REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3589 This commit is to remove the support of py 2.7.10 UEFI port. Py2.7.10 is no more supported as it has reached EOL starting from 1st Jan 2020. You may use the version py 3.6.8 available for uefi shell from edk2-libc. Cc: Rebecca Cran Cc: Michael D Kinney Signed-off-by: Jayaprakash N --- AppPkg/AppPkg.dsc | 3 - .../Python/Python-2.7.10/Ia32/pyconfig.h | 1302 -- .../Python/Python-2.7.10/Include/Python-ast.h | 535 - .../Python/Python-2.7.10/Include/Python.h | 178 - .../Python/Python-2.7.10/Include/abstract.h | 1396 -- .../Python/Python-2.7.10/Include/asdl.h | 45 - .../Python/Python-2.7.10/Include/ast.h | 13 - .../Python/Python-2.7.10/Include/bitset.h | 32 - .../Python/Python-2.7.10/Include/boolobject.h | 36 - .../Python-2.7.10/Include/bufferobject.h | 33 - .../Python-2.7.10/Include/bytearrayobject.h | 57 - .../Python-2.7.10/Include/bytes_methods.h | 75 - .../Python-2.7.10/Include/bytesobject.h | 27 - .../Python/Python-2.7.10/Include/cStringIO.h | 73 - .../Python/Python-2.7.10/Include/cellobject.h | 28 - .../Python/Python-2.7.10/Include/ceval.h | 153 - .../Python-2.7.10/Include/classobject.h | 83 - .../Python/Python-2.7.10/Include/cobject.h | 89 - .../Python/Python-2.7.10/Include/code.h | 107 - .../Python/Python-2.7.10/Include/codecs.h | 167 - .../Python/Python-2.7.10/Include/compile.h | 40 - .../Python-2.7.10/Include/complexobject.h | 66 - .../Python/Python-2.7.10/Include/datetime.h | 239 - .../Python-2.7.10/Include/descrobject.h | 94 - .../Python/Python-2.7.10/Include/dictobject.h | 156 - .../Python/Python-2.7.10/Include/dtoa.h | 15 - .../Python/Python-2.7.10/Include/enumobject.h | 17 - .../Python/Python-2.7.10/Include/errcode.h | 36 - .../Python/Python-2.7.10/Include/eval.h | 25 - .../Python/Python-2.7.10/Include/fileobject.h | 97 - .../Python-2.7.10/Include/floatobject.h | 140 - .../Python-2.7.10/Include/frameobject.h | 89 - .../Python/Python-2.7.10/Include/funcobject.h | 76 - .../Python/Python-2.7.10/Include/genobject.h | 40 - .../Python/Python-2.7.10/Include/graminit.h | 87 - .../Python/Python-2.7.10/Include/grammar.h | 93 - .../Python/Python-2.7.10/Include/import.h | 71 - .../Python/Python-2.7.10/Include/intobject.h | 81 - .../Python/Python-2.7.10/Include/intrcheck.h | 15 - .../Python/Python-2.7.10/Include/iterobject.h | 23 - .../Python/Python-2.7.10/Include/listobject.h | 68 - .../Python-2.7.10/Include/longintrepr.h | 103 - .../Python/Python-2.7.10/Include/longobject.h | 135 - .../Python/Python-2.7.10/Include/marshal.h | 25 - .../Python-2.7.10/Include/memoryobject.h | 74 - .../Python-2.7.10/Include/metagrammar.h | 18 - .../Python-2.7.10/Include/methodobject.h | 93 - .../Python/Python-2.7.10/Include/modsupport.h | 134 - .../Python-2.7.10/Include/moduleobject.h | 24 - .../Python/Python-2.7.10/Include/node.h | 41 - .../Python/Python-2.7.10/Include/object.h | 1013 - .../Python/Python-2.7.10/Include/objimpl.h | 354 - .../Python/Python-2.7.10/Include/opcode.h | 162 - .../Python/Python-2.7.10/Include/osdefs.h | 63 - .../Python/Python-2.7.10/Include/parsetok.h | 64 - .../Python/Python-2.7.10/Include/patchlevel.h | 43 - .../Python/Python-2.7.10/Include/pgen.h | 18 - .../Python-2.7.10/Include/pgenheaders.h | 42 - .../Python/Python-2.7.10/Include/py_curses.h | 176 - .../Python/Python-2.7.10/Include/pyarena.h | 62 - .../Python/Python-2.7.10/Include/pycapsule.h | 56 - .../Python/Python-2.7.10/Include/pyctype.h | 31 - .../Python/Python-2.7.10/Include/pydebug.h | 41 - .../Python/Python-2.7.10/Include/pyerrors.h | 329 - .../Python/Python-2.7.10/Include/pyexpat.h | 48 - .../Python/Python-2.7.10/Include/pyfpe.h | 176 - .../Python/Python-2.7.10/Include/pygetopt.h | 18 - .../Python-2.7.10/Include/pymacconfig.h | 102 - .../Python-2.7.10/Include/pymactoolbox.h | 217 - .../Python/Python-2.7.10/Include/pymath.h | 192 - .../Python/Python-2.7.10/Include/pymem.h | 122 - .../Python/Python-2.7.10/Include/pyport.h | 941 - .../Python/Python-2.7.10/Include/pystate.h | 200 - .../Python/Python-2.7.10/Include/pystrcmp.h | 23 - .../Python/Python-2.7.10/Include/pystrtod.h | 45 - .../Python/Python-2.7.10/Include/pythonrun.h | 182 - .../Python/Python-2.7.10/Include/pythread.h | 41 - .../Python-2.7.10/Include/rangeobject.h | 28 - .../Python/Python-2.7.10/Include/setobject.h | 99 - .../Python-2.7.10/Include/sliceobject.h | 44 - .../Python-2.7.10/Include/stringobject.h | 210 - .../Python-2.7.10/Include/structmember.h | 99 - .../Python/Python-2.7.10/Include/structseq.h | 41 - .../Python/Python-2.7.10/Include/symtable.h | 98 - .../Python/Python-2.7.10/Include/sysmodule.h | 31 - .../Python/Python-2.7.10/Include/timefuncs.h | 26 - .../Python/Python-2.7.10/Include/token.h | 85 - .../Python/Python-2.7.10/Include/traceback.h | 31 - .../Python-2.7.10/Include/tupleobject.h | 61 - .../Python/Python-2.7.10/Include/ucnhash.h | 33 - .../Python-2.7.10/Include/unicodeobject.h | 1413 -- .../Python/Python-2.7.10/Include/warnings.h | 23 - .../Python-2.7.10/Include/weakrefobject.h | 82 - .../Applications/Python/Python-2.7.10/LICENSE | 254 - .../Python-2.7.10/Lib/BaseHTTPServer.py | 603 - .../Python/Python-2.7.10/Lib/HTMLParser.py | 475 - .../Python-2.7.10/Lib/SimpleHTTPServer.py | 235 - .../Python/Python-2.7.10/Lib/SocketServer.py | 737 - .../Python/Python-2.7.10/Lib/StringIO.py | 324 - .../Python/Python-2.7.10/Lib/UserDict.py | 180 - .../Python/Python-2.7.10/Lib/_abcoll.py | 692 - .../Python/Python-2.7.10/Lib/_weakrefset.py | 204 - .../Python/Python-2.7.10/Lib/abc.py | 185 - .../Python/Python-2.7.10/Lib/argparse.py | 2374 --- .../Python/Python-2.7.10/Lib/ast.py | 311 - .../Python/Python-2.7.10/Lib/atexit.py | 65 - .../Python/Python-2.7.10/Lib/binhex.py | 518 - .../Python/Python-2.7.10/Lib/bisect.py | 92 - .../Python/Python-2.7.10/Lib/calendar.py | 713 - .../Python/Python-2.7.10/Lib/cmd.py | 404 - .../Python/Python-2.7.10/Lib/codecs.py | 1101 - .../Python/Python-2.7.10/Lib/collections.py | 730 - .../Python/Python-2.7.10/Lib/compileall.py | 227 - .../Python/Python-2.7.10/Lib/copy.py | 433 - .../Python/Python-2.7.10/Lib/copy_reg.py | 201 - .../Python/Python-2.7.10/Lib/csv.py | 456 - .../Python/Python-2.7.10/Lib/dis.py | 224 - .../Python/Python-2.7.10/Lib/dummy_thread.py | 145 - .../Python-2.7.10/Lib/encodings/__init__.py | 157 - .../Python-2.7.10/Lib/encodings/aliases.py | 527 - .../Python-2.7.10/Lib/encodings/ascii.py | 50 - .../Lib/encodings/base64_codec.py | 79 - .../Python-2.7.10/Lib/encodings/big5.py | 39 - .../Python-2.7.10/Lib/encodings/big5hkscs.py | 39 - .../Python-2.7.10/Lib/encodings/bz2_codec.py | 102 - .../Python-2.7.10/Lib/encodings/charmap.py | 69 - .../Python-2.7.10/Lib/encodings/cp037.py | 307 - .../Python-2.7.10/Lib/encodings/cp1006.py | 307 - .../Python-2.7.10/Lib/encodings/cp1026.py | 307 - .../Python-2.7.10/Lib/encodings/cp1140.py | 307 - .../Python-2.7.10/Lib/encodings/cp1250.py | 307 - .../Python-2.7.10/Lib/encodings/cp1251.py | 307 - .../Python-2.7.10/Lib/encodings/cp1252.py | 307 - .../Python-2.7.10/Lib/encodings/cp1253.py | 307 - .../Python-2.7.10/Lib/encodings/cp1254.py | 307 - .../Python-2.7.10/Lib/encodings/cp1255.py | 307 - .../Python-2.7.10/Lib/encodings/cp1256.py | 307 - .../Python-2.7.10/Lib/encodings/cp1257.py | 307 - .../Python-2.7.10/Lib/encodings/cp1258.py | 307 - .../Python-2.7.10/Lib/encodings/cp424.py | 307 - .../Python-2.7.10/Lib/encodings/cp437.py | 698 - .../Python-2.7.10/Lib/encodings/cp500.py | 307 - .../Python-2.7.10/Lib/encodings/cp720.py | 309 - .../Python-2.7.10/Lib/encodings/cp737.py | 698 - .../Python-2.7.10/Lib/encodings/cp775.py | 697 - .../Python-2.7.10/Lib/encodings/cp850.py | 698 - .../Python-2.7.10/Lib/encodings/cp852.py | 698 - .../Python-2.7.10/Lib/encodings/cp855.py | 698 - .../Python-2.7.10/Lib/encodings/cp856.py | 307 - .../Python-2.7.10/Lib/encodings/cp857.py | 694 - .../Python-2.7.10/Lib/encodings/cp858.py | 698 - .../Python-2.7.10/Lib/encodings/cp860.py | 698 - .../Python-2.7.10/Lib/encodings/cp861.py | 698 - .../Python-2.7.10/Lib/encodings/cp862.py | 698 - .../Python-2.7.10/Lib/encodings/cp863.py | 698 - .../Python-2.7.10/Lib/encodings/cp864.py | 690 - .../Python-2.7.10/Lib/encodings/cp865.py | 698 - .../Python-2.7.10/Lib/encodings/cp866.py | 698 - .../Python-2.7.10/Lib/encodings/cp869.py | 689 - .../Python-2.7.10/Lib/encodings/cp874.py | 307 - .../Python-2.7.10/Lib/encodings/cp875.py | 307 - .../Python-2.7.10/Lib/encodings/cp932.py | 39 - .../Python-2.7.10/Lib/encodings/cp949.py | 39 - .../Python-2.7.10/Lib/encodings/cp950.py | 39 - .../Lib/encodings/euc_jis_2004.py | 39 - .../Lib/encodings/euc_jisx0213.py | 39 - .../Python-2.7.10/Lib/encodings/euc_jp.py | 39 - .../Python-2.7.10/Lib/encodings/euc_kr.py | 39 - .../Python-2.7.10/Lib/encodings/gb18030.py | 39 - .../Python-2.7.10/Lib/encodings/gb2312.py | 39 - .../Python/Python-2.7.10/Lib/encodings/gbk.py | 39 - .../Python-2.7.10/Lib/encodings/hex_codec.py | 79 - .../Python-2.7.10/Lib/encodings/hp_roman8.py | 152 - .../Python/Python-2.7.10/Lib/encodings/hz.py | 39 - .../Python-2.7.10/Lib/encodings/idna.py | 288 - .../Python-2.7.10/Lib/encodings/iso2022_jp.py | 39 - .../Lib/encodings/iso2022_jp_1.py | 39 - .../Lib/encodings/iso2022_jp_2.py | 39 - .../Lib/encodings/iso2022_jp_2004.py | 39 - .../Lib/encodings/iso2022_jp_3.py | 39 - .../Lib/encodings/iso2022_jp_ext.py | 39 - .../Python-2.7.10/Lib/encodings/iso2022_kr.py | 39 - .../Python-2.7.10/Lib/encodings/iso8859_1.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_10.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_11.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_13.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_14.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_15.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_16.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_2.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_3.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_4.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_5.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_6.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_7.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_8.py | 307 - .../Python-2.7.10/Lib/encodings/iso8859_9.py | 307 - .../Python-2.7.10/Lib/encodings/johab.py | 39 - .../Python-2.7.10/Lib/encodings/koi8_r.py | 307 - .../Python-2.7.10/Lib/encodings/koi8_u.py | 307 - .../Python-2.7.10/Lib/encodings/latin_1.py | 50 - .../Python-2.7.10/Lib/encodings/mac_arabic.py | 698 - .../Lib/encodings/mac_centeuro.py | 307 - .../Lib/encodings/mac_croatian.py | 307 - .../Lib/encodings/mac_cyrillic.py | 307 - .../Python-2.7.10/Lib/encodings/mac_farsi.py | 307 - .../Python-2.7.10/Lib/encodings/mac_greek.py | 307 - .../Lib/encodings/mac_iceland.py | 307 - .../Python-2.7.10/Lib/encodings/mac_latin2.py | 183 - .../Python-2.7.10/Lib/encodings/mac_roman.py | 307 - .../Lib/encodings/mac_romanian.py | 307 - .../Lib/encodings/mac_turkish.py | 307 - .../Python-2.7.10/Lib/encodings/mbcs.py | 47 - .../Python-2.7.10/Lib/encodings/palmos.py | 83 - .../Python-2.7.10/Lib/encodings/ptcp154.py | 175 - .../Python-2.7.10/Lib/encodings/punycode.py | 238 - .../Lib/encodings/quopri_codec.py | 75 - .../Lib/encodings/raw_unicode_escape.py | 45 - .../Python-2.7.10/Lib/encodings/rot_13.py | 118 - .../Python-2.7.10/Lib/encodings/shift_jis.py | 39 - .../Lib/encodings/shift_jis_2004.py | 39 - .../Lib/encodings/shift_jisx0213.py | 39 - .../Lib/encodings/string_escape.py | 38 - .../Python-2.7.10/Lib/encodings/tis_620.py | 307 - .../Python-2.7.10/Lib/encodings/undefined.py | 49 - .../Lib/encodings/unicode_escape.py | 45 - .../Lib/encodings/unicode_internal.py | 45 - .../Python-2.7.10/Lib/encodings/utf_16.py | 126 - .../Python-2.7.10/Lib/encodings/utf_16_be.py | 42 - .../Python-2.7.10/Lib/encodings/utf_16_le.py | 42 - .../Python-2.7.10/Lib/encodings/utf_32.py | 150 - .../Python-2.7.10/Lib/encodings/utf_32_be.py | 37 - .../Python-2.7.10/Lib/encodings/utf_32_le.py | 37 - .../Python-2.7.10/Lib/encodings/utf_7.py | 38 - .../Python-2.7.10/Lib/encodings/utf_8.py | 42 - .../Python-2.7.10/Lib/encodings/utf_8_sig.py | 117 - .../Python-2.7.10/Lib/encodings/uu_codec.py | 129 - .../Python-2.7.10/Lib/encodings/zlib_codec.py | 102 - .../Python/Python-2.7.10/Lib/fileinput.py | 417 - .../Python/Python-2.7.10/Lib/fnmatch.py | 120 - .../Python/Python-2.7.10/Lib/formatter.py | 445 - .../Python/Python-2.7.10/Lib/functools.py | 100 - .../Python/Python-2.7.10/Lib/genericpath.py | 113 - .../Python/Python-2.7.10/Lib/getopt.py | 210 - .../Python/Python-2.7.10/Lib/gettext.py | 594 - .../Python/Python-2.7.10/Lib/hashlib.py | 221 - .../Python/Python-2.7.10/Lib/heapq.py | 485 - .../Python-2.7.10/Lib/importlib/__init__.py | 38 - .../Python/Python-2.7.10/Lib/inspect.py | 1059 - .../Python/Python-2.7.10/Lib/io.py | 90 - .../Python/Python-2.7.10/Lib/json/__init__.py | 351 - .../Python/Python-2.7.10/Lib/json/decoder.py | 385 - .../Python/Python-2.7.10/Lib/json/encoder.py | 448 - .../Python/Python-2.7.10/Lib/json/scanner.py | 67 - .../Python-2.7.10/Lib/json/tests/__init__.py | 73 - .../Lib/json/tests/test_check_circular.py | 34 - .../Lib/json/tests/test_decode.py | 69 - .../Lib/json/tests/test_default.py | 12 - .../Python-2.7.10/Lib/json/tests/test_dump.py | 32 - .../tests/test_encode_basestring_ascii.py | 41 - .../Python-2.7.10/Lib/json/tests/test_fail.py | 105 - .../Lib/json/tests/test_float.py | 37 - .../Lib/json/tests/test_indent.py | 60 - .../Lib/json/tests/test_pass1.py | 75 - .../Lib/json/tests/test_pass2.py | 18 - .../Lib/json/tests/test_pass3.py | 24 - .../Lib/json/tests/test_recursion.py | 108 - .../Lib/json/tests/test_scanstring.py | 157 - .../Lib/json/tests/test_separators.py | 44 - .../Lib/json/tests/test_speedups.py | 23 - .../Python-2.7.10/Lib/json/tests/test_tool.py | 69 - .../Lib/json/tests/test_unicode.py | 89 - .../Python/Python-2.7.10/Lib/json/tool.py | 40 - .../Python/Python-2.7.10/Lib/keyword.py | 93 - .../Python/Python-2.7.10/Lib/linecache.py | 139 - .../Python/Python-2.7.10/Lib/locale.py | 2062 -- .../Python/Python-2.7.10/Lib/md5.py | 14 - .../Python/Python-2.7.10/Lib/modulefinder.py | 673 - .../Python/Python-2.7.10/Lib/numbers.py | 391 - .../Python/Python-2.7.10/Lib/opcode.py | 192 - .../Python/Python-2.7.10/Lib/optparse.py | 1704 -- .../Python/Python-2.7.10/Lib/pkgutil.py | 591 - .../Python/Python-2.7.10/Lib/platform.py | 1655 -- .../Python-2.7.10/Lib/pydoc_data/__init__.py | 0 .../Python-2.7.10/Lib/pydoc_data/topics.py | 80 - .../Python/Python-2.7.10/Lib/random.py | 910 - .../Python/Python-2.7.10/Lib/re.py | 340 - .../Python/Python-2.7.10/Lib/repr.py | 132 - .../Python/Python-2.7.10/Lib/runpy.py | 278 - .../Python/Python-2.7.10/Lib/sha.py | 15 - .../Python/Python-2.7.10/Lib/shutil.py | 555 - .../Python-2.7.10/Lib/site-packages/README | 2 - .../Python/Python-2.7.10/Lib/socket.py | 577 - .../Python/Python-2.7.10/Lib/sre.py | 13 - .../Python/Python-2.7.10/Lib/sre_compile.py | 596 - .../Python/Python-2.7.10/Lib/sre_constants.py | 263 - .../Python/Python-2.7.10/Lib/sre_parse.py | 834 - .../Python/Python-2.7.10/Lib/stat.py | 96 - .../Python/Python-2.7.10/Lib/string.py | 656 - .../Python/Python-2.7.10/Lib/struct.py | 3 - .../Python/Python-2.7.10/Lib/sysconfig.py | 640 - .../Python/Python-2.7.10/Lib/textwrap.py | 425 - .../Python/Python-2.7.10/Lib/token.py | 140 - .../Python/Python-2.7.10/Lib/tokenize.py | 432 - .../Python/Python-2.7.10/Lib/traceback.py | 320 - .../Python/Python-2.7.10/Lib/types.py | 86 - .../Python/Python-2.7.10/Lib/urlparse.py | 428 - .../Python/Python-2.7.10/Lib/warnings.py | 404 - .../Python/Python-2.7.10/Lib/weakref.py | 443 - .../Python/Python-2.7.10/Lib/xml/__init__.py | 41 - .../Python-2.7.10/Lib/xml/dom/NodeFilter.py | 27 - .../Python-2.7.10/Lib/xml/dom/__init__.py | 139 - .../Python-2.7.10/Lib/xml/dom/domreg.py | 99 - .../Python-2.7.10/Lib/xml/dom/expatbuilder.py | 983 - .../Python-2.7.10/Lib/xml/dom/minicompat.py | 110 - .../Python-2.7.10/Lib/xml/dom/minidom.py | 1941 -- .../Python-2.7.10/Lib/xml/dom/pulldom.py | 351 - .../Python-2.7.10/Lib/xml/dom/xmlbuilder.py | 386 - .../Lib/xml/etree/ElementInclude.py | 142 - .../Lib/xml/etree/ElementPath.py | 303 - .../Lib/xml/etree/ElementTree.py | 1667 -- .../Python-2.7.10/Lib/xml/etree/__init__.py | 33 - .../Lib/xml/etree/cElementTree.py | 3 - .../Python-2.7.10/Lib/xml/parsers/__init__.py | 8 - .../Python-2.7.10/Lib/xml/parsers/expat.py | 4 - .../Python-2.7.10/Lib/xml/sax/__init__.py | 108 - .../Python-2.7.10/Lib/xml/sax/_exceptions.py | 131 - .../Python-2.7.10/Lib/xml/sax/expatreader.py | 430 - .../Python-2.7.10/Lib/xml/sax/handler.py | 342 - .../Python-2.7.10/Lib/xml/sax/saxutils.py | 353 - .../Python-2.7.10/Lib/xml/sax/xmlreader.py | 381 - .../Python/Python-2.7.10/Lib/xmllib.py | 930 - .../Python/Python-2.7.10/Lib/zipfile.py | 1539 -- .../Python-2.7.10/Modules/_bisectmodule.c | 246 - .../Python-2.7.10/Modules/_codecsmodule.c | 1116 - .../Modules/_collectionsmodule.c | 1706 -- .../Python/Python-2.7.10/Modules/_csv.c | 1629 -- .../Python-2.7.10/Modules/_functoolsmodule.c | 398 - .../Python-2.7.10/Modules/_heapqmodule.c | 696 - .../Python-2.7.10/Modules/_io/_iomodule.c | 777 - .../Python-2.7.10/Modules/_io/_iomodule.h | 170 - .../Python-2.7.10/Modules/_io/bufferedio.c | 2446 --- .../Python-2.7.10/Modules/_io/bytesio.c | 909 - .../Python/Python-2.7.10/Modules/_io/fileio.c | 1118 - .../Python/Python-2.7.10/Modules/_io/iobase.c | 913 - .../Python-2.7.10/Modules/_io/stringio.c | 895 - .../Python/Python-2.7.10/Modules/_io/textio.c | 2670 --- .../Python/Python-2.7.10/Modules/_json.c | 2409 --- .../Python-2.7.10/Modules/_localemodule.c | 758 - .../Python/Python-2.7.10/Modules/_math.c | 255 - .../Python/Python-2.7.10/Modules/_math.h | 41 - .../Python-2.7.10/Modules/_randommodule.c | 595 - .../Python/Python-2.7.10/Modules/_struct.c | 2097 -- .../Python/Python-2.7.10/Modules/_weakref.c | 112 - .../Python/Python-2.7.10/Modules/addrinfo.h | 176 - .../Python-2.7.10/Modules/arraymodule.c | 2261 -- .../Python/Python-2.7.10/Modules/binascii.c | 1516 -- .../Python/Python-2.7.10/Modules/cPickle.c | 6058 ------ .../Python/Python-2.7.10/Modules/cStringIO.c | 779 - .../Python-2.7.10/Modules/cjkcodecs/README | 79 - .../Modules/cjkcodecs/_codecs_cn.c | 444 - .../Modules/cjkcodecs/_codecs_hk.c | 184 - .../Modules/cjkcodecs/_codecs_iso2022.c | 1131 - .../Modules/cjkcodecs/_codecs_jp.c | 731 - .../Modules/cjkcodecs/_codecs_kr.c | 452 - .../Modules/cjkcodecs/_codecs_tw.c | 132 - .../Modules/cjkcodecs/alg_jisx0201.h | 24 - .../Modules/cjkcodecs/cjkcodecs.h | 398 - .../Modules/cjkcodecs/emu_jisx0213_2000.h | 43 - .../Modules/cjkcodecs/mappings_cn.h | 4103 ---- .../Modules/cjkcodecs/mappings_hk.h | 2378 --- .../cjkcodecs/mappings_jisx0213_pair.h | 59 - .../Modules/cjkcodecs/mappings_jp.h | 4765 ----- .../Modules/cjkcodecs/mappings_kr.h | 3251 --- .../Modules/cjkcodecs/mappings_tw.h | 2633 --- .../Modules/cjkcodecs/multibytecodec.c | 1832 -- .../Modules/cjkcodecs/multibytecodec.h | 141 - .../Python-2.7.10/Modules/cmathmodule.c | 1217 -- .../Python-2.7.10/Modules/datetimemodule.c | 5117 ----- .../Python-2.7.10/Modules/expat/COPYING | 22 - .../Python-2.7.10/Modules/expat/ascii.h | 92 - .../Python-2.7.10/Modules/expat/asciitab.h | 36 - .../Python-2.7.10/Modules/expat/expat.h | 1049 - .../Modules/expat/expat_external.h | 119 - .../Python-2.7.10/Modules/expat/iasciitab.h | 37 - .../Python-2.7.10/Modules/expat/internal.h | 73 - .../Python-2.7.10/Modules/expat/latin1tab.h | 36 - .../Python-2.7.10/Modules/expat/nametab.h | 150 - .../Python-2.7.10/Modules/expat/utf8tab.h | 37 - .../Python-2.7.10/Modules/expat/xmlparse.c | 6403 ------ .../Python-2.7.10/Modules/expat/xmlrole.c | 1336 -- .../Python-2.7.10/Modules/expat/xmlrole.h | 114 - .../Python-2.7.10/Modules/expat/xmltok.c | 1651 -- .../Python-2.7.10/Modules/expat/xmltok.h | 316 - .../Python-2.7.10/Modules/expat/xmltok_impl.c | 1783 -- .../Python-2.7.10/Modules/expat/xmltok_impl.h | 46 - .../Python-2.7.10/Modules/expat/xmltok_ns.c | 115 - .../Python-2.7.10/Modules/future_builtins.c | 105 - .../Python/Python-2.7.10/Modules/gcmodule.c | 1570 -- .../Python-2.7.10/Modules/getbuildinfo.c | 85 - .../Python-2.7.10/Modules/itertoolsmodule.c | 4143 ---- .../Python/Python-2.7.10/Modules/mathmodule.c | 1634 -- .../Python/Python-2.7.10/Modules/md5.c | 394 - .../Python/Python-2.7.10/Modules/md5.h | 91 - .../Python/Python-2.7.10/Modules/md5module.c | 339 - .../Python/Python-2.7.10/Modules/operator.c | 930 - .../Python-2.7.10/Modules/parsermodule.c | 3493 ---- .../Python/Python-2.7.10/Modules/pyexpat.c | 2143 -- .../Python/Python-2.7.10/Modules/python.c | 24 - .../Python-2.7.10/Modules/sha256module.c | 706 - .../Python-2.7.10/Modules/sha512module.c | 774 - .../Python/Python-2.7.10/Modules/shamodule.c | 623 - .../Python-2.7.10/Modules/signalmodule.c | 1011 - .../Python-2.7.10/Modules/socketmodule.c | 5556 ----- .../Python-2.7.10/Modules/socketmodule.h | 251 - .../Python/Python-2.7.10/Modules/sre.h | 104 - .../Python-2.7.10/Modules/sre_constants.h | 86 - .../Python-2.7.10/Modules/stropmodule.c | 1272 -- .../Python-2.7.10/Modules/symtablemodule.c | 86 - .../Python/Python-2.7.10/Modules/timemodule.c | 1064 - .../Python-2.7.10/Modules/unicodedata.c | 1287 -- .../Python-2.7.10/Modules/unicodedata_db.h | 6202 ------ .../Python-2.7.10/Modules/unicodename_db.h | 17259 ---------------- .../Python/Python-2.7.10/Modules/xxsubtype.c | 297 - .../Python/Python-2.7.10/Modules/zipimport.c | 1257 -- .../Python-2.7.10/Modules/zlib/ChangeLog | 1472 -- .../Python/Python-2.7.10/Modules/zlib/FAQ | 368 - .../Python/Python-2.7.10/Modules/zlib/INDEX | 68 - .../Python/Python-2.7.10/Modules/zlib/README | 115 - .../Python-2.7.10/Modules/zlib/adler32.c | 179 - .../Python-2.7.10/Modules/zlib/algorithm.txt | 209 - .../Python-2.7.10/Modules/zlib/compress.c | 80 - .../Python-2.7.10/Modules/zlib/configure | 831 - .../Python/Python-2.7.10/Modules/zlib/crc32.c | 425 - .../Python/Python-2.7.10/Modules/zlib/crc32.h | 441 - .../Python-2.7.10/Modules/zlib/deflate.c | 1967 -- .../Python-2.7.10/Modules/zlib/deflate.h | 346 - .../Python-2.7.10/Modules/zlib/example.c | 601 - .../Python-2.7.10/Modules/zlib/gzclose.c | 25 - .../Python-2.7.10/Modules/zlib/gzguts.h | 209 - .../Python/Python-2.7.10/Modules/zlib/gzlib.c | 634 - .../Python-2.7.10/Modules/zlib/gzread.c | 594 - .../Python-2.7.10/Modules/zlib/gzwrite.c | 577 - .../Python-2.7.10/Modules/zlib/infback.c | 640 - .../Python-2.7.10/Modules/zlib/inffast.c | 340 - .../Python-2.7.10/Modules/zlib/inffast.h | 11 - .../Python-2.7.10/Modules/zlib/inffixed.h | 94 - .../Python-2.7.10/Modules/zlib/inflate.c | 1512 -- .../Python-2.7.10/Modules/zlib/inflate.h | 122 - .../Python-2.7.10/Modules/zlib/inftrees.c | 306 - .../Python-2.7.10/Modules/zlib/inftrees.h | 62 - .../Python-2.7.10/Modules/zlib/minigzip.c | 651 - .../Python/Python-2.7.10/Modules/zlib/trees.c | 1226 -- .../Python/Python-2.7.10/Modules/zlib/trees.h | 128 - .../Python-2.7.10/Modules/zlib/uncompr.c | 59 - .../Python/Python-2.7.10/Modules/zlib/zconf.h | 511 - .../Python/Python-2.7.10/Modules/zlib/zlib.3 | 151 - .../Python/Python-2.7.10/Modules/zlib/zlib.h | 1768 -- .../Python/Python-2.7.10/Modules/zlib/zutil.c | 324 - .../Python/Python-2.7.10/Modules/zlib/zutil.h | 253 - .../Python/Python-2.7.10/Modules/zlibmodule.c | 1093 - .../Python/Python-2.7.10/Objects/abstract.c | 3109 --- .../Python/Python-2.7.10/Objects/boolobject.c | 202 - .../Python-2.7.10/Objects/bufferobject.c | 878 - .../Python-2.7.10/Objects/bytearrayobject.c | 3052 --- .../Python-2.7.10/Objects/bytes_methods.c | 398 - .../Python/Python-2.7.10/Objects/capsule.c | 324 - .../Python/Python-2.7.10/Objects/cellobject.c | 145 - .../Python-2.7.10/Objects/classobject.c | 2696 --- .../Python/Python-2.7.10/Objects/cobject.c | 172 - .../Python/Python-2.7.10/Objects/codeobject.c | 581 - .../Python-2.7.10/Objects/complexobject.c | 1357 -- .../Python-2.7.10/Objects/descrobject.c | 1440 -- .../Python-2.7.10/Objects/dictnotes.txt | 270 - .../Python/Python-2.7.10/Objects/dictobject.c | 3248 --- .../Python/Python-2.7.10/Objects/enumobject.c | 381 - .../Python/Python-2.7.10/Objects/exceptions.c | 2231 -- .../Python/Python-2.7.10/Objects/fileobject.c | 2889 --- .../Python-2.7.10/Objects/floatobject.c | 2708 --- .../Python-2.7.10/Objects/frameobject.c | 984 - .../Python/Python-2.7.10/Objects/funcobject.c | 895 - .../Python/Python-2.7.10/Objects/genobject.c | 417 - .../Python/Python-2.7.10/Objects/intobject.c | 1581 -- .../Python/Python-2.7.10/Objects/iterobject.c | 230 - .../Python/Python-2.7.10/Objects/listobject.c | 3045 --- .../Python/Python-2.7.10/Objects/listsort.txt | 755 - .../Python-2.7.10/Objects/lnotab_notes.txt | 124 - .../Python-2.7.10/Objects/memoryobject.c | 842 - .../Python-2.7.10/Objects/methodobject.c | 427 - .../Python-2.7.10/Objects/moduleobject.c | 262 - .../Python/Python-2.7.10/Objects/object.c | 2513 --- .../Python/Python-2.7.10/Objects/obmalloc.c | 1937 -- .../Python-2.7.10/Objects/rangeobject.c | 347 - .../Python/Python-2.7.10/Objects/setobject.c | 2514 --- .../Python-2.7.10/Objects/sliceobject.c | 362 - .../Objects/stringlib/README.txt | 40 - .../Python-2.7.10/Objects/stringlib/count.h | 30 - .../Python-2.7.10/Objects/stringlib/ctype.h | 109 - .../Objects/stringlib/fastsearch.h | 160 - .../Python-2.7.10/Objects/stringlib/find.h | 175 - .../Objects/stringlib/formatter.h | 1539 -- .../Objects/stringlib/partition.h | 110 - .../Python-2.7.10/Objects/stringlib/split.h | 394 - .../Objects/stringlib/string_format.h | 1361 -- .../Objects/stringlib/stringdefs.h | 33 - .../Objects/stringlib/transmogrify.h | 264 - .../Objects/stringlib/unicodedefs.h | 37 - .../Python-2.7.10/Objects/stringobject.c | 4847 ----- .../Python/Python-2.7.10/Objects/structseq.c | 540 - .../Python-2.7.10/Objects/tupleobject.c | 1040 - .../Python/Python-2.7.10/Objects/typeobject.c | 6748 ------ .../Python-2.7.10/Objects/unicodectype.c | 215 - .../Python-2.7.10/Objects/unicodeobject.c | 8994 -------- .../Python-2.7.10/Objects/unicodetype_db.h | 3337 --- .../Python-2.7.10/Objects/weakrefobject.c | 981 - .../Python/Python-2.7.10/Parser/acceler.c | 125 - .../Python/Python-2.7.10/Parser/bitset.c | 66 - .../Python/Python-2.7.10/Parser/firstsets.c | 113 - .../Python/Python-2.7.10/Parser/grammar.c | 254 - .../Python/Python-2.7.10/Parser/grammar1.c | 57 - .../Python/Python-2.7.10/Parser/listnode.c | 66 - .../Python/Python-2.7.10/Parser/metagrammar.c | 159 - .../Python/Python-2.7.10/Parser/myreadline.c | 218 - .../Python/Python-2.7.10/Parser/node.c | 164 - .../Python/Python-2.7.10/Parser/parser.c | 436 - .../Python/Python-2.7.10/Parser/parser.h | 42 - .../Python/Python-2.7.10/Parser/parsetok.c | 282 - .../Python/Python-2.7.10/Parser/tokenizer.c | 1755 -- .../Python/Python-2.7.10/Parser/tokenizer.h | 70 - .../Python/Python-2.7.10/Py2710ReadMe.txt | 259 - .../PyMod-2.7.10/Include/fileobject.h | 108 - .../PyMod-2.7.10/Include/osdefs.h | 81 - .../PyMod-2.7.10/Include/pyport.h | 957 - .../Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py | 568 - .../Python-2.7.10/PyMod-2.7.10/Lib/os.py | 769 - .../Python-2.7.10/PyMod-2.7.10/Lib/pydoc.py | 2423 --- .../Python-2.7.10/PyMod-2.7.10/Lib/site.py | 531 - .../Python-2.7.10/PyMod-2.7.10/Modules/_sre.c | 4048 ---- .../PyMod-2.7.10/Modules/addrinfo.h | 187 - .../PyMod-2.7.10/Modules/config.c | 155 - .../PyMod-2.7.10/Modules/edk2module.c | 4234 ---- .../PyMod-2.7.10/Modules/errnomodule.c | 844 - .../Modules/expat/expat_external.h | 121 - .../PyMod-2.7.10/Modules/getpath.c | 656 - .../Python-2.7.10/PyMod-2.7.10/Modules/main.c | 701 - .../PyMod-2.7.10/Modules/selectmodule.c | 1967 -- .../PyMod-2.7.10/Modules/zlib/gzguts.h | 215 - .../PyMod-2.7.10/Modules/zlib/zutil.h | 256 - .../PyMod-2.7.10/Objects/longobject.c | 4413 ---- .../Objects/stringlib/localeutil.h | 227 - .../PyMod-2.7.10/Python/getcopyright.c | 41 - .../PyMod-2.7.10/Python/marshal.c | 1423 -- .../PyMod-2.7.10/Python/random.c | 446 - .../Python/Python-2.7.10/Python/Python-ast.c | 6788 ------ .../Python/Python-2.7.10/Python/_warnings.c | 911 - .../Python/Python-2.7.10/Python/asdl.c | 64 - .../Python/Python-2.7.10/Python/ast.c | 3587 ---- .../Python/Python-2.7.10/Python/bltinmodule.c | 3061 --- .../Python/Python-2.7.10/Python/ceval.c | 4917 ----- .../Python/Python-2.7.10/Python/codecs.c | 889 - .../Python/Python-2.7.10/Python/compile.c | 4003 ---- .../Python/Python-2.7.10/Python/dtoa.c | 2949 --- .../Python-2.7.10/Python/dynload_stub.c | 11 - .../Python/Python-2.7.10/Python/errors.c | 827 - .../Python-2.7.10/Python/formatter_string.c | 17 - .../Python-2.7.10/Python/formatter_unicode.c | 18 - .../Python/Python-2.7.10/Python/frozen.c | 38 - .../Python/Python-2.7.10/Python/future.c | 137 - .../Python/Python-2.7.10/Python/getargs.c | 1908 -- .../Python/Python-2.7.10/Python/getcompiler.c | 28 - .../Python/Python-2.7.10/Python/getopt.c | 136 - .../Python/Python-2.7.10/Python/getplatform.c | 12 - .../Python/Python-2.7.10/Python/getversion.c | 15 - .../Python/Python-2.7.10/Python/graminit.c | 2177 -- .../Python/Python-2.7.10/Python/import.c | 3481 ---- .../Python/Python-2.7.10/Python/importdl.c | 78 - .../Python/Python-2.7.10/Python/importdl.h | 53 - .../Python/Python-2.7.10/Python/modsupport.c | 644 - .../Python/Python-2.7.10/Python/mysnprintf.c | 105 - .../Python/Python-2.7.10/Python/mystrtoul.c | 285 - .../Python/Python-2.7.10/Python/peephole.c | 667 - .../Python/Python-2.7.10/Python/pyarena.c | 213 - .../Python/Python-2.7.10/Python/pyctype.c | 214 - .../Python/Python-2.7.10/Python/pyfpe.c | 23 - .../Python/Python-2.7.10/Python/pymath.c | 79 - .../Python/Python-2.7.10/Python/pystate.c | 665 - .../Python/Python-2.7.10/Python/pystrcmp.c | 26 - .../Python/Python-2.7.10/Python/pystrtod.c | 1249 -- .../Python/Python-2.7.10/Python/pythonrun.c | 2029 -- .../Python-2.7.10/Python/structmember.c | 363 - .../Python/Python-2.7.10/Python/symtable.c | 1556 -- .../Python/Python-2.7.10/Python/sysmodule.c | 1800 -- .../Python/Python-2.7.10/Python/traceback.c | 283 - .../Python/Python-2.7.10/Python2710.inf | 255 - .../Applications/Python/Python-2.7.10/README | 1236 -- .../Python/Python-2.7.10/X64/pyconfig.h | 1305 -- .../Python/Python-2.7.10/libprep.bat | 20 - .../Python/Python-2.7.10/srcprep.bat | 13 - 598 files changed, 388336 deletions(-) delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Ia32/pyconfig.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/Python-ast.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/Python.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/abstract.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/asdl.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/ast.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/bitset.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/boolobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/bufferobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/bytearrayobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/bytes_methods.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/bytesobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/cStringIO.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/cellobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/ceval.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/cobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/code.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/codecs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/compile.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/complexobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/datetime.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/descrobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/dictobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/dtoa.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/enumobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/errcode.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/eval.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/fileobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/floatobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/frameobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/funcobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/genobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/graminit.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/grammar.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/import.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/intobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/intrcheck.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/iterobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/listobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/longintrepr.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/longobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/marshal.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/memoryobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/metagrammar.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/methodobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/modsupport.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/moduleobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/node.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/object.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/objimpl.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/opcode.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/osdefs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/parsetok.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/patchlevel.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pgen.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pgenheaders.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/py_curses.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pyarena.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pycapsule.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pyctype.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pydebug.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pyerrors.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pyexpat.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pyfpe.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pygetopt.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pymacconfig.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pymactoolbox.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pymath.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pyport.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pystate.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pystrcmp.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pystrtod.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pythonrun.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/pythread.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/rangeobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/setobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/sliceobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/stringobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/structmember.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/structseq.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/symtable.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/sysmodule.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/timefuncs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/token.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/traceback.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/ucnhash.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/unicodeobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/warnings.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Include/weakrefobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/LICENSE delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/io.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/random.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/re.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/string.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/token.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/types.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Lib/zipfile.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_bisectmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_codecsmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_collectionsmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_csv.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_functoolsmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_heapqmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bufferedio.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bytesio.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/fileio.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/iobase.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/stringio.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_io/textio.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_json.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_localemodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_math.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_math.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_randommodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_struct.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/_weakref.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/addrinfo.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/arraymodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/binascii.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cPickle.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cStringIO.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/README delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_cn.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_iso2022.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_jp.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_kr.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_tw.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/alg_jisx0201.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/cjkcodecs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/emu_jisx0213_2000.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_cn.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_hk.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jisx0213_pair.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jp.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_kr.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_tw.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/cmathmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/datetimemodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/COPYING delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/ascii.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/asciitab.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat_external.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/iasciitab.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/internal.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/latin1tab.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/nametab.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/utf8tab.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlparse.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_ns.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/future_builtins.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/gcmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/getbuildinfo.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/itertoolsmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/mathmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/md5.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/md5.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/md5module.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/operator.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/parsermodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/pyexpat.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/python.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/sha256module.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/sha512module.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/shamodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/signalmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/socketmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/socketmodule.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/sre.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/sre_constants.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/stropmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/symtablemodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/timemodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata_db.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/unicodename_db.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/xxsubtype.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zipimport.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/ChangeLog delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/FAQ delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/INDEX delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/README delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/adler32.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/algorithm.txt delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/compress.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/configure delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/example.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzclose.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzguts.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzlib.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzread.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzwrite.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/infback.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffixed.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/minigzip.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/uncompr.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zconf.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.3 delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Modules/zlibmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/abstract.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/boolobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/bufferobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/bytearrayobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/bytes_methods.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/capsule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/cellobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/classobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/cobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/codeobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/complexobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/descrobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/dictnotes.txt delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/dictobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/enumobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/exceptions.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/fileobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/floatobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/frameobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/funcobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/genobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/intobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/iterobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/listobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/listsort.txt delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/lnotab_notes.txt delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/memoryobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/methodobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/moduleobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/object.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/obmalloc.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/rangeobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/setobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/sliceobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/README.txt delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/count.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/ctype.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/fastsearch.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/find.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/formatter.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/partition.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/split.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/string_format.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/stringdefs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/transmogrify.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/unicodedefs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/stringobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/structseq.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/tupleobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/typeobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/unicodectype.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/unicodeobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/unicodetype_db.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Objects/weakrefobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/acceler.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/bitset.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/firstsets.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/grammar.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/grammar1.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/listnode.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/metagrammar.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/myreadline.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/node.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/parser.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/parser.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/parsetok.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Py2710ReadMe.txt delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/fileobject.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/osdefs.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/pyport.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/os.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/pydoc.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/site.py delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/_sre.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/addrinfo.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/config.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/edk2module.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/errnomodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/expat/expat_external.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/getpath.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/main.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/selectmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/gzguts.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/zutil.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/longobject.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/stringlib/localeutil.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/getcopyright.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/marshal.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/random.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/Python-ast.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/_warnings.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/asdl.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/ast.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/bltinmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/ceval.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/codecs.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/compile.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/dtoa.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/dynload_stub.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/errors.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/formatter_string.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/formatter_unicode.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/frozen.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/future.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/getargs.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/getcompiler.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/getopt.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/getplatform.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/getversion.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/graminit.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/import.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/importdl.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/importdl.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/modsupport.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/mysnprintf.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/mystrtoul.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/peephole.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pyarena.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pyctype.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pyfpe.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pymath.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pystate.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pystrcmp.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pystrtod.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/pythonrun.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/structmember.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/symtable.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/sysmodule.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python/traceback.c delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/Python2710.inf delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/README delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/X64/pyconfig.h delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/libprep.bat delete mode 100644 AppPkg/Applications/Python/Python-2.7.10/srcprep.bat diff --git a/AppPkg/AppPkg.dsc b/AppPkg/AppPkg.dsc index eb02539..e5a6c5e 100644 --- a/AppPkg/AppPkg.dsc +++ b/AppPkg/AppPkg.dsc @@ -120,9 +120,6 @@ gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80400040 } -#### Un-comment the following line to build Python 2.7.10. -# AppPkg/Applications/Python/Python-2.7.10/Python2710.inf - #### Un-comment the following line to build Python 3.6.8. # AppPkg/Applications/Python/Python-3.6.8/Python368.inf diff --git a/AppPkg/Applications/Python/Python-2.7.10/Ia32/pyconfig.h b/AppPkg/Applications/Python/Python-2.7.10/Ia32/pyconfig.h deleted file mode 100644 index 5a86ec3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Ia32/pyconfig.h +++ /dev/null @@ -1,1302 +0,0 @@ -/** @file - Manually generated Python Configuration file for EDK II. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#ifndef Py_PYCONFIG_H -#define Py_PYCONFIG_H - -#include - -#define PLATFORM "uefi" - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want - support for AIX C++ shared extension modules. */ -#undef AIX_GENUINE_CPLUSPLUS - -/* Define this if you have AtheOS threads. */ -#undef ATHEOS_THREADS - -/* Define this if you have BeOS threads. */ -#undef BEOS_THREADS - -/* Define if you have the Mach cthreads package */ -#undef C_THREADS - -/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM - mixed-endian order (byte order 45670123) */ -#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 - -/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most - significant byte first */ -#undef DOUBLE_IS_BIG_ENDIAN_IEEE754 - -/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the - least significant byte first */ -#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 - -/* Define if --enable-ipv6 is specified */ -#undef ENABLE_IPV6 - -/* Define if flock needs to be linked with bsd library. */ -#undef FLOCK_NEEDS_LIBBSD - -/* Define if getpgrp() must be called as getpgrp(0). */ -#undef GETPGRP_HAVE_ARG - -/* Define if gettimeofday() does not have second (timezone) argument This is - the case on Motorola V4 (R40V4.2) */ -#undef GETTIMEOFDAY_NO_TZ - -/* Define to 1 if you have the 'acosh' function. */ -#undef HAVE_ACOSH - -/* struct addrinfo (netdb.h) */ -#undef HAVE_ADDRINFO - -/* Define to 1 if you have the 'alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have the header file. */ -#undef HAVE_ALLOCA_H - -/* Define this if your time.h defines altzone. */ -#undef HAVE_ALTZONE - -/* Define to 1 if you have the 'asinh' function. */ -#undef HAVE_ASINH - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_TYPES_H - -/* Define to 1 if you have the 'atanh' function. */ -#undef HAVE_ATANH - -/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */ -#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE - -/* Define to 1 if you have the 'bind_textdomain_codeset' function. */ -#undef HAVE_BIND_TEXTDOMAIN_CODESET - -/* Define to 1 if you have the header file. */ -#undef HAVE_BLUETOOTH_BLUETOOTH_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_BLUETOOTH_H - -/* Define if nice() returns success/failure instead of the new priority. */ -#undef HAVE_BROKEN_NICE - -/* Define if the system reports an invalid PIPE_BUF value. */ -#undef HAVE_BROKEN_PIPE_BUF - -/* Define if poll() sets errno on invalid file descriptors. */ -#undef HAVE_BROKEN_POLL - -/* Define if the Posix semaphores do not work on your system */ -#define HAVE_BROKEN_POSIX_SEMAPHORES 1 - -/* Define if pthread_sigmask() does not work on your system. */ -#define HAVE_BROKEN_PTHREAD_SIGMASK 1 - -/* define to 1 if your sem_getvalue is broken. */ -#define HAVE_BROKEN_SEM_GETVALUE 1 - -/* Define if 'unsetenv' does not return an int. */ -#undef HAVE_BROKEN_UNSETENV - -/* Define this if you have the type _Bool. */ -#define HAVE_C99_BOOL 1 - -/* Define to 1 if you have the 'chflags' function. */ -#undef HAVE_CHFLAGS - -/* Define to 1 if you have the 'chown' function. */ -#undef HAVE_CHOWN - -/* Define if you have the 'chroot' function. */ -#undef HAVE_CHROOT - -/* Define to 1 if you have the 'clock' function. */ -#define HAVE_CLOCK 1 - -/* Define to 1 if you have the 'confstr' function. */ -#undef HAVE_CONFSTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_CONIO_H - -/* Define to 1 if you have the 'copysign' function. */ -#define HAVE_COPYSIGN 1 - -/* Define to 1 if you have the 'ctermid' function. */ -#undef HAVE_CTERMID - -/* Define if you have the 'ctermid_r' function. */ -#undef HAVE_CTERMID_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_CURSES_H - -/* Define if you have the 'is_term_resized' function. */ -#undef HAVE_CURSES_IS_TERM_RESIZED - -/* Define if you have the 'resizeterm' function. */ -#undef HAVE_CURSES_RESIZETERM - -/* Define if you have the 'resize_term' function. */ -#undef HAVE_CURSES_RESIZE_TERM - -/* Define to 1 if you have the declaration of 'isfinite', and to 0 if you - don't. */ -#define HAVE_DECL_ISFINITE 0 - -/* Define to 1 if you have the declaration of 'isinf', and to 0 if you don't. - */ -#define HAVE_DECL_ISINF 1 - -/* Define to 1 if you have the declaration of 'isnan', and to 0 if you don't. - */ -#define HAVE_DECL_ISNAN 1 - -/* Define to 1 if you have the declaration of 'tzname', and to 0 if you don't. - */ -#define HAVE_DECL_TZNAME 0 - -/* Define to 1 if you have the device macros. */ -#undef HAVE_DEVICE_MACROS - -/* Define to 1 if you have the /dev/ptc device file. */ -#undef HAVE_DEV_PTC - -/* Define to 1 if you have the /dev/ptmx device file. */ -#undef HAVE_DEV_PTMX - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRECT_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. - */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the 'dlopen' function. */ -#undef HAVE_DLOPEN - -/* Define to 1 if you have the 'dup2' function. */ -#define HAVE_DUP2 1 - -/* Defined when any dynamic module loading is enabled. */ -#undef HAVE_DYNAMIC_LOADING - -/* Define if you have the 'epoll' functions. */ -#undef HAVE_EPOLL - -/* Define to 1 if you have the 'erf' function. */ -#undef HAVE_ERF - -/* Define to 1 if you have the 'erfc' function. */ -#undef HAVE_ERFC - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the 'execv' function. */ -#undef HAVE_EXECV - -/* Define to 1 if you have the 'expm1' function. */ -#undef HAVE_EXPM1 - -/* Define if you have the 'fchdir' function. */ -#undef HAVE_FCHDIR - -/* Define to 1 if you have the 'fchmod' function. */ -#undef HAVE_FCHMOD - -/* Define to 1 if you have the 'fchown' function. */ -#undef HAVE_FCHOWN - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the 'fdatasync' function. */ -#undef HAVE_FDATASYNC - -/* Define to 1 if you have the 'finite' function. */ -#define HAVE_FINITE 1 - -/* Define to 1 if you have the 'flock' function. */ -#undef HAVE_FLOCK - -/* Define to 1 if you have the 'fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the 'forkpty' function. */ -#undef HAVE_FORKPTY - -/* Define to 1 if you have the 'fpathconf' function. */ -#undef HAVE_FPATHCONF - -/* Define to 1 if you have the 'fseek64' function. */ -#undef HAVE_FSEEK64 - -/* Define to 1 if you have the 'fseeko' function. */ -#define HAVE_FSEEKO 1 - -/* Define to 1 if you have the 'fstatvfs' function. */ -#undef HAVE_FSTATVFS - -/* Define if you have the 'fsync' function. */ -#undef HAVE_FSYNC - -/* Define to 1 if you have the 'ftell64' function. */ -#undef HAVE_FTELL64 - -/* Define to 1 if you have the 'ftello' function. */ -#define HAVE_FTELLO 1 - -/* Define to 1 if you have the 'ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the 'ftruncate' function. */ -#undef HAVE_FTRUNCATE - -/* Define to 1 if you have the 'gai_strerror' function. */ -#undef HAVE_GAI_STRERROR - -/* Define to 1 if you have the 'gamma' function. */ -#undef HAVE_GAMMA - -/* Define if we can use gcc inline assembler to get and set x87 control word */ -#if defined(__GNUC__) - #define HAVE_GCC_ASM_FOR_X87 1 -#else - #undef HAVE_GCC_ASM_FOR_X87 -#endif - -/* Define if you have the getaddrinfo function. */ -//#undef HAVE_GETADDRINFO -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the 'getcwd' function. */ -#define HAVE_GETCWD 1 - -/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ -#undef HAVE_GETC_UNLOCKED - -/* Define to 1 if you have the 'getentropy' function. */ -#undef HAVE_GETENTROPY - -/* Define to 1 if you have the 'getgroups' function. */ -#undef HAVE_GETGROUPS - -/* Define to 1 if you have the 'gethostbyname' function. */ -//#undef HAVE_GETHOSTBYNAME -#define HAVE_GETHOSTBYNAME 1 - -/* Define this if you have some version of gethostbyname_r() */ -#undef HAVE_GETHOSTBYNAME_R - -/* Define this if you have the 3-arg version of gethostbyname_r(). */ -#undef HAVE_GETHOSTBYNAME_R_3_ARG - -/* Define this if you have the 5-arg version of gethostbyname_r(). */ -#undef HAVE_GETHOSTBYNAME_R_5_ARG - -/* Define this if you have the 6-arg version of gethostbyname_r(). */ -#undef HAVE_GETHOSTBYNAME_R_6_ARG - -/* Define to 1 if you have the 'getitimer' function. */ -#undef HAVE_GETITIMER - -/* Define to 1 if you have the 'getloadavg' function. */ -#undef HAVE_GETLOADAVG - -/* Define to 1 if you have the 'getlogin' function. */ -#undef HAVE_GETLOGIN - -/* Define to 1 if you have the 'getnameinfo' function. */ -//#undef HAVE_GETNAMEINFO -#define HAVE_GETNAMEINFO 1 - -/* Define if you have the 'getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the 'getpeername' function. */ -#define HAVE_GETPEERNAME 1 - -/* Define to 1 if you have the 'getpgid' function. */ -#undef HAVE_GETPGID - -/* Define to 1 if you have the 'getpgrp' function. */ -#undef HAVE_GETPGRP - -/* Define to 1 if you have the 'getpid' function. */ -#undef HAVE_GETPID - -/* Define to 1 if you have the 'getpriority' function. */ -#undef HAVE_GETPRIORITY - -/* Define to 1 if you have the 'getpwent' function. */ -#undef HAVE_GETPWENT - -/* Define to 1 if you have the 'getresgid' function. */ -#undef HAVE_GETRESGID - -/* Define to 1 if you have the 'getresuid' function. */ -#undef HAVE_GETRESUID - -/* Define to 1 if you have the 'getsid' function. */ -#undef HAVE_GETSID - -/* Define to 1 if you have the 'getspent' function. */ -#undef HAVE_GETSPENT - -/* Define to 1 if you have the 'getspnam' function. */ -#undef HAVE_GETSPNAM - -/* Define to 1 if you have the 'gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the 'getwd' function. */ -#undef HAVE_GETWD - -/* Define to 1 if you have the header file. */ -#undef HAVE_GRP_H - -/* Define if you have the 'hstrerror' function. */ -#undef HAVE_HSTRERROR - -/* Define to 1 if you have the 'hypot' function. */ -#undef HAVE_HYPOT - -/* Define to 1 if you have the header file. */ -#undef HAVE_IEEEFP_H - -/* Define if you have the 'inet_aton' function. */ -#define HAVE_INET_ATON 1 - -/* Define if you have the 'inet_pton' function. */ -#define HAVE_INET_PTON 1 - -/* Define to 1 if you have the 'initgroups' function. */ -#undef HAVE_INITGROUPS - -/* Define if your compiler provides int32_t. */ -#undef HAVE_INT32_T - -/* Define if your compiler provides int64_t. */ -#undef HAVE_INT64_T - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_IO_H - -/* Define to 1 if you have the 'kill' function. */ -#undef HAVE_KILL - -/* Define to 1 if you have the 'killpg' function. */ -#undef HAVE_KILLPG - -/* Define if you have the 'kqueue' functions. */ -#undef HAVE_KQUEUE - -/* Define to 1 if you have the header file. */ -#undef HAVE_LANGINFO_H /* non-functional in EFI. */ - -/* Defined to enable large file support when an off_t is bigger than a long - and long long is available and at least as big as an off_t. You may need to - add some flags for configuration and compilation to enable this mode. (For - Solaris and Linux, the necessary defines are already defined.) */ -#undef HAVE_LARGEFILE_SUPPORT - -/* Define to 1 if you have the 'lchflags' function. */ -#undef HAVE_LCHFLAGS - -/* Define to 1 if you have the 'lchmod' function. */ -#undef HAVE_LCHMOD - -/* Define to 1 if you have the 'lchown' function. */ -#undef HAVE_LCHOWN - -/* Define to 1 if you have the 'lgamma' function. */ -#undef HAVE_LGAMMA - -/* Define to 1 if you have the 'dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the 'dld' library (-ldld). */ -#undef HAVE_LIBDLD - -/* Define to 1 if you have the 'ieee' library (-lieee). */ -#undef HAVE_LIBIEEE - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBINTL_H - -/* Define if you have the readline library (-lreadline). */ -#undef HAVE_LIBREADLINE - -/* Define to 1 if you have the 'resolv' library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBUTIL_H - -/* Define if you have the 'link' function. */ -#undef HAVE_LINK - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_NETLINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TIPC_H - -/* Define to 1 if you have the 'log1p' function. */ -#undef HAVE_LOG1P - -/* Define this if you have the type long double. */ -#undef HAVE_LONG_DOUBLE - -/* Define this if you have the type long long. */ -#define HAVE_LONG_LONG 1 - -/* Define to 1 if you have the 'lstat' function. */ -#define HAVE_LSTAT 1 - -/* Define this if you have the makedev macro. */ -#undef HAVE_MAKEDEV - -/* Define to 1 if you have the 'memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the 'mkfifo' function. */ -#undef HAVE_MKFIFO - -/* Define to 1 if you have the 'mknod' function. */ -#undef HAVE_MKNOD - -/* Define to 1 if you have the 'mktime' function. */ -#define HAVE_MKTIME 1 - -/* Define to 1 if you have the 'mmap' function. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the 'mremap' function. */ -#undef HAVE_MREMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NCURSES_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETPACKET_PACKET_H - -/* Define to 1 if you have the 'nice' function. */ -#undef HAVE_NICE - -/* Define to 1 if you have the 'openpty' function. */ -#undef HAVE_OPENPTY - -/* Define if compiling using MacOS X 10.5 SDK or later. */ -#undef HAVE_OSX105_SDK - -/* Define to 1 if you have the 'pathconf' function. */ -#undef HAVE_PATHCONF - -/* Define to 1 if you have the 'pause' function. */ -#undef HAVE_PAUSE - -/* Define to 1 if you have the 'plock' function. */ -#undef HAVE_PLOCK - -/* Define to 1 if you have the 'poll' function. */ -#define HAVE_POLL 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_POLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PROCESS_H - -/* Define if your compiler supports function prototype */ -#define HAVE_PROTOTYPES 1 - -/* Define if you have GNU PTH threads. */ -#undef HAVE_PTH - -/* Define to 1 if you have the 'pthread_atfork' function. */ -#undef HAVE_PTHREAD_ATFORK - -/* Defined for Solaris 2.6 bug in pthread header. */ -#undef HAVE_PTHREAD_DESTRUCTOR - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the 'pthread_init' function. */ -#undef HAVE_PTHREAD_INIT - -/* Define to 1 if you have the 'pthread_sigmask' function. */ -#undef HAVE_PTHREAD_SIGMASK - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTY_H - -/* Define to 1 if you have the 'putenv' function. */ -#undef HAVE_PUTENV - -/* Define if the libcrypto has RAND_egd */ -#undef HAVE_RAND_EGD - -/* Define to 1 if you have the 'readlink' function. */ -#undef HAVE_READLINK - -/* Define to 1 if you have the 'realpath' function. */ -#define HAVE_REALPATH 1 - -/* Define if you have readline 2.1 */ -#undef HAVE_RL_CALLBACK - -/* Define if you can turn off readline's signal handling. */ -#undef HAVE_RL_CATCH_SIGNAL - -/* Define if you have readline 2.2 */ -#undef HAVE_RL_COMPLETION_APPEND_CHARACTER - -/* Define if you have readline 4.0 */ -#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK - -/* Define if you have readline 4.2 */ -#undef HAVE_RL_COMPLETION_MATCHES - -/* Define if you have rl_completion_suppress_append */ -#undef HAVE_RL_COMPLETION_SUPPRESS_APPEND - -/* Define if you have readline 4.0 */ -#undef HAVE_RL_PRE_INPUT_HOOK - -/* Define to 1 if you have the 'round' function. */ -#undef HAVE_ROUND - -/* Define to 1 if you have the 'select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the 'sem_getvalue' function. */ -#undef HAVE_SEM_GETVALUE - -/* Define to 1 if you have the 'sem_open' function. */ -#undef HAVE_SEM_OPEN - -/* Define to 1 if you have the 'sem_timedwait' function. */ -#undef HAVE_SEM_TIMEDWAIT - -/* Define to 1 if you have the 'sem_unlink' function. */ -#undef HAVE_SEM_UNLINK - -/* Define to 1 if you have the 'setegid' function. */ -#undef HAVE_SETEGID - -/* Define to 1 if you have the 'seteuid' function. */ -#undef HAVE_SETEUID - -/* Define to 1 if you have the 'setgid' function. */ -#undef HAVE_SETGID - -/* Define if you have the 'setgroups' function. */ -#undef HAVE_SETGROUPS - -/* Define to 1 if you have the 'setitimer' function. */ -#undef HAVE_SETITIMER - -/* Define to 1 if you have the 'setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the 'setpgid' function. */ -#undef HAVE_SETPGID - -/* Define to 1 if you have the 'setpgrp' function. */ -#undef HAVE_SETPGRP - -/* Define to 1 if you have the 'setregid' function. */ -#undef HAVE_SETREGID - -/* Define to 1 if you have the 'setresgid' function. */ -#undef HAVE_SETRESGID - -/* Define to 1 if you have the 'setresuid' function. */ -#undef HAVE_SETRESUID - -/* Define to 1 if you have the 'setreuid' function. */ -#undef HAVE_SETREUID - -/* Define to 1 if you have the 'setsid' function. */ -#undef HAVE_SETSID - -/* Define to 1 if you have the 'setuid' function. */ -#undef HAVE_SETUID - -/* Define to 1 if you have the 'setvbuf' function. */ -#define HAVE_SETVBUF 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SHADOW_H - -/* Define to 1 if you have the 'sigaction' function. */ -#undef HAVE_SIGACTION - -/* Define to 1 if you have the 'siginterrupt' function. */ -#undef HAVE_SIGINTERRUPT - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the 'sigrelse' function. */ -#undef HAVE_SIGRELSE - -/* Define to 1 if you have the 'snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define if sockaddr has sa_len member */ -#undef HAVE_SOCKADDR_SA_LEN - -/* struct sockaddr_storage (sys/socket.h) */ -#undef HAVE_SOCKADDR_STORAGE - -/* Define if you have the 'socketpair' function. */ -#undef HAVE_SOCKETPAIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_SPAWN_H - -/* Define if your compiler provides ssize_t */ -#define HAVE_SSIZE_T 1 - -/* Define to 1 if you have the 'statvfs' function. */ -#undef HAVE_STATVFS - -/* Define if you have struct stat.st_mtim.tv_nsec */ -#undef HAVE_STAT_TV_NSEC - -/* Define if you have struct stat.st_mtimensec */ -#undef HAVE_STAT_TV_NSEC2 - -/* Define if your compiler supports variable length function prototypes (e.g. - void fprintf(FILE *, char *, ...);) *and* */ -#define HAVE_STDARG_PROTOTYPES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the 'strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the 'strftime' function. */ -#define HAVE_STRFTIME 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_STROPTS_H - -/* Define to 1 if 'st_birthtime' is a member of 'struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 - -/* Define to 1 if 'st_blksize' is a member of 'struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 - -/* Define to 1 if 'st_blocks' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - -/* Define to 1 if 'st_flags' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_FLAGS - -/* Define to 1 if 'st_gen' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_GEN - -/* Define to 1 if 'st_rdev' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if 'st_dev' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_DEV - -/* Define to 1 if 'st_ino' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_INO - -/* Define to 1 if 'tm_zone' is a member of 'struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if your 'struct stat' has 'st_blocks'. Deprecated, use - 'HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#undef HAVE_ST_BLOCKS - -/* Define if you have the 'symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the 'sysconf' function. */ -#undef HAVE_SYSCONF - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYSEXITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_AUDIOIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_BSDTTY_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EVENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LOADAVG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LOCK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MKDEV_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MODEM_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STATVFS_H - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TERMIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the system() command. */ -#define HAVE_SYSTEM 1 - -/* Define to 1 if you have the 'tcgetpgrp' function. */ -#undef HAVE_TCGETPGRP - -/* Define to 1 if you have the 'tcsetpgrp' function. */ -#undef HAVE_TCSETPGRP - -/* Define to 1 if you have the 'tempnam' function. */ -#define HAVE_TEMPNAM 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the 'tgamma' function. */ -#undef HAVE_TGAMMA - -/* Define to 1 if you have the header file. */ -#undef HAVE_THREAD_H - -/* Define to 1 if you have the 'timegm' function. */ -#undef HAVE_TIMEGM - -/* Define to 1 if you have the 'times' function. */ -#undef HAVE_TIMES - -/* Define to 1 if you have the 'tmpfile' function. */ -#define HAVE_TMPFILE 1 - -/* Define to 1 if you have the 'tmpnam' function. */ -#define HAVE_TMPNAM 1 - -/* Define to 1 if you have the 'tmpnam_r' function. */ -#undef HAVE_TMPNAM_R - -/* Define to 1 if your 'struct tm' has 'tm_zone'. Deprecated, use - 'HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you have the 'truncate' function. */ -#undef HAVE_TRUNCATE - -/* Define to 1 if you don't have 'tm_zone' but do have the external array - 'tzname'. */ -#undef HAVE_TZNAME - -/* Define this if you have tcl and TCL_UTF_MAX==6 */ -#undef HAVE_UCS4_TCL - -/* Define if your compiler provides uint32_t. */ -#undef HAVE_UINT32_T - -/* Define if your compiler provides uint64_t. */ -#undef HAVE_UINT64_T - -/* Define to 1 if the system has the type 'uintptr_t'. */ -#define HAVE_UINTPTR_T 1 - -/* Define to 1 if you have the 'uname' function. */ -#undef HAVE_UNAME - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the 'unsetenv' function. */ -#undef HAVE_UNSETENV - -/* Define if you have a useable wchar_t type defined in wchar.h; useable means - wchar_t must be an unsigned type with at least 16 bits. (see - Include/unicodeobject.h). */ -#define HAVE_USABLE_WCHAR_T 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIL_H - -/* Define to 1 if you have the 'utimes' function. */ -#undef HAVE_UTIMES - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIME_H 1 - -/* Define to 1 if you have the 'wait3' function. */ -#undef HAVE_WAIT3 - -/* Define to 1 if you have the 'wait4' function. */ -#undef HAVE_WAIT4 - -/* Define to 1 if you have the 'waitpid' function. */ -#undef HAVE_WAITPID - -/* Define if the compiler provides a wchar.h header file. */ -#define HAVE_WCHAR_H 1 - -/* Define to 1 if you have the 'wcscoll' function. */ -#define HAVE_WCSCOLL 1 - -/* Define if tzset() actually switches the local timezone in a meaningful way. - */ -#undef HAVE_WORKING_TZSET - -/* Define if the zlib library has inflateCopy */ -#undef HAVE_ZLIB_COPY - -/* Define to 1 if you have the '_getpty' function. */ -#undef HAVE__GETPTY - -/* Define if you are using Mach cthreads directly under /include */ -#undef HURD_C_THREADS - -/* Define if you are using Mach cthreads under mach / */ -#undef MACH_C_THREADS - -/* Define to 1 if 'major', 'minor', and 'makedev' are declared in . - */ -#undef MAJOR_IN_MKDEV - -/* Define to 1 if 'major', 'minor', and 'makedev' are declared in - . */ -#undef MAJOR_IN_SYSMACROS - -/* Define if mvwdelch in curses.h is an expression. */ -#undef MVWDELCH_IS_EXPRESSION - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "edk2-devel@lists.01.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "EDK II Python 2.7.10 Package" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "EDK II Python 2.7.10 Package V0.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "EADK_Python" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "http://www.tianocore.org/" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "V0.1" - -/* Define if POSIX semaphores aren't enabled on your system */ -#define POSIX_SEMAPHORES_NOT_ENABLED 1 - -/* Defined if PTHREAD_SCOPE_SYSTEM supported. */ -#undef PTHREAD_SYSTEM_SCHED_SUPPORTED - -/* Define as the preferred size in bits of long digits */ -#undef PYLONG_BITS_IN_DIGIT - -/* Define to printf format modifier for long long type */ -#define PY_FORMAT_LONG_LONG "ll" - -/* Define to printf format modifier for Py_ssize_t */ -#define PY_FORMAT_SIZE_T "z" - -/* Define as the integral type used for Unicode representation. */ -#define PY_UNICODE_TYPE wchar_t - -/* Define if you want to build an interpreter with many run-time checks. */ -#undef Py_DEBUG - -/* Defined if Python is built as a shared library. */ -#undef Py_ENABLE_SHARED - -/* Define as the size of the unicode type. */ -#define Py_UNICODE_SIZE 2 - -/* Define if you want to have a Unicode type. */ -#define Py_USING_UNICODE - -/* assume C89 semantics that RETSIGTYPE is always void */ -#undef RETSIGTYPE - -/* Define if setpgrp() must be called as setpgrp(0, 0). */ -#undef SETPGRP_HAVE_ARG - -/* Define this to be extension of shared libraries (including the dot!). */ -#undef SHLIB_EXT - -/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ -#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS - -/* The size of 'double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of 'float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of 'fpos_t', as computed by sizeof. */ -#define SIZEOF_FPOS_T 8 - -/* The size of 'int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of 'long', as computed by sizeof. */ -#define SIZEOF_LONG 4 - -/* The size of 'long double', as computed by sizeof. */ -#undef SIZEOF_LONG_DOUBLE - -/* The size of 'long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of 'off_t', as computed by sizeof. */ -#define SIZEOF_OFF_T 4 - -/* The size of 'pid_t', as computed by sizeof. */ -#define SIZEOF_PID_T 4 - -/* The size of 'pthread_t', as computed by sizeof. */ -#undef SIZEOF_PTHREAD_T - -/* The size of 'short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of 'size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 4 - -/* The size of 'time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 - -/* The size of 'uintptr_t', as computed by sizeof. */ -#define SIZEOF_UINTPTR_T 4 - -/* The size of 'void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 4 - -/* The size of 'wchar_t', as computed by sizeof. */ -#define SIZEOF_WCHAR_T 2 - -/* The size of '_Bool', as computed by sizeof. */ -#define SIZEOF__BOOL 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and - (which you can't on SCO ODT 3.0). */ -#undef SYS_SELECT_WITH_SYS_TIME - -/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ -#undef TANH_PRESERVES_ZERO_SIGN - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares 'struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define if you want to use MacPython modules on MacOSX in unix-Python. */ -#undef USE_TOOLBOX_OBJECT_GLUE - -/* Define if a va_list is an array of some kind */ -#undef VA_LIST_IS_ARRAY - -/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ -#undef WANT_SIGFPE_HANDLER - -/* Define if you want wctype.h functions to be used instead of the one - supplied by Python itself. (see Include/unicodectype.h). */ -#define WANT_WCTYPE_FUNCTIONS 1 - -/* Define if WINDOW in curses.h offers a field _flags. */ -#undef WINDOW_HAS_FLAGS - -/* Define if you want documentation strings in extension modules */ -#undef WITH_DOC_STRINGS - -/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic - linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). - Dyld is necessary to support frameworks. */ -#undef WITH_DYLD - -/* Define to 1 if libintl is needed for locale functions. */ -#undef WITH_LIBINTL - -/* Define if you want to produce an OpenStep/Rhapsody framework (shared - library plus accessory files). */ -#undef WITH_NEXT_FRAMEWORK - -/* Define if you want to compile in Python-specific mallocs */ -#undef WITH_PYMALLOC - -/* Define if you want to compile in rudimentary thread support */ -#undef WITH_THREAD - -/* Define to profile with the Pentium timestamp counter */ -#undef WITH_TSC - -/* Define if you want pymalloc to be disabled when running under valgrind */ -#undef WITH_VALGRIND - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define if arithmetic is subject to x87-style double rounding issue */ -#undef X87_DOUBLE_ROUNDING - -/* Define on OpenBSD to activate all library features */ -#undef _BSD_SOURCE - -/* Define on Irix to enable u_int */ -#undef _BSD_TYPES - -/* Define on Darwin to activate all library features */ -#undef _DARWIN_C_SOURCE - -/* This must be set to 64 on some systems to enable large file support. */ -#undef _FILE_OFFSET_BITS - -/* Define on Linux to activate all library features */ -#undef _GNU_SOURCE - -/* This must be defined on some systems to enable large file support. */ -#undef _LARGEFILE_SOURCE - -/* This must be defined on AIX systems to enable large file support. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define on NetBSD to activate all library features */ -#define _NETBSD_SOURCE 1 - -/* Define _OSF_SOURCE to get the makedev macro. */ -#undef _OSF_SOURCE - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to activate features from IEEE Stds 1003.1-2001 */ -#undef _POSIX_C_SOURCE - -/* Define to 1 if you need to in order for 'stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define if you have POSIX threads, and your system does not define that. */ -#undef _POSIX_THREADS - -/* Define to force use of thread-safe errno, h_errno, and other functions */ -#undef _REENTRANT - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT32_T - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT64_T - -/* Define to the level of X/Open that your system supports */ -#undef _XOPEN_SOURCE - -/* Define to activate Unix95-and-earlier features */ -#undef _XOPEN_SOURCE_EXTENDED - -/* Define on FreeBSD to activate all library features */ -#undef __BSD_VISIBLE - -/* Define to 1 if type 'char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -# undef __CHAR_UNSIGNED__ -#endif - -/* Defined on Solaris to see additional function prototypes. */ -#undef __EXTENSIONS__ - -/* Define to 'long' if doesn't define. */ -//#undef clock_t - -/* Define to empty if 'const' does not conform to ANSI C. */ -//#undef const - -/* Define to 'int' if doesn't define. */ -//#undef gid_t - -/* Define to the type of a signed integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -//#undef int32_t - -/* Define to the type of a signed integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -//#undef int64_t - -/* Define to 'int' if does not define. */ -//#undef mode_t - -/* Define to 'long int' if does not define. */ -//#undef off_t - -/* Define to 'int' if does not define. */ -//#undef pid_t - -/* Define to empty if the keyword does not work. */ -//#undef signed - -/* Define to 'unsigned int' if does not define. */ -//#undef size_t - -/* Define to 'int' if does not define. */ -//#undef socklen_t - -/* Define to 'int' if doesn't define. */ -//#undef uid_t - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -//#undef uint32_t - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -//#undef uint64_t - -/* Define to empty if the keyword does not work. */ -//#undef volatile - -#endif /*Py_PYCONFIG_H*/ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/Python-ast.h b/AppPkg/Applications/Python/Python-2.7.10/Include/Python-ast.h deleted file mode 100644 index d794c32..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/Python-ast.h +++ /dev/null @@ -1,535 +0,0 @@ -/* File automatically generated by Parser/asdl_c.py. */ - -#include "asdl.h" - -typedef struct _mod *mod_ty; - -typedef struct _stmt *stmt_ty; - -typedef struct _expr *expr_ty; - -typedef enum _expr_context { Load=1, Store=2, Del=3, AugLoad=4, AugStore=5, - Param=6 } expr_context_ty; - -typedef struct _slice *slice_ty; - -typedef enum _boolop { And=1, Or=2 } boolop_ty; - -typedef enum _operator { Add=1, Sub=2, Mult=3, Div=4, Mod=5, Pow=6, LShift=7, - RShift=8, BitOr=9, BitXor=10, BitAnd=11, FloorDiv=12 } - operator_ty; - -typedef enum _unaryop { Invert=1, Not=2, UAdd=3, USub=4 } unaryop_ty; - -typedef enum _cmpop { Eq=1, NotEq=2, Lt=3, LtE=4, Gt=5, GtE=6, Is=7, IsNot=8, - In=9, NotIn=10 } cmpop_ty; - -typedef struct _comprehension *comprehension_ty; - -typedef struct _excepthandler *excepthandler_ty; - -typedef struct _arguments *arguments_ty; - -typedef struct _keyword *keyword_ty; - -typedef struct _alias *alias_ty; - - -enum _mod_kind {Module_kind=1, Interactive_kind=2, Expression_kind=3, - Suite_kind=4}; -struct _mod { - enum _mod_kind kind; - union { - struct { - asdl_seq *body; - } Module; - - struct { - asdl_seq *body; - } Interactive; - - struct { - expr_ty body; - } Expression; - - struct { - asdl_seq *body; - } Suite; - - } v; -}; - -enum _stmt_kind {FunctionDef_kind=1, ClassDef_kind=2, Return_kind=3, - Delete_kind=4, Assign_kind=5, AugAssign_kind=6, Print_kind=7, - For_kind=8, While_kind=9, If_kind=10, With_kind=11, - Raise_kind=12, TryExcept_kind=13, TryFinally_kind=14, - Assert_kind=15, Import_kind=16, ImportFrom_kind=17, - Exec_kind=18, Global_kind=19, Expr_kind=20, Pass_kind=21, - Break_kind=22, Continue_kind=23}; -struct _stmt { - enum _stmt_kind kind; - union { - struct { - identifier name; - arguments_ty args; - asdl_seq *body; - asdl_seq *decorator_list; - } FunctionDef; - - struct { - identifier name; - asdl_seq *bases; - asdl_seq *body; - asdl_seq *decorator_list; - } ClassDef; - - struct { - expr_ty value; - } Return; - - struct { - asdl_seq *targets; - } Delete; - - struct { - asdl_seq *targets; - expr_ty value; - } Assign; - - struct { - expr_ty target; - operator_ty op; - expr_ty value; - } AugAssign; - - struct { - expr_ty dest; - asdl_seq *values; - bool nl; - } Print; - - struct { - expr_ty target; - expr_ty iter; - asdl_seq *body; - asdl_seq *orelse; - } For; - - struct { - expr_ty test; - asdl_seq *body; - asdl_seq *orelse; - } While; - - struct { - expr_ty test; - asdl_seq *body; - asdl_seq *orelse; - } If; - - struct { - expr_ty context_expr; - expr_ty optional_vars; - asdl_seq *body; - } With; - - struct { - expr_ty type; - expr_ty inst; - expr_ty tback; - } Raise; - - struct { - asdl_seq *body; - asdl_seq *handlers; - asdl_seq *orelse; - } TryExcept; - - struct { - asdl_seq *body; - asdl_seq *finalbody; - } TryFinally; - - struct { - expr_ty test; - expr_ty msg; - } Assert; - - struct { - asdl_seq *names; - } Import; - - struct { - identifier module; - asdl_seq *names; - int level; - } ImportFrom; - - struct { - expr_ty body; - expr_ty globals; - expr_ty locals; - } Exec; - - struct { - asdl_seq *names; - } Global; - - struct { - expr_ty value; - } Expr; - - } v; - int lineno; - int col_offset; -}; - -enum _expr_kind {BoolOp_kind=1, BinOp_kind=2, UnaryOp_kind=3, Lambda_kind=4, - IfExp_kind=5, Dict_kind=6, Set_kind=7, ListComp_kind=8, - SetComp_kind=9, DictComp_kind=10, GeneratorExp_kind=11, - Yield_kind=12, Compare_kind=13, Call_kind=14, Repr_kind=15, - Num_kind=16, Str_kind=17, Attribute_kind=18, - Subscript_kind=19, Name_kind=20, List_kind=21, Tuple_kind=22}; -struct _expr { - enum _expr_kind kind; - union { - struct { - boolop_ty op; - asdl_seq *values; - } BoolOp; - - struct { - expr_ty left; - operator_ty op; - expr_ty right; - } BinOp; - - struct { - unaryop_ty op; - expr_ty operand; - } UnaryOp; - - struct { - arguments_ty args; - expr_ty body; - } Lambda; - - struct { - expr_ty test; - expr_ty body; - expr_ty orelse; - } IfExp; - - struct { - asdl_seq *keys; - asdl_seq *values; - } Dict; - - struct { - asdl_seq *elts; - } Set; - - struct { - expr_ty elt; - asdl_seq *generators; - } ListComp; - - struct { - expr_ty elt; - asdl_seq *generators; - } SetComp; - - struct { - expr_ty key; - expr_ty value; - asdl_seq *generators; - } DictComp; - - struct { - expr_ty elt; - asdl_seq *generators; - } GeneratorExp; - - struct { - expr_ty value; - } Yield; - - struct { - expr_ty left; - asdl_int_seq *ops; - asdl_seq *comparators; - } Compare; - - struct { - expr_ty func; - asdl_seq *args; - asdl_seq *keywords; - expr_ty starargs; - expr_ty kwargs; - } Call; - - struct { - expr_ty value; - } Repr; - - struct { - object n; - } Num; - - struct { - string s; - } Str; - - struct { - expr_ty value; - identifier attr; - expr_context_ty ctx; - } Attribute; - - struct { - expr_ty value; - slice_ty slice; - expr_context_ty ctx; - } Subscript; - - struct { - identifier id; - expr_context_ty ctx; - } Name; - - struct { - asdl_seq *elts; - expr_context_ty ctx; - } List; - - struct { - asdl_seq *elts; - expr_context_ty ctx; - } Tuple; - - } v; - int lineno; - int col_offset; -}; - -enum _slice_kind {Ellipsis_kind=1, Slice_kind=2, ExtSlice_kind=3, Index_kind=4}; -struct _slice { - enum _slice_kind kind; - union { - struct { - expr_ty lower; - expr_ty upper; - expr_ty step; - } Slice; - - struct { - asdl_seq *dims; - } ExtSlice; - - struct { - expr_ty value; - } Index; - - } v; -}; - -struct _comprehension { - expr_ty target; - expr_ty iter; - asdl_seq *ifs; -}; - -enum _excepthandler_kind {ExceptHandler_kind=1}; -struct _excepthandler { - enum _excepthandler_kind kind; - union { - struct { - expr_ty type; - expr_ty name; - asdl_seq *body; - } ExceptHandler; - - } v; - int lineno; - int col_offset; -}; - -struct _arguments { - asdl_seq *args; - identifier vararg; - identifier kwarg; - asdl_seq *defaults; -}; - -struct _keyword { - identifier arg; - expr_ty value; -}; - -struct _alias { - identifier name; - identifier asname; -}; - - -#define Module(a0, a1) _Py_Module(a0, a1) -mod_ty _Py_Module(asdl_seq * body, PyArena *arena); -#define Interactive(a0, a1) _Py_Interactive(a0, a1) -mod_ty _Py_Interactive(asdl_seq * body, PyArena *arena); -#define Expression(a0, a1) _Py_Expression(a0, a1) -mod_ty _Py_Expression(expr_ty body, PyArena *arena); -#define Suite(a0, a1) _Py_Suite(a0, a1) -mod_ty _Py_Suite(asdl_seq * body, PyArena *arena); -#define FunctionDef(a0, a1, a2, a3, a4, a5, a6) _Py_FunctionDef(a0, a1, a2, a3, a4, a5, a6) -stmt_ty _Py_FunctionDef(identifier name, arguments_ty args, asdl_seq * body, - asdl_seq * decorator_list, int lineno, int col_offset, - PyArena *arena); -#define ClassDef(a0, a1, a2, a3, a4, a5, a6) _Py_ClassDef(a0, a1, a2, a3, a4, a5, a6) -stmt_ty _Py_ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, - asdl_seq * decorator_list, int lineno, int col_offset, - PyArena *arena); -#define Return(a0, a1, a2, a3) _Py_Return(a0, a1, a2, a3) -stmt_ty _Py_Return(expr_ty value, int lineno, int col_offset, PyArena *arena); -#define Delete(a0, a1, a2, a3) _Py_Delete(a0, a1, a2, a3) -stmt_ty _Py_Delete(asdl_seq * targets, int lineno, int col_offset, PyArena - *arena); -#define Assign(a0, a1, a2, a3, a4) _Py_Assign(a0, a1, a2, a3, a4) -stmt_ty _Py_Assign(asdl_seq * targets, expr_ty value, int lineno, int - col_offset, PyArena *arena); -#define AugAssign(a0, a1, a2, a3, a4, a5) _Py_AugAssign(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_AugAssign(expr_ty target, operator_ty op, expr_ty value, int - lineno, int col_offset, PyArena *arena); -#define Print(a0, a1, a2, a3, a4, a5) _Py_Print(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int - col_offset, PyArena *arena); -#define For(a0, a1, a2, a3, a4, a5, a6) _Py_For(a0, a1, a2, a3, a4, a5, a6) -stmt_ty _Py_For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * - orelse, int lineno, int col_offset, PyArena *arena); -#define While(a0, a1, a2, a3, a4, a5) _Py_While(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, - int col_offset, PyArena *arena); -#define If(a0, a1, a2, a3, a4, a5) _Py_If(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, - int col_offset, PyArena *arena); -#define With(a0, a1, a2, a3, a4, a5) _Py_With(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, - int lineno, int col_offset, PyArena *arena); -#define Raise(a0, a1, a2, a3, a4, a5) _Py_Raise(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int - col_offset, PyArena *arena); -#define TryExcept(a0, a1, a2, a3, a4, a5) _Py_TryExcept(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, - int lineno, int col_offset, PyArena *arena); -#define TryFinally(a0, a1, a2, a3, a4) _Py_TryFinally(a0, a1, a2, a3, a4) -stmt_ty _Py_TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int - col_offset, PyArena *arena); -#define Assert(a0, a1, a2, a3, a4) _Py_Assert(a0, a1, a2, a3, a4) -stmt_ty _Py_Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, - PyArena *arena); -#define Import(a0, a1, a2, a3) _Py_Import(a0, a1, a2, a3) -stmt_ty _Py_Import(asdl_seq * names, int lineno, int col_offset, PyArena - *arena); -#define ImportFrom(a0, a1, a2, a3, a4, a5) _Py_ImportFrom(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_ImportFrom(identifier module, asdl_seq * names, int level, int - lineno, int col_offset, PyArena *arena); -#define Exec(a0, a1, a2, a3, a4, a5) _Py_Exec(a0, a1, a2, a3, a4, a5) -stmt_ty _Py_Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int - col_offset, PyArena *arena); -#define Global(a0, a1, a2, a3) _Py_Global(a0, a1, a2, a3) -stmt_ty _Py_Global(asdl_seq * names, int lineno, int col_offset, PyArena - *arena); -#define Expr(a0, a1, a2, a3) _Py_Expr(a0, a1, a2, a3) -stmt_ty _Py_Expr(expr_ty value, int lineno, int col_offset, PyArena *arena); -#define Pass(a0, a1, a2) _Py_Pass(a0, a1, a2) -stmt_ty _Py_Pass(int lineno, int col_offset, PyArena *arena); -#define Break(a0, a1, a2) _Py_Break(a0, a1, a2) -stmt_ty _Py_Break(int lineno, int col_offset, PyArena *arena); -#define Continue(a0, a1, a2) _Py_Continue(a0, a1, a2) -stmt_ty _Py_Continue(int lineno, int col_offset, PyArena *arena); -#define BoolOp(a0, a1, a2, a3, a4) _Py_BoolOp(a0, a1, a2, a3, a4) -expr_ty _Py_BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, - PyArena *arena); -#define BinOp(a0, a1, a2, a3, a4, a5) _Py_BinOp(a0, a1, a2, a3, a4, a5) -expr_ty _Py_BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int - col_offset, PyArena *arena); -#define UnaryOp(a0, a1, a2, a3, a4) _Py_UnaryOp(a0, a1, a2, a3, a4) -expr_ty _Py_UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, - PyArena *arena); -#define Lambda(a0, a1, a2, a3, a4) _Py_Lambda(a0, a1, a2, a3, a4) -expr_ty _Py_Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, - PyArena *arena); -#define IfExp(a0, a1, a2, a3, a4, a5) _Py_IfExp(a0, a1, a2, a3, a4, a5) -expr_ty _Py_IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int - col_offset, PyArena *arena); -#define Dict(a0, a1, a2, a3, a4) _Py_Dict(a0, a1, a2, a3, a4) -expr_ty _Py_Dict(asdl_seq * keys, asdl_seq * values, int lineno, int - col_offset, PyArena *arena); -#define Set(a0, a1, a2, a3) _Py_Set(a0, a1, a2, a3) -expr_ty _Py_Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena); -#define ListComp(a0, a1, a2, a3, a4) _Py_ListComp(a0, a1, a2, a3, a4) -expr_ty _Py_ListComp(expr_ty elt, asdl_seq * generators, int lineno, int - col_offset, PyArena *arena); -#define SetComp(a0, a1, a2, a3, a4) _Py_SetComp(a0, a1, a2, a3, a4) -expr_ty _Py_SetComp(expr_ty elt, asdl_seq * generators, int lineno, int - col_offset, PyArena *arena); -#define DictComp(a0, a1, a2, a3, a4, a5) _Py_DictComp(a0, a1, a2, a3, a4, a5) -expr_ty _Py_DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int - lineno, int col_offset, PyArena *arena); -#define GeneratorExp(a0, a1, a2, a3, a4) _Py_GeneratorExp(a0, a1, a2, a3, a4) -expr_ty _Py_GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int - col_offset, PyArena *arena); -#define Yield(a0, a1, a2, a3) _Py_Yield(a0, a1, a2, a3) -expr_ty _Py_Yield(expr_ty value, int lineno, int col_offset, PyArena *arena); -#define Compare(a0, a1, a2, a3, a4, a5) _Py_Compare(a0, a1, a2, a3, a4, a5) -expr_ty _Py_Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, - int lineno, int col_offset, PyArena *arena); -#define Call(a0, a1, a2, a3, a4, a5, a6, a7) _Py_Call(a0, a1, a2, a3, a4, a5, a6, a7) -expr_ty _Py_Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty - starargs, expr_ty kwargs, int lineno, int col_offset, PyArena - *arena); -#define Repr(a0, a1, a2, a3) _Py_Repr(a0, a1, a2, a3) -expr_ty _Py_Repr(expr_ty value, int lineno, int col_offset, PyArena *arena); -#define Num(a0, a1, a2, a3) _Py_Num(a0, a1, a2, a3) -expr_ty _Py_Num(object n, int lineno, int col_offset, PyArena *arena); -#define Str(a0, a1, a2, a3) _Py_Str(a0, a1, a2, a3) -expr_ty _Py_Str(string s, int lineno, int col_offset, PyArena *arena); -#define Attribute(a0, a1, a2, a3, a4, a5) _Py_Attribute(a0, a1, a2, a3, a4, a5) -expr_ty _Py_Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int - lineno, int col_offset, PyArena *arena); -#define Subscript(a0, a1, a2, a3, a4, a5) _Py_Subscript(a0, a1, a2, a3, a4, a5) -expr_ty _Py_Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int - lineno, int col_offset, PyArena *arena); -#define Name(a0, a1, a2, a3, a4) _Py_Name(a0, a1, a2, a3, a4) -expr_ty _Py_Name(identifier id, expr_context_ty ctx, int lineno, int - col_offset, PyArena *arena); -#define List(a0, a1, a2, a3, a4) _Py_List(a0, a1, a2, a3, a4) -expr_ty _Py_List(asdl_seq * elts, expr_context_ty ctx, int lineno, int - col_offset, PyArena *arena); -#define Tuple(a0, a1, a2, a3, a4) _Py_Tuple(a0, a1, a2, a3, a4) -expr_ty _Py_Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int - col_offset, PyArena *arena); -#define Ellipsis(a0) _Py_Ellipsis(a0) -slice_ty _Py_Ellipsis(PyArena *arena); -#define Slice(a0, a1, a2, a3) _Py_Slice(a0, a1, a2, a3) -slice_ty _Py_Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena); -#define ExtSlice(a0, a1) _Py_ExtSlice(a0, a1) -slice_ty _Py_ExtSlice(asdl_seq * dims, PyArena *arena); -#define Index(a0, a1) _Py_Index(a0, a1) -slice_ty _Py_Index(expr_ty value, PyArena *arena); -#define comprehension(a0, a1, a2, a3) _Py_comprehension(a0, a1, a2, a3) -comprehension_ty _Py_comprehension(expr_ty target, expr_ty iter, asdl_seq * - ifs, PyArena *arena); -#define ExceptHandler(a0, a1, a2, a3, a4, a5) _Py_ExceptHandler(a0, a1, a2, a3, a4, a5) -excepthandler_ty _Py_ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, - int lineno, int col_offset, PyArena *arena); -#define arguments(a0, a1, a2, a3, a4) _Py_arguments(a0, a1, a2, a3, a4) -arguments_ty _Py_arguments(asdl_seq * args, identifier vararg, identifier - kwarg, asdl_seq * defaults, PyArena *arena); -#define keyword(a0, a1, a2) _Py_keyword(a0, a1, a2) -keyword_ty _Py_keyword(identifier arg, expr_ty value, PyArena *arena); -#define alias(a0, a1, a2) _Py_alias(a0, a1, a2) -alias_ty _Py_alias(identifier name, identifier asname, PyArena *arena); - -PyObject* PyAST_mod2obj(mod_ty t); -mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode); -int PyAST_Check(PyObject* obj); diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/Python.h b/AppPkg/Applications/Python/Python-2.7.10/Include/Python.h deleted file mode 100644 index 5abad47..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/Python.h +++ /dev/null @@ -1,178 +0,0 @@ -#ifndef Py_PYTHON_H -#define Py_PYTHON_H -/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */ - -/* Include nearly all Python header files */ - -#include "patchlevel.h" -#include "pyconfig.h" -#include "pymacconfig.h" - -/* Cyclic gc is always enabled, starting with release 2.3a1. Supply the - * old symbol for the benefit of extension modules written before then - * that may be conditionalizing on it. The core doesn't use it anymore. - */ -#ifndef WITH_CYCLE_GC -#define WITH_CYCLE_GC 1 -#endif - -#include - -#ifndef UCHAR_MAX -#error "Something's broken. UCHAR_MAX should be defined in limits.h." -#endif - -#if UCHAR_MAX != 255 -#error "Python's source code assumes C's unsigned char is an 8-bit type." -#endif - -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) -#define _SGI_MP_SOURCE -#endif - -#include -#ifndef NULL -# error "Python.h requires that stdio.h define NULL." -#endif - -#include -#ifdef HAVE_ERRNO_H -#include -#endif -#include -#ifdef HAVE_UNISTD_H -#include -#endif - -/* For size_t? */ -#ifdef HAVE_STDDEF_H -#include -#endif - -/* CAUTION: Build setups should ensure that NDEBUG is defined on the - * compiler command line when building Python in release mode; else - * assert() calls won't be removed. - */ -#include - -#include "pyport.h" - -/* pyconfig.h or pyport.h may or may not define DL_IMPORT */ -#ifndef DL_IMPORT /* declarations for DLL import/export */ -#define DL_IMPORT(RTYPE) RTYPE -#endif -#ifndef DL_EXPORT /* declarations for DLL import/export */ -#define DL_EXPORT(RTYPE) RTYPE -#endif - -/* Debug-mode build with pymalloc implies PYMALLOC_DEBUG. - * PYMALLOC_DEBUG is in error if pymalloc is not in use. - */ -#if defined(Py_DEBUG) && defined(WITH_PYMALLOC) && !defined(PYMALLOC_DEBUG) -#define PYMALLOC_DEBUG -#endif -#if defined(PYMALLOC_DEBUG) && !defined(WITH_PYMALLOC) -#error "PYMALLOC_DEBUG requires WITH_PYMALLOC" -#endif -#include "pymath.h" -#include "pymem.h" - -#include "object.h" -#include "objimpl.h" - -#include "pydebug.h" - -#include "unicodeobject.h" -#include "intobject.h" -#include "boolobject.h" -#include "longobject.h" -#include "floatobject.h" -#ifndef WITHOUT_COMPLEX -#include "complexobject.h" -#endif -#include "rangeobject.h" -#include "stringobject.h" -#include "memoryobject.h" -#include "bufferobject.h" -#include "bytesobject.h" -#include "bytearrayobject.h" -#include "tupleobject.h" -#include "listobject.h" -#include "dictobject.h" -#include "enumobject.h" -#include "setobject.h" -#include "methodobject.h" -#include "moduleobject.h" -#include "funcobject.h" -#include "classobject.h" -#include "fileobject.h" -#include "cobject.h" -#include "pycapsule.h" -#include "traceback.h" -#include "sliceobject.h" -#include "cellobject.h" -#include "iterobject.h" -#include "genobject.h" -#include "descrobject.h" -#include "warnings.h" -#include "weakrefobject.h" - -#include "codecs.h" -#include "pyerrors.h" - -#include "pystate.h" - -#include "pyarena.h" -#include "modsupport.h" -#include "pythonrun.h" -#include "ceval.h" -#include "sysmodule.h" -#include "intrcheck.h" -#include "import.h" - -#include "abstract.h" - -#include "compile.h" -#include "eval.h" - -#include "pyctype.h" -#include "pystrtod.h" -#include "pystrcmp.h" -#include "dtoa.h" - -/* _Py_Mangle is defined in compile.c */ -PyAPI_FUNC(PyObject*) _Py_Mangle(PyObject *p, PyObject *name); - -/* PyArg_GetInt is deprecated and should not be used, use PyArg_Parse(). */ -#define PyArg_GetInt(v, a) PyArg_Parse((v), "i", (a)) - -/* PyArg_NoArgs should not be necessary. - Set ml_flags in the PyMethodDef to METH_NOARGS. */ -#define PyArg_NoArgs(v) PyArg_Parse(v, "") - -/* Argument must be a char or an int in [-128, 127] or [0, 255]. */ -#define Py_CHARMASK(c) ((unsigned char)((c) & 0xff)) - -#include "pyfpe.h" - -/* These definitions must match corresponding definitions in graminit.h. - There's code in compile.c that checks that they are the same. */ -#define Py_single_input 256 -#define Py_file_input 257 -#define Py_eval_input 258 - -#ifdef HAVE_PTH -/* GNU pth user-space thread support */ -#include -#endif - -/* Define macros for inline documentation. */ -#define PyDoc_VAR(name) static char name[] -#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) -#ifdef WITH_DOC_STRINGS -#define PyDoc_STR(str) str -#else -#define PyDoc_STR(str) "" -#endif - -#endif /* !Py_PYTHON_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/abstract.h b/AppPkg/Applications/Python/Python-2.7.10/Include/abstract.h deleted file mode 100644 index 61d56ff..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/abstract.h +++ /dev/null @@ -1,1396 +0,0 @@ -#ifndef Py_ABSTRACTOBJECT_H -#define Py_ABSTRACTOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef PY_SSIZE_T_CLEAN -#define PyObject_CallFunction _PyObject_CallFunction_SizeT -#define PyObject_CallMethod _PyObject_CallMethod_SizeT -#endif - -/* Abstract Object Interface (many thanks to Jim Fulton) */ - -/* - PROPOSAL: A Generic Python Object Interface for Python C Modules - -Problem - - Python modules written in C that must access Python objects must do - so through routines whose interfaces are described by a set of - include files. Unfortunately, these routines vary according to the - object accessed. To use these routines, the C programmer must check - the type of the object being used and must call a routine based on - the object type. For example, to access an element of a sequence, - the programmer must determine whether the sequence is a list or a - tuple: - - if(is_tupleobject(o)) - e=gettupleitem(o,i) - else if(is_listitem(o)) - e=getlistitem(o,i) - - If the programmer wants to get an item from another type of object - that provides sequence behavior, there is no clear way to do it - correctly. - - The persistent programmer may peruse object.h and find that the - _typeobject structure provides a means of invoking up to (currently - about) 41 special operators. So, for example, a routine can get an - item from any object that provides sequence behavior. However, to - use this mechanism, the programmer must make their code dependent on - the current Python implementation. - - Also, certain semantics, especially memory management semantics, may - differ by the type of object being used. Unfortunately, these - semantics are not clearly described in the current include files. - An abstract interface providing more consistent semantics is needed. - -Proposal - - I propose the creation of a standard interface (with an associated - library of routines and/or macros) for generically obtaining the - services of Python objects. This proposal can be viewed as one - components of a Python C interface consisting of several components. - - From the viewpoint of C access to Python services, we have (as - suggested by Guido in off-line discussions): - - - "Very high level layer": two or three functions that let you exec or - eval arbitrary Python code given as a string in a module whose name is - given, passing C values in and getting C values out using - mkvalue/getargs style format strings. This does not require the user - to declare any variables of type "PyObject *". This should be enough - to write a simple application that gets Python code from the user, - execs it, and returns the output or errors. (Error handling must also - be part of this API.) - - - "Abstract objects layer": which is the subject of this proposal. - It has many functions operating on objects, and lest you do many - things from C that you can also write in Python, without going - through the Python parser. - - - "Concrete objects layer": This is the public type-dependent - interface provided by the standard built-in types, such as floats, - strings, and lists. This interface exists and is currently - documented by the collection of include files provided with the - Python distributions. - - From the point of view of Python accessing services provided by C - modules: - - - "Python module interface": this interface consist of the basic - routines used to define modules and their members. Most of the - current extensions-writing guide deals with this interface. - - - "Built-in object interface": this is the interface that a new - built-in type must provide and the mechanisms and rules that a - developer of a new built-in type must use and follow. - - This proposal is a "first-cut" that is intended to spur - discussion. See especially the lists of notes. - - The Python C object interface will provide four protocols: object, - numeric, sequence, and mapping. Each protocol consists of a - collection of related operations. If an operation that is not - provided by a particular type is invoked, then a standard exception, - NotImplementedError is raised with a operation name as an argument. - In addition, for convenience this interface defines a set of - constructors for building objects of built-in types. This is needed - so new objects can be returned from C functions that otherwise treat - objects generically. - -Memory Management - - For all of the functions described in this proposal, if a function - retains a reference to a Python object passed as an argument, then the - function will increase the reference count of the object. It is - unnecessary for the caller to increase the reference count of an - argument in anticipation of the object's retention. - - All Python objects returned from functions should be treated as new - objects. Functions that return objects assume that the caller will - retain a reference and the reference count of the object has already - been incremented to account for this fact. A caller that does not - retain a reference to an object that is returned from a function - must decrement the reference count of the object (using - DECREF(object)) to prevent memory leaks. - - Note that the behavior mentioned here is different from the current - behavior for some objects (e.g. lists and tuples) when certain - type-specific routines are called directly (e.g. setlistitem). The - proposed abstraction layer will provide a consistent memory - management interface, correcting for inconsistent behavior for some - built-in types. - -Protocols - -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/ - -/* Object Protocol: */ - - /* Implemented elsewhere: - - int PyObject_Print(PyObject *o, FILE *fp, int flags); - - Print an object, o, on file, fp. Returns -1 on - error. The flags argument is used to enable certain printing - options. The only option currently supported is Py_Print_RAW. - - (What should be said about Py_Print_RAW?) - - */ - - /* Implemented elsewhere: - - int PyObject_HasAttrString(PyObject *o, char *attr_name); - - Returns 1 if o has the attribute attr_name, and 0 otherwise. - This is equivalent to the Python expression: - hasattr(o,attr_name). - - This function always succeeds. - - */ - - /* Implemented elsewhere: - - PyObject* PyObject_GetAttrString(PyObject *o, char *attr_name); - - Retrieve an attributed named attr_name form object o. - Returns the attribute value on success, or NULL on failure. - This is the equivalent of the Python expression: o.attr_name. - - */ - - /* Implemented elsewhere: - - int PyObject_HasAttr(PyObject *o, PyObject *attr_name); - - Returns 1 if o has the attribute attr_name, and 0 otherwise. - This is equivalent to the Python expression: - hasattr(o,attr_name). - - This function always succeeds. - - */ - - /* Implemented elsewhere: - - PyObject* PyObject_GetAttr(PyObject *o, PyObject *attr_name); - - Retrieve an attributed named attr_name form object o. - Returns the attribute value on success, or NULL on failure. - This is the equivalent of the Python expression: o.attr_name. - - */ - - - /* Implemented elsewhere: - - int PyObject_SetAttrString(PyObject *o, char *attr_name, PyObject *v); - - Set the value of the attribute named attr_name, for object o, - to the value, v. Returns -1 on failure. This is - the equivalent of the Python statement: o.attr_name=v. - - */ - - /* Implemented elsewhere: - - int PyObject_SetAttr(PyObject *o, PyObject *attr_name, PyObject *v); - - Set the value of the attribute named attr_name, for object o, - to the value, v. Returns -1 on failure. This is - the equivalent of the Python statement: o.attr_name=v. - - */ - - /* implemented as a macro: - - int PyObject_DelAttrString(PyObject *o, char *attr_name); - - Delete attribute named attr_name, for object o. Returns - -1 on failure. This is the equivalent of the Python - statement: del o.attr_name. - - */ -#define PyObject_DelAttrString(O,A) PyObject_SetAttrString((O),(A),NULL) - - /* implemented as a macro: - - int PyObject_DelAttr(PyObject *o, PyObject *attr_name); - - Delete attribute named attr_name, for object o. Returns -1 - on failure. This is the equivalent of the Python - statement: del o.attr_name. - - */ -#define PyObject_DelAttr(O,A) PyObject_SetAttr((O),(A),NULL) - - PyAPI_FUNC(int) PyObject_Cmp(PyObject *o1, PyObject *o2, int *result); - - /* - Compare the values of o1 and o2 using a routine provided by - o1, if one exists, otherwise with a routine provided by o2. - The result of the comparison is returned in result. Returns - -1 on failure. This is the equivalent of the Python - statement: result=cmp(o1,o2). - - */ - - /* Implemented elsewhere: - - int PyObject_Compare(PyObject *o1, PyObject *o2); - - Compare the values of o1 and o2 using a routine provided by - o1, if one exists, otherwise with a routine provided by o2. - Returns the result of the comparison on success. On error, - the value returned is undefined. This is equivalent to the - Python expression: cmp(o1,o2). - - */ - - /* Implemented elsewhere: - - PyObject *PyObject_Repr(PyObject *o); - - Compute the string representation of object, o. Returns the - string representation on success, NULL on failure. This is - the equivalent of the Python expression: repr(o). - - Called by the repr() built-in function and by reverse quotes. - - */ - - /* Implemented elsewhere: - - PyObject *PyObject_Str(PyObject *o); - - Compute the string representation of object, o. Returns the - string representation on success, NULL on failure. This is - the equivalent of the Python expression: str(o).) - - Called by the str() built-in function and by the print - statement. - - */ - - /* Implemented elsewhere: - - PyObject *PyObject_Unicode(PyObject *o); - - Compute the unicode representation of object, o. Returns the - unicode representation on success, NULL on failure. This is - the equivalent of the Python expression: unistr(o).) - - Called by the unistr() built-in function. - - */ - - /* Declared elsewhere - - PyAPI_FUNC(int) PyCallable_Check(PyObject *o); - - Determine if the object, o, is callable. Return 1 if the - object is callable and 0 otherwise. - - This function always succeeds. - - */ - - - - PyAPI_FUNC(PyObject *) PyObject_Call(PyObject *callable_object, - PyObject *args, PyObject *kw); - - /* - Call a callable Python object, callable_object, with - arguments and keywords arguments. The 'args' argument can not be - NULL, but the 'kw' argument can be NULL. - - */ - - PyAPI_FUNC(PyObject *) PyObject_CallObject(PyObject *callable_object, - PyObject *args); - - /* - Call a callable Python object, callable_object, with - arguments given by the tuple, args. If no arguments are - needed, then args may be NULL. Returns the result of the - call on success, or NULL on failure. This is the equivalent - of the Python expression: apply(o,args). - - */ - - PyAPI_FUNC(PyObject *) PyObject_CallFunction(PyObject *callable_object, - char *format, ...); - - /* - Call a callable Python object, callable_object, with a - variable number of C arguments. The C arguments are described - using a mkvalue-style format string. The format may be NULL, - indicating that no arguments are provided. Returns the - result of the call on success, or NULL on failure. This is - the equivalent of the Python expression: apply(o,args). - - */ - - - PyAPI_FUNC(PyObject *) PyObject_CallMethod(PyObject *o, char *m, - char *format, ...); - - /* - Call the method named m of object o with a variable number of - C arguments. The C arguments are described by a mkvalue - format string. The format may be NULL, indicating that no - arguments are provided. Returns the result of the call on - success, or NULL on failure. This is the equivalent of the - Python expression: o.method(args). - */ - - PyAPI_FUNC(PyObject *) _PyObject_CallFunction_SizeT(PyObject *callable, - char *format, ...); - PyAPI_FUNC(PyObject *) _PyObject_CallMethod_SizeT(PyObject *o, - char *name, - char *format, ...); - - PyAPI_FUNC(PyObject *) PyObject_CallFunctionObjArgs(PyObject *callable, - ...); - - /* - Call a callable Python object, callable_object, with a - variable number of C arguments. The C arguments are provided - as PyObject * values, terminated by a NULL. Returns the - result of the call on success, or NULL on failure. This is - the equivalent of the Python expression: apply(o,args). - */ - - - PyAPI_FUNC(PyObject *) PyObject_CallMethodObjArgs(PyObject *o, - PyObject *m, ...); - - /* - Call the method named m of object o with a variable number of - C arguments. The C arguments are provided as PyObject * - values, terminated by NULL. Returns the result of the call - on success, or NULL on failure. This is the equivalent of - the Python expression: o.method(args). - */ - - - /* Implemented elsewhere: - - long PyObject_Hash(PyObject *o); - - Compute and return the hash, hash_value, of an object, o. On - failure, return -1. This is the equivalent of the Python - expression: hash(o). - - */ - - - /* Implemented elsewhere: - - int PyObject_IsTrue(PyObject *o); - - Returns 1 if the object, o, is considered to be true, 0 if o is - considered to be false and -1 on failure. This is equivalent to the - Python expression: not not o - - */ - - /* Implemented elsewhere: - - int PyObject_Not(PyObject *o); - - Returns 0 if the object, o, is considered to be true, 1 if o is - considered to be false and -1 on failure. This is equivalent to the - Python expression: not o - - */ - - PyAPI_FUNC(PyObject *) PyObject_Type(PyObject *o); - - /* - On success, returns a type object corresponding to the object - type of object o. On failure, returns NULL. This is - equivalent to the Python expression: type(o). - */ - - PyAPI_FUNC(Py_ssize_t) PyObject_Size(PyObject *o); - - /* - Return the size of object o. If the object, o, provides - both sequence and mapping protocols, the sequence size is - returned. On error, -1 is returned. This is the equivalent - to the Python expression: len(o). - - */ - - /* For DLL compatibility */ -#undef PyObject_Length - PyAPI_FUNC(Py_ssize_t) PyObject_Length(PyObject *o); -#define PyObject_Length PyObject_Size - - PyAPI_FUNC(Py_ssize_t) _PyObject_LengthHint(PyObject *o, Py_ssize_t); - - /* - Guess the size of object o using len(o) or o.__length_hint__(). - If neither of those return a non-negative value, then return the - default value. If one of the calls fails, this function returns -1. - */ - - PyAPI_FUNC(PyObject *) PyObject_GetItem(PyObject *o, PyObject *key); - - /* - Return element of o corresponding to the object, key, or NULL - on failure. This is the equivalent of the Python expression: - o[key]. - - */ - - PyAPI_FUNC(int) PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); - - /* - Map the object, key, to the value, v. Returns - -1 on failure. This is the equivalent of the Python - statement: o[key]=v. - */ - - PyAPI_FUNC(int) PyObject_DelItemString(PyObject *o, char *key); - - /* - Remove the mapping for object, key, from the object *o. - Returns -1 on failure. This is equivalent to - the Python statement: del o[key]. - */ - - PyAPI_FUNC(int) PyObject_DelItem(PyObject *o, PyObject *key); - - /* - Delete the mapping for key from *o. Returns -1 on failure. - This is the equivalent of the Python statement: del o[key]. - */ - - PyAPI_FUNC(int) PyObject_AsCharBuffer(PyObject *obj, - const char **buffer, - Py_ssize_t *buffer_len); - - /* - Takes an arbitrary object which must support the (character, - single segment) buffer interface and returns a pointer to a - read-only memory location useable as character based input - for subsequent processing. - - 0 is returned on success. buffer and buffer_len are only - set in case no error occurs. Otherwise, -1 is returned and - an exception set. - - */ - - PyAPI_FUNC(int) PyObject_CheckReadBuffer(PyObject *obj); - - /* - Checks whether an arbitrary object supports the (character, - single segment) buffer interface. Returns 1 on success, 0 - on failure. - - */ - - PyAPI_FUNC(int) PyObject_AsReadBuffer(PyObject *obj, - const void **buffer, - Py_ssize_t *buffer_len); - - /* - Same as PyObject_AsCharBuffer() except that this API expects - (readable, single segment) buffer interface and returns a - pointer to a read-only memory location which can contain - arbitrary data. - - 0 is returned on success. buffer and buffer_len are only - set in case no error occurs. Otherwise, -1 is returned and - an exception set. - - */ - - PyAPI_FUNC(int) PyObject_AsWriteBuffer(PyObject *obj, - void **buffer, - Py_ssize_t *buffer_len); - - /* - Takes an arbitrary object which must support the (writeable, - single segment) buffer interface and returns a pointer to a - writeable memory location in buffer of size buffer_len. - - 0 is returned on success. buffer and buffer_len are only - set in case no error occurs. Otherwise, -1 is returned and - an exception set. - - */ - - /* new buffer API */ - -#define PyObject_CheckBuffer(obj) \ - (((obj)->ob_type->tp_as_buffer != NULL) && \ - (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_NEWBUFFER)) && \ - ((obj)->ob_type->tp_as_buffer->bf_getbuffer != NULL)) - - /* Return 1 if the getbuffer function is available, otherwise - return 0 */ - - PyAPI_FUNC(int) PyObject_GetBuffer(PyObject *obj, Py_buffer *view, - int flags); - - /* This is a C-API version of the getbuffer function call. It checks - to make sure object has the required function pointer and issues the - call. Returns -1 and raises an error on failure and returns 0 on - success - */ - - - PyAPI_FUNC(void *) PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices); - - /* Get the memory area pointed to by the indices for the buffer given. - Note that view->ndim is the assumed size of indices - */ - - PyAPI_FUNC(int) PyBuffer_SizeFromFormat(const char *); - - /* Return the implied itemsize of the data-format area from a - struct-style description */ - - - - PyAPI_FUNC(int) PyBuffer_ToContiguous(void *buf, Py_buffer *view, - Py_ssize_t len, char fort); - - PyAPI_FUNC(int) PyBuffer_FromContiguous(Py_buffer *view, void *buf, - Py_ssize_t len, char fort); - - - /* Copy len bytes of data from the contiguous chunk of memory - pointed to by buf into the buffer exported by obj. Return - 0 on success and return -1 and raise a PyBuffer_Error on - error (i.e. the object does not have a buffer interface or - it is not working). - - If fort is 'F' and the object is multi-dimensional, - then the data will be copied into the array in - Fortran-style (first dimension varies the fastest). If - fort is 'C', then the data will be copied into the array - in C-style (last dimension varies the fastest). If fort - is 'A', then it does not matter and the copy will be made - in whatever way is more efficient. - - */ - - PyAPI_FUNC(int) PyObject_CopyData(PyObject *dest, PyObject *src); - - /* Copy the data from the src buffer to the buffer of destination - */ - - PyAPI_FUNC(int) PyBuffer_IsContiguous(Py_buffer *view, char fort); - - - PyAPI_FUNC(void) PyBuffer_FillContiguousStrides(int ndims, - Py_ssize_t *shape, - Py_ssize_t *strides, - int itemsize, - char fort); - - /* Fill the strides array with byte-strides of a contiguous - (Fortran-style if fort is 'F' or C-style otherwise) - array of the given shape with the given number of bytes - per element. - */ - - PyAPI_FUNC(int) PyBuffer_FillInfo(Py_buffer *view, PyObject *o, void *buf, - Py_ssize_t len, int readonly, - int flags); - - /* Fills in a buffer-info structure correctly for an exporter - that can only share a contiguous chunk of memory of - "unsigned bytes" of the given length. Returns 0 on success - and -1 (with raising an error) on error. - */ - - PyAPI_FUNC(void) PyBuffer_Release(Py_buffer *view); - - /* Releases a Py_buffer obtained from getbuffer ParseTuple's s*. - */ - - PyAPI_FUNC(PyObject *) PyObject_Format(PyObject* obj, - PyObject *format_spec); - /* - Takes an arbitrary object and returns the result of - calling obj.__format__(format_spec). - */ - -/* Iterators */ - - PyAPI_FUNC(PyObject *) PyObject_GetIter(PyObject *); - /* Takes an object and returns an iterator for it. - This is typically a new iterator but if the argument - is an iterator, this returns itself. */ - -#define PyIter_Check(obj) \ - (PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_ITER) && \ - (obj)->ob_type->tp_iternext != NULL && \ - (obj)->ob_type->tp_iternext != &_PyObject_NextNotImplemented) - - PyAPI_FUNC(PyObject *) PyIter_Next(PyObject *); - /* Takes an iterator object and calls its tp_iternext slot, - returning the next value. If the iterator is exhausted, - this returns NULL without setting an exception. - NULL with an exception means an error occurred. */ - -/* Number Protocol:*/ - - PyAPI_FUNC(int) PyNumber_Check(PyObject *o); - - /* - Returns 1 if the object, o, provides numeric protocols, and - false otherwise. - - This function always succeeds. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Add(PyObject *o1, PyObject *o2); - - /* - Returns the result of adding o1 and o2, or null on failure. - This is the equivalent of the Python expression: o1+o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Subtract(PyObject *o1, PyObject *o2); - - /* - Returns the result of subtracting o2 from o1, or null on - failure. This is the equivalent of the Python expression: - o1-o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Multiply(PyObject *o1, PyObject *o2); - - /* - Returns the result of multiplying o1 and o2, or null on - failure. This is the equivalent of the Python expression: - o1*o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Divide(PyObject *o1, PyObject *o2); - - /* - Returns the result of dividing o1 by o2, or null on failure. - This is the equivalent of the Python expression: o1/o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_FloorDivide(PyObject *o1, PyObject *o2); - - /* - Returns the result of dividing o1 by o2 giving an integral result, - or null on failure. - This is the equivalent of the Python expression: o1//o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_TrueDivide(PyObject *o1, PyObject *o2); - - /* - Returns the result of dividing o1 by o2 giving a float result, - or null on failure. - This is the equivalent of the Python expression: o1/o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Remainder(PyObject *o1, PyObject *o2); - - /* - Returns the remainder of dividing o1 by o2, or null on - failure. This is the equivalent of the Python expression: - o1%o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Divmod(PyObject *o1, PyObject *o2); - - /* - See the built-in function divmod. Returns NULL on failure. - This is the equivalent of the Python expression: - divmod(o1,o2). - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Power(PyObject *o1, PyObject *o2, - PyObject *o3); - - /* - See the built-in function pow. Returns NULL on failure. - This is the equivalent of the Python expression: - pow(o1,o2,o3), where o3 is optional. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Negative(PyObject *o); - - /* - Returns the negation of o on success, or null on failure. - This is the equivalent of the Python expression: -o. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Positive(PyObject *o); - - /* - Returns the (what?) of o on success, or NULL on failure. - This is the equivalent of the Python expression: +o. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Absolute(PyObject *o); - - /* - Returns the absolute value of o, or null on failure. This is - the equivalent of the Python expression: abs(o). - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Invert(PyObject *o); - - /* - Returns the bitwise negation of o on success, or NULL on - failure. This is the equivalent of the Python expression: - ~o. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Lshift(PyObject *o1, PyObject *o2); - - /* - Returns the result of left shifting o1 by o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1 << o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Rshift(PyObject *o1, PyObject *o2); - - /* - Returns the result of right shifting o1 by o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1 >> o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_And(PyObject *o1, PyObject *o2); - - /* - Returns the result of bitwise and of o1 and o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1&o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Xor(PyObject *o1, PyObject *o2); - - /* - Returns the bitwise exclusive or of o1 by o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1^o2. - - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Or(PyObject *o1, PyObject *o2); - - /* - Returns the result of bitwise or on o1 and o2 on success, or - NULL on failure. This is the equivalent of the Python - expression: o1|o2. - - */ - - /* Implemented elsewhere: - - int PyNumber_Coerce(PyObject **p1, PyObject **p2); - - This function takes the addresses of two variables of type - PyObject*. - - If the objects pointed to by *p1 and *p2 have the same type, - increment their reference count and return 0 (success). - If the objects can be converted to a common numeric type, - replace *p1 and *p2 by their converted value (with 'new' - reference counts), and return 0. - If no conversion is possible, or if some other error occurs, - return -1 (failure) and don't increment the reference counts. - The call PyNumber_Coerce(&o1, &o2) is equivalent to the Python - statement o1, o2 = coerce(o1, o2). - - */ - -#define PyIndex_Check(obj) \ - ((obj)->ob_type->tp_as_number != NULL && \ - PyType_HasFeature((obj)->ob_type, Py_TPFLAGS_HAVE_INDEX) && \ - (obj)->ob_type->tp_as_number->nb_index != NULL) - - PyAPI_FUNC(PyObject *) PyNumber_Index(PyObject *o); - - /* - Returns the object converted to a Python long or int - or NULL with an error raised on failure. - */ - - PyAPI_FUNC(Py_ssize_t) PyNumber_AsSsize_t(PyObject *o, PyObject *exc); - - /* - Returns the Integral instance converted to an int. The - instance is expected to be int or long or have an __int__ - method. Steals integral's reference. error_format will be - used to create the TypeError if integral isn't actually an - Integral instance. error_format should be a format string - that can accept a char* naming integral's type. - */ - - PyAPI_FUNC(PyObject *) _PyNumber_ConvertIntegralToInt( - PyObject *integral, - const char* error_format); - - /* - Returns the object converted to Py_ssize_t by going through - PyNumber_Index first. If an overflow error occurs while - converting the int-or-long to Py_ssize_t, then the second argument - is the error-type to return. If it is NULL, then the overflow error - is cleared and the value is clipped. - */ - - PyAPI_FUNC(PyObject *) PyNumber_Int(PyObject *o); - - /* - Returns the o converted to an integer object on success, or - NULL on failure. This is the equivalent of the Python - expression: int(o). - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Long(PyObject *o); - - /* - Returns the o converted to a long integer object on success, - or NULL on failure. This is the equivalent of the Python - expression: long(o). - - */ - - PyAPI_FUNC(PyObject *) PyNumber_Float(PyObject *o); - - /* - Returns the o converted to a float object on success, or NULL - on failure. This is the equivalent of the Python expression: - float(o). - */ - -/* In-place variants of (some of) the above number protocol functions */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceAdd(PyObject *o1, PyObject *o2); - - /* - Returns the result of adding o2 to o1, possibly in-place, or null - on failure. This is the equivalent of the Python expression: - o1 += o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceSubtract(PyObject *o1, PyObject *o2); - - /* - Returns the result of subtracting o2 from o1, possibly in-place or - null on failure. This is the equivalent of the Python expression: - o1 -= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceMultiply(PyObject *o1, PyObject *o2); - - /* - Returns the result of multiplying o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 *= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceDivide(PyObject *o1, PyObject *o2); - - /* - Returns the result of dividing o1 by o2, possibly in-place, or null - on failure. This is the equivalent of the Python expression: - o1 /= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceFloorDivide(PyObject *o1, - PyObject *o2); - - /* - Returns the result of dividing o1 by o2 giving an integral result, - possibly in-place, or null on failure. - This is the equivalent of the Python expression: - o1 /= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceTrueDivide(PyObject *o1, - PyObject *o2); - - /* - Returns the result of dividing o1 by o2 giving a float result, - possibly in-place, or null on failure. - This is the equivalent of the Python expression: - o1 /= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceRemainder(PyObject *o1, PyObject *o2); - - /* - Returns the remainder of dividing o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 %= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlacePower(PyObject *o1, PyObject *o2, - PyObject *o3); - - /* - Returns the result of raising o1 to the power of o2, possibly - in-place, or null on failure. This is the equivalent of the Python - expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceLshift(PyObject *o1, PyObject *o2); - - /* - Returns the result of left shifting o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 <<= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceRshift(PyObject *o1, PyObject *o2); - - /* - Returns the result of right shifting o1 by o2, possibly in-place or - null on failure. This is the equivalent of the Python expression: - o1 >>= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceAnd(PyObject *o1, PyObject *o2); - - /* - Returns the result of bitwise and of o1 and o2, possibly in-place, - or null on failure. This is the equivalent of the Python - expression: o1 &= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceXor(PyObject *o1, PyObject *o2); - - /* - Returns the bitwise exclusive or of o1 by o2, possibly in-place, or - null on failure. This is the equivalent of the Python expression: - o1 ^= o2. - - */ - - PyAPI_FUNC(PyObject *) PyNumber_InPlaceOr(PyObject *o1, PyObject *o2); - - /* - Returns the result of bitwise or of o1 and o2, possibly in-place, - or null on failure. This is the equivalent of the Python - expression: o1 |= o2. - - */ - - - PyAPI_FUNC(PyObject *) PyNumber_ToBase(PyObject *n, int base); - - /* - Returns the integer n converted to a string with a base, with a base - marker of 0b, 0o or 0x prefixed if applicable. - If n is not an int object, it is converted with PyNumber_Index first. - */ - - -/* Sequence protocol:*/ - - PyAPI_FUNC(int) PySequence_Check(PyObject *o); - - /* - Return 1 if the object provides sequence protocol, and zero - otherwise. - - This function always succeeds. - - */ - - PyAPI_FUNC(Py_ssize_t) PySequence_Size(PyObject *o); - - /* - Return the size of sequence object o, or -1 on failure. - - */ - - /* For DLL compatibility */ -#undef PySequence_Length - PyAPI_FUNC(Py_ssize_t) PySequence_Length(PyObject *o); -#define PySequence_Length PySequence_Size - - - PyAPI_FUNC(PyObject *) PySequence_Concat(PyObject *o1, PyObject *o2); - - /* - Return the concatenation of o1 and o2 on success, and NULL on - failure. This is the equivalent of the Python - expression: o1+o2. - - */ - - PyAPI_FUNC(PyObject *) PySequence_Repeat(PyObject *o, Py_ssize_t count); - - /* - Return the result of repeating sequence object o count times, - or NULL on failure. This is the equivalent of the Python - expression: o1*count. - - */ - - PyAPI_FUNC(PyObject *) PySequence_GetItem(PyObject *o, Py_ssize_t i); - - /* - Return the ith element of o, or NULL on failure. This is the - equivalent of the Python expression: o[i]. - */ - - PyAPI_FUNC(PyObject *) PySequence_GetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); - - /* - Return the slice of sequence object o between i1 and i2, or - NULL on failure. This is the equivalent of the Python - expression: o[i1:i2]. - - */ - - PyAPI_FUNC(int) PySequence_SetItem(PyObject *o, Py_ssize_t i, PyObject *v); - - /* - Assign object v to the ith element of o. Returns - -1 on failure. This is the equivalent of the Python - statement: o[i]=v. - - */ - - PyAPI_FUNC(int) PySequence_DelItem(PyObject *o, Py_ssize_t i); - - /* - Delete the ith element of object v. Returns - -1 on failure. This is the equivalent of the Python - statement: del o[i]. - */ - - PyAPI_FUNC(int) PySequence_SetSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2, - PyObject *v); - - /* - Assign the sequence object, v, to the slice in sequence - object, o, from i1 to i2. Returns -1 on failure. This is the - equivalent of the Python statement: o[i1:i2]=v. - */ - - PyAPI_FUNC(int) PySequence_DelSlice(PyObject *o, Py_ssize_t i1, Py_ssize_t i2); - - /* - Delete the slice in sequence object, o, from i1 to i2. - Returns -1 on failure. This is the equivalent of the Python - statement: del o[i1:i2]. - */ - - PyAPI_FUNC(PyObject *) PySequence_Tuple(PyObject *o); - - /* - Returns the sequence, o, as a tuple on success, and NULL on failure. - This is equivalent to the Python expression: tuple(o) - */ - - - PyAPI_FUNC(PyObject *) PySequence_List(PyObject *o); - /* - Returns the sequence, o, as a list on success, and NULL on failure. - This is equivalent to the Python expression: list(o) - */ - - PyAPI_FUNC(PyObject *) PySequence_Fast(PyObject *o, const char* m); - /* - Return the sequence, o, as a list, unless it's already a - tuple or list. Use PySequence_Fast_GET_ITEM to access the - members of this list, and PySequence_Fast_GET_SIZE to get its length. - - Returns NULL on failure. If the object does not support iteration, - raises a TypeError exception with m as the message text. - */ - -#define PySequence_Fast_GET_SIZE(o) \ - (PyList_Check(o) ? PyList_GET_SIZE(o) : PyTuple_GET_SIZE(o)) - /* - Return the size of o, assuming that o was returned by - PySequence_Fast and is not NULL. - */ - -#define PySequence_Fast_GET_ITEM(o, i)\ - (PyList_Check(o) ? PyList_GET_ITEM(o, i) : PyTuple_GET_ITEM(o, i)) - /* - Return the ith element of o, assuming that o was returned by - PySequence_Fast, and that i is within bounds. - */ - -#define PySequence_ITEM(o, i)\ - ( Py_TYPE(o)->tp_as_sequence->sq_item(o, i) ) - /* Assume tp_as_sequence and sq_item exist and that i does not - need to be corrected for a negative index - */ - -#define PySequence_Fast_ITEMS(sf) \ - (PyList_Check(sf) ? ((PyListObject *)(sf))->ob_item \ - : ((PyTupleObject *)(sf))->ob_item) - /* Return a pointer to the underlying item array for - an object retured by PySequence_Fast */ - - PyAPI_FUNC(Py_ssize_t) PySequence_Count(PyObject *o, PyObject *value); - - /* - Return the number of occurrences on value on o, that is, - return the number of keys for which o[key]==value. On - failure, return -1. This is equivalent to the Python - expression: o.count(value). - */ - - PyAPI_FUNC(int) PySequence_Contains(PyObject *seq, PyObject *ob); - /* - Return -1 if error; 1 if ob in seq; 0 if ob not in seq. - Use __contains__ if possible, else _PySequence_IterSearch(). - */ - -#define PY_ITERSEARCH_COUNT 1 -#define PY_ITERSEARCH_INDEX 2 -#define PY_ITERSEARCH_CONTAINS 3 - PyAPI_FUNC(Py_ssize_t) _PySequence_IterSearch(PyObject *seq, - PyObject *obj, int operation); - /* - Iterate over seq. Result depends on the operation: - PY_ITERSEARCH_COUNT: return # of times obj appears in seq; -1 if - error. - PY_ITERSEARCH_INDEX: return 0-based index of first occurrence of - obj in seq; set ValueError and return -1 if none found; - also return -1 on error. - PY_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on - error. - */ - -/* For DLL-level backwards compatibility */ -#undef PySequence_In - PyAPI_FUNC(int) PySequence_In(PyObject *o, PyObject *value); - -/* For source-level backwards compatibility */ -#define PySequence_In PySequence_Contains - - /* - Determine if o contains value. If an item in o is equal to - X, return 1, otherwise return 0. On error, return -1. This - is equivalent to the Python expression: value in o. - */ - - PyAPI_FUNC(Py_ssize_t) PySequence_Index(PyObject *o, PyObject *value); - - /* - Return the first index for which o[i]=value. On error, - return -1. This is equivalent to the Python - expression: o.index(value). - */ - -/* In-place versions of some of the above Sequence functions. */ - - PyAPI_FUNC(PyObject *) PySequence_InPlaceConcat(PyObject *o1, PyObject *o2); - - /* - Append o2 to o1, in-place when possible. Return the resulting - object, which could be o1, or NULL on failure. This is the - equivalent of the Python expression: o1 += o2. - - */ - - PyAPI_FUNC(PyObject *) PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count); - - /* - Repeat o1 by count, in-place when possible. Return the resulting - object, which could be o1, or NULL on failure. This is the - equivalent of the Python expression: o1 *= count. - - */ - -/* Mapping protocol:*/ - - PyAPI_FUNC(int) PyMapping_Check(PyObject *o); - - /* - Return 1 if the object provides mapping protocol, and zero - otherwise. - - This function always succeeds. - */ - - PyAPI_FUNC(Py_ssize_t) PyMapping_Size(PyObject *o); - - /* - Returns the number of keys in object o on success, and -1 on - failure. For objects that do not provide sequence protocol, - this is equivalent to the Python expression: len(o). - */ - - /* For DLL compatibility */ -#undef PyMapping_Length - PyAPI_FUNC(Py_ssize_t) PyMapping_Length(PyObject *o); -#define PyMapping_Length PyMapping_Size - - - /* implemented as a macro: - - int PyMapping_DelItemString(PyObject *o, char *key); - - Remove the mapping for object, key, from the object *o. - Returns -1 on failure. This is equivalent to - the Python statement: del o[key]. - */ -#define PyMapping_DelItemString(O,K) PyObject_DelItemString((O),(K)) - - /* implemented as a macro: - - int PyMapping_DelItem(PyObject *o, PyObject *key); - - Remove the mapping for object, key, from the object *o. - Returns -1 on failure. This is equivalent to - the Python statement: del o[key]. - */ -#define PyMapping_DelItem(O,K) PyObject_DelItem((O),(K)) - - PyAPI_FUNC(int) PyMapping_HasKeyString(PyObject *o, char *key); - - /* - On success, return 1 if the mapping object has the key, key, - and 0 otherwise. This is equivalent to the Python expression: - o.has_key(key). - - This function always succeeds. - */ - - PyAPI_FUNC(int) PyMapping_HasKey(PyObject *o, PyObject *key); - - /* - Return 1 if the mapping object has the key, key, - and 0 otherwise. This is equivalent to the Python expression: - o.has_key(key). - - This function always succeeds. - - */ - - /* Implemented as macro: - - PyObject *PyMapping_Keys(PyObject *o); - - On success, return a list of the keys in object o. On - failure, return NULL. This is equivalent to the Python - expression: o.keys(). - */ -#define PyMapping_Keys(O) PyObject_CallMethod(O,"keys",NULL) - - /* Implemented as macro: - - PyObject *PyMapping_Values(PyObject *o); - - On success, return a list of the values in object o. On - failure, return NULL. This is equivalent to the Python - expression: o.values(). - */ -#define PyMapping_Values(O) PyObject_CallMethod(O,"values",NULL) - - /* Implemented as macro: - - PyObject *PyMapping_Items(PyObject *o); - - On success, return a list of the items in object o, where - each item is a tuple containing a key-value pair. On - failure, return NULL. This is equivalent to the Python - expression: o.items(). - - */ -#define PyMapping_Items(O) PyObject_CallMethod(O,"items",NULL) - - PyAPI_FUNC(PyObject *) PyMapping_GetItemString(PyObject *o, char *key); - - /* - Return element of o corresponding to the object, key, or NULL - on failure. This is the equivalent of the Python expression: - o[key]. - */ - - PyAPI_FUNC(int) PyMapping_SetItemString(PyObject *o, char *key, - PyObject *value); - - /* - Map the object, key, to the value, v. Returns - -1 on failure. This is the equivalent of the Python - statement: o[key]=v. - */ - - -PyAPI_FUNC(int) PyObject_IsInstance(PyObject *object, PyObject *typeorclass); - /* isinstance(object, typeorclass) */ - -PyAPI_FUNC(int) PyObject_IsSubclass(PyObject *object, PyObject *typeorclass); - /* issubclass(object, typeorclass) */ - - -PyAPI_FUNC(int) _PyObject_RealIsInstance(PyObject *inst, PyObject *cls); - -PyAPI_FUNC(int) _PyObject_RealIsSubclass(PyObject *derived, PyObject *cls); - - -/* For internal use by buffer API functions */ -PyAPI_FUNC(void) _Py_add_one_to_index_F(int nd, Py_ssize_t *index, - const Py_ssize_t *shape); -PyAPI_FUNC(void) _Py_add_one_to_index_C(int nd, Py_ssize_t *index, - const Py_ssize_t *shape); - - -#ifdef __cplusplus -} -#endif -#endif /* Py_ABSTRACTOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/asdl.h b/AppPkg/Applications/Python/Python-2.7.10/Include/asdl.h deleted file mode 100644 index d72b2f8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/asdl.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef Py_ASDL_H -#define Py_ASDL_H - -typedef PyObject * identifier; -typedef PyObject * string; -typedef PyObject * object; - -#ifndef __cplusplus -typedef enum {false, true} bool; -#endif - -/* It would be nice if the code generated by asdl_c.py was completely - independent of Python, but it is a goal the requires too much work - at this stage. So, for example, I'll represent identifiers as - interned Python strings. -*/ - -/* XXX A sequence should be typed so that its use can be typechecked. */ - -typedef struct { - int size; - void *elements[1]; -} asdl_seq; - -typedef struct { - int size; - int elements[1]; -} asdl_int_seq; - -asdl_seq *asdl_seq_new(int size, PyArena *arena); -asdl_int_seq *asdl_int_seq_new(int size, PyArena *arena); - -#define asdl_seq_GET(S, I) (S)->elements[(I)] -#define asdl_seq_LEN(S) ((S) == NULL ? 0 : (S)->size) -#ifdef Py_DEBUG -#define asdl_seq_SET(S, I, V) { \ - int _asdl_i = (I); \ - assert((S) && _asdl_i < (S)->size); \ - (S)->elements[_asdl_i] = (V); \ -} -#else -#define asdl_seq_SET(S, I, V) (S)->elements[I] = (V) -#endif - -#endif /* !Py_ASDL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/ast.h b/AppPkg/Applications/Python/Python-2.7.10/Include/ast.h deleted file mode 100644 index 77dbe5f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/ast.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef Py_AST_H -#define Py_AST_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(mod_ty) PyAST_FromNode(const node *, PyCompilerFlags *flags, - const char *, PyArena *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_AST_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/bitset.h b/AppPkg/Applications/Python/Python-2.7.10/Include/bitset.h deleted file mode 100644 index 028acdf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/bitset.h +++ /dev/null @@ -1,32 +0,0 @@ - -#ifndef Py_BITSET_H -#define Py_BITSET_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Bitset interface */ - -#define BYTE char - -typedef BYTE *bitset; - -bitset newbitset(int nbits); -void delbitset(bitset bs); -#define testbit(ss, ibit) (((ss)[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0) -int addbit(bitset bs, int ibit); /* Returns 0 if already set */ -int samebitset(bitset bs1, bitset bs2, int nbits); -void mergebitset(bitset bs1, bitset bs2, int nbits); - -#define BITSPERBYTE (8*sizeof(BYTE)) -#define NBYTES(nbits) (((nbits) + BITSPERBYTE - 1) / BITSPERBYTE) - -#define BIT2BYTE(ibit) ((ibit) / BITSPERBYTE) -#define BIT2SHIFT(ibit) ((ibit) % BITSPERBYTE) -#define BIT2MASK(ibit) (1 << BIT2SHIFT(ibit)) -#define BYTE2BIT(ibyte) ((ibyte) * BITSPERBYTE) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_BITSET_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/boolobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/boolobject.h deleted file mode 100644 index 9dd0e43..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/boolobject.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Boolean object interface */ - -#ifndef Py_BOOLOBJECT_H -#define Py_BOOLOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -typedef PyIntObject PyBoolObject; - -PyAPI_DATA(PyTypeObject) PyBool_Type; - -#define PyBool_Check(x) (Py_TYPE(x) == &PyBool_Type) - -/* Py_False and Py_True are the only two bools in existence. -Don't forget to apply Py_INCREF() when returning either!!! */ - -/* Don't use these directly */ -PyAPI_DATA(PyIntObject) _Py_ZeroStruct, _Py_TrueStruct; - -/* Use these macros */ -#define Py_False ((PyObject *) &_Py_ZeroStruct) -#define Py_True ((PyObject *) &_Py_TrueStruct) - -/* Macros for returning Py_True or Py_False, respectively */ -#define Py_RETURN_TRUE return Py_INCREF(Py_True), Py_True -#define Py_RETURN_FALSE return Py_INCREF(Py_False), Py_False - -/* Function to return a bool from a C long */ -PyAPI_FUNC(PyObject *) PyBool_FromLong(long); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_BOOLOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/bufferobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/bufferobject.h deleted file mode 100644 index 6c33a8b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/bufferobject.h +++ /dev/null @@ -1,33 +0,0 @@ - -/* Buffer object interface */ - -/* Note: the object's structure is private */ - -#ifndef Py_BUFFEROBJECT_H -#define Py_BUFFEROBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -PyAPI_DATA(PyTypeObject) PyBuffer_Type; - -#define PyBuffer_Check(op) (Py_TYPE(op) == &PyBuffer_Type) - -#define Py_END_OF_BUFFER (-1) - -PyAPI_FUNC(PyObject *) PyBuffer_FromObject(PyObject *base, - Py_ssize_t offset, Py_ssize_t size); -PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteObject(PyObject *base, - Py_ssize_t offset, - Py_ssize_t size); - -PyAPI_FUNC(PyObject *) PyBuffer_FromMemory(void *ptr, Py_ssize_t size); -PyAPI_FUNC(PyObject *) PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size); - -PyAPI_FUNC(PyObject *) PyBuffer_New(Py_ssize_t size); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_BUFFEROBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/bytearrayobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/bytearrayobject.h deleted file mode 100644 index 6d5af4d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/bytearrayobject.h +++ /dev/null @@ -1,57 +0,0 @@ -/* ByteArray object interface */ - -#ifndef Py_BYTEARRAYOBJECT_H -#define Py_BYTEARRAYOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* Type PyByteArrayObject represents a mutable array of bytes. - * The Python API is that of a sequence; - * the bytes are mapped to ints in [0, 256). - * Bytes are not characters; they may be used to encode characters. - * The only way to go between bytes and str/unicode is via encoding - * and decoding. - * For the convenience of C programmers, the bytes type is considered - * to contain a char pointer, not an unsigned char pointer. - */ - -/* Object layout */ -typedef struct { - PyObject_VAR_HEAD - /* XXX(nnorwitz): should ob_exports be Py_ssize_t? */ - int ob_exports; /* how many buffer exports */ - Py_ssize_t ob_alloc; /* How many bytes allocated */ - char *ob_bytes; -} PyByteArrayObject; - -/* Type object */ -PyAPI_DATA(PyTypeObject) PyByteArray_Type; -PyAPI_DATA(PyTypeObject) PyByteArrayIter_Type; - -/* Type check macros */ -#define PyByteArray_Check(self) PyObject_TypeCheck(self, &PyByteArray_Type) -#define PyByteArray_CheckExact(self) (Py_TYPE(self) == &PyByteArray_Type) - -/* Direct API functions */ -PyAPI_FUNC(PyObject *) PyByteArray_FromObject(PyObject *); -PyAPI_FUNC(PyObject *) PyByteArray_Concat(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyByteArray_FromStringAndSize(const char *, Py_ssize_t); -PyAPI_FUNC(Py_ssize_t) PyByteArray_Size(PyObject *); -PyAPI_FUNC(char *) PyByteArray_AsString(PyObject *); -PyAPI_FUNC(int) PyByteArray_Resize(PyObject *, Py_ssize_t); - -/* Macros, trading safety for speed */ -#define PyByteArray_AS_STRING(self) \ - (assert(PyByteArray_Check(self)), \ - Py_SIZE(self) ? ((PyByteArrayObject *)(self))->ob_bytes : _PyByteArray_empty_string) -#define PyByteArray_GET_SIZE(self) (assert(PyByteArray_Check(self)),Py_SIZE(self)) - -PyAPI_DATA(char) _PyByteArray_empty_string[]; - -#ifdef __cplusplus -} -#endif -#endif /* !Py_BYTEARRAYOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/bytes_methods.h b/AppPkg/Applications/Python/Python-2.7.10/Include/bytes_methods.h deleted file mode 100644 index 64ba0aa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/bytes_methods.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef Py_BYTES_CTYPE_H -#define Py_BYTES_CTYPE_H - -/* - * The internal implementation behind PyString (bytes) and PyBytes (buffer) - * methods of the given names, they operate on ASCII byte strings. - */ -extern PyObject* _Py_bytes_isspace(const char *cptr, Py_ssize_t len); -extern PyObject* _Py_bytes_isalpha(const char *cptr, Py_ssize_t len); -extern PyObject* _Py_bytes_isalnum(const char *cptr, Py_ssize_t len); -extern PyObject* _Py_bytes_isdigit(const char *cptr, Py_ssize_t len); -extern PyObject* _Py_bytes_islower(const char *cptr, Py_ssize_t len); -extern PyObject* _Py_bytes_isupper(const char *cptr, Py_ssize_t len); -extern PyObject* _Py_bytes_istitle(const char *cptr, Py_ssize_t len); - -/* These store their len sized answer in the given preallocated *result arg. */ -extern void _Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len); -extern void _Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len); -extern void _Py_bytes_title(char *result, char *s, Py_ssize_t len); -extern void _Py_bytes_capitalize(char *result, char *s, Py_ssize_t len); -extern void _Py_bytes_swapcase(char *result, char *s, Py_ssize_t len); - -/* Shared __doc__ strings. */ -extern const char _Py_isspace__doc__[]; -extern const char _Py_isalpha__doc__[]; -extern const char _Py_isalnum__doc__[]; -extern const char _Py_isdigit__doc__[]; -extern const char _Py_islower__doc__[]; -extern const char _Py_isupper__doc__[]; -extern const char _Py_istitle__doc__[]; -extern const char _Py_lower__doc__[]; -extern const char _Py_upper__doc__[]; -extern const char _Py_title__doc__[]; -extern const char _Py_capitalize__doc__[]; -extern const char _Py_swapcase__doc__[]; - -/* These are left in for backward compatibility and will be removed - in 2.8/3.2 */ -#define ISLOWER(c) Py_ISLOWER(c) -#define ISUPPER(c) Py_ISUPPER(c) -#define ISALPHA(c) Py_ISALPHA(c) -#define ISDIGIT(c) Py_ISDIGIT(c) -#define ISXDIGIT(c) Py_ISXDIGIT(c) -#define ISALNUM(c) Py_ISALNUM(c) -#define ISSPACE(c) Py_ISSPACE(c) - -#undef islower -#define islower(c) undefined_islower(c) -#undef isupper -#define isupper(c) undefined_isupper(c) -#undef isalpha -#define isalpha(c) undefined_isalpha(c) -#undef isdigit -#define isdigit(c) undefined_isdigit(c) -#undef isxdigit -#define isxdigit(c) undefined_isxdigit(c) -#undef isalnum -#define isalnum(c) undefined_isalnum(c) -#undef isspace -#define isspace(c) undefined_isspace(c) - -/* These are left in for backward compatibility and will be removed - in 2.8/3.2 */ -#define TOLOWER(c) Py_TOLOWER(c) -#define TOUPPER(c) Py_TOUPPER(c) - -#undef tolower -#define tolower(c) undefined_tolower(c) -#undef toupper -#define toupper(c) undefined_toupper(c) - -/* this is needed because some docs are shared from the .o, not static */ -#define PyDoc_STRVAR_shared(name,str) const char name[] = PyDoc_STR(str) - -#endif /* !Py_BYTES_CTYPE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/bytesobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/bytesobject.h deleted file mode 100644 index d60bdc0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/bytesobject.h +++ /dev/null @@ -1,27 +0,0 @@ -#define PyBytesObject PyStringObject -#define PyBytes_Type PyString_Type - -#define PyBytes_Check PyString_Check -#define PyBytes_CheckExact PyString_CheckExact -#define PyBytes_CHECK_INTERNED PyString_CHECK_INTERNED -#define PyBytes_AS_STRING PyString_AS_STRING -#define PyBytes_GET_SIZE PyString_GET_SIZE -#define Py_TPFLAGS_BYTES_SUBCLASS Py_TPFLAGS_STRING_SUBCLASS - -#define PyBytes_FromStringAndSize PyString_FromStringAndSize -#define PyBytes_FromString PyString_FromString -#define PyBytes_FromFormatV PyString_FromFormatV -#define PyBytes_FromFormat PyString_FromFormat -#define PyBytes_Size PyString_Size -#define PyBytes_AsString PyString_AsString -#define PyBytes_Repr PyString_Repr -#define PyBytes_Concat PyString_Concat -#define PyBytes_ConcatAndDel PyString_ConcatAndDel -#define _PyBytes_Resize _PyString_Resize -#define _PyBytes_Eq _PyString_Eq -#define PyBytes_Format PyString_Format -#define _PyBytes_FormatLong _PyString_FormatLong -#define PyBytes_DecodeEscape PyString_DecodeEscape -#define _PyBytes_Join _PyString_Join -#define PyBytes_AsStringAndSize PyString_AsStringAndSize -#define _PyBytes_InsertThousandsGrouping _PyString_InsertThousandsGrouping diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/cStringIO.h b/AppPkg/Applications/Python/Python-2.7.10/Include/cStringIO.h deleted file mode 100644 index 391309a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/cStringIO.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef Py_CSTRINGIO_H -#define Py_CSTRINGIO_H -#ifdef __cplusplus -extern "C" { -#endif -/* - - This header provides access to cStringIO objects from C. - Functions are provided for calling cStringIO objects and - macros are provided for testing whether you have cStringIO - objects. - - Before calling any of the functions or macros, you must initialize - the routines with: - - PycString_IMPORT - - This would typically be done in your init function. - -*/ - -#define PycStringIO_CAPSULE_NAME "cStringIO.cStringIO_CAPI" - -#define PycString_IMPORT \ - PycStringIO = ((struct PycStringIO_CAPI*)PyCapsule_Import(\ - PycStringIO_CAPSULE_NAME, 0)) - -/* Basic functions to manipulate cStringIO objects from C */ - -static struct PycStringIO_CAPI { - - /* Read a string from an input object. If the last argument - is -1, the remainder will be read. - */ - int(*cread)(PyObject *, char **, Py_ssize_t); - - /* Read a line from an input object. Returns the length of the read - line as an int and a pointer inside the object buffer as char** (so - the caller doesn't have to provide its own buffer as destination). - */ - int(*creadline)(PyObject *, char **); - - /* Write a string to an output object*/ - int(*cwrite)(PyObject *, const char *, Py_ssize_t); - - /* Get the output object as a Python string (returns new reference). */ - PyObject *(*cgetvalue)(PyObject *); - - /* Create a new output object */ - PyObject *(*NewOutput)(int); - - /* Create an input object from a Python string - (copies the Python string reference). - */ - PyObject *(*NewInput)(PyObject *); - - /* The Python types for cStringIO input and output objects. - Note that you can do input on an output object. - */ - PyTypeObject *InputType, *OutputType; - -} *PycStringIO; - -/* These can be used to test if you have one */ -#define PycStringIO_InputCheck(O) \ - (Py_TYPE(O)==PycStringIO->InputType) -#define PycStringIO_OutputCheck(O) \ - (Py_TYPE(O)==PycStringIO->OutputType) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CSTRINGIO_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/cellobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/cellobject.h deleted file mode 100644 index 8d27f35..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/cellobject.h +++ /dev/null @@ -1,28 +0,0 @@ -/* Cell object interface */ - -#ifndef Py_CELLOBJECT_H -#define Py_CELLOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - PyObject *ob_ref; /* Content of the cell or NULL when empty */ -} PyCellObject; - -PyAPI_DATA(PyTypeObject) PyCell_Type; - -#define PyCell_Check(op) (Py_TYPE(op) == &PyCell_Type) - -PyAPI_FUNC(PyObject *) PyCell_New(PyObject *); -PyAPI_FUNC(PyObject *) PyCell_Get(PyObject *); -PyAPI_FUNC(int) PyCell_Set(PyObject *, PyObject *); - -#define PyCell_GET(op) (((PyCellObject *)(op))->ob_ref) -#define PyCell_SET(op, v) (((PyCellObject *)(op))->ob_ref = v) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_TUPLEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/ceval.h b/AppPkg/Applications/Python/Python-2.7.10/Include/ceval.h deleted file mode 100644 index 58b2ded..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/ceval.h +++ /dev/null @@ -1,153 +0,0 @@ -#ifndef Py_CEVAL_H -#define Py_CEVAL_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Interface to random parts in ceval.c */ - -PyAPI_FUNC(PyObject *) PyEval_CallObjectWithKeywords( - PyObject *, PyObject *, PyObject *); - -/* Inline this */ -#define PyEval_CallObject(func,arg) \ - PyEval_CallObjectWithKeywords(func, arg, (PyObject *)NULL) - -PyAPI_FUNC(PyObject *) PyEval_CallFunction(PyObject *obj, - const char *format, ...); -PyAPI_FUNC(PyObject *) PyEval_CallMethod(PyObject *obj, - const char *methodname, - const char *format, ...); - -PyAPI_FUNC(void) PyEval_SetProfile(Py_tracefunc, PyObject *); -PyAPI_FUNC(void) PyEval_SetTrace(Py_tracefunc, PyObject *); - -struct _frame; /* Avoid including frameobject.h */ - -PyAPI_FUNC(PyObject *) PyEval_GetBuiltins(void); -PyAPI_FUNC(PyObject *) PyEval_GetGlobals(void); -PyAPI_FUNC(PyObject *) PyEval_GetLocals(void); -PyAPI_FUNC(struct _frame *) PyEval_GetFrame(void); -PyAPI_FUNC(int) PyEval_GetRestricted(void); - -/* Look at the current frame's (if any) code's co_flags, and turn on - the corresponding compiler flags in cf->cf_flags. Return 1 if any - flag was set, else return 0. */ -PyAPI_FUNC(int) PyEval_MergeCompilerFlags(PyCompilerFlags *cf); - -PyAPI_FUNC(int) Py_FlushLine(void); - -PyAPI_FUNC(int) Py_AddPendingCall(int (*func)(void *), void *arg); -PyAPI_FUNC(int) Py_MakePendingCalls(void); - -/* Protection against deeply nested recursive calls */ -PyAPI_FUNC(void) Py_SetRecursionLimit(int); -PyAPI_FUNC(int) Py_GetRecursionLimit(void); - -#define Py_EnterRecursiveCall(where) \ - (_Py_MakeRecCheck(PyThreadState_GET()->recursion_depth) && \ - _Py_CheckRecursiveCall(where)) -#define Py_LeaveRecursiveCall() \ - (--PyThreadState_GET()->recursion_depth) -PyAPI_FUNC(int) _Py_CheckRecursiveCall(char *where); -PyAPI_DATA(int) _Py_CheckRecursionLimit; -#ifdef USE_STACKCHECK -# define _Py_MakeRecCheck(x) (++(x) > --_Py_CheckRecursionLimit) -#else -# define _Py_MakeRecCheck(x) (++(x) > _Py_CheckRecursionLimit) -#endif - -PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *); -PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *); - -PyAPI_FUNC(PyObject *) PyEval_GetCallStats(PyObject *); -PyAPI_FUNC(PyObject *) PyEval_EvalFrame(struct _frame *); -PyAPI_FUNC(PyObject *) PyEval_EvalFrameEx(struct _frame *f, int exc); - -/* this used to be handled on a per-thread basis - now just two globals */ -PyAPI_DATA(volatile int) _Py_Ticker; -PyAPI_DATA(int) _Py_CheckInterval; - -/* Interface for threads. - - A module that plans to do a blocking system call (or something else - that lasts a long time and doesn't touch Python data) can allow other - threads to run as follows: - - ...preparations here... - Py_BEGIN_ALLOW_THREADS - ...blocking system call here... - Py_END_ALLOW_THREADS - ...interpret result here... - - The Py_BEGIN_ALLOW_THREADS/Py_END_ALLOW_THREADS pair expands to a - {}-surrounded block. - To leave the block in the middle (e.g., with return), you must insert - a line containing Py_BLOCK_THREADS before the return, e.g. - - if (...premature_exit...) { - Py_BLOCK_THREADS - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - An alternative is: - - Py_BLOCK_THREADS - if (...premature_exit...) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - Py_UNBLOCK_THREADS - - For convenience, that the value of 'errno' is restored across - Py_END_ALLOW_THREADS and Py_BLOCK_THREADS. - - WARNING: NEVER NEST CALLS TO Py_BEGIN_ALLOW_THREADS AND - Py_END_ALLOW_THREADS!!! - - The function PyEval_InitThreads() should be called only from - initthread() in "threadmodule.c". - - Note that not yet all candidates have been converted to use this - mechanism! -*/ - -PyAPI_FUNC(PyThreadState *) PyEval_SaveThread(void); -PyAPI_FUNC(void) PyEval_RestoreThread(PyThreadState *); - -#ifdef WITH_THREAD - -PyAPI_FUNC(int) PyEval_ThreadsInitialized(void); -PyAPI_FUNC(void) PyEval_InitThreads(void); -PyAPI_FUNC(void) PyEval_AcquireLock(void); -PyAPI_FUNC(void) PyEval_ReleaseLock(void); -PyAPI_FUNC(void) PyEval_AcquireThread(PyThreadState *tstate); -PyAPI_FUNC(void) PyEval_ReleaseThread(PyThreadState *tstate); -PyAPI_FUNC(void) PyEval_ReInitThreads(void); - -#define Py_BEGIN_ALLOW_THREADS { \ - PyThreadState *_save; \ - _save = PyEval_SaveThread(); -#define Py_BLOCK_THREADS PyEval_RestoreThread(_save); -#define Py_UNBLOCK_THREADS _save = PyEval_SaveThread(); -#define Py_END_ALLOW_THREADS PyEval_RestoreThread(_save); \ - } - -#else /* !WITH_THREAD */ - -#define Py_BEGIN_ALLOW_THREADS { -#define Py_BLOCK_THREADS -#define Py_UNBLOCK_THREADS -#define Py_END_ALLOW_THREADS } - -#endif /* !WITH_THREAD */ - -PyAPI_FUNC(int) _PyEval_SliceIndex(PyObject *, Py_ssize_t *); - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CEVAL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h deleted file mode 100644 index 8e42e53..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/classobject.h +++ /dev/null @@ -1,83 +0,0 @@ - -/* Class object interface */ - -/* Revealing some structures (not for general use) */ - -#ifndef Py_CLASSOBJECT_H -#define Py_CLASSOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - PyObject *cl_bases; /* A tuple of class objects */ - PyObject *cl_dict; /* A dictionary */ - PyObject *cl_name; /* A string */ - /* The following three are functions or NULL */ - PyObject *cl_getattr; - PyObject *cl_setattr; - PyObject *cl_delattr; - PyObject *cl_weakreflist; /* List of weak references */ -} PyClassObject; - -typedef struct { - PyObject_HEAD - PyClassObject *in_class; /* The class object */ - PyObject *in_dict; /* A dictionary */ - PyObject *in_weakreflist; /* List of weak references */ -} PyInstanceObject; - -typedef struct { - PyObject_HEAD - PyObject *im_func; /* The callable object implementing the method */ - PyObject *im_self; /* The instance it is bound to, or NULL */ - PyObject *im_class; /* The class that asked for the method */ - PyObject *im_weakreflist; /* List of weak references */ -} PyMethodObject; - -PyAPI_DATA(PyTypeObject) PyClass_Type, PyInstance_Type, PyMethod_Type; - -#define PyClass_Check(op) ((op)->ob_type == &PyClass_Type) -#define PyInstance_Check(op) ((op)->ob_type == &PyInstance_Type) -#define PyMethod_Check(op) ((op)->ob_type == &PyMethod_Type) - -PyAPI_FUNC(PyObject *) PyClass_New(PyObject *, PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyInstance_New(PyObject *, PyObject *, - PyObject *); -PyAPI_FUNC(PyObject *) PyInstance_NewRaw(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyMethod_New(PyObject *, PyObject *, PyObject *); - -PyAPI_FUNC(PyObject *) PyMethod_Function(PyObject *); -PyAPI_FUNC(PyObject *) PyMethod_Self(PyObject *); -PyAPI_FUNC(PyObject *) PyMethod_Class(PyObject *); - -/* Look up attribute with name (a string) on instance object pinst, using - * only the instance and base class dicts. If a descriptor is found in - * a class dict, the descriptor is returned without calling it. - * Returns NULL if nothing found, else a borrowed reference to the - * value associated with name in the dict in which name was found. - * The point of this routine is that it never calls arbitrary Python - * code, so is always "safe": all it does is dict lookups. The function - * can't fail, never sets an exception, and NULL is not an error (it just - * means "not found"). - */ -PyAPI_FUNC(PyObject *) _PyInstance_Lookup(PyObject *pinst, PyObject *name); - -/* Macros for direct access to these values. Type checks are *not* - done, so use with care. */ -#define PyMethod_GET_FUNCTION(meth) \ - (((PyMethodObject *)meth) -> im_func) -#define PyMethod_GET_SELF(meth) \ - (((PyMethodObject *)meth) -> im_self) -#define PyMethod_GET_CLASS(meth) \ - (((PyMethodObject *)meth) -> im_class) - -PyAPI_FUNC(int) PyClass_IsSubclass(PyObject *, PyObject *); - -PyAPI_FUNC(int) PyMethod_ClearFreeList(void); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CLASSOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/cobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/cobject.h deleted file mode 100644 index 11a8b43..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/cobject.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - CObjects are marked Pending Deprecation as of Python 2.7. - The full schedule for 2.x is as follows: - - CObjects are marked Pending Deprecation in Python 2.7. - - CObjects will be marked Deprecated in Python 2.8 - (if there is one). - - CObjects will be removed in Python 2.9 (if there is one). - - Additionally, for the Python 3.x series: - - CObjects were marked Deprecated in Python 3.1. - - CObjects will be removed in Python 3.2. - - You should switch all use of CObjects to capsules. Capsules - have a safer and more consistent API. For more information, - see Include/pycapsule.h, or read the "Capsules" topic in - the "Python/C API Reference Manual". - - Python 2.7 no longer uses CObjects itself; all objects which - were formerly CObjects are now capsules. Note that this change - does not by itself break binary compatibility with extensions - built for previous versions of Python--PyCObject_AsVoidPtr() - has been changed to also understand capsules. - -*/ - -/* original file header comment follows: */ - -/* C objects to be exported from one extension module to another. - - C objects are used for communication between extension modules. - They provide a way for an extension module to export a C interface - to other extension modules, so that extension modules can use the - Python import mechanism to link to one another. - -*/ - -#ifndef Py_COBJECT_H -#define Py_COBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(PyTypeObject) PyCObject_Type; - -#define PyCObject_Check(op) (Py_TYPE(op) == &PyCObject_Type) - -/* Create a PyCObject from a pointer to a C object and an optional - destructor function. If the second argument is non-null, then it - will be called with the first argument if and when the PyCObject is - destroyed. - -*/ -PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtr( - void *cobj, void (*destruct)(void*)); - - -/* Create a PyCObject from a pointer to a C object, a description object, - and an optional destructor function. If the third argument is non-null, - then it will be called with the first and second arguments if and when - the PyCObject is destroyed. -*/ -PyAPI_FUNC(PyObject *) PyCObject_FromVoidPtrAndDesc( - void *cobj, void *desc, void (*destruct)(void*,void*)); - -/* Retrieve a pointer to a C object from a PyCObject. */ -PyAPI_FUNC(void *) PyCObject_AsVoidPtr(PyObject *); - -/* Retrieve a pointer to a description object from a PyCObject. */ -PyAPI_FUNC(void *) PyCObject_GetDesc(PyObject *); - -/* Import a pointer to a C object from a module using a PyCObject. */ -PyAPI_FUNC(void *) PyCObject_Import(char *module_name, char *cobject_name); - -/* Modify a C object. Fails (==0) if object has a destructor. */ -PyAPI_FUNC(int) PyCObject_SetVoidPtr(PyObject *self, void *cobj); - - -typedef struct { - PyObject_HEAD - void *cobject; - void *desc; - void (*destructor)(void *); -} PyCObject; - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_COBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/code.h b/AppPkg/Applications/Python/Python-2.7.10/Include/code.h deleted file mode 100644 index 4015159..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/code.h +++ /dev/null @@ -1,107 +0,0 @@ -/* Definitions for bytecode */ - -#ifndef Py_CODE_H -#define Py_CODE_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Bytecode object */ -typedef struct { - PyObject_HEAD - int co_argcount; /* #arguments, except *args */ - int co_nlocals; /* #local variables */ - int co_stacksize; /* #entries needed for evaluation stack */ - int co_flags; /* CO_..., see below */ - PyObject *co_code; /* instruction opcodes */ - PyObject *co_consts; /* list (constants used) */ - PyObject *co_names; /* list of strings (names used) */ - PyObject *co_varnames; /* tuple of strings (local variable names) */ - PyObject *co_freevars; /* tuple of strings (free variable names) */ - PyObject *co_cellvars; /* tuple of strings (cell variable names) */ - /* The rest doesn't count for hash/cmp */ - PyObject *co_filename; /* string (where it was loaded from) */ - PyObject *co_name; /* string (name, for reference) */ - int co_firstlineno; /* first source line number */ - PyObject *co_lnotab; /* string (encoding addr<->lineno mapping) See - Objects/lnotab_notes.txt for details. */ - void *co_zombieframe; /* for optimization only (see frameobject.c) */ - PyObject *co_weakreflist; /* to support weakrefs to code objects */ -} PyCodeObject; - -/* Masks for co_flags above */ -#define CO_OPTIMIZED 0x0001 -#define CO_NEWLOCALS 0x0002 -#define CO_VARARGS 0x0004 -#define CO_VARKEYWORDS 0x0008 -#define CO_NESTED 0x0010 -#define CO_GENERATOR 0x0020 -/* The CO_NOFREE flag is set if there are no free or cell variables. - This information is redundant, but it allows a single flag test - to determine whether there is any extra work to be done when the - call frame it setup. -*/ -#define CO_NOFREE 0x0040 - -#if 0 -/* This is no longer used. Stopped defining in 2.5, do not re-use. */ -#define CO_GENERATOR_ALLOWED 0x1000 -#endif -#define CO_FUTURE_DIVISION 0x2000 -#define CO_FUTURE_ABSOLUTE_IMPORT 0x4000 /* do absolute imports by default */ -#define CO_FUTURE_WITH_STATEMENT 0x8000 -#define CO_FUTURE_PRINT_FUNCTION 0x10000 -#define CO_FUTURE_UNICODE_LITERALS 0x20000 - -/* This should be defined if a future statement modifies the syntax. - For example, when a keyword is added. -*/ -#if 1 -#define PY_PARSER_REQUIRES_FUTURE_KEYWORD -#endif - -#define CO_MAXBLOCKS 20 /* Max static block nesting within a function */ - -PyAPI_DATA(PyTypeObject) PyCode_Type; - -#define PyCode_Check(op) (Py_TYPE(op) == &PyCode_Type) -#define PyCode_GetNumFree(op) (PyTuple_GET_SIZE((op)->co_freevars)) - -/* Public interface */ -PyAPI_FUNC(PyCodeObject *) PyCode_New( - int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, - PyObject *, PyObject *, PyObject *, PyObject *, int, PyObject *); - /* same as struct above */ - -/* Creates a new empty code object with the specified source location. */ -PyAPI_FUNC(PyCodeObject *) -PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno); - -/* Return the line number associated with the specified bytecode index - in this code object. If you just need the line number of a frame, - use PyFrame_GetLineNumber() instead. */ -PyAPI_FUNC(int) PyCode_Addr2Line(PyCodeObject *, int); - -/* for internal use only */ -#define _PyCode_GETCODEPTR(co, pp) \ - ((*Py_TYPE((co)->co_code)->tp_as_buffer->bf_getreadbuffer) \ - ((co)->co_code, 0, (void **)(pp))) - -typedef struct _addr_pair { - int ap_lower; - int ap_upper; -} PyAddrPair; - -/* Update *bounds to describe the first and one-past-the-last instructions in the - same line as lasti. Return the number of that line. -*/ -PyAPI_FUNC(int) _PyCode_CheckLineNumber(PyCodeObject* co, - int lasti, PyAddrPair *bounds); - -PyAPI_FUNC(PyObject*) PyCode_Optimize(PyObject *code, PyObject* consts, - PyObject *names, PyObject *lineno_obj); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CODE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/codecs.h b/AppPkg/Applications/Python/Python-2.7.10/Include/codecs.h deleted file mode 100644 index 79c19a8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/codecs.h +++ /dev/null @@ -1,167 +0,0 @@ -#ifndef Py_CODECREGISTRY_H -#define Py_CODECREGISTRY_H -#ifdef __cplusplus -extern "C" { -#endif - -/* ------------------------------------------------------------------------ - - Python Codec Registry and support functions - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -Copyright (c) Corporation for National Research Initiatives. - - ------------------------------------------------------------------------ */ - -/* Register a new codec search function. - - As side effect, this tries to load the encodings package, if not - yet done, to make sure that it is always first in the list of - search functions. - - The search_function's refcount is incremented by this function. */ - -PyAPI_FUNC(int) PyCodec_Register( - PyObject *search_function - ); - -/* Codec register lookup API. - - Looks up the given encoding and returns a CodecInfo object with - function attributes which implement the different aspects of - processing the encoding. - - The encoding string is looked up converted to all lower-case - characters. This makes encodings looked up through this mechanism - effectively case-insensitive. - - If no codec is found, a KeyError is set and NULL returned. - - As side effect, this tries to load the encodings package, if not - yet done. This is part of the lazy load strategy for the encodings - package. - - */ - -PyAPI_FUNC(PyObject *) _PyCodec_Lookup( - const char *encoding - ); - -/* Generic codec based encoding API. - - object is passed through the encoder function found for the given - encoding using the error handling method defined by errors. errors - may be NULL to use the default method defined for the codec. - - Raises a LookupError in case no encoder can be found. - - */ - -PyAPI_FUNC(PyObject *) PyCodec_Encode( - PyObject *object, - const char *encoding, - const char *errors - ); - -/* Generic codec based decoding API. - - object is passed through the decoder function found for the given - encoding using the error handling method defined by errors. errors - may be NULL to use the default method defined for the codec. - - Raises a LookupError in case no encoder can be found. - - */ - -PyAPI_FUNC(PyObject *) PyCodec_Decode( - PyObject *object, - const char *encoding, - const char *errors - ); - -/* --- Codec Lookup APIs -------------------------------------------------- - - All APIs return a codec object with incremented refcount and are - based on _PyCodec_Lookup(). The same comments w/r to the encoding - name also apply to these APIs. - -*/ - -/* Get an encoder function for the given encoding. */ - -PyAPI_FUNC(PyObject *) PyCodec_Encoder( - const char *encoding - ); - -/* Get a decoder function for the given encoding. */ - -PyAPI_FUNC(PyObject *) PyCodec_Decoder( - const char *encoding - ); - -/* Get a IncrementalEncoder object for the given encoding. */ - -PyAPI_FUNC(PyObject *) PyCodec_IncrementalEncoder( - const char *encoding, - const char *errors - ); - -/* Get a IncrementalDecoder object function for the given encoding. */ - -PyAPI_FUNC(PyObject *) PyCodec_IncrementalDecoder( - const char *encoding, - const char *errors - ); - -/* Get a StreamReader factory function for the given encoding. */ - -PyAPI_FUNC(PyObject *) PyCodec_StreamReader( - const char *encoding, - PyObject *stream, - const char *errors - ); - -/* Get a StreamWriter factory function for the given encoding. */ - -PyAPI_FUNC(PyObject *) PyCodec_StreamWriter( - const char *encoding, - PyObject *stream, - const char *errors - ); - -/* Unicode encoding error handling callback registry API */ - -/* Register the error handling callback function error under the given - name. This function will be called by the codec when it encounters - unencodable characters/undecodable bytes and doesn't know the - callback name, when name is specified as the error parameter - in the call to the encode/decode function. - Return 0 on success, -1 on error */ -PyAPI_FUNC(int) PyCodec_RegisterError(const char *name, PyObject *error); - -/* Lookup the error handling callback function registered under the given - name. As a special case NULL can be passed, in which case - the error handling callback for "strict" will be returned. */ -PyAPI_FUNC(PyObject *) PyCodec_LookupError(const char *name); - -/* raise exc as an exception */ -PyAPI_FUNC(PyObject *) PyCodec_StrictErrors(PyObject *exc); - -/* ignore the unicode error, skipping the faulty input */ -PyAPI_FUNC(PyObject *) PyCodec_IgnoreErrors(PyObject *exc); - -/* replace the unicode encode error with ? or U+FFFD */ -PyAPI_FUNC(PyObject *) PyCodec_ReplaceErrors(PyObject *exc); - -/* replace the unicode encode error with XML character references */ -PyAPI_FUNC(PyObject *) PyCodec_XMLCharRefReplaceErrors(PyObject *exc); - -/* replace the unicode encode error with backslash escapes (\x, \u and \U) */ -PyAPI_FUNC(PyObject *) PyCodec_BackslashReplaceErrors(PyObject *exc); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CODECREGISTRY_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/compile.h b/AppPkg/Applications/Python/Python-2.7.10/Include/compile.h deleted file mode 100644 index 22cb75f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/compile.h +++ /dev/null @@ -1,40 +0,0 @@ - -#ifndef Py_COMPILE_H -#define Py_COMPILE_H - -#include "code.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Public interface */ -struct _node; /* Declare the existence of this type */ -PyAPI_FUNC(PyCodeObject *) PyNode_Compile(struct _node *, const char *); - -/* Future feature support */ - -typedef struct { - int ff_features; /* flags set by future statements */ - int ff_lineno; /* line number of last future statement */ -} PyFutureFeatures; - -#define FUTURE_NESTED_SCOPES "nested_scopes" -#define FUTURE_GENERATORS "generators" -#define FUTURE_DIVISION "division" -#define FUTURE_ABSOLUTE_IMPORT "absolute_import" -#define FUTURE_WITH_STATEMENT "with_statement" -#define FUTURE_PRINT_FUNCTION "print_function" -#define FUTURE_UNICODE_LITERALS "unicode_literals" - - -struct _mod; /* Declare the existence of this type */ -PyAPI_FUNC(PyCodeObject *) PyAST_Compile(struct _mod *, const char *, - PyCompilerFlags *, PyArena *); -PyAPI_FUNC(PyFutureFeatures *) PyFuture_FromAST(struct _mod *, const char *); - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_COMPILE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/complexobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/complexobject.h deleted file mode 100644 index 747048a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/complexobject.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Complex number structure */ - -#ifndef Py_COMPLEXOBJECT_H -#define Py_COMPLEXOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - double real; - double imag; -} Py_complex; - -/* Operations on complex numbers from complexmodule.c */ - -#define c_sum _Py_c_sum -#define c_diff _Py_c_diff -#define c_neg _Py_c_neg -#define c_prod _Py_c_prod -#define c_quot _Py_c_quot -#define c_pow _Py_c_pow -#define c_abs _Py_c_abs - -PyAPI_FUNC(Py_complex) c_sum(Py_complex, Py_complex); -PyAPI_FUNC(Py_complex) c_diff(Py_complex, Py_complex); -PyAPI_FUNC(Py_complex) c_neg(Py_complex); -PyAPI_FUNC(Py_complex) c_prod(Py_complex, Py_complex); -PyAPI_FUNC(Py_complex) c_quot(Py_complex, Py_complex); -PyAPI_FUNC(Py_complex) c_pow(Py_complex, Py_complex); -PyAPI_FUNC(double) c_abs(Py_complex); - - -/* Complex object interface */ - -/* -PyComplexObject represents a complex number with double-precision -real and imaginary parts. -*/ - -typedef struct { - PyObject_HEAD - Py_complex cval; -} PyComplexObject; - -PyAPI_DATA(PyTypeObject) PyComplex_Type; - -#define PyComplex_Check(op) PyObject_TypeCheck(op, &PyComplex_Type) -#define PyComplex_CheckExact(op) (Py_TYPE(op) == &PyComplex_Type) - -PyAPI_FUNC(PyObject *) PyComplex_FromCComplex(Py_complex); -PyAPI_FUNC(PyObject *) PyComplex_FromDoubles(double real, double imag); - -PyAPI_FUNC(double) PyComplex_RealAsDouble(PyObject *op); -PyAPI_FUNC(double) PyComplex_ImagAsDouble(PyObject *op); -PyAPI_FUNC(Py_complex) PyComplex_AsCComplex(PyObject *op); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyComplex_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_COMPLEXOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/datetime.h b/AppPkg/Applications/Python/Python-2.7.10/Include/datetime.h deleted file mode 100644 index 47d0162..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/datetime.h +++ /dev/null @@ -1,239 +0,0 @@ -/* datetime.h - */ - -#ifndef DATETIME_H -#define DATETIME_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Fields are packed into successive bytes, each viewed as unsigned and - * big-endian, unless otherwise noted: - * - * byte offset - * 0 year 2 bytes, 1-9999 - * 2 month 1 byte, 1-12 - * 3 day 1 byte, 1-31 - * 4 hour 1 byte, 0-23 - * 5 minute 1 byte, 0-59 - * 6 second 1 byte, 0-59 - * 7 usecond 3 bytes, 0-999999 - * 10 - */ - -/* # of bytes for year, month, and day. */ -#define _PyDateTime_DATE_DATASIZE 4 - -/* # of bytes for hour, minute, second, and usecond. */ -#define _PyDateTime_TIME_DATASIZE 6 - -/* # of bytes for year, month, day, hour, minute, second, and usecond. */ -#define _PyDateTime_DATETIME_DATASIZE 10 - - -typedef struct -{ - PyObject_HEAD - long hashcode; /* -1 when unknown */ - int days; /* -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS */ - int seconds; /* 0 <= seconds < 24*3600 is invariant */ - int microseconds; /* 0 <= microseconds < 1000000 is invariant */ -} PyDateTime_Delta; - -typedef struct -{ - PyObject_HEAD /* a pure abstract base class */ -} PyDateTime_TZInfo; - - -/* The datetime and time types have hashcodes, and an optional tzinfo member, - * present if and only if hastzinfo is true. - */ -#define _PyTZINFO_HEAD \ - PyObject_HEAD \ - long hashcode; \ - char hastzinfo; /* boolean flag */ - -/* No _PyDateTime_BaseTZInfo is allocated; it's just to have something - * convenient to cast to, when getting at the hastzinfo member of objects - * starting with _PyTZINFO_HEAD. - */ -typedef struct -{ - _PyTZINFO_HEAD -} _PyDateTime_BaseTZInfo; - -/* All time objects are of PyDateTime_TimeType, but that can be allocated - * in two ways, with or without a tzinfo member. Without is the same as - * tzinfo == None, but consumes less memory. _PyDateTime_BaseTime is an - * internal struct used to allocate the right amount of space for the - * "without" case. - */ -#define _PyDateTime_TIMEHEAD \ - _PyTZINFO_HEAD \ - unsigned char data[_PyDateTime_TIME_DATASIZE]; - -typedef struct -{ - _PyDateTime_TIMEHEAD -} _PyDateTime_BaseTime; /* hastzinfo false */ - -typedef struct -{ - _PyDateTime_TIMEHEAD - PyObject *tzinfo; -} PyDateTime_Time; /* hastzinfo true */ - - -/* All datetime objects are of PyDateTime_DateTimeType, but that can be - * allocated in two ways too, just like for time objects above. In addition, - * the plain date type is a base class for datetime, so it must also have - * a hastzinfo member (although it's unused there). - */ -typedef struct -{ - _PyTZINFO_HEAD - unsigned char data[_PyDateTime_DATE_DATASIZE]; -} PyDateTime_Date; - -#define _PyDateTime_DATETIMEHEAD \ - _PyTZINFO_HEAD \ - unsigned char data[_PyDateTime_DATETIME_DATASIZE]; - -typedef struct -{ - _PyDateTime_DATETIMEHEAD -} _PyDateTime_BaseDateTime; /* hastzinfo false */ - -typedef struct -{ - _PyDateTime_DATETIMEHEAD - PyObject *tzinfo; -} PyDateTime_DateTime; /* hastzinfo true */ - - -/* Apply for date and datetime instances. */ -#define PyDateTime_GET_YEAR(o) ((((PyDateTime_Date*)o)->data[0] << 8) | \ - ((PyDateTime_Date*)o)->data[1]) -#define PyDateTime_GET_MONTH(o) (((PyDateTime_Date*)o)->data[2]) -#define PyDateTime_GET_DAY(o) (((PyDateTime_Date*)o)->data[3]) - -#define PyDateTime_DATE_GET_HOUR(o) (((PyDateTime_DateTime*)o)->data[4]) -#define PyDateTime_DATE_GET_MINUTE(o) (((PyDateTime_DateTime*)o)->data[5]) -#define PyDateTime_DATE_GET_SECOND(o) (((PyDateTime_DateTime*)o)->data[6]) -#define PyDateTime_DATE_GET_MICROSECOND(o) \ - ((((PyDateTime_DateTime*)o)->data[7] << 16) | \ - (((PyDateTime_DateTime*)o)->data[8] << 8) | \ - ((PyDateTime_DateTime*)o)->data[9]) - -/* Apply for time instances. */ -#define PyDateTime_TIME_GET_HOUR(o) (((PyDateTime_Time*)o)->data[0]) -#define PyDateTime_TIME_GET_MINUTE(o) (((PyDateTime_Time*)o)->data[1]) -#define PyDateTime_TIME_GET_SECOND(o) (((PyDateTime_Time*)o)->data[2]) -#define PyDateTime_TIME_GET_MICROSECOND(o) \ - ((((PyDateTime_Time*)o)->data[3] << 16) | \ - (((PyDateTime_Time*)o)->data[4] << 8) | \ - ((PyDateTime_Time*)o)->data[5]) - - -/* Define structure for C API. */ -typedef struct { - /* type objects */ - PyTypeObject *DateType; - PyTypeObject *DateTimeType; - PyTypeObject *TimeType; - PyTypeObject *DeltaType; - PyTypeObject *TZInfoType; - - /* constructors */ - PyObject *(*Date_FromDate)(int, int, int, PyTypeObject*); - PyObject *(*DateTime_FromDateAndTime)(int, int, int, int, int, int, int, - PyObject*, PyTypeObject*); - PyObject *(*Time_FromTime)(int, int, int, int, PyObject*, PyTypeObject*); - PyObject *(*Delta_FromDelta)(int, int, int, int, PyTypeObject*); - - /* constructors for the DB API */ - PyObject *(*DateTime_FromTimestamp)(PyObject*, PyObject*, PyObject*); - PyObject *(*Date_FromTimestamp)(PyObject*, PyObject*); - -} PyDateTime_CAPI; - -#define PyDateTime_CAPSULE_NAME "datetime.datetime_CAPI" - - -/* "magic" constant used to partially protect against developer mistakes. */ -#define DATETIME_API_MAGIC 0x414548d5 - -#ifdef Py_BUILD_CORE - -/* Macros for type checking when building the Python core. */ -#define PyDate_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateType) -#define PyDate_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateType) - -#define PyDateTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_DateTimeType) -#define PyDateTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DateTimeType) - -#define PyTime_Check(op) PyObject_TypeCheck(op, &PyDateTime_TimeType) -#define PyTime_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TimeType) - -#define PyDelta_Check(op) PyObject_TypeCheck(op, &PyDateTime_DeltaType) -#define PyDelta_CheckExact(op) (Py_TYPE(op) == &PyDateTime_DeltaType) - -#define PyTZInfo_Check(op) PyObject_TypeCheck(op, &PyDateTime_TZInfoType) -#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == &PyDateTime_TZInfoType) - -#else - -/* Define global variable for the C API and a macro for setting it. */ -static PyDateTime_CAPI *PyDateTimeAPI = NULL; - -#define PyDateTime_IMPORT \ - PyDateTimeAPI = (PyDateTime_CAPI *)PyCapsule_Import(PyDateTime_CAPSULE_NAME, 0) - -/* Macros for type checking when not building the Python core. */ -#define PyDate_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateType) -#define PyDate_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateType) - -#define PyDateTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DateTimeType) -#define PyDateTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DateTimeType) - -#define PyTime_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TimeType) -#define PyTime_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TimeType) - -#define PyDelta_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->DeltaType) -#define PyDelta_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->DeltaType) - -#define PyTZInfo_Check(op) PyObject_TypeCheck(op, PyDateTimeAPI->TZInfoType) -#define PyTZInfo_CheckExact(op) (Py_TYPE(op) == PyDateTimeAPI->TZInfoType) - -/* Macros for accessing constructors in a simplified fashion. */ -#define PyDate_FromDate(year, month, day) \ - PyDateTimeAPI->Date_FromDate(year, month, day, PyDateTimeAPI->DateType) - -#define PyDateTime_FromDateAndTime(year, month, day, hour, min, sec, usec) \ - PyDateTimeAPI->DateTime_FromDateAndTime(year, month, day, hour, \ - min, sec, usec, Py_None, PyDateTimeAPI->DateTimeType) - -#define PyTime_FromTime(hour, minute, second, usecond) \ - PyDateTimeAPI->Time_FromTime(hour, minute, second, usecond, \ - Py_None, PyDateTimeAPI->TimeType) - -#define PyDelta_FromDSU(days, seconds, useconds) \ - PyDateTimeAPI->Delta_FromDelta(days, seconds, useconds, 1, \ - PyDateTimeAPI->DeltaType) - -/* Macros supporting the DB API. */ -#define PyDateTime_FromTimestamp(args) \ - PyDateTimeAPI->DateTime_FromTimestamp( \ - (PyObject*) (PyDateTimeAPI->DateTimeType), args, NULL) - -#define PyDate_FromTimestamp(args) \ - PyDateTimeAPI->Date_FromTimestamp( \ - (PyObject*) (PyDateTimeAPI->DateType), args) - -#endif /* Py_BUILD_CORE */ - -#ifdef __cplusplus -} -#endif -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/descrobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/descrobject.h deleted file mode 100644 index 5a9c3e1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/descrobject.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Descriptors */ -#ifndef Py_DESCROBJECT_H -#define Py_DESCROBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef PyObject *(*getter)(PyObject *, void *); -typedef int (*setter)(PyObject *, PyObject *, void *); - -typedef struct PyGetSetDef { - char *name; - getter get; - setter set; - char *doc; - void *closure; -} PyGetSetDef; - -typedef PyObject *(*wrapperfunc)(PyObject *self, PyObject *args, - void *wrapped); - -typedef PyObject *(*wrapperfunc_kwds)(PyObject *self, PyObject *args, - void *wrapped, PyObject *kwds); - -struct wrapperbase { - char *name; - int offset; - void *function; - wrapperfunc wrapper; - char *doc; - int flags; - PyObject *name_strobj; -}; - -/* Flags for above struct */ -#define PyWrapperFlag_KEYWORDS 1 /* wrapper function takes keyword args */ - -/* Various kinds of descriptor objects */ - -#define PyDescr_COMMON \ - PyObject_HEAD \ - PyTypeObject *d_type; \ - PyObject *d_name - -typedef struct { - PyDescr_COMMON; -} PyDescrObject; - -typedef struct { - PyDescr_COMMON; - PyMethodDef *d_method; -} PyMethodDescrObject; - -typedef struct { - PyDescr_COMMON; - struct PyMemberDef *d_member; -} PyMemberDescrObject; - -typedef struct { - PyDescr_COMMON; - PyGetSetDef *d_getset; -} PyGetSetDescrObject; - -typedef struct { - PyDescr_COMMON; - struct wrapperbase *d_base; - void *d_wrapped; /* This can be any function pointer */ -} PyWrapperDescrObject; - -PyAPI_DATA(PyTypeObject) PyWrapperDescr_Type; -PyAPI_DATA(PyTypeObject) PyDictProxy_Type; -PyAPI_DATA(PyTypeObject) PyGetSetDescr_Type; -PyAPI_DATA(PyTypeObject) PyMemberDescr_Type; - -PyAPI_FUNC(PyObject *) PyDescr_NewMethod(PyTypeObject *, PyMethodDef *); -PyAPI_FUNC(PyObject *) PyDescr_NewClassMethod(PyTypeObject *, PyMethodDef *); -PyAPI_FUNC(PyObject *) PyDescr_NewMember(PyTypeObject *, - struct PyMemberDef *); -PyAPI_FUNC(PyObject *) PyDescr_NewGetSet(PyTypeObject *, - struct PyGetSetDef *); -PyAPI_FUNC(PyObject *) PyDescr_NewWrapper(PyTypeObject *, - struct wrapperbase *, void *); -#define PyDescr_IsData(d) (Py_TYPE(d)->tp_descr_set != NULL) - -PyAPI_FUNC(PyObject *) PyDictProxy_New(PyObject *); -PyAPI_FUNC(PyObject *) PyWrapper_New(PyObject *, PyObject *); - - -PyAPI_DATA(PyTypeObject) PyProperty_Type; -#ifdef __cplusplus -} -#endif -#endif /* !Py_DESCROBJECT_H */ - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/dictobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/dictobject.h deleted file mode 100644 index 0f3ab17..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/dictobject.h +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef Py_DICTOBJECT_H -#define Py_DICTOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Dictionary object type -- mapping from hashable object to object */ - -/* The distribution includes a separate file, Objects/dictnotes.txt, - describing explorations into dictionary design and optimization. - It covers typical dictionary use patterns, the parameters for - tuning dictionaries, and several ideas for possible optimizations. -*/ - -/* -There are three kinds of slots in the table: - -1. Unused. me_key == me_value == NULL - Does not hold an active (key, value) pair now and never did. Unused can - transition to Active upon key insertion. This is the only case in which - me_key is NULL, and is each slot's initial state. - -2. Active. me_key != NULL and me_key != dummy and me_value != NULL - Holds an active (key, value) pair. Active can transition to Dummy upon - key deletion. This is the only case in which me_value != NULL. - -3. Dummy. me_key == dummy and me_value == NULL - Previously held an active (key, value) pair, but that was deleted and an - active pair has not yet overwritten the slot. Dummy can transition to - Active upon key insertion. Dummy slots cannot be made Unused again - (cannot have me_key set to NULL), else the probe sequence in case of - collision would have no way to know they were once active. - -Note: .popitem() abuses the me_hash field of an Unused or Dummy slot to -hold a search finger. The me_hash field of Unused or Dummy slots has no -meaning otherwise. -*/ - -/* PyDict_MINSIZE is the minimum size of a dictionary. This many slots are - * allocated directly in the dict object (in the ma_smalltable member). - * It must be a power of 2, and at least 4. 8 allows dicts with no more - * than 5 active entries to live in ma_smalltable (and so avoid an - * additional malloc); instrumentation suggested this suffices for the - * majority of dicts (consisting mostly of usually-small instance dicts and - * usually-small dicts created to pass keyword arguments). - */ -#define PyDict_MINSIZE 8 - -typedef struct { - /* Cached hash code of me_key. Note that hash codes are C longs. - * We have to use Py_ssize_t instead because dict_popitem() abuses - * me_hash to hold a search finger. - */ - Py_ssize_t me_hash; - PyObject *me_key; - PyObject *me_value; -} PyDictEntry; - -/* -To ensure the lookup algorithm terminates, there must be at least one Unused -slot (NULL key) in the table. -The value ma_fill is the number of non-NULL keys (sum of Active and Dummy); -ma_used is the number of non-NULL, non-dummy keys (== the number of non-NULL -values == the number of Active items). -To avoid slowing down lookups on a near-full table, we resize the table when -it's two-thirds full. -*/ -typedef struct _dictobject PyDictObject; -struct _dictobject { - PyObject_HEAD - Py_ssize_t ma_fill; /* # Active + # Dummy */ - Py_ssize_t ma_used; /* # Active */ - - /* The table contains ma_mask + 1 slots, and that's a power of 2. - * We store the mask instead of the size because the mask is more - * frequently needed. - */ - Py_ssize_t ma_mask; - - /* ma_table points to ma_smalltable for small tables, else to - * additional malloc'ed memory. ma_table is never NULL! This rule - * saves repeated runtime null-tests in the workhorse getitem and - * setitem calls. - */ - PyDictEntry *ma_table; - PyDictEntry *(*ma_lookup)(PyDictObject *mp, PyObject *key, long hash); - PyDictEntry ma_smalltable[PyDict_MINSIZE]; -}; - -PyAPI_DATA(PyTypeObject) PyDict_Type; -PyAPI_DATA(PyTypeObject) PyDictIterKey_Type; -PyAPI_DATA(PyTypeObject) PyDictIterValue_Type; -PyAPI_DATA(PyTypeObject) PyDictIterItem_Type; -PyAPI_DATA(PyTypeObject) PyDictKeys_Type; -PyAPI_DATA(PyTypeObject) PyDictItems_Type; -PyAPI_DATA(PyTypeObject) PyDictValues_Type; - -#define PyDict_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_DICT_SUBCLASS) -#define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) -#define PyDictKeys_Check(op) (Py_TYPE(op) == &PyDictKeys_Type) -#define PyDictItems_Check(op) (Py_TYPE(op) == &PyDictItems_Type) -#define PyDictValues_Check(op) (Py_TYPE(op) == &PyDictValues_Type) -/* This excludes Values, since they are not sets. */ -# define PyDictViewSet_Check(op) \ - (PyDictKeys_Check(op) || PyDictItems_Check(op)) - -PyAPI_FUNC(PyObject *) PyDict_New(void); -PyAPI_FUNC(PyObject *) PyDict_GetItem(PyObject *mp, PyObject *key); -PyAPI_FUNC(int) PyDict_SetItem(PyObject *mp, PyObject *key, PyObject *item); -PyAPI_FUNC(int) PyDict_DelItem(PyObject *mp, PyObject *key); -PyAPI_FUNC(void) PyDict_Clear(PyObject *mp); -PyAPI_FUNC(int) PyDict_Next( - PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value); -PyAPI_FUNC(int) _PyDict_Next( - PyObject *mp, Py_ssize_t *pos, PyObject **key, PyObject **value, long *hash); -PyAPI_FUNC(PyObject *) PyDict_Keys(PyObject *mp); -PyAPI_FUNC(PyObject *) PyDict_Values(PyObject *mp); -PyAPI_FUNC(PyObject *) PyDict_Items(PyObject *mp); -PyAPI_FUNC(Py_ssize_t) PyDict_Size(PyObject *mp); -PyAPI_FUNC(PyObject *) PyDict_Copy(PyObject *mp); -PyAPI_FUNC(int) PyDict_Contains(PyObject *mp, PyObject *key); -PyAPI_FUNC(int) _PyDict_Contains(PyObject *mp, PyObject *key, long hash); -PyAPI_FUNC(PyObject *) _PyDict_NewPresized(Py_ssize_t minused); -PyAPI_FUNC(void) _PyDict_MaybeUntrack(PyObject *mp); - -/* PyDict_Update(mp, other) is equivalent to PyDict_Merge(mp, other, 1). */ -PyAPI_FUNC(int) PyDict_Update(PyObject *mp, PyObject *other); - -/* PyDict_Merge updates/merges from a mapping object (an object that - supports PyMapping_Keys() and PyObject_GetItem()). If override is true, - the last occurrence of a key wins, else the first. The Python - dict.update(other) is equivalent to PyDict_Merge(dict, other, 1). -*/ -PyAPI_FUNC(int) PyDict_Merge(PyObject *mp, - PyObject *other, - int override); - -/* PyDict_MergeFromSeq2 updates/merges from an iterable object producing - iterable objects of length 2. If override is true, the last occurrence - of a key wins, else the first. The Python dict constructor dict(seq2) - is equivalent to dict={}; PyDict_MergeFromSeq(dict, seq2, 1). -*/ -PyAPI_FUNC(int) PyDict_MergeFromSeq2(PyObject *d, - PyObject *seq2, - int override); - -PyAPI_FUNC(PyObject *) PyDict_GetItemString(PyObject *dp, const char *key); -PyAPI_FUNC(int) PyDict_SetItemString(PyObject *dp, const char *key, PyObject *item); -PyAPI_FUNC(int) PyDict_DelItemString(PyObject *dp, const char *key); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_DICTOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/dtoa.h b/AppPkg/Applications/Python/Python-2.7.10/Include/dtoa.h deleted file mode 100644 index c7e80bc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/dtoa.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef PY_NO_SHORT_FLOAT_REPR -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(double) _Py_dg_strtod(const char *str, char **ptr); -PyAPI_FUNC(char *) _Py_dg_dtoa(double d, int mode, int ndigits, - int *decpt, int *sign, char **rve); -PyAPI_FUNC(void) _Py_dg_freedtoa(char *s); - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/enumobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/enumobject.h deleted file mode 100644 index 42dc2d2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/enumobject.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef Py_ENUMOBJECT_H -#define Py_ENUMOBJECT_H - -/* Enumerate Object */ - -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(PyTypeObject) PyEnum_Type; -PyAPI_DATA(PyTypeObject) PyReversed_Type; - -#ifdef __cplusplus -} -#endif - -#endif /* !Py_ENUMOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/errcode.h b/AppPkg/Applications/Python/Python-2.7.10/Include/errcode.h deleted file mode 100644 index 295295c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/errcode.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef Py_ERRCODE_H -#define Py_ERRCODE_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Error codes passed around between file input, tokenizer, parser and - interpreter. This is necessary so we can turn them into Python - exceptions at a higher level. Note that some errors have a - slightly different meaning when passed from the tokenizer to the - parser than when passed from the parser to the interpreter; e.g. - the parser only returns E_EOF when it hits EOF immediately, and it - never returns E_OK. */ - -#define E_OK 10 /* No error */ -#define E_EOF 11 /* End Of File */ -#define E_INTR 12 /* Interrupted */ -#define E_TOKEN 13 /* Bad token */ -#define E_SYNTAX 14 /* Syntax error */ -#define E_NOMEM 15 /* Ran out of memory */ -#define E_DONE 16 /* Parsing complete */ -#define E_ERROR 17 /* Execution error */ -#define E_TABSPACE 18 /* Inconsistent mixing of tabs and spaces */ -#define E_OVERFLOW 19 /* Node had too many children */ -#define E_TOODEEP 20 /* Too many indentation levels */ -#define E_DEDENT 21 /* No matching outer block for dedent */ -#define E_DECODE 22 /* Error in decoding into Unicode */ -#define E_EOFS 23 /* EOF in triple-quoted string */ -#define E_EOLS 24 /* EOL in single-quoted string */ -#define E_LINECONT 25 /* Unexpected characters after a line continuation */ - -#ifdef __cplusplus -} -#endif -#endif /* !Py_ERRCODE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/eval.h b/AppPkg/Applications/Python/Python-2.7.10/Include/eval.h deleted file mode 100644 index fe1d47a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/eval.h +++ /dev/null @@ -1,25 +0,0 @@ - -/* Interface to execute compiled code */ - -#ifndef Py_EVAL_H -#define Py_EVAL_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(PyObject *) PyEval_EvalCode(PyCodeObject *, PyObject *, PyObject *); - -PyAPI_FUNC(PyObject *) PyEval_EvalCodeEx(PyCodeObject *co, - PyObject *globals, - PyObject *locals, - PyObject **args, int argc, - PyObject **kwds, int kwdc, - PyObject **defs, int defc, - PyObject *closure); - -PyAPI_FUNC(PyObject *) _PyEval_CallTracing(PyObject *func, PyObject *args); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_EVAL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/fileobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/fileobject.h deleted file mode 100644 index c16aed9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/fileobject.h +++ /dev/null @@ -1,97 +0,0 @@ - -/* File object interface */ - -#ifndef Py_FILEOBJECT_H -#define Py_FILEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - FILE *f_fp; - PyObject *f_name; - PyObject *f_mode; - int (*f_close)(FILE *); - int f_softspace; /* Flag used by 'print' command */ - int f_binary; /* Flag which indicates whether the file is - open in binary (1) or text (0) mode */ - char* f_buf; /* Allocated readahead buffer */ - char* f_bufend; /* Points after last occupied position */ - char* f_bufptr; /* Current buffer position */ - char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */ - int f_univ_newline; /* Handle any newline convention */ - int f_newlinetypes; /* Types of newlines seen */ - int f_skipnextlf; /* Skip next \n */ - PyObject *f_encoding; - PyObject *f_errors; - PyObject *weakreflist; /* List of weak references */ - int unlocked_count; /* Num. currently running sections of code - using f_fp with the GIL released. */ - int readable; - int writable; -} PyFileObject; - -PyAPI_DATA(PyTypeObject) PyFile_Type; - -#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) -#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type) - -PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); -PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); -PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); -PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); -PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, - int (*)(FILE *)); -PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); -PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *); -PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *); -PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *); -PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); -PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); -PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int); -PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); -PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); - -/* The default encoding used by the platform file system APIs - If non-NULL, this is different than the default encoding for strings -*/ -PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; - -/* Routines to replace fread() and fgets() which accept any of \r, \n - or \r\n as line terminators. -*/ -#define PY_STDIOTEXTMODE "b" -char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); -size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); - -/* A routine to do sanity checking on the file mode string. returns - non-zero on if an exception occurred -*/ -int _PyFile_SanitizeMode(char *mode); - -#if defined _MSC_VER && _MSC_VER >= 1400 -/* A routine to check if a file descriptor is valid on Windows. Returns 0 - * and sets errno to EBADF if it isn't. This is to avoid Assertions - * from various functions in the Windows CRT beginning with - * Visual Studio 2005 - */ -int _PyVerify_fd(int fd); -#elif defined _MSC_VER && _MSC_VER >= 1200 -/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */ -#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0) -#else -#define _PyVerify_fd(A) (1) /* dummy */ -#endif - -/* A routine to check if a file descriptor can be select()-ed. */ -#ifdef HAVE_SELECT - #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) -#else - #define _PyIsSelectable_fd(FD) (1) -#endif /* HAVE_SELECT */ - -#ifdef __cplusplus -} -#endif -#endif /* !Py_FILEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/floatobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/floatobject.h deleted file mode 100644 index 92c69fe..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/floatobject.h +++ /dev/null @@ -1,140 +0,0 @@ - -/* Float object interface */ - -/* -PyFloatObject represents a (double precision) floating point number. -*/ - -#ifndef Py_FLOATOBJECT_H -#define Py_FLOATOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - double ob_fval; -} PyFloatObject; - -PyAPI_DATA(PyTypeObject) PyFloat_Type; - -#define PyFloat_Check(op) PyObject_TypeCheck(op, &PyFloat_Type) -#define PyFloat_CheckExact(op) (Py_TYPE(op) == &PyFloat_Type) - -/* The str() precision PyFloat_STR_PRECISION is chosen so that in most cases, - the rounding noise created by various operations is suppressed, while - giving plenty of precision for practical use. */ - -#define PyFloat_STR_PRECISION 12 - -#ifdef Py_NAN -#define Py_RETURN_NAN return PyFloat_FromDouble(Py_NAN) -#endif - -#define Py_RETURN_INF(sign) do \ - if (copysign(1., sign) == 1.) { \ - return PyFloat_FromDouble(Py_HUGE_VAL); \ - } else { \ - return PyFloat_FromDouble(-Py_HUGE_VAL); \ - } while(0) - -PyAPI_FUNC(double) PyFloat_GetMax(void); -PyAPI_FUNC(double) PyFloat_GetMin(void); -PyAPI_FUNC(PyObject *) PyFloat_GetInfo(void); - -/* Return Python float from string PyObject. Second argument ignored on - input, and, if non-NULL, NULL is stored into *junk (this tried to serve a - purpose once but can't be made to work as intended). */ -PyAPI_FUNC(PyObject *) PyFloat_FromString(PyObject*, char** junk); - -/* Return Python float from C double. */ -PyAPI_FUNC(PyObject *) PyFloat_FromDouble(double); - -/* Extract C double from Python float. The macro version trades safety for - speed. */ -PyAPI_FUNC(double) PyFloat_AsDouble(PyObject *); -#define PyFloat_AS_DOUBLE(op) (((PyFloatObject *)(op))->ob_fval) - -/* Write repr(v) into the char buffer argument, followed by null byte. The - buffer must be "big enough"; >= 100 is very safe. - PyFloat_AsReprString(buf, x) strives to print enough digits so that - PyFloat_FromString(buf) then reproduces x exactly. */ -PyAPI_FUNC(void) PyFloat_AsReprString(char*, PyFloatObject *v); - -/* Write str(v) into the char buffer argument, followed by null byte. The - buffer must be "big enough"; >= 100 is very safe. Note that it's - unusual to be able to get back the float you started with from - PyFloat_AsString's result -- use PyFloat_AsReprString() if you want to - preserve precision across conversions. */ -PyAPI_FUNC(void) PyFloat_AsString(char*, PyFloatObject *v); - -/* _PyFloat_{Pack,Unpack}{4,8} - * - * The struct and pickle (at least) modules need an efficient platform- - * independent way to store floating-point values as byte strings. - * The Pack routines produce a string from a C double, and the Unpack - * routines produce a C double from such a string. The suffix (4 or 8) - * specifies the number of bytes in the string. - * - * On platforms that appear to use (see _PyFloat_Init()) IEEE-754 formats - * these functions work by copying bits. On other platforms, the formats the - * 4- byte format is identical to the IEEE-754 single precision format, and - * the 8-byte format to the IEEE-754 double precision format, although the - * packing of INFs and NaNs (if such things exist on the platform) isn't - * handled correctly, and attempting to unpack a string containing an IEEE - * INF or NaN will raise an exception. - * - * On non-IEEE platforms with more precision, or larger dynamic range, than - * 754 supports, not all values can be packed; on non-IEEE platforms with less - * precision, or smaller dynamic range, not all values can be unpacked. What - * happens in such cases is partly accidental (alas). - */ - -/* The pack routines write 4 or 8 bytes, starting at p. le is a bool - * argument, true if you want the string in little-endian format (exponent - * last, at p+3 or p+7), false if you want big-endian format (exponent - * first, at p). - * Return value: 0 if all is OK, -1 if error (and an exception is - * set, most likely OverflowError). - * There are two problems on non-IEEE platforms: - * 1): What this does is undefined if x is a NaN or infinity. - * 2): -0.0 and +0.0 produce the same string. - */ -PyAPI_FUNC(int) _PyFloat_Pack4(double x, unsigned char *p, int le); -PyAPI_FUNC(int) _PyFloat_Pack8(double x, unsigned char *p, int le); - -/* Used to get the important decimal digits of a double */ -PyAPI_FUNC(int) _PyFloat_Digits(char *buf, double v, int *signum); -PyAPI_FUNC(void) _PyFloat_DigitsInit(void); - -/* The unpack routines read 4 or 8 bytes, starting at p. le is a bool - * argument, true if the string is in little-endian format (exponent - * last, at p+3 or p+7), false if big-endian (exponent first, at p). - * Return value: The unpacked double. On error, this is -1.0 and - * PyErr_Occurred() is true (and an exception is set, most likely - * OverflowError). Note that on a non-IEEE platform this will refuse - * to unpack a string that represents a NaN or infinity. - */ -PyAPI_FUNC(double) _PyFloat_Unpack4(const unsigned char *p, int le); -PyAPI_FUNC(double) _PyFloat_Unpack8(const unsigned char *p, int le); - -/* free list api */ -PyAPI_FUNC(int) PyFloat_ClearFreeList(void); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyFloat_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -/* Round a C double x to the closest multiple of 10**-ndigits. Returns a - Python float on success, or NULL (with an appropriate exception set) on - failure. Used in builtin_round in bltinmodule.c. */ -PyAPI_FUNC(PyObject *) _Py_double_round(double x, int ndigits); - - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_FLOATOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/frameobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/frameobject.h deleted file mode 100644 index 2298ed3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/frameobject.h +++ /dev/null @@ -1,89 +0,0 @@ - -/* Frame object interface */ - -#ifndef Py_FRAMEOBJECT_H -#define Py_FRAMEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int b_type; /* what kind of block this is */ - int b_handler; /* where to jump to find handler */ - int b_level; /* value stack level to pop to */ -} PyTryBlock; - -typedef struct _frame { - PyObject_VAR_HEAD - struct _frame *f_back; /* previous frame, or NULL */ - PyCodeObject *f_code; /* code segment */ - PyObject *f_builtins; /* builtin symbol table (PyDictObject) */ - PyObject *f_globals; /* global symbol table (PyDictObject) */ - PyObject *f_locals; /* local symbol table (any mapping) */ - PyObject **f_valuestack; /* points after the last local */ - /* Next free slot in f_valuestack. Frame creation sets to f_valuestack. - Frame evaluation usually NULLs it, but a frame that yields sets it - to the current stack top. */ - PyObject **f_stacktop; - PyObject *f_trace; /* Trace function */ - - /* If an exception is raised in this frame, the next three are used to - * record the exception info (if any) originally in the thread state. See - * comments before set_exc_info() -- it's not obvious. - * Invariant: if _type is NULL, then so are _value and _traceback. - * Desired invariant: all three are NULL, or all three are non-NULL. That - * one isn't currently true, but "should be". - */ - PyObject *f_exc_type, *f_exc_value, *f_exc_traceback; - - PyThreadState *f_tstate; - int f_lasti; /* Last instruction if called */ - /* Call PyFrame_GetLineNumber() instead of reading this field - directly. As of 2.3 f_lineno is only valid when tracing is - active (i.e. when f_trace is set). At other times we use - PyCode_Addr2Line to calculate the line from the current - bytecode index. */ - int f_lineno; /* Current line number */ - int f_iblock; /* index in f_blockstack */ - PyTryBlock f_blockstack[CO_MAXBLOCKS]; /* for try and loop blocks */ - PyObject *f_localsplus[1]; /* locals+stack, dynamically sized */ -} PyFrameObject; - - -/* Standard object interface */ - -PyAPI_DATA(PyTypeObject) PyFrame_Type; - -#define PyFrame_Check(op) ((op)->ob_type == &PyFrame_Type) -#define PyFrame_IsRestricted(f) \ - ((f)->f_builtins != (f)->f_tstate->interp->builtins) - -PyAPI_FUNC(PyFrameObject *) PyFrame_New(PyThreadState *, PyCodeObject *, - PyObject *, PyObject *); - - -/* The rest of the interface is specific for frame objects */ - -/* Block management functions */ - -PyAPI_FUNC(void) PyFrame_BlockSetup(PyFrameObject *, int, int, int); -PyAPI_FUNC(PyTryBlock *) PyFrame_BlockPop(PyFrameObject *); - -/* Extend the value stack */ - -PyAPI_FUNC(PyObject **) PyFrame_ExtendStack(PyFrameObject *, int, int); - -/* Conversions between "fast locals" and locals in dictionary */ - -PyAPI_FUNC(void) PyFrame_LocalsToFast(PyFrameObject *, int); -PyAPI_FUNC(void) PyFrame_FastToLocals(PyFrameObject *); - -PyAPI_FUNC(int) PyFrame_ClearFreeList(void); - -/* Return the line of code the frame is currently executing. */ -PyAPI_FUNC(int) PyFrame_GetLineNumber(PyFrameObject *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_FRAMEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/funcobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/funcobject.h deleted file mode 100644 index 07c05ce..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/funcobject.h +++ /dev/null @@ -1,76 +0,0 @@ - -/* Function object interface */ - -#ifndef Py_FUNCOBJECT_H -#define Py_FUNCOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Function objects and code objects should not be confused with each other: - * - * Function objects are created by the execution of the 'def' statement. - * They reference a code object in their func_code attribute, which is a - * purely syntactic object, i.e. nothing more than a compiled version of some - * source code lines. There is one code object per source code "fragment", - * but each code object can be referenced by zero or many function objects - * depending only on how many times the 'def' statement in the source was - * executed so far. - */ - -typedef struct { - PyObject_HEAD - PyObject *func_code; /* A code object */ - PyObject *func_globals; /* A dictionary (other mappings won't do) */ - PyObject *func_defaults; /* NULL or a tuple */ - PyObject *func_closure; /* NULL or a tuple of cell objects */ - PyObject *func_doc; /* The __doc__ attribute, can be anything */ - PyObject *func_name; /* The __name__ attribute, a string object */ - PyObject *func_dict; /* The __dict__ attribute, a dict or NULL */ - PyObject *func_weakreflist; /* List of weak references */ - PyObject *func_module; /* The __module__ attribute, can be anything */ - - /* Invariant: - * func_closure contains the bindings for func_code->co_freevars, so - * PyTuple_Size(func_closure) == PyCode_GetNumFree(func_code) - * (func_closure may be NULL if PyCode_GetNumFree(func_code) == 0). - */ -} PyFunctionObject; - -PyAPI_DATA(PyTypeObject) PyFunction_Type; - -#define PyFunction_Check(op) (Py_TYPE(op) == &PyFunction_Type) - -PyAPI_FUNC(PyObject *) PyFunction_New(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyFunction_GetCode(PyObject *); -PyAPI_FUNC(PyObject *) PyFunction_GetGlobals(PyObject *); -PyAPI_FUNC(PyObject *) PyFunction_GetModule(PyObject *); -PyAPI_FUNC(PyObject *) PyFunction_GetDefaults(PyObject *); -PyAPI_FUNC(int) PyFunction_SetDefaults(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyFunction_GetClosure(PyObject *); -PyAPI_FUNC(int) PyFunction_SetClosure(PyObject *, PyObject *); - -/* Macros for direct access to these values. Type checks are *not* - done, so use with care. */ -#define PyFunction_GET_CODE(func) \ - (((PyFunctionObject *)func) -> func_code) -#define PyFunction_GET_GLOBALS(func) \ - (((PyFunctionObject *)func) -> func_globals) -#define PyFunction_GET_MODULE(func) \ - (((PyFunctionObject *)func) -> func_module) -#define PyFunction_GET_DEFAULTS(func) \ - (((PyFunctionObject *)func) -> func_defaults) -#define PyFunction_GET_CLOSURE(func) \ - (((PyFunctionObject *)func) -> func_closure) - -/* The classmethod and staticmethod types lives here, too */ -PyAPI_DATA(PyTypeObject) PyClassMethod_Type; -PyAPI_DATA(PyTypeObject) PyStaticMethod_Type; - -PyAPI_FUNC(PyObject *) PyClassMethod_New(PyObject *); -PyAPI_FUNC(PyObject *) PyStaticMethod_New(PyObject *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_FUNCOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/genobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/genobject.h deleted file mode 100644 index ab9680d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/genobject.h +++ /dev/null @@ -1,40 +0,0 @@ - -/* Generator object interface */ - -#ifndef Py_GENOBJECT_H -#define Py_GENOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -struct _frame; /* Avoid including frameobject.h */ - -typedef struct { - PyObject_HEAD - /* The gi_ prefix is intended to remind of generator-iterator. */ - - /* Note: gi_frame can be NULL if the generator is "finished" */ - struct _frame *gi_frame; - - /* True if generator is being executed. */ - int gi_running; - - /* The code object backing the generator */ - PyObject *gi_code; - - /* List of weak reference. */ - PyObject *gi_weakreflist; -} PyGenObject; - -PyAPI_DATA(PyTypeObject) PyGen_Type; - -#define PyGen_Check(op) PyObject_TypeCheck(op, &PyGen_Type) -#define PyGen_CheckExact(op) (Py_TYPE(op) == &PyGen_Type) - -PyAPI_FUNC(PyObject *) PyGen_New(struct _frame *); -PyAPI_FUNC(int) PyGen_NeedsFinalizing(PyGenObject *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_GENOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/graminit.h b/AppPkg/Applications/Python/Python-2.7.10/Include/graminit.h deleted file mode 100644 index b083e9d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/graminit.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Generated by Parser/pgen */ - -#define single_input 256 -#define file_input 257 -#define eval_input 258 -#define decorator 259 -#define decorators 260 -#define decorated 261 -#define funcdef 262 -#define parameters 263 -#define varargslist 264 -#define fpdef 265 -#define fplist 266 -#define stmt 267 -#define simple_stmt 268 -#define small_stmt 269 -#define expr_stmt 270 -#define augassign 271 -#define print_stmt 272 -#define del_stmt 273 -#define pass_stmt 274 -#define flow_stmt 275 -#define break_stmt 276 -#define continue_stmt 277 -#define return_stmt 278 -#define yield_stmt 279 -#define raise_stmt 280 -#define import_stmt 281 -#define import_name 282 -#define import_from 283 -#define import_as_name 284 -#define dotted_as_name 285 -#define import_as_names 286 -#define dotted_as_names 287 -#define dotted_name 288 -#define global_stmt 289 -#define exec_stmt 290 -#define assert_stmt 291 -#define compound_stmt 292 -#define if_stmt 293 -#define while_stmt 294 -#define for_stmt 295 -#define try_stmt 296 -#define with_stmt 297 -#define with_item 298 -#define except_clause 299 -#define suite 300 -#define testlist_safe 301 -#define old_test 302 -#define old_lambdef 303 -#define test 304 -#define or_test 305 -#define and_test 306 -#define not_test 307 -#define comparison 308 -#define comp_op 309 -#define expr 310 -#define xor_expr 311 -#define and_expr 312 -#define shift_expr 313 -#define arith_expr 314 -#define term 315 -#define factor 316 -#define power 317 -#define atom 318 -#define listmaker 319 -#define testlist_comp 320 -#define lambdef 321 -#define trailer 322 -#define subscriptlist 323 -#define subscript 324 -#define sliceop 325 -#define exprlist 326 -#define testlist 327 -#define dictorsetmaker 328 -#define classdef 329 -#define arglist 330 -#define argument 331 -#define list_iter 332 -#define list_for 333 -#define list_if 334 -#define comp_iter 335 -#define comp_for 336 -#define comp_if 337 -#define testlist1 338 -#define encoding_decl 339 -#define yield_expr 340 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/grammar.h b/AppPkg/Applications/Python/Python-2.7.10/Include/grammar.h deleted file mode 100644 index f82ee9c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/grammar.h +++ /dev/null @@ -1,93 +0,0 @@ - -/* Grammar interface */ - -#ifndef Py_GRAMMAR_H -#define Py_GRAMMAR_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "bitset.h" /* Sigh... */ - -/* A label of an arc */ - -typedef struct { - int lb_type; - char *lb_str; -} label; - -#define EMPTY 0 /* Label number 0 is by definition the empty label */ - -/* A list of labels */ - -typedef struct { - int ll_nlabels; - label *ll_label; -} labellist; - -/* An arc from one state to another */ - -typedef struct { - short a_lbl; /* Label of this arc */ - short a_arrow; /* State where this arc goes to */ -} arc; - -/* A state in a DFA */ - -typedef struct { - int s_narcs; - arc *s_arc; /* Array of arcs */ - - /* Optional accelerators */ - int s_lower; /* Lowest label index */ - int s_upper; /* Highest label index */ - int *s_accel; /* Accelerator */ - int s_accept; /* Nonzero for accepting state */ -} state; - -/* A DFA */ - -typedef struct { - int d_type; /* Non-terminal this represents */ - char *d_name; /* For printing */ - int d_initial; /* Initial state */ - int d_nstates; - state *d_state; /* Array of states */ - bitset d_first; -} dfa; - -/* A grammar */ - -typedef struct { - int g_ndfas; - dfa *g_dfa; /* Array of DFAs */ - labellist g_ll; - int g_start; /* Start symbol of the grammar */ - int g_accel; /* Set if accelerators present */ -} grammar; - -/* FUNCTIONS */ - -grammar *newgrammar(int start); -dfa *adddfa(grammar *g, int type, char *name); -int addstate(dfa *d); -void addarc(dfa *d, int from, int to, int lbl); -dfa *PyGrammar_FindDFA(grammar *g, int type); - -int addlabel(labellist *ll, int type, char *str); -int findlabel(labellist *ll, int type, char *str); -char *PyGrammar_LabelRepr(label *lb); -void translatelabels(grammar *g); - -void addfirstsets(grammar *g); - -void PyGrammar_AddAccelerators(grammar *g); -void PyGrammar_RemoveAccelerators(grammar *); - -void printgrammar(grammar *g, FILE *fp); -void printnonterminals(grammar *g, FILE *fp); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_GRAMMAR_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/import.h b/AppPkg/Applications/Python/Python-2.7.10/Include/import.h deleted file mode 100644 index a731f24..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/import.h +++ /dev/null @@ -1,71 +0,0 @@ - -/* Module definition and import interface */ - -#ifndef Py_IMPORT_H -#define Py_IMPORT_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(long) PyImport_GetMagicNumber(void); -PyAPI_FUNC(PyObject *) PyImport_ExecCodeModule(char *name, PyObject *co); -PyAPI_FUNC(PyObject *) PyImport_ExecCodeModuleEx( - char *name, PyObject *co, char *pathname); -PyAPI_FUNC(PyObject *) PyImport_GetModuleDict(void); -PyAPI_FUNC(PyObject *) PyImport_AddModule(const char *name); -PyAPI_FUNC(PyObject *) PyImport_ImportModule(const char *name); -PyAPI_FUNC(PyObject *) PyImport_ImportModuleNoBlock(const char *); -PyAPI_FUNC(PyObject *) PyImport_ImportModuleLevel(char *name, - PyObject *globals, PyObject *locals, PyObject *fromlist, int level); - -#define PyImport_ImportModuleEx(n, g, l, f) \ - PyImport_ImportModuleLevel(n, g, l, f, -1) - -PyAPI_FUNC(PyObject *) PyImport_GetImporter(PyObject *path); -PyAPI_FUNC(PyObject *) PyImport_Import(PyObject *name); -PyAPI_FUNC(PyObject *) PyImport_ReloadModule(PyObject *m); -PyAPI_FUNC(void) PyImport_Cleanup(void); -PyAPI_FUNC(int) PyImport_ImportFrozenModule(char *); - -#ifdef WITH_THREAD -PyAPI_FUNC(void) _PyImport_AcquireLock(void); -PyAPI_FUNC(int) _PyImport_ReleaseLock(void); -#else -#define _PyImport_AcquireLock() -#define _PyImport_ReleaseLock() 1 -#endif - -PyAPI_FUNC(struct filedescr *) _PyImport_FindModule( - const char *, PyObject *, char *, size_t, FILE **, PyObject **); -PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr *); -PyAPI_FUNC(void) _PyImport_ReInitLock(void); - -PyAPI_FUNC(PyObject *) _PyImport_FindExtension(char *, char *); -PyAPI_FUNC(PyObject *) _PyImport_FixupExtension(char *, char *); - -struct _inittab { - char *name; - void (*initfunc)(void); -}; - -PyAPI_DATA(PyTypeObject) PyNullImporter_Type; -PyAPI_DATA(struct _inittab *) PyImport_Inittab; - -PyAPI_FUNC(int) PyImport_AppendInittab(const char *name, void (*initfunc)(void)); -PyAPI_FUNC(int) PyImport_ExtendInittab(struct _inittab *newtab); - -struct _frozen { - char *name; - unsigned char *code; - int size; -}; - -/* Embedding apps may change this pointer to point to their favorite - collection of frozen modules: */ - -PyAPI_DATA(struct _frozen *) PyImport_FrozenModules; - -#ifdef __cplusplus -} -#endif -#endif /* !Py_IMPORT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/intobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/intobject.h deleted file mode 100644 index b286ec6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/intobject.h +++ /dev/null @@ -1,81 +0,0 @@ - -/* Integer object interface */ - -/* -PyIntObject represents a (long) integer. This is an immutable object; -an integer cannot change its value after creation. - -There are functions to create new integer objects, to test an object -for integer-ness, and to get the integer value. The latter functions -returns -1 and sets errno to EBADF if the object is not an PyIntObject. -None of the functions should be applied to nil objects. - -The type PyIntObject is (unfortunately) exposed here so we can declare -_Py_TrueStruct and _Py_ZeroStruct in boolobject.h; don't use this. -*/ - -#ifndef Py_INTOBJECT_H -#define Py_INTOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - long ob_ival; -} PyIntObject; - -PyAPI_DATA(PyTypeObject) PyInt_Type; - -#define PyInt_Check(op) \ - PyType_FastSubclass((op)->ob_type, Py_TPFLAGS_INT_SUBCLASS) -#define PyInt_CheckExact(op) ((op)->ob_type == &PyInt_Type) - -PyAPI_FUNC(PyObject *) PyInt_FromString(char*, char**, int); -#ifdef Py_USING_UNICODE -PyAPI_FUNC(PyObject *) PyInt_FromUnicode(Py_UNICODE*, Py_ssize_t, int); -#endif -PyAPI_FUNC(PyObject *) PyInt_FromLong(long); -PyAPI_FUNC(PyObject *) PyInt_FromSize_t(size_t); -PyAPI_FUNC(PyObject *) PyInt_FromSsize_t(Py_ssize_t); -PyAPI_FUNC(long) PyInt_AsLong(PyObject *); -PyAPI_FUNC(Py_ssize_t) PyInt_AsSsize_t(PyObject *); -PyAPI_FUNC(int) _PyInt_AsInt(PyObject *); -PyAPI_FUNC(unsigned long) PyInt_AsUnsignedLongMask(PyObject *); -#ifdef HAVE_LONG_LONG -PyAPI_FUNC(unsigned PY_LONG_LONG) PyInt_AsUnsignedLongLongMask(PyObject *); -#endif - -PyAPI_FUNC(long) PyInt_GetMax(void); - -/* Macro, trading safety for speed */ -#define PyInt_AS_LONG(op) (((PyIntObject *)(op))->ob_ival) - -/* These aren't really part of the Int object, but they're handy; the protos - * are necessary for systems that need the magic of PyAPI_FUNC and that want - * to have stropmodule as a dynamically loaded module instead of building it - * into the main Python shared library/DLL. Guido thinks I'm weird for - * building it this way. :-) [cjh] - */ -PyAPI_FUNC(unsigned long) PyOS_strtoul(char *, char **, int); -PyAPI_FUNC(long) PyOS_strtol(char *, char **, int); - -/* free list api */ -PyAPI_FUNC(int) PyInt_ClearFreeList(void); - -/* Convert an integer to the given base. Returns a string. - If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. - If newstyle is zero, then use the pre-2.6 behavior of octal having - a leading "0" */ -PyAPI_FUNC(PyObject*) _PyInt_Format(PyIntObject* v, int base, int newstyle); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyInt_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_INTOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/intrcheck.h b/AppPkg/Applications/Python/Python-2.7.10/Include/intrcheck.h deleted file mode 100644 index 11d759e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/intrcheck.h +++ /dev/null @@ -1,15 +0,0 @@ - -#ifndef Py_INTRCHECK_H -#define Py_INTRCHECK_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(int) PyOS_InterruptOccurred(void); -PyAPI_FUNC(void) PyOS_InitInterrupts(void); -PyAPI_FUNC(void) PyOS_AfterFork(void); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_INTRCHECK_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/iterobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/iterobject.h deleted file mode 100644 index ac49cb6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/iterobject.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef Py_ITEROBJECT_H -#define Py_ITEROBJECT_H -/* Iterators (the basic kind, over a sequence) */ -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(PyTypeObject) PySeqIter_Type; - -#define PySeqIter_Check(op) (Py_TYPE(op) == &PySeqIter_Type) - -PyAPI_FUNC(PyObject *) PySeqIter_New(PyObject *); - -PyAPI_DATA(PyTypeObject) PyCallIter_Type; - -#define PyCallIter_Check(op) (Py_TYPE(op) == &PyCallIter_Type) - -PyAPI_FUNC(PyObject *) PyCallIter_New(PyObject *, PyObject *); -#ifdef __cplusplus -} -#endif -#endif /* !Py_ITEROBJECT_H */ - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/listobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/listobject.h deleted file mode 100644 index 1b55d62..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/listobject.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* List object interface */ - -/* -Another generally useful object type is an list of object pointers. -This is a mutable type: the list items can be changed, and items can be -added or removed. Out-of-range indices or non-list objects are ignored. - -*** WARNING *** PyList_SetItem does not increment the new item's reference -count, but does decrement the reference count of the item it replaces, -if not nil. It does *decrement* the reference count if it is *not* -inserted in the list. Similarly, PyList_GetItem does not increment the -returned item's reference count. -*/ - -#ifndef Py_LISTOBJECT_H -#define Py_LISTOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_VAR_HEAD - /* Vector of pointers to list elements. list[0] is ob_item[0], etc. */ - PyObject **ob_item; - - /* ob_item contains space for 'allocated' elements. The number - * currently in use is ob_size. - * Invariants: - * 0 <= ob_size <= allocated - * len(list) == ob_size - * ob_item == NULL implies ob_size == allocated == 0 - * list.sort() temporarily sets allocated to -1 to detect mutations. - * - * Items must normally not be NULL, except during construction when - * the list is not yet visible outside the function that builds it. - */ - Py_ssize_t allocated; -} PyListObject; - -PyAPI_DATA(PyTypeObject) PyList_Type; - -#define PyList_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LIST_SUBCLASS) -#define PyList_CheckExact(op) (Py_TYPE(op) == &PyList_Type) - -PyAPI_FUNC(PyObject *) PyList_New(Py_ssize_t size); -PyAPI_FUNC(Py_ssize_t) PyList_Size(PyObject *); -PyAPI_FUNC(PyObject *) PyList_GetItem(PyObject *, Py_ssize_t); -PyAPI_FUNC(int) PyList_SetItem(PyObject *, Py_ssize_t, PyObject *); -PyAPI_FUNC(int) PyList_Insert(PyObject *, Py_ssize_t, PyObject *); -PyAPI_FUNC(int) PyList_Append(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyList_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); -PyAPI_FUNC(int) PyList_SetSlice(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); -PyAPI_FUNC(int) PyList_Sort(PyObject *); -PyAPI_FUNC(int) PyList_Reverse(PyObject *); -PyAPI_FUNC(PyObject *) PyList_AsTuple(PyObject *); -PyAPI_FUNC(PyObject *) _PyList_Extend(PyListObject *, PyObject *); - -/* Macro, trading safety for speed */ -#define PyList_GET_ITEM(op, i) (((PyListObject *)(op))->ob_item[i]) -#define PyList_SET_ITEM(op, i, v) (((PyListObject *)(op))->ob_item[i] = (v)) -#define PyList_GET_SIZE(op) Py_SIZE(op) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_LISTOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/longintrepr.h b/AppPkg/Applications/Python/Python-2.7.10/Include/longintrepr.h deleted file mode 100644 index 3d1cd25..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/longintrepr.h +++ /dev/null @@ -1,103 +0,0 @@ -#ifndef Py_LONGINTREPR_H -#define Py_LONGINTREPR_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* This is published for the benefit of "friend" marshal.c only. */ - -/* Parameters of the long integer representation. There are two different - sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit - integer type, and one set for 15-bit digits with each digit stored in an - unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at - configure time or in pyport.h, is used to decide which digit size to use. - - Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits' - should be an unsigned integer type able to hold all integers up to - PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type, - and that overflow is handled by taking the result modulo 2**N for some N > - PyLong_SHIFT. The majority of the code doesn't care about the precise - value of PyLong_SHIFT, but there are some notable exceptions: - - - long_pow() requires that PyLong_SHIFT be divisible by 5 - - - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8 - - - long_hash() requires that PyLong_SHIFT is *strictly* less than the number - of bits in an unsigned long, as do the PyLong <-> long (or unsigned long) - conversion functions - - - the long <-> size_t/Py_ssize_t conversion functions expect that - PyLong_SHIFT is strictly less than the number of bits in a size_t - - - the marshal code currently expects that PyLong_SHIFT is a multiple of 15 - - The values 15 and 30 should fit all of the above requirements, on any - platform. -*/ - -#if PYLONG_BITS_IN_DIGIT == 30 -#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \ - defined HAVE_INT64_T && defined HAVE_INT32_T) -#error "30-bit long digits requested, but the necessary types are not available on this platform" -#endif -typedef PY_UINT32_T digit; -typedef PY_INT32_T sdigit; /* signed variant of digit */ -typedef PY_UINT64_T twodigits; -typedef PY_INT64_T stwodigits; /* signed variant of twodigits */ -#define PyLong_SHIFT 30 -#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */ -#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */ -#elif PYLONG_BITS_IN_DIGIT == 15 -typedef unsigned short digit; -typedef short sdigit; /* signed variant of digit */ -typedef unsigned long twodigits; -typedef long stwodigits; /* signed variant of twodigits */ -#define PyLong_SHIFT 15 -#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */ -#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */ -#else -#error "PYLONG_BITS_IN_DIGIT should be 15 or 30" -#endif -#define PyLong_BASE ((digit)1 << PyLong_SHIFT) -#define PyLong_MASK ((digit)(PyLong_BASE - 1)) - -/* b/w compatibility with Python 2.5 */ -#define SHIFT PyLong_SHIFT -#define BASE PyLong_BASE -#define MASK PyLong_MASK - -#if PyLong_SHIFT % 5 != 0 -#error "longobject.c requires that PyLong_SHIFT be divisible by 5" -#endif - -/* Long integer representation. - The absolute value of a number is equal to - SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i) - Negative numbers are represented with ob_size < 0; - zero is represented by ob_size == 0. - In a normalized number, ob_digit[abs(ob_size)-1] (the most significant - digit) is never zero. Also, in all cases, for all valid i, - 0 <= ob_digit[i] <= MASK. - The allocation function takes care of allocating extra memory - so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available. - - CAUTION: Generic code manipulating subtypes of PyVarObject has to - aware that longs abuse ob_size's sign bit. -*/ - -struct _longobject { - PyObject_VAR_HEAD - digit ob_digit[1]; -}; - -PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t); - -/* Return a copy of src. */ -PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_LONGINTREPR_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/longobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/longobject.h deleted file mode 100644 index 71453b4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/longobject.h +++ /dev/null @@ -1,135 +0,0 @@ -#ifndef Py_LONGOBJECT_H -#define Py_LONGOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Long (arbitrary precision) integer object interface */ - -typedef struct _longobject PyLongObject; /* Revealed in longintrepr.h */ - -PyAPI_DATA(PyTypeObject) PyLong_Type; - -#define PyLong_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_LONG_SUBCLASS) -#define PyLong_CheckExact(op) (Py_TYPE(op) == &PyLong_Type) - -PyAPI_FUNC(PyObject *) PyLong_FromLong(long); -PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLong(unsigned long); -PyAPI_FUNC(PyObject *) PyLong_FromDouble(double); -PyAPI_FUNC(PyObject *) PyLong_FromSize_t(size_t); -PyAPI_FUNC(PyObject *) PyLong_FromSsize_t(Py_ssize_t); -PyAPI_FUNC(long) PyLong_AsLong(PyObject *); -PyAPI_FUNC(long) PyLong_AsLongAndOverflow(PyObject *, int *); -PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLong(PyObject *); -PyAPI_FUNC(unsigned long) PyLong_AsUnsignedLongMask(PyObject *); -PyAPI_FUNC(Py_ssize_t) PyLong_AsSsize_t(PyObject *); -PyAPI_FUNC(int) _PyLong_AsInt(PyObject *); -PyAPI_FUNC(PyObject *) PyLong_GetInfo(void); - -/* For use by intobject.c only */ -#define _PyLong_AsSsize_t PyLong_AsSsize_t -#define _PyLong_FromSize_t PyLong_FromSize_t -#define _PyLong_FromSsize_t PyLong_FromSsize_t -PyAPI_DATA(int) _PyLong_DigitValue[256]; - -/* _PyLong_Frexp returns a double x and an exponent e such that the - true value is approximately equal to x * 2**e. e is >= 0. x is - 0.0 if and only if the input is 0 (in which case, e and x are both - zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is - possible if the number of bits doesn't fit into a Py_ssize_t, sets - OverflowError and returns -1.0 for x, 0 for e. */ -PyAPI_FUNC(double) _PyLong_Frexp(PyLongObject *a, Py_ssize_t *e); - -PyAPI_FUNC(double) PyLong_AsDouble(PyObject *); -PyAPI_FUNC(PyObject *) PyLong_FromVoidPtr(void *); -PyAPI_FUNC(void *) PyLong_AsVoidPtr(PyObject *); - -#ifdef HAVE_LONG_LONG -PyAPI_FUNC(PyObject *) PyLong_FromLongLong(PY_LONG_LONG); -PyAPI_FUNC(PyObject *) PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG); -PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLong(PyObject *); -PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLong(PyObject *); -PyAPI_FUNC(unsigned PY_LONG_LONG) PyLong_AsUnsignedLongLongMask(PyObject *); -PyAPI_FUNC(PY_LONG_LONG) PyLong_AsLongLongAndOverflow(PyObject *, int *); -#endif /* HAVE_LONG_LONG */ - -PyAPI_FUNC(PyObject *) PyLong_FromString(char *, char **, int); -#ifdef Py_USING_UNICODE -PyAPI_FUNC(PyObject *) PyLong_FromUnicode(Py_UNICODE*, Py_ssize_t, int); -#endif - -/* _PyLong_Sign. Return 0 if v is 0, -1 if v < 0, +1 if v > 0. - v must not be NULL, and must be a normalized long. - There are no error cases. -*/ -PyAPI_FUNC(int) _PyLong_Sign(PyObject *v); - - -/* _PyLong_NumBits. Return the number of bits needed to represent the - absolute value of a long. For example, this returns 1 for 1 and -1, 2 - for 2 and -2, and 2 for 3 and -3. It returns 0 for 0. - v must not be NULL, and must be a normalized long. - (size_t)-1 is returned and OverflowError set if the true result doesn't - fit in a size_t. -*/ -PyAPI_FUNC(size_t) _PyLong_NumBits(PyObject *v); - -/* _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in - base 256, and return a Python long with the same numeric value. - If n is 0, the integer is 0. Else: - If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB; - else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the - LSB. - If is_signed is 0/false, view the bytes as a non-negative integer. - If is_signed is 1/true, view the bytes as a 2's-complement integer, - non-negative if bit 0x80 of the MSB is clear, negative if set. - Error returns: - + Return NULL with the appropriate exception set if there's not - enough memory to create the Python long. -*/ -PyAPI_FUNC(PyObject *) _PyLong_FromByteArray( - const unsigned char* bytes, size_t n, - int little_endian, int is_signed); - -/* _PyLong_AsByteArray: Convert the least-significant 8*n bits of long - v to a base-256 integer, stored in array bytes. Normally return 0, - return -1 on error. - If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at - bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and - the LSB at bytes[n-1]. - If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes - are filled and there's nothing special about bit 0x80 of the MSB. - If is_signed is 1/true, bytes is filled with the 2's-complement - representation of v's value. Bit 0x80 of the MSB is the sign bit. - Error returns (-1): - + is_signed is 0 and v < 0. TypeError is set in this case, and bytes - isn't altered. - + n isn't big enough to hold the full mathematical value of v. For - example, if is_signed is 0 and there are more digits in the v than - fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of - being large enough to hold a sign bit. OverflowError is set in this - case, but bytes holds the least-signficant n bytes of the true value. -*/ -PyAPI_FUNC(int) _PyLong_AsByteArray(PyLongObject* v, - unsigned char* bytes, size_t n, - int little_endian, int is_signed); - -/* _PyLong_Format: Convert the long to a string object with given base, - appending a base prefix of 0[box] if base is 2, 8 or 16. - Add a trailing "L" if addL is non-zero. - If newstyle is zero, then use the pre-2.6 behavior of octal having - a leading "0", instead of the prefix "0o" */ -PyAPI_FUNC(PyObject *) _PyLong_Format(PyObject *aa, int base, int addL, int newstyle); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyLong_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_LONGOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/marshal.h b/AppPkg/Applications/Python/Python-2.7.10/Include/marshal.h deleted file mode 100644 index 43ac538..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/marshal.h +++ /dev/null @@ -1,25 +0,0 @@ - -/* Interface for marshal.c */ - -#ifndef Py_MARSHAL_H -#define Py_MARSHAL_H -#ifdef __cplusplus -extern "C" { -#endif - -#define Py_MARSHAL_VERSION 2 - -PyAPI_FUNC(void) PyMarshal_WriteLongToFile(long, FILE *, int); -PyAPI_FUNC(void) PyMarshal_WriteObjectToFile(PyObject *, FILE *, int); -PyAPI_FUNC(PyObject *) PyMarshal_WriteObjectToString(PyObject *, int); - -PyAPI_FUNC(long) PyMarshal_ReadLongFromFile(FILE *); -PyAPI_FUNC(int) PyMarshal_ReadShortFromFile(FILE *); -PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromFile(FILE *); -PyAPI_FUNC(PyObject *) PyMarshal_ReadLastObjectFromFile(FILE *); -PyAPI_FUNC(PyObject *) PyMarshal_ReadObjectFromString(char *, Py_ssize_t); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_MARSHAL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/memoryobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/memoryobject.h deleted file mode 100644 index ca5064e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/memoryobject.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Memory view object. In Python this is available as "memoryview". */ - -#ifndef Py_MEMORYOBJECT_H -#define Py_MEMORYOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(PyTypeObject) PyMemoryView_Type; - -#define PyMemoryView_Check(op) (Py_TYPE(op) == &PyMemoryView_Type) - -/* Get a pointer to the underlying Py_buffer of a memoryview object. */ -#define PyMemoryView_GET_BUFFER(op) (&((PyMemoryViewObject *)(op))->view) -/* Get a pointer to the PyObject from which originates a memoryview object. */ -#define PyMemoryView_GET_BASE(op) (((PyMemoryViewObject *)(op))->view.obj) - - -PyAPI_FUNC(PyObject *) PyMemoryView_GetContiguous(PyObject *base, - int buffertype, - char fort); - - /* Return a contiguous chunk of memory representing the buffer - from an object in a memory view object. If a copy is made then the - base object for the memory view will be a *new* bytes object. - - Otherwise, the base-object will be the object itself and no - data-copying will be done. - - The buffertype argument can be PyBUF_READ, PyBUF_WRITE, - PyBUF_SHADOW to determine whether the returned buffer - should be READONLY, WRITABLE, or set to update the - original buffer if a copy must be made. If buffertype is - PyBUF_WRITE and the buffer is not contiguous an error will - be raised. In this circumstance, the user can use - PyBUF_SHADOW to ensure that a a writable temporary - contiguous buffer is returned. The contents of this - contiguous buffer will be copied back into the original - object after the memoryview object is deleted as long as - the original object is writable and allows setting an - exclusive write lock. If this is not allowed by the - original object, then a BufferError is raised. - - If the object is multi-dimensional and if fortran is 'F', - the first dimension of the underlying array will vary the - fastest in the buffer. If fortran is 'C', then the last - dimension will vary the fastest (C-style contiguous). If - fortran is 'A', then it does not matter and you will get - whatever the object decides is more efficient. - - A new reference is returned that must be DECREF'd when finished. - */ - -PyAPI_FUNC(PyObject *) PyMemoryView_FromObject(PyObject *base); - -PyAPI_FUNC(PyObject *) PyMemoryView_FromBuffer(Py_buffer *info); - /* create new if bufptr is NULL - will be a new bytesobject in base */ - - -/* The struct is declared here so that macros can work, but it shouldn't - be considered public. Don't access those fields directly, use the macros - and functions instead! */ -typedef struct { - PyObject_HEAD - PyObject *base; - Py_buffer view; -} PyMemoryViewObject; - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_MEMORYOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/metagrammar.h b/AppPkg/Applications/Python/Python-2.7.10/Include/metagrammar.h deleted file mode 100644 index 1fb471a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/metagrammar.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef Py_METAGRAMMAR_H -#define Py_METAGRAMMAR_H -#ifdef __cplusplus -extern "C" { -#endif - - -#define MSTART 256 -#define RULE 257 -#define RHS 258 -#define ALT 259 -#define ITEM 260 -#define ATOM 261 - -#ifdef __cplusplus -} -#endif -#endif /* !Py_METAGRAMMAR_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/methodobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/methodobject.h deleted file mode 100644 index 8b28288..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/methodobject.h +++ /dev/null @@ -1,93 +0,0 @@ - -/* Method object interface */ - -#ifndef Py_METHODOBJECT_H -#define Py_METHODOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -/* This is about the type 'builtin_function_or_method', - not Python methods in user-defined classes. See classobject.h - for the latter. */ - -PyAPI_DATA(PyTypeObject) PyCFunction_Type; - -#define PyCFunction_Check(op) (Py_TYPE(op) == &PyCFunction_Type) - -typedef PyObject *(*PyCFunction)(PyObject *, PyObject *); -typedef PyObject *(*PyCFunctionWithKeywords)(PyObject *, PyObject *, - PyObject *); -typedef PyObject *(*PyNoArgsFunction)(PyObject *); - -PyAPI_FUNC(PyCFunction) PyCFunction_GetFunction(PyObject *); -PyAPI_FUNC(PyObject *) PyCFunction_GetSelf(PyObject *); -PyAPI_FUNC(int) PyCFunction_GetFlags(PyObject *); - -/* Macros for direct access to these values. Type checks are *not* - done, so use with care. */ -#define PyCFunction_GET_FUNCTION(func) \ - (((PyCFunctionObject *)func) -> m_ml -> ml_meth) -#define PyCFunction_GET_SELF(func) \ - (((PyCFunctionObject *)func) -> m_self) -#define PyCFunction_GET_FLAGS(func) \ - (((PyCFunctionObject *)func) -> m_ml -> ml_flags) -PyAPI_FUNC(PyObject *) PyCFunction_Call(PyObject *, PyObject *, PyObject *); - -struct PyMethodDef { - const char *ml_name; /* The name of the built-in function/method */ - PyCFunction ml_meth; /* The C function that implements it */ - int ml_flags; /* Combination of METH_xxx flags, which mostly - describe the args expected by the C func */ - const char *ml_doc; /* The __doc__ attribute, or NULL */ -}; -typedef struct PyMethodDef PyMethodDef; - -PyAPI_FUNC(PyObject *) Py_FindMethod(PyMethodDef[], PyObject *, const char *); - -#define PyCFunction_New(ML, SELF) PyCFunction_NewEx((ML), (SELF), NULL) -PyAPI_FUNC(PyObject *) PyCFunction_NewEx(PyMethodDef *, PyObject *, - PyObject *); - -/* Flag passed to newmethodobject */ -#define METH_OLDARGS 0x0000 -#define METH_VARARGS 0x0001 -#define METH_KEYWORDS 0x0002 -/* METH_NOARGS and METH_O must not be combined with the flags above. */ -#define METH_NOARGS 0x0004 -#define METH_O 0x0008 - -/* METH_CLASS and METH_STATIC are a little different; these control - the construction of methods for a class. These cannot be used for - functions in modules. */ -#define METH_CLASS 0x0010 -#define METH_STATIC 0x0020 - -/* METH_COEXIST allows a method to be entered eventhough a slot has - already filled the entry. When defined, the flag allows a separate - method, "__contains__" for example, to coexist with a defined - slot like sq_contains. */ - -#define METH_COEXIST 0x0040 - -typedef struct PyMethodChain { - PyMethodDef *methods; /* Methods of this type */ - struct PyMethodChain *link; /* NULL or base type */ -} PyMethodChain; - -PyAPI_FUNC(PyObject *) Py_FindMethodInChain(PyMethodChain *, PyObject *, - const char *); - -typedef struct { - PyObject_HEAD - PyMethodDef *m_ml; /* Description of the C function to call */ - PyObject *m_self; /* Passed as 'self' arg to the C func, can be NULL */ - PyObject *m_module; /* The __module__ attribute, can be anything */ -} PyCFunctionObject; - -PyAPI_FUNC(int) PyCFunction_ClearFreeList(void); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_METHODOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/modsupport.h b/AppPkg/Applications/Python/Python-2.7.10/Include/modsupport.h deleted file mode 100644 index 8a8cf8d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/modsupport.h +++ /dev/null @@ -1,134 +0,0 @@ - -#ifndef Py_MODSUPPORT_H -#define Py_MODSUPPORT_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Module support interface */ - -#include - -/* If PY_SSIZE_T_CLEAN is defined, each functions treats #-specifier - to mean Py_ssize_t */ -#ifdef PY_SSIZE_T_CLEAN -#define PyArg_Parse _PyArg_Parse_SizeT -#define PyArg_ParseTuple _PyArg_ParseTuple_SizeT -#define PyArg_ParseTupleAndKeywords _PyArg_ParseTupleAndKeywords_SizeT -#define PyArg_VaParse _PyArg_VaParse_SizeT -#define PyArg_VaParseTupleAndKeywords _PyArg_VaParseTupleAndKeywords_SizeT -#define Py_BuildValue _Py_BuildValue_SizeT -#define Py_VaBuildValue _Py_VaBuildValue_SizeT -#else -PyAPI_FUNC(PyObject *) _Py_VaBuildValue_SizeT(const char *, va_list); -#endif - -PyAPI_FUNC(int) PyArg_Parse(PyObject *, const char *, ...); -PyAPI_FUNC(int) PyArg_ParseTuple(PyObject *, const char *, ...) Py_FORMAT_PARSETUPLE(PyArg_ParseTuple, 2, 3); -PyAPI_FUNC(int) PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, - const char *, char **, ...); -PyAPI_FUNC(int) PyArg_UnpackTuple(PyObject *, const char *, Py_ssize_t, Py_ssize_t, ...); -PyAPI_FUNC(PyObject *) Py_BuildValue(const char *, ...); -PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); -PyAPI_FUNC(int) _PyArg_NoKeywords(const char *funcname, PyObject *kw); - -PyAPI_FUNC(int) PyArg_VaParse(PyObject *, const char *, va_list); -PyAPI_FUNC(int) PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, - const char *, char **, va_list); -PyAPI_FUNC(PyObject *) Py_VaBuildValue(const char *, va_list); - -PyAPI_FUNC(int) PyModule_AddObject(PyObject *, const char *, PyObject *); -PyAPI_FUNC(int) PyModule_AddIntConstant(PyObject *, const char *, long); -PyAPI_FUNC(int) PyModule_AddStringConstant(PyObject *, const char *, const char *); -#define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c) -#define PyModule_AddStringMacro(m, c) PyModule_AddStringConstant(m, #c, c) - -#define PYTHON_API_VERSION 1013 -#define PYTHON_API_STRING "1013" -/* The API version is maintained (independently from the Python version) - so we can detect mismatches between the interpreter and dynamically - loaded modules. These are diagnosed by an error message but - the module is still loaded (because the mismatch can only be tested - after loading the module). The error message is intended to - explain the core dump a few seconds later. - - The symbol PYTHON_API_STRING defines the same value as a string - literal. *** PLEASE MAKE SURE THE DEFINITIONS MATCH. *** - - Please add a line or two to the top of this log for each API - version change: - - 22-Feb-2006 MvL 1013 PEP 353 - long indices for sequence lengths - - 19-Aug-2002 GvR 1012 Changes to string object struct for - interning changes, saving 3 bytes. - - 17-Jul-2001 GvR 1011 Descr-branch, just to be on the safe side - - 25-Jan-2001 FLD 1010 Parameters added to PyCode_New() and - PyFrame_New(); Python 2.1a2 - - 14-Mar-2000 GvR 1009 Unicode API added - - 3-Jan-1999 GvR 1007 Decided to change back! (Don't reuse 1008!) - - 3-Dec-1998 GvR 1008 Python 1.5.2b1 - - 18-Jan-1997 GvR 1007 string interning and other speedups - - 11-Oct-1996 GvR renamed Py_Ellipses to Py_Ellipsis :-( - - 30-Jul-1996 GvR Slice and ellipses syntax added - - 23-Jul-1996 GvR For 1.4 -- better safe than sorry this time :-) - - 7-Nov-1995 GvR Keyword arguments (should've been done at 1.3 :-( ) - - 10-Jan-1995 GvR Renamed globals to new naming scheme - - 9-Jan-1995 GvR Initial version (incompatible with older API) -*/ - -#ifdef MS_WINDOWS -/* Special defines for Windows versions used to live here. Things - have changed, and the "Version" is now in a global string variable. - Reason for this is that this for easier branding of a "custom DLL" - without actually needing a recompile. */ -#endif /* MS_WINDOWS */ - -#if SIZEOF_SIZE_T != SIZEOF_INT -/* On a 64-bit system, rename the Py_InitModule4 so that 2.4 - modules cannot get loaded into a 2.5 interpreter */ -#define Py_InitModule4 Py_InitModule4_64 -#endif - -#ifdef Py_TRACE_REFS - /* When we are tracing reference counts, rename Py_InitModule4 so - modules compiled with incompatible settings will generate a - link-time error. */ - #if SIZEOF_SIZE_T != SIZEOF_INT - #undef Py_InitModule4 - #define Py_InitModule4 Py_InitModule4TraceRefs_64 - #else - #define Py_InitModule4 Py_InitModule4TraceRefs - #endif -#endif - -PyAPI_FUNC(PyObject *) Py_InitModule4(const char *name, PyMethodDef *methods, - const char *doc, PyObject *self, - int apiver); - -#define Py_InitModule(name, methods) \ - Py_InitModule4(name, methods, (char *)NULL, (PyObject *)NULL, \ - PYTHON_API_VERSION) - -#define Py_InitModule3(name, methods, doc) \ - Py_InitModule4(name, methods, doc, (PyObject *)NULL, \ - PYTHON_API_VERSION) - -PyAPI_DATA(char *) _Py_PackageContext; - -#ifdef __cplusplus -} -#endif -#endif /* !Py_MODSUPPORT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/moduleobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/moduleobject.h deleted file mode 100644 index ff16ad2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/moduleobject.h +++ /dev/null @@ -1,24 +0,0 @@ - -/* Module object interface */ - -#ifndef Py_MODULEOBJECT_H -#define Py_MODULEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(PyTypeObject) PyModule_Type; - -#define PyModule_Check(op) PyObject_TypeCheck(op, &PyModule_Type) -#define PyModule_CheckExact(op) (Py_TYPE(op) == &PyModule_Type) - -PyAPI_FUNC(PyObject *) PyModule_New(const char *); -PyAPI_FUNC(PyObject *) PyModule_GetDict(PyObject *); -PyAPI_FUNC(char *) PyModule_GetName(PyObject *); -PyAPI_FUNC(char *) PyModule_GetFilename(PyObject *); -PyAPI_FUNC(void) _PyModule_Clear(PyObject *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_MODULEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/node.h b/AppPkg/Applications/Python/Python-2.7.10/Include/node.h deleted file mode 100644 index 9baa89a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/node.h +++ /dev/null @@ -1,41 +0,0 @@ - -/* Parse tree node interface */ - -#ifndef Py_NODE_H -#define Py_NODE_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _node { - short n_type; - char *n_str; - int n_lineno; - int n_col_offset; - int n_nchildren; - struct _node *n_child; -} node; - -PyAPI_FUNC(node *) PyNode_New(int type); -PyAPI_FUNC(int) PyNode_AddChild(node *n, int type, - char *str, int lineno, int col_offset); -PyAPI_FUNC(void) PyNode_Free(node *n); -PyAPI_FUNC(Py_ssize_t) _PyNode_SizeOf(node *n); - -/* Node access functions */ -#define NCH(n) ((n)->n_nchildren) - -#define CHILD(n, i) (&(n)->n_child[i]) -#define RCHILD(n, i) (CHILD(n, NCH(n) + i)) -#define TYPE(n) ((n)->n_type) -#define STR(n) ((n)->n_str) - -/* Assert that the type of a node is what we expect */ -#define REQ(n, type) assert(TYPE(n) == (type)) - -PyAPI_FUNC(void) PyNode_ListTree(node *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_NODE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/object.h b/AppPkg/Applications/Python/Python-2.7.10/Include/object.h deleted file mode 100644 index bb5fa3c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/object.h +++ /dev/null @@ -1,1013 +0,0 @@ -#ifndef Py_OBJECT_H -#define Py_OBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Object and type object interface */ - -/* -Objects are structures allocated on the heap. Special rules apply to -the use of objects to ensure they are properly garbage-collected. -Objects are never allocated statically or on the stack; they must be -accessed through special macros and functions only. (Type objects are -exceptions to the first rule; the standard types are represented by -statically initialized type objects, although work on type/class unification -for Python 2.2 made it possible to have heap-allocated type objects too). - -An object has a 'reference count' that is increased or decreased when a -pointer to the object is copied or deleted; when the reference count -reaches zero there are no references to the object left and it can be -removed from the heap. - -An object has a 'type' that determines what it represents and what kind -of data it contains. An object's type is fixed when it is created. -Types themselves are represented as objects; an object contains a -pointer to the corresponding type object. The type itself has a type -pointer pointing to the object representing the type 'type', which -contains a pointer to itself!). - -Objects do not float around in memory; once allocated an object keeps -the same size and address. Objects that must hold variable-size data -can contain pointers to variable-size parts of the object. Not all -objects of the same type have the same size; but the size cannot change -after allocation. (These restrictions are made so a reference to an -object can be simply a pointer -- moving an object would require -updating all the pointers, and changing an object's size would require -moving it if there was another object right next to it.) - -Objects are always accessed through pointers of the type 'PyObject *'. -The type 'PyObject' is a structure that only contains the reference count -and the type pointer. The actual memory allocated for an object -contains other data that can only be accessed after casting the pointer -to a pointer to a longer structure type. This longer type must start -with the reference count and type fields; the macro PyObject_HEAD should be -used for this (to accommodate for future changes). The implementation -of a particular object type can cast the object pointer to the proper -type and back. - -A standard interface exists for objects that contain an array of items -whose size is determined when the object is allocated. -*/ - -/* Py_DEBUG implies Py_TRACE_REFS. */ -#if defined(Py_DEBUG) && !defined(Py_TRACE_REFS) -#define Py_TRACE_REFS -#endif - -/* Py_TRACE_REFS implies Py_REF_DEBUG. */ -#if defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) -#define Py_REF_DEBUG -#endif - -#ifdef Py_TRACE_REFS -/* Define pointers to support a doubly-linked list of all live heap objects. */ -#define _PyObject_HEAD_EXTRA \ - struct _object *_ob_next; \ - struct _object *_ob_prev; - -#define _PyObject_EXTRA_INIT 0, 0, - -#else -#define _PyObject_HEAD_EXTRA -#define _PyObject_EXTRA_INIT -#endif - -/* PyObject_HEAD defines the initial segment of every PyObject. */ -#define PyObject_HEAD \ - _PyObject_HEAD_EXTRA \ - Py_ssize_t ob_refcnt; \ - struct _typeobject *ob_type; - -#define PyObject_HEAD_INIT(type) \ - _PyObject_EXTRA_INIT \ - 1, type, - -#define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, - -/* PyObject_VAR_HEAD defines the initial segment of all variable-size - * container objects. These end with a declaration of an array with 1 - * element, but enough space is malloc'ed so that the array actually - * has room for ob_size elements. Note that ob_size is an element count, - * not necessarily a byte count. - */ -#define PyObject_VAR_HEAD \ - PyObject_HEAD \ - Py_ssize_t ob_size; /* Number of items in variable part */ -#define Py_INVALID_SIZE (Py_ssize_t)-1 - -/* Nothing is actually declared to be a PyObject, but every pointer to - * a Python object can be cast to a PyObject*. This is inheritance built - * by hand. Similarly every pointer to a variable-size Python object can, - * in addition, be cast to PyVarObject*. - */ -typedef struct _object { - PyObject_HEAD -} PyObject; - -typedef struct { - PyObject_VAR_HEAD -} PyVarObject; - -#define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) -#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) -#define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) - -/* -Type objects contain a string containing the type name (to help somewhat -in debugging), the allocation parameters (see PyObject_New() and -PyObject_NewVar()), -and methods for accessing objects of the type. Methods are optional, a -nil pointer meaning that particular kind of access is not available for -this type. The Py_DECREF() macro uses the tp_dealloc method without -checking for a nil pointer; it should always be implemented except if -the implementation can guarantee that the reference count will never -reach zero (e.g., for statically allocated type objects). - -NB: the methods for certain type groups are now contained in separate -method blocks. -*/ - -typedef PyObject * (*unaryfunc)(PyObject *); -typedef PyObject * (*binaryfunc)(PyObject *, PyObject *); -typedef PyObject * (*ternaryfunc)(PyObject *, PyObject *, PyObject *); -typedef int (*inquiry)(PyObject *); -typedef Py_ssize_t (*lenfunc)(PyObject *); -typedef int (*coercion)(PyObject **, PyObject **); -typedef PyObject *(*intargfunc)(PyObject *, int) Py_DEPRECATED(2.5); -typedef PyObject *(*intintargfunc)(PyObject *, int, int) Py_DEPRECATED(2.5); -typedef PyObject *(*ssizeargfunc)(PyObject *, Py_ssize_t); -typedef PyObject *(*ssizessizeargfunc)(PyObject *, Py_ssize_t, Py_ssize_t); -typedef int(*intobjargproc)(PyObject *, int, PyObject *); -typedef int(*intintobjargproc)(PyObject *, int, int, PyObject *); -typedef int(*ssizeobjargproc)(PyObject *, Py_ssize_t, PyObject *); -typedef int(*ssizessizeobjargproc)(PyObject *, Py_ssize_t, Py_ssize_t, PyObject *); -typedef int(*objobjargproc)(PyObject *, PyObject *, PyObject *); - - - -/* int-based buffer interface */ -typedef int (*getreadbufferproc)(PyObject *, int, void **); -typedef int (*getwritebufferproc)(PyObject *, int, void **); -typedef int (*getsegcountproc)(PyObject *, int *); -typedef int (*getcharbufferproc)(PyObject *, int, char **); -/* ssize_t-based buffer interface */ -typedef Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **); -typedef Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **); -typedef Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *); -typedef Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, char **); - - -/* Py3k buffer interface */ -typedef struct bufferinfo { - void *buf; - PyObject *obj; /* owned reference */ - Py_ssize_t len; - Py_ssize_t itemsize; /* This is Py_ssize_t so it can be - pointed to by strides in simple case.*/ - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - Py_ssize_t smalltable[2]; /* static store for shape and strides of - mono-dimensional buffers. */ - void *internal; -} Py_buffer; - -typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); -typedef void (*releasebufferproc)(PyObject *, Py_buffer *); - - /* Flags for getting buffers */ -#define PyBUF_SIMPLE 0 -#define PyBUF_WRITABLE 0x0001 -/* we used to include an E, backwards compatible alias */ -#define PyBUF_WRITEABLE PyBUF_WRITABLE -#define PyBUF_FORMAT 0x0004 -#define PyBUF_ND 0x0008 -#define PyBUF_STRIDES (0x0010 | PyBUF_ND) -#define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) -#define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) -#define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) -#define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - -#define PyBUF_CONTIG (PyBUF_ND | PyBUF_WRITABLE) -#define PyBUF_CONTIG_RO (PyBUF_ND) - -#define PyBUF_STRIDED (PyBUF_STRIDES | PyBUF_WRITABLE) -#define PyBUF_STRIDED_RO (PyBUF_STRIDES) - -#define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_WRITABLE | PyBUF_FORMAT) -#define PyBUF_RECORDS_RO (PyBUF_STRIDES | PyBUF_FORMAT) - -#define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_WRITABLE | PyBUF_FORMAT) -#define PyBUF_FULL_RO (PyBUF_INDIRECT | PyBUF_FORMAT) - - -#define PyBUF_READ 0x100 -#define PyBUF_WRITE 0x200 -#define PyBUF_SHADOW 0x400 -/* end Py3k buffer interface */ - -typedef int (*objobjproc)(PyObject *, PyObject *); -typedef int (*visitproc)(PyObject *, void *); -typedef int (*traverseproc)(PyObject *, visitproc, void *); - -typedef struct { - /* For numbers without flag bit Py_TPFLAGS_CHECKTYPES set, all - arguments are guaranteed to be of the object's type (modulo - coercion hacks -- i.e. if the type's coercion function - returns other types, then these are allowed as well). Numbers that - have the Py_TPFLAGS_CHECKTYPES flag bit set should check *both* - arguments for proper type and implement the necessary conversions - in the slot functions themselves. */ - - binaryfunc nb_add; - binaryfunc nb_subtract; - binaryfunc nb_multiply; - binaryfunc nb_divide; - binaryfunc nb_remainder; - binaryfunc nb_divmod; - ternaryfunc nb_power; - unaryfunc nb_negative; - unaryfunc nb_positive; - unaryfunc nb_absolute; - inquiry nb_nonzero; - unaryfunc nb_invert; - binaryfunc nb_lshift; - binaryfunc nb_rshift; - binaryfunc nb_and; - binaryfunc nb_xor; - binaryfunc nb_or; - coercion nb_coerce; - unaryfunc nb_int; - unaryfunc nb_long; - unaryfunc nb_float; - unaryfunc nb_oct; - unaryfunc nb_hex; - /* Added in release 2.0 */ - binaryfunc nb_inplace_add; - binaryfunc nb_inplace_subtract; - binaryfunc nb_inplace_multiply; - binaryfunc nb_inplace_divide; - binaryfunc nb_inplace_remainder; - ternaryfunc nb_inplace_power; - binaryfunc nb_inplace_lshift; - binaryfunc nb_inplace_rshift; - binaryfunc nb_inplace_and; - binaryfunc nb_inplace_xor; - binaryfunc nb_inplace_or; - - /* Added in release 2.2 */ - /* The following require the Py_TPFLAGS_HAVE_CLASS flag */ - binaryfunc nb_floor_divide; - binaryfunc nb_true_divide; - binaryfunc nb_inplace_floor_divide; - binaryfunc nb_inplace_true_divide; - - /* Added in release 2.5 */ - unaryfunc nb_index; -} PyNumberMethods; - -typedef struct { - lenfunc sq_length; - binaryfunc sq_concat; - ssizeargfunc sq_repeat; - ssizeargfunc sq_item; - ssizessizeargfunc sq_slice; - ssizeobjargproc sq_ass_item; - ssizessizeobjargproc sq_ass_slice; - objobjproc sq_contains; - /* Added in release 2.0 */ - binaryfunc sq_inplace_concat; - ssizeargfunc sq_inplace_repeat; -} PySequenceMethods; - -typedef struct { - lenfunc mp_length; - binaryfunc mp_subscript; - objobjargproc mp_ass_subscript; -} PyMappingMethods; - -typedef struct { - readbufferproc bf_getreadbuffer; - writebufferproc bf_getwritebuffer; - segcountproc bf_getsegcount; - charbufferproc bf_getcharbuffer; - getbufferproc bf_getbuffer; - releasebufferproc bf_releasebuffer; -} PyBufferProcs; - - -typedef void (*freefunc)(void *); -typedef void (*destructor)(PyObject *); -typedef int (*printfunc)(PyObject *, FILE *, int); -typedef PyObject *(*getattrfunc)(PyObject *, char *); -typedef PyObject *(*getattrofunc)(PyObject *, PyObject *); -typedef int (*setattrfunc)(PyObject *, char *, PyObject *); -typedef int (*setattrofunc)(PyObject *, PyObject *, PyObject *); -typedef int (*cmpfunc)(PyObject *, PyObject *); -typedef PyObject *(*reprfunc)(PyObject *); -typedef long (*hashfunc)(PyObject *); -typedef PyObject *(*richcmpfunc) (PyObject *, PyObject *, int); -typedef PyObject *(*getiterfunc) (PyObject *); -typedef PyObject *(*iternextfunc) (PyObject *); -typedef PyObject *(*descrgetfunc) (PyObject *, PyObject *, PyObject *); -typedef int (*descrsetfunc) (PyObject *, PyObject *, PyObject *); -typedef int (*initproc)(PyObject *, PyObject *, PyObject *); -typedef PyObject *(*newfunc)(struct _typeobject *, PyObject *, PyObject *); -typedef PyObject *(*allocfunc)(struct _typeobject *, Py_ssize_t); - -typedef struct _typeobject { - PyObject_VAR_HEAD - const char *tp_name; /* For printing, in format "." */ - Py_ssize_t tp_basicsize, tp_itemsize; /* For allocation */ - - /* Methods to implement standard operations */ - - destructor tp_dealloc; - printfunc tp_print; - getattrfunc tp_getattr; - setattrfunc tp_setattr; - cmpfunc tp_compare; - reprfunc tp_repr; - - /* Method suites for standard classes */ - - PyNumberMethods *tp_as_number; - PySequenceMethods *tp_as_sequence; - PyMappingMethods *tp_as_mapping; - - /* More standard operations (here for binary compatibility) */ - - hashfunc tp_hash; - ternaryfunc tp_call; - reprfunc tp_str; - getattrofunc tp_getattro; - setattrofunc tp_setattro; - - /* Functions to access object as input/output buffer */ - PyBufferProcs *tp_as_buffer; - - /* Flags to define presence of optional/expanded features */ - long tp_flags; - - const char *tp_doc; /* Documentation string */ - - /* Assigned meaning in release 2.0 */ - /* call function for all accessible objects */ - traverseproc tp_traverse; - - /* delete references to contained objects */ - inquiry tp_clear; - - /* Assigned meaning in release 2.1 */ - /* rich comparisons */ - richcmpfunc tp_richcompare; - - /* weak reference enabler */ - Py_ssize_t tp_weaklistoffset; - - /* Added in release 2.2 */ - /* Iterators */ - getiterfunc tp_iter; - iternextfunc tp_iternext; - - /* Attribute descriptor and subclassing stuff */ - struct PyMethodDef *tp_methods; - struct PyMemberDef *tp_members; - struct PyGetSetDef *tp_getset; - struct _typeobject *tp_base; - PyObject *tp_dict; - descrgetfunc tp_descr_get; - descrsetfunc tp_descr_set; - Py_ssize_t tp_dictoffset; - initproc tp_init; - allocfunc tp_alloc; - newfunc tp_new; - freefunc tp_free; /* Low-level free-memory routine */ - inquiry tp_is_gc; /* For PyObject_IS_GC */ - PyObject *tp_bases; - PyObject *tp_mro; /* method resolution order */ - PyObject *tp_cache; - PyObject *tp_subclasses; - PyObject *tp_weaklist; - destructor tp_del; - - /* Type attribute cache version tag. Added in version 2.6 */ - unsigned int tp_version_tag; - -#ifdef COUNT_ALLOCS - /* these must be last and never explicitly initialized */ - Py_ssize_t tp_allocs; - Py_ssize_t tp_frees; - Py_ssize_t tp_maxalloc; - struct _typeobject *tp_prev; - struct _typeobject *tp_next; -#endif -} PyTypeObject; - - -/* The *real* layout of a type object when allocated on the heap */ -typedef struct _heaptypeobject { - /* Note: there's a dependency on the order of these members - in slotptr() in typeobject.c . */ - PyTypeObject ht_type; - PyNumberMethods as_number; - PyMappingMethods as_mapping; - PySequenceMethods as_sequence; /* as_sequence comes after as_mapping, - so that the mapping wins when both - the mapping and the sequence define - a given operator (e.g. __getitem__). - see add_operators() in typeobject.c . */ - PyBufferProcs as_buffer; - PyObject *ht_name, *ht_slots; - /* here are optional user slots, followed by the members. */ -} PyHeapTypeObject; - -/* access macro to the members which are floating "behind" the object */ -#define PyHeapType_GET_MEMBERS(etype) \ - ((PyMemberDef *)(((char *)etype) + Py_TYPE(etype)->tp_basicsize)) - - -/* Generic type check */ -PyAPI_FUNC(int) PyType_IsSubtype(PyTypeObject *, PyTypeObject *); -#define PyObject_TypeCheck(ob, tp) \ - (Py_TYPE(ob) == (tp) || PyType_IsSubtype(Py_TYPE(ob), (tp))) - -PyAPI_DATA(PyTypeObject) PyType_Type; /* built-in 'type' */ -PyAPI_DATA(PyTypeObject) PyBaseObject_Type; /* built-in 'object' */ -PyAPI_DATA(PyTypeObject) PySuper_Type; /* built-in 'super' */ - -#define PyType_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TYPE_SUBCLASS) -#define PyType_CheckExact(op) (Py_TYPE(op) == &PyType_Type) - -PyAPI_FUNC(int) PyType_Ready(PyTypeObject *); -PyAPI_FUNC(PyObject *) PyType_GenericAlloc(PyTypeObject *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyType_GenericNew(PyTypeObject *, - PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyType_Lookup(PyTypeObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyObject_LookupSpecial(PyObject *, char *, PyObject **); -PyAPI_FUNC(unsigned int) PyType_ClearCache(void); -PyAPI_FUNC(void) PyType_Modified(PyTypeObject *); - -/* Generic operations on objects */ -PyAPI_FUNC(int) PyObject_Print(PyObject *, FILE *, int); -PyAPI_FUNC(void) _PyObject_Dump(PyObject *); -PyAPI_FUNC(PyObject *) PyObject_Repr(PyObject *); -PyAPI_FUNC(PyObject *) _PyObject_Str(PyObject *); -PyAPI_FUNC(PyObject *) PyObject_Str(PyObject *); -#define PyObject_Bytes PyObject_Str -#ifdef Py_USING_UNICODE -PyAPI_FUNC(PyObject *) PyObject_Unicode(PyObject *); -#endif -PyAPI_FUNC(int) PyObject_Compare(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyObject_RichCompare(PyObject *, PyObject *, int); -PyAPI_FUNC(int) PyObject_RichCompareBool(PyObject *, PyObject *, int); -PyAPI_FUNC(PyObject *) PyObject_GetAttrString(PyObject *, const char *); -PyAPI_FUNC(int) PyObject_SetAttrString(PyObject *, const char *, PyObject *); -PyAPI_FUNC(int) PyObject_HasAttrString(PyObject *, const char *); -PyAPI_FUNC(PyObject *) PyObject_GetAttr(PyObject *, PyObject *); -PyAPI_FUNC(int) PyObject_SetAttr(PyObject *, PyObject *, PyObject *); -PyAPI_FUNC(int) PyObject_HasAttr(PyObject *, PyObject *); -PyAPI_FUNC(PyObject **) _PyObject_GetDictPtr(PyObject *); -PyAPI_FUNC(PyObject *) PyObject_SelfIter(PyObject *); -PyAPI_FUNC(PyObject *) _PyObject_NextNotImplemented(PyObject *); -PyAPI_FUNC(PyObject *) PyObject_GenericGetAttr(PyObject *, PyObject *); -PyAPI_FUNC(int) PyObject_GenericSetAttr(PyObject *, - PyObject *, PyObject *); -PyAPI_FUNC(long) PyObject_Hash(PyObject *); -PyAPI_FUNC(long) PyObject_HashNotImplemented(PyObject *); -PyAPI_FUNC(int) PyObject_IsTrue(PyObject *); -PyAPI_FUNC(int) PyObject_Not(PyObject *); -PyAPI_FUNC(int) PyCallable_Check(PyObject *); -PyAPI_FUNC(int) PyNumber_Coerce(PyObject **, PyObject **); -PyAPI_FUNC(int) PyNumber_CoerceEx(PyObject **, PyObject **); - -PyAPI_FUNC(void) PyObject_ClearWeakRefs(PyObject *); - -/* A slot function whose address we need to compare */ -extern int _PyObject_SlotCompare(PyObject *, PyObject *); -/* Same as PyObject_Generic{Get,Set}Attr, but passing the attributes - dict as the last parameter. */ -PyAPI_FUNC(PyObject *) -_PyObject_GenericGetAttrWithDict(PyObject *, PyObject *, PyObject *); -PyAPI_FUNC(int) -_PyObject_GenericSetAttrWithDict(PyObject *, PyObject *, - PyObject *, PyObject *); - - -/* PyObject_Dir(obj) acts like Python __builtin__.dir(obj), returning a - list of strings. PyObject_Dir(NULL) is like __builtin__.dir(), - returning the names of the current locals. In this case, if there are - no current locals, NULL is returned, and PyErr_Occurred() is false. -*/ -PyAPI_FUNC(PyObject *) PyObject_Dir(PyObject *); - - -/* Helpers for printing recursive container types */ -PyAPI_FUNC(int) Py_ReprEnter(PyObject *); -PyAPI_FUNC(void) Py_ReprLeave(PyObject *); - -/* Helpers for hash functions */ -PyAPI_FUNC(long) _Py_HashDouble(double); -PyAPI_FUNC(long) _Py_HashPointer(void*); - -typedef struct { - long prefix; - long suffix; -} _Py_HashSecret_t; -PyAPI_DATA(_Py_HashSecret_t) _Py_HashSecret; - -#ifdef Py_DEBUG -PyAPI_DATA(int) _Py_HashSecret_Initialized; -#endif - -/* Helper for passing objects to printf and the like. - Leaks refcounts. Don't use it! -*/ -#define PyObject_REPR(obj) PyString_AS_STRING(PyObject_Repr(obj)) - -/* Flag bits for printing: */ -#define Py_PRINT_RAW 1 /* No string quotes etc. */ - -/* -`Type flags (tp_flags) - -These flags are used to extend the type structure in a backwards-compatible -fashion. Extensions can use the flags to indicate (and test) when a given -type structure contains a new feature. The Python core will use these when -introducing new functionality between major revisions (to avoid mid-version -changes in the PYTHON_API_VERSION). - -Arbitration of the flag bit positions will need to be coordinated among -all extension writers who publically release their extensions (this will -be fewer than you might expect!).. - -Python 1.5.2 introduced the bf_getcharbuffer slot into PyBufferProcs. - -Type definitions should use Py_TPFLAGS_DEFAULT for their tp_flags value. - -Code can use PyType_HasFeature(type_ob, flag_value) to test whether the -given type object has a specified feature. - -NOTE: when building the core, Py_TPFLAGS_DEFAULT includes -Py_TPFLAGS_HAVE_VERSION_TAG; outside the core, it doesn't. This is so -that extensions that modify tp_dict of their own types directly don't -break, since this was allowed in 2.5. In 3.0 they will have to -manually remove this flag though! -*/ - -/* PyBufferProcs contains bf_getcharbuffer */ -#define Py_TPFLAGS_HAVE_GETCHARBUFFER (1L<<0) - -/* PySequenceMethods contains sq_contains */ -#define Py_TPFLAGS_HAVE_SEQUENCE_IN (1L<<1) - -/* This is here for backwards compatibility. Extensions that use the old GC - * API will still compile but the objects will not be tracked by the GC. */ -#define Py_TPFLAGS_GC 0 /* used to be (1L<<2) */ - -/* PySequenceMethods and PyNumberMethods contain in-place operators */ -#define Py_TPFLAGS_HAVE_INPLACEOPS (1L<<3) - -/* PyNumberMethods do their own coercion */ -#define Py_TPFLAGS_CHECKTYPES (1L<<4) - -/* tp_richcompare is defined */ -#define Py_TPFLAGS_HAVE_RICHCOMPARE (1L<<5) - -/* Objects which are weakly referencable if their tp_weaklistoffset is >0 */ -#define Py_TPFLAGS_HAVE_WEAKREFS (1L<<6) - -/* tp_iter is defined */ -#define Py_TPFLAGS_HAVE_ITER (1L<<7) - -/* New members introduced by Python 2.2 exist */ -#define Py_TPFLAGS_HAVE_CLASS (1L<<8) - -/* Set if the type object is dynamically allocated */ -#define Py_TPFLAGS_HEAPTYPE (1L<<9) - -/* Set if the type allows subclassing */ -#define Py_TPFLAGS_BASETYPE (1L<<10) - -/* Set if the type is 'ready' -- fully initialized */ -#define Py_TPFLAGS_READY (1L<<12) - -/* Set while the type is being 'readied', to prevent recursive ready calls */ -#define Py_TPFLAGS_READYING (1L<<13) - -/* Objects support garbage collection (see objimp.h) */ -#define Py_TPFLAGS_HAVE_GC (1L<<14) - -/* These two bits are preserved for Stackless Python, next after this is 17 */ -#ifdef STACKLESS -#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION (3L<<15) -#else -#define Py_TPFLAGS_HAVE_STACKLESS_EXTENSION 0 -#endif - -/* Objects support nb_index in PyNumberMethods */ -#define Py_TPFLAGS_HAVE_INDEX (1L<<17) - -/* Objects support type attribute cache */ -#define Py_TPFLAGS_HAVE_VERSION_TAG (1L<<18) -#define Py_TPFLAGS_VALID_VERSION_TAG (1L<<19) - -/* Type is abstract and cannot be instantiated */ -#define Py_TPFLAGS_IS_ABSTRACT (1L<<20) - -/* Has the new buffer protocol */ -#define Py_TPFLAGS_HAVE_NEWBUFFER (1L<<21) - -/* These flags are used to determine if a type is a subclass. */ -#define Py_TPFLAGS_INT_SUBCLASS (1L<<23) -#define Py_TPFLAGS_LONG_SUBCLASS (1L<<24) -#define Py_TPFLAGS_LIST_SUBCLASS (1L<<25) -#define Py_TPFLAGS_TUPLE_SUBCLASS (1L<<26) -#define Py_TPFLAGS_STRING_SUBCLASS (1L<<27) -#define Py_TPFLAGS_UNICODE_SUBCLASS (1L<<28) -#define Py_TPFLAGS_DICT_SUBCLASS (1L<<29) -#define Py_TPFLAGS_BASE_EXC_SUBCLASS (1L<<30) -#define Py_TPFLAGS_TYPE_SUBCLASS (1L<<31) - -#define Py_TPFLAGS_DEFAULT_EXTERNAL ( \ - Py_TPFLAGS_HAVE_GETCHARBUFFER | \ - Py_TPFLAGS_HAVE_SEQUENCE_IN | \ - Py_TPFLAGS_HAVE_INPLACEOPS | \ - Py_TPFLAGS_HAVE_RICHCOMPARE | \ - Py_TPFLAGS_HAVE_WEAKREFS | \ - Py_TPFLAGS_HAVE_ITER | \ - Py_TPFLAGS_HAVE_CLASS | \ - Py_TPFLAGS_HAVE_STACKLESS_EXTENSION | \ - Py_TPFLAGS_HAVE_INDEX | \ - 0) -#define Py_TPFLAGS_DEFAULT_CORE (Py_TPFLAGS_DEFAULT_EXTERNAL | \ - Py_TPFLAGS_HAVE_VERSION_TAG) - -#ifdef Py_BUILD_CORE -#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_CORE -#else -#define Py_TPFLAGS_DEFAULT Py_TPFLAGS_DEFAULT_EXTERNAL -#endif - -#define PyType_HasFeature(t,f) (((t)->tp_flags & (f)) != 0) -#define PyType_FastSubclass(t,f) PyType_HasFeature(t,f) - - -/* -The macros Py_INCREF(op) and Py_DECREF(op) are used to increment or decrement -reference counts. Py_DECREF calls the object's deallocator function when -the refcount falls to 0; for -objects that don't contain references to other objects or heap memory -this can be the standard function free(). Both macros can be used -wherever a void expression is allowed. The argument must not be a -NULL pointer. If it may be NULL, use Py_XINCREF/Py_XDECREF instead. -The macro _Py_NewReference(op) initialize reference counts to 1, and -in special builds (Py_REF_DEBUG, Py_TRACE_REFS) performs additional -bookkeeping appropriate to the special build. - -We assume that the reference count field can never overflow; this can -be proven when the size of the field is the same as the pointer size, so -we ignore the possibility. Provided a C int is at least 32 bits (which -is implicitly assumed in many parts of this code), that's enough for -about 2**31 references to an object. - -XXX The following became out of date in Python 2.2, but I'm not sure -XXX what the full truth is now. Certainly, heap-allocated type objects -XXX can and should be deallocated. -Type objects should never be deallocated; the type pointer in an object -is not considered to be a reference to the type object, to save -complications in the deallocation function. (This is actually a -decision that's up to the implementer of each new type so if you want, -you can count such references to the type object.) - -*** WARNING*** The Py_DECREF macro must have a side-effect-free argument -since it may evaluate its argument multiple times. (The alternative -would be to mace it a proper function or assign it to a global temporary -variable first, both of which are slower; and in a multi-threaded -environment the global variable trick is not safe.) -*/ - -/* First define a pile of simple helper macros, one set per special - * build symbol. These either expand to the obvious things, or to - * nothing at all when the special mode isn't in effect. The main - * macros can later be defined just once then, yet expand to different - * things depending on which special build options are and aren't in effect. - * Trust me : while painful, this is 20x easier to understand than, - * e.g, defining _Py_NewReference five different times in a maze of nested - * #ifdefs (we used to do that -- it was impenetrable). - */ -#ifdef Py_REF_DEBUG -PyAPI_DATA(Py_ssize_t) _Py_RefTotal; -PyAPI_FUNC(void) _Py_NegativeRefcount(const char *fname, - int lineno, PyObject *op); -PyAPI_FUNC(PyObject *) _PyDict_Dummy(void); -PyAPI_FUNC(PyObject *) _PySet_Dummy(void); -PyAPI_FUNC(Py_ssize_t) _Py_GetRefTotal(void); -#define _Py_INC_REFTOTAL _Py_RefTotal++ -#define _Py_DEC_REFTOTAL _Py_RefTotal-- -#define _Py_REF_DEBUG_COMMA , -#define _Py_CHECK_REFCNT(OP) \ -{ if (((PyObject*)OP)->ob_refcnt < 0) \ - _Py_NegativeRefcount(__FILE__, __LINE__, \ - (PyObject *)(OP)); \ -} -#else -#define _Py_INC_REFTOTAL -#define _Py_DEC_REFTOTAL -#define _Py_REF_DEBUG_COMMA -#define _Py_CHECK_REFCNT(OP) /* a semicolon */; -#endif /* Py_REF_DEBUG */ - -#ifdef COUNT_ALLOCS -PyAPI_FUNC(void) inc_count(PyTypeObject *); -PyAPI_FUNC(void) dec_count(PyTypeObject *); -#define _Py_INC_TPALLOCS(OP) inc_count(Py_TYPE(OP)) -#define _Py_INC_TPFREES(OP) dec_count(Py_TYPE(OP)) -#define _Py_DEC_TPFREES(OP) Py_TYPE(OP)->tp_frees-- -#define _Py_COUNT_ALLOCS_COMMA , -#else -#define _Py_INC_TPALLOCS(OP) -#define _Py_INC_TPFREES(OP) -#define _Py_DEC_TPFREES(OP) -#define _Py_COUNT_ALLOCS_COMMA -#endif /* COUNT_ALLOCS */ - -#ifdef Py_TRACE_REFS -/* Py_TRACE_REFS is such major surgery that we call external routines. */ -PyAPI_FUNC(void) _Py_NewReference(PyObject *); -PyAPI_FUNC(void) _Py_ForgetReference(PyObject *); -PyAPI_FUNC(void) _Py_Dealloc(PyObject *); -PyAPI_FUNC(void) _Py_PrintReferences(FILE *); -PyAPI_FUNC(void) _Py_PrintReferenceAddresses(FILE *); -PyAPI_FUNC(void) _Py_AddToAllObjects(PyObject *, int force); - -#else -/* Without Py_TRACE_REFS, there's little enough to do that we expand code - * inline. - */ -#define _Py_NewReference(op) ( \ - _Py_INC_TPALLOCS(op) _Py_COUNT_ALLOCS_COMMA \ - _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ - Py_REFCNT(op) = 1) - -#define _Py_ForgetReference(op) _Py_INC_TPFREES(op) - -#define _Py_Dealloc(op) ( \ - _Py_INC_TPFREES(op) _Py_COUNT_ALLOCS_COMMA \ - (*Py_TYPE(op)->tp_dealloc)((PyObject *)(op))) -#endif /* !Py_TRACE_REFS */ - -#define Py_INCREF(op) ( \ - _Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \ - ((PyObject*)(op))->ob_refcnt++) - -#define Py_DECREF(op) \ - do { \ - if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \ - --((PyObject*)(op))->ob_refcnt != 0) \ - _Py_CHECK_REFCNT(op) \ - else \ - _Py_Dealloc((PyObject *)(op)); \ - } while (0) - -/* Safely decref `op` and set `op` to NULL, especially useful in tp_clear - * and tp_dealloc implementatons. - * - * Note that "the obvious" code can be deadly: - * - * Py_XDECREF(op); - * op = NULL; - * - * Typically, `op` is something like self->containee, and `self` is done - * using its `containee` member. In the code sequence above, suppose - * `containee` is non-NULL with a refcount of 1. Its refcount falls to - * 0 on the first line, which can trigger an arbitrary amount of code, - * possibly including finalizers (like __del__ methods or weakref callbacks) - * coded in Python, which in turn can release the GIL and allow other threads - * to run, etc. Such code may even invoke methods of `self` again, or cause - * cyclic gc to trigger, but-- oops! --self->containee still points to the - * object being torn down, and it may be in an insane state while being torn - * down. This has in fact been a rich historic source of miserable (rare & - * hard-to-diagnose) segfaulting (and other) bugs. - * - * The safe way is: - * - * Py_CLEAR(op); - * - * That arranges to set `op` to NULL _before_ decref'ing, so that any code - * triggered as a side-effect of `op` getting torn down no longer believes - * `op` points to a valid object. - * - * There are cases where it's safe to use the naive code, but they're brittle. - * For example, if `op` points to a Python integer, you know that destroying - * one of those can't cause problems -- but in part that relies on that - * Python integers aren't currently weakly referencable. Best practice is - * to use Py_CLEAR() even if you can't think of a reason for why you need to. - */ -#define Py_CLEAR(op) \ - do { \ - if (op) { \ - PyObject *_py_tmp = (PyObject *)(op); \ - (op) = NULL; \ - Py_DECREF(_py_tmp); \ - } \ - } while (0) - -/* Macros to use in case the object pointer may be NULL: */ -#define Py_XINCREF(op) do { if ((op) == NULL) ; else Py_INCREF(op); } while (0) -#define Py_XDECREF(op) do { if ((op) == NULL) ; else Py_DECREF(op); } while (0) - -/* -These are provided as conveniences to Python runtime embedders, so that -they can have object code that is not dependent on Python compilation flags. -*/ -PyAPI_FUNC(void) Py_IncRef(PyObject *); -PyAPI_FUNC(void) Py_DecRef(PyObject *); - -/* -_Py_NoneStruct is an object of undefined type which can be used in contexts -where NULL (nil) is not suitable (since NULL often means 'error'). - -Don't forget to apply Py_INCREF() when returning this value!!! -*/ -PyAPI_DATA(PyObject) _Py_NoneStruct; /* Don't use this directly */ -#define Py_None (&_Py_NoneStruct) - -/* Macro for returning Py_None from a function */ -#define Py_RETURN_NONE return Py_INCREF(Py_None), Py_None - -/* -Py_NotImplemented is a singleton used to signal that an operation is -not implemented for a given type combination. -*/ -PyAPI_DATA(PyObject) _Py_NotImplementedStruct; /* Don't use this directly */ -#define Py_NotImplemented (&_Py_NotImplementedStruct) - -/* Rich comparison opcodes */ -#define Py_LT 0 -#define Py_LE 1 -#define Py_EQ 2 -#define Py_NE 3 -#define Py_GT 4 -#define Py_GE 5 - -/* Maps Py_LT to Py_GT, ..., Py_GE to Py_LE. - * Defined in object.c. - */ -PyAPI_DATA(int) _Py_SwappedOp[]; - -/* -Define staticforward and statichere for source compatibility with old -C extensions. - -The staticforward define was needed to support certain broken C -compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the -static keyword when it was used with a forward declaration of a static -initialized structure. Standard C allows the forward declaration with -static, and we've decided to stop catering to broken C compilers. -(In fact, we expect that the compilers are all fixed eight years later.) -*/ - -#define staticforward static -#define statichere static - - -/* -More conventions -================ - -Argument Checking ------------------ - -Functions that take objects as arguments normally don't check for nil -arguments, but they do check the type of the argument, and return an -error if the function doesn't apply to the type. - -Failure Modes -------------- - -Functions may fail for a variety of reasons, including running out of -memory. This is communicated to the caller in two ways: an error string -is set (see errors.h), and the function result differs: functions that -normally return a pointer return NULL for failure, functions returning -an integer return -1 (which could be a legal return value too!), and -other functions return 0 for success and -1 for failure. -Callers should always check for errors before using the result. If -an error was set, the caller must either explicitly clear it, or pass -the error on to its caller. - -Reference Counts ----------------- - -It takes a while to get used to the proper usage of reference counts. - -Functions that create an object set the reference count to 1; such new -objects must be stored somewhere or destroyed again with Py_DECREF(). -Some functions that 'store' objects, such as PyTuple_SetItem() and -PyList_SetItem(), -don't increment the reference count of the object, since the most -frequent use is to store a fresh object. Functions that 'retrieve' -objects, such as PyTuple_GetItem() and PyDict_GetItemString(), also -don't increment -the reference count, since most frequently the object is only looked at -quickly. Thus, to retrieve an object and store it again, the caller -must call Py_INCREF() explicitly. - -NOTE: functions that 'consume' a reference count, like -PyList_SetItem(), consume the reference even if the object wasn't -successfully stored, to simplify error handling. - -It seems attractive to make other functions that take an object as -argument consume a reference count; however, this may quickly get -confusing (even the current practice is already confusing). Consider -it carefully, it may save lots of calls to Py_INCREF() and Py_DECREF() at -times. -*/ - - -/* Trashcan mechanism, thanks to Christian Tismer. - -When deallocating a container object, it's possible to trigger an unbounded -chain of deallocations, as each Py_DECREF in turn drops the refcount on "the -next" object in the chain to 0. This can easily lead to stack faults, and -especially in threads (which typically have less stack space to work with). - -A container object that participates in cyclic gc can avoid this by -bracketing the body of its tp_dealloc function with a pair of macros: - -static void -mytype_dealloc(mytype *p) -{ - ... declarations go here ... - - PyObject_GC_UnTrack(p); // must untrack first - Py_TRASHCAN_SAFE_BEGIN(p) - ... The body of the deallocator goes here, including all calls ... - ... to Py_DECREF on contained objects. ... - Py_TRASHCAN_SAFE_END(p) -} - -CAUTION: Never return from the middle of the body! If the body needs to -"get out early", put a label immediately before the Py_TRASHCAN_SAFE_END -call, and goto it. Else the call-depth counter (see below) will stay -above 0 forever, and the trashcan will never get emptied. - -How it works: The BEGIN macro increments a call-depth counter. So long -as this counter is small, the body of the deallocator is run directly without -further ado. But if the counter gets large, it instead adds p to a list of -objects to be deallocated later, skips the body of the deallocator, and -resumes execution after the END macro. The tp_dealloc routine then returns -without deallocating anything (and so unbounded call-stack depth is avoided). - -When the call stack finishes unwinding again, code generated by the END macro -notices this, and calls another routine to deallocate all the objects that -may have been added to the list of deferred deallocations. In effect, a -chain of N deallocations is broken into N / PyTrash_UNWIND_LEVEL pieces, -with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL. -*/ - -/* This is the old private API, invoked by the macros before 2.7.4. - Kept for binary compatibility of extensions. */ -PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*); -PyAPI_FUNC(void) _PyTrash_destroy_chain(void); -PyAPI_DATA(int) _PyTrash_delete_nesting; -PyAPI_DATA(PyObject *) _PyTrash_delete_later; - -/* The new thread-safe private API, invoked by the macros below. */ -PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*); -PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void); - -#define PyTrash_UNWIND_LEVEL 50 - -/* Note the workaround for when the thread state is NULL (issue #17703) */ -#define Py_TRASHCAN_SAFE_BEGIN(op) \ - do { \ - PyThreadState *_tstate = PyThreadState_GET(); \ - if (!_tstate || \ - _tstate->trash_delete_nesting < PyTrash_UNWIND_LEVEL) { \ - if (_tstate) \ - ++_tstate->trash_delete_nesting; - /* The body of the deallocator is here. */ -#define Py_TRASHCAN_SAFE_END(op) \ - if (_tstate) { \ - --_tstate->trash_delete_nesting; \ - if (_tstate->trash_delete_later \ - && _tstate->trash_delete_nesting <= 0) \ - _PyTrash_thread_destroy_chain(); \ - } \ - } \ - else \ - _PyTrash_thread_deposit_object((PyObject*)op); \ - } while (0); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_OBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/objimpl.h b/AppPkg/Applications/Python/Python-2.7.10/Include/objimpl.h deleted file mode 100644 index 79d7e2d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/objimpl.h +++ /dev/null @@ -1,354 +0,0 @@ -/* The PyObject_ memory family: high-level object memory interfaces. - See pymem.h for the low-level PyMem_ family. -*/ - -#ifndef Py_OBJIMPL_H -#define Py_OBJIMPL_H - -#include "pymem.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* BEWARE: - - Each interface exports both functions and macros. Extension modules should - use the functions, to ensure binary compatibility across Python versions. - Because the Python implementation is free to change internal details, and - the macros may (or may not) expose details for speed, if you do use the - macros you must recompile your extensions with each Python release. - - Never mix calls to PyObject_ memory functions with calls to the platform - malloc/realloc/ calloc/free, or with calls to PyMem_. -*/ - -/* -Functions and macros for modules that implement new object types. - - - PyObject_New(type, typeobj) allocates memory for a new object of the given - type, and initializes part of it. 'type' must be the C structure type used - to represent the object, and 'typeobj' the address of the corresponding - type object. Reference count and type pointer are filled in; the rest of - the bytes of the object are *undefined*! The resulting expression type is - 'type *'. The size of the object is determined by the tp_basicsize field - of the type object. - - - PyObject_NewVar(type, typeobj, n) is similar but allocates a variable-size - object with room for n items. In addition to the refcount and type pointer - fields, this also fills in the ob_size field. - - - PyObject_Del(op) releases the memory allocated for an object. It does not - run a destructor -- it only frees the memory. PyObject_Free is identical. - - - PyObject_Init(op, typeobj) and PyObject_InitVar(op, typeobj, n) don't - allocate memory. Instead of a 'type' parameter, they take a pointer to a - new object (allocated by an arbitrary allocator), and initialize its object - header fields. - -Note that objects created with PyObject_{New, NewVar} are allocated using the -specialized Python allocator (implemented in obmalloc.c), if WITH_PYMALLOC is -enabled. In addition, a special debugging allocator is used if PYMALLOC_DEBUG -is also #defined. - -In case a specific form of memory management is needed (for example, if you -must use the platform malloc heap(s), or shared memory, or C++ local storage or -operator new), you must first allocate the object with your custom allocator, -then pass its pointer to PyObject_{Init, InitVar} for filling in its Python- -specific fields: reference count, type pointer, possibly others. You should -be aware that Python no control over these objects because they don't -cooperate with the Python memory manager. Such objects may not be eligible -for automatic garbage collection and you have to make sure that they are -released accordingly whenever their destructor gets called (cf. the specific -form of memory management you're using). - -Unless you have specific memory management requirements, use -PyObject_{New, NewVar, Del}. -*/ - -/* - * Raw object memory interface - * =========================== - */ - -/* Functions to call the same malloc/realloc/free as used by Python's - object allocator. If WITH_PYMALLOC is enabled, these may differ from - the platform malloc/realloc/free. The Python object allocator is - designed for fast, cache-conscious allocation of many "small" objects, - and with low hidden memory overhead. - - PyObject_Malloc(0) returns a unique non-NULL pointer if possible. - - PyObject_Realloc(NULL, n) acts like PyObject_Malloc(n). - PyObject_Realloc(p != NULL, 0) does not return NULL, or free the memory - at p. - - Returned pointers must be checked for NULL explicitly; no action is - performed on failure other than to return NULL (no warning it printed, no - exception is set, etc). - - For allocating objects, use PyObject_{New, NewVar} instead whenever - possible. The PyObject_{Malloc, Realloc, Free} family is exposed - so that you can exploit Python's small-block allocator for non-object - uses. If you must use these routines to allocate object memory, make sure - the object gets initialized via PyObject_{Init, InitVar} after obtaining - the raw memory. -*/ -PyAPI_FUNC(void *) PyObject_Malloc(size_t); -PyAPI_FUNC(void *) PyObject_Realloc(void *, size_t); -PyAPI_FUNC(void) PyObject_Free(void *); - - -/* Macros */ -#ifdef WITH_PYMALLOC -#ifdef PYMALLOC_DEBUG /* WITH_PYMALLOC && PYMALLOC_DEBUG */ -PyAPI_FUNC(void *) _PyObject_DebugMalloc(size_t nbytes); -PyAPI_FUNC(void *) _PyObject_DebugRealloc(void *p, size_t nbytes); -PyAPI_FUNC(void) _PyObject_DebugFree(void *p); -PyAPI_FUNC(void) _PyObject_DebugDumpAddress(const void *p); -PyAPI_FUNC(void) _PyObject_DebugCheckAddress(const void *p); -PyAPI_FUNC(void) _PyObject_DebugMallocStats(void); -PyAPI_FUNC(void *) _PyObject_DebugMallocApi(char api, size_t nbytes); -PyAPI_FUNC(void *) _PyObject_DebugReallocApi(char api, void *p, size_t nbytes); -PyAPI_FUNC(void) _PyObject_DebugFreeApi(char api, void *p); -PyAPI_FUNC(void) _PyObject_DebugCheckAddressApi(char api, const void *p); -PyAPI_FUNC(void *) _PyMem_DebugMalloc(size_t nbytes); -PyAPI_FUNC(void *) _PyMem_DebugRealloc(void *p, size_t nbytes); -PyAPI_FUNC(void) _PyMem_DebugFree(void *p); -#define PyObject_MALLOC _PyObject_DebugMalloc -#define PyObject_Malloc _PyObject_DebugMalloc -#define PyObject_REALLOC _PyObject_DebugRealloc -#define PyObject_Realloc _PyObject_DebugRealloc -#define PyObject_FREE _PyObject_DebugFree -#define PyObject_Free _PyObject_DebugFree - -#else /* WITH_PYMALLOC && ! PYMALLOC_DEBUG */ -#define PyObject_MALLOC PyObject_Malloc -#define PyObject_REALLOC PyObject_Realloc -#define PyObject_FREE PyObject_Free -#endif - -#else /* ! WITH_PYMALLOC */ -#define PyObject_MALLOC PyMem_MALLOC -#define PyObject_REALLOC PyMem_REALLOC -#define PyObject_FREE PyMem_FREE - -#endif /* WITH_PYMALLOC */ - -#define PyObject_Del PyObject_Free -#define PyObject_DEL PyObject_FREE - -/* for source compatibility with 2.2 */ -#define _PyObject_Del PyObject_Free - -/* - * Generic object allocator interface - * ================================== - */ - -/* Functions */ -PyAPI_FUNC(PyObject *) PyObject_Init(PyObject *, PyTypeObject *); -PyAPI_FUNC(PyVarObject *) PyObject_InitVar(PyVarObject *, - PyTypeObject *, Py_ssize_t); -PyAPI_FUNC(PyObject *) _PyObject_New(PyTypeObject *); -PyAPI_FUNC(PyVarObject *) _PyObject_NewVar(PyTypeObject *, Py_ssize_t); - -#define PyObject_New(type, typeobj) \ - ( (type *) _PyObject_New(typeobj) ) -#define PyObject_NewVar(type, typeobj, n) \ - ( (type *) _PyObject_NewVar((typeobj), (n)) ) - -/* Macros trading binary compatibility for speed. See also pymem.h. - Note that these macros expect non-NULL object pointers.*/ -#define PyObject_INIT(op, typeobj) \ - ( Py_TYPE(op) = (typeobj), _Py_NewReference((PyObject *)(op)), (op) ) -#define PyObject_INIT_VAR(op, typeobj, size) \ - ( Py_SIZE(op) = (size), PyObject_INIT((op), (typeobj)) ) - -#define _PyObject_SIZE(typeobj) ( (typeobj)->tp_basicsize ) - -/* _PyObject_VAR_SIZE returns the number of bytes (as size_t) allocated for a - vrbl-size object with nitems items, exclusive of gc overhead (if any). The - value is rounded up to the closest multiple of sizeof(void *), in order to - ensure that pointer fields at the end of the object are correctly aligned - for the platform (this is of special importance for subclasses of, e.g., - str or long, so that pointers can be stored after the embedded data). - - Note that there's no memory wastage in doing this, as malloc has to - return (at worst) pointer-aligned memory anyway. -*/ -#if ((SIZEOF_VOID_P - 1) & SIZEOF_VOID_P) != 0 -# error "_PyObject_VAR_SIZE requires SIZEOF_VOID_P be a power of 2" -#endif - -#define _PyObject_VAR_SIZE(typeobj, nitems) \ - (size_t) \ - ( ( (typeobj)->tp_basicsize + \ - (nitems)*(typeobj)->tp_itemsize + \ - (SIZEOF_VOID_P - 1) \ - ) & ~(SIZEOF_VOID_P - 1) \ - ) - -#define PyObject_NEW(type, typeobj) \ -( (type *) PyObject_Init( \ - (PyObject *) PyObject_MALLOC( _PyObject_SIZE(typeobj) ), (typeobj)) ) - -#define PyObject_NEW_VAR(type, typeobj, n) \ -( (type *) PyObject_InitVar( \ - (PyVarObject *) PyObject_MALLOC(_PyObject_VAR_SIZE((typeobj),(n)) ),\ - (typeobj), (n)) ) - -/* This example code implements an object constructor with a custom - allocator, where PyObject_New is inlined, and shows the important - distinction between two steps (at least): - 1) the actual allocation of the object storage; - 2) the initialization of the Python specific fields - in this storage with PyObject_{Init, InitVar}. - - PyObject * - YourObject_New(...) - { - PyObject *op; - - op = (PyObject *) Your_Allocator(_PyObject_SIZE(YourTypeStruct)); - if (op == NULL) - return PyErr_NoMemory(); - - PyObject_Init(op, &YourTypeStruct); - - op->ob_field = value; - ... - return op; - } - - Note that in C++, the use of the new operator usually implies that - the 1st step is performed automatically for you, so in a C++ class - constructor you would start directly with PyObject_Init/InitVar -*/ - -/* - * Garbage Collection Support - * ========================== - */ - -/* C equivalent of gc.collect(). */ -PyAPI_FUNC(Py_ssize_t) PyGC_Collect(void); - -/* Test if a type has a GC head */ -#define PyType_IS_GC(t) PyType_HasFeature((t), Py_TPFLAGS_HAVE_GC) - -/* Test if an object has a GC head */ -#define PyObject_IS_GC(o) (PyType_IS_GC(Py_TYPE(o)) && \ - (Py_TYPE(o)->tp_is_gc == NULL || Py_TYPE(o)->tp_is_gc(o))) - -PyAPI_FUNC(PyVarObject *) _PyObject_GC_Resize(PyVarObject *, Py_ssize_t); -#define PyObject_GC_Resize(type, op, n) \ - ( (type *) _PyObject_GC_Resize((PyVarObject *)(op), (n)) ) - -/* for source compatibility with 2.2 */ -#define _PyObject_GC_Del PyObject_GC_Del - -/* GC information is stored BEFORE the object structure. */ -typedef union _gc_head { - struct { - union _gc_head *gc_next; - union _gc_head *gc_prev; - Py_ssize_t gc_refs; - } gc; - long double dummy; /* force worst-case alignment */ -} PyGC_Head; - -extern PyGC_Head *_PyGC_generation0; - -#define _Py_AS_GC(o) ((PyGC_Head *)(o)-1) - -#define _PyGC_REFS_UNTRACKED (-2) -#define _PyGC_REFS_REACHABLE (-3) -#define _PyGC_REFS_TENTATIVELY_UNREACHABLE (-4) - -/* Tell the GC to track this object. NB: While the object is tracked the - * collector it must be safe to call the ob_traverse method. */ -#define _PyObject_GC_TRACK(o) do { \ - PyGC_Head *g = _Py_AS_GC(o); \ - if (g->gc.gc_refs != _PyGC_REFS_UNTRACKED) \ - Py_FatalError("GC object already tracked"); \ - g->gc.gc_refs = _PyGC_REFS_REACHABLE; \ - g->gc.gc_next = _PyGC_generation0; \ - g->gc.gc_prev = _PyGC_generation0->gc.gc_prev; \ - g->gc.gc_prev->gc.gc_next = g; \ - _PyGC_generation0->gc.gc_prev = g; \ - } while (0); - -/* Tell the GC to stop tracking this object. - * gc_next doesn't need to be set to NULL, but doing so is a good - * way to provoke memory errors if calling code is confused. - */ -#define _PyObject_GC_UNTRACK(o) do { \ - PyGC_Head *g = _Py_AS_GC(o); \ - assert(g->gc.gc_refs != _PyGC_REFS_UNTRACKED); \ - g->gc.gc_refs = _PyGC_REFS_UNTRACKED; \ - g->gc.gc_prev->gc.gc_next = g->gc.gc_next; \ - g->gc.gc_next->gc.gc_prev = g->gc.gc_prev; \ - g->gc.gc_next = NULL; \ - } while (0); - -/* True if the object is currently tracked by the GC. */ -#define _PyObject_GC_IS_TRACKED(o) \ - ((_Py_AS_GC(o))->gc.gc_refs != _PyGC_REFS_UNTRACKED) - -/* True if the object may be tracked by the GC in the future, or already is. - This can be useful to implement some optimizations. */ -#define _PyObject_GC_MAY_BE_TRACKED(obj) \ - (PyObject_IS_GC(obj) && \ - (!PyTuple_CheckExact(obj) || _PyObject_GC_IS_TRACKED(obj))) - - -PyAPI_FUNC(PyObject *) _PyObject_GC_Malloc(size_t); -PyAPI_FUNC(PyObject *) _PyObject_GC_New(PyTypeObject *); -PyAPI_FUNC(PyVarObject *) _PyObject_GC_NewVar(PyTypeObject *, Py_ssize_t); -PyAPI_FUNC(void) PyObject_GC_Track(void *); -PyAPI_FUNC(void) PyObject_GC_UnTrack(void *); -PyAPI_FUNC(void) PyObject_GC_Del(void *); - -#define PyObject_GC_New(type, typeobj) \ - ( (type *) _PyObject_GC_New(typeobj) ) -#define PyObject_GC_NewVar(type, typeobj, n) \ - ( (type *) _PyObject_GC_NewVar((typeobj), (n)) ) - - -/* Utility macro to help write tp_traverse functions. - * To use this macro, the tp_traverse function must name its arguments - * "visit" and "arg". This is intended to keep tp_traverse functions - * looking as much alike as possible. - */ -#define Py_VISIT(op) \ - do { \ - if (op) { \ - int vret = visit((PyObject *)(op), arg); \ - if (vret) \ - return vret; \ - } \ - } while (0) - -/* This is here for the sake of backwards compatibility. Extensions that - * use the old GC API will still compile but the objects will not be - * tracked by the GC. */ -#define PyGC_HEAD_SIZE 0 -#define PyObject_GC_Init(op) -#define PyObject_GC_Fini(op) -#define PyObject_AS_GC(op) (op) -#define PyObject_FROM_GC(op) (op) - - -/* Test if a type supports weak references */ -#define PyType_SUPPORTS_WEAKREFS(t) \ - (PyType_HasFeature((t), Py_TPFLAGS_HAVE_WEAKREFS) \ - && ((t)->tp_weaklistoffset > 0)) - -#define PyObject_GET_WEAKREFS_LISTPTR(o) \ - ((PyObject **) (((char *) (o)) + Py_TYPE(o)->tp_weaklistoffset)) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_OBJIMPL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/opcode.h b/AppPkg/Applications/Python/Python-2.7.10/Include/opcode.h deleted file mode 100644 index fe2a690..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/opcode.h +++ /dev/null @@ -1,162 +0,0 @@ -#ifndef Py_OPCODE_H -#define Py_OPCODE_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Instruction opcodes for compiled code */ - -#define STOP_CODE 0 -#define POP_TOP 1 -#define ROT_TWO 2 -#define ROT_THREE 3 -#define DUP_TOP 4 -#define ROT_FOUR 5 -#define NOP 9 - -#define UNARY_POSITIVE 10 -#define UNARY_NEGATIVE 11 -#define UNARY_NOT 12 -#define UNARY_CONVERT 13 - -#define UNARY_INVERT 15 - -#define BINARY_POWER 19 - -#define BINARY_MULTIPLY 20 -#define BINARY_DIVIDE 21 -#define BINARY_MODULO 22 -#define BINARY_ADD 23 -#define BINARY_SUBTRACT 24 -#define BINARY_SUBSCR 25 -#define BINARY_FLOOR_DIVIDE 26 -#define BINARY_TRUE_DIVIDE 27 -#define INPLACE_FLOOR_DIVIDE 28 -#define INPLACE_TRUE_DIVIDE 29 - -#define SLICE 30 -/* Also uses 31-33 */ - -#define STORE_SLICE 40 -/* Also uses 41-43 */ - -#define DELETE_SLICE 50 -/* Also uses 51-53 */ - -#define STORE_MAP 54 -#define INPLACE_ADD 55 -#define INPLACE_SUBTRACT 56 -#define INPLACE_MULTIPLY 57 -#define INPLACE_DIVIDE 58 -#define INPLACE_MODULO 59 -#define STORE_SUBSCR 60 -#define DELETE_SUBSCR 61 - -#define BINARY_LSHIFT 62 -#define BINARY_RSHIFT 63 -#define BINARY_AND 64 -#define BINARY_XOR 65 -#define BINARY_OR 66 -#define INPLACE_POWER 67 -#define GET_ITER 68 - -#define PRINT_EXPR 70 -#define PRINT_ITEM 71 -#define PRINT_NEWLINE 72 -#define PRINT_ITEM_TO 73 -#define PRINT_NEWLINE_TO 74 -#define INPLACE_LSHIFT 75 -#define INPLACE_RSHIFT 76 -#define INPLACE_AND 77 -#define INPLACE_XOR 78 -#define INPLACE_OR 79 -#define BREAK_LOOP 80 -#define WITH_CLEANUP 81 -#define LOAD_LOCALS 82 -#define RETURN_VALUE 83 -#define IMPORT_STAR 84 -#define EXEC_STMT 85 -#define YIELD_VALUE 86 -#define POP_BLOCK 87 -#define END_FINALLY 88 -#define BUILD_CLASS 89 - -#define HAVE_ARGUMENT 90 /* Opcodes from here have an argument: */ - -#define STORE_NAME 90 /* Index in name list */ -#define DELETE_NAME 91 /* "" */ -#define UNPACK_SEQUENCE 92 /* Number of sequence items */ -#define FOR_ITER 93 -#define LIST_APPEND 94 - -#define STORE_ATTR 95 /* Index in name list */ -#define DELETE_ATTR 96 /* "" */ -#define STORE_GLOBAL 97 /* "" */ -#define DELETE_GLOBAL 98 /* "" */ -#define DUP_TOPX 99 /* number of items to duplicate */ -#define LOAD_CONST 100 /* Index in const list */ -#define LOAD_NAME 101 /* Index in name list */ -#define BUILD_TUPLE 102 /* Number of tuple items */ -#define BUILD_LIST 103 /* Number of list items */ -#define BUILD_SET 104 /* Number of set items */ -#define BUILD_MAP 105 /* Always zero for now */ -#define LOAD_ATTR 106 /* Index in name list */ -#define COMPARE_OP 107 /* Comparison operator */ -#define IMPORT_NAME 108 /* Index in name list */ -#define IMPORT_FROM 109 /* Index in name list */ -#define JUMP_FORWARD 110 /* Number of bytes to skip */ - -#define JUMP_IF_FALSE_OR_POP 111 /* Target byte offset from beginning - of code */ -#define JUMP_IF_TRUE_OR_POP 112 /* "" */ -#define JUMP_ABSOLUTE 113 /* "" */ -#define POP_JUMP_IF_FALSE 114 /* "" */ -#define POP_JUMP_IF_TRUE 115 /* "" */ - -#define LOAD_GLOBAL 116 /* Index in name list */ - -#define CONTINUE_LOOP 119 /* Start of loop (absolute) */ -#define SETUP_LOOP 120 /* Target address (relative) */ -#define SETUP_EXCEPT 121 /* "" */ -#define SETUP_FINALLY 122 /* "" */ - -#define LOAD_FAST 124 /* Local variable number */ -#define STORE_FAST 125 /* Local variable number */ -#define DELETE_FAST 126 /* Local variable number */ - -#define RAISE_VARARGS 130 /* Number of raise arguments (1, 2 or 3) */ -/* CALL_FUNCTION_XXX opcodes defined below depend on this definition */ -#define CALL_FUNCTION 131 /* #args + (#kwargs<<8) */ -#define MAKE_FUNCTION 132 /* #defaults */ -#define BUILD_SLICE 133 /* Number of items */ - -#define MAKE_CLOSURE 134 /* #free vars */ -#define LOAD_CLOSURE 135 /* Load free variable from closure */ -#define LOAD_DEREF 136 /* Load and dereference from closure cell */ -#define STORE_DEREF 137 /* Store into cell */ - -/* The next 3 opcodes must be contiguous and satisfy - (CALL_FUNCTION_VAR - CALL_FUNCTION) & 3 == 1 */ -#define CALL_FUNCTION_VAR 140 /* #args + (#kwargs<<8) */ -#define CALL_FUNCTION_KW 141 /* #args + (#kwargs<<8) */ -#define CALL_FUNCTION_VAR_KW 142 /* #args + (#kwargs<<8) */ - -#define SETUP_WITH 143 - -/* Support for opargs more than 16 bits long */ -#define EXTENDED_ARG 145 - -#define SET_ADD 146 -#define MAP_ADD 147 - - -enum cmp_op {PyCmp_LT=Py_LT, PyCmp_LE=Py_LE, PyCmp_EQ=Py_EQ, PyCmp_NE=Py_NE, PyCmp_GT=Py_GT, PyCmp_GE=Py_GE, - PyCmp_IN, PyCmp_NOT_IN, PyCmp_IS, PyCmp_IS_NOT, PyCmp_EXC_MATCH, PyCmp_BAD}; - -#define HAS_ARG(op) ((op) >= HAVE_ARGUMENT) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_OPCODE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/osdefs.h b/AppPkg/Applications/Python/Python-2.7.10/Include/osdefs.h deleted file mode 100644 index d41ea14..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/osdefs.h +++ /dev/null @@ -1,63 +0,0 @@ -#ifndef Py_OSDEFS_H -#define Py_OSDEFS_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Operating system dependencies */ - -/* Mod by chrish: QNX has WATCOM, but isn't DOS */ -#if !defined(__QNX__) -#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2) -#if defined(PYOS_OS2) && defined(PYCC_GCC) -#define MAXPATHLEN 260 -#define SEP '/' -#define ALTSEP '\\' -#else -#define SEP '\\' -#define ALTSEP '/' -#define MAXPATHLEN 256 -#endif -#define DELIM ';' -#endif -#endif - -#ifdef RISCOS -#define SEP '.' -#define MAXPATHLEN 256 -#define DELIM ',' -#endif - - -/* Filename separator */ -#ifndef SEP -#define SEP '/' -#endif - -/* Max pathname length */ -#ifdef __hpux -#include -#include -#ifndef PATH_MAX -#define PATH_MAX MAXPATHLEN -#endif -#endif - -#ifndef MAXPATHLEN -#if defined(PATH_MAX) && PATH_MAX > 1024 -#define MAXPATHLEN PATH_MAX -#else -#define MAXPATHLEN 1024 -#endif -#endif - -/* Search path entry delimiter */ -#ifndef DELIM -#define DELIM ':' -#endif - -#ifdef __cplusplus -} -#endif -#endif /* !Py_OSDEFS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/parsetok.h b/AppPkg/Applications/Python/Python-2.7.10/Include/parsetok.h deleted file mode 100644 index 915bdba..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/parsetok.h +++ /dev/null @@ -1,64 +0,0 @@ - -/* Parser-tokenizer link interface */ - -#ifndef Py_PARSETOK_H -#define Py_PARSETOK_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - int error; - const char *filename; - int lineno; - int offset; - char *text; - int token; - int expected; -} perrdetail; - -#if 0 -#define PyPARSE_YIELD_IS_KEYWORD 0x0001 -#endif - -#define PyPARSE_DONT_IMPLY_DEDENT 0x0002 - -#if 0 -#define PyPARSE_WITH_IS_KEYWORD 0x0003 -#endif - -#define PyPARSE_PRINT_IS_FUNCTION 0x0004 -#define PyPARSE_UNICODE_LITERALS 0x0008 - - - -PyAPI_FUNC(node *) PyParser_ParseString(const char *, grammar *, int, - perrdetail *); -PyAPI_FUNC(node *) PyParser_ParseFile (FILE *, const char *, grammar *, int, - char *, char *, perrdetail *); - -PyAPI_FUNC(node *) PyParser_ParseStringFlags(const char *, grammar *, int, - perrdetail *, int); -PyAPI_FUNC(node *) PyParser_ParseFileFlags(FILE *, const char *, grammar *, - int, char *, char *, - perrdetail *, int); -PyAPI_FUNC(node *) PyParser_ParseFileFlagsEx(FILE *, const char *, grammar *, - int, char *, char *, - perrdetail *, int *); - -PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilename(const char *, - const char *, - grammar *, int, - perrdetail *, int); -PyAPI_FUNC(node *) PyParser_ParseStringFlagsFilenameEx(const char *, - const char *, - grammar *, int, - perrdetail *, int *); - -/* Note that he following function is defined in pythonrun.c not parsetok.c. */ -PyAPI_FUNC(void) PyParser_SetError(perrdetail *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PARSETOK_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/patchlevel.h b/AppPkg/Applications/Python/Python-2.7.10/Include/patchlevel.h deleted file mode 100644 index 6b17d28..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/patchlevel.h +++ /dev/null @@ -1,43 +0,0 @@ - -/* Newfangled version identification scheme. - - This scheme was added in Python 1.5.2b2; before that time, only PATCHLEVEL - was available. To test for presence of the scheme, test for - defined(PY_MAJOR_VERSION). - - When the major or minor version changes, the VERSION variable in - configure.ac must also be changed. - - There is also (independent) API version information in modsupport.h. -*/ - -/* Values for PY_RELEASE_LEVEL */ -#define PY_RELEASE_LEVEL_ALPHA 0xA -#define PY_RELEASE_LEVEL_BETA 0xB -#define PY_RELEASE_LEVEL_GAMMA 0xC /* For release candidates */ -#define PY_RELEASE_LEVEL_FINAL 0xF /* Serial should be 0 here */ - /* Higher for patch releases */ - -/* Version parsed out into numeric values */ -/*--start constants--*/ -#define PY_MAJOR_VERSION 2 -#define PY_MINOR_VERSION 7 -#define PY_MICRO_VERSION 10 -#define PY_RELEASE_LEVEL PY_RELEASE_LEVEL_FINAL -#define PY_RELEASE_SERIAL 0 - -/* Version as a string */ -#define PY_VERSION "2.7.10" -/*--end constants--*/ - -/* Subversion Revision number of this file (not of the repository). Empty - since Mercurial migration. */ -#define PY_PATCHLEVEL_REVISION "" - -/* Version as a single 4-byte hex number, e.g. 0x010502B2 == 1.5.2b2. - Use this for numeric comparisons, e.g. #if PY_VERSION_HEX >= ... */ -#define PY_VERSION_HEX ((PY_MAJOR_VERSION << 24) | \ - (PY_MINOR_VERSION << 16) | \ - (PY_MICRO_VERSION << 8) | \ - (PY_RELEASE_LEVEL << 4) | \ - (PY_RELEASE_SERIAL << 0)) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pgen.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pgen.h deleted file mode 100644 index af84852..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pgen.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef Py_PGEN_H -#define Py_PGEN_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Parser generator interface */ - -extern grammar *meta_grammar(void); - -struct _node; -extern grammar *pgen(struct _node *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PGEN_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pgenheaders.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pgenheaders.h deleted file mode 100644 index 7aac4e2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pgenheaders.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef Py_PGENHEADERS_H -#define Py_PGENHEADERS_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Include files and extern declarations used by most of the parser. */ - -#include "Python.h" - -PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); - -#define addarc _Py_addarc -#define addbit _Py_addbit -#define adddfa _Py_adddfa -#define addfirstsets _Py_addfirstsets -#define addlabel _Py_addlabel -#define addstate _Py_addstate -#define delbitset _Py_delbitset -#define dumptree _Py_dumptree -#define findlabel _Py_findlabel -#define mergebitset _Py_mergebitset -#define meta_grammar _Py_meta_grammar -#define newbitset _Py_newbitset -#define newgrammar _Py_newgrammar -#define pgen _Py_pgen -#define printgrammar _Py_printgrammar -#define printnonterminals _Py_printnonterminals -#define printtree _Py_printtree -#define samebitset _Py_samebitset -#define showtree _Py_showtree -#define tok_dump _Py_tok_dump -#define translatelabels _Py_translatelabels - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PGENHEADERS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/py_curses.h b/AppPkg/Applications/Python/Python-2.7.10/Include/py_curses.h deleted file mode 100644 index 2120607..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/py_curses.h +++ /dev/null @@ -1,176 +0,0 @@ - -#ifndef Py_CURSES_H -#define Py_CURSES_H - -#ifdef __APPLE__ -/* -** On Mac OS X 10.2 [n]curses.h and stdlib.h use different guards -** against multiple definition of wchar_t. -*/ -#ifdef _BSD_WCHAR_T_DEFINED_ -#define _WCHAR_T -#endif - -/* the following define is necessary for OS X 10.6; without it, the - Apple-supplied ncurses.h sets NCURSES_OPAQUE to 1, and then Python - can't get at the WINDOW flags field. */ -#define NCURSES_OPAQUE 0 -#endif /* __APPLE__ */ - -#ifdef __FreeBSD__ -/* -** On FreeBSD, [n]curses.h and stdlib.h/wchar.h use different guards -** against multiple definition of wchar_t and wint_t. -*/ -#ifdef _XOPEN_SOURCE_EXTENDED -#ifndef __FreeBSD_version -#include -#endif -#if __FreeBSD_version >= 500000 -#ifndef __wchar_t -#define __wchar_t -#endif -#ifndef __wint_t -#define __wint_t -#endif -#else -#ifndef _WCHAR_T -#define _WCHAR_T -#endif -#ifndef _WINT_T -#define _WINT_T -#endif -#endif -#endif -#endif - -#ifdef HAVE_NCURSES_H -#include -#else -#include -#ifdef HAVE_TERM_H -/* for tigetstr, which is not declared in SysV curses */ -#include -#endif -#endif - -#ifdef HAVE_NCURSES_H -/* configure was checking , but we will - use , which has all these features. */ -#ifndef WINDOW_HAS_FLAGS -#define WINDOW_HAS_FLAGS 1 -#endif -#ifndef MVWDELCH_IS_EXPRESSION -#define MVWDELCH_IS_EXPRESSION 1 -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define PyCurses_API_pointers 4 - -/* Type declarations */ - -typedef struct { - PyObject_HEAD - WINDOW *win; -} PyCursesWindowObject; - -#define PyCursesWindow_Check(v) (Py_TYPE(v) == &PyCursesWindow_Type) - -#define PyCurses_CAPSULE_NAME "_curses._C_API" - - -#ifdef CURSES_MODULE -/* This section is used when compiling _cursesmodule.c */ - -#else -/* This section is used in modules that use the _cursesmodule API */ - -static void **PyCurses_API; - -#define PyCursesWindow_Type (*(PyTypeObject *) PyCurses_API[0]) -#define PyCursesSetupTermCalled {if (! ((int (*)(void))PyCurses_API[1]) () ) return NULL;} -#define PyCursesInitialised {if (! ((int (*)(void))PyCurses_API[2]) () ) return NULL;} -#define PyCursesInitialisedColor {if (! ((int (*)(void))PyCurses_API[3]) () ) return NULL;} - -#define import_curses() \ - PyCurses_API = (void **)PyCapsule_Import(PyCurses_CAPSULE_NAME, 1); - -#endif - -/* general error messages */ -static char *catchall_ERR = "curses function returned ERR"; -static char *catchall_NULL = "curses function returned NULL"; - -/* Function Prototype Macros - They are ugly but very, very useful. ;-) - - X - function name - TYPE - parameter Type - ERGSTR - format string for construction of the return value - PARSESTR - format string for argument parsing - */ - -#define NoArgNoReturnFunction(X) \ -static PyObject *PyCurses_ ## X (PyObject *self) \ -{ \ - PyCursesInitialised \ - return PyCursesCheckERR(X(), # X); } - -#define NoArgOrFlagNoReturnFunction(X) \ -static PyObject *PyCurses_ ## X (PyObject *self, PyObject *args) \ -{ \ - int flag = 0; \ - PyCursesInitialised \ - switch(PyTuple_Size(args)) { \ - case 0: \ - return PyCursesCheckERR(X(), # X); \ - case 1: \ - if (!PyArg_ParseTuple(args, "i;True(1) or False(0)", &flag)) return NULL; \ - if (flag) return PyCursesCheckERR(X(), # X); \ - else return PyCursesCheckERR(no ## X (), # X); \ - default: \ - PyErr_SetString(PyExc_TypeError, # X " requires 0 or 1 arguments"); \ - return NULL; } } - -#define NoArgReturnIntFunction(X) \ -static PyObject *PyCurses_ ## X (PyObject *self) \ -{ \ - PyCursesInitialised \ - return PyInt_FromLong((long) X()); } - - -#define NoArgReturnStringFunction(X) \ -static PyObject *PyCurses_ ## X (PyObject *self) \ -{ \ - PyCursesInitialised \ - return PyString_FromString(X()); } - -#define NoArgTrueFalseFunction(X) \ -static PyObject *PyCurses_ ## X (PyObject *self) \ -{ \ - PyCursesInitialised \ - if (X () == FALSE) { \ - Py_INCREF(Py_False); \ - return Py_False; \ - } \ - Py_INCREF(Py_True); \ - return Py_True; } - -#define NoArgNoReturnVoidFunction(X) \ -static PyObject *PyCurses_ ## X (PyObject *self) \ -{ \ - PyCursesInitialised \ - X(); \ - Py_INCREF(Py_None); \ - return Py_None; } - -#ifdef __cplusplus -} -#endif - -#endif /* !defined(Py_CURSES_H) */ - - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pyarena.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pyarena.h deleted file mode 100644 index fec1afa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pyarena.h +++ /dev/null @@ -1,62 +0,0 @@ -/* An arena-like memory interface for the compiler. - */ - -#ifndef Py_PYARENA_H -#define Py_PYARENA_H - -#ifdef __cplusplus -extern "C" { -#endif - - typedef struct _arena PyArena; - - /* PyArena_New() and PyArena_Free() create a new arena and free it, - respectively. Once an arena has been created, it can be used - to allocate memory via PyArena_Malloc(). Pointers to PyObject can - also be registered with the arena via PyArena_AddPyObject(), and the - arena will ensure that the PyObjects stay alive at least until - PyArena_Free() is called. When an arena is freed, all the memory it - allocated is freed, the arena releases internal references to registered - PyObject*, and none of its pointers are valid. - XXX (tim) What does "none of its pointers are valid" mean? Does it - XXX mean that pointers previously obtained via PyArena_Malloc() are - XXX no longer valid? (That's clearly true, but not sure that's what - XXX the text is trying to say.) - - PyArena_New() returns an arena pointer. On error, it - returns a negative number and sets an exception. - XXX (tim): Not true. On error, PyArena_New() actually returns NULL, - XXX and looks like it may or may not set an exception (e.g., if the - XXX internal PyList_New(0) returns NULL, PyArena_New() passes that on - XXX and an exception is set; OTOH, if the internal - XXX block_new(DEFAULT_BLOCK_SIZE) returns NULL, that's passed on but - XXX an exception is not set in that case). - */ - PyAPI_FUNC(PyArena *) PyArena_New(void); - PyAPI_FUNC(void) PyArena_Free(PyArena *); - - /* Mostly like malloc(), return the address of a block of memory spanning - * `size` bytes, or return NULL (without setting an exception) if enough - * new memory can't be obtained. Unlike malloc(0), PyArena_Malloc() with - * size=0 does not guarantee to return a unique pointer (the pointer - * returned may equal one or more other pointers obtained from - * PyArena_Malloc()). - * Note that pointers obtained via PyArena_Malloc() must never be passed to - * the system free() or realloc(), or to any of Python's similar memory- - * management functions. PyArena_Malloc()-obtained pointers remain valid - * until PyArena_Free(ar) is called, at which point all pointers obtained - * from the arena `ar` become invalid simultaneously. - */ - PyAPI_FUNC(void *) PyArena_Malloc(PyArena *, size_t size); - - /* This routine isn't a proper arena allocation routine. It takes - * a PyObject* and records it so that it can be DECREFed when the - * arena is freed. - */ - PyAPI_FUNC(int) PyArena_AddPyObject(PyArena *, PyObject *); - -#ifdef __cplusplus -} -#endif - -#endif /* !Py_PYARENA_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pycapsule.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pycapsule.h deleted file mode 100644 index d414435..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pycapsule.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* Capsule objects let you wrap a C "void *" pointer in a Python - object. They're a way of passing data through the Python interpreter - without creating your own custom type. - - Capsules are used for communication between extension modules. - They provide a way for an extension module to export a C interface - to other extension modules, so that extension modules can use the - Python import mechanism to link to one another. - - For more information, please see "c-api/capsule.html" in the - documentation. -*/ - -#ifndef Py_CAPSULE_H -#define Py_CAPSULE_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(PyTypeObject) PyCapsule_Type; - -typedef void (*PyCapsule_Destructor)(PyObject *); - -#define PyCapsule_CheckExact(op) (Py_TYPE(op) == &PyCapsule_Type) - - -PyAPI_FUNC(PyObject *) PyCapsule_New( - void *pointer, - const char *name, - PyCapsule_Destructor destructor); - -PyAPI_FUNC(void *) PyCapsule_GetPointer(PyObject *capsule, const char *name); - -PyAPI_FUNC(PyCapsule_Destructor) PyCapsule_GetDestructor(PyObject *capsule); - -PyAPI_FUNC(const char *) PyCapsule_GetName(PyObject *capsule); - -PyAPI_FUNC(void *) PyCapsule_GetContext(PyObject *capsule); - -PyAPI_FUNC(int) PyCapsule_IsValid(PyObject *capsule, const char *name); - -PyAPI_FUNC(int) PyCapsule_SetPointer(PyObject *capsule, void *pointer); - -PyAPI_FUNC(int) PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor); - -PyAPI_FUNC(int) PyCapsule_SetName(PyObject *capsule, const char *name); - -PyAPI_FUNC(int) PyCapsule_SetContext(PyObject *capsule, void *context); - -PyAPI_FUNC(void *) PyCapsule_Import(const char *name, int no_block); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_CAPSULE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pyctype.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pyctype.h deleted file mode 100644 index e28542a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pyctype.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef PYCTYPE_H -#define PYCTYPE_H - -#define PY_CTF_LOWER 0x01 -#define PY_CTF_UPPER 0x02 -#define PY_CTF_ALPHA (PY_CTF_LOWER|PY_CTF_UPPER) -#define PY_CTF_DIGIT 0x04 -#define PY_CTF_ALNUM (PY_CTF_ALPHA|PY_CTF_DIGIT) -#define PY_CTF_SPACE 0x08 -#define PY_CTF_XDIGIT 0x10 - -PyAPI_DATA(const unsigned int) _Py_ctype_table[256]; - -/* Unlike their C counterparts, the following macros are not meant to - * handle an int with any of the values [EOF, 0-UCHAR_MAX]. The argument - * must be a signed/unsigned char. */ -#define Py_ISLOWER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_LOWER) -#define Py_ISUPPER(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_UPPER) -#define Py_ISALPHA(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALPHA) -#define Py_ISDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_DIGIT) -#define Py_ISXDIGIT(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_XDIGIT) -#define Py_ISALNUM(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_ALNUM) -#define Py_ISSPACE(c) (_Py_ctype_table[Py_CHARMASK(c)] & PY_CTF_SPACE) - -PyAPI_DATA(const unsigned char) _Py_ctype_tolower[256]; -PyAPI_DATA(const unsigned char) _Py_ctype_toupper[256]; - -#define Py_TOLOWER(c) (_Py_ctype_tolower[Py_CHARMASK(c)]) -#define Py_TOUPPER(c) (_Py_ctype_toupper[Py_CHARMASK(c)]) - -#endif /* !PYCTYPE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pydebug.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pydebug.h deleted file mode 100644 index 9f719e1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pydebug.h +++ /dev/null @@ -1,41 +0,0 @@ - -#ifndef Py_PYDEBUG_H -#define Py_PYDEBUG_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(int) Py_DebugFlag; -PyAPI_DATA(int) Py_VerboseFlag; -PyAPI_DATA(int) Py_InteractiveFlag; -PyAPI_DATA(int) Py_InspectFlag; -PyAPI_DATA(int) Py_OptimizeFlag; -PyAPI_DATA(int) Py_NoSiteFlag; -PyAPI_DATA(int) Py_BytesWarningFlag; -PyAPI_DATA(int) Py_UseClassExceptionsFlag; -PyAPI_DATA(int) Py_FrozenFlag; -PyAPI_DATA(int) Py_TabcheckFlag; -PyAPI_DATA(int) Py_UnicodeFlag; -PyAPI_DATA(int) Py_IgnoreEnvironmentFlag; -PyAPI_DATA(int) Py_DivisionWarningFlag; -PyAPI_DATA(int) Py_DontWriteBytecodeFlag; -PyAPI_DATA(int) Py_NoUserSiteDirectory; -/* _XXX Py_QnewFlag should go away in 3.0. It's true iff -Qnew is passed, - on the command line, and is used in 2.2 by ceval.c to make all "/" divisions - true divisions (which they will be in 3.0). */ -PyAPI_DATA(int) _Py_QnewFlag; -/* Warn about 3.x issues */ -PyAPI_DATA(int) Py_Py3kWarningFlag; -PyAPI_DATA(int) Py_HashRandomizationFlag; - -/* this is a wrapper around getenv() that pays attention to - Py_IgnoreEnvironmentFlag. It should be used for getting variables like - PYTHONPATH and PYTHONHOME from the environment */ -#define Py_GETENV(s) (Py_IgnoreEnvironmentFlag ? NULL : getenv(s)) - -PyAPI_FUNC(void) Py_FatalError(const char *message); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PYDEBUG_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pyerrors.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pyerrors.h deleted file mode 100644 index a703345..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pyerrors.h +++ /dev/null @@ -1,329 +0,0 @@ -#ifndef Py_ERRORS_H -#define Py_ERRORS_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Error objects */ - -typedef struct { - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; -} PyBaseExceptionObject; - -typedef struct { - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; - PyObject *msg; - PyObject *filename; - PyObject *lineno; - PyObject *offset; - PyObject *text; - PyObject *print_file_and_line; -} PySyntaxErrorObject; - -#ifdef Py_USING_UNICODE -typedef struct { - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; - PyObject *encoding; - PyObject *object; - Py_ssize_t start; - Py_ssize_t end; - PyObject *reason; -} PyUnicodeErrorObject; -#endif - -typedef struct { - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; - PyObject *code; -} PySystemExitObject; - -typedef struct { - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; - PyObject *myerrno; - PyObject *strerror; - PyObject *filename; -} PyEnvironmentErrorObject; - -#ifdef MS_WINDOWS -typedef struct { - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; - PyObject *myerrno; - PyObject *strerror; - PyObject *filename; - PyObject *winerror; -} PyWindowsErrorObject; -#endif - -/* Error handling definitions */ - -PyAPI_FUNC(void) PyErr_SetNone(PyObject *); -PyAPI_FUNC(void) PyErr_SetObject(PyObject *, PyObject *); -PyAPI_FUNC(void) PyErr_SetString(PyObject *, const char *); -PyAPI_FUNC(PyObject *) PyErr_Occurred(void); -PyAPI_FUNC(void) PyErr_Clear(void); -PyAPI_FUNC(void) PyErr_Fetch(PyObject **, PyObject **, PyObject **); -PyAPI_FUNC(void) PyErr_Restore(PyObject *, PyObject *, PyObject *); - -#ifdef Py_DEBUG -#define _PyErr_OCCURRED() PyErr_Occurred() -#else -#define _PyErr_OCCURRED() (_PyThreadState_Current->curexc_type) -#endif - -/* Error testing and normalization */ -PyAPI_FUNC(int) PyErr_GivenExceptionMatches(PyObject *, PyObject *); -PyAPI_FUNC(int) PyErr_ExceptionMatches(PyObject *); -PyAPI_FUNC(void) PyErr_NormalizeException(PyObject**, PyObject**, PyObject**); -PyAPI_FUNC(void) _PyErr_ReplaceException(PyObject *, PyObject *, PyObject *); - -/* */ - -#define PyExceptionClass_Check(x) \ - (PyClass_Check((x)) || (PyType_Check((x)) && \ - PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS))) - -#define PyExceptionInstance_Check(x) \ - (PyInstance_Check((x)) || \ - PyType_FastSubclass((x)->ob_type, Py_TPFLAGS_BASE_EXC_SUBCLASS)) - -#define PyExceptionClass_Name(x) \ - (PyClass_Check((x)) \ - ? PyString_AS_STRING(((PyClassObject*)(x))->cl_name) \ - : (char *)(((PyTypeObject*)(x))->tp_name)) - -#define PyExceptionInstance_Class(x) \ - ((PyInstance_Check((x)) \ - ? (PyObject*)((PyInstanceObject*)(x))->in_class \ - : (PyObject*)((x)->ob_type))) - - -/* Predefined exceptions */ - -PyAPI_DATA(PyObject *) PyExc_BaseException; -PyAPI_DATA(PyObject *) PyExc_Exception; -PyAPI_DATA(PyObject *) PyExc_StopIteration; -PyAPI_DATA(PyObject *) PyExc_GeneratorExit; -PyAPI_DATA(PyObject *) PyExc_StandardError; -PyAPI_DATA(PyObject *) PyExc_ArithmeticError; -PyAPI_DATA(PyObject *) PyExc_LookupError; - -PyAPI_DATA(PyObject *) PyExc_AssertionError; -PyAPI_DATA(PyObject *) PyExc_AttributeError; -PyAPI_DATA(PyObject *) PyExc_EOFError; -PyAPI_DATA(PyObject *) PyExc_FloatingPointError; -PyAPI_DATA(PyObject *) PyExc_EnvironmentError; -PyAPI_DATA(PyObject *) PyExc_IOError; -PyAPI_DATA(PyObject *) PyExc_OSError; -PyAPI_DATA(PyObject *) PyExc_ImportError; -PyAPI_DATA(PyObject *) PyExc_IndexError; -PyAPI_DATA(PyObject *) PyExc_KeyError; -PyAPI_DATA(PyObject *) PyExc_KeyboardInterrupt; -PyAPI_DATA(PyObject *) PyExc_MemoryError; -PyAPI_DATA(PyObject *) PyExc_NameError; -PyAPI_DATA(PyObject *) PyExc_OverflowError; -PyAPI_DATA(PyObject *) PyExc_RuntimeError; -PyAPI_DATA(PyObject *) PyExc_NotImplementedError; -PyAPI_DATA(PyObject *) PyExc_SyntaxError; -PyAPI_DATA(PyObject *) PyExc_IndentationError; -PyAPI_DATA(PyObject *) PyExc_TabError; -PyAPI_DATA(PyObject *) PyExc_ReferenceError; -PyAPI_DATA(PyObject *) PyExc_SystemError; -PyAPI_DATA(PyObject *) PyExc_SystemExit; -PyAPI_DATA(PyObject *) PyExc_TypeError; -PyAPI_DATA(PyObject *) PyExc_UnboundLocalError; -PyAPI_DATA(PyObject *) PyExc_UnicodeError; -PyAPI_DATA(PyObject *) PyExc_UnicodeEncodeError; -PyAPI_DATA(PyObject *) PyExc_UnicodeDecodeError; -PyAPI_DATA(PyObject *) PyExc_UnicodeTranslateError; -PyAPI_DATA(PyObject *) PyExc_ValueError; -PyAPI_DATA(PyObject *) PyExc_ZeroDivisionError; -#ifdef MS_WINDOWS -PyAPI_DATA(PyObject *) PyExc_WindowsError; -#endif -#ifdef __VMS -PyAPI_DATA(PyObject *) PyExc_VMSError; -#endif - -PyAPI_DATA(PyObject *) PyExc_BufferError; - -PyAPI_DATA(PyObject *) PyExc_MemoryErrorInst; -PyAPI_DATA(PyObject *) PyExc_RecursionErrorInst; - -/* Predefined warning categories */ -PyAPI_DATA(PyObject *) PyExc_Warning; -PyAPI_DATA(PyObject *) PyExc_UserWarning; -PyAPI_DATA(PyObject *) PyExc_DeprecationWarning; -PyAPI_DATA(PyObject *) PyExc_PendingDeprecationWarning; -PyAPI_DATA(PyObject *) PyExc_SyntaxWarning; -PyAPI_DATA(PyObject *) PyExc_RuntimeWarning; -PyAPI_DATA(PyObject *) PyExc_FutureWarning; -PyAPI_DATA(PyObject *) PyExc_ImportWarning; -PyAPI_DATA(PyObject *) PyExc_UnicodeWarning; -PyAPI_DATA(PyObject *) PyExc_BytesWarning; - - -/* Convenience functions */ - -PyAPI_FUNC(int) PyErr_BadArgument(void); -PyAPI_FUNC(PyObject *) PyErr_NoMemory(void); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrno(PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilenameObject( - PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithFilename( - PyObject *, const char *); -#ifdef MS_WINDOWS -PyAPI_FUNC(PyObject *) PyErr_SetFromErrnoWithUnicodeFilename( - PyObject *, const Py_UNICODE *); -#endif /* MS_WINDOWS */ - -PyAPI_FUNC(PyObject *) PyErr_Format(PyObject *, const char *, ...) - Py_GCC_ATTRIBUTE((format(printf, 2, 3))); - -#ifdef MS_WINDOWS -PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilenameObject( - int, const char *); -PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithFilename( - int, const char *); -PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErrWithUnicodeFilename( - int, const Py_UNICODE *); -PyAPI_FUNC(PyObject *) PyErr_SetFromWindowsErr(int); -PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilenameObject( - PyObject *,int, PyObject *); -PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithFilename( - PyObject *,int, const char *); -PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErrWithUnicodeFilename( - PyObject *,int, const Py_UNICODE *); -PyAPI_FUNC(PyObject *) PyErr_SetExcFromWindowsErr(PyObject *, int); -#endif /* MS_WINDOWS */ - -/* Export the old function so that the existing API remains available: */ -PyAPI_FUNC(void) PyErr_BadInternalCall(void); -PyAPI_FUNC(void) _PyErr_BadInternalCall(char *filename, int lineno); -/* Mask the old API with a call to the new API for code compiled under - Python 2.0: */ -#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) - -/* Function to create a new exception */ -PyAPI_FUNC(PyObject *) PyErr_NewException( - char *name, PyObject *base, PyObject *dict); -PyAPI_FUNC(PyObject *) PyErr_NewExceptionWithDoc( - char *name, char *doc, PyObject *base, PyObject *dict); -PyAPI_FUNC(void) PyErr_WriteUnraisable(PyObject *); - -/* In sigcheck.c or signalmodule.c */ -PyAPI_FUNC(int) PyErr_CheckSignals(void); -PyAPI_FUNC(void) PyErr_SetInterrupt(void); - -/* In signalmodule.c */ -int PySignal_SetWakeupFd(int fd); - -/* Support for adding program text to SyntaxErrors */ -PyAPI_FUNC(void) PyErr_SyntaxLocation(const char *, int); -PyAPI_FUNC(PyObject *) PyErr_ProgramText(const char *, int); - -#ifdef Py_USING_UNICODE -/* The following functions are used to create and modify unicode - exceptions from C */ - -/* create a UnicodeDecodeError object */ -PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_Create( - const char *, const char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); - -/* create a UnicodeEncodeError object */ -PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_Create( - const char *, const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); - -/* create a UnicodeTranslateError object */ -PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_Create( - const Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, const char *); - -/* get the encoding attribute */ -PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetEncoding(PyObject *); -PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetEncoding(PyObject *); - -/* get the object attribute */ -PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetObject(PyObject *); -PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetObject(PyObject *); -PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetObject(PyObject *); - -/* get the value of the start attribute (the int * may not be NULL) - return 0 on success, -1 on failure */ -PyAPI_FUNC(int) PyUnicodeEncodeError_GetStart(PyObject *, Py_ssize_t *); -PyAPI_FUNC(int) PyUnicodeDecodeError_GetStart(PyObject *, Py_ssize_t *); -PyAPI_FUNC(int) PyUnicodeTranslateError_GetStart(PyObject *, Py_ssize_t *); - -/* assign a new value to the start attribute - return 0 on success, -1 on failure */ -PyAPI_FUNC(int) PyUnicodeEncodeError_SetStart(PyObject *, Py_ssize_t); -PyAPI_FUNC(int) PyUnicodeDecodeError_SetStart(PyObject *, Py_ssize_t); -PyAPI_FUNC(int) PyUnicodeTranslateError_SetStart(PyObject *, Py_ssize_t); - -/* get the value of the end attribute (the int *may not be NULL) - return 0 on success, -1 on failure */ -PyAPI_FUNC(int) PyUnicodeEncodeError_GetEnd(PyObject *, Py_ssize_t *); -PyAPI_FUNC(int) PyUnicodeDecodeError_GetEnd(PyObject *, Py_ssize_t *); -PyAPI_FUNC(int) PyUnicodeTranslateError_GetEnd(PyObject *, Py_ssize_t *); - -/* assign a new value to the end attribute - return 0 on success, -1 on failure */ -PyAPI_FUNC(int) PyUnicodeEncodeError_SetEnd(PyObject *, Py_ssize_t); -PyAPI_FUNC(int) PyUnicodeDecodeError_SetEnd(PyObject *, Py_ssize_t); -PyAPI_FUNC(int) PyUnicodeTranslateError_SetEnd(PyObject *, Py_ssize_t); - -/* get the value of the reason attribute */ -PyAPI_FUNC(PyObject *) PyUnicodeEncodeError_GetReason(PyObject *); -PyAPI_FUNC(PyObject *) PyUnicodeDecodeError_GetReason(PyObject *); -PyAPI_FUNC(PyObject *) PyUnicodeTranslateError_GetReason(PyObject *); - -/* assign a new value to the reason attribute - return 0 on success, -1 on failure */ -PyAPI_FUNC(int) PyUnicodeEncodeError_SetReason( - PyObject *, const char *); -PyAPI_FUNC(int) PyUnicodeDecodeError_SetReason( - PyObject *, const char *); -PyAPI_FUNC(int) PyUnicodeTranslateError_SetReason( - PyObject *, const char *); -#endif - - -/* These APIs aren't really part of the error implementation, but - often needed to format error messages; the native C lib APIs are - not available on all platforms, which is why we provide emulations - for those platforms in Python/mysnprintf.c, - WARNING: The return value of snprintf varies across platforms; do - not rely on any particular behavior; eventually the C99 defn may - be reliable. -*/ -#if defined(MS_WIN32) && !defined(HAVE_SNPRINTF) -# define HAVE_SNPRINTF -# define snprintf _snprintf -# define vsnprintf _vsnprintf -#endif - -#include -PyAPI_FUNC(int) PyOS_snprintf(char *str, size_t size, const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 3, 4))); -PyAPI_FUNC(int) PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) - Py_GCC_ATTRIBUTE((format(printf, 3, 0))); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_ERRORS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pyexpat.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pyexpat.h deleted file mode 100644 index fdce988..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pyexpat.h +++ /dev/null @@ -1,48 +0,0 @@ -/* Stuff to export relevant 'expat' entry points from pyexpat to other - * parser modules, such as cElementTree. */ - -/* note: you must import expat.h before importing this module! */ - -#define PyExpat_CAPI_MAGIC "pyexpat.expat_CAPI 1.0" -#define PyExpat_CAPSULE_NAME "pyexpat.expat_CAPI" - -struct PyExpat_CAPI -{ - char* magic; /* set to PyExpat_CAPI_MAGIC */ - int size; /* set to sizeof(struct PyExpat_CAPI) */ - int MAJOR_VERSION; - int MINOR_VERSION; - int MICRO_VERSION; - /* pointers to selected expat functions. add new functions at - the end, if needed */ - const XML_LChar * (*ErrorString)(enum XML_Error code); - enum XML_Error (*GetErrorCode)(XML_Parser parser); - XML_Size (*GetErrorColumnNumber)(XML_Parser parser); - XML_Size (*GetErrorLineNumber)(XML_Parser parser); - enum XML_Status (*Parse)( - XML_Parser parser, const char *s, int len, int isFinal); - XML_Parser (*ParserCreate_MM)( - const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - void (*ParserFree)(XML_Parser parser); - void (*SetCharacterDataHandler)( - XML_Parser parser, XML_CharacterDataHandler handler); - void (*SetCommentHandler)( - XML_Parser parser, XML_CommentHandler handler); - void (*SetDefaultHandlerExpand)( - XML_Parser parser, XML_DefaultHandler handler); - void (*SetElementHandler)( - XML_Parser parser, XML_StartElementHandler start, - XML_EndElementHandler end); - void (*SetNamespaceDeclHandler)( - XML_Parser parser, XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - void (*SetProcessingInstructionHandler)( - XML_Parser parser, XML_ProcessingInstructionHandler handler); - void (*SetUnknownEncodingHandler)( - XML_Parser parser, XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - void (*SetUserData)(XML_Parser parser, void *userData); - /* always add new stuff to the end! */ -}; - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pyfpe.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pyfpe.h deleted file mode 100644 index 6671616..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pyfpe.h +++ /dev/null @@ -1,176 +0,0 @@ -#ifndef Py_PYFPE_H -#define Py_PYFPE_H -#ifdef __cplusplus -extern "C" { -#endif -/* - --------------------------------------------------------------------- - / Copyright (c) 1996. \ - | The Regents of the University of California. | - | All rights reserved. | - | | - | Permission to use, copy, modify, and distribute this software for | - | any purpose without fee is hereby granted, provided that this en- | - | tire notice is included in all copies of any software which is or | - | includes a copy or modification of this software and in all | - | copies of the supporting documentation for such software. | - | | - | This work was produced at the University of California, Lawrence | - | Livermore National Laboratory under contract no. W-7405-ENG-48 | - | between the U.S. Department of Energy and The Regents of the | - | University of California for the operation of UC LLNL. | - | | - | DISCLAIMER | - | | - | This software was prepared as an account of work sponsored by an | - | agency of the United States Government. Neither the United States | - | Government nor the University of California nor any of their em- | - | ployees, makes any warranty, express or implied, or assumes any | - | liability or responsibility for the accuracy, completeness, or | - | usefulness of any information, apparatus, product, or process | - | disclosed, or represents that its use would not infringe | - | privately-owned rights. Reference herein to any specific commer- | - | cial products, process, or service by trade name, trademark, | - | manufacturer, or otherwise, does not necessarily constitute or | - | imply its endorsement, recommendation, or favoring by the United | - | States Government or the University of California. The views and | - | opinions of authors expressed herein do not necessarily state or | - | reflect those of the United States Government or the University | - | of California, and shall not be used for advertising or product | - \ endorsement purposes. / - --------------------------------------------------------------------- -*/ - -/* - * Define macros for handling SIGFPE. - * Lee Busby, LLNL, November, 1996 - * busby1@llnl.gov - * - ********************************************* - * Overview of the system for handling SIGFPE: - * - * This file (Include/pyfpe.h) defines a couple of "wrapper" macros for - * insertion into your Python C code of choice. Their proper use is - * discussed below. The file Python/pyfpe.c defines a pair of global - * variables PyFPE_jbuf and PyFPE_counter which are used by the signal - * handler for SIGFPE to decide if a particular exception was protected - * by the macros. The signal handler itself, and code for enabling the - * generation of SIGFPE in the first place, is in a (new) Python module - * named fpectl. This module is standard in every respect. It can be loaded - * either statically or dynamically as you choose, and like any other - * Python module, has no effect until you import it. - * - * In the general case, there are three steps toward handling SIGFPE in any - * Python code: - * - * 1) Add the *_PROTECT macros to your C code as required to protect - * dangerous floating point sections. - * - * 2) Turn on the inclusion of the code by adding the ``--with-fpectl'' - * flag at the time you run configure. If the fpectl or other modules - * which use the *_PROTECT macros are to be dynamically loaded, be - * sure they are compiled with WANT_SIGFPE_HANDLER defined. - * - * 3) When python is built and running, import fpectl, and execute - * fpectl.turnon_sigfpe(). This sets up the signal handler and enables - * generation of SIGFPE whenever an exception occurs. From this point - * on, any properly trapped SIGFPE should result in the Python - * FloatingPointError exception. - * - * Step 1 has been done already for the Python kernel code, and should be - * done soon for the NumPy array package. Step 2 is usually done once at - * python install time. Python's behavior with respect to SIGFPE is not - * changed unless you also do step 3. Thus you can control this new - * facility at compile time, or run time, or both. - * - ******************************** - * Using the macros in your code: - * - * static PyObject *foobar(PyObject *self,PyObject *args) - * { - * .... - * PyFPE_START_PROTECT("Error in foobar", return 0) - * result = dangerous_op(somearg1, somearg2, ...); - * PyFPE_END_PROTECT(result) - * .... - * } - * - * If a floating point error occurs in dangerous_op, foobar returns 0 (NULL), - * after setting the associated value of the FloatingPointError exception to - * "Error in foobar". ``Dangerous_op'' can be a single operation, or a block - * of code, function calls, or any combination, so long as no alternate - * return is possible before the PyFPE_END_PROTECT macro is reached. - * - * The macros can only be used in a function context where an error return - * can be recognized as signaling a Python exception. (Generally, most - * functions that return a PyObject * will qualify.) - * - * Guido's original design suggestion for PyFPE_START_PROTECT and - * PyFPE_END_PROTECT had them open and close a local block, with a locally - * defined jmp_buf and jmp_buf pointer. This would allow recursive nesting - * of the macros. The Ansi C standard makes it clear that such local - * variables need to be declared with the "volatile" type qualifier to keep - * setjmp from corrupting their values. Some current implementations seem - * to be more restrictive. For example, the HPUX man page for setjmp says - * - * Upon the return from a setjmp() call caused by a longjmp(), the - * values of any non-static local variables belonging to the routine - * from which setjmp() was called are undefined. Code which depends on - * such values is not guaranteed to be portable. - * - * I therefore decided on a more limited form of nesting, using a counter - * variable (PyFPE_counter) to keep track of any recursion. If an exception - * occurs in an ``inner'' pair of macros, the return will apparently - * come from the outermost level. - * - */ - -#ifdef WANT_SIGFPE_HANDLER -#include -#include -#include -extern jmp_buf PyFPE_jbuf; -extern int PyFPE_counter; -extern double PyFPE_dummy(void *); - -#define PyFPE_START_PROTECT(err_string, leave_stmt) \ -if (!PyFPE_counter++ && setjmp(PyFPE_jbuf)) { \ - PyErr_SetString(PyExc_FloatingPointError, err_string); \ - PyFPE_counter = 0; \ - leave_stmt; \ -} - -/* - * This (following) is a heck of a way to decrement a counter. However, - * unless the macro argument is provided, code optimizers will sometimes move - * this statement so that it gets executed *before* the unsafe expression - * which we're trying to protect. That pretty well messes things up, - * of course. - * - * If the expression(s) you're trying to protect don't happen to return a - * value, you will need to manufacture a dummy result just to preserve the - * correct ordering of statements. Note that the macro passes the address - * of its argument (so you need to give it something which is addressable). - * If your expression returns multiple results, pass the last such result - * to PyFPE_END_PROTECT. - * - * Note that PyFPE_dummy returns a double, which is cast to int. - * This seeming insanity is to tickle the Floating Point Unit (FPU). - * If an exception has occurred in a preceding floating point operation, - * some architectures (notably Intel 80x86) will not deliver the interrupt - * until the *next* floating point operation. This is painful if you've - * already decremented PyFPE_counter. - */ -#define PyFPE_END_PROTECT(v) PyFPE_counter -= (int)PyFPE_dummy(&(v)); - -#else - -#define PyFPE_START_PROTECT(err_string, leave_stmt) -#define PyFPE_END_PROTECT(v) - -#endif - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PYFPE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pygetopt.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pygetopt.h deleted file mode 100644 index 024f173..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pygetopt.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef Py_PYGETOPT_H -#define Py_PYGETOPT_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_DATA(int) _PyOS_opterr; -PyAPI_DATA(int) _PyOS_optind; -PyAPI_DATA(char *) _PyOS_optarg; - -PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); -PyAPI_FUNC(int) _PyOS_GetOpt(int argc, char **argv, char *optstring); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PYGETOPT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pymacconfig.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pymacconfig.h deleted file mode 100644 index f647b47..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pymacconfig.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef PYMACCONFIG_H -#define PYMACCONFIG_H - /* - * This file moves some of the autoconf magic to compile-time - * when building on MacOSX. This is needed for building 4-way - * universal binaries and for 64-bit universal binaries because - * the values redefined below aren't configure-time constant but - * only compile-time constant in these scenarios. - */ - -#if defined(__APPLE__) - -# undef SIZEOF_LONG -# undef SIZEOF_PTHREAD_T -# undef SIZEOF_SIZE_T -# undef SIZEOF_TIME_T -# undef SIZEOF_VOID_P -# undef SIZEOF__BOOL -# undef SIZEOF_UINTPTR_T -# undef SIZEOF_PTHREAD_T -# undef WORDS_BIGENDIAN -# undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 -# undef DOUBLE_IS_BIG_ENDIAN_IEEE754 -# undef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 -# undef HAVE_GCC_ASM_FOR_X87 - -# undef VA_LIST_IS_ARRAY -# if defined(__LP64__) && defined(__x86_64__) -# define VA_LIST_IS_ARRAY 1 -# endif - -# undef HAVE_LARGEFILE_SUPPORT -# ifndef __LP64__ -# define HAVE_LARGEFILE_SUPPORT 1 -# endif - -# undef SIZEOF_LONG -# ifdef __LP64__ -# define SIZEOF__BOOL 1 -# define SIZEOF__BOOL 1 -# define SIZEOF_LONG 8 -# define SIZEOF_PTHREAD_T 8 -# define SIZEOF_SIZE_T 8 -# define SIZEOF_TIME_T 8 -# define SIZEOF_VOID_P 8 -# define SIZEOF_UINTPTR_T 8 -# define SIZEOF_PTHREAD_T 8 -# else -# ifdef __ppc__ -# define SIZEOF__BOOL 4 -# else -# define SIZEOF__BOOL 1 -# endif -# define SIZEOF_LONG 4 -# define SIZEOF_PTHREAD_T 4 -# define SIZEOF_SIZE_T 4 -# define SIZEOF_TIME_T 4 -# define SIZEOF_VOID_P 4 -# define SIZEOF_UINTPTR_T 4 -# define SIZEOF_PTHREAD_T 4 -# endif - -# if defined(__LP64__) - /* MacOSX 10.4 (the first release to support 64-bit code - * at all) only supports 64-bit in the UNIX layer. - * Therefore surpress the toolbox-glue in 64-bit mode. - */ - - /* In 64-bit mode setpgrp always has no argments, in 32-bit - * mode that depends on the compilation environment - */ -# undef SETPGRP_HAVE_ARG - -# endif - -#ifdef __BIG_ENDIAN__ -#define WORDS_BIGENDIAN 1 -#define DOUBLE_IS_BIG_ENDIAN_IEEE754 -#else -#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 -#endif /* __BIG_ENDIAN */ - -#ifdef __i386__ -# define HAVE_GCC_ASM_FOR_X87 -#endif - - /* - * The definition in pyconfig.h is only valid on the OS release - * where configure ran on and not necessarily for all systems where - * the executable can be used on. - * - * Specifically: OSX 10.4 has limited supported for '%zd', while - * 10.5 has full support for '%zd'. A binary built on 10.5 won't - * work properly on 10.4 unless we surpress the definition - * of PY_FORMAT_SIZE_T - */ -#undef PY_FORMAT_SIZE_T - - -#endif /* defined(_APPLE__) */ - -#endif /* PYMACCONFIG_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pymactoolbox.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pymactoolbox.h deleted file mode 100644 index a0ac1c2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pymactoolbox.h +++ /dev/null @@ -1,217 +0,0 @@ -/* -** pymactoolbox.h - globals defined in mactoolboxglue.c -*/ -#ifndef Py_PYMACTOOLBOX_H -#define Py_PYMACTOOLBOX_H -#ifdef __cplusplus - extern "C" { -#endif - -#include - -#ifndef __LP64__ -#include -#endif /* !__LP64__ */ - -/* -** Helper routines for error codes and such. -*/ -char *PyMac_StrError(int); /* strerror with mac errors */ -extern PyObject *PyMac_OSErrException; /* Exception for OSErr */ -PyObject *PyMac_GetOSErrException(void); /* Initialize & return it */ -PyObject *PyErr_Mac(PyObject *, int); /* Exception with a mac error */ -PyObject *PyMac_Error(OSErr); /* Uses PyMac_GetOSErrException */ -#ifndef __LP64__ -extern OSErr PyMac_GetFullPathname(FSSpec *, char *, int); /* convert - fsspec->path */ -#endif /* __LP64__ */ - -/* -** These conversion routines are defined in mactoolboxglue.c itself. -*/ -int PyMac_GetOSType(PyObject *, OSType *); /* argument parser for OSType */ -PyObject *PyMac_BuildOSType(OSType); /* Convert OSType to PyObject */ - -PyObject *PyMac_BuildNumVersion(NumVersion);/* Convert NumVersion to PyObject */ - -int PyMac_GetStr255(PyObject *, Str255); /* argument parser for Str255 */ -PyObject *PyMac_BuildStr255(Str255); /* Convert Str255 to PyObject */ -PyObject *PyMac_BuildOptStr255(Str255); /* Convert Str255 to PyObject, - NULL to None */ - -int PyMac_GetRect(PyObject *, Rect *); /* argument parser for Rect */ -PyObject *PyMac_BuildRect(Rect *); /* Convert Rect to PyObject */ - -int PyMac_GetPoint(PyObject *, Point *); /* argument parser for Point */ -PyObject *PyMac_BuildPoint(Point); /* Convert Point to PyObject */ - -int PyMac_GetEventRecord(PyObject *, EventRecord *); /* argument parser for - EventRecord */ -PyObject *PyMac_BuildEventRecord(EventRecord *); /* Convert EventRecord to - PyObject */ - -int PyMac_GetFixed(PyObject *, Fixed *); /* argument parser for Fixed */ -PyObject *PyMac_BuildFixed(Fixed); /* Convert Fixed to PyObject */ -int PyMac_Getwide(PyObject *, wide *); /* argument parser for wide */ -PyObject *PyMac_Buildwide(wide *); /* Convert wide to PyObject */ - -/* -** The rest of the routines are implemented by extension modules. If they are -** dynamically loaded mactoolboxglue will contain a stub implementation of the -** routine, which imports the module, whereupon the module's init routine will -** communicate the routine pointer back to the stub. -** If USE_TOOLBOX_OBJECT_GLUE is not defined there is no glue code, and the -** extension modules simply declare the routine. This is the case for static -** builds (and could be the case for MacPython CFM builds, because CFM extension -** modules can reference each other without problems). -*/ - -#ifdef USE_TOOLBOX_OBJECT_GLUE -/* -** These macros are used in the module init code. If we use toolbox object glue -** it sets the function pointer to point to the real function. -*/ -#define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) { \ - extern PyObject *(*PyMacGluePtr_##rtn)(object); \ - PyMacGluePtr_##rtn = _##rtn; \ -} -#define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) { \ - extern int (*PyMacGluePtr_##rtn)(PyObject *, object *); \ - PyMacGluePtr_##rtn = _##rtn; \ -} -#else -/* -** If we don't use toolbox object glue the init macros are empty. Moreover, we define -** _xxx_New to be the same as xxx_New, and the code in mactoolboxglue isn't included. -*/ -#define PyMac_INIT_TOOLBOX_OBJECT_NEW(object, rtn) -#define PyMac_INIT_TOOLBOX_OBJECT_CONVERT(object, rtn) -#endif /* USE_TOOLBOX_OBJECT_GLUE */ - -/* macfs exports */ -#ifndef __LP64__ -int PyMac_GetFSSpec(PyObject *, FSSpec *); /* argument parser for FSSpec */ -PyObject *PyMac_BuildFSSpec(FSSpec *); /* Convert FSSpec to PyObject */ -#endif /* !__LP64__ */ - -int PyMac_GetFSRef(PyObject *, FSRef *); /* argument parser for FSRef */ -PyObject *PyMac_BuildFSRef(FSRef *); /* Convert FSRef to PyObject */ - -/* AE exports */ -extern PyObject *AEDesc_New(AppleEvent *); /* XXXX Why passed by address?? */ -extern PyObject *AEDesc_NewBorrowed(AppleEvent *); -extern int AEDesc_Convert(PyObject *, AppleEvent *); - -/* Cm exports */ -extern PyObject *CmpObj_New(Component); -extern int CmpObj_Convert(PyObject *, Component *); -extern PyObject *CmpInstObj_New(ComponentInstance); -extern int CmpInstObj_Convert(PyObject *, ComponentInstance *); - -/* Ctl exports */ -#ifndef __LP64__ -extern PyObject *CtlObj_New(ControlHandle); -extern int CtlObj_Convert(PyObject *, ControlHandle *); -#endif /* !__LP64__ */ - -/* Dlg exports */ -#ifndef __LP64__ -extern PyObject *DlgObj_New(DialogPtr); -extern int DlgObj_Convert(PyObject *, DialogPtr *); -extern PyObject *DlgObj_WhichDialog(DialogPtr); -#endif /* !__LP64__ */ - -/* Drag exports */ -#ifndef __LP64__ -extern PyObject *DragObj_New(DragReference); -extern int DragObj_Convert(PyObject *, DragReference *); -#endif /* !__LP64__ */ - -/* List exports */ -#ifndef __LP64__ -extern PyObject *ListObj_New(ListHandle); -extern int ListObj_Convert(PyObject *, ListHandle *); -#endif /* !__LP64__ */ - -/* Menu exports */ -#ifndef __LP64__ -extern PyObject *MenuObj_New(MenuHandle); -extern int MenuObj_Convert(PyObject *, MenuHandle *); -#endif /* !__LP64__ */ - -/* Qd exports */ -#ifndef __LP64__ -extern PyObject *GrafObj_New(GrafPtr); -extern int GrafObj_Convert(PyObject *, GrafPtr *); -extern PyObject *BMObj_New(BitMapPtr); -extern int BMObj_Convert(PyObject *, BitMapPtr *); -extern PyObject *QdRGB_New(RGBColor *); -extern int QdRGB_Convert(PyObject *, RGBColor *); -#endif /* !__LP64__ */ - -/* Qdoffs exports */ -#ifndef __LP64__ -extern PyObject *GWorldObj_New(GWorldPtr); -extern int GWorldObj_Convert(PyObject *, GWorldPtr *); -#endif /* !__LP64__ */ - -/* Qt exports */ -#ifndef __LP64__ -extern PyObject *TrackObj_New(Track); -extern int TrackObj_Convert(PyObject *, Track *); -extern PyObject *MovieObj_New(Movie); -extern int MovieObj_Convert(PyObject *, Movie *); -extern PyObject *MovieCtlObj_New(MovieController); -extern int MovieCtlObj_Convert(PyObject *, MovieController *); -extern PyObject *TimeBaseObj_New(TimeBase); -extern int TimeBaseObj_Convert(PyObject *, TimeBase *); -extern PyObject *UserDataObj_New(UserData); -extern int UserDataObj_Convert(PyObject *, UserData *); -extern PyObject *MediaObj_New(Media); -extern int MediaObj_Convert(PyObject *, Media *); -#endif /* !__LP64__ */ - -/* Res exports */ -extern PyObject *ResObj_New(Handle); -extern int ResObj_Convert(PyObject *, Handle *); -extern PyObject *OptResObj_New(Handle); -extern int OptResObj_Convert(PyObject *, Handle *); - -/* TE exports */ -#ifndef __LP64__ -extern PyObject *TEObj_New(TEHandle); -extern int TEObj_Convert(PyObject *, TEHandle *); -#endif /* !__LP64__ */ - -/* Win exports */ -#ifndef __LP64__ -extern PyObject *WinObj_New(WindowPtr); -extern int WinObj_Convert(PyObject *, WindowPtr *); -extern PyObject *WinObj_WhichWindow(WindowPtr); -#endif /* !__LP64__ */ - -/* CF exports */ -extern PyObject *CFObj_New(CFTypeRef); -extern int CFObj_Convert(PyObject *, CFTypeRef *); -extern PyObject *CFTypeRefObj_New(CFTypeRef); -extern int CFTypeRefObj_Convert(PyObject *, CFTypeRef *); -extern PyObject *CFStringRefObj_New(CFStringRef); -extern int CFStringRefObj_Convert(PyObject *, CFStringRef *); -extern PyObject *CFMutableStringRefObj_New(CFMutableStringRef); -extern int CFMutableStringRefObj_Convert(PyObject *, CFMutableStringRef *); -extern PyObject *CFArrayRefObj_New(CFArrayRef); -extern int CFArrayRefObj_Convert(PyObject *, CFArrayRef *); -extern PyObject *CFMutableArrayRefObj_New(CFMutableArrayRef); -extern int CFMutableArrayRefObj_Convert(PyObject *, CFMutableArrayRef *); -extern PyObject *CFDictionaryRefObj_New(CFDictionaryRef); -extern int CFDictionaryRefObj_Convert(PyObject *, CFDictionaryRef *); -extern PyObject *CFMutableDictionaryRefObj_New(CFMutableDictionaryRef); -extern int CFMutableDictionaryRefObj_Convert(PyObject *, CFMutableDictionaryRef *); -extern PyObject *CFURLRefObj_New(CFURLRef); -extern int CFURLRefObj_Convert(PyObject *, CFURLRef *); -extern int OptionalCFURLRefObj_Convert(PyObject *, CFURLRef *); - -#ifdef __cplusplus - } -#endif -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pymath.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pymath.h deleted file mode 100644 index f63ddb7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pymath.h +++ /dev/null @@ -1,192 +0,0 @@ -#ifndef Py_PYMATH_H -#define Py_PYMATH_H - -#include "pyconfig.h" /* include for defines */ - -/************************************************************************** -Symbols and macros to supply platform-independent interfaces to mathematical -functions and constants -**************************************************************************/ - -/* Python provides implementations for copysign, round and hypot in - * Python/pymath.c just in case your math library doesn't provide the - * functions. - * - *Note: PC/pyconfig.h defines copysign as _copysign - */ -#ifndef HAVE_COPYSIGN -extern double copysign(double, double); -#endif - -#ifndef HAVE_ROUND -extern double round(double); -#endif - -#ifndef HAVE_HYPOT -extern double hypot(double, double); -#endif - -/* extra declarations */ -#ifndef _MSC_VER -#ifndef __STDC__ -extern double fmod (double, double); -extern double frexp (double, int *); -extern double ldexp (double, int); -extern double modf (double, double *); -extern double pow(double, double); -#endif /* __STDC__ */ -#endif /* _MSC_VER */ - -#ifdef _OSF_SOURCE -/* OSF1 5.1 doesn't make these available with XOPEN_SOURCE_EXTENDED defined */ -extern int finite(double); -extern double copysign(double, double); -#endif - -/* High precision defintion of pi and e (Euler) - * The values are taken from libc6's math.h. - */ -#ifndef Py_MATH_PIl -#define Py_MATH_PIl 3.1415926535897932384626433832795029L -#endif -#ifndef Py_MATH_PI -#define Py_MATH_PI 3.14159265358979323846 -#endif - -#ifndef Py_MATH_El -#define Py_MATH_El 2.7182818284590452353602874713526625L -#endif - -#ifndef Py_MATH_E -#define Py_MATH_E 2.7182818284590452354 -#endif - -/* On x86, Py_FORCE_DOUBLE forces a floating-point number out of an x87 FPU - register and into a 64-bit memory location, rounding from extended - precision to double precision in the process. On other platforms it does - nothing. */ - -/* we take double rounding as evidence of x87 usage */ -#ifndef Py_FORCE_DOUBLE -# ifdef X87_DOUBLE_ROUNDING -PyAPI_FUNC(double) _Py_force_double(double); -# define Py_FORCE_DOUBLE(X) (_Py_force_double(X)) -# else -# define Py_FORCE_DOUBLE(X) (X) -# endif -#endif - -#ifdef HAVE_GCC_ASM_FOR_X87 -PyAPI_FUNC(unsigned short) _Py_get_387controlword(void); -PyAPI_FUNC(void) _Py_set_387controlword(unsigned short); -#endif - -/* Py_IS_NAN(X) - * Return 1 if float or double arg is a NaN, else 0. - * Caution: - * X is evaluated more than once. - * This may not work on all platforms. Each platform has *some* - * way to spell this, though -- override in pyconfig.h if you have - * a platform where it doesn't work. - * Note: PC/pyconfig.h defines Py_IS_NAN as _isnan - */ -#ifndef Py_IS_NAN -#if defined HAVE_DECL_ISNAN && HAVE_DECL_ISNAN == 1 -#define Py_IS_NAN(X) isnan(X) -#else -#define Py_IS_NAN(X) ((X) != (X)) -#endif -#endif - -/* Py_IS_INFINITY(X) - * Return 1 if float or double arg is an infinity, else 0. - * Caution: - * X is evaluated more than once. - * This implementation may set the underflow flag if |X| is very small; - * it really can't be implemented correctly (& easily) before C99. - * Override in pyconfig.h if you have a better spelling on your platform. - * Py_FORCE_DOUBLE is used to avoid getting false negatives from a - * non-infinite value v sitting in an 80-bit x87 register such that - * v becomes infinite when spilled from the register to 64-bit memory. - * Note: PC/pyconfig.h defines Py_IS_INFINITY as _isinf - */ -#ifndef Py_IS_INFINITY -# if defined HAVE_DECL_ISINF && HAVE_DECL_ISINF == 1 -# define Py_IS_INFINITY(X) isinf(X) -# else -# define Py_IS_INFINITY(X) ((X) && \ - (Py_FORCE_DOUBLE(X)*0.5 == Py_FORCE_DOUBLE(X))) -# endif -#endif - -/* Py_IS_FINITE(X) - * Return 1 if float or double arg is neither infinite nor NAN, else 0. - * Some compilers (e.g. VisualStudio) have intrisics for this, so a special - * macro for this particular test is useful - * Note: PC/pyconfig.h defines Py_IS_FINITE as _finite - */ -#ifndef Py_IS_FINITE -#if defined HAVE_DECL_ISFINITE && HAVE_DECL_ISFINITE == 1 -#define Py_IS_FINITE(X) isfinite(X) -#elif defined HAVE_FINITE -#define Py_IS_FINITE(X) finite(X) -#else -#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) -#endif -#endif - -/* HUGE_VAL is supposed to expand to a positive double infinity. Python - * uses Py_HUGE_VAL instead because some platforms are broken in this - * respect. We used to embed code in pyport.h to try to worm around that, - * but different platforms are broken in conflicting ways. If you're on - * a platform where HUGE_VAL is defined incorrectly, fiddle your Python - * config to #define Py_HUGE_VAL to something that works on your platform. - */ -#ifndef Py_HUGE_VAL -#define Py_HUGE_VAL HUGE_VAL -#endif - -/* Py_NAN - * A value that evaluates to a NaN. On IEEE 754 platforms INF*0 or - * INF/INF works. Define Py_NO_NAN in pyconfig.h if your platform - * doesn't support NaNs. - */ -#if !defined(Py_NAN) && !defined(Py_NO_NAN) -#define Py_NAN (Py_HUGE_VAL * 0.) -#endif - -/* Py_OVERFLOWED(X) - * Return 1 iff a libm function overflowed. Set errno to 0 before calling - * a libm function, and invoke this macro after, passing the function - * result. - * Caution: - * This isn't reliable. C99 no longer requires libm to set errno under - * any exceptional condition, but does require +- HUGE_VAL return - * values on overflow. A 754 box *probably* maps HUGE_VAL to a - * double infinity, and we're cool if that's so, unless the input - * was an infinity and an infinity is the expected result. A C89 - * system sets errno to ERANGE, so we check for that too. We're - * out of luck if a C99 754 box doesn't map HUGE_VAL to +Inf, or - * if the returned result is a NaN, or if a C89 box returns HUGE_VAL - * in non-overflow cases. - * X is evaluated more than once. - * Some platforms have better way to spell this, so expect some #ifdef'ery. - * - * OpenBSD uses 'isinf()' because a compiler bug on that platform causes - * the longer macro version to be mis-compiled. This isn't optimal, and - * should be removed once a newer compiler is available on that platform. - * The system that had the failure was running OpenBSD 3.2 on Intel, with - * gcc 2.95.3. - * - * According to Tim's checkin, the FreeBSD systems use isinf() to work - * around a FPE bug on that platform. - */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) -#define Py_OVERFLOWED(X) isinf(X) -#else -#define Py_OVERFLOWED(X) ((X) != 0.0 && (errno == ERANGE || \ - (X) == Py_HUGE_VAL || \ - (X) == -Py_HUGE_VAL)) -#endif - -#endif /* Py_PYMATH_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h deleted file mode 100644 index 27c72f1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pymem.h +++ /dev/null @@ -1,122 +0,0 @@ -/* The PyMem_ family: low-level memory allocation interfaces. - See objimpl.h for the PyObject_ memory family. -*/ - -#ifndef Py_PYMEM_H -#define Py_PYMEM_H - -#include "pyport.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* BEWARE: - - Each interface exports both functions and macros. Extension modules should - use the functions, to ensure binary compatibility across Python versions. - Because the Python implementation is free to change internal details, and - the macros may (or may not) expose details for speed, if you do use the - macros you must recompile your extensions with each Python release. - - Never mix calls to PyMem_ with calls to the platform malloc/realloc/ - calloc/free. For example, on Windows different DLLs may end up using - different heaps, and if you use PyMem_Malloc you'll get the memory from the - heap used by the Python DLL; it could be a disaster if you free()'ed that - directly in your own extension. Using PyMem_Free instead ensures Python - can return the memory to the proper heap. As another example, in - PYMALLOC_DEBUG mode, Python wraps all calls to all PyMem_ and PyObject_ - memory functions in special debugging wrappers that add additional - debugging info to dynamic memory blocks. The system routines have no idea - what to do with that stuff, and the Python wrappers have no idea what to do - with raw blocks obtained directly by the system routines then. - - The GIL must be held when using these APIs. -*/ - -/* - * Raw memory interface - * ==================== - */ - -/* Functions - - Functions supplying platform-independent semantics for malloc/realloc/ - free. These functions make sure that allocating 0 bytes returns a distinct - non-NULL pointer (whenever possible -- if we're flat out of memory, NULL - may be returned), even if the platform malloc and realloc don't. - Returned pointers must be checked for NULL explicitly. No action is - performed on failure (no exception is set, no warning is printed, etc). -*/ - -PyAPI_FUNC(void *) PyMem_Malloc(size_t); -PyAPI_FUNC(void *) PyMem_Realloc(void *, size_t); -PyAPI_FUNC(void) PyMem_Free(void *); - -/* Starting from Python 1.6, the wrappers Py_{Malloc,Realloc,Free} are - no longer supported. They used to call PyErr_NoMemory() on failure. */ - -/* Macros. */ -#ifdef PYMALLOC_DEBUG -/* Redirect all memory operations to Python's debugging allocator. */ -#define PyMem_MALLOC _PyMem_DebugMalloc -#define PyMem_REALLOC _PyMem_DebugRealloc -#define PyMem_FREE _PyMem_DebugFree - -#else /* ! PYMALLOC_DEBUG */ - -/* PyMem_MALLOC(0) means malloc(1). Some systems would return NULL - for malloc(0), which would be treated as an error. Some platforms - would return a pointer with no memory behind it, which would break - pymalloc. To solve these problems, allocate an extra byte. */ -/* Returns NULL to indicate error if a negative size or size larger than - Py_ssize_t can represent is supplied. Helps prevents security holes. */ -#define PyMem_MALLOC(n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ - : malloc((n) ? (n) : 1)) -#define PyMem_REALLOC(p, n) ((size_t)(n) > (size_t)PY_SSIZE_T_MAX ? NULL \ - : realloc((p), (n) ? (n) : 1)) -#define PyMem_FREE free - -#endif /* PYMALLOC_DEBUG */ - -/* - * Type-oriented memory interface - * ============================== - * - * Allocate memory for n objects of the given type. Returns a new pointer - * or NULL if the request was too large or memory allocation failed. Use - * these macros rather than doing the multiplication yourself so that proper - * overflow checking is always done. - */ - -#define PyMem_New(type, n) \ - ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - ( (type *) PyMem_Malloc((n) * sizeof(type)) ) ) -#define PyMem_NEW(type, n) \ - ( ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - ( (type *) PyMem_MALLOC((n) * sizeof(type)) ) ) - -/* - * The value of (p) is always clobbered by this macro regardless of success. - * The caller MUST check if (p) is NULL afterwards and deal with the memory - * error if so. This means the original value of (p) MUST be saved for the - * caller's memory error handler to not lose track of it. - */ -#define PyMem_Resize(p, type, n) \ - ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - (type *) PyMem_Realloc((p), (n) * sizeof(type)) ) -#define PyMem_RESIZE(p, type, n) \ - ( (p) = ((size_t)(n) > PY_SSIZE_T_MAX / sizeof(type)) ? NULL : \ - (type *) PyMem_REALLOC((p), (n) * sizeof(type)) ) - -/* PyMem{Del,DEL} are left over from ancient days, and shouldn't be used - * anymore. They're just confusing aliases for PyMem_{Free,FREE} now. - */ -#define PyMem_Del PyMem_Free -#define PyMem_DEL PyMem_FREE - -#ifdef __cplusplus -} -#endif - -#endif /* !Py_PYMEM_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pyport.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pyport.h deleted file mode 100644 index ff43d6e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pyport.h +++ /dev/null @@ -1,941 +0,0 @@ -#ifndef Py_PYPORT_H -#define Py_PYPORT_H - -#include "pyconfig.h" /* include for defines */ - -/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, - INT32_MAX, etc. */ -#ifdef HAVE_INTTYPES_H -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -/************************************************************************** -Symbols and macros to supply platform-independent interfaces to basic -C language & library operations whose spellings vary across platforms. - -Please try to make documentation here as clear as possible: by definition, -the stuff here is trying to illuminate C's darkest corners. - -Config #defines referenced here: - -SIGNED_RIGHT_SHIFT_ZERO_FILLS -Meaning: To be defined iff i>>j does not extend the sign bit when i is a - signed integral type and i < 0. -Used in: Py_ARITHMETIC_RIGHT_SHIFT - -Py_DEBUG -Meaning: Extra checks compiled in for debug mode. -Used in: Py_SAFE_DOWNCAST - -HAVE_UINTPTR_T -Meaning: The C9X type uintptr_t is supported by the compiler -Used in: Py_uintptr_t - -HAVE_LONG_LONG -Meaning: The compiler supports the C type "long long" -Used in: PY_LONG_LONG - -**************************************************************************/ - - -/* For backward compatibility only. Obsolete, do not use. */ -#ifdef HAVE_PROTOTYPES -#define Py_PROTO(x) x -#else -#define Py_PROTO(x) () -#endif -#ifndef Py_FPROTO -#define Py_FPROTO(x) Py_PROTO(x) -#endif - -/* typedefs for some C9X-defined synonyms for integral types. - * - * The names in Python are exactly the same as the C9X names, except with a - * Py_ prefix. Until C9X is universally implemented, this is the only way - * to ensure that Python gets reliable names that don't conflict with names - * in non-Python code that are playing their own tricks to define the C9X - * names. - * - * NOTE: don't go nuts here! Python has no use for *most* of the C9X - * integral synonyms. Only define the ones we actually need. - */ - -#ifdef HAVE_LONG_LONG -#ifndef PY_LONG_LONG -#define PY_LONG_LONG long long -#if defined(LLONG_MAX) -/* If LLONG_MAX is defined in limits.h, use that. */ -#define PY_LLONG_MIN LLONG_MIN -#define PY_LLONG_MAX LLONG_MAX -#define PY_ULLONG_MAX ULLONG_MAX -#elif defined(__LONG_LONG_MAX__) -/* Otherwise, if GCC has a builtin define, use that. */ -#define PY_LLONG_MAX __LONG_LONG_MAX__ -#define PY_LLONG_MIN (-PY_LLONG_MAX-1) -#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL) -#else -/* Otherwise, rely on two's complement. */ -#define PY_ULLONG_MAX (~0ULL) -#define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1)) -#define PY_LLONG_MIN (-PY_LLONG_MAX-1) -#endif /* LLONG_MAX */ -#endif -#endif /* HAVE_LONG_LONG */ - -/* a build with 30-bit digits for Python long integers needs an exact-width - * 32-bit unsigned integer type to store those digits. (We could just use - * type 'unsigned long', but that would be wasteful on a system where longs - * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines - * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t. - * However, it doesn't set HAVE_UINT32_T, so we do that here. - */ -#ifdef uint32_t -#define HAVE_UINT32_T 1 -#endif - -#ifdef HAVE_UINT32_T -#ifndef PY_UINT32_T -#define PY_UINT32_T uint32_t -#endif -#endif - -/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the - * long integer implementation, when 30-bit digits are enabled. - */ -#ifdef uint64_t -#define HAVE_UINT64_T 1 -#endif - -#ifdef HAVE_UINT64_T -#ifndef PY_UINT64_T -#define PY_UINT64_T uint64_t -#endif -#endif - -/* Signed variants of the above */ -#ifdef int32_t -#define HAVE_INT32_T 1 -#endif - -#ifdef HAVE_INT32_T -#ifndef PY_INT32_T -#define PY_INT32_T int32_t -#endif -#endif - -#ifdef int64_t -#define HAVE_INT64_T 1 -#endif - -#ifdef HAVE_INT64_T -#ifndef PY_INT64_T -#define PY_INT64_T int64_t -#endif -#endif - -/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all - the necessary integer types are available, and we're on a 64-bit platform - (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ - -#ifndef PYLONG_BITS_IN_DIGIT -#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \ - defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8) -#define PYLONG_BITS_IN_DIGIT 30 -#else -#define PYLONG_BITS_IN_DIGIT 15 -#endif -#endif - -/* uintptr_t is the C9X name for an unsigned integral type such that a - * legitimate void* can be cast to uintptr_t and then back to void* again - * without loss of information. Similarly for intptr_t, wrt a signed - * integral type. - */ -#ifdef HAVE_UINTPTR_T -typedef uintptr_t Py_uintptr_t; -typedef intptr_t Py_intptr_t; - -#elif SIZEOF_VOID_P <= SIZEOF_INT -typedef unsigned int Py_uintptr_t; -typedef int Py_intptr_t; - -#elif SIZEOF_VOID_P <= SIZEOF_LONG -typedef unsigned long Py_uintptr_t; -typedef long Py_intptr_t; - -#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) -typedef unsigned PY_LONG_LONG Py_uintptr_t; -typedef PY_LONG_LONG Py_intptr_t; - -#else -# error "Python needs a typedef for Py_uintptr_t in pyport.h." -#endif /* HAVE_UINTPTR_T */ - -/* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == - * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an - * unsigned integral type). See PEP 353 for details. - */ -#ifdef HAVE_SSIZE_T -typedef ssize_t Py_ssize_t; -#elif SIZEOF_VOID_P == SIZEOF_SIZE_T -typedef Py_intptr_t Py_ssize_t; -#else -# error "Python needs a typedef for Py_ssize_t in pyport.h." -#endif - -/* Largest possible value of size_t. - SIZE_MAX is part of C99, so it might be defined on some - platforms. If it is not defined, (size_t)-1 is a portable - definition for C89, due to the way signed->unsigned - conversion is defined. */ -#ifdef SIZE_MAX -#define PY_SIZE_MAX SIZE_MAX -#else -#define PY_SIZE_MAX ((size_t)-1) -#endif - -/* Largest positive value of type Py_ssize_t. */ -#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) -/* Smallest negative value of type Py_ssize_t. */ -#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) - -#if SIZEOF_PID_T > SIZEOF_LONG -# error "Python doesn't support sizeof(pid_t) > sizeof(long)" -#endif - -/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf - * format to convert an argument with the width of a size_t or Py_ssize_t. - * C99 introduced "z" for this purpose, but not all platforms support that; - * e.g., MS compilers use "I" instead. - * - * These "high level" Python format functions interpret "z" correctly on - * all platforms (Python interprets the format string itself, and does whatever - * the platform C requires to convert a size_t/Py_ssize_t argument): - * - * PyString_FromFormat - * PyErr_Format - * PyString_FromFormatV - * - * Lower-level uses require that you interpolate the correct format modifier - * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for - * example, - * - * Py_ssize_t index; - * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); - * - * That will expand to %ld, or %Id, or to something else correct for a - * Py_ssize_t on the platform. - */ -#ifndef PY_FORMAT_SIZE_T -# if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) -# define PY_FORMAT_SIZE_T "" -# elif SIZEOF_SIZE_T == SIZEOF_LONG -# define PY_FORMAT_SIZE_T "l" -# elif defined(MS_WINDOWS) -# define PY_FORMAT_SIZE_T "I" -# else -# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" -# endif -#endif - -/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for - * the long long type instead of the size_t type. It's only available - * when HAVE_LONG_LONG is defined. The "high level" Python format - * functions listed above will interpret "lld" or "llu" correctly on - * all platforms. - */ -#ifdef HAVE_LONG_LONG -# ifndef PY_FORMAT_LONG_LONG -# if defined(MS_WIN64) || defined(MS_WINDOWS) -# define PY_FORMAT_LONG_LONG "I64" -# else -# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" -# endif -# endif -#endif - -/* Py_LOCAL can be used instead of static to get the fastest possible calling - * convention for functions that are local to a given module. - * - * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, - * for platforms that support that. - * - * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more - * "aggressive" inlining/optimizaion is enabled for the entire module. This - * may lead to code bloat, and may slow things down for those reasons. It may - * also lead to errors, if the code relies on pointer aliasing. Use with - * care. - * - * NOTE: You can only use this for functions that are entirely local to a - * module; functions that are exported via method tables, callbacks, etc, - * should keep using static. - */ - -#undef USE_INLINE /* XXX - set via configure? */ - -#if defined(_MSC_VER) -#if defined(PY_LOCAL_AGGRESSIVE) -/* enable more aggressive optimization for visual studio */ -#pragma optimize("agtw", on) -#endif -/* ignore warnings if the compiler decides not to inline a function */ -#pragma warning(disable: 4710) -/* fastest possible local call under MSVC */ -#define Py_LOCAL(type) static type __fastcall -#define Py_LOCAL_INLINE(type) static __inline type __fastcall -#elif defined(USE_INLINE) -#define Py_LOCAL(type) static type -#define Py_LOCAL_INLINE(type) static inline type -#else -#define Py_LOCAL(type) static type -#define Py_LOCAL_INLINE(type) static type -#endif - -/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks - * are often very short. While most platforms have highly optimized code for - * large transfers, the setup costs for memcpy are often quite high. MEMCPY - * solves this by doing short copies "in line". - */ - -#if defined(_MSC_VER) -#define Py_MEMCPY(target, source, length) do { \ - size_t i_, n_ = (length); \ - char *t_ = (void*) (target); \ - const char *s_ = (void*) (source); \ - if (n_ >= 16) \ - memcpy(t_, s_, n_); \ - else \ - for (i_ = 0; i_ < n_; i_++) \ - t_[i_] = s_[i_]; \ - } while (0) -#else -#define Py_MEMCPY memcpy -#endif - -#include - -#ifdef HAVE_IEEEFP_H -#include /* needed for 'finite' declaration on some platforms */ -#endif - -#include /* Moved here from the math section, before extern "C" */ - -/******************************************** - * WRAPPER FOR and/or * - ********************************************/ - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else /* !TIME_WITH_SYS_TIME */ -#ifdef HAVE_SYS_TIME_H -#include -#else /* !HAVE_SYS_TIME_H */ -#include -#endif /* !HAVE_SYS_TIME_H */ -#endif /* !TIME_WITH_SYS_TIME */ - - -/****************************** - * WRAPPER FOR * - ******************************/ - -/* NB caller must include */ - -#ifdef HAVE_SYS_SELECT_H - -#include - -#endif /* !HAVE_SYS_SELECT_H */ - -/******************************* - * stat() and fstat() fiddling * - *******************************/ - -/* We expect that stat and fstat exist on most systems. - * It's confirmed on Unix, Mac and Windows. - * If you don't have them, add - * #define DONT_HAVE_STAT - * and/or - * #define DONT_HAVE_FSTAT - * to your pyconfig.h. Python code beyond this should check HAVE_STAT and - * HAVE_FSTAT instead. - * Also - * #define HAVE_SYS_STAT_H - * if exists on your platform, and - * #define HAVE_STAT_H - * if does. - */ -#ifndef DONT_HAVE_STAT -#define HAVE_STAT -#endif - -#ifndef DONT_HAVE_FSTAT -#define HAVE_FSTAT -#endif - -#ifdef RISCOS -#include -#include "unixstuff.h" -#endif - -#ifdef HAVE_SYS_STAT_H -#if defined(PYOS_OS2) && defined(PYCC_GCC) -#include -#endif -#include -#elif defined(HAVE_STAT_H) -#include -#endif - -#if defined(PYCC_VACPP) -/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ -#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG) -#endif - -#ifndef S_ISREG -#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) -#endif - -#ifndef S_ISDIR -#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) -#endif - - -#ifdef __cplusplus -/* Move this down here since some C++ #include's don't like to be included - inside an extern "C" */ -extern "C" { -#endif - - -/* Py_ARITHMETIC_RIGHT_SHIFT - * C doesn't define whether a right-shift of a signed integer sign-extends - * or zero-fills. Here a macro to force sign extension: - * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) - * Return I >> J, forcing sign extension. Arithmetically, return the - * floor of I/2**J. - * Requirements: - * I should have signed integer type. In the terminology of C99, this can - * be either one of the five standard signed integer types (signed char, - * short, int, long, long long) or an extended signed integer type. - * J is an integer >= 0 and strictly less than the number of bits in the - * type of I (because C doesn't define what happens for J outside that - * range either). - * TYPE used to specify the type of I, but is now ignored. It's been left - * in for backwards compatibility with versions <= 2.6 or 3.0. - * Caution: - * I may be evaluated more than once. - */ -#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS -#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ - ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) -#else -#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) -#endif - -/* Py_FORCE_EXPANSION(X) - * "Simply" returns its argument. However, macro expansions within the - * argument are evaluated. This unfortunate trickery is needed to get - * token-pasting to work as desired in some cases. - */ -#define Py_FORCE_EXPANSION(X) X - -/* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) - * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this - * assert-fails if any information is lost. - * Caution: - * VALUE may be evaluated more than once. - */ -#ifdef Py_DEBUG -#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ - (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) -#else -#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) -#endif - -/* Py_SET_ERRNO_ON_MATH_ERROR(x) - * If a libm function did not set errno, but it looks like the result - * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno - * to 0 before calling a libm function, and invoke this macro after, - * passing the function result. - * Caution: - * This isn't reliable. See Py_OVERFLOWED comments. - * X is evaluated more than once. - */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) -#define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; -#else -#define _Py_SET_EDOM_FOR_NAN(X) ; -#endif -#define Py_SET_ERRNO_ON_MATH_ERROR(X) \ - do { \ - if (errno == 0) { \ - if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ - errno = ERANGE; \ - else _Py_SET_EDOM_FOR_NAN(X) \ - } \ - } while(0) - -/* Py_SET_ERANGE_ON_OVERFLOW(x) - * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. - */ -#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) - -/* Py_ADJUST_ERANGE1(x) - * Py_ADJUST_ERANGE2(x, y) - * Set errno to 0 before calling a libm function, and invoke one of these - * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful - * for functions returning complex results). This makes two kinds of - * adjustments to errno: (A) If it looks like the platform libm set - * errno=ERANGE due to underflow, clear errno. (B) If it looks like the - * platform libm overflowed but didn't set errno, force errno to ERANGE. In - * effect, we're trying to force a useful implementation of C89 errno - * behavior. - * Caution: - * This isn't reliable. See Py_OVERFLOWED comments. - * X and Y may be evaluated more than once. - */ -#define Py_ADJUST_ERANGE1(X) \ - do { \ - if (errno == 0) { \ - if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ - errno = ERANGE; \ - } \ - else if (errno == ERANGE && (X) == 0.0) \ - errno = 0; \ - } while(0) - -#define Py_ADJUST_ERANGE2(X, Y) \ - do { \ - if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ - (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ - if (errno == 0) \ - errno = ERANGE; \ - } \ - else if (errno == ERANGE) \ - errno = 0; \ - } while(0) - -/* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are - * required to support the short float repr introduced in Python 3.1) require - * that the floating-point unit that's being used for arithmetic operations - * on C doubles is set to use 53-bit precision. It also requires that the - * FPU rounding mode is round-half-to-even, but that's less often an issue. - * - * If your FPU isn't already set to 53-bit precision/round-half-to-even, and - * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should - * - * #define HAVE_PY_SET_53BIT_PRECISION 1 - * - * and also give appropriate definitions for the following three macros: - * - * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and - * set FPU to 53-bit precision/round-half-to-even - * _PY_SET_53BIT_PRECISION_END : restore original FPU settings - * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to - * use the two macros above. - * - * The macros are designed to be used within a single C function: see - * Python/pystrtod.c for an example of their use. - */ - -/* get and set x87 control word for gcc/x86 */ -#ifdef HAVE_GCC_ASM_FOR_X87 -#define HAVE_PY_SET_53BIT_PRECISION 1 -/* _Py_get/set_387controlword functions are defined in Python/pymath.c */ -#define _Py_SET_53BIT_PRECISION_HEADER \ - unsigned short old_387controlword, new_387controlword -#define _Py_SET_53BIT_PRECISION_START \ - do { \ - old_387controlword = _Py_get_387controlword(); \ - new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ - if (new_387controlword != old_387controlword) \ - _Py_set_387controlword(new_387controlword); \ - } while (0) -#define _Py_SET_53BIT_PRECISION_END \ - if (new_387controlword != old_387controlword) \ - _Py_set_387controlword(old_387controlword) -#endif - -/* get and set x87 control word for VisualStudio/x86 */ -#if defined(_MSC_VER) && !defined(_WIN64) /* x87 not supported in 64-bit */ -#define HAVE_PY_SET_53BIT_PRECISION 1 -#define _Py_SET_53BIT_PRECISION_HEADER \ - unsigned int old_387controlword, new_387controlword, out_387controlword -/* We use the __control87_2 function to set only the x87 control word. - The SSE control word is unaffected. */ -#define _Py_SET_53BIT_PRECISION_START \ - do { \ - __control87_2(0, 0, &old_387controlword, NULL); \ - new_387controlword = \ - (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ - if (new_387controlword != old_387controlword) \ - __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ - &out_387controlword, NULL); \ - } while (0) -#define _Py_SET_53BIT_PRECISION_END \ - do { \ - if (new_387controlword != old_387controlword) \ - __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ - &out_387controlword, NULL); \ - } while (0) -#endif - -/* default definitions are empty */ -#ifndef HAVE_PY_SET_53BIT_PRECISION -#define _Py_SET_53BIT_PRECISION_HEADER -#define _Py_SET_53BIT_PRECISION_START -#define _Py_SET_53BIT_PRECISION_END -#endif - -/* If we can't guarantee 53-bit precision, don't use the code - in Python/dtoa.c, but fall back to standard code. This - means that repr of a float will be long (17 sig digits). - - Realistically, there are two things that could go wrong: - - (1) doubles aren't IEEE 754 doubles, or - (2) we're on x86 with the rounding precision set to 64-bits - (extended precision), and we don't know how to change - the rounding precision. - */ - -#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ - !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ - !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) -#define PY_NO_SHORT_FLOAT_REPR -#endif - -/* double rounding is symptomatic of use of extended precision on x86. If - we're seeing double rounding, and we don't have any mechanism available for - changing the FPU rounding precision, then don't use Python/dtoa.c. */ -#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) -#define PY_NO_SHORT_FLOAT_REPR -#endif - -/* Py_DEPRECATED(version) - * Declare a variable, type, or function deprecated. - * Usage: - * extern int old_var Py_DEPRECATED(2.3); - * typedef int T1 Py_DEPRECATED(2.4); - * extern int x() Py_DEPRECATED(2.5); - */ -#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ - (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) -#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) -#else -#define Py_DEPRECATED(VERSION_UNUSED) -#endif - -/************************************************************************** -Prototypes that are missing from the standard include files on some systems -(and possibly only some versions of such systems.) - -Please be conservative with adding new ones, document them and enclose them -in platform-specific #ifdefs. -**************************************************************************/ - -#ifdef SOLARIS -/* Unchecked */ -extern int gethostname(char *, int); -#endif - -#ifdef __BEOS__ -/* Unchecked */ -/* It's in the libs, but not the headers... - [cjh] */ -int shutdown( int, int ); -#endif - -#ifdef HAVE__GETPTY -#include /* we need to import mode_t */ -extern char * _getpty(int *, int, mode_t, int); -#endif - -/* On QNX 6, struct termio must be declared by including sys/termio.h - if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must - be included before termios.h or it will generate an error. */ -#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) -#include -#endif - -#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) -#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H) -/* BSDI does not supply a prototype for the 'openpty' and 'forkpty' - functions, even though they are included in libutil. */ -#include -extern int openpty(int *, int *, char *, struct termios *, struct winsize *); -extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); -#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ -#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ - - -/* These are pulled from various places. It isn't obvious on what platforms - they are necessary, nor what the exact prototype should look like (which - is likely to vary between platforms!) If you find you need one of these - declarations, please move them to a platform-specific block and include - proper prototypes. */ -#if 0 - -/* From Modules/resource.c */ -extern int getrusage(); -extern int getpagesize(); - -/* From Python/sysmodule.c and Modules/posixmodule.c */ -extern int fclose(FILE *); - -/* From Modules/posixmodule.c */ -extern int fdatasync(int); -#endif /* 0 */ - - -/* On 4.4BSD-descendants, ctype functions serves the whole range of - * wchar_t character set rather than single byte code points only. - * This characteristic can break some operations of string object - * including str.upper() and str.split() on UTF-8 locales. This - * workaround was provided by Tim Robbins of FreeBSD project. - */ - -#ifdef __FreeBSD__ -#include -#if __FreeBSD_version > 500039 -# define _PY_PORT_CTYPE_UTF8_ISSUE -#endif -#endif - - -#if defined(__APPLE__) -# define _PY_PORT_CTYPE_UTF8_ISSUE -#endif - -#ifdef _PY_PORT_CTYPE_UTF8_ISSUE -#include -#include -#undef isalnum -#define isalnum(c) iswalnum(btowc(c)) -#undef isalpha -#define isalpha(c) iswalpha(btowc(c)) -#undef islower -#define islower(c) iswlower(btowc(c)) -#undef isspace -#define isspace(c) iswspace(btowc(c)) -#undef isupper -#define isupper(c) iswupper(btowc(c)) -#undef tolower -#define tolower(c) towlower(btowc(c)) -#undef toupper -#define toupper(c) towupper(btowc(c)) -#endif - - -/* Declarations for symbol visibility. - - PyAPI_FUNC(type): Declares a public Python API function and return type - PyAPI_DATA(type): Declares public Python data and its type - PyMODINIT_FUNC: A Python module init function. If these functions are - inside the Python core, they are private to the core. - If in an extension module, it may be declared with - external linkage depending on the platform. - - As a number of platforms support/require "__declspec(dllimport/dllexport)", - we support a HAVE_DECLSPEC_DLL macro to save duplication. -*/ - -/* - All windows ports, except cygwin, are handled in PC/pyconfig.h. - - BeOS and cygwin are the only other autoconf platform requiring special - linkage handling and both of these use __declspec(). -*/ -#if defined(__CYGWIN__) || defined(__BEOS__) -# define HAVE_DECLSPEC_DLL -#endif - -/* only get special linkage if built as shared or platform is Cygwin */ -#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) -# if defined(HAVE_DECLSPEC_DLL) -# ifdef Py_BUILD_CORE -# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE -# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE - /* module init functions inside the core need no external linkage */ - /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ -# if defined(__CYGWIN__) -# define PyMODINIT_FUNC __declspec(dllexport) void -# else /* __CYGWIN__ */ -# define PyMODINIT_FUNC void -# endif /* __CYGWIN__ */ -# else /* Py_BUILD_CORE */ - /* Building an extension module, or an embedded situation */ - /* public Python functions and data are imported */ - /* Under Cygwin, auto-import functions to prevent compilation */ - /* failures similar to those described at the bottom of 4.1: */ - /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ -# if !defined(__CYGWIN__) -# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE -# endif /* !__CYGWIN__ */ -# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE - /* module init functions outside the core must be exported */ -# if defined(__cplusplus) -# define PyMODINIT_FUNC extern "C" __declspec(dllexport) void -# else /* __cplusplus */ -# define PyMODINIT_FUNC __declspec(dllexport) void -# endif /* __cplusplus */ -# endif /* Py_BUILD_CORE */ -# endif /* HAVE_DECLSPEC */ -#endif /* Py_ENABLE_SHARED */ - -/* If no external linkage macros defined by now, create defaults */ -#ifndef PyAPI_FUNC -# define PyAPI_FUNC(RTYPE) RTYPE -#endif -#ifndef PyAPI_DATA -# define PyAPI_DATA(RTYPE) extern RTYPE -#endif -#ifndef PyMODINIT_FUNC -# if defined(__cplusplus) -# define PyMODINIT_FUNC extern "C" void -# else /* __cplusplus */ -# define PyMODINIT_FUNC void -# endif /* __cplusplus */ -#endif - -/* Deprecated DL_IMPORT and DL_EXPORT macros */ -#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL) -# if defined(Py_BUILD_CORE) -# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE -# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -# else -# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE -# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -# endif -#endif -#ifndef DL_EXPORT -# define DL_EXPORT(RTYPE) RTYPE -#endif -#ifndef DL_IMPORT -# define DL_IMPORT(RTYPE) RTYPE -#endif -/* End of deprecated DL_* macros */ - -/* If the fd manipulation macros aren't defined, - here is a set that should do the job */ - -#if 0 /* disabled and probably obsolete */ - -#ifndef FD_SETSIZE -#define FD_SETSIZE 256 -#endif - -#ifndef FD_SET - -typedef long fd_mask; - -#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif /* howmany */ - -typedef struct fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p))) - -#endif /* FD_SET */ - -#endif /* fd manipulation macros */ - - -/* limits.h constants that may be missing */ - -#ifndef INT_MAX -#define INT_MAX 2147483647 -#endif - -#ifndef LONG_MAX -#if SIZEOF_LONG == 4 -#define LONG_MAX 0X7FFFFFFFL -#elif SIZEOF_LONG == 8 -#define LONG_MAX 0X7FFFFFFFFFFFFFFFL -#else -#error "could not set LONG_MAX in pyport.h" -#endif -#endif - -#ifndef LONG_MIN -#define LONG_MIN (-LONG_MAX-1) -#endif - -#ifndef LONG_BIT -#define LONG_BIT (8 * SIZEOF_LONG) -#endif - -#if LONG_BIT != 8 * SIZEOF_LONG -/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent - * 32-bit platforms using gcc. We try to catch that here at compile-time - * rather than waiting for integer multiplication to trigger bogus - * overflows. - */ -#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." -#endif - -#ifdef __cplusplus -} -#endif - -/* - * Hide GCC attributes from compilers that don't support them. - */ -#if (!defined(__GNUC__) || __GNUC__ < 2 || \ - (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ - !defined(RISCOS) -#define Py_GCC_ATTRIBUTE(x) -#else -#define Py_GCC_ATTRIBUTE(x) __attribute__(x) -#endif - -/* - * Add PyArg_ParseTuple format where available. - */ -#ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE -#define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2))) -#else -#define Py_FORMAT_PARSETUPLE(func,p1,p2) -#endif - -/* - * Specify alignment on compilers that support it. - */ -#if defined(__GNUC__) && __GNUC__ >= 3 -#define Py_ALIGNED(x) __attribute__((aligned(x))) -#else -#define Py_ALIGNED(x) -#endif - -/* Eliminate end-of-loop code not reached warnings from SunPro C - * when using do{...}while(0) macros - */ -#ifdef __SUNPRO_C -#pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) -#endif - -/* - * Older Microsoft compilers don't support the C99 long long literal suffixes, - * so these will be defined in PC/pyconfig.h for those compilers. - */ -#ifndef Py_LL -#define Py_LL(x) x##LL -#endif - -#ifndef Py_ULL -#define Py_ULL(x) Py_LL(x##U) -#endif - -#endif /* Py_PYPORT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pystate.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pystate.h deleted file mode 100644 index 62ada41..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pystate.h +++ /dev/null @@ -1,200 +0,0 @@ - -/* Thread and interpreter state structures and their interfaces */ - - -#ifndef Py_PYSTATE_H -#define Py_PYSTATE_H -#ifdef __cplusplus -extern "C" { -#endif - -/* State shared between threads */ - -struct _ts; /* Forward */ -struct _is; /* Forward */ - -typedef struct _is { - - struct _is *next; - struct _ts *tstate_head; - - PyObject *modules; - PyObject *sysdict; - PyObject *builtins; - PyObject *modules_reloading; - - PyObject *codec_search_path; - PyObject *codec_search_cache; - PyObject *codec_error_registry; - -#ifdef HAVE_DLOPEN - int dlopenflags; -#endif -#ifdef WITH_TSC - int tscdump; -#endif - -} PyInterpreterState; - - -/* State unique per thread */ - -struct _frame; /* Avoid including frameobject.h */ - -/* Py_tracefunc return -1 when raising an exception, or 0 for success. */ -typedef int (*Py_tracefunc)(PyObject *, struct _frame *, int, PyObject *); - -/* The following values are used for 'what' for tracefunc functions: */ -#define PyTrace_CALL 0 -#define PyTrace_EXCEPTION 1 -#define PyTrace_LINE 2 -#define PyTrace_RETURN 3 -#define PyTrace_C_CALL 4 -#define PyTrace_C_EXCEPTION 5 -#define PyTrace_C_RETURN 6 - -typedef struct _ts { - /* See Python/ceval.c for comments explaining most fields */ - - struct _ts *next; - PyInterpreterState *interp; - - struct _frame *frame; - int recursion_depth; - /* 'tracing' keeps track of the execution depth when tracing/profiling. - This is to prevent the actual trace/profile code from being recorded in - the trace/profile. */ - int tracing; - int use_tracing; - - Py_tracefunc c_profilefunc; - Py_tracefunc c_tracefunc; - PyObject *c_profileobj; - PyObject *c_traceobj; - - PyObject *curexc_type; - PyObject *curexc_value; - PyObject *curexc_traceback; - - PyObject *exc_type; - PyObject *exc_value; - PyObject *exc_traceback; - - PyObject *dict; /* Stores per-thread state */ - - /* tick_counter is incremented whenever the check_interval ticker - * reaches zero. The purpose is to give a useful measure of the number - * of interpreted bytecode instructions in a given thread. This - * extremely lightweight statistic collector may be of interest to - * profilers (like psyco.jit()), although nothing in the core uses it. - */ - int tick_counter; - - int gilstate_counter; - - PyObject *async_exc; /* Asynchronous exception to raise */ - long thread_id; /* Thread id where this tstate was created */ - - int trash_delete_nesting; - PyObject *trash_delete_later; - - /* XXX signal handlers should also be here */ - -} PyThreadState; - - -PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_New(void); -PyAPI_FUNC(void) PyInterpreterState_Clear(PyInterpreterState *); -PyAPI_FUNC(void) PyInterpreterState_Delete(PyInterpreterState *); - -PyAPI_FUNC(PyThreadState *) PyThreadState_New(PyInterpreterState *); -PyAPI_FUNC(PyThreadState *) _PyThreadState_Prealloc(PyInterpreterState *); -PyAPI_FUNC(void) _PyThreadState_Init(PyThreadState *); -PyAPI_FUNC(void) PyThreadState_Clear(PyThreadState *); -PyAPI_FUNC(void) PyThreadState_Delete(PyThreadState *); -#ifdef WITH_THREAD -PyAPI_FUNC(void) PyThreadState_DeleteCurrent(void); -#endif - -PyAPI_FUNC(PyThreadState *) PyThreadState_Get(void); -PyAPI_FUNC(PyThreadState *) PyThreadState_Swap(PyThreadState *); -PyAPI_FUNC(PyObject *) PyThreadState_GetDict(void); -PyAPI_FUNC(int) PyThreadState_SetAsyncExc(long, PyObject *); - - -/* Variable and macro for in-line access to current thread state */ - -PyAPI_DATA(PyThreadState *) _PyThreadState_Current; - -#ifdef Py_DEBUG -#define PyThreadState_GET() PyThreadState_Get() -#else -#define PyThreadState_GET() (_PyThreadState_Current) -#endif - -typedef - enum {PyGILState_LOCKED, PyGILState_UNLOCKED} - PyGILState_STATE; - -/* Ensure that the current thread is ready to call the Python - C API, regardless of the current state of Python, or of its - thread lock. This may be called as many times as desired - by a thread so long as each call is matched with a call to - PyGILState_Release(). In general, other thread-state APIs may - be used between _Ensure() and _Release() calls, so long as the - thread-state is restored to its previous state before the Release(). - For example, normal use of the Py_BEGIN_ALLOW_THREADS/ - Py_END_ALLOW_THREADS macros are acceptable. - - The return value is an opaque "handle" to the thread state when - PyGILState_Ensure() was called, and must be passed to - PyGILState_Release() to ensure Python is left in the same state. Even - though recursive calls are allowed, these handles can *not* be shared - - each unique call to PyGILState_Ensure must save the handle for its - call to PyGILState_Release. - - When the function returns, the current thread will hold the GIL. - - Failure is a fatal error. -*/ -PyAPI_FUNC(PyGILState_STATE) PyGILState_Ensure(void); - -/* Release any resources previously acquired. After this call, Python's - state will be the same as it was prior to the corresponding - PyGILState_Ensure() call (but generally this state will be unknown to - the caller, hence the use of the GILState API.) - - Every call to PyGILState_Ensure must be matched by a call to - PyGILState_Release on the same thread. -*/ -PyAPI_FUNC(void) PyGILState_Release(PyGILState_STATE); - -/* Helper/diagnostic function - get the current thread state for - this thread. May return NULL if no GILState API has been used - on the current thread. Note that the main thread always has such a - thread-state, even if no auto-thread-state call has been made - on the main thread. -*/ -PyAPI_FUNC(PyThreadState *) PyGILState_GetThisThreadState(void); - -/* The implementation of sys._current_frames() Returns a dict mapping - thread id to that thread's current frame. -*/ -PyAPI_FUNC(PyObject *) _PyThread_CurrentFrames(void); - -/* Routines for advanced debuggers, requested by David Beazley. - Don't use unless you know what you are doing! */ -PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Head(void); -PyAPI_FUNC(PyInterpreterState *) PyInterpreterState_Next(PyInterpreterState *); -PyAPI_FUNC(PyThreadState *) PyInterpreterState_ThreadHead(PyInterpreterState *); -PyAPI_FUNC(PyThreadState *) PyThreadState_Next(PyThreadState *); - -typedef struct _frame *(*PyThreadFrameGetter)(PyThreadState *self_); - -/* hook for PyEval_GetFrame(), requested for Psyco */ -PyAPI_DATA(PyThreadFrameGetter) _PyThreadState_GetFrame; - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PYSTATE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pystrcmp.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pystrcmp.h deleted file mode 100644 index 542399d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pystrcmp.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef Py_STRCMP_H -#define Py_STRCMP_H - -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(int) PyOS_mystrnicmp(const char *, const char *, Py_ssize_t); -PyAPI_FUNC(int) PyOS_mystricmp(const char *, const char *); - -#if defined(MS_WINDOWS) || defined(PYOS_OS2) -#define PyOS_strnicmp strnicmp -#define PyOS_stricmp stricmp -#else -#define PyOS_strnicmp PyOS_mystrnicmp -#define PyOS_stricmp PyOS_mystricmp -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* !Py_STRCMP_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pystrtod.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pystrtod.h deleted file mode 100644 index f2ecc60..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pystrtod.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef Py_STRTOD_H -#define Py_STRTOD_H - -#ifdef __cplusplus -extern "C" { -#endif - - -PyAPI_FUNC(double) PyOS_ascii_strtod(const char *str, char **ptr); -PyAPI_FUNC(double) PyOS_ascii_atof(const char *str); - -/* Deprecated in 2.7 and 3.1. Will disappear in 2.8 (if it exists) and 3.2 */ -PyAPI_FUNC(char *) PyOS_ascii_formatd(char *buffer, size_t buf_len, - const char *format, double d); -PyAPI_FUNC(double) PyOS_string_to_double(const char *str, - char **endptr, - PyObject *overflow_exception); - -/* The caller is responsible for calling PyMem_Free to free the buffer - that's is returned. */ -PyAPI_FUNC(char *) PyOS_double_to_string(double val, - char format_code, - int precision, - int flags, - int *type); - -PyAPI_FUNC(double) _Py_parse_inf_or_nan(const char *p, char **endptr); - - -/* PyOS_double_to_string's "flags" parameter can be set to 0 or more of: */ -#define Py_DTSF_SIGN 0x01 /* always add the sign */ -#define Py_DTSF_ADD_DOT_0 0x02 /* if the result is an integer add ".0" */ -#define Py_DTSF_ALT 0x04 /* "alternate" formatting. it's format_code - specific */ - -/* PyOS_double_to_string's "type", if non-NULL, will be set to one of: */ -#define Py_DTST_FINITE 0 -#define Py_DTST_INFINITE 1 -#define Py_DTST_NAN 2 - -#ifdef __cplusplus -} -#endif - -#endif /* !Py_STRTOD_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pythonrun.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pythonrun.h deleted file mode 100644 index 58e1831..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pythonrun.h +++ /dev/null @@ -1,182 +0,0 @@ - -/* Interfaces to parse and execute pieces of python code */ - -#ifndef Py_PYTHONRUN_H -#define Py_PYTHONRUN_H -#ifdef __cplusplus -extern "C" { -#endif - -#define PyCF_MASK (CO_FUTURE_DIVISION | CO_FUTURE_ABSOLUTE_IMPORT | \ - CO_FUTURE_WITH_STATEMENT | CO_FUTURE_PRINT_FUNCTION | \ - CO_FUTURE_UNICODE_LITERALS) -#define PyCF_MASK_OBSOLETE (CO_NESTED) -#define PyCF_SOURCE_IS_UTF8 0x0100 -#define PyCF_DONT_IMPLY_DEDENT 0x0200 -#define PyCF_ONLY_AST 0x0400 - -typedef struct { - int cf_flags; /* bitmask of CO_xxx flags relevant to future */ -} PyCompilerFlags; - -PyAPI_FUNC(void) Py_SetProgramName(char *); -PyAPI_FUNC(char *) Py_GetProgramName(void); - -PyAPI_FUNC(void) Py_SetPythonHome(char *); -PyAPI_FUNC(char *) Py_GetPythonHome(void); - -PyAPI_FUNC(void) Py_Initialize(void); -PyAPI_FUNC(void) Py_InitializeEx(int); -PyAPI_FUNC(void) Py_Finalize(void); -PyAPI_FUNC(int) Py_IsInitialized(void); -PyAPI_FUNC(PyThreadState *) Py_NewInterpreter(void); -PyAPI_FUNC(void) Py_EndInterpreter(PyThreadState *); - -PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_AnyFileExFlags(FILE *, const char *, int, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_SimpleFileExFlags(FILE *, const char *, int, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_InteractiveOneFlags(FILE *, const char *, PyCompilerFlags *); -PyAPI_FUNC(int) PyRun_InteractiveLoopFlags(FILE *, const char *, PyCompilerFlags *); - -PyAPI_FUNC(struct _mod *) PyParser_ASTFromString(const char *, const char *, - int, PyCompilerFlags *flags, - PyArena *); -PyAPI_FUNC(struct _mod *) PyParser_ASTFromFile(FILE *, const char *, int, - char *, char *, - PyCompilerFlags *, int *, - PyArena *); -#define PyParser_SimpleParseString(S, B) \ - PyParser_SimpleParseStringFlags(S, B, 0) -#define PyParser_SimpleParseFile(FP, S, B) \ - PyParser_SimpleParseFileFlags(FP, S, B, 0) -PyAPI_FUNC(struct _node *) PyParser_SimpleParseStringFlags(const char *, int, - int); -PyAPI_FUNC(struct _node *) PyParser_SimpleParseFileFlags(FILE *, const char *, - int, int); - -PyAPI_FUNC(PyObject *) PyRun_StringFlags(const char *, int, PyObject *, - PyObject *, PyCompilerFlags *); - -PyAPI_FUNC(PyObject *) PyRun_FileExFlags(FILE *, const char *, int, - PyObject *, PyObject *, int, - PyCompilerFlags *); - -#define Py_CompileString(str, p, s) Py_CompileStringFlags(str, p, s, NULL) -PyAPI_FUNC(PyObject *) Py_CompileStringFlags(const char *, const char *, int, - PyCompilerFlags *); -PyAPI_FUNC(struct symtable *) Py_SymtableString(const char *, const char *, int); - -PyAPI_FUNC(void) PyErr_Print(void); -PyAPI_FUNC(void) PyErr_PrintEx(int); -PyAPI_FUNC(void) PyErr_Display(PyObject *, PyObject *, PyObject *); - -PyAPI_FUNC(int) Py_AtExit(void (*func)(void)); - -PyAPI_FUNC(void) Py_Exit(int); - -PyAPI_FUNC(int) Py_FdIsInteractive(FILE *, const char *); - -/* Bootstrap */ -PyAPI_FUNC(int) Py_Main(int argc, char **argv); - -/* Use macros for a bunch of old variants */ -#define PyRun_String(str, s, g, l) PyRun_StringFlags(str, s, g, l, NULL) -#define PyRun_AnyFile(fp, name) PyRun_AnyFileExFlags(fp, name, 0, NULL) -#define PyRun_AnyFileEx(fp, name, closeit) \ - PyRun_AnyFileExFlags(fp, name, closeit, NULL) -#define PyRun_AnyFileFlags(fp, name, flags) \ - PyRun_AnyFileExFlags(fp, name, 0, flags) -#define PyRun_SimpleString(s) PyRun_SimpleStringFlags(s, NULL) -#define PyRun_SimpleFile(f, p) PyRun_SimpleFileExFlags(f, p, 0, NULL) -#define PyRun_SimpleFileEx(f, p, c) PyRun_SimpleFileExFlags(f, p, c, NULL) -#define PyRun_InteractiveOne(f, p) PyRun_InteractiveOneFlags(f, p, NULL) -#define PyRun_InteractiveLoop(f, p) PyRun_InteractiveLoopFlags(f, p, NULL) -#define PyRun_File(fp, p, s, g, l) \ - PyRun_FileExFlags(fp, p, s, g, l, 0, NULL) -#define PyRun_FileEx(fp, p, s, g, l, c) \ - PyRun_FileExFlags(fp, p, s, g, l, c, NULL) -#define PyRun_FileFlags(fp, p, s, g, l, flags) \ - PyRun_FileExFlags(fp, p, s, g, l, 0, flags) - -/* In getpath.c */ -PyAPI_FUNC(char *) Py_GetProgramFullPath(void); -PyAPI_FUNC(char *) Py_GetPrefix(void); -PyAPI_FUNC(char *) Py_GetExecPrefix(void); -PyAPI_FUNC(char *) Py_GetPath(void); - -/* In their own files */ -PyAPI_FUNC(const char *) Py_GetVersion(void); -PyAPI_FUNC(const char *) Py_GetPlatform(void); -PyAPI_FUNC(const char *) Py_GetCopyright(void); -PyAPI_FUNC(const char *) Py_GetCompiler(void); -PyAPI_FUNC(const char *) Py_GetBuildInfo(void); -PyAPI_FUNC(const char *) _Py_svnversion(void); -PyAPI_FUNC(const char *) Py_SubversionRevision(void); -PyAPI_FUNC(const char *) Py_SubversionShortBranch(void); -PyAPI_FUNC(const char *) _Py_hgidentifier(void); -PyAPI_FUNC(const char *) _Py_hgversion(void); - -/* Internal -- various one-time initializations */ -PyAPI_FUNC(PyObject *) _PyBuiltin_Init(void); -PyAPI_FUNC(PyObject *) _PySys_Init(void); -PyAPI_FUNC(void) _PyImport_Init(void); -PyAPI_FUNC(void) _PyExc_Init(void); -PyAPI_FUNC(void) _PyImportHooks_Init(void); -PyAPI_FUNC(int) _PyFrame_Init(void); -PyAPI_FUNC(int) _PyInt_Init(void); -PyAPI_FUNC(int) _PyLong_Init(void); -PyAPI_FUNC(void) _PyFloat_Init(void); -PyAPI_FUNC(int) PyByteArray_Init(void); -PyAPI_FUNC(void) _PyRandom_Init(void); - -/* Various internal finalizers */ -PyAPI_FUNC(void) _PyExc_Fini(void); -PyAPI_FUNC(void) _PyImport_Fini(void); -PyAPI_FUNC(void) PyMethod_Fini(void); -PyAPI_FUNC(void) PyFrame_Fini(void); -PyAPI_FUNC(void) PyCFunction_Fini(void); -PyAPI_FUNC(void) PyDict_Fini(void); -PyAPI_FUNC(void) PyTuple_Fini(void); -PyAPI_FUNC(void) PyList_Fini(void); -PyAPI_FUNC(void) PySet_Fini(void); -PyAPI_FUNC(void) PyString_Fini(void); -PyAPI_FUNC(void) PyInt_Fini(void); -PyAPI_FUNC(void) PyFloat_Fini(void); -PyAPI_FUNC(void) PyOS_FiniInterrupts(void); -PyAPI_FUNC(void) PyByteArray_Fini(void); -PyAPI_FUNC(void) _PyRandom_Fini(void); - -/* Stuff with no proper home (yet) */ -PyAPI_FUNC(char *) PyOS_Readline(FILE *, FILE *, char *); -PyAPI_DATA(int) (*PyOS_InputHook)(void); -PyAPI_DATA(char) *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); -PyAPI_DATA(PyThreadState*) _PyOS_ReadlineTState; - -/* Stack size, in "pointers" (so we get extra safety margins - on 64-bit platforms). On a 32-bit platform, this translates - to a 8k margin. */ -#define PYOS_STACK_MARGIN 2048 - -#if defined(WIN32) && !defined(MS_WIN64) && defined(_MSC_VER) && _MSC_VER >= 1300 -/* Enable stack checking under Microsoft C */ -#define USE_STACKCHECK -#endif - -#ifdef USE_STACKCHECK -/* Check that we aren't overflowing our stack */ -PyAPI_FUNC(int) PyOS_CheckStack(void); -#endif - -/* Signals */ -typedef void (*PyOS_sighandler_t)(int); -PyAPI_FUNC(PyOS_sighandler_t) PyOS_getsig(int); -PyAPI_FUNC(PyOS_sighandler_t) PyOS_setsig(int, PyOS_sighandler_t); - -/* Random */ -PyAPI_FUNC(int) _PyOS_URandom (void *buffer, Py_ssize_t size); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PYTHONRUN_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/pythread.h b/AppPkg/Applications/Python/Python-2.7.10/Include/pythread.h deleted file mode 100644 index d3c587b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/pythread.h +++ /dev/null @@ -1,41 +0,0 @@ - -#ifndef Py_PYTHREAD_H -#define Py_PYTHREAD_H - -typedef void *PyThread_type_lock; -typedef void *PyThread_type_sema; - -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(void) PyThread_init_thread(void); -PyAPI_FUNC(long) PyThread_start_new_thread(void (*)(void *), void *); -PyAPI_FUNC(void) PyThread_exit_thread(void); -PyAPI_FUNC(long) PyThread_get_thread_ident(void); - -PyAPI_FUNC(PyThread_type_lock) PyThread_allocate_lock(void); -PyAPI_FUNC(void) PyThread_free_lock(PyThread_type_lock); -PyAPI_FUNC(int) PyThread_acquire_lock(PyThread_type_lock, int); -#define WAIT_LOCK 1 -#define NOWAIT_LOCK 0 -PyAPI_FUNC(void) PyThread_release_lock(PyThread_type_lock); - -PyAPI_FUNC(size_t) PyThread_get_stacksize(void); -PyAPI_FUNC(int) PyThread_set_stacksize(size_t); - -/* Thread Local Storage (TLS) API */ -PyAPI_FUNC(int) PyThread_create_key(void); -PyAPI_FUNC(void) PyThread_delete_key(int); -PyAPI_FUNC(int) PyThread_set_key_value(int, void *); -PyAPI_FUNC(void *) PyThread_get_key_value(int); -PyAPI_FUNC(void) PyThread_delete_key_value(int key); - -/* Cleanup after a fork */ -PyAPI_FUNC(void) PyThread_ReInitTLS(void); - -#ifdef __cplusplus -} -#endif - -#endif /* !Py_PYTHREAD_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/rangeobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/rangeobject.h deleted file mode 100644 index b8dcb40..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/rangeobject.h +++ /dev/null @@ -1,28 +0,0 @@ - -/* Range object interface */ - -#ifndef Py_RANGEOBJECT_H -#define Py_RANGEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -/* This is about the type 'xrange', not the built-in function range(), which - returns regular lists. */ - -/* -A range object represents an integer range. This is an immutable object; -a range cannot change its value after creation. - -Range objects behave like the corresponding tuple objects except that -they are represented by a start, stop, and step datamembers. -*/ - -PyAPI_DATA(PyTypeObject) PyRange_Type; - -#define PyRange_Check(op) (Py_TYPE(op) == &PyRange_Type) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_RANGEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/setobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/setobject.h deleted file mode 100644 index 6ded153..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/setobject.h +++ /dev/null @@ -1,99 +0,0 @@ -/* Set object interface */ - -#ifndef Py_SETOBJECT_H -#define Py_SETOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* -There are three kinds of slots in the table: - -1. Unused: key == NULL -2. Active: key != NULL and key != dummy -3. Dummy: key == dummy - -Note: .pop() abuses the hash field of an Unused or Dummy slot to -hold a search finger. The hash field of Unused or Dummy slots has -no meaning otherwise. -*/ - -#define PySet_MINSIZE 8 - -typedef struct { - long hash; /* cached hash code for the entry key */ - PyObject *key; -} setentry; - - -/* -This data structure is shared by set and frozenset objects. -*/ - -typedef struct _setobject PySetObject; -struct _setobject { - PyObject_HEAD - - Py_ssize_t fill; /* # Active + # Dummy */ - Py_ssize_t used; /* # Active */ - - /* The table contains mask + 1 slots, and that's a power of 2. - * We store the mask instead of the size because the mask is more - * frequently needed. - */ - Py_ssize_t mask; - - /* table points to smalltable for small tables, else to - * additional malloc'ed memory. table is never NULL! This rule - * saves repeated runtime null-tests. - */ - setentry *table; - setentry *(*lookup)(PySetObject *so, PyObject *key, long hash); - setentry smalltable[PySet_MINSIZE]; - - long hash; /* only used by frozenset objects */ - PyObject *weakreflist; /* List of weak references */ -}; - -PyAPI_DATA(PyTypeObject) PySet_Type; -PyAPI_DATA(PyTypeObject) PyFrozenSet_Type; - -/* Invariants for frozensets: - * data is immutable. - * hash is the hash of the frozenset or -1 if not computed yet. - * Invariants for sets: - * hash is -1 - */ - -#define PyFrozenSet_CheckExact(ob) (Py_TYPE(ob) == &PyFrozenSet_Type) -#define PyAnySet_CheckExact(ob) \ - (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type) -#define PyAnySet_Check(ob) \ - (Py_TYPE(ob) == &PySet_Type || Py_TYPE(ob) == &PyFrozenSet_Type || \ - PyType_IsSubtype(Py_TYPE(ob), &PySet_Type) || \ - PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) -#define PySet_Check(ob) \ - (Py_TYPE(ob) == &PySet_Type || \ - PyType_IsSubtype(Py_TYPE(ob), &PySet_Type)) -#define PyFrozenSet_Check(ob) \ - (Py_TYPE(ob) == &PyFrozenSet_Type || \ - PyType_IsSubtype(Py_TYPE(ob), &PyFrozenSet_Type)) - -PyAPI_FUNC(PyObject *) PySet_New(PyObject *); -PyAPI_FUNC(PyObject *) PyFrozenSet_New(PyObject *); -PyAPI_FUNC(Py_ssize_t) PySet_Size(PyObject *anyset); -#define PySet_GET_SIZE(so) (((PySetObject *)(so))->used) -PyAPI_FUNC(int) PySet_Clear(PyObject *set); -PyAPI_FUNC(int) PySet_Contains(PyObject *anyset, PyObject *key); -PyAPI_FUNC(int) PySet_Discard(PyObject *set, PyObject *key); -PyAPI_FUNC(int) PySet_Add(PyObject *set, PyObject *key); -PyAPI_FUNC(int) _PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key); -PyAPI_FUNC(int) _PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash); -PyAPI_FUNC(PyObject *) PySet_Pop(PyObject *set); -PyAPI_FUNC(int) _PySet_Update(PyObject *set, PyObject *iterable); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_SETOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/sliceobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/sliceobject.h deleted file mode 100644 index 469921a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/sliceobject.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef Py_SLICEOBJECT_H -#define Py_SLICEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -/* The unique ellipsis object "..." */ - -PyAPI_DATA(PyObject) _Py_EllipsisObject; /* Don't use this directly */ - -#define Py_Ellipsis (&_Py_EllipsisObject) - -/* Slice object interface */ - -/* - -A slice object containing start, stop, and step data members (the -names are from range). After much talk with Guido, it was decided to -let these be any arbitrary python type. Py_None stands for omitted values. -*/ - -typedef struct { - PyObject_HEAD - PyObject *start, *stop, *step; /* not NULL */ -} PySliceObject; - -PyAPI_DATA(PyTypeObject) PySlice_Type; -PyAPI_DATA(PyTypeObject) PyEllipsis_Type; - -#define PySlice_Check(op) (Py_TYPE(op) == &PySlice_Type) - -PyAPI_FUNC(PyObject *) PySlice_New(PyObject* start, PyObject* stop, - PyObject* step); -PyAPI_FUNC(PyObject *) _PySlice_FromIndices(Py_ssize_t start, Py_ssize_t stop); -PyAPI_FUNC(int) PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step); -PyAPI_FUNC(int) PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, - Py_ssize_t *step, Py_ssize_t *slicelength); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_SLICEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/stringobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/stringobject.h deleted file mode 100644 index d20d986..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/stringobject.h +++ /dev/null @@ -1,210 +0,0 @@ - -/* String (str/bytes) object interface */ - -#ifndef Py_STRINGOBJECT_H -#define Py_STRINGOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -#include - -/* -Type PyStringObject represents a character string. An extra zero byte is -reserved at the end to ensure it is zero-terminated, but a size is -present so strings with null bytes in them can be represented. This -is an immutable object type. - -There are functions to create new string objects, to test -an object for string-ness, and to get the -string value. The latter function returns a null pointer -if the object is not of the proper type. -There is a variant that takes an explicit size as well as a -variant that assumes a zero-terminated string. Note that none of the -functions should be applied to nil objects. -*/ - -/* Caching the hash (ob_shash) saves recalculation of a string's hash value. - Interning strings (ob_sstate) tries to ensure that only one string - object with a given value exists, so equality tests can be one pointer - comparison. This is generally restricted to strings that "look like" - Python identifiers, although the intern() builtin can be used to force - interning of any string. - Together, these sped the interpreter by up to 20%. */ - -typedef struct { - PyObject_VAR_HEAD - long ob_shash; - int ob_sstate; - char ob_sval[1]; - - /* Invariants: - * ob_sval contains space for 'ob_size+1' elements. - * ob_sval[ob_size] == 0. - * ob_shash is the hash of the string or -1 if not computed yet. - * ob_sstate != 0 iff the string object is in stringobject.c's - * 'interned' dictionary; in this case the two references - * from 'interned' to this object are *not counted* in ob_refcnt. - */ -} PyStringObject; - -#define SSTATE_NOT_INTERNED 0 -#define SSTATE_INTERNED_MORTAL 1 -#define SSTATE_INTERNED_IMMORTAL 2 - -PyAPI_DATA(PyTypeObject) PyBaseString_Type; -PyAPI_DATA(PyTypeObject) PyString_Type; - -#define PyString_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_STRING_SUBCLASS) -#define PyString_CheckExact(op) (Py_TYPE(op) == &PyString_Type) - -PyAPI_FUNC(PyObject *) PyString_FromStringAndSize(const char *, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyString_FromString(const char *); -PyAPI_FUNC(PyObject *) PyString_FromFormatV(const char*, va_list) - Py_GCC_ATTRIBUTE((format(printf, 1, 0))); -PyAPI_FUNC(PyObject *) PyString_FromFormat(const char*, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(Py_ssize_t) PyString_Size(PyObject *); -PyAPI_FUNC(char *) PyString_AsString(PyObject *); -PyAPI_FUNC(PyObject *) PyString_Repr(PyObject *, int); -PyAPI_FUNC(void) PyString_Concat(PyObject **, PyObject *); -PyAPI_FUNC(void) PyString_ConcatAndDel(PyObject **, PyObject *); -PyAPI_FUNC(int) _PyString_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(int) _PyString_Eq(PyObject *, PyObject*); -PyAPI_FUNC(PyObject *) PyString_Format(PyObject *, PyObject *); -PyAPI_FUNC(PyObject *) _PyString_FormatLong(PyObject*, int, int, - int, char**, int*); -PyAPI_FUNC(PyObject *) PyString_DecodeEscape(const char *, Py_ssize_t, - const char *, Py_ssize_t, - const char *); - -PyAPI_FUNC(void) PyString_InternInPlace(PyObject **); -PyAPI_FUNC(void) PyString_InternImmortal(PyObject **); -PyAPI_FUNC(PyObject *) PyString_InternFromString(const char *); -PyAPI_FUNC(void) _Py_ReleaseInternedStrings(void); - -/* Use only if you know it's a string */ -#define PyString_CHECK_INTERNED(op) (((PyStringObject *)(op))->ob_sstate) - -/* Macro, trading safety for speed */ -#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval) -#define PyString_GET_SIZE(op) Py_SIZE(op) - -/* _PyString_Join(sep, x) is like sep.join(x). sep must be PyStringObject*, - x must be an iterable object. */ -PyAPI_FUNC(PyObject *) _PyString_Join(PyObject *sep, PyObject *x); - -/* --- Generic Codecs ----------------------------------------------------- */ - -/* Create an object by decoding the encoded string s of the - given size. */ - -PyAPI_FUNC(PyObject*) PyString_Decode( - const char *s, /* encoded string */ - Py_ssize_t size, /* size of buffer */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a char buffer of the given size and returns a - Python object. */ - -PyAPI_FUNC(PyObject*) PyString_Encode( - const char *s, /* string char buffer */ - Py_ssize_t size, /* number of chars to encode */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a string object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyString_AsEncodedObject( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a string object and returns the result as Python string - object. - - If the codec returns an Unicode object, the object is converted - back to a string using the default encoding. - - DEPRECATED - use PyString_AsEncodedObject() instead. */ - -PyAPI_FUNC(PyObject*) PyString_AsEncodedString( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decodes a string object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyString_AsDecodedObject( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Decodes a string object and returns the result as Python string - object. - - If the codec returns an Unicode object, the object is converted - back to a string using the default encoding. - - DEPRECATED - use PyString_AsDecodedObject() instead. */ - -PyAPI_FUNC(PyObject*) PyString_AsDecodedString( - PyObject *str, /* string object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Provides access to the internal data buffer and size of a string - object or the default encoded version of an Unicode object. Passing - NULL as *len parameter will force the string buffer to be - 0-terminated (passing a string with embedded NULL characters will - cause an exception). */ - -PyAPI_FUNC(int) PyString_AsStringAndSize( - register PyObject *obj, /* string or Unicode object */ - register char **s, /* pointer to buffer variable */ - register Py_ssize_t *len /* pointer to length variable or NULL - (only possible for 0-terminated - strings) */ - ); - - -/* Using the current locale, insert the thousands grouping - into the string pointed to by buffer. For the argument descriptions, - see Objects/stringlib/localeutil.h */ -PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGroupingLocale(char *buffer, - Py_ssize_t n_buffer, - char *digits, - Py_ssize_t n_digits, - Py_ssize_t min_width); - -/* Using explicit passed-in values, insert the thousands grouping - into the string pointed to by buffer. For the argument descriptions, - see Objects/stringlib/localeutil.h */ -PyAPI_FUNC(Py_ssize_t) _PyString_InsertThousandsGrouping(char *buffer, - Py_ssize_t n_buffer, - char *digits, - Py_ssize_t n_digits, - Py_ssize_t min_width, - const char *grouping, - const char *thousands_sep); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyBytes_FormatAdvanced(PyObject *obj, - char *format_spec, - Py_ssize_t format_spec_len); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_STRINGOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/structmember.h b/AppPkg/Applications/Python/Python-2.7.10/Include/structmember.h deleted file mode 100644 index 8e2425b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/structmember.h +++ /dev/null @@ -1,99 +0,0 @@ -#ifndef Py_STRUCTMEMBER_H -#define Py_STRUCTMEMBER_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Interface to map C struct members to Python object attributes */ - -#include /* For offsetof */ - -/* The offsetof() macro calculates the offset of a structure member - in its structure. Unfortunately this cannot be written down - portably, hence it is provided by a Standard C header file. - For pre-Standard C compilers, here is a version that usually works - (but watch out!): */ - -#ifndef offsetof -#define offsetof(type, member) ( (int) & ((type*)0) -> member ) -#endif - -/* An array of memberlist structures defines the name, type and offset - of selected members of a C structure. These can be read by - PyMember_Get() and set by PyMember_Set() (except if their READONLY flag - is set). The array must be terminated with an entry whose name - pointer is NULL. */ - -struct memberlist { - /* Obsolete version, for binary backwards compatibility */ - char *name; - int type; - int offset; - int flags; -}; - -typedef struct PyMemberDef { - /* Current version, use this */ - char *name; - int type; - Py_ssize_t offset; - int flags; - char *doc; -} PyMemberDef; - -/* Types */ -#define T_SHORT 0 -#define T_INT 1 -#define T_LONG 2 -#define T_FLOAT 3 -#define T_DOUBLE 4 -#define T_STRING 5 -#define T_OBJECT 6 -/* XXX the ordering here is weird for binary compatibility */ -#define T_CHAR 7 /* 1-character string */ -#define T_BYTE 8 /* 8-bit signed int */ -/* unsigned variants: */ -#define T_UBYTE 9 -#define T_USHORT 10 -#define T_UINT 11 -#define T_ULONG 12 - -/* Added by Jack: strings contained in the structure */ -#define T_STRING_INPLACE 13 - -/* Added by Lillo: bools contained in the structure (assumed char) */ -#define T_BOOL 14 - -#define T_OBJECT_EX 16 /* Like T_OBJECT, but raises AttributeError - when the value is NULL, instead of - converting to None. */ -#ifdef HAVE_LONG_LONG -#define T_LONGLONG 17 -#define T_ULONGLONG 18 -#endif /* HAVE_LONG_LONG */ - -#define T_PYSSIZET 19 /* Py_ssize_t */ - - -/* Flags */ -#define READONLY 1 -#define RO READONLY /* Shorthand */ -#define READ_RESTRICTED 2 -#define PY_WRITE_RESTRICTED 4 -#define RESTRICTED (READ_RESTRICTED | PY_WRITE_RESTRICTED) - - -/* Obsolete API, for binary backwards compatibility */ -PyAPI_FUNC(PyObject *) PyMember_Get(const char *, struct memberlist *, const char *); -PyAPI_FUNC(int) PyMember_Set(char *, struct memberlist *, const char *, PyObject *); - -/* Current API, use this */ -PyAPI_FUNC(PyObject *) PyMember_GetOne(const char *, struct PyMemberDef *); -PyAPI_FUNC(int) PyMember_SetOne(char *, struct PyMemberDef *, PyObject *); - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_STRUCTMEMBER_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/structseq.h b/AppPkg/Applications/Python/Python-2.7.10/Include/structseq.h deleted file mode 100644 index 74b1a88..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/structseq.h +++ /dev/null @@ -1,41 +0,0 @@ - -/* Tuple object interface */ - -#ifndef Py_STRUCTSEQ_H -#define Py_STRUCTSEQ_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct PyStructSequence_Field { - char *name; - char *doc; -} PyStructSequence_Field; - -typedef struct PyStructSequence_Desc { - char *name; - char *doc; - struct PyStructSequence_Field *fields; - int n_in_sequence; -} PyStructSequence_Desc; - -extern char* PyStructSequence_UnnamedField; - -PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type, - PyStructSequence_Desc *desc); - -PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type); - -typedef struct { - PyObject_VAR_HEAD - PyObject *ob_item[1]; -} PyStructSequence; - -/* Macro, *only* to be used to fill in brand new objects */ -#define PyStructSequence_SET_ITEM(op, i, v) \ - (((PyStructSequence *)(op))->ob_item[i] = v) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_STRUCTSEQ_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/symtable.h b/AppPkg/Applications/Python/Python-2.7.10/Include/symtable.h deleted file mode 100644 index dd3e360..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/symtable.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef Py_SYMTABLE_H -#define Py_SYMTABLE_H - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum _block_type { FunctionBlock, ClassBlock, ModuleBlock } - _Py_block_ty; - -struct _symtable_entry; - -struct symtable { - const char *st_filename; /* name of file being compiled */ - struct _symtable_entry *st_cur; /* current symbol table entry */ - struct _symtable_entry *st_top; /* module entry */ - PyObject *st_symbols; /* dictionary of symbol table entries */ - PyObject *st_stack; /* stack of namespace info */ - PyObject *st_global; /* borrowed ref to MODULE in st_symbols */ - int st_nblocks; /* number of blocks */ - PyObject *st_private; /* name of current class or NULL */ - PyFutureFeatures *st_future; /* module's future features */ -}; - -typedef struct _symtable_entry { - PyObject_HEAD - PyObject *ste_id; /* int: key in st_symbols */ - PyObject *ste_symbols; /* dict: name to flags */ - PyObject *ste_name; /* string: name of block */ - PyObject *ste_varnames; /* list of variable names */ - PyObject *ste_children; /* list of child ids */ - _Py_block_ty ste_type; /* module, class, or function */ - int ste_unoptimized; /* false if namespace is optimized */ - int ste_nested; /* true if block is nested */ - unsigned ste_free : 1; /* true if block has free variables */ - unsigned ste_child_free : 1; /* true if a child block has free vars, - including free refs to globals */ - unsigned ste_generator : 1; /* true if namespace is a generator */ - unsigned ste_varargs : 1; /* true if block has varargs */ - unsigned ste_varkeywords : 1; /* true if block has varkeywords */ - unsigned ste_returns_value : 1; /* true if namespace uses return with - an argument */ - int ste_lineno; /* first line of block */ - int ste_opt_lineno; /* lineno of last exec or import * */ - int ste_tmpname; /* counter for listcomp temp vars */ - struct symtable *ste_table; -} PySTEntryObject; - -PyAPI_DATA(PyTypeObject) PySTEntry_Type; - -#define PySTEntry_Check(op) (Py_TYPE(op) == &PySTEntry_Type) - -PyAPI_FUNC(int) PyST_GetScope(PySTEntryObject *, PyObject *); - -PyAPI_FUNC(struct symtable *) PySymtable_Build(mod_ty, const char *, - PyFutureFeatures *); -PyAPI_FUNC(PySTEntryObject *) PySymtable_Lookup(struct symtable *, void *); - -PyAPI_FUNC(void) PySymtable_Free(struct symtable *); - -/* Flags for def-use information */ - -#define DEF_GLOBAL 1 /* global stmt */ -#define DEF_LOCAL 2 /* assignment in code block */ -#define DEF_PARAM 2<<1 /* formal parameter */ -#define USE 2<<2 /* name is used */ -#define DEF_FREE 2<<3 /* name used but not defined in nested block */ -#define DEF_FREE_CLASS 2<<4 /* free variable from class's method */ -#define DEF_IMPORT 2<<5 /* assignment occurred via import */ - -#define DEF_BOUND (DEF_LOCAL | DEF_PARAM | DEF_IMPORT) - -/* GLOBAL_EXPLICIT and GLOBAL_IMPLICIT are used internally by the symbol - table. GLOBAL is returned from PyST_GetScope() for either of them. - It is stored in ste_symbols at bits 12-14. -*/ -#define SCOPE_OFF 11 -#define SCOPE_MASK 7 - -#define LOCAL 1 -#define GLOBAL_EXPLICIT 2 -#define GLOBAL_IMPLICIT 3 -#define FREE 4 -#define CELL 5 - -/* The following three names are used for the ste_unoptimized bit field */ -#define OPT_IMPORT_STAR 1 -#define OPT_EXEC 2 -#define OPT_BARE_EXEC 4 -#define OPT_TOPLEVEL 8 /* top-level names, including eval and exec */ - -#define GENERATOR 1 -#define GENERATOR_EXPRESSION 2 - -#ifdef __cplusplus -} -#endif -#endif /* !Py_SYMTABLE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/sysmodule.h b/AppPkg/Applications/Python/Python-2.7.10/Include/sysmodule.h deleted file mode 100644 index 5a8bee7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/sysmodule.h +++ /dev/null @@ -1,31 +0,0 @@ - -/* System module interface */ - -#ifndef Py_SYSMODULE_H -#define Py_SYSMODULE_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(PyObject *) PySys_GetObject(char *); -PyAPI_FUNC(int) PySys_SetObject(char *, PyObject *); -PyAPI_FUNC(FILE *) PySys_GetFile(char *, FILE *); -PyAPI_FUNC(void) PySys_SetArgv(int, char **); -PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int); -PyAPI_FUNC(void) PySys_SetPath(char *); - -PyAPI_FUNC(void) PySys_WriteStdout(const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); -PyAPI_FUNC(void) PySys_WriteStderr(const char *format, ...) - Py_GCC_ATTRIBUTE((format(printf, 1, 2))); - -PyAPI_FUNC(void) PySys_ResetWarnOptions(void); -PyAPI_FUNC(void) PySys_AddWarnOption(char *); -PyAPI_FUNC(int) PySys_HasWarnOptions(void); - -PyAPI_FUNC(size_t) _PySys_GetSizeOf(PyObject *); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_SYSMODULE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/timefuncs.h b/AppPkg/Applications/Python/Python-2.7.10/Include/timefuncs.h deleted file mode 100644 index ae5acf7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/timefuncs.h +++ /dev/null @@ -1,26 +0,0 @@ -/* timefuncs.h - */ - -/* Utility function related to timemodule.c. */ - -#ifndef TIMEFUNCS_H -#define TIMEFUNCS_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Cast double x to time_t, but raise ValueError if x is too large - * to fit in a time_t. ValueError is set on return iff the return - * value is (time_t)-1 and PyErr_Occurred(). - */ -PyAPI_FUNC(time_t) _PyTime_DoubleToTimet(double x); - -/* Get the current time since the epoch in seconds */ -PyAPI_FUNC(double) _PyTime_FloatTime(void); - - -#ifdef __cplusplus -} -#endif -#endif /* TIMEFUNCS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/token.h b/AppPkg/Applications/Python/Python-2.7.10/Include/token.h deleted file mode 100644 index 438f04b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/token.h +++ /dev/null @@ -1,85 +0,0 @@ - -/* Token types */ - -#ifndef Py_TOKEN_H -#define Py_TOKEN_H -#ifdef __cplusplus -extern "C" { -#endif - -#undef TILDE /* Prevent clash of our definition with system macro. Ex AIX, ioctl.h */ - -#define ENDMARKER 0 -#define NAME 1 -#define NUMBER 2 -#define STRING 3 -#define NEWLINE 4 -#define INDENT 5 -#define DEDENT 6 -#define LPAR 7 -#define RPAR 8 -#define LSQB 9 -#define RSQB 10 -#define COLON 11 -#define COMMA 12 -#define SEMI 13 -#define PLUS 14 -#define MINUS 15 -#define STAR 16 -#define SLASH 17 -#define VBAR 18 -#define AMPER 19 -#define LESS 20 -#define GREATER 21 -#define EQUAL 22 -#define DOT 23 -#define PERCENT 24 -#define BACKQUOTE 25 -#define LBRACE 26 -#define RBRACE 27 -#define EQEQUAL 28 -#define NOTEQUAL 29 -#define LESSEQUAL 30 -#define GREATEREQUAL 31 -#define TILDE 32 -#define CIRCUMFLEX 33 -#define LEFTSHIFT 34 -#define RIGHTSHIFT 35 -#define DOUBLESTAR 36 -#define PLUSEQUAL 37 -#define MINEQUAL 38 -#define STAREQUAL 39 -#define SLASHEQUAL 40 -#define PERCENTEQUAL 41 -#define AMPEREQUAL 42 -#define VBAREQUAL 43 -#define CIRCUMFLEXEQUAL 44 -#define LEFTSHIFTEQUAL 45 -#define RIGHTSHIFTEQUAL 46 -#define DOUBLESTAREQUAL 47 -#define DOUBLESLASH 48 -#define DOUBLESLASHEQUAL 49 -#define AT 50 -/* Don't forget to update the table _PyParser_TokenNames in tokenizer.c! */ -#define OP 51 -#define ERRORTOKEN 52 -#define N_TOKENS 53 - -/* Special definitions for cooperation with parser */ - -#define NT_OFFSET 256 - -#define ISTERMINAL(x) ((x) < NT_OFFSET) -#define ISNONTERMINAL(x) ((x) >= NT_OFFSET) -#define ISEOF(x) ((x) == ENDMARKER) - - -PyAPI_DATA(char *) _PyParser_TokenNames[]; /* Token names */ -PyAPI_FUNC(int) PyToken_OneChar(int); -PyAPI_FUNC(int) PyToken_TwoChars(int, int); -PyAPI_FUNC(int) PyToken_ThreeChars(int, int, int); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_TOKEN_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/traceback.h b/AppPkg/Applications/Python/Python-2.7.10/Include/traceback.h deleted file mode 100644 index fce0607..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/traceback.h +++ /dev/null @@ -1,31 +0,0 @@ - -#ifndef Py_TRACEBACK_H -#define Py_TRACEBACK_H -#ifdef __cplusplus -extern "C" { -#endif - -struct _frame; - -/* Traceback interface */ - -typedef struct _traceback { - PyObject_HEAD - struct _traceback *tb_next; - struct _frame *tb_frame; - int tb_lasti; - int tb_lineno; -} PyTracebackObject; - -PyAPI_FUNC(int) PyTraceBack_Here(struct _frame *); -PyAPI_FUNC(int) PyTraceBack_Print(PyObject *, PyObject *); -PyAPI_FUNC(int) _Py_DisplaySourceLine(PyObject *, const char *, int, int); - -/* Reveal traceback type so we can typecheck traceback objects */ -PyAPI_DATA(PyTypeObject) PyTraceBack_Type; -#define PyTraceBack_Check(v) (Py_TYPE(v) == &PyTraceBack_Type) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_TRACEBACK_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h deleted file mode 100644 index 8fdfd59..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/tupleobject.h +++ /dev/null @@ -1,61 +0,0 @@ - -/* Tuple object interface */ - -#ifndef Py_TUPLEOBJECT_H -#define Py_TUPLEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -/* -Another generally useful object type is a tuple of object pointers. -For Python, this is an immutable type. C code can change the tuple items -(but not their number), and even use tuples are general-purpose arrays of -object references, but in general only brand new tuples should be mutated, -not ones that might already have been exposed to Python code. - -*** WARNING *** PyTuple_SetItem does not increment the new item's reference -count, but does decrement the reference count of the item it replaces, -if not nil. It does *decrement* the reference count if it is *not* -inserted in the tuple. Similarly, PyTuple_GetItem does not increment the -returned item's reference count. -*/ - -typedef struct { - PyObject_VAR_HEAD - PyObject *ob_item[1]; - - /* ob_item contains space for 'ob_size' elements. - * Items must normally not be NULL, except during construction when - * the tuple is not yet visible outside the function that builds it. - */ -} PyTupleObject; - -PyAPI_DATA(PyTypeObject) PyTuple_Type; - -#define PyTuple_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_TUPLE_SUBCLASS) -#define PyTuple_CheckExact(op) (Py_TYPE(op) == &PyTuple_Type) - -PyAPI_FUNC(PyObject *) PyTuple_New(Py_ssize_t size); -PyAPI_FUNC(Py_ssize_t) PyTuple_Size(PyObject *); -PyAPI_FUNC(PyObject *) PyTuple_GetItem(PyObject *, Py_ssize_t); -PyAPI_FUNC(int) PyTuple_SetItem(PyObject *, Py_ssize_t, PyObject *); -PyAPI_FUNC(PyObject *) PyTuple_GetSlice(PyObject *, Py_ssize_t, Py_ssize_t); -PyAPI_FUNC(int) _PyTuple_Resize(PyObject **, Py_ssize_t); -PyAPI_FUNC(PyObject *) PyTuple_Pack(Py_ssize_t, ...); -PyAPI_FUNC(void) _PyTuple_MaybeUntrack(PyObject *); - -/* Macro, trading safety for speed */ -#define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i]) -#define PyTuple_GET_SIZE(op) Py_SIZE(op) - -/* Macro, *only* to be used to fill in brand new tuples */ -#define PyTuple_SET_ITEM(op, i, v) (((PyTupleObject *)(op))->ob_item[i] = v) - -PyAPI_FUNC(int) PyTuple_ClearFreeList(void); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_TUPLEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/ucnhash.h b/AppPkg/Applications/Python/Python-2.7.10/Include/ucnhash.h deleted file mode 100644 index 8158730..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/ucnhash.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Unicode name database interface */ - -#ifndef Py_UCNHASH_H -#define Py_UCNHASH_H -#ifdef __cplusplus -extern "C" { -#endif - -/* revised ucnhash CAPI interface (exported through a "wrapper") */ - -#define PyUnicodeData_CAPSULE_NAME "unicodedata.ucnhash_CAPI" - -typedef struct { - - /* Size of this struct */ - int size; - - /* Get name for a given character code. Returns non-zero if - success, zero if not. Does not set Python exceptions. - If self is NULL, data come from the default version of the database. - If it is not NULL, it should be a unicodedata.ucd_X_Y_Z object */ - int (*getname)(PyObject *self, Py_UCS4 code, char* buffer, int buflen); - - /* Get character code for a given name. Same error handling - as for getname. */ - int (*getcode)(PyObject *self, const char* name, int namelen, Py_UCS4* code); - -} _PyUnicode_Name_CAPI; - -#ifdef __cplusplus -} -#endif -#endif /* !Py_UCNHASH_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/unicodeobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/unicodeobject.h deleted file mode 100644 index de52416..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/unicodeobject.h +++ /dev/null @@ -1,1413 +0,0 @@ -#ifndef Py_UNICODEOBJECT_H -#define Py_UNICODEOBJECT_H - -#include - -/* - -Unicode implementation based on original code by Fredrik Lundh, -modified by Marc-Andre Lemburg (mal@lemburg.com) according to the -Unicode Integration Proposal (see file Misc/unicode.txt). - -Copyright (c) Corporation for National Research Initiatives. - - - Original header: - -------------------------------------------------------------------- - - * Yet another Unicode string type for Python. This type supports the - * 16-bit Basic Multilingual Plane (BMP) only. - * - * Written by Fredrik Lundh, January 1999. - * - * Copyright (c) 1999 by Secret Labs AB. - * Copyright (c) 1999 by Fredrik Lundh. - * - * fredrik@pythonware.com - * http://www.pythonware.com - * - * -------------------------------------------------------------------- - * This Unicode String Type is - * - * Copyright (c) 1999 by Secret Labs AB - * Copyright (c) 1999 by Fredrik Lundh - * - * By obtaining, using, and/or copying this software and/or its - * associated documentation, you agree that you have read, understood, - * and will comply with the following terms and conditions: - * - * Permission to use, copy, modify, and distribute this software and its - * associated documentation for any purpose and without fee is hereby - * granted, provided that the above copyright notice appears in all - * copies, and that both that copyright notice and this permission notice - * appear in supporting documentation, and that the name of Secret Labs - * AB or the author not be used in advertising or publicity pertaining to - * distribution of the software without specific, written prior - * permission. - * - * SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * -------------------------------------------------------------------- */ - -#include - -/* === Internal API ======================================================= */ - -/* --- Internal Unicode Format -------------------------------------------- */ - -#ifndef Py_USING_UNICODE - -#define PyUnicode_Check(op) 0 -#define PyUnicode_CheckExact(op) 0 - -#else - -/* FIXME: MvL's new implementation assumes that Py_UNICODE_SIZE is - properly set, but the default rules below doesn't set it. I'll - sort this out some other day -- fredrik@pythonware.com */ - -#ifndef Py_UNICODE_SIZE -#error Must define Py_UNICODE_SIZE -#endif - -/* Setting Py_UNICODE_WIDE enables UCS-4 storage. Otherwise, Unicode - strings are stored as UCS-2 (with limited support for UTF-16) */ - -#if Py_UNICODE_SIZE >= 4 -#define Py_UNICODE_WIDE -#endif - -/* Set these flags if the platform has "wchar.h", "wctype.h" and the - wchar_t type is a 16-bit unsigned type */ -/* #define HAVE_WCHAR_H */ -/* #define HAVE_USABLE_WCHAR_T */ - -/* Defaults for various platforms */ -#ifndef PY_UNICODE_TYPE - -/* Windows has a usable wchar_t type (unless we're using UCS-4) */ -# if defined(MS_WIN32) && Py_UNICODE_SIZE == 2 -# define HAVE_USABLE_WCHAR_T -# define PY_UNICODE_TYPE wchar_t -# endif - -# if defined(Py_UNICODE_WIDE) -# define PY_UNICODE_TYPE Py_UCS4 -# endif - -#endif - -/* If the compiler provides a wchar_t type we try to support it - through the interface functions PyUnicode_FromWideChar() and - PyUnicode_AsWideChar(). */ - -#ifdef HAVE_USABLE_WCHAR_T -# ifndef HAVE_WCHAR_H -# define HAVE_WCHAR_H -# endif -#endif - -#ifdef HAVE_WCHAR_H -/* Work around a cosmetic bug in BSDI 4.x wchar.h; thanks to Thomas Wouters */ -# ifdef _HAVE_BSDI -# include -# endif -# include -#endif - -/* - * Use this typedef when you need to represent a UTF-16 surrogate pair - * as single unsigned integer. - */ -#if SIZEOF_INT >= 4 -typedef unsigned int Py_UCS4; -#elif SIZEOF_LONG >= 4 -typedef unsigned long Py_UCS4; -#endif - -/* Py_UNICODE is the native Unicode storage format (code unit) used by - Python and represents a single Unicode element in the Unicode - type. */ - -typedef PY_UNICODE_TYPE Py_UNICODE; - -/* --- UCS-2/UCS-4 Name Mangling ------------------------------------------ */ - -/* Unicode API names are mangled to assure that UCS-2 and UCS-4 builds - produce different external names and thus cause import errors in - case Python interpreters and extensions with mixed compiled in - Unicode width assumptions are combined. */ - -#ifndef Py_UNICODE_WIDE - -# define PyUnicode_AsASCIIString PyUnicodeUCS2_AsASCIIString -# define PyUnicode_AsCharmapString PyUnicodeUCS2_AsCharmapString -# define PyUnicode_AsEncodedObject PyUnicodeUCS2_AsEncodedObject -# define PyUnicode_AsEncodedString PyUnicodeUCS2_AsEncodedString -# define PyUnicode_AsLatin1String PyUnicodeUCS2_AsLatin1String -# define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS2_AsRawUnicodeEscapeString -# define PyUnicode_AsUTF32String PyUnicodeUCS2_AsUTF32String -# define PyUnicode_AsUTF16String PyUnicodeUCS2_AsUTF16String -# define PyUnicode_AsUTF8String PyUnicodeUCS2_AsUTF8String -# define PyUnicode_AsUnicode PyUnicodeUCS2_AsUnicode -# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS2_AsUnicodeEscapeString -# define PyUnicode_AsWideChar PyUnicodeUCS2_AsWideChar -# define PyUnicode_ClearFreeList PyUnicodeUCS2_ClearFreelist -# define PyUnicode_Compare PyUnicodeUCS2_Compare -# define PyUnicode_Concat PyUnicodeUCS2_Concat -# define PyUnicode_Contains PyUnicodeUCS2_Contains -# define PyUnicode_Count PyUnicodeUCS2_Count -# define PyUnicode_Decode PyUnicodeUCS2_Decode -# define PyUnicode_DecodeASCII PyUnicodeUCS2_DecodeASCII -# define PyUnicode_DecodeCharmap PyUnicodeUCS2_DecodeCharmap -# define PyUnicode_DecodeLatin1 PyUnicodeUCS2_DecodeLatin1 -# define PyUnicode_DecodeRawUnicodeEscape PyUnicodeUCS2_DecodeRawUnicodeEscape -# define PyUnicode_DecodeUTF32 PyUnicodeUCS2_DecodeUTF32 -# define PyUnicode_DecodeUTF32Stateful PyUnicodeUCS2_DecodeUTF32Stateful -# define PyUnicode_DecodeUTF16 PyUnicodeUCS2_DecodeUTF16 -# define PyUnicode_DecodeUTF16Stateful PyUnicodeUCS2_DecodeUTF16Stateful -# define PyUnicode_DecodeUTF8 PyUnicodeUCS2_DecodeUTF8 -# define PyUnicode_DecodeUTF8Stateful PyUnicodeUCS2_DecodeUTF8Stateful -# define PyUnicode_DecodeUnicodeEscape PyUnicodeUCS2_DecodeUnicodeEscape -# define PyUnicode_Encode PyUnicodeUCS2_Encode -# define PyUnicode_EncodeASCII PyUnicodeUCS2_EncodeASCII -# define PyUnicode_EncodeCharmap PyUnicodeUCS2_EncodeCharmap -# define PyUnicode_EncodeDecimal PyUnicodeUCS2_EncodeDecimal -# define PyUnicode_EncodeLatin1 PyUnicodeUCS2_EncodeLatin1 -# define PyUnicode_EncodeRawUnicodeEscape PyUnicodeUCS2_EncodeRawUnicodeEscape -# define PyUnicode_EncodeUTF32 PyUnicodeUCS2_EncodeUTF32 -# define PyUnicode_EncodeUTF16 PyUnicodeUCS2_EncodeUTF16 -# define PyUnicode_EncodeUTF8 PyUnicodeUCS2_EncodeUTF8 -# define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS2_EncodeUnicodeEscape -# define PyUnicode_Find PyUnicodeUCS2_Find -# define PyUnicode_Format PyUnicodeUCS2_Format -# define PyUnicode_FromEncodedObject PyUnicodeUCS2_FromEncodedObject -# define PyUnicode_FromFormat PyUnicodeUCS2_FromFormat -# define PyUnicode_FromFormatV PyUnicodeUCS2_FromFormatV -# define PyUnicode_FromObject PyUnicodeUCS2_FromObject -# define PyUnicode_FromOrdinal PyUnicodeUCS2_FromOrdinal -# define PyUnicode_FromString PyUnicodeUCS2_FromString -# define PyUnicode_FromStringAndSize PyUnicodeUCS2_FromStringAndSize -# define PyUnicode_FromUnicode PyUnicodeUCS2_FromUnicode -# define PyUnicode_FromWideChar PyUnicodeUCS2_FromWideChar -# define PyUnicode_GetDefaultEncoding PyUnicodeUCS2_GetDefaultEncoding -# define PyUnicode_GetMax PyUnicodeUCS2_GetMax -# define PyUnicode_GetSize PyUnicodeUCS2_GetSize -# define PyUnicode_Join PyUnicodeUCS2_Join -# define PyUnicode_Partition PyUnicodeUCS2_Partition -# define PyUnicode_RPartition PyUnicodeUCS2_RPartition -# define PyUnicode_RSplit PyUnicodeUCS2_RSplit -# define PyUnicode_Replace PyUnicodeUCS2_Replace -# define PyUnicode_Resize PyUnicodeUCS2_Resize -# define PyUnicode_RichCompare PyUnicodeUCS2_RichCompare -# define PyUnicode_SetDefaultEncoding PyUnicodeUCS2_SetDefaultEncoding -# define PyUnicode_Split PyUnicodeUCS2_Split -# define PyUnicode_Splitlines PyUnicodeUCS2_Splitlines -# define PyUnicode_Tailmatch PyUnicodeUCS2_Tailmatch -# define PyUnicode_Translate PyUnicodeUCS2_Translate -# define PyUnicode_TranslateCharmap PyUnicodeUCS2_TranslateCharmap -# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS2_AsDefaultEncodedString -# define _PyUnicode_Fini _PyUnicodeUCS2_Fini -# define _PyUnicode_Init _PyUnicodeUCS2_Init -# define _PyUnicode_IsAlpha _PyUnicodeUCS2_IsAlpha -# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS2_IsDecimalDigit -# define _PyUnicode_IsDigit _PyUnicodeUCS2_IsDigit -# define _PyUnicode_IsLinebreak _PyUnicodeUCS2_IsLinebreak -# define _PyUnicode_IsLowercase _PyUnicodeUCS2_IsLowercase -# define _PyUnicode_IsNumeric _PyUnicodeUCS2_IsNumeric -# define _PyUnicode_IsTitlecase _PyUnicodeUCS2_IsTitlecase -# define _PyUnicode_IsUppercase _PyUnicodeUCS2_IsUppercase -# define _PyUnicode_IsWhitespace _PyUnicodeUCS2_IsWhitespace -# define _PyUnicode_ToDecimalDigit _PyUnicodeUCS2_ToDecimalDigit -# define _PyUnicode_ToDigit _PyUnicodeUCS2_ToDigit -# define _PyUnicode_ToLowercase _PyUnicodeUCS2_ToLowercase -# define _PyUnicode_ToNumeric _PyUnicodeUCS2_ToNumeric -# define _PyUnicode_ToTitlecase _PyUnicodeUCS2_ToTitlecase -# define _PyUnicode_ToUppercase _PyUnicodeUCS2_ToUppercase - -#else - -# define PyUnicode_AsASCIIString PyUnicodeUCS4_AsASCIIString -# define PyUnicode_AsCharmapString PyUnicodeUCS4_AsCharmapString -# define PyUnicode_AsEncodedObject PyUnicodeUCS4_AsEncodedObject -# define PyUnicode_AsEncodedString PyUnicodeUCS4_AsEncodedString -# define PyUnicode_AsLatin1String PyUnicodeUCS4_AsLatin1String -# define PyUnicode_AsRawUnicodeEscapeString PyUnicodeUCS4_AsRawUnicodeEscapeString -# define PyUnicode_AsUTF32String PyUnicodeUCS4_AsUTF32String -# define PyUnicode_AsUTF16String PyUnicodeUCS4_AsUTF16String -# define PyUnicode_AsUTF8String PyUnicodeUCS4_AsUTF8String -# define PyUnicode_AsUnicode PyUnicodeUCS4_AsUnicode -# define PyUnicode_AsUnicodeEscapeString PyUnicodeUCS4_AsUnicodeEscapeString -# define PyUnicode_AsWideChar PyUnicodeUCS4_AsWideChar -# define PyUnicode_ClearFreeList PyUnicodeUCS4_ClearFreelist -# define PyUnicode_Compare PyUnicodeUCS4_Compare -# define PyUnicode_Concat PyUnicodeUCS4_Concat -# define PyUnicode_Contains PyUnicodeUCS4_Contains -# define PyUnicode_Count PyUnicodeUCS4_Count -# define PyUnicode_Decode PyUnicodeUCS4_Decode -# define PyUnicode_DecodeASCII PyUnicodeUCS4_DecodeASCII -# define PyUnicode_DecodeCharmap PyUnicodeUCS4_DecodeCharmap -# define PyUnicode_DecodeLatin1 PyUnicodeUCS4_DecodeLatin1 -# define PyUnicode_DecodeRawUnicodeEscape PyUnicodeUCS4_DecodeRawUnicodeEscape -# define PyUnicode_DecodeUTF32 PyUnicodeUCS4_DecodeUTF32 -# define PyUnicode_DecodeUTF32Stateful PyUnicodeUCS4_DecodeUTF32Stateful -# define PyUnicode_DecodeUTF16 PyUnicodeUCS4_DecodeUTF16 -# define PyUnicode_DecodeUTF16Stateful PyUnicodeUCS4_DecodeUTF16Stateful -# define PyUnicode_DecodeUTF8 PyUnicodeUCS4_DecodeUTF8 -# define PyUnicode_DecodeUTF8Stateful PyUnicodeUCS4_DecodeUTF8Stateful -# define PyUnicode_DecodeUnicodeEscape PyUnicodeUCS4_DecodeUnicodeEscape -# define PyUnicode_Encode PyUnicodeUCS4_Encode -# define PyUnicode_EncodeASCII PyUnicodeUCS4_EncodeASCII -# define PyUnicode_EncodeCharmap PyUnicodeUCS4_EncodeCharmap -# define PyUnicode_EncodeDecimal PyUnicodeUCS4_EncodeDecimal -# define PyUnicode_EncodeLatin1 PyUnicodeUCS4_EncodeLatin1 -# define PyUnicode_EncodeRawUnicodeEscape PyUnicodeUCS4_EncodeRawUnicodeEscape -# define PyUnicode_EncodeUTF32 PyUnicodeUCS4_EncodeUTF32 -# define PyUnicode_EncodeUTF16 PyUnicodeUCS4_EncodeUTF16 -# define PyUnicode_EncodeUTF8 PyUnicodeUCS4_EncodeUTF8 -# define PyUnicode_EncodeUnicodeEscape PyUnicodeUCS4_EncodeUnicodeEscape -# define PyUnicode_Find PyUnicodeUCS4_Find -# define PyUnicode_Format PyUnicodeUCS4_Format -# define PyUnicode_FromEncodedObject PyUnicodeUCS4_FromEncodedObject -# define PyUnicode_FromFormat PyUnicodeUCS4_FromFormat -# define PyUnicode_FromFormatV PyUnicodeUCS4_FromFormatV -# define PyUnicode_FromObject PyUnicodeUCS4_FromObject -# define PyUnicode_FromOrdinal PyUnicodeUCS4_FromOrdinal -# define PyUnicode_FromString PyUnicodeUCS4_FromString -# define PyUnicode_FromStringAndSize PyUnicodeUCS4_FromStringAndSize -# define PyUnicode_FromUnicode PyUnicodeUCS4_FromUnicode -# define PyUnicode_FromWideChar PyUnicodeUCS4_FromWideChar -# define PyUnicode_GetDefaultEncoding PyUnicodeUCS4_GetDefaultEncoding -# define PyUnicode_GetMax PyUnicodeUCS4_GetMax -# define PyUnicode_GetSize PyUnicodeUCS4_GetSize -# define PyUnicode_Join PyUnicodeUCS4_Join -# define PyUnicode_Partition PyUnicodeUCS4_Partition -# define PyUnicode_RPartition PyUnicodeUCS4_RPartition -# define PyUnicode_RSplit PyUnicodeUCS4_RSplit -# define PyUnicode_Replace PyUnicodeUCS4_Replace -# define PyUnicode_Resize PyUnicodeUCS4_Resize -# define PyUnicode_RichCompare PyUnicodeUCS4_RichCompare -# define PyUnicode_SetDefaultEncoding PyUnicodeUCS4_SetDefaultEncoding -# define PyUnicode_Split PyUnicodeUCS4_Split -# define PyUnicode_Splitlines PyUnicodeUCS4_Splitlines -# define PyUnicode_Tailmatch PyUnicodeUCS4_Tailmatch -# define PyUnicode_Translate PyUnicodeUCS4_Translate -# define PyUnicode_TranslateCharmap PyUnicodeUCS4_TranslateCharmap -# define _PyUnicode_AsDefaultEncodedString _PyUnicodeUCS4_AsDefaultEncodedString -# define _PyUnicode_Fini _PyUnicodeUCS4_Fini -# define _PyUnicode_Init _PyUnicodeUCS4_Init -# define _PyUnicode_IsAlpha _PyUnicodeUCS4_IsAlpha -# define _PyUnicode_IsDecimalDigit _PyUnicodeUCS4_IsDecimalDigit -# define _PyUnicode_IsDigit _PyUnicodeUCS4_IsDigit -# define _PyUnicode_IsLinebreak _PyUnicodeUCS4_IsLinebreak -# define _PyUnicode_IsLowercase _PyUnicodeUCS4_IsLowercase -# define _PyUnicode_IsNumeric _PyUnicodeUCS4_IsNumeric -# define _PyUnicode_IsTitlecase _PyUnicodeUCS4_IsTitlecase -# define _PyUnicode_IsUppercase _PyUnicodeUCS4_IsUppercase -# define _PyUnicode_IsWhitespace _PyUnicodeUCS4_IsWhitespace -# define _PyUnicode_ToDecimalDigit _PyUnicodeUCS4_ToDecimalDigit -# define _PyUnicode_ToDigit _PyUnicodeUCS4_ToDigit -# define _PyUnicode_ToLowercase _PyUnicodeUCS4_ToLowercase -# define _PyUnicode_ToNumeric _PyUnicodeUCS4_ToNumeric -# define _PyUnicode_ToTitlecase _PyUnicodeUCS4_ToTitlecase -# define _PyUnicode_ToUppercase _PyUnicodeUCS4_ToUppercase - - -#endif - -/* --- Internal Unicode Operations ---------------------------------------- */ - -/* If you want Python to use the compiler's wctype.h functions instead - of the ones supplied with Python, define WANT_WCTYPE_FUNCTIONS or - configure Python using --with-wctype-functions. This reduces the - interpreter's code size. */ - -#if defined(HAVE_USABLE_WCHAR_T) && defined(WANT_WCTYPE_FUNCTIONS) - -#include - -#define Py_UNICODE_ISSPACE(ch) iswspace(ch) - -#define Py_UNICODE_ISLOWER(ch) iswlower(ch) -#define Py_UNICODE_ISUPPER(ch) iswupper(ch) -#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) -#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) - -#define Py_UNICODE_TOLOWER(ch) towlower(ch) -#define Py_UNICODE_TOUPPER(ch) towupper(ch) -#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) - -#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) -#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) -#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) - -#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) -#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) -#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) - -#define Py_UNICODE_ISALPHA(ch) iswalpha(ch) - -#else - -/* Since splitting on whitespace is an important use case, and - whitespace in most situations is solely ASCII whitespace, we - optimize for the common case by using a quick look-up table - _Py_ascii_whitespace (see below) with an inlined check. - - */ -#define Py_UNICODE_ISSPACE(ch) \ - ((ch) < 128U ? _Py_ascii_whitespace[(ch)] : _PyUnicode_IsWhitespace(ch)) - -#define Py_UNICODE_ISLOWER(ch) _PyUnicode_IsLowercase(ch) -#define Py_UNICODE_ISUPPER(ch) _PyUnicode_IsUppercase(ch) -#define Py_UNICODE_ISTITLE(ch) _PyUnicode_IsTitlecase(ch) -#define Py_UNICODE_ISLINEBREAK(ch) _PyUnicode_IsLinebreak(ch) - -#define Py_UNICODE_TOLOWER(ch) _PyUnicode_ToLowercase(ch) -#define Py_UNICODE_TOUPPER(ch) _PyUnicode_ToUppercase(ch) -#define Py_UNICODE_TOTITLE(ch) _PyUnicode_ToTitlecase(ch) - -#define Py_UNICODE_ISDECIMAL(ch) _PyUnicode_IsDecimalDigit(ch) -#define Py_UNICODE_ISDIGIT(ch) _PyUnicode_IsDigit(ch) -#define Py_UNICODE_ISNUMERIC(ch) _PyUnicode_IsNumeric(ch) - -#define Py_UNICODE_TODECIMAL(ch) _PyUnicode_ToDecimalDigit(ch) -#define Py_UNICODE_TODIGIT(ch) _PyUnicode_ToDigit(ch) -#define Py_UNICODE_TONUMERIC(ch) _PyUnicode_ToNumeric(ch) - -#define Py_UNICODE_ISALPHA(ch) _PyUnicode_IsAlpha(ch) - -#endif - -#define Py_UNICODE_ISALNUM(ch) \ - (Py_UNICODE_ISALPHA(ch) || \ - Py_UNICODE_ISDECIMAL(ch) || \ - Py_UNICODE_ISDIGIT(ch) || \ - Py_UNICODE_ISNUMERIC(ch)) - -#define Py_UNICODE_COPY(target, source, length) \ - Py_MEMCPY((target), (source), (length)*sizeof(Py_UNICODE)) - -#define Py_UNICODE_FILL(target, value, length) \ - do {Py_ssize_t i_; Py_UNICODE *t_ = (target); Py_UNICODE v_ = (value);\ - for (i_ = 0; i_ < (length); i_++) t_[i_] = v_;\ - } while (0) - -/* Check if substring matches at given offset. the offset must be - valid, and the substring must not be empty */ - -#define Py_UNICODE_MATCH(string, offset, substring) \ - ((*((string)->str + (offset)) == *((substring)->str)) && \ - ((*((string)->str + (offset) + (substring)->length-1) == *((substring)->str + (substring)->length-1))) && \ - !memcmp((string)->str + (offset), (substring)->str, (substring)->length*sizeof(Py_UNICODE))) - -#ifdef __cplusplus -extern "C" { -#endif - -/* --- Unicode Type ------------------------------------------------------- */ - -typedef struct { - PyObject_HEAD - Py_ssize_t length; /* Length of raw Unicode data in buffer */ - Py_UNICODE *str; /* Raw Unicode buffer */ - long hash; /* Hash value; -1 if not set */ - PyObject *defenc; /* (Default) Encoded version as Python - string, or NULL; this is used for - implementing the buffer protocol */ -} PyUnicodeObject; - -PyAPI_DATA(PyTypeObject) PyUnicode_Type; - -#define PyUnicode_Check(op) \ - PyType_FastSubclass(Py_TYPE(op), Py_TPFLAGS_UNICODE_SUBCLASS) -#define PyUnicode_CheckExact(op) (Py_TYPE(op) == &PyUnicode_Type) - -/* Fast access macros */ -#define PyUnicode_GET_SIZE(op) \ - (((PyUnicodeObject *)(op))->length) -#define PyUnicode_GET_DATA_SIZE(op) \ - (((PyUnicodeObject *)(op))->length * sizeof(Py_UNICODE)) -#define PyUnicode_AS_UNICODE(op) \ - (((PyUnicodeObject *)(op))->str) -#define PyUnicode_AS_DATA(op) \ - ((const char *)((PyUnicodeObject *)(op))->str) - -/* --- Constants ---------------------------------------------------------- */ - -/* This Unicode character will be used as replacement character during - decoding if the errors argument is set to "replace". Note: the - Unicode character U+FFFD is the official REPLACEMENT CHARACTER in - Unicode 3.0. */ - -#define Py_UNICODE_REPLACEMENT_CHARACTER ((Py_UNICODE) 0xFFFD) - -/* === Public API ========================================================= */ - -/* --- Plain Py_UNICODE --------------------------------------------------- */ - -/* Create a Unicode Object from the Py_UNICODE buffer u of the given - size. - - u may be NULL which causes the contents to be undefined. It is the - user's responsibility to fill in the needed data afterwards. Note - that modifying the Unicode object contents after construction is - only allowed if u was set to NULL. - - The buffer is copied into the new object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_FromUnicode( - const Py_UNICODE *u, /* Unicode buffer */ - Py_ssize_t size /* size of buffer */ - ); - -/* Similar to PyUnicode_FromUnicode(), but u points to Latin-1 encoded bytes */ -PyAPI_FUNC(PyObject*) PyUnicode_FromStringAndSize( - const char *u, /* char buffer */ - Py_ssize_t size /* size of buffer */ - ); - -/* Similar to PyUnicode_FromUnicode(), but u points to null-terminated - Latin-1 encoded bytes */ -PyAPI_FUNC(PyObject*) PyUnicode_FromString( - const char *u /* string */ - ); - -/* Return a read-only pointer to the Unicode object's internal - Py_UNICODE buffer. */ - -PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode( - PyObject *unicode /* Unicode object */ - ); - -/* Get the length of the Unicode object. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_GetSize( - PyObject *unicode /* Unicode object */ - ); - -/* Get the maximum ordinal for a Unicode character. */ -PyAPI_FUNC(Py_UNICODE) PyUnicode_GetMax(void); - -/* Resize an already allocated Unicode object to the new size length. - - *unicode is modified to point to the new (resized) object and 0 - returned on success. - - This API may only be called by the function which also called the - Unicode constructor. The refcount on the object must be 1. Otherwise, - an error is returned. - - Error handling is implemented as follows: an exception is set, -1 - is returned and *unicode left untouched. - -*/ - -PyAPI_FUNC(int) PyUnicode_Resize( - PyObject **unicode, /* Pointer to the Unicode object */ - Py_ssize_t length /* New length */ - ); - -/* Coerce obj to an Unicode object and return a reference with - *incremented* refcount. - - Coercion is done in the following way: - - 1. String and other char buffer compatible objects are decoded - under the assumptions that they contain data using the current - default encoding. Decoding is done in "strict" mode. - - 2. All other objects (including Unicode objects) raise an - exception. - - The API returns NULL in case of an error. The caller is responsible - for decref'ing the returned objects. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_FromEncodedObject( - register PyObject *obj, /* Object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Coerce obj to an Unicode object and return a reference with - *incremented* refcount. - - Unicode objects are passed back as-is (subclasses are converted to - true Unicode objects), all other objects are delegated to - PyUnicode_FromEncodedObject(obj, NULL, "strict") which results in - using the default encoding as basis for decoding the object. - - The API returns NULL in case of an error. The caller is responsible - for decref'ing the returned objects. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_FromObject( - register PyObject *obj /* Object */ - ); - -PyAPI_FUNC(PyObject *) PyUnicode_FromFormatV(const char*, va_list); -PyAPI_FUNC(PyObject *) PyUnicode_FromFormat(const char*, ...); - -/* Format the object based on the format_spec, as defined in PEP 3101 - (Advanced String Formatting). */ -PyAPI_FUNC(PyObject *) _PyUnicode_FormatAdvanced(PyObject *obj, - Py_UNICODE *format_spec, - Py_ssize_t format_spec_len); - -/* --- wchar_t support for platforms which support it --------------------- */ - -#ifdef HAVE_WCHAR_H - -/* Create a Unicode Object from the whcar_t buffer w of the given - size. - - The buffer is copied into the new object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_FromWideChar( - register const wchar_t *w, /* wchar_t buffer */ - Py_ssize_t size /* size of buffer */ - ); - -/* Copies the Unicode Object contents into the wchar_t buffer w. At - most size wchar_t characters are copied. - - Note that the resulting wchar_t string may or may not be - 0-terminated. It is the responsibility of the caller to make sure - that the wchar_t string is 0-terminated in case this is required by - the application. - - Returns the number of wchar_t characters copied (excluding a - possibly trailing 0-termination character) or -1 in case of an - error. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_AsWideChar( - PyUnicodeObject *unicode, /* Unicode object */ - register wchar_t *w, /* wchar_t buffer */ - Py_ssize_t size /* size of buffer */ - ); - -#endif - -/* --- Unicode ordinals --------------------------------------------------- */ - -/* Create a Unicode Object from the given Unicode code point ordinal. - - The ordinal must be in range(0x10000) on narrow Python builds - (UCS2), and range(0x110000) on wide builds (UCS4). A ValueError is - raised in case it is not. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_FromOrdinal(int ordinal); - -/* --- Free-list management ----------------------------------------------- */ - -/* Clear the free list used by the Unicode implementation. - - This can be used to release memory used for objects on the free - list back to the Python memory allocator. - -*/ - -PyAPI_FUNC(int) PyUnicode_ClearFreeList(void); - -/* === Builtin Codecs ===================================================== - - Many of these APIs take two arguments encoding and errors. These - parameters encoding and errors have the same semantics as the ones - of the builtin unicode() API. - - Setting encoding to NULL causes the default encoding to be used. - - Error handling is set by errors which may also be set to NULL - meaning to use the default handling defined for the codec. Default - error handling for all builtin codecs is "strict" (ValueErrors are - raised). - - The codecs all use a similar interface. Only deviation from the - generic ones are documented. - -*/ - -/* --- Manage the default encoding ---------------------------------------- */ - -/* Return a Python string holding the default encoded value of the - Unicode object. - - The resulting string is cached in the Unicode object for subsequent - usage by this function. The cached version is needed to implement - the character buffer interface and will live (at least) as long as - the Unicode object itself. - - The refcount of the string is *not* incremented. - - *** Exported for internal use by the interpreter only !!! *** - -*/ - -PyAPI_FUNC(PyObject *) _PyUnicode_AsDefaultEncodedString( - PyObject *, const char *); - -/* Returns the currently active default encoding. - - The default encoding is currently implemented as run-time settable - process global. This may change in future versions of the - interpreter to become a parameter which is managed on a per-thread - basis. - - */ - -PyAPI_FUNC(const char*) PyUnicode_GetDefaultEncoding(void); - -/* Sets the currently active default encoding. - - Returns 0 on success, -1 in case of an error. - - */ - -PyAPI_FUNC(int) PyUnicode_SetDefaultEncoding( - const char *encoding /* Encoding name in standard form */ - ); - -/* --- Generic Codecs ----------------------------------------------------- */ - -/* Create a Unicode object by decoding the encoded string s of the - given size. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Decode( - const char *s, /* encoded string */ - Py_ssize_t size, /* size of buffer */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a Py_UNICODE buffer of the given size and returns a - Python string object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Encode( - const Py_UNICODE *s, /* Unicode char buffer */ - Py_ssize_t size, /* number of Py_UNICODE chars to encode */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a Unicode object and returns the result as Python - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedObject( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -/* Encodes a Unicode object and returns the result as Python string - object. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsEncodedString( - PyObject *unicode, /* Unicode object */ - const char *encoding, /* encoding */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_BuildEncodingMap( - PyObject* string /* 256 character map */ - ); - - -/* --- UTF-7 Codecs ------------------------------------------------------- */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7( - const char *string, /* UTF-7 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF7Stateful( - const char *string, /* UTF-7 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF7( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - int base64SetO, /* Encode RFC2152 Set O characters in base64 */ - int base64WhiteSpace, /* Encode whitespace (sp, ht, nl, cr) in base64 */ - const char *errors /* error handling */ - ); - -/* --- UTF-8 Codecs ------------------------------------------------------- */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8( - const char *string, /* UTF-8 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF8Stateful( - const char *string, /* UTF-8 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsUTF8String( - PyObject *unicode /* Unicode object */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF8( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ - ); - -/* --- UTF-32 Codecs ------------------------------------------------------ */ - -/* Decodes length bytes from a UTF-32 encoded buffer string and returns - the corresponding Unicode object. - - errors (if non-NULL) defines the error handling. It defaults - to "strict". - - If byteorder is non-NULL, the decoder starts decoding using the - given byte order: - - *byteorder == -1: little endian - *byteorder == 0: native order - *byteorder == 1: big endian - - In native mode, the first four bytes of the stream are checked for a - BOM mark. If found, the BOM mark is analysed, the byte order - adjusted and the BOM skipped. In the other modes, no BOM mark - interpretation is done. After completion, *byteorder is set to the - current byte order at the end of input data. - - If byteorder is NULL, the codec starts in native order mode. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32( - const char *string, /* UTF-32 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF32Stateful( - const char *string, /* UTF-32 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder, /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -/* Returns a Python string using the UTF-32 encoding in native byte - order. The string always starts with a BOM mark. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsUTF32String( - PyObject *unicode /* Unicode object */ - ); - -/* Returns a Python string object holding the UTF-32 encoded value of - the Unicode data. - - If byteorder is not 0, output is written according to the following - byte order: - - byteorder == -1: little endian - byteorder == 0: native byte order (writes a BOM mark) - byteorder == 1: big endian - - If byteorder is 0, the output string will always start with the - Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is - prepended. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF32( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - const char *errors, /* error handling */ - int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ - ); - -/* --- UTF-16 Codecs ------------------------------------------------------ */ - -/* Decodes length bytes from a UTF-16 encoded buffer string and returns - the corresponding Unicode object. - - errors (if non-NULL) defines the error handling. It defaults - to "strict". - - If byteorder is non-NULL, the decoder starts decoding using the - given byte order: - - *byteorder == -1: little endian - *byteorder == 0: native order - *byteorder == 1: big endian - - In native mode, the first two bytes of the stream are checked for a - BOM mark. If found, the BOM mark is analysed, the byte order - adjusted and the BOM skipped. In the other modes, no BOM mark - interpretation is done. After completion, *byteorder is set to the - current byte order at the end of input data. - - If byteorder is NULL, the codec starts in native order mode. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16( - const char *string, /* UTF-16 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUTF16Stateful( - const char *string, /* UTF-16 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - int *byteorder, /* pointer to byteorder to use - 0=native;-1=LE,1=BE; updated on - exit */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -/* Returns a Python string using the UTF-16 encoding in native byte - order. The string always starts with a BOM mark. */ - -PyAPI_FUNC(PyObject*) PyUnicode_AsUTF16String( - PyObject *unicode /* Unicode object */ - ); - -/* Returns a Python string object holding the UTF-16 encoded value of - the Unicode data. - - If byteorder is not 0, output is written according to the following - byte order: - - byteorder == -1: little endian - byteorder == 0: native byte order (writes a BOM mark) - byteorder == 1: big endian - - If byteorder is 0, the output string will always start with the - Unicode BOM mark (U+FEFF). In the other two modes, no BOM mark is - prepended. - - Note that Py_UNICODE data is being interpreted as UTF-16 reduced to - UCS-2. This trick makes it possible to add full UTF-16 capabilities - at a later point without compromising the APIs. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUTF16( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* number of Py_UNICODE chars to encode */ - const char *errors, /* error handling */ - int byteorder /* byteorder to use 0=BOM+native;-1=LE,1=BE */ - ); - -/* --- Unicode-Escape Codecs ---------------------------------------------- */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeUnicodeEscape( - const char *string, /* Unicode-Escape encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsUnicodeEscapeString( - PyObject *unicode /* Unicode object */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeUnicodeEscape( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length /* Number of Py_UNICODE chars to encode */ - ); - -/* --- Raw-Unicode-Escape Codecs ------------------------------------------ */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeRawUnicodeEscape( - const char *string, /* Raw-Unicode-Escape encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsRawUnicodeEscapeString( - PyObject *unicode /* Unicode object */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeRawUnicodeEscape( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length /* Number of Py_UNICODE chars to encode */ - ); - -/* --- Unicode Internal Codec --------------------------------------------- - - Only for internal use in _codecsmodule.c */ - -PyObject *_PyUnicode_DecodeUnicodeInternal( - const char *string, - Py_ssize_t length, - const char *errors - ); - -/* --- Latin-1 Codecs ----------------------------------------------------- - - Note: Latin-1 corresponds to the first 256 Unicode ordinals. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeLatin1( - const char *string, /* Latin-1 encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsLatin1String( - PyObject *unicode /* Unicode object */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeLatin1( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ - ); - -/* --- ASCII Codecs ------------------------------------------------------- - - Only 7-bit ASCII data is excepted. All other codes generate errors. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeASCII( - const char *string, /* ASCII encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsASCIIString( - PyObject *unicode /* Unicode object */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeASCII( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ - ); - -/* --- Character Map Codecs ----------------------------------------------- - - This codec uses mappings to encode and decode characters. - - Decoding mappings must map single string characters to single - Unicode characters, integers (which are then interpreted as Unicode - ordinals) or None (meaning "undefined mapping" and causing an - error). - - Encoding mappings must map single Unicode characters to single - string characters, integers (which are then interpreted as Latin-1 - ordinals) or None (meaning "undefined mapping" and causing an - error). - - If a character lookup fails with a LookupError, the character is - copied as-is meaning that its ordinal value will be interpreted as - Unicode or Latin-1 ordinal resp. Because of this mappings only need - to contain those mappings which map characters to different code - points. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeCharmap( - const char *string, /* Encoded string */ - Py_ssize_t length, /* size of string */ - PyObject *mapping, /* character mapping - (char ordinal -> unicode ordinal) */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsCharmapString( - PyObject *unicode, /* Unicode object */ - PyObject *mapping /* character mapping - (unicode ordinal -> char ordinal) */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeCharmap( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - PyObject *mapping, /* character mapping - (unicode ordinal -> char ordinal) */ - const char *errors /* error handling */ - ); - -/* Translate a Py_UNICODE buffer of the given length by applying a - character mapping table to it and return the resulting Unicode - object. - - The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). - - Mapping tables may be dictionaries or sequences. Unmapped character - ordinals (ones which cause a LookupError) are left untouched and - are copied as-is. - -*/ - -PyAPI_FUNC(PyObject *) PyUnicode_TranslateCharmap( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - PyObject *table, /* Translate table */ - const char *errors /* error handling */ - ); - -#ifdef MS_WIN32 - -/* --- MBCS codecs for Windows -------------------------------------------- */ - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCS( - const char *string, /* MBCS encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors /* error handling */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_DecodeMBCSStateful( - const char *string, /* MBCS encoded string */ - Py_ssize_t length, /* size of string */ - const char *errors, /* error handling */ - Py_ssize_t *consumed /* bytes consumed */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_AsMBCSString( - PyObject *unicode /* Unicode object */ - ); - -PyAPI_FUNC(PyObject*) PyUnicode_EncodeMBCS( - const Py_UNICODE *data, /* Unicode char buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - const char *errors /* error handling */ - ); - -#endif /* MS_WIN32 */ - -/* --- Decimal Encoder ---------------------------------------------------- */ - -/* Takes a Unicode string holding a decimal value and writes it into - an output buffer using standard ASCII digit codes. - - The output buffer has to provide at least length+1 bytes of storage - area. The output string is 0-terminated. - - The encoder converts whitespace to ' ', decimal characters to their - corresponding ASCII digit and all other Latin-1 characters except - \0 as-is. Characters outside this range (Unicode ordinals 1-256) - are treated as errors. This includes embedded NULL bytes. - - Error handling is defined by the errors argument: - - NULL or "strict": raise a ValueError - "ignore": ignore the wrong characters (these are not copied to the - output buffer) - "replace": replaces illegal characters with '?' - - Returns 0 on success, -1 on failure. - -*/ - -PyAPI_FUNC(int) PyUnicode_EncodeDecimal( - Py_UNICODE *s, /* Unicode buffer */ - Py_ssize_t length, /* Number of Py_UNICODE chars to encode */ - char *output, /* Output buffer; must have size >= length */ - const char *errors /* error handling */ - ); - -/* --- Methods & Slots ---------------------------------------------------- - - These are capable of handling Unicode objects and strings on input - (we refer to them as strings in the descriptions) and return - Unicode objects or integers as apporpriate. */ - -/* Concat two strings giving a new Unicode string. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Concat( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ - ); - -/* Split a string giving a list of Unicode strings. - - If sep is NULL, splitting will be done at all whitespace - substrings. Otherwise, splits occur at the given separator. - - At most maxsplit splits will be done. If negative, no limit is set. - - Separators are not included in the resulting list. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_Split( - PyObject *s, /* String to split */ - PyObject *sep, /* String separator */ - Py_ssize_t maxsplit /* Maxsplit count */ - ); - -/* Dito, but split at line breaks. - - CRLF is considered to be one line break. Line breaks are not - included in the resulting list. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Splitlines( - PyObject *s, /* String to split */ - int keepends /* If true, line end markers are included */ - ); - -/* Partition a string using a given separator. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Partition( - PyObject *s, /* String to partition */ - PyObject *sep /* String separator */ - ); - -/* Partition a string using a given separator, searching from the end of the - string. */ - -PyAPI_FUNC(PyObject*) PyUnicode_RPartition( - PyObject *s, /* String to partition */ - PyObject *sep /* String separator */ - ); - -/* Split a string giving a list of Unicode strings. - - If sep is NULL, splitting will be done at all whitespace - substrings. Otherwise, splits occur at the given separator. - - At most maxsplit splits will be done. But unlike PyUnicode_Split - PyUnicode_RSplit splits from the end of the string. If negative, - no limit is set. - - Separators are not included in the resulting list. - -*/ - -PyAPI_FUNC(PyObject*) PyUnicode_RSplit( - PyObject *s, /* String to split */ - PyObject *sep, /* String separator */ - Py_ssize_t maxsplit /* Maxsplit count */ - ); - -/* Translate a string by applying a character mapping table to it and - return the resulting Unicode object. - - The mapping table must map Unicode ordinal integers to Unicode - ordinal integers or None (causing deletion of the character). - - Mapping tables may be dictionaries or sequences. Unmapped character - ordinals (ones which cause a LookupError) are left untouched and - are copied as-is. - -*/ - -PyAPI_FUNC(PyObject *) PyUnicode_Translate( - PyObject *str, /* String */ - PyObject *table, /* Translate table */ - const char *errors /* error handling */ - ); - -/* Join a sequence of strings using the given separator and return - the resulting Unicode string. */ - -PyAPI_FUNC(PyObject*) PyUnicode_Join( - PyObject *separator, /* Separator string */ - PyObject *seq /* Sequence object */ - ); - -/* Return 1 if substr matches str[start:end] at the given tail end, 0 - otherwise. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_Tailmatch( - PyObject *str, /* String */ - PyObject *substr, /* Prefix or Suffix string */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end, /* Stop index */ - int direction /* Tail end: -1 prefix, +1 suffix */ - ); - -/* Return the first position of substr in str[start:end] using the - given search direction or -1 if not found. -2 is returned in case - an error occurred and an exception is set. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_Find( - PyObject *str, /* String */ - PyObject *substr, /* Substring to find */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end, /* Stop index */ - int direction /* Find direction: +1 forward, -1 backward */ - ); - -/* Count the number of occurrences of substr in str[start:end]. */ - -PyAPI_FUNC(Py_ssize_t) PyUnicode_Count( - PyObject *str, /* String */ - PyObject *substr, /* Substring to count */ - Py_ssize_t start, /* Start index */ - Py_ssize_t end /* Stop index */ - ); - -/* Replace at most maxcount occurrences of substr in str with replstr - and return the resulting Unicode object. */ - -PyAPI_FUNC(PyObject *) PyUnicode_Replace( - PyObject *str, /* String */ - PyObject *substr, /* Substring to find */ - PyObject *replstr, /* Substring to replace */ - Py_ssize_t maxcount /* Max. number of replacements to apply; - -1 = all */ - ); - -/* Compare two strings and return -1, 0, 1 for less than, equal, - greater than resp. */ - -PyAPI_FUNC(int) PyUnicode_Compare( - PyObject *left, /* Left string */ - PyObject *right /* Right string */ - ); - -/* Rich compare two strings and return one of the following: - - - NULL in case an exception was raised - - Py_True or Py_False for successfuly comparisons - - Py_NotImplemented in case the type combination is unknown - - Note that Py_EQ and Py_NE comparisons can cause a UnicodeWarning in - case the conversion of the arguments to Unicode fails with a - UnicodeDecodeError. - - Possible values for op: - - Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE - -*/ - -PyAPI_FUNC(PyObject *) PyUnicode_RichCompare( - PyObject *left, /* Left string */ - PyObject *right, /* Right string */ - int op /* Operation: Py_EQ, Py_NE, Py_GT, etc. */ - ); - -/* Apply a argument tuple or dictionary to a format string and return - the resulting Unicode string. */ - -PyAPI_FUNC(PyObject *) PyUnicode_Format( - PyObject *format, /* Format string */ - PyObject *args /* Argument tuple or dictionary */ - ); - -/* Checks whether element is contained in container and return 1/0 - accordingly. - - element has to coerce to an one element Unicode string. -1 is - returned in case of an error. */ - -PyAPI_FUNC(int) PyUnicode_Contains( - PyObject *container, /* Container string */ - PyObject *element /* Element string */ - ); - -/* Externally visible for str.strip(unicode) */ -PyAPI_FUNC(PyObject *) _PyUnicode_XStrip( - PyUnicodeObject *self, - int striptype, - PyObject *sepobj - ); - -/* === Characters Type APIs =============================================== */ - -/* Helper array used by Py_UNICODE_ISSPACE(). */ - -PyAPI_DATA(const unsigned char) _Py_ascii_whitespace[]; - -/* These should not be used directly. Use the Py_UNICODE_IS* and - Py_UNICODE_TO* macros instead. - - These APIs are implemented in Objects/unicodectype.c. - -*/ - -PyAPI_FUNC(int) _PyUnicode_IsLowercase( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsUppercase( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsTitlecase( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsWhitespace( - const Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsLinebreak( - const Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToLowercase( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToUppercase( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(Py_UNICODE) _PyUnicode_ToTitlecase( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_ToDecimalDigit( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_ToDigit( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(double) _PyUnicode_ToNumeric( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsDecimalDigit( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsDigit( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsNumeric( - Py_UNICODE ch /* Unicode character */ - ); - -PyAPI_FUNC(int) _PyUnicode_IsAlpha( - Py_UNICODE ch /* Unicode character */ - ); - -#ifdef __cplusplus -} -#endif -#endif /* Py_USING_UNICODE */ -#endif /* !Py_UNICODEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/warnings.h b/AppPkg/Applications/Python/Python-2.7.10/Include/warnings.h deleted file mode 100644 index bf8f963..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/warnings.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef Py_WARNINGS_H -#define Py_WARNINGS_H -#ifdef __cplusplus -extern "C" { -#endif - -PyAPI_FUNC(void) _PyWarnings_Init(void); - -PyAPI_FUNC(int) PyErr_WarnEx(PyObject *, const char *, Py_ssize_t); -PyAPI_FUNC(int) PyErr_WarnExplicit(PyObject *, const char *, const char *, int, - const char *, PyObject *); - -#define PyErr_WarnPy3k(msg, stacklevel) \ - (Py_Py3kWarningFlag ? PyErr_WarnEx(PyExc_DeprecationWarning, msg, stacklevel) : 0) - -/* DEPRECATED: Use PyErr_WarnEx() instead. */ -#define PyErr_Warn(category, msg) PyErr_WarnEx(category, msg, 1) - -#ifdef __cplusplus -} -#endif -#endif /* !Py_WARNINGS_H */ - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Include/weakrefobject.h b/AppPkg/Applications/Python/Python-2.7.10/Include/weakrefobject.h deleted file mode 100644 index 49c23b1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Include/weakrefobject.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Weak references objects for Python. */ - -#ifndef Py_WEAKREFOBJECT_H -#define Py_WEAKREFOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - - -typedef struct _PyWeakReference PyWeakReference; - -/* PyWeakReference is the base struct for the Python ReferenceType, ProxyType, - * and CallableProxyType. - */ -struct _PyWeakReference { - PyObject_HEAD - - /* The object to which this is a weak reference, or Py_None if none. - * Note that this is a stealth reference: wr_object's refcount is - * not incremented to reflect this pointer. - */ - PyObject *wr_object; - - /* A callable to invoke when wr_object dies, or NULL if none. */ - PyObject *wr_callback; - - /* A cache for wr_object's hash code. As usual for hashes, this is -1 - * if the hash code isn't known yet. - */ - long hash; - - /* If wr_object is weakly referenced, wr_object has a doubly-linked NULL- - * terminated list of weak references to it. These are the list pointers. - * If wr_object goes away, wr_object is set to Py_None, and these pointers - * have no meaning then. - */ - PyWeakReference *wr_prev; - PyWeakReference *wr_next; -}; - -PyAPI_DATA(PyTypeObject) _PyWeakref_RefType; -PyAPI_DATA(PyTypeObject) _PyWeakref_ProxyType; -PyAPI_DATA(PyTypeObject) _PyWeakref_CallableProxyType; - -#define PyWeakref_CheckRef(op) PyObject_TypeCheck(op, &_PyWeakref_RefType) -#define PyWeakref_CheckRefExact(op) \ - (Py_TYPE(op) == &_PyWeakref_RefType) -#define PyWeakref_CheckProxy(op) \ - ((Py_TYPE(op) == &_PyWeakref_ProxyType) || \ - (Py_TYPE(op) == &_PyWeakref_CallableProxyType)) - -#define PyWeakref_Check(op) \ - (PyWeakref_CheckRef(op) || PyWeakref_CheckProxy(op)) - - -PyAPI_FUNC(PyObject *) PyWeakref_NewRef(PyObject *ob, - PyObject *callback); -PyAPI_FUNC(PyObject *) PyWeakref_NewProxy(PyObject *ob, - PyObject *callback); -PyAPI_FUNC(PyObject *) PyWeakref_GetObject(PyObject *ref); - -PyAPI_FUNC(Py_ssize_t) _PyWeakref_GetWeakrefCount(PyWeakReference *head); - -PyAPI_FUNC(void) _PyWeakref_ClearRef(PyWeakReference *self); - -/* Explanation for the Py_REFCNT() check: when a weakref's target is part - of a long chain of deallocations which triggers the trashcan mechanism, - clearing the weakrefs can be delayed long after the target's refcount - has dropped to zero. In the meantime, code accessing the weakref will - be able to "see" the target object even though it is supposed to be - unreachable. See issue #16602. */ - -#define PyWeakref_GET_OBJECT(ref) \ - (Py_REFCNT(((PyWeakReference *)(ref))->wr_object) > 0 \ - ? ((PyWeakReference *)(ref))->wr_object \ - : Py_None) - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_WEAKREFOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/LICENSE b/AppPkg/Applications/Python/Python-2.7.10/LICENSE deleted file mode 100644 index d89dbe5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/LICENSE +++ /dev/null @@ -1,254 +0,0 @@ -A. HISTORY OF THE SOFTWARE -========================== - -Python was created in the early 1990s by Guido van Rossum at Stichting -Mathematisch Centrum (CWI, see http://www.cwi.nl) in the Netherlands -as a successor of a language called ABC. Guido remains Python's -principal author, although it includes many contributions from others. - -In 1995, Guido continued his work on Python at the Corporation for -National Research Initiatives (CNRI, see http://www.cnri.reston.va.us) -in Reston, Virginia where he released several versions of the -software. - -In May 2000, Guido and the Python core development team moved to -BeOpen.com to form the BeOpen PythonLabs team. In October of the same -year, the PythonLabs team moved to Digital Creations (now Zope -Corporation, see http://www.zope.com). In 2001, the Python Software -Foundation (PSF, see http://www.python.org/psf/) was formed, a -non-profit organization created specifically to own Python-related -Intellectual Property. Zope Corporation is a sponsoring member of -the PSF. - -All Python releases are Open Source (see http://www.opensource.org for -the Open Source Definition). Historically, most, but not all, Python -releases have also been GPL-compatible; the table below summarizes -the various releases. - - Release Derived Year Owner GPL- - from compatible? (1) - - 0.9.0 thru 1.2 1991-1995 CWI yes - 1.3 thru 1.5.2 1.2 1995-1999 CNRI yes - 1.6 1.5.2 2000 CNRI no - 2.0 1.6 2000 BeOpen.com no - 1.6.1 1.6 2001 CNRI yes (2) - 2.1 2.0+1.6.1 2001 PSF no - 2.0.1 2.0+1.6.1 2001 PSF yes - 2.1.1 2.1+2.0.1 2001 PSF yes - 2.1.2 2.1.1 2002 PSF yes - 2.1.3 2.1.2 2002 PSF yes - 2.2 and above 2.1.1 2001-now PSF yes - -Footnotes: - -(1) GPL-compatible doesn't mean that we're distributing Python under - the GPL. All Python licenses, unlike the GPL, let you distribute - a modified version without making your changes open source. The - GPL-compatible licenses make it possible to combine Python with - other software that is released under the GPL; the others don't. - -(2) According to Richard Stallman, 1.6.1 is not GPL-compatible, - because its license has a choice of law clause. According to - CNRI, however, Stallman's lawyer has told CNRI's lawyer that 1.6.1 - is "not incompatible" with the GPL. - -Thanks to the many outside volunteers who have worked under Guido's -direction to make these releases possible. - - -B. TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING PYTHON -=============================================================== - -PYTHON SOFTWARE FOUNDATION LICENSE VERSION 2 --------------------------------------------- - -1. This LICENSE AGREEMENT is between the Python Software Foundation -("PSF"), and the Individual or Organization ("Licensee") accessing and -otherwise using this software ("Python") in source or binary form and -its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, PSF hereby -grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, -analyze, test, perform and/or display publicly, prepare derivative works, -distribute, and otherwise use Python alone or in any derivative version, -provided, however, that PSF's License Agreement and PSF's notice of copyright, -i.e., "Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -2011, 2012, 2013, 2014, 2015 Python Software Foundation; All Rights Reserved" -are retained in Python alone or in any derivative version prepared by Licensee. - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python. - -4. PSF is making Python available to Licensee on an "AS IS" -basis. PSF MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, PSF MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. PSF SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. Nothing in this License Agreement shall be deemed to create any -relationship of agency, partnership, or joint venture between PSF and -Licensee. This License Agreement does not grant permission to use PSF -trademarks or trade name in a trademark sense to endorse or promote -products or services of Licensee, or any third party. - -8. By copying, installing or otherwise using Python, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -BEOPEN.COM LICENSE AGREEMENT FOR PYTHON 2.0 -------------------------------------------- - -BEOPEN PYTHON OPEN SOURCE LICENSE AGREEMENT VERSION 1 - -1. This LICENSE AGREEMENT is between BeOpen.com ("BeOpen"), having an -office at 160 Saratoga Avenue, Santa Clara, CA 95051, and the -Individual or Organization ("Licensee") accessing and otherwise using -this software in source or binary form and its associated -documentation ("the Software"). - -2. Subject to the terms and conditions of this BeOpen Python License -Agreement, BeOpen hereby grants Licensee a non-exclusive, -royalty-free, world-wide license to reproduce, analyze, test, perform -and/or display publicly, prepare derivative works, distribute, and -otherwise use the Software alone or in any derivative version, -provided, however, that the BeOpen Python License is retained in the -Software, alone or in any derivative version prepared by Licensee. - -3. BeOpen is making the Software available to Licensee on an "AS IS" -basis. BEOPEN MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, BEOPEN MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -4. BEOPEN SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF THE -SOFTWARE FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS -AS A RESULT OF USING, MODIFYING OR DISTRIBUTING THE SOFTWARE, OR ANY -DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -5. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -6. This License Agreement shall be governed by and interpreted in all -respects by the law of the State of California, excluding conflict of -law provisions. Nothing in this License Agreement shall be deemed to -create any relationship of agency, partnership, or joint venture -between BeOpen and Licensee. This License Agreement does not grant -permission to use BeOpen trademarks or trade names in a trademark -sense to endorse or promote products or services of Licensee, or any -third party. As an exception, the "BeOpen Python" logos available at -http://www.pythonlabs.com/logos.html may be used according to the -permissions granted on that web page. - -7. By copying, installing or otherwise using the software, Licensee -agrees to be bound by the terms and conditions of this License -Agreement. - - -CNRI LICENSE AGREEMENT FOR PYTHON 1.6.1 ---------------------------------------- - -1. This LICENSE AGREEMENT is between the Corporation for National -Research Initiatives, having an office at 1895 Preston White Drive, -Reston, VA 20191 ("CNRI"), and the Individual or Organization -("Licensee") accessing and otherwise using Python 1.6.1 software in -source or binary form and its associated documentation. - -2. Subject to the terms and conditions of this License Agreement, CNRI -hereby grants Licensee a nonexclusive, royalty-free, world-wide -license to reproduce, analyze, test, perform and/or display publicly, -prepare derivative works, distribute, and otherwise use Python 1.6.1 -alone or in any derivative version, provided, however, that CNRI's -License Agreement and CNRI's notice of copyright, i.e., "Copyright (c) -1995-2001 Corporation for National Research Initiatives; All Rights -Reserved" are retained in Python 1.6.1 alone or in any derivative -version prepared by Licensee. Alternately, in lieu of CNRI's License -Agreement, Licensee may substitute the following text (omitting the -quotes): "Python 1.6.1 is made available subject to the terms and -conditions in CNRI's License Agreement. This Agreement together with -Python 1.6.1 may be located on the Internet using the following -unique, persistent identifier (known as a handle): 1895.22/1013. This -Agreement may also be obtained from a proxy server on the Internet -using the following URL: http://hdl.handle.net/1895.22/1013". - -3. In the event Licensee prepares a derivative work that is based on -or incorporates Python 1.6.1 or any part thereof, and wants to make -the derivative work available to others as provided herein, then -Licensee hereby agrees to include in any such work a brief summary of -the changes made to Python 1.6.1. - -4. CNRI is making Python 1.6.1 available to Licensee on an "AS IS" -basis. CNRI MAKES NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR -IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION, CNRI MAKES NO AND -DISCLAIMS ANY REPRESENTATION OR WARRANTY OF MERCHANTABILITY OR FITNESS -FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF PYTHON 1.6.1 WILL NOT -INFRINGE ANY THIRD PARTY RIGHTS. - -5. CNRI SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER USERS OF PYTHON -1.6.1 FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL DAMAGES OR LOSS AS -A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE USING PYTHON 1.6.1, -OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. - -6. This License Agreement will automatically terminate upon a material -breach of its terms and conditions. - -7. This License Agreement shall be governed by the federal -intellectual property law of the United States, including without -limitation the federal copyright law, and, to the extent such -U.S. federal law does not apply, by the law of the Commonwealth of -Virginia, excluding Virginia's conflict of law provisions. -Notwithstanding the foregoing, with regard to derivative works based -on Python 1.6.1 that incorporate non-separable material that was -previously distributed under the GNU General Public License (GPL), the -law of the Commonwealth of Virginia shall govern this License -Agreement only as to issues arising under or with respect to -Paragraphs 4, 5, and 7 of this License Agreement. Nothing in this -License Agreement shall be deemed to create any relationship of -agency, partnership, or joint venture between CNRI and Licensee. This -License Agreement does not grant permission to use CNRI trademarks or -trade name in a trademark sense to endorse or promote products or -services of Licensee, or any third party. - -8. By clicking on the "ACCEPT" button where indicated, or by copying, -installing or otherwise using Python 1.6.1, Licensee agrees to be -bound by the terms and conditions of this License Agreement. - - ACCEPT - - -CWI LICENSE AGREEMENT FOR PYTHON 0.9.0 THROUGH 1.2 --------------------------------------------------- - -Copyright (c) 1991 - 1995, Stichting Mathematisch Centrum Amsterdam, -The Netherlands. All rights reserved. - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both that copyright notice and this permission notice appear in -supporting documentation, and that the name of Stichting Mathematisch -Centrum or CWI not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -STICHTING MATHEMATISCH CENTRUM DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL STICHTING MATHEMATISCH CENTRUM BE LIABLE -FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py deleted file mode 100644 index d83ff51..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/BaseHTTPServer.py +++ /dev/null @@ -1,603 +0,0 @@ -"""HTTP server base class. - -Note: the class in this module doesn't implement any HTTP request; see -SimpleHTTPServer for simple implementations of GET, HEAD and POST -(including CGI scripts). It does, however, optionally implement HTTP/1.1 -persistent connections, as of version 0.3. - -Contents: - -- BaseHTTPRequestHandler: HTTP request handler base class -- test: test function - -XXX To do: - -- log requests even later (to capture byte count) -- log user-agent header and other interesting goodies -- send error log to separate file -""" - - -# See also: -# -# HTTP Working Group T. Berners-Lee -# INTERNET-DRAFT R. T. Fielding -# H. Frystyk Nielsen -# Expires September 8, 1995 March 8, 1995 -# -# URL: http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-v10-spec-00.txt -# -# and -# -# Network Working Group R. Fielding -# Request for Comments: 2616 et al -# Obsoletes: 2068 June 1999 -# Category: Standards Track -# -# URL: http://www.faqs.org/rfcs/rfc2616.html - -# Log files -# --------- -# -# Here's a quote from the NCSA httpd docs about log file format. -# -# | The logfile format is as follows. Each line consists of: -# | -# | host rfc931 authuser [DD/Mon/YYYY:hh:mm:ss] "request" ddd bbbb -# | -# | host: Either the DNS name or the IP number of the remote client -# | rfc931: Any information returned by identd for this person, -# | - otherwise. -# | authuser: If user sent a userid for authentication, the user name, -# | - otherwise. -# | DD: Day -# | Mon: Month (calendar name) -# | YYYY: Year -# | hh: hour (24-hour format, the machine's timezone) -# | mm: minutes -# | ss: seconds -# | request: The first line of the HTTP request as sent by the client. -# | ddd: the status code returned by the server, - if not available. -# | bbbb: the total number of bytes sent, -# | *not including the HTTP/1.0 header*, - if not available -# | -# | You can determine the name of the file accessed through request. -# -# (Actually, the latter is only true if you know the server configuration -# at the time the request was made!) - -__version__ = "0.3" - -__all__ = ["HTTPServer", "BaseHTTPRequestHandler"] - -import sys -import time -import socket # For gethostbyaddr() -from warnings import filterwarnings, catch_warnings -with catch_warnings(): - if sys.py3kwarning: - filterwarnings("ignore", ".*mimetools has been removed", - DeprecationWarning) - import mimetools -import SocketServer - -# Default error message template -DEFAULT_ERROR_MESSAGE = """\ - -Error response - - -

Error response

-

Error code %(code)d. -

Message: %(message)s. -

Error code explanation: %(code)s = %(explain)s. - -""" - -DEFAULT_ERROR_CONTENT_TYPE = "text/html" - -def _quote_html(html): - return html.replace("&", "&").replace("<", "<").replace(">", ">") - -class HTTPServer(SocketServer.TCPServer): - - allow_reuse_address = 1 # Seems to make sense in testing environment - - def server_bind(self): - """Override server_bind to store the server name.""" - SocketServer.TCPServer.server_bind(self) - host, port = self.socket.getsockname()[:2] - self.server_name = socket.getfqdn(host) - self.server_port = port - - -class BaseHTTPRequestHandler(SocketServer.StreamRequestHandler): - - """HTTP request handler base class. - - The following explanation of HTTP serves to guide you through the - code as well as to expose any misunderstandings I may have about - HTTP (so you don't need to read the code to figure out I'm wrong - :-). - - HTTP (HyperText Transfer Protocol) is an extensible protocol on - top of a reliable stream transport (e.g. TCP/IP). The protocol - recognizes three parts to a request: - - 1. One line identifying the request type and path - 2. An optional set of RFC-822-style headers - 3. An optional data part - - The headers and data are separated by a blank line. - - The first line of the request has the form - - - - where is a (case-sensitive) keyword such as GET or POST, - is a string containing path information for the request, - and should be the string "HTTP/1.0" or "HTTP/1.1". - is encoded using the URL encoding scheme (using %xx to signify - the ASCII character with hex code xx). - - The specification specifies that lines are separated by CRLF but - for compatibility with the widest range of clients recommends - servers also handle LF. Similarly, whitespace in the request line - is treated sensibly (allowing multiple spaces between components - and allowing trailing whitespace). - - Similarly, for output, lines ought to be separated by CRLF pairs - but most clients grok LF characters just fine. - - If the first line of the request has the form - - - - (i.e. is left out) then this is assumed to be an HTTP - 0.9 request; this form has no optional headers and data part and - the reply consists of just the data. - - The reply form of the HTTP 1.x protocol again has three parts: - - 1. One line giving the response code - 2. An optional set of RFC-822-style headers - 3. The data - - Again, the headers and data are separated by a blank line. - - The response code line has the form - - - - where is the protocol version ("HTTP/1.0" or "HTTP/1.1"), - is a 3-digit response code indicating success or - failure of the request, and is an optional - human-readable string explaining what the response code means. - - This server parses the request and the headers, and then calls a - function specific to the request type (). Specifically, - a request SPAM will be handled by a method do_SPAM(). If no - such method exists the server sends an error response to the - client. If it exists, it is called with no arguments: - - do_SPAM() - - Note that the request name is case sensitive (i.e. SPAM and spam - are different requests). - - The various request details are stored in instance variables: - - - client_address is the client IP address in the form (host, - port); - - - command, path and version are the broken-down request line; - - - headers is an instance of mimetools.Message (or a derived - class) containing the header information; - - - rfile is a file object open for reading positioned at the - start of the optional input data part; - - - wfile is a file object open for writing. - - IT IS IMPORTANT TO ADHERE TO THE PROTOCOL FOR WRITING! - - The first thing to be written must be the response line. Then - follow 0 or more header lines, then a blank line, and then the - actual data (if any). The meaning of the header lines depends on - the command executed by the server; in most cases, when data is - returned, there should be at least one header line of the form - - Content-type: / - - where and should be registered MIME types, - e.g. "text/html" or "text/plain". - - """ - - # The Python system version, truncated to its first component. - sys_version = "Python/" + sys.version.split()[0] - - # The server software version. You may want to override this. - # The format is multiple whitespace-separated strings, - # where each string is of the form name[/version]. - server_version = "BaseHTTP/" + __version__ - - # The default request version. This only affects responses up until - # the point where the request line is parsed, so it mainly decides what - # the client gets back when sending a malformed request line. - # Most web servers default to HTTP 0.9, i.e. don't send a status line. - default_request_version = "HTTP/0.9" - - def parse_request(self): - """Parse a request (internal). - - The request should be stored in self.raw_requestline; the results - are in self.command, self.path, self.request_version and - self.headers. - - Return True for success, False for failure; on failure, an - error is sent back. - - """ - self.command = None # set in case of error on the first line - self.request_version = version = self.default_request_version - self.close_connection = 1 - requestline = self.raw_requestline - requestline = requestline.rstrip('\r\n') - self.requestline = requestline - words = requestline.split() - if len(words) == 3: - command, path, version = words - if version[:5] != 'HTTP/': - self.send_error(400, "Bad request version (%r)" % version) - return False - try: - base_version_number = version.split('/', 1)[1] - version_number = base_version_number.split(".") - # RFC 2145 section 3.1 says there can be only one "." and - # - major and minor numbers MUST be treated as - # separate integers; - # - HTTP/2.4 is a lower version than HTTP/2.13, which in - # turn is lower than HTTP/12.3; - # - Leading zeros MUST be ignored by recipients. - if len(version_number) != 2: - raise ValueError - version_number = int(version_number[0]), int(version_number[1]) - except (ValueError, IndexError): - self.send_error(400, "Bad request version (%r)" % version) - return False - if version_number >= (1, 1) and self.protocol_version >= "HTTP/1.1": - self.close_connection = 0 - if version_number >= (2, 0): - self.send_error(505, - "Invalid HTTP Version (%s)" % base_version_number) - return False - elif len(words) == 2: - command, path = words - self.close_connection = 1 - if command != 'GET': - self.send_error(400, - "Bad HTTP/0.9 request type (%r)" % command) - return False - elif not words: - return False - else: - self.send_error(400, "Bad request syntax (%r)" % requestline) - return False - self.command, self.path, self.request_version = command, path, version - - # Examine the headers and look for a Connection directive - self.headers = self.MessageClass(self.rfile, 0) - - conntype = self.headers.get('Connection', "") - if conntype.lower() == 'close': - self.close_connection = 1 - elif (conntype.lower() == 'keep-alive' and - self.protocol_version >= "HTTP/1.1"): - self.close_connection = 0 - return True - - def handle_one_request(self): - """Handle a single HTTP request. - - You normally don't need to override this method; see the class - __doc__ string for information on how to handle specific HTTP - commands such as GET and POST. - - """ - try: - self.raw_requestline = self.rfile.readline(65537) - if len(self.raw_requestline) > 65536: - self.requestline = '' - self.request_version = '' - self.command = '' - self.send_error(414) - return - if not self.raw_requestline: - self.close_connection = 1 - return - if not self.parse_request(): - # An error code has been sent, just exit - return - mname = 'do_' + self.command - if not hasattr(self, mname): - self.send_error(501, "Unsupported method (%r)" % self.command) - return - method = getattr(self, mname) - method() - self.wfile.flush() #actually send the response if not already done. - except socket.timeout, e: - #a read or a write timed out. Discard this connection - self.log_error("Request timed out: %r", e) - self.close_connection = 1 - return - - def handle(self): - """Handle multiple requests if necessary.""" - self.close_connection = 1 - - self.handle_one_request() - while not self.close_connection: - self.handle_one_request() - - def send_error(self, code, message=None): - """Send and log an error reply. - - Arguments are the error code, and a detailed message. - The detailed message defaults to the short entry matching the - response code. - - This sends an error response (so it must be called before any - output has been generated), logs the error, and finally sends - a piece of HTML explaining the error to the user. - - """ - - try: - short, long = self.responses[code] - except KeyError: - short, long = '???', '???' - if message is None: - message = short - explain = long - self.log_error("code %d, message %s", code, message) - # using _quote_html to prevent Cross Site Scripting attacks (see bug #1100201) - content = (self.error_message_format % - {'code': code, 'message': _quote_html(message), 'explain': explain}) - self.send_response(code, message) - self.send_header("Content-Type", self.error_content_type) - self.send_header('Connection', 'close') - self.end_headers() - if self.command != 'HEAD' and code >= 200 and code not in (204, 304): - self.wfile.write(content) - - error_message_format = DEFAULT_ERROR_MESSAGE - error_content_type = DEFAULT_ERROR_CONTENT_TYPE - - def send_response(self, code, message=None): - """Send the response header and log the response code. - - Also send two standard headers with the server software - version and the current date. - - """ - self.log_request(code) - if message is None: - if code in self.responses: - message = self.responses[code][0] - else: - message = '' - if self.request_version != 'HTTP/0.9': - self.wfile.write("%s %d %s\r\n" % - (self.protocol_version, code, message)) - # print (self.protocol_version, code, message) - self.send_header('Server', self.version_string()) - self.send_header('Date', self.date_time_string()) - - def send_header(self, keyword, value): - """Send a MIME header.""" - if self.request_version != 'HTTP/0.9': - self.wfile.write("%s: %s\r\n" % (keyword, value)) - - if keyword.lower() == 'connection': - if value.lower() == 'close': - self.close_connection = 1 - elif value.lower() == 'keep-alive': - self.close_connection = 0 - - def end_headers(self): - """Send the blank line ending the MIME headers.""" - if self.request_version != 'HTTP/0.9': - self.wfile.write("\r\n") - - def log_request(self, code='-', size='-'): - """Log an accepted request. - - This is called by send_response(). - - """ - - self.log_message('"%s" %s %s', - self.requestline, str(code), str(size)) - - def log_error(self, format, *args): - """Log an error. - - This is called when a request cannot be fulfilled. By - default it passes the message on to log_message(). - - Arguments are the same as for log_message(). - - XXX This should go to the separate error log. - - """ - - self.log_message(format, *args) - - def log_message(self, format, *args): - """Log an arbitrary message. - - This is used by all other logging functions. Override - it if you have specific logging wishes. - - The first argument, FORMAT, is a format string for the - message to be logged. If the format string contains - any % escapes requiring parameters, they should be - specified as subsequent arguments (it's just like - printf!). - - The client ip address and current date/time are prefixed to every - message. - - """ - - sys.stderr.write("%s - - [%s] %s\n" % - (self.client_address[0], - self.log_date_time_string(), - format%args)) - - def version_string(self): - """Return the server software version string.""" - return self.server_version + ' ' + self.sys_version - - def date_time_string(self, timestamp=None): - """Return the current date and time formatted for a message header.""" - if timestamp is None: - timestamp = time.time() - year, month, day, hh, mm, ss, wd, y, z = time.gmtime(timestamp) - s = "%s, %02d %3s %4d %02d:%02d:%02d GMT" % ( - self.weekdayname[wd], - day, self.monthname[month], year, - hh, mm, ss) - return s - - def log_date_time_string(self): - """Return the current time formatted for logging.""" - now = time.time() - year, month, day, hh, mm, ss, x, y, z = time.localtime(now) - s = "%02d/%3s/%04d %02d:%02d:%02d" % ( - day, self.monthname[month], year, hh, mm, ss) - return s - - weekdayname = ['Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun'] - - monthname = [None, - 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', - 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] - - def address_string(self): - """Return the client address formatted for logging. - - This version looks up the full hostname using gethostbyaddr(), - and tries to find a name that contains at least one dot. - - """ - - host, port = self.client_address[:2] - return socket.getfqdn(host) - - # Essentially static class variables - - # The version of the HTTP protocol we support. - # Set this to HTTP/1.1 to enable automatic keepalive - protocol_version = "HTTP/1.0" - - # The Message-like class used to parse headers - MessageClass = mimetools.Message - - # Table mapping response codes to messages; entries have the - # form {code: (shortmessage, longmessage)}. - # See RFC 2616. - responses = { - 100: ('Continue', 'Request received, please continue'), - 101: ('Switching Protocols', - 'Switching to new protocol; obey Upgrade header'), - - 200: ('OK', 'Request fulfilled, document follows'), - 201: ('Created', 'Document created, URL follows'), - 202: ('Accepted', - 'Request accepted, processing continues off-line'), - 203: ('Non-Authoritative Information', 'Request fulfilled from cache'), - 204: ('No Content', 'Request fulfilled, nothing follows'), - 205: ('Reset Content', 'Clear input form for further input.'), - 206: ('Partial Content', 'Partial content follows.'), - - 300: ('Multiple Choices', - 'Object has several resources -- see URI list'), - 301: ('Moved Permanently', 'Object moved permanently -- see URI list'), - 302: ('Found', 'Object moved temporarily -- see URI list'), - 303: ('See Other', 'Object moved -- see Method and URL list'), - 304: ('Not Modified', - 'Document has not changed since given time'), - 305: ('Use Proxy', - 'You must use proxy specified in Location to access this ' - 'resource.'), - 307: ('Temporary Redirect', - 'Object moved temporarily -- see URI list'), - - 400: ('Bad Request', - 'Bad request syntax or unsupported method'), - 401: ('Unauthorized', - 'No permission -- see authorization schemes'), - 402: ('Payment Required', - 'No payment -- see charging schemes'), - 403: ('Forbidden', - 'Request forbidden -- authorization will not help'), - 404: ('Not Found', 'Nothing matches the given URI'), - 405: ('Method Not Allowed', - 'Specified method is invalid for this resource.'), - 406: ('Not Acceptable', 'URI not available in preferred format.'), - 407: ('Proxy Authentication Required', 'You must authenticate with ' - 'this proxy before proceeding.'), - 408: ('Request Timeout', 'Request timed out; try again later.'), - 409: ('Conflict', 'Request conflict.'), - 410: ('Gone', - 'URI no longer exists and has been permanently removed.'), - 411: ('Length Required', 'Client must specify Content-Length.'), - 412: ('Precondition Failed', 'Precondition in headers is false.'), - 413: ('Request Entity Too Large', 'Entity is too large.'), - 414: ('Request-URI Too Long', 'URI is too long.'), - 415: ('Unsupported Media Type', 'Entity body in unsupported format.'), - 416: ('Requested Range Not Satisfiable', - 'Cannot satisfy request range.'), - 417: ('Expectation Failed', - 'Expect condition could not be satisfied.'), - - 500: ('Internal Server Error', 'Server got itself in trouble'), - 501: ('Not Implemented', - 'Server does not support this operation'), - 502: ('Bad Gateway', 'Invalid responses from another server/proxy.'), - 503: ('Service Unavailable', - 'The server cannot process the request due to a high load'), - 504: ('Gateway Timeout', - 'The gateway server did not receive a timely response'), - 505: ('HTTP Version Not Supported', 'Cannot fulfill request.'), - } - - -def test(HandlerClass = BaseHTTPRequestHandler, - ServerClass = HTTPServer, protocol="HTTP/1.0"): - """Test the HTTP request handler class. - - This runs an HTTP server on port 8000 (or the first command line - argument). - - """ - - if sys.argv[1:]: - port = int(sys.argv[1]) - else: - port = 8000 - server_address = ('', port) - - HandlerClass.protocol_version = protocol - httpd = ServerClass(server_address, HandlerClass) - - sa = httpd.socket.getsockname() - print "Serving HTTP on", sa[0], "port", sa[1], "..." - httpd.serve_forever() - - -if __name__ == '__main__': - test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py deleted file mode 100644 index 07313d2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/HTMLParser.py +++ /dev/null @@ -1,475 +0,0 @@ -"""A parser for HTML and XHTML.""" - -# This file is based on sgmllib.py, but the API is slightly different. - -# XXX There should be a way to distinguish between PCDATA (parsed -# character data -- the normal case), RCDATA (replaceable character -# data -- only char and entity references and end tags are special) -# and CDATA (character data -- only end tags are special). - - -import markupbase -import re - -# Regular expressions used for parsing - -interesting_normal = re.compile('[&<]') -incomplete = re.compile('&[a-zA-Z#]') - -entityref = re.compile('&([a-zA-Z][-.a-zA-Z0-9]*)[^a-zA-Z0-9]') -charref = re.compile('&#(?:[0-9]+|[xX][0-9a-fA-F]+)[^0-9a-fA-F]') - -starttagopen = re.compile('<[a-zA-Z]') -piclose = re.compile('>') -commentclose = re.compile(r'--\s*>') - -# see http://www.w3.org/TR/html5/tokenization.html#tag-open-state -# and http://www.w3.org/TR/html5/tokenization.html#tag-name-state -# note: if you change tagfind/attrfind remember to update locatestarttagend too -tagfind = re.compile('([a-zA-Z][^\t\n\r\f />\x00]*)(?:\s|/(?!>))*') -# this regex is currently unused, but left for backward compatibility -tagfind_tolerant = re.compile('[a-zA-Z][^\t\n\r\f />\x00]*') - -attrfind = re.compile( - r'((?<=[\'"\s/])[^\s/>][^\s/=>]*)(\s*=+\s*' - r'(\'[^\']*\'|"[^"]*"|(?![\'"])[^>\s]*))?(?:\s|/(?!>))*') - -locatestarttagend = re.compile(r""" - <[a-zA-Z][^\t\n\r\f />\x00]* # tag name - (?:[\s/]* # optional whitespace before attribute name - (?:(?<=['"\s/])[^\s/>][^\s/=>]* # attribute name - (?:\s*=+\s* # value indicator - (?:'[^']*' # LITA-enclosed value - |"[^"]*" # LIT-enclosed value - |(?!['"])[^>\s]* # bare value - ) - )?(?:\s|/(?!>))* - )* - )? - \s* # trailing whitespace -""", re.VERBOSE) -endendtag = re.compile('>') -# the HTML 5 spec, section 8.1.2.2, doesn't allow spaces between -# ') - - -class HTMLParseError(Exception): - """Exception raised for all parse errors.""" - - def __init__(self, msg, position=(None, None)): - assert msg - self.msg = msg - self.lineno = position[0] - self.offset = position[1] - - def __str__(self): - result = self.msg - if self.lineno is not None: - result = result + ", at line %d" % self.lineno - if self.offset is not None: - result = result + ", column %d" % (self.offset + 1) - return result - - -class HTMLParser(markupbase.ParserBase): - """Find tags and other markup and call handler functions. - - Usage: - p = HTMLParser() - p.feed(data) - ... - p.close() - - Start tags are handled by calling self.handle_starttag() or - self.handle_startendtag(); end tags by self.handle_endtag(). The - data between tags is passed from the parser to the derived class - by calling self.handle_data() with the data as argument (the data - may be split up in arbitrary chunks). Entity references are - passed by calling self.handle_entityref() with the entity - reference as the argument. Numeric character references are - passed to self.handle_charref() with the string containing the - reference as the argument. - """ - - CDATA_CONTENT_ELEMENTS = ("script", "style") - - - def __init__(self): - """Initialize and reset this instance.""" - self.reset() - - def reset(self): - """Reset this instance. Loses all unprocessed data.""" - self.rawdata = '' - self.lasttag = '???' - self.interesting = interesting_normal - self.cdata_elem = None - markupbase.ParserBase.reset(self) - - def feed(self, data): - r"""Feed data to the parser. - - Call this as often as you want, with as little or as much text - as you want (may include '\n'). - """ - self.rawdata = self.rawdata + data - self.goahead(0) - - def close(self): - """Handle any buffered data.""" - self.goahead(1) - - def error(self, message): - raise HTMLParseError(message, self.getpos()) - - __starttag_text = None - - def get_starttag_text(self): - """Return full source of start tag: '<...>'.""" - return self.__starttag_text - - def set_cdata_mode(self, elem): - self.cdata_elem = elem.lower() - self.interesting = re.compile(r'' % self.cdata_elem, re.I) - - def clear_cdata_mode(self): - self.interesting = interesting_normal - self.cdata_elem = None - - # Internal -- handle data as far as reasonable. May leave state - # and data to be processed by a subsequent call. If 'end' is - # true, force handling all data as if followed by EOF marker. - def goahead(self, end): - rawdata = self.rawdata - i = 0 - n = len(rawdata) - while i < n: - match = self.interesting.search(rawdata, i) # < or & - if match: - j = match.start() - else: - if self.cdata_elem: - break - j = n - if i < j: self.handle_data(rawdata[i:j]) - i = self.updatepos(i, j) - if i == n: break - startswith = rawdata.startswith - if startswith('<', i): - if starttagopen.match(rawdata, i): # < + letter - k = self.parse_starttag(i) - elif startswith("', i + 1) - if k < 0: - k = rawdata.find('<', i + 1) - if k < 0: - k = i + 1 - else: - k += 1 - self.handle_data(rawdata[i:k]) - i = self.updatepos(i, k) - elif startswith("&#", i): - match = charref.match(rawdata, i) - if match: - name = match.group()[2:-1] - self.handle_charref(name) - k = match.end() - if not startswith(';', k-1): - k = k - 1 - i = self.updatepos(i, k) - continue - else: - if ";" in rawdata[i:]: # bail by consuming '&#' - self.handle_data(rawdata[i:i+2]) - i = self.updatepos(i, i+2) - break - elif startswith('&', i): - match = entityref.match(rawdata, i) - if match: - name = match.group(1) - self.handle_entityref(name) - k = match.end() - if not startswith(';', k-1): - k = k - 1 - i = self.updatepos(i, k) - continue - match = incomplete.match(rawdata, i) - if match: - # match.group() will contain at least 2 chars - if end and match.group() == rawdata[i:]: - self.error("EOF in middle of entity or char ref") - # incomplete - break - elif (i + 1) < n: - # not the end of the buffer, and can't be confused - # with some other construct - self.handle_data("&") - i = self.updatepos(i, i + 1) - else: - break - else: - assert 0, "interesting.search() lied" - # end while - if end and i < n and not self.cdata_elem: - self.handle_data(rawdata[i:n]) - i = self.updatepos(i, n) - self.rawdata = rawdata[i:] - - # Internal -- parse html declarations, return length or -1 if not terminated - # See w3.org/TR/html5/tokenization.html#markup-declaration-open-state - # See also parse_declaration in _markupbase - def parse_html_declaration(self, i): - rawdata = self.rawdata - if rawdata[i:i+2] != ' - gtpos = rawdata.find('>', i+9) - if gtpos == -1: - return -1 - self.handle_decl(rawdata[i+2:gtpos]) - return gtpos+1 - else: - return self.parse_bogus_comment(i) - - # Internal -- parse bogus comment, return length or -1 if not terminated - # see http://www.w3.org/TR/html5/tokenization.html#bogus-comment-state - def parse_bogus_comment(self, i, report=1): - rawdata = self.rawdata - if rawdata[i:i+2] not in ('', i+2) - if pos == -1: - return -1 - if report: - self.handle_comment(rawdata[i+2:pos]) - return pos + 1 - - # Internal -- parse processing instr, return end or -1 if not terminated - def parse_pi(self, i): - rawdata = self.rawdata - assert rawdata[i:i+2] == ' - if not match: - return -1 - j = match.start() - self.handle_pi(rawdata[i+2: j]) - j = match.end() - return j - - # Internal -- handle starttag, return end or -1 if not terminated - def parse_starttag(self, i): - self.__starttag_text = None - endpos = self.check_for_whole_start_tag(i) - if endpos < 0: - return endpos - rawdata = self.rawdata - self.__starttag_text = rawdata[i:endpos] - - # Now parse the data between i+1 and j into a tag and attrs - attrs = [] - match = tagfind.match(rawdata, i+1) - assert match, 'unexpected call to parse_starttag()' - k = match.end() - self.lasttag = tag = match.group(1).lower() - - while k < endpos: - m = attrfind.match(rawdata, k) - if not m: - break - attrname, rest, attrvalue = m.group(1, 2, 3) - if not rest: - attrvalue = None - elif attrvalue[:1] == '\'' == attrvalue[-1:] or \ - attrvalue[:1] == '"' == attrvalue[-1:]: - attrvalue = attrvalue[1:-1] - if attrvalue: - attrvalue = self.unescape(attrvalue) - attrs.append((attrname.lower(), attrvalue)) - k = m.end() - - end = rawdata[k:endpos].strip() - if end not in (">", "/>"): - lineno, offset = self.getpos() - if "\n" in self.__starttag_text: - lineno = lineno + self.__starttag_text.count("\n") - offset = len(self.__starttag_text) \ - - self.__starttag_text.rfind("\n") - else: - offset = offset + len(self.__starttag_text) - self.handle_data(rawdata[i:endpos]) - return endpos - if end.endswith('/>'): - # XHTML-style empty tag: - self.handle_startendtag(tag, attrs) - else: - self.handle_starttag(tag, attrs) - if tag in self.CDATA_CONTENT_ELEMENTS: - self.set_cdata_mode(tag) - return endpos - - # Internal -- check to see if we have a complete starttag; return end - # or -1 if incomplete. - def check_for_whole_start_tag(self, i): - rawdata = self.rawdata - m = locatestarttagend.match(rawdata, i) - if m: - j = m.end() - next = rawdata[j:j+1] - if next == ">": - return j + 1 - if next == "/": - if rawdata.startswith("/>", j): - return j + 2 - if rawdata.startswith("/", j): - # buffer boundary - return -1 - # else bogus input - self.updatepos(i, j + 1) - self.error("malformed empty start tag") - if next == "": - # end of input - return -1 - if next in ("abcdefghijklmnopqrstuvwxyz=/" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ"): - # end of input in or before attribute value, or we have the - # '/' from a '/>' ending - return -1 - if j > i: - return j - else: - return i + 1 - raise AssertionError("we should not get here!") - - # Internal -- parse endtag, return end or -1 if incomplete - def parse_endtag(self, i): - rawdata = self.rawdata - assert rawdata[i:i+2] == " - if not match: - return -1 - gtpos = match.end() - match = endtagfind.match(rawdata, i) # - if not match: - if self.cdata_elem is not None: - self.handle_data(rawdata[i:gtpos]) - return gtpos - # find the name: w3.org/TR/html5/tokenization.html#tag-name-state - namematch = tagfind.match(rawdata, i+2) - if not namematch: - # w3.org/TR/html5/tokenization.html#end-tag-open-state - if rawdata[i:i+3] == '': - return i+3 - else: - return self.parse_bogus_comment(i) - tagname = namematch.group(1).lower() - # consume and ignore other stuff between the name and the > - # Note: this is not 100% correct, since we might have things like - # , but looking for > after tha name should cover - # most of the cases and is much simpler - gtpos = rawdata.find('>', namematch.end()) - self.handle_endtag(tagname) - return gtpos+1 - - elem = match.group(1).lower() # script or style - if self.cdata_elem is not None: - if elem != self.cdata_elem: - self.handle_data(rawdata[i:gtpos]) - return gtpos - - self.handle_endtag(elem) - self.clear_cdata_mode() - return gtpos - - # Overridable -- finish processing of start+end tag: - def handle_startendtag(self, tag, attrs): - self.handle_starttag(tag, attrs) - self.handle_endtag(tag) - - # Overridable -- handle start tag - def handle_starttag(self, tag, attrs): - pass - - # Overridable -- handle end tag - def handle_endtag(self, tag): - pass - - # Overridable -- handle character reference - def handle_charref(self, name): - pass - - # Overridable -- handle entity reference - def handle_entityref(self, name): - pass - - # Overridable -- handle data - def handle_data(self, data): - pass - - # Overridable -- handle comment - def handle_comment(self, data): - pass - - # Overridable -- handle declaration - def handle_decl(self, decl): - pass - - # Overridable -- handle processing instruction - def handle_pi(self, data): - pass - - def unknown_decl(self, data): - pass - - # Internal -- helper to remove special character quoting - entitydefs = None - def unescape(self, s): - if '&' not in s: - return s - def replaceEntities(s): - s = s.groups()[0] - try: - if s[0] == "#": - s = s[1:] - if s[0] in ['x','X']: - c = int(s[1:], 16) - else: - c = int(s) - return unichr(c) - except ValueError: - return '&#'+s+';' - else: - # Cannot use name2codepoint directly, because HTMLParser supports apos, - # which is not part of HTML 4 - import htmlentitydefs - if HTMLParser.entitydefs is None: - entitydefs = HTMLParser.entitydefs = {'apos':u"'"} - for k, v in htmlentitydefs.name2codepoint.iteritems(): - entitydefs[k] = unichr(v) - try: - return self.entitydefs[s] - except KeyError: - return '&'+s+';' - - return re.sub(r"&(#?[xX]?(?:[0-9a-fA-F]+|\w{1,8}));", replaceEntities, s) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py deleted file mode 100644 index 841a1cc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/SimpleHTTPServer.py +++ /dev/null @@ -1,235 +0,0 @@ -"""Simple HTTP Server. - -This module builds on BaseHTTPServer by implementing the standard GET -and HEAD requests in a fairly straightforward manner. - -""" - - -__version__ = "0.6" - -__all__ = ["SimpleHTTPRequestHandler"] - -import os -import posixpath -import BaseHTTPServer -import urllib -import urlparse -import cgi -import sys -import shutil -import mimetypes -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - - -class SimpleHTTPRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler): - - """Simple HTTP request handler with GET and HEAD commands. - - This serves files from the current directory and any of its - subdirectories. The MIME type for files is determined by - calling the .guess_type() method. - - The GET and HEAD requests are identical except that the HEAD - request omits the actual contents of the file. - - """ - - server_version = "SimpleHTTP/" + __version__ - - def do_GET(self): - """Serve a GET request.""" - f = self.send_head() - if f: - try: - self.copyfile(f, self.wfile) - finally: - f.close() - - def do_HEAD(self): - """Serve a HEAD request.""" - f = self.send_head() - if f: - f.close() - - def send_head(self): - """Common code for GET and HEAD commands. - - This sends the response code and MIME headers. - - Return value is either a file object (which has to be copied - to the outputfile by the caller unless the command was HEAD, - and must be closed by the caller under all circumstances), or - None, in which case the caller has nothing further to do. - - """ - path = self.translate_path(self.path) - f = None - if os.path.isdir(path): - parts = urlparse.urlsplit(self.path) - if not parts.path.endswith('/'): - # redirect browser - doing basically what apache does - self.send_response(301) - new_parts = (parts[0], parts[1], parts[2] + '/', - parts[3], parts[4]) - new_url = urlparse.urlunsplit(new_parts) - self.send_header("Location", new_url) - self.end_headers() - return None - for index in "index.html", "index.htm": - index = os.path.join(path, index) - if os.path.exists(index): - path = index - break - else: - return self.list_directory(path) - ctype = self.guess_type(path) - try: - # Always read in binary mode. Opening files in text mode may cause - # newline translations, making the actual size of the content - # transmitted *less* than the content-length! - f = open(path, 'rb') - except IOError: - self.send_error(404, "File not found") - return None - try: - self.send_response(200) - self.send_header("Content-type", ctype) - fs = os.fstat(f.fileno()) - self.send_header("Content-Length", str(fs[6])) - self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) - self.end_headers() - return f - except: - f.close() - raise - - def list_directory(self, path): - """Helper to produce a directory listing (absent index.html). - - Return value is either a file object, or None (indicating an - error). In either case, the headers are sent, making the - interface the same as for send_head(). - - """ - try: - list = os.listdir(path) - except os.error: - self.send_error(404, "No permission to list directory") - return None - list.sort(key=lambda a: a.lower()) - f = StringIO() - displaypath = cgi.escape(urllib.unquote(self.path)) - f.write('') - f.write("\nDirectory listing for %s\n" % displaypath) - f.write("\n

Directory listing for %s

\n" % displaypath) - f.write("
\n
    \n") - for name in list: - fullname = os.path.join(path, name) - displayname = linkname = name - # Append / for directories or @ for symbolic links - if os.path.isdir(fullname): - displayname = name + "/" - linkname = name + "/" - if os.path.islink(fullname): - displayname = name + "@" - # Note: a link to a directory displays with @ and links with / - f.write('
  • %s\n' - % (urllib.quote(linkname), cgi.escape(displayname))) - f.write("
\n
\n\n\n") - length = f.tell() - f.seek(0) - self.send_response(200) - encoding = sys.getfilesystemencoding() - self.send_header("Content-type", "text/html; charset=%s" % encoding) - self.send_header("Content-Length", str(length)) - self.end_headers() - return f - - def translate_path(self, path): - """Translate a /-separated PATH to the local filename syntax. - - Components that mean special things to the local file system - (e.g. drive or directory names) are ignored. (XXX They should - probably be diagnosed.) - - """ - # abandon query parameters - path = path.split('?',1)[0] - path = path.split('#',1)[0] - # Don't forget explicit trailing slash when normalizing. Issue17324 - trailing_slash = path.rstrip().endswith('/') - path = posixpath.normpath(urllib.unquote(path)) - words = path.split('/') - words = filter(None, words) - path = os.getcwd() - for word in words: - drive, word = os.path.splitdrive(word) - head, word = os.path.split(word) - if word in (os.curdir, os.pardir): continue - path = os.path.join(path, word) - if trailing_slash: - path += '/' - return path - - def copyfile(self, source, outputfile): - """Copy all data between two file objects. - - The SOURCE argument is a file object open for reading - (or anything with a read() method) and the DESTINATION - argument is a file object open for writing (or - anything with a write() method). - - The only reason for overriding this would be to change - the block size or perhaps to replace newlines by CRLF - -- note however that this the default server uses this - to copy binary data as well. - - """ - shutil.copyfileobj(source, outputfile) - - def guess_type(self, path): - """Guess the type of a file. - - Argument is a PATH (a filename). - - Return value is a string of the form type/subtype, - usable for a MIME Content-type header. - - The default implementation looks the file's extension - up in the table self.extensions_map, using application/octet-stream - as a default; however it would be permissible (if - slow) to look inside the data to make a better guess. - - """ - - base, ext = posixpath.splitext(path) - if ext in self.extensions_map: - return self.extensions_map[ext] - ext = ext.lower() - if ext in self.extensions_map: - return self.extensions_map[ext] - else: - return self.extensions_map[''] - - if not mimetypes.inited: - mimetypes.init() # try to read system mime.types - extensions_map = mimetypes.types_map.copy() - extensions_map.update({ - '': 'application/octet-stream', # Default - '.py': 'text/plain', - '.c': 'text/plain', - '.h': 'text/plain', - }) - - -def test(HandlerClass = SimpleHTTPRequestHandler, - ServerClass = BaseHTTPServer.HTTPServer): - BaseHTTPServer.test(HandlerClass, ServerClass) - - -if __name__ == '__main__': - test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py deleted file mode 100644 index 64a53d4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/SocketServer.py +++ /dev/null @@ -1,737 +0,0 @@ -"""Generic socket server classes. - -This module tries to capture the various aspects of defining a server: - -For socket-based servers: - -- address family: - - AF_INET{,6}: IP (Internet Protocol) sockets (default) - - AF_UNIX: Unix domain sockets - - others, e.g. AF_DECNET are conceivable (see -- socket type: - - SOCK_STREAM (reliable stream, e.g. TCP) - - SOCK_DGRAM (datagrams, e.g. UDP) - -For request-based servers (including socket-based): - -- client address verification before further looking at the request - (This is actually a hook for any processing that needs to look - at the request before anything else, e.g. logging) -- how to handle multiple requests: - - synchronous (one request is handled at a time) - - forking (each request is handled by a new process) - - threading (each request is handled by a new thread) - -The classes in this module favor the server type that is simplest to -write: a synchronous TCP/IP server. This is bad class design, but -save some typing. (There's also the issue that a deep class hierarchy -slows down method lookups.) - -There are five classes in an inheritance diagram, four of which represent -synchronous servers of four types: - - +------------+ - | BaseServer | - +------------+ - | - v - +-----------+ +------------------+ - | TCPServer |------->| UnixStreamServer | - +-----------+ +------------------+ - | - v - +-----------+ +--------------------+ - | UDPServer |------->| UnixDatagramServer | - +-----------+ +--------------------+ - -Note that UnixDatagramServer derives from UDPServer, not from -UnixStreamServer -- the only difference between an IP and a Unix -stream server is the address family, which is simply repeated in both -unix server classes. - -Forking and threading versions of each type of server can be created -using the ForkingMixIn and ThreadingMixIn mix-in classes. For -instance, a threading UDP server class is created as follows: - - class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass - -The Mix-in class must come first, since it overrides a method defined -in UDPServer! Setting the various member variables also changes -the behavior of the underlying server mechanism. - -To implement a service, you must derive a class from -BaseRequestHandler and redefine its handle() method. You can then run -various versions of the service by combining one of the server classes -with your request handler class. - -The request handler class must be different for datagram or stream -services. This can be hidden by using the request handler -subclasses StreamRequestHandler or DatagramRequestHandler. - -Of course, you still have to use your head! - -For instance, it makes no sense to use a forking server if the service -contains state in memory that can be modified by requests (since the -modifications in the child process would never reach the initial state -kept in the parent process and passed to each child). In this case, -you can use a threading server, but you will probably have to use -locks to avoid two requests that come in nearly simultaneous to apply -conflicting changes to the server state. - -On the other hand, if you are building e.g. an HTTP server, where all -data is stored externally (e.g. in the file system), a synchronous -class will essentially render the service "deaf" while one request is -being handled -- which may be for a very long time if a client is slow -to read all the data it has requested. Here a threading or forking -server is appropriate. - -In some cases, it may be appropriate to process part of a request -synchronously, but to finish processing in a forked child depending on -the request data. This can be implemented by using a synchronous -server and doing an explicit fork in the request handler class -handle() method. - -Another approach to handling multiple simultaneous requests in an -environment that supports neither threads nor fork (or where these are -too expensive or inappropriate for the service) is to maintain an -explicit table of partially finished requests and to use select() to -decide which request to work on next (or whether to handle a new -incoming request). This is particularly important for stream services -where each client can potentially be connected for a long time (if -threads or subprocesses cannot be used). - -Future work: -- Standard classes for Sun RPC (which uses either UDP or TCP) -- Standard mix-in classes to implement various authentication - and encryption schemes -- Standard framework for select-based multiplexing - -XXX Open problems: -- What to do with out-of-band data? - -BaseServer: -- split generic "request" functionality out into BaseServer class. - Copyright (C) 2000 Luke Kenneth Casson Leighton - - example: read entries from a SQL database (requires overriding - get_request() to return a table entry from the database). - entry is processed by a RequestHandlerClass. - -""" - -# Author of the BaseServer patch: Luke Kenneth Casson Leighton - -# XXX Warning! -# There is a test suite for this module, but it cannot be run by the -# standard regression test. -# To run it manually, run Lib/test/test_socketserver.py. - -__version__ = "0.4" - - -import socket -import select -import sys -import os -import errno -try: - import threading -except ImportError: - import dummy_threading as threading - -__all__ = ["TCPServer","UDPServer","ForkingUDPServer","ForkingTCPServer", - "ThreadingUDPServer","ThreadingTCPServer","BaseRequestHandler", - "StreamRequestHandler","DatagramRequestHandler", - "ThreadingMixIn", "ForkingMixIn"] -if hasattr(socket, "AF_UNIX"): - __all__.extend(["UnixStreamServer","UnixDatagramServer", - "ThreadingUnixStreamServer", - "ThreadingUnixDatagramServer"]) - -def _eintr_retry(func, *args): - """restart a system call interrupted by EINTR""" - while True: - try: - return func(*args) - except (OSError, select.error) as e: - if e.args[0] != errno.EINTR: - raise - -class BaseServer: - - """Base class for server classes. - - Methods for the caller: - - - __init__(server_address, RequestHandlerClass) - - serve_forever(poll_interval=0.5) - - shutdown() - - handle_request() # if you do not use serve_forever() - - fileno() -> int # for select() - - Methods that may be overridden: - - - server_bind() - - server_activate() - - get_request() -> request, client_address - - handle_timeout() - - verify_request(request, client_address) - - server_close() - - process_request(request, client_address) - - shutdown_request(request) - - close_request(request) - - handle_error() - - Methods for derived classes: - - - finish_request(request, client_address) - - Class variables that may be overridden by derived classes or - instances: - - - timeout - - address_family - - socket_type - - allow_reuse_address - - Instance variables: - - - RequestHandlerClass - - socket - - """ - - timeout = None - - def __init__(self, server_address, RequestHandlerClass): - """Constructor. May be extended, do not override.""" - self.server_address = server_address - self.RequestHandlerClass = RequestHandlerClass - self.__is_shut_down = threading.Event() - self.__shutdown_request = False - - def server_activate(self): - """Called by constructor to activate the server. - - May be overridden. - - """ - pass - - def serve_forever(self, poll_interval=0.5): - """Handle one request at a time until shutdown. - - Polls for shutdown every poll_interval seconds. Ignores - self.timeout. If you need to do periodic tasks, do them in - another thread. - """ - self.__is_shut_down.clear() - try: - while not self.__shutdown_request: - # XXX: Consider using another file descriptor or - # connecting to the socket to wake this up instead of - # polling. Polling reduces our responsiveness to a - # shutdown request and wastes cpu at all other times. - r, w, e = _eintr_retry(select.select, [self], [], [], - poll_interval) - if self in r: - self._handle_request_noblock() - finally: - self.__shutdown_request = False - self.__is_shut_down.set() - - def shutdown(self): - """Stops the serve_forever loop. - - Blocks until the loop has finished. This must be called while - serve_forever() is running in another thread, or it will - deadlock. - """ - self.__shutdown_request = True - self.__is_shut_down.wait() - - # The distinction between handling, getting, processing and - # finishing a request is fairly arbitrary. Remember: - # - # - handle_request() is the top-level call. It calls - # select, get_request(), verify_request() and process_request() - # - get_request() is different for stream or datagram sockets - # - process_request() is the place that may fork a new process - # or create a new thread to finish the request - # - finish_request() instantiates the request handler class; - # this constructor will handle the request all by itself - - def handle_request(self): - """Handle one request, possibly blocking. - - Respects self.timeout. - """ - # Support people who used socket.settimeout() to escape - # handle_request before self.timeout was available. - timeout = self.socket.gettimeout() - if timeout is None: - timeout = self.timeout - elif self.timeout is not None: - timeout = min(timeout, self.timeout) - fd_sets = _eintr_retry(select.select, [self], [], [], timeout) - if not fd_sets[0]: - self.handle_timeout() - return - self._handle_request_noblock() - - def _handle_request_noblock(self): - """Handle one request, without blocking. - - I assume that select.select has returned that the socket is - readable before this function was called, so there should be - no risk of blocking in get_request(). - """ - try: - request, client_address = self.get_request() - except socket.error: - return - if self.verify_request(request, client_address): - try: - self.process_request(request, client_address) - except: - self.handle_error(request, client_address) - self.shutdown_request(request) - - def handle_timeout(self): - """Called if no new request arrives within self.timeout. - - Overridden by ForkingMixIn. - """ - pass - - def verify_request(self, request, client_address): - """Verify the request. May be overridden. - - Return True if we should proceed with this request. - - """ - return True - - def process_request(self, request, client_address): - """Call finish_request. - - Overridden by ForkingMixIn and ThreadingMixIn. - - """ - self.finish_request(request, client_address) - self.shutdown_request(request) - - def server_close(self): - """Called to clean-up the server. - - May be overridden. - - """ - pass - - def finish_request(self, request, client_address): - """Finish one request by instantiating RequestHandlerClass.""" - self.RequestHandlerClass(request, client_address, self) - - def shutdown_request(self, request): - """Called to shutdown and close an individual request.""" - self.close_request(request) - - def close_request(self, request): - """Called to clean up an individual request.""" - pass - - def handle_error(self, request, client_address): - """Handle an error gracefully. May be overridden. - - The default is to print a traceback and continue. - - """ - print '-'*40 - print 'Exception happened during processing of request from', - print client_address - import traceback - traceback.print_exc() # XXX But this goes to stderr! - print '-'*40 - - -class TCPServer(BaseServer): - - """Base class for various socket-based server classes. - - Defaults to synchronous IP stream (i.e., TCP). - - Methods for the caller: - - - __init__(server_address, RequestHandlerClass, bind_and_activate=True) - - serve_forever(poll_interval=0.5) - - shutdown() - - handle_request() # if you don't use serve_forever() - - fileno() -> int # for select() - - Methods that may be overridden: - - - server_bind() - - server_activate() - - get_request() -> request, client_address - - handle_timeout() - - verify_request(request, client_address) - - process_request(request, client_address) - - shutdown_request(request) - - close_request(request) - - handle_error() - - Methods for derived classes: - - - finish_request(request, client_address) - - Class variables that may be overridden by derived classes or - instances: - - - timeout - - address_family - - socket_type - - request_queue_size (only for stream sockets) - - allow_reuse_address - - Instance variables: - - - server_address - - RequestHandlerClass - - socket - - """ - - address_family = socket.AF_INET - - socket_type = socket.SOCK_STREAM - - request_queue_size = 5 - - allow_reuse_address = False - - def __init__(self, server_address, RequestHandlerClass, bind_and_activate=True): - """Constructor. May be extended, do not override.""" - BaseServer.__init__(self, server_address, RequestHandlerClass) - self.socket = socket.socket(self.address_family, - self.socket_type) - if bind_and_activate: - try: - self.server_bind() - self.server_activate() - except: - self.server_close() - raise - - def server_bind(self): - """Called by constructor to bind the socket. - - May be overridden. - - """ - if self.allow_reuse_address: - self.socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self.socket.bind(self.server_address) - self.server_address = self.socket.getsockname() - - def server_activate(self): - """Called by constructor to activate the server. - - May be overridden. - - """ - self.socket.listen(self.request_queue_size) - - def server_close(self): - """Called to clean-up the server. - - May be overridden. - - """ - self.socket.close() - - def fileno(self): - """Return socket file number. - - Interface required by select(). - - """ - return self.socket.fileno() - - def get_request(self): - """Get the request and client address from the socket. - - May be overridden. - - """ - return self.socket.accept() - - def shutdown_request(self, request): - """Called to shutdown and close an individual request.""" - try: - #explicitly shutdown. socket.close() merely releases - #the socket and waits for GC to perform the actual close. - request.shutdown(socket.SHUT_WR) - except socket.error: - pass #some platforms may raise ENOTCONN here - self.close_request(request) - - def close_request(self, request): - """Called to clean up an individual request.""" - request.close() - - -class UDPServer(TCPServer): - - """UDP server class.""" - - allow_reuse_address = False - - socket_type = socket.SOCK_DGRAM - - max_packet_size = 8192 - - def get_request(self): - data, client_addr = self.socket.recvfrom(self.max_packet_size) - return (data, self.socket), client_addr - - def server_activate(self): - # No need to call listen() for UDP. - pass - - def shutdown_request(self, request): - # No need to shutdown anything. - self.close_request(request) - - def close_request(self, request): - # No need to close anything. - pass - -class ForkingMixIn: - - """Mix-in class to handle each request in a new process.""" - - timeout = 300 - active_children = None - max_children = 40 - - def collect_children(self): - """Internal routine to wait for children that have exited.""" - if self.active_children is None: - return - - # If we're above the max number of children, wait and reap them until - # we go back below threshold. Note that we use waitpid(-1) below to be - # able to collect children in size() syscalls instead - # of size(): the downside is that this might reap children - # which we didn't spawn, which is why we only resort to this when we're - # above max_children. - while len(self.active_children) >= self.max_children: - try: - pid, _ = os.waitpid(-1, 0) - self.active_children.discard(pid) - except OSError as e: - if e.errno == errno.ECHILD: - # we don't have any children, we're done - self.active_children.clear() - elif e.errno != errno.EINTR: - break - - # Now reap all defunct children. - for pid in self.active_children.copy(): - try: - pid, _ = os.waitpid(pid, os.WNOHANG) - # if the child hasn't exited yet, pid will be 0 and ignored by - # discard() below - self.active_children.discard(pid) - except OSError as e: - if e.errno == errno.ECHILD: - # someone else reaped it - self.active_children.discard(pid) - - def handle_timeout(self): - """Wait for zombies after self.timeout seconds of inactivity. - - May be extended, do not override. - """ - self.collect_children() - - def process_request(self, request, client_address): - """Fork a new subprocess to process the request.""" - self.collect_children() - pid = os.fork() - if pid: - # Parent process - if self.active_children is None: - self.active_children = set() - self.active_children.add(pid) - self.close_request(request) #close handle in parent process - return - else: - # Child process. - # This must never return, hence os._exit()! - try: - self.finish_request(request, client_address) - self.shutdown_request(request) - os._exit(0) - except: - try: - self.handle_error(request, client_address) - self.shutdown_request(request) - finally: - os._exit(1) - - -class ThreadingMixIn: - """Mix-in class to handle each request in a new thread.""" - - # Decides how threads will act upon termination of the - # main process - daemon_threads = False - - def process_request_thread(self, request, client_address): - """Same as in BaseServer but as a thread. - - In addition, exception handling is done here. - - """ - try: - self.finish_request(request, client_address) - self.shutdown_request(request) - except: - self.handle_error(request, client_address) - self.shutdown_request(request) - - def process_request(self, request, client_address): - """Start a new thread to process the request.""" - t = threading.Thread(target = self.process_request_thread, - args = (request, client_address)) - t.daemon = self.daemon_threads - t.start() - - -class ForkingUDPServer(ForkingMixIn, UDPServer): pass -class ForkingTCPServer(ForkingMixIn, TCPServer): pass - -class ThreadingUDPServer(ThreadingMixIn, UDPServer): pass -class ThreadingTCPServer(ThreadingMixIn, TCPServer): pass - -if hasattr(socket, 'AF_UNIX'): - - class UnixStreamServer(TCPServer): - address_family = socket.AF_UNIX - - class UnixDatagramServer(UDPServer): - address_family = socket.AF_UNIX - - class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer): pass - - class ThreadingUnixDatagramServer(ThreadingMixIn, UnixDatagramServer): pass - -class BaseRequestHandler: - - """Base class for request handler classes. - - This class is instantiated for each request to be handled. The - constructor sets the instance variables request, client_address - and server, and then calls the handle() method. To implement a - specific service, all you need to do is to derive a class which - defines a handle() method. - - The handle() method can find the request as self.request, the - client address as self.client_address, and the server (in case it - needs access to per-server information) as self.server. Since a - separate instance is created for each request, the handle() method - can define arbitrary other instance variariables. - - """ - - def __init__(self, request, client_address, server): - self.request = request - self.client_address = client_address - self.server = server - self.setup() - try: - self.handle() - finally: - self.finish() - - def setup(self): - pass - - def handle(self): - pass - - def finish(self): - pass - - -# The following two classes make it possible to use the same service -# class for stream or datagram servers. -# Each class sets up these instance variables: -# - rfile: a file object from which receives the request is read -# - wfile: a file object to which the reply is written -# When the handle() method returns, wfile is flushed properly - - -class StreamRequestHandler(BaseRequestHandler): - - """Define self.rfile and self.wfile for stream sockets.""" - - # Default buffer sizes for rfile, wfile. - # We default rfile to buffered because otherwise it could be - # really slow for large data (a getc() call per byte); we make - # wfile unbuffered because (a) often after a write() we want to - # read and we need to flush the line; (b) big writes to unbuffered - # files are typically optimized by stdio even when big reads - # aren't. - rbufsize = -1 - wbufsize = 0 - - # A timeout to apply to the request socket, if not None. - timeout = None - - # Disable nagle algorithm for this socket, if True. - # Use only when wbufsize != 0, to avoid small packets. - disable_nagle_algorithm = False - - def setup(self): - self.connection = self.request - if self.timeout is not None: - self.connection.settimeout(self.timeout) - if self.disable_nagle_algorithm: - self.connection.setsockopt(socket.IPPROTO_TCP, - socket.TCP_NODELAY, True) - self.rfile = self.connection.makefile('rb', self.rbufsize) - self.wfile = self.connection.makefile('wb', self.wbufsize) - - def finish(self): - if not self.wfile.closed: - try: - self.wfile.flush() - except socket.error: - # An final socket error may have occurred here, such as - # the local error ECONNABORTED. - pass - self.wfile.close() - self.rfile.close() - - -class DatagramRequestHandler(BaseRequestHandler): - - # XXX Regrettably, I cannot get this working on Linux; - # s.recvfrom() doesn't return a meaningful client address. - - """Define self.rfile and self.wfile for datagram sockets.""" - - def setup(self): - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - self.packet, self.socket = self.request - self.rfile = StringIO(self.packet) - self.wfile = StringIO() - - def finish(self): - self.socket.sendto(self.wfile.getvalue(), self.client_address) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py deleted file mode 100644 index 92f4b79..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/StringIO.py +++ /dev/null @@ -1,324 +0,0 @@ -r"""File-like objects that read from or write to a string buffer. - -This implements (nearly) all stdio methods. - -f = StringIO() # ready for writing -f = StringIO(buf) # ready for reading -f.close() # explicitly release resources held -flag = f.isatty() # always false -pos = f.tell() # get current position -f.seek(pos) # set current position -f.seek(pos, mode) # mode 0: absolute; 1: relative; 2: relative to EOF -buf = f.read() # read until EOF -buf = f.read(n) # read up to n bytes -buf = f.readline() # read until end of line ('\n') or EOF -list = f.readlines()# list of f.readline() results until EOF -f.truncate([size]) # truncate file at to at most size (default: current pos) -f.write(buf) # write at current position -f.writelines(list) # for line in list: f.write(line) -f.getvalue() # return whole file's contents as a string - -Notes: -- Using a real file is often faster (but less convenient). -- There's also a much faster implementation in C, called cStringIO, but - it's not subclassable. -- fileno() is left unimplemented so that code which uses it triggers - an exception early. -- Seeking far beyond EOF and then writing will insert real null - bytes that occupy space in the buffer. -- There's a simple test set (see end of this file). -""" -try: - from errno import EINVAL -except ImportError: - EINVAL = 22 - -__all__ = ["StringIO"] - -def _complain_ifclosed(closed): - if closed: - raise ValueError, "I/O operation on closed file" - -class StringIO: - """class StringIO([buffer]) - - When a StringIO object is created, it can be initialized to an existing - string by passing the string to the constructor. If no string is given, - the StringIO will start empty. - - The StringIO object can accept either Unicode or 8-bit strings, but - mixing the two may take some care. If both are used, 8-bit strings that - cannot be interpreted as 7-bit ASCII (that use the 8th bit) will cause - a UnicodeError to be raised when getvalue() is called. - """ - def __init__(self, buf = ''): - # Force self.buf to be a string or unicode - if not isinstance(buf, basestring): - buf = str(buf) - self.buf = buf - self.len = len(buf) - self.buflist = [] - self.pos = 0 - self.closed = False - self.softspace = 0 - - def __iter__(self): - return self - - def next(self): - """A file object is its own iterator, for example iter(f) returns f - (unless f is closed). When a file is used as an iterator, typically - in a for loop (for example, for line in f: print line), the next() - method is called repeatedly. This method returns the next input line, - or raises StopIteration when EOF is hit. - """ - _complain_ifclosed(self.closed) - r = self.readline() - if not r: - raise StopIteration - return r - - def close(self): - """Free the memory buffer. - """ - if not self.closed: - self.closed = True - del self.buf, self.pos - - def isatty(self): - """Returns False because StringIO objects are not connected to a - tty-like device. - """ - _complain_ifclosed(self.closed) - return False - - def seek(self, pos, mode = 0): - """Set the file's current position. - - The mode argument is optional and defaults to 0 (absolute file - positioning); other values are 1 (seek relative to the current - position) and 2 (seek relative to the file's end). - - There is no return value. - """ - _complain_ifclosed(self.closed) - if self.buflist: - self.buf += ''.join(self.buflist) - self.buflist = [] - if mode == 1: - pos += self.pos - elif mode == 2: - pos += self.len - self.pos = max(0, pos) - - def tell(self): - """Return the file's current position.""" - _complain_ifclosed(self.closed) - return self.pos - - def read(self, n = -1): - """Read at most size bytes from the file - (less if the read hits EOF before obtaining size bytes). - - If the size argument is negative or omitted, read all data until EOF - is reached. The bytes are returned as a string object. An empty - string is returned when EOF is encountered immediately. - """ - _complain_ifclosed(self.closed) - if self.buflist: - self.buf += ''.join(self.buflist) - self.buflist = [] - if n is None or n < 0: - newpos = self.len - else: - newpos = min(self.pos+n, self.len) - r = self.buf[self.pos:newpos] - self.pos = newpos - return r - - def readline(self, length=None): - r"""Read one entire line from the file. - - A trailing newline character is kept in the string (but may be absent - when a file ends with an incomplete line). If the size argument is - present and non-negative, it is a maximum byte count (including the - trailing newline) and an incomplete line may be returned. - - An empty string is returned only when EOF is encountered immediately. - - Note: Unlike stdio's fgets(), the returned string contains null - characters ('\0') if they occurred in the input. - """ - _complain_ifclosed(self.closed) - if self.buflist: - self.buf += ''.join(self.buflist) - self.buflist = [] - i = self.buf.find('\n', self.pos) - if i < 0: - newpos = self.len - else: - newpos = i+1 - if length is not None and length >= 0: - if self.pos + length < newpos: - newpos = self.pos + length - r = self.buf[self.pos:newpos] - self.pos = newpos - return r - - def readlines(self, sizehint = 0): - """Read until EOF using readline() and return a list containing the - lines thus read. - - If the optional sizehint argument is present, instead of reading up - to EOF, whole lines totalling approximately sizehint bytes (or more - to accommodate a final whole line). - """ - total = 0 - lines = [] - line = self.readline() - while line: - lines.append(line) - total += len(line) - if 0 < sizehint <= total: - break - line = self.readline() - return lines - - def truncate(self, size=None): - """Truncate the file's size. - - If the optional size argument is present, the file is truncated to - (at most) that size. The size defaults to the current position. - The current file position is not changed unless the position - is beyond the new file size. - - If the specified size exceeds the file's current size, the - file remains unchanged. - """ - _complain_ifclosed(self.closed) - if size is None: - size = self.pos - elif size < 0: - raise IOError(EINVAL, "Negative size not allowed") - elif size < self.pos: - self.pos = size - self.buf = self.getvalue()[:size] - self.len = size - - def write(self, s): - """Write a string to the file. - - There is no return value. - """ - _complain_ifclosed(self.closed) - if not s: return - # Force s to be a string or unicode - if not isinstance(s, basestring): - s = str(s) - spos = self.pos - slen = self.len - if spos == slen: - self.buflist.append(s) - self.len = self.pos = spos + len(s) - return - if spos > slen: - self.buflist.append('\0'*(spos - slen)) - slen = spos - newpos = spos + len(s) - if spos < slen: - if self.buflist: - self.buf += ''.join(self.buflist) - self.buflist = [self.buf[:spos], s, self.buf[newpos:]] - self.buf = '' - if newpos > slen: - slen = newpos - else: - self.buflist.append(s) - slen = newpos - self.len = slen - self.pos = newpos - - def writelines(self, iterable): - """Write a sequence of strings to the file. The sequence can be any - iterable object producing strings, typically a list of strings. There - is no return value. - - (The name is intended to match readlines(); writelines() does not add - line separators.) - """ - write = self.write - for line in iterable: - write(line) - - def flush(self): - """Flush the internal buffer - """ - _complain_ifclosed(self.closed) - - def getvalue(self): - """ - Retrieve the entire contents of the "file" at any time before - the StringIO object's close() method is called. - - The StringIO object can accept either Unicode or 8-bit strings, - but mixing the two may take some care. If both are used, 8-bit - strings that cannot be interpreted as 7-bit ASCII (that use the - 8th bit) will cause a UnicodeError to be raised when getvalue() - is called. - """ - _complain_ifclosed(self.closed) - if self.buflist: - self.buf += ''.join(self.buflist) - self.buflist = [] - return self.buf - - -# A little test suite - -def test(): - import sys - if sys.argv[1:]: - file = sys.argv[1] - else: - file = '/etc/passwd' - lines = open(file, 'r').readlines() - text = open(file, 'r').read() - f = StringIO() - for line in lines[:-2]: - f.write(line) - f.writelines(lines[-2:]) - if f.getvalue() != text: - raise RuntimeError, 'write failed' - length = f.tell() - print 'File length =', length - f.seek(len(lines[0])) - f.write(lines[1]) - f.seek(0) - print 'First line =', repr(f.readline()) - print 'Position =', f.tell() - line = f.readline() - print 'Second line =', repr(line) - f.seek(-len(line), 1) - line2 = f.read(len(line)) - if line != line2: - raise RuntimeError, 'bad result after seek back' - f.seek(len(line2), 1) - list = f.readlines() - line = list[-1] - f.seek(f.tell() - len(line)) - line2 = f.read() - if line != line2: - raise RuntimeError, 'bad result after seek back from EOF' - print 'Read', len(list), 'more lines' - print 'File length =', f.tell() - if f.tell() != length: - raise RuntimeError, 'bad length' - f.truncate(length/2) - f.seek(0, 2) - print 'Truncated length =', f.tell() - if f.tell() != length/2: - raise RuntimeError, 'truncate did not adjust length' - f.close() - -if __name__ == '__main__': - test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py deleted file mode 100644 index 67822a3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/UserDict.py +++ /dev/null @@ -1,180 +0,0 @@ -"""A more or less complete user-defined wrapper around dictionary objects.""" - -class UserDict: - def __init__(self, dict=None, **kwargs): - self.data = {} - if dict is not None: - self.update(dict) - if len(kwargs): - self.update(kwargs) - def __repr__(self): return repr(self.data) - def __cmp__(self, dict): - if isinstance(dict, UserDict): - return cmp(self.data, dict.data) - else: - return cmp(self.data, dict) - __hash__ = None # Avoid Py3k warning - def __len__(self): return len(self.data) - def __getitem__(self, key): - if key in self.data: - return self.data[key] - if hasattr(self.__class__, "__missing__"): - return self.__class__.__missing__(self, key) - raise KeyError(key) - def __setitem__(self, key, item): self.data[key] = item - def __delitem__(self, key): del self.data[key] - def clear(self): self.data.clear() - def copy(self): - if self.__class__ is UserDict: - return UserDict(self.data.copy()) - import copy - data = self.data - try: - self.data = {} - c = copy.copy(self) - finally: - self.data = data - c.update(self) - return c - def keys(self): return self.data.keys() - def items(self): return self.data.items() - def iteritems(self): return self.data.iteritems() - def iterkeys(self): return self.data.iterkeys() - def itervalues(self): return self.data.itervalues() - def values(self): return self.data.values() - def has_key(self, key): return key in self.data - def update(self, dict=None, **kwargs): - if dict is None: - pass - elif isinstance(dict, UserDict): - self.data.update(dict.data) - elif isinstance(dict, type({})) or not hasattr(dict, 'items'): - self.data.update(dict) - else: - for k, v in dict.items(): - self[k] = v - if len(kwargs): - self.data.update(kwargs) - def get(self, key, failobj=None): - if key not in self: - return failobj - return self[key] - def setdefault(self, key, failobj=None): - if key not in self: - self[key] = failobj - return self[key] - def pop(self, key, *args): - return self.data.pop(key, *args) - def popitem(self): - return self.data.popitem() - def __contains__(self, key): - return key in self.data - @classmethod - def fromkeys(cls, iterable, value=None): - d = cls() - for key in iterable: - d[key] = value - return d - -class IterableUserDict(UserDict): - def __iter__(self): - return iter(self.data) - -import _abcoll -_abcoll.MutableMapping.register(IterableUserDict) - - -class DictMixin: - # Mixin defining all dictionary methods for classes that already have - # a minimum dictionary interface including getitem, setitem, delitem, - # and keys. Without knowledge of the subclass constructor, the mixin - # does not define __init__() or copy(). In addition to the four base - # methods, progressively more efficiency comes with defining - # __contains__(), __iter__(), and iteritems(). - - # second level definitions support higher levels - def __iter__(self): - for k in self.keys(): - yield k - def has_key(self, key): - try: - self[key] - except KeyError: - return False - return True - def __contains__(self, key): - return self.has_key(key) - - # third level takes advantage of second level definitions - def iteritems(self): - for k in self: - yield (k, self[k]) - def iterkeys(self): - return self.__iter__() - - # fourth level uses definitions from lower levels - def itervalues(self): - for _, v in self.iteritems(): - yield v - def values(self): - return [v for _, v in self.iteritems()] - def items(self): - return list(self.iteritems()) - def clear(self): - for key in self.keys(): - del self[key] - def setdefault(self, key, default=None): - try: - return self[key] - except KeyError: - self[key] = default - return default - def pop(self, key, *args): - if len(args) > 1: - raise TypeError, "pop expected at most 2 arguments, got "\ - + repr(1 + len(args)) - try: - value = self[key] - except KeyError: - if args: - return args[0] - raise - del self[key] - return value - def popitem(self): - try: - k, v = self.iteritems().next() - except StopIteration: - raise KeyError, 'container is empty' - del self[k] - return (k, v) - def update(self, other=None, **kwargs): - # Make progressively weaker assumptions about "other" - if other is None: - pass - elif hasattr(other, 'iteritems'): # iteritems saves memory and lookups - for k, v in other.iteritems(): - self[k] = v - elif hasattr(other, 'keys'): - for k in other.keys(): - self[k] = other[k] - else: - for k, v in other: - self[k] = v - if kwargs: - self.update(kwargs) - def get(self, key, default=None): - try: - return self[key] - except KeyError: - return default - def __repr__(self): - return repr(dict(self.iteritems())) - def __cmp__(self, other): - if other is None: - return 1 - if isinstance(other, DictMixin): - other = dict(other.iteritems()) - return cmp(dict(self.iteritems()), other) - def __len__(self): - return len(self.keys()) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py deleted file mode 100644 index 62f4051..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/_abcoll.py +++ /dev/null @@ -1,692 +0,0 @@ -# Copyright 2007 Google, Inc. All Rights Reserved. -# Licensed to PSF under a Contributor Agreement. - -"""Abstract Base Classes (ABCs) for collections, according to PEP 3119. - -DON'T USE THIS MODULE DIRECTLY! The classes here should be imported -via collections; they are defined here only to alleviate certain -bootstrapping issues. Unit tests are in test_collections. -""" - -from abc import ABCMeta, abstractmethod -import sys - -__all__ = ["Hashable", "Iterable", "Iterator", - "Sized", "Container", "Callable", - "Set", "MutableSet", - "Mapping", "MutableMapping", - "MappingView", "KeysView", "ItemsView", "ValuesView", - "Sequence", "MutableSequence", - ] - -### ONE-TRICK PONIES ### - -def _hasattr(C, attr): - try: - return any(attr in B.__dict__ for B in C.__mro__) - except AttributeError: - # Old-style class - return hasattr(C, attr) - - -class Hashable: - __metaclass__ = ABCMeta - - @abstractmethod - def __hash__(self): - return 0 - - @classmethod - def __subclasshook__(cls, C): - if cls is Hashable: - try: - for B in C.__mro__: - if "__hash__" in B.__dict__: - if B.__dict__["__hash__"]: - return True - break - except AttributeError: - # Old-style class - if getattr(C, "__hash__", None): - return True - return NotImplemented - - -class Iterable: - __metaclass__ = ABCMeta - - @abstractmethod - def __iter__(self): - while False: - yield None - - @classmethod - def __subclasshook__(cls, C): - if cls is Iterable: - if _hasattr(C, "__iter__"): - return True - return NotImplemented - -Iterable.register(str) - - -class Iterator(Iterable): - - @abstractmethod - def next(self): - 'Return the next item from the iterator. When exhausted, raise StopIteration' - raise StopIteration - - def __iter__(self): - return self - - @classmethod - def __subclasshook__(cls, C): - if cls is Iterator: - if _hasattr(C, "next") and _hasattr(C, "__iter__"): - return True - return NotImplemented - - -class Sized: - __metaclass__ = ABCMeta - - @abstractmethod - def __len__(self): - return 0 - - @classmethod - def __subclasshook__(cls, C): - if cls is Sized: - if _hasattr(C, "__len__"): - return True - return NotImplemented - - -class Container: - __metaclass__ = ABCMeta - - @abstractmethod - def __contains__(self, x): - return False - - @classmethod - def __subclasshook__(cls, C): - if cls is Container: - if _hasattr(C, "__contains__"): - return True - return NotImplemented - - -class Callable: - __metaclass__ = ABCMeta - - @abstractmethod - def __call__(self, *args, **kwds): - return False - - @classmethod - def __subclasshook__(cls, C): - if cls is Callable: - if _hasattr(C, "__call__"): - return True - return NotImplemented - - -### SETS ### - - -class Set(Sized, Iterable, Container): - """A set is a finite, iterable container. - - This class provides concrete generic implementations of all - methods except for __contains__, __iter__ and __len__. - - To override the comparisons (presumably for speed, as the - semantics are fixed), redefine __le__ and __ge__, - then the other operations will automatically follow suit. - """ - - def __le__(self, other): - if not isinstance(other, Set): - return NotImplemented - if len(self) > len(other): - return False - for elem in self: - if elem not in other: - return False - return True - - def __lt__(self, other): - if not isinstance(other, Set): - return NotImplemented - return len(self) < len(other) and self.__le__(other) - - def __gt__(self, other): - if not isinstance(other, Set): - return NotImplemented - return len(self) > len(other) and self.__ge__(other) - - def __ge__(self, other): - if not isinstance(other, Set): - return NotImplemented - if len(self) < len(other): - return False - for elem in other: - if elem not in self: - return False - return True - - def __eq__(self, other): - if not isinstance(other, Set): - return NotImplemented - return len(self) == len(other) and self.__le__(other) - - def __ne__(self, other): - return not (self == other) - - @classmethod - def _from_iterable(cls, it): - '''Construct an instance of the class from any iterable input. - - Must override this method if the class constructor signature - does not accept an iterable for an input. - ''' - return cls(it) - - def __and__(self, other): - if not isinstance(other, Iterable): - return NotImplemented - return self._from_iterable(value for value in other if value in self) - - __rand__ = __and__ - - def isdisjoint(self, other): - 'Return True if two sets have a null intersection.' - for value in other: - if value in self: - return False - return True - - def __or__(self, other): - if not isinstance(other, Iterable): - return NotImplemented - chain = (e for s in (self, other) for e in s) - return self._from_iterable(chain) - - __ror__ = __or__ - - def __sub__(self, other): - if not isinstance(other, Set): - if not isinstance(other, Iterable): - return NotImplemented - other = self._from_iterable(other) - return self._from_iterable(value for value in self - if value not in other) - - def __rsub__(self, other): - if not isinstance(other, Set): - if not isinstance(other, Iterable): - return NotImplemented - other = self._from_iterable(other) - return self._from_iterable(value for value in other - if value not in self) - - def __xor__(self, other): - if not isinstance(other, Set): - if not isinstance(other, Iterable): - return NotImplemented - other = self._from_iterable(other) - return (self - other) | (other - self) - - __rxor__ = __xor__ - - # Sets are not hashable by default, but subclasses can change this - __hash__ = None - - def _hash(self): - """Compute the hash value of a set. - - Note that we don't define __hash__: not all sets are hashable. - But if you define a hashable set type, its __hash__ should - call this function. - - This must be compatible __eq__. - - All sets ought to compare equal if they contain the same - elements, regardless of how they are implemented, and - regardless of the order of the elements; so there's not much - freedom for __eq__ or __hash__. We match the algorithm used - by the built-in frozenset type. - """ - MAX = sys.maxint - MASK = 2 * MAX + 1 - n = len(self) - h = 1927868237 * (n + 1) - h &= MASK - for x in self: - hx = hash(x) - h ^= (hx ^ (hx << 16) ^ 89869747) * 3644798167 - h &= MASK - h = h * 69069 + 907133923 - h &= MASK - if h > MAX: - h -= MASK + 1 - if h == -1: - h = 590923713 - return h - -Set.register(frozenset) - - -class MutableSet(Set): - """A mutable set is a finite, iterable container. - - This class provides concrete generic implementations of all - methods except for __contains__, __iter__, __len__, - add(), and discard(). - - To override the comparisons (presumably for speed, as the - semantics are fixed), all you have to do is redefine __le__ and - then the other operations will automatically follow suit. - """ - - @abstractmethod - def add(self, value): - """Add an element.""" - raise NotImplementedError - - @abstractmethod - def discard(self, value): - """Remove an element. Do not raise an exception if absent.""" - raise NotImplementedError - - def remove(self, value): - """Remove an element. If not a member, raise a KeyError.""" - if value not in self: - raise KeyError(value) - self.discard(value) - - def pop(self): - """Return the popped value. Raise KeyError if empty.""" - it = iter(self) - try: - value = next(it) - except StopIteration: - raise KeyError - self.discard(value) - return value - - def clear(self): - """This is slow (creates N new iterators!) but effective.""" - try: - while True: - self.pop() - except KeyError: - pass - - def __ior__(self, it): - for value in it: - self.add(value) - return self - - def __iand__(self, it): - for value in (self - it): - self.discard(value) - return self - - def __ixor__(self, it): - if it is self: - self.clear() - else: - if not isinstance(it, Set): - it = self._from_iterable(it) - for value in it: - if value in self: - self.discard(value) - else: - self.add(value) - return self - - def __isub__(self, it): - if it is self: - self.clear() - else: - for value in it: - self.discard(value) - return self - -MutableSet.register(set) - - -### MAPPINGS ### - - -class Mapping(Sized, Iterable, Container): - - """A Mapping is a generic container for associating key/value - pairs. - - This class provides concrete generic implementations of all - methods except for __getitem__, __iter__, and __len__. - - """ - - @abstractmethod - def __getitem__(self, key): - raise KeyError - - def get(self, key, default=None): - 'D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None.' - try: - return self[key] - except KeyError: - return default - - def __contains__(self, key): - try: - self[key] - except KeyError: - return False - else: - return True - - def iterkeys(self): - 'D.iterkeys() -> an iterator over the keys of D' - return iter(self) - - def itervalues(self): - 'D.itervalues() -> an iterator over the values of D' - for key in self: - yield self[key] - - def iteritems(self): - 'D.iteritems() -> an iterator over the (key, value) items of D' - for key in self: - yield (key, self[key]) - - def keys(self): - "D.keys() -> list of D's keys" - return list(self) - - def items(self): - "D.items() -> list of D's (key, value) pairs, as 2-tuples" - return [(key, self[key]) for key in self] - - def values(self): - "D.values() -> list of D's values" - return [self[key] for key in self] - - # Mappings are not hashable by default, but subclasses can change this - __hash__ = None - - def __eq__(self, other): - if not isinstance(other, Mapping): - return NotImplemented - return dict(self.items()) == dict(other.items()) - - def __ne__(self, other): - return not (self == other) - -class MappingView(Sized): - - def __init__(self, mapping): - self._mapping = mapping - - def __len__(self): - return len(self._mapping) - - def __repr__(self): - return '{0.__class__.__name__}({0._mapping!r})'.format(self) - - -class KeysView(MappingView, Set): - - @classmethod - def _from_iterable(self, it): - return set(it) - - def __contains__(self, key): - return key in self._mapping - - def __iter__(self): - for key in self._mapping: - yield key - - -class ItemsView(MappingView, Set): - - @classmethod - def _from_iterable(self, it): - return set(it) - - def __contains__(self, item): - key, value = item - try: - v = self._mapping[key] - except KeyError: - return False - else: - return v == value - - def __iter__(self): - for key in self._mapping: - yield (key, self._mapping[key]) - - -class ValuesView(MappingView): - - def __contains__(self, value): - for key in self._mapping: - if value == self._mapping[key]: - return True - return False - - def __iter__(self): - for key in self._mapping: - yield self._mapping[key] - - -class MutableMapping(Mapping): - - """A MutableMapping is a generic container for associating - key/value pairs. - - This class provides concrete generic implementations of all - methods except for __getitem__, __setitem__, __delitem__, - __iter__, and __len__. - - """ - - @abstractmethod - def __setitem__(self, key, value): - raise KeyError - - @abstractmethod - def __delitem__(self, key): - raise KeyError - - __marker = object() - - def pop(self, key, default=__marker): - '''D.pop(k[,d]) -> v, remove specified key and return the corresponding value. - If key is not found, d is returned if given, otherwise KeyError is raised. - ''' - try: - value = self[key] - except KeyError: - if default is self.__marker: - raise - return default - else: - del self[key] - return value - - def popitem(self): - '''D.popitem() -> (k, v), remove and return some (key, value) pair - as a 2-tuple; but raise KeyError if D is empty. - ''' - try: - key = next(iter(self)) - except StopIteration: - raise KeyError - value = self[key] - del self[key] - return key, value - - def clear(self): - 'D.clear() -> None. Remove all items from D.' - try: - while True: - self.popitem() - except KeyError: - pass - - def update(*args, **kwds): - ''' D.update([E, ]**F) -> None. Update D from mapping/iterable E and F. - If E present and has a .keys() method, does: for k in E: D[k] = E[k] - If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v - In either case, this is followed by: for k, v in F.items(): D[k] = v - ''' - if not args: - raise TypeError("descriptor 'update' of 'MutableMapping' object " - "needs an argument") - self = args[0] - args = args[1:] - if len(args) > 1: - raise TypeError('update expected at most 1 arguments, got %d' % - len(args)) - if args: - other = args[0] - if isinstance(other, Mapping): - for key in other: - self[key] = other[key] - elif hasattr(other, "keys"): - for key in other.keys(): - self[key] = other[key] - else: - for key, value in other: - self[key] = value - for key, value in kwds.items(): - self[key] = value - - def setdefault(self, key, default=None): - 'D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D' - try: - return self[key] - except KeyError: - self[key] = default - return default - -MutableMapping.register(dict) - - -### SEQUENCES ### - - -class Sequence(Sized, Iterable, Container): - """All the operations on a read-only sequence. - - Concrete subclasses must override __new__ or __init__, - __getitem__, and __len__. - """ - - @abstractmethod - def __getitem__(self, index): - raise IndexError - - def __iter__(self): - i = 0 - try: - while True: - v = self[i] - yield v - i += 1 - except IndexError: - return - - def __contains__(self, value): - for v in self: - if v == value: - return True - return False - - def __reversed__(self): - for i in reversed(range(len(self))): - yield self[i] - - def index(self, value): - '''S.index(value) -> integer -- return first index of value. - Raises ValueError if the value is not present. - ''' - for i, v in enumerate(self): - if v == value: - return i - raise ValueError - - def count(self, value): - 'S.count(value) -> integer -- return number of occurrences of value' - return sum(1 for v in self if v == value) - -Sequence.register(tuple) -Sequence.register(basestring) -Sequence.register(buffer) -Sequence.register(xrange) - - -class MutableSequence(Sequence): - - """All the operations on a read-only sequence. - - Concrete subclasses must provide __new__ or __init__, - __getitem__, __setitem__, __delitem__, __len__, and insert(). - - """ - - @abstractmethod - def __setitem__(self, index, value): - raise IndexError - - @abstractmethod - def __delitem__(self, index): - raise IndexError - - @abstractmethod - def insert(self, index, value): - 'S.insert(index, object) -- insert object before index' - raise IndexError - - def append(self, value): - 'S.append(object) -- append object to the end of the sequence' - self.insert(len(self), value) - - def reverse(self): - 'S.reverse() -- reverse *IN PLACE*' - n = len(self) - for i in range(n//2): - self[i], self[n-i-1] = self[n-i-1], self[i] - - def extend(self, values): - 'S.extend(iterable) -- extend sequence by appending elements from the iterable' - for v in values: - self.append(v) - - def pop(self, index=-1): - '''S.pop([index]) -> item -- remove and return item at index (default last). - Raise IndexError if list is empty or index is out of range. - ''' - v = self[index] - del self[index] - return v - - def remove(self, value): - '''S.remove(value) -- remove first occurrence of value. - Raise ValueError if the value is not present. - ''' - del self[self.index(value)] - - def __iadd__(self, values): - self.extend(values) - return self - -MutableSequence.register(list) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py deleted file mode 100644 index 9cd1857..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/_weakrefset.py +++ /dev/null @@ -1,204 +0,0 @@ -# Access WeakSet through the weakref module. -# This code is separated-out because it is needed -# by abc.py to load everything else at startup. - -from _weakref import ref - -__all__ = ['WeakSet'] - - -class _IterationGuard(object): - # This context manager registers itself in the current iterators of the - # weak container, such as to delay all removals until the context manager - # exits. - # This technique should be relatively thread-safe (since sets are). - - def __init__(self, weakcontainer): - # Don't create cycles - self.weakcontainer = ref(weakcontainer) - - def __enter__(self): - w = self.weakcontainer() - if w is not None: - w._iterating.add(self) - return self - - def __exit__(self, e, t, b): - w = self.weakcontainer() - if w is not None: - s = w._iterating - s.remove(self) - if not s: - w._commit_removals() - - -class WeakSet(object): - def __init__(self, data=None): - self.data = set() - def _remove(item, selfref=ref(self)): - self = selfref() - if self is not None: - if self._iterating: - self._pending_removals.append(item) - else: - self.data.discard(item) - self._remove = _remove - # A list of keys to be removed - self._pending_removals = [] - self._iterating = set() - if data is not None: - self.update(data) - - def _commit_removals(self): - l = self._pending_removals - discard = self.data.discard - while l: - discard(l.pop()) - - def __iter__(self): - with _IterationGuard(self): - for itemref in self.data: - item = itemref() - if item is not None: - # Caveat: the iterator will keep a strong reference to - # `item` until it is resumed or closed. - yield item - - def __len__(self): - return len(self.data) - len(self._pending_removals) - - def __contains__(self, item): - try: - wr = ref(item) - except TypeError: - return False - return wr in self.data - - def __reduce__(self): - return (self.__class__, (list(self),), - getattr(self, '__dict__', None)) - - __hash__ = None - - def add(self, item): - if self._pending_removals: - self._commit_removals() - self.data.add(ref(item, self._remove)) - - def clear(self): - if self._pending_removals: - self._commit_removals() - self.data.clear() - - def copy(self): - return self.__class__(self) - - def pop(self): - if self._pending_removals: - self._commit_removals() - while True: - try: - itemref = self.data.pop() - except KeyError: - raise KeyError('pop from empty WeakSet') - item = itemref() - if item is not None: - return item - - def remove(self, item): - if self._pending_removals: - self._commit_removals() - self.data.remove(ref(item)) - - def discard(self, item): - if self._pending_removals: - self._commit_removals() - self.data.discard(ref(item)) - - def update(self, other): - if self._pending_removals: - self._commit_removals() - for element in other: - self.add(element) - - def __ior__(self, other): - self.update(other) - return self - - def difference(self, other): - newset = self.copy() - newset.difference_update(other) - return newset - __sub__ = difference - - def difference_update(self, other): - self.__isub__(other) - def __isub__(self, other): - if self._pending_removals: - self._commit_removals() - if self is other: - self.data.clear() - else: - self.data.difference_update(ref(item) for item in other) - return self - - def intersection(self, other): - return self.__class__(item for item in other if item in self) - __and__ = intersection - - def intersection_update(self, other): - self.__iand__(other) - def __iand__(self, other): - if self._pending_removals: - self._commit_removals() - self.data.intersection_update(ref(item) for item in other) - return self - - def issubset(self, other): - return self.data.issubset(ref(item) for item in other) - __le__ = issubset - - def __lt__(self, other): - return self.data < set(ref(item) for item in other) - - def issuperset(self, other): - return self.data.issuperset(ref(item) for item in other) - __ge__ = issuperset - - def __gt__(self, other): - return self.data > set(ref(item) for item in other) - - def __eq__(self, other): - if not isinstance(other, self.__class__): - return NotImplemented - return self.data == set(ref(item) for item in other) - - def __ne__(self, other): - opposite = self.__eq__(other) - if opposite is NotImplemented: - return NotImplemented - return not opposite - - def symmetric_difference(self, other): - newset = self.copy() - newset.symmetric_difference_update(other) - return newset - __xor__ = symmetric_difference - - def symmetric_difference_update(self, other): - self.__ixor__(other) - def __ixor__(self, other): - if self._pending_removals: - self._commit_removals() - if self is other: - self.data.clear() - else: - self.data.symmetric_difference_update(ref(item, self._remove) for item in other) - return self - - def union(self, other): - return self.__class__(e for s in (self, other) for e in s) - __or__ = union - - def isdisjoint(self, other): - return len(self.intersection(other)) == 0 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py deleted file mode 100644 index 0e1bfec..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/abc.py +++ /dev/null @@ -1,185 +0,0 @@ -# Copyright 2007 Google, Inc. All Rights Reserved. -# Licensed to PSF under a Contributor Agreement. - -"""Abstract Base Classes (ABCs) according to PEP 3119.""" - -import types - -from _weakrefset import WeakSet - -# Instance of old-style class -class _C: pass -_InstanceType = type(_C()) - - -def abstractmethod(funcobj): - """A decorator indicating abstract methods. - - Requires that the metaclass is ABCMeta or derived from it. A - class that has a metaclass derived from ABCMeta cannot be - instantiated unless all of its abstract methods are overridden. - The abstract methods can be called using any of the normal - 'super' call mechanisms. - - Usage: - - class C: - __metaclass__ = ABCMeta - @abstractmethod - def my_abstract_method(self, ...): - ... - """ - funcobj.__isabstractmethod__ = True - return funcobj - - -class abstractproperty(property): - """A decorator indicating abstract properties. - - Requires that the metaclass is ABCMeta or derived from it. A - class that has a metaclass derived from ABCMeta cannot be - instantiated unless all of its abstract properties are overridden. - The abstract properties can be called using any of the normal - 'super' call mechanisms. - - Usage: - - class C: - __metaclass__ = ABCMeta - @abstractproperty - def my_abstract_property(self): - ... - - This defines a read-only property; you can also define a read-write - abstract property using the 'long' form of property declaration: - - class C: - __metaclass__ = ABCMeta - def getx(self): ... - def setx(self, value): ... - x = abstractproperty(getx, setx) - """ - __isabstractmethod__ = True - - -class ABCMeta(type): - - """Metaclass for defining Abstract Base Classes (ABCs). - - Use this metaclass to create an ABC. An ABC can be subclassed - directly, and then acts as a mix-in class. You can also register - unrelated concrete classes (even built-in classes) and unrelated - ABCs as 'virtual subclasses' -- these and their descendants will - be considered subclasses of the registering ABC by the built-in - issubclass() function, but the registering ABC won't show up in - their MRO (Method Resolution Order) nor will method - implementations defined by the registering ABC be callable (not - even via super()). - - """ - - # A global counter that is incremented each time a class is - # registered as a virtual subclass of anything. It forces the - # negative cache to be cleared before its next use. - _abc_invalidation_counter = 0 - - def __new__(mcls, name, bases, namespace): - cls = super(ABCMeta, mcls).__new__(mcls, name, bases, namespace) - # Compute set of abstract method names - abstracts = set(name - for name, value in namespace.items() - if getattr(value, "__isabstractmethod__", False)) - for base in bases: - for name in getattr(base, "__abstractmethods__", set()): - value = getattr(cls, name, None) - if getattr(value, "__isabstractmethod__", False): - abstracts.add(name) - cls.__abstractmethods__ = frozenset(abstracts) - # Set up inheritance registry - cls._abc_registry = WeakSet() - cls._abc_cache = WeakSet() - cls._abc_negative_cache = WeakSet() - cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter - return cls - - def register(cls, subclass): - """Register a virtual subclass of an ABC.""" - if not isinstance(subclass, (type, types.ClassType)): - raise TypeError("Can only register classes") - if issubclass(subclass, cls): - return # Already a subclass - # Subtle: test for cycles *after* testing for "already a subclass"; - # this means we allow X.register(X) and interpret it as a no-op. - if issubclass(cls, subclass): - # This would create a cycle, which is bad for the algorithm below - raise RuntimeError("Refusing to create an inheritance cycle") - cls._abc_registry.add(subclass) - ABCMeta._abc_invalidation_counter += 1 # Invalidate negative cache - - def _dump_registry(cls, file=None): - """Debug helper to print the ABC registry.""" - print >> file, "Class: %s.%s" % (cls.__module__, cls.__name__) - print >> file, "Inv.counter: %s" % ABCMeta._abc_invalidation_counter - for name in sorted(cls.__dict__.keys()): - if name.startswith("_abc_"): - value = getattr(cls, name) - print >> file, "%s: %r" % (name, value) - - def __instancecheck__(cls, instance): - """Override for isinstance(instance, cls).""" - # Inline the cache checking when it's simple. - subclass = getattr(instance, '__class__', None) - if subclass is not None and subclass in cls._abc_cache: - return True - subtype = type(instance) - # Old-style instances - if subtype is _InstanceType: - subtype = subclass - if subtype is subclass or subclass is None: - if (cls._abc_negative_cache_version == - ABCMeta._abc_invalidation_counter and - subtype in cls._abc_negative_cache): - return False - # Fall back to the subclass check. - return cls.__subclasscheck__(subtype) - return (cls.__subclasscheck__(subclass) or - cls.__subclasscheck__(subtype)) - - def __subclasscheck__(cls, subclass): - """Override for issubclass(subclass, cls).""" - # Check cache - if subclass in cls._abc_cache: - return True - # Check negative cache; may have to invalidate - if cls._abc_negative_cache_version < ABCMeta._abc_invalidation_counter: - # Invalidate the negative cache - cls._abc_negative_cache = WeakSet() - cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter - elif subclass in cls._abc_negative_cache: - return False - # Check the subclass hook - ok = cls.__subclasshook__(subclass) - if ok is not NotImplemented: - assert isinstance(ok, bool) - if ok: - cls._abc_cache.add(subclass) - else: - cls._abc_negative_cache.add(subclass) - return ok - # Check if it's a direct subclass - if cls in getattr(subclass, '__mro__', ()): - cls._abc_cache.add(subclass) - return True - # Check if it's a subclass of a registered class (recursive) - for rcls in cls._abc_registry: - if issubclass(subclass, rcls): - cls._abc_cache.add(subclass) - return True - # Check if it's a subclass of a subclass (recursive) - for scls in cls.__subclasses__(): - if issubclass(subclass, scls): - cls._abc_cache.add(subclass) - return True - # No dice; update negative cache - cls._abc_negative_cache.add(subclass) - return False diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py deleted file mode 100644 index 4d56aa7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/argparse.py +++ /dev/null @@ -1,2374 +0,0 @@ -# Author: Steven J. Bethard . - -"""Command-line parsing library - -This module is an optparse-inspired command-line parsing library that: - - - handles both optional and positional arguments - - produces highly informative usage messages - - supports parsers that dispatch to sub-parsers - -The following is a simple usage example that sums integers from the -command-line and writes the result to a file:: - - parser = argparse.ArgumentParser( - description='sum the integers at the command line') - parser.add_argument( - 'integers', metavar='int', nargs='+', type=int, - help='an integer to be summed') - parser.add_argument( - '--log', default=sys.stdout, type=argparse.FileType('w'), - help='the file where the sum should be written') - args = parser.parse_args() - args.log.write('%s' % sum(args.integers)) - args.log.close() - -The module contains the following public classes: - - - ArgumentParser -- The main entry point for command-line parsing. As the - example above shows, the add_argument() method is used to populate - the parser with actions for optional and positional arguments. Then - the parse_args() method is invoked to convert the args at the - command-line into an object with attributes. - - - ArgumentError -- The exception raised by ArgumentParser objects when - there are errors with the parser's actions. Errors raised while - parsing the command-line are caught by ArgumentParser and emitted - as command-line messages. - - - FileType -- A factory for defining types of files to be created. As the - example above shows, instances of FileType are typically passed as - the type= argument of add_argument() calls. - - - Action -- The base class for parser actions. Typically actions are - selected by passing strings like 'store_true' or 'append_const' to - the action= argument of add_argument(). However, for greater - customization of ArgumentParser actions, subclasses of Action may - be defined and passed as the action= argument. - - - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, - ArgumentDefaultsHelpFormatter -- Formatter classes which - may be passed as the formatter_class= argument to the - ArgumentParser constructor. HelpFormatter is the default, - RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser - not to change the formatting for help text, and - ArgumentDefaultsHelpFormatter adds information about argument defaults - to the help. - -All other classes in this module are considered implementation details. -(Also note that HelpFormatter and RawDescriptionHelpFormatter are only -considered public as object names -- the API of the formatter objects is -still considered an implementation detail.) -""" - -__version__ = '1.1' -__all__ = [ - 'ArgumentParser', - 'ArgumentError', - 'ArgumentTypeError', - 'FileType', - 'HelpFormatter', - 'ArgumentDefaultsHelpFormatter', - 'RawDescriptionHelpFormatter', - 'RawTextHelpFormatter', - 'Namespace', - 'Action', - 'ONE_OR_MORE', - 'OPTIONAL', - 'PARSER', - 'REMAINDER', - 'SUPPRESS', - 'ZERO_OR_MORE', -] - - -import collections as _collections -import copy as _copy -import os as _os -import re as _re -import sys as _sys -import textwrap as _textwrap - -from gettext import gettext as _ - - -def _callable(obj): - return hasattr(obj, '__call__') or hasattr(obj, '__bases__') - - -SUPPRESS = '==SUPPRESS==' - -OPTIONAL = '?' -ZERO_OR_MORE = '*' -ONE_OR_MORE = '+' -PARSER = 'A...' -REMAINDER = '...' -_UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args' - -# ============================= -# Utility functions and classes -# ============================= - -class _AttributeHolder(object): - """Abstract base class that provides __repr__. - - The __repr__ method returns a string in the format:: - ClassName(attr=name, attr=name, ...) - The attributes are determined either by a class-level attribute, - '_kwarg_names', or by inspecting the instance __dict__. - """ - - def __repr__(self): - type_name = type(self).__name__ - arg_strings = [] - for arg in self._get_args(): - arg_strings.append(repr(arg)) - for name, value in self._get_kwargs(): - arg_strings.append('%s=%r' % (name, value)) - return '%s(%s)' % (type_name, ', '.join(arg_strings)) - - def _get_kwargs(self): - return sorted(self.__dict__.items()) - - def _get_args(self): - return [] - - -def _ensure_value(namespace, name, value): - if getattr(namespace, name, None) is None: - setattr(namespace, name, value) - return getattr(namespace, name) - - -# =============== -# Formatting Help -# =============== - -class HelpFormatter(object): - """Formatter for generating usage messages and argument help strings. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def __init__(self, - prog, - indent_increment=2, - max_help_position=24, - width=None): - - # default setting for width - if width is None: - try: - width = int(_os.environ['COLUMNS']) - except (KeyError, ValueError): - width = 80 - width -= 2 - - self._prog = prog - self._indent_increment = indent_increment - self._max_help_position = max_help_position - self._max_help_position = min(max_help_position, - max(width - 20, indent_increment * 2)) - self._width = width - - self._current_indent = 0 - self._level = 0 - self._action_max_length = 0 - - self._root_section = self._Section(self, None) - self._current_section = self._root_section - - self._whitespace_matcher = _re.compile(r'\s+') - self._long_break_matcher = _re.compile(r'\n\n\n+') - - # =============================== - # Section and indentation methods - # =============================== - def _indent(self): - self._current_indent += self._indent_increment - self._level += 1 - - def _dedent(self): - self._current_indent -= self._indent_increment - assert self._current_indent >= 0, 'Indent decreased below 0.' - self._level -= 1 - - class _Section(object): - - def __init__(self, formatter, parent, heading=None): - self.formatter = formatter - self.parent = parent - self.heading = heading - self.items = [] - - def format_help(self): - # format the indented section - if self.parent is not None: - self.formatter._indent() - join = self.formatter._join_parts - for func, args in self.items: - func(*args) - item_help = join([func(*args) for func, args in self.items]) - if self.parent is not None: - self.formatter._dedent() - - # return nothing if the section was empty - if not item_help: - return '' - - # add the heading if the section was non-empty - if self.heading is not SUPPRESS and self.heading is not None: - current_indent = self.formatter._current_indent - heading = '%*s%s:\n' % (current_indent, '', self.heading) - else: - heading = '' - - # join the section-initial newline, the heading and the help - return join(['\n', heading, item_help, '\n']) - - def _add_item(self, func, args): - self._current_section.items.append((func, args)) - - # ======================== - # Message building methods - # ======================== - def start_section(self, heading): - self._indent() - section = self._Section(self, self._current_section, heading) - self._add_item(section.format_help, []) - self._current_section = section - - def end_section(self): - self._current_section = self._current_section.parent - self._dedent() - - def add_text(self, text): - if text is not SUPPRESS and text is not None: - self._add_item(self._format_text, [text]) - - def add_usage(self, usage, actions, groups, prefix=None): - if usage is not SUPPRESS: - args = usage, actions, groups, prefix - self._add_item(self._format_usage, args) - - def add_argument(self, action): - if action.help is not SUPPRESS: - - # find all invocations - get_invocation = self._format_action_invocation - invocations = [get_invocation(action)] - for subaction in self._iter_indented_subactions(action): - invocations.append(get_invocation(subaction)) - - # update the maximum item length - invocation_length = max([len(s) for s in invocations]) - action_length = invocation_length + self._current_indent - self._action_max_length = max(self._action_max_length, - action_length) - - # add the item to the list - self._add_item(self._format_action, [action]) - - def add_arguments(self, actions): - for action in actions: - self.add_argument(action) - - # ======================= - # Help-formatting methods - # ======================= - def format_help(self): - help = self._root_section.format_help() - if help: - help = self._long_break_matcher.sub('\n\n', help) - help = help.strip('\n') + '\n' - return help - - def _join_parts(self, part_strings): - return ''.join([part - for part in part_strings - if part and part is not SUPPRESS]) - - def _format_usage(self, usage, actions, groups, prefix): - if prefix is None: - prefix = _('usage: ') - - # if usage is specified, use that - if usage is not None: - usage = usage % dict(prog=self._prog) - - # if no optionals or positionals are available, usage is just prog - elif usage is None and not actions: - usage = '%(prog)s' % dict(prog=self._prog) - - # if optionals and positionals are available, calculate usage - elif usage is None: - prog = '%(prog)s' % dict(prog=self._prog) - - # split optionals from positionals - optionals = [] - positionals = [] - for action in actions: - if action.option_strings: - optionals.append(action) - else: - positionals.append(action) - - # build full usage string - format = self._format_actions_usage - action_usage = format(optionals + positionals, groups) - usage = ' '.join([s for s in [prog, action_usage] if s]) - - # wrap the usage parts if it's too long - text_width = self._width - self._current_indent - if len(prefix) + len(usage) > text_width: - - # break usage into wrappable parts - part_regexp = r'\(.*?\)+|\[.*?\]+|\S+' - opt_usage = format(optionals, groups) - pos_usage = format(positionals, groups) - opt_parts = _re.findall(part_regexp, opt_usage) - pos_parts = _re.findall(part_regexp, pos_usage) - assert ' '.join(opt_parts) == opt_usage - assert ' '.join(pos_parts) == pos_usage - - # helper for wrapping lines - def get_lines(parts, indent, prefix=None): - lines = [] - line = [] - if prefix is not None: - line_len = len(prefix) - 1 - else: - line_len = len(indent) - 1 - for part in parts: - if line_len + 1 + len(part) > text_width and line: - lines.append(indent + ' '.join(line)) - line = [] - line_len = len(indent) - 1 - line.append(part) - line_len += len(part) + 1 - if line: - lines.append(indent + ' '.join(line)) - if prefix is not None: - lines[0] = lines[0][len(indent):] - return lines - - # if prog is short, follow it with optionals or positionals - if len(prefix) + len(prog) <= 0.75 * text_width: - indent = ' ' * (len(prefix) + len(prog) + 1) - if opt_parts: - lines = get_lines([prog] + opt_parts, indent, prefix) - lines.extend(get_lines(pos_parts, indent)) - elif pos_parts: - lines = get_lines([prog] + pos_parts, indent, prefix) - else: - lines = [prog] - - # if prog is long, put it on its own line - else: - indent = ' ' * len(prefix) - parts = opt_parts + pos_parts - lines = get_lines(parts, indent) - if len(lines) > 1: - lines = [] - lines.extend(get_lines(opt_parts, indent)) - lines.extend(get_lines(pos_parts, indent)) - lines = [prog] + lines - - # join lines into usage - usage = '\n'.join(lines) - - # prefix with 'usage:' - return '%s%s\n\n' % (prefix, usage) - - def _format_actions_usage(self, actions, groups): - # find group indices and identify actions in groups - group_actions = set() - inserts = {} - for group in groups: - try: - start = actions.index(group._group_actions[0]) - except ValueError: - continue - else: - end = start + len(group._group_actions) - if actions[start:end] == group._group_actions: - for action in group._group_actions: - group_actions.add(action) - if not group.required: - if start in inserts: - inserts[start] += ' [' - else: - inserts[start] = '[' - inserts[end] = ']' - else: - if start in inserts: - inserts[start] += ' (' - else: - inserts[start] = '(' - inserts[end] = ')' - for i in range(start + 1, end): - inserts[i] = '|' - - # collect all actions format strings - parts = [] - for i, action in enumerate(actions): - - # suppressed arguments are marked with None - # remove | separators for suppressed arguments - if action.help is SUPPRESS: - parts.append(None) - if inserts.get(i) == '|': - inserts.pop(i) - elif inserts.get(i + 1) == '|': - inserts.pop(i + 1) - - # produce all arg strings - elif not action.option_strings: - part = self._format_args(action, action.dest) - - # if it's in a group, strip the outer [] - if action in group_actions: - if part[0] == '[' and part[-1] == ']': - part = part[1:-1] - - # add the action string to the list - parts.append(part) - - # produce the first way to invoke the option in brackets - else: - option_string = action.option_strings[0] - - # if the Optional doesn't take a value, format is: - # -s or --long - if action.nargs == 0: - part = '%s' % option_string - - # if the Optional takes a value, format is: - # -s ARGS or --long ARGS - else: - default = action.dest.upper() - args_string = self._format_args(action, default) - part = '%s %s' % (option_string, args_string) - - # make it look optional if it's not required or in a group - if not action.required and action not in group_actions: - part = '[%s]' % part - - # add the action string to the list - parts.append(part) - - # insert things at the necessary indices - for i in sorted(inserts, reverse=True): - parts[i:i] = [inserts[i]] - - # join all the action items with spaces - text = ' '.join([item for item in parts if item is not None]) - - # clean up separators for mutually exclusive groups - open = r'[\[(]' - close = r'[\])]' - text = _re.sub(r'(%s) ' % open, r'\1', text) - text = _re.sub(r' (%s)' % close, r'\1', text) - text = _re.sub(r'%s *%s' % (open, close), r'', text) - text = _re.sub(r'\(([^|]*)\)', r'\1', text) - text = text.strip() - - # return the text - return text - - def _format_text(self, text): - if '%(prog)' in text: - text = text % dict(prog=self._prog) - text_width = max(self._width - self._current_indent, 11) - indent = ' ' * self._current_indent - return self._fill_text(text, text_width, indent) + '\n\n' - - def _format_action(self, action): - # determine the required width and the entry label - help_position = min(self._action_max_length + 2, - self._max_help_position) - help_width = max(self._width - help_position, 11) - action_width = help_position - self._current_indent - 2 - action_header = self._format_action_invocation(action) - - # ho nelp; start on same line and add a final newline - if not action.help: - tup = self._current_indent, '', action_header - action_header = '%*s%s\n' % tup - - # short action name; start on the same line and pad two spaces - elif len(action_header) <= action_width: - tup = self._current_indent, '', action_width, action_header - action_header = '%*s%-*s ' % tup - indent_first = 0 - - # long action name; start on the next line - else: - tup = self._current_indent, '', action_header - action_header = '%*s%s\n' % tup - indent_first = help_position - - # collect the pieces of the action help - parts = [action_header] - - # if there was help for the action, add lines of help text - if action.help: - help_text = self._expand_help(action) - help_lines = self._split_lines(help_text, help_width) - parts.append('%*s%s\n' % (indent_first, '', help_lines[0])) - for line in help_lines[1:]: - parts.append('%*s%s\n' % (help_position, '', line)) - - # or add a newline if the description doesn't end with one - elif not action_header.endswith('\n'): - parts.append('\n') - - # if there are any sub-actions, add their help as well - for subaction in self._iter_indented_subactions(action): - parts.append(self._format_action(subaction)) - - # return a single string - return self._join_parts(parts) - - def _format_action_invocation(self, action): - if not action.option_strings: - metavar, = self._metavar_formatter(action, action.dest)(1) - return metavar - - else: - parts = [] - - # if the Optional doesn't take a value, format is: - # -s, --long - if action.nargs == 0: - parts.extend(action.option_strings) - - # if the Optional takes a value, format is: - # -s ARGS, --long ARGS - else: - default = action.dest.upper() - args_string = self._format_args(action, default) - for option_string in action.option_strings: - parts.append('%s %s' % (option_string, args_string)) - - return ', '.join(parts) - - def _metavar_formatter(self, action, default_metavar): - if action.metavar is not None: - result = action.metavar - elif action.choices is not None: - choice_strs = [str(choice) for choice in action.choices] - result = '{%s}' % ','.join(choice_strs) - else: - result = default_metavar - - def format(tuple_size): - if isinstance(result, tuple): - return result - else: - return (result, ) * tuple_size - return format - - def _format_args(self, action, default_metavar): - get_metavar = self._metavar_formatter(action, default_metavar) - if action.nargs is None: - result = '%s' % get_metavar(1) - elif action.nargs == OPTIONAL: - result = '[%s]' % get_metavar(1) - elif action.nargs == ZERO_OR_MORE: - result = '[%s [%s ...]]' % get_metavar(2) - elif action.nargs == ONE_OR_MORE: - result = '%s [%s ...]' % get_metavar(2) - elif action.nargs == REMAINDER: - result = '...' - elif action.nargs == PARSER: - result = '%s ...' % get_metavar(1) - else: - formats = ['%s' for _ in range(action.nargs)] - result = ' '.join(formats) % get_metavar(action.nargs) - return result - - def _expand_help(self, action): - params = dict(vars(action), prog=self._prog) - for name in list(params): - if params[name] is SUPPRESS: - del params[name] - for name in list(params): - if hasattr(params[name], '__name__'): - params[name] = params[name].__name__ - if params.get('choices') is not None: - choices_str = ', '.join([str(c) for c in params['choices']]) - params['choices'] = choices_str - return self._get_help_string(action) % params - - def _iter_indented_subactions(self, action): - try: - get_subactions = action._get_subactions - except AttributeError: - pass - else: - self._indent() - for subaction in get_subactions(): - yield subaction - self._dedent() - - def _split_lines(self, text, width): - text = self._whitespace_matcher.sub(' ', text).strip() - return _textwrap.wrap(text, width) - - def _fill_text(self, text, width, indent): - text = self._whitespace_matcher.sub(' ', text).strip() - return _textwrap.fill(text, width, initial_indent=indent, - subsequent_indent=indent) - - def _get_help_string(self, action): - return action.help - - -class RawDescriptionHelpFormatter(HelpFormatter): - """Help message formatter which retains any formatting in descriptions. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def _fill_text(self, text, width, indent): - return ''.join([indent + line for line in text.splitlines(True)]) - - -class RawTextHelpFormatter(RawDescriptionHelpFormatter): - """Help message formatter which retains formatting of all help text. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def _split_lines(self, text, width): - return text.splitlines() - - -class ArgumentDefaultsHelpFormatter(HelpFormatter): - """Help message formatter which adds default values to argument help. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def _get_help_string(self, action): - help = action.help - if '%(default)' not in action.help: - if action.default is not SUPPRESS: - defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] - if action.option_strings or action.nargs in defaulting_nargs: - help += ' (default: %(default)s)' - return help - - -# ===================== -# Options and Arguments -# ===================== - -def _get_action_name(argument): - if argument is None: - return None - elif argument.option_strings: - return '/'.join(argument.option_strings) - elif argument.metavar not in (None, SUPPRESS): - return argument.metavar - elif argument.dest not in (None, SUPPRESS): - return argument.dest - else: - return None - - -class ArgumentError(Exception): - """An error from creating or using an argument (optional or positional). - - The string value of this exception is the message, augmented with - information about the argument that caused it. - """ - - def __init__(self, argument, message): - self.argument_name = _get_action_name(argument) - self.message = message - - def __str__(self): - if self.argument_name is None: - format = '%(message)s' - else: - format = 'argument %(argument_name)s: %(message)s' - return format % dict(message=self.message, - argument_name=self.argument_name) - - -class ArgumentTypeError(Exception): - """An error from trying to convert a command line string to a type.""" - pass - - -# ============== -# Action classes -# ============== - -class Action(_AttributeHolder): - """Information about how to convert command line strings to Python objects. - - Action objects are used by an ArgumentParser to represent the information - needed to parse a single argument from one or more strings from the - command line. The keyword arguments to the Action constructor are also - all attributes of Action instances. - - Keyword Arguments: - - - option_strings -- A list of command-line option strings which - should be associated with this action. - - - dest -- The name of the attribute to hold the created object(s) - - - nargs -- The number of command-line arguments that should be - consumed. By default, one argument will be consumed and a single - value will be produced. Other values include: - - N (an integer) consumes N arguments (and produces a list) - - '?' consumes zero or one arguments - - '*' consumes zero or more arguments (and produces a list) - - '+' consumes one or more arguments (and produces a list) - Note that the difference between the default and nargs=1 is that - with the default, a single value will be produced, while with - nargs=1, a list containing a single value will be produced. - - - const -- The value to be produced if the option is specified and the - option uses an action that takes no values. - - - default -- The value to be produced if the option is not specified. - - - type -- A callable that accepts a single string argument, and - returns the converted value. The standard Python types str, int, - float, and complex are useful examples of such callables. If None, - str is used. - - - choices -- A container of values that should be allowed. If not None, - after a command-line argument has been converted to the appropriate - type, an exception will be raised if it is not a member of this - collection. - - - required -- True if the action must always be specified at the - command line. This is only meaningful for optional command-line - arguments. - - - help -- The help string describing the argument. - - - metavar -- The name to be used for the option's argument with the - help string. If None, the 'dest' value will be used as the name. - """ - - def __init__(self, - option_strings, - dest, - nargs=None, - const=None, - default=None, - type=None, - choices=None, - required=False, - help=None, - metavar=None): - self.option_strings = option_strings - self.dest = dest - self.nargs = nargs - self.const = const - self.default = default - self.type = type - self.choices = choices - self.required = required - self.help = help - self.metavar = metavar - - def _get_kwargs(self): - names = [ - 'option_strings', - 'dest', - 'nargs', - 'const', - 'default', - 'type', - 'choices', - 'help', - 'metavar', - ] - return [(name, getattr(self, name)) for name in names] - - def __call__(self, parser, namespace, values, option_string=None): - raise NotImplementedError(_('.__call__() not defined')) - - -class _StoreAction(Action): - - def __init__(self, - option_strings, - dest, - nargs=None, - const=None, - default=None, - type=None, - choices=None, - required=False, - help=None, - metavar=None): - if nargs == 0: - raise ValueError('nargs for store actions must be > 0; if you ' - 'have nothing to store, actions such as store ' - 'true or store const may be more appropriate') - if const is not None and nargs != OPTIONAL: - raise ValueError('nargs must be %r to supply const' % OPTIONAL) - super(_StoreAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=nargs, - const=const, - default=default, - type=type, - choices=choices, - required=required, - help=help, - metavar=metavar) - - def __call__(self, parser, namespace, values, option_string=None): - setattr(namespace, self.dest, values) - - -class _StoreConstAction(Action): - - def __init__(self, - option_strings, - dest, - const, - default=None, - required=False, - help=None, - metavar=None): - super(_StoreConstAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=0, - const=const, - default=default, - required=required, - help=help) - - def __call__(self, parser, namespace, values, option_string=None): - setattr(namespace, self.dest, self.const) - - -class _StoreTrueAction(_StoreConstAction): - - def __init__(self, - option_strings, - dest, - default=False, - required=False, - help=None): - super(_StoreTrueAction, self).__init__( - option_strings=option_strings, - dest=dest, - const=True, - default=default, - required=required, - help=help) - - -class _StoreFalseAction(_StoreConstAction): - - def __init__(self, - option_strings, - dest, - default=True, - required=False, - help=None): - super(_StoreFalseAction, self).__init__( - option_strings=option_strings, - dest=dest, - const=False, - default=default, - required=required, - help=help) - - -class _AppendAction(Action): - - def __init__(self, - option_strings, - dest, - nargs=None, - const=None, - default=None, - type=None, - choices=None, - required=False, - help=None, - metavar=None): - if nargs == 0: - raise ValueError('nargs for append actions must be > 0; if arg ' - 'strings are not supplying the value to append, ' - 'the append const action may be more appropriate') - if const is not None and nargs != OPTIONAL: - raise ValueError('nargs must be %r to supply const' % OPTIONAL) - super(_AppendAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=nargs, - const=const, - default=default, - type=type, - choices=choices, - required=required, - help=help, - metavar=metavar) - - def __call__(self, parser, namespace, values, option_string=None): - items = _copy.copy(_ensure_value(namespace, self.dest, [])) - items.append(values) - setattr(namespace, self.dest, items) - - -class _AppendConstAction(Action): - - def __init__(self, - option_strings, - dest, - const, - default=None, - required=False, - help=None, - metavar=None): - super(_AppendConstAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=0, - const=const, - default=default, - required=required, - help=help, - metavar=metavar) - - def __call__(self, parser, namespace, values, option_string=None): - items = _copy.copy(_ensure_value(namespace, self.dest, [])) - items.append(self.const) - setattr(namespace, self.dest, items) - - -class _CountAction(Action): - - def __init__(self, - option_strings, - dest, - default=None, - required=False, - help=None): - super(_CountAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=0, - default=default, - required=required, - help=help) - - def __call__(self, parser, namespace, values, option_string=None): - new_count = _ensure_value(namespace, self.dest, 0) + 1 - setattr(namespace, self.dest, new_count) - - -class _HelpAction(Action): - - def __init__(self, - option_strings, - dest=SUPPRESS, - default=SUPPRESS, - help=None): - super(_HelpAction, self).__init__( - option_strings=option_strings, - dest=dest, - default=default, - nargs=0, - help=help) - - def __call__(self, parser, namespace, values, option_string=None): - parser.print_help() - parser.exit() - - -class _VersionAction(Action): - - def __init__(self, - option_strings, - version=None, - dest=SUPPRESS, - default=SUPPRESS, - help="show program's version number and exit"): - super(_VersionAction, self).__init__( - option_strings=option_strings, - dest=dest, - default=default, - nargs=0, - help=help) - self.version = version - - def __call__(self, parser, namespace, values, option_string=None): - version = self.version - if version is None: - version = parser.version - formatter = parser._get_formatter() - formatter.add_text(version) - parser.exit(message=formatter.format_help()) - - -class _SubParsersAction(Action): - - class _ChoicesPseudoAction(Action): - - def __init__(self, name, help): - sup = super(_SubParsersAction._ChoicesPseudoAction, self) - sup.__init__(option_strings=[], dest=name, help=help) - - def __init__(self, - option_strings, - prog, - parser_class, - dest=SUPPRESS, - help=None, - metavar=None): - - self._prog_prefix = prog - self._parser_class = parser_class - self._name_parser_map = _collections.OrderedDict() - self._choices_actions = [] - - super(_SubParsersAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=PARSER, - choices=self._name_parser_map, - help=help, - metavar=metavar) - - def add_parser(self, name, **kwargs): - # set prog from the existing prefix - if kwargs.get('prog') is None: - kwargs['prog'] = '%s %s' % (self._prog_prefix, name) - - # create a pseudo-action to hold the choice help - if 'help' in kwargs: - help = kwargs.pop('help') - choice_action = self._ChoicesPseudoAction(name, help) - self._choices_actions.append(choice_action) - - # create the parser and add it to the map - parser = self._parser_class(**kwargs) - self._name_parser_map[name] = parser - return parser - - def _get_subactions(self): - return self._choices_actions - - def __call__(self, parser, namespace, values, option_string=None): - parser_name = values[0] - arg_strings = values[1:] - - # set the parser name if requested - if self.dest is not SUPPRESS: - setattr(namespace, self.dest, parser_name) - - # select the parser - try: - parser = self._name_parser_map[parser_name] - except KeyError: - tup = parser_name, ', '.join(self._name_parser_map) - msg = _('unknown parser %r (choices: %s)') % tup - raise ArgumentError(self, msg) - - # parse all the remaining options into the namespace - # store any unrecognized options on the object, so that the top - # level parser can decide what to do with them - - # In case this subparser defines new defaults, we parse them - # in a new namespace object and then update the original - # namespace for the relevant parts. - subnamespace, arg_strings = parser.parse_known_args(arg_strings, None) - for key, value in vars(subnamespace).items(): - setattr(namespace, key, value) - - if arg_strings: - vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, []) - getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings) - - -# ============== -# Type classes -# ============== - -class FileType(object): - """Factory for creating file object types - - Instances of FileType are typically passed as type= arguments to the - ArgumentParser add_argument() method. - - Keyword Arguments: - - mode -- A string indicating how the file is to be opened. Accepts the - same values as the builtin open() function. - - bufsize -- The file's desired buffer size. Accepts the same values as - the builtin open() function. - """ - - def __init__(self, mode='r', bufsize=-1): - self._mode = mode - self._bufsize = bufsize - - def __call__(self, string): - # the special argument "-" means sys.std{in,out} - if string == '-': - if 'r' in self._mode: - return _sys.stdin - elif 'w' in self._mode: - return _sys.stdout - else: - msg = _('argument "-" with mode %r') % self._mode - raise ValueError(msg) - - # all other arguments are used as file names - try: - return open(string, self._mode, self._bufsize) - except IOError as e: - message = _("can't open '%s': %s") - raise ArgumentTypeError(message % (string, e)) - - def __repr__(self): - args = self._mode, self._bufsize - args_str = ', '.join(repr(arg) for arg in args if arg != -1) - return '%s(%s)' % (type(self).__name__, args_str) - -# =========================== -# Optional and Positional Parsing -# =========================== - -class Namespace(_AttributeHolder): - """Simple object for storing attributes. - - Implements equality by attribute names and values, and provides a simple - string representation. - """ - - def __init__(self, **kwargs): - for name in kwargs: - setattr(self, name, kwargs[name]) - - __hash__ = None - - def __eq__(self, other): - if not isinstance(other, Namespace): - return NotImplemented - return vars(self) == vars(other) - - def __ne__(self, other): - if not isinstance(other, Namespace): - return NotImplemented - return not (self == other) - - def __contains__(self, key): - return key in self.__dict__ - - -class _ActionsContainer(object): - - def __init__(self, - description, - prefix_chars, - argument_default, - conflict_handler): - super(_ActionsContainer, self).__init__() - - self.description = description - self.argument_default = argument_default - self.prefix_chars = prefix_chars - self.conflict_handler = conflict_handler - - # set up registries - self._registries = {} - - # register actions - self.register('action', None, _StoreAction) - self.register('action', 'store', _StoreAction) - self.register('action', 'store_const', _StoreConstAction) - self.register('action', 'store_true', _StoreTrueAction) - self.register('action', 'store_false', _StoreFalseAction) - self.register('action', 'append', _AppendAction) - self.register('action', 'append_const', _AppendConstAction) - self.register('action', 'count', _CountAction) - self.register('action', 'help', _HelpAction) - self.register('action', 'version', _VersionAction) - self.register('action', 'parsers', _SubParsersAction) - - # raise an exception if the conflict handler is invalid - self._get_handler() - - # action storage - self._actions = [] - self._option_string_actions = {} - - # groups - self._action_groups = [] - self._mutually_exclusive_groups = [] - - # defaults storage - self._defaults = {} - - # determines whether an "option" looks like a negative number - self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$') - - # whether or not there are any optionals that look like negative - # numbers -- uses a list so it can be shared and edited - self._has_negative_number_optionals = [] - - # ==================== - # Registration methods - # ==================== - def register(self, registry_name, value, object): - registry = self._registries.setdefault(registry_name, {}) - registry[value] = object - - def _registry_get(self, registry_name, value, default=None): - return self._registries[registry_name].get(value, default) - - # ================================== - # Namespace default accessor methods - # ================================== - def set_defaults(self, **kwargs): - self._defaults.update(kwargs) - - # if these defaults match any existing arguments, replace - # the previous default on the object with the new one - for action in self._actions: - if action.dest in kwargs: - action.default = kwargs[action.dest] - - def get_default(self, dest): - for action in self._actions: - if action.dest == dest and action.default is not None: - return action.default - return self._defaults.get(dest, None) - - - # ======================= - # Adding argument actions - # ======================= - def add_argument(self, *args, **kwargs): - """ - add_argument(dest, ..., name=value, ...) - add_argument(option_string, option_string, ..., name=value, ...) - """ - - # if no positional args are supplied or only one is supplied and - # it doesn't look like an option string, parse a positional - # argument - chars = self.prefix_chars - if not args or len(args) == 1 and args[0][0] not in chars: - if args and 'dest' in kwargs: - raise ValueError('dest supplied twice for positional argument') - kwargs = self._get_positional_kwargs(*args, **kwargs) - - # otherwise, we're adding an optional argument - else: - kwargs = self._get_optional_kwargs(*args, **kwargs) - - # if no default was supplied, use the parser-level default - if 'default' not in kwargs: - dest = kwargs['dest'] - if dest in self._defaults: - kwargs['default'] = self._defaults[dest] - elif self.argument_default is not None: - kwargs['default'] = self.argument_default - - # create the action object, and add it to the parser - action_class = self._pop_action_class(kwargs) - if not _callable(action_class): - raise ValueError('unknown action "%s"' % (action_class,)) - action = action_class(**kwargs) - - # raise an error if the action type is not callable - type_func = self._registry_get('type', action.type, action.type) - if not _callable(type_func): - raise ValueError('%r is not callable' % (type_func,)) - - # raise an error if the metavar does not match the type - if hasattr(self, "_get_formatter"): - try: - self._get_formatter()._format_args(action, None) - except TypeError: - raise ValueError("length of metavar tuple does not match nargs") - - return self._add_action(action) - - def add_argument_group(self, *args, **kwargs): - group = _ArgumentGroup(self, *args, **kwargs) - self._action_groups.append(group) - return group - - def add_mutually_exclusive_group(self, **kwargs): - group = _MutuallyExclusiveGroup(self, **kwargs) - self._mutually_exclusive_groups.append(group) - return group - - def _add_action(self, action): - # resolve any conflicts - self._check_conflict(action) - - # add to actions list - self._actions.append(action) - action.container = self - - # index the action by any option strings it has - for option_string in action.option_strings: - self._option_string_actions[option_string] = action - - # set the flag if any option strings look like negative numbers - for option_string in action.option_strings: - if self._negative_number_matcher.match(option_string): - if not self._has_negative_number_optionals: - self._has_negative_number_optionals.append(True) - - # return the created action - return action - - def _remove_action(self, action): - self._actions.remove(action) - - def _add_container_actions(self, container): - # collect groups by titles - title_group_map = {} - for group in self._action_groups: - if group.title in title_group_map: - msg = _('cannot merge actions - two groups are named %r') - raise ValueError(msg % (group.title)) - title_group_map[group.title] = group - - # map each action to its group - group_map = {} - for group in container._action_groups: - - # if a group with the title exists, use that, otherwise - # create a new group matching the container's group - if group.title not in title_group_map: - title_group_map[group.title] = self.add_argument_group( - title=group.title, - description=group.description, - conflict_handler=group.conflict_handler) - - # map the actions to their new group - for action in group._group_actions: - group_map[action] = title_group_map[group.title] - - # add container's mutually exclusive groups - # NOTE: if add_mutually_exclusive_group ever gains title= and - # description= then this code will need to be expanded as above - for group in container._mutually_exclusive_groups: - mutex_group = self.add_mutually_exclusive_group( - required=group.required) - - # map the actions to their new mutex group - for action in group._group_actions: - group_map[action] = mutex_group - - # add all actions to this container or their group - for action in container._actions: - group_map.get(action, self)._add_action(action) - - def _get_positional_kwargs(self, dest, **kwargs): - # make sure required is not specified - if 'required' in kwargs: - msg = _("'required' is an invalid argument for positionals") - raise TypeError(msg) - - # mark positional arguments as required if at least one is - # always required - if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]: - kwargs['required'] = True - if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs: - kwargs['required'] = True - - # return the keyword arguments with no option strings - return dict(kwargs, dest=dest, option_strings=[]) - - def _get_optional_kwargs(self, *args, **kwargs): - # determine short and long option strings - option_strings = [] - long_option_strings = [] - for option_string in args: - # error on strings that don't start with an appropriate prefix - if not option_string[0] in self.prefix_chars: - msg = _('invalid option string %r: ' - 'must start with a character %r') - tup = option_string, self.prefix_chars - raise ValueError(msg % tup) - - # strings starting with two prefix characters are long options - option_strings.append(option_string) - if option_string[0] in self.prefix_chars: - if len(option_string) > 1: - if option_string[1] in self.prefix_chars: - long_option_strings.append(option_string) - - # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' - dest = kwargs.pop('dest', None) - if dest is None: - if long_option_strings: - dest_option_string = long_option_strings[0] - else: - dest_option_string = option_strings[0] - dest = dest_option_string.lstrip(self.prefix_chars) - if not dest: - msg = _('dest= is required for options like %r') - raise ValueError(msg % option_string) - dest = dest.replace('-', '_') - - # return the updated keyword arguments - return dict(kwargs, dest=dest, option_strings=option_strings) - - def _pop_action_class(self, kwargs, default=None): - action = kwargs.pop('action', default) - return self._registry_get('action', action, action) - - def _get_handler(self): - # determine function from conflict handler string - handler_func_name = '_handle_conflict_%s' % self.conflict_handler - try: - return getattr(self, handler_func_name) - except AttributeError: - msg = _('invalid conflict_resolution value: %r') - raise ValueError(msg % self.conflict_handler) - - def _check_conflict(self, action): - - # find all options that conflict with this option - confl_optionals = [] - for option_string in action.option_strings: - if option_string in self._option_string_actions: - confl_optional = self._option_string_actions[option_string] - confl_optionals.append((option_string, confl_optional)) - - # resolve any conflicts - if confl_optionals: - conflict_handler = self._get_handler() - conflict_handler(action, confl_optionals) - - def _handle_conflict_error(self, action, conflicting_actions): - message = _('conflicting option string(s): %s') - conflict_string = ', '.join([option_string - for option_string, action - in conflicting_actions]) - raise ArgumentError(action, message % conflict_string) - - def _handle_conflict_resolve(self, action, conflicting_actions): - - # remove all conflicting options - for option_string, action in conflicting_actions: - - # remove the conflicting option - action.option_strings.remove(option_string) - self._option_string_actions.pop(option_string, None) - - # if the option now has no option string, remove it from the - # container holding it - if not action.option_strings: - action.container._remove_action(action) - - -class _ArgumentGroup(_ActionsContainer): - - def __init__(self, container, title=None, description=None, **kwargs): - # add any missing keyword arguments by checking the container - update = kwargs.setdefault - update('conflict_handler', container.conflict_handler) - update('prefix_chars', container.prefix_chars) - update('argument_default', container.argument_default) - super_init = super(_ArgumentGroup, self).__init__ - super_init(description=description, **kwargs) - - # group attributes - self.title = title - self._group_actions = [] - - # share most attributes with the container - self._registries = container._registries - self._actions = container._actions - self._option_string_actions = container._option_string_actions - self._defaults = container._defaults - self._has_negative_number_optionals = \ - container._has_negative_number_optionals - self._mutually_exclusive_groups = container._mutually_exclusive_groups - - def _add_action(self, action): - action = super(_ArgumentGroup, self)._add_action(action) - self._group_actions.append(action) - return action - - def _remove_action(self, action): - super(_ArgumentGroup, self)._remove_action(action) - self._group_actions.remove(action) - - -class _MutuallyExclusiveGroup(_ArgumentGroup): - - def __init__(self, container, required=False): - super(_MutuallyExclusiveGroup, self).__init__(container) - self.required = required - self._container = container - - def _add_action(self, action): - if action.required: - msg = _('mutually exclusive arguments must be optional') - raise ValueError(msg) - action = self._container._add_action(action) - self._group_actions.append(action) - return action - - def _remove_action(self, action): - self._container._remove_action(action) - self._group_actions.remove(action) - - -class ArgumentParser(_AttributeHolder, _ActionsContainer): - """Object for parsing command line strings into Python objects. - - Keyword Arguments: - - prog -- The name of the program (default: sys.argv[0]) - - usage -- A usage message (default: auto-generated from arguments) - - description -- A description of what the program does - - epilog -- Text following the argument descriptions - - parents -- Parsers whose arguments should be copied into this one - - formatter_class -- HelpFormatter class for printing help messages - - prefix_chars -- Characters that prefix optional arguments - - fromfile_prefix_chars -- Characters that prefix files containing - additional arguments - - argument_default -- The default value for all arguments - - conflict_handler -- String indicating how to handle conflicts - - add_help -- Add a -h/-help option - """ - - def __init__(self, - prog=None, - usage=None, - description=None, - epilog=None, - version=None, - parents=[], - formatter_class=HelpFormatter, - prefix_chars='-', - fromfile_prefix_chars=None, - argument_default=None, - conflict_handler='error', - add_help=True): - - if version is not None: - import warnings - warnings.warn( - """The "version" argument to ArgumentParser is deprecated. """ - """Please use """ - """"add_argument(..., action='version', version="N", ...)" """ - """instead""", DeprecationWarning) - - superinit = super(ArgumentParser, self).__init__ - superinit(description=description, - prefix_chars=prefix_chars, - argument_default=argument_default, - conflict_handler=conflict_handler) - - # default setting for prog - if prog is None: - prog = _os.path.basename(_sys.argv[0]) - - self.prog = prog - self.usage = usage - self.epilog = epilog - self.version = version - self.formatter_class = formatter_class - self.fromfile_prefix_chars = fromfile_prefix_chars - self.add_help = add_help - - add_group = self.add_argument_group - self._positionals = add_group(_('positional arguments')) - self._optionals = add_group(_('optional arguments')) - self._subparsers = None - - # register types - def identity(string): - return string - self.register('type', None, identity) - - # add help and version arguments if necessary - # (using explicit default to override global argument_default) - default_prefix = '-' if '-' in prefix_chars else prefix_chars[0] - if self.add_help: - self.add_argument( - default_prefix+'h', default_prefix*2+'help', - action='help', default=SUPPRESS, - help=_('show this help message and exit')) - if self.version: - self.add_argument( - default_prefix+'v', default_prefix*2+'version', - action='version', default=SUPPRESS, - version=self.version, - help=_("show program's version number and exit")) - - # add parent arguments and defaults - for parent in parents: - self._add_container_actions(parent) - try: - defaults = parent._defaults - except AttributeError: - pass - else: - self._defaults.update(defaults) - - # ======================= - # Pretty __repr__ methods - # ======================= - def _get_kwargs(self): - names = [ - 'prog', - 'usage', - 'description', - 'version', - 'formatter_class', - 'conflict_handler', - 'add_help', - ] - return [(name, getattr(self, name)) for name in names] - - # ================================== - # Optional/Positional adding methods - # ================================== - def add_subparsers(self, **kwargs): - if self._subparsers is not None: - self.error(_('cannot have multiple subparser arguments')) - - # add the parser class to the arguments if it's not present - kwargs.setdefault('parser_class', type(self)) - - if 'title' in kwargs or 'description' in kwargs: - title = _(kwargs.pop('title', 'subcommands')) - description = _(kwargs.pop('description', None)) - self._subparsers = self.add_argument_group(title, description) - else: - self._subparsers = self._positionals - - # prog defaults to the usage message of this parser, skipping - # optional arguments and with no "usage:" prefix - if kwargs.get('prog') is None: - formatter = self._get_formatter() - positionals = self._get_positional_actions() - groups = self._mutually_exclusive_groups - formatter.add_usage(self.usage, positionals, groups, '') - kwargs['prog'] = formatter.format_help().strip() - - # create the parsers action and add it to the positionals list - parsers_class = self._pop_action_class(kwargs, 'parsers') - action = parsers_class(option_strings=[], **kwargs) - self._subparsers._add_action(action) - - # return the created parsers action - return action - - def _add_action(self, action): - if action.option_strings: - self._optionals._add_action(action) - else: - self._positionals._add_action(action) - return action - - def _get_optional_actions(self): - return [action - for action in self._actions - if action.option_strings] - - def _get_positional_actions(self): - return [action - for action in self._actions - if not action.option_strings] - - # ===================================== - # Command line argument parsing methods - # ===================================== - def parse_args(self, args=None, namespace=None): - args, argv = self.parse_known_args(args, namespace) - if argv: - msg = _('unrecognized arguments: %s') - self.error(msg % ' '.join(argv)) - return args - - def parse_known_args(self, args=None, namespace=None): - if args is None: - # args default to the system args - args = _sys.argv[1:] - else: - # make sure that args are mutable - args = list(args) - - # default Namespace built from parser defaults - if namespace is None: - namespace = Namespace() - - # add any action defaults that aren't present - for action in self._actions: - if action.dest is not SUPPRESS: - if not hasattr(namespace, action.dest): - if action.default is not SUPPRESS: - setattr(namespace, action.dest, action.default) - - # add any parser defaults that aren't present - for dest in self._defaults: - if not hasattr(namespace, dest): - setattr(namespace, dest, self._defaults[dest]) - - # parse the arguments and exit if there are any errors - try: - namespace, args = self._parse_known_args(args, namespace) - if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR): - args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) - delattr(namespace, _UNRECOGNIZED_ARGS_ATTR) - return namespace, args - except ArgumentError: - err = _sys.exc_info()[1] - self.error(str(err)) - - def _parse_known_args(self, arg_strings, namespace): - # replace arg strings that are file references - if self.fromfile_prefix_chars is not None: - arg_strings = self._read_args_from_files(arg_strings) - - # map all mutually exclusive arguments to the other arguments - # they can't occur with - action_conflicts = {} - for mutex_group in self._mutually_exclusive_groups: - group_actions = mutex_group._group_actions - for i, mutex_action in enumerate(mutex_group._group_actions): - conflicts = action_conflicts.setdefault(mutex_action, []) - conflicts.extend(group_actions[:i]) - conflicts.extend(group_actions[i + 1:]) - - # find all option indices, and determine the arg_string_pattern - # which has an 'O' if there is an option at an index, - # an 'A' if there is an argument, or a '-' if there is a '--' - option_string_indices = {} - arg_string_pattern_parts = [] - arg_strings_iter = iter(arg_strings) - for i, arg_string in enumerate(arg_strings_iter): - - # all args after -- are non-options - if arg_string == '--': - arg_string_pattern_parts.append('-') - for arg_string in arg_strings_iter: - arg_string_pattern_parts.append('A') - - # otherwise, add the arg to the arg strings - # and note the index if it was an option - else: - option_tuple = self._parse_optional(arg_string) - if option_tuple is None: - pattern = 'A' - else: - option_string_indices[i] = option_tuple - pattern = 'O' - arg_string_pattern_parts.append(pattern) - - # join the pieces together to form the pattern - arg_strings_pattern = ''.join(arg_string_pattern_parts) - - # converts arg strings to the appropriate and then takes the action - seen_actions = set() - seen_non_default_actions = set() - - def take_action(action, argument_strings, option_string=None): - seen_actions.add(action) - argument_values = self._get_values(action, argument_strings) - - # error if this argument is not allowed with other previously - # seen arguments, assuming that actions that use the default - # value don't really count as "present" - if argument_values is not action.default: - seen_non_default_actions.add(action) - for conflict_action in action_conflicts.get(action, []): - if conflict_action in seen_non_default_actions: - msg = _('not allowed with argument %s') - action_name = _get_action_name(conflict_action) - raise ArgumentError(action, msg % action_name) - - # take the action if we didn't receive a SUPPRESS value - # (e.g. from a default) - if argument_values is not SUPPRESS: - action(self, namespace, argument_values, option_string) - - # function to convert arg_strings into an optional action - def consume_optional(start_index): - - # get the optional identified at this index - option_tuple = option_string_indices[start_index] - action, option_string, explicit_arg = option_tuple - - # identify additional optionals in the same arg string - # (e.g. -xyz is the same as -x -y -z if no args are required) - match_argument = self._match_argument - action_tuples = [] - while True: - - # if we found no optional action, skip it - if action is None: - extras.append(arg_strings[start_index]) - return start_index + 1 - - # if there is an explicit argument, try to match the - # optional's string arguments to only this - if explicit_arg is not None: - arg_count = match_argument(action, 'A') - - # if the action is a single-dash option and takes no - # arguments, try to parse more single-dash options out - # of the tail of the option string - chars = self.prefix_chars - if arg_count == 0 and option_string[1] not in chars: - action_tuples.append((action, [], option_string)) - char = option_string[0] - option_string = char + explicit_arg[0] - new_explicit_arg = explicit_arg[1:] or None - optionals_map = self._option_string_actions - if option_string in optionals_map: - action = optionals_map[option_string] - explicit_arg = new_explicit_arg - else: - msg = _('ignored explicit argument %r') - raise ArgumentError(action, msg % explicit_arg) - - # if the action expect exactly one argument, we've - # successfully matched the option; exit the loop - elif arg_count == 1: - stop = start_index + 1 - args = [explicit_arg] - action_tuples.append((action, args, option_string)) - break - - # error if a double-dash option did not use the - # explicit argument - else: - msg = _('ignored explicit argument %r') - raise ArgumentError(action, msg % explicit_arg) - - # if there is no explicit argument, try to match the - # optional's string arguments with the following strings - # if successful, exit the loop - else: - start = start_index + 1 - selected_patterns = arg_strings_pattern[start:] - arg_count = match_argument(action, selected_patterns) - stop = start + arg_count - args = arg_strings[start:stop] - action_tuples.append((action, args, option_string)) - break - - # add the Optional to the list and return the index at which - # the Optional's string args stopped - assert action_tuples - for action, args, option_string in action_tuples: - take_action(action, args, option_string) - return stop - - # the list of Positionals left to be parsed; this is modified - # by consume_positionals() - positionals = self._get_positional_actions() - - # function to convert arg_strings into positional actions - def consume_positionals(start_index): - # match as many Positionals as possible - match_partial = self._match_arguments_partial - selected_pattern = arg_strings_pattern[start_index:] - arg_counts = match_partial(positionals, selected_pattern) - - # slice off the appropriate arg strings for each Positional - # and add the Positional and its args to the list - for action, arg_count in zip(positionals, arg_counts): - args = arg_strings[start_index: start_index + arg_count] - start_index += arg_count - take_action(action, args) - - # slice off the Positionals that we just parsed and return the - # index at which the Positionals' string args stopped - positionals[:] = positionals[len(arg_counts):] - return start_index - - # consume Positionals and Optionals alternately, until we have - # passed the last option string - extras = [] - start_index = 0 - if option_string_indices: - max_option_string_index = max(option_string_indices) - else: - max_option_string_index = -1 - while start_index <= max_option_string_index: - - # consume any Positionals preceding the next option - next_option_string_index = min([ - index - for index in option_string_indices - if index >= start_index]) - if start_index != next_option_string_index: - positionals_end_index = consume_positionals(start_index) - - # only try to parse the next optional if we didn't consume - # the option string during the positionals parsing - if positionals_end_index > start_index: - start_index = positionals_end_index - continue - else: - start_index = positionals_end_index - - # if we consumed all the positionals we could and we're not - # at the index of an option string, there were extra arguments - if start_index not in option_string_indices: - strings = arg_strings[start_index:next_option_string_index] - extras.extend(strings) - start_index = next_option_string_index - - # consume the next optional and any arguments for it - start_index = consume_optional(start_index) - - # consume any positionals following the last Optional - stop_index = consume_positionals(start_index) - - # if we didn't consume all the argument strings, there were extras - extras.extend(arg_strings[stop_index:]) - - # if we didn't use all the Positional objects, there were too few - # arg strings supplied. - if positionals: - self.error(_('too few arguments')) - - # make sure all required actions were present, and convert defaults. - for action in self._actions: - if action not in seen_actions: - if action.required: - name = _get_action_name(action) - self.error(_('argument %s is required') % name) - else: - # Convert action default now instead of doing it before - # parsing arguments to avoid calling convert functions - # twice (which may fail) if the argument was given, but - # only if it was defined already in the namespace - if (action.default is not None and - isinstance(action.default, basestring) and - hasattr(namespace, action.dest) and - action.default is getattr(namespace, action.dest)): - setattr(namespace, action.dest, - self._get_value(action, action.default)) - - # make sure all required groups had one option present - for group in self._mutually_exclusive_groups: - if group.required: - for action in group._group_actions: - if action in seen_non_default_actions: - break - - # if no actions were used, report the error - else: - names = [_get_action_name(action) - for action in group._group_actions - if action.help is not SUPPRESS] - msg = _('one of the arguments %s is required') - self.error(msg % ' '.join(names)) - - # return the updated namespace and the extra arguments - return namespace, extras - - def _read_args_from_files(self, arg_strings): - # expand arguments referencing files - new_arg_strings = [] - for arg_string in arg_strings: - - # for regular arguments, just add them back into the list - if not arg_string or arg_string[0] not in self.fromfile_prefix_chars: - new_arg_strings.append(arg_string) - - # replace arguments referencing files with the file content - else: - try: - args_file = open(arg_string[1:]) - try: - arg_strings = [] - for arg_line in args_file.read().splitlines(): - for arg in self.convert_arg_line_to_args(arg_line): - arg_strings.append(arg) - arg_strings = self._read_args_from_files(arg_strings) - new_arg_strings.extend(arg_strings) - finally: - args_file.close() - except IOError: - err = _sys.exc_info()[1] - self.error(str(err)) - - # return the modified argument list - return new_arg_strings - - def convert_arg_line_to_args(self, arg_line): - return [arg_line] - - def _match_argument(self, action, arg_strings_pattern): - # match the pattern for this action to the arg strings - nargs_pattern = self._get_nargs_pattern(action) - match = _re.match(nargs_pattern, arg_strings_pattern) - - # raise an exception if we weren't able to find a match - if match is None: - nargs_errors = { - None: _('expected one argument'), - OPTIONAL: _('expected at most one argument'), - ONE_OR_MORE: _('expected at least one argument'), - } - default = _('expected %s argument(s)') % action.nargs - msg = nargs_errors.get(action.nargs, default) - raise ArgumentError(action, msg) - - # return the number of arguments matched - return len(match.group(1)) - - def _match_arguments_partial(self, actions, arg_strings_pattern): - # progressively shorten the actions list by slicing off the - # final actions until we find a match - result = [] - for i in range(len(actions), 0, -1): - actions_slice = actions[:i] - pattern = ''.join([self._get_nargs_pattern(action) - for action in actions_slice]) - match = _re.match(pattern, arg_strings_pattern) - if match is not None: - result.extend([len(string) for string in match.groups()]) - break - - # return the list of arg string counts - return result - - def _parse_optional(self, arg_string): - # if it's an empty string, it was meant to be a positional - if not arg_string: - return None - - # if it doesn't start with a prefix, it was meant to be positional - if not arg_string[0] in self.prefix_chars: - return None - - # if the option string is present in the parser, return the action - if arg_string in self._option_string_actions: - action = self._option_string_actions[arg_string] - return action, arg_string, None - - # if it's just a single character, it was meant to be positional - if len(arg_string) == 1: - return None - - # if the option string before the "=" is present, return the action - if '=' in arg_string: - option_string, explicit_arg = arg_string.split('=', 1) - if option_string in self._option_string_actions: - action = self._option_string_actions[option_string] - return action, option_string, explicit_arg - - # search through all possible prefixes of the option string - # and all actions in the parser for possible interpretations - option_tuples = self._get_option_tuples(arg_string) - - # if multiple actions match, the option string was ambiguous - if len(option_tuples) > 1: - options = ', '.join([option_string - for action, option_string, explicit_arg in option_tuples]) - tup = arg_string, options - self.error(_('ambiguous option: %s could match %s') % tup) - - # if exactly one action matched, this segmentation is good, - # so return the parsed action - elif len(option_tuples) == 1: - option_tuple, = option_tuples - return option_tuple - - # if it was not found as an option, but it looks like a negative - # number, it was meant to be positional - # unless there are negative-number-like options - if self._negative_number_matcher.match(arg_string): - if not self._has_negative_number_optionals: - return None - - # if it contains a space, it was meant to be a positional - if ' ' in arg_string: - return None - - # it was meant to be an optional but there is no such option - # in this parser (though it might be a valid option in a subparser) - return None, arg_string, None - - def _get_option_tuples(self, option_string): - result = [] - - # option strings starting with two prefix characters are only - # split at the '=' - chars = self.prefix_chars - if option_string[0] in chars and option_string[1] in chars: - if '=' in option_string: - option_prefix, explicit_arg = option_string.split('=', 1) - else: - option_prefix = option_string - explicit_arg = None - for option_string in self._option_string_actions: - if option_string.startswith(option_prefix): - action = self._option_string_actions[option_string] - tup = action, option_string, explicit_arg - result.append(tup) - - # single character options can be concatenated with their arguments - # but multiple character options always have to have their argument - # separate - elif option_string[0] in chars and option_string[1] not in chars: - option_prefix = option_string - explicit_arg = None - short_option_prefix = option_string[:2] - short_explicit_arg = option_string[2:] - - for option_string in self._option_string_actions: - if option_string == short_option_prefix: - action = self._option_string_actions[option_string] - tup = action, option_string, short_explicit_arg - result.append(tup) - elif option_string.startswith(option_prefix): - action = self._option_string_actions[option_string] - tup = action, option_string, explicit_arg - result.append(tup) - - # shouldn't ever get here - else: - self.error(_('unexpected option string: %s') % option_string) - - # return the collected option tuples - return result - - def _get_nargs_pattern(self, action): - # in all examples below, we have to allow for '--' args - # which are represented as '-' in the pattern - nargs = action.nargs - - # the default (None) is assumed to be a single argument - if nargs is None: - nargs_pattern = '(-*A-*)' - - # allow zero or one arguments - elif nargs == OPTIONAL: - nargs_pattern = '(-*A?-*)' - - # allow zero or more arguments - elif nargs == ZERO_OR_MORE: - nargs_pattern = '(-*[A-]*)' - - # allow one or more arguments - elif nargs == ONE_OR_MORE: - nargs_pattern = '(-*A[A-]*)' - - # allow any number of options or arguments - elif nargs == REMAINDER: - nargs_pattern = '([-AO]*)' - - # allow one argument followed by any number of options or arguments - elif nargs == PARSER: - nargs_pattern = '(-*A[-AO]*)' - - # all others should be integers - else: - nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs) - - # if this is an optional action, -- is not allowed - if action.option_strings: - nargs_pattern = nargs_pattern.replace('-*', '') - nargs_pattern = nargs_pattern.replace('-', '') - - # return the pattern - return nargs_pattern - - # ======================== - # Value conversion methods - # ======================== - def _get_values(self, action, arg_strings): - # for everything but PARSER, REMAINDER args, strip out first '--' - if action.nargs not in [PARSER, REMAINDER]: - try: - arg_strings.remove('--') - except ValueError: - pass - - # optional argument produces a default when not present - if not arg_strings and action.nargs == OPTIONAL: - if action.option_strings: - value = action.const - else: - value = action.default - if isinstance(value, basestring): - value = self._get_value(action, value) - self._check_value(action, value) - - # when nargs='*' on a positional, if there were no command-line - # args, use the default if it is anything other than None - elif (not arg_strings and action.nargs == ZERO_OR_MORE and - not action.option_strings): - if action.default is not None: - value = action.default - else: - value = arg_strings - self._check_value(action, value) - - # single argument or optional argument produces a single value - elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]: - arg_string, = arg_strings - value = self._get_value(action, arg_string) - self._check_value(action, value) - - # REMAINDER arguments convert all values, checking none - elif action.nargs == REMAINDER: - value = [self._get_value(action, v) for v in arg_strings] - - # PARSER arguments convert all values, but check only the first - elif action.nargs == PARSER: - value = [self._get_value(action, v) for v in arg_strings] - self._check_value(action, value[0]) - - # all other types of nargs produce a list - else: - value = [self._get_value(action, v) for v in arg_strings] - for v in value: - self._check_value(action, v) - - # return the converted value - return value - - def _get_value(self, action, arg_string): - type_func = self._registry_get('type', action.type, action.type) - if not _callable(type_func): - msg = _('%r is not callable') - raise ArgumentError(action, msg % type_func) - - # convert the value to the appropriate type - try: - result = type_func(arg_string) - - # ArgumentTypeErrors indicate errors - except ArgumentTypeError: - name = getattr(action.type, '__name__', repr(action.type)) - msg = str(_sys.exc_info()[1]) - raise ArgumentError(action, msg) - - # TypeErrors or ValueErrors also indicate errors - except (TypeError, ValueError): - name = getattr(action.type, '__name__', repr(action.type)) - msg = _('invalid %s value: %r') - raise ArgumentError(action, msg % (name, arg_string)) - - # return the converted value - return result - - def _check_value(self, action, value): - # converted value must be one of the choices (if specified) - if action.choices is not None and value not in action.choices: - tup = value, ', '.join(map(repr, action.choices)) - msg = _('invalid choice: %r (choose from %s)') % tup - raise ArgumentError(action, msg) - - # ======================= - # Help-formatting methods - # ======================= - def format_usage(self): - formatter = self._get_formatter() - formatter.add_usage(self.usage, self._actions, - self._mutually_exclusive_groups) - return formatter.format_help() - - def format_help(self): - formatter = self._get_formatter() - - # usage - formatter.add_usage(self.usage, self._actions, - self._mutually_exclusive_groups) - - # description - formatter.add_text(self.description) - - # positionals, optionals and user-defined groups - for action_group in self._action_groups: - formatter.start_section(action_group.title) - formatter.add_text(action_group.description) - formatter.add_arguments(action_group._group_actions) - formatter.end_section() - - # epilog - formatter.add_text(self.epilog) - - # determine help from format above - return formatter.format_help() - - def format_version(self): - import warnings - warnings.warn( - 'The format_version method is deprecated -- the "version" ' - 'argument to ArgumentParser is no longer supported.', - DeprecationWarning) - formatter = self._get_formatter() - formatter.add_text(self.version) - return formatter.format_help() - - def _get_formatter(self): - return self.formatter_class(prog=self.prog) - - # ===================== - # Help-printing methods - # ===================== - def print_usage(self, file=None): - if file is None: - file = _sys.stdout - self._print_message(self.format_usage(), file) - - def print_help(self, file=None): - if file is None: - file = _sys.stdout - self._print_message(self.format_help(), file) - - def print_version(self, file=None): - import warnings - warnings.warn( - 'The print_version method is deprecated -- the "version" ' - 'argument to ArgumentParser is no longer supported.', - DeprecationWarning) - self._print_message(self.format_version(), file) - - def _print_message(self, message, file=None): - if message: - if file is None: - file = _sys.stderr - file.write(message) - - # =============== - # Exiting methods - # =============== - def exit(self, status=0, message=None): - if message: - self._print_message(message, _sys.stderr) - _sys.exit(status) - - def error(self, message): - """error(message: string) - - Prints a usage message incorporating the message to stderr and - exits. - - If you override this in a subclass, it should not return -- it - should either exit or raise an exception. - """ - self.print_usage(_sys.stderr) - self.exit(2, _('%s: error: %s\n') % (self.prog, message)) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py deleted file mode 100644 index 4070c39..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/ast.py +++ /dev/null @@ -1,311 +0,0 @@ -# -*- coding: utf-8 -*- -""" - ast - ~~~ - - The `ast` module helps Python applications to process trees of the Python - abstract syntax grammar. The abstract syntax itself might change with - each Python release; this module helps to find out programmatically what - the current grammar looks like and allows modifications of it. - - An abstract syntax tree can be generated by passing `ast.PyCF_ONLY_AST` as - a flag to the `compile()` builtin function or by using the `parse()` - function from this module. The result will be a tree of objects whose - classes all inherit from `ast.AST`. - - A modified abstract syntax tree can be compiled into a Python code object - using the built-in `compile()` function. - - Additionally various helper functions are provided that make working with - the trees simpler. The main intention of the helper functions and this - module in general is to provide an easy to use interface for libraries - that work tightly with the python syntax (template engines for example). - - - :copyright: Copyright 2008 by Armin Ronacher. - :license: Python License. -""" -from _ast import * -from _ast import __version__ - - -def parse(source, filename='', mode='exec'): - """ - Parse the source into an AST node. - Equivalent to compile(source, filename, mode, PyCF_ONLY_AST). - """ - return compile(source, filename, mode, PyCF_ONLY_AST) - - -def literal_eval(node_or_string): - """ - Safely evaluate an expression node or a string containing a Python - expression. The string or node provided may only consist of the following - Python literal structures: strings, numbers, tuples, lists, dicts, booleans, - and None. - """ - _safe_names = {'None': None, 'True': True, 'False': False} - if isinstance(node_or_string, basestring): - node_or_string = parse(node_or_string, mode='eval') - if isinstance(node_or_string, Expression): - node_or_string = node_or_string.body - def _convert(node): - if isinstance(node, Str): - return node.s - elif isinstance(node, Num): - return node.n - elif isinstance(node, Tuple): - return tuple(map(_convert, node.elts)) - elif isinstance(node, List): - return list(map(_convert, node.elts)) - elif isinstance(node, Dict): - return dict((_convert(k), _convert(v)) for k, v - in zip(node.keys, node.values)) - elif isinstance(node, Name): - if node.id in _safe_names: - return _safe_names[node.id] - elif isinstance(node, BinOp) and \ - isinstance(node.op, (Add, Sub)) and \ - isinstance(node.right, Num) and \ - isinstance(node.right.n, complex) and \ - isinstance(node.left, Num) and \ - isinstance(node.left.n, (int, long, float)): - left = node.left.n - right = node.right.n - if isinstance(node.op, Add): - return left + right - else: - return left - right - raise ValueError('malformed string') - return _convert(node_or_string) - - -def dump(node, annotate_fields=True, include_attributes=False): - """ - Return a formatted dump of the tree in *node*. This is mainly useful for - debugging purposes. The returned string will show the names and the values - for fields. This makes the code impossible to evaluate, so if evaluation is - wanted *annotate_fields* must be set to False. Attributes such as line - numbers and column offsets are not dumped by default. If this is wanted, - *include_attributes* can be set to True. - """ - def _format(node): - if isinstance(node, AST): - fields = [(a, _format(b)) for a, b in iter_fields(node)] - rv = '%s(%s' % (node.__class__.__name__, ', '.join( - ('%s=%s' % field for field in fields) - if annotate_fields else - (b for a, b in fields) - )) - if include_attributes and node._attributes: - rv += fields and ', ' or ' ' - rv += ', '.join('%s=%s' % (a, _format(getattr(node, a))) - for a in node._attributes) - return rv + ')' - elif isinstance(node, list): - return '[%s]' % ', '.join(_format(x) for x in node) - return repr(node) - if not isinstance(node, AST): - raise TypeError('expected AST, got %r' % node.__class__.__name__) - return _format(node) - - -def copy_location(new_node, old_node): - """ - Copy source location (`lineno` and `col_offset` attributes) from - *old_node* to *new_node* if possible, and return *new_node*. - """ - for attr in 'lineno', 'col_offset': - if attr in old_node._attributes and attr in new_node._attributes \ - and hasattr(old_node, attr): - setattr(new_node, attr, getattr(old_node, attr)) - return new_node - - -def fix_missing_locations(node): - """ - When you compile a node tree with compile(), the compiler expects lineno and - col_offset attributes for every node that supports them. This is rather - tedious to fill in for generated nodes, so this helper adds these attributes - recursively where not already set, by setting them to the values of the - parent node. It works recursively starting at *node*. - """ - def _fix(node, lineno, col_offset): - if 'lineno' in node._attributes: - if not hasattr(node, 'lineno'): - node.lineno = lineno - else: - lineno = node.lineno - if 'col_offset' in node._attributes: - if not hasattr(node, 'col_offset'): - node.col_offset = col_offset - else: - col_offset = node.col_offset - for child in iter_child_nodes(node): - _fix(child, lineno, col_offset) - _fix(node, 1, 0) - return node - - -def increment_lineno(node, n=1): - """ - Increment the line number of each node in the tree starting at *node* by *n*. - This is useful to "move code" to a different location in a file. - """ - for child in walk(node): - if 'lineno' in child._attributes: - child.lineno = getattr(child, 'lineno', 0) + n - return node - - -def iter_fields(node): - """ - Yield a tuple of ``(fieldname, value)`` for each field in ``node._fields`` - that is present on *node*. - """ - for field in node._fields: - try: - yield field, getattr(node, field) - except AttributeError: - pass - - -def iter_child_nodes(node): - """ - Yield all direct child nodes of *node*, that is, all fields that are nodes - and all items of fields that are lists of nodes. - """ - for name, field in iter_fields(node): - if isinstance(field, AST): - yield field - elif isinstance(field, list): - for item in field: - if isinstance(item, AST): - yield item - - -def get_docstring(node, clean=True): - """ - Return the docstring for the given node or None if no docstring can - be found. If the node provided does not have docstrings a TypeError - will be raised. - """ - if not isinstance(node, (FunctionDef, ClassDef, Module)): - raise TypeError("%r can't have docstrings" % node.__class__.__name__) - if node.body and isinstance(node.body[0], Expr) and \ - isinstance(node.body[0].value, Str): - if clean: - import inspect - return inspect.cleandoc(node.body[0].value.s) - return node.body[0].value.s - - -def walk(node): - """ - Recursively yield all descendant nodes in the tree starting at *node* - (including *node* itself), in no specified order. This is useful if you - only want to modify nodes in place and don't care about the context. - """ - from collections import deque - todo = deque([node]) - while todo: - node = todo.popleft() - todo.extend(iter_child_nodes(node)) - yield node - - -class NodeVisitor(object): - """ - A node visitor base class that walks the abstract syntax tree and calls a - visitor function for every node found. This function may return a value - which is forwarded by the `visit` method. - - This class is meant to be subclassed, with the subclass adding visitor - methods. - - Per default the visitor functions for the nodes are ``'visit_'`` + - class name of the node. So a `TryFinally` node visit function would - be `visit_TryFinally`. This behavior can be changed by overriding - the `visit` method. If no visitor function exists for a node - (return value `None`) the `generic_visit` visitor is used instead. - - Don't use the `NodeVisitor` if you want to apply changes to nodes during - traversing. For this a special visitor exists (`NodeTransformer`) that - allows modifications. - """ - - def visit(self, node): - """Visit a node.""" - method = 'visit_' + node.__class__.__name__ - visitor = getattr(self, method, self.generic_visit) - return visitor(node) - - def generic_visit(self, node): - """Called if no explicit visitor function exists for a node.""" - for field, value in iter_fields(node): - if isinstance(value, list): - for item in value: - if isinstance(item, AST): - self.visit(item) - elif isinstance(value, AST): - self.visit(value) - - -class NodeTransformer(NodeVisitor): - """ - A :class:`NodeVisitor` subclass that walks the abstract syntax tree and - allows modification of nodes. - - The `NodeTransformer` will walk the AST and use the return value of the - visitor methods to replace or remove the old node. If the return value of - the visitor method is ``None``, the node will be removed from its location, - otherwise it is replaced with the return value. The return value may be the - original node in which case no replacement takes place. - - Here is an example transformer that rewrites all occurrences of name lookups - (``foo``) to ``data['foo']``:: - - class RewriteName(NodeTransformer): - - def visit_Name(self, node): - return copy_location(Subscript( - value=Name(id='data', ctx=Load()), - slice=Index(value=Str(s=node.id)), - ctx=node.ctx - ), node) - - Keep in mind that if the node you're operating on has child nodes you must - either transform the child nodes yourself or call the :meth:`generic_visit` - method for the node first. - - For nodes that were part of a collection of statements (that applies to all - statement nodes), the visitor may also return a list of nodes rather than - just a single node. - - Usually you use the transformer like this:: - - node = YourTransformer().visit(node) - """ - - def generic_visit(self, node): - for field, old_value in iter_fields(node): - old_value = getattr(node, field, None) - if isinstance(old_value, list): - new_values = [] - for value in old_value: - if isinstance(value, AST): - value = self.visit(value) - if value is None: - continue - elif not isinstance(value, AST): - new_values.extend(value) - continue - new_values.append(value) - old_value[:] = new_values - elif isinstance(old_value, AST): - new_node = self.visit(old_value) - if new_node is None: - delattr(node, field) - else: - setattr(node, field, new_node) - return node diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py deleted file mode 100644 index 6c2769c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/atexit.py +++ /dev/null @@ -1,65 +0,0 @@ -""" -atexit.py - allow programmer to define multiple exit functions to be executed -upon normal program termination. - -One public function, register, is defined. -""" - -__all__ = ["register"] - -import sys - -_exithandlers = [] -def _run_exitfuncs(): - """run any registered exit functions - - _exithandlers is traversed in reverse order so functions are executed - last in, first out. - """ - - exc_info = None - while _exithandlers: - func, targs, kargs = _exithandlers.pop() - try: - func(*targs, **kargs) - except SystemExit: - exc_info = sys.exc_info() - except: - import traceback - print >> sys.stderr, "Error in atexit._run_exitfuncs:" - traceback.print_exc() - exc_info = sys.exc_info() - - if exc_info is not None: - raise exc_info[0], exc_info[1], exc_info[2] - - -def register(func, *targs, **kargs): - """register a function to be executed upon normal program termination - - func - function to be called at exit - targs - optional arguments to pass to func - kargs - optional keyword arguments to pass to func - - func is returned to facilitate usage as a decorator. - """ - _exithandlers.append((func, targs, kargs)) - return func - -if hasattr(sys, "exitfunc"): - # Assume it's another registered exit function - append it to our list - register(sys.exitfunc) -sys.exitfunc = _run_exitfuncs - -if __name__ == "__main__": - def x1(): - print "running x1" - def x2(n): - print "running x2(%r)" % (n,) - def x3(n, kwd=None): - print "running x3(%r, kwd=%r)" % (n, kwd) - - register(x1) - register(x2, 12) - register(x3, 5, "bar") - register(x3, "no kwd args") diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py deleted file mode 100644 index 4828c1c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/binhex.py +++ /dev/null @@ -1,518 +0,0 @@ -"""Macintosh binhex compression/decompression. - -easy interface: -binhex(inputfilename, outputfilename) -hexbin(inputfilename, outputfilename) -""" - -# -# Jack Jansen, CWI, August 1995. -# -# The module is supposed to be as compatible as possible. Especially the -# easy interface should work "as expected" on any platform. -# XXXX Note: currently, textfiles appear in mac-form on all platforms. -# We seem to lack a simple character-translate in python. -# (we should probably use ISO-Latin-1 on all but the mac platform). -# XXXX The simple routines are too simple: they expect to hold the complete -# files in-core. Should be fixed. -# XXXX It would be nice to handle AppleDouble format on unix -# (for servers serving macs). -# XXXX I don't understand what happens when you get 0x90 times the same byte on -# input. The resulting code (xx 90 90) would appear to be interpreted as an -# escaped *value* of 0x90. All coders I've seen appear to ignore this nicety... -# -import sys -import os -import struct -import binascii - -__all__ = ["binhex","hexbin","Error"] - -class Error(Exception): - pass - -# States (what have we written) -_DID_HEADER = 0 -_DID_DATA = 1 - -# Various constants -REASONABLY_LARGE=32768 # Minimal amount we pass the rle-coder -LINELEN=64 -RUNCHAR=chr(0x90) # run-length introducer - -# -# This code is no longer byte-order dependent - -# -# Workarounds for non-mac machines. -try: - from Carbon.File import FSSpec, FInfo - from MacOS import openrf - - def getfileinfo(name): - finfo = FSSpec(name).FSpGetFInfo() - dir, file = os.path.split(name) - # XXX Get resource/data sizes - fp = open(name, 'rb') - fp.seek(0, 2) - dlen = fp.tell() - fp = openrf(name, '*rb') - fp.seek(0, 2) - rlen = fp.tell() - return file, finfo, dlen, rlen - - def openrsrc(name, *mode): - if not mode: - mode = '*rb' - else: - mode = '*' + mode[0] - return openrf(name, mode) - -except ImportError: - # - # Glue code for non-macintosh usage - # - - class FInfo: - def __init__(self): - self.Type = '????' - self.Creator = '????' - self.Flags = 0 - - def getfileinfo(name): - finfo = FInfo() - # Quick check for textfile - fp = open(name) - data = open(name).read(256) - for c in data: - if not c.isspace() and (c<' ' or ord(c) > 0x7f): - break - else: - finfo.Type = 'TEXT' - fp.seek(0, 2) - dsize = fp.tell() - fp.close() - dir, file = os.path.split(name) - file = file.replace(':', '-', 1) - return file, finfo, dsize, 0 - - class openrsrc: - def __init__(self, *args): - pass - - def read(self, *args): - return '' - - def write(self, *args): - pass - - def close(self): - pass - -class _Hqxcoderengine: - """Write data to the coder in 3-byte chunks""" - - def __init__(self, ofp): - self.ofp = ofp - self.data = '' - self.hqxdata = '' - self.linelen = LINELEN-1 - - def write(self, data): - self.data = self.data + data - datalen = len(self.data) - todo = (datalen//3)*3 - data = self.data[:todo] - self.data = self.data[todo:] - if not data: - return - self.hqxdata = self.hqxdata + binascii.b2a_hqx(data) - self._flush(0) - - def _flush(self, force): - first = 0 - while first <= len(self.hqxdata)-self.linelen: - last = first + self.linelen - self.ofp.write(self.hqxdata[first:last]+'\n') - self.linelen = LINELEN - first = last - self.hqxdata = self.hqxdata[first:] - if force: - self.ofp.write(self.hqxdata + ':\n') - - def close(self): - if self.data: - self.hqxdata = \ - self.hqxdata + binascii.b2a_hqx(self.data) - self._flush(1) - self.ofp.close() - del self.ofp - -class _Rlecoderengine: - """Write data to the RLE-coder in suitably large chunks""" - - def __init__(self, ofp): - self.ofp = ofp - self.data = '' - - def write(self, data): - self.data = self.data + data - if len(self.data) < REASONABLY_LARGE: - return - rledata = binascii.rlecode_hqx(self.data) - self.ofp.write(rledata) - self.data = '' - - def close(self): - if self.data: - rledata = binascii.rlecode_hqx(self.data) - self.ofp.write(rledata) - self.ofp.close() - del self.ofp - -class BinHex: - def __init__(self, name_finfo_dlen_rlen, ofp): - name, finfo, dlen, rlen = name_finfo_dlen_rlen - if type(ofp) == type(''): - ofname = ofp - ofp = open(ofname, 'w') - ofp.write('(This file must be converted with BinHex 4.0)\n\n:') - hqxer = _Hqxcoderengine(ofp) - self.ofp = _Rlecoderengine(hqxer) - self.crc = 0 - if finfo is None: - finfo = FInfo() - self.dlen = dlen - self.rlen = rlen - self._writeinfo(name, finfo) - self.state = _DID_HEADER - - def _writeinfo(self, name, finfo): - nl = len(name) - if nl > 63: - raise Error, 'Filename too long' - d = chr(nl) + name + '\0' - d2 = finfo.Type + finfo.Creator - - # Force all structs to be packed with big-endian - d3 = struct.pack('>h', finfo.Flags) - d4 = struct.pack('>ii', self.dlen, self.rlen) - info = d + d2 + d3 + d4 - self._write(info) - self._writecrc() - - def _write(self, data): - self.crc = binascii.crc_hqx(data, self.crc) - self.ofp.write(data) - - def _writecrc(self): - # XXXX Should this be here?? - # self.crc = binascii.crc_hqx('\0\0', self.crc) - if self.crc < 0: - fmt = '>h' - else: - fmt = '>H' - self.ofp.write(struct.pack(fmt, self.crc)) - self.crc = 0 - - def write(self, data): - if self.state != _DID_HEADER: - raise Error, 'Writing data at the wrong time' - self.dlen = self.dlen - len(data) - self._write(data) - - def close_data(self): - if self.dlen != 0: - raise Error, 'Incorrect data size, diff=%r' % (self.rlen,) - self._writecrc() - self.state = _DID_DATA - - def write_rsrc(self, data): - if self.state < _DID_DATA: - self.close_data() - if self.state != _DID_DATA: - raise Error, 'Writing resource data at the wrong time' - self.rlen = self.rlen - len(data) - self._write(data) - - def close(self): - if self.state is None: - return - try: - if self.state < _DID_DATA: - self.close_data() - if self.state != _DID_DATA: - raise Error, 'Close at the wrong time' - if self.rlen != 0: - raise Error, \ - "Incorrect resource-datasize, diff=%r" % (self.rlen,) - self._writecrc() - finally: - self.state = None - ofp = self.ofp - del self.ofp - ofp.close() - -def binhex(inp, out): - """(infilename, outfilename) - Create binhex-encoded copy of a file""" - finfo = getfileinfo(inp) - ofp = BinHex(finfo, out) - - ifp = open(inp, 'rb') - # XXXX Do textfile translation on non-mac systems - while 1: - d = ifp.read(128000) - if not d: break - ofp.write(d) - ofp.close_data() - ifp.close() - - ifp = openrsrc(inp, 'rb') - while 1: - d = ifp.read(128000) - if not d: break - ofp.write_rsrc(d) - ofp.close() - ifp.close() - -class _Hqxdecoderengine: - """Read data via the decoder in 4-byte chunks""" - - def __init__(self, ifp): - self.ifp = ifp - self.eof = 0 - - def read(self, totalwtd): - """Read at least wtd bytes (or until EOF)""" - decdata = '' - wtd = totalwtd - # - # The loop here is convoluted, since we don't really now how - # much to decode: there may be newlines in the incoming data. - while wtd > 0: - if self.eof: return decdata - wtd = ((wtd+2)//3)*4 - data = self.ifp.read(wtd) - # - # Next problem: there may not be a complete number of - # bytes in what we pass to a2b. Solve by yet another - # loop. - # - while 1: - try: - decdatacur, self.eof = \ - binascii.a2b_hqx(data) - break - except binascii.Incomplete: - pass - newdata = self.ifp.read(1) - if not newdata: - raise Error, \ - 'Premature EOF on binhex file' - data = data + newdata - decdata = decdata + decdatacur - wtd = totalwtd - len(decdata) - if not decdata and not self.eof: - raise Error, 'Premature EOF on binhex file' - return decdata - - def close(self): - self.ifp.close() - -class _Rledecoderengine: - """Read data via the RLE-coder""" - - def __init__(self, ifp): - self.ifp = ifp - self.pre_buffer = '' - self.post_buffer = '' - self.eof = 0 - - def read(self, wtd): - if wtd > len(self.post_buffer): - self._fill(wtd-len(self.post_buffer)) - rv = self.post_buffer[:wtd] - self.post_buffer = self.post_buffer[wtd:] - return rv - - def _fill(self, wtd): - self.pre_buffer = self.pre_buffer + self.ifp.read(wtd+4) - if self.ifp.eof: - self.post_buffer = self.post_buffer + \ - binascii.rledecode_hqx(self.pre_buffer) - self.pre_buffer = '' - return - - # - # Obfuscated code ahead. We have to take care that we don't - # end up with an orphaned RUNCHAR later on. So, we keep a couple - # of bytes in the buffer, depending on what the end of - # the buffer looks like: - # '\220\0\220' - Keep 3 bytes: repeated \220 (escaped as \220\0) - # '?\220' - Keep 2 bytes: repeated something-else - # '\220\0' - Escaped \220: Keep 2 bytes. - # '?\220?' - Complete repeat sequence: decode all - # otherwise: keep 1 byte. - # - mark = len(self.pre_buffer) - if self.pre_buffer[-3:] == RUNCHAR + '\0' + RUNCHAR: - mark = mark - 3 - elif self.pre_buffer[-1] == RUNCHAR: - mark = mark - 2 - elif self.pre_buffer[-2:] == RUNCHAR + '\0': - mark = mark - 2 - elif self.pre_buffer[-2] == RUNCHAR: - pass # Decode all - else: - mark = mark - 1 - - self.post_buffer = self.post_buffer + \ - binascii.rledecode_hqx(self.pre_buffer[:mark]) - self.pre_buffer = self.pre_buffer[mark:] - - def close(self): - self.ifp.close() - -class HexBin: - def __init__(self, ifp): - if type(ifp) == type(''): - ifp = open(ifp) - # - # Find initial colon. - # - while 1: - ch = ifp.read(1) - if not ch: - raise Error, "No binhex data found" - # Cater for \r\n terminated lines (which show up as \n\r, hence - # all lines start with \r) - if ch == '\r': - continue - if ch == ':': - break - if ch != '\n': - dummy = ifp.readline() - - hqxifp = _Hqxdecoderengine(ifp) - self.ifp = _Rledecoderengine(hqxifp) - self.crc = 0 - self._readheader() - - def _read(self, len): - data = self.ifp.read(len) - self.crc = binascii.crc_hqx(data, self.crc) - return data - - def _checkcrc(self): - filecrc = struct.unpack('>h', self.ifp.read(2))[0] & 0xffff - #self.crc = binascii.crc_hqx('\0\0', self.crc) - # XXXX Is this needed?? - self.crc = self.crc & 0xffff - if filecrc != self.crc: - raise Error, 'CRC error, computed %x, read %x' \ - %(self.crc, filecrc) - self.crc = 0 - - def _readheader(self): - len = self._read(1) - fname = self._read(ord(len)) - rest = self._read(1+4+4+2+4+4) - self._checkcrc() - - type = rest[1:5] - creator = rest[5:9] - flags = struct.unpack('>h', rest[9:11])[0] - self.dlen = struct.unpack('>l', rest[11:15])[0] - self.rlen = struct.unpack('>l', rest[15:19])[0] - - self.FName = fname - self.FInfo = FInfo() - self.FInfo.Creator = creator - self.FInfo.Type = type - self.FInfo.Flags = flags - - self.state = _DID_HEADER - - def read(self, *n): - if self.state != _DID_HEADER: - raise Error, 'Read data at wrong time' - if n: - n = n[0] - n = min(n, self.dlen) - else: - n = self.dlen - rv = '' - while len(rv) < n: - rv = rv + self._read(n-len(rv)) - self.dlen = self.dlen - n - return rv - - def close_data(self): - if self.state != _DID_HEADER: - raise Error, 'close_data at wrong time' - if self.dlen: - dummy = self._read(self.dlen) - self._checkcrc() - self.state = _DID_DATA - - def read_rsrc(self, *n): - if self.state == _DID_HEADER: - self.close_data() - if self.state != _DID_DATA: - raise Error, 'Read resource data at wrong time' - if n: - n = n[0] - n = min(n, self.rlen) - else: - n = self.rlen - self.rlen = self.rlen - n - return self._read(n) - - def close(self): - if self.state is None: - return - try: - if self.rlen: - dummy = self.read_rsrc(self.rlen) - self._checkcrc() - finally: - self.state = None - self.ifp.close() - -def hexbin(inp, out): - """(infilename, outfilename) - Decode binhexed file""" - ifp = HexBin(inp) - finfo = ifp.FInfo - if not out: - out = ifp.FName - - ofp = open(out, 'wb') - # XXXX Do translation on non-mac systems - while 1: - d = ifp.read(128000) - if not d: break - ofp.write(d) - ofp.close() - ifp.close_data() - - d = ifp.read_rsrc(128000) - if d: - ofp = openrsrc(out, 'wb') - ofp.write(d) - while 1: - d = ifp.read_rsrc(128000) - if not d: break - ofp.write(d) - ofp.close() - - ifp.close() - -def _test(): - fname = sys.argv[1] - binhex(fname, fname+'.hqx') - hexbin(fname+'.hqx', fname+'.viahqx') - #hexbin(fname, fname+'.unpacked') - sys.exit(1) - -if __name__ == '__main__': - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py deleted file mode 100644 index d1016d9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/bisect.py +++ /dev/null @@ -1,92 +0,0 @@ -"""Bisection algorithms.""" - -def insort_right(a, x, lo=0, hi=None): - """Insert item x in list a, and keep it sorted assuming a is sorted. - - If x is already in a, insert it to the right of the rightmost x. - - Optional args lo (default 0) and hi (default len(a)) bound the - slice of a to be searched. - """ - - if lo < 0: - raise ValueError('lo must be non-negative') - if hi is None: - hi = len(a) - while lo < hi: - mid = (lo+hi)//2 - if x < a[mid]: hi = mid - else: lo = mid+1 - a.insert(lo, x) - -insort = insort_right # backward compatibility - -def bisect_right(a, x, lo=0, hi=None): - """Return the index where to insert item x in list a, assuming a is sorted. - - The return value i is such that all e in a[:i] have e <= x, and all e in - a[i:] have e > x. So if x already appears in the list, a.insert(x) will - insert just after the rightmost x already there. - - Optional args lo (default 0) and hi (default len(a)) bound the - slice of a to be searched. - """ - - if lo < 0: - raise ValueError('lo must be non-negative') - if hi is None: - hi = len(a) - while lo < hi: - mid = (lo+hi)//2 - if x < a[mid]: hi = mid - else: lo = mid+1 - return lo - -bisect = bisect_right # backward compatibility - -def insort_left(a, x, lo=0, hi=None): - """Insert item x in list a, and keep it sorted assuming a is sorted. - - If x is already in a, insert it to the left of the leftmost x. - - Optional args lo (default 0) and hi (default len(a)) bound the - slice of a to be searched. - """ - - if lo < 0: - raise ValueError('lo must be non-negative') - if hi is None: - hi = len(a) - while lo < hi: - mid = (lo+hi)//2 - if a[mid] < x: lo = mid+1 - else: hi = mid - a.insert(lo, x) - - -def bisect_left(a, x, lo=0, hi=None): - """Return the index where to insert item x in list a, assuming a is sorted. - - The return value i is such that all e in a[:i] have e < x, and all e in - a[i:] have e >= x. So if x already appears in the list, a.insert(x) will - insert just before the leftmost x already there. - - Optional args lo (default 0) and hi (default len(a)) bound the - slice of a to be searched. - """ - - if lo < 0: - raise ValueError('lo must be non-negative') - if hi is None: - hi = len(a) - while lo < hi: - mid = (lo+hi)//2 - if a[mid] < x: lo = mid+1 - else: hi = mid - return lo - -# Overwrite above definitions with a fast C implementation -try: - from _bisect import * -except ImportError: - pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py deleted file mode 100644 index f07cb71..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/calendar.py +++ /dev/null @@ -1,713 +0,0 @@ -"""Calendar printing functions - -Note when comparing these calendars to the ones printed by cal(1): By -default, these calendars have Monday as the first day of the week, and -Sunday as the last (the European convention). Use setfirstweekday() to -set the first day of the week (0=Monday, 6=Sunday).""" - -import sys -import datetime -import locale as _locale - -__all__ = ["IllegalMonthError", "IllegalWeekdayError", "setfirstweekday", - "firstweekday", "isleap", "leapdays", "weekday", "monthrange", - "monthcalendar", "prmonth", "month", "prcal", "calendar", - "timegm", "month_name", "month_abbr", "day_name", "day_abbr"] - -# Exception raised for bad input (with string parameter for details) -error = ValueError - -# Exceptions raised for bad input -class IllegalMonthError(ValueError): - def __init__(self, month): - self.month = month - def __str__(self): - return "bad month number %r; must be 1-12" % self.month - - -class IllegalWeekdayError(ValueError): - def __init__(self, weekday): - self.weekday = weekday - def __str__(self): - return "bad weekday number %r; must be 0 (Monday) to 6 (Sunday)" % self.weekday - - -# Constants for months referenced later -January = 1 -February = 2 - -# Number of days per month (except for February in leap years) -mdays = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] - -# This module used to have hard-coded lists of day and month names, as -# English strings. The classes following emulate a read-only version of -# that, but supply localized names. Note that the values are computed -# fresh on each call, in case the user changes locale between calls. - -class _localized_month: - - _months = [datetime.date(2001, i+1, 1).strftime for i in range(12)] - _months.insert(0, lambda x: "") - - def __init__(self, format): - self.format = format - - def __getitem__(self, i): - funcs = self._months[i] - if isinstance(i, slice): - return [f(self.format) for f in funcs] - else: - return funcs(self.format) - - def __len__(self): - return 13 - - -class _localized_day: - - # January 1, 2001, was a Monday. - _days = [datetime.date(2001, 1, i+1).strftime for i in range(7)] - - def __init__(self, format): - self.format = format - - def __getitem__(self, i): - funcs = self._days[i] - if isinstance(i, slice): - return [f(self.format) for f in funcs] - else: - return funcs(self.format) - - def __len__(self): - return 7 - - -# Full and abbreviated names of weekdays -day_name = _localized_day('%A') -day_abbr = _localized_day('%a') - -# Full and abbreviated names of months (1-based arrays!!!) -month_name = _localized_month('%B') -month_abbr = _localized_month('%b') - -# Constants for weekdays -(MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY, SUNDAY) = range(7) - - -def isleap(year): - """Return True for leap years, False for non-leap years.""" - return year % 4 == 0 and (year % 100 != 0 or year % 400 == 0) - - -def leapdays(y1, y2): - """Return number of leap years in range [y1, y2). - Assume y1 <= y2.""" - y1 -= 1 - y2 -= 1 - return (y2//4 - y1//4) - (y2//100 - y1//100) + (y2//400 - y1//400) - - -def weekday(year, month, day): - """Return weekday (0-6 ~ Mon-Sun) for year (1970-...), month (1-12), - day (1-31).""" - return datetime.date(year, month, day).weekday() - - -def monthrange(year, month): - """Return weekday (0-6 ~ Mon-Sun) and number of days (28-31) for - year, month.""" - if not 1 <= month <= 12: - raise IllegalMonthError(month) - day1 = weekday(year, month, 1) - ndays = mdays[month] + (month == February and isleap(year)) - return day1, ndays - - -class Calendar(object): - """ - Base calendar class. This class doesn't do any formatting. It simply - provides data to subclasses. - """ - - def __init__(self, firstweekday=0): - self.firstweekday = firstweekday # 0 = Monday, 6 = Sunday - - def getfirstweekday(self): - return self._firstweekday % 7 - - def setfirstweekday(self, firstweekday): - self._firstweekday = firstweekday - - firstweekday = property(getfirstweekday, setfirstweekday) - - def iterweekdays(self): - """ - Return a iterator for one week of weekday numbers starting with the - configured first one. - """ - for i in range(self.firstweekday, self.firstweekday + 7): - yield i%7 - - def itermonthdates(self, year, month): - """ - Return an iterator for one month. The iterator will yield datetime.date - values and will always iterate through complete weeks, so it will yield - dates outside the specified month. - """ - date = datetime.date(year, month, 1) - # Go back to the beginning of the week - days = (date.weekday() - self.firstweekday) % 7 - date -= datetime.timedelta(days=days) - oneday = datetime.timedelta(days=1) - while True: - yield date - try: - date += oneday - except OverflowError: - # Adding one day could fail after datetime.MAXYEAR - break - if date.month != month and date.weekday() == self.firstweekday: - break - - def itermonthdays2(self, year, month): - """ - Like itermonthdates(), but will yield (day number, weekday number) - tuples. For days outside the specified month the day number is 0. - """ - for date in self.itermonthdates(year, month): - if date.month != month: - yield (0, date.weekday()) - else: - yield (date.day, date.weekday()) - - def itermonthdays(self, year, month): - """ - Like itermonthdates(), but will yield day numbers. For days outside - the specified month the day number is 0. - """ - for date in self.itermonthdates(year, month): - if date.month != month: - yield 0 - else: - yield date.day - - def monthdatescalendar(self, year, month): - """ - Return a matrix (list of lists) representing a month's calendar. - Each row represents a week; week entries are datetime.date values. - """ - dates = list(self.itermonthdates(year, month)) - return [ dates[i:i+7] for i in range(0, len(dates), 7) ] - - def monthdays2calendar(self, year, month): - """ - Return a matrix representing a month's calendar. - Each row represents a week; week entries are - (day number, weekday number) tuples. Day numbers outside this month - are zero. - """ - days = list(self.itermonthdays2(year, month)) - return [ days[i:i+7] for i in range(0, len(days), 7) ] - - def monthdayscalendar(self, year, month): - """ - Return a matrix representing a month's calendar. - Each row represents a week; days outside this month are zero. - """ - days = list(self.itermonthdays(year, month)) - return [ days[i:i+7] for i in range(0, len(days), 7) ] - - def yeardatescalendar(self, year, width=3): - """ - Return the data for the specified year ready for formatting. The return - value is a list of month rows. Each month row contains up to width months. - Each month contains between 4 and 6 weeks and each week contains 1-7 - days. Days are datetime.date objects. - """ - months = [ - self.monthdatescalendar(year, i) - for i in range(January, January+12) - ] - return [months[i:i+width] for i in range(0, len(months), width) ] - - def yeardays2calendar(self, year, width=3): - """ - Return the data for the specified year ready for formatting (similar to - yeardatescalendar()). Entries in the week lists are - (day number, weekday number) tuples. Day numbers outside this month are - zero. - """ - months = [ - self.monthdays2calendar(year, i) - for i in range(January, January+12) - ] - return [months[i:i+width] for i in range(0, len(months), width) ] - - def yeardayscalendar(self, year, width=3): - """ - Return the data for the specified year ready for formatting (similar to - yeardatescalendar()). Entries in the week lists are day numbers. - Day numbers outside this month are zero. - """ - months = [ - self.monthdayscalendar(year, i) - for i in range(January, January+12) - ] - return [months[i:i+width] for i in range(0, len(months), width) ] - - -class TextCalendar(Calendar): - """ - Subclass of Calendar that outputs a calendar as a simple plain text - similar to the UNIX program cal. - """ - - def prweek(self, theweek, width): - """ - Print a single week (no newline). - """ - print self.formatweek(theweek, width), - - def formatday(self, day, weekday, width): - """ - Returns a formatted day. - """ - if day == 0: - s = '' - else: - s = '%2i' % day # right-align single-digit days - return s.center(width) - - def formatweek(self, theweek, width): - """ - Returns a single week in a string (no newline). - """ - return ' '.join(self.formatday(d, wd, width) for (d, wd) in theweek) - - def formatweekday(self, day, width): - """ - Returns a formatted week day name. - """ - if width >= 9: - names = day_name - else: - names = day_abbr - return names[day][:width].center(width) - - def formatweekheader(self, width): - """ - Return a header for a week. - """ - return ' '.join(self.formatweekday(i, width) for i in self.iterweekdays()) - - def formatmonthname(self, theyear, themonth, width, withyear=True): - """ - Return a formatted month name. - """ - s = month_name[themonth] - if withyear: - s = "%s %r" % (s, theyear) - return s.center(width) - - def prmonth(self, theyear, themonth, w=0, l=0): - """ - Print a month's calendar. - """ - print self.formatmonth(theyear, themonth, w, l), - - def formatmonth(self, theyear, themonth, w=0, l=0): - """ - Return a month's calendar string (multi-line). - """ - w = max(2, w) - l = max(1, l) - s = self.formatmonthname(theyear, themonth, 7 * (w + 1) - 1) - s = s.rstrip() - s += '\n' * l - s += self.formatweekheader(w).rstrip() - s += '\n' * l - for week in self.monthdays2calendar(theyear, themonth): - s += self.formatweek(week, w).rstrip() - s += '\n' * l - return s - - def formatyear(self, theyear, w=2, l=1, c=6, m=3): - """ - Returns a year's calendar as a multi-line string. - """ - w = max(2, w) - l = max(1, l) - c = max(2, c) - colwidth = (w + 1) * 7 - 1 - v = [] - a = v.append - a(repr(theyear).center(colwidth*m+c*(m-1)).rstrip()) - a('\n'*l) - header = self.formatweekheader(w) - for (i, row) in enumerate(self.yeardays2calendar(theyear, m)): - # months in this row - months = range(m*i+1, min(m*(i+1)+1, 13)) - a('\n'*l) - names = (self.formatmonthname(theyear, k, colwidth, False) - for k in months) - a(formatstring(names, colwidth, c).rstrip()) - a('\n'*l) - headers = (header for k in months) - a(formatstring(headers, colwidth, c).rstrip()) - a('\n'*l) - # max number of weeks for this row - height = max(len(cal) for cal in row) - for j in range(height): - weeks = [] - for cal in row: - if j >= len(cal): - weeks.append('') - else: - weeks.append(self.formatweek(cal[j], w)) - a(formatstring(weeks, colwidth, c).rstrip()) - a('\n' * l) - return ''.join(v) - - def pryear(self, theyear, w=0, l=0, c=6, m=3): - """Print a year's calendar.""" - print self.formatyear(theyear, w, l, c, m) - - -class HTMLCalendar(Calendar): - """ - This calendar returns complete HTML pages. - """ - - # CSS classes for the day s - cssclasses = ["mon", "tue", "wed", "thu", "fri", "sat", "sun"] - - def formatday(self, day, weekday): - """ - Return a day as a table cell. - """ - if day == 0: - return ' ' # day outside month - else: - return '%d' % (self.cssclasses[weekday], day) - - def formatweek(self, theweek): - """ - Return a complete week as a table row. - """ - s = ''.join(self.formatday(d, wd) for (d, wd) in theweek) - return '%s' % s - - def formatweekday(self, day): - """ - Return a weekday name as a table header. - """ - return '%s' % (self.cssclasses[day], day_abbr[day]) - - def formatweekheader(self): - """ - Return a header for a week as a table row. - """ - s = ''.join(self.formatweekday(i) for i in self.iterweekdays()) - return '%s' % s - - def formatmonthname(self, theyear, themonth, withyear=True): - """ - Return a month name as a table row. - """ - if withyear: - s = '%s %s' % (month_name[themonth], theyear) - else: - s = '%s' % month_name[themonth] - return '%s' % s - - def formatmonth(self, theyear, themonth, withyear=True): - """ - Return a formatted month as a table. - """ - v = [] - a = v.append - a('') - a('\n') - a(self.formatmonthname(theyear, themonth, withyear=withyear)) - a('\n') - a(self.formatweekheader()) - a('\n') - for week in self.monthdays2calendar(theyear, themonth): - a(self.formatweek(week)) - a('\n') - a('
') - a('\n') - return ''.join(v) - - def formatyear(self, theyear, width=3): - """ - Return a formatted year as a table of tables. - """ - v = [] - a = v.append - width = max(width, 1) - a('') - a('\n') - a('' % (width, theyear)) - for i in range(January, January+12, width): - # months in this row - months = range(i, min(i+width, 13)) - a('') - for m in months: - a('') - a('') - a('
%s
') - a(self.formatmonth(theyear, m, withyear=False)) - a('
') - return ''.join(v) - - def formatyearpage(self, theyear, width=3, css='calendar.css', encoding=None): - """ - Return a formatted year as a complete HTML page. - """ - if encoding is None: - encoding = sys.getdefaultencoding() - v = [] - a = v.append - a('\n' % encoding) - a('\n') - a('\n') - a('\n') - a('\n' % encoding) - if css is not None: - a('\n' % css) - a('Calendar for %d\n' % theyear) - a('\n') - a('\n') - a(self.formatyear(theyear, width)) - a('\n') - a('\n') - return ''.join(v).encode(encoding, "xmlcharrefreplace") - - -class TimeEncoding: - def __init__(self, locale): - self.locale = locale - - def __enter__(self): - self.oldlocale = _locale.getlocale(_locale.LC_TIME) - _locale.setlocale(_locale.LC_TIME, self.locale) - return _locale.getlocale(_locale.LC_TIME)[1] - - def __exit__(self, *args): - _locale.setlocale(_locale.LC_TIME, self.oldlocale) - - -class LocaleTextCalendar(TextCalendar): - """ - This class can be passed a locale name in the constructor and will return - month and weekday names in the specified locale. If this locale includes - an encoding all strings containing month and weekday names will be returned - as unicode. - """ - - def __init__(self, firstweekday=0, locale=None): - TextCalendar.__init__(self, firstweekday) - if locale is None: - locale = _locale.getdefaultlocale() - self.locale = locale - - def formatweekday(self, day, width): - with TimeEncoding(self.locale) as encoding: - if width >= 9: - names = day_name - else: - names = day_abbr - name = names[day] - if encoding is not None: - name = name.decode(encoding) - return name[:width].center(width) - - def formatmonthname(self, theyear, themonth, width, withyear=True): - with TimeEncoding(self.locale) as encoding: - s = month_name[themonth] - if encoding is not None: - s = s.decode(encoding) - if withyear: - s = "%s %r" % (s, theyear) - return s.center(width) - - -class LocaleHTMLCalendar(HTMLCalendar): - """ - This class can be passed a locale name in the constructor and will return - month and weekday names in the specified locale. If this locale includes - an encoding all strings containing month and weekday names will be returned - as unicode. - """ - def __init__(self, firstweekday=0, locale=None): - HTMLCalendar.__init__(self, firstweekday) - if locale is None: - locale = _locale.getdefaultlocale() - self.locale = locale - - def formatweekday(self, day): - with TimeEncoding(self.locale) as encoding: - s = day_abbr[day] - if encoding is not None: - s = s.decode(encoding) - return '%s' % (self.cssclasses[day], s) - - def formatmonthname(self, theyear, themonth, withyear=True): - with TimeEncoding(self.locale) as encoding: - s = month_name[themonth] - if encoding is not None: - s = s.decode(encoding) - if withyear: - s = '%s %s' % (s, theyear) - return '%s' % s - - -# Support for old module level interface -c = TextCalendar() - -firstweekday = c.getfirstweekday - -def setfirstweekday(firstweekday): - try: - firstweekday.__index__ - except AttributeError: - raise IllegalWeekdayError(firstweekday) - if not MONDAY <= firstweekday <= SUNDAY: - raise IllegalWeekdayError(firstweekday) - c.firstweekday = firstweekday - -monthcalendar = c.monthdayscalendar -prweek = c.prweek -week = c.formatweek -weekheader = c.formatweekheader -prmonth = c.prmonth -month = c.formatmonth -calendar = c.formatyear -prcal = c.pryear - - -# Spacing of month columns for multi-column year calendar -_colwidth = 7*3 - 1 # Amount printed by prweek() -_spacing = 6 # Number of spaces between columns - - -def format(cols, colwidth=_colwidth, spacing=_spacing): - """Prints multi-column formatting for year calendars""" - print formatstring(cols, colwidth, spacing) - - -def formatstring(cols, colwidth=_colwidth, spacing=_spacing): - """Returns a string formatted from n strings, centered within n columns.""" - spacing *= ' ' - return spacing.join(c.center(colwidth) for c in cols) - - -EPOCH = 1970 -_EPOCH_ORD = datetime.date(EPOCH, 1, 1).toordinal() - - -def timegm(tuple): - """Unrelated but handy function to calculate Unix timestamp from GMT.""" - year, month, day, hour, minute, second = tuple[:6] - days = datetime.date(year, month, 1).toordinal() - _EPOCH_ORD + day - 1 - hours = days*24 + hour - minutes = hours*60 + minute - seconds = minutes*60 + second - return seconds - - -def main(args): - import optparse - parser = optparse.OptionParser(usage="usage: %prog [options] [year [month]]") - parser.add_option( - "-w", "--width", - dest="width", type="int", default=2, - help="width of date column (default 2, text only)" - ) - parser.add_option( - "-l", "--lines", - dest="lines", type="int", default=1, - help="number of lines for each week (default 1, text only)" - ) - parser.add_option( - "-s", "--spacing", - dest="spacing", type="int", default=6, - help="spacing between months (default 6, text only)" - ) - parser.add_option( - "-m", "--months", - dest="months", type="int", default=3, - help="months per row (default 3, text only)" - ) - parser.add_option( - "-c", "--css", - dest="css", default="calendar.css", - help="CSS to use for page (html only)" - ) - parser.add_option( - "-L", "--locale", - dest="locale", default=None, - help="locale to be used from month and weekday names" - ) - parser.add_option( - "-e", "--encoding", - dest="encoding", default=None, - help="Encoding to use for output" - ) - parser.add_option( - "-t", "--type", - dest="type", default="text", - choices=("text", "html"), - help="output type (text or html)" - ) - - (options, args) = parser.parse_args(args) - - if options.locale and not options.encoding: - parser.error("if --locale is specified --encoding is required") - sys.exit(1) - - locale = options.locale, options.encoding - - if options.type == "html": - if options.locale: - cal = LocaleHTMLCalendar(locale=locale) - else: - cal = HTMLCalendar() - encoding = options.encoding - if encoding is None: - encoding = sys.getdefaultencoding() - optdict = dict(encoding=encoding, css=options.css) - if len(args) == 1: - print cal.formatyearpage(datetime.date.today().year, **optdict) - elif len(args) == 2: - print cal.formatyearpage(int(args[1]), **optdict) - else: - parser.error("incorrect number of arguments") - sys.exit(1) - else: - if options.locale: - cal = LocaleTextCalendar(locale=locale) - else: - cal = TextCalendar() - optdict = dict(w=options.width, l=options.lines) - if len(args) != 3: - optdict["c"] = options.spacing - optdict["m"] = options.months - if len(args) == 1: - result = cal.formatyear(datetime.date.today().year, **optdict) - elif len(args) == 2: - result = cal.formatyear(int(args[1]), **optdict) - elif len(args) == 3: - result = cal.formatmonth(int(args[1]), int(args[2]), **optdict) - else: - parser.error("incorrect number of arguments") - sys.exit(1) - if options.encoding: - result = result.encode(options.encoding) - print result - - -if __name__ == "__main__": - main(sys.argv) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py deleted file mode 100644 index 33a624c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/cmd.py +++ /dev/null @@ -1,404 +0,0 @@ -"""A generic class to build line-oriented command interpreters. - -Interpreters constructed with this class obey the following conventions: - -1. End of file on input is processed as the command 'EOF'. -2. A command is parsed out of each line by collecting the prefix composed - of characters in the identchars member. -3. A command `foo' is dispatched to a method 'do_foo()'; the do_ method - is passed a single argument consisting of the remainder of the line. -4. Typing an empty line repeats the last command. (Actually, it calls the - method `emptyline', which may be overridden in a subclass.) -5. There is a predefined `help' method. Given an argument `topic', it - calls the command `help_topic'. With no arguments, it lists all topics - with defined help_ functions, broken into up to three topics; documented - commands, miscellaneous help topics, and undocumented commands. -6. The command '?' is a synonym for `help'. The command '!' is a synonym - for `shell', if a do_shell method exists. -7. If completion is enabled, completing commands will be done automatically, - and completing of commands args is done by calling complete_foo() with - arguments text, line, begidx, endidx. text is string we are matching - against, all returned matches must begin with it. line is the current - input line (lstripped), begidx and endidx are the beginning and end - indexes of the text being matched, which could be used to provide - different completion depending upon which position the argument is in. - -The `default' method may be overridden to intercept commands for which there -is no do_ method. - -The `completedefault' method may be overridden to intercept completions for -commands that have no complete_ method. - -The data member `self.ruler' sets the character used to draw separator lines -in the help messages. If empty, no ruler line is drawn. It defaults to "=". - -If the value of `self.intro' is nonempty when the cmdloop method is called, -it is printed out on interpreter startup. This value may be overridden -via an optional argument to the cmdloop() method. - -The data members `self.doc_header', `self.misc_header', and -`self.undoc_header' set the headers used for the help function's -listings of documented functions, miscellaneous topics, and undocumented -functions respectively. - -These interpreters use raw_input; thus, if the readline module is loaded, -they automatically support Emacs-like command history and editing features. -""" - -import string - -__all__ = ["Cmd"] - -PROMPT = '(Cmd) ' -IDENTCHARS = string.ascii_letters + string.digits + '_' - -class Cmd: - """A simple framework for writing line-oriented command interpreters. - - These are often useful for test harnesses, administrative tools, and - prototypes that will later be wrapped in a more sophisticated interface. - - A Cmd instance or subclass instance is a line-oriented interpreter - framework. There is no good reason to instantiate Cmd itself; rather, - it's useful as a superclass of an interpreter class you define yourself - in order to inherit Cmd's methods and encapsulate action methods. - - """ - prompt = PROMPT - identchars = IDENTCHARS - ruler = '=' - lastcmd = '' - intro = None - doc_leader = "" - doc_header = "Documented commands (type help ):" - misc_header = "Miscellaneous help topics:" - undoc_header = "Undocumented commands:" - nohelp = "*** No help on %s" - use_rawinput = 1 - - def __init__(self, completekey='tab', stdin=None, stdout=None): - """Instantiate a line-oriented interpreter framework. - - The optional argument 'completekey' is the readline name of a - completion key; it defaults to the Tab key. If completekey is - not None and the readline module is available, command completion - is done automatically. The optional arguments stdin and stdout - specify alternate input and output file objects; if not specified, - sys.stdin and sys.stdout are used. - - """ - import sys - if stdin is not None: - self.stdin = stdin - else: - self.stdin = sys.stdin - if stdout is not None: - self.stdout = stdout - else: - self.stdout = sys.stdout - self.cmdqueue = [] - self.completekey = completekey - - def cmdloop(self, intro=None): - """Repeatedly issue a prompt, accept input, parse an initial prefix - off the received input, and dispatch to action methods, passing them - the remainder of the line as argument. - - """ - - self.preloop() - if self.use_rawinput and self.completekey: - try: - import readline - self.old_completer = readline.get_completer() - readline.set_completer(self.complete) - readline.parse_and_bind(self.completekey+": complete") - except ImportError: - pass - try: - if intro is not None: - self.intro = intro - if self.intro: - self.stdout.write(str(self.intro)+"\n") - stop = None - while not stop: - if self.cmdqueue: - line = self.cmdqueue.pop(0) - else: - if self.use_rawinput: - try: - line = raw_input(self.prompt) - except EOFError: - line = 'EOF' - else: - self.stdout.write(self.prompt) - self.stdout.flush() - line = self.stdin.readline() - if not len(line): - line = 'EOF' - else: - line = line.rstrip('\r\n') - line = self.precmd(line) - stop = self.onecmd(line) - stop = self.postcmd(stop, line) - self.postloop() - finally: - if self.use_rawinput and self.completekey: - try: - import readline - readline.set_completer(self.old_completer) - except ImportError: - pass - - - def precmd(self, line): - """Hook method executed just before the command line is - interpreted, but after the input prompt is generated and issued. - - """ - return line - - def postcmd(self, stop, line): - """Hook method executed just after a command dispatch is finished.""" - return stop - - def preloop(self): - """Hook method executed once when the cmdloop() method is called.""" - pass - - def postloop(self): - """Hook method executed once when the cmdloop() method is about to - return. - - """ - pass - - def parseline(self, line): - """Parse the line into a command name and a string containing - the arguments. Returns a tuple containing (command, args, line). - 'command' and 'args' may be None if the line couldn't be parsed. - """ - line = line.strip() - if not line: - return None, None, line - elif line[0] == '?': - line = 'help ' + line[1:] - elif line[0] == '!': - if hasattr(self, 'do_shell'): - line = 'shell ' + line[1:] - else: - return None, None, line - i, n = 0, len(line) - while i < n and line[i] in self.identchars: i = i+1 - cmd, arg = line[:i], line[i:].strip() - return cmd, arg, line - - def onecmd(self, line): - """Interpret the argument as though it had been typed in response - to the prompt. - - This may be overridden, but should not normally need to be; - see the precmd() and postcmd() methods for useful execution hooks. - The return value is a flag indicating whether interpretation of - commands by the interpreter should stop. - - """ - cmd, arg, line = self.parseline(line) - if not line: - return self.emptyline() - if cmd is None: - return self.default(line) - self.lastcmd = line - if line == 'EOF' : - self.lastcmd = '' - if cmd == '': - return self.default(line) - else: - try: - func = getattr(self, 'do_' + cmd) - except AttributeError: - return self.default(line) - return func(arg) - - def emptyline(self): - """Called when an empty line is entered in response to the prompt. - - If this method is not overridden, it repeats the last nonempty - command entered. - - """ - if self.lastcmd: - return self.onecmd(self.lastcmd) - - def default(self, line): - """Called on an input line when the command prefix is not recognized. - - If this method is not overridden, it prints an error message and - returns. - - """ - self.stdout.write('*** Unknown syntax: %s\n'%line) - - def completedefault(self, *ignored): - """Method called to complete an input line when no command-specific - complete_*() method is available. - - By default, it returns an empty list. - - """ - return [] - - def completenames(self, text, *ignored): - dotext = 'do_'+text - return [a[3:] for a in self.get_names() if a.startswith(dotext)] - - def complete(self, text, state): - """Return the next possible completion for 'text'. - - If a command has not been entered, then complete against command list. - Otherwise try to call complete_ to get list of completions. - """ - if state == 0: - import readline - origline = readline.get_line_buffer() - line = origline.lstrip() - stripped = len(origline) - len(line) - begidx = readline.get_begidx() - stripped - endidx = readline.get_endidx() - stripped - if begidx>0: - cmd, args, foo = self.parseline(line) - if cmd == '': - compfunc = self.completedefault - else: - try: - compfunc = getattr(self, 'complete_' + cmd) - except AttributeError: - compfunc = self.completedefault - else: - compfunc = self.completenames - self.completion_matches = compfunc(text, line, begidx, endidx) - try: - return self.completion_matches[state] - except IndexError: - return None - - def get_names(self): - # This method used to pull in base class attributes - # at a time dir() didn't do it yet. - return dir(self.__class__) - - def complete_help(self, *args): - commands = set(self.completenames(*args)) - topics = set(a[5:] for a in self.get_names() - if a.startswith('help_' + args[0])) - return list(commands | topics) - - def do_help(self, arg): - 'List available commands with "help" or detailed help with "help cmd".' - if arg: - # XXX check arg syntax - try: - func = getattr(self, 'help_' + arg) - except AttributeError: - try: - doc=getattr(self, 'do_' + arg).__doc__ - if doc: - self.stdout.write("%s\n"%str(doc)) - return - except AttributeError: - pass - self.stdout.write("%s\n"%str(self.nohelp % (arg,))) - return - func() - else: - names = self.get_names() - cmds_doc = [] - cmds_undoc = [] - help = {} - for name in names: - if name[:5] == 'help_': - help[name[5:]]=1 - names.sort() - # There can be duplicates if routines overridden - prevname = '' - for name in names: - if name[:3] == 'do_': - if name == prevname: - continue - prevname = name - cmd=name[3:] - if cmd in help: - cmds_doc.append(cmd) - del help[cmd] - elif getattr(self, name).__doc__: - cmds_doc.append(cmd) - else: - cmds_undoc.append(cmd) - self.stdout.write("%s\n"%str(self.doc_leader)) - self.print_topics(self.doc_header, cmds_doc, 15,80) - self.print_topics(self.misc_header, help.keys(),15,80) - self.print_topics(self.undoc_header, cmds_undoc, 15,80) - - def print_topics(self, header, cmds, cmdlen, maxcol): - if cmds: - self.stdout.write("%s\n"%str(header)) - if self.ruler: - self.stdout.write("%s\n"%str(self.ruler * len(header))) - self.columnize(cmds, maxcol-1) - self.stdout.write("\n") - - def columnize(self, list, displaywidth=80): - """Display a list of strings as a compact set of columns. - - Each column is only as wide as necessary. - Columns are separated by two spaces (one was not legible enough). - """ - if not list: - self.stdout.write("\n") - return - nonstrings = [i for i in range(len(list)) - if not isinstance(list[i], str)] - if nonstrings: - raise TypeError, ("list[i] not a string for i in %s" % - ", ".join(map(str, nonstrings))) - size = len(list) - if size == 1: - self.stdout.write('%s\n'%str(list[0])) - return - # Try every row count from 1 upwards - for nrows in range(1, len(list)): - ncols = (size+nrows-1) // nrows - colwidths = [] - totwidth = -2 - for col in range(ncols): - colwidth = 0 - for row in range(nrows): - i = row + nrows*col - if i >= size: - break - x = list[i] - colwidth = max(colwidth, len(x)) - colwidths.append(colwidth) - totwidth += colwidth + 2 - if totwidth > displaywidth: - break - if totwidth <= displaywidth: - break - else: - nrows = len(list) - ncols = 1 - colwidths = [0] - for row in range(nrows): - texts = [] - for col in range(ncols): - i = row + nrows*col - if i >= size: - x = "" - else: - x = list[i] - texts.append(x) - while texts and not texts[-1]: - del texts[-1] - for col in range(len(texts)): - texts[col] = texts[col].ljust(colwidths[col]) - self.stdout.write("%s\n"%str(" ".join(texts))) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py deleted file mode 100644 index 452bf2f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/codecs.py +++ /dev/null @@ -1,1101 +0,0 @@ -""" codecs -- Python Codec Registry, API and helpers. - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" - -import __builtin__, sys - -### Registry and builtin stateless codec functions - -try: - from _codecs import * -except ImportError, why: - raise SystemError('Failed to load the builtin codecs: %s' % why) - -__all__ = ["register", "lookup", "open", "EncodedFile", "BOM", "BOM_BE", - "BOM_LE", "BOM32_BE", "BOM32_LE", "BOM64_BE", "BOM64_LE", - "BOM_UTF8", "BOM_UTF16", "BOM_UTF16_LE", "BOM_UTF16_BE", - "BOM_UTF32", "BOM_UTF32_LE", "BOM_UTF32_BE", - "CodecInfo", "Codec", "IncrementalEncoder", "IncrementalDecoder", - "StreamReader", "StreamWriter", - "StreamReaderWriter", "StreamRecoder", - "getencoder", "getdecoder", "getincrementalencoder", - "getincrementaldecoder", "getreader", "getwriter", - "encode", "decode", "iterencode", "iterdecode", - "strict_errors", "ignore_errors", "replace_errors", - "xmlcharrefreplace_errors", "backslashreplace_errors", - "register_error", "lookup_error"] - -### Constants - -# -# Byte Order Mark (BOM = ZERO WIDTH NO-BREAK SPACE = U+FEFF) -# and its possible byte string values -# for UTF8/UTF16/UTF32 output and little/big endian machines -# - -# UTF-8 -BOM_UTF8 = '\xef\xbb\xbf' - -# UTF-16, little endian -BOM_LE = BOM_UTF16_LE = '\xff\xfe' - -# UTF-16, big endian -BOM_BE = BOM_UTF16_BE = '\xfe\xff' - -# UTF-32, little endian -BOM_UTF32_LE = '\xff\xfe\x00\x00' - -# UTF-32, big endian -BOM_UTF32_BE = '\x00\x00\xfe\xff' - -if sys.byteorder == 'little': - - # UTF-16, native endianness - BOM = BOM_UTF16 = BOM_UTF16_LE - - # UTF-32, native endianness - BOM_UTF32 = BOM_UTF32_LE - -else: - - # UTF-16, native endianness - BOM = BOM_UTF16 = BOM_UTF16_BE - - # UTF-32, native endianness - BOM_UTF32 = BOM_UTF32_BE - -# Old broken names (don't use in new code) -BOM32_LE = BOM_UTF16_LE -BOM32_BE = BOM_UTF16_BE -BOM64_LE = BOM_UTF32_LE -BOM64_BE = BOM_UTF32_BE - - -### Codec base classes (defining the API) - -class CodecInfo(tuple): - - def __new__(cls, encode, decode, streamreader=None, streamwriter=None, - incrementalencoder=None, incrementaldecoder=None, name=None): - self = tuple.__new__(cls, (encode, decode, streamreader, streamwriter)) - self.name = name - self.encode = encode - self.decode = decode - self.incrementalencoder = incrementalencoder - self.incrementaldecoder = incrementaldecoder - self.streamwriter = streamwriter - self.streamreader = streamreader - return self - - def __repr__(self): - return "<%s.%s object for encoding %s at 0x%x>" % (self.__class__.__module__, self.__class__.__name__, self.name, id(self)) - -class Codec: - - """ Defines the interface for stateless encoders/decoders. - - The .encode()/.decode() methods may use different error - handling schemes by providing the errors argument. These - string values are predefined: - - 'strict' - raise a ValueError error (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace' - replace with a suitable replacement character; - Python will use the official U+FFFD REPLACEMENT - CHARACTER for the builtin Unicode codecs on - decoding and '?' on encoding. - 'xmlcharrefreplace' - Replace with the appropriate XML - character reference (only for encoding). - 'backslashreplace' - Replace with backslashed escape sequences - (only for encoding). - - The set of allowed values can be extended via register_error. - - """ - def encode(self, input, errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling. - - The method may not store state in the Codec instance. Use - StreamCodec for codecs which have to keep state in order to - make encoding/decoding efficient. - - The encoder must be able to handle zero length input and - return an empty object of the output object type in this - situation. - - """ - raise NotImplementedError - - def decode(self, input, errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling. - - The method may not store state in the Codec instance. Use - StreamCodec for codecs which have to keep state in order to - make encoding/decoding efficient. - - The decoder must be able to handle zero length input and - return an empty object of the output object type in this - situation. - - """ - raise NotImplementedError - -class IncrementalEncoder(object): - """ - An IncrementalEncoder encodes an input in multiple steps. The input can be - passed piece by piece to the encode() method. The IncrementalEncoder remembers - the state of the Encoding process between calls to encode(). - """ - def __init__(self, errors='strict'): - """ - Creates an IncrementalEncoder instance. - - The IncrementalEncoder may use different error handling schemes by - providing the errors keyword argument. See the module docstring - for a list of possible values. - """ - self.errors = errors - self.buffer = "" - - def encode(self, input, final=False): - """ - Encodes input and returns the resulting object. - """ - raise NotImplementedError - - def reset(self): - """ - Resets the encoder to the initial state. - """ - - def getstate(self): - """ - Return the current state of the encoder. - """ - return 0 - - def setstate(self, state): - """ - Set the current state of the encoder. state must have been - returned by getstate(). - """ - -class BufferedIncrementalEncoder(IncrementalEncoder): - """ - This subclass of IncrementalEncoder can be used as the baseclass for an - incremental encoder if the encoder must keep some of the output in a - buffer between calls to encode(). - """ - def __init__(self, errors='strict'): - IncrementalEncoder.__init__(self, errors) - self.buffer = "" # unencoded input that is kept between calls to encode() - - def _buffer_encode(self, input, errors, final): - # Overwrite this method in subclasses: It must encode input - # and return an (output, length consumed) tuple - raise NotImplementedError - - def encode(self, input, final=False): - # encode input (taking the buffer into account) - data = self.buffer + input - (result, consumed) = self._buffer_encode(data, self.errors, final) - # keep unencoded input until the next call - self.buffer = data[consumed:] - return result - - def reset(self): - IncrementalEncoder.reset(self) - self.buffer = "" - - def getstate(self): - return self.buffer or 0 - - def setstate(self, state): - self.buffer = state or "" - -class IncrementalDecoder(object): - """ - An IncrementalDecoder decodes an input in multiple steps. The input can be - passed piece by piece to the decode() method. The IncrementalDecoder - remembers the state of the decoding process between calls to decode(). - """ - def __init__(self, errors='strict'): - """ - Creates a IncrementalDecoder instance. - - The IncrementalDecoder may use different error handling schemes by - providing the errors keyword argument. See the module docstring - for a list of possible values. - """ - self.errors = errors - - def decode(self, input, final=False): - """ - Decodes input and returns the resulting object. - """ - raise NotImplementedError - - def reset(self): - """ - Resets the decoder to the initial state. - """ - - def getstate(self): - """ - Return the current state of the decoder. - - This must be a (buffered_input, additional_state_info) tuple. - buffered_input must be a bytes object containing bytes that - were passed to decode() that have not yet been converted. - additional_state_info must be a non-negative integer - representing the state of the decoder WITHOUT yet having - processed the contents of buffered_input. In the initial state - and after reset(), getstate() must return (b"", 0). - """ - return (b"", 0) - - def setstate(self, state): - """ - Set the current state of the decoder. - - state must have been returned by getstate(). The effect of - setstate((b"", 0)) must be equivalent to reset(). - """ - -class BufferedIncrementalDecoder(IncrementalDecoder): - """ - This subclass of IncrementalDecoder can be used as the baseclass for an - incremental decoder if the decoder must be able to handle incomplete byte - sequences. - """ - def __init__(self, errors='strict'): - IncrementalDecoder.__init__(self, errors) - self.buffer = "" # undecoded input that is kept between calls to decode() - - def _buffer_decode(self, input, errors, final): - # Overwrite this method in subclasses: It must decode input - # and return an (output, length consumed) tuple - raise NotImplementedError - - def decode(self, input, final=False): - # decode input (taking the buffer into account) - data = self.buffer + input - (result, consumed) = self._buffer_decode(data, self.errors, final) - # keep undecoded input until the next call - self.buffer = data[consumed:] - return result - - def reset(self): - IncrementalDecoder.reset(self) - self.buffer = "" - - def getstate(self): - # additional state info is always 0 - return (self.buffer, 0) - - def setstate(self, state): - # ignore additional state info - self.buffer = state[0] - -# -# The StreamWriter and StreamReader class provide generic working -# interfaces which can be used to implement new encoding submodules -# very easily. See encodings/utf_8.py for an example on how this is -# done. -# - -class StreamWriter(Codec): - - def __init__(self, stream, errors='strict'): - - """ Creates a StreamWriter instance. - - stream must be a file-like object open for writing - (binary) data. - - The StreamWriter may use different error handling - schemes by providing the errors keyword argument. These - parameters are predefined: - - 'strict' - raise a ValueError (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace'- replace with a suitable replacement character - 'xmlcharrefreplace' - Replace with the appropriate XML - character reference. - 'backslashreplace' - Replace with backslashed escape - sequences (only for encoding). - - The set of allowed parameter values can be extended via - register_error. - """ - self.stream = stream - self.errors = errors - - def write(self, object): - - """ Writes the object's contents encoded to self.stream. - """ - data, consumed = self.encode(object, self.errors) - self.stream.write(data) - - def writelines(self, list): - - """ Writes the concatenated list of strings to the stream - using .write(). - """ - self.write(''.join(list)) - - def reset(self): - - """ Flushes and resets the codec buffers used for keeping state. - - Calling this method should ensure that the data on the - output is put into a clean state, that allows appending - of new fresh data without having to rescan the whole - stream to recover state. - - """ - pass - - def seek(self, offset, whence=0): - self.stream.seek(offset, whence) - if whence == 0 and offset == 0: - self.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - - def __enter__(self): - return self - - def __exit__(self, type, value, tb): - self.stream.close() - -### - -class StreamReader(Codec): - - def __init__(self, stream, errors='strict'): - - """ Creates a StreamReader instance. - - stream must be a file-like object open for reading - (binary) data. - - The StreamReader may use different error handling - schemes by providing the errors keyword argument. These - parameters are predefined: - - 'strict' - raise a ValueError (or a subclass) - 'ignore' - ignore the character and continue with the next - 'replace'- replace with a suitable replacement character; - - The set of allowed parameter values can be extended via - register_error. - """ - self.stream = stream - self.errors = errors - self.bytebuffer = "" - # For str->str decoding this will stay a str - # For str->unicode decoding the first read will promote it to unicode - self.charbuffer = "" - self.linebuffer = None - - def decode(self, input, errors='strict'): - raise NotImplementedError - - def read(self, size=-1, chars=-1, firstline=False): - - """ Decodes data from the stream self.stream and returns the - resulting object. - - chars indicates the number of characters to read from the - stream. read() will never return more than chars - characters, but it might return less, if there are not enough - characters available. - - size indicates the approximate maximum number of bytes to - read from the stream for decoding purposes. The decoder - can modify this setting as appropriate. The default value - -1 indicates to read and decode as much as possible. size - is intended to prevent having to decode huge files in one - step. - - If firstline is true, and a UnicodeDecodeError happens - after the first line terminator in the input only the first line - will be returned, the rest of the input will be kept until the - next call to read(). - - The method should use a greedy read strategy meaning that - it should read as much data as is allowed within the - definition of the encoding and the given size, e.g. if - optional encoding endings or state markers are available - on the stream, these should be read too. - """ - # If we have lines cached, first merge them back into characters - if self.linebuffer: - self.charbuffer = "".join(self.linebuffer) - self.linebuffer = None - - # read until we get the required number of characters (if available) - while True: - # can the request be satisfied from the character buffer? - if chars >= 0: - if len(self.charbuffer) >= chars: - break - elif size >= 0: - if len(self.charbuffer) >= size: - break - # we need more data - if size < 0: - newdata = self.stream.read() - else: - newdata = self.stream.read(size) - # decode bytes (those remaining from the last call included) - data = self.bytebuffer + newdata - try: - newchars, decodedbytes = self.decode(data, self.errors) - except UnicodeDecodeError, exc: - if firstline: - newchars, decodedbytes = self.decode(data[:exc.start], self.errors) - lines = newchars.splitlines(True) - if len(lines)<=1: - raise - else: - raise - # keep undecoded bytes until the next call - self.bytebuffer = data[decodedbytes:] - # put new characters in the character buffer - self.charbuffer += newchars - # there was no data available - if not newdata: - break - if chars < 0: - # Return everything we've got - result = self.charbuffer - self.charbuffer = "" - else: - # Return the first chars characters - result = self.charbuffer[:chars] - self.charbuffer = self.charbuffer[chars:] - return result - - def readline(self, size=None, keepends=True): - - """ Read one line from the input stream and return the - decoded data. - - size, if given, is passed as size argument to the - read() method. - - """ - # If we have lines cached from an earlier read, return - # them unconditionally - if self.linebuffer: - line = self.linebuffer[0] - del self.linebuffer[0] - if len(self.linebuffer) == 1: - # revert to charbuffer mode; we might need more data - # next time - self.charbuffer = self.linebuffer[0] - self.linebuffer = None - if not keepends: - line = line.splitlines(False)[0] - return line - - readsize = size or 72 - line = "" - # If size is given, we call read() only once - while True: - data = self.read(readsize, firstline=True) - if data: - # If we're at a "\r" read one extra character (which might - # be a "\n") to get a proper line ending. If the stream is - # temporarily exhausted we return the wrong line ending. - if data.endswith("\r"): - data += self.read(size=1, chars=1) - - line += data - lines = line.splitlines(True) - if lines: - if len(lines) > 1: - # More than one line result; the first line is a full line - # to return - line = lines[0] - del lines[0] - if len(lines) > 1: - # cache the remaining lines - lines[-1] += self.charbuffer - self.linebuffer = lines - self.charbuffer = None - else: - # only one remaining line, put it back into charbuffer - self.charbuffer = lines[0] + self.charbuffer - if not keepends: - line = line.splitlines(False)[0] - break - line0withend = lines[0] - line0withoutend = lines[0].splitlines(False)[0] - if line0withend != line0withoutend: # We really have a line end - # Put the rest back together and keep it until the next call - self.charbuffer = "".join(lines[1:]) + self.charbuffer - if keepends: - line = line0withend - else: - line = line0withoutend - break - # we didn't get anything or this was our only try - if not data or size is not None: - if line and not keepends: - line = line.splitlines(False)[0] - break - if readsize<8000: - readsize *= 2 - return line - - def readlines(self, sizehint=None, keepends=True): - - """ Read all lines available on the input stream - and return them as list of lines. - - Line breaks are implemented using the codec's decoder - method and are included in the list entries. - - sizehint, if given, is ignored since there is no efficient - way to finding the true end-of-line. - - """ - data = self.read() - return data.splitlines(keepends) - - def reset(self): - - """ Resets the codec buffers used for keeping state. - - Note that no stream repositioning should take place. - This method is primarily intended to be able to recover - from decoding errors. - - """ - self.bytebuffer = "" - self.charbuffer = u"" - self.linebuffer = None - - def seek(self, offset, whence=0): - """ Set the input stream's current position. - - Resets the codec buffers used for keeping state. - """ - self.stream.seek(offset, whence) - self.reset() - - def next(self): - - """ Return the next decoded line from the input stream.""" - line = self.readline() - if line: - return line - raise StopIteration - - def __iter__(self): - return self - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - - def __enter__(self): - return self - - def __exit__(self, type, value, tb): - self.stream.close() - -### - -class StreamReaderWriter: - - """ StreamReaderWriter instances allow wrapping streams which - work in both read and write modes. - - The design is such that one can use the factory functions - returned by the codec.lookup() function to construct the - instance. - - """ - # Optional attributes set by the file wrappers below - encoding = 'unknown' - - def __init__(self, stream, Reader, Writer, errors='strict'): - - """ Creates a StreamReaderWriter instance. - - stream must be a Stream-like object. - - Reader, Writer must be factory functions or classes - providing the StreamReader, StreamWriter interface resp. - - Error handling is done in the same way as defined for the - StreamWriter/Readers. - - """ - self.stream = stream - self.reader = Reader(stream, errors) - self.writer = Writer(stream, errors) - self.errors = errors - - def read(self, size=-1): - - return self.reader.read(size) - - def readline(self, size=None): - - return self.reader.readline(size) - - def readlines(self, sizehint=None): - - return self.reader.readlines(sizehint) - - def next(self): - - """ Return the next decoded line from the input stream.""" - return self.reader.next() - - def __iter__(self): - return self - - def write(self, data): - - return self.writer.write(data) - - def writelines(self, list): - - return self.writer.writelines(list) - - def reset(self): - - self.reader.reset() - self.writer.reset() - - def seek(self, offset, whence=0): - self.stream.seek(offset, whence) - self.reader.reset() - if whence == 0 and offset == 0: - self.writer.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - - # these are needed to make "with codecs.open(...)" work properly - - def __enter__(self): - return self - - def __exit__(self, type, value, tb): - self.stream.close() - -### - -class StreamRecoder: - - """ StreamRecoder instances provide a frontend - backend - view of encoding data. - - They use the complete set of APIs returned by the - codecs.lookup() function to implement their task. - - Data written to the stream is first decoded into an - intermediate format (which is dependent on the given codec - combination) and then written to the stream using an instance - of the provided Writer class. - - In the other direction, data is read from the stream using a - Reader instance and then return encoded data to the caller. - - """ - # Optional attributes set by the file wrappers below - data_encoding = 'unknown' - file_encoding = 'unknown' - - def __init__(self, stream, encode, decode, Reader, Writer, - errors='strict'): - - """ Creates a StreamRecoder instance which implements a two-way - conversion: encode and decode work on the frontend (the - input to .read() and output of .write()) while - Reader and Writer work on the backend (reading and - writing to the stream). - - You can use these objects to do transparent direct - recodings from e.g. latin-1 to utf-8 and back. - - stream must be a file-like object. - - encode, decode must adhere to the Codec interface, Reader, - Writer must be factory functions or classes providing the - StreamReader, StreamWriter interface resp. - - encode and decode are needed for the frontend translation, - Reader and Writer for the backend translation. Unicode is - used as intermediate encoding. - - Error handling is done in the same way as defined for the - StreamWriter/Readers. - - """ - self.stream = stream - self.encode = encode - self.decode = decode - self.reader = Reader(stream, errors) - self.writer = Writer(stream, errors) - self.errors = errors - - def read(self, size=-1): - - data = self.reader.read(size) - data, bytesencoded = self.encode(data, self.errors) - return data - - def readline(self, size=None): - - if size is None: - data = self.reader.readline() - else: - data = self.reader.readline(size) - data, bytesencoded = self.encode(data, self.errors) - return data - - def readlines(self, sizehint=None): - - data = self.reader.read() - data, bytesencoded = self.encode(data, self.errors) - return data.splitlines(1) - - def next(self): - - """ Return the next decoded line from the input stream.""" - data = self.reader.next() - data, bytesencoded = self.encode(data, self.errors) - return data - - def __iter__(self): - return self - - def write(self, data): - - data, bytesdecoded = self.decode(data, self.errors) - return self.writer.write(data) - - def writelines(self, list): - - data = ''.join(list) - data, bytesdecoded = self.decode(data, self.errors) - return self.writer.write(data) - - def reset(self): - - self.reader.reset() - self.writer.reset() - - def __getattr__(self, name, - getattr=getattr): - - """ Inherit all other methods from the underlying stream. - """ - return getattr(self.stream, name) - - def __enter__(self): - return self - - def __exit__(self, type, value, tb): - self.stream.close() - -### Shortcuts - -def open(filename, mode='rb', encoding=None, errors='strict', buffering=1): - - """ Open an encoded file using the given mode and return - a wrapped version providing transparent encoding/decoding. - - Note: The wrapped version will only accept the object format - defined by the codecs, i.e. Unicode objects for most builtin - codecs. Output is also codec dependent and will usually be - Unicode as well. - - Files are always opened in binary mode, even if no binary mode - was specified. This is done to avoid data loss due to encodings - using 8-bit values. The default file mode is 'rb' meaning to - open the file in binary read mode. - - encoding specifies the encoding which is to be used for the - file. - - errors may be given to define the error handling. It defaults - to 'strict' which causes ValueErrors to be raised in case an - encoding error occurs. - - buffering has the same meaning as for the builtin open() API. - It defaults to line buffered. - - The returned wrapped file object provides an extra attribute - .encoding which allows querying the used encoding. This - attribute is only available if an encoding was specified as - parameter. - - """ - if encoding is not None: - if 'U' in mode: - # No automatic conversion of '\n' is done on reading and writing - mode = mode.strip().replace('U', '') - if mode[:1] not in set('rwa'): - mode = 'r' + mode - if 'b' not in mode: - # Force opening of the file in binary mode - mode = mode + 'b' - file = __builtin__.open(filename, mode, buffering) - if encoding is None: - return file - info = lookup(encoding) - srw = StreamReaderWriter(file, info.streamreader, info.streamwriter, errors) - # Add attributes to simplify introspection - srw.encoding = encoding - return srw - -def EncodedFile(file, data_encoding, file_encoding=None, errors='strict'): - - """ Return a wrapped version of file which provides transparent - encoding translation. - - Strings written to the wrapped file are interpreted according - to the given data_encoding and then written to the original - file as string using file_encoding. The intermediate encoding - will usually be Unicode but depends on the specified codecs. - - Strings are read from the file using file_encoding and then - passed back to the caller as string using data_encoding. - - If file_encoding is not given, it defaults to data_encoding. - - errors may be given to define the error handling. It defaults - to 'strict' which causes ValueErrors to be raised in case an - encoding error occurs. - - The returned wrapped file object provides two extra attributes - .data_encoding and .file_encoding which reflect the given - parameters of the same name. The attributes can be used for - introspection by Python programs. - - """ - if file_encoding is None: - file_encoding = data_encoding - data_info = lookup(data_encoding) - file_info = lookup(file_encoding) - sr = StreamRecoder(file, data_info.encode, data_info.decode, - file_info.streamreader, file_info.streamwriter, errors) - # Add attributes to simplify introspection - sr.data_encoding = data_encoding - sr.file_encoding = file_encoding - return sr - -### Helpers for codec lookup - -def getencoder(encoding): - - """ Lookup up the codec for the given encoding and return - its encoder function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding).encode - -def getdecoder(encoding): - - """ Lookup up the codec for the given encoding and return - its decoder function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding).decode - -def getincrementalencoder(encoding): - - """ Lookup up the codec for the given encoding and return - its IncrementalEncoder class or factory function. - - Raises a LookupError in case the encoding cannot be found - or the codecs doesn't provide an incremental encoder. - - """ - encoder = lookup(encoding).incrementalencoder - if encoder is None: - raise LookupError(encoding) - return encoder - -def getincrementaldecoder(encoding): - - """ Lookup up the codec for the given encoding and return - its IncrementalDecoder class or factory function. - - Raises a LookupError in case the encoding cannot be found - or the codecs doesn't provide an incremental decoder. - - """ - decoder = lookup(encoding).incrementaldecoder - if decoder is None: - raise LookupError(encoding) - return decoder - -def getreader(encoding): - - """ Lookup up the codec for the given encoding and return - its StreamReader class or factory function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding).streamreader - -def getwriter(encoding): - - """ Lookup up the codec for the given encoding and return - its StreamWriter class or factory function. - - Raises a LookupError in case the encoding cannot be found. - - """ - return lookup(encoding).streamwriter - -def iterencode(iterator, encoding, errors='strict', **kwargs): - """ - Encoding iterator. - - Encodes the input strings from the iterator using a IncrementalEncoder. - - errors and kwargs are passed through to the IncrementalEncoder - constructor. - """ - encoder = getincrementalencoder(encoding)(errors, **kwargs) - for input in iterator: - output = encoder.encode(input) - if output: - yield output - output = encoder.encode("", True) - if output: - yield output - -def iterdecode(iterator, encoding, errors='strict', **kwargs): - """ - Decoding iterator. - - Decodes the input strings from the iterator using a IncrementalDecoder. - - errors and kwargs are passed through to the IncrementalDecoder - constructor. - """ - decoder = getincrementaldecoder(encoding)(errors, **kwargs) - for input in iterator: - output = decoder.decode(input) - if output: - yield output - output = decoder.decode("", True) - if output: - yield output - -### Helpers for charmap-based codecs - -def make_identity_dict(rng): - - """ make_identity_dict(rng) -> dict - - Return a dictionary where elements of the rng sequence are - mapped to themselves. - - """ - res = {} - for i in rng: - res[i]=i - return res - -def make_encoding_map(decoding_map): - - """ Creates an encoding map from a decoding map. - - If a target mapping in the decoding map occurs multiple - times, then that target is mapped to None (undefined mapping), - causing an exception when encountered by the charmap codec - during translation. - - One example where this happens is cp875.py which decodes - multiple character to \\u001a. - - """ - m = {} - for k,v in decoding_map.items(): - if not v in m: - m[v] = k - else: - m[v] = None - return m - -### error handlers - -try: - strict_errors = lookup_error("strict") - ignore_errors = lookup_error("ignore") - replace_errors = lookup_error("replace") - xmlcharrefreplace_errors = lookup_error("xmlcharrefreplace") - backslashreplace_errors = lookup_error("backslashreplace") -except LookupError: - # In --disable-unicode builds, these error handler are missing - strict_errors = None - ignore_errors = None - replace_errors = None - xmlcharrefreplace_errors = None - backslashreplace_errors = None - -# Tell modulefinder that using codecs probably needs the encodings -# package -_false = 0 -if _false: - import encodings - -### Tests - -if __name__ == '__main__': - - # Make stdout translate Latin-1 output into UTF-8 output - sys.stdout = EncodedFile(sys.stdout, 'latin-1', 'utf-8') - - # Have stdin translate Latin-1 input into UTF-8 input - sys.stdin = EncodedFile(sys.stdin, 'utf-8', 'latin-1') diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py deleted file mode 100644 index 82bf490..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/collections.py +++ /dev/null @@ -1,730 +0,0 @@ -__all__ = ['Counter', 'deque', 'defaultdict', 'namedtuple', 'OrderedDict'] -# For bootstrapping reasons, the collection ABCs are defined in _abcoll.py. -# They should however be considered an integral part of collections.py. -from _abcoll import * -import _abcoll -__all__ += _abcoll.__all__ - -from _collections import deque, defaultdict -from operator import itemgetter as _itemgetter, eq as _eq -from keyword import iskeyword as _iskeyword -import sys as _sys -import heapq as _heapq -from itertools import repeat as _repeat, chain as _chain, starmap as _starmap -from itertools import imap as _imap - -try: - from thread import get_ident as _get_ident -except ImportError: - from dummy_thread import get_ident as _get_ident - - -################################################################################ -### OrderedDict -################################################################################ - -class OrderedDict(dict): - 'Dictionary that remembers insertion order' - # An inherited dict maps keys to values. - # The inherited dict provides __getitem__, __len__, __contains__, and get. - # The remaining methods are order-aware. - # Big-O running times for all methods are the same as regular dictionaries. - - # The internal self.__map dict maps keys to links in a doubly linked list. - # The circular doubly linked list starts and ends with a sentinel element. - # The sentinel element never gets deleted (this simplifies the algorithm). - # Each link is stored as a list of length three: [PREV, NEXT, KEY]. - - def __init__(*args, **kwds): - '''Initialize an ordered dictionary. The signature is the same as - regular dictionaries, but keyword arguments are not recommended because - their insertion order is arbitrary. - - ''' - if not args: - raise TypeError("descriptor '__init__' of 'OrderedDict' object " - "needs an argument") - self = args[0] - args = args[1:] - if len(args) > 1: - raise TypeError('expected at most 1 arguments, got %d' % len(args)) - try: - self.__root - except AttributeError: - self.__root = root = [] # sentinel node - root[:] = [root, root, None] - self.__map = {} - self.__update(*args, **kwds) - - def __setitem__(self, key, value, dict_setitem=dict.__setitem__): - 'od.__setitem__(i, y) <==> od[i]=y' - # Setting a new item creates a new link at the end of the linked list, - # and the inherited dictionary is updated with the new key/value pair. - if key not in self: - root = self.__root - last = root[0] - last[1] = root[0] = self.__map[key] = [last, root, key] - return dict_setitem(self, key, value) - - def __delitem__(self, key, dict_delitem=dict.__delitem__): - 'od.__delitem__(y) <==> del od[y]' - # Deleting an existing item uses self.__map to find the link which gets - # removed by updating the links in the predecessor and successor nodes. - dict_delitem(self, key) - link_prev, link_next, _ = self.__map.pop(key) - link_prev[1] = link_next # update link_prev[NEXT] - link_next[0] = link_prev # update link_next[PREV] - - def __iter__(self): - 'od.__iter__() <==> iter(od)' - # Traverse the linked list in order. - root = self.__root - curr = root[1] # start at the first node - while curr is not root: - yield curr[2] # yield the curr[KEY] - curr = curr[1] # move to next node - - def __reversed__(self): - 'od.__reversed__() <==> reversed(od)' - # Traverse the linked list in reverse order. - root = self.__root - curr = root[0] # start at the last node - while curr is not root: - yield curr[2] # yield the curr[KEY] - curr = curr[0] # move to previous node - - def clear(self): - 'od.clear() -> None. Remove all items from od.' - root = self.__root - root[:] = [root, root, None] - self.__map.clear() - dict.clear(self) - - # -- the following methods do not depend on the internal structure -- - - def keys(self): - 'od.keys() -> list of keys in od' - return list(self) - - def values(self): - 'od.values() -> list of values in od' - return [self[key] for key in self] - - def items(self): - 'od.items() -> list of (key, value) pairs in od' - return [(key, self[key]) for key in self] - - def iterkeys(self): - 'od.iterkeys() -> an iterator over the keys in od' - return iter(self) - - def itervalues(self): - 'od.itervalues -> an iterator over the values in od' - for k in self: - yield self[k] - - def iteritems(self): - 'od.iteritems -> an iterator over the (key, value) pairs in od' - for k in self: - yield (k, self[k]) - - update = MutableMapping.update - - __update = update # let subclasses override update without breaking __init__ - - __marker = object() - - def pop(self, key, default=__marker): - '''od.pop(k[,d]) -> v, remove specified key and return the corresponding - value. If key is not found, d is returned if given, otherwise KeyError - is raised. - - ''' - if key in self: - result = self[key] - del self[key] - return result - if default is self.__marker: - raise KeyError(key) - return default - - def setdefault(self, key, default=None): - 'od.setdefault(k[,d]) -> od.get(k,d), also set od[k]=d if k not in od' - if key in self: - return self[key] - self[key] = default - return default - - def popitem(self, last=True): - '''od.popitem() -> (k, v), return and remove a (key, value) pair. - Pairs are returned in LIFO order if last is true or FIFO order if false. - - ''' - if not self: - raise KeyError('dictionary is empty') - key = next(reversed(self) if last else iter(self)) - value = self.pop(key) - return key, value - - def __repr__(self, _repr_running={}): - 'od.__repr__() <==> repr(od)' - call_key = id(self), _get_ident() - if call_key in _repr_running: - return '...' - _repr_running[call_key] = 1 - try: - if not self: - return '%s()' % (self.__class__.__name__,) - return '%s(%r)' % (self.__class__.__name__, self.items()) - finally: - del _repr_running[call_key] - - def __reduce__(self): - 'Return state information for pickling' - items = [[k, self[k]] for k in self] - inst_dict = vars(self).copy() - for k in vars(OrderedDict()): - inst_dict.pop(k, None) - if inst_dict: - return (self.__class__, (items,), inst_dict) - return self.__class__, (items,) - - def copy(self): - 'od.copy() -> a shallow copy of od' - return self.__class__(self) - - @classmethod - def fromkeys(cls, iterable, value=None): - '''OD.fromkeys(S[, v]) -> New ordered dictionary with keys from S. - If not specified, the value defaults to None. - - ''' - self = cls() - for key in iterable: - self[key] = value - return self - - def __eq__(self, other): - '''od.__eq__(y) <==> od==y. Comparison to another OD is order-sensitive - while comparison to a regular mapping is order-insensitive. - - ''' - if isinstance(other, OrderedDict): - return dict.__eq__(self, other) and all(_imap(_eq, self, other)) - return dict.__eq__(self, other) - - def __ne__(self, other): - 'od.__ne__(y) <==> od!=y' - return not self == other - - # -- the following methods support python 3.x style dictionary views -- - - def viewkeys(self): - "od.viewkeys() -> a set-like object providing a view on od's keys" - return KeysView(self) - - def viewvalues(self): - "od.viewvalues() -> an object providing a view on od's values" - return ValuesView(self) - - def viewitems(self): - "od.viewitems() -> a set-like object providing a view on od's items" - return ItemsView(self) - - -################################################################################ -### namedtuple -################################################################################ - -_class_template = '''\ -class {typename}(tuple): - '{typename}({arg_list})' - - __slots__ = () - - _fields = {field_names!r} - - def __new__(_cls, {arg_list}): - 'Create new instance of {typename}({arg_list})' - return _tuple.__new__(_cls, ({arg_list})) - - @classmethod - def _make(cls, iterable, new=tuple.__new__, len=len): - 'Make a new {typename} object from a sequence or iterable' - result = new(cls, iterable) - if len(result) != {num_fields:d}: - raise TypeError('Expected {num_fields:d} arguments, got %d' % len(result)) - return result - - def __repr__(self): - 'Return a nicely formatted representation string' - return '{typename}({repr_fmt})' % self - - def _asdict(self): - 'Return a new OrderedDict which maps field names to their values' - return OrderedDict(zip(self._fields, self)) - - def _replace(_self, **kwds): - 'Return a new {typename} object replacing specified fields with new values' - result = _self._make(map(kwds.pop, {field_names!r}, _self)) - if kwds: - raise ValueError('Got unexpected field names: %r' % kwds.keys()) - return result - - def __getnewargs__(self): - 'Return self as a plain tuple. Used by copy and pickle.' - return tuple(self) - - __dict__ = _property(_asdict) - - def __getstate__(self): - 'Exclude the OrderedDict from pickling' - pass - -{field_defs} -''' - -_repr_template = '{name}=%r' - -_field_template = '''\ - {name} = _property(_itemgetter({index:d}), doc='Alias for field number {index:d}') -''' - -def namedtuple(typename, field_names, verbose=False, rename=False): - """Returns a new subclass of tuple with named fields. - - >>> Point = namedtuple('Point', ['x', 'y']) - >>> Point.__doc__ # docstring for the new class - 'Point(x, y)' - >>> p = Point(11, y=22) # instantiate with positional args or keywords - >>> p[0] + p[1] # indexable like a plain tuple - 33 - >>> x, y = p # unpack like a regular tuple - >>> x, y - (11, 22) - >>> p.x + p.y # fields also accessable by name - 33 - >>> d = p._asdict() # convert to a dictionary - >>> d['x'] - 11 - >>> Point(**d) # convert from a dictionary - Point(x=11, y=22) - >>> p._replace(x=100) # _replace() is like str.replace() but targets named fields - Point(x=100, y=22) - - """ - - # Validate the field names. At the user's option, either generate an error - # message or automatically replace the field name with a valid name. - if isinstance(field_names, basestring): - field_names = field_names.replace(',', ' ').split() - field_names = map(str, field_names) - typename = str(typename) - if rename: - seen = set() - for index, name in enumerate(field_names): - if (not all(c.isalnum() or c=='_' for c in name) - or _iskeyword(name) - or not name - or name[0].isdigit() - or name.startswith('_') - or name in seen): - field_names[index] = '_%d' % index - seen.add(name) - for name in [typename] + field_names: - if type(name) != str: - raise TypeError('Type names and field names must be strings') - if not all(c.isalnum() or c=='_' for c in name): - raise ValueError('Type names and field names can only contain ' - 'alphanumeric characters and underscores: %r' % name) - if _iskeyword(name): - raise ValueError('Type names and field names cannot be a ' - 'keyword: %r' % name) - if name[0].isdigit(): - raise ValueError('Type names and field names cannot start with ' - 'a number: %r' % name) - seen = set() - for name in field_names: - if name.startswith('_') and not rename: - raise ValueError('Field names cannot start with an underscore: ' - '%r' % name) - if name in seen: - raise ValueError('Encountered duplicate field name: %r' % name) - seen.add(name) - - # Fill-in the class template - class_definition = _class_template.format( - typename = typename, - field_names = tuple(field_names), - num_fields = len(field_names), - arg_list = repr(tuple(field_names)).replace("'", "")[1:-1], - repr_fmt = ', '.join(_repr_template.format(name=name) - for name in field_names), - field_defs = '\n'.join(_field_template.format(index=index, name=name) - for index, name in enumerate(field_names)) - ) - if verbose: - print class_definition - - # Execute the template string in a temporary namespace and support - # tracing utilities by setting a value for frame.f_globals['__name__'] - namespace = dict(_itemgetter=_itemgetter, __name__='namedtuple_%s' % typename, - OrderedDict=OrderedDict, _property=property, _tuple=tuple) - try: - exec class_definition in namespace - except SyntaxError as e: - raise SyntaxError(e.message + ':\n' + class_definition) - result = namespace[typename] - - # For pickling to work, the __module__ variable needs to be set to the frame - # where the named tuple is created. Bypass this step in environments where - # sys._getframe is not defined (Jython for example) or sys._getframe is not - # defined for arguments greater than 0 (IronPython). - try: - result.__module__ = _sys._getframe(1).f_globals.get('__name__', '__main__') - except (AttributeError, ValueError): - pass - - return result - - -######################################################################## -### Counter -######################################################################## - -class Counter(dict): - '''Dict subclass for counting hashable items. Sometimes called a bag - or multiset. Elements are stored as dictionary keys and their counts - are stored as dictionary values. - - >>> c = Counter('abcdeabcdabcaba') # count elements from a string - - >>> c.most_common(3) # three most common elements - [('a', 5), ('b', 4), ('c', 3)] - >>> sorted(c) # list all unique elements - ['a', 'b', 'c', 'd', 'e'] - >>> ''.join(sorted(c.elements())) # list elements with repetitions - 'aaaaabbbbcccdde' - >>> sum(c.values()) # total of all counts - 15 - - >>> c['a'] # count of letter 'a' - 5 - >>> for elem in 'shazam': # update counts from an iterable - ... c[elem] += 1 # by adding 1 to each element's count - >>> c['a'] # now there are seven 'a' - 7 - >>> del c['b'] # remove all 'b' - >>> c['b'] # now there are zero 'b' - 0 - - >>> d = Counter('simsalabim') # make another counter - >>> c.update(d) # add in the second counter - >>> c['a'] # now there are nine 'a' - 9 - - >>> c.clear() # empty the counter - >>> c - Counter() - - Note: If a count is set to zero or reduced to zero, it will remain - in the counter until the entry is deleted or the counter is cleared: - - >>> c = Counter('aaabbc') - >>> c['b'] -= 2 # reduce the count of 'b' by two - >>> c.most_common() # 'b' is still in, but its count is zero - [('a', 3), ('c', 1), ('b', 0)] - - ''' - # References: - # http://en.wikipedia.org/wiki/Multiset - # http://www.gnu.org/software/smalltalk/manual-base/html_node/Bag.html - # http://www.demo2s.com/Tutorial/Cpp/0380__set-multiset/Catalog0380__set-multiset.htm - # http://code.activestate.com/recipes/259174/ - # Knuth, TAOCP Vol. II section 4.6.3 - - def __init__(*args, **kwds): - '''Create a new, empty Counter object. And if given, count elements - from an input iterable. Or, initialize the count from another mapping - of elements to their counts. - - >>> c = Counter() # a new, empty counter - >>> c = Counter('gallahad') # a new counter from an iterable - >>> c = Counter({'a': 4, 'b': 2}) # a new counter from a mapping - >>> c = Counter(a=4, b=2) # a new counter from keyword args - - ''' - if not args: - raise TypeError("descriptor '__init__' of 'Counter' object " - "needs an argument") - self = args[0] - args = args[1:] - if len(args) > 1: - raise TypeError('expected at most 1 arguments, got %d' % len(args)) - super(Counter, self).__init__() - self.update(*args, **kwds) - - def __missing__(self, key): - 'The count of elements not in the Counter is zero.' - # Needed so that self[missing_item] does not raise KeyError - return 0 - - def most_common(self, n=None): - '''List the n most common elements and their counts from the most - common to the least. If n is None, then list all element counts. - - >>> Counter('abcdeabcdabcaba').most_common(3) - [('a', 5), ('b', 4), ('c', 3)] - - ''' - # Emulate Bag.sortedByCount from Smalltalk - if n is None: - return sorted(self.iteritems(), key=_itemgetter(1), reverse=True) - return _heapq.nlargest(n, self.iteritems(), key=_itemgetter(1)) - - def elements(self): - '''Iterator over elements repeating each as many times as its count. - - >>> c = Counter('ABCABC') - >>> sorted(c.elements()) - ['A', 'A', 'B', 'B', 'C', 'C'] - - # Knuth's example for prime factors of 1836: 2**2 * 3**3 * 17**1 - >>> prime_factors = Counter({2: 2, 3: 3, 17: 1}) - >>> product = 1 - >>> for factor in prime_factors.elements(): # loop over factors - ... product *= factor # and multiply them - >>> product - 1836 - - Note, if an element's count has been set to zero or is a negative - number, elements() will ignore it. - - ''' - # Emulate Bag.do from Smalltalk and Multiset.begin from C++. - return _chain.from_iterable(_starmap(_repeat, self.iteritems())) - - # Override dict methods where necessary - - @classmethod - def fromkeys(cls, iterable, v=None): - # There is no equivalent method for counters because setting v=1 - # means that no element can have a count greater than one. - raise NotImplementedError( - 'Counter.fromkeys() is undefined. Use Counter(iterable) instead.') - - def update(*args, **kwds): - '''Like dict.update() but add counts instead of replacing them. - - Source can be an iterable, a dictionary, or another Counter instance. - - >>> c = Counter('which') - >>> c.update('witch') # add elements from another iterable - >>> d = Counter('watch') - >>> c.update(d) # add elements from another counter - >>> c['h'] # four 'h' in which, witch, and watch - 4 - - ''' - # The regular dict.update() operation makes no sense here because the - # replace behavior results in the some of original untouched counts - # being mixed-in with all of the other counts for a mismash that - # doesn't have a straight-forward interpretation in most counting - # contexts. Instead, we implement straight-addition. Both the inputs - # and outputs are allowed to contain zero and negative counts. - - if not args: - raise TypeError("descriptor 'update' of 'Counter' object " - "needs an argument") - self = args[0] - args = args[1:] - if len(args) > 1: - raise TypeError('expected at most 1 arguments, got %d' % len(args)) - iterable = args[0] if args else None - if iterable is not None: - if isinstance(iterable, Mapping): - if self: - self_get = self.get - for elem, count in iterable.iteritems(): - self[elem] = self_get(elem, 0) + count - else: - super(Counter, self).update(iterable) # fast path when counter is empty - else: - self_get = self.get - for elem in iterable: - self[elem] = self_get(elem, 0) + 1 - if kwds: - self.update(kwds) - - def subtract(*args, **kwds): - '''Like dict.update() but subtracts counts instead of replacing them. - Counts can be reduced below zero. Both the inputs and outputs are - allowed to contain zero and negative counts. - - Source can be an iterable, a dictionary, or another Counter instance. - - >>> c = Counter('which') - >>> c.subtract('witch') # subtract elements from another iterable - >>> c.subtract(Counter('watch')) # subtract elements from another counter - >>> c['h'] # 2 in which, minus 1 in witch, minus 1 in watch - 0 - >>> c['w'] # 1 in which, minus 1 in witch, minus 1 in watch - -1 - - ''' - if not args: - raise TypeError("descriptor 'subtract' of 'Counter' object " - "needs an argument") - self = args[0] - args = args[1:] - if len(args) > 1: - raise TypeError('expected at most 1 arguments, got %d' % len(args)) - iterable = args[0] if args else None - if iterable is not None: - self_get = self.get - if isinstance(iterable, Mapping): - for elem, count in iterable.items(): - self[elem] = self_get(elem, 0) - count - else: - for elem in iterable: - self[elem] = self_get(elem, 0) - 1 - if kwds: - self.subtract(kwds) - - def copy(self): - 'Return a shallow copy.' - return self.__class__(self) - - def __reduce__(self): - return self.__class__, (dict(self),) - - def __delitem__(self, elem): - 'Like dict.__delitem__() but does not raise KeyError for missing values.' - if elem in self: - super(Counter, self).__delitem__(elem) - - def __repr__(self): - if not self: - return '%s()' % self.__class__.__name__ - items = ', '.join(map('%r: %r'.__mod__, self.most_common())) - return '%s({%s})' % (self.__class__.__name__, items) - - # Multiset-style mathematical operations discussed in: - # Knuth TAOCP Volume II section 4.6.3 exercise 19 - # and at http://en.wikipedia.org/wiki/Multiset - # - # Outputs guaranteed to only include positive counts. - # - # To strip negative and zero counts, add-in an empty counter: - # c += Counter() - - def __add__(self, other): - '''Add counts from two counters. - - >>> Counter('abbb') + Counter('bcc') - Counter({'b': 4, 'c': 2, 'a': 1}) - - ''' - if not isinstance(other, Counter): - return NotImplemented - result = Counter() - for elem, count in self.items(): - newcount = count + other[elem] - if newcount > 0: - result[elem] = newcount - for elem, count in other.items(): - if elem not in self and count > 0: - result[elem] = count - return result - - def __sub__(self, other): - ''' Subtract count, but keep only results with positive counts. - - >>> Counter('abbbc') - Counter('bccd') - Counter({'b': 2, 'a': 1}) - - ''' - if not isinstance(other, Counter): - return NotImplemented - result = Counter() - for elem, count in self.items(): - newcount = count - other[elem] - if newcount > 0: - result[elem] = newcount - for elem, count in other.items(): - if elem not in self and count < 0: - result[elem] = 0 - count - return result - - def __or__(self, other): - '''Union is the maximum of value in either of the input counters. - - >>> Counter('abbb') | Counter('bcc') - Counter({'b': 3, 'c': 2, 'a': 1}) - - ''' - if not isinstance(other, Counter): - return NotImplemented - result = Counter() - for elem, count in self.items(): - other_count = other[elem] - newcount = other_count if count < other_count else count - if newcount > 0: - result[elem] = newcount - for elem, count in other.items(): - if elem not in self and count > 0: - result[elem] = count - return result - - def __and__(self, other): - ''' Intersection is the minimum of corresponding counts. - - >>> Counter('abbb') & Counter('bcc') - Counter({'b': 1}) - - ''' - if not isinstance(other, Counter): - return NotImplemented - result = Counter() - for elem, count in self.items(): - other_count = other[elem] - newcount = count if count < other_count else other_count - if newcount > 0: - result[elem] = newcount - return result - - -if __name__ == '__main__': - # verify that instances can be pickled - from cPickle import loads, dumps - Point = namedtuple('Point', 'x, y', True) - p = Point(x=10, y=20) - assert p == loads(dumps(p)) - - # test and demonstrate ability to override methods - class Point(namedtuple('Point', 'x y')): - __slots__ = () - @property - def hypot(self): - return (self.x ** 2 + self.y ** 2) ** 0.5 - def __str__(self): - return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot) - - for p in Point(3, 4), Point(14, 5/7.): - print p - - class Point(namedtuple('Point', 'x y')): - 'Point class with optimized _make() and _replace() without error-checking' - __slots__ = () - _make = classmethod(tuple.__new__) - def _replace(self, _map=map, **kwds): - return self._make(_map(kwds.get, ('x', 'y'), self)) - - print Point(11, 22)._replace(x=100) - - Point3D = namedtuple('Point3D', Point._fields + ('z',)) - print Point3D.__doc__ - - import doctest - TestResults = namedtuple('TestResults', 'failed attempted') - print TestResults(*doctest.testmod()) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py deleted file mode 100644 index 839649d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/compileall.py +++ /dev/null @@ -1,227 +0,0 @@ -"""Module/script to byte-compile all .py files to .pyc (or .pyo) files. - -When called as a script with arguments, this compiles the directories -given as arguments recursively; the -l option prevents it from -recursing into directories. - -Without arguments, if compiles all modules on sys.path, without -recursing into subdirectories. (Even though it should do so for -packages -- for now, you'll have to deal with packages separately.) - -See module py_compile for details of the actual byte-compilation. -""" -import os -import sys -import py_compile -import struct -import imp - -__all__ = ["compile_dir","compile_file","compile_path"] - -def compile_dir(dir, maxlevels=10, ddir=None, - force=0, rx=None, quiet=0): - """Byte-compile all modules in the given directory tree. - - Arguments (only dir is required): - - dir: the directory to byte-compile - maxlevels: maximum recursion level (default 10) - ddir: the directory that will be prepended to the path to the - file as it is compiled into each byte-code file. - force: if 1, force compilation, even if timestamps are up-to-date - quiet: if 1, be quiet during compilation - """ - if not quiet: - print 'Listing', dir, '...' - try: - names = os.listdir(dir) - except os.error: - print "Can't list", dir - names = [] - names.sort() - success = 1 - for name in names: - fullname = os.path.join(dir, name) - if ddir is not None: - dfile = os.path.join(ddir, name) - else: - dfile = None - if not os.path.isdir(fullname): - if not compile_file(fullname, ddir, force, rx, quiet): - success = 0 - elif maxlevels > 0 and \ - name != os.curdir and name != os.pardir and \ - os.path.isdir(fullname) and \ - not os.path.islink(fullname): - if not compile_dir(fullname, maxlevels - 1, dfile, force, rx, - quiet): - success = 0 - return success - -def compile_file(fullname, ddir=None, force=0, rx=None, quiet=0): - """Byte-compile one file. - - Arguments (only fullname is required): - - fullname: the file to byte-compile - ddir: if given, the directory name compiled in to the - byte-code file. - force: if 1, force compilation, even if timestamps are up-to-date - quiet: if 1, be quiet during compilation - """ - success = 1 - name = os.path.basename(fullname) - if ddir is not None: - dfile = os.path.join(ddir, name) - else: - dfile = None - if rx is not None: - mo = rx.search(fullname) - if mo: - return success - if os.path.isfile(fullname): - head, tail = name[:-3], name[-3:] - if tail == '.py': - if not force: - try: - mtime = int(os.stat(fullname).st_mtime) - expect = struct.pack('<4sl', imp.get_magic(), mtime) - cfile = fullname + (__debug__ and 'c' or 'o') - with open(cfile, 'rb') as chandle: - actual = chandle.read(8) - if expect == actual: - return success - except IOError: - pass - if not quiet: - print 'Compiling', fullname, '...' - try: - ok = py_compile.compile(fullname, None, dfile, True) - except py_compile.PyCompileError,err: - if quiet: - print 'Compiling', fullname, '...' - print err.msg - success = 0 - except IOError, e: - print "Sorry", e - success = 0 - else: - if ok == 0: - success = 0 - return success - -def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0): - """Byte-compile all module on sys.path. - - Arguments (all optional): - - skip_curdir: if true, skip current directory (default true) - maxlevels: max recursion level (default 0) - force: as for compile_dir() (default 0) - quiet: as for compile_dir() (default 0) - """ - success = 1 - for dir in sys.path: - if (not dir or dir == os.curdir) and skip_curdir: - print 'Skipping current directory' - else: - success = success and compile_dir(dir, maxlevels, None, - force, quiet=quiet) - return success - -def expand_args(args, flist): - """read names in flist and append to args""" - expanded = args[:] - if flist: - try: - if flist == '-': - fd = sys.stdin - else: - fd = open(flist) - while 1: - line = fd.readline() - if not line: - break - expanded.append(line[:-1]) - except IOError: - print "Error reading file list %s" % flist - raise - return expanded - -def main(): - """Script main program.""" - import getopt - try: - opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:i:') - except getopt.error, msg: - print msg - print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \ - "[-x regexp] [-i list] [directory|file ...]" - print - print "arguments: zero or more file and directory names to compile; " \ - "if no arguments given, " - print " defaults to the equivalent of -l sys.path" - print - print "options:" - print "-l: don't recurse into subdirectories" - print "-f: force rebuild even if timestamps are up-to-date" - print "-q: output only error messages" - print "-d destdir: directory to prepend to file paths for use in " \ - "compile-time tracebacks and in" - print " runtime tracebacks in cases where the source " \ - "file is unavailable" - print "-x regexp: skip files matching the regular expression regexp; " \ - "the regexp is searched for" - print " in the full path of each file considered for " \ - "compilation" - print "-i file: add all the files and directories listed in file to " \ - "the list considered for" - print ' compilation; if "-", names are read from stdin' - - sys.exit(2) - maxlevels = 10 - ddir = None - force = 0 - quiet = 0 - rx = None - flist = None - for o, a in opts: - if o == '-l': maxlevels = 0 - if o == '-d': ddir = a - if o == '-f': force = 1 - if o == '-q': quiet = 1 - if o == '-x': - import re - rx = re.compile(a) - if o == '-i': flist = a - if ddir: - if len(args) != 1 and not os.path.isdir(args[0]): - print "-d destdir require exactly one directory argument" - sys.exit(2) - success = 1 - try: - if args or flist: - try: - if flist: - args = expand_args(args, flist) - except IOError: - success = 0 - if success: - for arg in args: - if os.path.isdir(arg): - if not compile_dir(arg, maxlevels, ddir, - force, rx, quiet): - success = 0 - else: - if not compile_file(arg, ddir, force, rx, quiet): - success = 0 - else: - success = compile_path() - except KeyboardInterrupt: - print "\n[interrupted]" - success = 0 - return success - -if __name__ == '__main__': - exit_status = int(not main()) - sys.exit(exit_status) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py deleted file mode 100644 index c9792f7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/copy.py +++ /dev/null @@ -1,433 +0,0 @@ -"""Generic (shallow and deep) copying operations. - -Interface summary: - - import copy - - x = copy.copy(y) # make a shallow copy of y - x = copy.deepcopy(y) # make a deep copy of y - -For module specific errors, copy.Error is raised. - -The difference between shallow and deep copying is only relevant for -compound objects (objects that contain other objects, like lists or -class instances). - -- A shallow copy constructs a new compound object and then (to the - extent possible) inserts *the same objects* into it that the - original contains. - -- A deep copy constructs a new compound object and then, recursively, - inserts *copies* into it of the objects found in the original. - -Two problems often exist with deep copy operations that don't exist -with shallow copy operations: - - a) recursive objects (compound objects that, directly or indirectly, - contain a reference to themselves) may cause a recursive loop - - b) because deep copy copies *everything* it may copy too much, e.g. - administrative data structures that should be shared even between - copies - -Python's deep copy operation avoids these problems by: - - a) keeping a table of objects already copied during the current - copying pass - - b) letting user-defined classes override the copying operation or the - set of components copied - -This version does not copy types like module, class, function, method, -nor stack trace, stack frame, nor file, socket, window, nor array, nor -any similar types. - -Classes can use the same interfaces to control copying that they use -to control pickling: they can define methods called __getinitargs__(), -__getstate__() and __setstate__(). See the documentation for module -"pickle" for information on these methods. -""" - -import types -import weakref -from copy_reg import dispatch_table - -class Error(Exception): - pass -error = Error # backward compatibility - -try: - from org.python.core import PyStringMap -except ImportError: - PyStringMap = None - -__all__ = ["Error", "copy", "deepcopy"] - -def copy(x): - """Shallow copy operation on arbitrary Python objects. - - See the module's __doc__ string for more info. - """ - - cls = type(x) - - copier = _copy_dispatch.get(cls) - if copier: - return copier(x) - - copier = getattr(cls, "__copy__", None) - if copier: - return copier(x) - - reductor = dispatch_table.get(cls) - if reductor: - rv = reductor(x) - else: - reductor = getattr(x, "__reduce_ex__", None) - if reductor: - rv = reductor(2) - else: - reductor = getattr(x, "__reduce__", None) - if reductor: - rv = reductor() - else: - raise Error("un(shallow)copyable object of type %s" % cls) - - return _reconstruct(x, rv, 0) - - -_copy_dispatch = d = {} - -def _copy_immutable(x): - return x -for t in (type(None), int, long, float, bool, str, tuple, - frozenset, type, xrange, types.ClassType, - types.BuiltinFunctionType, type(Ellipsis), - types.FunctionType, weakref.ref): - d[t] = _copy_immutable -for name in ("ComplexType", "UnicodeType", "CodeType"): - t = getattr(types, name, None) - if t is not None: - d[t] = _copy_immutable - -def _copy_with_constructor(x): - return type(x)(x) -for t in (list, dict, set): - d[t] = _copy_with_constructor - -def _copy_with_copy_method(x): - return x.copy() -if PyStringMap is not None: - d[PyStringMap] = _copy_with_copy_method - -def _copy_inst(x): - if hasattr(x, '__copy__'): - return x.__copy__() - if hasattr(x, '__getinitargs__'): - args = x.__getinitargs__() - y = x.__class__(*args) - else: - y = _EmptyClass() - y.__class__ = x.__class__ - if hasattr(x, '__getstate__'): - state = x.__getstate__() - else: - state = x.__dict__ - if hasattr(y, '__setstate__'): - y.__setstate__(state) - else: - y.__dict__.update(state) - return y -d[types.InstanceType] = _copy_inst - -del d - -def deepcopy(x, memo=None, _nil=[]): - """Deep copy operation on arbitrary Python objects. - - See the module's __doc__ string for more info. - """ - - if memo is None: - memo = {} - - d = id(x) - y = memo.get(d, _nil) - if y is not _nil: - return y - - cls = type(x) - - copier = _deepcopy_dispatch.get(cls) - if copier: - y = copier(x, memo) - else: - try: - issc = issubclass(cls, type) - except TypeError: # cls is not a class (old Boost; see SF #502085) - issc = 0 - if issc: - y = _deepcopy_atomic(x, memo) - else: - copier = getattr(x, "__deepcopy__", None) - if copier: - y = copier(memo) - else: - reductor = dispatch_table.get(cls) - if reductor: - rv = reductor(x) - else: - reductor = getattr(x, "__reduce_ex__", None) - if reductor: - rv = reductor(2) - else: - reductor = getattr(x, "__reduce__", None) - if reductor: - rv = reductor() - else: - raise Error( - "un(deep)copyable object of type %s" % cls) - y = _reconstruct(x, rv, 1, memo) - - memo[d] = y - _keep_alive(x, memo) # Make sure x lives at least as long as d - return y - -_deepcopy_dispatch = d = {} - -def _deepcopy_atomic(x, memo): - return x -d[type(None)] = _deepcopy_atomic -d[type(Ellipsis)] = _deepcopy_atomic -d[int] = _deepcopy_atomic -d[long] = _deepcopy_atomic -d[float] = _deepcopy_atomic -d[bool] = _deepcopy_atomic -try: - d[complex] = _deepcopy_atomic -except NameError: - pass -d[str] = _deepcopy_atomic -try: - d[unicode] = _deepcopy_atomic -except NameError: - pass -try: - d[types.CodeType] = _deepcopy_atomic -except AttributeError: - pass -d[type] = _deepcopy_atomic -d[xrange] = _deepcopy_atomic -d[types.ClassType] = _deepcopy_atomic -d[types.BuiltinFunctionType] = _deepcopy_atomic -d[types.FunctionType] = _deepcopy_atomic -d[weakref.ref] = _deepcopy_atomic - -def _deepcopy_list(x, memo): - y = [] - memo[id(x)] = y - for a in x: - y.append(deepcopy(a, memo)) - return y -d[list] = _deepcopy_list - -def _deepcopy_tuple(x, memo): - y = [] - for a in x: - y.append(deepcopy(a, memo)) - d = id(x) - try: - return memo[d] - except KeyError: - pass - for i in range(len(x)): - if x[i] is not y[i]: - y = tuple(y) - break - else: - y = x - memo[d] = y - return y -d[tuple] = _deepcopy_tuple - -def _deepcopy_dict(x, memo): - y = {} - memo[id(x)] = y - for key, value in x.iteritems(): - y[deepcopy(key, memo)] = deepcopy(value, memo) - return y -d[dict] = _deepcopy_dict -if PyStringMap is not None: - d[PyStringMap] = _deepcopy_dict - -def _deepcopy_method(x, memo): # Copy instance methods - return type(x)(x.im_func, deepcopy(x.im_self, memo), x.im_class) -_deepcopy_dispatch[types.MethodType] = _deepcopy_method - -def _keep_alive(x, memo): - """Keeps a reference to the object x in the memo. - - Because we remember objects by their id, we have - to assure that possibly temporary objects are kept - alive by referencing them. - We store a reference at the id of the memo, which should - normally not be used unless someone tries to deepcopy - the memo itself... - """ - try: - memo[id(memo)].append(x) - except KeyError: - # aha, this is the first one :-) - memo[id(memo)]=[x] - -def _deepcopy_inst(x, memo): - if hasattr(x, '__deepcopy__'): - return x.__deepcopy__(memo) - if hasattr(x, '__getinitargs__'): - args = x.__getinitargs__() - args = deepcopy(args, memo) - y = x.__class__(*args) - else: - y = _EmptyClass() - y.__class__ = x.__class__ - memo[id(x)] = y - if hasattr(x, '__getstate__'): - state = x.__getstate__() - else: - state = x.__dict__ - state = deepcopy(state, memo) - if hasattr(y, '__setstate__'): - y.__setstate__(state) - else: - y.__dict__.update(state) - return y -d[types.InstanceType] = _deepcopy_inst - -def _reconstruct(x, info, deep, memo=None): - if isinstance(info, str): - return x - assert isinstance(info, tuple) - if memo is None: - memo = {} - n = len(info) - assert n in (2, 3, 4, 5) - callable, args = info[:2] - if n > 2: - state = info[2] - else: - state = {} - if n > 3: - listiter = info[3] - else: - listiter = None - if n > 4: - dictiter = info[4] - else: - dictiter = None - if deep: - args = deepcopy(args, memo) - y = callable(*args) - memo[id(x)] = y - - if state: - if deep: - state = deepcopy(state, memo) - if hasattr(y, '__setstate__'): - y.__setstate__(state) - else: - if isinstance(state, tuple) and len(state) == 2: - state, slotstate = state - else: - slotstate = None - if state is not None: - y.__dict__.update(state) - if slotstate is not None: - for key, value in slotstate.iteritems(): - setattr(y, key, value) - - if listiter is not None: - for item in listiter: - if deep: - item = deepcopy(item, memo) - y.append(item) - if dictiter is not None: - for key, value in dictiter: - if deep: - key = deepcopy(key, memo) - value = deepcopy(value, memo) - y[key] = value - return y - -del d - -del types - -# Helper for instance creation without calling __init__ -class _EmptyClass: - pass - -def _test(): - l = [None, 1, 2L, 3.14, 'xyzzy', (1, 2L), [3.14, 'abc'], - {'abc': 'ABC'}, (), [], {}] - l1 = copy(l) - print l1==l - l1 = map(copy, l) - print l1==l - l1 = deepcopy(l) - print l1==l - class C: - def __init__(self, arg=None): - self.a = 1 - self.arg = arg - if __name__ == '__main__': - import sys - file = sys.argv[0] - else: - file = __file__ - self.fp = open(file) - self.fp.close() - def __getstate__(self): - return {'a': self.a, 'arg': self.arg} - def __setstate__(self, state): - for key, value in state.iteritems(): - setattr(self, key, value) - def __deepcopy__(self, memo=None): - new = self.__class__(deepcopy(self.arg, memo)) - new.a = self.a - return new - c = C('argument sketch') - l.append(c) - l2 = copy(l) - print l == l2 - print l - print l2 - l2 = deepcopy(l) - print l == l2 - print l - print l2 - l.append({l[1]: l, 'xyz': l[2]}) - l3 = copy(l) - import repr - print map(repr.repr, l) - print map(repr.repr, l1) - print map(repr.repr, l2) - print map(repr.repr, l3) - l3 = deepcopy(l) - import repr - print map(repr.repr, l) - print map(repr.repr, l1) - print map(repr.repr, l2) - print map(repr.repr, l3) - class odict(dict): - def __init__(self, d = {}): - self.a = 99 - dict.__init__(self, d) - def __setitem__(self, k, i): - dict.__setitem__(self, k, i) - self.a - o = odict({"A" : "B"}) - x = deepcopy(o) - print(o, x) - -if __name__ == '__main__': - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py deleted file mode 100644 index 72db74d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/copy_reg.py +++ /dev/null @@ -1,201 +0,0 @@ -"""Helper to provide extensibility for pickle/cPickle. - -This is only useful to add pickle support for extension types defined in -C, not for instances of user-defined classes. -""" - -from types import ClassType as _ClassType - -__all__ = ["pickle", "constructor", - "add_extension", "remove_extension", "clear_extension_cache"] - -dispatch_table = {} - -def pickle(ob_type, pickle_function, constructor_ob=None): - if type(ob_type) is _ClassType: - raise TypeError("copy_reg is not intended for use with classes") - - if not hasattr(pickle_function, '__call__'): - raise TypeError("reduction functions must be callable") - dispatch_table[ob_type] = pickle_function - - # The constructor_ob function is a vestige of safe for unpickling. - # There is no reason for the caller to pass it anymore. - if constructor_ob is not None: - constructor(constructor_ob) - -def constructor(object): - if not hasattr(object, '__call__'): - raise TypeError("constructors must be callable") - -# Example: provide pickling support for complex numbers. - -try: - complex -except NameError: - pass -else: - - def pickle_complex(c): - return complex, (c.real, c.imag) - - pickle(complex, pickle_complex, complex) - -# Support for pickling new-style objects - -def _reconstructor(cls, base, state): - if base is object: - obj = object.__new__(cls) - else: - obj = base.__new__(cls, state) - if base.__init__ != object.__init__: - base.__init__(obj, state) - return obj - -_HEAPTYPE = 1<<9 - -# Python code for object.__reduce_ex__ for protocols 0 and 1 - -def _reduce_ex(self, proto): - assert proto < 2 - for base in self.__class__.__mro__: - if hasattr(base, '__flags__') and not base.__flags__ & _HEAPTYPE: - break - else: - base = object # not really reachable - if base is object: - state = None - else: - if base is self.__class__: - raise TypeError, "can't pickle %s objects" % base.__name__ - state = base(self) - args = (self.__class__, base, state) - try: - getstate = self.__getstate__ - except AttributeError: - if getattr(self, "__slots__", None): - raise TypeError("a class that defines __slots__ without " - "defining __getstate__ cannot be pickled") - try: - dict = self.__dict__ - except AttributeError: - dict = None - else: - dict = getstate() - if dict: - return _reconstructor, args, dict - else: - return _reconstructor, args - -# Helper for __reduce_ex__ protocol 2 - -def __newobj__(cls, *args): - return cls.__new__(cls, *args) - -def _slotnames(cls): - """Return a list of slot names for a given class. - - This needs to find slots defined by the class and its bases, so we - can't simply return the __slots__ attribute. We must walk down - the Method Resolution Order and concatenate the __slots__ of each - class found there. (This assumes classes don't modify their - __slots__ attribute to misrepresent their slots after the class is - defined.) - """ - - # Get the value from a cache in the class if possible - names = cls.__dict__.get("__slotnames__") - if names is not None: - return names - - # Not cached -- calculate the value - names = [] - if not hasattr(cls, "__slots__"): - # This class has no slots - pass - else: - # Slots found -- gather slot names from all base classes - for c in cls.__mro__: - if "__slots__" in c.__dict__: - slots = c.__dict__['__slots__'] - # if class has a single slot, it can be given as a string - if isinstance(slots, basestring): - slots = (slots,) - for name in slots: - # special descriptors - if name in ("__dict__", "__weakref__"): - continue - # mangled names - elif name.startswith('__') and not name.endswith('__'): - names.append('_%s%s' % (c.__name__, name)) - else: - names.append(name) - - # Cache the outcome in the class if at all possible - try: - cls.__slotnames__ = names - except: - pass # But don't die if we can't - - return names - -# A registry of extension codes. This is an ad-hoc compression -# mechanism. Whenever a global reference to , is about -# to be pickled, the (, ) tuple is looked up here to see -# if it is a registered extension code for it. Extension codes are -# universal, so that the meaning of a pickle does not depend on -# context. (There are also some codes reserved for local use that -# don't have this restriction.) Codes are positive ints; 0 is -# reserved. - -_extension_registry = {} # key -> code -_inverted_registry = {} # code -> key -_extension_cache = {} # code -> object -# Don't ever rebind those names: cPickle grabs a reference to them when -# it's initialized, and won't see a rebinding. - -def add_extension(module, name, code): - """Register an extension code.""" - code = int(code) - if not 1 <= code <= 0x7fffffff: - raise ValueError, "code out of range" - key = (module, name) - if (_extension_registry.get(key) == code and - _inverted_registry.get(code) == key): - return # Redundant registrations are benign - if key in _extension_registry: - raise ValueError("key %s is already registered with code %s" % - (key, _extension_registry[key])) - if code in _inverted_registry: - raise ValueError("code %s is already in use for key %s" % - (code, _inverted_registry[code])) - _extension_registry[key] = code - _inverted_registry[code] = key - -def remove_extension(module, name, code): - """Unregister an extension code. For testing only.""" - key = (module, name) - if (_extension_registry.get(key) != code or - _inverted_registry.get(code) != key): - raise ValueError("key %s is not registered with code %s" % - (key, code)) - del _extension_registry[key] - del _inverted_registry[code] - if code in _extension_cache: - del _extension_cache[code] - -def clear_extension_cache(): - _extension_cache.clear() - -# Standard extension code assignments - -# Reserved ranges - -# First Last Count Purpose -# 1 127 127 Reserved for Python standard library -# 128 191 64 Reserved for Zope -# 192 239 48 Reserved for 3rd parties -# 240 255 16 Reserved for private use (will never be assigned) -# 256 Inf Inf Reserved for future assignment - -# Extension codes are assigned by the Python Software Foundation. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py deleted file mode 100644 index 081df79..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/csv.py +++ /dev/null @@ -1,456 +0,0 @@ - -""" -csv.py - read/write/investigate CSV files -""" - -import re -from functools import reduce -from _csv import Error, __version__, writer, reader, register_dialect, \ - unregister_dialect, get_dialect, list_dialects, \ - field_size_limit, \ - QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE, \ - __doc__ -from _csv import Dialect as _Dialect - -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - -__all__ = [ "QUOTE_MINIMAL", "QUOTE_ALL", "QUOTE_NONNUMERIC", "QUOTE_NONE", - "Error", "Dialect", "__doc__", "excel", "excel_tab", - "field_size_limit", "reader", "writer", - "register_dialect", "get_dialect", "list_dialects", "Sniffer", - "unregister_dialect", "__version__", "DictReader", "DictWriter" ] - -class Dialect: - """Describe an Excel dialect. - - This must be subclassed (see csv.excel). Valid attributes are: - delimiter, quotechar, escapechar, doublequote, skipinitialspace, - lineterminator, quoting. - - """ - _name = "" - _valid = False - # placeholders - delimiter = None - quotechar = None - escapechar = None - doublequote = None - skipinitialspace = None - lineterminator = None - quoting = None - - def __init__(self): - if self.__class__ != Dialect: - self._valid = True - self._validate() - - def _validate(self): - try: - _Dialect(self) - except TypeError, e: - # We do this for compatibility with py2.3 - raise Error(str(e)) - -class excel(Dialect): - """Describe the usual properties of Excel-generated CSV files.""" - delimiter = ',' - quotechar = '"' - doublequote = True - skipinitialspace = False - lineterminator = '\r\n' - quoting = QUOTE_MINIMAL -register_dialect("excel", excel) - -class excel_tab(excel): - """Describe the usual properties of Excel-generated TAB-delimited files.""" - delimiter = '\t' -register_dialect("excel-tab", excel_tab) - - -class DictReader: - def __init__(self, f, fieldnames=None, restkey=None, restval=None, - dialect="excel", *args, **kwds): - self._fieldnames = fieldnames # list of keys for the dict - self.restkey = restkey # key to catch long rows - self.restval = restval # default value for short rows - self.reader = reader(f, dialect, *args, **kwds) - self.dialect = dialect - self.line_num = 0 - - def __iter__(self): - return self - - @property - def fieldnames(self): - if self._fieldnames is None: - try: - self._fieldnames = self.reader.next() - except StopIteration: - pass - self.line_num = self.reader.line_num - return self._fieldnames - - # Issue 20004: Because DictReader is a classic class, this setter is - # ignored. At this point in 2.7's lifecycle, it is too late to change the - # base class for fear of breaking working code. If you want to change - # fieldnames without overwriting the getter, set _fieldnames directly. - @fieldnames.setter - def fieldnames(self, value): - self._fieldnames = value - - def next(self): - if self.line_num == 0: - # Used only for its side effect. - self.fieldnames - row = self.reader.next() - self.line_num = self.reader.line_num - - # unlike the basic reader, we prefer not to return blanks, - # because we will typically wind up with a dict full of None - # values - while row == []: - row = self.reader.next() - d = dict(zip(self.fieldnames, row)) - lf = len(self.fieldnames) - lr = len(row) - if lf < lr: - d[self.restkey] = row[lf:] - elif lf > lr: - for key in self.fieldnames[lr:]: - d[key] = self.restval - return d - - -class DictWriter: - def __init__(self, f, fieldnames, restval="", extrasaction="raise", - dialect="excel", *args, **kwds): - self.fieldnames = fieldnames # list of keys for the dict - self.restval = restval # for writing short dicts - if extrasaction.lower() not in ("raise", "ignore"): - raise ValueError, \ - ("extrasaction (%s) must be 'raise' or 'ignore'" % - extrasaction) - self.extrasaction = extrasaction - self.writer = writer(f, dialect, *args, **kwds) - - def writeheader(self): - header = dict(zip(self.fieldnames, self.fieldnames)) - self.writerow(header) - - def _dict_to_list(self, rowdict): - if self.extrasaction == "raise": - wrong_fields = [k for k in rowdict if k not in self.fieldnames] - if wrong_fields: - raise ValueError("dict contains fields not in fieldnames: " - + ", ".join([repr(x) for x in wrong_fields])) - return [rowdict.get(key, self.restval) for key in self.fieldnames] - - def writerow(self, rowdict): - return self.writer.writerow(self._dict_to_list(rowdict)) - - def writerows(self, rowdicts): - rows = [] - for rowdict in rowdicts: - rows.append(self._dict_to_list(rowdict)) - return self.writer.writerows(rows) - -# Guard Sniffer's type checking against builds that exclude complex() -try: - complex -except NameError: - complex = float - -class Sniffer: - ''' - "Sniffs" the format of a CSV file (i.e. delimiter, quotechar) - Returns a Dialect object. - ''' - def __init__(self): - # in case there is more than one possible delimiter - self.preferred = [',', '\t', ';', ' ', ':'] - - - def sniff(self, sample, delimiters=None): - """ - Returns a dialect (or None) corresponding to the sample - """ - - quotechar, doublequote, delimiter, skipinitialspace = \ - self._guess_quote_and_delimiter(sample, delimiters) - if not delimiter: - delimiter, skipinitialspace = self._guess_delimiter(sample, - delimiters) - - if not delimiter: - raise Error, "Could not determine delimiter" - - class dialect(Dialect): - _name = "sniffed" - lineterminator = '\r\n' - quoting = QUOTE_MINIMAL - # escapechar = '' - - dialect.doublequote = doublequote - dialect.delimiter = delimiter - # _csv.reader won't accept a quotechar of '' - dialect.quotechar = quotechar or '"' - dialect.skipinitialspace = skipinitialspace - - return dialect - - - def _guess_quote_and_delimiter(self, data, delimiters): - """ - Looks for text enclosed between two identical quotes - (the probable quotechar) which are preceded and followed - by the same character (the probable delimiter). - For example: - ,'some text', - The quote with the most wins, same with the delimiter. - If there is no quotechar the delimiter can't be determined - this way. - """ - - matches = [] - for restr in ('(?P[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?P=delim)', # ,".*?", - '(?:^|\n)(?P["\']).*?(?P=quote)(?P[^\w\n"\'])(?P ?)', # ".*?", - '(?P>[^\w\n"\'])(?P ?)(?P["\']).*?(?P=quote)(?:$|\n)', # ,".*?" - '(?:^|\n)(?P["\']).*?(?P=quote)(?:$|\n)'): # ".*?" (no delim, no space) - regexp = re.compile(restr, re.DOTALL | re.MULTILINE) - matches = regexp.findall(data) - if matches: - break - - if not matches: - # (quotechar, doublequote, delimiter, skipinitialspace) - return ('', False, None, 0) - quotes = {} - delims = {} - spaces = 0 - for m in matches: - n = regexp.groupindex['quote'] - 1 - key = m[n] - if key: - quotes[key] = quotes.get(key, 0) + 1 - try: - n = regexp.groupindex['delim'] - 1 - key = m[n] - except KeyError: - continue - if key and (delimiters is None or key in delimiters): - delims[key] = delims.get(key, 0) + 1 - try: - n = regexp.groupindex['space'] - 1 - except KeyError: - continue - if m[n]: - spaces += 1 - - quotechar = reduce(lambda a, b, quotes = quotes: - (quotes[a] > quotes[b]) and a or b, quotes.keys()) - - if delims: - delim = reduce(lambda a, b, delims = delims: - (delims[a] > delims[b]) and a or b, delims.keys()) - skipinitialspace = delims[delim] == spaces - if delim == '\n': # most likely a file with a single column - delim = '' - else: - # there is *no* delimiter, it's a single column of quoted data - delim = '' - skipinitialspace = 0 - - # if we see an extra quote between delimiters, we've got a - # double quoted format - dq_regexp = re.compile( - r"((%(delim)s)|^)\W*%(quote)s[^%(delim)s\n]*%(quote)s[^%(delim)s\n]*%(quote)s\W*((%(delim)s)|$)" % \ - {'delim':re.escape(delim), 'quote':quotechar}, re.MULTILINE) - - - - if dq_regexp.search(data): - doublequote = True - else: - doublequote = False - - return (quotechar, doublequote, delim, skipinitialspace) - - - def _guess_delimiter(self, data, delimiters): - """ - The delimiter /should/ occur the same number of times on - each row. However, due to malformed data, it may not. We don't want - an all or nothing approach, so we allow for small variations in this - number. - 1) build a table of the frequency of each character on every line. - 2) build a table of frequencies of this frequency (meta-frequency?), - e.g. 'x occurred 5 times in 10 rows, 6 times in 1000 rows, - 7 times in 2 rows' - 3) use the mode of the meta-frequency to determine the /expected/ - frequency for that character - 4) find out how often the character actually meets that goal - 5) the character that best meets its goal is the delimiter - For performance reasons, the data is evaluated in chunks, so it can - try and evaluate the smallest portion of the data possible, evaluating - additional chunks as necessary. - """ - - data = filter(None, data.split('\n')) - - ascii = [chr(c) for c in range(127)] # 7-bit ASCII - - # build frequency tables - chunkLength = min(10, len(data)) - iteration = 0 - charFrequency = {} - modes = {} - delims = {} - start, end = 0, min(chunkLength, len(data)) - while start < len(data): - iteration += 1 - for line in data[start:end]: - for char in ascii: - metaFrequency = charFrequency.get(char, {}) - # must count even if frequency is 0 - freq = line.count(char) - # value is the mode - metaFrequency[freq] = metaFrequency.get(freq, 0) + 1 - charFrequency[char] = metaFrequency - - for char in charFrequency.keys(): - items = charFrequency[char].items() - if len(items) == 1 and items[0][0] == 0: - continue - # get the mode of the frequencies - if len(items) > 1: - modes[char] = reduce(lambda a, b: a[1] > b[1] and a or b, - items) - # adjust the mode - subtract the sum of all - # other frequencies - items.remove(modes[char]) - modes[char] = (modes[char][0], modes[char][1] - - reduce(lambda a, b: (0, a[1] + b[1]), - items)[1]) - else: - modes[char] = items[0] - - # build a list of possible delimiters - modeList = modes.items() - total = float(chunkLength * iteration) - # (rows of consistent data) / (number of rows) = 100% - consistency = 1.0 - # minimum consistency threshold - threshold = 0.9 - while len(delims) == 0 and consistency >= threshold: - for k, v in modeList: - if v[0] > 0 and v[1] > 0: - if ((v[1]/total) >= consistency and - (delimiters is None or k in delimiters)): - delims[k] = v - consistency -= 0.01 - - if len(delims) == 1: - delim = delims.keys()[0] - skipinitialspace = (data[0].count(delim) == - data[0].count("%c " % delim)) - return (delim, skipinitialspace) - - # analyze another chunkLength lines - start = end - end += chunkLength - - if not delims: - return ('', 0) - - # if there's more than one, fall back to a 'preferred' list - if len(delims) > 1: - for d in self.preferred: - if d in delims.keys(): - skipinitialspace = (data[0].count(d) == - data[0].count("%c " % d)) - return (d, skipinitialspace) - - # nothing else indicates a preference, pick the character that - # dominates(?) - items = [(v,k) for (k,v) in delims.items()] - items.sort() - delim = items[-1][1] - - skipinitialspace = (data[0].count(delim) == - data[0].count("%c " % delim)) - return (delim, skipinitialspace) - - - def has_header(self, sample): - # Creates a dictionary of types of data in each column. If any - # column is of a single type (say, integers), *except* for the first - # row, then the first row is presumed to be labels. If the type - # can't be determined, it is assumed to be a string in which case - # the length of the string is the determining factor: if all of the - # rows except for the first are the same length, it's a header. - # Finally, a 'vote' is taken at the end for each column, adding or - # subtracting from the likelihood of the first row being a header. - - rdr = reader(StringIO(sample), self.sniff(sample)) - - header = rdr.next() # assume first row is header - - columns = len(header) - columnTypes = {} - for i in range(columns): columnTypes[i] = None - - checked = 0 - for row in rdr: - # arbitrary number of rows to check, to keep it sane - if checked > 20: - break - checked += 1 - - if len(row) != columns: - continue # skip rows that have irregular number of columns - - for col in columnTypes.keys(): - - for thisType in [int, long, float, complex]: - try: - thisType(row[col]) - break - except (ValueError, OverflowError): - pass - else: - # fallback to length of string - thisType = len(row[col]) - - # treat longs as ints - if thisType == long: - thisType = int - - if thisType != columnTypes[col]: - if columnTypes[col] is None: # add new column type - columnTypes[col] = thisType - else: - # type is inconsistent, remove column from - # consideration - del columnTypes[col] - - # finally, compare results against first row and "vote" - # on whether it's a header - hasHeader = 0 - for col, colType in columnTypes.items(): - if type(colType) == type(0): # it's a length - if len(header[col]) != colType: - hasHeader += 1 - else: - hasHeader -= 1 - else: # attempt typecast - try: - colType(header[col]) - except (ValueError, TypeError): - hasHeader += 1 - else: - hasHeader -= 1 - - return hasHeader > 0 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py deleted file mode 100644 index cdb9c59..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/dis.py +++ /dev/null @@ -1,224 +0,0 @@ -"""Disassembler of Python byte code into mnemonics.""" - -import sys -import types - -from opcode import * -from opcode import __all__ as _opcodes_all - -__all__ = ["dis", "disassemble", "distb", "disco", - "findlinestarts", "findlabels"] + _opcodes_all -del _opcodes_all - -_have_code = (types.MethodType, types.FunctionType, types.CodeType, - types.ClassType, type) - -def dis(x=None): - """Disassemble classes, methods, functions, or code. - - With no argument, disassemble the last traceback. - - """ - if x is None: - distb() - return - if isinstance(x, types.InstanceType): - x = x.__class__ - if hasattr(x, 'im_func'): - x = x.im_func - if hasattr(x, 'func_code'): - x = x.func_code - if hasattr(x, '__dict__'): - items = x.__dict__.items() - items.sort() - for name, x1 in items: - if isinstance(x1, _have_code): - print "Disassembly of %s:" % name - try: - dis(x1) - except TypeError, msg: - print "Sorry:", msg - print - elif hasattr(x, 'co_code'): - disassemble(x) - elif isinstance(x, str): - disassemble_string(x) - else: - raise TypeError, \ - "don't know how to disassemble %s objects" % \ - type(x).__name__ - -def distb(tb=None): - """Disassemble a traceback (default: last traceback).""" - if tb is None: - try: - tb = sys.last_traceback - except AttributeError: - raise RuntimeError, "no last traceback to disassemble" - while tb.tb_next: tb = tb.tb_next - disassemble(tb.tb_frame.f_code, tb.tb_lasti) - -def disassemble(co, lasti=-1): - """Disassemble a code object.""" - code = co.co_code - labels = findlabels(code) - linestarts = dict(findlinestarts(co)) - n = len(code) - i = 0 - extended_arg = 0 - free = None - while i < n: - c = code[i] - op = ord(c) - if i in linestarts: - if i > 0: - print - print "%3d" % linestarts[i], - else: - print ' ', - - if i == lasti: print '-->', - else: print ' ', - if i in labels: print '>>', - else: print ' ', - print repr(i).rjust(4), - print opname[op].ljust(20), - i = i+1 - if op >= HAVE_ARGUMENT: - oparg = ord(code[i]) + ord(code[i+1])*256 + extended_arg - extended_arg = 0 - i = i+2 - if op == EXTENDED_ARG: - extended_arg = oparg*65536L - print repr(oparg).rjust(5), - if op in hasconst: - print '(' + repr(co.co_consts[oparg]) + ')', - elif op in hasname: - print '(' + co.co_names[oparg] + ')', - elif op in hasjrel: - print '(to ' + repr(i + oparg) + ')', - elif op in haslocal: - print '(' + co.co_varnames[oparg] + ')', - elif op in hascompare: - print '(' + cmp_op[oparg] + ')', - elif op in hasfree: - if free is None: - free = co.co_cellvars + co.co_freevars - print '(' + free[oparg] + ')', - print - -def disassemble_string(code, lasti=-1, varnames=None, names=None, - constants=None): - labels = findlabels(code) - n = len(code) - i = 0 - while i < n: - c = code[i] - op = ord(c) - if i == lasti: print '-->', - else: print ' ', - if i in labels: print '>>', - else: print ' ', - print repr(i).rjust(4), - print opname[op].ljust(15), - i = i+1 - if op >= HAVE_ARGUMENT: - oparg = ord(code[i]) + ord(code[i+1])*256 - i = i+2 - print repr(oparg).rjust(5), - if op in hasconst: - if constants: - print '(' + repr(constants[oparg]) + ')', - else: - print '(%d)'%oparg, - elif op in hasname: - if names is not None: - print '(' + names[oparg] + ')', - else: - print '(%d)'%oparg, - elif op in hasjrel: - print '(to ' + repr(i + oparg) + ')', - elif op in haslocal: - if varnames: - print '(' + varnames[oparg] + ')', - else: - print '(%d)' % oparg, - elif op in hascompare: - print '(' + cmp_op[oparg] + ')', - print - -disco = disassemble # XXX For backwards compatibility - -def findlabels(code): - """Detect all offsets in a byte code which are jump targets. - - Return the list of offsets. - - """ - labels = [] - n = len(code) - i = 0 - while i < n: - c = code[i] - op = ord(c) - i = i+1 - if op >= HAVE_ARGUMENT: - oparg = ord(code[i]) + ord(code[i+1])*256 - i = i+2 - label = -1 - if op in hasjrel: - label = i+oparg - elif op in hasjabs: - label = oparg - if label >= 0: - if label not in labels: - labels.append(label) - return labels - -def findlinestarts(code): - """Find the offsets in a byte code which are start of lines in the source. - - Generate pairs (offset, lineno) as described in Python/compile.c. - - """ - byte_increments = [ord(c) for c in code.co_lnotab[0::2]] - line_increments = [ord(c) for c in code.co_lnotab[1::2]] - - lastlineno = None - lineno = code.co_firstlineno - addr = 0 - for byte_incr, line_incr in zip(byte_increments, line_increments): - if byte_incr: - if lineno != lastlineno: - yield (addr, lineno) - lastlineno = lineno - addr += byte_incr - lineno += line_incr - if lineno != lastlineno: - yield (addr, lineno) - -def _test(): - """Simple test program to disassemble a file.""" - if sys.argv[1:]: - if sys.argv[2:]: - sys.stderr.write("usage: python dis.py [-|file]\n") - sys.exit(2) - fn = sys.argv[1] - if not fn or fn == "-": - fn = None - else: - fn = None - if fn is None: - f = sys.stdin - else: - f = open(fn) - source = f.read() - if fn is not None: - f.close() - else: - fn = "" - code = compile(source, fn, "exec") - dis(code) - -if __name__ == "__main__": - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py deleted file mode 100644 index 4b2da7d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/dummy_thread.py +++ /dev/null @@ -1,145 +0,0 @@ -"""Drop-in replacement for the thread module. - -Meant to be used as a brain-dead substitute so that threaded code does -not need to be rewritten for when the thread module is not present. - -Suggested usage is:: - - try: - import thread - except ImportError: - import dummy_thread as thread - -""" -# Exports only things specified by thread documentation; -# skipping obsolete synonyms allocate(), start_new(), exit_thread(). -__all__ = ['error', 'start_new_thread', 'exit', 'get_ident', 'allocate_lock', - 'interrupt_main', 'LockType'] - -import traceback as _traceback - -class error(Exception): - """Dummy implementation of thread.error.""" - - def __init__(self, *args): - self.args = args - -def start_new_thread(function, args, kwargs={}): - """Dummy implementation of thread.start_new_thread(). - - Compatibility is maintained by making sure that ``args`` is a - tuple and ``kwargs`` is a dictionary. If an exception is raised - and it is SystemExit (which can be done by thread.exit()) it is - caught and nothing is done; all other exceptions are printed out - by using traceback.print_exc(). - - If the executed function calls interrupt_main the KeyboardInterrupt will be - raised when the function returns. - - """ - if type(args) != type(tuple()): - raise TypeError("2nd arg must be a tuple") - if type(kwargs) != type(dict()): - raise TypeError("3rd arg must be a dict") - global _main - _main = False - try: - function(*args, **kwargs) - except SystemExit: - pass - except: - _traceback.print_exc() - _main = True - global _interrupt - if _interrupt: - _interrupt = False - raise KeyboardInterrupt - -def exit(): - """Dummy implementation of thread.exit().""" - raise SystemExit - -def get_ident(): - """Dummy implementation of thread.get_ident(). - - Since this module should only be used when threadmodule is not - available, it is safe to assume that the current process is the - only thread. Thus a constant can be safely returned. - """ - return -1 - -def allocate_lock(): - """Dummy implementation of thread.allocate_lock().""" - return LockType() - -def stack_size(size=None): - """Dummy implementation of thread.stack_size().""" - if size is not None: - raise error("setting thread stack size not supported") - return 0 - -class LockType(object): - """Class implementing dummy implementation of thread.LockType. - - Compatibility is maintained by maintaining self.locked_status - which is a boolean that stores the state of the lock. Pickling of - the lock, though, should not be done since if the thread module is - then used with an unpickled ``lock()`` from here problems could - occur from this class not having atomic methods. - - """ - - def __init__(self): - self.locked_status = False - - def acquire(self, waitflag=None): - """Dummy implementation of acquire(). - - For blocking calls, self.locked_status is automatically set to - True and returned appropriately based on value of - ``waitflag``. If it is non-blocking, then the value is - actually checked and not set if it is already acquired. This - is all done so that threading.Condition's assert statements - aren't triggered and throw a little fit. - - """ - if waitflag is None or waitflag: - self.locked_status = True - return True - else: - if not self.locked_status: - self.locked_status = True - return True - else: - return False - - __enter__ = acquire - - def __exit__(self, typ, val, tb): - self.release() - - def release(self): - """Release the dummy lock.""" - # XXX Perhaps shouldn't actually bother to test? Could lead - # to problems for complex, threaded code. - if not self.locked_status: - raise error - self.locked_status = False - return True - - def locked(self): - return self.locked_status - -# Used to signal that interrupt_main was called in a "thread" -_interrupt = False -# True when not executing in a "thread" -_main = True - -def interrupt_main(): - """Set _interrupt flag to True to have start_new_thread raise - KeyboardInterrupt upon exiting.""" - if _main: - raise KeyboardInterrupt - else: - global _interrupt - _interrupt = True diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py deleted file mode 100644 index 40e862f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/__init__.py +++ /dev/null @@ -1,157 +0,0 @@ -""" Standard "encodings" Package - - Standard Python encoding modules are stored in this package - directory. - - Codec modules must have names corresponding to normalized encoding - names as defined in the normalize_encoding() function below, e.g. - 'utf-8' must be implemented by the module 'utf_8.py'. - - Each codec module must export the following interface: - - * getregentry() -> codecs.CodecInfo object - The getregentry() API must a CodecInfo object with encoder, decoder, - incrementalencoder, incrementaldecoder, streamwriter and streamreader - atttributes which adhere to the Python Codec Interface Standard. - - In addition, a module may optionally also define the following - APIs which are then used by the package's codec search function: - - * getaliases() -> sequence of encoding name strings to use as aliases - - Alias names returned by getaliases() must be normalized encoding - names as defined by normalize_encoding(). - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" - -import codecs -from encodings import aliases -import __builtin__ - -_cache = {} -_unknown = '--unknown--' -_import_tail = ['*'] -_norm_encoding_map = (' . ' - '0123456789 ABCDEFGHIJKLMNOPQRSTUVWXYZ ' - ' abcdefghijklmnopqrstuvwxyz ' - ' ' - ' ' - ' ') -_aliases = aliases.aliases - -class CodecRegistryError(LookupError, SystemError): - pass - -def normalize_encoding(encoding): - - """ Normalize an encoding name. - - Normalization works as follows: all non-alphanumeric - characters except the dot used for Python package names are - collapsed and replaced with a single underscore, e.g. ' -;#' - becomes '_'. Leading and trailing underscores are removed. - - Note that encoding names should be ASCII only; if they do use - non-ASCII characters, these must be Latin-1 compatible. - - """ - # Make sure we have an 8-bit string, because .translate() works - # differently for Unicode strings. - if hasattr(__builtin__, "unicode") and isinstance(encoding, unicode): - # Note that .encode('latin-1') does *not* use the codec - # registry, so this call doesn't recurse. (See unicodeobject.c - # PyUnicode_AsEncodedString() for details) - encoding = encoding.encode('latin-1') - return '_'.join(encoding.translate(_norm_encoding_map).split()) - -def search_function(encoding): - - # Cache lookup - entry = _cache.get(encoding, _unknown) - if entry is not _unknown: - return entry - - # Import the module: - # - # First try to find an alias for the normalized encoding - # name and lookup the module using the aliased name, then try to - # lookup the module using the standard import scheme, i.e. first - # try in the encodings package, then at top-level. - # - norm_encoding = normalize_encoding(encoding) - aliased_encoding = _aliases.get(norm_encoding) or \ - _aliases.get(norm_encoding.replace('.', '_')) - if aliased_encoding is not None: - modnames = [aliased_encoding, - norm_encoding] - else: - modnames = [norm_encoding] - for modname in modnames: - if not modname or '.' in modname: - continue - try: - # Import is absolute to prevent the possibly malicious import of a - # module with side-effects that is not in the 'encodings' package. - mod = __import__('encodings.' + modname, fromlist=_import_tail, - level=0) - except ImportError: - pass - else: - break - else: - mod = None - - try: - getregentry = mod.getregentry - except AttributeError: - # Not a codec module - mod = None - - if mod is None: - # Cache misses - _cache[encoding] = None - return None - - # Now ask the module for the registry entry - entry = getregentry() - if not isinstance(entry, codecs.CodecInfo): - if not 4 <= len(entry) <= 7: - raise CodecRegistryError,\ - 'module "%s" (%s) failed to register' % \ - (mod.__name__, mod.__file__) - if not hasattr(entry[0], '__call__') or \ - not hasattr(entry[1], '__call__') or \ - (entry[2] is not None and not hasattr(entry[2], '__call__')) or \ - (entry[3] is not None and not hasattr(entry[3], '__call__')) or \ - (len(entry) > 4 and entry[4] is not None and not hasattr(entry[4], '__call__')) or \ - (len(entry) > 5 and entry[5] is not None and not hasattr(entry[5], '__call__')): - raise CodecRegistryError,\ - 'incompatible codecs in module "%s" (%s)' % \ - (mod.__name__, mod.__file__) - if len(entry)<7 or entry[6] is None: - entry += (None,)*(6-len(entry)) + (mod.__name__.split(".", 1)[1],) - entry = codecs.CodecInfo(*entry) - - # Cache the codec registry entry - _cache[encoding] = entry - - # Register its aliases (without overwriting previously registered - # aliases) - try: - codecaliases = mod.getaliases() - except AttributeError: - pass - else: - for alias in codecaliases: - if alias not in _aliases: - _aliases[alias] = modname - - # Return the registry entry - return entry - -# Register the search_function in the Python codec registry -codecs.register(search_function) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py deleted file mode 100644 index ff8011b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/aliases.py +++ /dev/null @@ -1,527 +0,0 @@ -""" Encoding Aliases Support - - This module is used by the encodings package search function to - map encodings names to module names. - - Note that the search function normalizes the encoding names before - doing the lookup, so the mapping will have to map normalized - encoding names to module names. - - Contents: - - The following aliases dictionary contains mappings of all IANA - character set names for which the Python core library provides - codecs. In addition to these, a few Python specific codec - aliases have also been added. - -""" -aliases = { - - # Please keep this list sorted alphabetically by value ! - - # ascii codec - '646' : 'ascii', - 'ansi_x3.4_1968' : 'ascii', - 'ansi_x3_4_1968' : 'ascii', # some email headers use this non-standard name - 'ansi_x3.4_1986' : 'ascii', - 'cp367' : 'ascii', - 'csascii' : 'ascii', - 'ibm367' : 'ascii', - 'iso646_us' : 'ascii', - 'iso_646.irv_1991' : 'ascii', - 'iso_ir_6' : 'ascii', - 'us' : 'ascii', - 'us_ascii' : 'ascii', - - # base64_codec codec - 'base64' : 'base64_codec', - 'base_64' : 'base64_codec', - - # big5 codec - 'big5_tw' : 'big5', - 'csbig5' : 'big5', - - # big5hkscs codec - 'big5_hkscs' : 'big5hkscs', - 'hkscs' : 'big5hkscs', - - # bz2_codec codec - 'bz2' : 'bz2_codec', - - # cp037 codec - '037' : 'cp037', - 'csibm037' : 'cp037', - 'ebcdic_cp_ca' : 'cp037', - 'ebcdic_cp_nl' : 'cp037', - 'ebcdic_cp_us' : 'cp037', - 'ebcdic_cp_wt' : 'cp037', - 'ibm037' : 'cp037', - 'ibm039' : 'cp037', - - # cp1026 codec - '1026' : 'cp1026', - 'csibm1026' : 'cp1026', - 'ibm1026' : 'cp1026', - - # cp1140 codec - '1140' : 'cp1140', - 'ibm1140' : 'cp1140', - - # cp1250 codec - '1250' : 'cp1250', - 'windows_1250' : 'cp1250', - - # cp1251 codec - '1251' : 'cp1251', - 'windows_1251' : 'cp1251', - - # cp1252 codec - '1252' : 'cp1252', - 'windows_1252' : 'cp1252', - - # cp1253 codec - '1253' : 'cp1253', - 'windows_1253' : 'cp1253', - - # cp1254 codec - '1254' : 'cp1254', - 'windows_1254' : 'cp1254', - - # cp1255 codec - '1255' : 'cp1255', - 'windows_1255' : 'cp1255', - - # cp1256 codec - '1256' : 'cp1256', - 'windows_1256' : 'cp1256', - - # cp1257 codec - '1257' : 'cp1257', - 'windows_1257' : 'cp1257', - - # cp1258 codec - '1258' : 'cp1258', - 'windows_1258' : 'cp1258', - - # cp424 codec - '424' : 'cp424', - 'csibm424' : 'cp424', - 'ebcdic_cp_he' : 'cp424', - 'ibm424' : 'cp424', - - # cp437 codec - '437' : 'cp437', - 'cspc8codepage437' : 'cp437', - 'ibm437' : 'cp437', - - # cp500 codec - '500' : 'cp500', - 'csibm500' : 'cp500', - 'ebcdic_cp_be' : 'cp500', - 'ebcdic_cp_ch' : 'cp500', - 'ibm500' : 'cp500', - - # cp775 codec - '775' : 'cp775', - 'cspc775baltic' : 'cp775', - 'ibm775' : 'cp775', - - # cp850 codec - '850' : 'cp850', - 'cspc850multilingual' : 'cp850', - 'ibm850' : 'cp850', - - # cp852 codec - '852' : 'cp852', - 'cspcp852' : 'cp852', - 'ibm852' : 'cp852', - - # cp855 codec - '855' : 'cp855', - 'csibm855' : 'cp855', - 'ibm855' : 'cp855', - - # cp857 codec - '857' : 'cp857', - 'csibm857' : 'cp857', - 'ibm857' : 'cp857', - - # cp858 codec - '858' : 'cp858', - 'csibm858' : 'cp858', - 'ibm858' : 'cp858', - - # cp860 codec - '860' : 'cp860', - 'csibm860' : 'cp860', - 'ibm860' : 'cp860', - - # cp861 codec - '861' : 'cp861', - 'cp_is' : 'cp861', - 'csibm861' : 'cp861', - 'ibm861' : 'cp861', - - # cp862 codec - '862' : 'cp862', - 'cspc862latinhebrew' : 'cp862', - 'ibm862' : 'cp862', - - # cp863 codec - '863' : 'cp863', - 'csibm863' : 'cp863', - 'ibm863' : 'cp863', - - # cp864 codec - '864' : 'cp864', - 'csibm864' : 'cp864', - 'ibm864' : 'cp864', - - # cp865 codec - '865' : 'cp865', - 'csibm865' : 'cp865', - 'ibm865' : 'cp865', - - # cp866 codec - '866' : 'cp866', - 'csibm866' : 'cp866', - 'ibm866' : 'cp866', - - # cp869 codec - '869' : 'cp869', - 'cp_gr' : 'cp869', - 'csibm869' : 'cp869', - 'ibm869' : 'cp869', - - # cp932 codec - '932' : 'cp932', - 'ms932' : 'cp932', - 'mskanji' : 'cp932', - 'ms_kanji' : 'cp932', - - # cp949 codec - '949' : 'cp949', - 'ms949' : 'cp949', - 'uhc' : 'cp949', - - # cp950 codec - '950' : 'cp950', - 'ms950' : 'cp950', - - # euc_jis_2004 codec - 'jisx0213' : 'euc_jis_2004', - 'eucjis2004' : 'euc_jis_2004', - 'euc_jis2004' : 'euc_jis_2004', - - # euc_jisx0213 codec - 'eucjisx0213' : 'euc_jisx0213', - - # euc_jp codec - 'eucjp' : 'euc_jp', - 'ujis' : 'euc_jp', - 'u_jis' : 'euc_jp', - - # euc_kr codec - 'euckr' : 'euc_kr', - 'korean' : 'euc_kr', - 'ksc5601' : 'euc_kr', - 'ks_c_5601' : 'euc_kr', - 'ks_c_5601_1987' : 'euc_kr', - 'ksx1001' : 'euc_kr', - 'ks_x_1001' : 'euc_kr', - - # gb18030 codec - 'gb18030_2000' : 'gb18030', - - # gb2312 codec - 'chinese' : 'gb2312', - 'csiso58gb231280' : 'gb2312', - 'euc_cn' : 'gb2312', - 'euccn' : 'gb2312', - 'eucgb2312_cn' : 'gb2312', - 'gb2312_1980' : 'gb2312', - 'gb2312_80' : 'gb2312', - 'iso_ir_58' : 'gb2312', - - # gbk codec - '936' : 'gbk', - 'cp936' : 'gbk', - 'ms936' : 'gbk', - - # hex_codec codec - 'hex' : 'hex_codec', - - # hp_roman8 codec - 'roman8' : 'hp_roman8', - 'r8' : 'hp_roman8', - 'csHPRoman8' : 'hp_roman8', - - # hz codec - 'hzgb' : 'hz', - 'hz_gb' : 'hz', - 'hz_gb_2312' : 'hz', - - # iso2022_jp codec - 'csiso2022jp' : 'iso2022_jp', - 'iso2022jp' : 'iso2022_jp', - 'iso_2022_jp' : 'iso2022_jp', - - # iso2022_jp_1 codec - 'iso2022jp_1' : 'iso2022_jp_1', - 'iso_2022_jp_1' : 'iso2022_jp_1', - - # iso2022_jp_2 codec - 'iso2022jp_2' : 'iso2022_jp_2', - 'iso_2022_jp_2' : 'iso2022_jp_2', - - # iso2022_jp_2004 codec - 'iso_2022_jp_2004' : 'iso2022_jp_2004', - 'iso2022jp_2004' : 'iso2022_jp_2004', - - # iso2022_jp_3 codec - 'iso2022jp_3' : 'iso2022_jp_3', - 'iso_2022_jp_3' : 'iso2022_jp_3', - - # iso2022_jp_ext codec - 'iso2022jp_ext' : 'iso2022_jp_ext', - 'iso_2022_jp_ext' : 'iso2022_jp_ext', - - # iso2022_kr codec - 'csiso2022kr' : 'iso2022_kr', - 'iso2022kr' : 'iso2022_kr', - 'iso_2022_kr' : 'iso2022_kr', - - # iso8859_10 codec - 'csisolatin6' : 'iso8859_10', - 'iso_8859_10' : 'iso8859_10', - 'iso_8859_10_1992' : 'iso8859_10', - 'iso_ir_157' : 'iso8859_10', - 'l6' : 'iso8859_10', - 'latin6' : 'iso8859_10', - - # iso8859_11 codec - 'thai' : 'iso8859_11', - 'iso_8859_11' : 'iso8859_11', - 'iso_8859_11_2001' : 'iso8859_11', - - # iso8859_13 codec - 'iso_8859_13' : 'iso8859_13', - 'l7' : 'iso8859_13', - 'latin7' : 'iso8859_13', - - # iso8859_14 codec - 'iso_8859_14' : 'iso8859_14', - 'iso_8859_14_1998' : 'iso8859_14', - 'iso_celtic' : 'iso8859_14', - 'iso_ir_199' : 'iso8859_14', - 'l8' : 'iso8859_14', - 'latin8' : 'iso8859_14', - - # iso8859_15 codec - 'iso_8859_15' : 'iso8859_15', - 'l9' : 'iso8859_15', - 'latin9' : 'iso8859_15', - - # iso8859_16 codec - 'iso_8859_16' : 'iso8859_16', - 'iso_8859_16_2001' : 'iso8859_16', - 'iso_ir_226' : 'iso8859_16', - 'l10' : 'iso8859_16', - 'latin10' : 'iso8859_16', - - # iso8859_2 codec - 'csisolatin2' : 'iso8859_2', - 'iso_8859_2' : 'iso8859_2', - 'iso_8859_2_1987' : 'iso8859_2', - 'iso_ir_101' : 'iso8859_2', - 'l2' : 'iso8859_2', - 'latin2' : 'iso8859_2', - - # iso8859_3 codec - 'csisolatin3' : 'iso8859_3', - 'iso_8859_3' : 'iso8859_3', - 'iso_8859_3_1988' : 'iso8859_3', - 'iso_ir_109' : 'iso8859_3', - 'l3' : 'iso8859_3', - 'latin3' : 'iso8859_3', - - # iso8859_4 codec - 'csisolatin4' : 'iso8859_4', - 'iso_8859_4' : 'iso8859_4', - 'iso_8859_4_1988' : 'iso8859_4', - 'iso_ir_110' : 'iso8859_4', - 'l4' : 'iso8859_4', - 'latin4' : 'iso8859_4', - - # iso8859_5 codec - 'csisolatincyrillic' : 'iso8859_5', - 'cyrillic' : 'iso8859_5', - 'iso_8859_5' : 'iso8859_5', - 'iso_8859_5_1988' : 'iso8859_5', - 'iso_ir_144' : 'iso8859_5', - - # iso8859_6 codec - 'arabic' : 'iso8859_6', - 'asmo_708' : 'iso8859_6', - 'csisolatinarabic' : 'iso8859_6', - 'ecma_114' : 'iso8859_6', - 'iso_8859_6' : 'iso8859_6', - 'iso_8859_6_1987' : 'iso8859_6', - 'iso_ir_127' : 'iso8859_6', - - # iso8859_7 codec - 'csisolatingreek' : 'iso8859_7', - 'ecma_118' : 'iso8859_7', - 'elot_928' : 'iso8859_7', - 'greek' : 'iso8859_7', - 'greek8' : 'iso8859_7', - 'iso_8859_7' : 'iso8859_7', - 'iso_8859_7_1987' : 'iso8859_7', - 'iso_ir_126' : 'iso8859_7', - - # iso8859_8 codec - 'csisolatinhebrew' : 'iso8859_8', - 'hebrew' : 'iso8859_8', - 'iso_8859_8' : 'iso8859_8', - 'iso_8859_8_1988' : 'iso8859_8', - 'iso_ir_138' : 'iso8859_8', - - # iso8859_9 codec - 'csisolatin5' : 'iso8859_9', - 'iso_8859_9' : 'iso8859_9', - 'iso_8859_9_1989' : 'iso8859_9', - 'iso_ir_148' : 'iso8859_9', - 'l5' : 'iso8859_9', - 'latin5' : 'iso8859_9', - - # johab codec - 'cp1361' : 'johab', - 'ms1361' : 'johab', - - # koi8_r codec - 'cskoi8r' : 'koi8_r', - - # latin_1 codec - # - # Note that the latin_1 codec is implemented internally in C and a - # lot faster than the charmap codec iso8859_1 which uses the same - # encoding. This is why we discourage the use of the iso8859_1 - # codec and alias it to latin_1 instead. - # - '8859' : 'latin_1', - 'cp819' : 'latin_1', - 'csisolatin1' : 'latin_1', - 'ibm819' : 'latin_1', - 'iso8859' : 'latin_1', - 'iso8859_1' : 'latin_1', - 'iso_8859_1' : 'latin_1', - 'iso_8859_1_1987' : 'latin_1', - 'iso_ir_100' : 'latin_1', - 'l1' : 'latin_1', - 'latin' : 'latin_1', - 'latin1' : 'latin_1', - - # mac_cyrillic codec - 'maccyrillic' : 'mac_cyrillic', - - # mac_greek codec - 'macgreek' : 'mac_greek', - - # mac_iceland codec - 'maciceland' : 'mac_iceland', - - # mac_latin2 codec - 'maccentraleurope' : 'mac_latin2', - 'maclatin2' : 'mac_latin2', - - # mac_roman codec - 'macroman' : 'mac_roman', - - # mac_turkish codec - 'macturkish' : 'mac_turkish', - - # mbcs codec - 'dbcs' : 'mbcs', - - # ptcp154 codec - 'csptcp154' : 'ptcp154', - 'pt154' : 'ptcp154', - 'cp154' : 'ptcp154', - 'cyrillic_asian' : 'ptcp154', - - # quopri_codec codec - 'quopri' : 'quopri_codec', - 'quoted_printable' : 'quopri_codec', - 'quotedprintable' : 'quopri_codec', - - # rot_13 codec - 'rot13' : 'rot_13', - - # shift_jis codec - 'csshiftjis' : 'shift_jis', - 'shiftjis' : 'shift_jis', - 'sjis' : 'shift_jis', - 's_jis' : 'shift_jis', - - # shift_jis_2004 codec - 'shiftjis2004' : 'shift_jis_2004', - 'sjis_2004' : 'shift_jis_2004', - 's_jis_2004' : 'shift_jis_2004', - - # shift_jisx0213 codec - 'shiftjisx0213' : 'shift_jisx0213', - 'sjisx0213' : 'shift_jisx0213', - 's_jisx0213' : 'shift_jisx0213', - - # tactis codec - 'tis260' : 'tactis', - - # tis_620 codec - 'tis620' : 'tis_620', - 'tis_620_0' : 'tis_620', - 'tis_620_2529_0' : 'tis_620', - 'tis_620_2529_1' : 'tis_620', - 'iso_ir_166' : 'tis_620', - - # utf_16 codec - 'u16' : 'utf_16', - 'utf16' : 'utf_16', - - # utf_16_be codec - 'unicodebigunmarked' : 'utf_16_be', - 'utf_16be' : 'utf_16_be', - - # utf_16_le codec - 'unicodelittleunmarked' : 'utf_16_le', - 'utf_16le' : 'utf_16_le', - - # utf_32 codec - 'u32' : 'utf_32', - 'utf32' : 'utf_32', - - # utf_32_be codec - 'utf_32be' : 'utf_32_be', - - # utf_32_le codec - 'utf_32le' : 'utf_32_le', - - # utf_7 codec - 'u7' : 'utf_7', - 'utf7' : 'utf_7', - 'unicode_1_1_utf_7' : 'utf_7', - - # utf_8 codec - 'u8' : 'utf_8', - 'utf' : 'utf_8', - 'utf8' : 'utf_8', - 'utf8_ucs2' : 'utf_8', - 'utf8_ucs4' : 'utf_8', - - # uu_codec codec - 'uu' : 'uu_codec', - - # zlib_codec codec - 'zip' : 'zlib_codec', - 'zlib' : 'zlib_codec', - -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py deleted file mode 100644 index df0d66d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ascii.py +++ /dev/null @@ -1,50 +0,0 @@ -""" Python 'ascii' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - # Note: Binding these as C functions will result in the class not - # converting them to methods. This is intended. - encode = codecs.ascii_encode - decode = codecs.ascii_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.ascii_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.ascii_decode(input, self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -class StreamConverter(StreamWriter,StreamReader): - - encode = codecs.ascii_decode - decode = codecs.ascii_encode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='ascii', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py deleted file mode 100644 index 2092637..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/base64_codec.py +++ /dev/null @@ -1,79 +0,0 @@ -""" Python 'base64_codec' Codec - base64 content transfer encoding - - Unlike most of the other codecs which target Unicode, this codec - will return Python string objects for both encode and decode. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - -""" -import codecs, base64 - -### Codec APIs - -def base64_encode(input,errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = base64.encodestring(input) - return (output, len(input)) - -def base64_decode(input,errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = base64.decodestring(input) - return (output, len(input)) - -class Codec(codecs.Codec): - - def encode(self, input,errors='strict'): - return base64_encode(input,errors) - def decode(self, input,errors='strict'): - return base64_decode(input,errors) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - assert self.errors == 'strict' - return base64.encodestring(input) - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - assert self.errors == 'strict' - return base64.decodestring(input) - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='base64', - encode=base64_encode, - decode=base64_decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py deleted file mode 100644 index 1be2c29..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# big5.py: Python Unicode Codec for BIG5 -# -# Written by Hye-Shik Chang -# - -import _codecs_tw, codecs -import _multibytecodec as mbc - -codec = _codecs_tw.getcodec('big5') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='big5', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py deleted file mode 100644 index ddfcaa6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/big5hkscs.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# big5hkscs.py: Python Unicode Codec for BIG5HKSCS -# -# Written by Hye-Shik Chang -# - -import _codecs_hk, codecs -import _multibytecodec as mbc - -codec = _codecs_hk.getcodec('big5hkscs') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='big5hkscs', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py deleted file mode 100644 index 04020db..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/bz2_codec.py +++ /dev/null @@ -1,102 +0,0 @@ -""" Python 'bz2_codec' Codec - bz2 compression encoding - - Unlike most of the other codecs which target Unicode, this codec - will return Python string objects for both encode and decode. - - Adapted by Raymond Hettinger from zlib_codec.py which was written - by Marc-Andre Lemburg (mal@lemburg.com). - -""" -import codecs -import bz2 # this codec needs the optional bz2 module ! - -### Codec APIs - -def bz2_encode(input,errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = bz2.compress(input) - return (output, len(input)) - -def bz2_decode(input,errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = bz2.decompress(input) - return (output, len(input)) - -class Codec(codecs.Codec): - - def encode(self, input, errors='strict'): - return bz2_encode(input, errors) - def decode(self, input, errors='strict'): - return bz2_decode(input, errors) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors='strict'): - assert errors == 'strict' - self.errors = errors - self.compressobj = bz2.BZ2Compressor() - - def encode(self, input, final=False): - if final: - c = self.compressobj.compress(input) - return c + self.compressobj.flush() - else: - return self.compressobj.compress(input) - - def reset(self): - self.compressobj = bz2.BZ2Compressor() - -class IncrementalDecoder(codecs.IncrementalDecoder): - def __init__(self, errors='strict'): - assert errors == 'strict' - self.errors = errors - self.decompressobj = bz2.BZ2Decompressor() - - def decode(self, input, final=False): - try: - return self.decompressobj.decompress(input) - except EOFError: - return '' - - def reset(self): - self.decompressobj = bz2.BZ2Decompressor() - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name="bz2", - encode=bz2_encode, - decode=bz2_decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py deleted file mode 100644 index 9697493..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/charmap.py +++ /dev/null @@ -1,69 +0,0 @@ -""" Generic Python Character Mapping Codec. - - Use this codec directly rather than through the automatic - conversion mechanisms supplied by unicode() and .encode(). - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - # Note: Binding these as C functions will result in the class not - # converting them to methods. This is intended. - encode = codecs.charmap_encode - decode = codecs.charmap_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors='strict', mapping=None): - codecs.IncrementalEncoder.__init__(self, errors) - self.mapping = mapping - - def encode(self, input, final=False): - return codecs.charmap_encode(input, self.errors, self.mapping)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def __init__(self, errors='strict', mapping=None): - codecs.IncrementalDecoder.__init__(self, errors) - self.mapping = mapping - - def decode(self, input, final=False): - return codecs.charmap_decode(input, self.errors, self.mapping)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - - def __init__(self,stream,errors='strict',mapping=None): - codecs.StreamWriter.__init__(self,stream,errors) - self.mapping = mapping - - def encode(self,input,errors='strict'): - return Codec.encode(input,errors,self.mapping) - -class StreamReader(Codec,codecs.StreamReader): - - def __init__(self,stream,errors='strict',mapping=None): - codecs.StreamReader.__init__(self,stream,errors) - self.mapping = mapping - - def decode(self,input,errors='strict'): - return Codec.decode(input,errors,self.mapping) - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='charmap', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py deleted file mode 100644 index c617a60..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp037.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp037 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP037.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp037', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'\xa2' # 0x4A -> CENT SIGN - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'|' # 0x4F -> VERTICAL LINE - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'!' # 0x5A -> EXCLAMATION MARK - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'\xac' # 0x5F -> NOT SIGN - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) - u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) - u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) - u'\xae' # 0xAF -> REGISTERED SIGN - u'^' # 0xB0 -> CIRCUMFLEX ACCENT - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'[' # 0xBA -> LEFT SQUARE BRACKET - u']' # 0xBB -> RIGHT SQUARE BRACKET - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py deleted file mode 100644 index c649b76..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1006.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1006 generated from 'MAPPINGS/VENDORS/MISC/CP1006.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1006', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u06f0' # 0xA1 -> EXTENDED ARABIC-INDIC DIGIT ZERO - u'\u06f1' # 0xA2 -> EXTENDED ARABIC-INDIC DIGIT ONE - u'\u06f2' # 0xA3 -> EXTENDED ARABIC-INDIC DIGIT TWO - u'\u06f3' # 0xA4 -> EXTENDED ARABIC-INDIC DIGIT THREE - u'\u06f4' # 0xA5 -> EXTENDED ARABIC-INDIC DIGIT FOUR - u'\u06f5' # 0xA6 -> EXTENDED ARABIC-INDIC DIGIT FIVE - u'\u06f6' # 0xA7 -> EXTENDED ARABIC-INDIC DIGIT SIX - u'\u06f7' # 0xA8 -> EXTENDED ARABIC-INDIC DIGIT SEVEN - u'\u06f8' # 0xA9 -> EXTENDED ARABIC-INDIC DIGIT EIGHT - u'\u06f9' # 0xAA -> EXTENDED ARABIC-INDIC DIGIT NINE - u'\u060c' # 0xAB -> ARABIC COMMA - u'\u061b' # 0xAC -> ARABIC SEMICOLON - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u061f' # 0xAE -> ARABIC QUESTION MARK - u'\ufe81' # 0xAF -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM - u'\ufe8d' # 0xB0 -> ARABIC LETTER ALEF ISOLATED FORM - u'\ufe8e' # 0xB1 -> ARABIC LETTER ALEF FINAL FORM - u'\ufe8e' # 0xB2 -> ARABIC LETTER ALEF FINAL FORM - u'\ufe8f' # 0xB3 -> ARABIC LETTER BEH ISOLATED FORM - u'\ufe91' # 0xB4 -> ARABIC LETTER BEH INITIAL FORM - u'\ufb56' # 0xB5 -> ARABIC LETTER PEH ISOLATED FORM - u'\ufb58' # 0xB6 -> ARABIC LETTER PEH INITIAL FORM - u'\ufe93' # 0xB7 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM - u'\ufe95' # 0xB8 -> ARABIC LETTER TEH ISOLATED FORM - u'\ufe97' # 0xB9 -> ARABIC LETTER TEH INITIAL FORM - u'\ufb66' # 0xBA -> ARABIC LETTER TTEH ISOLATED FORM - u'\ufb68' # 0xBB -> ARABIC LETTER TTEH INITIAL FORM - u'\ufe99' # 0xBC -> ARABIC LETTER THEH ISOLATED FORM - u'\ufe9b' # 0xBD -> ARABIC LETTER THEH INITIAL FORM - u'\ufe9d' # 0xBE -> ARABIC LETTER JEEM ISOLATED FORM - u'\ufe9f' # 0xBF -> ARABIC LETTER JEEM INITIAL FORM - u'\ufb7a' # 0xC0 -> ARABIC LETTER TCHEH ISOLATED FORM - u'\ufb7c' # 0xC1 -> ARABIC LETTER TCHEH INITIAL FORM - u'\ufea1' # 0xC2 -> ARABIC LETTER HAH ISOLATED FORM - u'\ufea3' # 0xC3 -> ARABIC LETTER HAH INITIAL FORM - u'\ufea5' # 0xC4 -> ARABIC LETTER KHAH ISOLATED FORM - u'\ufea7' # 0xC5 -> ARABIC LETTER KHAH INITIAL FORM - u'\ufea9' # 0xC6 -> ARABIC LETTER DAL ISOLATED FORM - u'\ufb84' # 0xC7 -> ARABIC LETTER DAHAL ISOLATED FORMN - u'\ufeab' # 0xC8 -> ARABIC LETTER THAL ISOLATED FORM - u'\ufead' # 0xC9 -> ARABIC LETTER REH ISOLATED FORM - u'\ufb8c' # 0xCA -> ARABIC LETTER RREH ISOLATED FORM - u'\ufeaf' # 0xCB -> ARABIC LETTER ZAIN ISOLATED FORM - u'\ufb8a' # 0xCC -> ARABIC LETTER JEH ISOLATED FORM - u'\ufeb1' # 0xCD -> ARABIC LETTER SEEN ISOLATED FORM - u'\ufeb3' # 0xCE -> ARABIC LETTER SEEN INITIAL FORM - u'\ufeb5' # 0xCF -> ARABIC LETTER SHEEN ISOLATED FORM - u'\ufeb7' # 0xD0 -> ARABIC LETTER SHEEN INITIAL FORM - u'\ufeb9' # 0xD1 -> ARABIC LETTER SAD ISOLATED FORM - u'\ufebb' # 0xD2 -> ARABIC LETTER SAD INITIAL FORM - u'\ufebd' # 0xD3 -> ARABIC LETTER DAD ISOLATED FORM - u'\ufebf' # 0xD4 -> ARABIC LETTER DAD INITIAL FORM - u'\ufec1' # 0xD5 -> ARABIC LETTER TAH ISOLATED FORM - u'\ufec5' # 0xD6 -> ARABIC LETTER ZAH ISOLATED FORM - u'\ufec9' # 0xD7 -> ARABIC LETTER AIN ISOLATED FORM - u'\ufeca' # 0xD8 -> ARABIC LETTER AIN FINAL FORM - u'\ufecb' # 0xD9 -> ARABIC LETTER AIN INITIAL FORM - u'\ufecc' # 0xDA -> ARABIC LETTER AIN MEDIAL FORM - u'\ufecd' # 0xDB -> ARABIC LETTER GHAIN ISOLATED FORM - u'\ufece' # 0xDC -> ARABIC LETTER GHAIN FINAL FORM - u'\ufecf' # 0xDD -> ARABIC LETTER GHAIN INITIAL FORM - u'\ufed0' # 0xDE -> ARABIC LETTER GHAIN MEDIAL FORM - u'\ufed1' # 0xDF -> ARABIC LETTER FEH ISOLATED FORM - u'\ufed3' # 0xE0 -> ARABIC LETTER FEH INITIAL FORM - u'\ufed5' # 0xE1 -> ARABIC LETTER QAF ISOLATED FORM - u'\ufed7' # 0xE2 -> ARABIC LETTER QAF INITIAL FORM - u'\ufed9' # 0xE3 -> ARABIC LETTER KAF ISOLATED FORM - u'\ufedb' # 0xE4 -> ARABIC LETTER KAF INITIAL FORM - u'\ufb92' # 0xE5 -> ARABIC LETTER GAF ISOLATED FORM - u'\ufb94' # 0xE6 -> ARABIC LETTER GAF INITIAL FORM - u'\ufedd' # 0xE7 -> ARABIC LETTER LAM ISOLATED FORM - u'\ufedf' # 0xE8 -> ARABIC LETTER LAM INITIAL FORM - u'\ufee0' # 0xE9 -> ARABIC LETTER LAM MEDIAL FORM - u'\ufee1' # 0xEA -> ARABIC LETTER MEEM ISOLATED FORM - u'\ufee3' # 0xEB -> ARABIC LETTER MEEM INITIAL FORM - u'\ufb9e' # 0xEC -> ARABIC LETTER NOON GHUNNA ISOLATED FORM - u'\ufee5' # 0xED -> ARABIC LETTER NOON ISOLATED FORM - u'\ufee7' # 0xEE -> ARABIC LETTER NOON INITIAL FORM - u'\ufe85' # 0xEF -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM - u'\ufeed' # 0xF0 -> ARABIC LETTER WAW ISOLATED FORM - u'\ufba6' # 0xF1 -> ARABIC LETTER HEH GOAL ISOLATED FORM - u'\ufba8' # 0xF2 -> ARABIC LETTER HEH GOAL INITIAL FORM - u'\ufba9' # 0xF3 -> ARABIC LETTER HEH GOAL MEDIAL FORM - u'\ufbaa' # 0xF4 -> ARABIC LETTER HEH DOACHASHMEE ISOLATED FORM - u'\ufe80' # 0xF5 -> ARABIC LETTER HAMZA ISOLATED FORM - u'\ufe89' # 0xF6 -> ARABIC LETTER YEH WITH HAMZA ABOVE ISOLATED FORM - u'\ufe8a' # 0xF7 -> ARABIC LETTER YEH WITH HAMZA ABOVE FINAL FORM - u'\ufe8b' # 0xF8 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM - u'\ufef1' # 0xF9 -> ARABIC LETTER YEH ISOLATED FORM - u'\ufef2' # 0xFA -> ARABIC LETTER YEH FINAL FORM - u'\ufef3' # 0xFB -> ARABIC LETTER YEH INITIAL FORM - u'\ufbb0' # 0xFC -> ARABIC LETTER YEH BARREE WITH HAMZA ABOVE ISOLATED FORM - u'\ufbae' # 0xFD -> ARABIC LETTER YEH BARREE ISOLATED FORM - u'\ufe7c' # 0xFE -> ARABIC SHADDA ISOLATED FORM - u'\ufe7d' # 0xFF -> ARABIC SHADDA MEDIAL FORM -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py deleted file mode 100644 index bc2a890..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1026.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1026 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP1026.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1026', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'{' # 0x48 -> LEFT CURLY BRACKET - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'\xc7' # 0x4A -> LATIN CAPITAL LETTER C WITH CEDILLA - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'!' # 0x4F -> EXCLAMATION MARK - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'\u011e' # 0x5A -> LATIN CAPITAL LETTER G WITH BREVE - u'\u0130' # 0x5B -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'^' # 0x5F -> CIRCUMFLEX ACCENT - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'[' # 0x68 -> LEFT SQUARE BRACKET - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\u015f' # 0x6A -> LATIN SMALL LETTER S WITH CEDILLA - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u0131' # 0x79 -> LATIN SMALL LETTER DOTLESS I - u':' # 0x7A -> COLON - u'\xd6' # 0x7B -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u015e' # 0x7C -> LATIN CAPITAL LETTER S WITH CEDILLA - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'\xdc' # 0x7F -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'}' # 0x8C -> RIGHT CURLY BRACKET - u'`' # 0x8D -> GRAVE ACCENT - u'\xa6' # 0x8E -> BROKEN BAR - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'\xf6' # 0xA1 -> LATIN SMALL LETTER O WITH DIAERESIS - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u']' # 0xAC -> RIGHT SQUARE BRACKET - u'$' # 0xAD -> DOLLAR SIGN - u'@' # 0xAE -> COMMERCIAL AT - u'\xae' # 0xAF -> REGISTERED SIGN - u'\xa2' # 0xB0 -> CENT SIGN - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'\xac' # 0xBA -> NOT SIGN - u'|' # 0xBB -> VERTICAL LINE - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'\xe7' # 0xC0 -> LATIN SMALL LETTER C WITH CEDILLA - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'~' # 0xCC -> TILDE - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'\u011f' # 0xD0 -> LATIN SMALL LETTER G WITH BREVE - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\\' # 0xDC -> REVERSE SOLIDUS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xfc' # 0xE0 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'#' # 0xEC -> NUMBER SIGN - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'"' # 0xFC -> QUOTATION MARK - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py deleted file mode 100644 index 0b918c6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1140.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1140 generated from 'python-mappings/CP1140.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1140', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'\xa2' # 0x4A -> CENT SIGN - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'|' # 0x4F -> VERTICAL LINE - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'!' # 0x5A -> EXCLAMATION MARK - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'\xac' # 0x5F -> NOT SIGN - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) - u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\u20ac' # 0x9F -> EURO SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) - u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) - u'\xae' # 0xAF -> REGISTERED SIGN - u'^' # 0xB0 -> CIRCUMFLEX ACCENT - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'[' # 0xBA -> LEFT SQUARE BRACKET - u']' # 0xBB -> RIGHT SQUARE BRACKET - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py deleted file mode 100644 index c6041e0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1250.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1250 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1250.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1250', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\ufffe' # 0x83 -> UNDEFINED - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\ufffe' # 0x88 -> UNDEFINED - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u015a' # 0x8C -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u0164' # 0x8D -> LATIN CAPITAL LETTER T WITH CARON - u'\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON - u'\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u015b' # 0x9C -> LATIN SMALL LETTER S WITH ACUTE - u'\u0165' # 0x9D -> LATIN SMALL LETTER T WITH CARON - u'\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON - u'\u017a' # 0x9F -> LATIN SMALL LETTER Z WITH ACUTE - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u02c7' # 0xA1 -> CARON - u'\u02d8' # 0xA2 -> BREVE - u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u0104' # 0xA5 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u02db' # 0xB2 -> OGONEK - u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\u0105' # 0xB9 -> LATIN SMALL LETTER A WITH OGONEK - u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u013d' # 0xBC -> LATIN CAPITAL LETTER L WITH CARON - u'\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT - u'\u013e' # 0xBE -> LATIN SMALL LETTER L WITH CARON - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON - u'\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE - u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON - u'\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA - u'\u02d9' # 0xFF -> DOT ABOVE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py deleted file mode 100644 index be9fec5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1251.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1251 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1251', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u0402' # 0x80 -> CYRILLIC CAPITAL LETTER DJE - u'\u0403' # 0x81 -> CYRILLIC CAPITAL LETTER GJE - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0453' # 0x83 -> CYRILLIC SMALL LETTER GJE - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u20ac' # 0x88 -> EURO SIGN - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0409' # 0x8A -> CYRILLIC CAPITAL LETTER LJE - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u040a' # 0x8C -> CYRILLIC CAPITAL LETTER NJE - u'\u040c' # 0x8D -> CYRILLIC CAPITAL LETTER KJE - u'\u040b' # 0x8E -> CYRILLIC CAPITAL LETTER TSHE - u'\u040f' # 0x8F -> CYRILLIC CAPITAL LETTER DZHE - u'\u0452' # 0x90 -> CYRILLIC SMALL LETTER DJE - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0459' # 0x9A -> CYRILLIC SMALL LETTER LJE - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u045a' # 0x9C -> CYRILLIC SMALL LETTER NJE - u'\u045c' # 0x9D -> CYRILLIC SMALL LETTER KJE - u'\u045b' # 0x9E -> CYRILLIC SMALL LETTER TSHE - u'\u045f' # 0x9F -> CYRILLIC SMALL LETTER DZHE - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u040e' # 0xA1 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045e' # 0xA2 -> CYRILLIC SMALL LETTER SHORT U - u'\u0408' # 0xA3 -> CYRILLIC CAPITAL LETTER JE - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u0490' # 0xA5 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0401' # 0xA8 -> CYRILLIC CAPITAL LETTER IO - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0404' # 0xAA -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u0407' # 0xAF -> CYRILLIC CAPITAL LETTER YI - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u0406' # 0xB2 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0456' # 0xB3 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0491' # 0xB4 -> CYRILLIC SMALL LETTER GHE WITH UPTURN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u0451' # 0xB8 -> CYRILLIC SMALL LETTER IO - u'\u2116' # 0xB9 -> NUMERO SIGN - u'\u0454' # 0xBA -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0458' # 0xBC -> CYRILLIC SMALL LETTER JE - u'\u0405' # 0xBD -> CYRILLIC CAPITAL LETTER DZE - u'\u0455' # 0xBE -> CYRILLIC SMALL LETTER DZE - u'\u0457' # 0xBF -> CYRILLIC SMALL LETTER YI - u'\u0410' # 0xC0 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xC1 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0xC2 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0xC3 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0xC4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xC5 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0xC6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0xC7 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0xC8 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xC9 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xCA -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xCB -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xCC -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xCD -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xCE -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xCF -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0xD0 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xD1 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xD2 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xD3 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0xD4 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0xD5 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0xD6 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0xD7 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0xD8 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0xD9 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0xDA -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0xDB -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0xDC -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0xDD -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0xDE -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0xDF -> CYRILLIC CAPITAL LETTER YA - u'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE - u'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E - u'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU - u'\u044f' # 0xFF -> CYRILLIC SMALL LETTER YA -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py deleted file mode 100644 index 005a122..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1252.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1252 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1252.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1252', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\ufffe' # 0x8D -> UNDEFINED - u'\u017d' # 0x8E -> LATIN CAPITAL LETTER Z WITH CARON - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\ufffe' # 0x9D -> UNDEFINED - u'\u017e' # 0x9E -> LATIN SMALL LETTER Z WITH CARON - u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py deleted file mode 100644 index ab3abdc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1253.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1253 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1253.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1253', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\ufffe' # 0x88 -> UNDEFINED - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x9C -> UNDEFINED - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0385' # 0xA1 -> GREEK DIALYTIKA TONOS - u'\u0386' # 0xA2 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\ufffe' # 0xAA -> UNDEFINED - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u2015' # 0xAF -> HORIZONTAL BAR - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u0384' # 0xB4 -> GREEK TONOS - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0xCC -> GREEK CAPITAL LETTER MU - u'\u039d' # 0xCD -> GREEK CAPITAL LETTER NU - u'\u039e' # 0xCE -> GREEK CAPITAL LETTER XI - u'\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO - u'\ufffe' # 0xD2 -> UNDEFINED - u'\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA - u'\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA - u'\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA - u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0xEC -> GREEK SMALL LETTER MU - u'\u03bd' # 0xED -> GREEK SMALL LETTER NU - u'\u03be' # 0xEE -> GREEK SMALL LETTER XI - u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI - u'\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO - u'\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA - u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU - u'\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI - u'\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI - u'\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI - u'\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA - u'\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\ufffe' # 0xFF -> UNDEFINED -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py deleted file mode 100644 index ac691e6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1254.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1254 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1254.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1254', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0160' # 0x8A -> LATIN CAPITAL LETTER S WITH CARON - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0161' # 0x9A -> LATIN SMALL LETTER S WITH CARON - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I - u'\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py deleted file mode 100644 index 8002347..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1255.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1255 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1255.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1255', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x9C -> UNDEFINED - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\u20aa' # 0xA4 -> NEW SHEQEL SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xd7' # 0xAA -> MULTIPLICATION SIGN - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xf7' # 0xBA -> DIVISION SIGN - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\u05b0' # 0xC0 -> HEBREW POINT SHEVA - u'\u05b1' # 0xC1 -> HEBREW POINT HATAF SEGOL - u'\u05b2' # 0xC2 -> HEBREW POINT HATAF PATAH - u'\u05b3' # 0xC3 -> HEBREW POINT HATAF QAMATS - u'\u05b4' # 0xC4 -> HEBREW POINT HIRIQ - u'\u05b5' # 0xC5 -> HEBREW POINT TSERE - u'\u05b6' # 0xC6 -> HEBREW POINT SEGOL - u'\u05b7' # 0xC7 -> HEBREW POINT PATAH - u'\u05b8' # 0xC8 -> HEBREW POINT QAMATS - u'\u05b9' # 0xC9 -> HEBREW POINT HOLAM - u'\ufffe' # 0xCA -> UNDEFINED - u'\u05bb' # 0xCB -> HEBREW POINT QUBUTS - u'\u05bc' # 0xCC -> HEBREW POINT DAGESH OR MAPIQ - u'\u05bd' # 0xCD -> HEBREW POINT METEG - u'\u05be' # 0xCE -> HEBREW PUNCTUATION MAQAF - u'\u05bf' # 0xCF -> HEBREW POINT RAFE - u'\u05c0' # 0xD0 -> HEBREW PUNCTUATION PASEQ - u'\u05c1' # 0xD1 -> HEBREW POINT SHIN DOT - u'\u05c2' # 0xD2 -> HEBREW POINT SIN DOT - u'\u05c3' # 0xD3 -> HEBREW PUNCTUATION SOF PASUQ - u'\u05f0' # 0xD4 -> HEBREW LIGATURE YIDDISH DOUBLE VAV - u'\u05f1' # 0xD5 -> HEBREW LIGATURE YIDDISH VAV YOD - u'\u05f2' # 0xD6 -> HEBREW LIGATURE YIDDISH DOUBLE YOD - u'\u05f3' # 0xD7 -> HEBREW PUNCTUATION GERESH - u'\u05f4' # 0xD8 -> HEBREW PUNCTUATION GERSHAYIM - u'\ufffe' # 0xD9 -> UNDEFINED - u'\ufffe' # 0xDA -> UNDEFINED - u'\ufffe' # 0xDB -> UNDEFINED - u'\ufffe' # 0xDC -> UNDEFINED - u'\ufffe' # 0xDD -> UNDEFINED - u'\ufffe' # 0xDE -> UNDEFINED - u'\ufffe' # 0xDF -> UNDEFINED - u'\u05d0' # 0xE0 -> HEBREW LETTER ALEF - u'\u05d1' # 0xE1 -> HEBREW LETTER BET - u'\u05d2' # 0xE2 -> HEBREW LETTER GIMEL - u'\u05d3' # 0xE3 -> HEBREW LETTER DALET - u'\u05d4' # 0xE4 -> HEBREW LETTER HE - u'\u05d5' # 0xE5 -> HEBREW LETTER VAV - u'\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0xE7 -> HEBREW LETTER HET - u'\u05d8' # 0xE8 -> HEBREW LETTER TET - u'\u05d9' # 0xE9 -> HEBREW LETTER YOD - u'\u05da' # 0xEA -> HEBREW LETTER FINAL KAF - u'\u05db' # 0xEB -> HEBREW LETTER KAF - u'\u05dc' # 0xEC -> HEBREW LETTER LAMED - u'\u05dd' # 0xED -> HEBREW LETTER FINAL MEM - u'\u05de' # 0xEE -> HEBREW LETTER MEM - u'\u05df' # 0xEF -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0xF0 -> HEBREW LETTER NUN - u'\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0xF2 -> HEBREW LETTER AYIN - u'\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0xF4 -> HEBREW LETTER PE - u'\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0xF6 -> HEBREW LETTER TSADI - u'\u05e7' # 0xF7 -> HEBREW LETTER QOF - u'\u05e8' # 0xF8 -> HEBREW LETTER RESH - u'\u05e9' # 0xF9 -> HEBREW LETTER SHIN - u'\u05ea' # 0xFA -> HEBREW LETTER TAV - u'\ufffe' # 0xFB -> UNDEFINED - u'\ufffe' # 0xFC -> UNDEFINED - u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK - u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK - u'\ufffe' # 0xFF -> UNDEFINED -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py deleted file mode 100644 index d8a67a4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1256.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1256 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1256.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1256', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\u067e' # 0x81 -> ARABIC LETTER PEH - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\u0679' # 0x8A -> ARABIC LETTER TTEH - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\u0686' # 0x8D -> ARABIC LETTER TCHEH - u'\u0698' # 0x8E -> ARABIC LETTER JEH - u'\u0688' # 0x8F -> ARABIC LETTER DDAL - u'\u06af' # 0x90 -> ARABIC LETTER GAF - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u06a9' # 0x98 -> ARABIC LETTER KEHEH - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\u0691' # 0x9A -> ARABIC LETTER RREH - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\u200c' # 0x9D -> ZERO WIDTH NON-JOINER - u'\u200d' # 0x9E -> ZERO WIDTH JOINER - u'\u06ba' # 0x9F -> ARABIC LETTER NOON GHUNNA - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u060c' # 0xA1 -> ARABIC COMMA - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u06be' # 0xAA -> ARABIC LETTER HEH DOACHASHMEE - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\u061b' # 0xBA -> ARABIC SEMICOLON - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\u061f' # 0xBF -> ARABIC QUESTION MARK - u'\u06c1' # 0xC0 -> ARABIC LETTER HEH GOAL - u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA - u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0xC7 -> ARABIC LETTER ALEF - u'\u0628' # 0xC8 -> ARABIC LETTER BEH - u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xCA -> ARABIC LETTER TEH - u'\u062b' # 0xCB -> ARABIC LETTER THEH - u'\u062c' # 0xCC -> ARABIC LETTER JEEM - u'\u062d' # 0xCD -> ARABIC LETTER HAH - u'\u062e' # 0xCE -> ARABIC LETTER KHAH - u'\u062f' # 0xCF -> ARABIC LETTER DAL - u'\u0630' # 0xD0 -> ARABIC LETTER THAL - u'\u0631' # 0xD1 -> ARABIC LETTER REH - u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN - u'\u0633' # 0xD3 -> ARABIC LETTER SEEN - u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN - u'\u0635' # 0xD5 -> ARABIC LETTER SAD - u'\u0636' # 0xD6 -> ARABIC LETTER DAD - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0637' # 0xD8 -> ARABIC LETTER TAH - u'\u0638' # 0xD9 -> ARABIC LETTER ZAH - u'\u0639' # 0xDA -> ARABIC LETTER AIN - u'\u063a' # 0xDB -> ARABIC LETTER GHAIN - u'\u0640' # 0xDC -> ARABIC TATWEEL - u'\u0641' # 0xDD -> ARABIC LETTER FEH - u'\u0642' # 0xDE -> ARABIC LETTER QAF - u'\u0643' # 0xDF -> ARABIC LETTER KAF - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\u0644' # 0xE1 -> ARABIC LETTER LAM - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0645' # 0xE3 -> ARABIC LETTER MEEM - u'\u0646' # 0xE4 -> ARABIC LETTER NOON - u'\u0647' # 0xE5 -> ARABIC LETTER HEH - u'\u0648' # 0xE6 -> ARABIC LETTER WAW - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0649' # 0xEC -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xED -> ARABIC LETTER YEH - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u064b' # 0xF0 -> ARABIC FATHATAN - u'\u064c' # 0xF1 -> ARABIC DAMMATAN - u'\u064d' # 0xF2 -> ARABIC KASRATAN - u'\u064e' # 0xF3 -> ARABIC FATHA - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u064f' # 0xF5 -> ARABIC DAMMA - u'\u0650' # 0xF6 -> ARABIC KASRA - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0651' # 0xF8 -> ARABIC SHADDA - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\u0652' # 0xFA -> ARABIC SUKUN - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK - u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK - u'\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py deleted file mode 100644 index 05917c7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1257.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1257 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1257.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1257', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\ufffe' # 0x83 -> UNDEFINED - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\ufffe' # 0x88 -> UNDEFINED - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\xa8' # 0x8D -> DIAERESIS - u'\u02c7' # 0x8E -> CARON - u'\xb8' # 0x8F -> CEDILLA - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufffe' # 0x9C -> UNDEFINED - u'\xaf' # 0x9D -> MACRON - u'\u02db' # 0x9E -> OGONEK - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\ufffe' # 0xA1 -> UNDEFINED - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\ufffe' # 0xA5 -> UNDEFINED - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xc6' # 0xAF -> LATIN CAPITAL LETTER AE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xe6' # 0xBF -> LATIN SMALL LETTER AE - u'\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON - u'\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE - u'\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK - u'\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK - u'\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON - u'\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK - u'\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE - u'\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA - u'\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA - u'\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON - u'\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK - u'\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE - u'\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE - u'\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON - u'\u02d9' # 0xFF -> DOT ABOVE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py deleted file mode 100644 index a6e8408..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp1258.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp1258 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1258.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp1258', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\u201a' # 0x82 -> SINGLE LOW-9 QUOTATION MARK - u'\u0192' # 0x83 -> LATIN SMALL LETTER F WITH HOOK - u'\u201e' # 0x84 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\u2020' # 0x86 -> DAGGER - u'\u2021' # 0x87 -> DOUBLE DAGGER - u'\u02c6' # 0x88 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u2030' # 0x89 -> PER MILLE SIGN - u'\ufffe' # 0x8A -> UNDEFINED - u'\u2039' # 0x8B -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u0152' # 0x8C -> LATIN CAPITAL LIGATURE OE - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\u02dc' # 0x98 -> SMALL TILDE - u'\u2122' # 0x99 -> TRADE MARK SIGN - u'\ufffe' # 0x9A -> UNDEFINED - u'\u203a' # 0x9B -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0153' # 0x9C -> LATIN SMALL LIGATURE OE - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\u0178' # 0x9F -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u0300' # 0xCC -> COMBINING GRAVE ACCENT - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\u0309' # 0xD2 -> COMBINING HOOK ABOVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u01a0' # 0xD5 -> LATIN CAPITAL LETTER O WITH HORN - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u01af' # 0xDD -> LATIN CAPITAL LETTER U WITH HORN - u'\u0303' # 0xDE -> COMBINING TILDE - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0301' # 0xEC -> COMBINING ACUTE ACCENT - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\u0323' # 0xF2 -> COMBINING DOT BELOW - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u01a1' # 0xF5 -> LATIN SMALL LETTER O WITH HORN - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u01b0' # 0xFD -> LATIN SMALL LETTER U WITH HORN - u'\u20ab' # 0xFE -> DONG SIGN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py deleted file mode 100644 index 343d7d7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp424.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp424 generated from 'MAPPINGS/VENDORS/MISC/CP424.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp424', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> SELECT - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> REQUIRED NEW LINE - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> GRAPHIC ESCAPE - u'\x8d' # 0x09 -> SUPERSCRIPT - u'\x8e' # 0x0A -> REPEAT - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> RESTORE/ENABLE PRESENTATION - u'\x85' # 0x15 -> NEW LINE - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> PROGRAM OPERATOR COMMUNICATION - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> UNIT BACK SPACE - u'\x8f' # 0x1B -> CUSTOMER USE ONE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> DIGIT SELECT - u'\x81' # 0x21 -> START OF SIGNIFICANCE - u'\x82' # 0x22 -> FIELD SEPARATOR - u'\x83' # 0x23 -> WORD UNDERSCORE - u'\x84' # 0x24 -> BYPASS OR INHIBIT PRESENTATION - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> SET ATTRIBUTE - u'\x89' # 0x29 -> START FIELD EXTENDED - u'\x8a' # 0x2A -> SET MODE OR SWITCH - u'\x8b' # 0x2B -> CONTROL SEQUENCE PREFIX - u'\x8c' # 0x2C -> MODIFY FIELD ATTRIBUTE - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> - u'\x91' # 0x31 -> - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> INDEX RETURN - u'\x94' # 0x34 -> PRESENTATION POSITION - u'\x95' # 0x35 -> TRANSPARENT - u'\x96' # 0x36 -> NUMERIC BACKSPACE - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> SUBSCRIPT - u'\x99' # 0x39 -> INDENT TABULATION - u'\x9a' # 0x3A -> REVERSE FORM FEED - u'\x9b' # 0x3B -> CUSTOMER USE THREE - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\u05d0' # 0x41 -> HEBREW LETTER ALEF - u'\u05d1' # 0x42 -> HEBREW LETTER BET - u'\u05d2' # 0x43 -> HEBREW LETTER GIMEL - u'\u05d3' # 0x44 -> HEBREW LETTER DALET - u'\u05d4' # 0x45 -> HEBREW LETTER HE - u'\u05d5' # 0x46 -> HEBREW LETTER VAV - u'\u05d6' # 0x47 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0x48 -> HEBREW LETTER HET - u'\u05d8' # 0x49 -> HEBREW LETTER TET - u'\xa2' # 0x4A -> CENT SIGN - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'|' # 0x4F -> VERTICAL LINE - u'&' # 0x50 -> AMPERSAND - u'\u05d9' # 0x51 -> HEBREW LETTER YOD - u'\u05da' # 0x52 -> HEBREW LETTER FINAL KAF - u'\u05db' # 0x53 -> HEBREW LETTER KAF - u'\u05dc' # 0x54 -> HEBREW LETTER LAMED - u'\u05dd' # 0x55 -> HEBREW LETTER FINAL MEM - u'\u05de' # 0x56 -> HEBREW LETTER MEM - u'\u05df' # 0x57 -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0x58 -> HEBREW LETTER NUN - u'\u05e1' # 0x59 -> HEBREW LETTER SAMEKH - u'!' # 0x5A -> EXCLAMATION MARK - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'\xac' # 0x5F -> NOT SIGN - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\u05e2' # 0x62 -> HEBREW LETTER AYIN - u'\u05e3' # 0x63 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0x64 -> HEBREW LETTER PE - u'\u05e5' # 0x65 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0x66 -> HEBREW LETTER TSADI - u'\u05e7' # 0x67 -> HEBREW LETTER QOF - u'\u05e8' # 0x68 -> HEBREW LETTER RESH - u'\u05e9' # 0x69 -> HEBREW LETTER SHIN - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\ufffe' # 0x70 -> UNDEFINED - u'\u05ea' # 0x71 -> HEBREW LETTER TAV - u'\ufffe' # 0x72 -> UNDEFINED - u'\ufffe' # 0x73 -> UNDEFINED - u'\xa0' # 0x74 -> NO-BREAK SPACE - u'\ufffe' # 0x75 -> UNDEFINED - u'\ufffe' # 0x76 -> UNDEFINED - u'\ufffe' # 0x77 -> UNDEFINED - u'\u2017' # 0x78 -> DOUBLE LOW LINE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\ufffe' # 0x80 -> UNDEFINED - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\ufffe' # 0x9A -> UNDEFINED - u'\ufffe' # 0x9B -> UNDEFINED - u'\ufffe' # 0x9C -> UNDEFINED - u'\xb8' # 0x9D -> CEDILLA - u'\ufffe' # 0x9E -> UNDEFINED - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\ufffe' # 0xAA -> UNDEFINED - u'\ufffe' # 0xAB -> UNDEFINED - u'\ufffe' # 0xAC -> UNDEFINED - u'\ufffe' # 0xAD -> UNDEFINED - u'\ufffe' # 0xAE -> UNDEFINED - u'\xae' # 0xAF -> REGISTERED SIGN - u'^' # 0xB0 -> CIRCUMFLEX ACCENT - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'[' # 0xBA -> LEFT SQUARE BRACKET - u']' # 0xBB -> RIGHT SQUARE BRACKET - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\ufffe' # 0xCB -> UNDEFINED - u'\ufffe' # 0xCC -> UNDEFINED - u'\ufffe' # 0xCD -> UNDEFINED - u'\ufffe' # 0xCE -> UNDEFINED - u'\ufffe' # 0xCF -> UNDEFINED - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\ufffe' # 0xDB -> UNDEFINED - u'\ufffe' # 0xDC -> UNDEFINED - u'\ufffe' # 0xDD -> UNDEFINED - u'\ufffe' # 0xDE -> UNDEFINED - u'\ufffe' # 0xDF -> UNDEFINED - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\ufffe' # 0xEB -> UNDEFINED - u'\ufffe' # 0xEC -> UNDEFINED - u'\ufffe' # 0xED -> UNDEFINED - u'\ufffe' # 0xEE -> UNDEFINED - u'\ufffe' # 0xEF -> UNDEFINED - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\ufffe' # 0xFB -> UNDEFINED - u'\ufffe' # 0xFC -> UNDEFINED - u'\ufffe' # 0xFD -> UNDEFINED - u'\ufffe' # 0xFE -> UNDEFINED - u'\x9f' # 0xFF -> EIGHT ONES -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py deleted file mode 100644 index 800ae50..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp437.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec cp437 generated from 'VENDORS/MICSFT/PC/CP437.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp437', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00a2, # CENT SIGN - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00a5, # YEN SIGN - 0x009e: 0x20a7, # PESETA SIGN - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x2310, # REVERSED NOT SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00e3: 0x03c0, # GREEK SMALL LETTER PI - 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU - 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00ec: 0x221e, # INFINITY - 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00ef: 0x2229, # INTERSECTION - 0x00f0: 0x2261, # IDENTICAL TO - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x2320, # TOP HALF INTEGRAL - 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xa5' # 0x009d -> YEN SIGN - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a2: 0x009b, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a5: 0x009d, # YEN SIGN - 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA - 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA - 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA - 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI - 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA - 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA - 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON - 0x03c0: 0x00e3, # GREEK SMALL LETTER PI - 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU - 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x20a7: 0x009e, # PESETA SIGN - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x221e: 0x00ec, # INFINITY - 0x2229: 0x00ef, # INTERSECTION - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2261: 0x00f0, # IDENTICAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2310: 0x00a9, # REVERSED NOT SIGN - 0x2320: 0x00f4, # TOP HALF INTEGRAL - 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py deleted file mode 100644 index 5f60957..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp500.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp500 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP500.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp500', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\xa0' # 0x41 -> NO-BREAK SPACE - u'\xe2' # 0x42 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x43 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x44 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0x45 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe3' # 0x46 -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x47 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x48 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xf1' # 0x49 -> LATIN SMALL LETTER N WITH TILDE - u'[' # 0x4A -> LEFT SQUARE BRACKET - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'!' # 0x4F -> EXCLAMATION MARK - u'&' # 0x50 -> AMPERSAND - u'\xe9' # 0x51 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0x52 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x53 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x54 -> LATIN SMALL LETTER E WITH GRAVE - u'\xed' # 0x55 -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0x56 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x57 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xec' # 0x58 -> LATIN SMALL LETTER I WITH GRAVE - u'\xdf' # 0x59 -> LATIN SMALL LETTER SHARP S (GERMAN) - u']' # 0x5A -> RIGHT SQUARE BRACKET - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'^' # 0x5F -> CIRCUMFLEX ACCENT - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\xc2' # 0x62 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc4' # 0x63 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc0' # 0x64 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0x65 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc3' # 0x66 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc5' # 0x67 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x68 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xd1' # 0x69 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xa6' # 0x6A -> BROKEN BAR - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xf8' # 0x70 -> LATIN SMALL LETTER O WITH STROKE - u'\xc9' # 0x71 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0x72 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x73 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x74 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0x75 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x76 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x77 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0x78 -> LATIN CAPITAL LETTER I WITH GRAVE - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\xd8' # 0x80 -> LATIN CAPITAL LETTER O WITH STROKE - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\xab' # 0x8A -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x8B -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xf0' # 0x8C -> LATIN SMALL LETTER ETH (ICELANDIC) - u'\xfd' # 0x8D -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0x8E -> LATIN SMALL LETTER THORN (ICELANDIC) - u'\xb1' # 0x8F -> PLUS-MINUS SIGN - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\xaa' # 0x9A -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x9B -> MASCULINE ORDINAL INDICATOR - u'\xe6' # 0x9C -> LATIN SMALL LIGATURE AE - u'\xb8' # 0x9D -> CEDILLA - u'\xc6' # 0x9E -> LATIN CAPITAL LIGATURE AE - u'\xa4' # 0x9F -> CURRENCY SIGN - u'\xb5' # 0xA0 -> MICRO SIGN - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\xa1' # 0xAA -> INVERTED EXCLAMATION MARK - u'\xbf' # 0xAB -> INVERTED QUESTION MARK - u'\xd0' # 0xAC -> LATIN CAPITAL LETTER ETH (ICELANDIC) - u'\xdd' # 0xAD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xAE -> LATIN CAPITAL LETTER THORN (ICELANDIC) - u'\xae' # 0xAF -> REGISTERED SIGN - u'\xa2' # 0xB0 -> CENT SIGN - u'\xa3' # 0xB1 -> POUND SIGN - u'\xa5' # 0xB2 -> YEN SIGN - u'\xb7' # 0xB3 -> MIDDLE DOT - u'\xa9' # 0xB4 -> COPYRIGHT SIGN - u'\xa7' # 0xB5 -> SECTION SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xbc' # 0xB7 -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xB8 -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xB9 -> VULGAR FRACTION THREE QUARTERS - u'\xac' # 0xBA -> NOT SIGN - u'|' # 0xBB -> VERTICAL LINE - u'\xaf' # 0xBC -> MACRON - u'\xa8' # 0xBD -> DIAERESIS - u'\xb4' # 0xBE -> ACUTE ACCENT - u'\xd7' # 0xBF -> MULTIPLICATION SIGN - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\xf4' # 0xCB -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0xCC -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0xCD -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xCE -> LATIN SMALL LETTER O WITH ACUTE - u'\xf5' # 0xCF -> LATIN SMALL LETTER O WITH TILDE - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb9' # 0xDA -> SUPERSCRIPT ONE - u'\xfb' # 0xDB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xDC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xf9' # 0xDD -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xDE -> LATIN SMALL LETTER U WITH ACUTE - u'\xff' # 0xDF -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\xf7' # 0xE1 -> DIVISION SIGN - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xd4' # 0xEB -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd6' # 0xEC -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd2' # 0xED -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd5' # 0xEF -> LATIN CAPITAL LETTER O WITH TILDE - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xdb' # 0xFB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xFC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xd9' # 0xFD -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xFE -> LATIN CAPITAL LETTER U WITH ACUTE - u'\x9f' # 0xFF -> CONTROL -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py deleted file mode 100644 index e8e0ae1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp720.py +++ /dev/null @@ -1,309 +0,0 @@ -"""Python Character Mapping Codec cp720 generated on Windows: -Vista 6.0.6002 SP2 Multiprocessor Free with the command: - python Tools/unicode/genwincodec.py 720 -"""#" - - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp720', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\x80' - u'\x81' - u'\xe9' # 0x82 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x83 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\x84' - u'\xe0' # 0x85 -> LATIN SMALL LETTER A WITH GRAVE - u'\x86' - u'\xe7' # 0x87 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x88 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x89 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x8A -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x8B -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x8C -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\x8d' - u'\x8e' - u'\x8f' - u'\x90' - u'\u0651' # 0x91 -> ARABIC SHADDA - u'\u0652' # 0x92 -> ARABIC SUKUN - u'\xf4' # 0x93 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xa4' # 0x94 -> CURRENCY SIGN - u'\u0640' # 0x95 -> ARABIC TATWEEL - u'\xfb' # 0x96 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x97 -> LATIN SMALL LETTER U WITH GRAVE - u'\u0621' # 0x98 -> ARABIC LETTER HAMZA - u'\u0622' # 0x99 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0x9A -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0x9B -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\xa3' # 0x9C -> POUND SIGN - u'\u0625' # 0x9D -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0x9E -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0x9F -> ARABIC LETTER ALEF - u'\u0628' # 0xA0 -> ARABIC LETTER BEH - u'\u0629' # 0xA1 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xA2 -> ARABIC LETTER TEH - u'\u062b' # 0xA3 -> ARABIC LETTER THEH - u'\u062c' # 0xA4 -> ARABIC LETTER JEEM - u'\u062d' # 0xA5 -> ARABIC LETTER HAH - u'\u062e' # 0xA6 -> ARABIC LETTER KHAH - u'\u062f' # 0xA7 -> ARABIC LETTER DAL - u'\u0630' # 0xA8 -> ARABIC LETTER THAL - u'\u0631' # 0xA9 -> ARABIC LETTER REH - u'\u0632' # 0xAA -> ARABIC LETTER ZAIN - u'\u0633' # 0xAB -> ARABIC LETTER SEEN - u'\u0634' # 0xAC -> ARABIC LETTER SHEEN - u'\u0635' # 0xAD -> ARABIC LETTER SAD - u'\xab' # 0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0xB0 -> LIGHT SHADE - u'\u2592' # 0xB1 -> MEDIUM SHADE - u'\u2593' # 0xB2 -> DARK SHADE - u'\u2502' # 0xB3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0xB5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0xB6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0xB7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0xB8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0xBA -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0xBD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0xBE -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0xC6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0xC7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0xCF -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0xD0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0xD1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0xD2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0xD3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0xD4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0xD5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0xD6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0xD7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0xD8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0xDB -> FULL BLOCK - u'\u2584' # 0xDC -> LOWER HALF BLOCK - u'\u258c' # 0xDD -> LEFT HALF BLOCK - u'\u2590' # 0xDE -> RIGHT HALF BLOCK - u'\u2580' # 0xDF -> UPPER HALF BLOCK - u'\u0636' # 0xE0 -> ARABIC LETTER DAD - u'\u0637' # 0xE1 -> ARABIC LETTER TAH - u'\u0638' # 0xE2 -> ARABIC LETTER ZAH - u'\u0639' # 0xE3 -> ARABIC LETTER AIN - u'\u063a' # 0xE4 -> ARABIC LETTER GHAIN - u'\u0641' # 0xE5 -> ARABIC LETTER FEH - u'\xb5' # 0xE6 -> MICRO SIGN - u'\u0642' # 0xE7 -> ARABIC LETTER QAF - u'\u0643' # 0xE8 -> ARABIC LETTER KAF - u'\u0644' # 0xE9 -> ARABIC LETTER LAM - u'\u0645' # 0xEA -> ARABIC LETTER MEEM - u'\u0646' # 0xEB -> ARABIC LETTER NOON - u'\u0647' # 0xEC -> ARABIC LETTER HEH - u'\u0648' # 0xED -> ARABIC LETTER WAW - u'\u0649' # 0xEE -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xEF -> ARABIC LETTER YEH - u'\u2261' # 0xF0 -> IDENTICAL TO - u'\u064b' # 0xF1 -> ARABIC FATHATAN - u'\u064c' # 0xF2 -> ARABIC DAMMATAN - u'\u064d' # 0xF3 -> ARABIC KASRATAN - u'\u064e' # 0xF4 -> ARABIC FATHA - u'\u064f' # 0xF5 -> ARABIC DAMMA - u'\u0650' # 0xF6 -> ARABIC KASRA - u'\u2248' # 0xF7 -> ALMOST EQUAL TO - u'\xb0' # 0xF8 -> DEGREE SIGN - u'\u2219' # 0xF9 -> BULLET OPERATOR - u'\xb7' # 0xFA -> MIDDLE DOT - u'\u221a' # 0xFB -> SQUARE ROOT - u'\u207f' # 0xFC -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0xFD -> SUPERSCRIPT TWO - u'\u25a0' # 0xFE -> BLACK SQUARE - u'\xa0' # 0xFF -> NO-BREAK SPACE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py deleted file mode 100644 index 2c080e5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp737.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec cp737 generated from 'VENDORS/MICSFT/PC/CP737.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp737', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x0391, # GREEK CAPITAL LETTER ALPHA - 0x0081: 0x0392, # GREEK CAPITAL LETTER BETA - 0x0082: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x0083: 0x0394, # GREEK CAPITAL LETTER DELTA - 0x0084: 0x0395, # GREEK CAPITAL LETTER EPSILON - 0x0085: 0x0396, # GREEK CAPITAL LETTER ZETA - 0x0086: 0x0397, # GREEK CAPITAL LETTER ETA - 0x0087: 0x0398, # GREEK CAPITAL LETTER THETA - 0x0088: 0x0399, # GREEK CAPITAL LETTER IOTA - 0x0089: 0x039a, # GREEK CAPITAL LETTER KAPPA - 0x008a: 0x039b, # GREEK CAPITAL LETTER LAMDA - 0x008b: 0x039c, # GREEK CAPITAL LETTER MU - 0x008c: 0x039d, # GREEK CAPITAL LETTER NU - 0x008d: 0x039e, # GREEK CAPITAL LETTER XI - 0x008e: 0x039f, # GREEK CAPITAL LETTER OMICRON - 0x008f: 0x03a0, # GREEK CAPITAL LETTER PI - 0x0090: 0x03a1, # GREEK CAPITAL LETTER RHO - 0x0091: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x0092: 0x03a4, # GREEK CAPITAL LETTER TAU - 0x0093: 0x03a5, # GREEK CAPITAL LETTER UPSILON - 0x0094: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x0095: 0x03a7, # GREEK CAPITAL LETTER CHI - 0x0096: 0x03a8, # GREEK CAPITAL LETTER PSI - 0x0097: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x0098: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x0099: 0x03b2, # GREEK SMALL LETTER BETA - 0x009a: 0x03b3, # GREEK SMALL LETTER GAMMA - 0x009b: 0x03b4, # GREEK SMALL LETTER DELTA - 0x009c: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x009d: 0x03b6, # GREEK SMALL LETTER ZETA - 0x009e: 0x03b7, # GREEK SMALL LETTER ETA - 0x009f: 0x03b8, # GREEK SMALL LETTER THETA - 0x00a0: 0x03b9, # GREEK SMALL LETTER IOTA - 0x00a1: 0x03ba, # GREEK SMALL LETTER KAPPA - 0x00a2: 0x03bb, # GREEK SMALL LETTER LAMDA - 0x00a3: 0x03bc, # GREEK SMALL LETTER MU - 0x00a4: 0x03bd, # GREEK SMALL LETTER NU - 0x00a5: 0x03be, # GREEK SMALL LETTER XI - 0x00a6: 0x03bf, # GREEK SMALL LETTER OMICRON - 0x00a7: 0x03c0, # GREEK SMALL LETTER PI - 0x00a8: 0x03c1, # GREEK SMALL LETTER RHO - 0x00a9: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00aa: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA - 0x00ab: 0x03c4, # GREEK SMALL LETTER TAU - 0x00ac: 0x03c5, # GREEK SMALL LETTER UPSILON - 0x00ad: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ae: 0x03c7, # GREEK SMALL LETTER CHI - 0x00af: 0x03c8, # GREEK SMALL LETTER PSI - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03c9, # GREEK SMALL LETTER OMEGA - 0x00e1: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS - 0x00e2: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS - 0x00e3: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS - 0x00e4: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA - 0x00e5: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS - 0x00e6: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS - 0x00e7: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS - 0x00e8: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA - 0x00e9: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS - 0x00ea: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS - 0x00eb: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS - 0x00ec: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS - 0x00ed: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS - 0x00ee: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS - 0x00ef: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS - 0x00f0: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - 0x00f5: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0391' # 0x0080 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0x0081 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0x0082 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0x0083 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0x0084 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0x0085 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0x0086 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0x0087 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0x0088 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0x0089 -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0x008a -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0x008b -> GREEK CAPITAL LETTER MU - u'\u039d' # 0x008c -> GREEK CAPITAL LETTER NU - u'\u039e' # 0x008d -> GREEK CAPITAL LETTER XI - u'\u039f' # 0x008e -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0x008f -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0x0090 -> GREEK CAPITAL LETTER RHO - u'\u03a3' # 0x0091 -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0x0092 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0x0093 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0x0094 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0x0095 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0x0096 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0x0097 -> GREEK CAPITAL LETTER OMEGA - u'\u03b1' # 0x0098 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0x0099 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0x009a -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0x009b -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0x009c -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0x009d -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0x009e -> GREEK SMALL LETTER ETA - u'\u03b8' # 0x009f -> GREEK SMALL LETTER THETA - u'\u03b9' # 0x00a0 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0x00a1 -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0x00a2 -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0x00a3 -> GREEK SMALL LETTER MU - u'\u03bd' # 0x00a4 -> GREEK SMALL LETTER NU - u'\u03be' # 0x00a5 -> GREEK SMALL LETTER XI - u'\u03bf' # 0x00a6 -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0x00a7 -> GREEK SMALL LETTER PI - u'\u03c1' # 0x00a8 -> GREEK SMALL LETTER RHO - u'\u03c3' # 0x00a9 -> GREEK SMALL LETTER SIGMA - u'\u03c2' # 0x00aa -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c4' # 0x00ab -> GREEK SMALL LETTER TAU - u'\u03c5' # 0x00ac -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0x00ad -> GREEK SMALL LETTER PHI - u'\u03c7' # 0x00ae -> GREEK SMALL LETTER CHI - u'\u03c8' # 0x00af -> GREEK SMALL LETTER PSI - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03c9' # 0x00e0 -> GREEK SMALL LETTER OMEGA - u'\u03ac' # 0x00e1 -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0x00e2 -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0x00e3 -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03ca' # 0x00e4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03af' # 0x00e5 -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03cc' # 0x00e6 -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0x00e7 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03cb' # 0x00e8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03ce' # 0x00e9 -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u0386' # 0x00ea -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\u0388' # 0x00eb -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0x00ec -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0x00ed -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u038c' # 0x00ee -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\u038e' # 0x00ef -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0x00f0 -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u03aa' # 0x00f4 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0x00f5 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00f7: 0x00f6, # DIVISION SIGN - 0x0386: 0x00ea, # GREEK CAPITAL LETTER ALPHA WITH TONOS - 0x0388: 0x00eb, # GREEK CAPITAL LETTER EPSILON WITH TONOS - 0x0389: 0x00ec, # GREEK CAPITAL LETTER ETA WITH TONOS - 0x038a: 0x00ed, # GREEK CAPITAL LETTER IOTA WITH TONOS - 0x038c: 0x00ee, # GREEK CAPITAL LETTER OMICRON WITH TONOS - 0x038e: 0x00ef, # GREEK CAPITAL LETTER UPSILON WITH TONOS - 0x038f: 0x00f0, # GREEK CAPITAL LETTER OMEGA WITH TONOS - 0x0391: 0x0080, # GREEK CAPITAL LETTER ALPHA - 0x0392: 0x0081, # GREEK CAPITAL LETTER BETA - 0x0393: 0x0082, # GREEK CAPITAL LETTER GAMMA - 0x0394: 0x0083, # GREEK CAPITAL LETTER DELTA - 0x0395: 0x0084, # GREEK CAPITAL LETTER EPSILON - 0x0396: 0x0085, # GREEK CAPITAL LETTER ZETA - 0x0397: 0x0086, # GREEK CAPITAL LETTER ETA - 0x0398: 0x0087, # GREEK CAPITAL LETTER THETA - 0x0399: 0x0088, # GREEK CAPITAL LETTER IOTA - 0x039a: 0x0089, # GREEK CAPITAL LETTER KAPPA - 0x039b: 0x008a, # GREEK CAPITAL LETTER LAMDA - 0x039c: 0x008b, # GREEK CAPITAL LETTER MU - 0x039d: 0x008c, # GREEK CAPITAL LETTER NU - 0x039e: 0x008d, # GREEK CAPITAL LETTER XI - 0x039f: 0x008e, # GREEK CAPITAL LETTER OMICRON - 0x03a0: 0x008f, # GREEK CAPITAL LETTER PI - 0x03a1: 0x0090, # GREEK CAPITAL LETTER RHO - 0x03a3: 0x0091, # GREEK CAPITAL LETTER SIGMA - 0x03a4: 0x0092, # GREEK CAPITAL LETTER TAU - 0x03a5: 0x0093, # GREEK CAPITAL LETTER UPSILON - 0x03a6: 0x0094, # GREEK CAPITAL LETTER PHI - 0x03a7: 0x0095, # GREEK CAPITAL LETTER CHI - 0x03a8: 0x0096, # GREEK CAPITAL LETTER PSI - 0x03a9: 0x0097, # GREEK CAPITAL LETTER OMEGA - 0x03aa: 0x00f4, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - 0x03ab: 0x00f5, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - 0x03ac: 0x00e1, # GREEK SMALL LETTER ALPHA WITH TONOS - 0x03ad: 0x00e2, # GREEK SMALL LETTER EPSILON WITH TONOS - 0x03ae: 0x00e3, # GREEK SMALL LETTER ETA WITH TONOS - 0x03af: 0x00e5, # GREEK SMALL LETTER IOTA WITH TONOS - 0x03b1: 0x0098, # GREEK SMALL LETTER ALPHA - 0x03b2: 0x0099, # GREEK SMALL LETTER BETA - 0x03b3: 0x009a, # GREEK SMALL LETTER GAMMA - 0x03b4: 0x009b, # GREEK SMALL LETTER DELTA - 0x03b5: 0x009c, # GREEK SMALL LETTER EPSILON - 0x03b6: 0x009d, # GREEK SMALL LETTER ZETA - 0x03b7: 0x009e, # GREEK SMALL LETTER ETA - 0x03b8: 0x009f, # GREEK SMALL LETTER THETA - 0x03b9: 0x00a0, # GREEK SMALL LETTER IOTA - 0x03ba: 0x00a1, # GREEK SMALL LETTER KAPPA - 0x03bb: 0x00a2, # GREEK SMALL LETTER LAMDA - 0x03bc: 0x00a3, # GREEK SMALL LETTER MU - 0x03bd: 0x00a4, # GREEK SMALL LETTER NU - 0x03be: 0x00a5, # GREEK SMALL LETTER XI - 0x03bf: 0x00a6, # GREEK SMALL LETTER OMICRON - 0x03c0: 0x00a7, # GREEK SMALL LETTER PI - 0x03c1: 0x00a8, # GREEK SMALL LETTER RHO - 0x03c2: 0x00aa, # GREEK SMALL LETTER FINAL SIGMA - 0x03c3: 0x00a9, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00ab, # GREEK SMALL LETTER TAU - 0x03c5: 0x00ac, # GREEK SMALL LETTER UPSILON - 0x03c6: 0x00ad, # GREEK SMALL LETTER PHI - 0x03c7: 0x00ae, # GREEK SMALL LETTER CHI - 0x03c8: 0x00af, # GREEK SMALL LETTER PSI - 0x03c9: 0x00e0, # GREEK SMALL LETTER OMEGA - 0x03ca: 0x00e4, # GREEK SMALL LETTER IOTA WITH DIALYTIKA - 0x03cb: 0x00e8, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA - 0x03cc: 0x00e6, # GREEK SMALL LETTER OMICRON WITH TONOS - 0x03cd: 0x00e7, # GREEK SMALL LETTER UPSILON WITH TONOS - 0x03ce: 0x00e9, # GREEK SMALL LETTER OMEGA WITH TONOS - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py deleted file mode 100644 index eadb989..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp775.py +++ /dev/null @@ -1,697 +0,0 @@ -""" Python Character Mapping Codec cp775 generated from 'VENDORS/MICSFT/PC/CP775.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp775', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x0101, # LATIN SMALL LETTER A WITH MACRON - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x0107, # LATIN SMALL LETTER C WITH ACUTE - 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE - 0x0089: 0x0113, # LATIN SMALL LETTER E WITH MACRON - 0x008a: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA - 0x008b: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA - 0x008c: 0x012b, # LATIN SMALL LETTER I WITH MACRON - 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x014d, # LATIN SMALL LETTER O WITH MACRON - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA - 0x0096: 0x00a2, # CENT SIGN - 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE - 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x009e: 0x00d7, # MULTIPLICATION SIGN - 0x009f: 0x00a4, # CURRENCY SIGN - 0x00a0: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON - 0x00a1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE - 0x00a4: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE - 0x00a5: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE - 0x00a6: 0x201d, # RIGHT DOUBLE QUOTATION MARK - 0x00a7: 0x00a6, # BROKEN BAR - 0x00a8: 0x00a9, # COPYRIGHT SIGN - 0x00a9: 0x00ae, # REGISTERED SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK - 0x00b6: 0x010c, # LATIN CAPITAL LETTER C WITH CARON - 0x00b7: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK - 0x00b8: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK - 0x00be: 0x0160, # LATIN CAPITAL LETTER S WITH CARON - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK - 0x00c7: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON - 0x00d0: 0x0105, # LATIN SMALL LETTER A WITH OGONEK - 0x00d1: 0x010d, # LATIN SMALL LETTER C WITH CARON - 0x00d2: 0x0119, # LATIN SMALL LETTER E WITH OGONEK - 0x00d3: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE - 0x00d4: 0x012f, # LATIN SMALL LETTER I WITH OGONEK - 0x00d5: 0x0161, # LATIN SMALL LETTER S WITH CARON - 0x00d6: 0x0173, # LATIN SMALL LETTER U WITH OGONEK - 0x00d7: 0x016b, # LATIN SMALL LETTER U WITH MACRON - 0x00d8: 0x017e, # LATIN SMALL LETTER Z WITH CARON - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) - 0x00e2: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON - 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE - 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x0144, # LATIN SMALL LETTER N WITH ACUTE - 0x00e8: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA - 0x00e9: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA - 0x00ea: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA - 0x00eb: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA - 0x00ec: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA - 0x00ed: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON - 0x00ee: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA - 0x00ef: 0x2019, # RIGHT SINGLE QUOTATION MARK - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x201c, # LEFT DOUBLE QUOTATION MARK - 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00f4: 0x00b6, # PILCROW SIGN - 0x00f5: 0x00a7, # SECTION SIGN - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x201e, # DOUBLE LOW-9 QUOTATION MARK - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x00b9, # SUPERSCRIPT ONE - 0x00fc: 0x00b3, # SUPERSCRIPT THREE - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0106' # 0x0080 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0101' # 0x0083 -> LATIN SMALL LETTER A WITH MACRON - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u0123' # 0x0085 -> LATIN SMALL LETTER G WITH CEDILLA - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\u0107' # 0x0087 -> LATIN SMALL LETTER C WITH ACUTE - u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE - u'\u0113' # 0x0089 -> LATIN SMALL LETTER E WITH MACRON - u'\u0156' # 0x008a -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\u0157' # 0x008b -> LATIN SMALL LETTER R WITH CEDILLA - u'\u012b' # 0x008c -> LATIN SMALL LETTER I WITH MACRON - u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\u014d' # 0x0093 -> LATIN SMALL LETTER O WITH MACRON - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u0122' # 0x0095 -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\xa2' # 0x0096 -> CENT SIGN - u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\xa4' # 0x009f -> CURRENCY SIGN - u'\u0100' # 0x00a0 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u012a' # 0x00a1 -> LATIN CAPITAL LETTER I WITH MACRON - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\u017b' # 0x00a3 -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017c' # 0x00a4 -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u017a' # 0x00a5 -> LATIN SMALL LETTER Z WITH ACUTE - u'\u201d' # 0x00a6 -> RIGHT DOUBLE QUOTATION MARK - u'\xa6' # 0x00a7 -> BROKEN BAR - u'\xa9' # 0x00a8 -> COPYRIGHT SIGN - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\u0141' # 0x00ad -> LATIN CAPITAL LETTER L WITH STROKE - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u0104' # 0x00b5 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u010c' # 0x00b6 -> LATIN CAPITAL LETTER C WITH CARON - u'\u0118' # 0x00b7 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0116' # 0x00b8 -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u012e' # 0x00bd -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u0160' # 0x00be -> LATIN CAPITAL LETTER S WITH CARON - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u0172' # 0x00c6 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u016a' # 0x00c7 -> LATIN CAPITAL LETTER U WITH MACRON - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u017d' # 0x00cf -> LATIN CAPITAL LETTER Z WITH CARON - u'\u0105' # 0x00d0 -> LATIN SMALL LETTER A WITH OGONEK - u'\u010d' # 0x00d1 -> LATIN SMALL LETTER C WITH CARON - u'\u0119' # 0x00d2 -> LATIN SMALL LETTER E WITH OGONEK - u'\u0117' # 0x00d3 -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\u012f' # 0x00d4 -> LATIN SMALL LETTER I WITH OGONEK - u'\u0161' # 0x00d5 -> LATIN SMALL LETTER S WITH CARON - u'\u0173' # 0x00d6 -> LATIN SMALL LETTER U WITH OGONEK - u'\u016b' # 0x00d7 -> LATIN SMALL LETTER U WITH MACRON - u'\u017e' # 0x00d8 -> LATIN SMALL LETTER Z WITH CARON - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'\u014c' # 0x00e2 -> LATIN CAPITAL LETTER O WITH MACRON - u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u0144' # 0x00e7 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0136' # 0x00e8 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u0137' # 0x00e9 -> LATIN SMALL LETTER K WITH CEDILLA - u'\u013b' # 0x00ea -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u013c' # 0x00eb -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0146' # 0x00ec -> LATIN SMALL LETTER N WITH CEDILLA - u'\u0112' # 0x00ed -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0145' # 0x00ee -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u2019' # 0x00ef -> RIGHT SINGLE QUOTATION MARK - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u201c' # 0x00f2 -> LEFT DOUBLE QUOTATION MARK - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u201e' # 0x00f7 -> DOUBLE LOW-9 QUOTATION MARK - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a2: 0x0096, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a4: 0x009f, # CURRENCY SIGN - 0x00a6: 0x00a7, # BROKEN BAR - 0x00a7: 0x00f5, # SECTION SIGN - 0x00a9: 0x00a8, # COPYRIGHT SIGN - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00ae: 0x00a9, # REGISTERED SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b3: 0x00fc, # SUPERSCRIPT THREE - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b6: 0x00f4, # PILCROW SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00b9: 0x00fb, # SUPERSCRIPT ONE - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x009e, # MULTIPLICATION SIGN - 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S (GERMAN) - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0100: 0x00a0, # LATIN CAPITAL LETTER A WITH MACRON - 0x0101: 0x0083, # LATIN SMALL LETTER A WITH MACRON - 0x0104: 0x00b5, # LATIN CAPITAL LETTER A WITH OGONEK - 0x0105: 0x00d0, # LATIN SMALL LETTER A WITH OGONEK - 0x0106: 0x0080, # LATIN CAPITAL LETTER C WITH ACUTE - 0x0107: 0x0087, # LATIN SMALL LETTER C WITH ACUTE - 0x010c: 0x00b6, # LATIN CAPITAL LETTER C WITH CARON - 0x010d: 0x00d1, # LATIN SMALL LETTER C WITH CARON - 0x0112: 0x00ed, # LATIN CAPITAL LETTER E WITH MACRON - 0x0113: 0x0089, # LATIN SMALL LETTER E WITH MACRON - 0x0116: 0x00b8, # LATIN CAPITAL LETTER E WITH DOT ABOVE - 0x0117: 0x00d3, # LATIN SMALL LETTER E WITH DOT ABOVE - 0x0118: 0x00b7, # LATIN CAPITAL LETTER E WITH OGONEK - 0x0119: 0x00d2, # LATIN SMALL LETTER E WITH OGONEK - 0x0122: 0x0095, # LATIN CAPITAL LETTER G WITH CEDILLA - 0x0123: 0x0085, # LATIN SMALL LETTER G WITH CEDILLA - 0x012a: 0x00a1, # LATIN CAPITAL LETTER I WITH MACRON - 0x012b: 0x008c, # LATIN SMALL LETTER I WITH MACRON - 0x012e: 0x00bd, # LATIN CAPITAL LETTER I WITH OGONEK - 0x012f: 0x00d4, # LATIN SMALL LETTER I WITH OGONEK - 0x0136: 0x00e8, # LATIN CAPITAL LETTER K WITH CEDILLA - 0x0137: 0x00e9, # LATIN SMALL LETTER K WITH CEDILLA - 0x013b: 0x00ea, # LATIN CAPITAL LETTER L WITH CEDILLA - 0x013c: 0x00eb, # LATIN SMALL LETTER L WITH CEDILLA - 0x0141: 0x00ad, # LATIN CAPITAL LETTER L WITH STROKE - 0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE - 0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE - 0x0144: 0x00e7, # LATIN SMALL LETTER N WITH ACUTE - 0x0145: 0x00ee, # LATIN CAPITAL LETTER N WITH CEDILLA - 0x0146: 0x00ec, # LATIN SMALL LETTER N WITH CEDILLA - 0x014c: 0x00e2, # LATIN CAPITAL LETTER O WITH MACRON - 0x014d: 0x0093, # LATIN SMALL LETTER O WITH MACRON - 0x0156: 0x008a, # LATIN CAPITAL LETTER R WITH CEDILLA - 0x0157: 0x008b, # LATIN SMALL LETTER R WITH CEDILLA - 0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE - 0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE - 0x0160: 0x00be, # LATIN CAPITAL LETTER S WITH CARON - 0x0161: 0x00d5, # LATIN SMALL LETTER S WITH CARON - 0x016a: 0x00c7, # LATIN CAPITAL LETTER U WITH MACRON - 0x016b: 0x00d7, # LATIN SMALL LETTER U WITH MACRON - 0x0172: 0x00c6, # LATIN CAPITAL LETTER U WITH OGONEK - 0x0173: 0x00d6, # LATIN SMALL LETTER U WITH OGONEK - 0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE - 0x017a: 0x00a5, # LATIN SMALL LETTER Z WITH ACUTE - 0x017b: 0x00a3, # LATIN CAPITAL LETTER Z WITH DOT ABOVE - 0x017c: 0x00a4, # LATIN SMALL LETTER Z WITH DOT ABOVE - 0x017d: 0x00cf, # LATIN CAPITAL LETTER Z WITH CARON - 0x017e: 0x00d8, # LATIN SMALL LETTER Z WITH CARON - 0x2019: 0x00ef, # RIGHT SINGLE QUOTATION MARK - 0x201c: 0x00f2, # LEFT DOUBLE QUOTATION MARK - 0x201d: 0x00a6, # RIGHT DOUBLE QUOTATION MARK - 0x201e: 0x00f7, # DOUBLE LOW-9 QUOTATION MARK - 0x2219: 0x00f9, # BULLET OPERATOR - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py deleted file mode 100644 index b110f4e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp850.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP850.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp850', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x009e: 0x00d7, # MULTIPLICATION SIGN - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x00ae, # REGISTERED SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00b8: 0x00a9, # COPYRIGHT SIGN - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x00a2, # CENT SIGN - 0x00be: 0x00a5, # YEN SIGN - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x00a4, # CURRENCY SIGN - 0x00d0: 0x00f0, # LATIN SMALL LETTER ETH - 0x00d1: 0x00d0, # LATIN CAPITAL LETTER ETH - 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00d5: 0x0131, # LATIN SMALL LETTER DOTLESS I - 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x00a6, # BROKEN BAR - 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x00fe, # LATIN SMALL LETTER THORN - 0x00e8: 0x00de, # LATIN CAPITAL LETTER THORN - 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00ee: 0x00af, # MACRON - 0x00ef: 0x00b4, # ACUTE ACCENT - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2017, # DOUBLE LOW LINE - 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00f4: 0x00b6, # PILCROW SIGN - 0x00f5: 0x00a7, # SECTION SIGN - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x00b8, # CEDILLA - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x00a8, # DIAERESIS - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x00b9, # SUPERSCRIPT ONE - 0x00fc: 0x00b3, # SUPERSCRIPT THREE - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa9' # 0x00b8 -> COPYRIGHT SIGN - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0x00bd -> CENT SIGN - u'\xa5' # 0x00be -> YEN SIGN - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE - u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\xf0' # 0x00d0 -> LATIN SMALL LETTER ETH - u'\xd0' # 0x00d1 -> LATIN CAPITAL LETTER ETH - u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\u0131' # 0x00d5 -> LATIN SMALL LETTER DOTLESS I - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\xa6' # 0x00dd -> BROKEN BAR - u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\xfe' # 0x00e7 -> LATIN SMALL LETTER THORN - u'\xde' # 0x00e8 -> LATIN CAPITAL LETTER THORN - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE - u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xaf' # 0x00ee -> MACRON - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2017' # 0x00f2 -> DOUBLE LOW LINE - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a2: 0x00bd, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a4: 0x00cf, # CURRENCY SIGN - 0x00a5: 0x00be, # YEN SIGN - 0x00a6: 0x00dd, # BROKEN BAR - 0x00a7: 0x00f5, # SECTION SIGN - 0x00a8: 0x00f9, # DIAERESIS - 0x00a9: 0x00b8, # COPYRIGHT SIGN - 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00ae: 0x00a9, # REGISTERED SIGN - 0x00af: 0x00ee, # MACRON - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b3: 0x00fc, # SUPERSCRIPT THREE - 0x00b4: 0x00ef, # ACUTE ACCENT - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b6: 0x00f4, # PILCROW SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00b8: 0x00f7, # CEDILLA - 0x00b9: 0x00fb, # SUPERSCRIPT ONE - 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c0: 0x00b7, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c3: 0x00c7, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x00d4, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x00d2, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00cc: 0x00de, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00cf: 0x00d8, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d0: 0x00d1, # LATIN CAPITAL LETTER ETH - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d2: 0x00e3, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x009e, # MULTIPLICATION SIGN - 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE - 0x00d9: 0x00eb, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00db: 0x00ea, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00de: 0x00e8, # LATIN CAPITAL LETTER THORN - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e3: 0x00c6, # LATIN SMALL LETTER A WITH TILDE - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f0: 0x00d0, # LATIN SMALL LETTER ETH - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE - 0x00fe: 0x00e7, # LATIN SMALL LETTER THORN - 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0131: 0x00d5, # LATIN SMALL LETTER DOTLESS I - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x2017: 0x00f2, # DOUBLE LOW LINE - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py deleted file mode 100644 index c004282..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp852.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP852.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp852', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE - 0x0086: 0x0107, # LATIN SMALL LETTER C WITH ACUTE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x0142, # LATIN SMALL LETTER L WITH STROKE - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - 0x008b: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE - 0x0092: 0x013a, # LATIN SMALL LETTER L WITH ACUTE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x013d, # LATIN CAPITAL LETTER L WITH CARON - 0x0096: 0x013e, # LATIN SMALL LETTER L WITH CARON - 0x0097: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE - 0x0098: 0x015b, # LATIN SMALL LETTER S WITH ACUTE - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x0164, # LATIN CAPITAL LETTER T WITH CARON - 0x009c: 0x0165, # LATIN SMALL LETTER T WITH CARON - 0x009d: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE - 0x009e: 0x00d7, # MULTIPLICATION SIGN - 0x009f: 0x010d, # LATIN SMALL LETTER C WITH CARON - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK - 0x00a5: 0x0105, # LATIN SMALL LETTER A WITH OGONEK - 0x00a6: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON - 0x00a7: 0x017e, # LATIN SMALL LETTER Z WITH CARON - 0x00a8: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK - 0x00a9: 0x0119, # LATIN SMALL LETTER E WITH OGONEK - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE - 0x00ac: 0x010c, # LATIN CAPITAL LETTER C WITH CARON - 0x00ad: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00b7: 0x011a, # LATIN CAPITAL LETTER E WITH CARON - 0x00b8: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE - 0x00be: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x0102, # LATIN CAPITAL LETTER A WITH BREVE - 0x00c7: 0x0103, # LATIN SMALL LETTER A WITH BREVE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x00a4, # CURRENCY SIGN - 0x00d0: 0x0111, # LATIN SMALL LETTER D WITH STROKE - 0x00d1: 0x0110, # LATIN CAPITAL LETTER D WITH STROKE - 0x00d2: 0x010e, # LATIN CAPITAL LETTER D WITH CARON - 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00d4: 0x010f, # LATIN SMALL LETTER D WITH CARON - 0x00d5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON - 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00d8: 0x011b, # LATIN SMALL LETTER E WITH CARON - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x0162, # LATIN CAPITAL LETTER T WITH CEDILLA - 0x00de: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00e3: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE - 0x00e4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE - 0x00e5: 0x0148, # LATIN SMALL LETTER N WITH CARON - 0x00e6: 0x0160, # LATIN CAPITAL LETTER S WITH CARON - 0x00e7: 0x0161, # LATIN SMALL LETTER S WITH CARON - 0x00e8: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE - 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00ea: 0x0155, # LATIN SMALL LETTER R WITH ACUTE - 0x00eb: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00ee: 0x0163, # LATIN SMALL LETTER T WITH CEDILLA - 0x00ef: 0x00b4, # ACUTE ACCENT - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x02dd, # DOUBLE ACUTE ACCENT - 0x00f2: 0x02db, # OGONEK - 0x00f3: 0x02c7, # CARON - 0x00f4: 0x02d8, # BREVE - 0x00f5: 0x00a7, # SECTION SIGN - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x00b8, # CEDILLA - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x00a8, # DIAERESIS - 0x00fa: 0x02d9, # DOT ABOVE - 0x00fb: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE - 0x00fc: 0x0158, # LATIN CAPITAL LETTER R WITH CARON - 0x00fd: 0x0159, # LATIN SMALL LETTER R WITH CARON - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u016f' # 0x0085 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\u0107' # 0x0086 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\u0142' # 0x0088 -> LATIN SMALL LETTER L WITH STROKE - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0150' # 0x008a -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\u0151' # 0x008b -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u0179' # 0x008d -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0106' # 0x008f -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0139' # 0x0091 -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u013a' # 0x0092 -> LATIN SMALL LETTER L WITH ACUTE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u013d' # 0x0095 -> LATIN CAPITAL LETTER L WITH CARON - u'\u013e' # 0x0096 -> LATIN SMALL LETTER L WITH CARON - u'\u015a' # 0x0097 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u015b' # 0x0098 -> LATIN SMALL LETTER S WITH ACUTE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0164' # 0x009b -> LATIN CAPITAL LETTER T WITH CARON - u'\u0165' # 0x009c -> LATIN SMALL LETTER T WITH CARON - u'\u0141' # 0x009d -> LATIN CAPITAL LETTER L WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\u010d' # 0x009f -> LATIN SMALL LETTER C WITH CARON - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\u0104' # 0x00a4 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0105' # 0x00a5 -> LATIN SMALL LETTER A WITH OGONEK - u'\u017d' # 0x00a6 -> LATIN CAPITAL LETTER Z WITH CARON - u'\u017e' # 0x00a7 -> LATIN SMALL LETTER Z WITH CARON - u'\u0118' # 0x00a8 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0119' # 0x00a9 -> LATIN SMALL LETTER E WITH OGONEK - u'\xac' # 0x00aa -> NOT SIGN - u'\u017a' # 0x00ab -> LATIN SMALL LETTER Z WITH ACUTE - u'\u010c' # 0x00ac -> LATIN CAPITAL LETTER C WITH CARON - u'\u015f' # 0x00ad -> LATIN SMALL LETTER S WITH CEDILLA - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u011a' # 0x00b7 -> LATIN CAPITAL LETTER E WITH CARON - u'\u015e' # 0x00b8 -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u017b' # 0x00bd -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017c' # 0x00be -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u0102' # 0x00c6 -> LATIN CAPITAL LETTER A WITH BREVE - u'\u0103' # 0x00c7 -> LATIN SMALL LETTER A WITH BREVE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\u0111' # 0x00d0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0110' # 0x00d1 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u010e' # 0x00d2 -> LATIN CAPITAL LETTER D WITH CARON - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u010f' # 0x00d4 -> LATIN SMALL LETTER D WITH CARON - u'\u0147' # 0x00d5 -> LATIN CAPITAL LETTER N WITH CARON - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u011b' # 0x00d8 -> LATIN SMALL LETTER E WITH CARON - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u0162' # 0x00dd -> LATIN CAPITAL LETTER T WITH CEDILLA - u'\u016e' # 0x00de -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0143' # 0x00e3 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0144' # 0x00e4 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0148' # 0x00e5 -> LATIN SMALL LETTER N WITH CARON - u'\u0160' # 0x00e6 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0161' # 0x00e7 -> LATIN SMALL LETTER S WITH CARON - u'\u0154' # 0x00e8 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u0155' # 0x00ea -> LATIN SMALL LETTER R WITH ACUTE - u'\u0170' # 0x00eb -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE - u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0163' # 0x00ee -> LATIN SMALL LETTER T WITH CEDILLA - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\u02dd' # 0x00f1 -> DOUBLE ACUTE ACCENT - u'\u02db' # 0x00f2 -> OGONEK - u'\u02c7' # 0x00f3 -> CARON - u'\u02d8' # 0x00f4 -> BREVE - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\u02d9' # 0x00fa -> DOT ABOVE - u'\u0171' # 0x00fb -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\u0158' # 0x00fc -> LATIN CAPITAL LETTER R WITH CARON - u'\u0159' # 0x00fd -> LATIN SMALL LETTER R WITH CARON - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a4: 0x00cf, # CURRENCY SIGN - 0x00a7: 0x00f5, # SECTION SIGN - 0x00a8: 0x00f9, # DIAERESIS - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b4: 0x00ef, # ACUTE ACCENT - 0x00b8: 0x00f7, # CEDILLA - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x009e, # MULTIPLICATION SIGN - 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE - 0x0102: 0x00c6, # LATIN CAPITAL LETTER A WITH BREVE - 0x0103: 0x00c7, # LATIN SMALL LETTER A WITH BREVE - 0x0104: 0x00a4, # LATIN CAPITAL LETTER A WITH OGONEK - 0x0105: 0x00a5, # LATIN SMALL LETTER A WITH OGONEK - 0x0106: 0x008f, # LATIN CAPITAL LETTER C WITH ACUTE - 0x0107: 0x0086, # LATIN SMALL LETTER C WITH ACUTE - 0x010c: 0x00ac, # LATIN CAPITAL LETTER C WITH CARON - 0x010d: 0x009f, # LATIN SMALL LETTER C WITH CARON - 0x010e: 0x00d2, # LATIN CAPITAL LETTER D WITH CARON - 0x010f: 0x00d4, # LATIN SMALL LETTER D WITH CARON - 0x0110: 0x00d1, # LATIN CAPITAL LETTER D WITH STROKE - 0x0111: 0x00d0, # LATIN SMALL LETTER D WITH STROKE - 0x0118: 0x00a8, # LATIN CAPITAL LETTER E WITH OGONEK - 0x0119: 0x00a9, # LATIN SMALL LETTER E WITH OGONEK - 0x011a: 0x00b7, # LATIN CAPITAL LETTER E WITH CARON - 0x011b: 0x00d8, # LATIN SMALL LETTER E WITH CARON - 0x0139: 0x0091, # LATIN CAPITAL LETTER L WITH ACUTE - 0x013a: 0x0092, # LATIN SMALL LETTER L WITH ACUTE - 0x013d: 0x0095, # LATIN CAPITAL LETTER L WITH CARON - 0x013e: 0x0096, # LATIN SMALL LETTER L WITH CARON - 0x0141: 0x009d, # LATIN CAPITAL LETTER L WITH STROKE - 0x0142: 0x0088, # LATIN SMALL LETTER L WITH STROKE - 0x0143: 0x00e3, # LATIN CAPITAL LETTER N WITH ACUTE - 0x0144: 0x00e4, # LATIN SMALL LETTER N WITH ACUTE - 0x0147: 0x00d5, # LATIN CAPITAL LETTER N WITH CARON - 0x0148: 0x00e5, # LATIN SMALL LETTER N WITH CARON - 0x0150: 0x008a, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - 0x0151: 0x008b, # LATIN SMALL LETTER O WITH DOUBLE ACUTE - 0x0154: 0x00e8, # LATIN CAPITAL LETTER R WITH ACUTE - 0x0155: 0x00ea, # LATIN SMALL LETTER R WITH ACUTE - 0x0158: 0x00fc, # LATIN CAPITAL LETTER R WITH CARON - 0x0159: 0x00fd, # LATIN SMALL LETTER R WITH CARON - 0x015a: 0x0097, # LATIN CAPITAL LETTER S WITH ACUTE - 0x015b: 0x0098, # LATIN SMALL LETTER S WITH ACUTE - 0x015e: 0x00b8, # LATIN CAPITAL LETTER S WITH CEDILLA - 0x015f: 0x00ad, # LATIN SMALL LETTER S WITH CEDILLA - 0x0160: 0x00e6, # LATIN CAPITAL LETTER S WITH CARON - 0x0161: 0x00e7, # LATIN SMALL LETTER S WITH CARON - 0x0162: 0x00dd, # LATIN CAPITAL LETTER T WITH CEDILLA - 0x0163: 0x00ee, # LATIN SMALL LETTER T WITH CEDILLA - 0x0164: 0x009b, # LATIN CAPITAL LETTER T WITH CARON - 0x0165: 0x009c, # LATIN SMALL LETTER T WITH CARON - 0x016e: 0x00de, # LATIN CAPITAL LETTER U WITH RING ABOVE - 0x016f: 0x0085, # LATIN SMALL LETTER U WITH RING ABOVE - 0x0170: 0x00eb, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - 0x0171: 0x00fb, # LATIN SMALL LETTER U WITH DOUBLE ACUTE - 0x0179: 0x008d, # LATIN CAPITAL LETTER Z WITH ACUTE - 0x017a: 0x00ab, # LATIN SMALL LETTER Z WITH ACUTE - 0x017b: 0x00bd, # LATIN CAPITAL LETTER Z WITH DOT ABOVE - 0x017c: 0x00be, # LATIN SMALL LETTER Z WITH DOT ABOVE - 0x017d: 0x00a6, # LATIN CAPITAL LETTER Z WITH CARON - 0x017e: 0x00a7, # LATIN SMALL LETTER Z WITH CARON - 0x02c7: 0x00f3, # CARON - 0x02d8: 0x00f4, # BREVE - 0x02d9: 0x00fa, # DOT ABOVE - 0x02db: 0x00f2, # OGONEK - 0x02dd: 0x00f1, # DOUBLE ACUTE ACCENT - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py deleted file mode 100644 index f72e8cc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp855.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP855.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp855', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x0452, # CYRILLIC SMALL LETTER DJE - 0x0081: 0x0402, # CYRILLIC CAPITAL LETTER DJE - 0x0082: 0x0453, # CYRILLIC SMALL LETTER GJE - 0x0083: 0x0403, # CYRILLIC CAPITAL LETTER GJE - 0x0084: 0x0451, # CYRILLIC SMALL LETTER IO - 0x0085: 0x0401, # CYRILLIC CAPITAL LETTER IO - 0x0086: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE - 0x0087: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE - 0x0088: 0x0455, # CYRILLIC SMALL LETTER DZE - 0x0089: 0x0405, # CYRILLIC CAPITAL LETTER DZE - 0x008a: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - 0x008b: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - 0x008c: 0x0457, # CYRILLIC SMALL LETTER YI - 0x008d: 0x0407, # CYRILLIC CAPITAL LETTER YI - 0x008e: 0x0458, # CYRILLIC SMALL LETTER JE - 0x008f: 0x0408, # CYRILLIC CAPITAL LETTER JE - 0x0090: 0x0459, # CYRILLIC SMALL LETTER LJE - 0x0091: 0x0409, # CYRILLIC CAPITAL LETTER LJE - 0x0092: 0x045a, # CYRILLIC SMALL LETTER NJE - 0x0093: 0x040a, # CYRILLIC CAPITAL LETTER NJE - 0x0094: 0x045b, # CYRILLIC SMALL LETTER TSHE - 0x0095: 0x040b, # CYRILLIC CAPITAL LETTER TSHE - 0x0096: 0x045c, # CYRILLIC SMALL LETTER KJE - 0x0097: 0x040c, # CYRILLIC CAPITAL LETTER KJE - 0x0098: 0x045e, # CYRILLIC SMALL LETTER SHORT U - 0x0099: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U - 0x009a: 0x045f, # CYRILLIC SMALL LETTER DZHE - 0x009b: 0x040f, # CYRILLIC CAPITAL LETTER DZHE - 0x009c: 0x044e, # CYRILLIC SMALL LETTER YU - 0x009d: 0x042e, # CYRILLIC CAPITAL LETTER YU - 0x009e: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN - 0x009f: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A - 0x00a1: 0x0410, # CYRILLIC CAPITAL LETTER A - 0x00a2: 0x0431, # CYRILLIC SMALL LETTER BE - 0x00a3: 0x0411, # CYRILLIC CAPITAL LETTER BE - 0x00a4: 0x0446, # CYRILLIC SMALL LETTER TSE - 0x00a5: 0x0426, # CYRILLIC CAPITAL LETTER TSE - 0x00a6: 0x0434, # CYRILLIC SMALL LETTER DE - 0x00a7: 0x0414, # CYRILLIC CAPITAL LETTER DE - 0x00a8: 0x0435, # CYRILLIC SMALL LETTER IE - 0x00a9: 0x0415, # CYRILLIC CAPITAL LETTER IE - 0x00aa: 0x0444, # CYRILLIC SMALL LETTER EF - 0x00ab: 0x0424, # CYRILLIC CAPITAL LETTER EF - 0x00ac: 0x0433, # CYRILLIC SMALL LETTER GHE - 0x00ad: 0x0413, # CYRILLIC CAPITAL LETTER GHE - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x0445, # CYRILLIC SMALL LETTER HA - 0x00b6: 0x0425, # CYRILLIC CAPITAL LETTER HA - 0x00b7: 0x0438, # CYRILLIC SMALL LETTER I - 0x00b8: 0x0418, # CYRILLIC CAPITAL LETTER I - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x0439, # CYRILLIC SMALL LETTER SHORT I - 0x00be: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x043a, # CYRILLIC SMALL LETTER KA - 0x00c7: 0x041a, # CYRILLIC CAPITAL LETTER KA - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x00a4, # CURRENCY SIGN - 0x00d0: 0x043b, # CYRILLIC SMALL LETTER EL - 0x00d1: 0x041b, # CYRILLIC CAPITAL LETTER EL - 0x00d2: 0x043c, # CYRILLIC SMALL LETTER EM - 0x00d3: 0x041c, # CYRILLIC CAPITAL LETTER EM - 0x00d4: 0x043d, # CYRILLIC SMALL LETTER EN - 0x00d5: 0x041d, # CYRILLIC CAPITAL LETTER EN - 0x00d6: 0x043e, # CYRILLIC SMALL LETTER O - 0x00d7: 0x041e, # CYRILLIC CAPITAL LETTER O - 0x00d8: 0x043f, # CYRILLIC SMALL LETTER PE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x041f, # CYRILLIC CAPITAL LETTER PE - 0x00de: 0x044f, # CYRILLIC SMALL LETTER YA - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x042f, # CYRILLIC CAPITAL LETTER YA - 0x00e1: 0x0440, # CYRILLIC SMALL LETTER ER - 0x00e2: 0x0420, # CYRILLIC CAPITAL LETTER ER - 0x00e3: 0x0441, # CYRILLIC SMALL LETTER ES - 0x00e4: 0x0421, # CYRILLIC CAPITAL LETTER ES - 0x00e5: 0x0442, # CYRILLIC SMALL LETTER TE - 0x00e6: 0x0422, # CYRILLIC CAPITAL LETTER TE - 0x00e7: 0x0443, # CYRILLIC SMALL LETTER U - 0x00e8: 0x0423, # CYRILLIC CAPITAL LETTER U - 0x00e9: 0x0436, # CYRILLIC SMALL LETTER ZHE - 0x00ea: 0x0416, # CYRILLIC CAPITAL LETTER ZHE - 0x00eb: 0x0432, # CYRILLIC SMALL LETTER VE - 0x00ec: 0x0412, # CYRILLIC CAPITAL LETTER VE - 0x00ed: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN - 0x00ee: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN - 0x00ef: 0x2116, # NUMERO SIGN - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x044b, # CYRILLIC SMALL LETTER YERU - 0x00f2: 0x042b, # CYRILLIC CAPITAL LETTER YERU - 0x00f3: 0x0437, # CYRILLIC SMALL LETTER ZE - 0x00f4: 0x0417, # CYRILLIC CAPITAL LETTER ZE - 0x00f5: 0x0448, # CYRILLIC SMALL LETTER SHA - 0x00f6: 0x0428, # CYRILLIC CAPITAL LETTER SHA - 0x00f7: 0x044d, # CYRILLIC SMALL LETTER E - 0x00f8: 0x042d, # CYRILLIC CAPITAL LETTER E - 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA - 0x00fa: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA - 0x00fb: 0x0447, # CYRILLIC SMALL LETTER CHE - 0x00fc: 0x0427, # CYRILLIC CAPITAL LETTER CHE - 0x00fd: 0x00a7, # SECTION SIGN - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0452' # 0x0080 -> CYRILLIC SMALL LETTER DJE - u'\u0402' # 0x0081 -> CYRILLIC CAPITAL LETTER DJE - u'\u0453' # 0x0082 -> CYRILLIC SMALL LETTER GJE - u'\u0403' # 0x0083 -> CYRILLIC CAPITAL LETTER GJE - u'\u0451' # 0x0084 -> CYRILLIC SMALL LETTER IO - u'\u0401' # 0x0085 -> CYRILLIC CAPITAL LETTER IO - u'\u0454' # 0x0086 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0404' # 0x0087 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0455' # 0x0088 -> CYRILLIC SMALL LETTER DZE - u'\u0405' # 0x0089 -> CYRILLIC CAPITAL LETTER DZE - u'\u0456' # 0x008a -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0406' # 0x008b -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0457' # 0x008c -> CYRILLIC SMALL LETTER YI - u'\u0407' # 0x008d -> CYRILLIC CAPITAL LETTER YI - u'\u0458' # 0x008e -> CYRILLIC SMALL LETTER JE - u'\u0408' # 0x008f -> CYRILLIC CAPITAL LETTER JE - u'\u0459' # 0x0090 -> CYRILLIC SMALL LETTER LJE - u'\u0409' # 0x0091 -> CYRILLIC CAPITAL LETTER LJE - u'\u045a' # 0x0092 -> CYRILLIC SMALL LETTER NJE - u'\u040a' # 0x0093 -> CYRILLIC CAPITAL LETTER NJE - u'\u045b' # 0x0094 -> CYRILLIC SMALL LETTER TSHE - u'\u040b' # 0x0095 -> CYRILLIC CAPITAL LETTER TSHE - u'\u045c' # 0x0096 -> CYRILLIC SMALL LETTER KJE - u'\u040c' # 0x0097 -> CYRILLIC CAPITAL LETTER KJE - u'\u045e' # 0x0098 -> CYRILLIC SMALL LETTER SHORT U - u'\u040e' # 0x0099 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045f' # 0x009a -> CYRILLIC SMALL LETTER DZHE - u'\u040f' # 0x009b -> CYRILLIC CAPITAL LETTER DZHE - u'\u044e' # 0x009c -> CYRILLIC SMALL LETTER YU - u'\u042e' # 0x009d -> CYRILLIC CAPITAL LETTER YU - u'\u044a' # 0x009e -> CYRILLIC SMALL LETTER HARD SIGN - u'\u042a' # 0x009f -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A - u'\u0410' # 0x00a1 -> CYRILLIC CAPITAL LETTER A - u'\u0431' # 0x00a2 -> CYRILLIC SMALL LETTER BE - u'\u0411' # 0x00a3 -> CYRILLIC CAPITAL LETTER BE - u'\u0446' # 0x00a4 -> CYRILLIC SMALL LETTER TSE - u'\u0426' # 0x00a5 -> CYRILLIC CAPITAL LETTER TSE - u'\u0434' # 0x00a6 -> CYRILLIC SMALL LETTER DE - u'\u0414' # 0x00a7 -> CYRILLIC CAPITAL LETTER DE - u'\u0435' # 0x00a8 -> CYRILLIC SMALL LETTER IE - u'\u0415' # 0x00a9 -> CYRILLIC CAPITAL LETTER IE - u'\u0444' # 0x00aa -> CYRILLIC SMALL LETTER EF - u'\u0424' # 0x00ab -> CYRILLIC CAPITAL LETTER EF - u'\u0433' # 0x00ac -> CYRILLIC SMALL LETTER GHE - u'\u0413' # 0x00ad -> CYRILLIC CAPITAL LETTER GHE - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u0445' # 0x00b5 -> CYRILLIC SMALL LETTER HA - u'\u0425' # 0x00b6 -> CYRILLIC CAPITAL LETTER HA - u'\u0438' # 0x00b7 -> CYRILLIC SMALL LETTER I - u'\u0418' # 0x00b8 -> CYRILLIC CAPITAL LETTER I - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u0439' # 0x00bd -> CYRILLIC SMALL LETTER SHORT I - u'\u0419' # 0x00be -> CYRILLIC CAPITAL LETTER SHORT I - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u043a' # 0x00c6 -> CYRILLIC SMALL LETTER KA - u'\u041a' # 0x00c7 -> CYRILLIC CAPITAL LETTER KA - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\u043b' # 0x00d0 -> CYRILLIC SMALL LETTER EL - u'\u041b' # 0x00d1 -> CYRILLIC CAPITAL LETTER EL - u'\u043c' # 0x00d2 -> CYRILLIC SMALL LETTER EM - u'\u041c' # 0x00d3 -> CYRILLIC CAPITAL LETTER EM - u'\u043d' # 0x00d4 -> CYRILLIC SMALL LETTER EN - u'\u041d' # 0x00d5 -> CYRILLIC CAPITAL LETTER EN - u'\u043e' # 0x00d6 -> CYRILLIC SMALL LETTER O - u'\u041e' # 0x00d7 -> CYRILLIC CAPITAL LETTER O - u'\u043f' # 0x00d8 -> CYRILLIC SMALL LETTER PE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u041f' # 0x00dd -> CYRILLIC CAPITAL LETTER PE - u'\u044f' # 0x00de -> CYRILLIC SMALL LETTER YA - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u042f' # 0x00e0 -> CYRILLIC CAPITAL LETTER YA - u'\u0440' # 0x00e1 -> CYRILLIC SMALL LETTER ER - u'\u0420' # 0x00e2 -> CYRILLIC CAPITAL LETTER ER - u'\u0441' # 0x00e3 -> CYRILLIC SMALL LETTER ES - u'\u0421' # 0x00e4 -> CYRILLIC CAPITAL LETTER ES - u'\u0442' # 0x00e5 -> CYRILLIC SMALL LETTER TE - u'\u0422' # 0x00e6 -> CYRILLIC CAPITAL LETTER TE - u'\u0443' # 0x00e7 -> CYRILLIC SMALL LETTER U - u'\u0423' # 0x00e8 -> CYRILLIC CAPITAL LETTER U - u'\u0436' # 0x00e9 -> CYRILLIC SMALL LETTER ZHE - u'\u0416' # 0x00ea -> CYRILLIC CAPITAL LETTER ZHE - u'\u0432' # 0x00eb -> CYRILLIC SMALL LETTER VE - u'\u0412' # 0x00ec -> CYRILLIC CAPITAL LETTER VE - u'\u044c' # 0x00ed -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u042c' # 0x00ee -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u2116' # 0x00ef -> NUMERO SIGN - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\u044b' # 0x00f1 -> CYRILLIC SMALL LETTER YERU - u'\u042b' # 0x00f2 -> CYRILLIC CAPITAL LETTER YERU - u'\u0437' # 0x00f3 -> CYRILLIC SMALL LETTER ZE - u'\u0417' # 0x00f4 -> CYRILLIC CAPITAL LETTER ZE - u'\u0448' # 0x00f5 -> CYRILLIC SMALL LETTER SHA - u'\u0428' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHA - u'\u044d' # 0x00f7 -> CYRILLIC SMALL LETTER E - u'\u042d' # 0x00f8 -> CYRILLIC CAPITAL LETTER E - u'\u0449' # 0x00f9 -> CYRILLIC SMALL LETTER SHCHA - u'\u0429' # 0x00fa -> CYRILLIC CAPITAL LETTER SHCHA - u'\u0447' # 0x00fb -> CYRILLIC SMALL LETTER CHE - u'\u0427' # 0x00fc -> CYRILLIC CAPITAL LETTER CHE - u'\xa7' # 0x00fd -> SECTION SIGN - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a4: 0x00cf, # CURRENCY SIGN - 0x00a7: 0x00fd, # SECTION SIGN - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x0401: 0x0085, # CYRILLIC CAPITAL LETTER IO - 0x0402: 0x0081, # CYRILLIC CAPITAL LETTER DJE - 0x0403: 0x0083, # CYRILLIC CAPITAL LETTER GJE - 0x0404: 0x0087, # CYRILLIC CAPITAL LETTER UKRAINIAN IE - 0x0405: 0x0089, # CYRILLIC CAPITAL LETTER DZE - 0x0406: 0x008b, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - 0x0407: 0x008d, # CYRILLIC CAPITAL LETTER YI - 0x0408: 0x008f, # CYRILLIC CAPITAL LETTER JE - 0x0409: 0x0091, # CYRILLIC CAPITAL LETTER LJE - 0x040a: 0x0093, # CYRILLIC CAPITAL LETTER NJE - 0x040b: 0x0095, # CYRILLIC CAPITAL LETTER TSHE - 0x040c: 0x0097, # CYRILLIC CAPITAL LETTER KJE - 0x040e: 0x0099, # CYRILLIC CAPITAL LETTER SHORT U - 0x040f: 0x009b, # CYRILLIC CAPITAL LETTER DZHE - 0x0410: 0x00a1, # CYRILLIC CAPITAL LETTER A - 0x0411: 0x00a3, # CYRILLIC CAPITAL LETTER BE - 0x0412: 0x00ec, # CYRILLIC CAPITAL LETTER VE - 0x0413: 0x00ad, # CYRILLIC CAPITAL LETTER GHE - 0x0414: 0x00a7, # CYRILLIC CAPITAL LETTER DE - 0x0415: 0x00a9, # CYRILLIC CAPITAL LETTER IE - 0x0416: 0x00ea, # CYRILLIC CAPITAL LETTER ZHE - 0x0417: 0x00f4, # CYRILLIC CAPITAL LETTER ZE - 0x0418: 0x00b8, # CYRILLIC CAPITAL LETTER I - 0x0419: 0x00be, # CYRILLIC CAPITAL LETTER SHORT I - 0x041a: 0x00c7, # CYRILLIC CAPITAL LETTER KA - 0x041b: 0x00d1, # CYRILLIC CAPITAL LETTER EL - 0x041c: 0x00d3, # CYRILLIC CAPITAL LETTER EM - 0x041d: 0x00d5, # CYRILLIC CAPITAL LETTER EN - 0x041e: 0x00d7, # CYRILLIC CAPITAL LETTER O - 0x041f: 0x00dd, # CYRILLIC CAPITAL LETTER PE - 0x0420: 0x00e2, # CYRILLIC CAPITAL LETTER ER - 0x0421: 0x00e4, # CYRILLIC CAPITAL LETTER ES - 0x0422: 0x00e6, # CYRILLIC CAPITAL LETTER TE - 0x0423: 0x00e8, # CYRILLIC CAPITAL LETTER U - 0x0424: 0x00ab, # CYRILLIC CAPITAL LETTER EF - 0x0425: 0x00b6, # CYRILLIC CAPITAL LETTER HA - 0x0426: 0x00a5, # CYRILLIC CAPITAL LETTER TSE - 0x0427: 0x00fc, # CYRILLIC CAPITAL LETTER CHE - 0x0428: 0x00f6, # CYRILLIC CAPITAL LETTER SHA - 0x0429: 0x00fa, # CYRILLIC CAPITAL LETTER SHCHA - 0x042a: 0x009f, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x042b: 0x00f2, # CYRILLIC CAPITAL LETTER YERU - 0x042c: 0x00ee, # CYRILLIC CAPITAL LETTER SOFT SIGN - 0x042d: 0x00f8, # CYRILLIC CAPITAL LETTER E - 0x042e: 0x009d, # CYRILLIC CAPITAL LETTER YU - 0x042f: 0x00e0, # CYRILLIC CAPITAL LETTER YA - 0x0430: 0x00a0, # CYRILLIC SMALL LETTER A - 0x0431: 0x00a2, # CYRILLIC SMALL LETTER BE - 0x0432: 0x00eb, # CYRILLIC SMALL LETTER VE - 0x0433: 0x00ac, # CYRILLIC SMALL LETTER GHE - 0x0434: 0x00a6, # CYRILLIC SMALL LETTER DE - 0x0435: 0x00a8, # CYRILLIC SMALL LETTER IE - 0x0436: 0x00e9, # CYRILLIC SMALL LETTER ZHE - 0x0437: 0x00f3, # CYRILLIC SMALL LETTER ZE - 0x0438: 0x00b7, # CYRILLIC SMALL LETTER I - 0x0439: 0x00bd, # CYRILLIC SMALL LETTER SHORT I - 0x043a: 0x00c6, # CYRILLIC SMALL LETTER KA - 0x043b: 0x00d0, # CYRILLIC SMALL LETTER EL - 0x043c: 0x00d2, # CYRILLIC SMALL LETTER EM - 0x043d: 0x00d4, # CYRILLIC SMALL LETTER EN - 0x043e: 0x00d6, # CYRILLIC SMALL LETTER O - 0x043f: 0x00d8, # CYRILLIC SMALL LETTER PE - 0x0440: 0x00e1, # CYRILLIC SMALL LETTER ER - 0x0441: 0x00e3, # CYRILLIC SMALL LETTER ES - 0x0442: 0x00e5, # CYRILLIC SMALL LETTER TE - 0x0443: 0x00e7, # CYRILLIC SMALL LETTER U - 0x0444: 0x00aa, # CYRILLIC SMALL LETTER EF - 0x0445: 0x00b5, # CYRILLIC SMALL LETTER HA - 0x0446: 0x00a4, # CYRILLIC SMALL LETTER TSE - 0x0447: 0x00fb, # CYRILLIC SMALL LETTER CHE - 0x0448: 0x00f5, # CYRILLIC SMALL LETTER SHA - 0x0449: 0x00f9, # CYRILLIC SMALL LETTER SHCHA - 0x044a: 0x009e, # CYRILLIC SMALL LETTER HARD SIGN - 0x044b: 0x00f1, # CYRILLIC SMALL LETTER YERU - 0x044c: 0x00ed, # CYRILLIC SMALL LETTER SOFT SIGN - 0x044d: 0x00f7, # CYRILLIC SMALL LETTER E - 0x044e: 0x009c, # CYRILLIC SMALL LETTER YU - 0x044f: 0x00de, # CYRILLIC SMALL LETTER YA - 0x0451: 0x0084, # CYRILLIC SMALL LETTER IO - 0x0452: 0x0080, # CYRILLIC SMALL LETTER DJE - 0x0453: 0x0082, # CYRILLIC SMALL LETTER GJE - 0x0454: 0x0086, # CYRILLIC SMALL LETTER UKRAINIAN IE - 0x0455: 0x0088, # CYRILLIC SMALL LETTER DZE - 0x0456: 0x008a, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - 0x0457: 0x008c, # CYRILLIC SMALL LETTER YI - 0x0458: 0x008e, # CYRILLIC SMALL LETTER JE - 0x0459: 0x0090, # CYRILLIC SMALL LETTER LJE - 0x045a: 0x0092, # CYRILLIC SMALL LETTER NJE - 0x045b: 0x0094, # CYRILLIC SMALL LETTER TSHE - 0x045c: 0x0096, # CYRILLIC SMALL LETTER KJE - 0x045e: 0x0098, # CYRILLIC SMALL LETTER SHORT U - 0x045f: 0x009a, # CYRILLIC SMALL LETTER DZHE - 0x2116: 0x00ef, # NUMERO SIGN - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py deleted file mode 100644 index e26af0b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp856.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp856 generated from 'MAPPINGS/VENDORS/MISC/CP856.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp856', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u05d0' # 0x80 -> HEBREW LETTER ALEF - u'\u05d1' # 0x81 -> HEBREW LETTER BET - u'\u05d2' # 0x82 -> HEBREW LETTER GIMEL - u'\u05d3' # 0x83 -> HEBREW LETTER DALET - u'\u05d4' # 0x84 -> HEBREW LETTER HE - u'\u05d5' # 0x85 -> HEBREW LETTER VAV - u'\u05d6' # 0x86 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0x87 -> HEBREW LETTER HET - u'\u05d8' # 0x88 -> HEBREW LETTER TET - u'\u05d9' # 0x89 -> HEBREW LETTER YOD - u'\u05da' # 0x8A -> HEBREW LETTER FINAL KAF - u'\u05db' # 0x8B -> HEBREW LETTER KAF - u'\u05dc' # 0x8C -> HEBREW LETTER LAMED - u'\u05dd' # 0x8D -> HEBREW LETTER FINAL MEM - u'\u05de' # 0x8E -> HEBREW LETTER MEM - u'\u05df' # 0x8F -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0x90 -> HEBREW LETTER NUN - u'\u05e1' # 0x91 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0x92 -> HEBREW LETTER AYIN - u'\u05e3' # 0x93 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0x94 -> HEBREW LETTER PE - u'\u05e5' # 0x95 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0x96 -> HEBREW LETTER TSADI - u'\u05e7' # 0x97 -> HEBREW LETTER QOF - u'\u05e8' # 0x98 -> HEBREW LETTER RESH - u'\u05e9' # 0x99 -> HEBREW LETTER SHIN - u'\u05ea' # 0x9A -> HEBREW LETTER TAV - u'\ufffe' # 0x9B -> UNDEFINED - u'\xa3' # 0x9C -> POUND SIGN - u'\ufffe' # 0x9D -> UNDEFINED - u'\xd7' # 0x9E -> MULTIPLICATION SIGN - u'\ufffe' # 0x9F -> UNDEFINED - u'\ufffe' # 0xA0 -> UNDEFINED - u'\ufffe' # 0xA1 -> UNDEFINED - u'\ufffe' # 0xA2 -> UNDEFINED - u'\ufffe' # 0xA3 -> UNDEFINED - u'\ufffe' # 0xA4 -> UNDEFINED - u'\ufffe' # 0xA5 -> UNDEFINED - u'\ufffe' # 0xA6 -> UNDEFINED - u'\ufffe' # 0xA7 -> UNDEFINED - u'\ufffe' # 0xA8 -> UNDEFINED - u'\xae' # 0xA9 -> REGISTERED SIGN - u'\xac' # 0xAA -> NOT SIGN - u'\xbd' # 0xAB -> VULGAR FRACTION ONE HALF - u'\xbc' # 0xAC -> VULGAR FRACTION ONE QUARTER - u'\ufffe' # 0xAD -> UNDEFINED - u'\xab' # 0xAE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xAF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0xB0 -> LIGHT SHADE - u'\u2592' # 0xB1 -> MEDIUM SHADE - u'\u2593' # 0xB2 -> DARK SHADE - u'\u2502' # 0xB3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0xB4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\ufffe' # 0xB5 -> UNDEFINED - u'\ufffe' # 0xB6 -> UNDEFINED - u'\ufffe' # 0xB7 -> UNDEFINED - u'\xa9' # 0xB8 -> COPYRIGHT SIGN - u'\u2563' # 0xB9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0xBA -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0xBB -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0xBC -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0xBD -> CENT SIGN - u'\xa5' # 0xBE -> YEN SIGN - u'\u2510' # 0xBF -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0xC0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0xC1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0xC2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0xC3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0xC4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0xC5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\ufffe' # 0xC6 -> UNDEFINED - u'\ufffe' # 0xC7 -> UNDEFINED - u'\u255a' # 0xC8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0xC9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0xCA -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0xCB -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0xCC -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0xCD -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0xCE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0xCF -> CURRENCY SIGN - u'\ufffe' # 0xD0 -> UNDEFINED - u'\ufffe' # 0xD1 -> UNDEFINED - u'\ufffe' # 0xD2 -> UNDEFINED - u'\ufffe' # 0xD3 -> UNDEFINEDS - u'\ufffe' # 0xD4 -> UNDEFINED - u'\ufffe' # 0xD5 -> UNDEFINED - u'\ufffe' # 0xD6 -> UNDEFINEDE - u'\ufffe' # 0xD7 -> UNDEFINED - u'\ufffe' # 0xD8 -> UNDEFINED - u'\u2518' # 0xD9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0xDA -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0xDB -> FULL BLOCK - u'\u2584' # 0xDC -> LOWER HALF BLOCK - u'\xa6' # 0xDD -> BROKEN BAR - u'\ufffe' # 0xDE -> UNDEFINED - u'\u2580' # 0xDF -> UPPER HALF BLOCK - u'\ufffe' # 0xE0 -> UNDEFINED - u'\ufffe' # 0xE1 -> UNDEFINED - u'\ufffe' # 0xE2 -> UNDEFINED - u'\ufffe' # 0xE3 -> UNDEFINED - u'\ufffe' # 0xE4 -> UNDEFINED - u'\ufffe' # 0xE5 -> UNDEFINED - u'\xb5' # 0xE6 -> MICRO SIGN - u'\ufffe' # 0xE7 -> UNDEFINED - u'\ufffe' # 0xE8 -> UNDEFINED - u'\ufffe' # 0xE9 -> UNDEFINED - u'\ufffe' # 0xEA -> UNDEFINED - u'\ufffe' # 0xEB -> UNDEFINED - u'\ufffe' # 0xEC -> UNDEFINED - u'\ufffe' # 0xED -> UNDEFINED - u'\xaf' # 0xEE -> MACRON - u'\xb4' # 0xEF -> ACUTE ACCENT - u'\xad' # 0xF0 -> SOFT HYPHEN - u'\xb1' # 0xF1 -> PLUS-MINUS SIGN - u'\u2017' # 0xF2 -> DOUBLE LOW LINE - u'\xbe' # 0xF3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0xF4 -> PILCROW SIGN - u'\xa7' # 0xF5 -> SECTION SIGN - u'\xf7' # 0xF6 -> DIVISION SIGN - u'\xb8' # 0xF7 -> CEDILLA - u'\xb0' # 0xF8 -> DEGREE SIGN - u'\xa8' # 0xF9 -> DIAERESIS - u'\xb7' # 0xFA -> MIDDLE DOT - u'\xb9' # 0xFB -> SUPERSCRIPT ONE - u'\xb3' # 0xFC -> SUPERSCRIPT THREE - u'\xb2' # 0xFD -> SUPERSCRIPT TWO - u'\u25a0' # 0xFE -> BLACK SQUARE - u'\xa0' # 0xFF -> NO-BREAK SPACE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py deleted file mode 100644 index d337e5b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp857.py +++ /dev/null @@ -1,694 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP857.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp857', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x0131, # LATIN SMALL LETTER DOTLESS I - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x0130, # LATIN CAPITAL LETTER I WITH DOT ABOVE - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x009e: 0x015e, # LATIN CAPITAL LETTER S WITH CEDILLA - 0x009f: 0x015f, # LATIN SMALL LETTER S WITH CEDILLA - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x011e, # LATIN CAPITAL LETTER G WITH BREVE - 0x00a7: 0x011f, # LATIN SMALL LETTER G WITH BREVE - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x00ae, # REGISTERED SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00b8: 0x00a9, # COPYRIGHT SIGN - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x00a2, # CENT SIGN - 0x00be: 0x00a5, # YEN SIGN - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x00a4, # CURRENCY SIGN - 0x00d0: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00d1: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00d5: None, # UNDEFINED - 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x00a6, # BROKEN BAR - 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: None, # UNDEFINED - 0x00e8: 0x00d7, # MULTIPLICATION SIGN - 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00ed: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x00ee: 0x00af, # MACRON - 0x00ef: 0x00b4, # ACUTE ACCENT - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: None, # UNDEFINED - 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00f4: 0x00b6, # PILCROW SIGN - 0x00f5: 0x00a7, # SECTION SIGN - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x00b8, # CEDILLA - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x00a8, # DIAERESIS - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x00b9, # SUPERSCRIPT ONE - 0x00fc: 0x00b3, # SUPERSCRIPT THREE - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u0131' # 0x008d -> LATIN SMALL LETTER DOTLESS I - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\u0130' # 0x0098 -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\u015e' # 0x009e -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u015f' # 0x009f -> LATIN SMALL LETTER S WITH CEDILLA - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\u011e' # 0x00a6 -> LATIN CAPITAL LETTER G WITH BREVE - u'\u011f' # 0x00a7 -> LATIN SMALL LETTER G WITH BREVE - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa9' # 0x00b8 -> COPYRIGHT SIGN - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0x00bd -> CENT SIGN - u'\xa5' # 0x00be -> YEN SIGN - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE - u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\xba' # 0x00d0 -> MASCULINE ORDINAL INDICATOR - u'\xaa' # 0x00d1 -> FEMININE ORDINAL INDICATOR - u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\ufffe' # 0x00d5 -> UNDEFINED - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\xa6' # 0x00dd -> BROKEN BAR - u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\ufffe' # 0x00e7 -> UNDEFINED - u'\xd7' # 0x00e8 -> MULTIPLICATION SIGN - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xec' # 0x00ec -> LATIN SMALL LETTER I WITH GRAVE - u'\xff' # 0x00ed -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xaf' # 0x00ee -> MACRON - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\ufffe' # 0x00f2 -> UNDEFINED - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a2: 0x00bd, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a4: 0x00cf, # CURRENCY SIGN - 0x00a5: 0x00be, # YEN SIGN - 0x00a6: 0x00dd, # BROKEN BAR - 0x00a7: 0x00f5, # SECTION SIGN - 0x00a8: 0x00f9, # DIAERESIS - 0x00a9: 0x00b8, # COPYRIGHT SIGN - 0x00aa: 0x00d1, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00ae: 0x00a9, # REGISTERED SIGN - 0x00af: 0x00ee, # MACRON - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b3: 0x00fc, # SUPERSCRIPT THREE - 0x00b4: 0x00ef, # ACUTE ACCENT - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b6: 0x00f4, # PILCROW SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00b8: 0x00f7, # CEDILLA - 0x00b9: 0x00fb, # SUPERSCRIPT ONE - 0x00ba: 0x00d0, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c0: 0x00b7, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c3: 0x00c7, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x00d4, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x00d2, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00cc: 0x00de, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00cf: 0x00d8, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d2: 0x00e3, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x00e8, # MULTIPLICATION SIGN - 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE - 0x00d9: 0x00eb, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00db: 0x00ea, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e3: 0x00c6, # LATIN SMALL LETTER A WITH TILDE - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00ff: 0x00ed, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x011e: 0x00a6, # LATIN CAPITAL LETTER G WITH BREVE - 0x011f: 0x00a7, # LATIN SMALL LETTER G WITH BREVE - 0x0130: 0x0098, # LATIN CAPITAL LETTER I WITH DOT ABOVE - 0x0131: 0x008d, # LATIN SMALL LETTER DOTLESS I - 0x015e: 0x009e, # LATIN CAPITAL LETTER S WITH CEDILLA - 0x015f: 0x009f, # LATIN SMALL LETTER S WITH CEDILLA - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py deleted file mode 100644 index 427a20d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp858.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec for CP858, modified from cp850. - -""" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp858', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x009e: 0x00d7, # MULTIPLICATION SIGN - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x00ae, # REGISTERED SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00b6: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00b7: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00b8: 0x00a9, # COPYRIGHT SIGN - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x00a2, # CENT SIGN - 0x00be: 0x00a5, # YEN SIGN - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x00c7: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x00a4, # CURRENCY SIGN - 0x00d0: 0x00f0, # LATIN SMALL LETTER ETH - 0x00d1: 0x00d0, # LATIN CAPITAL LETTER ETH - 0x00d2: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00d3: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00d4: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00d5: 0x20ac, # EURO SIGN - 0x00d6: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00d7: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00d8: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x00a6, # BROKEN BAR - 0x00de: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00e3: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00e4: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00e5: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x00fe, # LATIN SMALL LETTER THORN - 0x00e8: 0x00de, # LATIN CAPITAL LETTER THORN - 0x00e9: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00ea: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00eb: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00ec: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00ed: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00ee: 0x00af, # MACRON - 0x00ef: 0x00b4, # ACUTE ACCENT - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2017, # DOUBLE LOW LINE - 0x00f3: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00f4: 0x00b6, # PILCROW SIGN - 0x00f5: 0x00a7, # SECTION SIGN - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x00b8, # CEDILLA - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x00a8, # DIAERESIS - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x00b9, # SUPERSCRIPT ONE - 0x00fc: 0x00b3, # SUPERSCRIPT THREE - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd7' # 0x009e -> MULTIPLICATION SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xae' # 0x00a9 -> REGISTERED SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\xc1' # 0x00b5 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0x00b6 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc0' # 0x00b7 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa9' # 0x00b8 -> COPYRIGHT SIGN - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\xa2' # 0x00bd -> CENT SIGN - u'\xa5' # 0x00be -> YEN SIGN - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\xe3' # 0x00c6 -> LATIN SMALL LETTER A WITH TILDE - u'\xc3' # 0x00c7 -> LATIN CAPITAL LETTER A WITH TILDE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa4' # 0x00cf -> CURRENCY SIGN - u'\xf0' # 0x00d0 -> LATIN SMALL LETTER ETH - u'\xd0' # 0x00d1 -> LATIN CAPITAL LETTER ETH - u'\xca' # 0x00d2 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0x00d3 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0x00d4 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\u20ac' # 0x00d5 -> EURO SIGN - u'\xcd' # 0x00d6 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0x00d7 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0x00d8 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\xa6' # 0x00dd -> BROKEN BAR - u'\xcc' # 0x00de -> LATIN CAPITAL LETTER I WITH GRAVE - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\xd3' # 0x00e0 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\xd4' # 0x00e2 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd2' # 0x00e3 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xf5' # 0x00e4 -> LATIN SMALL LETTER O WITH TILDE - u'\xd5' # 0x00e5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\xfe' # 0x00e7 -> LATIN SMALL LETTER THORN - u'\xde' # 0x00e8 -> LATIN CAPITAL LETTER THORN - u'\xda' # 0x00e9 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0x00ea -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0x00eb -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xfd' # 0x00ec -> LATIN SMALL LETTER Y WITH ACUTE - u'\xdd' # 0x00ed -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xaf' # 0x00ee -> MACRON - u'\xb4' # 0x00ef -> ACUTE ACCENT - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2017' # 0x00f2 -> DOUBLE LOW LINE - u'\xbe' # 0x00f3 -> VULGAR FRACTION THREE QUARTERS - u'\xb6' # 0x00f4 -> PILCROW SIGN - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\xb8' # 0x00f7 -> CEDILLA - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\xb9' # 0x00fb -> SUPERSCRIPT ONE - u'\xb3' # 0x00fc -> SUPERSCRIPT THREE - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a2: 0x00bd, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a4: 0x00cf, # CURRENCY SIGN - 0x00a5: 0x00be, # YEN SIGN - 0x00a6: 0x00dd, # BROKEN BAR - 0x00a7: 0x00f5, # SECTION SIGN - 0x00a8: 0x00f9, # DIAERESIS - 0x00a9: 0x00b8, # COPYRIGHT SIGN - 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00ae: 0x00a9, # REGISTERED SIGN - 0x00af: 0x00ee, # MACRON - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b3: 0x00fc, # SUPERSCRIPT THREE - 0x00b4: 0x00ef, # ACUTE ACCENT - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b6: 0x00f4, # PILCROW SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00b8: 0x00f7, # CEDILLA - 0x00b9: 0x00fb, # SUPERSCRIPT ONE - 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00be: 0x00f3, # VULGAR FRACTION THREE QUARTERS - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c0: 0x00b7, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c1: 0x00b5, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x00b6, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c3: 0x00c7, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x00d4, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x00d2, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cb: 0x00d3, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00cc: 0x00de, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00cd: 0x00d6, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00ce: 0x00d7, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00cf: 0x00d8, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d0: 0x00d1, # LATIN CAPITAL LETTER ETH - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d2: 0x00e3, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00d3: 0x00e0, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x00e2, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d5: 0x00e5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d7: 0x009e, # MULTIPLICATION SIGN - 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE - 0x00d9: 0x00eb, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00da: 0x00e9, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00db: 0x00ea, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dd: 0x00ed, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00de: 0x00e8, # LATIN CAPITAL LETTER THORN - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e3: 0x00c6, # LATIN SMALL LETTER A WITH TILDE - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f0: 0x00d0, # LATIN SMALL LETTER ETH - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f5: 0x00e4, # LATIN SMALL LETTER O WITH TILDE - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00fd: 0x00ec, # LATIN SMALL LETTER Y WITH ACUTE - 0x00fe: 0x00e7, # LATIN SMALL LETTER THORN - 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x20ac: 0x00d5, # EURO SIGN - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x2017: 0x00f2, # DOUBLE LOW LINE - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py deleted file mode 100644 index ca96653..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp860.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP860.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp860', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x008c: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x008e: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x008f: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x0092: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x0096: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x0099: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00a2, # CENT SIGN - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x009e: 0x20a7, # PESETA SIGN - 0x009f: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00e3: 0x03c0, # GREEK SMALL LETTER PI - 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU - 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00ec: 0x221e, # INFINITY - 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00ef: 0x2229, # INTERSECTION - 0x00f0: 0x2261, # IDENTICAL TO - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x2320, # TOP HALF INTEGRAL - 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0x0084 -> LATIN SMALL LETTER A WITH TILDE - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xc1' # 0x0086 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xca' # 0x0089 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xcd' # 0x008b -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xd4' # 0x008c -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc3' # 0x008e -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc2' # 0x008f -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xc0' # 0x0091 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc8' # 0x0092 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0x0094 -> LATIN SMALL LETTER O WITH TILDE - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xda' # 0x0096 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xcc' # 0x0098 -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd5' # 0x0099 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u20a7' # 0x009e -> PESETA SIGN - u'\xd3' # 0x009f -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\xd2' # 0x00a9 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a2: 0x009b, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c0: 0x0091, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c1: 0x0086, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c2: 0x008f, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c3: 0x008e, # LATIN CAPITAL LETTER A WITH TILDE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x0092, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x0089, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cc: 0x0098, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00cd: 0x008b, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d2: 0x00a9, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00d3: 0x009f, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d4: 0x008c, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d5: 0x0099, # LATIN CAPITAL LETTER O WITH TILDE - 0x00d9: 0x009d, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00da: 0x0096, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e3: 0x0084, # LATIN SMALL LETTER A WITH TILDE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f5: 0x0094, # LATIN SMALL LETTER O WITH TILDE - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA - 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA - 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA - 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI - 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA - 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA - 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON - 0x03c0: 0x00e3, # GREEK SMALL LETTER PI - 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU - 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x20a7: 0x009e, # PESETA SIGN - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x221e: 0x00ec, # INFINITY - 0x2229: 0x00ef, # INTERSECTION - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2261: 0x00f0, # IDENTICAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2320: 0x00f4, # TOP HALF INTEGRAL - 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py deleted file mode 100644 index ce08f10..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp861.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP861.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp861', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00d0, # LATIN CAPITAL LETTER ETH - 0x008c: 0x00f0, # LATIN SMALL LETTER ETH - 0x008d: 0x00de, # LATIN CAPITAL LETTER THORN - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x00fe, # LATIN SMALL LETTER THORN - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x0098: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x009e: 0x20a7, # PESETA SIGN - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00a5: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00a6: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00a7: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x2310, # REVERSED NOT SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00e3: 0x03c0, # GREEK SMALL LETTER PI - 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU - 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00ec: 0x221e, # INFINITY - 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00ef: 0x2229, # INTERSECTION - 0x00f0: 0x2261, # IDENTICAL TO - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x2320, # TOP HALF INTEGRAL - 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xd0' # 0x008b -> LATIN CAPITAL LETTER ETH - u'\xf0' # 0x008c -> LATIN SMALL LETTER ETH - u'\xde' # 0x008d -> LATIN CAPITAL LETTER THORN - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xfe' # 0x0095 -> LATIN SMALL LETTER THORN - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xdd' # 0x0097 -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xfd' # 0x0098 -> LATIN SMALL LETTER Y WITH ACUTE - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xc1' # 0x00a4 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcd' # 0x00a5 -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xd3' # 0x00a6 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xda' # 0x00a7 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a3: 0x009c, # POUND SIGN - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c1: 0x00a4, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00cd: 0x00a5, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00d0: 0x008b, # LATIN CAPITAL LETTER ETH - 0x00d3: 0x00a6, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE - 0x00da: 0x00a7, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dd: 0x0097, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00de: 0x008d, # LATIN CAPITAL LETTER THORN - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00f0: 0x008c, # LATIN SMALL LETTER ETH - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00fd: 0x0098, # LATIN SMALL LETTER Y WITH ACUTE - 0x00fe: 0x0095, # LATIN SMALL LETTER THORN - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA - 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA - 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA - 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI - 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA - 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA - 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON - 0x03c0: 0x00e3, # GREEK SMALL LETTER PI - 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU - 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x20a7: 0x009e, # PESETA SIGN - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x221e: 0x00ec, # INFINITY - 0x2229: 0x00ef, # INTERSECTION - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2261: 0x00f0, # IDENTICAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2310: 0x00a9, # REVERSED NOT SIGN - 0x2320: 0x00f4, # TOP HALF INTEGRAL - 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py deleted file mode 100644 index ac81345..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp862.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP862.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp862', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x05d0, # HEBREW LETTER ALEF - 0x0081: 0x05d1, # HEBREW LETTER BET - 0x0082: 0x05d2, # HEBREW LETTER GIMEL - 0x0083: 0x05d3, # HEBREW LETTER DALET - 0x0084: 0x05d4, # HEBREW LETTER HE - 0x0085: 0x05d5, # HEBREW LETTER VAV - 0x0086: 0x05d6, # HEBREW LETTER ZAYIN - 0x0087: 0x05d7, # HEBREW LETTER HET - 0x0088: 0x05d8, # HEBREW LETTER TET - 0x0089: 0x05d9, # HEBREW LETTER YOD - 0x008a: 0x05da, # HEBREW LETTER FINAL KAF - 0x008b: 0x05db, # HEBREW LETTER KAF - 0x008c: 0x05dc, # HEBREW LETTER LAMED - 0x008d: 0x05dd, # HEBREW LETTER FINAL MEM - 0x008e: 0x05de, # HEBREW LETTER MEM - 0x008f: 0x05df, # HEBREW LETTER FINAL NUN - 0x0090: 0x05e0, # HEBREW LETTER NUN - 0x0091: 0x05e1, # HEBREW LETTER SAMEKH - 0x0092: 0x05e2, # HEBREW LETTER AYIN - 0x0093: 0x05e3, # HEBREW LETTER FINAL PE - 0x0094: 0x05e4, # HEBREW LETTER PE - 0x0095: 0x05e5, # HEBREW LETTER FINAL TSADI - 0x0096: 0x05e6, # HEBREW LETTER TSADI - 0x0097: 0x05e7, # HEBREW LETTER QOF - 0x0098: 0x05e8, # HEBREW LETTER RESH - 0x0099: 0x05e9, # HEBREW LETTER SHIN - 0x009a: 0x05ea, # HEBREW LETTER TAV - 0x009b: 0x00a2, # CENT SIGN - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00a5, # YEN SIGN - 0x009e: 0x20a7, # PESETA SIGN - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x2310, # REVERSED NOT SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S (GERMAN) - 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00e3: 0x03c0, # GREEK SMALL LETTER PI - 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU - 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00ec: 0x221e, # INFINITY - 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00ef: 0x2229, # INTERSECTION - 0x00f0: 0x2261, # IDENTICAL TO - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x2320, # TOP HALF INTEGRAL - 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u05d0' # 0x0080 -> HEBREW LETTER ALEF - u'\u05d1' # 0x0081 -> HEBREW LETTER BET - u'\u05d2' # 0x0082 -> HEBREW LETTER GIMEL - u'\u05d3' # 0x0083 -> HEBREW LETTER DALET - u'\u05d4' # 0x0084 -> HEBREW LETTER HE - u'\u05d5' # 0x0085 -> HEBREW LETTER VAV - u'\u05d6' # 0x0086 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0x0087 -> HEBREW LETTER HET - u'\u05d8' # 0x0088 -> HEBREW LETTER TET - u'\u05d9' # 0x0089 -> HEBREW LETTER YOD - u'\u05da' # 0x008a -> HEBREW LETTER FINAL KAF - u'\u05db' # 0x008b -> HEBREW LETTER KAF - u'\u05dc' # 0x008c -> HEBREW LETTER LAMED - u'\u05dd' # 0x008d -> HEBREW LETTER FINAL MEM - u'\u05de' # 0x008e -> HEBREW LETTER MEM - u'\u05df' # 0x008f -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0x0090 -> HEBREW LETTER NUN - u'\u05e1' # 0x0091 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0x0092 -> HEBREW LETTER AYIN - u'\u05e3' # 0x0093 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0x0094 -> HEBREW LETTER PE - u'\u05e5' # 0x0095 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0x0096 -> HEBREW LETTER TSADI - u'\u05e7' # 0x0097 -> HEBREW LETTER QOF - u'\u05e8' # 0x0098 -> HEBREW LETTER RESH - u'\u05e9' # 0x0099 -> HEBREW LETTER SHIN - u'\u05ea' # 0x009a -> HEBREW LETTER TAV - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xa5' # 0x009d -> YEN SIGN - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S (GERMAN) - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a2: 0x009b, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a5: 0x009d, # YEN SIGN - 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S (GERMAN) - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA - 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA - 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA - 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI - 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA - 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA - 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON - 0x03c0: 0x00e3, # GREEK SMALL LETTER PI - 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU - 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI - 0x05d0: 0x0080, # HEBREW LETTER ALEF - 0x05d1: 0x0081, # HEBREW LETTER BET - 0x05d2: 0x0082, # HEBREW LETTER GIMEL - 0x05d3: 0x0083, # HEBREW LETTER DALET - 0x05d4: 0x0084, # HEBREW LETTER HE - 0x05d5: 0x0085, # HEBREW LETTER VAV - 0x05d6: 0x0086, # HEBREW LETTER ZAYIN - 0x05d7: 0x0087, # HEBREW LETTER HET - 0x05d8: 0x0088, # HEBREW LETTER TET - 0x05d9: 0x0089, # HEBREW LETTER YOD - 0x05da: 0x008a, # HEBREW LETTER FINAL KAF - 0x05db: 0x008b, # HEBREW LETTER KAF - 0x05dc: 0x008c, # HEBREW LETTER LAMED - 0x05dd: 0x008d, # HEBREW LETTER FINAL MEM - 0x05de: 0x008e, # HEBREW LETTER MEM - 0x05df: 0x008f, # HEBREW LETTER FINAL NUN - 0x05e0: 0x0090, # HEBREW LETTER NUN - 0x05e1: 0x0091, # HEBREW LETTER SAMEKH - 0x05e2: 0x0092, # HEBREW LETTER AYIN - 0x05e3: 0x0093, # HEBREW LETTER FINAL PE - 0x05e4: 0x0094, # HEBREW LETTER PE - 0x05e5: 0x0095, # HEBREW LETTER FINAL TSADI - 0x05e6: 0x0096, # HEBREW LETTER TSADI - 0x05e7: 0x0097, # HEBREW LETTER QOF - 0x05e8: 0x0098, # HEBREW LETTER RESH - 0x05e9: 0x0099, # HEBREW LETTER SHIN - 0x05ea: 0x009a, # HEBREW LETTER TAV - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x20a7: 0x009e, # PESETA SIGN - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x221e: 0x00ec, # INFINITY - 0x2229: 0x00ef, # INTERSECTION - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2261: 0x00f0, # IDENTICAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2310: 0x00a9, # REVERSED NOT SIGN - 0x2320: 0x00f4, # TOP HALF INTEGRAL - 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py deleted file mode 100644 index fc8dfa5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp863.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP863.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp863', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00b6, # PILCROW SIGN - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x2017, # DOUBLE LOW LINE - 0x008e: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x008f: 0x00a7, # SECTION SIGN - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x0092: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x0095: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x00a4, # CURRENCY SIGN - 0x0099: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00a2, # CENT SIGN - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x009e: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00a6, # BROKEN BAR - 0x00a1: 0x00b4, # ACUTE ACCENT - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00a8, # DIAERESIS - 0x00a5: 0x00b8, # CEDILLA - 0x00a6: 0x00b3, # SUPERSCRIPT THREE - 0x00a7: 0x00af, # MACRON - 0x00a8: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00a9: 0x2310, # REVERSED NOT SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00e3: 0x03c0, # GREEK SMALL LETTER PI - 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU - 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00ec: 0x221e, # INFINITY - 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00ef: 0x2229, # INTERSECTION - 0x00f0: 0x2261, # IDENTICAL TO - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x2320, # TOP HALF INTEGRAL - 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xc2' # 0x0084 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xb6' # 0x0086 -> PILCROW SIGN - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u2017' # 0x008d -> DOUBLE LOW LINE - u'\xc0' # 0x008e -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xa7' # 0x008f -> SECTION SIGN - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xc8' # 0x0091 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xca' # 0x0092 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xcb' # 0x0094 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcf' # 0x0095 -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xa4' # 0x0098 -> CURRENCY SIGN - u'\xd4' # 0x0099 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xa2' # 0x009b -> CENT SIGN - u'\xa3' # 0x009c -> POUND SIGN - u'\xd9' # 0x009d -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xdb' # 0x009e -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xa6' # 0x00a0 -> BROKEN BAR - u'\xb4' # 0x00a1 -> ACUTE ACCENT - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xa8' # 0x00a4 -> DIAERESIS - u'\xb8' # 0x00a5 -> CEDILLA - u'\xb3' # 0x00a6 -> SUPERSCRIPT THREE - u'\xaf' # 0x00a7 -> MACRON - u'\xce' # 0x00a8 -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xbe' # 0x00ad -> VULGAR FRACTION THREE QUARTERS - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a2: 0x009b, # CENT SIGN - 0x00a3: 0x009c, # POUND SIGN - 0x00a4: 0x0098, # CURRENCY SIGN - 0x00a6: 0x00a0, # BROKEN BAR - 0x00a7: 0x008f, # SECTION SIGN - 0x00a8: 0x00a4, # DIAERESIS - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00af: 0x00a7, # MACRON - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b3: 0x00a6, # SUPERSCRIPT THREE - 0x00b4: 0x00a1, # ACUTE ACCENT - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b6: 0x0086, # PILCROW SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00b8: 0x00a5, # CEDILLA - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00be: 0x00ad, # VULGAR FRACTION THREE QUARTERS - 0x00c0: 0x008e, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00c2: 0x0084, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c8: 0x0091, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00ca: 0x0092, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00cb: 0x0094, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00ce: 0x00a8, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00cf: 0x0095, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00d4: 0x0099, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00d9: 0x009d, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00db: 0x009e, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA - 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA - 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA - 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI - 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA - 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA - 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON - 0x03c0: 0x00e3, # GREEK SMALL LETTER PI - 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU - 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI - 0x2017: 0x008d, # DOUBLE LOW LINE - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x221e: 0x00ec, # INFINITY - 0x2229: 0x00ef, # INTERSECTION - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2261: 0x00f0, # IDENTICAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2310: 0x00a9, # REVERSED NOT SIGN - 0x2320: 0x00f4, # TOP HALF INTEGRAL - 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py deleted file mode 100644 index 9733ada..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp864.py +++ /dev/null @@ -1,690 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP864.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp864', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0025: 0x066a, # ARABIC PERCENT SIGN - 0x0080: 0x00b0, # DEGREE SIGN - 0x0081: 0x00b7, # MIDDLE DOT - 0x0082: 0x2219, # BULLET OPERATOR - 0x0083: 0x221a, # SQUARE ROOT - 0x0084: 0x2592, # MEDIUM SHADE - 0x0085: 0x2500, # FORMS LIGHT HORIZONTAL - 0x0086: 0x2502, # FORMS LIGHT VERTICAL - 0x0087: 0x253c, # FORMS LIGHT VERTICAL AND HORIZONTAL - 0x0088: 0x2524, # FORMS LIGHT VERTICAL AND LEFT - 0x0089: 0x252c, # FORMS LIGHT DOWN AND HORIZONTAL - 0x008a: 0x251c, # FORMS LIGHT VERTICAL AND RIGHT - 0x008b: 0x2534, # FORMS LIGHT UP AND HORIZONTAL - 0x008c: 0x2510, # FORMS LIGHT DOWN AND LEFT - 0x008d: 0x250c, # FORMS LIGHT DOWN AND RIGHT - 0x008e: 0x2514, # FORMS LIGHT UP AND RIGHT - 0x008f: 0x2518, # FORMS LIGHT UP AND LEFT - 0x0090: 0x03b2, # GREEK SMALL BETA - 0x0091: 0x221e, # INFINITY - 0x0092: 0x03c6, # GREEK SMALL PHI - 0x0093: 0x00b1, # PLUS-OR-MINUS SIGN - 0x0094: 0x00bd, # FRACTION 1/2 - 0x0095: 0x00bc, # FRACTION 1/4 - 0x0096: 0x2248, # ALMOST EQUAL TO - 0x0097: 0x00ab, # LEFT POINTING GUILLEMET - 0x0098: 0x00bb, # RIGHT POINTING GUILLEMET - 0x0099: 0xfef7, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM - 0x009a: 0xfef8, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM - 0x009b: None, # UNDEFINED - 0x009c: None, # UNDEFINED - 0x009d: 0xfefb, # ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM - 0x009e: 0xfefc, # ARABIC LIGATURE LAM WITH ALEF FINAL FORM - 0x009f: None, # UNDEFINED - 0x00a1: 0x00ad, # SOFT HYPHEN - 0x00a2: 0xfe82, # ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM - 0x00a5: 0xfe84, # ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM - 0x00a6: None, # UNDEFINED - 0x00a7: None, # UNDEFINED - 0x00a8: 0xfe8e, # ARABIC LETTER ALEF FINAL FORM - 0x00a9: 0xfe8f, # ARABIC LETTER BEH ISOLATED FORM - 0x00aa: 0xfe95, # ARABIC LETTER TEH ISOLATED FORM - 0x00ab: 0xfe99, # ARABIC LETTER THEH ISOLATED FORM - 0x00ac: 0x060c, # ARABIC COMMA - 0x00ad: 0xfe9d, # ARABIC LETTER JEEM ISOLATED FORM - 0x00ae: 0xfea1, # ARABIC LETTER HAH ISOLATED FORM - 0x00af: 0xfea5, # ARABIC LETTER KHAH ISOLATED FORM - 0x00b0: 0x0660, # ARABIC-INDIC DIGIT ZERO - 0x00b1: 0x0661, # ARABIC-INDIC DIGIT ONE - 0x00b2: 0x0662, # ARABIC-INDIC DIGIT TWO - 0x00b3: 0x0663, # ARABIC-INDIC DIGIT THREE - 0x00b4: 0x0664, # ARABIC-INDIC DIGIT FOUR - 0x00b5: 0x0665, # ARABIC-INDIC DIGIT FIVE - 0x00b6: 0x0666, # ARABIC-INDIC DIGIT SIX - 0x00b7: 0x0667, # ARABIC-INDIC DIGIT SEVEN - 0x00b8: 0x0668, # ARABIC-INDIC DIGIT EIGHT - 0x00b9: 0x0669, # ARABIC-INDIC DIGIT NINE - 0x00ba: 0xfed1, # ARABIC LETTER FEH ISOLATED FORM - 0x00bb: 0x061b, # ARABIC SEMICOLON - 0x00bc: 0xfeb1, # ARABIC LETTER SEEN ISOLATED FORM - 0x00bd: 0xfeb5, # ARABIC LETTER SHEEN ISOLATED FORM - 0x00be: 0xfeb9, # ARABIC LETTER SAD ISOLATED FORM - 0x00bf: 0x061f, # ARABIC QUESTION MARK - 0x00c0: 0x00a2, # CENT SIGN - 0x00c1: 0xfe80, # ARABIC LETTER HAMZA ISOLATED FORM - 0x00c2: 0xfe81, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM - 0x00c3: 0xfe83, # ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM - 0x00c4: 0xfe85, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM - 0x00c5: 0xfeca, # ARABIC LETTER AIN FINAL FORM - 0x00c6: 0xfe8b, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM - 0x00c7: 0xfe8d, # ARABIC LETTER ALEF ISOLATED FORM - 0x00c8: 0xfe91, # ARABIC LETTER BEH INITIAL FORM - 0x00c9: 0xfe93, # ARABIC LETTER TEH MARBUTA ISOLATED FORM - 0x00ca: 0xfe97, # ARABIC LETTER TEH INITIAL FORM - 0x00cb: 0xfe9b, # ARABIC LETTER THEH INITIAL FORM - 0x00cc: 0xfe9f, # ARABIC LETTER JEEM INITIAL FORM - 0x00cd: 0xfea3, # ARABIC LETTER HAH INITIAL FORM - 0x00ce: 0xfea7, # ARABIC LETTER KHAH INITIAL FORM - 0x00cf: 0xfea9, # ARABIC LETTER DAL ISOLATED FORM - 0x00d0: 0xfeab, # ARABIC LETTER THAL ISOLATED FORM - 0x00d1: 0xfead, # ARABIC LETTER REH ISOLATED FORM - 0x00d2: 0xfeaf, # ARABIC LETTER ZAIN ISOLATED FORM - 0x00d3: 0xfeb3, # ARABIC LETTER SEEN INITIAL FORM - 0x00d4: 0xfeb7, # ARABIC LETTER SHEEN INITIAL FORM - 0x00d5: 0xfebb, # ARABIC LETTER SAD INITIAL FORM - 0x00d6: 0xfebf, # ARABIC LETTER DAD INITIAL FORM - 0x00d7: 0xfec1, # ARABIC LETTER TAH ISOLATED FORM - 0x00d8: 0xfec5, # ARABIC LETTER ZAH ISOLATED FORM - 0x00d9: 0xfecb, # ARABIC LETTER AIN INITIAL FORM - 0x00da: 0xfecf, # ARABIC LETTER GHAIN INITIAL FORM - 0x00db: 0x00a6, # BROKEN VERTICAL BAR - 0x00dc: 0x00ac, # NOT SIGN - 0x00dd: 0x00f7, # DIVISION SIGN - 0x00de: 0x00d7, # MULTIPLICATION SIGN - 0x00df: 0xfec9, # ARABIC LETTER AIN ISOLATED FORM - 0x00e0: 0x0640, # ARABIC TATWEEL - 0x00e1: 0xfed3, # ARABIC LETTER FEH INITIAL FORM - 0x00e2: 0xfed7, # ARABIC LETTER QAF INITIAL FORM - 0x00e3: 0xfedb, # ARABIC LETTER KAF INITIAL FORM - 0x00e4: 0xfedf, # ARABIC LETTER LAM INITIAL FORM - 0x00e5: 0xfee3, # ARABIC LETTER MEEM INITIAL FORM - 0x00e6: 0xfee7, # ARABIC LETTER NOON INITIAL FORM - 0x00e7: 0xfeeb, # ARABIC LETTER HEH INITIAL FORM - 0x00e8: 0xfeed, # ARABIC LETTER WAW ISOLATED FORM - 0x00e9: 0xfeef, # ARABIC LETTER ALEF MAKSURA ISOLATED FORM - 0x00ea: 0xfef3, # ARABIC LETTER YEH INITIAL FORM - 0x00eb: 0xfebd, # ARABIC LETTER DAD ISOLATED FORM - 0x00ec: 0xfecc, # ARABIC LETTER AIN MEDIAL FORM - 0x00ed: 0xfece, # ARABIC LETTER GHAIN FINAL FORM - 0x00ee: 0xfecd, # ARABIC LETTER GHAIN ISOLATED FORM - 0x00ef: 0xfee1, # ARABIC LETTER MEEM ISOLATED FORM - 0x00f0: 0xfe7d, # ARABIC SHADDA MEDIAL FORM - 0x00f1: 0x0651, # ARABIC SHADDAH - 0x00f2: 0xfee5, # ARABIC LETTER NOON ISOLATED FORM - 0x00f3: 0xfee9, # ARABIC LETTER HEH ISOLATED FORM - 0x00f4: 0xfeec, # ARABIC LETTER HEH MEDIAL FORM - 0x00f5: 0xfef0, # ARABIC LETTER ALEF MAKSURA FINAL FORM - 0x00f6: 0xfef2, # ARABIC LETTER YEH FINAL FORM - 0x00f7: 0xfed0, # ARABIC LETTER GHAIN MEDIAL FORM - 0x00f8: 0xfed5, # ARABIC LETTER QAF ISOLATED FORM - 0x00f9: 0xfef5, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM - 0x00fa: 0xfef6, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM - 0x00fb: 0xfedd, # ARABIC LETTER LAM ISOLATED FORM - 0x00fc: 0xfed9, # ARABIC LETTER KAF ISOLATED FORM - 0x00fd: 0xfef1, # ARABIC LETTER YEH ISOLATED FORM - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: None, # UNDEFINED -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'\u066a' # 0x0025 -> ARABIC PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xb0' # 0x0080 -> DEGREE SIGN - u'\xb7' # 0x0081 -> MIDDLE DOT - u'\u2219' # 0x0082 -> BULLET OPERATOR - u'\u221a' # 0x0083 -> SQUARE ROOT - u'\u2592' # 0x0084 -> MEDIUM SHADE - u'\u2500' # 0x0085 -> FORMS LIGHT HORIZONTAL - u'\u2502' # 0x0086 -> FORMS LIGHT VERTICAL - u'\u253c' # 0x0087 -> FORMS LIGHT VERTICAL AND HORIZONTAL - u'\u2524' # 0x0088 -> FORMS LIGHT VERTICAL AND LEFT - u'\u252c' # 0x0089 -> FORMS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x008a -> FORMS LIGHT VERTICAL AND RIGHT - u'\u2534' # 0x008b -> FORMS LIGHT UP AND HORIZONTAL - u'\u2510' # 0x008c -> FORMS LIGHT DOWN AND LEFT - u'\u250c' # 0x008d -> FORMS LIGHT DOWN AND RIGHT - u'\u2514' # 0x008e -> FORMS LIGHT UP AND RIGHT - u'\u2518' # 0x008f -> FORMS LIGHT UP AND LEFT - u'\u03b2' # 0x0090 -> GREEK SMALL BETA - u'\u221e' # 0x0091 -> INFINITY - u'\u03c6' # 0x0092 -> GREEK SMALL PHI - u'\xb1' # 0x0093 -> PLUS-OR-MINUS SIGN - u'\xbd' # 0x0094 -> FRACTION 1/2 - u'\xbc' # 0x0095 -> FRACTION 1/4 - u'\u2248' # 0x0096 -> ALMOST EQUAL TO - u'\xab' # 0x0097 -> LEFT POINTING GUILLEMET - u'\xbb' # 0x0098 -> RIGHT POINTING GUILLEMET - u'\ufef7' # 0x0099 -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM - u'\ufef8' # 0x009a -> ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM - u'\ufffe' # 0x009b -> UNDEFINED - u'\ufffe' # 0x009c -> UNDEFINED - u'\ufefb' # 0x009d -> ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM - u'\ufefc' # 0x009e -> ARABIC LIGATURE LAM WITH ALEF FINAL FORM - u'\ufffe' # 0x009f -> UNDEFINED - u'\xa0' # 0x00a0 -> NON-BREAKING SPACE - u'\xad' # 0x00a1 -> SOFT HYPHEN - u'\ufe82' # 0x00a2 -> ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM - u'\xa3' # 0x00a3 -> POUND SIGN - u'\xa4' # 0x00a4 -> CURRENCY SIGN - u'\ufe84' # 0x00a5 -> ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM - u'\ufffe' # 0x00a6 -> UNDEFINED - u'\ufffe' # 0x00a7 -> UNDEFINED - u'\ufe8e' # 0x00a8 -> ARABIC LETTER ALEF FINAL FORM - u'\ufe8f' # 0x00a9 -> ARABIC LETTER BEH ISOLATED FORM - u'\ufe95' # 0x00aa -> ARABIC LETTER TEH ISOLATED FORM - u'\ufe99' # 0x00ab -> ARABIC LETTER THEH ISOLATED FORM - u'\u060c' # 0x00ac -> ARABIC COMMA - u'\ufe9d' # 0x00ad -> ARABIC LETTER JEEM ISOLATED FORM - u'\ufea1' # 0x00ae -> ARABIC LETTER HAH ISOLATED FORM - u'\ufea5' # 0x00af -> ARABIC LETTER KHAH ISOLATED FORM - u'\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO - u'\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE - u'\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO - u'\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE - u'\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR - u'\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE - u'\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX - u'\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN - u'\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT - u'\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE - u'\ufed1' # 0x00ba -> ARABIC LETTER FEH ISOLATED FORM - u'\u061b' # 0x00bb -> ARABIC SEMICOLON - u'\ufeb1' # 0x00bc -> ARABIC LETTER SEEN ISOLATED FORM - u'\ufeb5' # 0x00bd -> ARABIC LETTER SHEEN ISOLATED FORM - u'\ufeb9' # 0x00be -> ARABIC LETTER SAD ISOLATED FORM - u'\u061f' # 0x00bf -> ARABIC QUESTION MARK - u'\xa2' # 0x00c0 -> CENT SIGN - u'\ufe80' # 0x00c1 -> ARABIC LETTER HAMZA ISOLATED FORM - u'\ufe81' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM - u'\ufe83' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM - u'\ufe85' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM - u'\ufeca' # 0x00c5 -> ARABIC LETTER AIN FINAL FORM - u'\ufe8b' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM - u'\ufe8d' # 0x00c7 -> ARABIC LETTER ALEF ISOLATED FORM - u'\ufe91' # 0x00c8 -> ARABIC LETTER BEH INITIAL FORM - u'\ufe93' # 0x00c9 -> ARABIC LETTER TEH MARBUTA ISOLATED FORM - u'\ufe97' # 0x00ca -> ARABIC LETTER TEH INITIAL FORM - u'\ufe9b' # 0x00cb -> ARABIC LETTER THEH INITIAL FORM - u'\ufe9f' # 0x00cc -> ARABIC LETTER JEEM INITIAL FORM - u'\ufea3' # 0x00cd -> ARABIC LETTER HAH INITIAL FORM - u'\ufea7' # 0x00ce -> ARABIC LETTER KHAH INITIAL FORM - u'\ufea9' # 0x00cf -> ARABIC LETTER DAL ISOLATED FORM - u'\ufeab' # 0x00d0 -> ARABIC LETTER THAL ISOLATED FORM - u'\ufead' # 0x00d1 -> ARABIC LETTER REH ISOLATED FORM - u'\ufeaf' # 0x00d2 -> ARABIC LETTER ZAIN ISOLATED FORM - u'\ufeb3' # 0x00d3 -> ARABIC LETTER SEEN INITIAL FORM - u'\ufeb7' # 0x00d4 -> ARABIC LETTER SHEEN INITIAL FORM - u'\ufebb' # 0x00d5 -> ARABIC LETTER SAD INITIAL FORM - u'\ufebf' # 0x00d6 -> ARABIC LETTER DAD INITIAL FORM - u'\ufec1' # 0x00d7 -> ARABIC LETTER TAH ISOLATED FORM - u'\ufec5' # 0x00d8 -> ARABIC LETTER ZAH ISOLATED FORM - u'\ufecb' # 0x00d9 -> ARABIC LETTER AIN INITIAL FORM - u'\ufecf' # 0x00da -> ARABIC LETTER GHAIN INITIAL FORM - u'\xa6' # 0x00db -> BROKEN VERTICAL BAR - u'\xac' # 0x00dc -> NOT SIGN - u'\xf7' # 0x00dd -> DIVISION SIGN - u'\xd7' # 0x00de -> MULTIPLICATION SIGN - u'\ufec9' # 0x00df -> ARABIC LETTER AIN ISOLATED FORM - u'\u0640' # 0x00e0 -> ARABIC TATWEEL - u'\ufed3' # 0x00e1 -> ARABIC LETTER FEH INITIAL FORM - u'\ufed7' # 0x00e2 -> ARABIC LETTER QAF INITIAL FORM - u'\ufedb' # 0x00e3 -> ARABIC LETTER KAF INITIAL FORM - u'\ufedf' # 0x00e4 -> ARABIC LETTER LAM INITIAL FORM - u'\ufee3' # 0x00e5 -> ARABIC LETTER MEEM INITIAL FORM - u'\ufee7' # 0x00e6 -> ARABIC LETTER NOON INITIAL FORM - u'\ufeeb' # 0x00e7 -> ARABIC LETTER HEH INITIAL FORM - u'\ufeed' # 0x00e8 -> ARABIC LETTER WAW ISOLATED FORM - u'\ufeef' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA ISOLATED FORM - u'\ufef3' # 0x00ea -> ARABIC LETTER YEH INITIAL FORM - u'\ufebd' # 0x00eb -> ARABIC LETTER DAD ISOLATED FORM - u'\ufecc' # 0x00ec -> ARABIC LETTER AIN MEDIAL FORM - u'\ufece' # 0x00ed -> ARABIC LETTER GHAIN FINAL FORM - u'\ufecd' # 0x00ee -> ARABIC LETTER GHAIN ISOLATED FORM - u'\ufee1' # 0x00ef -> ARABIC LETTER MEEM ISOLATED FORM - u'\ufe7d' # 0x00f0 -> ARABIC SHADDA MEDIAL FORM - u'\u0651' # 0x00f1 -> ARABIC SHADDAH - u'\ufee5' # 0x00f2 -> ARABIC LETTER NOON ISOLATED FORM - u'\ufee9' # 0x00f3 -> ARABIC LETTER HEH ISOLATED FORM - u'\ufeec' # 0x00f4 -> ARABIC LETTER HEH MEDIAL FORM - u'\ufef0' # 0x00f5 -> ARABIC LETTER ALEF MAKSURA FINAL FORM - u'\ufef2' # 0x00f6 -> ARABIC LETTER YEH FINAL FORM - u'\ufed0' # 0x00f7 -> ARABIC LETTER GHAIN MEDIAL FORM - u'\ufed5' # 0x00f8 -> ARABIC LETTER QAF ISOLATED FORM - u'\ufef5' # 0x00f9 -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM - u'\ufef6' # 0x00fa -> ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM - u'\ufedd' # 0x00fb -> ARABIC LETTER LAM ISOLATED FORM - u'\ufed9' # 0x00fc -> ARABIC LETTER KAF ISOLATED FORM - u'\ufef1' # 0x00fd -> ARABIC LETTER YEH ISOLATED FORM - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\ufffe' # 0x00ff -> UNDEFINED -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00a0, # NON-BREAKING SPACE - 0x00a2: 0x00c0, # CENT SIGN - 0x00a3: 0x00a3, # POUND SIGN - 0x00a4: 0x00a4, # CURRENCY SIGN - 0x00a6: 0x00db, # BROKEN VERTICAL BAR - 0x00ab: 0x0097, # LEFT POINTING GUILLEMET - 0x00ac: 0x00dc, # NOT SIGN - 0x00ad: 0x00a1, # SOFT HYPHEN - 0x00b0: 0x0080, # DEGREE SIGN - 0x00b1: 0x0093, # PLUS-OR-MINUS SIGN - 0x00b7: 0x0081, # MIDDLE DOT - 0x00bb: 0x0098, # RIGHT POINTING GUILLEMET - 0x00bc: 0x0095, # FRACTION 1/4 - 0x00bd: 0x0094, # FRACTION 1/2 - 0x00d7: 0x00de, # MULTIPLICATION SIGN - 0x00f7: 0x00dd, # DIVISION SIGN - 0x03b2: 0x0090, # GREEK SMALL BETA - 0x03c6: 0x0092, # GREEK SMALL PHI - 0x060c: 0x00ac, # ARABIC COMMA - 0x061b: 0x00bb, # ARABIC SEMICOLON - 0x061f: 0x00bf, # ARABIC QUESTION MARK - 0x0640: 0x00e0, # ARABIC TATWEEL - 0x0651: 0x00f1, # ARABIC SHADDAH - 0x0660: 0x00b0, # ARABIC-INDIC DIGIT ZERO - 0x0661: 0x00b1, # ARABIC-INDIC DIGIT ONE - 0x0662: 0x00b2, # ARABIC-INDIC DIGIT TWO - 0x0663: 0x00b3, # ARABIC-INDIC DIGIT THREE - 0x0664: 0x00b4, # ARABIC-INDIC DIGIT FOUR - 0x0665: 0x00b5, # ARABIC-INDIC DIGIT FIVE - 0x0666: 0x00b6, # ARABIC-INDIC DIGIT SIX - 0x0667: 0x00b7, # ARABIC-INDIC DIGIT SEVEN - 0x0668: 0x00b8, # ARABIC-INDIC DIGIT EIGHT - 0x0669: 0x00b9, # ARABIC-INDIC DIGIT NINE - 0x066a: 0x0025, # ARABIC PERCENT SIGN - 0x2219: 0x0082, # BULLET OPERATOR - 0x221a: 0x0083, # SQUARE ROOT - 0x221e: 0x0091, # INFINITY - 0x2248: 0x0096, # ALMOST EQUAL TO - 0x2500: 0x0085, # FORMS LIGHT HORIZONTAL - 0x2502: 0x0086, # FORMS LIGHT VERTICAL - 0x250c: 0x008d, # FORMS LIGHT DOWN AND RIGHT - 0x2510: 0x008c, # FORMS LIGHT DOWN AND LEFT - 0x2514: 0x008e, # FORMS LIGHT UP AND RIGHT - 0x2518: 0x008f, # FORMS LIGHT UP AND LEFT - 0x251c: 0x008a, # FORMS LIGHT VERTICAL AND RIGHT - 0x2524: 0x0088, # FORMS LIGHT VERTICAL AND LEFT - 0x252c: 0x0089, # FORMS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x008b, # FORMS LIGHT UP AND HORIZONTAL - 0x253c: 0x0087, # FORMS LIGHT VERTICAL AND HORIZONTAL - 0x2592: 0x0084, # MEDIUM SHADE - 0x25a0: 0x00fe, # BLACK SQUARE - 0xfe7d: 0x00f0, # ARABIC SHADDA MEDIAL FORM - 0xfe80: 0x00c1, # ARABIC LETTER HAMZA ISOLATED FORM - 0xfe81: 0x00c2, # ARABIC LETTER ALEF WITH MADDA ABOVE ISOLATED FORM - 0xfe82: 0x00a2, # ARABIC LETTER ALEF WITH MADDA ABOVE FINAL FORM - 0xfe83: 0x00c3, # ARABIC LETTER ALEF WITH HAMZA ABOVE ISOLATED FORM - 0xfe84: 0x00a5, # ARABIC LETTER ALEF WITH HAMZA ABOVE FINAL FORM - 0xfe85: 0x00c4, # ARABIC LETTER WAW WITH HAMZA ABOVE ISOLATED FORM - 0xfe8b: 0x00c6, # ARABIC LETTER YEH WITH HAMZA ABOVE INITIAL FORM - 0xfe8d: 0x00c7, # ARABIC LETTER ALEF ISOLATED FORM - 0xfe8e: 0x00a8, # ARABIC LETTER ALEF FINAL FORM - 0xfe8f: 0x00a9, # ARABIC LETTER BEH ISOLATED FORM - 0xfe91: 0x00c8, # ARABIC LETTER BEH INITIAL FORM - 0xfe93: 0x00c9, # ARABIC LETTER TEH MARBUTA ISOLATED FORM - 0xfe95: 0x00aa, # ARABIC LETTER TEH ISOLATED FORM - 0xfe97: 0x00ca, # ARABIC LETTER TEH INITIAL FORM - 0xfe99: 0x00ab, # ARABIC LETTER THEH ISOLATED FORM - 0xfe9b: 0x00cb, # ARABIC LETTER THEH INITIAL FORM - 0xfe9d: 0x00ad, # ARABIC LETTER JEEM ISOLATED FORM - 0xfe9f: 0x00cc, # ARABIC LETTER JEEM INITIAL FORM - 0xfea1: 0x00ae, # ARABIC LETTER HAH ISOLATED FORM - 0xfea3: 0x00cd, # ARABIC LETTER HAH INITIAL FORM - 0xfea5: 0x00af, # ARABIC LETTER KHAH ISOLATED FORM - 0xfea7: 0x00ce, # ARABIC LETTER KHAH INITIAL FORM - 0xfea9: 0x00cf, # ARABIC LETTER DAL ISOLATED FORM - 0xfeab: 0x00d0, # ARABIC LETTER THAL ISOLATED FORM - 0xfead: 0x00d1, # ARABIC LETTER REH ISOLATED FORM - 0xfeaf: 0x00d2, # ARABIC LETTER ZAIN ISOLATED FORM - 0xfeb1: 0x00bc, # ARABIC LETTER SEEN ISOLATED FORM - 0xfeb3: 0x00d3, # ARABIC LETTER SEEN INITIAL FORM - 0xfeb5: 0x00bd, # ARABIC LETTER SHEEN ISOLATED FORM - 0xfeb7: 0x00d4, # ARABIC LETTER SHEEN INITIAL FORM - 0xfeb9: 0x00be, # ARABIC LETTER SAD ISOLATED FORM - 0xfebb: 0x00d5, # ARABIC LETTER SAD INITIAL FORM - 0xfebd: 0x00eb, # ARABIC LETTER DAD ISOLATED FORM - 0xfebf: 0x00d6, # ARABIC LETTER DAD INITIAL FORM - 0xfec1: 0x00d7, # ARABIC LETTER TAH ISOLATED FORM - 0xfec5: 0x00d8, # ARABIC LETTER ZAH ISOLATED FORM - 0xfec9: 0x00df, # ARABIC LETTER AIN ISOLATED FORM - 0xfeca: 0x00c5, # ARABIC LETTER AIN FINAL FORM - 0xfecb: 0x00d9, # ARABIC LETTER AIN INITIAL FORM - 0xfecc: 0x00ec, # ARABIC LETTER AIN MEDIAL FORM - 0xfecd: 0x00ee, # ARABIC LETTER GHAIN ISOLATED FORM - 0xfece: 0x00ed, # ARABIC LETTER GHAIN FINAL FORM - 0xfecf: 0x00da, # ARABIC LETTER GHAIN INITIAL FORM - 0xfed0: 0x00f7, # ARABIC LETTER GHAIN MEDIAL FORM - 0xfed1: 0x00ba, # ARABIC LETTER FEH ISOLATED FORM - 0xfed3: 0x00e1, # ARABIC LETTER FEH INITIAL FORM - 0xfed5: 0x00f8, # ARABIC LETTER QAF ISOLATED FORM - 0xfed7: 0x00e2, # ARABIC LETTER QAF INITIAL FORM - 0xfed9: 0x00fc, # ARABIC LETTER KAF ISOLATED FORM - 0xfedb: 0x00e3, # ARABIC LETTER KAF INITIAL FORM - 0xfedd: 0x00fb, # ARABIC LETTER LAM ISOLATED FORM - 0xfedf: 0x00e4, # ARABIC LETTER LAM INITIAL FORM - 0xfee1: 0x00ef, # ARABIC LETTER MEEM ISOLATED FORM - 0xfee3: 0x00e5, # ARABIC LETTER MEEM INITIAL FORM - 0xfee5: 0x00f2, # ARABIC LETTER NOON ISOLATED FORM - 0xfee7: 0x00e6, # ARABIC LETTER NOON INITIAL FORM - 0xfee9: 0x00f3, # ARABIC LETTER HEH ISOLATED FORM - 0xfeeb: 0x00e7, # ARABIC LETTER HEH INITIAL FORM - 0xfeec: 0x00f4, # ARABIC LETTER HEH MEDIAL FORM - 0xfeed: 0x00e8, # ARABIC LETTER WAW ISOLATED FORM - 0xfeef: 0x00e9, # ARABIC LETTER ALEF MAKSURA ISOLATED FORM - 0xfef0: 0x00f5, # ARABIC LETTER ALEF MAKSURA FINAL FORM - 0xfef1: 0x00fd, # ARABIC LETTER YEH ISOLATED FORM - 0xfef2: 0x00f6, # ARABIC LETTER YEH FINAL FORM - 0xfef3: 0x00ea, # ARABIC LETTER YEH INITIAL FORM - 0xfef5: 0x00f9, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE ISOLATED FORM - 0xfef6: 0x00fa, # ARABIC LIGATURE LAM WITH ALEF WITH MADDA ABOVE FINAL FORM - 0xfef7: 0x0099, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE ISOLATED FORM - 0xfef8: 0x009a, # ARABIC LIGATURE LAM WITH ALEF WITH HAMZA ABOVE FINAL FORM - 0xfefb: 0x009d, # ARABIC LIGATURE LAM WITH ALEF ISOLATED FORM - 0xfefc: 0x009e, # ARABIC LIGATURE LAM WITH ALEF FINAL FORM -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py deleted file mode 100644 index b246a49..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp865.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP865.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp865', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0081: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x0082: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x0083: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x0084: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x0085: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0086: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x0087: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x0088: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0089: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x008a: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x008b: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x008c: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x008d: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x008e: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x008f: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x0090: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0091: 0x00e6, # LATIN SMALL LIGATURE AE - 0x0092: 0x00c6, # LATIN CAPITAL LIGATURE AE - 0x0093: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x0094: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x0095: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x0096: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x0097: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x0098: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0099: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x009a: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x009b: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x009e: 0x20a7, # PESETA SIGN - 0x009f: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00a0: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00a1: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00a2: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00a3: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00a4: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00a5: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00a6: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00a7: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00a8: 0x00bf, # INVERTED QUESTION MARK - 0x00a9: 0x2310, # REVERSED NOT SIGN - 0x00aa: 0x00ac, # NOT SIGN - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00ad: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00a4, # CURRENCY SIGN - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00e1: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00e2: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00e3: 0x03c0, # GREEK SMALL LETTER PI - 0x00e4: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00e5: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00e6: 0x00b5, # MICRO SIGN - 0x00e7: 0x03c4, # GREEK SMALL LETTER TAU - 0x00e8: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00e9: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ea: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00eb: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00ec: 0x221e, # INFINITY - 0x00ed: 0x03c6, # GREEK SMALL LETTER PHI - 0x00ee: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00ef: 0x2229, # INTERSECTION - 0x00f0: 0x2261, # IDENTICAL TO - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00f3: 0x2264, # LESS-THAN OR EQUAL TO - 0x00f4: 0x2320, # TOP HALF INTEGRAL - 0x00f5: 0x2321, # BOTTOM HALF INTEGRAL - 0x00f6: 0x00f7, # DIVISION SIGN - 0x00f7: 0x2248, # ALMOST EQUAL TO - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x207f, # SUPERSCRIPT LATIN SMALL LETTER N - 0x00fd: 0x00b2, # SUPERSCRIPT TWO - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\xc7' # 0x0080 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xfc' # 0x0081 -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xe9' # 0x0082 -> LATIN SMALL LETTER E WITH ACUTE - u'\xe2' # 0x0083 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x0084 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe0' # 0x0085 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe5' # 0x0086 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x0087 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xea' # 0x0088 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0089 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xe8' # 0x008a -> LATIN SMALL LETTER E WITH GRAVE - u'\xef' # 0x008b -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xee' # 0x008c -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xec' # 0x008d -> LATIN SMALL LETTER I WITH GRAVE - u'\xc4' # 0x008e -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x008f -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc9' # 0x0090 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xe6' # 0x0091 -> LATIN SMALL LIGATURE AE - u'\xc6' # 0x0092 -> LATIN CAPITAL LIGATURE AE - u'\xf4' # 0x0093 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x0094 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf2' # 0x0095 -> LATIN SMALL LETTER O WITH GRAVE - u'\xfb' # 0x0096 -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xf9' # 0x0097 -> LATIN SMALL LETTER U WITH GRAVE - u'\xff' # 0x0098 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\xd6' # 0x0099 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x009a -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xf8' # 0x009b -> LATIN SMALL LETTER O WITH STROKE - u'\xa3' # 0x009c -> POUND SIGN - u'\xd8' # 0x009d -> LATIN CAPITAL LETTER O WITH STROKE - u'\u20a7' # 0x009e -> PESETA SIGN - u'\u0192' # 0x009f -> LATIN SMALL LETTER F WITH HOOK - u'\xe1' # 0x00a0 -> LATIN SMALL LETTER A WITH ACUTE - u'\xed' # 0x00a1 -> LATIN SMALL LETTER I WITH ACUTE - u'\xf3' # 0x00a2 -> LATIN SMALL LETTER O WITH ACUTE - u'\xfa' # 0x00a3 -> LATIN SMALL LETTER U WITH ACUTE - u'\xf1' # 0x00a4 -> LATIN SMALL LETTER N WITH TILDE - u'\xd1' # 0x00a5 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xaa' # 0x00a6 -> FEMININE ORDINAL INDICATOR - u'\xba' # 0x00a7 -> MASCULINE ORDINAL INDICATOR - u'\xbf' # 0x00a8 -> INVERTED QUESTION MARK - u'\u2310' # 0x00a9 -> REVERSED NOT SIGN - u'\xac' # 0x00aa -> NOT SIGN - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\xbc' # 0x00ac -> VULGAR FRACTION ONE QUARTER - u'\xa1' # 0x00ad -> INVERTED EXCLAMATION MARK - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xa4' # 0x00af -> CURRENCY SIGN - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b1' # 0x00e0 -> GREEK SMALL LETTER ALPHA - u'\xdf' # 0x00e1 -> LATIN SMALL LETTER SHARP S - u'\u0393' # 0x00e2 -> GREEK CAPITAL LETTER GAMMA - u'\u03c0' # 0x00e3 -> GREEK SMALL LETTER PI - u'\u03a3' # 0x00e4 -> GREEK CAPITAL LETTER SIGMA - u'\u03c3' # 0x00e5 -> GREEK SMALL LETTER SIGMA - u'\xb5' # 0x00e6 -> MICRO SIGN - u'\u03c4' # 0x00e7 -> GREEK SMALL LETTER TAU - u'\u03a6' # 0x00e8 -> GREEK CAPITAL LETTER PHI - u'\u0398' # 0x00e9 -> GREEK CAPITAL LETTER THETA - u'\u03a9' # 0x00ea -> GREEK CAPITAL LETTER OMEGA - u'\u03b4' # 0x00eb -> GREEK SMALL LETTER DELTA - u'\u221e' # 0x00ec -> INFINITY - u'\u03c6' # 0x00ed -> GREEK SMALL LETTER PHI - u'\u03b5' # 0x00ee -> GREEK SMALL LETTER EPSILON - u'\u2229' # 0x00ef -> INTERSECTION - u'\u2261' # 0x00f0 -> IDENTICAL TO - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u2265' # 0x00f2 -> GREATER-THAN OR EQUAL TO - u'\u2264' # 0x00f3 -> LESS-THAN OR EQUAL TO - u'\u2320' # 0x00f4 -> TOP HALF INTEGRAL - u'\u2321' # 0x00f5 -> BOTTOM HALF INTEGRAL - u'\xf7' # 0x00f6 -> DIVISION SIGN - u'\u2248' # 0x00f7 -> ALMOST EQUAL TO - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u207f' # 0x00fc -> SUPERSCRIPT LATIN SMALL LETTER N - u'\xb2' # 0x00fd -> SUPERSCRIPT TWO - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a1: 0x00ad, # INVERTED EXCLAMATION MARK - 0x00a3: 0x009c, # POUND SIGN - 0x00a4: 0x00af, # CURRENCY SIGN - 0x00aa: 0x00a6, # FEMININE ORDINAL INDICATOR - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x00aa, # NOT SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x00fd, # SUPERSCRIPT TWO - 0x00b5: 0x00e6, # MICRO SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x00ba: 0x00a7, # MASCULINE ORDINAL INDICATOR - 0x00bc: 0x00ac, # VULGAR FRACTION ONE QUARTER - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x00bf: 0x00a8, # INVERTED QUESTION MARK - 0x00c4: 0x008e, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c5: 0x008f, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00c6: 0x0092, # LATIN CAPITAL LIGATURE AE - 0x00c7: 0x0080, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c9: 0x0090, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00d1: 0x00a5, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d6: 0x0099, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00d8: 0x009d, # LATIN CAPITAL LETTER O WITH STROKE - 0x00dc: 0x009a, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00df: 0x00e1, # LATIN SMALL LETTER SHARP S - 0x00e0: 0x0085, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x00a0, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0083, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e4: 0x0084, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e5: 0x0086, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00e6: 0x0091, # LATIN SMALL LIGATURE AE - 0x00e7: 0x0087, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008a, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x0082, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0088, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0089, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ec: 0x008d, # LATIN SMALL LETTER I WITH GRAVE - 0x00ed: 0x00a1, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x008c, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x008b, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f1: 0x00a4, # LATIN SMALL LETTER N WITH TILDE - 0x00f2: 0x0095, # LATIN SMALL LETTER O WITH GRAVE - 0x00f3: 0x00a2, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0093, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f6: 0x0094, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x00f6, # DIVISION SIGN - 0x00f8: 0x009b, # LATIN SMALL LETTER O WITH STROKE - 0x00f9: 0x0097, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x00a3, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x0096, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x0081, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00ff: 0x0098, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x0192: 0x009f, # LATIN SMALL LETTER F WITH HOOK - 0x0393: 0x00e2, # GREEK CAPITAL LETTER GAMMA - 0x0398: 0x00e9, # GREEK CAPITAL LETTER THETA - 0x03a3: 0x00e4, # GREEK CAPITAL LETTER SIGMA - 0x03a6: 0x00e8, # GREEK CAPITAL LETTER PHI - 0x03a9: 0x00ea, # GREEK CAPITAL LETTER OMEGA - 0x03b1: 0x00e0, # GREEK SMALL LETTER ALPHA - 0x03b4: 0x00eb, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00ee, # GREEK SMALL LETTER EPSILON - 0x03c0: 0x00e3, # GREEK SMALL LETTER PI - 0x03c3: 0x00e5, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00e7, # GREEK SMALL LETTER TAU - 0x03c6: 0x00ed, # GREEK SMALL LETTER PHI - 0x207f: 0x00fc, # SUPERSCRIPT LATIN SMALL LETTER N - 0x20a7: 0x009e, # PESETA SIGN - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x221e: 0x00ec, # INFINITY - 0x2229: 0x00ef, # INTERSECTION - 0x2248: 0x00f7, # ALMOST EQUAL TO - 0x2261: 0x00f0, # IDENTICAL TO - 0x2264: 0x00f3, # LESS-THAN OR EQUAL TO - 0x2265: 0x00f2, # GREATER-THAN OR EQUAL TO - 0x2310: 0x00a9, # REVERSED NOT SIGN - 0x2320: 0x00f4, # TOP HALF INTEGRAL - 0x2321: 0x00f5, # BOTTOM HALF INTEGRAL - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py deleted file mode 100644 index 70e5139..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp866.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP866.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp866', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x0410, # CYRILLIC CAPITAL LETTER A - 0x0081: 0x0411, # CYRILLIC CAPITAL LETTER BE - 0x0082: 0x0412, # CYRILLIC CAPITAL LETTER VE - 0x0083: 0x0413, # CYRILLIC CAPITAL LETTER GHE - 0x0084: 0x0414, # CYRILLIC CAPITAL LETTER DE - 0x0085: 0x0415, # CYRILLIC CAPITAL LETTER IE - 0x0086: 0x0416, # CYRILLIC CAPITAL LETTER ZHE - 0x0087: 0x0417, # CYRILLIC CAPITAL LETTER ZE - 0x0088: 0x0418, # CYRILLIC CAPITAL LETTER I - 0x0089: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I - 0x008a: 0x041a, # CYRILLIC CAPITAL LETTER KA - 0x008b: 0x041b, # CYRILLIC CAPITAL LETTER EL - 0x008c: 0x041c, # CYRILLIC CAPITAL LETTER EM - 0x008d: 0x041d, # CYRILLIC CAPITAL LETTER EN - 0x008e: 0x041e, # CYRILLIC CAPITAL LETTER O - 0x008f: 0x041f, # CYRILLIC CAPITAL LETTER PE - 0x0090: 0x0420, # CYRILLIC CAPITAL LETTER ER - 0x0091: 0x0421, # CYRILLIC CAPITAL LETTER ES - 0x0092: 0x0422, # CYRILLIC CAPITAL LETTER TE - 0x0093: 0x0423, # CYRILLIC CAPITAL LETTER U - 0x0094: 0x0424, # CYRILLIC CAPITAL LETTER EF - 0x0095: 0x0425, # CYRILLIC CAPITAL LETTER HA - 0x0096: 0x0426, # CYRILLIC CAPITAL LETTER TSE - 0x0097: 0x0427, # CYRILLIC CAPITAL LETTER CHE - 0x0098: 0x0428, # CYRILLIC CAPITAL LETTER SHA - 0x0099: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA - 0x009a: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x009b: 0x042b, # CYRILLIC CAPITAL LETTER YERU - 0x009c: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN - 0x009d: 0x042d, # CYRILLIC CAPITAL LETTER E - 0x009e: 0x042e, # CYRILLIC CAPITAL LETTER YU - 0x009f: 0x042f, # CYRILLIC CAPITAL LETTER YA - 0x00a0: 0x0430, # CYRILLIC SMALL LETTER A - 0x00a1: 0x0431, # CYRILLIC SMALL LETTER BE - 0x00a2: 0x0432, # CYRILLIC SMALL LETTER VE - 0x00a3: 0x0433, # CYRILLIC SMALL LETTER GHE - 0x00a4: 0x0434, # CYRILLIC SMALL LETTER DE - 0x00a5: 0x0435, # CYRILLIC SMALL LETTER IE - 0x00a6: 0x0436, # CYRILLIC SMALL LETTER ZHE - 0x00a7: 0x0437, # CYRILLIC SMALL LETTER ZE - 0x00a8: 0x0438, # CYRILLIC SMALL LETTER I - 0x00a9: 0x0439, # CYRILLIC SMALL LETTER SHORT I - 0x00aa: 0x043a, # CYRILLIC SMALL LETTER KA - 0x00ab: 0x043b, # CYRILLIC SMALL LETTER EL - 0x00ac: 0x043c, # CYRILLIC SMALL LETTER EM - 0x00ad: 0x043d, # CYRILLIC SMALL LETTER EN - 0x00ae: 0x043e, # CYRILLIC SMALL LETTER O - 0x00af: 0x043f, # CYRILLIC SMALL LETTER PE - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x2561, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x00b6: 0x2562, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x00b7: 0x2556, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x00b8: 0x2555, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x255c, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x00be: 0x255b, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x255e, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x00c7: 0x255f, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x2567, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x00d0: 0x2568, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x00d1: 0x2564, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x00d2: 0x2565, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x00d3: 0x2559, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x00d4: 0x2558, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x00d5: 0x2552, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x00d6: 0x2553, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x00d7: 0x256b, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x00d8: 0x256a, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x258c, # LEFT HALF BLOCK - 0x00de: 0x2590, # RIGHT HALF BLOCK - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x0440, # CYRILLIC SMALL LETTER ER - 0x00e1: 0x0441, # CYRILLIC SMALL LETTER ES - 0x00e2: 0x0442, # CYRILLIC SMALL LETTER TE - 0x00e3: 0x0443, # CYRILLIC SMALL LETTER U - 0x00e4: 0x0444, # CYRILLIC SMALL LETTER EF - 0x00e5: 0x0445, # CYRILLIC SMALL LETTER HA - 0x00e6: 0x0446, # CYRILLIC SMALL LETTER TSE - 0x00e7: 0x0447, # CYRILLIC SMALL LETTER CHE - 0x00e8: 0x0448, # CYRILLIC SMALL LETTER SHA - 0x00e9: 0x0449, # CYRILLIC SMALL LETTER SHCHA - 0x00ea: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN - 0x00eb: 0x044b, # CYRILLIC SMALL LETTER YERU - 0x00ec: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN - 0x00ed: 0x044d, # CYRILLIC SMALL LETTER E - 0x00ee: 0x044e, # CYRILLIC SMALL LETTER YU - 0x00ef: 0x044f, # CYRILLIC SMALL LETTER YA - 0x00f0: 0x0401, # CYRILLIC CAPITAL LETTER IO - 0x00f1: 0x0451, # CYRILLIC SMALL LETTER IO - 0x00f2: 0x0404, # CYRILLIC CAPITAL LETTER UKRAINIAN IE - 0x00f3: 0x0454, # CYRILLIC SMALL LETTER UKRAINIAN IE - 0x00f4: 0x0407, # CYRILLIC CAPITAL LETTER YI - 0x00f5: 0x0457, # CYRILLIC SMALL LETTER YI - 0x00f6: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U - 0x00f7: 0x045e, # CYRILLIC SMALL LETTER SHORT U - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x2219, # BULLET OPERATOR - 0x00fa: 0x00b7, # MIDDLE DOT - 0x00fb: 0x221a, # SQUARE ROOT - 0x00fc: 0x2116, # NUMERO SIGN - 0x00fd: 0x00a4, # CURRENCY SIGN - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\u0410' # 0x0080 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0x0081 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0x0082 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0x0083 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0x0084 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0x0085 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0x0086 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0x0087 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0x0088 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0x0089 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0x008a -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0x008b -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0x008c -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0x008d -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0x008e -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0x008f -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0x0090 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0x0091 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0x0092 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0x0093 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0x0094 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0x0095 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0x0096 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0x0097 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0x0098 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0x0099 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0x009a -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0x009b -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0x009c -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0x009d -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0x009e -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0x009f -> CYRILLIC CAPITAL LETTER YA - u'\u0430' # 0x00a0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0x00a1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0x00a2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0x00a3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0x00a4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0x00a5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0x00a6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0x00a7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0x00a8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0x00a9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0x00aa -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0x00ab -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0x00ac -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0x00ad -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0x00ae -> CYRILLIC SMALL LETTER O - u'\u043f' # 0x00af -> CYRILLIC SMALL LETTER PE - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u2561' # 0x00b5 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u2562' # 0x00b6 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2556' # 0x00b7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2555' # 0x00b8 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255c' # 0x00bd -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255b' # 0x00be -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u255e' # 0x00c6 -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0x00c7 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u2567' # 0x00cf -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0x00d0 -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2564' # 0x00d1 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0x00d2 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2559' # 0x00d3 -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u2558' # 0x00d4 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2552' # 0x00d5 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u2553' # 0x00d6 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u256b' # 0x00d7 -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256a' # 0x00d8 -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u258c' # 0x00dd -> LEFT HALF BLOCK - u'\u2590' # 0x00de -> RIGHT HALF BLOCK - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u0440' # 0x00e0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0x00e1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0x00e2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0x00e3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0x00e4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0x00e5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0x00e6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0x00e7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0x00e8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0x00e9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0x00ea -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0x00eb -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0x00ec -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0x00ed -> CYRILLIC SMALL LETTER E - u'\u044e' # 0x00ee -> CYRILLIC SMALL LETTER YU - u'\u044f' # 0x00ef -> CYRILLIC SMALL LETTER YA - u'\u0401' # 0x00f0 -> CYRILLIC CAPITAL LETTER IO - u'\u0451' # 0x00f1 -> CYRILLIC SMALL LETTER IO - u'\u0404' # 0x00f2 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0454' # 0x00f3 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0407' # 0x00f4 -> CYRILLIC CAPITAL LETTER YI - u'\u0457' # 0x00f5 -> CYRILLIC SMALL LETTER YI - u'\u040e' # 0x00f6 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045e' # 0x00f7 -> CYRILLIC SMALL LETTER SHORT U - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\u2219' # 0x00f9 -> BULLET OPERATOR - u'\xb7' # 0x00fa -> MIDDLE DOT - u'\u221a' # 0x00fb -> SQUARE ROOT - u'\u2116' # 0x00fc -> NUMERO SIGN - u'\xa4' # 0x00fd -> CURRENCY SIGN - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a4: 0x00fd, # CURRENCY SIGN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b7: 0x00fa, # MIDDLE DOT - 0x0401: 0x00f0, # CYRILLIC CAPITAL LETTER IO - 0x0404: 0x00f2, # CYRILLIC CAPITAL LETTER UKRAINIAN IE - 0x0407: 0x00f4, # CYRILLIC CAPITAL LETTER YI - 0x040e: 0x00f6, # CYRILLIC CAPITAL LETTER SHORT U - 0x0410: 0x0080, # CYRILLIC CAPITAL LETTER A - 0x0411: 0x0081, # CYRILLIC CAPITAL LETTER BE - 0x0412: 0x0082, # CYRILLIC CAPITAL LETTER VE - 0x0413: 0x0083, # CYRILLIC CAPITAL LETTER GHE - 0x0414: 0x0084, # CYRILLIC CAPITAL LETTER DE - 0x0415: 0x0085, # CYRILLIC CAPITAL LETTER IE - 0x0416: 0x0086, # CYRILLIC CAPITAL LETTER ZHE - 0x0417: 0x0087, # CYRILLIC CAPITAL LETTER ZE - 0x0418: 0x0088, # CYRILLIC CAPITAL LETTER I - 0x0419: 0x0089, # CYRILLIC CAPITAL LETTER SHORT I - 0x041a: 0x008a, # CYRILLIC CAPITAL LETTER KA - 0x041b: 0x008b, # CYRILLIC CAPITAL LETTER EL - 0x041c: 0x008c, # CYRILLIC CAPITAL LETTER EM - 0x041d: 0x008d, # CYRILLIC CAPITAL LETTER EN - 0x041e: 0x008e, # CYRILLIC CAPITAL LETTER O - 0x041f: 0x008f, # CYRILLIC CAPITAL LETTER PE - 0x0420: 0x0090, # CYRILLIC CAPITAL LETTER ER - 0x0421: 0x0091, # CYRILLIC CAPITAL LETTER ES - 0x0422: 0x0092, # CYRILLIC CAPITAL LETTER TE - 0x0423: 0x0093, # CYRILLIC CAPITAL LETTER U - 0x0424: 0x0094, # CYRILLIC CAPITAL LETTER EF - 0x0425: 0x0095, # CYRILLIC CAPITAL LETTER HA - 0x0426: 0x0096, # CYRILLIC CAPITAL LETTER TSE - 0x0427: 0x0097, # CYRILLIC CAPITAL LETTER CHE - 0x0428: 0x0098, # CYRILLIC CAPITAL LETTER SHA - 0x0429: 0x0099, # CYRILLIC CAPITAL LETTER SHCHA - 0x042a: 0x009a, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x042b: 0x009b, # CYRILLIC CAPITAL LETTER YERU - 0x042c: 0x009c, # CYRILLIC CAPITAL LETTER SOFT SIGN - 0x042d: 0x009d, # CYRILLIC CAPITAL LETTER E - 0x042e: 0x009e, # CYRILLIC CAPITAL LETTER YU - 0x042f: 0x009f, # CYRILLIC CAPITAL LETTER YA - 0x0430: 0x00a0, # CYRILLIC SMALL LETTER A - 0x0431: 0x00a1, # CYRILLIC SMALL LETTER BE - 0x0432: 0x00a2, # CYRILLIC SMALL LETTER VE - 0x0433: 0x00a3, # CYRILLIC SMALL LETTER GHE - 0x0434: 0x00a4, # CYRILLIC SMALL LETTER DE - 0x0435: 0x00a5, # CYRILLIC SMALL LETTER IE - 0x0436: 0x00a6, # CYRILLIC SMALL LETTER ZHE - 0x0437: 0x00a7, # CYRILLIC SMALL LETTER ZE - 0x0438: 0x00a8, # CYRILLIC SMALL LETTER I - 0x0439: 0x00a9, # CYRILLIC SMALL LETTER SHORT I - 0x043a: 0x00aa, # CYRILLIC SMALL LETTER KA - 0x043b: 0x00ab, # CYRILLIC SMALL LETTER EL - 0x043c: 0x00ac, # CYRILLIC SMALL LETTER EM - 0x043d: 0x00ad, # CYRILLIC SMALL LETTER EN - 0x043e: 0x00ae, # CYRILLIC SMALL LETTER O - 0x043f: 0x00af, # CYRILLIC SMALL LETTER PE - 0x0440: 0x00e0, # CYRILLIC SMALL LETTER ER - 0x0441: 0x00e1, # CYRILLIC SMALL LETTER ES - 0x0442: 0x00e2, # CYRILLIC SMALL LETTER TE - 0x0443: 0x00e3, # CYRILLIC SMALL LETTER U - 0x0444: 0x00e4, # CYRILLIC SMALL LETTER EF - 0x0445: 0x00e5, # CYRILLIC SMALL LETTER HA - 0x0446: 0x00e6, # CYRILLIC SMALL LETTER TSE - 0x0447: 0x00e7, # CYRILLIC SMALL LETTER CHE - 0x0448: 0x00e8, # CYRILLIC SMALL LETTER SHA - 0x0449: 0x00e9, # CYRILLIC SMALL LETTER SHCHA - 0x044a: 0x00ea, # CYRILLIC SMALL LETTER HARD SIGN - 0x044b: 0x00eb, # CYRILLIC SMALL LETTER YERU - 0x044c: 0x00ec, # CYRILLIC SMALL LETTER SOFT SIGN - 0x044d: 0x00ed, # CYRILLIC SMALL LETTER E - 0x044e: 0x00ee, # CYRILLIC SMALL LETTER YU - 0x044f: 0x00ef, # CYRILLIC SMALL LETTER YA - 0x0451: 0x00f1, # CYRILLIC SMALL LETTER IO - 0x0454: 0x00f3, # CYRILLIC SMALL LETTER UKRAINIAN IE - 0x0457: 0x00f5, # CYRILLIC SMALL LETTER YI - 0x045e: 0x00f7, # CYRILLIC SMALL LETTER SHORT U - 0x2116: 0x00fc, # NUMERO SIGN - 0x2219: 0x00f9, # BULLET OPERATOR - 0x221a: 0x00fb, # SQUARE ROOT - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2552: 0x00d5, # BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - 0x2553: 0x00d6, # BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2555: 0x00b8, # BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - 0x2556: 0x00b7, # BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x2558: 0x00d4, # BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - 0x2559: 0x00d3, # BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255b: 0x00be, # BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - 0x255c: 0x00bd, # BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x255e: 0x00c6, # BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - 0x255f: 0x00c7, # BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2561: 0x00b5, # BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - 0x2562: 0x00b6, # BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2564: 0x00d1, # BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - 0x2565: 0x00d2, # BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2567: 0x00cf, # BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - 0x2568: 0x00d0, # BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256a: 0x00d8, # BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - 0x256b: 0x00d7, # BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x258c: 0x00dd, # LEFT HALF BLOCK - 0x2590: 0x00de, # RIGHT HALF BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py deleted file mode 100644 index 59e3318..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp869.py +++ /dev/null @@ -1,689 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/MICSFT/PC/CP869.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp869', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: None, # UNDEFINED - 0x0081: None, # UNDEFINED - 0x0082: None, # UNDEFINED - 0x0083: None, # UNDEFINED - 0x0084: None, # UNDEFINED - 0x0085: None, # UNDEFINED - 0x0086: 0x0386, # GREEK CAPITAL LETTER ALPHA WITH TONOS - 0x0087: None, # UNDEFINED - 0x0088: 0x00b7, # MIDDLE DOT - 0x0089: 0x00ac, # NOT SIGN - 0x008a: 0x00a6, # BROKEN BAR - 0x008b: 0x2018, # LEFT SINGLE QUOTATION MARK - 0x008c: 0x2019, # RIGHT SINGLE QUOTATION MARK - 0x008d: 0x0388, # GREEK CAPITAL LETTER EPSILON WITH TONOS - 0x008e: 0x2015, # HORIZONTAL BAR - 0x008f: 0x0389, # GREEK CAPITAL LETTER ETA WITH TONOS - 0x0090: 0x038a, # GREEK CAPITAL LETTER IOTA WITH TONOS - 0x0091: 0x03aa, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - 0x0092: 0x038c, # GREEK CAPITAL LETTER OMICRON WITH TONOS - 0x0093: None, # UNDEFINED - 0x0094: None, # UNDEFINED - 0x0095: 0x038e, # GREEK CAPITAL LETTER UPSILON WITH TONOS - 0x0096: 0x03ab, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - 0x0097: 0x00a9, # COPYRIGHT SIGN - 0x0098: 0x038f, # GREEK CAPITAL LETTER OMEGA WITH TONOS - 0x0099: 0x00b2, # SUPERSCRIPT TWO - 0x009a: 0x00b3, # SUPERSCRIPT THREE - 0x009b: 0x03ac, # GREEK SMALL LETTER ALPHA WITH TONOS - 0x009c: 0x00a3, # POUND SIGN - 0x009d: 0x03ad, # GREEK SMALL LETTER EPSILON WITH TONOS - 0x009e: 0x03ae, # GREEK SMALL LETTER ETA WITH TONOS - 0x009f: 0x03af, # GREEK SMALL LETTER IOTA WITH TONOS - 0x00a0: 0x03ca, # GREEK SMALL LETTER IOTA WITH DIALYTIKA - 0x00a1: 0x0390, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - 0x00a2: 0x03cc, # GREEK SMALL LETTER OMICRON WITH TONOS - 0x00a3: 0x03cd, # GREEK SMALL LETTER UPSILON WITH TONOS - 0x00a4: 0x0391, # GREEK CAPITAL LETTER ALPHA - 0x00a5: 0x0392, # GREEK CAPITAL LETTER BETA - 0x00a6: 0x0393, # GREEK CAPITAL LETTER GAMMA - 0x00a7: 0x0394, # GREEK CAPITAL LETTER DELTA - 0x00a8: 0x0395, # GREEK CAPITAL LETTER EPSILON - 0x00a9: 0x0396, # GREEK CAPITAL LETTER ZETA - 0x00aa: 0x0397, # GREEK CAPITAL LETTER ETA - 0x00ab: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00ac: 0x0398, # GREEK CAPITAL LETTER THETA - 0x00ad: 0x0399, # GREEK CAPITAL LETTER IOTA - 0x00ae: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00af: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00b0: 0x2591, # LIGHT SHADE - 0x00b1: 0x2592, # MEDIUM SHADE - 0x00b2: 0x2593, # DARK SHADE - 0x00b3: 0x2502, # BOX DRAWINGS LIGHT VERTICAL - 0x00b4: 0x2524, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x00b5: 0x039a, # GREEK CAPITAL LETTER KAPPA - 0x00b6: 0x039b, # GREEK CAPITAL LETTER LAMDA - 0x00b7: 0x039c, # GREEK CAPITAL LETTER MU - 0x00b8: 0x039d, # GREEK CAPITAL LETTER NU - 0x00b9: 0x2563, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x00ba: 0x2551, # BOX DRAWINGS DOUBLE VERTICAL - 0x00bb: 0x2557, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x00bc: 0x255d, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x00bd: 0x039e, # GREEK CAPITAL LETTER XI - 0x00be: 0x039f, # GREEK CAPITAL LETTER OMICRON - 0x00bf: 0x2510, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x00c0: 0x2514, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x00c1: 0x2534, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x00c2: 0x252c, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x00c3: 0x251c, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x00c4: 0x2500, # BOX DRAWINGS LIGHT HORIZONTAL - 0x00c5: 0x253c, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x00c6: 0x03a0, # GREEK CAPITAL LETTER PI - 0x00c7: 0x03a1, # GREEK CAPITAL LETTER RHO - 0x00c8: 0x255a, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x00c9: 0x2554, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x00ca: 0x2569, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x00cb: 0x2566, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x00cc: 0x2560, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x00cd: 0x2550, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x00ce: 0x256c, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x00cf: 0x03a3, # GREEK CAPITAL LETTER SIGMA - 0x00d0: 0x03a4, # GREEK CAPITAL LETTER TAU - 0x00d1: 0x03a5, # GREEK CAPITAL LETTER UPSILON - 0x00d2: 0x03a6, # GREEK CAPITAL LETTER PHI - 0x00d3: 0x03a7, # GREEK CAPITAL LETTER CHI - 0x00d4: 0x03a8, # GREEK CAPITAL LETTER PSI - 0x00d5: 0x03a9, # GREEK CAPITAL LETTER OMEGA - 0x00d6: 0x03b1, # GREEK SMALL LETTER ALPHA - 0x00d7: 0x03b2, # GREEK SMALL LETTER BETA - 0x00d8: 0x03b3, # GREEK SMALL LETTER GAMMA - 0x00d9: 0x2518, # BOX DRAWINGS LIGHT UP AND LEFT - 0x00da: 0x250c, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x00db: 0x2588, # FULL BLOCK - 0x00dc: 0x2584, # LOWER HALF BLOCK - 0x00dd: 0x03b4, # GREEK SMALL LETTER DELTA - 0x00de: 0x03b5, # GREEK SMALL LETTER EPSILON - 0x00df: 0x2580, # UPPER HALF BLOCK - 0x00e0: 0x03b6, # GREEK SMALL LETTER ZETA - 0x00e1: 0x03b7, # GREEK SMALL LETTER ETA - 0x00e2: 0x03b8, # GREEK SMALL LETTER THETA - 0x00e3: 0x03b9, # GREEK SMALL LETTER IOTA - 0x00e4: 0x03ba, # GREEK SMALL LETTER KAPPA - 0x00e5: 0x03bb, # GREEK SMALL LETTER LAMDA - 0x00e6: 0x03bc, # GREEK SMALL LETTER MU - 0x00e7: 0x03bd, # GREEK SMALL LETTER NU - 0x00e8: 0x03be, # GREEK SMALL LETTER XI - 0x00e9: 0x03bf, # GREEK SMALL LETTER OMICRON - 0x00ea: 0x03c0, # GREEK SMALL LETTER PI - 0x00eb: 0x03c1, # GREEK SMALL LETTER RHO - 0x00ec: 0x03c3, # GREEK SMALL LETTER SIGMA - 0x00ed: 0x03c2, # GREEK SMALL LETTER FINAL SIGMA - 0x00ee: 0x03c4, # GREEK SMALL LETTER TAU - 0x00ef: 0x0384, # GREEK TONOS - 0x00f0: 0x00ad, # SOFT HYPHEN - 0x00f1: 0x00b1, # PLUS-MINUS SIGN - 0x00f2: 0x03c5, # GREEK SMALL LETTER UPSILON - 0x00f3: 0x03c6, # GREEK SMALL LETTER PHI - 0x00f4: 0x03c7, # GREEK SMALL LETTER CHI - 0x00f5: 0x00a7, # SECTION SIGN - 0x00f6: 0x03c8, # GREEK SMALL LETTER PSI - 0x00f7: 0x0385, # GREEK DIALYTIKA TONOS - 0x00f8: 0x00b0, # DEGREE SIGN - 0x00f9: 0x00a8, # DIAERESIS - 0x00fa: 0x03c9, # GREEK SMALL LETTER OMEGA - 0x00fb: 0x03cb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA - 0x00fc: 0x03b0, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - 0x00fd: 0x03ce, # GREEK SMALL LETTER OMEGA WITH TONOS - 0x00fe: 0x25a0, # BLACK SQUARE - 0x00ff: 0x00a0, # NO-BREAK SPACE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> NULL - u'\x01' # 0x0001 -> START OF HEADING - u'\x02' # 0x0002 -> START OF TEXT - u'\x03' # 0x0003 -> END OF TEXT - u'\x04' # 0x0004 -> END OF TRANSMISSION - u'\x05' # 0x0005 -> ENQUIRY - u'\x06' # 0x0006 -> ACKNOWLEDGE - u'\x07' # 0x0007 -> BELL - u'\x08' # 0x0008 -> BACKSPACE - u'\t' # 0x0009 -> HORIZONTAL TABULATION - u'\n' # 0x000a -> LINE FEED - u'\x0b' # 0x000b -> VERTICAL TABULATION - u'\x0c' # 0x000c -> FORM FEED - u'\r' # 0x000d -> CARRIAGE RETURN - u'\x0e' # 0x000e -> SHIFT OUT - u'\x0f' # 0x000f -> SHIFT IN - u'\x10' # 0x0010 -> DATA LINK ESCAPE - u'\x11' # 0x0011 -> DEVICE CONTROL ONE - u'\x12' # 0x0012 -> DEVICE CONTROL TWO - u'\x13' # 0x0013 -> DEVICE CONTROL THREE - u'\x14' # 0x0014 -> DEVICE CONTROL FOUR - u'\x15' # 0x0015 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x0016 -> SYNCHRONOUS IDLE - u'\x17' # 0x0017 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x0018 -> CANCEL - u'\x19' # 0x0019 -> END OF MEDIUM - u'\x1a' # 0x001a -> SUBSTITUTE - u'\x1b' # 0x001b -> ESCAPE - u'\x1c' # 0x001c -> FILE SEPARATOR - u'\x1d' # 0x001d -> GROUP SEPARATOR - u'\x1e' # 0x001e -> RECORD SEPARATOR - u'\x1f' # 0x001f -> UNIT SEPARATOR - u' ' # 0x0020 -> SPACE - u'!' # 0x0021 -> EXCLAMATION MARK - u'"' # 0x0022 -> QUOTATION MARK - u'#' # 0x0023 -> NUMBER SIGN - u'$' # 0x0024 -> DOLLAR SIGN - u'%' # 0x0025 -> PERCENT SIGN - u'&' # 0x0026 -> AMPERSAND - u"'" # 0x0027 -> APOSTROPHE - u'(' # 0x0028 -> LEFT PARENTHESIS - u')' # 0x0029 -> RIGHT PARENTHESIS - u'*' # 0x002a -> ASTERISK - u'+' # 0x002b -> PLUS SIGN - u',' # 0x002c -> COMMA - u'-' # 0x002d -> HYPHEN-MINUS - u'.' # 0x002e -> FULL STOP - u'/' # 0x002f -> SOLIDUS - u'0' # 0x0030 -> DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE - u':' # 0x003a -> COLON - u';' # 0x003b -> SEMICOLON - u'<' # 0x003c -> LESS-THAN SIGN - u'=' # 0x003d -> EQUALS SIGN - u'>' # 0x003e -> GREATER-THAN SIGN - u'?' # 0x003f -> QUESTION MARK - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET - u'\\' # 0x005c -> REVERSE SOLIDUS - u']' # 0x005d -> RIGHT SQUARE BRACKET - u'^' # 0x005e -> CIRCUMFLEX ACCENT - u'_' # 0x005f -> LOW LINE - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET - u'|' # 0x007c -> VERTICAL LINE - u'}' # 0x007d -> RIGHT CURLY BRACKET - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> DELETE - u'\ufffe' # 0x0080 -> UNDEFINED - u'\ufffe' # 0x0081 -> UNDEFINED - u'\ufffe' # 0x0082 -> UNDEFINED - u'\ufffe' # 0x0083 -> UNDEFINED - u'\ufffe' # 0x0084 -> UNDEFINED - u'\ufffe' # 0x0085 -> UNDEFINED - u'\u0386' # 0x0086 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\ufffe' # 0x0087 -> UNDEFINED - u'\xb7' # 0x0088 -> MIDDLE DOT - u'\xac' # 0x0089 -> NOT SIGN - u'\xa6' # 0x008a -> BROKEN BAR - u'\u2018' # 0x008b -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x008c -> RIGHT SINGLE QUOTATION MARK - u'\u0388' # 0x008d -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u2015' # 0x008e -> HORIZONTAL BAR - u'\u0389' # 0x008f -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0x0090 -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u03aa' # 0x0091 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u038c' # 0x0092 -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\ufffe' # 0x0093 -> UNDEFINED - u'\ufffe' # 0x0094 -> UNDEFINED - u'\u038e' # 0x0095 -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u03ab' # 0x0096 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\xa9' # 0x0097 -> COPYRIGHT SIGN - u'\u038f' # 0x0098 -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\xb2' # 0x0099 -> SUPERSCRIPT TWO - u'\xb3' # 0x009a -> SUPERSCRIPT THREE - u'\u03ac' # 0x009b -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\xa3' # 0x009c -> POUND SIGN - u'\u03ad' # 0x009d -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0x009e -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0x009f -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03ca' # 0x00a0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u0390' # 0x00a1 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u03cc' # 0x00a2 -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0x00a3 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u0391' # 0x00a4 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0x00a5 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0x00a6 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0x00a7 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0x00a8 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0x00a9 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0x00aa -> GREEK CAPITAL LETTER ETA - u'\xbd' # 0x00ab -> VULGAR FRACTION ONE HALF - u'\u0398' # 0x00ac -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0x00ad -> GREEK CAPITAL LETTER IOTA - u'\xab' # 0x00ae -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0x00af -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2591' # 0x00b0 -> LIGHT SHADE - u'\u2592' # 0x00b1 -> MEDIUM SHADE - u'\u2593' # 0x00b2 -> DARK SHADE - u'\u2502' # 0x00b3 -> BOX DRAWINGS LIGHT VERTICAL - u'\u2524' # 0x00b4 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u039a' # 0x00b5 -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0x00b6 -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0x00b7 -> GREEK CAPITAL LETTER MU - u'\u039d' # 0x00b8 -> GREEK CAPITAL LETTER NU - u'\u2563' # 0x00b9 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2551' # 0x00ba -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2557' # 0x00bb -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u255d' # 0x00bc -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u039e' # 0x00bd -> GREEK CAPITAL LETTER XI - u'\u039f' # 0x00be -> GREEK CAPITAL LETTER OMICRON - u'\u2510' # 0x00bf -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x00c0 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2534' # 0x00c1 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u252c' # 0x00c2 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u251c' # 0x00c3 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2500' # 0x00c4 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u253c' # 0x00c5 -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u03a0' # 0x00c6 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0x00c7 -> GREEK CAPITAL LETTER RHO - u'\u255a' # 0x00c8 -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u2554' # 0x00c9 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2569' # 0x00ca -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u2566' # 0x00cb -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2560' # 0x00cc -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2550' # 0x00cd -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u256c' # 0x00ce -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\u03a3' # 0x00cf -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0x00d0 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0x00d1 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0x00d2 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0x00d3 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0x00d4 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0x00d5 -> GREEK CAPITAL LETTER OMEGA - u'\u03b1' # 0x00d6 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0x00d7 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0x00d8 -> GREEK SMALL LETTER GAMMA - u'\u2518' # 0x00d9 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u250c' # 0x00da -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2588' # 0x00db -> FULL BLOCK - u'\u2584' # 0x00dc -> LOWER HALF BLOCK - u'\u03b4' # 0x00dd -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0x00de -> GREEK SMALL LETTER EPSILON - u'\u2580' # 0x00df -> UPPER HALF BLOCK - u'\u03b6' # 0x00e0 -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0x00e1 -> GREEK SMALL LETTER ETA - u'\u03b8' # 0x00e2 -> GREEK SMALL LETTER THETA - u'\u03b9' # 0x00e3 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0x00e4 -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0x00e5 -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0x00e6 -> GREEK SMALL LETTER MU - u'\u03bd' # 0x00e7 -> GREEK SMALL LETTER NU - u'\u03be' # 0x00e8 -> GREEK SMALL LETTER XI - u'\u03bf' # 0x00e9 -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0x00ea -> GREEK SMALL LETTER PI - u'\u03c1' # 0x00eb -> GREEK SMALL LETTER RHO - u'\u03c3' # 0x00ec -> GREEK SMALL LETTER SIGMA - u'\u03c2' # 0x00ed -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c4' # 0x00ee -> GREEK SMALL LETTER TAU - u'\u0384' # 0x00ef -> GREEK TONOS - u'\xad' # 0x00f0 -> SOFT HYPHEN - u'\xb1' # 0x00f1 -> PLUS-MINUS SIGN - u'\u03c5' # 0x00f2 -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0x00f3 -> GREEK SMALL LETTER PHI - u'\u03c7' # 0x00f4 -> GREEK SMALL LETTER CHI - u'\xa7' # 0x00f5 -> SECTION SIGN - u'\u03c8' # 0x00f6 -> GREEK SMALL LETTER PSI - u'\u0385' # 0x00f7 -> GREEK DIALYTIKA TONOS - u'\xb0' # 0x00f8 -> DEGREE SIGN - u'\xa8' # 0x00f9 -> DIAERESIS - u'\u03c9' # 0x00fa -> GREEK SMALL LETTER OMEGA - u'\u03cb' # 0x00fb -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03b0' # 0x00fc -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u03ce' # 0x00fd -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u25a0' # 0x00fe -> BLACK SQUARE - u'\xa0' # 0x00ff -> NO-BREAK SPACE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # NULL - 0x0001: 0x0001, # START OF HEADING - 0x0002: 0x0002, # START OF TEXT - 0x0003: 0x0003, # END OF TEXT - 0x0004: 0x0004, # END OF TRANSMISSION - 0x0005: 0x0005, # ENQUIRY - 0x0006: 0x0006, # ACKNOWLEDGE - 0x0007: 0x0007, # BELL - 0x0008: 0x0008, # BACKSPACE - 0x0009: 0x0009, # HORIZONTAL TABULATION - 0x000a: 0x000a, # LINE FEED - 0x000b: 0x000b, # VERTICAL TABULATION - 0x000c: 0x000c, # FORM FEED - 0x000d: 0x000d, # CARRIAGE RETURN - 0x000e: 0x000e, # SHIFT OUT - 0x000f: 0x000f, # SHIFT IN - 0x0010: 0x0010, # DATA LINK ESCAPE - 0x0011: 0x0011, # DEVICE CONTROL ONE - 0x0012: 0x0012, # DEVICE CONTROL TWO - 0x0013: 0x0013, # DEVICE CONTROL THREE - 0x0014: 0x0014, # DEVICE CONTROL FOUR - 0x0015: 0x0015, # NEGATIVE ACKNOWLEDGE - 0x0016: 0x0016, # SYNCHRONOUS IDLE - 0x0017: 0x0017, # END OF TRANSMISSION BLOCK - 0x0018: 0x0018, # CANCEL - 0x0019: 0x0019, # END OF MEDIUM - 0x001a: 0x001a, # SUBSTITUTE - 0x001b: 0x001b, # ESCAPE - 0x001c: 0x001c, # FILE SEPARATOR - 0x001d: 0x001d, # GROUP SEPARATOR - 0x001e: 0x001e, # RECORD SEPARATOR - 0x001f: 0x001f, # UNIT SEPARATOR - 0x0020: 0x0020, # SPACE - 0x0021: 0x0021, # EXCLAMATION MARK - 0x0022: 0x0022, # QUOTATION MARK - 0x0023: 0x0023, # NUMBER SIGN - 0x0024: 0x0024, # DOLLAR SIGN - 0x0025: 0x0025, # PERCENT SIGN - 0x0026: 0x0026, # AMPERSAND - 0x0027: 0x0027, # APOSTROPHE - 0x0028: 0x0028, # LEFT PARENTHESIS - 0x0029: 0x0029, # RIGHT PARENTHESIS - 0x002a: 0x002a, # ASTERISK - 0x002b: 0x002b, # PLUS SIGN - 0x002c: 0x002c, # COMMA - 0x002d: 0x002d, # HYPHEN-MINUS - 0x002e: 0x002e, # FULL STOP - 0x002f: 0x002f, # SOLIDUS - 0x0030: 0x0030, # DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE - 0x003a: 0x003a, # COLON - 0x003b: 0x003b, # SEMICOLON - 0x003c: 0x003c, # LESS-THAN SIGN - 0x003d: 0x003d, # EQUALS SIGN - 0x003e: 0x003e, # GREATER-THAN SIGN - 0x003f: 0x003f, # QUESTION MARK - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET - 0x005c: 0x005c, # REVERSE SOLIDUS - 0x005d: 0x005d, # RIGHT SQUARE BRACKET - 0x005e: 0x005e, # CIRCUMFLEX ACCENT - 0x005f: 0x005f, # LOW LINE - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET - 0x007c: 0x007c, # VERTICAL LINE - 0x007d: 0x007d, # RIGHT CURLY BRACKET - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # DELETE - 0x00a0: 0x00ff, # NO-BREAK SPACE - 0x00a3: 0x009c, # POUND SIGN - 0x00a6: 0x008a, # BROKEN BAR - 0x00a7: 0x00f5, # SECTION SIGN - 0x00a8: 0x00f9, # DIAERESIS - 0x00a9: 0x0097, # COPYRIGHT SIGN - 0x00ab: 0x00ae, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00ac: 0x0089, # NOT SIGN - 0x00ad: 0x00f0, # SOFT HYPHEN - 0x00b0: 0x00f8, # DEGREE SIGN - 0x00b1: 0x00f1, # PLUS-MINUS SIGN - 0x00b2: 0x0099, # SUPERSCRIPT TWO - 0x00b3: 0x009a, # SUPERSCRIPT THREE - 0x00b7: 0x0088, # MIDDLE DOT - 0x00bb: 0x00af, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00bd: 0x00ab, # VULGAR FRACTION ONE HALF - 0x0384: 0x00ef, # GREEK TONOS - 0x0385: 0x00f7, # GREEK DIALYTIKA TONOS - 0x0386: 0x0086, # GREEK CAPITAL LETTER ALPHA WITH TONOS - 0x0388: 0x008d, # GREEK CAPITAL LETTER EPSILON WITH TONOS - 0x0389: 0x008f, # GREEK CAPITAL LETTER ETA WITH TONOS - 0x038a: 0x0090, # GREEK CAPITAL LETTER IOTA WITH TONOS - 0x038c: 0x0092, # GREEK CAPITAL LETTER OMICRON WITH TONOS - 0x038e: 0x0095, # GREEK CAPITAL LETTER UPSILON WITH TONOS - 0x038f: 0x0098, # GREEK CAPITAL LETTER OMEGA WITH TONOS - 0x0390: 0x00a1, # GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - 0x0391: 0x00a4, # GREEK CAPITAL LETTER ALPHA - 0x0392: 0x00a5, # GREEK CAPITAL LETTER BETA - 0x0393: 0x00a6, # GREEK CAPITAL LETTER GAMMA - 0x0394: 0x00a7, # GREEK CAPITAL LETTER DELTA - 0x0395: 0x00a8, # GREEK CAPITAL LETTER EPSILON - 0x0396: 0x00a9, # GREEK CAPITAL LETTER ZETA - 0x0397: 0x00aa, # GREEK CAPITAL LETTER ETA - 0x0398: 0x00ac, # GREEK CAPITAL LETTER THETA - 0x0399: 0x00ad, # GREEK CAPITAL LETTER IOTA - 0x039a: 0x00b5, # GREEK CAPITAL LETTER KAPPA - 0x039b: 0x00b6, # GREEK CAPITAL LETTER LAMDA - 0x039c: 0x00b7, # GREEK CAPITAL LETTER MU - 0x039d: 0x00b8, # GREEK CAPITAL LETTER NU - 0x039e: 0x00bd, # GREEK CAPITAL LETTER XI - 0x039f: 0x00be, # GREEK CAPITAL LETTER OMICRON - 0x03a0: 0x00c6, # GREEK CAPITAL LETTER PI - 0x03a1: 0x00c7, # GREEK CAPITAL LETTER RHO - 0x03a3: 0x00cf, # GREEK CAPITAL LETTER SIGMA - 0x03a4: 0x00d0, # GREEK CAPITAL LETTER TAU - 0x03a5: 0x00d1, # GREEK CAPITAL LETTER UPSILON - 0x03a6: 0x00d2, # GREEK CAPITAL LETTER PHI - 0x03a7: 0x00d3, # GREEK CAPITAL LETTER CHI - 0x03a8: 0x00d4, # GREEK CAPITAL LETTER PSI - 0x03a9: 0x00d5, # GREEK CAPITAL LETTER OMEGA - 0x03aa: 0x0091, # GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - 0x03ab: 0x0096, # GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - 0x03ac: 0x009b, # GREEK SMALL LETTER ALPHA WITH TONOS - 0x03ad: 0x009d, # GREEK SMALL LETTER EPSILON WITH TONOS - 0x03ae: 0x009e, # GREEK SMALL LETTER ETA WITH TONOS - 0x03af: 0x009f, # GREEK SMALL LETTER IOTA WITH TONOS - 0x03b0: 0x00fc, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - 0x03b1: 0x00d6, # GREEK SMALL LETTER ALPHA - 0x03b2: 0x00d7, # GREEK SMALL LETTER BETA - 0x03b3: 0x00d8, # GREEK SMALL LETTER GAMMA - 0x03b4: 0x00dd, # GREEK SMALL LETTER DELTA - 0x03b5: 0x00de, # GREEK SMALL LETTER EPSILON - 0x03b6: 0x00e0, # GREEK SMALL LETTER ZETA - 0x03b7: 0x00e1, # GREEK SMALL LETTER ETA - 0x03b8: 0x00e2, # GREEK SMALL LETTER THETA - 0x03b9: 0x00e3, # GREEK SMALL LETTER IOTA - 0x03ba: 0x00e4, # GREEK SMALL LETTER KAPPA - 0x03bb: 0x00e5, # GREEK SMALL LETTER LAMDA - 0x03bc: 0x00e6, # GREEK SMALL LETTER MU - 0x03bd: 0x00e7, # GREEK SMALL LETTER NU - 0x03be: 0x00e8, # GREEK SMALL LETTER XI - 0x03bf: 0x00e9, # GREEK SMALL LETTER OMICRON - 0x03c0: 0x00ea, # GREEK SMALL LETTER PI - 0x03c1: 0x00eb, # GREEK SMALL LETTER RHO - 0x03c2: 0x00ed, # GREEK SMALL LETTER FINAL SIGMA - 0x03c3: 0x00ec, # GREEK SMALL LETTER SIGMA - 0x03c4: 0x00ee, # GREEK SMALL LETTER TAU - 0x03c5: 0x00f2, # GREEK SMALL LETTER UPSILON - 0x03c6: 0x00f3, # GREEK SMALL LETTER PHI - 0x03c7: 0x00f4, # GREEK SMALL LETTER CHI - 0x03c8: 0x00f6, # GREEK SMALL LETTER PSI - 0x03c9: 0x00fa, # GREEK SMALL LETTER OMEGA - 0x03ca: 0x00a0, # GREEK SMALL LETTER IOTA WITH DIALYTIKA - 0x03cb: 0x00fb, # GREEK SMALL LETTER UPSILON WITH DIALYTIKA - 0x03cc: 0x00a2, # GREEK SMALL LETTER OMICRON WITH TONOS - 0x03cd: 0x00a3, # GREEK SMALL LETTER UPSILON WITH TONOS - 0x03ce: 0x00fd, # GREEK SMALL LETTER OMEGA WITH TONOS - 0x2015: 0x008e, # HORIZONTAL BAR - 0x2018: 0x008b, # LEFT SINGLE QUOTATION MARK - 0x2019: 0x008c, # RIGHT SINGLE QUOTATION MARK - 0x2500: 0x00c4, # BOX DRAWINGS LIGHT HORIZONTAL - 0x2502: 0x00b3, # BOX DRAWINGS LIGHT VERTICAL - 0x250c: 0x00da, # BOX DRAWINGS LIGHT DOWN AND RIGHT - 0x2510: 0x00bf, # BOX DRAWINGS LIGHT DOWN AND LEFT - 0x2514: 0x00c0, # BOX DRAWINGS LIGHT UP AND RIGHT - 0x2518: 0x00d9, # BOX DRAWINGS LIGHT UP AND LEFT - 0x251c: 0x00c3, # BOX DRAWINGS LIGHT VERTICAL AND RIGHT - 0x2524: 0x00b4, # BOX DRAWINGS LIGHT VERTICAL AND LEFT - 0x252c: 0x00c2, # BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - 0x2534: 0x00c1, # BOX DRAWINGS LIGHT UP AND HORIZONTAL - 0x253c: 0x00c5, # BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - 0x2550: 0x00cd, # BOX DRAWINGS DOUBLE HORIZONTAL - 0x2551: 0x00ba, # BOX DRAWINGS DOUBLE VERTICAL - 0x2554: 0x00c9, # BOX DRAWINGS DOUBLE DOWN AND RIGHT - 0x2557: 0x00bb, # BOX DRAWINGS DOUBLE DOWN AND LEFT - 0x255a: 0x00c8, # BOX DRAWINGS DOUBLE UP AND RIGHT - 0x255d: 0x00bc, # BOX DRAWINGS DOUBLE UP AND LEFT - 0x2560: 0x00cc, # BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - 0x2563: 0x00b9, # BOX DRAWINGS DOUBLE VERTICAL AND LEFT - 0x2566: 0x00cb, # BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - 0x2569: 0x00ca, # BOX DRAWINGS DOUBLE UP AND HORIZONTAL - 0x256c: 0x00ce, # BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - 0x2580: 0x00df, # UPPER HALF BLOCK - 0x2584: 0x00dc, # LOWER HALF BLOCK - 0x2588: 0x00db, # FULL BLOCK - 0x2591: 0x00b0, # LIGHT SHADE - 0x2592: 0x00b1, # MEDIUM SHADE - 0x2593: 0x00b2, # DARK SHADE - 0x25a0: 0x00fe, # BLACK SQUARE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py deleted file mode 100644 index 66f112f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp874.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp874 generated from 'MAPPINGS/VENDORS/MICSFT/WINDOWS/CP874.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp874', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u20ac' # 0x80 -> EURO SIGN - u'\ufffe' # 0x81 -> UNDEFINED - u'\ufffe' # 0x82 -> UNDEFINED - u'\ufffe' # 0x83 -> UNDEFINED - u'\ufffe' # 0x84 -> UNDEFINED - u'\u2026' # 0x85 -> HORIZONTAL ELLIPSIS - u'\ufffe' # 0x86 -> UNDEFINED - u'\ufffe' # 0x87 -> UNDEFINED - u'\ufffe' # 0x88 -> UNDEFINED - u'\ufffe' # 0x89 -> UNDEFINED - u'\ufffe' # 0x8A -> UNDEFINED - u'\ufffe' # 0x8B -> UNDEFINED - u'\ufffe' # 0x8C -> UNDEFINED - u'\ufffe' # 0x8D -> UNDEFINED - u'\ufffe' # 0x8E -> UNDEFINED - u'\ufffe' # 0x8F -> UNDEFINED - u'\ufffe' # 0x90 -> UNDEFINED - u'\u2018' # 0x91 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0x92 -> RIGHT SINGLE QUOTATION MARK - u'\u201c' # 0x93 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0x94 -> RIGHT DOUBLE QUOTATION MARK - u'\u2022' # 0x95 -> BULLET - u'\u2013' # 0x96 -> EN DASH - u'\u2014' # 0x97 -> EM DASH - u'\ufffe' # 0x98 -> UNDEFINED - u'\ufffe' # 0x99 -> UNDEFINED - u'\ufffe' # 0x9A -> UNDEFINED - u'\ufffe' # 0x9B -> UNDEFINED - u'\ufffe' # 0x9C -> UNDEFINED - u'\ufffe' # 0x9D -> UNDEFINED - u'\ufffe' # 0x9E -> UNDEFINED - u'\ufffe' # 0x9F -> UNDEFINED - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI - u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI - u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT - u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI - u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON - u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG - u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU - u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN - u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING - u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG - u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO - u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE - u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING - u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA - u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK - u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN - u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO - u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO - u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN - u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK - u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO - u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG - u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN - u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG - u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU - u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI - u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA - u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG - u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA - u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN - u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN - u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO - u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA - u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK - u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA - u'\u0e24' # 0xC4 -> THAI CHARACTER RU - u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING - u'\u0e26' # 0xC6 -> THAI CHARACTER LU - u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN - u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA - u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI - u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA - u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP - u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA - u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG - u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK - u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI - u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A - u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT - u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA - u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM - u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I - u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II - u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE - u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE - u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U - u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU - u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU - u'\ufffe' # 0xDB -> UNDEFINED - u'\ufffe' # 0xDC -> UNDEFINED - u'\ufffe' # 0xDD -> UNDEFINED - u'\ufffe' # 0xDE -> UNDEFINED - u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT - u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E - u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE - u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O - u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN - u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI - u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO - u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK - u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU - u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK - u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO - u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI - u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA - u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT - u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT - u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN - u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN - u'\u0e50' # 0xF0 -> THAI DIGIT ZERO - u'\u0e51' # 0xF1 -> THAI DIGIT ONE - u'\u0e52' # 0xF2 -> THAI DIGIT TWO - u'\u0e53' # 0xF3 -> THAI DIGIT THREE - u'\u0e54' # 0xF4 -> THAI DIGIT FOUR - u'\u0e55' # 0xF5 -> THAI DIGIT FIVE - u'\u0e56' # 0xF6 -> THAI DIGIT SIX - u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN - u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT - u'\u0e59' # 0xF9 -> THAI DIGIT NINE - u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU - u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT - u'\ufffe' # 0xFC -> UNDEFINED - u'\ufffe' # 0xFD -> UNDEFINED - u'\ufffe' # 0xFE -> UNDEFINED - u'\ufffe' # 0xFF -> UNDEFINED -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py deleted file mode 100644 index 50bbef3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp875.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec cp875 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP875.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='cp875', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x9c' # 0x04 -> CONTROL - u'\t' # 0x05 -> HORIZONTAL TABULATION - u'\x86' # 0x06 -> CONTROL - u'\x7f' # 0x07 -> DELETE - u'\x97' # 0x08 -> CONTROL - u'\x8d' # 0x09 -> CONTROL - u'\x8e' # 0x0A -> CONTROL - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x9d' # 0x14 -> CONTROL - u'\x85' # 0x15 -> CONTROL - u'\x08' # 0x16 -> BACKSPACE - u'\x87' # 0x17 -> CONTROL - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x92' # 0x1A -> CONTROL - u'\x8f' # 0x1B -> CONTROL - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u'\x80' # 0x20 -> CONTROL - u'\x81' # 0x21 -> CONTROL - u'\x82' # 0x22 -> CONTROL - u'\x83' # 0x23 -> CONTROL - u'\x84' # 0x24 -> CONTROL - u'\n' # 0x25 -> LINE FEED - u'\x17' # 0x26 -> END OF TRANSMISSION BLOCK - u'\x1b' # 0x27 -> ESCAPE - u'\x88' # 0x28 -> CONTROL - u'\x89' # 0x29 -> CONTROL - u'\x8a' # 0x2A -> CONTROL - u'\x8b' # 0x2B -> CONTROL - u'\x8c' # 0x2C -> CONTROL - u'\x05' # 0x2D -> ENQUIRY - u'\x06' # 0x2E -> ACKNOWLEDGE - u'\x07' # 0x2F -> BELL - u'\x90' # 0x30 -> CONTROL - u'\x91' # 0x31 -> CONTROL - u'\x16' # 0x32 -> SYNCHRONOUS IDLE - u'\x93' # 0x33 -> CONTROL - u'\x94' # 0x34 -> CONTROL - u'\x95' # 0x35 -> CONTROL - u'\x96' # 0x36 -> CONTROL - u'\x04' # 0x37 -> END OF TRANSMISSION - u'\x98' # 0x38 -> CONTROL - u'\x99' # 0x39 -> CONTROL - u'\x9a' # 0x3A -> CONTROL - u'\x9b' # 0x3B -> CONTROL - u'\x14' # 0x3C -> DEVICE CONTROL FOUR - u'\x15' # 0x3D -> NEGATIVE ACKNOWLEDGE - u'\x9e' # 0x3E -> CONTROL - u'\x1a' # 0x3F -> SUBSTITUTE - u' ' # 0x40 -> SPACE - u'\u0391' # 0x41 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0x42 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0x43 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0x44 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0x45 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0x46 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0x47 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0x48 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0x49 -> GREEK CAPITAL LETTER IOTA - u'[' # 0x4A -> LEFT SQUARE BRACKET - u'.' # 0x4B -> FULL STOP - u'<' # 0x4C -> LESS-THAN SIGN - u'(' # 0x4D -> LEFT PARENTHESIS - u'+' # 0x4E -> PLUS SIGN - u'!' # 0x4F -> EXCLAMATION MARK - u'&' # 0x50 -> AMPERSAND - u'\u039a' # 0x51 -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0x52 -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0x53 -> GREEK CAPITAL LETTER MU - u'\u039d' # 0x54 -> GREEK CAPITAL LETTER NU - u'\u039e' # 0x55 -> GREEK CAPITAL LETTER XI - u'\u039f' # 0x56 -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0x57 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0x58 -> GREEK CAPITAL LETTER RHO - u'\u03a3' # 0x59 -> GREEK CAPITAL LETTER SIGMA - u']' # 0x5A -> RIGHT SQUARE BRACKET - u'$' # 0x5B -> DOLLAR SIGN - u'*' # 0x5C -> ASTERISK - u')' # 0x5D -> RIGHT PARENTHESIS - u';' # 0x5E -> SEMICOLON - u'^' # 0x5F -> CIRCUMFLEX ACCENT - u'-' # 0x60 -> HYPHEN-MINUS - u'/' # 0x61 -> SOLIDUS - u'\u03a4' # 0x62 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0x63 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0x64 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0x65 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0x66 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0x67 -> GREEK CAPITAL LETTER OMEGA - u'\u03aa' # 0x68 -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0x69 -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'|' # 0x6A -> VERTICAL LINE - u',' # 0x6B -> COMMA - u'%' # 0x6C -> PERCENT SIGN - u'_' # 0x6D -> LOW LINE - u'>' # 0x6E -> GREATER-THAN SIGN - u'?' # 0x6F -> QUESTION MARK - u'\xa8' # 0x70 -> DIAERESIS - u'\u0386' # 0x71 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\u0388' # 0x72 -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0x73 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\xa0' # 0x74 -> NO-BREAK SPACE - u'\u038a' # 0x75 -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u038c' # 0x76 -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\u038e' # 0x77 -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0x78 -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'`' # 0x79 -> GRAVE ACCENT - u':' # 0x7A -> COLON - u'#' # 0x7B -> NUMBER SIGN - u'@' # 0x7C -> COMMERCIAL AT - u"'" # 0x7D -> APOSTROPHE - u'=' # 0x7E -> EQUALS SIGN - u'"' # 0x7F -> QUOTATION MARK - u'\u0385' # 0x80 -> GREEK DIALYTIKA TONOS - u'a' # 0x81 -> LATIN SMALL LETTER A - u'b' # 0x82 -> LATIN SMALL LETTER B - u'c' # 0x83 -> LATIN SMALL LETTER C - u'd' # 0x84 -> LATIN SMALL LETTER D - u'e' # 0x85 -> LATIN SMALL LETTER E - u'f' # 0x86 -> LATIN SMALL LETTER F - u'g' # 0x87 -> LATIN SMALL LETTER G - u'h' # 0x88 -> LATIN SMALL LETTER H - u'i' # 0x89 -> LATIN SMALL LETTER I - u'\u03b1' # 0x8A -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0x8B -> GREEK SMALL LETTER BETA - u'\u03b3' # 0x8C -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0x8D -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0x8E -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0x8F -> GREEK SMALL LETTER ZETA - u'\xb0' # 0x90 -> DEGREE SIGN - u'j' # 0x91 -> LATIN SMALL LETTER J - u'k' # 0x92 -> LATIN SMALL LETTER K - u'l' # 0x93 -> LATIN SMALL LETTER L - u'm' # 0x94 -> LATIN SMALL LETTER M - u'n' # 0x95 -> LATIN SMALL LETTER N - u'o' # 0x96 -> LATIN SMALL LETTER O - u'p' # 0x97 -> LATIN SMALL LETTER P - u'q' # 0x98 -> LATIN SMALL LETTER Q - u'r' # 0x99 -> LATIN SMALL LETTER R - u'\u03b7' # 0x9A -> GREEK SMALL LETTER ETA - u'\u03b8' # 0x9B -> GREEK SMALL LETTER THETA - u'\u03b9' # 0x9C -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0x9D -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0x9E -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0x9F -> GREEK SMALL LETTER MU - u'\xb4' # 0xA0 -> ACUTE ACCENT - u'~' # 0xA1 -> TILDE - u's' # 0xA2 -> LATIN SMALL LETTER S - u't' # 0xA3 -> LATIN SMALL LETTER T - u'u' # 0xA4 -> LATIN SMALL LETTER U - u'v' # 0xA5 -> LATIN SMALL LETTER V - u'w' # 0xA6 -> LATIN SMALL LETTER W - u'x' # 0xA7 -> LATIN SMALL LETTER X - u'y' # 0xA8 -> LATIN SMALL LETTER Y - u'z' # 0xA9 -> LATIN SMALL LETTER Z - u'\u03bd' # 0xAA -> GREEK SMALL LETTER NU - u'\u03be' # 0xAB -> GREEK SMALL LETTER XI - u'\u03bf' # 0xAC -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xAD -> GREEK SMALL LETTER PI - u'\u03c1' # 0xAE -> GREEK SMALL LETTER RHO - u'\u03c3' # 0xAF -> GREEK SMALL LETTER SIGMA - u'\xa3' # 0xB0 -> POUND SIGN - u'\u03ac' # 0xB1 -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0xB2 -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xB3 -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03ca' # 0xB4 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03af' # 0xB5 -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03cc' # 0xB6 -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0xB7 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03cb' # 0xB8 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03ce' # 0xB9 -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u03c2' # 0xBA -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c4' # 0xBB -> GREEK SMALL LETTER TAU - u'\u03c5' # 0xBC -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0xBD -> GREEK SMALL LETTER PHI - u'\u03c7' # 0xBE -> GREEK SMALL LETTER CHI - u'\u03c8' # 0xBF -> GREEK SMALL LETTER PSI - u'{' # 0xC0 -> LEFT CURLY BRACKET - u'A' # 0xC1 -> LATIN CAPITAL LETTER A - u'B' # 0xC2 -> LATIN CAPITAL LETTER B - u'C' # 0xC3 -> LATIN CAPITAL LETTER C - u'D' # 0xC4 -> LATIN CAPITAL LETTER D - u'E' # 0xC5 -> LATIN CAPITAL LETTER E - u'F' # 0xC6 -> LATIN CAPITAL LETTER F - u'G' # 0xC7 -> LATIN CAPITAL LETTER G - u'H' # 0xC8 -> LATIN CAPITAL LETTER H - u'I' # 0xC9 -> LATIN CAPITAL LETTER I - u'\xad' # 0xCA -> SOFT HYPHEN - u'\u03c9' # 0xCB -> GREEK SMALL LETTER OMEGA - u'\u0390' # 0xCC -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u03b0' # 0xCD -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u2018' # 0xCE -> LEFT SINGLE QUOTATION MARK - u'\u2015' # 0xCF -> HORIZONTAL BAR - u'}' # 0xD0 -> RIGHT CURLY BRACKET - u'J' # 0xD1 -> LATIN CAPITAL LETTER J - u'K' # 0xD2 -> LATIN CAPITAL LETTER K - u'L' # 0xD3 -> LATIN CAPITAL LETTER L - u'M' # 0xD4 -> LATIN CAPITAL LETTER M - u'N' # 0xD5 -> LATIN CAPITAL LETTER N - u'O' # 0xD6 -> LATIN CAPITAL LETTER O - u'P' # 0xD7 -> LATIN CAPITAL LETTER P - u'Q' # 0xD8 -> LATIN CAPITAL LETTER Q - u'R' # 0xD9 -> LATIN CAPITAL LETTER R - u'\xb1' # 0xDA -> PLUS-MINUS SIGN - u'\xbd' # 0xDB -> VULGAR FRACTION ONE HALF - u'\x1a' # 0xDC -> SUBSTITUTE - u'\u0387' # 0xDD -> GREEK ANO TELEIA - u'\u2019' # 0xDE -> RIGHT SINGLE QUOTATION MARK - u'\xa6' # 0xDF -> BROKEN BAR - u'\\' # 0xE0 -> REVERSE SOLIDUS - u'\x1a' # 0xE1 -> SUBSTITUTE - u'S' # 0xE2 -> LATIN CAPITAL LETTER S - u'T' # 0xE3 -> LATIN CAPITAL LETTER T - u'U' # 0xE4 -> LATIN CAPITAL LETTER U - u'V' # 0xE5 -> LATIN CAPITAL LETTER V - u'W' # 0xE6 -> LATIN CAPITAL LETTER W - u'X' # 0xE7 -> LATIN CAPITAL LETTER X - u'Y' # 0xE8 -> LATIN CAPITAL LETTER Y - u'Z' # 0xE9 -> LATIN CAPITAL LETTER Z - u'\xb2' # 0xEA -> SUPERSCRIPT TWO - u'\xa7' # 0xEB -> SECTION SIGN - u'\x1a' # 0xEC -> SUBSTITUTE - u'\x1a' # 0xED -> SUBSTITUTE - u'\xab' # 0xEE -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xEF -> NOT SIGN - u'0' # 0xF0 -> DIGIT ZERO - u'1' # 0xF1 -> DIGIT ONE - u'2' # 0xF2 -> DIGIT TWO - u'3' # 0xF3 -> DIGIT THREE - u'4' # 0xF4 -> DIGIT FOUR - u'5' # 0xF5 -> DIGIT FIVE - u'6' # 0xF6 -> DIGIT SIX - u'7' # 0xF7 -> DIGIT SEVEN - u'8' # 0xF8 -> DIGIT EIGHT - u'9' # 0xF9 -> DIGIT NINE - u'\xb3' # 0xFA -> SUPERSCRIPT THREE - u'\xa9' # 0xFB -> COPYRIGHT SIGN - u'\x1a' # 0xFC -> SUBSTITUTE - u'\x1a' # 0xFD -> SUBSTITUTE - u'\xbb' # 0xFE -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\x9f' # 0xFF -> CONTROL -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py deleted file mode 100644 index 6321c20..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp932.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# cp932.py: Python Unicode Codec for CP932 -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('cp932') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='cp932', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py deleted file mode 100644 index 1d9725d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp949.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# cp949.py: Python Unicode Codec for CP949 -# -# Written by Hye-Shik Chang -# - -import _codecs_kr, codecs -import _multibytecodec as mbc - -codec = _codecs_kr.getcodec('cp949') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='cp949', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py deleted file mode 100644 index e7772b1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/cp950.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# cp950.py: Python Unicode Codec for CP950 -# -# Written by Hye-Shik Chang -# - -import _codecs_tw, codecs -import _multibytecodec as mbc - -codec = _codecs_tw.getcodec('cp950') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='cp950', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py deleted file mode 100644 index bb35520..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jis_2004.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# euc_jis_2004.py: Python Unicode Codec for EUC_JIS_2004 -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('euc_jis_2004') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='euc_jis_2004', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py deleted file mode 100644 index 9914c4f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jisx0213.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# euc_jisx0213.py: Python Unicode Codec for EUC_JISX0213 -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('euc_jisx0213') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='euc_jisx0213', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py deleted file mode 100644 index 29406b6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_jp.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# euc_jp.py: Python Unicode Codec for EUC_JP -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('euc_jp') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='euc_jp', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py deleted file mode 100644 index 7d5eca4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/euc_kr.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# euc_kr.py: Python Unicode Codec for EUC_KR -# -# Written by Hye-Shik Chang -# - -import _codecs_kr, codecs -import _multibytecodec as mbc - -codec = _codecs_kr.getcodec('euc_kr') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='euc_kr', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py deleted file mode 100644 index 99059ff..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb18030.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# gb18030.py: Python Unicode Codec for GB18030 -# -# Written by Hye-Shik Chang -# - -import _codecs_cn, codecs -import _multibytecodec as mbc - -codec = _codecs_cn.getcodec('gb18030') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='gb18030', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py deleted file mode 100644 index 4e396fa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gb2312.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# gb2312.py: Python Unicode Codec for GB2312 -# -# Written by Hye-Shik Chang -# - -import _codecs_cn, codecs -import _multibytecodec as mbc - -codec = _codecs_cn.getcodec('gb2312') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='gb2312', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py deleted file mode 100644 index 0fd2734..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/gbk.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# gbk.py: Python Unicode Codec for GBK -# -# Written by Hye-Shik Chang -# - -import _codecs_cn, codecs -import _multibytecodec as mbc - -codec = _codecs_cn.getcodec('gbk') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='gbk', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py deleted file mode 100644 index 5262bff..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hex_codec.py +++ /dev/null @@ -1,79 +0,0 @@ -""" Python 'hex_codec' Codec - 2-digit hex content transfer encoding - - Unlike most of the other codecs which target Unicode, this codec - will return Python string objects for both encode and decode. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - -""" -import codecs, binascii - -### Codec APIs - -def hex_encode(input,errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = binascii.b2a_hex(input) - return (output, len(input)) - -def hex_decode(input,errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = binascii.a2b_hex(input) - return (output, len(input)) - -class Codec(codecs.Codec): - - def encode(self, input,errors='strict'): - return hex_encode(input,errors) - def decode(self, input,errors='strict'): - return hex_decode(input,errors) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - assert self.errors == 'strict' - return binascii.b2a_hex(input) - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - assert self.errors == 'strict' - return binascii.a2b_hex(input) - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='hex', - encode=hex_encode, - decode=hex_decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py deleted file mode 100644 index 70c1ccc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hp_roman8.py +++ /dev/null @@ -1,152 +0,0 @@ -""" Python Character Mapping Codec generated from 'hp_roman8.txt' with gencodec.py. - - Based on data from ftp://dkuug.dk/i18n/charmaps/HP-ROMAN8 (Keld Simonsen) - - Original source: LaserJet IIP Printer User's Manual HP part no - 33471-90901, Hewlet-Packard, June 1989. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_map) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_map)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='hp-roman8', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x00a1: 0x00c0, # LATIN CAPITAL LETTER A WITH GRAVE - 0x00a2: 0x00c2, # LATIN CAPITAL LETTER A WITH CIRCUMFLEX - 0x00a3: 0x00c8, # LATIN CAPITAL LETTER E WITH GRAVE - 0x00a4: 0x00ca, # LATIN CAPITAL LETTER E WITH CIRCUMFLEX - 0x00a5: 0x00cb, # LATIN CAPITAL LETTER E WITH DIAERESIS - 0x00a6: 0x00ce, # LATIN CAPITAL LETTER I WITH CIRCUMFLEX - 0x00a7: 0x00cf, # LATIN CAPITAL LETTER I WITH DIAERESIS - 0x00a8: 0x00b4, # ACUTE ACCENT - 0x00a9: 0x02cb, # MODIFIER LETTER GRAVE ACCENT (Mandarin Chinese fourth tone) - 0x00aa: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT - 0x00ab: 0x00a8, # DIAERESIS - 0x00ac: 0x02dc, # SMALL TILDE - 0x00ad: 0x00d9, # LATIN CAPITAL LETTER U WITH GRAVE - 0x00ae: 0x00db, # LATIN CAPITAL LETTER U WITH CIRCUMFLEX - 0x00af: 0x20a4, # LIRA SIGN - 0x00b0: 0x00af, # MACRON - 0x00b1: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00b2: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00b3: 0x00b0, # DEGREE SIGN - 0x00b4: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00b5: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x00b6: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x00b7: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x00b8: 0x00a1, # INVERTED EXCLAMATION MARK - 0x00b9: 0x00bf, # INVERTED QUESTION MARK - 0x00ba: 0x00a4, # CURRENCY SIGN - 0x00bb: 0x00a3, # POUND SIGN - 0x00bc: 0x00a5, # YEN SIGN - 0x00bd: 0x00a7, # SECTION SIGN - 0x00be: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x00bf: 0x00a2, # CENT SIGN - 0x00c0: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00c1: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00c2: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00c3: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00c4: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x00c5: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x00c6: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x00c7: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x00c8: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x00c9: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x00ca: 0x00f2, # LATIN SMALL LETTER O WITH GRAVE - 0x00cb: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x00cc: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00cd: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ce: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00cf: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00d0: 0x00c5, # LATIN CAPITAL LETTER A WITH RING ABOVE - 0x00d1: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00d2: 0x00d8, # LATIN CAPITAL LETTER O WITH STROKE - 0x00d3: 0x00c6, # LATIN CAPITAL LETTER AE - 0x00d4: 0x00e5, # LATIN SMALL LETTER A WITH RING ABOVE - 0x00d5: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x00d6: 0x00f8, # LATIN SMALL LETTER O WITH STROKE - 0x00d7: 0x00e6, # LATIN SMALL LETTER AE - 0x00d8: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00d9: 0x00ec, # LATIN SMALL LETTER I WITH GRAVE - 0x00da: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00db: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00dc: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00dd: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00de: 0x00df, # LATIN SMALL LETTER SHARP S (German) - 0x00df: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00e0: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00e1: 0x00c3, # LATIN CAPITAL LETTER A WITH TILDE - 0x00e2: 0x00e3, # LATIN SMALL LETTER A WITH TILDE - 0x00e3: 0x00d0, # LATIN CAPITAL LETTER ETH (Icelandic) - 0x00e4: 0x00f0, # LATIN SMALL LETTER ETH (Icelandic) - 0x00e5: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00e6: 0x00cc, # LATIN CAPITAL LETTER I WITH GRAVE - 0x00e7: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00e8: 0x00d2, # LATIN CAPITAL LETTER O WITH GRAVE - 0x00e9: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00ea: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x00eb: 0x0160, # LATIN CAPITAL LETTER S WITH CARON - 0x00ec: 0x0161, # LATIN SMALL LETTER S WITH CARON - 0x00ed: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00ee: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS - 0x00ef: 0x00ff, # LATIN SMALL LETTER Y WITH DIAERESIS - 0x00f0: 0x00de, # LATIN CAPITAL LETTER THORN (Icelandic) - 0x00f1: 0x00fe, # LATIN SMALL LETTER THORN (Icelandic) - 0x00f2: 0x00b7, # MIDDLE DOT - 0x00f3: 0x00b5, # MICRO SIGN - 0x00f4: 0x00b6, # PILCROW SIGN - 0x00f5: 0x00be, # VULGAR FRACTION THREE QUARTERS - 0x00f6: 0x2014, # EM DASH - 0x00f7: 0x00bc, # VULGAR FRACTION ONE QUARTER - 0x00f8: 0x00bd, # VULGAR FRACTION ONE HALF - 0x00f9: 0x00aa, # FEMININE ORDINAL INDICATOR - 0x00fa: 0x00ba, # MASCULINE ORDINAL INDICATOR - 0x00fb: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00fc: 0x25a0, # BLACK SQUARE - 0x00fd: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00fe: 0x00b1, # PLUS-MINUS SIGN - 0x00ff: None, -}) - -### Encoding Map - -encoding_map = codecs.make_encoding_map(decoding_map) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py deleted file mode 100644 index 027c4fb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/hz.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# hz.py: Python Unicode Codec for HZ -# -# Written by Hye-Shik Chang -# - -import _codecs_cn, codecs -import _multibytecodec as mbc - -codec = _codecs_cn.getcodec('hz') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='hz', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py deleted file mode 100644 index ecbf2be..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/idna.py +++ /dev/null @@ -1,288 +0,0 @@ -# This module implements the RFCs 3490 (IDNA) and 3491 (Nameprep) - -import stringprep, re, codecs -from unicodedata import ucd_3_2_0 as unicodedata - -# IDNA section 3.1 -dots = re.compile(u"[\u002E\u3002\uFF0E\uFF61]") - -# IDNA section 5 -ace_prefix = "xn--" -uace_prefix = unicode(ace_prefix, "ascii") - -# This assumes query strings, so AllowUnassigned is true -def nameprep(label): - # Map - newlabel = [] - for c in label: - if stringprep.in_table_b1(c): - # Map to nothing - continue - newlabel.append(stringprep.map_table_b2(c)) - label = u"".join(newlabel) - - # Normalize - label = unicodedata.normalize("NFKC", label) - - # Prohibit - for c in label: - if stringprep.in_table_c12(c) or \ - stringprep.in_table_c22(c) or \ - stringprep.in_table_c3(c) or \ - stringprep.in_table_c4(c) or \ - stringprep.in_table_c5(c) or \ - stringprep.in_table_c6(c) or \ - stringprep.in_table_c7(c) or \ - stringprep.in_table_c8(c) or \ - stringprep.in_table_c9(c): - raise UnicodeError("Invalid character %r" % c) - - # Check bidi - RandAL = map(stringprep.in_table_d1, label) - for c in RandAL: - if c: - # There is a RandAL char in the string. Must perform further - # tests: - # 1) The characters in section 5.8 MUST be prohibited. - # This is table C.8, which was already checked - # 2) If a string contains any RandALCat character, the string - # MUST NOT contain any LCat character. - if filter(stringprep.in_table_d2, label): - raise UnicodeError("Violation of BIDI requirement 2") - - # 3) If a string contains any RandALCat character, a - # RandALCat character MUST be the first character of the - # string, and a RandALCat character MUST be the last - # character of the string. - if not RandAL[0] or not RandAL[-1]: - raise UnicodeError("Violation of BIDI requirement 3") - - return label - -def ToASCII(label): - try: - # Step 1: try ASCII - label = label.encode("ascii") - except UnicodeError: - pass - else: - # Skip to step 3: UseSTD3ASCIIRules is false, so - # Skip to step 8. - if 0 < len(label) < 64: - return label - raise UnicodeError("label empty or too long") - - # Step 2: nameprep - label = nameprep(label) - - # Step 3: UseSTD3ASCIIRules is false - # Step 4: try ASCII - try: - label = label.encode("ascii") - except UnicodeError: - pass - else: - # Skip to step 8. - if 0 < len(label) < 64: - return label - raise UnicodeError("label empty or too long") - - # Step 5: Check ACE prefix - if label.startswith(uace_prefix): - raise UnicodeError("Label starts with ACE prefix") - - # Step 6: Encode with PUNYCODE - label = label.encode("punycode") - - # Step 7: Prepend ACE prefix - label = ace_prefix + label - - # Step 8: Check size - if 0 < len(label) < 64: - return label - raise UnicodeError("label empty or too long") - -def ToUnicode(label): - # Step 1: Check for ASCII - if isinstance(label, str): - pure_ascii = True - else: - try: - label = label.encode("ascii") - pure_ascii = True - except UnicodeError: - pure_ascii = False - if not pure_ascii: - # Step 2: Perform nameprep - label = nameprep(label) - # It doesn't say this, but apparently, it should be ASCII now - try: - label = label.encode("ascii") - except UnicodeError: - raise UnicodeError("Invalid character in IDN label") - # Step 3: Check for ACE prefix - if not label.startswith(ace_prefix): - return unicode(label, "ascii") - - # Step 4: Remove ACE prefix - label1 = label[len(ace_prefix):] - - # Step 5: Decode using PUNYCODE - result = label1.decode("punycode") - - # Step 6: Apply ToASCII - label2 = ToASCII(result) - - # Step 7: Compare the result of step 6 with the one of step 3 - # label2 will already be in lower case. - if label.lower() != label2: - raise UnicodeError("IDNA does not round-trip", label, label2) - - # Step 8: return the result of step 5 - return result - -### Codec APIs - -class Codec(codecs.Codec): - def encode(self,input,errors='strict'): - - if errors != 'strict': - # IDNA is quite clear that implementations must be strict - raise UnicodeError("unsupported error handling "+errors) - - if not input: - return "", 0 - - result = [] - labels = dots.split(input) - if labels and len(labels[-1])==0: - trailing_dot = '.' - del labels[-1] - else: - trailing_dot = '' - for label in labels: - result.append(ToASCII(label)) - # Join with U+002E - return ".".join(result)+trailing_dot, len(input) - - def decode(self,input,errors='strict'): - - if errors != 'strict': - raise UnicodeError("Unsupported error handling "+errors) - - if not input: - return u"", 0 - - # IDNA allows decoding to operate on Unicode strings, too. - if isinstance(input, unicode): - labels = dots.split(input) - else: - # Must be ASCII string - input = str(input) - unicode(input, "ascii") - labels = input.split(".") - - if labels and len(labels[-1]) == 0: - trailing_dot = u'.' - del labels[-1] - else: - trailing_dot = u'' - - result = [] - for label in labels: - result.append(ToUnicode(label)) - - return u".".join(result)+trailing_dot, len(input) - -class IncrementalEncoder(codecs.BufferedIncrementalEncoder): - def _buffer_encode(self, input, errors, final): - if errors != 'strict': - # IDNA is quite clear that implementations must be strict - raise UnicodeError("unsupported error handling "+errors) - - if not input: - return ("", 0) - - labels = dots.split(input) - trailing_dot = u'' - if labels: - if not labels[-1]: - trailing_dot = '.' - del labels[-1] - elif not final: - # Keep potentially unfinished label until the next call - del labels[-1] - if labels: - trailing_dot = '.' - - result = [] - size = 0 - for label in labels: - result.append(ToASCII(label)) - if size: - size += 1 - size += len(label) - - # Join with U+002E - result = ".".join(result) + trailing_dot - size += len(trailing_dot) - return (result, size) - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def _buffer_decode(self, input, errors, final): - if errors != 'strict': - raise UnicodeError("Unsupported error handling "+errors) - - if not input: - return (u"", 0) - - # IDNA allows decoding to operate on Unicode strings, too. - if isinstance(input, unicode): - labels = dots.split(input) - else: - # Must be ASCII string - input = str(input) - unicode(input, "ascii") - labels = input.split(".") - - trailing_dot = u'' - if labels: - if not labels[-1]: - trailing_dot = u'.' - del labels[-1] - elif not final: - # Keep potentially unfinished label until the next call - del labels[-1] - if labels: - trailing_dot = u'.' - - result = [] - size = 0 - for label in labels: - result.append(ToUnicode(label)) - if size: - size += 1 - size += len(label) - - result = u".".join(result) + trailing_dot - size += len(trailing_dot) - return (result, size) - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='idna', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py deleted file mode 100644 index 3471999..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_jp.py: Python Unicode Codec for ISO2022_JP -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_jp') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_jp', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py deleted file mode 100644 index 8b04b84..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_1.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_jp_1.py: Python Unicode Codec for ISO2022_JP_1 -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_jp_1') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_jp_1', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py deleted file mode 100644 index df92673..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_jp_2.py: Python Unicode Codec for ISO2022_JP_2 -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_jp_2') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_jp_2', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py deleted file mode 100644 index 138e628..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_2004.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_jp_2004.py: Python Unicode Codec for ISO2022_JP_2004 -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_jp_2004') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_jp_2004', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py deleted file mode 100644 index 5fd5825..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_3.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_jp_3.py: Python Unicode Codec for ISO2022_JP_3 -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_jp_3') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_jp_3', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py deleted file mode 100644 index 4ac8a0c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_jp_ext.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_jp_ext.py: Python Unicode Codec for ISO2022_JP_EXT -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_jp_ext') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_jp_ext', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py deleted file mode 100644 index 3dfe986..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso2022_kr.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# iso2022_kr.py: Python Unicode Codec for ISO2022_KR -# -# Written by Hye-Shik Chang -# - -import _codecs_iso2022, codecs -import _multibytecodec as mbc - -codec = _codecs_iso2022.getcodec('iso2022_kr') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='iso2022_kr', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py deleted file mode 100644 index 7f6be30..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_1.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-1', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic) - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic) - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic) - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic) - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py deleted file mode 100644 index d2a7a51..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_10.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_10 generated from 'MAPPINGS/ISO8859/8859-10.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-10', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0112' # 0xA2 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0122' # 0xA3 -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u012a' # 0xA4 -> LATIN CAPITAL LETTER I WITH MACRON - u'\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE - u'\u0136' # 0xA6 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u013b' # 0xA8 -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u0110' # 0xA9 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0160' # 0xAA -> LATIN CAPITAL LETTER S WITH CARON - u'\u0166' # 0xAB -> LATIN CAPITAL LETTER T WITH STROKE - u'\u017d' # 0xAC -> LATIN CAPITAL LETTER Z WITH CARON - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u016a' # 0xAE -> LATIN CAPITAL LETTER U WITH MACRON - u'\u014a' # 0xAF -> LATIN CAPITAL LETTER ENG - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK - u'\u0113' # 0xB2 -> LATIN SMALL LETTER E WITH MACRON - u'\u0123' # 0xB3 -> LATIN SMALL LETTER G WITH CEDILLA - u'\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON - u'\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE - u'\u0137' # 0xB6 -> LATIN SMALL LETTER K WITH CEDILLA - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u013c' # 0xB8 -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0111' # 0xB9 -> LATIN SMALL LETTER D WITH STROKE - u'\u0161' # 0xBA -> LATIN SMALL LETTER S WITH CARON - u'\u0167' # 0xBB -> LATIN SMALL LETTER T WITH STROKE - u'\u017e' # 0xBC -> LATIN SMALL LETTER Z WITH CARON - u'\u2015' # 0xBD -> HORIZONTAL BAR - u'\u016b' # 0xBE -> LATIN SMALL LETTER U WITH MACRON - u'\u014b' # 0xBF -> LATIN SMALL LETTER ENG - u'\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH (Icelandic) - u'\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u0168' # 0xD7 -> LATIN CAPITAL LETTER U WITH TILDE - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN (Icelandic) - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) - u'\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH (Icelandic) - u'\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA - u'\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u0169' # 0xF7 -> LATIN SMALL LETTER U WITH TILDE - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN (Icelandic) - u'\u0138' # 0xFF -> LATIN SMALL LETTER KRA -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py deleted file mode 100644 index 2f6252a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_11.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_11 generated from 'MAPPINGS/ISO8859/8859-11.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-11', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI - u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI - u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT - u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI - u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON - u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG - u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU - u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN - u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING - u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG - u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO - u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE - u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING - u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA - u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK - u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN - u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO - u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO - u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN - u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK - u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO - u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG - u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN - u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG - u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU - u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI - u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA - u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG - u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA - u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN - u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN - u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO - u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA - u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK - u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA - u'\u0e24' # 0xC4 -> THAI CHARACTER RU - u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING - u'\u0e26' # 0xC6 -> THAI CHARACTER LU - u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN - u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA - u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI - u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA - u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP - u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA - u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG - u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK - u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI - u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A - u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT - u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA - u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM - u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I - u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II - u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE - u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE - u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U - u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU - u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT - u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E - u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE - u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O - u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN - u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI - u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO - u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK - u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU - u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK - u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO - u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI - u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA - u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT - u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT - u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN - u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN - u'\u0e50' # 0xF0 -> THAI DIGIT ZERO - u'\u0e51' # 0xF1 -> THAI DIGIT ONE - u'\u0e52' # 0xF2 -> THAI DIGIT TWO - u'\u0e53' # 0xF3 -> THAI DIGIT THREE - u'\u0e54' # 0xF4 -> THAI DIGIT FOUR - u'\u0e55' # 0xF5 -> THAI DIGIT FIVE - u'\u0e56' # 0xF6 -> THAI DIGIT SIX - u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN - u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT - u'\u0e59' # 0xF9 -> THAI DIGIT NINE - u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU - u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py deleted file mode 100644 index 0523133..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_13.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_13 generated from 'MAPPINGS/ISO8859/8859-13.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-13', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u201d' # 0xA1 -> RIGHT DOUBLE QUOTATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xd8' # 0xA8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0156' # 0xAA -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xc6' # 0xAF -> LATIN CAPITAL LETTER AE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u201c' # 0xB4 -> LEFT DOUBLE QUOTATION MARK - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xf8' # 0xB8 -> LATIN SMALL LETTER O WITH STROKE - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\u0157' # 0xBA -> LATIN SMALL LETTER R WITH CEDILLA - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xe6' # 0xBF -> LATIN SMALL LETTER AE - u'\u0104' # 0xC0 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u012e' # 0xC1 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u0100' # 0xC2 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u0106' # 0xC3 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\u0118' # 0xC6 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u0112' # 0xC7 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0179' # 0xCA -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\u0116' # 0xCB -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\u0122' # 0xCC -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u0136' # 0xCD -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u012a' # 0xCE -> LATIN CAPITAL LETTER I WITH MACRON - u'\u013b' # 0xCF -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u0160' # 0xD0 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0145' # 0xD2 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\u014c' # 0xD4 -> LATIN CAPITAL LETTER O WITH MACRON - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0172' # 0xD8 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u0141' # 0xD9 -> LATIN CAPITAL LETTER L WITH STROKE - u'\u015a' # 0xDA -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u016a' # 0xDB -> LATIN CAPITAL LETTER U WITH MACRON - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u017b' # 0xDD -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u017d' # 0xDE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S (German) - u'\u0105' # 0xE0 -> LATIN SMALL LETTER A WITH OGONEK - u'\u012f' # 0xE1 -> LATIN SMALL LETTER I WITH OGONEK - u'\u0101' # 0xE2 -> LATIN SMALL LETTER A WITH MACRON - u'\u0107' # 0xE3 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\u0119' # 0xE6 -> LATIN SMALL LETTER E WITH OGONEK - u'\u0113' # 0xE7 -> LATIN SMALL LETTER E WITH MACRON - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u017a' # 0xEA -> LATIN SMALL LETTER Z WITH ACUTE - u'\u0117' # 0xEB -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\u0123' # 0xEC -> LATIN SMALL LETTER G WITH CEDILLA - u'\u0137' # 0xED -> LATIN SMALL LETTER K WITH CEDILLA - u'\u012b' # 0xEE -> LATIN SMALL LETTER I WITH MACRON - u'\u013c' # 0xEF -> LATIN SMALL LETTER L WITH CEDILLA - u'\u0161' # 0xF0 -> LATIN SMALL LETTER S WITH CARON - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0146' # 0xF2 -> LATIN SMALL LETTER N WITH CEDILLA - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\u014d' # 0xF4 -> LATIN SMALL LETTER O WITH MACRON - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0173' # 0xF8 -> LATIN SMALL LETTER U WITH OGONEK - u'\u0142' # 0xF9 -> LATIN SMALL LETTER L WITH STROKE - u'\u015b' # 0xFA -> LATIN SMALL LETTER S WITH ACUTE - u'\u016b' # 0xFB -> LATIN SMALL LETTER U WITH MACRON - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u017e' # 0xFE -> LATIN SMALL LETTER Z WITH CARON - u'\u2019' # 0xFF -> RIGHT SINGLE QUOTATION MARK -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py deleted file mode 100644 index f0ed8fa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_14.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_14 generated from 'MAPPINGS/ISO8859/8859-14.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-14', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u1e02' # 0xA1 -> LATIN CAPITAL LETTER B WITH DOT ABOVE - u'\u1e03' # 0xA2 -> LATIN SMALL LETTER B WITH DOT ABOVE - u'\xa3' # 0xA3 -> POUND SIGN - u'\u010a' # 0xA4 -> LATIN CAPITAL LETTER C WITH DOT ABOVE - u'\u010b' # 0xA5 -> LATIN SMALL LETTER C WITH DOT ABOVE - u'\u1e0a' # 0xA6 -> LATIN CAPITAL LETTER D WITH DOT ABOVE - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u1e80' # 0xA8 -> LATIN CAPITAL LETTER W WITH GRAVE - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u1e82' # 0xAA -> LATIN CAPITAL LETTER W WITH ACUTE - u'\u1e0b' # 0xAB -> LATIN SMALL LETTER D WITH DOT ABOVE - u'\u1ef2' # 0xAC -> LATIN CAPITAL LETTER Y WITH GRAVE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\u0178' # 0xAF -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u1e1e' # 0xB0 -> LATIN CAPITAL LETTER F WITH DOT ABOVE - u'\u1e1f' # 0xB1 -> LATIN SMALL LETTER F WITH DOT ABOVE - u'\u0120' # 0xB2 -> LATIN CAPITAL LETTER G WITH DOT ABOVE - u'\u0121' # 0xB3 -> LATIN SMALL LETTER G WITH DOT ABOVE - u'\u1e40' # 0xB4 -> LATIN CAPITAL LETTER M WITH DOT ABOVE - u'\u1e41' # 0xB5 -> LATIN SMALL LETTER M WITH DOT ABOVE - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\u1e56' # 0xB7 -> LATIN CAPITAL LETTER P WITH DOT ABOVE - u'\u1e81' # 0xB8 -> LATIN SMALL LETTER W WITH GRAVE - u'\u1e57' # 0xB9 -> LATIN SMALL LETTER P WITH DOT ABOVE - u'\u1e83' # 0xBA -> LATIN SMALL LETTER W WITH ACUTE - u'\u1e60' # 0xBB -> LATIN CAPITAL LETTER S WITH DOT ABOVE - u'\u1ef3' # 0xBC -> LATIN SMALL LETTER Y WITH GRAVE - u'\u1e84' # 0xBD -> LATIN CAPITAL LETTER W WITH DIAERESIS - u'\u1e85' # 0xBE -> LATIN SMALL LETTER W WITH DIAERESIS - u'\u1e61' # 0xBF -> LATIN SMALL LETTER S WITH DOT ABOVE - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u0174' # 0xD0 -> LATIN CAPITAL LETTER W WITH CIRCUMFLEX - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u1e6a' # 0xD7 -> LATIN CAPITAL LETTER T WITH DOT ABOVE - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0176' # 0xDE -> LATIN CAPITAL LETTER Y WITH CIRCUMFLEX - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u0175' # 0xF0 -> LATIN SMALL LETTER W WITH CIRCUMFLEX - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u1e6b' # 0xF7 -> LATIN SMALL LETTER T WITH DOT ABOVE - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0177' # 0xFE -> LATIN SMALL LETTER Y WITH CIRCUMFLEX - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py deleted file mode 100644 index 4c322be..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_15.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_15 generated from 'MAPPINGS/ISO8859/8859-15.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-15', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\u20ac' # 0xA4 -> EURO SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xBD -> LATIN SMALL LIGATURE OE - u'\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xd0' # 0xD0 -> LATIN CAPITAL LETTER ETH - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf0' # 0xF0 -> LATIN SMALL LETTER ETH - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\xfe' # 0xFE -> LATIN SMALL LETTER THORN - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py deleted file mode 100644 index e1bce0a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_16.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_16 generated from 'MAPPINGS/ISO8859/8859-16.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-16', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0105' # 0xA2 -> LATIN SMALL LETTER A WITH OGONEK - u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE - u'\u20ac' # 0xA4 -> EURO SIGN - u'\u201e' # 0xA5 -> DOUBLE LOW-9 QUOTATION MARK - u'\u0160' # 0xA6 -> LATIN CAPITAL LETTER S WITH CARON - u'\xa7' # 0xA7 -> SECTION SIGN - u'\u0161' # 0xA8 -> LATIN SMALL LETTER S WITH CARON - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u0218' # 0xAA -> LATIN CAPITAL LETTER S WITH COMMA BELOW - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u017a' # 0xAE -> LATIN SMALL LETTER Z WITH ACUTE - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u010c' # 0xB2 -> LATIN CAPITAL LETTER C WITH CARON - u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE - u'\u017d' # 0xB4 -> LATIN CAPITAL LETTER Z WITH CARON - u'\u201d' # 0xB5 -> RIGHT DOUBLE QUOTATION MARK - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u017e' # 0xB8 -> LATIN SMALL LETTER Z WITH CARON - u'\u010d' # 0xB9 -> LATIN SMALL LETTER C WITH CARON - u'\u0219' # 0xBA -> LATIN SMALL LETTER S WITH COMMA BELOW - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u0152' # 0xBC -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xBD -> LATIN SMALL LIGATURE OE - u'\u0178' # 0xBE -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0106' # 0xC5 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\u015a' # 0xD7 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u0170' # 0xD8 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0118' # 0xDD -> LATIN CAPITAL LETTER E WITH OGONEK - u'\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u0107' # 0xE5 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\u015b' # 0xF7 -> LATIN SMALL LETTER S WITH ACUTE - u'\u0171' # 0xF8 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0119' # 0xFD -> LATIN SMALL LETTER E WITH OGONEK - u'\u021b' # 0xFE -> LATIN SMALL LETTER T WITH COMMA BELOW - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py deleted file mode 100644 index fb3606f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_2.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_2 generated from 'MAPPINGS/ISO8859/8859-2.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-2', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u02d8' # 0xA2 -> BREVE - u'\u0141' # 0xA3 -> LATIN CAPITAL LETTER L WITH STROKE - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u013d' # 0xA5 -> LATIN CAPITAL LETTER L WITH CARON - u'\u015a' # 0xA6 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON - u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u0164' # 0xAB -> LATIN CAPITAL LETTER T WITH CARON - u'\u0179' # 0xAC -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK - u'\u02db' # 0xB2 -> OGONEK - u'\u0142' # 0xB3 -> LATIN SMALL LETTER L WITH STROKE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\u013e' # 0xB5 -> LATIN SMALL LETTER L WITH CARON - u'\u015b' # 0xB6 -> LATIN SMALL LETTER S WITH ACUTE - u'\u02c7' # 0xB7 -> CARON - u'\xb8' # 0xB8 -> CEDILLA - u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON - u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA - u'\u0165' # 0xBB -> LATIN SMALL LETTER T WITH CARON - u'\u017a' # 0xBC -> LATIN SMALL LETTER Z WITH ACUTE - u'\u02dd' # 0xBD -> DOUBLE ACUTE ACCENT - u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u0154' # 0xC0 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0102' # 0xC3 -> LATIN CAPITAL LETTER A WITH BREVE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0139' # 0xC5 -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u011a' # 0xCC -> LATIN CAPITAL LETTER E WITH CARON - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u010e' # 0xCF -> LATIN CAPITAL LETTER D WITH CARON - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0143' # 0xD1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\u0147' # 0xD2 -> LATIN CAPITAL LETTER N WITH CARON - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0150' # 0xD5 -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u0158' # 0xD8 -> LATIN CAPITAL LETTER R WITH CARON - u'\u016e' # 0xD9 -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u0170' # 0xDB -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xdd' # 0xDD -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\u0162' # 0xDE -> LATIN CAPITAL LETTER T WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0155' # 0xE0 -> LATIN SMALL LETTER R WITH ACUTE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\u0103' # 0xE3 -> LATIN SMALL LETTER A WITH BREVE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u013a' # 0xE5 -> LATIN SMALL LETTER L WITH ACUTE - u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u011b' # 0xEC -> LATIN SMALL LETTER E WITH CARON - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u010f' # 0xEF -> LATIN SMALL LETTER D WITH CARON - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0144' # 0xF1 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0148' # 0xF2 -> LATIN SMALL LETTER N WITH CARON - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0151' # 0xF5 -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u0159' # 0xF8 -> LATIN SMALL LETTER R WITH CARON - u'\u016f' # 0xF9 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\u0171' # 0xFB -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xfd' # 0xFD -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0163' # 0xFE -> LATIN SMALL LETTER T WITH CEDILLA - u'\u02d9' # 0xFF -> DOT ABOVE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py deleted file mode 100644 index aaa2f52..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_3.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_3 generated from 'MAPPINGS/ISO8859/8859-3.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-3', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0126' # 0xA1 -> LATIN CAPITAL LETTER H WITH STROKE - u'\u02d8' # 0xA2 -> BREVE - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\ufffe' - u'\u0124' # 0xA6 -> LATIN CAPITAL LETTER H WITH CIRCUMFLEX - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\u0130' # 0xA9 -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u015e' # 0xAA -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u011e' # 0xAB -> LATIN CAPITAL LETTER G WITH BREVE - u'\u0134' # 0xAC -> LATIN CAPITAL LETTER J WITH CIRCUMFLEX - u'\xad' # 0xAD -> SOFT HYPHEN - u'\ufffe' - u'\u017b' # 0xAF -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0127' # 0xB1 -> LATIN SMALL LETTER H WITH STROKE - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u0125' # 0xB6 -> LATIN SMALL LETTER H WITH CIRCUMFLEX - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\u0131' # 0xB9 -> LATIN SMALL LETTER DOTLESS I - u'\u015f' # 0xBA -> LATIN SMALL LETTER S WITH CEDILLA - u'\u011f' # 0xBB -> LATIN SMALL LETTER G WITH BREVE - u'\u0135' # 0xBC -> LATIN SMALL LETTER J WITH CIRCUMFLEX - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\ufffe' - u'\u017c' # 0xBF -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\ufffe' - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u010a' # 0xC5 -> LATIN CAPITAL LETTER C WITH DOT ABOVE - u'\u0108' # 0xC6 -> LATIN CAPITAL LETTER C WITH CIRCUMFLEX - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\ufffe' - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0120' # 0xD5 -> LATIN CAPITAL LETTER G WITH DOT ABOVE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\u011c' # 0xD8 -> LATIN CAPITAL LETTER G WITH CIRCUMFLEX - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u016c' # 0xDD -> LATIN CAPITAL LETTER U WITH BREVE - u'\u015c' # 0xDE -> LATIN CAPITAL LETTER S WITH CIRCUMFLEX - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\ufffe' - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u010b' # 0xE5 -> LATIN SMALL LETTER C WITH DOT ABOVE - u'\u0109' # 0xE6 -> LATIN SMALL LETTER C WITH CIRCUMFLEX - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\ufffe' - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\u0121' # 0xF5 -> LATIN SMALL LETTER G WITH DOT ABOVE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\u011d' # 0xF8 -> LATIN SMALL LETTER G WITH CIRCUMFLEX - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u016d' # 0xFD -> LATIN SMALL LETTER U WITH BREVE - u'\u015d' # 0xFE -> LATIN SMALL LETTER S WITH CIRCUMFLEX - u'\u02d9' # 0xFF -> DOT ABOVE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py deleted file mode 100644 index 6e86ed1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_4.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_4 generated from 'MAPPINGS/ISO8859/8859-4.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-4', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0104' # 0xA1 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\u0138' # 0xA2 -> LATIN SMALL LETTER KRA - u'\u0156' # 0xA3 -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\u0128' # 0xA5 -> LATIN CAPITAL LETTER I WITH TILDE - u'\u013b' # 0xA6 -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON - u'\u0112' # 0xAA -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0122' # 0xAB -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u0166' # 0xAC -> LATIN CAPITAL LETTER T WITH STROKE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\u0105' # 0xB1 -> LATIN SMALL LETTER A WITH OGONEK - u'\u02db' # 0xB2 -> OGONEK - u'\u0157' # 0xB3 -> LATIN SMALL LETTER R WITH CEDILLA - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\u0129' # 0xB5 -> LATIN SMALL LETTER I WITH TILDE - u'\u013c' # 0xB6 -> LATIN SMALL LETTER L WITH CEDILLA - u'\u02c7' # 0xB7 -> CARON - u'\xb8' # 0xB8 -> CEDILLA - u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON - u'\u0113' # 0xBA -> LATIN SMALL LETTER E WITH MACRON - u'\u0123' # 0xBB -> LATIN SMALL LETTER G WITH CEDILLA - u'\u0167' # 0xBC -> LATIN SMALL LETTER T WITH STROKE - u'\u014a' # 0xBD -> LATIN CAPITAL LETTER ENG - u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON - u'\u014b' # 0xBF -> LATIN SMALL LETTER ENG - u'\u0100' # 0xC0 -> LATIN CAPITAL LETTER A WITH MACRON - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\u012e' # 0xC7 -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0118' # 0xCA -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u0116' # 0xCC -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\u012a' # 0xCF -> LATIN CAPITAL LETTER I WITH MACRON - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u0145' # 0xD1 -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u014c' # 0xD2 -> LATIN CAPITAL LETTER O WITH MACRON - u'\u0136' # 0xD3 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\u0172' # 0xD9 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0168' # 0xDD -> LATIN CAPITAL LETTER U WITH TILDE - u'\u016a' # 0xDE -> LATIN CAPITAL LETTER U WITH MACRON - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\u0101' # 0xE0 -> LATIN SMALL LETTER A WITH MACRON - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\u012f' # 0xE7 -> LATIN SMALL LETTER I WITH OGONEK - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\u0119' # 0xEA -> LATIN SMALL LETTER E WITH OGONEK - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\u0117' # 0xEC -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\u012b' # 0xEF -> LATIN SMALL LETTER I WITH MACRON - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\u0146' # 0xF1 -> LATIN SMALL LETTER N WITH CEDILLA - u'\u014d' # 0xF2 -> LATIN SMALL LETTER O WITH MACRON - u'\u0137' # 0xF3 -> LATIN SMALL LETTER K WITH CEDILLA - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\u0173' # 0xF9 -> LATIN SMALL LETTER U WITH OGONEK - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0169' # 0xFD -> LATIN SMALL LETTER U WITH TILDE - u'\u016b' # 0xFE -> LATIN SMALL LETTER U WITH MACRON - u'\u02d9' # 0xFF -> DOT ABOVE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py deleted file mode 100644 index c93283e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_5.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_5 generated from 'MAPPINGS/ISO8859/8859-5.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-5', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u0401' # 0xA1 -> CYRILLIC CAPITAL LETTER IO - u'\u0402' # 0xA2 -> CYRILLIC CAPITAL LETTER DJE - u'\u0403' # 0xA3 -> CYRILLIC CAPITAL LETTER GJE - u'\u0404' # 0xA4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0405' # 0xA5 -> CYRILLIC CAPITAL LETTER DZE - u'\u0406' # 0xA6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0407' # 0xA7 -> CYRILLIC CAPITAL LETTER YI - u'\u0408' # 0xA8 -> CYRILLIC CAPITAL LETTER JE - u'\u0409' # 0xA9 -> CYRILLIC CAPITAL LETTER LJE - u'\u040a' # 0xAA -> CYRILLIC CAPITAL LETTER NJE - u'\u040b' # 0xAB -> CYRILLIC CAPITAL LETTER TSHE - u'\u040c' # 0xAC -> CYRILLIC CAPITAL LETTER KJE - u'\xad' # 0xAD -> SOFT HYPHEN - u'\u040e' # 0xAE -> CYRILLIC CAPITAL LETTER SHORT U - u'\u040f' # 0xAF -> CYRILLIC CAPITAL LETTER DZHE - u'\u0410' # 0xB0 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xB1 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0xB2 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0xB3 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0xB4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xB5 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0xB6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0xB7 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0xB8 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xB9 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xBA -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xBB -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xBC -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xBD -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xBE -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xBF -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0xC0 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xC1 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xC2 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xC3 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0xC4 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0xC5 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0xC6 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0xC7 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0xC8 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0xC9 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0xCA -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0xCB -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0xCC -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0xCD -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0xCE -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0xCF -> CYRILLIC CAPITAL LETTER YA - u'\u0430' # 0xD0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xD1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0xD2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0xD3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0xD4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xD5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0xD7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0xD8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xD9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xDA -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xDB -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xDC -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xDD -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xDE -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xDF -> CYRILLIC SMALL LETTER PE - u'\u0440' # 0xE0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xE1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xE2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xE3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0xE4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0xE5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0xE6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0xE7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0xE8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0xE9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0xEA -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0xEB -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0xEC -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0xED -> CYRILLIC SMALL LETTER E - u'\u044e' # 0xEE -> CYRILLIC SMALL LETTER YU - u'\u044f' # 0xEF -> CYRILLIC SMALL LETTER YA - u'\u2116' # 0xF0 -> NUMERO SIGN - u'\u0451' # 0xF1 -> CYRILLIC SMALL LETTER IO - u'\u0452' # 0xF2 -> CYRILLIC SMALL LETTER DJE - u'\u0453' # 0xF3 -> CYRILLIC SMALL LETTER GJE - u'\u0454' # 0xF4 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0455' # 0xF5 -> CYRILLIC SMALL LETTER DZE - u'\u0456' # 0xF6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0457' # 0xF7 -> CYRILLIC SMALL LETTER YI - u'\u0458' # 0xF8 -> CYRILLIC SMALL LETTER JE - u'\u0459' # 0xF9 -> CYRILLIC SMALL LETTER LJE - u'\u045a' # 0xFA -> CYRILLIC SMALL LETTER NJE - u'\u045b' # 0xFB -> CYRILLIC SMALL LETTER TSHE - u'\u045c' # 0xFC -> CYRILLIC SMALL LETTER KJE - u'\xa7' # 0xFD -> SECTION SIGN - u'\u045e' # 0xFE -> CYRILLIC SMALL LETTER SHORT U - u'\u045f' # 0xFF -> CYRILLIC SMALL LETTER DZHE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py deleted file mode 100644 index 6fc769a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_6.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_6 generated from 'MAPPINGS/ISO8859/8859-6.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-6', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u060c' # 0xAC -> ARABIC COMMA - u'\xad' # 0xAD -> SOFT HYPHEN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u061b' # 0xBB -> ARABIC SEMICOLON - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u061f' # 0xBF -> ARABIC QUESTION MARK - u'\ufffe' - u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA - u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0xC7 -> ARABIC LETTER ALEF - u'\u0628' # 0xC8 -> ARABIC LETTER BEH - u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xCA -> ARABIC LETTER TEH - u'\u062b' # 0xCB -> ARABIC LETTER THEH - u'\u062c' # 0xCC -> ARABIC LETTER JEEM - u'\u062d' # 0xCD -> ARABIC LETTER HAH - u'\u062e' # 0xCE -> ARABIC LETTER KHAH - u'\u062f' # 0xCF -> ARABIC LETTER DAL - u'\u0630' # 0xD0 -> ARABIC LETTER THAL - u'\u0631' # 0xD1 -> ARABIC LETTER REH - u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN - u'\u0633' # 0xD3 -> ARABIC LETTER SEEN - u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN - u'\u0635' # 0xD5 -> ARABIC LETTER SAD - u'\u0636' # 0xD6 -> ARABIC LETTER DAD - u'\u0637' # 0xD7 -> ARABIC LETTER TAH - u'\u0638' # 0xD8 -> ARABIC LETTER ZAH - u'\u0639' # 0xD9 -> ARABIC LETTER AIN - u'\u063a' # 0xDA -> ARABIC LETTER GHAIN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u0640' # 0xE0 -> ARABIC TATWEEL - u'\u0641' # 0xE1 -> ARABIC LETTER FEH - u'\u0642' # 0xE2 -> ARABIC LETTER QAF - u'\u0643' # 0xE3 -> ARABIC LETTER KAF - u'\u0644' # 0xE4 -> ARABIC LETTER LAM - u'\u0645' # 0xE5 -> ARABIC LETTER MEEM - u'\u0646' # 0xE6 -> ARABIC LETTER NOON - u'\u0647' # 0xE7 -> ARABIC LETTER HEH - u'\u0648' # 0xE8 -> ARABIC LETTER WAW - u'\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xEA -> ARABIC LETTER YEH - u'\u064b' # 0xEB -> ARABIC FATHATAN - u'\u064c' # 0xEC -> ARABIC DAMMATAN - u'\u064d' # 0xED -> ARABIC KASRATAN - u'\u064e' # 0xEE -> ARABIC FATHA - u'\u064f' # 0xEF -> ARABIC DAMMA - u'\u0650' # 0xF0 -> ARABIC KASRA - u'\u0651' # 0xF1 -> ARABIC SHADDA - u'\u0652' # 0xF2 -> ARABIC SUKUN - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py deleted file mode 100644 index 9fc2785..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_7.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_7 generated from 'MAPPINGS/ISO8859/8859-7.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-7', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\u2018' # 0xA1 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xA2 -> RIGHT SINGLE QUOTATION MARK - u'\xa3' # 0xA3 -> POUND SIGN - u'\u20ac' # 0xA4 -> EURO SIGN - u'\u20af' # 0xA5 -> DRACHMA SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u037a' # 0xAA -> GREEK YPOGEGRAMMENI - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\ufffe' - u'\u2015' # 0xAF -> HORIZONTAL BAR - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\u0384' # 0xB4 -> GREEK TONOS - u'\u0385' # 0xB5 -> GREEK DIALYTIKA TONOS - u'\u0386' # 0xB6 -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\u0388' # 0xB8 -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0389' # 0xB9 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0xBA -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u038c' # 0xBC -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\u038e' # 0xBE -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u038f' # 0xBF -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\u0390' # 0xC0 -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u0391' # 0xC1 -> GREEK CAPITAL LETTER ALPHA - u'\u0392' # 0xC2 -> GREEK CAPITAL LETTER BETA - u'\u0393' # 0xC3 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0xC4 -> GREEK CAPITAL LETTER DELTA - u'\u0395' # 0xC5 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0xC6 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0xC7 -> GREEK CAPITAL LETTER ETA - u'\u0398' # 0xC8 -> GREEK CAPITAL LETTER THETA - u'\u0399' # 0xC9 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0xCA -> GREEK CAPITAL LETTER KAPPA - u'\u039b' # 0xCB -> GREEK CAPITAL LETTER LAMDA - u'\u039c' # 0xCC -> GREEK CAPITAL LETTER MU - u'\u039d' # 0xCD -> GREEK CAPITAL LETTER NU - u'\u039e' # 0xCE -> GREEK CAPITAL LETTER XI - u'\u039f' # 0xCF -> GREEK CAPITAL LETTER OMICRON - u'\u03a0' # 0xD0 -> GREEK CAPITAL LETTER PI - u'\u03a1' # 0xD1 -> GREEK CAPITAL LETTER RHO - u'\ufffe' - u'\u03a3' # 0xD3 -> GREEK CAPITAL LETTER SIGMA - u'\u03a4' # 0xD4 -> GREEK CAPITAL LETTER TAU - u'\u03a5' # 0xD5 -> GREEK CAPITAL LETTER UPSILON - u'\u03a6' # 0xD6 -> GREEK CAPITAL LETTER PHI - u'\u03a7' # 0xD7 -> GREEK CAPITAL LETTER CHI - u'\u03a8' # 0xD8 -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0xD9 -> GREEK CAPITAL LETTER OMEGA - u'\u03aa' # 0xDA -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\u03ab' # 0xDB -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\u03ac' # 0xDC -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u03ad' # 0xDD -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xDE -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0xDF -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03b0' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA - u'\u03b3' # 0xE3 -> GREEK SMALL LETTER GAMMA - u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON - u'\u03b6' # 0xE6 -> GREEK SMALL LETTER ZETA - u'\u03b7' # 0xE7 -> GREEK SMALL LETTER ETA - u'\u03b8' # 0xE8 -> GREEK SMALL LETTER THETA - u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA - u'\u03ba' # 0xEA -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0xEB -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0xEC -> GREEK SMALL LETTER MU - u'\u03bd' # 0xED -> GREEK SMALL LETTER NU - u'\u03be' # 0xEE -> GREEK SMALL LETTER XI - u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI - u'\u03c1' # 0xF1 -> GREEK SMALL LETTER RHO - u'\u03c2' # 0xF2 -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA - u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU - u'\u03c5' # 0xF5 -> GREEK SMALL LETTER UPSILON - u'\u03c6' # 0xF6 -> GREEK SMALL LETTER PHI - u'\u03c7' # 0xF7 -> GREEK SMALL LETTER CHI - u'\u03c8' # 0xF8 -> GREEK SMALL LETTER PSI - u'\u03c9' # 0xF9 -> GREEK SMALL LETTER OMEGA - u'\u03ca' # 0xFA -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03cb' # 0xFB -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u03cc' # 0xFC -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u03cd' # 0xFD -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03ce' # 0xFE -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\ufffe' -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py deleted file mode 100644 index 8810aed..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_8.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_8 generated from 'MAPPINGS/ISO8859/8859-8.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-8', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\ufffe' - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xd7' # 0xAA -> MULTIPLICATION SIGN - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xf7' # 0xBA -> DIVISION SIGN - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u2017' # 0xDF -> DOUBLE LOW LINE - u'\u05d0' # 0xE0 -> HEBREW LETTER ALEF - u'\u05d1' # 0xE1 -> HEBREW LETTER BET - u'\u05d2' # 0xE2 -> HEBREW LETTER GIMEL - u'\u05d3' # 0xE3 -> HEBREW LETTER DALET - u'\u05d4' # 0xE4 -> HEBREW LETTER HE - u'\u05d5' # 0xE5 -> HEBREW LETTER VAV - u'\u05d6' # 0xE6 -> HEBREW LETTER ZAYIN - u'\u05d7' # 0xE7 -> HEBREW LETTER HET - u'\u05d8' # 0xE8 -> HEBREW LETTER TET - u'\u05d9' # 0xE9 -> HEBREW LETTER YOD - u'\u05da' # 0xEA -> HEBREW LETTER FINAL KAF - u'\u05db' # 0xEB -> HEBREW LETTER KAF - u'\u05dc' # 0xEC -> HEBREW LETTER LAMED - u'\u05dd' # 0xED -> HEBREW LETTER FINAL MEM - u'\u05de' # 0xEE -> HEBREW LETTER MEM - u'\u05df' # 0xEF -> HEBREW LETTER FINAL NUN - u'\u05e0' # 0xF0 -> HEBREW LETTER NUN - u'\u05e1' # 0xF1 -> HEBREW LETTER SAMEKH - u'\u05e2' # 0xF2 -> HEBREW LETTER AYIN - u'\u05e3' # 0xF3 -> HEBREW LETTER FINAL PE - u'\u05e4' # 0xF4 -> HEBREW LETTER PE - u'\u05e5' # 0xF5 -> HEBREW LETTER FINAL TSADI - u'\u05e6' # 0xF6 -> HEBREW LETTER TSADI - u'\u05e7' # 0xF7 -> HEBREW LETTER QOF - u'\u05e8' # 0xF8 -> HEBREW LETTER RESH - u'\u05e9' # 0xF9 -> HEBREW LETTER SHIN - u'\u05ea' # 0xFA -> HEBREW LETTER TAV - u'\ufffe' - u'\ufffe' - u'\u200e' # 0xFD -> LEFT-TO-RIGHT MARK - u'\u200f' # 0xFE -> RIGHT-TO-LEFT MARK - u'\ufffe' -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py deleted file mode 100644 index 980e994..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/iso8859_9.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec iso8859_9 generated from 'MAPPINGS/ISO8859/8859-9.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-9', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\xa0' # 0xA0 -> NO-BREAK SPACE - u'\xa1' # 0xA1 -> INVERTED EXCLAMATION MARK - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa4' # 0xA4 -> CURRENCY SIGN - u'\xa5' # 0xA5 -> YEN SIGN - u'\xa6' # 0xA6 -> BROKEN BAR - u'\xa7' # 0xA7 -> SECTION SIGN - u'\xa8' # 0xA8 -> DIAERESIS - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\xaa' # 0xAA -> FEMININE ORDINAL INDICATOR - u'\xab' # 0xAB -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xac' # 0xAC -> NOT SIGN - u'\xad' # 0xAD -> SOFT HYPHEN - u'\xae' # 0xAE -> REGISTERED SIGN - u'\xaf' # 0xAF -> MACRON - u'\xb0' # 0xB0 -> DEGREE SIGN - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\xb2' # 0xB2 -> SUPERSCRIPT TWO - u'\xb3' # 0xB3 -> SUPERSCRIPT THREE - u'\xb4' # 0xB4 -> ACUTE ACCENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\xb6' # 0xB6 -> PILCROW SIGN - u'\xb7' # 0xB7 -> MIDDLE DOT - u'\xb8' # 0xB8 -> CEDILLA - u'\xb9' # 0xB9 -> SUPERSCRIPT ONE - u'\xba' # 0xBA -> MASCULINE ORDINAL INDICATOR - u'\xbb' # 0xBB -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbc' # 0xBC -> VULGAR FRACTION ONE QUARTER - u'\xbd' # 0xBD -> VULGAR FRACTION ONE HALF - u'\xbe' # 0xBE -> VULGAR FRACTION THREE QUARTERS - u'\xbf' # 0xBF -> INVERTED QUESTION MARK - u'\xc0' # 0xC0 -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc1' # 0xC1 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xc2' # 0xC2 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xc3' # 0xC3 -> LATIN CAPITAL LETTER A WITH TILDE - u'\xc4' # 0xC4 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0xC5 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc6' # 0xC6 -> LATIN CAPITAL LETTER AE - u'\xc7' # 0xC7 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc8' # 0xC8 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xc9' # 0xC9 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xca' # 0xCA -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xcb' # 0xCB -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xcc' # 0xCC -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xcd' # 0xCD -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xCE -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xCF -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\u011e' # 0xD0 -> LATIN CAPITAL LETTER G WITH BREVE - u'\xd1' # 0xD1 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd2' # 0xD2 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xd3' # 0xD3 -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xD4 -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\xd5' # 0xD5 -> LATIN CAPITAL LETTER O WITH TILDE - u'\xd6' # 0xD6 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xd7' # 0xD7 -> MULTIPLICATION SIGN - u'\xd8' # 0xD8 -> LATIN CAPITAL LETTER O WITH STROKE - u'\xd9' # 0xD9 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\xda' # 0xDA -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xDB -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xdc' # 0xDC -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0130' # 0xDD -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\xdf' # 0xDF -> LATIN SMALL LETTER SHARP S - u'\xe0' # 0xE0 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe1' # 0xE1 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe2' # 0xE2 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe3' # 0xE3 -> LATIN SMALL LETTER A WITH TILDE - u'\xe4' # 0xE4 -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe5' # 0xE5 -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe6' # 0xE6 -> LATIN SMALL LETTER AE - u'\xe7' # 0xE7 -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe8' # 0xE8 -> LATIN SMALL LETTER E WITH GRAVE - u'\xe9' # 0xE9 -> LATIN SMALL LETTER E WITH ACUTE - u'\xea' # 0xEA -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0xEB -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xec' # 0xEC -> LATIN SMALL LETTER I WITH GRAVE - u'\xed' # 0xED -> LATIN SMALL LETTER I WITH ACUTE - u'\xee' # 0xEE -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0xEF -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u011f' # 0xF0 -> LATIN SMALL LETTER G WITH BREVE - u'\xf1' # 0xF1 -> LATIN SMALL LETTER N WITH TILDE - u'\xf2' # 0xF2 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf3' # 0xF3 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf4' # 0xF4 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf5' # 0xF5 -> LATIN SMALL LETTER O WITH TILDE - u'\xf6' # 0xF6 -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0xF7 -> DIVISION SIGN - u'\xf8' # 0xF8 -> LATIN SMALL LETTER O WITH STROKE - u'\xf9' # 0xF9 -> LATIN SMALL LETTER U WITH GRAVE - u'\xfa' # 0xFA -> LATIN SMALL LETTER U WITH ACUTE - u'\xfb' # 0xFB -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0xFC -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u0131' # 0xFD -> LATIN SMALL LETTER DOTLESS I - u'\u015f' # 0xFE -> LATIN SMALL LETTER S WITH CEDILLA - u'\xff' # 0xFF -> LATIN SMALL LETTER Y WITH DIAERESIS -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py deleted file mode 100644 index 5c767cd..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/johab.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# johab.py: Python Unicode Codec for JOHAB -# -# Written by Hye-Shik Chang -# - -import _codecs_kr, codecs -import _multibytecodec as mbc - -codec = _codecs_kr.getcodec('johab') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='johab', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py deleted file mode 100644 index 492a618..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_r.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec koi8_r generated from 'MAPPINGS/VENDORS/MISC/KOI8-R.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='koi8-r', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL - u'\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u2580' # 0x8B -> UPPER HALF BLOCK - u'\u2584' # 0x8C -> LOWER HALF BLOCK - u'\u2588' # 0x8D -> FULL BLOCK - u'\u258c' # 0x8E -> LEFT HALF BLOCK - u'\u2590' # 0x8F -> RIGHT HALF BLOCK - u'\u2591' # 0x90 -> LIGHT SHADE - u'\u2592' # 0x91 -> MEDIUM SHADE - u'\u2593' # 0x92 -> DARK SHADE - u'\u2320' # 0x93 -> TOP HALF INTEGRAL - u'\u25a0' # 0x94 -> BLACK SQUARE - u'\u2219' # 0x95 -> BULLET OPERATOR - u'\u221a' # 0x96 -> SQUARE ROOT - u'\u2248' # 0x97 -> ALMOST EQUAL TO - u'\u2264' # 0x98 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO - u'\xa0' # 0x9A -> NO-BREAK SPACE - u'\u2321' # 0x9B -> BOTTOM HALF INTEGRAL - u'\xb0' # 0x9C -> DEGREE SIGN - u'\xb2' # 0x9D -> SUPERSCRIPT TWO - u'\xb7' # 0x9E -> MIDDLE DOT - u'\xf7' # 0x9F -> DIVISION SIGN - u'\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO - u'\u2553' # 0xA4 -> BOX DRAWINGS DOWN DOUBLE AND RIGHT SINGLE - u'\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u2555' # 0xA6 -> BOX DRAWINGS DOWN SINGLE AND LEFT DOUBLE - u'\u2556' # 0xA7 -> BOX DRAWINGS DOWN DOUBLE AND LEFT SINGLE - u'\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u255c' # 0xAD -> BOX DRAWINGS UP DOUBLE AND LEFT SINGLE - u'\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO - u'\u2562' # 0xB4 -> BOX DRAWINGS VERTICAL DOUBLE AND LEFT SINGLE - u'\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u2564' # 0xB6 -> BOX DRAWINGS DOWN SINGLE AND HORIZONTAL DOUBLE - u'\u2565' # 0xB7 -> BOX DRAWINGS DOWN DOUBLE AND HORIZONTAL SINGLE - u'\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u256b' # 0xBD -> BOX DRAWINGS VERTICAL DOUBLE AND HORIZONTAL SINGLE - u'\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa9' # 0xBF -> COPYRIGHT SIGN - u'\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU - u'\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE - u'\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE - u'\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE - u'\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF - u'\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE - u'\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA - u'\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xCF -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE - u'\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA - u'\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U - u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE - u'\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE - u'\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU - u'\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE - u'\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA - u'\u044d' # 0xDC -> CYRILLIC SMALL LETTER E - u'\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA - u'\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE - u'\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN - u'\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU - u'\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE - u'\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE - u'\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE - u'\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF - u'\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE - u'\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA - u'\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE - u'\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA - u'\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U - u'\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE - u'\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU - u'\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE - u'\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA - u'\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E - u'\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA - u'\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE - u'\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py deleted file mode 100644 index edb85f4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/koi8_u.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec koi8_u generated from 'python-mappings/KOI8-U.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='koi8-u', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\u2500' # 0x80 -> BOX DRAWINGS LIGHT HORIZONTAL - u'\u2502' # 0x81 -> BOX DRAWINGS LIGHT VERTICAL - u'\u250c' # 0x82 -> BOX DRAWINGS LIGHT DOWN AND RIGHT - u'\u2510' # 0x83 -> BOX DRAWINGS LIGHT DOWN AND LEFT - u'\u2514' # 0x84 -> BOX DRAWINGS LIGHT UP AND RIGHT - u'\u2518' # 0x85 -> BOX DRAWINGS LIGHT UP AND LEFT - u'\u251c' # 0x86 -> BOX DRAWINGS LIGHT VERTICAL AND RIGHT - u'\u2524' # 0x87 -> BOX DRAWINGS LIGHT VERTICAL AND LEFT - u'\u252c' # 0x88 -> BOX DRAWINGS LIGHT DOWN AND HORIZONTAL - u'\u2534' # 0x89 -> BOX DRAWINGS LIGHT UP AND HORIZONTAL - u'\u253c' # 0x8A -> BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL - u'\u2580' # 0x8B -> UPPER HALF BLOCK - u'\u2584' # 0x8C -> LOWER HALF BLOCK - u'\u2588' # 0x8D -> FULL BLOCK - u'\u258c' # 0x8E -> LEFT HALF BLOCK - u'\u2590' # 0x8F -> RIGHT HALF BLOCK - u'\u2591' # 0x90 -> LIGHT SHADE - u'\u2592' # 0x91 -> MEDIUM SHADE - u'\u2593' # 0x92 -> DARK SHADE - u'\u2320' # 0x93 -> TOP HALF INTEGRAL - u'\u25a0' # 0x94 -> BLACK SQUARE - u'\u2219' # 0x95 -> BULLET OPERATOR - u'\u221a' # 0x96 -> SQUARE ROOT - u'\u2248' # 0x97 -> ALMOST EQUAL TO - u'\u2264' # 0x98 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0x99 -> GREATER-THAN OR EQUAL TO - u'\xa0' # 0x9A -> NO-BREAK SPACE - u'\u2321' # 0x9B -> BOTTOM HALF INTEGRAL - u'\xb0' # 0x9C -> DEGREE SIGN - u'\xb2' # 0x9D -> SUPERSCRIPT TWO - u'\xb7' # 0x9E -> MIDDLE DOT - u'\xf7' # 0x9F -> DIVISION SIGN - u'\u2550' # 0xA0 -> BOX DRAWINGS DOUBLE HORIZONTAL - u'\u2551' # 0xA1 -> BOX DRAWINGS DOUBLE VERTICAL - u'\u2552' # 0xA2 -> BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE - u'\u0451' # 0xA3 -> CYRILLIC SMALL LETTER IO - u'\u0454' # 0xA4 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u2554' # 0xA5 -> BOX DRAWINGS DOUBLE DOWN AND RIGHT - u'\u0456' # 0xA6 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0457' # 0xA7 -> CYRILLIC SMALL LETTER YI (UKRAINIAN) - u'\u2557' # 0xA8 -> BOX DRAWINGS DOUBLE DOWN AND LEFT - u'\u2558' # 0xA9 -> BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE - u'\u2559' # 0xAA -> BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE - u'\u255a' # 0xAB -> BOX DRAWINGS DOUBLE UP AND RIGHT - u'\u255b' # 0xAC -> BOX DRAWINGS UP SINGLE AND LEFT DOUBLE - u'\u0491' # 0xAD -> CYRILLIC SMALL LETTER UKRAINIAN GHE WITH UPTURN - u'\u255d' # 0xAE -> BOX DRAWINGS DOUBLE UP AND LEFT - u'\u255e' # 0xAF -> BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE - u'\u255f' # 0xB0 -> BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE - u'\u2560' # 0xB1 -> BOX DRAWINGS DOUBLE VERTICAL AND RIGHT - u'\u2561' # 0xB2 -> BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE - u'\u0401' # 0xB3 -> CYRILLIC CAPITAL LETTER IO - u'\u0404' # 0xB4 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u2563' # 0xB5 -> BOX DRAWINGS DOUBLE VERTICAL AND LEFT - u'\u0406' # 0xB6 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\u0407' # 0xB7 -> CYRILLIC CAPITAL LETTER YI (UKRAINIAN) - u'\u2566' # 0xB8 -> BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL - u'\u2567' # 0xB9 -> BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE - u'\u2568' # 0xBA -> BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE - u'\u2569' # 0xBB -> BOX DRAWINGS DOUBLE UP AND HORIZONTAL - u'\u256a' # 0xBC -> BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE - u'\u0490' # 0xBD -> CYRILLIC CAPITAL LETTER UKRAINIAN GHE WITH UPTURN - u'\u256c' # 0xBE -> BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL - u'\xa9' # 0xBF -> COPYRIGHT SIGN - u'\u044e' # 0xC0 -> CYRILLIC SMALL LETTER YU - u'\u0430' # 0xC1 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xC2 -> CYRILLIC SMALL LETTER BE - u'\u0446' # 0xC3 -> CYRILLIC SMALL LETTER TSE - u'\u0434' # 0xC4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xC5 -> CYRILLIC SMALL LETTER IE - u'\u0444' # 0xC6 -> CYRILLIC SMALL LETTER EF - u'\u0433' # 0xC7 -> CYRILLIC SMALL LETTER GHE - u'\u0445' # 0xC8 -> CYRILLIC SMALL LETTER HA - u'\u0438' # 0xC9 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xCA -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xCB -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xCC -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xCD -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xCE -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xCF -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xD0 -> CYRILLIC SMALL LETTER PE - u'\u044f' # 0xD1 -> CYRILLIC SMALL LETTER YA - u'\u0440' # 0xD2 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xD3 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xD4 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xD5 -> CYRILLIC SMALL LETTER U - u'\u0436' # 0xD6 -> CYRILLIC SMALL LETTER ZHE - u'\u0432' # 0xD7 -> CYRILLIC SMALL LETTER VE - u'\u044c' # 0xD8 -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044b' # 0xD9 -> CYRILLIC SMALL LETTER YERU - u'\u0437' # 0xDA -> CYRILLIC SMALL LETTER ZE - u'\u0448' # 0xDB -> CYRILLIC SMALL LETTER SHA - u'\u044d' # 0xDC -> CYRILLIC SMALL LETTER E - u'\u0449' # 0xDD -> CYRILLIC SMALL LETTER SHCHA - u'\u0447' # 0xDE -> CYRILLIC SMALL LETTER CHE - u'\u044a' # 0xDF -> CYRILLIC SMALL LETTER HARD SIGN - u'\u042e' # 0xE0 -> CYRILLIC CAPITAL LETTER YU - u'\u0410' # 0xE1 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0xE2 -> CYRILLIC CAPITAL LETTER BE - u'\u0426' # 0xE3 -> CYRILLIC CAPITAL LETTER TSE - u'\u0414' # 0xE4 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0xE5 -> CYRILLIC CAPITAL LETTER IE - u'\u0424' # 0xE6 -> CYRILLIC CAPITAL LETTER EF - u'\u0413' # 0xE7 -> CYRILLIC CAPITAL LETTER GHE - u'\u0425' # 0xE8 -> CYRILLIC CAPITAL LETTER HA - u'\u0418' # 0xE9 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0xEA -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0xEB -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0xEC -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0xED -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0xEE -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0xEF -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0xF0 -> CYRILLIC CAPITAL LETTER PE - u'\u042f' # 0xF1 -> CYRILLIC CAPITAL LETTER YA - u'\u0420' # 0xF2 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0xF3 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0xF4 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0xF5 -> CYRILLIC CAPITAL LETTER U - u'\u0416' # 0xF6 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0412' # 0xF7 -> CYRILLIC CAPITAL LETTER VE - u'\u042c' # 0xF8 -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042b' # 0xF9 -> CYRILLIC CAPITAL LETTER YERU - u'\u0417' # 0xFA -> CYRILLIC CAPITAL LETTER ZE - u'\u0428' # 0xFB -> CYRILLIC CAPITAL LETTER SHA - u'\u042d' # 0xFC -> CYRILLIC CAPITAL LETTER E - u'\u0429' # 0xFD -> CYRILLIC CAPITAL LETTER SHCHA - u'\u0427' # 0xFE -> CYRILLIC CAPITAL LETTER CHE - u'\u042a' # 0xFF -> CYRILLIC CAPITAL LETTER HARD SIGN -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py deleted file mode 100644 index a6193bc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/latin_1.py +++ /dev/null @@ -1,50 +0,0 @@ -""" Python 'latin-1' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - # Note: Binding these as C functions will result in the class not - # converting them to methods. This is intended. - encode = codecs.latin_1_encode - decode = codecs.latin_1_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.latin_1_encode(input,self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.latin_1_decode(input,self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -class StreamConverter(StreamWriter,StreamReader): - - encode = codecs.latin_1_decode - decode = codecs.latin_1_encode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='iso8859-1', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py deleted file mode 100644 index e5e63e3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_arabic.py +++ /dev/null @@ -1,698 +0,0 @@ -""" Python Character Mapping Codec generated from 'VENDORS/APPLE/ARABIC.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-arabic', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x0081: 0x00a0, # NO-BREAK SPACE, right-left - 0x0082: 0x00c7, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0084: 0x00d1, # LATIN CAPITAL LETTER N WITH TILDE - 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x0088: 0x00e0, # LATIN SMALL LETTER A WITH GRAVE - 0x0089: 0x00e2, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x008b: 0x06ba, # ARABIC LETTER NOON GHUNNA - 0x008c: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - 0x008d: 0x00e7, # LATIN SMALL LETTER C WITH CEDILLA - 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x008f: 0x00e8, # LATIN SMALL LETTER E WITH GRAVE - 0x0090: 0x00ea, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x0091: 0x00eb, # LATIN SMALL LETTER E WITH DIAERESIS - 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x0093: 0x2026, # HORIZONTAL ELLIPSIS, right-left - 0x0094: 0x00ee, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x0095: 0x00ef, # LATIN SMALL LETTER I WITH DIAERESIS - 0x0096: 0x00f1, # LATIN SMALL LETTER N WITH TILDE - 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x0098: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x009b: 0x00f7, # DIVISION SIGN, right-left - 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x009d: 0x00f9, # LATIN SMALL LETTER U WITH GRAVE - 0x009e: 0x00fb, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00a0: 0x0020, # SPACE, right-left - 0x00a1: 0x0021, # EXCLAMATION MARK, right-left - 0x00a2: 0x0022, # QUOTATION MARK, right-left - 0x00a3: 0x0023, # NUMBER SIGN, right-left - 0x00a4: 0x0024, # DOLLAR SIGN, right-left - 0x00a5: 0x066a, # ARABIC PERCENT SIGN - 0x00a6: 0x0026, # AMPERSAND, right-left - 0x00a7: 0x0027, # APOSTROPHE, right-left - 0x00a8: 0x0028, # LEFT PARENTHESIS, right-left - 0x00a9: 0x0029, # RIGHT PARENTHESIS, right-left - 0x00aa: 0x002a, # ASTERISK, right-left - 0x00ab: 0x002b, # PLUS SIGN, right-left - 0x00ac: 0x060c, # ARABIC COMMA - 0x00ad: 0x002d, # HYPHEN-MINUS, right-left - 0x00ae: 0x002e, # FULL STOP, right-left - 0x00af: 0x002f, # SOLIDUS, right-left - 0x00b0: 0x0660, # ARABIC-INDIC DIGIT ZERO, right-left (need override) - 0x00b1: 0x0661, # ARABIC-INDIC DIGIT ONE, right-left (need override) - 0x00b2: 0x0662, # ARABIC-INDIC DIGIT TWO, right-left (need override) - 0x00b3: 0x0663, # ARABIC-INDIC DIGIT THREE, right-left (need override) - 0x00b4: 0x0664, # ARABIC-INDIC DIGIT FOUR, right-left (need override) - 0x00b5: 0x0665, # ARABIC-INDIC DIGIT FIVE, right-left (need override) - 0x00b6: 0x0666, # ARABIC-INDIC DIGIT SIX, right-left (need override) - 0x00b7: 0x0667, # ARABIC-INDIC DIGIT SEVEN, right-left (need override) - 0x00b8: 0x0668, # ARABIC-INDIC DIGIT EIGHT, right-left (need override) - 0x00b9: 0x0669, # ARABIC-INDIC DIGIT NINE, right-left (need override) - 0x00ba: 0x003a, # COLON, right-left - 0x00bb: 0x061b, # ARABIC SEMICOLON - 0x00bc: 0x003c, # LESS-THAN SIGN, right-left - 0x00bd: 0x003d, # EQUALS SIGN, right-left - 0x00be: 0x003e, # GREATER-THAN SIGN, right-left - 0x00bf: 0x061f, # ARABIC QUESTION MARK - 0x00c0: 0x274a, # EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left - 0x00c1: 0x0621, # ARABIC LETTER HAMZA - 0x00c2: 0x0622, # ARABIC LETTER ALEF WITH MADDA ABOVE - 0x00c3: 0x0623, # ARABIC LETTER ALEF WITH HAMZA ABOVE - 0x00c4: 0x0624, # ARABIC LETTER WAW WITH HAMZA ABOVE - 0x00c5: 0x0625, # ARABIC LETTER ALEF WITH HAMZA BELOW - 0x00c6: 0x0626, # ARABIC LETTER YEH WITH HAMZA ABOVE - 0x00c7: 0x0627, # ARABIC LETTER ALEF - 0x00c8: 0x0628, # ARABIC LETTER BEH - 0x00c9: 0x0629, # ARABIC LETTER TEH MARBUTA - 0x00ca: 0x062a, # ARABIC LETTER TEH - 0x00cb: 0x062b, # ARABIC LETTER THEH - 0x00cc: 0x062c, # ARABIC LETTER JEEM - 0x00cd: 0x062d, # ARABIC LETTER HAH - 0x00ce: 0x062e, # ARABIC LETTER KHAH - 0x00cf: 0x062f, # ARABIC LETTER DAL - 0x00d0: 0x0630, # ARABIC LETTER THAL - 0x00d1: 0x0631, # ARABIC LETTER REH - 0x00d2: 0x0632, # ARABIC LETTER ZAIN - 0x00d3: 0x0633, # ARABIC LETTER SEEN - 0x00d4: 0x0634, # ARABIC LETTER SHEEN - 0x00d5: 0x0635, # ARABIC LETTER SAD - 0x00d6: 0x0636, # ARABIC LETTER DAD - 0x00d7: 0x0637, # ARABIC LETTER TAH - 0x00d8: 0x0638, # ARABIC LETTER ZAH - 0x00d9: 0x0639, # ARABIC LETTER AIN - 0x00da: 0x063a, # ARABIC LETTER GHAIN - 0x00db: 0x005b, # LEFT SQUARE BRACKET, right-left - 0x00dc: 0x005c, # REVERSE SOLIDUS, right-left - 0x00dd: 0x005d, # RIGHT SQUARE BRACKET, right-left - 0x00de: 0x005e, # CIRCUMFLEX ACCENT, right-left - 0x00df: 0x005f, # LOW LINE, right-left - 0x00e0: 0x0640, # ARABIC TATWEEL - 0x00e1: 0x0641, # ARABIC LETTER FEH - 0x00e2: 0x0642, # ARABIC LETTER QAF - 0x00e3: 0x0643, # ARABIC LETTER KAF - 0x00e4: 0x0644, # ARABIC LETTER LAM - 0x00e5: 0x0645, # ARABIC LETTER MEEM - 0x00e6: 0x0646, # ARABIC LETTER NOON - 0x00e7: 0x0647, # ARABIC LETTER HEH - 0x00e8: 0x0648, # ARABIC LETTER WAW - 0x00e9: 0x0649, # ARABIC LETTER ALEF MAKSURA - 0x00ea: 0x064a, # ARABIC LETTER YEH - 0x00eb: 0x064b, # ARABIC FATHATAN - 0x00ec: 0x064c, # ARABIC DAMMATAN - 0x00ed: 0x064d, # ARABIC KASRATAN - 0x00ee: 0x064e, # ARABIC FATHA - 0x00ef: 0x064f, # ARABIC DAMMA - 0x00f0: 0x0650, # ARABIC KASRA - 0x00f1: 0x0651, # ARABIC SHADDA - 0x00f2: 0x0652, # ARABIC SUKUN - 0x00f3: 0x067e, # ARABIC LETTER PEH - 0x00f4: 0x0679, # ARABIC LETTER TTEH - 0x00f5: 0x0686, # ARABIC LETTER TCHEH - 0x00f6: 0x06d5, # ARABIC LETTER AE - 0x00f7: 0x06a4, # ARABIC LETTER VEH - 0x00f8: 0x06af, # ARABIC LETTER GAF - 0x00f9: 0x0688, # ARABIC LETTER DDAL - 0x00fa: 0x0691, # ARABIC LETTER RREH - 0x00fb: 0x007b, # LEFT CURLY BRACKET, right-left - 0x00fc: 0x007c, # VERTICAL LINE, right-left - 0x00fd: 0x007d, # RIGHT CURLY BRACKET, right-left - 0x00fe: 0x0698, # ARABIC LETTER JEH - 0x00ff: 0x06d2, # ARABIC LETTER YEH BARREE -}) - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x0000 -> CONTROL CHARACTER - u'\x01' # 0x0001 -> CONTROL CHARACTER - u'\x02' # 0x0002 -> CONTROL CHARACTER - u'\x03' # 0x0003 -> CONTROL CHARACTER - u'\x04' # 0x0004 -> CONTROL CHARACTER - u'\x05' # 0x0005 -> CONTROL CHARACTER - u'\x06' # 0x0006 -> CONTROL CHARACTER - u'\x07' # 0x0007 -> CONTROL CHARACTER - u'\x08' # 0x0008 -> CONTROL CHARACTER - u'\t' # 0x0009 -> CONTROL CHARACTER - u'\n' # 0x000a -> CONTROL CHARACTER - u'\x0b' # 0x000b -> CONTROL CHARACTER - u'\x0c' # 0x000c -> CONTROL CHARACTER - u'\r' # 0x000d -> CONTROL CHARACTER - u'\x0e' # 0x000e -> CONTROL CHARACTER - u'\x0f' # 0x000f -> CONTROL CHARACTER - u'\x10' # 0x0010 -> CONTROL CHARACTER - u'\x11' # 0x0011 -> CONTROL CHARACTER - u'\x12' # 0x0012 -> CONTROL CHARACTER - u'\x13' # 0x0013 -> CONTROL CHARACTER - u'\x14' # 0x0014 -> CONTROL CHARACTER - u'\x15' # 0x0015 -> CONTROL CHARACTER - u'\x16' # 0x0016 -> CONTROL CHARACTER - u'\x17' # 0x0017 -> CONTROL CHARACTER - u'\x18' # 0x0018 -> CONTROL CHARACTER - u'\x19' # 0x0019 -> CONTROL CHARACTER - u'\x1a' # 0x001a -> CONTROL CHARACTER - u'\x1b' # 0x001b -> CONTROL CHARACTER - u'\x1c' # 0x001c -> CONTROL CHARACTER - u'\x1d' # 0x001d -> CONTROL CHARACTER - u'\x1e' # 0x001e -> CONTROL CHARACTER - u'\x1f' # 0x001f -> CONTROL CHARACTER - u' ' # 0x0020 -> SPACE, left-right - u'!' # 0x0021 -> EXCLAMATION MARK, left-right - u'"' # 0x0022 -> QUOTATION MARK, left-right - u'#' # 0x0023 -> NUMBER SIGN, left-right - u'$' # 0x0024 -> DOLLAR SIGN, left-right - u'%' # 0x0025 -> PERCENT SIGN, left-right - u'&' # 0x0026 -> AMPERSAND, left-right - u"'" # 0x0027 -> APOSTROPHE, left-right - u'(' # 0x0028 -> LEFT PARENTHESIS, left-right - u')' # 0x0029 -> RIGHT PARENTHESIS, left-right - u'*' # 0x002a -> ASTERISK, left-right - u'+' # 0x002b -> PLUS SIGN, left-right - u',' # 0x002c -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR - u'-' # 0x002d -> HYPHEN-MINUS, left-right - u'.' # 0x002e -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR - u'/' # 0x002f -> SOLIDUS, left-right - u'0' # 0x0030 -> DIGIT ZERO; in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO - u'1' # 0x0031 -> DIGIT ONE; in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE - u'2' # 0x0032 -> DIGIT TWO; in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO - u'3' # 0x0033 -> DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE - u'4' # 0x0034 -> DIGIT FOUR; in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR - u'5' # 0x0035 -> DIGIT FIVE; in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE - u'6' # 0x0036 -> DIGIT SIX; in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX - u'7' # 0x0037 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN - u'8' # 0x0038 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT - u'9' # 0x0039 -> DIGIT NINE; in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE - u':' # 0x003a -> COLON, left-right - u';' # 0x003b -> SEMICOLON, left-right - u'<' # 0x003c -> LESS-THAN SIGN, left-right - u'=' # 0x003d -> EQUALS SIGN, left-right - u'>' # 0x003e -> GREATER-THAN SIGN, left-right - u'?' # 0x003f -> QUESTION MARK, left-right - u'@' # 0x0040 -> COMMERCIAL AT - u'A' # 0x0041 -> LATIN CAPITAL LETTER A - u'B' # 0x0042 -> LATIN CAPITAL LETTER B - u'C' # 0x0043 -> LATIN CAPITAL LETTER C - u'D' # 0x0044 -> LATIN CAPITAL LETTER D - u'E' # 0x0045 -> LATIN CAPITAL LETTER E - u'F' # 0x0046 -> LATIN CAPITAL LETTER F - u'G' # 0x0047 -> LATIN CAPITAL LETTER G - u'H' # 0x0048 -> LATIN CAPITAL LETTER H - u'I' # 0x0049 -> LATIN CAPITAL LETTER I - u'J' # 0x004a -> LATIN CAPITAL LETTER J - u'K' # 0x004b -> LATIN CAPITAL LETTER K - u'L' # 0x004c -> LATIN CAPITAL LETTER L - u'M' # 0x004d -> LATIN CAPITAL LETTER M - u'N' # 0x004e -> LATIN CAPITAL LETTER N - u'O' # 0x004f -> LATIN CAPITAL LETTER O - u'P' # 0x0050 -> LATIN CAPITAL LETTER P - u'Q' # 0x0051 -> LATIN CAPITAL LETTER Q - u'R' # 0x0052 -> LATIN CAPITAL LETTER R - u'S' # 0x0053 -> LATIN CAPITAL LETTER S - u'T' # 0x0054 -> LATIN CAPITAL LETTER T - u'U' # 0x0055 -> LATIN CAPITAL LETTER U - u'V' # 0x0056 -> LATIN CAPITAL LETTER V - u'W' # 0x0057 -> LATIN CAPITAL LETTER W - u'X' # 0x0058 -> LATIN CAPITAL LETTER X - u'Y' # 0x0059 -> LATIN CAPITAL LETTER Y - u'Z' # 0x005a -> LATIN CAPITAL LETTER Z - u'[' # 0x005b -> LEFT SQUARE BRACKET, left-right - u'\\' # 0x005c -> REVERSE SOLIDUS, left-right - u']' # 0x005d -> RIGHT SQUARE BRACKET, left-right - u'^' # 0x005e -> CIRCUMFLEX ACCENT, left-right - u'_' # 0x005f -> LOW LINE, left-right - u'`' # 0x0060 -> GRAVE ACCENT - u'a' # 0x0061 -> LATIN SMALL LETTER A - u'b' # 0x0062 -> LATIN SMALL LETTER B - u'c' # 0x0063 -> LATIN SMALL LETTER C - u'd' # 0x0064 -> LATIN SMALL LETTER D - u'e' # 0x0065 -> LATIN SMALL LETTER E - u'f' # 0x0066 -> LATIN SMALL LETTER F - u'g' # 0x0067 -> LATIN SMALL LETTER G - u'h' # 0x0068 -> LATIN SMALL LETTER H - u'i' # 0x0069 -> LATIN SMALL LETTER I - u'j' # 0x006a -> LATIN SMALL LETTER J - u'k' # 0x006b -> LATIN SMALL LETTER K - u'l' # 0x006c -> LATIN SMALL LETTER L - u'm' # 0x006d -> LATIN SMALL LETTER M - u'n' # 0x006e -> LATIN SMALL LETTER N - u'o' # 0x006f -> LATIN SMALL LETTER O - u'p' # 0x0070 -> LATIN SMALL LETTER P - u'q' # 0x0071 -> LATIN SMALL LETTER Q - u'r' # 0x0072 -> LATIN SMALL LETTER R - u's' # 0x0073 -> LATIN SMALL LETTER S - u't' # 0x0074 -> LATIN SMALL LETTER T - u'u' # 0x0075 -> LATIN SMALL LETTER U - u'v' # 0x0076 -> LATIN SMALL LETTER V - u'w' # 0x0077 -> LATIN SMALL LETTER W - u'x' # 0x0078 -> LATIN SMALL LETTER X - u'y' # 0x0079 -> LATIN SMALL LETTER Y - u'z' # 0x007a -> LATIN SMALL LETTER Z - u'{' # 0x007b -> LEFT CURLY BRACKET, left-right - u'|' # 0x007c -> VERTICAL LINE, left-right - u'}' # 0x007d -> RIGHT CURLY BRACKET, left-right - u'~' # 0x007e -> TILDE - u'\x7f' # 0x007f -> CONTROL CHARACTER - u'\xc4' # 0x0080 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xa0' # 0x0081 -> NO-BREAK SPACE, right-left - u'\xc7' # 0x0082 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x0083 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x0084 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x0085 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x0086 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x0087 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x0088 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x0089 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x008a -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u06ba' # 0x008b -> ARABIC LETTER NOON GHUNNA - u'\xab' # 0x008c -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xe7' # 0x008d -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x008e -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x008f -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x0090 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x0091 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x0092 -> LATIN SMALL LETTER I WITH ACUTE - u'\u2026' # 0x0093 -> HORIZONTAL ELLIPSIS, right-left - u'\xee' # 0x0094 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x0095 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x0096 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x0097 -> LATIN SMALL LETTER O WITH ACUTE - u'\xbb' # 0x0098 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xf4' # 0x0099 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x009a -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0x009b -> DIVISION SIGN, right-left - u'\xfa' # 0x009c -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x009d -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x009e -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x009f -> LATIN SMALL LETTER U WITH DIAERESIS - u' ' # 0x00a0 -> SPACE, right-left - u'!' # 0x00a1 -> EXCLAMATION MARK, right-left - u'"' # 0x00a2 -> QUOTATION MARK, right-left - u'#' # 0x00a3 -> NUMBER SIGN, right-left - u'$' # 0x00a4 -> DOLLAR SIGN, right-left - u'\u066a' # 0x00a5 -> ARABIC PERCENT SIGN - u'&' # 0x00a6 -> AMPERSAND, right-left - u"'" # 0x00a7 -> APOSTROPHE, right-left - u'(' # 0x00a8 -> LEFT PARENTHESIS, right-left - u')' # 0x00a9 -> RIGHT PARENTHESIS, right-left - u'*' # 0x00aa -> ASTERISK, right-left - u'+' # 0x00ab -> PLUS SIGN, right-left - u'\u060c' # 0x00ac -> ARABIC COMMA - u'-' # 0x00ad -> HYPHEN-MINUS, right-left - u'.' # 0x00ae -> FULL STOP, right-left - u'/' # 0x00af -> SOLIDUS, right-left - u'\u0660' # 0x00b0 -> ARABIC-INDIC DIGIT ZERO, right-left (need override) - u'\u0661' # 0x00b1 -> ARABIC-INDIC DIGIT ONE, right-left (need override) - u'\u0662' # 0x00b2 -> ARABIC-INDIC DIGIT TWO, right-left (need override) - u'\u0663' # 0x00b3 -> ARABIC-INDIC DIGIT THREE, right-left (need override) - u'\u0664' # 0x00b4 -> ARABIC-INDIC DIGIT FOUR, right-left (need override) - u'\u0665' # 0x00b5 -> ARABIC-INDIC DIGIT FIVE, right-left (need override) - u'\u0666' # 0x00b6 -> ARABIC-INDIC DIGIT SIX, right-left (need override) - u'\u0667' # 0x00b7 -> ARABIC-INDIC DIGIT SEVEN, right-left (need override) - u'\u0668' # 0x00b8 -> ARABIC-INDIC DIGIT EIGHT, right-left (need override) - u'\u0669' # 0x00b9 -> ARABIC-INDIC DIGIT NINE, right-left (need override) - u':' # 0x00ba -> COLON, right-left - u'\u061b' # 0x00bb -> ARABIC SEMICOLON - u'<' # 0x00bc -> LESS-THAN SIGN, right-left - u'=' # 0x00bd -> EQUALS SIGN, right-left - u'>' # 0x00be -> GREATER-THAN SIGN, right-left - u'\u061f' # 0x00bf -> ARABIC QUESTION MARK - u'\u274a' # 0x00c0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left - u'\u0621' # 0x00c1 -> ARABIC LETTER HAMZA - u'\u0622' # 0x00c2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0x00c3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0x00c4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0x00c5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0x00c6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0x00c7 -> ARABIC LETTER ALEF - u'\u0628' # 0x00c8 -> ARABIC LETTER BEH - u'\u0629' # 0x00c9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0x00ca -> ARABIC LETTER TEH - u'\u062b' # 0x00cb -> ARABIC LETTER THEH - u'\u062c' # 0x00cc -> ARABIC LETTER JEEM - u'\u062d' # 0x00cd -> ARABIC LETTER HAH - u'\u062e' # 0x00ce -> ARABIC LETTER KHAH - u'\u062f' # 0x00cf -> ARABIC LETTER DAL - u'\u0630' # 0x00d0 -> ARABIC LETTER THAL - u'\u0631' # 0x00d1 -> ARABIC LETTER REH - u'\u0632' # 0x00d2 -> ARABIC LETTER ZAIN - u'\u0633' # 0x00d3 -> ARABIC LETTER SEEN - u'\u0634' # 0x00d4 -> ARABIC LETTER SHEEN - u'\u0635' # 0x00d5 -> ARABIC LETTER SAD - u'\u0636' # 0x00d6 -> ARABIC LETTER DAD - u'\u0637' # 0x00d7 -> ARABIC LETTER TAH - u'\u0638' # 0x00d8 -> ARABIC LETTER ZAH - u'\u0639' # 0x00d9 -> ARABIC LETTER AIN - u'\u063a' # 0x00da -> ARABIC LETTER GHAIN - u'[' # 0x00db -> LEFT SQUARE BRACKET, right-left - u'\\' # 0x00dc -> REVERSE SOLIDUS, right-left - u']' # 0x00dd -> RIGHT SQUARE BRACKET, right-left - u'^' # 0x00de -> CIRCUMFLEX ACCENT, right-left - u'_' # 0x00df -> LOW LINE, right-left - u'\u0640' # 0x00e0 -> ARABIC TATWEEL - u'\u0641' # 0x00e1 -> ARABIC LETTER FEH - u'\u0642' # 0x00e2 -> ARABIC LETTER QAF - u'\u0643' # 0x00e3 -> ARABIC LETTER KAF - u'\u0644' # 0x00e4 -> ARABIC LETTER LAM - u'\u0645' # 0x00e5 -> ARABIC LETTER MEEM - u'\u0646' # 0x00e6 -> ARABIC LETTER NOON - u'\u0647' # 0x00e7 -> ARABIC LETTER HEH - u'\u0648' # 0x00e8 -> ARABIC LETTER WAW - u'\u0649' # 0x00e9 -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0x00ea -> ARABIC LETTER YEH - u'\u064b' # 0x00eb -> ARABIC FATHATAN - u'\u064c' # 0x00ec -> ARABIC DAMMATAN - u'\u064d' # 0x00ed -> ARABIC KASRATAN - u'\u064e' # 0x00ee -> ARABIC FATHA - u'\u064f' # 0x00ef -> ARABIC DAMMA - u'\u0650' # 0x00f0 -> ARABIC KASRA - u'\u0651' # 0x00f1 -> ARABIC SHADDA - u'\u0652' # 0x00f2 -> ARABIC SUKUN - u'\u067e' # 0x00f3 -> ARABIC LETTER PEH - u'\u0679' # 0x00f4 -> ARABIC LETTER TTEH - u'\u0686' # 0x00f5 -> ARABIC LETTER TCHEH - u'\u06d5' # 0x00f6 -> ARABIC LETTER AE - u'\u06a4' # 0x00f7 -> ARABIC LETTER VEH - u'\u06af' # 0x00f8 -> ARABIC LETTER GAF - u'\u0688' # 0x00f9 -> ARABIC LETTER DDAL - u'\u0691' # 0x00fa -> ARABIC LETTER RREH - u'{' # 0x00fb -> LEFT CURLY BRACKET, right-left - u'|' # 0x00fc -> VERTICAL LINE, right-left - u'}' # 0x00fd -> RIGHT CURLY BRACKET, right-left - u'\u0698' # 0x00fe -> ARABIC LETTER JEH - u'\u06d2' # 0x00ff -> ARABIC LETTER YEH BARREE -) - -### Encoding Map - -encoding_map = { - 0x0000: 0x0000, # CONTROL CHARACTER - 0x0001: 0x0001, # CONTROL CHARACTER - 0x0002: 0x0002, # CONTROL CHARACTER - 0x0003: 0x0003, # CONTROL CHARACTER - 0x0004: 0x0004, # CONTROL CHARACTER - 0x0005: 0x0005, # CONTROL CHARACTER - 0x0006: 0x0006, # CONTROL CHARACTER - 0x0007: 0x0007, # CONTROL CHARACTER - 0x0008: 0x0008, # CONTROL CHARACTER - 0x0009: 0x0009, # CONTROL CHARACTER - 0x000a: 0x000a, # CONTROL CHARACTER - 0x000b: 0x000b, # CONTROL CHARACTER - 0x000c: 0x000c, # CONTROL CHARACTER - 0x000d: 0x000d, # CONTROL CHARACTER - 0x000e: 0x000e, # CONTROL CHARACTER - 0x000f: 0x000f, # CONTROL CHARACTER - 0x0010: 0x0010, # CONTROL CHARACTER - 0x0011: 0x0011, # CONTROL CHARACTER - 0x0012: 0x0012, # CONTROL CHARACTER - 0x0013: 0x0013, # CONTROL CHARACTER - 0x0014: 0x0014, # CONTROL CHARACTER - 0x0015: 0x0015, # CONTROL CHARACTER - 0x0016: 0x0016, # CONTROL CHARACTER - 0x0017: 0x0017, # CONTROL CHARACTER - 0x0018: 0x0018, # CONTROL CHARACTER - 0x0019: 0x0019, # CONTROL CHARACTER - 0x001a: 0x001a, # CONTROL CHARACTER - 0x001b: 0x001b, # CONTROL CHARACTER - 0x001c: 0x001c, # CONTROL CHARACTER - 0x001d: 0x001d, # CONTROL CHARACTER - 0x001e: 0x001e, # CONTROL CHARACTER - 0x001f: 0x001f, # CONTROL CHARACTER - 0x0020: 0x0020, # SPACE, left-right - 0x0020: 0x00a0, # SPACE, right-left - 0x0021: 0x0021, # EXCLAMATION MARK, left-right - 0x0021: 0x00a1, # EXCLAMATION MARK, right-left - 0x0022: 0x0022, # QUOTATION MARK, left-right - 0x0022: 0x00a2, # QUOTATION MARK, right-left - 0x0023: 0x0023, # NUMBER SIGN, left-right - 0x0023: 0x00a3, # NUMBER SIGN, right-left - 0x0024: 0x0024, # DOLLAR SIGN, left-right - 0x0024: 0x00a4, # DOLLAR SIGN, right-left - 0x0025: 0x0025, # PERCENT SIGN, left-right - 0x0026: 0x0026, # AMPERSAND, left-right - 0x0026: 0x00a6, # AMPERSAND, right-left - 0x0027: 0x0027, # APOSTROPHE, left-right - 0x0027: 0x00a7, # APOSTROPHE, right-left - 0x0028: 0x0028, # LEFT PARENTHESIS, left-right - 0x0028: 0x00a8, # LEFT PARENTHESIS, right-left - 0x0029: 0x0029, # RIGHT PARENTHESIS, left-right - 0x0029: 0x00a9, # RIGHT PARENTHESIS, right-left - 0x002a: 0x002a, # ASTERISK, left-right - 0x002a: 0x00aa, # ASTERISK, right-left - 0x002b: 0x002b, # PLUS SIGN, left-right - 0x002b: 0x00ab, # PLUS SIGN, right-left - 0x002c: 0x002c, # COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR - 0x002d: 0x002d, # HYPHEN-MINUS, left-right - 0x002d: 0x00ad, # HYPHEN-MINUS, right-left - 0x002e: 0x002e, # FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR - 0x002e: 0x00ae, # FULL STOP, right-left - 0x002f: 0x002f, # SOLIDUS, left-right - 0x002f: 0x00af, # SOLIDUS, right-left - 0x0030: 0x0030, # DIGIT ZERO; in Arabic-script context, displayed as 0x0660 ARABIC-INDIC DIGIT ZERO - 0x0031: 0x0031, # DIGIT ONE; in Arabic-script context, displayed as 0x0661 ARABIC-INDIC DIGIT ONE - 0x0032: 0x0032, # DIGIT TWO; in Arabic-script context, displayed as 0x0662 ARABIC-INDIC DIGIT TWO - 0x0033: 0x0033, # DIGIT THREE; in Arabic-script context, displayed as 0x0663 ARABIC-INDIC DIGIT THREE - 0x0034: 0x0034, # DIGIT FOUR; in Arabic-script context, displayed as 0x0664 ARABIC-INDIC DIGIT FOUR - 0x0035: 0x0035, # DIGIT FIVE; in Arabic-script context, displayed as 0x0665 ARABIC-INDIC DIGIT FIVE - 0x0036: 0x0036, # DIGIT SIX; in Arabic-script context, displayed as 0x0666 ARABIC-INDIC DIGIT SIX - 0x0037: 0x0037, # DIGIT SEVEN; in Arabic-script context, displayed as 0x0667 ARABIC-INDIC DIGIT SEVEN - 0x0038: 0x0038, # DIGIT EIGHT; in Arabic-script context, displayed as 0x0668 ARABIC-INDIC DIGIT EIGHT - 0x0039: 0x0039, # DIGIT NINE; in Arabic-script context, displayed as 0x0669 ARABIC-INDIC DIGIT NINE - 0x003a: 0x003a, # COLON, left-right - 0x003a: 0x00ba, # COLON, right-left - 0x003b: 0x003b, # SEMICOLON, left-right - 0x003c: 0x003c, # LESS-THAN SIGN, left-right - 0x003c: 0x00bc, # LESS-THAN SIGN, right-left - 0x003d: 0x003d, # EQUALS SIGN, left-right - 0x003d: 0x00bd, # EQUALS SIGN, right-left - 0x003e: 0x003e, # GREATER-THAN SIGN, left-right - 0x003e: 0x00be, # GREATER-THAN SIGN, right-left - 0x003f: 0x003f, # QUESTION MARK, left-right - 0x0040: 0x0040, # COMMERCIAL AT - 0x0041: 0x0041, # LATIN CAPITAL LETTER A - 0x0042: 0x0042, # LATIN CAPITAL LETTER B - 0x0043: 0x0043, # LATIN CAPITAL LETTER C - 0x0044: 0x0044, # LATIN CAPITAL LETTER D - 0x0045: 0x0045, # LATIN CAPITAL LETTER E - 0x0046: 0x0046, # LATIN CAPITAL LETTER F - 0x0047: 0x0047, # LATIN CAPITAL LETTER G - 0x0048: 0x0048, # LATIN CAPITAL LETTER H - 0x0049: 0x0049, # LATIN CAPITAL LETTER I - 0x004a: 0x004a, # LATIN CAPITAL LETTER J - 0x004b: 0x004b, # LATIN CAPITAL LETTER K - 0x004c: 0x004c, # LATIN CAPITAL LETTER L - 0x004d: 0x004d, # LATIN CAPITAL LETTER M - 0x004e: 0x004e, # LATIN CAPITAL LETTER N - 0x004f: 0x004f, # LATIN CAPITAL LETTER O - 0x0050: 0x0050, # LATIN CAPITAL LETTER P - 0x0051: 0x0051, # LATIN CAPITAL LETTER Q - 0x0052: 0x0052, # LATIN CAPITAL LETTER R - 0x0053: 0x0053, # LATIN CAPITAL LETTER S - 0x0054: 0x0054, # LATIN CAPITAL LETTER T - 0x0055: 0x0055, # LATIN CAPITAL LETTER U - 0x0056: 0x0056, # LATIN CAPITAL LETTER V - 0x0057: 0x0057, # LATIN CAPITAL LETTER W - 0x0058: 0x0058, # LATIN CAPITAL LETTER X - 0x0059: 0x0059, # LATIN CAPITAL LETTER Y - 0x005a: 0x005a, # LATIN CAPITAL LETTER Z - 0x005b: 0x005b, # LEFT SQUARE BRACKET, left-right - 0x005b: 0x00db, # LEFT SQUARE BRACKET, right-left - 0x005c: 0x005c, # REVERSE SOLIDUS, left-right - 0x005c: 0x00dc, # REVERSE SOLIDUS, right-left - 0x005d: 0x005d, # RIGHT SQUARE BRACKET, left-right - 0x005d: 0x00dd, # RIGHT SQUARE BRACKET, right-left - 0x005e: 0x005e, # CIRCUMFLEX ACCENT, left-right - 0x005e: 0x00de, # CIRCUMFLEX ACCENT, right-left - 0x005f: 0x005f, # LOW LINE, left-right - 0x005f: 0x00df, # LOW LINE, right-left - 0x0060: 0x0060, # GRAVE ACCENT - 0x0061: 0x0061, # LATIN SMALL LETTER A - 0x0062: 0x0062, # LATIN SMALL LETTER B - 0x0063: 0x0063, # LATIN SMALL LETTER C - 0x0064: 0x0064, # LATIN SMALL LETTER D - 0x0065: 0x0065, # LATIN SMALL LETTER E - 0x0066: 0x0066, # LATIN SMALL LETTER F - 0x0067: 0x0067, # LATIN SMALL LETTER G - 0x0068: 0x0068, # LATIN SMALL LETTER H - 0x0069: 0x0069, # LATIN SMALL LETTER I - 0x006a: 0x006a, # LATIN SMALL LETTER J - 0x006b: 0x006b, # LATIN SMALL LETTER K - 0x006c: 0x006c, # LATIN SMALL LETTER L - 0x006d: 0x006d, # LATIN SMALL LETTER M - 0x006e: 0x006e, # LATIN SMALL LETTER N - 0x006f: 0x006f, # LATIN SMALL LETTER O - 0x0070: 0x0070, # LATIN SMALL LETTER P - 0x0071: 0x0071, # LATIN SMALL LETTER Q - 0x0072: 0x0072, # LATIN SMALL LETTER R - 0x0073: 0x0073, # LATIN SMALL LETTER S - 0x0074: 0x0074, # LATIN SMALL LETTER T - 0x0075: 0x0075, # LATIN SMALL LETTER U - 0x0076: 0x0076, # LATIN SMALL LETTER V - 0x0077: 0x0077, # LATIN SMALL LETTER W - 0x0078: 0x0078, # LATIN SMALL LETTER X - 0x0079: 0x0079, # LATIN SMALL LETTER Y - 0x007a: 0x007a, # LATIN SMALL LETTER Z - 0x007b: 0x007b, # LEFT CURLY BRACKET, left-right - 0x007b: 0x00fb, # LEFT CURLY BRACKET, right-left - 0x007c: 0x007c, # VERTICAL LINE, left-right - 0x007c: 0x00fc, # VERTICAL LINE, right-left - 0x007d: 0x007d, # RIGHT CURLY BRACKET, left-right - 0x007d: 0x00fd, # RIGHT CURLY BRACKET, right-left - 0x007e: 0x007e, # TILDE - 0x007f: 0x007f, # CONTROL CHARACTER - 0x00a0: 0x0081, # NO-BREAK SPACE, right-left - 0x00ab: 0x008c, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - 0x00bb: 0x0098, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - 0x00c4: 0x0080, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x00c7: 0x0082, # LATIN CAPITAL LETTER C WITH CEDILLA - 0x00c9: 0x0083, # LATIN CAPITAL LETTER E WITH ACUTE - 0x00d1: 0x0084, # LATIN CAPITAL LETTER N WITH TILDE - 0x00d6: 0x0085, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x00dc: 0x0086, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x00e0: 0x0088, # LATIN SMALL LETTER A WITH GRAVE - 0x00e1: 0x0087, # LATIN SMALL LETTER A WITH ACUTE - 0x00e2: 0x0089, # LATIN SMALL LETTER A WITH CIRCUMFLEX - 0x00e4: 0x008a, # LATIN SMALL LETTER A WITH DIAERESIS - 0x00e7: 0x008d, # LATIN SMALL LETTER C WITH CEDILLA - 0x00e8: 0x008f, # LATIN SMALL LETTER E WITH GRAVE - 0x00e9: 0x008e, # LATIN SMALL LETTER E WITH ACUTE - 0x00ea: 0x0090, # LATIN SMALL LETTER E WITH CIRCUMFLEX - 0x00eb: 0x0091, # LATIN SMALL LETTER E WITH DIAERESIS - 0x00ed: 0x0092, # LATIN SMALL LETTER I WITH ACUTE - 0x00ee: 0x0094, # LATIN SMALL LETTER I WITH CIRCUMFLEX - 0x00ef: 0x0095, # LATIN SMALL LETTER I WITH DIAERESIS - 0x00f1: 0x0096, # LATIN SMALL LETTER N WITH TILDE - 0x00f3: 0x0097, # LATIN SMALL LETTER O WITH ACUTE - 0x00f4: 0x0099, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x00f6: 0x009a, # LATIN SMALL LETTER O WITH DIAERESIS - 0x00f7: 0x009b, # DIVISION SIGN, right-left - 0x00f9: 0x009d, # LATIN SMALL LETTER U WITH GRAVE - 0x00fa: 0x009c, # LATIN SMALL LETTER U WITH ACUTE - 0x00fb: 0x009e, # LATIN SMALL LETTER U WITH CIRCUMFLEX - 0x00fc: 0x009f, # LATIN SMALL LETTER U WITH DIAERESIS - 0x060c: 0x00ac, # ARABIC COMMA - 0x061b: 0x00bb, # ARABIC SEMICOLON - 0x061f: 0x00bf, # ARABIC QUESTION MARK - 0x0621: 0x00c1, # ARABIC LETTER HAMZA - 0x0622: 0x00c2, # ARABIC LETTER ALEF WITH MADDA ABOVE - 0x0623: 0x00c3, # ARABIC LETTER ALEF WITH HAMZA ABOVE - 0x0624: 0x00c4, # ARABIC LETTER WAW WITH HAMZA ABOVE - 0x0625: 0x00c5, # ARABIC LETTER ALEF WITH HAMZA BELOW - 0x0626: 0x00c6, # ARABIC LETTER YEH WITH HAMZA ABOVE - 0x0627: 0x00c7, # ARABIC LETTER ALEF - 0x0628: 0x00c8, # ARABIC LETTER BEH - 0x0629: 0x00c9, # ARABIC LETTER TEH MARBUTA - 0x062a: 0x00ca, # ARABIC LETTER TEH - 0x062b: 0x00cb, # ARABIC LETTER THEH - 0x062c: 0x00cc, # ARABIC LETTER JEEM - 0x062d: 0x00cd, # ARABIC LETTER HAH - 0x062e: 0x00ce, # ARABIC LETTER KHAH - 0x062f: 0x00cf, # ARABIC LETTER DAL - 0x0630: 0x00d0, # ARABIC LETTER THAL - 0x0631: 0x00d1, # ARABIC LETTER REH - 0x0632: 0x00d2, # ARABIC LETTER ZAIN - 0x0633: 0x00d3, # ARABIC LETTER SEEN - 0x0634: 0x00d4, # ARABIC LETTER SHEEN - 0x0635: 0x00d5, # ARABIC LETTER SAD - 0x0636: 0x00d6, # ARABIC LETTER DAD - 0x0637: 0x00d7, # ARABIC LETTER TAH - 0x0638: 0x00d8, # ARABIC LETTER ZAH - 0x0639: 0x00d9, # ARABIC LETTER AIN - 0x063a: 0x00da, # ARABIC LETTER GHAIN - 0x0640: 0x00e0, # ARABIC TATWEEL - 0x0641: 0x00e1, # ARABIC LETTER FEH - 0x0642: 0x00e2, # ARABIC LETTER QAF - 0x0643: 0x00e3, # ARABIC LETTER KAF - 0x0644: 0x00e4, # ARABIC LETTER LAM - 0x0645: 0x00e5, # ARABIC LETTER MEEM - 0x0646: 0x00e6, # ARABIC LETTER NOON - 0x0647: 0x00e7, # ARABIC LETTER HEH - 0x0648: 0x00e8, # ARABIC LETTER WAW - 0x0649: 0x00e9, # ARABIC LETTER ALEF MAKSURA - 0x064a: 0x00ea, # ARABIC LETTER YEH - 0x064b: 0x00eb, # ARABIC FATHATAN - 0x064c: 0x00ec, # ARABIC DAMMATAN - 0x064d: 0x00ed, # ARABIC KASRATAN - 0x064e: 0x00ee, # ARABIC FATHA - 0x064f: 0x00ef, # ARABIC DAMMA - 0x0650: 0x00f0, # ARABIC KASRA - 0x0651: 0x00f1, # ARABIC SHADDA - 0x0652: 0x00f2, # ARABIC SUKUN - 0x0660: 0x00b0, # ARABIC-INDIC DIGIT ZERO, right-left (need override) - 0x0661: 0x00b1, # ARABIC-INDIC DIGIT ONE, right-left (need override) - 0x0662: 0x00b2, # ARABIC-INDIC DIGIT TWO, right-left (need override) - 0x0663: 0x00b3, # ARABIC-INDIC DIGIT THREE, right-left (need override) - 0x0664: 0x00b4, # ARABIC-INDIC DIGIT FOUR, right-left (need override) - 0x0665: 0x00b5, # ARABIC-INDIC DIGIT FIVE, right-left (need override) - 0x0666: 0x00b6, # ARABIC-INDIC DIGIT SIX, right-left (need override) - 0x0667: 0x00b7, # ARABIC-INDIC DIGIT SEVEN, right-left (need override) - 0x0668: 0x00b8, # ARABIC-INDIC DIGIT EIGHT, right-left (need override) - 0x0669: 0x00b9, # ARABIC-INDIC DIGIT NINE, right-left (need override) - 0x066a: 0x00a5, # ARABIC PERCENT SIGN - 0x0679: 0x00f4, # ARABIC LETTER TTEH - 0x067e: 0x00f3, # ARABIC LETTER PEH - 0x0686: 0x00f5, # ARABIC LETTER TCHEH - 0x0688: 0x00f9, # ARABIC LETTER DDAL - 0x0691: 0x00fa, # ARABIC LETTER RREH - 0x0698: 0x00fe, # ARABIC LETTER JEH - 0x06a4: 0x00f7, # ARABIC LETTER VEH - 0x06af: 0x00f8, # ARABIC LETTER GAF - 0x06ba: 0x008b, # ARABIC LETTER NOON GHUNNA - 0x06d2: 0x00ff, # ARABIC LETTER YEH BARREE - 0x06d5: 0x00f6, # ARABIC LETTER AE - 0x2026: 0x0093, # HORIZONTAL ELLIPSIS, right-left - 0x274a: 0x00c0, # EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py deleted file mode 100644 index 3ef432c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_centeuro.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_centeuro generated from 'MAPPINGS/VENDORS/APPLE/CENTEURO.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-centeuro', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\u0100' # 0x81 -> LATIN CAPITAL LETTER A WITH MACRON - u'\u0101' # 0x82 -> LATIN SMALL LETTER A WITH MACRON - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\u0104' # 0x84 -> LATIN CAPITAL LETTER A WITH OGONEK - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\u0105' # 0x88 -> LATIN SMALL LETTER A WITH OGONEK - u'\u010c' # 0x89 -> LATIN CAPITAL LETTER C WITH CARON - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u010d' # 0x8B -> LATIN SMALL LETTER C WITH CARON - u'\u0106' # 0x8C -> LATIN CAPITAL LETTER C WITH ACUTE - u'\u0107' # 0x8D -> LATIN SMALL LETTER C WITH ACUTE - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\u0179' # 0x8F -> LATIN CAPITAL LETTER Z WITH ACUTE - u'\u017a' # 0x90 -> LATIN SMALL LETTER Z WITH ACUTE - u'\u010e' # 0x91 -> LATIN CAPITAL LETTER D WITH CARON - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\u010f' # 0x93 -> LATIN SMALL LETTER D WITH CARON - u'\u0112' # 0x94 -> LATIN CAPITAL LETTER E WITH MACRON - u'\u0113' # 0x95 -> LATIN SMALL LETTER E WITH MACRON - u'\u0116' # 0x96 -> LATIN CAPITAL LETTER E WITH DOT ABOVE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\u0117' # 0x98 -> LATIN SMALL LETTER E WITH DOT ABOVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\u011a' # 0x9D -> LATIN CAPITAL LETTER E WITH CARON - u'\u011b' # 0x9E -> LATIN SMALL LETTER E WITH CARON - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\u0118' # 0xA2 -> LATIN CAPITAL LETTER E WITH OGONEK - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\u0119' # 0xAB -> LATIN SMALL LETTER E WITH OGONEK - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u0123' # 0xAE -> LATIN SMALL LETTER G WITH CEDILLA - u'\u012e' # 0xAF -> LATIN CAPITAL LETTER I WITH OGONEK - u'\u012f' # 0xB0 -> LATIN SMALL LETTER I WITH OGONEK - u'\u012a' # 0xB1 -> LATIN CAPITAL LETTER I WITH MACRON - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\u012b' # 0xB4 -> LATIN SMALL LETTER I WITH MACRON - u'\u0136' # 0xB5 -> LATIN CAPITAL LETTER K WITH CEDILLA - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u0142' # 0xB8 -> LATIN SMALL LETTER L WITH STROKE - u'\u013b' # 0xB9 -> LATIN CAPITAL LETTER L WITH CEDILLA - u'\u013c' # 0xBA -> LATIN SMALL LETTER L WITH CEDILLA - u'\u013d' # 0xBB -> LATIN CAPITAL LETTER L WITH CARON - u'\u013e' # 0xBC -> LATIN SMALL LETTER L WITH CARON - u'\u0139' # 0xBD -> LATIN CAPITAL LETTER L WITH ACUTE - u'\u013a' # 0xBE -> LATIN SMALL LETTER L WITH ACUTE - u'\u0145' # 0xBF -> LATIN CAPITAL LETTER N WITH CEDILLA - u'\u0146' # 0xC0 -> LATIN SMALL LETTER N WITH CEDILLA - u'\u0143' # 0xC1 -> LATIN CAPITAL LETTER N WITH ACUTE - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0144' # 0xC4 -> LATIN SMALL LETTER N WITH ACUTE - u'\u0147' # 0xC5 -> LATIN CAPITAL LETTER N WITH CARON - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\u0148' # 0xCB -> LATIN SMALL LETTER N WITH CARON - u'\u0150' # 0xCC -> LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0151' # 0xCE -> LATIN SMALL LETTER O WITH DOUBLE ACUTE - u'\u014c' # 0xCF -> LATIN CAPITAL LETTER O WITH MACRON - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\u014d' # 0xD8 -> LATIN SMALL LETTER O WITH MACRON - u'\u0154' # 0xD9 -> LATIN CAPITAL LETTER R WITH ACUTE - u'\u0155' # 0xDA -> LATIN SMALL LETTER R WITH ACUTE - u'\u0158' # 0xDB -> LATIN CAPITAL LETTER R WITH CARON - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u0159' # 0xDE -> LATIN SMALL LETTER R WITH CARON - u'\u0156' # 0xDF -> LATIN CAPITAL LETTER R WITH CEDILLA - u'\u0157' # 0xE0 -> LATIN SMALL LETTER R WITH CEDILLA - u'\u0160' # 0xE1 -> LATIN CAPITAL LETTER S WITH CARON - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u0161' # 0xE4 -> LATIN SMALL LETTER S WITH CARON - u'\u015a' # 0xE5 -> LATIN CAPITAL LETTER S WITH ACUTE - u'\u015b' # 0xE6 -> LATIN SMALL LETTER S WITH ACUTE - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\u0164' # 0xE8 -> LATIN CAPITAL LETTER T WITH CARON - u'\u0165' # 0xE9 -> LATIN SMALL LETTER T WITH CARON - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\u017d' # 0xEB -> LATIN CAPITAL LETTER Z WITH CARON - u'\u017e' # 0xEC -> LATIN SMALL LETTER Z WITH CARON - u'\u016a' # 0xED -> LATIN CAPITAL LETTER U WITH MACRON - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u016b' # 0xF0 -> LATIN SMALL LETTER U WITH MACRON - u'\u016e' # 0xF1 -> LATIN CAPITAL LETTER U WITH RING ABOVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\u016f' # 0xF3 -> LATIN SMALL LETTER U WITH RING ABOVE - u'\u0170' # 0xF4 -> LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - u'\u0171' # 0xF5 -> LATIN SMALL LETTER U WITH DOUBLE ACUTE - u'\u0172' # 0xF6 -> LATIN CAPITAL LETTER U WITH OGONEK - u'\u0173' # 0xF7 -> LATIN SMALL LETTER U WITH OGONEK - u'\xdd' # 0xF8 -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xfd' # 0xF9 -> LATIN SMALL LETTER Y WITH ACUTE - u'\u0137' # 0xFA -> LATIN SMALL LETTER K WITH CEDILLA - u'\u017b' # 0xFB -> LATIN CAPITAL LETTER Z WITH DOT ABOVE - u'\u0141' # 0xFC -> LATIN CAPITAL LETTER L WITH STROKE - u'\u017c' # 0xFD -> LATIN SMALL LETTER Z WITH DOT ABOVE - u'\u0122' # 0xFE -> LATIN CAPITAL LETTER G WITH CEDILLA - u'\u02c7' # 0xFF -> CARON -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py deleted file mode 100644 index ebcb1cc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_croatian.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_croatian generated from 'MAPPINGS/VENDORS/APPLE/CROATIAN.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-croatian', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\u0160' # 0xA9 -> LATIN CAPITAL LETTER S WITH CARON - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u017d' # 0xAE -> LATIN CAPITAL LETTER Z WITH CARON - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\u2206' # 0xB4 -> INCREMENT - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u0161' # 0xB9 -> LATIN SMALL LETTER S WITH CARON - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\u017e' # 0xBE -> LATIN SMALL LETTER Z WITH CARON - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u0106' # 0xC6 -> LATIN CAPITAL LETTER C WITH ACUTE - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u010c' # 0xC8 -> LATIN CAPITAL LETTER C WITH CARON - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u0110' # 0xD0 -> LATIN CAPITAL LETTER D WITH STROKE - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\uf8ff' # 0xD8 -> Apple logo - u'\xa9' # 0xD9 -> COPYRIGHT SIGN - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\xc6' # 0xDE -> LATIN CAPITAL LETTER AE - u'\xbb' # 0xDF -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2013' # 0xE0 -> EN DASH - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\u0107' # 0xE6 -> LATIN SMALL LETTER C WITH ACUTE - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\u010d' # 0xE8 -> LATIN SMALL LETTER C WITH CARON - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\u0111' # 0xF0 -> LATIN SMALL LETTER D WITH STROKE - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u03c0' # 0xF9 -> GREEK SMALL LETTER PI - u'\xcb' # 0xFA -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\xca' # 0xFD -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xe6' # 0xFE -> LATIN SMALL LETTER AE - u'\u02c7' # 0xFF -> CARON -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py deleted file mode 100644 index bca866f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_cyrillic.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_cyrillic generated from 'MAPPINGS/VENDORS/APPLE/CYRILLIC.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-cyrillic', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\u0410' # 0x80 -> CYRILLIC CAPITAL LETTER A - u'\u0411' # 0x81 -> CYRILLIC CAPITAL LETTER BE - u'\u0412' # 0x82 -> CYRILLIC CAPITAL LETTER VE - u'\u0413' # 0x83 -> CYRILLIC CAPITAL LETTER GHE - u'\u0414' # 0x84 -> CYRILLIC CAPITAL LETTER DE - u'\u0415' # 0x85 -> CYRILLIC CAPITAL LETTER IE - u'\u0416' # 0x86 -> CYRILLIC CAPITAL LETTER ZHE - u'\u0417' # 0x87 -> CYRILLIC CAPITAL LETTER ZE - u'\u0418' # 0x88 -> CYRILLIC CAPITAL LETTER I - u'\u0419' # 0x89 -> CYRILLIC CAPITAL LETTER SHORT I - u'\u041a' # 0x8A -> CYRILLIC CAPITAL LETTER KA - u'\u041b' # 0x8B -> CYRILLIC CAPITAL LETTER EL - u'\u041c' # 0x8C -> CYRILLIC CAPITAL LETTER EM - u'\u041d' # 0x8D -> CYRILLIC CAPITAL LETTER EN - u'\u041e' # 0x8E -> CYRILLIC CAPITAL LETTER O - u'\u041f' # 0x8F -> CYRILLIC CAPITAL LETTER PE - u'\u0420' # 0x90 -> CYRILLIC CAPITAL LETTER ER - u'\u0421' # 0x91 -> CYRILLIC CAPITAL LETTER ES - u'\u0422' # 0x92 -> CYRILLIC CAPITAL LETTER TE - u'\u0423' # 0x93 -> CYRILLIC CAPITAL LETTER U - u'\u0424' # 0x94 -> CYRILLIC CAPITAL LETTER EF - u'\u0425' # 0x95 -> CYRILLIC CAPITAL LETTER HA - u'\u0426' # 0x96 -> CYRILLIC CAPITAL LETTER TSE - u'\u0427' # 0x97 -> CYRILLIC CAPITAL LETTER CHE - u'\u0428' # 0x98 -> CYRILLIC CAPITAL LETTER SHA - u'\u0429' # 0x99 -> CYRILLIC CAPITAL LETTER SHCHA - u'\u042a' # 0x9A -> CYRILLIC CAPITAL LETTER HARD SIGN - u'\u042b' # 0x9B -> CYRILLIC CAPITAL LETTER YERU - u'\u042c' # 0x9C -> CYRILLIC CAPITAL LETTER SOFT SIGN - u'\u042d' # 0x9D -> CYRILLIC CAPITAL LETTER E - u'\u042e' # 0x9E -> CYRILLIC CAPITAL LETTER YU - u'\u042f' # 0x9F -> CYRILLIC CAPITAL LETTER YA - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\u0490' # 0xA2 -> CYRILLIC CAPITAL LETTER GHE WITH UPTURN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\u0406' # 0xA7 -> CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\u0402' # 0xAB -> CYRILLIC CAPITAL LETTER DJE - u'\u0452' # 0xAC -> CYRILLIC SMALL LETTER DJE - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u0403' # 0xAE -> CYRILLIC CAPITAL LETTER GJE - u'\u0453' # 0xAF -> CYRILLIC SMALL LETTER GJE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\u0456' # 0xB4 -> CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u0491' # 0xB6 -> CYRILLIC SMALL LETTER GHE WITH UPTURN - u'\u0408' # 0xB7 -> CYRILLIC CAPITAL LETTER JE - u'\u0404' # 0xB8 -> CYRILLIC CAPITAL LETTER UKRAINIAN IE - u'\u0454' # 0xB9 -> CYRILLIC SMALL LETTER UKRAINIAN IE - u'\u0407' # 0xBA -> CYRILLIC CAPITAL LETTER YI - u'\u0457' # 0xBB -> CYRILLIC SMALL LETTER YI - u'\u0409' # 0xBC -> CYRILLIC CAPITAL LETTER LJE - u'\u0459' # 0xBD -> CYRILLIC SMALL LETTER LJE - u'\u040a' # 0xBE -> CYRILLIC CAPITAL LETTER NJE - u'\u045a' # 0xBF -> CYRILLIC SMALL LETTER NJE - u'\u0458' # 0xC0 -> CYRILLIC SMALL LETTER JE - u'\u0405' # 0xC1 -> CYRILLIC CAPITAL LETTER DZE - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\u040b' # 0xCB -> CYRILLIC CAPITAL LETTER TSHE - u'\u045b' # 0xCC -> CYRILLIC SMALL LETTER TSHE - u'\u040c' # 0xCD -> CYRILLIC CAPITAL LETTER KJE - u'\u045c' # 0xCE -> CYRILLIC SMALL LETTER KJE - u'\u0455' # 0xCF -> CYRILLIC SMALL LETTER DZE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u201e' # 0xD7 -> DOUBLE LOW-9 QUOTATION MARK - u'\u040e' # 0xD8 -> CYRILLIC CAPITAL LETTER SHORT U - u'\u045e' # 0xD9 -> CYRILLIC SMALL LETTER SHORT U - u'\u040f' # 0xDA -> CYRILLIC CAPITAL LETTER DZHE - u'\u045f' # 0xDB -> CYRILLIC SMALL LETTER DZHE - u'\u2116' # 0xDC -> NUMERO SIGN - u'\u0401' # 0xDD -> CYRILLIC CAPITAL LETTER IO - u'\u0451' # 0xDE -> CYRILLIC SMALL LETTER IO - u'\u044f' # 0xDF -> CYRILLIC SMALL LETTER YA - u'\u0430' # 0xE0 -> CYRILLIC SMALL LETTER A - u'\u0431' # 0xE1 -> CYRILLIC SMALL LETTER BE - u'\u0432' # 0xE2 -> CYRILLIC SMALL LETTER VE - u'\u0433' # 0xE3 -> CYRILLIC SMALL LETTER GHE - u'\u0434' # 0xE4 -> CYRILLIC SMALL LETTER DE - u'\u0435' # 0xE5 -> CYRILLIC SMALL LETTER IE - u'\u0436' # 0xE6 -> CYRILLIC SMALL LETTER ZHE - u'\u0437' # 0xE7 -> CYRILLIC SMALL LETTER ZE - u'\u0438' # 0xE8 -> CYRILLIC SMALL LETTER I - u'\u0439' # 0xE9 -> CYRILLIC SMALL LETTER SHORT I - u'\u043a' # 0xEA -> CYRILLIC SMALL LETTER KA - u'\u043b' # 0xEB -> CYRILLIC SMALL LETTER EL - u'\u043c' # 0xEC -> CYRILLIC SMALL LETTER EM - u'\u043d' # 0xED -> CYRILLIC SMALL LETTER EN - u'\u043e' # 0xEE -> CYRILLIC SMALL LETTER O - u'\u043f' # 0xEF -> CYRILLIC SMALL LETTER PE - u'\u0440' # 0xF0 -> CYRILLIC SMALL LETTER ER - u'\u0441' # 0xF1 -> CYRILLIC SMALL LETTER ES - u'\u0442' # 0xF2 -> CYRILLIC SMALL LETTER TE - u'\u0443' # 0xF3 -> CYRILLIC SMALL LETTER U - u'\u0444' # 0xF4 -> CYRILLIC SMALL LETTER EF - u'\u0445' # 0xF5 -> CYRILLIC SMALL LETTER HA - u'\u0446' # 0xF6 -> CYRILLIC SMALL LETTER TSE - u'\u0447' # 0xF7 -> CYRILLIC SMALL LETTER CHE - u'\u0448' # 0xF8 -> CYRILLIC SMALL LETTER SHA - u'\u0449' # 0xF9 -> CYRILLIC SMALL LETTER SHCHA - u'\u044a' # 0xFA -> CYRILLIC SMALL LETTER HARD SIGN - u'\u044b' # 0xFB -> CYRILLIC SMALL LETTER YERU - u'\u044c' # 0xFC -> CYRILLIC SMALL LETTER SOFT SIGN - u'\u044d' # 0xFD -> CYRILLIC SMALL LETTER E - u'\u044e' # 0xFE -> CYRILLIC SMALL LETTER YU - u'\u20ac' # 0xFF -> EURO SIGN -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py deleted file mode 100644 index 06d9285..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_farsi.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_farsi generated from 'MAPPINGS/VENDORS/APPLE/FARSI.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-farsi', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE, left-right - u'!' # 0x21 -> EXCLAMATION MARK, left-right - u'"' # 0x22 -> QUOTATION MARK, left-right - u'#' # 0x23 -> NUMBER SIGN, left-right - u'$' # 0x24 -> DOLLAR SIGN, left-right - u'%' # 0x25 -> PERCENT SIGN, left-right - u'&' # 0x26 -> AMPERSAND, left-right - u"'" # 0x27 -> APOSTROPHE, left-right - u'(' # 0x28 -> LEFT PARENTHESIS, left-right - u')' # 0x29 -> RIGHT PARENTHESIS, left-right - u'*' # 0x2A -> ASTERISK, left-right - u'+' # 0x2B -> PLUS SIGN, left-right - u',' # 0x2C -> COMMA, left-right; in Arabic-script context, displayed as 0x066C ARABIC THOUSANDS SEPARATOR - u'-' # 0x2D -> HYPHEN-MINUS, left-right - u'.' # 0x2E -> FULL STOP, left-right; in Arabic-script context, displayed as 0x066B ARABIC DECIMAL SEPARATOR - u'/' # 0x2F -> SOLIDUS, left-right - u'0' # 0x30 -> DIGIT ZERO; in Arabic-script context, displayed as 0x06F0 EXTENDED ARABIC-INDIC DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE; in Arabic-script context, displayed as 0x06F1 EXTENDED ARABIC-INDIC DIGIT ONE - u'2' # 0x32 -> DIGIT TWO; in Arabic-script context, displayed as 0x06F2 EXTENDED ARABIC-INDIC DIGIT TWO - u'3' # 0x33 -> DIGIT THREE; in Arabic-script context, displayed as 0x06F3 EXTENDED ARABIC-INDIC DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR; in Arabic-script context, displayed as 0x06F4 EXTENDED ARABIC-INDIC DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE; in Arabic-script context, displayed as 0x06F5 EXTENDED ARABIC-INDIC DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX; in Arabic-script context, displayed as 0x06F6 EXTENDED ARABIC-INDIC DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN; in Arabic-script context, displayed as 0x06F7 EXTENDED ARABIC-INDIC DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT; in Arabic-script context, displayed as 0x06F8 EXTENDED ARABIC-INDIC DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE; in Arabic-script context, displayed as 0x06F9 EXTENDED ARABIC-INDIC DIGIT NINE - u':' # 0x3A -> COLON, left-right - u';' # 0x3B -> SEMICOLON, left-right - u'<' # 0x3C -> LESS-THAN SIGN, left-right - u'=' # 0x3D -> EQUALS SIGN, left-right - u'>' # 0x3E -> GREATER-THAN SIGN, left-right - u'?' # 0x3F -> QUESTION MARK, left-right - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET, left-right - u'\\' # 0x5C -> REVERSE SOLIDUS, left-right - u']' # 0x5D -> RIGHT SQUARE BRACKET, left-right - u'^' # 0x5E -> CIRCUMFLEX ACCENT, left-right - u'_' # 0x5F -> LOW LINE, left-right - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET, left-right - u'|' # 0x7C -> VERTICAL LINE, left-right - u'}' # 0x7D -> RIGHT CURLY BRACKET, left-right - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xa0' # 0x81 -> NO-BREAK SPACE, right-left - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u06ba' # 0x8B -> ARABIC LETTER NOON GHUNNA - u'\xab' # 0x8C -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\u2026' # 0x93 -> HORIZONTAL ELLIPSIS, right-left - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xbb' # 0x98 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK, right-left - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf7' # 0x9B -> DIVISION SIGN, right-left - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u' ' # 0xA0 -> SPACE, right-left - u'!' # 0xA1 -> EXCLAMATION MARK, right-left - u'"' # 0xA2 -> QUOTATION MARK, right-left - u'#' # 0xA3 -> NUMBER SIGN, right-left - u'$' # 0xA4 -> DOLLAR SIGN, right-left - u'\u066a' # 0xA5 -> ARABIC PERCENT SIGN - u'&' # 0xA6 -> AMPERSAND, right-left - u"'" # 0xA7 -> APOSTROPHE, right-left - u'(' # 0xA8 -> LEFT PARENTHESIS, right-left - u')' # 0xA9 -> RIGHT PARENTHESIS, right-left - u'*' # 0xAA -> ASTERISK, right-left - u'+' # 0xAB -> PLUS SIGN, right-left - u'\u060c' # 0xAC -> ARABIC COMMA - u'-' # 0xAD -> HYPHEN-MINUS, right-left - u'.' # 0xAE -> FULL STOP, right-left - u'/' # 0xAF -> SOLIDUS, right-left - u'\u06f0' # 0xB0 -> EXTENDED ARABIC-INDIC DIGIT ZERO, right-left (need override) - u'\u06f1' # 0xB1 -> EXTENDED ARABIC-INDIC DIGIT ONE, right-left (need override) - u'\u06f2' # 0xB2 -> EXTENDED ARABIC-INDIC DIGIT TWO, right-left (need override) - u'\u06f3' # 0xB3 -> EXTENDED ARABIC-INDIC DIGIT THREE, right-left (need override) - u'\u06f4' # 0xB4 -> EXTENDED ARABIC-INDIC DIGIT FOUR, right-left (need override) - u'\u06f5' # 0xB5 -> EXTENDED ARABIC-INDIC DIGIT FIVE, right-left (need override) - u'\u06f6' # 0xB6 -> EXTENDED ARABIC-INDIC DIGIT SIX, right-left (need override) - u'\u06f7' # 0xB7 -> EXTENDED ARABIC-INDIC DIGIT SEVEN, right-left (need override) - u'\u06f8' # 0xB8 -> EXTENDED ARABIC-INDIC DIGIT EIGHT, right-left (need override) - u'\u06f9' # 0xB9 -> EXTENDED ARABIC-INDIC DIGIT NINE, right-left (need override) - u':' # 0xBA -> COLON, right-left - u'\u061b' # 0xBB -> ARABIC SEMICOLON - u'<' # 0xBC -> LESS-THAN SIGN, right-left - u'=' # 0xBD -> EQUALS SIGN, right-left - u'>' # 0xBE -> GREATER-THAN SIGN, right-left - u'\u061f' # 0xBF -> ARABIC QUESTION MARK - u'\u274a' # 0xC0 -> EIGHT TEARDROP-SPOKED PROPELLER ASTERISK, right-left - u'\u0621' # 0xC1 -> ARABIC LETTER HAMZA - u'\u0622' # 0xC2 -> ARABIC LETTER ALEF WITH MADDA ABOVE - u'\u0623' # 0xC3 -> ARABIC LETTER ALEF WITH HAMZA ABOVE - u'\u0624' # 0xC4 -> ARABIC LETTER WAW WITH HAMZA ABOVE - u'\u0625' # 0xC5 -> ARABIC LETTER ALEF WITH HAMZA BELOW - u'\u0626' # 0xC6 -> ARABIC LETTER YEH WITH HAMZA ABOVE - u'\u0627' # 0xC7 -> ARABIC LETTER ALEF - u'\u0628' # 0xC8 -> ARABIC LETTER BEH - u'\u0629' # 0xC9 -> ARABIC LETTER TEH MARBUTA - u'\u062a' # 0xCA -> ARABIC LETTER TEH - u'\u062b' # 0xCB -> ARABIC LETTER THEH - u'\u062c' # 0xCC -> ARABIC LETTER JEEM - u'\u062d' # 0xCD -> ARABIC LETTER HAH - u'\u062e' # 0xCE -> ARABIC LETTER KHAH - u'\u062f' # 0xCF -> ARABIC LETTER DAL - u'\u0630' # 0xD0 -> ARABIC LETTER THAL - u'\u0631' # 0xD1 -> ARABIC LETTER REH - u'\u0632' # 0xD2 -> ARABIC LETTER ZAIN - u'\u0633' # 0xD3 -> ARABIC LETTER SEEN - u'\u0634' # 0xD4 -> ARABIC LETTER SHEEN - u'\u0635' # 0xD5 -> ARABIC LETTER SAD - u'\u0636' # 0xD6 -> ARABIC LETTER DAD - u'\u0637' # 0xD7 -> ARABIC LETTER TAH - u'\u0638' # 0xD8 -> ARABIC LETTER ZAH - u'\u0639' # 0xD9 -> ARABIC LETTER AIN - u'\u063a' # 0xDA -> ARABIC LETTER GHAIN - u'[' # 0xDB -> LEFT SQUARE BRACKET, right-left - u'\\' # 0xDC -> REVERSE SOLIDUS, right-left - u']' # 0xDD -> RIGHT SQUARE BRACKET, right-left - u'^' # 0xDE -> CIRCUMFLEX ACCENT, right-left - u'_' # 0xDF -> LOW LINE, right-left - u'\u0640' # 0xE0 -> ARABIC TATWEEL - u'\u0641' # 0xE1 -> ARABIC LETTER FEH - u'\u0642' # 0xE2 -> ARABIC LETTER QAF - u'\u0643' # 0xE3 -> ARABIC LETTER KAF - u'\u0644' # 0xE4 -> ARABIC LETTER LAM - u'\u0645' # 0xE5 -> ARABIC LETTER MEEM - u'\u0646' # 0xE6 -> ARABIC LETTER NOON - u'\u0647' # 0xE7 -> ARABIC LETTER HEH - u'\u0648' # 0xE8 -> ARABIC LETTER WAW - u'\u0649' # 0xE9 -> ARABIC LETTER ALEF MAKSURA - u'\u064a' # 0xEA -> ARABIC LETTER YEH - u'\u064b' # 0xEB -> ARABIC FATHATAN - u'\u064c' # 0xEC -> ARABIC DAMMATAN - u'\u064d' # 0xED -> ARABIC KASRATAN - u'\u064e' # 0xEE -> ARABIC FATHA - u'\u064f' # 0xEF -> ARABIC DAMMA - u'\u0650' # 0xF0 -> ARABIC KASRA - u'\u0651' # 0xF1 -> ARABIC SHADDA - u'\u0652' # 0xF2 -> ARABIC SUKUN - u'\u067e' # 0xF3 -> ARABIC LETTER PEH - u'\u0679' # 0xF4 -> ARABIC LETTER TTEH - u'\u0686' # 0xF5 -> ARABIC LETTER TCHEH - u'\u06d5' # 0xF6 -> ARABIC LETTER AE - u'\u06a4' # 0xF7 -> ARABIC LETTER VEH - u'\u06af' # 0xF8 -> ARABIC LETTER GAF - u'\u0688' # 0xF9 -> ARABIC LETTER DDAL - u'\u0691' # 0xFA -> ARABIC LETTER RREH - u'{' # 0xFB -> LEFT CURLY BRACKET, right-left - u'|' # 0xFC -> VERTICAL LINE, right-left - u'}' # 0xFD -> RIGHT CURLY BRACKET, right-left - u'\u0698' # 0xFE -> ARABIC LETTER JEH - u'\u06d2' # 0xFF -> ARABIC LETTER YEH BARREE -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py deleted file mode 100644 index 77a25f4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_greek.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_greek generated from 'MAPPINGS/VENDORS/APPLE/GREEK.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-greek', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xb9' # 0x81 -> SUPERSCRIPT ONE - u'\xb2' # 0x82 -> SUPERSCRIPT TWO - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xb3' # 0x84 -> SUPERSCRIPT THREE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\u0385' # 0x87 -> GREEK DIALYTIKA TONOS - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\u0384' # 0x8B -> GREEK TONOS - u'\xa8' # 0x8C -> DIAERESIS - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xa3' # 0x92 -> POUND SIGN - u'\u2122' # 0x93 -> TRADE MARK SIGN - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\u2022' # 0x96 -> BULLET - u'\xbd' # 0x97 -> VULGAR FRACTION ONE HALF - u'\u2030' # 0x98 -> PER MILLE SIGN - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xa6' # 0x9B -> BROKEN BAR - u'\u20ac' # 0x9C -> EURO SIGN # before Mac OS 9.2.2, was SOFT HYPHEN - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\u0393' # 0xA1 -> GREEK CAPITAL LETTER GAMMA - u'\u0394' # 0xA2 -> GREEK CAPITAL LETTER DELTA - u'\u0398' # 0xA3 -> GREEK CAPITAL LETTER THETA - u'\u039b' # 0xA4 -> GREEK CAPITAL LETTER LAMDA - u'\u039e' # 0xA5 -> GREEK CAPITAL LETTER XI - u'\u03a0' # 0xA6 -> GREEK CAPITAL LETTER PI - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u03a3' # 0xAA -> GREEK CAPITAL LETTER SIGMA - u'\u03aa' # 0xAB -> GREEK CAPITAL LETTER IOTA WITH DIALYTIKA - u'\xa7' # 0xAC -> SECTION SIGN - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xb0' # 0xAE -> DEGREE SIGN - u'\xb7' # 0xAF -> MIDDLE DOT - u'\u0391' # 0xB0 -> GREEK CAPITAL LETTER ALPHA - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\u0392' # 0xB5 -> GREEK CAPITAL LETTER BETA - u'\u0395' # 0xB6 -> GREEK CAPITAL LETTER EPSILON - u'\u0396' # 0xB7 -> GREEK CAPITAL LETTER ZETA - u'\u0397' # 0xB8 -> GREEK CAPITAL LETTER ETA - u'\u0399' # 0xB9 -> GREEK CAPITAL LETTER IOTA - u'\u039a' # 0xBA -> GREEK CAPITAL LETTER KAPPA - u'\u039c' # 0xBB -> GREEK CAPITAL LETTER MU - u'\u03a6' # 0xBC -> GREEK CAPITAL LETTER PHI - u'\u03ab' # 0xBD -> GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA - u'\u03a8' # 0xBE -> GREEK CAPITAL LETTER PSI - u'\u03a9' # 0xBF -> GREEK CAPITAL LETTER OMEGA - u'\u03ac' # 0xC0 -> GREEK SMALL LETTER ALPHA WITH TONOS - u'\u039d' # 0xC1 -> GREEK CAPITAL LETTER NU - u'\xac' # 0xC2 -> NOT SIGN - u'\u039f' # 0xC3 -> GREEK CAPITAL LETTER OMICRON - u'\u03a1' # 0xC4 -> GREEK CAPITAL LETTER RHO - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u03a4' # 0xC6 -> GREEK CAPITAL LETTER TAU - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\u03a5' # 0xCB -> GREEK CAPITAL LETTER UPSILON - u'\u03a7' # 0xCC -> GREEK CAPITAL LETTER CHI - u'\u0386' # 0xCD -> GREEK CAPITAL LETTER ALPHA WITH TONOS - u'\u0388' # 0xCE -> GREEK CAPITAL LETTER EPSILON WITH TONOS - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2015' # 0xD1 -> HORIZONTAL BAR - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u0389' # 0xD7 -> GREEK CAPITAL LETTER ETA WITH TONOS - u'\u038a' # 0xD8 -> GREEK CAPITAL LETTER IOTA WITH TONOS - u'\u038c' # 0xD9 -> GREEK CAPITAL LETTER OMICRON WITH TONOS - u'\u038e' # 0xDA -> GREEK CAPITAL LETTER UPSILON WITH TONOS - u'\u03ad' # 0xDB -> GREEK SMALL LETTER EPSILON WITH TONOS - u'\u03ae' # 0xDC -> GREEK SMALL LETTER ETA WITH TONOS - u'\u03af' # 0xDD -> GREEK SMALL LETTER IOTA WITH TONOS - u'\u03cc' # 0xDE -> GREEK SMALL LETTER OMICRON WITH TONOS - u'\u038f' # 0xDF -> GREEK CAPITAL LETTER OMEGA WITH TONOS - u'\u03cd' # 0xE0 -> GREEK SMALL LETTER UPSILON WITH TONOS - u'\u03b1' # 0xE1 -> GREEK SMALL LETTER ALPHA - u'\u03b2' # 0xE2 -> GREEK SMALL LETTER BETA - u'\u03c8' # 0xE3 -> GREEK SMALL LETTER PSI - u'\u03b4' # 0xE4 -> GREEK SMALL LETTER DELTA - u'\u03b5' # 0xE5 -> GREEK SMALL LETTER EPSILON - u'\u03c6' # 0xE6 -> GREEK SMALL LETTER PHI - u'\u03b3' # 0xE7 -> GREEK SMALL LETTER GAMMA - u'\u03b7' # 0xE8 -> GREEK SMALL LETTER ETA - u'\u03b9' # 0xE9 -> GREEK SMALL LETTER IOTA - u'\u03be' # 0xEA -> GREEK SMALL LETTER XI - u'\u03ba' # 0xEB -> GREEK SMALL LETTER KAPPA - u'\u03bb' # 0xEC -> GREEK SMALL LETTER LAMDA - u'\u03bc' # 0xED -> GREEK SMALL LETTER MU - u'\u03bd' # 0xEE -> GREEK SMALL LETTER NU - u'\u03bf' # 0xEF -> GREEK SMALL LETTER OMICRON - u'\u03c0' # 0xF0 -> GREEK SMALL LETTER PI - u'\u03ce' # 0xF1 -> GREEK SMALL LETTER OMEGA WITH TONOS - u'\u03c1' # 0xF2 -> GREEK SMALL LETTER RHO - u'\u03c3' # 0xF3 -> GREEK SMALL LETTER SIGMA - u'\u03c4' # 0xF4 -> GREEK SMALL LETTER TAU - u'\u03b8' # 0xF5 -> GREEK SMALL LETTER THETA - u'\u03c9' # 0xF6 -> GREEK SMALL LETTER OMEGA - u'\u03c2' # 0xF7 -> GREEK SMALL LETTER FINAL SIGMA - u'\u03c7' # 0xF8 -> GREEK SMALL LETTER CHI - u'\u03c5' # 0xF9 -> GREEK SMALL LETTER UPSILON - u'\u03b6' # 0xFA -> GREEK SMALL LETTER ZETA - u'\u03ca' # 0xFB -> GREEK SMALL LETTER IOTA WITH DIALYTIKA - u'\u03cb' # 0xFC -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA - u'\u0390' # 0xFD -> GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS - u'\u03b0' # 0xFE -> GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS - u'\xad' # 0xFF -> SOFT HYPHEN # before Mac OS 9.2.2, was undefined -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py deleted file mode 100644 index 7045dc1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_iceland.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_iceland generated from 'MAPPINGS/VENDORS/APPLE/ICELAND.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-iceland', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\xdd' # 0xA0 -> LATIN CAPITAL LETTER Y WITH ACUTE - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\xe6' # 0xBE -> LATIN SMALL LETTER AE - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\xd0' # 0xDC -> LATIN CAPITAL LETTER ETH - u'\xf0' # 0xDD -> LATIN SMALL LETTER ETH - u'\xde' # 0xDE -> LATIN CAPITAL LETTER THORN - u'\xfe' # 0xDF -> LATIN SMALL LETTER THORN - u'\xfd' # 0xE0 -> LATIN SMALL LETTER Y WITH ACUTE - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py deleted file mode 100644 index 324b4af..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_latin2.py +++ /dev/null @@ -1,183 +0,0 @@ -""" Python Character Mapping Codec generated from 'LATIN2.TXT' with gencodec.py. - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. -(c) Copyright 2000 Guido van Rossum. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_map) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_map)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-latin2', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x00c4, # LATIN CAPITAL LETTER A WITH DIAERESIS - 0x0081: 0x0100, # LATIN CAPITAL LETTER A WITH MACRON - 0x0082: 0x0101, # LATIN SMALL LETTER A WITH MACRON - 0x0083: 0x00c9, # LATIN CAPITAL LETTER E WITH ACUTE - 0x0084: 0x0104, # LATIN CAPITAL LETTER A WITH OGONEK - 0x0085: 0x00d6, # LATIN CAPITAL LETTER O WITH DIAERESIS - 0x0086: 0x00dc, # LATIN CAPITAL LETTER U WITH DIAERESIS - 0x0087: 0x00e1, # LATIN SMALL LETTER A WITH ACUTE - 0x0088: 0x0105, # LATIN SMALL LETTER A WITH OGONEK - 0x0089: 0x010c, # LATIN CAPITAL LETTER C WITH CARON - 0x008a: 0x00e4, # LATIN SMALL LETTER A WITH DIAERESIS - 0x008b: 0x010d, # LATIN SMALL LETTER C WITH CARON - 0x008c: 0x0106, # LATIN CAPITAL LETTER C WITH ACUTE - 0x008d: 0x0107, # LATIN SMALL LETTER C WITH ACUTE - 0x008e: 0x00e9, # LATIN SMALL LETTER E WITH ACUTE - 0x008f: 0x0179, # LATIN CAPITAL LETTER Z WITH ACUTE - 0x0090: 0x017a, # LATIN SMALL LETTER Z WITH ACUTE - 0x0091: 0x010e, # LATIN CAPITAL LETTER D WITH CARON - 0x0092: 0x00ed, # LATIN SMALL LETTER I WITH ACUTE - 0x0093: 0x010f, # LATIN SMALL LETTER D WITH CARON - 0x0094: 0x0112, # LATIN CAPITAL LETTER E WITH MACRON - 0x0095: 0x0113, # LATIN SMALL LETTER E WITH MACRON - 0x0096: 0x0116, # LATIN CAPITAL LETTER E WITH DOT ABOVE - 0x0097: 0x00f3, # LATIN SMALL LETTER O WITH ACUTE - 0x0098: 0x0117, # LATIN SMALL LETTER E WITH DOT ABOVE - 0x0099: 0x00f4, # LATIN SMALL LETTER O WITH CIRCUMFLEX - 0x009a: 0x00f6, # LATIN SMALL LETTER O WITH DIAERESIS - 0x009b: 0x00f5, # LATIN SMALL LETTER O WITH TILDE - 0x009c: 0x00fa, # LATIN SMALL LETTER U WITH ACUTE - 0x009d: 0x011a, # LATIN CAPITAL LETTER E WITH CARON - 0x009e: 0x011b, # LATIN SMALL LETTER E WITH CARON - 0x009f: 0x00fc, # LATIN SMALL LETTER U WITH DIAERESIS - 0x00a0: 0x2020, # DAGGER - 0x00a1: 0x00b0, # DEGREE SIGN - 0x00a2: 0x0118, # LATIN CAPITAL LETTER E WITH OGONEK - 0x00a4: 0x00a7, # SECTION SIGN - 0x00a5: 0x2022, # BULLET - 0x00a6: 0x00b6, # PILCROW SIGN - 0x00a7: 0x00df, # LATIN SMALL LETTER SHARP S - 0x00a8: 0x00ae, # REGISTERED SIGN - 0x00aa: 0x2122, # TRADE MARK SIGN - 0x00ab: 0x0119, # LATIN SMALL LETTER E WITH OGONEK - 0x00ac: 0x00a8, # DIAERESIS - 0x00ad: 0x2260, # NOT EQUAL TO - 0x00ae: 0x0123, # LATIN SMALL LETTER G WITH CEDILLA - 0x00af: 0x012e, # LATIN CAPITAL LETTER I WITH OGONEK - 0x00b0: 0x012f, # LATIN SMALL LETTER I WITH OGONEK - 0x00b1: 0x012a, # LATIN CAPITAL LETTER I WITH MACRON - 0x00b2: 0x2264, # LESS-THAN OR EQUAL TO - 0x00b3: 0x2265, # GREATER-THAN OR EQUAL TO - 0x00b4: 0x012b, # LATIN SMALL LETTER I WITH MACRON - 0x00b5: 0x0136, # LATIN CAPITAL LETTER K WITH CEDILLA - 0x00b6: 0x2202, # PARTIAL DIFFERENTIAL - 0x00b7: 0x2211, # N-ARY SUMMATION - 0x00b8: 0x0142, # LATIN SMALL LETTER L WITH STROKE - 0x00b9: 0x013b, # LATIN CAPITAL LETTER L WITH CEDILLA - 0x00ba: 0x013c, # LATIN SMALL LETTER L WITH CEDILLA - 0x00bb: 0x013d, # LATIN CAPITAL LETTER L WITH CARON - 0x00bc: 0x013e, # LATIN SMALL LETTER L WITH CARON - 0x00bd: 0x0139, # LATIN CAPITAL LETTER L WITH ACUTE - 0x00be: 0x013a, # LATIN SMALL LETTER L WITH ACUTE - 0x00bf: 0x0145, # LATIN CAPITAL LETTER N WITH CEDILLA - 0x00c0: 0x0146, # LATIN SMALL LETTER N WITH CEDILLA - 0x00c1: 0x0143, # LATIN CAPITAL LETTER N WITH ACUTE - 0x00c2: 0x00ac, # NOT SIGN - 0x00c3: 0x221a, # SQUARE ROOT - 0x00c4: 0x0144, # LATIN SMALL LETTER N WITH ACUTE - 0x00c5: 0x0147, # LATIN CAPITAL LETTER N WITH CARON - 0x00c6: 0x2206, # INCREMENT - 0x00c7: 0x00ab, # LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00c8: 0x00bb, # RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - 0x00c9: 0x2026, # HORIZONTAL ELLIPSIS - 0x00ca: 0x00a0, # NO-BREAK SPACE - 0x00cb: 0x0148, # LATIN SMALL LETTER N WITH CARON - 0x00cc: 0x0150, # LATIN CAPITAL LETTER O WITH DOUBLE ACUTE - 0x00cd: 0x00d5, # LATIN CAPITAL LETTER O WITH TILDE - 0x00ce: 0x0151, # LATIN SMALL LETTER O WITH DOUBLE ACUTE - 0x00cf: 0x014c, # LATIN CAPITAL LETTER O WITH MACRON - 0x00d0: 0x2013, # EN DASH - 0x00d1: 0x2014, # EM DASH - 0x00d2: 0x201c, # LEFT DOUBLE QUOTATION MARK - 0x00d3: 0x201d, # RIGHT DOUBLE QUOTATION MARK - 0x00d4: 0x2018, # LEFT SINGLE QUOTATION MARK - 0x00d5: 0x2019, # RIGHT SINGLE QUOTATION MARK - 0x00d6: 0x00f7, # DIVISION SIGN - 0x00d7: 0x25ca, # LOZENGE - 0x00d8: 0x014d, # LATIN SMALL LETTER O WITH MACRON - 0x00d9: 0x0154, # LATIN CAPITAL LETTER R WITH ACUTE - 0x00da: 0x0155, # LATIN SMALL LETTER R WITH ACUTE - 0x00db: 0x0158, # LATIN CAPITAL LETTER R WITH CARON - 0x00dc: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK - 0x00dd: 0x203a, # SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - 0x00de: 0x0159, # LATIN SMALL LETTER R WITH CARON - 0x00df: 0x0156, # LATIN CAPITAL LETTER R WITH CEDILLA - 0x00e0: 0x0157, # LATIN SMALL LETTER R WITH CEDILLA - 0x00e1: 0x0160, # LATIN CAPITAL LETTER S WITH CARON - 0x00e2: 0x201a, # SINGLE LOW-9 QUOTATION MARK - 0x00e3: 0x201e, # DOUBLE LOW-9 QUOTATION MARK - 0x00e4: 0x0161, # LATIN SMALL LETTER S WITH CARON - 0x00e5: 0x015a, # LATIN CAPITAL LETTER S WITH ACUTE - 0x00e6: 0x015b, # LATIN SMALL LETTER S WITH ACUTE - 0x00e7: 0x00c1, # LATIN CAPITAL LETTER A WITH ACUTE - 0x00e8: 0x0164, # LATIN CAPITAL LETTER T WITH CARON - 0x00e9: 0x0165, # LATIN SMALL LETTER T WITH CARON - 0x00ea: 0x00cd, # LATIN CAPITAL LETTER I WITH ACUTE - 0x00eb: 0x017d, # LATIN CAPITAL LETTER Z WITH CARON - 0x00ec: 0x017e, # LATIN SMALL LETTER Z WITH CARON - 0x00ed: 0x016a, # LATIN CAPITAL LETTER U WITH MACRON - 0x00ee: 0x00d3, # LATIN CAPITAL LETTER O WITH ACUTE - 0x00ef: 0x00d4, # LATIN CAPITAL LETTER O WITH CIRCUMFLEX - 0x00f0: 0x016b, # LATIN SMALL LETTER U WITH MACRON - 0x00f1: 0x016e, # LATIN CAPITAL LETTER U WITH RING ABOVE - 0x00f2: 0x00da, # LATIN CAPITAL LETTER U WITH ACUTE - 0x00f3: 0x016f, # LATIN SMALL LETTER U WITH RING ABOVE - 0x00f4: 0x0170, # LATIN CAPITAL LETTER U WITH DOUBLE ACUTE - 0x00f5: 0x0171, # LATIN SMALL LETTER U WITH DOUBLE ACUTE - 0x00f6: 0x0172, # LATIN CAPITAL LETTER U WITH OGONEK - 0x00f7: 0x0173, # LATIN SMALL LETTER U WITH OGONEK - 0x00f8: 0x00dd, # LATIN CAPITAL LETTER Y WITH ACUTE - 0x00f9: 0x00fd, # LATIN SMALL LETTER Y WITH ACUTE - 0x00fa: 0x0137, # LATIN SMALL LETTER K WITH CEDILLA - 0x00fb: 0x017b, # LATIN CAPITAL LETTER Z WITH DOT ABOVE - 0x00fc: 0x0141, # LATIN CAPITAL LETTER L WITH STROKE - 0x00fd: 0x017c, # LATIN SMALL LETTER Z WITH DOT ABOVE - 0x00fe: 0x0122, # LATIN CAPITAL LETTER G WITH CEDILLA - 0x00ff: 0x02c7, # CARON -}) - -### Encoding Map - -encoding_map = codecs.make_encoding_map(decoding_map) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py deleted file mode 100644 index 1098501..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_roman.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-roman', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\xe6' # 0xBE -> LATIN SMALL LETTER AE - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\ufb01' # 0xDE -> LATIN SMALL LIGATURE FI - u'\ufb02' # 0xDF -> LATIN SMALL LIGATURE FL - u'\u2021' # 0xE0 -> DOUBLE DAGGER - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py deleted file mode 100644 index 26a5e53..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_romanian.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_romanian generated from 'MAPPINGS/VENDORS/APPLE/ROMANIAN.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-romanian', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\u0102' # 0xAE -> LATIN CAPITAL LETTER A WITH BREVE - u'\u0218' # 0xAF -> LATIN CAPITAL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\u0103' # 0xBE -> LATIN SMALL LETTER A WITH BREVE - u'\u0219' # 0xBF -> LATIN SMALL LETTER S WITH COMMA BELOW # for Unicode 3.0 and later - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u2044' # 0xDA -> FRACTION SLASH - u'\u20ac' # 0xDB -> EURO SIGN - u'\u2039' # 0xDC -> SINGLE LEFT-POINTING ANGLE QUOTATION MARK - u'\u203a' # 0xDD -> SINGLE RIGHT-POINTING ANGLE QUOTATION MARK - u'\u021a' # 0xDE -> LATIN CAPITAL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later - u'\u021b' # 0xDF -> LATIN SMALL LETTER T WITH COMMA BELOW # for Unicode 3.0 and later - u'\u2021' # 0xE0 -> DOUBLE DAGGER - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\u0131' # 0xF5 -> LATIN SMALL LETTER DOTLESS I - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py deleted file mode 100644 index fafcc64..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mac_turkish.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec mac_turkish generated from 'MAPPINGS/VENDORS/APPLE/TURKISH.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mac-turkish', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> CONTROL CHARACTER - u'\x01' # 0x01 -> CONTROL CHARACTER - u'\x02' # 0x02 -> CONTROL CHARACTER - u'\x03' # 0x03 -> CONTROL CHARACTER - u'\x04' # 0x04 -> CONTROL CHARACTER - u'\x05' # 0x05 -> CONTROL CHARACTER - u'\x06' # 0x06 -> CONTROL CHARACTER - u'\x07' # 0x07 -> CONTROL CHARACTER - u'\x08' # 0x08 -> CONTROL CHARACTER - u'\t' # 0x09 -> CONTROL CHARACTER - u'\n' # 0x0A -> CONTROL CHARACTER - u'\x0b' # 0x0B -> CONTROL CHARACTER - u'\x0c' # 0x0C -> CONTROL CHARACTER - u'\r' # 0x0D -> CONTROL CHARACTER - u'\x0e' # 0x0E -> CONTROL CHARACTER - u'\x0f' # 0x0F -> CONTROL CHARACTER - u'\x10' # 0x10 -> CONTROL CHARACTER - u'\x11' # 0x11 -> CONTROL CHARACTER - u'\x12' # 0x12 -> CONTROL CHARACTER - u'\x13' # 0x13 -> CONTROL CHARACTER - u'\x14' # 0x14 -> CONTROL CHARACTER - u'\x15' # 0x15 -> CONTROL CHARACTER - u'\x16' # 0x16 -> CONTROL CHARACTER - u'\x17' # 0x17 -> CONTROL CHARACTER - u'\x18' # 0x18 -> CONTROL CHARACTER - u'\x19' # 0x19 -> CONTROL CHARACTER - u'\x1a' # 0x1A -> CONTROL CHARACTER - u'\x1b' # 0x1B -> CONTROL CHARACTER - u'\x1c' # 0x1C -> CONTROL CHARACTER - u'\x1d' # 0x1D -> CONTROL CHARACTER - u'\x1e' # 0x1E -> CONTROL CHARACTER - u'\x1f' # 0x1F -> CONTROL CHARACTER - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> CONTROL CHARACTER - u'\xc4' # 0x80 -> LATIN CAPITAL LETTER A WITH DIAERESIS - u'\xc5' # 0x81 -> LATIN CAPITAL LETTER A WITH RING ABOVE - u'\xc7' # 0x82 -> LATIN CAPITAL LETTER C WITH CEDILLA - u'\xc9' # 0x83 -> LATIN CAPITAL LETTER E WITH ACUTE - u'\xd1' # 0x84 -> LATIN CAPITAL LETTER N WITH TILDE - u'\xd6' # 0x85 -> LATIN CAPITAL LETTER O WITH DIAERESIS - u'\xdc' # 0x86 -> LATIN CAPITAL LETTER U WITH DIAERESIS - u'\xe1' # 0x87 -> LATIN SMALL LETTER A WITH ACUTE - u'\xe0' # 0x88 -> LATIN SMALL LETTER A WITH GRAVE - u'\xe2' # 0x89 -> LATIN SMALL LETTER A WITH CIRCUMFLEX - u'\xe4' # 0x8A -> LATIN SMALL LETTER A WITH DIAERESIS - u'\xe3' # 0x8B -> LATIN SMALL LETTER A WITH TILDE - u'\xe5' # 0x8C -> LATIN SMALL LETTER A WITH RING ABOVE - u'\xe7' # 0x8D -> LATIN SMALL LETTER C WITH CEDILLA - u'\xe9' # 0x8E -> LATIN SMALL LETTER E WITH ACUTE - u'\xe8' # 0x8F -> LATIN SMALL LETTER E WITH GRAVE - u'\xea' # 0x90 -> LATIN SMALL LETTER E WITH CIRCUMFLEX - u'\xeb' # 0x91 -> LATIN SMALL LETTER E WITH DIAERESIS - u'\xed' # 0x92 -> LATIN SMALL LETTER I WITH ACUTE - u'\xec' # 0x93 -> LATIN SMALL LETTER I WITH GRAVE - u'\xee' # 0x94 -> LATIN SMALL LETTER I WITH CIRCUMFLEX - u'\xef' # 0x95 -> LATIN SMALL LETTER I WITH DIAERESIS - u'\xf1' # 0x96 -> LATIN SMALL LETTER N WITH TILDE - u'\xf3' # 0x97 -> LATIN SMALL LETTER O WITH ACUTE - u'\xf2' # 0x98 -> LATIN SMALL LETTER O WITH GRAVE - u'\xf4' # 0x99 -> LATIN SMALL LETTER O WITH CIRCUMFLEX - u'\xf6' # 0x9A -> LATIN SMALL LETTER O WITH DIAERESIS - u'\xf5' # 0x9B -> LATIN SMALL LETTER O WITH TILDE - u'\xfa' # 0x9C -> LATIN SMALL LETTER U WITH ACUTE - u'\xf9' # 0x9D -> LATIN SMALL LETTER U WITH GRAVE - u'\xfb' # 0x9E -> LATIN SMALL LETTER U WITH CIRCUMFLEX - u'\xfc' # 0x9F -> LATIN SMALL LETTER U WITH DIAERESIS - u'\u2020' # 0xA0 -> DAGGER - u'\xb0' # 0xA1 -> DEGREE SIGN - u'\xa2' # 0xA2 -> CENT SIGN - u'\xa3' # 0xA3 -> POUND SIGN - u'\xa7' # 0xA4 -> SECTION SIGN - u'\u2022' # 0xA5 -> BULLET - u'\xb6' # 0xA6 -> PILCROW SIGN - u'\xdf' # 0xA7 -> LATIN SMALL LETTER SHARP S - u'\xae' # 0xA8 -> REGISTERED SIGN - u'\xa9' # 0xA9 -> COPYRIGHT SIGN - u'\u2122' # 0xAA -> TRADE MARK SIGN - u'\xb4' # 0xAB -> ACUTE ACCENT - u'\xa8' # 0xAC -> DIAERESIS - u'\u2260' # 0xAD -> NOT EQUAL TO - u'\xc6' # 0xAE -> LATIN CAPITAL LETTER AE - u'\xd8' # 0xAF -> LATIN CAPITAL LETTER O WITH STROKE - u'\u221e' # 0xB0 -> INFINITY - u'\xb1' # 0xB1 -> PLUS-MINUS SIGN - u'\u2264' # 0xB2 -> LESS-THAN OR EQUAL TO - u'\u2265' # 0xB3 -> GREATER-THAN OR EQUAL TO - u'\xa5' # 0xB4 -> YEN SIGN - u'\xb5' # 0xB5 -> MICRO SIGN - u'\u2202' # 0xB6 -> PARTIAL DIFFERENTIAL - u'\u2211' # 0xB7 -> N-ARY SUMMATION - u'\u220f' # 0xB8 -> N-ARY PRODUCT - u'\u03c0' # 0xB9 -> GREEK SMALL LETTER PI - u'\u222b' # 0xBA -> INTEGRAL - u'\xaa' # 0xBB -> FEMININE ORDINAL INDICATOR - u'\xba' # 0xBC -> MASCULINE ORDINAL INDICATOR - u'\u03a9' # 0xBD -> GREEK CAPITAL LETTER OMEGA - u'\xe6' # 0xBE -> LATIN SMALL LETTER AE - u'\xf8' # 0xBF -> LATIN SMALL LETTER O WITH STROKE - u'\xbf' # 0xC0 -> INVERTED QUESTION MARK - u'\xa1' # 0xC1 -> INVERTED EXCLAMATION MARK - u'\xac' # 0xC2 -> NOT SIGN - u'\u221a' # 0xC3 -> SQUARE ROOT - u'\u0192' # 0xC4 -> LATIN SMALL LETTER F WITH HOOK - u'\u2248' # 0xC5 -> ALMOST EQUAL TO - u'\u2206' # 0xC6 -> INCREMENT - u'\xab' # 0xC7 -> LEFT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\xbb' # 0xC8 -> RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK - u'\u2026' # 0xC9 -> HORIZONTAL ELLIPSIS - u'\xa0' # 0xCA -> NO-BREAK SPACE - u'\xc0' # 0xCB -> LATIN CAPITAL LETTER A WITH GRAVE - u'\xc3' # 0xCC -> LATIN CAPITAL LETTER A WITH TILDE - u'\xd5' # 0xCD -> LATIN CAPITAL LETTER O WITH TILDE - u'\u0152' # 0xCE -> LATIN CAPITAL LIGATURE OE - u'\u0153' # 0xCF -> LATIN SMALL LIGATURE OE - u'\u2013' # 0xD0 -> EN DASH - u'\u2014' # 0xD1 -> EM DASH - u'\u201c' # 0xD2 -> LEFT DOUBLE QUOTATION MARK - u'\u201d' # 0xD3 -> RIGHT DOUBLE QUOTATION MARK - u'\u2018' # 0xD4 -> LEFT SINGLE QUOTATION MARK - u'\u2019' # 0xD5 -> RIGHT SINGLE QUOTATION MARK - u'\xf7' # 0xD6 -> DIVISION SIGN - u'\u25ca' # 0xD7 -> LOZENGE - u'\xff' # 0xD8 -> LATIN SMALL LETTER Y WITH DIAERESIS - u'\u0178' # 0xD9 -> LATIN CAPITAL LETTER Y WITH DIAERESIS - u'\u011e' # 0xDA -> LATIN CAPITAL LETTER G WITH BREVE - u'\u011f' # 0xDB -> LATIN SMALL LETTER G WITH BREVE - u'\u0130' # 0xDC -> LATIN CAPITAL LETTER I WITH DOT ABOVE - u'\u0131' # 0xDD -> LATIN SMALL LETTER DOTLESS I - u'\u015e' # 0xDE -> LATIN CAPITAL LETTER S WITH CEDILLA - u'\u015f' # 0xDF -> LATIN SMALL LETTER S WITH CEDILLA - u'\u2021' # 0xE0 -> DOUBLE DAGGER - u'\xb7' # 0xE1 -> MIDDLE DOT - u'\u201a' # 0xE2 -> SINGLE LOW-9 QUOTATION MARK - u'\u201e' # 0xE3 -> DOUBLE LOW-9 QUOTATION MARK - u'\u2030' # 0xE4 -> PER MILLE SIGN - u'\xc2' # 0xE5 -> LATIN CAPITAL LETTER A WITH CIRCUMFLEX - u'\xca' # 0xE6 -> LATIN CAPITAL LETTER E WITH CIRCUMFLEX - u'\xc1' # 0xE7 -> LATIN CAPITAL LETTER A WITH ACUTE - u'\xcb' # 0xE8 -> LATIN CAPITAL LETTER E WITH DIAERESIS - u'\xc8' # 0xE9 -> LATIN CAPITAL LETTER E WITH GRAVE - u'\xcd' # 0xEA -> LATIN CAPITAL LETTER I WITH ACUTE - u'\xce' # 0xEB -> LATIN CAPITAL LETTER I WITH CIRCUMFLEX - u'\xcf' # 0xEC -> LATIN CAPITAL LETTER I WITH DIAERESIS - u'\xcc' # 0xED -> LATIN CAPITAL LETTER I WITH GRAVE - u'\xd3' # 0xEE -> LATIN CAPITAL LETTER O WITH ACUTE - u'\xd4' # 0xEF -> LATIN CAPITAL LETTER O WITH CIRCUMFLEX - u'\uf8ff' # 0xF0 -> Apple logo - u'\xd2' # 0xF1 -> LATIN CAPITAL LETTER O WITH GRAVE - u'\xda' # 0xF2 -> LATIN CAPITAL LETTER U WITH ACUTE - u'\xdb' # 0xF3 -> LATIN CAPITAL LETTER U WITH CIRCUMFLEX - u'\xd9' # 0xF4 -> LATIN CAPITAL LETTER U WITH GRAVE - u'\uf8a0' # 0xF5 -> undefined1 - u'\u02c6' # 0xF6 -> MODIFIER LETTER CIRCUMFLEX ACCENT - u'\u02dc' # 0xF7 -> SMALL TILDE - u'\xaf' # 0xF8 -> MACRON - u'\u02d8' # 0xF9 -> BREVE - u'\u02d9' # 0xFA -> DOT ABOVE - u'\u02da' # 0xFB -> RING ABOVE - u'\xb8' # 0xFC -> CEDILLA - u'\u02dd' # 0xFD -> DOUBLE ACUTE ACCENT - u'\u02db' # 0xFE -> OGONEK - u'\u02c7' # 0xFF -> CARON -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py deleted file mode 100644 index d6b17b5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/mbcs.py +++ /dev/null @@ -1,47 +0,0 @@ -""" Python 'mbcs' Codec for Windows - - -Cloned by Mark Hammond (mhammond@skippinet.com.au) from ascii.py, -which was written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -# Import them explicitly to cause an ImportError -# on non-Windows systems -from codecs import mbcs_encode, mbcs_decode -# for IncrementalDecoder, IncrementalEncoder, ... -import codecs - -### Codec APIs - -encode = mbcs_encode - -def decode(input, errors='strict'): - return mbcs_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return mbcs_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = mbcs_decode - -class StreamWriter(codecs.StreamWriter): - encode = mbcs_encode - -class StreamReader(codecs.StreamReader): - decode = mbcs_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='mbcs', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py deleted file mode 100644 index 4fc4b72..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/palmos.py +++ /dev/null @@ -1,83 +0,0 @@ -""" Python Character Mapping Codec for PalmOS 3.5. - -Written by Sjoerd Mullender (sjoerd@acm.org); based on iso8859_15.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_map) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_map)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='palmos', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) - -# The PalmOS character set is mostly iso-8859-1 with some differences. -decoding_map.update({ - 0x0080: 0x20ac, # EURO SIGN - 0x0082: 0x201a, # SINGLE LOW-9 QUOTATION MARK - 0x0083: 0x0192, # LATIN SMALL LETTER F WITH HOOK - 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK - 0x0085: 0x2026, # HORIZONTAL ELLIPSIS - 0x0086: 0x2020, # DAGGER - 0x0087: 0x2021, # DOUBLE DAGGER - 0x0088: 0x02c6, # MODIFIER LETTER CIRCUMFLEX ACCENT - 0x0089: 0x2030, # PER MILLE SIGN - 0x008a: 0x0160, # LATIN CAPITAL LETTER S WITH CARON - 0x008b: 0x2039, # SINGLE LEFT-POINTING ANGLE QUOTATION MARK - 0x008c: 0x0152, # LATIN CAPITAL LIGATURE OE - 0x008d: 0x2666, # BLACK DIAMOND SUIT - 0x008e: 0x2663, # BLACK CLUB SUIT - 0x008f: 0x2665, # BLACK HEART SUIT - 0x0090: 0x2660, # BLACK SPADE SUIT - 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK - 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK - 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK - 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK - 0x0095: 0x2022, # BULLET - 0x0096: 0x2013, # EN DASH - 0x0097: 0x2014, # EM DASH - 0x0098: 0x02dc, # SMALL TILDE - 0x0099: 0x2122, # TRADE MARK SIGN - 0x009a: 0x0161, # LATIN SMALL LETTER S WITH CARON - 0x009c: 0x0153, # LATIN SMALL LIGATURE OE - 0x009f: 0x0178, # LATIN CAPITAL LETTER Y WITH DIAERESIS -}) - -### Encoding Map - -encoding_map = codecs.make_encoding_map(decoding_map) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py deleted file mode 100644 index f197da5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/ptcp154.py +++ /dev/null @@ -1,175 +0,0 @@ -""" Python Character Mapping Codec generated from 'PTCP154.txt' with gencodec.py. - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. -(c) Copyright 2000 Guido van Rossum. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_map) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_map)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='ptcp154', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0080: 0x0496, # CYRILLIC CAPITAL LETTER ZHE WITH DESCENDER - 0x0081: 0x0492, # CYRILLIC CAPITAL LETTER GHE WITH STROKE - 0x0082: 0x04ee, # CYRILLIC CAPITAL LETTER U WITH MACRON - 0x0083: 0x0493, # CYRILLIC SMALL LETTER GHE WITH STROKE - 0x0084: 0x201e, # DOUBLE LOW-9 QUOTATION MARK - 0x0085: 0x2026, # HORIZONTAL ELLIPSIS - 0x0086: 0x04b6, # CYRILLIC CAPITAL LETTER CHE WITH DESCENDER - 0x0087: 0x04ae, # CYRILLIC CAPITAL LETTER STRAIGHT U - 0x0088: 0x04b2, # CYRILLIC CAPITAL LETTER HA WITH DESCENDER - 0x0089: 0x04af, # CYRILLIC SMALL LETTER STRAIGHT U - 0x008a: 0x04a0, # CYRILLIC CAPITAL LETTER BASHKIR KA - 0x008b: 0x04e2, # CYRILLIC CAPITAL LETTER I WITH MACRON - 0x008c: 0x04a2, # CYRILLIC CAPITAL LETTER EN WITH DESCENDER - 0x008d: 0x049a, # CYRILLIC CAPITAL LETTER KA WITH DESCENDER - 0x008e: 0x04ba, # CYRILLIC CAPITAL LETTER SHHA - 0x008f: 0x04b8, # CYRILLIC CAPITAL LETTER CHE WITH VERTICAL STROKE - 0x0090: 0x0497, # CYRILLIC SMALL LETTER ZHE WITH DESCENDER - 0x0091: 0x2018, # LEFT SINGLE QUOTATION MARK - 0x0092: 0x2019, # RIGHT SINGLE QUOTATION MARK - 0x0093: 0x201c, # LEFT DOUBLE QUOTATION MARK - 0x0094: 0x201d, # RIGHT DOUBLE QUOTATION MARK - 0x0095: 0x2022, # BULLET - 0x0096: 0x2013, # EN DASH - 0x0097: 0x2014, # EM DASH - 0x0098: 0x04b3, # CYRILLIC SMALL LETTER HA WITH DESCENDER - 0x0099: 0x04b7, # CYRILLIC SMALL LETTER CHE WITH DESCENDER - 0x009a: 0x04a1, # CYRILLIC SMALL LETTER BASHKIR KA - 0x009b: 0x04e3, # CYRILLIC SMALL LETTER I WITH MACRON - 0x009c: 0x04a3, # CYRILLIC SMALL LETTER EN WITH DESCENDER - 0x009d: 0x049b, # CYRILLIC SMALL LETTER KA WITH DESCENDER - 0x009e: 0x04bb, # CYRILLIC SMALL LETTER SHHA - 0x009f: 0x04b9, # CYRILLIC SMALL LETTER CHE WITH VERTICAL STROKE - 0x00a1: 0x040e, # CYRILLIC CAPITAL LETTER SHORT U (Byelorussian) - 0x00a2: 0x045e, # CYRILLIC SMALL LETTER SHORT U (Byelorussian) - 0x00a3: 0x0408, # CYRILLIC CAPITAL LETTER JE - 0x00a4: 0x04e8, # CYRILLIC CAPITAL LETTER BARRED O - 0x00a5: 0x0498, # CYRILLIC CAPITAL LETTER ZE WITH DESCENDER - 0x00a6: 0x04b0, # CYRILLIC CAPITAL LETTER STRAIGHT U WITH STROKE - 0x00a8: 0x0401, # CYRILLIC CAPITAL LETTER IO - 0x00aa: 0x04d8, # CYRILLIC CAPITAL LETTER SCHWA - 0x00ad: 0x04ef, # CYRILLIC SMALL LETTER U WITH MACRON - 0x00af: 0x049c, # CYRILLIC CAPITAL LETTER KA WITH VERTICAL STROKE - 0x00b1: 0x04b1, # CYRILLIC SMALL LETTER STRAIGHT U WITH STROKE - 0x00b2: 0x0406, # CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I - 0x00b3: 0x0456, # CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I - 0x00b4: 0x0499, # CYRILLIC SMALL LETTER ZE WITH DESCENDER - 0x00b5: 0x04e9, # CYRILLIC SMALL LETTER BARRED O - 0x00b8: 0x0451, # CYRILLIC SMALL LETTER IO - 0x00b9: 0x2116, # NUMERO SIGN - 0x00ba: 0x04d9, # CYRILLIC SMALL LETTER SCHWA - 0x00bc: 0x0458, # CYRILLIC SMALL LETTER JE - 0x00bd: 0x04aa, # CYRILLIC CAPITAL LETTER ES WITH DESCENDER - 0x00be: 0x04ab, # CYRILLIC SMALL LETTER ES WITH DESCENDER - 0x00bf: 0x049d, # CYRILLIC SMALL LETTER KA WITH VERTICAL STROKE - 0x00c0: 0x0410, # CYRILLIC CAPITAL LETTER A - 0x00c1: 0x0411, # CYRILLIC CAPITAL LETTER BE - 0x00c2: 0x0412, # CYRILLIC CAPITAL LETTER VE - 0x00c3: 0x0413, # CYRILLIC CAPITAL LETTER GHE - 0x00c4: 0x0414, # CYRILLIC CAPITAL LETTER DE - 0x00c5: 0x0415, # CYRILLIC CAPITAL LETTER IE - 0x00c6: 0x0416, # CYRILLIC CAPITAL LETTER ZHE - 0x00c7: 0x0417, # CYRILLIC CAPITAL LETTER ZE - 0x00c8: 0x0418, # CYRILLIC CAPITAL LETTER I - 0x00c9: 0x0419, # CYRILLIC CAPITAL LETTER SHORT I - 0x00ca: 0x041a, # CYRILLIC CAPITAL LETTER KA - 0x00cb: 0x041b, # CYRILLIC CAPITAL LETTER EL - 0x00cc: 0x041c, # CYRILLIC CAPITAL LETTER EM - 0x00cd: 0x041d, # CYRILLIC CAPITAL LETTER EN - 0x00ce: 0x041e, # CYRILLIC CAPITAL LETTER O - 0x00cf: 0x041f, # CYRILLIC CAPITAL LETTER PE - 0x00d0: 0x0420, # CYRILLIC CAPITAL LETTER ER - 0x00d1: 0x0421, # CYRILLIC CAPITAL LETTER ES - 0x00d2: 0x0422, # CYRILLIC CAPITAL LETTER TE - 0x00d3: 0x0423, # CYRILLIC CAPITAL LETTER U - 0x00d4: 0x0424, # CYRILLIC CAPITAL LETTER EF - 0x00d5: 0x0425, # CYRILLIC CAPITAL LETTER HA - 0x00d6: 0x0426, # CYRILLIC CAPITAL LETTER TSE - 0x00d7: 0x0427, # CYRILLIC CAPITAL LETTER CHE - 0x00d8: 0x0428, # CYRILLIC CAPITAL LETTER SHA - 0x00d9: 0x0429, # CYRILLIC CAPITAL LETTER SHCHA - 0x00da: 0x042a, # CYRILLIC CAPITAL LETTER HARD SIGN - 0x00db: 0x042b, # CYRILLIC CAPITAL LETTER YERU - 0x00dc: 0x042c, # CYRILLIC CAPITAL LETTER SOFT SIGN - 0x00dd: 0x042d, # CYRILLIC CAPITAL LETTER E - 0x00de: 0x042e, # CYRILLIC CAPITAL LETTER YU - 0x00df: 0x042f, # CYRILLIC CAPITAL LETTER YA - 0x00e0: 0x0430, # CYRILLIC SMALL LETTER A - 0x00e1: 0x0431, # CYRILLIC SMALL LETTER BE - 0x00e2: 0x0432, # CYRILLIC SMALL LETTER VE - 0x00e3: 0x0433, # CYRILLIC SMALL LETTER GHE - 0x00e4: 0x0434, # CYRILLIC SMALL LETTER DE - 0x00e5: 0x0435, # CYRILLIC SMALL LETTER IE - 0x00e6: 0x0436, # CYRILLIC SMALL LETTER ZHE - 0x00e7: 0x0437, # CYRILLIC SMALL LETTER ZE - 0x00e8: 0x0438, # CYRILLIC SMALL LETTER I - 0x00e9: 0x0439, # CYRILLIC SMALL LETTER SHORT I - 0x00ea: 0x043a, # CYRILLIC SMALL LETTER KA - 0x00eb: 0x043b, # CYRILLIC SMALL LETTER EL - 0x00ec: 0x043c, # CYRILLIC SMALL LETTER EM - 0x00ed: 0x043d, # CYRILLIC SMALL LETTER EN - 0x00ee: 0x043e, # CYRILLIC SMALL LETTER O - 0x00ef: 0x043f, # CYRILLIC SMALL LETTER PE - 0x00f0: 0x0440, # CYRILLIC SMALL LETTER ER - 0x00f1: 0x0441, # CYRILLIC SMALL LETTER ES - 0x00f2: 0x0442, # CYRILLIC SMALL LETTER TE - 0x00f3: 0x0443, # CYRILLIC SMALL LETTER U - 0x00f4: 0x0444, # CYRILLIC SMALL LETTER EF - 0x00f5: 0x0445, # CYRILLIC SMALL LETTER HA - 0x00f6: 0x0446, # CYRILLIC SMALL LETTER TSE - 0x00f7: 0x0447, # CYRILLIC SMALL LETTER CHE - 0x00f8: 0x0448, # CYRILLIC SMALL LETTER SHA - 0x00f9: 0x0449, # CYRILLIC SMALL LETTER SHCHA - 0x00fa: 0x044a, # CYRILLIC SMALL LETTER HARD SIGN - 0x00fb: 0x044b, # CYRILLIC SMALL LETTER YERU - 0x00fc: 0x044c, # CYRILLIC SMALL LETTER SOFT SIGN - 0x00fd: 0x044d, # CYRILLIC SMALL LETTER E - 0x00fe: 0x044e, # CYRILLIC SMALL LETTER YU - 0x00ff: 0x044f, # CYRILLIC SMALL LETTER YA -}) - -### Encoding Map - -encoding_map = codecs.make_encoding_map(decoding_map) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py deleted file mode 100644 index ad3cc55..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/punycode.py +++ /dev/null @@ -1,238 +0,0 @@ -# -*- coding: iso-8859-1 -*- -""" Codec for the Punicode encoding, as specified in RFC 3492 - -Written by Martin v. Löwis. -""" - -import codecs - -##################### Encoding ##################################### - -def segregate(str): - """3.1 Basic code point segregation""" - base = [] - extended = {} - for c in str: - if ord(c) < 128: - base.append(c) - else: - extended[c] = 1 - extended = extended.keys() - extended.sort() - return "".join(base).encode("ascii"),extended - -def selective_len(str, max): - """Return the length of str, considering only characters below max.""" - res = 0 - for c in str: - if ord(c) < max: - res += 1 - return res - -def selective_find(str, char, index, pos): - """Return a pair (index, pos), indicating the next occurrence of - char in str. index is the position of the character considering - only ordinals up to and including char, and pos is the position in - the full string. index/pos is the starting position in the full - string.""" - - l = len(str) - while 1: - pos += 1 - if pos == l: - return (-1, -1) - c = str[pos] - if c == char: - return index+1, pos - elif c < char: - index += 1 - -def insertion_unsort(str, extended): - """3.2 Insertion unsort coding""" - oldchar = 0x80 - result = [] - oldindex = -1 - for c in extended: - index = pos = -1 - char = ord(c) - curlen = selective_len(str, char) - delta = (curlen+1) * (char - oldchar) - while 1: - index,pos = selective_find(str,c,index,pos) - if index == -1: - break - delta += index - oldindex - result.append(delta-1) - oldindex = index - delta = 0 - oldchar = char - - return result - -def T(j, bias): - # Punycode parameters: tmin = 1, tmax = 26, base = 36 - res = 36 * (j + 1) - bias - if res < 1: return 1 - if res > 26: return 26 - return res - -digits = "abcdefghijklmnopqrstuvwxyz0123456789" -def generate_generalized_integer(N, bias): - """3.3 Generalized variable-length integers""" - result = [] - j = 0 - while 1: - t = T(j, bias) - if N < t: - result.append(digits[N]) - return result - result.append(digits[t + ((N - t) % (36 - t))]) - N = (N - t) // (36 - t) - j += 1 - -def adapt(delta, first, numchars): - if first: - delta //= 700 - else: - delta //= 2 - delta += delta // numchars - # ((base - tmin) * tmax) // 2 == 455 - divisions = 0 - while delta > 455: - delta = delta // 35 # base - tmin - divisions += 36 - bias = divisions + (36 * delta // (delta + 38)) - return bias - - -def generate_integers(baselen, deltas): - """3.4 Bias adaptation""" - # Punycode parameters: initial bias = 72, damp = 700, skew = 38 - result = [] - bias = 72 - for points, delta in enumerate(deltas): - s = generate_generalized_integer(delta, bias) - result.extend(s) - bias = adapt(delta, points==0, baselen+points+1) - return "".join(result) - -def punycode_encode(text): - base, extended = segregate(text) - base = base.encode("ascii") - deltas = insertion_unsort(text, extended) - extended = generate_integers(len(base), deltas) - if base: - return base + "-" + extended - return extended - -##################### Decoding ##################################### - -def decode_generalized_number(extended, extpos, bias, errors): - """3.3 Generalized variable-length integers""" - result = 0 - w = 1 - j = 0 - while 1: - try: - char = ord(extended[extpos]) - except IndexError: - if errors == "strict": - raise UnicodeError, "incomplete punicode string" - return extpos + 1, None - extpos += 1 - if 0x41 <= char <= 0x5A: # A-Z - digit = char - 0x41 - elif 0x30 <= char <= 0x39: - digit = char - 22 # 0x30-26 - elif errors == "strict": - raise UnicodeError("Invalid extended code point '%s'" - % extended[extpos]) - else: - return extpos, None - t = T(j, bias) - result += digit * w - if digit < t: - return extpos, result - w = w * (36 - t) - j += 1 - - -def insertion_sort(base, extended, errors): - """3.2 Insertion unsort coding""" - char = 0x80 - pos = -1 - bias = 72 - extpos = 0 - while extpos < len(extended): - newpos, delta = decode_generalized_number(extended, extpos, - bias, errors) - if delta is None: - # There was an error in decoding. We can't continue because - # synchronization is lost. - return base - pos += delta+1 - char += pos // (len(base) + 1) - if char > 0x10FFFF: - if errors == "strict": - raise UnicodeError, ("Invalid character U+%x" % char) - char = ord('?') - pos = pos % (len(base) + 1) - base = base[:pos] + unichr(char) + base[pos:] - bias = adapt(delta, (extpos == 0), len(base)) - extpos = newpos - return base - -def punycode_decode(text, errors): - pos = text.rfind("-") - if pos == -1: - base = "" - extended = text - else: - base = text[:pos] - extended = text[pos+1:] - base = unicode(base, "ascii", errors) - extended = extended.upper() - return insertion_sort(base, extended, errors) - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - res = punycode_encode(input) - return res, len(input) - - def decode(self,input,errors='strict'): - if errors not in ('strict', 'replace', 'ignore'): - raise UnicodeError, "Unsupported error handling "+errors - res = punycode_decode(input, errors) - return res, len(input) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return punycode_encode(input) - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - if self.errors not in ('strict', 'replace', 'ignore'): - raise UnicodeError, "Unsupported error handling "+self.errors - return punycode_decode(input, self.errors) - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='punycode', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py deleted file mode 100644 index 663d6a6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/quopri_codec.py +++ /dev/null @@ -1,75 +0,0 @@ -"""Codec for quoted-printable encoding. - -Like base64 and rot13, this returns Python strings, not Unicode. -""" - -import codecs, quopri -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - -def quopri_encode(input, errors='strict'): - """Encode the input, returning a tuple (output object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - # using str() because of cStringIO's Unicode undesired Unicode behavior. - f = StringIO(str(input)) - g = StringIO() - quopri.encode(f, g, 1) - output = g.getvalue() - return (output, len(input)) - -def quopri_decode(input, errors='strict'): - """Decode the input, returning a tuple (output object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - f = StringIO(str(input)) - g = StringIO() - quopri.decode(f, g) - output = g.getvalue() - return (output, len(input)) - -class Codec(codecs.Codec): - - def encode(self, input,errors='strict'): - return quopri_encode(input,errors) - def decode(self, input,errors='strict'): - return quopri_decode(input,errors) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return quopri_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return quopri_decode(input, self.errors)[0] - -class StreamWriter(Codec, codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -# encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='quopri', - encode=quopri_encode, - decode=quopri_decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py deleted file mode 100644 index cb0abfb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/raw_unicode_escape.py +++ /dev/null @@ -1,45 +0,0 @@ -""" Python 'raw-unicode-escape' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - # Note: Binding these as C functions will result in the class not - # converting them to methods. This is intended. - encode = codecs.raw_unicode_escape_encode - decode = codecs.raw_unicode_escape_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.raw_unicode_escape_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.raw_unicode_escape_decode(input, self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='raw-unicode-escape', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py deleted file mode 100644 index cb25ecb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/rot_13.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python -""" Python Character Mapping Codec for ROT13. - - See http://ucsub.colorado.edu/~kominek/rot13/ for details. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_map) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_map) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_map)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_map)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='rot-13', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) - -### Decoding Map - -decoding_map = codecs.make_identity_dict(range(256)) -decoding_map.update({ - 0x0041: 0x004e, - 0x0042: 0x004f, - 0x0043: 0x0050, - 0x0044: 0x0051, - 0x0045: 0x0052, - 0x0046: 0x0053, - 0x0047: 0x0054, - 0x0048: 0x0055, - 0x0049: 0x0056, - 0x004a: 0x0057, - 0x004b: 0x0058, - 0x004c: 0x0059, - 0x004d: 0x005a, - 0x004e: 0x0041, - 0x004f: 0x0042, - 0x0050: 0x0043, - 0x0051: 0x0044, - 0x0052: 0x0045, - 0x0053: 0x0046, - 0x0054: 0x0047, - 0x0055: 0x0048, - 0x0056: 0x0049, - 0x0057: 0x004a, - 0x0058: 0x004b, - 0x0059: 0x004c, - 0x005a: 0x004d, - 0x0061: 0x006e, - 0x0062: 0x006f, - 0x0063: 0x0070, - 0x0064: 0x0071, - 0x0065: 0x0072, - 0x0066: 0x0073, - 0x0067: 0x0074, - 0x0068: 0x0075, - 0x0069: 0x0076, - 0x006a: 0x0077, - 0x006b: 0x0078, - 0x006c: 0x0079, - 0x006d: 0x007a, - 0x006e: 0x0061, - 0x006f: 0x0062, - 0x0070: 0x0063, - 0x0071: 0x0064, - 0x0072: 0x0065, - 0x0073: 0x0066, - 0x0074: 0x0067, - 0x0075: 0x0068, - 0x0076: 0x0069, - 0x0077: 0x006a, - 0x0078: 0x006b, - 0x0079: 0x006c, - 0x007a: 0x006d, -}) - -### Encoding Map - -encoding_map = codecs.make_encoding_map(decoding_map) - -### Filter API - -def rot13(infile, outfile): - outfile.write(infile.read().encode('rot-13')) - -if __name__ == '__main__': - import sys - rot13(sys.stdin, sys.stdout) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py deleted file mode 100644 index 3db9364..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# shift_jis.py: Python Unicode Codec for SHIFT_JIS -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('shift_jis') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='shift_jis', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py deleted file mode 100644 index 3e48bb7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jis_2004.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# shift_jis_2004.py: Python Unicode Codec for SHIFT_JIS_2004 -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('shift_jis_2004') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='shift_jis_2004', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py deleted file mode 100644 index 4092e41..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/shift_jisx0213.py +++ /dev/null @@ -1,39 +0,0 @@ -# -# shift_jisx0213.py: Python Unicode Codec for SHIFT_JISX0213 -# -# Written by Hye-Shik Chang -# - -import _codecs_jp, codecs -import _multibytecodec as mbc - -codec = _codecs_jp.getcodec('shift_jisx0213') - -class Codec(codecs.Codec): - encode = codec.encode - decode = codec.decode - -class IncrementalEncoder(mbc.MultibyteIncrementalEncoder, - codecs.IncrementalEncoder): - codec = codec - -class IncrementalDecoder(mbc.MultibyteIncrementalDecoder, - codecs.IncrementalDecoder): - codec = codec - -class StreamReader(Codec, mbc.MultibyteStreamReader, codecs.StreamReader): - codec = codec - -class StreamWriter(Codec, mbc.MultibyteStreamWriter, codecs.StreamWriter): - codec = codec - -def getregentry(): - return codecs.CodecInfo( - name='shift_jisx0213', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py deleted file mode 100644 index cb11794..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/string_escape.py +++ /dev/null @@ -1,38 +0,0 @@ -# -*- coding: iso-8859-1 -*- -""" Python 'escape' Codec - - -Written by Martin v. Löwis (martin@v.loewis.de). - -""" -import codecs - -class Codec(codecs.Codec): - - encode = codecs.escape_encode - decode = codecs.escape_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.escape_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.escape_decode(input, self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -def getregentry(): - return codecs.CodecInfo( - name='string-escape', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py deleted file mode 100644 index 776525e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/tis_620.py +++ /dev/null @@ -1,307 +0,0 @@ -""" Python Character Mapping Codec tis_620 generated from 'python-mappings/TIS-620.TXT' with gencodec.py. - -"""#" - -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return codecs.charmap_encode(input,errors,encoding_table) - - def decode(self,input,errors='strict'): - return codecs.charmap_decode(input,errors,decoding_table) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.charmap_encode(input,self.errors,encoding_table)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.charmap_decode(input,self.errors,decoding_table)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='tis-620', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) - - -### Decoding Table - -decoding_table = ( - u'\x00' # 0x00 -> NULL - u'\x01' # 0x01 -> START OF HEADING - u'\x02' # 0x02 -> START OF TEXT - u'\x03' # 0x03 -> END OF TEXT - u'\x04' # 0x04 -> END OF TRANSMISSION - u'\x05' # 0x05 -> ENQUIRY - u'\x06' # 0x06 -> ACKNOWLEDGE - u'\x07' # 0x07 -> BELL - u'\x08' # 0x08 -> BACKSPACE - u'\t' # 0x09 -> HORIZONTAL TABULATION - u'\n' # 0x0A -> LINE FEED - u'\x0b' # 0x0B -> VERTICAL TABULATION - u'\x0c' # 0x0C -> FORM FEED - u'\r' # 0x0D -> CARRIAGE RETURN - u'\x0e' # 0x0E -> SHIFT OUT - u'\x0f' # 0x0F -> SHIFT IN - u'\x10' # 0x10 -> DATA LINK ESCAPE - u'\x11' # 0x11 -> DEVICE CONTROL ONE - u'\x12' # 0x12 -> DEVICE CONTROL TWO - u'\x13' # 0x13 -> DEVICE CONTROL THREE - u'\x14' # 0x14 -> DEVICE CONTROL FOUR - u'\x15' # 0x15 -> NEGATIVE ACKNOWLEDGE - u'\x16' # 0x16 -> SYNCHRONOUS IDLE - u'\x17' # 0x17 -> END OF TRANSMISSION BLOCK - u'\x18' # 0x18 -> CANCEL - u'\x19' # 0x19 -> END OF MEDIUM - u'\x1a' # 0x1A -> SUBSTITUTE - u'\x1b' # 0x1B -> ESCAPE - u'\x1c' # 0x1C -> FILE SEPARATOR - u'\x1d' # 0x1D -> GROUP SEPARATOR - u'\x1e' # 0x1E -> RECORD SEPARATOR - u'\x1f' # 0x1F -> UNIT SEPARATOR - u' ' # 0x20 -> SPACE - u'!' # 0x21 -> EXCLAMATION MARK - u'"' # 0x22 -> QUOTATION MARK - u'#' # 0x23 -> NUMBER SIGN - u'$' # 0x24 -> DOLLAR SIGN - u'%' # 0x25 -> PERCENT SIGN - u'&' # 0x26 -> AMPERSAND - u"'" # 0x27 -> APOSTROPHE - u'(' # 0x28 -> LEFT PARENTHESIS - u')' # 0x29 -> RIGHT PARENTHESIS - u'*' # 0x2A -> ASTERISK - u'+' # 0x2B -> PLUS SIGN - u',' # 0x2C -> COMMA - u'-' # 0x2D -> HYPHEN-MINUS - u'.' # 0x2E -> FULL STOP - u'/' # 0x2F -> SOLIDUS - u'0' # 0x30 -> DIGIT ZERO - u'1' # 0x31 -> DIGIT ONE - u'2' # 0x32 -> DIGIT TWO - u'3' # 0x33 -> DIGIT THREE - u'4' # 0x34 -> DIGIT FOUR - u'5' # 0x35 -> DIGIT FIVE - u'6' # 0x36 -> DIGIT SIX - u'7' # 0x37 -> DIGIT SEVEN - u'8' # 0x38 -> DIGIT EIGHT - u'9' # 0x39 -> DIGIT NINE - u':' # 0x3A -> COLON - u';' # 0x3B -> SEMICOLON - u'<' # 0x3C -> LESS-THAN SIGN - u'=' # 0x3D -> EQUALS SIGN - u'>' # 0x3E -> GREATER-THAN SIGN - u'?' # 0x3F -> QUESTION MARK - u'@' # 0x40 -> COMMERCIAL AT - u'A' # 0x41 -> LATIN CAPITAL LETTER A - u'B' # 0x42 -> LATIN CAPITAL LETTER B - u'C' # 0x43 -> LATIN CAPITAL LETTER C - u'D' # 0x44 -> LATIN CAPITAL LETTER D - u'E' # 0x45 -> LATIN CAPITAL LETTER E - u'F' # 0x46 -> LATIN CAPITAL LETTER F - u'G' # 0x47 -> LATIN CAPITAL LETTER G - u'H' # 0x48 -> LATIN CAPITAL LETTER H - u'I' # 0x49 -> LATIN CAPITAL LETTER I - u'J' # 0x4A -> LATIN CAPITAL LETTER J - u'K' # 0x4B -> LATIN CAPITAL LETTER K - u'L' # 0x4C -> LATIN CAPITAL LETTER L - u'M' # 0x4D -> LATIN CAPITAL LETTER M - u'N' # 0x4E -> LATIN CAPITAL LETTER N - u'O' # 0x4F -> LATIN CAPITAL LETTER O - u'P' # 0x50 -> LATIN CAPITAL LETTER P - u'Q' # 0x51 -> LATIN CAPITAL LETTER Q - u'R' # 0x52 -> LATIN CAPITAL LETTER R - u'S' # 0x53 -> LATIN CAPITAL LETTER S - u'T' # 0x54 -> LATIN CAPITAL LETTER T - u'U' # 0x55 -> LATIN CAPITAL LETTER U - u'V' # 0x56 -> LATIN CAPITAL LETTER V - u'W' # 0x57 -> LATIN CAPITAL LETTER W - u'X' # 0x58 -> LATIN CAPITAL LETTER X - u'Y' # 0x59 -> LATIN CAPITAL LETTER Y - u'Z' # 0x5A -> LATIN CAPITAL LETTER Z - u'[' # 0x5B -> LEFT SQUARE BRACKET - u'\\' # 0x5C -> REVERSE SOLIDUS - u']' # 0x5D -> RIGHT SQUARE BRACKET - u'^' # 0x5E -> CIRCUMFLEX ACCENT - u'_' # 0x5F -> LOW LINE - u'`' # 0x60 -> GRAVE ACCENT - u'a' # 0x61 -> LATIN SMALL LETTER A - u'b' # 0x62 -> LATIN SMALL LETTER B - u'c' # 0x63 -> LATIN SMALL LETTER C - u'd' # 0x64 -> LATIN SMALL LETTER D - u'e' # 0x65 -> LATIN SMALL LETTER E - u'f' # 0x66 -> LATIN SMALL LETTER F - u'g' # 0x67 -> LATIN SMALL LETTER G - u'h' # 0x68 -> LATIN SMALL LETTER H - u'i' # 0x69 -> LATIN SMALL LETTER I - u'j' # 0x6A -> LATIN SMALL LETTER J - u'k' # 0x6B -> LATIN SMALL LETTER K - u'l' # 0x6C -> LATIN SMALL LETTER L - u'm' # 0x6D -> LATIN SMALL LETTER M - u'n' # 0x6E -> LATIN SMALL LETTER N - u'o' # 0x6F -> LATIN SMALL LETTER O - u'p' # 0x70 -> LATIN SMALL LETTER P - u'q' # 0x71 -> LATIN SMALL LETTER Q - u'r' # 0x72 -> LATIN SMALL LETTER R - u's' # 0x73 -> LATIN SMALL LETTER S - u't' # 0x74 -> LATIN SMALL LETTER T - u'u' # 0x75 -> LATIN SMALL LETTER U - u'v' # 0x76 -> LATIN SMALL LETTER V - u'w' # 0x77 -> LATIN SMALL LETTER W - u'x' # 0x78 -> LATIN SMALL LETTER X - u'y' # 0x79 -> LATIN SMALL LETTER Y - u'z' # 0x7A -> LATIN SMALL LETTER Z - u'{' # 0x7B -> LEFT CURLY BRACKET - u'|' # 0x7C -> VERTICAL LINE - u'}' # 0x7D -> RIGHT CURLY BRACKET - u'~' # 0x7E -> TILDE - u'\x7f' # 0x7F -> DELETE - u'\x80' # 0x80 -> - u'\x81' # 0x81 -> - u'\x82' # 0x82 -> - u'\x83' # 0x83 -> - u'\x84' # 0x84 -> - u'\x85' # 0x85 -> - u'\x86' # 0x86 -> - u'\x87' # 0x87 -> - u'\x88' # 0x88 -> - u'\x89' # 0x89 -> - u'\x8a' # 0x8A -> - u'\x8b' # 0x8B -> - u'\x8c' # 0x8C -> - u'\x8d' # 0x8D -> - u'\x8e' # 0x8E -> - u'\x8f' # 0x8F -> - u'\x90' # 0x90 -> - u'\x91' # 0x91 -> - u'\x92' # 0x92 -> - u'\x93' # 0x93 -> - u'\x94' # 0x94 -> - u'\x95' # 0x95 -> - u'\x96' # 0x96 -> - u'\x97' # 0x97 -> - u'\x98' # 0x98 -> - u'\x99' # 0x99 -> - u'\x9a' # 0x9A -> - u'\x9b' # 0x9B -> - u'\x9c' # 0x9C -> - u'\x9d' # 0x9D -> - u'\x9e' # 0x9E -> - u'\x9f' # 0x9F -> - u'\ufffe' - u'\u0e01' # 0xA1 -> THAI CHARACTER KO KAI - u'\u0e02' # 0xA2 -> THAI CHARACTER KHO KHAI - u'\u0e03' # 0xA3 -> THAI CHARACTER KHO KHUAT - u'\u0e04' # 0xA4 -> THAI CHARACTER KHO KHWAI - u'\u0e05' # 0xA5 -> THAI CHARACTER KHO KHON - u'\u0e06' # 0xA6 -> THAI CHARACTER KHO RAKHANG - u'\u0e07' # 0xA7 -> THAI CHARACTER NGO NGU - u'\u0e08' # 0xA8 -> THAI CHARACTER CHO CHAN - u'\u0e09' # 0xA9 -> THAI CHARACTER CHO CHING - u'\u0e0a' # 0xAA -> THAI CHARACTER CHO CHANG - u'\u0e0b' # 0xAB -> THAI CHARACTER SO SO - u'\u0e0c' # 0xAC -> THAI CHARACTER CHO CHOE - u'\u0e0d' # 0xAD -> THAI CHARACTER YO YING - u'\u0e0e' # 0xAE -> THAI CHARACTER DO CHADA - u'\u0e0f' # 0xAF -> THAI CHARACTER TO PATAK - u'\u0e10' # 0xB0 -> THAI CHARACTER THO THAN - u'\u0e11' # 0xB1 -> THAI CHARACTER THO NANGMONTHO - u'\u0e12' # 0xB2 -> THAI CHARACTER THO PHUTHAO - u'\u0e13' # 0xB3 -> THAI CHARACTER NO NEN - u'\u0e14' # 0xB4 -> THAI CHARACTER DO DEK - u'\u0e15' # 0xB5 -> THAI CHARACTER TO TAO - u'\u0e16' # 0xB6 -> THAI CHARACTER THO THUNG - u'\u0e17' # 0xB7 -> THAI CHARACTER THO THAHAN - u'\u0e18' # 0xB8 -> THAI CHARACTER THO THONG - u'\u0e19' # 0xB9 -> THAI CHARACTER NO NU - u'\u0e1a' # 0xBA -> THAI CHARACTER BO BAIMAI - u'\u0e1b' # 0xBB -> THAI CHARACTER PO PLA - u'\u0e1c' # 0xBC -> THAI CHARACTER PHO PHUNG - u'\u0e1d' # 0xBD -> THAI CHARACTER FO FA - u'\u0e1e' # 0xBE -> THAI CHARACTER PHO PHAN - u'\u0e1f' # 0xBF -> THAI CHARACTER FO FAN - u'\u0e20' # 0xC0 -> THAI CHARACTER PHO SAMPHAO - u'\u0e21' # 0xC1 -> THAI CHARACTER MO MA - u'\u0e22' # 0xC2 -> THAI CHARACTER YO YAK - u'\u0e23' # 0xC3 -> THAI CHARACTER RO RUA - u'\u0e24' # 0xC4 -> THAI CHARACTER RU - u'\u0e25' # 0xC5 -> THAI CHARACTER LO LING - u'\u0e26' # 0xC6 -> THAI CHARACTER LU - u'\u0e27' # 0xC7 -> THAI CHARACTER WO WAEN - u'\u0e28' # 0xC8 -> THAI CHARACTER SO SALA - u'\u0e29' # 0xC9 -> THAI CHARACTER SO RUSI - u'\u0e2a' # 0xCA -> THAI CHARACTER SO SUA - u'\u0e2b' # 0xCB -> THAI CHARACTER HO HIP - u'\u0e2c' # 0xCC -> THAI CHARACTER LO CHULA - u'\u0e2d' # 0xCD -> THAI CHARACTER O ANG - u'\u0e2e' # 0xCE -> THAI CHARACTER HO NOKHUK - u'\u0e2f' # 0xCF -> THAI CHARACTER PAIYANNOI - u'\u0e30' # 0xD0 -> THAI CHARACTER SARA A - u'\u0e31' # 0xD1 -> THAI CHARACTER MAI HAN-AKAT - u'\u0e32' # 0xD2 -> THAI CHARACTER SARA AA - u'\u0e33' # 0xD3 -> THAI CHARACTER SARA AM - u'\u0e34' # 0xD4 -> THAI CHARACTER SARA I - u'\u0e35' # 0xD5 -> THAI CHARACTER SARA II - u'\u0e36' # 0xD6 -> THAI CHARACTER SARA UE - u'\u0e37' # 0xD7 -> THAI CHARACTER SARA UEE - u'\u0e38' # 0xD8 -> THAI CHARACTER SARA U - u'\u0e39' # 0xD9 -> THAI CHARACTER SARA UU - u'\u0e3a' # 0xDA -> THAI CHARACTER PHINTHU - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\u0e3f' # 0xDF -> THAI CURRENCY SYMBOL BAHT - u'\u0e40' # 0xE0 -> THAI CHARACTER SARA E - u'\u0e41' # 0xE1 -> THAI CHARACTER SARA AE - u'\u0e42' # 0xE2 -> THAI CHARACTER SARA O - u'\u0e43' # 0xE3 -> THAI CHARACTER SARA AI MAIMUAN - u'\u0e44' # 0xE4 -> THAI CHARACTER SARA AI MAIMALAI - u'\u0e45' # 0xE5 -> THAI CHARACTER LAKKHANGYAO - u'\u0e46' # 0xE6 -> THAI CHARACTER MAIYAMOK - u'\u0e47' # 0xE7 -> THAI CHARACTER MAITAIKHU - u'\u0e48' # 0xE8 -> THAI CHARACTER MAI EK - u'\u0e49' # 0xE9 -> THAI CHARACTER MAI THO - u'\u0e4a' # 0xEA -> THAI CHARACTER MAI TRI - u'\u0e4b' # 0xEB -> THAI CHARACTER MAI CHATTAWA - u'\u0e4c' # 0xEC -> THAI CHARACTER THANTHAKHAT - u'\u0e4d' # 0xED -> THAI CHARACTER NIKHAHIT - u'\u0e4e' # 0xEE -> THAI CHARACTER YAMAKKAN - u'\u0e4f' # 0xEF -> THAI CHARACTER FONGMAN - u'\u0e50' # 0xF0 -> THAI DIGIT ZERO - u'\u0e51' # 0xF1 -> THAI DIGIT ONE - u'\u0e52' # 0xF2 -> THAI DIGIT TWO - u'\u0e53' # 0xF3 -> THAI DIGIT THREE - u'\u0e54' # 0xF4 -> THAI DIGIT FOUR - u'\u0e55' # 0xF5 -> THAI DIGIT FIVE - u'\u0e56' # 0xF6 -> THAI DIGIT SIX - u'\u0e57' # 0xF7 -> THAI DIGIT SEVEN - u'\u0e58' # 0xF8 -> THAI DIGIT EIGHT - u'\u0e59' # 0xF9 -> THAI DIGIT NINE - u'\u0e5a' # 0xFA -> THAI CHARACTER ANGKHANKHU - u'\u0e5b' # 0xFB -> THAI CHARACTER KHOMUT - u'\ufffe' - u'\ufffe' - u'\ufffe' - u'\ufffe' -) - -### Encoding table -encoding_table=codecs.charmap_build(decoding_table) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py deleted file mode 100644 index a077fd6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/undefined.py +++ /dev/null @@ -1,49 +0,0 @@ -""" Python 'undefined' Codec - - This codec will always raise a ValueError exception when being - used. It is intended for use by the site.py file to switch off - automatic string to Unicode coercion. - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - raise UnicodeError("undefined encoding") - - def decode(self,input,errors='strict'): - raise UnicodeError("undefined encoding") - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - raise UnicodeError("undefined encoding") - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - raise UnicodeError("undefined encoding") - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='undefined', - encode=Codec().encode, - decode=Codec().decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py deleted file mode 100644 index 3b77cda..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_escape.py +++ /dev/null @@ -1,45 +0,0 @@ -""" Python 'unicode-escape' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - # Note: Binding these as C functions will result in the class not - # converting them to methods. This is intended. - encode = codecs.unicode_escape_encode - decode = codecs.unicode_escape_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.unicode_escape_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.unicode_escape_decode(input, self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='unicode-escape', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py deleted file mode 100644 index 0803e7b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/unicode_internal.py +++ /dev/null @@ -1,45 +0,0 @@ -""" Python 'unicode-internal' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -class Codec(codecs.Codec): - - # Note: Binding these as C functions will result in the class not - # converting them to methods. This is intended. - encode = codecs.unicode_internal_encode - decode = codecs.unicode_internal_decode - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.unicode_internal_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return codecs.unicode_internal_decode(input, self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='unicode-internal', - encode=Codec.encode, - decode=Codec.decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamwriter=StreamWriter, - streamreader=StreamReader, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py deleted file mode 100644 index 566bcc7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16.py +++ /dev/null @@ -1,126 +0,0 @@ -""" Python 'utf-16' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs, sys - -### Codec APIs - -encode = codecs.utf_16_encode - -def decode(input, errors='strict'): - return codecs.utf_16_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors='strict'): - codecs.IncrementalEncoder.__init__(self, errors) - self.encoder = None - - def encode(self, input, final=False): - if self.encoder is None: - result = codecs.utf_16_encode(input, self.errors)[0] - if sys.byteorder == 'little': - self.encoder = codecs.utf_16_le_encode - else: - self.encoder = codecs.utf_16_be_encode - return result - return self.encoder(input, self.errors)[0] - - def reset(self): - codecs.IncrementalEncoder.reset(self) - self.encoder = None - - def getstate(self): - # state info we return to the caller: - # 0: stream is in natural order for this platform - # 2: endianness hasn't been determined yet - # (we're never writing in unnatural order) - return (2 if self.encoder is None else 0) - - def setstate(self, state): - if state: - self.encoder = None - else: - if sys.byteorder == 'little': - self.encoder = codecs.utf_16_le_encode - else: - self.encoder = codecs.utf_16_be_encode - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def __init__(self, errors='strict'): - codecs.BufferedIncrementalDecoder.__init__(self, errors) - self.decoder = None - - def _buffer_decode(self, input, errors, final): - if self.decoder is None: - (output, consumed, byteorder) = \ - codecs.utf_16_ex_decode(input, errors, 0, final) - if byteorder == -1: - self.decoder = codecs.utf_16_le_decode - elif byteorder == 1: - self.decoder = codecs.utf_16_be_decode - elif consumed >= 2: - raise UnicodeError("UTF-16 stream does not start with BOM") - return (output, consumed) - return self.decoder(input, self.errors, final) - - def reset(self): - codecs.BufferedIncrementalDecoder.reset(self) - self.decoder = None - -class StreamWriter(codecs.StreamWriter): - def __init__(self, stream, errors='strict'): - codecs.StreamWriter.__init__(self, stream, errors) - self.encoder = None - - def reset(self): - codecs.StreamWriter.reset(self) - self.encoder = None - - def encode(self, input, errors='strict'): - if self.encoder is None: - result = codecs.utf_16_encode(input, errors) - if sys.byteorder == 'little': - self.encoder = codecs.utf_16_le_encode - else: - self.encoder = codecs.utf_16_be_encode - return result - else: - return self.encoder(input, errors) - -class StreamReader(codecs.StreamReader): - - def reset(self): - codecs.StreamReader.reset(self) - try: - del self.decode - except AttributeError: - pass - - def decode(self, input, errors='strict'): - (object, consumed, byteorder) = \ - codecs.utf_16_ex_decode(input, errors, 0, False) - if byteorder == -1: - self.decode = codecs.utf_16_le_decode - elif byteorder == 1: - self.decode = codecs.utf_16_be_decode - elif consumed>=2: - raise UnicodeError,"UTF-16 stream does not start with BOM" - return (object, consumed) - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-16', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py deleted file mode 100644 index 780c499..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_be.py +++ /dev/null @@ -1,42 +0,0 @@ -""" Python 'utf-16-be' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -encode = codecs.utf_16_be_encode - -def decode(input, errors='strict'): - return codecs.utf_16_be_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.utf_16_be_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = codecs.utf_16_be_decode - -class StreamWriter(codecs.StreamWriter): - encode = codecs.utf_16_be_encode - -class StreamReader(codecs.StreamReader): - decode = codecs.utf_16_be_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-16-be', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py deleted file mode 100644 index 3964124..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_16_le.py +++ /dev/null @@ -1,42 +0,0 @@ -""" Python 'utf-16-le' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -encode = codecs.utf_16_le_encode - -def decode(input, errors='strict'): - return codecs.utf_16_le_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.utf_16_le_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = codecs.utf_16_le_decode - -class StreamWriter(codecs.StreamWriter): - encode = codecs.utf_16_le_encode - -class StreamReader(codecs.StreamReader): - decode = codecs.utf_16_le_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-16-le', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py deleted file mode 100644 index 9d836ea..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32.py +++ /dev/null @@ -1,150 +0,0 @@ -""" -Python 'utf-32' Codec -""" -import codecs, sys - -### Codec APIs - -encode = codecs.utf_32_encode - -def decode(input, errors='strict'): - return codecs.utf_32_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors='strict'): - codecs.IncrementalEncoder.__init__(self, errors) - self.encoder = None - - def encode(self, input, final=False): - if self.encoder is None: - result = codecs.utf_32_encode(input, self.errors)[0] - if sys.byteorder == 'little': - self.encoder = codecs.utf_32_le_encode - else: - self.encoder = codecs.utf_32_be_encode - return result - return self.encoder(input, self.errors)[0] - - def reset(self): - codecs.IncrementalEncoder.reset(self) - self.encoder = None - - def getstate(self): - # state info we return to the caller: - # 0: stream is in natural order for this platform - # 2: endianness hasn't been determined yet - # (we're never writing in unnatural order) - return (2 if self.encoder is None else 0) - - def setstate(self, state): - if state: - self.encoder = None - else: - if sys.byteorder == 'little': - self.encoder = codecs.utf_32_le_encode - else: - self.encoder = codecs.utf_32_be_encode - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def __init__(self, errors='strict'): - codecs.BufferedIncrementalDecoder.__init__(self, errors) - self.decoder = None - - def _buffer_decode(self, input, errors, final): - if self.decoder is None: - (output, consumed, byteorder) = \ - codecs.utf_32_ex_decode(input, errors, 0, final) - if byteorder == -1: - self.decoder = codecs.utf_32_le_decode - elif byteorder == 1: - self.decoder = codecs.utf_32_be_decode - elif consumed >= 4: - raise UnicodeError("UTF-32 stream does not start with BOM") - return (output, consumed) - return self.decoder(input, self.errors, final) - - def reset(self): - codecs.BufferedIncrementalDecoder.reset(self) - self.decoder = None - - def getstate(self): - # additonal state info from the base class must be None here, - # as it isn't passed along to the caller - state = codecs.BufferedIncrementalDecoder.getstate(self)[0] - # additional state info we pass to the caller: - # 0: stream is in natural order for this platform - # 1: stream is in unnatural order - # 2: endianness hasn't been determined yet - if self.decoder is None: - return (state, 2) - addstate = int((sys.byteorder == "big") != - (self.decoder is codecs.utf_32_be_decode)) - return (state, addstate) - - def setstate(self, state): - # state[1] will be ignored by BufferedIncrementalDecoder.setstate() - codecs.BufferedIncrementalDecoder.setstate(self, state) - state = state[1] - if state == 0: - self.decoder = (codecs.utf_32_be_decode - if sys.byteorder == "big" - else codecs.utf_32_le_decode) - elif state == 1: - self.decoder = (codecs.utf_32_le_decode - if sys.byteorder == "big" - else codecs.utf_32_be_decode) - else: - self.decoder = None - -class StreamWriter(codecs.StreamWriter): - def __init__(self, stream, errors='strict'): - self.encoder = None - codecs.StreamWriter.__init__(self, stream, errors) - - def reset(self): - codecs.StreamWriter.reset(self) - self.encoder = None - - def encode(self, input, errors='strict'): - if self.encoder is None: - result = codecs.utf_32_encode(input, errors) - if sys.byteorder == 'little': - self.encoder = codecs.utf_32_le_encode - else: - self.encoder = codecs.utf_32_be_encode - return result - else: - return self.encoder(input, errors) - -class StreamReader(codecs.StreamReader): - - def reset(self): - codecs.StreamReader.reset(self) - try: - del self.decode - except AttributeError: - pass - - def decode(self, input, errors='strict'): - (object, consumed, byteorder) = \ - codecs.utf_32_ex_decode(input, errors, 0, False) - if byteorder == -1: - self.decode = codecs.utf_32_le_decode - elif byteorder == 1: - self.decode = codecs.utf_32_be_decode - elif consumed>=4: - raise UnicodeError,"UTF-32 stream does not start with BOM" - return (object, consumed) - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-32', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py deleted file mode 100644 index f7c4b87..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_be.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Python 'utf-32-be' Codec -""" -import codecs - -### Codec APIs - -encode = codecs.utf_32_be_encode - -def decode(input, errors='strict'): - return codecs.utf_32_be_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.utf_32_be_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = codecs.utf_32_be_decode - -class StreamWriter(codecs.StreamWriter): - encode = codecs.utf_32_be_encode - -class StreamReader(codecs.StreamReader): - decode = codecs.utf_32_be_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-32-be', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py deleted file mode 100644 index 4346a12..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_32_le.py +++ /dev/null @@ -1,37 +0,0 @@ -""" -Python 'utf-32-le' Codec -""" -import codecs - -### Codec APIs - -encode = codecs.utf_32_le_encode - -def decode(input, errors='strict'): - return codecs.utf_32_le_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.utf_32_le_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = codecs.utf_32_le_decode - -class StreamWriter(codecs.StreamWriter): - encode = codecs.utf_32_le_encode - -class StreamReader(codecs.StreamReader): - decode = codecs.utf_32_le_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-32-le', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py deleted file mode 100644 index 6c30538..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_7.py +++ /dev/null @@ -1,38 +0,0 @@ -""" Python 'utf-7' Codec - -Written by Brian Quinlan (brian@sweetapp.com). -""" -import codecs - -### Codec APIs - -encode = codecs.utf_7_encode - -def decode(input, errors='strict'): - return codecs.utf_7_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.utf_7_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = codecs.utf_7_decode - -class StreamWriter(codecs.StreamWriter): - encode = codecs.utf_7_encode - -class StreamReader(codecs.StreamReader): - decode = codecs.utf_7_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-7', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py deleted file mode 100644 index cc118ac..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8.py +++ /dev/null @@ -1,42 +0,0 @@ -""" Python 'utf-8' Codec - - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -(c) Copyright CNRI, All Rights Reserved. NO WARRANTY. - -""" -import codecs - -### Codec APIs - -encode = codecs.utf_8_encode - -def decode(input, errors='strict'): - return codecs.utf_8_decode(input, errors, True) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return codecs.utf_8_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - _buffer_decode = codecs.utf_8_decode - -class StreamWriter(codecs.StreamWriter): - encode = codecs.utf_8_encode - -class StreamReader(codecs.StreamReader): - decode = codecs.utf_8_decode - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-8', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py deleted file mode 100644 index 8cafef7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/utf_8_sig.py +++ /dev/null @@ -1,117 +0,0 @@ -""" Python 'utf-8-sig' Codec -This work similar to UTF-8 with the following changes: - -* On encoding/writing a UTF-8 encoded BOM will be prepended/written as the - first three bytes. - -* On decoding/reading if the first three bytes are a UTF-8 encoded BOM, these - bytes will be skipped. -""" -import codecs - -### Codec APIs - -def encode(input, errors='strict'): - return (codecs.BOM_UTF8 + codecs.utf_8_encode(input, errors)[0], len(input)) - -def decode(input, errors='strict'): - prefix = 0 - if input[:3] == codecs.BOM_UTF8: - input = input[3:] - prefix = 3 - (output, consumed) = codecs.utf_8_decode(input, errors, True) - return (output, consumed+prefix) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors='strict'): - codecs.IncrementalEncoder.__init__(self, errors) - self.first = 1 - - def encode(self, input, final=False): - if self.first: - self.first = 0 - return codecs.BOM_UTF8 + codecs.utf_8_encode(input, self.errors)[0] - else: - return codecs.utf_8_encode(input, self.errors)[0] - - def reset(self): - codecs.IncrementalEncoder.reset(self) - self.first = 1 - - def getstate(self): - return self.first - - def setstate(self, state): - self.first = state - -class IncrementalDecoder(codecs.BufferedIncrementalDecoder): - def __init__(self, errors='strict'): - codecs.BufferedIncrementalDecoder.__init__(self, errors) - self.first = True - - def _buffer_decode(self, input, errors, final): - if self.first: - if len(input) < 3: - if codecs.BOM_UTF8.startswith(input): - # not enough data to decide if this really is a BOM - # => try again on the next call - return (u"", 0) - else: - self.first = None - else: - self.first = None - if input[:3] == codecs.BOM_UTF8: - (output, consumed) = codecs.utf_8_decode(input[3:], errors, final) - return (output, consumed+3) - return codecs.utf_8_decode(input, errors, final) - - def reset(self): - codecs.BufferedIncrementalDecoder.reset(self) - self.first = True - -class StreamWriter(codecs.StreamWriter): - def reset(self): - codecs.StreamWriter.reset(self) - try: - del self.encode - except AttributeError: - pass - - def encode(self, input, errors='strict'): - self.encode = codecs.utf_8_encode - return encode(input, errors) - -class StreamReader(codecs.StreamReader): - def reset(self): - codecs.StreamReader.reset(self) - try: - del self.decode - except AttributeError: - pass - - def decode(self, input, errors='strict'): - if len(input) < 3: - if codecs.BOM_UTF8.startswith(input): - # not enough data to decide if this is a BOM - # => try again on the next call - return (u"", 0) - elif input[:3] == codecs.BOM_UTF8: - self.decode = codecs.utf_8_decode - (output, consumed) = codecs.utf_8_decode(input[3:],errors) - return (output, consumed+3) - # (else) no BOM present - self.decode = codecs.utf_8_decode - return codecs.utf_8_decode(input, errors) - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='utf-8-sig', - encode=encode, - decode=decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py deleted file mode 100644 index 71ac65b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/uu_codec.py +++ /dev/null @@ -1,129 +0,0 @@ -""" Python 'uu_codec' Codec - UU content transfer encoding - - Unlike most of the other codecs which target Unicode, this codec - will return Python string objects for both encode and decode. - - Written by Marc-Andre Lemburg (mal@lemburg.com). Some details were - adapted from uu.py which was written by Lance Ellinghouse and - modified by Jack Jansen and Fredrik Lundh. - -""" -import codecs, binascii - -### Codec APIs - -def uu_encode(input,errors='strict',filename='',mode=0666): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - from cStringIO import StringIO - from binascii import b2a_uu - # using str() because of cStringIO's Unicode undesired Unicode behavior. - infile = StringIO(str(input)) - outfile = StringIO() - read = infile.read - write = outfile.write - - # Encode - write('begin %o %s\n' % (mode & 0777, filename)) - chunk = read(45) - while chunk: - write(b2a_uu(chunk)) - chunk = read(45) - write(' \nend\n') - - return (outfile.getvalue(), len(input)) - -def uu_decode(input,errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - Note: filename and file mode information in the input data is - ignored. - - """ - assert errors == 'strict' - from cStringIO import StringIO - from binascii import a2b_uu - infile = StringIO(str(input)) - outfile = StringIO() - readline = infile.readline - write = outfile.write - - # Find start of encoded data - while 1: - s = readline() - if not s: - raise ValueError, 'Missing "begin" line in input data' - if s[:5] == 'begin': - break - - # Decode - while 1: - s = readline() - if not s or \ - s == 'end\n': - break - try: - data = a2b_uu(s) - except binascii.Error, v: - # Workaround for broken uuencoders by /Fredrik Lundh - nbytes = (((ord(s[0])-32) & 63) * 4 + 5) // 3 - data = a2b_uu(s[:nbytes]) - #sys.stderr.write("Warning: %s\n" % str(v)) - write(data) - if not s: - raise ValueError, 'Truncated input data' - - return (outfile.getvalue(), len(input)) - -class Codec(codecs.Codec): - - def encode(self,input,errors='strict'): - return uu_encode(input,errors) - - def decode(self,input,errors='strict'): - return uu_decode(input,errors) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def encode(self, input, final=False): - return uu_encode(input, self.errors)[0] - -class IncrementalDecoder(codecs.IncrementalDecoder): - def decode(self, input, final=False): - return uu_decode(input, self.errors)[0] - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='uu', - encode=uu_encode, - decode=uu_decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py deleted file mode 100644 index 82557d0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/encodings/zlib_codec.py +++ /dev/null @@ -1,102 +0,0 @@ -""" Python 'zlib_codec' Codec - zlib compression encoding - - Unlike most of the other codecs which target Unicode, this codec - will return Python string objects for both encode and decode. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - -""" -import codecs -import zlib # this codec needs the optional zlib module ! - -### Codec APIs - -def zlib_encode(input,errors='strict'): - - """ Encodes the object input and returns a tuple (output - object, length consumed). - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = zlib.compress(input) - return (output, len(input)) - -def zlib_decode(input,errors='strict'): - - """ Decodes the object input and returns a tuple (output - object, length consumed). - - input must be an object which provides the bf_getreadbuf - buffer slot. Python strings, buffer objects and memory - mapped files are examples of objects providing this slot. - - errors defines the error handling to apply. It defaults to - 'strict' handling which is the only currently supported - error handling for this codec. - - """ - assert errors == 'strict' - output = zlib.decompress(input) - return (output, len(input)) - -class Codec(codecs.Codec): - - def encode(self, input, errors='strict'): - return zlib_encode(input, errors) - def decode(self, input, errors='strict'): - return zlib_decode(input, errors) - -class IncrementalEncoder(codecs.IncrementalEncoder): - def __init__(self, errors='strict'): - assert errors == 'strict' - self.errors = errors - self.compressobj = zlib.compressobj() - - def encode(self, input, final=False): - if final: - c = self.compressobj.compress(input) - return c + self.compressobj.flush() - else: - return self.compressobj.compress(input) - - def reset(self): - self.compressobj = zlib.compressobj() - -class IncrementalDecoder(codecs.IncrementalDecoder): - def __init__(self, errors='strict'): - assert errors == 'strict' - self.errors = errors - self.decompressobj = zlib.decompressobj() - - def decode(self, input, final=False): - if final: - c = self.decompressobj.decompress(input) - return c + self.decompressobj.flush() - else: - return self.decompressobj.decompress(input) - - def reset(self): - self.decompressobj = zlib.decompressobj() - -class StreamWriter(Codec,codecs.StreamWriter): - pass - -class StreamReader(Codec,codecs.StreamReader): - pass - -### encodings module API - -def getregentry(): - return codecs.CodecInfo( - name='zlib', - encode=zlib_encode, - decode=zlib_decode, - incrementalencoder=IncrementalEncoder, - incrementaldecoder=IncrementalDecoder, - streamreader=StreamReader, - streamwriter=StreamWriter, - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py deleted file mode 100644 index 221c507..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/fileinput.py +++ /dev/null @@ -1,417 +0,0 @@ -"""Helper class to quickly write a loop over all standard input files. - -Typical use is: - - import fileinput - for line in fileinput.input(): - process(line) - -This iterates over the lines of all files listed in sys.argv[1:], -defaulting to sys.stdin if the list is empty. If a filename is '-' it -is also replaced by sys.stdin. To specify an alternative list of -filenames, pass it as the argument to input(). A single file name is -also allowed. - -Functions filename(), lineno() return the filename and cumulative line -number of the line that has just been read; filelineno() returns its -line number in the current file; isfirstline() returns true iff the -line just read is the first line of its file; isstdin() returns true -iff the line was read from sys.stdin. Function nextfile() closes the -current file so that the next iteration will read the first line from -the next file (if any); lines not read from the file will not count -towards the cumulative line count; the filename is not changed until -after the first line of the next file has been read. Function close() -closes the sequence. - -Before any lines have been read, filename() returns None and both line -numbers are zero; nextfile() has no effect. After all lines have been -read, filename() and the line number functions return the values -pertaining to the last line read; nextfile() has no effect. - -All files are opened in text mode by default, you can override this by -setting the mode parameter to input() or FileInput.__init__(). -If an I/O error occurs during opening or reading a file, the IOError -exception is raised. - -If sys.stdin is used more than once, the second and further use will -return no lines, except perhaps for interactive use, or if it has been -explicitly reset (e.g. using sys.stdin.seek(0)). - -Empty files are opened and immediately closed; the only time their -presence in the list of filenames is noticeable at all is when the -last file opened is empty. - -It is possible that the last line of a file doesn't end in a newline -character; otherwise lines are returned including the trailing -newline. - -Class FileInput is the implementation; its methods filename(), -lineno(), fileline(), isfirstline(), isstdin(), nextfile() and close() -correspond to the functions in the module. In addition it has a -readline() method which returns the next input line, and a -__getitem__() method which implements the sequence behavior. The -sequence must be accessed in strictly sequential order; sequence -access and readline() cannot be mixed. - -Optional in-place filtering: if the keyword argument inplace=1 is -passed to input() or to the FileInput constructor, the file is moved -to a backup file and standard output is directed to the input file. -This makes it possible to write a filter that rewrites its input file -in place. If the keyword argument backup="." is also -given, it specifies the extension for the backup file, and the backup -file remains around; by default, the extension is ".bak" and it is -deleted when the output file is closed. In-place filtering is -disabled when standard input is read. XXX The current implementation -does not work for MS-DOS 8+3 filesystems. - -Performance: this module is unfortunately one of the slower ways of -processing large numbers of input lines. Nevertheless, a significant -speed-up has been obtained by using readlines(bufsize) instead of -readline(). A new keyword argument, bufsize=N, is present on the -input() function and the FileInput() class to override the default -buffer size. - -XXX Possible additions: - -- optional getopt argument processing -- isatty() -- read(), read(size), even readlines() - -""" - -import sys, os - -__all__ = ["input","close","nextfile","filename","lineno","filelineno", - "isfirstline","isstdin","FileInput"] - -_state = None - -DEFAULT_BUFSIZE = 8*1024 - -def input(files=None, inplace=0, backup="", bufsize=0, - mode="r", openhook=None): - """Return an instance of the FileInput class, which can be iterated. - - The parameters are passed to the constructor of the FileInput class. - The returned instance, in addition to being an iterator, - keeps global state for the functions of this module,. - """ - global _state - if _state and _state._file: - raise RuntimeError, "input() already active" - _state = FileInput(files, inplace, backup, bufsize, mode, openhook) - return _state - -def close(): - """Close the sequence.""" - global _state - state = _state - _state = None - if state: - state.close() - -def nextfile(): - """ - Close the current file so that the next iteration will read the first - line from the next file (if any); lines not read from the file will - not count towards the cumulative line count. The filename is not - changed until after the first line of the next file has been read. - Before the first line has been read, this function has no effect; - it cannot be used to skip the first file. After the last line of the - last file has been read, this function has no effect. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.nextfile() - -def filename(): - """ - Return the name of the file currently being read. - Before the first line has been read, returns None. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.filename() - -def lineno(): - """ - Return the cumulative line number of the line that has just been read. - Before the first line has been read, returns 0. After the last line - of the last file has been read, returns the line number of that line. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.lineno() - -def filelineno(): - """ - Return the line number in the current file. Before the first line - has been read, returns 0. After the last line of the last file has - been read, returns the line number of that line within the file. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.filelineno() - -def fileno(): - """ - Return the file number of the current file. When no file is currently - opened, returns -1. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.fileno() - -def isfirstline(): - """ - Returns true the line just read is the first line of its file, - otherwise returns false. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.isfirstline() - -def isstdin(): - """ - Returns true if the last line was read from sys.stdin, - otherwise returns false. - """ - if not _state: - raise RuntimeError, "no active input()" - return _state.isstdin() - -class FileInput: - """FileInput([files[, inplace[, backup[, bufsize[, mode[, openhook]]]]]]) - - Class FileInput is the implementation of the module; its methods - filename(), lineno(), fileline(), isfirstline(), isstdin(), fileno(), - nextfile() and close() correspond to the functions of the same name - in the module. - In addition it has a readline() method which returns the next - input line, and a __getitem__() method which implements the - sequence behavior. The sequence must be accessed in strictly - sequential order; random access and readline() cannot be mixed. - """ - - def __init__(self, files=None, inplace=0, backup="", bufsize=0, - mode="r", openhook=None): - if isinstance(files, basestring): - files = (files,) - else: - if files is None: - files = sys.argv[1:] - if not files: - files = ('-',) - else: - files = tuple(files) - self._files = files - self._inplace = inplace - self._backup = backup - self._bufsize = bufsize or DEFAULT_BUFSIZE - self._savestdout = None - self._output = None - self._filename = None - self._lineno = 0 - self._filelineno = 0 - self._file = None - self._isstdin = False - self._backupfilename = None - self._buffer = [] - self._bufindex = 0 - # restrict mode argument to reading modes - if mode not in ('r', 'rU', 'U', 'rb'): - raise ValueError("FileInput opening mode must be one of " - "'r', 'rU', 'U' and 'rb'") - self._mode = mode - if inplace and openhook: - raise ValueError("FileInput cannot use an opening hook in inplace mode") - elif openhook and not hasattr(openhook, '__call__'): - raise ValueError("FileInput openhook must be callable") - self._openhook = openhook - - def __del__(self): - self.close() - - def close(self): - try: - self.nextfile() - finally: - self._files = () - - def __iter__(self): - return self - - def next(self): - try: - line = self._buffer[self._bufindex] - except IndexError: - pass - else: - self._bufindex += 1 - self._lineno += 1 - self._filelineno += 1 - return line - line = self.readline() - if not line: - raise StopIteration - return line - - def __getitem__(self, i): - if i != self._lineno: - raise RuntimeError, "accessing lines out of order" - try: - return self.next() - except StopIteration: - raise IndexError, "end of input reached" - - def nextfile(self): - savestdout = self._savestdout - self._savestdout = 0 - if savestdout: - sys.stdout = savestdout - - output = self._output - self._output = 0 - try: - if output: - output.close() - finally: - file = self._file - self._file = 0 - try: - if file and not self._isstdin: - file.close() - finally: - backupfilename = self._backupfilename - self._backupfilename = 0 - if backupfilename and not self._backup: - try: os.unlink(backupfilename) - except OSError: pass - - self._isstdin = False - self._buffer = [] - self._bufindex = 0 - - def readline(self): - try: - line = self._buffer[self._bufindex] - except IndexError: - pass - else: - self._bufindex += 1 - self._lineno += 1 - self._filelineno += 1 - return line - if not self._file: - if not self._files: - return "" - self._filename = self._files[0] - self._files = self._files[1:] - self._filelineno = 0 - self._file = None - self._isstdin = False - self._backupfilename = 0 - if self._filename == '-': - self._filename = '' - self._file = sys.stdin - self._isstdin = True - else: - if self._inplace: - self._backupfilename = ( - self._filename + (self._backup or os.extsep+"bak")) - try: os.unlink(self._backupfilename) - except os.error: pass - # The next few lines may raise IOError - os.rename(self._filename, self._backupfilename) - self._file = open(self._backupfilename, self._mode) - try: - perm = os.fstat(self._file.fileno()).st_mode - except OSError: - self._output = open(self._filename, "w") - else: - fd = os.open(self._filename, - os.O_CREAT | os.O_WRONLY | os.O_TRUNC, - perm) - self._output = os.fdopen(fd, "w") - try: - if hasattr(os, 'chmod'): - os.chmod(self._filename, perm) - except OSError: - pass - self._savestdout = sys.stdout - sys.stdout = self._output - else: - # This may raise IOError - if self._openhook: - self._file = self._openhook(self._filename, self._mode) - else: - self._file = open(self._filename, self._mode) - self._buffer = self._file.readlines(self._bufsize) - self._bufindex = 0 - if not self._buffer: - self.nextfile() - # Recursive call - return self.readline() - - def filename(self): - return self._filename - - def lineno(self): - return self._lineno - - def filelineno(self): - return self._filelineno - - def fileno(self): - if self._file: - try: - return self._file.fileno() - except ValueError: - return -1 - else: - return -1 - - def isfirstline(self): - return self._filelineno == 1 - - def isstdin(self): - return self._isstdin - - -def hook_compressed(filename, mode): - ext = os.path.splitext(filename)[1] - if ext == '.gz': - import gzip - return gzip.open(filename, mode) - elif ext == '.bz2': - import bz2 - return bz2.BZ2File(filename, mode) - else: - return open(filename, mode) - - -def hook_encoded(encoding): - import io - def openhook(filename, mode): - mode = mode.replace('U', '').replace('b', '') or 'r' - return io.open(filename, mode, encoding=encoding, newline='') - return openhook - - -def _test(): - import getopt - inplace = 0 - backup = 0 - opts, args = getopt.getopt(sys.argv[1:], "ib:") - for o, a in opts: - if o == '-i': inplace = 1 - if o == '-b': backup = a - for line in input(args, inplace=inplace, backup=backup): - if line[-1:] == '\n': line = line[:-1] - if line[-1:] == '\r': line = line[:-1] - print "%d: %s[%d]%s %s" % (lineno(), filename(), filelineno(), - isfirstline() and "*" or "", line) - print "%d: %s[%d]" % (lineno(), filename(), filelineno()) - -if __name__ == '__main__': - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py deleted file mode 100644 index 2a03be9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/fnmatch.py +++ /dev/null @@ -1,120 +0,0 @@ -"""Filename matching with shell patterns. - -fnmatch(FILENAME, PATTERN) matches according to the local convention. -fnmatchcase(FILENAME, PATTERN) always takes case in account. - -The functions operate by translating the pattern into a regular -expression. They cache the compiled regular expressions for speed. - -The function translate(PATTERN) returns a regular expression -corresponding to PATTERN. (It does not compile it.) -""" - -import re - -__all__ = ["filter", "fnmatch", "fnmatchcase", "translate"] - -_cache = {} -_MAXCACHE = 100 - -def _purge(): - """Clear the pattern cache""" - _cache.clear() - -def fnmatch(name, pat): - """Test whether FILENAME matches PATTERN. - - Patterns are Unix shell style: - - * matches everything - ? matches any single character - [seq] matches any character in seq - [!seq] matches any char not in seq - - An initial period in FILENAME is not special. - Both FILENAME and PATTERN are first case-normalized - if the operating system requires it. - If you don't want this, use fnmatchcase(FILENAME, PATTERN). - """ - - import os - name = os.path.normcase(name) - pat = os.path.normcase(pat) - return fnmatchcase(name, pat) - -def filter(names, pat): - """Return the subset of the list NAMES that match PAT""" - import os,posixpath - result=[] - pat=os.path.normcase(pat) - try: - re_pat = _cache[pat] - except KeyError: - res = translate(pat) - if len(_cache) >= _MAXCACHE: - _cache.clear() - _cache[pat] = re_pat = re.compile(res) - match = re_pat.match - if os.path is posixpath: - # normcase on posix is NOP. Optimize it away from the loop. - for name in names: - if match(name): - result.append(name) - else: - for name in names: - if match(os.path.normcase(name)): - result.append(name) - return result - -def fnmatchcase(name, pat): - """Test whether FILENAME matches PATTERN, including case. - - This is a version of fnmatch() which doesn't case-normalize - its arguments. - """ - - try: - re_pat = _cache[pat] - except KeyError: - res = translate(pat) - if len(_cache) >= _MAXCACHE: - _cache.clear() - _cache[pat] = re_pat = re.compile(res) - return re_pat.match(name) is not None - -def translate(pat): - """Translate a shell PATTERN to a regular expression. - - There is no way to quote meta-characters. - """ - - i, n = 0, len(pat) - res = '' - while i < n: - c = pat[i] - i = i+1 - if c == '*': - res = res + '.*' - elif c == '?': - res = res + '.' - elif c == '[': - j = i - if j < n and pat[j] == '!': - j = j+1 - if j < n and pat[j] == ']': - j = j+1 - while j < n and pat[j] != ']': - j = j+1 - if j >= n: - res = res + '\\[' - else: - stuff = pat[i:j].replace('\\','\\\\') - i = j+1 - if stuff[0] == '!': - stuff = '^' + stuff[1:] - elif stuff[0] == '^': - stuff = '\\' + stuff - res = '%s[%s]' % (res, stuff) - else: - res = res + re.escape(c) - return res + '\Z(?ms)' diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py deleted file mode 100644 index 8413f8c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/formatter.py +++ /dev/null @@ -1,445 +0,0 @@ -"""Generic output formatting. - -Formatter objects transform an abstract flow of formatting events into -specific output events on writer objects. Formatters manage several stack -structures to allow various properties of a writer object to be changed and -restored; writers need not be able to handle relative changes nor any sort -of ``change back'' operation. Specific writer properties which may be -controlled via formatter objects are horizontal alignment, font, and left -margin indentations. A mechanism is provided which supports providing -arbitrary, non-exclusive style settings to a writer as well. Additional -interfaces facilitate formatting events which are not reversible, such as -paragraph separation. - -Writer objects encapsulate device interfaces. Abstract devices, such as -file formats, are supported as well as physical devices. The provided -implementations all work with abstract devices. The interface makes -available mechanisms for setting the properties which formatter objects -manage and inserting data into the output. -""" - -import sys - - -AS_IS = None - - -class NullFormatter: - """A formatter which does nothing. - - If the writer parameter is omitted, a NullWriter instance is created. - No methods of the writer are called by NullFormatter instances. - - Implementations should inherit from this class if implementing a writer - interface but don't need to inherit any implementation. - - """ - - def __init__(self, writer=None): - if writer is None: - writer = NullWriter() - self.writer = writer - def end_paragraph(self, blankline): pass - def add_line_break(self): pass - def add_hor_rule(self, *args, **kw): pass - def add_label_data(self, format, counter, blankline=None): pass - def add_flowing_data(self, data): pass - def add_literal_data(self, data): pass - def flush_softspace(self): pass - def push_alignment(self, align): pass - def pop_alignment(self): pass - def push_font(self, x): pass - def pop_font(self): pass - def push_margin(self, margin): pass - def pop_margin(self): pass - def set_spacing(self, spacing): pass - def push_style(self, *styles): pass - def pop_style(self, n=1): pass - def assert_line_data(self, flag=1): pass - - -class AbstractFormatter: - """The standard formatter. - - This implementation has demonstrated wide applicability to many writers, - and may be used directly in most circumstances. It has been used to - implement a full-featured World Wide Web browser. - - """ - - # Space handling policy: blank spaces at the boundary between elements - # are handled by the outermost context. "Literal" data is not checked - # to determine context, so spaces in literal data are handled directly - # in all circumstances. - - def __init__(self, writer): - self.writer = writer # Output device - self.align = None # Current alignment - self.align_stack = [] # Alignment stack - self.font_stack = [] # Font state - self.margin_stack = [] # Margin state - self.spacing = None # Vertical spacing state - self.style_stack = [] # Other state, e.g. color - self.nospace = 1 # Should leading space be suppressed - self.softspace = 0 # Should a space be inserted - self.para_end = 1 # Just ended a paragraph - self.parskip = 0 # Skipped space between paragraphs? - self.hard_break = 1 # Have a hard break - self.have_label = 0 - - def end_paragraph(self, blankline): - if not self.hard_break: - self.writer.send_line_break() - self.have_label = 0 - if self.parskip < blankline and not self.have_label: - self.writer.send_paragraph(blankline - self.parskip) - self.parskip = blankline - self.have_label = 0 - self.hard_break = self.nospace = self.para_end = 1 - self.softspace = 0 - - def add_line_break(self): - if not (self.hard_break or self.para_end): - self.writer.send_line_break() - self.have_label = self.parskip = 0 - self.hard_break = self.nospace = 1 - self.softspace = 0 - - def add_hor_rule(self, *args, **kw): - if not self.hard_break: - self.writer.send_line_break() - self.writer.send_hor_rule(*args, **kw) - self.hard_break = self.nospace = 1 - self.have_label = self.para_end = self.softspace = self.parskip = 0 - - def add_label_data(self, format, counter, blankline = None): - if self.have_label or not self.hard_break: - self.writer.send_line_break() - if not self.para_end: - self.writer.send_paragraph((blankline and 1) or 0) - if isinstance(format, str): - self.writer.send_label_data(self.format_counter(format, counter)) - else: - self.writer.send_label_data(format) - self.nospace = self.have_label = self.hard_break = self.para_end = 1 - self.softspace = self.parskip = 0 - - def format_counter(self, format, counter): - label = '' - for c in format: - if c == '1': - label = label + ('%d' % counter) - elif c in 'aA': - if counter > 0: - label = label + self.format_letter(c, counter) - elif c in 'iI': - if counter > 0: - label = label + self.format_roman(c, counter) - else: - label = label + c - return label - - def format_letter(self, case, counter): - label = '' - while counter > 0: - counter, x = divmod(counter-1, 26) - # This makes a strong assumption that lowercase letters - # and uppercase letters form two contiguous blocks, with - # letters in order! - s = chr(ord(case) + x) - label = s + label - return label - - def format_roman(self, case, counter): - ones = ['i', 'x', 'c', 'm'] - fives = ['v', 'l', 'd'] - label, index = '', 0 - # This will die of IndexError when counter is too big - while counter > 0: - counter, x = divmod(counter, 10) - if x == 9: - label = ones[index] + ones[index+1] + label - elif x == 4: - label = ones[index] + fives[index] + label - else: - if x >= 5: - s = fives[index] - x = x-5 - else: - s = '' - s = s + ones[index]*x - label = s + label - index = index + 1 - if case == 'I': - return label.upper() - return label - - def add_flowing_data(self, data): - if not data: return - prespace = data[:1].isspace() - postspace = data[-1:].isspace() - data = " ".join(data.split()) - if self.nospace and not data: - return - elif prespace or self.softspace: - if not data: - if not self.nospace: - self.softspace = 1 - self.parskip = 0 - return - if not self.nospace: - data = ' ' + data - self.hard_break = self.nospace = self.para_end = \ - self.parskip = self.have_label = 0 - self.softspace = postspace - self.writer.send_flowing_data(data) - - def add_literal_data(self, data): - if not data: return - if self.softspace: - self.writer.send_flowing_data(" ") - self.hard_break = data[-1:] == '\n' - self.nospace = self.para_end = self.softspace = \ - self.parskip = self.have_label = 0 - self.writer.send_literal_data(data) - - def flush_softspace(self): - if self.softspace: - self.hard_break = self.para_end = self.parskip = \ - self.have_label = self.softspace = 0 - self.nospace = 1 - self.writer.send_flowing_data(' ') - - def push_alignment(self, align): - if align and align != self.align: - self.writer.new_alignment(align) - self.align = align - self.align_stack.append(align) - else: - self.align_stack.append(self.align) - - def pop_alignment(self): - if self.align_stack: - del self.align_stack[-1] - if self.align_stack: - self.align = align = self.align_stack[-1] - self.writer.new_alignment(align) - else: - self.align = None - self.writer.new_alignment(None) - - def push_font(self, font): - size, i, b, tt = font - if self.softspace: - self.hard_break = self.para_end = self.softspace = 0 - self.nospace = 1 - self.writer.send_flowing_data(' ') - if self.font_stack: - csize, ci, cb, ctt = self.font_stack[-1] - if size is AS_IS: size = csize - if i is AS_IS: i = ci - if b is AS_IS: b = cb - if tt is AS_IS: tt = ctt - font = (size, i, b, tt) - self.font_stack.append(font) - self.writer.new_font(font) - - def pop_font(self): - if self.font_stack: - del self.font_stack[-1] - if self.font_stack: - font = self.font_stack[-1] - else: - font = None - self.writer.new_font(font) - - def push_margin(self, margin): - self.margin_stack.append(margin) - fstack = filter(None, self.margin_stack) - if not margin and fstack: - margin = fstack[-1] - self.writer.new_margin(margin, len(fstack)) - - def pop_margin(self): - if self.margin_stack: - del self.margin_stack[-1] - fstack = filter(None, self.margin_stack) - if fstack: - margin = fstack[-1] - else: - margin = None - self.writer.new_margin(margin, len(fstack)) - - def set_spacing(self, spacing): - self.spacing = spacing - self.writer.new_spacing(spacing) - - def push_style(self, *styles): - if self.softspace: - self.hard_break = self.para_end = self.softspace = 0 - self.nospace = 1 - self.writer.send_flowing_data(' ') - for style in styles: - self.style_stack.append(style) - self.writer.new_styles(tuple(self.style_stack)) - - def pop_style(self, n=1): - del self.style_stack[-n:] - self.writer.new_styles(tuple(self.style_stack)) - - def assert_line_data(self, flag=1): - self.nospace = self.hard_break = not flag - self.para_end = self.parskip = self.have_label = 0 - - -class NullWriter: - """Minimal writer interface to use in testing & inheritance. - - A writer which only provides the interface definition; no actions are - taken on any methods. This should be the base class for all writers - which do not need to inherit any implementation methods. - - """ - def __init__(self): pass - def flush(self): pass - def new_alignment(self, align): pass - def new_font(self, font): pass - def new_margin(self, margin, level): pass - def new_spacing(self, spacing): pass - def new_styles(self, styles): pass - def send_paragraph(self, blankline): pass - def send_line_break(self): pass - def send_hor_rule(self, *args, **kw): pass - def send_label_data(self, data): pass - def send_flowing_data(self, data): pass - def send_literal_data(self, data): pass - - -class AbstractWriter(NullWriter): - """A writer which can be used in debugging formatters, but not much else. - - Each method simply announces itself by printing its name and - arguments on standard output. - - """ - - def new_alignment(self, align): - print "new_alignment(%r)" % (align,) - - def new_font(self, font): - print "new_font(%r)" % (font,) - - def new_margin(self, margin, level): - print "new_margin(%r, %d)" % (margin, level) - - def new_spacing(self, spacing): - print "new_spacing(%r)" % (spacing,) - - def new_styles(self, styles): - print "new_styles(%r)" % (styles,) - - def send_paragraph(self, blankline): - print "send_paragraph(%r)" % (blankline,) - - def send_line_break(self): - print "send_line_break()" - - def send_hor_rule(self, *args, **kw): - print "send_hor_rule()" - - def send_label_data(self, data): - print "send_label_data(%r)" % (data,) - - def send_flowing_data(self, data): - print "send_flowing_data(%r)" % (data,) - - def send_literal_data(self, data): - print "send_literal_data(%r)" % (data,) - - -class DumbWriter(NullWriter): - """Simple writer class which writes output on the file object passed in - as the file parameter or, if file is omitted, on standard output. The - output is simply word-wrapped to the number of columns specified by - the maxcol parameter. This class is suitable for reflowing a sequence - of paragraphs. - - """ - - def __init__(self, file=None, maxcol=72): - self.file = file or sys.stdout - self.maxcol = maxcol - NullWriter.__init__(self) - self.reset() - - def reset(self): - self.col = 0 - self.atbreak = 0 - - def send_paragraph(self, blankline): - self.file.write('\n'*blankline) - self.col = 0 - self.atbreak = 0 - - def send_line_break(self): - self.file.write('\n') - self.col = 0 - self.atbreak = 0 - - def send_hor_rule(self, *args, **kw): - self.file.write('\n') - self.file.write('-'*self.maxcol) - self.file.write('\n') - self.col = 0 - self.atbreak = 0 - - def send_literal_data(self, data): - self.file.write(data) - i = data.rfind('\n') - if i >= 0: - self.col = 0 - data = data[i+1:] - data = data.expandtabs() - self.col = self.col + len(data) - self.atbreak = 0 - - def send_flowing_data(self, data): - if not data: return - atbreak = self.atbreak or data[0].isspace() - col = self.col - maxcol = self.maxcol - write = self.file.write - for word in data.split(): - if atbreak: - if col + len(word) >= maxcol: - write('\n') - col = 0 - else: - write(' ') - col = col + 1 - write(word) - col = col + len(word) - atbreak = 1 - self.col = col - self.atbreak = data[-1].isspace() - - -def test(file = None): - w = DumbWriter() - f = AbstractFormatter(w) - if file is not None: - fp = open(file) - elif sys.argv[1:]: - fp = open(sys.argv[1]) - else: - fp = sys.stdin - for line in fp: - if line == '\n': - f.end_paragraph(1) - else: - f.add_flowing_data(line) - f.end_paragraph(0) - - -if __name__ == '__main__': - test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py deleted file mode 100644 index b267245..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/functools.py +++ /dev/null @@ -1,100 +0,0 @@ -"""functools.py - Tools for working with functions and callable objects -""" -# Python module wrapper for _functools C module -# to allow utilities written in Python to be added -# to the functools module. -# Written by Nick Coghlan -# Copyright (C) 2006 Python Software Foundation. -# See C source code for _functools credits/copyright - -from _functools import partial, reduce - -# update_wrapper() and wraps() are tools to help write -# wrapper functions that can handle naive introspection - -WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__') -WRAPPER_UPDATES = ('__dict__',) -def update_wrapper(wrapper, - wrapped, - assigned = WRAPPER_ASSIGNMENTS, - updated = WRAPPER_UPDATES): - """Update a wrapper function to look like the wrapped function - - wrapper is the function to be updated - wrapped is the original function - assigned is a tuple naming the attributes assigned directly - from the wrapped function to the wrapper function (defaults to - functools.WRAPPER_ASSIGNMENTS) - updated is a tuple naming the attributes of the wrapper that - are updated with the corresponding attribute from the wrapped - function (defaults to functools.WRAPPER_UPDATES) - """ - for attr in assigned: - setattr(wrapper, attr, getattr(wrapped, attr)) - for attr in updated: - getattr(wrapper, attr).update(getattr(wrapped, attr, {})) - # Return the wrapper so this can be used as a decorator via partial() - return wrapper - -def wraps(wrapped, - assigned = WRAPPER_ASSIGNMENTS, - updated = WRAPPER_UPDATES): - """Decorator factory to apply update_wrapper() to a wrapper function - - Returns a decorator that invokes update_wrapper() with the decorated - function as the wrapper argument and the arguments to wraps() as the - remaining arguments. Default arguments are as for update_wrapper(). - This is a convenience function to simplify applying partial() to - update_wrapper(). - """ - return partial(update_wrapper, wrapped=wrapped, - assigned=assigned, updated=updated) - -def total_ordering(cls): - """Class decorator that fills in missing ordering methods""" - convert = { - '__lt__': [('__gt__', lambda self, other: not (self < other or self == other)), - ('__le__', lambda self, other: self < other or self == other), - ('__ge__', lambda self, other: not self < other)], - '__le__': [('__ge__', lambda self, other: not self <= other or self == other), - ('__lt__', lambda self, other: self <= other and not self == other), - ('__gt__', lambda self, other: not self <= other)], - '__gt__': [('__lt__', lambda self, other: not (self > other or self == other)), - ('__ge__', lambda self, other: self > other or self == other), - ('__le__', lambda self, other: not self > other)], - '__ge__': [('__le__', lambda self, other: (not self >= other) or self == other), - ('__gt__', lambda self, other: self >= other and not self == other), - ('__lt__', lambda self, other: not self >= other)] - } - roots = set(dir(cls)) & set(convert) - if not roots: - raise ValueError('must define at least one ordering operation: < > <= >=') - root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__ - for opname, opfunc in convert[root]: - if opname not in roots: - opfunc.__name__ = opname - opfunc.__doc__ = getattr(int, opname).__doc__ - setattr(cls, opname, opfunc) - return cls - -def cmp_to_key(mycmp): - """Convert a cmp= function into a key= function""" - class K(object): - __slots__ = ['obj'] - def __init__(self, obj, *args): - self.obj = obj - def __lt__(self, other): - return mycmp(self.obj, other.obj) < 0 - def __gt__(self, other): - return mycmp(self.obj, other.obj) > 0 - def __eq__(self, other): - return mycmp(self.obj, other.obj) == 0 - def __le__(self, other): - return mycmp(self.obj, other.obj) <= 0 - def __ge__(self, other): - return mycmp(self.obj, other.obj) >= 0 - def __ne__(self, other): - return mycmp(self.obj, other.obj) != 0 - def __hash__(self): - raise TypeError('hash not implemented') - return K diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py deleted file mode 100644 index 09d2c45..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/genericpath.py +++ /dev/null @@ -1,113 +0,0 @@ -""" -Path operations common to more than one OS -Do not use directly. The OS specific modules import the appropriate -functions from this module themselves. -""" -import os -import stat - -__all__ = ['commonprefix', 'exists', 'getatime', 'getctime', 'getmtime', - 'getsize', 'isdir', 'isfile'] - - -try: - _unicode = unicode -except NameError: - # If Python is built without Unicode support, the unicode type - # will not exist. Fake one. - class _unicode(object): - pass - -# Does a path exist? -# This is false for dangling symbolic links on systems that support them. -def exists(path): - """Test whether a path exists. Returns False for broken symbolic links""" - try: - os.stat(path) - except os.error: - return False - return True - - -# This follows symbolic links, so both islink() and isdir() can be true -# for the same path on systems that support symlinks -def isfile(path): - """Test whether a path is a regular file""" - try: - st = os.stat(path) - except os.error: - return False - return stat.S_ISREG(st.st_mode) - - -# Is a path a directory? -# This follows symbolic links, so both islink() and isdir() -# can be true for the same path on systems that support symlinks -def isdir(s): - """Return true if the pathname refers to an existing directory.""" - try: - st = os.stat(s) - except os.error: - return False - return stat.S_ISDIR(st.st_mode) - - -def getsize(filename): - """Return the size of a file, reported by os.stat().""" - return os.stat(filename).st_size - - -def getmtime(filename): - """Return the last modification time of a file, reported by os.stat().""" - return os.stat(filename).st_mtime - - -def getatime(filename): - """Return the last access time of a file, reported by os.stat().""" - return os.stat(filename).st_atime - - -def getctime(filename): - """Return the metadata change time of a file, reported by os.stat().""" - return os.stat(filename).st_ctime - - -# Return the longest prefix of all list elements. -def commonprefix(m): - "Given a list of pathnames, returns the longest common leading component" - if not m: return '' - s1 = min(m) - s2 = max(m) - for i, c in enumerate(s1): - if c != s2[i]: - return s1[:i] - return s1 - -# Split a path in root and extension. -# The extension is everything starting at the last dot in the last -# pathname component; the root is everything before that. -# It is always true that root + ext == p. - -# Generic implementation of splitext, to be parametrized with -# the separators -def _splitext(p, sep, altsep, extsep): - """Split the extension from a pathname. - - Extension is everything from the last dot to the end, ignoring - leading dots. Returns "(root, ext)"; ext may be empty.""" - - sepIndex = p.rfind(sep) - if altsep: - altsepIndex = p.rfind(altsep) - sepIndex = max(sepIndex, altsepIndex) - - dotIndex = p.rfind(extsep) - if dotIndex > sepIndex: - # skip all leading dots - filenameIndex = sepIndex + 1 - while filenameIndex < dotIndex: - if p[filenameIndex] != extsep: - return p[:dotIndex], p[dotIndex:] - filenameIndex += 1 - - return p, '' diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py deleted file mode 100644 index c6a763a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/getopt.py +++ /dev/null @@ -1,210 +0,0 @@ -"""Parser for command line options. - -This module helps scripts to parse the command line arguments in -sys.argv. It supports the same conventions as the Unix getopt() -function (including the special meanings of arguments of the form `-' -and `--'). Long options similar to those supported by GNU software -may be used as well via an optional third argument. This module -provides two functions and an exception: - -getopt() -- Parse command line options -gnu_getopt() -- Like getopt(), but allow option and non-option arguments -to be intermixed. -GetoptError -- exception (class) raised with 'opt' attribute, which is the -option involved with the exception. -""" - -# Long option support added by Lars Wirzenius . -# -# Gerrit Holl moved the string-based exceptions -# to class-based exceptions. -# -# Peter Astrand added gnu_getopt(). -# -# TODO for gnu_getopt(): -# -# - GNU getopt_long_only mechanism -# - allow the caller to specify ordering -# - RETURN_IN_ORDER option -# - GNU extension with '-' as first character of option string -# - optional arguments, specified by double colons -# - a option string with a W followed by semicolon should -# treat "-W foo" as "--foo" - -__all__ = ["GetoptError","error","getopt","gnu_getopt"] - -import os - -class GetoptError(Exception): - opt = '' - msg = '' - def __init__(self, msg, opt=''): - self.msg = msg - self.opt = opt - Exception.__init__(self, msg, opt) - - def __str__(self): - return self.msg - -error = GetoptError # backward compatibility - -def getopt(args, shortopts, longopts = []): - """getopt(args, options[, long_options]) -> opts, args - - Parses command line options and parameter list. args is the - argument list to be parsed, without the leading reference to the - running program. Typically, this means "sys.argv[1:]". shortopts - is the string of option letters that the script wants to - recognize, with options that require an argument followed by a - colon (i.e., the same format that Unix getopt() uses). If - specified, longopts is a list of strings with the names of the - long options which should be supported. The leading '--' - characters should not be included in the option name. Options - which require an argument should be followed by an equal sign - ('='). - - The return value consists of two elements: the first is a list of - (option, value) pairs; the second is the list of program arguments - left after the option list was stripped (this is a trailing slice - of the first argument). Each option-and-value pair returned has - the option as its first element, prefixed with a hyphen (e.g., - '-x'), and the option argument as its second element, or an empty - string if the option has no argument. The options occur in the - list in the same order in which they were found, thus allowing - multiple occurrences. Long and short options may be mixed. - - """ - - opts = [] - if type(longopts) == type(""): - longopts = [longopts] - else: - longopts = list(longopts) - while args and args[0].startswith('-') and args[0] != '-': - if args[0] == '--': - args = args[1:] - break - if args[0].startswith('--'): - opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) - else: - opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) - - return opts, args - -def gnu_getopt(args, shortopts, longopts = []): - """getopt(args, options[, long_options]) -> opts, args - - This function works like getopt(), except that GNU style scanning - mode is used by default. This means that option and non-option - arguments may be intermixed. The getopt() function stops - processing options as soon as a non-option argument is - encountered. - - If the first character of the option string is `+', or if the - environment variable POSIXLY_CORRECT is set, then option - processing stops as soon as a non-option argument is encountered. - - """ - - opts = [] - prog_args = [] - if isinstance(longopts, str): - longopts = [longopts] - else: - longopts = list(longopts) - - # Allow options after non-option arguments? - if shortopts.startswith('+'): - shortopts = shortopts[1:] - all_options_first = True - elif os.environ.get("POSIXLY_CORRECT"): - all_options_first = True - else: - all_options_first = False - - while args: - if args[0] == '--': - prog_args += args[1:] - break - - if args[0][:2] == '--': - opts, args = do_longs(opts, args[0][2:], longopts, args[1:]) - elif args[0][:1] == '-' and args[0] != '-': - opts, args = do_shorts(opts, args[0][1:], shortopts, args[1:]) - else: - if all_options_first: - prog_args += args - break - else: - prog_args.append(args[0]) - args = args[1:] - - return opts, prog_args - -def do_longs(opts, opt, longopts, args): - try: - i = opt.index('=') - except ValueError: - optarg = None - else: - opt, optarg = opt[:i], opt[i+1:] - - has_arg, opt = long_has_args(opt, longopts) - if has_arg: - if optarg is None: - if not args: - raise GetoptError('option --%s requires argument' % opt, opt) - optarg, args = args[0], args[1:] - elif optarg is not None: - raise GetoptError('option --%s must not have an argument' % opt, opt) - opts.append(('--' + opt, optarg or '')) - return opts, args - -# Return: -# has_arg? -# full option name -def long_has_args(opt, longopts): - possibilities = [o for o in longopts if o.startswith(opt)] - if not possibilities: - raise GetoptError('option --%s not recognized' % opt, opt) - # Is there an exact match? - if opt in possibilities: - return False, opt - elif opt + '=' in possibilities: - return True, opt - # No exact match, so better be unique. - if len(possibilities) > 1: - # XXX since possibilities contains all valid continuations, might be - # nice to work them into the error msg - raise GetoptError('option --%s not a unique prefix' % opt, opt) - assert len(possibilities) == 1 - unique_match = possibilities[0] - has_arg = unique_match.endswith('=') - if has_arg: - unique_match = unique_match[:-1] - return has_arg, unique_match - -def do_shorts(opts, optstring, shortopts, args): - while optstring != '': - opt, optstring = optstring[0], optstring[1:] - if short_has_arg(opt, shortopts): - if optstring == '': - if not args: - raise GetoptError('option -%s requires argument' % opt, - opt) - optstring, args = args[0], args[1:] - optarg, optstring = optstring, '' - else: - optarg = '' - opts.append(('-' + opt, optarg)) - return opts, args - -def short_has_arg(opt, shortopts): - for i in range(len(shortopts)): - if opt == shortopts[i] != ':': - return shortopts.startswith(':', i+1) - raise GetoptError('option -%s not recognized' % opt, opt) - -if __name__ == '__main__': - import sys - print getopt(sys.argv[1:], "a:b", ["alpha=", "beta"]) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py deleted file mode 100644 index a531462..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/gettext.py +++ /dev/null @@ -1,594 +0,0 @@ -"""Internationalization and localization support. - -This module provides internationalization (I18N) and localization (L10N) -support for your Python programs by providing an interface to the GNU gettext -message catalog library. - -I18N refers to the operation by which a program is made aware of multiple -languages. L10N refers to the adaptation of your program, once -internationalized, to the local language and cultural habits. - -""" - -# This module represents the integration of work, contributions, feedback, and -# suggestions from the following people: -# -# Martin von Loewis, who wrote the initial implementation of the underlying -# C-based libintlmodule (later renamed _gettext), along with a skeletal -# gettext.py implementation. -# -# Peter Funk, who wrote fintl.py, a fairly complete wrapper around intlmodule, -# which also included a pure-Python implementation to read .mo files if -# intlmodule wasn't available. -# -# James Henstridge, who also wrote a gettext.py module, which has some -# interesting, but currently unsupported experimental features: the notion of -# a Catalog class and instances, and the ability to add to a catalog file via -# a Python API. -# -# Barry Warsaw integrated these modules, wrote the .install() API and code, -# and conformed all C and Python code to Python's coding standards. -# -# Francois Pinard and Marc-Andre Lemburg also contributed valuably to this -# module. -# -# J. David Ibanez implemented plural forms. Bruno Haible fixed some bugs. -# -# TODO: -# - Lazy loading of .mo files. Currently the entire catalog is loaded into -# memory, but that's probably bad for large translated programs. Instead, -# the lexical sort of original strings in GNU .mo files should be exploited -# to do binary searches and lazy initializations. Or you might want to use -# the undocumented double-hash algorithm for .mo files with hash tables, but -# you'll need to study the GNU gettext code to do this. -# -# - Support Solaris .mo file formats. Unfortunately, we've been unable to -# find this format documented anywhere. - - -import locale, copy, os, re, struct, sys -from errno import ENOENT - - -__all__ = ['NullTranslations', 'GNUTranslations', 'Catalog', - 'find', 'translation', 'install', 'textdomain', 'bindtextdomain', - 'bind_textdomain_codeset', - 'dgettext', 'dngettext', 'gettext', 'lgettext', 'ldgettext', - 'ldngettext', 'lngettext', 'ngettext', - ] - -_default_localedir = os.path.join(sys.prefix, 'share', 'locale') - - -def test(condition, true, false): - """ - Implements the C expression: - - condition ? true : false - - Required to correctly interpret plural forms. - """ - if condition: - return true - else: - return false - - -def c2py(plural): - """Gets a C expression as used in PO files for plural forms and returns a - Python lambda function that implements an equivalent expression. - """ - # Security check, allow only the "n" identifier - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - import token, tokenize - tokens = tokenize.generate_tokens(StringIO(plural).readline) - try: - danger = [x for x in tokens if x[0] == token.NAME and x[1] != 'n'] - except tokenize.TokenError: - raise ValueError, \ - 'plural forms expression error, maybe unbalanced parenthesis' - else: - if danger: - raise ValueError, 'plural forms expression could be dangerous' - - # Replace some C operators by their Python equivalents - plural = plural.replace('&&', ' and ') - plural = plural.replace('||', ' or ') - - expr = re.compile(r'\!([^=])') - plural = expr.sub(' not \\1', plural) - - # Regular expression and replacement function used to transform - # "a?b:c" to "test(a,b,c)". - expr = re.compile(r'(.*?)\?(.*?):(.*)') - def repl(x): - return "test(%s, %s, %s)" % (x.group(1), x.group(2), - expr.sub(repl, x.group(3))) - - # Code to transform the plural expression, taking care of parentheses - stack = [''] - for c in plural: - if c == '(': - stack.append('') - elif c == ')': - if len(stack) == 1: - # Actually, we never reach this code, because unbalanced - # parentheses get caught in the security check at the - # beginning. - raise ValueError, 'unbalanced parenthesis in plural form' - s = expr.sub(repl, stack.pop()) - stack[-1] += '(%s)' % s - else: - stack[-1] += c - plural = expr.sub(repl, stack.pop()) - - return eval('lambda n: int(%s)' % plural) - - - -def _expand_lang(locale): - from locale import normalize - locale = normalize(locale) - COMPONENT_CODESET = 1 << 0 - COMPONENT_TERRITORY = 1 << 1 - COMPONENT_MODIFIER = 1 << 2 - # split up the locale into its base components - mask = 0 - pos = locale.find('@') - if pos >= 0: - modifier = locale[pos:] - locale = locale[:pos] - mask |= COMPONENT_MODIFIER - else: - modifier = '' - pos = locale.find('.') - if pos >= 0: - codeset = locale[pos:] - locale = locale[:pos] - mask |= COMPONENT_CODESET - else: - codeset = '' - pos = locale.find('_') - if pos >= 0: - territory = locale[pos:] - locale = locale[:pos] - mask |= COMPONENT_TERRITORY - else: - territory = '' - language = locale - ret = [] - for i in range(mask+1): - if not (i & ~mask): # if all components for this combo exist ... - val = language - if i & COMPONENT_TERRITORY: val += territory - if i & COMPONENT_CODESET: val += codeset - if i & COMPONENT_MODIFIER: val += modifier - ret.append(val) - ret.reverse() - return ret - - - -class NullTranslations: - def __init__(self, fp=None): - self._info = {} - self._charset = None - self._output_charset = None - self._fallback = None - if fp is not None: - self._parse(fp) - - def _parse(self, fp): - pass - - def add_fallback(self, fallback): - if self._fallback: - self._fallback.add_fallback(fallback) - else: - self._fallback = fallback - - def gettext(self, message): - if self._fallback: - return self._fallback.gettext(message) - return message - - def lgettext(self, message): - if self._fallback: - return self._fallback.lgettext(message) - return message - - def ngettext(self, msgid1, msgid2, n): - if self._fallback: - return self._fallback.ngettext(msgid1, msgid2, n) - if n == 1: - return msgid1 - else: - return msgid2 - - def lngettext(self, msgid1, msgid2, n): - if self._fallback: - return self._fallback.lngettext(msgid1, msgid2, n) - if n == 1: - return msgid1 - else: - return msgid2 - - def ugettext(self, message): - if self._fallback: - return self._fallback.ugettext(message) - return unicode(message) - - def ungettext(self, msgid1, msgid2, n): - if self._fallback: - return self._fallback.ungettext(msgid1, msgid2, n) - if n == 1: - return unicode(msgid1) - else: - return unicode(msgid2) - - def info(self): - return self._info - - def charset(self): - return self._charset - - def output_charset(self): - return self._output_charset - - def set_output_charset(self, charset): - self._output_charset = charset - - def install(self, unicode=False, names=None): - import __builtin__ - __builtin__.__dict__['_'] = unicode and self.ugettext or self.gettext - if hasattr(names, "__contains__"): - if "gettext" in names: - __builtin__.__dict__['gettext'] = __builtin__.__dict__['_'] - if "ngettext" in names: - __builtin__.__dict__['ngettext'] = (unicode and self.ungettext - or self.ngettext) - if "lgettext" in names: - __builtin__.__dict__['lgettext'] = self.lgettext - if "lngettext" in names: - __builtin__.__dict__['lngettext'] = self.lngettext - - -class GNUTranslations(NullTranslations): - # Magic number of .mo files - LE_MAGIC = 0x950412deL - BE_MAGIC = 0xde120495L - - def _parse(self, fp): - """Override this method to support alternative .mo formats.""" - unpack = struct.unpack - filename = getattr(fp, 'name', '') - # Parse the .mo file header, which consists of 5 little endian 32 - # bit words. - self._catalog = catalog = {} - self.plural = lambda n: int(n != 1) # germanic plural by default - buf = fp.read() - buflen = len(buf) - # Are we big endian or little endian? - magic = unpack('4I', buf[4:20]) - ii = '>II' - else: - raise IOError(0, 'Bad magic number', filename) - # Now put all messages from the .mo file buffer into the catalog - # dictionary. - for i in xrange(0, msgcount): - mlen, moff = unpack(ii, buf[masteridx:masteridx+8]) - mend = moff + mlen - tlen, toff = unpack(ii, buf[transidx:transidx+8]) - tend = toff + tlen - if mend < buflen and tend < buflen: - msg = buf[moff:mend] - tmsg = buf[toff:tend] - else: - raise IOError(0, 'File is corrupt', filename) - # See if we're looking at GNU .mo conventions for metadata - if mlen == 0: - # Catalog description - lastk = None - for item in tmsg.splitlines(): - item = item.strip() - if not item: - continue - k = v = None - if ':' in item: - k, v = item.split(':', 1) - k = k.strip().lower() - v = v.strip() - self._info[k] = v - lastk = k - elif lastk: - self._info[lastk] += '\n' + item - if k == 'content-type': - self._charset = v.split('charset=')[1] - elif k == 'plural-forms': - v = v.split(';') - plural = v[1].split('plural=')[1] - self.plural = c2py(plural) - # Note: we unconditionally convert both msgids and msgstrs to - # Unicode using the character encoding specified in the charset - # parameter of the Content-Type header. The gettext documentation - # strongly encourages msgids to be us-ascii, but some applications - # require alternative encodings (e.g. Zope's ZCML and ZPT). For - # traditional gettext applications, the msgid conversion will - # cause no problems since us-ascii should always be a subset of - # the charset encoding. We may want to fall back to 8-bit msgids - # if the Unicode conversion fails. - if '\x00' in msg: - # Plural forms - msgid1, msgid2 = msg.split('\x00') - tmsg = tmsg.split('\x00') - if self._charset: - msgid1 = unicode(msgid1, self._charset) - tmsg = [unicode(x, self._charset) for x in tmsg] - for i in range(len(tmsg)): - catalog[(msgid1, i)] = tmsg[i] - else: - if self._charset: - msg = unicode(msg, self._charset) - tmsg = unicode(tmsg, self._charset) - catalog[msg] = tmsg - # advance to next entry in the seek tables - masteridx += 8 - transidx += 8 - - def gettext(self, message): - missing = object() - tmsg = self._catalog.get(message, missing) - if tmsg is missing: - if self._fallback: - return self._fallback.gettext(message) - return message - # Encode the Unicode tmsg back to an 8-bit string, if possible - if self._output_charset: - return tmsg.encode(self._output_charset) - elif self._charset: - return tmsg.encode(self._charset) - return tmsg - - def lgettext(self, message): - missing = object() - tmsg = self._catalog.get(message, missing) - if tmsg is missing: - if self._fallback: - return self._fallback.lgettext(message) - return message - if self._output_charset: - return tmsg.encode(self._output_charset) - return tmsg.encode(locale.getpreferredencoding()) - - def ngettext(self, msgid1, msgid2, n): - try: - tmsg = self._catalog[(msgid1, self.plural(n))] - if self._output_charset: - return tmsg.encode(self._output_charset) - elif self._charset: - return tmsg.encode(self._charset) - return tmsg - except KeyError: - if self._fallback: - return self._fallback.ngettext(msgid1, msgid2, n) - if n == 1: - return msgid1 - else: - return msgid2 - - def lngettext(self, msgid1, msgid2, n): - try: - tmsg = self._catalog[(msgid1, self.plural(n))] - if self._output_charset: - return tmsg.encode(self._output_charset) - return tmsg.encode(locale.getpreferredencoding()) - except KeyError: - if self._fallback: - return self._fallback.lngettext(msgid1, msgid2, n) - if n == 1: - return msgid1 - else: - return msgid2 - - def ugettext(self, message): - missing = object() - tmsg = self._catalog.get(message, missing) - if tmsg is missing: - if self._fallback: - return self._fallback.ugettext(message) - return unicode(message) - return tmsg - - def ungettext(self, msgid1, msgid2, n): - try: - tmsg = self._catalog[(msgid1, self.plural(n))] - except KeyError: - if self._fallback: - return self._fallback.ungettext(msgid1, msgid2, n) - if n == 1: - tmsg = unicode(msgid1) - else: - tmsg = unicode(msgid2) - return tmsg - - -# Locate a .mo file using the gettext strategy -def find(domain, localedir=None, languages=None, all=0): - # Get some reasonable defaults for arguments that were not supplied - if localedir is None: - localedir = _default_localedir - if languages is None: - languages = [] - for envar in ('LANGUAGE', 'LC_ALL', 'LC_MESSAGES', 'LANG'): - val = os.environ.get(envar) - if val: - languages = val.split(':') - break - if 'C' not in languages: - languages.append('C') - # now normalize and expand the languages - nelangs = [] - for lang in languages: - for nelang in _expand_lang(lang): - if nelang not in nelangs: - nelangs.append(nelang) - # select a language - if all: - result = [] - else: - result = None - for lang in nelangs: - if lang == 'C': - break - mofile = os.path.join(localedir, lang, 'LC_MESSAGES', '%s.mo' % domain) - if os.path.exists(mofile): - if all: - result.append(mofile) - else: - return mofile - return result - - - -# a mapping between absolute .mo file path and Translation object -_translations = {} - -def translation(domain, localedir=None, languages=None, - class_=None, fallback=False, codeset=None): - if class_ is None: - class_ = GNUTranslations - mofiles = find(domain, localedir, languages, all=1) - if not mofiles: - if fallback: - return NullTranslations() - raise IOError(ENOENT, 'No translation file found for domain', domain) - # Avoid opening, reading, and parsing the .mo file after it's been done - # once. - result = None - for mofile in mofiles: - key = (class_, os.path.abspath(mofile)) - t = _translations.get(key) - if t is None: - with open(mofile, 'rb') as fp: - t = _translations.setdefault(key, class_(fp)) - # Copy the translation object to allow setting fallbacks and - # output charset. All other instance data is shared with the - # cached object. - t = copy.copy(t) - if codeset: - t.set_output_charset(codeset) - if result is None: - result = t - else: - result.add_fallback(t) - return result - - -def install(domain, localedir=None, unicode=False, codeset=None, names=None): - t = translation(domain, localedir, fallback=True, codeset=codeset) - t.install(unicode, names) - - - -# a mapping b/w domains and locale directories -_localedirs = {} -# a mapping b/w domains and codesets -_localecodesets = {} -# current global domain, `messages' used for compatibility w/ GNU gettext -_current_domain = 'messages' - - -def textdomain(domain=None): - global _current_domain - if domain is not None: - _current_domain = domain - return _current_domain - - -def bindtextdomain(domain, localedir=None): - global _localedirs - if localedir is not None: - _localedirs[domain] = localedir - return _localedirs.get(domain, _default_localedir) - - -def bind_textdomain_codeset(domain, codeset=None): - global _localecodesets - if codeset is not None: - _localecodesets[domain] = codeset - return _localecodesets.get(domain) - - -def dgettext(domain, message): - try: - t = translation(domain, _localedirs.get(domain, None), - codeset=_localecodesets.get(domain)) - except IOError: - return message - return t.gettext(message) - -def ldgettext(domain, message): - try: - t = translation(domain, _localedirs.get(domain, None), - codeset=_localecodesets.get(domain)) - except IOError: - return message - return t.lgettext(message) - -def dngettext(domain, msgid1, msgid2, n): - try: - t = translation(domain, _localedirs.get(domain, None), - codeset=_localecodesets.get(domain)) - except IOError: - if n == 1: - return msgid1 - else: - return msgid2 - return t.ngettext(msgid1, msgid2, n) - -def ldngettext(domain, msgid1, msgid2, n): - try: - t = translation(domain, _localedirs.get(domain, None), - codeset=_localecodesets.get(domain)) - except IOError: - if n == 1: - return msgid1 - else: - return msgid2 - return t.lngettext(msgid1, msgid2, n) - -def gettext(message): - return dgettext(_current_domain, message) - -def lgettext(message): - return ldgettext(_current_domain, message) - -def ngettext(msgid1, msgid2, n): - return dngettext(_current_domain, msgid1, msgid2, n) - -def lngettext(msgid1, msgid2, n): - return ldngettext(_current_domain, msgid1, msgid2, n) - -# dcgettext() has been deemed unnecessary and is not implemented. - -# James Henstridge's Catalog constructor from GNOME gettext. Documented usage -# was: -# -# import gettext -# cat = gettext.Catalog(PACKAGE, localedir=LOCALEDIR) -# _ = cat.gettext -# print _('Hello World') - -# The resulting catalog object currently don't support access through a -# dictionary API, which was supported (but apparently unused) in GNOME -# gettext. - -Catalog = translation diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py deleted file mode 100644 index d723f20..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/hashlib.py +++ /dev/null @@ -1,221 +0,0 @@ -# $Id$ -# -# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org) -# Licensed to PSF under a Contributor Agreement. -# - -__doc__ = """hashlib module - A common interface to many hash functions. - -new(name, string='') - returns a new hash object implementing the - given hash function; initializing the hash - using the given string data. - -Named constructor functions are also available, these are much faster -than using new(): - -md5(), sha1(), sha224(), sha256(), sha384(), and sha512() - -More algorithms may be available on your platform but the above are guaranteed -to exist. See the algorithms_guaranteed and algorithms_available attributes -to find out what algorithm names can be passed to new(). - -NOTE: If you want the adler32 or crc32 hash functions they are available in -the zlib module. - -Choose your hash function wisely. Some have known collision weaknesses. -sha384 and sha512 will be slow on 32 bit platforms. - -Hash objects have these methods: - - update(arg): Update the hash object with the string arg. Repeated calls - are equivalent to a single call with the concatenation of all - the arguments. - - digest(): Return the digest of the strings passed to the update() method - so far. This may contain non-ASCII characters, including - NUL bytes. - - hexdigest(): Like digest() except the digest is returned as a string of - double length, containing only hexadecimal digits. - - copy(): Return a copy (clone) of the hash object. This can be used to - efficiently compute the digests of strings that share a common - initial substring. - -For example, to obtain the digest of the string 'Nobody inspects the -spammish repetition': - - >>> import hashlib - >>> m = hashlib.md5() - >>> m.update("Nobody inspects") - >>> m.update(" the spammish repetition") - >>> m.digest() - '\\xbbd\\x9c\\x83\\xdd\\x1e\\xa5\\xc9\\xd9\\xde\\xc9\\xa1\\x8d\\xf0\\xff\\xe9' - -More condensed: - - >>> hashlib.sha224("Nobody inspects the spammish repetition").hexdigest() - 'a4337bc45a8fc544c03f52dc550cd6e1e87021bc896588bd79e901e2' - -""" - -# This tuple and __get_builtin_constructor() must be modified if a new -# always available algorithm is added. -__always_supported = ('md5', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512') - -algorithms_guaranteed = set(__always_supported) -algorithms_available = set(__always_supported) - -algorithms = __always_supported - -__all__ = __always_supported + ('new', 'algorithms_guaranteed', - 'algorithms_available', 'algorithms', - 'pbkdf2_hmac') - - -def __get_builtin_constructor(name): - try: - if name in ('SHA1', 'sha1'): - import _sha - return _sha.new - elif name in ('MD5', 'md5'): - import _md5 - return _md5.new - elif name in ('SHA256', 'sha256', 'SHA224', 'sha224'): - import _sha256 - bs = name[3:] - if bs == '256': - return _sha256.sha256 - elif bs == '224': - return _sha256.sha224 - elif name in ('SHA512', 'sha512', 'SHA384', 'sha384'): - import _sha512 - bs = name[3:] - if bs == '512': - return _sha512.sha512 - elif bs == '384': - return _sha512.sha384 - except ImportError: - pass # no extension module, this hash is unsupported. - - raise ValueError('unsupported hash type ' + name) - - -def __get_openssl_constructor(name): - try: - f = getattr(_hashlib, 'openssl_' + name) - # Allow the C module to raise ValueError. The function will be - # defined but the hash not actually available thanks to OpenSSL. - f() - # Use the C function directly (very fast) - return f - except (AttributeError, ValueError): - return __get_builtin_constructor(name) - - -def __py_new(name, string=''): - """new(name, string='') - Return a new hashing object using the named algorithm; - optionally initialized with a string. - """ - return __get_builtin_constructor(name)(string) - - -def __hash_new(name, string=''): - """new(name, string='') - Return a new hashing object using the named algorithm; - optionally initialized with a string. - """ - try: - return _hashlib.new(name, string) - except ValueError: - # If the _hashlib module (OpenSSL) doesn't support the named - # hash, try using our builtin implementations. - # This allows for SHA224/256 and SHA384/512 support even though - # the OpenSSL library prior to 0.9.8 doesn't provide them. - return __get_builtin_constructor(name)(string) - - -try: - import _hashlib - new = __hash_new - __get_hash = __get_openssl_constructor - algorithms_available = algorithms_available.union( - _hashlib.openssl_md_meth_names) -except ImportError: - new = __py_new - __get_hash = __get_builtin_constructor - -for __func_name in __always_supported: - # try them all, some may not work due to the OpenSSL - # version not supporting that algorithm. - try: - globals()[__func_name] = __get_hash(__func_name) - except ValueError: - import logging - logging.exception('code for hash %s was not found.', __func_name) - - -try: - # OpenSSL's PKCS5_PBKDF2_HMAC requires OpenSSL 1.0+ with HMAC and SHA - from _hashlib import pbkdf2_hmac -except ImportError: - import binascii - import struct - - _trans_5C = b"".join(chr(x ^ 0x5C) for x in range(256)) - _trans_36 = b"".join(chr(x ^ 0x36) for x in range(256)) - - def pbkdf2_hmac(hash_name, password, salt, iterations, dklen=None): - """Password based key derivation function 2 (PKCS #5 v2.0) - - This Python implementations based on the hmac module about as fast - as OpenSSL's PKCS5_PBKDF2_HMAC for short passwords and much faster - for long passwords. - """ - if not isinstance(hash_name, str): - raise TypeError(hash_name) - - if not isinstance(password, (bytes, bytearray)): - password = bytes(buffer(password)) - if not isinstance(salt, (bytes, bytearray)): - salt = bytes(buffer(salt)) - - # Fast inline HMAC implementation - inner = new(hash_name) - outer = new(hash_name) - blocksize = getattr(inner, 'block_size', 64) - if len(password) > blocksize: - password = new(hash_name, password).digest() - password = password + b'\x00' * (blocksize - len(password)) - inner.update(password.translate(_trans_36)) - outer.update(password.translate(_trans_5C)) - - def prf(msg, inner=inner, outer=outer): - # PBKDF2_HMAC uses the password as key. We can re-use the same - # digest objects and just update copies to skip initialization. - icpy = inner.copy() - ocpy = outer.copy() - icpy.update(msg) - ocpy.update(icpy.digest()) - return ocpy.digest() - - if iterations < 1: - raise ValueError(iterations) - if dklen is None: - dklen = outer.digest_size - if dklen < 1: - raise ValueError(dklen) - - hex_format_string = "%%0%ix" % (new(hash_name).digest_size * 2) - - dkey = b'' - loop = 1 - while len(dkey) < dklen: - prev = prf(salt + struct.pack(b'>I', loop)) - rkey = int(binascii.hexlify(prev), 16) - for i in xrange(iterations - 1): - prev = prf(prev) - rkey ^= int(binascii.hexlify(prev), 16) - loop += 1 - dkey += binascii.unhexlify(hex_format_string % rkey) - - return dkey[:dklen] - -# Cleanup locals() -del __always_supported, __func_name, __get_hash -del __py_new, __hash_new, __get_openssl_constructor diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py deleted file mode 100644 index f87e9ee..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/heapq.py +++ /dev/null @@ -1,485 +0,0 @@ -# -*- coding: latin-1 -*- - -"""Heap queue algorithm (a.k.a. priority queue). - -Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for -all k, counting elements from 0. For the sake of comparison, -non-existing elements are considered to be infinite. The interesting -property of a heap is that a[0] is always its smallest element. - -Usage: - -heap = [] # creates an empty heap -heappush(heap, item) # pushes a new item on the heap -item = heappop(heap) # pops the smallest item from the heap -item = heap[0] # smallest item on the heap without popping it -heapify(x) # transforms list into a heap, in-place, in linear time -item = heapreplace(heap, item) # pops and returns smallest item, and adds - # new item; the heap size is unchanged - -Our API differs from textbook heap algorithms as follows: - -- We use 0-based indexing. This makes the relationship between the - index for a node and the indexes for its children slightly less - obvious, but is more suitable since Python uses 0-based indexing. - -- Our heappop() method returns the smallest item, not the largest. - -These two make it possible to view the heap as a regular Python list -without surprises: heap[0] is the smallest item, and heap.sort() -maintains the heap invariant! -""" - -# Original code by Kevin O'Connor, augmented by Tim Peters and Raymond Hettinger - -__about__ = """Heap queues - -[explanation by François Pinard] - -Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for -all k, counting elements from 0. For the sake of comparison, -non-existing elements are considered to be infinite. The interesting -property of a heap is that a[0] is always its smallest element. - -The strange invariant above is meant to be an efficient memory -representation for a tournament. The numbers below are `k', not a[k]: - - 0 - - 1 2 - - 3 4 5 6 - - 7 8 9 10 11 12 13 14 - - 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 - - -In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In -an usual binary tournament we see in sports, each cell is the winner -over the two cells it tops, and we can trace the winner down the tree -to see all opponents s/he had. However, in many computer applications -of such tournaments, we do not need to trace the history of a winner. -To be more memory efficient, when a winner is promoted, we try to -replace it by something else at a lower level, and the rule becomes -that a cell and the two cells it tops contain three different items, -but the top cell "wins" over the two topped cells. - -If this heap invariant is protected at all time, index 0 is clearly -the overall winner. The simplest algorithmic way to remove it and -find the "next" winner is to move some loser (let's say cell 30 in the -diagram above) into the 0 position, and then percolate this new 0 down -the tree, exchanging values, until the invariant is re-established. -This is clearly logarithmic on the total number of items in the tree. -By iterating over all items, you get an O(n ln n) sort. - -A nice feature of this sort is that you can efficiently insert new -items while the sort is going on, provided that the inserted items are -not "better" than the last 0'th element you extracted. This is -especially useful in simulation contexts, where the tree holds all -incoming events, and the "win" condition means the smallest scheduled -time. When an event schedule other events for execution, they are -scheduled into the future, so they can easily go into the heap. So, a -heap is a good structure for implementing schedulers (this is what I -used for my MIDI sequencer :-). - -Various structures for implementing schedulers have been extensively -studied, and heaps are good for this, as they are reasonably speedy, -the speed is almost constant, and the worst case is not much different -than the average case. However, there are other representations which -are more efficient overall, yet the worst cases might be terrible. - -Heaps are also very useful in big disk sorts. You most probably all -know that a big sort implies producing "runs" (which are pre-sorted -sequences, which size is usually related to the amount of CPU memory), -followed by a merging passes for these runs, which merging is often -very cleverly organised[1]. It is very important that the initial -sort produces the longest runs possible. Tournaments are a good way -to that. If, using all the memory available to hold a tournament, you -replace and percolate items that happen to fit the current run, you'll -produce runs which are twice the size of the memory for random input, -and much better for input fuzzily ordered. - -Moreover, if you output the 0'th item on disk and get an input which -may not fit in the current tournament (because the value "wins" over -the last output value), it cannot fit in the heap, so the size of the -heap decreases. The freed memory could be cleverly reused immediately -for progressively building a second heap, which grows at exactly the -same rate the first heap is melting. When the first heap completely -vanishes, you switch heaps and start a new run. Clever and quite -effective! - -In a word, heaps are useful memory structures to know. I use them in -a few applications, and I think it is good to keep a `heap' module -around. :-) - --------------------- -[1] The disk balancing algorithms which are current, nowadays, are -more annoying than clever, and this is a consequence of the seeking -capabilities of the disks. On devices which cannot seek, like big -tape drives, the story was quite different, and one had to be very -clever to ensure (far in advance) that each tape movement will be the -most effective possible (that is, will best participate at -"progressing" the merge). Some tapes were even able to read -backwards, and this was also used to avoid the rewinding time. -Believe me, real good tape sorts were quite spectacular to watch! -From all times, sorting has always been a Great Art! :-) -""" - -__all__ = ['heappush', 'heappop', 'heapify', 'heapreplace', 'merge', - 'nlargest', 'nsmallest', 'heappushpop'] - -from itertools import islice, count, imap, izip, tee, chain -from operator import itemgetter - -def cmp_lt(x, y): - # Use __lt__ if available; otherwise, try __le__. - # In Py3.x, only __lt__ will be called. - return (x < y) if hasattr(x, '__lt__') else (not y <= x) - -def heappush(heap, item): - """Push item onto heap, maintaining the heap invariant.""" - heap.append(item) - _siftdown(heap, 0, len(heap)-1) - -def heappop(heap): - """Pop the smallest item off the heap, maintaining the heap invariant.""" - lastelt = heap.pop() # raises appropriate IndexError if heap is empty - if heap: - returnitem = heap[0] - heap[0] = lastelt - _siftup(heap, 0) - else: - returnitem = lastelt - return returnitem - -def heapreplace(heap, item): - """Pop and return the current smallest value, and add the new item. - - This is more efficient than heappop() followed by heappush(), and can be - more appropriate when using a fixed-size heap. Note that the value - returned may be larger than item! That constrains reasonable uses of - this routine unless written as part of a conditional replacement: - - if item > heap[0]: - item = heapreplace(heap, item) - """ - returnitem = heap[0] # raises appropriate IndexError if heap is empty - heap[0] = item - _siftup(heap, 0) - return returnitem - -def heappushpop(heap, item): - """Fast version of a heappush followed by a heappop.""" - if heap and cmp_lt(heap[0], item): - item, heap[0] = heap[0], item - _siftup(heap, 0) - return item - -def heapify(x): - """Transform list into a heap, in-place, in O(len(x)) time.""" - n = len(x) - # Transform bottom-up. The largest index there's any point to looking at - # is the largest with a child index in-range, so must have 2*i + 1 < n, - # or i < (n-1)/2. If n is even = 2*j, this is (2*j-1)/2 = j-1/2 so - # j-1 is the largest, which is n//2 - 1. If n is odd = 2*j+1, this is - # (2*j+1-1)/2 = j so j-1 is the largest, and that's again n//2-1. - for i in reversed(xrange(n//2)): - _siftup(x, i) - -def _heappushpop_max(heap, item): - """Maxheap version of a heappush followed by a heappop.""" - if heap and cmp_lt(item, heap[0]): - item, heap[0] = heap[0], item - _siftup_max(heap, 0) - return item - -def _heapify_max(x): - """Transform list into a maxheap, in-place, in O(len(x)) time.""" - n = len(x) - for i in reversed(range(n//2)): - _siftup_max(x, i) - -def nlargest(n, iterable): - """Find the n largest elements in a dataset. - - Equivalent to: sorted(iterable, reverse=True)[:n] - """ - if n < 0: - return [] - it = iter(iterable) - result = list(islice(it, n)) - if not result: - return result - heapify(result) - _heappushpop = heappushpop - for elem in it: - _heappushpop(result, elem) - result.sort(reverse=True) - return result - -def nsmallest(n, iterable): - """Find the n smallest elements in a dataset. - - Equivalent to: sorted(iterable)[:n] - """ - if n < 0: - return [] - it = iter(iterable) - result = list(islice(it, n)) - if not result: - return result - _heapify_max(result) - _heappushpop = _heappushpop_max - for elem in it: - _heappushpop(result, elem) - result.sort() - return result - -# 'heap' is a heap at all indices >= startpos, except possibly for pos. pos -# is the index of a leaf with a possibly out-of-order value. Restore the -# heap invariant. -def _siftdown(heap, startpos, pos): - newitem = heap[pos] - # Follow the path to the root, moving parents down until finding a place - # newitem fits. - while pos > startpos: - parentpos = (pos - 1) >> 1 - parent = heap[parentpos] - if cmp_lt(newitem, parent): - heap[pos] = parent - pos = parentpos - continue - break - heap[pos] = newitem - -# The child indices of heap index pos are already heaps, and we want to make -# a heap at index pos too. We do this by bubbling the smaller child of -# pos up (and so on with that child's children, etc) until hitting a leaf, -# then using _siftdown to move the oddball originally at index pos into place. -# -# We *could* break out of the loop as soon as we find a pos where newitem <= -# both its children, but turns out that's not a good idea, and despite that -# many books write the algorithm that way. During a heap pop, the last array -# element is sifted in, and that tends to be large, so that comparing it -# against values starting from the root usually doesn't pay (= usually doesn't -# get us out of the loop early). See Knuth, Volume 3, where this is -# explained and quantified in an exercise. -# -# Cutting the # of comparisons is important, since these routines have no -# way to extract "the priority" from an array element, so that intelligence -# is likely to be hiding in custom __cmp__ methods, or in array elements -# storing (priority, record) tuples. Comparisons are thus potentially -# expensive. -# -# On random arrays of length 1000, making this change cut the number of -# comparisons made by heapify() a little, and those made by exhaustive -# heappop() a lot, in accord with theory. Here are typical results from 3 -# runs (3 just to demonstrate how small the variance is): -# -# Compares needed by heapify Compares needed by 1000 heappops -# -------------------------- -------------------------------- -# 1837 cut to 1663 14996 cut to 8680 -# 1855 cut to 1659 14966 cut to 8678 -# 1847 cut to 1660 15024 cut to 8703 -# -# Building the heap by using heappush() 1000 times instead required -# 2198, 2148, and 2219 compares: heapify() is more efficient, when -# you can use it. -# -# The total compares needed by list.sort() on the same lists were 8627, -# 8627, and 8632 (this should be compared to the sum of heapify() and -# heappop() compares): list.sort() is (unsurprisingly!) more efficient -# for sorting. - -def _siftup(heap, pos): - endpos = len(heap) - startpos = pos - newitem = heap[pos] - # Bubble up the smaller child until hitting a leaf. - childpos = 2*pos + 1 # leftmost child position - while childpos < endpos: - # Set childpos to index of smaller child. - rightpos = childpos + 1 - if rightpos < endpos and not cmp_lt(heap[childpos], heap[rightpos]): - childpos = rightpos - # Move the smaller child up. - heap[pos] = heap[childpos] - pos = childpos - childpos = 2*pos + 1 - # The leaf at pos is empty now. Put newitem there, and bubble it up - # to its final resting place (by sifting its parents down). - heap[pos] = newitem - _siftdown(heap, startpos, pos) - -def _siftdown_max(heap, startpos, pos): - 'Maxheap variant of _siftdown' - newitem = heap[pos] - # Follow the path to the root, moving parents down until finding a place - # newitem fits. - while pos > startpos: - parentpos = (pos - 1) >> 1 - parent = heap[parentpos] - if cmp_lt(parent, newitem): - heap[pos] = parent - pos = parentpos - continue - break - heap[pos] = newitem - -def _siftup_max(heap, pos): - 'Maxheap variant of _siftup' - endpos = len(heap) - startpos = pos - newitem = heap[pos] - # Bubble up the larger child until hitting a leaf. - childpos = 2*pos + 1 # leftmost child position - while childpos < endpos: - # Set childpos to index of larger child. - rightpos = childpos + 1 - if rightpos < endpos and not cmp_lt(heap[rightpos], heap[childpos]): - childpos = rightpos - # Move the larger child up. - heap[pos] = heap[childpos] - pos = childpos - childpos = 2*pos + 1 - # The leaf at pos is empty now. Put newitem there, and bubble it up - # to its final resting place (by sifting its parents down). - heap[pos] = newitem - _siftdown_max(heap, startpos, pos) - -# If available, use C implementation -try: - from _heapq import * -except ImportError: - pass - -def merge(*iterables): - '''Merge multiple sorted inputs into a single sorted output. - - Similar to sorted(itertools.chain(*iterables)) but returns a generator, - does not pull the data into memory all at once, and assumes that each of - the input streams is already sorted (smallest to largest). - - >>> list(merge([1,3,5,7], [0,2,4,8], [5,10,15,20], [], [25])) - [0, 1, 2, 3, 4, 5, 5, 7, 8, 10, 15, 20, 25] - - ''' - _heappop, _heapreplace, _StopIteration = heappop, heapreplace, StopIteration - _len = len - - h = [] - h_append = h.append - for itnum, it in enumerate(map(iter, iterables)): - try: - next = it.next - h_append([next(), itnum, next]) - except _StopIteration: - pass - heapify(h) - - while _len(h) > 1: - try: - while 1: - v, itnum, next = s = h[0] - yield v - s[0] = next() # raises StopIteration when exhausted - _heapreplace(h, s) # restore heap condition - except _StopIteration: - _heappop(h) # remove empty iterator - if h: - # fast case when only a single iterator remains - v, itnum, next = h[0] - yield v - for v in next.__self__: - yield v - -# Extend the implementations of nsmallest and nlargest to use a key= argument -_nsmallest = nsmallest -def nsmallest(n, iterable, key=None): - """Find the n smallest elements in a dataset. - - Equivalent to: sorted(iterable, key=key)[:n] - """ - # Short-cut for n==1 is to use min() when len(iterable)>0 - if n == 1: - it = iter(iterable) - head = list(islice(it, 1)) - if not head: - return [] - if key is None: - return [min(chain(head, it))] - return [min(chain(head, it), key=key)] - - # When n>=size, it's faster to use sorted() - try: - size = len(iterable) - except (TypeError, AttributeError): - pass - else: - if n >= size: - return sorted(iterable, key=key)[:n] - - # When key is none, use simpler decoration - if key is None: - it = izip(iterable, count()) # decorate - result = _nsmallest(n, it) - return map(itemgetter(0), result) # undecorate - - # General case, slowest method - in1, in2 = tee(iterable) - it = izip(imap(key, in1), count(), in2) # decorate - result = _nsmallest(n, it) - return map(itemgetter(2), result) # undecorate - -_nlargest = nlargest -def nlargest(n, iterable, key=None): - """Find the n largest elements in a dataset. - - Equivalent to: sorted(iterable, key=key, reverse=True)[:n] - """ - - # Short-cut for n==1 is to use max() when len(iterable)>0 - if n == 1: - it = iter(iterable) - head = list(islice(it, 1)) - if not head: - return [] - if key is None: - return [max(chain(head, it))] - return [max(chain(head, it), key=key)] - - # When n>=size, it's faster to use sorted() - try: - size = len(iterable) - except (TypeError, AttributeError): - pass - else: - if n >= size: - return sorted(iterable, key=key, reverse=True)[:n] - - # When key is none, use simpler decoration - if key is None: - it = izip(iterable, count(0,-1)) # decorate - result = _nlargest(n, it) - return map(itemgetter(0), result) # undecorate - - # General case, slowest method - in1, in2 = tee(iterable) - it = izip(imap(key, in1), count(0,-1), in2) # decorate - result = _nlargest(n, it) - return map(itemgetter(2), result) # undecorate - -if __name__ == "__main__": - # Simple sanity test - heap = [] - data = [1, 3, 5, 7, 9, 2, 4, 6, 8, 0] - for item in data: - heappush(heap, item) - sort = [] - while heap: - sort.append(heappop(heap)) - print sort - - import doctest - doctest.testmod() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py deleted file mode 100644 index a44aea4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/importlib/__init__.py +++ /dev/null @@ -1,38 +0,0 @@ -"""Backport of importlib.import_module from 3.x.""" -# While not critical (and in no way guaranteed!), it would be nice to keep this -# code compatible with Python 2.3. -import sys - -def _resolve_name(name, package, level): - """Return the absolute name of the module to be imported.""" - if not hasattr(package, 'rindex'): - raise ValueError("'package' not set to a string") - dot = len(package) - for x in xrange(level, 1, -1): - try: - dot = package.rindex('.', 0, dot) - except ValueError: - raise ValueError("attempted relative import beyond top-level " - "package") - return "%s.%s" % (package[:dot], name) - - -def import_module(name, package=None): - """Import a module. - - The 'package' argument is required when performing a relative import. It - specifies the package to use as the anchor point from which to resolve the - relative import to an absolute import. - - """ - if name.startswith('.'): - if not package: - raise TypeError("relative imports require the 'package' argument") - level = 0 - for character in name: - if character != '.': - break - level += 1 - name = _resolve_name(name[level:], package, level) - __import__(name) - return sys.modules[name] diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py deleted file mode 100644 index ada3873..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/inspect.py +++ /dev/null @@ -1,1059 +0,0 @@ -# -*- coding: iso-8859-1 -*- -"""Get useful information from live Python objects. - -This module encapsulates the interface provided by the internal special -attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion. -It also provides some help for examining source code and class layout. - -Here are some of the useful functions provided by this module: - - ismodule(), isclass(), ismethod(), isfunction(), isgeneratorfunction(), - isgenerator(), istraceback(), isframe(), iscode(), isbuiltin(), - isroutine() - check object types - getmembers() - get members of an object that satisfy a given condition - - getfile(), getsourcefile(), getsource() - find an object's source code - getdoc(), getcomments() - get documentation on an object - getmodule() - determine the module that an object came from - getclasstree() - arrange classes so as to represent their hierarchy - - getargspec(), getargvalues(), getcallargs() - get info about function arguments - formatargspec(), formatargvalues() - format an argument spec - getouterframes(), getinnerframes() - get info about frames - currentframe() - get the current stack frame - stack(), trace() - get info about frames on the stack or in a traceback -""" - -# This module is in the public domain. No warranties. - -__author__ = 'Ka-Ping Yee ' -__date__ = '1 Jan 2001' - -import sys -import os -import types -import string -import re -import dis -import imp -import tokenize -import linecache -from operator import attrgetter -from collections import namedtuple - -# These constants are from Include/code.h. -CO_OPTIMIZED, CO_NEWLOCALS, CO_VARARGS, CO_VARKEYWORDS = 0x1, 0x2, 0x4, 0x8 -CO_NESTED, CO_GENERATOR, CO_NOFREE = 0x10, 0x20, 0x40 -# See Include/object.h -TPFLAGS_IS_ABSTRACT = 1 << 20 - -# ----------------------------------------------------------- type-checking -def ismodule(object): - """Return true if the object is a module. - - Module objects provide these attributes: - __doc__ documentation string - __file__ filename (missing for built-in modules)""" - return isinstance(object, types.ModuleType) - -def isclass(object): - """Return true if the object is a class. - - Class objects provide these attributes: - __doc__ documentation string - __module__ name of module in which this class was defined""" - return isinstance(object, (type, types.ClassType)) - -def ismethod(object): - """Return true if the object is an instance method. - - Instance method objects provide these attributes: - __doc__ documentation string - __name__ name with which this method was defined - im_class class object in which this method belongs - im_func function object containing implementation of method - im_self instance to which this method is bound, or None""" - return isinstance(object, types.MethodType) - -def ismethoddescriptor(object): - """Return true if the object is a method descriptor. - - But not if ismethod() or isclass() or isfunction() are true. - - This is new in Python 2.2, and, for example, is true of int.__add__. - An object passing this test has a __get__ attribute but not a __set__ - attribute, but beyond that the set of attributes varies. __name__ is - usually sensible, and __doc__ often is. - - Methods implemented via descriptors that also pass one of the other - tests return false from the ismethoddescriptor() test, simply because - the other tests promise more -- you can, e.g., count on having the - im_func attribute (etc) when an object passes ismethod().""" - return (hasattr(object, "__get__") - and not hasattr(object, "__set__") # else it's a data descriptor - and not ismethod(object) # mutual exclusion - and not isfunction(object) - and not isclass(object)) - -def isdatadescriptor(object): - """Return true if the object is a data descriptor. - - Data descriptors have both a __get__ and a __set__ attribute. Examples are - properties (defined in Python) and getsets and members (defined in C). - Typically, data descriptors will also have __name__ and __doc__ attributes - (properties, getsets, and members have both of these attributes), but this - is not guaranteed.""" - return (hasattr(object, "__set__") and hasattr(object, "__get__")) - -if hasattr(types, 'MemberDescriptorType'): - # CPython and equivalent - def ismemberdescriptor(object): - """Return true if the object is a member descriptor. - - Member descriptors are specialized descriptors defined in extension - modules.""" - return isinstance(object, types.MemberDescriptorType) -else: - # Other implementations - def ismemberdescriptor(object): - """Return true if the object is a member descriptor. - - Member descriptors are specialized descriptors defined in extension - modules.""" - return False - -if hasattr(types, 'GetSetDescriptorType'): - # CPython and equivalent - def isgetsetdescriptor(object): - """Return true if the object is a getset descriptor. - - getset descriptors are specialized descriptors defined in extension - modules.""" - return isinstance(object, types.GetSetDescriptorType) -else: - # Other implementations - def isgetsetdescriptor(object): - """Return true if the object is a getset descriptor. - - getset descriptors are specialized descriptors defined in extension - modules.""" - return False - -def isfunction(object): - """Return true if the object is a user-defined function. - - Function objects provide these attributes: - __doc__ documentation string - __name__ name with which this function was defined - func_code code object containing compiled function bytecode - func_defaults tuple of any default values for arguments - func_doc (same as __doc__) - func_globals global namespace in which this function was defined - func_name (same as __name__)""" - return isinstance(object, types.FunctionType) - -def isgeneratorfunction(object): - """Return true if the object is a user-defined generator function. - - Generator function objects provides same attributes as functions. - - See help(isfunction) for attributes listing.""" - return bool((isfunction(object) or ismethod(object)) and - object.func_code.co_flags & CO_GENERATOR) - -def isgenerator(object): - """Return true if the object is a generator. - - Generator objects provide these attributes: - __iter__ defined to support iteration over container - close raises a new GeneratorExit exception inside the - generator to terminate the iteration - gi_code code object - gi_frame frame object or possibly None once the generator has - been exhausted - gi_running set to 1 when generator is executing, 0 otherwise - next return the next item from the container - send resumes the generator and "sends" a value that becomes - the result of the current yield-expression - throw used to raise an exception inside the generator""" - return isinstance(object, types.GeneratorType) - -def istraceback(object): - """Return true if the object is a traceback. - - Traceback objects provide these attributes: - tb_frame frame object at this level - tb_lasti index of last attempted instruction in bytecode - tb_lineno current line number in Python source code - tb_next next inner traceback object (called by this level)""" - return isinstance(object, types.TracebackType) - -def isframe(object): - """Return true if the object is a frame object. - - Frame objects provide these attributes: - f_back next outer frame object (this frame's caller) - f_builtins built-in namespace seen by this frame - f_code code object being executed in this frame - f_exc_traceback traceback if raised in this frame, or None - f_exc_type exception type if raised in this frame, or None - f_exc_value exception value if raised in this frame, or None - f_globals global namespace seen by this frame - f_lasti index of last attempted instruction in bytecode - f_lineno current line number in Python source code - f_locals local namespace seen by this frame - f_restricted 0 or 1 if frame is in restricted execution mode - f_trace tracing function for this frame, or None""" - return isinstance(object, types.FrameType) - -def iscode(object): - """Return true if the object is a code object. - - Code objects provide these attributes: - co_argcount number of arguments (not including * or ** args) - co_code string of raw compiled bytecode - co_consts tuple of constants used in the bytecode - co_filename name of file in which this code object was created - co_firstlineno number of first line in Python source code - co_flags bitmap: 1=optimized | 2=newlocals | 4=*arg | 8=**arg - co_lnotab encoded mapping of line numbers to bytecode indices - co_name name with which this code object was defined - co_names tuple of names of local variables - co_nlocals number of local variables - co_stacksize virtual machine stack space required - co_varnames tuple of names of arguments and local variables""" - return isinstance(object, types.CodeType) - -def isbuiltin(object): - """Return true if the object is a built-in function or method. - - Built-in functions and methods provide these attributes: - __doc__ documentation string - __name__ original name of this function or method - __self__ instance to which a method is bound, or None""" - return isinstance(object, types.BuiltinFunctionType) - -def isroutine(object): - """Return true if the object is any kind of function or method.""" - return (isbuiltin(object) - or isfunction(object) - or ismethod(object) - or ismethoddescriptor(object)) - -def isabstract(object): - """Return true if the object is an abstract base class (ABC).""" - return bool(isinstance(object, type) and object.__flags__ & TPFLAGS_IS_ABSTRACT) - -def getmembers(object, predicate=None): - """Return all members of an object as (name, value) pairs sorted by name. - Optionally, only return members that satisfy a given predicate.""" - results = [] - for key in dir(object): - try: - value = getattr(object, key) - except AttributeError: - continue - if not predicate or predicate(value): - results.append((key, value)) - results.sort() - return results - -Attribute = namedtuple('Attribute', 'name kind defining_class object') - -def classify_class_attrs(cls): - """Return list of attribute-descriptor tuples. - - For each name in dir(cls), the return list contains a 4-tuple - with these elements: - - 0. The name (a string). - - 1. The kind of attribute this is, one of these strings: - 'class method' created via classmethod() - 'static method' created via staticmethod() - 'property' created via property() - 'method' any other flavor of method - 'data' not a method - - 2. The class which defined this attribute (a class). - - 3. The object as obtained directly from the defining class's - __dict__, not via getattr. This is especially important for - data attributes: C.data is just a data object, but - C.__dict__['data'] may be a data descriptor with additional - info, like a __doc__ string. - """ - - mro = getmro(cls) - names = dir(cls) - result = [] - for name in names: - # Get the object associated with the name, and where it was defined. - # Getting an obj from the __dict__ sometimes reveals more than - # using getattr. Static and class methods are dramatic examples. - # Furthermore, some objects may raise an Exception when fetched with - # getattr(). This is the case with some descriptors (bug #1785). - # Thus, we only use getattr() as a last resort. - homecls = None - for base in (cls,) + mro: - if name in base.__dict__: - obj = base.__dict__[name] - homecls = base - break - else: - obj = getattr(cls, name) - homecls = getattr(obj, "__objclass__", homecls) - - # Classify the object. - if isinstance(obj, staticmethod): - kind = "static method" - elif isinstance(obj, classmethod): - kind = "class method" - elif isinstance(obj, property): - kind = "property" - elif ismethoddescriptor(obj): - kind = "method" - elif isdatadescriptor(obj): - kind = "data" - else: - obj_via_getattr = getattr(cls, name) - if (ismethod(obj_via_getattr) or - ismethoddescriptor(obj_via_getattr)): - kind = "method" - else: - kind = "data" - obj = obj_via_getattr - - result.append(Attribute(name, kind, homecls, obj)) - - return result - -# ----------------------------------------------------------- class helpers -def _searchbases(cls, accum): - # Simulate the "classic class" search order. - if cls in accum: - return - accum.append(cls) - for base in cls.__bases__: - _searchbases(base, accum) - -def getmro(cls): - "Return tuple of base classes (including cls) in method resolution order." - if hasattr(cls, "__mro__"): - return cls.__mro__ - else: - result = [] - _searchbases(cls, result) - return tuple(result) - -# -------------------------------------------------- source code extraction -def indentsize(line): - """Return the indent size, in spaces, at the start of a line of text.""" - expline = string.expandtabs(line) - return len(expline) - len(string.lstrip(expline)) - -def getdoc(object): - """Get the documentation string for an object. - - All tabs are expanded to spaces. To clean up docstrings that are - indented to line up with blocks of code, any whitespace than can be - uniformly removed from the second line onwards is removed.""" - try: - doc = object.__doc__ - except AttributeError: - return None - if not isinstance(doc, types.StringTypes): - return None - return cleandoc(doc) - -def cleandoc(doc): - """Clean up indentation from docstrings. - - Any whitespace that can be uniformly removed from the second line - onwards is removed.""" - try: - lines = string.split(string.expandtabs(doc), '\n') - except UnicodeError: - return None - else: - # Find minimum indentation of any non-blank lines after first line. - margin = sys.maxint - for line in lines[1:]: - content = len(string.lstrip(line)) - if content: - indent = len(line) - content - margin = min(margin, indent) - # Remove indentation. - if lines: - lines[0] = lines[0].lstrip() - if margin < sys.maxint: - for i in range(1, len(lines)): lines[i] = lines[i][margin:] - # Remove any trailing or leading blank lines. - while lines and not lines[-1]: - lines.pop() - while lines and not lines[0]: - lines.pop(0) - return string.join(lines, '\n') - -def getfile(object): - """Work out which source or compiled file an object was defined in.""" - if ismodule(object): - if hasattr(object, '__file__'): - return object.__file__ - raise TypeError('{!r} is a built-in module'.format(object)) - if isclass(object): - object = sys.modules.get(object.__module__) - if hasattr(object, '__file__'): - return object.__file__ - raise TypeError('{!r} is a built-in class'.format(object)) - if ismethod(object): - object = object.im_func - if isfunction(object): - object = object.func_code - if istraceback(object): - object = object.tb_frame - if isframe(object): - object = object.f_code - if iscode(object): - return object.co_filename - raise TypeError('{!r} is not a module, class, method, ' - 'function, traceback, frame, or code object'.format(object)) - -ModuleInfo = namedtuple('ModuleInfo', 'name suffix mode module_type') - -def getmoduleinfo(path): - """Get the module name, suffix, mode, and module type for a given file.""" - filename = os.path.basename(path) - suffixes = map(lambda info: - (-len(info[0]), info[0], info[1], info[2]), - imp.get_suffixes()) - suffixes.sort() # try longest suffixes first, in case they overlap - for neglen, suffix, mode, mtype in suffixes: - if filename[neglen:] == suffix: - return ModuleInfo(filename[:neglen], suffix, mode, mtype) - -def getmodulename(path): - """Return the module name for a given file, or None.""" - info = getmoduleinfo(path) - if info: return info[0] - -def getsourcefile(object): - """Return the filename that can be used to locate an object's source. - Return None if no way can be identified to get the source. - """ - filename = getfile(object) - if string.lower(filename[-4:]) in ('.pyc', '.pyo'): - filename = filename[:-4] + '.py' - for suffix, mode, kind in imp.get_suffixes(): - if 'b' in mode and string.lower(filename[-len(suffix):]) == suffix: - # Looks like a binary file. We want to only return a text file. - return None - if os.path.exists(filename): - return filename - # only return a non-existent filename if the module has a PEP 302 loader - if hasattr(getmodule(object, filename), '__loader__'): - return filename - # or it is in the linecache - if filename in linecache.cache: - return filename - -def getabsfile(object, _filename=None): - """Return an absolute path to the source or compiled file for an object. - - The idea is for each object to have a unique origin, so this routine - normalizes the result as much as possible.""" - if _filename is None: - _filename = getsourcefile(object) or getfile(object) - return os.path.normcase(os.path.abspath(_filename)) - -modulesbyfile = {} -_filesbymodname = {} - -def getmodule(object, _filename=None): - """Return the module an object was defined in, or None if not found.""" - if ismodule(object): - return object - if hasattr(object, '__module__'): - return sys.modules.get(object.__module__) - # Try the filename to modulename cache - if _filename is not None and _filename in modulesbyfile: - return sys.modules.get(modulesbyfile[_filename]) - # Try the cache again with the absolute file name - try: - file = getabsfile(object, _filename) - except TypeError: - return None - if file in modulesbyfile: - return sys.modules.get(modulesbyfile[file]) - # Update the filename to module name cache and check yet again - # Copy sys.modules in order to cope with changes while iterating - for modname, module in sys.modules.items(): - if ismodule(module) and hasattr(module, '__file__'): - f = module.__file__ - if f == _filesbymodname.get(modname, None): - # Have already mapped this module, so skip it - continue - _filesbymodname[modname] = f - f = getabsfile(module) - # Always map to the name the module knows itself by - modulesbyfile[f] = modulesbyfile[ - os.path.realpath(f)] = module.__name__ - if file in modulesbyfile: - return sys.modules.get(modulesbyfile[file]) - # Check the main module - main = sys.modules['__main__'] - if not hasattr(object, '__name__'): - return None - if hasattr(main, object.__name__): - mainobject = getattr(main, object.__name__) - if mainobject is object: - return main - # Check builtins - builtin = sys.modules['__builtin__'] - if hasattr(builtin, object.__name__): - builtinobject = getattr(builtin, object.__name__) - if builtinobject is object: - return builtin - -def findsource(object): - """Return the entire source file and starting line number for an object. - - The argument may be a module, class, method, function, traceback, frame, - or code object. The source code is returned as a list of all the lines - in the file and the line number indexes a line in that list. An IOError - is raised if the source code cannot be retrieved.""" - - file = getfile(object) - sourcefile = getsourcefile(object) - if not sourcefile and file[:1] + file[-1:] != '<>': - raise IOError('source code not available') - file = sourcefile if sourcefile else file - - module = getmodule(object, file) - if module: - lines = linecache.getlines(file, module.__dict__) - else: - lines = linecache.getlines(file) - if not lines: - raise IOError('could not get source code') - - if ismodule(object): - return lines, 0 - - if isclass(object): - name = object.__name__ - pat = re.compile(r'^(\s*)class\s*' + name + r'\b') - # make some effort to find the best matching class definition: - # use the one with the least indentation, which is the one - # that's most probably not inside a function definition. - candidates = [] - for i in range(len(lines)): - match = pat.match(lines[i]) - if match: - # if it's at toplevel, it's already the best one - if lines[i][0] == 'c': - return lines, i - # else add whitespace to candidate list - candidates.append((match.group(1), i)) - if candidates: - # this will sort by whitespace, and by line number, - # less whitespace first - candidates.sort() - return lines, candidates[0][1] - else: - raise IOError('could not find class definition') - - if ismethod(object): - object = object.im_func - if isfunction(object): - object = object.func_code - if istraceback(object): - object = object.tb_frame - if isframe(object): - object = object.f_code - if iscode(object): - if not hasattr(object, 'co_firstlineno'): - raise IOError('could not find function definition') - lnum = object.co_firstlineno - 1 - pat = re.compile(r'^(\s*def\s)|(.*(? 0: - if pat.match(lines[lnum]): break - lnum = lnum - 1 - return lines, lnum - raise IOError('could not find code object') - -def getcomments(object): - """Get lines of comments immediately preceding an object's source code. - - Returns None when source can't be found. - """ - try: - lines, lnum = findsource(object) - except (IOError, TypeError): - return None - - if ismodule(object): - # Look for a comment block at the top of the file. - start = 0 - if lines and lines[0][:2] == '#!': start = 1 - while start < len(lines) and string.strip(lines[start]) in ('', '#'): - start = start + 1 - if start < len(lines) and lines[start][:1] == '#': - comments = [] - end = start - while end < len(lines) and lines[end][:1] == '#': - comments.append(string.expandtabs(lines[end])) - end = end + 1 - return string.join(comments, '') - - # Look for a preceding block of comments at the same indentation. - elif lnum > 0: - indent = indentsize(lines[lnum]) - end = lnum - 1 - if end >= 0 and string.lstrip(lines[end])[:1] == '#' and \ - indentsize(lines[end]) == indent: - comments = [string.lstrip(string.expandtabs(lines[end]))] - if end > 0: - end = end - 1 - comment = string.lstrip(string.expandtabs(lines[end])) - while comment[:1] == '#' and indentsize(lines[end]) == indent: - comments[:0] = [comment] - end = end - 1 - if end < 0: break - comment = string.lstrip(string.expandtabs(lines[end])) - while comments and string.strip(comments[0]) == '#': - comments[:1] = [] - while comments and string.strip(comments[-1]) == '#': - comments[-1:] = [] - return string.join(comments, '') - -class EndOfBlock(Exception): pass - -class BlockFinder: - """Provide a tokeneater() method to detect the end of a code block.""" - def __init__(self): - self.indent = 0 - self.islambda = False - self.started = False - self.passline = False - self.last = 1 - - def tokeneater(self, type, token, srow_scol, erow_ecol, line): - srow, scol = srow_scol - erow, ecol = erow_ecol - if not self.started: - # look for the first "def", "class" or "lambda" - if token in ("def", "class", "lambda"): - if token == "lambda": - self.islambda = True - self.started = True - self.passline = True # skip to the end of the line - elif type == tokenize.NEWLINE: - self.passline = False # stop skipping when a NEWLINE is seen - self.last = srow - if self.islambda: # lambdas always end at the first NEWLINE - raise EndOfBlock - elif self.passline: - pass - elif type == tokenize.INDENT: - self.indent = self.indent + 1 - self.passline = True - elif type == tokenize.DEDENT: - self.indent = self.indent - 1 - # the end of matching indent/dedent pairs end a block - # (note that this only works for "def"/"class" blocks, - # not e.g. for "if: else:" or "try: finally:" blocks) - if self.indent <= 0: - raise EndOfBlock - elif self.indent == 0 and type not in (tokenize.COMMENT, tokenize.NL): - # any other token on the same indentation level end the previous - # block as well, except the pseudo-tokens COMMENT and NL. - raise EndOfBlock - -def getblock(lines): - """Extract the block of code at the top of the given list of lines.""" - blockfinder = BlockFinder() - try: - tokenize.tokenize(iter(lines).next, blockfinder.tokeneater) - except (EndOfBlock, IndentationError): - pass - return lines[:blockfinder.last] - -def getsourcelines(object): - """Return a list of source lines and starting line number for an object. - - The argument may be a module, class, method, function, traceback, frame, - or code object. The source code is returned as a list of the lines - corresponding to the object and the line number indicates where in the - original source file the first line of code was found. An IOError is - raised if the source code cannot be retrieved.""" - lines, lnum = findsource(object) - - if ismodule(object): return lines, 0 - else: return getblock(lines[lnum:]), lnum + 1 - -def getsource(object): - """Return the text of the source code for an object. - - The argument may be a module, class, method, function, traceback, frame, - or code object. The source code is returned as a single string. An - IOError is raised if the source code cannot be retrieved.""" - lines, lnum = getsourcelines(object) - return string.join(lines, '') - -# --------------------------------------------------- class tree extraction -def walktree(classes, children, parent): - """Recursive helper function for getclasstree().""" - results = [] - classes.sort(key=attrgetter('__module__', '__name__')) - for c in classes: - results.append((c, c.__bases__)) - if c in children: - results.append(walktree(children[c], children, c)) - return results - -def getclasstree(classes, unique=0): - """Arrange the given list of classes into a hierarchy of nested lists. - - Where a nested list appears, it contains classes derived from the class - whose entry immediately precedes the list. Each entry is a 2-tuple - containing a class and a tuple of its base classes. If the 'unique' - argument is true, exactly one entry appears in the returned structure - for each class in the given list. Otherwise, classes using multiple - inheritance and their descendants will appear multiple times.""" - children = {} - roots = [] - for c in classes: - if c.__bases__: - for parent in c.__bases__: - if not parent in children: - children[parent] = [] - if c not in children[parent]: - children[parent].append(c) - if unique and parent in classes: break - elif c not in roots: - roots.append(c) - for parent in children: - if parent not in classes: - roots.append(parent) - return walktree(roots, children, None) - -# ------------------------------------------------ argument list extraction -Arguments = namedtuple('Arguments', 'args varargs keywords') - -def getargs(co): - """Get information about the arguments accepted by a code object. - - Three things are returned: (args, varargs, varkw), where 'args' is - a list of argument names (possibly containing nested lists), and - 'varargs' and 'varkw' are the names of the * and ** arguments or None.""" - - if not iscode(co): - raise TypeError('{!r} is not a code object'.format(co)) - - nargs = co.co_argcount - names = co.co_varnames - args = list(names[:nargs]) - step = 0 - - # The following acrobatics are for anonymous (tuple) arguments. - for i in range(nargs): - if args[i][:1] in ('', '.'): - stack, remain, count = [], [], [] - while step < len(co.co_code): - op = ord(co.co_code[step]) - step = step + 1 - if op >= dis.HAVE_ARGUMENT: - opname = dis.opname[op] - value = ord(co.co_code[step]) + ord(co.co_code[step+1])*256 - step = step + 2 - if opname in ('UNPACK_TUPLE', 'UNPACK_SEQUENCE'): - remain.append(value) - count.append(value) - elif opname == 'STORE_FAST': - stack.append(names[value]) - - # Special case for sublists of length 1: def foo((bar)) - # doesn't generate the UNPACK_TUPLE bytecode, so if - # `remain` is empty here, we have such a sublist. - if not remain: - stack[0] = [stack[0]] - break - else: - remain[-1] = remain[-1] - 1 - while remain[-1] == 0: - remain.pop() - size = count.pop() - stack[-size:] = [stack[-size:]] - if not remain: break - remain[-1] = remain[-1] - 1 - if not remain: break - args[i] = stack[0] - - varargs = None - if co.co_flags & CO_VARARGS: - varargs = co.co_varnames[nargs] - nargs = nargs + 1 - varkw = None - if co.co_flags & CO_VARKEYWORDS: - varkw = co.co_varnames[nargs] - return Arguments(args, varargs, varkw) - -ArgSpec = namedtuple('ArgSpec', 'args varargs keywords defaults') - -def getargspec(func): - """Get the names and default values of a function's arguments. - - A tuple of four things is returned: (args, varargs, varkw, defaults). - 'args' is a list of the argument names (it may contain nested lists). - 'varargs' and 'varkw' are the names of the * and ** arguments or None. - 'defaults' is an n-tuple of the default values of the last n arguments. - """ - - if ismethod(func): - func = func.im_func - if not isfunction(func): - raise TypeError('{!r} is not a Python function'.format(func)) - args, varargs, varkw = getargs(func.func_code) - return ArgSpec(args, varargs, varkw, func.func_defaults) - -ArgInfo = namedtuple('ArgInfo', 'args varargs keywords locals') - -def getargvalues(frame): - """Get information about arguments passed into a particular frame. - - A tuple of four things is returned: (args, varargs, varkw, locals). - 'args' is a list of the argument names (it may contain nested lists). - 'varargs' and 'varkw' are the names of the * and ** arguments or None. - 'locals' is the locals dictionary of the given frame.""" - args, varargs, varkw = getargs(frame.f_code) - return ArgInfo(args, varargs, varkw, frame.f_locals) - -def joinseq(seq): - if len(seq) == 1: - return '(' + seq[0] + ',)' - else: - return '(' + string.join(seq, ', ') + ')' - -def strseq(object, convert, join=joinseq): - """Recursively walk a sequence, stringifying each element.""" - if type(object) in (list, tuple): - return join(map(lambda o, c=convert, j=join: strseq(o, c, j), object)) - else: - return convert(object) - -def formatargspec(args, varargs=None, varkw=None, defaults=None, - formatarg=str, - formatvarargs=lambda name: '*' + name, - formatvarkw=lambda name: '**' + name, - formatvalue=lambda value: '=' + repr(value), - join=joinseq): - """Format an argument spec from the 4 values returned by getargspec. - - The first four arguments are (args, varargs, varkw, defaults). The - other four arguments are the corresponding optional formatting functions - that are called to turn names and values into strings. The ninth - argument is an optional function to format the sequence of arguments.""" - specs = [] - if defaults: - firstdefault = len(args) - len(defaults) - for i, arg in enumerate(args): - spec = strseq(arg, formatarg, join) - if defaults and i >= firstdefault: - spec = spec + formatvalue(defaults[i - firstdefault]) - specs.append(spec) - if varargs is not None: - specs.append(formatvarargs(varargs)) - if varkw is not None: - specs.append(formatvarkw(varkw)) - return '(' + string.join(specs, ', ') + ')' - -def formatargvalues(args, varargs, varkw, locals, - formatarg=str, - formatvarargs=lambda name: '*' + name, - formatvarkw=lambda name: '**' + name, - formatvalue=lambda value: '=' + repr(value), - join=joinseq): - """Format an argument spec from the 4 values returned by getargvalues. - - The first four arguments are (args, varargs, varkw, locals). The - next four arguments are the corresponding optional formatting functions - that are called to turn names and values into strings. The ninth - argument is an optional function to format the sequence of arguments.""" - def convert(name, locals=locals, - formatarg=formatarg, formatvalue=formatvalue): - return formatarg(name) + formatvalue(locals[name]) - specs = [] - for i in range(len(args)): - specs.append(strseq(args[i], convert, join)) - if varargs: - specs.append(formatvarargs(varargs) + formatvalue(locals[varargs])) - if varkw: - specs.append(formatvarkw(varkw) + formatvalue(locals[varkw])) - return '(' + string.join(specs, ', ') + ')' - -def getcallargs(func, *positional, **named): - """Get the mapping of arguments to values. - - A dict is returned, with keys the function argument names (including the - names of the * and ** arguments, if any), and values the respective bound - values from 'positional' and 'named'.""" - args, varargs, varkw, defaults = getargspec(func) - f_name = func.__name__ - arg2value = {} - - # The following closures are basically because of tuple parameter unpacking. - assigned_tuple_params = [] - def assign(arg, value): - if isinstance(arg, str): - arg2value[arg] = value - else: - assigned_tuple_params.append(arg) - value = iter(value) - for i, subarg in enumerate(arg): - try: - subvalue = next(value) - except StopIteration: - raise ValueError('need more than %d %s to unpack' % - (i, 'values' if i > 1 else 'value')) - assign(subarg,subvalue) - try: - next(value) - except StopIteration: - pass - else: - raise ValueError('too many values to unpack') - def is_assigned(arg): - if isinstance(arg,str): - return arg in arg2value - return arg in assigned_tuple_params - if ismethod(func) and func.im_self is not None: - # implicit 'self' (or 'cls' for classmethods) argument - positional = (func.im_self,) + positional - num_pos = len(positional) - num_total = num_pos + len(named) - num_args = len(args) - num_defaults = len(defaults) if defaults else 0 - for arg, value in zip(args, positional): - assign(arg, value) - if varargs: - if num_pos > num_args: - assign(varargs, positional[-(num_pos-num_args):]) - else: - assign(varargs, ()) - elif 0 < num_args < num_pos: - raise TypeError('%s() takes %s %d %s (%d given)' % ( - f_name, 'at most' if defaults else 'exactly', num_args, - 'arguments' if num_args > 1 else 'argument', num_total)) - elif num_args == 0 and num_total: - if varkw: - if num_pos: - # XXX: We should use num_pos, but Python also uses num_total: - raise TypeError('%s() takes exactly 0 arguments ' - '(%d given)' % (f_name, num_total)) - else: - raise TypeError('%s() takes no arguments (%d given)' % - (f_name, num_total)) - for arg in args: - if isinstance(arg, str) and arg in named: - if is_assigned(arg): - raise TypeError("%s() got multiple values for keyword " - "argument '%s'" % (f_name, arg)) - else: - assign(arg, named.pop(arg)) - if defaults: # fill in any missing values with the defaults - for arg, value in zip(args[-num_defaults:], defaults): - if not is_assigned(arg): - assign(arg, value) - if varkw: - assign(varkw, named) - elif named: - unexpected = next(iter(named)) - if isinstance(unexpected, unicode): - unexpected = unexpected.encode(sys.getdefaultencoding(), 'replace') - raise TypeError("%s() got an unexpected keyword argument '%s'" % - (f_name, unexpected)) - unassigned = num_args - len([arg for arg in args if is_assigned(arg)]) - if unassigned: - num_required = num_args - num_defaults - raise TypeError('%s() takes %s %d %s (%d given)' % ( - f_name, 'at least' if defaults else 'exactly', num_required, - 'arguments' if num_required > 1 else 'argument', num_total)) - return arg2value - -# -------------------------------------------------- stack frame extraction - -Traceback = namedtuple('Traceback', 'filename lineno function code_context index') - -def getframeinfo(frame, context=1): - """Get information about a frame or traceback object. - - A tuple of five things is returned: the filename, the line number of - the current line, the function name, a list of lines of context from - the source code, and the index of the current line within that list. - The optional second argument specifies the number of lines of context - to return, which are centered around the current line.""" - if istraceback(frame): - lineno = frame.tb_lineno - frame = frame.tb_frame - else: - lineno = frame.f_lineno - if not isframe(frame): - raise TypeError('{!r} is not a frame or traceback object'.format(frame)) - - filename = getsourcefile(frame) or getfile(frame) - if context > 0: - start = lineno - 1 - context//2 - try: - lines, lnum = findsource(frame) - except IOError: - lines = index = None - else: - start = max(start, 1) - start = max(0, min(start, len(lines) - context)) - lines = lines[start:start+context] - index = lineno - 1 - start - else: - lines = index = None - - return Traceback(filename, lineno, frame.f_code.co_name, lines, index) - -def getlineno(frame): - """Get the line number from a frame object, allowing for optimization.""" - # FrameType.f_lineno is now a descriptor that grovels co_lnotab - return frame.f_lineno - -def getouterframes(frame, context=1): - """Get a list of records for a frame and all higher (calling) frames. - - Each record contains a frame object, filename, line number, function - name, a list of lines of context, and index within the context.""" - framelist = [] - while frame: - framelist.append((frame,) + getframeinfo(frame, context)) - frame = frame.f_back - return framelist - -def getinnerframes(tb, context=1): - """Get a list of records for a traceback's frame and all lower frames. - - Each record contains a frame object, filename, line number, function - name, a list of lines of context, and index within the context.""" - framelist = [] - while tb: - framelist.append((tb.tb_frame,) + getframeinfo(tb, context)) - tb = tb.tb_next - return framelist - -if hasattr(sys, '_getframe'): - currentframe = sys._getframe -else: - currentframe = lambda _=None: None - -def stack(context=1): - """Return a list of records for the stack above the caller's frame.""" - return getouterframes(sys._getframe(1), context) - -def trace(context=1): - """Return a list of records for the stack below the current exception.""" - return getinnerframes(sys.exc_info()[2], context) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py deleted file mode 100644 index e047147..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/io.py +++ /dev/null @@ -1,90 +0,0 @@ -"""The io module provides the Python interfaces to stream handling. The -builtin open function is defined in this module. - -At the top of the I/O hierarchy is the abstract base class IOBase. It -defines the basic interface to a stream. Note, however, that there is no -separation between reading and writing to streams; implementations are -allowed to raise an IOError if they do not support a given operation. - -Extending IOBase is RawIOBase which deals simply with the reading and -writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide -an interface to OS files. - -BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its -subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer -streams that are readable, writable, and both respectively. -BufferedRandom provides a buffered interface to random access -streams. BytesIO is a simple stream of in-memory bytes. - -Another IOBase subclass, TextIOBase, deals with the encoding and decoding -of streams into text. TextIOWrapper, which extends it, is a buffered text -interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO -is a in-memory stream for text. - -Argument names are not part of the specification, and only the arguments -of open() are intended to be used as keyword arguments. - -data: - -DEFAULT_BUFFER_SIZE - - An int containing the default buffer size used by the module's buffered - I/O classes. open() uses the file's blksize (as obtained by os.stat) if - possible. -""" -# New I/O library conforming to PEP 3116. - -__author__ = ("Guido van Rossum , " - "Mike Verdone , " - "Mark Russell , " - "Antoine Pitrou , " - "Amaury Forgeot d'Arc , " - "Benjamin Peterson ") - -__all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO", - "BytesIO", "StringIO", "BufferedIOBase", - "BufferedReader", "BufferedWriter", "BufferedRWPair", - "BufferedRandom", "TextIOBase", "TextIOWrapper", - "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"] - - -import _io -import abc - -from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation, - open, FileIO, BytesIO, StringIO, BufferedReader, - BufferedWriter, BufferedRWPair, BufferedRandom, - IncrementalNewlineDecoder, TextIOWrapper) - -OpenWrapper = _io.open # for compatibility with _pyio - -# for seek() -SEEK_SET = 0 -SEEK_CUR = 1 -SEEK_END = 2 - -# Declaring ABCs in C is tricky so we do it here. -# Method descriptions and default implementations are inherited from the C -# version however. -class IOBase(_io._IOBase): - __metaclass__ = abc.ABCMeta - __doc__ = _io._IOBase.__doc__ - -class RawIOBase(_io._RawIOBase, IOBase): - __doc__ = _io._RawIOBase.__doc__ - -class BufferedIOBase(_io._BufferedIOBase, IOBase): - __doc__ = _io._BufferedIOBase.__doc__ - -class TextIOBase(_io._TextIOBase, IOBase): - __doc__ = _io._TextIOBase.__doc__ - -RawIOBase.register(FileIO) - -for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom, - BufferedRWPair): - BufferedIOBase.register(klass) - -for klass in (StringIO, TextIOWrapper): - TextIOBase.register(klass) -del klass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py deleted file mode 100644 index dafae51..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/__init__.py +++ /dev/null @@ -1,351 +0,0 @@ -r"""JSON (JavaScript Object Notation) is a subset of -JavaScript syntax (ECMA-262 3rd edition) used as a lightweight data -interchange format. - -:mod:`json` exposes an API familiar to users of the standard library -:mod:`marshal` and :mod:`pickle` modules. It is the externally maintained -version of the :mod:`json` library contained in Python 2.6, but maintains -compatibility with Python 2.4 and Python 2.5 and (currently) has -significant performance advantages, even without using the optional C -extension for speedups. - -Encoding basic Python object hierarchies:: - - >>> import json - >>> json.dumps(['foo', {'bar': ('baz', None, 1.0, 2)}]) - '["foo", {"bar": ["baz", null, 1.0, 2]}]' - >>> print json.dumps("\"foo\bar") - "\"foo\bar" - >>> print json.dumps(u'\u1234') - "\u1234" - >>> print json.dumps('\\') - "\\" - >>> print json.dumps({"c": 0, "b": 0, "a": 0}, sort_keys=True) - {"a": 0, "b": 0, "c": 0} - >>> from StringIO import StringIO - >>> io = StringIO() - >>> json.dump(['streaming API'], io) - >>> io.getvalue() - '["streaming API"]' - -Compact encoding:: - - >>> import json - >>> json.dumps([1,2,3,{'4': 5, '6': 7}], sort_keys=True, separators=(',',':')) - '[1,2,3,{"4":5,"6":7}]' - -Pretty printing:: - - >>> import json - >>> print json.dumps({'4': 5, '6': 7}, sort_keys=True, - ... indent=4, separators=(',', ': ')) - { - "4": 5, - "6": 7 - } - -Decoding JSON:: - - >>> import json - >>> obj = [u'foo', {u'bar': [u'baz', None, 1.0, 2]}] - >>> json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]') == obj - True - >>> json.loads('"\\"foo\\bar"') == u'"foo\x08ar' - True - >>> from StringIO import StringIO - >>> io = StringIO('["streaming API"]') - >>> json.load(io)[0] == 'streaming API' - True - -Specializing JSON object decoding:: - - >>> import json - >>> def as_complex(dct): - ... if '__complex__' in dct: - ... return complex(dct['real'], dct['imag']) - ... return dct - ... - >>> json.loads('{"__complex__": true, "real": 1, "imag": 2}', - ... object_hook=as_complex) - (1+2j) - >>> from decimal import Decimal - >>> json.loads('1.1', parse_float=Decimal) == Decimal('1.1') - True - -Specializing JSON object encoding:: - - >>> import json - >>> def encode_complex(obj): - ... if isinstance(obj, complex): - ... return [obj.real, obj.imag] - ... raise TypeError(repr(o) + " is not JSON serializable") - ... - >>> json.dumps(2 + 1j, default=encode_complex) - '[2.0, 1.0]' - >>> json.JSONEncoder(default=encode_complex).encode(2 + 1j) - '[2.0, 1.0]' - >>> ''.join(json.JSONEncoder(default=encode_complex).iterencode(2 + 1j)) - '[2.0, 1.0]' - - -Using json.tool from the shell to validate and pretty-print:: - - $ echo '{"json":"obj"}' | python -m json.tool - { - "json": "obj" - } - $ echo '{ 1.2:3.4}' | python -m json.tool - Expecting property name enclosed in double quotes: line 1 column 3 (char 2) -""" -__version__ = '2.0.9' -__all__ = [ - 'dump', 'dumps', 'load', 'loads', - 'JSONDecoder', 'JSONEncoder', -] - -__author__ = 'Bob Ippolito ' - -from .decoder import JSONDecoder -from .encoder import JSONEncoder - -_default_encoder = JSONEncoder( - skipkeys=False, - ensure_ascii=True, - check_circular=True, - allow_nan=True, - indent=None, - separators=None, - encoding='utf-8', - default=None, -) - -def dump(obj, fp, skipkeys=False, ensure_ascii=True, check_circular=True, - allow_nan=True, cls=None, indent=None, separators=None, - encoding='utf-8', default=None, sort_keys=False, **kw): - """Serialize ``obj`` as a JSON formatted stream to ``fp`` (a - ``.write()``-supporting file-like object). - - If ``skipkeys`` is true then ``dict`` keys that are not basic types - (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) - will be skipped instead of raising a ``TypeError``. - - If ``ensure_ascii`` is true (the default), all non-ASCII characters in the - output are escaped with ``\uXXXX`` sequences, and the result is a ``str`` - instance consisting of ASCII characters only. If ``ensure_ascii`` is - ``False``, some chunks written to ``fp`` may be ``unicode`` instances. - This usually happens because the input contains unicode strings or the - ``encoding`` parameter is used. Unless ``fp.write()`` explicitly - understands ``unicode`` (as in ``codecs.getwriter``) this is likely to - cause an error. - - If ``check_circular`` is false, then the circular reference check - for container types will be skipped and a circular reference will - result in an ``OverflowError`` (or worse). - - If ``allow_nan`` is false, then it will be a ``ValueError`` to - serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) - in strict compliance of the JSON specification, instead of using the - JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). - - If ``indent`` is a non-negative integer, then JSON array elements and - object members will be pretty-printed with that indent level. An indent - level of 0 will only insert newlines. ``None`` is the most compact - representation. Since the default item separator is ``', '``, the - output might include trailing whitespace when ``indent`` is specified. - You can use ``separators=(',', ': ')`` to avoid this. - - If ``separators`` is an ``(item_separator, dict_separator)`` tuple - then it will be used instead of the default ``(', ', ': ')`` separators. - ``(',', ':')`` is the most compact JSON representation. - - ``encoding`` is the character encoding for str instances, default is UTF-8. - - ``default(obj)`` is a function that should return a serializable version - of obj or raise TypeError. The default simply raises TypeError. - - If *sort_keys* is ``True`` (default: ``False``), then the output of - dictionaries will be sorted by key. - - To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the - ``.default()`` method to serialize additional types), specify it with - the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. - - """ - # cached encoder - if (not skipkeys and ensure_ascii and - check_circular and allow_nan and - cls is None and indent is None and separators is None and - encoding == 'utf-8' and default is None and not sort_keys and not kw): - iterable = _default_encoder.iterencode(obj) - else: - if cls is None: - cls = JSONEncoder - iterable = cls(skipkeys=skipkeys, ensure_ascii=ensure_ascii, - check_circular=check_circular, allow_nan=allow_nan, indent=indent, - separators=separators, encoding=encoding, - default=default, sort_keys=sort_keys, **kw).iterencode(obj) - # could accelerate with writelines in some versions of Python, at - # a debuggability cost - for chunk in iterable: - fp.write(chunk) - - -def dumps(obj, skipkeys=False, ensure_ascii=True, check_circular=True, - allow_nan=True, cls=None, indent=None, separators=None, - encoding='utf-8', default=None, sort_keys=False, **kw): - """Serialize ``obj`` to a JSON formatted ``str``. - - If ``skipkeys`` is false then ``dict`` keys that are not basic types - (``str``, ``unicode``, ``int``, ``long``, ``float``, ``bool``, ``None``) - will be skipped instead of raising a ``TypeError``. - - If ``ensure_ascii`` is false, all non-ASCII characters are not escaped, and - the return value may be a ``unicode`` instance. See ``dump`` for details. - - If ``check_circular`` is false, then the circular reference check - for container types will be skipped and a circular reference will - result in an ``OverflowError`` (or worse). - - If ``allow_nan`` is false, then it will be a ``ValueError`` to - serialize out of range ``float`` values (``nan``, ``inf``, ``-inf``) in - strict compliance of the JSON specification, instead of using the - JavaScript equivalents (``NaN``, ``Infinity``, ``-Infinity``). - - If ``indent`` is a non-negative integer, then JSON array elements and - object members will be pretty-printed with that indent level. An indent - level of 0 will only insert newlines. ``None`` is the most compact - representation. Since the default item separator is ``', '``, the - output might include trailing whitespace when ``indent`` is specified. - You can use ``separators=(',', ': ')`` to avoid this. - - If ``separators`` is an ``(item_separator, dict_separator)`` tuple - then it will be used instead of the default ``(', ', ': ')`` separators. - ``(',', ':')`` is the most compact JSON representation. - - ``encoding`` is the character encoding for str instances, default is UTF-8. - - ``default(obj)`` is a function that should return a serializable version - of obj or raise TypeError. The default simply raises TypeError. - - If *sort_keys* is ``True`` (default: ``False``), then the output of - dictionaries will be sorted by key. - - To use a custom ``JSONEncoder`` subclass (e.g. one that overrides the - ``.default()`` method to serialize additional types), specify it with - the ``cls`` kwarg; otherwise ``JSONEncoder`` is used. - - """ - # cached encoder - if (not skipkeys and ensure_ascii and - check_circular and allow_nan and - cls is None and indent is None and separators is None and - encoding == 'utf-8' and default is None and not sort_keys and not kw): - return _default_encoder.encode(obj) - if cls is None: - cls = JSONEncoder - return cls( - skipkeys=skipkeys, ensure_ascii=ensure_ascii, - check_circular=check_circular, allow_nan=allow_nan, indent=indent, - separators=separators, encoding=encoding, default=default, - sort_keys=sort_keys, **kw).encode(obj) - - -_default_decoder = JSONDecoder(encoding=None, object_hook=None, - object_pairs_hook=None) - - -def load(fp, encoding=None, cls=None, object_hook=None, parse_float=None, - parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): - """Deserialize ``fp`` (a ``.read()``-supporting file-like object containing - a JSON document) to a Python object. - - If the contents of ``fp`` is encoded with an ASCII based encoding other - than utf-8 (e.g. latin-1), then an appropriate ``encoding`` name must - be specified. Encodings that are not ASCII based (such as UCS-2) are - not allowed, and should be wrapped with - ``codecs.getreader(fp)(encoding)``, or simply decoded to a ``unicode`` - object and passed to ``loads()`` - - ``object_hook`` is an optional function that will be called with the - result of any object literal decode (a ``dict``). The return value of - ``object_hook`` will be used instead of the ``dict``. This feature - can be used to implement custom decoders (e.g. JSON-RPC class hinting). - - ``object_pairs_hook`` is an optional function that will be called with the - result of any object literal decoded with an ordered list of pairs. The - return value of ``object_pairs_hook`` will be used instead of the ``dict``. - This feature can be used to implement custom decoders that rely on the - order that the key and value pairs are decoded (for example, - collections.OrderedDict will remember the order of insertion). If - ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. - - To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` - kwarg; otherwise ``JSONDecoder`` is used. - - """ - return loads(fp.read(), - encoding=encoding, cls=cls, object_hook=object_hook, - parse_float=parse_float, parse_int=parse_int, - parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, - **kw) - - -def loads(s, encoding=None, cls=None, object_hook=None, parse_float=None, - parse_int=None, parse_constant=None, object_pairs_hook=None, **kw): - """Deserialize ``s`` (a ``str`` or ``unicode`` instance containing a JSON - document) to a Python object. - - If ``s`` is a ``str`` instance and is encoded with an ASCII based encoding - other than utf-8 (e.g. latin-1) then an appropriate ``encoding`` name - must be specified. Encodings that are not ASCII based (such as UCS-2) - are not allowed and should be decoded to ``unicode`` first. - - ``object_hook`` is an optional function that will be called with the - result of any object literal decode (a ``dict``). The return value of - ``object_hook`` will be used instead of the ``dict``. This feature - can be used to implement custom decoders (e.g. JSON-RPC class hinting). - - ``object_pairs_hook`` is an optional function that will be called with the - result of any object literal decoded with an ordered list of pairs. The - return value of ``object_pairs_hook`` will be used instead of the ``dict``. - This feature can be used to implement custom decoders that rely on the - order that the key and value pairs are decoded (for example, - collections.OrderedDict will remember the order of insertion). If - ``object_hook`` is also defined, the ``object_pairs_hook`` takes priority. - - ``parse_float``, if specified, will be called with the string - of every JSON float to be decoded. By default this is equivalent to - float(num_str). This can be used to use another datatype or parser - for JSON floats (e.g. decimal.Decimal). - - ``parse_int``, if specified, will be called with the string - of every JSON int to be decoded. By default this is equivalent to - int(num_str). This can be used to use another datatype or parser - for JSON integers (e.g. float). - - ``parse_constant``, if specified, will be called with one of the - following strings: -Infinity, Infinity, NaN, null, true, false. - This can be used to raise an exception if invalid JSON numbers - are encountered. - - To use a custom ``JSONDecoder`` subclass, specify it with the ``cls`` - kwarg; otherwise ``JSONDecoder`` is used. - - """ - if (cls is None and encoding is None and object_hook is None and - parse_int is None and parse_float is None and - parse_constant is None and object_pairs_hook is None and not kw): - return _default_decoder.decode(s) - if cls is None: - cls = JSONDecoder - if object_hook is not None: - kw['object_hook'] = object_hook - if object_pairs_hook is not None: - kw['object_pairs_hook'] = object_pairs_hook - if parse_float is not None: - kw['parse_float'] = parse_float - if parse_int is not None: - kw['parse_int'] = parse_int - if parse_constant is not None: - kw['parse_constant'] = parse_constant - return cls(encoding=encoding, **kw).decode(s) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py deleted file mode 100644 index f2a4829..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/decoder.py +++ /dev/null @@ -1,385 +0,0 @@ -"""Implementation of JSONDecoder -""" -import re -import sys -import struct - -from json import scanner -try: - from _json import scanstring as c_scanstring -except ImportError: - c_scanstring = None - -__all__ = ['JSONDecoder'] - -FLAGS = re.VERBOSE | re.MULTILINE | re.DOTALL - -def _floatconstants(): - _BYTES = '7FF80000000000007FF0000000000000'.decode('hex') - if sys.byteorder != 'big': - _BYTES = _BYTES[:8][::-1] + _BYTES[8:][::-1] - nan, inf = struct.unpack('dd', _BYTES) - return nan, inf, -inf - -NaN, PosInf, NegInf = _floatconstants() - - -def linecol(doc, pos): - lineno = doc.count('\n', 0, pos) + 1 - if lineno == 1: - colno = pos + 1 - else: - colno = pos - doc.rindex('\n', 0, pos) - return lineno, colno - - -def errmsg(msg, doc, pos, end=None): - # Note that this function is called from _json - lineno, colno = linecol(doc, pos) - if end is None: - fmt = '{0}: line {1} column {2} (char {3})' - return fmt.format(msg, lineno, colno, pos) - #fmt = '%s: line %d column %d (char %d)' - #return fmt % (msg, lineno, colno, pos) - endlineno, endcolno = linecol(doc, end) - fmt = '{0}: line {1} column {2} - line {3} column {4} (char {5} - {6})' - return fmt.format(msg, lineno, colno, endlineno, endcolno, pos, end) - #fmt = '%s: line %d column %d - line %d column %d (char %d - %d)' - #return fmt % (msg, lineno, colno, endlineno, endcolno, pos, end) - - -_CONSTANTS = { - '-Infinity': NegInf, - 'Infinity': PosInf, - 'NaN': NaN, -} - -STRINGCHUNK = re.compile(r'(.*?)(["\\\x00-\x1f])', FLAGS) -BACKSLASH = { - '"': u'"', '\\': u'\\', '/': u'/', - 'b': u'\b', 'f': u'\f', 'n': u'\n', 'r': u'\r', 't': u'\t', -} - -DEFAULT_ENCODING = "utf-8" - -def _decode_uXXXX(s, pos): - esc = s[pos + 1:pos + 5] - if len(esc) == 4 and esc[1] not in 'xX': - try: - return int(esc, 16) - except ValueError: - pass - msg = "Invalid \\uXXXX escape" - raise ValueError(errmsg(msg, s, pos)) - -def py_scanstring(s, end, encoding=None, strict=True, - _b=BACKSLASH, _m=STRINGCHUNK.match): - """Scan the string s for a JSON string. End is the index of the - character in s after the quote that started the JSON string. - Unescapes all valid JSON string escape sequences and raises ValueError - on attempt to decode an invalid string. If strict is False then literal - control characters are allowed in the string. - - Returns a tuple of the decoded string and the index of the character in s - after the end quote.""" - if encoding is None: - encoding = DEFAULT_ENCODING - chunks = [] - _append = chunks.append - begin = end - 1 - while 1: - chunk = _m(s, end) - if chunk is None: - raise ValueError( - errmsg("Unterminated string starting at", s, begin)) - end = chunk.end() - content, terminator = chunk.groups() - # Content is contains zero or more unescaped string characters - if content: - if not isinstance(content, unicode): - content = unicode(content, encoding) - _append(content) - # Terminator is the end of string, a literal control character, - # or a backslash denoting that an escape sequence follows - if terminator == '"': - break - elif terminator != '\\': - if strict: - #msg = "Invalid control character %r at" % (terminator,) - msg = "Invalid control character {0!r} at".format(terminator) - raise ValueError(errmsg(msg, s, end)) - else: - _append(terminator) - continue - try: - esc = s[end] - except IndexError: - raise ValueError( - errmsg("Unterminated string starting at", s, begin)) - # If not a unicode escape sequence, must be in the lookup table - if esc != 'u': - try: - char = _b[esc] - except KeyError: - msg = "Invalid \\escape: " + repr(esc) - raise ValueError(errmsg(msg, s, end)) - end += 1 - else: - # Unicode escape sequence - uni = _decode_uXXXX(s, end) - end += 5 - # Check for surrogate pair on UCS-4 systems - if sys.maxunicode > 65535 and \ - 0xd800 <= uni <= 0xdbff and s[end:end + 2] == '\\u': - uni2 = _decode_uXXXX(s, end + 1) - if 0xdc00 <= uni2 <= 0xdfff: - uni = 0x10000 + (((uni - 0xd800) << 10) | (uni2 - 0xdc00)) - end += 6 - char = unichr(uni) - # Append the unescaped character - _append(char) - return u''.join(chunks), end - - -# Use speedup if available -scanstring = c_scanstring or py_scanstring - -WHITESPACE = re.compile(r'[ \t\n\r]*', FLAGS) -WHITESPACE_STR = ' \t\n\r' - -def JSONObject(s_and_end, encoding, strict, scan_once, object_hook, - object_pairs_hook, _w=WHITESPACE.match, _ws=WHITESPACE_STR): - s, end = s_and_end - pairs = [] - pairs_append = pairs.append - # Use a slice to prevent IndexError from being raised, the following - # check will raise a more specific ValueError if the string is empty - nextchar = s[end:end + 1] - # Normally we expect nextchar == '"' - if nextchar != '"': - if nextchar in _ws: - end = _w(s, end).end() - nextchar = s[end:end + 1] - # Trivial empty object - if nextchar == '}': - if object_pairs_hook is not None: - result = object_pairs_hook(pairs) - return result, end + 1 - pairs = {} - if object_hook is not None: - pairs = object_hook(pairs) - return pairs, end + 1 - elif nextchar != '"': - raise ValueError(errmsg( - "Expecting property name enclosed in double quotes", s, end)) - end += 1 - while True: - key, end = scanstring(s, end, encoding, strict) - - # To skip some function call overhead we optimize the fast paths where - # the JSON key separator is ": " or just ":". - if s[end:end + 1] != ':': - end = _w(s, end).end() - if s[end:end + 1] != ':': - raise ValueError(errmsg("Expecting ':' delimiter", s, end)) - end += 1 - - try: - if s[end] in _ws: - end += 1 - if s[end] in _ws: - end = _w(s, end + 1).end() - except IndexError: - pass - - try: - value, end = scan_once(s, end) - except StopIteration: - raise ValueError(errmsg("Expecting object", s, end)) - pairs_append((key, value)) - - try: - nextchar = s[end] - if nextchar in _ws: - end = _w(s, end + 1).end() - nextchar = s[end] - except IndexError: - nextchar = '' - end += 1 - - if nextchar == '}': - break - elif nextchar != ',': - raise ValueError(errmsg("Expecting ',' delimiter", s, end - 1)) - - try: - nextchar = s[end] - if nextchar in _ws: - end += 1 - nextchar = s[end] - if nextchar in _ws: - end = _w(s, end + 1).end() - nextchar = s[end] - except IndexError: - nextchar = '' - - end += 1 - if nextchar != '"': - raise ValueError(errmsg( - "Expecting property name enclosed in double quotes", s, end - 1)) - if object_pairs_hook is not None: - result = object_pairs_hook(pairs) - return result, end - pairs = dict(pairs) - if object_hook is not None: - pairs = object_hook(pairs) - return pairs, end - -def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR): - s, end = s_and_end - values = [] - nextchar = s[end:end + 1] - if nextchar in _ws: - end = _w(s, end + 1).end() - nextchar = s[end:end + 1] - # Look-ahead for trivial empty array - if nextchar == ']': - return values, end + 1 - _append = values.append - while True: - try: - value, end = scan_once(s, end) - except StopIteration: - raise ValueError(errmsg("Expecting object", s, end)) - _append(value) - nextchar = s[end:end + 1] - if nextchar in _ws: - end = _w(s, end + 1).end() - nextchar = s[end:end + 1] - end += 1 - if nextchar == ']': - break - elif nextchar != ',': - raise ValueError(errmsg("Expecting ',' delimiter", s, end)) - try: - if s[end] in _ws: - end += 1 - if s[end] in _ws: - end = _w(s, end + 1).end() - except IndexError: - pass - - return values, end - -class JSONDecoder(object): - """Simple JSON decoder - - Performs the following translations in decoding by default: - - +---------------+-------------------+ - | JSON | Python | - +===============+===================+ - | object | dict | - +---------------+-------------------+ - | array | list | - +---------------+-------------------+ - | string | unicode | - +---------------+-------------------+ - | number (int) | int, long | - +---------------+-------------------+ - | number (real) | float | - +---------------+-------------------+ - | true | True | - +---------------+-------------------+ - | false | False | - +---------------+-------------------+ - | null | None | - +---------------+-------------------+ - - It also understands ``NaN``, ``Infinity``, and ``-Infinity`` as - their corresponding ``float`` values, which is outside the JSON spec. - - """ - - def __init__(self, encoding=None, object_hook=None, parse_float=None, - parse_int=None, parse_constant=None, strict=True, - object_pairs_hook=None): - """``encoding`` determines the encoding used to interpret any ``str`` - objects decoded by this instance (utf-8 by default). It has no - effect when decoding ``unicode`` objects. - - Note that currently only encodings that are a superset of ASCII work, - strings of other encodings should be passed in as ``unicode``. - - ``object_hook``, if specified, will be called with the result - of every JSON object decoded and its return value will be used in - place of the given ``dict``. This can be used to provide custom - deserializations (e.g. to support JSON-RPC class hinting). - - ``object_pairs_hook``, if specified will be called with the result of - every JSON object decoded with an ordered list of pairs. The return - value of ``object_pairs_hook`` will be used instead of the ``dict``. - This feature can be used to implement custom decoders that rely on the - order that the key and value pairs are decoded (for example, - collections.OrderedDict will remember the order of insertion). If - ``object_hook`` is also defined, the ``object_pairs_hook`` takes - priority. - - ``parse_float``, if specified, will be called with the string - of every JSON float to be decoded. By default this is equivalent to - float(num_str). This can be used to use another datatype or parser - for JSON floats (e.g. decimal.Decimal). - - ``parse_int``, if specified, will be called with the string - of every JSON int to be decoded. By default this is equivalent to - int(num_str). This can be used to use another datatype or parser - for JSON integers (e.g. float). - - ``parse_constant``, if specified, will be called with one of the - following strings: -Infinity, Infinity, NaN. - This can be used to raise an exception if invalid JSON numbers - are encountered. - - If ``strict`` is false (true is the default), then control - characters will be allowed inside strings. Control characters in - this context are those with character codes in the 0-31 range, - including ``'\\t'`` (tab), ``'\\n'``, ``'\\r'`` and ``'\\0'``. - - """ - self.encoding = encoding - self.object_hook = object_hook - self.object_pairs_hook = object_pairs_hook - self.parse_float = parse_float or float - self.parse_int = parse_int or int - self.parse_constant = parse_constant or _CONSTANTS.__getitem__ - self.strict = strict - self.parse_object = JSONObject - self.parse_array = JSONArray - self.parse_string = scanstring - self.scan_once = scanner.make_scanner(self) - - def decode(self, s, _w=WHITESPACE.match): - """Return the Python representation of ``s`` (a ``str`` or ``unicode`` - instance containing a JSON document) - - """ - obj, end = self.raw_decode(s, idx=_w(s, 0).end()) - end = _w(s, end).end() - if end != len(s): - raise ValueError(errmsg("Extra data", s, end, len(s))) - return obj - - def raw_decode(self, s, idx=0): - """Decode a JSON document from ``s`` (a ``str`` or ``unicode`` - beginning with a JSON document) and return a 2-tuple of the Python - representation and the index in ``s`` where the document ended. - - This can be used to decode a JSON document from a string that may - have extraneous data at the end. - - """ - try: - obj, end = self.scan_once(s, idx) - except StopIteration: - raise ValueError("No JSON object could be decoded") - return obj, end diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py deleted file mode 100644 index cd1a120..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/encoder.py +++ /dev/null @@ -1,448 +0,0 @@ -"""Implementation of JSONEncoder -""" -import re - -try: - from _json import encode_basestring_ascii as c_encode_basestring_ascii -except ImportError: - c_encode_basestring_ascii = None -try: - from _json import make_encoder as c_make_encoder -except ImportError: - c_make_encoder = None - -ESCAPE = re.compile(r'[\x00-\x1f\\"\b\f\n\r\t]') -ESCAPE_ASCII = re.compile(r'([\\"]|[^\ -~])') -HAS_UTF8 = re.compile(r'[\x80-\xff]') -ESCAPE_DCT = { - '\\': '\\\\', - '"': '\\"', - '\b': '\\b', - '\f': '\\f', - '\n': '\\n', - '\r': '\\r', - '\t': '\\t', -} -for i in range(0x20): - ESCAPE_DCT.setdefault(chr(i), '\\u{0:04x}'.format(i)) - #ESCAPE_DCT.setdefault(chr(i), '\\u%04x' % (i,)) - -INFINITY = float('inf') -FLOAT_REPR = repr - -def encode_basestring(s): - """Return a JSON representation of a Python string - - """ - def replace(match): - return ESCAPE_DCT[match.group(0)] - return '"' + ESCAPE.sub(replace, s) + '"' - - -def py_encode_basestring_ascii(s): - """Return an ASCII-only JSON representation of a Python string - - """ - if isinstance(s, str) and HAS_UTF8.search(s) is not None: - s = s.decode('utf-8') - def replace(match): - s = match.group(0) - try: - return ESCAPE_DCT[s] - except KeyError: - n = ord(s) - if n < 0x10000: - return '\\u{0:04x}'.format(n) - #return '\\u%04x' % (n,) - else: - # surrogate pair - n -= 0x10000 - s1 = 0xd800 | ((n >> 10) & 0x3ff) - s2 = 0xdc00 | (n & 0x3ff) - return '\\u{0:04x}\\u{1:04x}'.format(s1, s2) - #return '\\u%04x\\u%04x' % (s1, s2) - return '"' + str(ESCAPE_ASCII.sub(replace, s)) + '"' - - -encode_basestring_ascii = ( - c_encode_basestring_ascii or py_encode_basestring_ascii) - -class JSONEncoder(object): - """Extensible JSON encoder for Python data structures. - - Supports the following objects and types by default: - - +-------------------+---------------+ - | Python | JSON | - +===================+===============+ - | dict | object | - +-------------------+---------------+ - | list, tuple | array | - +-------------------+---------------+ - | str, unicode | string | - +-------------------+---------------+ - | int, long, float | number | - +-------------------+---------------+ - | True | true | - +-------------------+---------------+ - | False | false | - +-------------------+---------------+ - | None | null | - +-------------------+---------------+ - - To extend this to recognize other objects, subclass and implement a - ``.default()`` method with another method that returns a serializable - object for ``o`` if possible, otherwise it should call the superclass - implementation (to raise ``TypeError``). - - """ - item_separator = ', ' - key_separator = ': ' - def __init__(self, skipkeys=False, ensure_ascii=True, - check_circular=True, allow_nan=True, sort_keys=False, - indent=None, separators=None, encoding='utf-8', default=None): - """Constructor for JSONEncoder, with sensible defaults. - - If skipkeys is false, then it is a TypeError to attempt - encoding of keys that are not str, int, long, float or None. If - skipkeys is True, such items are simply skipped. - - If *ensure_ascii* is true (the default), all non-ASCII - characters in the output are escaped with \uXXXX sequences, - and the results are str instances consisting of ASCII - characters only. If ensure_ascii is False, a result may be a - unicode instance. This usually happens if the input contains - unicode strings or the *encoding* parameter is used. - - If check_circular is true, then lists, dicts, and custom encoded - objects will be checked for circular references during encoding to - prevent an infinite recursion (which would cause an OverflowError). - Otherwise, no such check takes place. - - If allow_nan is true, then NaN, Infinity, and -Infinity will be - encoded as such. This behavior is not JSON specification compliant, - but is consistent with most JavaScript based encoders and decoders. - Otherwise, it will be a ValueError to encode such floats. - - If sort_keys is true, then the output of dictionaries will be - sorted by key; this is useful for regression tests to ensure - that JSON serializations can be compared on a day-to-day basis. - - If indent is a non-negative integer, then JSON array - elements and object members will be pretty-printed with that - indent level. An indent level of 0 will only insert newlines. - None is the most compact representation. Since the default - item separator is ', ', the output might include trailing - whitespace when indent is specified. You can use - separators=(',', ': ') to avoid this. - - If specified, separators should be a (item_separator, key_separator) - tuple. The default is (', ', ': '). To get the most compact JSON - representation you should specify (',', ':') to eliminate whitespace. - - If specified, default is a function that gets called for objects - that can't otherwise be serialized. It should return a JSON encodable - version of the object or raise a ``TypeError``. - - If encoding is not None, then all input strings will be - transformed into unicode using that encoding prior to JSON-encoding. - The default is UTF-8. - - """ - - self.skipkeys = skipkeys - self.ensure_ascii = ensure_ascii - self.check_circular = check_circular - self.allow_nan = allow_nan - self.sort_keys = sort_keys - self.indent = indent - if separators is not None: - self.item_separator, self.key_separator = separators - if default is not None: - self.default = default - self.encoding = encoding - - def default(self, o): - """Implement this method in a subclass such that it returns - a serializable object for ``o``, or calls the base implementation - (to raise a ``TypeError``). - - For example, to support arbitrary iterators, you could - implement default like this:: - - def default(self, o): - try: - iterable = iter(o) - except TypeError: - pass - else: - return list(iterable) - # Let the base class default method raise the TypeError - return JSONEncoder.default(self, o) - - """ - raise TypeError(repr(o) + " is not JSON serializable") - - def encode(self, o): - """Return a JSON string representation of a Python data structure. - - >>> JSONEncoder().encode({"foo": ["bar", "baz"]}) - '{"foo": ["bar", "baz"]}' - - """ - # This is for extremely simple cases and benchmarks. - if isinstance(o, basestring): - if isinstance(o, str): - _encoding = self.encoding - if (_encoding is not None - and not (_encoding == 'utf-8')): - o = o.decode(_encoding) - if self.ensure_ascii: - return encode_basestring_ascii(o) - else: - return encode_basestring(o) - # This doesn't pass the iterator directly to ''.join() because the - # exceptions aren't as detailed. The list call should be roughly - # equivalent to the PySequence_Fast that ''.join() would do. - chunks = self.iterencode(o, _one_shot=True) - if not isinstance(chunks, (list, tuple)): - chunks = list(chunks) - return ''.join(chunks) - - def iterencode(self, o, _one_shot=False): - """Encode the given object and yield each string - representation as available. - - For example:: - - for chunk in JSONEncoder().iterencode(bigobject): - mysocket.write(chunk) - - """ - if self.check_circular: - markers = {} - else: - markers = None - if self.ensure_ascii: - _encoder = encode_basestring_ascii - else: - _encoder = encode_basestring - if self.encoding != 'utf-8': - def _encoder(o, _orig_encoder=_encoder, _encoding=self.encoding): - if isinstance(o, str): - o = o.decode(_encoding) - return _orig_encoder(o) - - def floatstr(o, allow_nan=self.allow_nan, - _repr=FLOAT_REPR, _inf=INFINITY, _neginf=-INFINITY): - # Check for specials. Note that this type of test is processor - # and/or platform-specific, so do tests which don't depend on the - # internals. - - if o != o: - text = 'NaN' - elif o == _inf: - text = 'Infinity' - elif o == _neginf: - text = '-Infinity' - else: - return _repr(o) - - if not allow_nan: - raise ValueError( - "Out of range float values are not JSON compliant: " + - repr(o)) - - return text - - - if (_one_shot and c_make_encoder is not None - and self.indent is None and not self.sort_keys): - _iterencode = c_make_encoder( - markers, self.default, _encoder, self.indent, - self.key_separator, self.item_separator, self.sort_keys, - self.skipkeys, self.allow_nan) - else: - _iterencode = _make_iterencode( - markers, self.default, _encoder, self.indent, floatstr, - self.key_separator, self.item_separator, self.sort_keys, - self.skipkeys, _one_shot) - return _iterencode(o, 0) - -def _make_iterencode(markers, _default, _encoder, _indent, _floatstr, - _key_separator, _item_separator, _sort_keys, _skipkeys, _one_shot, - ## HACK: hand-optimized bytecode; turn globals into locals - ValueError=ValueError, - basestring=basestring, - dict=dict, - float=float, - id=id, - int=int, - isinstance=isinstance, - list=list, - long=long, - str=str, - tuple=tuple, - ): - - def _iterencode_list(lst, _current_indent_level): - if not lst: - yield '[]' - return - if markers is not None: - markerid = id(lst) - if markerid in markers: - raise ValueError("Circular reference detected") - markers[markerid] = lst - buf = '[' - if _indent is not None: - _current_indent_level += 1 - newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) - separator = _item_separator + newline_indent - buf += newline_indent - else: - newline_indent = None - separator = _item_separator - first = True - for value in lst: - if first: - first = False - else: - buf = separator - if isinstance(value, basestring): - yield buf + _encoder(value) - elif value is None: - yield buf + 'null' - elif value is True: - yield buf + 'true' - elif value is False: - yield buf + 'false' - elif isinstance(value, (int, long)): - yield buf + str(value) - elif isinstance(value, float): - yield buf + _floatstr(value) - else: - yield buf - if isinstance(value, (list, tuple)): - chunks = _iterencode_list(value, _current_indent_level) - elif isinstance(value, dict): - chunks = _iterencode_dict(value, _current_indent_level) - else: - chunks = _iterencode(value, _current_indent_level) - for chunk in chunks: - yield chunk - if newline_indent is not None: - _current_indent_level -= 1 - yield '\n' + (' ' * (_indent * _current_indent_level)) - yield ']' - if markers is not None: - del markers[markerid] - - def _iterencode_dict(dct, _current_indent_level): - if not dct: - yield '{}' - return - if markers is not None: - markerid = id(dct) - if markerid in markers: - raise ValueError("Circular reference detected") - markers[markerid] = dct - yield '{' - if _indent is not None: - _current_indent_level += 1 - newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) - item_separator = _item_separator + newline_indent - yield newline_indent - else: - newline_indent = None - item_separator = _item_separator - first = True - if _sort_keys: - items = sorted(dct.items(), key=lambda kv: kv[0]) - else: - items = dct.iteritems() - for key, value in items: - if isinstance(key, basestring): - pass - # JavaScript is weakly typed for these, so it makes sense to - # also allow them. Many encoders seem to do something like this. - elif isinstance(key, float): - key = _floatstr(key) - elif key is True: - key = 'true' - elif key is False: - key = 'false' - elif key is None: - key = 'null' - elif isinstance(key, (int, long)): - key = str(key) - elif _skipkeys: - continue - else: - raise TypeError("key " + repr(key) + " is not a string") - if first: - first = False - else: - yield item_separator - yield _encoder(key) - yield _key_separator - if isinstance(value, basestring): - yield _encoder(value) - elif value is None: - yield 'null' - elif value is True: - yield 'true' - elif value is False: - yield 'false' - elif isinstance(value, (int, long)): - yield str(value) - elif isinstance(value, float): - yield _floatstr(value) - else: - if isinstance(value, (list, tuple)): - chunks = _iterencode_list(value, _current_indent_level) - elif isinstance(value, dict): - chunks = _iterencode_dict(value, _current_indent_level) - else: - chunks = _iterencode(value, _current_indent_level) - for chunk in chunks: - yield chunk - if newline_indent is not None: - _current_indent_level -= 1 - yield '\n' + (' ' * (_indent * _current_indent_level)) - yield '}' - if markers is not None: - del markers[markerid] - - def _iterencode(o, _current_indent_level): - if isinstance(o, basestring): - yield _encoder(o) - elif o is None: - yield 'null' - elif o is True: - yield 'true' - elif o is False: - yield 'false' - elif isinstance(o, (int, long)): - yield str(o) - elif isinstance(o, float): - yield _floatstr(o) - elif isinstance(o, (list, tuple)): - for chunk in _iterencode_list(o, _current_indent_level): - yield chunk - elif isinstance(o, dict): - for chunk in _iterencode_dict(o, _current_indent_level): - yield chunk - else: - if markers is not None: - markerid = id(o) - if markerid in markers: - raise ValueError("Circular reference detected") - markers[markerid] = o - o = _default(o) - for chunk in _iterencode(o, _current_indent_level): - yield chunk - if markers is not None: - del markers[markerid] - - return _iterencode diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py deleted file mode 100644 index 259e955..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/scanner.py +++ /dev/null @@ -1,67 +0,0 @@ -"""JSON token scanner -""" -import re -try: - from _json import make_scanner as c_make_scanner -except ImportError: - c_make_scanner = None - -__all__ = ['make_scanner'] - -NUMBER_RE = re.compile( - r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?', - (re.VERBOSE | re.MULTILINE | re.DOTALL)) - -def py_make_scanner(context): - parse_object = context.parse_object - parse_array = context.parse_array - parse_string = context.parse_string - match_number = NUMBER_RE.match - encoding = context.encoding - strict = context.strict - parse_float = context.parse_float - parse_int = context.parse_int - parse_constant = context.parse_constant - object_hook = context.object_hook - object_pairs_hook = context.object_pairs_hook - - def _scan_once(string, idx): - try: - nextchar = string[idx] - except IndexError: - raise StopIteration - - if nextchar == '"': - return parse_string(string, idx + 1, encoding, strict) - elif nextchar == '{': - return parse_object((string, idx + 1), encoding, strict, - _scan_once, object_hook, object_pairs_hook) - elif nextchar == '[': - return parse_array((string, idx + 1), _scan_once) - elif nextchar == 'n' and string[idx:idx + 4] == 'null': - return None, idx + 4 - elif nextchar == 't' and string[idx:idx + 4] == 'true': - return True, idx + 4 - elif nextchar == 'f' and string[idx:idx + 5] == 'false': - return False, idx + 5 - - m = match_number(string, idx) - if m is not None: - integer, frac, exp = m.groups() - if frac or exp: - res = parse_float(integer + (frac or '') + (exp or '')) - else: - res = parse_int(integer) - return res, m.end() - elif nextchar == 'N' and string[idx:idx + 3] == 'NaN': - return parse_constant('NaN'), idx + 3 - elif nextchar == 'I' and string[idx:idx + 8] == 'Infinity': - return parse_constant('Infinity'), idx + 8 - elif nextchar == '-' and string[idx:idx + 9] == '-Infinity': - return parse_constant('-Infinity'), idx + 9 - else: - raise StopIteration - - return _scan_once - -make_scanner = c_make_scanner or py_make_scanner diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py deleted file mode 100644 index 17d3849..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/__init__.py +++ /dev/null @@ -1,73 +0,0 @@ -import os -import sys -import json -import doctest -import unittest - -from test import test_support - -# import json with and without accelerations -cjson = test_support.import_fresh_module('json', fresh=['_json']) -pyjson = test_support.import_fresh_module('json', blocked=['_json']) - -# create two base classes that will be used by the other tests -class PyTest(unittest.TestCase): - json = pyjson - loads = staticmethod(pyjson.loads) - dumps = staticmethod(pyjson.dumps) - -@unittest.skipUnless(cjson, 'requires _json') -class CTest(unittest.TestCase): - if cjson is not None: - json = cjson - loads = staticmethod(cjson.loads) - dumps = staticmethod(cjson.dumps) - -# test PyTest and CTest checking if the functions come from the right module -class TestPyTest(PyTest): - def test_pyjson(self): - self.assertEqual(self.json.scanner.make_scanner.__module__, - 'json.scanner') - self.assertEqual(self.json.decoder.scanstring.__module__, - 'json.decoder') - self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__, - 'json.encoder') - -class TestCTest(CTest): - def test_cjson(self): - self.assertEqual(self.json.scanner.make_scanner.__module__, '_json') - self.assertEqual(self.json.decoder.scanstring.__module__, '_json') - self.assertEqual(self.json.encoder.c_make_encoder.__module__, '_json') - self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__, - '_json') - - -here = os.path.dirname(__file__) - -def test_suite(): - suite = additional_tests() - loader = unittest.TestLoader() - for fn in os.listdir(here): - if fn.startswith("test") and fn.endswith(".py"): - modname = "json.tests." + fn[:-3] - __import__(modname) - module = sys.modules[modname] - suite.addTests(loader.loadTestsFromModule(module)) - return suite - -def additional_tests(): - suite = unittest.TestSuite() - for mod in (json, json.encoder, json.decoder): - suite.addTest(doctest.DocTestSuite(mod)) - suite.addTest(TestPyTest('test_pyjson')) - suite.addTest(TestCTest('test_cjson')) - return suite - -def main(): - suite = test_suite() - runner = unittest.TextTestRunner() - runner.run(suite) - -if __name__ == '__main__': - sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))) - main() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py deleted file mode 100644 index 94a63c5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_check_circular.py +++ /dev/null @@ -1,34 +0,0 @@ -from json.tests import PyTest, CTest - - -def default_iterable(obj): - return list(obj) - -class TestCheckCircular(object): - def test_circular_dict(self): - dct = {} - dct['a'] = dct - self.assertRaises(ValueError, self.dumps, dct) - - def test_circular_list(self): - lst = [] - lst.append(lst) - self.assertRaises(ValueError, self.dumps, lst) - - def test_circular_composite(self): - dct2 = {} - dct2['a'] = [] - dct2['a'].append(dct2) - self.assertRaises(ValueError, self.dumps, dct2) - - def test_circular_default(self): - self.dumps([set()], default=default_iterable) - self.assertRaises(TypeError, self.dumps, [set()]) - - def test_circular_off_default(self): - self.dumps([set()], default=default_iterable, check_circular=False) - self.assertRaises(TypeError, self.dumps, [set()], check_circular=False) - - -class TestPyCheckCircular(TestCheckCircular, PyTest): pass -class TestCCheckCircular(TestCheckCircular, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py deleted file mode 100644 index 1c763c4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_decode.py +++ /dev/null @@ -1,69 +0,0 @@ -import decimal -from StringIO import StringIO -from collections import OrderedDict -from json.tests import PyTest, CTest - - -class TestDecode(object): - def test_decimal(self): - rval = self.loads('1.1', parse_float=decimal.Decimal) - self.assertTrue(isinstance(rval, decimal.Decimal)) - self.assertEqual(rval, decimal.Decimal('1.1')) - - def test_float(self): - rval = self.loads('1', parse_int=float) - self.assertTrue(isinstance(rval, float)) - self.assertEqual(rval, 1.0) - - def test_decoder_optimizations(self): - # Several optimizations were made that skip over calls to - # the whitespace regex, so this test is designed to try and - # exercise the uncommon cases. The array cases are already covered. - rval = self.loads('{ "key" : "value" , "k":"v" }') - self.assertEqual(rval, {"key":"value", "k":"v"}) - - def test_empty_objects(self): - self.assertEqual(self.loads('{}'), {}) - self.assertEqual(self.loads('[]'), []) - self.assertEqual(self.loads('""'), u"") - self.assertIsInstance(self.loads('""'), unicode) - - def test_object_pairs_hook(self): - s = '{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}' - p = [("xkd", 1), ("kcw", 2), ("art", 3), ("hxm", 4), - ("qrt", 5), ("pad", 6), ("hoy", 7)] - self.assertEqual(self.loads(s), eval(s)) - self.assertEqual(self.loads(s, object_pairs_hook=lambda x: x), p) - self.assertEqual(self.json.load(StringIO(s), - object_pairs_hook=lambda x: x), p) - od = self.loads(s, object_pairs_hook=OrderedDict) - self.assertEqual(od, OrderedDict(p)) - self.assertEqual(type(od), OrderedDict) - # the object_pairs_hook takes priority over the object_hook - self.assertEqual(self.loads(s, object_pairs_hook=OrderedDict, - object_hook=lambda x: None), - OrderedDict(p)) - # check that empty objects literals work (see #17368) - self.assertEqual(self.loads('{}', object_pairs_hook=OrderedDict), - OrderedDict()) - self.assertEqual(self.loads('{"empty": {}}', - object_pairs_hook=OrderedDict), - OrderedDict([('empty', OrderedDict())])) - - def test_extra_data(self): - s = '[1, 2, 3]5' - msg = 'Extra data' - self.assertRaisesRegexp(ValueError, msg, self.loads, s) - - def test_invalid_escape(self): - s = '["abc\\y"]' - msg = 'escape' - self.assertRaisesRegexp(ValueError, msg, self.loads, s) - - def test_negative_index(self): - d = self.json.JSONDecoder() - self.assertRaises(ValueError, d.raw_decode, 'a'*42, -50000) - self.assertRaises(ValueError, d.raw_decode, u'a'*42, -50000) - -class TestPyDecode(TestDecode, PyTest): pass -class TestCDecode(TestDecode, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py deleted file mode 100644 index 74aacee..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_default.py +++ /dev/null @@ -1,12 +0,0 @@ -from json.tests import PyTest, CTest - - -class TestDefault(object): - def test_default(self): - self.assertEqual( - self.dumps(type, default=repr), - self.dumps(repr(type))) - - -class TestPyDefault(TestDefault, PyTest): pass -class TestCDefault(TestDefault, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py deleted file mode 100644 index 1b46612..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_dump.py +++ /dev/null @@ -1,32 +0,0 @@ -from cStringIO import StringIO -from json.tests import PyTest, CTest - - -class TestDump(object): - def test_dump(self): - sio = StringIO() - self.json.dump({}, sio) - self.assertEqual(sio.getvalue(), '{}') - - def test_dumps(self): - self.assertEqual(self.dumps({}), '{}') - - def test_encode_truefalse(self): - self.assertEqual(self.dumps( - {True: False, False: True}, sort_keys=True), - '{"false": true, "true": false}') - self.assertEqual(self.dumps( - {2: 3.0, 4.0: 5L, False: 1, 6L: True}, sort_keys=True), - '{"false": 1, "2": 3.0, "4.0": 5, "6": true}') - - # Issue 16228: Crash on encoding resized list - def test_encode_mutated(self): - a = [object()] * 10 - def crasher(obj): - del a[-1] - self.assertEqual(self.dumps(a, default=crasher), - '[null, null, null, null, null]') - - -class TestPyDump(TestDump, PyTest): pass -class TestCDump(TestDump, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py deleted file mode 100644 index d3a8d5c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_encode_basestring_ascii.py +++ /dev/null @@ -1,41 +0,0 @@ -from collections import OrderedDict -from json.tests import PyTest, CTest - - -CASES = [ - (u'/\\"\ucafe\ubabe\uab98\ufcde\ubcda\uef4a\x08\x0c\n\r\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?', '"/\\\\\\"\\ucafe\\ubabe\\uab98\\ufcde\\ubcda\\uef4a\\b\\f\\n\\r\\t`1~!@#$%^&*()_+-=[]{}|;:\',./<>?"'), - (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'), - (u'controls', '"controls"'), - (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'), - (u'{"object with 1 member":["array with 1 element"]}', '"{\\"object with 1 member\\":[\\"array with 1 element\\"]}"'), - (u' s p a c e d ', '" s p a c e d "'), - (u'\U0001d120', '"\\ud834\\udd20"'), - (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), - ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'), - (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), - ('\xce\xb1\xce\xa9', '"\\u03b1\\u03a9"'), - (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), - (u'\u03b1\u03a9', '"\\u03b1\\u03a9"'), - (u"`1~!@#$%^&*()_+-={':[,]}|;.?", '"`1~!@#$%^&*()_+-={\':[,]}|;.?"'), - (u'\x08\x0c\n\r\t', '"\\b\\f\\n\\r\\t"'), - (u'\u0123\u4567\u89ab\ucdef\uabcd\uef4a', '"\\u0123\\u4567\\u89ab\\ucdef\\uabcd\\uef4a"'), -] - -class TestEncodeBasestringAscii(object): - def test_encode_basestring_ascii(self): - fname = self.json.encoder.encode_basestring_ascii.__name__ - for input_string, expect in CASES: - result = self.json.encoder.encode_basestring_ascii(input_string) - self.assertEqual(result, expect, - '{0!r} != {1!r} for {2}({3!r})'.format( - result, expect, fname, input_string)) - - def test_ordered_dict(self): - # See issue 6105 - items = [('one', 1), ('two', 2), ('three', 3), ('four', 4), ('five', 5)] - s = self.dumps(OrderedDict(items)) - self.assertEqual(s, '{"one": 1, "two": 2, "three": 3, "four": 4, "five": 5}') - - -class TestPyEncodeBasestringAscii(TestEncodeBasestringAscii, PyTest): pass -class TestCEncodeBasestringAscii(TestEncodeBasestringAscii, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py deleted file mode 100644 index 2f249cb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_fail.py +++ /dev/null @@ -1,105 +0,0 @@ -from json.tests import PyTest, CTest - -# 2007-10-05 -JSONDOCS = [ - # http://json.org/JSON_checker/test/fail1.json - '"A JSON payload should be an object or array, not a string."', - # http://json.org/JSON_checker/test/fail2.json - '["Unclosed array"', - # http://json.org/JSON_checker/test/fail3.json - '{unquoted_key: "keys must be quoted"}', - # http://json.org/JSON_checker/test/fail4.json - '["extra comma",]', - # http://json.org/JSON_checker/test/fail5.json - '["double extra comma",,]', - # http://json.org/JSON_checker/test/fail6.json - '[ , "<-- missing value"]', - # http://json.org/JSON_checker/test/fail7.json - '["Comma after the close"],', - # http://json.org/JSON_checker/test/fail8.json - '["Extra close"]]', - # http://json.org/JSON_checker/test/fail9.json - '{"Extra comma": true,}', - # http://json.org/JSON_checker/test/fail10.json - '{"Extra value after close": true} "misplaced quoted value"', - # http://json.org/JSON_checker/test/fail11.json - '{"Illegal expression": 1 + 2}', - # http://json.org/JSON_checker/test/fail12.json - '{"Illegal invocation": alert()}', - # http://json.org/JSON_checker/test/fail13.json - '{"Numbers cannot have leading zeroes": 013}', - # http://json.org/JSON_checker/test/fail14.json - '{"Numbers cannot be hex": 0x14}', - # http://json.org/JSON_checker/test/fail15.json - '["Illegal backslash escape: \\x15"]', - # http://json.org/JSON_checker/test/fail16.json - '[\\naked]', - # http://json.org/JSON_checker/test/fail17.json - '["Illegal backslash escape: \\017"]', - # http://json.org/JSON_checker/test/fail18.json - '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]', - # http://json.org/JSON_checker/test/fail19.json - '{"Missing colon" null}', - # http://json.org/JSON_checker/test/fail20.json - '{"Double colon":: null}', - # http://json.org/JSON_checker/test/fail21.json - '{"Comma instead of colon", null}', - # http://json.org/JSON_checker/test/fail22.json - '["Colon instead of comma": false]', - # http://json.org/JSON_checker/test/fail23.json - '["Bad value", truth]', - # http://json.org/JSON_checker/test/fail24.json - "['single quote']", - # http://json.org/JSON_checker/test/fail25.json - '["\ttab\tcharacter\tin\tstring\t"]', - # http://json.org/JSON_checker/test/fail26.json - '["tab\\ character\\ in\\ string\\ "]', - # http://json.org/JSON_checker/test/fail27.json - '["line\nbreak"]', - # http://json.org/JSON_checker/test/fail28.json - '["line\\\nbreak"]', - # http://json.org/JSON_checker/test/fail29.json - '[0e]', - # http://json.org/JSON_checker/test/fail30.json - '[0e+]', - # http://json.org/JSON_checker/test/fail31.json - '[0e+-1]', - # http://json.org/JSON_checker/test/fail32.json - '{"Comma instead if closing brace": true,', - # http://json.org/JSON_checker/test/fail33.json - '["mismatch"}', - # http://code.google.com/p/simplejson/issues/detail?id=3 - u'["A\u001FZ control characters in string"]', -] - -SKIPS = { - 1: "why not have a string payload?", - 18: "spec doesn't specify any nesting limitations", -} - -class TestFail(object): - def test_failures(self): - for idx, doc in enumerate(JSONDOCS): - idx = idx + 1 - if idx in SKIPS: - self.loads(doc) - continue - try: - self.loads(doc) - except ValueError: - pass - else: - self.fail("Expected failure for fail{0}.json: {1!r}".format(idx, doc)) - - def test_non_string_keys_dict(self): - data = {'a' : 1, (1, 2) : 2} - - #This is for c encoder - self.assertRaises(TypeError, self.dumps, data) - - #This is for python encoder - self.assertRaises(TypeError, self.dumps, data, indent=True) - - -class TestPyFail(TestFail, PyTest): pass -class TestCFail(TestFail, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py deleted file mode 100644 index 1fba25b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_float.py +++ /dev/null @@ -1,37 +0,0 @@ -import math -from json.tests import PyTest, CTest - - -class TestFloat(object): - def test_floats(self): - for num in [1617161771.7650001, math.pi, math.pi**100, - math.pi**-100, 3.1]: - self.assertEqual(float(self.dumps(num)), num) - self.assertEqual(self.loads(self.dumps(num)), num) - self.assertEqual(self.loads(unicode(self.dumps(num))), num) - - def test_ints(self): - for num in [1, 1L, 1<<32, 1<<64]: - self.assertEqual(self.dumps(num), str(num)) - self.assertEqual(int(self.dumps(num)), num) - self.assertEqual(self.loads(self.dumps(num)), num) - self.assertEqual(self.loads(unicode(self.dumps(num))), num) - - def test_out_of_range(self): - self.assertEqual(self.loads('[23456789012E666]'), [float('inf')]) - self.assertEqual(self.loads('[-23456789012E666]'), [float('-inf')]) - - def test_allow_nan(self): - for val in (float('inf'), float('-inf'), float('nan')): - out = self.dumps([val]) - if val == val: # inf - self.assertEqual(self.loads(out), [val]) - else: # nan - res = self.loads(out) - self.assertEqual(len(res), 1) - self.assertNotEqual(res[0], res[0]) - self.assertRaises(ValueError, self.dumps, [val], allow_nan=False) - - -class TestPyFloat(TestFloat, PyTest): pass -class TestCFloat(TestFloat, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py deleted file mode 100644 index 866abb1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_indent.py +++ /dev/null @@ -1,60 +0,0 @@ -import textwrap -from StringIO import StringIO -from json.tests import PyTest, CTest - - -class TestIndent(object): - def test_indent(self): - h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', - {'nifty': 87}, {'field': 'yes', 'morefield': False} ] - - expect = textwrap.dedent("""\ - [ - [ - "blorpie" - ], - [ - "whoops" - ], - [], - "d-shtaeou", - "d-nthiouh", - "i-vhbjkhnth", - { - "nifty": 87 - }, - { - "field": "yes", - "morefield": false - } - ]""") - - - d1 = self.dumps(h) - d2 = self.dumps(h, indent=2, sort_keys=True, separators=(',', ': ')) - - h1 = self.loads(d1) - h2 = self.loads(d2) - - self.assertEqual(h1, h) - self.assertEqual(h2, h) - self.assertEqual(d2, expect) - - def test_indent0(self): - h = {3: 1} - def check(indent, expected): - d1 = self.dumps(h, indent=indent) - self.assertEqual(d1, expected) - - sio = StringIO() - self.json.dump(h, sio, indent=indent) - self.assertEqual(sio.getvalue(), expected) - - # indent=0 should emit newlines - check(0, '{\n"3": 1\n}') - # indent=None is more compact - check(None, '{"3": 1}') - - -class TestPyIndent(TestIndent, PyTest): pass -class TestCIndent(TestIndent, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py deleted file mode 100644 index 8bf73bc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass1.py +++ /dev/null @@ -1,75 +0,0 @@ -from json.tests import PyTest, CTest - - -# from http://json.org/JSON_checker/test/pass1.json -JSON = r''' -[ - "JSON Test Pattern pass1", - {"object with 1 member":["array with 1 element"]}, - {}, - [], - -42, - true, - false, - null, - { - "integer": 1234567890, - "real": -9876.543210, - "e": 0.123456789e-12, - "E": 1.234567890E+34, - "": 23456789012E66, - "zero": 0, - "one": 1, - "space": " ", - "quote": "\"", - "backslash": "\\", - "controls": "\b\f\n\r\t", - "slash": "/ & \/", - "alpha": "abcdefghijklmnopqrstuvwyz", - "ALPHA": "ABCDEFGHIJKLMNOPQRSTUVWYZ", - "digit": "0123456789", - "0123456789": "digit", - "special": "`1~!@#$%^&*()_+-={':[,]}|;.?", - "hex": "\u0123\u4567\u89AB\uCDEF\uabcd\uef4A", - "true": true, - "false": false, - "null": null, - "array":[ ], - "object":{ }, - "address": "50 St. James Street", - "url": "http://www.JSON.org/", - "comment": "// /* */": " ", - " s p a c e d " :[1,2 , 3 - -, - -4 , 5 , 6 ,7 ],"compact":[1,2,3,4,5,6,7], - "jsontext": "{\"object with 1 member\":[\"array with 1 element\"]}", - "quotes": "" \u0022 %22 0x22 034 "", - "\/\\\"\uCAFE\uBABE\uAB98\uFCDE\ubcda\uef4A\b\f\n\r\t`1~!@#$%^&*()_+-=[]{}|;:',./<>?" -: "A key can be any string" - }, - 0.5 ,98.6 -, -99.44 -, - -1066, -1e1, -0.1e1, -1e-1, -1e00,2e+00,2e-00 -,"rosebud"] -''' - -class TestPass1(object): - def test_parse(self): - # test in/out equivalence and parsing - res = self.loads(JSON) - out = self.dumps(res) - self.assertEqual(res, self.loads(out)) - - -class TestPyPass1(TestPass1, PyTest): pass -class TestCPass1(TestPass1, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py deleted file mode 100644 index 4972490..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass2.py +++ /dev/null @@ -1,18 +0,0 @@ -from json.tests import PyTest, CTest - - -# from http://json.org/JSON_checker/test/pass2.json -JSON = r''' -[[[[[[[[[[[[[[[[[[["Not too deep"]]]]]]]]]]]]]]]]]]] -''' - -class TestPass2(object): - def test_parse(self): - # test in/out equivalence and parsing - res = self.loads(JSON) - out = self.dumps(res) - self.assertEqual(res, self.loads(out)) - - -class TestPyPass2(TestPass2, PyTest): pass -class TestCPass2(TestPass2, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py deleted file mode 100644 index 8dc6d76..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_pass3.py +++ /dev/null @@ -1,24 +0,0 @@ -from json.tests import PyTest, CTest - - -# from http://json.org/JSON_checker/test/pass3.json -JSON = r''' -{ - "JSON Test Pattern pass3": { - "The outermost value": "must be an object or array.", - "In this test": "It is an object." - } -} -''' - - -class TestPass3(object): - def test_parse(self): - # test in/out equivalence and parsing - res = self.loads(JSON) - out = self.dumps(res) - self.assertEqual(res, self.loads(out)) - - -class TestPyPass3(TestPass3, PyTest): pass -class TestCPass3(TestPass3, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py deleted file mode 100644 index 016cd81..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_recursion.py +++ /dev/null @@ -1,108 +0,0 @@ -from json.tests import PyTest, CTest - - -class JSONTestObject: - pass - - -class TestRecursion(object): - def test_listrecursion(self): - x = [] - x.append(x) - try: - self.dumps(x) - except ValueError: - pass - else: - self.fail("didn't raise ValueError on list recursion") - x = [] - y = [x] - x.append(y) - try: - self.dumps(x) - except ValueError: - pass - else: - self.fail("didn't raise ValueError on alternating list recursion") - y = [] - x = [y, y] - # ensure that the marker is cleared - self.dumps(x) - - def test_dictrecursion(self): - x = {} - x["test"] = x - try: - self.dumps(x) - except ValueError: - pass - else: - self.fail("didn't raise ValueError on dict recursion") - x = {} - y = {"a": x, "b": x} - # ensure that the marker is cleared - self.dumps(x) - - def test_defaultrecursion(self): - class RecursiveJSONEncoder(self.json.JSONEncoder): - recurse = False - def default(self, o): - if o is JSONTestObject: - if self.recurse: - return [JSONTestObject] - else: - return 'JSONTestObject' - return pyjson.JSONEncoder.default(o) - - enc = RecursiveJSONEncoder() - self.assertEqual(enc.encode(JSONTestObject), '"JSONTestObject"') - enc.recurse = True - try: - enc.encode(JSONTestObject) - except ValueError: - pass - else: - self.fail("didn't raise ValueError on default recursion") - - - def test_highly_nested_objects_decoding(self): - # test that loading highly-nested objects doesn't segfault when C - # accelerations are used. See #12017 - # str - with self.assertRaises(RuntimeError): - self.loads('{"a":' * 100000 + '1' + '}' * 100000) - with self.assertRaises(RuntimeError): - self.loads('{"a":' * 100000 + '[1]' + '}' * 100000) - with self.assertRaises(RuntimeError): - self.loads('[' * 100000 + '1' + ']' * 100000) - # unicode - with self.assertRaises(RuntimeError): - self.loads(u'{"a":' * 100000 + u'1' + u'}' * 100000) - with self.assertRaises(RuntimeError): - self.loads(u'{"a":' * 100000 + u'[1]' + u'}' * 100000) - with self.assertRaises(RuntimeError): - self.loads(u'[' * 100000 + u'1' + u']' * 100000) - - def test_highly_nested_objects_encoding(self): - # See #12051 - l, d = [], {} - for x in xrange(100000): - l, d = [l], {'k':d} - with self.assertRaises(RuntimeError): - self.dumps(l) - with self.assertRaises(RuntimeError): - self.dumps(d) - - def test_endless_recursion(self): - # See #12051 - class EndlessJSONEncoder(self.json.JSONEncoder): - def default(self, o): - """If check_circular is False, this will keep adding another list.""" - return [o] - - with self.assertRaises(RuntimeError): - EndlessJSONEncoder(check_circular=False).encode(5j) - - -class TestPyRecursion(TestRecursion, PyTest): pass -class TestCRecursion(TestRecursion, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py deleted file mode 100644 index f4f7b00..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_scanstring.py +++ /dev/null @@ -1,157 +0,0 @@ -import sys -from json.tests import PyTest, CTest - - -class TestScanstring(object): - def test_scanstring(self): - scanstring = self.json.decoder.scanstring - if sys.maxunicode == 65535: - self.assertEqual( - scanstring(u'"z\U0001d120x"', 1, None, True), - (u'z\U0001d120x', 6)) - else: - self.assertEqual( - scanstring(u'"z\U0001d120x"', 1, None, True), - (u'z\U0001d120x', 5)) - - self.assertEqual( - scanstring('"\\u007b"', 1, None, True), - (u'{', 8)) - - self.assertEqual( - scanstring('"A JSON payload should be an object or array, not a string."', 1, None, True), - (u'A JSON payload should be an object or array, not a string.', 60)) - - self.assertEqual( - scanstring('["Unclosed array"', 2, None, True), - (u'Unclosed array', 17)) - - self.assertEqual( - scanstring('["extra comma",]', 2, None, True), - (u'extra comma', 14)) - - self.assertEqual( - scanstring('["double extra comma",,]', 2, None, True), - (u'double extra comma', 21)) - - self.assertEqual( - scanstring('["Comma after the close"],', 2, None, True), - (u'Comma after the close', 24)) - - self.assertEqual( - scanstring('["Extra close"]]', 2, None, True), - (u'Extra close', 14)) - - self.assertEqual( - scanstring('{"Extra comma": true,}', 2, None, True), - (u'Extra comma', 14)) - - self.assertEqual( - scanstring('{"Extra value after close": true} "misplaced quoted value"', 2, None, True), - (u'Extra value after close', 26)) - - self.assertEqual( - scanstring('{"Illegal expression": 1 + 2}', 2, None, True), - (u'Illegal expression', 21)) - - self.assertEqual( - scanstring('{"Illegal invocation": alert()}', 2, None, True), - (u'Illegal invocation', 21)) - - self.assertEqual( - scanstring('{"Numbers cannot have leading zeroes": 013}', 2, None, True), - (u'Numbers cannot have leading zeroes', 37)) - - self.assertEqual( - scanstring('{"Numbers cannot be hex": 0x14}', 2, None, True), - (u'Numbers cannot be hex', 24)) - - self.assertEqual( - scanstring('[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]', 21, None, True), - (u'Too deep', 30)) - - self.assertEqual( - scanstring('{"Missing colon" null}', 2, None, True), - (u'Missing colon', 16)) - - self.assertEqual( - scanstring('{"Double colon":: null}', 2, None, True), - (u'Double colon', 15)) - - self.assertEqual( - scanstring('{"Comma instead of colon", null}', 2, None, True), - (u'Comma instead of colon', 25)) - - self.assertEqual( - scanstring('["Colon instead of comma": false]', 2, None, True), - (u'Colon instead of comma', 25)) - - self.assertEqual( - scanstring('["Bad value", truth]', 2, None, True), - (u'Bad value', 12)) - - def test_surrogates(self): - scanstring = self.json.decoder.scanstring - def assertScan(given, expect): - self.assertEqual(scanstring(given, 1, None, True), - (expect, len(given))) - if not isinstance(given, unicode): - given = unicode(given) - self.assertEqual(scanstring(given, 1, None, True), - (expect, len(given))) - - surrogates = unichr(0xd834) + unichr(0xdd20) - assertScan('"z\\ud834\\u0079x"', u'z\ud834yx') - assertScan('"z\\ud834\\udd20x"', u'z\U0001d120x') - assertScan('"z\\ud834\\ud834\\udd20x"', u'z\ud834\U0001d120x') - assertScan('"z\\ud834x"', u'z\ud834x') - assertScan(u'"z\\ud834\udd20x12345"', u'z%sx12345' % surrogates) - assertScan('"z\\udd20x"', u'z\udd20x') - assertScan(u'"z\ud834\udd20x"', u'z\ud834\udd20x') - assertScan(u'"z\ud834\\udd20x"', u'z%sx' % surrogates) - assertScan(u'"z\ud834x"', u'z\ud834x') - - def test_bad_escapes(self): - scanstring = self.json.decoder.scanstring - bad_escapes = [ - '"\\"', - '"\\x"', - '"\\u"', - '"\\u0"', - '"\\u01"', - '"\\u012"', - '"\\uz012"', - '"\\u0z12"', - '"\\u01z2"', - '"\\u012z"', - '"\\u0x12"', - '"\\u0X12"', - '"\\ud834\\"', - '"\\ud834\\u"', - '"\\ud834\\ud"', - '"\\ud834\\udd"', - '"\\ud834\\udd2"', - '"\\ud834\\uzdd2"', - '"\\ud834\\udzd2"', - '"\\ud834\\uddz2"', - '"\\ud834\\udd2z"', - '"\\ud834\\u0x20"', - '"\\ud834\\u0X20"', - ] - for s in bad_escapes: - with self.assertRaises(ValueError): - scanstring(s, 1, None, True) - - def test_issue3623(self): - self.assertRaises(ValueError, self.json.decoder.scanstring, b"xxx", 1, - "xxx") - self.assertRaises(UnicodeDecodeError, - self.json.encoder.encode_basestring_ascii, b"xx\xff") - - def test_overflow(self): - with self.assertRaises(OverflowError): - self.json.decoder.scanstring(b"xxx", sys.maxsize+1) - - -class TestPyScanstring(TestScanstring, PyTest): pass -class TestCScanstring(TestScanstring, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py deleted file mode 100644 index b468c3b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_separators.py +++ /dev/null @@ -1,44 +0,0 @@ -import textwrap -from json.tests import PyTest, CTest - - -class TestSeparators(object): - def test_separators(self): - h = [['blorpie'], ['whoops'], [], 'd-shtaeou', 'd-nthiouh', 'i-vhbjkhnth', - {'nifty': 87}, {'field': 'yes', 'morefield': False} ] - - expect = textwrap.dedent("""\ - [ - [ - "blorpie" - ] , - [ - "whoops" - ] , - [] , - "d-shtaeou" , - "d-nthiouh" , - "i-vhbjkhnth" , - { - "nifty" : 87 - } , - { - "field" : "yes" , - "morefield" : false - } - ]""") - - - d1 = self.dumps(h) - d2 = self.dumps(h, indent=2, sort_keys=True, separators=(' ,', ' : ')) - - h1 = self.loads(d1) - h2 = self.loads(d2) - - self.assertEqual(h1, h) - self.assertEqual(h2, h) - self.assertEqual(d2, expect) - - -class TestPySeparators(TestSeparators, PyTest): pass -class TestCSeparators(TestSeparators, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py deleted file mode 100644 index bc0e00d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_speedups.py +++ /dev/null @@ -1,23 +0,0 @@ -from json.tests import CTest - - -class TestSpeedups(CTest): - def test_scanstring(self): - self.assertEqual(self.json.decoder.scanstring.__module__, "_json") - self.assertIs(self.json.decoder.scanstring, self.json.decoder.c_scanstring) - - def test_encode_basestring_ascii(self): - self.assertEqual(self.json.encoder.encode_basestring_ascii.__module__, - "_json") - self.assertIs(self.json.encoder.encode_basestring_ascii, - self.json.encoder.c_encode_basestring_ascii) - -class TestDecode(CTest): - def test_make_scanner(self): - self.assertRaises(AttributeError, self.json.scanner.c_make_scanner, 1) - - def test_make_encoder(self): - self.assertRaises(TypeError, self.json.encoder.c_make_encoder, - None, - "\xCD\x7D\x3D\x4E\x12\x4C\xF9\x79\xD7\x52\xBA\x82\xF2\x27\x4A\x7D\xA0\xCA\x75", - None) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py deleted file mode 100644 index b45c1e2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_tool.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import sys -import textwrap -import unittest -import subprocess -from test import test_support -from test.script_helper import assert_python_ok - -class TestTool(unittest.TestCase): - data = """ - - [["blorpie"],[ "whoops" ] , [ - ],\t"d-shtaeou",\r"d-nthiouh", - "i-vhbjkhnth", {"nifty":87}, {"morefield" :\tfalse,"field" - :"yes"} ] - """ - - expect = textwrap.dedent("""\ - [ - [ - "blorpie" - ], - [ - "whoops" - ], - [], - "d-shtaeou", - "d-nthiouh", - "i-vhbjkhnth", - { - "nifty": 87 - }, - { - "field": "yes", - "morefield": false - } - ] - """) - - def test_stdin_stdout(self): - proc = subprocess.Popen( - (sys.executable, '-m', 'json.tool'), - stdin=subprocess.PIPE, stdout=subprocess.PIPE) - out, err = proc.communicate(self.data.encode()) - self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) - self.assertEqual(err, None) - - def _create_infile(self): - infile = test_support.TESTFN - with open(infile, "w") as fp: - self.addCleanup(os.remove, infile) - fp.write(self.data) - return infile - - def test_infile_stdout(self): - infile = self._create_infile() - rc, out, err = assert_python_ok('-m', 'json.tool', infile) - self.assertEqual(out.splitlines(), self.expect.encode().splitlines()) - self.assertEqual(err, b'') - - def test_infile_outfile(self): - infile = self._create_infile() - outfile = test_support.TESTFN + '.out' - rc, out, err = assert_python_ok('-m', 'json.tool', infile, outfile) - self.addCleanup(os.remove, outfile) - with open(outfile, "r") as fp: - self.assertEqual(fp.read(), self.expect) - self.assertEqual(out, b'') - self.assertEqual(err, b'') diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py deleted file mode 100644 index 4edc69a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tests/test_unicode.py +++ /dev/null @@ -1,89 +0,0 @@ -from collections import OrderedDict -from json.tests import PyTest, CTest - - -class TestUnicode(object): - def test_encoding1(self): - encoder = self.json.JSONEncoder(encoding='utf-8') - u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' - s = u.encode('utf-8') - ju = encoder.encode(u) - js = encoder.encode(s) - self.assertEqual(ju, js) - - def test_encoding2(self): - u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' - s = u.encode('utf-8') - ju = self.dumps(u, encoding='utf-8') - js = self.dumps(s, encoding='utf-8') - self.assertEqual(ju, js) - - def test_encoding3(self): - u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' - j = self.dumps(u) - self.assertEqual(j, '"\\u03b1\\u03a9"') - - def test_encoding4(self): - u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' - j = self.dumps([u]) - self.assertEqual(j, '["\\u03b1\\u03a9"]') - - def test_encoding5(self): - u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' - j = self.dumps(u, ensure_ascii=False) - self.assertEqual(j, u'"{0}"'.format(u)) - - def test_encoding6(self): - u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}' - j = self.dumps([u], ensure_ascii=False) - self.assertEqual(j, u'["{0}"]'.format(u)) - - def test_big_unicode_encode(self): - u = u'\U0001d120' - self.assertEqual(self.dumps(u), '"\\ud834\\udd20"') - self.assertEqual(self.dumps(u, ensure_ascii=False), u'"\U0001d120"') - - def test_big_unicode_decode(self): - u = u'z\U0001d120x' - self.assertEqual(self.loads('"' + u + '"'), u) - self.assertEqual(self.loads('"z\\ud834\\udd20x"'), u) - - def test_unicode_decode(self): - for i in range(0, 0xd7ff): - u = unichr(i) - s = '"\\u{0:04x}"'.format(i) - self.assertEqual(self.loads(s), u) - - def test_object_pairs_hook_with_unicode(self): - s = u'{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7}' - p = [(u"xkd", 1), (u"kcw", 2), (u"art", 3), (u"hxm", 4), - (u"qrt", 5), (u"pad", 6), (u"hoy", 7)] - self.assertEqual(self.loads(s), eval(s)) - self.assertEqual(self.loads(s, object_pairs_hook = lambda x: x), p) - od = self.loads(s, object_pairs_hook = OrderedDict) - self.assertEqual(od, OrderedDict(p)) - self.assertEqual(type(od), OrderedDict) - # the object_pairs_hook takes priority over the object_hook - self.assertEqual(self.loads(s, - object_pairs_hook = OrderedDict, - object_hook = lambda x: None), - OrderedDict(p)) - - def test_default_encoding(self): - self.assertEqual(self.loads(u'{"a": "\xe9"}'.encode('utf-8')), - {'a': u'\xe9'}) - - def test_unicode_preservation(self): - self.assertEqual(type(self.loads(u'""')), unicode) - self.assertEqual(type(self.loads(u'"a"')), unicode) - self.assertEqual(type(self.loads(u'["a"]')[0]), unicode) - # Issue 10038. - self.assertEqual(type(self.loads('"foo"')), unicode) - - def test_bad_encoding(self): - self.assertRaises(UnicodeEncodeError, self.loads, '"a"', u"rat\xe9") - self.assertRaises(TypeError, self.loads, '"a"', 1) - - -class TestPyUnicode(TestUnicode, PyTest): pass -class TestCUnicode(TestUnicode, CTest): pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py deleted file mode 100644 index ea96f6b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/json/tool.py +++ /dev/null @@ -1,40 +0,0 @@ -r"""Command-line tool to validate and pretty-print JSON - -Usage:: - - $ echo '{"json":"obj"}' | python -m json.tool - { - "json": "obj" - } - $ echo '{ 1.2:3.4}' | python -m json.tool - Expecting property name enclosed in double quotes: line 1 column 3 (char 2) - -""" -import sys -import json - -def main(): - if len(sys.argv) == 1: - infile = sys.stdin - outfile = sys.stdout - elif len(sys.argv) == 2: - infile = open(sys.argv[1], 'rb') - outfile = sys.stdout - elif len(sys.argv) == 3: - infile = open(sys.argv[1], 'rb') - outfile = open(sys.argv[2], 'wb') - else: - raise SystemExit(sys.argv[0] + " [infile [outfile]]") - with infile: - try: - obj = json.load(infile) - except ValueError, e: - raise SystemExit(e) - with outfile: - json.dump(obj, outfile, sort_keys=True, - indent=4, separators=(',', ': ')) - outfile.write('\n') - - -if __name__ == '__main__': - main() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py deleted file mode 100644 index d8a0746..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/keyword.py +++ /dev/null @@ -1,93 +0,0 @@ -#! /usr/bin/env python - -"""Keywords (from "graminit.c") - -This file is automatically generated; please don't muck it up! - -To update the symbols in this file, 'cd' to the top directory of -the python source tree after building the interpreter and run: - - ./python Lib/keyword.py -""" - -__all__ = ["iskeyword", "kwlist"] - -kwlist = [ -#--start keywords-- - 'and', - 'as', - 'assert', - 'break', - 'class', - 'continue', - 'def', - 'del', - 'elif', - 'else', - 'except', - 'exec', - 'finally', - 'for', - 'from', - 'global', - 'if', - 'import', - 'in', - 'is', - 'lambda', - 'not', - 'or', - 'pass', - 'print', - 'raise', - 'return', - 'try', - 'while', - 'with', - 'yield', -#--end keywords-- - ] - -iskeyword = frozenset(kwlist).__contains__ - -def main(): - import sys, re - - args = sys.argv[1:] - iptfile = args and args[0] or "Python/graminit.c" - if len(args) > 1: optfile = args[1] - else: optfile = "Lib/keyword.py" - - # scan the source file for keywords - fp = open(iptfile) - strprog = re.compile('"([^"]+)"') - lines = [] - for line in fp: - if '{1, "' in line: - match = strprog.search(line) - if match: - lines.append(" '" + match.group(1) + "',\n") - fp.close() - lines.sort() - - # load the output skeleton from the target - fp = open(optfile) - format = fp.readlines() - fp.close() - - # insert the lines of keywords - try: - start = format.index("#--start keywords--\n") + 1 - end = format.index("#--end keywords--\n") - format[start:end] = lines - except ValueError: - sys.stderr.write("target does not contain format markers\n") - sys.exit(1) - - # write the output file - fp = open(optfile, 'w') - fp.write(''.join(format)) - fp.close() - -if __name__ == "__main__": - main() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py deleted file mode 100644 index 1495348..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/linecache.py +++ /dev/null @@ -1,139 +0,0 @@ -"""Cache lines from files. - -This is intended to read lines from modules imported -- hence if a filename -is not found, it will look down the module search path for a file by -that name. -""" - -import sys -import os - -__all__ = ["getline", "clearcache", "checkcache"] - -def getline(filename, lineno, module_globals=None): - lines = getlines(filename, module_globals) - if 1 <= lineno <= len(lines): - return lines[lineno-1] - else: - return '' - - -# The cache - -cache = {} # The cache - - -def clearcache(): - """Clear the cache entirely.""" - - global cache - cache = {} - - -def getlines(filename, module_globals=None): - """Get the lines for a file from the cache. - Update the cache if it doesn't contain an entry for this file already.""" - - if filename in cache: - return cache[filename][2] - - try: - return updatecache(filename, module_globals) - except MemoryError: - clearcache() - return [] - - -def checkcache(filename=None): - """Discard cache entries that are out of date. - (This is not checked upon each call!)""" - - if filename is None: - filenames = cache.keys() - else: - if filename in cache: - filenames = [filename] - else: - return - - for filename in filenames: - size, mtime, lines, fullname = cache[filename] - if mtime is None: - continue # no-op for files loaded via a __loader__ - try: - stat = os.stat(fullname) - except os.error: - del cache[filename] - continue - if size != stat.st_size or mtime != stat.st_mtime: - del cache[filename] - - -def updatecache(filename, module_globals=None): - """Update a cache entry and return its list of lines. - If something's wrong, print a message, discard the cache entry, - and return an empty list.""" - - if filename in cache: - del cache[filename] - if not filename or (filename.startswith('<') and filename.endswith('>')): - return [] - - fullname = filename - try: - stat = os.stat(fullname) - except OSError: - basename = filename - - # Try for a __loader__, if available - if module_globals and '__loader__' in module_globals: - name = module_globals.get('__name__') - loader = module_globals['__loader__'] - get_source = getattr(loader, 'get_source', None) - - if name and get_source: - try: - data = get_source(name) - except (ImportError, IOError): - pass - else: - if data is None: - # No luck, the PEP302 loader cannot find the source - # for this module. - return [] - cache[filename] = ( - len(data), None, - [line+'\n' for line in data.splitlines()], fullname - ) - return cache[filename][2] - - # Try looking through the module search path, which is only useful - # when handling a relative filename. - if os.path.isabs(filename): - return [] - - for dirname in sys.path: - # When using imputil, sys.path may contain things other than - # strings; ignore them when it happens. - try: - fullname = os.path.join(dirname, basename) - except (TypeError, AttributeError): - # Not sufficiently string-like to do anything useful with. - continue - try: - stat = os.stat(fullname) - break - except os.error: - pass - else: - return [] - try: - with open(fullname, 'rU') as fp: - lines = fp.readlines() - except IOError: - return [] - if lines and not lines[-1].endswith('\n'): - lines[-1] += '\n' - size, mtime = stat.st_size, stat.st_mtime - cache[filename] = size, mtime, lines, fullname - return lines diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py deleted file mode 100644 index 7d466bf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/locale.py +++ /dev/null @@ -1,2062 +0,0 @@ -""" Locale support. - - The module provides low-level access to the C lib's locale APIs - and adds high level number formatting APIs as well as a locale - aliasing engine to complement these. - - The aliasing engine includes support for many commonly used locale - names and maps them to values suitable for passing to the C lib's - setlocale() function. It also includes default encodings for all - supported locale names. - -""" - -import sys -import encodings -import encodings.aliases -import re -import operator -import functools - -try: - _unicode = unicode -except NameError: - # If Python is built without Unicode support, the unicode type - # will not exist. Fake one. - class _unicode(object): - pass - -# Try importing the _locale module. -# -# If this fails, fall back on a basic 'C' locale emulation. - -# Yuck: LC_MESSAGES is non-standard: can't tell whether it exists before -# trying the import. So __all__ is also fiddled at the end of the file. -__all__ = ["getlocale", "getdefaultlocale", "getpreferredencoding", "Error", - "setlocale", "resetlocale", "localeconv", "strcoll", "strxfrm", - "str", "atof", "atoi", "format", "format_string", "currency", - "normalize", "LC_CTYPE", "LC_COLLATE", "LC_TIME", "LC_MONETARY", - "LC_NUMERIC", "LC_ALL", "CHAR_MAX"] - -try: - - from _locale import * - -except ImportError: - - # Locale emulation - - CHAR_MAX = 127 - LC_ALL = 6 - LC_COLLATE = 3 - LC_CTYPE = 0 - LC_MESSAGES = 5 - LC_MONETARY = 4 - LC_NUMERIC = 1 - LC_TIME = 2 - Error = ValueError - - def localeconv(): - """ localeconv() -> dict. - Returns numeric and monetary locale-specific parameters. - """ - # 'C' locale default values - return {'grouping': [127], - 'currency_symbol': '', - 'n_sign_posn': 127, - 'p_cs_precedes': 127, - 'n_cs_precedes': 127, - 'mon_grouping': [], - 'n_sep_by_space': 127, - 'decimal_point': '.', - 'negative_sign': '', - 'positive_sign': '', - 'p_sep_by_space': 127, - 'int_curr_symbol': '', - 'p_sign_posn': 127, - 'thousands_sep': '', - 'mon_thousands_sep': '', - 'frac_digits': 127, - 'mon_decimal_point': '', - 'int_frac_digits': 127} - - def setlocale(category, value=None): - """ setlocale(integer,string=None) -> string. - Activates/queries locale processing. - """ - if value not in (None, '', 'C'): - raise Error, '_locale emulation only supports "C" locale' - return 'C' - - def strcoll(a,b): - """ strcoll(string,string) -> int. - Compares two strings according to the locale. - """ - return cmp(a,b) - - def strxfrm(s): - """ strxfrm(string) -> string. - Returns a string that behaves for cmp locale-aware. - """ - return s - - -_localeconv = localeconv - -# With this dict, you can override some items of localeconv's return value. -# This is useful for testing purposes. -_override_localeconv = {} - -@functools.wraps(_localeconv) -def localeconv(): - d = _localeconv() - if _override_localeconv: - d.update(_override_localeconv) - return d - - -### Number formatting APIs - -# Author: Martin von Loewis -# improved by Georg Brandl - -# Iterate over grouping intervals -def _grouping_intervals(grouping): - last_interval = None - for interval in grouping: - # if grouping is -1, we are done - if interval == CHAR_MAX: - return - # 0: re-use last group ad infinitum - if interval == 0: - if last_interval is None: - raise ValueError("invalid grouping") - while True: - yield last_interval - yield interval - last_interval = interval - -#perform the grouping from right to left -def _group(s, monetary=False): - conv = localeconv() - thousands_sep = conv[monetary and 'mon_thousands_sep' or 'thousands_sep'] - grouping = conv[monetary and 'mon_grouping' or 'grouping'] - if not grouping: - return (s, 0) - if s[-1] == ' ': - stripped = s.rstrip() - right_spaces = s[len(stripped):] - s = stripped - else: - right_spaces = '' - left_spaces = '' - groups = [] - for interval in _grouping_intervals(grouping): - if not s or s[-1] not in "0123456789": - # only non-digit characters remain (sign, spaces) - left_spaces = s - s = '' - break - groups.append(s[-interval:]) - s = s[:-interval] - if s: - groups.append(s) - groups.reverse() - return ( - left_spaces + thousands_sep.join(groups) + right_spaces, - len(thousands_sep) * (len(groups) - 1) - ) - -# Strip a given amount of excess padding from the given string -def _strip_padding(s, amount): - lpos = 0 - while amount and s[lpos] == ' ': - lpos += 1 - amount -= 1 - rpos = len(s) - 1 - while amount and s[rpos] == ' ': - rpos -= 1 - amount -= 1 - return s[lpos:rpos+1] - -_percent_re = re.compile(r'%(?:\((?P.*?)\))?' - r'(?P[-#0-9 +*.hlL]*?)[eEfFgGdiouxXcrs%]') - -def format(percent, value, grouping=False, monetary=False, *additional): - """Returns the locale-aware substitution of a %? specifier - (percent). - - additional is for format strings which contain one or more - '*' modifiers.""" - # this is only for one-percent-specifier strings and this should be checked - match = _percent_re.match(percent) - if not match or len(match.group())!= len(percent): - raise ValueError(("format() must be given exactly one %%char " - "format specifier, %s not valid") % repr(percent)) - return _format(percent, value, grouping, monetary, *additional) - -def _format(percent, value, grouping=False, monetary=False, *additional): - if additional: - formatted = percent % ((value,) + additional) - else: - formatted = percent % value - # floats and decimal ints need special action! - if percent[-1] in 'eEfFgG': - seps = 0 - parts = formatted.split('.') - if grouping: - parts[0], seps = _group(parts[0], monetary=monetary) - decimal_point = localeconv()[monetary and 'mon_decimal_point' - or 'decimal_point'] - formatted = decimal_point.join(parts) - if seps: - formatted = _strip_padding(formatted, seps) - elif percent[-1] in 'diu': - seps = 0 - if grouping: - formatted, seps = _group(formatted, monetary=monetary) - if seps: - formatted = _strip_padding(formatted, seps) - return formatted - -def format_string(f, val, grouping=False): - """Formats a string in the same way that the % formatting would use, - but takes the current locale into account. - Grouping is applied if the third parameter is true.""" - percents = list(_percent_re.finditer(f)) - new_f = _percent_re.sub('%s', f) - - if operator.isMappingType(val): - new_val = [] - for perc in percents: - if perc.group()[-1]=='%': - new_val.append('%') - else: - new_val.append(format(perc.group(), val, grouping)) - else: - if not isinstance(val, tuple): - val = (val,) - new_val = [] - i = 0 - for perc in percents: - if perc.group()[-1]=='%': - new_val.append('%') - else: - starcount = perc.group('modifiers').count('*') - new_val.append(_format(perc.group(), - val[i], - grouping, - False, - *val[i+1:i+1+starcount])) - i += (1 + starcount) - val = tuple(new_val) - - return new_f % val - -def currency(val, symbol=True, grouping=False, international=False): - """Formats val according to the currency settings - in the current locale.""" - conv = localeconv() - - # check for illegal values - digits = conv[international and 'int_frac_digits' or 'frac_digits'] - if digits == 127: - raise ValueError("Currency formatting is not possible using " - "the 'C' locale.") - - s = format('%%.%if' % digits, abs(val), grouping, monetary=True) - # '<' and '>' are markers if the sign must be inserted between symbol and value - s = '<' + s + '>' - - if symbol: - smb = conv[international and 'int_curr_symbol' or 'currency_symbol'] - precedes = conv[val<0 and 'n_cs_precedes' or 'p_cs_precedes'] - separated = conv[val<0 and 'n_sep_by_space' or 'p_sep_by_space'] - - if precedes: - s = smb + (separated and ' ' or '') + s - else: - s = s + (separated and ' ' or '') + smb - - sign_pos = conv[val<0 and 'n_sign_posn' or 'p_sign_posn'] - sign = conv[val<0 and 'negative_sign' or 'positive_sign'] - - if sign_pos == 0: - s = '(' + s + ')' - elif sign_pos == 1: - s = sign + s - elif sign_pos == 2: - s = s + sign - elif sign_pos == 3: - s = s.replace('<', sign) - elif sign_pos == 4: - s = s.replace('>', sign) - else: - # the default if nothing specified; - # this should be the most fitting sign position - s = sign + s - - return s.replace('<', '').replace('>', '') - -def str(val): - """Convert float to integer, taking the locale into account.""" - return format("%.12g", val) - -def atof(string, func=float): - "Parses a string as a float according to the locale settings." - #First, get rid of the grouping - ts = localeconv()['thousands_sep'] - if ts: - string = string.replace(ts, '') - #next, replace the decimal point with a dot - dd = localeconv()['decimal_point'] - if dd: - string = string.replace(dd, '.') - #finally, parse the string - return func(string) - -def atoi(str): - "Converts a string to an integer according to the locale settings." - return atof(str, int) - -def _test(): - setlocale(LC_ALL, "") - #do grouping - s1 = format("%d", 123456789,1) - print s1, "is", atoi(s1) - #standard formatting - s1 = str(3.14) - print s1, "is", atof(s1) - -### Locale name aliasing engine - -# Author: Marc-Andre Lemburg, mal@lemburg.com -# Various tweaks by Fredrik Lundh - -# store away the low-level version of setlocale (it's -# overridden below) -_setlocale = setlocale - -# Avoid relying on the locale-dependent .lower() method -# (see issue #1813). -_ascii_lower_map = ''.join( - chr(x + 32 if x >= ord('A') and x <= ord('Z') else x) - for x in range(256) -) - -def _replace_encoding(code, encoding): - if '.' in code: - langname = code[:code.index('.')] - else: - langname = code - # Convert the encoding to a C lib compatible encoding string - norm_encoding = encodings.normalize_encoding(encoding) - #print('norm encoding: %r' % norm_encoding) - norm_encoding = encodings.aliases.aliases.get(norm_encoding, - norm_encoding) - #print('aliased encoding: %r' % norm_encoding) - encoding = locale_encoding_alias.get(norm_encoding, - norm_encoding) - #print('found encoding %r' % encoding) - return langname + '.' + encoding - -def normalize(localename): - - """ Returns a normalized locale code for the given locale - name. - - The returned locale code is formatted for use with - setlocale(). - - If normalization fails, the original name is returned - unchanged. - - If the given encoding is not known, the function defaults to - the default encoding for the locale code just like setlocale() - does. - - """ - # Normalize the locale name and extract the encoding and modifier - if isinstance(localename, _unicode): - localename = localename.encode('ascii') - code = localename.translate(_ascii_lower_map) - if ':' in code: - # ':' is sometimes used as encoding delimiter. - code = code.replace(':', '.') - if '@' in code: - code, modifier = code.split('@', 1) - else: - modifier = '' - if '.' in code: - langname, encoding = code.split('.')[:2] - else: - langname = code - encoding = '' - - # First lookup: fullname (possibly with encoding and modifier) - lang_enc = langname - if encoding: - norm_encoding = encoding.replace('-', '') - norm_encoding = norm_encoding.replace('_', '') - lang_enc += '.' + norm_encoding - lookup_name = lang_enc - if modifier: - lookup_name += '@' + modifier - code = locale_alias.get(lookup_name, None) - if code is not None: - return code - #print('first lookup failed') - - if modifier: - # Second try: fullname without modifier (possibly with encoding) - code = locale_alias.get(lang_enc, None) - if code is not None: - #print('lookup without modifier succeeded') - if '@' not in code: - return code + '@' + modifier - if code.split('@', 1)[1].translate(_ascii_lower_map) == modifier: - return code - #print('second lookup failed') - - if encoding: - # Third try: langname (without encoding, possibly with modifier) - lookup_name = langname - if modifier: - lookup_name += '@' + modifier - code = locale_alias.get(lookup_name, None) - if code is not None: - #print('lookup without encoding succeeded') - if '@' not in code: - return _replace_encoding(code, encoding) - code, modifier = code.split('@', 1) - return _replace_encoding(code, encoding) + '@' + modifier - - if modifier: - # Fourth try: langname (without encoding and modifier) - code = locale_alias.get(langname, None) - if code is not None: - #print('lookup without modifier and encoding succeeded') - if '@' not in code: - return _replace_encoding(code, encoding) + '@' + modifier - code, defmod = code.split('@', 1) - if defmod.translate(_ascii_lower_map) == modifier: - return _replace_encoding(code, encoding) + '@' + defmod - - return localename - -def _parse_localename(localename): - - """ Parses the locale code for localename and returns the - result as tuple (language code, encoding). - - The localename is normalized and passed through the locale - alias engine. A ValueError is raised in case the locale name - cannot be parsed. - - The language code corresponds to RFC 1766. code and encoding - can be None in case the values cannot be determined or are - unknown to this implementation. - - """ - code = normalize(localename) - if '@' in code: - # Deal with locale modifiers - code, modifier = code.split('@', 1) - if modifier == 'euro' and '.' not in code: - # Assume Latin-9 for @euro locales. This is bogus, - # since some systems may use other encodings for these - # locales. Also, we ignore other modifiers. - return code, 'iso-8859-15' - - if '.' in code: - return tuple(code.split('.')[:2]) - elif code == 'C': - return None, None - raise ValueError, 'unknown locale: %s' % localename - -def _build_localename(localetuple): - - """ Builds a locale code from the given tuple (language code, - encoding). - - No aliasing or normalizing takes place. - - """ - language, encoding = localetuple - if language is None: - language = 'C' - if encoding is None: - return language - else: - return language + '.' + encoding - -def getdefaultlocale(envvars=('LC_ALL', 'LC_CTYPE', 'LANG', 'LANGUAGE')): - - """ Tries to determine the default locale settings and returns - them as tuple (language code, encoding). - - According to POSIX, a program which has not called - setlocale(LC_ALL, "") runs using the portable 'C' locale. - Calling setlocale(LC_ALL, "") lets it use the default locale as - defined by the LANG variable. Since we don't want to interfere - with the current locale setting we thus emulate the behavior - in the way described above. - - To maintain compatibility with other platforms, not only the - LANG variable is tested, but a list of variables given as - envvars parameter. The first found to be defined will be - used. envvars defaults to the search path used in GNU gettext; - it must always contain the variable name 'LANG'. - - Except for the code 'C', the language code corresponds to RFC - 1766. code and encoding can be None in case the values cannot - be determined. - - """ - - try: - # check if it's supported by the _locale module - import _locale - code, encoding = _locale._getdefaultlocale() - except (ImportError, AttributeError): - pass - else: - # make sure the code/encoding values are valid - if sys.platform == "win32" and code and code[:2] == "0x": - # map windows language identifier to language name - code = windows_locale.get(int(code, 0)) - # ...add other platform-specific processing here, if - # necessary... - return code, encoding - - # fall back on POSIX behaviour - import os - lookup = os.environ.get - for variable in envvars: - localename = lookup(variable,None) - if localename: - if variable == 'LANGUAGE': - localename = localename.split(':')[0] - break - else: - localename = 'C' - return _parse_localename(localename) - - -def getlocale(category=LC_CTYPE): - - """ Returns the current setting for the given locale category as - tuple (language code, encoding). - - category may be one of the LC_* value except LC_ALL. It - defaults to LC_CTYPE. - - Except for the code 'C', the language code corresponds to RFC - 1766. code and encoding can be None in case the values cannot - be determined. - - """ - localename = _setlocale(category) - if category == LC_ALL and ';' in localename: - raise TypeError, 'category LC_ALL is not supported' - return _parse_localename(localename) - -def setlocale(category, locale=None): - - """ Set the locale for the given category. The locale can be - a string, an iterable of two strings (language code and encoding), - or None. - - Iterables are converted to strings using the locale aliasing - engine. Locale strings are passed directly to the C lib. - - category may be given as one of the LC_* values. - - """ - if locale and type(locale) is not type(""): - # convert to string - locale = normalize(_build_localename(locale)) - return _setlocale(category, locale) - -def resetlocale(category=LC_ALL): - - """ Sets the locale for category to the default setting. - - The default setting is determined by calling - getdefaultlocale(). category defaults to LC_ALL. - - """ - _setlocale(category, _build_localename(getdefaultlocale())) - -if sys.platform.startswith("win"): - # On Win32, this will return the ANSI code page - def getpreferredencoding(do_setlocale = True): - """Return the charset that the user is likely using.""" - import _locale - return _locale._getdefaultlocale()[1] -else: - # On Unix, if CODESET is available, use that. - try: - CODESET - except NameError: - # Fall back to parsing environment variables :-( - def getpreferredencoding(do_setlocale = True): - """Return the charset that the user is likely using, - by looking at environment variables.""" - return getdefaultlocale()[1] - else: - def getpreferredencoding(do_setlocale = True): - """Return the charset that the user is likely using, - according to the system configuration.""" - if do_setlocale: - oldloc = setlocale(LC_CTYPE) - try: - setlocale(LC_CTYPE, "") - except Error: - pass - result = nl_langinfo(CODESET) - setlocale(LC_CTYPE, oldloc) - return result - else: - return nl_langinfo(CODESET) - - -### Database -# -# The following data was extracted from the locale.alias file which -# comes with X11 and then hand edited removing the explicit encoding -# definitions and adding some more aliases. The file is usually -# available as /usr/lib/X11/locale/locale.alias. -# - -# -# The local_encoding_alias table maps lowercase encoding alias names -# to C locale encoding names (case-sensitive). Note that normalize() -# first looks up the encoding in the encodings.aliases dictionary and -# then applies this mapping to find the correct C lib name for the -# encoding. -# -locale_encoding_alias = { - - # Mappings for non-standard encoding names used in locale names - '437': 'C', - 'c': 'C', - 'en': 'ISO8859-1', - 'jis': 'JIS7', - 'jis7': 'JIS7', - 'ajec': 'eucJP', - - # Mappings from Python codec names to C lib encoding names - 'ascii': 'ISO8859-1', - 'latin_1': 'ISO8859-1', - 'iso8859_1': 'ISO8859-1', - 'iso8859_10': 'ISO8859-10', - 'iso8859_11': 'ISO8859-11', - 'iso8859_13': 'ISO8859-13', - 'iso8859_14': 'ISO8859-14', - 'iso8859_15': 'ISO8859-15', - 'iso8859_16': 'ISO8859-16', - 'iso8859_2': 'ISO8859-2', - 'iso8859_3': 'ISO8859-3', - 'iso8859_4': 'ISO8859-4', - 'iso8859_5': 'ISO8859-5', - 'iso8859_6': 'ISO8859-6', - 'iso8859_7': 'ISO8859-7', - 'iso8859_8': 'ISO8859-8', - 'iso8859_9': 'ISO8859-9', - 'iso2022_jp': 'JIS7', - 'shift_jis': 'SJIS', - 'tactis': 'TACTIS', - 'euc_jp': 'eucJP', - 'euc_kr': 'eucKR', - 'utf_8': 'UTF-8', - 'koi8_r': 'KOI8-R', - 'koi8_u': 'KOI8-U', - # XXX This list is still incomplete. If you know more - # mappings, please file a bug report. Thanks. -} - -# -# The locale_alias table maps lowercase alias names to C locale names -# (case-sensitive). Encodings are always separated from the locale -# name using a dot ('.'); they should only be given in case the -# language name is needed to interpret the given encoding alias -# correctly (CJK codes often have this need). -# -# Note that the normalize() function which uses this tables -# removes '_' and '-' characters from the encoding part of the -# locale name before doing the lookup. This saves a lot of -# space in the table. -# -# MAL 2004-12-10: -# Updated alias mapping to most recent locale.alias file -# from X.org distribution using makelocalealias.py. -# -# These are the differences compared to the old mapping (Python 2.4 -# and older): -# -# updated 'bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251' -# updated 'bg_bg' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251' -# updated 'bulgarian' -> 'bg_BG.ISO8859-5' to 'bg_BG.CP1251' -# updated 'cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2' -# updated 'cz_cz' -> 'cz_CZ.ISO8859-2' to 'cs_CZ.ISO8859-2' -# updated 'czech' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2' -# updated 'dutch' -> 'nl_BE.ISO8859-1' to 'nl_NL.ISO8859-1' -# updated 'et' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15' -# updated 'et_ee' -> 'et_EE.ISO8859-4' to 'et_EE.ISO8859-15' -# updated 'fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15' -# updated 'fi_fi' -> 'fi_FI.ISO8859-1' to 'fi_FI.ISO8859-15' -# updated 'iw' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8' -# updated 'iw_il' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8' -# updated 'japanese' -> 'ja_JP.SJIS' to 'ja_JP.eucJP' -# updated 'lt' -> 'lt_LT.ISO8859-4' to 'lt_LT.ISO8859-13' -# updated 'lv' -> 'lv_LV.ISO8859-4' to 'lv_LV.ISO8859-13' -# updated 'sl' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2' -# updated 'slovene' -> 'sl_CS.ISO8859-2' to 'sl_SI.ISO8859-2' -# updated 'th_th' -> 'th_TH.TACTIS' to 'th_TH.ISO8859-11' -# updated 'zh_cn' -> 'zh_CN.eucCN' to 'zh_CN.gb2312' -# updated 'zh_cn.big5' -> 'zh_TW.eucTW' to 'zh_TW.big5' -# updated 'zh_tw' -> 'zh_TW.eucTW' to 'zh_TW.big5' -# -# MAL 2008-05-30: -# Updated alias mapping to most recent locale.alias file -# from X.org distribution using makelocalealias.py. -# -# These are the differences compared to the old mapping (Python 2.5 -# and older): -# -# updated 'cs_cs.iso88592' -> 'cs_CZ.ISO8859-2' to 'cs_CS.ISO8859-2' -# updated 'serbocroatian' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' -# updated 'sh' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' -# updated 'sh_hr.iso88592' -> 'sh_HR.ISO8859-2' to 'hr_HR.ISO8859-2' -# updated 'sh_sp' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' -# updated 'sh_yu' -> 'sh_YU.ISO8859-2' to 'sr_CS.ISO8859-2' -# updated 'sp' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sp_yu' -> 'sp_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sr' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sr@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sr_sp' -> 'sr_SP.ISO8859-2' to 'sr_CS.ISO8859-2' -# updated 'sr_yu' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sr_yu.cp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251' -# updated 'sr_yu.iso88592' -> 'sr_YU.ISO8859-2' to 'sr_CS.ISO8859-2' -# updated 'sr_yu.iso88595' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sr_yu.iso88595@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# updated 'sr_yu.microsoftcp1251@cyrillic' -> 'sr_YU.CP1251' to 'sr_CS.CP1251' -# updated 'sr_yu.utf8@cyrillic' -> 'sr_YU.UTF-8' to 'sr_CS.UTF-8' -# updated 'sr_yu@cyrillic' -> 'sr_YU.ISO8859-5' to 'sr_CS.ISO8859-5' -# -# AP 2010-04-12: -# Updated alias mapping to most recent locale.alias file -# from X.org distribution using makelocalealias.py. -# -# These are the differences compared to the old mapping (Python 2.6.5 -# and older): -# -# updated 'ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8' -# updated 'ru_ru' -> 'ru_RU.ISO8859-5' to 'ru_RU.UTF-8' -# updated 'serbocroatian' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin' -# updated 'sh' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin' -# updated 'sh_yu' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin' -# updated 'sr' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8' -# updated 'sr@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8' -# updated 'sr@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin' -# updated 'sr_cs.utf8@latn' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8@latin' -# updated 'sr_cs@latn' -> 'sr_CS.ISO8859-2' to 'sr_RS.UTF-8@latin' -# updated 'sr_yu' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8@latin' -# updated 'sr_yu.utf8@cyrillic' -> 'sr_CS.UTF-8' to 'sr_RS.UTF-8' -# updated 'sr_yu@cyrillic' -> 'sr_CS.ISO8859-5' to 'sr_RS.UTF-8' -# -# SS 2013-12-20: -# Updated alias mapping to most recent locale.alias file -# from X.org distribution using makelocalealias.py. -# -# These are the differences compared to the old mapping (Python 2.7.6 -# and older): -# -# updated 'a3' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C' -# updated 'a3_az' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C' -# updated 'a3_az.koi8c' -> 'a3_AZ.KOI8-C' to 'az_AZ.KOI8-C' -# updated 'cs_cs.iso88592' -> 'cs_CS.ISO8859-2' to 'cs_CZ.ISO8859-2' -# updated 'hebrew' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8' -# updated 'hebrew.iso88598' -> 'iw_IL.ISO8859-8' to 'he_IL.ISO8859-8' -# updated 'sd' -> 'sd_IN@devanagari.UTF-8' to 'sd_IN.UTF-8' -# updated 'sr@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin' -# updated 'sr_cs' -> 'sr_RS.UTF-8' to 'sr_CS.UTF-8' -# updated 'sr_cs.utf8@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin' -# updated 'sr_cs@latn' -> 'sr_RS.UTF-8@latin' to 'sr_CS.UTF-8@latin' -# -# SS 2014-10-01: -# Updated alias mapping with glibc 2.19 supported locales. - -locale_alias = { - 'a3': 'az_AZ.KOI8-C', - 'a3_az': 'az_AZ.KOI8-C', - 'a3_az.koi8c': 'az_AZ.KOI8-C', - 'a3_az.koic': 'az_AZ.KOI8-C', - 'aa_dj': 'aa_DJ.ISO8859-1', - 'aa_er': 'aa_ER.UTF-8', - 'aa_et': 'aa_ET.UTF-8', - 'af': 'af_ZA.ISO8859-1', - 'af_za': 'af_ZA.ISO8859-1', - 'af_za.iso88591': 'af_ZA.ISO8859-1', - 'am': 'am_ET.UTF-8', - 'am_et': 'am_ET.UTF-8', - 'american': 'en_US.ISO8859-1', - 'american.iso88591': 'en_US.ISO8859-1', - 'an_es': 'an_ES.ISO8859-15', - 'ar': 'ar_AA.ISO8859-6', - 'ar_aa': 'ar_AA.ISO8859-6', - 'ar_aa.iso88596': 'ar_AA.ISO8859-6', - 'ar_ae': 'ar_AE.ISO8859-6', - 'ar_ae.iso88596': 'ar_AE.ISO8859-6', - 'ar_bh': 'ar_BH.ISO8859-6', - 'ar_bh.iso88596': 'ar_BH.ISO8859-6', - 'ar_dz': 'ar_DZ.ISO8859-6', - 'ar_dz.iso88596': 'ar_DZ.ISO8859-6', - 'ar_eg': 'ar_EG.ISO8859-6', - 'ar_eg.iso88596': 'ar_EG.ISO8859-6', - 'ar_in': 'ar_IN.UTF-8', - 'ar_iq': 'ar_IQ.ISO8859-6', - 'ar_iq.iso88596': 'ar_IQ.ISO8859-6', - 'ar_jo': 'ar_JO.ISO8859-6', - 'ar_jo.iso88596': 'ar_JO.ISO8859-6', - 'ar_kw': 'ar_KW.ISO8859-6', - 'ar_kw.iso88596': 'ar_KW.ISO8859-6', - 'ar_lb': 'ar_LB.ISO8859-6', - 'ar_lb.iso88596': 'ar_LB.ISO8859-6', - 'ar_ly': 'ar_LY.ISO8859-6', - 'ar_ly.iso88596': 'ar_LY.ISO8859-6', - 'ar_ma': 'ar_MA.ISO8859-6', - 'ar_ma.iso88596': 'ar_MA.ISO8859-6', - 'ar_om': 'ar_OM.ISO8859-6', - 'ar_om.iso88596': 'ar_OM.ISO8859-6', - 'ar_qa': 'ar_QA.ISO8859-6', - 'ar_qa.iso88596': 'ar_QA.ISO8859-6', - 'ar_sa': 'ar_SA.ISO8859-6', - 'ar_sa.iso88596': 'ar_SA.ISO8859-6', - 'ar_sd': 'ar_SD.ISO8859-6', - 'ar_sd.iso88596': 'ar_SD.ISO8859-6', - 'ar_sy': 'ar_SY.ISO8859-6', - 'ar_sy.iso88596': 'ar_SY.ISO8859-6', - 'ar_tn': 'ar_TN.ISO8859-6', - 'ar_tn.iso88596': 'ar_TN.ISO8859-6', - 'ar_ye': 'ar_YE.ISO8859-6', - 'ar_ye.iso88596': 'ar_YE.ISO8859-6', - 'arabic': 'ar_AA.ISO8859-6', - 'arabic.iso88596': 'ar_AA.ISO8859-6', - 'as': 'as_IN.UTF-8', - 'as_in': 'as_IN.UTF-8', - 'ast_es': 'ast_ES.ISO8859-15', - 'ayc_pe': 'ayc_PE.UTF-8', - 'az': 'az_AZ.ISO8859-9E', - 'az_az': 'az_AZ.ISO8859-9E', - 'az_az.iso88599e': 'az_AZ.ISO8859-9E', - 'be': 'be_BY.CP1251', - 'be@latin': 'be_BY.UTF-8@latin', - 'be_bg.utf8': 'bg_BG.UTF-8', - 'be_by': 'be_BY.CP1251', - 'be_by.cp1251': 'be_BY.CP1251', - 'be_by.microsoftcp1251': 'be_BY.CP1251', - 'be_by.utf8@latin': 'be_BY.UTF-8@latin', - 'be_by@latin': 'be_BY.UTF-8@latin', - 'bem_zm': 'bem_ZM.UTF-8', - 'ber_dz': 'ber_DZ.UTF-8', - 'ber_ma': 'ber_MA.UTF-8', - 'bg': 'bg_BG.CP1251', - 'bg_bg': 'bg_BG.CP1251', - 'bg_bg.cp1251': 'bg_BG.CP1251', - 'bg_bg.iso88595': 'bg_BG.ISO8859-5', - 'bg_bg.koi8r': 'bg_BG.KOI8-R', - 'bg_bg.microsoftcp1251': 'bg_BG.CP1251', - 'bho_in': 'bho_IN.UTF-8', - 'bn_bd': 'bn_BD.UTF-8', - 'bn_in': 'bn_IN.UTF-8', - 'bo_cn': 'bo_CN.UTF-8', - 'bo_in': 'bo_IN.UTF-8', - 'bokmal': 'nb_NO.ISO8859-1', - 'bokm\xe5l': 'nb_NO.ISO8859-1', - 'br': 'br_FR.ISO8859-1', - 'br_fr': 'br_FR.ISO8859-1', - 'br_fr.iso88591': 'br_FR.ISO8859-1', - 'br_fr.iso885914': 'br_FR.ISO8859-14', - 'br_fr.iso885915': 'br_FR.ISO8859-15', - 'br_fr.iso885915@euro': 'br_FR.ISO8859-15', - 'br_fr.utf8@euro': 'br_FR.UTF-8', - 'br_fr@euro': 'br_FR.ISO8859-15', - 'brx_in': 'brx_IN.UTF-8', - 'bs': 'bs_BA.ISO8859-2', - 'bs_ba': 'bs_BA.ISO8859-2', - 'bs_ba.iso88592': 'bs_BA.ISO8859-2', - 'bulgarian': 'bg_BG.CP1251', - 'byn_er': 'byn_ER.UTF-8', - 'c': 'C', - 'c-french': 'fr_CA.ISO8859-1', - 'c-french.iso88591': 'fr_CA.ISO8859-1', - 'c.ascii': 'C', - 'c.en': 'C', - 'c.iso88591': 'en_US.ISO8859-1', - 'c.utf8': 'en_US.UTF-8', - 'c_c': 'C', - 'c_c.c': 'C', - 'ca': 'ca_ES.ISO8859-1', - 'ca_ad': 'ca_AD.ISO8859-1', - 'ca_ad.iso88591': 'ca_AD.ISO8859-1', - 'ca_ad.iso885915': 'ca_AD.ISO8859-15', - 'ca_ad.iso885915@euro': 'ca_AD.ISO8859-15', - 'ca_ad.utf8@euro': 'ca_AD.UTF-8', - 'ca_ad@euro': 'ca_AD.ISO8859-15', - 'ca_es': 'ca_ES.ISO8859-1', - 'ca_es.iso88591': 'ca_ES.ISO8859-1', - 'ca_es.iso885915': 'ca_ES.ISO8859-15', - 'ca_es.iso885915@euro': 'ca_ES.ISO8859-15', - 'ca_es.utf8@euro': 'ca_ES.UTF-8', - 'ca_es@valencia': 'ca_ES.ISO8859-15@valencia', - 'ca_es@euro': 'ca_ES.ISO8859-15', - 'ca_fr': 'ca_FR.ISO8859-1', - 'ca_fr.iso88591': 'ca_FR.ISO8859-1', - 'ca_fr.iso885915': 'ca_FR.ISO8859-15', - 'ca_fr.iso885915@euro': 'ca_FR.ISO8859-15', - 'ca_fr.utf8@euro': 'ca_FR.UTF-8', - 'ca_fr@euro': 'ca_FR.ISO8859-15', - 'ca_it': 'ca_IT.ISO8859-1', - 'ca_it.iso88591': 'ca_IT.ISO8859-1', - 'ca_it.iso885915': 'ca_IT.ISO8859-15', - 'ca_it.iso885915@euro': 'ca_IT.ISO8859-15', - 'ca_it.utf8@euro': 'ca_IT.UTF-8', - 'ca_it@euro': 'ca_IT.ISO8859-15', - 'catalan': 'ca_ES.ISO8859-1', - 'cextend': 'en_US.ISO8859-1', - 'cextend.en': 'en_US.ISO8859-1', - 'chinese-s': 'zh_CN.eucCN', - 'chinese-t': 'zh_TW.eucTW', - 'crh_ua': 'crh_UA.UTF-8', - 'croatian': 'hr_HR.ISO8859-2', - 'cs': 'cs_CZ.ISO8859-2', - 'cs_cs': 'cs_CZ.ISO8859-2', - 'cs_cs.iso88592': 'cs_CZ.ISO8859-2', - 'cs_cz': 'cs_CZ.ISO8859-2', - 'cs_cz.iso88592': 'cs_CZ.ISO8859-2', - 'csb_pl': 'csb_PL.UTF-8', - 'cv_ru': 'cv_RU.UTF-8', - 'cy': 'cy_GB.ISO8859-1', - 'cy_gb': 'cy_GB.ISO8859-1', - 'cy_gb.iso88591': 'cy_GB.ISO8859-1', - 'cy_gb.iso885914': 'cy_GB.ISO8859-14', - 'cy_gb.iso885915': 'cy_GB.ISO8859-15', - 'cy_gb@euro': 'cy_GB.ISO8859-15', - 'cz': 'cs_CZ.ISO8859-2', - 'cz_cz': 'cs_CZ.ISO8859-2', - 'czech': 'cs_CZ.ISO8859-2', - 'da': 'da_DK.ISO8859-1', - 'da.iso885915': 'da_DK.ISO8859-15', - 'da_dk': 'da_DK.ISO8859-1', - 'da_dk.88591': 'da_DK.ISO8859-1', - 'da_dk.885915': 'da_DK.ISO8859-15', - 'da_dk.iso88591': 'da_DK.ISO8859-1', - 'da_dk.iso885915': 'da_DK.ISO8859-15', - 'da_dk@euro': 'da_DK.ISO8859-15', - 'danish': 'da_DK.ISO8859-1', - 'danish.iso88591': 'da_DK.ISO8859-1', - 'dansk': 'da_DK.ISO8859-1', - 'de': 'de_DE.ISO8859-1', - 'de.iso885915': 'de_DE.ISO8859-15', - 'de_at': 'de_AT.ISO8859-1', - 'de_at.iso88591': 'de_AT.ISO8859-1', - 'de_at.iso885915': 'de_AT.ISO8859-15', - 'de_at.iso885915@euro': 'de_AT.ISO8859-15', - 'de_at.utf8@euro': 'de_AT.UTF-8', - 'de_at@euro': 'de_AT.ISO8859-15', - 'de_be': 'de_BE.ISO8859-1', - 'de_be.iso88591': 'de_BE.ISO8859-1', - 'de_be.iso885915': 'de_BE.ISO8859-15', - 'de_be.iso885915@euro': 'de_BE.ISO8859-15', - 'de_be.utf8@euro': 'de_BE.UTF-8', - 'de_be@euro': 'de_BE.ISO8859-15', - 'de_ch': 'de_CH.ISO8859-1', - 'de_ch.iso88591': 'de_CH.ISO8859-1', - 'de_ch.iso885915': 'de_CH.ISO8859-15', - 'de_ch@euro': 'de_CH.ISO8859-15', - 'de_de': 'de_DE.ISO8859-1', - 'de_de.88591': 'de_DE.ISO8859-1', - 'de_de.885915': 'de_DE.ISO8859-15', - 'de_de.885915@euro': 'de_DE.ISO8859-15', - 'de_de.iso88591': 'de_DE.ISO8859-1', - 'de_de.iso885915': 'de_DE.ISO8859-15', - 'de_de.iso885915@euro': 'de_DE.ISO8859-15', - 'de_de.utf8@euro': 'de_DE.UTF-8', - 'de_de@euro': 'de_DE.ISO8859-15', - 'de_li.utf8': 'de_LI.UTF-8', - 'de_lu': 'de_LU.ISO8859-1', - 'de_lu.iso88591': 'de_LU.ISO8859-1', - 'de_lu.iso885915': 'de_LU.ISO8859-15', - 'de_lu.iso885915@euro': 'de_LU.ISO8859-15', - 'de_lu.utf8@euro': 'de_LU.UTF-8', - 'de_lu@euro': 'de_LU.ISO8859-15', - 'deutsch': 'de_DE.ISO8859-1', - 'doi_in': 'doi_IN.UTF-8', - 'dutch': 'nl_NL.ISO8859-1', - 'dutch.iso88591': 'nl_BE.ISO8859-1', - 'dv_mv': 'dv_MV.UTF-8', - 'dz_bt': 'dz_BT.UTF-8', - 'ee': 'ee_EE.ISO8859-4', - 'ee_ee': 'ee_EE.ISO8859-4', - 'ee_ee.iso88594': 'ee_EE.ISO8859-4', - 'eesti': 'et_EE.ISO8859-1', - 'el': 'el_GR.ISO8859-7', - 'el_cy': 'el_CY.ISO8859-7', - 'el_gr': 'el_GR.ISO8859-7', - 'el_gr.iso88597': 'el_GR.ISO8859-7', - 'el_gr@euro': 'el_GR.ISO8859-15', - 'en': 'en_US.ISO8859-1', - 'en.iso88591': 'en_US.ISO8859-1', - 'en_ag': 'en_AG.UTF-8', - 'en_au': 'en_AU.ISO8859-1', - 'en_au.iso88591': 'en_AU.ISO8859-1', - 'en_be': 'en_BE.ISO8859-1', - 'en_be@euro': 'en_BE.ISO8859-15', - 'en_bw': 'en_BW.ISO8859-1', - 'en_bw.iso88591': 'en_BW.ISO8859-1', - 'en_ca': 'en_CA.ISO8859-1', - 'en_ca.iso88591': 'en_CA.ISO8859-1', - 'en_dk': 'en_DK.ISO8859-1', - 'en_dl.utf8': 'en_DL.UTF-8', - 'en_gb': 'en_GB.ISO8859-1', - 'en_gb.88591': 'en_GB.ISO8859-1', - 'en_gb.iso88591': 'en_GB.ISO8859-1', - 'en_gb.iso885915': 'en_GB.ISO8859-15', - 'en_gb@euro': 'en_GB.ISO8859-15', - 'en_hk': 'en_HK.ISO8859-1', - 'en_hk.iso88591': 'en_HK.ISO8859-1', - 'en_ie': 'en_IE.ISO8859-1', - 'en_ie.iso88591': 'en_IE.ISO8859-1', - 'en_ie.iso885915': 'en_IE.ISO8859-15', - 'en_ie.iso885915@euro': 'en_IE.ISO8859-15', - 'en_ie.utf8@euro': 'en_IE.UTF-8', - 'en_ie@euro': 'en_IE.ISO8859-15', - 'en_in': 'en_IN.ISO8859-1', - 'en_ng': 'en_NG.UTF-8', - 'en_nz': 'en_NZ.ISO8859-1', - 'en_nz.iso88591': 'en_NZ.ISO8859-1', - 'en_ph': 'en_PH.ISO8859-1', - 'en_ph.iso88591': 'en_PH.ISO8859-1', - 'en_sg': 'en_SG.ISO8859-1', - 'en_sg.iso88591': 'en_SG.ISO8859-1', - 'en_uk': 'en_GB.ISO8859-1', - 'en_us': 'en_US.ISO8859-1', - 'en_us.88591': 'en_US.ISO8859-1', - 'en_us.885915': 'en_US.ISO8859-15', - 'en_us.iso88591': 'en_US.ISO8859-1', - 'en_us.iso885915': 'en_US.ISO8859-15', - 'en_us.iso885915@euro': 'en_US.ISO8859-15', - 'en_us@euro': 'en_US.ISO8859-15', - 'en_us@euro@euro': 'en_US.ISO8859-15', - 'en_za': 'en_ZA.ISO8859-1', - 'en_za.88591': 'en_ZA.ISO8859-1', - 'en_za.iso88591': 'en_ZA.ISO8859-1', - 'en_za.iso885915': 'en_ZA.ISO8859-15', - 'en_za@euro': 'en_ZA.ISO8859-15', - 'en_zm': 'en_ZM.UTF-8', - 'en_zw': 'en_ZW.ISO8859-1', - 'en_zw.iso88591': 'en_ZW.ISO8859-1', - 'en_zw.utf8': 'en_ZS.UTF-8', - 'eng_gb': 'en_GB.ISO8859-1', - 'eng_gb.8859': 'en_GB.ISO8859-1', - 'english': 'en_EN.ISO8859-1', - 'english.iso88591': 'en_EN.ISO8859-1', - 'english_uk': 'en_GB.ISO8859-1', - 'english_uk.8859': 'en_GB.ISO8859-1', - 'english_united-states': 'en_US.ISO8859-1', - 'english_united-states.437': 'C', - 'english_us': 'en_US.ISO8859-1', - 'english_us.8859': 'en_US.ISO8859-1', - 'english_us.ascii': 'en_US.ISO8859-1', - 'eo': 'eo_XX.ISO8859-3', - 'eo.utf8': 'eo.UTF-8', - 'eo_eo': 'eo_EO.ISO8859-3', - 'eo_eo.iso88593': 'eo_EO.ISO8859-3', - 'eo_us.utf8': 'eo_US.UTF-8', - 'eo_xx': 'eo_XX.ISO8859-3', - 'eo_xx.iso88593': 'eo_XX.ISO8859-3', - 'es': 'es_ES.ISO8859-1', - 'es_ar': 'es_AR.ISO8859-1', - 'es_ar.iso88591': 'es_AR.ISO8859-1', - 'es_bo': 'es_BO.ISO8859-1', - 'es_bo.iso88591': 'es_BO.ISO8859-1', - 'es_cl': 'es_CL.ISO8859-1', - 'es_cl.iso88591': 'es_CL.ISO8859-1', - 'es_co': 'es_CO.ISO8859-1', - 'es_co.iso88591': 'es_CO.ISO8859-1', - 'es_cr': 'es_CR.ISO8859-1', - 'es_cr.iso88591': 'es_CR.ISO8859-1', - 'es_cu': 'es_CU.UTF-8', - 'es_do': 'es_DO.ISO8859-1', - 'es_do.iso88591': 'es_DO.ISO8859-1', - 'es_ec': 'es_EC.ISO8859-1', - 'es_ec.iso88591': 'es_EC.ISO8859-1', - 'es_es': 'es_ES.ISO8859-1', - 'es_es.88591': 'es_ES.ISO8859-1', - 'es_es.iso88591': 'es_ES.ISO8859-1', - 'es_es.iso885915': 'es_ES.ISO8859-15', - 'es_es.iso885915@euro': 'es_ES.ISO8859-15', - 'es_es.utf8@euro': 'es_ES.UTF-8', - 'es_es@euro': 'es_ES.ISO8859-15', - 'es_gt': 'es_GT.ISO8859-1', - 'es_gt.iso88591': 'es_GT.ISO8859-1', - 'es_hn': 'es_HN.ISO8859-1', - 'es_hn.iso88591': 'es_HN.ISO8859-1', - 'es_mx': 'es_MX.ISO8859-1', - 'es_mx.iso88591': 'es_MX.ISO8859-1', - 'es_ni': 'es_NI.ISO8859-1', - 'es_ni.iso88591': 'es_NI.ISO8859-1', - 'es_pa': 'es_PA.ISO8859-1', - 'es_pa.iso88591': 'es_PA.ISO8859-1', - 'es_pa.iso885915': 'es_PA.ISO8859-15', - 'es_pa@euro': 'es_PA.ISO8859-15', - 'es_pe': 'es_PE.ISO8859-1', - 'es_pe.iso88591': 'es_PE.ISO8859-1', - 'es_pe.iso885915': 'es_PE.ISO8859-15', - 'es_pe@euro': 'es_PE.ISO8859-15', - 'es_pr': 'es_PR.ISO8859-1', - 'es_pr.iso88591': 'es_PR.ISO8859-1', - 'es_py': 'es_PY.ISO8859-1', - 'es_py.iso88591': 'es_PY.ISO8859-1', - 'es_py.iso885915': 'es_PY.ISO8859-15', - 'es_py@euro': 'es_PY.ISO8859-15', - 'es_sv': 'es_SV.ISO8859-1', - 'es_sv.iso88591': 'es_SV.ISO8859-1', - 'es_sv.iso885915': 'es_SV.ISO8859-15', - 'es_sv@euro': 'es_SV.ISO8859-15', - 'es_us': 'es_US.ISO8859-1', - 'es_us.iso88591': 'es_US.ISO8859-1', - 'es_uy': 'es_UY.ISO8859-1', - 'es_uy.iso88591': 'es_UY.ISO8859-1', - 'es_uy.iso885915': 'es_UY.ISO8859-15', - 'es_uy@euro': 'es_UY.ISO8859-15', - 'es_ve': 'es_VE.ISO8859-1', - 'es_ve.iso88591': 'es_VE.ISO8859-1', - 'es_ve.iso885915': 'es_VE.ISO8859-15', - 'es_ve@euro': 'es_VE.ISO8859-15', - 'estonian': 'et_EE.ISO8859-1', - 'et': 'et_EE.ISO8859-15', - 'et_ee': 'et_EE.ISO8859-15', - 'et_ee.iso88591': 'et_EE.ISO8859-1', - 'et_ee.iso885913': 'et_EE.ISO8859-13', - 'et_ee.iso885915': 'et_EE.ISO8859-15', - 'et_ee.iso88594': 'et_EE.ISO8859-4', - 'et_ee@euro': 'et_EE.ISO8859-15', - 'eu': 'eu_ES.ISO8859-1', - 'eu_es': 'eu_ES.ISO8859-1', - 'eu_es.iso88591': 'eu_ES.ISO8859-1', - 'eu_es.iso885915': 'eu_ES.ISO8859-15', - 'eu_es.iso885915@euro': 'eu_ES.ISO8859-15', - 'eu_es.utf8@euro': 'eu_ES.UTF-8', - 'eu_es@euro': 'eu_ES.ISO8859-15', - 'eu_fr': 'eu_FR.ISO8859-1', - 'fa': 'fa_IR.UTF-8', - 'fa_ir': 'fa_IR.UTF-8', - 'fa_ir.isiri3342': 'fa_IR.ISIRI-3342', - 'ff_sn': 'ff_SN.UTF-8', - 'fi': 'fi_FI.ISO8859-15', - 'fi.iso885915': 'fi_FI.ISO8859-15', - 'fi_fi': 'fi_FI.ISO8859-15', - 'fi_fi.88591': 'fi_FI.ISO8859-1', - 'fi_fi.iso88591': 'fi_FI.ISO8859-1', - 'fi_fi.iso885915': 'fi_FI.ISO8859-15', - 'fi_fi.iso885915@euro': 'fi_FI.ISO8859-15', - 'fi_fi.utf8@euro': 'fi_FI.UTF-8', - 'fi_fi@euro': 'fi_FI.ISO8859-15', - 'fil_ph': 'fil_PH.UTF-8', - 'finnish': 'fi_FI.ISO8859-1', - 'finnish.iso88591': 'fi_FI.ISO8859-1', - 'fo': 'fo_FO.ISO8859-1', - 'fo_fo': 'fo_FO.ISO8859-1', - 'fo_fo.iso88591': 'fo_FO.ISO8859-1', - 'fo_fo.iso885915': 'fo_FO.ISO8859-15', - 'fo_fo@euro': 'fo_FO.ISO8859-15', - 'fr': 'fr_FR.ISO8859-1', - 'fr.iso885915': 'fr_FR.ISO8859-15', - 'fr_be': 'fr_BE.ISO8859-1', - 'fr_be.88591': 'fr_BE.ISO8859-1', - 'fr_be.iso88591': 'fr_BE.ISO8859-1', - 'fr_be.iso885915': 'fr_BE.ISO8859-15', - 'fr_be.iso885915@euro': 'fr_BE.ISO8859-15', - 'fr_be.utf8@euro': 'fr_BE.UTF-8', - 'fr_be@euro': 'fr_BE.ISO8859-15', - 'fr_ca': 'fr_CA.ISO8859-1', - 'fr_ca.88591': 'fr_CA.ISO8859-1', - 'fr_ca.iso88591': 'fr_CA.ISO8859-1', - 'fr_ca.iso885915': 'fr_CA.ISO8859-15', - 'fr_ca@euro': 'fr_CA.ISO8859-15', - 'fr_ch': 'fr_CH.ISO8859-1', - 'fr_ch.88591': 'fr_CH.ISO8859-1', - 'fr_ch.iso88591': 'fr_CH.ISO8859-1', - 'fr_ch.iso885915': 'fr_CH.ISO8859-15', - 'fr_ch@euro': 'fr_CH.ISO8859-15', - 'fr_fr': 'fr_FR.ISO8859-1', - 'fr_fr.88591': 'fr_FR.ISO8859-1', - 'fr_fr.iso88591': 'fr_FR.ISO8859-1', - 'fr_fr.iso885915': 'fr_FR.ISO8859-15', - 'fr_fr.iso885915@euro': 'fr_FR.ISO8859-15', - 'fr_fr.utf8@euro': 'fr_FR.UTF-8', - 'fr_fr@euro': 'fr_FR.ISO8859-15', - 'fr_lu': 'fr_LU.ISO8859-1', - 'fr_lu.88591': 'fr_LU.ISO8859-1', - 'fr_lu.iso88591': 'fr_LU.ISO8859-1', - 'fr_lu.iso885915': 'fr_LU.ISO8859-15', - 'fr_lu.iso885915@euro': 'fr_LU.ISO8859-15', - 'fr_lu.utf8@euro': 'fr_LU.UTF-8', - 'fr_lu@euro': 'fr_LU.ISO8859-15', - 'fran\xe7ais': 'fr_FR.ISO8859-1', - 'fre_fr': 'fr_FR.ISO8859-1', - 'fre_fr.8859': 'fr_FR.ISO8859-1', - 'french': 'fr_FR.ISO8859-1', - 'french.iso88591': 'fr_CH.ISO8859-1', - 'french_france': 'fr_FR.ISO8859-1', - 'french_france.8859': 'fr_FR.ISO8859-1', - 'fur_it': 'fur_IT.UTF-8', - 'fy_de': 'fy_DE.UTF-8', - 'fy_nl': 'fy_NL.UTF-8', - 'ga': 'ga_IE.ISO8859-1', - 'ga_ie': 'ga_IE.ISO8859-1', - 'ga_ie.iso88591': 'ga_IE.ISO8859-1', - 'ga_ie.iso885914': 'ga_IE.ISO8859-14', - 'ga_ie.iso885915': 'ga_IE.ISO8859-15', - 'ga_ie.iso885915@euro': 'ga_IE.ISO8859-15', - 'ga_ie.utf8@euro': 'ga_IE.UTF-8', - 'ga_ie@euro': 'ga_IE.ISO8859-15', - 'galego': 'gl_ES.ISO8859-1', - 'galician': 'gl_ES.ISO8859-1', - 'gd': 'gd_GB.ISO8859-1', - 'gd_gb': 'gd_GB.ISO8859-1', - 'gd_gb.iso88591': 'gd_GB.ISO8859-1', - 'gd_gb.iso885914': 'gd_GB.ISO8859-14', - 'gd_gb.iso885915': 'gd_GB.ISO8859-15', - 'gd_gb@euro': 'gd_GB.ISO8859-15', - 'ger_de': 'de_DE.ISO8859-1', - 'ger_de.8859': 'de_DE.ISO8859-1', - 'german': 'de_DE.ISO8859-1', - 'german.iso88591': 'de_CH.ISO8859-1', - 'german_germany': 'de_DE.ISO8859-1', - 'german_germany.8859': 'de_DE.ISO8859-1', - 'gez_er': 'gez_ER.UTF-8', - 'gez_et': 'gez_ET.UTF-8', - 'gl': 'gl_ES.ISO8859-1', - 'gl_es': 'gl_ES.ISO8859-1', - 'gl_es.iso88591': 'gl_ES.ISO8859-1', - 'gl_es.iso885915': 'gl_ES.ISO8859-15', - 'gl_es.iso885915@euro': 'gl_ES.ISO8859-15', - 'gl_es.utf8@euro': 'gl_ES.UTF-8', - 'gl_es@euro': 'gl_ES.ISO8859-15', - 'greek': 'el_GR.ISO8859-7', - 'greek.iso88597': 'el_GR.ISO8859-7', - 'gu_in': 'gu_IN.UTF-8', - 'gv': 'gv_GB.ISO8859-1', - 'gv_gb': 'gv_GB.ISO8859-1', - 'gv_gb.iso88591': 'gv_GB.ISO8859-1', - 'gv_gb.iso885914': 'gv_GB.ISO8859-14', - 'gv_gb.iso885915': 'gv_GB.ISO8859-15', - 'gv_gb@euro': 'gv_GB.ISO8859-15', - 'ha_ng': 'ha_NG.UTF-8', - 'he': 'he_IL.ISO8859-8', - 'he_il': 'he_IL.ISO8859-8', - 'he_il.cp1255': 'he_IL.CP1255', - 'he_il.iso88598': 'he_IL.ISO8859-8', - 'he_il.microsoftcp1255': 'he_IL.CP1255', - 'hebrew': 'he_IL.ISO8859-8', - 'hebrew.iso88598': 'he_IL.ISO8859-8', - 'hi': 'hi_IN.ISCII-DEV', - 'hi_in': 'hi_IN.ISCII-DEV', - 'hi_in.isciidev': 'hi_IN.ISCII-DEV', - 'hne': 'hne_IN.UTF-8', - 'hne_in': 'hne_IN.UTF-8', - 'hr': 'hr_HR.ISO8859-2', - 'hr_hr': 'hr_HR.ISO8859-2', - 'hr_hr.iso88592': 'hr_HR.ISO8859-2', - 'hrvatski': 'hr_HR.ISO8859-2', - 'hsb_de': 'hsb_DE.ISO8859-2', - 'ht_ht': 'ht_HT.UTF-8', - 'hu': 'hu_HU.ISO8859-2', - 'hu_hu': 'hu_HU.ISO8859-2', - 'hu_hu.iso88592': 'hu_HU.ISO8859-2', - 'hungarian': 'hu_HU.ISO8859-2', - 'hy_am': 'hy_AM.UTF-8', - 'hy_am.armscii8': 'hy_AM.ARMSCII_8', - 'ia': 'ia.UTF-8', - 'ia_fr': 'ia_FR.UTF-8', - 'icelandic': 'is_IS.ISO8859-1', - 'icelandic.iso88591': 'is_IS.ISO8859-1', - 'id': 'id_ID.ISO8859-1', - 'id_id': 'id_ID.ISO8859-1', - 'ig_ng': 'ig_NG.UTF-8', - 'ik_ca': 'ik_CA.UTF-8', - 'in': 'id_ID.ISO8859-1', - 'in_id': 'id_ID.ISO8859-1', - 'is': 'is_IS.ISO8859-1', - 'is_is': 'is_IS.ISO8859-1', - 'is_is.iso88591': 'is_IS.ISO8859-1', - 'is_is.iso885915': 'is_IS.ISO8859-15', - 'is_is@euro': 'is_IS.ISO8859-15', - 'iso-8859-1': 'en_US.ISO8859-1', - 'iso-8859-15': 'en_US.ISO8859-15', - 'iso8859-1': 'en_US.ISO8859-1', - 'iso8859-15': 'en_US.ISO8859-15', - 'iso_8859_1': 'en_US.ISO8859-1', - 'iso_8859_15': 'en_US.ISO8859-15', - 'it': 'it_IT.ISO8859-1', - 'it.iso885915': 'it_IT.ISO8859-15', - 'it_ch': 'it_CH.ISO8859-1', - 'it_ch.iso88591': 'it_CH.ISO8859-1', - 'it_ch.iso885915': 'it_CH.ISO8859-15', - 'it_ch@euro': 'it_CH.ISO8859-15', - 'it_it': 'it_IT.ISO8859-1', - 'it_it.88591': 'it_IT.ISO8859-1', - 'it_it.iso88591': 'it_IT.ISO8859-1', - 'it_it.iso885915': 'it_IT.ISO8859-15', - 'it_it.iso885915@euro': 'it_IT.ISO8859-15', - 'it_it.utf8@euro': 'it_IT.UTF-8', - 'it_it@euro': 'it_IT.ISO8859-15', - 'italian': 'it_IT.ISO8859-1', - 'italian.iso88591': 'it_IT.ISO8859-1', - 'iu': 'iu_CA.NUNACOM-8', - 'iu_ca': 'iu_CA.NUNACOM-8', - 'iu_ca.nunacom8': 'iu_CA.NUNACOM-8', - 'iw': 'he_IL.ISO8859-8', - 'iw_il': 'he_IL.ISO8859-8', - 'iw_il.iso88598': 'he_IL.ISO8859-8', - 'iw_il.utf8': 'iw_IL.UTF-8', - 'ja': 'ja_JP.eucJP', - 'ja.jis': 'ja_JP.JIS7', - 'ja.sjis': 'ja_JP.SJIS', - 'ja_jp': 'ja_JP.eucJP', - 'ja_jp.ajec': 'ja_JP.eucJP', - 'ja_jp.euc': 'ja_JP.eucJP', - 'ja_jp.eucjp': 'ja_JP.eucJP', - 'ja_jp.iso-2022-jp': 'ja_JP.JIS7', - 'ja_jp.iso2022jp': 'ja_JP.JIS7', - 'ja_jp.jis': 'ja_JP.JIS7', - 'ja_jp.jis7': 'ja_JP.JIS7', - 'ja_jp.mscode': 'ja_JP.SJIS', - 'ja_jp.pck': 'ja_JP.SJIS', - 'ja_jp.sjis': 'ja_JP.SJIS', - 'ja_jp.ujis': 'ja_JP.eucJP', - 'japan': 'ja_JP.eucJP', - 'japanese': 'ja_JP.eucJP', - 'japanese-euc': 'ja_JP.eucJP', - 'japanese.euc': 'ja_JP.eucJP', - 'japanese.sjis': 'ja_JP.SJIS', - 'jp_jp': 'ja_JP.eucJP', - 'ka': 'ka_GE.GEORGIAN-ACADEMY', - 'ka_ge': 'ka_GE.GEORGIAN-ACADEMY', - 'ka_ge.georgianacademy': 'ka_GE.GEORGIAN-ACADEMY', - 'ka_ge.georgianps': 'ka_GE.GEORGIAN-PS', - 'ka_ge.georgianrs': 'ka_GE.GEORGIAN-ACADEMY', - 'kk_kz': 'kk_KZ.RK1048', - 'kl': 'kl_GL.ISO8859-1', - 'kl_gl': 'kl_GL.ISO8859-1', - 'kl_gl.iso88591': 'kl_GL.ISO8859-1', - 'kl_gl.iso885915': 'kl_GL.ISO8859-15', - 'kl_gl@euro': 'kl_GL.ISO8859-15', - 'km_kh': 'km_KH.UTF-8', - 'kn': 'kn_IN.UTF-8', - 'kn_in': 'kn_IN.UTF-8', - 'ko': 'ko_KR.eucKR', - 'ko_kr': 'ko_KR.eucKR', - 'ko_kr.euc': 'ko_KR.eucKR', - 'ko_kr.euckr': 'ko_KR.eucKR', - 'kok_in': 'kok_IN.UTF-8', - 'korean': 'ko_KR.eucKR', - 'korean.euc': 'ko_KR.eucKR', - 'ks': 'ks_IN.UTF-8', - 'ks_in': 'ks_IN.UTF-8', - 'ks_in@devanagari': 'ks_IN.UTF-8@devanagari', - 'ks_in@devanagari.utf8': 'ks_IN.UTF-8@devanagari', - 'ku_tr': 'ku_TR.ISO8859-9', - 'kw': 'kw_GB.ISO8859-1', - 'kw_gb': 'kw_GB.ISO8859-1', - 'kw_gb.iso88591': 'kw_GB.ISO8859-1', - 'kw_gb.iso885914': 'kw_GB.ISO8859-14', - 'kw_gb.iso885915': 'kw_GB.ISO8859-15', - 'kw_gb@euro': 'kw_GB.ISO8859-15', - 'ky': 'ky_KG.UTF-8', - 'ky_kg': 'ky_KG.UTF-8', - 'lb_lu': 'lb_LU.UTF-8', - 'lg_ug': 'lg_UG.ISO8859-10', - 'li_be': 'li_BE.UTF-8', - 'li_nl': 'li_NL.UTF-8', - 'lij_it': 'lij_IT.UTF-8', - 'lithuanian': 'lt_LT.ISO8859-13', - 'lo': 'lo_LA.MULELAO-1', - 'lo_la': 'lo_LA.MULELAO-1', - 'lo_la.cp1133': 'lo_LA.IBM-CP1133', - 'lo_la.ibmcp1133': 'lo_LA.IBM-CP1133', - 'lo_la.mulelao1': 'lo_LA.MULELAO-1', - 'lt': 'lt_LT.ISO8859-13', - 'lt_lt': 'lt_LT.ISO8859-13', - 'lt_lt.iso885913': 'lt_LT.ISO8859-13', - 'lt_lt.iso88594': 'lt_LT.ISO8859-4', - 'lv': 'lv_LV.ISO8859-13', - 'lv_lv': 'lv_LV.ISO8859-13', - 'lv_lv.iso885913': 'lv_LV.ISO8859-13', - 'lv_lv.iso88594': 'lv_LV.ISO8859-4', - 'mag_in': 'mag_IN.UTF-8', - 'mai': 'mai_IN.UTF-8', - 'mai_in': 'mai_IN.UTF-8', - 'mg_mg': 'mg_MG.ISO8859-15', - 'mhr_ru': 'mhr_RU.UTF-8', - 'mi': 'mi_NZ.ISO8859-1', - 'mi_nz': 'mi_NZ.ISO8859-1', - 'mi_nz.iso88591': 'mi_NZ.ISO8859-1', - 'mk': 'mk_MK.ISO8859-5', - 'mk_mk': 'mk_MK.ISO8859-5', - 'mk_mk.cp1251': 'mk_MK.CP1251', - 'mk_mk.iso88595': 'mk_MK.ISO8859-5', - 'mk_mk.microsoftcp1251': 'mk_MK.CP1251', - 'ml': 'ml_IN.UTF-8', - 'ml_in': 'ml_IN.UTF-8', - 'mn_mn': 'mn_MN.UTF-8', - 'mni_in': 'mni_IN.UTF-8', - 'mr': 'mr_IN.UTF-8', - 'mr_in': 'mr_IN.UTF-8', - 'ms': 'ms_MY.ISO8859-1', - 'ms_my': 'ms_MY.ISO8859-1', - 'ms_my.iso88591': 'ms_MY.ISO8859-1', - 'mt': 'mt_MT.ISO8859-3', - 'mt_mt': 'mt_MT.ISO8859-3', - 'mt_mt.iso88593': 'mt_MT.ISO8859-3', - 'my_mm': 'my_MM.UTF-8', - 'nan_tw@latin': 'nan_TW.UTF-8@latin', - 'nb': 'nb_NO.ISO8859-1', - 'nb_no': 'nb_NO.ISO8859-1', - 'nb_no.88591': 'nb_NO.ISO8859-1', - 'nb_no.iso88591': 'nb_NO.ISO8859-1', - 'nb_no.iso885915': 'nb_NO.ISO8859-15', - 'nb_no@euro': 'nb_NO.ISO8859-15', - 'nds_de': 'nds_DE.UTF-8', - 'nds_nl': 'nds_NL.UTF-8', - 'ne_np': 'ne_NP.UTF-8', - 'nhn_mx': 'nhn_MX.UTF-8', - 'niu_nu': 'niu_NU.UTF-8', - 'niu_nz': 'niu_NZ.UTF-8', - 'nl': 'nl_NL.ISO8859-1', - 'nl.iso885915': 'nl_NL.ISO8859-15', - 'nl_aw': 'nl_AW.UTF-8', - 'nl_be': 'nl_BE.ISO8859-1', - 'nl_be.88591': 'nl_BE.ISO8859-1', - 'nl_be.iso88591': 'nl_BE.ISO8859-1', - 'nl_be.iso885915': 'nl_BE.ISO8859-15', - 'nl_be.iso885915@euro': 'nl_BE.ISO8859-15', - 'nl_be.utf8@euro': 'nl_BE.UTF-8', - 'nl_be@euro': 'nl_BE.ISO8859-15', - 'nl_nl': 'nl_NL.ISO8859-1', - 'nl_nl.88591': 'nl_NL.ISO8859-1', - 'nl_nl.iso88591': 'nl_NL.ISO8859-1', - 'nl_nl.iso885915': 'nl_NL.ISO8859-15', - 'nl_nl.iso885915@euro': 'nl_NL.ISO8859-15', - 'nl_nl.utf8@euro': 'nl_NL.UTF-8', - 'nl_nl@euro': 'nl_NL.ISO8859-15', - 'nn': 'nn_NO.ISO8859-1', - 'nn_no': 'nn_NO.ISO8859-1', - 'nn_no.88591': 'nn_NO.ISO8859-1', - 'nn_no.iso88591': 'nn_NO.ISO8859-1', - 'nn_no.iso885915': 'nn_NO.ISO8859-15', - 'nn_no@euro': 'nn_NO.ISO8859-15', - 'no': 'no_NO.ISO8859-1', - 'no@nynorsk': 'ny_NO.ISO8859-1', - 'no_no': 'no_NO.ISO8859-1', - 'no_no.88591': 'no_NO.ISO8859-1', - 'no_no.iso88591': 'no_NO.ISO8859-1', - 'no_no.iso885915': 'no_NO.ISO8859-15', - 'no_no.iso88591@bokmal': 'no_NO.ISO8859-1', - 'no_no.iso88591@nynorsk': 'no_NO.ISO8859-1', - 'no_no@euro': 'no_NO.ISO8859-15', - 'norwegian': 'no_NO.ISO8859-1', - 'norwegian.iso88591': 'no_NO.ISO8859-1', - 'nr': 'nr_ZA.ISO8859-1', - 'nr_za': 'nr_ZA.ISO8859-1', - 'nr_za.iso88591': 'nr_ZA.ISO8859-1', - 'nso': 'nso_ZA.ISO8859-15', - 'nso_za': 'nso_ZA.ISO8859-15', - 'nso_za.iso885915': 'nso_ZA.ISO8859-15', - 'ny': 'ny_NO.ISO8859-1', - 'ny_no': 'ny_NO.ISO8859-1', - 'ny_no.88591': 'ny_NO.ISO8859-1', - 'ny_no.iso88591': 'ny_NO.ISO8859-1', - 'ny_no.iso885915': 'ny_NO.ISO8859-15', - 'ny_no@euro': 'ny_NO.ISO8859-15', - 'nynorsk': 'nn_NO.ISO8859-1', - 'oc': 'oc_FR.ISO8859-1', - 'oc_fr': 'oc_FR.ISO8859-1', - 'oc_fr.iso88591': 'oc_FR.ISO8859-1', - 'oc_fr.iso885915': 'oc_FR.ISO8859-15', - 'oc_fr@euro': 'oc_FR.ISO8859-15', - 'om_et': 'om_ET.UTF-8', - 'om_ke': 'om_KE.ISO8859-1', - 'or': 'or_IN.UTF-8', - 'or_in': 'or_IN.UTF-8', - 'os_ru': 'os_RU.UTF-8', - 'pa': 'pa_IN.UTF-8', - 'pa_in': 'pa_IN.UTF-8', - 'pa_pk': 'pa_PK.UTF-8', - 'pap_an': 'pap_AN.UTF-8', - 'pd': 'pd_US.ISO8859-1', - 'pd_de': 'pd_DE.ISO8859-1', - 'pd_de.iso88591': 'pd_DE.ISO8859-1', - 'pd_de.iso885915': 'pd_DE.ISO8859-15', - 'pd_de@euro': 'pd_DE.ISO8859-15', - 'pd_us': 'pd_US.ISO8859-1', - 'pd_us.iso88591': 'pd_US.ISO8859-1', - 'pd_us.iso885915': 'pd_US.ISO8859-15', - 'pd_us@euro': 'pd_US.ISO8859-15', - 'ph': 'ph_PH.ISO8859-1', - 'ph_ph': 'ph_PH.ISO8859-1', - 'ph_ph.iso88591': 'ph_PH.ISO8859-1', - 'pl': 'pl_PL.ISO8859-2', - 'pl_pl': 'pl_PL.ISO8859-2', - 'pl_pl.iso88592': 'pl_PL.ISO8859-2', - 'polish': 'pl_PL.ISO8859-2', - 'portuguese': 'pt_PT.ISO8859-1', - 'portuguese.iso88591': 'pt_PT.ISO8859-1', - 'portuguese_brazil': 'pt_BR.ISO8859-1', - 'portuguese_brazil.8859': 'pt_BR.ISO8859-1', - 'posix': 'C', - 'posix-utf2': 'C', - 'pp': 'pp_AN.ISO8859-1', - 'pp_an': 'pp_AN.ISO8859-1', - 'pp_an.iso88591': 'pp_AN.ISO8859-1', - 'ps_af': 'ps_AF.UTF-8', - 'pt': 'pt_PT.ISO8859-1', - 'pt.iso885915': 'pt_PT.ISO8859-15', - 'pt_br': 'pt_BR.ISO8859-1', - 'pt_br.88591': 'pt_BR.ISO8859-1', - 'pt_br.iso88591': 'pt_BR.ISO8859-1', - 'pt_br.iso885915': 'pt_BR.ISO8859-15', - 'pt_br@euro': 'pt_BR.ISO8859-15', - 'pt_pt': 'pt_PT.ISO8859-1', - 'pt_pt.88591': 'pt_PT.ISO8859-1', - 'pt_pt.iso88591': 'pt_PT.ISO8859-1', - 'pt_pt.iso885915': 'pt_PT.ISO8859-15', - 'pt_pt.iso885915@euro': 'pt_PT.ISO8859-15', - 'pt_pt.utf8@euro': 'pt_PT.UTF-8', - 'pt_pt@euro': 'pt_PT.ISO8859-15', - 'ro': 'ro_RO.ISO8859-2', - 'ro_ro': 'ro_RO.ISO8859-2', - 'ro_ro.iso88592': 'ro_RO.ISO8859-2', - 'romanian': 'ro_RO.ISO8859-2', - 'ru': 'ru_RU.UTF-8', - 'ru.koi8r': 'ru_RU.KOI8-R', - 'ru_ru': 'ru_RU.UTF-8', - 'ru_ru.cp1251': 'ru_RU.CP1251', - 'ru_ru.iso88595': 'ru_RU.ISO8859-5', - 'ru_ru.koi8r': 'ru_RU.KOI8-R', - 'ru_ru.microsoftcp1251': 'ru_RU.CP1251', - 'ru_ua': 'ru_UA.KOI8-U', - 'ru_ua.cp1251': 'ru_UA.CP1251', - 'ru_ua.koi8u': 'ru_UA.KOI8-U', - 'ru_ua.microsoftcp1251': 'ru_UA.CP1251', - 'rumanian': 'ro_RO.ISO8859-2', - 'russian': 'ru_RU.ISO8859-5', - 'rw': 'rw_RW.ISO8859-1', - 'rw_rw': 'rw_RW.ISO8859-1', - 'rw_rw.iso88591': 'rw_RW.ISO8859-1', - 'sa_in': 'sa_IN.UTF-8', - 'sat_in': 'sat_IN.UTF-8', - 'sc_it': 'sc_IT.UTF-8', - 'sd': 'sd_IN.UTF-8', - 'sd@devanagari': 'sd_IN.UTF-8@devanagari', - 'sd_in': 'sd_IN.UTF-8', - 'sd_in@devanagari': 'sd_IN.UTF-8@devanagari', - 'sd_in@devanagari.utf8': 'sd_IN.UTF-8@devanagari', - 'sd_pk': 'sd_PK.UTF-8', - 'se_no': 'se_NO.UTF-8', - 'serbocroatian': 'sr_RS.UTF-8@latin', - 'sh': 'sr_RS.UTF-8@latin', - 'sh_ba.iso88592@bosnia': 'sr_CS.ISO8859-2', - 'sh_hr': 'sh_HR.ISO8859-2', - 'sh_hr.iso88592': 'hr_HR.ISO8859-2', - 'sh_sp': 'sr_CS.ISO8859-2', - 'sh_yu': 'sr_RS.UTF-8@latin', - 'shs_ca': 'shs_CA.UTF-8', - 'si': 'si_LK.UTF-8', - 'si_lk': 'si_LK.UTF-8', - 'sid_et': 'sid_ET.UTF-8', - 'sinhala': 'si_LK.UTF-8', - 'sk': 'sk_SK.ISO8859-2', - 'sk_sk': 'sk_SK.ISO8859-2', - 'sk_sk.iso88592': 'sk_SK.ISO8859-2', - 'sl': 'sl_SI.ISO8859-2', - 'sl_cs': 'sl_CS.ISO8859-2', - 'sl_si': 'sl_SI.ISO8859-2', - 'sl_si.iso88592': 'sl_SI.ISO8859-2', - 'slovak': 'sk_SK.ISO8859-2', - 'slovene': 'sl_SI.ISO8859-2', - 'slovenian': 'sl_SI.ISO8859-2', - 'so_dj': 'so_DJ.ISO8859-1', - 'so_et': 'so_ET.UTF-8', - 'so_ke': 'so_KE.ISO8859-1', - 'so_so': 'so_SO.ISO8859-1', - 'sp': 'sr_CS.ISO8859-5', - 'sp_yu': 'sr_CS.ISO8859-5', - 'spanish': 'es_ES.ISO8859-1', - 'spanish.iso88591': 'es_ES.ISO8859-1', - 'spanish_spain': 'es_ES.ISO8859-1', - 'spanish_spain.8859': 'es_ES.ISO8859-1', - 'sq': 'sq_AL.ISO8859-2', - 'sq_al': 'sq_AL.ISO8859-2', - 'sq_al.iso88592': 'sq_AL.ISO8859-2', - 'sq_mk': 'sq_MK.UTF-8', - 'sr': 'sr_RS.UTF-8', - 'sr@cyrillic': 'sr_RS.UTF-8', - 'sr@latin': 'sr_RS.UTF-8@latin', - 'sr@latn': 'sr_CS.UTF-8@latin', - 'sr_cs': 'sr_CS.UTF-8', - 'sr_cs.iso88592': 'sr_CS.ISO8859-2', - 'sr_cs.iso88592@latn': 'sr_CS.ISO8859-2', - 'sr_cs.iso88595': 'sr_CS.ISO8859-5', - 'sr_cs.utf8@latn': 'sr_CS.UTF-8@latin', - 'sr_cs@latn': 'sr_CS.UTF-8@latin', - 'sr_me': 'sr_ME.UTF-8', - 'sr_rs': 'sr_RS.UTF-8', - 'sr_rs@latin': 'sr_RS.UTF-8@latin', - 'sr_rs@latn': 'sr_RS.UTF-8@latin', - 'sr_sp': 'sr_CS.ISO8859-2', - 'sr_yu': 'sr_RS.UTF-8@latin', - 'sr_yu.cp1251@cyrillic': 'sr_CS.CP1251', - 'sr_yu.iso88592': 'sr_CS.ISO8859-2', - 'sr_yu.iso88595': 'sr_CS.ISO8859-5', - 'sr_yu.iso88595@cyrillic': 'sr_CS.ISO8859-5', - 'sr_yu.microsoftcp1251@cyrillic': 'sr_CS.CP1251', - 'sr_yu.utf8': 'sr_RS.UTF-8', - 'sr_yu.utf8@cyrillic': 'sr_RS.UTF-8', - 'sr_yu@cyrillic': 'sr_RS.UTF-8', - 'ss': 'ss_ZA.ISO8859-1', - 'ss_za': 'ss_ZA.ISO8859-1', - 'ss_za.iso88591': 'ss_ZA.ISO8859-1', - 'st': 'st_ZA.ISO8859-1', - 'st_za': 'st_ZA.ISO8859-1', - 'st_za.iso88591': 'st_ZA.ISO8859-1', - 'sv': 'sv_SE.ISO8859-1', - 'sv.iso885915': 'sv_SE.ISO8859-15', - 'sv_fi': 'sv_FI.ISO8859-1', - 'sv_fi.iso88591': 'sv_FI.ISO8859-1', - 'sv_fi.iso885915': 'sv_FI.ISO8859-15', - 'sv_fi.iso885915@euro': 'sv_FI.ISO8859-15', - 'sv_fi.utf8@euro': 'sv_FI.UTF-8', - 'sv_fi@euro': 'sv_FI.ISO8859-15', - 'sv_se': 'sv_SE.ISO8859-1', - 'sv_se.88591': 'sv_SE.ISO8859-1', - 'sv_se.iso88591': 'sv_SE.ISO8859-1', - 'sv_se.iso885915': 'sv_SE.ISO8859-15', - 'sv_se@euro': 'sv_SE.ISO8859-15', - 'sw_ke': 'sw_KE.UTF-8', - 'sw_tz': 'sw_TZ.UTF-8', - 'swedish': 'sv_SE.ISO8859-1', - 'swedish.iso88591': 'sv_SE.ISO8859-1', - 'szl_pl': 'szl_PL.UTF-8', - 'ta': 'ta_IN.TSCII-0', - 'ta_in': 'ta_IN.TSCII-0', - 'ta_in.tscii': 'ta_IN.TSCII-0', - 'ta_in.tscii0': 'ta_IN.TSCII-0', - 'ta_lk': 'ta_LK.UTF-8', - 'te': 'te_IN.UTF-8', - 'te_in': 'te_IN.UTF-8', - 'tg': 'tg_TJ.KOI8-C', - 'tg_tj': 'tg_TJ.KOI8-C', - 'tg_tj.koi8c': 'tg_TJ.KOI8-C', - 'th': 'th_TH.ISO8859-11', - 'th_th': 'th_TH.ISO8859-11', - 'th_th.iso885911': 'th_TH.ISO8859-11', - 'th_th.tactis': 'th_TH.TIS620', - 'th_th.tis620': 'th_TH.TIS620', - 'thai': 'th_TH.ISO8859-11', - 'ti_er': 'ti_ER.UTF-8', - 'ti_et': 'ti_ET.UTF-8', - 'tig_er': 'tig_ER.UTF-8', - 'tk_tm': 'tk_TM.UTF-8', - 'tl': 'tl_PH.ISO8859-1', - 'tl_ph': 'tl_PH.ISO8859-1', - 'tl_ph.iso88591': 'tl_PH.ISO8859-1', - 'tn': 'tn_ZA.ISO8859-15', - 'tn_za': 'tn_ZA.ISO8859-15', - 'tn_za.iso885915': 'tn_ZA.ISO8859-15', - 'tr': 'tr_TR.ISO8859-9', - 'tr_cy': 'tr_CY.ISO8859-9', - 'tr_tr': 'tr_TR.ISO8859-9', - 'tr_tr.iso88599': 'tr_TR.ISO8859-9', - 'ts': 'ts_ZA.ISO8859-1', - 'ts_za': 'ts_ZA.ISO8859-1', - 'ts_za.iso88591': 'ts_ZA.ISO8859-1', - 'tt': 'tt_RU.TATAR-CYR', - 'tt_ru': 'tt_RU.TATAR-CYR', - 'tt_ru.koi8c': 'tt_RU.KOI8-C', - 'tt_ru.tatarcyr': 'tt_RU.TATAR-CYR', - 'tt_ru@iqtelif': 'tt_RU.UTF-8@iqtelif', - 'turkish': 'tr_TR.ISO8859-9', - 'turkish.iso88599': 'tr_TR.ISO8859-9', - 'ug_cn': 'ug_CN.UTF-8', - 'uk': 'uk_UA.KOI8-U', - 'uk_ua': 'uk_UA.KOI8-U', - 'uk_ua.cp1251': 'uk_UA.CP1251', - 'uk_ua.iso88595': 'uk_UA.ISO8859-5', - 'uk_ua.koi8u': 'uk_UA.KOI8-U', - 'uk_ua.microsoftcp1251': 'uk_UA.CP1251', - 'univ': 'en_US.utf', - 'universal': 'en_US.utf', - 'universal.utf8@ucs4': 'en_US.UTF-8', - 'unm_us': 'unm_US.UTF-8', - 'ur': 'ur_PK.CP1256', - 'ur_in': 'ur_IN.UTF-8', - 'ur_pk': 'ur_PK.CP1256', - 'ur_pk.cp1256': 'ur_PK.CP1256', - 'ur_pk.microsoftcp1256': 'ur_PK.CP1256', - 'uz': 'uz_UZ.UTF-8', - 'uz_uz': 'uz_UZ.UTF-8', - 'uz_uz.iso88591': 'uz_UZ.ISO8859-1', - 'uz_uz.utf8@cyrillic': 'uz_UZ.UTF-8', - 'uz_uz@cyrillic': 'uz_UZ.UTF-8', - 've': 've_ZA.UTF-8', - 've_za': 've_ZA.UTF-8', - 'vi': 'vi_VN.TCVN', - 'vi_vn': 'vi_VN.TCVN', - 'vi_vn.tcvn': 'vi_VN.TCVN', - 'vi_vn.tcvn5712': 'vi_VN.TCVN', - 'vi_vn.viscii': 'vi_VN.VISCII', - 'vi_vn.viscii111': 'vi_VN.VISCII', - 'wa': 'wa_BE.ISO8859-1', - 'wa_be': 'wa_BE.ISO8859-1', - 'wa_be.iso88591': 'wa_BE.ISO8859-1', - 'wa_be.iso885915': 'wa_BE.ISO8859-15', - 'wa_be.iso885915@euro': 'wa_BE.ISO8859-15', - 'wa_be@euro': 'wa_BE.ISO8859-15', - 'wae_ch': 'wae_CH.UTF-8', - 'wal_et': 'wal_ET.UTF-8', - 'wo_sn': 'wo_SN.UTF-8', - 'xh': 'xh_ZA.ISO8859-1', - 'xh_za': 'xh_ZA.ISO8859-1', - 'xh_za.iso88591': 'xh_ZA.ISO8859-1', - 'yi': 'yi_US.CP1255', - 'yi_us': 'yi_US.CP1255', - 'yi_us.cp1255': 'yi_US.CP1255', - 'yi_us.microsoftcp1255': 'yi_US.CP1255', - 'yo_ng': 'yo_NG.UTF-8', - 'yue_hk': 'yue_HK.UTF-8', - 'zh': 'zh_CN.eucCN', - 'zh_cn': 'zh_CN.gb2312', - 'zh_cn.big5': 'zh_TW.big5', - 'zh_cn.euc': 'zh_CN.eucCN', - 'zh_cn.gb18030': 'zh_CN.gb18030', - 'zh_cn.gb2312': 'zh_CN.gb2312', - 'zh_cn.gbk': 'zh_CN.gbk', - 'zh_hk': 'zh_HK.big5hkscs', - 'zh_hk.big5': 'zh_HK.big5', - 'zh_hk.big5hk': 'zh_HK.big5hkscs', - 'zh_hk.big5hkscs': 'zh_HK.big5hkscs', - 'zh_sg': 'zh_SG.GB2312', - 'zh_sg.gbk': 'zh_SG.GBK', - 'zh_tw': 'zh_TW.big5', - 'zh_tw.big5': 'zh_TW.big5', - 'zh_tw.euc': 'zh_TW.eucTW', - 'zh_tw.euctw': 'zh_TW.eucTW', - 'zu': 'zu_ZA.ISO8859-1', - 'zu_za': 'zu_ZA.ISO8859-1', - 'zu_za.iso88591': 'zu_ZA.ISO8859-1', -} - -# -# This maps Windows language identifiers to locale strings. -# -# This list has been updated from -# http://msdn.microsoft.com/library/default.asp?url=/library/en-us/intl/nls_238z.asp -# to include every locale up to Windows Vista. -# -# NOTE: this mapping is incomplete. If your language is missing, please -# submit a bug report to the Python bug tracker at http://bugs.python.org/ -# Make sure you include the missing language identifier and the suggested -# locale code. -# - -windows_locale = { - 0x0436: "af_ZA", # Afrikaans - 0x041c: "sq_AL", # Albanian - 0x0484: "gsw_FR",# Alsatian - France - 0x045e: "am_ET", # Amharic - Ethiopia - 0x0401: "ar_SA", # Arabic - Saudi Arabia - 0x0801: "ar_IQ", # Arabic - Iraq - 0x0c01: "ar_EG", # Arabic - Egypt - 0x1001: "ar_LY", # Arabic - Libya - 0x1401: "ar_DZ", # Arabic - Algeria - 0x1801: "ar_MA", # Arabic - Morocco - 0x1c01: "ar_TN", # Arabic - Tunisia - 0x2001: "ar_OM", # Arabic - Oman - 0x2401: "ar_YE", # Arabic - Yemen - 0x2801: "ar_SY", # Arabic - Syria - 0x2c01: "ar_JO", # Arabic - Jordan - 0x3001: "ar_LB", # Arabic - Lebanon - 0x3401: "ar_KW", # Arabic - Kuwait - 0x3801: "ar_AE", # Arabic - United Arab Emirates - 0x3c01: "ar_BH", # Arabic - Bahrain - 0x4001: "ar_QA", # Arabic - Qatar - 0x042b: "hy_AM", # Armenian - 0x044d: "as_IN", # Assamese - India - 0x042c: "az_AZ", # Azeri - Latin - 0x082c: "az_AZ", # Azeri - Cyrillic - 0x046d: "ba_RU", # Bashkir - 0x042d: "eu_ES", # Basque - Russia - 0x0423: "be_BY", # Belarusian - 0x0445: "bn_IN", # Begali - 0x201a: "bs_BA", # Bosnian - Cyrillic - 0x141a: "bs_BA", # Bosnian - Latin - 0x047e: "br_FR", # Breton - France - 0x0402: "bg_BG", # Bulgarian -# 0x0455: "my_MM", # Burmese - Not supported - 0x0403: "ca_ES", # Catalan - 0x0004: "zh_CHS",# Chinese - Simplified - 0x0404: "zh_TW", # Chinese - Taiwan - 0x0804: "zh_CN", # Chinese - PRC - 0x0c04: "zh_HK", # Chinese - Hong Kong S.A.R. - 0x1004: "zh_SG", # Chinese - Singapore - 0x1404: "zh_MO", # Chinese - Macao S.A.R. - 0x7c04: "zh_CHT",# Chinese - Traditional - 0x0483: "co_FR", # Corsican - France - 0x041a: "hr_HR", # Croatian - 0x101a: "hr_BA", # Croatian - Bosnia - 0x0405: "cs_CZ", # Czech - 0x0406: "da_DK", # Danish - 0x048c: "gbz_AF",# Dari - Afghanistan - 0x0465: "div_MV",# Divehi - Maldives - 0x0413: "nl_NL", # Dutch - The Netherlands - 0x0813: "nl_BE", # Dutch - Belgium - 0x0409: "en_US", # English - United States - 0x0809: "en_GB", # English - United Kingdom - 0x0c09: "en_AU", # English - Australia - 0x1009: "en_CA", # English - Canada - 0x1409: "en_NZ", # English - New Zealand - 0x1809: "en_IE", # English - Ireland - 0x1c09: "en_ZA", # English - South Africa - 0x2009: "en_JA", # English - Jamaica - 0x2409: "en_CB", # English - Carribbean - 0x2809: "en_BZ", # English - Belize - 0x2c09: "en_TT", # English - Trinidad - 0x3009: "en_ZW", # English - Zimbabwe - 0x3409: "en_PH", # English - Philippines - 0x4009: "en_IN", # English - India - 0x4409: "en_MY", # English - Malaysia - 0x4809: "en_IN", # English - Singapore - 0x0425: "et_EE", # Estonian - 0x0438: "fo_FO", # Faroese - 0x0464: "fil_PH",# Filipino - 0x040b: "fi_FI", # Finnish - 0x040c: "fr_FR", # French - France - 0x080c: "fr_BE", # French - Belgium - 0x0c0c: "fr_CA", # French - Canada - 0x100c: "fr_CH", # French - Switzerland - 0x140c: "fr_LU", # French - Luxembourg - 0x180c: "fr_MC", # French - Monaco - 0x0462: "fy_NL", # Frisian - Netherlands - 0x0456: "gl_ES", # Galician - 0x0437: "ka_GE", # Georgian - 0x0407: "de_DE", # German - Germany - 0x0807: "de_CH", # German - Switzerland - 0x0c07: "de_AT", # German - Austria - 0x1007: "de_LU", # German - Luxembourg - 0x1407: "de_LI", # German - Liechtenstein - 0x0408: "el_GR", # Greek - 0x046f: "kl_GL", # Greenlandic - Greenland - 0x0447: "gu_IN", # Gujarati - 0x0468: "ha_NG", # Hausa - Latin - 0x040d: "he_IL", # Hebrew - 0x0439: "hi_IN", # Hindi - 0x040e: "hu_HU", # Hungarian - 0x040f: "is_IS", # Icelandic - 0x0421: "id_ID", # Indonesian - 0x045d: "iu_CA", # Inuktitut - Syllabics - 0x085d: "iu_CA", # Inuktitut - Latin - 0x083c: "ga_IE", # Irish - Ireland - 0x0410: "it_IT", # Italian - Italy - 0x0810: "it_CH", # Italian - Switzerland - 0x0411: "ja_JP", # Japanese - 0x044b: "kn_IN", # Kannada - India - 0x043f: "kk_KZ", # Kazakh - 0x0453: "kh_KH", # Khmer - Cambodia - 0x0486: "qut_GT",# K'iche - Guatemala - 0x0487: "rw_RW", # Kinyarwanda - Rwanda - 0x0457: "kok_IN",# Konkani - 0x0412: "ko_KR", # Korean - 0x0440: "ky_KG", # Kyrgyz - 0x0454: "lo_LA", # Lao - Lao PDR - 0x0426: "lv_LV", # Latvian - 0x0427: "lt_LT", # Lithuanian - 0x082e: "dsb_DE",# Lower Sorbian - Germany - 0x046e: "lb_LU", # Luxembourgish - 0x042f: "mk_MK", # FYROM Macedonian - 0x043e: "ms_MY", # Malay - Malaysia - 0x083e: "ms_BN", # Malay - Brunei Darussalam - 0x044c: "ml_IN", # Malayalam - India - 0x043a: "mt_MT", # Maltese - 0x0481: "mi_NZ", # Maori - 0x047a: "arn_CL",# Mapudungun - 0x044e: "mr_IN", # Marathi - 0x047c: "moh_CA",# Mohawk - Canada - 0x0450: "mn_MN", # Mongolian - Cyrillic - 0x0850: "mn_CN", # Mongolian - PRC - 0x0461: "ne_NP", # Nepali - 0x0414: "nb_NO", # Norwegian - Bokmal - 0x0814: "nn_NO", # Norwegian - Nynorsk - 0x0482: "oc_FR", # Occitan - France - 0x0448: "or_IN", # Oriya - India - 0x0463: "ps_AF", # Pashto - Afghanistan - 0x0429: "fa_IR", # Persian - 0x0415: "pl_PL", # Polish - 0x0416: "pt_BR", # Portuguese - Brazil - 0x0816: "pt_PT", # Portuguese - Portugal - 0x0446: "pa_IN", # Punjabi - 0x046b: "quz_BO",# Quechua (Bolivia) - 0x086b: "quz_EC",# Quechua (Ecuador) - 0x0c6b: "quz_PE",# Quechua (Peru) - 0x0418: "ro_RO", # Romanian - Romania - 0x0417: "rm_CH", # Romansh - 0x0419: "ru_RU", # Russian - 0x243b: "smn_FI",# Sami Finland - 0x103b: "smj_NO",# Sami Norway - 0x143b: "smj_SE",# Sami Sweden - 0x043b: "se_NO", # Sami Northern Norway - 0x083b: "se_SE", # Sami Northern Sweden - 0x0c3b: "se_FI", # Sami Northern Finland - 0x203b: "sms_FI",# Sami Skolt - 0x183b: "sma_NO",# Sami Southern Norway - 0x1c3b: "sma_SE",# Sami Southern Sweden - 0x044f: "sa_IN", # Sanskrit - 0x0c1a: "sr_SP", # Serbian - Cyrillic - 0x1c1a: "sr_BA", # Serbian - Bosnia Cyrillic - 0x081a: "sr_SP", # Serbian - Latin - 0x181a: "sr_BA", # Serbian - Bosnia Latin - 0x045b: "si_LK", # Sinhala - Sri Lanka - 0x046c: "ns_ZA", # Northern Sotho - 0x0432: "tn_ZA", # Setswana - Southern Africa - 0x041b: "sk_SK", # Slovak - 0x0424: "sl_SI", # Slovenian - 0x040a: "es_ES", # Spanish - Spain - 0x080a: "es_MX", # Spanish - Mexico - 0x0c0a: "es_ES", # Spanish - Spain (Modern) - 0x100a: "es_GT", # Spanish - Guatemala - 0x140a: "es_CR", # Spanish - Costa Rica - 0x180a: "es_PA", # Spanish - Panama - 0x1c0a: "es_DO", # Spanish - Dominican Republic - 0x200a: "es_VE", # Spanish - Venezuela - 0x240a: "es_CO", # Spanish - Colombia - 0x280a: "es_PE", # Spanish - Peru - 0x2c0a: "es_AR", # Spanish - Argentina - 0x300a: "es_EC", # Spanish - Ecuador - 0x340a: "es_CL", # Spanish - Chile - 0x380a: "es_UR", # Spanish - Uruguay - 0x3c0a: "es_PY", # Spanish - Paraguay - 0x400a: "es_BO", # Spanish - Bolivia - 0x440a: "es_SV", # Spanish - El Salvador - 0x480a: "es_HN", # Spanish - Honduras - 0x4c0a: "es_NI", # Spanish - Nicaragua - 0x500a: "es_PR", # Spanish - Puerto Rico - 0x540a: "es_US", # Spanish - United States -# 0x0430: "", # Sutu - Not supported - 0x0441: "sw_KE", # Swahili - 0x041d: "sv_SE", # Swedish - Sweden - 0x081d: "sv_FI", # Swedish - Finland - 0x045a: "syr_SY",# Syriac - 0x0428: "tg_TJ", # Tajik - Cyrillic - 0x085f: "tmz_DZ",# Tamazight - Latin - 0x0449: "ta_IN", # Tamil - 0x0444: "tt_RU", # Tatar - 0x044a: "te_IN", # Telugu - 0x041e: "th_TH", # Thai - 0x0851: "bo_BT", # Tibetan - Bhutan - 0x0451: "bo_CN", # Tibetan - PRC - 0x041f: "tr_TR", # Turkish - 0x0442: "tk_TM", # Turkmen - Cyrillic - 0x0480: "ug_CN", # Uighur - Arabic - 0x0422: "uk_UA", # Ukrainian - 0x042e: "wen_DE",# Upper Sorbian - Germany - 0x0420: "ur_PK", # Urdu - 0x0820: "ur_IN", # Urdu - India - 0x0443: "uz_UZ", # Uzbek - Latin - 0x0843: "uz_UZ", # Uzbek - Cyrillic - 0x042a: "vi_VN", # Vietnamese - 0x0452: "cy_GB", # Welsh - 0x0488: "wo_SN", # Wolof - Senegal - 0x0434: "xh_ZA", # Xhosa - South Africa - 0x0485: "sah_RU",# Yakut - Cyrillic - 0x0478: "ii_CN", # Yi - PRC - 0x046a: "yo_NG", # Yoruba - Nigeria - 0x0435: "zu_ZA", # Zulu -} - -def _print_locale(): - - """ Test function. - """ - categories = {} - def _init_categories(categories=categories): - for k,v in globals().items(): - if k[:3] == 'LC_': - categories[k] = v - _init_categories() - del categories['LC_ALL'] - - print 'Locale defaults as determined by getdefaultlocale():' - print '-'*72 - lang, enc = getdefaultlocale() - print 'Language: ', lang or '(undefined)' - print 'Encoding: ', enc or '(undefined)' - print - - print 'Locale settings on startup:' - print '-'*72 - for name,category in categories.items(): - print name, '...' - lang, enc = getlocale(category) - print ' Language: ', lang or '(undefined)' - print ' Encoding: ', enc or '(undefined)' - print - - print - print 'Locale settings after calling resetlocale():' - print '-'*72 - resetlocale() - for name,category in categories.items(): - print name, '...' - lang, enc = getlocale(category) - print ' Language: ', lang or '(undefined)' - print ' Encoding: ', enc or '(undefined)' - print - - try: - setlocale(LC_ALL, "") - except: - print 'NOTE:' - print 'setlocale(LC_ALL, "") does not support the default locale' - print 'given in the OS environment variables.' - else: - print - print 'Locale settings after calling setlocale(LC_ALL, ""):' - print '-'*72 - for name,category in categories.items(): - print name, '...' - lang, enc = getlocale(category) - print ' Language: ', lang or '(undefined)' - print ' Encoding: ', enc or '(undefined)' - print - -### - -try: - LC_MESSAGES -except NameError: - pass -else: - __all__.append("LC_MESSAGES") - -if __name__=='__main__': - print 'Locale aliasing:' - print - _print_locale() - print - print 'Number formatting:' - print - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py deleted file mode 100644 index 10d0b05..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/md5.py +++ /dev/null @@ -1,14 +0,0 @@ -# $Id$ -# -# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org) -# Licensed to PSF under a Contributor Agreement. - -import warnings -warnings.warn("the md5 module is deprecated; use hashlib instead", - DeprecationWarning, 2) - -from hashlib import md5 -new = md5 - -blocksize = 1 # legacy value (wrong in any useful sense) -digest_size = 16 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py deleted file mode 100644 index 3091fdc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/modulefinder.py +++ /dev/null @@ -1,673 +0,0 @@ -"""Find modules used by a script, using introspection.""" -# This module should be kept compatible with Python 2.2, see PEP 291. - -from __future__ import generators -import dis -import imp -import marshal -import os -import sys -import types -import struct - -if hasattr(sys.__stdout__, "newlines"): - READ_MODE = "U" # universal line endings -else: - # remain compatible with Python < 2.3 - READ_MODE = "r" - -LOAD_CONST = chr(dis.opname.index('LOAD_CONST')) -IMPORT_NAME = chr(dis.opname.index('IMPORT_NAME')) -STORE_NAME = chr(dis.opname.index('STORE_NAME')) -STORE_GLOBAL = chr(dis.opname.index('STORE_GLOBAL')) -STORE_OPS = [STORE_NAME, STORE_GLOBAL] -HAVE_ARGUMENT = chr(dis.HAVE_ARGUMENT) - -# Modulefinder does a good job at simulating Python's, but it can not -# handle __path__ modifications packages make at runtime. Therefore there -# is a mechanism whereby you can register extra paths in this map for a -# package, and it will be honored. - -# Note this is a mapping is lists of paths. -packagePathMap = {} - -# A Public interface -def AddPackagePath(packagename, path): - paths = packagePathMap.get(packagename, []) - paths.append(path) - packagePathMap[packagename] = paths - -replacePackageMap = {} - -# This ReplacePackage mechanism allows modulefinder to work around the -# way the _xmlplus package injects itself under the name "xml" into -# sys.modules at runtime by calling ReplacePackage("_xmlplus", "xml") -# before running ModuleFinder. - -def ReplacePackage(oldname, newname): - replacePackageMap[oldname] = newname - - -class Module: - - def __init__(self, name, file=None, path=None): - self.__name__ = name - self.__file__ = file - self.__path__ = path - self.__code__ = None - # The set of global names that are assigned to in the module. - # This includes those names imported through starimports of - # Python modules. - self.globalnames = {} - # The set of starimports this module did that could not be - # resolved, ie. a starimport from a non-Python module. - self.starimports = {} - - def __repr__(self): - s = "Module(%r" % (self.__name__,) - if self.__file__ is not None: - s = s + ", %r" % (self.__file__,) - if self.__path__ is not None: - s = s + ", %r" % (self.__path__,) - s = s + ")" - return s - -class ModuleFinder: - - def __init__(self, path=None, debug=0, excludes=[], replace_paths=[]): - if path is None: - path = sys.path - self.path = path - self.modules = {} - self.badmodules = {} - self.debug = debug - self.indent = 0 - self.excludes = excludes - self.replace_paths = replace_paths - self.processed_paths = [] # Used in debugging only - - def msg(self, level, str, *args): - if level <= self.debug: - for i in range(self.indent): - print " ", - print str, - for arg in args: - print repr(arg), - print - - def msgin(self, *args): - level = args[0] - if level <= self.debug: - self.indent = self.indent + 1 - self.msg(*args) - - def msgout(self, *args): - level = args[0] - if level <= self.debug: - self.indent = self.indent - 1 - self.msg(*args) - - def run_script(self, pathname): - self.msg(2, "run_script", pathname) - with open(pathname, READ_MODE) as fp: - stuff = ("", "r", imp.PY_SOURCE) - self.load_module('__main__', fp, pathname, stuff) - - def load_file(self, pathname): - dir, name = os.path.split(pathname) - name, ext = os.path.splitext(name) - with open(pathname, READ_MODE) as fp: - stuff = (ext, "r", imp.PY_SOURCE) - self.load_module(name, fp, pathname, stuff) - - def import_hook(self, name, caller=None, fromlist=None, level=-1): - self.msg(3, "import_hook", name, caller, fromlist, level) - parent = self.determine_parent(caller, level=level) - q, tail = self.find_head_package(parent, name) - m = self.load_tail(q, tail) - if not fromlist: - return q - if m.__path__: - self.ensure_fromlist(m, fromlist) - return None - - def determine_parent(self, caller, level=-1): - self.msgin(4, "determine_parent", caller, level) - if not caller or level == 0: - self.msgout(4, "determine_parent -> None") - return None - pname = caller.__name__ - if level >= 1: # relative import - if caller.__path__: - level -= 1 - if level == 0: - parent = self.modules[pname] - assert parent is caller - self.msgout(4, "determine_parent ->", parent) - return parent - if pname.count(".") < level: - raise ImportError, "relative importpath too deep" - pname = ".".join(pname.split(".")[:-level]) - parent = self.modules[pname] - self.msgout(4, "determine_parent ->", parent) - return parent - if caller.__path__: - parent = self.modules[pname] - assert caller is parent - self.msgout(4, "determine_parent ->", parent) - return parent - if '.' in pname: - i = pname.rfind('.') - pname = pname[:i] - parent = self.modules[pname] - assert parent.__name__ == pname - self.msgout(4, "determine_parent ->", parent) - return parent - self.msgout(4, "determine_parent -> None") - return None - - def find_head_package(self, parent, name): - self.msgin(4, "find_head_package", parent, name) - if '.' in name: - i = name.find('.') - head = name[:i] - tail = name[i+1:] - else: - head = name - tail = "" - if parent: - qname = "%s.%s" % (parent.__name__, head) - else: - qname = head - q = self.import_module(head, qname, parent) - if q: - self.msgout(4, "find_head_package ->", (q, tail)) - return q, tail - if parent: - qname = head - parent = None - q = self.import_module(head, qname, parent) - if q: - self.msgout(4, "find_head_package ->", (q, tail)) - return q, tail - self.msgout(4, "raise ImportError: No module named", qname) - raise ImportError, "No module named " + qname - - def load_tail(self, q, tail): - self.msgin(4, "load_tail", q, tail) - m = q - while tail: - i = tail.find('.') - if i < 0: i = len(tail) - head, tail = tail[:i], tail[i+1:] - mname = "%s.%s" % (m.__name__, head) - m = self.import_module(head, mname, m) - if not m: - self.msgout(4, "raise ImportError: No module named", mname) - raise ImportError, "No module named " + mname - self.msgout(4, "load_tail ->", m) - return m - - def ensure_fromlist(self, m, fromlist, recursive=0): - self.msg(4, "ensure_fromlist", m, fromlist, recursive) - for sub in fromlist: - if sub == "*": - if not recursive: - all = self.find_all_submodules(m) - if all: - self.ensure_fromlist(m, all, 1) - elif not hasattr(m, sub): - subname = "%s.%s" % (m.__name__, sub) - submod = self.import_module(sub, subname, m) - if not submod: - raise ImportError, "No module named " + subname - - def find_all_submodules(self, m): - if not m.__path__: - return - modules = {} - # 'suffixes' used to be a list hardcoded to [".py", ".pyc", ".pyo"]. - # But we must also collect Python extension modules - although - # we cannot separate normal dlls from Python extensions. - suffixes = [] - for triple in imp.get_suffixes(): - suffixes.append(triple[0]) - for dir in m.__path__: - try: - names = os.listdir(dir) - except os.error: - self.msg(2, "can't list directory", dir) - continue - for name in names: - mod = None - for suff in suffixes: - n = len(suff) - if name[-n:] == suff: - mod = name[:-n] - break - if mod and mod != "__init__": - modules[mod] = mod - return modules.keys() - - def import_module(self, partname, fqname, parent): - self.msgin(3, "import_module", partname, fqname, parent) - try: - m = self.modules[fqname] - except KeyError: - pass - else: - self.msgout(3, "import_module ->", m) - return m - if fqname in self.badmodules: - self.msgout(3, "import_module -> None") - return None - if parent and parent.__path__ is None: - self.msgout(3, "import_module -> None") - return None - try: - fp, pathname, stuff = self.find_module(partname, - parent and parent.__path__, parent) - except ImportError: - self.msgout(3, "import_module ->", None) - return None - try: - m = self.load_module(fqname, fp, pathname, stuff) - finally: - if fp: fp.close() - if parent: - setattr(parent, partname, m) - self.msgout(3, "import_module ->", m) - return m - - def load_module(self, fqname, fp, pathname, file_info): - suffix, mode, type = file_info - self.msgin(2, "load_module", fqname, fp and "fp", pathname) - if type == imp.PKG_DIRECTORY: - m = self.load_package(fqname, pathname) - self.msgout(2, "load_module ->", m) - return m - if type == imp.PY_SOURCE: - co = compile(fp.read()+'\n', pathname, 'exec') - elif type == imp.PY_COMPILED: - if fp.read(4) != imp.get_magic(): - self.msgout(2, "raise ImportError: Bad magic number", pathname) - raise ImportError, "Bad magic number in %s" % pathname - fp.read(4) - co = marshal.load(fp) - else: - co = None - m = self.add_module(fqname) - m.__file__ = pathname - if co: - if self.replace_paths: - co = self.replace_paths_in_code(co) - m.__code__ = co - self.scan_code(co, m) - self.msgout(2, "load_module ->", m) - return m - - def _add_badmodule(self, name, caller): - if name not in self.badmodules: - self.badmodules[name] = {} - if caller: - self.badmodules[name][caller.__name__] = 1 - else: - self.badmodules[name]["-"] = 1 - - def _safe_import_hook(self, name, caller, fromlist, level=-1): - # wrapper for self.import_hook() that won't raise ImportError - if name in self.badmodules: - self._add_badmodule(name, caller) - return - try: - self.import_hook(name, caller, level=level) - except ImportError, msg: - self.msg(2, "ImportError:", str(msg)) - self._add_badmodule(name, caller) - else: - if fromlist: - for sub in fromlist: - if sub in self.badmodules: - self._add_badmodule(sub, caller) - continue - try: - self.import_hook(name, caller, [sub], level=level) - except ImportError, msg: - self.msg(2, "ImportError:", str(msg)) - fullname = name + "." + sub - self._add_badmodule(fullname, caller) - - def scan_opcodes(self, co, - unpack = struct.unpack): - # Scan the code, and yield 'interesting' opcode combinations - # Version for Python 2.4 and older - code = co.co_code - names = co.co_names - consts = co.co_consts - while code: - c = code[0] - if c in STORE_OPS: - oparg, = unpack('= HAVE_ARGUMENT: - code = code[3:] - else: - code = code[1:] - - def scan_opcodes_25(self, co, - unpack = struct.unpack): - # Scan the code, and yield 'interesting' opcode combinations - # Python 2.5 version (has absolute and relative imports) - code = co.co_code - names = co.co_names - consts = co.co_consts - LOAD_LOAD_AND_IMPORT = LOAD_CONST + LOAD_CONST + IMPORT_NAME - while code: - c = code[0] - if c in STORE_OPS: - oparg, = unpack('= HAVE_ARGUMENT: - code = code[3:] - else: - code = code[1:] - - def scan_code(self, co, m): - code = co.co_code - if sys.version_info >= (2, 5): - scanner = self.scan_opcodes_25 - else: - scanner = self.scan_opcodes - for what, args in scanner(co): - if what == "store": - name, = args - m.globalnames[name] = 1 - elif what in ("import", "absolute_import"): - fromlist, name = args - have_star = 0 - if fromlist is not None: - if "*" in fromlist: - have_star = 1 - fromlist = [f for f in fromlist if f != "*"] - if what == "absolute_import": level = 0 - else: level = -1 - self._safe_import_hook(name, m, fromlist, level=level) - if have_star: - # We've encountered an "import *". If it is a Python module, - # the code has already been parsed and we can suck out the - # global names. - mm = None - if m.__path__: - # At this point we don't know whether 'name' is a - # submodule of 'm' or a global module. Let's just try - # the full name first. - mm = self.modules.get(m.__name__ + "." + name) - if mm is None: - mm = self.modules.get(name) - if mm is not None: - m.globalnames.update(mm.globalnames) - m.starimports.update(mm.starimports) - if mm.__code__ is None: - m.starimports[name] = 1 - else: - m.starimports[name] = 1 - elif what == "relative_import": - level, fromlist, name = args - if name: - self._safe_import_hook(name, m, fromlist, level=level) - else: - parent = self.determine_parent(m, level=level) - self._safe_import_hook(parent.__name__, None, fromlist, level=0) - else: - # We don't expect anything else from the generator. - raise RuntimeError(what) - - for c in co.co_consts: - if isinstance(c, type(co)): - self.scan_code(c, m) - - def load_package(self, fqname, pathname): - self.msgin(2, "load_package", fqname, pathname) - newname = replacePackageMap.get(fqname) - if newname: - fqname = newname - m = self.add_module(fqname) - m.__file__ = pathname - m.__path__ = [pathname] - - # As per comment at top of file, simulate runtime __path__ additions. - m.__path__ = m.__path__ + packagePathMap.get(fqname, []) - - fp, buf, stuff = self.find_module("__init__", m.__path__) - self.load_module(fqname, fp, buf, stuff) - self.msgout(2, "load_package ->", m) - if fp: - fp.close() - return m - - def add_module(self, fqname): - if fqname in self.modules: - return self.modules[fqname] - self.modules[fqname] = m = Module(fqname) - return m - - def find_module(self, name, path, parent=None): - if parent is not None: - # assert path is not None - fullname = parent.__name__+'.'+name - else: - fullname = name - if fullname in self.excludes: - self.msgout(3, "find_module -> Excluded", fullname) - raise ImportError, name - - if path is None: - if name in sys.builtin_module_names: - return (None, None, ("", "", imp.C_BUILTIN)) - - path = self.path - return imp.find_module(name, path) - - def report(self): - """Print a report to stdout, listing the found modules with their - paths, as well as modules that are missing, or seem to be missing. - """ - print - print " %-25s %s" % ("Name", "File") - print " %-25s %s" % ("----", "----") - # Print modules found - keys = self.modules.keys() - keys.sort() - for key in keys: - m = self.modules[key] - if m.__path__: - print "P", - else: - print "m", - print "%-25s" % key, m.__file__ or "" - - # Print missing modules - missing, maybe = self.any_missing_maybe() - if missing: - print - print "Missing modules:" - for name in missing: - mods = self.badmodules[name].keys() - mods.sort() - print "?", name, "imported from", ', '.join(mods) - # Print modules that may be missing, but then again, maybe not... - if maybe: - print - print "Submodules that appear to be missing, but could also be", - print "global names in the parent package:" - for name in maybe: - mods = self.badmodules[name].keys() - mods.sort() - print "?", name, "imported from", ', '.join(mods) - - def any_missing(self): - """Return a list of modules that appear to be missing. Use - any_missing_maybe() if you want to know which modules are - certain to be missing, and which *may* be missing. - """ - missing, maybe = self.any_missing_maybe() - return missing + maybe - - def any_missing_maybe(self): - """Return two lists, one with modules that are certainly missing - and one with modules that *may* be missing. The latter names could - either be submodules *or* just global names in the package. - - The reason it can't always be determined is that it's impossible to - tell which names are imported when "from module import *" is done - with an extension module, short of actually importing it. - """ - missing = [] - maybe = [] - for name in self.badmodules: - if name in self.excludes: - continue - i = name.rfind(".") - if i < 0: - missing.append(name) - continue - subname = name[i+1:] - pkgname = name[:i] - pkg = self.modules.get(pkgname) - if pkg is not None: - if pkgname in self.badmodules[name]: - # The package tried to import this module itself and - # failed. It's definitely missing. - missing.append(name) - elif subname in pkg.globalnames: - # It's a global in the package: definitely not missing. - pass - elif pkg.starimports: - # It could be missing, but the package did an "import *" - # from a non-Python module, so we simply can't be sure. - maybe.append(name) - else: - # It's not a global in the package, the package didn't - # do funny star imports, it's very likely to be missing. - # The symbol could be inserted into the package from the - # outside, but since that's not good style we simply list - # it missing. - missing.append(name) - else: - missing.append(name) - missing.sort() - maybe.sort() - return missing, maybe - - def replace_paths_in_code(self, co): - new_filename = original_filename = os.path.normpath(co.co_filename) - for f, r in self.replace_paths: - if original_filename.startswith(f): - new_filename = r + original_filename[len(f):] - break - - if self.debug and original_filename not in self.processed_paths: - if new_filename != original_filename: - self.msgout(2, "co_filename %r changed to %r" \ - % (original_filename,new_filename,)) - else: - self.msgout(2, "co_filename %r remains unchanged" \ - % (original_filename,)) - self.processed_paths.append(original_filename) - - consts = list(co.co_consts) - for i in range(len(consts)): - if isinstance(consts[i], type(co)): - consts[i] = self.replace_paths_in_code(consts[i]) - - return types.CodeType(co.co_argcount, co.co_nlocals, co.co_stacksize, - co.co_flags, co.co_code, tuple(consts), co.co_names, - co.co_varnames, new_filename, co.co_name, - co.co_firstlineno, co.co_lnotab, - co.co_freevars, co.co_cellvars) - - -def test(): - # Parse command line - import getopt - try: - opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:") - except getopt.error, msg: - print msg - return - - # Process options - debug = 1 - domods = 0 - addpath = [] - exclude = [] - for o, a in opts: - if o == '-d': - debug = debug + 1 - if o == '-m': - domods = 1 - if o == '-p': - addpath = addpath + a.split(os.pathsep) - if o == '-q': - debug = 0 - if o == '-x': - exclude.append(a) - - # Provide default arguments - if not args: - script = "hello.py" - else: - script = args[0] - - # Set the path based on sys.path and the script directory - path = sys.path[:] - path[0] = os.path.dirname(script) - path = addpath + path - if debug > 1: - print "path:" - for item in path: - print " ", repr(item) - - # Create the module finder and turn its crank - mf = ModuleFinder(path, debug, exclude) - for arg in args[1:]: - if arg == '-m': - domods = 1 - continue - if domods: - if arg[-2:] == '.*': - mf.import_hook(arg[:-2], None, ["*"]) - else: - mf.import_hook(arg) - else: - mf.load_file(arg) - mf.run_script(script) - mf.report() - return mf # for -i debugging - - -if __name__ == '__main__': - try: - mf = test() - except KeyboardInterrupt: - print "\n[interrupt]" diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py deleted file mode 100644 index f41775a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/numbers.py +++ /dev/null @@ -1,391 +0,0 @@ -# Copyright 2007 Google, Inc. All Rights Reserved. -# Licensed to PSF under a Contributor Agreement. - -"""Abstract Base Classes (ABCs) for numbers, according to PEP 3141. - -TODO: Fill out more detailed documentation on the operators.""" - -from __future__ import division -from abc import ABCMeta, abstractmethod, abstractproperty - -__all__ = ["Number", "Complex", "Real", "Rational", "Integral"] - -class Number(object): - """All numbers inherit from this class. - - If you just want to check if an argument x is a number, without - caring what kind, use isinstance(x, Number). - """ - __metaclass__ = ABCMeta - __slots__ = () - - # Concrete numeric types must provide their own hash implementation - __hash__ = None - - -## Notes on Decimal -## ---------------- -## Decimal has all of the methods specified by the Real abc, but it should -## not be registered as a Real because decimals do not interoperate with -## binary floats (i.e. Decimal('3.14') + 2.71828 is undefined). But, -## abstract reals are expected to interoperate (i.e. R1 + R2 should be -## expected to work if R1 and R2 are both Reals). - -class Complex(Number): - """Complex defines the operations that work on the builtin complex type. - - In short, those are: a conversion to complex, .real, .imag, +, -, - *, /, abs(), .conjugate, ==, and !=. - - If it is given heterogenous arguments, and doesn't have special - knowledge about them, it should fall back to the builtin complex - type as described below. - """ - - __slots__ = () - - @abstractmethod - def __complex__(self): - """Return a builtin complex instance. Called for complex(self).""" - - # Will be __bool__ in 3.0. - def __nonzero__(self): - """True if self != 0. Called for bool(self).""" - return self != 0 - - @abstractproperty - def real(self): - """Retrieve the real component of this number. - - This should subclass Real. - """ - raise NotImplementedError - - @abstractproperty - def imag(self): - """Retrieve the imaginary component of this number. - - This should subclass Real. - """ - raise NotImplementedError - - @abstractmethod - def __add__(self, other): - """self + other""" - raise NotImplementedError - - @abstractmethod - def __radd__(self, other): - """other + self""" - raise NotImplementedError - - @abstractmethod - def __neg__(self): - """-self""" - raise NotImplementedError - - @abstractmethod - def __pos__(self): - """+self""" - raise NotImplementedError - - def __sub__(self, other): - """self - other""" - return self + -other - - def __rsub__(self, other): - """other - self""" - return -self + other - - @abstractmethod - def __mul__(self, other): - """self * other""" - raise NotImplementedError - - @abstractmethod - def __rmul__(self, other): - """other * self""" - raise NotImplementedError - - @abstractmethod - def __div__(self, other): - """self / other without __future__ division - - May promote to float. - """ - raise NotImplementedError - - @abstractmethod - def __rdiv__(self, other): - """other / self without __future__ division""" - raise NotImplementedError - - @abstractmethod - def __truediv__(self, other): - """self / other with __future__ division. - - Should promote to float when necessary. - """ - raise NotImplementedError - - @abstractmethod - def __rtruediv__(self, other): - """other / self with __future__ division""" - raise NotImplementedError - - @abstractmethod - def __pow__(self, exponent): - """self**exponent; should promote to float or complex when necessary.""" - raise NotImplementedError - - @abstractmethod - def __rpow__(self, base): - """base ** self""" - raise NotImplementedError - - @abstractmethod - def __abs__(self): - """Returns the Real distance from 0. Called for abs(self).""" - raise NotImplementedError - - @abstractmethod - def conjugate(self): - """(x+y*i).conjugate() returns (x-y*i).""" - raise NotImplementedError - - @abstractmethod - def __eq__(self, other): - """self == other""" - raise NotImplementedError - - def __ne__(self, other): - """self != other""" - # The default __ne__ doesn't negate __eq__ until 3.0. - return not (self == other) - -Complex.register(complex) - - -class Real(Complex): - """To Complex, Real adds the operations that work on real numbers. - - In short, those are: a conversion to float, trunc(), divmod, - %, <, <=, >, and >=. - - Real also provides defaults for the derived operations. - """ - - __slots__ = () - - @abstractmethod - def __float__(self): - """Any Real can be converted to a native float object. - - Called for float(self).""" - raise NotImplementedError - - @abstractmethod - def __trunc__(self): - """trunc(self): Truncates self to an Integral. - - Returns an Integral i such that: - * i>0 iff self>0; - * abs(i) <= abs(self); - * for any Integral j satisfying the first two conditions, - abs(i) >= abs(j) [i.e. i has "maximal" abs among those]. - i.e. "truncate towards 0". - """ - raise NotImplementedError - - def __divmod__(self, other): - """divmod(self, other): The pair (self // other, self % other). - - Sometimes this can be computed faster than the pair of - operations. - """ - return (self // other, self % other) - - def __rdivmod__(self, other): - """divmod(other, self): The pair (self // other, self % other). - - Sometimes this can be computed faster than the pair of - operations. - """ - return (other // self, other % self) - - @abstractmethod - def __floordiv__(self, other): - """self // other: The floor() of self/other.""" - raise NotImplementedError - - @abstractmethod - def __rfloordiv__(self, other): - """other // self: The floor() of other/self.""" - raise NotImplementedError - - @abstractmethod - def __mod__(self, other): - """self % other""" - raise NotImplementedError - - @abstractmethod - def __rmod__(self, other): - """other % self""" - raise NotImplementedError - - @abstractmethod - def __lt__(self, other): - """self < other - - < on Reals defines a total ordering, except perhaps for NaN.""" - raise NotImplementedError - - @abstractmethod - def __le__(self, other): - """self <= other""" - raise NotImplementedError - - # Concrete implementations of Complex abstract methods. - def __complex__(self): - """complex(self) == complex(float(self), 0)""" - return complex(float(self)) - - @property - def real(self): - """Real numbers are their real component.""" - return +self - - @property - def imag(self): - """Real numbers have no imaginary component.""" - return 0 - - def conjugate(self): - """Conjugate is a no-op for Reals.""" - return +self - -Real.register(float) - - -class Rational(Real): - """.numerator and .denominator should be in lowest terms.""" - - __slots__ = () - - @abstractproperty - def numerator(self): - raise NotImplementedError - - @abstractproperty - def denominator(self): - raise NotImplementedError - - # Concrete implementation of Real's conversion to float. - def __float__(self): - """float(self) = self.numerator / self.denominator - - It's important that this conversion use the integer's "true" - division rather than casting one side to float before dividing - so that ratios of huge integers convert without overflowing. - - """ - return self.numerator / self.denominator - - -class Integral(Rational): - """Integral adds a conversion to long and the bit-string operations.""" - - __slots__ = () - - @abstractmethod - def __long__(self): - """long(self)""" - raise NotImplementedError - - def __index__(self): - """Called whenever an index is needed, such as in slicing""" - return long(self) - - @abstractmethod - def __pow__(self, exponent, modulus=None): - """self ** exponent % modulus, but maybe faster. - - Accept the modulus argument if you want to support the - 3-argument version of pow(). Raise a TypeError if exponent < 0 - or any argument isn't Integral. Otherwise, just implement the - 2-argument version described in Complex. - """ - raise NotImplementedError - - @abstractmethod - def __lshift__(self, other): - """self << other""" - raise NotImplementedError - - @abstractmethod - def __rlshift__(self, other): - """other << self""" - raise NotImplementedError - - @abstractmethod - def __rshift__(self, other): - """self >> other""" - raise NotImplementedError - - @abstractmethod - def __rrshift__(self, other): - """other >> self""" - raise NotImplementedError - - @abstractmethod - def __and__(self, other): - """self & other""" - raise NotImplementedError - - @abstractmethod - def __rand__(self, other): - """other & self""" - raise NotImplementedError - - @abstractmethod - def __xor__(self, other): - """self ^ other""" - raise NotImplementedError - - @abstractmethod - def __rxor__(self, other): - """other ^ self""" - raise NotImplementedError - - @abstractmethod - def __or__(self, other): - """self | other""" - raise NotImplementedError - - @abstractmethod - def __ror__(self, other): - """other | self""" - raise NotImplementedError - - @abstractmethod - def __invert__(self): - """~self""" - raise NotImplementedError - - # Concrete implementations of Rational and Real abstract methods. - def __float__(self): - """float(self) == float(long(self))""" - return float(long(self)) - - @property - def numerator(self): - """Integers are their own numerators.""" - return +self - - @property - def denominator(self): - """Integers have a denominator of 1.""" - return 1 - -Integral.register(int) -Integral.register(long) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py deleted file mode 100644 index 14e8d5c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/opcode.py +++ /dev/null @@ -1,192 +0,0 @@ - -""" -opcode module - potentially shared between dis and other modules which -operate on bytecodes (e.g. peephole optimizers). -""" - -__all__ = ["cmp_op", "hasconst", "hasname", "hasjrel", "hasjabs", - "haslocal", "hascompare", "hasfree", "opname", "opmap", - "HAVE_ARGUMENT", "EXTENDED_ARG"] - -cmp_op = ('<', '<=', '==', '!=', '>', '>=', 'in', 'not in', 'is', - 'is not', 'exception match', 'BAD') - -hasconst = [] -hasname = [] -hasjrel = [] -hasjabs = [] -haslocal = [] -hascompare = [] -hasfree = [] - -opmap = {} -opname = [''] * 256 -for op in range(256): opname[op] = '<%r>' % (op,) -del op - -def def_op(name, op): - opname[op] = name - opmap[name] = op - -def name_op(name, op): - def_op(name, op) - hasname.append(op) - -def jrel_op(name, op): - def_op(name, op) - hasjrel.append(op) - -def jabs_op(name, op): - def_op(name, op) - hasjabs.append(op) - -# Instruction opcodes for compiled code -# Blank lines correspond to available opcodes - -def_op('STOP_CODE', 0) -def_op('POP_TOP', 1) -def_op('ROT_TWO', 2) -def_op('ROT_THREE', 3) -def_op('DUP_TOP', 4) -def_op('ROT_FOUR', 5) - -def_op('NOP', 9) -def_op('UNARY_POSITIVE', 10) -def_op('UNARY_NEGATIVE', 11) -def_op('UNARY_NOT', 12) -def_op('UNARY_CONVERT', 13) - -def_op('UNARY_INVERT', 15) - -def_op('BINARY_POWER', 19) -def_op('BINARY_MULTIPLY', 20) -def_op('BINARY_DIVIDE', 21) -def_op('BINARY_MODULO', 22) -def_op('BINARY_ADD', 23) -def_op('BINARY_SUBTRACT', 24) -def_op('BINARY_SUBSCR', 25) -def_op('BINARY_FLOOR_DIVIDE', 26) -def_op('BINARY_TRUE_DIVIDE', 27) -def_op('INPLACE_FLOOR_DIVIDE', 28) -def_op('INPLACE_TRUE_DIVIDE', 29) -def_op('SLICE+0', 30) -def_op('SLICE+1', 31) -def_op('SLICE+2', 32) -def_op('SLICE+3', 33) - -def_op('STORE_SLICE+0', 40) -def_op('STORE_SLICE+1', 41) -def_op('STORE_SLICE+2', 42) -def_op('STORE_SLICE+3', 43) - -def_op('DELETE_SLICE+0', 50) -def_op('DELETE_SLICE+1', 51) -def_op('DELETE_SLICE+2', 52) -def_op('DELETE_SLICE+3', 53) - -def_op('STORE_MAP', 54) -def_op('INPLACE_ADD', 55) -def_op('INPLACE_SUBTRACT', 56) -def_op('INPLACE_MULTIPLY', 57) -def_op('INPLACE_DIVIDE', 58) -def_op('INPLACE_MODULO', 59) -def_op('STORE_SUBSCR', 60) -def_op('DELETE_SUBSCR', 61) -def_op('BINARY_LSHIFT', 62) -def_op('BINARY_RSHIFT', 63) -def_op('BINARY_AND', 64) -def_op('BINARY_XOR', 65) -def_op('BINARY_OR', 66) -def_op('INPLACE_POWER', 67) -def_op('GET_ITER', 68) - -def_op('PRINT_EXPR', 70) -def_op('PRINT_ITEM', 71) -def_op('PRINT_NEWLINE', 72) -def_op('PRINT_ITEM_TO', 73) -def_op('PRINT_NEWLINE_TO', 74) -def_op('INPLACE_LSHIFT', 75) -def_op('INPLACE_RSHIFT', 76) -def_op('INPLACE_AND', 77) -def_op('INPLACE_XOR', 78) -def_op('INPLACE_OR', 79) -def_op('BREAK_LOOP', 80) -def_op('WITH_CLEANUP', 81) -def_op('LOAD_LOCALS', 82) -def_op('RETURN_VALUE', 83) -def_op('IMPORT_STAR', 84) -def_op('EXEC_STMT', 85) -def_op('YIELD_VALUE', 86) -def_op('POP_BLOCK', 87) -def_op('END_FINALLY', 88) -def_op('BUILD_CLASS', 89) - -HAVE_ARGUMENT = 90 # Opcodes from here have an argument: - -name_op('STORE_NAME', 90) # Index in name list -name_op('DELETE_NAME', 91) # "" -def_op('UNPACK_SEQUENCE', 92) # Number of tuple items -jrel_op('FOR_ITER', 93) -def_op('LIST_APPEND', 94) -name_op('STORE_ATTR', 95) # Index in name list -name_op('DELETE_ATTR', 96) # "" -name_op('STORE_GLOBAL', 97) # "" -name_op('DELETE_GLOBAL', 98) # "" -def_op('DUP_TOPX', 99) # number of items to duplicate -def_op('LOAD_CONST', 100) # Index in const list -hasconst.append(100) -name_op('LOAD_NAME', 101) # Index in name list -def_op('BUILD_TUPLE', 102) # Number of tuple items -def_op('BUILD_LIST', 103) # Number of list items -def_op('BUILD_SET', 104) # Number of set items -def_op('BUILD_MAP', 105) # Number of dict entries (upto 255) -name_op('LOAD_ATTR', 106) # Index in name list -def_op('COMPARE_OP', 107) # Comparison operator -hascompare.append(107) -name_op('IMPORT_NAME', 108) # Index in name list -name_op('IMPORT_FROM', 109) # Index in name list -jrel_op('JUMP_FORWARD', 110) # Number of bytes to skip -jabs_op('JUMP_IF_FALSE_OR_POP', 111) # Target byte offset from beginning of code -jabs_op('JUMP_IF_TRUE_OR_POP', 112) # "" -jabs_op('JUMP_ABSOLUTE', 113) # "" -jabs_op('POP_JUMP_IF_FALSE', 114) # "" -jabs_op('POP_JUMP_IF_TRUE', 115) # "" - -name_op('LOAD_GLOBAL', 116) # Index in name list - -jabs_op('CONTINUE_LOOP', 119) # Target address -jrel_op('SETUP_LOOP', 120) # Distance to target address -jrel_op('SETUP_EXCEPT', 121) # "" -jrel_op('SETUP_FINALLY', 122) # "" - -def_op('LOAD_FAST', 124) # Local variable number -haslocal.append(124) -def_op('STORE_FAST', 125) # Local variable number -haslocal.append(125) -def_op('DELETE_FAST', 126) # Local variable number -haslocal.append(126) - -def_op('RAISE_VARARGS', 130) # Number of raise arguments (1, 2, or 3) -def_op('CALL_FUNCTION', 131) # #args + (#kwargs << 8) -def_op('MAKE_FUNCTION', 132) # Number of args with default values -def_op('BUILD_SLICE', 133) # Number of items -def_op('MAKE_CLOSURE', 134) -def_op('LOAD_CLOSURE', 135) -hasfree.append(135) -def_op('LOAD_DEREF', 136) -hasfree.append(136) -def_op('STORE_DEREF', 137) -hasfree.append(137) - -def_op('CALL_FUNCTION_VAR', 140) # #args + (#kwargs << 8) -def_op('CALL_FUNCTION_KW', 141) # #args + (#kwargs << 8) -def_op('CALL_FUNCTION_VAR_KW', 142) # #args + (#kwargs << 8) - -jrel_op('SETUP_WITH', 143) - -def_op('EXTENDED_ARG', 145) -EXTENDED_ARG = 145 -def_op('SET_ADD', 146) -def_op('MAP_ADD', 147) - -del def_op, name_op, jrel_op, jabs_op diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py deleted file mode 100644 index fee5fae..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/optparse.py +++ /dev/null @@ -1,1704 +0,0 @@ -"""A powerful, extensible, and easy-to-use option parser. - -By Greg Ward - -Originally distributed as Optik. - -For support, use the optik-users@lists.sourceforge.net mailing list -(http://lists.sourceforge.net/lists/listinfo/optik-users). - -Simple usage example: - - from optparse import OptionParser - - parser = OptionParser() - parser.add_option("-f", "--file", dest="filename", - help="write report to FILE", metavar="FILE") - parser.add_option("-q", "--quiet", - action="store_false", dest="verbose", default=True, - help="don't print status messages to stdout") - - (options, args) = parser.parse_args() -""" - -__version__ = "1.5.3" - -__all__ = ['Option', - 'make_option', - 'SUPPRESS_HELP', - 'SUPPRESS_USAGE', - 'Values', - 'OptionContainer', - 'OptionGroup', - 'OptionParser', - 'HelpFormatter', - 'IndentedHelpFormatter', - 'TitledHelpFormatter', - 'OptParseError', - 'OptionError', - 'OptionConflictError', - 'OptionValueError', - 'BadOptionError'] - -__copyright__ = """ -Copyright (c) 2001-2006 Gregory P. Ward. All rights reserved. -Copyright (c) 2002-2006 Python Software Foundation. All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - * Neither the name of the author nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS -IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A -PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR -CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -""" - -import sys, os -import types -import textwrap - -def _repr(self): - return "<%s at 0x%x: %s>" % (self.__class__.__name__, id(self), self) - - -# This file was generated from: -# Id: option_parser.py 527 2006-07-23 15:21:30Z greg -# Id: option.py 522 2006-06-11 16:22:03Z gward -# Id: help.py 527 2006-07-23 15:21:30Z greg -# Id: errors.py 509 2006-04-20 00:58:24Z gward - -try: - from gettext import gettext -except ImportError: - def gettext(message): - return message -_ = gettext - - -class OptParseError (Exception): - def __init__(self, msg): - self.msg = msg - - def __str__(self): - return self.msg - - -class OptionError (OptParseError): - """ - Raised if an Option instance is created with invalid or - inconsistent arguments. - """ - - def __init__(self, msg, option): - self.msg = msg - self.option_id = str(option) - - def __str__(self): - if self.option_id: - return "option %s: %s" % (self.option_id, self.msg) - else: - return self.msg - -class OptionConflictError (OptionError): - """ - Raised if conflicting options are added to an OptionParser. - """ - -class OptionValueError (OptParseError): - """ - Raised if an invalid option value is encountered on the command - line. - """ - -class BadOptionError (OptParseError): - """ - Raised if an invalid option is seen on the command line. - """ - def __init__(self, opt_str): - self.opt_str = opt_str - - def __str__(self): - return _("no such option: %s") % self.opt_str - -class AmbiguousOptionError (BadOptionError): - """ - Raised if an ambiguous option is seen on the command line. - """ - def __init__(self, opt_str, possibilities): - BadOptionError.__init__(self, opt_str) - self.possibilities = possibilities - - def __str__(self): - return (_("ambiguous option: %s (%s?)") - % (self.opt_str, ", ".join(self.possibilities))) - - -class HelpFormatter: - - """ - Abstract base class for formatting option help. OptionParser - instances should use one of the HelpFormatter subclasses for - formatting help; by default IndentedHelpFormatter is used. - - Instance attributes: - parser : OptionParser - the controlling OptionParser instance - indent_increment : int - the number of columns to indent per nesting level - max_help_position : int - the maximum starting column for option help text - help_position : int - the calculated starting column for option help text; - initially the same as the maximum - width : int - total number of columns for output (pass None to constructor for - this value to be taken from the $COLUMNS environment variable) - level : int - current indentation level - current_indent : int - current indentation level (in columns) - help_width : int - number of columns available for option help text (calculated) - default_tag : str - text to replace with each option's default value, "%default" - by default. Set to false value to disable default value expansion. - option_strings : { Option : str } - maps Option instances to the snippet of help text explaining - the syntax of that option, e.g. "-h, --help" or - "-fFILE, --file=FILE" - _short_opt_fmt : str - format string controlling how short options with values are - printed in help text. Must be either "%s%s" ("-fFILE") or - "%s %s" ("-f FILE"), because those are the two syntaxes that - Optik supports. - _long_opt_fmt : str - similar but for long options; must be either "%s %s" ("--file FILE") - or "%s=%s" ("--file=FILE"). - """ - - NO_DEFAULT_VALUE = "none" - - def __init__(self, - indent_increment, - max_help_position, - width, - short_first): - self.parser = None - self.indent_increment = indent_increment - if width is None: - try: - width = int(os.environ['COLUMNS']) - except (KeyError, ValueError): - width = 80 - width -= 2 - self.width = width - self.help_position = self.max_help_position = \ - min(max_help_position, max(width - 20, indent_increment * 2)) - self.current_indent = 0 - self.level = 0 - self.help_width = None # computed later - self.short_first = short_first - self.default_tag = "%default" - self.option_strings = {} - self._short_opt_fmt = "%s %s" - self._long_opt_fmt = "%s=%s" - - def set_parser(self, parser): - self.parser = parser - - def set_short_opt_delimiter(self, delim): - if delim not in ("", " "): - raise ValueError( - "invalid metavar delimiter for short options: %r" % delim) - self._short_opt_fmt = "%s" + delim + "%s" - - def set_long_opt_delimiter(self, delim): - if delim not in ("=", " "): - raise ValueError( - "invalid metavar delimiter for long options: %r" % delim) - self._long_opt_fmt = "%s" + delim + "%s" - - def indent(self): - self.current_indent += self.indent_increment - self.level += 1 - - def dedent(self): - self.current_indent -= self.indent_increment - assert self.current_indent >= 0, "Indent decreased below 0." - self.level -= 1 - - def format_usage(self, usage): - raise NotImplementedError, "subclasses must implement" - - def format_heading(self, heading): - raise NotImplementedError, "subclasses must implement" - - def _format_text(self, text): - """ - Format a paragraph of free-form text for inclusion in the - help output at the current indentation level. - """ - text_width = max(self.width - self.current_indent, 11) - indent = " "*self.current_indent - return textwrap.fill(text, - text_width, - initial_indent=indent, - subsequent_indent=indent) - - def format_description(self, description): - if description: - return self._format_text(description) + "\n" - else: - return "" - - def format_epilog(self, epilog): - if epilog: - return "\n" + self._format_text(epilog) + "\n" - else: - return "" - - - def expand_default(self, option): - if self.parser is None or not self.default_tag: - return option.help - - default_value = self.parser.defaults.get(option.dest) - if default_value is NO_DEFAULT or default_value is None: - default_value = self.NO_DEFAULT_VALUE - - return option.help.replace(self.default_tag, str(default_value)) - - def format_option(self, option): - # The help for each option consists of two parts: - # * the opt strings and metavars - # eg. ("-x", or "-fFILENAME, --file=FILENAME") - # * the user-supplied help string - # eg. ("turn on expert mode", "read data from FILENAME") - # - # If possible, we write both of these on the same line: - # -x turn on expert mode - # - # But if the opt string list is too long, we put the help - # string on a second line, indented to the same column it would - # start in if it fit on the first line. - # -fFILENAME, --file=FILENAME - # read data from FILENAME - result = [] - opts = self.option_strings[option] - opt_width = self.help_position - self.current_indent - 2 - if len(opts) > opt_width: - opts = "%*s%s\n" % (self.current_indent, "", opts) - indent_first = self.help_position - else: # start help on same line as opts - opts = "%*s%-*s " % (self.current_indent, "", opt_width, opts) - indent_first = 0 - result.append(opts) - if option.help: - help_text = self.expand_default(option) - help_lines = textwrap.wrap(help_text, self.help_width) - result.append("%*s%s\n" % (indent_first, "", help_lines[0])) - result.extend(["%*s%s\n" % (self.help_position, "", line) - for line in help_lines[1:]]) - elif opts[-1] != "\n": - result.append("\n") - return "".join(result) - - def store_option_strings(self, parser): - self.indent() - max_len = 0 - for opt in parser.option_list: - strings = self.format_option_strings(opt) - self.option_strings[opt] = strings - max_len = max(max_len, len(strings) + self.current_indent) - self.indent() - for group in parser.option_groups: - for opt in group.option_list: - strings = self.format_option_strings(opt) - self.option_strings[opt] = strings - max_len = max(max_len, len(strings) + self.current_indent) - self.dedent() - self.dedent() - self.help_position = min(max_len + 2, self.max_help_position) - self.help_width = max(self.width - self.help_position, 11) - - def format_option_strings(self, option): - """Return a comma-separated list of option strings & metavariables.""" - if option.takes_value(): - metavar = option.metavar or option.dest.upper() - short_opts = [self._short_opt_fmt % (sopt, metavar) - for sopt in option._short_opts] - long_opts = [self._long_opt_fmt % (lopt, metavar) - for lopt in option._long_opts] - else: - short_opts = option._short_opts - long_opts = option._long_opts - - if self.short_first: - opts = short_opts + long_opts - else: - opts = long_opts + short_opts - - return ", ".join(opts) - -class IndentedHelpFormatter (HelpFormatter): - """Format help with indented section bodies. - """ - - def __init__(self, - indent_increment=2, - max_help_position=24, - width=None, - short_first=1): - HelpFormatter.__init__( - self, indent_increment, max_help_position, width, short_first) - - def format_usage(self, usage): - return _("Usage: %s\n") % usage - - def format_heading(self, heading): - return "%*s%s:\n" % (self.current_indent, "", heading) - - -class TitledHelpFormatter (HelpFormatter): - """Format help with underlined section headers. - """ - - def __init__(self, - indent_increment=0, - max_help_position=24, - width=None, - short_first=0): - HelpFormatter.__init__ ( - self, indent_increment, max_help_position, width, short_first) - - def format_usage(self, usage): - return "%s %s\n" % (self.format_heading(_("Usage")), usage) - - def format_heading(self, heading): - return "%s\n%s\n" % (heading, "=-"[self.level] * len(heading)) - - -def _parse_num(val, type): - if val[:2].lower() == "0x": # hexadecimal - radix = 16 - elif val[:2].lower() == "0b": # binary - radix = 2 - val = val[2:] or "0" # have to remove "0b" prefix - elif val[:1] == "0": # octal - radix = 8 - else: # decimal - radix = 10 - - return type(val, radix) - -def _parse_int(val): - return _parse_num(val, int) - -def _parse_long(val): - return _parse_num(val, long) - -_builtin_cvt = { "int" : (_parse_int, _("integer")), - "long" : (_parse_long, _("long integer")), - "float" : (float, _("floating-point")), - "complex" : (complex, _("complex")) } - -def check_builtin(option, opt, value): - (cvt, what) = _builtin_cvt[option.type] - try: - return cvt(value) - except ValueError: - raise OptionValueError( - _("option %s: invalid %s value: %r") % (opt, what, value)) - -def check_choice(option, opt, value): - if value in option.choices: - return value - else: - choices = ", ".join(map(repr, option.choices)) - raise OptionValueError( - _("option %s: invalid choice: %r (choose from %s)") - % (opt, value, choices)) - -# Not supplying a default is different from a default of None, -# so we need an explicit "not supplied" value. -NO_DEFAULT = ("NO", "DEFAULT") - - -class Option: - """ - Instance attributes: - _short_opts : [string] - _long_opts : [string] - - action : string - type : string - dest : string - default : any - nargs : int - const : any - choices : [string] - callback : function - callback_args : (any*) - callback_kwargs : { string : any } - help : string - metavar : string - """ - - # The list of instance attributes that may be set through - # keyword args to the constructor. - ATTRS = ['action', - 'type', - 'dest', - 'default', - 'nargs', - 'const', - 'choices', - 'callback', - 'callback_args', - 'callback_kwargs', - 'help', - 'metavar'] - - # The set of actions allowed by option parsers. Explicitly listed - # here so the constructor can validate its arguments. - ACTIONS = ("store", - "store_const", - "store_true", - "store_false", - "append", - "append_const", - "count", - "callback", - "help", - "version") - - # The set of actions that involve storing a value somewhere; - # also listed just for constructor argument validation. (If - # the action is one of these, there must be a destination.) - STORE_ACTIONS = ("store", - "store_const", - "store_true", - "store_false", - "append", - "append_const", - "count") - - # The set of actions for which it makes sense to supply a value - # type, ie. which may consume an argument from the command line. - TYPED_ACTIONS = ("store", - "append", - "callback") - - # The set of actions which *require* a value type, ie. that - # always consume an argument from the command line. - ALWAYS_TYPED_ACTIONS = ("store", - "append") - - # The set of actions which take a 'const' attribute. - CONST_ACTIONS = ("store_const", - "append_const") - - # The set of known types for option parsers. Again, listed here for - # constructor argument validation. - TYPES = ("string", "int", "long", "float", "complex", "choice") - - # Dictionary of argument checking functions, which convert and - # validate option arguments according to the option type. - # - # Signature of checking functions is: - # check(option : Option, opt : string, value : string) -> any - # where - # option is the Option instance calling the checker - # opt is the actual option seen on the command-line - # (eg. "-a", "--file") - # value is the option argument seen on the command-line - # - # The return value should be in the appropriate Python type - # for option.type -- eg. an integer if option.type == "int". - # - # If no checker is defined for a type, arguments will be - # unchecked and remain strings. - TYPE_CHECKER = { "int" : check_builtin, - "long" : check_builtin, - "float" : check_builtin, - "complex": check_builtin, - "choice" : check_choice, - } - - - # CHECK_METHODS is a list of unbound method objects; they are called - # by the constructor, in order, after all attributes are - # initialized. The list is created and filled in later, after all - # the methods are actually defined. (I just put it here because I - # like to define and document all class attributes in the same - # place.) Subclasses that add another _check_*() method should - # define their own CHECK_METHODS list that adds their check method - # to those from this class. - CHECK_METHODS = None - - - # -- Constructor/initialization methods ---------------------------- - - def __init__(self, *opts, **attrs): - # Set _short_opts, _long_opts attrs from 'opts' tuple. - # Have to be set now, in case no option strings are supplied. - self._short_opts = [] - self._long_opts = [] - opts = self._check_opt_strings(opts) - self._set_opt_strings(opts) - - # Set all other attrs (action, type, etc.) from 'attrs' dict - self._set_attrs(attrs) - - # Check all the attributes we just set. There are lots of - # complicated interdependencies, but luckily they can be farmed - # out to the _check_*() methods listed in CHECK_METHODS -- which - # could be handy for subclasses! The one thing these all share - # is that they raise OptionError if they discover a problem. - for checker in self.CHECK_METHODS: - checker(self) - - def _check_opt_strings(self, opts): - # Filter out None because early versions of Optik had exactly - # one short option and one long option, either of which - # could be None. - opts = filter(None, opts) - if not opts: - raise TypeError("at least one option string must be supplied") - return opts - - def _set_opt_strings(self, opts): - for opt in opts: - if len(opt) < 2: - raise OptionError( - "invalid option string %r: " - "must be at least two characters long" % opt, self) - elif len(opt) == 2: - if not (opt[0] == "-" and opt[1] != "-"): - raise OptionError( - "invalid short option string %r: " - "must be of the form -x, (x any non-dash char)" % opt, - self) - self._short_opts.append(opt) - else: - if not (opt[0:2] == "--" and opt[2] != "-"): - raise OptionError( - "invalid long option string %r: " - "must start with --, followed by non-dash" % opt, - self) - self._long_opts.append(opt) - - def _set_attrs(self, attrs): - for attr in self.ATTRS: - if attr in attrs: - setattr(self, attr, attrs[attr]) - del attrs[attr] - else: - if attr == 'default': - setattr(self, attr, NO_DEFAULT) - else: - setattr(self, attr, None) - if attrs: - attrs = attrs.keys() - attrs.sort() - raise OptionError( - "invalid keyword arguments: %s" % ", ".join(attrs), - self) - - - # -- Constructor validation methods -------------------------------- - - def _check_action(self): - if self.action is None: - self.action = "store" - elif self.action not in self.ACTIONS: - raise OptionError("invalid action: %r" % self.action, self) - - def _check_type(self): - if self.type is None: - if self.action in self.ALWAYS_TYPED_ACTIONS: - if self.choices is not None: - # The "choices" attribute implies "choice" type. - self.type = "choice" - else: - # No type given? "string" is the most sensible default. - self.type = "string" - else: - # Allow type objects or builtin type conversion functions - # (int, str, etc.) as an alternative to their names. (The - # complicated check of __builtin__ is only necessary for - # Python 2.1 and earlier, and is short-circuited by the - # first check on modern Pythons.) - import __builtin__ - if ( type(self.type) is types.TypeType or - (hasattr(self.type, "__name__") and - getattr(__builtin__, self.type.__name__, None) is self.type) ): - self.type = self.type.__name__ - - if self.type == "str": - self.type = "string" - - if self.type not in self.TYPES: - raise OptionError("invalid option type: %r" % self.type, self) - if self.action not in self.TYPED_ACTIONS: - raise OptionError( - "must not supply a type for action %r" % self.action, self) - - def _check_choice(self): - if self.type == "choice": - if self.choices is None: - raise OptionError( - "must supply a list of choices for type 'choice'", self) - elif type(self.choices) not in (types.TupleType, types.ListType): - raise OptionError( - "choices must be a list of strings ('%s' supplied)" - % str(type(self.choices)).split("'")[1], self) - elif self.choices is not None: - raise OptionError( - "must not supply choices for type %r" % self.type, self) - - def _check_dest(self): - # No destination given, and we need one for this action. The - # self.type check is for callbacks that take a value. - takes_value = (self.action in self.STORE_ACTIONS or - self.type is not None) - if self.dest is None and takes_value: - - # Glean a destination from the first long option string, - # or from the first short option string if no long options. - if self._long_opts: - # eg. "--foo-bar" -> "foo_bar" - self.dest = self._long_opts[0][2:].replace('-', '_') - else: - self.dest = self._short_opts[0][1] - - def _check_const(self): - if self.action not in self.CONST_ACTIONS and self.const is not None: - raise OptionError( - "'const' must not be supplied for action %r" % self.action, - self) - - def _check_nargs(self): - if self.action in self.TYPED_ACTIONS: - if self.nargs is None: - self.nargs = 1 - elif self.nargs is not None: - raise OptionError( - "'nargs' must not be supplied for action %r" % self.action, - self) - - def _check_callback(self): - if self.action == "callback": - if not hasattr(self.callback, '__call__'): - raise OptionError( - "callback not callable: %r" % self.callback, self) - if (self.callback_args is not None and - type(self.callback_args) is not types.TupleType): - raise OptionError( - "callback_args, if supplied, must be a tuple: not %r" - % self.callback_args, self) - if (self.callback_kwargs is not None and - type(self.callback_kwargs) is not types.DictType): - raise OptionError( - "callback_kwargs, if supplied, must be a dict: not %r" - % self.callback_kwargs, self) - else: - if self.callback is not None: - raise OptionError( - "callback supplied (%r) for non-callback option" - % self.callback, self) - if self.callback_args is not None: - raise OptionError( - "callback_args supplied for non-callback option", self) - if self.callback_kwargs is not None: - raise OptionError( - "callback_kwargs supplied for non-callback option", self) - - - CHECK_METHODS = [_check_action, - _check_type, - _check_choice, - _check_dest, - _check_const, - _check_nargs, - _check_callback] - - - # -- Miscellaneous methods ----------------------------------------- - - def __str__(self): - return "/".join(self._short_opts + self._long_opts) - - __repr__ = _repr - - def takes_value(self): - return self.type is not None - - def get_opt_string(self): - if self._long_opts: - return self._long_opts[0] - else: - return self._short_opts[0] - - - # -- Processing methods -------------------------------------------- - - def check_value(self, opt, value): - checker = self.TYPE_CHECKER.get(self.type) - if checker is None: - return value - else: - return checker(self, opt, value) - - def convert_value(self, opt, value): - if value is not None: - if self.nargs == 1: - return self.check_value(opt, value) - else: - return tuple([self.check_value(opt, v) for v in value]) - - def process(self, opt, value, values, parser): - - # First, convert the value(s) to the right type. Howl if any - # value(s) are bogus. - value = self.convert_value(opt, value) - - # And then take whatever action is expected of us. - # This is a separate method to make life easier for - # subclasses to add new actions. - return self.take_action( - self.action, self.dest, opt, value, values, parser) - - def take_action(self, action, dest, opt, value, values, parser): - if action == "store": - setattr(values, dest, value) - elif action == "store_const": - setattr(values, dest, self.const) - elif action == "store_true": - setattr(values, dest, True) - elif action == "store_false": - setattr(values, dest, False) - elif action == "append": - values.ensure_value(dest, []).append(value) - elif action == "append_const": - values.ensure_value(dest, []).append(self.const) - elif action == "count": - setattr(values, dest, values.ensure_value(dest, 0) + 1) - elif action == "callback": - args = self.callback_args or () - kwargs = self.callback_kwargs or {} - self.callback(self, opt, value, parser, *args, **kwargs) - elif action == "help": - parser.print_help() - parser.exit() - elif action == "version": - parser.print_version() - parser.exit() - else: - raise ValueError("unknown action %r" % self.action) - - return 1 - -# class Option - - -SUPPRESS_HELP = "SUPPRESS"+"HELP" -SUPPRESS_USAGE = "SUPPRESS"+"USAGE" - -try: - basestring -except NameError: - def isbasestring(x): - return isinstance(x, (types.StringType, types.UnicodeType)) -else: - def isbasestring(x): - return isinstance(x, basestring) - -class Values: - - def __init__(self, defaults=None): - if defaults: - for (attr, val) in defaults.items(): - setattr(self, attr, val) - - def __str__(self): - return str(self.__dict__) - - __repr__ = _repr - - def __cmp__(self, other): - if isinstance(other, Values): - return cmp(self.__dict__, other.__dict__) - elif isinstance(other, types.DictType): - return cmp(self.__dict__, other) - else: - return -1 - - def _update_careful(self, dict): - """ - Update the option values from an arbitrary dictionary, but only - use keys from dict that already have a corresponding attribute - in self. Any keys in dict without a corresponding attribute - are silently ignored. - """ - for attr in dir(self): - if attr in dict: - dval = dict[attr] - if dval is not None: - setattr(self, attr, dval) - - def _update_loose(self, dict): - """ - Update the option values from an arbitrary dictionary, - using all keys from the dictionary regardless of whether - they have a corresponding attribute in self or not. - """ - self.__dict__.update(dict) - - def _update(self, dict, mode): - if mode == "careful": - self._update_careful(dict) - elif mode == "loose": - self._update_loose(dict) - else: - raise ValueError, "invalid update mode: %r" % mode - - def read_module(self, modname, mode="careful"): - __import__(modname) - mod = sys.modules[modname] - self._update(vars(mod), mode) - - def read_file(self, filename, mode="careful"): - vars = {} - execfile(filename, vars) - self._update(vars, mode) - - def ensure_value(self, attr, value): - if not hasattr(self, attr) or getattr(self, attr) is None: - setattr(self, attr, value) - return getattr(self, attr) - - -class OptionContainer: - - """ - Abstract base class. - - Class attributes: - standard_option_list : [Option] - list of standard options that will be accepted by all instances - of this parser class (intended to be overridden by subclasses). - - Instance attributes: - option_list : [Option] - the list of Option objects contained by this OptionContainer - _short_opt : { string : Option } - dictionary mapping short option strings, eg. "-f" or "-X", - to the Option instances that implement them. If an Option - has multiple short option strings, it will appears in this - dictionary multiple times. [1] - _long_opt : { string : Option } - dictionary mapping long option strings, eg. "--file" or - "--exclude", to the Option instances that implement them. - Again, a given Option can occur multiple times in this - dictionary. [1] - defaults : { string : any } - dictionary mapping option destination names to default - values for each destination [1] - - [1] These mappings are common to (shared by) all components of the - controlling OptionParser, where they are initially created. - - """ - - def __init__(self, option_class, conflict_handler, description): - # Initialize the option list and related data structures. - # This method must be provided by subclasses, and it must - # initialize at least the following instance attributes: - # option_list, _short_opt, _long_opt, defaults. - self._create_option_list() - - self.option_class = option_class - self.set_conflict_handler(conflict_handler) - self.set_description(description) - - def _create_option_mappings(self): - # For use by OptionParser constructor -- create the master - # option mappings used by this OptionParser and all - # OptionGroups that it owns. - self._short_opt = {} # single letter -> Option instance - self._long_opt = {} # long option -> Option instance - self.defaults = {} # maps option dest -> default value - - - def _share_option_mappings(self, parser): - # For use by OptionGroup constructor -- use shared option - # mappings from the OptionParser that owns this OptionGroup. - self._short_opt = parser._short_opt - self._long_opt = parser._long_opt - self.defaults = parser.defaults - - def set_conflict_handler(self, handler): - if handler not in ("error", "resolve"): - raise ValueError, "invalid conflict_resolution value %r" % handler - self.conflict_handler = handler - - def set_description(self, description): - self.description = description - - def get_description(self): - return self.description - - - def destroy(self): - """see OptionParser.destroy().""" - del self._short_opt - del self._long_opt - del self.defaults - - - # -- Option-adding methods ----------------------------------------- - - def _check_conflict(self, option): - conflict_opts = [] - for opt in option._short_opts: - if opt in self._short_opt: - conflict_opts.append((opt, self._short_opt[opt])) - for opt in option._long_opts: - if opt in self._long_opt: - conflict_opts.append((opt, self._long_opt[opt])) - - if conflict_opts: - handler = self.conflict_handler - if handler == "error": - raise OptionConflictError( - "conflicting option string(s): %s" - % ", ".join([co[0] for co in conflict_opts]), - option) - elif handler == "resolve": - for (opt, c_option) in conflict_opts: - if opt.startswith("--"): - c_option._long_opts.remove(opt) - del self._long_opt[opt] - else: - c_option._short_opts.remove(opt) - del self._short_opt[opt] - if not (c_option._short_opts or c_option._long_opts): - c_option.container.option_list.remove(c_option) - - def add_option(self, *args, **kwargs): - """add_option(Option) - add_option(opt_str, ..., kwarg=val, ...) - """ - if type(args[0]) in types.StringTypes: - option = self.option_class(*args, **kwargs) - elif len(args) == 1 and not kwargs: - option = args[0] - if not isinstance(option, Option): - raise TypeError, "not an Option instance: %r" % option - else: - raise TypeError, "invalid arguments" - - self._check_conflict(option) - - self.option_list.append(option) - option.container = self - for opt in option._short_opts: - self._short_opt[opt] = option - for opt in option._long_opts: - self._long_opt[opt] = option - - if option.dest is not None: # option has a dest, we need a default - if option.default is not NO_DEFAULT: - self.defaults[option.dest] = option.default - elif option.dest not in self.defaults: - self.defaults[option.dest] = None - - return option - - def add_options(self, option_list): - for option in option_list: - self.add_option(option) - - # -- Option query/removal methods ---------------------------------- - - def get_option(self, opt_str): - return (self._short_opt.get(opt_str) or - self._long_opt.get(opt_str)) - - def has_option(self, opt_str): - return (opt_str in self._short_opt or - opt_str in self._long_opt) - - def remove_option(self, opt_str): - option = self._short_opt.get(opt_str) - if option is None: - option = self._long_opt.get(opt_str) - if option is None: - raise ValueError("no such option %r" % opt_str) - - for opt in option._short_opts: - del self._short_opt[opt] - for opt in option._long_opts: - del self._long_opt[opt] - option.container.option_list.remove(option) - - - # -- Help-formatting methods --------------------------------------- - - def format_option_help(self, formatter): - if not self.option_list: - return "" - result = [] - for option in self.option_list: - if not option.help is SUPPRESS_HELP: - result.append(formatter.format_option(option)) - return "".join(result) - - def format_description(self, formatter): - return formatter.format_description(self.get_description()) - - def format_help(self, formatter): - result = [] - if self.description: - result.append(self.format_description(formatter)) - if self.option_list: - result.append(self.format_option_help(formatter)) - return "\n".join(result) - - -class OptionGroup (OptionContainer): - - def __init__(self, parser, title, description=None): - self.parser = parser - OptionContainer.__init__( - self, parser.option_class, parser.conflict_handler, description) - self.title = title - - def _create_option_list(self): - self.option_list = [] - self._share_option_mappings(self.parser) - - def set_title(self, title): - self.title = title - - def destroy(self): - """see OptionParser.destroy().""" - OptionContainer.destroy(self) - del self.option_list - - # -- Help-formatting methods --------------------------------------- - - def format_help(self, formatter): - result = formatter.format_heading(self.title) - formatter.indent() - result += OptionContainer.format_help(self, formatter) - formatter.dedent() - return result - - -class OptionParser (OptionContainer): - - """ - Class attributes: - standard_option_list : [Option] - list of standard options that will be accepted by all instances - of this parser class (intended to be overridden by subclasses). - - Instance attributes: - usage : string - a usage string for your program. Before it is displayed - to the user, "%prog" will be expanded to the name of - your program (self.prog or os.path.basename(sys.argv[0])). - prog : string - the name of the current program (to override - os.path.basename(sys.argv[0])). - description : string - A paragraph of text giving a brief overview of your program. - optparse reformats this paragraph to fit the current terminal - width and prints it when the user requests help (after usage, - but before the list of options). - epilog : string - paragraph of help text to print after option help - - option_groups : [OptionGroup] - list of option groups in this parser (option groups are - irrelevant for parsing the command-line, but very useful - for generating help) - - allow_interspersed_args : bool = true - if true, positional arguments may be interspersed with options. - Assuming -a and -b each take a single argument, the command-line - -ablah foo bar -bboo baz - will be interpreted the same as - -ablah -bboo -- foo bar baz - If this flag were false, that command line would be interpreted as - -ablah -- foo bar -bboo baz - -- ie. we stop processing options as soon as we see the first - non-option argument. (This is the tradition followed by - Python's getopt module, Perl's Getopt::Std, and other argument- - parsing libraries, but it is generally annoying to users.) - - process_default_values : bool = true - if true, option default values are processed similarly to option - values from the command line: that is, they are passed to the - type-checking function for the option's type (as long as the - default value is a string). (This really only matters if you - have defined custom types; see SF bug #955889.) Set it to false - to restore the behaviour of Optik 1.4.1 and earlier. - - rargs : [string] - the argument list currently being parsed. Only set when - parse_args() is active, and continually trimmed down as - we consume arguments. Mainly there for the benefit of - callback options. - largs : [string] - the list of leftover arguments that we have skipped while - parsing options. If allow_interspersed_args is false, this - list is always empty. - values : Values - the set of option values currently being accumulated. Only - set when parse_args() is active. Also mainly for callbacks. - - Because of the 'rargs', 'largs', and 'values' attributes, - OptionParser is not thread-safe. If, for some perverse reason, you - need to parse command-line arguments simultaneously in different - threads, use different OptionParser instances. - - """ - - standard_option_list = [] - - def __init__(self, - usage=None, - option_list=None, - option_class=Option, - version=None, - conflict_handler="error", - description=None, - formatter=None, - add_help_option=True, - prog=None, - epilog=None): - OptionContainer.__init__( - self, option_class, conflict_handler, description) - self.set_usage(usage) - self.prog = prog - self.version = version - self.allow_interspersed_args = True - self.process_default_values = True - if formatter is None: - formatter = IndentedHelpFormatter() - self.formatter = formatter - self.formatter.set_parser(self) - self.epilog = epilog - - # Populate the option list; initial sources are the - # standard_option_list class attribute, the 'option_list' - # argument, and (if applicable) the _add_version_option() and - # _add_help_option() methods. - self._populate_option_list(option_list, - add_help=add_help_option) - - self._init_parsing_state() - - - def destroy(self): - """ - Declare that you are done with this OptionParser. This cleans up - reference cycles so the OptionParser (and all objects referenced by - it) can be garbage-collected promptly. After calling destroy(), the - OptionParser is unusable. - """ - OptionContainer.destroy(self) - for group in self.option_groups: - group.destroy() - del self.option_list - del self.option_groups - del self.formatter - - - # -- Private methods ----------------------------------------------- - # (used by our or OptionContainer's constructor) - - def _create_option_list(self): - self.option_list = [] - self.option_groups = [] - self._create_option_mappings() - - def _add_help_option(self): - self.add_option("-h", "--help", - action="help", - help=_("show this help message and exit")) - - def _add_version_option(self): - self.add_option("--version", - action="version", - help=_("show program's version number and exit")) - - def _populate_option_list(self, option_list, add_help=True): - if self.standard_option_list: - self.add_options(self.standard_option_list) - if option_list: - self.add_options(option_list) - if self.version: - self._add_version_option() - if add_help: - self._add_help_option() - - def _init_parsing_state(self): - # These are set in parse_args() for the convenience of callbacks. - self.rargs = None - self.largs = None - self.values = None - - - # -- Simple modifier methods --------------------------------------- - - def set_usage(self, usage): - if usage is None: - self.usage = _("%prog [options]") - elif usage is SUPPRESS_USAGE: - self.usage = None - # For backwards compatibility with Optik 1.3 and earlier. - elif usage.lower().startswith("usage: "): - self.usage = usage[7:] - else: - self.usage = usage - - def enable_interspersed_args(self): - """Set parsing to not stop on the first non-option, allowing - interspersing switches with command arguments. This is the - default behavior. See also disable_interspersed_args() and the - class documentation description of the attribute - allow_interspersed_args.""" - self.allow_interspersed_args = True - - def disable_interspersed_args(self): - """Set parsing to stop on the first non-option. Use this if - you have a command processor which runs another command that - has options of its own and you want to make sure these options - don't get confused. - """ - self.allow_interspersed_args = False - - def set_process_default_values(self, process): - self.process_default_values = process - - def set_default(self, dest, value): - self.defaults[dest] = value - - def set_defaults(self, **kwargs): - self.defaults.update(kwargs) - - def _get_all_options(self): - options = self.option_list[:] - for group in self.option_groups: - options.extend(group.option_list) - return options - - def get_default_values(self): - if not self.process_default_values: - # Old, pre-Optik 1.5 behaviour. - return Values(self.defaults) - - defaults = self.defaults.copy() - for option in self._get_all_options(): - default = defaults.get(option.dest) - if isbasestring(default): - opt_str = option.get_opt_string() - defaults[option.dest] = option.check_value(opt_str, default) - - return Values(defaults) - - - # -- OptionGroup methods ------------------------------------------- - - def add_option_group(self, *args, **kwargs): - # XXX lots of overlap with OptionContainer.add_option() - if type(args[0]) is types.StringType: - group = OptionGroup(self, *args, **kwargs) - elif len(args) == 1 and not kwargs: - group = args[0] - if not isinstance(group, OptionGroup): - raise TypeError, "not an OptionGroup instance: %r" % group - if group.parser is not self: - raise ValueError, "invalid OptionGroup (wrong parser)" - else: - raise TypeError, "invalid arguments" - - self.option_groups.append(group) - return group - - def get_option_group(self, opt_str): - option = (self._short_opt.get(opt_str) or - self._long_opt.get(opt_str)) - if option and option.container is not self: - return option.container - return None - - - # -- Option-parsing methods ---------------------------------------- - - def _get_args(self, args): - if args is None: - return sys.argv[1:] - else: - return args[:] # don't modify caller's list - - def parse_args(self, args=None, values=None): - """ - parse_args(args : [string] = sys.argv[1:], - values : Values = None) - -> (values : Values, args : [string]) - - Parse the command-line options found in 'args' (default: - sys.argv[1:]). Any errors result in a call to 'error()', which - by default prints the usage message to stderr and calls - sys.exit() with an error message. On success returns a pair - (values, args) where 'values' is an Values instance (with all - your option values) and 'args' is the list of arguments left - over after parsing options. - """ - rargs = self._get_args(args) - if values is None: - values = self.get_default_values() - - # Store the halves of the argument list as attributes for the - # convenience of callbacks: - # rargs - # the rest of the command-line (the "r" stands for - # "remaining" or "right-hand") - # largs - # the leftover arguments -- ie. what's left after removing - # options and their arguments (the "l" stands for "leftover" - # or "left-hand") - self.rargs = rargs - self.largs = largs = [] - self.values = values - - try: - stop = self._process_args(largs, rargs, values) - except (BadOptionError, OptionValueError), err: - self.error(str(err)) - - args = largs + rargs - return self.check_values(values, args) - - def check_values(self, values, args): - """ - check_values(values : Values, args : [string]) - -> (values : Values, args : [string]) - - Check that the supplied option values and leftover arguments are - valid. Returns the option values and leftover arguments - (possibly adjusted, possibly completely new -- whatever you - like). Default implementation just returns the passed-in - values; subclasses may override as desired. - """ - return (values, args) - - def _process_args(self, largs, rargs, values): - """_process_args(largs : [string], - rargs : [string], - values : Values) - - Process command-line arguments and populate 'values', consuming - options and arguments from 'rargs'. If 'allow_interspersed_args' is - false, stop at the first non-option argument. If true, accumulate any - interspersed non-option arguments in 'largs'. - """ - while rargs: - arg = rargs[0] - # We handle bare "--" explicitly, and bare "-" is handled by the - # standard arg handler since the short arg case ensures that the - # len of the opt string is greater than 1. - if arg == "--": - del rargs[0] - return - elif arg[0:2] == "--": - # process a single long option (possibly with value(s)) - self._process_long_opt(rargs, values) - elif arg[:1] == "-" and len(arg) > 1: - # process a cluster of short options (possibly with - # value(s) for the last one only) - self._process_short_opts(rargs, values) - elif self.allow_interspersed_args: - largs.append(arg) - del rargs[0] - else: - return # stop now, leave this arg in rargs - - # Say this is the original argument list: - # [arg0, arg1, ..., arg(i-1), arg(i), arg(i+1), ..., arg(N-1)] - # ^ - # (we are about to process arg(i)). - # - # Then rargs is [arg(i), ..., arg(N-1)] and largs is a *subset* of - # [arg0, ..., arg(i-1)] (any options and their arguments will have - # been removed from largs). - # - # The while loop will usually consume 1 or more arguments per pass. - # If it consumes 1 (eg. arg is an option that takes no arguments), - # then after _process_arg() is done the situation is: - # - # largs = subset of [arg0, ..., arg(i)] - # rargs = [arg(i+1), ..., arg(N-1)] - # - # If allow_interspersed_args is false, largs will always be - # *empty* -- still a subset of [arg0, ..., arg(i-1)], but - # not a very interesting subset! - - def _match_long_opt(self, opt): - """_match_long_opt(opt : string) -> string - - Determine which long option string 'opt' matches, ie. which one - it is an unambiguous abbreviation for. Raises BadOptionError if - 'opt' doesn't unambiguously match any long option string. - """ - return _match_abbrev(opt, self._long_opt) - - def _process_long_opt(self, rargs, values): - arg = rargs.pop(0) - - # Value explicitly attached to arg? Pretend it's the next - # argument. - if "=" in arg: - (opt, next_arg) = arg.split("=", 1) - rargs.insert(0, next_arg) - had_explicit_value = True - else: - opt = arg - had_explicit_value = False - - opt = self._match_long_opt(opt) - option = self._long_opt[opt] - if option.takes_value(): - nargs = option.nargs - if len(rargs) < nargs: - if nargs == 1: - self.error(_("%s option requires an argument") % opt) - else: - self.error(_("%s option requires %d arguments") - % (opt, nargs)) - elif nargs == 1: - value = rargs.pop(0) - else: - value = tuple(rargs[0:nargs]) - del rargs[0:nargs] - - elif had_explicit_value: - self.error(_("%s option does not take a value") % opt) - - else: - value = None - - option.process(opt, value, values, self) - - def _process_short_opts(self, rargs, values): - arg = rargs.pop(0) - stop = False - i = 1 - for ch in arg[1:]: - opt = "-" + ch - option = self._short_opt.get(opt) - i += 1 # we have consumed a character - - if not option: - raise BadOptionError(opt) - if option.takes_value(): - # Any characters left in arg? Pretend they're the - # next arg, and stop consuming characters of arg. - if i < len(arg): - rargs.insert(0, arg[i:]) - stop = True - - nargs = option.nargs - if len(rargs) < nargs: - if nargs == 1: - self.error(_("%s option requires an argument") % opt) - else: - self.error(_("%s option requires %d arguments") - % (opt, nargs)) - elif nargs == 1: - value = rargs.pop(0) - else: - value = tuple(rargs[0:nargs]) - del rargs[0:nargs] - - else: # option doesn't take a value - value = None - - option.process(opt, value, values, self) - - if stop: - break - - - # -- Feedback methods ---------------------------------------------- - - def get_prog_name(self): - if self.prog is None: - return os.path.basename(sys.argv[0]) - else: - return self.prog - - def expand_prog_name(self, s): - return s.replace("%prog", self.get_prog_name()) - - def get_description(self): - return self.expand_prog_name(self.description) - - def exit(self, status=0, msg=None): - if msg: - sys.stderr.write(msg) - sys.exit(status) - - def error(self, msg): - """error(msg : string) - - Print a usage message incorporating 'msg' to stderr and exit. - If you override this in a subclass, it should not return -- it - should either exit or raise an exception. - """ - self.print_usage(sys.stderr) - self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg)) - - def get_usage(self): - if self.usage: - return self.formatter.format_usage( - self.expand_prog_name(self.usage)) - else: - return "" - - def print_usage(self, file=None): - """print_usage(file : file = stdout) - - Print the usage message for the current program (self.usage) to - 'file' (default stdout). Any occurrence of the string "%prog" in - self.usage is replaced with the name of the current program - (basename of sys.argv[0]). Does nothing if self.usage is empty - or not defined. - """ - if self.usage: - print >>file, self.get_usage() - - def get_version(self): - if self.version: - return self.expand_prog_name(self.version) - else: - return "" - - def print_version(self, file=None): - """print_version(file : file = stdout) - - Print the version message for this program (self.version) to - 'file' (default stdout). As with print_usage(), any occurrence - of "%prog" in self.version is replaced by the current program's - name. Does nothing if self.version is empty or undefined. - """ - if self.version: - print >>file, self.get_version() - - def format_option_help(self, formatter=None): - if formatter is None: - formatter = self.formatter - formatter.store_option_strings(self) - result = [] - result.append(formatter.format_heading(_("Options"))) - formatter.indent() - if self.option_list: - result.append(OptionContainer.format_option_help(self, formatter)) - result.append("\n") - for group in self.option_groups: - result.append(group.format_help(formatter)) - result.append("\n") - formatter.dedent() - # Drop the last "\n", or the header if no options or option groups: - return "".join(result[:-1]) - - def format_epilog(self, formatter): - return formatter.format_epilog(self.epilog) - - def format_help(self, formatter=None): - if formatter is None: - formatter = self.formatter - result = [] - if self.usage: - result.append(self.get_usage() + "\n") - if self.description: - result.append(self.format_description(formatter) + "\n") - result.append(self.format_option_help(formatter)) - result.append(self.format_epilog(formatter)) - return "".join(result) - - # used by test suite - def _get_encoding(self, file): - encoding = getattr(file, "encoding", None) - if not encoding: - encoding = sys.getdefaultencoding() - return encoding - - def print_help(self, file=None): - """print_help(file : file = stdout) - - Print an extended help message, listing all options and any - help text provided with them, to 'file' (default stdout). - """ - if file is None: - file = sys.stdout - encoding = self._get_encoding(file) - file.write(self.format_help().encode(encoding, "replace")) - -# class OptionParser - - -def _match_abbrev(s, wordmap): - """_match_abbrev(s : string, wordmap : {string : Option}) -> string - - Return the string key in 'wordmap' for which 's' is an unambiguous - abbreviation. If 's' is found to be ambiguous or doesn't match any of - 'words', raise BadOptionError. - """ - # Is there an exact match? - if s in wordmap: - return s - else: - # Isolate all words with s as a prefix. - possibilities = [word for word in wordmap.keys() - if word.startswith(s)] - # No exact match, so there had better be just one possibility. - if len(possibilities) == 1: - return possibilities[0] - elif not possibilities: - raise BadOptionError(s) - else: - # More than one possible completion: ambiguous prefix. - possibilities.sort() - raise AmbiguousOptionError(s, possibilities) - - -# Some day, there might be many Option classes. As of Optik 1.3, the -# preferred way to instantiate Options is indirectly, via make_option(), -# which will become a factory function when there are many Option -# classes. -make_option = Option diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py deleted file mode 100644 index 3a58242..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/pkgutil.py +++ /dev/null @@ -1,591 +0,0 @@ -"""Utilities to support packages.""" - -# NOTE: This module must remain compatible with Python 2.3, as it is shared -# by setuptools for distribution with Python 2.3 and up. - -import os -import sys -import imp -import os.path -from types import ModuleType - -__all__ = [ - 'get_importer', 'iter_importers', 'get_loader', 'find_loader', - 'walk_packages', 'iter_modules', 'get_data', - 'ImpImporter', 'ImpLoader', 'read_code', 'extend_path', -] - -def read_code(stream): - # This helper is needed in order for the PEP 302 emulation to - # correctly handle compiled files - import marshal - - magic = stream.read(4) - if magic != imp.get_magic(): - return None - - stream.read(4) # Skip timestamp - return marshal.load(stream) - - -def simplegeneric(func): - """Make a trivial single-dispatch generic function""" - registry = {} - def wrapper(*args, **kw): - ob = args[0] - try: - cls = ob.__class__ - except AttributeError: - cls = type(ob) - try: - mro = cls.__mro__ - except AttributeError: - try: - class cls(cls, object): - pass - mro = cls.__mro__[1:] - except TypeError: - mro = object, # must be an ExtensionClass or some such :( - for t in mro: - if t in registry: - return registry[t](*args, **kw) - else: - return func(*args, **kw) - try: - wrapper.__name__ = func.__name__ - except (TypeError, AttributeError): - pass # Python 2.3 doesn't allow functions to be renamed - - def register(typ, func=None): - if func is None: - return lambda f: register(typ, f) - registry[typ] = func - return func - - wrapper.__dict__ = func.__dict__ - wrapper.__doc__ = func.__doc__ - wrapper.register = register - return wrapper - - -def walk_packages(path=None, prefix='', onerror=None): - """Yields (module_loader, name, ispkg) for all modules recursively - on path, or, if path is None, all accessible modules. - - 'path' should be either None or a list of paths to look for - modules in. - - 'prefix' is a string to output on the front of every module name - on output. - - Note that this function must import all *packages* (NOT all - modules!) on the given path, in order to access the __path__ - attribute to find submodules. - - 'onerror' is a function which gets called with one argument (the - name of the package which was being imported) if any exception - occurs while trying to import a package. If no onerror function is - supplied, ImportErrors are caught and ignored, while all other - exceptions are propagated, terminating the search. - - Examples: - - # list all modules python can access - walk_packages() - - # list all submodules of ctypes - walk_packages(ctypes.__path__, ctypes.__name__+'.') - """ - - def seen(p, m={}): - if p in m: - return True - m[p] = True - - for importer, name, ispkg in iter_modules(path, prefix): - yield importer, name, ispkg - - if ispkg: - try: - __import__(name) - except ImportError: - if onerror is not None: - onerror(name) - except Exception: - if onerror is not None: - onerror(name) - else: - raise - else: - path = getattr(sys.modules[name], '__path__', None) or [] - - # don't traverse path items we've seen before - path = [p for p in path if not seen(p)] - - for item in walk_packages(path, name+'.', onerror): - yield item - - -def iter_modules(path=None, prefix=''): - """Yields (module_loader, name, ispkg) for all submodules on path, - or, if path is None, all top-level modules on sys.path. - - 'path' should be either None or a list of paths to look for - modules in. - - 'prefix' is a string to output on the front of every module name - on output. - """ - - if path is None: - importers = iter_importers() - else: - importers = map(get_importer, path) - - yielded = {} - for i in importers: - for name, ispkg in iter_importer_modules(i, prefix): - if name not in yielded: - yielded[name] = 1 - yield i, name, ispkg - - -#@simplegeneric -def iter_importer_modules(importer, prefix=''): - if not hasattr(importer, 'iter_modules'): - return [] - return importer.iter_modules(prefix) - -iter_importer_modules = simplegeneric(iter_importer_modules) - - -class ImpImporter: - """PEP 302 Importer that wraps Python's "classic" import algorithm - - ImpImporter(dirname) produces a PEP 302 importer that searches that - directory. ImpImporter(None) produces a PEP 302 importer that searches - the current sys.path, plus any modules that are frozen or built-in. - - Note that ImpImporter does not currently support being used by placement - on sys.meta_path. - """ - - def __init__(self, path=None): - self.path = path - - def find_module(self, fullname, path=None): - # Note: we ignore 'path' argument since it is only used via meta_path - subname = fullname.split(".")[-1] - if subname != fullname and self.path is None: - return None - if self.path is None: - path = None - else: - path = [os.path.realpath(self.path)] - try: - file, filename, etc = imp.find_module(subname, path) - except ImportError: - return None - return ImpLoader(fullname, file, filename, etc) - - def iter_modules(self, prefix=''): - if self.path is None or not os.path.isdir(self.path): - return - - yielded = {} - import inspect - try: - filenames = os.listdir(self.path) - except OSError: - # ignore unreadable directories like import does - filenames = [] - filenames.sort() # handle packages before same-named modules - - for fn in filenames: - modname = inspect.getmodulename(fn) - if modname=='__init__' or modname in yielded: - continue - - path = os.path.join(self.path, fn) - ispkg = False - - if not modname and os.path.isdir(path) and '.' not in fn: - modname = fn - try: - dircontents = os.listdir(path) - except OSError: - # ignore unreadable directories like import does - dircontents = [] - for fn in dircontents: - subname = inspect.getmodulename(fn) - if subname=='__init__': - ispkg = True - break - else: - continue # not a package - - if modname and '.' not in modname: - yielded[modname] = 1 - yield prefix + modname, ispkg - - -class ImpLoader: - """PEP 302 Loader that wraps Python's "classic" import algorithm - """ - code = source = None - - def __init__(self, fullname, file, filename, etc): - self.file = file - self.filename = filename - self.fullname = fullname - self.etc = etc - - def load_module(self, fullname): - self._reopen() - try: - mod = imp.load_module(fullname, self.file, self.filename, self.etc) - finally: - if self.file: - self.file.close() - # Note: we don't set __loader__ because we want the module to look - # normal; i.e. this is just a wrapper for standard import machinery - return mod - - def get_data(self, pathname): - return open(pathname, "rb").read() - - def _reopen(self): - if self.file and self.file.closed: - mod_type = self.etc[2] - if mod_type==imp.PY_SOURCE: - self.file = open(self.filename, 'rU') - elif mod_type in (imp.PY_COMPILED, imp.C_EXTENSION): - self.file = open(self.filename, 'rb') - - def _fix_name(self, fullname): - if fullname is None: - fullname = self.fullname - elif fullname != self.fullname: - raise ImportError("Loader for module %s cannot handle " - "module %s" % (self.fullname, fullname)) - return fullname - - def is_package(self, fullname): - fullname = self._fix_name(fullname) - return self.etc[2]==imp.PKG_DIRECTORY - - def get_code(self, fullname=None): - fullname = self._fix_name(fullname) - if self.code is None: - mod_type = self.etc[2] - if mod_type==imp.PY_SOURCE: - source = self.get_source(fullname) - self.code = compile(source, self.filename, 'exec') - elif mod_type==imp.PY_COMPILED: - self._reopen() - try: - self.code = read_code(self.file) - finally: - self.file.close() - elif mod_type==imp.PKG_DIRECTORY: - self.code = self._get_delegate().get_code() - return self.code - - def get_source(self, fullname=None): - fullname = self._fix_name(fullname) - if self.source is None: - mod_type = self.etc[2] - if mod_type==imp.PY_SOURCE: - self._reopen() - try: - self.source = self.file.read() - finally: - self.file.close() - elif mod_type==imp.PY_COMPILED: - if os.path.exists(self.filename[:-1]): - f = open(self.filename[:-1], 'rU') - self.source = f.read() - f.close() - elif mod_type==imp.PKG_DIRECTORY: - self.source = self._get_delegate().get_source() - return self.source - - - def _get_delegate(self): - return ImpImporter(self.filename).find_module('__init__') - - def get_filename(self, fullname=None): - fullname = self._fix_name(fullname) - mod_type = self.etc[2] - if self.etc[2]==imp.PKG_DIRECTORY: - return self._get_delegate().get_filename() - elif self.etc[2] in (imp.PY_SOURCE, imp.PY_COMPILED, imp.C_EXTENSION): - return self.filename - return None - - -try: - import zipimport - from zipimport import zipimporter - - def iter_zipimport_modules(importer, prefix=''): - dirlist = zipimport._zip_directory_cache[importer.archive].keys() - dirlist.sort() - _prefix = importer.prefix - plen = len(_prefix) - yielded = {} - import inspect - for fn in dirlist: - if not fn.startswith(_prefix): - continue - - fn = fn[plen:].split(os.sep) - - if len(fn)==2 and fn[1].startswith('__init__.py'): - if fn[0] not in yielded: - yielded[fn[0]] = 1 - yield fn[0], True - - if len(fn)!=1: - continue - - modname = inspect.getmodulename(fn[0]) - if modname=='__init__': - continue - - if modname and '.' not in modname and modname not in yielded: - yielded[modname] = 1 - yield prefix + modname, False - - iter_importer_modules.register(zipimporter, iter_zipimport_modules) - -except ImportError: - pass - - -def get_importer(path_item): - """Retrieve a PEP 302 importer for the given path item - - The returned importer is cached in sys.path_importer_cache - if it was newly created by a path hook. - - If there is no importer, a wrapper around the basic import - machinery is returned. This wrapper is never inserted into - the importer cache (None is inserted instead). - - The cache (or part of it) can be cleared manually if a - rescan of sys.path_hooks is necessary. - """ - try: - importer = sys.path_importer_cache[path_item] - except KeyError: - for path_hook in sys.path_hooks: - try: - importer = path_hook(path_item) - break - except ImportError: - pass - else: - importer = None - sys.path_importer_cache.setdefault(path_item, importer) - - if importer is None: - try: - importer = ImpImporter(path_item) - except ImportError: - importer = None - return importer - - -def iter_importers(fullname=""): - """Yield PEP 302 importers for the given module name - - If fullname contains a '.', the importers will be for the package - containing fullname, otherwise they will be importers for sys.meta_path, - sys.path, and Python's "classic" import machinery, in that order. If - the named module is in a package, that package is imported as a side - effect of invoking this function. - - Non PEP 302 mechanisms (e.g. the Windows registry) used by the - standard import machinery to find files in alternative locations - are partially supported, but are searched AFTER sys.path. Normally, - these locations are searched BEFORE sys.path, preventing sys.path - entries from shadowing them. - - For this to cause a visible difference in behaviour, there must - be a module or package name that is accessible via both sys.path - and one of the non PEP 302 file system mechanisms. In this case, - the emulation will find the former version, while the builtin - import mechanism will find the latter. - - Items of the following types can be affected by this discrepancy: - imp.C_EXTENSION, imp.PY_SOURCE, imp.PY_COMPILED, imp.PKG_DIRECTORY - """ - if fullname.startswith('.'): - raise ImportError("Relative module names not supported") - if '.' in fullname: - # Get the containing package's __path__ - pkg = '.'.join(fullname.split('.')[:-1]) - if pkg not in sys.modules: - __import__(pkg) - path = getattr(sys.modules[pkg], '__path__', None) or [] - else: - for importer in sys.meta_path: - yield importer - path = sys.path - for item in path: - yield get_importer(item) - if '.' not in fullname: - yield ImpImporter() - -def get_loader(module_or_name): - """Get a PEP 302 "loader" object for module_or_name - - If the module or package is accessible via the normal import - mechanism, a wrapper around the relevant part of that machinery - is returned. Returns None if the module cannot be found or imported. - If the named module is not already imported, its containing package - (if any) is imported, in order to establish the package __path__. - - This function uses iter_importers(), and is thus subject to the same - limitations regarding platform-specific special import locations such - as the Windows registry. - """ - if module_or_name in sys.modules: - module_or_name = sys.modules[module_or_name] - if isinstance(module_or_name, ModuleType): - module = module_or_name - loader = getattr(module, '__loader__', None) - if loader is not None: - return loader - fullname = module.__name__ - else: - fullname = module_or_name - return find_loader(fullname) - -def find_loader(fullname): - """Find a PEP 302 "loader" object for fullname - - If fullname contains dots, path must be the containing package's __path__. - Returns None if the module cannot be found or imported. This function uses - iter_importers(), and is thus subject to the same limitations regarding - platform-specific special import locations such as the Windows registry. - """ - for importer in iter_importers(fullname): - loader = importer.find_module(fullname) - if loader is not None: - return loader - - return None - - -def extend_path(path, name): - """Extend a package's path. - - Intended use is to place the following code in a package's __init__.py: - - from pkgutil import extend_path - __path__ = extend_path(__path__, __name__) - - This will add to the package's __path__ all subdirectories of - directories on sys.path named after the package. This is useful - if one wants to distribute different parts of a single logical - package as multiple directories. - - It also looks for *.pkg files beginning where * matches the name - argument. This feature is similar to *.pth files (see site.py), - except that it doesn't special-case lines starting with 'import'. - A *.pkg file is trusted at face value: apart from checking for - duplicates, all entries found in a *.pkg file are added to the - path, regardless of whether they are exist the filesystem. (This - is a feature.) - - If the input path is not a list (as is the case for frozen - packages) it is returned unchanged. The input path is not - modified; an extended copy is returned. Items are only appended - to the copy at the end. - - It is assumed that sys.path is a sequence. Items of sys.path that - are not (unicode or 8-bit) strings referring to existing - directories are ignored. Unicode items of sys.path that cause - errors when used as filenames may cause this function to raise an - exception (in line with os.path.isdir() behavior). - """ - - if not isinstance(path, list): - # This could happen e.g. when this is called from inside a - # frozen package. Return the path unchanged in that case. - return path - - pname = os.path.join(*name.split('.')) # Reconstitute as relative path - # Just in case os.extsep != '.' - sname = os.extsep.join(name.split('.')) - sname_pkg = sname + os.extsep + "pkg" - init_py = "__init__" + os.extsep + "py" - - path = path[:] # Start with a copy of the existing path - - for dir in sys.path: - if not isinstance(dir, basestring) or not os.path.isdir(dir): - continue - subdir = os.path.join(dir, pname) - # XXX This may still add duplicate entries to path on - # case-insensitive filesystems - initfile = os.path.join(subdir, init_py) - if subdir not in path and os.path.isfile(initfile): - path.append(subdir) - # XXX Is this the right thing for subpackages like zope.app? - # It looks for a file named "zope.app.pkg" - pkgfile = os.path.join(dir, sname_pkg) - if os.path.isfile(pkgfile): - try: - f = open(pkgfile) - except IOError, msg: - sys.stderr.write("Can't open %s: %s\n" % - (pkgfile, msg)) - else: - for line in f: - line = line.rstrip('\n') - if not line or line.startswith('#'): - continue - path.append(line) # Don't check for existence! - f.close() - - return path - -def get_data(package, resource): - """Get a resource from a package. - - This is a wrapper round the PEP 302 loader get_data API. The package - argument should be the name of a package, in standard module format - (foo.bar). The resource argument should be in the form of a relative - filename, using '/' as the path separator. The parent directory name '..' - is not allowed, and nor is a rooted name (starting with a '/'). - - The function returns a binary string, which is the contents of the - specified resource. - - For packages located in the filesystem, which have already been imported, - this is the rough equivalent of - - d = os.path.dirname(sys.modules[package].__file__) - data = open(os.path.join(d, resource), 'rb').read() - - If the package cannot be located or loaded, or it uses a PEP 302 loader - which does not support get_data(), then None is returned. - """ - - loader = get_loader(package) - if loader is None or not hasattr(loader, 'get_data'): - return None - mod = sys.modules.get(package) or loader.load_module(package) - if mod is None or not hasattr(mod, '__file__'): - return None - - # Modify the resource name to be compatible with the loader.get_data - # signature - an os.path format "filename" starting with the dirname of - # the package's __file__ - parts = resource.split('/') - parts.insert(0, os.path.dirname(mod.__file__)) - resource_name = os.path.join(*parts) - return loader.get_data(resource_name) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py deleted file mode 100644 index 8d7f1e7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/platform.py +++ /dev/null @@ -1,1655 +0,0 @@ -#!/usr/bin/env python - -""" This module tries to retrieve as much platform-identifying data as - possible. It makes this information available via function APIs. - - If called from the command line, it prints the platform - information concatenated as single string to stdout. The output - format is useable as part of a filename. - -""" -# This module is maintained by Marc-Andre Lemburg . -# If you find problems, please submit bug reports/patches via the -# Python bug tracker (http://bugs.python.org) and assign them to "lemburg". -# -# Note: Please keep this module compatible to Python 1.5.2. -# -# Still needed: -# * more support for WinCE -# * support for MS-DOS (PythonDX ?) -# * support for Amiga and other still unsupported platforms running Python -# * support for additional Linux distributions -# -# Many thanks to all those who helped adding platform-specific -# checks (in no particular order): -# -# Charles G Waldman, David Arnold, Gordon McMillan, Ben Darnell, -# Jeff Bauer, Cliff Crawford, Ivan Van Laningham, Josef -# Betancourt, Randall Hopper, Karl Putland, John Farrell, Greg -# Andruk, Just van Rossum, Thomas Heller, Mark R. Levinson, Mark -# Hammond, Bill Tutt, Hans Nowak, Uwe Zessin (OpenVMS support), -# Colin Kong, Trent Mick, Guido van Rossum, Anthony Baxter -# -# History: -# -# -# -# 1.0.7 - added DEV_NULL -# 1.0.6 - added linux_distribution() -# 1.0.5 - fixed Java support to allow running the module on Jython -# 1.0.4 - added IronPython support -# 1.0.3 - added normalization of Windows system name -# 1.0.2 - added more Windows support -# 1.0.1 - reformatted to make doc.py happy -# 1.0.0 - reformatted a bit and checked into Python CVS -# 0.8.0 - added sys.version parser and various new access -# APIs (python_version(), python_compiler(), etc.) -# 0.7.2 - fixed architecture() to use sizeof(pointer) where available -# 0.7.1 - added support for Caldera OpenLinux -# 0.7.0 - some fixes for WinCE; untabified the source file -# 0.6.2 - support for OpenVMS - requires version 1.5.2-V006 or higher and -# vms_lib.getsyi() configured -# 0.6.1 - added code to prevent 'uname -p' on platforms which are -# known not to support it -# 0.6.0 - fixed win32_ver() to hopefully work on Win95,98,NT and Win2k; -# did some cleanup of the interfaces - some APIs have changed -# 0.5.5 - fixed another type in the MacOS code... should have -# used more coffee today ;-) -# 0.5.4 - fixed a few typos in the MacOS code -# 0.5.3 - added experimental MacOS support; added better popen() -# workarounds in _syscmd_ver() -- still not 100% elegant -# though -# 0.5.2 - fixed uname() to return '' instead of 'unknown' in all -# return values (the system uname command tends to return -# 'unknown' instead of just leaving the field emtpy) -# 0.5.1 - included code for slackware dist; added exception handlers -# to cover up situations where platforms don't have os.popen -# (e.g. Mac) or fail on socket.gethostname(); fixed libc -# detection RE -# 0.5.0 - changed the API names referring to system commands to *syscmd*; -# added java_ver(); made syscmd_ver() a private -# API (was system_ver() in previous versions) -- use uname() -# instead; extended the win32_ver() to also return processor -# type information -# 0.4.0 - added win32_ver() and modified the platform() output for WinXX -# 0.3.4 - fixed a bug in _follow_symlinks() -# 0.3.3 - fixed popen() and "file" command invokation bugs -# 0.3.2 - added architecture() API and support for it in platform() -# 0.3.1 - fixed syscmd_ver() RE to support Windows NT -# 0.3.0 - added system alias support -# 0.2.3 - removed 'wince' again... oh well. -# 0.2.2 - added 'wince' to syscmd_ver() supported platforms -# 0.2.1 - added cache logic and changed the platform string format -# 0.2.0 - changed the API to use functions instead of module globals -# since some action take too long to be run on module import -# 0.1.0 - first release -# -# You can always get the latest version of this module at: -# -# http://www.egenix.com/files/python/platform.py -# -# If that URL should fail, try contacting the author. - -__copyright__ = """ - Copyright (c) 1999-2000, Marc-Andre Lemburg; mailto:mal@lemburg.com - Copyright (c) 2000-2010, eGenix.com Software GmbH; mailto:info@egenix.com - - Permission to use, copy, modify, and distribute this software and its - documentation for any purpose and without fee or royalty is hereby granted, - provided that the above copyright notice appear in all copies and that - both that copyright notice and this permission notice appear in - supporting documentation or portions thereof, including modifications, - that you make. - - EGENIX.COM SOFTWARE GMBH DISCLAIMS ALL WARRANTIES WITH REGARD TO - THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - FITNESS, IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, - INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING - FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, - NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION - WITH THE USE OR PERFORMANCE OF THIS SOFTWARE ! - -""" - -__version__ = '1.0.7' - -import sys,string,os,re - -### Globals & Constants - -# Determine the platform's /dev/null device -try: - DEV_NULL = os.devnull -except AttributeError: - # os.devnull was added in Python 2.4, so emulate it for earlier - # Python versions - if sys.platform in ('dos','win32','win16','os2'): - # Use the old CP/M NUL as device name - DEV_NULL = 'NUL' - else: - # Standard Unix uses /dev/null - DEV_NULL = '/dev/null' - -### Platform specific APIs - -_libc_search = re.compile(r'(__libc_init)' - '|' - '(GLIBC_([0-9.]+))' - '|' - '(libc(_\w+)?\.so(?:\.(\d[0-9.]*))?)') - -def libc_ver(executable=sys.executable,lib='',version='', - - chunksize=2048): - - """ Tries to determine the libc version that the file executable - (which defaults to the Python interpreter) is linked against. - - Returns a tuple of strings (lib,version) which default to the - given parameters in case the lookup fails. - - Note that the function has intimate knowledge of how different - libc versions add symbols to the executable and thus is probably - only useable for executables compiled using gcc. - - The file is read and scanned in chunks of chunksize bytes. - - """ - if hasattr(os.path, 'realpath'): - # Python 2.2 introduced os.path.realpath(); it is used - # here to work around problems with Cygwin not being - # able to open symlinks for reading - executable = os.path.realpath(executable) - f = open(executable,'rb') - binary = f.read(chunksize) - pos = 0 - while 1: - m = _libc_search.search(binary,pos) - if not m: - binary = f.read(chunksize) - if not binary: - break - pos = 0 - continue - libcinit,glibc,glibcversion,so,threads,soversion = m.groups() - if libcinit and not lib: - lib = 'libc' - elif glibc: - if lib != 'glibc': - lib = 'glibc' - version = glibcversion - elif glibcversion > version: - version = glibcversion - elif so: - if lib != 'glibc': - lib = 'libc' - if soversion and soversion > version: - version = soversion - if threads and version[-len(threads):] != threads: - version = version + threads - pos = m.end() - f.close() - return lib,version - -def _dist_try_harder(distname,version,id): - - """ Tries some special tricks to get the distribution - information in case the default method fails. - - Currently supports older SuSE Linux, Caldera OpenLinux and - Slackware Linux distributions. - - """ - if os.path.exists('/var/adm/inst-log/info'): - # SuSE Linux stores distribution information in that file - info = open('/var/adm/inst-log/info').readlines() - distname = 'SuSE' - for line in info: - tv = string.split(line) - if len(tv) == 2: - tag,value = tv - else: - continue - if tag == 'MIN_DIST_VERSION': - version = string.strip(value) - elif tag == 'DIST_IDENT': - values = string.split(value,'-') - id = values[2] - return distname,version,id - - if os.path.exists('/etc/.installed'): - # Caldera OpenLinux has some infos in that file (thanks to Colin Kong) - info = open('/etc/.installed').readlines() - for line in info: - pkg = string.split(line,'-') - if len(pkg) >= 2 and pkg[0] == 'OpenLinux': - # XXX does Caldera support non Intel platforms ? If yes, - # where can we find the needed id ? - return 'OpenLinux',pkg[1],id - - if os.path.isdir('/usr/lib/setup'): - # Check for slackware version tag file (thanks to Greg Andruk) - verfiles = os.listdir('/usr/lib/setup') - for n in range(len(verfiles)-1, -1, -1): - if verfiles[n][:14] != 'slack-version-': - del verfiles[n] - if verfiles: - verfiles.sort() - distname = 'slackware' - version = verfiles[-1][14:] - return distname,version,id - - return distname,version,id - -_release_filename = re.compile(r'(\w+)[-_](release|version)') -_lsb_release_version = re.compile(r'(.+)' - ' release ' - '([\d.]+)' - '[^(]*(?:\((.+)\))?') -_release_version = re.compile(r'([^0-9]+)' - '(?: release )?' - '([\d.]+)' - '[^(]*(?:\((.+)\))?') - -# See also http://www.novell.com/coolsolutions/feature/11251.html -# and http://linuxmafia.com/faq/Admin/release-files.html -# and http://data.linux-ntfs.org/rpm/whichrpm -# and http://www.die.net/doc/linux/man/man1/lsb_release.1.html - -_supported_dists = ( - 'SuSE', 'debian', 'fedora', 'redhat', 'centos', - 'mandrake', 'mandriva', 'rocks', 'slackware', 'yellowdog', 'gentoo', - 'UnitedLinux', 'turbolinux') - -def _parse_release_file(firstline): - - # Default to empty 'version' and 'id' strings. Both defaults are used - # when 'firstline' is empty. 'id' defaults to empty when an id can not - # be deduced. - version = '' - id = '' - - # Parse the first line - m = _lsb_release_version.match(firstline) - if m is not None: - # LSB format: "distro release x.x (codename)" - return tuple(m.groups()) - - # Pre-LSB format: "distro x.x (codename)" - m = _release_version.match(firstline) - if m is not None: - return tuple(m.groups()) - - # Unknown format... take the first two words - l = string.split(string.strip(firstline)) - if l: - version = l[0] - if len(l) > 1: - id = l[1] - return '', version, id - -def linux_distribution(distname='', version='', id='', - - supported_dists=_supported_dists, - full_distribution_name=1): - - """ Tries to determine the name of the Linux OS distribution name. - - The function first looks for a distribution release file in - /etc and then reverts to _dist_try_harder() in case no - suitable files are found. - - supported_dists may be given to define the set of Linux - distributions to look for. It defaults to a list of currently - supported Linux distributions identified by their release file - name. - - If full_distribution_name is true (default), the full - distribution read from the OS is returned. Otherwise the short - name taken from supported_dists is used. - - Returns a tuple (distname,version,id) which default to the - args given as parameters. - - """ - try: - etc = os.listdir('/etc') - except os.error: - # Probably not a Unix system - return distname,version,id - etc.sort() - for file in etc: - m = _release_filename.match(file) - if m is not None: - _distname,dummy = m.groups() - if _distname in supported_dists: - distname = _distname - break - else: - return _dist_try_harder(distname,version,id) - - # Read the first line - f = open('/etc/'+file, 'r') - firstline = f.readline() - f.close() - _distname, _version, _id = _parse_release_file(firstline) - - if _distname and full_distribution_name: - distname = _distname - if _version: - version = _version - if _id: - id = _id - return distname, version, id - -# To maintain backwards compatibility: - -def dist(distname='',version='',id='', - - supported_dists=_supported_dists): - - """ Tries to determine the name of the Linux OS distribution name. - - The function first looks for a distribution release file in - /etc and then reverts to _dist_try_harder() in case no - suitable files are found. - - Returns a tuple (distname,version,id) which default to the - args given as parameters. - - """ - return linux_distribution(distname, version, id, - supported_dists=supported_dists, - full_distribution_name=0) - -class _popen: - - """ Fairly portable (alternative) popen implementation. - - This is mostly needed in case os.popen() is not available, or - doesn't work as advertised, e.g. in Win9X GUI programs like - PythonWin or IDLE. - - Writing to the pipe is currently not supported. - - """ - tmpfile = '' - pipe = None - bufsize = None - mode = 'r' - - def __init__(self,cmd,mode='r',bufsize=None): - - if mode != 'r': - raise ValueError,'popen()-emulation only supports read mode' - import tempfile - self.tmpfile = tmpfile = tempfile.mktemp() - os.system(cmd + ' > %s' % tmpfile) - self.pipe = open(tmpfile,'rb') - self.bufsize = bufsize - self.mode = mode - - def read(self): - - return self.pipe.read() - - def readlines(self): - - if self.bufsize is not None: - return self.pipe.readlines() - - def close(self, - - remove=os.unlink,error=os.error): - - if self.pipe: - rc = self.pipe.close() - else: - rc = 255 - if self.tmpfile: - try: - remove(self.tmpfile) - except error: - pass - return rc - - # Alias - __del__ = close - -def popen(cmd, mode='r', bufsize=None): - - """ Portable popen() interface. - """ - # Find a working popen implementation preferring win32pipe.popen - # over os.popen over _popen - popen = None - if os.environ.get('OS','') == 'Windows_NT': - # On NT win32pipe should work; on Win9x it hangs due to bugs - # in the MS C lib (see MS KnowledgeBase article Q150956) - try: - import win32pipe - except ImportError: - pass - else: - popen = win32pipe.popen - if popen is None: - if hasattr(os,'popen'): - popen = os.popen - # Check whether it works... it doesn't in GUI programs - # on Windows platforms - if sys.platform == 'win32': # XXX Others too ? - try: - popen('') - except os.error: - popen = _popen - else: - popen = _popen - if bufsize is None: - return popen(cmd,mode) - else: - return popen(cmd,mode,bufsize) - -def _norm_version(version, build=''): - - """ Normalize the version and build strings and return a single - version string using the format major.minor.build (or patchlevel). - """ - l = string.split(version,'.') - if build: - l.append(build) - try: - ints = map(int,l) - except ValueError: - strings = l - else: - strings = map(str,ints) - version = string.join(strings[:3],'.') - return version - -_ver_output = re.compile(r'(?:([\w ]+) ([\w.]+) ' - '.*' - '\[.* ([\d.]+)\])') - -# Examples of VER command output: -# -# Windows 2000: Microsoft Windows 2000 [Version 5.00.2195] -# Windows XP: Microsoft Windows XP [Version 5.1.2600] -# Windows Vista: Microsoft Windows [Version 6.0.6002] -# -# Note that the "Version" string gets localized on different -# Windows versions. - -def _syscmd_ver(system='', release='', version='', - - supported_platforms=('win32','win16','dos','os2')): - - """ Tries to figure out the OS version used and returns - a tuple (system,release,version). - - It uses the "ver" shell command for this which is known - to exists on Windows, DOS and OS/2. XXX Others too ? - - In case this fails, the given parameters are used as - defaults. - - """ - if sys.platform not in supported_platforms: - return system,release,version - - # Try some common cmd strings - for cmd in ('ver','command /c ver','cmd /c ver'): - try: - pipe = popen(cmd) - info = pipe.read() - if pipe.close(): - raise os.error,'command failed' - # XXX How can I suppress shell errors from being written - # to stderr ? - except os.error,why: - #print 'Command %s failed: %s' % (cmd,why) - continue - except IOError,why: - #print 'Command %s failed: %s' % (cmd,why) - continue - else: - break - else: - return system,release,version - - # Parse the output - info = string.strip(info) - m = _ver_output.match(info) - if m is not None: - system,release,version = m.groups() - # Strip trailing dots from version and release - if release[-1] == '.': - release = release[:-1] - if version[-1] == '.': - version = version[:-1] - # Normalize the version and build strings (eliminating additional - # zeros) - version = _norm_version(version) - return system,release,version - -def _win32_getvalue(key,name,default=''): - - """ Read a value for name from the registry key. - - In case this fails, default is returned. - - """ - try: - # Use win32api if available - from win32api import RegQueryValueEx - except ImportError: - # On Python 2.0 and later, emulate using _winreg - import _winreg - RegQueryValueEx = _winreg.QueryValueEx - try: - return RegQueryValueEx(key,name) - except: - return default - -def win32_ver(release='',version='',csd='',ptype=''): - - """ Get additional version information from the Windows Registry - and return a tuple (version,csd,ptype) referring to version - number, CSD level (service pack), and OS type (multi/single - processor). - - As a hint: ptype returns 'Uniprocessor Free' on single - processor NT machines and 'Multiprocessor Free' on multi - processor machines. The 'Free' refers to the OS version being - free of debugging code. It could also state 'Checked' which - means the OS version uses debugging code, i.e. code that - checks arguments, ranges, etc. (Thomas Heller). - - Note: this function works best with Mark Hammond's win32 - package installed, but also on Python 2.3 and later. It - obviously only runs on Win32 compatible platforms. - - """ - # XXX Is there any way to find out the processor type on WinXX ? - # XXX Is win32 available on Windows CE ? - # - # Adapted from code posted by Karl Putland to comp.lang.python. - # - # The mappings between reg. values and release names can be found - # here: http://msdn.microsoft.com/library/en-us/sysinfo/base/osversioninfo_str.asp - - # Import the needed APIs - try: - import win32api - from win32api import RegQueryValueEx, RegOpenKeyEx, \ - RegCloseKey, GetVersionEx - from win32con import HKEY_LOCAL_MACHINE, VER_PLATFORM_WIN32_NT, \ - VER_PLATFORM_WIN32_WINDOWS, VER_NT_WORKSTATION - except ImportError: - # Emulate the win32api module using Python APIs - try: - sys.getwindowsversion - except AttributeError: - # No emulation possible, so return the defaults... - return release,version,csd,ptype - else: - # Emulation using _winreg (added in Python 2.0) and - # sys.getwindowsversion() (added in Python 2.3) - import _winreg - GetVersionEx = sys.getwindowsversion - RegQueryValueEx = _winreg.QueryValueEx - RegOpenKeyEx = _winreg.OpenKeyEx - RegCloseKey = _winreg.CloseKey - HKEY_LOCAL_MACHINE = _winreg.HKEY_LOCAL_MACHINE - VER_PLATFORM_WIN32_WINDOWS = 1 - VER_PLATFORM_WIN32_NT = 2 - VER_NT_WORKSTATION = 1 - VER_NT_SERVER = 3 - REG_SZ = 1 - - # Find out the registry key and some general version infos - winver = GetVersionEx() - maj,min,buildno,plat,csd = winver - version = '%i.%i.%i' % (maj,min,buildno & 0xFFFF) - if hasattr(winver, "service_pack"): - if winver.service_pack != "": - csd = 'SP%s' % winver.service_pack_major - else: - if csd[:13] == 'Service Pack ': - csd = 'SP' + csd[13:] - - if plat == VER_PLATFORM_WIN32_WINDOWS: - regkey = 'SOFTWARE\\Microsoft\\Windows\\CurrentVersion' - # Try to guess the release name - if maj == 4: - if min == 0: - release = '95' - elif min == 10: - release = '98' - elif min == 90: - release = 'Me' - else: - release = 'postMe' - elif maj == 5: - release = '2000' - - elif plat == VER_PLATFORM_WIN32_NT: - regkey = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion' - if maj <= 4: - release = 'NT' - elif maj == 5: - if min == 0: - release = '2000' - elif min == 1: - release = 'XP' - elif min == 2: - release = '2003Server' - else: - release = 'post2003' - elif maj == 6: - if hasattr(winver, "product_type"): - product_type = winver.product_type - else: - product_type = VER_NT_WORKSTATION - # Without an OSVERSIONINFOEX capable sys.getwindowsversion(), - # or help from the registry, we cannot properly identify - # non-workstation versions. - try: - key = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey) - name, type = RegQueryValueEx(key, "ProductName") - # Discard any type that isn't REG_SZ - if type == REG_SZ and name.find("Server") != -1: - product_type = VER_NT_SERVER - except WindowsError: - # Use default of VER_NT_WORKSTATION - pass - - if min == 0: - if product_type == VER_NT_WORKSTATION: - release = 'Vista' - else: - release = '2008Server' - elif min == 1: - if product_type == VER_NT_WORKSTATION: - release = '7' - else: - release = '2008ServerR2' - elif min == 2: - if product_type == VER_NT_WORKSTATION: - release = '8' - else: - release = '2012Server' - else: - release = 'post2012Server' - - else: - if not release: - # E.g. Win3.1 with win32s - release = '%i.%i' % (maj,min) - return release,version,csd,ptype - - # Open the registry key - try: - keyCurVer = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey) - # Get a value to make sure the key exists... - RegQueryValueEx(keyCurVer, 'SystemRoot') - except: - return release,version,csd,ptype - - # Parse values - #subversion = _win32_getvalue(keyCurVer, - # 'SubVersionNumber', - # ('',1))[0] - #if subversion: - # release = release + subversion # 95a, 95b, etc. - build = _win32_getvalue(keyCurVer, - 'CurrentBuildNumber', - ('',1))[0] - ptype = _win32_getvalue(keyCurVer, - 'CurrentType', - (ptype,1))[0] - - # Normalize version - version = _norm_version(version,build) - - # Close key - RegCloseKey(keyCurVer) - return release,version,csd,ptype - -def _mac_ver_lookup(selectors,default=None): - - from gestalt import gestalt - import MacOS - l = [] - append = l.append - for selector in selectors: - try: - append(gestalt(selector)) - except (RuntimeError, MacOS.Error): - append(default) - return l - -def _bcd2str(bcd): - - return hex(bcd)[2:] - -def _mac_ver_gestalt(): - """ - Thanks to Mark R. Levinson for mailing documentation links and - code examples for this function. Documentation for the - gestalt() API is available online at: - - http://www.rgaros.nl/gestalt/ - """ - # Check whether the version info module is available - try: - import gestalt - import MacOS - except ImportError: - return None - # Get the infos - sysv,sysa = _mac_ver_lookup(('sysv','sysa')) - # Decode the infos - if sysv: - major = (sysv & 0xFF00) >> 8 - minor = (sysv & 0x00F0) >> 4 - patch = (sysv & 0x000F) - - if (major, minor) >= (10, 4): - # the 'sysv' gestald cannot return patchlevels - # higher than 9. Apple introduced 3 new - # gestalt codes in 10.4 to deal with this - # issue (needed because patch levels can - # run higher than 9, such as 10.4.11) - major,minor,patch = _mac_ver_lookup(('sys1','sys2','sys3')) - release = '%i.%i.%i' %(major, minor, patch) - else: - release = '%s.%i.%i' % (_bcd2str(major),minor,patch) - - if sysa: - machine = {0x1: '68k', - 0x2: 'PowerPC', - 0xa: 'i386'}.get(sysa,'') - - versioninfo=('', '', '') - return release,versioninfo,machine - -def _mac_ver_xml(): - fn = '/System/Library/CoreServices/SystemVersion.plist' - if not os.path.exists(fn): - return None - - try: - import plistlib - except ImportError: - return None - - pl = plistlib.readPlist(fn) - release = pl['ProductVersion'] - versioninfo=('', '', '') - machine = os.uname()[4] - if machine in ('ppc', 'Power Macintosh'): - # for compatibility with the gestalt based code - machine = 'PowerPC' - - return release,versioninfo,machine - - -def mac_ver(release='',versioninfo=('','',''),machine=''): - - """ Get MacOS version information and return it as tuple (release, - versioninfo, machine) with versioninfo being a tuple (version, - dev_stage, non_release_version). - - Entries which cannot be determined are set to the parameter values - which default to ''. All tuple entries are strings. - """ - - # First try reading the information from an XML file which should - # always be present - info = _mac_ver_xml() - if info is not None: - return info - - # If that doesn't work for some reason fall back to reading the - # information using gestalt calls. - info = _mac_ver_gestalt() - if info is not None: - return info - - # If that also doesn't work return the default values - return release,versioninfo,machine - -def _java_getprop(name,default): - - from java.lang import System - try: - value = System.getProperty(name) - if value is None: - return default - return value - except AttributeError: - return default - -def java_ver(release='',vendor='',vminfo=('','',''),osinfo=('','','')): - - """ Version interface for Jython. - - Returns a tuple (release,vendor,vminfo,osinfo) with vminfo being - a tuple (vm_name,vm_release,vm_vendor) and osinfo being a - tuple (os_name,os_version,os_arch). - - Values which cannot be determined are set to the defaults - given as parameters (which all default to ''). - - """ - # Import the needed APIs - try: - import java.lang - except ImportError: - return release,vendor,vminfo,osinfo - - vendor = _java_getprop('java.vendor', vendor) - release = _java_getprop('java.version', release) - vm_name, vm_release, vm_vendor = vminfo - vm_name = _java_getprop('java.vm.name', vm_name) - vm_vendor = _java_getprop('java.vm.vendor', vm_vendor) - vm_release = _java_getprop('java.vm.version', vm_release) - vminfo = vm_name, vm_release, vm_vendor - os_name, os_version, os_arch = osinfo - os_arch = _java_getprop('java.os.arch', os_arch) - os_name = _java_getprop('java.os.name', os_name) - os_version = _java_getprop('java.os.version', os_version) - osinfo = os_name, os_version, os_arch - - return release, vendor, vminfo, osinfo - -### System name aliasing - -def system_alias(system,release,version): - - """ Returns (system,release,version) aliased to common - marketing names used for some systems. - - It also does some reordering of the information in some cases - where it would otherwise cause confusion. - - """ - if system == 'Rhapsody': - # Apple's BSD derivative - # XXX How can we determine the marketing release number ? - return 'MacOS X Server',system+release,version - - elif system == 'SunOS': - # Sun's OS - if release < '5': - # These releases use the old name SunOS - return system,release,version - # Modify release (marketing release = SunOS release - 3) - l = string.split(release,'.') - if l: - try: - major = int(l[0]) - except ValueError: - pass - else: - major = major - 3 - l[0] = str(major) - release = string.join(l,'.') - if release < '6': - system = 'Solaris' - else: - # XXX Whatever the new SunOS marketing name is... - system = 'Solaris' - - elif system == 'IRIX64': - # IRIX reports IRIX64 on platforms with 64-bit support; yet it - # is really a version and not a different platform, since 32-bit - # apps are also supported.. - system = 'IRIX' - if version: - version = version + ' (64bit)' - else: - version = '64bit' - - elif system in ('win32','win16'): - # In case one of the other tricks - system = 'Windows' - - return system,release,version - -### Various internal helpers - -def _platform(*args): - - """ Helper to format the platform string in a filename - compatible format e.g. "system-version-machine". - """ - # Format the platform string - platform = string.join( - map(string.strip, - filter(len, args)), - '-') - - # Cleanup some possible filename obstacles... - replace = string.replace - platform = replace(platform,' ','_') - platform = replace(platform,'/','-') - platform = replace(platform,'\\','-') - platform = replace(platform,':','-') - platform = replace(platform,';','-') - platform = replace(platform,'"','-') - platform = replace(platform,'(','-') - platform = replace(platform,')','-') - - # No need to report 'unknown' information... - platform = replace(platform,'unknown','') - - # Fold '--'s and remove trailing '-' - while 1: - cleaned = replace(platform,'--','-') - if cleaned == platform: - break - platform = cleaned - while platform[-1] == '-': - platform = platform[:-1] - - return platform - -def _node(default=''): - - """ Helper to determine the node name of this machine. - """ - try: - import socket - except ImportError: - # No sockets... - return default - try: - return socket.gethostname() - except socket.error: - # Still not working... - return default - -# os.path.abspath is new in Python 1.5.2: -if not hasattr(os.path,'abspath'): - - def _abspath(path, - - isabs=os.path.isabs,join=os.path.join,getcwd=os.getcwd, - normpath=os.path.normpath): - - if not isabs(path): - path = join(getcwd(), path) - return normpath(path) - -else: - - _abspath = os.path.abspath - -def _follow_symlinks(filepath): - - """ In case filepath is a symlink, follow it until a - real file is reached. - """ - filepath = _abspath(filepath) - while os.path.islink(filepath): - filepath = os.path.normpath( - os.path.join(os.path.dirname(filepath),os.readlink(filepath))) - return filepath - -def _syscmd_uname(option,default=''): - - """ Interface to the system's uname command. - """ - if sys.platform in ('dos','win32','win16','os2'): - # XXX Others too ? - return default - try: - f = os.popen('uname %s 2> %s' % (option, DEV_NULL)) - except (AttributeError,os.error): - return default - output = string.strip(f.read()) - rc = f.close() - if not output or rc: - return default - else: - return output - -def _syscmd_file(target,default=''): - - """ Interface to the system's file command. - - The function uses the -b option of the file command to have it - ommit the filename in its output and if possible the -L option - to have the command follow symlinks. It returns default in - case the command should fail. - - """ - - # We do the import here to avoid a bootstrap issue. - # See c73b90b6dadd changeset. - # - # [..] - # ranlib libpython2.7.a - # gcc -o python \ - # Modules/python.o \ - # libpython2.7.a -lsocket -lnsl -ldl -lm - # Traceback (most recent call last): - # File "./setup.py", line 8, in - # from platform import machine as platform_machine - # File "[..]/build/Lib/platform.py", line 116, in - # import sys,string,os,re,subprocess - # File "[..]/build/Lib/subprocess.py", line 429, in - # import select - # ImportError: No module named select - - import subprocess - - if sys.platform in ('dos','win32','win16','os2'): - # XXX Others too ? - return default - target = _follow_symlinks(target) - try: - proc = subprocess.Popen(['file', target], - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - - except (AttributeError,os.error): - return default - output = proc.communicate()[0] - rc = proc.wait() - if not output or rc: - return default - else: - return output - -### Information about the used architecture - -# Default values for architecture; non-empty strings override the -# defaults given as parameters -_default_architecture = { - 'win32': ('','WindowsPE'), - 'win16': ('','Windows'), - 'dos': ('','MSDOS'), -} - -_architecture_split = re.compile(r'[\s,]').split - -def architecture(executable=sys.executable,bits='',linkage=''): - - """ Queries the given executable (defaults to the Python interpreter - binary) for various architecture information. - - Returns a tuple (bits,linkage) which contains information about - the bit architecture and the linkage format used for the - executable. Both values are returned as strings. - - Values that cannot be determined are returned as given by the - parameter presets. If bits is given as '', the sizeof(pointer) - (or sizeof(long) on Python version < 1.5.2) is used as - indicator for the supported pointer size. - - The function relies on the system's "file" command to do the - actual work. This is available on most if not all Unix - platforms. On some non-Unix platforms where the "file" command - does not exist and the executable is set to the Python interpreter - binary defaults from _default_architecture are used. - - """ - # Use the sizeof(pointer) as default number of bits if nothing - # else is given as default. - if not bits: - import struct - try: - size = struct.calcsize('P') - except struct.error: - # Older installations can only query longs - size = struct.calcsize('l') - bits = str(size*8) + 'bit' - - # Get data from the 'file' system command - if executable: - output = _syscmd_file(executable, '') - else: - output = '' - - if not output and \ - executable == sys.executable: - # "file" command did not return anything; we'll try to provide - # some sensible defaults then... - if sys.platform in _default_architecture: - b, l = _default_architecture[sys.platform] - if b: - bits = b - if l: - linkage = l - return bits, linkage - - # Split the output into a list of strings omitting the filename - fileout = _architecture_split(output)[1:] - - if 'executable' not in fileout: - # Format not supported - return bits,linkage - - # Bits - if '32-bit' in fileout: - bits = '32bit' - elif 'N32' in fileout: - # On Irix only - bits = 'n32bit' - elif '64-bit' in fileout: - bits = '64bit' - - # Linkage - if 'ELF' in fileout: - linkage = 'ELF' - elif 'PE' in fileout: - # E.g. Windows uses this format - if 'Windows' in fileout: - linkage = 'WindowsPE' - else: - linkage = 'PE' - elif 'COFF' in fileout: - linkage = 'COFF' - elif 'MS-DOS' in fileout: - linkage = 'MSDOS' - else: - # XXX the A.OUT format also falls under this class... - pass - - return bits,linkage - -### Portable uname() interface - -_uname_cache = None - -def uname(): - - """ Fairly portable uname interface. Returns a tuple - of strings (system,node,release,version,machine,processor) - identifying the underlying platform. - - Note that unlike the os.uname function this also returns - possible processor information as an additional tuple entry. - - Entries which cannot be determined are set to ''. - - """ - global _uname_cache - no_os_uname = 0 - - if _uname_cache is not None: - return _uname_cache - - processor = '' - - # Get some infos from the builtin os.uname API... - try: - system,node,release,version,machine = os.uname() - except AttributeError: - no_os_uname = 1 - - if no_os_uname or not filter(None, (system, node, release, version, machine)): - # Hmm, no there is either no uname or uname has returned - #'unknowns'... we'll have to poke around the system then. - if no_os_uname: - system = sys.platform - release = '' - version = '' - node = _node() - machine = '' - - use_syscmd_ver = 1 - - # Try win32_ver() on win32 platforms - if system == 'win32': - release,version,csd,ptype = win32_ver() - if release and version: - use_syscmd_ver = 0 - # Try to use the PROCESSOR_* environment variables - # available on Win XP and later; see - # http://support.microsoft.com/kb/888731 and - # http://www.geocities.com/rick_lively/MANUALS/ENV/MSWIN/PROCESSI.HTM - if not machine: - # WOW64 processes mask the native architecture - if "PROCESSOR_ARCHITEW6432" in os.environ: - machine = os.environ.get("PROCESSOR_ARCHITEW6432", '') - else: - machine = os.environ.get('PROCESSOR_ARCHITECTURE', '') - if not processor: - processor = os.environ.get('PROCESSOR_IDENTIFIER', machine) - - # Try the 'ver' system command available on some - # platforms - if use_syscmd_ver: - system,release,version = _syscmd_ver(system) - # Normalize system to what win32_ver() normally returns - # (_syscmd_ver() tends to return the vendor name as well) - if system == 'Microsoft Windows': - system = 'Windows' - elif system == 'Microsoft' and release == 'Windows': - # Under Windows Vista and Windows Server 2008, - # Microsoft changed the output of the ver command. The - # release is no longer printed. This causes the - # system and release to be misidentified. - system = 'Windows' - if '6.0' == version[:3]: - release = 'Vista' - else: - release = '' - - # In case we still don't know anything useful, we'll try to - # help ourselves - if system in ('win32','win16'): - if not version: - if system == 'win32': - version = '32bit' - else: - version = '16bit' - system = 'Windows' - - elif system[:4] == 'java': - release,vendor,vminfo,osinfo = java_ver() - system = 'Java' - version = string.join(vminfo,', ') - if not version: - version = vendor - - # System specific extensions - if system == 'OpenVMS': - # OpenVMS seems to have release and version mixed up - if not release or release == '0': - release = version - version = '' - # Get processor information - try: - import vms_lib - except ImportError: - pass - else: - csid, cpu_number = vms_lib.getsyi('SYI$_CPU',0) - if (cpu_number >= 128): - processor = 'Alpha' - else: - processor = 'VAX' - if not processor: - # Get processor information from the uname system command - processor = _syscmd_uname('-p','') - - #If any unknowns still exist, replace them with ''s, which are more portable - if system == 'unknown': - system = '' - if node == 'unknown': - node = '' - if release == 'unknown': - release = '' - if version == 'unknown': - version = '' - if machine == 'unknown': - machine = '' - if processor == 'unknown': - processor = '' - - # normalize name - if system == 'Microsoft' and release == 'Windows': - system = 'Windows' - release = 'Vista' - - _uname_cache = system,node,release,version,machine,processor - return _uname_cache - -### Direct interfaces to some of the uname() return values - -def system(): - - """ Returns the system/OS name, e.g. 'Linux', 'Windows' or 'Java'. - - An empty string is returned if the value cannot be determined. - - """ - return uname()[0] - -def node(): - - """ Returns the computer's network name (which may not be fully - qualified) - - An empty string is returned if the value cannot be determined. - - """ - return uname()[1] - -def release(): - - """ Returns the system's release, e.g. '2.2.0' or 'NT' - - An empty string is returned if the value cannot be determined. - - """ - return uname()[2] - -def version(): - - """ Returns the system's release version, e.g. '#3 on degas' - - An empty string is returned if the value cannot be determined. - - """ - return uname()[3] - -def machine(): - - """ Returns the machine type, e.g. 'i386' - - An empty string is returned if the value cannot be determined. - - """ - return uname()[4] - -def processor(): - - """ Returns the (true) processor name, e.g. 'amdk6' - - An empty string is returned if the value cannot be - determined. Note that many platforms do not provide this - information or simply return the same value as for machine(), - e.g. NetBSD does this. - - """ - return uname()[5] - -### Various APIs for extracting information from sys.version - -_sys_version_parser = re.compile( - r'([\w.+]+)\s*' - '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' - '\[([^\]]+)\]?') - -_ironpython_sys_version_parser = re.compile( - r'IronPython\s*' - '([\d\.]+)' - '(?: \(([\d\.]+)\))?' - ' on (.NET [\d\.]+)') - -# IronPython covering 2.6 and 2.7 -_ironpython26_sys_version_parser = re.compile( - r'([\d.]+)\s*' - '\(IronPython\s*' - '[\d.]+\s*' - '\(([\d.]+)\) on ([\w.]+ [\d.]+(?: \(\d+-bit\))?)\)' -) - -_pypy_sys_version_parser = re.compile( - r'([\w.+]+)\s*' - '\(#?([^,]+),\s*([\w ]+),\s*([\w :]+)\)\s*' - '\[PyPy [^\]]+\]?') - -_sys_version_cache = {} - -def _sys_version(sys_version=None): - - """ Returns a parsed version of Python's sys.version as tuple - (name, version, branch, revision, buildno, builddate, compiler) - referring to the Python implementation name, version, branch, - revision, build number, build date/time as string and the compiler - identification string. - - Note that unlike the Python sys.version, the returned value - for the Python version will always include the patchlevel (it - defaults to '.0'). - - The function returns empty strings for tuple entries that - cannot be determined. - - sys_version may be given to parse an alternative version - string, e.g. if the version was read from a different Python - interpreter. - - """ - # Get the Python version - if sys_version is None: - sys_version = sys.version - - # Try the cache first - result = _sys_version_cache.get(sys_version, None) - if result is not None: - return result - - # Parse it - if 'IronPython' in sys_version: - # IronPython - name = 'IronPython' - if sys_version.startswith('IronPython'): - match = _ironpython_sys_version_parser.match(sys_version) - else: - match = _ironpython26_sys_version_parser.match(sys_version) - - if match is None: - raise ValueError( - 'failed to parse IronPython sys.version: %s' % - repr(sys_version)) - - version, alt_version, compiler = match.groups() - buildno = '' - builddate = '' - - elif sys.platform.startswith('java'): - # Jython - name = 'Jython' - match = _sys_version_parser.match(sys_version) - if match is None: - raise ValueError( - 'failed to parse Jython sys.version: %s' % - repr(sys_version)) - version, buildno, builddate, buildtime, _ = match.groups() - compiler = sys.platform - - elif "PyPy" in sys_version: - # PyPy - name = "PyPy" - match = _pypy_sys_version_parser.match(sys_version) - if match is None: - raise ValueError("failed to parse PyPy sys.version: %s" % - repr(sys_version)) - version, buildno, builddate, buildtime = match.groups() - compiler = "" - - else: - # CPython - match = _sys_version_parser.match(sys_version) - if match is None: - raise ValueError( - 'failed to parse CPython sys.version: %s' % - repr(sys_version)) - version, buildno, builddate, buildtime, compiler = \ - match.groups() - name = 'CPython' - builddate = builddate + ' ' + buildtime - - if hasattr(sys, 'subversion'): - # sys.subversion was added in Python 2.5 - _, branch, revision = sys.subversion - else: - branch = '' - revision = '' - - # Add the patchlevel version if missing - l = string.split(version, '.') - if len(l) == 2: - l.append('0') - version = string.join(l, '.') - - # Build and cache the result - result = (name, version, branch, revision, buildno, builddate, compiler) - _sys_version_cache[sys_version] = result - return result - -def python_implementation(): - - """ Returns a string identifying the Python implementation. - - Currently, the following implementations are identified: - 'CPython' (C implementation of Python), - 'IronPython' (.NET implementation of Python), - 'Jython' (Java implementation of Python), - 'PyPy' (Python implementation of Python). - - """ - return _sys_version()[0] - -def python_version(): - - """ Returns the Python version as string 'major.minor.patchlevel' - - Note that unlike the Python sys.version, the returned value - will always include the patchlevel (it defaults to 0). - - """ - return _sys_version()[1] - -def python_version_tuple(): - - """ Returns the Python version as tuple (major, minor, patchlevel) - of strings. - - Note that unlike the Python sys.version, the returned value - will always include the patchlevel (it defaults to 0). - - """ - return tuple(string.split(_sys_version()[1], '.')) - -def python_branch(): - - """ Returns a string identifying the Python implementation - branch. - - For CPython this is the Subversion branch from which the - Python binary was built. - - If not available, an empty string is returned. - - """ - - return _sys_version()[2] - -def python_revision(): - - """ Returns a string identifying the Python implementation - revision. - - For CPython this is the Subversion revision from which the - Python binary was built. - - If not available, an empty string is returned. - - """ - return _sys_version()[3] - -def python_build(): - - """ Returns a tuple (buildno, builddate) stating the Python - build number and date as strings. - - """ - return _sys_version()[4:6] - -def python_compiler(): - - """ Returns a string identifying the compiler used for compiling - Python. - - """ - return _sys_version()[6] - -### The Opus Magnum of platform strings :-) - -_platform_cache = {} - -def platform(aliased=0, terse=0): - - """ Returns a single string identifying the underlying platform - with as much useful information as possible (but no more :). - - The output is intended to be human readable rather than - machine parseable. It may look different on different - platforms and this is intended. - - If "aliased" is true, the function will use aliases for - various platforms that report system names which differ from - their common names, e.g. SunOS will be reported as - Solaris. The system_alias() function is used to implement - this. - - Setting terse to true causes the function to return only the - absolute minimum information needed to identify the platform. - - """ - result = _platform_cache.get((aliased, terse), None) - if result is not None: - return result - - # Get uname information and then apply platform specific cosmetics - # to it... - system,node,release,version,machine,processor = uname() - if machine == processor: - processor = '' - if aliased: - system,release,version = system_alias(system,release,version) - - if system == 'Windows': - # MS platforms - rel,vers,csd,ptype = win32_ver(version) - if terse: - platform = _platform(system,release) - else: - platform = _platform(system,release,version,csd) - - elif system in ('Linux',): - # Linux based systems - distname,distversion,distid = dist('') - if distname and not terse: - platform = _platform(system,release,machine,processor, - 'with', - distname,distversion,distid) - else: - # If the distribution name is unknown check for libc vs. glibc - libcname,libcversion = libc_ver(sys.executable) - platform = _platform(system,release,machine,processor, - 'with', - libcname+libcversion) - elif system == 'Java': - # Java platforms - r,v,vminfo,(os_name,os_version,os_arch) = java_ver() - if terse or not os_name: - platform = _platform(system,release,version) - else: - platform = _platform(system,release,version, - 'on', - os_name,os_version,os_arch) - - elif system == 'MacOS': - # MacOS platforms - if terse: - platform = _platform(system,release) - else: - platform = _platform(system,release,machine) - - else: - # Generic handler - if terse: - platform = _platform(system,release) - else: - bits,linkage = architecture(sys.executable) - platform = _platform(system,release,machine,processor,bits,linkage) - - _platform_cache[(aliased, terse)] = platform - return platform - -### Command line interface - -if __name__ == '__main__': - # Default is to print the aliased verbose platform string - terse = ('terse' in sys.argv or '--terse' in sys.argv) - aliased = (not 'nonaliased' in sys.argv and not '--nonaliased' in sys.argv) - print platform(aliased,terse) - sys.exit(0) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py deleted file mode 100644 index b6744d8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/pydoc_data/topics.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- -# Autogenerated by Sphinx on Sun May 10 13:12:18 2015 -topics = {'assert': u'\nThe "assert" statement\n**********************\n\nAssert statements are a convenient way to insert debugging assertions\ninto a program:\n\n assert_stmt ::= "assert" expression ["," expression]\n\nThe simple form, "assert expression", is equivalent to\n\n if __debug__:\n if not expression: raise AssertionError\n\nThe extended form, "assert expression1, expression2", is equivalent to\n\n if __debug__:\n if not expression1: raise AssertionError(expression2)\n\nThese equivalences assume that "__debug__" and "AssertionError" refer\nto the built-in variables with those names. In the current\nimplementation, the built-in variable "__debug__" is "True" under\nnormal circumstances, "False" when optimization is requested (command\nline option -O). The current code generator emits no code for an\nassert statement when optimization is requested at compile time. Note\nthat it is unnecessary to include the source code for the expression\nthat failed in the error message; it will be displayed as part of the\nstack trace.\n\nAssignments to "__debug__" are illegal. The value for the built-in\nvariable is determined when the interpreter starts.\n', - 'assignment': u'\nAssignment statements\n*********************\n\nAssignment statements are used to (re)bind names to values and to\nmodify attributes or items of mutable objects:\n\n assignment_stmt ::= (target_list "=")+ (expression_list | yield_expression)\n target_list ::= target ("," target)* [","]\n target ::= identifier\n | "(" target_list ")"\n | "[" target_list "]"\n | attributeref\n | subscription\n | slicing\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn assignment statement evaluates the expression list (remember that\nthis can be a single expression or a comma-separated list, the latter\nyielding a tuple) and assigns the single resulting object to each of\nthe target lists, from left to right.\n\nAssignment is defined recursively depending on the form of the target\n(list). When a target is part of a mutable object (an attribute\nreference, subscription or slicing), the mutable object must\nultimately perform the assignment and decide about its validity, and\nmay raise an exception if the assignment is unacceptable. The rules\nobserved by various types and the exceptions raised are given with the\ndefinition of the object types (see section The standard type\nhierarchy).\n\nAssignment of an object to a target list is recursively defined as\nfollows.\n\n* If the target list is a single target: The object is assigned to\n that target.\n\n* If the target list is a comma-separated list of targets: The\n object must be an iterable with the same number of items as there\n are targets in the target list, and the items are assigned, from\n left to right, to the corresponding targets.\n\nAssignment of an object to a single target is recursively defined as\nfollows.\n\n* If the target is an identifier (name):\n\n * If the name does not occur in a "global" statement in the\n current code block: the name is bound to the object in the current\n local namespace.\n\n * Otherwise: the name is bound to the object in the current global\n namespace.\n\n The name is rebound if it was already bound. This may cause the\n reference count for the object previously bound to the name to reach\n zero, causing the object to be deallocated and its destructor (if it\n has one) to be called.\n\n* If the target is a target list enclosed in parentheses or in\n square brackets: The object must be an iterable with the same number\n of items as there are targets in the target list, and its items are\n assigned, from left to right, to the corresponding targets.\n\n* If the target is an attribute reference: The primary expression in\n the reference is evaluated. It should yield an object with\n assignable attributes; if this is not the case, "TypeError" is\n raised. That object is then asked to assign the assigned object to\n the given attribute; if it cannot perform the assignment, it raises\n an exception (usually but not necessarily "AttributeError").\n\n Note: If the object is a class instance and the attribute reference\n occurs on both sides of the assignment operator, the RHS expression,\n "a.x" can access either an instance attribute or (if no instance\n attribute exists) a class attribute. The LHS target "a.x" is always\n set as an instance attribute, creating it if necessary. Thus, the\n two occurrences of "a.x" do not necessarily refer to the same\n attribute: if the RHS expression refers to a class attribute, the\n LHS creates a new instance attribute as the target of the\n assignment:\n\n class Cls:\n x = 3 # class variable\n inst = Cls()\n inst.x = inst.x + 1 # writes inst.x as 4 leaving Cls.x as 3\n\n This description does not necessarily apply to descriptor\n attributes, such as properties created with "property()".\n\n* If the target is a subscription: The primary expression in the\n reference is evaluated. It should yield either a mutable sequence\n object (such as a list) or a mapping object (such as a dictionary).\n Next, the subscript expression is evaluated.\n\n If the primary is a mutable sequence object (such as a list), the\n subscript must yield a plain integer. If it is negative, the\n sequence\'s length is added to it. The resulting value must be a\n nonnegative integer less than the sequence\'s length, and the\n sequence is asked to assign the assigned object to its item with\n that index. If the index is out of range, "IndexError" is raised\n (assignment to a subscripted sequence cannot add new items to a\n list).\n\n If the primary is a mapping object (such as a dictionary), the\n subscript must have a type compatible with the mapping\'s key type,\n and the mapping is then asked to create a key/datum pair which maps\n the subscript to the assigned object. This can either replace an\n existing key/value pair with the same key value, or insert a new\n key/value pair (if no key with the same value existed).\n\n* If the target is a slicing: The primary expression in the\n reference is evaluated. It should yield a mutable sequence object\n (such as a list). The assigned object should be a sequence object\n of the same type. Next, the lower and upper bound expressions are\n evaluated, insofar they are present; defaults are zero and the\n sequence\'s length. The bounds should evaluate to (small) integers.\n If either bound is negative, the sequence\'s length is added to it.\n The resulting bounds are clipped to lie between zero and the\n sequence\'s length, inclusive. Finally, the sequence object is asked\n to replace the slice with the items of the assigned sequence. The\n length of the slice may be different from the length of the assigned\n sequence, thus changing the length of the target sequence, if the\n object allows it.\n\n**CPython implementation detail:** In the current implementation, the\nsyntax for targets is taken to be the same as for expressions, and\ninvalid syntax is rejected during the code generation phase, causing\nless detailed error messages.\n\nWARNING: Although the definition of assignment implies that overlaps\nbetween the left-hand side and the right-hand side are \'safe\' (for\nexample "a, b = b, a" swaps two variables), overlaps *within* the\ncollection of assigned-to variables are not safe! For instance, the\nfollowing program prints "[0, 2]":\n\n x = [0, 1]\n i = 0\n i, x[i] = 1, 2\n print x\n\n\nAugmented assignment statements\n===============================\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n', - 'atom-identifiers': u'\nIdentifiers (Names)\n*******************\n\nAn identifier occurring as an atom is a name. See section Identifiers\nand keywords for lexical definition and section Naming and binding for\ndocumentation of naming and binding.\n\nWhen the name is bound to an object, evaluation of the atom yields\nthat object. When a name is not bound, an attempt to evaluate it\nraises a "NameError" exception.\n\n**Private name mangling:** When an identifier that textually occurs in\na class definition begins with two or more underscore characters and\ndoes not end in two or more underscores, it is considered a *private\nname* of that class. Private names are transformed to a longer form\nbefore code is generated for them. The transformation inserts the\nclass name, with leading underscores removed and a single underscore\ninserted, in front of the name. For example, the identifier "__spam"\noccurring in a class named "Ham" will be transformed to "_Ham__spam".\nThis transformation is independent of the syntactical context in which\nthe identifier is used. If the transformed name is extremely long\n(longer than 255 characters), implementation defined truncation may\nhappen. If the class name consists only of underscores, no\ntransformation is done.\n', - 'atom-literals': u"\nLiterals\n********\n\nPython supports string literals and various numeric literals:\n\n literal ::= stringliteral | integer | longinteger\n | floatnumber | imagnumber\n\nEvaluation of a literal yields an object of the given type (string,\ninteger, long integer, floating point number, complex number) with the\ngiven value. The value may be approximated in the case of floating\npoint and imaginary (complex) literals. See section Literals for\ndetails.\n\nAll literals correspond to immutable data types, and hence the\nobject's identity is less important than its value. Multiple\nevaluations of literals with the same value (either the same\noccurrence in the program text or a different occurrence) may obtain\nthe same object or a different object with the same value.\n", - 'attribute-access': u'\nCustomizing attribute access\n****************************\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n===========================================\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\n\n\nImplementing Descriptors\n========================\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n====================\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n=========\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (Implementing Descriptors) for each variable name. As a\n result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n', - 'attribute-references': u'\nAttribute references\n********************\n\nAn attribute reference is a primary followed by a period and a name:\n\n attributeref ::= primary "." identifier\n\nThe primary must evaluate to an object of a type that supports\nattribute references, e.g., a module, list, or an instance. This\nobject is then asked to produce the attribute whose name is the\nidentifier. If this attribute is not available, the exception\n"AttributeError" is raised. Otherwise, the type and value of the\nobject produced is determined by the object. Multiple evaluations of\nthe same attribute reference may yield different objects.\n', - 'augassign': u'\nAugmented assignment statements\n*******************************\n\nAugmented assignment is the combination, in a single statement, of a\nbinary operation and an assignment statement:\n\n augmented_assignment_stmt ::= augtarget augop (expression_list | yield_expression)\n augtarget ::= identifier | attributeref | subscription | slicing\n augop ::= "+=" | "-=" | "*=" | "/=" | "//=" | "%=" | "**="\n | ">>=" | "<<=" | "&=" | "^=" | "|="\n\n(See section Primaries for the syntax definitions for the last three\nsymbols.)\n\nAn augmented assignment evaluates the target (which, unlike normal\nassignment statements, cannot be an unpacking) and the expression\nlist, performs the binary operation specific to the type of assignment\non the two operands, and assigns the result to the original target.\nThe target is only evaluated once.\n\nAn augmented assignment expression like "x += 1" can be rewritten as\n"x = x + 1" to achieve a similar, but not exactly equal effect. In the\naugmented version, "x" is only evaluated once. Also, when possible,\nthe actual operation is performed *in-place*, meaning that rather than\ncreating a new object and assigning that to the target, the old object\nis modified instead.\n\nWith the exception of assigning to tuples and multiple targets in a\nsingle statement, the assignment done by augmented assignment\nstatements is handled the same way as normal assignments. Similarly,\nwith the exception of the possible *in-place* behavior, the binary\noperation performed by augmented assignment is the same as the normal\nbinary operations.\n\nFor targets which are attribute references, the same caveat about\nclass and instance attributes applies as for regular assignments.\n', - 'binary': u'\nBinary arithmetic operations\n****************************\n\nThe binary arithmetic operations have the conventional priority\nlevels. Note that some of these operations also apply to certain non-\nnumeric types. Apart from the power operator, there are only two\nlevels, one for multiplicative operators and one for additive\noperators:\n\n m_expr ::= u_expr | m_expr "*" u_expr | m_expr "//" u_expr | m_expr "/" u_expr\n | m_expr "%" u_expr\n a_expr ::= m_expr | a_expr "+" m_expr | a_expr "-" m_expr\n\nThe "*" (multiplication) operator yields the product of its arguments.\nThe arguments must either both be numbers, or one argument must be an\ninteger (plain or long) and the other must be a sequence. In the\nformer case, the numbers are converted to a common type and then\nmultiplied together. In the latter case, sequence repetition is\nperformed; a negative repetition factor yields an empty sequence.\n\nThe "/" (division) and "//" (floor division) operators yield the\nquotient of their arguments. The numeric arguments are first\nconverted to a common type. Plain or long integer division yields an\ninteger of the same type; the result is that of mathematical division\nwith the \'floor\' function applied to the result. Division by zero\nraises the "ZeroDivisionError" exception.\n\nThe "%" (modulo) operator yields the remainder from the division of\nthe first argument by the second. The numeric arguments are first\nconverted to a common type. A zero right argument raises the\n"ZeroDivisionError" exception. The arguments may be floating point\nnumbers, e.g., "3.14%0.7" equals "0.34" (since "3.14" equals "4*0.7 +\n0.34".) The modulo operator always yields a result with the same sign\nas its second operand (or zero); the absolute value of the result is\nstrictly smaller than the absolute value of the second operand [2].\n\nThe integer division and modulo operators are connected by the\nfollowing identity: "x == (x/y)*y + (x%y)". Integer division and\nmodulo are also connected with the built-in function "divmod()":\n"divmod(x, y) == (x/y, x%y)". These identities don\'t hold for\nfloating point numbers; there similar identities hold approximately\nwhere "x/y" is replaced by "floor(x/y)" or "floor(x/y) - 1" [3].\n\nIn addition to performing the modulo operation on numbers, the "%"\noperator is also overloaded by string and unicode objects to perform\nstring formatting (also known as interpolation). The syntax for string\nformatting is described in the Python Library Reference, section\nString Formatting Operations.\n\nDeprecated since version 2.3: The floor division operator, the modulo\noperator, and the "divmod()" function are no longer defined for\ncomplex numbers. Instead, convert to a floating point number using\nthe "abs()" function if appropriate.\n\nThe "+" (addition) operator yields the sum of its arguments. The\narguments must either both be numbers or both sequences of the same\ntype. In the former case, the numbers are converted to a common type\nand then added together. In the latter case, the sequences are\nconcatenated.\n\nThe "-" (subtraction) operator yields the difference of its arguments.\nThe numeric arguments are first converted to a common type.\n', - 'bitwise': u'\nBinary bitwise operations\n*************************\n\nEach of the three bitwise operations has a different priority level:\n\n and_expr ::= shift_expr | and_expr "&" shift_expr\n xor_expr ::= and_expr | xor_expr "^" and_expr\n or_expr ::= xor_expr | or_expr "|" xor_expr\n\nThe "&" operator yields the bitwise AND of its arguments, which must\nbe plain or long integers. The arguments are converted to a common\ntype.\n\nThe "^" operator yields the bitwise XOR (exclusive OR) of its\narguments, which must be plain or long integers. The arguments are\nconverted to a common type.\n\nThe "|" operator yields the bitwise (inclusive) OR of its arguments,\nwhich must be plain or long integers. The arguments are converted to\na common type.\n', - 'bltin-code-objects': u'\nCode Objects\n************\n\nCode objects are used by the implementation to represent "pseudo-\ncompiled" executable Python code such as a function body. They differ\nfrom function objects because they don\'t contain a reference to their\nglobal execution environment. Code objects are returned by the built-\nin "compile()" function and can be extracted from function objects\nthrough their "func_code" attribute. See also the "code" module.\n\nA code object can be executed or evaluated by passing it (instead of a\nsource string) to the "exec" statement or the built-in "eval()"\nfunction.\n\nSee The standard type hierarchy for more information.\n', - 'bltin-ellipsis-object': u'\nThe Ellipsis Object\n*******************\n\nThis object is used by extended slice notation (see Slicings). It\nsupports no special operations. There is exactly one ellipsis object,\nnamed "Ellipsis" (a built-in name).\n\nIt is written as "Ellipsis". When in a subscript, it can also be\nwritten as "...", for example "seq[...]".\n', - 'bltin-null-object': u'\nThe Null Object\n***************\n\nThis object is returned by functions that don\'t explicitly return a\nvalue. It supports no special operations. There is exactly one null\nobject, named "None" (a built-in name).\n\nIt is written as "None".\n', - 'bltin-type-objects': u'\nType Objects\n************\n\nType objects represent the various object types. An object\'s type is\naccessed by the built-in function "type()". There are no special\noperations on types. The standard module "types" defines names for\nall standard built-in types.\n\nTypes are written like this: "".\n', - 'booleans': u'\nBoolean operations\n******************\n\n or_test ::= and_test | or_test "or" and_test\n and_test ::= not_test | and_test "and" not_test\n not_test ::= comparison | "not" not_test\n\nIn the context of Boolean operations, and also when expressions are\nused by control flow statements, the following values are interpreted\nas false: "False", "None", numeric zero of all types, and empty\nstrings and containers (including strings, tuples, lists,\ndictionaries, sets and frozensets). All other values are interpreted\nas true. (See the "__nonzero__()" special method for a way to change\nthis.)\n\nThe operator "not" yields "True" if its argument is false, "False"\notherwise.\n\nThe expression "x and y" first evaluates *x*; if *x* is false, its\nvalue is returned; otherwise, *y* is evaluated and the resulting value\nis returned.\n\nThe expression "x or y" first evaluates *x*; if *x* is true, its value\nis returned; otherwise, *y* is evaluated and the resulting value is\nreturned.\n\n(Note that neither "and" nor "or" restrict the value and type they\nreturn to "False" and "True", but rather return the last evaluated\nargument. This is sometimes useful, e.g., if "s" is a string that\nshould be replaced by a default value if it is empty, the expression\n"s or \'foo\'" yields the desired value. Because "not" has to invent a\nvalue anyway, it does not bother to return a value of the same type as\nits argument, so e.g., "not \'foo\'" yields "False", not "\'\'".)\n', - 'break': u'\nThe "break" statement\n*********************\n\n break_stmt ::= "break"\n\n"break" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition within that\nloop.\n\nIt terminates the nearest enclosing loop, skipping the optional "else"\nclause if the loop has one.\n\nIf a "for" loop is terminated by "break", the loop control target\nkeeps its current value.\n\nWhen "break" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nloop.\n', - 'callable-types': u'\nEmulating callable objects\n**************************\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n', - 'calls': u'\nCalls\n*****\n\nA call calls a callable object (e.g., a *function*) with a possibly\nempty series of *arguments*:\n\n call ::= primary "(" [argument_list [","]\n | expression genexpr_for] ")"\n argument_list ::= positional_arguments ["," keyword_arguments]\n ["," "*" expression] ["," keyword_arguments]\n ["," "**" expression]\n | keyword_arguments ["," "*" expression]\n ["," "**" expression]\n | "*" expression ["," keyword_arguments] ["," "**" expression]\n | "**" expression\n positional_arguments ::= expression ("," expression)*\n keyword_arguments ::= keyword_item ("," keyword_item)*\n keyword_item ::= identifier "=" expression\n\nA trailing comma may be present after the positional and keyword\narguments but does not affect the semantics.\n\nThe primary must evaluate to a callable object (user-defined\nfunctions, built-in functions, methods of built-in objects, class\nobjects, methods of class instances, and certain class instances\nthemselves are callable; extensions may define additional callable\nobject types). All argument expressions are evaluated before the call\nis attempted. Please refer to section Function definitions for the\nsyntax of formal *parameter* lists.\n\nIf keyword arguments are present, they are first converted to\npositional arguments, as follows. First, a list of unfilled slots is\ncreated for the formal parameters. If there are N positional\narguments, they are placed in the first N slots. Next, for each\nkeyword argument, the identifier is used to determine the\ncorresponding slot (if the identifier is the same as the first formal\nparameter name, the first slot is used, and so on). If the slot is\nalready filled, a "TypeError" exception is raised. Otherwise, the\nvalue of the argument is placed in the slot, filling it (even if the\nexpression is "None", it fills the slot). When all arguments have\nbeen processed, the slots that are still unfilled are filled with the\ncorresponding default value from the function definition. (Default\nvalues are calculated, once, when the function is defined; thus, a\nmutable object such as a list or dictionary used as default value will\nbe shared by all calls that don\'t specify an argument value for the\ncorresponding slot; this should usually be avoided.) If there are any\nunfilled slots for which no default value is specified, a "TypeError"\nexception is raised. Otherwise, the list of filled slots is used as\nthe argument list for the call.\n\n**CPython implementation detail:** An implementation may provide\nbuilt-in functions whose positional parameters do not have names, even\nif they are \'named\' for the purpose of documentation, and which\ntherefore cannot be supplied by keyword. In CPython, this is the case\nfor functions implemented in C that use "PyArg_ParseTuple()" to parse\ntheir arguments.\n\nIf there are more positional arguments than there are formal parameter\nslots, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "*identifier" is present; in this case, that formal\nparameter receives a tuple containing the excess positional arguments\n(or an empty tuple if there were no excess positional arguments).\n\nIf any keyword argument does not correspond to a formal parameter\nname, a "TypeError" exception is raised, unless a formal parameter\nusing the syntax "**identifier" is present; in this case, that formal\nparameter receives a dictionary containing the excess keyword\narguments (using the keywords as keys and the argument values as\ncorresponding values), or a (new) empty dictionary if there were no\nexcess keyword arguments.\n\nIf the syntax "*expression" appears in the function call, "expression"\nmust evaluate to an iterable. Elements from this iterable are treated\nas if they were additional positional arguments; if there are\npositional arguments *x1*, ..., *xN*, and "expression" evaluates to a\nsequence *y1*, ..., *yM*, this is equivalent to a call with M+N\npositional arguments *x1*, ..., *xN*, *y1*, ..., *yM*.\n\nA consequence of this is that although the "*expression" syntax may\nappear *after* some keyword arguments, it is processed *before* the\nkeyword arguments (and the "**expression" argument, if any -- see\nbelow). So:\n\n >>> def f(a, b):\n ... print a, b\n ...\n >>> f(b=1, *(2,))\n 2 1\n >>> f(a=1, *(2,))\n Traceback (most recent call last):\n File "", line 1, in ?\n TypeError: f() got multiple values for keyword argument \'a\'\n >>> f(1, *(2,))\n 1 2\n\nIt is unusual for both keyword arguments and the "*expression" syntax\nto be used in the same call, so in practice this confusion does not\narise.\n\nIf the syntax "**expression" appears in the function call,\n"expression" must evaluate to a mapping, the contents of which are\ntreated as additional keyword arguments. In the case of a keyword\nappearing in both "expression" and as an explicit keyword argument, a\n"TypeError" exception is raised.\n\nFormal parameters using the syntax "*identifier" or "**identifier"\ncannot be used as positional argument slots or as keyword argument\nnames. Formal parameters using the syntax "(sublist)" cannot be used\nas keyword argument names; the outermost sublist corresponds to a\nsingle unnamed argument slot, and the argument value is assigned to\nthe sublist using the usual tuple assignment rules after all other\nparameter processing is done.\n\nA call always returns some value, possibly "None", unless it raises an\nexception. How this value is computed depends on the type of the\ncallable object.\n\nIf it is---\n\na user-defined function:\n The code block for the function is executed, passing it the\n argument list. The first thing the code block will do is bind the\n formal parameters to the arguments; this is described in section\n Function definitions. When the code block executes a "return"\n statement, this specifies the return value of the function call.\n\na built-in function or method:\n The result is up to the interpreter; see Built-in Functions for the\n descriptions of built-in functions and methods.\n\na class object:\n A new instance of that class is returned.\n\na class instance method:\n The corresponding user-defined function is called, with an argument\n list that is one longer than the argument list of the call: the\n instance becomes the first argument.\n\na class instance:\n The class must define a "__call__()" method; the effect is then the\n same as if that method was called.\n', - 'class': u'\nClass definitions\n*****************\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', - 'comparisons': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. Unicode and 8-bit strings are fully interoperable in\n this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n the same as "cmp(x,y)". If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, "[1,2] <\n [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n', - 'compound': u'\nCompound statements\n*******************\n\nCompound statements contain (groups of) other statements; they affect\nor control the execution of those other statements in some way. In\ngeneral, compound statements span multiple lines, although in simple\nincarnations a whole compound statement may be contained in one line.\n\nThe "if", "while" and "for" statements implement traditional control\nflow constructs. "try" specifies exception handlers and/or cleanup\ncode for a group of statements. Function and class definitions are\nalso syntactically compound statements.\n\nCompound statements consist of one or more \'clauses.\' A clause\nconsists of a header and a \'suite.\' The clause headers of a\nparticular compound statement are all at the same indentation level.\nEach clause header begins with a uniquely identifying keyword and ends\nwith a colon. A suite is a group of statements controlled by a\nclause. A suite can be one or more semicolon-separated simple\nstatements on the same line as the header, following the header\'s\ncolon, or it can be one or more indented statements on subsequent\nlines. Only the latter form of suite can contain nested compound\nstatements; the following is illegal, mostly because it wouldn\'t be\nclear to which "if" clause a following "else" clause would belong:\n\n if test1: if test2: print x\n\nAlso note that the semicolon binds tighter than the colon in this\ncontext, so that in the following example, either all or none of the\n"print" statements are executed:\n\n if x < y < z: print x; print y; print z\n\nSummarizing:\n\n compound_stmt ::= if_stmt\n | while_stmt\n | for_stmt\n | try_stmt\n | with_stmt\n | funcdef\n | classdef\n | decorated\n suite ::= stmt_list NEWLINE | NEWLINE INDENT statement+ DEDENT\n statement ::= stmt_list NEWLINE | compound_stmt\n stmt_list ::= simple_stmt (";" simple_stmt)* [";"]\n\nNote that statements always end in a "NEWLINE" possibly followed by a\n"DEDENT". Also note that optional continuation clauses always begin\nwith a keyword that cannot start a statement, thus there are no\nambiguities (the \'dangling "else"\' problem is solved in Python by\nrequiring nested "if" statements to be indented).\n\nThe formatting of the grammar rules in the following sections places\neach clause on a separate line for clarity.\n\n\nThe "if" statement\n==================\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n\n\nThe "while" statement\n=====================\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n\n\nThe "for" statement\n===================\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n\n\nThe "try" statement\n===================\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n\n\nThe "with" statement\n====================\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n "with_statement" feature has been enabled. It is always enabled in\n Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nFunction definitions\n====================\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n\n\nClass definitions\n=================\n\nA class definition defines a class object (see section The standard\ntype hierarchy):\n\n classdef ::= "class" classname [inheritance] ":" suite\n inheritance ::= "(" [expression_list] ")"\n classname ::= identifier\n\nA class definition is an executable statement. It first evaluates the\ninheritance list, if present. Each item in the inheritance list\nshould evaluate to a class object or class type which allows\nsubclassing. The class\'s suite is then executed in a new execution\nframe (see section Naming and binding), using a newly created local\nnamespace and the original global namespace. (Usually, the suite\ncontains only function definitions.) When the class\'s suite finishes\nexecution, its execution frame is discarded but its local namespace is\nsaved. [4] A class object is then created using the inheritance list\nfor the base classes and the saved local namespace for the attribute\ndictionary. The class name is bound to this class object in the\noriginal local namespace.\n\n**Programmer\'s note:** Variables defined in the class definition are\nclass variables; they are shared by all instances. To create instance\nvariables, they can be set in a method with "self.name = value". Both\nclass and instance variables are accessible through the notation\n""self.name"", and an instance variable hides a class variable with\nthe same name when accessed in this way. Class variables can be used\nas defaults for instance variables, but using mutable values there can\nlead to unexpected results. For *new-style class*es, descriptors can\nbe used to create instance variables with different implementation\ndetails.\n\nClass definitions, like function definitions, may be wrapped by one or\nmore *decorator* expressions. The evaluation rules for the decorator\nexpressions are the same as for functions. The result must be a class\nobject, which is then bound to the class name.\n\n-[ Footnotes ]-\n\n[1] The exception is propagated to the invocation stack unless\n there is a "finally" clause which happens to raise another\n exception. That new exception causes the old one to be lost.\n\n[2] Currently, control "flows off the end" except in the case of\n an exception or the execution of a "return", "continue", or\n "break" statement.\n\n[3] A string literal appearing as the first statement in the\n function body is transformed into the function\'s "__doc__"\n attribute and therefore the function\'s *docstring*.\n\n[4] A string literal appearing as the first statement in the class\n body is transformed into the namespace\'s "__doc__" item and\n therefore the class\'s *docstring*.\n', - 'context-managers': u'\nWith Statement Context Managers\n*******************************\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', - 'continue': u'\nThe "continue" statement\n************************\n\n continue_stmt ::= "continue"\n\n"continue" may only occur syntactically nested in a "for" or "while"\nloop, but not nested in a function or class definition or "finally"\nclause within that loop. It continues with the next cycle of the\nnearest enclosing loop.\n\nWhen "continue" passes control out of a "try" statement with a\n"finally" clause, that "finally" clause is executed before really\nstarting the next loop cycle.\n', - 'conversions': u'\nArithmetic conversions\n**********************\n\nWhen a description of an arithmetic operator below uses the phrase\n"the numeric arguments are converted to a common type," the arguments\nare coerced using the coercion rules listed at Coercion rules. If\nboth arguments are standard numeric types, the following coercions are\napplied:\n\n* If either argument is a complex number, the other is converted to\n complex;\n\n* otherwise, if either argument is a floating point number, the\n other is converted to floating point;\n\n* otherwise, if either argument is a long integer, the other is\n converted to long integer;\n\n* otherwise, both must be plain integers and no conversion is\n necessary.\n\nSome additional rules apply for certain operators (e.g., a string left\nargument to the \'%\' operator). Extensions can define their own\ncoercions.\n', - 'customization': u'\nBasic customization\n*******************\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_traceback" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing "None" in\n "sys.exc_traceback" or "sys.last_traceback". Circular references\n which are garbage are detected when the option cycle detector is\n enabled (it\'s on by default), but can only be cleaned up if there\n are no Python-level "__del__()" methods involved. Refer to the\n documentation for the "gc" module for more information about how\n "__del__()" methods are handled by the cycle detector,\n particularly the description of the "garbage" value.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\n See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function and by string conversions\n (reverse quotes) to compute the "official" string representation of\n an object. If at all possible, this should look like a valid\n Python expression that could be used to recreate an object with the\n same value (given an appropriate environment). If this is not\n possible, a string of the form "<...some useful description...>"\n should be returned. The return value must be a string object. If a\n class defines "__repr__()" but not "__str__()", then "__repr__()"\n is also used when an "informal" string representation of instances\n of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the "str()" built-in function and by the "print"\n statement to compute the "informal" string representation of an\n object. This differs from "__repr__()" in that it does not have to\n be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to "__cmp__()" below. The\n correspondence between operator symbols and method names is as\n follows: "xy" call "x.__ne__(y)",\n "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if "self < other",\n zero if "self == other", a positive integer if "self > other". If\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n class instances are compared by object identity ("address"). See\n also the description of "__hash__()" for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by "__cmp__()" has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a "__cmp__()" or "__eq__()" method it\n should not define a "__hash__()" operation either; if it defines\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n not be usable in hashed collections. If a class defines mutable\n objects and implements a "__cmp__()" or "__eq__()" method, it\n should not implement "__hash__()", since hashable collection\n implementations require that a object\'s hash value is immutable (if\n the object\'s hash value changes, it will be in the wrong hash\n bucket).\n\n User-defined classes have "__cmp__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns a result derived from\n "id(x)".\n\n Classes which inherit a "__hash__()" method from a parent class but\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\n value returned is no longer appropriate (e.g. by switching to a\n value-based concept of equality instead of the default identity\n based equality) can explicitly flag themselves as being unhashable\n by setting "__hash__ = None" in the class definition. Doing so\n means that not only will instances of the class raise an\n appropriate "TypeError" when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable)"\n (unlike classes which define their own "__hash__()" to explicitly\n raise "TypeError").\n\n Changed in version 2.5: "__hash__()" may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: "__hash__" may now be set to "None" to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True", or their integer\n equivalents "0" or "1". When this method is not defined,\n "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__nonzero__()", all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement "unicode()" built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n', - 'debugger': u'\n"pdb" --- The Python Debugger\n*****************************\n\n**Source code:** Lib/pdb.py\n\n======================================================================\n\nThe module "pdb" defines an interactive source code debugger for\nPython programs. It supports setting (conditional) breakpoints and\nsingle stepping at the source line level, inspection of stack frames,\nsource code listing, and evaluation of arbitrary Python code in the\ncontext of any stack frame. It also supports post-mortem debugging\nand can be called under program control.\n\nThe debugger is extensible --- it is actually defined as the class\n"Pdb". This is currently undocumented but easily understood by reading\nthe source. The extension interface uses the modules "bdb" and "cmd".\n\nThe debugger\'s prompt is "(Pdb)". Typical usage to run a program under\ncontrol of the debugger is:\n\n >>> import pdb\n >>> import mymodule\n >>> pdb.run(\'mymodule.test()\')\n > (0)?()\n (Pdb) continue\n > (1)?()\n (Pdb) continue\n NameError: \'spam\'\n > (1)?()\n (Pdb)\n\n"pdb.py" can also be invoked as a script to debug other scripts. For\nexample:\n\n python -m pdb myscript.py\n\nWhen invoked as a script, pdb will automatically enter post-mortem\ndebugging if the program being debugged exits abnormally. After post-\nmortem debugging (or after normal exit of the program), pdb will\nrestart the program. Automatic restarting preserves pdb\'s state (such\nas breakpoints) and in most cases is more useful than quitting the\ndebugger upon program\'s exit.\n\nNew in version 2.4: Restarting post-mortem behavior added.\n\nThe typical usage to break into the debugger from a running program is\nto insert\n\n import pdb; pdb.set_trace()\n\nat the location you want to break into the debugger. You can then\nstep through the code following this statement, and continue running\nwithout the debugger using the "c" command.\n\nThe typical usage to inspect a crashed program is:\n\n >>> import pdb\n >>> import mymodule\n >>> mymodule.test()\n Traceback (most recent call last):\n File "", line 1, in ?\n File "./mymodule.py", line 4, in test\n test2()\n File "./mymodule.py", line 3, in test2\n print spam\n NameError: spam\n >>> pdb.pm()\n > ./mymodule.py(3)test2()\n -> print spam\n (Pdb)\n\nThe module defines the following functions; each enters the debugger\nin a slightly different way:\n\npdb.run(statement[, globals[, locals]])\n\n Execute the *statement* (given as a string) under debugger control.\n The debugger prompt appears before any code is executed; you can\n set breakpoints and type "continue", or you can step through the\n statement using "step" or "next" (all these commands are explained\n below). The optional *globals* and *locals* arguments specify the\n environment in which the code is executed; by default the\n dictionary of the module "__main__" is used. (See the explanation\n of the "exec" statement or the "eval()" built-in function.)\n\npdb.runeval(expression[, globals[, locals]])\n\n Evaluate the *expression* (given as a string) under debugger\n control. When "runeval()" returns, it returns the value of the\n expression. Otherwise this function is similar to "run()".\n\npdb.runcall(function[, argument, ...])\n\n Call the *function* (a function or method object, not a string)\n with the given arguments. When "runcall()" returns, it returns\n whatever the function call returned. The debugger prompt appears\n as soon as the function is entered.\n\npdb.set_trace()\n\n Enter the debugger at the calling stack frame. This is useful to\n hard-code a breakpoint at a given point in a program, even if the\n code is not otherwise being debugged (e.g. when an assertion\n fails).\n\npdb.post_mortem([traceback])\n\n Enter post-mortem debugging of the given *traceback* object. If no\n *traceback* is given, it uses the one of the exception that is\n currently being handled (an exception must be being handled if the\n default is to be used).\n\npdb.pm()\n\n Enter post-mortem debugging of the traceback found in\n "sys.last_traceback".\n\nThe "run*" functions and "set_trace()" are aliases for instantiating\nthe "Pdb" class and calling the method of the same name. If you want\nto access further features, you have to do this yourself:\n\nclass class pdb.Pdb(completekey=\'tab\', stdin=None, stdout=None, skip=None)\n\n "Pdb" is the debugger class.\n\n The *completekey*, *stdin* and *stdout* arguments are passed to the\n underlying "cmd.Cmd" class; see the description there.\n\n The *skip* argument, if given, must be an iterable of glob-style\n module name patterns. The debugger will not step into frames that\n originate in a module that matches one of these patterns. [1]\n\n Example call to enable tracing with *skip*:\n\n import pdb; pdb.Pdb(skip=[\'django.*\']).set_trace()\n\n New in version 2.7: The *skip* argument.\n\n run(statement[, globals[, locals]])\n runeval(expression[, globals[, locals]])\n runcall(function[, argument, ...])\n set_trace()\n\n See the documentation for the functions explained above.\n', - 'del': u'\nThe "del" statement\n*******************\n\n del_stmt ::= "del" target_list\n\nDeletion is recursively defined very similar to the way assignment is\ndefined. Rather than spelling it out in full details, here are some\nhints.\n\nDeletion of a target list recursively deletes each target, from left\nto right.\n\nDeletion of a name removes the binding of that name from the local or\nglobal namespace, depending on whether the name occurs in a "global"\nstatement in the same code block. If the name is unbound, a\n"NameError" exception will be raised.\n\nIt is illegal to delete a name from the local namespace if it occurs\nas a free variable in a nested block.\n\nDeletion of attribute references, subscriptions and slicings is passed\nto the primary object involved; deletion of a slicing is in general\nequivalent to assignment of an empty slice of the right type (but even\nthis is determined by the sliced object).\n', - 'dict': u'\nDictionary displays\n*******************\n\nA dictionary display is a possibly empty series of key/datum pairs\nenclosed in curly braces:\n\n dict_display ::= "{" [key_datum_list | dict_comprehension] "}"\n key_datum_list ::= key_datum ("," key_datum)* [","]\n key_datum ::= expression ":" expression\n dict_comprehension ::= expression ":" expression comp_for\n\nA dictionary display yields a new dictionary object.\n\nIf a comma-separated sequence of key/datum pairs is given, they are\nevaluated from left to right to define the entries of the dictionary:\neach key object is used as a key into the dictionary to store the\ncorresponding datum. This means that you can specify the same key\nmultiple times in the key/datum list, and the final dictionary\'s value\nfor that key will be the last one given.\n\nA dict comprehension, in contrast to list and set comprehensions,\nneeds two expressions separated with a colon followed by the usual\n"for" and "if" clauses. When the comprehension is run, the resulting\nkey and value elements are inserted in the new dictionary in the order\nthey are produced.\n\nRestrictions on the types of the key values are listed earlier in\nsection The standard type hierarchy. (To summarize, the key type\nshould be *hashable*, which excludes all mutable objects.) Clashes\nbetween duplicate keys are not detected; the last datum (textually\nrightmost in the display) stored for a given key value prevails.\n', - 'dynamic-features': u'\nInteraction with dynamic features\n*********************************\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', - 'else': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', - 'exceptions': u'\nExceptions\n**********\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', - 'exec': u'\nThe "exec" statement\n********************\n\n exec_stmt ::= "exec" or_expr ["in" expression ["," expression]]\n\nThis statement supports dynamic execution of Python code. The first\nexpression should evaluate to either a Unicode string, a *Latin-1*\nencoded string, an open file object, a code object, or a tuple. If it\nis a string, the string is parsed as a suite of Python statements\nwhich is then executed (unless a syntax error occurs). [1] If it is an\nopen file, the file is parsed until EOF and executed. If it is a code\nobject, it is simply executed. For the interpretation of a tuple, see\nbelow. In all cases, the code that\'s executed is expected to be valid\nas file input (see section File input). Be aware that the "return"\nand "yield" statements may not be used outside of function definitions\neven within the context of code passed to the "exec" statement.\n\nIn all cases, if the optional parts are omitted, the code is executed\nin the current scope. If only the first expression after "in" is\nspecified, it should be a dictionary, which will be used for both the\nglobal and the local variables. If two expressions are given, they\nare used for the global and local variables, respectively. If\nprovided, *locals* can be any mapping object. Remember that at module\nlevel, globals and locals are the same dictionary. If two separate\nobjects are given as *globals* and *locals*, the code will be executed\nas if it were embedded in a class definition.\n\nThe first expression may also be a tuple of length 2 or 3. In this\ncase, the optional parts must be omitted. The form "exec(expr,\nglobals)" is equivalent to "exec expr in globals", while the form\n"exec(expr, globals, locals)" is equivalent to "exec expr in globals,\nlocals". The tuple form of "exec" provides compatibility with Python\n3, where "exec" is a function rather than a statement.\n\nChanged in version 2.4: Formerly, *locals* was required to be a\ndictionary.\n\nAs a side effect, an implementation may insert additional keys into\nthe dictionaries given besides those corresponding to variable names\nset by the executed code. For example, the current implementation may\nadd a reference to the dictionary of the built-in module "__builtin__"\nunder the key "__builtins__" (!).\n\n**Programmer\'s hints:** dynamic evaluation of expressions is supported\nby the built-in function "eval()". The built-in functions "globals()"\nand "locals()" return the current global and local dictionary,\nrespectively, which may be useful to pass around for use by "exec".\n\n-[ Footnotes ]-\n\n[1] Note that the parser only accepts the Unix-style end of line\n convention. If you are reading the code from a file, make sure to\n use *universal newlines* mode to convert Windows or Mac-style\n newlines.\n', - 'execmodel': u'\nExecution model\n***************\n\n\nNaming and binding\n==================\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n---------------------------------\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n\n\nExceptions\n==========\n\nExceptions are a means of breaking out of the normal flow of control\nof a code block in order to handle errors or other exceptional\nconditions. An exception is *raised* at the point where the error is\ndetected; it may be *handled* by the surrounding code block or by any\ncode block that directly or indirectly invoked the code block where\nthe error occurred.\n\nThe Python interpreter raises an exception when it detects a run-time\nerror (such as division by zero). A Python program can also\nexplicitly raise an exception with the "raise" statement. Exception\nhandlers are specified with the "try" ... "except" statement. The\n"finally" clause of such a statement can be used to specify cleanup\ncode which does not handle the exception, but is executed whether an\nexception occurred or not in the preceding code.\n\nPython uses the "termination" model of error handling: an exception\nhandler can find out what happened and continue execution at an outer\nlevel, but it cannot repair the cause of the error and retry the\nfailing operation (except by re-entering the offending piece of code\nfrom the top).\n\nWhen an exception is not handled at all, the interpreter terminates\nexecution of the program, or returns to its interactive main loop. In\neither case, it prints a stack backtrace, except when the exception is\n"SystemExit".\n\nExceptions are identified by class instances. The "except" clause is\nselected depending on the class of the instance: it must reference the\nclass of the instance or a base class thereof. The instance can be\nreceived by the handler and can carry additional information about the\nexceptional condition.\n\nExceptions can also be identified by strings, in which case the\n"except" clause is selected by object identity. An arbitrary value\ncan be raised along with the identifying string which can be passed to\nthe handler.\n\nNote: Messages to exceptions are not part of the Python API. Their\n contents may change from one version of Python to the next without\n warning and should not be relied on by code which will run under\n multiple versions of the interpreter.\n\nSee also the description of the "try" statement in section The try\nstatement and "raise" statement in section The raise statement.\n\n-[ Footnotes ]-\n\n[1] This limitation occurs because the code that is executed by\n these operations is not available at the time the module is\n compiled.\n', - 'exprlists': u'\nExpression lists\n****************\n\n expression_list ::= expression ( "," expression )* [","]\n\nAn expression list containing at least one comma yields a tuple. The\nlength of the tuple is the number of expressions in the list. The\nexpressions are evaluated from left to right.\n\nThe trailing comma is required only to create a single tuple (a.k.a. a\n*singleton*); it is optional in all other cases. A single expression\nwithout a trailing comma doesn\'t create a tuple, but rather yields the\nvalue of that expression. (To create an empty tuple, use an empty pair\nof parentheses: "()".)\n', - 'floating': u'\nFloating point literals\n***********************\n\nFloating point literals are described by the following lexical\ndefinitions:\n\n floatnumber ::= pointfloat | exponentfloat\n pointfloat ::= [intpart] fraction | intpart "."\n exponentfloat ::= (intpart | pointfloat) exponent\n intpart ::= digit+\n fraction ::= "." digit+\n exponent ::= ("e" | "E") ["+" | "-"] digit+\n\nNote that the integer and exponent parts of floating point numbers can\nlook like octal integers, but are interpreted using radix 10. For\nexample, "077e010" is legal, and denotes the same number as "77e10".\nThe allowed range of floating point literals is implementation-\ndependent. Some examples of floating point literals:\n\n 3.14 10. .001 1e100 3.14e-10 0e0\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator "-" and the\nliteral "1".\n', - 'for': u'\nThe "for" statement\n*******************\n\nThe "for" statement is used to iterate over the elements of a sequence\n(such as a string, tuple or list) or other iterable object:\n\n for_stmt ::= "for" target_list "in" expression_list ":" suite\n ["else" ":" suite]\n\nThe expression list is evaluated once; it should yield an iterable\nobject. An iterator is created for the result of the\n"expression_list". The suite is then executed once for each item\nprovided by the iterator, in the order of ascending indices. Each\nitem in turn is assigned to the target list using the standard rules\nfor assignments, and then the suite is executed. When the items are\nexhausted (which is immediately when the sequence is empty), the suite\nin the "else" clause, if present, is executed, and the loop\nterminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and continues\nwith the next item, or with the "else" clause if there was no next\nitem.\n\nThe suite may assign to the variable(s) in the target list; this does\nnot affect the next item assigned to it.\n\nThe target list is not deleted when the loop is finished, but if the\nsequence is empty, it will not have been assigned to at all by the\nloop. Hint: the built-in function "range()" returns a sequence of\nintegers suitable to emulate the effect of Pascal\'s "for i := a to b\ndo"; e.g., "range(3)" returns the list "[0, 1, 2]".\n\nNote: There is a subtlety when the sequence is being modified by the\n loop (this can only occur for mutable sequences, i.e. lists). An\n internal counter is used to keep track of which item is used next,\n and this is incremented on each iteration. When this counter has\n reached the length of the sequence the loop terminates. This means\n that if the suite deletes the current (or a previous) item from the\n sequence, the next item will be skipped (since it gets the index of\n the current item which has already been treated). Likewise, if the\n suite inserts an item in the sequence before the current item, the\n current item will be treated again the next time through the loop.\n This can lead to nasty bugs that can be avoided by making a\n temporary copy using a slice of the whole sequence, e.g.,\n\n for x in a[:]:\n if x < 0: a.remove(x)\n', - 'formatstrings': u'\nFormat String Syntax\n********************\n\nThe "str.format()" method and the "Formatter" class share the same\nsyntax for format strings (although in the case of "Formatter",\nsubclasses can define their own format string syntax).\n\nFormat strings contain "replacement fields" surrounded by curly braces\n"{}". Anything that is not contained in braces is considered literal\ntext, which is copied unchanged to the output. If you need to include\na brace character in the literal text, it can be escaped by doubling:\n"{{" and "}}".\n\nThe grammar for a replacement field is as follows:\n\n replacement_field ::= "{" [field_name] ["!" conversion] [":" format_spec] "}"\n field_name ::= arg_name ("." attribute_name | "[" element_index "]")*\n arg_name ::= [identifier | integer]\n attribute_name ::= identifier\n element_index ::= integer | index_string\n index_string ::= +\n conversion ::= "r" | "s"\n format_spec ::= \n\nIn less formal terms, the replacement field can start with a\n*field_name* that specifies the object whose value is to be formatted\nand inserted into the output instead of the replacement field. The\n*field_name* is optionally followed by a *conversion* field, which is\npreceded by an exclamation point "\'!\'", and a *format_spec*, which is\npreceded by a colon "\':\'". These specify a non-default format for the\nreplacement value.\n\nSee also the Format Specification Mini-Language section.\n\nThe *field_name* itself begins with an *arg_name* that is either a\nnumber or a keyword. If it\'s a number, it refers to a positional\nargument, and if it\'s a keyword, it refers to a named keyword\nargument. If the numerical arg_names in a format string are 0, 1, 2,\n... in sequence, they can all be omitted (not just some) and the\nnumbers 0, 1, 2, ... will be automatically inserted in that order.\nBecause *arg_name* is not quote-delimited, it is not possible to\nspecify arbitrary dictionary keys (e.g., the strings "\'10\'" or\n"\':-]\'") within a format string. The *arg_name* can be followed by any\nnumber of index or attribute expressions. An expression of the form\n"\'.name\'" selects the named attribute using "getattr()", while an\nexpression of the form "\'[index]\'" does an index lookup using\n"__getitem__()".\n\nChanged in version 2.7: The positional argument specifiers can be\nomitted, so "\'{} {}\'" is equivalent to "\'{0} {1}\'".\n\nSome simple format string examples:\n\n "First, thou shalt count to {0}" # References first positional argument\n "Bring me a {}" # Implicitly references the first positional argument\n "From {} to {}" # Same as "From {0} to {1}"\n "My quest is {name}" # References keyword argument \'name\'\n "Weight in tons {0.weight}" # \'weight\' attribute of first positional arg\n "Units destroyed: {players[0]}" # First element of keyword argument \'players\'.\n\nThe *conversion* field causes a type coercion before formatting.\nNormally, the job of formatting a value is done by the "__format__()"\nmethod of the value itself. However, in some cases it is desirable to\nforce a type to be formatted as a string, overriding its own\ndefinition of formatting. By converting the value to a string before\ncalling "__format__()", the normal formatting logic is bypassed.\n\nTwo conversion flags are currently supported: "\'!s\'" which calls\n"str()" on the value, and "\'!r\'" which calls "repr()".\n\nSome examples:\n\n "Harold\'s a clever {0!s}" # Calls str() on the argument first\n "Bring out the holy {name!r}" # Calls repr() on the argument first\n\nThe *format_spec* field contains a specification of how the value\nshould be presented, including such details as field width, alignment,\npadding, decimal precision and so on. Each value type can define its\nown "formatting mini-language" or interpretation of the *format_spec*.\n\nMost built-in types support a common formatting mini-language, which\nis described in the next section.\n\nA *format_spec* field can also include nested replacement fields\nwithin it. These nested replacement fields can contain only a field\nname; conversion flags and format specifications are not allowed. The\nreplacement fields within the format_spec are substituted before the\n*format_spec* string is interpreted. This allows the formatting of a\nvalue to be dynamically specified.\n\nSee the Format examples section for some examples.\n\n\nFormat Specification Mini-Language\n==================================\n\n"Format specifications" are used within replacement fields contained\nwithin a format string to define how individual values are presented\n(see Format String Syntax). They can also be passed directly to the\nbuilt-in "format()" function. Each formattable type may define how\nthe format specification is to be interpreted.\n\nMost built-in types implement the following options for format\nspecifications, although some of the formatting options are only\nsupported by the numeric types.\n\nA general convention is that an empty format string ("""") produces\nthe same result as if you had called "str()" on the value. A non-empty\nformat string typically modifies the result.\n\nThe general form of a *standard format specifier* is:\n\n format_spec ::= [[fill]align][sign][#][0][width][,][.precision][type]\n fill ::= \n align ::= "<" | ">" | "=" | "^"\n sign ::= "+" | "-" | " "\n width ::= integer\n precision ::= integer\n type ::= "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"\n\nIf a valid *align* value is specified, it can be preceded by a *fill*\ncharacter that can be any character and defaults to a space if\nomitted. Note that it is not possible to use "{" and "}" as *fill*\nchar while using the "str.format()" method; this limitation however\ndoesn\'t affect the "format()" function.\n\nThe meaning of the various alignment options is as follows:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'<\'" | Forces the field to be left-aligned within the available |\n | | space (this is the default for most objects). |\n +-----------+------------------------------------------------------------+\n | "\'>\'" | Forces the field to be right-aligned within the available |\n | | space (this is the default for numbers). |\n +-----------+------------------------------------------------------------+\n | "\'=\'" | Forces the padding to be placed after the sign (if any) |\n | | but before the digits. This is used for printing fields |\n | | in the form \'+000000120\'. This alignment option is only |\n | | valid for numeric types. |\n +-----------+------------------------------------------------------------+\n | "\'^\'" | Forces the field to be centered within the available |\n | | space. |\n +-----------+------------------------------------------------------------+\n\nNote that unless a minimum field width is defined, the field width\nwill always be the same size as the data to fill it, so that the\nalignment option has no meaning in this case.\n\nThe *sign* option is only valid for number types, and can be one of\nthe following:\n\n +-----------+------------------------------------------------------------+\n | Option | Meaning |\n +===========+============================================================+\n | "\'+\'" | indicates that a sign should be used for both positive as |\n | | well as negative numbers. |\n +-----------+------------------------------------------------------------+\n | "\'-\'" | indicates that a sign should be used only for negative |\n | | numbers (this is the default behavior). |\n +-----------+------------------------------------------------------------+\n | space | indicates that a leading space should be used on positive |\n | | numbers, and a minus sign on negative numbers. |\n +-----------+------------------------------------------------------------+\n\nThe "\'#\'" option is only valid for integers, and only for binary,\noctal, or hexadecimal output. If present, it specifies that the\noutput will be prefixed by "\'0b\'", "\'0o\'", or "\'0x\'", respectively.\n\nThe "\',\'" option signals the use of a comma for a thousands separator.\nFor a locale aware separator, use the "\'n\'" integer presentation type\ninstead.\n\nChanged in version 2.7: Added the "\',\'" option (see also **PEP 378**).\n\n*width* is a decimal integer defining the minimum field width. If not\nspecified, then the field width will be determined by the content.\n\nPreceding the *width* field by a zero ("\'0\'") character enables sign-\naware zero-padding for numeric types. This is equivalent to a *fill*\ncharacter of "\'0\'" with an *alignment* type of "\'=\'".\n\nThe *precision* is a decimal number indicating how many digits should\nbe displayed after the decimal point for a floating point value\nformatted with "\'f\'" and "\'F\'", or before and after the decimal point\nfor a floating point value formatted with "\'g\'" or "\'G\'". For non-\nnumber types the field indicates the maximum field size - in other\nwords, how many characters will be used from the field content. The\n*precision* is not allowed for integer values.\n\nFinally, the *type* determines how the data should be presented.\n\nThe available string presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'s\'" | String format. This is the default type for strings and |\n | | may be omitted. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'s\'". |\n +-----------+------------------------------------------------------------+\n\nThe available integer presentation types are:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'b\'" | Binary format. Outputs the number in base 2. |\n +-----------+------------------------------------------------------------+\n | "\'c\'" | Character. Converts the integer to the corresponding |\n | | unicode character before printing. |\n +-----------+------------------------------------------------------------+\n | "\'d\'" | Decimal Integer. Outputs the number in base 10. |\n +-----------+------------------------------------------------------------+\n | "\'o\'" | Octal format. Outputs the number in base 8. |\n +-----------+------------------------------------------------------------+\n | "\'x\'" | Hex format. Outputs the number in base 16, using lower- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'X\'" | Hex format. Outputs the number in base 16, using upper- |\n | | case letters for the digits above 9. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'d\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'d\'". |\n +-----------+------------------------------------------------------------+\n\nIn addition to the above presentation types, integers can be formatted\nwith the floating point presentation types listed below (except "\'n\'"\nand None). When doing so, "float()" is used to convert the integer to\na floating point number before formatting.\n\nThe available presentation types for floating point and decimal values\nare:\n\n +-----------+------------------------------------------------------------+\n | Type | Meaning |\n +===========+============================================================+\n | "\'e\'" | Exponent notation. Prints the number in scientific |\n | | notation using the letter \'e\' to indicate the exponent. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'E\'" | Exponent notation. Same as "\'e\'" except it uses an upper |\n | | case \'E\' as the separator character. |\n +-----------+------------------------------------------------------------+\n | "\'f\'" | Fixed point. Displays the number as a fixed-point number. |\n | | The default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'F\'" | Fixed point. Same as "\'f\'". |\n +-----------+------------------------------------------------------------+\n | "\'g\'" | General format. For a given precision "p >= 1", this |\n | | rounds the number to "p" significant digits and then |\n | | formats the result in either fixed-point format or in |\n | | scientific notation, depending on its magnitude. The |\n | | precise rules are as follows: suppose that the result |\n | | formatted with presentation type "\'e\'" and precision "p-1" |\n | | would have exponent "exp". Then if "-4 <= exp < p", the |\n | | number is formatted with presentation type "\'f\'" and |\n | | precision "p-1-exp". Otherwise, the number is formatted |\n | | with presentation type "\'e\'" and precision "p-1". In both |\n | | cases insignificant trailing zeros are removed from the |\n | | significand, and the decimal point is also removed if |\n | | there are no remaining digits following it. Positive and |\n | | negative infinity, positive and negative zero, and nans, |\n | | are formatted as "inf", "-inf", "0", "-0" and "nan" |\n | | respectively, regardless of the precision. A precision of |\n | | "0" is treated as equivalent to a precision of "1". The |\n | | default precision is "6". |\n +-----------+------------------------------------------------------------+\n | "\'G\'" | General format. Same as "\'g\'" except switches to "\'E\'" if |\n | | the number gets too large. The representations of infinity |\n | | and NaN are uppercased, too. |\n +-----------+------------------------------------------------------------+\n | "\'n\'" | Number. This is the same as "\'g\'", except that it uses the |\n | | current locale setting to insert the appropriate number |\n | | separator characters. |\n +-----------+------------------------------------------------------------+\n | "\'%\'" | Percentage. Multiplies the number by 100 and displays in |\n | | fixed ("\'f\'") format, followed by a percent sign. |\n +-----------+------------------------------------------------------------+\n | None | The same as "\'g\'". |\n +-----------+------------------------------------------------------------+\n\n\nFormat examples\n===============\n\nThis section contains examples of the new format syntax and comparison\nwith the old "%"-formatting.\n\nIn most of the cases the syntax is similar to the old "%"-formatting,\nwith the addition of the "{}" and with ":" used instead of "%". For\nexample, "\'%03.2f\'" can be translated to "\'{:03.2f}\'".\n\nThe new format syntax also supports new and different options, shown\nin the follow examples.\n\nAccessing arguments by position:\n\n >>> \'{0}, {1}, {2}\'.format(\'a\', \'b\', \'c\')\n \'a, b, c\'\n >>> \'{}, {}, {}\'.format(\'a\', \'b\', \'c\') # 2.7+ only\n \'a, b, c\'\n >>> \'{2}, {1}, {0}\'.format(\'a\', \'b\', \'c\')\n \'c, b, a\'\n >>> \'{2}, {1}, {0}\'.format(*\'abc\') # unpacking argument sequence\n \'c, b, a\'\n >>> \'{0}{1}{0}\'.format(\'abra\', \'cad\') # arguments\' indices can be repeated\n \'abracadabra\'\n\nAccessing arguments by name:\n\n >>> \'Coordinates: {latitude}, {longitude}\'.format(latitude=\'37.24N\', longitude=\'-115.81W\')\n \'Coordinates: 37.24N, -115.81W\'\n >>> coord = {\'latitude\': \'37.24N\', \'longitude\': \'-115.81W\'}\n >>> \'Coordinates: {latitude}, {longitude}\'.format(**coord)\n \'Coordinates: 37.24N, -115.81W\'\n\nAccessing arguments\' attributes:\n\n >>> c = 3-5j\n >>> (\'The complex number {0} is formed from the real part {0.real} \'\n ... \'and the imaginary part {0.imag}.\').format(c)\n \'The complex number (3-5j) is formed from the real part 3.0 and the imaginary part -5.0.\'\n >>> class Point(object):\n ... def __init__(self, x, y):\n ... self.x, self.y = x, y\n ... def __str__(self):\n ... return \'Point({self.x}, {self.y})\'.format(self=self)\n ...\n >>> str(Point(4, 2))\n \'Point(4, 2)\'\n\nAccessing arguments\' items:\n\n >>> coord = (3, 5)\n >>> \'X: {0[0]}; Y: {0[1]}\'.format(coord)\n \'X: 3; Y: 5\'\n\nReplacing "%s" and "%r":\n\n >>> "repr() shows quotes: {!r}; str() doesn\'t: {!s}".format(\'test1\', \'test2\')\n "repr() shows quotes: \'test1\'; str() doesn\'t: test2"\n\nAligning the text and specifying a width:\n\n >>> \'{:<30}\'.format(\'left aligned\')\n \'left aligned \'\n >>> \'{:>30}\'.format(\'right aligned\')\n \' right aligned\'\n >>> \'{:^30}\'.format(\'centered\')\n \' centered \'\n >>> \'{:*^30}\'.format(\'centered\') # use \'*\' as a fill char\n \'***********centered***********\'\n\nReplacing "%+f", "%-f", and "% f" and specifying a sign:\n\n >>> \'{:+f}; {:+f}\'.format(3.14, -3.14) # show it always\n \'+3.140000; -3.140000\'\n >>> \'{: f}; {: f}\'.format(3.14, -3.14) # show a space for positive numbers\n \' 3.140000; -3.140000\'\n >>> \'{:-f}; {:-f}\'.format(3.14, -3.14) # show only the minus -- same as \'{:f}; {:f}\'\n \'3.140000; -3.140000\'\n\nReplacing "%x" and "%o" and converting the value to different bases:\n\n >>> # format also supports binary numbers\n >>> "int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}".format(42)\n \'int: 42; hex: 2a; oct: 52; bin: 101010\'\n >>> # with 0x, 0o, or 0b as prefix:\n >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42)\n \'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010\'\n\nUsing the comma as a thousands separator:\n\n >>> \'{:,}\'.format(1234567890)\n \'1,234,567,890\'\n\nExpressing a percentage:\n\n >>> points = 19.5\n >>> total = 22\n >>> \'Correct answers: {:.2%}\'.format(points/total)\n \'Correct answers: 88.64%\'\n\nUsing type-specific formatting:\n\n >>> import datetime\n >>> d = datetime.datetime(2010, 7, 4, 12, 15, 58)\n >>> \'{:%Y-%m-%d %H:%M:%S}\'.format(d)\n \'2010-07-04 12:15:58\'\n\nNesting arguments and more complex examples:\n\n >>> for align, text in zip(\'<^>\', [\'left\', \'center\', \'right\']):\n ... \'{0:{fill}{align}16}\'.format(text, fill=align, align=align)\n ...\n \'left<<<<<<<<<<<<\'\n \'^^^^^center^^^^^\'\n \'>>>>>>>>>>>right\'\n >>>\n >>> octets = [192, 168, 0, 1]\n >>> \'{:02X}{:02X}{:02X}{:02X}\'.format(*octets)\n \'C0A80001\'\n >>> int(_, 16)\n 3232235521\n >>>\n >>> width = 5\n >>> for num in range(5,12):\n ... for base in \'dXob\':\n ... print \'{0:{width}{base}}\'.format(num, base=base, width=width),\n ... print\n ...\n 5 5 5 101\n 6 6 6 110\n 7 7 7 111\n 8 8 10 1000\n 9 9 11 1001\n 10 A 12 1010\n 11 B 13 1011\n', - 'function': u'\nFunction definitions\n********************\n\nA function definition defines a user-defined function object (see\nsection The standard type hierarchy):\n\n decorated ::= decorators (classdef | funcdef)\n decorators ::= decorator+\n decorator ::= "@" dotted_name ["(" [argument_list [","]] ")"] NEWLINE\n funcdef ::= "def" funcname "(" [parameter_list] ")" ":" suite\n dotted_name ::= identifier ("." identifier)*\n parameter_list ::= (defparameter ",")*\n ( "*" identifier ["," "**" identifier]\n | "**" identifier\n | defparameter [","] )\n defparameter ::= parameter ["=" expression]\n sublist ::= parameter ("," parameter)* [","]\n parameter ::= identifier | "(" sublist ")"\n funcname ::= identifier\n\nA function definition is an executable statement. Its execution binds\nthe function name in the current local namespace to a function object\n(a wrapper around the executable code for the function). This\nfunction object contains a reference to the current global namespace\nas the global namespace to be used when the function is called.\n\nThe function definition does not execute the function body; this gets\nexecuted only when the function is called. [3]\n\nA function definition may be wrapped by one or more *decorator*\nexpressions. Decorator expressions are evaluated when the function is\ndefined, in the scope that contains the function definition. The\nresult must be a callable, which is invoked with the function object\nas the only argument. The returned value is bound to the function name\ninstead of the function object. Multiple decorators are applied in\nnested fashion. For example, the following code:\n\n @f1(arg)\n @f2\n def func(): pass\n\nis equivalent to:\n\n def func(): pass\n func = f1(arg)(f2(func))\n\nWhen one or more top-level *parameters* have the form *parameter* "="\n*expression*, the function is said to have "default parameter values."\nFor a parameter with a default value, the corresponding *argument* may\nbe omitted from a call, in which case the parameter\'s default value is\nsubstituted. If a parameter has a default value, all following\nparameters must also have a default value --- this is a syntactic\nrestriction that is not expressed by the grammar.\n\n**Default parameter values are evaluated when the function definition\nis executed.** This means that the expression is evaluated once, when\nthe function is defined, and that the same "pre-computed" value is\nused for each call. This is especially important to understand when a\ndefault parameter is a mutable object, such as a list or a dictionary:\nif the function modifies the object (e.g. by appending an item to a\nlist), the default value is in effect modified. This is generally not\nwhat was intended. A way around this is to use "None" as the\ndefault, and explicitly test for it in the body of the function, e.g.:\n\n def whats_on_the_telly(penguin=None):\n if penguin is None:\n penguin = []\n penguin.append("property of the zoo")\n return penguin\n\nFunction call semantics are described in more detail in section Calls.\nA function call always assigns values to all parameters mentioned in\nthe parameter list, either from position arguments, from keyword\narguments, or from default values. If the form ""*identifier"" is\npresent, it is initialized to a tuple receiving any excess positional\nparameters, defaulting to the empty tuple. If the form\n""**identifier"" is present, it is initialized to a new dictionary\nreceiving any excess keyword arguments, defaulting to a new empty\ndictionary.\n\nIt is also possible to create anonymous functions (functions not bound\nto a name), for immediate use in expressions. This uses lambda\nexpressions, described in section Lambdas. Note that the lambda\nexpression is merely a shorthand for a simplified function definition;\na function defined in a ""def"" statement can be passed around or\nassigned to another name just like a function defined by a lambda\nexpression. The ""def"" form is actually more powerful since it\nallows the execution of multiple statements.\n\n**Programmer\'s note:** Functions are first-class objects. A ""def""\nform executed inside a function definition defines a local function\nthat can be returned or passed around. Free variables used in the\nnested function can access the local variables of the function\ncontaining the def. See section Naming and binding for details.\n', - 'global': u'\nThe "global" statement\n**********************\n\n global_stmt ::= "global" identifier ("," identifier)*\n\nThe "global" statement is a declaration which holds for the entire\ncurrent code block. It means that the listed identifiers are to be\ninterpreted as globals. It would be impossible to assign to a global\nvariable without "global", although free variables may refer to\nglobals without being declared global.\n\nNames listed in a "global" statement must not be used in the same code\nblock textually preceding that "global" statement.\n\nNames listed in a "global" statement must not be defined as formal\nparameters or in a "for" loop control target, "class" definition,\nfunction definition, or "import" statement.\n\n**CPython implementation detail:** The current implementation does not\nenforce the latter two restrictions, but programs should not abuse\nthis freedom, as future implementations may enforce them or silently\nchange the meaning of the program.\n\n**Programmer\'s note:** the "global" is a directive to the parser. It\napplies only to code parsed at the same time as the "global"\nstatement. In particular, a "global" statement contained in an "exec"\nstatement does not affect the code block *containing* the "exec"\nstatement, and code contained in an "exec" statement is unaffected by\n"global" statements in the code containing the "exec" statement. The\nsame applies to the "eval()", "execfile()" and "compile()" functions.\n', - 'id-classes': u'\nReserved classes of identifiers\n*******************************\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "__builtin__" module. When\n not in interactive mode, "_" has no special meaning and is not\n defined. See section The import statement.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the Special method names section and\n elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section Identifiers (Names).\n', - 'identifiers': u'\nIdentifiers and keywords\n************************\n\nIdentifiers (also referred to as *names*) are described by the\nfollowing lexical definitions:\n\n identifier ::= (letter|"_") (letter | digit | "_")*\n letter ::= lowercase | uppercase\n lowercase ::= "a"..."z"\n uppercase ::= "A"..."Z"\n digit ::= "0"..."9"\n\nIdentifiers are unlimited in length. Case is significant.\n\n\nKeywords\n========\n\nThe following identifiers are used as reserved words, or *keywords* of\nthe language, and cannot be used as ordinary identifiers. They must\nbe spelled exactly as written here:\n\n and del from not while\n as elif global or with\n assert else if pass yield\n break except import print\n class exec in raise\n continue finally is return\n def for lambda try\n\nChanged in version 2.4: "None" became a constant and is now recognized\nby the compiler as a name for the built-in object "None". Although it\nis not a keyword, you cannot assign a different object to it.\n\nChanged in version 2.5: Using "as" and "with" as identifiers triggers\na warning. To use them as keywords, enable the "with_statement"\nfuture feature .\n\nChanged in version 2.6: "as" and "with" are full keywords.\n\n\nReserved classes of identifiers\n===============================\n\nCertain classes of identifiers (besides keywords) have special\nmeanings. These classes are identified by the patterns of leading and\ntrailing underscore characters:\n\n"_*"\n Not imported by "from module import *". The special identifier "_"\n is used in the interactive interpreter to store the result of the\n last evaluation; it is stored in the "__builtin__" module. When\n not in interactive mode, "_" has no special meaning and is not\n defined. See section The import statement.\n\n Note: The name "_" is often used in conjunction with\n internationalization; refer to the documentation for the\n "gettext" module for more information on this convention.\n\n"__*__"\n System-defined names. These names are defined by the interpreter\n and its implementation (including the standard library). Current\n system names are discussed in the Special method names section and\n elsewhere. More will likely be defined in future versions of\n Python. *Any* use of "__*__" names, in any context, that does not\n follow explicitly documented use, is subject to breakage without\n warning.\n\n"__*"\n Class-private names. Names in this category, when used within the\n context of a class definition, are re-written to use a mangled form\n to help avoid name clashes between "private" attributes of base and\n derived classes. See section Identifiers (Names).\n', - 'if': u'\nThe "if" statement\n******************\n\nThe "if" statement is used for conditional execution:\n\n if_stmt ::= "if" expression ":" suite\n ( "elif" expression ":" suite )*\n ["else" ":" suite]\n\nIt selects exactly one of the suites by evaluating the expressions one\nby one until one is found to be true (see section Boolean operations\nfor the definition of true and false); then that suite is executed\n(and no other part of the "if" statement is executed or evaluated).\nIf all expressions are false, the suite of the "else" clause, if\npresent, is executed.\n', - 'imaginary': u'\nImaginary literals\n******************\n\nImaginary literals are described by the following lexical definitions:\n\n imagnumber ::= (floatnumber | intpart) ("j" | "J")\n\nAn imaginary literal yields a complex number with a real part of 0.0.\nComplex numbers are represented as a pair of floating point numbers\nand have the same restrictions on their range. To create a complex\nnumber with a nonzero real part, add a floating point number to it,\ne.g., "(3+4j)". Some examples of imaginary literals:\n\n 3.14j 10.j 10j .001j 1e100j 3.14e-10j\n', - 'import': u'\nThe "import" statement\n**********************\n\n import_stmt ::= "import" module ["as" name] ( "," module ["as" name] )*\n | "from" relative_module "import" identifier ["as" name]\n ( "," identifier ["as" name] )*\n | "from" relative_module "import" "(" identifier ["as" name]\n ( "," identifier ["as" name] )* [","] ")"\n | "from" module "import" "*"\n module ::= (identifier ".")* identifier\n relative_module ::= "."* module | "."+\n name ::= identifier\n\nImport statements are executed in two steps: (1) find a module, and\ninitialize it if necessary; (2) define a name or names in the local\nnamespace (of the scope where the "import" statement occurs). The\nstatement comes in two forms differing on whether it uses the "from"\nkeyword. The first form (without "from") repeats these steps for each\nidentifier in the list. The form with "from" performs step (1) once,\nand then performs step (2) repeatedly.\n\nTo understand how step (1) occurs, one must first understand how\nPython handles hierarchical naming of modules. To help organize\nmodules and provide a hierarchy in naming, Python has a concept of\npackages. A package can contain other packages and modules while\nmodules cannot contain other modules or packages. From a file system\nperspective, packages are directories and modules are files.\n\nOnce the name of the module is known (unless otherwise specified, the\nterm "module" will refer to both packages and modules), searching for\nthe module or package can begin. The first place checked is\n"sys.modules", the cache of all modules that have been imported\npreviously. If the module is found there then it is used in step (2)\nof import.\n\nIf the module is not found in the cache, then "sys.meta_path" is\nsearched (the specification for "sys.meta_path" can be found in **PEP\n302**). The object is a list of *finder* objects which are queried in\norder as to whether they know how to load the module by calling their\n"find_module()" method with the name of the module. If the module\nhappens to be contained within a package (as denoted by the existence\nof a dot in the name), then a second argument to "find_module()" is\ngiven as the value of the "__path__" attribute from the parent package\n(everything up to the last dot in the name of the module being\nimported). If a finder can find the module it returns a *loader*\n(discussed later) or returns "None".\n\nIf none of the finders on "sys.meta_path" are able to find the module\nthen some implicitly defined finders are queried. Implementations of\nPython vary in what implicit meta path finders are defined. The one\nthey all do define, though, is one that handles "sys.path_hooks",\n"sys.path_importer_cache", and "sys.path".\n\nThe implicit finder searches for the requested module in the "paths"\nspecified in one of two places ("paths" do not have to be file system\npaths). If the module being imported is supposed to be contained\nwithin a package then the second argument passed to "find_module()",\n"__path__" on the parent package, is used as the source of paths. If\nthe module is not contained in a package then "sys.path" is used as\nthe source of paths.\n\nOnce the source of paths is chosen it is iterated over to find a\nfinder that can handle that path. The dict at\n"sys.path_importer_cache" caches finders for paths and is checked for\na finder. If the path does not have a finder cached then\n"sys.path_hooks" is searched by calling each object in the list with a\nsingle argument of the path, returning a finder or raises\n"ImportError". If a finder is returned then it is cached in\n"sys.path_importer_cache" and then used for that path entry. If no\nfinder can be found but the path exists then a value of "None" is\nstored in "sys.path_importer_cache" to signify that an implicit, file-\nbased finder that handles modules stored as individual files should be\nused for that path. If the path does not exist then a finder which\nalways returns "None" is placed in the cache for the path.\n\nIf no finder can find the module then "ImportError" is raised.\nOtherwise some finder returned a loader whose "load_module()" method\nis called with the name of the module to load (see **PEP 302** for the\noriginal definition of loaders). A loader has several responsibilities\nto perform on a module it loads. First, if the module already exists\nin "sys.modules" (a possibility if the loader is called outside of the\nimport machinery) then it is to use that module for initialization and\nnot a new module. But if the module does not exist in "sys.modules"\nthen it is to be added to that dict before initialization begins. If\nan error occurs during loading of the module and it was added to\n"sys.modules" it is to be removed from the dict. If an error occurs\nbut the module was already in "sys.modules" it is left in the dict.\n\nThe loader must set several attributes on the module. "__name__" is to\nbe set to the name of the module. "__file__" is to be the "path" to\nthe file unless the module is built-in (and thus listed in\n"sys.builtin_module_names") in which case the attribute is not set. If\nwhat is being imported is a package then "__path__" is to be set to a\nlist of paths to be searched when looking for modules and packages\ncontained within the package being imported. "__package__" is optional\nbut should be set to the name of package that contains the module or\npackage (the empty string is used for module not contained in a\npackage). "__loader__" is also optional but should be set to the\nloader object that is loading the module.\n\nIf an error occurs during loading then the loader raises "ImportError"\nif some other exception is not already being propagated. Otherwise the\nloader returns the module that was loaded and initialized.\n\nWhen step (1) finishes without raising an exception, step (2) can\nbegin.\n\nThe first form of "import" statement binds the module name in the\nlocal namespace to the module object, and then goes on to import the\nnext identifier, if any. If the module name is followed by "as", the\nname following "as" is used as the local name for the module.\n\nThe "from" form does not bind the module name: it goes through the\nlist of identifiers, looks each one of them up in the module found in\nstep (1), and binds the name in the local namespace to the object thus\nfound. As with the first form of "import", an alternate local name\ncan be supplied by specifying ""as" localname". If a name is not\nfound, "ImportError" is raised. If the list of identifiers is\nreplaced by a star ("\'*\'"), all public names defined in the module are\nbound in the local namespace of the "import" statement..\n\nThe *public names* defined by a module are determined by checking the\nmodule\'s namespace for a variable named "__all__"; if defined, it must\nbe a sequence of strings which are names defined or imported by that\nmodule. The names given in "__all__" are all considered public and\nare required to exist. If "__all__" is not defined, the set of public\nnames includes all names found in the module\'s namespace which do not\nbegin with an underscore character ("\'_\'"). "__all__" should contain\nthe entire public API. It is intended to avoid accidentally exporting\nitems that are not part of the API (such as library modules which were\nimported and used within the module).\n\nThe "from" form with "*" may only occur in a module scope. If the\nwild card form of import --- "import *" --- is used in a function and\nthe function contains or is a nested block with free variables, the\ncompiler will raise a "SyntaxError".\n\nWhen specifying what module to import you do not have to specify the\nabsolute name of the module. When a module or package is contained\nwithin another package it is possible to make a relative import within\nthe same top package without having to mention the package name. By\nusing leading dots in the specified module or package after "from" you\ncan specify how high to traverse up the current package hierarchy\nwithout specifying exact names. One leading dot means the current\npackage where the module making the import exists. Two dots means up\none package level. Three dots is up two levels, etc. So if you execute\n"from . import mod" from a module in the "pkg" package then you will\nend up importing "pkg.mod". If you execute "from ..subpkg2 import mod"\nfrom within "pkg.subpkg1" you will import "pkg.subpkg2.mod". The\nspecification for relative imports is contained within **PEP 328**.\n\n"importlib.import_module()" is provided to support applications that\ndetermine which modules need to be loaded dynamically.\n\n\nFuture statements\n=================\n\nA *future statement* is a directive to the compiler that a particular\nmodule should be compiled using syntax or semantics that will be\navailable in a specified future release of Python. The future\nstatement is intended to ease migration to future versions of Python\nthat introduce incompatible changes to the language. It allows use of\nthe new features on a per-module basis before the release in which the\nfeature becomes standard.\n\n future_statement ::= "from" "__future__" "import" feature ["as" name]\n ("," feature ["as" name])*\n | "from" "__future__" "import" "(" feature ["as" name]\n ("," feature ["as" name])* [","] ")"\n feature ::= identifier\n name ::= identifier\n\nA future statement must appear near the top of the module. The only\nlines that can appear before a future statement are:\n\n* the module docstring (if any),\n\n* comments,\n\n* blank lines, and\n\n* other future statements.\n\nThe features recognized by Python 2.6 are "unicode_literals",\n"print_function", "absolute_import", "division", "generators",\n"nested_scopes" and "with_statement". "generators", "with_statement",\n"nested_scopes" are redundant in Python version 2.6 and above because\nthey are always enabled.\n\nA future statement is recognized and treated specially at compile\ntime: Changes to the semantics of core constructs are often\nimplemented by generating different code. It may even be the case\nthat a new feature introduces new incompatible syntax (such as a new\nreserved word), in which case the compiler may need to parse the\nmodule differently. Such decisions cannot be pushed off until\nruntime.\n\nFor any given release, the compiler knows which feature names have\nbeen defined, and raises a compile-time error if a future statement\ncontains a feature not known to it.\n\nThe direct runtime semantics are the same as for any import statement:\nthere is a standard module "__future__", described later, and it will\nbe imported in the usual way at the time the future statement is\nexecuted.\n\nThe interesting runtime semantics depend on the specific feature\nenabled by the future statement.\n\nNote that there is nothing special about the statement:\n\n import __future__ [as name]\n\nThat is not a future statement; it\'s an ordinary import statement with\nno special semantics or syntax restrictions.\n\nCode compiled by an "exec" statement or calls to the built-in\nfunctions "compile()" and "execfile()" that occur in a module "M"\ncontaining a future statement will, by default, use the new syntax or\nsemantics associated with the future statement. This can, starting\nwith Python 2.2 be controlled by optional arguments to "compile()" ---\nsee the documentation of that function for details.\n\nA future statement typed at an interactive interpreter prompt will\ntake effect for the rest of the interpreter session. If an\ninterpreter is started with the "-i" option, is passed a script name\nto execute, and the script includes a future statement, it will be in\neffect in the interactive session started after the script is\nexecuted.\n\nSee also: **PEP 236** - Back to the __future__\n\n The original proposal for the __future__ mechanism.\n', - 'in': u'\nComparisons\n***********\n\nUnlike C, all comparison operations in Python have the same priority,\nwhich is lower than that of any arithmetic, shifting or bitwise\noperation. Also unlike C, expressions like "a < b < c" have the\ninterpretation that is conventional in mathematics:\n\n comparison ::= or_expr ( comp_operator or_expr )*\n comp_operator ::= "<" | ">" | "==" | ">=" | "<=" | "<>" | "!="\n | "is" ["not"] | ["not"] "in"\n\nComparisons yield boolean values: "True" or "False".\n\nComparisons can be chained arbitrarily, e.g., "x < y <= z" is\nequivalent to "x < y and y <= z", except that "y" is evaluated only\nonce (but in both cases "z" is not evaluated at all when "x < y" is\nfound to be false).\n\nFormally, if *a*, *b*, *c*, ..., *y*, *z* are expressions and *op1*,\n*op2*, ..., *opN* are comparison operators, then "a op1 b op2 c ... y\nopN z" is equivalent to "a op1 b and b op2 c and ... y opN z", except\nthat each expression is evaluated at most once.\n\nNote that "a op1 b op2 c" doesn\'t imply any kind of comparison between\n*a* and *c*, so that, e.g., "x < y > z" is perfectly legal (though\nperhaps not pretty).\n\nThe forms "<>" and "!=" are equivalent; for consistency with C, "!="\nis preferred; where "!=" is mentioned below "<>" is also accepted.\nThe "<>" spelling is considered obsolescent.\n\nThe operators "<", ">", "==", ">=", "<=", and "!=" compare the values\nof two objects. The objects need not have the same type. If both are\nnumbers, they are converted to a common type. Otherwise, objects of\ndifferent types *always* compare unequal, and are ordered consistently\nbut arbitrarily. You can control comparison behavior of objects of\nnon-built-in types by defining a "__cmp__" method or rich comparison\nmethods like "__gt__", described in section Special method names.\n\n(This unusual definition of comparison was used to simplify the\ndefinition of operations like sorting and the "in" and "not in"\noperators. In the future, the comparison rules for objects of\ndifferent types are likely to change.)\n\nComparison of objects of the same type depends on the type:\n\n* Numbers are compared arithmetically.\n\n* Strings are compared lexicographically using the numeric\n equivalents (the result of the built-in function "ord()") of their\n characters. Unicode and 8-bit strings are fully interoperable in\n this behavior. [4]\n\n* Tuples and lists are compared lexicographically using comparison\n of corresponding elements. This means that to compare equal, each\n element must compare equal and the two sequences must be of the same\n type and have the same length.\n\n If not equal, the sequences are ordered the same as their first\n differing elements. For example, "cmp([1,2,x], [1,2,y])" returns\n the same as "cmp(x,y)". If the corresponding element does not\n exist, the shorter sequence is ordered first (for example, "[1,2] <\n [1,2,3]").\n\n* Mappings (dictionaries) compare equal if and only if their sorted\n (key, value) lists compare equal. [5] Outcomes other than equality\n are resolved consistently, but are not otherwise defined. [6]\n\n* Most other objects of built-in types compare unequal unless they\n are the same object; the choice whether one object is considered\n smaller or larger than another one is made arbitrarily but\n consistently within one execution of a program.\n\nThe operators "in" and "not in" test for collection membership. "x in\ns" evaluates to true if *x* is a member of the collection *s*, and\nfalse otherwise. "x not in s" returns the negation of "x in s". The\ncollection membership test has traditionally been bound to sequences;\nan object is a member of a collection if the collection is a sequence\nand contains an element equal to that object. However, it make sense\nfor many other object types to support membership tests without being\na sequence. In particular, dictionaries (for keys) and sets support\nmembership testing.\n\nFor the list and tuple types, "x in y" is true if and only if there\nexists an index *i* such that "x == y[i]" is true.\n\nFor the Unicode and string types, "x in y" is true if and only if *x*\nis a substring of *y*. An equivalent test is "y.find(x) != -1".\nNote, *x* and *y* need not be the same type; consequently, "u\'ab\' in\n\'abc\'" will return "True". Empty strings are always considered to be a\nsubstring of any other string, so """ in "abc"" will return "True".\n\nChanged in version 2.3: Previously, *x* was required to be a string of\nlength "1".\n\nFor user-defined classes which define the "__contains__()" method, "x\nin y" is true if and only if "y.__contains__(x)" is true.\n\nFor user-defined classes which do not define "__contains__()" but do\ndefine "__iter__()", "x in y" is true if some value "z" with "x == z"\nis produced while iterating over "y". If an exception is raised\nduring the iteration, it is as if "in" raised that exception.\n\nLastly, the old-style iteration protocol is tried: if a class defines\n"__getitem__()", "x in y" is true if and only if there is a non-\nnegative integer index *i* such that "x == y[i]", and all lower\ninteger indices do not raise "IndexError" exception. (If any other\nexception is raised, it is as if "in" raised that exception).\n\nThe operator "not in" is defined to have the inverse true value of\n"in".\n\nThe operators "is" and "is not" test for object identity: "x is y" is\ntrue if and only if *x* and *y* are the same object. "x is not y"\nyields the inverse truth value. [7]\n', - 'integers': u'\nInteger and long integer literals\n*********************************\n\nInteger and long integer literals are described by the following\nlexical definitions:\n\n longinteger ::= integer ("l" | "L")\n integer ::= decimalinteger | octinteger | hexinteger | bininteger\n decimalinteger ::= nonzerodigit digit* | "0"\n octinteger ::= "0" ("o" | "O") octdigit+ | "0" octdigit+\n hexinteger ::= "0" ("x" | "X") hexdigit+\n bininteger ::= "0" ("b" | "B") bindigit+\n nonzerodigit ::= "1"..."9"\n octdigit ::= "0"..."7"\n bindigit ::= "0" | "1"\n hexdigit ::= digit | "a"..."f" | "A"..."F"\n\nAlthough both lower case "\'l\'" and upper case "\'L\'" are allowed as\nsuffix for long integers, it is strongly recommended to always use\n"\'L\'", since the letter "\'l\'" looks too much like the digit "\'1\'".\n\nPlain integer literals that are above the largest representable plain\ninteger (e.g., 2147483647 when using 32-bit arithmetic) are accepted\nas if they were long integers instead. [1] There is no limit for long\ninteger literals apart from what can be stored in available memory.\n\nSome examples of plain integer literals (first row) and long integer\nliterals (second and third rows):\n\n 7 2147483647 0177\n 3L 79228162514264337593543950336L 0377L 0x100000000L\n 79228162514264337593543950336 0xdeadbeef\n', - 'lambda': u'\nLambdas\n*******\n\n lambda_expr ::= "lambda" [parameter_list]: expression\n old_lambda_expr ::= "lambda" [parameter_list]: old_expression\n\nLambda expressions (sometimes called lambda forms) have the same\nsyntactic position as expressions. They are a shorthand to create\nanonymous functions; the expression "lambda arguments: expression"\nyields a function object. The unnamed object behaves like a function\nobject defined with\n\n def name(arguments):\n return expression\n\nSee section Function definitions for the syntax of parameter lists.\nNote that functions created with lambda expressions cannot contain\nstatements.\n', - 'lists': u'\nList displays\n*************\n\nA list display is a possibly empty series of expressions enclosed in\nsquare brackets:\n\n list_display ::= "[" [expression_list | list_comprehension] "]"\n list_comprehension ::= expression list_for\n list_for ::= "for" target_list "in" old_expression_list [list_iter]\n old_expression_list ::= old_expression [("," old_expression)+ [","]]\n old_expression ::= or_test | old_lambda_expr\n list_iter ::= list_for | list_if\n list_if ::= "if" old_expression [list_iter]\n\nA list display yields a new list object. Its contents are specified\nby providing either a list of expressions or a list comprehension.\nWhen a comma-separated list of expressions is supplied, its elements\nare evaluated from left to right and placed into the list object in\nthat order. When a list comprehension is supplied, it consists of a\nsingle expression followed by at least one "for" clause and zero or\nmore "for" or "if" clauses. In this case, the elements of the new\nlist are those that would be produced by considering each of the "for"\nor "if" clauses a block, nesting from left to right, and evaluating\nthe expression to produce a list element each time the innermost block\nis reached [1].\n', - 'naming': u'\nNaming and binding\n******************\n\n*Names* refer to objects. Names are introduced by name binding\noperations. Each occurrence of a name in the program text refers to\nthe *binding* of that name established in the innermost function block\ncontaining the use.\n\nA *block* is a piece of Python program text that is executed as a\nunit. The following are blocks: a module, a function body, and a class\ndefinition. Each command typed interactively is a block. A script\nfile (a file given as standard input to the interpreter or specified\non the interpreter command line the first argument) is a code block.\nA script command (a command specified on the interpreter command line\nwith the \'**-c**\' option) is a code block. The file read by the\nbuilt-in function "execfile()" is a code block. The string argument\npassed to the built-in function "eval()" and to the "exec" statement\nis a code block. The expression read and evaluated by the built-in\nfunction "input()" is a code block.\n\nA code block is executed in an *execution frame*. A frame contains\nsome administrative information (used for debugging) and determines\nwhere and how execution continues after the code block\'s execution has\ncompleted.\n\nA *scope* defines the visibility of a name within a block. If a local\nvariable is defined in a block, its scope includes that block. If the\ndefinition occurs in a function block, the scope extends to any blocks\ncontained within the defining one, unless a contained block introduces\na different binding for the name. The scope of names defined in a\nclass block is limited to the class block; it does not extend to the\ncode blocks of methods -- this includes generator expressions since\nthey are implemented using a function scope. This means that the\nfollowing will fail:\n\n class A:\n a = 42\n b = list(a + i for i in range(10))\n\nWhen a name is used in a code block, it is resolved using the nearest\nenclosing scope. The set of all such scopes visible to a code block\nis called the block\'s *environment*.\n\nIf a name is bound in a block, it is a local variable of that block.\nIf a name is bound at the module level, it is a global variable. (The\nvariables of the module code block are local and global.) If a\nvariable is used in a code block but not defined there, it is a *free\nvariable*.\n\nWhen a name is not found at all, a "NameError" exception is raised.\nIf the name refers to a local variable that has not been bound, a\n"UnboundLocalError" exception is raised. "UnboundLocalError" is a\nsubclass of "NameError".\n\nThe following constructs bind names: formal parameters to functions,\n"import" statements, class and function definitions (these bind the\nclass or function name in the defining block), and targets that are\nidentifiers if occurring in an assignment, "for" loop header, in the\nsecond position of an "except" clause header or after "as" in a "with"\nstatement. The "import" statement of the form "from ... import *"\nbinds all names defined in the imported module, except those beginning\nwith an underscore. This form may only be used at the module level.\n\nA target occurring in a "del" statement is also considered bound for\nthis purpose (though the actual semantics are to unbind the name). It\nis illegal to unbind a name that is referenced by an enclosing scope;\nthe compiler will report a "SyntaxError".\n\nEach assignment or import statement occurs within a block defined by a\nclass or function definition or at the module level (the top-level\ncode block).\n\nIf a name binding operation occurs anywhere within a code block, all\nuses of the name within the block are treated as references to the\ncurrent block. This can lead to errors when a name is used within a\nblock before it is bound. This rule is subtle. Python lacks\ndeclarations and allows name binding operations to occur anywhere\nwithin a code block. The local variables of a code block can be\ndetermined by scanning the entire text of the block for name binding\noperations.\n\nIf the global statement occurs within a block, all uses of the name\nspecified in the statement refer to the binding of that name in the\ntop-level namespace. Names are resolved in the top-level namespace by\nsearching the global namespace, i.e. the namespace of the module\ncontaining the code block, and the builtins namespace, the namespace\nof the module "__builtin__". The global namespace is searched first.\nIf the name is not found there, the builtins namespace is searched.\nThe global statement must precede all uses of the name.\n\nThe builtins namespace associated with the execution of a code block\nis actually found by looking up the name "__builtins__" in its global\nnamespace; this should be a dictionary or a module (in the latter case\nthe module\'s dictionary is used). By default, when in the "__main__"\nmodule, "__builtins__" is the built-in module "__builtin__" (note: no\n\'s\'); when in any other module, "__builtins__" is an alias for the\ndictionary of the "__builtin__" module itself. "__builtins__" can be\nset to a user-created dictionary to create a weak form of restricted\nexecution.\n\n**CPython implementation detail:** Users should not touch\n"__builtins__"; it is strictly an implementation detail. Users\nwanting to override values in the builtins namespace should "import"\nthe "__builtin__" (no \'s\') module and modify its attributes\nappropriately.\n\nThe namespace for a module is automatically created the first time a\nmodule is imported. The main module for a script is always called\n"__main__".\n\nThe "global" statement has the same scope as a name binding operation\nin the same block. If the nearest enclosing scope for a free variable\ncontains a global statement, the free variable is treated as a global.\n\nA class definition is an executable statement that may use and define\nnames. These references follow the normal rules for name resolution.\nThe namespace of the class definition becomes the attribute dictionary\nof the class. Names defined at the class scope are not visible in\nmethods.\n\n\nInteraction with dynamic features\n=================================\n\nThere are several cases where Python statements are illegal when used\nin conjunction with nested scopes that contain free variables.\n\nIf a variable is referenced in an enclosing scope, it is illegal to\ndelete the name. An error will be reported at compile time.\n\nIf the wild card form of import --- "import *" --- is used in a\nfunction and the function contains or is a nested block with free\nvariables, the compiler will raise a "SyntaxError".\n\nIf "exec" is used in a function and the function contains or is a\nnested block with free variables, the compiler will raise a\n"SyntaxError" unless the exec explicitly specifies the local namespace\nfor the "exec". (In other words, "exec obj" would be illegal, but\n"exec obj in ns" would be legal.)\n\nThe "eval()", "execfile()", and "input()" functions and the "exec"\nstatement do not have access to the full environment for resolving\nnames. Names may be resolved in the local and global namespaces of\nthe caller. Free variables are not resolved in the nearest enclosing\nnamespace, but in the global namespace. [1] The "exec" statement and\nthe "eval()" and "execfile()" functions have optional arguments to\noverride the global and local namespace. If only one namespace is\nspecified, it is used for both.\n', - 'numbers': u'\nNumeric literals\n****************\n\nThere are four types of numeric literals: plain integers, long\nintegers, floating point numbers, and imaginary numbers. There are no\ncomplex literals (complex numbers can be formed by adding a real\nnumber and an imaginary number).\n\nNote that numeric literals do not include a sign; a phrase like "-1"\nis actually an expression composed of the unary operator \'"-"\' and the\nliteral "1".\n', - 'numeric-types': u'\nEmulating numeric types\n***********************\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()" (described\n below). Note that "__pow__()" should be defined to accept an\n optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator ("/") is implemented by these methods. The\n "__truediv__()" method is used when "__future__.division" is in\n effect, otherwise "__div__()" is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, to execute the statement "x += y", where\n *x* is an instance of a class that has an "__iadd__()" method,\n "x.__iadd__(y)" is called. If *x* is an instance of a class that\n does not define a "__iadd__()" method, "x.__add__(y)" and\n "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions "complex()", "int()",\n "long()", and "float()". Should return a value of the appropriate\n type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions "oct()" and "hex()".\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement "operator.index()". Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or "None" if conversion is impossible. When\n the common type would be the type of "other", it is sufficient to\n return "None", since the interpreter will also ask the other object\n to attempt a coercion (but sometimes, if the implementation of the\n other type cannot be changed, it is useful to do the conversion to\n the other type here). A return value of "NotImplemented" is\n equivalent to returning "None".\n', - 'objects': u'\nObjects, values and types\n*************************\n\n*Objects* are Python\'s abstraction for data. All data in a Python\nprogram is represented by objects or by relations between objects. (In\na sense, and in conformance to Von Neumann\'s model of a "stored\nprogram computer," code is also represented by objects.)\n\nEvery object has an identity, a type and a value. An object\'s\n*identity* never changes once it has been created; you may think of it\nas the object\'s address in memory. The \'"is"\' operator compares the\nidentity of two objects; the "id()" function returns an integer\nrepresenting its identity (currently implemented as its address). An\nobject\'s *type* is also unchangeable. [1] An object\'s type determines\nthe operations that the object supports (e.g., "does it have a\nlength?") and also defines the possible values for objects of that\ntype. The "type()" function returns an object\'s type (which is an\nobject itself). The *value* of some objects can change. Objects\nwhose value can change are said to be *mutable*; objects whose value\nis unchangeable once they are created are called *immutable*. (The\nvalue of an immutable container object that contains a reference to a\nmutable object can change when the latter\'s value is changed; however\nthe container is still considered immutable, because the collection of\nobjects it contains cannot be changed. So, immutability is not\nstrictly the same as having an unchangeable value, it is more subtle.)\nAn object\'s mutability is determined by its type; for instance,\nnumbers, strings and tuples are immutable, while dictionaries and\nlists are mutable.\n\nObjects are never explicitly destroyed; however, when they become\nunreachable they may be garbage-collected. An implementation is\nallowed to postpone garbage collection or omit it altogether --- it is\na matter of implementation quality how garbage collection is\nimplemented, as long as no objects are collected that are still\nreachable.\n\n**CPython implementation detail:** CPython currently uses a reference-\ncounting scheme with (optional) delayed detection of cyclically linked\ngarbage, which collects most objects as soon as they become\nunreachable, but is not guaranteed to collect garbage containing\ncircular references. See the documentation of the "gc" module for\ninformation on controlling the collection of cyclic garbage. Other\nimplementations act differently and CPython may change. Do not depend\non immediate finalization of objects when they become unreachable (ex:\nalways close files).\n\nNote that the use of the implementation\'s tracing or debugging\nfacilities may keep objects alive that would normally be collectable.\nAlso note that catching an exception with a \'"try"..."except"\'\nstatement may keep objects alive.\n\nSome objects contain references to "external" resources such as open\nfiles or windows. It is understood that these resources are freed\nwhen the object is garbage-collected, but since garbage collection is\nnot guaranteed to happen, such objects also provide an explicit way to\nrelease the external resource, usually a "close()" method. Programs\nare strongly recommended to explicitly close such objects. The\n\'"try"..."finally"\' statement provides a convenient way to do this.\n\nSome objects contain references to other objects; these are called\n*containers*. Examples of containers are tuples, lists and\ndictionaries. The references are part of a container\'s value. In\nmost cases, when we talk about the value of a container, we imply the\nvalues, not the identities of the contained objects; however, when we\ntalk about the mutability of a container, only the identities of the\nimmediately contained objects are implied. So, if an immutable\ncontainer (like a tuple) contains a reference to a mutable object, its\nvalue changes if that mutable object is changed.\n\nTypes affect almost all aspects of object behavior. Even the\nimportance of object identity is affected in some sense: for immutable\ntypes, operations that compute new values may actually return a\nreference to any existing object with the same type and value, while\nfor mutable objects this is not allowed. E.g., after "a = 1; b = 1",\n"a" and "b" may or may not refer to the same object with the value\none, depending on the implementation, but after "c = []; d = []", "c"\nand "d" are guaranteed to refer to two different, unique, newly\ncreated empty lists. (Note that "c = d = []" assigns the same object\nto both "c" and "d".)\n', - 'operator-summary': u'\nOperator precedence\n*******************\n\nThe following table summarizes the operator precedences in Python,\nfrom lowest precedence (least binding) to highest precedence (most\nbinding). Operators in the same box have the same precedence. Unless\nthe syntax is explicitly given, operators are binary. Operators in\nthe same box group left to right (except for comparisons, including\ntests, which all have the same precedence and chain from left to right\n--- see section Comparisons --- and exponentiation, which groups from\nright to left).\n\n+-------------------------------------------------+---------------------------------------+\n| Operator | Description |\n+=================================================+=======================================+\n| "lambda" | Lambda expression |\n+-------------------------------------------------+---------------------------------------+\n| "if" -- "else" | Conditional expression |\n+-------------------------------------------------+---------------------------------------+\n| "or" | Boolean OR |\n+-------------------------------------------------+---------------------------------------+\n| "and" | Boolean AND |\n+-------------------------------------------------+---------------------------------------+\n| "not" "x" | Boolean NOT |\n+-------------------------------------------------+---------------------------------------+\n| "in", "not in", "is", "is not", "<", "<=", ">", | Comparisons, including membership |\n| ">=", "<>", "!=", "==" | tests and identity tests |\n+-------------------------------------------------+---------------------------------------+\n| "|" | Bitwise OR |\n+-------------------------------------------------+---------------------------------------+\n| "^" | Bitwise XOR |\n+-------------------------------------------------+---------------------------------------+\n| "&" | Bitwise AND |\n+-------------------------------------------------+---------------------------------------+\n| "<<", ">>" | Shifts |\n+-------------------------------------------------+---------------------------------------+\n| "+", "-" | Addition and subtraction |\n+-------------------------------------------------+---------------------------------------+\n| "*", "/", "//", "%" | Multiplication, division, remainder |\n| | [8] |\n+-------------------------------------------------+---------------------------------------+\n| "+x", "-x", "~x" | Positive, negative, bitwise NOT |\n+-------------------------------------------------+---------------------------------------+\n| "**" | Exponentiation [9] |\n+-------------------------------------------------+---------------------------------------+\n| "x[index]", "x[index:index]", | Subscription, slicing, call, |\n| "x(arguments...)", "x.attribute" | attribute reference |\n+-------------------------------------------------+---------------------------------------+\n| "(expressions...)", "[expressions...]", "{key: | Binding or tuple display, list |\n| value...}", "`expressions...`" | display, dictionary display, string |\n| | conversion |\n+-------------------------------------------------+---------------------------------------+\n\n-[ Footnotes ]-\n\n[1] In Python 2.3 and later releases, a list comprehension "leaks"\n the control variables of each "for" it contains into the\n containing scope. However, this behavior is deprecated, and\n relying on it will not work in Python 3.\n\n[2] While "abs(x%y) < abs(y)" is true mathematically, for floats\n it may not be true numerically due to roundoff. For example, and\n assuming a platform on which a Python float is an IEEE 754 double-\n precision number, in order that "-1e-100 % 1e100" have the same\n sign as "1e100", the computed result is "-1e-100 + 1e100", which\n is numerically exactly equal to "1e100". The function\n "math.fmod()" returns a result whose sign matches the sign of the\n first argument instead, and so returns "-1e-100" in this case.\n Which approach is more appropriate depends on the application.\n\n[3] If x is very close to an exact integer multiple of y, it\'s\n possible for "floor(x/y)" to be one larger than "(x-x%y)/y" due to\n rounding. In such cases, Python returns the latter result, in\n order to preserve that "divmod(x,y)[0] * y + x % y" be very close\n to "x".\n\n[4] While comparisons between unicode strings make sense at the\n byte level, they may be counter-intuitive to users. For example,\n the strings "u"\\u00C7"" and "u"\\u0043\\u0327"" compare differently,\n even though they both represent the same unicode character (LATIN\n CAPITAL LETTER C WITH CEDILLA). To compare strings in a human\n recognizable way, compare using "unicodedata.normalize()".\n\n[5] The implementation computes this efficiently, without\n constructing lists or sorting.\n\n[6] Earlier versions of Python used lexicographic comparison of\n the sorted (key, value) lists, but this was very expensive for the\n common case of comparing for equality. An even earlier version of\n Python compared dictionaries by identity only, but this caused\n surprises because people expected to be able to test a dictionary\n for emptiness by comparing it to "{}".\n\n[7] Due to automatic garbage-collection, free lists, and the\n dynamic nature of descriptors, you may notice seemingly unusual\n behaviour in certain uses of the "is" operator, like those\n involving comparisons between instance methods, or constants.\n Check their documentation for more info.\n\n[8] The "%" operator is also used for string formatting; the same\n precedence applies.\n\n[9] The power operator "**" binds less tightly than an arithmetic\n or bitwise unary operator on its right, that is, "2**-1" is "0.5".\n', - 'pass': u'\nThe "pass" statement\n********************\n\n pass_stmt ::= "pass"\n\n"pass" is a null operation --- when it is executed, nothing happens.\nIt is useful as a placeholder when a statement is required\nsyntactically, but no code needs to be executed, for example:\n\n def f(arg): pass # a function that does nothing (yet)\n\n class C: pass # a class with no methods (yet)\n', - 'power': u'\nThe power operator\n******************\n\nThe power operator binds more tightly than unary operators on its\nleft; it binds less tightly than unary operators on its right. The\nsyntax is:\n\n power ::= primary ["**" u_expr]\n\nThus, in an unparenthesized sequence of power and unary operators, the\noperators are evaluated from right to left (this does not constrain\nthe evaluation order for the operands): "-1**2" results in "-1".\n\nThe power operator has the same semantics as the built-in "pow()"\nfunction, when called with two arguments: it yields its left argument\nraised to the power of its right argument. The numeric arguments are\nfirst converted to a common type. The result type is that of the\narguments after coercion.\n\nWith mixed operand types, the coercion rules for binary arithmetic\noperators apply. For int and long int operands, the result has the\nsame type as the operands (after coercion) unless the second argument\nis negative; in that case, all arguments are converted to float and a\nfloat result is delivered. For example, "10**2" returns "100", but\n"10**-2" returns "0.01". (This last feature was added in Python 2.2.\nIn Python 2.1 and before, if both arguments were of integer types and\nthe second argument was negative, an exception was raised).\n\nRaising "0.0" to a negative power results in a "ZeroDivisionError".\nRaising a negative number to a fractional power results in a\n"ValueError".\n', - 'print': u'\nThe "print" statement\n*********************\n\n print_stmt ::= "print" ([expression ("," expression)* [","]]\n | ">>" expression [("," expression)+ [","]])\n\n"print" evaluates each expression in turn and writes the resulting\nobject to standard output (see below). If an object is not a string,\nit is first converted to a string using the rules for string\nconversions. The (resulting or original) string is then written. A\nspace is written before each object is (converted and) written, unless\nthe output system believes it is positioned at the beginning of a\nline. This is the case (1) when no characters have yet been written\nto standard output, (2) when the last character written to standard\noutput is a whitespace character except "\' \'", or (3) when the last\nwrite operation on standard output was not a "print" statement. (In\nsome cases it may be functional to write an empty string to standard\noutput for this reason.)\n\nNote: Objects which act like file objects but which are not the\n built-in file objects often do not properly emulate this aspect of\n the file object\'s behavior, so it is best not to rely on this.\n\nA "\'\\n\'" character is written at the end, unless the "print" statement\nends with a comma. This is the only action if the statement contains\njust the keyword "print".\n\nStandard output is defined as the file object named "stdout" in the\nbuilt-in module "sys". If no such object exists, or if it does not\nhave a "write()" method, a "RuntimeError" exception is raised.\n\n"print" also has an extended form, defined by the second portion of\nthe syntax described above. This form is sometimes referred to as\n""print" chevron." In this form, the first expression after the ">>"\nmust evaluate to a "file-like" object, specifically an object that has\na "write()" method as described above. With this extended form, the\nsubsequent expressions are printed to this file object. If the first\nexpression evaluates to "None", then "sys.stdout" is used as the file\nfor output.\n', - 'raise': u'\nThe "raise" statement\n*********************\n\n raise_stmt ::= "raise" [expression ["," expression ["," expression]]]\n\nIf no expressions are present, "raise" re-raises the last exception\nthat was active in the current scope. If no exception is active in\nthe current scope, a "TypeError" exception is raised indicating that\nthis is an error (if running under IDLE, a "Queue.Empty" exception is\nraised instead).\n\nOtherwise, "raise" evaluates the expressions to get three objects,\nusing "None" as the value of omitted expressions. The first two\nobjects are used to determine the *type* and *value* of the exception.\n\nIf the first object is an instance, the type of the exception is the\nclass of the instance, the instance itself is the value, and the\nsecond object must be "None".\n\nIf the first object is a class, it becomes the type of the exception.\nThe second object is used to determine the exception value: If it is\nan instance of the class, the instance becomes the exception value. If\nthe second object is a tuple, it is used as the argument list for the\nclass constructor; if it is "None", an empty argument list is used,\nand any other object is treated as a single argument to the\nconstructor. The instance so created by calling the constructor is\nused as the exception value.\n\nIf a third object is present and not "None", it must be a traceback\nobject (see section The standard type hierarchy), and it is\nsubstituted instead of the current location as the place where the\nexception occurred. If the third object is present and not a\ntraceback object or "None", a "TypeError" exception is raised. The\nthree-expression form of "raise" is useful to re-raise an exception\ntransparently in an except clause, but "raise" with no expressions\nshould be preferred if the exception to be re-raised was the most\nrecently active exception in the current scope.\n\nAdditional information on exceptions can be found in section\nExceptions, and information about handling exceptions is in section\nThe try statement.\n', - 'return': u'\nThe "return" statement\n**********************\n\n return_stmt ::= "return" [expression_list]\n\n"return" may only occur syntactically nested in a function definition,\nnot within a nested class definition.\n\nIf an expression list is present, it is evaluated, else "None" is\nsubstituted.\n\n"return" leaves the current function call with the expression list (or\n"None") as return value.\n\nWhen "return" passes control out of a "try" statement with a "finally"\nclause, that "finally" clause is executed before really leaving the\nfunction.\n\nIn a generator function, the "return" statement is not allowed to\ninclude an "expression_list". In that context, a bare "return"\nindicates that the generator is done and will cause "StopIteration" to\nbe raised.\n', - 'sequence-types': u'\nEmulating container types\n*************************\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__nonzero__()" method and whose "__len__()"\n method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method "iterkeys()".\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\n New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see this section in the\n language reference.\n', - 'shifting': u'\nShifting operations\n*******************\n\nThe shifting operations have lower priority than the arithmetic\noperations:\n\n shift_expr ::= a_expr | shift_expr ( "<<" | ">>" ) a_expr\n\nThese operators accept plain or long integers as arguments. The\narguments are converted to a common type. They shift the first\nargument to the left or right by the number of bits given by the\nsecond argument.\n\nA right shift by *n* bits is defined as division by "pow(2, n)". A\nleft shift by *n* bits is defined as multiplication with "pow(2, n)".\nNegative shift counts raise a "ValueError" exception.\n\nNote: In the current implementation, the right-hand operand is\n required to be at most "sys.maxsize". If the right-hand operand is\n larger than "sys.maxsize" an "OverflowError" exception is raised.\n', - 'slicings': u'\nSlicings\n********\n\nA slicing selects a range of items in a sequence object (e.g., a\nstring, tuple or list). Slicings may be used as expressions or as\ntargets in assignment or "del" statements. The syntax for a slicing:\n\n slicing ::= simple_slicing | extended_slicing\n simple_slicing ::= primary "[" short_slice "]"\n extended_slicing ::= primary "[" slice_list "]"\n slice_list ::= slice_item ("," slice_item)* [","]\n slice_item ::= expression | proper_slice | ellipsis\n proper_slice ::= short_slice | long_slice\n short_slice ::= [lower_bound] ":" [upper_bound]\n long_slice ::= short_slice ":" [stride]\n lower_bound ::= expression\n upper_bound ::= expression\n stride ::= expression\n ellipsis ::= "..."\n\nThere is ambiguity in the formal syntax here: anything that looks like\nan expression list also looks like a slice list, so any subscription\ncan be interpreted as a slicing. Rather than further complicating the\nsyntax, this is disambiguated by defining that in this case the\ninterpretation as a subscription takes priority over the\ninterpretation as a slicing (this is the case if the slice list\ncontains no proper slice nor ellipses). Similarly, when the slice\nlist has exactly one short slice and no trailing comma, the\ninterpretation as a simple slicing takes priority over that as an\nextended slicing.\n\nThe semantics for a simple slicing are as follows. The primary must\nevaluate to a sequence object. The lower and upper bound expressions,\nif present, must evaluate to plain integers; defaults are zero and the\n"sys.maxint", respectively. If either bound is negative, the\nsequence\'s length is added to it. The slicing now selects all items\nwith index *k* such that "i <= k < j" where *i* and *j* are the\nspecified lower and upper bounds. This may be an empty sequence. It\nis not an error if *i* or *j* lie outside the range of valid indexes\n(such items don\'t exist so they aren\'t selected).\n\nThe semantics for an extended slicing are as follows. The primary\nmust evaluate to a mapping object, and it is indexed with a key that\nis constructed from the slice list, as follows. If the slice list\ncontains at least one comma, the key is a tuple containing the\nconversion of the slice items; otherwise, the conversion of the lone\nslice item is the key. The conversion of a slice item that is an\nexpression is that expression. The conversion of an ellipsis slice\nitem is the built-in "Ellipsis" object. The conversion of a proper\nslice is a slice object (see section The standard type hierarchy)\nwhose "start", "stop" and "step" attributes are the values of the\nexpressions given as lower bound, upper bound and stride,\nrespectively, substituting "None" for missing expressions.\n', - 'specialattrs': u'\nSpecial Attributes\n******************\n\nThe implementation adds a few special read-only attributes to several\nobject types, where they are relevant. Some of these are not reported\nby the "dir()" built-in function.\n\nobject.__dict__\n\n A dictionary or other mapping object used to store an object\'s\n (writable) attributes.\n\nobject.__methods__\n\n Deprecated since version 2.2: Use the built-in function "dir()" to\n get a list of an object\'s attributes. This attribute is no longer\n available.\n\nobject.__members__\n\n Deprecated since version 2.2: Use the built-in function "dir()" to\n get a list of an object\'s attributes. This attribute is no longer\n available.\n\ninstance.__class__\n\n The class to which a class instance belongs.\n\nclass.__bases__\n\n The tuple of base classes of a class object.\n\nclass.__name__\n\n The name of the class or type.\n\nThe following attributes are only supported by *new-style class*es.\n\nclass.__mro__\n\n This attribute is a tuple of classes that are considered when\n looking for base classes during method resolution.\n\nclass.mro()\n\n This method can be overridden by a metaclass to customize the\n method resolution order for its instances. It is called at class\n instantiation, and its result is stored in "__mro__".\n\nclass.__subclasses__()\n\n Each new-style class keeps a list of weak references to its\n immediate subclasses. This method returns a list of all those\n references still alive. Example:\n\n >>> int.__subclasses__()\n []\n\n-[ Footnotes ]-\n\n[1] Additional information on these special methods may be found\n in the Python Reference Manual (Basic customization).\n\n[2] As a consequence, the list "[1, 2]" is considered equal to\n "[1.0, 2.0]", and similarly for tuples.\n\n[3] They must have since the parser can\'t tell the type of the\n operands.\n\n[4] Cased characters are those with general category property\n being one of "Lu" (Letter, uppercase), "Ll" (Letter, lowercase),\n or "Lt" (Letter, titlecase).\n\n[5] To format only a tuple you should therefore provide a\n singleton tuple whose only element is the tuple to be formatted.\n\n[6] The advantage of leaving the newline on is that returning an\n empty string is then an unambiguous EOF indication. It is also\n possible (in cases where it might matter, for example, if you want\n to make an exact copy of a file while scanning its lines) to tell\n whether the last line of a file ended in a newline or not (yes\n this happens!).\n', - 'specialnames': u'\nSpecial method names\n********************\n\nA class can implement certain operations that are invoked by special\nsyntax (such as arithmetic operations or subscripting and slicing) by\ndefining methods with special names. This is Python\'s approach to\n*operator overloading*, allowing classes to define their own behavior\nwith respect to language operators. For instance, if a class defines\na method named "__getitem__()", and "x" is an instance of this class,\nthen "x[i]" is roughly equivalent to "x.__getitem__(i)" for old-style\nclasses and "type(x).__getitem__(x, i)" for new-style classes. Except\nwhere mentioned, attempts to execute an operation raise an exception\nwhen no appropriate method is defined (typically "AttributeError" or\n"TypeError").\n\nWhen implementing a class that emulates any built-in type, it is\nimportant that the emulation only be implemented to the degree that it\nmakes sense for the object being modelled. For example, some\nsequences may work well with retrieval of individual elements, but\nextracting a slice may not make sense. (One example of this is the\n"NodeList" interface in the W3C\'s Document Object Model.)\n\n\nBasic customization\n===================\n\nobject.__new__(cls[, ...])\n\n Called to create a new instance of class *cls*. "__new__()" is a\n static method (special-cased so you need not declare it as such)\n that takes the class of which an instance was requested as its\n first argument. The remaining arguments are those passed to the\n object constructor expression (the call to the class). The return\n value of "__new__()" should be the new object instance (usually an\n instance of *cls*).\n\n Typical implementations create a new instance of the class by\n invoking the superclass\'s "__new__()" method using\n "super(currentclass, cls).__new__(cls[, ...])" with appropriate\n arguments and then modifying the newly-created instance as\n necessary before returning it.\n\n If "__new__()" returns an instance of *cls*, then the new\n instance\'s "__init__()" method will be invoked like\n "__init__(self[, ...])", where *self* is the new instance and the\n remaining arguments are the same as were passed to "__new__()".\n\n If "__new__()" does not return an instance of *cls*, then the new\n instance\'s "__init__()" method will not be invoked.\n\n "__new__()" is intended mainly to allow subclasses of immutable\n types (like int, str, or tuple) to customize instance creation. It\n is also commonly overridden in custom metaclasses in order to\n customize class creation.\n\nobject.__init__(self[, ...])\n\n Called after the instance has been created (by "__new__()"), but\n before it is returned to the caller. The arguments are those\n passed to the class constructor expression. If a base class has an\n "__init__()" method, the derived class\'s "__init__()" method, if\n any, must explicitly call it to ensure proper initialization of the\n base class part of the instance; for example:\n "BaseClass.__init__(self, [args...])".\n\n Because "__new__()" and "__init__()" work together in constructing\n objects ("__new__()" to create it, and "__init__()" to customise\n it), no non-"None" value may be returned by "__init__()"; doing so\n will cause a "TypeError" to be raised at runtime.\n\nobject.__del__(self)\n\n Called when the instance is about to be destroyed. This is also\n called a destructor. If a base class has a "__del__()" method, the\n derived class\'s "__del__()" method, if any, must explicitly call it\n to ensure proper deletion of the base class part of the instance.\n Note that it is possible (though not recommended!) for the\n "__del__()" method to postpone destruction of the instance by\n creating a new reference to it. It may then be called at a later\n time when this new reference is deleted. It is not guaranteed that\n "__del__()" methods are called for objects that still exist when\n the interpreter exits.\n\n Note: "del x" doesn\'t directly call "x.__del__()" --- the former\n decrements the reference count for "x" by one, and the latter is\n only called when "x"\'s reference count reaches zero. Some common\n situations that may prevent the reference count of an object from\n going to zero include: circular references between objects (e.g.,\n a doubly-linked list or a tree data structure with parent and\n child pointers); a reference to the object on the stack frame of\n a function that caught an exception (the traceback stored in\n "sys.exc_traceback" keeps the stack frame alive); or a reference\n to the object on the stack frame that raised an unhandled\n exception in interactive mode (the traceback stored in\n "sys.last_traceback" keeps the stack frame alive). The first\n situation can only be remedied by explicitly breaking the cycles;\n the latter two situations can be resolved by storing "None" in\n "sys.exc_traceback" or "sys.last_traceback". Circular references\n which are garbage are detected when the option cycle detector is\n enabled (it\'s on by default), but can only be cleaned up if there\n are no Python-level "__del__()" methods involved. Refer to the\n documentation for the "gc" module for more information about how\n "__del__()" methods are handled by the cycle detector,\n particularly the description of the "garbage" value.\n\n Warning: Due to the precarious circumstances under which\n "__del__()" methods are invoked, exceptions that occur during\n their execution are ignored, and a warning is printed to\n "sys.stderr" instead. Also, when "__del__()" is invoked in\n response to a module being deleted (e.g., when execution of the\n program is done), other globals referenced by the "__del__()"\n method may already have been deleted or in the process of being\n torn down (e.g. the import machinery shutting down). For this\n reason, "__del__()" methods should do the absolute minimum needed\n to maintain external invariants. Starting with version 1.5,\n Python guarantees that globals whose name begins with a single\n underscore are deleted from their module before other globals are\n deleted; if no other references to such globals exist, this may\n help in assuring that imported modules are still available at the\n time when the "__del__()" method is called.\n\n See also the "-R" command-line option.\n\nobject.__repr__(self)\n\n Called by the "repr()" built-in function and by string conversions\n (reverse quotes) to compute the "official" string representation of\n an object. If at all possible, this should look like a valid\n Python expression that could be used to recreate an object with the\n same value (given an appropriate environment). If this is not\n possible, a string of the form "<...some useful description...>"\n should be returned. The return value must be a string object. If a\n class defines "__repr__()" but not "__str__()", then "__repr__()"\n is also used when an "informal" string representation of instances\n of that class is required.\n\n This is typically used for debugging, so it is important that the\n representation is information-rich and unambiguous.\n\nobject.__str__(self)\n\n Called by the "str()" built-in function and by the "print"\n statement to compute the "informal" string representation of an\n object. This differs from "__repr__()" in that it does not have to\n be a valid Python expression: a more convenient or concise\n representation may be used instead. The return value must be a\n string object.\n\nobject.__lt__(self, other)\nobject.__le__(self, other)\nobject.__eq__(self, other)\nobject.__ne__(self, other)\nobject.__gt__(self, other)\nobject.__ge__(self, other)\n\n New in version 2.1.\n\n These are the so-called "rich comparison" methods, and are called\n for comparison operators in preference to "__cmp__()" below. The\n correspondence between operator symbols and method names is as\n follows: "xy" call "x.__ne__(y)",\n "x>y" calls "x.__gt__(y)", and "x>=y" calls "x.__ge__(y)".\n\n A rich comparison method may return the singleton "NotImplemented"\n if it does not implement the operation for a given pair of\n arguments. By convention, "False" and "True" are returned for a\n successful comparison. However, these methods can return any value,\n so if the comparison operator is used in a Boolean context (e.g.,\n in the condition of an "if" statement), Python will call "bool()"\n on the value to determine if the result is true or false.\n\n There are no implied relationships among the comparison operators.\n The truth of "x==y" does not imply that "x!=y" is false.\n Accordingly, when defining "__eq__()", one should also define\n "__ne__()" so that the operators will behave as expected. See the\n paragraph on "__hash__()" for some important notes on creating\n *hashable* objects which support custom comparison operations and\n are usable as dictionary keys.\n\n There are no swapped-argument versions of these methods (to be used\n when the left argument does not support the operation but the right\n argument does); rather, "__lt__()" and "__gt__()" are each other\'s\n reflection, "__le__()" and "__ge__()" are each other\'s reflection,\n and "__eq__()" and "__ne__()" are their own reflection.\n\n Arguments to rich comparison methods are never coerced.\n\n To automatically generate ordering operations from a single root\n operation, see "functools.total_ordering()".\n\nobject.__cmp__(self, other)\n\n Called by comparison operations if rich comparison (see above) is\n not defined. Should return a negative integer if "self < other",\n zero if "self == other", a positive integer if "self > other". If\n no "__cmp__()", "__eq__()" or "__ne__()" operation is defined,\n class instances are compared by object identity ("address"). See\n also the description of "__hash__()" for some important notes on\n creating *hashable* objects which support custom comparison\n operations and are usable as dictionary keys. (Note: the\n restriction that exceptions are not propagated by "__cmp__()" has\n been removed since Python 1.5.)\n\nobject.__rcmp__(self, other)\n\n Changed in version 2.1: No longer supported.\n\nobject.__hash__(self)\n\n Called by built-in function "hash()" and for operations on members\n of hashed collections including "set", "frozenset", and "dict".\n "__hash__()" should return an integer. The only required property\n is that objects which compare equal have the same hash value; it is\n advised to somehow mix together (e.g. using exclusive or) the hash\n values for the components of the object that also play a part in\n comparison of objects.\n\n If a class does not define a "__cmp__()" or "__eq__()" method it\n should not define a "__hash__()" operation either; if it defines\n "__cmp__()" or "__eq__()" but not "__hash__()", its instances will\n not be usable in hashed collections. If a class defines mutable\n objects and implements a "__cmp__()" or "__eq__()" method, it\n should not implement "__hash__()", since hashable collection\n implementations require that a object\'s hash value is immutable (if\n the object\'s hash value changes, it will be in the wrong hash\n bucket).\n\n User-defined classes have "__cmp__()" and "__hash__()" methods by\n default; with them, all objects compare unequal (except with\n themselves) and "x.__hash__()" returns a result derived from\n "id(x)".\n\n Classes which inherit a "__hash__()" method from a parent class but\n change the meaning of "__cmp__()" or "__eq__()" such that the hash\n value returned is no longer appropriate (e.g. by switching to a\n value-based concept of equality instead of the default identity\n based equality) can explicitly flag themselves as being unhashable\n by setting "__hash__ = None" in the class definition. Doing so\n means that not only will instances of the class raise an\n appropriate "TypeError" when a program attempts to retrieve their\n hash value, but they will also be correctly identified as\n unhashable when checking "isinstance(obj, collections.Hashable)"\n (unlike classes which define their own "__hash__()" to explicitly\n raise "TypeError").\n\n Changed in version 2.5: "__hash__()" may now also return a long\n integer object; the 32-bit integer is then derived from the hash of\n that object.\n\n Changed in version 2.6: "__hash__" may now be set to "None" to\n explicitly flag instances of a class as unhashable.\n\nobject.__nonzero__(self)\n\n Called to implement truth value testing and the built-in operation\n "bool()"; should return "False" or "True", or their integer\n equivalents "0" or "1". When this method is not defined,\n "__len__()" is called, if it is defined, and the object is\n considered true if its result is nonzero. If a class defines\n neither "__len__()" nor "__nonzero__()", all its instances are\n considered true.\n\nobject.__unicode__(self)\n\n Called to implement "unicode()" built-in; should return a Unicode\n object. When this method is not defined, string conversion is\n attempted, and the result of string conversion is converted to\n Unicode using the system default encoding.\n\n\nCustomizing attribute access\n============================\n\nThe following methods can be defined to customize the meaning of\nattribute access (use of, assignment to, or deletion of "x.name") for\nclass instances.\n\nobject.__getattr__(self, name)\n\n Called when an attribute lookup has not found the attribute in the\n usual places (i.e. it is not an instance attribute nor is it found\n in the class tree for "self"). "name" is the attribute name. This\n method should return the (computed) attribute value or raise an\n "AttributeError" exception.\n\n Note that if the attribute is found through the normal mechanism,\n "__getattr__()" is not called. (This is an intentional asymmetry\n between "__getattr__()" and "__setattr__()".) This is done both for\n efficiency reasons and because otherwise "__getattr__()" would have\n no way to access other attributes of the instance. Note that at\n least for instance variables, you can fake total control by not\n inserting any values in the instance attribute dictionary (but\n instead inserting them in another object). See the\n "__getattribute__()" method below for a way to actually get total\n control in new-style classes.\n\nobject.__setattr__(self, name, value)\n\n Called when an attribute assignment is attempted. This is called\n instead of the normal mechanism (i.e. store the value in the\n instance dictionary). *name* is the attribute name, *value* is the\n value to be assigned to it.\n\n If "__setattr__()" wants to assign to an instance attribute, it\n should not simply execute "self.name = value" --- this would cause\n a recursive call to itself. Instead, it should insert the value in\n the dictionary of instance attributes, e.g., "self.__dict__[name] =\n value". For new-style classes, rather than accessing the instance\n dictionary, it should call the base class method with the same\n name, for example, "object.__setattr__(self, name, value)".\n\nobject.__delattr__(self, name)\n\n Like "__setattr__()" but for attribute deletion instead of\n assignment. This should only be implemented if "del obj.name" is\n meaningful for the object.\n\n\nMore attribute access for new-style classes\n-------------------------------------------\n\nThe following methods only apply to new-style classes.\n\nobject.__getattribute__(self, name)\n\n Called unconditionally to implement attribute accesses for\n instances of the class. If the class also defines "__getattr__()",\n the latter will not be called unless "__getattribute__()" either\n calls it explicitly or raises an "AttributeError". This method\n should return the (computed) attribute value or raise an\n "AttributeError" exception. In order to avoid infinite recursion in\n this method, its implementation should always call the base class\n method with the same name to access any attributes it needs, for\n example, "object.__getattribute__(self, name)".\n\n Note: This method may still be bypassed when looking up special\n methods as the result of implicit invocation via language syntax\n or built-in functions. See Special method lookup for new-style\n classes.\n\n\nImplementing Descriptors\n------------------------\n\nThe following methods only apply when an instance of the class\ncontaining the method (a so-called *descriptor* class) appears in an\n*owner* class (the descriptor must be in either the owner\'s class\ndictionary or in the class dictionary for one of its parents). In the\nexamples below, "the attribute" refers to the attribute whose name is\nthe key of the property in the owner class\' "__dict__".\n\nobject.__get__(self, instance, owner)\n\n Called to get the attribute of the owner class (class attribute\n access) or of an instance of that class (instance attribute\n access). *owner* is always the owner class, while *instance* is the\n instance that the attribute was accessed through, or "None" when\n the attribute is accessed through the *owner*. This method should\n return the (computed) attribute value or raise an "AttributeError"\n exception.\n\nobject.__set__(self, instance, value)\n\n Called to set the attribute on an instance *instance* of the owner\n class to a new value, *value*.\n\nobject.__delete__(self, instance)\n\n Called to delete the attribute on an instance *instance* of the\n owner class.\n\n\nInvoking Descriptors\n--------------------\n\nIn general, a descriptor is an object attribute with "binding\nbehavior", one whose attribute access has been overridden by methods\nin the descriptor protocol: "__get__()", "__set__()", and\n"__delete__()". If any of those methods are defined for an object, it\nis said to be a descriptor.\n\nThe default behavior for attribute access is to get, set, or delete\nthe attribute from an object\'s dictionary. For instance, "a.x" has a\nlookup chain starting with "a.__dict__[\'x\']", then\n"type(a).__dict__[\'x\']", and continuing through the base classes of\n"type(a)" excluding metaclasses.\n\nHowever, if the looked-up value is an object defining one of the\ndescriptor methods, then Python may override the default behavior and\ninvoke the descriptor method instead. Where this occurs in the\nprecedence chain depends on which descriptor methods were defined and\nhow they were called. Note that descriptors are only invoked for new\nstyle objects or classes (ones that subclass "object()" or "type()").\n\nThe starting point for descriptor invocation is a binding, "a.x". How\nthe arguments are assembled depends on "a":\n\nDirect Call\n The simplest and least common call is when user code directly\n invokes a descriptor method: "x.__get__(a)".\n\nInstance Binding\n If binding to a new-style object instance, "a.x" is transformed\n into the call: "type(a).__dict__[\'x\'].__get__(a, type(a))".\n\nClass Binding\n If binding to a new-style class, "A.x" is transformed into the\n call: "A.__dict__[\'x\'].__get__(None, A)".\n\nSuper Binding\n If "a" is an instance of "super", then the binding "super(B,\n obj).m()" searches "obj.__class__.__mro__" for the base class "A"\n immediately preceding "B" and then invokes the descriptor with the\n call: "A.__dict__[\'m\'].__get__(obj, obj.__class__)".\n\nFor instance bindings, the precedence of descriptor invocation depends\non the which descriptor methods are defined. A descriptor can define\nany combination of "__get__()", "__set__()" and "__delete__()". If it\ndoes not define "__get__()", then accessing the attribute will return\nthe descriptor object itself unless there is a value in the object\'s\ninstance dictionary. If the descriptor defines "__set__()" and/or\n"__delete__()", it is a data descriptor; if it defines neither, it is\na non-data descriptor. Normally, data descriptors define both\n"__get__()" and "__set__()", while non-data descriptors have just the\n"__get__()" method. Data descriptors with "__set__()" and "__get__()"\ndefined always override a redefinition in an instance dictionary. In\ncontrast, non-data descriptors can be overridden by instances.\n\nPython methods (including "staticmethod()" and "classmethod()") are\nimplemented as non-data descriptors. Accordingly, instances can\nredefine and override methods. This allows individual instances to\nacquire behaviors that differ from other instances of the same class.\n\nThe "property()" function is implemented as a data descriptor.\nAccordingly, instances cannot override the behavior of a property.\n\n\n__slots__\n---------\n\nBy default, instances of both old and new-style classes have a\ndictionary for attribute storage. This wastes space for objects\nhaving very few instance variables. The space consumption can become\nacute when creating large numbers of instances.\n\nThe default can be overridden by defining *__slots__* in a new-style\nclass definition. The *__slots__* declaration takes a sequence of\ninstance variables and reserves just enough space in each instance to\nhold a value for each variable. Space is saved because *__dict__* is\nnot created for each instance.\n\n__slots__\n\n This class variable can be assigned a string, iterable, or sequence\n of strings with variable names used by instances. If defined in a\n new-style class, *__slots__* reserves space for the declared\n variables and prevents the automatic creation of *__dict__* and\n *__weakref__* for each instance.\n\n New in version 2.2.\n\nNotes on using *__slots__*\n\n* When inheriting from a class without *__slots__*, the *__dict__*\n attribute of that class will always be accessible, so a *__slots__*\n definition in the subclass is meaningless.\n\n* Without a *__dict__* variable, instances cannot be assigned new\n variables not listed in the *__slots__* definition. Attempts to\n assign to an unlisted variable name raises "AttributeError". If\n dynamic assignment of new variables is desired, then add\n "\'__dict__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__dict__\'" to the\n *__slots__* declaration would not enable the assignment of new\n attributes not specifically listed in the sequence of instance\n variable names.\n\n* Without a *__weakref__* variable for each instance, classes\n defining *__slots__* do not support weak references to its\n instances. If weak reference support is needed, then add\n "\'__weakref__\'" to the sequence of strings in the *__slots__*\n declaration.\n\n Changed in version 2.3: Previously, adding "\'__weakref__\'" to the\n *__slots__* declaration would not enable support for weak\n references.\n\n* *__slots__* are implemented at the class level by creating\n descriptors (Implementing Descriptors) for each variable name. As a\n result, class attributes cannot be used to set default values for\n instance variables defined by *__slots__*; otherwise, the class\n attribute would overwrite the descriptor assignment.\n\n* The action of a *__slots__* declaration is limited to the class\n where it is defined. As a result, subclasses will have a *__dict__*\n unless they also define *__slots__* (which must only contain names\n of any *additional* slots).\n\n* If a class defines a slot also defined in a base class, the\n instance variable defined by the base class slot is inaccessible\n (except by retrieving its descriptor directly from the base class).\n This renders the meaning of the program undefined. In the future, a\n check may be added to prevent this.\n\n* Nonempty *__slots__* does not work for classes derived from\n "variable-length" built-in types such as "long", "str" and "tuple".\n\n* Any non-string iterable may be assigned to *__slots__*. Mappings\n may also be used; however, in the future, special meaning may be\n assigned to the values corresponding to each key.\n\n* *__class__* assignment works only if both classes have the same\n *__slots__*.\n\n Changed in version 2.6: Previously, *__class__* assignment raised an\n error if either new or old class had *__slots__*.\n\n\nCustomizing class creation\n==========================\n\nBy default, new-style classes are constructed using "type()". A class\ndefinition is read into a separate namespace and the value of class\nname is bound to the result of "type(name, bases, dict)".\n\nWhen the class definition is read, if *__metaclass__* is defined then\nthe callable assigned to it will be called instead of "type()". This\nallows classes or functions to be written which monitor or alter the\nclass creation process:\n\n* Modifying the class dictionary prior to the class being created.\n\n* Returning an instance of another class -- essentially performing\n the role of a factory function.\n\nThese steps will have to be performed in the metaclass\'s "__new__()"\nmethod -- "type.__new__()" can then be called from this method to\ncreate a class with different properties. This example adds a new\nelement to the class dictionary before creating the class:\n\n class metacls(type):\n def __new__(mcs, name, bases, dict):\n dict[\'foo\'] = \'metacls was here\'\n return type.__new__(mcs, name, bases, dict)\n\nYou can of course also override other class methods (or add new\nmethods); for example defining a custom "__call__()" method in the\nmetaclass allows custom behavior when the class is called, e.g. not\nalways creating a new instance.\n\n__metaclass__\n\n This variable can be any callable accepting arguments for "name",\n "bases", and "dict". Upon class creation, the callable is used\n instead of the built-in "type()".\n\n New in version 2.2.\n\nThe appropriate metaclass is determined by the following precedence\nrules:\n\n* If "dict[\'__metaclass__\']" exists, it is used.\n\n* Otherwise, if there is at least one base class, its metaclass is\n used (this looks for a *__class__* attribute first and if not found,\n uses its type).\n\n* Otherwise, if a global variable named __metaclass__ exists, it is\n used.\n\n* Otherwise, the old-style, classic metaclass (types.ClassType) is\n used.\n\nThe potential uses for metaclasses are boundless. Some ideas that have\nbeen explored including logging, interface checking, automatic\ndelegation, automatic property creation, proxies, frameworks, and\nautomatic resource locking/synchronization.\n\n\nCustomizing instance and subclass checks\n========================================\n\nNew in version 2.6.\n\nThe following methods are used to override the default behavior of the\n"isinstance()" and "issubclass()" built-in functions.\n\nIn particular, the metaclass "abc.ABCMeta" implements these methods in\norder to allow the addition of Abstract Base Classes (ABCs) as\n"virtual base classes" to any class or type (including built-in\ntypes), including other ABCs.\n\nclass.__instancecheck__(self, instance)\n\n Return true if *instance* should be considered a (direct or\n indirect) instance of *class*. If defined, called to implement\n "isinstance(instance, class)".\n\nclass.__subclasscheck__(self, subclass)\n\n Return true if *subclass* should be considered a (direct or\n indirect) subclass of *class*. If defined, called to implement\n "issubclass(subclass, class)".\n\nNote that these methods are looked up on the type (metaclass) of a\nclass. They cannot be defined as class methods in the actual class.\nThis is consistent with the lookup of special methods that are called\non instances, only in this case the instance is itself a class.\n\nSee also: **PEP 3119** - Introducing Abstract Base Classes\n\n Includes the specification for customizing "isinstance()" and\n "issubclass()" behavior through "__instancecheck__()" and\n "__subclasscheck__()", with motivation for this functionality in\n the context of adding Abstract Base Classes (see the "abc"\n module) to the language.\n\n\nEmulating callable objects\n==========================\n\nobject.__call__(self[, args...])\n\n Called when the instance is "called" as a function; if this method\n is defined, "x(arg1, arg2, ...)" is a shorthand for\n "x.__call__(arg1, arg2, ...)".\n\n\nEmulating container types\n=========================\n\nThe following methods can be defined to implement container objects.\nContainers usually are sequences (such as lists or tuples) or mappings\n(like dictionaries), but can represent other containers as well. The\nfirst set of methods is used either to emulate a sequence or to\nemulate a mapping; the difference is that for a sequence, the\nallowable keys should be the integers *k* for which "0 <= k < N" where\n*N* is the length of the sequence, or slice objects, which define a\nrange of items. (For backwards compatibility, the method\n"__getslice__()" (see below) can also be defined to handle simple, but\nnot extended slices.) It is also recommended that mappings provide the\nmethods "keys()", "values()", "items()", "has_key()", "get()",\n"clear()", "setdefault()", "iterkeys()", "itervalues()",\n"iteritems()", "pop()", "popitem()", "copy()", and "update()" behaving\nsimilar to those for Python\'s standard dictionary objects. The\n"UserDict" module provides a "DictMixin" class to help create those\nmethods from a base set of "__getitem__()", "__setitem__()",\n"__delitem__()", and "keys()". Mutable sequences should provide\nmethods "append()", "count()", "index()", "extend()", "insert()",\n"pop()", "remove()", "reverse()" and "sort()", like Python standard\nlist objects. Finally, sequence types should implement addition\n(meaning concatenation) and multiplication (meaning repetition) by\ndefining the methods "__add__()", "__radd__()", "__iadd__()",\n"__mul__()", "__rmul__()" and "__imul__()" described below; they\nshould not define "__coerce__()" or other numerical operators. It is\nrecommended that both mappings and sequences implement the\n"__contains__()" method to allow efficient use of the "in" operator;\nfor mappings, "in" should be equivalent of "has_key()"; for sequences,\nit should search through the values. It is further recommended that\nboth mappings and sequences implement the "__iter__()" method to allow\nefficient iteration through the container; for mappings, "__iter__()"\nshould be the same as "iterkeys()"; for sequences, it should iterate\nthrough the values.\n\nobject.__len__(self)\n\n Called to implement the built-in function "len()". Should return\n the length of the object, an integer ">=" 0. Also, an object that\n doesn\'t define a "__nonzero__()" method and whose "__len__()"\n method returns zero is considered to be false in a Boolean context.\n\nobject.__getitem__(self, key)\n\n Called to implement evaluation of "self[key]". For sequence types,\n the accepted keys should be integers and slice objects. Note that\n the special interpretation of negative indexes (if the class wishes\n to emulate a sequence type) is up to the "__getitem__()" method. If\n *key* is of an inappropriate type, "TypeError" may be raised; if of\n a value outside the set of indexes for the sequence (after any\n special interpretation of negative values), "IndexError" should be\n raised. For mapping types, if *key* is missing (not in the\n container), "KeyError" should be raised.\n\n Note: "for" loops expect that an "IndexError" will be raised for\n illegal indexes to allow proper detection of the end of the\n sequence.\n\nobject.__missing__(self, key)\n\n Called by "dict"."__getitem__()" to implement "self[key]" for dict\n subclasses when key is not in the dictionary.\n\nobject.__setitem__(self, key, value)\n\n Called to implement assignment to "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support changes to the values for keys, or if new keys\n can be added, or for sequences if elements can be replaced. The\n same exceptions should be raised for improper *key* values as for\n the "__getitem__()" method.\n\nobject.__delitem__(self, key)\n\n Called to implement deletion of "self[key]". Same note as for\n "__getitem__()". This should only be implemented for mappings if\n the objects support removal of keys, or for sequences if elements\n can be removed from the sequence. The same exceptions should be\n raised for improper *key* values as for the "__getitem__()" method.\n\nobject.__iter__(self)\n\n This method is called when an iterator is required for a container.\n This method should return a new iterator object that can iterate\n over all the objects in the container. For mappings, it should\n iterate over the keys of the container, and should also be made\n available as the method "iterkeys()".\n\n Iterator objects also need to implement this method; they are\n required to return themselves. For more information on iterator\n objects, see Iterator Types.\n\nobject.__reversed__(self)\n\n Called (if present) by the "reversed()" built-in to implement\n reverse iteration. It should return a new iterator object that\n iterates over all the objects in the container in reverse order.\n\n If the "__reversed__()" method is not provided, the "reversed()"\n built-in will fall back to using the sequence protocol ("__len__()"\n and "__getitem__()"). Objects that support the sequence protocol\n should only provide "__reversed__()" if they can provide an\n implementation that is more efficient than the one provided by\n "reversed()".\n\n New in version 2.6.\n\nThe membership test operators ("in" and "not in") are normally\nimplemented as an iteration through a sequence. However, container\nobjects can supply the following special method with a more efficient\nimplementation, which also does not require the object be a sequence.\n\nobject.__contains__(self, item)\n\n Called to implement membership test operators. Should return true\n if *item* is in *self*, false otherwise. For mapping objects, this\n should consider the keys of the mapping rather than the values or\n the key-item pairs.\n\n For objects that don\'t define "__contains__()", the membership test\n first tries iteration via "__iter__()", then the old sequence\n iteration protocol via "__getitem__()", see this section in the\n language reference.\n\n\nAdditional methods for emulation of sequence types\n==================================================\n\nThe following optional methods can be defined to further emulate\nsequence objects. Immutable sequences methods should at most only\ndefine "__getslice__()"; mutable sequences might define all three\nmethods.\n\nobject.__getslice__(self, i, j)\n\n Deprecated since version 2.0: Support slice objects as parameters\n to the "__getitem__()" method. (However, built-in types in CPython\n currently still implement "__getslice__()". Therefore, you have to\n override it in derived classes when implementing slicing.)\n\n Called to implement evaluation of "self[i:j]". The returned object\n should be of the same type as *self*. Note that missing *i* or *j*\n in the slice expression are replaced by zero or "sys.maxsize",\n respectively. If negative indexes are used in the slice, the\n length of the sequence is added to that index. If the instance does\n not implement the "__len__()" method, an "AttributeError" is\n raised. No guarantee is made that indexes adjusted this way are not\n still negative. Indexes which are greater than the length of the\n sequence are not modified. If no "__getslice__()" is found, a slice\n object is created instead, and passed to "__getitem__()" instead.\n\nobject.__setslice__(self, i, j, sequence)\n\n Called to implement assignment to "self[i:j]". Same notes for *i*\n and *j* as for "__getslice__()".\n\n This method is deprecated. If no "__setslice__()" is found, or for\n extended slicing of the form "self[i:j:k]", a slice object is\n created, and passed to "__setitem__()", instead of "__setslice__()"\n being called.\n\nobject.__delslice__(self, i, j)\n\n Called to implement deletion of "self[i:j]". Same notes for *i* and\n *j* as for "__getslice__()". This method is deprecated. If no\n "__delslice__()" is found, or for extended slicing of the form\n "self[i:j:k]", a slice object is created, and passed to\n "__delitem__()", instead of "__delslice__()" being called.\n\nNotice that these methods are only invoked when a single slice with a\nsingle colon is used, and the slice method is available. For slice\noperations involving extended slice notation, or in absence of the\nslice methods, "__getitem__()", "__setitem__()" or "__delitem__()" is\ncalled with a slice object as argument.\n\nThe following example demonstrate how to make your program or module\ncompatible with earlier versions of Python (assuming that methods\n"__getitem__()", "__setitem__()" and "__delitem__()" support slice\nobjects as arguments):\n\n class MyClass:\n ...\n def __getitem__(self, index):\n ...\n def __setitem__(self, index, value):\n ...\n def __delitem__(self, index):\n ...\n\n if sys.version_info < (2, 0):\n # They won\'t be defined if version is at least 2.0 final\n\n def __getslice__(self, i, j):\n return self[max(0, i):max(0, j):]\n def __setslice__(self, i, j, seq):\n self[max(0, i):max(0, j):] = seq\n def __delslice__(self, i, j):\n del self[max(0, i):max(0, j):]\n ...\n\nNote the calls to "max()"; these are necessary because of the handling\nof negative indices before the "__*slice__()" methods are called.\nWhen negative indexes are used, the "__*item__()" methods receive them\nas provided, but the "__*slice__()" methods get a "cooked" form of the\nindex values. For each negative index value, the length of the\nsequence is added to the index before calling the method (which may\nstill result in a negative index); this is the customary handling of\nnegative indexes by the built-in sequence types, and the "__*item__()"\nmethods are expected to do this as well. However, since they should\nalready be doing that, negative indexes cannot be passed in; they must\nbe constrained to the bounds of the sequence before being passed to\nthe "__*item__()" methods. Calling "max(0, i)" conveniently returns\nthe proper value.\n\n\nEmulating numeric types\n=======================\n\nThe following methods can be defined to emulate numeric objects.\nMethods corresponding to operations that are not supported by the\nparticular kind of number implemented (e.g., bitwise operations for\nnon-integral numbers) should be left undefined.\n\nobject.__add__(self, other)\nobject.__sub__(self, other)\nobject.__mul__(self, other)\nobject.__floordiv__(self, other)\nobject.__mod__(self, other)\nobject.__divmod__(self, other)\nobject.__pow__(self, other[, modulo])\nobject.__lshift__(self, other)\nobject.__rshift__(self, other)\nobject.__and__(self, other)\nobject.__xor__(self, other)\nobject.__or__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "//", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|"). For instance, to evaluate the\n expression "x + y", where *x* is an instance of a class that has an\n "__add__()" method, "x.__add__(y)" is called. The "__divmod__()"\n method should be the equivalent to using "__floordiv__()" and\n "__mod__()"; it should not be related to "__truediv__()" (described\n below). Note that "__pow__()" should be defined to accept an\n optional third argument if the ternary version of the built-in\n "pow()" function is to be supported.\n\n If one of those methods does not support the operation with the\n supplied arguments, it should return "NotImplemented".\n\nobject.__div__(self, other)\nobject.__truediv__(self, other)\n\n The division operator ("/") is implemented by these methods. The\n "__truediv__()" method is used when "__future__.division" is in\n effect, otherwise "__div__()" is used. If only one of these two\n methods is defined, the object will not support division in the\n alternate context; "TypeError" will be raised instead.\n\nobject.__radd__(self, other)\nobject.__rsub__(self, other)\nobject.__rmul__(self, other)\nobject.__rdiv__(self, other)\nobject.__rtruediv__(self, other)\nobject.__rfloordiv__(self, other)\nobject.__rmod__(self, other)\nobject.__rdivmod__(self, other)\nobject.__rpow__(self, other)\nobject.__rlshift__(self, other)\nobject.__rrshift__(self, other)\nobject.__rand__(self, other)\nobject.__rxor__(self, other)\nobject.__ror__(self, other)\n\n These methods are called to implement the binary arithmetic\n operations ("+", "-", "*", "/", "%", "divmod()", "pow()", "**",\n "<<", ">>", "&", "^", "|") with reflected (swapped) operands.\n These functions are only called if the left operand does not\n support the corresponding operation and the operands are of\n different types. [2] For instance, to evaluate the expression "x -\n y", where *y* is an instance of a class that has an "__rsub__()"\n method, "y.__rsub__(x)" is called if "x.__sub__(y)" returns\n *NotImplemented*.\n\n Note that ternary "pow()" will not try calling "__rpow__()" (the\n coercion rules would become too complicated).\n\n Note: If the right operand\'s type is a subclass of the left\n operand\'s type and that subclass provides the reflected method\n for the operation, this method will be called before the left\n operand\'s non-reflected method. This behavior allows subclasses\n to override their ancestors\' operations.\n\nobject.__iadd__(self, other)\nobject.__isub__(self, other)\nobject.__imul__(self, other)\nobject.__idiv__(self, other)\nobject.__itruediv__(self, other)\nobject.__ifloordiv__(self, other)\nobject.__imod__(self, other)\nobject.__ipow__(self, other[, modulo])\nobject.__ilshift__(self, other)\nobject.__irshift__(self, other)\nobject.__iand__(self, other)\nobject.__ixor__(self, other)\nobject.__ior__(self, other)\n\n These methods are called to implement the augmented arithmetic\n assignments ("+=", "-=", "*=", "/=", "//=", "%=", "**=", "<<=",\n ">>=", "&=", "^=", "|="). These methods should attempt to do the\n operation in-place (modifying *self*) and return the result (which\n could be, but does not have to be, *self*). If a specific method\n is not defined, the augmented assignment falls back to the normal\n methods. For instance, to execute the statement "x += y", where\n *x* is an instance of a class that has an "__iadd__()" method,\n "x.__iadd__(y)" is called. If *x* is an instance of a class that\n does not define a "__iadd__()" method, "x.__add__(y)" and\n "y.__radd__(x)" are considered, as with the evaluation of "x + y".\n\nobject.__neg__(self)\nobject.__pos__(self)\nobject.__abs__(self)\nobject.__invert__(self)\n\n Called to implement the unary arithmetic operations ("-", "+",\n "abs()" and "~").\n\nobject.__complex__(self)\nobject.__int__(self)\nobject.__long__(self)\nobject.__float__(self)\n\n Called to implement the built-in functions "complex()", "int()",\n "long()", and "float()". Should return a value of the appropriate\n type.\n\nobject.__oct__(self)\nobject.__hex__(self)\n\n Called to implement the built-in functions "oct()" and "hex()".\n Should return a string value.\n\nobject.__index__(self)\n\n Called to implement "operator.index()". Also called whenever\n Python needs an integer object (such as in slicing). Must return\n an integer (int or long).\n\n New in version 2.5.\n\nobject.__coerce__(self, other)\n\n Called to implement "mixed-mode" numeric arithmetic. Should either\n return a 2-tuple containing *self* and *other* converted to a\n common numeric type, or "None" if conversion is impossible. When\n the common type would be the type of "other", it is sufficient to\n return "None", since the interpreter will also ask the other object\n to attempt a coercion (but sometimes, if the implementation of the\n other type cannot be changed, it is useful to do the conversion to\n the other type here). A return value of "NotImplemented" is\n equivalent to returning "None".\n\n\nCoercion rules\n==============\n\nThis section used to document the rules for coercion. As the language\nhas evolved, the coercion rules have become hard to document\nprecisely; documenting what one version of one particular\nimplementation does is undesirable. Instead, here are some informal\nguidelines regarding coercion. In Python 3, coercion will not be\nsupported.\n\n* If the left operand of a % operator is a string or Unicode object,\n no coercion takes place and the string formatting operation is\n invoked instead.\n\n* It is no longer recommended to define a coercion operation. Mixed-\n mode operations on types that don\'t define coercion pass the\n original arguments to the operation.\n\n* New-style classes (those derived from "object") never invoke the\n "__coerce__()" method in response to a binary operator; the only\n time "__coerce__()" is invoked is when the built-in function\n "coerce()" is called.\n\n* For most intents and purposes, an operator that returns\n "NotImplemented" is treated the same as one that is not implemented\n at all.\n\n* Below, "__op__()" and "__rop__()" are used to signify the generic\n method names corresponding to an operator; "__iop__()" is used for\n the corresponding in-place operator. For example, for the operator\n \'"+"\', "__add__()" and "__radd__()" are used for the left and right\n variant of the binary operator, and "__iadd__()" for the in-place\n variant.\n\n* For objects *x* and *y*, first "x.__op__(y)" is tried. If this is\n not implemented or returns "NotImplemented", "y.__rop__(x)" is\n tried. If this is also not implemented or returns "NotImplemented",\n a "TypeError" exception is raised. But see the following exception:\n\n* Exception to the previous item: if the left operand is an instance\n of a built-in type or a new-style class, and the right operand is an\n instance of a proper subclass of that type or class and overrides\n the base\'s "__rop__()" method, the right operand\'s "__rop__()"\n method is tried *before* the left operand\'s "__op__()" method.\n\n This is done so that a subclass can completely override binary\n operators. Otherwise, the left operand\'s "__op__()" method would\n always accept the right operand: when an instance of a given class\n is expected, an instance of a subclass of that class is always\n acceptable.\n\n* When either operand type defines a coercion, this coercion is\n called before that type\'s "__op__()" or "__rop__()" method is\n called, but no sooner. If the coercion returns an object of a\n different type for the operand whose coercion is invoked, part of\n the process is redone using the new object.\n\n* When an in-place operator (like \'"+="\') is used, if the left\n operand implements "__iop__()", it is invoked without any coercion.\n When the operation falls back to "__op__()" and/or "__rop__()", the\n normal coercion rules apply.\n\n* In "x + y", if *x* is a sequence that implements sequence\n concatenation, sequence concatenation is invoked.\n\n* In "x * y", if one operand is a sequence that implements sequence\n repetition, and the other is an integer ("int" or "long"), sequence\n repetition is invoked.\n\n* Rich comparisons (implemented by methods "__eq__()" and so on)\n never use coercion. Three-way comparison (implemented by\n "__cmp__()") does use coercion under the same conditions as other\n binary operations use it.\n\n* In the current implementation, the built-in numeric types "int",\n "long", "float", and "complex" do not use coercion. All these types\n implement a "__coerce__()" method, for use by the built-in\n "coerce()" function.\n\n Changed in version 2.7: The complex type no longer makes implicit\n calls to the "__coerce__()" method for mixed-type binary arithmetic\n operations.\n\n\nWith Statement Context Managers\n===============================\n\nNew in version 2.5.\n\nA *context manager* is an object that defines the runtime context to\nbe established when executing a "with" statement. The context manager\nhandles the entry into, and the exit from, the desired runtime context\nfor the execution of the block of code. Context managers are normally\ninvoked using the "with" statement (described in section The with\nstatement), but can also be used by directly invoking their methods.\n\nTypical uses of context managers include saving and restoring various\nkinds of global state, locking and unlocking resources, closing opened\nfiles, etc.\n\nFor more information on context managers, see Context Manager Types.\n\nobject.__enter__(self)\n\n Enter the runtime context related to this object. The "with"\n statement will bind this method\'s return value to the target(s)\n specified in the "as" clause of the statement, if any.\n\nobject.__exit__(self, exc_type, exc_value, traceback)\n\n Exit the runtime context related to this object. The parameters\n describe the exception that caused the context to be exited. If the\n context was exited without an exception, all three arguments will\n be "None".\n\n If an exception is supplied, and the method wishes to suppress the\n exception (i.e., prevent it from being propagated), it should\n return a true value. Otherwise, the exception will be processed\n normally upon exit from this method.\n\n Note that "__exit__()" methods should not reraise the passed-in\n exception; this is the caller\'s responsibility.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n\n\nSpecial method lookup for old-style classes\n===========================================\n\nFor old-style classes, special methods are always looked up in exactly\nthe same way as any other method or attribute. This is the case\nregardless of whether the method is being looked up explicitly as in\n"x.__getitem__(i)" or implicitly as in "x[i]".\n\nThis behaviour means that special methods may exhibit different\nbehaviour for different instances of a single old-style class if the\nappropriate special attributes are set differently:\n\n >>> class C:\n ... pass\n ...\n >>> c1 = C()\n >>> c2 = C()\n >>> c1.__len__ = lambda: 5\n >>> c2.__len__ = lambda: 9\n >>> len(c1)\n 5\n >>> len(c2)\n 9\n\n\nSpecial method lookup for new-style classes\n===========================================\n\nFor new-style classes, implicit invocations of special methods are\nonly guaranteed to work correctly if defined on an object\'s type, not\nin the object\'s instance dictionary. That behaviour is the reason why\nthe following code raises an exception (unlike the equivalent example\nwith old-style classes):\n\n >>> class C(object):\n ... pass\n ...\n >>> c = C()\n >>> c.__len__ = lambda: 5\n >>> len(c)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: object of type \'C\' has no len()\n\nThe rationale behind this behaviour lies with a number of special\nmethods such as "__hash__()" and "__repr__()" that are implemented by\nall objects, including type objects. If the implicit lookup of these\nmethods used the conventional lookup process, they would fail when\ninvoked on the type object itself:\n\n >>> 1 .__hash__() == hash(1)\n True\n >>> int.__hash__() == hash(int)\n Traceback (most recent call last):\n File "", line 1, in \n TypeError: descriptor \'__hash__\' of \'int\' object needs an argument\n\nIncorrectly attempting to invoke an unbound method of a class in this\nway is sometimes referred to as \'metaclass confusion\', and is avoided\nby bypassing the instance when looking up special methods:\n\n >>> type(1).__hash__(1) == hash(1)\n True\n >>> type(int).__hash__(int) == hash(int)\n True\n\nIn addition to bypassing any instance attributes in the interest of\ncorrectness, implicit special method lookup generally also bypasses\nthe "__getattribute__()" method even of the object\'s metaclass:\n\n >>> class Meta(type):\n ... def __getattribute__(*args):\n ... print "Metaclass getattribute invoked"\n ... return type.__getattribute__(*args)\n ...\n >>> class C(object):\n ... __metaclass__ = Meta\n ... def __len__(self):\n ... return 10\n ... def __getattribute__(*args):\n ... print "Class getattribute invoked"\n ... return object.__getattribute__(*args)\n ...\n >>> c = C()\n >>> c.__len__() # Explicit lookup via instance\n Class getattribute invoked\n 10\n >>> type(c).__len__(c) # Explicit lookup via type\n Metaclass getattribute invoked\n 10\n >>> len(c) # Implicit lookup\n 10\n\nBypassing the "__getattribute__()" machinery in this fashion provides\nsignificant scope for speed optimisations within the interpreter, at\nthe cost of some flexibility in the handling of special methods (the\nspecial method *must* be set on the class object itself in order to be\nconsistently invoked by the interpreter).\n\n-[ Footnotes ]-\n\n[1] It *is* possible in some cases to change an object\'s type,\n under certain controlled conditions. It generally isn\'t a good\n idea though, since it can lead to some very strange behaviour if\n it is handled incorrectly.\n\n[2] For operands of the same type, it is assumed that if the non-\n reflected method (such as "__add__()") fails the operation is not\n supported, which is why the reflected method is not called.\n', - 'string-methods': u'\nString Methods\n**************\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n "\'strict\'", meaning that encoding errors raise "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'" and any other\n name registered via "codecs.register_error()", see section Codec\n Base Classes.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'",\n "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n registered via "codecs.register_error()", see section Codec Base\n Classes. For a list of possible encodings, see section Standard\n Encodings.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n "\'backslashreplace\'" and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" if *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See Format String Syntax for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the "%" formatting described in String\n Formatting Operations in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example, "\' 1 2 3 \'.split()" returns "[\'1\', \'2\', \'3\']", and\n "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 \']".\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n c\', \'\', \'de fg\', \'kl\']", while the same call with\n "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']".\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the "maketrans()" helper function in the "string"\n module to create a translation table. For string objects, set the\n *table* argument to "None" for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a "None" *table* argument.\n\n For Unicode objects, the "translate()" method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or "None". Unmapped characters\n are left untouched. Characters mapped to "None" are deleted. Note,\n a more flexible approach is to create a custom character mapping\n codec using the "codecs" module (see "encodings.cp1251" for an\n example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to "len(s)".\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return "True" if there are only numeric characters in S, "False"\n otherwise. Numeric characters include digit characters, and all\n characters that have the Unicode numeric value property, e.g.\n U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return "True" if there are only decimal characters in S, "False"\n otherwise. Decimal characters include digit characters, and all\n characters that can be used to form decimal-radix numbers, e.g.\n U+0660, ARABIC-INDIC DIGIT ZERO.\n', - 'strings': u'\nString literals\n***************\n\nString literals are described by the following lexical definitions:\n\n stringliteral ::= [stringprefix](shortstring | longstring)\n stringprefix ::= "r" | "u" | "ur" | "R" | "U" | "UR" | "Ur" | "uR"\n | "b" | "B" | "br" | "Br" | "bR" | "BR"\n shortstring ::= "\'" shortstringitem* "\'" | \'"\' shortstringitem* \'"\'\n longstring ::= "\'\'\'" longstringitem* "\'\'\'"\n | \'"""\' longstringitem* \'"""\'\n shortstringitem ::= shortstringchar | escapeseq\n longstringitem ::= longstringchar | escapeseq\n shortstringchar ::= \n longstringchar ::= \n escapeseq ::= "\\" \n\nOne syntactic restriction not indicated by these productions is that\nwhitespace is not allowed between the "stringprefix" and the rest of\nthe string literal. The source character set is defined by the\nencoding declaration; it is ASCII if no encoding declaration is given\nin the source file; see section Encoding declarations.\n\nIn plain English: String literals can be enclosed in matching single\nquotes ("\'") or double quotes ("""). They can also be enclosed in\nmatching groups of three single or double quotes (these are generally\nreferred to as *triple-quoted strings*). The backslash ("\\")\ncharacter is used to escape characters that otherwise have a special\nmeaning, such as newline, backslash itself, or the quote character.\nString literals may optionally be prefixed with a letter "\'r\'" or\n"\'R\'"; such strings are called *raw strings* and use different rules\nfor interpreting backslash escape sequences. A prefix of "\'u\'" or\n"\'U\'" makes the string a Unicode string. Unicode strings use the\nUnicode character set as defined by the Unicode Consortium and ISO\n10646. Some additional escape sequences, described below, are\navailable in Unicode strings. A prefix of "\'b\'" or "\'B\'" is ignored in\nPython 2; it indicates that the literal should become a bytes literal\nin Python 3 (e.g. when code is automatically converted with 2to3). A\n"\'u\'" or "\'b\'" prefix may be followed by an "\'r\'" prefix.\n\nIn triple-quoted strings, unescaped newlines and quotes are allowed\n(and are retained), except that three unescaped quotes in a row\nterminate the string. (A "quote" is the character used to open the\nstring, i.e. either "\'" or """.)\n\nUnless an "\'r\'" or "\'R\'" prefix is present, escape sequences in\nstrings are interpreted according to rules similar to those used by\nStandard C. The recognized escape sequences are:\n\n+-------------------+-----------------------------------+---------+\n| Escape Sequence | Meaning | Notes |\n+===================+===================================+=========+\n| "\\newline" | Ignored | |\n+-------------------+-----------------------------------+---------+\n| "\\\\" | Backslash ("\\") | |\n+-------------------+-----------------------------------+---------+\n| "\\\'" | Single quote ("\'") | |\n+-------------------+-----------------------------------+---------+\n| "\\"" | Double quote (""") | |\n+-------------------+-----------------------------------+---------+\n| "\\a" | ASCII Bell (BEL) | |\n+-------------------+-----------------------------------+---------+\n| "\\b" | ASCII Backspace (BS) | |\n+-------------------+-----------------------------------+---------+\n| "\\f" | ASCII Formfeed (FF) | |\n+-------------------+-----------------------------------+---------+\n| "\\n" | ASCII Linefeed (LF) | |\n+-------------------+-----------------------------------+---------+\n| "\\N{name}" | Character named *name* in the | |\n| | Unicode database (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\r" | ASCII Carriage Return (CR) | |\n+-------------------+-----------------------------------+---------+\n| "\\t" | ASCII Horizontal Tab (TAB) | |\n+-------------------+-----------------------------------+---------+\n| "\\uxxxx" | Character with 16-bit hex value | (1) |\n| | *xxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\Uxxxxxxxx" | Character with 32-bit hex value | (2) |\n| | *xxxxxxxx* (Unicode only) | |\n+-------------------+-----------------------------------+---------+\n| "\\v" | ASCII Vertical Tab (VT) | |\n+-------------------+-----------------------------------+---------+\n| "\\ooo" | Character with octal value *ooo* | (3,5) |\n+-------------------+-----------------------------------+---------+\n| "\\xhh" | Character with hex value *hh* | (4,5) |\n+-------------------+-----------------------------------+---------+\n\nNotes:\n\n1. Individual code units which form parts of a surrogate pair can\n be encoded using this escape sequence.\n\n2. Any Unicode character can be encoded this way, but characters\n outside the Basic Multilingual Plane (BMP) will be encoded using a\n surrogate pair if Python is compiled to use 16-bit code units (the\n default).\n\n3. As in Standard C, up to three octal digits are accepted.\n\n4. Unlike in Standard C, exactly two hex digits are required.\n\n5. In a string literal, hexadecimal and octal escapes denote the\n byte with the given value; it is not necessary that the byte\n encodes a character in the source character set. In a Unicode\n literal, these escapes denote a Unicode character with the given\n value.\n\nUnlike Standard C, all unrecognized escape sequences are left in the\nstring unchanged, i.e., *the backslash is left in the string*. (This\nbehavior is useful when debugging: if an escape sequence is mistyped,\nthe resulting output is more easily recognized as broken.) It is also\nimportant to note that the escape sequences marked as "(Unicode only)"\nin the table above fall into the category of unrecognized escapes for\nnon-Unicode string literals.\n\nWhen an "\'r\'" or "\'R\'" prefix is present, a character following a\nbackslash is included in the string without change, and *all\nbackslashes are left in the string*. For example, the string literal\n"r"\\n"" consists of two characters: a backslash and a lowercase "\'n\'".\nString quotes can be escaped with a backslash, but the backslash\nremains in the string; for example, "r"\\""" is a valid string literal\nconsisting of two characters: a backslash and a double quote; "r"\\""\nis not a valid string literal (even a raw string cannot end in an odd\nnumber of backslashes). Specifically, *a raw string cannot end in a\nsingle backslash* (since the backslash would escape the following\nquote character). Note also that a single backslash followed by a\nnewline is interpreted as those two characters as part of the string,\n*not* as a line continuation.\n\nWhen an "\'r\'" or "\'R\'" prefix is used in conjunction with a "\'u\'" or\n"\'U\'" prefix, then the "\\uXXXX" and "\\UXXXXXXXX" escape sequences are\nprocessed while *all other backslashes are left in the string*. For\nexample, the string literal "ur"\\u0062\\n"" consists of three Unicode\ncharacters: \'LATIN SMALL LETTER B\', \'REVERSE SOLIDUS\', and \'LATIN\nSMALL LETTER N\'. Backslashes can be escaped with a preceding\nbackslash; however, both remain in the string. As a result, "\\uXXXX"\nescape sequences are only recognized when there are an odd number of\nbackslashes.\n', - 'subscriptions': u'\nSubscriptions\n*************\n\nA subscription selects an item of a sequence (string, tuple or list)\nor mapping (dictionary) object:\n\n subscription ::= primary "[" expression_list "]"\n\nThe primary must evaluate to an object of a sequence or mapping type.\n\nIf the primary is a mapping, the expression list must evaluate to an\nobject whose value is one of the keys of the mapping, and the\nsubscription selects the value in the mapping that corresponds to that\nkey. (The expression list is a tuple except if it has exactly one\nitem.)\n\nIf the primary is a sequence, the expression (list) must evaluate to a\nplain integer. If this value is negative, the length of the sequence\nis added to it (so that, e.g., "x[-1]" selects the last item of "x".)\nThe resulting value must be a nonnegative integer less than the number\nof items in the sequence, and the subscription selects the item whose\nindex is that value (counting from zero).\n\nA string\'s items are characters. A character is not a separate data\ntype but a string of exactly one character.\n', - 'truth': u'\nTruth Value Testing\n*******************\n\nAny object can be tested for truth value, for use in an "if" or\n"while" condition or as operand of the Boolean operations below. The\nfollowing values are considered false:\n\n* "None"\n\n* "False"\n\n* zero of any numeric type, for example, "0", "0L", "0.0", "0j".\n\n* any empty sequence, for example, "\'\'", "()", "[]".\n\n* any empty mapping, for example, "{}".\n\n* instances of user-defined classes, if the class defines a\n "__nonzero__()" or "__len__()" method, when that method returns the\n integer zero or "bool" value "False". [1]\n\nAll other values are considered true --- so objects of many types are\nalways true.\n\nOperations and built-in functions that have a Boolean result always\nreturn "0" or "False" for false and "1" or "True" for true, unless\notherwise stated. (Important exception: the Boolean operations "or"\nand "and" always return one of their operands.)\n', - 'try': u'\nThe "try" statement\n*******************\n\nThe "try" statement specifies exception handlers and/or cleanup code\nfor a group of statements:\n\n try_stmt ::= try1_stmt | try2_stmt\n try1_stmt ::= "try" ":" suite\n ("except" [expression [("as" | ",") identifier]] ":" suite)+\n ["else" ":" suite]\n ["finally" ":" suite]\n try2_stmt ::= "try" ":" suite\n "finally" ":" suite\n\nChanged in version 2.5: In previous versions of Python,\n"try"..."except"..."finally" did not work. "try"..."except" had to be\nnested in "try"..."finally".\n\nThe "except" clause(s) specify one or more exception handlers. When no\nexception occurs in the "try" clause, no exception handler is\nexecuted. When an exception occurs in the "try" suite, a search for an\nexception handler is started. This search inspects the except clauses\nin turn until one is found that matches the exception. An expression-\nless except clause, if present, must be last; it matches any\nexception. For an except clause with an expression, that expression\nis evaluated, and the clause matches the exception if the resulting\nobject is "compatible" with the exception. An object is compatible\nwith an exception if it is the class or a base class of the exception\nobject, or a tuple containing an item compatible with the exception.\n\nIf no except clause matches the exception, the search for an exception\nhandler continues in the surrounding code and on the invocation stack.\n[1]\n\nIf the evaluation of an expression in the header of an except clause\nraises an exception, the original search for a handler is canceled and\na search starts for the new exception in the surrounding code and on\nthe call stack (it is treated as if the entire "try" statement raised\nthe exception).\n\nWhen a matching except clause is found, the exception is assigned to\nthe target specified in that except clause, if present, and the except\nclause\'s suite is executed. All except clauses must have an\nexecutable block. When the end of this block is reached, execution\ncontinues normally after the entire try statement. (This means that\nif two nested handlers exist for the same exception, and the exception\noccurs in the try clause of the inner handler, the outer handler will\nnot handle the exception.)\n\nBefore an except clause\'s suite is executed, details about the\nexception are assigned to three variables in the "sys" module:\n"sys.exc_type" receives the object identifying the exception;\n"sys.exc_value" receives the exception\'s parameter;\n"sys.exc_traceback" receives a traceback object (see section The\nstandard type hierarchy) identifying the point in the program where\nthe exception occurred. These details are also available through the\n"sys.exc_info()" function, which returns a tuple "(exc_type,\nexc_value, exc_traceback)". Use of the corresponding variables is\ndeprecated in favor of this function, since their use is unsafe in a\nthreaded program. As of Python 1.5, the variables are restored to\ntheir previous values (before the call) when returning from a function\nthat handled an exception.\n\nThe optional "else" clause is executed if and when control flows off\nthe end of the "try" clause. [2] Exceptions in the "else" clause are\nnot handled by the preceding "except" clauses.\n\nIf "finally" is present, it specifies a \'cleanup\' handler. The "try"\nclause is executed, including any "except" and "else" clauses. If an\nexception occurs in any of the clauses and is not handled, the\nexception is temporarily saved. The "finally" clause is executed. If\nthere is a saved exception, it is re-raised at the end of the\n"finally" clause. If the "finally" clause raises another exception or\nexecutes a "return" or "break" statement, the saved exception is\ndiscarded:\n\n >>> def f():\n ... try:\n ... 1/0\n ... finally:\n ... return 42\n ...\n >>> f()\n 42\n\nThe exception information is not available to the program during\nexecution of the "finally" clause.\n\nWhen a "return", "break" or "continue" statement is executed in the\n"try" suite of a "try"..."finally" statement, the "finally" clause is\nalso executed \'on the way out.\' A "continue" statement is illegal in\nthe "finally" clause. (The reason is a problem with the current\nimplementation --- this restriction may be lifted in the future).\n\nThe return value of a function is determined by the last "return"\nstatement executed. Since the "finally" clause always executes, a\n"return" statement executed in the "finally" clause will always be the\nlast one executed:\n\n >>> def foo():\n ... try:\n ... return \'try\'\n ... finally:\n ... return \'finally\'\n ...\n >>> foo()\n \'finally\'\n\nAdditional information on exceptions can be found in section\nExceptions, and information on using the "raise" statement to generate\nexceptions may be found in section The raise statement.\n', - 'types': u'\nThe standard type hierarchy\n***************************\n\nBelow is a list of the types that are built into Python. Extension\nmodules (written in C, Java, or other languages, depending on the\nimplementation) can define additional types. Future versions of\nPython may add types to the type hierarchy (e.g., rational numbers,\nefficiently stored arrays of integers, etc.).\n\nSome of the type descriptions below contain a paragraph listing\n\'special attributes.\' These are attributes that provide access to the\nimplementation and are not intended for general use. Their definition\nmay change in the future.\n\nNone\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name "None". It\n is used to signify the absence of a value in many situations, e.g.,\n it is returned from functions that don\'t explicitly return\n anything. Its truth value is false.\n\nNotImplemented\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "NotImplemented". Numeric methods and rich comparison methods may\n return this value if they do not implement the operation for the\n operands provided. (The interpreter will then try the reflected\n operation, or some other fallback, depending on the operator.) Its\n truth value is true.\n\nEllipsis\n This type has a single value. There is a single object with this\n value. This object is accessed through the built-in name\n "Ellipsis". It is used to indicate the presence of the "..." syntax\n in a slice. Its truth value is true.\n\n"numbers.Number"\n These are created by numeric literals and returned as results by\n arithmetic operators and arithmetic built-in functions. Numeric\n objects are immutable; once created their value never changes.\n Python numbers are of course strongly related to mathematical\n numbers, but subject to the limitations of numerical representation\n in computers.\n\n Python distinguishes between integers, floating point numbers, and\n complex numbers:\n\n "numbers.Integral"\n These represent elements from the mathematical set of integers\n (positive and negative).\n\n There are three types of integers:\n\n Plain integers\n These represent numbers in the range -2147483648 through\n 2147483647. (The range may be larger on machines with a\n larger natural word size, but not smaller.) When the result\n of an operation would fall outside this range, the result is\n normally returned as a long integer (in some cases, the\n exception "OverflowError" is raised instead). For the\n purpose of shift and mask operations, integers are assumed to\n have a binary, 2\'s complement notation using 32 or more bits,\n and hiding no bits from the user (i.e., all 4294967296\n different bit patterns correspond to different values).\n\n Long integers\n These represent numbers in an unlimited range, subject to\n available (virtual) memory only. For the purpose of shift\n and mask operations, a binary representation is assumed, and\n negative numbers are represented in a variant of 2\'s\n complement which gives the illusion of an infinite string of\n sign bits extending to the left.\n\n Booleans\n These represent the truth values False and True. The two\n objects representing the values "False" and "True" are the\n only Boolean objects. The Boolean type is a subtype of plain\n integers, and Boolean values behave like the values 0 and 1,\n respectively, in almost all contexts, the exception being\n that when converted to a string, the strings ""False"" or\n ""True"" are returned, respectively.\n\n The rules for integer representation are intended to give the\n most meaningful interpretation of shift and mask operations\n involving negative integers and the least surprises when\n switching between the plain and long integer domains. Any\n operation, if it yields a result in the plain integer domain,\n will yield the same result in the long integer domain or when\n using mixed operands. The switch between domains is transparent\n to the programmer.\n\n "numbers.Real" ("float")\n These represent machine-level double precision floating point\n numbers. You are at the mercy of the underlying machine\n architecture (and C or Java implementation) for the accepted\n range and handling of overflow. Python does not support single-\n precision floating point numbers; the savings in processor and\n memory usage that are usually the reason for using these are\n dwarfed by the overhead of using objects in Python, so there is\n no reason to complicate the language with two kinds of floating\n point numbers.\n\n "numbers.Complex"\n These represent complex numbers as a pair of machine-level\n double precision floating point numbers. The same caveats apply\n as for floating point numbers. The real and imaginary parts of a\n complex number "z" can be retrieved through the read-only\n attributes "z.real" and "z.imag".\n\nSequences\n These represent finite ordered sets indexed by non-negative\n numbers. The built-in function "len()" returns the number of items\n of a sequence. When the length of a sequence is *n*, the index set\n contains the numbers 0, 1, ..., *n*-1. Item *i* of sequence *a* is\n selected by "a[i]".\n\n Sequences also support slicing: "a[i:j]" selects all items with\n index *k* such that *i* "<=" *k* "<" *j*. When used as an\n expression, a slice is a sequence of the same type. This implies\n that the index set is renumbered so that it starts at 0.\n\n Some sequences also support "extended slicing" with a third "step"\n parameter: "a[i:j:k]" selects all items of *a* with index *x* where\n "x = i + n*k", *n* ">=" "0" and *i* "<=" *x* "<" *j*.\n\n Sequences are distinguished according to their mutability:\n\n Immutable sequences\n An object of an immutable sequence type cannot change once it is\n created. (If the object contains references to other objects,\n these other objects may be mutable and may be changed; however,\n the collection of objects directly referenced by an immutable\n object cannot change.)\n\n The following types are immutable sequences:\n\n Strings\n The items of a string are characters. There is no separate\n character type; a character is represented by a string of one\n item. Characters represent (at least) 8-bit bytes. The\n built-in functions "chr()" and "ord()" convert between\n characters and nonnegative integers representing the byte\n values. Bytes with the values 0-127 usually represent the\n corresponding ASCII values, but the interpretation of values\n is up to the program. The string data type is also used to\n represent arrays of bytes, e.g., to hold data read from a\n file.\n\n (On systems whose native character set is not ASCII, strings\n may use EBCDIC in their internal representation, provided the\n functions "chr()" and "ord()" implement a mapping between\n ASCII and EBCDIC, and string comparison preserves the ASCII\n order. Or perhaps someone can propose a better rule?)\n\n Unicode\n The items of a Unicode object are Unicode code units. A\n Unicode code unit is represented by a Unicode object of one\n item and can hold either a 16-bit or 32-bit value\n representing a Unicode ordinal (the maximum value for the\n ordinal is given in "sys.maxunicode", and depends on how\n Python is configured at compile time). Surrogate pairs may\n be present in the Unicode object, and will be reported as two\n separate items. The built-in functions "unichr()" and\n "ord()" convert between code units and nonnegative integers\n representing the Unicode ordinals as defined in the Unicode\n Standard 3.0. Conversion from and to other encodings are\n possible through the Unicode method "encode()" and the built-\n in function "unicode()".\n\n Tuples\n The items of a tuple are arbitrary Python objects. Tuples of\n two or more items are formed by comma-separated lists of\n expressions. A tuple of one item (a \'singleton\') can be\n formed by affixing a comma to an expression (an expression by\n itself does not create a tuple, since parentheses must be\n usable for grouping of expressions). An empty tuple can be\n formed by an empty pair of parentheses.\n\n Mutable sequences\n Mutable sequences can be changed after they are created. The\n subscription and slicing notations can be used as the target of\n assignment and "del" (delete) statements.\n\n There are currently two intrinsic mutable sequence types:\n\n Lists\n The items of a list are arbitrary Python objects. Lists are\n formed by placing a comma-separated list of expressions in\n square brackets. (Note that there are no special cases needed\n to form lists of length 0 or 1.)\n\n Byte Arrays\n A bytearray object is a mutable array. They are created by\n the built-in "bytearray()" constructor. Aside from being\n mutable (and hence unhashable), byte arrays otherwise provide\n the same interface and functionality as immutable bytes\n objects.\n\n The extension module "array" provides an additional example of a\n mutable sequence type.\n\nSet types\n These represent unordered, finite sets of unique, immutable\n objects. As such, they cannot be indexed by any subscript. However,\n they can be iterated over, and the built-in function "len()"\n returns the number of items in a set. Common uses for sets are fast\n membership testing, removing duplicates from a sequence, and\n computing mathematical operations such as intersection, union,\n difference, and symmetric difference.\n\n For set elements, the same immutability rules apply as for\n dictionary keys. Note that numeric types obey the normal rules for\n numeric comparison: if two numbers compare equal (e.g., "1" and\n "1.0"), only one of them can be contained in a set.\n\n There are currently two intrinsic set types:\n\n Sets\n These represent a mutable set. They are created by the built-in\n "set()" constructor and can be modified afterwards by several\n methods, such as "add()".\n\n Frozen sets\n These represent an immutable set. They are created by the\n built-in "frozenset()" constructor. As a frozenset is immutable\n and *hashable*, it can be used again as an element of another\n set, or as a dictionary key.\n\nMappings\n These represent finite sets of objects indexed by arbitrary index\n sets. The subscript notation "a[k]" selects the item indexed by "k"\n from the mapping "a"; this can be used in expressions and as the\n target of assignments or "del" statements. The built-in function\n "len()" returns the number of items in a mapping.\n\n There is currently a single intrinsic mapping type:\n\n Dictionaries\n These represent finite sets of objects indexed by nearly\n arbitrary values. The only types of values not acceptable as\n keys are values containing lists or dictionaries or other\n mutable types that are compared by value rather than by object\n identity, the reason being that the efficient implementation of\n dictionaries requires a key\'s hash value to remain constant.\n Numeric types used for keys obey the normal rules for numeric\n comparison: if two numbers compare equal (e.g., "1" and "1.0")\n then they can be used interchangeably to index the same\n dictionary entry.\n\n Dictionaries are mutable; they can be created by the "{...}"\n notation (see section Dictionary displays).\n\n The extension modules "dbm", "gdbm", and "bsddb" provide\n additional examples of mapping types.\n\nCallable types\n These are the types to which the function call operation (see\n section Calls) can be applied:\n\n User-defined functions\n A user-defined function object is created by a function\n definition (see section Function definitions). It should be\n called with an argument list containing the same number of items\n as the function\'s formal parameter list.\n\n Special attributes:\n\n +-------------------------+---------------------------------+-------------+\n | Attribute | Meaning | |\n +=========================+=================================+=============+\n | "__doc__" "func_doc" | The function\'s documentation | Writable |\n | | string, or "None" if | |\n | | unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | "__name__" "func_name" | The function\'s name. | Writable |\n +-------------------------+---------------------------------+-------------+\n | "__module__" | The name of the module the | Writable |\n | | function was defined in, or | |\n | | "None" if unavailable. | |\n +-------------------------+---------------------------------+-------------+\n | "__defaults__" | A tuple containing default | Writable |\n | "func_defaults" | argument values for those | |\n | | arguments that have defaults, | |\n | | or "None" if no arguments have | |\n | | a default value. | |\n +-------------------------+---------------------------------+-------------+\n | "__code__" "func_code" | The code object representing | Writable |\n | | the compiled function body. | |\n +-------------------------+---------------------------------+-------------+\n | "__globals__" | A reference to the dictionary | Read-only |\n | "func_globals" | that holds the function\'s | |\n | | global variables --- the global | |\n | | namespace of the module in | |\n | | which the function was defined. | |\n +-------------------------+---------------------------------+-------------+\n | "__dict__" "func_dict" | The namespace supporting | Writable |\n | | arbitrary function attributes. | |\n +-------------------------+---------------------------------+-------------+\n | "__closure__" | "None" or a tuple of cells that | Read-only |\n | "func_closure" | contain bindings for the | |\n | | function\'s free variables. | |\n +-------------------------+---------------------------------+-------------+\n\n Most of the attributes labelled "Writable" check the type of the\n assigned value.\n\n Changed in version 2.4: "func_name" is now writable.\n\n Changed in version 2.6: The double-underscore attributes\n "__closure__", "__code__", "__defaults__", and "__globals__"\n were introduced as aliases for the corresponding "func_*"\n attributes for forwards compatibility with Python 3.\n\n Function objects also support getting and setting arbitrary\n attributes, which can be used, for example, to attach metadata\n to functions. Regular attribute dot-notation is used to get and\n set such attributes. *Note that the current implementation only\n supports function attributes on user-defined functions. Function\n attributes on built-in functions may be supported in the\n future.*\n\n Additional information about a function\'s definition can be\n retrieved from its code object; see the description of internal\n types below.\n\n User-defined methods\n A user-defined method object combines a class, a class instance\n (or "None") and any callable object (normally a user-defined\n function).\n\n Special read-only attributes: "im_self" is the class instance\n object, "im_func" is the function object; "im_class" is the\n class of "im_self" for bound methods or the class that asked for\n the method for unbound methods; "__doc__" is the method\'s\n documentation (same as "im_func.__doc__"); "__name__" is the\n method name (same as "im_func.__name__"); "__module__" is the\n name of the module the method was defined in, or "None" if\n unavailable.\n\n Changed in version 2.2: "im_self" used to refer to the class\n that defined the method.\n\n Changed in version 2.6: For Python 3 forward-compatibility,\n "im_func" is also available as "__func__", and "im_self" as\n "__self__".\n\n Methods also support accessing (but not setting) the arbitrary\n function attributes on the underlying function object.\n\n User-defined method objects may be created when getting an\n attribute of a class (perhaps via an instance of that class), if\n that attribute is a user-defined function object, an unbound\n user-defined method object, or a class method object. When the\n attribute is a user-defined method object, a new method object\n is only created if the class from which it is being retrieved is\n the same as, or a derived class of, the class stored in the\n original method object; otherwise, the original method object is\n used as it is.\n\n When a user-defined method object is created by retrieving a\n user-defined function object from a class, its "im_self"\n attribute is "None" and the method object is said to be unbound.\n When one is created by retrieving a user-defined function object\n from a class via one of its instances, its "im_self" attribute\n is the instance, and the method object is said to be bound. In\n either case, the new method\'s "im_class" attribute is the class\n from which the retrieval takes place, and its "im_func"\n attribute is the original function object.\n\n When a user-defined method object is created by retrieving\n another method object from a class or instance, the behaviour is\n the same as for a function object, except that the "im_func"\n attribute of the new instance is not the original method object\n but its "im_func" attribute.\n\n When a user-defined method object is created by retrieving a\n class method object from a class or instance, its "im_self"\n attribute is the class itself, and its "im_func" attribute is\n the function object underlying the class method.\n\n When an unbound user-defined method object is called, the\n underlying function ("im_func") is called, with the restriction\n that the first argument must be an instance of the proper class\n ("im_class") or of a derived class thereof.\n\n When a bound user-defined method object is called, the\n underlying function ("im_func") is called, inserting the class\n instance ("im_self") in front of the argument list. For\n instance, when "C" is a class which contains a definition for a\n function "f()", and "x" is an instance of "C", calling "x.f(1)"\n is equivalent to calling "C.f(x, 1)".\n\n When a user-defined method object is derived from a class method\n object, the "class instance" stored in "im_self" will actually\n be the class itself, so that calling either "x.f(1)" or "C.f(1)"\n is equivalent to calling "f(C,1)" where "f" is the underlying\n function.\n\n Note that the transformation from function object to (unbound or\n bound) method object happens each time the attribute is\n retrieved from the class or instance. In some cases, a fruitful\n optimization is to assign the attribute to a local variable and\n call that local variable. Also notice that this transformation\n only happens for user-defined functions; other callable objects\n (and all non-callable objects) are retrieved without\n transformation. It is also important to note that user-defined\n functions which are attributes of a class instance are not\n converted to bound methods; this *only* happens when the\n function is an attribute of the class.\n\n Generator functions\n A function or method which uses the "yield" statement (see\n section The yield statement) is called a *generator function*.\n Such a function, when called, always returns an iterator object\n which can be used to execute the body of the function: calling\n the iterator\'s "next()" method will cause the function to\n execute until it provides a value using the "yield" statement.\n When the function executes a "return" statement or falls off the\n end, a "StopIteration" exception is raised and the iterator will\n have reached the end of the set of values to be returned.\n\n Built-in functions\n A built-in function object is a wrapper around a C function.\n Examples of built-in functions are "len()" and "math.sin()"\n ("math" is a standard built-in module). The number and type of\n the arguments are determined by the C function. Special read-\n only attributes: "__doc__" is the function\'s documentation\n string, or "None" if unavailable; "__name__" is the function\'s\n name; "__self__" is set to "None" (but see the next item);\n "__module__" is the name of the module the function was defined\n in or "None" if unavailable.\n\n Built-in methods\n This is really a different disguise of a built-in function, this\n time containing an object passed to the C function as an\n implicit extra argument. An example of a built-in method is\n "alist.append()", assuming *alist* is a list object. In this\n case, the special read-only attribute "__self__" is set to the\n object denoted by *alist*.\n\n Class Types\n Class types, or "new-style classes," are callable. These\n objects normally act as factories for new instances of\n themselves, but variations are possible for class types that\n override "__new__()". The arguments of the call are passed to\n "__new__()" and, in the typical case, to "__init__()" to\n initialize the new instance.\n\n Classic Classes\n Class objects are described below. When a class object is\n called, a new class instance (also described below) is created\n and returned. This implies a call to the class\'s "__init__()"\n method if it has one. Any arguments are passed on to the\n "__init__()" method. If there is no "__init__()" method, the\n class must be called without arguments.\n\n Class instances\n Class instances are described below. Class instances are\n callable only when the class has a "__call__()" method;\n "x(arguments)" is a shorthand for "x.__call__(arguments)".\n\nModules\n Modules are imported by the "import" statement (see section The\n import statement). A module object has a namespace implemented by a\n dictionary object (this is the dictionary referenced by the\n func_globals attribute of functions defined in the module).\n Attribute references are translated to lookups in this dictionary,\n e.g., "m.x" is equivalent to "m.__dict__["x"]". A module object\n does not contain the code object used to initialize the module\n (since it isn\'t needed once the initialization is done).\n\n Attribute assignment updates the module\'s namespace dictionary,\n e.g., "m.x = 1" is equivalent to "m.__dict__["x"] = 1".\n\n Special read-only attribute: "__dict__" is the module\'s namespace\n as a dictionary object.\n\n **CPython implementation detail:** Because of the way CPython\n clears module dictionaries, the module dictionary will be cleared\n when the module falls out of scope even if the dictionary still has\n live references. To avoid this, copy the dictionary or keep the\n module around while using its dictionary directly.\n\n Predefined (writable) attributes: "__name__" is the module\'s name;\n "__doc__" is the module\'s documentation string, or "None" if\n unavailable; "__file__" is the pathname of the file from which the\n module was loaded, if it was loaded from a file. The "__file__"\n attribute is not present for C modules that are statically linked\n into the interpreter; for extension modules loaded dynamically from\n a shared library, it is the pathname of the shared library file.\n\nClasses\n Both class types (new-style classes) and class objects (old-\n style/classic classes) are typically created by class definitions\n (see section Class definitions). A class has a namespace\n implemented by a dictionary object. Class attribute references are\n translated to lookups in this dictionary, e.g., "C.x" is translated\n to "C.__dict__["x"]" (although for new-style classes in particular\n there are a number of hooks which allow for other means of locating\n attributes). When the attribute name is not found there, the\n attribute search continues in the base classes. For old-style\n classes, the search is depth-first, left-to-right in the order of\n occurrence in the base class list. New-style classes use the more\n complex C3 method resolution order which behaves correctly even in\n the presence of \'diamond\' inheritance structures where there are\n multiple inheritance paths leading back to a common ancestor.\n Additional details on the C3 MRO used by new-style classes can be\n found in the documentation accompanying the 2.3 release at\n https://www.python.org/download/releases/2.3/mro/.\n\n When a class attribute reference (for class "C", say) would yield a\n user-defined function object or an unbound user-defined method\n object whose associated class is either "C" or one of its base\n classes, it is transformed into an unbound user-defined method\n object whose "im_class" attribute is "C". When it would yield a\n class method object, it is transformed into a bound user-defined\n method object whose "im_self" attribute is "C". When it would\n yield a static method object, it is transformed into the object\n wrapped by the static method object. See section Implementing\n Descriptors for another way in which attributes retrieved from a\n class may differ from those actually contained in its "__dict__"\n (note that only new-style classes support descriptors).\n\n Class attribute assignments update the class\'s dictionary, never\n the dictionary of a base class.\n\n A class object can be called (see above) to yield a class instance\n (see below).\n\n Special attributes: "__name__" is the class name; "__module__" is\n the module name in which the class was defined; "__dict__" is the\n dictionary containing the class\'s namespace; "__bases__" is a tuple\n (possibly empty or a singleton) containing the base classes, in the\n order of their occurrence in the base class list; "__doc__" is the\n class\'s documentation string, or None if undefined.\n\nClass instances\n A class instance is created by calling a class object (see above).\n A class instance has a namespace implemented as a dictionary which\n is the first place in which attribute references are searched.\n When an attribute is not found there, and the instance\'s class has\n an attribute by that name, the search continues with the class\n attributes. If a class attribute is found that is a user-defined\n function object or an unbound user-defined method object whose\n associated class is the class (call it "C") of the instance for\n which the attribute reference was initiated or one of its bases, it\n is transformed into a bound user-defined method object whose\n "im_class" attribute is "C" and whose "im_self" attribute is the\n instance. Static method and class method objects are also\n transformed, as if they had been retrieved from class "C"; see\n above under "Classes". See section Implementing Descriptors for\n another way in which attributes of a class retrieved via its\n instances may differ from the objects actually stored in the\n class\'s "__dict__". If no class attribute is found, and the\n object\'s class has a "__getattr__()" method, that is called to\n satisfy the lookup.\n\n Attribute assignments and deletions update the instance\'s\n dictionary, never a class\'s dictionary. If the class has a\n "__setattr__()" or "__delattr__()" method, this is called instead\n of updating the instance dictionary directly.\n\n Class instances can pretend to be numbers, sequences, or mappings\n if they have methods with certain special names. See section\n Special method names.\n\n Special attributes: "__dict__" is the attribute dictionary;\n "__class__" is the instance\'s class.\n\nFiles\n A file object represents an open file. File objects are created by\n the "open()" built-in function, and also by "os.popen()",\n "os.fdopen()", and the "makefile()" method of socket objects (and\n perhaps by other functions or methods provided by extension\n modules). The objects "sys.stdin", "sys.stdout" and "sys.stderr"\n are initialized to file objects corresponding to the interpreter\'s\n standard input, output and error streams. See File Objects for\n complete documentation of file objects.\n\nInternal types\n A few types used internally by the interpreter are exposed to the\n user. Their definitions may change with future versions of the\n interpreter, but they are mentioned here for completeness.\n\n Code objects\n Code objects represent *byte-compiled* executable Python code,\n or *bytecode*. The difference between a code object and a\n function object is that the function object contains an explicit\n reference to the function\'s globals (the module in which it was\n defined), while a code object contains no context; also the\n default argument values are stored in the function object, not\n in the code object (because they represent values calculated at\n run-time). Unlike function objects, code objects are immutable\n and contain no references (directly or indirectly) to mutable\n objects.\n\n Special read-only attributes: "co_name" gives the function name;\n "co_argcount" is the number of positional arguments (including\n arguments with default values); "co_nlocals" is the number of\n local variables used by the function (including arguments);\n "co_varnames" is a tuple containing the names of the local\n variables (starting with the argument names); "co_cellvars" is a\n tuple containing the names of local variables that are\n referenced by nested functions; "co_freevars" is a tuple\n containing the names of free variables; "co_code" is a string\n representing the sequence of bytecode instructions; "co_consts"\n is a tuple containing the literals used by the bytecode;\n "co_names" is a tuple containing the names used by the bytecode;\n "co_filename" is the filename from which the code was compiled;\n "co_firstlineno" is the first line number of the function;\n "co_lnotab" is a string encoding the mapping from bytecode\n offsets to line numbers (for details see the source code of the\n interpreter); "co_stacksize" is the required stack size\n (including local variables); "co_flags" is an integer encoding a\n number of flags for the interpreter.\n\n The following flag bits are defined for "co_flags": bit "0x04"\n is set if the function uses the "*arguments" syntax to accept an\n arbitrary number of positional arguments; bit "0x08" is set if\n the function uses the "**keywords" syntax to accept arbitrary\n keyword arguments; bit "0x20" is set if the function is a\n generator.\n\n Future feature declarations ("from __future__ import division")\n also use bits in "co_flags" to indicate whether a code object\n was compiled with a particular feature enabled: bit "0x2000" is\n set if the function was compiled with future division enabled;\n bits "0x10" and "0x1000" were used in earlier versions of\n Python.\n\n Other bits in "co_flags" are reserved for internal use.\n\n If a code object represents a function, the first item in\n "co_consts" is the documentation string of the function, or\n "None" if undefined.\n\n Frame objects\n Frame objects represent execution frames. They may occur in\n traceback objects (see below).\n\n Special read-only attributes: "f_back" is to the previous stack\n frame (towards the caller), or "None" if this is the bottom\n stack frame; "f_code" is the code object being executed in this\n frame; "f_locals" is the dictionary used to look up local\n variables; "f_globals" is used for global variables;\n "f_builtins" is used for built-in (intrinsic) names;\n "f_restricted" is a flag indicating whether the function is\n executing in restricted execution mode; "f_lasti" gives the\n precise instruction (this is an index into the bytecode string\n of the code object).\n\n Special writable attributes: "f_trace", if not "None", is a\n function called at the start of each source code line (this is\n used by the debugger); "f_exc_type", "f_exc_value",\n "f_exc_traceback" represent the last exception raised in the\n parent frame provided another exception was ever raised in the\n current frame (in all other cases they are None); "f_lineno" is\n the current line number of the frame --- writing to this from\n within a trace function jumps to the given line (only for the\n bottom-most frame). A debugger can implement a Jump command\n (aka Set Next Statement) by writing to f_lineno.\n\n Traceback objects\n Traceback objects represent a stack trace of an exception. A\n traceback object is created when an exception occurs. When the\n search for an exception handler unwinds the execution stack, at\n each unwound level a traceback object is inserted in front of\n the current traceback. When an exception handler is entered,\n the stack trace is made available to the program. (See section\n The try statement.) It is accessible as "sys.exc_traceback", and\n also as the third item of the tuple returned by\n "sys.exc_info()". The latter is the preferred interface, since\n it works correctly when the program is using multiple threads.\n When the program contains no suitable handler, the stack trace\n is written (nicely formatted) to the standard error stream; if\n the interpreter is interactive, it is also made available to the\n user as "sys.last_traceback".\n\n Special read-only attributes: "tb_next" is the next level in the\n stack trace (towards the frame where the exception occurred), or\n "None" if there is no next level; "tb_frame" points to the\n execution frame of the current level; "tb_lineno" gives the line\n number where the exception occurred; "tb_lasti" indicates the\n precise instruction. The line number and last instruction in\n the traceback may differ from the line number of its frame\n object if the exception occurred in a "try" statement with no\n matching except clause or with a finally clause.\n\n Slice objects\n Slice objects are used to represent slices when *extended slice\n syntax* is used. This is a slice using two colons, or multiple\n slices or ellipses separated by commas, e.g., "a[i:j:step]",\n "a[i:j, k:l]", or "a[..., i:j]". They are also created by the\n built-in "slice()" function.\n\n Special read-only attributes: "start" is the lower bound; "stop"\n is the upper bound; "step" is the step value; each is "None" if\n omitted. These attributes can have any type.\n\n Slice objects support one method:\n\n slice.indices(self, length)\n\n This method takes a single integer argument *length* and\n computes information about the extended slice that the slice\n object would describe if applied to a sequence of *length*\n items. It returns a tuple of three integers; respectively\n these are the *start* and *stop* indices and the *step* or\n stride length of the slice. Missing or out-of-bounds indices\n are handled in a manner consistent with regular slices.\n\n New in version 2.3.\n\n Static method objects\n Static method objects provide a way of defeating the\n transformation of function objects to method objects described\n above. A static method object is a wrapper around any other\n object, usually a user-defined method object. When a static\n method object is retrieved from a class or a class instance, the\n object actually returned is the wrapped object, which is not\n subject to any further transformation. Static method objects are\n not themselves callable, although the objects they wrap usually\n are. Static method objects are created by the built-in\n "staticmethod()" constructor.\n\n Class method objects\n A class method object, like a static method object, is a wrapper\n around another object that alters the way in which that object\n is retrieved from classes and class instances. The behaviour of\n class method objects upon such retrieval is described above,\n under "User-defined methods". Class method objects are created\n by the built-in "classmethod()" constructor.\n', - 'typesfunctions': u'\nFunctions\n*********\n\nFunction objects are created by function definitions. The only\noperation on a function object is to call it: "func(argument-list)".\n\nThere are really two flavors of function objects: built-in functions\nand user-defined functions. Both support the same operation (to call\nthe function), but the implementation is different, hence the\ndifferent object types.\n\nSee Function definitions for more information.\n', - 'typesmapping': u'\nMapping Types --- "dict"\n************************\n\nA *mapping* object maps *hashable* values to arbitrary objects.\nMappings are mutable objects. There is currently only one standard\nmapping type, the *dictionary*. (For other containers see the built\nin "list", "set", and "tuple" classes, and the "collections" module.)\n\nA dictionary\'s keys are *almost* arbitrary values. Values that are\nnot *hashable*, that is, values containing lists, dictionaries or\nother mutable types (that are compared by value rather than by object\nidentity) may not be used as keys. Numeric types used for keys obey\nthe normal rules for numeric comparison: if two numbers compare equal\n(such as "1" and "1.0") then they can be used interchangeably to index\nthe same dictionary entry. (Note however, that since computers store\nfloating-point numbers as approximations it is usually unwise to use\nthem as dictionary keys.)\n\nDictionaries can be created by placing a comma-separated list of "key:\nvalue" pairs within braces, for example: "{\'jack\': 4098, \'sjoerd\':\n4127}" or "{4098: \'jack\', 4127: \'sjoerd\'}", or by the "dict"\nconstructor.\n\nclass class dict(**kwarg)\nclass class dict(mapping, **kwarg)\nclass class dict(iterable, **kwarg)\n\n Return a new dictionary initialized from an optional positional\n argument and a possibly empty set of keyword arguments.\n\n If no positional argument is given, an empty dictionary is created.\n If a positional argument is given and it is a mapping object, a\n dictionary is created with the same key-value pairs as the mapping\n object. Otherwise, the positional argument must be an *iterable*\n object. Each item in the iterable must itself be an iterable with\n exactly two objects. The first object of each item becomes a key\n in the new dictionary, and the second object the corresponding\n value. If a key occurs more than once, the last value for that key\n becomes the corresponding value in the new dictionary.\n\n If keyword arguments are given, the keyword arguments and their\n values are added to the dictionary created from the positional\n argument. If a key being added is already present, the value from\n the keyword argument replaces the value from the positional\n argument.\n\n To illustrate, the following examples all return a dictionary equal\n to "{"one": 1, "two": 2, "three": 3}":\n\n >>> a = dict(one=1, two=2, three=3)\n >>> b = {\'one\': 1, \'two\': 2, \'three\': 3}\n >>> c = dict(zip([\'one\', \'two\', \'three\'], [1, 2, 3]))\n >>> d = dict([(\'two\', 2), (\'one\', 1), (\'three\', 3)])\n >>> e = dict({\'three\': 3, \'one\': 1, \'two\': 2})\n >>> a == b == c == d == e\n True\n\n Providing keyword arguments as in the first example only works for\n keys that are valid Python identifiers. Otherwise, any valid keys\n can be used.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for building a dictionary from\n keyword arguments added.\n\n These are the operations that dictionaries support (and therefore,\n custom mapping types should support too):\n\n len(d)\n\n Return the number of items in the dictionary *d*.\n\n d[key]\n\n Return the item of *d* with key *key*. Raises a "KeyError" if\n *key* is not in the map.\n\n If a subclass of dict defines a method "__missing__()" and *key*\n is not present, the "d[key]" operation calls that method with\n the key *key* as argument. The "d[key]" operation then returns\n or raises whatever is returned or raised by the\n "__missing__(key)" call. No other operations or methods invoke\n "__missing__()". If "__missing__()" is not defined, "KeyError"\n is raised. "__missing__()" must be a method; it cannot be an\n instance variable:\n\n >>> class Counter(dict):\n ... def __missing__(self, key):\n ... return 0\n >>> c = Counter()\n >>> c[\'red\']\n 0\n >>> c[\'red\'] += 1\n >>> c[\'red\']\n 1\n\n The example above shows part of the implementation of\n "collections.Counter". A different "__missing__" method is used\n by "collections.defaultdict".\n\n New in version 2.5: Recognition of __missing__ methods of dict\n subclasses.\n\n d[key] = value\n\n Set "d[key]" to *value*.\n\n del d[key]\n\n Remove "d[key]" from *d*. Raises a "KeyError" if *key* is not\n in the map.\n\n key in d\n\n Return "True" if *d* has a key *key*, else "False".\n\n New in version 2.2.\n\n key not in d\n\n Equivalent to "not key in d".\n\n New in version 2.2.\n\n iter(d)\n\n Return an iterator over the keys of the dictionary. This is a\n shortcut for "iterkeys()".\n\n clear()\n\n Remove all items from the dictionary.\n\n copy()\n\n Return a shallow copy of the dictionary.\n\n fromkeys(seq[, value])\n\n Create a new dictionary with keys from *seq* and values set to\n *value*.\n\n "fromkeys()" is a class method that returns a new dictionary.\n *value* defaults to "None".\n\n New in version 2.3.\n\n get(key[, default])\n\n Return the value for *key* if *key* is in the dictionary, else\n *default*. If *default* is not given, it defaults to "None", so\n that this method never raises a "KeyError".\n\n has_key(key)\n\n Test for the presence of *key* in the dictionary. "has_key()"\n is deprecated in favor of "key in d".\n\n items()\n\n Return a copy of the dictionary\'s list of "(key, value)" pairs.\n\n **CPython implementation detail:** Keys and values are listed in\n an arbitrary order which is non-random, varies across Python\n implementations, and depends on the dictionary\'s history of\n insertions and deletions.\n\n If "items()", "keys()", "values()", "iteritems()", "iterkeys()",\n and "itervalues()" are called with no intervening modifications\n to the dictionary, the lists will directly correspond. This\n allows the creation of "(value, key)" pairs using "zip()":\n "pairs = zip(d.values(), d.keys())". The same relationship\n holds for the "iterkeys()" and "itervalues()" methods: "pairs =\n zip(d.itervalues(), d.iterkeys())" provides the same value for\n "pairs". Another way to create the same list is "pairs = [(v, k)\n for (k, v) in d.iteritems()]".\n\n iteritems()\n\n Return an iterator over the dictionary\'s "(key, value)" pairs.\n See the note for "dict.items()".\n\n Using "iteritems()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n iterkeys()\n\n Return an iterator over the dictionary\'s keys. See the note for\n "dict.items()".\n\n Using "iterkeys()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n itervalues()\n\n Return an iterator over the dictionary\'s values. See the note\n for "dict.items()".\n\n Using "itervalues()" while adding or deleting entries in the\n dictionary may raise a "RuntimeError" or fail to iterate over\n all entries.\n\n New in version 2.2.\n\n keys()\n\n Return a copy of the dictionary\'s list of keys. See the note\n for "dict.items()".\n\n pop(key[, default])\n\n If *key* is in the dictionary, remove it and return its value,\n else return *default*. If *default* is not given and *key* is\n not in the dictionary, a "KeyError" is raised.\n\n New in version 2.3.\n\n popitem()\n\n Remove and return an arbitrary "(key, value)" pair from the\n dictionary.\n\n "popitem()" is useful to destructively iterate over a\n dictionary, as often used in set algorithms. If the dictionary\n is empty, calling "popitem()" raises a "KeyError".\n\n setdefault(key[, default])\n\n If *key* is in the dictionary, return its value. If not, insert\n *key* with a value of *default* and return *default*. *default*\n defaults to "None".\n\n update([other])\n\n Update the dictionary with the key/value pairs from *other*,\n overwriting existing keys. Return "None".\n\n "update()" accepts either another dictionary object or an\n iterable of key/value pairs (as tuples or other iterables of\n length two). If keyword arguments are specified, the dictionary\n is then updated with those key/value pairs: "d.update(red=1,\n blue=2)".\n\n Changed in version 2.4: Allowed the argument to be an iterable\n of key/value pairs and allowed keyword arguments.\n\n values()\n\n Return a copy of the dictionary\'s list of values. See the note\n for "dict.items()".\n\n viewitems()\n\n Return a new view of the dictionary\'s items ("(key, value)"\n pairs). See below for documentation of view objects.\n\n New in version 2.7.\n\n viewkeys()\n\n Return a new view of the dictionary\'s keys. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n viewvalues()\n\n Return a new view of the dictionary\'s values. See below for\n documentation of view objects.\n\n New in version 2.7.\n\n\nDictionary view objects\n=======================\n\nThe objects returned by "dict.viewkeys()", "dict.viewvalues()" and\n"dict.viewitems()" are *view objects*. They provide a dynamic view on\nthe dictionary\'s entries, which means that when the dictionary\nchanges, the view reflects these changes.\n\nDictionary views can be iterated over to yield their respective data,\nand support membership tests:\n\nlen(dictview)\n\n Return the number of entries in the dictionary.\n\niter(dictview)\n\n Return an iterator over the keys, values or items (represented as\n tuples of "(key, value)") in the dictionary.\n\n Keys and values are iterated over in an arbitrary order which is\n non-random, varies across Python implementations, and depends on\n the dictionary\'s history of insertions and deletions. If keys,\n values and items views are iterated over with no intervening\n modifications to the dictionary, the order of items will directly\n correspond. This allows the creation of "(value, key)" pairs using\n "zip()": "pairs = zip(d.values(), d.keys())". Another way to\n create the same list is "pairs = [(v, k) for (k, v) in d.items()]".\n\n Iterating views while adding or deleting entries in the dictionary\n may raise a "RuntimeError" or fail to iterate over all entries.\n\nx in dictview\n\n Return "True" if *x* is in the underlying dictionary\'s keys, values\n or items (in the latter case, *x* should be a "(key, value)"\n tuple).\n\nKeys views are set-like since their entries are unique and hashable.\nIf all values are hashable, so that (key, value) pairs are unique and\nhashable, then the items view is also set-like. (Values views are not\ntreated as set-like since the entries are generally not unique.) Then\nthese set operations are available ("other" refers either to another\nview or a set):\n\ndictview & other\n\n Return the intersection of the dictview and the other object as a\n new set.\n\ndictview | other\n\n Return the union of the dictview and the other object as a new set.\n\ndictview - other\n\n Return the difference between the dictview and the other object\n (all elements in *dictview* that aren\'t in *other*) as a new set.\n\ndictview ^ other\n\n Return the symmetric difference (all elements either in *dictview*\n or *other*, but not in both) of the dictview and the other object\n as a new set.\n\nAn example of dictionary view usage:\n\n >>> dishes = {\'eggs\': 2, \'sausage\': 1, \'bacon\': 1, \'spam\': 500}\n >>> keys = dishes.viewkeys()\n >>> values = dishes.viewvalues()\n\n >>> # iteration\n >>> n = 0\n >>> for val in values:\n ... n += val\n >>> print(n)\n 504\n\n >>> # keys and values are iterated over in the same order\n >>> list(keys)\n [\'eggs\', \'bacon\', \'sausage\', \'spam\']\n >>> list(values)\n [2, 1, 1, 500]\n\n >>> # view objects are dynamic and reflect dict changes\n >>> del dishes[\'eggs\']\n >>> del dishes[\'sausage\']\n >>> list(keys)\n [\'spam\', \'bacon\']\n\n >>> # set operations\n >>> keys & {\'eggs\', \'bacon\', \'salad\'}\n {\'bacon\'}\n', - 'typesmethods': u'\nMethods\n*******\n\nMethods are functions that are called using the attribute notation.\nThere are two flavors: built-in methods (such as "append()" on lists)\nand class instance methods. Built-in methods are described with the\ntypes that support them.\n\nThe implementation adds two special read-only attributes to class\ninstance methods: "m.im_self" is the object on which the method\noperates, and "m.im_func" is the function implementing the method.\nCalling "m(arg-1, arg-2, ..., arg-n)" is completely equivalent to\ncalling "m.im_func(m.im_self, arg-1, arg-2, ..., arg-n)".\n\nClass instance methods are either *bound* or *unbound*, referring to\nwhether the method was accessed through an instance or a class,\nrespectively. When a method is unbound, its "im_self" attribute will\nbe "None" and if called, an explicit "self" object must be passed as\nthe first argument. In this case, "self" must be an instance of the\nunbound method\'s class (or a subclass of that class), otherwise a\n"TypeError" is raised.\n\nLike function objects, methods objects support getting arbitrary\nattributes. However, since method attributes are actually stored on\nthe underlying function object ("meth.im_func"), setting method\nattributes on either bound or unbound methods is disallowed.\nAttempting to set an attribute on a method results in an\n"AttributeError" being raised. In order to set a method attribute,\nyou need to explicitly set it on the underlying function object:\n\n >>> class C:\n ... def method(self):\n ... pass\n ...\n >>> c = C()\n >>> c.method.whoami = \'my name is method\' # can\'t set on the method\n Traceback (most recent call last):\n File "", line 1, in \n AttributeError: \'instancemethod\' object has no attribute \'whoami\'\n >>> c.method.im_func.whoami = \'my name is method\'\n >>> c.method.whoami\n \'my name is method\'\n\nSee The standard type hierarchy for more information.\n', - 'typesmodules': u'\nModules\n*******\n\nThe only special operation on a module is attribute access: "m.name",\nwhere *m* is a module and *name* accesses a name defined in *m*\'s\nsymbol table. Module attributes can be assigned to. (Note that the\n"import" statement is not, strictly speaking, an operation on a module\nobject; "import foo" does not require a module object named *foo* to\nexist, rather it requires an (external) *definition* for a module\nnamed *foo* somewhere.)\n\nA special attribute of every module is "__dict__". This is the\ndictionary containing the module\'s symbol table. Modifying this\ndictionary will actually change the module\'s symbol table, but direct\nassignment to the "__dict__" attribute is not possible (you can write\n"m.__dict__[\'a\'] = 1", which defines "m.a" to be "1", but you can\'t\nwrite "m.__dict__ = {}"). Modifying "__dict__" directly is not\nrecommended.\n\nModules built into the interpreter are written like this: "". If loaded from a file, they are written as\n"".\n', - 'typesseq': u'\nSequence Types --- "str", "unicode", "list", "tuple", "bytearray", "buffer", "xrange"\n*************************************************************************************\n\nThere are seven sequence types: strings, Unicode strings, lists,\ntuples, bytearrays, buffers, and xrange objects.\n\nFor other containers see the built in "dict" and "set" classes, and\nthe "collections" module.\n\nString literals are written in single or double quotes: "\'xyzzy\'",\n""frobozz"". See String literals for more about string literals.\nUnicode strings are much like strings, but are specified in the syntax\nusing a preceding "\'u\'" character: "u\'abc\'", "u"def"". In addition to\nthe functionality described here, there are also string-specific\nmethods described in the String Methods section. Lists are constructed\nwith square brackets, separating items with commas: "[a, b, c]".\nTuples are constructed by the comma operator (not within square\nbrackets), with or without enclosing parentheses, but an empty tuple\nmust have the enclosing parentheses, such as "a, b, c" or "()". A\nsingle item tuple must have a trailing comma, such as "(d,)".\n\nBytearray objects are created with the built-in function\n"bytearray()".\n\nBuffer objects are not directly supported by Python syntax, but can be\ncreated by calling the built-in function "buffer()". They don\'t\nsupport concatenation or repetition.\n\nObjects of type xrange are similar to buffers in that there is no\nspecific syntax to create them, but they are created using the\n"xrange()" function. They don\'t support slicing, concatenation or\nrepetition, and using "in", "not in", "min()" or "max()" on them is\ninefficient.\n\nMost sequence types support the following operations. The "in" and\n"not in" operations have the same priorities as the comparison\noperations. The "+" and "*" operations have the same priority as the\ncorresponding numeric operations. [3] Additional methods are provided\nfor Mutable Sequence Types.\n\nThis table lists the sequence operations sorted in ascending priority.\nIn the table, *s* and *t* are sequences of the same type; *n*, *i* and\n*j* are integers:\n\n+--------------------+----------------------------------+------------+\n| Operation | Result | Notes |\n+====================+==================================+============+\n| "x in s" | "True" if an item of *s* is | (1) |\n| | equal to *x*, else "False" | |\n+--------------------+----------------------------------+------------+\n| "x not in s" | "False" if an item of *s* is | (1) |\n| | equal to *x*, else "True" | |\n+--------------------+----------------------------------+------------+\n| "s + t" | the concatenation of *s* and *t* | (6) |\n+--------------------+----------------------------------+------------+\n| "s * n, n * s" | *n* shallow copies of *s* | (2) |\n| | concatenated | |\n+--------------------+----------------------------------+------------+\n| "s[i]" | *i*th item of *s*, origin 0 | (3) |\n+--------------------+----------------------------------+------------+\n| "s[i:j]" | slice of *s* from *i* to *j* | (3)(4) |\n+--------------------+----------------------------------+------------+\n| "s[i:j:k]" | slice of *s* from *i* to *j* | (3)(5) |\n| | with step *k* | |\n+--------------------+----------------------------------+------------+\n| "len(s)" | length of *s* | |\n+--------------------+----------------------------------+------------+\n| "min(s)" | smallest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "max(s)" | largest item of *s* | |\n+--------------------+----------------------------------+------------+\n| "s.index(x)" | index of the first occurrence of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n| "s.count(x)" | total number of occurrences of | |\n| | *x* in *s* | |\n+--------------------+----------------------------------+------------+\n\nSequence types also support comparisons. In particular, tuples and\nlists are compared lexicographically by comparing corresponding\nelements. This means that to compare equal, every element must compare\nequal and the two sequences must be of the same type and have the same\nlength. (For full details see Comparisons in the language reference.)\n\nNotes:\n\n1. When *s* is a string or Unicode string object the "in" and "not\n in" operations act like a substring test. In Python versions\n before 2.3, *x* had to be a string of length 1. In Python 2.3 and\n beyond, *x* may be a string of any length.\n\n2. Values of *n* less than "0" are treated as "0" (which yields an\n empty sequence of the same type as *s*). Note also that the copies\n are shallow; nested structures are not copied. This often haunts\n new Python programmers; consider:\n\n >>> lists = [[]] * 3\n >>> lists\n [[], [], []]\n >>> lists[0].append(3)\n >>> lists\n [[3], [3], [3]]\n\n What has happened is that "[[]]" is a one-element list containing\n an empty list, so all three elements of "[[]] * 3" are (pointers\n to) this single empty list. Modifying any of the elements of\n "lists" modifies this single list. You can create a list of\n different lists this way:\n\n >>> lists = [[] for i in range(3)]\n >>> lists[0].append(3)\n >>> lists[1].append(5)\n >>> lists[2].append(7)\n >>> lists\n [[3], [5], [7]]\n\n3. If *i* or *j* is negative, the index is relative to the end of\n the string: "len(s) + i" or "len(s) + j" is substituted. But note\n that "-0" is still "0".\n\n4. The slice of *s* from *i* to *j* is defined as the sequence of\n items with index *k* such that "i <= k < j". If *i* or *j* is\n greater than "len(s)", use "len(s)". If *i* is omitted or "None",\n use "0". If *j* is omitted or "None", use "len(s)". If *i* is\n greater than or equal to *j*, the slice is empty.\n\n5. The slice of *s* from *i* to *j* with step *k* is defined as the\n sequence of items with index "x = i + n*k" such that "0 <= n <\n (j-i)/k". In other words, the indices are "i", "i+k", "i+2*k",\n "i+3*k" and so on, stopping when *j* is reached (but never\n including *j*). If *i* or *j* is greater than "len(s)", use\n "len(s)". If *i* or *j* are omitted or "None", they become "end"\n values (which end depends on the sign of *k*). Note, *k* cannot be\n zero. If *k* is "None", it is treated like "1".\n\n6. **CPython implementation detail:** If *s* and *t* are both\n strings, some Python implementations such as CPython can usually\n perform an in-place optimization for assignments of the form "s = s\n + t" or "s += t". When applicable, this optimization makes\n quadratic run-time much less likely. This optimization is both\n version and implementation dependent. For performance sensitive\n code, it is preferable to use the "str.join()" method which assures\n consistent linear concatenation performance across versions and\n implementations.\n\n Changed in version 2.4: Formerly, string concatenation never\n occurred in-place.\n\n\nString Methods\n==============\n\nBelow are listed the string methods which both 8-bit strings and\nUnicode objects support. Some of them are also available on\n"bytearray" objects.\n\nIn addition, Python\'s strings support the sequence type methods\ndescribed in the Sequence Types --- str, unicode, list, tuple,\nbytearray, buffer, xrange section. To output formatted strings use\ntemplate strings or the "%" operator described in the String\nFormatting Operations section. Also, see the "re" module for string\nfunctions based on regular expressions.\n\nstr.capitalize()\n\n Return a copy of the string with its first character capitalized\n and the rest lowercased.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.center(width[, fillchar])\n\n Return centered in a string of length *width*. Padding is done\n using the specified *fillchar* (default is a space).\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.count(sub[, start[, end]])\n\n Return the number of non-overlapping occurrences of substring *sub*\n in the range [*start*, *end*]. Optional arguments *start* and\n *end* are interpreted as in slice notation.\n\nstr.decode([encoding[, errors]])\n\n Decodes the string using the codec registered for *encoding*.\n *encoding* defaults to the default string encoding. *errors* may\n be given to set a different error handling scheme. The default is\n "\'strict\'", meaning that encoding errors raise "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'" and any other\n name registered via "codecs.register_error()", see section Codec\n Base Classes.\n\n New in version 2.2.\n\n Changed in version 2.3: Support for other error handling schemes\n added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.encode([encoding[, errors]])\n\n Return an encoded version of the string. Default encoding is the\n current default string encoding. *errors* may be given to set a\n different error handling scheme. The default for *errors* is\n "\'strict\'", meaning that encoding errors raise a "UnicodeError".\n Other possible values are "\'ignore\'", "\'replace\'",\n "\'xmlcharrefreplace\'", "\'backslashreplace\'" and any other name\n registered via "codecs.register_error()", see section Codec Base\n Classes. For a list of possible encodings, see section Standard\n Encodings.\n\n New in version 2.0.\n\n Changed in version 2.3: Support for "\'xmlcharrefreplace\'" and\n "\'backslashreplace\'" and other error handling schemes added.\n\n Changed in version 2.7: Support for keyword arguments added.\n\nstr.endswith(suffix[, start[, end]])\n\n Return "True" if the string ends with the specified *suffix*,\n otherwise return "False". *suffix* can also be a tuple of suffixes\n to look for. With optional *start*, test beginning at that\n position. With optional *end*, stop comparing at that position.\n\n Changed in version 2.5: Accept tuples as *suffix*.\n\nstr.expandtabs([tabsize])\n\n Return a copy of the string where all tab characters are replaced\n by one or more spaces, depending on the current column and the\n given tab size. Tab positions occur every *tabsize* characters\n (default is 8, giving tab positions at columns 0, 8, 16 and so on).\n To expand the string, the current column is set to zero and the\n string is examined character by character. If the character is a\n tab ("\\t"), one or more space characters are inserted in the result\n until the current column is equal to the next tab position. (The\n tab character itself is not copied.) If the character is a newline\n ("\\n") or return ("\\r"), it is copied and the current column is\n reset to zero. Any other character is copied unchanged and the\n current column is incremented by one regardless of how the\n character is represented when printed.\n\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs()\n \'01 012 0123 01234\'\n >>> \'01\\t012\\t0123\\t01234\'.expandtabs(4)\n \'01 012 0123 01234\'\n\nstr.find(sub[, start[, end]])\n\n Return the lowest index in the string where substring *sub* is\n found, such that *sub* is contained in the slice "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" if *sub* is not found.\n\n Note: The "find()" method should be used only if you need to know\n the position of *sub*. To check if *sub* is a substring or not,\n use the "in" operator:\n\n >>> \'Py\' in \'Python\'\n True\n\nstr.format(*args, **kwargs)\n\n Perform a string formatting operation. The string on which this\n method is called can contain literal text or replacement fields\n delimited by braces "{}". Each replacement field contains either\n the numeric index of a positional argument, or the name of a\n keyword argument. Returns a copy of the string where each\n replacement field is replaced with the string value of the\n corresponding argument.\n\n >>> "The sum of 1 + 2 is {0}".format(1+2)\n \'The sum of 1 + 2 is 3\'\n\n See Format String Syntax for a description of the various\n formatting options that can be specified in format strings.\n\n This method of string formatting is the new standard in Python 3,\n and should be preferred to the "%" formatting described in String\n Formatting Operations in new code.\n\n New in version 2.6.\n\nstr.index(sub[, start[, end]])\n\n Like "find()", but raise "ValueError" when the substring is not\n found.\n\nstr.isalnum()\n\n Return true if all characters in the string are alphanumeric and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isalpha()\n\n Return true if all characters in the string are alphabetic and\n there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isdigit()\n\n Return true if all characters in the string are digits and there is\n at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.islower()\n\n Return true if all cased characters [4] in the string are lowercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isspace()\n\n Return true if there are only whitespace characters in the string\n and there is at least one character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.istitle()\n\n Return true if the string is a titlecased string and there is at\n least one character, for example uppercase characters may only\n follow uncased characters and lowercase characters only cased ones.\n Return false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.isupper()\n\n Return true if all cased characters [4] in the string are uppercase\n and there is at least one cased character, false otherwise.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.join(iterable)\n\n Return a string which is the concatenation of the strings in the\n *iterable* *iterable*. The separator between elements is the\n string providing this method.\n\nstr.ljust(width[, fillchar])\n\n Return the string left justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.lower()\n\n Return a copy of the string with all the cased characters [4]\n converted to lowercase.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.lstrip([chars])\n\n Return a copy of the string with leading characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a prefix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.lstrip()\n \'spacious \'\n >>> \'www.example.com\'.lstrip(\'cmowz.\')\n \'example.com\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.partition(sep)\n\n Split the string at the first occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing the string itself, followed by\n two empty strings.\n\n New in version 2.5.\n\nstr.replace(old, new[, count])\n\n Return a copy of the string with all occurrences of substring *old*\n replaced by *new*. If the optional argument *count* is given, only\n the first *count* occurrences are replaced.\n\nstr.rfind(sub[, start[, end]])\n\n Return the highest index in the string where substring *sub* is\n found, such that *sub* is contained within "s[start:end]".\n Optional arguments *start* and *end* are interpreted as in slice\n notation. Return "-1" on failure.\n\nstr.rindex(sub[, start[, end]])\n\n Like "rfind()" but raises "ValueError" when the substring *sub* is\n not found.\n\nstr.rjust(width[, fillchar])\n\n Return the string right justified in a string of length *width*.\n Padding is done using the specified *fillchar* (default is a\n space). The original string is returned if *width* is less than or\n equal to "len(s)".\n\n Changed in version 2.4: Support for the *fillchar* argument.\n\nstr.rpartition(sep)\n\n Split the string at the last occurrence of *sep*, and return a\n 3-tuple containing the part before the separator, the separator\n itself, and the part after the separator. If the separator is not\n found, return a 3-tuple containing two empty strings, followed by\n the string itself.\n\n New in version 2.5.\n\nstr.rsplit([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit* splits\n are done, the *rightmost* ones. If *sep* is not specified or\n "None", any whitespace string is a separator. Except for splitting\n from the right, "rsplit()" behaves like "split()" which is\n described in detail below.\n\n New in version 2.4.\n\nstr.rstrip([chars])\n\n Return a copy of the string with trailing characters removed. The\n *chars* argument is a string specifying the set of characters to be\n removed. If omitted or "None", the *chars* argument defaults to\n removing whitespace. The *chars* argument is not a suffix; rather,\n all combinations of its values are stripped:\n\n >>> \' spacious \'.rstrip()\n \' spacious\'\n >>> \'mississippi\'.rstrip(\'ipz\')\n \'mississ\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.split([sep[, maxsplit]])\n\n Return a list of the words in the string, using *sep* as the\n delimiter string. If *maxsplit* is given, at most *maxsplit*\n splits are done (thus, the list will have at most "maxsplit+1"\n elements). If *maxsplit* is not specified or "-1", then there is\n no limit on the number of splits (all possible splits are made).\n\n If *sep* is given, consecutive delimiters are not grouped together\n and are deemed to delimit empty strings (for example,\n "\'1,,2\'.split(\',\')" returns "[\'1\', \'\', \'2\']"). The *sep* argument\n may consist of multiple characters (for example,\n "\'1<>2<>3\'.split(\'<>\')" returns "[\'1\', \'2\', \'3\']"). Splitting an\n empty string with a specified separator returns "[\'\']".\n\n If *sep* is not specified or is "None", a different splitting\n algorithm is applied: runs of consecutive whitespace are regarded\n as a single separator, and the result will contain no empty strings\n at the start or end if the string has leading or trailing\n whitespace. Consequently, splitting an empty string or a string\n consisting of just whitespace with a "None" separator returns "[]".\n\n For example, "\' 1 2 3 \'.split()" returns "[\'1\', \'2\', \'3\']", and\n "\' 1 2 3 \'.split(None, 1)" returns "[\'1\', \'2 3 \']".\n\nstr.splitlines([keepends])\n\n Return a list of the lines in the string, breaking at line\n boundaries. This method uses the *universal newlines* approach to\n splitting lines. Line breaks are not included in the resulting list\n unless *keepends* is given and true.\n\n For example, "\'ab c\\n\\nde fg\\rkl\\r\\n\'.splitlines()" returns "[\'ab\n c\', \'\', \'de fg\', \'kl\']", while the same call with\n "splitlines(True)" returns "[\'ab c\\n\', \'\\n\', \'de fg\\r\', \'kl\\r\\n\']".\n\n Unlike "split()" when a delimiter string *sep* is given, this\n method returns an empty list for the empty string, and a terminal\n line break does not result in an extra line.\n\nstr.startswith(prefix[, start[, end]])\n\n Return "True" if string starts with the *prefix*, otherwise return\n "False". *prefix* can also be a tuple of prefixes to look for.\n With optional *start*, test string beginning at that position.\n With optional *end*, stop comparing string at that position.\n\n Changed in version 2.5: Accept tuples as *prefix*.\n\nstr.strip([chars])\n\n Return a copy of the string with the leading and trailing\n characters removed. The *chars* argument is a string specifying the\n set of characters to be removed. If omitted or "None", the *chars*\n argument defaults to removing whitespace. The *chars* argument is\n not a prefix or suffix; rather, all combinations of its values are\n stripped:\n\n >>> \' spacious \'.strip()\n \'spacious\'\n >>> \'www.example.com\'.strip(\'cmowz.\')\n \'example\'\n\n Changed in version 2.2.2: Support for the *chars* argument.\n\nstr.swapcase()\n\n Return a copy of the string with uppercase characters converted to\n lowercase and vice versa.\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.title()\n\n Return a titlecased version of the string where words start with an\n uppercase character and the remaining characters are lowercase.\n\n The algorithm uses a simple language-independent definition of a\n word as groups of consecutive letters. The definition works in\n many contexts but it means that apostrophes in contractions and\n possessives form word boundaries, which may not be the desired\n result:\n\n >>> "they\'re bill\'s friends from the UK".title()\n "They\'Re Bill\'S Friends From The Uk"\n\n A workaround for apostrophes can be constructed using regular\n expressions:\n\n >>> import re\n >>> def titlecase(s):\n ... return re.sub(r"[A-Za-z]+(\'[A-Za-z]+)?",\n ... lambda mo: mo.group(0)[0].upper() +\n ... mo.group(0)[1:].lower(),\n ... s)\n ...\n >>> titlecase("they\'re bill\'s friends.")\n "They\'re Bill\'s Friends."\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.translate(table[, deletechars])\n\n Return a copy of the string where all characters occurring in the\n optional argument *deletechars* are removed, and the remaining\n characters have been mapped through the given translation table,\n which must be a string of length 256.\n\n You can use the "maketrans()" helper function in the "string"\n module to create a translation table. For string objects, set the\n *table* argument to "None" for translations that only delete\n characters:\n\n >>> \'read this short text\'.translate(None, \'aeiou\')\n \'rd ths shrt txt\'\n\n New in version 2.6: Support for a "None" *table* argument.\n\n For Unicode objects, the "translate()" method does not accept the\n optional *deletechars* argument. Instead, it returns a copy of the\n *s* where all characters have been mapped through the given\n translation table which must be a mapping of Unicode ordinals to\n Unicode ordinals, Unicode strings or "None". Unmapped characters\n are left untouched. Characters mapped to "None" are deleted. Note,\n a more flexible approach is to create a custom character mapping\n codec using the "codecs" module (see "encodings.cp1251" for an\n example).\n\nstr.upper()\n\n Return a copy of the string with all the cased characters [4]\n converted to uppercase. Note that "str.upper().isupper()" might be\n "False" if "s" contains uncased characters or if the Unicode\n category of the resulting character(s) is not "Lu" (Letter,\n uppercase), but e.g. "Lt" (Letter, titlecase).\n\n For 8-bit strings, this method is locale-dependent.\n\nstr.zfill(width)\n\n Return the numeric string left filled with zeros in a string of\n length *width*. A sign prefix is handled correctly. The original\n string is returned if *width* is less than or equal to "len(s)".\n\n New in version 2.2.2.\n\nThe following methods are present only on unicode objects:\n\nunicode.isnumeric()\n\n Return "True" if there are only numeric characters in S, "False"\n otherwise. Numeric characters include digit characters, and all\n characters that have the Unicode numeric value property, e.g.\n U+2155, VULGAR FRACTION ONE FIFTH.\n\nunicode.isdecimal()\n\n Return "True" if there are only decimal characters in S, "False"\n otherwise. Decimal characters include digit characters, and all\n characters that can be used to form decimal-radix numbers, e.g.\n U+0660, ARABIC-INDIC DIGIT ZERO.\n\n\nString Formatting Operations\n============================\n\nString and Unicode objects have one unique built-in operation: the "%"\noperator (modulo). This is also known as the string *formatting* or\n*interpolation* operator. Given "format % values" (where *format* is\na string or Unicode object), "%" conversion specifications in *format*\nare replaced with zero or more elements of *values*. The effect is\nsimilar to the using "sprintf()" in the C language. If *format* is a\nUnicode object, or if any of the objects being converted using the\n"%s" conversion are Unicode objects, the result will also be a Unicode\nobject.\n\nIf *format* requires a single argument, *values* may be a single non-\ntuple object. [5] Otherwise, *values* must be a tuple with exactly\nthe number of items specified by the format string, or a single\nmapping object (for example, a dictionary).\n\nA conversion specifier contains two or more characters and has the\nfollowing components, which must occur in this order:\n\n1. The "\'%\'" character, which marks the start of the specifier.\n\n2. Mapping key (optional), consisting of a parenthesised sequence\n of characters (for example, "(somename)").\n\n3. Conversion flags (optional), which affect the result of some\n conversion types.\n\n4. Minimum field width (optional). If specified as an "\'*\'"\n (asterisk), the actual width is read from the next element of the\n tuple in *values*, and the object to convert comes after the\n minimum field width and optional precision.\n\n5. Precision (optional), given as a "\'.\'" (dot) followed by the\n precision. If specified as "\'*\'" (an asterisk), the actual width\n is read from the next element of the tuple in *values*, and the\n value to convert comes after the precision.\n\n6. Length modifier (optional).\n\n7. Conversion type.\n\nWhen the right argument is a dictionary (or other mapping type), then\nthe formats in the string *must* include a parenthesised mapping key\ninto that dictionary inserted immediately after the "\'%\'" character.\nThe mapping key selects the value to be formatted from the mapping.\nFor example:\n\n>>> print \'%(language)s has %(number)03d quote types.\' % \\\n... {"language": "Python", "number": 2}\nPython has 002 quote types.\n\nIn this case no "*" specifiers may occur in a format (since they\nrequire a sequential parameter list).\n\nThe conversion flag characters are:\n\n+-----------+-----------------------------------------------------------------------+\n| Flag | Meaning |\n+===========+=======================================================================+\n| "\'#\'" | The value conversion will use the "alternate form" (where defined |\n| | below). |\n+-----------+-----------------------------------------------------------------------+\n| "\'0\'" | The conversion will be zero padded for numeric values. |\n+-----------+-----------------------------------------------------------------------+\n| "\'-\'" | The converted value is left adjusted (overrides the "\'0\'" conversion |\n| | if both are given). |\n+-----------+-----------------------------------------------------------------------+\n| "\' \'" | (a space) A blank should be left before a positive number (or empty |\n| | string) produced by a signed conversion. |\n+-----------+-----------------------------------------------------------------------+\n| "\'+\'" | A sign character ("\'+\'" or "\'-\'") will precede the conversion |\n| | (overrides a "space" flag). |\n+-----------+-----------------------------------------------------------------------+\n\nA length modifier ("h", "l", or "L") may be present, but is ignored as\nit is not necessary for Python -- so e.g. "%ld" is identical to "%d".\n\nThe conversion types are:\n\n+--------------+-------------------------------------------------------+---------+\n| Conversion | Meaning | Notes |\n+==============+=======================================================+=========+\n| "\'d\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'i\'" | Signed integer decimal. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'o\'" | Signed octal value. | (1) |\n+--------------+-------------------------------------------------------+---------+\n| "\'u\'" | Obsolete type -- it is identical to "\'d\'". | (7) |\n+--------------+-------------------------------------------------------+---------+\n| "\'x\'" | Signed hexadecimal (lowercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'X\'" | Signed hexadecimal (uppercase). | (2) |\n+--------------+-------------------------------------------------------+---------+\n| "\'e\'" | Floating point exponential format (lowercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'E\'" | Floating point exponential format (uppercase). | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'f\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'F\'" | Floating point decimal format. | (3) |\n+--------------+-------------------------------------------------------+---------+\n| "\'g\'" | Floating point format. Uses lowercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'G\'" | Floating point format. Uses uppercase exponential | (4) |\n| | format if exponent is less than -4 or not less than | |\n| | precision, decimal format otherwise. | |\n+--------------+-------------------------------------------------------+---------+\n| "\'c\'" | Single character (accepts integer or single character | |\n| | string). | |\n+--------------+-------------------------------------------------------+---------+\n| "\'r\'" | String (converts any Python object using repr()). | (5) |\n+--------------+-------------------------------------------------------+---------+\n| "\'s\'" | String (converts any Python object using "str()"). | (6) |\n+--------------+-------------------------------------------------------+---------+\n| "\'%\'" | No argument is converted, results in a "\'%\'" | |\n| | character in the result. | |\n+--------------+-------------------------------------------------------+---------+\n\nNotes:\n\n1. The alternate form causes a leading zero ("\'0\'") to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n2. The alternate form causes a leading "\'0x\'" or "\'0X\'" (depending\n on whether the "\'x\'" or "\'X\'" format was used) to be inserted\n between left-hand padding and the formatting of the number if the\n leading character of the result is not already a zero.\n\n3. The alternate form causes the result to always contain a decimal\n point, even if no digits follow it.\n\n The precision determines the number of digits after the decimal\n point and defaults to 6.\n\n4. The alternate form causes the result to always contain a decimal\n point, and trailing zeroes are not removed as they would otherwise\n be.\n\n The precision determines the number of significant digits before\n and after the decimal point and defaults to 6.\n\n5. The "%r" conversion was added in Python 2.0.\n\n The precision determines the maximal number of characters used.\n\n6. If the object or format provided is a "unicode" string, the\n resulting string will also be "unicode".\n\n The precision determines the maximal number of characters used.\n\n7. See **PEP 237**.\n\nSince Python strings have an explicit length, "%s" conversions do not\nassume that "\'\\0\'" is the end of the string.\n\nChanged in version 2.7: "%f" conversions for numbers whose absolute\nvalue is over 1e50 are no longer replaced by "%g" conversions.\n\nAdditional string operations are defined in standard modules "string"\nand "re".\n\n\nXRange Type\n===========\n\nThe "xrange" type is an immutable sequence which is commonly used for\nlooping. The advantage of the "xrange" type is that an "xrange"\nobject will always take the same amount of memory, no matter the size\nof the range it represents. There are no consistent performance\nadvantages.\n\nXRange objects have very little behavior: they only support indexing,\niteration, and the "len()" function.\n\n\nMutable Sequence Types\n======================\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)" | same as "s[len(s):len(s)] = x" | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\n multiple parameters and implicitly joined them into a tuple; this\n no longer works in Python 2.0. Use of this misfeature has been\n deprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n negative index is passed as the second or third parameter to the\n "index()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, "index()" didn\'t have arguments\n for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n "insert()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: "cmp=lambda x,y:\n cmp(x.lower(), y.lower())". The default value is "None".\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: "key=str.lower". The\n default value is "None".\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n "functools.cmp_to_key()" to convert an old-style *cmp* function to\n a *key* function.\n\n Changed in version 2.3: Support for "None" as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n be stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n sorted, the effect of attempting to mutate, or even inspect, the\n list is undefined. The C implementation of Python 2.3 and newer\n makes the list appear empty for the duration, and raises\n "ValueError" if it can detect that the list has been mutated\n during a sort.\n', - 'typesseq-mutable': u'\nMutable Sequence Types\n**********************\n\nList and "bytearray" objects support additional operations that allow\nin-place modification of the object. Other mutable sequence types\n(when added to the language) should also support these operations.\nStrings and tuples are immutable sequence types: such objects cannot\nbe modified once created. The following operations are defined on\nmutable sequence types (where *x* is an arbitrary object):\n\n+--------------------------------+----------------------------------+-----------------------+\n| Operation | Result | Notes |\n+================================+==================================+=======================+\n| "s[i] = x" | item *i* of *s* is replaced by | |\n| | *x* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j] = t" | slice of *s* from *i* to *j* is | |\n| | replaced by the contents of the | |\n| | iterable *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j]" | same as "s[i:j] = []" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s[i:j:k] = t" | the elements of "s[i:j:k]" are | (1) |\n| | replaced by those of *t* | |\n+--------------------------------+----------------------------------+-----------------------+\n| "del s[i:j:k]" | removes the elements of | |\n| | "s[i:j:k]" from the list | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.append(x)" | same as "s[len(s):len(s)] = [x]" | (2) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.extend(x)" | same as "s[len(s):len(s)] = x" | (3) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.count(x)" | return number of *i*\'s for which | |\n| | "s[i] == x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.index(x[, i[, j]])" | return smallest *k* such that | (4) |\n| | "s[k] == x" and "i <= k < j" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.insert(i, x)" | same as "s[i:i] = [x]" | (5) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.pop([i])" | same as "x = s[i]; del s[i]; | (6) |\n| | return x" | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.remove(x)" | same as "del s[s.index(x)]" | (4) |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.reverse()" | reverses the items of *s* in | (7) |\n| | place | |\n+--------------------------------+----------------------------------+-----------------------+\n| "s.sort([cmp[, key[, | sort the items of *s* in place | (7)(8)(9)(10) |\n| reverse]]])" | | |\n+--------------------------------+----------------------------------+-----------------------+\n\nNotes:\n\n1. *t* must have the same length as the slice it is replacing.\n\n2. The C implementation of Python has historically accepted\n multiple parameters and implicitly joined them into a tuple; this\n no longer works in Python 2.0. Use of this misfeature has been\n deprecated since Python 1.4.\n\n3. *x* can be any iterable object.\n\n4. Raises "ValueError" when *x* is not found in *s*. When a\n negative index is passed as the second or third parameter to the\n "index()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, "index()" didn\'t have arguments\n for specifying start and stop positions.\n\n5. When a negative index is passed as the first parameter to the\n "insert()" method, the list length is added, as for slice indices.\n If it is still negative, it is truncated to zero, as for slice\n indices.\n\n Changed in version 2.3: Previously, all negative indices were\n truncated to zero.\n\n6. The "pop()" method\'s optional argument *i* defaults to "-1", so\n that by default the last item is removed and returned.\n\n7. The "sort()" and "reverse()" methods modify the list in place\n for economy of space when sorting or reversing a large list. To\n remind you that they operate by side effect, they don\'t return the\n sorted or reversed list.\n\n8. The "sort()" method takes optional arguments for controlling the\n comparisons.\n\n *cmp* specifies a custom comparison function of two arguments (list\n items) which should return a negative, zero or positive number\n depending on whether the first argument is considered smaller than,\n equal to, or larger than the second argument: "cmp=lambda x,y:\n cmp(x.lower(), y.lower())". The default value is "None".\n\n *key* specifies a function of one argument that is used to extract\n a comparison key from each list element: "key=str.lower". The\n default value is "None".\n\n *reverse* is a boolean value. If set to "True", then the list\n elements are sorted as if each comparison were reversed.\n\n In general, the *key* and *reverse* conversion processes are much\n faster than specifying an equivalent *cmp* function. This is\n because *cmp* is called multiple times for each list element while\n *key* and *reverse* touch each element only once. Use\n "functools.cmp_to_key()" to convert an old-style *cmp* function to\n a *key* function.\n\n Changed in version 2.3: Support for "None" as an equivalent to\n omitting *cmp* was added.\n\n Changed in version 2.4: Support for *key* and *reverse* was added.\n\n9. Starting with Python 2.3, the "sort()" method is guaranteed to\n be stable. A sort is stable if it guarantees not to change the\n relative order of elements that compare equal --- this is helpful\n for sorting in multiple passes (for example, sort by department,\n then by salary grade).\n\n10. **CPython implementation detail:** While a list is being\n sorted, the effect of attempting to mutate, or even inspect, the\n list is undefined. The C implementation of Python 2.3 and newer\n makes the list appear empty for the duration, and raises\n "ValueError" if it can detect that the list has been mutated\n during a sort.\n', - 'unary': u'\nUnary arithmetic and bitwise operations\n***************************************\n\nAll unary arithmetic and bitwise operations have the same priority:\n\n u_expr ::= power | "-" u_expr | "+" u_expr | "~" u_expr\n\nThe unary "-" (minus) operator yields the negation of its numeric\nargument.\n\nThe unary "+" (plus) operator yields its numeric argument unchanged.\n\nThe unary "~" (invert) operator yields the bitwise inversion of its\nplain or long integer argument. The bitwise inversion of "x" is\ndefined as "-(x+1)". It only applies to integral numbers.\n\nIn all three cases, if the argument does not have the proper type, a\n"TypeError" exception is raised.\n', - 'while': u'\nThe "while" statement\n*********************\n\nThe "while" statement is used for repeated execution as long as an\nexpression is true:\n\n while_stmt ::= "while" expression ":" suite\n ["else" ":" suite]\n\nThis repeatedly tests the expression and, if it is true, executes the\nfirst suite; if the expression is false (which may be the first time\nit is tested) the suite of the "else" clause, if present, is executed\nand the loop terminates.\n\nA "break" statement executed in the first suite terminates the loop\nwithout executing the "else" clause\'s suite. A "continue" statement\nexecuted in the first suite skips the rest of the suite and goes back\nto testing the expression.\n', - 'with': u'\nThe "with" statement\n********************\n\nNew in version 2.5.\n\nThe "with" statement is used to wrap the execution of a block with\nmethods defined by a context manager (see section With Statement\nContext Managers). This allows common "try"..."except"..."finally"\nusage patterns to be encapsulated for convenient reuse.\n\n with_stmt ::= "with" with_item ("," with_item)* ":" suite\n with_item ::= expression ["as" target]\n\nThe execution of the "with" statement with one "item" proceeds as\nfollows:\n\n1. The context expression (the expression given in the "with_item")\n is evaluated to obtain a context manager.\n\n2. The context manager\'s "__exit__()" is loaded for later use.\n\n3. The context manager\'s "__enter__()" method is invoked.\n\n4. If a target was included in the "with" statement, the return\n value from "__enter__()" is assigned to it.\n\n Note: The "with" statement guarantees that if the "__enter__()"\n method returns without an error, then "__exit__()" will always be\n called. Thus, if an error occurs during the assignment to the\n target list, it will be treated the same as an error occurring\n within the suite would be. See step 6 below.\n\n5. The suite is executed.\n\n6. The context manager\'s "__exit__()" method is invoked. If an\n exception caused the suite to be exited, its type, value, and\n traceback are passed as arguments to "__exit__()". Otherwise, three\n "None" arguments are supplied.\n\n If the suite was exited due to an exception, and the return value\n from the "__exit__()" method was false, the exception is reraised.\n If the return value was true, the exception is suppressed, and\n execution continues with the statement following the "with"\n statement.\n\n If the suite was exited for any reason other than an exception, the\n return value from "__exit__()" is ignored, and execution proceeds\n at the normal location for the kind of exit that was taken.\n\nWith more than one item, the context managers are processed as if\nmultiple "with" statements were nested:\n\n with A() as a, B() as b:\n suite\n\nis equivalent to\n\n with A() as a:\n with B() as b:\n suite\n\nNote: In Python 2.5, the "with" statement is only allowed when the\n "with_statement" feature has been enabled. It is always enabled in\n Python 2.6.\n\nChanged in version 2.7: Support for multiple context expressions.\n\nSee also: **PEP 0343** - The "with" statement\n\n The specification, background, and examples for the Python "with"\n statement.\n', - 'yield': u'\nThe "yield" statement\n*********************\n\n yield_stmt ::= yield_expression\n\nThe "yield" statement is only used when defining a generator function,\nand is only used in the body of the generator function. Using a\n"yield" statement in a function definition is sufficient to cause that\ndefinition to create a generator function instead of a normal\nfunction.\n\nWhen a generator function is called, it returns an iterator known as a\ngenerator iterator, or more commonly, a generator. The body of the\ngenerator function is executed by calling the generator\'s "next()"\nmethod repeatedly until it raises an exception.\n\nWhen a "yield" statement is executed, the state of the generator is\nfrozen and the value of "expression_list" is returned to "next()"\'s\ncaller. By "frozen" we mean that all local state is retained,\nincluding the current bindings of local variables, the instruction\npointer, and the internal evaluation stack: enough information is\nsaved so that the next time "next()" is invoked, the function can\nproceed exactly as if the "yield" statement were just another external\ncall.\n\nAs of Python version 2.5, the "yield" statement is now allowed in the\n"try" clause of a "try" ... "finally" construct. If the generator is\nnot resumed before it is finalized (by reaching a zero reference count\nor by being garbage collected), the generator-iterator\'s "close()"\nmethod will be called, allowing any pending "finally" clauses to\nexecute.\n\nFor full details of "yield" semantics, refer to the Yield expressions\nsection.\n\nNote: In Python 2.2, the "yield" statement was only allowed when the\n "generators" feature has been enabled. This "__future__" import\n statement was used to enable the feature:\n\n from __future__ import generators\n\nSee also: **PEP 0255** - Simple Generators\n\n The proposal for adding generators and the "yield" statement to\n Python.\n\n **PEP 0342** - Coroutines via Enhanced Generators\n The proposal that, among other generator enhancements, proposed\n allowing "yield" to appear inside a "try" ... "finally" block.\n'} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/random.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/random.py deleted file mode 100644 index f234c85..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/random.py +++ /dev/null @@ -1,910 +0,0 @@ -"""Random variable generators. - - integers - -------- - uniform within range - - sequences - --------- - pick random element - pick random sample - generate random permutation - - distributions on the real line: - ------------------------------ - uniform - triangular - normal (Gaussian) - lognormal - negative exponential - gamma - beta - pareto - Weibull - - distributions on the circle (angles 0 to 2pi) - --------------------------------------------- - circular uniform - von Mises - -General notes on the underlying Mersenne Twister core generator: - -* The period is 2**19937-1. -* It is one of the most extensively tested generators in existence. -* Without a direct way to compute N steps forward, the semantics of - jumpahead(n) are weakened to simply jump to another distant state and rely - on the large period to avoid overlapping sequences. -* The random() method is implemented in C, executes in a single Python step, - and is, therefore, threadsafe. - -""" - -from __future__ import division -from warnings import warn as _warn -from types import MethodType as _MethodType, BuiltinMethodType as _BuiltinMethodType -from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil -from math import sqrt as _sqrt, acos as _acos, cos as _cos, sin as _sin -from os import urandom as _urandom -from binascii import hexlify as _hexlify -import hashlib as _hashlib - -__all__ = ["Random","seed","random","uniform","randint","choice","sample", - "randrange","shuffle","normalvariate","lognormvariate", - "expovariate","vonmisesvariate","gammavariate","triangular", - "gauss","betavariate","paretovariate","weibullvariate", - "getstate","setstate","jumpahead", "WichmannHill", "getrandbits", - "SystemRandom"] - -NV_MAGICCONST = 4 * _exp(-0.5)/_sqrt(2.0) -TWOPI = 2.0*_pi -LOG4 = _log(4.0) -SG_MAGICCONST = 1.0 + _log(4.5) -BPF = 53 # Number of bits in a float -RECIP_BPF = 2**-BPF - - -# Translated by Guido van Rossum from C source provided by -# Adrian Baddeley. Adapted by Raymond Hettinger for use with -# the Mersenne Twister and os.urandom() core generators. - -import _random - -class Random(_random.Random): - """Random number generator base class used by bound module functions. - - Used to instantiate instances of Random to get generators that don't - share state. Especially useful for multi-threaded programs, creating - a different instance of Random for each thread, and using the jumpahead() - method to ensure that the generated sequences seen by each thread don't - overlap. - - Class Random can also be subclassed if you want to use a different basic - generator of your own devising: in that case, override the following - methods: random(), seed(), getstate(), setstate() and jumpahead(). - Optionally, implement a getrandbits() method so that randrange() can cover - arbitrarily large ranges. - - """ - - VERSION = 3 # used by getstate/setstate - - def __init__(self, x=None): - """Initialize an instance. - - Optional argument x controls seeding, as for Random.seed(). - """ - - self.seed(x) - self.gauss_next = None - - def seed(self, a=None): - """Initialize internal state from hashable object. - - None or no argument seeds from current time or from an operating - system specific randomness source if available. - - If a is not None or an int or long, hash(a) is used instead. - """ - - if a is None: - try: - # Seed with enough bytes to span the 19937 bit - # state space for the Mersenne Twister - a = long(_hexlify(_urandom(2500)), 16) - except NotImplementedError: - import time - a = long(time.time() * 256) # use fractional seconds - - super(Random, self).seed(a) - self.gauss_next = None - - def getstate(self): - """Return internal state; can be passed to setstate() later.""" - return self.VERSION, super(Random, self).getstate(), self.gauss_next - - def setstate(self, state): - """Restore internal state from object returned by getstate().""" - version = state[0] - if version == 3: - version, internalstate, self.gauss_next = state - super(Random, self).setstate(internalstate) - elif version == 2: - version, internalstate, self.gauss_next = state - # In version 2, the state was saved as signed ints, which causes - # inconsistencies between 32/64-bit systems. The state is - # really unsigned 32-bit ints, so we convert negative ints from - # version 2 to positive longs for version 3. - try: - internalstate = tuple( long(x) % (2**32) for x in internalstate ) - except ValueError, e: - raise TypeError, e - super(Random, self).setstate(internalstate) - else: - raise ValueError("state with version %s passed to " - "Random.setstate() of version %s" % - (version, self.VERSION)) - - def jumpahead(self, n): - """Change the internal state to one that is likely far away - from the current state. This method will not be in Py3.x, - so it is better to simply reseed. - """ - # The super.jumpahead() method uses shuffling to change state, - # so it needs a large and "interesting" n to work with. Here, - # we use hashing to create a large n for the shuffle. - s = repr(n) + repr(self.getstate()) - n = int(_hashlib.new('sha512', s).hexdigest(), 16) - super(Random, self).jumpahead(n) - -## ---- Methods below this point do not need to be overridden when -## ---- subclassing for the purpose of using a different core generator. - -## -------------------- pickle support ------------------- - - def __getstate__(self): # for pickle - return self.getstate() - - def __setstate__(self, state): # for pickle - self.setstate(state) - - def __reduce__(self): - return self.__class__, (), self.getstate() - -## -------------------- integer methods ------------------- - - def randrange(self, start, stop=None, step=1, _int=int, _maxwidth=1L< 0: - if istart >= _maxwidth: - return self._randbelow(istart) - return _int(self.random() * istart) - raise ValueError, "empty range for randrange()" - - # stop argument supplied. - istop = _int(stop) - if istop != stop: - raise ValueError, "non-integer stop for randrange()" - width = istop - istart - if step == 1 and width > 0: - # Note that - # int(istart + self.random()*width) - # instead would be incorrect. For example, consider istart - # = -2 and istop = 0. Then the guts would be in - # -2.0 to 0.0 exclusive on both ends (ignoring that random() - # might return 0.0), and because int() truncates toward 0, the - # final result would be -1 or 0 (instead of -2 or -1). - # istart + int(self.random()*width) - # would also be incorrect, for a subtler reason: the RHS - # can return a long, and then randrange() would also return - # a long, but we're supposed to return an int (for backward - # compatibility). - - if width >= _maxwidth: - return _int(istart + self._randbelow(width)) - return _int(istart + _int(self.random()*width)) - if step == 1: - raise ValueError, "empty range for randrange() (%d,%d, %d)" % (istart, istop, width) - - # Non-unit step argument supplied. - istep = _int(step) - if istep != step: - raise ValueError, "non-integer step for randrange()" - if istep > 0: - n = (width + istep - 1) // istep - elif istep < 0: - n = (width + istep + 1) // istep - else: - raise ValueError, "zero step for randrange()" - - if n <= 0: - raise ValueError, "empty range for randrange()" - - if n >= _maxwidth: - return istart + istep*self._randbelow(n) - return istart + istep*_int(self.random() * n) - - def randint(self, a, b): - """Return random integer in range [a, b], including both end points. - """ - - return self.randrange(a, b+1) - - def _randbelow(self, n, _log=_log, _int=int, _maxwidth=1L< n-1 > 2**(k-2) - r = getrandbits(k) - while r >= n: - r = getrandbits(k) - return r - if n >= _maxwidth: - _warn("Underlying random() generator does not supply \n" - "enough bits to choose from a population range this large") - return _int(self.random() * n) - -## -------------------- sequence methods ------------------- - - def choice(self, seq): - """Choose a random element from a non-empty sequence.""" - return seq[int(self.random() * len(seq))] # raises IndexError if seq is empty - - def shuffle(self, x, random=None): - """x, random=random.random -> shuffle list x in place; return None. - - Optional arg random is a 0-argument function returning a random - float in [0.0, 1.0); by default, the standard random.random. - - """ - - if random is None: - random = self.random - _int = int - for i in reversed(xrange(1, len(x))): - # pick an element in x[:i+1] with which to exchange x[i] - j = _int(random() * (i+1)) - x[i], x[j] = x[j], x[i] - - def sample(self, population, k): - """Chooses k unique random elements from a population sequence. - - Returns a new list containing elements from the population while - leaving the original population unchanged. The resulting list is - in selection order so that all sub-slices will also be valid random - samples. This allows raffle winners (the sample) to be partitioned - into grand prize and second place winners (the subslices). - - Members of the population need not be hashable or unique. If the - population contains repeats, then each occurrence is a possible - selection in the sample. - - To choose a sample in a range of integers, use xrange as an argument. - This is especially fast and space efficient for sampling from a - large population: sample(xrange(10000000), 60) - """ - - # Sampling without replacement entails tracking either potential - # selections (the pool) in a list or previous selections in a set. - - # When the number of selections is small compared to the - # population, then tracking selections is efficient, requiring - # only a small set and an occasional reselection. For - # a larger number of selections, the pool tracking method is - # preferred since the list takes less space than the - # set and it doesn't suffer from frequent reselections. - - n = len(population) - if not 0 <= k <= n: - raise ValueError("sample larger than population") - random = self.random - _int = int - result = [None] * k - setsize = 21 # size of a small set minus size of an empty list - if k > 5: - setsize += 4 ** _ceil(_log(k * 3, 4)) # table size for big sets - if n <= setsize or hasattr(population, "keys"): - # An n-length list is smaller than a k-length set, or this is a - # mapping type so the other algorithm wouldn't work. - pool = list(population) - for i in xrange(k): # invariant: non-selected at [0,n-i) - j = _int(random() * (n-i)) - result[i] = pool[j] - pool[j] = pool[n-i-1] # move non-selected item into vacancy - else: - try: - selected = set() - selected_add = selected.add - for i in xrange(k): - j = _int(random() * n) - while j in selected: - j = _int(random() * n) - selected_add(j) - result[i] = population[j] - except (TypeError, KeyError): # handle (at least) sets - if isinstance(population, list): - raise - return self.sample(tuple(population), k) - return result - -## -------------------- real-valued distributions ------------------- - -## -------------------- uniform distribution ------------------- - - def uniform(self, a, b): - "Get a random number in the range [a, b) or [a, b] depending on rounding." - return a + (b-a) * self.random() - -## -------------------- triangular -------------------- - - def triangular(self, low=0.0, high=1.0, mode=None): - """Triangular distribution. - - Continuous distribution bounded by given lower and upper limits, - and having a given mode value in-between. - - http://en.wikipedia.org/wiki/Triangular_distribution - - """ - u = self.random() - try: - c = 0.5 if mode is None else (mode - low) / (high - low) - except ZeroDivisionError: - return low - if u > c: - u = 1.0 - u - c = 1.0 - c - low, high = high, low - return low + (high - low) * (u * c) ** 0.5 - -## -------------------- normal distribution -------------------- - - def normalvariate(self, mu, sigma): - """Normal distribution. - - mu is the mean, and sigma is the standard deviation. - - """ - # mu = mean, sigma = standard deviation - - # Uses Kinderman and Monahan method. Reference: Kinderman, - # A.J. and Monahan, J.F., "Computer generation of random - # variables using the ratio of uniform deviates", ACM Trans - # Math Software, 3, (1977), pp257-260. - - random = self.random - while 1: - u1 = random() - u2 = 1.0 - random() - z = NV_MAGICCONST*(u1-0.5)/u2 - zz = z*z/4.0 - if zz <= -_log(u2): - break - return mu + z*sigma - -## -------------------- lognormal distribution -------------------- - - def lognormvariate(self, mu, sigma): - """Log normal distribution. - - If you take the natural logarithm of this distribution, you'll get a - normal distribution with mean mu and standard deviation sigma. - mu can have any value, and sigma must be greater than zero. - - """ - return _exp(self.normalvariate(mu, sigma)) - -## -------------------- exponential distribution -------------------- - - def expovariate(self, lambd): - """Exponential distribution. - - lambd is 1.0 divided by the desired mean. It should be - nonzero. (The parameter would be called "lambda", but that is - a reserved word in Python.) Returned values range from 0 to - positive infinity if lambd is positive, and from negative - infinity to 0 if lambd is negative. - - """ - # lambd: rate lambd = 1/mean - # ('lambda' is a Python reserved word) - - # we use 1-random() instead of random() to preclude the - # possibility of taking the log of zero. - return -_log(1.0 - self.random())/lambd - -## -------------------- von Mises distribution -------------------- - - def vonmisesvariate(self, mu, kappa): - """Circular data distribution. - - mu is the mean angle, expressed in radians between 0 and 2*pi, and - kappa is the concentration parameter, which must be greater than or - equal to zero. If kappa is equal to zero, this distribution reduces - to a uniform random angle over the range 0 to 2*pi. - - """ - # mu: mean angle (in radians between 0 and 2*pi) - # kappa: concentration parameter kappa (>= 0) - # if kappa = 0 generate uniform random angle - - # Based upon an algorithm published in: Fisher, N.I., - # "Statistical Analysis of Circular Data", Cambridge - # University Press, 1993. - - # Thanks to Magnus Kessler for a correction to the - # implementation of step 4. - - random = self.random - if kappa <= 1e-6: - return TWOPI * random() - - s = 0.5 / kappa - r = s + _sqrt(1.0 + s * s) - - while 1: - u1 = random() - z = _cos(_pi * u1) - - d = z / (r + z) - u2 = random() - if u2 < 1.0 - d * d or u2 <= (1.0 - d) * _exp(d): - break - - q = 1.0 / r - f = (q + z) / (1.0 + q * z) - u3 = random() - if u3 > 0.5: - theta = (mu + _acos(f)) % TWOPI - else: - theta = (mu - _acos(f)) % TWOPI - - return theta - -## -------------------- gamma distribution -------------------- - - def gammavariate(self, alpha, beta): - """Gamma distribution. Not the gamma function! - - Conditions on the parameters are alpha > 0 and beta > 0. - - The probability distribution function is: - - x ** (alpha - 1) * math.exp(-x / beta) - pdf(x) = -------------------------------------- - math.gamma(alpha) * beta ** alpha - - """ - - # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2 - - # Warning: a few older sources define the gamma distribution in terms - # of alpha > -1.0 - if alpha <= 0.0 or beta <= 0.0: - raise ValueError, 'gammavariate: alpha and beta must be > 0.0' - - random = self.random - if alpha > 1.0: - - # Uses R.C.H. Cheng, "The generation of Gamma - # variables with non-integral shape parameters", - # Applied Statistics, (1977), 26, No. 1, p71-74 - - ainv = _sqrt(2.0 * alpha - 1.0) - bbb = alpha - LOG4 - ccc = alpha + ainv - - while 1: - u1 = random() - if not 1e-7 < u1 < .9999999: - continue - u2 = 1.0 - random() - v = _log(u1/(1.0-u1))/ainv - x = alpha*_exp(v) - z = u1*u1*u2 - r = bbb+ccc*v-x - if r + SG_MAGICCONST - 4.5*z >= 0.0 or r >= _log(z): - return x * beta - - elif alpha == 1.0: - # expovariate(1) - u = random() - while u <= 1e-7: - u = random() - return -_log(u) * beta - - else: # alpha is between 0 and 1 (exclusive) - - # Uses ALGORITHM GS of Statistical Computing - Kennedy & Gentle - - while 1: - u = random() - b = (_e + alpha)/_e - p = b*u - if p <= 1.0: - x = p ** (1.0/alpha) - else: - x = -_log((b-p)/alpha) - u1 = random() - if p > 1.0: - if u1 <= x ** (alpha - 1.0): - break - elif u1 <= _exp(-x): - break - return x * beta - -## -------------------- Gauss (faster alternative) -------------------- - - def gauss(self, mu, sigma): - """Gaussian distribution. - - mu is the mean, and sigma is the standard deviation. This is - slightly faster than the normalvariate() function. - - Not thread-safe without a lock around calls. - - """ - - # When x and y are two variables from [0, 1), uniformly - # distributed, then - # - # cos(2*pi*x)*sqrt(-2*log(1-y)) - # sin(2*pi*x)*sqrt(-2*log(1-y)) - # - # are two *independent* variables with normal distribution - # (mu = 0, sigma = 1). - # (Lambert Meertens) - # (corrected version; bug discovered by Mike Miller, fixed by LM) - - # Multithreading note: When two threads call this function - # simultaneously, it is possible that they will receive the - # same return value. The window is very small though. To - # avoid this, you have to use a lock around all calls. (I - # didn't want to slow this down in the serial case by using a - # lock here.) - - random = self.random - z = self.gauss_next - self.gauss_next = None - if z is None: - x2pi = random() * TWOPI - g2rad = _sqrt(-2.0 * _log(1.0 - random())) - z = _cos(x2pi) * g2rad - self.gauss_next = _sin(x2pi) * g2rad - - return mu + z*sigma - -## -------------------- beta -------------------- -## See -## http://mail.python.org/pipermail/python-bugs-list/2001-January/003752.html -## for Ivan Frohne's insightful analysis of why the original implementation: -## -## def betavariate(self, alpha, beta): -## # Discrete Event Simulation in C, pp 87-88. -## -## y = self.expovariate(alpha) -## z = self.expovariate(1.0/beta) -## return z/(y+z) -## -## was dead wrong, and how it probably got that way. - - def betavariate(self, alpha, beta): - """Beta distribution. - - Conditions on the parameters are alpha > 0 and beta > 0. - Returned values range between 0 and 1. - - """ - - # This version due to Janne Sinkkonen, and matches all the std - # texts (e.g., Knuth Vol 2 Ed 3 pg 134 "the beta distribution"). - y = self.gammavariate(alpha, 1.) - if y == 0: - return 0.0 - else: - return y / (y + self.gammavariate(beta, 1.)) - -## -------------------- Pareto -------------------- - - def paretovariate(self, alpha): - """Pareto distribution. alpha is the shape parameter.""" - # Jain, pg. 495 - - u = 1.0 - self.random() - return 1.0 / pow(u, 1.0/alpha) - -## -------------------- Weibull -------------------- - - def weibullvariate(self, alpha, beta): - """Weibull distribution. - - alpha is the scale parameter and beta is the shape parameter. - - """ - # Jain, pg. 499; bug fix courtesy Bill Arms - - u = 1.0 - self.random() - return alpha * pow(-_log(u), 1.0/beta) - -## -------------------- Wichmann-Hill ------------------- - -class WichmannHill(Random): - - VERSION = 1 # used by getstate/setstate - - def seed(self, a=None): - """Initialize internal state from hashable object. - - None or no argument seeds from current time or from an operating - system specific randomness source if available. - - If a is not None or an int or long, hash(a) is used instead. - - If a is an int or long, a is used directly. Distinct values between - 0 and 27814431486575L inclusive are guaranteed to yield distinct - internal states (this guarantee is specific to the default - Wichmann-Hill generator). - """ - - if a is None: - try: - a = long(_hexlify(_urandom(16)), 16) - except NotImplementedError: - import time - a = long(time.time() * 256) # use fractional seconds - - if not isinstance(a, (int, long)): - a = hash(a) - - a, x = divmod(a, 30268) - a, y = divmod(a, 30306) - a, z = divmod(a, 30322) - self._seed = int(x)+1, int(y)+1, int(z)+1 - - self.gauss_next = None - - def random(self): - """Get the next random number in the range [0.0, 1.0).""" - - # Wichman-Hill random number generator. - # - # Wichmann, B. A. & Hill, I. D. (1982) - # Algorithm AS 183: - # An efficient and portable pseudo-random number generator - # Applied Statistics 31 (1982) 188-190 - # - # see also: - # Correction to Algorithm AS 183 - # Applied Statistics 33 (1984) 123 - # - # McLeod, A. I. (1985) - # A remark on Algorithm AS 183 - # Applied Statistics 34 (1985),198-200 - - # This part is thread-unsafe: - # BEGIN CRITICAL SECTION - x, y, z = self._seed - x = (171 * x) % 30269 - y = (172 * y) % 30307 - z = (170 * z) % 30323 - self._seed = x, y, z - # END CRITICAL SECTION - - # Note: on a platform using IEEE-754 double arithmetic, this can - # never return 0.0 (asserted by Tim; proof too long for a comment). - return (x/30269.0 + y/30307.0 + z/30323.0) % 1.0 - - def getstate(self): - """Return internal state; can be passed to setstate() later.""" - return self.VERSION, self._seed, self.gauss_next - - def setstate(self, state): - """Restore internal state from object returned by getstate().""" - version = state[0] - if version == 1: - version, self._seed, self.gauss_next = state - else: - raise ValueError("state with version %s passed to " - "Random.setstate() of version %s" % - (version, self.VERSION)) - - def jumpahead(self, n): - """Act as if n calls to random() were made, but quickly. - - n is an int, greater than or equal to 0. - - Example use: If you have 2 threads and know that each will - consume no more than a million random numbers, create two Random - objects r1 and r2, then do - r2.setstate(r1.getstate()) - r2.jumpahead(1000000) - Then r1 and r2 will use guaranteed-disjoint segments of the full - period. - """ - - if not n >= 0: - raise ValueError("n must be >= 0") - x, y, z = self._seed - x = int(x * pow(171, n, 30269)) % 30269 - y = int(y * pow(172, n, 30307)) % 30307 - z = int(z * pow(170, n, 30323)) % 30323 - self._seed = x, y, z - - def __whseed(self, x=0, y=0, z=0): - """Set the Wichmann-Hill seed from (x, y, z). - - These must be integers in the range [0, 256). - """ - - if not type(x) == type(y) == type(z) == int: - raise TypeError('seeds must be integers') - if not (0 <= x < 256 and 0 <= y < 256 and 0 <= z < 256): - raise ValueError('seeds must be in range(0, 256)') - if 0 == x == y == z: - # Initialize from current time - import time - t = long(time.time() * 256) - t = int((t&0xffffff) ^ (t>>24)) - t, x = divmod(t, 256) - t, y = divmod(t, 256) - t, z = divmod(t, 256) - # Zero is a poor seed, so substitute 1 - self._seed = (x or 1, y or 1, z or 1) - - self.gauss_next = None - - def whseed(self, a=None): - """Seed from hashable object's hash code. - - None or no argument seeds from current time. It is not guaranteed - that objects with distinct hash codes lead to distinct internal - states. - - This is obsolete, provided for compatibility with the seed routine - used prior to Python 2.1. Use the .seed() method instead. - """ - - if a is None: - self.__whseed() - return - a = hash(a) - a, x = divmod(a, 256) - a, y = divmod(a, 256) - a, z = divmod(a, 256) - x = (x + a) % 256 or 1 - y = (y + a) % 256 or 1 - z = (z + a) % 256 or 1 - self.__whseed(x, y, z) - -## --------------- Operating System Random Source ------------------ - -class SystemRandom(Random): - """Alternate random number generator using sources provided - by the operating system (such as /dev/urandom on Unix or - CryptGenRandom on Windows). - - Not available on all systems (see os.urandom() for details). - """ - - def random(self): - """Get the next random number in the range [0.0, 1.0).""" - return (long(_hexlify(_urandom(7)), 16) >> 3) * RECIP_BPF - - def getrandbits(self, k): - """getrandbits(k) -> x. Generates a long int with k random bits.""" - if k <= 0: - raise ValueError('number of bits must be greater than zero') - if k != int(k): - raise TypeError('number of bits should be an integer') - bytes = (k + 7) // 8 # bits / 8 and rounded up - x = long(_hexlify(_urandom(bytes)), 16) - return x >> (bytes * 8 - k) # trim excess bits - - def _stub(self, *args, **kwds): - "Stub method. Not used for a system random number generator." - return None - seed = jumpahead = _stub - - def _notimplemented(self, *args, **kwds): - "Method should not be called for a system random number generator." - raise NotImplementedError('System entropy source does not have state.') - getstate = setstate = _notimplemented - -## -------------------- test program -------------------- - -def _test_generator(n, func, args): - import time - print n, 'times', func.__name__ - total = 0.0 - sqsum = 0.0 - smallest = 1e10 - largest = -1e10 - t0 = time.time() - for i in range(n): - x = func(*args) - total += x - sqsum = sqsum + x*x - smallest = min(x, smallest) - largest = max(x, largest) - t1 = time.time() - print round(t1-t0, 3), 'sec,', - avg = total/n - stddev = _sqrt(sqsum/n - avg*avg) - print 'avg %g, stddev %g, min %g, max %g' % \ - (avg, stddev, smallest, largest) - - -def _test(N=2000): - _test_generator(N, random, ()) - _test_generator(N, normalvariate, (0.0, 1.0)) - _test_generator(N, lognormvariate, (0.0, 1.0)) - _test_generator(N, vonmisesvariate, (0.0, 1.0)) - _test_generator(N, gammavariate, (0.01, 1.0)) - _test_generator(N, gammavariate, (0.1, 1.0)) - _test_generator(N, gammavariate, (0.1, 2.0)) - _test_generator(N, gammavariate, (0.5, 1.0)) - _test_generator(N, gammavariate, (0.9, 1.0)) - _test_generator(N, gammavariate, (1.0, 1.0)) - _test_generator(N, gammavariate, (2.0, 1.0)) - _test_generator(N, gammavariate, (20.0, 1.0)) - _test_generator(N, gammavariate, (200.0, 1.0)) - _test_generator(N, gauss, (0.0, 1.0)) - _test_generator(N, betavariate, (3.0, 3.0)) - _test_generator(N, triangular, (0.0, 1.0, 1.0/3.0)) - -# Create one instance, seeded from current time, and export its methods -# as module-level functions. The functions share state across all uses -#(both in the user's code and in the Python libraries), but that's fine -# for most programs and is easier for the casual user than making them -# instantiate their own Random() instance. - -_inst = Random() -seed = _inst.seed -random = _inst.random -uniform = _inst.uniform -triangular = _inst.triangular -randint = _inst.randint -choice = _inst.choice -randrange = _inst.randrange -sample = _inst.sample -shuffle = _inst.shuffle -normalvariate = _inst.normalvariate -lognormvariate = _inst.lognormvariate -expovariate = _inst.expovariate -vonmisesvariate = _inst.vonmisesvariate -gammavariate = _inst.gammavariate -gauss = _inst.gauss -betavariate = _inst.betavariate -paretovariate = _inst.paretovariate -weibullvariate = _inst.weibullvariate -getstate = _inst.getstate -setstate = _inst.setstate -jumpahead = _inst.jumpahead -getrandbits = _inst.getrandbits - -if __name__ == '__main__': - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/re.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/re.py deleted file mode 100644 index 6620d33..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/re.py +++ /dev/null @@ -1,340 +0,0 @@ -# -# Secret Labs' Regular Expression Engine -# -# re-compatible interface for the sre matching engine -# -# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. -# -# This version of the SRE library can be redistributed under CNRI's -# Python 1.6 license. For any other use, please contact Secret Labs -# AB (info@pythonware.com). -# -# Portions of this engine have been developed in cooperation with -# CNRI. Hewlett-Packard provided funding for 1.6 integration and -# other compatibility work. -# - -r"""Support for regular expressions (RE). - -This module provides regular expression matching operations similar to -those found in Perl. It supports both 8-bit and Unicode strings; both -the pattern and the strings being processed can contain null bytes and -characters outside the US ASCII range. - -Regular expressions can contain both special and ordinary characters. -Most ordinary characters, like "A", "a", or "0", are the simplest -regular expressions; they simply match themselves. You can -concatenate ordinary characters, so last matches the string 'last'. - -The special characters are: - "." Matches any character except a newline. - "^" Matches the start of the string. - "$" Matches the end of the string or just before the newline at - the end of the string. - "*" Matches 0 or more (greedy) repetitions of the preceding RE. - Greedy means that it will match as many repetitions as possible. - "+" Matches 1 or more (greedy) repetitions of the preceding RE. - "?" Matches 0 or 1 (greedy) of the preceding RE. - *?,+?,?? Non-greedy versions of the previous three special characters. - {m,n} Matches from m to n repetitions of the preceding RE. - {m,n}? Non-greedy version of the above. - "\\" Either escapes special characters or signals a special sequence. - [] Indicates a set of characters. - A "^" as the first character indicates a complementing set. - "|" A|B, creates an RE that will match either A or B. - (...) Matches the RE inside the parentheses. - The contents can be retrieved or matched later in the string. - (?iLmsux) Set the I, L, M, S, U, or X flag for the RE (see below). - (?:...) Non-grouping version of regular parentheses. - (?P...) The substring matched by the group is accessible by name. - (?P=name) Matches the text matched earlier by the group named name. - (?#...) A comment; ignored. - (?=...) Matches if ... matches next, but doesn't consume the string. - (?!...) Matches if ... doesn't match next. - (?<=...) Matches if preceded by ... (must be fixed length). - (?= 0x02020000: - __all__.append("finditer") - def finditer(pattern, string, flags=0): - """Return an iterator over all non-overlapping matches in the - string. For each match, the iterator returns a match object. - - Empty matches are included in the result.""" - return _compile(pattern, flags).finditer(string) - -def compile(pattern, flags=0): - "Compile a regular expression pattern, returning a pattern object." - return _compile(pattern, flags) - -def purge(): - "Clear the regular expression cache" - _cache.clear() - _cache_repl.clear() - -def template(pattern, flags=0): - "Compile a template pattern, returning a pattern object" - return _compile(pattern, flags|T) - -_alphanum = frozenset( - "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789") - -def escape(pattern): - "Escape all non-alphanumeric characters in pattern." - s = list(pattern) - alphanum = _alphanum - for i, c in enumerate(pattern): - if c not in alphanum: - if c == "\000": - s[i] = "\\000" - else: - s[i] = "\\" + c - return pattern[:0].join(s) - -# -------------------------------------------------------------------- -# internals - -_cache = {} -_cache_repl = {} - -_pattern_type = type(sre_compile.compile("", 0)) - -_MAXCACHE = 100 - -def _compile(*key): - # internal: compile pattern - pattern, flags = key - bypass_cache = flags & DEBUG - if not bypass_cache: - cachekey = (type(key[0]),) + key - try: - p, loc = _cache[cachekey] - if loc is None or loc == _locale.setlocale(_locale.LC_CTYPE): - return p - except KeyError: - pass - if isinstance(pattern, _pattern_type): - if flags: - raise ValueError('Cannot process flags argument with a compiled pattern') - return pattern - if not sre_compile.isstring(pattern): - raise TypeError, "first argument must be string or compiled pattern" - try: - p = sre_compile.compile(pattern, flags) - except error, v: - raise error, v # invalid expression - if not bypass_cache: - if len(_cache) >= _MAXCACHE: - _cache.clear() - if p.flags & LOCALE: - if not _locale: - return p - loc = _locale.setlocale(_locale.LC_CTYPE) - else: - loc = None - _cache[cachekey] = p, loc - return p - -def _compile_repl(*key): - # internal: compile replacement pattern - p = _cache_repl.get(key) - if p is not None: - return p - repl, pattern = key - try: - p = sre_parse.parse_template(repl, pattern) - except error, v: - raise error, v # invalid expression - if len(_cache_repl) >= _MAXCACHE: - _cache_repl.clear() - _cache_repl[key] = p - return p - -def _expand(pattern, match, template): - # internal: match.expand implementation hook - template = sre_parse.parse_template(template, pattern) - return sre_parse.expand_template(template, match) - -def _subx(pattern, template): - # internal: pattern.sub/subn implementation helper - template = _compile_repl(template, pattern) - if not template[0] and len(template[1]) == 1: - # literal replacement - return template[1][0] - def filter(match, template=template): - return sre_parse.expand_template(template, match) - return filter - -# register myself for pickling - -import copy_reg - -def _pickle(p): - return _compile, (p.pattern, p.flags) - -copy_reg.pickle(_pattern_type, _pickle, _compile) - -# -------------------------------------------------------------------- -# experimental stuff (see python-dev discussions for details) - -class Scanner: - def __init__(self, lexicon, flags=0): - from sre_constants import BRANCH, SUBPATTERN - self.lexicon = lexicon - # combine phrases into a compound pattern - p = [] - s = sre_parse.Pattern() - s.flags = flags - for phrase, action in lexicon: - p.append(sre_parse.SubPattern(s, [ - (SUBPATTERN, (len(p)+1, sre_parse.parse(phrase, flags))), - ])) - s.groups = len(p)+1 - p = sre_parse.SubPattern(s, [(BRANCH, (None, p))]) - self.scanner = sre_compile.compile(p) - def scan(self, string): - result = [] - append = result.append - match = self.scanner.scanner(string).match - i = 0 - while 1: - m = match() - if not m: - break - j = m.end() - if i == j: - break - action = self.lexicon[m.lastindex-1][1] - if hasattr(action, '__call__'): - self.match = m - action = action(self, m.group()) - if action is not None: - append(action) - i = j - return result, string[i:] diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py deleted file mode 100644 index 71a3a15..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/repr.py +++ /dev/null @@ -1,132 +0,0 @@ -"""Redo the builtin repr() (representation) but with limits on most sizes.""" - -__all__ = ["Repr","repr"] - -import __builtin__ -from itertools import islice - -class Repr: - - def __init__(self): - self.maxlevel = 6 - self.maxtuple = 6 - self.maxlist = 6 - self.maxarray = 5 - self.maxdict = 4 - self.maxset = 6 - self.maxfrozenset = 6 - self.maxdeque = 6 - self.maxstring = 30 - self.maxlong = 40 - self.maxother = 20 - - def repr(self, x): - return self.repr1(x, self.maxlevel) - - def repr1(self, x, level): - typename = type(x).__name__ - if ' ' in typename: - parts = typename.split() - typename = '_'.join(parts) - if hasattr(self, 'repr_' + typename): - return getattr(self, 'repr_' + typename)(x, level) - else: - s = __builtin__.repr(x) - if len(s) > self.maxother: - i = max(0, (self.maxother-3)//2) - j = max(0, self.maxother-3-i) - s = s[:i] + '...' + s[len(s)-j:] - return s - - def _repr_iterable(self, x, level, left, right, maxiter, trail=''): - n = len(x) - if level <= 0 and n: - s = '...' - else: - newlevel = level - 1 - repr1 = self.repr1 - pieces = [repr1(elem, newlevel) for elem in islice(x, maxiter)] - if n > maxiter: pieces.append('...') - s = ', '.join(pieces) - if n == 1 and trail: right = trail + right - return '%s%s%s' % (left, s, right) - - def repr_tuple(self, x, level): - return self._repr_iterable(x, level, '(', ')', self.maxtuple, ',') - - def repr_list(self, x, level): - return self._repr_iterable(x, level, '[', ']', self.maxlist) - - def repr_array(self, x, level): - header = "array('%s', [" % x.typecode - return self._repr_iterable(x, level, header, '])', self.maxarray) - - def repr_set(self, x, level): - x = _possibly_sorted(x) - return self._repr_iterable(x, level, 'set([', '])', self.maxset) - - def repr_frozenset(self, x, level): - x = _possibly_sorted(x) - return self._repr_iterable(x, level, 'frozenset([', '])', - self.maxfrozenset) - - def repr_deque(self, x, level): - return self._repr_iterable(x, level, 'deque([', '])', self.maxdeque) - - def repr_dict(self, x, level): - n = len(x) - if n == 0: return '{}' - if level <= 0: return '{...}' - newlevel = level - 1 - repr1 = self.repr1 - pieces = [] - for key in islice(_possibly_sorted(x), self.maxdict): - keyrepr = repr1(key, newlevel) - valrepr = repr1(x[key], newlevel) - pieces.append('%s: %s' % (keyrepr, valrepr)) - if n > self.maxdict: pieces.append('...') - s = ', '.join(pieces) - return '{%s}' % (s,) - - def repr_str(self, x, level): - s = __builtin__.repr(x[:self.maxstring]) - if len(s) > self.maxstring: - i = max(0, (self.maxstring-3)//2) - j = max(0, self.maxstring-3-i) - s = __builtin__.repr(x[:i] + x[len(x)-j:]) - s = s[:i] + '...' + s[len(s)-j:] - return s - - def repr_long(self, x, level): - s = __builtin__.repr(x) # XXX Hope this isn't too slow... - if len(s) > self.maxlong: - i = max(0, (self.maxlong-3)//2) - j = max(0, self.maxlong-3-i) - s = s[:i] + '...' + s[len(s)-j:] - return s - - def repr_instance(self, x, level): - try: - s = __builtin__.repr(x) - # Bugs in x.__repr__() can cause arbitrary - # exceptions -- then make up something - except Exception: - return '<%s instance at %x>' % (x.__class__.__name__, id(x)) - if len(s) > self.maxstring: - i = max(0, (self.maxstring-3)//2) - j = max(0, self.maxstring-3-i) - s = s[:i] + '...' + s[len(s)-j:] - return s - - -def _possibly_sorted(x): - # Since not all sequences of items can be sorted and comparison - # functions may raise arbitrary exceptions, return an unsorted - # sequence in that case. - try: - return sorted(x) - except Exception: - return list(x) - -aRepr = Repr() -repr = aRepr.repr diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py deleted file mode 100644 index abbd1db..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/runpy.py +++ /dev/null @@ -1,278 +0,0 @@ -"""runpy.py - locating and running Python code using the module namespace - -Provides support for locating and running Python scripts using the Python -module namespace instead of the native filesystem. - -This allows Python code to play nicely with non-filesystem based PEP 302 -importers when locating support scripts as well as when importing modules. -""" -# Written by Nick Coghlan -# to implement PEP 338 (Executing Modules as Scripts) - -import sys -import imp -from pkgutil import read_code -try: - from imp import get_loader -except ImportError: - from pkgutil import get_loader - -__all__ = [ - "run_module", "run_path", -] - -class _TempModule(object): - """Temporarily replace a module in sys.modules with an empty namespace""" - def __init__(self, mod_name): - self.mod_name = mod_name - self.module = imp.new_module(mod_name) - self._saved_module = [] - - def __enter__(self): - mod_name = self.mod_name - try: - self._saved_module.append(sys.modules[mod_name]) - except KeyError: - pass - sys.modules[mod_name] = self.module - return self - - def __exit__(self, *args): - if self._saved_module: - sys.modules[self.mod_name] = self._saved_module[0] - else: - del sys.modules[self.mod_name] - self._saved_module = [] - -class _ModifiedArgv0(object): - def __init__(self, value): - self.value = value - self._saved_value = self._sentinel = object() - - def __enter__(self): - if self._saved_value is not self._sentinel: - raise RuntimeError("Already preserving saved value") - self._saved_value = sys.argv[0] - sys.argv[0] = self.value - - def __exit__(self, *args): - self.value = self._sentinel - sys.argv[0] = self._saved_value - -def _run_code(code, run_globals, init_globals=None, - mod_name=None, mod_fname=None, - mod_loader=None, pkg_name=None): - """Helper to run code in nominated namespace""" - if init_globals is not None: - run_globals.update(init_globals) - run_globals.update(__name__ = mod_name, - __file__ = mod_fname, - __loader__ = mod_loader, - __package__ = pkg_name) - exec code in run_globals - return run_globals - -def _run_module_code(code, init_globals=None, - mod_name=None, mod_fname=None, - mod_loader=None, pkg_name=None): - """Helper to run code in new namespace with sys modified""" - with _TempModule(mod_name) as temp_module, _ModifiedArgv0(mod_fname): - mod_globals = temp_module.module.__dict__ - _run_code(code, mod_globals, init_globals, - mod_name, mod_fname, mod_loader, pkg_name) - # Copy the globals of the temporary module, as they - # may be cleared when the temporary module goes away - return mod_globals.copy() - - -# This helper is needed due to a missing component in the PEP 302 -# loader protocol (specifically, "get_filename" is non-standard) -# Since we can't introduce new features in maintenance releases, -# support was added to zipimporter under the name '_get_filename' -def _get_filename(loader, mod_name): - for attr in ("get_filename", "_get_filename"): - meth = getattr(loader, attr, None) - if meth is not None: - return meth(mod_name) - return None - -# Helper to get the loader, code and filename for a module -def _get_module_details(mod_name): - loader = get_loader(mod_name) - if loader is None: - raise ImportError("No module named %s" % mod_name) - if loader.is_package(mod_name): - if mod_name == "__main__" or mod_name.endswith(".__main__"): - raise ImportError("Cannot use package as __main__ module") - try: - pkg_main_name = mod_name + ".__main__" - return _get_module_details(pkg_main_name) - except ImportError, e: - raise ImportError(("%s; %r is a package and cannot " + - "be directly executed") %(e, mod_name)) - code = loader.get_code(mod_name) - if code is None: - raise ImportError("No code object available for %s" % mod_name) - filename = _get_filename(loader, mod_name) - return mod_name, loader, code, filename - - -def _get_main_module_details(): - # Helper that gives a nicer error message when attempting to - # execute a zipfile or directory by invoking __main__.py - main_name = "__main__" - try: - return _get_module_details(main_name) - except ImportError as exc: - if main_name in str(exc): - raise ImportError("can't find %r module in %r" % - (main_name, sys.path[0])) - raise - -# This function is the actual implementation of the -m switch and direct -# execution of zipfiles and directories and is deliberately kept private. -# This avoids a repeat of the situation where run_module() no longer met the -# needs of mainmodule.c, but couldn't be changed because it was public -def _run_module_as_main(mod_name, alter_argv=True): - """Runs the designated module in the __main__ namespace - - Note that the executed module will have full access to the - __main__ namespace. If this is not desirable, the run_module() - function should be used to run the module code in a fresh namespace. - - At the very least, these variables in __main__ will be overwritten: - __name__ - __file__ - __loader__ - __package__ - """ - try: - if alter_argv or mod_name != "__main__": # i.e. -m switch - mod_name, loader, code, fname = _get_module_details(mod_name) - else: # i.e. directory or zipfile execution - mod_name, loader, code, fname = _get_main_module_details() - except ImportError as exc: - msg = "%s: %s" % (sys.executable, str(exc)) - sys.exit(msg) - pkg_name = mod_name.rpartition('.')[0] - main_globals = sys.modules["__main__"].__dict__ - if alter_argv: - sys.argv[0] = fname - return _run_code(code, main_globals, None, - "__main__", fname, loader, pkg_name) - -def run_module(mod_name, init_globals=None, - run_name=None, alter_sys=False): - """Execute a module's code without importing it - - Returns the resulting top level namespace dictionary - """ - mod_name, loader, code, fname = _get_module_details(mod_name) - if run_name is None: - run_name = mod_name - pkg_name = mod_name.rpartition('.')[0] - if alter_sys: - return _run_module_code(code, init_globals, run_name, - fname, loader, pkg_name) - else: - # Leave the sys module alone - return _run_code(code, {}, init_globals, run_name, - fname, loader, pkg_name) - - -# XXX (ncoghlan): Perhaps expose the C API function -# as imp.get_importer instead of reimplementing it in Python? -def _get_importer(path_name): - """Python version of PyImport_GetImporter C API function""" - cache = sys.path_importer_cache - try: - importer = cache[path_name] - except KeyError: - # Not yet cached. Flag as using the - # standard machinery until we finish - # checking the hooks - cache[path_name] = None - for hook in sys.path_hooks: - try: - importer = hook(path_name) - break - except ImportError: - pass - else: - # The following check looks a bit odd. The trick is that - # NullImporter raises ImportError if the supplied path is a - # *valid* directory entry (and hence able to be handled - # by the standard import machinery) - try: - importer = imp.NullImporter(path_name) - except ImportError: - return None - cache[path_name] = importer - return importer - -def _get_code_from_file(fname): - # Check for a compiled file first - with open(fname, "rb") as f: - code = read_code(f) - if code is None: - # That didn't work, so try it as normal source code - with open(fname, "rU") as f: - code = compile(f.read(), fname, 'exec') - return code - -def run_path(path_name, init_globals=None, run_name=None): - """Execute code located at the specified filesystem location - - Returns the resulting top level namespace dictionary - - The file path may refer directly to a Python script (i.e. - one that could be directly executed with execfile) or else - it may refer to a zipfile or directory containing a top - level __main__.py script. - """ - if run_name is None: - run_name = "" - importer = _get_importer(path_name) - if isinstance(importer, imp.NullImporter): - # Not a valid sys.path entry, so run the code directly - # execfile() doesn't help as we want to allow compiled files - code = _get_code_from_file(path_name) - return _run_module_code(code, init_globals, run_name, path_name) - else: - # Importer is defined for path, so add it to - # the start of sys.path - sys.path.insert(0, path_name) - try: - # Here's where things are a little different from the run_module - # case. There, we only had to replace the module in sys while the - # code was running and doing so was somewhat optional. Here, we - # have no choice and we have to remove it even while we read the - # code. If we don't do this, a __loader__ attribute in the - # existing __main__ module may prevent location of the new module. - main_name = "__main__" - saved_main = sys.modules[main_name] - del sys.modules[main_name] - try: - mod_name, loader, code, fname = _get_main_module_details() - finally: - sys.modules[main_name] = saved_main - pkg_name = "" - with _TempModule(run_name) as temp_module, \ - _ModifiedArgv0(path_name): - mod_globals = temp_module.module.__dict__ - return _run_code(code, mod_globals, init_globals, - run_name, fname, loader, pkg_name).copy() - finally: - try: - sys.path.remove(path_name) - except ValueError: - pass - - -if __name__ == "__main__": - # Run the module specified as the next command line argument - if len(sys.argv) < 2: - print >> sys.stderr, "No module specified for execution" - else: - del sys.argv[0] # Make the requested module sys.argv[0] - _run_module_as_main(sys.argv[0]) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py deleted file mode 100644 index 93a17bc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/sha.py +++ /dev/null @@ -1,15 +0,0 @@ -# $Id$ -# -# Copyright (C) 2005 Gregory P. Smith (greg@krypto.org) -# Licensed to PSF under a Contributor Agreement. - -import warnings -warnings.warn("the sha module is deprecated; use the hashlib module instead", - DeprecationWarning, 2) - -from hashlib import sha1 as sha -new = sha - -blocksize = 1 # legacy value (wrong in any useful sense) -digest_size = 20 -digestsize = 20 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py deleted file mode 100644 index 539c5b9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/shutil.py +++ /dev/null @@ -1,555 +0,0 @@ -"""Utility functions for copying and archiving files and directory trees. - -XXX The functions here don't copy the resource fork or other metadata on Mac. - -""" - -import os -import sys -import stat -from os.path import abspath -import fnmatch -import collections -import errno - -try: - from pwd import getpwnam -except ImportError: - getpwnam = None - -try: - from grp import getgrnam -except ImportError: - getgrnam = None - -__all__ = ["copyfileobj", "copyfile", "copymode", "copystat", "copy", "copy2", - "copytree", "move", "rmtree", "Error", "SpecialFileError", - "ExecError", "make_archive", "get_archive_formats", - "register_archive_format", "unregister_archive_format", - "ignore_patterns"] - -class Error(EnvironmentError): - pass - -class SpecialFileError(EnvironmentError): - """Raised when trying to do a kind of operation (e.g. copying) which is - not supported on a special file (e.g. a named pipe)""" - -class ExecError(EnvironmentError): - """Raised when a command could not be executed""" - -try: - WindowsError -except NameError: - WindowsError = None - -def copyfileobj(fsrc, fdst, length=16*1024): - """copy data from file-like object fsrc to file-like object fdst""" - while 1: - buf = fsrc.read(length) - if not buf: - break - fdst.write(buf) - -def _samefile(src, dst): - # Macintosh, Unix. - if hasattr(os.path, 'samefile'): - try: - return os.path.samefile(src, dst) - except OSError: - return False - - # All other platforms: check for same pathname. - return (os.path.normcase(os.path.abspath(src)) == - os.path.normcase(os.path.abspath(dst))) - -def copyfile(src, dst): - """Copy data from src to dst""" - if _samefile(src, dst): - raise Error("`%s` and `%s` are the same file" % (src, dst)) - - for fn in [src, dst]: - try: - st = os.stat(fn) - except OSError: - # File most likely does not exist - pass - else: - # XXX What about other special files? (sockets, devices...) - if stat.S_ISFIFO(st.st_mode): - raise SpecialFileError("`%s` is a named pipe" % fn) - - with open(src, 'rb') as fsrc: - with open(dst, 'wb') as fdst: - copyfileobj(fsrc, fdst) - -def copymode(src, dst): - """Copy mode bits from src to dst""" - if hasattr(os, 'chmod'): - st = os.stat(src) - mode = stat.S_IMODE(st.st_mode) - os.chmod(dst, mode) - -def copystat(src, dst): - """Copy all stat info (mode bits, atime, mtime, flags) from src to dst""" - st = os.stat(src) - mode = stat.S_IMODE(st.st_mode) - if hasattr(os, 'utime'): - os.utime(dst, (st.st_atime, st.st_mtime)) - if hasattr(os, 'chmod'): - os.chmod(dst, mode) - if hasattr(os, 'chflags') and hasattr(st, 'st_flags'): - try: - os.chflags(dst, st.st_flags) - except OSError, why: - for err in 'EOPNOTSUPP', 'ENOTSUP': - if hasattr(errno, err) and why.errno == getattr(errno, err): - break - else: - raise - -def copy(src, dst): - """Copy data and mode bits ("cp src dst"). - - The destination may be a directory. - - """ - if os.path.isdir(dst): - dst = os.path.join(dst, os.path.basename(src)) - copyfile(src, dst) - copymode(src, dst) - -def copy2(src, dst): - """Copy data and all stat info ("cp -p src dst"). - - The destination may be a directory. - - """ - if os.path.isdir(dst): - dst = os.path.join(dst, os.path.basename(src)) - copyfile(src, dst) - copystat(src, dst) - -def ignore_patterns(*patterns): - """Function that can be used as copytree() ignore parameter. - - Patterns is a sequence of glob-style patterns - that are used to exclude files""" - def _ignore_patterns(path, names): - ignored_names = [] - for pattern in patterns: - ignored_names.extend(fnmatch.filter(names, pattern)) - return set(ignored_names) - return _ignore_patterns - -def copytree(src, dst, symlinks=False, ignore=None): - """Recursively copy a directory tree using copy2(). - - The destination directory must not already exist. - If exception(s) occur, an Error is raised with a list of reasons. - - If the optional symlinks flag is true, symbolic links in the - source tree result in symbolic links in the destination tree; if - it is false, the contents of the files pointed to by symbolic - links are copied. - - The optional ignore argument is a callable. If given, it - is called with the `src` parameter, which is the directory - being visited by copytree(), and `names` which is the list of - `src` contents, as returned by os.listdir(): - - callable(src, names) -> ignored_names - - Since copytree() is called recursively, the callable will be - called once for each directory that is copied. It returns a - list of names relative to the `src` directory that should - not be copied. - - XXX Consider this example code rather than the ultimate tool. - - """ - names = os.listdir(src) - if ignore is not None: - ignored_names = ignore(src, names) - else: - ignored_names = set() - - os.makedirs(dst) - errors = [] - for name in names: - if name in ignored_names: - continue - srcname = os.path.join(src, name) - dstname = os.path.join(dst, name) - try: - if symlinks and os.path.islink(srcname): - linkto = os.readlink(srcname) - os.symlink(linkto, dstname) - elif os.path.isdir(srcname): - copytree(srcname, dstname, symlinks, ignore) - else: - # Will raise a SpecialFileError for unsupported file types - copy2(srcname, dstname) - # catch the Error from the recursive copytree so that we can - # continue with other files - except Error, err: - errors.extend(err.args[0]) - except EnvironmentError, why: - errors.append((srcname, dstname, str(why))) - try: - copystat(src, dst) - except OSError, why: - if WindowsError is not None and isinstance(why, WindowsError): - # Copying file access times may fail on Windows - pass - else: - errors.append((src, dst, str(why))) - if errors: - raise Error, errors - -def rmtree(path, ignore_errors=False, onerror=None): - """Recursively delete a directory tree. - - If ignore_errors is set, errors are ignored; otherwise, if onerror - is set, it is called to handle the error with arguments (func, - path, exc_info) where func is os.listdir, os.remove, or os.rmdir; - path is the argument to that function that caused it to fail; and - exc_info is a tuple returned by sys.exc_info(). If ignore_errors - is false and onerror is None, an exception is raised. - - """ - if ignore_errors: - def onerror(*args): - pass - elif onerror is None: - def onerror(*args): - raise - try: - if os.path.islink(path): - # symlinks to directories are forbidden, see bug #1669 - raise OSError("Cannot call rmtree on a symbolic link") - except OSError: - onerror(os.path.islink, path, sys.exc_info()) - # can't continue even if onerror hook returns - return - names = [] - try: - names = os.listdir(path) - except os.error, err: - onerror(os.listdir, path, sys.exc_info()) - for name in names: - fullname = os.path.join(path, name) - try: - mode = os.lstat(fullname).st_mode - except os.error: - mode = 0 - if stat.S_ISDIR(mode): - rmtree(fullname, ignore_errors, onerror) - else: - try: - os.remove(fullname) - except os.error, err: - onerror(os.remove, fullname, sys.exc_info()) - try: - os.rmdir(path) - except os.error: - onerror(os.rmdir, path, sys.exc_info()) - - -def _basename(path): - # A basename() variant which first strips the trailing slash, if present. - # Thus we always get the last component of the path, even for directories. - sep = os.path.sep + (os.path.altsep or '') - return os.path.basename(path.rstrip(sep)) - -def move(src, dst): - """Recursively move a file or directory to another location. This is - similar to the Unix "mv" command. - - If the destination is a directory or a symlink to a directory, the source - is moved inside the directory. The destination path must not already - exist. - - If the destination already exists but is not a directory, it may be - overwritten depending on os.rename() semantics. - - If the destination is on our current filesystem, then rename() is used. - Otherwise, src is copied to the destination and then removed. - A lot more could be done here... A look at a mv.c shows a lot of - the issues this implementation glosses over. - - """ - real_dst = dst - if os.path.isdir(dst): - if _samefile(src, dst): - # We might be on a case insensitive filesystem, - # perform the rename anyway. - os.rename(src, dst) - return - - real_dst = os.path.join(dst, _basename(src)) - if os.path.exists(real_dst): - raise Error, "Destination path '%s' already exists" % real_dst - try: - os.rename(src, real_dst) - except OSError: - if os.path.isdir(src): - if _destinsrc(src, dst): - raise Error, "Cannot move a directory '%s' into itself '%s'." % (src, dst) - copytree(src, real_dst, symlinks=True) - rmtree(src) - else: - copy2(src, real_dst) - os.unlink(src) - -def _destinsrc(src, dst): - src = abspath(src) - dst = abspath(dst) - if not src.endswith(os.path.sep): - src += os.path.sep - if not dst.endswith(os.path.sep): - dst += os.path.sep - return dst.startswith(src) - -def _get_gid(name): - """Returns a gid, given a group name.""" - if getgrnam is None or name is None: - return None - try: - result = getgrnam(name) - except KeyError: - result = None - if result is not None: - return result[2] - return None - -def _get_uid(name): - """Returns an uid, given a user name.""" - if getpwnam is None or name is None: - return None - try: - result = getpwnam(name) - except KeyError: - result = None - if result is not None: - return result[2] - return None - -def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, - owner=None, group=None, logger=None): - """Create a (possibly compressed) tar file from all the files under - 'base_dir'. - - 'compress' must be "gzip" (the default), "bzip2", or None. - - 'owner' and 'group' can be used to define an owner and a group for the - archive that is being built. If not provided, the current owner and group - will be used. - - The output tar file will be named 'base_name' + ".tar", possibly plus - the appropriate compression extension (".gz", or ".bz2"). - - Returns the output filename. - """ - tar_compression = {'gzip': 'gz', 'bzip2': 'bz2', None: ''} - compress_ext = {'gzip': '.gz', 'bzip2': '.bz2'} - - # flags for compression program, each element of list will be an argument - if compress is not None and compress not in compress_ext.keys(): - raise ValueError, \ - ("bad value for 'compress': must be None, 'gzip' or 'bzip2'") - - archive_name = base_name + '.tar' + compress_ext.get(compress, '') - archive_dir = os.path.dirname(archive_name) - - if archive_dir and not os.path.exists(archive_dir): - if logger is not None: - logger.info("creating %s", archive_dir) - if not dry_run: - os.makedirs(archive_dir) - - - # creating the tarball - import tarfile # late import so Python build itself doesn't break - - if logger is not None: - logger.info('Creating tar archive') - - uid = _get_uid(owner) - gid = _get_gid(group) - - def _set_uid_gid(tarinfo): - if gid is not None: - tarinfo.gid = gid - tarinfo.gname = group - if uid is not None: - tarinfo.uid = uid - tarinfo.uname = owner - return tarinfo - - if not dry_run: - tar = tarfile.open(archive_name, 'w|%s' % tar_compression[compress]) - try: - tar.add(base_dir, filter=_set_uid_gid) - finally: - tar.close() - - return archive_name - -def _call_external_zip(base_dir, zip_filename, verbose=False, dry_run=False): - # XXX see if we want to keep an external call here - if verbose: - zipoptions = "-r" - else: - zipoptions = "-rq" - from distutils.errors import DistutilsExecError - from distutils.spawn import spawn - try: - spawn(["zip", zipoptions, zip_filename, base_dir], dry_run=dry_run) - except DistutilsExecError: - # XXX really should distinguish between "couldn't find - # external 'zip' command" and "zip failed". - raise ExecError, \ - ("unable to create zip file '%s': " - "could neither import the 'zipfile' module nor " - "find a standalone zip utility") % zip_filename - -def _make_zipfile(base_name, base_dir, verbose=0, dry_run=0, logger=None): - """Create a zip file from all the files under 'base_dir'. - - The output zip file will be named 'base_name' + ".zip". Uses either the - "zipfile" Python module (if available) or the InfoZIP "zip" utility - (if installed and found on the default search path). If neither tool is - available, raises ExecError. Returns the name of the output zip - file. - """ - zip_filename = base_name + ".zip" - archive_dir = os.path.dirname(base_name) - - if archive_dir and not os.path.exists(archive_dir): - if logger is not None: - logger.info("creating %s", archive_dir) - if not dry_run: - os.makedirs(archive_dir) - - # If zipfile module is not available, try spawning an external 'zip' - # command. - try: - import zipfile - except ImportError: - zipfile = None - - if zipfile is None: - _call_external_zip(base_dir, zip_filename, verbose, dry_run) - else: - if logger is not None: - logger.info("creating '%s' and adding '%s' to it", - zip_filename, base_dir) - - if not dry_run: - with zipfile.ZipFile(zip_filename, "w", - compression=zipfile.ZIP_DEFLATED) as zf: - for dirpath, dirnames, filenames in os.walk(base_dir): - for name in filenames: - path = os.path.normpath(os.path.join(dirpath, name)) - if os.path.isfile(path): - zf.write(path, path) - if logger is not None: - logger.info("adding '%s'", path) - - return zip_filename - -_ARCHIVE_FORMATS = { - 'gztar': (_make_tarball, [('compress', 'gzip')], "gzip'ed tar-file"), - 'bztar': (_make_tarball, [('compress', 'bzip2')], "bzip2'ed tar-file"), - 'tar': (_make_tarball, [('compress', None)], "uncompressed tar file"), - 'zip': (_make_zipfile, [],"ZIP file") - } - -def get_archive_formats(): - """Returns a list of supported formats for archiving and unarchiving. - - Each element of the returned sequence is a tuple (name, description) - """ - formats = [(name, registry[2]) for name, registry in - _ARCHIVE_FORMATS.items()] - formats.sort() - return formats - -def register_archive_format(name, function, extra_args=None, description=''): - """Registers an archive format. - - name is the name of the format. function is the callable that will be - used to create archives. If provided, extra_args is a sequence of - (name, value) tuples that will be passed as arguments to the callable. - description can be provided to describe the format, and will be returned - by the get_archive_formats() function. - """ - if extra_args is None: - extra_args = [] - if not isinstance(function, collections.Callable): - raise TypeError('The %s object is not callable' % function) - if not isinstance(extra_args, (tuple, list)): - raise TypeError('extra_args needs to be a sequence') - for element in extra_args: - if not isinstance(element, (tuple, list)) or len(element) !=2 : - raise TypeError('extra_args elements are : (arg_name, value)') - - _ARCHIVE_FORMATS[name] = (function, extra_args, description) - -def unregister_archive_format(name): - del _ARCHIVE_FORMATS[name] - -def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, - dry_run=0, owner=None, group=None, logger=None): - """Create an archive file (eg. zip or tar). - - 'base_name' is the name of the file to create, minus any format-specific - extension; 'format' is the archive format: one of "zip", "tar", "bztar" - or "gztar". - - 'root_dir' is a directory that will be the root directory of the - archive; ie. we typically chdir into 'root_dir' before creating the - archive. 'base_dir' is the directory where we start archiving from; - ie. 'base_dir' will be the common prefix of all files and - directories in the archive. 'root_dir' and 'base_dir' both default - to the current directory. Returns the name of the archive file. - - 'owner' and 'group' are used when creating a tar archive. By default, - uses the current owner and group. - """ - save_cwd = os.getcwd() - if root_dir is not None: - if logger is not None: - logger.debug("changing into '%s'", root_dir) - base_name = os.path.abspath(base_name) - if not dry_run: - os.chdir(root_dir) - - if base_dir is None: - base_dir = os.curdir - - kwargs = {'dry_run': dry_run, 'logger': logger} - - try: - format_info = _ARCHIVE_FORMATS[format] - except KeyError: - raise ValueError, "unknown archive format '%s'" % format - - func = format_info[0] - for arg, val in format_info[1]: - kwargs[arg] = val - - if format != 'zip': - kwargs['owner'] = owner - kwargs['group'] = group - - try: - filename = func(base_name, base_dir, **kwargs) - finally: - if root_dir is not None: - if logger is not None: - logger.debug("changing back to '%s'", save_cwd) - os.chdir(save_cwd) - - return filename diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README b/AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README deleted file mode 100644 index 74df190..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/site-packages/README +++ /dev/null @@ -1,2 +0,0 @@ -This directory exists so that 3rd party packages can be installed -here. Read the source for site.py for more details. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py deleted file mode 100644 index 670bde1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/socket.py +++ /dev/null @@ -1,577 +0,0 @@ -# Wrapper module for _socket, providing some additional facilities -# implemented in Python. - -"""\ -This module provides socket operations and some related functions. -On Unix, it supports IP (Internet Protocol) and Unix domain sockets. -On other systems, it only supports IP. Functions specific for a -socket are available as methods of the socket object. - -Functions: - -socket() -- create a new socket object -socketpair() -- create a pair of new socket objects [*] -fromfd() -- create a socket object from an open file descriptor [*] -gethostname() -- return the current hostname -gethostbyname() -- map a hostname to its IP number -gethostbyaddr() -- map an IP number or hostname to DNS info -getservbyname() -- map a service name and a protocol name to a port number -getprotobyname() -- map a protocol name (e.g. 'tcp') to a number -ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order -htons(), htonl() -- convert 16, 32 bit int from host to network byte order -inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format -inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89) -ssl() -- secure socket layer support (only available if configured) -socket.getdefaulttimeout() -- get the default timeout value -socket.setdefaulttimeout() -- set the default timeout value -create_connection() -- connects to an address, with an optional timeout and - optional source address. - - [*] not available on all platforms! - -Special objects: - -SocketType -- type object for socket objects -error -- exception raised for I/O errors -has_ipv6 -- boolean value indicating if IPv6 is supported - -Integer constants: - -AF_INET, AF_UNIX -- socket domains (first argument to socket() call) -SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument) - -Many other constants may be defined; these may be used in calls to -the setsockopt() and getsockopt() methods. -""" - -import _socket -from _socket import * -from functools import partial -from types import MethodType - -try: - import _ssl -except ImportError: - # no SSL support - pass -else: - def ssl(sock, keyfile=None, certfile=None): - # we do an internal import here because the ssl - # module imports the socket module - import ssl as _realssl - warnings.warn("socket.ssl() is deprecated. Use ssl.wrap_socket() instead.", - DeprecationWarning, stacklevel=2) - return _realssl.sslwrap_simple(sock, keyfile, certfile) - - # we need to import the same constants we used to... - from _ssl import SSLError as sslerror - from _ssl import \ - RAND_add, \ - RAND_status, \ - SSL_ERROR_ZERO_RETURN, \ - SSL_ERROR_WANT_READ, \ - SSL_ERROR_WANT_WRITE, \ - SSL_ERROR_WANT_X509_LOOKUP, \ - SSL_ERROR_SYSCALL, \ - SSL_ERROR_SSL, \ - SSL_ERROR_WANT_CONNECT, \ - SSL_ERROR_EOF, \ - SSL_ERROR_INVALID_ERROR_CODE - try: - from _ssl import RAND_egd - except ImportError: - # LibreSSL does not provide RAND_egd - pass - -import os, sys, warnings - -try: - from cStringIO import StringIO -except ImportError: - from StringIO import StringIO - -try: - import errno -except ImportError: - errno = None -EBADF = getattr(errno, 'EBADF', 9) -EINTR = getattr(errno, 'EINTR', 4) - -__all__ = ["getfqdn", "create_connection"] -__all__.extend(os._get_exports_list(_socket)) - - -_realsocket = socket - -# WSA error codes -if sys.platform.lower().startswith("win"): - errorTab = {} - errorTab[10004] = "The operation was interrupted." - errorTab[10009] = "A bad file handle was passed." - errorTab[10013] = "Permission denied." - errorTab[10014] = "A fault occurred on the network??" # WSAEFAULT - errorTab[10022] = "An invalid operation was attempted." - errorTab[10035] = "The socket operation would block" - errorTab[10036] = "A blocking operation is already in progress." - errorTab[10048] = "The network address is in use." - errorTab[10054] = "The connection has been reset." - errorTab[10058] = "The network has been shut down." - errorTab[10060] = "The operation timed out." - errorTab[10061] = "Connection refused." - errorTab[10063] = "The name is too long." - errorTab[10064] = "The host is down." - errorTab[10065] = "The host is unreachable." - __all__.append("errorTab") - - - -def getfqdn(name=''): - """Get fully qualified domain name from name. - - An empty argument is interpreted as meaning the local host. - - First the hostname returned by gethostbyaddr() is checked, then - possibly existing aliases. In case no FQDN is available, hostname - from gethostname() is returned. - """ - name = name.strip() - if not name or name == '0.0.0.0': - name = gethostname() - try: - hostname, aliases, ipaddrs = gethostbyaddr(name) - except error: - pass - else: - aliases.insert(0, hostname) - for name in aliases: - if '.' in name: - break - else: - name = hostname - return name - - -_socketmethods = ( - 'bind', 'connect', 'connect_ex', 'fileno', 'listen', - 'getpeername', 'getsockname', 'getsockopt', 'setsockopt', - 'sendall', 'setblocking', - 'settimeout', 'gettimeout', 'shutdown') - -if os.name == "nt": - _socketmethods = _socketmethods + ('ioctl',) - -if sys.platform == "riscos": - _socketmethods = _socketmethods + ('sleeptaskw',) - -# All the method names that must be delegated to either the real socket -# object or the _closedsocket object. -_delegate_methods = ("recv", "recvfrom", "recv_into", "recvfrom_into", - "send", "sendto") - -class _closedsocket(object): - __slots__ = [] - def _dummy(*args): - raise error(EBADF, 'Bad file descriptor') - # All _delegate_methods must also be initialized here. - send = recv = recv_into = sendto = recvfrom = recvfrom_into = _dummy - __getattr__ = _dummy - -# Wrapper around platform socket objects. This implements -# a platform-independent dup() functionality. The -# implementation currently relies on reference counting -# to close the underlying socket object. -class _socketobject(object): - - __doc__ = _realsocket.__doc__ - - __slots__ = ["_sock", "__weakref__"] + list(_delegate_methods) - - def __init__(self, family=AF_INET, type=SOCK_STREAM, proto=0, _sock=None): - if _sock is None: - _sock = _realsocket(family, type, proto) - self._sock = _sock - for method in _delegate_methods: - setattr(self, method, getattr(_sock, method)) - - def close(self, _closedsocket=_closedsocket, - _delegate_methods=_delegate_methods, setattr=setattr): - # This function should not reference any globals. See issue #808164. - self._sock = _closedsocket() - dummy = self._sock._dummy - for method in _delegate_methods: - setattr(self, method, dummy) - close.__doc__ = _realsocket.close.__doc__ - - def accept(self): - sock, addr = self._sock.accept() - return _socketobject(_sock=sock), addr - accept.__doc__ = _realsocket.accept.__doc__ - - def dup(self): - """dup() -> socket object - - Return a new socket object connected to the same system resource.""" - return _socketobject(_sock=self._sock) - - def makefile(self, mode='r', bufsize=-1): - """makefile([mode[, bufsize]]) -> file object - - Return a regular file object corresponding to the socket. The mode - and bufsize arguments are as for the built-in open() function.""" - return _fileobject(self._sock, mode, bufsize) - - family = property(lambda self: self._sock.family, doc="the socket family") - type = property(lambda self: self._sock.type, doc="the socket type") - proto = property(lambda self: self._sock.proto, doc="the socket protocol") - -def meth(name,self,*args): - return getattr(self._sock,name)(*args) - -for _m in _socketmethods: - p = partial(meth,_m) - p.__name__ = _m - p.__doc__ = getattr(_realsocket,_m).__doc__ - m = MethodType(p,None,_socketobject) - setattr(_socketobject,_m,m) - -socket = SocketType = _socketobject - -class _fileobject(object): - """Faux file object attached to a socket object.""" - - default_bufsize = 8192 - name = "" - - __slots__ = ["mode", "bufsize", "softspace", - # "closed" is a property, see below - "_sock", "_rbufsize", "_wbufsize", "_rbuf", "_wbuf", "_wbuf_len", - "_close"] - - def __init__(self, sock, mode='rb', bufsize=-1, close=False): - self._sock = sock - self.mode = mode # Not actually used in this version - if bufsize < 0: - bufsize = self.default_bufsize - self.bufsize = bufsize - self.softspace = False - # _rbufsize is the suggested recv buffer size. It is *strictly* - # obeyed within readline() for recv calls. If it is larger than - # default_bufsize it will be used for recv calls within read(). - if bufsize == 0: - self._rbufsize = 1 - elif bufsize == 1: - self._rbufsize = self.default_bufsize - else: - self._rbufsize = bufsize - self._wbufsize = bufsize - # We use StringIO for the read buffer to avoid holding a list - # of variously sized string objects which have been known to - # fragment the heap due to how they are malloc()ed and often - # realloc()ed down much smaller than their original allocation. - self._rbuf = StringIO() - self._wbuf = [] # A list of strings - self._wbuf_len = 0 - self._close = close - - def _getclosed(self): - return self._sock is None - closed = property(_getclosed, doc="True if the file is closed") - - def close(self): - try: - if self._sock: - self.flush() - finally: - if self._close: - self._sock.close() - self._sock = None - - def __del__(self): - try: - self.close() - except: - # close() may fail if __init__ didn't complete - pass - - def flush(self): - if self._wbuf: - data = "".join(self._wbuf) - self._wbuf = [] - self._wbuf_len = 0 - buffer_size = max(self._rbufsize, self.default_bufsize) - data_size = len(data) - write_offset = 0 - view = memoryview(data) - try: - while write_offset < data_size: - self._sock.sendall(view[write_offset:write_offset+buffer_size]) - write_offset += buffer_size - finally: - if write_offset < data_size: - remainder = data[write_offset:] - del view, data # explicit free - self._wbuf.append(remainder) - self._wbuf_len = len(remainder) - - def fileno(self): - return self._sock.fileno() - - def write(self, data): - data = str(data) # XXX Should really reject non-string non-buffers - if not data: - return - self._wbuf.append(data) - self._wbuf_len += len(data) - if (self._wbufsize == 0 or - (self._wbufsize == 1 and '\n' in data) or - (self._wbufsize > 1 and self._wbuf_len >= self._wbufsize)): - self.flush() - - def writelines(self, list): - # XXX We could do better here for very long lists - # XXX Should really reject non-string non-buffers - lines = filter(None, map(str, list)) - self._wbuf_len += sum(map(len, lines)) - self._wbuf.extend(lines) - if (self._wbufsize <= 1 or - self._wbuf_len >= self._wbufsize): - self.flush() - - def read(self, size=-1): - # Use max, disallow tiny reads in a loop as they are very inefficient. - # We never leave read() with any leftover data from a new recv() call - # in our internal buffer. - rbufsize = max(self._rbufsize, self.default_bufsize) - # Our use of StringIO rather than lists of string objects returned by - # recv() minimizes memory usage and fragmentation that occurs when - # rbufsize is large compared to the typical return value of recv(). - buf = self._rbuf - buf.seek(0, 2) # seek end - if size < 0: - # Read until EOF - self._rbuf = StringIO() # reset _rbuf. we consume it via buf. - while True: - try: - data = self._sock.recv(rbufsize) - except error, e: - if e.args[0] == EINTR: - continue - raise - if not data: - break - buf.write(data) - return buf.getvalue() - else: - # Read until size bytes or EOF seen, whichever comes first - buf_len = buf.tell() - if buf_len >= size: - # Already have size bytes in our buffer? Extract and return. - buf.seek(0) - rv = buf.read(size) - self._rbuf = StringIO() - self._rbuf.write(buf.read()) - return rv - - self._rbuf = StringIO() # reset _rbuf. we consume it via buf. - while True: - left = size - buf_len - # recv() will malloc the amount of memory given as its - # parameter even though it often returns much less data - # than that. The returned data string is short lived - # as we copy it into a StringIO and free it. This avoids - # fragmentation issues on many platforms. - try: - data = self._sock.recv(left) - except error, e: - if e.args[0] == EINTR: - continue - raise - if not data: - break - n = len(data) - if n == size and not buf_len: - # Shortcut. Avoid buffer data copies when: - # - We have no data in our buffer. - # AND - # - Our call to recv returned exactly the - # number of bytes we were asked to read. - return data - if n == left: - buf.write(data) - del data # explicit free - break - assert n <= left, "recv(%d) returned %d bytes" % (left, n) - buf.write(data) - buf_len += n - del data # explicit free - #assert buf_len == buf.tell() - return buf.getvalue() - - def readline(self, size=-1): - buf = self._rbuf - buf.seek(0, 2) # seek end - if buf.tell() > 0: - # check if we already have it in our buffer - buf.seek(0) - bline = buf.readline(size) - if bline.endswith('\n') or len(bline) == size: - self._rbuf = StringIO() - self._rbuf.write(buf.read()) - return bline - del bline - if size < 0: - # Read until \n or EOF, whichever comes first - if self._rbufsize <= 1: - # Speed up unbuffered case - buf.seek(0) - buffers = [buf.read()] - self._rbuf = StringIO() # reset _rbuf. we consume it via buf. - data = None - recv = self._sock.recv - while True: - try: - while data != "\n": - data = recv(1) - if not data: - break - buffers.append(data) - except error, e: - # The try..except to catch EINTR was moved outside the - # recv loop to avoid the per byte overhead. - if e.args[0] == EINTR: - continue - raise - break - return "".join(buffers) - - buf.seek(0, 2) # seek end - self._rbuf = StringIO() # reset _rbuf. we consume it via buf. - while True: - try: - data = self._sock.recv(self._rbufsize) - except error, e: - if e.args[0] == EINTR: - continue - raise - if not data: - break - nl = data.find('\n') - if nl >= 0: - nl += 1 - buf.write(data[:nl]) - self._rbuf.write(data[nl:]) - del data - break - buf.write(data) - return buf.getvalue() - else: - # Read until size bytes or \n or EOF seen, whichever comes first - buf.seek(0, 2) # seek end - buf_len = buf.tell() - if buf_len >= size: - buf.seek(0) - rv = buf.read(size) - self._rbuf = StringIO() - self._rbuf.write(buf.read()) - return rv - self._rbuf = StringIO() # reset _rbuf. we consume it via buf. - while True: - try: - data = self._sock.recv(self._rbufsize) - except error, e: - if e.args[0] == EINTR: - continue - raise - if not data: - break - left = size - buf_len - # did we just receive a newline? - nl = data.find('\n', 0, left) - if nl >= 0: - nl += 1 - # save the excess data to _rbuf - self._rbuf.write(data[nl:]) - if buf_len: - buf.write(data[:nl]) - break - else: - # Shortcut. Avoid data copy through buf when returning - # a substring of our first recv(). - return data[:nl] - n = len(data) - if n == size and not buf_len: - # Shortcut. Avoid data copy through buf when - # returning exactly all of our first recv(). - return data - if n >= left: - buf.write(data[:left]) - self._rbuf.write(data[left:]) - break - buf.write(data) - buf_len += n - #assert buf_len == buf.tell() - return buf.getvalue() - - def readlines(self, sizehint=0): - total = 0 - list = [] - while True: - line = self.readline() - if not line: - break - list.append(line) - total += len(line) - if sizehint and total >= sizehint: - break - return list - - # Iterator protocols - - def __iter__(self): - return self - - def next(self): - line = self.readline() - if not line: - raise StopIteration - return line - -_GLOBAL_DEFAULT_TIMEOUT = object() - -def create_connection(address, timeout=_GLOBAL_DEFAULT_TIMEOUT, - source_address=None): - """Connect to *address* and return the socket object. - - Convenience function. Connect to *address* (a 2-tuple ``(host, - port)``) and return the socket object. Passing the optional - *timeout* parameter will set the timeout on the socket instance - before attempting to connect. If no *timeout* is supplied, the - global default timeout setting returned by :func:`getdefaulttimeout` - is used. If *source_address* is set it must be a tuple of (host, port) - for the socket to bind as a source address before making the connection. - An host of '' or port 0 tells the OS to use the default. - """ - - host, port = address - err = None - for res in getaddrinfo(host, port, 0, SOCK_STREAM): - af, socktype, proto, canonname, sa = res - sock = None - try: - sock = socket(af, socktype, proto) - if timeout is not _GLOBAL_DEFAULT_TIMEOUT: - sock.settimeout(timeout) - if source_address: - sock.bind(source_address) - sock.connect(sa) - return sock - - except error as _: - err = _ - if sock is not None: - sock.close() - - if err is not None: - raise err - else: - raise error("getaddrinfo returns an empty list") diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py deleted file mode 100644 index 6d376ad..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre.py +++ /dev/null @@ -1,13 +0,0 @@ -"""This file is only retained for backwards compatibility. -It will be removed in the future. sre was moved to re in version 2.5. -""" - -import warnings -warnings.warn("The sre module is deprecated, please import re.", - DeprecationWarning, 2) - -from re import * -from re import __all__ - -# old pickles expect the _compile() reconstructor in this module -from re import _compile diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py deleted file mode 100644 index 6a74d04..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_compile.py +++ /dev/null @@ -1,596 +0,0 @@ -# -*- coding: utf-8 -*- -# -# Secret Labs' Regular Expression Engine -# -# convert template to internal format -# -# Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. -# -# See the sre.py file for information on usage and redistribution. -# - -"""Internal support module for sre""" - -import _sre, sys -import sre_parse -from sre_constants import * - -assert _sre.MAGIC == MAGIC, "SRE module mismatch" - -if _sre.CODESIZE == 2: - MAXCODE = 65535 -else: - MAXCODE = 0xFFFFFFFFL - -_LITERAL_CODES = set([LITERAL, NOT_LITERAL]) -_REPEATING_CODES = set([REPEAT, MIN_REPEAT, MAX_REPEAT]) -_SUCCESS_CODES = set([SUCCESS, FAILURE]) -_ASSERT_CODES = set([ASSERT, ASSERT_NOT]) - -# Sets of lowercase characters which have the same uppercase. -_equivalences = ( - # LATIN SMALL LETTER I, LATIN SMALL LETTER DOTLESS I - (0x69, 0x131), # iı - # LATIN SMALL LETTER S, LATIN SMALL LETTER LONG S - (0x73, 0x17f), # sÅ¿ - # MICRO SIGN, GREEK SMALL LETTER MU - (0xb5, 0x3bc), # µμ - # COMBINING GREEK YPOGEGRAMMENI, GREEK SMALL LETTER IOTA, GREEK PROSGEGRAMMENI - (0x345, 0x3b9, 0x1fbe), # \u0345ιι - # GREEK SMALL LETTER BETA, GREEK BETA SYMBOL - (0x3b2, 0x3d0), # Î²Ï - # GREEK SMALL LETTER EPSILON, GREEK LUNATE EPSILON SYMBOL - (0x3b5, 0x3f5), # εϵ - # GREEK SMALL LETTER THETA, GREEK THETA SYMBOL - (0x3b8, 0x3d1), # θϑ - # GREEK SMALL LETTER KAPPA, GREEK KAPPA SYMBOL - (0x3ba, 0x3f0), # κϰ - # GREEK SMALL LETTER PI, GREEK PI SYMBOL - (0x3c0, 0x3d6), # πϖ - # GREEK SMALL LETTER RHO, GREEK RHO SYMBOL - (0x3c1, 0x3f1), # Ïϱ - # GREEK SMALL LETTER FINAL SIGMA, GREEK SMALL LETTER SIGMA - (0x3c2, 0x3c3), # ςσ - # GREEK SMALL LETTER PHI, GREEK PHI SYMBOL - (0x3c6, 0x3d5), # φϕ - # LATIN SMALL LETTER S WITH DOT ABOVE, LATIN SMALL LETTER LONG S WITH DOT ABOVE - (0x1e61, 0x1e9b), # ṡẛ -) - -# Maps the lowercase code to lowercase codes which have the same uppercase. -_ignorecase_fixes = {i: tuple(j for j in t if i != j) - for t in _equivalences for i in t} - -def _compile(code, pattern, flags): - # internal: compile a (sub)pattern - emit = code.append - _len = len - LITERAL_CODES = _LITERAL_CODES - REPEATING_CODES = _REPEATING_CODES - SUCCESS_CODES = _SUCCESS_CODES - ASSERT_CODES = _ASSERT_CODES - if (flags & SRE_FLAG_IGNORECASE and - not (flags & SRE_FLAG_LOCALE) and - flags & SRE_FLAG_UNICODE): - fixes = _ignorecase_fixes - else: - fixes = None - for op, av in pattern: - if op in LITERAL_CODES: - if flags & SRE_FLAG_IGNORECASE: - lo = _sre.getlower(av, flags) - if fixes and lo in fixes: - emit(OPCODES[IN_IGNORE]) - skip = _len(code); emit(0) - if op is NOT_LITERAL: - emit(OPCODES[NEGATE]) - for k in (lo,) + fixes[lo]: - emit(OPCODES[LITERAL]) - emit(k) - emit(OPCODES[FAILURE]) - code[skip] = _len(code) - skip - else: - emit(OPCODES[OP_IGNORE[op]]) - emit(lo) - else: - emit(OPCODES[op]) - emit(av) - elif op is IN: - if flags & SRE_FLAG_IGNORECASE: - emit(OPCODES[OP_IGNORE[op]]) - def fixup(literal, flags=flags): - return _sre.getlower(literal, flags) - else: - emit(OPCODES[op]) - fixup = None - skip = _len(code); emit(0) - _compile_charset(av, flags, code, fixup, fixes) - code[skip] = _len(code) - skip - elif op is ANY: - if flags & SRE_FLAG_DOTALL: - emit(OPCODES[ANY_ALL]) - else: - emit(OPCODES[ANY]) - elif op in REPEATING_CODES: - if flags & SRE_FLAG_TEMPLATE: - raise error, "internal: unsupported template operator" - emit(OPCODES[REPEAT]) - skip = _len(code); emit(0) - emit(av[0]) - emit(av[1]) - _compile(code, av[2], flags) - emit(OPCODES[SUCCESS]) - code[skip] = _len(code) - skip - elif _simple(av) and op is not REPEAT: - if op is MAX_REPEAT: - emit(OPCODES[REPEAT_ONE]) - else: - emit(OPCODES[MIN_REPEAT_ONE]) - skip = _len(code); emit(0) - emit(av[0]) - emit(av[1]) - _compile(code, av[2], flags) - emit(OPCODES[SUCCESS]) - code[skip] = _len(code) - skip - else: - emit(OPCODES[REPEAT]) - skip = _len(code); emit(0) - emit(av[0]) - emit(av[1]) - _compile(code, av[2], flags) - code[skip] = _len(code) - skip - if op is MAX_REPEAT: - emit(OPCODES[MAX_UNTIL]) - else: - emit(OPCODES[MIN_UNTIL]) - elif op is SUBPATTERN: - if av[0]: - emit(OPCODES[MARK]) - emit((av[0]-1)*2) - # _compile_info(code, av[1], flags) - _compile(code, av[1], flags) - if av[0]: - emit(OPCODES[MARK]) - emit((av[0]-1)*2+1) - elif op in SUCCESS_CODES: - emit(OPCODES[op]) - elif op in ASSERT_CODES: - emit(OPCODES[op]) - skip = _len(code); emit(0) - if av[0] >= 0: - emit(0) # look ahead - else: - lo, hi = av[1].getwidth() - if lo != hi: - raise error, "look-behind requires fixed-width pattern" - emit(lo) # look behind - _compile(code, av[1], flags) - emit(OPCODES[SUCCESS]) - code[skip] = _len(code) - skip - elif op is CALL: - emit(OPCODES[op]) - skip = _len(code); emit(0) - _compile(code, av, flags) - emit(OPCODES[SUCCESS]) - code[skip] = _len(code) - skip - elif op is AT: - emit(OPCODES[op]) - if flags & SRE_FLAG_MULTILINE: - av = AT_MULTILINE.get(av, av) - if flags & SRE_FLAG_LOCALE: - av = AT_LOCALE.get(av, av) - elif flags & SRE_FLAG_UNICODE: - av = AT_UNICODE.get(av, av) - emit(ATCODES[av]) - elif op is BRANCH: - emit(OPCODES[op]) - tail = [] - tailappend = tail.append - for av in av[1]: - skip = _len(code); emit(0) - # _compile_info(code, av, flags) - _compile(code, av, flags) - emit(OPCODES[JUMP]) - tailappend(_len(code)); emit(0) - code[skip] = _len(code) - skip - emit(0) # end of branch - for tail in tail: - code[tail] = _len(code) - tail - elif op is CATEGORY: - emit(OPCODES[op]) - if flags & SRE_FLAG_LOCALE: - av = CH_LOCALE[av] - elif flags & SRE_FLAG_UNICODE: - av = CH_UNICODE[av] - emit(CHCODES[av]) - elif op is GROUPREF: - if flags & SRE_FLAG_IGNORECASE: - emit(OPCODES[OP_IGNORE[op]]) - else: - emit(OPCODES[op]) - emit(av-1) - elif op is GROUPREF_EXISTS: - emit(OPCODES[op]) - emit(av[0]-1) - skipyes = _len(code); emit(0) - _compile(code, av[1], flags) - if av[2]: - emit(OPCODES[JUMP]) - skipno = _len(code); emit(0) - code[skipyes] = _len(code) - skipyes + 1 - _compile(code, av[2], flags) - code[skipno] = _len(code) - skipno - else: - code[skipyes] = _len(code) - skipyes + 1 - else: - raise ValueError, ("unsupported operand type", op) - -def _compile_charset(charset, flags, code, fixup=None, fixes=None): - # compile charset subprogram - emit = code.append - for op, av in _optimize_charset(charset, fixup, fixes, - flags & SRE_FLAG_UNICODE): - emit(OPCODES[op]) - if op is NEGATE: - pass - elif op is LITERAL: - emit(av) - elif op is RANGE: - emit(av[0]) - emit(av[1]) - elif op is CHARSET: - code.extend(av) - elif op is BIGCHARSET: - code.extend(av) - elif op is CATEGORY: - if flags & SRE_FLAG_LOCALE: - emit(CHCODES[CH_LOCALE[av]]) - elif flags & SRE_FLAG_UNICODE: - emit(CHCODES[CH_UNICODE[av]]) - else: - emit(CHCODES[av]) - else: - raise error, "internal: unsupported set operator" - emit(OPCODES[FAILURE]) - -def _optimize_charset(charset, fixup, fixes, isunicode): - # internal: optimize character set - out = [] - tail = [] - charmap = bytearray(256) - for op, av in charset: - while True: - try: - if op is LITERAL: - if fixup: - i = fixup(av) - charmap[i] = 1 - if fixes and i in fixes: - for k in fixes[i]: - charmap[k] = 1 - else: - charmap[av] = 1 - elif op is RANGE: - r = range(av[0], av[1]+1) - if fixup: - r = map(fixup, r) - if fixup and fixes: - for i in r: - charmap[i] = 1 - if i in fixes: - for k in fixes[i]: - charmap[k] = 1 - else: - for i in r: - charmap[i] = 1 - elif op is NEGATE: - out.append((op, av)) - else: - tail.append((op, av)) - except IndexError: - if len(charmap) == 256: - # character set contains non-UCS1 character codes - charmap += b'\0' * 0xff00 - continue - # character set contains non-BMP character codes - if fixup and isunicode and op is RANGE: - lo, hi = av - ranges = [av] - # There are only two ranges of cased astral characters: - # 10400-1044F (Deseret) and 118A0-118DF (Warang Citi). - _fixup_range(max(0x10000, lo), min(0x11fff, hi), - ranges, fixup) - for lo, hi in ranges: - if lo == hi: - tail.append((LITERAL, hi)) - else: - tail.append((RANGE, (lo, hi))) - else: - tail.append((op, av)) - break - - # compress character map - runs = [] - q = 0 - while True: - p = charmap.find(b'\1', q) - if p < 0: - break - if len(runs) >= 2: - runs = None - break - q = charmap.find(b'\0', p) - if q < 0: - runs.append((p, len(charmap))) - break - runs.append((p, q)) - if runs is not None: - # use literal/range - for p, q in runs: - if q - p == 1: - out.append((LITERAL, p)) - else: - out.append((RANGE, (p, q - 1))) - out += tail - # if the case was changed or new representation is more compact - if fixup or len(out) < len(charset): - return out - # else original character set is good enough - return charset - - # use bitmap - if len(charmap) == 256: - data = _mk_bitmap(charmap) - out.append((CHARSET, data)) - out += tail - return out - - # To represent a big charset, first a bitmap of all characters in the - # set is constructed. Then, this bitmap is sliced into chunks of 256 - # characters, duplicate chunks are eliminated, and each chunk is - # given a number. In the compiled expression, the charset is - # represented by a 32-bit word sequence, consisting of one word for - # the number of different chunks, a sequence of 256 bytes (64 words) - # of chunk numbers indexed by their original chunk position, and a - # sequence of 256-bit chunks (8 words each). - - # Compression is normally good: in a typical charset, large ranges of - # Unicode will be either completely excluded (e.g. if only cyrillic - # letters are to be matched), or completely included (e.g. if large - # subranges of Kanji match). These ranges will be represented by - # chunks of all one-bits or all zero-bits. - - # Matching can be also done efficiently: the more significant byte of - # the Unicode character is an index into the chunk number, and the - # less significant byte is a bit index in the chunk (just like the - # CHARSET matching). - - # In UCS-4 mode, the BIGCHARSET opcode still supports only subsets - # of the basic multilingual plane; an efficient representation - # for all of Unicode has not yet been developed. - - charmap = bytes(charmap) # should be hashable - comps = {} - mapping = bytearray(256) - block = 0 - data = bytearray() - for i in range(0, 65536, 256): - chunk = charmap[i: i + 256] - if chunk in comps: - mapping[i // 256] = comps[chunk] - else: - mapping[i // 256] = comps[chunk] = block - block += 1 - data += chunk - data = _mk_bitmap(data) - data[0:0] = [block] + _bytes_to_codes(mapping) - out.append((BIGCHARSET, data)) - out += tail - return out - -def _fixup_range(lo, hi, ranges, fixup): - for i in map(fixup, range(lo, hi+1)): - for k, (lo, hi) in enumerate(ranges): - if i < lo: - if l == lo - 1: - ranges[k] = (i, hi) - else: - ranges.insert(k, (i, i)) - break - elif i > hi: - if i == hi + 1: - ranges[k] = (lo, i) - break - else: - break - else: - ranges.append((i, i)) - -_CODEBITS = _sre.CODESIZE * 8 -_BITS_TRANS = b'0' + b'1' * 255 -def _mk_bitmap(bits, _CODEBITS=_CODEBITS, _int=int): - s = bytes(bits).translate(_BITS_TRANS)[::-1] - return [_int(s[i - _CODEBITS: i], 2) - for i in range(len(s), 0, -_CODEBITS)] - -def _bytes_to_codes(b): - # Convert block indices to word array - import array - if _sre.CODESIZE == 2: - code = 'H' - else: - code = 'I' - a = array.array(code, bytes(b)) - assert a.itemsize == _sre.CODESIZE - assert len(a) * a.itemsize == len(b) - return a.tolist() - -def _simple(av): - # check if av is a "simple" operator - lo, hi = av[2].getwidth() - return lo == hi == 1 and av[2][0][0] != SUBPATTERN - -def _compile_info(code, pattern, flags): - # internal: compile an info block. in the current version, - # this contains min/max pattern width, and an optional literal - # prefix or a character map - lo, hi = pattern.getwidth() - if lo == 0: - return # not worth it - # look for a literal prefix - prefix = [] - prefixappend = prefix.append - prefix_skip = 0 - charset = [] # not used - charsetappend = charset.append - if not (flags & SRE_FLAG_IGNORECASE): - # look for literal prefix - for op, av in pattern.data: - if op is LITERAL: - if len(prefix) == prefix_skip: - prefix_skip = prefix_skip + 1 - prefixappend(av) - elif op is SUBPATTERN and len(av[1]) == 1: - op, av = av[1][0] - if op is LITERAL: - prefixappend(av) - else: - break - else: - break - # if no prefix, look for charset prefix - if not prefix and pattern.data: - op, av = pattern.data[0] - if op is SUBPATTERN and av[1]: - op, av = av[1][0] - if op is LITERAL: - charsetappend((op, av)) - elif op is BRANCH: - c = [] - cappend = c.append - for p in av[1]: - if not p: - break - op, av = p[0] - if op is LITERAL: - cappend((op, av)) - else: - break - else: - charset = c - elif op is BRANCH: - c = [] - cappend = c.append - for p in av[1]: - if not p: - break - op, av = p[0] - if op is LITERAL: - cappend((op, av)) - else: - break - else: - charset = c - elif op is IN: - charset = av -## if prefix: -## print "*** PREFIX", prefix, prefix_skip -## if charset: -## print "*** CHARSET", charset - # add an info block - emit = code.append - emit(OPCODES[INFO]) - skip = len(code); emit(0) - # literal flag - mask = 0 - if prefix: - mask = SRE_INFO_PREFIX - if len(prefix) == prefix_skip == len(pattern.data): - mask = mask + SRE_INFO_LITERAL - elif charset: - mask = mask + SRE_INFO_CHARSET - emit(mask) - # pattern length - if lo < MAXCODE: - emit(lo) - else: - emit(MAXCODE) - prefix = prefix[:MAXCODE] - if hi < MAXCODE: - emit(hi) - else: - emit(0) - # add literal prefix - if prefix: - emit(len(prefix)) # length - emit(prefix_skip) # skip - code.extend(prefix) - # generate overlap table - table = [-1] + ([0]*len(prefix)) - for i in xrange(len(prefix)): - table[i+1] = table[i]+1 - while table[i+1] > 0 and prefix[i] != prefix[table[i+1]-1]: - table[i+1] = table[table[i+1]-1]+1 - code.extend(table[1:]) # don't store first entry - elif charset: - _compile_charset(charset, flags, code) - code[skip] = len(code) - skip - -try: - unicode -except NameError: - STRING_TYPES = (type(""),) -else: - STRING_TYPES = (type(""), type(unicode(""))) - -def isstring(obj): - for tp in STRING_TYPES: - if isinstance(obj, tp): - return 1 - return 0 - -def _code(p, flags): - - flags = p.pattern.flags | flags - code = [] - - # compile info block - _compile_info(code, p, flags) - - # compile the pattern - _compile(code, p.data, flags) - - code.append(OPCODES[SUCCESS]) - - return code - -def compile(p, flags=0): - # internal: convert pattern list to internal format - - if isstring(p): - pattern = p - p = sre_parse.parse(p, flags) - else: - pattern = None - - code = _code(p, flags) - - # print code - - # XXX: get rid of this limitation! - if p.pattern.groups > 100: - raise AssertionError( - "sorry, but this version only supports 100 named groups" - ) - - # map in either direction - groupindex = p.pattern.groupdict - indexgroup = [None] * p.pattern.groups - for k, i in groupindex.items(): - indexgroup[i] = k - - return _sre.compile( - pattern, flags | p.pattern.flags, code, - p.pattern.groups-1, - groupindex, indexgroup - ) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py deleted file mode 100644 index cabbda4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_constants.py +++ /dev/null @@ -1,263 +0,0 @@ -# -# Secret Labs' Regular Expression Engine -# -# various symbols used by the regular expression engine. -# run this script to update the _sre include files! -# -# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. -# -# See the sre.py file for information on usage and redistribution. -# - -"""Internal support module for sre""" - -# update when constants are added or removed - -MAGIC = 20031017 - -try: - from _sre import MAXREPEAT -except ImportError: - import _sre - MAXREPEAT = _sre.MAXREPEAT = 65535 - -# SRE standard exception (access as sre.error) -# should this really be here? - -class error(Exception): - pass - -# operators - -FAILURE = "failure" -SUCCESS = "success" - -ANY = "any" -ANY_ALL = "any_all" -ASSERT = "assert" -ASSERT_NOT = "assert_not" -AT = "at" -BIGCHARSET = "bigcharset" -BRANCH = "branch" -CALL = "call" -CATEGORY = "category" -CHARSET = "charset" -GROUPREF = "groupref" -GROUPREF_IGNORE = "groupref_ignore" -GROUPREF_EXISTS = "groupref_exists" -IN = "in" -IN_IGNORE = "in_ignore" -INFO = "info" -JUMP = "jump" -LITERAL = "literal" -LITERAL_IGNORE = "literal_ignore" -MARK = "mark" -MAX_REPEAT = "max_repeat" -MAX_UNTIL = "max_until" -MIN_REPEAT = "min_repeat" -MIN_UNTIL = "min_until" -NEGATE = "negate" -NOT_LITERAL = "not_literal" -NOT_LITERAL_IGNORE = "not_literal_ignore" -RANGE = "range" -REPEAT = "repeat" -REPEAT_ONE = "repeat_one" -SUBPATTERN = "subpattern" -MIN_REPEAT_ONE = "min_repeat_one" - -# positions -AT_BEGINNING = "at_beginning" -AT_BEGINNING_LINE = "at_beginning_line" -AT_BEGINNING_STRING = "at_beginning_string" -AT_BOUNDARY = "at_boundary" -AT_NON_BOUNDARY = "at_non_boundary" -AT_END = "at_end" -AT_END_LINE = "at_end_line" -AT_END_STRING = "at_end_string" -AT_LOC_BOUNDARY = "at_loc_boundary" -AT_LOC_NON_BOUNDARY = "at_loc_non_boundary" -AT_UNI_BOUNDARY = "at_uni_boundary" -AT_UNI_NON_BOUNDARY = "at_uni_non_boundary" - -# categories -CATEGORY_DIGIT = "category_digit" -CATEGORY_NOT_DIGIT = "category_not_digit" -CATEGORY_SPACE = "category_space" -CATEGORY_NOT_SPACE = "category_not_space" -CATEGORY_WORD = "category_word" -CATEGORY_NOT_WORD = "category_not_word" -CATEGORY_LINEBREAK = "category_linebreak" -CATEGORY_NOT_LINEBREAK = "category_not_linebreak" -CATEGORY_LOC_WORD = "category_loc_word" -CATEGORY_LOC_NOT_WORD = "category_loc_not_word" -CATEGORY_UNI_DIGIT = "category_uni_digit" -CATEGORY_UNI_NOT_DIGIT = "category_uni_not_digit" -CATEGORY_UNI_SPACE = "category_uni_space" -CATEGORY_UNI_NOT_SPACE = "category_uni_not_space" -CATEGORY_UNI_WORD = "category_uni_word" -CATEGORY_UNI_NOT_WORD = "category_uni_not_word" -CATEGORY_UNI_LINEBREAK = "category_uni_linebreak" -CATEGORY_UNI_NOT_LINEBREAK = "category_uni_not_linebreak" - -OPCODES = [ - - # failure=0 success=1 (just because it looks better that way :-) - FAILURE, SUCCESS, - - ANY, ANY_ALL, - ASSERT, ASSERT_NOT, - AT, - BRANCH, - CALL, - CATEGORY, - CHARSET, BIGCHARSET, - GROUPREF, GROUPREF_EXISTS, GROUPREF_IGNORE, - IN, IN_IGNORE, - INFO, - JUMP, - LITERAL, LITERAL_IGNORE, - MARK, - MAX_UNTIL, - MIN_UNTIL, - NOT_LITERAL, NOT_LITERAL_IGNORE, - NEGATE, - RANGE, - REPEAT, - REPEAT_ONE, - SUBPATTERN, - MIN_REPEAT_ONE - -] - -ATCODES = [ - AT_BEGINNING, AT_BEGINNING_LINE, AT_BEGINNING_STRING, AT_BOUNDARY, - AT_NON_BOUNDARY, AT_END, AT_END_LINE, AT_END_STRING, - AT_LOC_BOUNDARY, AT_LOC_NON_BOUNDARY, AT_UNI_BOUNDARY, - AT_UNI_NON_BOUNDARY -] - -CHCODES = [ - CATEGORY_DIGIT, CATEGORY_NOT_DIGIT, CATEGORY_SPACE, - CATEGORY_NOT_SPACE, CATEGORY_WORD, CATEGORY_NOT_WORD, - CATEGORY_LINEBREAK, CATEGORY_NOT_LINEBREAK, CATEGORY_LOC_WORD, - CATEGORY_LOC_NOT_WORD, CATEGORY_UNI_DIGIT, CATEGORY_UNI_NOT_DIGIT, - CATEGORY_UNI_SPACE, CATEGORY_UNI_NOT_SPACE, CATEGORY_UNI_WORD, - CATEGORY_UNI_NOT_WORD, CATEGORY_UNI_LINEBREAK, - CATEGORY_UNI_NOT_LINEBREAK -] - -def makedict(list): - d = {} - i = 0 - for item in list: - d[item] = i - i = i + 1 - return d - -OPCODES = makedict(OPCODES) -ATCODES = makedict(ATCODES) -CHCODES = makedict(CHCODES) - -# replacement operations for "ignore case" mode -OP_IGNORE = { - GROUPREF: GROUPREF_IGNORE, - IN: IN_IGNORE, - LITERAL: LITERAL_IGNORE, - NOT_LITERAL: NOT_LITERAL_IGNORE -} - -AT_MULTILINE = { - AT_BEGINNING: AT_BEGINNING_LINE, - AT_END: AT_END_LINE -} - -AT_LOCALE = { - AT_BOUNDARY: AT_LOC_BOUNDARY, - AT_NON_BOUNDARY: AT_LOC_NON_BOUNDARY -} - -AT_UNICODE = { - AT_BOUNDARY: AT_UNI_BOUNDARY, - AT_NON_BOUNDARY: AT_UNI_NON_BOUNDARY -} - -CH_LOCALE = { - CATEGORY_DIGIT: CATEGORY_DIGIT, - CATEGORY_NOT_DIGIT: CATEGORY_NOT_DIGIT, - CATEGORY_SPACE: CATEGORY_SPACE, - CATEGORY_NOT_SPACE: CATEGORY_NOT_SPACE, - CATEGORY_WORD: CATEGORY_LOC_WORD, - CATEGORY_NOT_WORD: CATEGORY_LOC_NOT_WORD, - CATEGORY_LINEBREAK: CATEGORY_LINEBREAK, - CATEGORY_NOT_LINEBREAK: CATEGORY_NOT_LINEBREAK -} - -CH_UNICODE = { - CATEGORY_DIGIT: CATEGORY_UNI_DIGIT, - CATEGORY_NOT_DIGIT: CATEGORY_UNI_NOT_DIGIT, - CATEGORY_SPACE: CATEGORY_UNI_SPACE, - CATEGORY_NOT_SPACE: CATEGORY_UNI_NOT_SPACE, - CATEGORY_WORD: CATEGORY_UNI_WORD, - CATEGORY_NOT_WORD: CATEGORY_UNI_NOT_WORD, - CATEGORY_LINEBREAK: CATEGORY_UNI_LINEBREAK, - CATEGORY_NOT_LINEBREAK: CATEGORY_UNI_NOT_LINEBREAK -} - -# flags -SRE_FLAG_TEMPLATE = 1 # template mode (disable backtracking) -SRE_FLAG_IGNORECASE = 2 # case insensitive -SRE_FLAG_LOCALE = 4 # honour system locale -SRE_FLAG_MULTILINE = 8 # treat target as multiline string -SRE_FLAG_DOTALL = 16 # treat target as a single string -SRE_FLAG_UNICODE = 32 # use unicode locale -SRE_FLAG_VERBOSE = 64 # ignore whitespace and comments -SRE_FLAG_DEBUG = 128 # debugging - -# flags for INFO primitive -SRE_INFO_PREFIX = 1 # has prefix -SRE_INFO_LITERAL = 2 # entire pattern is literal (given by prefix) -SRE_INFO_CHARSET = 4 # pattern starts with character from given set - -if __name__ == "__main__": - def dump(f, d, prefix): - items = d.items() - items.sort(key=lambda a: a[1]) - for k, v in items: - f.write("#define %s_%s %s\n" % (prefix, k.upper(), v)) - f = open("sre_constants.h", "w") - f.write("""\ -/* - * Secret Labs' Regular Expression Engine - * - * regular expression matching engine - * - * NOTE: This file is generated by sre_constants.py. If you need - * to change anything in here, edit sre_constants.py and run it. - * - * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. - * - * See the _sre.c file for information on usage and redistribution. - */ - -""") - - f.write("#define SRE_MAGIC %d\n" % MAGIC) - - dump(f, OPCODES, "SRE_OP") - dump(f, ATCODES, "SRE") - dump(f, CHCODES, "SRE") - - f.write("#define SRE_FLAG_TEMPLATE %d\n" % SRE_FLAG_TEMPLATE) - f.write("#define SRE_FLAG_IGNORECASE %d\n" % SRE_FLAG_IGNORECASE) - f.write("#define SRE_FLAG_LOCALE %d\n" % SRE_FLAG_LOCALE) - f.write("#define SRE_FLAG_MULTILINE %d\n" % SRE_FLAG_MULTILINE) - f.write("#define SRE_FLAG_DOTALL %d\n" % SRE_FLAG_DOTALL) - f.write("#define SRE_FLAG_UNICODE %d\n" % SRE_FLAG_UNICODE) - f.write("#define SRE_FLAG_VERBOSE %d\n" % SRE_FLAG_VERBOSE) - - f.write("#define SRE_INFO_PREFIX %d\n" % SRE_INFO_PREFIX) - f.write("#define SRE_INFO_LITERAL %d\n" % SRE_INFO_LITERAL) - f.write("#define SRE_INFO_CHARSET %d\n" % SRE_INFO_CHARSET) - - f.close() - print "done" diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py deleted file mode 100644 index 803c09d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/sre_parse.py +++ /dev/null @@ -1,834 +0,0 @@ -# -# Secret Labs' Regular Expression Engine -# -# convert re-style regular expression to sre pattern -# -# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved. -# -# See the sre.py file for information on usage and redistribution. -# - -"""Internal support module for sre""" - -# XXX: show string offset and offending character for all errors - -import sys - -from sre_constants import * - -SPECIAL_CHARS = ".\\[{()*+?^$|" -REPEAT_CHARS = "*+?{" - -DIGITS = set("0123456789") - -OCTDIGITS = set("01234567") -HEXDIGITS = set("0123456789abcdefABCDEF") - -WHITESPACE = set(" \t\n\r\v\f") - -ESCAPES = { - r"\a": (LITERAL, ord("\a")), - r"\b": (LITERAL, ord("\b")), - r"\f": (LITERAL, ord("\f")), - r"\n": (LITERAL, ord("\n")), - r"\r": (LITERAL, ord("\r")), - r"\t": (LITERAL, ord("\t")), - r"\v": (LITERAL, ord("\v")), - r"\\": (LITERAL, ord("\\")) -} - -CATEGORIES = { - r"\A": (AT, AT_BEGINNING_STRING), # start of string - r"\b": (AT, AT_BOUNDARY), - r"\B": (AT, AT_NON_BOUNDARY), - r"\d": (IN, [(CATEGORY, CATEGORY_DIGIT)]), - r"\D": (IN, [(CATEGORY, CATEGORY_NOT_DIGIT)]), - r"\s": (IN, [(CATEGORY, CATEGORY_SPACE)]), - r"\S": (IN, [(CATEGORY, CATEGORY_NOT_SPACE)]), - r"\w": (IN, [(CATEGORY, CATEGORY_WORD)]), - r"\W": (IN, [(CATEGORY, CATEGORY_NOT_WORD)]), - r"\Z": (AT, AT_END_STRING), # end of string -} - -FLAGS = { - # standard flags - "i": SRE_FLAG_IGNORECASE, - "L": SRE_FLAG_LOCALE, - "m": SRE_FLAG_MULTILINE, - "s": SRE_FLAG_DOTALL, - "x": SRE_FLAG_VERBOSE, - # extensions - "t": SRE_FLAG_TEMPLATE, - "u": SRE_FLAG_UNICODE, -} - -class Pattern: - # master pattern object. keeps track of global attributes - def __init__(self): - self.flags = 0 - self.open = [] - self.groups = 1 - self.groupdict = {} - self.lookbehind = 0 - - def opengroup(self, name=None): - gid = self.groups - self.groups = gid + 1 - if name is not None: - ogid = self.groupdict.get(name, None) - if ogid is not None: - raise error, ("redefinition of group name %s as group %d; " - "was group %d" % (repr(name), gid, ogid)) - self.groupdict[name] = gid - self.open.append(gid) - return gid - def closegroup(self, gid): - self.open.remove(gid) - def checkgroup(self, gid): - return gid < self.groups and gid not in self.open - -class SubPattern: - # a subpattern, in intermediate form - def __init__(self, pattern, data=None): - self.pattern = pattern - if data is None: - data = [] - self.data = data - self.width = None - def dump(self, level=0): - seqtypes = (tuple, list) - for op, av in self.data: - print level*" " + op, - if op == IN: - # member sublanguage - print - for op, a in av: - print (level+1)*" " + op, a - elif op == BRANCH: - print - for i, a in enumerate(av[1]): - if i: - print level*" " + "or" - a.dump(level+1) - elif op == GROUPREF_EXISTS: - condgroup, item_yes, item_no = av - print condgroup - item_yes.dump(level+1) - if item_no: - print level*" " + "else" - item_no.dump(level+1) - elif isinstance(av, seqtypes): - nl = 0 - for a in av: - if isinstance(a, SubPattern): - if not nl: - print - a.dump(level+1) - nl = 1 - else: - print a, - nl = 0 - if not nl: - print - else: - print av - def __repr__(self): - return repr(self.data) - def __len__(self): - return len(self.data) - def __delitem__(self, index): - del self.data[index] - def __getitem__(self, index): - if isinstance(index, slice): - return SubPattern(self.pattern, self.data[index]) - return self.data[index] - def __setitem__(self, index, code): - self.data[index] = code - def insert(self, index, code): - self.data.insert(index, code) - def append(self, code): - self.data.append(code) - def getwidth(self): - # determine the width (min, max) for this subpattern - if self.width: - return self.width - lo = hi = 0 - UNITCODES = (ANY, RANGE, IN, LITERAL, NOT_LITERAL, CATEGORY) - REPEATCODES = (MIN_REPEAT, MAX_REPEAT) - for op, av in self.data: - if op is BRANCH: - i = MAXREPEAT - 1 - j = 0 - for av in av[1]: - l, h = av.getwidth() - i = min(i, l) - j = max(j, h) - lo = lo + i - hi = hi + j - elif op is CALL: - i, j = av.getwidth() - lo = lo + i - hi = hi + j - elif op is SUBPATTERN: - i, j = av[1].getwidth() - lo = lo + i - hi = hi + j - elif op in REPEATCODES: - i, j = av[2].getwidth() - lo = lo + i * av[0] - hi = hi + j * av[1] - elif op in UNITCODES: - lo = lo + 1 - hi = hi + 1 - elif op == SUCCESS: - break - self.width = min(lo, MAXREPEAT - 1), min(hi, MAXREPEAT) - return self.width - -class Tokenizer: - def __init__(self, string): - self.string = string - self.index = 0 - self.__next() - def __next(self): - if self.index >= len(self.string): - self.next = None - return - char = self.string[self.index] - if char[0] == "\\": - try: - c = self.string[self.index + 1] - except IndexError: - raise error, "bogus escape (end of line)" - char = char + c - self.index = self.index + len(char) - self.next = char - def match(self, char, skip=1): - if char == self.next: - if skip: - self.__next() - return 1 - return 0 - def get(self): - this = self.next - self.__next() - return this - def tell(self): - return self.index, self.next - def seek(self, index): - self.index, self.next = index - -def isident(char): - return "a" <= char <= "z" or "A" <= char <= "Z" or char == "_" - -def isdigit(char): - return "0" <= char <= "9" - -def isname(name): - # check that group name is a valid string - if not isident(name[0]): - return False - for char in name[1:]: - if not isident(char) and not isdigit(char): - return False - return True - -def _class_escape(source, escape): - # handle escape code inside character class - code = ESCAPES.get(escape) - if code: - return code - code = CATEGORIES.get(escape) - if code and code[0] == IN: - return code - try: - c = escape[1:2] - if c == "x": - # hexadecimal escape (exactly two digits) - while source.next in HEXDIGITS and len(escape) < 4: - escape = escape + source.get() - escape = escape[2:] - if len(escape) != 2: - raise error, "bogus escape: %s" % repr("\\" + escape) - return LITERAL, int(escape, 16) & 0xff - elif c in OCTDIGITS: - # octal escape (up to three digits) - while source.next in OCTDIGITS and len(escape) < 4: - escape = escape + source.get() - escape = escape[1:] - return LITERAL, int(escape, 8) & 0xff - elif c in DIGITS: - raise error, "bogus escape: %s" % repr(escape) - if len(escape) == 2: - return LITERAL, ord(escape[1]) - except ValueError: - pass - raise error, "bogus escape: %s" % repr(escape) - -def _escape(source, escape, state): - # handle escape code in expression - code = CATEGORIES.get(escape) - if code: - return code - code = ESCAPES.get(escape) - if code: - return code - try: - c = escape[1:2] - if c == "x": - # hexadecimal escape - while source.next in HEXDIGITS and len(escape) < 4: - escape = escape + source.get() - if len(escape) != 4: - raise ValueError - return LITERAL, int(escape[2:], 16) & 0xff - elif c == "0": - # octal escape - while source.next in OCTDIGITS and len(escape) < 4: - escape = escape + source.get() - return LITERAL, int(escape[1:], 8) & 0xff - elif c in DIGITS: - # octal escape *or* decimal group reference (sigh) - if source.next in DIGITS: - escape = escape + source.get() - if (escape[1] in OCTDIGITS and escape[2] in OCTDIGITS and - source.next in OCTDIGITS): - # got three octal digits; this is an octal escape - escape = escape + source.get() - return LITERAL, int(escape[1:], 8) & 0xff - # not an octal escape, so this is a group reference - group = int(escape[1:]) - if group < state.groups: - if not state.checkgroup(group): - raise error, "cannot refer to open group" - if state.lookbehind: - import warnings - warnings.warn('group references in lookbehind ' - 'assertions are not supported', - RuntimeWarning) - return GROUPREF, group - raise ValueError - if len(escape) == 2: - return LITERAL, ord(escape[1]) - except ValueError: - pass - raise error, "bogus escape: %s" % repr(escape) - -def _parse_sub(source, state, nested=1): - # parse an alternation: a|b|c - - items = [] - itemsappend = items.append - sourcematch = source.match - while 1: - itemsappend(_parse(source, state)) - if sourcematch("|"): - continue - if not nested: - break - if not source.next or sourcematch(")", 0): - break - else: - raise error, "pattern not properly closed" - - if len(items) == 1: - return items[0] - - subpattern = SubPattern(state) - subpatternappend = subpattern.append - - # check if all items share a common prefix - while 1: - prefix = None - for item in items: - if not item: - break - if prefix is None: - prefix = item[0] - elif item[0] != prefix: - break - else: - # all subitems start with a common "prefix". - # move it out of the branch - for item in items: - del item[0] - subpatternappend(prefix) - continue # check next one - break - - # check if the branch can be replaced by a character set - for item in items: - if len(item) != 1 or item[0][0] != LITERAL: - break - else: - # we can store this as a character set instead of a - # branch (the compiler may optimize this even more) - set = [] - setappend = set.append - for item in items: - setappend(item[0]) - subpatternappend((IN, set)) - return subpattern - - subpattern.append((BRANCH, (None, items))) - return subpattern - -def _parse_sub_cond(source, state, condgroup): - item_yes = _parse(source, state) - if source.match("|"): - item_no = _parse(source, state) - if source.match("|"): - raise error, "conditional backref with more than two branches" - else: - item_no = None - if source.next and not source.match(")", 0): - raise error, "pattern not properly closed" - subpattern = SubPattern(state) - subpattern.append((GROUPREF_EXISTS, (condgroup, item_yes, item_no))) - return subpattern - -_PATTERNENDERS = set("|)") -_ASSERTCHARS = set("=!<") -_LOOKBEHINDASSERTCHARS = set("=!") -_REPEATCODES = set([MIN_REPEAT, MAX_REPEAT]) - -def _parse(source, state): - # parse a simple pattern - subpattern = SubPattern(state) - - # precompute constants into local variables - subpatternappend = subpattern.append - sourceget = source.get - sourcematch = source.match - _len = len - PATTERNENDERS = _PATTERNENDERS - ASSERTCHARS = _ASSERTCHARS - LOOKBEHINDASSERTCHARS = _LOOKBEHINDASSERTCHARS - REPEATCODES = _REPEATCODES - - while 1: - - if source.next in PATTERNENDERS: - break # end of subpattern - this = sourceget() - if this is None: - break # end of pattern - - if state.flags & SRE_FLAG_VERBOSE: - # skip whitespace and comments - if this in WHITESPACE: - continue - if this == "#": - while 1: - this = sourceget() - if this in (None, "\n"): - break - continue - - if this and this[0] not in SPECIAL_CHARS: - subpatternappend((LITERAL, ord(this))) - - elif this == "[": - # character set - set = [] - setappend = set.append -## if sourcematch(":"): -## pass # handle character classes - if sourcematch("^"): - setappend((NEGATE, None)) - # check remaining characters - start = set[:] - while 1: - this = sourceget() - if this == "]" and set != start: - break - elif this and this[0] == "\\": - code1 = _class_escape(source, this) - elif this: - code1 = LITERAL, ord(this) - else: - raise error, "unexpected end of regular expression" - if sourcematch("-"): - # potential range - this = sourceget() - if this == "]": - if code1[0] is IN: - code1 = code1[1][0] - setappend(code1) - setappend((LITERAL, ord("-"))) - break - elif this: - if this[0] == "\\": - code2 = _class_escape(source, this) - else: - code2 = LITERAL, ord(this) - if code1[0] != LITERAL or code2[0] != LITERAL: - raise error, "bad character range" - lo = code1[1] - hi = code2[1] - if hi < lo: - raise error, "bad character range" - setappend((RANGE, (lo, hi))) - else: - raise error, "unexpected end of regular expression" - else: - if code1[0] is IN: - code1 = code1[1][0] - setappend(code1) - - # XXX: should move set optimization to compiler! - if _len(set)==1 and set[0][0] is LITERAL: - subpatternappend(set[0]) # optimization - elif _len(set)==2 and set[0][0] is NEGATE and set[1][0] is LITERAL: - subpatternappend((NOT_LITERAL, set[1][1])) # optimization - else: - # XXX: should add charmap optimization here - subpatternappend((IN, set)) - - elif this and this[0] in REPEAT_CHARS: - # repeat previous item - if this == "?": - min, max = 0, 1 - elif this == "*": - min, max = 0, MAXREPEAT - - elif this == "+": - min, max = 1, MAXREPEAT - elif this == "{": - if source.next == "}": - subpatternappend((LITERAL, ord(this))) - continue - here = source.tell() - min, max = 0, MAXREPEAT - lo = hi = "" - while source.next in DIGITS: - lo = lo + source.get() - if sourcematch(","): - while source.next in DIGITS: - hi = hi + sourceget() - else: - hi = lo - if not sourcematch("}"): - subpatternappend((LITERAL, ord(this))) - source.seek(here) - continue - if lo: - min = int(lo) - if min >= MAXREPEAT: - raise OverflowError("the repetition number is too large") - if hi: - max = int(hi) - if max >= MAXREPEAT: - raise OverflowError("the repetition number is too large") - if max < min: - raise error("bad repeat interval") - else: - raise error, "not supported" - # figure out which item to repeat - if subpattern: - item = subpattern[-1:] - else: - item = None - if not item or (_len(item) == 1 and item[0][0] == AT): - raise error, "nothing to repeat" - if item[0][0] in REPEATCODES: - raise error, "multiple repeat" - if sourcematch("?"): - subpattern[-1] = (MIN_REPEAT, (min, max, item)) - else: - subpattern[-1] = (MAX_REPEAT, (min, max, item)) - - elif this == ".": - subpatternappend((ANY, None)) - - elif this == "(": - group = 1 - name = None - condgroup = None - if sourcematch("?"): - group = 0 - # options - if sourcematch("P"): - # python extensions - if sourcematch("<"): - # named group: skip forward to end of name - name = "" - while 1: - char = sourceget() - if char is None: - raise error, "unterminated name" - if char == ">": - break - name = name + char - group = 1 - if not name: - raise error("missing group name") - if not isname(name): - raise error("bad character in group name %r" % - name) - elif sourcematch("="): - # named backreference - name = "" - while 1: - char = sourceget() - if char is None: - raise error, "unterminated name" - if char == ")": - break - name = name + char - if not name: - raise error("missing group name") - if not isname(name): - raise error("bad character in backref group name " - "%r" % name) - gid = state.groupdict.get(name) - if gid is None: - msg = "unknown group name: {0!r}".format(name) - raise error(msg) - if state.lookbehind: - import warnings - warnings.warn('group references in lookbehind ' - 'assertions are not supported', - RuntimeWarning) - subpatternappend((GROUPREF, gid)) - continue - else: - char = sourceget() - if char is None: - raise error, "unexpected end of pattern" - raise error, "unknown specifier: ?P%s" % char - elif sourcematch(":"): - # non-capturing group - group = 2 - elif sourcematch("#"): - # comment - while 1: - if source.next is None or source.next == ")": - break - sourceget() - if not sourcematch(")"): - raise error, "unbalanced parenthesis" - continue - elif source.next in ASSERTCHARS: - # lookahead assertions - char = sourceget() - dir = 1 - if char == "<": - if source.next not in LOOKBEHINDASSERTCHARS: - raise error, "syntax error" - dir = -1 # lookbehind - char = sourceget() - state.lookbehind += 1 - p = _parse_sub(source, state) - if dir < 0: - state.lookbehind -= 1 - if not sourcematch(")"): - raise error, "unbalanced parenthesis" - if char == "=": - subpatternappend((ASSERT, (dir, p))) - else: - subpatternappend((ASSERT_NOT, (dir, p))) - continue - elif sourcematch("("): - # conditional backreference group - condname = "" - while 1: - char = sourceget() - if char is None: - raise error, "unterminated name" - if char == ")": - break - condname = condname + char - group = 2 - if not condname: - raise error("missing group name") - if isname(condname): - condgroup = state.groupdict.get(condname) - if condgroup is None: - msg = "unknown group name: {0!r}".format(condname) - raise error(msg) - else: - try: - condgroup = int(condname) - except ValueError: - raise error, "bad character in group name" - if state.lookbehind: - import warnings - warnings.warn('group references in lookbehind ' - 'assertions are not supported', - RuntimeWarning) - else: - # flags - if not source.next in FLAGS: - raise error, "unexpected end of pattern" - while source.next in FLAGS: - state.flags = state.flags | FLAGS[sourceget()] - if group: - # parse group contents - if group == 2: - # anonymous group - group = None - else: - group = state.opengroup(name) - if condgroup: - p = _parse_sub_cond(source, state, condgroup) - else: - p = _parse_sub(source, state) - if not sourcematch(")"): - raise error, "unbalanced parenthesis" - if group is not None: - state.closegroup(group) - subpatternappend((SUBPATTERN, (group, p))) - else: - while 1: - char = sourceget() - if char is None: - raise error, "unexpected end of pattern" - if char == ")": - break - raise error, "unknown extension" - - elif this == "^": - subpatternappend((AT, AT_BEGINNING)) - - elif this == "$": - subpattern.append((AT, AT_END)) - - elif this and this[0] == "\\": - code = _escape(source, this, state) - subpatternappend(code) - - else: - raise error, "parser error" - - return subpattern - -def parse(str, flags=0, pattern=None): - # parse 're' pattern into list of (opcode, argument) tuples - - source = Tokenizer(str) - - if pattern is None: - pattern = Pattern() - pattern.flags = flags - pattern.str = str - - p = _parse_sub(source, pattern, 0) - - tail = source.get() - if tail == ")": - raise error, "unbalanced parenthesis" - elif tail: - raise error, "bogus characters at end of regular expression" - - if flags & SRE_FLAG_DEBUG: - p.dump() - - if not (flags & SRE_FLAG_VERBOSE) and p.pattern.flags & SRE_FLAG_VERBOSE: - # the VERBOSE flag was switched on inside the pattern. to be - # on the safe side, we'll parse the whole thing again... - return parse(str, p.pattern.flags) - - return p - -def parse_template(source, pattern): - # parse 're' replacement string into list of literals and - # group references - s = Tokenizer(source) - sget = s.get - p = [] - a = p.append - def literal(literal, p=p, pappend=a): - if p and p[-1][0] is LITERAL: - p[-1] = LITERAL, p[-1][1] + literal - else: - pappend((LITERAL, literal)) - sep = source[:0] - if type(sep) is type(""): - makechar = chr - else: - makechar = unichr - while 1: - this = sget() - if this is None: - break # end of replacement string - if this and this[0] == "\\": - # group - c = this[1:2] - if c == "g": - name = "" - if s.match("<"): - while 1: - char = sget() - if char is None: - raise error, "unterminated group name" - if char == ">": - break - name = name + char - if not name: - raise error, "missing group name" - try: - index = int(name) - if index < 0: - raise error, "negative group number" - except ValueError: - if not isname(name): - raise error, "bad character in group name" - try: - index = pattern.groupindex[name] - except KeyError: - msg = "unknown group name: {0!r}".format(name) - raise IndexError(msg) - a((MARK, index)) - elif c == "0": - if s.next in OCTDIGITS: - this = this + sget() - if s.next in OCTDIGITS: - this = this + sget() - literal(makechar(int(this[1:], 8) & 0xff)) - elif c in DIGITS: - isoctal = False - if s.next in DIGITS: - this = this + sget() - if (c in OCTDIGITS and this[2] in OCTDIGITS and - s.next in OCTDIGITS): - this = this + sget() - isoctal = True - literal(makechar(int(this[1:], 8) & 0xff)) - if not isoctal: - a((MARK, int(this[1:]))) - else: - try: - this = makechar(ESCAPES[this][1]) - except KeyError: - pass - literal(this) - else: - literal(this) - # convert template to groups and literals lists - i = 0 - groups = [] - groupsappend = groups.append - literals = [None] * len(p) - for c, s in p: - if c is MARK: - groupsappend((i, s)) - # literal[i] is already None - else: - literals[i] = s - i = i + 1 - return groups, literals - -def expand_template(template, match): - g = match.group - sep = match.string[:0] - groups, literals = template - literals = literals[:] - try: - for index, group in groups: - literals[index] = s = g(group) - if s is None: - raise error, "unmatched group" - except IndexError: - raise error, "invalid group reference" - return sep.join(literals) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py deleted file mode 100644 index e917fc1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/stat.py +++ /dev/null @@ -1,96 +0,0 @@ -"""Constants/functions for interpreting results of os.stat() and os.lstat(). - -Suggested usage: from stat import * -""" - -# Indices for stat struct members in the tuple returned by os.stat() - -ST_MODE = 0 -ST_INO = 1 -ST_DEV = 2 -ST_NLINK = 3 -ST_UID = 4 -ST_GID = 5 -ST_SIZE = 6 -ST_ATIME = 7 -ST_MTIME = 8 -ST_CTIME = 9 - -# Extract bits from the mode - -def S_IMODE(mode): - return mode & 07777 - -def S_IFMT(mode): - return mode & 0170000 - -# Constants used as S_IFMT() for various file types -# (not all are implemented on all systems) - -S_IFDIR = 0040000 -S_IFCHR = 0020000 -S_IFBLK = 0060000 -S_IFREG = 0100000 -S_IFIFO = 0010000 -S_IFLNK = 0120000 -S_IFSOCK = 0140000 - -# Functions to test for each file type - -def S_ISDIR(mode): - return S_IFMT(mode) == S_IFDIR - -def S_ISCHR(mode): - return S_IFMT(mode) == S_IFCHR - -def S_ISBLK(mode): - return S_IFMT(mode) == S_IFBLK - -def S_ISREG(mode): - return S_IFMT(mode) == S_IFREG - -def S_ISFIFO(mode): - return S_IFMT(mode) == S_IFIFO - -def S_ISLNK(mode): - return S_IFMT(mode) == S_IFLNK - -def S_ISSOCK(mode): - return S_IFMT(mode) == S_IFSOCK - -# Names for permission bits - -S_ISUID = 04000 -S_ISGID = 02000 -S_ENFMT = S_ISGID -S_ISVTX = 01000 -S_IREAD = 00400 -S_IWRITE = 00200 -S_IEXEC = 00100 -S_IRWXU = 00700 -S_IRUSR = 00400 -S_IWUSR = 00200 -S_IXUSR = 00100 -S_IRWXG = 00070 -S_IRGRP = 00040 -S_IWGRP = 00020 -S_IXGRP = 00010 -S_IRWXO = 00007 -S_IROTH = 00004 -S_IWOTH = 00002 -S_IXOTH = 00001 - -# Names for file flags - -UF_NODUMP = 0x00000001 -UF_IMMUTABLE = 0x00000002 -UF_APPEND = 0x00000004 -UF_OPAQUE = 0x00000008 -UF_NOUNLINK = 0x00000010 -UF_COMPRESSED = 0x00000020 # OS X: file is hfs-compressed -UF_HIDDEN = 0x00008000 # OS X: file should not be displayed -SF_ARCHIVED = 0x00010000 -SF_IMMUTABLE = 0x00020000 -SF_APPEND = 0x00040000 -SF_NOUNLINK = 0x00100000 -SF_SNAPSHOT = 0x00200000 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/string.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/string.py deleted file mode 100644 index 3509872..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/string.py +++ /dev/null @@ -1,656 +0,0 @@ -"""A collection of string operations (most are no longer used). - -Warning: most of the code you see here isn't normally used nowadays. -Beginning with Python 1.6, many of these functions are implemented as -methods on the standard string object. They used to be implemented by -a built-in module called strop, but strop is now obsolete itself. - -Public module variables: - -whitespace -- a string containing all characters considered whitespace -lowercase -- a string containing all characters considered lowercase letters -uppercase -- a string containing all characters considered uppercase letters -letters -- a string containing all characters considered letters -digits -- a string containing all characters considered decimal digits -hexdigits -- a string containing all characters considered hexadecimal digits -octdigits -- a string containing all characters considered octal digits -punctuation -- a string containing all characters considered punctuation -printable -- a string containing all characters considered printable - -""" - -# Some strings for ctype-style character classification -whitespace = ' \t\n\r\v\f' -lowercase = 'abcdefghijklmnopqrstuvwxyz' -uppercase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' -letters = lowercase + uppercase -ascii_lowercase = lowercase -ascii_uppercase = uppercase -ascii_letters = ascii_lowercase + ascii_uppercase -digits = '0123456789' -hexdigits = digits + 'abcdef' + 'ABCDEF' -octdigits = '01234567' -punctuation = """!"#$%&'()*+,-./:;<=>?@[\]^_`{|}~""" -printable = digits + letters + punctuation + whitespace - -# Case conversion helpers -# Use str to convert Unicode literal in case of -U -l = map(chr, xrange(256)) -_idmap = str('').join(l) -del l - -# Functions which aren't available as string methods. - -# Capitalize the words in a string, e.g. " aBc dEf " -> "Abc Def". -def capwords(s, sep=None): - """capwords(s [,sep]) -> string - - Split the argument into words using split, capitalize each - word using capitalize, and join the capitalized words using - join. If the optional second argument sep is absent or None, - runs of whitespace characters are replaced by a single space - and leading and trailing whitespace are removed, otherwise - sep is used to split and join the words. - - """ - return (sep or ' ').join(x.capitalize() for x in s.split(sep)) - - -# Construct a translation string -_idmapL = None -def maketrans(fromstr, tostr): - """maketrans(frm, to) -> string - - Return a translation table (a string of 256 bytes long) - suitable for use in string.translate. The strings frm and to - must be of the same length. - - """ - if len(fromstr) != len(tostr): - raise ValueError, "maketrans arguments must have same length" - global _idmapL - if not _idmapL: - _idmapL = list(_idmap) - L = _idmapL[:] - fromstr = map(ord, fromstr) - for i in range(len(fromstr)): - L[fromstr[i]] = tostr[i] - return ''.join(L) - - - -#################################################################### -import re as _re - -class _multimap: - """Helper class for combining multiple mappings. - - Used by .{safe_,}substitute() to combine the mapping and keyword - arguments. - """ - def __init__(self, primary, secondary): - self._primary = primary - self._secondary = secondary - - def __getitem__(self, key): - try: - return self._primary[key] - except KeyError: - return self._secondary[key] - - -class _TemplateMetaclass(type): - pattern = r""" - %(delim)s(?: - (?P%(delim)s) | # Escape sequence of two delimiters - (?P%(id)s) | # delimiter and a Python identifier - {(?P%(id)s)} | # delimiter and a braced identifier - (?P) # Other ill-formed delimiter exprs - ) - """ - - def __init__(cls, name, bases, dct): - super(_TemplateMetaclass, cls).__init__(name, bases, dct) - if 'pattern' in dct: - pattern = cls.pattern - else: - pattern = _TemplateMetaclass.pattern % { - 'delim' : _re.escape(cls.delimiter), - 'id' : cls.idpattern, - } - cls.pattern = _re.compile(pattern, _re.IGNORECASE | _re.VERBOSE) - - -class Template: - """A string class for supporting $-substitutions.""" - __metaclass__ = _TemplateMetaclass - - delimiter = '$' - idpattern = r'[_a-z][_a-z0-9]*' - - def __init__(self, template): - self.template = template - - # Search for $$, $identifier, ${identifier}, and any bare $'s - - def _invalid(self, mo): - i = mo.start('invalid') - lines = self.template[:i].splitlines(True) - if not lines: - colno = 1 - lineno = 1 - else: - colno = i - len(''.join(lines[:-1])) - lineno = len(lines) - raise ValueError('Invalid placeholder in string: line %d, col %d' % - (lineno, colno)) - - def substitute(*args, **kws): - if not args: - raise TypeError("descriptor 'substitute' of 'Template' object " - "needs an argument") - self, args = args[0], args[1:] # allow the "self" keyword be passed - if len(args) > 1: - raise TypeError('Too many positional arguments') - if not args: - mapping = kws - elif kws: - mapping = _multimap(kws, args[0]) - else: - mapping = args[0] - # Helper function for .sub() - def convert(mo): - # Check the most common path first. - named = mo.group('named') or mo.group('braced') - if named is not None: - val = mapping[named] - # We use this idiom instead of str() because the latter will - # fail if val is a Unicode containing non-ASCII characters. - return '%s' % (val,) - if mo.group('escaped') is not None: - return self.delimiter - if mo.group('invalid') is not None: - self._invalid(mo) - raise ValueError('Unrecognized named group in pattern', - self.pattern) - return self.pattern.sub(convert, self.template) - - def safe_substitute(*args, **kws): - if not args: - raise TypeError("descriptor 'safe_substitute' of 'Template' object " - "needs an argument") - self, args = args[0], args[1:] # allow the "self" keyword be passed - if len(args) > 1: - raise TypeError('Too many positional arguments') - if not args: - mapping = kws - elif kws: - mapping = _multimap(kws, args[0]) - else: - mapping = args[0] - # Helper function for .sub() - def convert(mo): - named = mo.group('named') or mo.group('braced') - if named is not None: - try: - # We use this idiom instead of str() because the latter - # will fail if val is a Unicode containing non-ASCII - return '%s' % (mapping[named],) - except KeyError: - return mo.group() - if mo.group('escaped') is not None: - return self.delimiter - if mo.group('invalid') is not None: - return mo.group() - raise ValueError('Unrecognized named group in pattern', - self.pattern) - return self.pattern.sub(convert, self.template) - - - -#################################################################### -# NOTE: Everything below here is deprecated. Use string methods instead. -# This stuff will go away in Python 3.0. - -# Backward compatible names for exceptions -index_error = ValueError -atoi_error = ValueError -atof_error = ValueError -atol_error = ValueError - -# convert UPPER CASE letters to lower case -def lower(s): - """lower(s) -> string - - Return a copy of the string s converted to lowercase. - - """ - return s.lower() - -# Convert lower case letters to UPPER CASE -def upper(s): - """upper(s) -> string - - Return a copy of the string s converted to uppercase. - - """ - return s.upper() - -# Swap lower case letters and UPPER CASE -def swapcase(s): - """swapcase(s) -> string - - Return a copy of the string s with upper case characters - converted to lowercase and vice versa. - - """ - return s.swapcase() - -# Strip leading and trailing tabs and spaces -def strip(s, chars=None): - """strip(s [,chars]) -> string - - Return a copy of the string s with leading and trailing - whitespace removed. - If chars is given and not None, remove characters in chars instead. - If chars is unicode, S will be converted to unicode before stripping. - - """ - return s.strip(chars) - -# Strip leading tabs and spaces -def lstrip(s, chars=None): - """lstrip(s [,chars]) -> string - - Return a copy of the string s with leading whitespace removed. - If chars is given and not None, remove characters in chars instead. - - """ - return s.lstrip(chars) - -# Strip trailing tabs and spaces -def rstrip(s, chars=None): - """rstrip(s [,chars]) -> string - - Return a copy of the string s with trailing whitespace removed. - If chars is given and not None, remove characters in chars instead. - - """ - return s.rstrip(chars) - - -# Split a string into a list of space/tab-separated words -def split(s, sep=None, maxsplit=-1): - """split(s [,sep [,maxsplit]]) -> list of strings - - Return a list of the words in the string s, using sep as the - delimiter string. If maxsplit is given, splits at no more than - maxsplit places (resulting in at most maxsplit+1 words). If sep - is not specified or is None, any whitespace string is a separator. - - (split and splitfields are synonymous) - - """ - return s.split(sep, maxsplit) -splitfields = split - -# Split a string into a list of space/tab-separated words -def rsplit(s, sep=None, maxsplit=-1): - """rsplit(s [,sep [,maxsplit]]) -> list of strings - - Return a list of the words in the string s, using sep as the - delimiter string, starting at the end of the string and working - to the front. If maxsplit is given, at most maxsplit splits are - done. If sep is not specified or is None, any whitespace string - is a separator. - """ - return s.rsplit(sep, maxsplit) - -# Join fields with optional separator -def join(words, sep = ' '): - """join(list [,sep]) -> string - - Return a string composed of the words in list, with - intervening occurrences of sep. The default separator is a - single space. - - (joinfields and join are synonymous) - - """ - return sep.join(words) -joinfields = join - -# Find substring, raise exception if not found -def index(s, *args): - """index(s, sub [,start [,end]]) -> int - - Like find but raises ValueError when the substring is not found. - - """ - return s.index(*args) - -# Find last substring, raise exception if not found -def rindex(s, *args): - """rindex(s, sub [,start [,end]]) -> int - - Like rfind but raises ValueError when the substring is not found. - - """ - return s.rindex(*args) - -# Count non-overlapping occurrences of substring -def count(s, *args): - """count(s, sub[, start[,end]]) -> int - - Return the number of occurrences of substring sub in string - s[start:end]. Optional arguments start and end are - interpreted as in slice notation. - - """ - return s.count(*args) - -# Find substring, return -1 if not found -def find(s, *args): - """find(s, sub [,start [,end]]) -> in - - Return the lowest index in s where substring sub is found, - such that sub is contained within s[start,end]. Optional - arguments start and end are interpreted as in slice notation. - - Return -1 on failure. - - """ - return s.find(*args) - -# Find last substring, return -1 if not found -def rfind(s, *args): - """rfind(s, sub [,start [,end]]) -> int - - Return the highest index in s where substring sub is found, - such that sub is contained within s[start,end]. Optional - arguments start and end are interpreted as in slice notation. - - Return -1 on failure. - - """ - return s.rfind(*args) - -# for a bit of speed -_float = float -_int = int -_long = long - -# Convert string to float -def atof(s): - """atof(s) -> float - - Return the floating point number represented by the string s. - - """ - return _float(s) - - -# Convert string to integer -def atoi(s , base=10): - """atoi(s [,base]) -> int - - Return the integer represented by the string s in the given - base, which defaults to 10. The string s must consist of one - or more digits, possibly preceded by a sign. If base is 0, it - is chosen from the leading characters of s, 0 for octal, 0x or - 0X for hexadecimal. If base is 16, a preceding 0x or 0X is - accepted. - - """ - return _int(s, base) - - -# Convert string to long integer -def atol(s, base=10): - """atol(s [,base]) -> long - - Return the long integer represented by the string s in the - given base, which defaults to 10. The string s must consist - of one or more digits, possibly preceded by a sign. If base - is 0, it is chosen from the leading characters of s, 0 for - octal, 0x or 0X for hexadecimal. If base is 16, a preceding - 0x or 0X is accepted. A trailing L or l is not accepted, - unless base is 0. - - """ - return _long(s, base) - - -# Left-justify a string -def ljust(s, width, *args): - """ljust(s, width[, fillchar]) -> string - - Return a left-justified version of s, in a field of the - specified width, padded with spaces as needed. The string is - never truncated. If specified the fillchar is used instead of spaces. - - """ - return s.ljust(width, *args) - -# Right-justify a string -def rjust(s, width, *args): - """rjust(s, width[, fillchar]) -> string - - Return a right-justified version of s, in a field of the - specified width, padded with spaces as needed. The string is - never truncated. If specified the fillchar is used instead of spaces. - - """ - return s.rjust(width, *args) - -# Center a string -def center(s, width, *args): - """center(s, width[, fillchar]) -> string - - Return a center version of s, in a field of the specified - width. padded with spaces as needed. The string is never - truncated. If specified the fillchar is used instead of spaces. - - """ - return s.center(width, *args) - -# Zero-fill a number, e.g., (12, 3) --> '012' and (-3, 3) --> '-03' -# Decadent feature: the argument may be a string or a number -# (Use of this is deprecated; it should be a string as with ljust c.s.) -def zfill(x, width): - """zfill(x, width) -> string - - Pad a numeric string x with zeros on the left, to fill a field - of the specified width. The string x is never truncated. - - """ - if not isinstance(x, basestring): - x = repr(x) - return x.zfill(width) - -# Expand tabs in a string. -# Doesn't take non-printing chars into account, but does understand \n. -def expandtabs(s, tabsize=8): - """expandtabs(s [,tabsize]) -> string - - Return a copy of the string s with all tab characters replaced - by the appropriate number of spaces, depending on the current - column, and the tabsize (default 8). - - """ - return s.expandtabs(tabsize) - -# Character translation through look-up table. -def translate(s, table, deletions=""): - """translate(s,table [,deletions]) -> string - - Return a copy of the string s, where all characters occurring - in the optional argument deletions are removed, and the - remaining characters have been mapped through the given - translation table, which must be a string of length 256. The - deletions argument is not allowed for Unicode strings. - - """ - if deletions or table is None: - return s.translate(table, deletions) - else: - # Add s[:0] so that if s is Unicode and table is an 8-bit string, - # table is converted to Unicode. This means that table *cannot* - # be a dictionary -- for that feature, use u.translate() directly. - return s.translate(table + s[:0]) - -# Capitalize a string, e.g. "aBc dEf" -> "Abc def". -def capitalize(s): - """capitalize(s) -> string - - Return a copy of the string s with only its first character - capitalized. - - """ - return s.capitalize() - -# Substring replacement (global) -def replace(s, old, new, maxreplace=-1): - """replace (str, old, new[, maxreplace]) -> string - - Return a copy of string str with all occurrences of substring - old replaced by new. If the optional argument maxreplace is - given, only the first maxreplace occurrences are replaced. - - """ - return s.replace(old, new, maxreplace) - - -# Try importing optional built-in module "strop" -- if it exists, -# it redefines some string operations that are 100-1000 times faster. -# It also defines values for whitespace, lowercase and uppercase -# that match 's definitions. - -try: - from strop import maketrans, lowercase, uppercase, whitespace - letters = lowercase + uppercase -except ImportError: - pass # Use the original versions - -######################################################################## -# the Formatter class -# see PEP 3101 for details and purpose of this class - -# The hard parts are reused from the C implementation. They're exposed as "_" -# prefixed methods of str and unicode. - -# The overall parser is implemented in str._formatter_parser. -# The field name parser is implemented in str._formatter_field_name_split - -class Formatter(object): - def format(*args, **kwargs): - if not args: - raise TypeError("descriptor 'format' of 'Formatter' object " - "needs an argument") - self, args = args[0], args[1:] # allow the "self" keyword be passed - try: - format_string, args = args[0], args[1:] # allow the "format_string" keyword be passed - except IndexError: - if 'format_string' in kwargs: - format_string = kwargs.pop('format_string') - else: - raise TypeError("format() missing 1 required positional " - "argument: 'format_string'") - return self.vformat(format_string, args, kwargs) - - def vformat(self, format_string, args, kwargs): - used_args = set() - result = self._vformat(format_string, args, kwargs, used_args, 2) - self.check_unused_args(used_args, args, kwargs) - return result - - def _vformat(self, format_string, args, kwargs, used_args, recursion_depth): - if recursion_depth < 0: - raise ValueError('Max string recursion exceeded') - result = [] - for literal_text, field_name, format_spec, conversion in \ - self.parse(format_string): - - # output the literal text - if literal_text: - result.append(literal_text) - - # if there's a field, output it - if field_name is not None: - # this is some markup, find the object and do - # the formatting - - # given the field_name, find the object it references - # and the argument it came from - obj, arg_used = self.get_field(field_name, args, kwargs) - used_args.add(arg_used) - - # do any conversion on the resulting object - obj = self.convert_field(obj, conversion) - - # expand the format spec, if needed - format_spec = self._vformat(format_spec, args, kwargs, - used_args, recursion_depth-1) - - # format the object and append to the result - result.append(self.format_field(obj, format_spec)) - - return ''.join(result) - - - def get_value(self, key, args, kwargs): - if isinstance(key, (int, long)): - return args[key] - else: - return kwargs[key] - - - def check_unused_args(self, used_args, args, kwargs): - pass - - - def format_field(self, value, format_spec): - return format(value, format_spec) - - - def convert_field(self, value, conversion): - # do any conversion on the resulting object - if conversion is None: - return value - elif conversion == 's': - return str(value) - elif conversion == 'r': - return repr(value) - raise ValueError("Unknown conversion specifier {0!s}".format(conversion)) - - - # returns an iterable that contains tuples of the form: - # (literal_text, field_name, format_spec, conversion) - # literal_text can be zero length - # field_name can be None, in which case there's no - # object to format and output - # if field_name is not None, it is looked up, formatted - # with format_spec and conversion and then used - def parse(self, format_string): - return format_string._formatter_parser() - - - # given a field_name, find the object it references. - # field_name: the field being looked up, e.g. "0.name" - # or "lookup[3]" - # used_args: a set of which args have been used - # args, kwargs: as passed in to vformat - def get_field(self, field_name, args, kwargs): - first, rest = field_name._formatter_field_name_split() - - obj = self.get_value(first, args, kwargs) - - # loop through the rest of the field_name, doing - # getattr or getitem as needed - for is_attr, i in rest: - if is_attr: - obj = getattr(obj, i) - else: - obj = obj[i] - - return obj, first diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py deleted file mode 100644 index f7c44e9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/struct.py +++ /dev/null @@ -1,3 +0,0 @@ -from _struct import * -from _struct import _clearcache -from _struct import __doc__ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py deleted file mode 100644 index f365443..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/sysconfig.py +++ /dev/null @@ -1,640 +0,0 @@ -"""Provide access to Python's configuration information. - -""" -import sys -import os -from os.path import pardir, realpath - -_INSTALL_SCHEMES = { - 'posix_prefix': { - 'stdlib': '{base}/lib/python{py_version_short}', - 'platstdlib': '{platbase}/lib/python{py_version_short}', - 'purelib': '{base}/lib/python{py_version_short}/site-packages', - 'platlib': '{platbase}/lib/python{py_version_short}/site-packages', - 'include': '{base}/include/python{py_version_short}', - 'platinclude': '{platbase}/include/python{py_version_short}', - 'scripts': '{base}/bin', - 'data': '{base}', - }, - 'posix_home': { - 'stdlib': '{base}/lib/python', - 'platstdlib': '{base}/lib/python', - 'purelib': '{base}/lib/python', - 'platlib': '{base}/lib/python', - 'include': '{base}/include/python', - 'platinclude': '{base}/include/python', - 'scripts': '{base}/bin', - 'data' : '{base}', - }, - 'nt': { - 'stdlib': '{base}/Lib', - 'platstdlib': '{base}/Lib', - 'purelib': '{base}/Lib/site-packages', - 'platlib': '{base}/Lib/site-packages', - 'include': '{base}/Include', - 'platinclude': '{base}/Include', - 'scripts': '{base}/Scripts', - 'data' : '{base}', - }, - 'os2': { - 'stdlib': '{base}/Lib', - 'platstdlib': '{base}/Lib', - 'purelib': '{base}/Lib/site-packages', - 'platlib': '{base}/Lib/site-packages', - 'include': '{base}/Include', - 'platinclude': '{base}/Include', - 'scripts': '{base}/Scripts', - 'data' : '{base}', - }, - 'os2_home': { - 'stdlib': '{userbase}/lib/python{py_version_short}', - 'platstdlib': '{userbase}/lib/python{py_version_short}', - 'purelib': '{userbase}/lib/python{py_version_short}/site-packages', - 'platlib': '{userbase}/lib/python{py_version_short}/site-packages', - 'include': '{userbase}/include/python{py_version_short}', - 'scripts': '{userbase}/bin', - 'data' : '{userbase}', - }, - 'nt_user': { - 'stdlib': '{userbase}/Python{py_version_nodot}', - 'platstdlib': '{userbase}/Python{py_version_nodot}', - 'purelib': '{userbase}/Python{py_version_nodot}/site-packages', - 'platlib': '{userbase}/Python{py_version_nodot}/site-packages', - 'include': '{userbase}/Python{py_version_nodot}/Include', - 'scripts': '{userbase}/Scripts', - 'data' : '{userbase}', - }, - 'posix_user': { - 'stdlib': '{userbase}/lib/python{py_version_short}', - 'platstdlib': '{userbase}/lib/python{py_version_short}', - 'purelib': '{userbase}/lib/python{py_version_short}/site-packages', - 'platlib': '{userbase}/lib/python{py_version_short}/site-packages', - 'include': '{userbase}/include/python{py_version_short}', - 'scripts': '{userbase}/bin', - 'data' : '{userbase}', - }, - 'osx_framework_user': { - 'stdlib': '{userbase}/lib/python', - 'platstdlib': '{userbase}/lib/python', - 'purelib': '{userbase}/lib/python/site-packages', - 'platlib': '{userbase}/lib/python/site-packages', - 'include': '{userbase}/include', - 'scripts': '{userbase}/bin', - 'data' : '{userbase}', - }, - } - -_SCHEME_KEYS = ('stdlib', 'platstdlib', 'purelib', 'platlib', 'include', - 'scripts', 'data') -_PY_VERSION = sys.version.split()[0] -_PY_VERSION_SHORT = sys.version[:3] -_PY_VERSION_SHORT_NO_DOT = _PY_VERSION[0] + _PY_VERSION[2] -_PREFIX = os.path.normpath(sys.prefix) -_EXEC_PREFIX = os.path.normpath(sys.exec_prefix) -_CONFIG_VARS = None -_USER_BASE = None - -def _safe_realpath(path): - try: - return realpath(path) - except OSError: - return path - -if sys.executable: - _PROJECT_BASE = os.path.dirname(_safe_realpath(sys.executable)) -else: - # sys.executable can be empty if argv[0] has been changed and Python is - # unable to retrieve the real program name - _PROJECT_BASE = _safe_realpath(os.getcwd()) - -if os.name == "nt" and "pcbuild" in _PROJECT_BASE[-8:].lower(): - _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir)) -# PC/VS7.1 -if os.name == "nt" and "\\pc\\v" in _PROJECT_BASE[-10:].lower(): - _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) -# PC/AMD64 -if os.name == "nt" and "\\pcbuild\\amd64" in _PROJECT_BASE[-14:].lower(): - _PROJECT_BASE = _safe_realpath(os.path.join(_PROJECT_BASE, pardir, pardir)) - -# set for cross builds -if "_PYTHON_PROJECT_BASE" in os.environ: - # the build directory for posix builds - _PROJECT_BASE = os.path.normpath(os.path.abspath(".")) -def is_python_build(): - for fn in ("Setup.dist", "Setup.local"): - if os.path.isfile(os.path.join(_PROJECT_BASE, "Modules", fn)): - return True - return False - -_PYTHON_BUILD = is_python_build() - -if _PYTHON_BUILD: - for scheme in ('posix_prefix', 'posix_home'): - _INSTALL_SCHEMES[scheme]['include'] = '{projectbase}/Include' - _INSTALL_SCHEMES[scheme]['platinclude'] = '{srcdir}' - -def _subst_vars(s, local_vars): - try: - return s.format(**local_vars) - except KeyError: - try: - return s.format(**os.environ) - except KeyError, var: - raise AttributeError('{%s}' % var) - -def _extend_dict(target_dict, other_dict): - target_keys = target_dict.keys() - for key, value in other_dict.items(): - if key in target_keys: - continue - target_dict[key] = value - -def _expand_vars(scheme, vars): - res = {} - if vars is None: - vars = {} - _extend_dict(vars, get_config_vars()) - - for key, value in _INSTALL_SCHEMES[scheme].items(): - if os.name in ('posix', 'nt'): - value = os.path.expanduser(value) - res[key] = os.path.normpath(_subst_vars(value, vars)) - return res - -def _get_default_scheme(): - if os.name == 'posix': - # the default scheme for posix is posix_prefix - return 'posix_prefix' - return os.name - -def _getuserbase(): - env_base = os.environ.get("PYTHONUSERBASE", None) - def joinuser(*args): - return os.path.expanduser(os.path.join(*args)) - - # what about 'os2emx', 'riscos' ? - if os.name == "nt": - base = os.environ.get("APPDATA") or "~" - return env_base if env_base else joinuser(base, "Python") - - if sys.platform == "darwin": - framework = get_config_var("PYTHONFRAMEWORK") - if framework: - return env_base if env_base else \ - joinuser("~", "Library", framework, "%d.%d" - % (sys.version_info[:2])) - - return env_base if env_base else joinuser("~", ".local") - - -def _parse_makefile(filename, vars=None): - """Parse a Makefile-style file. - - A dictionary containing name/value pairs is returned. If an - optional dictionary is passed in as the second argument, it is - used instead of a new dictionary. - """ - import re - # Regexes needed for parsing Makefile (and similar syntaxes, - # like old-style Setup files). - _variable_rx = re.compile("([a-zA-Z][a-zA-Z0-9_]+)\s*=\s*(.*)") - _findvar1_rx = re.compile(r"\$\(([A-Za-z][A-Za-z0-9_]*)\)") - _findvar2_rx = re.compile(r"\${([A-Za-z][A-Za-z0-9_]*)}") - - if vars is None: - vars = {} - done = {} - notdone = {} - - with open(filename) as f: - lines = f.readlines() - - for line in lines: - if line.startswith('#') or line.strip() == '': - continue - m = _variable_rx.match(line) - if m: - n, v = m.group(1, 2) - v = v.strip() - # `$$' is a literal `$' in make - tmpv = v.replace('$$', '') - - if "$" in tmpv: - notdone[n] = v - else: - try: - v = int(v) - except ValueError: - # insert literal `$' - done[n] = v.replace('$$', '$') - else: - done[n] = v - - # do variable interpolation here - while notdone: - for name in notdone.keys(): - value = notdone[name] - m = _findvar1_rx.search(value) or _findvar2_rx.search(value) - if m: - n = m.group(1) - found = True - if n in done: - item = str(done[n]) - elif n in notdone: - # get it on a subsequent round - found = False - elif n in os.environ: - # do it like make: fall back to environment - item = os.environ[n] - else: - done[n] = item = "" - if found: - after = value[m.end():] - value = value[:m.start()] + item + after - if "$" in after: - notdone[name] = value - else: - try: value = int(value) - except ValueError: - done[name] = value.strip() - else: - done[name] = value - del notdone[name] - else: - # bogus variable reference; just drop it since we can't deal - del notdone[name] - # strip spurious spaces - for k, v in done.items(): - if isinstance(v, str): - done[k] = v.strip() - - # save the results in the global dictionary - vars.update(done) - return vars - - -def get_makefile_filename(): - """Return the path of the Makefile.""" - if _PYTHON_BUILD: - return os.path.join(_PROJECT_BASE, "Makefile") - return os.path.join(get_path('platstdlib'), "config", "Makefile") - -# Issue #22199: retain undocumented private name for compatibility -_get_makefile_filename = get_makefile_filename - -def _generate_posix_vars(): - """Generate the Python module containing build-time variables.""" - import pprint - vars = {} - # load the installed Makefile: - makefile = get_makefile_filename() - try: - _parse_makefile(makefile, vars) - except IOError, e: - msg = "invalid Python installation: unable to open %s" % makefile - if hasattr(e, "strerror"): - msg = msg + " (%s)" % e.strerror - raise IOError(msg) - - # load the installed pyconfig.h: - config_h = get_config_h_filename() - try: - with open(config_h) as f: - parse_config_h(f, vars) - except IOError, e: - msg = "invalid Python installation: unable to open %s" % config_h - if hasattr(e, "strerror"): - msg = msg + " (%s)" % e.strerror - raise IOError(msg) - - # On AIX, there are wrong paths to the linker scripts in the Makefile - # -- these paths are relative to the Python source, but when installed - # the scripts are in another directory. - if _PYTHON_BUILD: - vars['LDSHARED'] = vars['BLDSHARED'] - - # There's a chicken-and-egg situation on OS X with regards to the - # _sysconfigdata module after the changes introduced by #15298: - # get_config_vars() is called by get_platform() as part of the - # `make pybuilddir.txt` target -- which is a precursor to the - # _sysconfigdata.py module being constructed. Unfortunately, - # get_config_vars() eventually calls _init_posix(), which attempts - # to import _sysconfigdata, which we won't have built yet. In order - # for _init_posix() to work, if we're on Darwin, just mock up the - # _sysconfigdata module manually and populate it with the build vars. - # This is more than sufficient for ensuring the subsequent call to - # get_platform() succeeds. - name = '_sysconfigdata' - if 'darwin' in sys.platform: - import imp - module = imp.new_module(name) - module.build_time_vars = vars - sys.modules[name] = module - - pybuilddir = 'build/lib.%s-%s' % (get_platform(), sys.version[:3]) - if hasattr(sys, "gettotalrefcount"): - pybuilddir += '-pydebug' - try: - os.makedirs(pybuilddir) - except OSError: - pass - destfile = os.path.join(pybuilddir, name + '.py') - - with open(destfile, 'wb') as f: - f.write('# system configuration generated and used by' - ' the sysconfig module\n') - f.write('build_time_vars = ') - pprint.pprint(vars, stream=f) - - # Create file used for sys.path fixup -- see Modules/getpath.c - with open('pybuilddir.txt', 'w') as f: - f.write(pybuilddir) - -def _init_posix(vars): - """Initialize the module as appropriate for POSIX systems.""" - # _sysconfigdata is generated at build time, see _generate_posix_vars() - from _sysconfigdata import build_time_vars - vars.update(build_time_vars) - -def _init_non_posix(vars): - """Initialize the module as appropriate for NT""" - # set basic install directories - vars['LIBDEST'] = get_path('stdlib') - vars['BINLIBDEST'] = get_path('platstdlib') - vars['INCLUDEPY'] = get_path('include') - vars['SO'] = '.pyd' - vars['EXE'] = '.exe' - vars['VERSION'] = _PY_VERSION_SHORT_NO_DOT - vars['BINDIR'] = os.path.dirname(_safe_realpath(sys.executable)) - -# -# public APIs -# - - -def parse_config_h(fp, vars=None): - """Parse a config.h-style file. - - A dictionary containing name/value pairs is returned. If an - optional dictionary is passed in as the second argument, it is - used instead of a new dictionary. - """ - import re - if vars is None: - vars = {} - define_rx = re.compile("#define ([A-Z][A-Za-z0-9_]+) (.*)\n") - undef_rx = re.compile("/[*] #undef ([A-Z][A-Za-z0-9_]+) [*]/\n") - - while True: - line = fp.readline() - if not line: - break - m = define_rx.match(line) - if m: - n, v = m.group(1, 2) - try: v = int(v) - except ValueError: pass - vars[n] = v - else: - m = undef_rx.match(line) - if m: - vars[m.group(1)] = 0 - return vars - -def get_config_h_filename(): - """Returns the path of pyconfig.h.""" - if _PYTHON_BUILD: - if os.name == "nt": - inc_dir = os.path.join(_PROJECT_BASE, "PC") - else: - inc_dir = _PROJECT_BASE - else: - inc_dir = get_path('platinclude') - return os.path.join(inc_dir, 'pyconfig.h') - -def get_scheme_names(): - """Returns a tuple containing the schemes names.""" - schemes = _INSTALL_SCHEMES.keys() - schemes.sort() - return tuple(schemes) - -def get_path_names(): - """Returns a tuple containing the paths names.""" - return _SCHEME_KEYS - -def get_paths(scheme=_get_default_scheme(), vars=None, expand=True): - """Returns a mapping containing an install scheme. - - ``scheme`` is the install scheme name. If not provided, it will - return the default scheme for the current platform. - """ - if expand: - return _expand_vars(scheme, vars) - else: - return _INSTALL_SCHEMES[scheme] - -def get_path(name, scheme=_get_default_scheme(), vars=None, expand=True): - """Returns a path corresponding to the scheme. - - ``scheme`` is the install scheme name. - """ - return get_paths(scheme, vars, expand)[name] - -def get_config_vars(*args): - """With no arguments, return a dictionary of all configuration - variables relevant for the current platform. - - On Unix, this means every variable defined in Python's installed Makefile; - On Windows and Mac OS it's a much smaller set. - - With arguments, return a list of values that result from looking up - each argument in the configuration variable dictionary. - """ - import re - global _CONFIG_VARS - if _CONFIG_VARS is None: - _CONFIG_VARS = {} - # Normalized versions of prefix and exec_prefix are handy to have; - # in fact, these are the standard versions used most places in the - # Distutils. - _CONFIG_VARS['prefix'] = _PREFIX - _CONFIG_VARS['exec_prefix'] = _EXEC_PREFIX - _CONFIG_VARS['py_version'] = _PY_VERSION - _CONFIG_VARS['py_version_short'] = _PY_VERSION_SHORT - _CONFIG_VARS['py_version_nodot'] = _PY_VERSION[0] + _PY_VERSION[2] - _CONFIG_VARS['base'] = _PREFIX - _CONFIG_VARS['platbase'] = _EXEC_PREFIX - _CONFIG_VARS['projectbase'] = _PROJECT_BASE - - if os.name in ('nt', 'os2'): - _init_non_posix(_CONFIG_VARS) - if os.name == 'posix': - _init_posix(_CONFIG_VARS) - - # Setting 'userbase' is done below the call to the - # init function to enable using 'get_config_var' in - # the init-function. - _CONFIG_VARS['userbase'] = _getuserbase() - - if 'srcdir' not in _CONFIG_VARS: - _CONFIG_VARS['srcdir'] = _PROJECT_BASE - - # Convert srcdir into an absolute path if it appears necessary. - # Normally it is relative to the build directory. However, during - # testing, for example, we might be running a non-installed python - # from a different directory. - if _PYTHON_BUILD and os.name == "posix": - base = _PROJECT_BASE - try: - cwd = os.getcwd() - except OSError: - cwd = None - if (not os.path.isabs(_CONFIG_VARS['srcdir']) and - base != cwd): - # srcdir is relative and we are not in the same directory - # as the executable. Assume executable is in the build - # directory and make srcdir absolute. - srcdir = os.path.join(base, _CONFIG_VARS['srcdir']) - _CONFIG_VARS['srcdir'] = os.path.normpath(srcdir) - - # OS X platforms require special customization to handle - # multi-architecture, multi-os-version installers - if sys.platform == 'darwin': - import _osx_support - _osx_support.customize_config_vars(_CONFIG_VARS) - - if args: - vals = [] - for name in args: - vals.append(_CONFIG_VARS.get(name)) - return vals - else: - return _CONFIG_VARS - -def get_config_var(name): - """Return the value of a single variable using the dictionary returned by - 'get_config_vars()'. - - Equivalent to get_config_vars().get(name) - """ - return get_config_vars().get(name) - -def get_platform(): - """Return a string that identifies the current platform. - - This is used mainly to distinguish platform-specific build directories and - platform-specific built distributions. Typically includes the OS name - and version and the architecture (as supplied by 'os.uname()'), - although the exact information included depends on the OS; eg. for IRIX - the architecture isn't particularly important (IRIX only runs on SGI - hardware), but for Linux the kernel version isn't particularly - important. - - Examples of returned values: - linux-i586 - linux-alpha (?) - solaris-2.6-sun4u - irix-5.3 - irix64-6.2 - - Windows will return one of: - win-amd64 (64bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc) - win-ia64 (64bit Windows on Itanium) - win32 (all others - specifically, sys.platform is returned) - - For other non-POSIX platforms, currently just returns 'sys.platform'. - """ - import re - if os.name == 'nt': - # sniff sys.version for architecture. - prefix = " bit (" - i = sys.version.find(prefix) - if i == -1: - return sys.platform - j = sys.version.find(")", i) - look = sys.version[i+len(prefix):j].lower() - if look == 'amd64': - return 'win-amd64' - if look == 'itanium': - return 'win-ia64' - return sys.platform - - # Set for cross builds explicitly - if "_PYTHON_HOST_PLATFORM" in os.environ: - return os.environ["_PYTHON_HOST_PLATFORM"] - - if os.name != "posix" or not hasattr(os, 'uname'): - # XXX what about the architecture? NT is Intel or Alpha, - # Mac OS is M68k or PPC, etc. - return sys.platform - - # Try to distinguish various flavours of Unix - osname, host, release, version, machine = os.uname() - - # Convert the OS name to lowercase, remove '/' characters - # (to accommodate BSD/OS), and translate spaces (for "Power Macintosh") - osname = osname.lower().replace('/', '') - machine = machine.replace(' ', '_') - machine = machine.replace('/', '-') - - if osname[:5] == "linux": - # At least on Linux/Intel, 'machine' is the processor -- - # i386, etc. - # XXX what about Alpha, SPARC, etc? - return "%s-%s" % (osname, machine) - elif osname[:5] == "sunos": - if release[0] >= "5": # SunOS 5 == Solaris 2 - osname = "solaris" - release = "%d.%s" % (int(release[0]) - 3, release[2:]) - # We can't use "platform.architecture()[0]" because a - # bootstrap problem. We use a dict to get an error - # if some suspicious happens. - bitness = {2147483647:"32bit", 9223372036854775807:"64bit"} - machine += ".%s" % bitness[sys.maxint] - # fall through to standard osname-release-machine representation - elif osname[:4] == "irix": # could be "irix64"! - return "%s-%s" % (osname, release) - elif osname[:3] == "aix": - return "%s-%s.%s" % (osname, version, release) - elif osname[:6] == "cygwin": - osname = "cygwin" - rel_re = re.compile (r'[\d.]+') - m = rel_re.match(release) - if m: - release = m.group() - elif osname[:6] == "darwin": - import _osx_support - osname, release, machine = _osx_support.get_platform_osx( - get_config_vars(), - osname, release, machine) - - return "%s-%s-%s" % (osname, release, machine) - - -def get_python_version(): - return _PY_VERSION_SHORT - - -def _print_dict(title, data): - for index, (key, value) in enumerate(sorted(data.items())): - if index == 0: - print '%s: ' % (title) - print '\t%s = "%s"' % (key, value) - - -def _main(): - """Display all information sysconfig detains.""" - if '--generate-posix-vars' in sys.argv: - _generate_posix_vars() - return - print 'Platform: "%s"' % get_platform() - print 'Python version: "%s"' % get_python_version() - print 'Current installation scheme: "%s"' % _get_default_scheme() - print - _print_dict('Paths', get_paths()) - print - _print_dict('Variables', get_config_vars()) - - -if __name__ == '__main__': - _main() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py deleted file mode 100644 index 131de9b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/textwrap.py +++ /dev/null @@ -1,425 +0,0 @@ -"""Text wrapping and filling. -""" - -# Copyright (C) 1999-2001 Gregory P. Ward. -# Copyright (C) 2002, 2003 Python Software Foundation. -# Written by Greg Ward - -__revision__ = "$Id$" - -import string, re - -try: - _unicode = unicode -except NameError: - # If Python is built without Unicode support, the unicode type - # will not exist. Fake one. - class _unicode(object): - pass - -# Do the right thing with boolean values for all known Python versions -# (so this module can be copied to projects that don't depend on Python -# 2.3, e.g. Optik and Docutils) by uncommenting the block of code below. -#try: -# True, False -#except NameError: -# (True, False) = (1, 0) - -__all__ = ['TextWrapper', 'wrap', 'fill', 'dedent'] - -# Hardcode the recognized whitespace characters to the US-ASCII -# whitespace characters. The main reason for doing this is that in -# ISO-8859-1, 0xa0 is non-breaking whitespace, so in certain locales -# that character winds up in string.whitespace. Respecting -# string.whitespace in those cases would 1) make textwrap treat 0xa0 the -# same as any other whitespace char, which is clearly wrong (it's a -# *non-breaking* space), 2) possibly cause problems with Unicode, -# since 0xa0 is not in range(128). -_whitespace = '\t\n\x0b\x0c\r ' - -class TextWrapper: - """ - Object for wrapping/filling text. The public interface consists of - the wrap() and fill() methods; the other methods are just there for - subclasses to override in order to tweak the default behaviour. - If you want to completely replace the main wrapping algorithm, - you'll probably have to override _wrap_chunks(). - - Several instance attributes control various aspects of wrapping: - width (default: 70) - the maximum width of wrapped lines (unless break_long_words - is false) - initial_indent (default: "") - string that will be prepended to the first line of wrapped - output. Counts towards the line's width. - subsequent_indent (default: "") - string that will be prepended to all lines save the first - of wrapped output; also counts towards each line's width. - expand_tabs (default: true) - Expand tabs in input text to spaces before further processing. - Each tab will become 1 .. 8 spaces, depending on its position in - its line. If false, each tab is treated as a single character. - replace_whitespace (default: true) - Replace all whitespace characters in the input text by spaces - after tab expansion. Note that if expand_tabs is false and - replace_whitespace is true, every tab will be converted to a - single space! - fix_sentence_endings (default: false) - Ensure that sentence-ending punctuation is always followed - by two spaces. Off by default because the algorithm is - (unavoidably) imperfect. - break_long_words (default: true) - Break words longer than 'width'. If false, those words will not - be broken, and some lines might be longer than 'width'. - break_on_hyphens (default: true) - Allow breaking hyphenated words. If true, wrapping will occur - preferably on whitespaces and right after hyphens part of - compound words. - drop_whitespace (default: true) - Drop leading and trailing whitespace from lines. - """ - - whitespace_trans = string.maketrans(_whitespace, ' ' * len(_whitespace)) - - unicode_whitespace_trans = {} - uspace = ord(u' ') - for x in map(ord, _whitespace): - unicode_whitespace_trans[x] = uspace - - # This funky little regex is just the trick for splitting - # text up into word-wrappable chunks. E.g. - # "Hello there -- you goof-ball, use the -b option!" - # splits into - # Hello/ /there/ /--/ /you/ /goof-/ball,/ /use/ /the/ /-b/ /option! - # (after stripping out empty strings). - wordsep_re = re.compile( - r'(\s+|' # any whitespace - r'[^\s\w]*\w+[^0-9\W]-(?=\w+[^0-9\W])|' # hyphenated words - r'(?<=[\w\!\"\'\&\.\,\?])-{2,}(?=\w))') # em-dash - - # This less funky little regex just split on recognized spaces. E.g. - # "Hello there -- you goof-ball, use the -b option!" - # splits into - # Hello/ /there/ /--/ /you/ /goof-ball,/ /use/ /the/ /-b/ /option!/ - wordsep_simple_re = re.compile(r'(\s+)') - - # XXX this is not locale- or charset-aware -- string.lowercase - # is US-ASCII only (and therefore English-only) - sentence_end_re = re.compile(r'[%s]' # lowercase letter - r'[\.\!\?]' # sentence-ending punct. - r'[\"\']?' # optional end-of-quote - r'\Z' # end of chunk - % string.lowercase) - - - def __init__(self, - width=70, - initial_indent="", - subsequent_indent="", - expand_tabs=True, - replace_whitespace=True, - fix_sentence_endings=False, - break_long_words=True, - drop_whitespace=True, - break_on_hyphens=True): - self.width = width - self.initial_indent = initial_indent - self.subsequent_indent = subsequent_indent - self.expand_tabs = expand_tabs - self.replace_whitespace = replace_whitespace - self.fix_sentence_endings = fix_sentence_endings - self.break_long_words = break_long_words - self.drop_whitespace = drop_whitespace - self.break_on_hyphens = break_on_hyphens - - # recompile the regexes for Unicode mode -- done in this clumsy way for - # backwards compatibility because it's rather common to monkey-patch - # the TextWrapper class' wordsep_re attribute. - self.wordsep_re_uni = re.compile(self.wordsep_re.pattern, re.U) - self.wordsep_simple_re_uni = re.compile( - self.wordsep_simple_re.pattern, re.U) - - - # -- Private methods ----------------------------------------------- - # (possibly useful for subclasses to override) - - def _munge_whitespace(self, text): - """_munge_whitespace(text : string) -> string - - Munge whitespace in text: expand tabs and convert all other - whitespace characters to spaces. Eg. " foo\\tbar\\n\\nbaz" - becomes " foo bar baz". - """ - if self.expand_tabs: - text = text.expandtabs() - if self.replace_whitespace: - if isinstance(text, str): - text = text.translate(self.whitespace_trans) - elif isinstance(text, _unicode): - text = text.translate(self.unicode_whitespace_trans) - return text - - - def _split(self, text): - """_split(text : string) -> [string] - - Split the text to wrap into indivisible chunks. Chunks are - not quite the same as words; see _wrap_chunks() for full - details. As an example, the text - Look, goof-ball -- use the -b option! - breaks into the following chunks: - 'Look,', ' ', 'goof-', 'ball', ' ', '--', ' ', - 'use', ' ', 'the', ' ', '-b', ' ', 'option!' - if break_on_hyphens is True, or in: - 'Look,', ' ', 'goof-ball', ' ', '--', ' ', - 'use', ' ', 'the', ' ', '-b', ' ', option!' - otherwise. - """ - if isinstance(text, _unicode): - if self.break_on_hyphens: - pat = self.wordsep_re_uni - else: - pat = self.wordsep_simple_re_uni - else: - if self.break_on_hyphens: - pat = self.wordsep_re - else: - pat = self.wordsep_simple_re - chunks = pat.split(text) - chunks = filter(None, chunks) # remove empty chunks - return chunks - - def _fix_sentence_endings(self, chunks): - """_fix_sentence_endings(chunks : [string]) - - Correct for sentence endings buried in 'chunks'. Eg. when the - original text contains "... foo.\\nBar ...", munge_whitespace() - and split() will convert that to [..., "foo.", " ", "Bar", ...] - which has one too few spaces; this method simply changes the one - space to two. - """ - i = 0 - patsearch = self.sentence_end_re.search - while i < len(chunks)-1: - if chunks[i+1] == " " and patsearch(chunks[i]): - chunks[i+1] = " " - i += 2 - else: - i += 1 - - def _handle_long_word(self, reversed_chunks, cur_line, cur_len, width): - """_handle_long_word(chunks : [string], - cur_line : [string], - cur_len : int, width : int) - - Handle a chunk of text (most likely a word, not whitespace) that - is too long to fit in any line. - """ - # Figure out when indent is larger than the specified width, and make - # sure at least one character is stripped off on every pass - if width < 1: - space_left = 1 - else: - space_left = width - cur_len - - # If we're allowed to break long words, then do so: put as much - # of the next chunk onto the current line as will fit. - if self.break_long_words: - cur_line.append(reversed_chunks[-1][:space_left]) - reversed_chunks[-1] = reversed_chunks[-1][space_left:] - - # Otherwise, we have to preserve the long word intact. Only add - # it to the current line if there's nothing already there -- - # that minimizes how much we violate the width constraint. - elif not cur_line: - cur_line.append(reversed_chunks.pop()) - - # If we're not allowed to break long words, and there's already - # text on the current line, do nothing. Next time through the - # main loop of _wrap_chunks(), we'll wind up here again, but - # cur_len will be zero, so the next line will be entirely - # devoted to the long word that we can't handle right now. - - def _wrap_chunks(self, chunks): - """_wrap_chunks(chunks : [string]) -> [string] - - Wrap a sequence of text chunks and return a list of lines of - length 'self.width' or less. (If 'break_long_words' is false, - some lines may be longer than this.) Chunks correspond roughly - to words and the whitespace between them: each chunk is - indivisible (modulo 'break_long_words'), but a line break can - come between any two chunks. Chunks should not have internal - whitespace; ie. a chunk is either all whitespace or a "word". - Whitespace chunks will be removed from the beginning and end of - lines, but apart from that whitespace is preserved. - """ - lines = [] - if self.width <= 0: - raise ValueError("invalid width %r (must be > 0)" % self.width) - - # Arrange in reverse order so items can be efficiently popped - # from a stack of chucks. - chunks.reverse() - - while chunks: - - # Start the list of chunks that will make up the current line. - # cur_len is just the length of all the chunks in cur_line. - cur_line = [] - cur_len = 0 - - # Figure out which static string will prefix this line. - if lines: - indent = self.subsequent_indent - else: - indent = self.initial_indent - - # Maximum width for this line. - width = self.width - len(indent) - - # First chunk on line is whitespace -- drop it, unless this - # is the very beginning of the text (ie. no lines started yet). - if self.drop_whitespace and chunks[-1].strip() == '' and lines: - del chunks[-1] - - while chunks: - l = len(chunks[-1]) - - # Can at least squeeze this chunk onto the current line. - if cur_len + l <= width: - cur_line.append(chunks.pop()) - cur_len += l - - # Nope, this line is full. - else: - break - - # The current line is full, and the next chunk is too big to - # fit on *any* line (not just this one). - if chunks and len(chunks[-1]) > width: - self._handle_long_word(chunks, cur_line, cur_len, width) - - # If the last chunk on this line is all whitespace, drop it. - if self.drop_whitespace and cur_line and cur_line[-1].strip() == '': - del cur_line[-1] - - # Convert current line back to a string and store it in list - # of all lines (return value). - if cur_line: - lines.append(indent + ''.join(cur_line)) - - return lines - - - # -- Public interface ---------------------------------------------- - - def wrap(self, text): - """wrap(text : string) -> [string] - - Reformat the single paragraph in 'text' so it fits in lines of - no more than 'self.width' columns, and return a list of wrapped - lines. Tabs in 'text' are expanded with string.expandtabs(), - and all other whitespace characters (including newline) are - converted to space. - """ - text = self._munge_whitespace(text) - chunks = self._split(text) - if self.fix_sentence_endings: - self._fix_sentence_endings(chunks) - return self._wrap_chunks(chunks) - - def fill(self, text): - """fill(text : string) -> string - - Reformat the single paragraph in 'text' to fit in lines of no - more than 'self.width' columns, and return a new string - containing the entire wrapped paragraph. - """ - return "\n".join(self.wrap(text)) - - -# -- Convenience interface --------------------------------------------- - -def wrap(text, width=70, **kwargs): - """Wrap a single paragraph of text, returning a list of wrapped lines. - - Reformat the single paragraph in 'text' so it fits in lines of no - more than 'width' columns, and return a list of wrapped lines. By - default, tabs in 'text' are expanded with string.expandtabs(), and - all other whitespace characters (including newline) are converted to - space. See TextWrapper class for available keyword args to customize - wrapping behaviour. - """ - w = TextWrapper(width=width, **kwargs) - return w.wrap(text) - -def fill(text, width=70, **kwargs): - """Fill a single paragraph of text, returning a new string. - - Reformat the single paragraph in 'text' to fit in lines of no more - than 'width' columns, and return a new string containing the entire - wrapped paragraph. As with wrap(), tabs are expanded and other - whitespace characters converted to space. See TextWrapper class for - available keyword args to customize wrapping behaviour. - """ - w = TextWrapper(width=width, **kwargs) - return w.fill(text) - - -# -- Loosely related functionality ------------------------------------- - -_whitespace_only_re = re.compile('^[ \t]+$', re.MULTILINE) -_leading_whitespace_re = re.compile('(^[ \t]*)(?:[^ \t\n])', re.MULTILINE) - -def dedent(text): - """Remove any common leading whitespace from every line in `text`. - - This can be used to make triple-quoted strings line up with the left - edge of the display, while still presenting them in the source code - in indented form. - - Note that tabs and spaces are both treated as whitespace, but they - are not equal: the lines " hello" and "\\thello" are - considered to have no common leading whitespace. (This behaviour is - new in Python 2.5; older versions of this module incorrectly - expanded tabs before searching for common leading whitespace.) - """ - # Look for the longest leading string of spaces and tabs common to - # all lines. - margin = None - text = _whitespace_only_re.sub('', text) - indents = _leading_whitespace_re.findall(text) - for indent in indents: - if margin is None: - margin = indent - - # Current line more deeply indented than previous winner: - # no change (previous winner is still on top). - elif indent.startswith(margin): - pass - - # Current line consistent with and no deeper than previous winner: - # it's the new winner. - elif margin.startswith(indent): - margin = indent - - # Current line and previous winner have no common whitespace: - # there is no margin. - else: - margin = "" - break - - # sanity check (testing/debugging only) - if 0 and margin: - for line in text.split("\n"): - assert not line or line.startswith(margin), \ - "line = %r, margin = %r" % (line, margin) - - if margin: - text = re.sub(r'(?m)^' + margin, '', text) - return text - -if __name__ == "__main__": - #print dedent("\tfoo\n\tbar") - #print dedent(" \thello there\n \t how are you?") - print dedent("Hello there.\n This is indented.") diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/token.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/token.py deleted file mode 100644 index 7808128..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/token.py +++ /dev/null @@ -1,140 +0,0 @@ -"""Token constants (from "token.h").""" - -# This file is automatically generated; please don't muck it up! -# -# To update the symbols in this file, 'cd' to the top directory of -# the python source tree after building the interpreter and run: -# -# ./python Lib/token.py - -#--start constants-- -ENDMARKER = 0 -NAME = 1 -NUMBER = 2 -STRING = 3 -NEWLINE = 4 -INDENT = 5 -DEDENT = 6 -LPAR = 7 -RPAR = 8 -LSQB = 9 -RSQB = 10 -COLON = 11 -COMMA = 12 -SEMI = 13 -PLUS = 14 -MINUS = 15 -STAR = 16 -SLASH = 17 -VBAR = 18 -AMPER = 19 -LESS = 20 -GREATER = 21 -EQUAL = 22 -DOT = 23 -PERCENT = 24 -BACKQUOTE = 25 -LBRACE = 26 -RBRACE = 27 -EQEQUAL = 28 -NOTEQUAL = 29 -LESSEQUAL = 30 -GREATEREQUAL = 31 -TILDE = 32 -CIRCUMFLEX = 33 -LEFTSHIFT = 34 -RIGHTSHIFT = 35 -DOUBLESTAR = 36 -PLUSEQUAL = 37 -MINEQUAL = 38 -STAREQUAL = 39 -SLASHEQUAL = 40 -PERCENTEQUAL = 41 -AMPEREQUAL = 42 -VBAREQUAL = 43 -CIRCUMFLEXEQUAL = 44 -LEFTSHIFTEQUAL = 45 -RIGHTSHIFTEQUAL = 46 -DOUBLESTAREQUAL = 47 -DOUBLESLASH = 48 -DOUBLESLASHEQUAL = 49 -AT = 50 -OP = 51 -ERRORTOKEN = 52 -N_TOKENS = 53 -NT_OFFSET = 256 -#--end constants-- - -tok_name = {} -for _name, _value in globals().items(): - if type(_value) is type(0): - tok_name[_value] = _name -del _name, _value - - -def ISTERMINAL(x): - return x < NT_OFFSET - -def ISNONTERMINAL(x): - return x >= NT_OFFSET - -def ISEOF(x): - return x == ENDMARKER - - -def main(): - import re - import sys - args = sys.argv[1:] - inFileName = args and args[0] or "Include/token.h" - outFileName = "Lib/token.py" - if len(args) > 1: - outFileName = args[1] - try: - fp = open(inFileName) - except IOError, err: - sys.stdout.write("I/O error: %s\n" % str(err)) - sys.exit(1) - lines = fp.read().split("\n") - fp.close() - prog = re.compile( - "#define[ \t][ \t]*([A-Z0-9][A-Z0-9_]*)[ \t][ \t]*([0-9][0-9]*)", - re.IGNORECASE) - tokens = {} - for line in lines: - match = prog.match(line) - if match: - name, val = match.group(1, 2) - val = int(val) - tokens[val] = name # reverse so we can sort them... - keys = tokens.keys() - keys.sort() - # load the output skeleton from the target: - try: - fp = open(outFileName) - except IOError, err: - sys.stderr.write("I/O error: %s\n" % str(err)) - sys.exit(2) - format = fp.read().split("\n") - fp.close() - try: - start = format.index("#--start constants--") + 1 - end = format.index("#--end constants--") - except ValueError: - sys.stderr.write("target does not contain format markers") - sys.exit(3) - lines = [] - for val in keys: - lines.append("%s = %d" % (tokens[val], val)) - format[start:end] = lines - try: - fp = open(outFileName, 'w') - except IOError, err: - sys.stderr.write("I/O error: %s\n" % str(err)) - sys.exit(4) - fp.write("\n".join(format)) - fp.close() - - -if __name__ == "__main__": - main() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py deleted file mode 100644 index 9e7e1dc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/tokenize.py +++ /dev/null @@ -1,432 +0,0 @@ -"""Tokenization help for Python programs. - -generate_tokens(readline) is a generator that breaks a stream of -text into Python tokens. It accepts a readline-like method which is called -repeatedly to get the next line of input (or "" for EOF). It generates -5-tuples with these members: - - the token type (see token.py) - the token (a string) - the starting (row, column) indices of the token (a 2-tuple of ints) - the ending (row, column) indices of the token (a 2-tuple of ints) - the original line (string) - -It is designed to match the working of the Python tokenizer exactly, except -that it produces COMMENT tokens for comments and gives type OP for all -operators - -Older entry points - tokenize_loop(readline, tokeneater) - tokenize(readline, tokeneater=printtoken) -are the same, except instead of generating tokens, tokeneater is a callback -function to which the 5 fields described above are passed as 5 arguments, -each time a new token is found.""" - -__author__ = 'Ka-Ping Yee ' -__credits__ = ('GvR, ESR, Tim Peters, Thomas Wouters, Fred Drake, ' - 'Skip Montanaro, Raymond Hettinger') - -from itertools import chain -import string, re -from token import * - -import token -__all__ = [x for x in dir(token) if not x.startswith("_")] -__all__ += ["COMMENT", "tokenize", "generate_tokens", "NL", "untokenize"] -del x -del token - -COMMENT = N_TOKENS -tok_name[COMMENT] = 'COMMENT' -NL = N_TOKENS + 1 -tok_name[NL] = 'NL' -N_TOKENS += 2 - -def group(*choices): return '(' + '|'.join(choices) + ')' -def any(*choices): return group(*choices) + '*' -def maybe(*choices): return group(*choices) + '?' - -Whitespace = r'[ \f\t]*' -Comment = r'#[^\r\n]*' -Ignore = Whitespace + any(r'\\\r?\n' + Whitespace) + maybe(Comment) -Name = r'[a-zA-Z_]\w*' - -Hexnumber = r'0[xX][\da-fA-F]+[lL]?' -Octnumber = r'(0[oO][0-7]+)|(0[0-7]*)[lL]?' -Binnumber = r'0[bB][01]+[lL]?' -Decnumber = r'[1-9]\d*[lL]?' -Intnumber = group(Hexnumber, Binnumber, Octnumber, Decnumber) -Exponent = r'[eE][-+]?\d+' -Pointfloat = group(r'\d+\.\d*', r'\.\d+') + maybe(Exponent) -Expfloat = r'\d+' + Exponent -Floatnumber = group(Pointfloat, Expfloat) -Imagnumber = group(r'\d+[jJ]', Floatnumber + r'[jJ]') -Number = group(Imagnumber, Floatnumber, Intnumber) - -# Tail end of ' string. -Single = r"[^'\\]*(?:\\.[^'\\]*)*'" -# Tail end of " string. -Double = r'[^"\\]*(?:\\.[^"\\]*)*"' -# Tail end of ''' string. -Single3 = r"[^'\\]*(?:(?:\\.|'(?!''))[^'\\]*)*'''" -# Tail end of """ string. -Double3 = r'[^"\\]*(?:(?:\\.|"(?!""))[^"\\]*)*"""' -Triple = group("[uUbB]?[rR]?'''", '[uUbB]?[rR]?"""') -# Single-line ' or " string. -String = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*'", - r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*"') - -# Because of leftmost-then-longest match semantics, be sure to put the -# longest operators first (e.g., if = came before ==, == would get -# recognized as two instances of =). -Operator = group(r"\*\*=?", r">>=?", r"<<=?", r"<>", r"!=", - r"//=?", - r"[+\-*/%&|^=<>]=?", - r"~") - -Bracket = '[][(){}]' -Special = group(r'\r?\n', r'[:;.,`@]') -Funny = group(Operator, Bracket, Special) - -PlainToken = group(Number, Funny, String, Name) -Token = Ignore + PlainToken - -# First (or only) line of ' or " string. -ContStr = group(r"[uUbB]?[rR]?'[^\n'\\]*(?:\\.[^\n'\\]*)*" + - group("'", r'\\\r?\n'), - r'[uUbB]?[rR]?"[^\n"\\]*(?:\\.[^\n"\\]*)*' + - group('"', r'\\\r?\n')) -PseudoExtras = group(r'\\\r?\n|\Z', Comment, Triple) -PseudoToken = Whitespace + group(PseudoExtras, Number, Funny, ContStr, Name) - -tokenprog, pseudoprog, single3prog, double3prog = map( - re.compile, (Token, PseudoToken, Single3, Double3)) -endprogs = {"'": re.compile(Single), '"': re.compile(Double), - "'''": single3prog, '"""': double3prog, - "r'''": single3prog, 'r"""': double3prog, - "u'''": single3prog, 'u"""': double3prog, - "ur'''": single3prog, 'ur"""': double3prog, - "R'''": single3prog, 'R"""': double3prog, - "U'''": single3prog, 'U"""': double3prog, - "uR'''": single3prog, 'uR"""': double3prog, - "Ur'''": single3prog, 'Ur"""': double3prog, - "UR'''": single3prog, 'UR"""': double3prog, - "b'''": single3prog, 'b"""': double3prog, - "br'''": single3prog, 'br"""': double3prog, - "B'''": single3prog, 'B"""': double3prog, - "bR'''": single3prog, 'bR"""': double3prog, - "Br'''": single3prog, 'Br"""': double3prog, - "BR'''": single3prog, 'BR"""': double3prog, - 'r': None, 'R': None, 'u': None, 'U': None, - 'b': None, 'B': None} - -triple_quoted = {} -for t in ("'''", '"""', - "r'''", 'r"""', "R'''", 'R"""', - "u'''", 'u"""', "U'''", 'U"""', - "ur'''", 'ur"""', "Ur'''", 'Ur"""', - "uR'''", 'uR"""', "UR'''", 'UR"""', - "b'''", 'b"""', "B'''", 'B"""', - "br'''", 'br"""', "Br'''", 'Br"""', - "bR'''", 'bR"""', "BR'''", 'BR"""'): - triple_quoted[t] = t -single_quoted = {} -for t in ("'", '"', - "r'", 'r"', "R'", 'R"', - "u'", 'u"', "U'", 'U"', - "ur'", 'ur"', "Ur'", 'Ur"', - "uR'", 'uR"', "UR'", 'UR"', - "b'", 'b"', "B'", 'B"', - "br'", 'br"', "Br'", 'Br"', - "bR'", 'bR"', "BR'", 'BR"' ): - single_quoted[t] = t - -tabsize = 8 - -class TokenError(Exception): pass - -class StopTokenizing(Exception): pass - -def printtoken(type, token, srow_scol, erow_ecol, line): # for testing - srow, scol = srow_scol - erow, ecol = erow_ecol - print "%d,%d-%d,%d:\t%s\t%s" % \ - (srow, scol, erow, ecol, tok_name[type], repr(token)) - -def tokenize(readline, tokeneater=printtoken): - """ - The tokenize() function accepts two parameters: one representing the - input stream, and one providing an output mechanism for tokenize(). - - The first parameter, readline, must be a callable object which provides - the same interface as the readline() method of built-in file objects. - Each call to the function should return one line of input as a string. - - The second parameter, tokeneater, must also be a callable object. It is - called once for each token, with five arguments, corresponding to the - tuples generated by generate_tokens(). - """ - try: - tokenize_loop(readline, tokeneater) - except StopTokenizing: - pass - -# backwards compatible interface -def tokenize_loop(readline, tokeneater): - for token_info in generate_tokens(readline): - tokeneater(*token_info) - -class Untokenizer: - - def __init__(self): - self.tokens = [] - self.prev_row = 1 - self.prev_col = 0 - - def add_whitespace(self, start): - row, col = start - if row < self.prev_row or row == self.prev_row and col < self.prev_col: - raise ValueError("start ({},{}) precedes previous end ({},{})" - .format(row, col, self.prev_row, self.prev_col)) - row_offset = row - self.prev_row - if row_offset: - self.tokens.append("\\\n" * row_offset) - self.prev_col = 0 - col_offset = col - self.prev_col - if col_offset: - self.tokens.append(" " * col_offset) - - def untokenize(self, iterable): - it = iter(iterable) - for t in it: - if len(t) == 2: - self.compat(t, it) - break - tok_type, token, start, end, line = t - if tok_type == ENDMARKER: - break - self.add_whitespace(start) - self.tokens.append(token) - self.prev_row, self.prev_col = end - if tok_type in (NEWLINE, NL): - self.prev_row += 1 - self.prev_col = 0 - return "".join(self.tokens) - - def compat(self, token, iterable): - indents = [] - toks_append = self.tokens.append - startline = token[0] in (NEWLINE, NL) - prevstring = False - - for tok in chain([token], iterable): - toknum, tokval = tok[:2] - - if toknum in (NAME, NUMBER): - tokval += ' ' - - # Insert a space between two consecutive strings - if toknum == STRING: - if prevstring: - tokval = ' ' + tokval - prevstring = True - else: - prevstring = False - - if toknum == INDENT: - indents.append(tokval) - continue - elif toknum == DEDENT: - indents.pop() - continue - elif toknum in (NEWLINE, NL): - startline = True - elif startline and indents: - toks_append(indents[-1]) - startline = False - toks_append(tokval) - -def untokenize(iterable): - """Transform tokens back into Python source code. - - Each element returned by the iterable must be a token sequence - with at least two elements, a token number and token value. If - only two tokens are passed, the resulting output is poor. - - Round-trip invariant for full input: - Untokenized source will match input source exactly - - Round-trip invariant for limited intput: - # Output text will tokenize the back to the input - t1 = [tok[:2] for tok in generate_tokens(f.readline)] - newcode = untokenize(t1) - readline = iter(newcode.splitlines(1)).next - t2 = [tok[:2] for tok in generate_tokens(readline)] - assert t1 == t2 - """ - ut = Untokenizer() - return ut.untokenize(iterable) - -def generate_tokens(readline): - """ - The generate_tokens() generator requires one argument, readline, which - must be a callable object which provides the same interface as the - readline() method of built-in file objects. Each call to the function - should return one line of input as a string. Alternately, readline - can be a callable function terminating with StopIteration: - readline = open(myfile).next # Example of alternate readline - - The generator produces 5-tuples with these members: the token type; the - token string; a 2-tuple (srow, scol) of ints specifying the row and - column where the token begins in the source; a 2-tuple (erow, ecol) of - ints specifying the row and column where the token ends in the source; - and the line on which the token was found. The line passed is the - logical line; continuation lines are included. - """ - lnum = parenlev = continued = 0 - namechars, numchars = string.ascii_letters + '_', '0123456789' - contstr, needcont = '', 0 - contline = None - indents = [0] - - while 1: # loop over lines in stream - try: - line = readline() - except StopIteration: - line = '' - lnum += 1 - pos, max = 0, len(line) - - if contstr: # continued string - if not line: - raise TokenError, ("EOF in multi-line string", strstart) - endmatch = endprog.match(line) - if endmatch: - pos = end = endmatch.end(0) - yield (STRING, contstr + line[:end], - strstart, (lnum, end), contline + line) - contstr, needcont = '', 0 - contline = None - elif needcont and line[-2:] != '\\\n' and line[-3:] != '\\\r\n': - yield (ERRORTOKEN, contstr + line, - strstart, (lnum, len(line)), contline) - contstr = '' - contline = None - continue - else: - contstr = contstr + line - contline = contline + line - continue - - elif parenlev == 0 and not continued: # new statement - if not line: break - column = 0 - while pos < max: # measure leading whitespace - if line[pos] == ' ': - column += 1 - elif line[pos] == '\t': - column = (column//tabsize + 1)*tabsize - elif line[pos] == '\f': - column = 0 - else: - break - pos += 1 - if pos == max: - break - - if line[pos] in '#\r\n': # skip comments or blank lines - if line[pos] == '#': - comment_token = line[pos:].rstrip('\r\n') - nl_pos = pos + len(comment_token) - yield (COMMENT, comment_token, - (lnum, pos), (lnum, pos + len(comment_token)), line) - yield (NL, line[nl_pos:], - (lnum, nl_pos), (lnum, len(line)), line) - else: - yield ((NL, COMMENT)[line[pos] == '#'], line[pos:], - (lnum, pos), (lnum, len(line)), line) - continue - - if column > indents[-1]: # count indents or dedents - indents.append(column) - yield (INDENT, line[:pos], (lnum, 0), (lnum, pos), line) - while column < indents[-1]: - if column not in indents: - raise IndentationError( - "unindent does not match any outer indentation level", - ("", lnum, pos, line)) - indents = indents[:-1] - yield (DEDENT, '', (lnum, pos), (lnum, pos), line) - - else: # continued statement - if not line: - raise TokenError, ("EOF in multi-line statement", (lnum, 0)) - continued = 0 - - while pos < max: - pseudomatch = pseudoprog.match(line, pos) - if pseudomatch: # scan for tokens - start, end = pseudomatch.span(1) - spos, epos, pos = (lnum, start), (lnum, end), end - if start == end: - continue - token, initial = line[start:end], line[start] - - if initial in numchars or \ - (initial == '.' and token != '.'): # ordinary number - yield (NUMBER, token, spos, epos, line) - elif initial in '\r\n': - yield (NL if parenlev > 0 else NEWLINE, - token, spos, epos, line) - elif initial == '#': - assert not token.endswith("\n") - yield (COMMENT, token, spos, epos, line) - elif token in triple_quoted: - endprog = endprogs[token] - endmatch = endprog.match(line, pos) - if endmatch: # all on one line - pos = endmatch.end(0) - token = line[start:pos] - yield (STRING, token, spos, (lnum, pos), line) - else: - strstart = (lnum, start) # multiple lines - contstr = line[start:] - contline = line - break - elif initial in single_quoted or \ - token[:2] in single_quoted or \ - token[:3] in single_quoted: - if token[-1] == '\n': # continued string - strstart = (lnum, start) - endprog = (endprogs[initial] or endprogs[token[1]] or - endprogs[token[2]]) - contstr, needcont = line[start:], 1 - contline = line - break - else: # ordinary string - yield (STRING, token, spos, epos, line) - elif initial in namechars: # ordinary name - yield (NAME, token, spos, epos, line) - elif initial == '\\': # continued stmt - continued = 1 - else: - if initial in '([{': - parenlev += 1 - elif initial in ')]}': - parenlev -= 1 - yield (OP, token, spos, epos, line) - else: - yield (ERRORTOKEN, line[pos], - (lnum, pos), (lnum, pos+1), line) - pos += 1 - - for indent in indents[1:]: # pop remaining indent levels - yield (DEDENT, '', (lnum, 0), (lnum, 0), '') - yield (ENDMARKER, '', (lnum, 0), (lnum, 0), '') - -if __name__ == '__main__': # testing - import sys - if len(sys.argv) > 1: - tokenize(open(sys.argv[1]).readline) - else: - tokenize(sys.stdin.readline) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py deleted file mode 100644 index 4e2b291..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/traceback.py +++ /dev/null @@ -1,320 +0,0 @@ -"""Extract, format and print information about Python stack traces.""" - -import linecache -import sys -import types - -__all__ = ['extract_stack', 'extract_tb', 'format_exception', - 'format_exception_only', 'format_list', 'format_stack', - 'format_tb', 'print_exc', 'format_exc', 'print_exception', - 'print_last', 'print_stack', 'print_tb', 'tb_lineno'] - -def _print(file, str='', terminator='\n'): - file.write(str+terminator) - - -def print_list(extracted_list, file=None): - """Print the list of tuples as returned by extract_tb() or - extract_stack() as a formatted stack trace to the given file.""" - if file is None: - file = sys.stderr - for filename, lineno, name, line in extracted_list: - _print(file, - ' File "%s", line %d, in %s' % (filename,lineno,name)) - if line: - _print(file, ' %s' % line.strip()) - -def format_list(extracted_list): - """Format a list of traceback entry tuples for printing. - - Given a list of tuples as returned by extract_tb() or - extract_stack(), return a list of strings ready for printing. - Each string in the resulting list corresponds to the item with the - same index in the argument list. Each string ends in a newline; - the strings may contain internal newlines as well, for those items - whose source text line is not None. - """ - list = [] - for filename, lineno, name, line in extracted_list: - item = ' File "%s", line %d, in %s\n' % (filename,lineno,name) - if line: - item = item + ' %s\n' % line.strip() - list.append(item) - return list - - -def print_tb(tb, limit=None, file=None): - """Print up to 'limit' stack trace entries from the traceback 'tb'. - - If 'limit' is omitted or None, all entries are printed. If 'file' - is omitted or None, the output goes to sys.stderr; otherwise - 'file' should be an open file or file-like object with a write() - method. - """ - if file is None: - file = sys.stderr - if limit is None: - if hasattr(sys, 'tracebacklimit'): - limit = sys.tracebacklimit - n = 0 - while tb is not None and (limit is None or n < limit): - f = tb.tb_frame - lineno = tb.tb_lineno - co = f.f_code - filename = co.co_filename - name = co.co_name - _print(file, - ' File "%s", line %d, in %s' % (filename, lineno, name)) - linecache.checkcache(filename) - line = linecache.getline(filename, lineno, f.f_globals) - if line: _print(file, ' ' + line.strip()) - tb = tb.tb_next - n = n+1 - -def format_tb(tb, limit = None): - """A shorthand for 'format_list(extract_tb(tb, limit))'.""" - return format_list(extract_tb(tb, limit)) - -def extract_tb(tb, limit = None): - """Return list of up to limit pre-processed entries from traceback. - - This is useful for alternate formatting of stack traces. If - 'limit' is omitted or None, all entries are extracted. A - pre-processed stack trace entry is a quadruple (filename, line - number, function name, text) representing the information that is - usually printed for a stack trace. The text is a string with - leading and trailing whitespace stripped; if the source is not - available it is None. - """ - if limit is None: - if hasattr(sys, 'tracebacklimit'): - limit = sys.tracebacklimit - list = [] - n = 0 - while tb is not None and (limit is None or n < limit): - f = tb.tb_frame - lineno = tb.tb_lineno - co = f.f_code - filename = co.co_filename - name = co.co_name - linecache.checkcache(filename) - line = linecache.getline(filename, lineno, f.f_globals) - if line: line = line.strip() - else: line = None - list.append((filename, lineno, name, line)) - tb = tb.tb_next - n = n+1 - return list - - -def print_exception(etype, value, tb, limit=None, file=None): - """Print exception up to 'limit' stack trace entries from 'tb' to 'file'. - - This differs from print_tb() in the following ways: (1) if - traceback is not None, it prints a header "Traceback (most recent - call last):"; (2) it prints the exception type and value after the - stack trace; (3) if type is SyntaxError and value has the - appropriate format, it prints the line where the syntax error - occurred with a caret on the next line indicating the approximate - position of the error. - """ - if file is None: - file = sys.stderr - if tb: - _print(file, 'Traceback (most recent call last):') - print_tb(tb, limit, file) - lines = format_exception_only(etype, value) - for line in lines: - _print(file, line, '') - -def format_exception(etype, value, tb, limit = None): - """Format a stack trace and the exception information. - - The arguments have the same meaning as the corresponding arguments - to print_exception(). The return value is a list of strings, each - ending in a newline and some containing internal newlines. When - these lines are concatenated and printed, exactly the same text is - printed as does print_exception(). - """ - if tb: - list = ['Traceback (most recent call last):\n'] - list = list + format_tb(tb, limit) - else: - list = [] - list = list + format_exception_only(etype, value) - return list - -def format_exception_only(etype, value): - """Format the exception part of a traceback. - - The arguments are the exception type and value such as given by - sys.last_type and sys.last_value. The return value is a list of - strings, each ending in a newline. - - Normally, the list contains a single string; however, for - SyntaxError exceptions, it contains several lines that (when - printed) display detailed information about where the syntax - error occurred. - - The message indicating which exception occurred is always the last - string in the list. - - """ - - # An instance should not have a meaningful value parameter, but - # sometimes does, particularly for string exceptions, such as - # >>> raise string1, string2 # deprecated - # - # Clear these out first because issubtype(string1, SyntaxError) - # would raise another exception and mask the original problem. - if (isinstance(etype, BaseException) or - isinstance(etype, types.InstanceType) or - etype is None or type(etype) is str): - return [_format_final_exc_line(etype, value)] - - stype = etype.__name__ - - if not issubclass(etype, SyntaxError): - return [_format_final_exc_line(stype, value)] - - # It was a syntax error; show exactly where the problem was found. - lines = [] - try: - msg, (filename, lineno, offset, badline) = value.args - except Exception: - pass - else: - filename = filename or "" - lines.append(' File "%s", line %d\n' % (filename, lineno)) - if badline is not None: - lines.append(' %s\n' % badline.strip()) - if offset is not None: - caretspace = badline.rstrip('\n') - offset = min(len(caretspace), offset) - 1 - caretspace = caretspace[:offset].lstrip() - # non-space whitespace (likes tabs) must be kept for alignment - caretspace = ((c.isspace() and c or ' ') for c in caretspace) - lines.append(' %s^\n' % ''.join(caretspace)) - value = msg - - lines.append(_format_final_exc_line(stype, value)) - return lines - -def _format_final_exc_line(etype, value): - """Return a list of a single line -- normal case for format_exception_only""" - valuestr = _some_str(value) - if value is None or not valuestr: - line = "%s\n" % etype - else: - line = "%s: %s\n" % (etype, valuestr) - return line - -def _some_str(value): - try: - return str(value) - except Exception: - pass - try: - value = unicode(value) - return value.encode("ascii", "backslashreplace") - except Exception: - pass - return '' % type(value).__name__ - - -def print_exc(limit=None, file=None): - """Shorthand for 'print_exception(sys.exc_type, sys.exc_value, sys.exc_traceback, limit, file)'. - (In fact, it uses sys.exc_info() to retrieve the same information - in a thread-safe way.)""" - if file is None: - file = sys.stderr - try: - etype, value, tb = sys.exc_info() - print_exception(etype, value, tb, limit, file) - finally: - etype = value = tb = None - - -def format_exc(limit=None): - """Like print_exc() but return a string.""" - try: - etype, value, tb = sys.exc_info() - return ''.join(format_exception(etype, value, tb, limit)) - finally: - etype = value = tb = None - - -def print_last(limit=None, file=None): - """This is a shorthand for 'print_exception(sys.last_type, - sys.last_value, sys.last_traceback, limit, file)'.""" - if not hasattr(sys, "last_type"): - raise ValueError("no last exception") - if file is None: - file = sys.stderr - print_exception(sys.last_type, sys.last_value, sys.last_traceback, - limit, file) - - -def print_stack(f=None, limit=None, file=None): - """Print a stack trace from its invocation point. - - The optional 'f' argument can be used to specify an alternate - stack frame at which to start. The optional 'limit' and 'file' - arguments have the same meaning as for print_exception(). - """ - if f is None: - try: - raise ZeroDivisionError - except ZeroDivisionError: - f = sys.exc_info()[2].tb_frame.f_back - print_list(extract_stack(f, limit), file) - -def format_stack(f=None, limit=None): - """Shorthand for 'format_list(extract_stack(f, limit))'.""" - if f is None: - try: - raise ZeroDivisionError - except ZeroDivisionError: - f = sys.exc_info()[2].tb_frame.f_back - return format_list(extract_stack(f, limit)) - -def extract_stack(f=None, limit = None): - """Extract the raw traceback from the current stack frame. - - The return value has the same format as for extract_tb(). The - optional 'f' and 'limit' arguments have the same meaning as for - print_stack(). Each item in the list is a quadruple (filename, - line number, function name, text), and the entries are in order - from oldest to newest stack frame. - """ - if f is None: - try: - raise ZeroDivisionError - except ZeroDivisionError: - f = sys.exc_info()[2].tb_frame.f_back - if limit is None: - if hasattr(sys, 'tracebacklimit'): - limit = sys.tracebacklimit - list = [] - n = 0 - while f is not None and (limit is None or n < limit): - lineno = f.f_lineno - co = f.f_code - filename = co.co_filename - name = co.co_name - linecache.checkcache(filename) - line = linecache.getline(filename, lineno, f.f_globals) - if line: line = line.strip() - else: line = None - list.append((filename, lineno, name, line)) - f = f.f_back - n = n+1 - list.reverse() - return list - -def tb_lineno(tb): - """Calculate correct line number of traceback given in tb. - - Obsolete in 2.3. - """ - return tb.tb_lineno diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/types.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/types.py deleted file mode 100644 index f1f18c7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/types.py +++ /dev/null @@ -1,86 +0,0 @@ -"""Define names for all type symbols known in the standard interpreter. - -Types that are part of optional modules (e.g. array) are not listed. -""" -import sys - -# Iterators in Python aren't a matter of type but of protocol. A large -# and changing number of builtin types implement *some* flavor of -# iterator. Don't check the type! Use hasattr to check for both -# "__iter__" and "next" attributes instead. - -NoneType = type(None) -TypeType = type -ObjectType = object - -IntType = int -LongType = long -FloatType = float -BooleanType = bool -try: - ComplexType = complex -except NameError: - pass - -StringType = str - -# StringTypes is already outdated. Instead of writing "type(x) in -# types.StringTypes", you should use "isinstance(x, basestring)". But -# we keep around for compatibility with Python 2.2. -try: - UnicodeType = unicode - StringTypes = (StringType, UnicodeType) -except NameError: - StringTypes = (StringType,) - -BufferType = buffer - -TupleType = tuple -ListType = list -DictType = DictionaryType = dict - -def _f(): pass -FunctionType = type(_f) -LambdaType = type(lambda: None) # Same as FunctionType -CodeType = type(_f.func_code) - -def _g(): - yield 1 -GeneratorType = type(_g()) - -class _C: - def _m(self): pass -ClassType = type(_C) -UnboundMethodType = type(_C._m) # Same as MethodType -_x = _C() -InstanceType = type(_x) -MethodType = type(_x._m) - -BuiltinFunctionType = type(len) -BuiltinMethodType = type([].append) # Same as BuiltinFunctionType - -ModuleType = type(sys) -FileType = file -XRangeType = xrange - -try: - raise TypeError -except TypeError: - tb = sys.exc_info()[2] - TracebackType = type(tb) - FrameType = type(tb.tb_frame) - del tb - -SliceType = slice -EllipsisType = type(Ellipsis) - -DictProxyType = type(TypeType.__dict__) -NotImplementedType = type(NotImplemented) - -# For Jython, the following two types are identical -GetSetDescriptorType = type(FunctionType.func_code) -MemberDescriptorType = type(FunctionType.func_globals) - -del sys, _f, _g, _C, _x # Not for export - -__all__ = list(n for n in globals() if n[:1] != '_') diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py deleted file mode 100644 index c4de785..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/urlparse.py +++ /dev/null @@ -1,428 +0,0 @@ -"""Parse (absolute and relative) URLs. - -urlparse module is based upon the following RFC specifications. - -RFC 3986 (STD66): "Uniform Resource Identifiers" by T. Berners-Lee, R. Fielding -and L. Masinter, January 2005. - -RFC 2732 : "Format for Literal IPv6 Addresses in URL's by R.Hinden, B.Carpenter -and L.Masinter, December 1999. - -RFC 2396: "Uniform Resource Identifiers (URI)": Generic Syntax by T. -Berners-Lee, R. Fielding, and L. Masinter, August 1998. - -RFC 2368: "The mailto URL scheme", by P.Hoffman , L Masinter, J. Zwinski, July 1998. - -RFC 1808: "Relative Uniform Resource Locators", by R. Fielding, UC Irvine, June -1995. - -RFC 1738: "Uniform Resource Locators (URL)" by T. Berners-Lee, L. Masinter, M. -McCahill, December 1994 - -RFC 3986 is considered the current standard and any future changes to -urlparse module should conform with it. The urlparse module is -currently not entirely compliant with this RFC due to defacto -scenarios for parsing, and for backward compatibility purposes, some -parsing quirks from older RFCs are retained. The testcases in -test_urlparse.py provides a good indicator of parsing behavior. - -""" - -import re - -__all__ = ["urlparse", "urlunparse", "urljoin", "urldefrag", - "urlsplit", "urlunsplit", "parse_qs", "parse_qsl"] - -# A classification of schemes ('' means apply by default) -uses_relative = ['ftp', 'http', 'gopher', 'nntp', 'imap', - 'wais', 'file', 'https', 'shttp', 'mms', - 'prospero', 'rtsp', 'rtspu', '', 'sftp', - 'svn', 'svn+ssh'] -uses_netloc = ['ftp', 'http', 'gopher', 'nntp', 'telnet', - 'imap', 'wais', 'file', 'mms', 'https', 'shttp', - 'snews', 'prospero', 'rtsp', 'rtspu', 'rsync', '', - 'svn', 'svn+ssh', 'sftp','nfs','git', 'git+ssh'] -uses_params = ['ftp', 'hdl', 'prospero', 'http', 'imap', - 'https', 'shttp', 'rtsp', 'rtspu', 'sip', 'sips', - 'mms', '', 'sftp', 'tel'] - -# These are not actually used anymore, but should stay for backwards -# compatibility. (They are undocumented, but have a public-looking name.) -non_hierarchical = ['gopher', 'hdl', 'mailto', 'news', - 'telnet', 'wais', 'imap', 'snews', 'sip', 'sips'] -uses_query = ['http', 'wais', 'imap', 'https', 'shttp', 'mms', - 'gopher', 'rtsp', 'rtspu', 'sip', 'sips', ''] -uses_fragment = ['ftp', 'hdl', 'http', 'gopher', 'news', - 'nntp', 'wais', 'https', 'shttp', 'snews', - 'file', 'prospero', ''] - -# Characters valid in scheme names -scheme_chars = ('abcdefghijklmnopqrstuvwxyz' - 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' - '0123456789' - '+-.') - -MAX_CACHE_SIZE = 20 -_parse_cache = {} - -def clear_cache(): - """Clear the parse cache.""" - _parse_cache.clear() - - -class ResultMixin(object): - """Shared methods for the parsed result objects.""" - - @property - def username(self): - netloc = self.netloc - if "@" in netloc: - userinfo = netloc.rsplit("@", 1)[0] - if ":" in userinfo: - userinfo = userinfo.split(":", 1)[0] - return userinfo - return None - - @property - def password(self): - netloc = self.netloc - if "@" in netloc: - userinfo = netloc.rsplit("@", 1)[0] - if ":" in userinfo: - return userinfo.split(":", 1)[1] - return None - - @property - def hostname(self): - netloc = self.netloc.split('@')[-1] - if '[' in netloc and ']' in netloc: - return netloc.split(']')[0][1:].lower() - elif ':' in netloc: - return netloc.split(':')[0].lower() - elif netloc == '': - return None - else: - return netloc.lower() - - @property - def port(self): - netloc = self.netloc.split('@')[-1].split(']')[-1] - if ':' in netloc: - port = netloc.split(':')[1] - if port: - port = int(port, 10) - # verify legal port - if (0 <= port <= 65535): - return port - return None - -from collections import namedtuple - -class SplitResult(namedtuple('SplitResult', 'scheme netloc path query fragment'), ResultMixin): - - __slots__ = () - - def geturl(self): - return urlunsplit(self) - - -class ParseResult(namedtuple('ParseResult', 'scheme netloc path params query fragment'), ResultMixin): - - __slots__ = () - - def geturl(self): - return urlunparse(self) - - -def urlparse(url, scheme='', allow_fragments=True): - """Parse a URL into 6 components: - :///;?# - Return a 6-tuple: (scheme, netloc, path, params, query, fragment). - Note that we don't break the components up in smaller bits - (e.g. netloc is a single string) and we don't expand % escapes.""" - tuple = urlsplit(url, scheme, allow_fragments) - scheme, netloc, url, query, fragment = tuple - if scheme in uses_params and ';' in url: - url, params = _splitparams(url) - else: - params = '' - return ParseResult(scheme, netloc, url, params, query, fragment) - -def _splitparams(url): - if '/' in url: - i = url.find(';', url.rfind('/')) - if i < 0: - return url, '' - else: - i = url.find(';') - return url[:i], url[i+1:] - -def _splitnetloc(url, start=0): - delim = len(url) # position of end of domain part of url, default is end - for c in '/?#': # look for delimiters; the order is NOT important - wdelim = url.find(c, start) # find first of this delim - if wdelim >= 0: # if found - delim = min(delim, wdelim) # use earliest delim position - return url[start:delim], url[delim:] # return (domain, rest) - -def urlsplit(url, scheme='', allow_fragments=True): - """Parse a URL into 5 components: - :///?# - Return a 5-tuple: (scheme, netloc, path, query, fragment). - Note that we don't break the components up in smaller bits - (e.g. netloc is a single string) and we don't expand % escapes.""" - allow_fragments = bool(allow_fragments) - key = url, scheme, allow_fragments, type(url), type(scheme) - cached = _parse_cache.get(key, None) - if cached: - return cached - if len(_parse_cache) >= MAX_CACHE_SIZE: # avoid runaway growth - clear_cache() - netloc = query = fragment = '' - i = url.find(':') - if i > 0: - if url[:i] == 'http': # optimize the common case - scheme = url[:i].lower() - url = url[i+1:] - if url[:2] == '//': - netloc, url = _splitnetloc(url, 2) - if (('[' in netloc and ']' not in netloc) or - (']' in netloc and '[' not in netloc)): - raise ValueError("Invalid IPv6 URL") - if allow_fragments and '#' in url: - url, fragment = url.split('#', 1) - if '?' in url: - url, query = url.split('?', 1) - v = SplitResult(scheme, netloc, url, query, fragment) - _parse_cache[key] = v - return v - for c in url[:i]: - if c not in scheme_chars: - break - else: - # make sure "url" is not actually a port number (in which case - # "scheme" is really part of the path) - rest = url[i+1:] - if not rest or any(c not in '0123456789' for c in rest): - # not a port number - scheme, url = url[:i].lower(), rest - - if url[:2] == '//': - netloc, url = _splitnetloc(url, 2) - if (('[' in netloc and ']' not in netloc) or - (']' in netloc and '[' not in netloc)): - raise ValueError("Invalid IPv6 URL") - if allow_fragments and '#' in url: - url, fragment = url.split('#', 1) - if '?' in url: - url, query = url.split('?', 1) - v = SplitResult(scheme, netloc, url, query, fragment) - _parse_cache[key] = v - return v - -def urlunparse(data): - """Put a parsed URL back together again. This may result in a - slightly different, but equivalent URL, if the URL that was parsed - originally had redundant delimiters, e.g. a ? with an empty query - (the draft states that these are equivalent).""" - scheme, netloc, url, params, query, fragment = data - if params: - url = "%s;%s" % (url, params) - return urlunsplit((scheme, netloc, url, query, fragment)) - -def urlunsplit(data): - """Combine the elements of a tuple as returned by urlsplit() into a - complete URL as a string. The data argument can be any five-item iterable. - This may result in a slightly different, but equivalent URL, if the URL that - was parsed originally had unnecessary delimiters (for example, a ? with an - empty query; the RFC states that these are equivalent).""" - scheme, netloc, url, query, fragment = data - if netloc or (scheme and scheme in uses_netloc and url[:2] != '//'): - if url and url[:1] != '/': url = '/' + url - url = '//' + (netloc or '') + url - if scheme: - url = scheme + ':' + url - if query: - url = url + '?' + query - if fragment: - url = url + '#' + fragment - return url - -def urljoin(base, url, allow_fragments=True): - """Join a base URL and a possibly relative URL to form an absolute - interpretation of the latter.""" - if not base: - return url - if not url: - return base - bscheme, bnetloc, bpath, bparams, bquery, bfragment = \ - urlparse(base, '', allow_fragments) - scheme, netloc, path, params, query, fragment = \ - urlparse(url, bscheme, allow_fragments) - if scheme != bscheme or scheme not in uses_relative: - return url - if scheme in uses_netloc: - if netloc: - return urlunparse((scheme, netloc, path, - params, query, fragment)) - netloc = bnetloc - if path[:1] == '/': - return urlunparse((scheme, netloc, path, - params, query, fragment)) - if not path and not params: - path = bpath - params = bparams - if not query: - query = bquery - return urlunparse((scheme, netloc, path, - params, query, fragment)) - segments = bpath.split('/')[:-1] + path.split('/') - # XXX The stuff below is bogus in various ways... - if segments[-1] == '.': - segments[-1] = '' - while '.' in segments: - segments.remove('.') - while 1: - i = 1 - n = len(segments) - 1 - while i < n: - if (segments[i] == '..' - and segments[i-1] not in ('', '..')): - del segments[i-1:i+1] - break - i = i+1 - else: - break - if segments == ['', '..']: - segments[-1] = '' - elif len(segments) >= 2 and segments[-1] == '..': - segments[-2:] = [''] - return urlunparse((scheme, netloc, '/'.join(segments), - params, query, fragment)) - -def urldefrag(url): - """Removes any existing fragment from URL. - - Returns a tuple of the defragmented URL and the fragment. If - the URL contained no fragments, the second element is the - empty string. - """ - if '#' in url: - s, n, p, a, q, frag = urlparse(url) - defrag = urlunparse((s, n, p, a, q, '')) - return defrag, frag - else: - return url, '' - -try: - unicode -except NameError: - def _is_unicode(x): - return 0 -else: - def _is_unicode(x): - return isinstance(x, unicode) - -# unquote method for parse_qs and parse_qsl -# Cannot use directly from urllib as it would create a circular reference -# because urllib uses urlparse methods (urljoin). If you update this function, -# update it also in urllib. This code duplication does not existin in Python3. - -_hexdig = '0123456789ABCDEFabcdef' -_hextochr = dict((a+b, chr(int(a+b,16))) - for a in _hexdig for b in _hexdig) -_asciire = re.compile('([\x00-\x7f]+)') - -def unquote(s): - """unquote('abc%20def') -> 'abc def'.""" - if _is_unicode(s): - if '%' not in s: - return s - bits = _asciire.split(s) - res = [bits[0]] - append = res.append - for i in range(1, len(bits), 2): - append(unquote(str(bits[i])).decode('latin1')) - append(bits[i + 1]) - return ''.join(res) - - bits = s.split('%') - # fastpath - if len(bits) == 1: - return s - res = [bits[0]] - append = res.append - for item in bits[1:]: - try: - append(_hextochr[item[:2]]) - append(item[2:]) - except KeyError: - append('%') - append(item) - return ''.join(res) - -def parse_qs(qs, keep_blank_values=0, strict_parsing=0): - """Parse a query given as a string argument. - - Arguments: - - qs: percent-encoded query string to be parsed - - keep_blank_values: flag indicating whether blank values in - percent-encoded queries should be treated as blank strings. - A true value indicates that blanks should be retained as - blank strings. The default false value indicates that - blank values are to be ignored and treated as if they were - not included. - - strict_parsing: flag indicating what to do with parsing errors. - If false (the default), errors are silently ignored. - If true, errors raise a ValueError exception. - """ - dict = {} - for name, value in parse_qsl(qs, keep_blank_values, strict_parsing): - if name in dict: - dict[name].append(value) - else: - dict[name] = [value] - return dict - -def parse_qsl(qs, keep_blank_values=0, strict_parsing=0): - """Parse a query given as a string argument. - - Arguments: - - qs: percent-encoded query string to be parsed - - keep_blank_values: flag indicating whether blank values in - percent-encoded queries should be treated as blank strings. A - true value indicates that blanks should be retained as blank - strings. The default false value indicates that blank values - are to be ignored and treated as if they were not included. - - strict_parsing: flag indicating what to do with parsing errors. If - false (the default), errors are silently ignored. If true, - errors raise a ValueError exception. - - Returns a list, as G-d intended. - """ - pairs = [s2 for s1 in qs.split('&') for s2 in s1.split(';')] - r = [] - for name_value in pairs: - if not name_value and not strict_parsing: - continue - nv = name_value.split('=', 1) - if len(nv) != 2: - if strict_parsing: - raise ValueError, "bad query field: %r" % (name_value,) - # Handle case of a control-name with no equal sign - if keep_blank_values: - nv.append('') - else: - continue - if len(nv[1]) or keep_blank_values: - name = unquote(nv[0].replace('+', ' ')) - value = unquote(nv[1].replace('+', ' ')) - r.append((name, value)) - - return r diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py deleted file mode 100644 index 8098c6e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/warnings.py +++ /dev/null @@ -1,404 +0,0 @@ -"""Python part of the warnings subsystem.""" - -# Note: function level imports should *not* be used -# in this module as it may cause import lock deadlock. -# See bug 683658. -import linecache -import sys -import types - -__all__ = ["warn", "warn_explicit", "showwarning", - "formatwarning", "filterwarnings", "simplefilter", - "resetwarnings", "catch_warnings"] - - -def warnpy3k(message, category=None, stacklevel=1): - """Issue a deprecation warning for Python 3.x related changes. - - Warnings are omitted unless Python is started with the -3 option. - """ - if sys.py3kwarning: - if category is None: - category = DeprecationWarning - warn(message, category, stacklevel+1) - -def _show_warning(message, category, filename, lineno, file=None, line=None): - """Hook to write a warning to a file; replace if you like.""" - if file is None: - file = sys.stderr - if file is None: - # sys.stderr is None - warnings get lost - return - try: - file.write(formatwarning(message, category, filename, lineno, line)) - except IOError: - pass # the file (probably stderr) is invalid - this warning gets lost. -# Keep a working version around in case the deprecation of the old API is -# triggered. -showwarning = _show_warning - -def formatwarning(message, category, filename, lineno, line=None): - """Function to format a warning the standard way.""" - s = "%s:%s: %s: %s\n" % (filename, lineno, category.__name__, message) - line = linecache.getline(filename, lineno) if line is None else line - if line: - line = line.strip() - s += " %s\n" % line - return s - -def filterwarnings(action, message="", category=Warning, module="", lineno=0, - append=0): - """Insert an entry into the list of warnings filters (at the front). - - 'action' -- one of "error", "ignore", "always", "default", "module", - or "once" - 'message' -- a regex that the warning message must match - 'category' -- a class that the warning must be a subclass of - 'module' -- a regex that the module name must match - 'lineno' -- an integer line number, 0 matches all warnings - 'append' -- if true, append to the list of filters - """ - import re - assert action in ("error", "ignore", "always", "default", "module", - "once"), "invalid action: %r" % (action,) - assert isinstance(message, basestring), "message must be a string" - assert isinstance(category, (type, types.ClassType)), \ - "category must be a class" - assert issubclass(category, Warning), "category must be a Warning subclass" - assert isinstance(module, basestring), "module must be a string" - assert isinstance(lineno, int) and lineno >= 0, \ - "lineno must be an int >= 0" - item = (action, re.compile(message, re.I), category, - re.compile(module), lineno) - if append: - filters.append(item) - else: - filters.insert(0, item) - -def simplefilter(action, category=Warning, lineno=0, append=0): - """Insert a simple entry into the list of warnings filters (at the front). - - A simple filter matches all modules and messages. - 'action' -- one of "error", "ignore", "always", "default", "module", - or "once" - 'category' -- a class that the warning must be a subclass of - 'lineno' -- an integer line number, 0 matches all warnings - 'append' -- if true, append to the list of filters - """ - assert action in ("error", "ignore", "always", "default", "module", - "once"), "invalid action: %r" % (action,) - assert isinstance(lineno, int) and lineno >= 0, \ - "lineno must be an int >= 0" - item = (action, None, category, None, lineno) - if append: - filters.append(item) - else: - filters.insert(0, item) - -def resetwarnings(): - """Clear the list of warning filters, so that no filters are active.""" - filters[:] = [] - -class _OptionError(Exception): - """Exception used by option processing helpers.""" - pass - -# Helper to process -W options passed via sys.warnoptions -def _processoptions(args): - for arg in args: - try: - _setoption(arg) - except _OptionError, msg: - print >>sys.stderr, "Invalid -W option ignored:", msg - -# Helper for _processoptions() -def _setoption(arg): - import re - parts = arg.split(':') - if len(parts) > 5: - raise _OptionError("too many fields (max 5): %r" % (arg,)) - while len(parts) < 5: - parts.append('') - action, message, category, module, lineno = [s.strip() - for s in parts] - action = _getaction(action) - message = re.escape(message) - category = _getcategory(category) - module = re.escape(module) - if module: - module = module + '$' - if lineno: - try: - lineno = int(lineno) - if lineno < 0: - raise ValueError - except (ValueError, OverflowError): - raise _OptionError("invalid lineno %r" % (lineno,)) - else: - lineno = 0 - filterwarnings(action, message, category, module, lineno) - -# Helper for _setoption() -def _getaction(action): - if not action: - return "default" - if action == "all": return "always" # Alias - for a in ('default', 'always', 'ignore', 'module', 'once', 'error'): - if a.startswith(action): - return a - raise _OptionError("invalid action: %r" % (action,)) - -# Helper for _setoption() -def _getcategory(category): - import re - if not category: - return Warning - if re.match("^[a-zA-Z0-9_]+$", category): - try: - cat = eval(category) - except NameError: - raise _OptionError("unknown warning category: %r" % (category,)) - else: - i = category.rfind(".") - module = category[:i] - klass = category[i+1:] - try: - m = __import__(module, None, None, [klass]) - except ImportError: - raise _OptionError("invalid module name: %r" % (module,)) - try: - cat = getattr(m, klass) - except AttributeError: - raise _OptionError("unknown warning category: %r" % (category,)) - if not issubclass(cat, Warning): - raise _OptionError("invalid warning category: %r" % (category,)) - return cat - - -# Code typically replaced by _warnings -def warn(message, category=None, stacklevel=1): - """Issue a warning, or maybe ignore it or raise an exception.""" - # Check if message is already a Warning object - if isinstance(message, Warning): - category = message.__class__ - # Check category argument - if category is None: - category = UserWarning - assert issubclass(category, Warning) - # Get context information - try: - caller = sys._getframe(stacklevel) - except ValueError: - globals = sys.__dict__ - lineno = 1 - else: - globals = caller.f_globals - lineno = caller.f_lineno - if '__name__' in globals: - module = globals['__name__'] - else: - module = "" - filename = globals.get('__file__') - if filename: - fnl = filename.lower() - if fnl.endswith((".pyc", ".pyo")): - filename = filename[:-1] - else: - if module == "__main__": - try: - filename = sys.argv[0] - except AttributeError: - # embedded interpreters don't have sys.argv, see bug #839151 - filename = '__main__' - if not filename: - filename = module - registry = globals.setdefault("__warningregistry__", {}) - warn_explicit(message, category, filename, lineno, module, registry, - globals) - -def warn_explicit(message, category, filename, lineno, - module=None, registry=None, module_globals=None): - lineno = int(lineno) - if module is None: - module = filename or "" - if module[-3:].lower() == ".py": - module = module[:-3] # XXX What about leading pathname? - if registry is None: - registry = {} - if isinstance(message, Warning): - text = str(message) - category = message.__class__ - else: - text = message - message = category(message) - key = (text, category, lineno) - # Quick test for common case - if registry.get(key): - return - # Search the filters - for item in filters: - action, msg, cat, mod, ln = item - if ((msg is None or msg.match(text)) and - issubclass(category, cat) and - (mod is None or mod.match(module)) and - (ln == 0 or lineno == ln)): - break - else: - action = defaultaction - # Early exit actions - if action == "ignore": - registry[key] = 1 - return - - # Prime the linecache for formatting, in case the - # "file" is actually in a zipfile or something. - linecache.getlines(filename, module_globals) - - if action == "error": - raise message - # Other actions - if action == "once": - registry[key] = 1 - oncekey = (text, category) - if onceregistry.get(oncekey): - return - onceregistry[oncekey] = 1 - elif action == "always": - pass - elif action == "module": - registry[key] = 1 - altkey = (text, category, 0) - if registry.get(altkey): - return - registry[altkey] = 1 - elif action == "default": - registry[key] = 1 - else: - # Unrecognized actions are errors - raise RuntimeError( - "Unrecognized action (%r) in warnings.filters:\n %s" % - (action, item)) - # Print message and context - showwarning(message, category, filename, lineno) - - -class WarningMessage(object): - - """Holds the result of a single showwarning() call.""" - - _WARNING_DETAILS = ("message", "category", "filename", "lineno", "file", - "line") - - def __init__(self, message, category, filename, lineno, file=None, - line=None): - local_values = locals() - for attr in self._WARNING_DETAILS: - setattr(self, attr, local_values[attr]) - self._category_name = category.__name__ if category else None - - def __str__(self): - return ("{message : %r, category : %r, filename : %r, lineno : %s, " - "line : %r}" % (self.message, self._category_name, - self.filename, self.lineno, self.line)) - - -class catch_warnings(object): - - """A context manager that copies and restores the warnings filter upon - exiting the context. - - The 'record' argument specifies whether warnings should be captured by a - custom implementation of warnings.showwarning() and be appended to a list - returned by the context manager. Otherwise None is returned by the context - manager. The objects appended to the list are arguments whose attributes - mirror the arguments to showwarning(). - - The 'module' argument is to specify an alternative module to the module - named 'warnings' and imported under that name. This argument is only useful - when testing the warnings module itself. - - """ - - def __init__(self, record=False, module=None): - """Specify whether to record warnings and if an alternative module - should be used other than sys.modules['warnings']. - - For compatibility with Python 3.0, please consider all arguments to be - keyword-only. - - """ - self._record = record - self._module = sys.modules['warnings'] if module is None else module - self._entered = False - - def __repr__(self): - args = [] - if self._record: - args.append("record=True") - if self._module is not sys.modules['warnings']: - args.append("module=%r" % self._module) - name = type(self).__name__ - return "%s(%s)" % (name, ", ".join(args)) - - def __enter__(self): - if self._entered: - raise RuntimeError("Cannot enter %r twice" % self) - self._entered = True - self._filters = self._module.filters - self._module.filters = self._filters[:] - self._showwarning = self._module.showwarning - if self._record: - log = [] - def showwarning(*args, **kwargs): - log.append(WarningMessage(*args, **kwargs)) - self._module.showwarning = showwarning - return log - else: - return None - - def __exit__(self, *exc_info): - if not self._entered: - raise RuntimeError("Cannot exit %r without entering first" % self) - self._module.filters = self._filters - self._module.showwarning = self._showwarning - - -# filters contains a sequence of filter 5-tuples -# The components of the 5-tuple are: -# - an action: error, ignore, always, default, module, or once -# - a compiled regex that must match the warning message -# - a class representing the warning category -# - a compiled regex that must match the module that is being warned -# - a line number for the line being warning, or 0 to mean any line -# If either if the compiled regexs are None, match anything. -_warnings_defaults = False -try: - from _warnings import (filters, default_action, once_registry, - warn, warn_explicit) - defaultaction = default_action - onceregistry = once_registry - _warnings_defaults = True -except ImportError: - filters = [] - defaultaction = "default" - onceregistry = {} - - -# Module initialization -_processoptions(sys.warnoptions) -if not _warnings_defaults: - silence = [ImportWarning, PendingDeprecationWarning] - # Don't silence DeprecationWarning if -3 or -Q was used. - if not sys.py3kwarning and not sys.flags.division_warning: - silence.append(DeprecationWarning) - for cls in silence: - simplefilter("ignore", category=cls) - bytes_warning = sys.flags.bytes_warning - if bytes_warning > 1: - bytes_action = "error" - elif bytes_warning: - bytes_action = "default" - else: - bytes_action = "ignore" - simplefilter(bytes_action, category=BytesWarning, append=1) -del _warnings_defaults diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py deleted file mode 100644 index dc6dbf0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/weakref.py +++ /dev/null @@ -1,443 +0,0 @@ -"""Weak reference support for Python. - -This module is an implementation of PEP 205: - -http://www.python.org/dev/peps/pep-0205/ -""" - -# Naming convention: Variables named "wr" are weak reference objects; -# they are called this instead of "ref" to avoid name collisions with -# the module-global ref() function imported from _weakref. - -import UserDict - -from _weakref import ( - getweakrefcount, - getweakrefs, - ref, - proxy, - CallableProxyType, - ProxyType, - ReferenceType) - -from _weakrefset import WeakSet, _IterationGuard - -from exceptions import ReferenceError - - -ProxyTypes = (ProxyType, CallableProxyType) - -__all__ = ["ref", "proxy", "getweakrefcount", "getweakrefs", - "WeakKeyDictionary", "ReferenceError", "ReferenceType", "ProxyType", - "CallableProxyType", "ProxyTypes", "WeakValueDictionary", 'WeakSet'] - - -class WeakValueDictionary(UserDict.UserDict): - """Mapping class that references values weakly. - - Entries in the dictionary will be discarded when no strong - reference to the value exists anymore - """ - # We inherit the constructor without worrying about the input - # dictionary; since it uses our .update() method, we get the right - # checks (if the other dictionary is a WeakValueDictionary, - # objects are unwrapped on the way out, and we always wrap on the - # way in). - - def __init__(self, *args, **kw): - def remove(wr, selfref=ref(self)): - self = selfref() - if self is not None: - if self._iterating: - self._pending_removals.append(wr.key) - else: - del self.data[wr.key] - self._remove = remove - # A list of keys to be removed - self._pending_removals = [] - self._iterating = set() - UserDict.UserDict.__init__(self, *args, **kw) - - def _commit_removals(self): - l = self._pending_removals - d = self.data - # We shouldn't encounter any KeyError, because this method should - # always be called *before* mutating the dict. - while l: - del d[l.pop()] - - def __getitem__(self, key): - o = self.data[key]() - if o is None: - raise KeyError, key - else: - return o - - def __delitem__(self, key): - if self._pending_removals: - self._commit_removals() - del self.data[key] - - def __contains__(self, key): - try: - o = self.data[key]() - except KeyError: - return False - return o is not None - - def has_key(self, key): - try: - o = self.data[key]() - except KeyError: - return False - return o is not None - - def __repr__(self): - return "" % id(self) - - def __setitem__(self, key, value): - if self._pending_removals: - self._commit_removals() - self.data[key] = KeyedRef(value, self._remove, key) - - def clear(self): - if self._pending_removals: - self._commit_removals() - self.data.clear() - - def copy(self): - new = WeakValueDictionary() - for key, wr in self.data.items(): - o = wr() - if o is not None: - new[key] = o - return new - - __copy__ = copy - - def __deepcopy__(self, memo): - from copy import deepcopy - new = self.__class__() - for key, wr in self.data.items(): - o = wr() - if o is not None: - new[deepcopy(key, memo)] = o - return new - - def get(self, key, default=None): - try: - wr = self.data[key] - except KeyError: - return default - else: - o = wr() - if o is None: - # This should only happen - return default - else: - return o - - def items(self): - L = [] - for key, wr in self.data.items(): - o = wr() - if o is not None: - L.append((key, o)) - return L - - def iteritems(self): - with _IterationGuard(self): - for wr in self.data.itervalues(): - value = wr() - if value is not None: - yield wr.key, value - - def iterkeys(self): - with _IterationGuard(self): - for k in self.data.iterkeys(): - yield k - - __iter__ = iterkeys - - def itervaluerefs(self): - """Return an iterator that yields the weak references to the values. - - The references are not guaranteed to be 'live' at the time - they are used, so the result of calling the references needs - to be checked before being used. This can be used to avoid - creating references that will cause the garbage collector to - keep the values around longer than needed. - - """ - with _IterationGuard(self): - for wr in self.data.itervalues(): - yield wr - - def itervalues(self): - with _IterationGuard(self): - for wr in self.data.itervalues(): - obj = wr() - if obj is not None: - yield obj - - def popitem(self): - if self._pending_removals: - self._commit_removals() - while 1: - key, wr = self.data.popitem() - o = wr() - if o is not None: - return key, o - - def pop(self, key, *args): - if self._pending_removals: - self._commit_removals() - try: - o = self.data.pop(key)() - except KeyError: - if args: - return args[0] - raise - if o is None: - raise KeyError, key - else: - return o - - def setdefault(self, key, default=None): - try: - wr = self.data[key] - except KeyError: - if self._pending_removals: - self._commit_removals() - self.data[key] = KeyedRef(default, self._remove, key) - return default - else: - return wr() - - def update(self, dict=None, **kwargs): - if self._pending_removals: - self._commit_removals() - d = self.data - if dict is not None: - if not hasattr(dict, "items"): - dict = type({})(dict) - for key, o in dict.items(): - d[key] = KeyedRef(o, self._remove, key) - if len(kwargs): - self.update(kwargs) - - def valuerefs(self): - """Return a list of weak references to the values. - - The references are not guaranteed to be 'live' at the time - they are used, so the result of calling the references needs - to be checked before being used. This can be used to avoid - creating references that will cause the garbage collector to - keep the values around longer than needed. - - """ - return self.data.values() - - def values(self): - L = [] - for wr in self.data.values(): - o = wr() - if o is not None: - L.append(o) - return L - - -class KeyedRef(ref): - """Specialized reference that includes a key corresponding to the value. - - This is used in the WeakValueDictionary to avoid having to create - a function object for each key stored in the mapping. A shared - callback object can use the 'key' attribute of a KeyedRef instead - of getting a reference to the key from an enclosing scope. - - """ - - __slots__ = "key", - - def __new__(type, ob, callback, key): - self = ref.__new__(type, ob, callback) - self.key = key - return self - - def __init__(self, ob, callback, key): - super(KeyedRef, self).__init__(ob, callback) - - -class WeakKeyDictionary(UserDict.UserDict): - """ Mapping class that references keys weakly. - - Entries in the dictionary will be discarded when there is no - longer a strong reference to the key. This can be used to - associate additional data with an object owned by other parts of - an application without adding attributes to those objects. This - can be especially useful with objects that override attribute - accesses. - """ - - def __init__(self, dict=None): - self.data = {} - def remove(k, selfref=ref(self)): - self = selfref() - if self is not None: - if self._iterating: - self._pending_removals.append(k) - else: - del self.data[k] - self._remove = remove - # A list of dead weakrefs (keys to be removed) - self._pending_removals = [] - self._iterating = set() - if dict is not None: - self.update(dict) - - def _commit_removals(self): - # NOTE: We don't need to call this method before mutating the dict, - # because a dead weakref never compares equal to a live weakref, - # even if they happened to refer to equal objects. - # However, it means keys may already have been removed. - l = self._pending_removals - d = self.data - while l: - try: - del d[l.pop()] - except KeyError: - pass - - def __delitem__(self, key): - del self.data[ref(key)] - - def __getitem__(self, key): - return self.data[ref(key)] - - def __repr__(self): - return "" % id(self) - - def __setitem__(self, key, value): - self.data[ref(key, self._remove)] = value - - def copy(self): - new = WeakKeyDictionary() - for key, value in self.data.items(): - o = key() - if o is not None: - new[o] = value - return new - - __copy__ = copy - - def __deepcopy__(self, memo): - from copy import deepcopy - new = self.__class__() - for key, value in self.data.items(): - o = key() - if o is not None: - new[o] = deepcopy(value, memo) - return new - - def get(self, key, default=None): - return self.data.get(ref(key),default) - - def has_key(self, key): - try: - wr = ref(key) - except TypeError: - return 0 - return wr in self.data - - def __contains__(self, key): - try: - wr = ref(key) - except TypeError: - return 0 - return wr in self.data - - def items(self): - L = [] - for key, value in self.data.items(): - o = key() - if o is not None: - L.append((o, value)) - return L - - def iteritems(self): - with _IterationGuard(self): - for wr, value in self.data.iteritems(): - key = wr() - if key is not None: - yield key, value - - def iterkeyrefs(self): - """Return an iterator that yields the weak references to the keys. - - The references are not guaranteed to be 'live' at the time - they are used, so the result of calling the references needs - to be checked before being used. This can be used to avoid - creating references that will cause the garbage collector to - keep the keys around longer than needed. - - """ - with _IterationGuard(self): - for wr in self.data.iterkeys(): - yield wr - - def iterkeys(self): - with _IterationGuard(self): - for wr in self.data.iterkeys(): - obj = wr() - if obj is not None: - yield obj - - __iter__ = iterkeys - - def itervalues(self): - with _IterationGuard(self): - for value in self.data.itervalues(): - yield value - - def keyrefs(self): - """Return a list of weak references to the keys. - - The references are not guaranteed to be 'live' at the time - they are used, so the result of calling the references needs - to be checked before being used. This can be used to avoid - creating references that will cause the garbage collector to - keep the keys around longer than needed. - - """ - return self.data.keys() - - def keys(self): - L = [] - for wr in self.data.keys(): - o = wr() - if o is not None: - L.append(o) - return L - - def popitem(self): - while 1: - key, value = self.data.popitem() - o = key() - if o is not None: - return o, value - - def pop(self, key, *args): - return self.data.pop(ref(key), *args) - - def setdefault(self, key, default=None): - return self.data.setdefault(ref(key, self._remove),default) - - def update(self, dict=None, **kwargs): - d = self.data - if dict is not None: - if not hasattr(dict, "items"): - dict = type({})(dict) - for key, value in dict.items(): - d[ref(key, self._remove)] = value - if len(kwargs): - self.update(kwargs) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py deleted file mode 100644 index 086543a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/__init__.py +++ /dev/null @@ -1,41 +0,0 @@ -"""Core XML support for Python. - -This package contains four sub-packages: - -dom -- The W3C Document Object Model. This supports DOM Level 1 + - Namespaces. - -parsers -- Python wrappers for XML parsers (currently only supports Expat). - -sax -- The Simple API for XML, developed by XML-Dev, led by David - Megginson and ported to Python by Lars Marius Garshol. This - supports the SAX 2 API. - -etree -- The ElementTree XML library. This is a subset of the full - ElementTree XML release. - -""" - - -__all__ = ["dom", "parsers", "sax", "etree"] - -_MINIMUM_XMLPLUS_VERSION = (0, 8, 4) - - -try: - import _xmlplus -except ImportError: - pass -else: - try: - v = _xmlplus.version_info - except AttributeError: - # _xmlplus is too old; ignore it - pass - else: - if v >= _MINIMUM_XMLPLUS_VERSION: - import sys - _xmlplus.__path__.extend(__path__) - sys.modules[__name__] = _xmlplus - else: - del v diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py deleted file mode 100644 index 07886e0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/NodeFilter.py +++ /dev/null @@ -1,27 +0,0 @@ -# This is the Python mapping for interface NodeFilter from -# DOM2-Traversal-Range. It contains only constants. - -class NodeFilter: - """ - This is the DOM2 NodeFilter interface. It contains only constants. - """ - FILTER_ACCEPT = 1 - FILTER_REJECT = 2 - FILTER_SKIP = 3 - - SHOW_ALL = 0xFFFFFFFFL - SHOW_ELEMENT = 0x00000001 - SHOW_ATTRIBUTE = 0x00000002 - SHOW_TEXT = 0x00000004 - SHOW_CDATA_SECTION = 0x00000008 - SHOW_ENTITY_REFERENCE = 0x00000010 - SHOW_ENTITY = 0x00000020 - SHOW_PROCESSING_INSTRUCTION = 0x00000040 - SHOW_COMMENT = 0x00000080 - SHOW_DOCUMENT = 0x00000100 - SHOW_DOCUMENT_TYPE = 0x00000200 - SHOW_DOCUMENT_FRAGMENT = 0x00000400 - SHOW_NOTATION = 0x00000800 - - def acceptNode(self, node): - raise NotImplementedError diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py deleted file mode 100644 index 5da489d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/__init__.py +++ /dev/null @@ -1,139 +0,0 @@ -"""W3C Document Object Model implementation for Python. - -The Python mapping of the Document Object Model is documented in the -Python Library Reference in the section on the xml.dom package. - -This package contains the following modules: - -minidom -- A simple implementation of the Level 1 DOM with namespace - support added (based on the Level 2 specification) and other - minor Level 2 functionality. - -pulldom -- DOM builder supporting on-demand tree-building for selected - subtrees of the document. - -""" - - -class Node: - """Class giving the NodeType constants.""" - - # DOM implementations may use this as a base class for their own - # Node implementations. If they don't, the constants defined here - # should still be used as the canonical definitions as they match - # the values given in the W3C recommendation. Client code can - # safely refer to these values in all tests of Node.nodeType - # values. - - ELEMENT_NODE = 1 - ATTRIBUTE_NODE = 2 - TEXT_NODE = 3 - CDATA_SECTION_NODE = 4 - ENTITY_REFERENCE_NODE = 5 - ENTITY_NODE = 6 - PROCESSING_INSTRUCTION_NODE = 7 - COMMENT_NODE = 8 - DOCUMENT_NODE = 9 - DOCUMENT_TYPE_NODE = 10 - DOCUMENT_FRAGMENT_NODE = 11 - NOTATION_NODE = 12 - - -#ExceptionCode -INDEX_SIZE_ERR = 1 -DOMSTRING_SIZE_ERR = 2 -HIERARCHY_REQUEST_ERR = 3 -WRONG_DOCUMENT_ERR = 4 -INVALID_CHARACTER_ERR = 5 -NO_DATA_ALLOWED_ERR = 6 -NO_MODIFICATION_ALLOWED_ERR = 7 -NOT_FOUND_ERR = 8 -NOT_SUPPORTED_ERR = 9 -INUSE_ATTRIBUTE_ERR = 10 -INVALID_STATE_ERR = 11 -SYNTAX_ERR = 12 -INVALID_MODIFICATION_ERR = 13 -NAMESPACE_ERR = 14 -INVALID_ACCESS_ERR = 15 -VALIDATION_ERR = 16 - - -class DOMException(Exception): - """Abstract base class for DOM exceptions. - Exceptions with specific codes are specializations of this class.""" - - def __init__(self, *args, **kw): - if self.__class__ is DOMException: - raise RuntimeError( - "DOMException should not be instantiated directly") - Exception.__init__(self, *args, **kw) - - def _get_code(self): - return self.code - - -class IndexSizeErr(DOMException): - code = INDEX_SIZE_ERR - -class DomstringSizeErr(DOMException): - code = DOMSTRING_SIZE_ERR - -class HierarchyRequestErr(DOMException): - code = HIERARCHY_REQUEST_ERR - -class WrongDocumentErr(DOMException): - code = WRONG_DOCUMENT_ERR - -class InvalidCharacterErr(DOMException): - code = INVALID_CHARACTER_ERR - -class NoDataAllowedErr(DOMException): - code = NO_DATA_ALLOWED_ERR - -class NoModificationAllowedErr(DOMException): - code = NO_MODIFICATION_ALLOWED_ERR - -class NotFoundErr(DOMException): - code = NOT_FOUND_ERR - -class NotSupportedErr(DOMException): - code = NOT_SUPPORTED_ERR - -class InuseAttributeErr(DOMException): - code = INUSE_ATTRIBUTE_ERR - -class InvalidStateErr(DOMException): - code = INVALID_STATE_ERR - -class SyntaxErr(DOMException): - code = SYNTAX_ERR - -class InvalidModificationErr(DOMException): - code = INVALID_MODIFICATION_ERR - -class NamespaceErr(DOMException): - code = NAMESPACE_ERR - -class InvalidAccessErr(DOMException): - code = INVALID_ACCESS_ERR - -class ValidationErr(DOMException): - code = VALIDATION_ERR - -class UserDataHandler: - """Class giving the operation constants for UserDataHandler.handle().""" - - # Based on DOM Level 3 (WD 9 April 2002) - - NODE_CLONED = 1 - NODE_IMPORTED = 2 - NODE_DELETED = 3 - NODE_RENAMED = 4 - -XML_NAMESPACE = "http://www.w3.org/XML/1998/namespace" -XMLNS_NAMESPACE = "http://www.w3.org/2000/xmlns/" -XHTML_NAMESPACE = "http://www.w3.org/1999/xhtml" -EMPTY_NAMESPACE = None -EMPTY_PREFIX = None - -from domreg import getDOMImplementation,registerDOMImplementation diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py deleted file mode 100644 index 751f54a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/domreg.py +++ /dev/null @@ -1,99 +0,0 @@ -"""Registration facilities for DOM. This module should not be used -directly. Instead, the functions getDOMImplementation and -registerDOMImplementation should be imported from xml.dom.""" - -from xml.dom.minicompat import * # isinstance, StringTypes - -# This is a list of well-known implementations. Well-known names -# should be published by posting to xml-sig@python.org, and are -# subsequently recorded in this file. - -well_known_implementations = { - 'minidom':'xml.dom.minidom', - '4DOM': 'xml.dom.DOMImplementation', - } - -# DOM implementations not officially registered should register -# themselves with their - -registered = {} - -def registerDOMImplementation(name, factory): - """registerDOMImplementation(name, factory) - - Register the factory function with the name. The factory function - should return an object which implements the DOMImplementation - interface. The factory function can either return the same object, - or a new one (e.g. if that implementation supports some - customization).""" - - registered[name] = factory - -def _good_enough(dom, features): - "_good_enough(dom, features) -> Return 1 if the dom offers the features" - for f,v in features: - if not dom.hasFeature(f,v): - return 0 - return 1 - -def getDOMImplementation(name = None, features = ()): - """getDOMImplementation(name = None, features = ()) -> DOM implementation. - - Return a suitable DOM implementation. The name is either - well-known, the module name of a DOM implementation, or None. If - it is not None, imports the corresponding module and returns - DOMImplementation object if the import succeeds. - - If name is not given, consider the available implementations to - find one with the required feature set. If no implementation can - be found, raise an ImportError. The features list must be a sequence - of (feature, version) pairs which are passed to hasFeature.""" - - import os - creator = None - mod = well_known_implementations.get(name) - if mod: - mod = __import__(mod, {}, {}, ['getDOMImplementation']) - return mod.getDOMImplementation() - elif name: - return registered[name]() - elif "PYTHON_DOM" in os.environ: - return getDOMImplementation(name = os.environ["PYTHON_DOM"]) - - # User did not specify a name, try implementations in arbitrary - # order, returning the one that has the required features - if isinstance(features, StringTypes): - features = _parse_feature_string(features) - for creator in registered.values(): - dom = creator() - if _good_enough(dom, features): - return dom - - for creator in well_known_implementations.keys(): - try: - dom = getDOMImplementation(name = creator) - except StandardError: # typically ImportError, or AttributeError - continue - if _good_enough(dom, features): - return dom - - raise ImportError,"no suitable DOM implementation found" - -def _parse_feature_string(s): - features = [] - parts = s.split() - i = 0 - length = len(parts) - while i < length: - feature = parts[i] - if feature[0] in "0123456789": - raise ValueError, "bad feature name: %r" % (feature,) - i = i + 1 - version = None - if i < length: - v = parts[i] - if v[0] in "0123456789": - i = i + 1 - version = v - features.append((feature, version)) - return tuple(features) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py deleted file mode 100644 index 95c23a0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/expatbuilder.py +++ /dev/null @@ -1,983 +0,0 @@ -"""Facility to use the Expat parser to load a minidom instance -from a string or file. - -This avoids all the overhead of SAX and pulldom to gain performance. -""" - -# Warning! -# -# This module is tightly bound to the implementation details of the -# minidom DOM and can't be used with other DOM implementations. This -# is due, in part, to a lack of appropriate methods in the DOM (there is -# no way to create Entity and Notation nodes via the DOM Level 2 -# interface), and for performance. The later is the cause of some fairly -# cryptic code. -# -# Performance hacks: -# -# - .character_data_handler() has an extra case in which continuing -# data is appended to an existing Text node; this can be a -# speedup since pyexpat can break up character data into multiple -# callbacks even though we set the buffer_text attribute on the -# parser. This also gives us the advantage that we don't need a -# separate normalization pass. -# -# - Determining that a node exists is done using an identity comparison -# with None rather than a truth test; this avoids searching for and -# calling any methods on the node object if it exists. (A rather -# nice speedup is achieved this way as well!) - -from xml.dom import xmlbuilder, minidom, Node -from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE -from xml.parsers import expat -from xml.dom.minidom import _append_child, _set_attribute_node -from xml.dom.NodeFilter import NodeFilter - -from xml.dom.minicompat import * - -TEXT_NODE = Node.TEXT_NODE -CDATA_SECTION_NODE = Node.CDATA_SECTION_NODE -DOCUMENT_NODE = Node.DOCUMENT_NODE - -FILTER_ACCEPT = xmlbuilder.DOMBuilderFilter.FILTER_ACCEPT -FILTER_REJECT = xmlbuilder.DOMBuilderFilter.FILTER_REJECT -FILTER_SKIP = xmlbuilder.DOMBuilderFilter.FILTER_SKIP -FILTER_INTERRUPT = xmlbuilder.DOMBuilderFilter.FILTER_INTERRUPT - -theDOMImplementation = minidom.getDOMImplementation() - -# Expat typename -> TypeInfo -_typeinfo_map = { - "CDATA": minidom.TypeInfo(None, "cdata"), - "ENUM": minidom.TypeInfo(None, "enumeration"), - "ENTITY": minidom.TypeInfo(None, "entity"), - "ENTITIES": minidom.TypeInfo(None, "entities"), - "ID": minidom.TypeInfo(None, "id"), - "IDREF": minidom.TypeInfo(None, "idref"), - "IDREFS": minidom.TypeInfo(None, "idrefs"), - "NMTOKEN": minidom.TypeInfo(None, "nmtoken"), - "NMTOKENS": minidom.TypeInfo(None, "nmtokens"), - } - -class ElementInfo(object): - __slots__ = '_attr_info', '_model', 'tagName' - - def __init__(self, tagName, model=None): - self.tagName = tagName - self._attr_info = [] - self._model = model - - def __getstate__(self): - return self._attr_info, self._model, self.tagName - - def __setstate__(self, state): - self._attr_info, self._model, self.tagName = state - - def getAttributeType(self, aname): - for info in self._attr_info: - if info[1] == aname: - t = info[-2] - if t[0] == "(": - return _typeinfo_map["ENUM"] - else: - return _typeinfo_map[info[-2]] - return minidom._no_type - - def getAttributeTypeNS(self, namespaceURI, localName): - return minidom._no_type - - def isElementContent(self): - if self._model: - type = self._model[0] - return type not in (expat.model.XML_CTYPE_ANY, - expat.model.XML_CTYPE_MIXED) - else: - return False - - def isEmpty(self): - if self._model: - return self._model[0] == expat.model.XML_CTYPE_EMPTY - else: - return False - - def isId(self, aname): - for info in self._attr_info: - if info[1] == aname: - return info[-2] == "ID" - return False - - def isIdNS(self, euri, ename, auri, aname): - # not sure this is meaningful - return self.isId((auri, aname)) - -def _intern(builder, s): - return builder._intern_setdefault(s, s) - -def _parse_ns_name(builder, name): - assert ' ' in name - parts = name.split(' ') - intern = builder._intern_setdefault - if len(parts) == 3: - uri, localname, prefix = parts - prefix = intern(prefix, prefix) - qname = "%s:%s" % (prefix, localname) - qname = intern(qname, qname) - localname = intern(localname, localname) - else: - uri, localname = parts - prefix = EMPTY_PREFIX - qname = localname = intern(localname, localname) - return intern(uri, uri), localname, prefix, qname - - -class ExpatBuilder: - """Document builder that uses Expat to build a ParsedXML.DOM document - instance.""" - - def __init__(self, options=None): - if options is None: - options = xmlbuilder.Options() - self._options = options - if self._options.filter is not None: - self._filter = FilterVisibilityController(self._options.filter) - else: - self._filter = None - # This *really* doesn't do anything in this case, so - # override it with something fast & minimal. - self._finish_start_element = id - self._parser = None - self.reset() - - def createParser(self): - """Create a new parser object.""" - return expat.ParserCreate() - - def getParser(self): - """Return the parser object, creating a new one if needed.""" - if not self._parser: - self._parser = self.createParser() - self._intern_setdefault = self._parser.intern.setdefault - self._parser.buffer_text = True - self._parser.ordered_attributes = True - self._parser.specified_attributes = True - self.install(self._parser) - return self._parser - - def reset(self): - """Free all data structures used during DOM construction.""" - self.document = theDOMImplementation.createDocument( - EMPTY_NAMESPACE, None, None) - self.curNode = self.document - self._elem_info = self.document._elem_info - self._cdata = False - - def install(self, parser): - """Install the callbacks needed to build the DOM into the parser.""" - # This creates circular references! - parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler - parser.StartElementHandler = self.first_element_handler - parser.EndElementHandler = self.end_element_handler - parser.ProcessingInstructionHandler = self.pi_handler - if self._options.entities: - parser.EntityDeclHandler = self.entity_decl_handler - parser.NotationDeclHandler = self.notation_decl_handler - if self._options.comments: - parser.CommentHandler = self.comment_handler - if self._options.cdata_sections: - parser.StartCdataSectionHandler = self.start_cdata_section_handler - parser.EndCdataSectionHandler = self.end_cdata_section_handler - parser.CharacterDataHandler = self.character_data_handler_cdata - else: - parser.CharacterDataHandler = self.character_data_handler - parser.ExternalEntityRefHandler = self.external_entity_ref_handler - parser.XmlDeclHandler = self.xml_decl_handler - parser.ElementDeclHandler = self.element_decl_handler - parser.AttlistDeclHandler = self.attlist_decl_handler - - def parseFile(self, file): - """Parse a document from a file object, returning the document - node.""" - parser = self.getParser() - first_buffer = True - try: - while 1: - buffer = file.read(16*1024) - if not buffer: - break - parser.Parse(buffer, 0) - if first_buffer and self.document.documentElement: - self._setup_subset(buffer) - first_buffer = False - parser.Parse("", True) - except ParseEscape: - pass - doc = self.document - self.reset() - self._parser = None - return doc - - def parseString(self, string): - """Parse a document from a string, returning the document node.""" - parser = self.getParser() - try: - parser.Parse(string, True) - self._setup_subset(string) - except ParseEscape: - pass - doc = self.document - self.reset() - self._parser = None - return doc - - def _setup_subset(self, buffer): - """Load the internal subset if there might be one.""" - if self.document.doctype: - extractor = InternalSubsetExtractor() - extractor.parseString(buffer) - subset = extractor.getSubset() - self.document.doctype.internalSubset = subset - - def start_doctype_decl_handler(self, doctypeName, systemId, publicId, - has_internal_subset): - doctype = self.document.implementation.createDocumentType( - doctypeName, publicId, systemId) - doctype.ownerDocument = self.document - _append_child(self.document, doctype) - self.document.doctype = doctype - if self._filter and self._filter.acceptNode(doctype) == FILTER_REJECT: - self.document.doctype = None - del self.document.childNodes[-1] - doctype = None - self._parser.EntityDeclHandler = None - self._parser.NotationDeclHandler = None - if has_internal_subset: - if doctype is not None: - doctype.entities._seq = [] - doctype.notations._seq = [] - self._parser.CommentHandler = None - self._parser.ProcessingInstructionHandler = None - self._parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler - - def end_doctype_decl_handler(self): - if self._options.comments: - self._parser.CommentHandler = self.comment_handler - self._parser.ProcessingInstructionHandler = self.pi_handler - if not (self._elem_info or self._filter): - self._finish_end_element = id - - def pi_handler(self, target, data): - node = self.document.createProcessingInstruction(target, data) - _append_child(self.curNode, node) - if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: - self.curNode.removeChild(node) - - def character_data_handler_cdata(self, data): - childNodes = self.curNode.childNodes - if self._cdata: - if ( self._cdata_continue - and childNodes[-1].nodeType == CDATA_SECTION_NODE): - childNodes[-1].appendData(data) - return - node = self.document.createCDATASection(data) - self._cdata_continue = True - elif childNodes and childNodes[-1].nodeType == TEXT_NODE: - node = childNodes[-1] - value = node.data + data - d = node.__dict__ - d['data'] = d['nodeValue'] = value - return - else: - node = minidom.Text() - d = node.__dict__ - d['data'] = d['nodeValue'] = data - d['ownerDocument'] = self.document - _append_child(self.curNode, node) - - def character_data_handler(self, data): - childNodes = self.curNode.childNodes - if childNodes and childNodes[-1].nodeType == TEXT_NODE: - node = childNodes[-1] - d = node.__dict__ - d['data'] = d['nodeValue'] = node.data + data - return - node = minidom.Text() - d = node.__dict__ - d['data'] = d['nodeValue'] = node.data + data - d['ownerDocument'] = self.document - _append_child(self.curNode, node) - - def entity_decl_handler(self, entityName, is_parameter_entity, value, - base, systemId, publicId, notationName): - if is_parameter_entity: - # we don't care about parameter entities for the DOM - return - if not self._options.entities: - return - node = self.document._create_entity(entityName, publicId, - systemId, notationName) - if value is not None: - # internal entity - # node *should* be readonly, but we'll cheat - child = self.document.createTextNode(value) - node.childNodes.append(child) - self.document.doctype.entities._seq.append(node) - if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: - del self.document.doctype.entities._seq[-1] - - def notation_decl_handler(self, notationName, base, systemId, publicId): - node = self.document._create_notation(notationName, publicId, systemId) - self.document.doctype.notations._seq.append(node) - if self._filter and self._filter.acceptNode(node) == FILTER_ACCEPT: - del self.document.doctype.notations._seq[-1] - - def comment_handler(self, data): - node = self.document.createComment(data) - _append_child(self.curNode, node) - if self._filter and self._filter.acceptNode(node) == FILTER_REJECT: - self.curNode.removeChild(node) - - def start_cdata_section_handler(self): - self._cdata = True - self._cdata_continue = False - - def end_cdata_section_handler(self): - self._cdata = False - self._cdata_continue = False - - def external_entity_ref_handler(self, context, base, systemId, publicId): - return 1 - - def first_element_handler(self, name, attributes): - if self._filter is None and not self._elem_info: - self._finish_end_element = id - self.getParser().StartElementHandler = self.start_element_handler - self.start_element_handler(name, attributes) - - def start_element_handler(self, name, attributes): - node = self.document.createElement(name) - _append_child(self.curNode, node) - self.curNode = node - - if attributes: - for i in range(0, len(attributes), 2): - a = minidom.Attr(attributes[i], EMPTY_NAMESPACE, - None, EMPTY_PREFIX) - value = attributes[i+1] - d = a.childNodes[0].__dict__ - d['data'] = d['nodeValue'] = value - d = a.__dict__ - d['value'] = d['nodeValue'] = value - d['ownerDocument'] = self.document - _set_attribute_node(node, a) - - if node is not self.document.documentElement: - self._finish_start_element(node) - - def _finish_start_element(self, node): - if self._filter: - # To be general, we'd have to call isSameNode(), but this - # is sufficient for minidom: - if node is self.document.documentElement: - return - filt = self._filter.startContainer(node) - if filt == FILTER_REJECT: - # ignore this node & all descendents - Rejecter(self) - elif filt == FILTER_SKIP: - # ignore this node, but make it's children become - # children of the parent node - Skipper(self) - else: - return - self.curNode = node.parentNode - node.parentNode.removeChild(node) - node.unlink() - - # If this ever changes, Namespaces.end_element_handler() needs to - # be changed to match. - # - def end_element_handler(self, name): - curNode = self.curNode - self.curNode = curNode.parentNode - self._finish_end_element(curNode) - - def _finish_end_element(self, curNode): - info = self._elem_info.get(curNode.tagName) - if info: - self._handle_white_text_nodes(curNode, info) - if self._filter: - if curNode is self.document.documentElement: - return - if self._filter.acceptNode(curNode) == FILTER_REJECT: - self.curNode.removeChild(curNode) - curNode.unlink() - - def _handle_white_text_nodes(self, node, info): - if (self._options.whitespace_in_element_content - or not info.isElementContent()): - return - - # We have element type information and should remove ignorable - # whitespace; identify for text nodes which contain only - # whitespace. - L = [] - for child in node.childNodes: - if child.nodeType == TEXT_NODE and not child.data.strip(): - L.append(child) - - # Remove ignorable whitespace from the tree. - for child in L: - node.removeChild(child) - - def element_decl_handler(self, name, model): - info = self._elem_info.get(name) - if info is None: - self._elem_info[name] = ElementInfo(name, model) - else: - assert info._model is None - info._model = model - - def attlist_decl_handler(self, elem, name, type, default, required): - info = self._elem_info.get(elem) - if info is None: - info = ElementInfo(elem) - self._elem_info[elem] = info - info._attr_info.append( - [None, name, None, None, default, 0, type, required]) - - def xml_decl_handler(self, version, encoding, standalone): - self.document.version = version - self.document.encoding = encoding - # This is still a little ugly, thanks to the pyexpat API. ;-( - if standalone >= 0: - if standalone: - self.document.standalone = True - else: - self.document.standalone = False - - -# Don't include FILTER_INTERRUPT, since that's checked separately -# where allowed. -_ALLOWED_FILTER_RETURNS = (FILTER_ACCEPT, FILTER_REJECT, FILTER_SKIP) - -class FilterVisibilityController(object): - """Wrapper around a DOMBuilderFilter which implements the checks - to make the whatToShow filter attribute work.""" - - __slots__ = 'filter', - - def __init__(self, filter): - self.filter = filter - - def startContainer(self, node): - mask = self._nodetype_mask[node.nodeType] - if self.filter.whatToShow & mask: - val = self.filter.startContainer(node) - if val == FILTER_INTERRUPT: - raise ParseEscape - if val not in _ALLOWED_FILTER_RETURNS: - raise ValueError, \ - "startContainer() returned illegal value: " + repr(val) - return val - else: - return FILTER_ACCEPT - - def acceptNode(self, node): - mask = self._nodetype_mask[node.nodeType] - if self.filter.whatToShow & mask: - val = self.filter.acceptNode(node) - if val == FILTER_INTERRUPT: - raise ParseEscape - if val == FILTER_SKIP: - # move all child nodes to the parent, and remove this node - parent = node.parentNode - for child in node.childNodes[:]: - parent.appendChild(child) - # node is handled by the caller - return FILTER_REJECT - if val not in _ALLOWED_FILTER_RETURNS: - raise ValueError, \ - "acceptNode() returned illegal value: " + repr(val) - return val - else: - return FILTER_ACCEPT - - _nodetype_mask = { - Node.ELEMENT_NODE: NodeFilter.SHOW_ELEMENT, - Node.ATTRIBUTE_NODE: NodeFilter.SHOW_ATTRIBUTE, - Node.TEXT_NODE: NodeFilter.SHOW_TEXT, - Node.CDATA_SECTION_NODE: NodeFilter.SHOW_CDATA_SECTION, - Node.ENTITY_REFERENCE_NODE: NodeFilter.SHOW_ENTITY_REFERENCE, - Node.ENTITY_NODE: NodeFilter.SHOW_ENTITY, - Node.PROCESSING_INSTRUCTION_NODE: NodeFilter.SHOW_PROCESSING_INSTRUCTION, - Node.COMMENT_NODE: NodeFilter.SHOW_COMMENT, - Node.DOCUMENT_NODE: NodeFilter.SHOW_DOCUMENT, - Node.DOCUMENT_TYPE_NODE: NodeFilter.SHOW_DOCUMENT_TYPE, - Node.DOCUMENT_FRAGMENT_NODE: NodeFilter.SHOW_DOCUMENT_FRAGMENT, - Node.NOTATION_NODE: NodeFilter.SHOW_NOTATION, - } - - -class FilterCrutch(object): - __slots__ = '_builder', '_level', '_old_start', '_old_end' - - def __init__(self, builder): - self._level = 0 - self._builder = builder - parser = builder._parser - self._old_start = parser.StartElementHandler - self._old_end = parser.EndElementHandler - parser.StartElementHandler = self.start_element_handler - parser.EndElementHandler = self.end_element_handler - -class Rejecter(FilterCrutch): - __slots__ = () - - def __init__(self, builder): - FilterCrutch.__init__(self, builder) - parser = builder._parser - for name in ("ProcessingInstructionHandler", - "CommentHandler", - "CharacterDataHandler", - "StartCdataSectionHandler", - "EndCdataSectionHandler", - "ExternalEntityRefHandler", - ): - setattr(parser, name, None) - - def start_element_handler(self, *args): - self._level = self._level + 1 - - def end_element_handler(self, *args): - if self._level == 0: - # restore the old handlers - parser = self._builder._parser - self._builder.install(parser) - parser.StartElementHandler = self._old_start - parser.EndElementHandler = self._old_end - else: - self._level = self._level - 1 - -class Skipper(FilterCrutch): - __slots__ = () - - def start_element_handler(self, *args): - node = self._builder.curNode - self._old_start(*args) - if self._builder.curNode is not node: - self._level = self._level + 1 - - def end_element_handler(self, *args): - if self._level == 0: - # We're popping back out of the node we're skipping, so we - # shouldn't need to do anything but reset the handlers. - self._builder._parser.StartElementHandler = self._old_start - self._builder._parser.EndElementHandler = self._old_end - self._builder = None - else: - self._level = self._level - 1 - self._old_end(*args) - - -# framework document used by the fragment builder. -# Takes a string for the doctype, subset string, and namespace attrs string. - -_FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID = \ - "http://xml.python.org/entities/fragment-builder/internal" - -_FRAGMENT_BUILDER_TEMPLATE = ( - '''\ - -%%s -]> -&fragment-builder-internal;''' - % _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID) - - -class FragmentBuilder(ExpatBuilder): - """Builder which constructs document fragments given XML source - text and a context node. - - The context node is expected to provide information about the - namespace declarations which are in scope at the start of the - fragment. - """ - - def __init__(self, context, options=None): - if context.nodeType == DOCUMENT_NODE: - self.originalDocument = context - self.context = context - else: - self.originalDocument = context.ownerDocument - self.context = context - ExpatBuilder.__init__(self, options) - - def reset(self): - ExpatBuilder.reset(self) - self.fragment = None - - def parseFile(self, file): - """Parse a document fragment from a file object, returning the - fragment node.""" - return self.parseString(file.read()) - - def parseString(self, string): - """Parse a document fragment from a string, returning the - fragment node.""" - self._source = string - parser = self.getParser() - doctype = self.originalDocument.doctype - ident = "" - if doctype: - subset = doctype.internalSubset or self._getDeclarations() - if doctype.publicId: - ident = ('PUBLIC "%s" "%s"' - % (doctype.publicId, doctype.systemId)) - elif doctype.systemId: - ident = 'SYSTEM "%s"' % doctype.systemId - else: - subset = "" - nsattrs = self._getNSattrs() # get ns decls from node's ancestors - document = _FRAGMENT_BUILDER_TEMPLATE % (ident, subset, nsattrs) - try: - parser.Parse(document, 1) - except: - self.reset() - raise - fragment = self.fragment - self.reset() -## self._parser = None - return fragment - - def _getDeclarations(self): - """Re-create the internal subset from the DocumentType node. - - This is only needed if we don't already have the - internalSubset as a string. - """ - doctype = self.context.ownerDocument.doctype - s = "" - if doctype: - for i in range(doctype.notations.length): - notation = doctype.notations.item(i) - if s: - s = s + "\n " - s = "%s' \ - % (s, notation.publicId, notation.systemId) - else: - s = '%s SYSTEM "%s">' % (s, notation.systemId) - for i in range(doctype.entities.length): - entity = doctype.entities.item(i) - if s: - s = s + "\n " - s = "%s" - return s - - def _getNSattrs(self): - return "" - - def external_entity_ref_handler(self, context, base, systemId, publicId): - if systemId == _FRAGMENT_BUILDER_INTERNAL_SYSTEM_ID: - # this entref is the one that we made to put the subtree - # in; all of our given input is parsed in here. - old_document = self.document - old_cur_node = self.curNode - parser = self._parser.ExternalEntityParserCreate(context) - # put the real document back, parse into the fragment to return - self.document = self.originalDocument - self.fragment = self.document.createDocumentFragment() - self.curNode = self.fragment - try: - parser.Parse(self._source, 1) - finally: - self.curNode = old_cur_node - self.document = old_document - self._source = None - return -1 - else: - return ExpatBuilder.external_entity_ref_handler( - self, context, base, systemId, publicId) - - -class Namespaces: - """Mix-in class for builders; adds support for namespaces.""" - - def _initNamespaces(self): - # list of (prefix, uri) ns declarations. Namespace attrs are - # constructed from this and added to the element's attrs. - self._ns_ordered_prefixes = [] - - def createParser(self): - """Create a new namespace-handling parser.""" - parser = expat.ParserCreate(namespace_separator=" ") - parser.namespace_prefixes = True - return parser - - def install(self, parser): - """Insert the namespace-handlers onto the parser.""" - ExpatBuilder.install(self, parser) - if self._options.namespace_declarations: - parser.StartNamespaceDeclHandler = ( - self.start_namespace_decl_handler) - - def start_namespace_decl_handler(self, prefix, uri): - """Push this namespace declaration on our storage.""" - self._ns_ordered_prefixes.append((prefix, uri)) - - def start_element_handler(self, name, attributes): - if ' ' in name: - uri, localname, prefix, qname = _parse_ns_name(self, name) - else: - uri = EMPTY_NAMESPACE - qname = name - localname = None - prefix = EMPTY_PREFIX - node = minidom.Element(qname, uri, prefix, localname) - node.ownerDocument = self.document - _append_child(self.curNode, node) - self.curNode = node - - if self._ns_ordered_prefixes: - for prefix, uri in self._ns_ordered_prefixes: - if prefix: - a = minidom.Attr(_intern(self, 'xmlns:' + prefix), - XMLNS_NAMESPACE, prefix, "xmlns") - else: - a = minidom.Attr("xmlns", XMLNS_NAMESPACE, - "xmlns", EMPTY_PREFIX) - d = a.childNodes[0].__dict__ - d['data'] = d['nodeValue'] = uri - d = a.__dict__ - d['value'] = d['nodeValue'] = uri - d['ownerDocument'] = self.document - _set_attribute_node(node, a) - del self._ns_ordered_prefixes[:] - - if attributes: - _attrs = node._attrs - _attrsNS = node._attrsNS - for i in range(0, len(attributes), 2): - aname = attributes[i] - value = attributes[i+1] - if ' ' in aname: - uri, localname, prefix, qname = _parse_ns_name(self, aname) - a = minidom.Attr(qname, uri, localname, prefix) - _attrs[qname] = a - _attrsNS[(uri, localname)] = a - else: - a = minidom.Attr(aname, EMPTY_NAMESPACE, - aname, EMPTY_PREFIX) - _attrs[aname] = a - _attrsNS[(EMPTY_NAMESPACE, aname)] = a - d = a.childNodes[0].__dict__ - d['data'] = d['nodeValue'] = value - d = a.__dict__ - d['ownerDocument'] = self.document - d['value'] = d['nodeValue'] = value - d['ownerElement'] = node - - if __debug__: - # This only adds some asserts to the original - # end_element_handler(), so we only define this when -O is not - # used. If changing one, be sure to check the other to see if - # it needs to be changed as well. - # - def end_element_handler(self, name): - curNode = self.curNode - if ' ' in name: - uri, localname, prefix, qname = _parse_ns_name(self, name) - assert (curNode.namespaceURI == uri - and curNode.localName == localname - and curNode.prefix == prefix), \ - "element stack messed up! (namespace)" - else: - assert curNode.nodeName == name, \ - "element stack messed up - bad nodeName" - assert curNode.namespaceURI == EMPTY_NAMESPACE, \ - "element stack messed up - bad namespaceURI" - self.curNode = curNode.parentNode - self._finish_end_element(curNode) - - -class ExpatBuilderNS(Namespaces, ExpatBuilder): - """Document builder that supports namespaces.""" - - def reset(self): - ExpatBuilder.reset(self) - self._initNamespaces() - - -class FragmentBuilderNS(Namespaces, FragmentBuilder): - """Fragment builder that supports namespaces.""" - - def reset(self): - FragmentBuilder.reset(self) - self._initNamespaces() - - def _getNSattrs(self): - """Return string of namespace attributes from this element and - ancestors.""" - # XXX This needs to be re-written to walk the ancestors of the - # context to build up the namespace information from - # declarations, elements, and attributes found in context. - # Otherwise we have to store a bunch more data on the DOM - # (though that *might* be more reliable -- not clear). - attrs = "" - context = self.context - L = [] - while context: - if hasattr(context, '_ns_prefix_uri'): - for prefix, uri in context._ns_prefix_uri.items(): - # add every new NS decl from context to L and attrs string - if prefix in L: - continue - L.append(prefix) - if prefix: - declname = "xmlns:" + prefix - else: - declname = "xmlns" - if attrs: - attrs = "%s\n %s='%s'" % (attrs, declname, uri) - else: - attrs = " %s='%s'" % (declname, uri) - context = context.parentNode - return attrs - - -class ParseEscape(Exception): - """Exception raised to short-circuit parsing in InternalSubsetExtractor.""" - pass - -class InternalSubsetExtractor(ExpatBuilder): - """XML processor which can rip out the internal document type subset.""" - - subset = None - - def getSubset(self): - """Return the internal subset as a string.""" - return self.subset - - def parseFile(self, file): - try: - ExpatBuilder.parseFile(self, file) - except ParseEscape: - pass - - def parseString(self, string): - try: - ExpatBuilder.parseString(self, string) - except ParseEscape: - pass - - def install(self, parser): - parser.StartDoctypeDeclHandler = self.start_doctype_decl_handler - parser.StartElementHandler = self.start_element_handler - - def start_doctype_decl_handler(self, name, publicId, systemId, - has_internal_subset): - if has_internal_subset: - parser = self.getParser() - self.subset = [] - parser.DefaultHandler = self.subset.append - parser.EndDoctypeDeclHandler = self.end_doctype_decl_handler - else: - raise ParseEscape() - - def end_doctype_decl_handler(self): - s = ''.join(self.subset).replace('\r\n', '\n').replace('\r', '\n') - self.subset = s - raise ParseEscape() - - def start_element_handler(self, name, attrs): - raise ParseEscape() - - -def parse(file, namespaces=True): - """Parse a document, returning the resulting Document node. - - 'file' may be either a file name or an open file object. - """ - if namespaces: - builder = ExpatBuilderNS() - else: - builder = ExpatBuilder() - - if isinstance(file, StringTypes): - fp = open(file, 'rb') - try: - result = builder.parseFile(fp) - finally: - fp.close() - else: - result = builder.parseFile(file) - return result - - -def parseString(string, namespaces=True): - """Parse a document from a string, returning the resulting - Document node. - """ - if namespaces: - builder = ExpatBuilderNS() - else: - builder = ExpatBuilder() - return builder.parseString(string) - - -def parseFragment(file, context, namespaces=True): - """Parse a fragment of a document, given the context from which it - was originally extracted. context should be the parent of the - node(s) which are in the fragment. - - 'file' may be either a file name or an open file object. - """ - if namespaces: - builder = FragmentBuilderNS(context) - else: - builder = FragmentBuilder(context) - - if isinstance(file, StringTypes): - fp = open(file, 'rb') - try: - result = builder.parseFile(fp) - finally: - fp.close() - else: - result = builder.parseFile(file) - return result - - -def parseFragmentString(string, context, namespaces=True): - """Parse a fragment of a document from a string, given the context - from which it was originally extracted. context should be the - parent of the node(s) which are in the fragment. - """ - if namespaces: - builder = FragmentBuilderNS(context) - else: - builder = FragmentBuilder(context) - return builder.parseString(string) - - -def makeBuilder(options): - """Create a builder based on an Options object.""" - if options.namespaces: - return ExpatBuilderNS(options) - else: - return ExpatBuilder(options) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py deleted file mode 100644 index a5fcee0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minicompat.py +++ /dev/null @@ -1,110 +0,0 @@ -"""Python version compatibility support for minidom.""" - -# This module should only be imported using "import *". -# -# The following names are defined: -# -# NodeList -- lightest possible NodeList implementation -# -# EmptyNodeList -- lightest possible NodeList that is guaranteed to -# remain empty (immutable) -# -# StringTypes -- tuple of defined string types -# -# defproperty -- function used in conjunction with GetattrMagic; -# using these together is needed to make them work -# as efficiently as possible in both Python 2.2+ -# and older versions. For example: -# -# class MyClass(GetattrMagic): -# def _get_myattr(self): -# return something -# -# defproperty(MyClass, "myattr", -# "return some value") -# -# For Python 2.2 and newer, this will construct a -# property object on the class, which avoids -# needing to override __getattr__(). It will only -# work for read-only attributes. -# -# For older versions of Python, inheriting from -# GetattrMagic will use the traditional -# __getattr__() hackery to achieve the same effect, -# but less efficiently. -# -# defproperty() should be used for each version of -# the relevant _get_() function. - -__all__ = ["NodeList", "EmptyNodeList", "StringTypes", "defproperty"] - -import xml.dom - -try: - unicode -except NameError: - StringTypes = type(''), -else: - StringTypes = type(''), type(unicode('')) - - -class NodeList(list): - __slots__ = () - - def item(self, index): - if 0 <= index < len(self): - return self[index] - - def _get_length(self): - return len(self) - - def _set_length(self, value): - raise xml.dom.NoModificationAllowedErr( - "attempt to modify read-only attribute 'length'") - - length = property(_get_length, _set_length, - doc="The number of nodes in the NodeList.") - - def __getstate__(self): - return list(self) - - def __setstate__(self, state): - self[:] = state - - -class EmptyNodeList(tuple): - __slots__ = () - - def __add__(self, other): - NL = NodeList() - NL.extend(other) - return NL - - def __radd__(self, other): - NL = NodeList() - NL.extend(other) - return NL - - def item(self, index): - return None - - def _get_length(self): - return 0 - - def _set_length(self, value): - raise xml.dom.NoModificationAllowedErr( - "attempt to modify read-only attribute 'length'") - - length = property(_get_length, _set_length, - doc="The number of nodes in the NodeList.") - - -def defproperty(klass, name, doc): - get = getattr(klass, ("_get_" + name)).im_func - def set(self, value, name=name): - raise xml.dom.NoModificationAllowedErr( - "attempt to modify read-only attribute " + repr(name)) - assert not hasattr(klass, "_set_" + name), \ - "expected not to find _set_" + name - prop = property(get, set, doc=doc) - setattr(klass, name, prop) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py deleted file mode 100644 index 54b41c4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/minidom.py +++ /dev/null @@ -1,1941 +0,0 @@ -"""Simple implementation of the Level 1 DOM. - -Namespaces and other minor Level 2 features are also supported. - -parse("foo.xml") - -parseString("") - -Todo: -===== - * convenience methods for getting elements and text. - * more testing - * bring some of the writer and linearizer code into conformance with this - interface - * SAX 2 namespaces -""" - -import xml.dom - -from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg -from xml.dom.minicompat import * -from xml.dom.xmlbuilder import DOMImplementationLS, DocumentLS - -# This is used by the ID-cache invalidation checks; the list isn't -# actually complete, since the nodes being checked will never be the -# DOCUMENT_NODE or DOCUMENT_FRAGMENT_NODE. (The node being checked is -# the node being added or removed, not the node being modified.) -# -_nodeTypes_with_children = (xml.dom.Node.ELEMENT_NODE, - xml.dom.Node.ENTITY_REFERENCE_NODE) - - -class Node(xml.dom.Node): - namespaceURI = None # this is non-null only for elements and attributes - parentNode = None - ownerDocument = None - nextSibling = None - previousSibling = None - - prefix = EMPTY_PREFIX # non-null only for NS elements and attributes - - def __nonzero__(self): - return True - - def toxml(self, encoding = None): - return self.toprettyxml("", "", encoding) - - def toprettyxml(self, indent="\t", newl="\n", encoding = None): - # indent = the indentation string to prepend, per level - # newl = the newline string to append - writer = _get_StringIO() - if encoding is not None: - import codecs - # Can't use codecs.getwriter to preserve 2.0 compatibility - writer = codecs.lookup(encoding)[3](writer) - if self.nodeType == Node.DOCUMENT_NODE: - # Can pass encoding only to document, to put it into XML header - self.writexml(writer, "", indent, newl, encoding) - else: - self.writexml(writer, "", indent, newl) - return writer.getvalue() - - def hasChildNodes(self): - if self.childNodes: - return True - else: - return False - - def _get_childNodes(self): - return self.childNodes - - def _get_firstChild(self): - if self.childNodes: - return self.childNodes[0] - - def _get_lastChild(self): - if self.childNodes: - return self.childNodes[-1] - - def insertBefore(self, newChild, refChild): - if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: - for c in tuple(newChild.childNodes): - self.insertBefore(c, refChild) - ### The DOM does not clearly specify what to return in this case - return newChild - if newChild.nodeType not in self._child_node_types: - raise xml.dom.HierarchyRequestErr( - "%s cannot be child of %s" % (repr(newChild), repr(self))) - if newChild.parentNode is not None: - newChild.parentNode.removeChild(newChild) - if refChild is None: - self.appendChild(newChild) - else: - try: - index = self.childNodes.index(refChild) - except ValueError: - raise xml.dom.NotFoundErr() - if newChild.nodeType in _nodeTypes_with_children: - _clear_id_cache(self) - self.childNodes.insert(index, newChild) - newChild.nextSibling = refChild - refChild.previousSibling = newChild - if index: - node = self.childNodes[index-1] - node.nextSibling = newChild - newChild.previousSibling = node - else: - newChild.previousSibling = None - newChild.parentNode = self - return newChild - - def appendChild(self, node): - if node.nodeType == self.DOCUMENT_FRAGMENT_NODE: - for c in tuple(node.childNodes): - self.appendChild(c) - ### The DOM does not clearly specify what to return in this case - return node - if node.nodeType not in self._child_node_types: - raise xml.dom.HierarchyRequestErr( - "%s cannot be child of %s" % (repr(node), repr(self))) - elif node.nodeType in _nodeTypes_with_children: - _clear_id_cache(self) - if node.parentNode is not None: - node.parentNode.removeChild(node) - _append_child(self, node) - node.nextSibling = None - return node - - def replaceChild(self, newChild, oldChild): - if newChild.nodeType == self.DOCUMENT_FRAGMENT_NODE: - refChild = oldChild.nextSibling - self.removeChild(oldChild) - return self.insertBefore(newChild, refChild) - if newChild.nodeType not in self._child_node_types: - raise xml.dom.HierarchyRequestErr( - "%s cannot be child of %s" % (repr(newChild), repr(self))) - if newChild is oldChild: - return - if newChild.parentNode is not None: - newChild.parentNode.removeChild(newChild) - try: - index = self.childNodes.index(oldChild) - except ValueError: - raise xml.dom.NotFoundErr() - self.childNodes[index] = newChild - newChild.parentNode = self - oldChild.parentNode = None - if (newChild.nodeType in _nodeTypes_with_children - or oldChild.nodeType in _nodeTypes_with_children): - _clear_id_cache(self) - newChild.nextSibling = oldChild.nextSibling - newChild.previousSibling = oldChild.previousSibling - oldChild.nextSibling = None - oldChild.previousSibling = None - if newChild.previousSibling: - newChild.previousSibling.nextSibling = newChild - if newChild.nextSibling: - newChild.nextSibling.previousSibling = newChild - return oldChild - - def removeChild(self, oldChild): - try: - self.childNodes.remove(oldChild) - except ValueError: - raise xml.dom.NotFoundErr() - if oldChild.nextSibling is not None: - oldChild.nextSibling.previousSibling = oldChild.previousSibling - if oldChild.previousSibling is not None: - oldChild.previousSibling.nextSibling = oldChild.nextSibling - oldChild.nextSibling = oldChild.previousSibling = None - if oldChild.nodeType in _nodeTypes_with_children: - _clear_id_cache(self) - - oldChild.parentNode = None - return oldChild - - def normalize(self): - L = [] - for child in self.childNodes: - if child.nodeType == Node.TEXT_NODE: - if not child.data: - # empty text node; discard - if L: - L[-1].nextSibling = child.nextSibling - if child.nextSibling: - child.nextSibling.previousSibling = child.previousSibling - child.unlink() - elif L and L[-1].nodeType == child.nodeType: - # collapse text node - node = L[-1] - node.data = node.data + child.data - node.nextSibling = child.nextSibling - if child.nextSibling: - child.nextSibling.previousSibling = node - child.unlink() - else: - L.append(child) - else: - L.append(child) - if child.nodeType == Node.ELEMENT_NODE: - child.normalize() - self.childNodes[:] = L - - def cloneNode(self, deep): - return _clone_node(self, deep, self.ownerDocument or self) - - def isSupported(self, feature, version): - return self.ownerDocument.implementation.hasFeature(feature, version) - - def _get_localName(self): - # Overridden in Element and Attr where localName can be Non-Null - return None - - # Node interfaces from Level 3 (WD 9 April 2002) - - def isSameNode(self, other): - return self is other - - def getInterface(self, feature): - if self.isSupported(feature, None): - return self - else: - return None - - # The "user data" functions use a dictionary that is only present - # if some user data has been set, so be careful not to assume it - # exists. - - def getUserData(self, key): - try: - return self._user_data[key][0] - except (AttributeError, KeyError): - return None - - def setUserData(self, key, data, handler): - old = None - try: - d = self._user_data - except AttributeError: - d = {} - self._user_data = d - if key in d: - old = d[key][0] - if data is None: - # ignore handlers passed for None - handler = None - if old is not None: - del d[key] - else: - d[key] = (data, handler) - return old - - def _call_user_data_handler(self, operation, src, dst): - if hasattr(self, "_user_data"): - for key, (data, handler) in self._user_data.items(): - if handler is not None: - handler.handle(operation, key, data, src, dst) - - # minidom-specific API: - - def unlink(self): - self.parentNode = self.ownerDocument = None - if self.childNodes: - for child in self.childNodes: - child.unlink() - self.childNodes = NodeList() - self.previousSibling = None - self.nextSibling = None - -defproperty(Node, "firstChild", doc="First child node, or None.") -defproperty(Node, "lastChild", doc="Last child node, or None.") -defproperty(Node, "localName", doc="Namespace-local name of this node.") - - -def _append_child(self, node): - # fast path with less checks; usable by DOM builders if careful - childNodes = self.childNodes - if childNodes: - last = childNodes[-1] - node.__dict__["previousSibling"] = last - last.__dict__["nextSibling"] = node - childNodes.append(node) - node.__dict__["parentNode"] = self - -def _in_document(node): - # return True iff node is part of a document tree - while node is not None: - if node.nodeType == Node.DOCUMENT_NODE: - return True - node = node.parentNode - return False - -def _write_data(writer, data): - "Writes datachars to writer." - if data: - data = data.replace("&", "&").replace("<", "<"). \ - replace("\"", """).replace(">", ">") - writer.write(data) - -def _get_elements_by_tagName_helper(parent, name, rc): - for node in parent.childNodes: - if node.nodeType == Node.ELEMENT_NODE and \ - (name == "*" or node.tagName == name): - rc.append(node) - _get_elements_by_tagName_helper(node, name, rc) - return rc - -def _get_elements_by_tagName_ns_helper(parent, nsURI, localName, rc): - for node in parent.childNodes: - if node.nodeType == Node.ELEMENT_NODE: - if ((localName == "*" or node.localName == localName) and - (nsURI == "*" or node.namespaceURI == nsURI)): - rc.append(node) - _get_elements_by_tagName_ns_helper(node, nsURI, localName, rc) - return rc - -class DocumentFragment(Node): - nodeType = Node.DOCUMENT_FRAGMENT_NODE - nodeName = "#document-fragment" - nodeValue = None - attributes = None - parentNode = None - _child_node_types = (Node.ELEMENT_NODE, - Node.TEXT_NODE, - Node.CDATA_SECTION_NODE, - Node.ENTITY_REFERENCE_NODE, - Node.PROCESSING_INSTRUCTION_NODE, - Node.COMMENT_NODE, - Node.NOTATION_NODE) - - def __init__(self): - self.childNodes = NodeList() - - -class Attr(Node): - nodeType = Node.ATTRIBUTE_NODE - attributes = None - ownerElement = None - specified = False - _is_id = False - - _child_node_types = (Node.TEXT_NODE, Node.ENTITY_REFERENCE_NODE) - - def __init__(self, qName, namespaceURI=EMPTY_NAMESPACE, localName=None, - prefix=None): - # skip setattr for performance - d = self.__dict__ - d["nodeName"] = d["name"] = qName - d["namespaceURI"] = namespaceURI - d["prefix"] = prefix - d['childNodes'] = NodeList() - - # Add the single child node that represents the value of the attr - self.childNodes.append(Text()) - - # nodeValue and value are set elsewhere - - def _get_localName(self): - return self.nodeName.split(":", 1)[-1] - - def _get_specified(self): - return self.specified - - def __setattr__(self, name, value): - d = self.__dict__ - if name in ("value", "nodeValue"): - d["value"] = d["nodeValue"] = value - d2 = self.childNodes[0].__dict__ - d2["data"] = d2["nodeValue"] = value - if self.ownerElement is not None: - _clear_id_cache(self.ownerElement) - elif name in ("name", "nodeName"): - d["name"] = d["nodeName"] = value - if self.ownerElement is not None: - _clear_id_cache(self.ownerElement) - else: - d[name] = value - - def _set_prefix(self, prefix): - nsuri = self.namespaceURI - if prefix == "xmlns": - if nsuri and nsuri != XMLNS_NAMESPACE: - raise xml.dom.NamespaceErr( - "illegal use of 'xmlns' prefix for the wrong namespace") - d = self.__dict__ - d['prefix'] = prefix - if prefix is None: - newName = self.localName - else: - newName = "%s:%s" % (prefix, self.localName) - if self.ownerElement: - _clear_id_cache(self.ownerElement) - d['nodeName'] = d['name'] = newName - - def _set_value(self, value): - d = self.__dict__ - d['value'] = d['nodeValue'] = value - if self.ownerElement: - _clear_id_cache(self.ownerElement) - self.childNodes[0].data = value - - def unlink(self): - # This implementation does not call the base implementation - # since most of that is not needed, and the expense of the - # method call is not warranted. We duplicate the removal of - # children, but that's all we needed from the base class. - elem = self.ownerElement - if elem is not None: - del elem._attrs[self.nodeName] - del elem._attrsNS[(self.namespaceURI, self.localName)] - if self._is_id: - self._is_id = False - elem._magic_id_nodes -= 1 - self.ownerDocument._magic_id_count -= 1 - for child in self.childNodes: - child.unlink() - del self.childNodes[:] - - def _get_isId(self): - if self._is_id: - return True - doc = self.ownerDocument - elem = self.ownerElement - if doc is None or elem is None: - return False - - info = doc._get_elem_info(elem) - if info is None: - return False - if self.namespaceURI: - return info.isIdNS(self.namespaceURI, self.localName) - else: - return info.isId(self.nodeName) - - def _get_schemaType(self): - doc = self.ownerDocument - elem = self.ownerElement - if doc is None or elem is None: - return _no_type - - info = doc._get_elem_info(elem) - if info is None: - return _no_type - if self.namespaceURI: - return info.getAttributeTypeNS(self.namespaceURI, self.localName) - else: - return info.getAttributeType(self.nodeName) - -defproperty(Attr, "isId", doc="True if this attribute is an ID.") -defproperty(Attr, "localName", doc="Namespace-local name of this attribute.") -defproperty(Attr, "schemaType", doc="Schema type for this attribute.") - - -class NamedNodeMap(object): - """The attribute list is a transient interface to the underlying - dictionaries. Mutations here will change the underlying element's - dictionary. - - Ordering is imposed artificially and does not reflect the order of - attributes as found in an input document. - """ - - __slots__ = ('_attrs', '_attrsNS', '_ownerElement') - - def __init__(self, attrs, attrsNS, ownerElement): - self._attrs = attrs - self._attrsNS = attrsNS - self._ownerElement = ownerElement - - def _get_length(self): - return len(self._attrs) - - def item(self, index): - try: - return self[self._attrs.keys()[index]] - except IndexError: - return None - - def items(self): - L = [] - for node in self._attrs.values(): - L.append((node.nodeName, node.value)) - return L - - def itemsNS(self): - L = [] - for node in self._attrs.values(): - L.append(((node.namespaceURI, node.localName), node.value)) - return L - - def has_key(self, key): - if isinstance(key, StringTypes): - return key in self._attrs - else: - return key in self._attrsNS - - def keys(self): - return self._attrs.keys() - - def keysNS(self): - return self._attrsNS.keys() - - def values(self): - return self._attrs.values() - - def get(self, name, value=None): - return self._attrs.get(name, value) - - __len__ = _get_length - - __hash__ = None # Mutable type can't be correctly hashed - def __cmp__(self, other): - if self._attrs is getattr(other, "_attrs", None): - return 0 - else: - return cmp(id(self), id(other)) - - def __getitem__(self, attname_or_tuple): - if isinstance(attname_or_tuple, tuple): - return self._attrsNS[attname_or_tuple] - else: - return self._attrs[attname_or_tuple] - - # same as set - def __setitem__(self, attname, value): - if isinstance(value, StringTypes): - try: - node = self._attrs[attname] - except KeyError: - node = Attr(attname) - node.ownerDocument = self._ownerElement.ownerDocument - self.setNamedItem(node) - node.value = value - else: - if not isinstance(value, Attr): - raise TypeError, "value must be a string or Attr object" - node = value - self.setNamedItem(node) - - def getNamedItem(self, name): - try: - return self._attrs[name] - except KeyError: - return None - - def getNamedItemNS(self, namespaceURI, localName): - try: - return self._attrsNS[(namespaceURI, localName)] - except KeyError: - return None - - def removeNamedItem(self, name): - n = self.getNamedItem(name) - if n is not None: - _clear_id_cache(self._ownerElement) - del self._attrs[n.nodeName] - del self._attrsNS[(n.namespaceURI, n.localName)] - if 'ownerElement' in n.__dict__: - n.__dict__['ownerElement'] = None - return n - else: - raise xml.dom.NotFoundErr() - - def removeNamedItemNS(self, namespaceURI, localName): - n = self.getNamedItemNS(namespaceURI, localName) - if n is not None: - _clear_id_cache(self._ownerElement) - del self._attrsNS[(n.namespaceURI, n.localName)] - del self._attrs[n.nodeName] - if 'ownerElement' in n.__dict__: - n.__dict__['ownerElement'] = None - return n - else: - raise xml.dom.NotFoundErr() - - def setNamedItem(self, node): - if not isinstance(node, Attr): - raise xml.dom.HierarchyRequestErr( - "%s cannot be child of %s" % (repr(node), repr(self))) - old = self._attrs.get(node.name) - if old: - old.unlink() - self._attrs[node.name] = node - self._attrsNS[(node.namespaceURI, node.localName)] = node - node.ownerElement = self._ownerElement - _clear_id_cache(node.ownerElement) - return old - - def setNamedItemNS(self, node): - return self.setNamedItem(node) - - def __delitem__(self, attname_or_tuple): - node = self[attname_or_tuple] - _clear_id_cache(node.ownerElement) - node.unlink() - - def __getstate__(self): - return self._attrs, self._attrsNS, self._ownerElement - - def __setstate__(self, state): - self._attrs, self._attrsNS, self._ownerElement = state - -defproperty(NamedNodeMap, "length", - doc="Number of nodes in the NamedNodeMap.") - -AttributeList = NamedNodeMap - - -class TypeInfo(object): - __slots__ = 'namespace', 'name' - - def __init__(self, namespace, name): - self.namespace = namespace - self.name = name - - def __repr__(self): - if self.namespace: - return "" % (self.name, self.namespace) - else: - return "" % self.name - - def _get_name(self): - return self.name - - def _get_namespace(self): - return self.namespace - -_no_type = TypeInfo(None, None) - -class Element(Node): - nodeType = Node.ELEMENT_NODE - nodeValue = None - schemaType = _no_type - - _magic_id_nodes = 0 - - _child_node_types = (Node.ELEMENT_NODE, - Node.PROCESSING_INSTRUCTION_NODE, - Node.COMMENT_NODE, - Node.TEXT_NODE, - Node.CDATA_SECTION_NODE, - Node.ENTITY_REFERENCE_NODE) - - def __init__(self, tagName, namespaceURI=EMPTY_NAMESPACE, prefix=None, - localName=None): - self.tagName = self.nodeName = tagName - self.prefix = prefix - self.namespaceURI = namespaceURI - self.childNodes = NodeList() - - self._attrs = {} # attributes are double-indexed: - self._attrsNS = {} # tagName -> Attribute - # URI,localName -> Attribute - # in the future: consider lazy generation - # of attribute objects this is too tricky - # for now because of headaches with - # namespaces. - - def _get_localName(self): - return self.tagName.split(":", 1)[-1] - - def _get_tagName(self): - return self.tagName - - def unlink(self): - for attr in self._attrs.values(): - attr.unlink() - self._attrs = None - self._attrsNS = None - Node.unlink(self) - - def getAttribute(self, attname): - try: - return self._attrs[attname].value - except KeyError: - return "" - - def getAttributeNS(self, namespaceURI, localName): - try: - return self._attrsNS[(namespaceURI, localName)].value - except KeyError: - return "" - - def setAttribute(self, attname, value): - attr = self.getAttributeNode(attname) - if attr is None: - attr = Attr(attname) - # for performance - d = attr.__dict__ - d["value"] = d["nodeValue"] = value - d["ownerDocument"] = self.ownerDocument - self.setAttributeNode(attr) - elif value != attr.value: - d = attr.__dict__ - d["value"] = d["nodeValue"] = value - if attr.isId: - _clear_id_cache(self) - - def setAttributeNS(self, namespaceURI, qualifiedName, value): - prefix, localname = _nssplit(qualifiedName) - attr = self.getAttributeNodeNS(namespaceURI, localname) - if attr is None: - # for performance - attr = Attr(qualifiedName, namespaceURI, localname, prefix) - d = attr.__dict__ - d["prefix"] = prefix - d["nodeName"] = qualifiedName - d["value"] = d["nodeValue"] = value - d["ownerDocument"] = self.ownerDocument - self.setAttributeNode(attr) - else: - d = attr.__dict__ - if value != attr.value: - d["value"] = d["nodeValue"] = value - if attr.isId: - _clear_id_cache(self) - if attr.prefix != prefix: - d["prefix"] = prefix - d["nodeName"] = qualifiedName - - def getAttributeNode(self, attrname): - return self._attrs.get(attrname) - - def getAttributeNodeNS(self, namespaceURI, localName): - return self._attrsNS.get((namespaceURI, localName)) - - def setAttributeNode(self, attr): - if attr.ownerElement not in (None, self): - raise xml.dom.InuseAttributeErr("attribute node already owned") - old1 = self._attrs.get(attr.name, None) - if old1 is not None: - self.removeAttributeNode(old1) - old2 = self._attrsNS.get((attr.namespaceURI, attr.localName), None) - if old2 is not None and old2 is not old1: - self.removeAttributeNode(old2) - _set_attribute_node(self, attr) - - if old1 is not attr: - # It might have already been part of this node, in which case - # it doesn't represent a change, and should not be returned. - return old1 - if old2 is not attr: - return old2 - - setAttributeNodeNS = setAttributeNode - - def removeAttribute(self, name): - try: - attr = self._attrs[name] - except KeyError: - raise xml.dom.NotFoundErr() - self.removeAttributeNode(attr) - - def removeAttributeNS(self, namespaceURI, localName): - try: - attr = self._attrsNS[(namespaceURI, localName)] - except KeyError: - raise xml.dom.NotFoundErr() - self.removeAttributeNode(attr) - - def removeAttributeNode(self, node): - if node is None: - raise xml.dom.NotFoundErr() - try: - self._attrs[node.name] - except KeyError: - raise xml.dom.NotFoundErr() - _clear_id_cache(self) - node.unlink() - # Restore this since the node is still useful and otherwise - # unlinked - node.ownerDocument = self.ownerDocument - - removeAttributeNodeNS = removeAttributeNode - - def hasAttribute(self, name): - return name in self._attrs - - def hasAttributeNS(self, namespaceURI, localName): - return (namespaceURI, localName) in self._attrsNS - - def getElementsByTagName(self, name): - return _get_elements_by_tagName_helper(self, name, NodeList()) - - def getElementsByTagNameNS(self, namespaceURI, localName): - return _get_elements_by_tagName_ns_helper( - self, namespaceURI, localName, NodeList()) - - def __repr__(self): - return "" % (self.tagName, id(self)) - - def writexml(self, writer, indent="", addindent="", newl=""): - # indent = current indentation - # addindent = indentation to add to higher levels - # newl = newline string - writer.write(indent+"<" + self.tagName) - - attrs = self._get_attributes() - a_names = attrs.keys() - a_names.sort() - - for a_name in a_names: - writer.write(" %s=\"" % a_name) - _write_data(writer, attrs[a_name].value) - writer.write("\"") - if self.childNodes: - writer.write(">") - if (len(self.childNodes) == 1 and - self.childNodes[0].nodeType == Node.TEXT_NODE): - self.childNodes[0].writexml(writer, '', '', '') - else: - writer.write(newl) - for node in self.childNodes: - node.writexml(writer, indent+addindent, addindent, newl) - writer.write(indent) - writer.write("%s" % (self.tagName, newl)) - else: - writer.write("/>%s"%(newl)) - - def _get_attributes(self): - return NamedNodeMap(self._attrs, self._attrsNS, self) - - def hasAttributes(self): - if self._attrs: - return True - else: - return False - - # DOM Level 3 attributes, based on the 22 Oct 2002 draft - - def setIdAttribute(self, name): - idAttr = self.getAttributeNode(name) - self.setIdAttributeNode(idAttr) - - def setIdAttributeNS(self, namespaceURI, localName): - idAttr = self.getAttributeNodeNS(namespaceURI, localName) - self.setIdAttributeNode(idAttr) - - def setIdAttributeNode(self, idAttr): - if idAttr is None or not self.isSameNode(idAttr.ownerElement): - raise xml.dom.NotFoundErr() - if _get_containing_entref(self) is not None: - raise xml.dom.NoModificationAllowedErr() - if not idAttr._is_id: - idAttr.__dict__['_is_id'] = True - self._magic_id_nodes += 1 - self.ownerDocument._magic_id_count += 1 - _clear_id_cache(self) - -defproperty(Element, "attributes", - doc="NamedNodeMap of attributes on the element.") -defproperty(Element, "localName", - doc="Namespace-local name of this element.") - - -def _set_attribute_node(element, attr): - _clear_id_cache(element) - element._attrs[attr.name] = attr - element._attrsNS[(attr.namespaceURI, attr.localName)] = attr - - # This creates a circular reference, but Element.unlink() - # breaks the cycle since the references to the attribute - # dictionaries are tossed. - attr.__dict__['ownerElement'] = element - - -class Childless: - """Mixin that makes childless-ness easy to implement and avoids - the complexity of the Node methods that deal with children. - """ - - attributes = None - childNodes = EmptyNodeList() - firstChild = None - lastChild = None - - def _get_firstChild(self): - return None - - def _get_lastChild(self): - return None - - def appendChild(self, node): - raise xml.dom.HierarchyRequestErr( - self.nodeName + " nodes cannot have children") - - def hasChildNodes(self): - return False - - def insertBefore(self, newChild, refChild): - raise xml.dom.HierarchyRequestErr( - self.nodeName + " nodes do not have children") - - def removeChild(self, oldChild): - raise xml.dom.NotFoundErr( - self.nodeName + " nodes do not have children") - - def normalize(self): - # For childless nodes, normalize() has nothing to do. - pass - - def replaceChild(self, newChild, oldChild): - raise xml.dom.HierarchyRequestErr( - self.nodeName + " nodes do not have children") - - -class ProcessingInstruction(Childless, Node): - nodeType = Node.PROCESSING_INSTRUCTION_NODE - - def __init__(self, target, data): - self.target = self.nodeName = target - self.data = self.nodeValue = data - - def _get_data(self): - return self.data - def _set_data(self, value): - d = self.__dict__ - d['data'] = d['nodeValue'] = value - - def _get_target(self): - return self.target - def _set_target(self, value): - d = self.__dict__ - d['target'] = d['nodeName'] = value - - def __setattr__(self, name, value): - if name == "data" or name == "nodeValue": - self.__dict__['data'] = self.__dict__['nodeValue'] = value - elif name == "target" or name == "nodeName": - self.__dict__['target'] = self.__dict__['nodeName'] = value - else: - self.__dict__[name] = value - - def writexml(self, writer, indent="", addindent="", newl=""): - writer.write("%s%s" % (indent,self.target, self.data, newl)) - - -class CharacterData(Childless, Node): - def _get_length(self): - return len(self.data) - __len__ = _get_length - - def _get_data(self): - return self.__dict__['data'] - def _set_data(self, data): - d = self.__dict__ - d['data'] = d['nodeValue'] = data - - _get_nodeValue = _get_data - _set_nodeValue = _set_data - - def __setattr__(self, name, value): - if name == "data" or name == "nodeValue": - self.__dict__['data'] = self.__dict__['nodeValue'] = value - else: - self.__dict__[name] = value - - def __repr__(self): - data = self.data - if len(data) > 10: - dotdotdot = "..." - else: - dotdotdot = "" - return '' % ( - self.__class__.__name__, data[0:10], dotdotdot) - - def substringData(self, offset, count): - if offset < 0: - raise xml.dom.IndexSizeErr("offset cannot be negative") - if offset >= len(self.data): - raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") - if count < 0: - raise xml.dom.IndexSizeErr("count cannot be negative") - return self.data[offset:offset+count] - - def appendData(self, arg): - self.data = self.data + arg - - def insertData(self, offset, arg): - if offset < 0: - raise xml.dom.IndexSizeErr("offset cannot be negative") - if offset >= len(self.data): - raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") - if arg: - self.data = "%s%s%s" % ( - self.data[:offset], arg, self.data[offset:]) - - def deleteData(self, offset, count): - if offset < 0: - raise xml.dom.IndexSizeErr("offset cannot be negative") - if offset >= len(self.data): - raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") - if count < 0: - raise xml.dom.IndexSizeErr("count cannot be negative") - if count: - self.data = self.data[:offset] + self.data[offset+count:] - - def replaceData(self, offset, count, arg): - if offset < 0: - raise xml.dom.IndexSizeErr("offset cannot be negative") - if offset >= len(self.data): - raise xml.dom.IndexSizeErr("offset cannot be beyond end of data") - if count < 0: - raise xml.dom.IndexSizeErr("count cannot be negative") - if count: - self.data = "%s%s%s" % ( - self.data[:offset], arg, self.data[offset+count:]) - -defproperty(CharacterData, "length", doc="Length of the string data.") - - -class Text(CharacterData): - # Make sure we don't add an instance __dict__ if we don't already - # have one, at least when that's possible: - # XXX this does not work, CharacterData is an old-style class - # __slots__ = () - - nodeType = Node.TEXT_NODE - nodeName = "#text" - attributes = None - - def splitText(self, offset): - if offset < 0 or offset > len(self.data): - raise xml.dom.IndexSizeErr("illegal offset value") - newText = self.__class__() - newText.data = self.data[offset:] - newText.ownerDocument = self.ownerDocument - next = self.nextSibling - if self.parentNode and self in self.parentNode.childNodes: - if next is None: - self.parentNode.appendChild(newText) - else: - self.parentNode.insertBefore(newText, next) - self.data = self.data[:offset] - return newText - - def writexml(self, writer, indent="", addindent="", newl=""): - _write_data(writer, "%s%s%s" % (indent, self.data, newl)) - - # DOM Level 3 (WD 9 April 2002) - - def _get_wholeText(self): - L = [self.data] - n = self.previousSibling - while n is not None: - if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): - L.insert(0, n.data) - n = n.previousSibling - else: - break - n = self.nextSibling - while n is not None: - if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): - L.append(n.data) - n = n.nextSibling - else: - break - return ''.join(L) - - def replaceWholeText(self, content): - # XXX This needs to be seriously changed if minidom ever - # supports EntityReference nodes. - parent = self.parentNode - n = self.previousSibling - while n is not None: - if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): - next = n.previousSibling - parent.removeChild(n) - n = next - else: - break - n = self.nextSibling - if not content: - parent.removeChild(self) - while n is not None: - if n.nodeType in (Node.TEXT_NODE, Node.CDATA_SECTION_NODE): - next = n.nextSibling - parent.removeChild(n) - n = next - else: - break - if content: - d = self.__dict__ - d['data'] = content - d['nodeValue'] = content - return self - else: - return None - - def _get_isWhitespaceInElementContent(self): - if self.data.strip(): - return False - elem = _get_containing_element(self) - if elem is None: - return False - info = self.ownerDocument._get_elem_info(elem) - if info is None: - return False - else: - return info.isElementContent() - -defproperty(Text, "isWhitespaceInElementContent", - doc="True iff this text node contains only whitespace" - " and is in element content.") -defproperty(Text, "wholeText", - doc="The text of all logically-adjacent text nodes.") - - -def _get_containing_element(node): - c = node.parentNode - while c is not None: - if c.nodeType == Node.ELEMENT_NODE: - return c - c = c.parentNode - return None - -def _get_containing_entref(node): - c = node.parentNode - while c is not None: - if c.nodeType == Node.ENTITY_REFERENCE_NODE: - return c - c = c.parentNode - return None - - -class Comment(Childless, CharacterData): - nodeType = Node.COMMENT_NODE - nodeName = "#comment" - - def __init__(self, data): - self.data = self.nodeValue = data - - def writexml(self, writer, indent="", addindent="", newl=""): - if "--" in self.data: - raise ValueError("'--' is not allowed in a comment node") - writer.write("%s%s" % (indent, self.data, newl)) - - -class CDATASection(Text): - # Make sure we don't add an instance __dict__ if we don't already - # have one, at least when that's possible: - # XXX this does not work, Text is an old-style class - # __slots__ = () - - nodeType = Node.CDATA_SECTION_NODE - nodeName = "#cdata-section" - - def writexml(self, writer, indent="", addindent="", newl=""): - if self.data.find("]]>") >= 0: - raise ValueError("']]>' not allowed in a CDATA section") - writer.write("" % self.data) - - -class ReadOnlySequentialNamedNodeMap(object): - __slots__ = '_seq', - - def __init__(self, seq=()): - # seq should be a list or tuple - self._seq = seq - - def __len__(self): - return len(self._seq) - - def _get_length(self): - return len(self._seq) - - def getNamedItem(self, name): - for n in self._seq: - if n.nodeName == name: - return n - - def getNamedItemNS(self, namespaceURI, localName): - for n in self._seq: - if n.namespaceURI == namespaceURI and n.localName == localName: - return n - - def __getitem__(self, name_or_tuple): - if isinstance(name_or_tuple, tuple): - node = self.getNamedItemNS(*name_or_tuple) - else: - node = self.getNamedItem(name_or_tuple) - if node is None: - raise KeyError, name_or_tuple - return node - - def item(self, index): - if index < 0: - return None - try: - return self._seq[index] - except IndexError: - return None - - def removeNamedItem(self, name): - raise xml.dom.NoModificationAllowedErr( - "NamedNodeMap instance is read-only") - - def removeNamedItemNS(self, namespaceURI, localName): - raise xml.dom.NoModificationAllowedErr( - "NamedNodeMap instance is read-only") - - def setNamedItem(self, node): - raise xml.dom.NoModificationAllowedErr( - "NamedNodeMap instance is read-only") - - def setNamedItemNS(self, node): - raise xml.dom.NoModificationAllowedErr( - "NamedNodeMap instance is read-only") - - def __getstate__(self): - return [self._seq] - - def __setstate__(self, state): - self._seq = state[0] - -defproperty(ReadOnlySequentialNamedNodeMap, "length", - doc="Number of entries in the NamedNodeMap.") - - -class Identified: - """Mix-in class that supports the publicId and systemId attributes.""" - - # XXX this does not work, this is an old-style class - # __slots__ = 'publicId', 'systemId' - - def _identified_mixin_init(self, publicId, systemId): - self.publicId = publicId - self.systemId = systemId - - def _get_publicId(self): - return self.publicId - - def _get_systemId(self): - return self.systemId - -class DocumentType(Identified, Childless, Node): - nodeType = Node.DOCUMENT_TYPE_NODE - nodeValue = None - name = None - publicId = None - systemId = None - internalSubset = None - - def __init__(self, qualifiedName): - self.entities = ReadOnlySequentialNamedNodeMap() - self.notations = ReadOnlySequentialNamedNodeMap() - if qualifiedName: - prefix, localname = _nssplit(qualifiedName) - self.name = localname - self.nodeName = self.name - - def _get_internalSubset(self): - return self.internalSubset - - def cloneNode(self, deep): - if self.ownerDocument is None: - # it's ok - clone = DocumentType(None) - clone.name = self.name - clone.nodeName = self.name - operation = xml.dom.UserDataHandler.NODE_CLONED - if deep: - clone.entities._seq = [] - clone.notations._seq = [] - for n in self.notations._seq: - notation = Notation(n.nodeName, n.publicId, n.systemId) - clone.notations._seq.append(notation) - n._call_user_data_handler(operation, n, notation) - for e in self.entities._seq: - entity = Entity(e.nodeName, e.publicId, e.systemId, - e.notationName) - entity.actualEncoding = e.actualEncoding - entity.encoding = e.encoding - entity.version = e.version - clone.entities._seq.append(entity) - e._call_user_data_handler(operation, n, entity) - self._call_user_data_handler(operation, self, clone) - return clone - else: - return None - - def writexml(self, writer, indent="", addindent="", newl=""): - writer.write(""+newl) - -class Entity(Identified, Node): - attributes = None - nodeType = Node.ENTITY_NODE - nodeValue = None - - actualEncoding = None - encoding = None - version = None - - def __init__(self, name, publicId, systemId, notation): - self.nodeName = name - self.notationName = notation - self.childNodes = NodeList() - self._identified_mixin_init(publicId, systemId) - - def _get_actualEncoding(self): - return self.actualEncoding - - def _get_encoding(self): - return self.encoding - - def _get_version(self): - return self.version - - def appendChild(self, newChild): - raise xml.dom.HierarchyRequestErr( - "cannot append children to an entity node") - - def insertBefore(self, newChild, refChild): - raise xml.dom.HierarchyRequestErr( - "cannot insert children below an entity node") - - def removeChild(self, oldChild): - raise xml.dom.HierarchyRequestErr( - "cannot remove children from an entity node") - - def replaceChild(self, newChild, oldChild): - raise xml.dom.HierarchyRequestErr( - "cannot replace children of an entity node") - -class Notation(Identified, Childless, Node): - nodeType = Node.NOTATION_NODE - nodeValue = None - - def __init__(self, name, publicId, systemId): - self.nodeName = name - self._identified_mixin_init(publicId, systemId) - - -class DOMImplementation(DOMImplementationLS): - _features = [("core", "1.0"), - ("core", "2.0"), - ("core", None), - ("xml", "1.0"), - ("xml", "2.0"), - ("xml", None), - ("ls-load", "3.0"), - ("ls-load", None), - ] - - def hasFeature(self, feature, version): - if version == "": - version = None - return (feature.lower(), version) in self._features - - def createDocument(self, namespaceURI, qualifiedName, doctype): - if doctype and doctype.parentNode is not None: - raise xml.dom.WrongDocumentErr( - "doctype object owned by another DOM tree") - doc = self._create_document() - - add_root_element = not (namespaceURI is None - and qualifiedName is None - and doctype is None) - - if not qualifiedName and add_root_element: - # The spec is unclear what to raise here; SyntaxErr - # would be the other obvious candidate. Since Xerces raises - # InvalidCharacterErr, and since SyntaxErr is not listed - # for createDocument, that seems to be the better choice. - # XXX: need to check for illegal characters here and in - # createElement. - - # DOM Level III clears this up when talking about the return value - # of this function. If namespaceURI, qName and DocType are - # Null the document is returned without a document element - # Otherwise if doctype or namespaceURI are not None - # Then we go back to the above problem - raise xml.dom.InvalidCharacterErr("Element with no name") - - if add_root_element: - prefix, localname = _nssplit(qualifiedName) - if prefix == "xml" \ - and namespaceURI != "http://www.w3.org/XML/1998/namespace": - raise xml.dom.NamespaceErr("illegal use of 'xml' prefix") - if prefix and not namespaceURI: - raise xml.dom.NamespaceErr( - "illegal use of prefix without namespaces") - element = doc.createElementNS(namespaceURI, qualifiedName) - if doctype: - doc.appendChild(doctype) - doc.appendChild(element) - - if doctype: - doctype.parentNode = doctype.ownerDocument = doc - - doc.doctype = doctype - doc.implementation = self - return doc - - def createDocumentType(self, qualifiedName, publicId, systemId): - doctype = DocumentType(qualifiedName) - doctype.publicId = publicId - doctype.systemId = systemId - return doctype - - # DOM Level 3 (WD 9 April 2002) - - def getInterface(self, feature): - if self.hasFeature(feature, None): - return self - else: - return None - - # internal - def _create_document(self): - return Document() - -class ElementInfo(object): - """Object that represents content-model information for an element. - - This implementation is not expected to be used in practice; DOM - builders should provide implementations which do the right thing - using information available to it. - - """ - - __slots__ = 'tagName', - - def __init__(self, name): - self.tagName = name - - def getAttributeType(self, aname): - return _no_type - - def getAttributeTypeNS(self, namespaceURI, localName): - return _no_type - - def isElementContent(self): - return False - - def isEmpty(self): - """Returns true iff this element is declared to have an EMPTY - content model.""" - return False - - def isId(self, aname): - """Returns true iff the named attribute is a DTD-style ID.""" - return False - - def isIdNS(self, namespaceURI, localName): - """Returns true iff the identified attribute is a DTD-style ID.""" - return False - - def __getstate__(self): - return self.tagName - - def __setstate__(self, state): - self.tagName = state - -def _clear_id_cache(node): - if node.nodeType == Node.DOCUMENT_NODE: - node._id_cache.clear() - node._id_search_stack = None - elif _in_document(node): - node.ownerDocument._id_cache.clear() - node.ownerDocument._id_search_stack= None - -class Document(Node, DocumentLS): - _child_node_types = (Node.ELEMENT_NODE, Node.PROCESSING_INSTRUCTION_NODE, - Node.COMMENT_NODE, Node.DOCUMENT_TYPE_NODE) - - nodeType = Node.DOCUMENT_NODE - nodeName = "#document" - nodeValue = None - attributes = None - doctype = None - parentNode = None - previousSibling = nextSibling = None - - implementation = DOMImplementation() - - # Document attributes from Level 3 (WD 9 April 2002) - - actualEncoding = None - encoding = None - standalone = None - version = None - strictErrorChecking = False - errorHandler = None - documentURI = None - - _magic_id_count = 0 - - def __init__(self): - self.childNodes = NodeList() - # mapping of (namespaceURI, localName) -> ElementInfo - # and tagName -> ElementInfo - self._elem_info = {} - self._id_cache = {} - self._id_search_stack = None - - def _get_elem_info(self, element): - if element.namespaceURI: - key = element.namespaceURI, element.localName - else: - key = element.tagName - return self._elem_info.get(key) - - def _get_actualEncoding(self): - return self.actualEncoding - - def _get_doctype(self): - return self.doctype - - def _get_documentURI(self): - return self.documentURI - - def _get_encoding(self): - return self.encoding - - def _get_errorHandler(self): - return self.errorHandler - - def _get_standalone(self): - return self.standalone - - def _get_strictErrorChecking(self): - return self.strictErrorChecking - - def _get_version(self): - return self.version - - def appendChild(self, node): - if node.nodeType not in self._child_node_types: - raise xml.dom.HierarchyRequestErr( - "%s cannot be child of %s" % (repr(node), repr(self))) - if node.parentNode is not None: - # This needs to be done before the next test since this - # may *be* the document element, in which case it should - # end up re-ordered to the end. - node.parentNode.removeChild(node) - - if node.nodeType == Node.ELEMENT_NODE \ - and self._get_documentElement(): - raise xml.dom.HierarchyRequestErr( - "two document elements disallowed") - return Node.appendChild(self, node) - - def removeChild(self, oldChild): - try: - self.childNodes.remove(oldChild) - except ValueError: - raise xml.dom.NotFoundErr() - oldChild.nextSibling = oldChild.previousSibling = None - oldChild.parentNode = None - if self.documentElement is oldChild: - self.documentElement = None - - return oldChild - - def _get_documentElement(self): - for node in self.childNodes: - if node.nodeType == Node.ELEMENT_NODE: - return node - - def unlink(self): - if self.doctype is not None: - self.doctype.unlink() - self.doctype = None - Node.unlink(self) - - def cloneNode(self, deep): - if not deep: - return None - clone = self.implementation.createDocument(None, None, None) - clone.encoding = self.encoding - clone.standalone = self.standalone - clone.version = self.version - for n in self.childNodes: - childclone = _clone_node(n, deep, clone) - assert childclone.ownerDocument.isSameNode(clone) - clone.childNodes.append(childclone) - if childclone.nodeType == Node.DOCUMENT_NODE: - assert clone.documentElement is None - elif childclone.nodeType == Node.DOCUMENT_TYPE_NODE: - assert clone.doctype is None - clone.doctype = childclone - childclone.parentNode = clone - self._call_user_data_handler(xml.dom.UserDataHandler.NODE_CLONED, - self, clone) - return clone - - def createDocumentFragment(self): - d = DocumentFragment() - d.ownerDocument = self - return d - - def createElement(self, tagName): - e = Element(tagName) - e.ownerDocument = self - return e - - def createTextNode(self, data): - if not isinstance(data, StringTypes): - raise TypeError, "node contents must be a string" - t = Text() - t.data = data - t.ownerDocument = self - return t - - def createCDATASection(self, data): - if not isinstance(data, StringTypes): - raise TypeError, "node contents must be a string" - c = CDATASection() - c.data = data - c.ownerDocument = self - return c - - def createComment(self, data): - c = Comment(data) - c.ownerDocument = self - return c - - def createProcessingInstruction(self, target, data): - p = ProcessingInstruction(target, data) - p.ownerDocument = self - return p - - def createAttribute(self, qName): - a = Attr(qName) - a.ownerDocument = self - a.value = "" - return a - - def createElementNS(self, namespaceURI, qualifiedName): - prefix, localName = _nssplit(qualifiedName) - e = Element(qualifiedName, namespaceURI, prefix) - e.ownerDocument = self - return e - - def createAttributeNS(self, namespaceURI, qualifiedName): - prefix, localName = _nssplit(qualifiedName) - a = Attr(qualifiedName, namespaceURI, localName, prefix) - a.ownerDocument = self - a.value = "" - return a - - # A couple of implementation-specific helpers to create node types - # not supported by the W3C DOM specs: - - def _create_entity(self, name, publicId, systemId, notationName): - e = Entity(name, publicId, systemId, notationName) - e.ownerDocument = self - return e - - def _create_notation(self, name, publicId, systemId): - n = Notation(name, publicId, systemId) - n.ownerDocument = self - return n - - def getElementById(self, id): - if id in self._id_cache: - return self._id_cache[id] - if not (self._elem_info or self._magic_id_count): - return None - - stack = self._id_search_stack - if stack is None: - # we never searched before, or the cache has been cleared - stack = [self.documentElement] - self._id_search_stack = stack - elif not stack: - # Previous search was completed and cache is still valid; - # no matching node. - return None - - result = None - while stack: - node = stack.pop() - # add child elements to stack for continued searching - stack.extend([child for child in node.childNodes - if child.nodeType in _nodeTypes_with_children]) - # check this node - info = self._get_elem_info(node) - if info: - # We have to process all ID attributes before - # returning in order to get all the attributes set to - # be IDs using Element.setIdAttribute*(). - for attr in node.attributes.values(): - if attr.namespaceURI: - if info.isIdNS(attr.namespaceURI, attr.localName): - self._id_cache[attr.value] = node - if attr.value == id: - result = node - elif not node._magic_id_nodes: - break - elif info.isId(attr.name): - self._id_cache[attr.value] = node - if attr.value == id: - result = node - elif not node._magic_id_nodes: - break - elif attr._is_id: - self._id_cache[attr.value] = node - if attr.value == id: - result = node - elif node._magic_id_nodes == 1: - break - elif node._magic_id_nodes: - for attr in node.attributes.values(): - if attr._is_id: - self._id_cache[attr.value] = node - if attr.value == id: - result = node - if result is not None: - break - return result - - def getElementsByTagName(self, name): - return _get_elements_by_tagName_helper(self, name, NodeList()) - - def getElementsByTagNameNS(self, namespaceURI, localName): - return _get_elements_by_tagName_ns_helper( - self, namespaceURI, localName, NodeList()) - - def isSupported(self, feature, version): - return self.implementation.hasFeature(feature, version) - - def importNode(self, node, deep): - if node.nodeType == Node.DOCUMENT_NODE: - raise xml.dom.NotSupportedErr("cannot import document nodes") - elif node.nodeType == Node.DOCUMENT_TYPE_NODE: - raise xml.dom.NotSupportedErr("cannot import document type nodes") - return _clone_node(node, deep, self) - - def writexml(self, writer, indent="", addindent="", newl="", - encoding = None): - if encoding is None: - writer.write(''+newl) - else: - writer.write('%s' % (encoding, newl)) - for node in self.childNodes: - node.writexml(writer, indent, addindent, newl) - - # DOM Level 3 (WD 9 April 2002) - - def renameNode(self, n, namespaceURI, name): - if n.ownerDocument is not self: - raise xml.dom.WrongDocumentErr( - "cannot rename nodes from other documents;\n" - "expected %s,\nfound %s" % (self, n.ownerDocument)) - if n.nodeType not in (Node.ELEMENT_NODE, Node.ATTRIBUTE_NODE): - raise xml.dom.NotSupportedErr( - "renameNode() only applies to element and attribute nodes") - if namespaceURI != EMPTY_NAMESPACE: - if ':' in name: - prefix, localName = name.split(':', 1) - if ( prefix == "xmlns" - and namespaceURI != xml.dom.XMLNS_NAMESPACE): - raise xml.dom.NamespaceErr( - "illegal use of 'xmlns' prefix") - else: - if ( name == "xmlns" - and namespaceURI != xml.dom.XMLNS_NAMESPACE - and n.nodeType == Node.ATTRIBUTE_NODE): - raise xml.dom.NamespaceErr( - "illegal use of the 'xmlns' attribute") - prefix = None - localName = name - else: - prefix = None - localName = None - if n.nodeType == Node.ATTRIBUTE_NODE: - element = n.ownerElement - if element is not None: - is_id = n._is_id - element.removeAttributeNode(n) - else: - element = None - # avoid __setattr__ - d = n.__dict__ - d['prefix'] = prefix - d['localName'] = localName - d['namespaceURI'] = namespaceURI - d['nodeName'] = name - if n.nodeType == Node.ELEMENT_NODE: - d['tagName'] = name - else: - # attribute node - d['name'] = name - if element is not None: - element.setAttributeNode(n) - if is_id: - element.setIdAttributeNode(n) - # It's not clear from a semantic perspective whether we should - # call the user data handlers for the NODE_RENAMED event since - # we're re-using the existing node. The draft spec has been - # interpreted as meaning "no, don't call the handler unless a - # new node is created." - return n - -defproperty(Document, "documentElement", - doc="Top-level element of this document.") - - -def _clone_node(node, deep, newOwnerDocument): - """ - Clone a node and give it the new owner document. - Called by Node.cloneNode and Document.importNode - """ - if node.ownerDocument.isSameNode(newOwnerDocument): - operation = xml.dom.UserDataHandler.NODE_CLONED - else: - operation = xml.dom.UserDataHandler.NODE_IMPORTED - if node.nodeType == Node.ELEMENT_NODE: - clone = newOwnerDocument.createElementNS(node.namespaceURI, - node.nodeName) - for attr in node.attributes.values(): - clone.setAttributeNS(attr.namespaceURI, attr.nodeName, attr.value) - a = clone.getAttributeNodeNS(attr.namespaceURI, attr.localName) - a.specified = attr.specified - - if deep: - for child in node.childNodes: - c = _clone_node(child, deep, newOwnerDocument) - clone.appendChild(c) - - elif node.nodeType == Node.DOCUMENT_FRAGMENT_NODE: - clone = newOwnerDocument.createDocumentFragment() - if deep: - for child in node.childNodes: - c = _clone_node(child, deep, newOwnerDocument) - clone.appendChild(c) - - elif node.nodeType == Node.TEXT_NODE: - clone = newOwnerDocument.createTextNode(node.data) - elif node.nodeType == Node.CDATA_SECTION_NODE: - clone = newOwnerDocument.createCDATASection(node.data) - elif node.nodeType == Node.PROCESSING_INSTRUCTION_NODE: - clone = newOwnerDocument.createProcessingInstruction(node.target, - node.data) - elif node.nodeType == Node.COMMENT_NODE: - clone = newOwnerDocument.createComment(node.data) - elif node.nodeType == Node.ATTRIBUTE_NODE: - clone = newOwnerDocument.createAttributeNS(node.namespaceURI, - node.nodeName) - clone.specified = True - clone.value = node.value - elif node.nodeType == Node.DOCUMENT_TYPE_NODE: - assert node.ownerDocument is not newOwnerDocument - operation = xml.dom.UserDataHandler.NODE_IMPORTED - clone = newOwnerDocument.implementation.createDocumentType( - node.name, node.publicId, node.systemId) - clone.ownerDocument = newOwnerDocument - if deep: - clone.entities._seq = [] - clone.notations._seq = [] - for n in node.notations._seq: - notation = Notation(n.nodeName, n.publicId, n.systemId) - notation.ownerDocument = newOwnerDocument - clone.notations._seq.append(notation) - if hasattr(n, '_call_user_data_handler'): - n._call_user_data_handler(operation, n, notation) - for e in node.entities._seq: - entity = Entity(e.nodeName, e.publicId, e.systemId, - e.notationName) - entity.actualEncoding = e.actualEncoding - entity.encoding = e.encoding - entity.version = e.version - entity.ownerDocument = newOwnerDocument - clone.entities._seq.append(entity) - if hasattr(e, '_call_user_data_handler'): - e._call_user_data_handler(operation, n, entity) - else: - # Note the cloning of Document and DocumentType nodes is - # implementation specific. minidom handles those cases - # directly in the cloneNode() methods. - raise xml.dom.NotSupportedErr("Cannot clone node %s" % repr(node)) - - # Check for _call_user_data_handler() since this could conceivably - # used with other DOM implementations (one of the FourThought - # DOMs, perhaps?). - if hasattr(node, '_call_user_data_handler'): - node._call_user_data_handler(operation, node, clone) - return clone - - -def _nssplit(qualifiedName): - fields = qualifiedName.split(':', 1) - if len(fields) == 2: - return fields - else: - return (None, fields[0]) - - -def _get_StringIO(): - # we can't use cStringIO since it doesn't support Unicode strings - from StringIO import StringIO - return StringIO() - -def _do_pulldom_parse(func, args, kwargs): - events = func(*args, **kwargs) - toktype, rootNode = events.getEvent() - events.expandNode(rootNode) - events.clear() - return rootNode - -def parse(file, parser=None, bufsize=None): - """Parse a file into a DOM by filename or file object.""" - if parser is None and not bufsize: - from xml.dom import expatbuilder - return expatbuilder.parse(file) - else: - from xml.dom import pulldom - return _do_pulldom_parse(pulldom.parse, (file,), - {'parser': parser, 'bufsize': bufsize}) - -def parseString(string, parser=None): - """Parse a file into a DOM from a string.""" - if parser is None: - from xml.dom import expatbuilder - return expatbuilder.parseString(string) - else: - from xml.dom import pulldom - return _do_pulldom_parse(pulldom.parseString, (string,), - {'parser': parser}) - -def getDOMImplementation(features=None): - if features: - if isinstance(features, StringTypes): - features = domreg._parse_feature_string(features) - for f, v in features: - if not Document.implementation.hasFeature(f, v): - return None - return Document.implementation diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py deleted file mode 100644 index cdec746..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/pulldom.py +++ /dev/null @@ -1,351 +0,0 @@ -import xml.sax -import xml.sax.handler -import types - -try: - _StringTypes = [types.StringType, types.UnicodeType] -except AttributeError: - _StringTypes = [types.StringType] - -START_ELEMENT = "START_ELEMENT" -END_ELEMENT = "END_ELEMENT" -COMMENT = "COMMENT" -START_DOCUMENT = "START_DOCUMENT" -END_DOCUMENT = "END_DOCUMENT" -PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION" -IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE" -CHARACTERS = "CHARACTERS" - -class PullDOM(xml.sax.ContentHandler): - _locator = None - document = None - - def __init__(self, documentFactory=None): - from xml.dom import XML_NAMESPACE - self.documentFactory = documentFactory - self.firstEvent = [None, None] - self.lastEvent = self.firstEvent - self.elementStack = [] - self.push = self.elementStack.append - try: - self.pop = self.elementStack.pop - except AttributeError: - # use class' pop instead - pass - self._ns_contexts = [{XML_NAMESPACE:'xml'}] # contains uri -> prefix dicts - self._current_context = self._ns_contexts[-1] - self.pending_events = [] - - def pop(self): - result = self.elementStack[-1] - del self.elementStack[-1] - return result - - def setDocumentLocator(self, locator): - self._locator = locator - - def startPrefixMapping(self, prefix, uri): - if not hasattr(self, '_xmlns_attrs'): - self._xmlns_attrs = [] - self._xmlns_attrs.append((prefix or 'xmlns', uri)) - self._ns_contexts.append(self._current_context.copy()) - self._current_context[uri] = prefix or None - - def endPrefixMapping(self, prefix): - self._current_context = self._ns_contexts.pop() - - def startElementNS(self, name, tagName , attrs): - # Retrieve xml namespace declaration attributes. - xmlns_uri = 'http://www.w3.org/2000/xmlns/' - xmlns_attrs = getattr(self, '_xmlns_attrs', None) - if xmlns_attrs is not None: - for aname, value in xmlns_attrs: - attrs._attrs[(xmlns_uri, aname)] = value - self._xmlns_attrs = [] - uri, localname = name - if uri: - # When using namespaces, the reader may or may not - # provide us with the original name. If not, create - # *a* valid tagName from the current context. - if tagName is None: - prefix = self._current_context[uri] - if prefix: - tagName = prefix + ":" + localname - else: - tagName = localname - if self.document: - node = self.document.createElementNS(uri, tagName) - else: - node = self.buildDocument(uri, tagName) - else: - # When the tagname is not prefixed, it just appears as - # localname - if self.document: - node = self.document.createElement(localname) - else: - node = self.buildDocument(None, localname) - - for aname,value in attrs.items(): - a_uri, a_localname = aname - if a_uri == xmlns_uri: - if a_localname == 'xmlns': - qname = a_localname - else: - qname = 'xmlns:' + a_localname - attr = self.document.createAttributeNS(a_uri, qname) - node.setAttributeNodeNS(attr) - elif a_uri: - prefix = self._current_context[a_uri] - if prefix: - qname = prefix + ":" + a_localname - else: - qname = a_localname - attr = self.document.createAttributeNS(a_uri, qname) - node.setAttributeNodeNS(attr) - else: - attr = self.document.createAttribute(a_localname) - node.setAttributeNode(attr) - attr.value = value - - self.lastEvent[1] = [(START_ELEMENT, node), None] - self.lastEvent = self.lastEvent[1] - self.push(node) - - def endElementNS(self, name, tagName): - self.lastEvent[1] = [(END_ELEMENT, self.pop()), None] - self.lastEvent = self.lastEvent[1] - - def startElement(self, name, attrs): - if self.document: - node = self.document.createElement(name) - else: - node = self.buildDocument(None, name) - - for aname,value in attrs.items(): - attr = self.document.createAttribute(aname) - attr.value = value - node.setAttributeNode(attr) - - self.lastEvent[1] = [(START_ELEMENT, node), None] - self.lastEvent = self.lastEvent[1] - self.push(node) - - def endElement(self, name): - self.lastEvent[1] = [(END_ELEMENT, self.pop()), None] - self.lastEvent = self.lastEvent[1] - - def comment(self, s): - if self.document: - node = self.document.createComment(s) - self.lastEvent[1] = [(COMMENT, node), None] - self.lastEvent = self.lastEvent[1] - else: - event = [(COMMENT, s), None] - self.pending_events.append(event) - - def processingInstruction(self, target, data): - if self.document: - node = self.document.createProcessingInstruction(target, data) - self.lastEvent[1] = [(PROCESSING_INSTRUCTION, node), None] - self.lastEvent = self.lastEvent[1] - else: - event = [(PROCESSING_INSTRUCTION, target, data), None] - self.pending_events.append(event) - - def ignorableWhitespace(self, chars): - node = self.document.createTextNode(chars) - self.lastEvent[1] = [(IGNORABLE_WHITESPACE, node), None] - self.lastEvent = self.lastEvent[1] - - def characters(self, chars): - node = self.document.createTextNode(chars) - self.lastEvent[1] = [(CHARACTERS, node), None] - self.lastEvent = self.lastEvent[1] - - def startDocument(self): - if self.documentFactory is None: - import xml.dom.minidom - self.documentFactory = xml.dom.minidom.Document.implementation - - def buildDocument(self, uri, tagname): - # Can't do that in startDocument, since we need the tagname - # XXX: obtain DocumentType - node = self.documentFactory.createDocument(uri, tagname, None) - self.document = node - self.lastEvent[1] = [(START_DOCUMENT, node), None] - self.lastEvent = self.lastEvent[1] - self.push(node) - # Put everything we have seen so far into the document - for e in self.pending_events: - if e[0][0] == PROCESSING_INSTRUCTION: - _,target,data = e[0] - n = self.document.createProcessingInstruction(target, data) - e[0] = (PROCESSING_INSTRUCTION, n) - elif e[0][0] == COMMENT: - n = self.document.createComment(e[0][1]) - e[0] = (COMMENT, n) - else: - raise AssertionError("Unknown pending event ",e[0][0]) - self.lastEvent[1] = e - self.lastEvent = e - self.pending_events = None - return node.firstChild - - def endDocument(self): - self.lastEvent[1] = [(END_DOCUMENT, self.document), None] - self.pop() - - def clear(self): - "clear(): Explicitly release parsing structures" - self.document = None - -class ErrorHandler: - def warning(self, exception): - print exception - def error(self, exception): - raise exception - def fatalError(self, exception): - raise exception - -class DOMEventStream: - def __init__(self, stream, parser, bufsize): - self.stream = stream - self.parser = parser - self.bufsize = bufsize - if not hasattr(self.parser, 'feed'): - self.getEvent = self._slurp - self.reset() - - def reset(self): - self.pulldom = PullDOM() - # This content handler relies on namespace support - self.parser.setFeature(xml.sax.handler.feature_namespaces, 1) - self.parser.setContentHandler(self.pulldom) - - def __getitem__(self, pos): - rc = self.getEvent() - if rc: - return rc - raise IndexError - - def next(self): - rc = self.getEvent() - if rc: - return rc - raise StopIteration - - def __iter__(self): - return self - - def expandNode(self, node): - event = self.getEvent() - parents = [node] - while event: - token, cur_node = event - if cur_node is node: - return - if token != END_ELEMENT: - parents[-1].appendChild(cur_node) - if token == START_ELEMENT: - parents.append(cur_node) - elif token == END_ELEMENT: - del parents[-1] - event = self.getEvent() - - def getEvent(self): - # use IncrementalParser interface, so we get the desired - # pull effect - if not self.pulldom.firstEvent[1]: - self.pulldom.lastEvent = self.pulldom.firstEvent - while not self.pulldom.firstEvent[1]: - buf = self.stream.read(self.bufsize) - if not buf: - self.parser.close() - return None - self.parser.feed(buf) - rc = self.pulldom.firstEvent[1][0] - self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1] - return rc - - def _slurp(self): - """ Fallback replacement for getEvent() using the - standard SAX2 interface, which means we slurp the - SAX events into memory (no performance gain, but - we are compatible to all SAX parsers). - """ - self.parser.parse(self.stream) - self.getEvent = self._emit - return self._emit() - - def _emit(self): - """ Fallback replacement for getEvent() that emits - the events that _slurp() read previously. - """ - rc = self.pulldom.firstEvent[1][0] - self.pulldom.firstEvent[1] = self.pulldom.firstEvent[1][1] - return rc - - def clear(self): - """clear(): Explicitly release parsing objects""" - self.pulldom.clear() - del self.pulldom - self.parser = None - self.stream = None - -class SAX2DOM(PullDOM): - - def startElementNS(self, name, tagName , attrs): - PullDOM.startElementNS(self, name, tagName, attrs) - curNode = self.elementStack[-1] - parentNode = self.elementStack[-2] - parentNode.appendChild(curNode) - - def startElement(self, name, attrs): - PullDOM.startElement(self, name, attrs) - curNode = self.elementStack[-1] - parentNode = self.elementStack[-2] - parentNode.appendChild(curNode) - - def processingInstruction(self, target, data): - PullDOM.processingInstruction(self, target, data) - node = self.lastEvent[0][1] - parentNode = self.elementStack[-1] - parentNode.appendChild(node) - - def ignorableWhitespace(self, chars): - PullDOM.ignorableWhitespace(self, chars) - node = self.lastEvent[0][1] - parentNode = self.elementStack[-1] - parentNode.appendChild(node) - - def characters(self, chars): - PullDOM.characters(self, chars) - node = self.lastEvent[0][1] - parentNode = self.elementStack[-1] - parentNode.appendChild(node) - - -default_bufsize = (2 ** 14) - 20 - -def parse(stream_or_string, parser=None, bufsize=None): - if bufsize is None: - bufsize = default_bufsize - if type(stream_or_string) in _StringTypes: - stream = open(stream_or_string) - else: - stream = stream_or_string - if not parser: - parser = xml.sax.make_parser() - return DOMEventStream(stream, parser, bufsize) - -def parseString(string, parser=None): - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - - bufsize = len(string) - buf = StringIO(string) - if not parser: - parser = xml.sax.make_parser() - return DOMEventStream(buf, parser, bufsize) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py deleted file mode 100644 index c386b26..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/dom/xmlbuilder.py +++ /dev/null @@ -1,386 +0,0 @@ -"""Implementation of the DOM Level 3 'LS-Load' feature.""" - -import copy -import xml.dom - -from xml.dom.NodeFilter import NodeFilter - - -__all__ = ["DOMBuilder", "DOMEntityResolver", "DOMInputSource"] - - -class Options: - """Features object that has variables set for each DOMBuilder feature. - - The DOMBuilder class uses an instance of this class to pass settings to - the ExpatBuilder class. - """ - - # Note that the DOMBuilder class in LoadSave constrains which of these - # values can be set using the DOM Level 3 LoadSave feature. - - namespaces = 1 - namespace_declarations = True - validation = False - external_parameter_entities = True - external_general_entities = True - external_dtd_subset = True - validate_if_schema = False - validate = False - datatype_normalization = False - create_entity_ref_nodes = True - entities = True - whitespace_in_element_content = True - cdata_sections = True - comments = True - charset_overrides_xml_encoding = True - infoset = False - supported_mediatypes_only = False - - errorHandler = None - filter = None - - -class DOMBuilder: - entityResolver = None - errorHandler = None - filter = None - - ACTION_REPLACE = 1 - ACTION_APPEND_AS_CHILDREN = 2 - ACTION_INSERT_AFTER = 3 - ACTION_INSERT_BEFORE = 4 - - _legal_actions = (ACTION_REPLACE, ACTION_APPEND_AS_CHILDREN, - ACTION_INSERT_AFTER, ACTION_INSERT_BEFORE) - - def __init__(self): - self._options = Options() - - def _get_entityResolver(self): - return self.entityResolver - def _set_entityResolver(self, entityResolver): - self.entityResolver = entityResolver - - def _get_errorHandler(self): - return self.errorHandler - def _set_errorHandler(self, errorHandler): - self.errorHandler = errorHandler - - def _get_filter(self): - return self.filter - def _set_filter(self, filter): - self.filter = filter - - def setFeature(self, name, state): - if self.supportsFeature(name): - state = state and 1 or 0 - try: - settings = self._settings[(_name_xform(name), state)] - except KeyError: - raise xml.dom.NotSupportedErr( - "unsupported feature: %r" % (name,)) - else: - for name, value in settings: - setattr(self._options, name, value) - else: - raise xml.dom.NotFoundErr("unknown feature: " + repr(name)) - - def supportsFeature(self, name): - return hasattr(self._options, _name_xform(name)) - - def canSetFeature(self, name, state): - key = (_name_xform(name), state and 1 or 0) - return key in self._settings - - # This dictionary maps from (feature,value) to a list of - # (option,value) pairs that should be set on the Options object. - # If a (feature,value) setting is not in this dictionary, it is - # not supported by the DOMBuilder. - # - _settings = { - ("namespace_declarations", 0): [ - ("namespace_declarations", 0)], - ("namespace_declarations", 1): [ - ("namespace_declarations", 1)], - ("validation", 0): [ - ("validation", 0)], - ("external_general_entities", 0): [ - ("external_general_entities", 0)], - ("external_general_entities", 1): [ - ("external_general_entities", 1)], - ("external_parameter_entities", 0): [ - ("external_parameter_entities", 0)], - ("external_parameter_entities", 1): [ - ("external_parameter_entities", 1)], - ("validate_if_schema", 0): [ - ("validate_if_schema", 0)], - ("create_entity_ref_nodes", 0): [ - ("create_entity_ref_nodes", 0)], - ("create_entity_ref_nodes", 1): [ - ("create_entity_ref_nodes", 1)], - ("entities", 0): [ - ("create_entity_ref_nodes", 0), - ("entities", 0)], - ("entities", 1): [ - ("entities", 1)], - ("whitespace_in_element_content", 0): [ - ("whitespace_in_element_content", 0)], - ("whitespace_in_element_content", 1): [ - ("whitespace_in_element_content", 1)], - ("cdata_sections", 0): [ - ("cdata_sections", 0)], - ("cdata_sections", 1): [ - ("cdata_sections", 1)], - ("comments", 0): [ - ("comments", 0)], - ("comments", 1): [ - ("comments", 1)], - ("charset_overrides_xml_encoding", 0): [ - ("charset_overrides_xml_encoding", 0)], - ("charset_overrides_xml_encoding", 1): [ - ("charset_overrides_xml_encoding", 1)], - ("infoset", 0): [], - ("infoset", 1): [ - ("namespace_declarations", 0), - ("validate_if_schema", 0), - ("create_entity_ref_nodes", 0), - ("entities", 0), - ("cdata_sections", 0), - ("datatype_normalization", 1), - ("whitespace_in_element_content", 1), - ("comments", 1), - ("charset_overrides_xml_encoding", 1)], - ("supported_mediatypes_only", 0): [ - ("supported_mediatypes_only", 0)], - ("namespaces", 0): [ - ("namespaces", 0)], - ("namespaces", 1): [ - ("namespaces", 1)], - } - - def getFeature(self, name): - xname = _name_xform(name) - try: - return getattr(self._options, xname) - except AttributeError: - if name == "infoset": - options = self._options - return (options.datatype_normalization - and options.whitespace_in_element_content - and options.comments - and options.charset_overrides_xml_encoding - and not (options.namespace_declarations - or options.validate_if_schema - or options.create_entity_ref_nodes - or options.entities - or options.cdata_sections)) - raise xml.dom.NotFoundErr("feature %s not known" % repr(name)) - - def parseURI(self, uri): - if self.entityResolver: - input = self.entityResolver.resolveEntity(None, uri) - else: - input = DOMEntityResolver().resolveEntity(None, uri) - return self.parse(input) - - def parse(self, input): - options = copy.copy(self._options) - options.filter = self.filter - options.errorHandler = self.errorHandler - fp = input.byteStream - if fp is None and options.systemId: - import urllib2 - fp = urllib2.urlopen(input.systemId) - return self._parse_bytestream(fp, options) - - def parseWithContext(self, input, cnode, action): - if action not in self._legal_actions: - raise ValueError("not a legal action") - raise NotImplementedError("Haven't written this yet...") - - def _parse_bytestream(self, stream, options): - import xml.dom.expatbuilder - builder = xml.dom.expatbuilder.makeBuilder(options) - return builder.parseFile(stream) - - -def _name_xform(name): - return name.lower().replace('-', '_') - - -class DOMEntityResolver(object): - __slots__ = '_opener', - - def resolveEntity(self, publicId, systemId): - assert systemId is not None - source = DOMInputSource() - source.publicId = publicId - source.systemId = systemId - source.byteStream = self._get_opener().open(systemId) - - # determine the encoding if the transport provided it - source.encoding = self._guess_media_encoding(source) - - # determine the base URI is we can - import posixpath, urlparse - parts = urlparse.urlparse(systemId) - scheme, netloc, path, params, query, fragment = parts - # XXX should we check the scheme here as well? - if path and not path.endswith("/"): - path = posixpath.dirname(path) + "/" - parts = scheme, netloc, path, params, query, fragment - source.baseURI = urlparse.urlunparse(parts) - - return source - - def _get_opener(self): - try: - return self._opener - except AttributeError: - self._opener = self._create_opener() - return self._opener - - def _create_opener(self): - import urllib2 - return urllib2.build_opener() - - def _guess_media_encoding(self, source): - info = source.byteStream.info() - if "Content-Type" in info: - for param in info.getplist(): - if param.startswith("charset="): - return param.split("=", 1)[1].lower() - - -class DOMInputSource(object): - __slots__ = ('byteStream', 'characterStream', 'stringData', - 'encoding', 'publicId', 'systemId', 'baseURI') - - def __init__(self): - self.byteStream = None - self.characterStream = None - self.stringData = None - self.encoding = None - self.publicId = None - self.systemId = None - self.baseURI = None - - def _get_byteStream(self): - return self.byteStream - def _set_byteStream(self, byteStream): - self.byteStream = byteStream - - def _get_characterStream(self): - return self.characterStream - def _set_characterStream(self, characterStream): - self.characterStream = characterStream - - def _get_stringData(self): - return self.stringData - def _set_stringData(self, data): - self.stringData = data - - def _get_encoding(self): - return self.encoding - def _set_encoding(self, encoding): - self.encoding = encoding - - def _get_publicId(self): - return self.publicId - def _set_publicId(self, publicId): - self.publicId = publicId - - def _get_systemId(self): - return self.systemId - def _set_systemId(self, systemId): - self.systemId = systemId - - def _get_baseURI(self): - return self.baseURI - def _set_baseURI(self, uri): - self.baseURI = uri - - -class DOMBuilderFilter: - """Element filter which can be used to tailor construction of - a DOM instance. - """ - - # There's really no need for this class; concrete implementations - # should just implement the endElement() and startElement() - # methods as appropriate. Using this makes it easy to only - # implement one of them. - - FILTER_ACCEPT = 1 - FILTER_REJECT = 2 - FILTER_SKIP = 3 - FILTER_INTERRUPT = 4 - - whatToShow = NodeFilter.SHOW_ALL - - def _get_whatToShow(self): - return self.whatToShow - - def acceptNode(self, element): - return self.FILTER_ACCEPT - - def startContainer(self, element): - return self.FILTER_ACCEPT - -del NodeFilter - - -class DocumentLS: - """Mixin to create documents that conform to the load/save spec.""" - - async = False - - def _get_async(self): - return False - def _set_async(self, async): - if async: - raise xml.dom.NotSupportedErr( - "asynchronous document loading is not supported") - - def abort(self): - # What does it mean to "clear" a document? Does the - # documentElement disappear? - raise NotImplementedError( - "haven't figured out what this means yet") - - def load(self, uri): - raise NotImplementedError("haven't written this yet") - - def loadXML(self, source): - raise NotImplementedError("haven't written this yet") - - def saveXML(self, snode): - if snode is None: - snode = self - elif snode.ownerDocument is not self: - raise xml.dom.WrongDocumentErr() - return snode.toxml() - - -class DOMImplementationLS: - MODE_SYNCHRONOUS = 1 - MODE_ASYNCHRONOUS = 2 - - def createDOMBuilder(self, mode, schemaType): - if schemaType is not None: - raise xml.dom.NotSupportedErr( - "schemaType not yet supported") - if mode == self.MODE_SYNCHRONOUS: - return DOMBuilder() - if mode == self.MODE_ASYNCHRONOUS: - raise xml.dom.NotSupportedErr( - "asynchronous builders are not supported") - raise ValueError("unknown value for mode") - - def createDOMWriter(self): - raise NotImplementedError( - "the writer interface hasn't been written yet!") - - def createDOMInputSource(self): - return DOMInputSource() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py deleted file mode 100644 index 2bfac34..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementInclude.py +++ /dev/null @@ -1,142 +0,0 @@ -# -# ElementTree -# $Id: ElementInclude.py 3375 2008-02-13 08:05:08Z fredrik $ -# -# limited xinclude support for element trees -# -# history: -# 2003-08-15 fl created -# 2003-11-14 fl fixed default loader -# -# Copyright (c) 2003-2004 by Fredrik Lundh. All rights reserved. -# -# fredrik@pythonware.com -# http://www.pythonware.com -# -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2008 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - -# Licensed to PSF under a Contributor Agreement. -# See http://www.python.org/psf/license for licensing details. - -## -# Limited XInclude support for the ElementTree package. -## - -import copy -from . import ElementTree - -XINCLUDE = "{http://www.w3.org/2001/XInclude}" - -XINCLUDE_INCLUDE = XINCLUDE + "include" -XINCLUDE_FALLBACK = XINCLUDE + "fallback" - -## -# Fatal include error. - -class FatalIncludeError(SyntaxError): - pass - -## -# Default loader. This loader reads an included resource from disk. -# -# @param href Resource reference. -# @param parse Parse mode. Either "xml" or "text". -# @param encoding Optional text encoding. -# @return The expanded resource. If the parse mode is "xml", this -# is an ElementTree instance. If the parse mode is "text", this -# is a Unicode string. If the loader fails, it can return None -# or raise an IOError exception. -# @throws IOError If the loader fails to load the resource. - -def default_loader(href, parse, encoding=None): - with open(href) as file: - if parse == "xml": - data = ElementTree.parse(file).getroot() - else: - data = file.read() - if encoding: - data = data.decode(encoding) - return data - -## -# Expand XInclude directives. -# -# @param elem Root element. -# @param loader Optional resource loader. If omitted, it defaults -# to {@link default_loader}. If given, it should be a callable -# that implements the same interface as default_loader. -# @throws FatalIncludeError If the function fails to include a given -# resource, or if the tree contains malformed XInclude elements. -# @throws IOError If the function fails to load a given resource. - -def include(elem, loader=None): - if loader is None: - loader = default_loader - # look for xinclude elements - i = 0 - while i < len(elem): - e = elem[i] - if e.tag == XINCLUDE_INCLUDE: - # process xinclude directive - href = e.get("href") - parse = e.get("parse", "xml") - if parse == "xml": - node = loader(href, parse) - if node is None: - raise FatalIncludeError( - "cannot load %r as %r" % (href, parse) - ) - node = copy.copy(node) - if e.tail: - node.tail = (node.tail or "") + e.tail - elem[i] = node - elif parse == "text": - text = loader(href, parse, e.get("encoding")) - if text is None: - raise FatalIncludeError( - "cannot load %r as %r" % (href, parse) - ) - if i: - node = elem[i-1] - node.tail = (node.tail or "") + text + (e.tail or "") - else: - elem.text = (elem.text or "") + text + (e.tail or "") - del elem[i] - continue - else: - raise FatalIncludeError( - "unknown parse type in xi:include tag (%r)" % parse - ) - elif e.tag == XINCLUDE_FALLBACK: - raise FatalIncludeError( - "xi:fallback tag must be child of xi:include (%r)" % e.tag - ) - else: - include(e, loader) - i = i + 1 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py deleted file mode 100644 index 5c117c3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementPath.py +++ /dev/null @@ -1,303 +0,0 @@ -# -# ElementTree -# $Id: ElementPath.py 3375 2008-02-13 08:05:08Z fredrik $ -# -# limited xpath support for element trees -# -# history: -# 2003-05-23 fl created -# 2003-05-28 fl added support for // etc -# 2003-08-27 fl fixed parsing of periods in element names -# 2007-09-10 fl new selection engine -# 2007-09-12 fl fixed parent selector -# 2007-09-13 fl added iterfind; changed findall to return a list -# 2007-11-30 fl added namespaces support -# 2009-10-30 fl added child element value filter -# -# Copyright (c) 2003-2009 by Fredrik Lundh. All rights reserved. -# -# fredrik@pythonware.com -# http://www.pythonware.com -# -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2009 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - -# Licensed to PSF under a Contributor Agreement. -# See http://www.python.org/psf/license for licensing details. - -## -# Implementation module for XPath support. There's usually no reason -# to import this module directly; the ElementTree does this for -# you, if needed. -## - -import re - -xpath_tokenizer_re = re.compile( - "(" - "'[^']*'|\"[^\"]*\"|" - "::|" - "//?|" - "\.\.|" - "\(\)|" - "[/.*:\[\]\(\)@=])|" - "((?:\{[^}]+\})?[^/\[\]\(\)@=\s]+)|" - "\s+" - ) - -def xpath_tokenizer(pattern, namespaces=None): - for token in xpath_tokenizer_re.findall(pattern): - tag = token[1] - if tag and tag[0] != "{" and ":" in tag: - try: - prefix, uri = tag.split(":", 1) - if not namespaces: - raise KeyError - yield token[0], "{%s}%s" % (namespaces[prefix], uri) - except KeyError: - raise SyntaxError("prefix %r not found in prefix map" % prefix) - else: - yield token - -def get_parent_map(context): - parent_map = context.parent_map - if parent_map is None: - context.parent_map = parent_map = {} - for p in context.root.iter(): - for e in p: - parent_map[e] = p - return parent_map - -def prepare_child(next, token): - tag = token[1] - def select(context, result): - for elem in result: - for e in elem: - if e.tag == tag: - yield e - return select - -def prepare_star(next, token): - def select(context, result): - for elem in result: - for e in elem: - yield e - return select - -def prepare_self(next, token): - def select(context, result): - for elem in result: - yield elem - return select - -def prepare_descendant(next, token): - token = next() - if token[0] == "*": - tag = "*" - elif not token[0]: - tag = token[1] - else: - raise SyntaxError("invalid descendant") - def select(context, result): - for elem in result: - for e in elem.iter(tag): - if e is not elem: - yield e - return select - -def prepare_parent(next, token): - def select(context, result): - # FIXME: raise error if .. is applied at toplevel? - parent_map = get_parent_map(context) - result_map = {} - for elem in result: - if elem in parent_map: - parent = parent_map[elem] - if parent not in result_map: - result_map[parent] = None - yield parent - return select - -def prepare_predicate(next, token): - # FIXME: replace with real parser!!! refs: - # http://effbot.org/zone/simple-iterator-parser.htm - # http://javascript.crockford.com/tdop/tdop.html - signature = [] - predicate = [] - while 1: - token = next() - if token[0] == "]": - break - if token[0] and token[0][:1] in "'\"": - token = "'", token[0][1:-1] - signature.append(token[0] or "-") - predicate.append(token[1]) - signature = "".join(signature) - # use signature to determine predicate type - if signature == "@-": - # [@attribute] predicate - key = predicate[1] - def select(context, result): - for elem in result: - if elem.get(key) is not None: - yield elem - return select - if signature == "@-='": - # [@attribute='value'] - key = predicate[1] - value = predicate[-1] - def select(context, result): - for elem in result: - if elem.get(key) == value: - yield elem - return select - if signature == "-" and not re.match("\d+$", predicate[0]): - # [tag] - tag = predicate[0] - def select(context, result): - for elem in result: - if elem.find(tag) is not None: - yield elem - return select - if signature == "-='" and not re.match("\d+$", predicate[0]): - # [tag='value'] - tag = predicate[0] - value = predicate[-1] - def select(context, result): - for elem in result: - for e in elem.findall(tag): - if "".join(e.itertext()) == value: - yield elem - break - return select - if signature == "-" or signature == "-()" or signature == "-()-": - # [index] or [last()] or [last()-index] - if signature == "-": - index = int(predicate[0]) - 1 - else: - if predicate[0] != "last": - raise SyntaxError("unsupported function") - if signature == "-()-": - try: - index = int(predicate[2]) - 1 - except ValueError: - raise SyntaxError("unsupported expression") - else: - index = -1 - def select(context, result): - parent_map = get_parent_map(context) - for elem in result: - try: - parent = parent_map[elem] - # FIXME: what if the selector is "*" ? - elems = list(parent.findall(elem.tag)) - if elems[index] is elem: - yield elem - except (IndexError, KeyError): - pass - return select - raise SyntaxError("invalid predicate") - -ops = { - "": prepare_child, - "*": prepare_star, - ".": prepare_self, - "..": prepare_parent, - "//": prepare_descendant, - "[": prepare_predicate, - } - -_cache = {} - -class _SelectorContext: - parent_map = None - def __init__(self, root): - self.root = root - -# -------------------------------------------------------------------- - -## -# Generate all matching objects. - -def iterfind(elem, path, namespaces=None): - # compile selector pattern - if path[-1:] == "/": - path = path + "*" # implicit all (FIXME: keep this?) - try: - selector = _cache[path] - except KeyError: - if len(_cache) > 100: - _cache.clear() - if path[:1] == "/": - raise SyntaxError("cannot use absolute path on element") - next = iter(xpath_tokenizer(path, namespaces)).next - token = next() - selector = [] - while 1: - try: - selector.append(ops[token[0]](next, token)) - except StopIteration: - raise SyntaxError("invalid path") - try: - token = next() - if token[0] == "/": - token = next() - except StopIteration: - break - _cache[path] = selector - # execute selector pattern - result = [elem] - context = _SelectorContext(elem) - for select in selector: - result = select(context, result) - return result - -## -# Find first matching object. - -def find(elem, path, namespaces=None): - try: - return iterfind(elem, path, namespaces).next() - except StopIteration: - return None - -## -# Find all matching objects. - -def findall(elem, path, namespaces=None): - return list(iterfind(elem, path, namespaces)) - -## -# Find text for first matching object. - -def findtext(elem, path, default=None, namespaces=None): - try: - elem = iterfind(elem, path, namespaces).next() - return elem.text or "" - except StopIteration: - return default diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py deleted file mode 100644 index 7ae11bc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/ElementTree.py +++ /dev/null @@ -1,1667 +0,0 @@ -# -# ElementTree -# $Id: ElementTree.py 3440 2008-07-18 14:45:01Z fredrik $ -# -# light-weight XML support for Python 2.3 and later. -# -# history (since 1.2.6): -# 2005-11-12 fl added tostringlist/fromstringlist helpers -# 2006-07-05 fl merged in selected changes from the 1.3 sandbox -# 2006-07-05 fl removed support for 2.1 and earlier -# 2007-06-21 fl added deprecation/future warnings -# 2007-08-25 fl added doctype hook, added parser version attribute etc -# 2007-08-26 fl added new serializer code (better namespace handling, etc) -# 2007-08-27 fl warn for broken /tag searches on tree level -# 2007-09-02 fl added html/text methods to serializer (experimental) -# 2007-09-05 fl added method argument to tostring/tostringlist -# 2007-09-06 fl improved error handling -# 2007-09-13 fl added itertext, iterfind; assorted cleanups -# 2007-12-15 fl added C14N hooks, copy method (experimental) -# -# Copyright (c) 1999-2008 by Fredrik Lundh. All rights reserved. -# -# fredrik@pythonware.com -# http://www.pythonware.com -# -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2008 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - -# Licensed to PSF under a Contributor Agreement. -# See http://www.python.org/psf/license for licensing details. - -__all__ = [ - # public symbols - "Comment", - "dump", - "Element", "ElementTree", - "fromstring", "fromstringlist", - "iselement", "iterparse", - "parse", "ParseError", - "PI", "ProcessingInstruction", - "QName", - "SubElement", - "tostring", "tostringlist", - "TreeBuilder", - "VERSION", - "XML", - "XMLParser", "XMLTreeBuilder", - ] - -VERSION = "1.3.0" - -## -# The Element type is a flexible container object, designed to -# store hierarchical data structures in memory. The type can be -# described as a cross between a list and a dictionary. -#

-# Each element has a number of properties associated with it: -#

    -#
  • a tag. This is a string identifying what kind of data -# this element represents (the element type, in other words).
  • -#
  • a number of attributes, stored in a Python dictionary.
  • -#
  • a text string.
  • -#
  • an optional tail string.
  • -#
  • a number of child elements, stored in a Python sequence
  • -#
-# -# To create an element instance, use the {@link #Element} constructor -# or the {@link #SubElement} factory function. -#

-# The {@link #ElementTree} class can be used to wrap an element -# structure, and convert it from and to XML. -## - -import sys -import re -import warnings - - -class _SimpleElementPath(object): - # emulate pre-1.2 find/findtext/findall behaviour - def find(self, element, tag, namespaces=None): - for elem in element: - if elem.tag == tag: - return elem - return None - def findtext(self, element, tag, default=None, namespaces=None): - elem = self.find(element, tag) - if elem is None: - return default - return elem.text or "" - def iterfind(self, element, tag, namespaces=None): - if tag[:3] == ".//": - for elem in element.iter(tag[3:]): - yield elem - for elem in element: - if elem.tag == tag: - yield elem - def findall(self, element, tag, namespaces=None): - return list(self.iterfind(element, tag, namespaces)) - -try: - from . import ElementPath -except ImportError: - ElementPath = _SimpleElementPath() - -## -# Parser error. This is a subclass of SyntaxError. -#

-# In addition to the exception value, an exception instance contains a -# specific exception code in the code attribute, and the line and -# column of the error in the position attribute. - -class ParseError(SyntaxError): - pass - -# -------------------------------------------------------------------- - -## -# Checks if an object appears to be a valid element object. -# -# @param An element instance. -# @return A true value if this is an element object. -# @defreturn flag - -def iselement(element): - # FIXME: not sure about this; might be a better idea to look - # for tag/attrib/text attributes - return isinstance(element, Element) or hasattr(element, "tag") - -## -# Element class. This class defines the Element interface, and -# provides a reference implementation of this interface. -#

-# The element name, attribute names, and attribute values can be -# either ASCII strings (ordinary Python strings containing only 7-bit -# ASCII characters) or Unicode strings. -# -# @param tag The element name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @see Element -# @see SubElement -# @see Comment -# @see ProcessingInstruction - -class Element(object): - # text...tail - - ## - # (Attribute) Element tag. - - tag = None - - ## - # (Attribute) Element attribute dictionary. Where possible, use - # {@link #Element.get}, - # {@link #Element.set}, - # {@link #Element.keys}, and - # {@link #Element.items} to access - # element attributes. - - attrib = None - - ## - # (Attribute) Text before first subelement. This is either a - # string or the value None. Note that if there was no text, this - # attribute may be either None or an empty string, depending on - # the parser. - - text = None - - ## - # (Attribute) Text after this element's end tag, but before the - # next sibling element's start tag. This is either a string or - # the value None. Note that if there was no text, this attribute - # may be either None or an empty string, depending on the parser. - - tail = None # text after end tag, if any - - # constructor - - def __init__(self, tag, attrib={}, **extra): - attrib = attrib.copy() - attrib.update(extra) - self.tag = tag - self.attrib = attrib - self._children = [] - - def __repr__(self): - return "" % (repr(self.tag), id(self)) - - ## - # Creates a new element object of the same type as this element. - # - # @param tag Element tag. - # @param attrib Element attributes, given as a dictionary. - # @return A new element instance. - - def makeelement(self, tag, attrib): - return self.__class__(tag, attrib) - - ## - # (Experimental) Copies the current element. This creates a - # shallow copy; subelements will be shared with the original tree. - # - # @return A new element instance. - - def copy(self): - elem = self.makeelement(self.tag, self.attrib) - elem.text = self.text - elem.tail = self.tail - elem[:] = self - return elem - - ## - # Returns the number of subelements. Note that this only counts - # full elements; to check if there's any content in an element, you - # have to check both the length and the text attribute. - # - # @return The number of subelements. - - def __len__(self): - return len(self._children) - - def __nonzero__(self): - warnings.warn( - "The behavior of this method will change in future versions. " - "Use specific 'len(elem)' or 'elem is not None' test instead.", - FutureWarning, stacklevel=2 - ) - return len(self._children) != 0 # emulate old behaviour, for now - - ## - # Returns the given subelement, by index. - # - # @param index What subelement to return. - # @return The given subelement. - # @exception IndexError If the given element does not exist. - - def __getitem__(self, index): - return self._children[index] - - ## - # Replaces the given subelement, by index. - # - # @param index What subelement to replace. - # @param element The new element value. - # @exception IndexError If the given element does not exist. - - def __setitem__(self, index, element): - # if isinstance(index, slice): - # for elt in element: - # assert iselement(elt) - # else: - # assert iselement(element) - self._children[index] = element - - ## - # Deletes the given subelement, by index. - # - # @param index What subelement to delete. - # @exception IndexError If the given element does not exist. - - def __delitem__(self, index): - del self._children[index] - - ## - # Adds a subelement to the end of this element. In document order, - # the new element will appear after the last existing subelement (or - # directly after the text, if it's the first subelement), but before - # the end tag for this element. - # - # @param element The element to add. - - def append(self, element): - # assert iselement(element) - self._children.append(element) - - ## - # Appends subelements from a sequence. - # - # @param elements A sequence object with zero or more elements. - # @since 1.3 - - def extend(self, elements): - # for element in elements: - # assert iselement(element) - self._children.extend(elements) - - ## - # Inserts a subelement at the given position in this element. - # - # @param index Where to insert the new subelement. - - def insert(self, index, element): - # assert iselement(element) - self._children.insert(index, element) - - ## - # Removes a matching subelement. Unlike the find methods, - # this method compares elements based on identity, not on tag - # value or contents. To remove subelements by other means, the - # easiest way is often to use a list comprehension to select what - # elements to keep, and use slice assignment to update the parent - # element. - # - # @param element What element to remove. - # @exception ValueError If a matching element could not be found. - - def remove(self, element): - # assert iselement(element) - self._children.remove(element) - - ## - # (Deprecated) Returns all subelements. The elements are returned - # in document order. - # - # @return A list of subelements. - # @defreturn list of Element instances - - def getchildren(self): - warnings.warn( - "This method will be removed in future versions. " - "Use 'list(elem)' or iteration over elem instead.", - DeprecationWarning, stacklevel=2 - ) - return self._children - - ## - # Finds the first matching subelement, by tag name or path. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None - - def find(self, path, namespaces=None): - return ElementPath.find(self, path, namespaces) - - ## - # Finds text for the first matching subelement, by tag name or path. - # - # @param path What element to look for. - # @param default What to return if the element was not found. - # @keyparam namespaces Optional namespace prefix map. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # is found, but has no text content, this method returns an - # empty string. - # @defreturn string - - def findtext(self, path, default=None, namespaces=None): - return ElementPath.findtext(self, path, default, namespaces) - - ## - # Finds all matching subelements, by tag name or path. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return A list or other sequence containing all matching elements, - # in document order. - # @defreturn list of Element instances - - def findall(self, path, namespaces=None): - return ElementPath.findall(self, path, namespaces) - - ## - # Finds all matching subelements, by tag name or path. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return An iterator or sequence containing all matching elements, - # in document order. - # @defreturn a generated sequence of Element instances - - def iterfind(self, path, namespaces=None): - return ElementPath.iterfind(self, path, namespaces) - - ## - # Resets an element. This function removes all subelements, clears - # all attributes, and sets the text and tail attributes - # to None. - - def clear(self): - self.attrib.clear() - self._children = [] - self.text = self.tail = None - - ## - # Gets an element attribute. Equivalent to attrib.get, but - # some implementations may handle this a bit more efficiently. - # - # @param key What attribute to look for. - # @param default What to return if the attribute was not found. - # @return The attribute value, or the default value, if the - # attribute was not found. - # @defreturn string or None - - def get(self, key, default=None): - return self.attrib.get(key, default) - - ## - # Sets an element attribute. Equivalent to attrib[key] = value, - # but some implementations may handle this a bit more efficiently. - # - # @param key What attribute to set. - # @param value The attribute value. - - def set(self, key, value): - self.attrib[key] = value - - ## - # Gets a list of attribute names. The names are returned in an - # arbitrary order (just like for an ordinary Python dictionary). - # Equivalent to attrib.keys(). - # - # @return A list of element attribute names. - # @defreturn list of strings - - def keys(self): - return self.attrib.keys() - - ## - # Gets element attributes, as a sequence. The attributes are - # returned in an arbitrary order. Equivalent to attrib.items(). - # - # @return A list of (name, value) tuples for all attributes. - # @defreturn list of (string, string) tuples - - def items(self): - return self.attrib.items() - - ## - # Creates a tree iterator. The iterator loops over this element - # and all subelements, in document order, and returns all elements - # with a matching tag. - #

- # If the tree structure is modified during iteration, new or removed - # elements may or may not be included. To get a stable set, use the - # list() function on the iterator, and loop over the resulting list. - # - # @param tag What tags to look for (default is to return all elements). - # @return An iterator containing all the matching elements. - # @defreturn iterator - - def iter(self, tag=None): - if tag == "*": - tag = None - if tag is None or self.tag == tag: - yield self - for e in self._children: - for e in e.iter(tag): - yield e - - # compatibility - def getiterator(self, tag=None): - # Change for a DeprecationWarning in 1.4 - warnings.warn( - "This method will be removed in future versions. " - "Use 'elem.iter()' or 'list(elem.iter())' instead.", - PendingDeprecationWarning, stacklevel=2 - ) - return list(self.iter(tag)) - - ## - # Creates a text iterator. The iterator loops over this element - # and all subelements, in document order, and returns all inner - # text. - # - # @return An iterator containing all inner text. - # @defreturn iterator - - def itertext(self): - tag = self.tag - if not isinstance(tag, basestring) and tag is not None: - return - if self.text: - yield self.text - for e in self: - for s in e.itertext(): - yield s - if e.tail: - yield e.tail - -# compatibility -_Element = _ElementInterface = Element - -## -# Subelement factory. This function creates an element instance, and -# appends it to an existing element. -#

-# The element name, attribute names, and attribute values can be -# either 8-bit ASCII strings or Unicode strings. -# -# @param parent The parent element. -# @param tag The subelement name. -# @param attrib An optional dictionary, containing element attributes. -# @param **extra Additional attributes, given as keyword arguments. -# @return An element instance. -# @defreturn Element - -def SubElement(parent, tag, attrib={}, **extra): - attrib = attrib.copy() - attrib.update(extra) - element = parent.makeelement(tag, attrib) - parent.append(element) - return element - -## -# Comment element factory. This factory function creates a special -# element that will be serialized as an XML comment by the standard -# serializer. -#

-# The comment string can be either an 8-bit ASCII string or a Unicode -# string. -# -# @param text A string containing the comment string. -# @return An element instance, representing a comment. -# @defreturn Element - -def Comment(text=None): - element = Element(Comment) - element.text = text - return element - -## -# PI element factory. This factory function creates a special element -# that will be serialized as an XML processing instruction by the standard -# serializer. -# -# @param target A string containing the PI target. -# @param text A string containing the PI contents, if any. -# @return An element instance, representing a PI. -# @defreturn Element - -def ProcessingInstruction(target, text=None): - element = Element(ProcessingInstruction) - element.text = target - if text: - element.text = element.text + " " + text - return element - -PI = ProcessingInstruction - -## -# QName wrapper. This can be used to wrap a QName attribute value, in -# order to get proper namespace handling on output. -# -# @param text A string containing the QName value, in the form {uri}local, -# or, if the tag argument is given, the URI part of a QName. -# @param tag Optional tag. If given, the first argument is interpreted as -# an URI, and this argument is interpreted as a local name. -# @return An opaque object, representing the QName. - -class QName(object): - def __init__(self, text_or_uri, tag=None): - if tag: - text_or_uri = "{%s}%s" % (text_or_uri, tag) - self.text = text_or_uri - def __str__(self): - return self.text - def __hash__(self): - return hash(self.text) - def __cmp__(self, other): - if isinstance(other, QName): - return cmp(self.text, other.text) - return cmp(self.text, other) - -# -------------------------------------------------------------------- - -## -# ElementTree wrapper class. This class represents an entire element -# hierarchy, and adds some extra support for serialization to and from -# standard XML. -# -# @param element Optional root element. -# @keyparam file Optional file handle or file name. If given, the -# tree is initialized with the contents of this XML file. - -class ElementTree(object): - - def __init__(self, element=None, file=None): - # assert element is None or iselement(element) - self._root = element # first node - if file: - self.parse(file) - - ## - # Gets the root element for this tree. - # - # @return An element instance. - # @defreturn Element - - def getroot(self): - return self._root - - ## - # Replaces the root element for this tree. This discards the - # current contents of the tree, and replaces it with the given - # element. Use with care. - # - # @param element An element instance. - - def _setroot(self, element): - # assert iselement(element) - self._root = element - - ## - # Loads an external XML document into this element tree. - # - # @param source A file name or file object. If a file object is - # given, it only has to implement a read(n) method. - # @keyparam parser An optional parser instance. If not given, the - # standard {@link XMLParser} parser is used. - # @return The document root element. - # @defreturn Element - # @exception ParseError If the parser fails to parse the document. - - def parse(self, source, parser=None): - close_source = False - if not hasattr(source, "read"): - source = open(source, "rb") - close_source = True - try: - if not parser: - parser = XMLParser(target=TreeBuilder()) - while 1: - data = source.read(65536) - if not data: - break - parser.feed(data) - self._root = parser.close() - return self._root - finally: - if close_source: - source.close() - - ## - # Creates a tree iterator for the root element. The iterator loops - # over all elements in this tree, in document order. - # - # @param tag What tags to look for (default is to return all elements) - # @return An iterator. - # @defreturn iterator - - def iter(self, tag=None): - # assert self._root is not None - return self._root.iter(tag) - - # compatibility - def getiterator(self, tag=None): - # Change for a DeprecationWarning in 1.4 - warnings.warn( - "This method will be removed in future versions. " - "Use 'tree.iter()' or 'list(tree.iter())' instead.", - PendingDeprecationWarning, stacklevel=2 - ) - return list(self.iter(tag)) - - ## - # Same as getroot().find(path), starting at the root of the - # tree. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return The first matching element, or None if no element was found. - # @defreturn Element or None - - def find(self, path, namespaces=None): - # assert self._root is not None - if path[:1] == "/": - path = "." + path - warnings.warn( - "This search is broken in 1.3 and earlier, and will be " - "fixed in a future version. If you rely on the current " - "behaviour, change it to %r" % path, - FutureWarning, stacklevel=2 - ) - return self._root.find(path, namespaces) - - ## - # Same as getroot().findtext(path), starting at the root of the tree. - # - # @param path What element to look for. - # @param default What to return if the element was not found. - # @keyparam namespaces Optional namespace prefix map. - # @return The text content of the first matching element, or the - # default value no element was found. Note that if the element - # is found, but has no text content, this method returns an - # empty string. - # @defreturn string - - def findtext(self, path, default=None, namespaces=None): - # assert self._root is not None - if path[:1] == "/": - path = "." + path - warnings.warn( - "This search is broken in 1.3 and earlier, and will be " - "fixed in a future version. If you rely on the current " - "behaviour, change it to %r" % path, - FutureWarning, stacklevel=2 - ) - return self._root.findtext(path, default, namespaces) - - ## - # Same as getroot().findall(path), starting at the root of the tree. - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return A list or iterator containing all matching elements, - # in document order. - # @defreturn list of Element instances - - def findall(self, path, namespaces=None): - # assert self._root is not None - if path[:1] == "/": - path = "." + path - warnings.warn( - "This search is broken in 1.3 and earlier, and will be " - "fixed in a future version. If you rely on the current " - "behaviour, change it to %r" % path, - FutureWarning, stacklevel=2 - ) - return self._root.findall(path, namespaces) - - ## - # Finds all matching subelements, by tag name or path. - # Same as getroot().iterfind(path). - # - # @param path What element to look for. - # @keyparam namespaces Optional namespace prefix map. - # @return An iterator or sequence containing all matching elements, - # in document order. - # @defreturn a generated sequence of Element instances - - def iterfind(self, path, namespaces=None): - # assert self._root is not None - if path[:1] == "/": - path = "." + path - warnings.warn( - "This search is broken in 1.3 and earlier, and will be " - "fixed in a future version. If you rely on the current " - "behaviour, change it to %r" % path, - FutureWarning, stacklevel=2 - ) - return self._root.iterfind(path, namespaces) - - ## - # Writes the element tree to a file, as XML. - # - # @def write(file, **options) - # @param file A file name, or a file object opened for writing. - # @param **options Options, given as keyword arguments. - # @keyparam encoding Optional output encoding (default is US-ASCII). - # @keyparam xml_declaration Controls if an XML declaration should - # be added to the file. Use False for never, True for always, - # None for only if not US-ASCII or UTF-8. None is default. - # @keyparam default_namespace Sets the default XML namespace (for "xmlns"). - # @keyparam method Optional output method ("xml", "html", "text" or - # "c14n"; default is "xml"). - - def write(self, file_or_filename, - # keyword arguments - encoding=None, - xml_declaration=None, - default_namespace=None, - method=None): - # assert self._root is not None - if not method: - method = "xml" - elif method not in _serialize: - # FIXME: raise an ImportError for c14n if ElementC14N is missing? - raise ValueError("unknown method %r" % method) - if hasattr(file_or_filename, "write"): - file = file_or_filename - else: - file = open(file_or_filename, "wb") - write = file.write - if not encoding: - if method == "c14n": - encoding = "utf-8" - else: - encoding = "us-ascii" - elif xml_declaration or (xml_declaration is None and - encoding not in ("utf-8", "us-ascii")): - if method == "xml": - write("\n" % encoding) - if method == "text": - _serialize_text(write, self._root, encoding) - else: - qnames, namespaces = _namespaces( - self._root, encoding, default_namespace - ) - serialize = _serialize[method] - serialize(write, self._root, encoding, qnames, namespaces) - if file_or_filename is not file: - file.close() - - def write_c14n(self, file): - # lxml.etree compatibility. use output method instead - return self.write(file, method="c14n") - -# -------------------------------------------------------------------- -# serialization support - -def _namespaces(elem, encoding, default_namespace=None): - # identify namespaces used in this tree - - # maps qnames to *encoded* prefix:local names - qnames = {None: None} - - # maps uri:s to prefixes - namespaces = {} - if default_namespace: - namespaces[default_namespace] = "" - - def encode(text): - return text.encode(encoding) - - def add_qname(qname): - # calculate serialized qname representation - try: - if qname[:1] == "{": - uri, tag = qname[1:].rsplit("}", 1) - prefix = namespaces.get(uri) - if prefix is None: - prefix = _namespace_map.get(uri) - if prefix is None: - prefix = "ns%d" % len(namespaces) - if prefix != "xml": - namespaces[uri] = prefix - if prefix: - qnames[qname] = encode("%s:%s" % (prefix, tag)) - else: - qnames[qname] = encode(tag) # default element - else: - if default_namespace: - # FIXME: can this be handled in XML 1.0? - raise ValueError( - "cannot use non-qualified names with " - "default_namespace option" - ) - qnames[qname] = encode(qname) - except TypeError: - _raise_serialization_error(qname) - - # populate qname and namespaces table - try: - iterate = elem.iter - except AttributeError: - iterate = elem.getiterator # cET compatibility - for elem in iterate(): - tag = elem.tag - if isinstance(tag, QName): - if tag.text not in qnames: - add_qname(tag.text) - elif isinstance(tag, basestring): - if tag not in qnames: - add_qname(tag) - elif tag is not None and tag is not Comment and tag is not PI: - _raise_serialization_error(tag) - for key, value in elem.items(): - if isinstance(key, QName): - key = key.text - if key not in qnames: - add_qname(key) - if isinstance(value, QName) and value.text not in qnames: - add_qname(value.text) - text = elem.text - if isinstance(text, QName) and text.text not in qnames: - add_qname(text.text) - return qnames, namespaces - -def _serialize_xml(write, elem, encoding, qnames, namespaces): - tag = elem.tag - text = elem.text - if tag is Comment: - write("" % _encode(text, encoding)) - elif tag is ProcessingInstruction: - write("" % _encode(text, encoding)) - else: - tag = qnames[tag] - if tag is None: - if text: - write(_escape_cdata(text, encoding)) - for e in elem: - _serialize_xml(write, e, encoding, qnames, None) - else: - write("<" + tag) - items = elem.items() - if items or namespaces: - if namespaces: - for v, k in sorted(namespaces.items(), - key=lambda x: x[1]): # sort on prefix - if k: - k = ":" + k - write(" xmlns%s=\"%s\"" % ( - k.encode(encoding), - _escape_attrib(v, encoding) - )) - for k, v in sorted(items): # lexical order - if isinstance(k, QName): - k = k.text - if isinstance(v, QName): - v = qnames[v.text] - else: - v = _escape_attrib(v, encoding) - write(" %s=\"%s\"" % (qnames[k], v)) - if text or len(elem): - write(">") - if text: - write(_escape_cdata(text, encoding)) - for e in elem: - _serialize_xml(write, e, encoding, qnames, None) - write("") - else: - write(" />") - if elem.tail: - write(_escape_cdata(elem.tail, encoding)) - -HTML_EMPTY = ("area", "base", "basefont", "br", "col", "frame", "hr", - "img", "input", "isindex", "link", "meta", "param") - -try: - HTML_EMPTY = set(HTML_EMPTY) -except NameError: - pass - -def _serialize_html(write, elem, encoding, qnames, namespaces): - tag = elem.tag - text = elem.text - if tag is Comment: - write("" % _escape_cdata(text, encoding)) - elif tag is ProcessingInstruction: - write("" % _escape_cdata(text, encoding)) - else: - tag = qnames[tag] - if tag is None: - if text: - write(_escape_cdata(text, encoding)) - for e in elem: - _serialize_html(write, e, encoding, qnames, None) - else: - write("<" + tag) - items = elem.items() - if items or namespaces: - if namespaces: - for v, k in sorted(namespaces.items(), - key=lambda x: x[1]): # sort on prefix - if k: - k = ":" + k - write(" xmlns%s=\"%s\"" % ( - k.encode(encoding), - _escape_attrib(v, encoding) - )) - for k, v in sorted(items): # lexical order - if isinstance(k, QName): - k = k.text - if isinstance(v, QName): - v = qnames[v.text] - else: - v = _escape_attrib_html(v, encoding) - # FIXME: handle boolean attributes - write(" %s=\"%s\"" % (qnames[k], v)) - write(">") - ltag = tag.lower() - if text: - if ltag == "script" or ltag == "style": - write(_encode(text, encoding)) - else: - write(_escape_cdata(text, encoding)) - for e in elem: - _serialize_html(write, e, encoding, qnames, None) - if ltag not in HTML_EMPTY: - write("") - if elem.tail: - write(_escape_cdata(elem.tail, encoding)) - -def _serialize_text(write, elem, encoding): - for part in elem.itertext(): - write(part.encode(encoding)) - if elem.tail: - write(elem.tail.encode(encoding)) - -_serialize = { - "xml": _serialize_xml, - "html": _serialize_html, - "text": _serialize_text, -# this optional method is imported at the end of the module -# "c14n": _serialize_c14n, -} - -## -# Registers a namespace prefix. The registry is global, and any -# existing mapping for either the given prefix or the namespace URI -# will be removed. -# -# @param prefix Namespace prefix. -# @param uri Namespace uri. Tags and attributes in this namespace -# will be serialized with the given prefix, if at all possible. -# @exception ValueError If the prefix is reserved, or is otherwise -# invalid. - -def register_namespace(prefix, uri): - if re.match("ns\d+$", prefix): - raise ValueError("Prefix format reserved for internal use") - for k, v in _namespace_map.items(): - if k == uri or v == prefix: - del _namespace_map[k] - _namespace_map[uri] = prefix - -_namespace_map = { - # "well-known" namespace prefixes - "http://www.w3.org/XML/1998/namespace": "xml", - "http://www.w3.org/1999/xhtml": "html", - "http://www.w3.org/1999/02/22-rdf-syntax-ns#": "rdf", - "http://schemas.xmlsoap.org/wsdl/": "wsdl", - # xml schema - "http://www.w3.org/2001/XMLSchema": "xs", - "http://www.w3.org/2001/XMLSchema-instance": "xsi", - # dublin core - "http://purl.org/dc/elements/1.1/": "dc", -} - -def _raise_serialization_error(text): - raise TypeError( - "cannot serialize %r (type %s)" % (text, type(text).__name__) - ) - -def _encode(text, encoding): - try: - return text.encode(encoding, "xmlcharrefreplace") - except (TypeError, AttributeError): - _raise_serialization_error(text) - -def _escape_cdata(text, encoding): - # escape character data - try: - # it's worth avoiding do-nothing calls for strings that are - # shorter than 500 character, or so. assume that's, by far, - # the most common case in most applications. - if "&" in text: - text = text.replace("&", "&") - if "<" in text: - text = text.replace("<", "<") - if ">" in text: - text = text.replace(">", ">") - return text.encode(encoding, "xmlcharrefreplace") - except (TypeError, AttributeError): - _raise_serialization_error(text) - -def _escape_attrib(text, encoding): - # escape attribute value - try: - if "&" in text: - text = text.replace("&", "&") - if "<" in text: - text = text.replace("<", "<") - if ">" in text: - text = text.replace(">", ">") - if "\"" in text: - text = text.replace("\"", """) - if "\n" in text: - text = text.replace("\n", " ") - return text.encode(encoding, "xmlcharrefreplace") - except (TypeError, AttributeError): - _raise_serialization_error(text) - -def _escape_attrib_html(text, encoding): - # escape attribute value - try: - if "&" in text: - text = text.replace("&", "&") - if ">" in text: - text = text.replace(">", ">") - if "\"" in text: - text = text.replace("\"", """) - return text.encode(encoding, "xmlcharrefreplace") - except (TypeError, AttributeError): - _raise_serialization_error(text) - -# -------------------------------------------------------------------- - -## -# Generates a string representation of an XML element, including all -# subelements. -# -# @param element An Element instance. -# @keyparam encoding Optional output encoding (default is US-ASCII). -# @keyparam method Optional output method ("xml", "html", "text" or -# "c14n"; default is "xml"). -# @return An encoded string containing the XML data. -# @defreturn string - -def tostring(element, encoding=None, method=None): - class dummy: - pass - data = [] - file = dummy() - file.write = data.append - ElementTree(element).write(file, encoding, method=method) - return "".join(data) - -## -# Generates a string representation of an XML element, including all -# subelements. The string is returned as a sequence of string fragments. -# -# @param element An Element instance. -# @keyparam encoding Optional output encoding (default is US-ASCII). -# @keyparam method Optional output method ("xml", "html", "text" or -# "c14n"; default is "xml"). -# @return A sequence object containing the XML data. -# @defreturn sequence -# @since 1.3 - -def tostringlist(element, encoding=None, method=None): - class dummy: - pass - data = [] - file = dummy() - file.write = data.append - ElementTree(element).write(file, encoding, method=method) - # FIXME: merge small fragments into larger parts - return data - -## -# Writes an element tree or element structure to sys.stdout. This -# function should be used for debugging only. -#

-# The exact output format is implementation dependent. In this -# version, it's written as an ordinary XML file. -# -# @param elem An element tree or an individual element. - -def dump(elem): - # debugging - if not isinstance(elem, ElementTree): - elem = ElementTree(elem) - elem.write(sys.stdout) - tail = elem.getroot().tail - if not tail or tail[-1] != "\n": - sys.stdout.write("\n") - -# -------------------------------------------------------------------- -# parsing - -## -# Parses an XML document into an element tree. -# -# @param source A filename or file object containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return An ElementTree instance - -def parse(source, parser=None): - tree = ElementTree() - tree.parse(source, parser) - return tree - -## -# Parses an XML document into an element tree incrementally, and reports -# what's going on to the user. -# -# @param source A filename or file object containing XML data. -# @param events A list of events to report back. If omitted, only "end" -# events are reported. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return A (event, elem) iterator. - -def iterparse(source, events=None, parser=None): - close_source = False - if not hasattr(source, "read"): - source = open(source, "rb") - close_source = True - if not parser: - parser = XMLParser(target=TreeBuilder()) - return _IterParseIterator(source, events, parser, close_source) - -class _IterParseIterator(object): - - def __init__(self, source, events, parser, close_source=False): - self._file = source - self._close_file = close_source - self._events = [] - self._index = 0 - self._error = None - self.root = self._root = None - self._parser = parser - # wire up the parser for event reporting - parser = self._parser._parser - append = self._events.append - if events is None: - events = ["end"] - for event in events: - if event == "start": - try: - parser.ordered_attributes = 1 - parser.specified_attributes = 1 - def handler(tag, attrib_in, event=event, append=append, - start=self._parser._start_list): - append((event, start(tag, attrib_in))) - parser.StartElementHandler = handler - except AttributeError: - def handler(tag, attrib_in, event=event, append=append, - start=self._parser._start): - append((event, start(tag, attrib_in))) - parser.StartElementHandler = handler - elif event == "end": - def handler(tag, event=event, append=append, - end=self._parser._end): - append((event, end(tag))) - parser.EndElementHandler = handler - elif event == "start-ns": - def handler(prefix, uri, event=event, append=append): - try: - uri = (uri or "").encode("ascii") - except UnicodeError: - pass - append((event, (prefix or "", uri or ""))) - parser.StartNamespaceDeclHandler = handler - elif event == "end-ns": - def handler(prefix, event=event, append=append): - append((event, None)) - parser.EndNamespaceDeclHandler = handler - else: - raise ValueError("unknown event %r" % event) - - def next(self): - while 1: - try: - item = self._events[self._index] - self._index += 1 - return item - except IndexError: - pass - if self._error: - e = self._error - self._error = None - raise e - if self._parser is None: - self.root = self._root - if self._close_file: - self._file.close() - raise StopIteration - # load event buffer - del self._events[:] - self._index = 0 - data = self._file.read(16384) - if data: - try: - self._parser.feed(data) - except SyntaxError as exc: - self._error = exc - else: - self._root = self._parser.close() - self._parser = None - - def __iter__(self): - return self - -## -# Parses an XML document from a string constant. This function can -# be used to embed "XML literals" in Python code. -# -# @param source A string containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return An Element instance. -# @defreturn Element - -def XML(text, parser=None): - if not parser: - parser = XMLParser(target=TreeBuilder()) - parser.feed(text) - return parser.close() - -## -# Parses an XML document from a string constant, and also returns -# a dictionary which maps from element id:s to elements. -# -# @param source A string containing XML data. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return A tuple containing an Element instance and a dictionary. -# @defreturn (Element, dictionary) - -def XMLID(text, parser=None): - if not parser: - parser = XMLParser(target=TreeBuilder()) - parser.feed(text) - tree = parser.close() - ids = {} - for elem in tree.iter(): - id = elem.get("id") - if id: - ids[id] = elem - return tree, ids - -## -# Parses an XML document from a string constant. Same as {@link #XML}. -# -# @def fromstring(text) -# @param source A string containing XML data. -# @return An Element instance. -# @defreturn Element - -fromstring = XML - -## -# Parses an XML document from a sequence of string fragments. -# -# @param sequence A list or other sequence containing XML data fragments. -# @param parser An optional parser instance. If not given, the -# standard {@link XMLParser} parser is used. -# @return An Element instance. -# @defreturn Element -# @since 1.3 - -def fromstringlist(sequence, parser=None): - if not parser: - parser = XMLParser(target=TreeBuilder()) - for text in sequence: - parser.feed(text) - return parser.close() - -# -------------------------------------------------------------------- - -## -# Generic element structure builder. This builder converts a sequence -# of {@link #TreeBuilder.start}, {@link #TreeBuilder.data}, and {@link -# #TreeBuilder.end} method calls to a well-formed element structure. -#

-# You can use this class to build an element structure using a custom XML -# parser, or a parser for some other XML-like format. -# -# @param element_factory Optional element factory. This factory -# is called to create new Element instances, as necessary. - -class TreeBuilder(object): - - def __init__(self, element_factory=None): - self._data = [] # data collector - self._elem = [] # element stack - self._last = None # last element - self._tail = None # true if we're after an end tag - if element_factory is None: - element_factory = Element - self._factory = element_factory - - ## - # Flushes the builder buffers, and returns the toplevel document - # element. - # - # @return An Element instance. - # @defreturn Element - - def close(self): - assert len(self._elem) == 0, "missing end tags" - assert self._last is not None, "missing toplevel element" - return self._last - - def _flush(self): - if self._data: - if self._last is not None: - text = "".join(self._data) - if self._tail: - assert self._last.tail is None, "internal error (tail)" - self._last.tail = text - else: - assert self._last.text is None, "internal error (text)" - self._last.text = text - self._data = [] - - ## - # Adds text to the current element. - # - # @param data A string. This should be either an 8-bit string - # containing ASCII text, or a Unicode string. - - def data(self, data): - self._data.append(data) - - ## - # Opens a new element. - # - # @param tag The element name. - # @param attrib A dictionary containing element attributes. - # @return The opened element. - # @defreturn Element - - def start(self, tag, attrs): - self._flush() - self._last = elem = self._factory(tag, attrs) - if self._elem: - self._elem[-1].append(elem) - self._elem.append(elem) - self._tail = 0 - return elem - - ## - # Closes the current element. - # - # @param tag The element name. - # @return The closed element. - # @defreturn Element - - def end(self, tag): - self._flush() - self._last = self._elem.pop() - assert self._last.tag == tag,\ - "end tag mismatch (expected %s, got %s)" % ( - self._last.tag, tag) - self._tail = 1 - return self._last - -## -# Element structure builder for XML source data, based on the -# expat parser. -# -# @keyparam target Target object. If omitted, the builder uses an -# instance of the standard {@link #TreeBuilder} class. -# @keyparam html Predefine HTML entities. This flag is not supported -# by the current implementation. -# @keyparam encoding Optional encoding. If given, the value overrides -# the encoding specified in the XML file. -# @see #ElementTree -# @see #TreeBuilder - -class XMLParser(object): - - def __init__(self, html=0, target=None, encoding=None): - try: - from xml.parsers import expat - except ImportError: - try: - import pyexpat as expat - except ImportError: - raise ImportError( - "No module named expat; use SimpleXMLTreeBuilder instead" - ) - parser = expat.ParserCreate(encoding, "}") - if target is None: - target = TreeBuilder() - # underscored names are provided for compatibility only - self.parser = self._parser = parser - self.target = self._target = target - self._error = expat.error - self._names = {} # name memo cache - # callbacks - parser.DefaultHandlerExpand = self._default - parser.StartElementHandler = self._start - parser.EndElementHandler = self._end - parser.CharacterDataHandler = self._data - # optional callbacks - parser.CommentHandler = self._comment - parser.ProcessingInstructionHandler = self._pi - # let expat do the buffering, if supported - try: - self._parser.buffer_text = 1 - except AttributeError: - pass - # use new-style attribute handling, if supported - try: - self._parser.ordered_attributes = 1 - self._parser.specified_attributes = 1 - parser.StartElementHandler = self._start_list - except AttributeError: - pass - self._doctype = None - self.entity = {} - try: - self.version = "Expat %d.%d.%d" % expat.version_info - except AttributeError: - pass # unknown - - def _raiseerror(self, value): - err = ParseError(value) - err.code = value.code - err.position = value.lineno, value.offset - raise err - - def _fixtext(self, text): - # convert text string to ascii, if possible - try: - return text.encode("ascii") - except UnicodeError: - return text - - def _fixname(self, key): - # expand qname, and convert name string to ascii, if possible - try: - name = self._names[key] - except KeyError: - name = key - if "}" in name: - name = "{" + name - self._names[key] = name = self._fixtext(name) - return name - - def _start(self, tag, attrib_in): - fixname = self._fixname - fixtext = self._fixtext - tag = fixname(tag) - attrib = {} - for key, value in attrib_in.items(): - attrib[fixname(key)] = fixtext(value) - return self.target.start(tag, attrib) - - def _start_list(self, tag, attrib_in): - fixname = self._fixname - fixtext = self._fixtext - tag = fixname(tag) - attrib = {} - if attrib_in: - for i in range(0, len(attrib_in), 2): - attrib[fixname(attrib_in[i])] = fixtext(attrib_in[i+1]) - return self.target.start(tag, attrib) - - def _data(self, text): - return self.target.data(self._fixtext(text)) - - def _end(self, tag): - return self.target.end(self._fixname(tag)) - - def _comment(self, data): - try: - comment = self.target.comment - except AttributeError: - pass - else: - return comment(self._fixtext(data)) - - def _pi(self, target, data): - try: - pi = self.target.pi - except AttributeError: - pass - else: - return pi(self._fixtext(target), self._fixtext(data)) - - def _default(self, text): - prefix = text[:1] - if prefix == "&": - # deal with undefined entities - try: - self.target.data(self.entity[text[1:-1]]) - except KeyError: - from xml.parsers import expat - err = expat.error( - "undefined entity %s: line %d, column %d" % - (text, self._parser.ErrorLineNumber, - self._parser.ErrorColumnNumber) - ) - err.code = 11 # XML_ERROR_UNDEFINED_ENTITY - err.lineno = self._parser.ErrorLineNumber - err.offset = self._parser.ErrorColumnNumber - raise err - elif prefix == "<" and text[:9] == "": - self._doctype = None - return - text = text.strip() - if not text: - return - self._doctype.append(text) - n = len(self._doctype) - if n > 2: - type = self._doctype[1] - if type == "PUBLIC" and n == 4: - name, type, pubid, system = self._doctype - elif type == "SYSTEM" and n == 3: - name, type, system = self._doctype - pubid = None - else: - return - if pubid: - pubid = pubid[1:-1] - if hasattr(self.target, "doctype"): - self.target.doctype(name, pubid, system[1:-1]) - elif self.doctype is not self._XMLParser__doctype: - # warn about deprecated call - self._XMLParser__doctype(name, pubid, system[1:-1]) - self.doctype(name, pubid, system[1:-1]) - self._doctype = None - - ## - # (Deprecated) Handles a doctype declaration. - # - # @param name Doctype name. - # @param pubid Public identifier. - # @param system System identifier. - - def doctype(self, name, pubid, system): - """This method of XMLParser is deprecated.""" - warnings.warn( - "This method of XMLParser is deprecated. Define doctype() " - "method on the TreeBuilder target.", - DeprecationWarning, - ) - - # sentinel, if doctype is redefined in a subclass - __doctype = doctype - - ## - # Feeds data to the parser. - # - # @param data Encoded data. - - def feed(self, data): - try: - self._parser.Parse(data, 0) - except self._error, v: - self._raiseerror(v) - - ## - # Finishes feeding data to the parser. - # - # @return An element structure. - # @defreturn Element - - def close(self): - try: - self._parser.Parse("", 1) # end of data - except self._error, v: - self._raiseerror(v) - tree = self.target.close() - del self.target, self._parser # get rid of circular references - return tree - -# compatibility -XMLTreeBuilder = XMLParser - -# workaround circular import. -try: - from ElementC14N import _serialize_c14n - _serialize["c14n"] = _serialize_c14n -except ImportError: - pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py deleted file mode 100644 index 1fd62da..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/__init__.py +++ /dev/null @@ -1,33 +0,0 @@ -# $Id: __init__.py 3375 2008-02-13 08:05:08Z fredrik $ -# elementtree package - -# -------------------------------------------------------------------- -# The ElementTree toolkit is -# -# Copyright (c) 1999-2008 by Fredrik Lundh -# -# By obtaining, using, and/or copying this software and/or its -# associated documentation, you agree that you have read, understood, -# and will comply with the following terms and conditions: -# -# Permission to use, copy, modify, and distribute this software and -# its associated documentation for any purpose and without fee is -# hereby granted, provided that the above copyright notice appears in -# all copies, and that both that copyright notice and this permission -# notice appear in supporting documentation, and that the name of -# Secret Labs AB or the author not be used in advertising or publicity -# pertaining to distribution of the software without specific, written -# prior permission. -# -# SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD -# TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANT- -# ABILITY AND FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR -# BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY -# DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS -# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. -# -------------------------------------------------------------------- - -# Licensed to PSF under a Contributor Agreement. -# See http://www.python.org/psf/license for licensing details. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py deleted file mode 100644 index db12fde..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/etree/cElementTree.py +++ /dev/null @@ -1,3 +0,0 @@ -# Wrapper module for _elementtree - -from _elementtree import * diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py deleted file mode 100644 index ee4380b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -"""Python interfaces to XML parsers. - -This package contains one module: - -expat -- Python wrapper for James Clark's Expat parser, with namespace - support. - -""" diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py deleted file mode 100644 index 77fed62..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/parsers/expat.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Interface to the Expat non-validating XML parser.""" -__version__ = '$Revision: 17640 $' - -from pyexpat import * diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py deleted file mode 100644 index 2686c38..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/__init__.py +++ /dev/null @@ -1,108 +0,0 @@ -"""Simple API for XML (SAX) implementation for Python. - -This module provides an implementation of the SAX 2 interface; -information about the Java version of the interface can be found at -http://www.megginson.com/SAX/. The Python version of the interface is -documented at <...>. - -This package contains the following modules: - -handler -- Base classes and constants which define the SAX 2 API for - the 'client-side' of SAX for Python. - -saxutils -- Implementation of the convenience classes commonly used to - work with SAX. - -xmlreader -- Base classes and constants which define the SAX 2 API for - the parsers used with SAX for Python. - -expatreader -- Driver that allows use of the Expat parser with SAX. -""" - -from xmlreader import InputSource -from handler import ContentHandler, ErrorHandler -from _exceptions import SAXException, SAXNotRecognizedException, \ - SAXParseException, SAXNotSupportedException, \ - SAXReaderNotAvailable - - -def parse(source, handler, errorHandler=ErrorHandler()): - parser = make_parser() - parser.setContentHandler(handler) - parser.setErrorHandler(errorHandler) - parser.parse(source) - -def parseString(string, handler, errorHandler=ErrorHandler()): - try: - from cStringIO import StringIO - except ImportError: - from StringIO import StringIO - - if errorHandler is None: - errorHandler = ErrorHandler() - parser = make_parser() - parser.setContentHandler(handler) - parser.setErrorHandler(errorHandler) - - inpsrc = InputSource() - inpsrc.setByteStream(StringIO(string)) - parser.parse(inpsrc) - -# this is the parser list used by the make_parser function if no -# alternatives are given as parameters to the function - -default_parser_list = ["xml.sax.expatreader"] - -# tell modulefinder that importing sax potentially imports expatreader -_false = 0 -if _false: - import xml.sax.expatreader - -import os, sys -if "PY_SAX_PARSER" in os.environ: - default_parser_list = os.environ["PY_SAX_PARSER"].split(",") -del os - -_key = "python.xml.sax.parser" -if sys.platform[:4] == "java" and sys.registry.containsKey(_key): - default_parser_list = sys.registry.getProperty(_key).split(",") - - -def make_parser(parser_list = []): - """Creates and returns a SAX parser. - - Creates the first parser it is able to instantiate of the ones - given in the list created by doing parser_list + - default_parser_list. The lists must contain the names of Python - modules containing both a SAX parser and a create_parser function.""" - - for parser_name in parser_list + default_parser_list: - try: - return _create_parser(parser_name) - except ImportError,e: - import sys - if parser_name in sys.modules: - # The parser module was found, but importing it - # failed unexpectedly, pass this exception through - raise - except SAXReaderNotAvailable: - # The parser module detected that it won't work properly, - # so try the next one - pass - - raise SAXReaderNotAvailable("No parsers found", None) - -# --- Internal utility methods used by make_parser - -if sys.platform[ : 4] == "java": - def _create_parser(parser_name): - from org.python.core import imp - drv_module = imp.importName(parser_name, 0, globals()) - return drv_module.create_parser() - -else: - def _create_parser(parser_name): - drv_module = __import__(parser_name,{},{},['create_parser']) - return drv_module.create_parser() - -del sys diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py deleted file mode 100644 index 8477f0e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/_exceptions.py +++ /dev/null @@ -1,131 +0,0 @@ -"""Different kinds of SAX Exceptions""" -import sys -if sys.platform[:4] == "java": - from java.lang import Exception -del sys - -# ===== SAXEXCEPTION ===== - -class SAXException(Exception): - """Encapsulate an XML error or warning. This class can contain - basic error or warning information from either the XML parser or - the application: you can subclass it to provide additional - functionality, or to add localization. Note that although you will - receive a SAXException as the argument to the handlers in the - ErrorHandler interface, you are not actually required to raise - the exception; instead, you can simply read the information in - it.""" - - def __init__(self, msg, exception=None): - """Creates an exception. The message is required, but the exception - is optional.""" - self._msg = msg - self._exception = exception - Exception.__init__(self, msg) - - def getMessage(self): - "Return a message for this exception." - return self._msg - - def getException(self): - "Return the embedded exception, or None if there was none." - return self._exception - - def __str__(self): - "Create a string representation of the exception." - return self._msg - - def __getitem__(self, ix): - """Avoids weird error messages if someone does exception[ix] by - mistake, since Exception has __getitem__ defined.""" - raise AttributeError("__getitem__") - - -# ===== SAXPARSEEXCEPTION ===== - -class SAXParseException(SAXException): - """Encapsulate an XML parse error or warning. - - This exception will include information for locating the error in - the original XML document. Note that although the application will - receive a SAXParseException as the argument to the handlers in the - ErrorHandler interface, the application is not actually required - to raise the exception; instead, it can simply read the - information in it and take a different action. - - Since this exception is a subclass of SAXException, it inherits - the ability to wrap another exception.""" - - def __init__(self, msg, exception, locator): - "Creates the exception. The exception parameter is allowed to be None." - SAXException.__init__(self, msg, exception) - self._locator = locator - - # We need to cache this stuff at construction time. - # If this exception is raised, the objects through which we must - # traverse to get this information may be deleted by the time - # it gets caught. - self._systemId = self._locator.getSystemId() - self._colnum = self._locator.getColumnNumber() - self._linenum = self._locator.getLineNumber() - - def getColumnNumber(self): - """The column number of the end of the text where the exception - occurred.""" - return self._colnum - - def getLineNumber(self): - "The line number of the end of the text where the exception occurred." - return self._linenum - - def getPublicId(self): - "Get the public identifier of the entity where the exception occurred." - return self._locator.getPublicId() - - def getSystemId(self): - "Get the system identifier of the entity where the exception occurred." - return self._systemId - - def __str__(self): - "Create a string representation of the exception." - sysid = self.getSystemId() - if sysid is None: - sysid = "" - linenum = self.getLineNumber() - if linenum is None: - linenum = "?" - colnum = self.getColumnNumber() - if colnum is None: - colnum = "?" - return "%s:%s:%s: %s" % (sysid, linenum, colnum, self._msg) - - -# ===== SAXNOTRECOGNIZEDEXCEPTION ===== - -class SAXNotRecognizedException(SAXException): - """Exception class for an unrecognized identifier. - - An XMLReader will raise this exception when it is confronted with an - unrecognized feature or property. SAX applications and extensions may - use this class for similar purposes.""" - - -# ===== SAXNOTSUPPORTEDEXCEPTION ===== - -class SAXNotSupportedException(SAXException): - """Exception class for an unsupported operation. - - An XMLReader will raise this exception when a service it cannot - perform is requested (specifically setting a state or value). SAX - applications and extensions may use this class for similar - purposes.""" - -# ===== SAXNOTSUPPORTEDEXCEPTION ===== - -class SAXReaderNotAvailable(SAXNotSupportedException): - """Exception class for a missing driver. - - An XMLReader module (driver) should raise this exception when it - is first imported, e.g. when a support module cannot be imported. - It also may be raised during parsing, e.g. if executing an external - program is not permitted.""" diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py deleted file mode 100644 index f573311..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/expatreader.py +++ /dev/null @@ -1,430 +0,0 @@ -""" -SAX driver for the pyexpat C module. This driver works with -pyexpat.__version__ == '2.22'. -""" - -version = "0.20" - -from xml.sax._exceptions import * -from xml.sax.handler import feature_validation, feature_namespaces -from xml.sax.handler import feature_namespace_prefixes -from xml.sax.handler import feature_external_ges, feature_external_pes -from xml.sax.handler import feature_string_interning -from xml.sax.handler import property_xml_string, property_interning_dict - -# xml.parsers.expat does not raise ImportError in Jython -import sys -if sys.platform[:4] == "java": - raise SAXReaderNotAvailable("expat not available in Java", None) -del sys - -try: - from xml.parsers import expat -except ImportError: - raise SAXReaderNotAvailable("expat not supported", None) -else: - if not hasattr(expat, "ParserCreate"): - raise SAXReaderNotAvailable("expat not supported", None) -from xml.sax import xmlreader, saxutils, handler - -AttributesImpl = xmlreader.AttributesImpl -AttributesNSImpl = xmlreader.AttributesNSImpl - -# If we're using a sufficiently recent version of Python, we can use -# weak references to avoid cycles between the parser and content -# handler, otherwise we'll just have to pretend. -try: - import _weakref -except ImportError: - def _mkproxy(o): - return o -else: - import weakref - _mkproxy = weakref.proxy - del weakref, _weakref - -class _ClosedParser: - pass - -# --- ExpatLocator - -class ExpatLocator(xmlreader.Locator): - """Locator for use with the ExpatParser class. - - This uses a weak reference to the parser object to avoid creating - a circular reference between the parser and the content handler. - """ - def __init__(self, parser): - self._ref = _mkproxy(parser) - - def getColumnNumber(self): - parser = self._ref - if parser._parser is None: - return None - return parser._parser.ErrorColumnNumber - - def getLineNumber(self): - parser = self._ref - if parser._parser is None: - return 1 - return parser._parser.ErrorLineNumber - - def getPublicId(self): - parser = self._ref - if parser is None: - return None - return parser._source.getPublicId() - - def getSystemId(self): - parser = self._ref - if parser is None: - return None - return parser._source.getSystemId() - - -# --- ExpatParser - -class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): - """SAX driver for the pyexpat C module.""" - - def __init__(self, namespaceHandling=0, bufsize=2**16-20): - xmlreader.IncrementalParser.__init__(self, bufsize) - self._source = xmlreader.InputSource() - self._parser = None - self._namespaces = namespaceHandling - self._lex_handler_prop = None - self._parsing = 0 - self._entity_stack = [] - self._external_ges = 1 - self._interning = None - - # XMLReader methods - - def parse(self, source): - "Parse an XML document from a URL or an InputSource." - source = saxutils.prepare_input_source(source) - - self._source = source - self.reset() - self._cont_handler.setDocumentLocator(ExpatLocator(self)) - xmlreader.IncrementalParser.parse(self, source) - - def prepareParser(self, source): - if source.getSystemId() is not None: - base = source.getSystemId() - if isinstance(base, unicode): - base = base.encode('utf-8') - self._parser.SetBase(base) - - # Redefined setContentHandler to allow changing handlers during parsing - - def setContentHandler(self, handler): - xmlreader.IncrementalParser.setContentHandler(self, handler) - if self._parsing: - self._reset_cont_handler() - - def getFeature(self, name): - if name == feature_namespaces: - return self._namespaces - elif name == feature_string_interning: - return self._interning is not None - elif name in (feature_validation, feature_external_pes, - feature_namespace_prefixes): - return 0 - elif name == feature_external_ges: - return self._external_ges - raise SAXNotRecognizedException("Feature '%s' not recognized" % name) - - def setFeature(self, name, state): - if self._parsing: - raise SAXNotSupportedException("Cannot set features while parsing") - - if name == feature_namespaces: - self._namespaces = state - elif name == feature_external_ges: - self._external_ges = state - elif name == feature_string_interning: - if state: - if self._interning is None: - self._interning = {} - else: - self._interning = None - elif name == feature_validation: - if state: - raise SAXNotSupportedException( - "expat does not support validation") - elif name == feature_external_pes: - if state: - raise SAXNotSupportedException( - "expat does not read external parameter entities") - elif name == feature_namespace_prefixes: - if state: - raise SAXNotSupportedException( - "expat does not report namespace prefixes") - else: - raise SAXNotRecognizedException( - "Feature '%s' not recognized" % name) - - def getProperty(self, name): - if name == handler.property_lexical_handler: - return self._lex_handler_prop - elif name == property_interning_dict: - return self._interning - elif name == property_xml_string: - if self._parser: - if hasattr(self._parser, "GetInputContext"): - return self._parser.GetInputContext() - else: - raise SAXNotRecognizedException( - "This version of expat does not support getting" - " the XML string") - else: - raise SAXNotSupportedException( - "XML string cannot be returned when not parsing") - raise SAXNotRecognizedException("Property '%s' not recognized" % name) - - def setProperty(self, name, value): - if name == handler.property_lexical_handler: - self._lex_handler_prop = value - if self._parsing: - self._reset_lex_handler_prop() - elif name == property_interning_dict: - self._interning = value - elif name == property_xml_string: - raise SAXNotSupportedException("Property '%s' cannot be set" % - name) - else: - raise SAXNotRecognizedException("Property '%s' not recognized" % - name) - - # IncrementalParser methods - - def feed(self, data, isFinal = 0): - if not self._parsing: - self.reset() - self._parsing = 1 - self._cont_handler.startDocument() - - try: - # The isFinal parameter is internal to the expat reader. - # If it is set to true, expat will check validity of the entire - # document. When feeding chunks, they are not normally final - - # except when invoked from close. - self._parser.Parse(data, isFinal) - except expat.error, e: - exc = SAXParseException(expat.ErrorString(e.code), e, self) - # FIXME: when to invoke error()? - self._err_handler.fatalError(exc) - - def close(self): - if (self._entity_stack or self._parser is None or - isinstance(self._parser, _ClosedParser)): - # If we are completing an external entity, do nothing here - return - try: - self.feed("", isFinal = 1) - self._cont_handler.endDocument() - self._parsing = 0 - # break cycle created by expat handlers pointing to our methods - self._parser = None - finally: - self._parsing = 0 - if self._parser is not None: - # Keep ErrorColumnNumber and ErrorLineNumber after closing. - parser = _ClosedParser() - parser.ErrorColumnNumber = self._parser.ErrorColumnNumber - parser.ErrorLineNumber = self._parser.ErrorLineNumber - self._parser = parser - - def _reset_cont_handler(self): - self._parser.ProcessingInstructionHandler = \ - self._cont_handler.processingInstruction - self._parser.CharacterDataHandler = self._cont_handler.characters - - def _reset_lex_handler_prop(self): - lex = self._lex_handler_prop - parser = self._parser - if lex is None: - parser.CommentHandler = None - parser.StartCdataSectionHandler = None - parser.EndCdataSectionHandler = None - parser.StartDoctypeDeclHandler = None - parser.EndDoctypeDeclHandler = None - else: - parser.CommentHandler = lex.comment - parser.StartCdataSectionHandler = lex.startCDATA - parser.EndCdataSectionHandler = lex.endCDATA - parser.StartDoctypeDeclHandler = self.start_doctype_decl - parser.EndDoctypeDeclHandler = lex.endDTD - - def reset(self): - if self._namespaces: - self._parser = expat.ParserCreate(self._source.getEncoding(), " ", - intern=self._interning) - self._parser.namespace_prefixes = 1 - self._parser.StartElementHandler = self.start_element_ns - self._parser.EndElementHandler = self.end_element_ns - else: - self._parser = expat.ParserCreate(self._source.getEncoding(), - intern = self._interning) - self._parser.StartElementHandler = self.start_element - self._parser.EndElementHandler = self.end_element - - self._reset_cont_handler() - self._parser.UnparsedEntityDeclHandler = self.unparsed_entity_decl - self._parser.NotationDeclHandler = self.notation_decl - self._parser.StartNamespaceDeclHandler = self.start_namespace_decl - self._parser.EndNamespaceDeclHandler = self.end_namespace_decl - - self._decl_handler_prop = None - if self._lex_handler_prop: - self._reset_lex_handler_prop() -# self._parser.DefaultHandler = -# self._parser.DefaultHandlerExpand = -# self._parser.NotStandaloneHandler = - self._parser.ExternalEntityRefHandler = self.external_entity_ref - try: - self._parser.SkippedEntityHandler = self.skipped_entity_handler - except AttributeError: - # This pyexpat does not support SkippedEntity - pass - self._parser.SetParamEntityParsing( - expat.XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - - self._parsing = 0 - self._entity_stack = [] - - # Locator methods - - def getColumnNumber(self): - if self._parser is None: - return None - return self._parser.ErrorColumnNumber - - def getLineNumber(self): - if self._parser is None: - return 1 - return self._parser.ErrorLineNumber - - def getPublicId(self): - return self._source.getPublicId() - - def getSystemId(self): - return self._source.getSystemId() - - # event handlers - def start_element(self, name, attrs): - self._cont_handler.startElement(name, AttributesImpl(attrs)) - - def end_element(self, name): - self._cont_handler.endElement(name) - - def start_element_ns(self, name, attrs): - pair = name.split() - if len(pair) == 1: - # no namespace - pair = (None, name) - elif len(pair) == 3: - pair = pair[0], pair[1] - else: - # default namespace - pair = tuple(pair) - - newattrs = {} - qnames = {} - for (aname, value) in attrs.items(): - parts = aname.split() - length = len(parts) - if length == 1: - # no namespace - qname = aname - apair = (None, aname) - elif length == 3: - qname = "%s:%s" % (parts[2], parts[1]) - apair = parts[0], parts[1] - else: - # default namespace - qname = parts[1] - apair = tuple(parts) - - newattrs[apair] = value - qnames[apair] = qname - - self._cont_handler.startElementNS(pair, None, - AttributesNSImpl(newattrs, qnames)) - - def end_element_ns(self, name): - pair = name.split() - if len(pair) == 1: - pair = (None, name) - elif len(pair) == 3: - pair = pair[0], pair[1] - else: - pair = tuple(pair) - - self._cont_handler.endElementNS(pair, None) - - # this is not used (call directly to ContentHandler) - def processing_instruction(self, target, data): - self._cont_handler.processingInstruction(target, data) - - # this is not used (call directly to ContentHandler) - def character_data(self, data): - self._cont_handler.characters(data) - - def start_namespace_decl(self, prefix, uri): - self._cont_handler.startPrefixMapping(prefix, uri) - - def end_namespace_decl(self, prefix): - self._cont_handler.endPrefixMapping(prefix) - - def start_doctype_decl(self, name, sysid, pubid, has_internal_subset): - self._lex_handler_prop.startDTD(name, pubid, sysid) - - def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name): - self._dtd_handler.unparsedEntityDecl(name, pubid, sysid, notation_name) - - def notation_decl(self, name, base, sysid, pubid): - self._dtd_handler.notationDecl(name, pubid, sysid) - - def external_entity_ref(self, context, base, sysid, pubid): - if not self._external_ges: - return 1 - - source = self._ent_handler.resolveEntity(pubid, sysid) - source = saxutils.prepare_input_source(source, - self._source.getSystemId() or - "") - - self._entity_stack.append((self._parser, self._source)) - self._parser = self._parser.ExternalEntityParserCreate(context) - self._source = source - - try: - xmlreader.IncrementalParser.parse(self, source) - except: - return 0 # FIXME: save error info here? - - (self._parser, self._source) = self._entity_stack[-1] - del self._entity_stack[-1] - return 1 - - def skipped_entity_handler(self, name, is_pe): - if is_pe: - # The SAX spec requires to report skipped PEs with a '%' - name = '%'+name - self._cont_handler.skippedEntity(name) - -# --- - -def create_parser(*args, **kwargs): - return ExpatParser(*args, **kwargs) - -# --- - -if __name__ == "__main__": - import xml.sax.saxutils - p = create_parser() - p.setContentHandler(xml.sax.saxutils.XMLGenerator()) - p.setErrorHandler(xml.sax.ErrorHandler()) - p.parse("http://www.ibiblio.org/xml/examples/shakespeare/hamlet.xml") diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py deleted file mode 100644 index 378f4f1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/handler.py +++ /dev/null @@ -1,342 +0,0 @@ -""" -This module contains the core classes of version 2.0 of SAX for Python. -This file provides only default classes with absolutely minimum -functionality, from which drivers and applications can be subclassed. - -Many of these classes are empty and are included only as documentation -of the interfaces. - -$Id$ -""" - -version = '2.0beta' - -#============================================================================ -# -# HANDLER INTERFACES -# -#============================================================================ - -# ===== ERRORHANDLER ===== - -class ErrorHandler: - """Basic interface for SAX error handlers. - - If you create an object that implements this interface, then - register the object with your XMLReader, the parser will call the - methods in your object to report all warnings and errors. There - are three levels of errors available: warnings, (possibly) - recoverable errors, and unrecoverable errors. All methods take a - SAXParseException as the only parameter.""" - - def error(self, exception): - "Handle a recoverable error." - raise exception - - def fatalError(self, exception): - "Handle a non-recoverable error." - raise exception - - def warning(self, exception): - "Handle a warning." - print exception - - -# ===== CONTENTHANDLER ===== - -class ContentHandler: - """Interface for receiving logical document content events. - - This is the main callback interface in SAX, and the one most - important to applications. The order of events in this interface - mirrors the order of the information in the document.""" - - def __init__(self): - self._locator = None - - def setDocumentLocator(self, locator): - """Called by the parser to give the application a locator for - locating the origin of document events. - - SAX parsers are strongly encouraged (though not absolutely - required) to supply a locator: if it does so, it must supply - the locator to the application by invoking this method before - invoking any of the other methods in the DocumentHandler - interface. - - The locator allows the application to determine the end - position of any document-related event, even if the parser is - not reporting an error. Typically, the application will use - this information for reporting its own errors (such as - character content that does not match an application's - business rules). The information returned by the locator is - probably not sufficient for use with a search engine. - - Note that the locator will return correct information only - during the invocation of the events in this interface. The - application should not attempt to use it at any other time.""" - self._locator = locator - - def startDocument(self): - """Receive notification of the beginning of a document. - - The SAX parser will invoke this method only once, before any - other methods in this interface or in DTDHandler (except for - setDocumentLocator).""" - - def endDocument(self): - """Receive notification of the end of a document. - - The SAX parser will invoke this method only once, and it will - be the last method invoked during the parse. The parser shall - not invoke this method until it has either abandoned parsing - (because of an unrecoverable error) or reached the end of - input.""" - - def startPrefixMapping(self, prefix, uri): - """Begin the scope of a prefix-URI Namespace mapping. - - The information from this event is not necessary for normal - Namespace processing: the SAX XML reader will automatically - replace prefixes for element and attribute names when the - http://xml.org/sax/features/namespaces feature is true (the - default). - - There are cases, however, when applications need to use - prefixes in character data or in attribute values, where they - cannot safely be expanded automatically; the - start/endPrefixMapping event supplies the information to the - application to expand prefixes in those contexts itself, if - necessary. - - Note that start/endPrefixMapping events are not guaranteed to - be properly nested relative to each-other: all - startPrefixMapping events will occur before the corresponding - startElement event, and all endPrefixMapping events will occur - after the corresponding endElement event, but their order is - not guaranteed.""" - - def endPrefixMapping(self, prefix): - """End the scope of a prefix-URI mapping. - - See startPrefixMapping for details. This event will always - occur after the corresponding endElement event, but the order - of endPrefixMapping events is not otherwise guaranteed.""" - - def startElement(self, name, attrs): - """Signals the start of an element in non-namespace mode. - - The name parameter contains the raw XML 1.0 name of the - element type as a string and the attrs parameter holds an - instance of the Attributes class containing the attributes of - the element.""" - - def endElement(self, name): - """Signals the end of an element in non-namespace mode. - - The name parameter contains the name of the element type, just - as with the startElement event.""" - - def startElementNS(self, name, qname, attrs): - """Signals the start of an element in namespace mode. - - The name parameter contains the name of the element type as a - (uri, localname) tuple, the qname parameter the raw XML 1.0 - name used in the source document, and the attrs parameter - holds an instance of the Attributes class containing the - attributes of the element. - - The uri part of the name tuple is None for elements which have - no namespace.""" - - def endElementNS(self, name, qname): - """Signals the end of an element in namespace mode. - - The name parameter contains the name of the element type, just - as with the startElementNS event.""" - - def characters(self, content): - """Receive notification of character data. - - The Parser will call this method to report each chunk of - character data. SAX parsers may return all contiguous - character data in a single chunk, or they may split it into - several chunks; however, all of the characters in any single - event must come from the same external entity so that the - Locator provides useful information.""" - - def ignorableWhitespace(self, whitespace): - """Receive notification of ignorable whitespace in element content. - - Validating Parsers must use this method to report each chunk - of ignorable whitespace (see the W3C XML 1.0 recommendation, - section 2.10): non-validating parsers may also use this method - if they are capable of parsing and using content models. - - SAX parsers may return all contiguous whitespace in a single - chunk, or they may split it into several chunks; however, all - of the characters in any single event must come from the same - external entity, so that the Locator provides useful - information.""" - - def processingInstruction(self, target, data): - """Receive notification of a processing instruction. - - The Parser will invoke this method once for each processing - instruction found: note that processing instructions may occur - before or after the main document element. - - A SAX parser should never report an XML declaration (XML 1.0, - section 2.8) or a text declaration (XML 1.0, section 4.3.1) - using this method.""" - - def skippedEntity(self, name): - """Receive notification of a skipped entity. - - The Parser will invoke this method once for each entity - skipped. Non-validating processors may skip entities if they - have not seen the declarations (because, for example, the - entity was declared in an external DTD subset). All processors - may skip external entities, depending on the values of the - http://xml.org/sax/features/external-general-entities and the - http://xml.org/sax/features/external-parameter-entities - properties.""" - - -# ===== DTDHandler ===== - -class DTDHandler: - """Handle DTD events. - - This interface specifies only those DTD events required for basic - parsing (unparsed entities and attributes).""" - - def notationDecl(self, name, publicId, systemId): - "Handle a notation declaration event." - - def unparsedEntityDecl(self, name, publicId, systemId, ndata): - "Handle an unparsed entity declaration event." - - -# ===== ENTITYRESOLVER ===== - -class EntityResolver: - """Basic interface for resolving entities. If you create an object - implementing this interface, then register the object with your - Parser, the parser will call the method in your object to - resolve all external entities. Note that DefaultHandler implements - this interface with the default behaviour.""" - - def resolveEntity(self, publicId, systemId): - """Resolve the system identifier of an entity and return either - the system identifier to read from as a string, or an InputSource - to read from.""" - return systemId - - -#============================================================================ -# -# CORE FEATURES -# -#============================================================================ - -feature_namespaces = "http://xml.org/sax/features/namespaces" -# true: Perform Namespace processing (default). -# false: Optionally do not perform Namespace processing -# (implies namespace-prefixes). -# access: (parsing) read-only; (not parsing) read/write - -feature_namespace_prefixes = "http://xml.org/sax/features/namespace-prefixes" -# true: Report the original prefixed names and attributes used for Namespace -# declarations. -# false: Do not report attributes used for Namespace declarations, and -# optionally do not report original prefixed names (default). -# access: (parsing) read-only; (not parsing) read/write - -feature_string_interning = "http://xml.org/sax/features/string-interning" -# true: All element names, prefixes, attribute names, Namespace URIs, and -# local names are interned using the built-in intern function. -# false: Names are not necessarily interned, although they may be (default). -# access: (parsing) read-only; (not parsing) read/write - -feature_validation = "http://xml.org/sax/features/validation" -# true: Report all validation errors (implies external-general-entities and -# external-parameter-entities). -# false: Do not report validation errors. -# access: (parsing) read-only; (not parsing) read/write - -feature_external_ges = "http://xml.org/sax/features/external-general-entities" -# true: Include all external general (text) entities. -# false: Do not include external general entities. -# access: (parsing) read-only; (not parsing) read/write - -feature_external_pes = "http://xml.org/sax/features/external-parameter-entities" -# true: Include all external parameter entities, including the external -# DTD subset. -# false: Do not include any external parameter entities, even the external -# DTD subset. -# access: (parsing) read-only; (not parsing) read/write - -all_features = [feature_namespaces, - feature_namespace_prefixes, - feature_string_interning, - feature_validation, - feature_external_ges, - feature_external_pes] - - -#============================================================================ -# -# CORE PROPERTIES -# -#============================================================================ - -property_lexical_handler = "http://xml.org/sax/properties/lexical-handler" -# data type: xml.sax.sax2lib.LexicalHandler -# description: An optional extension handler for lexical events like comments. -# access: read/write - -property_declaration_handler = "http://xml.org/sax/properties/declaration-handler" -# data type: xml.sax.sax2lib.DeclHandler -# description: An optional extension handler for DTD-related events other -# than notations and unparsed entities. -# access: read/write - -property_dom_node = "http://xml.org/sax/properties/dom-node" -# data type: org.w3c.dom.Node -# description: When parsing, the current DOM node being visited if this is -# a DOM iterator; when not parsing, the root DOM node for -# iteration. -# access: (parsing) read-only; (not parsing) read/write - -property_xml_string = "http://xml.org/sax/properties/xml-string" -# data type: String -# description: The literal string of characters that was the source for -# the current event. -# access: read-only - -property_encoding = "http://www.python.org/sax/properties/encoding" -# data type: String -# description: The name of the encoding to assume for input data. -# access: write: set the encoding, e.g. established by a higher-level -# protocol. May change during parsing (e.g. after -# processing a META tag) -# read: return the current encoding (possibly established through -# auto-detection. -# initial value: UTF-8 -# - -property_interning_dict = "http://www.python.org/sax/properties/interning-dict" -# data type: Dictionary -# description: The dictionary used to intern common strings in the document -# access: write: Request that the parser uses a specific dictionary, to -# allow interning across different documents -# read: return the current interning dictionary, or None -# - -all_properties = [property_lexical_handler, - property_dom_node, - property_declaration_handler, - property_xml_string, - property_encoding, - property_interning_dict] diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py deleted file mode 100644 index 674df6d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/saxutils.py +++ /dev/null @@ -1,353 +0,0 @@ -"""\ -A library of useful helper classes to the SAX classes, for the -convenience of application and driver writers. -""" - -import os, urlparse, urllib, types -import io -import sys -import handler -import xmlreader - -try: - _StringTypes = [types.StringType, types.UnicodeType] -except AttributeError: - _StringTypes = [types.StringType] - -def __dict_replace(s, d): - """Replace substrings of a string using a dictionary.""" - for key, value in d.items(): - s = s.replace(key, value) - return s - -def escape(data, entities={}): - """Escape &, <, and > in a string of data. - - You can escape other strings of data by passing a dictionary as - the optional entities parameter. The keys and values must all be - strings; each key will be replaced with its corresponding value. - """ - - # must do ampersand first - data = data.replace("&", "&") - data = data.replace(">", ">") - data = data.replace("<", "<") - if entities: - data = __dict_replace(data, entities) - return data - -def unescape(data, entities={}): - """Unescape &, <, and > in a string of data. - - You can unescape other strings of data by passing a dictionary as - the optional entities parameter. The keys and values must all be - strings; each key will be replaced with its corresponding value. - """ - data = data.replace("<", "<") - data = data.replace(">", ">") - if entities: - data = __dict_replace(data, entities) - # must do ampersand last - return data.replace("&", "&") - -def quoteattr(data, entities={}): - """Escape and quote an attribute value. - - Escape &, <, and > in a string of data, then quote it for use as - an attribute value. The \" character will be escaped as well, if - necessary. - - You can escape other strings of data by passing a dictionary as - the optional entities parameter. The keys and values must all be - strings; each key will be replaced with its corresponding value. - """ - entities = entities.copy() - entities.update({'\n': ' ', '\r': ' ', '\t':' '}) - data = escape(data, entities) - if '"' in data: - if "'" in data: - data = '"%s"' % data.replace('"', """) - else: - data = "'%s'" % data - else: - data = '"%s"' % data - return data - - -def _gettextwriter(out, encoding): - if out is None: - import sys - out = sys.stdout - - if isinstance(out, io.RawIOBase): - buffer = io.BufferedIOBase(out) - # Keep the original file open when the TextIOWrapper is - # destroyed - buffer.close = lambda: None - else: - # This is to handle passed objects that aren't in the - # IOBase hierarchy, but just have a write method - buffer = io.BufferedIOBase() - buffer.writable = lambda: True - buffer.write = out.write - try: - # TextIOWrapper uses this methods to determine - # if BOM (for UTF-16, etc) should be added - buffer.seekable = out.seekable - buffer.tell = out.tell - except AttributeError: - pass - # wrap a binary writer with TextIOWrapper - return _UnbufferedTextIOWrapper(buffer, encoding=encoding, - errors='xmlcharrefreplace', - newline='\n') - - -class _UnbufferedTextIOWrapper(io.TextIOWrapper): - def write(self, s): - super(_UnbufferedTextIOWrapper, self).write(s) - self.flush() - - -class XMLGenerator(handler.ContentHandler): - - def __init__(self, out=None, encoding="iso-8859-1"): - handler.ContentHandler.__init__(self) - out = _gettextwriter(out, encoding) - self._write = out.write - self._flush = out.flush - self._ns_contexts = [{}] # contains uri -> prefix dicts - self._current_context = self._ns_contexts[-1] - self._undeclared_ns_maps = [] - self._encoding = encoding - - def _qname(self, name): - """Builds a qualified name from a (ns_url, localname) pair""" - if name[0]: - # Per http://www.w3.org/XML/1998/namespace, The 'xml' prefix is - # bound by definition to http://www.w3.org/XML/1998/namespace. It - # does not need to be declared and will not usually be found in - # self._current_context. - if 'http://www.w3.org/XML/1998/namespace' == name[0]: - return 'xml:' + name[1] - # The name is in a non-empty namespace - prefix = self._current_context[name[0]] - if prefix: - # If it is not the default namespace, prepend the prefix - return prefix + ":" + name[1] - # Return the unqualified name - return name[1] - - # ContentHandler methods - - def startDocument(self): - self._write(u'\n' % - self._encoding) - - def endDocument(self): - self._flush() - - def startPrefixMapping(self, prefix, uri): - self._ns_contexts.append(self._current_context.copy()) - self._current_context[uri] = prefix - self._undeclared_ns_maps.append((prefix, uri)) - - def endPrefixMapping(self, prefix): - self._current_context = self._ns_contexts[-1] - del self._ns_contexts[-1] - - def startElement(self, name, attrs): - self._write(u'<' + name) - for (name, value) in attrs.items(): - self._write(u' %s=%s' % (name, quoteattr(value))) - self._write(u'>') - - def endElement(self, name): - self._write(u'' % name) - - def startElementNS(self, name, qname, attrs): - self._write(u'<' + self._qname(name)) - - for prefix, uri in self._undeclared_ns_maps: - if prefix: - self._write(u' xmlns:%s="%s"' % (prefix, uri)) - else: - self._write(u' xmlns="%s"' % uri) - self._undeclared_ns_maps = [] - - for (name, value) in attrs.items(): - self._write(u' %s=%s' % (self._qname(name), quoteattr(value))) - self._write(u'>') - - def endElementNS(self, name, qname): - self._write(u'' % self._qname(name)) - - def characters(self, content): - if not isinstance(content, unicode): - content = unicode(content, self._encoding) - self._write(escape(content)) - - def ignorableWhitespace(self, content): - if not isinstance(content, unicode): - content = unicode(content, self._encoding) - self._write(content) - - def processingInstruction(self, target, data): - self._write(u'' % (target, data)) - - -class XMLFilterBase(xmlreader.XMLReader): - """This class is designed to sit between an XMLReader and the - client application's event handlers. By default, it does nothing - but pass requests up to the reader and events on to the handlers - unmodified, but subclasses can override specific methods to modify - the event stream or the configuration requests as they pass - through.""" - - def __init__(self, parent = None): - xmlreader.XMLReader.__init__(self) - self._parent = parent - - # ErrorHandler methods - - def error(self, exception): - self._err_handler.error(exception) - - def fatalError(self, exception): - self._err_handler.fatalError(exception) - - def warning(self, exception): - self._err_handler.warning(exception) - - # ContentHandler methods - - def setDocumentLocator(self, locator): - self._cont_handler.setDocumentLocator(locator) - - def startDocument(self): - self._cont_handler.startDocument() - - def endDocument(self): - self._cont_handler.endDocument() - - def startPrefixMapping(self, prefix, uri): - self._cont_handler.startPrefixMapping(prefix, uri) - - def endPrefixMapping(self, prefix): - self._cont_handler.endPrefixMapping(prefix) - - def startElement(self, name, attrs): - self._cont_handler.startElement(name, attrs) - - def endElement(self, name): - self._cont_handler.endElement(name) - - def startElementNS(self, name, qname, attrs): - self._cont_handler.startElementNS(name, qname, attrs) - - def endElementNS(self, name, qname): - self._cont_handler.endElementNS(name, qname) - - def characters(self, content): - self._cont_handler.characters(content) - - def ignorableWhitespace(self, chars): - self._cont_handler.ignorableWhitespace(chars) - - def processingInstruction(self, target, data): - self._cont_handler.processingInstruction(target, data) - - def skippedEntity(self, name): - self._cont_handler.skippedEntity(name) - - # DTDHandler methods - - def notationDecl(self, name, publicId, systemId): - self._dtd_handler.notationDecl(name, publicId, systemId) - - def unparsedEntityDecl(self, name, publicId, systemId, ndata): - self._dtd_handler.unparsedEntityDecl(name, publicId, systemId, ndata) - - # EntityResolver methods - - def resolveEntity(self, publicId, systemId): - return self._ent_handler.resolveEntity(publicId, systemId) - - # XMLReader methods - - def parse(self, source): - self._parent.setContentHandler(self) - self._parent.setErrorHandler(self) - self._parent.setEntityResolver(self) - self._parent.setDTDHandler(self) - self._parent.parse(source) - - def setLocale(self, locale): - self._parent.setLocale(locale) - - def getFeature(self, name): - return self._parent.getFeature(name) - - def setFeature(self, name, state): - self._parent.setFeature(name, state) - - def getProperty(self, name): - return self._parent.getProperty(name) - - def setProperty(self, name, value): - self._parent.setProperty(name, value) - - # XMLFilter methods - - def getParent(self): - return self._parent - - def setParent(self, parent): - self._parent = parent - -# --- Utility functions - -def prepare_input_source(source, base = ""): - """This function takes an InputSource and an optional base URL and - returns a fully resolved InputSource object ready for reading.""" - - if type(source) in _StringTypes: - source = xmlreader.InputSource(source) - elif hasattr(source, "read"): - f = source - source = xmlreader.InputSource() - source.setByteStream(f) - if hasattr(f, "name"): - source.setSystemId(f.name) - - if source.getByteStream() is None: - try: - sysid = source.getSystemId() - basehead = os.path.dirname(os.path.normpath(base)) - encoding = sys.getfilesystemencoding() - if isinstance(sysid, unicode): - if not isinstance(basehead, unicode): - try: - basehead = basehead.decode(encoding) - except UnicodeDecodeError: - sysid = sysid.encode(encoding) - else: - if isinstance(basehead, unicode): - try: - sysid = sysid.decode(encoding) - except UnicodeDecodeError: - basehead = basehead.encode(encoding) - sysidfilename = os.path.join(basehead, sysid) - isfile = os.path.isfile(sysidfilename) - except UnicodeError: - isfile = False - if isfile: - source.setSystemId(sysidfilename) - f = open(sysidfilename, "rb") - else: - source.setSystemId(urlparse.urljoin(base, source.getSystemId())) - f = urllib.urlopen(source.getSystemId()) - - source.setByteStream(f) - - return source diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py deleted file mode 100644 index 05f2506..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xml/sax/xmlreader.py +++ /dev/null @@ -1,381 +0,0 @@ -"""An XML Reader is the SAX 2 name for an XML parser. XML Parsers -should be based on this code. """ - -import handler - -from _exceptions import SAXNotSupportedException, SAXNotRecognizedException - - -# ===== XMLREADER ===== - -class XMLReader: - """Interface for reading an XML document using callbacks. - - XMLReader is the interface that an XML parser's SAX2 driver must - implement. This interface allows an application to set and query - features and properties in the parser, to register event handlers - for document processing, and to initiate a document parse. - - All SAX interfaces are assumed to be synchronous: the parse - methods must not return until parsing is complete, and readers - must wait for an event-handler callback to return before reporting - the next event.""" - - def __init__(self): - self._cont_handler = handler.ContentHandler() - self._dtd_handler = handler.DTDHandler() - self._ent_handler = handler.EntityResolver() - self._err_handler = handler.ErrorHandler() - - def parse(self, source): - "Parse an XML document from a system identifier or an InputSource." - raise NotImplementedError("This method must be implemented!") - - def getContentHandler(self): - "Returns the current ContentHandler." - return self._cont_handler - - def setContentHandler(self, handler): - "Registers a new object to receive document content events." - self._cont_handler = handler - - def getDTDHandler(self): - "Returns the current DTD handler." - return self._dtd_handler - - def setDTDHandler(self, handler): - "Register an object to receive basic DTD-related events." - self._dtd_handler = handler - - def getEntityResolver(self): - "Returns the current EntityResolver." - return self._ent_handler - - def setEntityResolver(self, resolver): - "Register an object to resolve external entities." - self._ent_handler = resolver - - def getErrorHandler(self): - "Returns the current ErrorHandler." - return self._err_handler - - def setErrorHandler(self, handler): - "Register an object to receive error-message events." - self._err_handler = handler - - def setLocale(self, locale): - """Allow an application to set the locale for errors and warnings. - - SAX parsers are not required to provide localization for errors - and warnings; if they cannot support the requested locale, - however, they must raise a SAX exception. Applications may - request a locale change in the middle of a parse.""" - raise SAXNotSupportedException("Locale support not implemented") - - def getFeature(self, name): - "Looks up and returns the state of a SAX2 feature." - raise SAXNotRecognizedException("Feature '%s' not recognized" % name) - - def setFeature(self, name, state): - "Sets the state of a SAX2 feature." - raise SAXNotRecognizedException("Feature '%s' not recognized" % name) - - def getProperty(self, name): - "Looks up and returns the value of a SAX2 property." - raise SAXNotRecognizedException("Property '%s' not recognized" % name) - - def setProperty(self, name, value): - "Sets the value of a SAX2 property." - raise SAXNotRecognizedException("Property '%s' not recognized" % name) - -class IncrementalParser(XMLReader): - """This interface adds three extra methods to the XMLReader - interface that allow XML parsers to support incremental - parsing. Support for this interface is optional, since not all - underlying XML parsers support this functionality. - - When the parser is instantiated it is ready to begin accepting - data from the feed method immediately. After parsing has been - finished with a call to close the reset method must be called to - make the parser ready to accept new data, either from feed or - using the parse method. - - Note that these methods must _not_ be called during parsing, that - is, after parse has been called and before it returns. - - By default, the class also implements the parse method of the XMLReader - interface using the feed, close and reset methods of the - IncrementalParser interface as a convenience to SAX 2.0 driver - writers.""" - - def __init__(self, bufsize=2**16): - self._bufsize = bufsize - XMLReader.__init__(self) - - def parse(self, source): - import saxutils - source = saxutils.prepare_input_source(source) - - self.prepareParser(source) - file = source.getByteStream() - buffer = file.read(self._bufsize) - while buffer != "": - self.feed(buffer) - buffer = file.read(self._bufsize) - self.close() - - def feed(self, data): - """This method gives the raw XML data in the data parameter to - the parser and makes it parse the data, emitting the - corresponding events. It is allowed for XML constructs to be - split across several calls to feed. - - feed may raise SAXException.""" - raise NotImplementedError("This method must be implemented!") - - def prepareParser(self, source): - """This method is called by the parse implementation to allow - the SAX 2.0 driver to prepare itself for parsing.""" - raise NotImplementedError("prepareParser must be overridden!") - - def close(self): - """This method is called when the entire XML document has been - passed to the parser through the feed method, to notify the - parser that there are no more data. This allows the parser to - do the final checks on the document and empty the internal - data buffer. - - The parser will not be ready to parse another document until - the reset method has been called. - - close may raise SAXException.""" - raise NotImplementedError("This method must be implemented!") - - def reset(self): - """This method is called after close has been called to reset - the parser so that it is ready to parse new documents. The - results of calling parse or feed after close without calling - reset are undefined.""" - raise NotImplementedError("This method must be implemented!") - -# ===== LOCATOR ===== - -class Locator: - """Interface for associating a SAX event with a document - location. A locator object will return valid results only during - calls to DocumentHandler methods; at any other time, the - results are unpredictable.""" - - def getColumnNumber(self): - "Return the column number where the current event ends." - return -1 - - def getLineNumber(self): - "Return the line number where the current event ends." - return -1 - - def getPublicId(self): - "Return the public identifier for the current event." - return None - - def getSystemId(self): - "Return the system identifier for the current event." - return None - -# ===== INPUTSOURCE ===== - -class InputSource: - """Encapsulation of the information needed by the XMLReader to - read entities. - - This class may include information about the public identifier, - system identifier, byte stream (possibly with character encoding - information) and/or the character stream of an entity. - - Applications will create objects of this class for use in the - XMLReader.parse method and for returning from - EntityResolver.resolveEntity. - - An InputSource belongs to the application, the XMLReader is not - allowed to modify InputSource objects passed to it from the - application, although it may make copies and modify those.""" - - def __init__(self, system_id = None): - self.__system_id = system_id - self.__public_id = None - self.__encoding = None - self.__bytefile = None - self.__charfile = None - - def setPublicId(self, public_id): - "Sets the public identifier of this InputSource." - self.__public_id = public_id - - def getPublicId(self): - "Returns the public identifier of this InputSource." - return self.__public_id - - def setSystemId(self, system_id): - "Sets the system identifier of this InputSource." - self.__system_id = system_id - - def getSystemId(self): - "Returns the system identifier of this InputSource." - return self.__system_id - - def setEncoding(self, encoding): - """Sets the character encoding of this InputSource. - - The encoding must be a string acceptable for an XML encoding - declaration (see section 4.3.3 of the XML recommendation). - - The encoding attribute of the InputSource is ignored if the - InputSource also contains a character stream.""" - self.__encoding = encoding - - def getEncoding(self): - "Get the character encoding of this InputSource." - return self.__encoding - - def setByteStream(self, bytefile): - """Set the byte stream (a Python file-like object which does - not perform byte-to-character conversion) for this input - source. - - The SAX parser will ignore this if there is also a character - stream specified, but it will use a byte stream in preference - to opening a URI connection itself. - - If the application knows the character encoding of the byte - stream, it should set it with the setEncoding method.""" - self.__bytefile = bytefile - - def getByteStream(self): - """Get the byte stream for this input source. - - The getEncoding method will return the character encoding for - this byte stream, or None if unknown.""" - return self.__bytefile - - def setCharacterStream(self, charfile): - """Set the character stream for this input source. (The stream - must be a Python 2.0 Unicode-wrapped file-like that performs - conversion to Unicode strings.) - - If there is a character stream specified, the SAX parser will - ignore any byte stream and will not attempt to open a URI - connection to the system identifier.""" - self.__charfile = charfile - - def getCharacterStream(self): - "Get the character stream for this input source." - return self.__charfile - -# ===== ATTRIBUTESIMPL ===== - -class AttributesImpl: - - def __init__(self, attrs): - """Non-NS-aware implementation. - - attrs should be of the form {name : value}.""" - self._attrs = attrs - - def getLength(self): - return len(self._attrs) - - def getType(self, name): - return "CDATA" - - def getValue(self, name): - return self._attrs[name] - - def getValueByQName(self, name): - return self._attrs[name] - - def getNameByQName(self, name): - if not name in self._attrs: - raise KeyError, name - return name - - def getQNameByName(self, name): - if not name in self._attrs: - raise KeyError, name - return name - - def getNames(self): - return self._attrs.keys() - - def getQNames(self): - return self._attrs.keys() - - def __len__(self): - return len(self._attrs) - - def __getitem__(self, name): - return self._attrs[name] - - def keys(self): - return self._attrs.keys() - - def has_key(self, name): - return name in self._attrs - - def __contains__(self, name): - return name in self._attrs - - def get(self, name, alternative=None): - return self._attrs.get(name, alternative) - - def copy(self): - return self.__class__(self._attrs) - - def items(self): - return self._attrs.items() - - def values(self): - return self._attrs.values() - -# ===== ATTRIBUTESNSIMPL ===== - -class AttributesNSImpl(AttributesImpl): - - def __init__(self, attrs, qnames): - """NS-aware implementation. - - attrs should be of the form {(ns_uri, lname): value, ...}. - qnames of the form {(ns_uri, lname): qname, ...}.""" - self._attrs = attrs - self._qnames = qnames - - def getValueByQName(self, name): - for (nsname, qname) in self._qnames.items(): - if qname == name: - return self._attrs[nsname] - - raise KeyError, name - - def getNameByQName(self, name): - for (nsname, qname) in self._qnames.items(): - if qname == name: - return nsname - - raise KeyError, name - - def getQNameByName(self, name): - return self._qnames[name] - - def getQNames(self): - return self._qnames.values() - - def copy(self): - return self.__class__(self._attrs, self._qnames) - - -def _test(): - XMLReader() - IncrementalParser() - Locator() - -if __name__ == "__main__": - _test() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py b/AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py deleted file mode 100644 index 79cd9c3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Lib/xmllib.py +++ /dev/null @@ -1,930 +0,0 @@ -"""A parser for XML, using the derived class as static DTD.""" - -# Author: Sjoerd Mullender. - -import re -import string - -import warnings -warnings.warn("The xmllib module is obsolete. Use xml.sax instead.", - DeprecationWarning, 2) -del warnings - -version = '0.3' - -class Error(RuntimeError): - pass - -# Regular expressions used for parsing - -_S = '[ \t\r\n]+' # white space -_opS = '[ \t\r\n]*' # optional white space -_Name = '[a-zA-Z_:][-a-zA-Z0-9._:]*' # valid XML name -_QStr = "(?:'[^']*'|\"[^\"]*\")" # quoted XML string -illegal = re.compile('[^\t\r\n -\176\240-\377]') # illegal chars in content -interesting = re.compile('[]&<]') - -amp = re.compile('&') -ref = re.compile('&(' + _Name + '|#[0-9]+|#x[0-9a-fA-F]+)[^-a-zA-Z0-9._:]') -entityref = re.compile('&(?P' + _Name + ')[^-a-zA-Z0-9._:]') -charref = re.compile('&#(?P[0-9]+[^0-9]|x[0-9a-fA-F]+[^0-9a-fA-F])') -space = re.compile(_S + '$') -newline = re.compile('\n') - -attrfind = re.compile( - _S + '(?P' + _Name + ')' - '(' + _opS + '=' + _opS + - '(?P'+_QStr+'|[-a-zA-Z0-9.:+*%?!\(\)_#=~]+))?') -starttagopen = re.compile('<' + _Name) -starttagend = re.compile(_opS + '(?P/?)>') -starttagmatch = re.compile('<(?P'+_Name+')' - '(?P(?:'+attrfind.pattern+')*)'+ - starttagend.pattern) -endtagopen = re.compile('') -endbracketfind = re.compile('(?:[^>\'"]|'+_QStr+')*>') -tagfind = re.compile(_Name) -cdataopen = re.compile(r'') -# this matches one of the following: -# SYSTEM SystemLiteral -# PUBLIC PubidLiteral SystemLiteral -_SystemLiteral = '(?P<%s>'+_QStr+')' -_PublicLiteral = '(?P<%s>"[-\'\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*"|' \ - "'[-\(\)+,./:=?;!*#@$_%% \n\ra-zA-Z0-9]*')" -_ExternalId = '(?:SYSTEM|' \ - 'PUBLIC'+_S+_PublicLiteral%'pubid'+ \ - ')'+_S+_SystemLiteral%'syslit' -doctype = re.compile(''+_Name+')' - '(?:'+_S+_ExternalId+')?'+_opS) -xmldecl = re.compile('<\?xml'+_S+ - 'version'+_opS+'='+_opS+'(?P'+_QStr+')'+ - '(?:'+_S+'encoding'+_opS+'='+_opS+ - "(?P'[A-Za-z][-A-Za-z0-9._]*'|" - '"[A-Za-z][-A-Za-z0-9._]*"))?' - '(?:'+_S+'standalone'+_opS+'='+_opS+ - '(?P\'(?:yes|no)\'|"(?:yes|no)"))?'+ - _opS+'\?>') -procopen = re.compile(r'<\?(?P' + _Name + ')' + _opS) -procclose = re.compile(_opS + r'\?>') -commentopen = re.compile('') -doubledash = re.compile('--') -attrtrans = string.maketrans(' \r\n\t', ' ') - -# definitions for XML namespaces -_NCName = '[a-zA-Z_][-a-zA-Z0-9._]*' # XML Name, minus the ":" -ncname = re.compile(_NCName + '$') -qname = re.compile('(?:(?P' + _NCName + '):)?' # optional prefix - '(?P' + _NCName + ')$') - -xmlns = re.compile('xmlns(?::(?P'+_NCName+'))?$') - -# XML parser base class -- find tags and call handler functions. -# Usage: p = XMLParser(); p.feed(data); ...; p.close(). -# The dtd is defined by deriving a class which defines methods with -# special names to handle tags: start_foo and end_foo to handle -# and , respectively. The data between tags is passed to the -# parser by calling self.handle_data() with some data as argument (the -# data may be split up in arbitrary chunks). - -class XMLParser: - attributes = {} # default, to be overridden - elements = {} # default, to be overridden - - # parsing options, settable using keyword args in __init__ - __accept_unquoted_attributes = 0 - __accept_missing_endtag_name = 0 - __map_case = 0 - __accept_utf8 = 0 - __translate_attribute_references = 1 - - # Interface -- initialize and reset this instance - def __init__(self, **kw): - self.__fixed = 0 - if 'accept_unquoted_attributes' in kw: - self.__accept_unquoted_attributes = kw['accept_unquoted_attributes'] - if 'accept_missing_endtag_name' in kw: - self.__accept_missing_endtag_name = kw['accept_missing_endtag_name'] - if 'map_case' in kw: - self.__map_case = kw['map_case'] - if 'accept_utf8' in kw: - self.__accept_utf8 = kw['accept_utf8'] - if 'translate_attribute_references' in kw: - self.__translate_attribute_references = kw['translate_attribute_references'] - self.reset() - - def __fixelements(self): - self.__fixed = 1 - self.elements = {} - self.__fixdict(self.__dict__) - self.__fixclass(self.__class__) - - def __fixclass(self, kl): - self.__fixdict(kl.__dict__) - for k in kl.__bases__: - self.__fixclass(k) - - def __fixdict(self, dict): - for key in dict.keys(): - if key[:6] == 'start_': - tag = key[6:] - start, end = self.elements.get(tag, (None, None)) - if start is None: - self.elements[tag] = getattr(self, key), end - elif key[:4] == 'end_': - tag = key[4:] - start, end = self.elements.get(tag, (None, None)) - if end is None: - self.elements[tag] = start, getattr(self, key) - - # Interface -- reset this instance. Loses all unprocessed data - def reset(self): - self.rawdata = '' - self.stack = [] - self.nomoretags = 0 - self.literal = 0 - self.lineno = 1 - self.__at_start = 1 - self.__seen_doctype = None - self.__seen_starttag = 0 - self.__use_namespaces = 0 - self.__namespaces = {'xml':None} # xml is implicitly declared - # backward compatibility hack: if elements not overridden, - # fill it in ourselves - if self.elements is XMLParser.elements: - self.__fixelements() - - # For derived classes only -- enter literal mode (CDATA) till EOF - def setnomoretags(self): - self.nomoretags = self.literal = 1 - - # For derived classes only -- enter literal mode (CDATA) - def setliteral(self, *args): - self.literal = 1 - - # Interface -- feed some data to the parser. Call this as - # often as you want, with as little or as much text as you - # want (may include '\n'). (This just saves the text, all the - # processing is done by goahead().) - def feed(self, data): - self.rawdata = self.rawdata + data - self.goahead(0) - - # Interface -- handle the remaining data - def close(self): - self.goahead(1) - if self.__fixed: - self.__fixed = 0 - # remove self.elements so that we don't leak - del self.elements - - # Interface -- translate references - def translate_references(self, data, all = 1): - if not self.__translate_attribute_references: - return data - i = 0 - while 1: - res = amp.search(data, i) - if res is None: - return data - s = res.start(0) - res = ref.match(data, s) - if res is None: - self.syntax_error("bogus `&'") - i = s+1 - continue - i = res.end(0) - str = res.group(1) - rescan = 0 - if str[0] == '#': - if str[1] == 'x': - str = chr(int(str[2:], 16)) - else: - str = chr(int(str[1:])) - if data[i - 1] != ';': - self.syntax_error("`;' missing after char reference") - i = i-1 - elif all: - if str in self.entitydefs: - str = self.entitydefs[str] - rescan = 1 - elif data[i - 1] != ';': - self.syntax_error("bogus `&'") - i = s + 1 # just past the & - continue - else: - self.syntax_error("reference to unknown entity `&%s;'" % str) - str = '&' + str + ';' - elif data[i - 1] != ';': - self.syntax_error("bogus `&'") - i = s + 1 # just past the & - continue - - # when we get here, str contains the translated text and i points - # to the end of the string that is to be replaced - data = data[:s] + str + data[i:] - if rescan: - i = s - else: - i = s + len(str) - - # Interface - return a dictionary of all namespaces currently valid - def getnamespace(self): - nsdict = {} - for t, d, nst in self.stack: - nsdict.update(d) - return nsdict - - # Internal -- handle data as far as reasonable. May leave state - # and data to be processed by a subsequent call. If 'end' is - # true, force handling all data as if followed by EOF marker. - def goahead(self, end): - rawdata = self.rawdata - i = 0 - n = len(rawdata) - while i < n: - if i > 0: - self.__at_start = 0 - if self.nomoretags: - data = rawdata[i:n] - self.handle_data(data) - self.lineno = self.lineno + data.count('\n') - i = n - break - res = interesting.search(rawdata, i) - if res: - j = res.start(0) - else: - j = n - if i < j: - data = rawdata[i:j] - if self.__at_start and space.match(data) is None: - self.syntax_error('illegal data at start of file') - self.__at_start = 0 - if not self.stack and space.match(data) is None: - self.syntax_error('data not in content') - if not self.__accept_utf8 and illegal.search(data): - self.syntax_error('illegal character in content') - self.handle_data(data) - self.lineno = self.lineno + data.count('\n') - i = j - if i == n: break - if rawdata[i] == '<': - if starttagopen.match(rawdata, i): - if self.literal: - data = rawdata[i] - self.handle_data(data) - self.lineno = self.lineno + data.count('\n') - i = i+1 - continue - k = self.parse_starttag(i) - if k < 0: break - self.__seen_starttag = 1 - self.lineno = self.lineno + rawdata[i:k].count('\n') - i = k - continue - if endtagopen.match(rawdata, i): - k = self.parse_endtag(i) - if k < 0: break - self.lineno = self.lineno + rawdata[i:k].count('\n') - i = k - continue - if commentopen.match(rawdata, i): - if self.literal: - data = rawdata[i] - self.handle_data(data) - self.lineno = self.lineno + data.count('\n') - i = i+1 - continue - k = self.parse_comment(i) - if k < 0: break - self.lineno = self.lineno + rawdata[i:k].count('\n') - i = k - continue - if cdataopen.match(rawdata, i): - k = self.parse_cdata(i) - if k < 0: break - self.lineno = self.lineno + rawdata[i:k].count('\n') - i = k - continue - res = xmldecl.match(rawdata, i) - if res: - if not self.__at_start: - self.syntax_error(" declaration not at start of document") - version, encoding, standalone = res.group('version', - 'encoding', - 'standalone') - if version[1:-1] != '1.0': - raise Error('only XML version 1.0 supported') - if encoding: encoding = encoding[1:-1] - if standalone: standalone = standalone[1:-1] - self.handle_xml(encoding, standalone) - i = res.end(0) - continue - res = procopen.match(rawdata, i) - if res: - k = self.parse_proc(i) - if k < 0: break - self.lineno = self.lineno + rawdata[i:k].count('\n') - i = k - continue - res = doctype.match(rawdata, i) - if res: - if self.literal: - data = rawdata[i] - self.handle_data(data) - self.lineno = self.lineno + data.count('\n') - i = i+1 - continue - if self.__seen_doctype: - self.syntax_error('multiple DOCTYPE elements') - if self.__seen_starttag: - self.syntax_error('DOCTYPE not at beginning of document') - k = self.parse_doctype(res) - if k < 0: break - self.__seen_doctype = res.group('name') - if self.__map_case: - self.__seen_doctype = self.__seen_doctype.lower() - self.lineno = self.lineno + rawdata[i:k].count('\n') - i = k - continue - elif rawdata[i] == '&': - if self.literal: - data = rawdata[i] - self.handle_data(data) - i = i+1 - continue - res = charref.match(rawdata, i) - if res is not None: - i = res.end(0) - if rawdata[i-1] != ';': - self.syntax_error("`;' missing in charref") - i = i-1 - if not self.stack: - self.syntax_error('data not in content') - self.handle_charref(res.group('char')[:-1]) - self.lineno = self.lineno + res.group(0).count('\n') - continue - res = entityref.match(rawdata, i) - if res is not None: - i = res.end(0) - if rawdata[i-1] != ';': - self.syntax_error("`;' missing in entityref") - i = i-1 - name = res.group('name') - if self.__map_case: - name = name.lower() - if name in self.entitydefs: - self.rawdata = rawdata = rawdata[:res.start(0)] + self.entitydefs[name] + rawdata[i:] - n = len(rawdata) - i = res.start(0) - else: - self.unknown_entityref(name) - self.lineno = self.lineno + res.group(0).count('\n') - continue - elif rawdata[i] == ']': - if self.literal: - data = rawdata[i] - self.handle_data(data) - i = i+1 - continue - if n-i < 3: - break - if cdataclose.match(rawdata, i): - self.syntax_error("bogus `]]>'") - self.handle_data(rawdata[i]) - i = i+1 - continue - else: - raise Error('neither < nor & ??') - # We get here only if incomplete matches but - # nothing else - break - # end while - if i > 0: - self.__at_start = 0 - if end and i < n: - data = rawdata[i] - self.syntax_error("bogus `%s'" % data) - if not self.__accept_utf8 and illegal.search(data): - self.syntax_error('illegal character in content') - self.handle_data(data) - self.lineno = self.lineno + data.count('\n') - self.rawdata = rawdata[i+1:] - return self.goahead(end) - self.rawdata = rawdata[i:] - if end: - if not self.__seen_starttag: - self.syntax_error('no elements in file') - if self.stack: - self.syntax_error('missing end tags') - while self.stack: - self.finish_endtag(self.stack[-1][0]) - - # Internal -- parse comment, return length or -1 if not terminated - def parse_comment(self, i): - rawdata = self.rawdata - if rawdata[i:i+4] != ' deque object\n\ -\n\ -Build an ordered collection with optimized access from its endpoints."); - -static PyTypeObject deque_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "collections.deque", /* tp_name */ - sizeof(dequeobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)deque_dealloc, /* tp_dealloc */ - deque_tp_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - deque_repr, /* tp_repr */ - 0, /* tp_as_number */ - &deque_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)PyObject_HashNotImplemented, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - deque_doc, /* tp_doc */ - (traverseproc)deque_traverse, /* tp_traverse */ - (inquiry)deque_clear, /* tp_clear */ - (richcmpfunc)deque_richcompare, /* tp_richcompare */ - offsetof(dequeobject, weakreflist), /* tp_weaklistoffset*/ - (getiterfunc)deque_iter, /* tp_iter */ - 0, /* tp_iternext */ - deque_methods, /* tp_methods */ - 0, /* tp_members */ - deque_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)deque_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - deque_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/*********************** Deque Iterator **************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t index; - block *b; - dequeobject *deque; - long state; /* state when the iterator is created */ - Py_ssize_t counter; /* number of items remaining for iteration */ -} dequeiterobject; - -static PyTypeObject dequeiter_type; - -static PyObject * -deque_iter(dequeobject *deque) -{ - dequeiterobject *it; - - it = PyObject_GC_New(dequeiterobject, &dequeiter_type); - if (it == NULL) - return NULL; - it->b = deque->leftblock; - it->index = deque->leftindex; - Py_INCREF(deque); - it->deque = deque; - it->state = deque->state; - it->counter = deque->len; - PyObject_GC_Track(it); - return (PyObject *)it; -} - -static int -dequeiter_traverse(dequeiterobject *dio, visitproc visit, void *arg) -{ - Py_VISIT(dio->deque); - return 0; -} - -static void -dequeiter_dealloc(dequeiterobject *dio) -{ - Py_XDECREF(dio->deque); - PyObject_GC_Del(dio); -} - -static PyObject * -dequeiter_next(dequeiterobject *it) -{ - PyObject *item; - - if (it->deque->state != it->state) { - it->counter = 0; - PyErr_SetString(PyExc_RuntimeError, - "deque mutated during iteration"); - return NULL; - } - if (it->counter == 0) - return NULL; - assert (!(it->b == it->deque->rightblock && - it->index > it->deque->rightindex)); - - item = it->b->data[it->index]; - it->index++; - it->counter--; - if (it->index == BLOCKLEN && it->counter > 0) { - assert (it->b->rightlink != NULL); - it->b = it->b->rightlink; - it->index = 0; - } - Py_INCREF(item); - return item; -} - -static PyObject * -dequeiter_len(dequeiterobject *it) -{ - return PyInt_FromLong(it->counter); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef dequeiter_methods[] = { - {"__length_hint__", (PyCFunction)dequeiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject dequeiter_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "deque_iterator", /* tp_name */ - sizeof(dequeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dequeiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dequeiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dequeiter_next, /* tp_iternext */ - dequeiter_methods, /* tp_methods */ - 0, -}; - -/*********************** Deque Reverse Iterator **************************/ - -static PyTypeObject dequereviter_type; - -static PyObject * -deque_reviter(dequeobject *deque) -{ - dequeiterobject *it; - - it = PyObject_GC_New(dequeiterobject, &dequereviter_type); - if (it == NULL) - return NULL; - it->b = deque->rightblock; - it->index = deque->rightindex; - Py_INCREF(deque); - it->deque = deque; - it->state = deque->state; - it->counter = deque->len; - PyObject_GC_Track(it); - return (PyObject *)it; -} - -static PyObject * -dequereviter_next(dequeiterobject *it) -{ - PyObject *item; - if (it->counter == 0) - return NULL; - - if (it->deque->state != it->state) { - it->counter = 0; - PyErr_SetString(PyExc_RuntimeError, - "deque mutated during iteration"); - return NULL; - } - assert (!(it->b == it->deque->leftblock && - it->index < it->deque->leftindex)); - - item = it->b->data[it->index]; - it->index--; - it->counter--; - if (it->index == -1 && it->counter > 0) { - assert (it->b->leftlink != NULL); - it->b = it->b->leftlink; - it->index = BLOCKLEN - 1; - } - Py_INCREF(item); - return item; -} - -static PyTypeObject dequereviter_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "deque_reverse_iterator", /* tp_name */ - sizeof(dequeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dequeiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dequeiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dequereviter_next, /* tp_iternext */ - dequeiter_methods, /* tp_methods */ - 0, -}; - -/* defaultdict type *********************************************************/ - -typedef struct { - PyDictObject dict; - PyObject *default_factory; -} defdictobject; - -static PyTypeObject defdict_type; /* Forward */ - -PyDoc_STRVAR(defdict_missing_doc, -"__missing__(key) # Called by __getitem__ for missing key; pseudo-code:\n\ - if self.default_factory is None: raise KeyError((key,))\n\ - self[key] = value = self.default_factory()\n\ - return value\n\ -"); - -static PyObject * -defdict_missing(defdictobject *dd, PyObject *key) -{ - PyObject *factory = dd->default_factory; - PyObject *value; - if (factory == NULL || factory == Py_None) { - /* XXX Call dict.__missing__(key) */ - PyObject *tup; - tup = PyTuple_Pack(1, key); - if (!tup) return NULL; - PyErr_SetObject(PyExc_KeyError, tup); - Py_DECREF(tup); - return NULL; - } - value = PyEval_CallObject(factory, NULL); - if (value == NULL) - return value; - if (PyObject_SetItem((PyObject *)dd, key, value) < 0) { - Py_DECREF(value); - return NULL; - } - return value; -} - -PyDoc_STRVAR(defdict_copy_doc, "D.copy() -> a shallow copy of D."); - -static PyObject * -defdict_copy(defdictobject *dd) -{ - /* This calls the object's class. That only works for subclasses - whose class constructor has the same signature. Subclasses that - define a different constructor signature must override copy(). - */ - - if (dd->default_factory == NULL) - return PyObject_CallFunctionObjArgs((PyObject*)Py_TYPE(dd), Py_None, dd, NULL); - return PyObject_CallFunctionObjArgs((PyObject*)Py_TYPE(dd), - dd->default_factory, dd, NULL); -} - -static PyObject * -defdict_reduce(defdictobject *dd) -{ - /* __reduce__ must return a 5-tuple as follows: - - - factory function - - tuple of args for the factory function - - additional state (here None) - - sequence iterator (here None) - - dictionary iterator (yielding successive (key, value) pairs - - This API is used by pickle.py and copy.py. - - For this to be useful with pickle.py, the default_factory - must be picklable; e.g., None, a built-in, or a global - function in a module or package. - - Both shallow and deep copying are supported, but for deep - copying, the default_factory must be deep-copyable; e.g. None, - or a built-in (functions are not copyable at this time). - - This only works for subclasses as long as their constructor - signature is compatible; the first argument must be the - optional default_factory, defaulting to None. - */ - PyObject *args; - PyObject *items; - PyObject *result; - if (dd->default_factory == NULL || dd->default_factory == Py_None) - args = PyTuple_New(0); - else - args = PyTuple_Pack(1, dd->default_factory); - if (args == NULL) - return NULL; - items = PyObject_CallMethod((PyObject *)dd, "iteritems", "()"); - if (items == NULL) { - Py_DECREF(args); - return NULL; - } - result = PyTuple_Pack(5, Py_TYPE(dd), args, - Py_None, Py_None, items); - Py_DECREF(items); - Py_DECREF(args); - return result; -} - -static PyMethodDef defdict_methods[] = { - {"__missing__", (PyCFunction)defdict_missing, METH_O, - defdict_missing_doc}, - {"copy", (PyCFunction)defdict_copy, METH_NOARGS, - defdict_copy_doc}, - {"__copy__", (PyCFunction)defdict_copy, METH_NOARGS, - defdict_copy_doc}, - {"__reduce__", (PyCFunction)defdict_reduce, METH_NOARGS, - reduce_doc}, - {NULL} -}; - -static PyMemberDef defdict_members[] = { - {"default_factory", T_OBJECT, - offsetof(defdictobject, default_factory), 0, - PyDoc_STR("Factory for default value called by __missing__().")}, - {NULL} -}; - -static void -defdict_dealloc(defdictobject *dd) -{ - Py_CLEAR(dd->default_factory); - PyDict_Type.tp_dealloc((PyObject *)dd); -} - -static int -defdict_print(defdictobject *dd, FILE *fp, int flags) -{ - int sts; - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "defaultdict("); - Py_END_ALLOW_THREADS - if (dd->default_factory == NULL) { - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "None"); - Py_END_ALLOW_THREADS - } else { - PyObject_Print(dd->default_factory, fp, 0); - } - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ", "); - Py_END_ALLOW_THREADS - sts = PyDict_Type.tp_print((PyObject *)dd, fp, 0); - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ")"); - Py_END_ALLOW_THREADS - return sts; -} - -static PyObject * -defdict_repr(defdictobject *dd) -{ - PyObject *defrepr; - PyObject *baserepr; - PyObject *result; - baserepr = PyDict_Type.tp_repr((PyObject *)dd); - if (baserepr == NULL) - return NULL; - if (dd->default_factory == NULL) - defrepr = PyString_FromString("None"); - else - { - int status = Py_ReprEnter(dd->default_factory); - if (status != 0) { - if (status < 0) { - Py_DECREF(baserepr); - return NULL; - } - defrepr = PyString_FromString("..."); - } - else - defrepr = PyObject_Repr(dd->default_factory); - Py_ReprLeave(dd->default_factory); - } - if (defrepr == NULL) { - Py_DECREF(baserepr); - return NULL; - } - result = PyString_FromFormat("defaultdict(%s, %s)", - PyString_AS_STRING(defrepr), - PyString_AS_STRING(baserepr)); - Py_DECREF(defrepr); - Py_DECREF(baserepr); - return result; -} - -static int -defdict_traverse(PyObject *self, visitproc visit, void *arg) -{ - Py_VISIT(((defdictobject *)self)->default_factory); - return PyDict_Type.tp_traverse(self, visit, arg); -} - -static int -defdict_tp_clear(defdictobject *dd) -{ - Py_CLEAR(dd->default_factory); - return PyDict_Type.tp_clear((PyObject *)dd); -} - -static int -defdict_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - defdictobject *dd = (defdictobject *)self; - PyObject *olddefault = dd->default_factory; - PyObject *newdefault = NULL; - PyObject *newargs; - int result; - if (args == NULL || !PyTuple_Check(args)) - newargs = PyTuple_New(0); - else { - Py_ssize_t n = PyTuple_GET_SIZE(args); - if (n > 0) { - newdefault = PyTuple_GET_ITEM(args, 0); - if (!PyCallable_Check(newdefault) && newdefault != Py_None) { - PyErr_SetString(PyExc_TypeError, - "first argument must be callable"); - return -1; - } - } - newargs = PySequence_GetSlice(args, 1, n); - } - if (newargs == NULL) - return -1; - Py_XINCREF(newdefault); - dd->default_factory = newdefault; - result = PyDict_Type.tp_init(self, newargs, kwds); - Py_DECREF(newargs); - Py_XDECREF(olddefault); - return result; -} - -PyDoc_STRVAR(defdict_doc, -"defaultdict(default_factory[, ...]) --> dict with default factory\n\ -\n\ -The default factory is called without arguments to produce\n\ -a new value when a key is not present, in __getitem__ only.\n\ -A defaultdict compares equal to a dict with the same items.\n\ -All remaining arguments are treated the same as if they were\n\ -passed to the dict constructor, including keyword arguments.\n\ -"); - -/* See comment in xxsubtype.c */ -#define DEFERRED_ADDRESS(ADDR) 0 - -static PyTypeObject defdict_type = { - PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0) - "collections.defaultdict", /* tp_name */ - sizeof(defdictobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)defdict_dealloc, /* tp_dealloc */ - (printfunc)defdict_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)defdict_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - defdict_doc, /* tp_doc */ - defdict_traverse, /* tp_traverse */ - (inquiry)defdict_tp_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - defdict_methods, /* tp_methods */ - defdict_members, /* tp_members */ - 0, /* tp_getset */ - DEFERRED_ADDRESS(&PyDict_Type), /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - defdict_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - 0, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* module level code ********************************************************/ - -PyDoc_STRVAR(module_doc, -"High performance data structures.\n\ -- deque: ordered collection accessible from endpoints only\n\ -- defaultdict: dict subclass with a default value factory\n\ -"); - -PyMODINIT_FUNC -init_collections(void) -{ - PyObject *m; - - m = Py_InitModule3("_collections", NULL, module_doc); - if (m == NULL) - return; - - if (PyType_Ready(&deque_type) < 0) - return; - Py_INCREF(&deque_type); - PyModule_AddObject(m, "deque", (PyObject *)&deque_type); - - defdict_type.tp_base = &PyDict_Type; - if (PyType_Ready(&defdict_type) < 0) - return; - Py_INCREF(&defdict_type); - PyModule_AddObject(m, "defaultdict", (PyObject *)&defdict_type); - - if (PyType_Ready(&dequeiter_type) < 0) - return; - - if (PyType_Ready(&dequereviter_type) < 0) - return; - - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_csv.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_csv.c deleted file mode 100644 index ab0dbe4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_csv.c +++ /dev/null @@ -1,1629 +0,0 @@ -/* csv module */ - -/* - -This module provides the low-level underpinnings of a CSV reading/writing -module. Users should not use this module directly, but import the csv.py -module instead. - -**** For people modifying this code, please note that as of this writing -**** (2003-03-23), it is intended that this code should work with Python -**** 2.2. - -*/ - -#define MODULE_VERSION "1.0" - -#include "Python.h" -#include "structmember.h" - - -/* begin 2.2 compatibility macros */ -#ifndef PyDoc_STRVAR -/* Define macros for inline documentation. */ -#define PyDoc_VAR(name) static char name[] -#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) -#ifdef WITH_DOC_STRINGS -#define PyDoc_STR(str) str -#else -#define PyDoc_STR(str) "" -#endif -#endif /* ifndef PyDoc_STRVAR */ - -#ifndef PyMODINIT_FUNC -# if defined(__cplusplus) -# define PyMODINIT_FUNC extern "C" void -# else /* __cplusplus */ -# define PyMODINIT_FUNC void -# endif /* __cplusplus */ -#endif - -#ifndef Py_CLEAR -#define Py_CLEAR(op) \ - do { \ - if (op) { \ - PyObject *tmp = (PyObject *)(op); \ - (op) = NULL; \ - Py_DECREF(tmp); \ - } \ - } while (0) -#endif -#ifndef Py_VISIT -#define Py_VISIT(op) \ - do { \ - if (op) { \ - int vret = visit((PyObject *)(op), arg); \ - if (vret) \ - return vret; \ - } \ - } while (0) -#endif - -/* end 2.2 compatibility macros */ - -#define IS_BASESTRING(o) \ - PyObject_TypeCheck(o, &PyBaseString_Type) - -static PyObject *error_obj; /* CSV exception */ -static PyObject *dialects; /* Dialect registry */ -static long field_limit = 128 * 1024; /* max parsed field size */ - -typedef enum { - START_RECORD, START_FIELD, ESCAPED_CHAR, IN_FIELD, - IN_QUOTED_FIELD, ESCAPE_IN_QUOTED_FIELD, QUOTE_IN_QUOTED_FIELD, - EAT_CRNL -} ParserState; - -typedef enum { - QUOTE_MINIMAL, QUOTE_ALL, QUOTE_NONNUMERIC, QUOTE_NONE -} QuoteStyle; - -typedef struct { - QuoteStyle style; - char *name; -} StyleDesc; - -static StyleDesc quote_styles[] = { - { QUOTE_MINIMAL, "QUOTE_MINIMAL" }, - { QUOTE_ALL, "QUOTE_ALL" }, - { QUOTE_NONNUMERIC, "QUOTE_NONNUMERIC" }, - { QUOTE_NONE, "QUOTE_NONE" }, - { 0 } -}; - -typedef struct { - PyObject_HEAD - - int doublequote; /* is " represented by ""? */ - char delimiter; /* field separator */ - char quotechar; /* quote character */ - char escapechar; /* escape character */ - int skipinitialspace; /* ignore spaces following delimiter? */ - PyObject *lineterminator; /* string to write between records */ - int quoting; /* style of quoting to write */ - - int strict; /* raise exception on bad CSV */ -} DialectObj; - -staticforward PyTypeObject Dialect_Type; - -typedef struct { - PyObject_HEAD - - PyObject *input_iter; /* iterate over this for input lines */ - - DialectObj *dialect; /* parsing dialect */ - - PyObject *fields; /* field list for current record */ - ParserState state; /* current CSV parse state */ - char *field; /* build current field in here */ - int field_size; /* size of allocated buffer */ - int field_len; /* length of current field */ - int numeric_field; /* treat field as numeric */ - unsigned long line_num; /* Source-file line number */ -} ReaderObj; - -staticforward PyTypeObject Reader_Type; - -#define ReaderObject_Check(v) (Py_TYPE(v) == &Reader_Type) - -typedef struct { - PyObject_HEAD - - PyObject *writeline; /* write output lines to this file */ - - DialectObj *dialect; /* parsing dialect */ - - char *rec; /* buffer for parser.join */ - int rec_size; /* size of allocated record */ - int rec_len; /* length of record */ - int num_fields; /* number of fields in record */ -} WriterObj; - -staticforward PyTypeObject Writer_Type; - -/* - * DIALECT class - */ - -static PyObject * -get_dialect_from_registry(PyObject * name_obj) -{ - PyObject *dialect_obj; - - dialect_obj = PyDict_GetItem(dialects, name_obj); - if (dialect_obj == NULL) { - if (!PyErr_Occurred()) - PyErr_Format(error_obj, "unknown dialect"); - } - else - Py_INCREF(dialect_obj); - return dialect_obj; -} - -static PyObject * -get_string(PyObject *str) -{ - Py_XINCREF(str); - return str; -} - -static PyObject * -get_nullchar_as_None(char c) -{ - if (c == '\0') { - Py_INCREF(Py_None); - return Py_None; - } - else - return PyString_FromStringAndSize((char*)&c, 1); -} - -static PyObject * -Dialect_get_lineterminator(DialectObj *self) -{ - return get_string(self->lineterminator); -} - -static PyObject * -Dialect_get_escapechar(DialectObj *self) -{ - return get_nullchar_as_None(self->escapechar); -} - -static PyObject * -Dialect_get_quotechar(DialectObj *self) -{ - return get_nullchar_as_None(self->quotechar); -} - -static PyObject * -Dialect_get_quoting(DialectObj *self) -{ - return PyInt_FromLong(self->quoting); -} - -static int -_set_bool(const char *name, int *target, PyObject *src, int dflt) -{ - if (src == NULL) - *target = dflt; - else { - int b = PyObject_IsTrue(src); - if (b < 0) - return -1; - *target = b; - } - return 0; -} - -static int -_set_int(const char *name, int *target, PyObject *src, int dflt) -{ - if (src == NULL) - *target = dflt; - else { - if (!PyInt_Check(src)) { - PyErr_Format(PyExc_TypeError, - "\"%s\" must be an integer", name); - return -1; - } - *target = PyInt_AsLong(src); - } - return 0; -} - -static int -_set_char(const char *name, char *target, PyObject *src, char dflt) -{ - if (src == NULL) - *target = dflt; - else { - *target = '\0'; - if (src != Py_None) { - Py_ssize_t len; - if (!PyString_Check(src)) { - PyErr_Format(PyExc_TypeError, - "\"%s\" must be string, not %.200s", name, - src->ob_type->tp_name); - return -1; - } - len = PyString_GET_SIZE(src); - if (len > 1) { - PyErr_Format(PyExc_TypeError, - "\"%s\" must be an 1-character string", - name); - return -1; - } - if (len > 0) - *target = *PyString_AS_STRING(src); - } - } - return 0; -} - -static int -_set_str(const char *name, PyObject **target, PyObject *src, const char *dflt) -{ - if (src == NULL) - *target = PyString_FromString(dflt); - else { - if (src == Py_None) - *target = NULL; - else if (!IS_BASESTRING(src)) { - PyErr_Format(PyExc_TypeError, - "\"%s\" must be a string", name); - return -1; - } - else { - Py_XDECREF(*target); - Py_INCREF(src); - *target = src; - } - } - return 0; -} - -static int -dialect_check_quoting(int quoting) -{ - StyleDesc *qs = quote_styles; - - for (qs = quote_styles; qs->name; qs++) { - if (qs->style == quoting) - return 0; - } - PyErr_Format(PyExc_TypeError, "bad \"quoting\" value"); - return -1; -} - -#define D_OFF(x) offsetof(DialectObj, x) - -static struct PyMemberDef Dialect_memberlist[] = { - { "delimiter", T_CHAR, D_OFF(delimiter), READONLY }, - { "skipinitialspace", T_INT, D_OFF(skipinitialspace), READONLY }, - { "doublequote", T_INT, D_OFF(doublequote), READONLY }, - { "strict", T_INT, D_OFF(strict), READONLY }, - { NULL } -}; - -static PyGetSetDef Dialect_getsetlist[] = { - { "escapechar", (getter)Dialect_get_escapechar}, - { "lineterminator", (getter)Dialect_get_lineterminator}, - { "quotechar", (getter)Dialect_get_quotechar}, - { "quoting", (getter)Dialect_get_quoting}, - {NULL}, -}; - -static void -Dialect_dealloc(DialectObj *self) -{ - Py_XDECREF(self->lineterminator); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static char *dialect_kws[] = { - "dialect", - "delimiter", - "doublequote", - "escapechar", - "lineterminator", - "quotechar", - "quoting", - "skipinitialspace", - "strict", - NULL -}; - -static PyObject * -dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - DialectObj *self; - PyObject *ret = NULL; - PyObject *dialect = NULL; - PyObject *delimiter = NULL; - PyObject *doublequote = NULL; - PyObject *escapechar = NULL; - PyObject *lineterminator = NULL; - PyObject *quotechar = NULL; - PyObject *quoting = NULL; - PyObject *skipinitialspace = NULL; - PyObject *strict = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, - "|OOOOOOOOO", dialect_kws, - &dialect, - &delimiter, - &doublequote, - &escapechar, - &lineterminator, - "echar, - "ing, - &skipinitialspace, - &strict)) - return NULL; - - if (dialect != NULL) { - if (IS_BASESTRING(dialect)) { - dialect = get_dialect_from_registry(dialect); - if (dialect == NULL) - return NULL; - } - else - Py_INCREF(dialect); - /* Can we reuse this instance? */ - if (PyObject_TypeCheck(dialect, &Dialect_Type) && - delimiter == 0 && - doublequote == 0 && - escapechar == 0 && - lineterminator == 0 && - quotechar == 0 && - quoting == 0 && - skipinitialspace == 0 && - strict == 0) - return dialect; - } - - self = (DialectObj *)type->tp_alloc(type, 0); - if (self == NULL) { - Py_XDECREF(dialect); - return NULL; - } - self->lineterminator = NULL; - - Py_XINCREF(delimiter); - Py_XINCREF(doublequote); - Py_XINCREF(escapechar); - Py_XINCREF(lineterminator); - Py_XINCREF(quotechar); - Py_XINCREF(quoting); - Py_XINCREF(skipinitialspace); - Py_XINCREF(strict); - if (dialect != NULL) { -#define DIALECT_GETATTR(v, n) \ - if (v == NULL) \ - v = PyObject_GetAttrString(dialect, n) - DIALECT_GETATTR(delimiter, "delimiter"); - DIALECT_GETATTR(doublequote, "doublequote"); - DIALECT_GETATTR(escapechar, "escapechar"); - DIALECT_GETATTR(lineterminator, "lineterminator"); - DIALECT_GETATTR(quotechar, "quotechar"); - DIALECT_GETATTR(quoting, "quoting"); - DIALECT_GETATTR(skipinitialspace, "skipinitialspace"); - DIALECT_GETATTR(strict, "strict"); - PyErr_Clear(); - } - - /* check types and convert to C values */ -#define DIASET(meth, name, target, src, dflt) \ - if (meth(name, target, src, dflt)) \ - goto err - DIASET(_set_char, "delimiter", &self->delimiter, delimiter, ','); - DIASET(_set_bool, "doublequote", &self->doublequote, doublequote, 1); - DIASET(_set_char, "escapechar", &self->escapechar, escapechar, 0); - DIASET(_set_str, "lineterminator", &self->lineterminator, lineterminator, "\r\n"); - DIASET(_set_char, "quotechar", &self->quotechar, quotechar, '"'); - DIASET(_set_int, "quoting", &self->quoting, quoting, QUOTE_MINIMAL); - DIASET(_set_bool, "skipinitialspace", &self->skipinitialspace, skipinitialspace, 0); - DIASET(_set_bool, "strict", &self->strict, strict, 0); - - /* validate options */ - if (dialect_check_quoting(self->quoting)) - goto err; - if (self->delimiter == 0) { - PyErr_SetString(PyExc_TypeError, - "\"delimiter\" must be an 1-character string"); - goto err; - } - if (quotechar == Py_None && quoting == NULL) - self->quoting = QUOTE_NONE; - if (self->quoting != QUOTE_NONE && self->quotechar == 0) { - PyErr_SetString(PyExc_TypeError, - "quotechar must be set if quoting enabled"); - goto err; - } - if (self->lineterminator == 0) { - PyErr_SetString(PyExc_TypeError, "lineterminator must be set"); - goto err; - } - - ret = (PyObject *)self; - Py_INCREF(self); -err: - Py_XDECREF(self); - Py_XDECREF(dialect); - Py_XDECREF(delimiter); - Py_XDECREF(doublequote); - Py_XDECREF(escapechar); - Py_XDECREF(lineterminator); - Py_XDECREF(quotechar); - Py_XDECREF(quoting); - Py_XDECREF(skipinitialspace); - Py_XDECREF(strict); - return ret; -} - - -PyDoc_STRVAR(Dialect_Type_doc, -"CSV dialect\n" -"\n" -"The Dialect type records CSV parsing and generation options.\n"); - -static PyTypeObject Dialect_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_csv.Dialect", /* tp_name */ - sizeof(DialectObj), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)Dialect_dealloc, /* tp_dealloc */ - (printfunc)0, /* tp_print */ - (getattrfunc)0, /* tp_getattr */ - (setattrfunc)0, /* tp_setattr */ - (cmpfunc)0, /* tp_compare */ - (reprfunc)0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)0, /* tp_hash */ - (ternaryfunc)0, /* tp_call */ - (reprfunc)0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - Dialect_Type_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - Dialect_memberlist, /* tp_members */ - Dialect_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - dialect_new, /* tp_new */ - 0, /* tp_free */ -}; - -/* - * Return an instance of the dialect type, given a Python instance or kwarg - * description of the dialect - */ -static PyObject * -_call_dialect(PyObject *dialect_inst, PyObject *kwargs) -{ - PyObject *ctor_args; - PyObject *dialect; - - ctor_args = Py_BuildValue(dialect_inst ? "(O)" : "()", dialect_inst); - if (ctor_args == NULL) - return NULL; - dialect = PyObject_Call((PyObject *)&Dialect_Type, ctor_args, kwargs); - Py_DECREF(ctor_args); - return dialect; -} - -/* - * READER - */ -static int -parse_save_field(ReaderObj *self) -{ - PyObject *field; - - field = PyString_FromStringAndSize(self->field, self->field_len); - if (field == NULL) - return -1; - self->field_len = 0; - if (self->numeric_field) { - PyObject *tmp; - - self->numeric_field = 0; - tmp = PyNumber_Float(field); - if (tmp == NULL) { - Py_DECREF(field); - return -1; - } - Py_DECREF(field); - field = tmp; - } - PyList_Append(self->fields, field); - Py_DECREF(field); - return 0; -} - -static int -parse_grow_buff(ReaderObj *self) -{ - if (self->field_size == 0) { - self->field_size = 4096; - if (self->field != NULL) - PyMem_Free(self->field); - self->field = PyMem_Malloc(self->field_size); - } - else { - if (self->field_size > INT_MAX / 2) { - PyErr_NoMemory(); - return 0; - } - self->field_size *= 2; - self->field = PyMem_Realloc(self->field, self->field_size); - } - if (self->field == NULL) { - PyErr_NoMemory(); - return 0; - } - return 1; -} - -static int -parse_add_char(ReaderObj *self, char c) -{ - if (self->field_len >= field_limit) { - PyErr_Format(error_obj, "field larger than field limit (%ld)", - field_limit); - return -1; - } - if (self->field_len == self->field_size && !parse_grow_buff(self)) - return -1; - self->field[self->field_len++] = c; - return 0; -} - -static int -parse_process_char(ReaderObj *self, char c) -{ - DialectObj *dialect = self->dialect; - - switch (self->state) { - case START_RECORD: - /* start of record */ - if (c == '\0') - /* empty line - return [] */ - break; - else if (c == '\n' || c == '\r') { - self->state = EAT_CRNL; - break; - } - /* normal character - handle as START_FIELD */ - self->state = START_FIELD; - /* fallthru */ - case START_FIELD: - /* expecting field */ - if (c == '\n' || c == '\r' || c == '\0') { - /* save empty field - return [fields] */ - if (parse_save_field(self) < 0) - return -1; - self->state = (c == '\0' ? START_RECORD : EAT_CRNL); - } - else if (c == dialect->quotechar && - dialect->quoting != QUOTE_NONE) { - /* start quoted field */ - self->state = IN_QUOTED_FIELD; - } - else if (c == dialect->escapechar) { - /* possible escaped character */ - self->state = ESCAPED_CHAR; - } - else if (c == ' ' && dialect->skipinitialspace) - /* ignore space at start of field */ - ; - else if (c == dialect->delimiter) { - /* save empty field */ - if (parse_save_field(self) < 0) - return -1; - } - else { - /* begin new unquoted field */ - if (dialect->quoting == QUOTE_NONNUMERIC) - self->numeric_field = 1; - if (parse_add_char(self, c) < 0) - return -1; - self->state = IN_FIELD; - } - break; - - case ESCAPED_CHAR: - if (c == '\0') - c = '\n'; - if (parse_add_char(self, c) < 0) - return -1; - self->state = IN_FIELD; - break; - - case IN_FIELD: - /* in unquoted field */ - if (c == '\n' || c == '\r' || c == '\0') { - /* end of line - return [fields] */ - if (parse_save_field(self) < 0) - return -1; - self->state = (c == '\0' ? START_RECORD : EAT_CRNL); - } - else if (c == dialect->escapechar) { - /* possible escaped character */ - self->state = ESCAPED_CHAR; - } - else if (c == dialect->delimiter) { - /* save field - wait for new field */ - if (parse_save_field(self) < 0) - return -1; - self->state = START_FIELD; - } - else { - /* normal character - save in field */ - if (parse_add_char(self, c) < 0) - return -1; - } - break; - - case IN_QUOTED_FIELD: - /* in quoted field */ - if (c == '\0') - ; - else if (c == dialect->escapechar) { - /* Possible escape character */ - self->state = ESCAPE_IN_QUOTED_FIELD; - } - else if (c == dialect->quotechar && - dialect->quoting != QUOTE_NONE) { - if (dialect->doublequote) { - /* doublequote; " represented by "" */ - self->state = QUOTE_IN_QUOTED_FIELD; - } - else { - /* end of quote part of field */ - self->state = IN_FIELD; - } - } - else { - /* normal character - save in field */ - if (parse_add_char(self, c) < 0) - return -1; - } - break; - - case ESCAPE_IN_QUOTED_FIELD: - if (c == '\0') - c = '\n'; - if (parse_add_char(self, c) < 0) - return -1; - self->state = IN_QUOTED_FIELD; - break; - - case QUOTE_IN_QUOTED_FIELD: - /* doublequote - seen a quote in an quoted field */ - if (dialect->quoting != QUOTE_NONE && - c == dialect->quotechar) { - /* save "" as " */ - if (parse_add_char(self, c) < 0) - return -1; - self->state = IN_QUOTED_FIELD; - } - else if (c == dialect->delimiter) { - /* save field - wait for new field */ - if (parse_save_field(self) < 0) - return -1; - self->state = START_FIELD; - } - else if (c == '\n' || c == '\r' || c == '\0') { - /* end of line - return [fields] */ - if (parse_save_field(self) < 0) - return -1; - self->state = (c == '\0' ? START_RECORD : EAT_CRNL); - } - else if (!dialect->strict) { - if (parse_add_char(self, c) < 0) - return -1; - self->state = IN_FIELD; - } - else { - /* illegal */ - PyErr_Format(error_obj, "'%c' expected after '%c'", - dialect->delimiter, - dialect->quotechar); - return -1; - } - break; - - case EAT_CRNL: - if (c == '\n' || c == '\r') - ; - else if (c == '\0') - self->state = START_RECORD; - else { - PyErr_Format(error_obj, "new-line character seen in unquoted field - do you need to open the file in universal-newline mode?"); - return -1; - } - break; - - } - return 0; -} - -static int -parse_reset(ReaderObj *self) -{ - Py_XDECREF(self->fields); - self->fields = PyList_New(0); - if (self->fields == NULL) - return -1; - self->field_len = 0; - self->state = START_RECORD; - self->numeric_field = 0; - return 0; -} - -static PyObject * -Reader_iternext(ReaderObj *self) -{ - PyObject *lineobj; - PyObject *fields = NULL; - char *line, c; - int linelen; - - if (parse_reset(self) < 0) - return NULL; - do { - lineobj = PyIter_Next(self->input_iter); - if (lineobj == NULL) { - /* End of input OR exception */ - if (!PyErr_Occurred() && (self->field_len != 0 || - self->state == IN_QUOTED_FIELD)) { - if (self->dialect->strict) - PyErr_SetString(error_obj, "unexpected end of data"); - else if (parse_save_field(self) >= 0 ) - break; - } - return NULL; - } - ++self->line_num; - - line = PyString_AsString(lineobj); - linelen = PyString_Size(lineobj); - - if (line == NULL || linelen < 0) { - Py_DECREF(lineobj); - return NULL; - } - while (linelen--) { - c = *line++; - if (c == '\0') { - Py_DECREF(lineobj); - PyErr_Format(error_obj, - "line contains NULL byte"); - goto err; - } - if (parse_process_char(self, c) < 0) { - Py_DECREF(lineobj); - goto err; - } - } - Py_DECREF(lineobj); - if (parse_process_char(self, 0) < 0) - goto err; - } while (self->state != START_RECORD); - - fields = self->fields; - self->fields = NULL; -err: - return fields; -} - -static void -Reader_dealloc(ReaderObj *self) -{ - PyObject_GC_UnTrack(self); - Py_XDECREF(self->dialect); - Py_XDECREF(self->input_iter); - Py_XDECREF(self->fields); - if (self->field != NULL) - PyMem_Free(self->field); - PyObject_GC_Del(self); -} - -static int -Reader_traverse(ReaderObj *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dialect); - Py_VISIT(self->input_iter); - Py_VISIT(self->fields); - return 0; -} - -static int -Reader_clear(ReaderObj *self) -{ - Py_CLEAR(self->dialect); - Py_CLEAR(self->input_iter); - Py_CLEAR(self->fields); - return 0; -} - -PyDoc_STRVAR(Reader_Type_doc, -"CSV reader\n" -"\n" -"Reader objects are responsible for reading and parsing tabular data\n" -"in CSV format.\n" -); - -static struct PyMethodDef Reader_methods[] = { - { NULL, NULL } -}; -#define R_OFF(x) offsetof(ReaderObj, x) - -static struct PyMemberDef Reader_memberlist[] = { - { "dialect", T_OBJECT, R_OFF(dialect), RO }, - { "line_num", T_ULONG, R_OFF(line_num), RO }, - { NULL } -}; - - -static PyTypeObject Reader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_csv.reader", /*tp_name*/ - sizeof(ReaderObj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)Reader_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)0, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - Reader_Type_doc, /*tp_doc*/ - (traverseproc)Reader_traverse, /*tp_traverse*/ - (inquiry)Reader_clear, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - PyObject_SelfIter, /*tp_iter*/ - (getiterfunc)Reader_iternext, /*tp_iternext*/ - Reader_methods, /*tp_methods*/ - Reader_memberlist, /*tp_members*/ - 0, /*tp_getset*/ - -}; - -static PyObject * -csv_reader(PyObject *module, PyObject *args, PyObject *keyword_args) -{ - PyObject * iterator, * dialect = NULL; - ReaderObj * self = PyObject_GC_New(ReaderObj, &Reader_Type); - - if (!self) - return NULL; - - self->dialect = NULL; - self->fields = NULL; - self->input_iter = NULL; - self->field = NULL; - self->field_size = 0; - self->line_num = 0; - - if (parse_reset(self) < 0) { - Py_DECREF(self); - return NULL; - } - - if (!PyArg_UnpackTuple(args, "", 1, 2, &iterator, &dialect)) { - Py_DECREF(self); - return NULL; - } - self->input_iter = PyObject_GetIter(iterator); - if (self->input_iter == NULL) { - PyErr_SetString(PyExc_TypeError, - "argument 1 must be an iterator"); - Py_DECREF(self); - return NULL; - } - self->dialect = (DialectObj *)_call_dialect(dialect, keyword_args); - if (self->dialect == NULL) { - Py_DECREF(self); - return NULL; - } - - PyObject_GC_Track(self); - return (PyObject *)self; -} - -/* - * WRITER - */ -/* ---------------------------------------------------------------- */ -static void -join_reset(WriterObj *self) -{ - self->rec_len = 0; - self->num_fields = 0; -} - -#define MEM_INCR 32768 - -/* Calculate new record length or append field to record. Return new - * record length. - */ -static int -join_append_data(WriterObj *self, char *field, int quote_empty, - int *quoted, int copy_phase) -{ - DialectObj *dialect = self->dialect; - int i, rec_len; - char *lineterm; - -#define ADDCH(c) \ - do {\ - if (copy_phase) \ - self->rec[rec_len] = c;\ - rec_len++;\ - } while(0) - - lineterm = PyString_AsString(dialect->lineterminator); - if (lineterm == NULL) - return -1; - - rec_len = self->rec_len; - - /* If this is not the first field we need a field separator */ - if (self->num_fields > 0) - ADDCH(dialect->delimiter); - - /* Handle preceding quote */ - if (copy_phase && *quoted) - ADDCH(dialect->quotechar); - - /* Copy/count field data */ - for (i = 0;; i++) { - char c = field[i]; - int want_escape = 0; - - if (c == '\0') - break; - - if (c == dialect->delimiter || - c == dialect->escapechar || - c == dialect->quotechar || - strchr(lineterm, c)) { - if (dialect->quoting == QUOTE_NONE) - want_escape = 1; - else { - if (c == dialect->quotechar) { - if (dialect->doublequote) - ADDCH(dialect->quotechar); - else - want_escape = 1; - } - if (!want_escape) - *quoted = 1; - } - if (want_escape) { - if (!dialect->escapechar) { - PyErr_Format(error_obj, - "need to escape, but no escapechar set"); - return -1; - } - ADDCH(dialect->escapechar); - } - } - /* Copy field character into record buffer. - */ - ADDCH(c); - } - - /* If field is empty check if it needs to be quoted. - */ - if (i == 0 && quote_empty) { - if (dialect->quoting == QUOTE_NONE) { - PyErr_Format(error_obj, - "single empty field record must be quoted"); - return -1; - } - else - *quoted = 1; - } - - if (*quoted) { - if (copy_phase) - ADDCH(dialect->quotechar); - else - rec_len += 2; - } - return rec_len; -#undef ADDCH -} - -static int -join_check_rec_size(WriterObj *self, int rec_len) -{ - - if (rec_len < 0 || rec_len > INT_MAX - MEM_INCR) { - PyErr_NoMemory(); - return 0; - } - - if (rec_len > self->rec_size) { - if (self->rec_size == 0) { - self->rec_size = (rec_len / MEM_INCR + 1) * MEM_INCR; - if (self->rec != NULL) - PyMem_Free(self->rec); - self->rec = PyMem_Malloc(self->rec_size); - } - else { - char *old_rec = self->rec; - - self->rec_size = (rec_len / MEM_INCR + 1) * MEM_INCR; - self->rec = PyMem_Realloc(self->rec, self->rec_size); - if (self->rec == NULL) - PyMem_Free(old_rec); - } - if (self->rec == NULL) { - PyErr_NoMemory(); - return 0; - } - } - return 1; -} - -static int -join_append(WriterObj *self, char *field, int *quoted, int quote_empty) -{ - int rec_len; - - rec_len = join_append_data(self, field, quote_empty, quoted, 0); - if (rec_len < 0) - return 0; - - /* grow record buffer if necessary */ - if (!join_check_rec_size(self, rec_len)) - return 0; - - self->rec_len = join_append_data(self, field, quote_empty, quoted, 1); - self->num_fields++; - - return 1; -} - -static int -join_append_lineterminator(WriterObj *self) -{ - int terminator_len; - char *terminator; - - terminator_len = PyString_Size(self->dialect->lineterminator); - if (terminator_len == -1) - return 0; - - /* grow record buffer if necessary */ - if (!join_check_rec_size(self, self->rec_len + terminator_len)) - return 0; - - terminator = PyString_AsString(self->dialect->lineterminator); - if (terminator == NULL) - return 0; - memmove(self->rec + self->rec_len, terminator, terminator_len); - self->rec_len += terminator_len; - - return 1; -} - -PyDoc_STRVAR(csv_writerow_doc, -"writerow(sequence)\n" -"\n" -"Construct and write a CSV record from a sequence of fields. Non-string\n" -"elements will be converted to string."); - -static PyObject * -csv_writerow(WriterObj *self, PyObject *seq) -{ - DialectObj *dialect = self->dialect; - int len, i; - - if (!PySequence_Check(seq)) - return PyErr_Format(error_obj, "sequence expected"); - - len = PySequence_Length(seq); - if (len < 0) - return NULL; - - /* Join all fields in internal buffer. - */ - join_reset(self); - for (i = 0; i < len; i++) { - PyObject *field; - int append_ok; - int quoted; - - field = PySequence_GetItem(seq, i); - if (field == NULL) - return NULL; - - switch (dialect->quoting) { - case QUOTE_NONNUMERIC: - quoted = !PyNumber_Check(field); - break; - case QUOTE_ALL: - quoted = 1; - break; - default: - quoted = 0; - break; - } - - if (PyString_Check(field)) { - append_ok = join_append(self, - PyString_AS_STRING(field), - "ed, len == 1); - Py_DECREF(field); - } - else if (field == Py_None) { - append_ok = join_append(self, "", "ed, len == 1); - Py_DECREF(field); - } - else { - PyObject *str; - - if (PyFloat_Check(field)) { - str = PyObject_Repr(field); - } else { - str = PyObject_Str(field); - } - Py_DECREF(field); - if (str == NULL) - return NULL; - - append_ok = join_append(self, PyString_AS_STRING(str), - "ed, len == 1); - Py_DECREF(str); - } - if (!append_ok) - return NULL; - } - - /* Add line terminator. - */ - if (!join_append_lineterminator(self)) - return 0; - - return PyObject_CallFunction(self->writeline, - "(s#)", self->rec, self->rec_len); -} - -PyDoc_STRVAR(csv_writerows_doc, -"writerows(sequence of sequences)\n" -"\n" -"Construct and write a series of sequences to a csv file. Non-string\n" -"elements will be converted to string."); - -static PyObject * -csv_writerows(WriterObj *self, PyObject *seqseq) -{ - PyObject *row_iter, *row_obj, *result; - - row_iter = PyObject_GetIter(seqseq); - if (row_iter == NULL) { - PyErr_SetString(PyExc_TypeError, - "writerows() argument must be iterable"); - return NULL; - } - while ((row_obj = PyIter_Next(row_iter))) { - result = csv_writerow(self, row_obj); - Py_DECREF(row_obj); - if (!result) { - Py_DECREF(row_iter); - return NULL; - } - else - Py_DECREF(result); - } - Py_DECREF(row_iter); - if (PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static struct PyMethodDef Writer_methods[] = { - { "writerow", (PyCFunction)csv_writerow, METH_O, csv_writerow_doc}, - { "writerows", (PyCFunction)csv_writerows, METH_O, csv_writerows_doc}, - { NULL, NULL } -}; - -#define W_OFF(x) offsetof(WriterObj, x) - -static struct PyMemberDef Writer_memberlist[] = { - { "dialect", T_OBJECT, W_OFF(dialect), RO }, - { NULL } -}; - -static void -Writer_dealloc(WriterObj *self) -{ - PyObject_GC_UnTrack(self); - Py_XDECREF(self->dialect); - Py_XDECREF(self->writeline); - if (self->rec != NULL) - PyMem_Free(self->rec); - PyObject_GC_Del(self); -} - -static int -Writer_traverse(WriterObj *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dialect); - Py_VISIT(self->writeline); - return 0; -} - -static int -Writer_clear(WriterObj *self) -{ - Py_CLEAR(self->dialect); - Py_CLEAR(self->writeline); - return 0; -} - -PyDoc_STRVAR(Writer_Type_doc, -"CSV writer\n" -"\n" -"Writer objects are responsible for generating tabular data\n" -"in CSV format from sequence input.\n" -); - -static PyTypeObject Writer_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_csv.writer", /*tp_name*/ - sizeof(WriterObj), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)Writer_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)0, /*tp_getattr*/ - (setattrfunc)0, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - Writer_Type_doc, - (traverseproc)Writer_traverse, /*tp_traverse*/ - (inquiry)Writer_clear, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - (getiterfunc)0, /*tp_iter*/ - (getiterfunc)0, /*tp_iternext*/ - Writer_methods, /*tp_methods*/ - Writer_memberlist, /*tp_members*/ - 0, /*tp_getset*/ -}; - -static PyObject * -csv_writer(PyObject *module, PyObject *args, PyObject *keyword_args) -{ - PyObject * output_file, * dialect = NULL; - WriterObj * self = PyObject_GC_New(WriterObj, &Writer_Type); - - if (!self) - return NULL; - - self->dialect = NULL; - self->writeline = NULL; - - self->rec = NULL; - self->rec_size = 0; - self->rec_len = 0; - self->num_fields = 0; - - if (!PyArg_UnpackTuple(args, "", 1, 2, &output_file, &dialect)) { - Py_DECREF(self); - return NULL; - } - self->writeline = PyObject_GetAttrString(output_file, "write"); - if (self->writeline == NULL || !PyCallable_Check(self->writeline)) { - PyErr_SetString(PyExc_TypeError, - "argument 1 must have a \"write\" method"); - Py_DECREF(self); - return NULL; - } - self->dialect = (DialectObj *)_call_dialect(dialect, keyword_args); - if (self->dialect == NULL) { - Py_DECREF(self); - return NULL; - } - PyObject_GC_Track(self); - return (PyObject *)self; -} - -/* - * DIALECT REGISTRY - */ -static PyObject * -csv_list_dialects(PyObject *module, PyObject *args) -{ - return PyDict_Keys(dialects); -} - -static PyObject * -csv_register_dialect(PyObject *module, PyObject *args, PyObject *kwargs) -{ - PyObject *name_obj, *dialect_obj = NULL; - PyObject *dialect; - - if (!PyArg_UnpackTuple(args, "", 1, 2, &name_obj, &dialect_obj)) - return NULL; - if (!IS_BASESTRING(name_obj)) { - PyErr_SetString(PyExc_TypeError, - "dialect name must be a string or unicode"); - return NULL; - } - dialect = _call_dialect(dialect_obj, kwargs); - if (dialect == NULL) - return NULL; - if (PyDict_SetItem(dialects, name_obj, dialect) < 0) { - Py_DECREF(dialect); - return NULL; - } - Py_DECREF(dialect); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -csv_unregister_dialect(PyObject *module, PyObject *name_obj) -{ - if (PyDict_DelItem(dialects, name_obj) < 0) - return PyErr_Format(error_obj, "unknown dialect"); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -csv_get_dialect(PyObject *module, PyObject *name_obj) -{ - return get_dialect_from_registry(name_obj); -} - -static PyObject * -csv_field_size_limit(PyObject *module, PyObject *args) -{ - PyObject *new_limit = NULL; - long old_limit = field_limit; - - if (!PyArg_UnpackTuple(args, "field_size_limit", 0, 1, &new_limit)) - return NULL; - if (new_limit != NULL) { - if (!PyInt_Check(new_limit)) { - PyErr_Format(PyExc_TypeError, - "limit must be an integer"); - return NULL; - } - field_limit = PyInt_AsLong(new_limit); - } - return PyInt_FromLong(old_limit); -} - -/* - * MODULE - */ - -PyDoc_STRVAR(csv_module_doc, -"CSV parsing and writing.\n" -"\n" -"This module provides classes that assist in the reading and writing\n" -"of Comma Separated Value (CSV) files, and implements the interface\n" -"described by PEP 305. Although many CSV files are simple to parse,\n" -"the format is not formally defined by a stable specification and\n" -"is subtle enough that parsing lines of a CSV file with something\n" -"like line.split(\",\") is bound to fail. The module supports three\n" -"basic APIs: reading, writing, and registration of dialects.\n" -"\n" -"\n" -"DIALECT REGISTRATION:\n" -"\n" -"Readers and writers support a dialect argument, which is a convenient\n" -"handle on a group of settings. When the dialect argument is a string,\n" -"it identifies one of the dialects previously registered with the module.\n" -"If it is a class or instance, the attributes of the argument are used as\n" -"the settings for the reader or writer:\n" -"\n" -" class excel:\n" -" delimiter = ','\n" -" quotechar = '\"'\n" -" escapechar = None\n" -" doublequote = True\n" -" skipinitialspace = False\n" -" lineterminator = '\\r\\n'\n" -" quoting = QUOTE_MINIMAL\n" -"\n" -"SETTINGS:\n" -"\n" -" * quotechar - specifies a one-character string to use as the \n" -" quoting character. It defaults to '\"'.\n" -" * delimiter - specifies a one-character string to use as the \n" -" field separator. It defaults to ','.\n" -" * skipinitialspace - specifies how to interpret whitespace which\n" -" immediately follows a delimiter. It defaults to False, which\n" -" means that whitespace immediately following a delimiter is part\n" -" of the following field.\n" -" * lineterminator - specifies the character sequence which should \n" -" terminate rows.\n" -" * quoting - controls when quotes should be generated by the writer.\n" -" It can take on any of the following module constants:\n" -"\n" -" csv.QUOTE_MINIMAL means only when required, for example, when a\n" -" field contains either the quotechar or the delimiter\n" -" csv.QUOTE_ALL means that quotes are always placed around fields.\n" -" csv.QUOTE_NONNUMERIC means that quotes are always placed around\n" -" fields which do not parse as integers or floating point\n" -" numbers.\n" -" csv.QUOTE_NONE means that quotes are never placed around fields.\n" -" * escapechar - specifies a one-character string used to escape \n" -" the delimiter when quoting is set to QUOTE_NONE.\n" -" * doublequote - controls the handling of quotes inside fields. When\n" -" True, two consecutive quotes are interpreted as one during read,\n" -" and when writing, each quote character embedded in the data is\n" -" written as two quotes\n"); - -PyDoc_STRVAR(csv_reader_doc, -" csv_reader = reader(iterable [, dialect='excel']\n" -" [optional keyword args])\n" -" for row in csv_reader:\n" -" process(row)\n" -"\n" -"The \"iterable\" argument can be any object that returns a line\n" -"of input for each iteration, such as a file object or a list. The\n" -"optional \"dialect\" parameter is discussed below. The function\n" -"also accepts optional keyword arguments which override settings\n" -"provided by the dialect.\n" -"\n" -"The returned object is an iterator. Each iteration returns a row\n" -"of the CSV file (which can span multiple input lines):\n"); - -PyDoc_STRVAR(csv_writer_doc, -" csv_writer = csv.writer(fileobj [, dialect='excel']\n" -" [optional keyword args])\n" -" for row in sequence:\n" -" csv_writer.writerow(row)\n" -"\n" -" [or]\n" -"\n" -" csv_writer = csv.writer(fileobj [, dialect='excel']\n" -" [optional keyword args])\n" -" csv_writer.writerows(rows)\n" -"\n" -"The \"fileobj\" argument can be any object that supports the file API.\n"); - -PyDoc_STRVAR(csv_list_dialects_doc, -"Return a list of all know dialect names.\n" -" names = csv.list_dialects()"); - -PyDoc_STRVAR(csv_get_dialect_doc, -"Return the dialect instance associated with name.\n" -" dialect = csv.get_dialect(name)"); - -PyDoc_STRVAR(csv_register_dialect_doc, -"Create a mapping from a string name to a dialect class.\n" -" dialect = csv.register_dialect(name, dialect)"); - -PyDoc_STRVAR(csv_unregister_dialect_doc, -"Delete the name/dialect mapping associated with a string name.\n" -" csv.unregister_dialect(name)"); - -PyDoc_STRVAR(csv_field_size_limit_doc, -"Sets an upper limit on parsed fields.\n" -" csv.field_size_limit([limit])\n" -"\n" -"Returns old limit. If limit is not given, no new limit is set and\n" -"the old limit is returned"); - -static struct PyMethodDef csv_methods[] = { - { "reader", (PyCFunction)csv_reader, - METH_VARARGS | METH_KEYWORDS, csv_reader_doc}, - { "writer", (PyCFunction)csv_writer, - METH_VARARGS | METH_KEYWORDS, csv_writer_doc}, - { "list_dialects", (PyCFunction)csv_list_dialects, - METH_NOARGS, csv_list_dialects_doc}, - { "register_dialect", (PyCFunction)csv_register_dialect, - METH_VARARGS | METH_KEYWORDS, csv_register_dialect_doc}, - { "unregister_dialect", (PyCFunction)csv_unregister_dialect, - METH_O, csv_unregister_dialect_doc}, - { "get_dialect", (PyCFunction)csv_get_dialect, - METH_O, csv_get_dialect_doc}, - { "field_size_limit", (PyCFunction)csv_field_size_limit, - METH_VARARGS, csv_field_size_limit_doc}, - { NULL, NULL } -}; - -PyMODINIT_FUNC -init_csv(void) -{ - PyObject *module; - StyleDesc *style; - - if (PyType_Ready(&Dialect_Type) < 0) - return; - - if (PyType_Ready(&Reader_Type) < 0) - return; - - if (PyType_Ready(&Writer_Type) < 0) - return; - - /* Create the module and add the functions */ - module = Py_InitModule3("_csv", csv_methods, csv_module_doc); - if (module == NULL) - return; - - /* Add version to the module. */ - if (PyModule_AddStringConstant(module, "__version__", - MODULE_VERSION) == -1) - return; - - /* Add _dialects dictionary */ - dialects = PyDict_New(); - if (dialects == NULL) - return; - if (PyModule_AddObject(module, "_dialects", dialects)) - return; - - /* Add quote styles into dictionary */ - for (style = quote_styles; style->name; style++) { - if (PyModule_AddIntConstant(module, style->name, - style->style) == -1) - return; - } - - /* Add the Dialect type */ - Py_INCREF(&Dialect_Type); - if (PyModule_AddObject(module, "Dialect", (PyObject *)&Dialect_Type)) - return; - - /* Add the CSV exception object to the module. */ - error_obj = PyErr_NewException("_csv.Error", NULL, NULL); - if (error_obj == NULL) - return; - PyModule_AddObject(module, "Error", error_obj); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_functoolsmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_functoolsmodule.c deleted file mode 100644 index 093e404..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_functoolsmodule.c +++ /dev/null @@ -1,398 +0,0 @@ - -#include "Python.h" -#include "structmember.h" - -/* _functools module written and maintained - by Hye-Shik Chang - with adaptations by Raymond Hettinger - Copyright (c) 2004, 2005, 2006 Python Software Foundation. - All rights reserved. -*/ - -/* reduce() *************************************************************/ - -static PyObject * -functools_reduce(PyObject *self, PyObject *args) -{ - PyObject *seq, *func, *result = NULL, *it; - - if (!PyArg_UnpackTuple(args, "reduce", 2, 3, &func, &seq, &result)) - return NULL; - if (result != NULL) - Py_INCREF(result); - - it = PyObject_GetIter(seq); - if (it == NULL) { - PyErr_SetString(PyExc_TypeError, - "reduce() arg 2 must support iteration"); - Py_XDECREF(result); - return NULL; - } - - if ((args = PyTuple_New(2)) == NULL) - goto Fail; - - for (;;) { - PyObject *op2; - - if (args->ob_refcnt > 1) { - Py_DECREF(args); - if ((args = PyTuple_New(2)) == NULL) - goto Fail; - } - - op2 = PyIter_Next(it); - if (op2 == NULL) { - if (PyErr_Occurred()) - goto Fail; - break; - } - - if (result == NULL) - result = op2; - else { - PyTuple_SetItem(args, 0, result); - PyTuple_SetItem(args, 1, op2); - if ((result = PyEval_CallObject(func, args)) == NULL) - goto Fail; - } - } - - Py_DECREF(args); - - if (result == NULL) - PyErr_SetString(PyExc_TypeError, - "reduce() of empty sequence with no initial value"); - - Py_DECREF(it); - return result; - -Fail: - Py_XDECREF(args); - Py_XDECREF(result); - Py_DECREF(it); - return NULL; -} - -PyDoc_STRVAR(reduce_doc, -"reduce(function, sequence[, initial]) -> value\n\ -\n\ -Apply a function of two arguments cumulatively to the items of a sequence,\n\ -from left to right, so as to reduce the sequence to a single value.\n\ -For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n\ -((((1+2)+3)+4)+5). If initial is present, it is placed before the items\n\ -of the sequence in the calculation, and serves as a default when the\n\ -sequence is empty."); - - - - -/* partial object **********************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *fn; - PyObject *args; - PyObject *kw; - PyObject *dict; - PyObject *weakreflist; /* List of weak references */ -} partialobject; - -static PyTypeObject partial_type; - -static PyObject * -partial_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *func; - partialobject *pto; - - if (PyTuple_GET_SIZE(args) < 1) { - PyErr_SetString(PyExc_TypeError, - "type 'partial' takes at least one argument"); - return NULL; - } - - func = PyTuple_GET_ITEM(args, 0); - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, - "the first argument must be callable"); - return NULL; - } - - /* create partialobject structure */ - pto = (partialobject *)type->tp_alloc(type, 0); - if (pto == NULL) - return NULL; - - pto->fn = func; - Py_INCREF(func); - pto->args = PyTuple_GetSlice(args, 1, PY_SSIZE_T_MAX); - if (pto->args == NULL) { - pto->kw = NULL; - Py_DECREF(pto); - return NULL; - } - pto->kw = (kw != NULL) ? PyDict_Copy(kw) : PyDict_New(); - if (pto->kw == NULL) { - Py_DECREF(pto); - return NULL; - } - - - pto->weakreflist = NULL; - pto->dict = NULL; - - return (PyObject *)pto; -} - -static void -partial_dealloc(partialobject *pto) -{ - PyObject_GC_UnTrack(pto); - if (pto->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) pto); - Py_XDECREF(pto->fn); - Py_XDECREF(pto->args); - Py_XDECREF(pto->kw); - Py_XDECREF(pto->dict); - Py_TYPE(pto)->tp_free(pto); -} - -static PyObject * -partial_call(partialobject *pto, PyObject *args, PyObject *kw) -{ - PyObject *ret; - PyObject *argappl = NULL, *kwappl = NULL; - - assert (PyCallable_Check(pto->fn)); - assert (PyTuple_Check(pto->args)); - assert (pto->kw == Py_None || PyDict_Check(pto->kw)); - - if (PyTuple_GET_SIZE(pto->args) == 0) { - argappl = args; - Py_INCREF(args); - } else if (PyTuple_GET_SIZE(args) == 0) { - argappl = pto->args; - Py_INCREF(pto->args); - } else { - argappl = PySequence_Concat(pto->args, args); - if (argappl == NULL) - return NULL; - } - - if (pto->kw == Py_None) { - kwappl = kw; - Py_XINCREF(kw); - } else { - kwappl = PyDict_Copy(pto->kw); - if (kwappl == NULL) { - Py_DECREF(argappl); - return NULL; - } - if (kw != NULL) { - if (PyDict_Merge(kwappl, kw, 1) != 0) { - Py_DECREF(argappl); - Py_DECREF(kwappl); - return NULL; - } - } - } - - ret = PyObject_Call(pto->fn, argappl, kwappl); - Py_DECREF(argappl); - Py_XDECREF(kwappl); - return ret; -} - -static int -partial_traverse(partialobject *pto, visitproc visit, void *arg) -{ - Py_VISIT(pto->fn); - Py_VISIT(pto->args); - Py_VISIT(pto->kw); - Py_VISIT(pto->dict); - return 0; -} - -PyDoc_STRVAR(partial_doc, -"partial(func, *args, **keywords) - new function with partial application\n\ - of the given arguments and keywords.\n"); - -#define OFF(x) offsetof(partialobject, x) -static PyMemberDef partial_memberlist[] = { - {"func", T_OBJECT, OFF(fn), READONLY, - "function object to use in future partial calls"}, - {"args", T_OBJECT, OFF(args), READONLY, - "tuple of arguments to future partial calls"}, - {"keywords", T_OBJECT, OFF(kw), READONLY, - "dictionary of keyword arguments to future partial calls"}, - {NULL} /* Sentinel */ -}; - -static PyObject * -partial_get_dict(partialobject *pto) -{ - if (pto->dict == NULL) { - pto->dict = PyDict_New(); - if (pto->dict == NULL) - return NULL; - } - Py_INCREF(pto->dict); - return pto->dict; -} - -static int -partial_set_dict(partialobject *pto, PyObject *value) -{ - PyObject *tmp; - - /* It is illegal to del p.__dict__ */ - if (value == NULL) { - PyErr_SetString(PyExc_TypeError, - "a partial object's dictionary may not be deleted"); - return -1; - } - /* Can only set __dict__ to a dictionary */ - if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "setting partial object's dictionary to a non-dict"); - return -1; - } - tmp = pto->dict; - Py_INCREF(value); - pto->dict = value; - Py_XDECREF(tmp); - return 0; -} - -static PyGetSetDef partial_getsetlist[] = { - {"__dict__", (getter)partial_get_dict, (setter)partial_set_dict}, - {NULL} /* Sentinel */ -}; - -/* Pickle strategy: - __reduce__ by itself doesn't support getting kwargs in the unpickle - operation so we define a __setstate__ that replaces all the information - about the partial. If we only replaced part of it someone would use - it as a hook to do strange things. - */ - -PyObject * -partial_reduce(partialobject *pto, PyObject *unused) -{ - return Py_BuildValue("O(O)(OOOO)", Py_TYPE(pto), pto->fn, pto->fn, - pto->args, pto->kw, - pto->dict ? pto->dict : Py_None); -} - -PyObject * -partial_setstate(partialobject *pto, PyObject *state) -{ - PyObject *fn, *fnargs, *kw, *dict; - if (!PyArg_ParseTuple(state, "OOOO", - &fn, &fnargs, &kw, &dict)) - return NULL; - Py_XDECREF(pto->fn); - Py_XDECREF(pto->args); - Py_XDECREF(pto->kw); - Py_XDECREF(pto->dict); - pto->fn = fn; - pto->args = fnargs; - pto->kw = kw; - if (dict != Py_None) { - pto->dict = dict; - Py_INCREF(dict); - } else { - pto->dict = NULL; - } - Py_INCREF(fn); - Py_INCREF(fnargs); - Py_INCREF(kw); - Py_RETURN_NONE; -} - -static PyMethodDef partial_methods[] = { - {"__reduce__", (PyCFunction)partial_reduce, METH_NOARGS}, - {"__setstate__", (PyCFunction)partial_setstate, METH_O}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject partial_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "functools.partial", /* tp_name */ - sizeof(partialobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)partial_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)partial_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - partial_doc, /* tp_doc */ - (traverseproc)partial_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(partialobject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - partial_methods, /* tp_methods */ - partial_memberlist, /* tp_members */ - partial_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(partialobject, dict), /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - partial_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* module level code ********************************************************/ - -PyDoc_STRVAR(module_doc, -"Tools that operate on functions."); - -static PyMethodDef module_methods[] = { - {"reduce", functools_reduce, METH_VARARGS, reduce_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -init_functools(void) -{ - int i; - PyObject *m; - char *name; - PyTypeObject *typelist[] = { - &partial_type, - NULL - }; - - m = Py_InitModule3("_functools", module_methods, module_doc); - if (m == NULL) - return; - - for (i=0 ; typelist[i] != NULL ; i++) { - if (PyType_Ready(typelist[i]) < 0) - return; - name = strchr(typelist[i]->tp_name, '.'); - assert (name != NULL); - Py_INCREF(typelist[i]); - PyModule_AddObject(m, name+1, (PyObject *)typelist[i]); - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_heapqmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_heapqmodule.c deleted file mode 100644 index 459577e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_heapqmodule.c +++ /dev/null @@ -1,696 +0,0 @@ -/* Drop in replacement for heapq.py - -C implementation derived directly from heapq.py in Py2.3 -which was written by Kevin O'Connor, augmented by Tim Peters, -annotated by François Pinard, and converted to C by Raymond Hettinger. - -*/ - -#include "Python.h" - -/* Older implementations of heapq used Py_LE for comparisons. Now, it uses - Py_LT so it will match min(), sorted(), and bisect(). Unfortunately, some - client code (Twisted for example) relied on Py_LE, so this little function - restores compatibility by trying both. -*/ -static int -cmp_lt(PyObject *x, PyObject *y) -{ - int cmp; - static PyObject *lt = NULL; - - if (lt == NULL) { - lt = PyString_FromString("__lt__"); - if (lt == NULL) - return -1; - } - if (PyObject_HasAttr(x, lt)) - return PyObject_RichCompareBool(x, y, Py_LT); - cmp = PyObject_RichCompareBool(y, x, Py_LE); - if (cmp != -1) - cmp = 1 - cmp; - return cmp; -} - -static int -_siftdown(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) -{ - PyObject *newitem, *parent; - Py_ssize_t parentpos, size; - int cmp; - - assert(PyList_Check(heap)); - size = PyList_GET_SIZE(heap); - if (pos >= size) { - PyErr_SetString(PyExc_IndexError, "index out of range"); - return -1; - } - - /* Follow the path to the root, moving parents down until finding - a place newitem fits. */ - newitem = PyList_GET_ITEM(heap, pos); - while (pos > startpos) { - parentpos = (pos - 1) >> 1; - parent = PyList_GET_ITEM(heap, parentpos); - cmp = cmp_lt(newitem, parent); - if (cmp == -1) - return -1; - if (size != PyList_GET_SIZE(heap)) { - PyErr_SetString(PyExc_RuntimeError, - "list changed size during iteration"); - return -1; - } - if (cmp == 0) - break; - parent = PyList_GET_ITEM(heap, parentpos); - newitem = PyList_GET_ITEM(heap, pos); - PyList_SET_ITEM(heap, parentpos, newitem); - PyList_SET_ITEM(heap, pos, parent); - pos = parentpos; - } - return 0; -} - -static int -_siftup(PyListObject *heap, Py_ssize_t pos) -{ - Py_ssize_t startpos, endpos, childpos, rightpos, limit; - PyObject *tmp1, *tmp2; - int cmp; - - assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); - startpos = pos; - if (pos >= endpos) { - PyErr_SetString(PyExc_IndexError, "index out of range"); - return -1; - } - - /* Bubble up the smaller child until hitting a leaf. */ - limit = endpos / 2; /* smallest pos that has no child */ - while (pos < limit) { - /* Set childpos to index of smaller child. */ - childpos = 2*pos + 1; /* leftmost child position */ - rightpos = childpos + 1; - if (rightpos < endpos) { - cmp = cmp_lt( - PyList_GET_ITEM(heap, childpos), - PyList_GET_ITEM(heap, rightpos)); - if (cmp == -1) - return -1; - if (cmp == 0) - childpos = rightpos; - if (endpos != PyList_GET_SIZE(heap)) { - PyErr_SetString(PyExc_RuntimeError, - "list changed size during iteration"); - return -1; - } - } - /* Move the smaller child up. */ - tmp1 = PyList_GET_ITEM(heap, childpos); - tmp2 = PyList_GET_ITEM(heap, pos); - PyList_SET_ITEM(heap, childpos, tmp2); - PyList_SET_ITEM(heap, pos, tmp1); - pos = childpos; - } - /* Bubble it up to its final resting place (by sifting its parents down). */ - return _siftdown(heap, startpos, pos); -} - -static PyObject * -heappush(PyObject *self, PyObject *args) -{ - PyObject *heap, *item; - - if (!PyArg_UnpackTuple(args, "heappush", 2, 2, &heap, &item)) - return NULL; - - if (!PyList_Check(heap)) { - PyErr_SetString(PyExc_TypeError, "heap argument must be a list"); - return NULL; - } - - if (PyList_Append(heap, item) == -1) - return NULL; - - if (_siftdown((PyListObject *)heap, 0, PyList_GET_SIZE(heap)-1) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(heappush_doc, -"heappush(heap, item) -> None. Push item onto heap, maintaining the heap invariant."); - -static PyObject * -heappop(PyObject *self, PyObject *heap) -{ - PyObject *lastelt, *returnitem; - Py_ssize_t n; - - if (!PyList_Check(heap)) { - PyErr_SetString(PyExc_TypeError, "heap argument must be a list"); - return NULL; - } - - /* # raises appropriate IndexError if heap is empty */ - n = PyList_GET_SIZE(heap); - if (n == 0) { - PyErr_SetString(PyExc_IndexError, "index out of range"); - return NULL; - } - - lastelt = PyList_GET_ITEM(heap, n-1) ; - Py_INCREF(lastelt); - PyList_SetSlice(heap, n-1, n, NULL); - n--; - - if (!n) - return lastelt; - returnitem = PyList_GET_ITEM(heap, 0); - PyList_SET_ITEM(heap, 0, lastelt); - if (_siftup((PyListObject *)heap, 0) == -1) { - Py_DECREF(returnitem); - return NULL; - } - return returnitem; -} - -PyDoc_STRVAR(heappop_doc, -"Pop the smallest item off the heap, maintaining the heap invariant."); - -static PyObject * -heapreplace(PyObject *self, PyObject *args) -{ - PyObject *heap, *item, *returnitem; - - if (!PyArg_UnpackTuple(args, "heapreplace", 2, 2, &heap, &item)) - return NULL; - - if (!PyList_Check(heap)) { - PyErr_SetString(PyExc_TypeError, "heap argument must be a list"); - return NULL; - } - - if (PyList_GET_SIZE(heap) < 1) { - PyErr_SetString(PyExc_IndexError, "index out of range"); - return NULL; - } - - returnitem = PyList_GET_ITEM(heap, 0); - Py_INCREF(item); - PyList_SET_ITEM(heap, 0, item); - if (_siftup((PyListObject *)heap, 0) == -1) { - Py_DECREF(returnitem); - return NULL; - } - return returnitem; -} - -PyDoc_STRVAR(heapreplace_doc, -"heapreplace(heap, item) -> value. Pop and return the current smallest value, and add the new item.\n\ -\n\ -This is more efficient than heappop() followed by heappush(), and can be\n\ -more appropriate when using a fixed-size heap. Note that the value\n\ -returned may be larger than item! That constrains reasonable uses of\n\ -this routine unless written as part of a conditional replacement:\n\n\ - if item > heap[0]:\n\ - item = heapreplace(heap, item)\n"); - -static PyObject * -heappushpop(PyObject *self, PyObject *args) -{ - PyObject *heap, *item, *returnitem; - int cmp; - - if (!PyArg_UnpackTuple(args, "heappushpop", 2, 2, &heap, &item)) - return NULL; - - if (!PyList_Check(heap)) { - PyErr_SetString(PyExc_TypeError, "heap argument must be a list"); - return NULL; - } - - if (PyList_GET_SIZE(heap) < 1) { - Py_INCREF(item); - return item; - } - - cmp = cmp_lt(PyList_GET_ITEM(heap, 0), item); - if (cmp == -1) - return NULL; - if (cmp == 0) { - Py_INCREF(item); - return item; - } - - returnitem = PyList_GET_ITEM(heap, 0); - Py_INCREF(item); - PyList_SET_ITEM(heap, 0, item); - if (_siftup((PyListObject *)heap, 0) == -1) { - Py_DECREF(returnitem); - return NULL; - } - return returnitem; -} - -PyDoc_STRVAR(heappushpop_doc, -"heappushpop(heap, item) -> value. Push item on the heap, then pop and return the smallest item\n\ -from the heap. The combined action runs more efficiently than\n\ -heappush() followed by a separate call to heappop()."); - -static PyObject * -heapify(PyObject *self, PyObject *heap) -{ - Py_ssize_t i, n; - - if (!PyList_Check(heap)) { - PyErr_SetString(PyExc_TypeError, "heap argument must be a list"); - return NULL; - } - - n = PyList_GET_SIZE(heap); - /* Transform bottom-up. The largest index there's any point to - looking at is the largest with a child index in-range, so must - have 2*i + 1 < n, or i < (n-1)/2. If n is even = 2*j, this is - (2*j-1)/2 = j-1/2 so j-1 is the largest, which is n//2 - 1. If - n is odd = 2*j+1, this is (2*j+1-1)/2 = j so j-1 is the largest, - and that's again n//2-1. - */ - for (i=n/2-1 ; i>=0 ; i--) - if(_siftup((PyListObject *)heap, i) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(heapify_doc, -"Transform list into a heap, in-place, in O(len(heap)) time."); - -static PyObject * -nlargest(PyObject *self, PyObject *args) -{ - PyObject *heap=NULL, *elem, *iterable, *sol, *it, *oldelem; - Py_ssize_t i, n; - int cmp; - - if (!PyArg_ParseTuple(args, "nO:nlargest", &n, &iterable)) - return NULL; - - it = PyObject_GetIter(iterable); - if (it == NULL) - return NULL; - - heap = PyList_New(0); - if (heap == NULL) - goto fail; - - for (i=0 ; i=0 ; i--) - if(_siftup((PyListObject *)heap, i) == -1) - goto fail; - - sol = PyList_GET_ITEM(heap, 0); - while (1) { - elem = PyIter_Next(it); - if (elem == NULL) { - if (PyErr_Occurred()) - goto fail; - else - goto sortit; - } - cmp = cmp_lt(sol, elem); - if (cmp == -1) { - Py_DECREF(elem); - goto fail; - } - if (cmp == 0) { - Py_DECREF(elem); - continue; - } - oldelem = PyList_GET_ITEM(heap, 0); - PyList_SET_ITEM(heap, 0, elem); - Py_DECREF(oldelem); - if (_siftup((PyListObject *)heap, 0) == -1) - goto fail; - sol = PyList_GET_ITEM(heap, 0); - } -sortit: - if (PyList_Sort(heap) == -1) - goto fail; - if (PyList_Reverse(heap) == -1) - goto fail; - Py_DECREF(it); - return heap; - -fail: - Py_DECREF(it); - Py_XDECREF(heap); - return NULL; -} - -PyDoc_STRVAR(nlargest_doc, -"Find the n largest elements in a dataset.\n\ -\n\ -Equivalent to: sorted(iterable, reverse=True)[:n]\n"); - -static int -_siftdownmax(PyListObject *heap, Py_ssize_t startpos, Py_ssize_t pos) -{ - PyObject *newitem, *parent; - int cmp; - Py_ssize_t parentpos; - - assert(PyList_Check(heap)); - if (pos >= PyList_GET_SIZE(heap)) { - PyErr_SetString(PyExc_IndexError, "index out of range"); - return -1; - } - - newitem = PyList_GET_ITEM(heap, pos); - Py_INCREF(newitem); - /* Follow the path to the root, moving parents down until finding - a place newitem fits. */ - while (pos > startpos){ - parentpos = (pos - 1) >> 1; - parent = PyList_GET_ITEM(heap, parentpos); - cmp = cmp_lt(parent, newitem); - if (cmp == -1) { - Py_DECREF(newitem); - return -1; - } - if (cmp == 0) - break; - Py_INCREF(parent); - Py_DECREF(PyList_GET_ITEM(heap, pos)); - PyList_SET_ITEM(heap, pos, parent); - pos = parentpos; - } - Py_DECREF(PyList_GET_ITEM(heap, pos)); - PyList_SET_ITEM(heap, pos, newitem); - return 0; -} - -static int -_siftupmax(PyListObject *heap, Py_ssize_t pos) -{ - Py_ssize_t startpos, endpos, childpos, rightpos, limit; - int cmp; - PyObject *newitem, *tmp; - - assert(PyList_Check(heap)); - endpos = PyList_GET_SIZE(heap); - startpos = pos; - if (pos >= endpos) { - PyErr_SetString(PyExc_IndexError, "index out of range"); - return -1; - } - newitem = PyList_GET_ITEM(heap, pos); - Py_INCREF(newitem); - - /* Bubble up the smaller child until hitting a leaf. */ - limit = endpos / 2; /* smallest pos that has no child */ - while (pos < limit) { - /* Set childpos to index of smaller child. */ - childpos = 2*pos + 1; /* leftmost child position */ - rightpos = childpos + 1; - if (rightpos < endpos) { - cmp = cmp_lt( - PyList_GET_ITEM(heap, rightpos), - PyList_GET_ITEM(heap, childpos)); - if (cmp == -1) { - Py_DECREF(newitem); - return -1; - } - if (cmp == 0) - childpos = rightpos; - } - /* Move the smaller child up. */ - tmp = PyList_GET_ITEM(heap, childpos); - Py_INCREF(tmp); - Py_DECREF(PyList_GET_ITEM(heap, pos)); - PyList_SET_ITEM(heap, pos, tmp); - pos = childpos; - } - - /* The leaf at pos is empty now. Put newitem there, and bubble - it up to its final resting place (by sifting its parents down). */ - Py_DECREF(PyList_GET_ITEM(heap, pos)); - PyList_SET_ITEM(heap, pos, newitem); - return _siftdownmax(heap, startpos, pos); -} - -static PyObject * -nsmallest(PyObject *self, PyObject *args) -{ - PyObject *heap=NULL, *elem, *iterable, *los, *it, *oldelem; - Py_ssize_t i, n; - int cmp; - - if (!PyArg_ParseTuple(args, "nO:nsmallest", &n, &iterable)) - return NULL; - - it = PyObject_GetIter(iterable); - if (it == NULL) - return NULL; - - heap = PyList_New(0); - if (heap == NULL) - goto fail; - - for (i=0 ; i=0 ; i--) - if(_siftupmax((PyListObject *)heap, i) == -1) - goto fail; - - los = PyList_GET_ITEM(heap, 0); - while (1) { - elem = PyIter_Next(it); - if (elem == NULL) { - if (PyErr_Occurred()) - goto fail; - else - goto sortit; - } - cmp = cmp_lt(elem, los); - if (cmp == -1) { - Py_DECREF(elem); - goto fail; - } - if (cmp == 0) { - Py_DECREF(elem); - continue; - } - - oldelem = PyList_GET_ITEM(heap, 0); - PyList_SET_ITEM(heap, 0, elem); - Py_DECREF(oldelem); - if (_siftupmax((PyListObject *)heap, 0) == -1) - goto fail; - los = PyList_GET_ITEM(heap, 0); - } - -sortit: - if (PyList_Sort(heap) == -1) - goto fail; - Py_DECREF(it); - return heap; - -fail: - Py_DECREF(it); - Py_XDECREF(heap); - return NULL; -} - -PyDoc_STRVAR(nsmallest_doc, -"Find the n smallest elements in a dataset.\n\ -\n\ -Equivalent to: sorted(iterable)[:n]\n"); - -static PyMethodDef heapq_methods[] = { - {"heappush", (PyCFunction)heappush, - METH_VARARGS, heappush_doc}, - {"heappushpop", (PyCFunction)heappushpop, - METH_VARARGS, heappushpop_doc}, - {"heappop", (PyCFunction)heappop, - METH_O, heappop_doc}, - {"heapreplace", (PyCFunction)heapreplace, - METH_VARARGS, heapreplace_doc}, - {"heapify", (PyCFunction)heapify, - METH_O, heapify_doc}, - {"nlargest", (PyCFunction)nlargest, - METH_VARARGS, nlargest_doc}, - {"nsmallest", (PyCFunction)nsmallest, - METH_VARARGS, nsmallest_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(module_doc, -"Heap queue algorithm (a.k.a. priority queue).\n\ -\n\ -Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\n\ -all k, counting elements from 0. For the sake of comparison,\n\ -non-existing elements are considered to be infinite. The interesting\n\ -property of a heap is that a[0] is always its smallest element.\n\ -\n\ -Usage:\n\ -\n\ -heap = [] # creates an empty heap\n\ -heappush(heap, item) # pushes a new item on the heap\n\ -item = heappop(heap) # pops the smallest item from the heap\n\ -item = heap[0] # smallest item on the heap without popping it\n\ -heapify(x) # transforms list into a heap, in-place, in linear time\n\ -item = heapreplace(heap, item) # pops and returns smallest item, and adds\n\ - # new item; the heap size is unchanged\n\ -\n\ -Our API differs from textbook heap algorithms as follows:\n\ -\n\ -- We use 0-based indexing. This makes the relationship between the\n\ - index for a node and the indexes for its children slightly less\n\ - obvious, but is more suitable since Python uses 0-based indexing.\n\ -\n\ -- Our heappop() method returns the smallest item, not the largest.\n\ -\n\ -These two make it possible to view the heap as a regular Python list\n\ -without surprises: heap[0] is the smallest item, and heap.sort()\n\ -maintains the heap invariant!\n"); - - -PyDoc_STRVAR(__about__, -"Heap queues\n\ -\n\ -[explanation by François Pinard]\n\ -\n\ -Heaps are arrays for which a[k] <= a[2*k+1] and a[k] <= a[2*k+2] for\n\ -all k, counting elements from 0. For the sake of comparison,\n\ -non-existing elements are considered to be infinite. The interesting\n\ -property of a heap is that a[0] is always its smallest element.\n" -"\n\ -The strange invariant above is meant to be an efficient memory\n\ -representation for a tournament. The numbers below are `k', not a[k]:\n\ -\n\ - 0\n\ -\n\ - 1 2\n\ -\n\ - 3 4 5 6\n\ -\n\ - 7 8 9 10 11 12 13 14\n\ -\n\ - 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30\n\ -\n\ -\n\ -In the tree above, each cell `k' is topping `2*k+1' and `2*k+2'. In\n\ -an usual binary tournament we see in sports, each cell is the winner\n\ -over the two cells it tops, and we can trace the winner down the tree\n\ -to see all opponents s/he had. However, in many computer applications\n\ -of such tournaments, we do not need to trace the history of a winner.\n\ -To be more memory efficient, when a winner is promoted, we try to\n\ -replace it by something else at a lower level, and the rule becomes\n\ -that a cell and the two cells it tops contain three different items,\n\ -but the top cell \"wins\" over the two topped cells.\n" -"\n\ -If this heap invariant is protected at all time, index 0 is clearly\n\ -the overall winner. The simplest algorithmic way to remove it and\n\ -find the \"next\" winner is to move some loser (let's say cell 30 in the\n\ -diagram above) into the 0 position, and then percolate this new 0 down\n\ -the tree, exchanging values, until the invariant is re-established.\n\ -This is clearly logarithmic on the total number of items in the tree.\n\ -By iterating over all items, you get an O(n ln n) sort.\n" -"\n\ -A nice feature of this sort is that you can efficiently insert new\n\ -items while the sort is going on, provided that the inserted items are\n\ -not \"better\" than the last 0'th element you extracted. This is\n\ -especially useful in simulation contexts, where the tree holds all\n\ -incoming events, and the \"win\" condition means the smallest scheduled\n\ -time. When an event schedule other events for execution, they are\n\ -scheduled into the future, so they can easily go into the heap. So, a\n\ -heap is a good structure for implementing schedulers (this is what I\n\ -used for my MIDI sequencer :-).\n" -"\n\ -Various structures for implementing schedulers have been extensively\n\ -studied, and heaps are good for this, as they are reasonably speedy,\n\ -the speed is almost constant, and the worst case is not much different\n\ -than the average case. However, there are other representations which\n\ -are more efficient overall, yet the worst cases might be terrible.\n" -"\n\ -Heaps are also very useful in big disk sorts. You most probably all\n\ -know that a big sort implies producing \"runs\" (which are pre-sorted\n\ -sequences, which size is usually related to the amount of CPU memory),\n\ -followed by a merging passes for these runs, which merging is often\n\ -very cleverly organised[1]. It is very important that the initial\n\ -sort produces the longest runs possible. Tournaments are a good way\n\ -to that. If, using all the memory available to hold a tournament, you\n\ -replace and percolate items that happen to fit the current run, you'll\n\ -produce runs which are twice the size of the memory for random input,\n\ -and much better for input fuzzily ordered.\n" -"\n\ -Moreover, if you output the 0'th item on disk and get an input which\n\ -may not fit in the current tournament (because the value \"wins\" over\n\ -the last output value), it cannot fit in the heap, so the size of the\n\ -heap decreases. The freed memory could be cleverly reused immediately\n\ -for progressively building a second heap, which grows at exactly the\n\ -same rate the first heap is melting. When the first heap completely\n\ -vanishes, you switch heaps and start a new run. Clever and quite\n\ -effective!\n\ -\n\ -In a word, heaps are useful memory structures to know. I use them in\n\ -a few applications, and I think it is good to keep a `heap' module\n\ -around. :-)\n" -"\n\ ---------------------\n\ -[1] The disk balancing algorithms which are current, nowadays, are\n\ -more annoying than clever, and this is a consequence of the seeking\n\ -capabilities of the disks. On devices which cannot seek, like big\n\ -tape drives, the story was quite different, and one had to be very\n\ -clever to ensure (far in advance) that each tape movement will be the\n\ -most effective possible (that is, will best participate at\n\ -\"progressing\" the merge). Some tapes were even able to read\n\ -backwards, and this was also used to avoid the rewinding time.\n\ -Believe me, real good tape sorts were quite spectacular to watch!\n\ -From all times, sorting has always been a Great Art! :-)\n"); - -PyMODINIT_FUNC -init_heapq(void) -{ - PyObject *m; - - m = Py_InitModule3("_heapq", heapq_methods, module_doc); - if (m == NULL) - return; - PyModule_AddObject(m, "__about__", PyString_FromString(__about__)); -} - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.c deleted file mode 100644 index 9cd1086..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.c +++ /dev/null @@ -1,777 +0,0 @@ -/* - An implementation of the new I/O lib as defined by PEP 3116 - "New I/O" - - Classes defined here: UnsupportedOperation, BlockingIOError. - Functions defined here: open(). - - Mostly written by Amaury Forgeot d'Arc -*/ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "_iomodule.h" - -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef HAVE_SYS_STAT_H -#include -#endif /* HAVE_SYS_STAT_H */ - - -/* Various interned strings */ - -PyObject *_PyIO_str_close; -PyObject *_PyIO_str_closed; -PyObject *_PyIO_str_decode; -PyObject *_PyIO_str_encode; -PyObject *_PyIO_str_fileno; -PyObject *_PyIO_str_flush; -PyObject *_PyIO_str_getstate; -PyObject *_PyIO_str_isatty; -PyObject *_PyIO_str_newlines; -PyObject *_PyIO_str_nl; -PyObject *_PyIO_str_read; -PyObject *_PyIO_str_read1; -PyObject *_PyIO_str_readable; -PyObject *_PyIO_str_readinto; -PyObject *_PyIO_str_readline; -PyObject *_PyIO_str_reset; -PyObject *_PyIO_str_seek; -PyObject *_PyIO_str_seekable; -PyObject *_PyIO_str_setstate; -PyObject *_PyIO_str_tell; -PyObject *_PyIO_str_truncate; -PyObject *_PyIO_str_writable; -PyObject *_PyIO_str_write; - -PyObject *_PyIO_empty_str; -PyObject *_PyIO_empty_bytes; -PyObject *_PyIO_zero; - - -PyDoc_STRVAR(module_doc, -"The io module provides the Python interfaces to stream handling. The\n" -"builtin open function is defined in this module.\n" -"\n" -"At the top of the I/O hierarchy is the abstract base class IOBase. It\n" -"defines the basic interface to a stream. Note, however, that there is no\n" -"separation between reading and writing to streams; implementations are\n" -"allowed to raise an IOError if they do not support a given operation.\n" -"\n" -"Extending IOBase is RawIOBase which deals simply with the reading and\n" -"writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide\n" -"an interface to OS files.\n" -"\n" -"BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its\n" -"subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer\n" -"streams that are readable, writable, and both respectively.\n" -"BufferedRandom provides a buffered interface to random access\n" -"streams. BytesIO is a simple stream of in-memory bytes.\n" -"\n" -"Another IOBase subclass, TextIOBase, deals with the encoding and decoding\n" -"of streams into text. TextIOWrapper, which extends it, is a buffered text\n" -"interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO\n" -"is a in-memory stream for text.\n" -"\n" -"Argument names are not part of the specification, and only the arguments\n" -"of open() are intended to be used as keyword arguments.\n" -"\n" -"data:\n" -"\n" -"DEFAULT_BUFFER_SIZE\n" -"\n" -" An int containing the default buffer size used by the module's buffered\n" -" I/O classes. open() uses the file's blksize (as obtained by os.stat) if\n" -" possible.\n" - ); - - -/* - * BlockingIOError extends IOError - */ - -static int -blockingioerror_init(PyBlockingIOErrorObject *self, PyObject *args, - PyObject *kwds) -{ - PyObject *myerrno = NULL, *strerror = NULL; - PyObject *baseargs = NULL; - Py_ssize_t written = 0; - - assert(PyTuple_Check(args)); - - self->written = 0; - if (!PyArg_ParseTuple(args, "OO|n:BlockingIOError", - &myerrno, &strerror, &written)) - return -1; - - baseargs = PyTuple_Pack(2, myerrno, strerror); - if (baseargs == NULL) - return -1; - /* This will take care of initializing of myerrno and strerror members */ - if (((PyTypeObject *)PyExc_IOError)->tp_init( - (PyObject *)self, baseargs, kwds) == -1) { - Py_DECREF(baseargs); - return -1; - } - Py_DECREF(baseargs); - - self->written = written; - return 0; -} - -static PyMemberDef blockingioerror_members[] = { - {"characters_written", T_PYSSIZET, offsetof(PyBlockingIOErrorObject, written), 0}, - {NULL} /* Sentinel */ -}; - -static PyTypeObject _PyExc_BlockingIOError = { - PyVarObject_HEAD_INIT(NULL, 0) - "BlockingIOError", /*tp_name*/ - sizeof(PyBlockingIOErrorObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - PyDoc_STR("Exception raised when I/O would block " - "on a non-blocking I/O stream"), /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - blockingioerror_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)blockingioerror_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; -PyObject *PyExc_BlockingIOError = (PyObject *)&_PyExc_BlockingIOError; - - -/* - * The main open() function - */ -PyDoc_STRVAR(open_doc, -"Open file and return a stream. Raise IOError upon failure.\n" -"\n" -"file is either a text or byte string giving the name (and the path\n" -"if the file isn't in the current working directory) of the file to\n" -"be opened or an integer file descriptor of the file to be\n" -"wrapped. (If a file descriptor is given, it is closed when the\n" -"returned I/O object is closed, unless closefd is set to False.)\n" -"\n" -"mode is an optional string that specifies the mode in which the file\n" -"is opened. It defaults to 'r' which means open for reading in text\n" -"mode. Other common values are 'w' for writing (truncating the file if\n" -"it already exists), and 'a' for appending (which on some Unix systems,\n" -"means that all writes append to the end of the file regardless of the\n" -"current seek position). In text mode, if encoding is not specified the\n" -"encoding used is platform dependent. (For reading and writing raw\n" -"bytes use binary mode and leave encoding unspecified.) The available\n" -"modes are:\n" -"\n" -"========= ===============================================================\n" -"Character Meaning\n" -"--------- ---------------------------------------------------------------\n" -"'r' open for reading (default)\n" -"'w' open for writing, truncating the file first\n" -"'a' open for writing, appending to the end of the file if it exists\n" -"'b' binary mode\n" -"'t' text mode (default)\n" -"'+' open a disk file for updating (reading and writing)\n" -"'U' universal newline mode (for backwards compatibility; unneeded\n" -" for new code)\n" -"========= ===============================================================\n" -"\n" -"The default mode is 'rt' (open for reading text). For binary random\n" -"access, the mode 'w+b' opens and truncates the file to 0 bytes, while\n" -"'r+b' opens the file without truncation.\n" -"\n" -"Python distinguishes between files opened in binary and text modes,\n" -"even when the underlying operating system doesn't. Files opened in\n" -"binary mode (appending 'b' to the mode argument) return contents as\n" -"bytes objects without any decoding. In text mode (the default, or when\n" -"'t' is appended to the mode argument), the contents of the file are\n" -"returned as strings, the bytes having been first decoded using a\n" -"platform-dependent encoding or using the specified encoding if given.\n" -"\n" -"buffering is an optional integer used to set the buffering policy.\n" -"Pass 0 to switch buffering off (only allowed in binary mode), 1 to select\n" -"line buffering (only usable in text mode), and an integer > 1 to indicate\n" -"the size of a fixed-size chunk buffer. When no buffering argument is\n" -"given, the default buffering policy works as follows:\n" -"\n" -"* Binary files are buffered in fixed-size chunks; the size of the buffer\n" -" is chosen using a heuristic trying to determine the underlying device's\n" -" \"block size\" and falling back on `io.DEFAULT_BUFFER_SIZE`.\n" -" On many systems, the buffer will typically be 4096 or 8192 bytes long.\n" -"\n" -"* \"Interactive\" text files (files for which isatty() returns True)\n" -" use line buffering. Other text files use the policy described above\n" -" for binary files.\n" -"\n" -"encoding is the name of the encoding used to decode or encode the\n" -"file. This should only be used in text mode. The default encoding is\n" -"platform dependent, but any encoding supported by Python can be\n" -"passed. See the codecs module for the list of supported encodings.\n" -"\n" -"errors is an optional string that specifies how encoding errors are to\n" -"be handled---this argument should not be used in binary mode. Pass\n" -"'strict' to raise a ValueError exception if there is an encoding error\n" -"(the default of None has the same effect), or pass 'ignore' to ignore\n" -"errors. (Note that ignoring encoding errors can lead to data loss.)\n" -"See the documentation for codecs.register for a list of the permitted\n" -"encoding error strings.\n" -"\n" -"newline controls how universal newlines works (it only applies to text\n" -"mode). It can be None, '', '\\n', '\\r', and '\\r\\n'. It works as\n" -"follows:\n" -"\n" -"* On input, if newline is None, universal newlines mode is\n" -" enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n" -" these are translated into '\\n' before being returned to the\n" -" caller. If it is '', universal newline mode is enabled, but line\n" -" endings are returned to the caller untranslated. If it has any of\n" -" the other legal values, input lines are only terminated by the given\n" -" string, and the line ending is returned to the caller untranslated.\n" -"\n" -"* On output, if newline is None, any '\\n' characters written are\n" -" translated to the system default line separator, os.linesep. If\n" -" newline is '', no translation takes place. If newline is any of the\n" -" other legal values, any '\\n' characters written are translated to\n" -" the given string.\n" -"\n" -"If closefd is False, the underlying file descriptor will be kept open\n" -"when the file is closed. This does not work when a file name is given\n" -"and must be True in that case.\n" -"\n" -"open() returns a file object whose type depends on the mode, and\n" -"through which the standard file operations such as reading and writing\n" -"are performed. When open() is used to open a file in a text mode ('w',\n" -"'r', 'wt', 'rt', etc.), it returns a TextIOWrapper. When used to open\n" -"a file in a binary mode, the returned class varies: in read binary\n" -"mode, it returns a BufferedReader; in write binary and append binary\n" -"modes, it returns a BufferedWriter, and in read/write mode, it returns\n" -"a BufferedRandom.\n" -"\n" -"It is also possible to use a string or bytearray as a file for both\n" -"reading and writing. For strings StringIO can be used like a file\n" -"opened in a text mode, and for bytes a BytesIO can be used like a file\n" -"opened in a binary mode.\n" - ); - -static PyObject * -io_open(PyObject *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"file", "mode", "buffering", - "encoding", "errors", "newline", - "closefd", NULL}; - PyObject *file; - char *mode = "r"; - int buffering = -1, closefd = 1; - char *encoding = NULL, *errors = NULL, *newline = NULL; - unsigned i; - - int reading = 0, writing = 0, appending = 0, updating = 0; - int text = 0, binary = 0, universal = 0; - - char rawmode[5], *m; - int line_buffering; - long isatty; - - PyObject *raw, *modeobj = NULL, *buffer, *wrapper, *result = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|sizzzi:open", kwlist, - &file, &mode, &buffering, - &encoding, &errors, &newline, - &closefd)) { - return NULL; - } - - if (!PyUnicode_Check(file) && - !PyBytes_Check(file) && - !PyNumber_Check(file)) { - PyObject *repr = PyObject_Repr(file); - if (repr != NULL) { - PyErr_Format(PyExc_TypeError, "invalid file: %s", - PyString_AS_STRING(repr)); - Py_DECREF(repr); - } - return NULL; - } - - /* Decode mode */ - for (i = 0; i < strlen(mode); i++) { - char c = mode[i]; - - switch (c) { - case 'r': - reading = 1; - break; - case 'w': - writing = 1; - break; - case 'a': - appending = 1; - break; - case '+': - updating = 1; - break; - case 't': - text = 1; - break; - case 'b': - binary = 1; - break; - case 'U': - universal = 1; - reading = 1; - break; - default: - goto invalid_mode; - } - - /* c must not be duplicated */ - if (strchr(mode+i+1, c)) { - invalid_mode: - PyErr_Format(PyExc_ValueError, "invalid mode: '%s'", mode); - return NULL; - } - - } - - m = rawmode; - if (reading) *(m++) = 'r'; - if (writing) *(m++) = 'w'; - if (appending) *(m++) = 'a'; - if (updating) *(m++) = '+'; - *m = '\0'; - - /* Parameters validation */ - if (universal) { - if (writing || appending) { - PyErr_SetString(PyExc_ValueError, - "can't use U and writing mode at once"); - return NULL; - } - reading = 1; - } - - if (text && binary) { - PyErr_SetString(PyExc_ValueError, - "can't have text and binary mode at once"); - return NULL; - } - - if (reading + writing + appending > 1) { - PyErr_SetString(PyExc_ValueError, - "must have exactly one of read/write/append mode"); - return NULL; - } - - if (binary && encoding != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take an encoding argument"); - return NULL; - } - - if (binary && errors != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take an errors argument"); - return NULL; - } - - if (binary && newline != NULL) { - PyErr_SetString(PyExc_ValueError, - "binary mode doesn't take a newline argument"); - return NULL; - } - - /* Create the Raw file stream */ - raw = PyObject_CallFunction((PyObject *)&PyFileIO_Type, - "Osi", file, rawmode, closefd); - if (raw == NULL) - return NULL; - result = raw; - - modeobj = PyUnicode_FromString(mode); - if (modeobj == NULL) - goto error; - - /* buffering */ - { - PyObject *res = PyObject_CallMethod(raw, "isatty", NULL); - if (res == NULL) - goto error; - isatty = PyLong_AsLong(res); - Py_DECREF(res); - if (isatty == -1 && PyErr_Occurred()) - goto error; - } - - if (buffering == 1 || (buffering < 0 && isatty)) { - buffering = -1; - line_buffering = 1; - } - else - line_buffering = 0; - - if (buffering < 0) { - buffering = DEFAULT_BUFFER_SIZE; -#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - { - struct stat st; - int fileno; - PyObject *res = PyObject_CallMethod(raw, "fileno", NULL); - if (res == NULL) - goto error; - - fileno = _PyInt_AsInt(res); - Py_DECREF(res); - if (fileno == -1 && PyErr_Occurred()) - goto error; - - if (fstat(fileno, &st) >= 0 && st.st_blksize > 1) - buffering = st.st_blksize; - } -#endif - } - if (buffering < 0) { - PyErr_SetString(PyExc_ValueError, - "invalid buffering size"); - goto error; - } - - /* if not buffering, returns the raw file object */ - if (buffering == 0) { - if (!binary) { - PyErr_SetString(PyExc_ValueError, - "can't have unbuffered text I/O"); - goto error; - } - - Py_DECREF(modeobj); - return result; - } - - /* wraps into a buffered file */ - { - PyObject *Buffered_class; - - if (updating) - Buffered_class = (PyObject *)&PyBufferedRandom_Type; - else if (writing || appending) - Buffered_class = (PyObject *)&PyBufferedWriter_Type; - else if (reading) - Buffered_class = (PyObject *)&PyBufferedReader_Type; - else { - PyErr_Format(PyExc_ValueError, - "unknown mode: '%s'", mode); - goto error; - } - - buffer = PyObject_CallFunction(Buffered_class, "Oi", raw, buffering); - } - if (buffer == NULL) - goto error; - result = buffer; - Py_DECREF(raw); - - - /* if binary, returns the buffered file */ - if (binary) { - Py_DECREF(modeobj); - return result; - } - - /* wraps into a TextIOWrapper */ - wrapper = PyObject_CallFunction((PyObject *)&PyTextIOWrapper_Type, - "Osssi", - buffer, - encoding, errors, newline, - line_buffering); - if (wrapper == NULL) - goto error; - result = wrapper; - Py_DECREF(buffer); - - if (PyObject_SetAttrString(wrapper, "mode", modeobj) < 0) - goto error; - Py_DECREF(modeobj); - return result; - - error: - if (result != NULL) { - PyObject *exc, *val, *tb, *close_result; - PyErr_Fetch(&exc, &val, &tb); - close_result = PyObject_CallMethod(result, "close", NULL); - _PyErr_ReplaceException(exc, val, tb); - Py_XDECREF(close_result); - Py_DECREF(result); - } - Py_XDECREF(modeobj); - return NULL; -} - -/* - * Private helpers for the io module. - */ - -Py_off_t -PyNumber_AsOff_t(PyObject *item, PyObject *err) -{ - Py_off_t result; - PyObject *runerr; - PyObject *value = PyNumber_Index(item); - if (value == NULL) - return -1; - - if (PyInt_Check(value)) { - /* We assume a long always fits in a Py_off_t... */ - result = (Py_off_t) PyInt_AS_LONG(value); - goto finish; - } - - /* We're done if PyLong_AsSsize_t() returns without error. */ - result = PyLong_AsOff_t(value); - if (result != -1 || !(runerr = PyErr_Occurred())) - goto finish; - - /* Error handling code -- only manage OverflowError differently */ - if (!PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) - goto finish; - - PyErr_Clear(); - /* If no error-handling desired then the default clipping - is sufficient. - */ - if (!err) { - assert(PyLong_Check(value)); - /* Whether or not it is less than or equal to - zero is determined by the sign of ob_size - */ - if (_PyLong_Sign(value) < 0) - result = PY_OFF_T_MIN; - else - result = PY_OFF_T_MAX; - } - else { - /* Otherwise replace the error with caller's error object. */ - PyErr_Format(err, - "cannot fit '%.200s' into an offset-sized integer", - item->ob_type->tp_name); - } - - finish: - Py_DECREF(value); - return result; -} - - -/* Basically the "n" format code with the ability to turn None into -1. */ -int -_PyIO_ConvertSsize_t(PyObject *obj, void *result) { - Py_ssize_t limit; - if (obj == Py_None) { - limit = -1; - } - else if (PyNumber_Check(obj)) { - limit = PyNumber_AsSsize_t(obj, PyExc_OverflowError); - if (limit == -1 && PyErr_Occurred()) - return 0; - } - else { - PyErr_Format(PyExc_TypeError, - "integer argument expected, got '%.200s'", - Py_TYPE(obj)->tp_name); - return 0; - } - *((Py_ssize_t *)result) = limit; - return 1; -} - - -/* - * Module definition - */ - -PyObject *_PyIO_os_module = NULL; -PyObject *_PyIO_locale_module = NULL; -PyObject *_PyIO_unsupported_operation = NULL; - -static PyMethodDef module_methods[] = { - {"open", (PyCFunction)io_open, METH_VARARGS|METH_KEYWORDS, open_doc}, - {NULL, NULL} -}; - -PyMODINIT_FUNC -init_io(void) -{ - PyObject *m = Py_InitModule4("_io", module_methods, - module_doc, NULL, PYTHON_API_VERSION); - if (m == NULL) - return; - - /* put os in the module state */ - _PyIO_os_module = PyImport_ImportModule("os"); - if (_PyIO_os_module == NULL) - goto fail; - -#define ADD_TYPE(type, name) \ - if (PyType_Ready(type) < 0) \ - goto fail; \ - Py_INCREF(type); \ - if (PyModule_AddObject(m, name, (PyObject *)type) < 0) { \ - Py_DECREF(type); \ - goto fail; \ - } - - /* DEFAULT_BUFFER_SIZE */ - if (PyModule_AddIntMacro(m, DEFAULT_BUFFER_SIZE) < 0) - goto fail; - - /* UnsupportedOperation inherits from ValueError and IOError */ - _PyIO_unsupported_operation = PyObject_CallFunction( - (PyObject *)&PyType_Type, "s(OO){}", - "UnsupportedOperation", PyExc_ValueError, PyExc_IOError); - if (_PyIO_unsupported_operation == NULL) - goto fail; - Py_INCREF(_PyIO_unsupported_operation); - if (PyModule_AddObject(m, "UnsupportedOperation", - _PyIO_unsupported_operation) < 0) - goto fail; - - /* BlockingIOError */ - _PyExc_BlockingIOError.tp_base = (PyTypeObject *) PyExc_IOError; - ADD_TYPE(&_PyExc_BlockingIOError, "BlockingIOError"); - - /* Concrete base types of the IO ABCs. - (the ABCs themselves are declared through inheritance in io.py) - */ - ADD_TYPE(&PyIOBase_Type, "_IOBase"); - ADD_TYPE(&PyRawIOBase_Type, "_RawIOBase"); - ADD_TYPE(&PyBufferedIOBase_Type, "_BufferedIOBase"); - ADD_TYPE(&PyTextIOBase_Type, "_TextIOBase"); - - /* Implementation of concrete IO objects. */ - /* FileIO */ - PyFileIO_Type.tp_base = &PyRawIOBase_Type; - ADD_TYPE(&PyFileIO_Type, "FileIO"); - - /* BytesIO */ - PyBytesIO_Type.tp_base = &PyBufferedIOBase_Type; - ADD_TYPE(&PyBytesIO_Type, "BytesIO"); - - /* StringIO */ - PyStringIO_Type.tp_base = &PyTextIOBase_Type; - ADD_TYPE(&PyStringIO_Type, "StringIO"); - - /* BufferedReader */ - PyBufferedReader_Type.tp_base = &PyBufferedIOBase_Type; - ADD_TYPE(&PyBufferedReader_Type, "BufferedReader"); - - /* BufferedWriter */ - PyBufferedWriter_Type.tp_base = &PyBufferedIOBase_Type; - ADD_TYPE(&PyBufferedWriter_Type, "BufferedWriter"); - - /* BufferedRWPair */ - PyBufferedRWPair_Type.tp_base = &PyBufferedIOBase_Type; - ADD_TYPE(&PyBufferedRWPair_Type, "BufferedRWPair"); - - /* BufferedRandom */ - PyBufferedRandom_Type.tp_base = &PyBufferedIOBase_Type; - ADD_TYPE(&PyBufferedRandom_Type, "BufferedRandom"); - - /* TextIOWrapper */ - PyTextIOWrapper_Type.tp_base = &PyTextIOBase_Type; - ADD_TYPE(&PyTextIOWrapper_Type, "TextIOWrapper"); - - /* IncrementalNewlineDecoder */ - ADD_TYPE(&PyIncrementalNewlineDecoder_Type, "IncrementalNewlineDecoder"); - - /* Interned strings */ - if (!(_PyIO_str_close = PyString_InternFromString("close"))) - goto fail; - if (!(_PyIO_str_closed = PyString_InternFromString("closed"))) - goto fail; - if (!(_PyIO_str_decode = PyString_InternFromString("decode"))) - goto fail; - if (!(_PyIO_str_encode = PyString_InternFromString("encode"))) - goto fail; - if (!(_PyIO_str_fileno = PyString_InternFromString("fileno"))) - goto fail; - if (!(_PyIO_str_flush = PyString_InternFromString("flush"))) - goto fail; - if (!(_PyIO_str_getstate = PyString_InternFromString("getstate"))) - goto fail; - if (!(_PyIO_str_isatty = PyString_InternFromString("isatty"))) - goto fail; - if (!(_PyIO_str_newlines = PyString_InternFromString("newlines"))) - goto fail; - if (!(_PyIO_str_nl = PyString_InternFromString("\n"))) - goto fail; - if (!(_PyIO_str_read = PyString_InternFromString("read"))) - goto fail; - if (!(_PyIO_str_read1 = PyString_InternFromString("read1"))) - goto fail; - if (!(_PyIO_str_readable = PyString_InternFromString("readable"))) - goto fail; - if (!(_PyIO_str_readinto = PyString_InternFromString("readinto"))) - goto fail; - if (!(_PyIO_str_readline = PyString_InternFromString("readline"))) - goto fail; - if (!(_PyIO_str_reset = PyString_InternFromString("reset"))) - goto fail; - if (!(_PyIO_str_seek = PyString_InternFromString("seek"))) - goto fail; - if (!(_PyIO_str_seekable = PyString_InternFromString("seekable"))) - goto fail; - if (!(_PyIO_str_setstate = PyString_InternFromString("setstate"))) - goto fail; - if (!(_PyIO_str_tell = PyString_InternFromString("tell"))) - goto fail; - if (!(_PyIO_str_truncate = PyString_InternFromString("truncate"))) - goto fail; - if (!(_PyIO_str_write = PyString_InternFromString("write"))) - goto fail; - if (!(_PyIO_str_writable = PyString_InternFromString("writable"))) - goto fail; - - if (!(_PyIO_empty_str = PyUnicode_FromStringAndSize(NULL, 0))) - goto fail; - if (!(_PyIO_empty_bytes = PyBytes_FromStringAndSize(NULL, 0))) - goto fail; - if (!(_PyIO_zero = PyLong_FromLong(0L))) - goto fail; - - return; - - fail: - Py_CLEAR(_PyIO_os_module); - Py_CLEAR(_PyIO_unsupported_operation); - Py_DECREF(m); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.h deleted file mode 100644 index 054048d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/_iomodule.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Declarations shared between the different parts of the io module - */ - -/* ABCs */ -extern PyTypeObject PyIOBase_Type; -extern PyTypeObject PyRawIOBase_Type; -extern PyTypeObject PyBufferedIOBase_Type; -extern PyTypeObject PyTextIOBase_Type; - -/* Concrete classes */ -extern PyTypeObject PyFileIO_Type; -extern PyTypeObject PyBytesIO_Type; -extern PyTypeObject PyStringIO_Type; -extern PyTypeObject PyBufferedReader_Type; -extern PyTypeObject PyBufferedWriter_Type; -extern PyTypeObject PyBufferedRWPair_Type; -extern PyTypeObject PyBufferedRandom_Type; -extern PyTypeObject PyTextIOWrapper_Type; -extern PyTypeObject PyIncrementalNewlineDecoder_Type; - - -extern int _PyIO_ConvertSsize_t(PyObject *, void *); - -/* These functions are used as METH_NOARGS methods, are normally called - * with args=NULL, and return a new reference. - * BUT when args=Py_True is passed, they return a borrowed reference. - */ -extern PyObject* _PyIOBase_check_readable(PyObject *self, PyObject *args); -extern PyObject* _PyIOBase_check_writable(PyObject *self, PyObject *args); -extern PyObject* _PyIOBase_check_seekable(PyObject *self, PyObject *args); -extern PyObject* _PyIOBase_check_closed(PyObject *self, PyObject *args); - -/* Helper for finalization. - This function will revive an object ready to be deallocated and try to - close() it. It returns 0 if the object can be destroyed, or -1 if it - is alive again. */ -extern int _PyIOBase_finalize(PyObject *self); - -/* Returns true if the given FileIO object is closed. - Doesn't check the argument type, so be careful! */ -extern int _PyFileIO_closed(PyObject *self); - -/* Shortcut to the core of the IncrementalNewlineDecoder.decode method */ -extern PyObject *_PyIncrementalNewlineDecoder_decode( - PyObject *self, PyObject *input, int final); - -/* Finds the first line ending between `start` and `end`. - If found, returns the index after the line ending and doesn't touch - `*consumed`. - If not found, returns -1 and sets `*consumed` to the number of characters - which can be safely put aside until another search. - - NOTE: for performance reasons, `end` must point to a NUL character ('\0'). - Otherwise, the function will scan further and return garbage. */ -extern Py_ssize_t _PyIO_find_line_ending( - int translated, int universal, PyObject *readnl, - Py_UNICODE *start, Py_UNICODE *end, Py_ssize_t *consumed); - -/* Return 1 if an EnvironmentError with errno == EINTR is set (and then - clears the error indicator), 0 otherwise. - Should only be called when PyErr_Occurred() is true. -*/ -extern int _PyIO_trap_eintr(void); - -#define DEFAULT_BUFFER_SIZE (8 * 1024) /* bytes */ - -typedef struct { - /* This is the equivalent of PyException_HEAD in 3.x */ - PyObject_HEAD - PyObject *dict; - PyObject *args; - PyObject *message; - - PyObject *myerrno; - PyObject *strerror; - PyObject *filename; /* Not used, but part of the IOError object */ - Py_ssize_t written; -} PyBlockingIOErrorObject; -extern PyObject *PyExc_BlockingIOError; - -/* - * Offset type for positioning. - */ - -/* Printing a variable of type off_t (with e.g., PyString_FromFormat) - correctly and without producing compiler warnings is surprisingly painful. - We identify an integer type whose size matches off_t and then: (1) cast the - off_t to that integer type and (2) use the appropriate conversion - specification. The cast is necessary: gcc complains about formatting a - long with "%lld" even when both long and long long have the same - precision. */ - -#if defined(MS_WIN64) || defined(MS_WINDOWS) - -/* Windows uses long long for offsets */ -typedef PY_LONG_LONG Py_off_t; -# define PyLong_AsOff_t PyLong_AsLongLong -# define PyLong_FromOff_t PyLong_FromLongLong -# define PY_OFF_T_MAX PY_LLONG_MAX -# define PY_OFF_T_MIN PY_LLONG_MIN -# define PY_OFF_T_COMPAT PY_LONG_LONG /* type compatible with off_t */ -# define PY_PRIdOFF "lld" /* format to use for that type */ - -#else - -/* Other platforms use off_t */ -typedef off_t Py_off_t; -#if (SIZEOF_OFF_T == SIZEOF_SIZE_T) -# define PyLong_AsOff_t PyLong_AsSsize_t -# define PyLong_FromOff_t PyLong_FromSsize_t -# define PY_OFF_T_MAX PY_SSIZE_T_MAX -# define PY_OFF_T_MIN PY_SSIZE_T_MIN -# define PY_OFF_T_COMPAT Py_ssize_t -# define PY_PRIdOFF "zd" -#elif (HAVE_LONG_LONG && SIZEOF_OFF_T == SIZEOF_LONG_LONG) -# define PyLong_AsOff_t PyLong_AsLongLong -# define PyLong_FromOff_t PyLong_FromLongLong -# define PY_OFF_T_MAX PY_LLONG_MAX -# define PY_OFF_T_MIN PY_LLONG_MIN -# define PY_OFF_T_COMPAT PY_LONG_LONG -# define PY_PRIdOFF "lld" -#elif (SIZEOF_OFF_T == SIZEOF_LONG) -# define PyLong_AsOff_t PyLong_AsLong -# define PyLong_FromOff_t PyLong_FromLong -# define PY_OFF_T_MAX LONG_MAX -# define PY_OFF_T_MIN LONG_MIN -# define PY_OFF_T_COMPAT long -# define PY_PRIdOFF "ld" -#else -# error off_t does not match either size_t, long, or long long! -#endif - -#endif - -extern Py_off_t PyNumber_AsOff_t(PyObject *item, PyObject *err); - -/* Implementation details */ - -extern PyObject *_PyIO_os_module; -extern PyObject *_PyIO_locale_module; -extern PyObject *_PyIO_unsupported_operation; - -extern PyObject *_PyIO_str_close; -extern PyObject *_PyIO_str_closed; -extern PyObject *_PyIO_str_decode; -extern PyObject *_PyIO_str_encode; -extern PyObject *_PyIO_str_fileno; -extern PyObject *_PyIO_str_flush; -extern PyObject *_PyIO_str_getstate; -extern PyObject *_PyIO_str_isatty; -extern PyObject *_PyIO_str_newlines; -extern PyObject *_PyIO_str_nl; -extern PyObject *_PyIO_str_read; -extern PyObject *_PyIO_str_read1; -extern PyObject *_PyIO_str_readable; -extern PyObject *_PyIO_str_readinto; -extern PyObject *_PyIO_str_readline; -extern PyObject *_PyIO_str_reset; -extern PyObject *_PyIO_str_seek; -extern PyObject *_PyIO_str_seekable; -extern PyObject *_PyIO_str_setstate; -extern PyObject *_PyIO_str_tell; -extern PyObject *_PyIO_str_truncate; -extern PyObject *_PyIO_str_writable; -extern PyObject *_PyIO_str_write; - -extern PyObject *_PyIO_empty_str; -extern PyObject *_PyIO_empty_bytes; -extern PyObject *_PyIO_zero; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bufferedio.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bufferedio.c deleted file mode 100644 index b7894b0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bufferedio.c +++ /dev/null @@ -1,2446 +0,0 @@ -/* - An implementation of Buffered I/O as defined by PEP 3116 - "New I/O" - - Classes defined here: BufferedIOBase, BufferedReader, BufferedWriter, - BufferedRandom. - - Written by Amaury Forgeot d'Arc and Antoine Pitrou -*/ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "pythread.h" -#include "_iomodule.h" - -/* - * BufferedIOBase class, inherits from IOBase. - */ -PyDoc_STRVAR(bufferediobase_doc, - "Base class for buffered IO objects.\n" - "\n" - "The main difference with RawIOBase is that the read() method\n" - "supports omitting the size argument, and does not have a default\n" - "implementation that defers to readinto().\n" - "\n" - "In addition, read(), readinto() and write() may raise\n" - "BlockingIOError if the underlying raw stream is in non-blocking\n" - "mode and not ready; unlike their raw counterparts, they will never\n" - "return None.\n" - "\n" - "A typical implementation should not inherit from a RawIOBase\n" - "implementation, but wrap one.\n" - ); - -static PyObject * -bufferediobase_readinto(PyObject *self, PyObject *args) -{ - Py_buffer buf; - Py_ssize_t len; - PyObject *data; - - if (!PyArg_ParseTuple(args, "w*:readinto", &buf)) { - return NULL; - } - - data = PyObject_CallMethod(self, "read", "n", buf.len); - if (data == NULL) - goto error; - - if (!PyBytes_Check(data)) { - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - goto error; - } - - len = Py_SIZE(data); - memcpy(buf.buf, PyBytes_AS_STRING(data), len); - - PyBuffer_Release(&buf); - Py_DECREF(data); - - return PyLong_FromSsize_t(len); - - error: - PyBuffer_Release(&buf); - return NULL; -} - -static PyObject * -bufferediobase_unsupported(const char *message) -{ - PyErr_SetString(_PyIO_unsupported_operation, message); - return NULL; -} - -PyDoc_STRVAR(bufferediobase_detach_doc, - "Disconnect this buffer from its underlying raw stream and return it.\n" - "\n" - "After the raw stream has been detached, the buffer is in an unusable\n" - "state.\n"); - -static PyObject * -bufferediobase_detach(PyObject *self) -{ - return bufferediobase_unsupported("detach"); -} - -PyDoc_STRVAR(bufferediobase_read_doc, - "Read and return up to n bytes.\n" - "\n" - "If the argument is omitted, None, or negative, reads and\n" - "returns all data until EOF.\n" - "\n" - "If the argument is positive, and the underlying raw stream is\n" - "not 'interactive', multiple raw reads may be issued to satisfy\n" - "the byte count (unless EOF is reached first). But for\n" - "interactive raw streams (as well as sockets and pipes), at most\n" - "one raw read will be issued, and a short result does not imply\n" - "that EOF is imminent.\n" - "\n" - "Returns an empty bytes object on EOF.\n" - "\n" - "Returns None if the underlying raw stream was open in non-blocking\n" - "mode and no data is available at the moment.\n"); - -static PyObject * -bufferediobase_read(PyObject *self, PyObject *args) -{ - return bufferediobase_unsupported("read"); -} - -PyDoc_STRVAR(bufferediobase_read1_doc, - "Read and return up to n bytes, with at most one read() call\n" - "to the underlying raw stream. A short result does not imply\n" - "that EOF is imminent.\n" - "\n" - "Returns an empty bytes object on EOF.\n"); - -static PyObject * -bufferediobase_read1(PyObject *self, PyObject *args) -{ - return bufferediobase_unsupported("read1"); -} - -PyDoc_STRVAR(bufferediobase_write_doc, - "Write the given buffer to the IO stream.\n" - "\n" - "Returns the number of bytes written, which is never less than\n" - "len(b).\n" - "\n" - "Raises BlockingIOError if the buffer is full and the\n" - "underlying raw stream cannot accept more data at the moment.\n"); - -static PyObject * -bufferediobase_write(PyObject *self, PyObject *args) -{ - return bufferediobase_unsupported("write"); -} - - -static PyMethodDef bufferediobase_methods[] = { - {"detach", (PyCFunction)bufferediobase_detach, METH_NOARGS, bufferediobase_detach_doc}, - {"read", bufferediobase_read, METH_VARARGS, bufferediobase_read_doc}, - {"read1", bufferediobase_read1, METH_VARARGS, bufferediobase_read1_doc}, - {"readinto", bufferediobase_readinto, METH_VARARGS, NULL}, - {"write", bufferediobase_write, METH_VARARGS, bufferediobase_write_doc}, - {NULL, NULL} -}; - -PyTypeObject PyBufferedIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io._BufferedIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - bufferediobase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - bufferediobase_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyIOBase_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - - -typedef struct { - PyObject_HEAD - - PyObject *raw; - int ok; /* Initialized? */ - int detached; - int readable; - int writable; - - /* True if this is a vanilla Buffered object (rather than a user derived - class) *and* the raw stream is a vanilla FileIO object. */ - int fast_closed_checks; - - /* Absolute position inside the raw stream (-1 if unknown). */ - Py_off_t abs_pos; - - /* A static buffer of size `buffer_size` */ - char *buffer; - /* Current logical position in the buffer. */ - Py_off_t pos; - /* Position of the raw stream in the buffer. */ - Py_off_t raw_pos; - - /* Just after the last buffered byte in the buffer, or -1 if the buffer - isn't ready for reading. */ - Py_off_t read_end; - - /* Just after the last byte actually written */ - Py_off_t write_pos; - /* Just after the last byte waiting to be written, or -1 if the buffer - isn't ready for writing. */ - Py_off_t write_end; - -#ifdef WITH_THREAD - PyThread_type_lock lock; - volatile long owner; -#endif - - Py_ssize_t buffer_size; - Py_ssize_t buffer_mask; - - PyObject *dict; - PyObject *weakreflist; -} buffered; - -/* - Implementation notes: - - * BufferedReader, BufferedWriter and BufferedRandom try to share most - methods (this is helped by the members `readable` and `writable`, which - are initialized in the respective constructors) - * They also share a single buffer for reading and writing. This enables - interleaved reads and writes without flushing. It also makes the logic - a bit trickier to get right. - * The absolute position of the raw stream is cached, if possible, in the - `abs_pos` member. It must be updated every time an operation is done - on the raw stream. If not sure, it can be reinitialized by calling - _buffered_raw_tell(), which queries the raw stream (_buffered_raw_seek() - also does it). To read it, use RAW_TELL(). - * Three helpers, _bufferedreader_raw_read, _bufferedwriter_raw_write and - _bufferedwriter_flush_unlocked do a lot of useful housekeeping. - - NOTE: we should try to maintain block alignment of reads and writes to the - raw stream (according to the buffer size), but for now it is only done - in read() and friends. - -*/ - -/* These macros protect the buffered object against concurrent operations. */ - -#ifdef WITH_THREAD - -static int -_enter_buffered_busy(buffered *self) -{ - if (self->owner == PyThread_get_thread_ident()) { - PyObject *r = PyObject_Repr((PyObject *) self); - if (r != NULL) { - PyErr_Format(PyExc_RuntimeError, - "reentrant call inside %s", - PyString_AS_STRING(r)); - Py_DECREF(r); - } - return 0; - } - Py_BEGIN_ALLOW_THREADS - PyThread_acquire_lock(self->lock, 1); - Py_END_ALLOW_THREADS - return 1; -} - -#define ENTER_BUFFERED(self) \ - ( (PyThread_acquire_lock(self->lock, 0) ? \ - 1 : _enter_buffered_busy(self)) \ - && (self->owner = PyThread_get_thread_ident(), 1) ) - -#define LEAVE_BUFFERED(self) \ - do { \ - self->owner = 0; \ - PyThread_release_lock(self->lock); \ - } while(0); - -#else -#define ENTER_BUFFERED(self) 1 -#define LEAVE_BUFFERED(self) -#endif - -#define CHECK_INITIALIZED(self) \ - if (self->ok <= 0) { \ - if (self->detached) { \ - PyErr_SetString(PyExc_ValueError, \ - "raw stream has been detached"); \ - } else { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on uninitialized object"); \ - } \ - return NULL; \ - } - -#define CHECK_INITIALIZED_INT(self) \ - if (self->ok <= 0) { \ - if (self->detached) { \ - PyErr_SetString(PyExc_ValueError, \ - "raw stream has been detached"); \ - } else { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on uninitialized object"); \ - } \ - return -1; \ - } - -#define IS_CLOSED(self) \ - (self->fast_closed_checks \ - ? _PyFileIO_closed(self->raw) \ - : buffered_closed(self)) - -#define CHECK_CLOSED(self, error_msg) \ - if (IS_CLOSED(self)) { \ - PyErr_SetString(PyExc_ValueError, error_msg); \ - return NULL; \ - } - - -#define VALID_READ_BUFFER(self) \ - (self->readable && self->read_end != -1) - -#define VALID_WRITE_BUFFER(self) \ - (self->writable && self->write_end != -1) - -#define ADJUST_POSITION(self, _new_pos) \ - do { \ - self->pos = _new_pos; \ - if (VALID_READ_BUFFER(self) && self->read_end < self->pos) \ - self->read_end = self->pos; \ - } while(0) - -#define READAHEAD(self) \ - ((self->readable && VALID_READ_BUFFER(self)) \ - ? (self->read_end - self->pos) : 0) - -#define RAW_OFFSET(self) \ - (((VALID_READ_BUFFER(self) || VALID_WRITE_BUFFER(self)) \ - && self->raw_pos >= 0) ? self->raw_pos - self->pos : 0) - -#define RAW_TELL(self) \ - (self->abs_pos != -1 ? self->abs_pos : _buffered_raw_tell(self)) - -#define MINUS_LAST_BLOCK(self, size) \ - (self->buffer_mask ? \ - (size & ~self->buffer_mask) : \ - (self->buffer_size * (size / self->buffer_size))) - - -static void -buffered_dealloc(buffered *self) -{ - if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) - return; - _PyObject_GC_UNTRACK(self); - self->ok = 0; - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)self); - Py_CLEAR(self->raw); - if (self->buffer) { - PyMem_Free(self->buffer); - self->buffer = NULL; - } -#ifdef WITH_THREAD - if (self->lock) { - PyThread_free_lock(self->lock); - self->lock = NULL; - } -#endif - Py_CLEAR(self->dict); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static PyObject * -buffered_sizeof(buffered *self, void *unused) -{ - Py_ssize_t res; - - res = sizeof(buffered); - if (self->buffer) - res += self->buffer_size; - return PyLong_FromSsize_t(res); -} - -static int -buffered_traverse(buffered *self, visitproc visit, void *arg) -{ - Py_VISIT(self->raw); - Py_VISIT(self->dict); - return 0; -} - -static int -buffered_clear(buffered *self) -{ - if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) - return -1; - self->ok = 0; - Py_CLEAR(self->raw); - Py_CLEAR(self->dict); - return 0; -} - -/* - * _BufferedIOMixin methods - * This is not a class, just a collection of methods that will be reused - * by BufferedReader and BufferedWriter - */ - -/* Flush and close */ - -static PyObject * -buffered_simple_flush(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_flush, NULL); -} - -static int -buffered_closed(buffered *self) -{ - int closed; - PyObject *res; - CHECK_INITIALIZED_INT(self) - res = PyObject_GetAttr(self->raw, _PyIO_str_closed); - if (res == NULL) - return -1; - closed = PyObject_IsTrue(res); - Py_DECREF(res); - return closed; -} - -static PyObject * -buffered_closed_get(buffered *self, void *context) -{ - CHECK_INITIALIZED(self) - return PyObject_GetAttr(self->raw, _PyIO_str_closed); -} - -static PyObject * -buffered_close(buffered *self, PyObject *args) -{ - PyObject *res = NULL, *exc = NULL, *val, *tb; - int r; - - CHECK_INITIALIZED(self) - if (!ENTER_BUFFERED(self)) - return NULL; - - r = buffered_closed(self); - if (r < 0) - goto end; - if (r > 0) { - res = Py_None; - Py_INCREF(res); - goto end; - } - /* flush() will most probably re-take the lock, so drop it first */ - LEAVE_BUFFERED(self) - res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); - if (!ENTER_BUFFERED(self)) - return NULL; - if (res == NULL) - PyErr_Fetch(&exc, &val, &tb); - else - Py_DECREF(res); - - res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_close, NULL); - - if (exc != NULL) { - _PyErr_ReplaceException(exc, val, tb); - Py_CLEAR(res); - } - -end: - LEAVE_BUFFERED(self) - return res; -} - -/* detach */ - -static PyObject * -buffered_detach(buffered *self, PyObject *args) -{ - PyObject *raw, *res; - CHECK_INITIALIZED(self) - res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); - if (res == NULL) - return NULL; - Py_DECREF(res); - raw = self->raw; - self->raw = NULL; - self->detached = 1; - self->ok = 0; - return raw; -} - -/* Inquiries */ - -static PyObject * -buffered_seekable(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_seekable, NULL); -} - -static PyObject * -buffered_readable(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_readable, NULL); -} - -static PyObject * -buffered_writable(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_writable, NULL); -} - -static PyObject * -buffered_name_get(buffered *self, void *context) -{ - CHECK_INITIALIZED(self) - return PyObject_GetAttrString(self->raw, "name"); -} - -static PyObject * -buffered_mode_get(buffered *self, void *context) -{ - CHECK_INITIALIZED(self) - return PyObject_GetAttrString(self->raw, "mode"); -} - -/* Lower-level APIs */ - -static PyObject * -buffered_fileno(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_fileno, NULL); -} - -static PyObject * -buffered_isatty(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - return PyObject_CallMethodObjArgs(self->raw, _PyIO_str_isatty, NULL); -} - - -/* Forward decls */ -static PyObject * -_bufferedwriter_flush_unlocked(buffered *); -static Py_ssize_t -_bufferedreader_fill_buffer(buffered *self); -static void -_bufferedreader_reset_buf(buffered *self); -static void -_bufferedwriter_reset_buf(buffered *self); -static PyObject * -_bufferedreader_peek_unlocked(buffered *self, Py_ssize_t); -static PyObject * -_bufferedreader_read_all(buffered *self); -static PyObject * -_bufferedreader_read_fast(buffered *self, Py_ssize_t); -static PyObject * -_bufferedreader_read_generic(buffered *self, Py_ssize_t); - - -/* - * Helpers - */ - -/* Sets the current error to BlockingIOError */ -static void -_set_BlockingIOError(char *msg, Py_ssize_t written) -{ - PyObject *err; - err = PyObject_CallFunction(PyExc_BlockingIOError, "isn", - errno, msg, written); - if (err) - PyErr_SetObject(PyExc_BlockingIOError, err); - Py_XDECREF(err); -} - -/* Returns the address of the `written` member if a BlockingIOError was - raised, NULL otherwise. The error is always re-raised. */ -static Py_ssize_t * -_buffered_check_blocking_error(void) -{ - PyObject *t, *v, *tb; - PyBlockingIOErrorObject *err; - - PyErr_Fetch(&t, &v, &tb); - if (v == NULL || !PyErr_GivenExceptionMatches(v, PyExc_BlockingIOError)) { - PyErr_Restore(t, v, tb); - return NULL; - } - err = (PyBlockingIOErrorObject *) v; - /* TODO: sanity check (err->written >= 0) */ - PyErr_Restore(t, v, tb); - return &err->written; -} - -static Py_off_t -_buffered_raw_tell(buffered *self) -{ - Py_off_t n; - PyObject *res; - res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_tell, NULL); - if (res == NULL) - return -1; - n = PyNumber_AsOff_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n < 0) { - if (!PyErr_Occurred()) - PyErr_Format(PyExc_IOError, - "Raw stream returned invalid position %" PY_PRIdOFF, - (PY_OFF_T_COMPAT)n); - return -1; - } - self->abs_pos = n; - return n; -} - -static Py_off_t -_buffered_raw_seek(buffered *self, Py_off_t target, int whence) -{ - PyObject *res, *posobj, *whenceobj; - Py_off_t n; - - posobj = PyLong_FromOff_t(target); - if (posobj == NULL) - return -1; - whenceobj = PyLong_FromLong(whence); - if (whenceobj == NULL) { - Py_DECREF(posobj); - return -1; - } - res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_seek, - posobj, whenceobj, NULL); - Py_DECREF(posobj); - Py_DECREF(whenceobj); - if (res == NULL) - return -1; - n = PyNumber_AsOff_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n < 0) { - if (!PyErr_Occurred()) - PyErr_Format(PyExc_IOError, - "Raw stream returned invalid position %" PY_PRIdOFF, - (PY_OFF_T_COMPAT)n); - return -1; - } - self->abs_pos = n; - return n; -} - -static int -_buffered_init(buffered *self) -{ - Py_ssize_t n; - if (self->buffer_size <= 0) { - PyErr_SetString(PyExc_ValueError, - "buffer size must be strictly positive"); - return -1; - } - if (self->buffer) - PyMem_Free(self->buffer); - self->buffer = PyMem_Malloc(self->buffer_size); - if (self->buffer == NULL) { - PyErr_NoMemory(); - return -1; - } -#ifdef WITH_THREAD - if (self->lock) - PyThread_free_lock(self->lock); - self->lock = PyThread_allocate_lock(); - if (self->lock == NULL) { - PyErr_SetString(PyExc_RuntimeError, "can't allocate read lock"); - return -1; - } - self->owner = 0; -#endif - /* Find out whether buffer_size is a power of 2 */ - /* XXX is this optimization useful? */ - for (n = self->buffer_size - 1; n & 1; n >>= 1) - ; - if (n == 0) - self->buffer_mask = self->buffer_size - 1; - else - self->buffer_mask = 0; - if (_buffered_raw_tell(self) == -1) - PyErr_Clear(); - return 0; -} - -/* Return 1 if an EnvironmentError with errno == EINTR is set (and then - clears the error indicator), 0 otherwise. - Should only be called when PyErr_Occurred() is true. -*/ -int -_PyIO_trap_eintr(void) -{ - static PyObject *eintr_int = NULL; - PyObject *typ, *val, *tb; - PyEnvironmentErrorObject *env_err; - - if (eintr_int == NULL) { - eintr_int = PyLong_FromLong(EINTR); - assert(eintr_int != NULL); - } - if (!PyErr_ExceptionMatches(PyExc_EnvironmentError)) - return 0; - PyErr_Fetch(&typ, &val, &tb); - PyErr_NormalizeException(&typ, &val, &tb); - env_err = (PyEnvironmentErrorObject *) val; - assert(env_err != NULL); - if (env_err->myerrno != NULL && - PyObject_RichCompareBool(env_err->myerrno, eintr_int, Py_EQ) > 0) { - Py_DECREF(typ); - Py_DECREF(val); - Py_XDECREF(tb); - return 1; - } - /* This silences any error set by PyObject_RichCompareBool() */ - PyErr_Restore(typ, val, tb); - return 0; -} - -/* - * Shared methods and wrappers - */ - -static PyObject * -buffered_flush_and_rewind_unlocked(buffered *self) -{ - PyObject *res; - - res = _bufferedwriter_flush_unlocked(self); - if (res == NULL) - return NULL; - Py_DECREF(res); - - if (self->readable) { - /* Rewind the raw stream so that its position corresponds to - the current logical position. */ - Py_off_t n; - n = _buffered_raw_seek(self, -RAW_OFFSET(self), 1); - _bufferedreader_reset_buf(self); - if (n == -1) - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject * -buffered_flush(buffered *self, PyObject *args) -{ - PyObject *res; - - CHECK_INITIALIZED(self) - CHECK_CLOSED(self, "flush of closed file") - - if (!ENTER_BUFFERED(self)) - return NULL; - res = buffered_flush_and_rewind_unlocked(self); - LEAVE_BUFFERED(self) - - return res; -} - -static PyObject * -buffered_peek(buffered *self, PyObject *args) -{ - Py_ssize_t n = 0; - PyObject *res = NULL; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "|n:peek", &n)) { - return NULL; - } - - if (!ENTER_BUFFERED(self)) - return NULL; - - if (self->writable) { - res = buffered_flush_and_rewind_unlocked(self); - if (res == NULL) - goto end; - Py_CLEAR(res); - } - res = _bufferedreader_peek_unlocked(self, n); - -end: - LEAVE_BUFFERED(self) - return res; -} - -static PyObject * -buffered_read(buffered *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *res; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "|O&:read", &_PyIO_ConvertSsize_t, &n)) { - return NULL; - } - if (n < -1) { - PyErr_SetString(PyExc_ValueError, - "read length must be positive or -1"); - return NULL; - } - - CHECK_CLOSED(self, "read of closed file") - - if (n == -1) { - /* The number of bytes is unspecified, read until the end of stream */ - if (!ENTER_BUFFERED(self)) - return NULL; - res = _bufferedreader_read_all(self); - } - else { - res = _bufferedreader_read_fast(self, n); - if (res != Py_None) - return res; - Py_DECREF(res); - if (!ENTER_BUFFERED(self)) - return NULL; - res = _bufferedreader_read_generic(self, n); - } - - LEAVE_BUFFERED(self) - return res; -} - -static PyObject * -buffered_read1(buffered *self, PyObject *args) -{ - Py_ssize_t n, have, r; - PyObject *res = NULL; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "n:read1", &n)) { - return NULL; - } - - if (n < 0) { - PyErr_SetString(PyExc_ValueError, - "read length must be positive"); - return NULL; - } - if (n == 0) - return PyBytes_FromStringAndSize(NULL, 0); - - if (!ENTER_BUFFERED(self)) - return NULL; - - /* Return up to n bytes. If at least one byte is buffered, we - only return buffered bytes. Otherwise, we do one raw read. */ - - /* XXX: this mimicks the io.py implementation but is probably wrong. - If we need to read from the raw stream, then we could actually read - all `n` bytes asked by the caller (and possibly more, so as to fill - our buffer for the next reads). */ - - have = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); - if (have > 0) { - if (n > have) - n = have; - res = PyBytes_FromStringAndSize(self->buffer + self->pos, n); - if (res == NULL) - goto end; - self->pos += n; - goto end; - } - - if (self->writable) { - res = buffered_flush_and_rewind_unlocked(self); - if (res == NULL) - goto end; - Py_DECREF(res); - } - - /* Fill the buffer from the raw stream, and copy it to the result. */ - _bufferedreader_reset_buf(self); - r = _bufferedreader_fill_buffer(self); - if (r == -1) - goto end; - if (r == -2) - r = 0; - if (n > r) - n = r; - res = PyBytes_FromStringAndSize(self->buffer, n); - if (res == NULL) - goto end; - self->pos = n; - -end: - LEAVE_BUFFERED(self) - return res; -} - -static PyObject * -buffered_readinto(buffered *self, PyObject *args) -{ - CHECK_INITIALIZED(self) - - /* TODO: use raw.readinto() (or a direct copy from our buffer) instead! */ - return bufferediobase_readinto((PyObject *)self, args); -} - -static PyObject * -_buffered_readline(buffered *self, Py_ssize_t limit) -{ - PyObject *res = NULL; - PyObject *chunks = NULL; - Py_ssize_t n, written = 0; - const char *start, *s, *end; - - CHECK_CLOSED(self, "readline of closed file") - - /* First, try to find a line in the buffer. This can run unlocked because - the calls to the C API are simple enough that they can't trigger - any thread switch. */ - n = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); - if (limit >= 0 && n > limit) - n = limit; - start = self->buffer + self->pos; - s = memchr(start, '\n', n); - if (s != NULL) { - res = PyBytes_FromStringAndSize(start, s - start + 1); - if (res != NULL) - self->pos += s - start + 1; - goto end_unlocked; - } - if (n == limit) { - res = PyBytes_FromStringAndSize(start, n); - if (res != NULL) - self->pos += n; - goto end_unlocked; - } - - if (!ENTER_BUFFERED(self)) - goto end_unlocked; - - /* Now we try to get some more from the raw stream */ - chunks = PyList_New(0); - if (chunks == NULL) - goto end; - if (n > 0) { - res = PyBytes_FromStringAndSize(start, n); - if (res == NULL) - goto end; - if (PyList_Append(chunks, res) < 0) { - Py_CLEAR(res); - goto end; - } - Py_CLEAR(res); - written += n; - self->pos += n; - if (limit >= 0) - limit -= n; - } - if (self->writable) { - PyObject *r = buffered_flush_and_rewind_unlocked(self); - if (r == NULL) - goto end; - Py_DECREF(r); - } - - for (;;) { - _bufferedreader_reset_buf(self); - n = _bufferedreader_fill_buffer(self); - if (n == -1) - goto end; - if (n <= 0) - break; - if (limit >= 0 && n > limit) - n = limit; - start = self->buffer; - end = start + n; - s = start; - while (s < end) { - if (*s++ == '\n') { - res = PyBytes_FromStringAndSize(start, s - start); - if (res == NULL) - goto end; - self->pos = s - start; - goto found; - } - } - res = PyBytes_FromStringAndSize(start, n); - if (res == NULL) - goto end; - if (n == limit) { - self->pos = n; - break; - } - if (PyList_Append(chunks, res) < 0) { - Py_CLEAR(res); - goto end; - } - Py_CLEAR(res); - written += n; - if (limit >= 0) - limit -= n; - } -found: - if (res != NULL && PyList_Append(chunks, res) < 0) { - Py_CLEAR(res); - goto end; - } - Py_CLEAR(res); - res = _PyBytes_Join(_PyIO_empty_bytes, chunks); - -end: - LEAVE_BUFFERED(self) -end_unlocked: - Py_XDECREF(chunks); - return res; -} - -static PyObject * -buffered_readline(buffered *self, PyObject *args) -{ - Py_ssize_t limit = -1; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) - return NULL; - return _buffered_readline(self, limit); -} - - -static PyObject * -buffered_tell(buffered *self, PyObject *args) -{ - Py_off_t pos; - - CHECK_INITIALIZED(self) - pos = _buffered_raw_tell(self); - if (pos == -1) - return NULL; - pos -= RAW_OFFSET(self); - /* TODO: sanity check (pos >= 0) */ - return PyLong_FromOff_t(pos); -} - -static PyObject * -buffered_seek(buffered *self, PyObject *args) -{ - Py_off_t target, n; - int whence = 0; - PyObject *targetobj, *res = NULL; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "O|i:seek", &targetobj, &whence)) { - return NULL; - } - if (whence < 0 || whence > 2) { - PyErr_Format(PyExc_ValueError, - "whence must be between 0 and 2, not %d", whence); - return NULL; - } - - CHECK_CLOSED(self, "seek of closed file") - - target = PyNumber_AsOff_t(targetobj, PyExc_ValueError); - if (target == -1 && PyErr_Occurred()) - return NULL; - - if (whence != 2 && self->readable) { - Py_off_t current, avail; - /* Check if seeking leaves us inside the current buffer, - so as to return quickly if possible. Also, we needn't take the - lock in this fast path. - Don't know how to do that when whence == 2, though. */ - /* NOTE: RAW_TELL() can release the GIL but the object is in a stable - state at this point. */ - current = RAW_TELL(self); - avail = READAHEAD(self); - if (avail > 0) { - Py_off_t offset; - if (whence == 0) - offset = target - (current - RAW_OFFSET(self)); - else - offset = target; - if (offset >= -self->pos && offset <= avail) { - self->pos += offset; - return PyLong_FromOff_t(current - avail + offset); - } - } - } - - if (!ENTER_BUFFERED(self)) - return NULL; - - /* Fallback: invoke raw seek() method and clear buffer */ - if (self->writable) { - res = _bufferedwriter_flush_unlocked(self); - if (res == NULL) - goto end; - Py_CLEAR(res); - _bufferedwriter_reset_buf(self); - } - - /* TODO: align on block boundary and read buffer if needed? */ - if (whence == 1) - target -= RAW_OFFSET(self); - n = _buffered_raw_seek(self, target, whence); - if (n == -1) - goto end; - self->raw_pos = -1; - res = PyLong_FromOff_t(n); - if (res != NULL && self->readable) - _bufferedreader_reset_buf(self); - -end: - LEAVE_BUFFERED(self) - return res; -} - -static PyObject * -buffered_truncate(buffered *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res = NULL; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - if (!ENTER_BUFFERED(self)) - return NULL; - - if (self->writable) { - res = buffered_flush_and_rewind_unlocked(self); - if (res == NULL) - goto end; - Py_CLEAR(res); - } - res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_truncate, pos, NULL); - if (res == NULL) - goto end; - /* Reset cached position */ - if (_buffered_raw_tell(self) == -1) - PyErr_Clear(); - -end: - LEAVE_BUFFERED(self) - return res; -} - -static PyObject * -buffered_iternext(buffered *self) -{ - PyObject *line; - PyTypeObject *tp; - - CHECK_INITIALIZED(self); - - tp = Py_TYPE(self); - if (tp == &PyBufferedReader_Type || - tp == &PyBufferedRandom_Type) { - /* Skip method call overhead for speed */ - line = _buffered_readline(self, -1); - } - else { - line = PyObject_CallMethodObjArgs((PyObject *)self, - _PyIO_str_readline, NULL); - if (line && !PyBytes_Check(line)) { - PyErr_Format(PyExc_IOError, - "readline() should have returned a bytes object, " - "not '%.200s'", Py_TYPE(line)->tp_name); - Py_DECREF(line); - return NULL; - } - } - - if (line == NULL) - return NULL; - - if (PyBytes_GET_SIZE(line) == 0) { - /* Reached EOF or would have blocked */ - Py_DECREF(line); - return NULL; - } - - return line; -} - -static PyObject * -buffered_repr(buffered *self) -{ - PyObject *nameobj, *res; - - nameobj = PyObject_GetAttrString((PyObject *) self, "name"); - if (nameobj == NULL) { - if (PyErr_ExceptionMatches(PyExc_Exception)) - PyErr_Clear(); - else - return NULL; - res = PyString_FromFormat("<%s>", Py_TYPE(self)->tp_name); - } - else { - PyObject *repr = PyObject_Repr(nameobj); - Py_DECREF(nameobj); - if (repr == NULL) - return NULL; - res = PyString_FromFormat("<%s name=%s>", - Py_TYPE(self)->tp_name, - PyString_AS_STRING(repr)); - Py_DECREF(repr); - } - return res; -} - -/* - * class BufferedReader - */ - -PyDoc_STRVAR(bufferedreader_doc, - "Create a new buffered reader using the given readable raw IO object."); - -static void _bufferedreader_reset_buf(buffered *self) -{ - self->read_end = -1; -} - -static int -bufferedreader_init(buffered *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - PyObject *raw; - - self->ok = 0; - self->detached = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:BufferedReader", kwlist, - &raw, &buffer_size)) { - return -1; - } - - if (_PyIOBase_check_readable(raw, Py_True) == NULL) - return -1; - - Py_CLEAR(self->raw); - Py_INCREF(raw); - self->raw = raw; - self->buffer_size = buffer_size; - self->readable = 1; - self->writable = 0; - - if (_buffered_init(self) < 0) - return -1; - _bufferedreader_reset_buf(self); - - self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedReader_Type && - Py_TYPE(raw) == &PyFileIO_Type); - - self->ok = 1; - return 0; -} - -static Py_ssize_t -_bufferedreader_raw_read(buffered *self, char *start, Py_ssize_t len) -{ - Py_buffer buf; - PyObject *memobj, *res; - Py_ssize_t n; - /* NOTE: the buffer needn't be released as its object is NULL. */ - if (PyBuffer_FillInfo(&buf, NULL, start, len, 0, PyBUF_CONTIG) == -1) - return -1; - memobj = PyMemoryView_FromBuffer(&buf); - if (memobj == NULL) - return -1; - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() when EINTR - occurs so we needn't do it ourselves. - We then retry reading, ignoring the signal if no handler has - raised (see issue #10956). - */ - do { - res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_readinto, memobj, NULL); - } while (res == NULL && _PyIO_trap_eintr()); - Py_DECREF(memobj); - if (res == NULL) - return -1; - if (res == Py_None) { - /* Non-blocking stream would have blocked. Special return code! */ - Py_DECREF(res); - return -2; - } - n = PyNumber_AsSsize_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n < 0 || n > len) { - PyErr_Format(PyExc_IOError, - "raw readinto() returned invalid length %zd " - "(should have been between 0 and %zd)", n, len); - return -1; - } - if (n > 0 && self->abs_pos != -1) - self->abs_pos += n; - return n; -} - -static Py_ssize_t -_bufferedreader_fill_buffer(buffered *self) -{ - Py_ssize_t start, len, n; - if (VALID_READ_BUFFER(self)) - start = Py_SAFE_DOWNCAST(self->read_end, Py_off_t, Py_ssize_t); - else - start = 0; - len = self->buffer_size - start; - n = _bufferedreader_raw_read(self, self->buffer + start, len); - if (n <= 0) - return n; - self->read_end = start + n; - self->raw_pos = start + n; - return n; -} - -static PyObject * -_bufferedreader_read_all(buffered *self) -{ - Py_ssize_t current_size; - PyObject *res, *data = NULL; - PyObject *chunks = PyList_New(0); - - if (chunks == NULL) - return NULL; - - /* First copy what we have in the current buffer. */ - current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); - if (current_size) { - data = PyBytes_FromStringAndSize( - self->buffer + self->pos, current_size); - if (data == NULL) { - Py_DECREF(chunks); - return NULL; - } - self->pos += current_size; - } - /* We're going past the buffer's bounds, flush it */ - if (self->writable) { - res = buffered_flush_and_rewind_unlocked(self); - if (res == NULL) { - Py_DECREF(chunks); - return NULL; - } - Py_CLEAR(res); - } - _bufferedreader_reset_buf(self); - while (1) { - if (data) { - if (PyList_Append(chunks, data) < 0) { - Py_DECREF(data); - Py_DECREF(chunks); - return NULL; - } - Py_DECREF(data); - } - - /* Read until EOF or until read() would block. */ - data = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_read, NULL); - if (data == NULL) { - Py_DECREF(chunks); - return NULL; - } - if (data != Py_None && !PyBytes_Check(data)) { - Py_DECREF(data); - Py_DECREF(chunks); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - if (data == Py_None || PyBytes_GET_SIZE(data) == 0) { - if (current_size == 0) { - Py_DECREF(chunks); - return data; - } - else { - res = _PyBytes_Join(_PyIO_empty_bytes, chunks); - Py_DECREF(data); - Py_DECREF(chunks); - return res; - } - } - current_size += PyBytes_GET_SIZE(data); - if (self->abs_pos != -1) - self->abs_pos += PyBytes_GET_SIZE(data); - } -} - -/* Read n bytes from the buffer if it can, otherwise return None. - This function is simple enough that it can run unlocked. */ -static PyObject * -_bufferedreader_read_fast(buffered *self, Py_ssize_t n) -{ - Py_ssize_t current_size; - - current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); - if (n <= current_size) { - /* Fast path: the data to read is fully buffered. */ - PyObject *res = PyBytes_FromStringAndSize(self->buffer + self->pos, n); - if (res != NULL) - self->pos += n; - return res; - } - Py_RETURN_NONE; -} - -/* Generic read function: read from the stream until enough bytes are read, - * or until an EOF occurs or until read() would block. - */ -static PyObject * -_bufferedreader_read_generic(buffered *self, Py_ssize_t n) -{ - PyObject *res = NULL; - Py_ssize_t current_size, remaining, written; - char *out; - - current_size = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); - if (n <= current_size) - return _bufferedreader_read_fast(self, n); - - res = PyBytes_FromStringAndSize(NULL, n); - if (res == NULL) - goto error; - out = PyBytes_AS_STRING(res); - remaining = n; - written = 0; - if (current_size > 0) { - memcpy(out, self->buffer + self->pos, current_size); - remaining -= current_size; - written += current_size; - self->pos += current_size; - } - /* Flush the write buffer if necessary */ - if (self->writable) { - PyObject *r = buffered_flush_and_rewind_unlocked(self); - if (r == NULL) - goto error; - Py_DECREF(r); - } - _bufferedreader_reset_buf(self); - while (remaining > 0) { - /* We want to read a whole block at the end into buffer. - If we had readv() we could do this in one pass. */ - Py_ssize_t r = MINUS_LAST_BLOCK(self, remaining); - if (r == 0) - break; - r = _bufferedreader_raw_read(self, out + written, r); - if (r == -1) - goto error; - if (r == 0 || r == -2) { - /* EOF occurred or read() would block. */ - if (r == 0 || written > 0) { - if (_PyBytes_Resize(&res, written)) - goto error; - return res; - } - Py_DECREF(res); - Py_INCREF(Py_None); - return Py_None; - } - remaining -= r; - written += r; - } - assert(remaining <= self->buffer_size); - self->pos = 0; - self->raw_pos = 0; - self->read_end = 0; - /* NOTE: when the read is satisfied, we avoid issuing any additional - reads, which could block indefinitely (e.g. on a socket). - See issue #9550. */ - while (remaining > 0 && self->read_end < self->buffer_size) { - Py_ssize_t r = _bufferedreader_fill_buffer(self); - if (r == -1) - goto error; - if (r == 0 || r == -2) { - /* EOF occurred or read() would block. */ - if (r == 0 || written > 0) { - if (_PyBytes_Resize(&res, written)) - goto error; - return res; - } - Py_DECREF(res); - Py_INCREF(Py_None); - return Py_None; - } - if (remaining > r) { - memcpy(out + written, self->buffer + self->pos, r); - written += r; - self->pos += r; - remaining -= r; - } - else if (remaining > 0) { - memcpy(out + written, self->buffer + self->pos, remaining); - written += remaining; - self->pos += remaining; - remaining = 0; - } - if (remaining == 0) - break; - } - - return res; - -error: - Py_XDECREF(res); - return NULL; -} - -static PyObject * -_bufferedreader_peek_unlocked(buffered *self, Py_ssize_t n) -{ - Py_ssize_t have, r; - - have = Py_SAFE_DOWNCAST(READAHEAD(self), Py_off_t, Py_ssize_t); - /* Constraints: - 1. we don't want to advance the file position. - 2. we don't want to lose block alignment, so we can't shift the buffer - to make some place. - Therefore, we either return `have` bytes (if > 0), or a full buffer. - */ - if (have > 0) { - return PyBytes_FromStringAndSize(self->buffer + self->pos, have); - } - - /* Fill the buffer from the raw stream, and copy it to the result. */ - _bufferedreader_reset_buf(self); - r = _bufferedreader_fill_buffer(self); - if (r == -1) - return NULL; - if (r == -2) - r = 0; - self->pos = 0; - return PyBytes_FromStringAndSize(self->buffer, r); -} - -static PyMethodDef bufferedreader_methods[] = { - /* BufferedIOMixin methods */ - {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, - {"flush", (PyCFunction)buffered_simple_flush, METH_NOARGS}, - {"close", (PyCFunction)buffered_close, METH_NOARGS}, - {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, - {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, - {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, - {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, - - {"read", (PyCFunction)buffered_read, METH_VARARGS}, - {"peek", (PyCFunction)buffered_peek, METH_VARARGS}, - {"read1", (PyCFunction)buffered_read1, METH_VARARGS}, - {"readline", (PyCFunction)buffered_readline, METH_VARARGS}, - {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, - {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, - {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, - {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef bufferedreader_members[] = { - {"raw", T_OBJECT, offsetof(buffered, raw), READONLY}, - {NULL} -}; - -static PyGetSetDef bufferedreader_getset[] = { - {"closed", (getter)buffered_closed_get, NULL, NULL}, - {"name", (getter)buffered_name_get, NULL, NULL}, - {"mode", (getter)buffered_mode_get, NULL, NULL}, - {NULL} -}; - - -PyTypeObject PyBufferedReader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.BufferedReader", /*tp_name*/ - sizeof(buffered), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)buffered_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - (reprfunc)buffered_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - bufferedreader_doc, /* tp_doc */ - (traverseproc)buffered_traverse, /* tp_traverse */ - (inquiry)buffered_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - (iternextfunc)buffered_iternext, /* tp_iternext */ - bufferedreader_methods, /* tp_methods */ - bufferedreader_members, /* tp_members */ - bufferedreader_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(buffered, dict), /* tp_dictoffset */ - (initproc)bufferedreader_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -static int -complain_about_max_buffer_size(void) -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "max_buffer_size is deprecated", 1) < 0) - return 0; - return 1; -} - -/* - * class BufferedWriter - */ -PyDoc_STRVAR(bufferedwriter_doc, - "A buffer for a writeable sequential RawIO object.\n" - "\n" - "The constructor creates a BufferedWriter for the given writeable raw\n" - "stream. If the buffer_size is not given, it defaults to\n" - "DEFAULT_BUFFER_SIZE. max_buffer_size isn't used anymore.\n" - ); - -static void -_bufferedwriter_reset_buf(buffered *self) -{ - self->write_pos = 0; - self->write_end = -1; -} - -static int -bufferedwriter_init(buffered *self, PyObject *args, PyObject *kwds) -{ - /* TODO: properly deprecate max_buffer_size */ - char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -234; - PyObject *raw; - - self->ok = 0; - self->detached = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedWriter", kwlist, - &raw, &buffer_size, &max_buffer_size)) { - return -1; - } - - if (max_buffer_size != -234 && !complain_about_max_buffer_size()) - return -1; - - if (_PyIOBase_check_writable(raw, Py_True) == NULL) - return -1; - - Py_CLEAR(self->raw); - Py_INCREF(raw); - self->raw = raw; - self->readable = 0; - self->writable = 1; - - self->buffer_size = buffer_size; - if (_buffered_init(self) < 0) - return -1; - _bufferedwriter_reset_buf(self); - self->pos = 0; - - self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedWriter_Type && - Py_TYPE(raw) == &PyFileIO_Type); - - self->ok = 1; - return 0; -} - -static Py_ssize_t -_bufferedwriter_raw_write(buffered *self, char *start, Py_ssize_t len) -{ - Py_buffer buf; - PyObject *memobj, *res; - Py_ssize_t n; - int errnum; - /* NOTE: the buffer needn't be released as its object is NULL. */ - if (PyBuffer_FillInfo(&buf, NULL, start, len, 1, PyBUF_CONTIG_RO) == -1) - return -1; - memobj = PyMemoryView_FromBuffer(&buf); - if (memobj == NULL) - return -1; - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() when EINTR - occurs so we needn't do it ourselves. - We then retry writing, ignoring the signal if no handler has - raised (see issue #10956). - */ - do { - errno = 0; - res = PyObject_CallMethodObjArgs(self->raw, _PyIO_str_write, memobj, NULL); - errnum = errno; - } while (res == NULL && _PyIO_trap_eintr()); - Py_DECREF(memobj); - if (res == NULL) - return -1; - if (res == Py_None) { - /* Non-blocking stream would have blocked. Special return code! - Being paranoid we reset errno in case it is changed by code - triggered by a decref. errno is used by _set_BlockingIOError(). */ - Py_DECREF(res); - errno = errnum; - return -2; - } - n = PyNumber_AsSsize_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n < 0 || n > len) { - PyErr_Format(PyExc_IOError, - "raw write() returned invalid length %zd " - "(should have been between 0 and %zd)", n, len); - return -1; - } - if (n > 0 && self->abs_pos != -1) - self->abs_pos += n; - return n; -} - -/* `restore_pos` is 1 if we need to restore the raw stream position at - the end, 0 otherwise. */ -static PyObject * -_bufferedwriter_flush_unlocked(buffered *self) -{ - Py_ssize_t written = 0; - Py_off_t n, rewind; - - if (!VALID_WRITE_BUFFER(self) || self->write_pos == self->write_end) - goto end; - /* First, rewind */ - rewind = RAW_OFFSET(self) + (self->pos - self->write_pos); - if (rewind != 0) { - n = _buffered_raw_seek(self, -rewind, 1); - if (n < 0) { - goto error; - } - self->raw_pos -= rewind; - } - while (self->write_pos < self->write_end) { - n = _bufferedwriter_raw_write(self, - self->buffer + self->write_pos, - Py_SAFE_DOWNCAST(self->write_end - self->write_pos, - Py_off_t, Py_ssize_t)); - if (n == -1) { - goto error; - } - else if (n == -2) { - _set_BlockingIOError("write could not complete without blocking", - 0); - goto error; - } - self->write_pos += n; - self->raw_pos = self->write_pos; - written += Py_SAFE_DOWNCAST(n, Py_off_t, Py_ssize_t); - /* Partial writes can return successfully when interrupted by a - signal (see write(2)). We must run signal handlers before - blocking another time, possibly indefinitely. */ - if (PyErr_CheckSignals() < 0) - goto error; - } - - _bufferedwriter_reset_buf(self); - -end: - Py_RETURN_NONE; - -error: - return NULL; -} - -static PyObject * -bufferedwriter_write(buffered *self, PyObject *args) -{ - PyObject *res = NULL; - Py_buffer buf; - Py_ssize_t written, avail, remaining; - Py_off_t offset; - - CHECK_INITIALIZED(self) - if (!PyArg_ParseTuple(args, "s*:write", &buf)) { - return NULL; - } - - if (IS_CLOSED(self)) { - PyErr_SetString(PyExc_ValueError, "write to closed file"); - PyBuffer_Release(&buf); - return NULL; - } - - if (!ENTER_BUFFERED(self)) { - PyBuffer_Release(&buf); - return NULL; - } - - /* Fast path: the data to write can be fully buffered. */ - if (!VALID_READ_BUFFER(self) && !VALID_WRITE_BUFFER(self)) { - self->pos = 0; - self->raw_pos = 0; - } - avail = Py_SAFE_DOWNCAST(self->buffer_size - self->pos, Py_off_t, Py_ssize_t); - if (buf.len <= avail) { - memcpy(self->buffer + self->pos, buf.buf, buf.len); - if (!VALID_WRITE_BUFFER(self) || self->write_pos > self->pos) { - self->write_pos = self->pos; - } - ADJUST_POSITION(self, self->pos + buf.len); - if (self->pos > self->write_end) - self->write_end = self->pos; - written = buf.len; - goto end; - } - - /* First write the current buffer */ - res = _bufferedwriter_flush_unlocked(self); - if (res == NULL) { - Py_ssize_t *w = _buffered_check_blocking_error(); - if (w == NULL) - goto error; - if (self->readable) - _bufferedreader_reset_buf(self); - /* Make some place by shifting the buffer. */ - assert(VALID_WRITE_BUFFER(self)); - memmove(self->buffer, self->buffer + self->write_pos, - Py_SAFE_DOWNCAST(self->write_end - self->write_pos, - Py_off_t, Py_ssize_t)); - self->write_end -= self->write_pos; - self->raw_pos -= self->write_pos; - self->pos -= self->write_pos; - self->write_pos = 0; - avail = Py_SAFE_DOWNCAST(self->buffer_size - self->write_end, - Py_off_t, Py_ssize_t); - if (buf.len <= avail) { - /* Everything can be buffered */ - PyErr_Clear(); - memcpy(self->buffer + self->write_end, buf.buf, buf.len); - self->write_end += buf.len; - self->pos += buf.len; - written = buf.len; - goto end; - } - /* Buffer as much as possible. */ - memcpy(self->buffer + self->write_end, buf.buf, avail); - self->write_end += avail; - self->pos += avail; - /* XXX Modifying the existing exception e using the pointer w - will change e.characters_written but not e.args[2]. - Therefore we just replace with a new error. */ - _set_BlockingIOError("write could not complete without blocking", - avail); - goto error; - } - Py_CLEAR(res); - - /* Adjust the raw stream position if it is away from the logical stream - position. This happens if the read buffer has been filled but not - modified (and therefore _bufferedwriter_flush_unlocked() didn't rewind - the raw stream by itself). - Fixes issue #6629. - */ - offset = RAW_OFFSET(self); - if (offset != 0) { - if (_buffered_raw_seek(self, -offset, 1) < 0) - goto error; - self->raw_pos -= offset; - } - - /* Then write buf itself. At this point the buffer has been emptied. */ - remaining = buf.len; - written = 0; - while (remaining > self->buffer_size) { - Py_ssize_t n = _bufferedwriter_raw_write( - self, (char *) buf.buf + written, buf.len - written); - if (n == -1) { - goto error; - } else if (n == -2) { - /* Write failed because raw file is non-blocking */ - if (remaining > self->buffer_size) { - /* Can't buffer everything, still buffer as much as possible */ - memcpy(self->buffer, - (char *) buf.buf + written, self->buffer_size); - self->raw_pos = 0; - ADJUST_POSITION(self, self->buffer_size); - self->write_end = self->buffer_size; - written += self->buffer_size; - _set_BlockingIOError("write could not complete without " - "blocking", written); - goto error; - } - PyErr_Clear(); - break; - } - written += n; - remaining -= n; - /* Partial writes can return successfully when interrupted by a - signal (see write(2)). We must run signal handlers before - blocking another time, possibly indefinitely. */ - if (PyErr_CheckSignals() < 0) - goto error; - } - if (self->readable) - _bufferedreader_reset_buf(self); - if (remaining > 0) { - memcpy(self->buffer, (char *) buf.buf + written, remaining); - written += remaining; - } - self->write_pos = 0; - /* TODO: sanity check (remaining >= 0) */ - self->write_end = remaining; - ADJUST_POSITION(self, remaining); - self->raw_pos = 0; - -end: - res = PyLong_FromSsize_t(written); - -error: - LEAVE_BUFFERED(self) - PyBuffer_Release(&buf); - return res; -} - -static PyMethodDef bufferedwriter_methods[] = { - /* BufferedIOMixin methods */ - {"close", (PyCFunction)buffered_close, METH_NOARGS}, - {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, - {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, - {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, - {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, - {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, - - {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS}, - {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, - {"flush", (PyCFunction)buffered_flush, METH_NOARGS}, - {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, - {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, - {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef bufferedwriter_members[] = { - {"raw", T_OBJECT, offsetof(buffered, raw), READONLY}, - {NULL} -}; - -static PyGetSetDef bufferedwriter_getset[] = { - {"closed", (getter)buffered_closed_get, NULL, NULL}, - {"name", (getter)buffered_name_get, NULL, NULL}, - {"mode", (getter)buffered_mode_get, NULL, NULL}, - {NULL} -}; - - -PyTypeObject PyBufferedWriter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.BufferedWriter", /*tp_name*/ - sizeof(buffered), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)buffered_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - (reprfunc)buffered_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - bufferedwriter_doc, /* tp_doc */ - (traverseproc)buffered_traverse, /* tp_traverse */ - (inquiry)buffered_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - bufferedwriter_methods, /* tp_methods */ - bufferedwriter_members, /* tp_members */ - bufferedwriter_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(buffered, dict), /* tp_dictoffset */ - (initproc)bufferedwriter_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -/* - * BufferedRWPair - */ - -PyDoc_STRVAR(bufferedrwpair_doc, - "A buffered reader and writer object together.\n" - "\n" - "A buffered reader object and buffered writer object put together to\n" - "form a sequential IO object that can read and write. This is typically\n" - "used with a socket or two-way pipe.\n" - "\n" - "reader and writer are RawIOBase objects that are readable and\n" - "writeable respectively. If the buffer_size is omitted it defaults to\n" - "DEFAULT_BUFFER_SIZE.\n" - ); - -/* XXX The usefulness of this (compared to having two separate IO objects) is - * questionable. - */ - -typedef struct { - PyObject_HEAD - buffered *reader; - buffered *writer; - PyObject *dict; - PyObject *weakreflist; -} rwpair; - -static int -bufferedrwpair_init(rwpair *self, PyObject *args, PyObject *kwds) -{ - PyObject *reader, *writer; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -234; - - if (!PyArg_ParseTuple(args, "OO|nn:BufferedRWPair", &reader, &writer, - &buffer_size, &max_buffer_size)) { - return -1; - } - - if (max_buffer_size != -234 && !complain_about_max_buffer_size()) - return -1; - - if (_PyIOBase_check_readable(reader, Py_True) == NULL) - return -1; - if (_PyIOBase_check_writable(writer, Py_True) == NULL) - return -1; - - self->reader = (buffered *) PyObject_CallFunction( - (PyObject *) &PyBufferedReader_Type, "On", reader, buffer_size); - if (self->reader == NULL) - return -1; - - self->writer = (buffered *) PyObject_CallFunction( - (PyObject *) &PyBufferedWriter_Type, "On", writer, buffer_size); - if (self->writer == NULL) { - Py_CLEAR(self->reader); - return -1; - } - - return 0; -} - -static int -bufferedrwpair_traverse(rwpair *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dict); - return 0; -} - -static int -bufferedrwpair_clear(rwpair *self) -{ - Py_CLEAR(self->reader); - Py_CLEAR(self->writer); - Py_CLEAR(self->dict); - return 0; -} - -static void -bufferedrwpair_dealloc(rwpair *self) -{ - _PyObject_GC_UNTRACK(self); - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)self); - Py_CLEAR(self->reader); - Py_CLEAR(self->writer); - Py_CLEAR(self->dict); - Py_TYPE(self)->tp_free((PyObject *) self); -} - -static PyObject * -_forward_call(buffered *self, const char *name, PyObject *args) -{ - PyObject *func, *ret; - if (self == NULL) { - PyErr_SetString(PyExc_ValueError, - "I/O operation on uninitialized object"); - return NULL; - } - - func = PyObject_GetAttrString((PyObject *)self, name); - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; - } - - ret = PyObject_CallObject(func, args); - Py_DECREF(func); - return ret; -} - -static PyObject * -bufferedrwpair_read(rwpair *self, PyObject *args) -{ - return _forward_call(self->reader, "read", args); -} - -static PyObject * -bufferedrwpair_peek(rwpair *self, PyObject *args) -{ - return _forward_call(self->reader, "peek", args); -} - -static PyObject * -bufferedrwpair_read1(rwpair *self, PyObject *args) -{ - return _forward_call(self->reader, "read1", args); -} - -static PyObject * -bufferedrwpair_readinto(rwpair *self, PyObject *args) -{ - return _forward_call(self->reader, "readinto", args); -} - -static PyObject * -bufferedrwpair_write(rwpair *self, PyObject *args) -{ - return _forward_call(self->writer, "write", args); -} - -static PyObject * -bufferedrwpair_flush(rwpair *self, PyObject *args) -{ - return _forward_call(self->writer, "flush", args); -} - -static PyObject * -bufferedrwpair_readable(rwpair *self, PyObject *args) -{ - return _forward_call(self->reader, "readable", args); -} - -static PyObject * -bufferedrwpair_writable(rwpair *self, PyObject *args) -{ - return _forward_call(self->writer, "writable", args); -} - -static PyObject * -bufferedrwpair_close(rwpair *self, PyObject *args) -{ - PyObject *exc = NULL, *val, *tb; - PyObject *ret = _forward_call(self->writer, "close", args); - if (ret == NULL) - PyErr_Fetch(&exc, &val, &tb); - else - Py_DECREF(ret); - ret = _forward_call(self->reader, "close", args); - if (exc != NULL) { - if (ret != NULL) { - Py_CLEAR(ret); - PyErr_Restore(exc, val, tb); - } - else { - Py_DECREF(exc); - Py_XDECREF(val); - Py_XDECREF(tb); - } - } - return ret; -} - -static PyObject * -bufferedrwpair_isatty(rwpair *self, PyObject *args) -{ - PyObject *ret = _forward_call(self->writer, "isatty", args); - - if (ret != Py_False) { - /* either True or exception */ - return ret; - } - Py_DECREF(ret); - - return _forward_call(self->reader, "isatty", args); -} - -static PyObject * -bufferedrwpair_closed_get(rwpair *self, void *context) -{ - if (self->writer == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "the BufferedRWPair object is being garbage-collected"); - return NULL; - } - return PyObject_GetAttr((PyObject *) self->writer, _PyIO_str_closed); -} - -static PyMethodDef bufferedrwpair_methods[] = { - {"read", (PyCFunction)bufferedrwpair_read, METH_VARARGS}, - {"peek", (PyCFunction)bufferedrwpair_peek, METH_VARARGS}, - {"read1", (PyCFunction)bufferedrwpair_read1, METH_VARARGS}, - {"readinto", (PyCFunction)bufferedrwpair_readinto, METH_VARARGS}, - - {"write", (PyCFunction)bufferedrwpair_write, METH_VARARGS}, - {"flush", (PyCFunction)bufferedrwpair_flush, METH_NOARGS}, - - {"readable", (PyCFunction)bufferedrwpair_readable, METH_NOARGS}, - {"writable", (PyCFunction)bufferedrwpair_writable, METH_NOARGS}, - - {"close", (PyCFunction)bufferedrwpair_close, METH_NOARGS}, - {"isatty", (PyCFunction)bufferedrwpair_isatty, METH_NOARGS}, - - {NULL, NULL} -}; - -static PyGetSetDef bufferedrwpair_getset[] = { - {"closed", (getter)bufferedrwpair_closed_get, NULL, NULL}, - {NULL} -}; - -PyTypeObject PyBufferedRWPair_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.BufferedRWPair", /*tp_name*/ - sizeof(rwpair), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)bufferedrwpair_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - bufferedrwpair_doc, /* tp_doc */ - (traverseproc)bufferedrwpair_traverse, /* tp_traverse */ - (inquiry)bufferedrwpair_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(rwpair, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - bufferedrwpair_methods, /* tp_methods */ - 0, /* tp_members */ - bufferedrwpair_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(rwpair, dict), /* tp_dictoffset */ - (initproc)bufferedrwpair_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - - -/* - * BufferedRandom - */ - -PyDoc_STRVAR(bufferedrandom_doc, - "A buffered interface to random access streams.\n" - "\n" - "The constructor creates a reader and writer for a seekable stream,\n" - "raw, given in the first argument. If the buffer_size is omitted it\n" - "defaults to DEFAULT_BUFFER_SIZE. max_buffer_size isn't used anymore.\n" - ); - -static int -bufferedrandom_init(buffered *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"raw", "buffer_size", "max_buffer_size", NULL}; - Py_ssize_t buffer_size = DEFAULT_BUFFER_SIZE; - Py_ssize_t max_buffer_size = -234; - PyObject *raw; - - self->ok = 0; - self->detached = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|nn:BufferedRandom", kwlist, - &raw, &buffer_size, &max_buffer_size)) { - return -1; - } - - if (max_buffer_size != -234 && !complain_about_max_buffer_size()) - return -1; - - if (_PyIOBase_check_seekable(raw, Py_True) == NULL) - return -1; - if (_PyIOBase_check_readable(raw, Py_True) == NULL) - return -1; - if (_PyIOBase_check_writable(raw, Py_True) == NULL) - return -1; - - Py_CLEAR(self->raw); - Py_INCREF(raw); - self->raw = raw; - self->buffer_size = buffer_size; - self->readable = 1; - self->writable = 1; - - if (_buffered_init(self) < 0) - return -1; - _bufferedreader_reset_buf(self); - _bufferedwriter_reset_buf(self); - self->pos = 0; - - self->fast_closed_checks = (Py_TYPE(self) == &PyBufferedRandom_Type && - Py_TYPE(raw) == &PyFileIO_Type); - - self->ok = 1; - return 0; -} - -static PyMethodDef bufferedrandom_methods[] = { - /* BufferedIOMixin methods */ - {"close", (PyCFunction)buffered_close, METH_NOARGS}, - {"detach", (PyCFunction)buffered_detach, METH_NOARGS}, - {"seekable", (PyCFunction)buffered_seekable, METH_NOARGS}, - {"readable", (PyCFunction)buffered_readable, METH_NOARGS}, - {"writable", (PyCFunction)buffered_writable, METH_NOARGS}, - {"fileno", (PyCFunction)buffered_fileno, METH_NOARGS}, - {"isatty", (PyCFunction)buffered_isatty, METH_NOARGS}, - - {"flush", (PyCFunction)buffered_flush, METH_NOARGS}, - - {"seek", (PyCFunction)buffered_seek, METH_VARARGS}, - {"tell", (PyCFunction)buffered_tell, METH_NOARGS}, - {"truncate", (PyCFunction)buffered_truncate, METH_VARARGS}, - {"read", (PyCFunction)buffered_read, METH_VARARGS}, - {"read1", (PyCFunction)buffered_read1, METH_VARARGS}, - {"readinto", (PyCFunction)buffered_readinto, METH_VARARGS}, - {"readline", (PyCFunction)buffered_readline, METH_VARARGS}, - {"peek", (PyCFunction)buffered_peek, METH_VARARGS}, - {"write", (PyCFunction)bufferedwriter_write, METH_VARARGS}, - {"__sizeof__", (PyCFunction)buffered_sizeof, METH_NOARGS}, - {NULL, NULL} -}; - -static PyMemberDef bufferedrandom_members[] = { - {"raw", T_OBJECT, offsetof(buffered, raw), READONLY}, - {NULL} -}; - -static PyGetSetDef bufferedrandom_getset[] = { - {"closed", (getter)buffered_closed_get, NULL, NULL}, - {"name", (getter)buffered_name_get, NULL, NULL}, - {"mode", (getter)buffered_mode_get, NULL, NULL}, - {NULL} -}; - - -PyTypeObject PyBufferedRandom_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.BufferedRandom", /*tp_name*/ - sizeof(buffered), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)buffered_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - (reprfunc)buffered_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - bufferedrandom_doc, /* tp_doc */ - (traverseproc)buffered_traverse, /* tp_traverse */ - (inquiry)buffered_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(buffered, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - (iternextfunc)buffered_iternext, /* tp_iternext */ - bufferedrandom_methods, /* tp_methods */ - bufferedrandom_members, /* tp_members */ - bufferedrandom_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /*tp_dict*/ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(buffered, dict), /*tp_dictoffset*/ - (initproc)bufferedrandom_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bytesio.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bytesio.c deleted file mode 100644 index 36cfb76..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/bytesio.c +++ /dev/null @@ -1,909 +0,0 @@ -#include "Python.h" -#include "structmember.h" /* for offsetof() */ -#include "_iomodule.h" - -typedef struct { - PyObject_HEAD - char *buf; - Py_ssize_t pos; - Py_ssize_t string_size; - size_t buf_size; - PyObject *dict; - PyObject *weakreflist; -} bytesio; - -#define CHECK_CLOSED(self) \ - if ((self)->buf == NULL) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on closed file."); \ - return NULL; \ - } - -/* Internal routine to get a line from the buffer of a BytesIO - object. Returns the length between the current position to the - next newline character. */ -static Py_ssize_t -get_line(bytesio *self, char **output) -{ - char *n; - const char *str_end; - Py_ssize_t len; - - assert(self->buf != NULL); - - /* Move to the end of the line, up to the end of the string, s. */ - str_end = self->buf + self->string_size; - for (n = self->buf + self->pos; - n < str_end && *n != '\n'; - n++); - - /* Skip the newline character */ - if (n < str_end) - n++; - - /* Get the length from the current position to the end of the line. */ - len = n - (self->buf + self->pos); - *output = self->buf + self->pos; - - assert(len >= 0); - assert(self->pos < PY_SSIZE_T_MAX - len); - self->pos += len; - - return len; -} - -/* Internal routine for changing the size of the buffer of BytesIO objects. - The caller should ensure that the 'size' argument is non-negative. Returns - 0 on success, -1 otherwise. */ -static int -resize_buffer(bytesio *self, size_t size) -{ - /* Here, unsigned types are used to avoid dealing with signed integer - overflow, which is undefined in C. */ - size_t alloc = self->buf_size; - char *new_buf = NULL; - - assert(self->buf != NULL); - - /* For simplicity, stay in the range of the signed type. Anyway, Python - doesn't allow strings to be longer than this. */ - if (size > PY_SSIZE_T_MAX) - goto overflow; - - if (size < alloc / 2) { - /* Major downsize; resize down to exact size. */ - alloc = size + 1; - } - else if (size < alloc) { - /* Within allocated size; quick exit */ - return 0; - } - else if (size <= alloc * 1.125) { - /* Moderate upsize; overallocate similar to list_resize() */ - alloc = size + (size >> 3) + (size < 9 ? 3 : 6); - } - else { - /* Major upsize; resize up to exact size */ - alloc = size + 1; - } - - if (alloc > ((size_t)-1) / sizeof(char)) - goto overflow; - new_buf = (char *)PyMem_Realloc(self->buf, alloc * sizeof(char)); - if (new_buf == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buf_size = alloc; - self->buf = new_buf; - - return 0; - - overflow: - PyErr_SetString(PyExc_OverflowError, - "new buffer size too large"); - return -1; -} - -/* Internal routine for writing a string of bytes to the buffer of a BytesIO - object. Returns the number of bytes written, or -1 on error. */ -static Py_ssize_t -write_bytes(bytesio *self, const char *bytes, Py_ssize_t len) -{ - assert(self->buf != NULL); - assert(self->pos >= 0); - assert(len >= 0); - - if ((size_t)self->pos + len > self->buf_size) { - if (resize_buffer(self, (size_t)self->pos + len) < 0) - return -1; - } - - if (self->pos > self->string_size) { - /* In case of overseek, pad with null bytes the buffer region between - the end of stream and the current position. - - 0 lo string_size hi - | |<---used--->|<----------available----------->| - | | <--to pad-->|<---to write---> | - 0 buf position - */ - memset(self->buf + self->string_size, '\0', - (self->pos - self->string_size) * sizeof(char)); - } - - /* Copy the data to the internal buffer, overwriting some of the existing - data if self->pos < self->string_size. */ - memcpy(self->buf + self->pos, bytes, len); - self->pos += len; - - /* Set the new length of the internal string if it has changed. */ - if (self->string_size < self->pos) { - self->string_size = self->pos; - } - - return len; -} - -static PyObject * -bytesio_get_closed(bytesio *self) -{ - if (self->buf == NULL) { - Py_RETURN_TRUE; - } - else { - Py_RETURN_FALSE; - } -} - -PyDoc_STRVAR(readable_doc, -"readable() -> bool. Returns True if the IO object can be read."); - -PyDoc_STRVAR(writable_doc, -"writable() -> bool. Returns True if the IO object can be written."); - -PyDoc_STRVAR(seekable_doc, -"seekable() -> bool. Returns True if the IO object can be seeked."); - -/* Generic getter for the writable, readable and seekable properties */ -static PyObject * -return_not_closed(bytesio *self) -{ - CHECK_CLOSED(self); - Py_RETURN_TRUE; -} - -PyDoc_STRVAR(flush_doc, -"flush() -> None. Does nothing."); - -static PyObject * -bytesio_flush(bytesio *self) -{ - CHECK_CLOSED(self); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(getval_doc, -"getvalue() -> bytes.\n" -"\n" -"Retrieve the entire contents of the BytesIO object."); - -static PyObject * -bytesio_getvalue(bytesio *self) -{ - CHECK_CLOSED(self); - return PyBytes_FromStringAndSize(self->buf, self->string_size); -} - -PyDoc_STRVAR(isatty_doc, -"isatty() -> False.\n" -"\n" -"Always returns False since BytesIO objects are not connected\n" -"to a tty-like device."); - -static PyObject * -bytesio_isatty(bytesio *self) -{ - CHECK_CLOSED(self); - Py_RETURN_FALSE; -} - -PyDoc_STRVAR(tell_doc, -"tell() -> current file position, an integer\n"); - -static PyObject * -bytesio_tell(bytesio *self) -{ - CHECK_CLOSED(self); - return PyLong_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(read_doc, -"read([size]) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative, read until EOF is reached.\n" -"Return an empty string at EOF."); - -static PyObject * -bytesio_read(bytesio *self, PyObject *args) -{ - Py_ssize_t size, n; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:read", &arg)) - return NULL; - - if (PyNumber_Check(arg)) { - size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Read until EOF is reached, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - /* adjust invalid sizes */ - n = self->string_size - self->pos; - if (size < 0 || size > n) { - size = n; - if (size < 0) - size = 0; - } - - assert(self->buf != NULL); - output = self->buf + self->pos; - self->pos += size; - - return PyBytes_FromStringAndSize(output, size); -} - - -PyDoc_STRVAR(read1_doc, -"read1(size) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative or omitted, read until EOF is reached.\n" -"Return an empty string at EOF."); - -static PyObject * -bytesio_read1(bytesio *self, PyObject *n) -{ - PyObject *arg, *res; - - arg = PyTuple_Pack(1, n); - if (arg == NULL) - return NULL; - res = bytesio_read(self, arg); - Py_DECREF(arg); - return res; -} - -PyDoc_STRVAR(readline_doc, -"readline([size]) -> next line from the file, as a string.\n" -"\n" -"Retain newline. A non-negative size argument limits the maximum\n" -"number of bytes to return (an incomplete line may be returned then).\n" -"Return an empty string at EOF.\n"); - -static PyObject * -bytesio_readline(bytesio *self, PyObject *args) -{ - Py_ssize_t size, n; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:readline", &arg)) - return NULL; - - if (PyNumber_Check(arg)) { - size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* No size limit, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - n = get_line(self, &output); - - if (size >= 0 && size < n) { - size = n - size; - n -= size; - self->pos -= size; - } - - return PyBytes_FromStringAndSize(output, n); -} - -PyDoc_STRVAR(readlines_doc, -"readlines([size]) -> list of strings, each a line from the file.\n" -"\n" -"Call readline() repeatedly and return a list of the lines so read.\n" -"The optional size argument, if given, is an approximate bound on the\n" -"total number of bytes in the lines returned.\n"); - -static PyObject * -bytesio_readlines(bytesio *self, PyObject *args) -{ - Py_ssize_t maxsize, size, n; - PyObject *result, *line; - char *output; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:readlines", &arg)) - return NULL; - - if (PyNumber_Check(arg)) { - maxsize = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (maxsize == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* No size limit, by default. */ - maxsize = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - size = 0; - result = PyList_New(0); - if (!result) - return NULL; - - while ((n = get_line(self, &output)) != 0) { - line = PyBytes_FromStringAndSize(output, n); - if (!line) - goto on_error; - if (PyList_Append(result, line) == -1) { - Py_DECREF(line); - goto on_error; - } - Py_DECREF(line); - size += n; - if (maxsize > 0 && size >= maxsize) - break; - } - return result; - - on_error: - Py_DECREF(result); - return NULL; -} - -PyDoc_STRVAR(readinto_doc, -"readinto(bytearray) -> int. Read up to len(b) bytes into b.\n" -"\n" -"Returns number of bytes read (0 for EOF), or None if the object\n" -"is set not to block as has no data to read."); - -static PyObject * -bytesio_readinto(bytesio *self, PyObject *args) -{ - Py_buffer buf; - Py_ssize_t len, n; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "w*", &buf)) - return NULL; - - len = buf.len; - /* adjust invalid sizes */ - n = self->string_size - self->pos; - if (len > n) { - len = n; - if (len < 0) - len = 0; - } - - memcpy(buf.buf, self->buf + self->pos, len); - assert(self->pos + len < PY_SSIZE_T_MAX); - assert(len >= 0); - self->pos += len; - - PyBuffer_Release(&buf); - return PyLong_FromSsize_t(len); -} - -PyDoc_STRVAR(truncate_doc, -"truncate([size]) -> int. Truncate the file to at most size bytes.\n" -"\n" -"Size defaults to the current file position, as returned by tell().\n" -"The current file position is unchanged. Returns the new size.\n"); - -static PyObject * -bytesio_truncate(bytesio *self, PyObject *args) -{ - Py_ssize_t size; - PyObject *arg = Py_None; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "|O:truncate", &arg)) - return NULL; - - if (PyNumber_Check(arg)) { - size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Truncate to current position if no argument is passed. */ - size = self->pos; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - if (size < 0) { - PyErr_Format(PyExc_ValueError, - "negative size value %zd", size); - return NULL; - } - - if (size < self->string_size) { - self->string_size = size; - if (resize_buffer(self, size) < 0) - return NULL; - } - - return PyLong_FromSsize_t(size); -} - -static PyObject * -bytesio_iternext(bytesio *self) -{ - char *next; - Py_ssize_t n; - - CHECK_CLOSED(self); - - n = get_line(self, &next); - - if (!next || n == 0) - return NULL; - - return PyBytes_FromStringAndSize(next, n); -} - -PyDoc_STRVAR(seek_doc, -"seek(pos, whence=0) -> int. Change stream position.\n" -"\n" -"Seek to byte offset pos relative to position indicated by whence:\n" -" 0 Start of stream (the default). pos should be >= 0;\n" -" 1 Current position - pos may be negative;\n" -" 2 End of stream - pos usually negative.\n" -"Returns the new absolute position."); - -static PyObject * -bytesio_seek(bytesio *self, PyObject *args) -{ - PyObject *posobj; - Py_ssize_t pos; - int mode = 0; - - CHECK_CLOSED(self); - - if (!PyArg_ParseTuple(args, "O|i:seek", &posobj, &mode)) - return NULL; - - pos = PyNumber_AsSsize_t(posobj, PyExc_OverflowError); - if (pos == -1 && PyErr_Occurred()) - return NULL; - - if (pos < 0 && mode == 0) { - PyErr_Format(PyExc_ValueError, - "negative seek value %zd", pos); - return NULL; - } - - /* mode 0: offset relative to beginning of the string. - mode 1: offset relative to current position. - mode 2: offset relative the end of the string. */ - if (mode == 1) { - if (pos > PY_SSIZE_T_MAX - self->pos) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return NULL; - } - pos += self->pos; - } - else if (mode == 2) { - if (pos > PY_SSIZE_T_MAX - self->string_size) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return NULL; - } - pos += self->string_size; - } - else if (mode != 0) { - PyErr_Format(PyExc_ValueError, - "invalid whence (%i, should be 0, 1 or 2)", mode); - return NULL; - } - - if (pos < 0) - pos = 0; - self->pos = pos; - - return PyLong_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(write_doc, -"write(bytes) -> int. Write bytes to file.\n" -"\n" -"Return the number of bytes written."); - -static PyObject * -bytesio_write(bytesio *self, PyObject *obj) -{ - Py_ssize_t n = 0; - Py_buffer buf; - PyObject *result = NULL; - - CHECK_CLOSED(self); - - if (PyObject_GetBuffer(obj, &buf, PyBUF_CONTIG_RO) < 0) - return NULL; - - if (buf.len != 0) - n = write_bytes(self, buf.buf, buf.len); - if (n >= 0) - result = PyLong_FromSsize_t(n); - - PyBuffer_Release(&buf); - return result; -} - -PyDoc_STRVAR(writelines_doc, -"writelines(sequence_of_strings) -> None. Write strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable\n" -"object producing strings. This is equivalent to calling write() for\n" -"each string."); - -static PyObject * -bytesio_writelines(bytesio *self, PyObject *v) -{ - PyObject *it, *item; - PyObject *ret; - - CHECK_CLOSED(self); - - it = PyObject_GetIter(v); - if (it == NULL) - return NULL; - - while ((item = PyIter_Next(it)) != NULL) { - ret = bytesio_write(self, item); - Py_DECREF(item); - if (ret == NULL) { - Py_DECREF(it); - return NULL; - } - Py_DECREF(ret); - } - Py_DECREF(it); - - /* See if PyIter_Next failed */ - if (PyErr_Occurred()) - return NULL; - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(close_doc, -"close() -> None. Disable all I/O operations."); - -static PyObject * -bytesio_close(bytesio *self) -{ - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_RETURN_NONE; -} - -/* Pickling support. - - Note that only pickle protocol 2 and onward are supported since we use - extended __reduce__ API of PEP 307 to make BytesIO instances picklable. - - Providing support for protocol < 2 would require the __reduce_ex__ method - which is notably long-winded when defined properly. - - For BytesIO, the implementation would similar to one coded for - object.__reduce_ex__, but slightly less general. To be more specific, we - could call bytesio_getstate directly and avoid checking for the presence of - a fallback __reduce__ method. However, we would still need a __newobj__ - function to use the efficient instance representation of PEP 307. - */ - -static PyObject * -bytesio_getstate(bytesio *self) -{ - PyObject *initvalue = bytesio_getvalue(self); - PyObject *dict; - PyObject *state; - - if (initvalue == NULL) - return NULL; - if (self->dict == NULL) { - Py_INCREF(Py_None); - dict = Py_None; - } - else { - dict = PyDict_Copy(self->dict); - if (dict == NULL) - return NULL; - } - - state = Py_BuildValue("(OnN)", initvalue, self->pos, dict); - Py_DECREF(initvalue); - return state; -} - -static PyObject * -bytesio_setstate(bytesio *self, PyObject *state) -{ - PyObject *result; - PyObject *position_obj; - PyObject *dict; - Py_ssize_t pos; - - assert(state != NULL); - - /* We allow the state tuple to be longer than 3, because we may need - someday to extend the object's state without breaking - backward-compatibility. */ - if (!PyTuple_Check(state) || Py_SIZE(state) < 3) { - PyErr_Format(PyExc_TypeError, - "%.200s.__setstate__ argument should be 3-tuple, got %.200s", - Py_TYPE(self)->tp_name, Py_TYPE(state)->tp_name); - return NULL; - } - /* Reset the object to its default state. This is only needed to handle - the case of repeated calls to __setstate__. */ - self->string_size = 0; - self->pos = 0; - - /* Set the value of the internal buffer. If state[0] does not support the - buffer protocol, bytesio_write will raise the appropriate TypeError. */ - result = bytesio_write(self, PyTuple_GET_ITEM(state, 0)); - if (result == NULL) - return NULL; - Py_DECREF(result); - - /* Set carefully the position value. Alternatively, we could use the seek - method instead of modifying self->pos directly to better protect the - object internal state against errneous (or malicious) inputs. */ - position_obj = PyTuple_GET_ITEM(state, 1); - if (!PyIndex_Check(position_obj)) { - PyErr_Format(PyExc_TypeError, - "second item of state must be an integer, not %.200s", - Py_TYPE(position_obj)->tp_name); - return NULL; - } - pos = PyNumber_AsSsize_t(position_obj, PyExc_OverflowError); - if (pos == -1 && PyErr_Occurred()) - return NULL; - if (pos < 0) { - PyErr_SetString(PyExc_ValueError, - "position value cannot be negative"); - return NULL; - } - self->pos = pos; - - /* Set the dictionary of the instance variables. */ - dict = PyTuple_GET_ITEM(state, 2); - if (dict != Py_None) { - if (!PyDict_Check(dict)) { - PyErr_Format(PyExc_TypeError, - "third item of state should be a dict, got a %.200s", - Py_TYPE(dict)->tp_name); - return NULL; - } - if (self->dict) { - /* Alternatively, we could replace the internal dictionary - completely. However, it seems more practical to just update it. */ - if (PyDict_Update(self->dict, dict) < 0) - return NULL; - } - else { - Py_INCREF(dict); - self->dict = dict; - } - } - - Py_RETURN_NONE; -} - -static void -bytesio_dealloc(bytesio *self) -{ - _PyObject_GC_UNTRACK(self); - if (self->buf != NULL) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_CLEAR(self->dict); - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - Py_TYPE(self)->tp_free(self); -} - -static PyObject * -bytesio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - bytesio *self; - - assert(type != NULL && type->tp_alloc != NULL); - self = (bytesio *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - /* tp_alloc initializes all the fields to zero. So we don't have to - initialize them here. */ - - self->buf = (char *)PyMem_Malloc(0); - if (self->buf == NULL) { - Py_DECREF(self); - return PyErr_NoMemory(); - } - - return (PyObject *)self; -} - -static int -bytesio_init(bytesio *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"initial_bytes", NULL}; - PyObject *initvalue = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:BytesIO", kwlist, - &initvalue)) - return -1; - - /* In case, __init__ is called multiple times. */ - self->string_size = 0; - self->pos = 0; - - if (initvalue && initvalue != Py_None) { - PyObject *res; - res = bytesio_write(self, initvalue); - if (res == NULL) - return -1; - Py_DECREF(res); - self->pos = 0; - } - - return 0; -} - -static PyObject * -bytesio_sizeof(bytesio *self, void *unused) -{ - Py_ssize_t res; - - res = sizeof(bytesio); - if (self->buf) - res += self->buf_size; - return PyLong_FromSsize_t(res); -} - -static int -bytesio_traverse(bytesio *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dict); - return 0; -} - -static int -bytesio_clear(bytesio *self) -{ - Py_CLEAR(self->dict); - return 0; -} - - -static PyGetSetDef bytesio_getsetlist[] = { - {"closed", (getter)bytesio_get_closed, NULL, - "True if the file is closed."}, - {NULL}, /* sentinel */ -}; - -static struct PyMethodDef bytesio_methods[] = { - {"readable", (PyCFunction)return_not_closed, METH_NOARGS, readable_doc}, - {"seekable", (PyCFunction)return_not_closed, METH_NOARGS, seekable_doc}, - {"writable", (PyCFunction)return_not_closed, METH_NOARGS, writable_doc}, - {"close", (PyCFunction)bytesio_close, METH_NOARGS, close_doc}, - {"flush", (PyCFunction)bytesio_flush, METH_NOARGS, flush_doc}, - {"isatty", (PyCFunction)bytesio_isatty, METH_NOARGS, isatty_doc}, - {"tell", (PyCFunction)bytesio_tell, METH_NOARGS, tell_doc}, - {"write", (PyCFunction)bytesio_write, METH_O, write_doc}, - {"writelines", (PyCFunction)bytesio_writelines, METH_O, writelines_doc}, - {"read1", (PyCFunction)bytesio_read1, METH_O, read1_doc}, - {"readinto", (PyCFunction)bytesio_readinto, METH_VARARGS, readinto_doc}, - {"readline", (PyCFunction)bytesio_readline, METH_VARARGS, readline_doc}, - {"readlines", (PyCFunction)bytesio_readlines, METH_VARARGS, readlines_doc}, - {"read", (PyCFunction)bytesio_read, METH_VARARGS, read_doc}, - {"getvalue", (PyCFunction)bytesio_getvalue, METH_NOARGS, getval_doc}, - {"seek", (PyCFunction)bytesio_seek, METH_VARARGS, seek_doc}, - {"truncate", (PyCFunction)bytesio_truncate, METH_VARARGS, truncate_doc}, - {"__getstate__", (PyCFunction)bytesio_getstate, METH_NOARGS, NULL}, - {"__setstate__", (PyCFunction)bytesio_setstate, METH_O, NULL}, - {"__sizeof__", (PyCFunction)bytesio_sizeof, METH_NOARGS, NULL}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(bytesio_doc, -"BytesIO([buffer]) -> object\n" -"\n" -"Create a buffered I/O implementation using an in-memory bytes\n" -"buffer, ready for reading and writing."); - -PyTypeObject PyBytesIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.BytesIO", /*tp_name*/ - sizeof(bytesio), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)bytesio_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_reserved*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - bytesio_doc, /*tp_doc*/ - (traverseproc)bytesio_traverse, /*tp_traverse*/ - (inquiry)bytesio_clear, /*tp_clear*/ - 0, /*tp_richcompare*/ - offsetof(bytesio, weakreflist), /*tp_weaklistoffset*/ - PyObject_SelfIter, /*tp_iter*/ - (iternextfunc)bytesio_iternext, /*tp_iternext*/ - bytesio_methods, /*tp_methods*/ - 0, /*tp_members*/ - bytesio_getsetlist, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - offsetof(bytesio, dict), /*tp_dictoffset*/ - (initproc)bytesio_init, /*tp_init*/ - 0, /*tp_alloc*/ - bytesio_new, /*tp_new*/ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/fileio.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/fileio.c deleted file mode 100644 index b69d366..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/fileio.c +++ /dev/null @@ -1,1118 +0,0 @@ -/* Author: Daniel Stutzbach */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#include /* For offsetof */ -#include "_iomodule.h" - -/* - * Known likely problems: - * - * - Files larger then 2**32-1 - * - Files with unicode filenames - * - Passing numbers greater than 2**32-1 when an integer is expected - * - Making it work on Windows and other oddball platforms - * - * To Do: - * - * - autoconfify header file inclusion - */ - -#ifdef MS_WINDOWS -/* can simulate truncate with Win32 API functions; see file_truncate */ -#define HAVE_FTRUNCATE -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#if BUFSIZ < (8*1024) -#define SMALLCHUNK (8*1024) -#elif (BUFSIZ >= (2 << 25)) -#error "unreasonable BUFSIZ > 64MB defined" -#else -#define SMALLCHUNK BUFSIZ -#endif - -typedef struct { - PyObject_HEAD - int fd; - unsigned int readable : 1; - unsigned int writable : 1; - unsigned int appending : 1; - signed int seekable : 2; /* -1 means unknown */ - unsigned int closefd : 1; - PyObject *weakreflist; - PyObject *dict; -} fileio; - -PyTypeObject PyFileIO_Type; - -#define PyFileIO_Check(op) (PyObject_TypeCheck((op), &PyFileIO_Type)) - -int -_PyFileIO_closed(PyObject *self) -{ - return ((fileio *)self)->fd < 0; -} - -static PyObject * -portable_lseek(int fd, PyObject *posobj, int whence); - -static PyObject *portable_lseek(int fd, PyObject *posobj, int whence); - -/* Returns 0 on success, -1 with exception set on failure. */ -static int -internal_close(fileio *self) -{ - int err = 0; - int save_errno = 0; - if (self->fd >= 0) { - int fd = self->fd; - self->fd = -1; - /* fd is accessible and someone else may have closed it */ - if (_PyVerify_fd(fd)) { - Py_BEGIN_ALLOW_THREADS - err = close(fd); - if (err < 0) - save_errno = errno; - Py_END_ALLOW_THREADS - } else { - save_errno = errno; - err = -1; - } - } - if (err < 0) { - errno = save_errno; - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - return 0; -} - -static PyObject * -fileio_close(fileio *self) -{ - PyObject *res; - res = PyObject_CallMethod((PyObject*)&PyRawIOBase_Type, - "close", "O", self); - if (!self->closefd) { - self->fd = -1; - return res; - } - if (internal_close(self) < 0) - Py_CLEAR(res); - return res; -} - -static PyObject * -fileio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - fileio *self; - - assert(type != NULL && type->tp_alloc != NULL); - - self = (fileio *) type->tp_alloc(type, 0); - if (self != NULL) { - self->fd = -1; - self->readable = 0; - self->writable = 0; - self->appending = 0; - self->seekable = -1; - self->closefd = 1; - self->weakreflist = NULL; - } - - return (PyObject *) self; -} - -/* On Unix, open will succeed for directories. - In Python, there should be no file objects referring to - directories, so we need a check. */ - -static int -dircheck(fileio* self, PyObject *nameobj) -{ -#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) - struct stat buf; - if (self->fd < 0) - return 0; - if (fstat(self->fd, &buf) == 0 && S_ISDIR(buf.st_mode)) { - errno = EISDIR; - PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, nameobj); - return -1; - } -#endif - return 0; -} - -static int -check_fd(int fd) -{ -#if defined(HAVE_FSTAT) - struct stat buf; - if (!_PyVerify_fd(fd) || (fstat(fd, &buf) < 0 && errno == EBADF)) { - PyObject *exc; - char *msg = strerror(EBADF); - exc = PyObject_CallFunction(PyExc_OSError, "(is)", - EBADF, msg); - PyErr_SetObject(PyExc_OSError, exc); - Py_XDECREF(exc); - return -1; - } -#endif - return 0; -} - - -static int -fileio_init(PyObject *oself, PyObject *args, PyObject *kwds) -{ - fileio *self = (fileio *) oself; - static char *kwlist[] = {"file", "mode", "closefd", NULL}; - const char *name = NULL; - PyObject *nameobj, *stringobj = NULL; - char *mode = "r"; - char *s; -#ifdef MS_WINDOWS - Py_UNICODE *widename = NULL; -#endif - int ret = 0; - int rwa = 0, plus = 0; - int flags = 0; - int fd = -1; - int closefd = 1; - int fd_is_own = 0; - - assert(PyFileIO_Check(oself)); - if (self->fd >= 0) { - if (self->closefd) { - /* Have to close the existing file first. */ - if (internal_close(self) < 0) - return -1; - } - else - self->fd = -1; - } - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:fileio", - kwlist, &nameobj, &mode, &closefd)) - return -1; - - if (PyFloat_Check(nameobj)) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float"); - return -1; - } - - fd = _PyLong_AsInt(nameobj); - if (fd < 0) { - if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ValueError, - "negative file descriptor"); - return -1; - } - PyErr_Clear(); - } - -#ifdef MS_WINDOWS - if (PyUnicode_Check(nameobj)) - widename = PyUnicode_AS_UNICODE(nameobj); - if (widename == NULL) -#endif - if (fd < 0) - { - if (PyBytes_Check(nameobj) || PyByteArray_Check(nameobj)) { - Py_ssize_t namelen; - if (PyObject_AsCharBuffer(nameobj, &name, &namelen) < 0) - return -1; - } - else { - PyObject *u = PyUnicode_FromObject(nameobj); - - if (u == NULL) - return -1; - - stringobj = PyUnicode_AsEncodedString( - u, Py_FileSystemDefaultEncoding, NULL); - Py_DECREF(u); - if (stringobj == NULL) - return -1; - if (!PyBytes_Check(stringobj)) { - PyErr_SetString(PyExc_TypeError, - "encoder failed to return bytes"); - goto error; - } - name = PyBytes_AS_STRING(stringobj); - } - } - - s = mode; - while (*s) { - switch (*s++) { - case 'r': - if (rwa) { - bad_mode: - PyErr_SetString(PyExc_ValueError, - "Must have exactly one of read/write/append " - "mode and at most one plus"); - goto error; - } - rwa = 1; - self->readable = 1; - break; - case 'w': - if (rwa) - goto bad_mode; - rwa = 1; - self->writable = 1; - flags |= O_CREAT | O_TRUNC; - break; - case 'a': - if (rwa) - goto bad_mode; - rwa = 1; - self->writable = 1; - self->appending = 1; - flags |= O_APPEND | O_CREAT; - break; - case 'b': - break; - case '+': - if (plus) - goto bad_mode; - self->readable = self->writable = 1; - plus = 1; - break; - default: - PyErr_Format(PyExc_ValueError, - "invalid mode: %.200s", mode); - goto error; - } - } - - if (!rwa) - goto bad_mode; - - if (self->readable && self->writable) - flags |= O_RDWR; - else if (self->readable) - flags |= O_RDONLY; - else - flags |= O_WRONLY; - -#ifdef O_BINARY - flags |= O_BINARY; -#endif - - if (fd >= 0) { - if (check_fd(fd)) - goto error; - self->fd = fd; - self->closefd = closefd; - } - else { - self->closefd = 1; - if (!closefd) { - PyErr_SetString(PyExc_ValueError, - "Cannot use closefd=False with file name"); - goto error; - } - - Py_BEGIN_ALLOW_THREADS - errno = 0; -#ifdef MS_WINDOWS - if (widename != NULL) - self->fd = _wopen(widename, flags, 0666); - else -#endif - self->fd = open(name, flags, 0666); - Py_END_ALLOW_THREADS - fd_is_own = 1; - if (self->fd < 0) { -#ifdef MS_WINDOWS - if (widename != NULL) - PyErr_SetFromErrnoWithUnicodeFilename(PyExc_IOError, widename); - else -#endif - PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); - goto error; - } - } - if (dircheck(self, nameobj) < 0) - goto error; - - if (PyObject_SetAttrString((PyObject *)self, "name", nameobj) < 0) - goto error; - - if (self->appending) { - /* For consistent behaviour, we explicitly seek to the - end of file (otherwise, it might be done only on the - first write()). */ - PyObject *pos = portable_lseek(self->fd, NULL, 2); - if (pos == NULL) - goto error; - Py_DECREF(pos); - } - - goto done; - - error: - if (!fd_is_own) - self->fd = -1; - - ret = -1; - - done: - Py_CLEAR(stringobj); - return ret; -} - -static int -fileio_traverse(fileio *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dict); - return 0; -} - -static int -fileio_clear(fileio *self) -{ - Py_CLEAR(self->dict); - return 0; -} - -static void -fileio_dealloc(fileio *self) -{ - if (_PyIOBase_finalize((PyObject *) self) < 0) - return; - _PyObject_GC_UNTRACK(self); - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - Py_CLEAR(self->dict); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static PyObject * -err_closed(void) -{ - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); - return NULL; -} - -static PyObject * -err_mode(char *action) -{ - PyErr_Format(PyExc_ValueError, "File not open for %s", action); - return NULL; -} - -static PyObject * -fileio_fileno(fileio *self) -{ - if (self->fd < 0) - return err_closed(); - return PyInt_FromLong((long) self->fd); -} - -static PyObject * -fileio_readable(fileio *self) -{ - if (self->fd < 0) - return err_closed(); - return PyBool_FromLong((long) self->readable); -} - -static PyObject * -fileio_writable(fileio *self) -{ - if (self->fd < 0) - return err_closed(); - return PyBool_FromLong((long) self->writable); -} - -static PyObject * -fileio_seekable(fileio *self) -{ - if (self->fd < 0) - return err_closed(); - if (self->seekable < 0) { - PyObject *pos = portable_lseek(self->fd, NULL, SEEK_CUR); - if (pos == NULL) { - PyErr_Clear(); - self->seekable = 0; - } else { - Py_DECREF(pos); - self->seekable = 1; - } - } - return PyBool_FromLong((long) self->seekable); -} - -static PyObject * -fileio_readinto(fileio *self, PyObject *args) -{ - Py_buffer pbuf; - Py_ssize_t n, len; - - if (self->fd < 0) - return err_closed(); - if (!self->readable) - return err_mode("reading"); - - if (!PyArg_ParseTuple(args, "w*", &pbuf)) - return NULL; - - if (_PyVerify_fd(self->fd)) { - len = pbuf.len; - Py_BEGIN_ALLOW_THREADS - errno = 0; -#if defined(MS_WIN64) || defined(MS_WINDOWS) - if (len > INT_MAX) - len = INT_MAX; - n = read(self->fd, pbuf.buf, (int)len); -#else - n = read(self->fd, pbuf.buf, len); -#endif - Py_END_ALLOW_THREADS - } else - n = -1; - PyBuffer_Release(&pbuf); - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return PyLong_FromSsize_t(n); -} - -static size_t -new_buffersize(fileio *self, size_t currentsize) -{ -#ifdef HAVE_FSTAT - off_t pos, end; - struct stat st; - if (fstat(self->fd, &st) == 0) { - end = st.st_size; - pos = lseek(self->fd, 0L, SEEK_CUR); - /* Files claiming a size smaller than SMALLCHUNK may - actually be streaming pseudo-files. In this case, we - apply the more aggressive algorithm below. - */ - if (end >= SMALLCHUNK && end >= pos && pos >= 0) { - /* Add 1 so if the file were to grow we'd notice. */ - return currentsize + end - pos + 1; - } - } -#endif - /* Expand the buffer by an amount proportional to the current size, - giving us amortized linear-time behavior. Use a less-than-double - growth factor to avoid excessive allocation. */ - return currentsize + (currentsize >> 3) + 6; -} - -static PyObject * -fileio_readall(fileio *self) -{ - PyObject *result; - Py_ssize_t total = 0; - Py_ssize_t n; - - if (self->fd < 0) - return err_closed(); - if (!_PyVerify_fd(self->fd)) - return PyErr_SetFromErrno(PyExc_IOError); - - result = PyBytes_FromStringAndSize(NULL, SMALLCHUNK); - if (result == NULL) - return NULL; - - while (1) { - size_t newsize = new_buffersize(self, total); - if (newsize > PY_SSIZE_T_MAX || newsize <= 0) { - PyErr_SetString(PyExc_OverflowError, - "unbounded read returned more bytes " - "than a Python string can hold "); - Py_DECREF(result); - return NULL; - } - - if (PyBytes_GET_SIZE(result) < (Py_ssize_t)newsize) { - if (_PyBytes_Resize(&result, newsize) < 0) - return NULL; /* result has been freed */ - } - Py_BEGIN_ALLOW_THREADS - errno = 0; - n = newsize - total; -#if defined(MS_WIN64) || defined(MS_WINDOWS) - if (n > INT_MAX) - n = INT_MAX; - n = read(self->fd, - PyBytes_AS_STRING(result) + total, - (int)n); -#else - n = read(self->fd, - PyBytes_AS_STRING(result) + total, - n); -#endif - Py_END_ALLOW_THREADS - if (n == 0) - break; - if (n < 0) { - if (errno == EINTR) { - if (PyErr_CheckSignals()) { - Py_DECREF(result); - return NULL; - } - continue; - } - if (errno == EAGAIN) { - if (total > 0) - break; - Py_DECREF(result); - Py_RETURN_NONE; - } - Py_DECREF(result); - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - total += n; - } - - if (PyBytes_GET_SIZE(result) > total) { - if (_PyBytes_Resize(&result, total) < 0) { - /* This should never happen, but just in case */ - return NULL; - } - } - return result; -} - -static PyObject * -fileio_read(fileio *self, PyObject *args) -{ - char *ptr; - Py_ssize_t n; - Py_ssize_t size = -1; - PyObject *bytes; - - if (self->fd < 0) - return err_closed(); - if (!self->readable) - return err_mode("reading"); - - if (!PyArg_ParseTuple(args, "|O&", &_PyIO_ConvertSsize_t, &size)) - return NULL; - - if (size < 0) { - return fileio_readall(self); - } - -#if defined(MS_WIN64) || defined(MS_WINDOWS) - if (size > INT_MAX) - size = INT_MAX; -#endif - bytes = PyBytes_FromStringAndSize(NULL, size); - if (bytes == NULL) - return NULL; - ptr = PyBytes_AS_STRING(bytes); - - if (_PyVerify_fd(self->fd)) { - Py_BEGIN_ALLOW_THREADS - errno = 0; -#if defined(MS_WIN64) || defined(MS_WINDOWS) - n = read(self->fd, ptr, (int)size); -#else - n = read(self->fd, ptr, size); -#endif - Py_END_ALLOW_THREADS - } else - n = -1; - - if (n < 0) { - Py_DECREF(bytes); - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - if (n != size) { - if (_PyBytes_Resize(&bytes, n) < 0) - return NULL; - } - - return (PyObject *) bytes; -} - -static PyObject * -fileio_write(fileio *self, PyObject *args) -{ - Py_buffer pbuf; - Py_ssize_t n, len; - - if (self->fd < 0) - return err_closed(); - if (!self->writable) - return err_mode("writing"); - - if (!PyArg_ParseTuple(args, "s*", &pbuf)) - return NULL; - - if (_PyVerify_fd(self->fd)) { - Py_BEGIN_ALLOW_THREADS - errno = 0; - len = pbuf.len; -#if defined(MS_WIN64) || defined(MS_WINDOWS) - if (len > INT_MAX) - len = INT_MAX; - n = write(self->fd, pbuf.buf, (int)len); -#else - n = write(self->fd, pbuf.buf, len); -#endif - Py_END_ALLOW_THREADS - } else - n = -1; - - PyBuffer_Release(&pbuf); - - if (n < 0) { - if (errno == EAGAIN) - Py_RETURN_NONE; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return PyLong_FromSsize_t(n); -} - -/* XXX Windows support below is likely incomplete */ - -/* Cribbed from posix_lseek() */ -static PyObject * -portable_lseek(int fd, PyObject *posobj, int whence) -{ - Py_off_t pos, res; - -#ifdef SEEK_SET - /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ - switch (whence) { -#if SEEK_SET != 0 - case 0: whence = SEEK_SET; break; -#endif -#if SEEK_CUR != 1 - case 1: whence = SEEK_CUR; break; -#endif -#if SEEK_END != 2 - case 2: whence = SEEK_END; break; -#endif - } -#endif /* SEEK_SET */ - - if (posobj == NULL) - pos = 0; - else { - if(PyFloat_Check(posobj)) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return NULL; - } -#if defined(HAVE_LARGEFILE_SUPPORT) - pos = PyLong_AsLongLong(posobj); -#else - pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()) - return NULL; - } - - if (_PyVerify_fd(fd)) { - Py_BEGIN_ALLOW_THREADS -#if defined(MS_WIN64) || defined(MS_WINDOWS) - res = _lseeki64(fd, pos, whence); -#else - res = lseek(fd, pos, whence); -#endif - Py_END_ALLOW_THREADS - } else - res = -1; - if (res < 0) - return PyErr_SetFromErrno(PyExc_IOError); - -#if defined(HAVE_LARGEFILE_SUPPORT) - return PyLong_FromLongLong(res); -#else - return PyLong_FromLong(res); -#endif -} - -static PyObject * -fileio_seek(fileio *self, PyObject *args) -{ - PyObject *posobj; - int whence = 0; - - if (self->fd < 0) - return err_closed(); - - if (!PyArg_ParseTuple(args, "O|i", &posobj, &whence)) - return NULL; - - return portable_lseek(self->fd, posobj, whence); -} - -static PyObject * -fileio_tell(fileio *self, PyObject *args) -{ - if (self->fd < 0) - return err_closed(); - - return portable_lseek(self->fd, NULL, 1); -} - -#ifdef HAVE_FTRUNCATE -static PyObject * -fileio_truncate(fileio *self, PyObject *args) -{ - PyObject *posobj = NULL; /* the new size wanted by the user */ -#ifndef MS_WINDOWS - Py_off_t pos; -#endif - int ret; - int fd; - - fd = self->fd; - if (fd < 0) - return err_closed(); - if (!self->writable) - return err_mode("writing"); - - if (!PyArg_ParseTuple(args, "|O", &posobj)) - return NULL; - - if (posobj == Py_None || posobj == NULL) { - /* Get the current position. */ - posobj = portable_lseek(fd, NULL, 1); - if (posobj == NULL) - return NULL; - } - else { - Py_INCREF(posobj); - } - -#ifdef MS_WINDOWS - /* MS _chsize doesn't work if newsize doesn't fit in 32 bits, - so don't even try using it. */ - { - PyObject *oldposobj, *tempposobj; - HANDLE hFile; - - /* we save the file pointer position */ - oldposobj = portable_lseek(fd, NULL, 1); - if (oldposobj == NULL) { - Py_DECREF(posobj); - return NULL; - } - - /* we then move to the truncation position */ - tempposobj = portable_lseek(fd, posobj, 0); - if (tempposobj == NULL) { - Py_DECREF(oldposobj); - Py_DECREF(posobj); - return NULL; - } - Py_DECREF(tempposobj); - - /* Truncate. Note that this may grow the file! */ - Py_BEGIN_ALLOW_THREADS - errno = 0; - hFile = (HANDLE)_get_osfhandle(fd); - ret = hFile == (HANDLE)-1; /* testing for INVALID_HANDLE value */ - if (ret == 0) { - ret = SetEndOfFile(hFile) == 0; - if (ret) - errno = EACCES; - } - Py_END_ALLOW_THREADS - - /* we restore the file pointer position in any case */ - tempposobj = portable_lseek(fd, oldposobj, 0); - Py_DECREF(oldposobj); - if (tempposobj == NULL) { - Py_DECREF(posobj); - return NULL; - } - Py_DECREF(tempposobj); - } -#else - -#if defined(HAVE_LARGEFILE_SUPPORT) - pos = PyLong_AsLongLong(posobj); -#else - pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()){ - Py_DECREF(posobj); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - errno = 0; - ret = ftruncate(fd, pos); - Py_END_ALLOW_THREADS - -#endif /* !MS_WINDOWS */ - - if (ret != 0) { - Py_DECREF(posobj); - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - return posobj; -} -#endif /* HAVE_FTRUNCATE */ - -static char * -mode_string(fileio *self) -{ - if (self->appending) { - if (self->readable) - return "ab+"; - else - return "ab"; - } - else if (self->readable) { - if (self->writable) - return "rb+"; - else - return "rb"; - } - else - return "wb"; -} - -static PyObject * -fileio_repr(fileio *self) -{ - PyObject *nameobj, *res; - - if (self->fd < 0) - return PyString_FromFormat("<_io.FileIO [closed]>"); - - nameobj = PyObject_GetAttrString((PyObject *) self, "name"); - if (nameobj == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - res = PyString_FromFormat("<_io.FileIO fd=%d mode='%s'>", - self->fd, mode_string(self)); - } - else { - PyObject *repr = PyObject_Repr(nameobj); - Py_DECREF(nameobj); - if (repr == NULL) - return NULL; - res = PyString_FromFormat("<_io.FileIO name=%s mode='%s'>", - PyString_AS_STRING(repr), - mode_string(self)); - Py_DECREF(repr); - } - return res; -} - -static PyObject * -fileio_isatty(fileio *self) -{ - long res; - - if (self->fd < 0) - return err_closed(); - Py_BEGIN_ALLOW_THREADS - res = isatty(self->fd); - Py_END_ALLOW_THREADS - return PyBool_FromLong(res); -} - - -PyDoc_STRVAR(fileio_doc, -"file(name: str[, mode: str]) -> file IO object\n" -"\n" -"Open a file. The mode can be 'r' (default), 'w' or 'a' for reading,\n" -"writing or appending. The file will be created if it doesn't exist\n" -"when opened for writing or appending; it will be truncated when\n" -"opened for writing. Add a '+' to the mode to allow simultaneous\n" -"reading and writing."); - -PyDoc_STRVAR(read_doc, -"read(size: int) -> bytes. read at most size bytes, returned as bytes.\n" -"\n" -"Only makes one system call, so less data may be returned than requested\n" -"In non-blocking mode, returns None if no data is available.\n" -"On end-of-file, returns ''."); - -PyDoc_STRVAR(readall_doc, -"readall() -> bytes. read all data from the file, returned as bytes.\n" -"\n" -"In non-blocking mode, returns as much as is immediately available,\n" -"or None if no data is available. On end-of-file, returns ''."); - -PyDoc_STRVAR(write_doc, -"write(b: bytes) -> int. Write bytes b to file, return number written.\n" -"\n" -"Only makes one system call, so not all of the data may be written.\n" -"The number of bytes actually written is returned. In non-blocking mode,\n" -"returns None if the write would block." -); - -PyDoc_STRVAR(fileno_doc, -"fileno() -> int. Return the underlying file descriptor (an integer)."); - -PyDoc_STRVAR(seek_doc, -"seek(offset: int[, whence: int]) -> int. Move to new file position\n" -"and return the file position.\n" -"\n" -"Argument offset is a byte count. Optional argument whence defaults to\n" -"SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values\n" -"are SEEK_CUR or 1 (move relative to current position, positive or negative),\n" -"and SEEK_END or 2 (move relative to end of file, usually negative, although\n" -"many platforms allow seeking beyond the end of a file).\n" -"\n" -"Note that not all file objects are seekable."); - -#ifdef HAVE_FTRUNCATE -PyDoc_STRVAR(truncate_doc, -"truncate([size: int]) -> int. Truncate the file to at most size bytes and\n" -"return the truncated size.\n" -"\n" -"Size defaults to the current file position, as returned by tell().\n" -"The current file position is changed to the value of size."); -#endif - -PyDoc_STRVAR(tell_doc, -"tell() -> int. Current file position.\n" -"\n" -"Can raise OSError for non seekable files." -); - -PyDoc_STRVAR(readinto_doc, -"readinto() -> Same as RawIOBase.readinto()."); - -PyDoc_STRVAR(close_doc, -"close() -> None. Close the file.\n" -"\n" -"A closed file cannot be used for further I/O operations. close() may be\n" -"called more than once without error."); - -PyDoc_STRVAR(isatty_doc, -"isatty() -> bool. True if the file is connected to a TTY device."); - -PyDoc_STRVAR(seekable_doc, -"seekable() -> bool. True if file supports random-access."); - -PyDoc_STRVAR(readable_doc, -"readable() -> bool. True if file was opened in a read mode."); - -PyDoc_STRVAR(writable_doc, -"writable() -> bool. True if file was opened in a write mode."); - -static PyMethodDef fileio_methods[] = { - {"read", (PyCFunction)fileio_read, METH_VARARGS, read_doc}, - {"readall", (PyCFunction)fileio_readall, METH_NOARGS, readall_doc}, - {"readinto", (PyCFunction)fileio_readinto, METH_VARARGS, readinto_doc}, - {"write", (PyCFunction)fileio_write, METH_VARARGS, write_doc}, - {"seek", (PyCFunction)fileio_seek, METH_VARARGS, seek_doc}, - {"tell", (PyCFunction)fileio_tell, METH_VARARGS, tell_doc}, -#ifdef HAVE_FTRUNCATE - {"truncate", (PyCFunction)fileio_truncate, METH_VARARGS, truncate_doc}, -#endif - {"close", (PyCFunction)fileio_close, METH_NOARGS, close_doc}, - {"seekable", (PyCFunction)fileio_seekable, METH_NOARGS, seekable_doc}, - {"readable", (PyCFunction)fileio_readable, METH_NOARGS, readable_doc}, - {"writable", (PyCFunction)fileio_writable, METH_NOARGS, writable_doc}, - {"fileno", (PyCFunction)fileio_fileno, METH_NOARGS, fileno_doc}, - {"isatty", (PyCFunction)fileio_isatty, METH_NOARGS, isatty_doc}, - {NULL, NULL} /* sentinel */ -}; - -/* 'closed' and 'mode' are attributes for backwards compatibility reasons. */ - -static PyObject * -get_closed(fileio *self, void *closure) -{ - return PyBool_FromLong((long)(self->fd < 0)); -} - -static PyObject * -get_closefd(fileio *self, void *closure) -{ - return PyBool_FromLong((long)(self->closefd)); -} - -static PyObject * -get_mode(fileio *self, void *closure) -{ - return PyUnicode_FromString(mode_string(self)); -} - -static PyGetSetDef fileio_getsetlist[] = { - {"closed", (getter)get_closed, NULL, "True if the file is closed"}, - {"closefd", (getter)get_closefd, NULL, - "True if the file descriptor will be closed by close()."}, - {"mode", (getter)get_mode, NULL, "String giving the file mode"}, - {NULL}, -}; - -PyTypeObject PyFileIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.FileIO", - sizeof(fileio), - 0, - (destructor)fileio_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)fileio_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - fileio_doc, /* tp_doc */ - (traverseproc)fileio_traverse, /* tp_traverse */ - (inquiry)fileio_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(fileio, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - fileio_methods, /* tp_methods */ - 0, /* tp_members */ - fileio_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(fileio, dict), /* tp_dictoffset */ - fileio_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - fileio_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/iobase.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/iobase.c deleted file mode 100644 index bd7f25a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/iobase.c +++ /dev/null @@ -1,913 +0,0 @@ -/* - An implementation of the I/O abstract base classes hierarchy - as defined by PEP 3116 - "New I/O" - - Classes defined here: IOBase, RawIOBase. - - Written by Amaury Forgeot d'Arc and Antoine Pitrou -*/ - - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "_iomodule.h" - -/* - * IOBase class, an abstract class - */ - -typedef struct { - PyObject_HEAD - - PyObject *dict; - PyObject *weakreflist; -} iobase; - -PyDoc_STRVAR(iobase_doc, - "The abstract base class for all I/O classes, acting on streams of\n" - "bytes. There is no public constructor.\n" - "\n" - "This class provides dummy implementations for many methods that\n" - "derived classes can override selectively; the default implementations\n" - "represent a file that cannot be read, written or seeked.\n" - "\n" - "Even though IOBase does not declare read, readinto, or write because\n" - "their signatures will vary, implementations and clients should\n" - "consider those methods part of the interface. Also, implementations\n" - "may raise a IOError when operations they do not support are called.\n" - "\n" - "The basic type used for binary data read from or written to a file is\n" - "bytes. bytearrays are accepted too, and in some cases (such as\n" - "readinto) needed. Text I/O classes work with str data.\n" - "\n" - "Note that calling any method (except additional calls to close(),\n" - "which are ignored) on a closed stream should raise a ValueError.\n" - "\n" - "IOBase (and its subclasses) support the iterator protocol, meaning\n" - "that an IOBase object can be iterated over yielding the lines in a\n" - "stream.\n" - "\n" - "IOBase also supports the :keyword:`with` statement. In this example,\n" - "fp is closed after the suite of the with statement is complete:\n" - "\n" - "with open('spam.txt', 'r') as fp:\n" - " fp.write('Spam and eggs!')\n"); - -/* Use this macro whenever you want to check the internal `closed` status - of the IOBase object rather than the virtual `closed` attribute as returned - by whatever subclass. */ - -#define IS_CLOSED(self) \ - PyObject_HasAttrString(self, "__IOBase_closed") - -/* Internal methods */ -static PyObject * -iobase_unsupported(const char *message) -{ - PyErr_SetString(_PyIO_unsupported_operation, message); - return NULL; -} - -/* Positionning */ - -PyDoc_STRVAR(iobase_seek_doc, - "Change stream position.\n" - "\n" - "Change the stream position to the given byte offset. The offset is\n" - "interpreted relative to the position indicated by whence. Values\n" - "for whence are:\n" - "\n" - "* 0 -- start of stream (the default); offset should be zero or positive\n" - "* 1 -- current stream position; offset may be negative\n" - "* 2 -- end of stream; offset is usually negative\n" - "\n" - "Return the new absolute position."); - -static PyObject * -iobase_seek(PyObject *self, PyObject *args) -{ - return iobase_unsupported("seek"); -} - -PyDoc_STRVAR(iobase_tell_doc, - "Return current stream position."); - -static PyObject * -iobase_tell(PyObject *self, PyObject *args) -{ - return PyObject_CallMethod(self, "seek", "ii", 0, 1); -} - -PyDoc_STRVAR(iobase_truncate_doc, - "Truncate file to size bytes.\n" - "\n" - "File pointer is left unchanged. Size defaults to the current IO\n" - "position as reported by tell(). Returns the new size."); - -static PyObject * -iobase_truncate(PyObject *self, PyObject *args) -{ - return iobase_unsupported("truncate"); -} - -/* Flush and close methods */ - -PyDoc_STRVAR(iobase_flush_doc, - "Flush write buffers, if applicable.\n" - "\n" - "This is not implemented for read-only and non-blocking streams.\n"); - -static PyObject * -iobase_flush(PyObject *self, PyObject *args) -{ - /* XXX Should this return the number of bytes written??? */ - if (IS_CLOSED(self)) { - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); - return NULL; - } - Py_RETURN_NONE; -} - -PyDoc_STRVAR(iobase_close_doc, - "Flush and close the IO object.\n" - "\n" - "This method has no effect if the file is already closed.\n"); - -static int -iobase_closed(PyObject *self) -{ - PyObject *res; - int closed; - /* This gets the derived attribute, which is *not* __IOBase_closed - in most cases! */ - res = PyObject_GetAttr(self, _PyIO_str_closed); - if (res == NULL) - return 0; - closed = PyObject_IsTrue(res); - Py_DECREF(res); - return closed; -} - -static PyObject * -iobase_closed_get(PyObject *self, void *context) -{ - return PyBool_FromLong(IS_CLOSED(self)); -} - -PyObject * -_PyIOBase_check_closed(PyObject *self, PyObject *args) -{ - if (iobase_closed(self)) { - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file."); - return NULL; - } - if (args == Py_True) - return Py_None; - else - Py_RETURN_NONE; -} - -/* XXX: IOBase thinks it has to maintain its own internal state in - `__IOBase_closed` and call flush() by itself, but it is redundant with - whatever behaviour a non-trivial derived class will implement. */ - -static PyObject * -iobase_close(PyObject *self, PyObject *args) -{ - PyObject *res; - - if (IS_CLOSED(self)) - Py_RETURN_NONE; - - res = PyObject_CallMethodObjArgs(self, _PyIO_str_flush, NULL); - PyObject_SetAttrString(self, "__IOBase_closed", Py_True); - if (res == NULL) { - return NULL; - } - Py_XDECREF(res); - Py_RETURN_NONE; -} - -/* Finalization and garbage collection support */ - -int -_PyIOBase_finalize(PyObject *self) -{ - PyObject *res; - PyObject *tp, *v, *tb; - int closed = 1; - int is_zombie; - - /* If _PyIOBase_finalize() is called from a destructor, we need to - resurrect the object as calling close() can invoke arbitrary code. */ - is_zombie = (Py_REFCNT(self) == 0); - if (is_zombie) { - ++Py_REFCNT(self); - } - PyErr_Fetch(&tp, &v, &tb); - /* If `closed` doesn't exist or can't be evaluated as bool, then the - object is probably in an unusable state, so ignore. */ - res = PyObject_GetAttr(self, _PyIO_str_closed); - if (res == NULL) - PyErr_Clear(); - else { - closed = PyObject_IsTrue(res); - Py_DECREF(res); - if (closed == -1) - PyErr_Clear(); - } - if (closed == 0) { - res = PyObject_CallMethodObjArgs((PyObject *) self, _PyIO_str_close, - NULL); - /* Silencing I/O errors is bad, but printing spurious tracebacks is - equally as bad, and potentially more frequent (because of - shutdown issues). */ - if (res == NULL) - PyErr_Clear(); - else - Py_DECREF(res); - } - PyErr_Restore(tp, v, tb); - if (is_zombie) { - if (--Py_REFCNT(self) != 0) { - /* The object lives again. The following code is taken from - slot_tp_del in typeobject.c. */ - Py_ssize_t refcnt = Py_REFCNT(self); - _Py_NewReference(self); - Py_REFCNT(self) = refcnt; - /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so - * we need to undo that. */ - _Py_DEC_REFTOTAL; - /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object - * chain, so no more to do there. - * If COUNT_ALLOCS, the original decref bumped tp_frees, and - * _Py_NewReference bumped tp_allocs: both of those need to be - * undone. - */ -#ifdef COUNT_ALLOCS - --Py_TYPE(self)->tp_frees; - --Py_TYPE(self)->tp_allocs; -#endif - return -1; - } - } - return 0; -} - -static int -iobase_traverse(iobase *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dict); - return 0; -} - -static int -iobase_clear(iobase *self) -{ - if (_PyIOBase_finalize((PyObject *) self) < 0) - return -1; - Py_CLEAR(self->dict); - return 0; -} - -/* Destructor */ - -static void -iobase_dealloc(iobase *self) -{ - /* NOTE: since IOBaseObject has its own dict, Python-defined attributes - are still available here for close() to use. - However, if the derived class declares a __slots__, those slots are - already gone. - */ - if (_PyIOBase_finalize((PyObject *) self) < 0) { - /* When called from a heap type's dealloc, the type will be - decref'ed on return (see e.g. subtype_dealloc in typeobject.c). */ - if (PyType_HasFeature(Py_TYPE(self), Py_TPFLAGS_HEAPTYPE)) - Py_INCREF(Py_TYPE(self)); - return; - } - _PyObject_GC_UNTRACK(self); - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - Py_CLEAR(self->dict); - Py_TYPE(self)->tp_free((PyObject *) self); -} - -/* Inquiry methods */ - -PyDoc_STRVAR(iobase_seekable_doc, - "Return whether object supports random access.\n" - "\n" - "If False, seek(), tell() and truncate() will raise IOError.\n" - "This method may need to do a test seek()."); - -static PyObject * -iobase_seekable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -PyObject * -_PyIOBase_check_seekable(PyObject *self, PyObject *args) -{ - PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_seekable, NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not seekable."); - return NULL; - } - if (args == Py_True) { - Py_DECREF(res); - } - return res; -} - -PyDoc_STRVAR(iobase_readable_doc, - "Return whether object was opened for reading.\n" - "\n" - "If False, read() will raise IOError."); - -static PyObject * -iobase_readable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -/* May be called with any object */ -PyObject * -_PyIOBase_check_readable(PyObject *self, PyObject *args) -{ - PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_readable, NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not readable."); - return NULL; - } - if (args == Py_True) { - Py_DECREF(res); - } - return res; -} - -PyDoc_STRVAR(iobase_writable_doc, - "Return whether object was opened for writing.\n" - "\n" - "If False, read() will raise IOError."); - -static PyObject * -iobase_writable(PyObject *self, PyObject *args) -{ - Py_RETURN_FALSE; -} - -/* May be called with any object */ -PyObject * -_PyIOBase_check_writable(PyObject *self, PyObject *args) -{ - PyObject *res = PyObject_CallMethodObjArgs(self, _PyIO_str_writable, NULL); - if (res == NULL) - return NULL; - if (res != Py_True) { - Py_CLEAR(res); - PyErr_SetString(PyExc_IOError, "File or stream is not writable."); - return NULL; - } - if (args == Py_True) { - Py_DECREF(res); - } - return res; -} - -/* Context manager */ - -static PyObject * -iobase_enter(PyObject *self, PyObject *args) -{ - if (_PyIOBase_check_closed(self, Py_True) == NULL) - return NULL; - - Py_INCREF(self); - return self; -} - -static PyObject * -iobase_exit(PyObject *self, PyObject *args) -{ - return PyObject_CallMethodObjArgs(self, _PyIO_str_close, NULL); -} - -/* Lower-level APIs */ - -/* XXX Should these be present even if unimplemented? */ - -PyDoc_STRVAR(iobase_fileno_doc, - "Returns underlying file descriptor if one exists.\n" - "\n" - "An IOError is raised if the IO object does not use a file descriptor.\n"); - -static PyObject * -iobase_fileno(PyObject *self, PyObject *args) -{ - return iobase_unsupported("fileno"); -} - -PyDoc_STRVAR(iobase_isatty_doc, - "Return whether this is an 'interactive' stream.\n" - "\n" - "Return False if it can't be determined.\n"); - -static PyObject * -iobase_isatty(PyObject *self, PyObject *args) -{ - if (_PyIOBase_check_closed(self, Py_True) == NULL) - return NULL; - Py_RETURN_FALSE; -} - -/* Readline(s) and writelines */ - -PyDoc_STRVAR(iobase_readline_doc, - "Read and return a line from the stream.\n" - "\n" - "If limit is specified, at most limit bytes will be read.\n" - "\n" - "The line terminator is always b'\\n' for binary files; for text\n" - "files, the newlines argument to open can be used to select the line\n" - "terminator(s) recognized.\n"); - -static PyObject * -iobase_readline(PyObject *self, PyObject *args) -{ - /* For backwards compatibility, a (slowish) readline(). */ - - Py_ssize_t limit = -1; - int has_peek = 0; - PyObject *buffer, *result; - Py_ssize_t old_size = -1; - - if (!PyArg_ParseTuple(args, "|O&:readline", &_PyIO_ConvertSsize_t, &limit)) { - return NULL; - } - - if (PyObject_HasAttrString(self, "peek")) - has_peek = 1; - - buffer = PyByteArray_FromStringAndSize(NULL, 0); - if (buffer == NULL) - return NULL; - - while (limit < 0 || Py_SIZE(buffer) < limit) { - Py_ssize_t nreadahead = 1; - PyObject *b; - - if (has_peek) { - PyObject *readahead = PyObject_CallMethod(self, "peek", "i", 1); - if (readahead == NULL) { - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() - when EINTR occurs so we needn't do it ourselves. */ - if (_PyIO_trap_eintr()) { - continue; - } - goto fail; - } - if (!PyBytes_Check(readahead)) { - PyErr_Format(PyExc_IOError, - "peek() should have returned a bytes object, " - "not '%.200s'", Py_TYPE(readahead)->tp_name); - Py_DECREF(readahead); - goto fail; - } - if (PyBytes_GET_SIZE(readahead) > 0) { - Py_ssize_t n = 0; - const char *buf = PyBytes_AS_STRING(readahead); - if (limit >= 0) { - do { - if (n >= PyBytes_GET_SIZE(readahead) || n >= limit) - break; - if (buf[n++] == '\n') - break; - } while (1); - } - else { - do { - if (n >= PyBytes_GET_SIZE(readahead)) - break; - if (buf[n++] == '\n') - break; - } while (1); - } - nreadahead = n; - } - Py_DECREF(readahead); - } - - b = PyObject_CallMethod(self, "read", "n", nreadahead); - if (b == NULL) { - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() - when EINTR occurs so we needn't do it ourselves. */ - if (_PyIO_trap_eintr()) { - continue; - } - goto fail; - } - if (!PyBytes_Check(b)) { - PyErr_Format(PyExc_IOError, - "read() should have returned a bytes object, " - "not '%.200s'", Py_TYPE(b)->tp_name); - Py_DECREF(b); - goto fail; - } - if (PyBytes_GET_SIZE(b) == 0) { - Py_DECREF(b); - break; - } - - old_size = PyByteArray_GET_SIZE(buffer); - PyByteArray_Resize(buffer, old_size + PyBytes_GET_SIZE(b)); - memcpy(PyByteArray_AS_STRING(buffer) + old_size, - PyBytes_AS_STRING(b), PyBytes_GET_SIZE(b)); - - Py_DECREF(b); - - if (PyByteArray_AS_STRING(buffer)[PyByteArray_GET_SIZE(buffer) - 1] == '\n') - break; - } - - result = PyBytes_FromStringAndSize(PyByteArray_AS_STRING(buffer), - PyByteArray_GET_SIZE(buffer)); - Py_DECREF(buffer); - return result; - fail: - Py_DECREF(buffer); - return NULL; -} - -static PyObject * -iobase_iter(PyObject *self) -{ - if (_PyIOBase_check_closed(self, Py_True) == NULL) - return NULL; - - Py_INCREF(self); - return self; -} - -static PyObject * -iobase_iternext(PyObject *self) -{ - PyObject *line = PyObject_CallMethodObjArgs(self, _PyIO_str_readline, NULL); - - if (line == NULL) - return NULL; - - if (PyObject_Size(line) == 0) { - Py_DECREF(line); - return NULL; - } - - return line; -} - -PyDoc_STRVAR(iobase_readlines_doc, - "Return a list of lines from the stream.\n" - "\n" - "hint can be specified to control the number of lines read: no more\n" - "lines will be read if the total size (in bytes/characters) of all\n" - "lines so far exceeds hint."); - -static PyObject * -iobase_readlines(PyObject *self, PyObject *args) -{ - Py_ssize_t hint = -1, length = 0; - PyObject *result; - - if (!PyArg_ParseTuple(args, "|O&:readlines", &_PyIO_ConvertSsize_t, &hint)) { - return NULL; - } - - result = PyList_New(0); - if (result == NULL) - return NULL; - - if (hint <= 0) { - /* XXX special-casing this made sense in the Python version in order - to remove the bytecode interpretation overhead, but it could - probably be removed here. */ - PyObject *ret = PyObject_CallMethod(result, "extend", "O", self); - if (ret == NULL) { - Py_DECREF(result); - return NULL; - } - Py_DECREF(ret); - return result; - } - - while (1) { - PyObject *line = PyIter_Next(self); - if (line == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; - } - else - break; /* StopIteration raised */ - } - - if (PyList_Append(result, line) < 0) { - Py_DECREF(line); - Py_DECREF(result); - return NULL; - } - length += PyObject_Size(line); - Py_DECREF(line); - - if (length > hint) - break; - } - return result; -} - -static PyObject * -iobase_writelines(PyObject *self, PyObject *args) -{ - PyObject *lines, *iter, *res; - - if (!PyArg_ParseTuple(args, "O:writelines", &lines)) { - return NULL; - } - - if (_PyIOBase_check_closed(self, Py_True) == NULL) - return NULL; - - iter = PyObject_GetIter(lines); - if (iter == NULL) - return NULL; - - while (1) { - PyObject *line = PyIter_Next(iter); - if (line == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(iter); - return NULL; - } - else - break; /* Stop Iteration */ - } - - res = NULL; - do { - res = PyObject_CallMethodObjArgs(self, _PyIO_str_write, line, NULL); - } while (res == NULL && _PyIO_trap_eintr()); - Py_DECREF(line); - if (res == NULL) { - Py_DECREF(iter); - return NULL; - } - Py_DECREF(res); - } - Py_DECREF(iter); - Py_RETURN_NONE; -} - -static PyMethodDef iobase_methods[] = { - {"seek", iobase_seek, METH_VARARGS, iobase_seek_doc}, - {"tell", iobase_tell, METH_NOARGS, iobase_tell_doc}, - {"truncate", iobase_truncate, METH_VARARGS, iobase_truncate_doc}, - {"flush", iobase_flush, METH_NOARGS, iobase_flush_doc}, - {"close", iobase_close, METH_NOARGS, iobase_close_doc}, - - {"seekable", iobase_seekable, METH_NOARGS, iobase_seekable_doc}, - {"readable", iobase_readable, METH_NOARGS, iobase_readable_doc}, - {"writable", iobase_writable, METH_NOARGS, iobase_writable_doc}, - - {"_checkClosed", _PyIOBase_check_closed, METH_NOARGS}, - {"_checkSeekable", _PyIOBase_check_seekable, METH_NOARGS}, - {"_checkReadable", _PyIOBase_check_readable, METH_NOARGS}, - {"_checkWritable", _PyIOBase_check_writable, METH_NOARGS}, - - {"fileno", iobase_fileno, METH_NOARGS, iobase_fileno_doc}, - {"isatty", iobase_isatty, METH_NOARGS, iobase_isatty_doc}, - - {"__enter__", iobase_enter, METH_NOARGS}, - {"__exit__", iobase_exit, METH_VARARGS}, - - {"readline", iobase_readline, METH_VARARGS, iobase_readline_doc}, - {"readlines", iobase_readlines, METH_VARARGS, iobase_readlines_doc}, - {"writelines", iobase_writelines, METH_VARARGS}, - - {NULL, NULL} -}; - -static PyGetSetDef iobase_getset[] = { - {"closed", (getter)iobase_closed_get, NULL, NULL}, - {NULL} -}; - - -PyTypeObject PyIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io._IOBase", /*tp_name*/ - sizeof(iobase), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)iobase_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - iobase_doc, /* tp_doc */ - (traverseproc)iobase_traverse, /* tp_traverse */ - (inquiry)iobase_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(iobase, weakreflist), /* tp_weaklistoffset */ - iobase_iter, /* tp_iter */ - iobase_iternext, /* tp_iternext */ - iobase_methods, /* tp_methods */ - 0, /* tp_members */ - iobase_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(iobase, dict), /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - -/* - * RawIOBase class, Inherits from IOBase. - */ -PyDoc_STRVAR(rawiobase_doc, - "Base class for raw binary I/O."); - -/* - * The read() method is implemented by calling readinto(); derived classes - * that want to support read() only need to implement readinto() as a - * primitive operation. In general, readinto() can be more efficient than - * read(). - * - * (It would be tempting to also provide an implementation of readinto() in - * terms of read(), in case the latter is a more suitable primitive operation, - * but that would lead to nasty recursion in case a subclass doesn't implement - * either.) -*/ - -static PyObject * -rawiobase_read(PyObject *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *b, *res; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) { - return NULL; - } - - if (n < 0) - return PyObject_CallMethod(self, "readall", NULL); - - /* TODO: allocate a bytes object directly instead and manually construct - a writable memoryview pointing to it. */ - b = PyByteArray_FromStringAndSize(NULL, n); - if (b == NULL) - return NULL; - - res = PyObject_CallMethodObjArgs(self, _PyIO_str_readinto, b, NULL); - if (res == NULL || res == Py_None) { - Py_DECREF(b); - return res; - } - - n = PyNumber_AsSsize_t(res, PyExc_ValueError); - Py_DECREF(res); - if (n == -1 && PyErr_Occurred()) { - Py_DECREF(b); - return NULL; - } - - res = PyBytes_FromStringAndSize(PyByteArray_AsString(b), n); - Py_DECREF(b); - return res; -} - - -PyDoc_STRVAR(rawiobase_readall_doc, - "Read until EOF, using multiple read() call."); - -static PyObject * -rawiobase_readall(PyObject *self, PyObject *args) -{ - int r; - PyObject *chunks = PyList_New(0); - PyObject *result; - - if (chunks == NULL) - return NULL; - - while (1) { - PyObject *data = PyObject_CallMethod(self, "read", - "i", DEFAULT_BUFFER_SIZE); - if (!data) { - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() - when EINTR occurs so we needn't do it ourselves. */ - if (_PyIO_trap_eintr()) { - continue; - } - Py_DECREF(chunks); - return NULL; - } - if (data == Py_None) { - if (PyList_GET_SIZE(chunks) == 0) { - Py_DECREF(chunks); - return data; - } - Py_DECREF(data); - break; - } - if (!PyBytes_Check(data)) { - Py_DECREF(chunks); - Py_DECREF(data); - PyErr_SetString(PyExc_TypeError, "read() should return bytes"); - return NULL; - } - if (PyBytes_GET_SIZE(data) == 0) { - /* EOF */ - Py_DECREF(data); - break; - } - r = PyList_Append(chunks, data); - Py_DECREF(data); - if (r < 0) { - Py_DECREF(chunks); - return NULL; - } - } - result = _PyBytes_Join(_PyIO_empty_bytes, chunks); - Py_DECREF(chunks); - return result; -} - -static PyMethodDef rawiobase_methods[] = { - {"read", rawiobase_read, METH_VARARGS}, - {"readall", rawiobase_readall, METH_NOARGS, rawiobase_readall_doc}, - {NULL, NULL} -}; - -PyTypeObject PyRawIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io._RawIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - rawiobase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - rawiobase_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyIOBase_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/stringio.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/stringio.c deleted file mode 100644 index 605a980..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/stringio.c +++ /dev/null @@ -1,895 +0,0 @@ -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "_iomodule.h" - -/* Implementation note: the buffer is always at least one character longer - than the enclosed string, for proper functioning of _PyIO_find_line_ending. -*/ - -typedef struct { - PyObject_HEAD - Py_UNICODE *buf; - Py_ssize_t pos; - Py_ssize_t string_size; - size_t buf_size; - - char ok; /* initialized? */ - char closed; - char readuniversal; - char readtranslate; - PyObject *decoder; - PyObject *readnl; - PyObject *writenl; - - PyObject *dict; - PyObject *weakreflist; -} stringio; - -#define CHECK_INITIALIZED(self) \ - if (self->ok <= 0) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on uninitialized object"); \ - return NULL; \ - } - -#define CHECK_CLOSED(self) \ - if (self->closed) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on closed file"); \ - return NULL; \ - } - -PyDoc_STRVAR(stringio_doc, - "Text I/O implementation using an in-memory buffer.\n" - "\n" - "The initial_value argument sets the value of object. The newline\n" - "argument is like the one of TextIOWrapper's constructor."); - - -/* Internal routine for changing the size, in terms of characters, of the - buffer of StringIO objects. The caller should ensure that the 'size' - argument is non-negative. Returns 0 on success, -1 otherwise. */ -static int -resize_buffer(stringio *self, size_t size) -{ - /* Here, unsigned types are used to avoid dealing with signed integer - overflow, which is undefined in C. */ - size_t alloc = self->buf_size; - Py_UNICODE *new_buf = NULL; - - assert(self->buf != NULL); - - /* Reserve one more char for line ending detection. */ - size = size + 1; - /* For simplicity, stay in the range of the signed type. Anyway, Python - doesn't allow strings to be longer than this. */ - if (size > PY_SSIZE_T_MAX) - goto overflow; - - if (size < alloc / 2) { - /* Major downsize; resize down to exact size. */ - alloc = size + 1; - } - else if (size < alloc) { - /* Within allocated size; quick exit */ - return 0; - } - else if (size <= alloc * 1.125) { - /* Moderate upsize; overallocate similar to list_resize() */ - alloc = size + (size >> 3) + (size < 9 ? 3 : 6); - } - else { - /* Major upsize; resize up to exact size */ - alloc = size + 1; - } - - if (alloc > ((size_t)-1) / sizeof(Py_UNICODE)) - goto overflow; - new_buf = (Py_UNICODE *)PyMem_Realloc(self->buf, - alloc * sizeof(Py_UNICODE)); - if (new_buf == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buf_size = alloc; - self->buf = new_buf; - - return 0; - - overflow: - PyErr_SetString(PyExc_OverflowError, - "new buffer size too large"); - return -1; -} - -/* Internal routine for writing a whole PyUnicode object to the buffer of a - StringIO object. Returns 0 on success, or -1 on error. */ -static Py_ssize_t -write_str(stringio *self, PyObject *obj) -{ - Py_UNICODE *str; - Py_ssize_t len; - PyObject *decoded = NULL; - assert(self->buf != NULL); - assert(self->pos >= 0); - - if (self->decoder != NULL) { - decoded = _PyIncrementalNewlineDecoder_decode( - self->decoder, obj, 1 /* always final */); - } - else { - decoded = obj; - Py_INCREF(decoded); - } - if (self->writenl) { - PyObject *translated = PyUnicode_Replace( - decoded, _PyIO_str_nl, self->writenl, -1); - Py_DECREF(decoded); - decoded = translated; - } - if (decoded == NULL) - return -1; - - assert(PyUnicode_Check(decoded)); - str = PyUnicode_AS_UNICODE(decoded); - len = PyUnicode_GET_SIZE(decoded); - - assert(len >= 0); - - /* This overflow check is not strictly necessary. However, it avoids us to - deal with funky things like comparing an unsigned and a signed - integer. */ - if (self->pos > PY_SSIZE_T_MAX - len) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - goto fail; - } - if (self->pos + len > self->string_size) { - if (resize_buffer(self, self->pos + len) < 0) - goto fail; - } - - if (self->pos > self->string_size) { - /* In case of overseek, pad with null bytes the buffer region between - the end of stream and the current position. - - 0 lo string_size hi - | |<---used--->|<----------available----------->| - | | <--to pad-->|<---to write---> | - 0 buf position - - */ - memset(self->buf + self->string_size, '\0', - (self->pos - self->string_size) * sizeof(Py_UNICODE)); - } - - /* Copy the data to the internal buffer, overwriting some of the - existing data if self->pos < self->string_size. */ - memcpy(self->buf + self->pos, str, len * sizeof(Py_UNICODE)); - self->pos += len; - - /* Set the new length of the internal string if it has changed. */ - if (self->string_size < self->pos) { - self->string_size = self->pos; - } - - Py_DECREF(decoded); - return 0; - -fail: - Py_XDECREF(decoded); - return -1; -} - -PyDoc_STRVAR(stringio_getvalue_doc, - "Retrieve the entire contents of the object."); - -static PyObject * -stringio_getvalue(stringio *self) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - return PyUnicode_FromUnicode(self->buf, self->string_size); -} - -PyDoc_STRVAR(stringio_tell_doc, - "Tell the current file position."); - -static PyObject * -stringio_tell(stringio *self) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - return PyLong_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(stringio_read_doc, - "Read at most n characters, returned as a string.\n" - "\n" - "If the argument is negative or omitted, read until EOF\n" - "is reached. Return an empty string at EOF.\n"); - -static PyObject * -stringio_read(stringio *self, PyObject *args) -{ - Py_ssize_t size, n; - Py_UNICODE *output; - PyObject *arg = Py_None; - - CHECK_INITIALIZED(self); - if (!PyArg_ParseTuple(args, "|O:read", &arg)) - return NULL; - CHECK_CLOSED(self); - - if (PyNumber_Check(arg)) { - size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Read until EOF is reached, by default. */ - size = -1; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - /* adjust invalid sizes */ - n = self->string_size - self->pos; - if (size < 0 || size > n) { - size = n; - if (size < 0) - size = 0; - } - - output = self->buf + self->pos; - self->pos += size; - return PyUnicode_FromUnicode(output, size); -} - -/* Internal helper, used by stringio_readline and stringio_iternext */ -static PyObject * -_stringio_readline(stringio *self, Py_ssize_t limit) -{ - Py_UNICODE *start, *end, old_char; - Py_ssize_t len, consumed; - - /* In case of overseek, return the empty string */ - if (self->pos >= self->string_size) - return PyUnicode_FromString(""); - - start = self->buf + self->pos; - if (limit < 0 || limit > self->string_size - self->pos) - limit = self->string_size - self->pos; - - end = start + limit; - old_char = *end; - *end = '\0'; - len = _PyIO_find_line_ending( - self->readtranslate, self->readuniversal, self->readnl, - start, end, &consumed); - *end = old_char; - /* If we haven't found any line ending, we just return everything - (`consumed` is ignored). */ - if (len < 0) - len = limit; - self->pos += len; - return PyUnicode_FromUnicode(start, len); -} - -PyDoc_STRVAR(stringio_readline_doc, - "Read until newline or EOF.\n" - "\n" - "Returns an empty string if EOF is hit immediately.\n"); - -static PyObject * -stringio_readline(stringio *self, PyObject *args) -{ - PyObject *arg = Py_None; - Py_ssize_t limit = -1; - - CHECK_INITIALIZED(self); - if (!PyArg_ParseTuple(args, "|O:readline", &arg)) - return NULL; - CHECK_CLOSED(self); - - if (PyNumber_Check(arg)) { - limit = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (limit == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg != Py_None) { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - return _stringio_readline(self, limit); -} - -static PyObject * -stringio_iternext(stringio *self) -{ - PyObject *line; - - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - - if (Py_TYPE(self) == &PyStringIO_Type) { - /* Skip method call overhead for speed */ - line = _stringio_readline(self, -1); - } - else { - /* XXX is subclassing StringIO really supported? */ - line = PyObject_CallMethodObjArgs((PyObject *)self, - _PyIO_str_readline, NULL); - if (line && !PyUnicode_Check(line)) { - PyErr_Format(PyExc_IOError, - "readline() should have returned an str object, " - "not '%.200s'", Py_TYPE(line)->tp_name); - Py_DECREF(line); - return NULL; - } - } - - if (line == NULL) - return NULL; - - if (PyUnicode_GET_SIZE(line) == 0) { - /* Reached EOF */ - Py_DECREF(line); - return NULL; - } - - return line; -} - -PyDoc_STRVAR(stringio_truncate_doc, - "Truncate size to pos.\n" - "\n" - "The pos argument defaults to the current file position, as\n" - "returned by tell(). The current file position is unchanged.\n" - "Returns the new absolute position.\n"); - -static PyObject * -stringio_truncate(stringio *self, PyObject *args) -{ - Py_ssize_t size; - PyObject *arg = Py_None; - - CHECK_INITIALIZED(self); - if (!PyArg_ParseTuple(args, "|O:truncate", &arg)) - return NULL; - CHECK_CLOSED(self); - - if (PyNumber_Check(arg)) { - size = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (size == -1 && PyErr_Occurred()) - return NULL; - } - else if (arg == Py_None) { - /* Truncate to current position if no argument is passed. */ - size = self->pos; - } - else { - PyErr_Format(PyExc_TypeError, "integer argument expected, got '%s'", - Py_TYPE(arg)->tp_name); - return NULL; - } - - if (size < 0) { - PyErr_Format(PyExc_ValueError, - "Negative size value %zd", size); - return NULL; - } - - if (size < self->string_size) { - if (resize_buffer(self, size) < 0) - return NULL; - self->string_size = size; - } - - return PyLong_FromSsize_t(size); -} - -PyDoc_STRVAR(stringio_seek_doc, - "Change stream position.\n" - "\n" - "Seek to character offset pos relative to position indicated by whence:\n" - " 0 Start of stream (the default). pos should be >= 0;\n" - " 1 Current position - pos must be 0;\n" - " 2 End of stream - pos must be 0.\n" - "Returns the new absolute position.\n"); - -static PyObject * -stringio_seek(stringio *self, PyObject *args) -{ - PyObject *posobj; - Py_ssize_t pos; - int mode = 0; - - CHECK_INITIALIZED(self); - if (!PyArg_ParseTuple(args, "O|i:seek", &posobj, &mode)) - return NULL; - - pos = PyNumber_AsSsize_t(posobj, PyExc_OverflowError); - if (pos == -1 && PyErr_Occurred()) - return NULL; - - CHECK_CLOSED(self); - - if (mode != 0 && mode != 1 && mode != 2) { - PyErr_Format(PyExc_ValueError, - "Invalid whence (%i, should be 0, 1 or 2)", mode); - return NULL; - } - else if (pos < 0 && mode == 0) { - PyErr_Format(PyExc_ValueError, - "Negative seek position %zd", pos); - return NULL; - } - else if (mode != 0 && pos != 0) { - PyErr_SetString(PyExc_IOError, - "Can't do nonzero cur-relative seeks"); - return NULL; - } - - /* mode 0: offset relative to beginning of the string. - mode 1: no change to current position. - mode 2: change position to end of file. */ - if (mode == 1) { - pos = self->pos; - } - else if (mode == 2) { - pos = self->string_size; - } - - self->pos = pos; - - return PyLong_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(stringio_write_doc, - "Write string to file.\n" - "\n" - "Returns the number of characters written, which is always equal to\n" - "the length of the string.\n"); - -static PyObject * -stringio_write(stringio *self, PyObject *obj) -{ - Py_ssize_t size; - - CHECK_INITIALIZED(self); - if (!PyUnicode_Check(obj)) { - PyErr_Format(PyExc_TypeError, "unicode argument expected, got '%s'", - Py_TYPE(obj)->tp_name); - return NULL; - } - CHECK_CLOSED(self); - size = PyUnicode_GET_SIZE(obj); - - if (size > 0 && write_str(self, obj) < 0) - return NULL; - - return PyLong_FromSsize_t(size); -} - -PyDoc_STRVAR(stringio_close_doc, - "Close the IO object. Attempting any further operation after the\n" - "object is closed will raise a ValueError.\n" - "\n" - "This method has no effect if the file is already closed.\n"); - -static PyObject * -stringio_close(stringio *self) -{ - self->closed = 1; - /* Free up some memory */ - if (resize_buffer(self, 0) < 0) - return NULL; - Py_CLEAR(self->readnl); - Py_CLEAR(self->writenl); - Py_CLEAR(self->decoder); - Py_RETURN_NONE; -} - -static int -stringio_traverse(stringio *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dict); - return 0; -} - -static int -stringio_clear(stringio *self) -{ - Py_CLEAR(self->dict); - return 0; -} - -static void -stringio_dealloc(stringio *self) -{ - _PyObject_GC_UNTRACK(self); - self->ok = 0; - if (self->buf) { - PyMem_Free(self->buf); - self->buf = NULL; - } - Py_CLEAR(self->readnl); - Py_CLEAR(self->writenl); - Py_CLEAR(self->decoder); - Py_CLEAR(self->dict); - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - Py_TYPE(self)->tp_free(self); -} - -static PyObject * -stringio_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - stringio *self; - - assert(type != NULL && type->tp_alloc != NULL); - self = (stringio *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - /* tp_alloc initializes all the fields to zero. So we don't have to - initialize them here. */ - - self->buf = (Py_UNICODE *)PyMem_Malloc(0); - if (self->buf == NULL) { - Py_DECREF(self); - return PyErr_NoMemory(); - } - - return (PyObject *)self; -} - -static int -stringio_init(stringio *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"initial_value", "newline", NULL}; - PyObject *value = NULL; - char *newline = "\n"; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oz:__init__", kwlist, - &value, &newline)) - return -1; - - if (newline && newline[0] != '\0' - && !(newline[0] == '\n' && newline[1] == '\0') - && !(newline[0] == '\r' && newline[1] == '\0') - && !(newline[0] == '\r' && newline[1] == '\n' && newline[2] == '\0')) { - PyErr_Format(PyExc_ValueError, - "illegal newline value: %s", newline); - return -1; - } - if (value && value != Py_None && !PyUnicode_Check(value)) { - PyErr_Format(PyExc_TypeError, - "initial_value must be unicode or None, not %.200s", - Py_TYPE(value)->tp_name); - return -1; - } - - self->ok = 0; - - Py_CLEAR(self->readnl); - Py_CLEAR(self->writenl); - Py_CLEAR(self->decoder); - - if (newline) { - self->readnl = PyString_FromString(newline); - if (self->readnl == NULL) - return -1; - } - self->readuniversal = (newline == NULL || newline[0] == '\0'); - self->readtranslate = (newline == NULL); - /* If newline == "", we don't translate anything. - If newline == "\n" or newline == None, we translate to "\n", which is - a no-op. - (for newline == None, TextIOWrapper translates to os.sepline, but it - is pointless for StringIO) - */ - if (newline != NULL && newline[0] == '\r') { - self->writenl = PyUnicode_FromString(newline); - } - - if (self->readuniversal) { - self->decoder = PyObject_CallFunction( - (PyObject *)&PyIncrementalNewlineDecoder_Type, - "Oi", Py_None, (int) self->readtranslate); - if (self->decoder == NULL) - return -1; - } - - /* Now everything is set up, resize buffer to size of initial value, - and copy it */ - self->string_size = 0; - if (value && value != Py_None) { - Py_ssize_t len = PyUnicode_GetSize(value); - /* This is a heuristic, for newline translation might change - the string length. */ - if (resize_buffer(self, len) < 0) - return -1; - self->pos = 0; - if (write_str(self, value) < 0) - return -1; - } - else { - if (resize_buffer(self, 0) < 0) - return -1; - } - self->pos = 0; - - self->closed = 0; - self->ok = 1; - return 0; -} - -/* Properties and pseudo-properties */ - -PyDoc_STRVAR(stringio_readable_doc, -"readable() -> bool. Returns True if the IO object can be read."); - -PyDoc_STRVAR(stringio_writable_doc, -"writable() -> bool. Returns True if the IO object can be written."); - -PyDoc_STRVAR(stringio_seekable_doc, -"seekable() -> bool. Returns True if the IO object can be seeked."); - -static PyObject * -stringio_seekable(stringio *self, PyObject *args) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - Py_RETURN_TRUE; -} - -static PyObject * -stringio_readable(stringio *self, PyObject *args) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - Py_RETURN_TRUE; -} - -static PyObject * -stringio_writable(stringio *self, PyObject *args) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - Py_RETURN_TRUE; -} - -/* Pickling support. - - The implementation of __getstate__ is similar to the one for BytesIO, - except that we also save the newline parameter. For __setstate__ and unlike - BytesIO, we call __init__ to restore the object's state. Doing so allows us - to avoid decoding the complex newline state while keeping the object - representation compact. - - See comment in bytesio.c regarding why only pickle protocols and onward are - supported. -*/ - -static PyObject * -stringio_getstate(stringio *self) -{ - PyObject *initvalue = stringio_getvalue(self); - PyObject *dict; - PyObject *state; - - if (initvalue == NULL) - return NULL; - if (self->dict == NULL) { - Py_INCREF(Py_None); - dict = Py_None; - } - else { - dict = PyDict_Copy(self->dict); - if (dict == NULL) - return NULL; - } - - state = Py_BuildValue("(OOnN)", initvalue, - self->readnl ? self->readnl : Py_None, - self->pos, dict); - Py_DECREF(initvalue); - return state; -} - -static PyObject * -stringio_setstate(stringio *self, PyObject *state) -{ - PyObject *initarg; - PyObject *position_obj; - PyObject *dict; - Py_ssize_t pos; - - assert(state != NULL); - CHECK_CLOSED(self); - - /* We allow the state tuple to be longer than 4, because we may need - someday to extend the object's state without breaking - backward-compatibility. */ - if (!PyTuple_Check(state) || Py_SIZE(state) < 4) { - PyErr_Format(PyExc_TypeError, - "%.200s.__setstate__ argument should be 4-tuple, got %.200s", - Py_TYPE(self)->tp_name, Py_TYPE(state)->tp_name); - return NULL; - } - - /* Initialize the object's state. */ - initarg = PyTuple_GetSlice(state, 0, 2); - if (initarg == NULL) - return NULL; - if (stringio_init(self, initarg, NULL) < 0) { - Py_DECREF(initarg); - return NULL; - } - Py_DECREF(initarg); - - /* Restore the buffer state. Even if __init__ did initialize the buffer, - we have to initialize it again since __init__ may translates the - newlines in the inital_value string. We clearly do not want that - because the string value in the state tuple has already been translated - once by __init__. So we do not take any chance and replace object's - buffer completely. */ - { - Py_UNICODE *buf = PyUnicode_AS_UNICODE(PyTuple_GET_ITEM(state, 0)); - Py_ssize_t bufsize = PyUnicode_GET_SIZE(PyTuple_GET_ITEM(state, 0)); - if (resize_buffer(self, bufsize) < 0) - return NULL; - memcpy(self->buf, buf, bufsize * sizeof(Py_UNICODE)); - self->string_size = bufsize; - } - - /* Set carefully the position value. Alternatively, we could use the seek - method instead of modifying self->pos directly to better protect the - object internal state against errneous (or malicious) inputs. */ - position_obj = PyTuple_GET_ITEM(state, 2); - if (!PyIndex_Check(position_obj)) { - PyErr_Format(PyExc_TypeError, - "third item of state must be an integer, got %.200s", - Py_TYPE(position_obj)->tp_name); - return NULL; - } - pos = PyNumber_AsSsize_t(position_obj, PyExc_OverflowError); - if (pos == -1 && PyErr_Occurred()) - return NULL; - if (pos < 0) { - PyErr_SetString(PyExc_ValueError, - "position value cannot be negative"); - return NULL; - } - self->pos = pos; - - /* Set the dictionary of the instance variables. */ - dict = PyTuple_GET_ITEM(state, 3); - if (dict != Py_None) { - if (!PyDict_Check(dict)) { - PyErr_Format(PyExc_TypeError, - "fourth item of state should be a dict, got a %.200s", - Py_TYPE(dict)->tp_name); - return NULL; - } - if (self->dict) { - /* Alternatively, we could replace the internal dictionary - completely. However, it seems more practical to just update it. */ - if (PyDict_Update(self->dict, dict) < 0) - return NULL; - } - else { - Py_INCREF(dict); - self->dict = dict; - } - } - - Py_RETURN_NONE; -} - - -static PyObject * -stringio_closed(stringio *self, void *context) -{ - CHECK_INITIALIZED(self); - return PyBool_FromLong(self->closed); -} - -static PyObject * -stringio_line_buffering(stringio *self, void *context) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - Py_RETURN_FALSE; -} - -static PyObject * -stringio_newlines(stringio *self, void *context) -{ - CHECK_INITIALIZED(self); - CHECK_CLOSED(self); - if (self->decoder == NULL) - Py_RETURN_NONE; - return PyObject_GetAttr(self->decoder, _PyIO_str_newlines); -} - -static struct PyMethodDef stringio_methods[] = { - {"close", (PyCFunction)stringio_close, METH_NOARGS, stringio_close_doc}, - {"getvalue", (PyCFunction)stringio_getvalue, METH_NOARGS, stringio_getvalue_doc}, - {"read", (PyCFunction)stringio_read, METH_VARARGS, stringio_read_doc}, - {"readline", (PyCFunction)stringio_readline, METH_VARARGS, stringio_readline_doc}, - {"tell", (PyCFunction)stringio_tell, METH_NOARGS, stringio_tell_doc}, - {"truncate", (PyCFunction)stringio_truncate, METH_VARARGS, stringio_truncate_doc}, - {"seek", (PyCFunction)stringio_seek, METH_VARARGS, stringio_seek_doc}, - {"write", (PyCFunction)stringio_write, METH_O, stringio_write_doc}, - - {"seekable", (PyCFunction)stringio_seekable, METH_NOARGS, stringio_seekable_doc}, - {"readable", (PyCFunction)stringio_readable, METH_NOARGS, stringio_readable_doc}, - {"writable", (PyCFunction)stringio_writable, METH_NOARGS, stringio_writable_doc}, - - {"__getstate__", (PyCFunction)stringio_getstate, METH_NOARGS}, - {"__setstate__", (PyCFunction)stringio_setstate, METH_O}, - {NULL, NULL} /* sentinel */ -}; - -static PyGetSetDef stringio_getset[] = { - {"closed", (getter)stringio_closed, NULL, NULL}, - {"newlines", (getter)stringio_newlines, NULL, NULL}, - /* (following comments straight off of the original Python wrapper:) - XXX Cruft to support the TextIOWrapper API. This would only - be meaningful if StringIO supported the buffer attribute. - Hopefully, a better solution, than adding these pseudo-attributes, - will be found. - */ - {"line_buffering", (getter)stringio_line_buffering, NULL, NULL}, - {NULL} -}; - -PyTypeObject PyStringIO_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.StringIO", /*tp_name*/ - sizeof(stringio), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)stringio_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_reserved*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - stringio_doc, /*tp_doc*/ - (traverseproc)stringio_traverse, /*tp_traverse*/ - (inquiry)stringio_clear, /*tp_clear*/ - 0, /*tp_richcompare*/ - offsetof(stringio, weakreflist), /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - (iternextfunc)stringio_iternext, /*tp_iternext*/ - stringio_methods, /*tp_methods*/ - 0, /*tp_members*/ - stringio_getset, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - offsetof(stringio, dict), /*tp_dictoffset*/ - (initproc)stringio_init, /*tp_init*/ - 0, /*tp_alloc*/ - stringio_new, /*tp_new*/ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/textio.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/textio.c deleted file mode 100644 index ea42af0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_io/textio.c +++ /dev/null @@ -1,2670 +0,0 @@ -/* - An implementation of Text I/O as defined by PEP 3116 - "New I/O" - - Classes defined here: TextIOBase, IncrementalNewlineDecoder, TextIOWrapper. - - Written by Amaury Forgeot d'Arc and Antoine Pitrou -*/ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "_iomodule.h" - -/* TextIOBase */ - -PyDoc_STRVAR(textiobase_doc, - "Base class for text I/O.\n" - "\n" - "This class provides a character and line based interface to stream\n" - "I/O. There is no readinto method because Python's character strings\n" - "are immutable. There is no public constructor.\n" - ); - -static PyObject * -_unsupported(const char *message) -{ - PyErr_SetString(_PyIO_unsupported_operation, message); - return NULL; -} - -PyDoc_STRVAR(textiobase_detach_doc, - "Separate the underlying buffer from the TextIOBase and return it.\n" - "\n" - "After the underlying buffer has been detached, the TextIO is in an\n" - "unusable state.\n" - ); - -static PyObject * -textiobase_detach(PyObject *self) -{ - return _unsupported("detach"); -} - -PyDoc_STRVAR(textiobase_read_doc, - "Read at most n characters from stream.\n" - "\n" - "Read from underlying buffer until we have n characters or we hit EOF.\n" - "If n is negative or omitted, read until EOF.\n" - ); - -static PyObject * -textiobase_read(PyObject *self, PyObject *args) -{ - return _unsupported("read"); -} - -PyDoc_STRVAR(textiobase_readline_doc, - "Read until newline or EOF.\n" - "\n" - "Returns an empty string if EOF is hit immediately.\n" - ); - -static PyObject * -textiobase_readline(PyObject *self, PyObject *args) -{ - return _unsupported("readline"); -} - -PyDoc_STRVAR(textiobase_write_doc, - "Write string to stream.\n" - "Returns the number of characters written (which is always equal to\n" - "the length of the string).\n" - ); - -static PyObject * -textiobase_write(PyObject *self, PyObject *args) -{ - return _unsupported("write"); -} - -PyDoc_STRVAR(textiobase_encoding_doc, - "Encoding of the text stream.\n" - "\n" - "Subclasses should override.\n" - ); - -static PyObject * -textiobase_encoding_get(PyObject *self, void *context) -{ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(textiobase_newlines_doc, - "Line endings translated so far.\n" - "\n" - "Only line endings translated during reading are considered.\n" - "\n" - "Subclasses should override.\n" - ); - -static PyObject * -textiobase_newlines_get(PyObject *self, void *context) -{ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(textiobase_errors_doc, - "The error setting of the decoder or encoder.\n" - "\n" - "Subclasses should override.\n" - ); - -static PyObject * -textiobase_errors_get(PyObject *self, void *context) -{ - Py_RETURN_NONE; -} - - -static PyMethodDef textiobase_methods[] = { - {"detach", (PyCFunction)textiobase_detach, METH_NOARGS, textiobase_detach_doc}, - {"read", textiobase_read, METH_VARARGS, textiobase_read_doc}, - {"readline", textiobase_readline, METH_VARARGS, textiobase_readline_doc}, - {"write", textiobase_write, METH_VARARGS, textiobase_write_doc}, - {NULL, NULL} -}; - -static PyGetSetDef textiobase_getset[] = { - {"encoding", (getter)textiobase_encoding_get, NULL, textiobase_encoding_doc}, - {"newlines", (getter)textiobase_newlines_get, NULL, textiobase_newlines_doc}, - {"errors", (getter)textiobase_errors_get, NULL, textiobase_errors_doc}, - {NULL} -}; - -PyTypeObject PyTextIOBase_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io._TextIOBase", /*tp_name*/ - 0, /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - textiobase_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - textiobase_methods, /* tp_methods */ - 0, /* tp_members */ - textiobase_getset, /* tp_getset */ - &PyIOBase_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - - -/* IncrementalNewlineDecoder */ - -PyDoc_STRVAR(incrementalnewlinedecoder_doc, - "Codec used when reading a file in universal newlines mode. It wraps\n" - "another incremental decoder, translating \\r\\n and \\r into \\n. It also\n" - "records the types of newlines encountered. When used with\n" - "translate=False, it ensures that the newline sequence is returned in\n" - "one piece. When used with decoder=None, it expects unicode strings as\n" - "decode input and translates newlines without first invoking an external\n" - "decoder.\n" - ); - -typedef struct { - PyObject_HEAD - PyObject *decoder; - PyObject *errors; - signed int pendingcr: 1; - signed int translate: 1; - unsigned int seennl: 3; -} nldecoder_object; - -static int -incrementalnewlinedecoder_init(nldecoder_object *self, - PyObject *args, PyObject *kwds) -{ - PyObject *decoder; - int translate; - PyObject *errors = NULL; - char *kwlist[] = {"decoder", "translate", "errors", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oi|O:IncrementalNewlineDecoder", - kwlist, &decoder, &translate, &errors)) - return -1; - - self->decoder = decoder; - Py_INCREF(decoder); - - if (errors == NULL) { - self->errors = PyUnicode_FromString("strict"); - if (self->errors == NULL) - return -1; - } - else { - Py_INCREF(errors); - self->errors = errors; - } - - self->translate = translate; - self->seennl = 0; - self->pendingcr = 0; - - return 0; -} - -static void -incrementalnewlinedecoder_dealloc(nldecoder_object *self) -{ - Py_CLEAR(self->decoder); - Py_CLEAR(self->errors); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -check_decoded(PyObject *decoded) -{ - if (decoded == NULL) - return -1; - if (!PyUnicode_Check(decoded)) { - PyErr_Format(PyExc_TypeError, - "decoder should return a string result, not '%.200s'", - Py_TYPE(decoded)->tp_name); - Py_DECREF(decoded); - return -1; - } - return 0; -} - -#define SEEN_CR 1 -#define SEEN_LF 2 -#define SEEN_CRLF 4 -#define SEEN_ALL (SEEN_CR | SEEN_LF | SEEN_CRLF) - -PyObject * -_PyIncrementalNewlineDecoder_decode(PyObject *_self, - PyObject *input, int final) -{ - PyObject *output; - Py_ssize_t output_len; - nldecoder_object *self = (nldecoder_object *) _self; - - if (self->decoder == NULL) { - PyErr_SetString(PyExc_ValueError, - "IncrementalNewlineDecoder.__init__ not called"); - return NULL; - } - - /* decode input (with the eventual \r from a previous pass) */ - if (self->decoder != Py_None) { - output = PyObject_CallMethodObjArgs(self->decoder, - _PyIO_str_decode, input, final ? Py_True : Py_False, NULL); - } - else { - output = input; - Py_INCREF(output); - } - - if (check_decoded(output) < 0) - return NULL; - - output_len = PyUnicode_GET_SIZE(output); - if (self->pendingcr && (final || output_len > 0)) { - Py_UNICODE *out; - PyObject *modified = PyUnicode_FromUnicode(NULL, output_len + 1); - if (modified == NULL) - goto error; - out = PyUnicode_AS_UNICODE(modified); - out[0] = '\r'; - memcpy(out + 1, PyUnicode_AS_UNICODE(output), - output_len * sizeof(Py_UNICODE)); - Py_DECREF(output); - output = modified; - self->pendingcr = 0; - output_len++; - } - - /* retain last \r even when not translating data: - * then readline() is sure to get \r\n in one pass - */ - if (!final) { - if (output_len > 0 - && PyUnicode_AS_UNICODE(output)[output_len - 1] == '\r') { - - if (Py_REFCNT(output) == 1) { - if (PyUnicode_Resize(&output, output_len - 1) < 0) - goto error; - } - else { - PyObject *modified = PyUnicode_FromUnicode( - PyUnicode_AS_UNICODE(output), - output_len - 1); - if (modified == NULL) - goto error; - Py_DECREF(output); - output = modified; - } - self->pendingcr = 1; - } - } - - /* Record which newlines are read and do newline translation if desired, - all in one pass. */ - { - Py_UNICODE *in_str; - Py_ssize_t len; - int seennl = self->seennl; - int only_lf = 0; - - in_str = PyUnicode_AS_UNICODE(output); - len = PyUnicode_GET_SIZE(output); - - if (len == 0) - return output; - - /* If, up to now, newlines are consistently \n, do a quick check - for the \r *byte* with the libc's optimized memchr. - */ - if (seennl == SEEN_LF || seennl == 0) { - only_lf = (memchr(in_str, '\r', len * sizeof(Py_UNICODE)) == NULL); - } - - if (only_lf) { - /* If not already seen, quick scan for a possible "\n" character. - (there's nothing else to be done, even when in translation mode) - */ - if (seennl == 0 && - memchr(in_str, '\n', len * sizeof(Py_UNICODE)) != NULL) { - Py_UNICODE *s, *end; - s = in_str; - end = in_str + len; - for (;;) { - Py_UNICODE c; - /* Fast loop for non-control characters */ - while (*s > '\n') - s++; - c = *s++; - if (c == '\n') { - seennl |= SEEN_LF; - break; - } - if (s > end) - break; - } - } - /* Finished: we have scanned for newlines, and none of them - need translating */ - } - else if (!self->translate) { - Py_UNICODE *s, *end; - /* We have already seen all newline types, no need to scan again */ - if (seennl == SEEN_ALL) - goto endscan; - s = in_str; - end = in_str + len; - for (;;) { - Py_UNICODE c; - /* Fast loop for non-control characters */ - while (*s > '\r') - s++; - c = *s++; - if (c == '\n') - seennl |= SEEN_LF; - else if (c == '\r') { - if (*s == '\n') { - seennl |= SEEN_CRLF; - s++; - } - else - seennl |= SEEN_CR; - } - if (s > end) - break; - if (seennl == SEEN_ALL) - break; - } - endscan: - ; - } - else { - PyObject *translated = NULL; - Py_UNICODE *out_str; - Py_UNICODE *in, *out, *end; - if (Py_REFCNT(output) != 1) { - /* We could try to optimize this so that we only do a copy - when there is something to translate. On the other hand, - most decoders should only output non-shared strings, i.e. - translation is done in place. */ - translated = PyUnicode_FromUnicode(NULL, len); - if (translated == NULL) - goto error; - assert(Py_REFCNT(translated) == 1); - memcpy(PyUnicode_AS_UNICODE(translated), - PyUnicode_AS_UNICODE(output), - len * sizeof(Py_UNICODE)); - } - else { - translated = output; - } - out_str = PyUnicode_AS_UNICODE(translated); - in = in_str; - out = out_str; - end = in_str + len; - for (;;) { - Py_UNICODE c; - /* Fast loop for non-control characters */ - while ((c = *in++) > '\r') - *out++ = c; - if (c == '\n') { - *out++ = c; - seennl |= SEEN_LF; - continue; - } - if (c == '\r') { - if (*in == '\n') { - in++; - seennl |= SEEN_CRLF; - } - else - seennl |= SEEN_CR; - *out++ = '\n'; - continue; - } - if (in > end) - break; - *out++ = c; - } - if (translated != output) { - Py_DECREF(output); - output = translated; - } - if (out - out_str != len) { - if (PyUnicode_Resize(&output, out - out_str) < 0) - goto error; - } - } - self->seennl |= seennl; - } - - return output; - - error: - Py_DECREF(output); - return NULL; -} - -static PyObject * -incrementalnewlinedecoder_decode(nldecoder_object *self, - PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"input", "final", NULL}; - PyObject *input; - int final = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|i:IncrementalNewlineDecoder", - kwlist, &input, &final)) - return NULL; - return _PyIncrementalNewlineDecoder_decode((PyObject *) self, input, final); -} - -static PyObject * -incrementalnewlinedecoder_getstate(nldecoder_object *self, PyObject *args) -{ - PyObject *buffer; - unsigned PY_LONG_LONG flag; - - if (self->decoder != Py_None) { - PyObject *state = PyObject_CallMethodObjArgs(self->decoder, - _PyIO_str_getstate, NULL); - if (state == NULL) - return NULL; - if (!PyArg_Parse(state, "(OK)", &buffer, &flag)) { - Py_DECREF(state); - return NULL; - } - Py_INCREF(buffer); - Py_DECREF(state); - } - else { - buffer = PyBytes_FromString(""); - flag = 0; - } - flag <<= 1; - if (self->pendingcr) - flag |= 1; - return Py_BuildValue("NK", buffer, flag); -} - -static PyObject * -incrementalnewlinedecoder_setstate(nldecoder_object *self, PyObject *state) -{ - PyObject *buffer; - unsigned PY_LONG_LONG flag; - - if (!PyArg_Parse(state, "(OK)", &buffer, &flag)) - return NULL; - - self->pendingcr = (int) flag & 1; - flag >>= 1; - - if (self->decoder != Py_None) - return PyObject_CallMethod(self->decoder, - "setstate", "((OK))", buffer, flag); - else - Py_RETURN_NONE; -} - -static PyObject * -incrementalnewlinedecoder_reset(nldecoder_object *self, PyObject *args) -{ - self->seennl = 0; - self->pendingcr = 0; - if (self->decoder != Py_None) - return PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_reset, NULL); - else - Py_RETURN_NONE; -} - -static PyObject * -incrementalnewlinedecoder_newlines_get(nldecoder_object *self, void *context) -{ - switch (self->seennl) { - case SEEN_CR: - return PyUnicode_FromString("\r"); - case SEEN_LF: - return PyUnicode_FromString("\n"); - case SEEN_CRLF: - return PyUnicode_FromString("\r\n"); - case SEEN_CR | SEEN_LF: - return Py_BuildValue("ss", "\r", "\n"); - case SEEN_CR | SEEN_CRLF: - return Py_BuildValue("ss", "\r", "\r\n"); - case SEEN_LF | SEEN_CRLF: - return Py_BuildValue("ss", "\n", "\r\n"); - case SEEN_CR | SEEN_LF | SEEN_CRLF: - return Py_BuildValue("sss", "\r", "\n", "\r\n"); - default: - Py_RETURN_NONE; - } - -} - - -static PyMethodDef incrementalnewlinedecoder_methods[] = { - {"decode", (PyCFunction)incrementalnewlinedecoder_decode, METH_VARARGS|METH_KEYWORDS}, - {"getstate", (PyCFunction)incrementalnewlinedecoder_getstate, METH_NOARGS}, - {"setstate", (PyCFunction)incrementalnewlinedecoder_setstate, METH_O}, - {"reset", (PyCFunction)incrementalnewlinedecoder_reset, METH_NOARGS}, - {NULL} -}; - -static PyGetSetDef incrementalnewlinedecoder_getset[] = { - {"newlines", (getter)incrementalnewlinedecoder_newlines_get, NULL, NULL}, - {NULL} -}; - -PyTypeObject PyIncrementalNewlineDecoder_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.IncrementalNewlineDecoder", /*tp_name*/ - sizeof(nldecoder_object), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)incrementalnewlinedecoder_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare */ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - incrementalnewlinedecoder_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /*tp_weaklistoffset*/ - 0, /* tp_iter */ - 0, /* tp_iternext */ - incrementalnewlinedecoder_methods, /* tp_methods */ - 0, /* tp_members */ - incrementalnewlinedecoder_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)incrementalnewlinedecoder_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; - - -/* TextIOWrapper */ - -PyDoc_STRVAR(textiowrapper_doc, - "Character and line based layer over a BufferedIOBase object, buffer.\n" - "\n" - "encoding gives the name of the encoding that the stream will be\n" - "decoded or encoded with. It defaults to locale.getpreferredencoding.\n" - "\n" - "errors determines the strictness of encoding and decoding (see the\n" - "codecs.register) and defaults to \"strict\".\n" - "\n" - "newline controls how line endings are handled. It can be None, '',\n" - "'\\n', '\\r', and '\\r\\n'. It works as follows:\n" - "\n" - "* On input, if newline is None, universal newlines mode is\n" - " enabled. Lines in the input can end in '\\n', '\\r', or '\\r\\n', and\n" - " these are translated into '\\n' before being returned to the\n" - " caller. If it is '', universal newline mode is enabled, but line\n" - " endings are returned to the caller untranslated. If it has any of\n" - " the other legal values, input lines are only terminated by the given\n" - " string, and the line ending is returned to the caller untranslated.\n" - "\n" - "* On output, if newline is None, any '\\n' characters written are\n" - " translated to the system default line separator, os.linesep. If\n" - " newline is '', no translation takes place. If newline is any of the\n" - " other legal values, any '\\n' characters written are translated to\n" - " the given string.\n" - "\n" - "If line_buffering is True, a call to flush is implied when a call to\n" - "write contains a newline character." - ); - -typedef PyObject * - (*encodefunc_t)(PyObject *, PyObject *); - -typedef struct -{ - PyObject_HEAD - int ok; /* initialized? */ - int detached; - Py_ssize_t chunk_size; - PyObject *buffer; - PyObject *encoding; - PyObject *encoder; - PyObject *decoder; - PyObject *readnl; - PyObject *errors; - const char *writenl; /* utf-8 encoded, NULL stands for \n */ - char line_buffering; - char readuniversal; - char readtranslate; - char writetranslate; - char seekable; - char telling; - /* Specialized encoding func (see below) */ - encodefunc_t encodefunc; - /* Whether or not it's the start of the stream */ - char encoding_start_of_stream; - - /* Reads and writes are internally buffered in order to speed things up. - However, any read will first flush the write buffer if itsn't empty. - - Please also note that text to be written is first encoded before being - buffered. This is necessary so that encoding errors are immediately - reported to the caller, but it unfortunately means that the - IncrementalEncoder (whose encode() method is always written in Python) - becomes a bottleneck for small writes. - */ - PyObject *decoded_chars; /* buffer for text returned from decoder */ - Py_ssize_t decoded_chars_used; /* offset into _decoded_chars for read() */ - PyObject *pending_bytes; /* list of bytes objects waiting to be - written, or NULL */ - Py_ssize_t pending_bytes_count; - PyObject *snapshot; - /* snapshot is either None, or a tuple (dec_flags, next_input) where - * dec_flags is the second (integer) item of the decoder state and - * next_input is the chunk of input bytes that comes next after the - * snapshot point. We use this to reconstruct decoder states in tell(). - */ - - /* Cache raw object if it's a FileIO object */ - PyObject *raw; - - PyObject *weakreflist; - PyObject *dict; -} textio; - - -/* A couple of specialized cases in order to bypass the slow incremental - encoding methods for the most popular encodings. */ - -static PyObject * -ascii_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors)); -} - -static PyObject * -utf16be_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors), 1); -} - -static PyObject * -utf16le_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors), -1); -} - -static PyObject * -utf16_encode(textio *self, PyObject *text) -{ - if (!self->encoding_start_of_stream) { - /* Skip the BOM and use native byte ordering */ -#if defined(WORDS_BIGENDIAN) - return utf16be_encode(self, text); -#else - return utf16le_encode(self, text); -#endif - } - return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors), 0); -} - -static PyObject * -utf32be_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors), 1); -} - -static PyObject * -utf32le_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors), -1); -} - -static PyObject * -utf32_encode(textio *self, PyObject *text) -{ - if (!self->encoding_start_of_stream) { - /* Skip the BOM and use native byte ordering */ -#if defined(WORDS_BIGENDIAN) - return utf32be_encode(self, text); -#else - return utf32le_encode(self, text); -#endif - } - return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors), 0); -} - -static PyObject * -utf8_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors)); -} - -static PyObject * -latin1_encode(textio *self, PyObject *text) -{ - return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), - PyBytes_AS_STRING(self->errors)); -} - -/* Map normalized encoding names onto the specialized encoding funcs */ - -typedef struct { - const char *name; - encodefunc_t encodefunc; -} encodefuncentry; - -static encodefuncentry encodefuncs[] = { - {"ascii", (encodefunc_t) ascii_encode}, - {"iso8859-1", (encodefunc_t) latin1_encode}, - {"utf-8", (encodefunc_t) utf8_encode}, - {"utf-16-be", (encodefunc_t) utf16be_encode}, - {"utf-16-le", (encodefunc_t) utf16le_encode}, - {"utf-16", (encodefunc_t) utf16_encode}, - {"utf-32-be", (encodefunc_t) utf32be_encode}, - {"utf-32-le", (encodefunc_t) utf32le_encode}, - {"utf-32", (encodefunc_t) utf32_encode}, - {NULL, NULL} -}; - - -static int -textiowrapper_init(textio *self, PyObject *args, PyObject *kwds) -{ - char *kwlist[] = {"buffer", "encoding", "errors", - "newline", "line_buffering", - NULL}; - PyObject *buffer, *raw; - char *encoding = NULL; - char *errors = NULL; - char *newline = NULL; - int line_buffering = 0; - - PyObject *res; - int r; - - self->ok = 0; - self->detached = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|zzzi:fileio", - kwlist, &buffer, &encoding, &errors, - &newline, &line_buffering)) - return -1; - - if (newline && newline[0] != '\0' - && !(newline[0] == '\n' && newline[1] == '\0') - && !(newline[0] == '\r' && newline[1] == '\0') - && !(newline[0] == '\r' && newline[1] == '\n' && newline[2] == '\0')) { - PyErr_Format(PyExc_ValueError, - "illegal newline value: %s", newline); - return -1; - } - - Py_CLEAR(self->buffer); - Py_CLEAR(self->encoding); - Py_CLEAR(self->encoder); - Py_CLEAR(self->decoder); - Py_CLEAR(self->readnl); - Py_CLEAR(self->decoded_chars); - Py_CLEAR(self->pending_bytes); - Py_CLEAR(self->snapshot); - Py_CLEAR(self->errors); - Py_CLEAR(self->raw); - self->decoded_chars_used = 0; - self->pending_bytes_count = 0; - self->encodefunc = NULL; - self->writenl = NULL; - - if (encoding == NULL && self->encoding == NULL) { - if (_PyIO_locale_module == NULL) { - _PyIO_locale_module = PyImport_ImportModule("locale"); - if (_PyIO_locale_module == NULL) - goto catch_ImportError; - else - goto use_locale; - } - else { - use_locale: - self->encoding = PyObject_CallMethod( - _PyIO_locale_module, "getpreferredencoding", NULL); - if (self->encoding == NULL) { - catch_ImportError: - /* - Importing locale can raise a ImportError because of - _functools, and locale.getpreferredencoding can raise a - ImportError if _locale is not available. These will happen - during module building. - */ - if (PyErr_ExceptionMatches(PyExc_ImportError)) { - PyErr_Clear(); - self->encoding = PyString_FromString("ascii"); - } - else - goto error; - } - else if (!PyString_Check(self->encoding)) - Py_CLEAR(self->encoding); - } - } - if (self->encoding != NULL) - encoding = PyString_AsString(self->encoding); - else if (encoding != NULL) { - self->encoding = PyString_FromString(encoding); - if (self->encoding == NULL) - goto error; - } - else { - PyErr_SetString(PyExc_IOError, - "could not determine default encoding"); - } - - if (errors == NULL) - errors = "strict"; - self->errors = PyBytes_FromString(errors); - if (self->errors == NULL) - goto error; - - self->chunk_size = 8192; - self->readuniversal = (newline == NULL || newline[0] == '\0'); - self->line_buffering = line_buffering; - self->readtranslate = (newline == NULL); - if (newline) { - self->readnl = PyString_FromString(newline); - if (self->readnl == NULL) - return -1; - } - self->writetranslate = (newline == NULL || newline[0] != '\0'); - if (!self->readuniversal && self->writetranslate) { - self->writenl = PyString_AsString(self->readnl); - if (!strcmp(self->writenl, "\n")) - self->writenl = NULL; - } -#ifdef MS_WINDOWS - else - self->writenl = "\r\n"; -#endif - - /* Build the decoder object */ - res = PyObject_CallMethod(buffer, "readable", NULL); - if (res == NULL) - goto error; - r = PyObject_IsTrue(res); - Py_DECREF(res); - if (r == -1) - goto error; - if (r == 1) { - self->decoder = PyCodec_IncrementalDecoder( - encoding, errors); - if (self->decoder == NULL) - goto error; - - if (self->readuniversal) { - PyObject *incrementalDecoder = PyObject_CallFunction( - (PyObject *)&PyIncrementalNewlineDecoder_Type, - "Oi", self->decoder, (int)self->readtranslate); - if (incrementalDecoder == NULL) - goto error; - Py_CLEAR(self->decoder); - self->decoder = incrementalDecoder; - } - } - - /* Build the encoder object */ - res = PyObject_CallMethod(buffer, "writable", NULL); - if (res == NULL) - goto error; - r = PyObject_IsTrue(res); - Py_DECREF(res); - if (r == -1) - goto error; - if (r == 1) { - PyObject *ci; - self->encoder = PyCodec_IncrementalEncoder( - encoding, errors); - if (self->encoder == NULL) - goto error; - /* Get the normalized named of the codec */ - ci = _PyCodec_Lookup(encoding); - if (ci == NULL) - goto error; - res = PyObject_GetAttrString(ci, "name"); - Py_DECREF(ci); - if (res == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - goto error; - } - else if (PyString_Check(res)) { - encodefuncentry *e = encodefuncs; - while (e->name != NULL) { - if (!strcmp(PyString_AS_STRING(res), e->name)) { - self->encodefunc = e->encodefunc; - break; - } - e++; - } - } - Py_XDECREF(res); - } - - self->buffer = buffer; - Py_INCREF(buffer); - - if (Py_TYPE(buffer) == &PyBufferedReader_Type || - Py_TYPE(buffer) == &PyBufferedWriter_Type || - Py_TYPE(buffer) == &PyBufferedRandom_Type) { - raw = PyObject_GetAttrString(buffer, "raw"); - /* Cache the raw FileIO object to speed up 'closed' checks */ - if (raw == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - goto error; - } - else if (Py_TYPE(raw) == &PyFileIO_Type) - self->raw = raw; - else - Py_DECREF(raw); - } - - res = PyObject_CallMethod(buffer, "seekable", NULL); - if (res == NULL) - goto error; - r = PyObject_IsTrue(res); - Py_DECREF(res); - if (r < 0) - goto error; - self->seekable = self->telling = r; - - self->encoding_start_of_stream = 0; - if (self->seekable && self->encoder) { - PyObject *cookieObj; - int cmp; - - self->encoding_start_of_stream = 1; - - cookieObj = PyObject_CallMethodObjArgs(buffer, _PyIO_str_tell, NULL); - if (cookieObj == NULL) - goto error; - - cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_EQ); - Py_DECREF(cookieObj); - if (cmp < 0) { - goto error; - } - - if (cmp == 0) { - self->encoding_start_of_stream = 0; - res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_setstate, - _PyIO_zero, NULL); - if (res == NULL) - goto error; - Py_DECREF(res); - } - } - - self->ok = 1; - return 0; - - error: - return -1; -} - -static int -_textiowrapper_clear(textio *self) -{ - if (self->ok && _PyIOBase_finalize((PyObject *) self) < 0) - return -1; - self->ok = 0; - Py_CLEAR(self->buffer); - Py_CLEAR(self->encoding); - Py_CLEAR(self->encoder); - Py_CLEAR(self->decoder); - Py_CLEAR(self->readnl); - Py_CLEAR(self->decoded_chars); - Py_CLEAR(self->pending_bytes); - Py_CLEAR(self->snapshot); - Py_CLEAR(self->errors); - Py_CLEAR(self->raw); - return 0; -} - -static void -textiowrapper_dealloc(textio *self) -{ - if (_textiowrapper_clear(self) < 0) - return; - _PyObject_GC_UNTRACK(self); - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)self); - Py_CLEAR(self->dict); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -textiowrapper_traverse(textio *self, visitproc visit, void *arg) -{ - Py_VISIT(self->buffer); - Py_VISIT(self->encoding); - Py_VISIT(self->encoder); - Py_VISIT(self->decoder); - Py_VISIT(self->readnl); - Py_VISIT(self->decoded_chars); - Py_VISIT(self->pending_bytes); - Py_VISIT(self->snapshot); - Py_VISIT(self->errors); - Py_VISIT(self->raw); - - Py_VISIT(self->dict); - return 0; -} - -static int -textiowrapper_clear(textio *self) -{ - if (_textiowrapper_clear(self) < 0) - return -1; - Py_CLEAR(self->dict); - return 0; -} - -static PyObject * -textiowrapper_closed_get(textio *self, void *context); - -/* This macro takes some shortcuts to make the common case faster. */ -#define CHECK_CLOSED(self) \ - do { \ - int r; \ - PyObject *_res; \ - if (Py_TYPE(self) == &PyTextIOWrapper_Type) { \ - if (self->raw != NULL) \ - r = _PyFileIO_closed(self->raw); \ - else { \ - _res = textiowrapper_closed_get(self, NULL); \ - if (_res == NULL) \ - return NULL; \ - r = PyObject_IsTrue(_res); \ - Py_DECREF(_res); \ - if (r < 0) \ - return NULL; \ - } \ - if (r > 0) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on closed file."); \ - return NULL; \ - } \ - } \ - else if (_PyIOBase_check_closed((PyObject *)self, Py_True) == NULL) \ - return NULL; \ - } while (0) - -#define CHECK_INITIALIZED(self) \ - if (self->ok <= 0) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on uninitialized object"); \ - return NULL; \ - } - -#define CHECK_ATTACHED(self) \ - CHECK_INITIALIZED(self); \ - if (self->detached) { \ - PyErr_SetString(PyExc_ValueError, \ - "underlying buffer has been detached"); \ - return NULL; \ - } - -#define CHECK_ATTACHED_INT(self) \ - if (self->ok <= 0) { \ - PyErr_SetString(PyExc_ValueError, \ - "I/O operation on uninitialized object"); \ - return -1; \ - } else if (self->detached) { \ - PyErr_SetString(PyExc_ValueError, \ - "underlying buffer has been detached"); \ - return -1; \ - } - - -static PyObject * -textiowrapper_detach(textio *self) -{ - PyObject *buffer, *res; - CHECK_ATTACHED(self); - res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); - if (res == NULL) - return NULL; - Py_DECREF(res); - buffer = self->buffer; - self->buffer = NULL; - self->detached = 1; - return buffer; -} - -Py_LOCAL_INLINE(const Py_UNICODE *) -findchar(const Py_UNICODE *s, Py_ssize_t size, Py_UNICODE ch) -{ - /* like wcschr, but doesn't stop at NULL characters */ - while (size-- > 0) { - if (*s == ch) - return s; - s++; - } - return NULL; -} - -/* Flush the internal write buffer. This doesn't explicitly flush the - underlying buffered object, though. */ -static int -_textiowrapper_writeflush(textio *self) -{ - PyObject *pending, *b, *ret; - - if (self->pending_bytes == NULL) - return 0; - - pending = self->pending_bytes; - Py_INCREF(pending); - self->pending_bytes_count = 0; - Py_CLEAR(self->pending_bytes); - - b = _PyBytes_Join(_PyIO_empty_bytes, pending); - Py_DECREF(pending); - if (b == NULL) - return -1; - ret = NULL; - do { - ret = PyObject_CallMethodObjArgs(self->buffer, - _PyIO_str_write, b, NULL); - } while (ret == NULL && _PyIO_trap_eintr()); - Py_DECREF(b); - if (ret == NULL) - return -1; - Py_DECREF(ret); - return 0; -} - -static PyObject * -textiowrapper_write(textio *self, PyObject *args) -{ - PyObject *ret; - PyObject *text; /* owned reference */ - PyObject *b; - Py_ssize_t textlen; - int haslf = 0; - int needflush = 0; - - CHECK_ATTACHED(self); - - if (!PyArg_ParseTuple(args, "U:write", &text)) { - return NULL; - } - - CHECK_CLOSED(self); - - if (self->encoder == NULL) { - PyErr_SetString(PyExc_IOError, "not writable"); - return NULL; - } - - Py_INCREF(text); - - textlen = PyUnicode_GetSize(text); - - if ((self->writetranslate && self->writenl != NULL) || self->line_buffering) - if (findchar(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), '\n')) - haslf = 1; - - if (haslf && self->writetranslate && self->writenl != NULL) { - PyObject *newtext = PyObject_CallMethod( - text, "replace", "ss", "\n", self->writenl); - Py_DECREF(text); - if (newtext == NULL) - return NULL; - text = newtext; - } - - if (self->line_buffering && - (haslf || - findchar(PyUnicode_AS_UNICODE(text), - PyUnicode_GET_SIZE(text), '\r'))) - needflush = 1; - - /* XXX What if we were just reading? */ - if (self->encodefunc != NULL) { - b = (*self->encodefunc)((PyObject *) self, text); - self->encoding_start_of_stream = 0; - } - else - b = PyObject_CallMethodObjArgs(self->encoder, - _PyIO_str_encode, text, NULL); - Py_DECREF(text); - if (b == NULL) - return NULL; - - if (self->pending_bytes == NULL) { - self->pending_bytes = PyList_New(0); - if (self->pending_bytes == NULL) { - Py_DECREF(b); - return NULL; - } - self->pending_bytes_count = 0; - } - if (PyList_Append(self->pending_bytes, b) < 0) { - Py_DECREF(b); - return NULL; - } - self->pending_bytes_count += PyBytes_GET_SIZE(b); - Py_DECREF(b); - if (self->pending_bytes_count > self->chunk_size || needflush) { - if (_textiowrapper_writeflush(self) < 0) - return NULL; - } - - if (needflush) { - ret = PyObject_CallMethodObjArgs(self->buffer, _PyIO_str_flush, NULL); - if (ret == NULL) - return NULL; - Py_DECREF(ret); - } - - Py_CLEAR(self->snapshot); - - if (self->decoder) { - ret = PyObject_CallMethod(self->decoder, "reset", NULL); - if (ret == NULL) - return NULL; - Py_DECREF(ret); - } - - return PyLong_FromSsize_t(textlen); -} - -/* Steal a reference to chars and store it in the decoded_char buffer; - */ -static void -textiowrapper_set_decoded_chars(textio *self, PyObject *chars) -{ - Py_CLEAR(self->decoded_chars); - self->decoded_chars = chars; - self->decoded_chars_used = 0; -} - -static PyObject * -textiowrapper_get_decoded_chars(textio *self, Py_ssize_t n) -{ - PyObject *chars; - Py_ssize_t avail; - - if (self->decoded_chars == NULL) - return PyUnicode_FromStringAndSize(NULL, 0); - - avail = (PyUnicode_GET_SIZE(self->decoded_chars) - - self->decoded_chars_used); - - assert(avail >= 0); - - if (n < 0 || n > avail) - n = avail; - - if (self->decoded_chars_used > 0 || n < avail) { - chars = PyUnicode_FromUnicode( - PyUnicode_AS_UNICODE(self->decoded_chars) - + self->decoded_chars_used, n); - if (chars == NULL) - return NULL; - } - else { - chars = self->decoded_chars; - Py_INCREF(chars); - } - - self->decoded_chars_used += n; - return chars; -} - -/* Read and decode the next chunk of data from the BufferedReader. - */ -static int -textiowrapper_read_chunk(textio *self) -{ - PyObject *dec_buffer = NULL; - PyObject *dec_flags = NULL; - PyObject *input_chunk = NULL; - PyObject *decoded_chars, *chunk_size; - int eof; - - /* The return value is True unless EOF was reached. The decoded string is - * placed in self._decoded_chars (replacing its previous value). The - * entire input chunk is sent to the decoder, though some of it may remain - * buffered in the decoder, yet to be converted. - */ - - if (self->decoder == NULL) { - PyErr_SetString(PyExc_IOError, "not readable"); - return -1; - } - - if (self->telling) { - /* To prepare for tell(), we need to snapshot a point in the file - * where the decoder's input buffer is empty. - */ - - PyObject *state = PyObject_CallMethodObjArgs(self->decoder, - _PyIO_str_getstate, NULL); - if (state == NULL) - return -1; - /* Given this, we know there was a valid snapshot point - * len(dec_buffer) bytes ago with decoder state (b'', dec_flags). - */ - if (PyArg_Parse(state, "(OO)", &dec_buffer, &dec_flags) < 0) { - Py_DECREF(state); - return -1; - } - Py_INCREF(dec_buffer); - Py_INCREF(dec_flags); - Py_DECREF(state); - } - - /* Read a chunk, decode it, and put the result in self._decoded_chars. */ - chunk_size = PyLong_FromSsize_t(self->chunk_size); - if (chunk_size == NULL) - goto fail; - input_chunk = PyObject_CallMethodObjArgs(self->buffer, - _PyIO_str_read1, chunk_size, NULL); - Py_DECREF(chunk_size); - if (input_chunk == NULL) - goto fail; - if (!PyBytes_Check(input_chunk)) { - PyErr_Format(PyExc_TypeError, - "underlying read1() should have returned a bytes object, " - "not '%.200s'", Py_TYPE(input_chunk)->tp_name); - goto fail; - } - - eof = (PyBytes_Size(input_chunk) == 0); - - if (Py_TYPE(self->decoder) == &PyIncrementalNewlineDecoder_Type) { - decoded_chars = _PyIncrementalNewlineDecoder_decode( - self->decoder, input_chunk, eof); - } - else { - decoded_chars = PyObject_CallMethodObjArgs(self->decoder, - _PyIO_str_decode, input_chunk, eof ? Py_True : Py_False, NULL); - } - - if (check_decoded(decoded_chars) < 0) - goto fail; - textiowrapper_set_decoded_chars(self, decoded_chars); - if (PyUnicode_GET_SIZE(decoded_chars) > 0) - eof = 0; - - if (self->telling) { - /* At the snapshot point, len(dec_buffer) bytes before the read, the - * next input to be decoded is dec_buffer + input_chunk. - */ - PyObject *next_input = PyNumber_Add(dec_buffer, input_chunk); - if (next_input == NULL) - goto fail; - if (!PyBytes_Check(next_input)) { - PyErr_Format(PyExc_TypeError, - "decoder getstate() should have returned a bytes " - "object, not '%.200s'", - Py_TYPE(next_input)->tp_name); - Py_DECREF(next_input); - goto fail; - } - Py_DECREF(dec_buffer); - Py_CLEAR(self->snapshot); - self->snapshot = Py_BuildValue("NN", dec_flags, next_input); - } - Py_DECREF(input_chunk); - - return (eof == 0); - - fail: - Py_XDECREF(dec_buffer); - Py_XDECREF(dec_flags); - Py_XDECREF(input_chunk); - return -1; -} - -static PyObject * -textiowrapper_read(textio *self, PyObject *args) -{ - Py_ssize_t n = -1; - PyObject *result = NULL, *chunks = NULL; - - CHECK_ATTACHED(self); - - if (!PyArg_ParseTuple(args, "|O&:read", &_PyIO_ConvertSsize_t, &n)) - return NULL; - - CHECK_CLOSED(self); - - if (self->decoder == NULL) { - PyErr_SetString(PyExc_IOError, "not readable"); - return NULL; - } - - if (_textiowrapper_writeflush(self) < 0) - return NULL; - - if (n < 0) { - /* Read everything */ - PyObject *bytes = PyObject_CallMethod(self->buffer, "read", NULL); - PyObject *decoded, *final; - if (bytes == NULL) - goto fail; - decoded = PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_decode, - bytes, Py_True, NULL); - Py_DECREF(bytes); - if (check_decoded(decoded) < 0) - goto fail; - - result = textiowrapper_get_decoded_chars(self, -1); - - if (result == NULL) { - Py_DECREF(decoded); - return NULL; - } - - final = PyUnicode_Concat(result, decoded); - Py_DECREF(result); - Py_DECREF(decoded); - if (final == NULL) - goto fail; - - Py_CLEAR(self->snapshot); - return final; - } - else { - int res = 1; - Py_ssize_t remaining = n; - - result = textiowrapper_get_decoded_chars(self, n); - if (result == NULL) - goto fail; - remaining -= PyUnicode_GET_SIZE(result); - - /* Keep reading chunks until we have n characters to return */ - while (remaining > 0) { - res = textiowrapper_read_chunk(self); - if (res < 0) { - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() - when EINTR occurs so we needn't do it ourselves. */ - if (_PyIO_trap_eintr()) { - continue; - } - goto fail; - } - if (res == 0) /* EOF */ - break; - if (chunks == NULL) { - chunks = PyList_New(0); - if (chunks == NULL) - goto fail; - } - if (PyList_Append(chunks, result) < 0) - goto fail; - Py_DECREF(result); - result = textiowrapper_get_decoded_chars(self, remaining); - if (result == NULL) - goto fail; - remaining -= PyUnicode_GET_SIZE(result); - } - if (chunks != NULL) { - if (result != NULL && PyList_Append(chunks, result) < 0) - goto fail; - Py_CLEAR(result); - result = PyUnicode_Join(_PyIO_empty_str, chunks); - if (result == NULL) - goto fail; - Py_CLEAR(chunks); - } - return result; - } - fail: - Py_XDECREF(result); - Py_XDECREF(chunks); - return NULL; -} - - -/* NOTE: `end` must point to the real end of the Py_UNICODE storage, - that is to the NUL character. Otherwise the function will produce - incorrect results. */ -static Py_UNICODE * -find_control_char(Py_UNICODE *start, Py_UNICODE *end, Py_UNICODE ch) -{ - Py_UNICODE *s = start; - for (;;) { - while (*s > ch) - s++; - if (*s == ch) - return s; - if (s == end) - return NULL; - s++; - } -} - -Py_ssize_t -_PyIO_find_line_ending( - int translated, int universal, PyObject *readnl, - Py_UNICODE *start, Py_UNICODE *end, Py_ssize_t *consumed) -{ - Py_ssize_t len = end - start; - - if (translated) { - /* Newlines are already translated, only search for \n */ - Py_UNICODE *pos = find_control_char(start, end, '\n'); - if (pos != NULL) - return pos - start + 1; - else { - *consumed = len; - return -1; - } - } - else if (universal) { - /* Universal newline search. Find any of \r, \r\n, \n - * The decoder ensures that \r\n are not split in two pieces - */ - Py_UNICODE *s = start; - for (;;) { - Py_UNICODE ch; - /* Fast path for non-control chars. The loop always ends - since the Py_UNICODE storage is NUL-terminated. */ - while (*s > '\r') - s++; - if (s >= end) { - *consumed = len; - return -1; - } - ch = *s++; - if (ch == '\n') - return s - start; - if (ch == '\r') { - if (*s == '\n') - return s - start + 1; - else - return s - start; - } - } - } - else { - /* Non-universal mode. */ - Py_ssize_t readnl_len = PyString_GET_SIZE(readnl); - unsigned char *nl = (unsigned char *) PyString_AS_STRING(readnl); - if (readnl_len == 1) { - Py_UNICODE *pos = find_control_char(start, end, nl[0]); - if (pos != NULL) - return pos - start + 1; - *consumed = len; - return -1; - } - else { - Py_UNICODE *s = start; - Py_UNICODE *e = end - readnl_len + 1; - Py_UNICODE *pos; - if (e < s) - e = s; - while (s < e) { - Py_ssize_t i; - Py_UNICODE *pos = find_control_char(s, end, nl[0]); - if (pos == NULL || pos >= e) - break; - for (i = 1; i < readnl_len; i++) { - if (pos[i] != nl[i]) - break; - } - if (i == readnl_len) - return pos - start + readnl_len; - s = pos + 1; - } - pos = find_control_char(e, end, nl[0]); - if (pos == NULL) - *consumed = len; - else - *consumed = pos - start; - return -1; - } - } -} - -static PyObject * -_textiowrapper_readline(textio *self, Py_ssize_t limit) -{ - PyObject *line = NULL, *chunks = NULL, *remaining = NULL; - Py_ssize_t start, endpos, chunked, offset_to_buffer; - int res; - - CHECK_CLOSED(self); - - if (_textiowrapper_writeflush(self) < 0) - return NULL; - - chunked = 0; - - while (1) { - Py_UNICODE *ptr; - Py_ssize_t line_len; - Py_ssize_t consumed = 0; - - /* First, get some data if necessary */ - res = 1; - while (!self->decoded_chars || - !PyUnicode_GET_SIZE(self->decoded_chars)) { - res = textiowrapper_read_chunk(self); - if (res < 0) { - /* NOTE: PyErr_SetFromErrno() calls PyErr_CheckSignals() - when EINTR occurs so we needn't do it ourselves. */ - if (_PyIO_trap_eintr()) { - continue; - } - goto error; - } - if (res == 0) - break; - } - if (res == 0) { - /* end of file */ - textiowrapper_set_decoded_chars(self, NULL); - Py_CLEAR(self->snapshot); - start = endpos = offset_to_buffer = 0; - break; - } - - if (remaining == NULL) { - line = self->decoded_chars; - start = self->decoded_chars_used; - offset_to_buffer = 0; - Py_INCREF(line); - } - else { - assert(self->decoded_chars_used == 0); - line = PyUnicode_Concat(remaining, self->decoded_chars); - start = 0; - offset_to_buffer = PyUnicode_GET_SIZE(remaining); - Py_CLEAR(remaining); - if (line == NULL) - goto error; - } - - ptr = PyUnicode_AS_UNICODE(line); - line_len = PyUnicode_GET_SIZE(line); - - endpos = _PyIO_find_line_ending( - self->readtranslate, self->readuniversal, self->readnl, - ptr + start, ptr + line_len, &consumed); - if (endpos >= 0) { - endpos += start; - if (limit >= 0 && (endpos - start) + chunked >= limit) - endpos = start + limit - chunked; - break; - } - - /* We can put aside up to `endpos` */ - endpos = consumed + start; - if (limit >= 0 && (endpos - start) + chunked >= limit) { - /* Didn't find line ending, but reached length limit */ - endpos = start + limit - chunked; - break; - } - - if (endpos > start) { - /* No line ending seen yet - put aside current data */ - PyObject *s; - if (chunks == NULL) { - chunks = PyList_New(0); - if (chunks == NULL) - goto error; - } - s = PyUnicode_FromUnicode(ptr + start, endpos - start); - if (s == NULL) - goto error; - if (PyList_Append(chunks, s) < 0) { - Py_DECREF(s); - goto error; - } - chunked += PyUnicode_GET_SIZE(s); - Py_DECREF(s); - } - /* There may be some remaining bytes we'll have to prepend to the - next chunk of data */ - if (endpos < line_len) { - remaining = PyUnicode_FromUnicode( - ptr + endpos, line_len - endpos); - if (remaining == NULL) - goto error; - } - Py_CLEAR(line); - /* We have consumed the buffer */ - textiowrapper_set_decoded_chars(self, NULL); - } - - if (line != NULL) { - /* Our line ends in the current buffer */ - self->decoded_chars_used = endpos - offset_to_buffer; - if (start > 0 || endpos < PyUnicode_GET_SIZE(line)) { - if (start == 0 && Py_REFCNT(line) == 1) { - if (PyUnicode_Resize(&line, endpos) < 0) - goto error; - } - else { - PyObject *s = PyUnicode_FromUnicode( - PyUnicode_AS_UNICODE(line) + start, endpos - start); - Py_CLEAR(line); - if (s == NULL) - goto error; - line = s; - } - } - } - if (remaining != NULL) { - if (chunks == NULL) { - chunks = PyList_New(0); - if (chunks == NULL) - goto error; - } - if (PyList_Append(chunks, remaining) < 0) - goto error; - Py_CLEAR(remaining); - } - if (chunks != NULL) { - if (line != NULL && PyList_Append(chunks, line) < 0) - goto error; - Py_CLEAR(line); - line = PyUnicode_Join(_PyIO_empty_str, chunks); - if (line == NULL) - goto error; - Py_DECREF(chunks); - } - if (line == NULL) - line = PyUnicode_FromStringAndSize(NULL, 0); - - return line; - - error: - Py_XDECREF(chunks); - Py_XDECREF(remaining); - Py_XDECREF(line); - return NULL; -} - -static PyObject * -textiowrapper_readline(textio *self, PyObject *args) -{ - PyObject *limitobj = NULL; - Py_ssize_t limit = -1; - - CHECK_ATTACHED(self); - if (!PyArg_ParseTuple(args, "|O:readline", &limitobj)) { - return NULL; - } - if (limitobj) { - if (!PyNumber_Check(limitobj)) { - PyErr_Format(PyExc_TypeError, - "integer argument expected, got '%.200s'", - Py_TYPE(limitobj)->tp_name); - return NULL; - } - limit = PyNumber_AsSsize_t(limitobj, PyExc_OverflowError); - if (limit == -1 && PyErr_Occurred()) - return NULL; - } - return _textiowrapper_readline(self, limit); -} - -/* Seek and Tell */ - -typedef struct { - Py_off_t start_pos; - int dec_flags; - int bytes_to_feed; - int chars_to_skip; - char need_eof; -} cookie_type; - -/* - To speed up cookie packing/unpacking, we store the fields in a temporary - string and call _PyLong_FromByteArray() or _PyLong_AsByteArray (resp.). - The following macros define at which offsets in the intermediary byte - string the various CookieStruct fields will be stored. - */ - -#define COOKIE_BUF_LEN (sizeof(Py_off_t) + 3 * sizeof(int) + sizeof(char)) - -#if defined(WORDS_BIGENDIAN) - -# define IS_LITTLE_ENDIAN 0 - -/* We want the least significant byte of start_pos to also be the least - significant byte of the cookie, which means that in big-endian mode we - must copy the fields in reverse order. */ - -# define OFF_START_POS (sizeof(char) + 3 * sizeof(int)) -# define OFF_DEC_FLAGS (sizeof(char) + 2 * sizeof(int)) -# define OFF_BYTES_TO_FEED (sizeof(char) + sizeof(int)) -# define OFF_CHARS_TO_SKIP (sizeof(char)) -# define OFF_NEED_EOF 0 - -#else - -# define IS_LITTLE_ENDIAN 1 - -/* Little-endian mode: the least significant byte of start_pos will - naturally end up the least significant byte of the cookie. */ - -# define OFF_START_POS 0 -# define OFF_DEC_FLAGS (sizeof(Py_off_t)) -# define OFF_BYTES_TO_FEED (sizeof(Py_off_t) + sizeof(int)) -# define OFF_CHARS_TO_SKIP (sizeof(Py_off_t) + 2 * sizeof(int)) -# define OFF_NEED_EOF (sizeof(Py_off_t) + 3 * sizeof(int)) - -#endif - -static int -textiowrapper_parse_cookie(cookie_type *cookie, PyObject *cookieObj) -{ - unsigned char buffer[COOKIE_BUF_LEN]; - PyLongObject *cookieLong = (PyLongObject *)PyNumber_Long(cookieObj); - if (cookieLong == NULL) - return -1; - - if (_PyLong_AsByteArray(cookieLong, buffer, sizeof(buffer), - IS_LITTLE_ENDIAN, 0) < 0) { - Py_DECREF(cookieLong); - return -1; - } - Py_DECREF(cookieLong); - - memcpy(&cookie->start_pos, buffer + OFF_START_POS, sizeof(cookie->start_pos)); - memcpy(&cookie->dec_flags, buffer + OFF_DEC_FLAGS, sizeof(cookie->dec_flags)); - memcpy(&cookie->bytes_to_feed, buffer + OFF_BYTES_TO_FEED, sizeof(cookie->bytes_to_feed)); - memcpy(&cookie->chars_to_skip, buffer + OFF_CHARS_TO_SKIP, sizeof(cookie->chars_to_skip)); - memcpy(&cookie->need_eof, buffer + OFF_NEED_EOF, sizeof(cookie->need_eof)); - - return 0; -} - -static PyObject * -textiowrapper_build_cookie(cookie_type *cookie) -{ - unsigned char buffer[COOKIE_BUF_LEN]; - - memcpy(buffer + OFF_START_POS, &cookie->start_pos, sizeof(cookie->start_pos)); - memcpy(buffer + OFF_DEC_FLAGS, &cookie->dec_flags, sizeof(cookie->dec_flags)); - memcpy(buffer + OFF_BYTES_TO_FEED, &cookie->bytes_to_feed, sizeof(cookie->bytes_to_feed)); - memcpy(buffer + OFF_CHARS_TO_SKIP, &cookie->chars_to_skip, sizeof(cookie->chars_to_skip)); - memcpy(buffer + OFF_NEED_EOF, &cookie->need_eof, sizeof(cookie->need_eof)); - - return _PyLong_FromByteArray(buffer, sizeof(buffer), IS_LITTLE_ENDIAN, 0); -} -#undef IS_LITTLE_ENDIAN - -static int -_textiowrapper_decoder_setstate(textio *self, cookie_type *cookie) -{ - PyObject *res; - /* When seeking to the start of the stream, we call decoder.reset() - rather than decoder.getstate(). - This is for a few decoders such as utf-16 for which the state value - at start is not (b"", 0) but e.g. (b"", 2) (meaning, in the case of - utf-16, that we are expecting a BOM). - */ - if (cookie->start_pos == 0 && cookie->dec_flags == 0) - res = PyObject_CallMethodObjArgs(self->decoder, _PyIO_str_reset, NULL); - else - res = PyObject_CallMethod(self->decoder, "setstate", - "((si))", "", cookie->dec_flags); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static int -_textiowrapper_encoder_setstate(textio *self, cookie_type *cookie) -{ - PyObject *res; - /* Same as _textiowrapper_decoder_setstate() above. */ - if (cookie->start_pos == 0 && cookie->dec_flags == 0) { - res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_reset, NULL); - self->encoding_start_of_stream = 1; - } - else { - res = PyObject_CallMethodObjArgs(self->encoder, _PyIO_str_setstate, - _PyIO_zero, NULL); - self->encoding_start_of_stream = 0; - } - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static PyObject * -textiowrapper_seek(textio *self, PyObject *args) -{ - PyObject *cookieObj, *posobj; - cookie_type cookie; - int whence = 0; - PyObject *res; - int cmp; - - CHECK_ATTACHED(self); - - if (!PyArg_ParseTuple(args, "O|i:seek", &cookieObj, &whence)) - return NULL; - CHECK_CLOSED(self); - - Py_INCREF(cookieObj); - - if (!self->seekable) { - PyErr_SetString(PyExc_IOError, - "underlying stream is not seekable"); - goto fail; - } - - if (whence == 1) { - /* seek relative to current position */ - cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_EQ); - if (cmp < 0) - goto fail; - - if (cmp == 0) { - PyErr_SetString(PyExc_IOError, - "can't do nonzero cur-relative seeks"); - goto fail; - } - - /* Seeking to the current position should attempt to - * sync the underlying buffer with the current position. - */ - Py_DECREF(cookieObj); - cookieObj = PyObject_CallMethod((PyObject *)self, "tell", NULL); - if (cookieObj == NULL) - goto fail; - } - else if (whence == 2) { - /* seek relative to end of file */ - - cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_EQ); - if (cmp < 0) - goto fail; - - if (cmp == 0) { - PyErr_SetString(PyExc_IOError, - "can't do nonzero end-relative seeks"); - goto fail; - } - - res = PyObject_CallMethod((PyObject *)self, "flush", NULL); - if (res == NULL) - goto fail; - Py_DECREF(res); - - textiowrapper_set_decoded_chars(self, NULL); - Py_CLEAR(self->snapshot); - if (self->decoder) { - res = PyObject_CallMethod(self->decoder, "reset", NULL); - if (res == NULL) - goto fail; - Py_DECREF(res); - } - - res = PyObject_CallMethod(self->buffer, "seek", "ii", 0, 2); - Py_XDECREF(cookieObj); - return res; - } - else if (whence != 0) { - PyErr_Format(PyExc_ValueError, - "invalid whence (%d, should be 0, 1 or 2)", whence); - goto fail; - } - - cmp = PyObject_RichCompareBool(cookieObj, _PyIO_zero, Py_LT); - if (cmp < 0) - goto fail; - - if (cmp == 1) { - PyObject *repr = PyObject_Repr(cookieObj); - if (repr != NULL) { - PyErr_Format(PyExc_ValueError, - "negative seek position %s", - PyString_AS_STRING(repr)); - Py_DECREF(repr); - } - goto fail; - } - - res = PyObject_CallMethodObjArgs((PyObject *)self, _PyIO_str_flush, NULL); - if (res == NULL) - goto fail; - Py_DECREF(res); - - /* The strategy of seek() is to go back to the safe start point - * and replay the effect of read(chars_to_skip) from there. - */ - if (textiowrapper_parse_cookie(&cookie, cookieObj) < 0) - goto fail; - - /* Seek back to the safe start point. */ - posobj = PyLong_FromOff_t(cookie.start_pos); - if (posobj == NULL) - goto fail; - res = PyObject_CallMethodObjArgs(self->buffer, - _PyIO_str_seek, posobj, NULL); - Py_DECREF(posobj); - if (res == NULL) - goto fail; - Py_DECREF(res); - - textiowrapper_set_decoded_chars(self, NULL); - Py_CLEAR(self->snapshot); - - /* Restore the decoder to its state from the safe start point. */ - if (self->decoder) { - if (_textiowrapper_decoder_setstate(self, &cookie) < 0) - goto fail; - } - - if (cookie.chars_to_skip) { - /* Just like _read_chunk, feed the decoder and save a snapshot. */ - PyObject *input_chunk = PyObject_CallMethod( - self->buffer, "read", "i", cookie.bytes_to_feed); - PyObject *decoded; - - if (input_chunk == NULL) - goto fail; - - if (!PyBytes_Check(input_chunk)) { - PyErr_Format(PyExc_TypeError, - "underlying read() should have returned a bytes " - "object, not '%.200s'", - Py_TYPE(input_chunk)->tp_name); - Py_DECREF(input_chunk); - goto fail; - } - - self->snapshot = Py_BuildValue("iN", cookie.dec_flags, input_chunk); - if (self->snapshot == NULL) { - Py_DECREF(input_chunk); - goto fail; - } - - decoded = PyObject_CallMethod(self->decoder, "decode", - "Oi", input_chunk, (int)cookie.need_eof); - - if (check_decoded(decoded) < 0) - goto fail; - - textiowrapper_set_decoded_chars(self, decoded); - - /* Skip chars_to_skip of the decoded characters. */ - if (PyUnicode_GetSize(self->decoded_chars) < cookie.chars_to_skip) { - PyErr_SetString(PyExc_IOError, "can't restore logical file position"); - goto fail; - } - self->decoded_chars_used = cookie.chars_to_skip; - } - else { - self->snapshot = Py_BuildValue("is", cookie.dec_flags, ""); - if (self->snapshot == NULL) - goto fail; - } - - /* Finally, reset the encoder (merely useful for proper BOM handling) */ - if (self->encoder) { - if (_textiowrapper_encoder_setstate(self, &cookie) < 0) - goto fail; - } - return cookieObj; - fail: - Py_XDECREF(cookieObj); - return NULL; - -} - -static PyObject * -textiowrapper_tell(textio *self, PyObject *args) -{ - PyObject *res; - PyObject *posobj = NULL; - cookie_type cookie = {0,0,0,0,0}; - PyObject *next_input; - Py_ssize_t chars_to_skip, chars_decoded; - PyObject *saved_state = NULL; - char *input, *input_end; - - CHECK_ATTACHED(self); - CHECK_CLOSED(self); - - if (!self->seekable) { - PyErr_SetString(PyExc_IOError, - "underlying stream is not seekable"); - goto fail; - } - if (!self->telling) { - PyErr_SetString(PyExc_IOError, - "telling position disabled by next() call"); - goto fail; - } - - if (_textiowrapper_writeflush(self) < 0) - return NULL; - res = PyObject_CallMethod((PyObject *)self, "flush", NULL); - if (res == NULL) - goto fail; - Py_DECREF(res); - - posobj = PyObject_CallMethod(self->buffer, "tell", NULL); - if (posobj == NULL) - goto fail; - - if (self->decoder == NULL || self->snapshot == NULL) { - assert (self->decoded_chars == NULL || PyUnicode_GetSize(self->decoded_chars) == 0); - return posobj; - } - -#if defined(HAVE_LARGEFILE_SUPPORT) - cookie.start_pos = PyLong_AsLongLong(posobj); -#else - cookie.start_pos = PyLong_AsLong(posobj); -#endif - if (PyErr_Occurred()) - goto fail; - - /* Skip backward to the snapshot point (see _read_chunk). */ - if (!PyArg_Parse(self->snapshot, "(iO)", &cookie.dec_flags, &next_input)) - goto fail; - - assert (PyBytes_Check(next_input)); - - cookie.start_pos -= PyBytes_GET_SIZE(next_input); - - /* How many decoded characters have been used up since the snapshot? */ - if (self->decoded_chars_used == 0) { - /* We haven't moved from the snapshot point. */ - Py_DECREF(posobj); - return textiowrapper_build_cookie(&cookie); - } - - chars_to_skip = self->decoded_chars_used; - - /* Starting from the snapshot position, we will walk the decoder - * forward until it gives us enough decoded characters. - */ - saved_state = PyObject_CallMethodObjArgs(self->decoder, - _PyIO_str_getstate, NULL); - if (saved_state == NULL) - goto fail; - - /* Note our initial start point. */ - if (_textiowrapper_decoder_setstate(self, &cookie) < 0) - goto fail; - - /* Feed the decoder one byte at a time. As we go, note the - * nearest "safe start point" before the current location - * (a point where the decoder has nothing buffered, so seek() - * can safely start from there and advance to this location). - */ - chars_decoded = 0; - input = PyBytes_AS_STRING(next_input); - input_end = input + PyBytes_GET_SIZE(next_input); - while (input < input_end) { - PyObject *state; - char *dec_buffer; - Py_ssize_t dec_buffer_len; - int dec_flags; - - PyObject *decoded = PyObject_CallMethod( - self->decoder, "decode", "s#", input, (Py_ssize_t)1); - if (check_decoded(decoded) < 0) - goto fail; - chars_decoded += PyUnicode_GET_SIZE(decoded); - Py_DECREF(decoded); - - cookie.bytes_to_feed += 1; - - state = PyObject_CallMethodObjArgs(self->decoder, - _PyIO_str_getstate, NULL); - if (state == NULL) - goto fail; - if (!PyArg_Parse(state, "(s#i)", &dec_buffer, &dec_buffer_len, &dec_flags)) { - Py_DECREF(state); - goto fail; - } - Py_DECREF(state); - - if (dec_buffer_len == 0 && chars_decoded <= chars_to_skip) { - /* Decoder buffer is empty, so this is a safe start point. */ - cookie.start_pos += cookie.bytes_to_feed; - chars_to_skip -= chars_decoded; - cookie.dec_flags = dec_flags; - cookie.bytes_to_feed = 0; - chars_decoded = 0; - } - if (chars_decoded >= chars_to_skip) - break; - input++; - } - if (input == input_end) { - /* We didn't get enough decoded data; signal EOF to get more. */ - PyObject *decoded = PyObject_CallMethod( - self->decoder, "decode", "si", "", /* final = */ 1); - if (check_decoded(decoded) < 0) - goto fail; - chars_decoded += PyUnicode_GET_SIZE(decoded); - Py_DECREF(decoded); - cookie.need_eof = 1; - - if (chars_decoded < chars_to_skip) { - PyErr_SetString(PyExc_IOError, - "can't reconstruct logical file position"); - goto fail; - } - } - - /* finally */ - Py_XDECREF(posobj); - res = PyObject_CallMethod(self->decoder, "setstate", "(O)", saved_state); - Py_DECREF(saved_state); - if (res == NULL) - return NULL; - Py_DECREF(res); - - /* The returned cookie corresponds to the last safe start point. */ - cookie.chars_to_skip = Py_SAFE_DOWNCAST(chars_to_skip, Py_ssize_t, int); - return textiowrapper_build_cookie(&cookie); - - fail: - Py_XDECREF(posobj); - if (saved_state) { - PyObject *type, *value, *traceback; - PyErr_Fetch(&type, &value, &traceback); - - res = PyObject_CallMethod(self->decoder, "setstate", "(O)", saved_state); - _PyErr_ReplaceException(type, value, traceback); - Py_DECREF(saved_state); - Py_XDECREF(res); - } - return NULL; -} - -static PyObject * -textiowrapper_truncate(textio *self, PyObject *args) -{ - PyObject *pos = Py_None; - PyObject *res; - - CHECK_ATTACHED(self) - if (!PyArg_ParseTuple(args, "|O:truncate", &pos)) { - return NULL; - } - - res = PyObject_CallMethodObjArgs((PyObject *) self, _PyIO_str_flush, NULL); - if (res == NULL) - return NULL; - Py_DECREF(res); - - return PyObject_CallMethodObjArgs(self->buffer, _PyIO_str_truncate, pos, NULL); -} - -static PyObject * -textiowrapper_repr(textio *self) -{ - PyObject *nameobj, *res; - PyObject *namerepr = NULL, *encrepr = NULL; - - CHECK_INITIALIZED(self); - - nameobj = PyObject_GetAttrString((PyObject *) self, "name"); - if (nameobj == NULL) { - if (PyErr_ExceptionMatches(PyExc_Exception)) - PyErr_Clear(); - else - goto error; - encrepr = PyObject_Repr(self->encoding); - res = PyString_FromFormat("<_io.TextIOWrapper encoding=%s>", - PyString_AS_STRING(encrepr)); - } - else { - encrepr = PyObject_Repr(self->encoding); - namerepr = PyObject_Repr(nameobj); - res = PyString_FromFormat("<_io.TextIOWrapper name=%s encoding=%s>", - PyString_AS_STRING(namerepr), - PyString_AS_STRING(encrepr)); - Py_DECREF(nameobj); - } - Py_XDECREF(namerepr); - Py_XDECREF(encrepr); - return res; - -error: - Py_XDECREF(namerepr); - Py_XDECREF(encrepr); - return NULL; -} - - -/* Inquiries */ - -static PyObject * -textiowrapper_fileno(textio *self, PyObject *args) -{ - CHECK_ATTACHED(self); - return PyObject_CallMethod(self->buffer, "fileno", NULL); -} - -static PyObject * -textiowrapper_seekable(textio *self, PyObject *args) -{ - CHECK_ATTACHED(self); - return PyObject_CallMethod(self->buffer, "seekable", NULL); -} - -static PyObject * -textiowrapper_readable(textio *self, PyObject *args) -{ - CHECK_ATTACHED(self); - return PyObject_CallMethod(self->buffer, "readable", NULL); -} - -static PyObject * -textiowrapper_writable(textio *self, PyObject *args) -{ - CHECK_ATTACHED(self); - return PyObject_CallMethod(self->buffer, "writable", NULL); -} - -static PyObject * -textiowrapper_isatty(textio *self, PyObject *args) -{ - CHECK_ATTACHED(self); - return PyObject_CallMethod(self->buffer, "isatty", NULL); -} - -static PyObject * -textiowrapper_flush(textio *self, PyObject *args) -{ - CHECK_ATTACHED(self); - CHECK_CLOSED(self); - self->telling = self->seekable; - if (_textiowrapper_writeflush(self) < 0) - return NULL; - return PyObject_CallMethod(self->buffer, "flush", NULL); -} - -static PyObject * -textiowrapper_close(textio *self, PyObject *args) -{ - PyObject *res; - int r; - CHECK_ATTACHED(self); - - res = textiowrapper_closed_get(self, NULL); - if (res == NULL) - return NULL; - r = PyObject_IsTrue(res); - Py_DECREF(res); - if (r < 0) - return NULL; - - if (r > 0) { - Py_RETURN_NONE; /* stream already closed */ - } - else { - PyObject *exc = NULL, *val, *tb; - res = PyObject_CallMethod((PyObject *)self, "flush", NULL); - if (res == NULL) - PyErr_Fetch(&exc, &val, &tb); - else - Py_DECREF(res); - - res = PyObject_CallMethod(self->buffer, "close", NULL); - if (exc != NULL) { - _PyErr_ReplaceException(exc, val, tb); - Py_CLEAR(res); - } - return res; - } -} - -static PyObject * -textiowrapper_iternext(textio *self) -{ - PyObject *line; - - CHECK_ATTACHED(self); - - self->telling = 0; - if (Py_TYPE(self) == &PyTextIOWrapper_Type) { - /* Skip method call overhead for speed */ - line = _textiowrapper_readline(self, -1); - } - else { - line = PyObject_CallMethodObjArgs((PyObject *)self, - _PyIO_str_readline, NULL); - if (line && !PyUnicode_Check(line)) { - PyErr_Format(PyExc_IOError, - "readline() should have returned an str object, " - "not '%.200s'", Py_TYPE(line)->tp_name); - Py_DECREF(line); - return NULL; - } - } - - if (line == NULL) - return NULL; - - if (PyUnicode_GET_SIZE(line) == 0) { - /* Reached EOF or would have blocked */ - Py_DECREF(line); - Py_CLEAR(self->snapshot); - self->telling = self->seekable; - return NULL; - } - - return line; -} - -static PyObject * -textiowrapper_name_get(textio *self, void *context) -{ - CHECK_ATTACHED(self); - return PyObject_GetAttrString(self->buffer, "name"); -} - -static PyObject * -textiowrapper_closed_get(textio *self, void *context) -{ - CHECK_ATTACHED(self); - return PyObject_GetAttr(self->buffer, _PyIO_str_closed); -} - -static PyObject * -textiowrapper_newlines_get(textio *self, void *context) -{ - PyObject *res; - CHECK_ATTACHED(self); - if (self->decoder == NULL) - Py_RETURN_NONE; - res = PyObject_GetAttr(self->decoder, _PyIO_str_newlines); - if (res == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - Py_RETURN_NONE; - } - else { - return NULL; - } - } - return res; -} - -static PyObject * -textiowrapper_errors_get(textio *self, void *context) -{ - CHECK_INITIALIZED(self); - Py_INCREF(self->errors); - return self->errors; -} - -static PyObject * -textiowrapper_chunk_size_get(textio *self, void *context) -{ - CHECK_ATTACHED(self); - return PyLong_FromSsize_t(self->chunk_size); -} - -static int -textiowrapper_chunk_size_set(textio *self, PyObject *arg, void *context) -{ - Py_ssize_t n; - CHECK_ATTACHED_INT(self); - n = PyNumber_AsSsize_t(arg, PyExc_TypeError); - if (n == -1 && PyErr_Occurred()) - return -1; - if (n <= 0) { - PyErr_SetString(PyExc_ValueError, - "a strictly positive integer is required"); - return -1; - } - self->chunk_size = n; - return 0; -} - -static PyMethodDef textiowrapper_methods[] = { - {"detach", (PyCFunction)textiowrapper_detach, METH_NOARGS}, - {"write", (PyCFunction)textiowrapper_write, METH_VARARGS}, - {"read", (PyCFunction)textiowrapper_read, METH_VARARGS}, - {"readline", (PyCFunction)textiowrapper_readline, METH_VARARGS}, - {"flush", (PyCFunction)textiowrapper_flush, METH_NOARGS}, - {"close", (PyCFunction)textiowrapper_close, METH_NOARGS}, - - {"fileno", (PyCFunction)textiowrapper_fileno, METH_NOARGS}, - {"seekable", (PyCFunction)textiowrapper_seekable, METH_NOARGS}, - {"readable", (PyCFunction)textiowrapper_readable, METH_NOARGS}, - {"writable", (PyCFunction)textiowrapper_writable, METH_NOARGS}, - {"isatty", (PyCFunction)textiowrapper_isatty, METH_NOARGS}, - - {"seek", (PyCFunction)textiowrapper_seek, METH_VARARGS}, - {"tell", (PyCFunction)textiowrapper_tell, METH_NOARGS}, - {"truncate", (PyCFunction)textiowrapper_truncate, METH_VARARGS}, - {NULL, NULL} -}; - -static PyMemberDef textiowrapper_members[] = { - {"encoding", T_OBJECT, offsetof(textio, encoding), READONLY}, - {"buffer", T_OBJECT, offsetof(textio, buffer), READONLY}, - {"line_buffering", T_BOOL, offsetof(textio, line_buffering), READONLY}, - {NULL} -}; - -static PyGetSetDef textiowrapper_getset[] = { - {"name", (getter)textiowrapper_name_get, NULL, NULL}, - {"closed", (getter)textiowrapper_closed_get, NULL, NULL}, -/* {"mode", (getter)TextIOWrapper_mode_get, NULL, NULL}, -*/ - {"newlines", (getter)textiowrapper_newlines_get, NULL, NULL}, - {"errors", (getter)textiowrapper_errors_get, NULL, NULL}, - {"_CHUNK_SIZE", (getter)textiowrapper_chunk_size_get, - (setter)textiowrapper_chunk_size_set, NULL}, - {NULL} -}; - -PyTypeObject PyTextIOWrapper_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_io.TextIOWrapper", /*tp_name*/ - sizeof(textio), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)textiowrapper_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tps_etattr*/ - 0, /*tp_compare */ - (reprfunc)textiowrapper_repr,/*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE - | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - textiowrapper_doc, /* tp_doc */ - (traverseproc)textiowrapper_traverse, /* tp_traverse */ - (inquiry)textiowrapper_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(textio, weakreflist), /*tp_weaklistoffset*/ - 0, /* tp_iter */ - (iternextfunc)textiowrapper_iternext, /* tp_iternext */ - textiowrapper_methods, /* tp_methods */ - textiowrapper_members, /* tp_members */ - textiowrapper_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(textio, dict), /*tp_dictoffset*/ - (initproc)textiowrapper_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_json.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_json.c deleted file mode 100644 index b6fee68..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_json.c +++ /dev/null @@ -1,2409 +0,0 @@ -#include "Python.h" -#include "structmember.h" -#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TYPE) -#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) -#endif -#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN) -typedef int Py_ssize_t; -#define PY_SSIZE_T_MAX INT_MAX -#define PY_SSIZE_T_MIN INT_MIN -#define PyInt_FromSsize_t PyInt_FromLong -#define PyInt_AsSsize_t PyInt_AsLong -#endif -#ifndef Py_IS_FINITE -#define Py_IS_FINITE(X) (!Py_IS_INFINITY(X) && !Py_IS_NAN(X)) -#endif - -#ifdef __GNUC__ -#define UNUSED __attribute__((__unused__)) -#else -#define UNUSED -#endif - -#define DEFAULT_ENCODING "utf-8" - -#define PyScanner_Check(op) PyObject_TypeCheck(op, &PyScannerType) -#define PyScanner_CheckExact(op) (Py_TYPE(op) == &PyScannerType) -#define PyEncoder_Check(op) PyObject_TypeCheck(op, &PyEncoderType) -#define PyEncoder_CheckExact(op) (Py_TYPE(op) == &PyEncoderType) - -static PyTypeObject PyScannerType; -static PyTypeObject PyEncoderType; - -typedef struct _PyScannerObject { - PyObject_HEAD - PyObject *encoding; - PyObject *strict; - PyObject *object_hook; - PyObject *pairs_hook; - PyObject *parse_float; - PyObject *parse_int; - PyObject *parse_constant; -} PyScannerObject; - -static PyMemberDef scanner_members[] = { - {"encoding", T_OBJECT, offsetof(PyScannerObject, encoding), READONLY, "encoding"}, - {"strict", T_OBJECT, offsetof(PyScannerObject, strict), READONLY, "strict"}, - {"object_hook", T_OBJECT, offsetof(PyScannerObject, object_hook), READONLY, "object_hook"}, - {"object_pairs_hook", T_OBJECT, offsetof(PyScannerObject, pairs_hook), READONLY, "object_pairs_hook"}, - {"parse_float", T_OBJECT, offsetof(PyScannerObject, parse_float), READONLY, "parse_float"}, - {"parse_int", T_OBJECT, offsetof(PyScannerObject, parse_int), READONLY, "parse_int"}, - {"parse_constant", T_OBJECT, offsetof(PyScannerObject, parse_constant), READONLY, "parse_constant"}, - {NULL} -}; - -typedef struct _PyEncoderObject { - PyObject_HEAD - PyObject *markers; - PyObject *defaultfn; - PyObject *encoder; - PyObject *indent; - PyObject *key_separator; - PyObject *item_separator; - PyObject *sort_keys; - PyObject *skipkeys; - int fast_encode; - int allow_nan; -} PyEncoderObject; - -static PyMemberDef encoder_members[] = { - {"markers", T_OBJECT, offsetof(PyEncoderObject, markers), READONLY, "markers"}, - {"default", T_OBJECT, offsetof(PyEncoderObject, defaultfn), READONLY, "default"}, - {"encoder", T_OBJECT, offsetof(PyEncoderObject, encoder), READONLY, "encoder"}, - {"indent", T_OBJECT, offsetof(PyEncoderObject, indent), READONLY, "indent"}, - {"key_separator", T_OBJECT, offsetof(PyEncoderObject, key_separator), READONLY, "key_separator"}, - {"item_separator", T_OBJECT, offsetof(PyEncoderObject, item_separator), READONLY, "item_separator"}, - {"sort_keys", T_OBJECT, offsetof(PyEncoderObject, sort_keys), READONLY, "sort_keys"}, - {"skipkeys", T_OBJECT, offsetof(PyEncoderObject, skipkeys), READONLY, "skipkeys"}, - {NULL} -}; - -static Py_ssize_t -ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars); -static PyObject * -ascii_escape_unicode(PyObject *pystr); -static PyObject * -ascii_escape_str(PyObject *pystr); -static PyObject * -py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr); -void init_json(void); -static PyObject * -scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr); -static PyObject * -scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr); -static PyObject * -_build_rval_index_tuple(PyObject *rval, Py_ssize_t idx); -static PyObject * -scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds); -static int -scanner_init(PyObject *self, PyObject *args, PyObject *kwds); -static void -scanner_dealloc(PyObject *self); -static int -scanner_clear(PyObject *self); -static PyObject * -encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds); -static int -encoder_init(PyObject *self, PyObject *args, PyObject *kwds); -static void -encoder_dealloc(PyObject *self); -static int -encoder_clear(PyObject *self); -static int -encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level); -static int -encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level); -static int -encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level); -static PyObject * -_encoded_const(PyObject *obj); -static void -raise_errmsg(char *msg, PyObject *s, Py_ssize_t end); -static PyObject * -encoder_encode_string(PyEncoderObject *s, PyObject *obj); -static int -_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr); -static PyObject * -_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr); -static PyObject * -encoder_encode_float(PyEncoderObject *s, PyObject *obj); - -#define S_CHAR(c) (c >= ' ' && c <= '~' && c != '\\' && c != '"') -#define IS_WHITESPACE(c) (((c) == ' ') || ((c) == '\t') || ((c) == '\n') || ((c) == '\r')) - -#define MIN_EXPANSION 6 -#ifdef Py_UNICODE_WIDE -#define MAX_EXPANSION (2 * MIN_EXPANSION) -#else -#define MAX_EXPANSION MIN_EXPANSION -#endif - -static int -_convertPyInt_AsSsize_t(PyObject *o, Py_ssize_t *size_ptr) -{ - /* PyObject to Py_ssize_t converter */ - *size_ptr = PyInt_AsSsize_t(o); - if (*size_ptr == -1 && PyErr_Occurred()) - return 0; - return 1; -} - -static PyObject * -_convertPyInt_FromSsize_t(Py_ssize_t *size_ptr) -{ - /* Py_ssize_t to PyObject converter */ - return PyInt_FromSsize_t(*size_ptr); -} - -static Py_ssize_t -ascii_escape_char(Py_UNICODE c, char *output, Py_ssize_t chars) -{ - /* Escape unicode code point c to ASCII escape sequences - in char *output. output must have at least 12 bytes unused to - accommodate an escaped surrogate pair "\uXXXX\uXXXX" */ - output[chars++] = '\\'; - switch (c) { - case '\\': output[chars++] = (char)c; break; - case '"': output[chars++] = (char)c; break; - case '\b': output[chars++] = 'b'; break; - case '\f': output[chars++] = 'f'; break; - case '\n': output[chars++] = 'n'; break; - case '\r': output[chars++] = 'r'; break; - case '\t': output[chars++] = 't'; break; - default: -#ifdef Py_UNICODE_WIDE - if (c >= 0x10000) { - /* UTF-16 surrogate pair */ - Py_UNICODE v = c - 0x10000; - c = 0xd800 | ((v >> 10) & 0x3ff); - output[chars++] = 'u'; - output[chars++] = "0123456789abcdef"[(c >> 12) & 0xf]; - output[chars++] = "0123456789abcdef"[(c >> 8) & 0xf]; - output[chars++] = "0123456789abcdef"[(c >> 4) & 0xf]; - output[chars++] = "0123456789abcdef"[(c ) & 0xf]; - c = 0xdc00 | (v & 0x3ff); - output[chars++] = '\\'; - } -#endif - output[chars++] = 'u'; - output[chars++] = "0123456789abcdef"[(c >> 12) & 0xf]; - output[chars++] = "0123456789abcdef"[(c >> 8) & 0xf]; - output[chars++] = "0123456789abcdef"[(c >> 4) & 0xf]; - output[chars++] = "0123456789abcdef"[(c ) & 0xf]; - } - return chars; -} - -static PyObject * -ascii_escape_unicode(PyObject *pystr) -{ - /* Take a PyUnicode pystr and return a new ASCII-only escaped PyString */ - Py_ssize_t i; - Py_ssize_t input_chars; - Py_ssize_t output_size; - Py_ssize_t max_output_size; - Py_ssize_t chars; - PyObject *rval; - char *output; - Py_UNICODE *input_unicode; - - input_chars = PyUnicode_GET_SIZE(pystr); - input_unicode = PyUnicode_AS_UNICODE(pystr); - - /* One char input can be up to 6 chars output, estimate 4 of these */ - output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - max_output_size = 2 + (input_chars * MAX_EXPANSION); - rval = PyString_FromStringAndSize(NULL, output_size); - if (rval == NULL) { - return NULL; - } - output = PyString_AS_STRING(rval); - chars = 0; - output[chars++] = '"'; - for (i = 0; i < input_chars; i++) { - Py_UNICODE c = input_unicode[i]; - if (S_CHAR(c)) { - output[chars++] = (char)c; - } - else { - chars = ascii_escape_char(c, output, chars); - } - if (output_size - chars < (1 + MAX_EXPANSION)) { - /* There's more than four, so let's resize by a lot */ - Py_ssize_t new_output_size = output_size * 2; - /* This is an upper bound */ - if (new_output_size > max_output_size) { - new_output_size = max_output_size; - } - /* Make sure that the output size changed before resizing */ - if (new_output_size != output_size) { - output_size = new_output_size; - if (_PyString_Resize(&rval, output_size) == -1) { - return NULL; - } - output = PyString_AS_STRING(rval); - } - } - } - output[chars++] = '"'; - if (_PyString_Resize(&rval, chars) == -1) { - return NULL; - } - return rval; -} - -static PyObject * -ascii_escape_str(PyObject *pystr) -{ - /* Take a PyString pystr and return a new ASCII-only escaped PyString */ - Py_ssize_t i; - Py_ssize_t input_chars; - Py_ssize_t output_size; - Py_ssize_t chars; - PyObject *rval; - char *output; - char *input_str; - - input_chars = PyString_GET_SIZE(pystr); - input_str = PyString_AS_STRING(pystr); - - /* Fast path for a string that's already ASCII */ - for (i = 0; i < input_chars; i++) { - Py_UNICODE c = (Py_UNICODE)(unsigned char)input_str[i]; - if (!S_CHAR(c)) { - /* If we have to escape something, scan the string for unicode */ - Py_ssize_t j; - for (j = i; j < input_chars; j++) { - c = (Py_UNICODE)(unsigned char)input_str[j]; - if (c > 0x7f) { - /* We hit a non-ASCII character, bail to unicode mode */ - PyObject *uni; - uni = PyUnicode_DecodeUTF8(input_str, input_chars, "strict"); - if (uni == NULL) { - return NULL; - } - rval = ascii_escape_unicode(uni); - Py_DECREF(uni); - return rval; - } - } - break; - } - } - - if (i == input_chars) { - /* Input is already ASCII */ - output_size = 2 + input_chars; - } - else { - /* One char input can be up to 6 chars output, estimate 4 of these */ - output_size = 2 + (MIN_EXPANSION * 4) + input_chars; - } - rval = PyString_FromStringAndSize(NULL, output_size); - if (rval == NULL) { - return NULL; - } - output = PyString_AS_STRING(rval); - output[0] = '"'; - - /* We know that everything up to i is ASCII already */ - chars = i + 1; - memcpy(&output[1], input_str, i); - - for (; i < input_chars; i++) { - Py_UNICODE c = (Py_UNICODE)(unsigned char)input_str[i]; - if (S_CHAR(c)) { - output[chars++] = (char)c; - } - else { - chars = ascii_escape_char(c, output, chars); - } - /* An ASCII char can't possibly expand to a surrogate! */ - if (output_size - chars < (1 + MIN_EXPANSION)) { - /* There's more than four, so let's resize by a lot */ - output_size *= 2; - if (output_size > 2 + (input_chars * MIN_EXPANSION)) { - output_size = 2 + (input_chars * MIN_EXPANSION); - } - if (_PyString_Resize(&rval, output_size) == -1) { - return NULL; - } - output = PyString_AS_STRING(rval); - } - } - output[chars++] = '"'; - if (_PyString_Resize(&rval, chars) == -1) { - return NULL; - } - return rval; -} - -static void -raise_errmsg(char *msg, PyObject *s, Py_ssize_t end) -{ - /* Use the Python function json.decoder.errmsg to raise a nice - looking ValueError exception */ - static PyObject *errmsg_fn = NULL; - PyObject *pymsg; - if (errmsg_fn == NULL) { - PyObject *decoder = PyImport_ImportModule("json.decoder"); - if (decoder == NULL) - return; - errmsg_fn = PyObject_GetAttrString(decoder, "errmsg"); - Py_DECREF(decoder); - if (errmsg_fn == NULL) - return; - } - pymsg = PyObject_CallFunction(errmsg_fn, "(zOO&)", msg, s, _convertPyInt_FromSsize_t, &end); - if (pymsg) { - PyErr_SetObject(PyExc_ValueError, pymsg); - Py_DECREF(pymsg); - } -} - -static PyObject * -join_list_unicode(PyObject *lst) -{ - /* return u''.join(lst) */ - static PyObject *joinfn = NULL; - if (joinfn == NULL) { - PyObject *ustr = PyUnicode_FromUnicode(NULL, 0); - if (ustr == NULL) - return NULL; - - joinfn = PyObject_GetAttrString(ustr, "join"); - Py_DECREF(ustr); - if (joinfn == NULL) - return NULL; - } - return PyObject_CallFunctionObjArgs(joinfn, lst, NULL); -} - -static PyObject * -_build_rval_index_tuple(PyObject *rval, Py_ssize_t idx) { - /* return (rval, idx) tuple, stealing reference to rval */ - PyObject *tpl; - PyObject *pyidx; - /* - steal a reference to rval, returns (rval, idx) - */ - if (rval == NULL) { - return NULL; - } - pyidx = PyInt_FromSsize_t(idx); - if (pyidx == NULL) { - Py_DECREF(rval); - return NULL; - } - tpl = PyTuple_New(2); - if (tpl == NULL) { - Py_DECREF(pyidx); - Py_DECREF(rval); - return NULL; - } - PyTuple_SET_ITEM(tpl, 0, rval); - PyTuple_SET_ITEM(tpl, 1, pyidx); - return tpl; -} - -static PyObject * -scanstring_str(PyObject *pystr, Py_ssize_t end, char *encoding, int strict, Py_ssize_t *next_end_ptr) -{ - /* Read the JSON string from PyString pystr. - end is the index of the first character after the quote. - encoding is the encoding of pystr (must be an ASCII superset) - if strict is zero then literal control characters are allowed - *next_end_ptr is a return-by-reference index of the character - after the end quote - - Return value is a new PyString (if ASCII-only) or PyUnicode - */ - PyObject *rval; - Py_ssize_t len = PyString_GET_SIZE(pystr); - Py_ssize_t begin = end - 1; - Py_ssize_t next; - char *buf = PyString_AS_STRING(pystr); - PyObject *chunks = PyList_New(0); - if (chunks == NULL) { - goto bail; - } - if (end < 0 || len <= end) { - PyErr_SetString(PyExc_ValueError, "end is out of bounds"); - goto bail; - } - while (1) { - /* Find the end of the string or the next escape */ - Py_UNICODE c = 0; - PyObject *chunk = NULL; - for (next = end; next < len; next++) { - c = (unsigned char)buf[next]; - if (c == '"' || c == '\\') { - break; - } - else if (strict && c <= 0x1f) { - raise_errmsg("Invalid control character at", pystr, next); - goto bail; - } - } - if (!(c == '"' || c == '\\')) { - raise_errmsg("Unterminated string starting at", pystr, begin); - goto bail; - } - /* Pick up this chunk if it's not zero length */ - if (next != end) { - PyObject *strchunk = PyString_FromStringAndSize(&buf[end], next - end); - if (strchunk == NULL) { - goto bail; - } - chunk = PyUnicode_FromEncodedObject(strchunk, encoding, NULL); - Py_DECREF(strchunk); - if (chunk == NULL) { - goto bail; - } - if (PyList_Append(chunks, chunk)) { - Py_DECREF(chunk); - goto bail; - } - Py_DECREF(chunk); - } - next++; - if (c == '"') { - end = next; - break; - } - if (next == len) { - raise_errmsg("Unterminated string starting at", pystr, begin); - goto bail; - } - c = buf[next]; - if (c != 'u') { - /* Non-unicode backslash escapes */ - end = next + 1; - switch (c) { - case '"': break; - case '\\': break; - case '/': break; - case 'b': c = '\b'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - default: c = 0; - } - if (c == 0) { - raise_errmsg("Invalid \\escape", pystr, end - 2); - goto bail; - } - } - else { - c = 0; - next++; - end = next + 4; - if (end >= len) { - raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1); - goto bail; - } - /* Decode 4 hex digits */ - for (; next < end; next++) { - Py_UNICODE digit = buf[next]; - c <<= 4; - switch (digit) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - c |= (digit - '0'); break; - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': - c |= (digit - 'a' + 10); break; - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': - c |= (digit - 'A' + 10); break; - default: - raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); - goto bail; - } - } -#ifdef Py_UNICODE_WIDE - /* Surrogate pair */ - if ((c & 0xfc00) == 0xd800 && end + 6 < len && - buf[next++] == '\\' && - buf[next++] == 'u') { - Py_UNICODE c2 = 0; - end += 6; - /* Decode 4 hex digits */ - for (; next < end; next++) { - Py_UNICODE digit = buf[next]; - c2 <<= 4; - switch (digit) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - c2 |= (digit - '0'); break; - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': - c2 |= (digit - 'a' + 10); break; - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': - c2 |= (digit - 'A' + 10); break; - default: - raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); - goto bail; - } - } - if ((c2 & 0xfc00) == 0xdc00) - c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00)); - else - end -= 6; - } -#endif - } - chunk = PyUnicode_FromUnicode(&c, 1); - if (chunk == NULL) { - goto bail; - } - if (PyList_Append(chunks, chunk)) { - Py_DECREF(chunk); - goto bail; - } - Py_DECREF(chunk); - } - - rval = join_list_unicode(chunks); - if (rval == NULL) { - goto bail; - } - Py_CLEAR(chunks); - *next_end_ptr = end; - return rval; -bail: - *next_end_ptr = -1; - Py_XDECREF(chunks); - return NULL; -} - - -static PyObject * -scanstring_unicode(PyObject *pystr, Py_ssize_t end, int strict, Py_ssize_t *next_end_ptr) -{ - /* Read the JSON string from PyUnicode pystr. - end is the index of the first character after the quote. - if strict is zero then literal control characters are allowed - *next_end_ptr is a return-by-reference index of the character - after the end quote - - Return value is a new PyUnicode - */ - PyObject *rval; - Py_ssize_t len = PyUnicode_GET_SIZE(pystr); - Py_ssize_t begin = end - 1; - Py_ssize_t next; - const Py_UNICODE *buf = PyUnicode_AS_UNICODE(pystr); - PyObject *chunks = PyList_New(0); - if (chunks == NULL) { - goto bail; - } - if (end < 0 || len <= end) { - PyErr_SetString(PyExc_ValueError, "end is out of bounds"); - goto bail; - } - while (1) { - /* Find the end of the string or the next escape */ - Py_UNICODE c = 0; - PyObject *chunk = NULL; - for (next = end; next < len; next++) { - c = buf[next]; - if (c == '"' || c == '\\') { - break; - } - else if (strict && c <= 0x1f) { - raise_errmsg("Invalid control character at", pystr, next); - goto bail; - } - } - if (!(c == '"' || c == '\\')) { - raise_errmsg("Unterminated string starting at", pystr, begin); - goto bail; - } - /* Pick up this chunk if it's not zero length */ - if (next != end) { - chunk = PyUnicode_FromUnicode(&buf[end], next - end); - if (chunk == NULL) { - goto bail; - } - if (PyList_Append(chunks, chunk)) { - Py_DECREF(chunk); - goto bail; - } - Py_DECREF(chunk); - } - next++; - if (c == '"') { - end = next; - break; - } - if (next == len) { - raise_errmsg("Unterminated string starting at", pystr, begin); - goto bail; - } - c = buf[next]; - if (c != 'u') { - /* Non-unicode backslash escapes */ - end = next + 1; - switch (c) { - case '"': break; - case '\\': break; - case '/': break; - case 'b': c = '\b'; break; - case 'f': c = '\f'; break; - case 'n': c = '\n'; break; - case 'r': c = '\r'; break; - case 't': c = '\t'; break; - default: c = 0; - } - if (c == 0) { - raise_errmsg("Invalid \\escape", pystr, end - 2); - goto bail; - } - } - else { - c = 0; - next++; - end = next + 4; - if (end >= len) { - raise_errmsg("Invalid \\uXXXX escape", pystr, next - 1); - goto bail; - } - /* Decode 4 hex digits */ - for (; next < end; next++) { - Py_UNICODE digit = buf[next]; - c <<= 4; - switch (digit) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - c |= (digit - '0'); break; - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': - c |= (digit - 'a' + 10); break; - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': - c |= (digit - 'A' + 10); break; - default: - raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); - goto bail; - } - } -#ifdef Py_UNICODE_WIDE - /* Surrogate pair */ - if ((c & 0xfc00) == 0xd800 && end + 6 < len && - buf[next++] == '\\' && buf[next++] == 'u') { - Py_UNICODE c2 = 0; - end += 6; - /* Decode 4 hex digits */ - for (; next < end; next++) { - Py_UNICODE digit = buf[next]; - c2 <<= 4; - switch (digit) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - c2 |= (digit - '0'); break; - case 'a': case 'b': case 'c': case 'd': case 'e': - case 'f': - c2 |= (digit - 'a' + 10); break; - case 'A': case 'B': case 'C': case 'D': case 'E': - case 'F': - c2 |= (digit - 'A' + 10); break; - default: - raise_errmsg("Invalid \\uXXXX escape", pystr, end - 5); - goto bail; - } - } - if ((c2 & 0xfc00) == 0xdc00) - c = 0x10000 + (((c - 0xd800) << 10) | (c2 - 0xdc00)); - else - end -= 6; - } -#endif - } - chunk = PyUnicode_FromUnicode(&c, 1); - if (chunk == NULL) { - goto bail; - } - if (PyList_Append(chunks, chunk)) { - Py_DECREF(chunk); - goto bail; - } - Py_DECREF(chunk); - } - - rval = join_list_unicode(chunks); - if (rval == NULL) { - goto bail; - } - Py_DECREF(chunks); - *next_end_ptr = end; - return rval; -bail: - *next_end_ptr = -1; - Py_XDECREF(chunks); - return NULL; -} - -PyDoc_STRVAR(pydoc_scanstring, - "scanstring(basestring, end, encoding, strict=True) -> (str, end)\n" - "\n" - "Scan the string s for a JSON string. End is the index of the\n" - "character in s after the quote that started the JSON string.\n" - "Unescapes all valid JSON string escape sequences and raises ValueError\n" - "on attempt to decode an invalid string. If strict is False then literal\n" - "control characters are allowed in the string.\n" - "\n" - "Returns a tuple of the decoded string and the index of the character in s\n" - "after the end quote." -); - -static PyObject * -py_scanstring(PyObject* self UNUSED, PyObject *args) -{ - PyObject *pystr; - PyObject *rval; - Py_ssize_t end; - Py_ssize_t next_end = -1; - char *encoding = NULL; - int strict = 1; - if (!PyArg_ParseTuple(args, "OO&|zi:scanstring", &pystr, _convertPyInt_AsSsize_t, &end, &encoding, &strict)) { - return NULL; - } - if (encoding == NULL) { - encoding = DEFAULT_ENCODING; - } - if (PyString_Check(pystr)) { - rval = scanstring_str(pystr, end, encoding, strict, &next_end); - } - else if (PyUnicode_Check(pystr)) { - rval = scanstring_unicode(pystr, end, strict, &next_end); - } - else { - PyErr_Format(PyExc_TypeError, - "first argument must be a string, not %.80s", - Py_TYPE(pystr)->tp_name); - return NULL; - } - return _build_rval_index_tuple(rval, next_end); -} - -PyDoc_STRVAR(pydoc_encode_basestring_ascii, - "encode_basestring_ascii(basestring) -> str\n" - "\n" - "Return an ASCII-only JSON representation of a Python string" -); - -static PyObject * -py_encode_basestring_ascii(PyObject* self UNUSED, PyObject *pystr) -{ - /* Return an ASCII-only JSON representation of a Python string */ - /* METH_O */ - if (PyString_Check(pystr)) { - return ascii_escape_str(pystr); - } - else if (PyUnicode_Check(pystr)) { - return ascii_escape_unicode(pystr); - } - else { - PyErr_Format(PyExc_TypeError, - "first argument must be a string, not %.80s", - Py_TYPE(pystr)->tp_name); - return NULL; - } -} - -static void -scanner_dealloc(PyObject *self) -{ - /* Deallocate scanner object */ - scanner_clear(self); - Py_TYPE(self)->tp_free(self); -} - -static int -scanner_traverse(PyObject *self, visitproc visit, void *arg) -{ - PyScannerObject *s; - assert(PyScanner_Check(self)); - s = (PyScannerObject *)self; - Py_VISIT(s->encoding); - Py_VISIT(s->strict); - Py_VISIT(s->object_hook); - Py_VISIT(s->pairs_hook); - Py_VISIT(s->parse_float); - Py_VISIT(s->parse_int); - Py_VISIT(s->parse_constant); - return 0; -} - -static int -scanner_clear(PyObject *self) -{ - PyScannerObject *s; - assert(PyScanner_Check(self)); - s = (PyScannerObject *)self; - Py_CLEAR(s->encoding); - Py_CLEAR(s->strict); - Py_CLEAR(s->object_hook); - Py_CLEAR(s->pairs_hook); - Py_CLEAR(s->parse_float); - Py_CLEAR(s->parse_int); - Py_CLEAR(s->parse_constant); - return 0; -} - -static PyObject * -_parse_object_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { - /* Read a JSON object from PyString pystr. - idx is the index of the first character after the opening curly brace. - *next_idx_ptr is a return-by-reference index to the first character after - the closing curly brace. - - Returns a new PyObject (usually a dict, but object_hook can change that) - */ - char *str = PyString_AS_STRING(pystr); - Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1; - PyObject *rval; - PyObject *pairs; - PyObject *item; - PyObject *key = NULL; - PyObject *val = NULL; - char *encoding = PyString_AS_STRING(s->encoding); - int strict = PyObject_IsTrue(s->strict); - Py_ssize_t next_idx; - - pairs = PyList_New(0); - if (pairs == NULL) - return NULL; - - /* skip whitespace after { */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* only loop if the object is non-empty */ - if (idx <= end_idx && str[idx] != '}') { - while (idx <= end_idx) { - /* read key */ - if (str[idx] != '"') { - raise_errmsg("Expecting property name", pystr, idx); - goto bail; - } - key = scanstring_str(pystr, idx + 1, encoding, strict, &next_idx); - if (key == NULL) - goto bail; - idx = next_idx; - - /* skip whitespace between key and : delimiter, read :, skip whitespace */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - if (idx > end_idx || str[idx] != ':') { - raise_errmsg("Expecting : delimiter", pystr, idx); - goto bail; - } - idx++; - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* read any JSON data type */ - val = scan_once_str(s, pystr, idx, &next_idx); - if (val == NULL) - goto bail; - - item = PyTuple_Pack(2, key, val); - if (item == NULL) - goto bail; - Py_CLEAR(key); - Py_CLEAR(val); - if (PyList_Append(pairs, item) == -1) { - Py_DECREF(item); - goto bail; - } - Py_DECREF(item); - idx = next_idx; - - /* skip whitespace before } or , */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* bail if the object is closed or we didn't get the , delimiter */ - if (idx > end_idx) break; - if (str[idx] == '}') { - break; - } - else if (str[idx] != ',') { - raise_errmsg("Expecting , delimiter", pystr, idx); - goto bail; - } - idx++; - - /* skip whitespace after , delimiter */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - } - } - /* verify that idx < end_idx, str[idx] should be '}' */ - if (idx > end_idx || str[idx] != '}') { - raise_errmsg("Expecting object", pystr, end_idx); - goto bail; - } - - /* if pairs_hook is not None: rval = object_pairs_hook(pairs) */ - if (s->pairs_hook != Py_None) { - val = PyObject_CallFunctionObjArgs(s->pairs_hook, pairs, NULL); - if (val == NULL) - goto bail; - Py_DECREF(pairs); - *next_idx_ptr = idx + 1; - return val; - } - - rval = PyObject_CallFunctionObjArgs((PyObject *)(&PyDict_Type), - pairs, NULL); - if (rval == NULL) - goto bail; - Py_CLEAR(pairs); - - /* if object_hook is not None: rval = object_hook(rval) */ - if (s->object_hook != Py_None) { - val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL); - if (val == NULL) - goto bail; - Py_DECREF(rval); - rval = val; - val = NULL; - } - *next_idx_ptr = idx + 1; - return rval; -bail: - Py_XDECREF(key); - Py_XDECREF(val); - Py_XDECREF(pairs); - return NULL; -} - -static PyObject * -_parse_object_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { - /* Read a JSON object from PyUnicode pystr. - idx is the index of the first character after the opening curly brace. - *next_idx_ptr is a return-by-reference index to the first character after - the closing curly brace. - - Returns a new PyObject (usually a dict, but object_hook can change that) - */ - Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); - Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1; - PyObject *rval; - PyObject *pairs; - PyObject *item; - PyObject *key = NULL; - PyObject *val = NULL; - int strict = PyObject_IsTrue(s->strict); - Py_ssize_t next_idx; - - pairs = PyList_New(0); - if (pairs == NULL) - return NULL; - - /* skip whitespace after { */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* only loop if the object is non-empty */ - if (idx <= end_idx && str[idx] != '}') { - while (idx <= end_idx) { - /* read key */ - if (str[idx] != '"') { - raise_errmsg("Expecting property name enclosed in double quotes", pystr, idx); - goto bail; - } - key = scanstring_unicode(pystr, idx + 1, strict, &next_idx); - if (key == NULL) - goto bail; - idx = next_idx; - - /* skip whitespace between key and : delimiter, read :, skip whitespace */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - if (idx > end_idx || str[idx] != ':') { - raise_errmsg("Expecting ':' delimiter", pystr, idx); - goto bail; - } - idx++; - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* read any JSON term */ - val = scan_once_unicode(s, pystr, idx, &next_idx); - if (val == NULL) - goto bail; - - item = PyTuple_Pack(2, key, val); - if (item == NULL) - goto bail; - Py_CLEAR(key); - Py_CLEAR(val); - if (PyList_Append(pairs, item) == -1) { - Py_DECREF(item); - goto bail; - } - Py_DECREF(item); - idx = next_idx; - - /* skip whitespace before } or , */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* bail if the object is closed or we didn't get the , delimiter */ - if (idx > end_idx) break; - if (str[idx] == '}') { - break; - } - else if (str[idx] != ',') { - raise_errmsg("Expecting ',' delimiter", pystr, idx); - goto bail; - } - idx++; - - /* skip whitespace after , delimiter */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - } - } - - /* verify that idx < end_idx, str[idx] should be '}' */ - if (idx > end_idx || str[idx] != '}') { - raise_errmsg("Expecting object", pystr, end_idx); - goto bail; - } - - /* if pairs_hook is not None: rval = object_pairs_hook(pairs) */ - if (s->pairs_hook != Py_None) { - val = PyObject_CallFunctionObjArgs(s->pairs_hook, pairs, NULL); - if (val == NULL) - goto bail; - Py_DECREF(pairs); - *next_idx_ptr = idx + 1; - return val; - } - - rval = PyObject_CallFunctionObjArgs((PyObject *)(&PyDict_Type), - pairs, NULL); - if (rval == NULL) - goto bail; - Py_CLEAR(pairs); - - /* if object_hook is not None: rval = object_hook(rval) */ - if (s->object_hook != Py_None) { - val = PyObject_CallFunctionObjArgs(s->object_hook, rval, NULL); - if (val == NULL) - goto bail; - Py_DECREF(rval); - rval = val; - val = NULL; - } - *next_idx_ptr = idx + 1; - return rval; -bail: - Py_XDECREF(key); - Py_XDECREF(val); - Py_XDECREF(pairs); - return NULL; -} - -static PyObject * -_parse_array_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { - /* Read a JSON array from PyString pystr. - idx is the index of the first character after the opening brace. - *next_idx_ptr is a return-by-reference index to the first character after - the closing brace. - - Returns a new PyList - */ - char *str = PyString_AS_STRING(pystr); - Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1; - PyObject *val = NULL; - PyObject *rval = PyList_New(0); - Py_ssize_t next_idx; - if (rval == NULL) - return NULL; - - /* skip whitespace after [ */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* only loop if the array is non-empty */ - if (idx <= end_idx && str[idx] != ']') { - while (idx <= end_idx) { - - /* read any JSON term and de-tuplefy the (rval, idx) */ - val = scan_once_str(s, pystr, idx, &next_idx); - if (val == NULL) - goto bail; - - if (PyList_Append(rval, val) == -1) - goto bail; - - Py_CLEAR(val); - idx = next_idx; - - /* skip whitespace between term and , */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* bail if the array is closed or we didn't get the , delimiter */ - if (idx > end_idx) break; - if (str[idx] == ']') { - break; - } - else if (str[idx] != ',') { - raise_errmsg("Expecting , delimiter", pystr, idx); - goto bail; - } - idx++; - - /* skip whitespace after , */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - } - } - - /* verify that idx < end_idx, str[idx] should be ']' */ - if (idx > end_idx || str[idx] != ']') { - raise_errmsg("Expecting object", pystr, end_idx); - goto bail; - } - *next_idx_ptr = idx + 1; - return rval; -bail: - Py_XDECREF(val); - Py_DECREF(rval); - return NULL; -} - -static PyObject * -_parse_array_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { - /* Read a JSON array from PyString pystr. - idx is the index of the first character after the opening brace. - *next_idx_ptr is a return-by-reference index to the first character after - the closing brace. - - Returns a new PyList - */ - Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); - Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1; - PyObject *val = NULL; - PyObject *rval = PyList_New(0); - Py_ssize_t next_idx; - if (rval == NULL) - return NULL; - - /* skip whitespace after [ */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* only loop if the array is non-empty */ - if (idx <= end_idx && str[idx] != ']') { - while (idx <= end_idx) { - - /* read any JSON term */ - val = scan_once_unicode(s, pystr, idx, &next_idx); - if (val == NULL) - goto bail; - - if (PyList_Append(rval, val) == -1) - goto bail; - - Py_CLEAR(val); - idx = next_idx; - - /* skip whitespace between term and , */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - - /* bail if the array is closed or we didn't get the , delimiter */ - if (idx > end_idx) break; - if (str[idx] == ']') { - break; - } - else if (str[idx] != ',') { - raise_errmsg("Expecting ',' delimiter", pystr, idx); - goto bail; - } - idx++; - - /* skip whitespace after , */ - while (idx <= end_idx && IS_WHITESPACE(str[idx])) idx++; - } - } - - /* verify that idx < end_idx, str[idx] should be ']' */ - if (idx > end_idx || str[idx] != ']') { - raise_errmsg("Expecting object", pystr, end_idx); - goto bail; - } - *next_idx_ptr = idx + 1; - return rval; -bail: - Py_XDECREF(val); - Py_DECREF(rval); - return NULL; -} - -static PyObject * -_parse_constant(PyScannerObject *s, char *constant, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) { - /* Read a JSON constant from PyString pystr. - constant is the constant string that was found - ("NaN", "Infinity", "-Infinity"). - idx is the index of the first character of the constant - *next_idx_ptr is a return-by-reference index to the first character after - the constant. - - Returns the result of parse_constant - */ - PyObject *cstr; - PyObject *rval; - /* constant is "NaN", "Infinity", or "-Infinity" */ - cstr = PyString_InternFromString(constant); - if (cstr == NULL) - return NULL; - - /* rval = parse_constant(constant) */ - rval = PyObject_CallFunctionObjArgs(s->parse_constant, cstr, NULL); - idx += PyString_GET_SIZE(cstr); - Py_DECREF(cstr); - *next_idx_ptr = idx; - return rval; -} - -static PyObject * -_match_number_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) { - /* Read a JSON number from PyString pystr. - idx is the index of the first character of the number - *next_idx_ptr is a return-by-reference index to the first character after - the number. - - Returns a new PyObject representation of that number: - PyInt, PyLong, or PyFloat. - May return other types if parse_int or parse_float are set - */ - char *str = PyString_AS_STRING(pystr); - Py_ssize_t end_idx = PyString_GET_SIZE(pystr) - 1; - Py_ssize_t idx = start; - int is_float = 0; - PyObject *rval; - PyObject *numstr; - - /* read a sign if it's there, make sure it's not the end of the string */ - if (str[idx] == '-') { - idx++; - if (idx > end_idx) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - } - - /* read as many integer digits as we find as long as it doesn't start with 0 */ - if (str[idx] >= '1' && str[idx] <= '9') { - idx++; - while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; - } - /* if it starts with 0 we only expect one integer digit */ - else if (str[idx] == '0') { - idx++; - } - /* no integer digits, error */ - else { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - - /* if the next char is '.' followed by a digit then read all float digits */ - if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') { - is_float = 1; - idx += 2; - while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; - } - - /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */ - if (idx < end_idx && (str[idx] == 'e' || str[idx] == 'E')) { - - /* save the index of the 'e' or 'E' just in case we need to backtrack */ - Py_ssize_t e_start = idx; - idx++; - - /* read an exponent sign if present */ - if (idx < end_idx && (str[idx] == '-' || str[idx] == '+')) idx++; - - /* read all digits */ - while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; - - /* if we got a digit, then parse as float. if not, backtrack */ - if (str[idx - 1] >= '0' && str[idx - 1] <= '9') { - is_float = 1; - } - else { - idx = e_start; - } - } - - /* copy the section we determined to be a number */ - numstr = PyString_FromStringAndSize(&str[start], idx - start); - if (numstr == NULL) - return NULL; - if (is_float) { - /* parse as a float using a fast path if available, otherwise call user defined method */ - if (s->parse_float != (PyObject *)&PyFloat_Type) { - rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL); - } - else { - double d = PyOS_string_to_double(PyString_AS_STRING(numstr), - NULL, NULL); - if (d == -1.0 && PyErr_Occurred()) - return NULL; - rval = PyFloat_FromDouble(d); - } - } - else { - /* parse as an int using a fast path if available, otherwise call user defined method */ - if (s->parse_int != (PyObject *)&PyInt_Type) { - rval = PyObject_CallFunctionObjArgs(s->parse_int, numstr, NULL); - } - else { - rval = PyInt_FromString(PyString_AS_STRING(numstr), NULL, 10); - } - } - Py_DECREF(numstr); - *next_idx_ptr = idx; - return rval; -} - -static PyObject * -_match_number_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t start, Py_ssize_t *next_idx_ptr) { - /* Read a JSON number from PyUnicode pystr. - idx is the index of the first character of the number - *next_idx_ptr is a return-by-reference index to the first character after - the number. - - Returns a new PyObject representation of that number: - PyInt, PyLong, or PyFloat. - May return other types if parse_int or parse_float are set - */ - Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); - Py_ssize_t end_idx = PyUnicode_GET_SIZE(pystr) - 1; - Py_ssize_t idx = start; - int is_float = 0; - PyObject *rval; - PyObject *numstr; - - /* read a sign if it's there, make sure it's not the end of the string */ - if (str[idx] == '-') { - idx++; - if (idx > end_idx) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - } - - /* read as many integer digits as we find as long as it doesn't start with 0 */ - if (str[idx] >= '1' && str[idx] <= '9') { - idx++; - while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; - } - /* if it starts with 0 we only expect one integer digit */ - else if (str[idx] == '0') { - idx++; - } - /* no integer digits, error */ - else { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - - /* if the next char is '.' followed by a digit then read all float digits */ - if (idx < end_idx && str[idx] == '.' && str[idx + 1] >= '0' && str[idx + 1] <= '9') { - is_float = 1; - idx += 2; - while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; - } - - /* if the next char is 'e' or 'E' then maybe read the exponent (or backtrack) */ - if (idx < end_idx && (str[idx] == 'e' || str[idx] == 'E')) { - Py_ssize_t e_start = idx; - idx++; - - /* read an exponent sign if present */ - if (idx < end_idx && (str[idx] == '-' || str[idx] == '+')) idx++; - - /* read all digits */ - while (idx <= end_idx && str[idx] >= '0' && str[idx] <= '9') idx++; - - /* if we got a digit, then parse as float. if not, backtrack */ - if (str[idx - 1] >= '0' && str[idx - 1] <= '9') { - is_float = 1; - } - else { - idx = e_start; - } - } - - /* copy the section we determined to be a number */ - numstr = PyUnicode_FromUnicode(&str[start], idx - start); - if (numstr == NULL) - return NULL; - if (is_float) { - /* parse as a float using a fast path if available, otherwise call user defined method */ - if (s->parse_float != (PyObject *)&PyFloat_Type) { - rval = PyObject_CallFunctionObjArgs(s->parse_float, numstr, NULL); - } - else { - rval = PyFloat_FromString(numstr, NULL); - } - } - else { - /* no fast path for unicode -> int, just call */ - rval = PyObject_CallFunctionObjArgs(s->parse_int, numstr, NULL); - } - Py_DECREF(numstr); - *next_idx_ptr = idx; - return rval; -} - -static PyObject * -scan_once_str(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) -{ - /* Read one JSON term (of any kind) from PyString pystr. - idx is the index of the first character of the term - *next_idx_ptr is a return-by-reference index to the first character after - the number. - - Returns a new PyObject representation of the term. - */ - PyObject *res; - char *str = PyString_AS_STRING(pystr); - Py_ssize_t length = PyString_GET_SIZE(pystr); - if (idx < 0) { - PyErr_SetString(PyExc_ValueError, "idx cannot be negative"); - return NULL; - } - if (idx >= length) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - switch (str[idx]) { - case '"': - /* string */ - return scanstring_str(pystr, idx + 1, - PyString_AS_STRING(s->encoding), - PyObject_IsTrue(s->strict), - next_idx_ptr); - case '{': - /* object */ - if (Py_EnterRecursiveCall(" while decoding a JSON object " - "from a byte string")) - return NULL; - res = _parse_object_str(s, pystr, idx + 1, next_idx_ptr); - Py_LeaveRecursiveCall(); - return res; - case '[': - /* array */ - if (Py_EnterRecursiveCall(" while decoding a JSON array " - "from a byte string")) - return NULL; - res = _parse_array_str(s, pystr, idx + 1, next_idx_ptr); - Py_LeaveRecursiveCall(); - return res; - case 'n': - /* null */ - if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') { - Py_INCREF(Py_None); - *next_idx_ptr = idx + 4; - return Py_None; - } - break; - case 't': - /* true */ - if ((idx + 3 < length) && str[idx + 1] == 'r' && str[idx + 2] == 'u' && str[idx + 3] == 'e') { - Py_INCREF(Py_True); - *next_idx_ptr = idx + 4; - return Py_True; - } - break; - case 'f': - /* false */ - if ((idx + 4 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'l' && str[idx + 3] == 's' && str[idx + 4] == 'e') { - Py_INCREF(Py_False); - *next_idx_ptr = idx + 5; - return Py_False; - } - break; - case 'N': - /* NaN */ - if ((idx + 2 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'N') { - return _parse_constant(s, "NaN", idx, next_idx_ptr); - } - break; - case 'I': - /* Infinity */ - if ((idx + 7 < length) && str[idx + 1] == 'n' && str[idx + 2] == 'f' && str[idx + 3] == 'i' && str[idx + 4] == 'n' && str[idx + 5] == 'i' && str[idx + 6] == 't' && str[idx + 7] == 'y') { - return _parse_constant(s, "Infinity", idx, next_idx_ptr); - } - break; - case '-': - /* -Infinity */ - if ((idx + 8 < length) && str[idx + 1] == 'I' && str[idx + 2] == 'n' && str[idx + 3] == 'f' && str[idx + 4] == 'i' && str[idx + 5] == 'n' && str[idx + 6] == 'i' && str[idx + 7] == 't' && str[idx + 8] == 'y') { - return _parse_constant(s, "-Infinity", idx, next_idx_ptr); - } - break; - } - /* Didn't find a string, object, array, or named constant. Look for a number. */ - return _match_number_str(s, pystr, idx, next_idx_ptr); -} - -static PyObject * -scan_once_unicode(PyScannerObject *s, PyObject *pystr, Py_ssize_t idx, Py_ssize_t *next_idx_ptr) -{ - /* Read one JSON term (of any kind) from PyUnicode pystr. - idx is the index of the first character of the term - *next_idx_ptr is a return-by-reference index to the first character after - the number. - - Returns a new PyObject representation of the term. - */ - PyObject *res; - Py_UNICODE *str = PyUnicode_AS_UNICODE(pystr); - Py_ssize_t length = PyUnicode_GET_SIZE(pystr); - if (idx < 0) { - PyErr_SetString(PyExc_ValueError, "idx cannot be negative"); - return NULL; - } - if (idx >= length) { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - switch (str[idx]) { - case '"': - /* string */ - return scanstring_unicode(pystr, idx + 1, - PyObject_IsTrue(s->strict), - next_idx_ptr); - case '{': - /* object */ - if (Py_EnterRecursiveCall(" while decoding a JSON object " - "from a unicode string")) - return NULL; - res = _parse_object_unicode(s, pystr, idx + 1, next_idx_ptr); - Py_LeaveRecursiveCall(); - return res; - case '[': - /* array */ - if (Py_EnterRecursiveCall(" while decoding a JSON array " - "from a unicode string")) - return NULL; - res = _parse_array_unicode(s, pystr, idx + 1, next_idx_ptr); - Py_LeaveRecursiveCall(); - return res; - case 'n': - /* null */ - if ((idx + 3 < length) && str[idx + 1] == 'u' && str[idx + 2] == 'l' && str[idx + 3] == 'l') { - Py_INCREF(Py_None); - *next_idx_ptr = idx + 4; - return Py_None; - } - break; - case 't': - /* true */ - if ((idx + 3 < length) && str[idx + 1] == 'r' && str[idx + 2] == 'u' && str[idx + 3] == 'e') { - Py_INCREF(Py_True); - *next_idx_ptr = idx + 4; - return Py_True; - } - break; - case 'f': - /* false */ - if ((idx + 4 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'l' && str[idx + 3] == 's' && str[idx + 4] == 'e') { - Py_INCREF(Py_False); - *next_idx_ptr = idx + 5; - return Py_False; - } - break; - case 'N': - /* NaN */ - if ((idx + 2 < length) && str[idx + 1] == 'a' && str[idx + 2] == 'N') { - return _parse_constant(s, "NaN", idx, next_idx_ptr); - } - break; - case 'I': - /* Infinity */ - if ((idx + 7 < length) && str[idx + 1] == 'n' && str[idx + 2] == 'f' && str[idx + 3] == 'i' && str[idx + 4] == 'n' && str[idx + 5] == 'i' && str[idx + 6] == 't' && str[idx + 7] == 'y') { - return _parse_constant(s, "Infinity", idx, next_idx_ptr); - } - break; - case '-': - /* -Infinity */ - if ((idx + 8 < length) && str[idx + 1] == 'I' && str[idx + 2] == 'n' && str[idx + 3] == 'f' && str[idx + 4] == 'i' && str[idx + 5] == 'n' && str[idx + 6] == 'i' && str[idx + 7] == 't' && str[idx + 8] == 'y') { - return _parse_constant(s, "-Infinity", idx, next_idx_ptr); - } - break; - } - /* Didn't find a string, object, array, or named constant. Look for a number. */ - return _match_number_unicode(s, pystr, idx, next_idx_ptr); -} - -static PyObject * -scanner_call(PyObject *self, PyObject *args, PyObject *kwds) -{ - /* Python callable interface to scan_once_{str,unicode} */ - PyObject *pystr; - PyObject *rval; - Py_ssize_t idx; - Py_ssize_t next_idx = -1; - static char *kwlist[] = {"string", "idx", NULL}; - PyScannerObject *s; - assert(PyScanner_Check(self)); - s = (PyScannerObject *)self; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:scan_once", kwlist, &pystr, _convertPyInt_AsSsize_t, &idx)) - return NULL; - - if (PyString_Check(pystr)) { - rval = scan_once_str(s, pystr, idx, &next_idx); - } - else if (PyUnicode_Check(pystr)) { - rval = scan_once_unicode(s, pystr, idx, &next_idx); - } - else { - PyErr_Format(PyExc_TypeError, - "first argument must be a string, not %.80s", - Py_TYPE(pystr)->tp_name); - return NULL; - } - return _build_rval_index_tuple(rval, next_idx); -} - -static PyObject * -scanner_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyScannerObject *s; - s = (PyScannerObject *)type->tp_alloc(type, 0); - if (s != NULL) { - s->encoding = NULL; - s->strict = NULL; - s->object_hook = NULL; - s->pairs_hook = NULL; - s->parse_float = NULL; - s->parse_int = NULL; - s->parse_constant = NULL; - } - return (PyObject *)s; -} - -static int -scanner_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - /* Initialize Scanner object */ - PyObject *ctx; - static char *kwlist[] = {"context", NULL}; - PyScannerObject *s; - - assert(PyScanner_Check(self)); - s = (PyScannerObject *)self; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:make_scanner", kwlist, &ctx)) - return -1; - - /* PyString_AS_STRING is used on encoding */ - s->encoding = PyObject_GetAttrString(ctx, "encoding"); - if (s->encoding == NULL) - goto bail; - if (s->encoding == Py_None) { - Py_DECREF(Py_None); - s->encoding = PyString_InternFromString(DEFAULT_ENCODING); - } - else if (PyUnicode_Check(s->encoding)) { - PyObject *tmp = PyUnicode_AsEncodedString(s->encoding, NULL, NULL); - Py_DECREF(s->encoding); - s->encoding = tmp; - } - if (s->encoding == NULL) - goto bail; - if (!PyString_Check(s->encoding)) { - PyErr_Format(PyExc_TypeError, - "encoding must be a string, not %.80s", - Py_TYPE(s->encoding)->tp_name); - goto bail; - } - - - /* All of these will fail "gracefully" so we don't need to verify them */ - s->strict = PyObject_GetAttrString(ctx, "strict"); - if (s->strict == NULL) - goto bail; - s->object_hook = PyObject_GetAttrString(ctx, "object_hook"); - if (s->object_hook == NULL) - goto bail; - s->pairs_hook = PyObject_GetAttrString(ctx, "object_pairs_hook"); - if (s->pairs_hook == NULL) - goto bail; - s->parse_float = PyObject_GetAttrString(ctx, "parse_float"); - if (s->parse_float == NULL) - goto bail; - s->parse_int = PyObject_GetAttrString(ctx, "parse_int"); - if (s->parse_int == NULL) - goto bail; - s->parse_constant = PyObject_GetAttrString(ctx, "parse_constant"); - if (s->parse_constant == NULL) - goto bail; - - return 0; - -bail: - Py_CLEAR(s->encoding); - Py_CLEAR(s->strict); - Py_CLEAR(s->object_hook); - Py_CLEAR(s->pairs_hook); - Py_CLEAR(s->parse_float); - Py_CLEAR(s->parse_int); - Py_CLEAR(s->parse_constant); - return -1; -} - -PyDoc_STRVAR(scanner_doc, "JSON scanner object"); - -static -PyTypeObject PyScannerType = { - PyObject_HEAD_INIT(NULL) - 0, /* tp_internal */ - "_json.Scanner", /* tp_name */ - sizeof(PyScannerObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - scanner_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - scanner_call, /* tp_call */ - 0, /* tp_str */ - 0,/* PyObject_GenericGetAttr, */ /* tp_getattro */ - 0,/* PyObject_GenericSetAttr, */ /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - scanner_doc, /* tp_doc */ - scanner_traverse, /* tp_traverse */ - scanner_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - scanner_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - scanner_init, /* tp_init */ - 0,/* PyType_GenericAlloc, */ /* tp_alloc */ - scanner_new, /* tp_new */ - 0,/* PyObject_GC_Del, */ /* tp_free */ -}; - -static PyObject * -encoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyEncoderObject *s; - s = (PyEncoderObject *)type->tp_alloc(type, 0); - if (s != NULL) { - s->markers = NULL; - s->defaultfn = NULL; - s->encoder = NULL; - s->indent = NULL; - s->key_separator = NULL; - s->item_separator = NULL; - s->sort_keys = NULL; - s->skipkeys = NULL; - } - return (PyObject *)s; -} - -static int -encoder_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - /* initialize Encoder object */ - static char *kwlist[] = {"markers", "default", "encoder", "indent", "key_separator", "item_separator", "sort_keys", "skipkeys", "allow_nan", NULL}; - - PyEncoderObject *s; - PyObject *markers, *defaultfn, *encoder, *indent, *key_separator; - PyObject *item_separator, *sort_keys, *skipkeys, *allow_nan; - - assert(PyEncoder_Check(self)); - s = (PyEncoderObject *)self; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOOOOOOO:make_encoder", kwlist, - &markers, &defaultfn, &encoder, &indent, &key_separator, &item_separator, - &sort_keys, &skipkeys, &allow_nan)) - return -1; - - s->markers = markers; - s->defaultfn = defaultfn; - s->encoder = encoder; - s->indent = indent; - s->key_separator = key_separator; - s->item_separator = item_separator; - s->sort_keys = sort_keys; - s->skipkeys = skipkeys; - s->fast_encode = (PyCFunction_Check(s->encoder) && PyCFunction_GetFunction(s->encoder) == (PyCFunction)py_encode_basestring_ascii); - s->allow_nan = PyObject_IsTrue(allow_nan); - - Py_INCREF(s->markers); - Py_INCREF(s->defaultfn); - Py_INCREF(s->encoder); - Py_INCREF(s->indent); - Py_INCREF(s->key_separator); - Py_INCREF(s->item_separator); - Py_INCREF(s->sort_keys); - Py_INCREF(s->skipkeys); - return 0; -} - -static PyObject * -encoder_call(PyObject *self, PyObject *args, PyObject *kwds) -{ - /* Python callable interface to encode_listencode_obj */ - static char *kwlist[] = {"obj", "_current_indent_level", NULL}; - PyObject *obj; - PyObject *rval; - Py_ssize_t indent_level; - PyEncoderObject *s; - assert(PyEncoder_Check(self)); - s = (PyEncoderObject *)self; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO&:_iterencode", kwlist, - &obj, _convertPyInt_AsSsize_t, &indent_level)) - return NULL; - rval = PyList_New(0); - if (rval == NULL) - return NULL; - if (encoder_listencode_obj(s, rval, obj, indent_level)) { - Py_DECREF(rval); - return NULL; - } - return rval; -} - -static PyObject * -_encoded_const(PyObject *obj) -{ - /* Return the JSON string representation of None, True, False */ - if (obj == Py_None) { - static PyObject *s_null = NULL; - if (s_null == NULL) { - s_null = PyString_InternFromString("null"); - } - Py_INCREF(s_null); - return s_null; - } - else if (obj == Py_True) { - static PyObject *s_true = NULL; - if (s_true == NULL) { - s_true = PyString_InternFromString("true"); - } - Py_INCREF(s_true); - return s_true; - } - else if (obj == Py_False) { - static PyObject *s_false = NULL; - if (s_false == NULL) { - s_false = PyString_InternFromString("false"); - } - Py_INCREF(s_false); - return s_false; - } - else { - PyErr_SetString(PyExc_ValueError, "not a const"); - return NULL; - } -} - -static PyObject * -encoder_encode_float(PyEncoderObject *s, PyObject *obj) -{ - /* Return the JSON representation of a PyFloat */ - double i = PyFloat_AS_DOUBLE(obj); - if (!Py_IS_FINITE(i)) { - if (!s->allow_nan) { - PyErr_SetString(PyExc_ValueError, "Out of range float values are not JSON compliant"); - return NULL; - } - if (i > 0) { - return PyString_FromString("Infinity"); - } - else if (i < 0) { - return PyString_FromString("-Infinity"); - } - else { - return PyString_FromString("NaN"); - } - } - /* Use a better float format here? */ - return PyObject_Repr(obj); -} - -static PyObject * -encoder_encode_string(PyEncoderObject *s, PyObject *obj) -{ - /* Return the JSON representation of a string */ - if (s->fast_encode) - return py_encode_basestring_ascii(NULL, obj); - else - return PyObject_CallFunctionObjArgs(s->encoder, obj, NULL); -} - -static int -_steal_list_append(PyObject *lst, PyObject *stolen) -{ - /* Append stolen and then decrement its reference count */ - int rval = PyList_Append(lst, stolen); - Py_DECREF(stolen); - return rval; -} - -static int -encoder_listencode_obj(PyEncoderObject *s, PyObject *rval, PyObject *obj, Py_ssize_t indent_level) -{ - /* Encode Python object obj to a JSON term, rval is a PyList */ - PyObject *newobj; - int rv; - - if (obj == Py_None || obj == Py_True || obj == Py_False) { - PyObject *cstr = _encoded_const(obj); - if (cstr == NULL) - return -1; - return _steal_list_append(rval, cstr); - } - else if (PyString_Check(obj) || PyUnicode_Check(obj)) - { - PyObject *encoded = encoder_encode_string(s, obj); - if (encoded == NULL) - return -1; - return _steal_list_append(rval, encoded); - } - else if (PyInt_Check(obj) || PyLong_Check(obj)) { - PyObject *encoded = PyObject_Str(obj); - if (encoded == NULL) - return -1; - return _steal_list_append(rval, encoded); - } - else if (PyFloat_Check(obj)) { - PyObject *encoded = encoder_encode_float(s, obj); - if (encoded == NULL) - return -1; - return _steal_list_append(rval, encoded); - } - else if (PyList_Check(obj) || PyTuple_Check(obj)) { - if (Py_EnterRecursiveCall(" while encoding a JSON object")) - return -1; - rv = encoder_listencode_list(s, rval, obj, indent_level); - Py_LeaveRecursiveCall(); - return rv; - } - else if (PyDict_Check(obj)) { - if (Py_EnterRecursiveCall(" while encoding a JSON object")) - return -1; - rv = encoder_listencode_dict(s, rval, obj, indent_level); - Py_LeaveRecursiveCall(); - return rv; - } - else { - PyObject *ident = NULL; - if (s->markers != Py_None) { - int has_key; - ident = PyLong_FromVoidPtr(obj); - if (ident == NULL) - return -1; - has_key = PyDict_Contains(s->markers, ident); - if (has_key) { - if (has_key != -1) - PyErr_SetString(PyExc_ValueError, "Circular reference detected"); - Py_DECREF(ident); - return -1; - } - if (PyDict_SetItem(s->markers, ident, obj)) { - Py_DECREF(ident); - return -1; - } - } - newobj = PyObject_CallFunctionObjArgs(s->defaultfn, obj, NULL); - if (newobj == NULL) { - Py_XDECREF(ident); - return -1; - } - - if (Py_EnterRecursiveCall(" while encoding a JSON object")) - return -1; - rv = encoder_listencode_obj(s, rval, newobj, indent_level); - Py_LeaveRecursiveCall(); - - Py_DECREF(newobj); - if (rv) { - Py_XDECREF(ident); - return -1; - } - if (ident != NULL) { - if (PyDict_DelItem(s->markers, ident)) { - Py_XDECREF(ident); - return -1; - } - Py_XDECREF(ident); - } - return rv; - } -} - -static int -encoder_listencode_dict(PyEncoderObject *s, PyObject *rval, PyObject *dct, Py_ssize_t indent_level) -{ - /* Encode Python dict dct a JSON term, rval is a PyList */ - static PyObject *open_dict = NULL; - static PyObject *close_dict = NULL; - static PyObject *empty_dict = NULL; - PyObject *kstr = NULL; - PyObject *ident = NULL; - PyObject *key = NULL; - PyObject *value = NULL; - PyObject *it = NULL; - int skipkeys; - Py_ssize_t idx; - - if (open_dict == NULL || close_dict == NULL || empty_dict == NULL) { - open_dict = PyString_InternFromString("{"); - close_dict = PyString_InternFromString("}"); - empty_dict = PyString_InternFromString("{}"); - if (open_dict == NULL || close_dict == NULL || empty_dict == NULL) - return -1; - } - if (Py_SIZE(dct) == 0) - return PyList_Append(rval, empty_dict); - - if (s->markers != Py_None) { - int has_key; - ident = PyLong_FromVoidPtr(dct); - if (ident == NULL) - goto bail; - has_key = PyDict_Contains(s->markers, ident); - if (has_key) { - if (has_key != -1) - PyErr_SetString(PyExc_ValueError, "Circular reference detected"); - goto bail; - } - if (PyDict_SetItem(s->markers, ident, dct)) { - goto bail; - } - } - - if (PyList_Append(rval, open_dict)) - goto bail; - - if (s->indent != Py_None) { - /* TODO: DOES NOT RUN */ - indent_level += 1; - /* - newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) - separator = _item_separator + newline_indent - buf += newline_indent - */ - } - - /* TODO: C speedup not implemented for sort_keys */ - - it = PyObject_GetIter(dct); - if (it == NULL) - goto bail; - skipkeys = PyObject_IsTrue(s->skipkeys); - idx = 0; - while ((key = PyIter_Next(it)) != NULL) { - PyObject *encoded; - - if (PyString_Check(key) || PyUnicode_Check(key)) { - Py_INCREF(key); - kstr = key; - } - else if (PyFloat_Check(key)) { - kstr = encoder_encode_float(s, key); - if (kstr == NULL) - goto bail; - } - else if (PyInt_Check(key) || PyLong_Check(key)) { - kstr = PyObject_Str(key); - if (kstr == NULL) - goto bail; - } - else if (key == Py_True || key == Py_False || key == Py_None) { - kstr = _encoded_const(key); - if (kstr == NULL) - goto bail; - } - else if (skipkeys) { - Py_DECREF(key); - continue; - } - else { - /* TODO: include repr of key */ - PyErr_SetString(PyExc_TypeError, "keys must be a string"); - goto bail; - } - - if (idx) { - if (PyList_Append(rval, s->item_separator)) - goto bail; - } - - value = PyObject_GetItem(dct, key); - if (value == NULL) - goto bail; - - encoded = encoder_encode_string(s, kstr); - Py_CLEAR(kstr); - if (encoded == NULL) - goto bail; - if (PyList_Append(rval, encoded)) { - Py_DECREF(encoded); - goto bail; - } - Py_DECREF(encoded); - if (PyList_Append(rval, s->key_separator)) - goto bail; - if (encoder_listencode_obj(s, rval, value, indent_level)) - goto bail; - idx += 1; - Py_CLEAR(value); - Py_DECREF(key); - } - if (PyErr_Occurred()) - goto bail; - Py_CLEAR(it); - - if (ident != NULL) { - if (PyDict_DelItem(s->markers, ident)) - goto bail; - Py_CLEAR(ident); - } - if (s->indent != Py_None) { - /* TODO: DOES NOT RUN */ - /* - indent_level -= 1; - - yield '\n' + (' ' * (_indent * _current_indent_level)) - */ - } - if (PyList_Append(rval, close_dict)) - goto bail; - return 0; - -bail: - Py_XDECREF(it); - Py_XDECREF(key); - Py_XDECREF(value); - Py_XDECREF(kstr); - Py_XDECREF(ident); - return -1; -} - - -static int -encoder_listencode_list(PyEncoderObject *s, PyObject *rval, PyObject *seq, Py_ssize_t indent_level) -{ - /* Encode Python list seq to a JSON term, rval is a PyList */ - static PyObject *open_array = NULL; - static PyObject *close_array = NULL; - static PyObject *empty_array = NULL; - PyObject *ident = NULL; - PyObject *s_fast = NULL; - Py_ssize_t i; - - if (open_array == NULL || close_array == NULL || empty_array == NULL) { - open_array = PyString_InternFromString("["); - close_array = PyString_InternFromString("]"); - empty_array = PyString_InternFromString("[]"); - if (open_array == NULL || close_array == NULL || empty_array == NULL) - return -1; - } - ident = NULL; - s_fast = PySequence_Fast(seq, "_iterencode_list needs a sequence"); - if (s_fast == NULL) - return -1; - if (PySequence_Fast_GET_SIZE(s_fast) == 0) { - Py_DECREF(s_fast); - return PyList_Append(rval, empty_array); - } - - if (s->markers != Py_None) { - int has_key; - ident = PyLong_FromVoidPtr(seq); - if (ident == NULL) - goto bail; - has_key = PyDict_Contains(s->markers, ident); - if (has_key) { - if (has_key != -1) - PyErr_SetString(PyExc_ValueError, "Circular reference detected"); - goto bail; - } - if (PyDict_SetItem(s->markers, ident, seq)) { - goto bail; - } - } - - if (PyList_Append(rval, open_array)) - goto bail; - if (s->indent != Py_None) { - /* TODO: DOES NOT RUN */ - indent_level += 1; - /* - newline_indent = '\n' + (' ' * (_indent * _current_indent_level)) - separator = _item_separator + newline_indent - buf += newline_indent - */ - } - for (i = 0; i < PySequence_Fast_GET_SIZE(s_fast); i++) { - PyObject *obj = PySequence_Fast_GET_ITEM(s_fast, i); - if (i) { - if (PyList_Append(rval, s->item_separator)) - goto bail; - } - if (encoder_listencode_obj(s, rval, obj, indent_level)) - goto bail; - } - if (ident != NULL) { - if (PyDict_DelItem(s->markers, ident)) - goto bail; - Py_CLEAR(ident); - } - if (s->indent != Py_None) { - /* TODO: DOES NOT RUN */ - /* - indent_level -= 1; - - yield '\n' + (' ' * (_indent * _current_indent_level)) - */ - } - if (PyList_Append(rval, close_array)) - goto bail; - Py_DECREF(s_fast); - return 0; - -bail: - Py_XDECREF(ident); - Py_DECREF(s_fast); - return -1; -} - -static void -encoder_dealloc(PyObject *self) -{ - /* Deallocate Encoder */ - encoder_clear(self); - Py_TYPE(self)->tp_free(self); -} - -static int -encoder_traverse(PyObject *self, visitproc visit, void *arg) -{ - PyEncoderObject *s; - assert(PyEncoder_Check(self)); - s = (PyEncoderObject *)self; - Py_VISIT(s->markers); - Py_VISIT(s->defaultfn); - Py_VISIT(s->encoder); - Py_VISIT(s->indent); - Py_VISIT(s->key_separator); - Py_VISIT(s->item_separator); - Py_VISIT(s->sort_keys); - Py_VISIT(s->skipkeys); - return 0; -} - -static int -encoder_clear(PyObject *self) -{ - /* Deallocate Encoder */ - PyEncoderObject *s; - assert(PyEncoder_Check(self)); - s = (PyEncoderObject *)self; - Py_CLEAR(s->markers); - Py_CLEAR(s->defaultfn); - Py_CLEAR(s->encoder); - Py_CLEAR(s->indent); - Py_CLEAR(s->key_separator); - Py_CLEAR(s->item_separator); - Py_CLEAR(s->sort_keys); - Py_CLEAR(s->skipkeys); - return 0; -} - -PyDoc_STRVAR(encoder_doc, "_iterencode(obj, _current_indent_level) -> iterable"); - -static -PyTypeObject PyEncoderType = { - PyObject_HEAD_INIT(NULL) - 0, /* tp_internal */ - "_json.Encoder", /* tp_name */ - sizeof(PyEncoderObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - encoder_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - encoder_call, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - encoder_doc, /* tp_doc */ - encoder_traverse, /* tp_traverse */ - encoder_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - encoder_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - encoder_init, /* tp_init */ - 0, /* tp_alloc */ - encoder_new, /* tp_new */ - 0, /* tp_free */ -}; - -static PyMethodDef speedups_methods[] = { - {"encode_basestring_ascii", - (PyCFunction)py_encode_basestring_ascii, - METH_O, - pydoc_encode_basestring_ascii}, - {"scanstring", - (PyCFunction)py_scanstring, - METH_VARARGS, - pydoc_scanstring}, - {NULL, NULL, 0, NULL} -}; - -PyDoc_STRVAR(module_doc, -"json speedups\n"); - -void -init_json(void) -{ - PyObject *m; - PyScannerType.tp_new = PyType_GenericNew; - if (PyType_Ready(&PyScannerType) < 0) - return; - PyEncoderType.tp_new = PyType_GenericNew; - if (PyType_Ready(&PyEncoderType) < 0) - return; - m = Py_InitModule3("_json", speedups_methods, module_doc); - Py_INCREF((PyObject*)&PyScannerType); - PyModule_AddObject(m, "make_scanner", (PyObject*)&PyScannerType); - Py_INCREF((PyObject*)&PyEncoderType); - PyModule_AddObject(m, "make_encoder", (PyObject*)&PyEncoderType); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_localemodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_localemodule.c deleted file mode 100644 index d0acc11..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_localemodule.c +++ /dev/null @@ -1,758 +0,0 @@ -/*********************************************************** -Copyright (C) 1997, 2002, 2003 Martin von Loewis - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies. - -This software comes with no warranty. Use at your own risk. - -******************************************************************/ - -#include "Python.h" - -#include -#include -#include -#include - -#ifdef HAVE_ERRNO_H -#include -#endif - -#ifdef HAVE_LANGINFO_H -#include -#endif - -#ifdef HAVE_LIBINTL_H -#include -#endif - -#ifdef HAVE_WCHAR_H -#include -#endif - -#if defined(MS_WINDOWS) -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#ifdef RISCOS -char *strdup(const char *); -#endif - -PyDoc_STRVAR(locale__doc__, "Support for POSIX locales."); - -static PyObject *Error; - -/* support functions for formatting floating point numbers */ - -PyDoc_STRVAR(setlocale__doc__, -"(integer,string=None) -> string. Activates/queries locale processing."); - -/* the grouping is terminated by either 0 or CHAR_MAX */ -static PyObject* -copy_grouping(char* s) -{ - int i; - PyObject *result, *val = NULL; - - if (s[0] == '\0') - /* empty string: no grouping at all */ - return PyList_New(0); - - for (i = 0; s[i] != '\0' && s[i] != CHAR_MAX; i++) - ; /* nothing */ - - result = PyList_New(i+1); - if (!result) - return NULL; - - i = -1; - do { - i++; - val = PyInt_FromLong(s[i]); - if (!val) - break; - if (PyList_SetItem(result, i, val)) { - Py_DECREF(val); - val = NULL; - break; - } - } while (s[i] != '\0' && s[i] != CHAR_MAX); - - if (!val) { - Py_DECREF(result); - return NULL; - } - - return result; -} - -static void -fixup_ulcase(void) -{ - PyObject *mods, *strop, *string, *ulo; - unsigned char ul[256]; - int n, c; - - /* find the string and strop modules */ - mods = PyImport_GetModuleDict(); - if (!mods) - return; - string = PyDict_GetItemString(mods, "string"); - if (string) - string = PyModule_GetDict(string); - strop=PyDict_GetItemString(mods, "strop"); - if (strop) - strop = PyModule_GetDict(strop); - if (!string && !strop) - return; - - /* create uppercase map string */ - n = 0; - for (c = 0; c < 256; c++) { - if (isupper(c)) - ul[n++] = c; - } - ulo = PyString_FromStringAndSize((const char *)ul, n); - if (!ulo) - return; - if (string) - PyDict_SetItemString(string, "uppercase", ulo); - if (strop) - PyDict_SetItemString(strop, "uppercase", ulo); - Py_DECREF(ulo); - - /* create lowercase string */ - n = 0; - for (c = 0; c < 256; c++) { - if (islower(c)) - ul[n++] = c; - } - ulo = PyString_FromStringAndSize((const char *)ul, n); - if (!ulo) - return; - if (string) - PyDict_SetItemString(string, "lowercase", ulo); - if (strop) - PyDict_SetItemString(strop, "lowercase", ulo); - Py_DECREF(ulo); - - /* create letters string */ - n = 0; - for (c = 0; c < 256; c++) { - if (isalpha(c)) - ul[n++] = c; - } - ulo = PyString_FromStringAndSize((const char *)ul, n); - if (!ulo) - return; - if (string) - PyDict_SetItemString(string, "letters", ulo); - Py_DECREF(ulo); -} - -static PyObject* -PyLocale_setlocale(PyObject* self, PyObject* args) -{ - int category; - char *locale = NULL, *result; - PyObject *result_object; - - if (!PyArg_ParseTuple(args, "i|z:setlocale", &category, &locale)) - return NULL; - -#if defined(MS_WINDOWS) - if (category < LC_MIN || category > LC_MAX) - { - PyErr_SetString(Error, "invalid locale category"); - return NULL; - } -#endif - - if (locale) { - /* set locale */ - result = setlocale(category, locale); - if (!result) { - /* operation failed, no setting was changed */ - PyErr_SetString(Error, "unsupported locale setting"); - return NULL; - } - result_object = PyString_FromString(result); - if (!result_object) - return NULL; - /* record changes to LC_CTYPE */ - if (category == LC_CTYPE || category == LC_ALL) - fixup_ulcase(); - /* things that got wrong up to here are ignored */ - PyErr_Clear(); - } else { - /* get locale */ - result = setlocale(category, NULL); - if (!result) { - PyErr_SetString(Error, "locale query failed"); - return NULL; - } - result_object = PyString_FromString(result); - } - return result_object; -} - -PyDoc_STRVAR(localeconv__doc__, -"() -> dict. Returns numeric and monetary locale-specific parameters."); - -static PyObject* -PyLocale_localeconv(PyObject* self) -{ - PyObject* result; - struct lconv *l; - PyObject *x; - - result = PyDict_New(); - if (!result) - return NULL; - - /* if LC_NUMERIC is different in the C library, use saved value */ - l = localeconv(); - - /* hopefully, the localeconv result survives the C library calls - involved herein */ - -#define RESULT_STRING(s)\ - x = PyString_FromString(l->s);\ - if (!x) goto failed;\ - PyDict_SetItemString(result, #s, x);\ - Py_XDECREF(x) - -#define RESULT_INT(i)\ - x = PyInt_FromLong(l->i);\ - if (!x) goto failed;\ - PyDict_SetItemString(result, #i, x);\ - Py_XDECREF(x) - - /* Numeric information */ - RESULT_STRING(decimal_point); - RESULT_STRING(thousands_sep); - x = copy_grouping(l->grouping); - if (!x) - goto failed; - PyDict_SetItemString(result, "grouping", x); - Py_XDECREF(x); - - /* Monetary information */ - RESULT_STRING(int_curr_symbol); - RESULT_STRING(currency_symbol); - RESULT_STRING(mon_decimal_point); - RESULT_STRING(mon_thousands_sep); - x = copy_grouping(l->mon_grouping); - if (!x) - goto failed; - PyDict_SetItemString(result, "mon_grouping", x); - Py_XDECREF(x); - RESULT_STRING(positive_sign); - RESULT_STRING(negative_sign); - RESULT_INT(int_frac_digits); - RESULT_INT(frac_digits); - RESULT_INT(p_cs_precedes); - RESULT_INT(p_sep_by_space); - RESULT_INT(n_cs_precedes); - RESULT_INT(n_sep_by_space); - RESULT_INT(p_sign_posn); - RESULT_INT(n_sign_posn); - return result; - - failed: - Py_XDECREF(result); - Py_XDECREF(x); - return NULL; -} - -PyDoc_STRVAR(strcoll__doc__, -"string,string -> int. Compares two strings according to the locale."); - -static PyObject* -PyLocale_strcoll(PyObject* self, PyObject* args) -{ -#if !defined(HAVE_WCSCOLL) || !defined(Py_USING_UNICODE) - char *s1,*s2; - - if (!PyArg_ParseTuple(args, "ss:strcoll", &s1, &s2)) - return NULL; - return PyInt_FromLong(strcoll(s1, s2)); -#else - PyObject *os1, *os2, *result = NULL; - wchar_t *ws1 = NULL, *ws2 = NULL; - int rel1 = 0, rel2 = 0, len1, len2; - - if (!PyArg_UnpackTuple(args, "strcoll", 2, 2, &os1, &os2)) - return NULL; - /* If both arguments are byte strings, use strcoll. */ - if (PyString_Check(os1) && PyString_Check(os2)) - return PyInt_FromLong(strcoll(PyString_AS_STRING(os1), - PyString_AS_STRING(os2))); - /* If neither argument is unicode, it's an error. */ - if (!PyUnicode_Check(os1) && !PyUnicode_Check(os2)) { - PyErr_SetString(PyExc_ValueError, "strcoll arguments must be strings"); - } - /* Convert the non-unicode argument to unicode. */ - if (!PyUnicode_Check(os1)) { - os1 = PyUnicode_FromObject(os1); - if (!os1) - return NULL; - rel1 = 1; - } - if (!PyUnicode_Check(os2)) { - os2 = PyUnicode_FromObject(os2); - if (!os2) { - if (rel1) { - Py_DECREF(os1); - } - return NULL; - } - rel2 = 1; - } - /* Convert the unicode strings to wchar[]. */ - len1 = PyUnicode_GET_SIZE(os1) + 1; - ws1 = PyMem_NEW(wchar_t, len1); - if (!ws1) { - PyErr_NoMemory(); - goto done; - } - if (PyUnicode_AsWideChar((PyUnicodeObject*)os1, ws1, len1) == -1) - goto done; - ws1[len1 - 1] = 0; - len2 = PyUnicode_GET_SIZE(os2) + 1; - ws2 = PyMem_NEW(wchar_t, len2); - if (!ws2) { - PyErr_NoMemory(); - goto done; - } - if (PyUnicode_AsWideChar((PyUnicodeObject*)os2, ws2, len2) == -1) - goto done; - ws2[len2 - 1] = 0; - /* Collate the strings. */ - result = PyInt_FromLong(wcscoll(ws1, ws2)); - done: - /* Deallocate everything. */ - if (ws1) PyMem_FREE(ws1); - if (ws2) PyMem_FREE(ws2); - if (rel1) { - Py_DECREF(os1); - } - if (rel2) { - Py_DECREF(os2); - } - return result; -#endif -} - - -PyDoc_STRVAR(strxfrm__doc__, -"string -> string. Returns a string that behaves for cmp locale-aware."); - -static PyObject* -PyLocale_strxfrm(PyObject* self, PyObject* args) -{ - char *s, *buf; - size_t n1, n2; - PyObject *result; - - if (!PyArg_ParseTuple(args, "s:strxfrm", &s)) - return NULL; - - /* assume no change in size, first */ - n1 = strlen(s) + 1; - buf = PyMem_Malloc(n1); - if (!buf) - return PyErr_NoMemory(); - n2 = strxfrm(buf, s, n1) + 1; - if (n2 > n1) { - /* more space needed */ - buf = PyMem_Realloc(buf, n2); - if (!buf) - return PyErr_NoMemory(); - strxfrm(buf, s, n2); - } - result = PyString_FromString(buf); - PyMem_Free(buf); - return result; -} - -#if defined(MS_WINDOWS) -static PyObject* -PyLocale_getdefaultlocale(PyObject* self) -{ - char encoding[100]; - char locale[100]; - - PyOS_snprintf(encoding, sizeof(encoding), "cp%d", GetACP()); - - if (GetLocaleInfo(LOCALE_USER_DEFAULT, - LOCALE_SISO639LANGNAME, - locale, sizeof(locale))) { - Py_ssize_t i = strlen(locale); - locale[i++] = '_'; - if (GetLocaleInfo(LOCALE_USER_DEFAULT, - LOCALE_SISO3166CTRYNAME, - locale+i, (int)(sizeof(locale)-i))) - return Py_BuildValue("ss", locale, encoding); - } - - /* If we end up here, this windows version didn't know about - ISO639/ISO3166 names (it's probably Windows 95). Return the - Windows language identifier instead (a hexadecimal number) */ - - locale[0] = '0'; - locale[1] = 'x'; - if (GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_IDEFAULTLANGUAGE, - locale+2, sizeof(locale)-2)) { - return Py_BuildValue("ss", locale, encoding); - } - - /* cannot determine the language code (very unlikely) */ - Py_INCREF(Py_None); - return Py_BuildValue("Os", Py_None, encoding); -} -#endif - -#ifdef HAVE_LANGINFO_H -#define LANGINFO(X) {#X, X} -static struct langinfo_constant{ - char* name; - int value; -} langinfo_constants[] = -{ - /* These constants should exist on any langinfo implementation */ - LANGINFO(DAY_1), - LANGINFO(DAY_2), - LANGINFO(DAY_3), - LANGINFO(DAY_4), - LANGINFO(DAY_5), - LANGINFO(DAY_6), - LANGINFO(DAY_7), - - LANGINFO(ABDAY_1), - LANGINFO(ABDAY_2), - LANGINFO(ABDAY_3), - LANGINFO(ABDAY_4), - LANGINFO(ABDAY_5), - LANGINFO(ABDAY_6), - LANGINFO(ABDAY_7), - - LANGINFO(MON_1), - LANGINFO(MON_2), - LANGINFO(MON_3), - LANGINFO(MON_4), - LANGINFO(MON_5), - LANGINFO(MON_6), - LANGINFO(MON_7), - LANGINFO(MON_8), - LANGINFO(MON_9), - LANGINFO(MON_10), - LANGINFO(MON_11), - LANGINFO(MON_12), - - LANGINFO(ABMON_1), - LANGINFO(ABMON_2), - LANGINFO(ABMON_3), - LANGINFO(ABMON_4), - LANGINFO(ABMON_5), - LANGINFO(ABMON_6), - LANGINFO(ABMON_7), - LANGINFO(ABMON_8), - LANGINFO(ABMON_9), - LANGINFO(ABMON_10), - LANGINFO(ABMON_11), - LANGINFO(ABMON_12), - -#ifdef RADIXCHAR - /* The following are not available with glibc 2.0 */ - LANGINFO(RADIXCHAR), - LANGINFO(THOUSEP), - /* YESSTR and NOSTR are deprecated in glibc, since they are - a special case of message translation, which should be rather - done using gettext. So we don't expose it to Python in the - first place. - LANGINFO(YESSTR), - LANGINFO(NOSTR), - */ - LANGINFO(CRNCYSTR), -#endif - - LANGINFO(D_T_FMT), - LANGINFO(D_FMT), - LANGINFO(T_FMT), - LANGINFO(AM_STR), - LANGINFO(PM_STR), - - /* The following constants are available only with XPG4, but... - AIX 3.2. only has CODESET. - OpenBSD doesn't have CODESET but has T_FMT_AMPM, and doesn't have - a few of the others. - Solution: ifdef-test them all. */ -#ifdef CODESET - LANGINFO(CODESET), -#endif -#ifdef T_FMT_AMPM - LANGINFO(T_FMT_AMPM), -#endif -#ifdef ERA - LANGINFO(ERA), -#endif -#ifdef ERA_D_FMT - LANGINFO(ERA_D_FMT), -#endif -#ifdef ERA_D_T_FMT - LANGINFO(ERA_D_T_FMT), -#endif -#ifdef ERA_T_FMT - LANGINFO(ERA_T_FMT), -#endif -#ifdef ALT_DIGITS - LANGINFO(ALT_DIGITS), -#endif -#ifdef YESEXPR - LANGINFO(YESEXPR), -#endif -#ifdef NOEXPR - LANGINFO(NOEXPR), -#endif -#ifdef _DATE_FMT - /* This is not available in all glibc versions that have CODESET. */ - LANGINFO(_DATE_FMT), -#endif - {0, 0} -}; - -PyDoc_STRVAR(nl_langinfo__doc__, -"nl_langinfo(key) -> string\n" -"Return the value for the locale information associated with key."); - -static PyObject* -PyLocale_nl_langinfo(PyObject* self, PyObject* args) -{ - int item, i; - if (!PyArg_ParseTuple(args, "i:nl_langinfo", &item)) - return NULL; - /* Check whether this is a supported constant. GNU libc sometimes - returns numeric values in the char* return value, which would - crash PyString_FromString. */ - for (i = 0; langinfo_constants[i].name; i++) - if (langinfo_constants[i].value == item) { - /* Check NULL as a workaround for GNU libc's returning NULL - instead of an empty string for nl_langinfo(ERA). */ - const char *result = nl_langinfo(item); - return PyString_FromString(result != NULL ? result : ""); - } - PyErr_SetString(PyExc_ValueError, "unsupported langinfo constant"); - return NULL; -} -#endif /* HAVE_LANGINFO_H */ - -#ifdef HAVE_LIBINTL_H - -PyDoc_STRVAR(gettext__doc__, -"gettext(msg) -> string\n" -"Return translation of msg."); - -static PyObject* -PyIntl_gettext(PyObject* self, PyObject *args) -{ - char *in; - if (!PyArg_ParseTuple(args, "s", &in)) - return 0; - return PyString_FromString(gettext(in)); -} - -PyDoc_STRVAR(dgettext__doc__, -"dgettext(domain, msg) -> string\n" -"Return translation of msg in domain."); - -static PyObject* -PyIntl_dgettext(PyObject* self, PyObject *args) -{ - char *domain, *in; - if (!PyArg_ParseTuple(args, "zs", &domain, &in)) - return 0; - return PyString_FromString(dgettext(domain, in)); -} - -PyDoc_STRVAR(dcgettext__doc__, -"dcgettext(domain, msg, category) -> string\n" -"Return translation of msg in domain and category."); - -static PyObject* -PyIntl_dcgettext(PyObject *self, PyObject *args) -{ - char *domain, *msgid; - int category; - if (!PyArg_ParseTuple(args, "zsi", &domain, &msgid, &category)) - return 0; - return PyString_FromString(dcgettext(domain,msgid,category)); -} - -PyDoc_STRVAR(textdomain__doc__, -"textdomain(domain) -> string\n" -"Set the C library's textdmain to domain, returning the new domain."); - -static PyObject* -PyIntl_textdomain(PyObject* self, PyObject* args) -{ - char *domain; - if (!PyArg_ParseTuple(args, "z", &domain)) - return 0; - domain = textdomain(domain); - if (!domain) { - PyErr_SetFromErrno(PyExc_OSError); - return NULL; - } - return PyString_FromString(domain); -} - -PyDoc_STRVAR(bindtextdomain__doc__, -"bindtextdomain(domain, dir) -> string\n" -"Bind the C library's domain to dir."); - -static PyObject* -PyIntl_bindtextdomain(PyObject* self,PyObject*args) -{ - char *domain, *dirname; - if (!PyArg_ParseTuple(args, "sz", &domain, &dirname)) - return 0; - if (!strlen(domain)) { - PyErr_SetString(Error, "domain must be a non-empty string"); - return 0; - } - dirname = bindtextdomain(domain, dirname); - if (!dirname) { - PyErr_SetFromErrno(PyExc_OSError); - return NULL; - } - return PyString_FromString(dirname); -} - -#ifdef HAVE_BIND_TEXTDOMAIN_CODESET -PyDoc_STRVAR(bind_textdomain_codeset__doc__, -"bind_textdomain_codeset(domain, codeset) -> string\n" -"Bind the C library's domain to codeset."); - -static PyObject* -PyIntl_bind_textdomain_codeset(PyObject* self,PyObject*args) -{ - char *domain,*codeset; - if (!PyArg_ParseTuple(args, "sz", &domain, &codeset)) - return NULL; - codeset = bind_textdomain_codeset(domain, codeset); - if (codeset) - return PyString_FromString(codeset); - Py_RETURN_NONE; -} -#endif - -#endif - -static struct PyMethodDef PyLocale_Methods[] = { - {"setlocale", (PyCFunction) PyLocale_setlocale, - METH_VARARGS, setlocale__doc__}, - {"localeconv", (PyCFunction) PyLocale_localeconv, - METH_NOARGS, localeconv__doc__}, - {"strcoll", (PyCFunction) PyLocale_strcoll, - METH_VARARGS, strcoll__doc__}, - {"strxfrm", (PyCFunction) PyLocale_strxfrm, - METH_VARARGS, strxfrm__doc__}, -#if defined(MS_WINDOWS) - {"_getdefaultlocale", (PyCFunction) PyLocale_getdefaultlocale, METH_NOARGS}, -#endif -#ifdef HAVE_LANGINFO_H - {"nl_langinfo", (PyCFunction) PyLocale_nl_langinfo, - METH_VARARGS, nl_langinfo__doc__}, -#endif -#ifdef HAVE_LIBINTL_H - {"gettext",(PyCFunction)PyIntl_gettext,METH_VARARGS, - gettext__doc__}, - {"dgettext",(PyCFunction)PyIntl_dgettext,METH_VARARGS, - dgettext__doc__}, - {"dcgettext",(PyCFunction)PyIntl_dcgettext,METH_VARARGS, - dcgettext__doc__}, - {"textdomain",(PyCFunction)PyIntl_textdomain,METH_VARARGS, - textdomain__doc__}, - {"bindtextdomain",(PyCFunction)PyIntl_bindtextdomain,METH_VARARGS, - bindtextdomain__doc__}, -#ifdef HAVE_BIND_TEXTDOMAIN_CODESET - {"bind_textdomain_codeset",(PyCFunction)PyIntl_bind_textdomain_codeset, - METH_VARARGS, bind_textdomain_codeset__doc__}, -#endif -#endif - {NULL, NULL} -}; - -PyMODINIT_FUNC -init_locale(void) -{ - PyObject *m, *d, *x; -#ifdef HAVE_LANGINFO_H - int i; -#endif - - m = Py_InitModule("_locale", PyLocale_Methods); - if (m == NULL) - return; - - d = PyModule_GetDict(m); - - x = PyInt_FromLong(LC_CTYPE); - PyDict_SetItemString(d, "LC_CTYPE", x); - Py_XDECREF(x); - - x = PyInt_FromLong(LC_TIME); - PyDict_SetItemString(d, "LC_TIME", x); - Py_XDECREF(x); - - x = PyInt_FromLong(LC_COLLATE); - PyDict_SetItemString(d, "LC_COLLATE", x); - Py_XDECREF(x); - - x = PyInt_FromLong(LC_MONETARY); - PyDict_SetItemString(d, "LC_MONETARY", x); - Py_XDECREF(x); - -#ifdef LC_MESSAGES - x = PyInt_FromLong(LC_MESSAGES); - PyDict_SetItemString(d, "LC_MESSAGES", x); - Py_XDECREF(x); -#endif /* LC_MESSAGES */ - - x = PyInt_FromLong(LC_NUMERIC); - PyDict_SetItemString(d, "LC_NUMERIC", x); - Py_XDECREF(x); - - x = PyInt_FromLong(LC_ALL); - PyDict_SetItemString(d, "LC_ALL", x); - Py_XDECREF(x); - - x = PyInt_FromLong(CHAR_MAX); - PyDict_SetItemString(d, "CHAR_MAX", x); - Py_XDECREF(x); - - Error = PyErr_NewException("locale.Error", NULL, NULL); - PyDict_SetItemString(d, "Error", Error); - - x = PyString_FromString(locale__doc__); - PyDict_SetItemString(d, "__doc__", x); - Py_XDECREF(x); - -#ifdef HAVE_LANGINFO_H - for (i = 0; langinfo_constants[i].name; i++) { - PyModule_AddIntConstant(m, langinfo_constants[i].name, - langinfo_constants[i].value); - } -#endif -} - -/* -Local variables: -c-basic-offset: 4 -indent-tabs-mode: nil -End: -*/ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_math.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_math.c deleted file mode 100644 index 5d9c365..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_math.c +++ /dev/null @@ -1,255 +0,0 @@ -/* Definitions of some C99 math library functions, for those platforms - that don't implement these functions already. */ - -#include "Python.h" -#include -#include "_math.h" - -/* The following copyright notice applies to the original - implementations of acosh, asinh and atanh. */ - -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ - -static const double ln2 = 6.93147180559945286227E-01; -static const double two_pow_m28 = 3.7252902984619141E-09; /* 2**-28 */ -static const double two_pow_p28 = 268435456.0; /* 2**28 */ -static const double zero = 0.0; - -/* acosh(x) - * Method : - * Based on - * acosh(x) = log [ x + sqrt(x*x-1) ] - * we have - * acosh(x) := log(x)+ln2, if x is large; else - * acosh(x) := log(2x-1/(sqrt(x*x-1)+x)) if x>2; else - * acosh(x) := log1p(t+sqrt(2.0*t+t*t)); where t=x-1. - * - * Special cases: - * acosh(x) is NaN with signal if x<1. - * acosh(NaN) is NaN without signal. - */ - -double -_Py_acosh(double x) -{ - if (Py_IS_NAN(x)) { - return x+x; - } - if (x < 1.) { /* x < 1; return a signaling NaN */ - errno = EDOM; -#ifdef Py_NAN - return Py_NAN; -#else - return (x-x)/(x-x); -#endif - } - else if (x >= two_pow_p28) { /* x > 2**28 */ - if (Py_IS_INFINITY(x)) { - return x+x; - } - else { - return log(x)+ln2; /* acosh(huge)=log(2x) */ - } - } - else if (x == 1.) { - return 0.0; /* acosh(1) = 0 */ - } - else if (x > 2.) { /* 2 < x < 2**28 */ - double t = x*x; - return log(2.0*x - 1.0 / (x + sqrt(t - 1.0))); - } - else { /* 1 < x <= 2 */ - double t = x - 1.0; - return m_log1p(t + sqrt(2.0*t + t*t)); - } -} - - -/* asinh(x) - * Method : - * Based on - * asinh(x) = sign(x) * log [ |x| + sqrt(x*x+1) ] - * we have - * asinh(x) := x if 1+x*x=1, - * := sign(x)*(log(x)+ln2)) for large |x|, else - * := sign(x)*log(2|x|+1/(|x|+sqrt(x*x+1))) if|x|>2, else - * := sign(x)*log1p(|x| + x^2/(1 + sqrt(1+x^2))) - */ - -double -_Py_asinh(double x) -{ - double w; - double absx = fabs(x); - - if (Py_IS_NAN(x) || Py_IS_INFINITY(x)) { - return x+x; - } - if (absx < two_pow_m28) { /* |x| < 2**-28 */ - return x; /* return x inexact except 0 */ - } - if (absx > two_pow_p28) { /* |x| > 2**28 */ - w = log(absx)+ln2; - } - else if (absx > 2.0) { /* 2 < |x| < 2**28 */ - w = log(2.0*absx + 1.0 / (sqrt(x*x + 1.0) + absx)); - } - else { /* 2**-28 <= |x| < 2= */ - double t = x*x; - w = m_log1p(absx + t / (1.0 + sqrt(1.0 + t))); - } - return copysign(w, x); - -} - -/* atanh(x) - * Method : - * 1.Reduced x to positive by atanh(-x) = -atanh(x) - * 2.For x>=0.5 - * 1 2x x - * atanh(x) = --- * log(1 + -------) = 0.5 * log1p(2 * -------) - * 2 1 - x 1 - x - * - * For x<0.5 - * atanh(x) = 0.5*log1p(2x+2x*x/(1-x)) - * - * Special cases: - * atanh(x) is NaN if |x| >= 1 with signal; - * atanh(NaN) is that NaN with no signal; - * - */ - -double -_Py_atanh(double x) -{ - double absx; - double t; - - if (Py_IS_NAN(x)) { - return x+x; - } - absx = fabs(x); - if (absx >= 1.) { /* |x| >= 1 */ - errno = EDOM; -#ifdef Py_NAN - return Py_NAN; -#else - return x/zero; -#endif - } - if (absx < two_pow_m28) { /* |x| < 2**-28 */ - return x; - } - if (absx < 0.5) { /* |x| < 0.5 */ - t = absx+absx; - t = 0.5 * m_log1p(t + t*absx / (1.0 - absx)); - } - else { /* 0.5 <= |x| <= 1.0 */ - t = 0.5 * m_log1p((absx + absx) / (1.0 - absx)); - } - return copysign(t, x); -} - -/* Mathematically, expm1(x) = exp(x) - 1. The expm1 function is designed - to avoid the significant loss of precision that arises from direct - evaluation of the expression exp(x) - 1, for x near 0. */ - -double -_Py_expm1(double x) -{ - /* For abs(x) >= log(2), it's safe to evaluate exp(x) - 1 directly; this - also works fine for infinities and nans. - - For smaller x, we can use a method due to Kahan that achieves close to - full accuracy. - */ - - if (fabs(x) < 0.7) { - double u; - u = exp(x); - if (u == 1.0) - return x; - else - return (u - 1.0) * x / log(u); - } - else - return exp(x) - 1.0; -} - -/* log1p(x) = log(1+x). The log1p function is designed to avoid the - significant loss of precision that arises from direct evaluation when x is - small. */ - -#ifdef HAVE_LOG1P - -double -_Py_log1p(double x) -{ - /* Some platforms supply a log1p function but don't respect the sign of - zero: log1p(-0.0) gives 0.0 instead of the correct result of -0.0. - - To save fiddling with configure tests and platform checks, we handle the - special case of zero input directly on all platforms. - */ - if (x == 0.0) { - return x; - } - else { - return log1p(x); - } -} - -#else - -double -_Py_log1p(double x) -{ - /* For x small, we use the following approach. Let y be the nearest float - to 1+x, then - - 1+x = y * (1 - (y-1-x)/y) - - so log(1+x) = log(y) + log(1-(y-1-x)/y). Since (y-1-x)/y is tiny, the - second term is well approximated by (y-1-x)/y. If abs(x) >= - DBL_EPSILON/2 or the rounding-mode is some form of round-to-nearest - then y-1-x will be exactly representable, and is computed exactly by - (y-1)-x. - - If abs(x) < DBL_EPSILON/2 and the rounding mode is not known to be - round-to-nearest then this method is slightly dangerous: 1+x could be - rounded up to 1+DBL_EPSILON instead of down to 1, and in that case - y-1-x will not be exactly representable any more and the result can be - off by many ulps. But this is easily fixed: for a floating-point - number |x| < DBL_EPSILON/2., the closest floating-point number to - log(1+x) is exactly x. - */ - - double y; - if (fabs(x) < DBL_EPSILON/2.) { - return x; - } - else if (-0.5 <= x && x <= 1.) { - /* WARNING: it's possible than an overeager compiler - will incorrectly optimize the following two lines - to the equivalent of "return log(1.+x)". If this - happens, then results from log1p will be inaccurate - for small x. */ - y = 1.+x; - return log(y)-((y-1.)-x)/y; - } - else { - /* NaNs and infinities should end up here */ - return log(1.+x); - } -} - -#endif /* ifdef HAVE_LOG1P */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_math.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/_math.h deleted file mode 100644 index 87520bb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_math.h +++ /dev/null @@ -1,41 +0,0 @@ -double _Py_acosh(double x); -double _Py_asinh(double x); -double _Py_atanh(double x); -double _Py_expm1(double x); -double _Py_log1p(double x); - -#ifdef HAVE_ACOSH -#define m_acosh acosh -#else -/* if the system doesn't have acosh, use the substitute - function defined in Modules/_math.c. */ -#define m_acosh _Py_acosh -#endif - -#ifdef HAVE_ASINH -#define m_asinh asinh -#else -/* if the system doesn't have asinh, use the substitute - function defined in Modules/_math.c. */ -#define m_asinh _Py_asinh -#endif - -#ifdef HAVE_ATANH -#define m_atanh atanh -#else -/* if the system doesn't have atanh, use the substitute - function defined in Modules/_math.c. */ -#define m_atanh _Py_atanh -#endif - -#ifdef HAVE_EXPM1 -#define m_expm1 expm1 -#else -/* if the system doesn't have expm1, use the substitute - function defined in Modules/_math.c. */ -#define m_expm1 _Py_expm1 -#endif - -/* Use the substitute from _math.c on all platforms: - it includes workarounds for buggy handling of zeros. */ -#define m_log1p _Py_log1p diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_randommodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_randommodule.c deleted file mode 100644 index 1033965..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_randommodule.c +++ /dev/null @@ -1,595 +0,0 @@ -/* Random objects */ - -/* ------------------------------------------------------------------ - The code in this module was based on a download from: - http://www.math.keio.ac.jp/~matumoto/MT2002/emt19937ar.html - - It was modified in 2002 by Raymond Hettinger as follows: - - * the principal computational lines untouched. - - * renamed genrand_res53() to random_random() and wrapped - in python calling/return code. - - * genrand_int32() and the helper functions, init_genrand() - and init_by_array(), were declared static, wrapped in - Python calling/return code. also, their global data - references were replaced with structure references. - - * unused functions from the original were deleted. - new, original C python code was added to implement the - Random() interface. - - The following are the verbatim comments from the original code: - - A C-program for MT19937, with initialization improved 2002/1/26. - Coded by Takuji Nishimura and Makoto Matsumoto. - - Before using, initialize the state by using init_genrand(seed) - or init_by_array(init_key, key_length). - - Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura, - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - 3. The names of its contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR - CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - - Any feedback is very welcome. - http://www.math.keio.ac.jp/matumoto/emt.html - email: matumoto@math.keio.ac.jp -*/ - -/* ---------------------------------------------------------------*/ - -#include "Python.h" -#include /* for seeding to current time */ - -/* Period parameters -- These are all magic. Don't change. */ -#define N 624 -#define M 397 -#define MATRIX_A 0x9908b0dfUL /* constant vector a */ -#define UPPER_MASK 0x80000000UL /* most significant w-r bits */ -#define LOWER_MASK 0x7fffffffUL /* least significant r bits */ - -typedef struct { - PyObject_HEAD - unsigned long state[N]; - int index; -} RandomObject; - -static PyTypeObject Random_Type; - -#define RandomObject_Check(v) (Py_TYPE(v) == &Random_Type) - - -/* Random methods */ - - -/* generates a random number on [0,0xffffffff]-interval */ -static unsigned long -genrand_int32(RandomObject *self) -{ - unsigned long y; - static unsigned long mag01[2]={0x0UL, MATRIX_A}; - /* mag01[x] = x * MATRIX_A for x=0,1 */ - unsigned long *mt; - - mt = self->state; - if (self->index >= N) { /* generate N words at one time */ - int kk; - - for (kk=0;kk> 1) ^ mag01[y & 0x1UL]; - } - for (;kk> 1) ^ mag01[y & 0x1UL]; - } - y = (mt[N-1]&UPPER_MASK)|(mt[0]&LOWER_MASK); - mt[N-1] = mt[M-1] ^ (y >> 1) ^ mag01[y & 0x1UL]; - - self->index = 0; - } - - y = mt[self->index++]; - y ^= (y >> 11); - y ^= (y << 7) & 0x9d2c5680UL; - y ^= (y << 15) & 0xefc60000UL; - y ^= (y >> 18); - return y; -} - -/* random_random is the function named genrand_res53 in the original code; - * generates a random number on [0,1) with 53-bit resolution; note that - * 9007199254740992 == 2**53; I assume they're spelling "/2**53" as - * multiply-by-reciprocal in the (likely vain) hope that the compiler will - * optimize the division away at compile-time. 67108864 is 2**26. In - * effect, a contains 27 random bits shifted left 26, and b fills in the - * lower 26 bits of the 53-bit numerator. - * The orginal code credited Isaku Wada for this algorithm, 2002/01/09. - */ -static PyObject * -random_random(RandomObject *self) -{ - unsigned long a=genrand_int32(self)>>5, b=genrand_int32(self)>>6; - return PyFloat_FromDouble((a*67108864.0+b)*(1.0/9007199254740992.0)); -} - -/* initializes mt[N] with a seed */ -static void -init_genrand(RandomObject *self, unsigned long s) -{ - int mti; - unsigned long *mt; - - mt = self->state; - mt[0]= s & 0xffffffffUL; - for (mti=1; mti> 30)) + mti); - /* See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier. */ - /* In the previous versions, MSBs of the seed affect */ - /* only MSBs of the array mt[]. */ - /* 2002/01/09 modified by Makoto Matsumoto */ - mt[mti] &= 0xffffffffUL; - /* for >32 bit machines */ - } - self->index = mti; - return; -} - -/* initialize by an array with array-length */ -/* init_key is the array for initializing keys */ -/* key_length is its length */ -static PyObject * -init_by_array(RandomObject *self, unsigned long init_key[], unsigned long key_length) -{ - unsigned int i, j, k; /* was signed in the original code. RDH 12/16/2002 */ - unsigned long *mt; - - mt = self->state; - init_genrand(self, 19650218UL); - i=1; j=0; - k = (N>key_length ? N : key_length); - for (; k; k--) { - mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1664525UL)) - + init_key[j] + j; /* non linear */ - mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ - i++; j++; - if (i>=N) { mt[0] = mt[N-1]; i=1; } - if (j>=key_length) j=0; - } - for (k=N-1; k; k--) { - mt[i] = (mt[i] ^ ((mt[i-1] ^ (mt[i-1] >> 30)) * 1566083941UL)) - - i; /* non linear */ - mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ - i++; - if (i>=N) { mt[0] = mt[N-1]; i=1; } - } - - mt[0] = 0x80000000UL; /* MSB is 1; assuring non-zero initial array */ - Py_INCREF(Py_None); - return Py_None; -} - -/* - * The rest is Python-specific code, neither part of, nor derived from, the - * Twister download. - */ - -static PyObject * -random_seed(RandomObject *self, PyObject *args) -{ - PyObject *result = NULL; /* guilty until proved innocent */ - PyObject *masklower = NULL; - PyObject *thirtytwo = NULL; - PyObject *n = NULL; - unsigned long *key = NULL; - unsigned long keymax; /* # of allocated slots in key */ - unsigned long keyused; /* # of used slots in key */ - int err; - - PyObject *arg = NULL; - - if (!PyArg_UnpackTuple(args, "seed", 0, 1, &arg)) - return NULL; - - if (arg == NULL || arg == Py_None) { - time_t now; - - time(&now); - init_genrand(self, (unsigned long)now); - Py_INCREF(Py_None); - return Py_None; - } - /* If the arg is an int or long, use its absolute value; else use - * the absolute value of its hash code. - */ - if (PyInt_Check(arg) || PyLong_Check(arg)) - n = PyNumber_Absolute(arg); - else { - long hash = PyObject_Hash(arg); - if (hash == -1) - goto Done; - n = PyLong_FromUnsignedLong((unsigned long)hash); - } - if (n == NULL) - goto Done; - - /* Now split n into 32-bit chunks, from the right. Each piece is - * stored into key, which has a capacity of keymax chunks, of which - * keyused are filled. Alas, the repeated shifting makes this a - * quadratic-time algorithm; we'd really like to use - * _PyLong_AsByteArray here, but then we'd have to break into the - * long representation to figure out how big an array was needed - * in advance. - */ - keymax = 8; /* arbitrary; grows later if needed */ - keyused = 0; - key = (unsigned long *)PyMem_Malloc(keymax * sizeof(*key)); - if (key == NULL) - goto Done; - - masklower = PyLong_FromUnsignedLong(0xffffffffU); - if (masklower == NULL) - goto Done; - thirtytwo = PyInt_FromLong(32L); - if (thirtytwo == NULL) - goto Done; - while ((err=PyObject_IsTrue(n))) { - PyObject *newn; - PyObject *pychunk; - unsigned long chunk; - - if (err == -1) - goto Done; - pychunk = PyNumber_And(n, masklower); - if (pychunk == NULL) - goto Done; - chunk = PyLong_AsUnsignedLong(pychunk); - Py_DECREF(pychunk); - if (chunk == (unsigned long)-1 && PyErr_Occurred()) - goto Done; - newn = PyNumber_Rshift(n, thirtytwo); - if (newn == NULL) - goto Done; - Py_DECREF(n); - n = newn; - if (keyused >= keymax) { - unsigned long bigger = keymax << 1; - if ((bigger >> 1) != keymax) { - PyErr_NoMemory(); - goto Done; - } - key = (unsigned long *)PyMem_Realloc(key, - bigger * sizeof(*key)); - if (key == NULL) - goto Done; - keymax = bigger; - } - assert(keyused < keymax); - key[keyused++] = chunk; - } - - if (keyused == 0) - key[keyused++] = 0UL; - result = init_by_array(self, key, keyused); -Done: - Py_XDECREF(masklower); - Py_XDECREF(thirtytwo); - Py_XDECREF(n); - PyMem_Free(key); - return result; -} - -static PyObject * -random_getstate(RandomObject *self) -{ - PyObject *state; - PyObject *element; - int i; - - state = PyTuple_New(N+1); - if (state == NULL) - return NULL; - for (i=0; istate[i]); - if (element == NULL) - goto Fail; - PyTuple_SET_ITEM(state, i, element); - } - element = PyLong_FromLong((long)(self->index)); - if (element == NULL) - goto Fail; - PyTuple_SET_ITEM(state, i, element); - return state; - -Fail: - Py_DECREF(state); - return NULL; -} - -static PyObject * -random_setstate(RandomObject *self, PyObject *state) -{ - int i; - unsigned long element; - long index; - - if (!PyTuple_Check(state)) { - PyErr_SetString(PyExc_TypeError, - "state vector must be a tuple"); - return NULL; - } - if (PyTuple_Size(state) != N+1) { - PyErr_SetString(PyExc_ValueError, - "state vector is the wrong size"); - return NULL; - } - - for (i=0; istate[i] = element & 0xffffffffUL; /* Make sure we get sane state */ - } - - index = PyLong_AsLong(PyTuple_GET_ITEM(state, i)); - if (index == -1 && PyErr_Occurred()) - return NULL; - self->index = (int)index; - - Py_INCREF(Py_None); - return Py_None; -} - -/* -Jumpahead should be a fast way advance the generator n-steps ahead, but -lacking a formula for that, the next best is to use n and the existing -state to create a new state far away from the original. - -The generator uses constant spaced additive feedback, so shuffling the -state elements ought to produce a state which would not be encountered -(in the near term) by calls to random(). Shuffling is normally -implemented by swapping the ith element with another element ranging -from 0 to i inclusive. That allows the element to have the possibility -of not being moved. Since the goal is to produce a new, different -state, the swap element is ranged from 0 to i-1 inclusive. This assures -that each element gets moved at least once. - -To make sure that consecutive calls to jumpahead(n) produce different -states (even in the rare case of involutory shuffles), i+1 is added to -each element at position i. Successive calls are then guaranteed to -have changing (growing) values as well as shuffled positions. - -Finally, the self->index value is set to N so that the generator itself -kicks in on the next call to random(). This assures that all results -have been through the generator and do not just reflect alterations to -the underlying state. -*/ - -static PyObject * -random_jumpahead(RandomObject *self, PyObject *n) -{ - long i, j; - PyObject *iobj; - PyObject *remobj; - unsigned long *mt, tmp, nonzero; - - if (!PyInt_Check(n) && !PyLong_Check(n)) { - PyErr_Format(PyExc_TypeError, "jumpahead requires an " - "integer, not '%s'", - Py_TYPE(n)->tp_name); - return NULL; - } - - mt = self->state; - for (i = N-1; i > 1; i--) { - iobj = PyInt_FromLong(i); - if (iobj == NULL) - return NULL; - remobj = PyNumber_Remainder(n, iobj); - Py_DECREF(iobj); - if (remobj == NULL) - return NULL; - j = PyInt_AsLong(remobj); - Py_DECREF(remobj); - if (j == -1L && PyErr_Occurred()) - return NULL; - tmp = mt[i]; - mt[i] = mt[j]; - mt[j] = tmp; - } - - nonzero = 0; - for (i = 1; i < N; i++) { - mt[i] += i+1; - mt[i] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ - nonzero |= mt[i]; - } - - /* Ensure the state is nonzero: in the unlikely event that mt[1] through - mt[N-1] are all zero, set the MSB of mt[0] (see issue #14591). In the - normal case, we fall back to the pre-issue 14591 behaviour for mt[0]. */ - if (nonzero) { - mt[0] += 1; - mt[0] &= 0xffffffffUL; /* for WORDSIZE > 32 machines */ - } - else { - mt[0] = 0x80000000UL; - } - - self->index = N; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -random_getrandbits(RandomObject *self, PyObject *args) -{ - int k, i, bytes; - unsigned long r; - unsigned char *bytearray; - PyObject *result; - - if (!PyArg_ParseTuple(args, "i:getrandbits", &k)) - return NULL; - - if (k <= 0) { - PyErr_SetString(PyExc_ValueError, - "number of bits must be greater than zero"); - return NULL; - } - - bytes = ((k - 1) / 32 + 1) * 4; - bytearray = (unsigned char *)PyMem_Malloc(bytes); - if (bytearray == NULL) { - PyErr_NoMemory(); - return NULL; - } - - /* Fill-out whole words, byte-by-byte to avoid endianness issues */ - for (i=0 ; i>= (32 - k); - bytearray[i+0] = (unsigned char)r; - bytearray[i+1] = (unsigned char)(r >> 8); - bytearray[i+2] = (unsigned char)(r >> 16); - bytearray[i+3] = (unsigned char)(r >> 24); - } - - /* little endian order to match bytearray assignment order */ - result = _PyLong_FromByteArray(bytearray, bytes, 1, 0); - PyMem_Free(bytearray); - return result; -} - -static PyObject * -random_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - RandomObject *self; - PyObject *tmp; - - if (type == &Random_Type && !_PyArg_NoKeywords("Random()", kwds)) - return NULL; - - self = (RandomObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - tmp = random_seed(self, args); - if (tmp == NULL) { - Py_DECREF(self); - return NULL; - } - Py_DECREF(tmp); - return (PyObject *)self; -} - -static PyMethodDef random_methods[] = { - {"random", (PyCFunction)random_random, METH_NOARGS, - PyDoc_STR("random() -> x in the interval [0, 1).")}, - {"seed", (PyCFunction)random_seed, METH_VARARGS, - PyDoc_STR("seed([n]) -> None. Defaults to current time.")}, - {"getstate", (PyCFunction)random_getstate, METH_NOARGS, - PyDoc_STR("getstate() -> tuple containing the current state.")}, - {"setstate", (PyCFunction)random_setstate, METH_O, - PyDoc_STR("setstate(state) -> None. Restores generator state.")}, - {"jumpahead", (PyCFunction)random_jumpahead, METH_O, - PyDoc_STR("jumpahead(int) -> None. Create new state from " - "existing state and integer.")}, - {"getrandbits", (PyCFunction)random_getrandbits, METH_VARARGS, - PyDoc_STR("getrandbits(k) -> x. Generates a long int with " - "k random bits.")}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(random_doc, -"Random() -> create a random number generator with its own internal state."); - -static PyTypeObject Random_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_random.Random", /*tp_name*/ - sizeof(RandomObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - PyObject_GenericGetAttr, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - random_doc, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - random_methods, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - random_new, /*tp_new*/ - _PyObject_Del, /*tp_free*/ - 0, /*tp_is_gc*/ -}; - -PyDoc_STRVAR(module_doc, -"Module implements the Mersenne Twister random number generator."); - -PyMODINIT_FUNC -init_random(void) -{ - PyObject *m; - - if (PyType_Ready(&Random_Type) < 0) - return; - m = Py_InitModule3("_random", NULL, module_doc); - if (m == NULL) - return; - Py_INCREF(&Random_Type); - PyModule_AddObject(m, "Random", (PyObject *)&Random_Type); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_struct.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_struct.c deleted file mode 100644 index 353f029..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_struct.c +++ /dev/null @@ -1,2097 +0,0 @@ -/* struct module -- pack values into and (out of) strings */ - -/* New version supporting byte order, alignment and size options, - character strings, and unsigned numbers */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "structseq.h" -#include "structmember.h" -#include - -static PyTypeObject PyStructType; - -/* compatibility macros */ -#if (PY_VERSION_HEX < 0x02050000) -typedef int Py_ssize_t; -#endif - -/* warning messages */ -#define FLOAT_COERCE_WARN "integer argument expected, got float" -#define NON_INTEGER_WARN "integer argument expected, got non-integer " \ - "(implicit conversion using __int__ is deprecated)" - - -/* The translation function for each format character is table driven */ -typedef struct _formatdef { - char format; - Py_ssize_t size; - Py_ssize_t alignment; - PyObject* (*unpack)(const char *, - const struct _formatdef *); - int (*pack)(char *, PyObject *, - const struct _formatdef *); -} formatdef; - -typedef struct _formatcode { - const struct _formatdef *fmtdef; - Py_ssize_t offset; - Py_ssize_t size; -} formatcode; - -/* Struct object interface */ - -typedef struct { - PyObject_HEAD - Py_ssize_t s_size; - Py_ssize_t s_len; - formatcode *s_codes; - PyObject *s_format; - PyObject *weakreflist; /* List of weak references */ -} PyStructObject; - - -#define PyStruct_Check(op) PyObject_TypeCheck(op, &PyStructType) -#define PyStruct_CheckExact(op) (Py_TYPE(op) == &PyStructType) - - -/* Exception */ - -static PyObject *StructError; - - -/* Define various structs to figure out the alignments of types */ - - -typedef struct { char c; short x; } st_short; -typedef struct { char c; int x; } st_int; -typedef struct { char c; long x; } st_long; -typedef struct { char c; float x; } st_float; -typedef struct { char c; double x; } st_double; -typedef struct { char c; void *x; } st_void_p; - -#define SHORT_ALIGN (sizeof(st_short) - sizeof(short)) -#define INT_ALIGN (sizeof(st_int) - sizeof(int)) -#define LONG_ALIGN (sizeof(st_long) - sizeof(long)) -#define FLOAT_ALIGN (sizeof(st_float) - sizeof(float)) -#define DOUBLE_ALIGN (sizeof(st_double) - sizeof(double)) -#define VOID_P_ALIGN (sizeof(st_void_p) - sizeof(void *)) - -/* We can't support q and Q in native mode unless the compiler does; - in std mode, they're 8 bytes on all platforms. */ -#ifdef HAVE_LONG_LONG -typedef struct { char c; PY_LONG_LONG x; } s_long_long; -#define LONG_LONG_ALIGN (sizeof(s_long_long) - sizeof(PY_LONG_LONG)) -#endif - -#ifdef HAVE_C99_BOOL -#define BOOL_TYPE _Bool -typedef struct { char c; _Bool x; } s_bool; -#define BOOL_ALIGN (sizeof(s_bool) - sizeof(BOOL_TYPE)) -#else -#define BOOL_TYPE char -#define BOOL_ALIGN 0 -#endif - -#define STRINGIFY(x) #x - -#ifdef __powerc -#pragma options align=reset -#endif - -static char *integer_codes = "bBhHiIlLqQ"; - -/* Helper to get a PyLongObject by hook or by crook. Caller should decref. */ - -static PyObject * -get_pylong(PyObject *v) -{ - PyObject *r, *w; - int converted = 0; - assert(v != NULL); - if (!PyInt_Check(v) && !PyLong_Check(v)) { - PyNumberMethods *m; - /* Not an integer; first try to use __index__ to - convert to an integer. If the __index__ method - doesn't exist, or raises a TypeError, try __int__. - Use of the latter is deprecated, and will fail in - Python 3.x. */ - - m = Py_TYPE(v)->tp_as_number; - if (PyIndex_Check(v)) { - w = PyNumber_Index(v); - if (w != NULL) { - v = w; - /* successfully converted to an integer */ - converted = 1; - } - else if (PyErr_ExceptionMatches(PyExc_TypeError)) { - PyErr_Clear(); - } - else - return NULL; - } - if (!converted && m != NULL && m->nb_int != NULL) { - /* Special case warning message for floats, for - backwards compatibility. */ - if (PyFloat_Check(v)) { - if (PyErr_WarnEx( - PyExc_DeprecationWarning, - FLOAT_COERCE_WARN, 1)) - return NULL; - } - else { - if (PyErr_WarnEx( - PyExc_DeprecationWarning, - NON_INTEGER_WARN, 1)) - return NULL; - } - v = m->nb_int(v); - if (v == NULL) - return NULL; - if (!PyInt_Check(v) && !PyLong_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "__int__ method returned " - "non-integer"); - return NULL; - } - converted = 1; - } - if (!converted) { - PyErr_SetString(StructError, - "cannot convert argument " - "to integer"); - return NULL; - } - } - else - /* Ensure we own a reference to v. */ - Py_INCREF(v); - - assert(PyInt_Check(v) || PyLong_Check(v)); - if (PyInt_Check(v)) { - r = PyLong_FromLong(PyInt_AS_LONG(v)); - Py_DECREF(v); - } - else if (PyLong_Check(v)) { - assert(PyLong_Check(v)); - r = v; - } - else { - r = NULL; /* silence compiler warning about - possibly uninitialized variable */ - assert(0); /* shouldn't ever get here */ - } - - return r; -} - -/* Helper to convert a Python object to a C long. Sets an exception - (struct.error for an inconvertible type, OverflowError for - out-of-range values) and returns -1 on error. */ - -static int -get_long(PyObject *v, long *p) -{ - long x; - - v = get_pylong(v); - if (v == NULL) - return -1; - assert(PyLong_Check(v)); - x = PyLong_AsLong(v); - Py_DECREF(v); - if (x == (long)-1 && PyErr_Occurred()) - return -1; - *p = x; - return 0; -} - -/* Same, but handling unsigned long */ - -static int -get_ulong(PyObject *v, unsigned long *p) -{ - unsigned long x; - - v = get_pylong(v); - if (v == NULL) - return -1; - assert(PyLong_Check(v)); - x = PyLong_AsUnsignedLong(v); - Py_DECREF(v); - if (x == (unsigned long)-1 && PyErr_Occurred()) - return -1; - *p = x; - return 0; -} - -#ifdef HAVE_LONG_LONG - -/* Same, but handling native long long. */ - -static int -get_longlong(PyObject *v, PY_LONG_LONG *p) -{ - PY_LONG_LONG x; - - v = get_pylong(v); - if (v == NULL) - return -1; - assert(PyLong_Check(v)); - x = PyLong_AsLongLong(v); - Py_DECREF(v); - if (x == (PY_LONG_LONG)-1 && PyErr_Occurred()) - return -1; - *p = x; - return 0; -} - -/* Same, but handling native unsigned long long. */ - -static int -get_ulonglong(PyObject *v, unsigned PY_LONG_LONG *p) -{ - unsigned PY_LONG_LONG x; - - v = get_pylong(v); - if (v == NULL) - return -1; - assert(PyLong_Check(v)); - x = PyLong_AsUnsignedLongLong(v); - Py_DECREF(v); - if (x == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred()) - return -1; - *p = x; - return 0; -} - -#endif - -/* Floating point helpers */ - -static PyObject * -unpack_float(const char *p, /* start of 4-byte string */ - int le) /* true for little-endian, false for big-endian */ -{ - double x; - - x = _PyFloat_Unpack4((unsigned char *)p, le); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(x); -} - -static PyObject * -unpack_double(const char *p, /* start of 8-byte string */ - int le) /* true for little-endian, false for big-endian */ -{ - double x; - - x = _PyFloat_Unpack8((unsigned char *)p, le); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(x); -} - -/* Helper to format the range error exceptions */ -static int -_range_error(const formatdef *f, int is_unsigned) -{ - /* ulargest is the largest unsigned value with f->size bytes. - * Note that the simpler: - * ((size_t)1 << (f->size * 8)) - 1 - * doesn't work when f->size == sizeof(size_t) because C doesn't - * define what happens when a left shift count is >= the number of - * bits in the integer being shifted; e.g., on some boxes it doesn't - * shift at all when they're equal. - */ - const size_t ulargest = (size_t)-1 >> ((SIZEOF_SIZE_T - f->size)*8); - assert(f->size >= 1 && f->size <= SIZEOF_SIZE_T); - if (is_unsigned) - PyErr_Format(StructError, - "'%c' format requires 0 <= number <= %zu", - f->format, - ulargest); - else { - const Py_ssize_t largest = (Py_ssize_t)(ulargest >> 1); - PyErr_Format(StructError, - "'%c' format requires %zd <= number <= %zd", - f->format, - ~ largest, - largest); - } - return -1; -} - - - -/* A large number of small routines follow, with names of the form - - [bln][up]_TYPE - - [bln] distiguishes among big-endian, little-endian and native. - [pu] distiguishes between pack (to struct) and unpack (from struct). - TYPE is one of char, byte, ubyte, etc. -*/ - -/* Native mode routines. ****************************************************/ -/* NOTE: - In all n[up]_ routines handling types larger than 1 byte, there is - *no* guarantee that the p pointer is properly aligned for each type, - therefore memcpy is called. An intermediate variable is used to - compensate for big-endian architectures. - Normally both the intermediate variable and the memcpy call will be - skipped by C optimisation in little-endian architectures (gcc >= 2.91 - does this). */ - -static PyObject * -nu_char(const char *p, const formatdef *f) -{ - return PyString_FromStringAndSize(p, 1); -} - -static PyObject * -nu_byte(const char *p, const formatdef *f) -{ - return PyInt_FromLong((long) *(signed char *)p); -} - -static PyObject * -nu_ubyte(const char *p, const formatdef *f) -{ - return PyInt_FromLong((long) *(unsigned char *)p); -} - -static PyObject * -nu_short(const char *p, const formatdef *f) -{ - short x; - memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong((long)x); -} - -static PyObject * -nu_ushort(const char *p, const formatdef *f) -{ - unsigned short x; - memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong((long)x); -} - -static PyObject * -nu_int(const char *p, const formatdef *f) -{ - int x; - memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong((long)x); -} - -static PyObject * -nu_uint(const char *p, const formatdef *f) -{ - unsigned int x; - memcpy((char *)&x, p, sizeof x); -#if (SIZEOF_LONG > SIZEOF_INT) - return PyInt_FromLong((long)x); -#else - if (x <= ((unsigned int)LONG_MAX)) - return PyInt_FromLong((long)x); - return PyLong_FromUnsignedLong((unsigned long)x); -#endif -} - -static PyObject * -nu_long(const char *p, const formatdef *f) -{ - long x; - memcpy((char *)&x, p, sizeof x); - return PyInt_FromLong(x); -} - -static PyObject * -nu_ulong(const char *p, const formatdef *f) -{ - unsigned long x; - memcpy((char *)&x, p, sizeof x); - if (x <= LONG_MAX) - return PyInt_FromLong((long)x); - return PyLong_FromUnsignedLong(x); -} - -/* Native mode doesn't support q or Q unless the platform C supports - long long (or, on Windows, __int64). */ - -#ifdef HAVE_LONG_LONG - -static PyObject * -nu_longlong(const char *p, const formatdef *f) -{ - PY_LONG_LONG x; - memcpy((char *)&x, p, sizeof x); - if (x >= LONG_MIN && x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); - return PyLong_FromLongLong(x); -} - -static PyObject * -nu_ulonglong(const char *p, const formatdef *f) -{ - unsigned PY_LONG_LONG x; - memcpy((char *)&x, p, sizeof x); - if (x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); - return PyLong_FromUnsignedLongLong(x); -} - -#endif - -static PyObject * -nu_bool(const char *p, const formatdef *f) -{ - BOOL_TYPE x; - memcpy((char *)&x, p, sizeof x); - return PyBool_FromLong(x != 0); -} - - -static PyObject * -nu_float(const char *p, const formatdef *f) -{ - float x; - memcpy((char *)&x, p, sizeof x); - return PyFloat_FromDouble((double)x); -} - -static PyObject * -nu_double(const char *p, const formatdef *f) -{ - double x; - memcpy((char *)&x, p, sizeof x); - return PyFloat_FromDouble(x); -} - -static PyObject * -nu_void_p(const char *p, const formatdef *f) -{ - void *x; - memcpy((char *)&x, p, sizeof x); - return PyLong_FromVoidPtr(x); -} - -static int -np_byte(char *p, PyObject *v, const formatdef *f) -{ - long x; - if (get_long(v, &x) < 0) - return -1; - if (x < -128 || x > 127){ - PyErr_SetString(StructError, - "byte format requires -128 <= number <= 127"); - return -1; - } - *p = (char)x; - return 0; -} - -static int -np_ubyte(char *p, PyObject *v, const formatdef *f) -{ - long x; - if (get_long(v, &x) < 0) - return -1; - if (x < 0 || x > 255){ - PyErr_SetString(StructError, - "ubyte format requires 0 <= number <= 255"); - return -1; - } - *p = (char)x; - return 0; -} - -static int -np_char(char *p, PyObject *v, const formatdef *f) -{ - if (!PyString_Check(v) || PyString_Size(v) != 1) { - PyErr_SetString(StructError, - "char format require string of length 1"); - return -1; - } - *p = *PyString_AsString(v); - return 0; -} - -static int -np_short(char *p, PyObject *v, const formatdef *f) -{ - long x; - short y; - if (get_long(v, &x) < 0) - return -1; - if (x < SHRT_MIN || x > SHRT_MAX){ - PyErr_SetString(StructError, - "short format requires " STRINGIFY(SHRT_MIN) - " <= number <= " STRINGIFY(SHRT_MAX)); - return -1; - } - y = (short)x; - memcpy(p, (char *)&y, sizeof y); - return 0; -} - -static int -np_ushort(char *p, PyObject *v, const formatdef *f) -{ - long x; - unsigned short y; - if (get_long(v, &x) < 0) - return -1; - if (x < 0 || x > USHRT_MAX){ - PyErr_SetString(StructError, - "ushort format requires 0 <= number <= " STRINGIFY(USHRT_MAX)); - return -1; - } - y = (unsigned short)x; - memcpy(p, (char *)&y, sizeof y); - return 0; -} - -static int -np_int(char *p, PyObject *v, const formatdef *f) -{ - long x; - int y; - if (get_long(v, &x) < 0) - return -1; -#if (SIZEOF_LONG > SIZEOF_INT) - if ((x < ((long)INT_MIN)) || (x > ((long)INT_MAX))) - return _range_error(f, 0); -#endif - y = (int)x; - memcpy(p, (char *)&y, sizeof y); - return 0; -} - -static int -np_uint(char *p, PyObject *v, const formatdef *f) -{ - unsigned long x; - unsigned int y; - if (get_ulong(v, &x) < 0) - return -1; - y = (unsigned int)x; -#if (SIZEOF_LONG > SIZEOF_INT) - if (x > ((unsigned long)UINT_MAX)) - return _range_error(f, 1); -#endif - memcpy(p, (char *)&y, sizeof y); - return 0; -} - -static int -np_long(char *p, PyObject *v, const formatdef *f) -{ - long x; - if (get_long(v, &x) < 0) - return -1; - memcpy(p, (char *)&x, sizeof x); - return 0; -} - -static int -np_ulong(char *p, PyObject *v, const formatdef *f) -{ - unsigned long x; - if (get_ulong(v, &x) < 0) - return -1; - memcpy(p, (char *)&x, sizeof x); - return 0; -} - -#ifdef HAVE_LONG_LONG - -static int -np_longlong(char *p, PyObject *v, const formatdef *f) -{ - PY_LONG_LONG x; - if (get_longlong(v, &x) < 0) - return -1; - memcpy(p, (char *)&x, sizeof x); - return 0; -} - -static int -np_ulonglong(char *p, PyObject *v, const formatdef *f) -{ - unsigned PY_LONG_LONG x; - if (get_ulonglong(v, &x) < 0) - return -1; - memcpy(p, (char *)&x, sizeof x); - return 0; -} -#endif - - -static int -np_bool(char *p, PyObject *v, const formatdef *f) -{ - int y; - BOOL_TYPE x; - y = PyObject_IsTrue(v); - if (y < 0) - return -1; - x = y; - memcpy(p, (char *)&x, sizeof x); - return 0; -} - -static int -np_float(char *p, PyObject *v, const formatdef *f) -{ - float x = (float)PyFloat_AsDouble(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(StructError, - "required argument is not a float"); - return -1; - } - memcpy(p, (char *)&x, sizeof x); - return 0; -} - -static int -np_double(char *p, PyObject *v, const formatdef *f) -{ - double x = PyFloat_AsDouble(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(StructError, - "required argument is not a float"); - return -1; - } - memcpy(p, (char *)&x, sizeof(double)); - return 0; -} - -static int -np_void_p(char *p, PyObject *v, const formatdef *f) -{ - void *x; - - v = get_pylong(v); - if (v == NULL) - return -1; - assert(PyLong_Check(v)); - x = PyLong_AsVoidPtr(v); - Py_DECREF(v); - if (x == NULL && PyErr_Occurred()) - return -1; - memcpy(p, (char *)&x, sizeof x); - return 0; -} - -static formatdef native_table[] = { - {'x', sizeof(char), 0, NULL}, - {'b', sizeof(char), 0, nu_byte, np_byte}, - {'B', sizeof(char), 0, nu_ubyte, np_ubyte}, - {'c', sizeof(char), 0, nu_char, np_char}, - {'s', sizeof(char), 0, NULL}, - {'p', sizeof(char), 0, NULL}, - {'h', sizeof(short), SHORT_ALIGN, nu_short, np_short}, - {'H', sizeof(short), SHORT_ALIGN, nu_ushort, np_ushort}, - {'i', sizeof(int), INT_ALIGN, nu_int, np_int}, - {'I', sizeof(int), INT_ALIGN, nu_uint, np_uint}, - {'l', sizeof(long), LONG_ALIGN, nu_long, np_long}, - {'L', sizeof(long), LONG_ALIGN, nu_ulong, np_ulong}, -#ifdef HAVE_LONG_LONG - {'q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_longlong, np_longlong}, - {'Q', sizeof(PY_LONG_LONG), LONG_LONG_ALIGN, nu_ulonglong,np_ulonglong}, -#endif - {'?', sizeof(BOOL_TYPE), BOOL_ALIGN, nu_bool, np_bool}, - {'f', sizeof(float), FLOAT_ALIGN, nu_float, np_float}, - {'d', sizeof(double), DOUBLE_ALIGN, nu_double, np_double}, - {'P', sizeof(void *), VOID_P_ALIGN, nu_void_p, np_void_p}, - {0} -}; - -/* Big-endian routines. *****************************************************/ - -static PyObject * -bu_int(const char *p, const formatdef *f) -{ - long x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | *bytes++; - } while (--i > 0); - /* Extend the sign bit. */ - if (SIZEOF_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); - return PyInt_FromLong(x); -} - -static PyObject * -bu_uint(const char *p, const formatdef *f) -{ - unsigned long x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | *bytes++; - } while (--i > 0); - if (x <= LONG_MAX) - return PyInt_FromLong((long)x); - return PyLong_FromUnsignedLong(x); -} - -static PyObject * -bu_longlong(const char *p, const formatdef *f) -{ -#ifdef HAVE_LONG_LONG - PY_LONG_LONG x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | *bytes++; - } while (--i > 0); - /* Extend the sign bit. */ - if (SIZEOF_LONG_LONG > f->size) - x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); - if (x >= LONG_MIN && x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); - return PyLong_FromLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 0, /* little-endian */ - 1 /* signed */); -#endif -} - -static PyObject * -bu_ulonglong(const char *p, const formatdef *f) -{ -#ifdef HAVE_LONG_LONG - unsigned PY_LONG_LONG x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | *bytes++; - } while (--i > 0); - if (x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); - return PyLong_FromUnsignedLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 0, /* little-endian */ - 0 /* signed */); -#endif -} - -static PyObject * -bu_float(const char *p, const formatdef *f) -{ - return unpack_float(p, 0); -} - -static PyObject * -bu_double(const char *p, const formatdef *f) -{ - return unpack_double(p, 0); -} - -static PyObject * -bu_bool(const char *p, const formatdef *f) -{ - char x; - memcpy((char *)&x, p, sizeof x); - return PyBool_FromLong(x != 0); -} - -static int -bp_int(char *p, PyObject *v, const formatdef *f) -{ - long x; - Py_ssize_t i; - if (get_long(v, &x) < 0) - return -1; - i = f->size; - if (i != SIZEOF_LONG) { - if ((i == 2) && (x < -32768 || x > 32767)) - return _range_error(f, 0); -#if (SIZEOF_LONG != 4) - else if ((i == 4) && (x < -2147483648L || x > 2147483647L)) - return _range_error(f, 0); -#endif - } - do { - p[--i] = (char)x; - x >>= 8; - } while (i > 0); - return 0; -} - -static int -bp_uint(char *p, PyObject *v, const formatdef *f) -{ - unsigned long x; - Py_ssize_t i; - if (get_ulong(v, &x) < 0) - return -1; - i = f->size; - if (i != SIZEOF_LONG) { - unsigned long maxint = 1; - maxint <<= (unsigned long)(i * 8); - if (x >= maxint) - return _range_error(f, 1); - } - do { - p[--i] = (char)x; - x >>= 8; - } while (i > 0); - return 0; -} - -static int -bp_longlong(char *p, PyObject *v, const formatdef *f) -{ - int res; - v = get_pylong(v); - if (v == NULL) - return -1; - res = _PyLong_AsByteArray((PyLongObject *)v, - (unsigned char *)p, - 8, - 0, /* little_endian */ - 1 /* signed */); - Py_DECREF(v); - return res; -} - -static int -bp_ulonglong(char *p, PyObject *v, const formatdef *f) -{ - int res; - v = get_pylong(v); - if (v == NULL) - return -1; - res = _PyLong_AsByteArray((PyLongObject *)v, - (unsigned char *)p, - 8, - 0, /* little_endian */ - 0 /* signed */); - Py_DECREF(v); - return res; -} - -static int -bp_float(char *p, PyObject *v, const formatdef *f) -{ - double x = PyFloat_AsDouble(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(StructError, - "required argument is not a float"); - return -1; - } - return _PyFloat_Pack4(x, (unsigned char *)p, 0); -} - -static int -bp_double(char *p, PyObject *v, const formatdef *f) -{ - double x = PyFloat_AsDouble(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(StructError, - "required argument is not a float"); - return -1; - } - return _PyFloat_Pack8(x, (unsigned char *)p, 0); -} - -static int -bp_bool(char *p, PyObject *v, const formatdef *f) -{ - int y; - y = PyObject_IsTrue(v); - if (y < 0) - return -1; - *p = (char)y; - return 0; -} - -static formatdef bigendian_table[] = { - {'x', 1, 0, NULL}, - {'b', 1, 0, nu_byte, np_byte}, - {'B', 1, 0, nu_ubyte, np_ubyte}, - {'c', 1, 0, nu_char, np_char}, - {'s', 1, 0, NULL}, - {'p', 1, 0, NULL}, - {'h', 2, 0, bu_int, bp_int}, - {'H', 2, 0, bu_uint, bp_uint}, - {'i', 4, 0, bu_int, bp_int}, - {'I', 4, 0, bu_uint, bp_uint}, - {'l', 4, 0, bu_int, bp_int}, - {'L', 4, 0, bu_uint, bp_uint}, - {'q', 8, 0, bu_longlong, bp_longlong}, - {'Q', 8, 0, bu_ulonglong, bp_ulonglong}, - {'?', 1, 0, bu_bool, bp_bool}, - {'f', 4, 0, bu_float, bp_float}, - {'d', 8, 0, bu_double, bp_double}, - {0} -}; - -/* Little-endian routines. *****************************************************/ - -static PyObject * -lu_int(const char *p, const formatdef *f) -{ - long x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | bytes[--i]; - } while (i > 0); - /* Extend the sign bit. */ - if (SIZEOF_LONG > f->size) - x |= -(x & (1L << ((8 * f->size) - 1))); - return PyInt_FromLong(x); -} - -static PyObject * -lu_uint(const char *p, const formatdef *f) -{ - unsigned long x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | bytes[--i]; - } while (i > 0); - if (x <= LONG_MAX) - return PyInt_FromLong((long)x); - return PyLong_FromUnsignedLong((long)x); -} - -static PyObject * -lu_longlong(const char *p, const formatdef *f) -{ -#ifdef HAVE_LONG_LONG - PY_LONG_LONG x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | bytes[--i]; - } while (i > 0); - /* Extend the sign bit. */ - if (SIZEOF_LONG_LONG > f->size) - x |= -(x & ((PY_LONG_LONG)1 << ((8 * f->size) - 1))); - if (x >= LONG_MIN && x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, PY_LONG_LONG, long)); - return PyLong_FromLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 1, /* little-endian */ - 1 /* signed */); -#endif -} - -static PyObject * -lu_ulonglong(const char *p, const formatdef *f) -{ -#ifdef HAVE_LONG_LONG - unsigned PY_LONG_LONG x = 0; - Py_ssize_t i = f->size; - const unsigned char *bytes = (const unsigned char *)p; - do { - x = (x<<8) | bytes[--i]; - } while (i > 0); - if (x <= LONG_MAX) - return PyInt_FromLong(Py_SAFE_DOWNCAST(x, unsigned PY_LONG_LONG, long)); - return PyLong_FromUnsignedLongLong(x); -#else - return _PyLong_FromByteArray((const unsigned char *)p, - 8, - 1, /* little-endian */ - 0 /* signed */); -#endif -} - -static PyObject * -lu_float(const char *p, const formatdef *f) -{ - return unpack_float(p, 1); -} - -static PyObject * -lu_double(const char *p, const formatdef *f) -{ - return unpack_double(p, 1); -} - -static int -lp_int(char *p, PyObject *v, const formatdef *f) -{ - long x; - Py_ssize_t i; - if (get_long(v, &x) < 0) - return -1; - i = f->size; - if (i != SIZEOF_LONG) { - if ((i == 2) && (x < -32768 || x > 32767)) - return _range_error(f, 0); -#if (SIZEOF_LONG != 4) - else if ((i == 4) && (x < -2147483648L || x > 2147483647L)) - return _range_error(f, 0); -#endif - } - do { - *p++ = (char)x; - x >>= 8; - } while (--i > 0); - return 0; -} - -static int -lp_uint(char *p, PyObject *v, const formatdef *f) -{ - unsigned long x; - Py_ssize_t i; - if (get_ulong(v, &x) < 0) - return -1; - i = f->size; - if (i != SIZEOF_LONG) { - unsigned long maxint = 1; - maxint <<= (unsigned long)(i * 8); - if (x >= maxint) - return _range_error(f, 1); - } - do { - *p++ = (char)x; - x >>= 8; - } while (--i > 0); - return 0; -} - -static int -lp_longlong(char *p, PyObject *v, const formatdef *f) -{ - int res; - v = get_pylong(v); - if (v == NULL) - return -1; - res = _PyLong_AsByteArray((PyLongObject*)v, - (unsigned char *)p, - 8, - 1, /* little_endian */ - 1 /* signed */); - Py_DECREF(v); - return res; -} - -static int -lp_ulonglong(char *p, PyObject *v, const formatdef *f) -{ - int res; - v = get_pylong(v); - if (v == NULL) - return -1; - res = _PyLong_AsByteArray((PyLongObject*)v, - (unsigned char *)p, - 8, - 1, /* little_endian */ - 0 /* signed */); - Py_DECREF(v); - return res; -} - -static int -lp_float(char *p, PyObject *v, const formatdef *f) -{ - double x = PyFloat_AsDouble(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(StructError, - "required argument is not a float"); - return -1; - } - return _PyFloat_Pack4(x, (unsigned char *)p, 1); -} - -static int -lp_double(char *p, PyObject *v, const formatdef *f) -{ - double x = PyFloat_AsDouble(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_SetString(StructError, - "required argument is not a float"); - return -1; - } - return _PyFloat_Pack8(x, (unsigned char *)p, 1); -} - -static formatdef lilendian_table[] = { - {'x', 1, 0, NULL}, - {'b', 1, 0, nu_byte, np_byte}, - {'B', 1, 0, nu_ubyte, np_ubyte}, - {'c', 1, 0, nu_char, np_char}, - {'s', 1, 0, NULL}, - {'p', 1, 0, NULL}, - {'h', 2, 0, lu_int, lp_int}, - {'H', 2, 0, lu_uint, lp_uint}, - {'i', 4, 0, lu_int, lp_int}, - {'I', 4, 0, lu_uint, lp_uint}, - {'l', 4, 0, lu_int, lp_int}, - {'L', 4, 0, lu_uint, lp_uint}, - {'q', 8, 0, lu_longlong, lp_longlong}, - {'Q', 8, 0, lu_ulonglong, lp_ulonglong}, - {'?', 1, 0, bu_bool, bp_bool}, /* Std rep not endian dep, - but potentially different from native rep -- reuse bx_bool funcs. */ - {'f', 4, 0, lu_float, lp_float}, - {'d', 8, 0, lu_double, lp_double}, - {0} -}; - - -static const formatdef * -whichtable(char **pfmt) -{ - const char *fmt = (*pfmt)++; /* May be backed out of later */ - switch (*fmt) { - case '<': - return lilendian_table; - case '>': - case '!': /* Network byte order is big-endian */ - return bigendian_table; - case '=': { /* Host byte order -- different from native in alignment! */ - int n = 1; - char *p = (char *) &n; - if (*p == 1) - return lilendian_table; - else - return bigendian_table; - } - default: - --*pfmt; /* Back out of pointer increment */ - /* Fall through */ - case '@': - return native_table; - } -} - - -/* Get the table entry for a format code */ - -static const formatdef * -getentry(int c, const formatdef *f) -{ - for (; f->format != '\0'; f++) { - if (f->format == c) { - return f; - } - } - PyErr_SetString(StructError, "bad char in struct format"); - return NULL; -} - - -/* Align a size according to a format code. Return -1 on overflow. */ - -static Py_ssize_t -align(Py_ssize_t size, char c, const formatdef *e) -{ - Py_ssize_t extra; - - if (e->format == c) { - if (e->alignment && size > 0) { - extra = (e->alignment - 1) - (size - 1) % (e->alignment); - if (extra > PY_SSIZE_T_MAX - size) - return -1; - size += extra; - } - } - return size; -} - - -/* calculate the size of a format string */ - -static int -prepare_s(PyStructObject *self) -{ - const formatdef *f; - const formatdef *e; - formatcode *codes; - - const char *s; - const char *fmt; - char c; - Py_ssize_t size, len, num, itemsize; - - fmt = PyString_AS_STRING(self->s_format); - - f = whichtable((char **)&fmt); - - s = fmt; - size = 0; - len = 0; - while ((c = *s++) != '\0') { - if (isspace(Py_CHARMASK(c))) - continue; - if ('0' <= c && c <= '9') { - num = c - '0'; - while ('0' <= (c = *s++) && c <= '9') { - /* overflow-safe version of - if (num*10 + (c - '0') > PY_SSIZE_T_MAX) { ... } */ - if (num >= PY_SSIZE_T_MAX / 10 && ( - num > PY_SSIZE_T_MAX / 10 || - (c - '0') > PY_SSIZE_T_MAX % 10)) - goto overflow; - num = num*10 + (c - '0'); - } - if (c == '\0') - break; - } - else - num = 1; - - e = getentry(c, f); - if (e == NULL) - return -1; - - switch (c) { - case 's': /* fall through */ - case 'p': len++; break; - case 'x': break; - default: len += num; break; - } - - itemsize = e->size; - size = align(size, c, e); - if (size == -1) - goto overflow; - - /* if (size + num * itemsize > PY_SSIZE_T_MAX) { ... } */ - if (num > (PY_SSIZE_T_MAX - size) / itemsize) - goto overflow; - size += num * itemsize; - } - - /* check for overflow */ - if ((len + 1) > (PY_SSIZE_T_MAX / sizeof(formatcode))) { - PyErr_NoMemory(); - return -1; - } - - self->s_size = size; - self->s_len = len; - codes = PyMem_MALLOC((len + 1) * sizeof(formatcode)); - if (codes == NULL) { - PyErr_NoMemory(); - return -1; - } - /* Free any s_codes value left over from a previous initialization. */ - if (self->s_codes != NULL) - PyMem_FREE(self->s_codes); - self->s_codes = codes; - - s = fmt; - size = 0; - while ((c = *s++) != '\0') { - if (isspace(Py_CHARMASK(c))) - continue; - if ('0' <= c && c <= '9') { - num = c - '0'; - while ('0' <= (c = *s++) && c <= '9') - num = num*10 + (c - '0'); - if (c == '\0') - break; - } - else - num = 1; - - e = getentry(c, f); - - size = align(size, c, e); - if (c == 's' || c == 'p') { - codes->offset = size; - codes->size = num; - codes->fmtdef = e; - codes++; - size += num; - } else if (c == 'x') { - size += num; - } else { - while (--num >= 0) { - codes->offset = size; - codes->size = e->size; - codes->fmtdef = e; - codes++; - size += e->size; - } - } - } - codes->fmtdef = NULL; - codes->offset = size; - codes->size = 0; - - return 0; - - overflow: - PyErr_SetString(StructError, - "total struct size too long"); - return -1; -} - -static PyObject * -s_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *self; - - assert(type != NULL && type->tp_alloc != NULL); - - self = type->tp_alloc(type, 0); - if (self != NULL) { - PyStructObject *s = (PyStructObject*)self; - Py_INCREF(Py_None); - s->s_format = Py_None; - s->s_codes = NULL; - s->s_size = -1; - s->s_len = -1; - } - return self; -} - -static int -s_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyStructObject *soself = (PyStructObject *)self; - PyObject *o_format = NULL; - int ret = 0; - static char *kwlist[] = {"format", 0}; - - assert(PyStruct_Check(self)); - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Struct", kwlist, - &o_format)) - return -1; - - if (PyString_Check(o_format)) { - Py_INCREF(o_format); - Py_CLEAR(soself->s_format); - soself->s_format = o_format; - } - else if (PyUnicode_Check(o_format)) { - PyObject *str = PyUnicode_AsEncodedString(o_format, "ascii", NULL); - if (str == NULL) - return -1; - Py_CLEAR(soself->s_format); - soself->s_format = str; - } - else { - PyErr_Format(PyExc_TypeError, - "Struct() argument 1 must be string, not %s", - Py_TYPE(o_format)->tp_name); - return -1; - } - - ret = prepare_s(soself); - return ret; -} - -static void -s_dealloc(PyStructObject *s) -{ - if (s->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)s); - if (s->s_codes != NULL) { - PyMem_FREE(s->s_codes); - } - Py_XDECREF(s->s_format); - Py_TYPE(s)->tp_free((PyObject *)s); -} - -static PyObject * -s_unpack_internal(PyStructObject *soself, char *startfrom) { - formatcode *code; - Py_ssize_t i = 0; - PyObject *result = PyTuple_New(soself->s_len); - if (result == NULL) - return NULL; - - for (code = soself->s_codes; code->fmtdef != NULL; code++) { - PyObject *v; - const formatdef *e = code->fmtdef; - const char *res = startfrom + code->offset; - if (e->format == 's') { - v = PyString_FromStringAndSize(res, code->size); - } else if (e->format == 'p') { - Py_ssize_t n = *(unsigned char*)res; - if (n >= code->size) - n = code->size - 1; - v = PyString_FromStringAndSize(res + 1, n); - } else { - v = e->unpack(res, e); - } - if (v == NULL) - goto fail; - PyTuple_SET_ITEM(result, i++, v); - } - - return result; -fail: - Py_DECREF(result); - return NULL; -} - - -PyDoc_STRVAR(s_unpack__doc__, -"S.unpack(str) -> (v1, v2, ...)\n\ -\n\ -Return tuple containing values unpacked according to this Struct's format.\n\ -Requires len(str) == self.size. See struct.__doc__ for more on format\n\ -strings."); - -static PyObject * -s_unpack(PyObject *self, PyObject *inputstr) -{ - Py_buffer buf; - char *start; - Py_ssize_t len; - PyObject *args=NULL, *result; - PyStructObject *soself = (PyStructObject *)self; - assert(PyStruct_Check(self)); - assert(soself->s_codes != NULL); - if (inputstr == NULL) - goto fail; - if (PyString_Check(inputstr) && - PyString_GET_SIZE(inputstr) == soself->s_size) { - return s_unpack_internal(soself, PyString_AS_STRING(inputstr)); - } - args = PyTuple_Pack(1, inputstr); - if (args == NULL) - return NULL; - if (!PyArg_ParseTuple(args, "s*:unpack", &buf)) - goto fail; - start = buf.buf; - len = buf.len; - if (soself->s_size != len) { - PyBuffer_Release(&buf); - goto fail; - } - result = s_unpack_internal(soself, start); - Py_DECREF(args); - PyBuffer_Release(&buf); - return result; - -fail: - Py_XDECREF(args); - PyErr_Format(StructError, - "unpack requires a string argument of length %zd", - soself->s_size); - return NULL; -} - -PyDoc_STRVAR(s_unpack_from__doc__, -"S.unpack_from(buffer[, offset]) -> (v1, v2, ...)\n\ -\n\ -Return tuple containing values unpacked according to this Struct's format.\n\ -Unlike unpack, unpack_from can unpack values from any object supporting\n\ -the buffer API, not just str. Requires len(buffer[offset:]) >= self.size.\n\ -See struct.__doc__ for more on format strings."); - -static PyObject * -s_unpack_from(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"buffer", "offset", 0}; - static char *fmt = "z*|n:unpack_from"; - Py_buffer buf; - Py_ssize_t buffer_len = 0, offset = 0; - char *buffer = NULL; - PyStructObject *soself = (PyStructObject *)self; - PyObject *result; - assert(PyStruct_Check(self)); - assert(soself->s_codes != NULL); - - if (!PyArg_ParseTupleAndKeywords(args, kwds, fmt, kwlist, - &buf, &offset)) - return NULL; - buffer = buf.buf; - buffer_len = buf.len; - if (buffer == NULL) { - PyErr_Format(StructError, - "unpack_from requires a buffer argument"); - PyBuffer_Release(&buf); - return NULL; - } - - if (offset < 0) - offset += buffer_len; - - if (offset < 0 || (buffer_len - offset) < soself->s_size) { - PyErr_Format(StructError, - "unpack_from requires a buffer of at least %zd bytes", - soself->s_size); - PyBuffer_Release(&buf); - return NULL; - } - result = s_unpack_internal(soself, buffer + offset); - PyBuffer_Release(&buf); - return result; -} - - -/* - * Guts of the pack function. - * - * Takes a struct object, a tuple of arguments, and offset in that tuple of - * argument for where to start processing the arguments for packing, and a - * character buffer for writing the packed string. The caller must insure - * that the buffer may contain the required length for packing the arguments. - * 0 is returned on success, 1 is returned if there is an error. - * - */ -static int -s_pack_internal(PyStructObject *soself, PyObject *args, int offset, char* buf) -{ - formatcode *code; - /* XXX(nnorwitz): why does i need to be a local? can we use - the offset parameter or do we need the wider width? */ - Py_ssize_t i; - - memset(buf, '\0', soself->s_size); - i = offset; - for (code = soself->s_codes; code->fmtdef != NULL; code++) { - Py_ssize_t n; - PyObject *v = PyTuple_GET_ITEM(args, i++); - const formatdef *e = code->fmtdef; - char *res = buf + code->offset; - if (e->format == 's') { - if (!PyString_Check(v)) { - PyErr_SetString(StructError, - "argument for 's' must " - "be a string"); - return -1; - } - n = PyString_GET_SIZE(v); - if (n > code->size) - n = code->size; - if (n > 0) - memcpy(res, PyString_AS_STRING(v), n); - } else if (e->format == 'p') { - if (!PyString_Check(v)) { - PyErr_SetString(StructError, - "argument for 'p' must " - "be a string"); - return -1; - } - n = PyString_GET_SIZE(v); - if (n > (code->size - 1)) - n = code->size - 1; - if (n > 0) - memcpy(res + 1, PyString_AS_STRING(v), n); - if (n > 255) - n = 255; - *res = Py_SAFE_DOWNCAST(n, Py_ssize_t, unsigned char); - } else if (e->pack(res, v, e) < 0) { - if (strchr(integer_codes, e->format) != NULL && - PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Format(StructError, - "integer out of range for " - "'%c' format code", - e->format); - return -1; - } - } - - /* Success */ - return 0; -} - - -PyDoc_STRVAR(s_pack__doc__, -"S.pack(v1, v2, ...) -> string\n\ -\n\ -Return a string containing values v1, v2, ... packed according to this\n\ -Struct's format. See struct.__doc__ for more on format strings."); - -static PyObject * -s_pack(PyObject *self, PyObject *args) -{ - PyStructObject *soself; - PyObject *result; - - /* Validate arguments. */ - soself = (PyStructObject *)self; - assert(PyStruct_Check(self)); - assert(soself->s_codes != NULL); - if (PyTuple_GET_SIZE(args) != soself->s_len) - { - PyErr_Format(StructError, - "pack expected %zd items for packing (got %zd)", soself->s_len, PyTuple_GET_SIZE(args)); - return NULL; - } - - /* Allocate a new string */ - result = PyString_FromStringAndSize((char *)NULL, soself->s_size); - if (result == NULL) - return NULL; - - /* Call the guts */ - if ( s_pack_internal(soself, args, 0, PyString_AS_STRING(result)) != 0 ) { - Py_DECREF(result); - return NULL; - } - - return result; -} - -PyDoc_STRVAR(s_pack_into__doc__, -"S.pack_into(buffer, offset, v1, v2, ...)\n\ -\n\ -Pack the values v1, v2, ... according to this Struct's format, write \n\ -the packed bytes into the writable buffer buf starting at offset. Note\n\ -that the offset is not an optional argument. See struct.__doc__ for \n\ -more on format strings."); - -static PyObject * -s_pack_into(PyObject *self, PyObject *args) -{ - PyStructObject *soself; - Py_buffer buf; - Py_ssize_t offset; - - /* Validate arguments. +1 is for the first arg as buffer. */ - soself = (PyStructObject *)self; - assert(PyStruct_Check(self)); - assert(soself->s_codes != NULL); - if (PyTuple_GET_SIZE(args) != (soself->s_len + 2)) - { - if (PyTuple_GET_SIZE(args) == 0) { - PyErr_Format(StructError, - "pack_into expected buffer argument"); - } - else if (PyTuple_GET_SIZE(args) == 1) { - PyErr_Format(StructError, - "pack_into expected offset argument"); - } - else { - PyErr_Format(StructError, - "pack_into expected %zd items for packing (got %zd)", - soself->s_len, (PyTuple_GET_SIZE(args) - 2)); - } - return NULL; - } - - /* Extract a writable memory buffer from the first argument */ - if (!PyArg_Parse(PyTuple_GET_ITEM(args, 0), "w*", &buf)) - return NULL; - - /* Extract the offset from the first argument */ - offset = PyInt_AsSsize_t(PyTuple_GET_ITEM(args, 1)); - if (offset == -1 && PyErr_Occurred()) { - PyBuffer_Release(&buf); - return NULL; - } - - /* Support negative offsets. */ - if (offset < 0) - offset += buf.len; - - /* Check boundaries */ - if (offset < 0 || (buf.len - offset) < soself->s_size) { - PyErr_Format(StructError, - "pack_into requires a buffer of at least %zd bytes", - soself->s_size); - PyBuffer_Release(&buf); - return NULL; - } - - /* Call the guts */ - if (s_pack_internal(soself, args, 2, (char *)buf.buf + offset) != 0) { - PyBuffer_Release(&buf); - return NULL; - } - PyBuffer_Release(&buf); - - Py_RETURN_NONE; -} - -static PyObject * -s_get_format(PyStructObject *self, void *unused) -{ - Py_INCREF(self->s_format); - return self->s_format; -} - -static PyObject * -s_get_size(PyStructObject *self, void *unused) -{ - return PyInt_FromSsize_t(self->s_size); -} - -PyDoc_STRVAR(s_sizeof__doc__, -"S.__sizeof__() -> size of S in memory, in bytes"); - -static PyObject * -s_sizeof(PyStructObject *self, void *unused) -{ - Py_ssize_t size; - - size = sizeof(PyStructObject) + sizeof(formatcode) * (self->s_len + 1); - return PyLong_FromSsize_t(size); -} - -/* List of functions */ - -static struct PyMethodDef s_methods[] = { - {"pack", s_pack, METH_VARARGS, s_pack__doc__}, - {"pack_into", s_pack_into, METH_VARARGS, s_pack_into__doc__}, - {"unpack", s_unpack, METH_O, s_unpack__doc__}, - {"unpack_from", (PyCFunction)s_unpack_from, METH_VARARGS|METH_KEYWORDS, - s_unpack_from__doc__}, - {"__sizeof__", (PyCFunction)s_sizeof, METH_NOARGS, s_sizeof__doc__}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(s__doc__, "Compiled struct object"); - -#define OFF(x) offsetof(PyStructObject, x) - -static PyGetSetDef s_getsetlist[] = { - {"format", (getter)s_get_format, (setter)NULL, "struct format string", NULL}, - {"size", (getter)s_get_size, (setter)NULL, "struct size in bytes", NULL}, - {NULL} /* sentinel */ -}; - -static -PyTypeObject PyStructType = { - PyVarObject_HEAD_INIT(NULL, 0) - "Struct", - sizeof(PyStructObject), - 0, - (destructor)s_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS,/* tp_flags */ - s__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyStructObject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - s_methods, /* tp_methods */ - NULL, /* tp_members */ - s_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - s_init, /* tp_init */ - PyType_GenericAlloc,/* tp_alloc */ - s_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - - -/* ---- Standalone functions ---- */ - -#define MAXCACHE 100 -static PyObject *cache = NULL; - -static PyObject * -cache_struct(PyObject *fmt) -{ - PyObject * s_object; - - if (cache == NULL) { - cache = PyDict_New(); - if (cache == NULL) - return NULL; - } - - s_object = PyDict_GetItem(cache, fmt); - if (s_object != NULL) { - Py_INCREF(s_object); - return s_object; - } - - s_object = PyObject_CallFunctionObjArgs((PyObject *)(&PyStructType), fmt, NULL); - if (s_object != NULL) { - if (PyDict_Size(cache) >= MAXCACHE) - PyDict_Clear(cache); - /* Attempt to cache the result */ - if (PyDict_SetItem(cache, fmt, s_object) == -1) - PyErr_Clear(); - } - return s_object; -} - -PyDoc_STRVAR(clearcache_doc, -"Clear the internal cache."); - -static PyObject * -clearcache(PyObject *self) -{ - Py_CLEAR(cache); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(calcsize_doc, -"Return size of C struct described by format string fmt."); - -static PyObject * -calcsize(PyObject *self, PyObject *fmt) -{ - Py_ssize_t n; - PyObject *s_object = cache_struct(fmt); - if (s_object == NULL) - return NULL; - n = ((PyStructObject *)s_object)->s_size; - Py_DECREF(s_object); - return PyInt_FromSsize_t(n); -} - -PyDoc_STRVAR(pack_doc, -"Return string containing values v1, v2, ... packed according to fmt."); - -static PyObject * -pack(PyObject *self, PyObject *args) -{ - PyObject *s_object, *fmt, *newargs, *result; - Py_ssize_t n = PyTuple_GET_SIZE(args); - - if (n == 0) { - PyErr_SetString(PyExc_TypeError, "missing format argument"); - return NULL; - } - fmt = PyTuple_GET_ITEM(args, 0); - newargs = PyTuple_GetSlice(args, 1, n); - if (newargs == NULL) - return NULL; - - s_object = cache_struct(fmt); - if (s_object == NULL) { - Py_DECREF(newargs); - return NULL; - } - result = s_pack(s_object, newargs); - Py_DECREF(newargs); - Py_DECREF(s_object); - return result; -} - -PyDoc_STRVAR(pack_into_doc, -"Pack the values v1, v2, ... according to fmt.\n\ -Write the packed bytes into the writable buffer buf starting at offset."); - -static PyObject * -pack_into(PyObject *self, PyObject *args) -{ - PyObject *s_object, *fmt, *newargs, *result; - Py_ssize_t n = PyTuple_GET_SIZE(args); - - if (n == 0) { - PyErr_SetString(PyExc_TypeError, "missing format argument"); - return NULL; - } - fmt = PyTuple_GET_ITEM(args, 0); - newargs = PyTuple_GetSlice(args, 1, n); - if (newargs == NULL) - return NULL; - - s_object = cache_struct(fmt); - if (s_object == NULL) { - Py_DECREF(newargs); - return NULL; - } - result = s_pack_into(s_object, newargs); - Py_DECREF(newargs); - Py_DECREF(s_object); - return result; -} - -PyDoc_STRVAR(unpack_doc, -"Unpack the string containing packed C structure data, according to fmt.\n\ -Requires len(string) == calcsize(fmt)."); - -static PyObject * -unpack(PyObject *self, PyObject *args) -{ - PyObject *s_object, *fmt, *inputstr, *result; - - if (!PyArg_UnpackTuple(args, "unpack", 2, 2, &fmt, &inputstr)) - return NULL; - - s_object = cache_struct(fmt); - if (s_object == NULL) - return NULL; - result = s_unpack(s_object, inputstr); - Py_DECREF(s_object); - return result; -} - -PyDoc_STRVAR(unpack_from_doc, -"Unpack the buffer, containing packed C structure data, according to\n\ -fmt, starting at offset. Requires len(buffer[offset:]) >= calcsize(fmt)."); - -static PyObject * -unpack_from(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *s_object, *fmt, *newargs, *result; - Py_ssize_t n = PyTuple_GET_SIZE(args); - - if (n == 0) { - PyErr_SetString(PyExc_TypeError, "missing format argument"); - return NULL; - } - fmt = PyTuple_GET_ITEM(args, 0); - newargs = PyTuple_GetSlice(args, 1, n); - if (newargs == NULL) - return NULL; - - s_object = cache_struct(fmt); - if (s_object == NULL) { - Py_DECREF(newargs); - return NULL; - } - result = s_unpack_from(s_object, newargs, kwds); - Py_DECREF(newargs); - Py_DECREF(s_object); - return result; -} - -static struct PyMethodDef module_functions[] = { - {"_clearcache", (PyCFunction)clearcache, METH_NOARGS, clearcache_doc}, - {"calcsize", calcsize, METH_O, calcsize_doc}, - {"pack", pack, METH_VARARGS, pack_doc}, - {"pack_into", pack_into, METH_VARARGS, pack_into_doc}, - {"unpack", unpack, METH_VARARGS, unpack_doc}, - {"unpack_from", (PyCFunction)unpack_from, - METH_VARARGS|METH_KEYWORDS, unpack_from_doc}, - {NULL, NULL} /* sentinel */ -}; - - -/* Module initialization */ - -PyDoc_STRVAR(module_doc, -"Functions to convert between Python values and C structs represented\n\ -as Python strings. It uses format strings (explained below) as compact\n\ -descriptions of the lay-out of the C structs and the intended conversion\n\ -to/from Python values.\n\ -\n\ -The optional first format char indicates byte order, size and alignment:\n\ - @: native order, size & alignment (default)\n\ - =: native order, std. size & alignment\n\ - <: little-endian, std. size & alignment\n\ - >: big-endian, std. size & alignment\n\ - !: same as >\n\ -\n\ -The remaining chars indicate types of args and must match exactly;\n\ -these can be preceded by a decimal repeat count:\n\ - x: pad byte (no data); c:char; b:signed byte; B:unsigned byte;\n\ - ?: _Bool (requires C99; if not available, char is used instead)\n\ - h:short; H:unsigned short; i:int; I:unsigned int;\n\ - l:long; L:unsigned long; f:float; d:double.\n\ -Special cases (preceding decimal count indicates length):\n\ - s:string (array of char); p: pascal string (with count byte).\n\ -Special case (only available in native format):\n\ - P:an integer type that is wide enough to hold a pointer.\n\ -Special case (not in native mode unless 'long long' in platform C):\n\ - q:long long; Q:unsigned long long\n\ -Whitespace between formats is ignored.\n\ -\n\ -The variable struct.error is an exception raised on errors.\n"); - -PyMODINIT_FUNC -init_struct(void) -{ - PyObject *ver, *m; - - ver = PyString_FromString("0.2"); - if (ver == NULL) - return; - - m = Py_InitModule3("_struct", module_functions, module_doc); - if (m == NULL) - return; - - Py_TYPE(&PyStructType) = &PyType_Type; - if (PyType_Ready(&PyStructType) < 0) - return; - - /* This speed trick can't be used until overflow masking goes - away, because native endian always raises exceptions - instead of overflow masking. */ - - /* Check endian and swap in faster functions */ - { - int one = 1; - formatdef *native = native_table; - formatdef *other, *ptr; - if ((int)*(unsigned char*)&one) - other = lilendian_table; - else - other = bigendian_table; - /* Scan through the native table, find a matching - entry in the endian table and swap in the - native implementations whenever possible - (64-bit platforms may not have "standard" sizes) */ - while (native->format != '\0' && other->format != '\0') { - ptr = other; - while (ptr->format != '\0') { - if (ptr->format == native->format) { - /* Match faster when formats are - listed in the same order */ - if (ptr == other) - other++; - /* Only use the trick if the - size matches */ - if (ptr->size != native->size) - break; - /* Skip float and double, could be - "unknown" float format */ - if (ptr->format == 'd' || ptr->format == 'f') - break; - ptr->pack = native->pack; - ptr->unpack = native->unpack; - break; - } - ptr++; - } - native++; - } - } - - /* Add some symbolic constants to the module */ - if (StructError == NULL) { - StructError = PyErr_NewException("struct.error", NULL, NULL); - if (StructError == NULL) - return; - } - - Py_INCREF(StructError); - PyModule_AddObject(m, "error", StructError); - - Py_INCREF((PyObject*)&PyStructType); - PyModule_AddObject(m, "Struct", (PyObject*)&PyStructType); - - PyModule_AddObject(m, "__version__", ver); - - PyModule_AddIntConstant(m, "_PY_STRUCT_RANGE_CHECKING", 1); - PyModule_AddIntConstant(m, "_PY_STRUCT_FLOAT_COERCE", 1); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/_weakref.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/_weakref.c deleted file mode 100644 index 087cc92..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/_weakref.c +++ /dev/null @@ -1,112 +0,0 @@ -#include "Python.h" - - -#define GET_WEAKREFS_LISTPTR(o) \ - ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o)) - - -PyDoc_STRVAR(weakref_getweakrefcount__doc__, -"getweakrefcount(object) -- return the number of weak references\n" -"to 'object'."); - -static PyObject * -weakref_getweakrefcount(PyObject *self, PyObject *object) -{ - PyObject *result = NULL; - - if (PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) { - PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); - - result = PyInt_FromSsize_t(_PyWeakref_GetWeakrefCount(*list)); - } - else - result = PyInt_FromLong(0); - - return result; -} - - -PyDoc_STRVAR(weakref_getweakrefs__doc__, -"getweakrefs(object) -- return a list of all weak reference objects\n" -"that point to 'object'."); - -static PyObject * -weakref_getweakrefs(PyObject *self, PyObject *object) -{ - PyObject *result = NULL; - - if (PyType_SUPPORTS_WEAKREFS(Py_TYPE(object))) { - PyWeakReference **list = GET_WEAKREFS_LISTPTR(object); - Py_ssize_t count = _PyWeakref_GetWeakrefCount(*list); - - result = PyList_New(count); - if (result != NULL) { - PyWeakReference *current = *list; - Py_ssize_t i; - for (i = 0; i < count; ++i) { - PyList_SET_ITEM(result, i, (PyObject *) current); - Py_INCREF(current); - current = current->wr_next; - } - } - } - else { - result = PyList_New(0); - } - return result; -} - - -PyDoc_STRVAR(weakref_proxy__doc__, -"proxy(object[, callback]) -- create a proxy object that weakly\n" -"references 'object'. 'callback', if given, is called with a\n" -"reference to the proxy when 'object' is about to be finalized."); - -static PyObject * -weakref_proxy(PyObject *self, PyObject *args) -{ - PyObject *object; - PyObject *callback = NULL; - PyObject *result = NULL; - - if (PyArg_UnpackTuple(args, "proxy", 1, 2, &object, &callback)) { - result = PyWeakref_NewProxy(object, callback); - } - return result; -} - - -static PyMethodDef -weakref_functions[] = { - {"getweakrefcount", weakref_getweakrefcount, METH_O, - weakref_getweakrefcount__doc__}, - {"getweakrefs", weakref_getweakrefs, METH_O, - weakref_getweakrefs__doc__}, - {"proxy", weakref_proxy, METH_VARARGS, - weakref_proxy__doc__}, - {NULL, NULL, 0, NULL} -}; - - -PyMODINIT_FUNC -init_weakref(void) -{ - PyObject *m; - - m = Py_InitModule3("_weakref", weakref_functions, - "Weak-reference support module."); - if (m != NULL) { - Py_INCREF(&_PyWeakref_RefType); - PyModule_AddObject(m, "ref", - (PyObject *) &_PyWeakref_RefType); - Py_INCREF(&_PyWeakref_RefType); - PyModule_AddObject(m, "ReferenceType", - (PyObject *) &_PyWeakref_RefType); - Py_INCREF(&_PyWeakref_ProxyType); - PyModule_AddObject(m, "ProxyType", - (PyObject *) &_PyWeakref_ProxyType); - Py_INCREF(&_PyWeakref_CallableProxyType); - PyModule_AddObject(m, "CallableProxyType", - (PyObject *) &_PyWeakref_CallableProxyType); - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/addrinfo.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/addrinfo.h deleted file mode 100644 index 6f8b496..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/addrinfo.h +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef HAVE_GETADDRINFO - -/* - * Error return codes from getaddrinfo() - */ -#ifdef EAI_ADDRFAMILY -/* If this is defined, there is a conflicting implementation - in the C library, which can't be used for some reason. - Make sure it won't interfere with this emulation. */ - -#undef EAI_ADDRFAMILY -#undef EAI_AGAIN -#undef EAI_BADFLAGS -#undef EAI_FAIL -#undef EAI_FAMILY -#undef EAI_MEMORY -#undef EAI_NODATA -#undef EAI_NONAME -#undef EAI_SERVICE -#undef EAI_SOCKTYPE -#undef EAI_SYSTEM -#undef EAI_BADHINTS -#undef EAI_PROTOCOL -#undef EAI_MAX -#undef getaddrinfo -#define getaddrinfo fake_getaddrinfo -#endif /* EAI_ADDRFAMILY */ - -#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with hostname */ -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_BADHINTS 12 -#define EAI_PROTOCOL 13 -#define EAI_MAX 14 - -/* - * Flag values for getaddrinfo() - */ -#ifdef AI_PASSIVE -#undef AI_PASSIVE -#undef AI_CANONNAME -#undef AI_NUMERICHOST -#undef AI_MASK -#undef AI_ALL -#undef AI_V4MAPPED_CFG -#undef AI_ADDRCONFIG -#undef AI_V4MAPPED -#undef AI_DEFAULT -#endif /* AI_PASSIVE */ - -#define AI_PASSIVE 0x00000001 /* get address to use bind() */ -#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ -#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ -/* valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) - -#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ -#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ -#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ -#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ -/* special recommended flags for getipnodebyname */ -#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) - -#endif /* !HAVE_GETADDRINFO */ - -#ifndef HAVE_GETNAMEINFO - -/* - * Constants for getnameinfo() - */ -#ifndef NI_MAXHOST -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 -#endif /* !NI_MAXHOST */ - -/* - * Flag values for getnameinfo() - */ -#ifndef NI_NOFQDN -#define NI_NOFQDN 0x00000001 -#define NI_NUMERICHOST 0x00000002 -#define NI_NAMEREQD 0x00000004 -#define NI_NUMERICSERV 0x00000008 -#define NI_DGRAM 0x00000010 -#endif /* !NI_NOFQDN */ - -#endif /* !HAVE_GETNAMEINFO */ - -#ifndef HAVE_ADDRINFO -struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ -}; -#endif /* !HAVE_ADDRINFO */ - -#ifndef HAVE_SOCKADDR_STORAGE -/* - * RFC 2553: protocol-independent placeholder for socket addresses - */ -#define _SS_MAXSIZE 128 -#ifdef HAVE_LONG_LONG -#define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG)) -#else -#define _SS_ALIGNSIZE (sizeof(double)) -#endif /* HAVE_LONG_LONG */ -#define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2) -#define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \ - _SS_PAD1SIZE - _SS_ALIGNSIZE) - -struct sockaddr_storage { -#ifdef HAVE_SOCKADDR_SA_LEN - unsigned char ss_len; /* address length */ - unsigned char ss_family; /* address family */ -#else - unsigned short ss_family; /* address family */ -#endif /* HAVE_SOCKADDR_SA_LEN */ - char __ss_pad1[_SS_PAD1SIZE]; -#ifdef HAVE_LONG_LONG - PY_LONG_LONG __ss_align; /* force desired structure storage alignment */ -#else - double __ss_align; /* force desired structure storage alignment */ -#endif /* HAVE_LONG_LONG */ - char __ss_pad2[_SS_PAD2SIZE]; -}; -#endif /* !HAVE_SOCKADDR_STORAGE */ - -#ifdef __cplusplus -extern "C" { -#endif -extern void freehostent Py_PROTO((struct hostent *)); -#ifdef __cplusplus -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/arraymodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/arraymodule.c deleted file mode 100644 index 572b142..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/arraymodule.c +++ /dev/null @@ -1,2261 +0,0 @@ -/* Array object implementation */ - -/* An array is a uniform list -- all items have the same type. - The item type is restricted to simple C types like int or float */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" - -#ifdef STDC_HEADERS -#include -#else /* !STDC_HEADERS */ -#ifdef HAVE_SYS_TYPES_H -#include /* For size_t */ -#endif /* HAVE_SYS_TYPES_H */ -#endif /* !STDC_HEADERS */ - -struct arrayobject; /* Forward */ - -/* All possible arraydescr values are defined in the vector "descriptors" - * below. That's defined later because the appropriate get and set - * functions aren't visible yet. - */ -struct arraydescr { - int typecode; - int itemsize; - PyObject * (*getitem)(struct arrayobject *, Py_ssize_t); - int (*setitem)(struct arrayobject *, Py_ssize_t, PyObject *); -}; - -typedef struct arrayobject { - PyObject_VAR_HEAD - char *ob_item; - Py_ssize_t allocated; - struct arraydescr *ob_descr; - PyObject *weakreflist; /* List of weak references */ -} arrayobject; - -static PyTypeObject Arraytype; - -#define array_Check(op) PyObject_TypeCheck(op, &Arraytype) -#define array_CheckExact(op) (Py_TYPE(op) == &Arraytype) - -static int -array_resize(arrayobject *self, Py_ssize_t newsize) -{ - char *items; - size_t _new_size; - - /* Bypass realloc() when a previous overallocation is large enough - to accommodate the newsize. If the newsize is 16 smaller than the - current size, then proceed with the realloc() to shrink the list. - */ - - if (self->allocated >= newsize && - Py_SIZE(self) < newsize + 16 && - self->ob_item != NULL) { - Py_SIZE(self) = newsize; - return 0; - } - - /* This over-allocates proportional to the array size, making room - * for additional growth. The over-allocation is mild, but is - * enough to give linear-time amortized behavior over a long - * sequence of appends() in the presence of a poorly-performing - * system realloc(). - * The growth pattern is: 0, 4, 8, 16, 25, 34, 46, 56, 67, 79, ... - * Note, the pattern starts out the same as for lists but then - * grows at a smaller rate so that larger arrays only overallocate - * by about 1/16th -- this is done because arrays are presumed to be more - * memory critical. - */ - - _new_size = (newsize >> 4) + (Py_SIZE(self) < 8 ? 3 : 7) + newsize; - items = self->ob_item; - /* XXX The following multiplication and division does not optimize away - like it does for lists since the size is not known at compile time */ - if (_new_size <= ((~(size_t)0) / self->ob_descr->itemsize)) - PyMem_RESIZE(items, char, (_new_size * self->ob_descr->itemsize)); - else - items = NULL; - if (items == NULL) { - PyErr_NoMemory(); - return -1; - } - self->ob_item = items; - Py_SIZE(self) = newsize; - self->allocated = _new_size; - return 0; -} - -/**************************************************************************** -Get and Set functions for each type. -A Get function takes an arrayobject* and an integer index, returning the -array value at that index wrapped in an appropriate PyObject*. -A Set function takes an arrayobject, integer index, and PyObject*; sets -the array value at that index to the raw C data extracted from the PyObject*, -and returns 0 if successful, else nonzero on failure (PyObject* not of an -appropriate type or value). -Note that the basic Get and Set functions do NOT check that the index is -in bounds; that's the responsibility of the caller. -****************************************************************************/ - -static PyObject * -c_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyString_FromStringAndSize(&((char *)ap->ob_item)[i], 1); -} - -static int -c_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - char x; - if (!PyArg_Parse(v, "c;array item must be char", &x)) - return -1; - if (i >= 0) - ((char *)ap->ob_item)[i] = x; - return 0; -} - -static PyObject * -b_getitem(arrayobject *ap, Py_ssize_t i) -{ - long x = ((char *)ap->ob_item)[i]; - if (x >= 128) - x -= 256; - return PyInt_FromLong(x); -} - -static int -b_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - short x; - /* PyArg_Parse's 'b' formatter is for an unsigned char, therefore - must use the next size up that is signed ('h') and manually do - the overflow checking */ - if (!PyArg_Parse(v, "h;array item must be integer", &x)) - return -1; - else if (x < -128) { - PyErr_SetString(PyExc_OverflowError, - "signed char is less than minimum"); - return -1; - } - else if (x > 127) { - PyErr_SetString(PyExc_OverflowError, - "signed char is greater than maximum"); - return -1; - } - if (i >= 0) - ((char *)ap->ob_item)[i] = (char)x; - return 0; -} - -static PyObject * -BB_getitem(arrayobject *ap, Py_ssize_t i) -{ - long x = ((unsigned char *)ap->ob_item)[i]; - return PyInt_FromLong(x); -} - -static int -BB_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - unsigned char x; - /* 'B' == unsigned char, maps to PyArg_Parse's 'b' formatter */ - if (!PyArg_Parse(v, "b;array item must be integer", &x)) - return -1; - if (i >= 0) - ((char *)ap->ob_item)[i] = x; - return 0; -} - -#ifdef Py_USING_UNICODE -static PyObject * -u_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyUnicode_FromUnicode(&((Py_UNICODE *) ap->ob_item)[i], 1); -} - -static int -u_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - Py_UNICODE *p; - Py_ssize_t len; - - if (!PyArg_Parse(v, "u#;array item must be unicode character", &p, &len)) - return -1; - if (len != 1) { - PyErr_SetString(PyExc_TypeError, - "array item must be unicode character"); - return -1; - } - if (i >= 0) - ((Py_UNICODE *)ap->ob_item)[i] = p[0]; - return 0; -} -#endif - -static PyObject * -h_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyInt_FromLong((long) ((short *)ap->ob_item)[i]); -} - -static int -h_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - short x; - /* 'h' == signed short, maps to PyArg_Parse's 'h' formatter */ - if (!PyArg_Parse(v, "h;array item must be integer", &x)) - return -1; - if (i >= 0) - ((short *)ap->ob_item)[i] = x; - return 0; -} - -static PyObject * -HH_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyInt_FromLong((long) ((unsigned short *)ap->ob_item)[i]); -} - -static int -HH_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - int x; - /* PyArg_Parse's 'h' formatter is for a signed short, therefore - must use the next size up and manually do the overflow checking */ - if (!PyArg_Parse(v, "i;array item must be integer", &x)) - return -1; - else if (x < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned short is less than minimum"); - return -1; - } - else if (x > USHRT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "unsigned short is greater than maximum"); - return -1; - } - if (i >= 0) - ((short *)ap->ob_item)[i] = (short)x; - return 0; -} - -static PyObject * -i_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyInt_FromLong((long) ((int *)ap->ob_item)[i]); -} - -static int -i_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - int x; - /* 'i' == signed int, maps to PyArg_Parse's 'i' formatter */ - if (!PyArg_Parse(v, "i;array item must be integer", &x)) - return -1; - if (i >= 0) - ((int *)ap->ob_item)[i] = x; - return 0; -} - -static PyObject * -II_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyLong_FromUnsignedLong( - (unsigned long) ((unsigned int *)ap->ob_item)[i]); -} - -static int -II_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - unsigned long x; - if (PyLong_Check(v)) { - x = PyLong_AsUnsignedLong(v); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return -1; - } - else { - long y; - if (!PyArg_Parse(v, "l;array item must be integer", &y)) - return -1; - if (y < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned int is less than minimum"); - return -1; - } - x = (unsigned long)y; - - } - if (x > UINT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "unsigned int is greater than maximum"); - return -1; - } - - if (i >= 0) - ((unsigned int *)ap->ob_item)[i] = (unsigned int)x; - return 0; -} - -static PyObject * -l_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyInt_FromLong(((long *)ap->ob_item)[i]); -} - -static int -l_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - long x; - if (!PyArg_Parse(v, "l;array item must be integer", &x)) - return -1; - if (i >= 0) - ((long *)ap->ob_item)[i] = x; - return 0; -} - -static PyObject * -LL_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyLong_FromUnsignedLong(((unsigned long *)ap->ob_item)[i]); -} - -static int -LL_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - unsigned long x; - if (PyLong_Check(v)) { - x = PyLong_AsUnsignedLong(v); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return -1; - } - else { - long y; - if (!PyArg_Parse(v, "l;array item must be integer", &y)) - return -1; - if (y < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned long is less than minimum"); - return -1; - } - x = (unsigned long)y; - - } - if (x > ULONG_MAX) { - PyErr_SetString(PyExc_OverflowError, - "unsigned long is greater than maximum"); - return -1; - } - - if (i >= 0) - ((unsigned long *)ap->ob_item)[i] = x; - return 0; -} - -static PyObject * -f_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyFloat_FromDouble((double) ((float *)ap->ob_item)[i]); -} - -static int -f_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - float x; - if (!PyArg_Parse(v, "f;array item must be float", &x)) - return -1; - if (i >= 0) - ((float *)ap->ob_item)[i] = x; - return 0; -} - -static PyObject * -d_getitem(arrayobject *ap, Py_ssize_t i) -{ - return PyFloat_FromDouble(((double *)ap->ob_item)[i]); -} - -static int -d_setitem(arrayobject *ap, Py_ssize_t i, PyObject *v) -{ - double x; - if (!PyArg_Parse(v, "d;array item must be float", &x)) - return -1; - if (i >= 0) - ((double *)ap->ob_item)[i] = x; - return 0; -} - -/* Description of types */ -static struct arraydescr descriptors[] = { - {'c', sizeof(char), c_getitem, c_setitem}, - {'b', sizeof(char), b_getitem, b_setitem}, - {'B', sizeof(char), BB_getitem, BB_setitem}, -#ifdef Py_USING_UNICODE - {'u', sizeof(Py_UNICODE), u_getitem, u_setitem}, -#endif - {'h', sizeof(short), h_getitem, h_setitem}, - {'H', sizeof(short), HH_getitem, HH_setitem}, - {'i', sizeof(int), i_getitem, i_setitem}, - {'I', sizeof(int), II_getitem, II_setitem}, - {'l', sizeof(long), l_getitem, l_setitem}, - {'L', sizeof(long), LL_getitem, LL_setitem}, - {'f', sizeof(float), f_getitem, f_setitem}, - {'d', sizeof(double), d_getitem, d_setitem}, - {'\0', 0, 0, 0} /* Sentinel */ -}; - -/**************************************************************************** -Implementations of array object methods. -****************************************************************************/ - -static PyObject * -newarrayobject(PyTypeObject *type, Py_ssize_t size, struct arraydescr *descr) -{ - arrayobject *op; - size_t nbytes; - - if (size < 0) { - PyErr_BadInternalCall(); - return NULL; - } - - nbytes = size * descr->itemsize; - /* Check for overflow */ - if (nbytes / descr->itemsize != (size_t)size) { - return PyErr_NoMemory(); - } - op = (arrayobject *) type->tp_alloc(type, 0); - if (op == NULL) { - return NULL; - } - op->ob_descr = descr; - op->allocated = size; - op->weakreflist = NULL; - Py_SIZE(op) = size; - if (size <= 0) { - op->ob_item = NULL; - } - else { - op->ob_item = PyMem_NEW(char, nbytes); - if (op->ob_item == NULL) { - Py_DECREF(op); - return PyErr_NoMemory(); - } - } - return (PyObject *) op; -} - -static PyObject * -getarrayitem(PyObject *op, Py_ssize_t i) -{ - register arrayobject *ap; - assert(array_Check(op)); - ap = (arrayobject *)op; - assert(i>=0 && iob_descr->getitem)(ap, i); -} - -static int -ins1(arrayobject *self, Py_ssize_t where, PyObject *v) -{ - char *items; - Py_ssize_t n = Py_SIZE(self); - if (v == NULL) { - PyErr_BadInternalCall(); - return -1; - } - if ((*self->ob_descr->setitem)(self, -1, v) < 0) - return -1; - - if (array_resize(self, n+1) == -1) - return -1; - items = self->ob_item; - if (where < 0) { - where += n; - if (where < 0) - where = 0; - } - if (where > n) - where = n; - /* appends don't need to call memmove() */ - if (where != n) - memmove(items + (where+1)*self->ob_descr->itemsize, - items + where*self->ob_descr->itemsize, - (n-where)*self->ob_descr->itemsize); - return (*self->ob_descr->setitem)(self, where, v); -} - -/* Methods */ - -static void -array_dealloc(arrayobject *op) -{ - if (op->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) op); - if (op->ob_item != NULL) - PyMem_DEL(op->ob_item); - Py_TYPE(op)->tp_free((PyObject *)op); -} - -static PyObject * -array_richcompare(PyObject *v, PyObject *w, int op) -{ - arrayobject *va, *wa; - PyObject *vi = NULL; - PyObject *wi = NULL; - Py_ssize_t i, k; - PyObject *res; - - if (!array_Check(v) || !array_Check(w)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - va = (arrayobject *)v; - wa = (arrayobject *)w; - - if (Py_SIZE(va) != Py_SIZE(wa) && (op == Py_EQ || op == Py_NE)) { - /* Shortcut: if the lengths differ, the arrays differ */ - if (op == Py_EQ) - res = Py_False; - else - res = Py_True; - Py_INCREF(res); - return res; - } - - /* Search for the first index where items are different */ - k = 1; - for (i = 0; i < Py_SIZE(va) && i < Py_SIZE(wa); i++) { - vi = getarrayitem(v, i); - wi = getarrayitem(w, i); - if (vi == NULL || wi == NULL) { - Py_XDECREF(vi); - Py_XDECREF(wi); - return NULL; - } - k = PyObject_RichCompareBool(vi, wi, Py_EQ); - if (k == 0) - break; /* Keeping vi and wi alive! */ - Py_DECREF(vi); - Py_DECREF(wi); - if (k < 0) - return NULL; - } - - if (k) { - /* No more items to compare -- compare sizes */ - Py_ssize_t vs = Py_SIZE(va); - Py_ssize_t ws = Py_SIZE(wa); - int cmp; - switch (op) { - case Py_LT: cmp = vs < ws; break; - case Py_LE: cmp = vs <= ws; break; - case Py_EQ: cmp = vs == ws; break; - case Py_NE: cmp = vs != ws; break; - case Py_GT: cmp = vs > ws; break; - case Py_GE: cmp = vs >= ws; break; - default: return NULL; /* cannot happen */ - } - if (cmp) - res = Py_True; - else - res = Py_False; - Py_INCREF(res); - return res; - } - - /* We have an item that differs. First, shortcuts for EQ/NE */ - if (op == Py_EQ) { - Py_INCREF(Py_False); - res = Py_False; - } - else if (op == Py_NE) { - Py_INCREF(Py_True); - res = Py_True; - } - else { - /* Compare the final item again using the proper operator */ - res = PyObject_RichCompare(vi, wi, op); - } - Py_DECREF(vi); - Py_DECREF(wi); - return res; -} - -static Py_ssize_t -array_length(arrayobject *a) -{ - return Py_SIZE(a); -} - -static PyObject * -array_item(arrayobject *a, Py_ssize_t i) -{ - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "array index out of range"); - return NULL; - } - return getarrayitem((PyObject *)a, i); -} - -static PyObject * -array_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh) -{ - arrayobject *np; - if (ilow < 0) - ilow = 0; - else if (ilow > Py_SIZE(a)) - ilow = Py_SIZE(a); - if (ihigh < 0) - ihigh = 0; - if (ihigh < ilow) - ihigh = ilow; - else if (ihigh > Py_SIZE(a)) - ihigh = Py_SIZE(a); - np = (arrayobject *) newarrayobject(&Arraytype, ihigh - ilow, a->ob_descr); - if (np == NULL) - return NULL; - memcpy(np->ob_item, a->ob_item + ilow * a->ob_descr->itemsize, - (ihigh-ilow) * a->ob_descr->itemsize); - return (PyObject *)np; -} - -static PyObject * -array_copy(arrayobject *a, PyObject *unused) -{ - return array_slice(a, 0, Py_SIZE(a)); -} - -PyDoc_STRVAR(copy_doc, -"copy(array)\n\ -\n\ - Return a copy of the array."); - -static PyObject * -array_concat(arrayobject *a, PyObject *bb) -{ - Py_ssize_t size; - arrayobject *np; - if (!array_Check(bb)) { - PyErr_Format(PyExc_TypeError, - "can only append array (not \"%.200s\") to array", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((arrayobject *)bb) - if (a->ob_descr != b->ob_descr) { - PyErr_BadArgument(); - return NULL; - } - if (Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b)) { - return PyErr_NoMemory(); - } - size = Py_SIZE(a) + Py_SIZE(b); - np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr); - if (np == NULL) { - return NULL; - } - memcpy(np->ob_item, a->ob_item, Py_SIZE(a)*a->ob_descr->itemsize); - memcpy(np->ob_item + Py_SIZE(a)*a->ob_descr->itemsize, - b->ob_item, Py_SIZE(b)*b->ob_descr->itemsize); - return (PyObject *)np; -#undef b -} - -static PyObject * -array_repeat(arrayobject *a, Py_ssize_t n) -{ - Py_ssize_t i; - Py_ssize_t size; - arrayobject *np; - char *p; - Py_ssize_t nbytes; - if (n < 0) - n = 0; - if ((Py_SIZE(a) != 0) && (n > PY_SSIZE_T_MAX / Py_SIZE(a))) { - return PyErr_NoMemory(); - } - size = Py_SIZE(a) * n; - np = (arrayobject *) newarrayobject(&Arraytype, size, a->ob_descr); - if (np == NULL) - return NULL; - p = np->ob_item; - nbytes = Py_SIZE(a) * a->ob_descr->itemsize; - for (i = 0; i < n; i++) { - memcpy(p, a->ob_item, nbytes); - p += nbytes; - } - return (PyObject *) np; -} - -static int -array_ass_slice(arrayobject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v) -{ - char *item; - Py_ssize_t n; /* Size of replacement array */ - Py_ssize_t d; /* Change in size */ -#define b ((arrayobject *)v) - if (v == NULL) - n = 0; - else if (array_Check(v)) { - n = Py_SIZE(b); - if (a == b) { - /* Special case "a[i:j] = a" -- copy b first */ - int ret; - v = array_slice(b, 0, n); - if (!v) - return -1; - ret = array_ass_slice(a, ilow, ihigh, v); - Py_DECREF(v); - return ret; - } - if (b->ob_descr != a->ob_descr) { - PyErr_BadArgument(); - return -1; - } - } - else { - PyErr_Format(PyExc_TypeError, - "can only assign array (not \"%.200s\") to array slice", - Py_TYPE(v)->tp_name); - return -1; - } - if (ilow < 0) - ilow = 0; - else if (ilow > Py_SIZE(a)) - ilow = Py_SIZE(a); - if (ihigh < 0) - ihigh = 0; - if (ihigh < ilow) - ihigh = ilow; - else if (ihigh > Py_SIZE(a)) - ihigh = Py_SIZE(a); - item = a->ob_item; - d = n - (ihigh-ilow); - if (d < 0) { /* Delete -d items */ - memmove(item + (ihigh+d)*a->ob_descr->itemsize, - item + ihigh*a->ob_descr->itemsize, - (Py_SIZE(a)-ihigh)*a->ob_descr->itemsize); - Py_SIZE(a) += d; - PyMem_RESIZE(item, char, Py_SIZE(a)*a->ob_descr->itemsize); - /* Can't fail */ - a->ob_item = item; - a->allocated = Py_SIZE(a); - } - else if (d > 0) { /* Insert d items */ - PyMem_RESIZE(item, char, - (Py_SIZE(a) + d)*a->ob_descr->itemsize); - if (item == NULL) { - PyErr_NoMemory(); - return -1; - } - memmove(item + (ihigh+d)*a->ob_descr->itemsize, - item + ihigh*a->ob_descr->itemsize, - (Py_SIZE(a)-ihigh)*a->ob_descr->itemsize); - a->ob_item = item; - Py_SIZE(a) += d; - a->allocated = Py_SIZE(a); - } - if (n > 0) - memcpy(item + ilow*a->ob_descr->itemsize, b->ob_item, - n*b->ob_descr->itemsize); - return 0; -#undef b -} - -static int -array_ass_item(arrayobject *a, Py_ssize_t i, PyObject *v) -{ - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, - "array assignment index out of range"); - return -1; - } - if (v == NULL) - return array_ass_slice(a, i, i+1, v); - return (*a->ob_descr->setitem)(a, i, v); -} - -static int -setarrayitem(PyObject *a, Py_ssize_t i, PyObject *v) -{ - assert(array_Check(a)); - return array_ass_item((arrayobject *)a, i, v); -} - -static int -array_iter_extend(arrayobject *self, PyObject *bb) -{ - PyObject *it, *v; - - it = PyObject_GetIter(bb); - if (it == NULL) - return -1; - - while ((v = PyIter_Next(it)) != NULL) { - if (ins1(self, Py_SIZE(self), v) != 0) { - Py_DECREF(v); - Py_DECREF(it); - return -1; - } - Py_DECREF(v); - } - Py_DECREF(it); - if (PyErr_Occurred()) - return -1; - return 0; -} - -static int -array_do_extend(arrayobject *self, PyObject *bb) -{ - Py_ssize_t size; - char *old_item; - - if (!array_Check(bb)) - return array_iter_extend(self, bb); -#define b ((arrayobject *)bb) - if (self->ob_descr != b->ob_descr) { - PyErr_SetString(PyExc_TypeError, - "can only extend with array of same kind"); - return -1; - } - if ((Py_SIZE(self) > PY_SSIZE_T_MAX - Py_SIZE(b)) || - ((Py_SIZE(self) + Py_SIZE(b)) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { - PyErr_NoMemory(); - return -1; - } - size = Py_SIZE(self) + Py_SIZE(b); - old_item = self->ob_item; - PyMem_RESIZE(self->ob_item, char, size*self->ob_descr->itemsize); - if (self->ob_item == NULL) { - self->ob_item = old_item; - PyErr_NoMemory(); - return -1; - } - memcpy(self->ob_item + Py_SIZE(self)*self->ob_descr->itemsize, - b->ob_item, Py_SIZE(b)*b->ob_descr->itemsize); - Py_SIZE(self) = size; - self->allocated = size; - - return 0; -#undef b -} - -static PyObject * -array_inplace_concat(arrayobject *self, PyObject *bb) -{ - if (!array_Check(bb)) { - PyErr_Format(PyExc_TypeError, - "can only extend array with array (not \"%.200s\")", - Py_TYPE(bb)->tp_name); - return NULL; - } - if (array_do_extend(self, bb) == -1) - return NULL; - Py_INCREF(self); - return (PyObject *)self; -} - -static PyObject * -array_inplace_repeat(arrayobject *self, Py_ssize_t n) -{ - char *items, *p; - Py_ssize_t size, i; - - if (Py_SIZE(self) > 0) { - if (n < 0) - n = 0; - items = self->ob_item; - if ((self->ob_descr->itemsize != 0) && - (Py_SIZE(self) > PY_SSIZE_T_MAX / self->ob_descr->itemsize)) { - return PyErr_NoMemory(); - } - size = Py_SIZE(self) * self->ob_descr->itemsize; - if (n == 0) { - PyMem_FREE(items); - self->ob_item = NULL; - Py_SIZE(self) = 0; - self->allocated = 0; - } - else { - if (size > PY_SSIZE_T_MAX / n) { - return PyErr_NoMemory(); - } - PyMem_RESIZE(items, char, n * size); - if (items == NULL) - return PyErr_NoMemory(); - p = items; - for (i = 1; i < n; i++) { - p += size; - memcpy(p, items, size); - } - self->ob_item = items; - Py_SIZE(self) *= n; - self->allocated = Py_SIZE(self); - } - } - Py_INCREF(self); - return (PyObject *)self; -} - - -static PyObject * -ins(arrayobject *self, Py_ssize_t where, PyObject *v) -{ - if (ins1(self, where, v) != 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -array_count(arrayobject *self, PyObject *v) -{ - Py_ssize_t count = 0; - Py_ssize_t i; - - for (i = 0; i < Py_SIZE(self); i++) { - PyObject *selfi = getarrayitem((PyObject *)self, i); - int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); - Py_DECREF(selfi); - if (cmp > 0) - count++; - else if (cmp < 0) - return NULL; - } - return PyInt_FromSsize_t(count); -} - -PyDoc_STRVAR(count_doc, -"count(x)\n\ -\n\ -Return number of occurrences of x in the array."); - -static PyObject * -array_index(arrayobject *self, PyObject *v) -{ - Py_ssize_t i; - - for (i = 0; i < Py_SIZE(self); i++) { - PyObject *selfi = getarrayitem((PyObject *)self, i); - int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); - Py_DECREF(selfi); - if (cmp > 0) { - return PyInt_FromLong((long)i); - } - else if (cmp < 0) - return NULL; - } - PyErr_SetString(PyExc_ValueError, "array.index(x): x not in list"); - return NULL; -} - -PyDoc_STRVAR(index_doc, -"index(x)\n\ -\n\ -Return index of first occurrence of x in the array."); - -static int -array_contains(arrayobject *self, PyObject *v) -{ - Py_ssize_t i; - int cmp; - - for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(self); i++) { - PyObject *selfi = getarrayitem((PyObject *)self, i); - cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); - Py_DECREF(selfi); - } - return cmp; -} - -static PyObject * -array_remove(arrayobject *self, PyObject *v) -{ - int i; - - for (i = 0; i < Py_SIZE(self); i++) { - PyObject *selfi = getarrayitem((PyObject *)self,i); - int cmp = PyObject_RichCompareBool(selfi, v, Py_EQ); - Py_DECREF(selfi); - if (cmp > 0) { - if (array_ass_slice(self, i, i+1, - (PyObject *)NULL) != 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; - } - else if (cmp < 0) - return NULL; - } - PyErr_SetString(PyExc_ValueError, "array.remove(x): x not in list"); - return NULL; -} - -PyDoc_STRVAR(remove_doc, -"remove(x)\n\ -\n\ -Remove the first occurrence of x in the array."); - -static PyObject * -array_pop(arrayobject *self, PyObject *args) -{ - Py_ssize_t i = -1; - PyObject *v; - if (!PyArg_ParseTuple(args, "|n:pop", &i)) - return NULL; - if (Py_SIZE(self) == 0) { - /* Special-case most common failure cause */ - PyErr_SetString(PyExc_IndexError, "pop from empty array"); - return NULL; - } - if (i < 0) - i += Py_SIZE(self); - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "pop index out of range"); - return NULL; - } - v = getarrayitem((PyObject *)self,i); - if (array_ass_slice(self, i, i+1, (PyObject *)NULL) != 0) { - Py_DECREF(v); - return NULL; - } - return v; -} - -PyDoc_STRVAR(pop_doc, -"pop([i])\n\ -\n\ -Return the i-th element and delete it from the array. i defaults to -1."); - -static PyObject * -array_extend(arrayobject *self, PyObject *bb) -{ - if (array_do_extend(self, bb) == -1) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(extend_doc, -"extend(array or iterable)\n\ -\n\ - Append items to the end of the array."); - -static PyObject * -array_insert(arrayobject *self, PyObject *args) -{ - Py_ssize_t i; - PyObject *v; - if (!PyArg_ParseTuple(args, "nO:insert", &i, &v)) - return NULL; - return ins(self, i, v); -} - -PyDoc_STRVAR(insert_doc, -"insert(i,x)\n\ -\n\ -Insert a new item x into the array before position i."); - - -static PyObject * -array_buffer_info(arrayobject *self, PyObject *unused) -{ - PyObject* retval = NULL; - retval = PyTuple_New(2); - if (!retval) - return NULL; - - PyTuple_SET_ITEM(retval, 0, PyLong_FromVoidPtr(self->ob_item)); - PyTuple_SET_ITEM(retval, 1, PyInt_FromLong((long)(Py_SIZE(self)))); - - return retval; -} - -PyDoc_STRVAR(buffer_info_doc, -"buffer_info() -> (address, length)\n\ -\n\ -Return a tuple (address, length) giving the current memory address and\n\ -the length in items of the buffer used to hold array's contents\n\ -The length should be multiplied by the itemsize attribute to calculate\n\ -the buffer length in bytes."); - - -static PyObject * -array_append(arrayobject *self, PyObject *v) -{ - return ins(self, Py_SIZE(self), v); -} - -PyDoc_STRVAR(append_doc, -"append(x)\n\ -\n\ -Append new value x to the end of the array."); - - -static PyObject * -array_byteswap(arrayobject *self, PyObject *unused) -{ - char *p; - Py_ssize_t i; - - switch (self->ob_descr->itemsize) { - case 1: - break; - case 2: - for (p = self->ob_item, i = Py_SIZE(self); --i >= 0; p += 2) { - char p0 = p[0]; - p[0] = p[1]; - p[1] = p0; - } - break; - case 4: - for (p = self->ob_item, i = Py_SIZE(self); --i >= 0; p += 4) { - char p0 = p[0]; - char p1 = p[1]; - p[0] = p[3]; - p[1] = p[2]; - p[2] = p1; - p[3] = p0; - } - break; - case 8: - for (p = self->ob_item, i = Py_SIZE(self); --i >= 0; p += 8) { - char p0 = p[0]; - char p1 = p[1]; - char p2 = p[2]; - char p3 = p[3]; - p[0] = p[7]; - p[1] = p[6]; - p[2] = p[5]; - p[3] = p[4]; - p[4] = p3; - p[5] = p2; - p[6] = p1; - p[7] = p0; - } - break; - default: - PyErr_SetString(PyExc_RuntimeError, - "don't know how to byteswap this array type"); - return NULL; - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(byteswap_doc, -"byteswap()\n\ -\n\ -Byteswap all items of the array. If the items in the array are not 1, 2,\n\ -4, or 8 bytes in size, RuntimeError is raised."); - -static PyObject * -array_reverse(arrayobject *self, PyObject *unused) -{ - register Py_ssize_t itemsize = self->ob_descr->itemsize; - register char *p, *q; - /* little buffer to hold items while swapping */ - char tmp[256]; /* 8 is probably enough -- but why skimp */ - assert((size_t)itemsize <= sizeof(tmp)); - - if (Py_SIZE(self) > 1) { - for (p = self->ob_item, - q = self->ob_item + (Py_SIZE(self) - 1)*itemsize; - p < q; - p += itemsize, q -= itemsize) { - /* memory areas guaranteed disjoint, so memcpy - * is safe (& memmove may be slower). - */ - memcpy(tmp, p, itemsize); - memcpy(p, q, itemsize); - memcpy(q, tmp, itemsize); - } - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(reverse_doc, -"reverse()\n\ -\n\ -Reverse the order of the items in the array."); - -static PyObject * -array_fromfile(arrayobject *self, PyObject *args) -{ - PyObject *f; - Py_ssize_t n; - FILE *fp; - if (!PyArg_ParseTuple(args, "On:fromfile", &f, &n)) - return NULL; - fp = PyFile_AsFile(f); - if (fp == NULL) { - PyErr_SetString(PyExc_TypeError, "arg1 must be open file"); - return NULL; - } - if (n > 0) { - char *item = self->ob_item; - Py_ssize_t itemsize = self->ob_descr->itemsize; - size_t nread; - Py_ssize_t newlength; - size_t newbytes; - /* Be careful here about overflow */ - if ((newlength = Py_SIZE(self) + n) <= 0 || - (newbytes = newlength * itemsize) / itemsize != - (size_t)newlength) - goto nomem; - PyMem_RESIZE(item, char, newbytes); - if (item == NULL) { - nomem: - PyErr_NoMemory(); - return NULL; - } - self->ob_item = item; - Py_SIZE(self) += n; - self->allocated = Py_SIZE(self); - nread = fread(item + (Py_SIZE(self) - n) * itemsize, - itemsize, n, fp); - if (nread < (size_t)n) { - Py_SIZE(self) -= (n - nread); - PyMem_RESIZE(item, char, Py_SIZE(self)*itemsize); - self->ob_item = item; - self->allocated = Py_SIZE(self); - if (ferror(fp)) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(fp); - } - else { - PyErr_SetString(PyExc_EOFError, - "not enough items in file"); - } - return NULL; - } - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(fromfile_doc, -"fromfile(f, n)\n\ -\n\ -Read n objects from the file object f and append them to the end of the\n\ -array. Also called as read."); - - -static PyObject * -array_fromfile_as_read(arrayobject *self, PyObject *args) -{ - if (PyErr_WarnPy3k("array.read() not supported in 3.x; " - "use array.fromfile()", 1) < 0) - return NULL; - return array_fromfile(self, args); -} - - -static PyObject * -array_tofile(arrayobject *self, PyObject *f) -{ - FILE *fp; - - fp = PyFile_AsFile(f); - if (fp == NULL) { - PyErr_SetString(PyExc_TypeError, "arg must be open file"); - return NULL; - } - if (self->ob_size > 0) { - if (fwrite(self->ob_item, self->ob_descr->itemsize, - self->ob_size, fp) != (size_t)self->ob_size) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(fp); - return NULL; - } - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(tofile_doc, -"tofile(f)\n\ -\n\ -Write all items (as machine values) to the file object f. Also called as\n\ -write."); - - -static PyObject * -array_tofile_as_write(arrayobject *self, PyObject *f) -{ - if (PyErr_WarnPy3k("array.write() not supported in 3.x; " - "use array.tofile()", 1) < 0) - return NULL; - return array_tofile(self, f); -} - - -static PyObject * -array_fromlist(arrayobject *self, PyObject *list) -{ - Py_ssize_t n; - Py_ssize_t itemsize = self->ob_descr->itemsize; - - if (!PyList_Check(list)) { - PyErr_SetString(PyExc_TypeError, "arg must be list"); - return NULL; - } - n = PyList_Size(list); - if (n > 0) { - char *item = self->ob_item; - Py_ssize_t i; - PyMem_RESIZE(item, char, (Py_SIZE(self) + n) * itemsize); - if (item == NULL) { - PyErr_NoMemory(); - return NULL; - } - self->ob_item = item; - Py_SIZE(self) += n; - self->allocated = Py_SIZE(self); - for (i = 0; i < n; i++) { - PyObject *v = PyList_GetItem(list, i); - if ((*self->ob_descr->setitem)(self, - Py_SIZE(self) - n + i, v) != 0) { - Py_SIZE(self) -= n; - if (itemsize && (self->ob_size > PY_SSIZE_T_MAX / itemsize)) { - return PyErr_NoMemory(); - } - PyMem_RESIZE(item, char, - Py_SIZE(self) * itemsize); - self->ob_item = item; - self->allocated = Py_SIZE(self); - return NULL; - } - } - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(fromlist_doc, -"fromlist(list)\n\ -\n\ -Append items to array from list."); - - -static PyObject * -array_tolist(arrayobject *self, PyObject *unused) -{ - PyObject *list = PyList_New(Py_SIZE(self)); - Py_ssize_t i; - - if (list == NULL) - return NULL; - for (i = 0; i < Py_SIZE(self); i++) { - PyObject *v = getarrayitem((PyObject *)self, i); - if (v == NULL) { - Py_DECREF(list); - return NULL; - } - PyList_SetItem(list, i, v); - } - return list; -} - -PyDoc_STRVAR(tolist_doc, -"tolist() -> list\n\ -\n\ -Convert array to an ordinary list with the same items."); - - -static PyObject * -array_fromstring(arrayobject *self, PyObject *args) -{ - char *str; - Py_ssize_t n; - int itemsize = self->ob_descr->itemsize; - if (!PyArg_ParseTuple(args, "s#:fromstring", &str, &n)) - return NULL; - if (n % itemsize != 0) { - PyErr_SetString(PyExc_ValueError, - "string length not a multiple of item size"); - return NULL; - } - n = n / itemsize; - if (n > 0) { - char *item = self->ob_item; - if ((n > PY_SSIZE_T_MAX - Py_SIZE(self)) || - ((Py_SIZE(self) + n) > PY_SSIZE_T_MAX / itemsize)) { - return PyErr_NoMemory(); - } - PyMem_RESIZE(item, char, (Py_SIZE(self) + n) * itemsize); - if (item == NULL) { - PyErr_NoMemory(); - return NULL; - } - self->ob_item = item; - Py_SIZE(self) += n; - self->allocated = Py_SIZE(self); - memcpy(item + (Py_SIZE(self) - n) * itemsize, - str, itemsize*n); - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(fromstring_doc, -"fromstring(string)\n\ -\n\ -Appends items from the string, interpreting it as an array of machine\n\ -values,as if it had been read from a file using the fromfile() method)."); - - -static PyObject * -array_tostring(arrayobject *self, PyObject *unused) -{ - if (self->ob_size <= PY_SSIZE_T_MAX / self->ob_descr->itemsize) { - return PyString_FromStringAndSize(self->ob_item, - Py_SIZE(self) * self->ob_descr->itemsize); - } else { - return PyErr_NoMemory(); - } -} - -PyDoc_STRVAR(tostring_doc, -"tostring() -> string\n\ -\n\ -Convert the array to an array of machine values and return the string\n\ -representation."); - - - -#ifdef Py_USING_UNICODE -static PyObject * -array_fromunicode(arrayobject *self, PyObject *args) -{ - Py_UNICODE *ustr; - Py_ssize_t n; - - if (!PyArg_ParseTuple(args, "u#:fromunicode", &ustr, &n)) - return NULL; - if (self->ob_descr->typecode != 'u') { - PyErr_SetString(PyExc_ValueError, - "fromunicode() may only be called on " - "type 'u' arrays"); - return NULL; - } - if (n > 0) { - Py_UNICODE *item = (Py_UNICODE *) self->ob_item; - if (Py_SIZE(self) > PY_SSIZE_T_MAX - n) { - return PyErr_NoMemory(); - } - PyMem_RESIZE(item, Py_UNICODE, Py_SIZE(self) + n); - if (item == NULL) { - PyErr_NoMemory(); - return NULL; - } - self->ob_item = (char *) item; - Py_SIZE(self) += n; - self->allocated = Py_SIZE(self); - memcpy(item + Py_SIZE(self) - n, - ustr, n * sizeof(Py_UNICODE)); - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(fromunicode_doc, -"fromunicode(ustr)\n\ -\n\ -Extends this array with data from the unicode string ustr.\n\ -The array must be a type 'u' array; otherwise a ValueError\n\ -is raised. Use array.fromstring(ustr.decode(...)) to\n\ -append Unicode data to an array of some other type."); - - -static PyObject * -array_tounicode(arrayobject *self, PyObject *unused) -{ - if (self->ob_descr->typecode != 'u') { - PyErr_SetString(PyExc_ValueError, - "tounicode() may only be called on type 'u' arrays"); - return NULL; - } - return PyUnicode_FromUnicode((Py_UNICODE *) self->ob_item, Py_SIZE(self)); -} - -PyDoc_STRVAR(tounicode_doc, -"tounicode() -> unicode\n\ -\n\ -Convert the array to a unicode string. The array must be\n\ -a type 'u' array; otherwise a ValueError is raised. Use\n\ -array.tostring().decode() to obtain a unicode string from\n\ -an array of some other type."); - -#endif /* Py_USING_UNICODE */ - -static PyObject * -array_reduce(arrayobject *array) -{ - PyObject *dict, *result, *list; - - dict = PyObject_GetAttrString((PyObject *)array, "__dict__"); - if (dict == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - dict = Py_None; - Py_INCREF(dict); - } - /* Unlike in Python 3.x, we never use the more efficient memory - * representation of an array for pickling. This is unfortunately - * necessary to allow array objects to be unpickled by Python 3.x, - * since str objects from 2.x are always decoded to unicode in - * Python 3.x. - */ - list = array_tolist(array, NULL); - if (list == NULL) { - Py_DECREF(dict); - return NULL; - } - result = Py_BuildValue( - "O(cO)O", Py_TYPE(array), array->ob_descr->typecode, list, dict); - Py_DECREF(list); - Py_DECREF(dict); - return result; -} - -PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); - -static PyObject * -array_sizeof(arrayobject *self, PyObject *unused) -{ - Py_ssize_t res; - res = sizeof(arrayobject) + self->allocated * self->ob_descr->itemsize; - return PyLong_FromSsize_t(res); -} - -PyDoc_STRVAR(sizeof_doc, -"__sizeof__() -> int\n\ -\n\ -Size of the array in memory, in bytes."); - -static PyObject * -array_get_typecode(arrayobject *a, void *closure) -{ - char tc = a->ob_descr->typecode; - return PyString_FromStringAndSize(&tc, 1); -} - -static PyObject * -array_get_itemsize(arrayobject *a, void *closure) -{ - return PyInt_FromLong((long)a->ob_descr->itemsize); -} - -static PyGetSetDef array_getsets [] = { - {"typecode", (getter) array_get_typecode, NULL, - "the typecode character used to create the array"}, - {"itemsize", (getter) array_get_itemsize, NULL, - "the size, in bytes, of one array item"}, - {NULL} -}; - -static PyMethodDef array_methods[] = { - {"append", (PyCFunction)array_append, METH_O, - append_doc}, - {"buffer_info", (PyCFunction)array_buffer_info, METH_NOARGS, - buffer_info_doc}, - {"byteswap", (PyCFunction)array_byteswap, METH_NOARGS, - byteswap_doc}, - {"__copy__", (PyCFunction)array_copy, METH_NOARGS, - copy_doc}, - {"count", (PyCFunction)array_count, METH_O, - count_doc}, - {"__deepcopy__",(PyCFunction)array_copy, METH_O, - copy_doc}, - {"extend", (PyCFunction)array_extend, METH_O, - extend_doc}, - {"fromfile", (PyCFunction)array_fromfile, METH_VARARGS, - fromfile_doc}, - {"fromlist", (PyCFunction)array_fromlist, METH_O, - fromlist_doc}, - {"fromstring", (PyCFunction)array_fromstring, METH_VARARGS, - fromstring_doc}, -#ifdef Py_USING_UNICODE - {"fromunicode", (PyCFunction)array_fromunicode, METH_VARARGS, - fromunicode_doc}, -#endif - {"index", (PyCFunction)array_index, METH_O, - index_doc}, - {"insert", (PyCFunction)array_insert, METH_VARARGS, - insert_doc}, - {"pop", (PyCFunction)array_pop, METH_VARARGS, - pop_doc}, - {"read", (PyCFunction)array_fromfile_as_read, METH_VARARGS, - fromfile_doc}, - {"__reduce__", (PyCFunction)array_reduce, METH_NOARGS, - reduce_doc}, - {"remove", (PyCFunction)array_remove, METH_O, - remove_doc}, - {"reverse", (PyCFunction)array_reverse, METH_NOARGS, - reverse_doc}, -/* {"sort", (PyCFunction)array_sort, METH_VARARGS, - sort_doc},*/ - {"tofile", (PyCFunction)array_tofile, METH_O, - tofile_doc}, - {"tolist", (PyCFunction)array_tolist, METH_NOARGS, - tolist_doc}, - {"tostring", (PyCFunction)array_tostring, METH_NOARGS, - tostring_doc}, -#ifdef Py_USING_UNICODE - {"tounicode", (PyCFunction)array_tounicode, METH_NOARGS, - tounicode_doc}, -#endif - {"write", (PyCFunction)array_tofile_as_write, METH_O, - tofile_doc}, - {"__sizeof__", (PyCFunction)array_sizeof, METH_NOARGS, - sizeof_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -array_repr(arrayobject *a) -{ - char buf[256], typecode; - PyObject *s, *t, *v = NULL; - Py_ssize_t len; - - len = Py_SIZE(a); - typecode = a->ob_descr->typecode; - if (len == 0) { - PyOS_snprintf(buf, sizeof(buf), "array('%c')", typecode); - return PyString_FromString(buf); - } - - if (typecode == 'c') - v = array_tostring(a, NULL); -#ifdef Py_USING_UNICODE - else if (typecode == 'u') - v = array_tounicode(a, NULL); -#endif - else - v = array_tolist(a, NULL); - t = PyObject_Repr(v); - Py_XDECREF(v); - - PyOS_snprintf(buf, sizeof(buf), "array('%c', ", typecode); - s = PyString_FromString(buf); - PyString_ConcatAndDel(&s, t); - PyString_ConcatAndDel(&s, PyString_FromString(")")); - return s; -} - -static PyObject* -array_subscr(arrayobject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i==-1 && PyErr_Occurred()) { - return NULL; - } - if (i < 0) - i += Py_SIZE(self); - return array_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - PyObject* result; - arrayobject* ar; - int itemsize = self->ob_descr->itemsize; - - if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return newarrayobject(&Arraytype, 0, self->ob_descr); - } - else if (step == 1) { - PyObject *result = newarrayobject(&Arraytype, - slicelength, self->ob_descr); - if (result == NULL) - return NULL; - memcpy(((arrayobject *)result)->ob_item, - self->ob_item + start * itemsize, - slicelength * itemsize); - return result; - } - else { - result = newarrayobject(&Arraytype, slicelength, self->ob_descr); - if (!result) return NULL; - - ar = (arrayobject*)result; - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - memcpy(ar->ob_item + i*itemsize, - self->ob_item + cur*itemsize, - itemsize); - } - - return result; - } - } - else { - PyErr_SetString(PyExc_TypeError, - "array indices must be integers"); - return NULL; - } -} - -static int -array_ass_subscr(arrayobject* self, PyObject* item, PyObject* value) -{ - Py_ssize_t start, stop, step, slicelength, needed; - arrayobject* other; - int itemsize; - - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - - if (i == -1 && PyErr_Occurred()) - return -1; - if (i < 0) - i += Py_SIZE(self); - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, - "array assignment index out of range"); - return -1; - } - if (value == NULL) { - /* Fall through to slice assignment */ - start = i; - stop = i + 1; - step = 1; - slicelength = 1; - } - else - return (*self->ob_descr->setitem)(self, i, value); - } - else if (PySlice_Check(item)) { - if (PySlice_GetIndicesEx((PySliceObject *)item, - Py_SIZE(self), &start, &stop, - &step, &slicelength) < 0) { - return -1; - } - } - else { - PyErr_SetString(PyExc_TypeError, - "array indices must be integer"); - return -1; - } - if (value == NULL) { - other = NULL; - needed = 0; - } - else if (array_Check(value)) { - other = (arrayobject *)value; - needed = Py_SIZE(other); - if (self == other) { - /* Special case "self[i:j] = self" -- copy self first */ - int ret; - value = array_slice(other, 0, needed); - if (value == NULL) - return -1; - ret = array_ass_subscr(self, item, value); - Py_DECREF(value); - return ret; - } - if (other->ob_descr != self->ob_descr) { - PyErr_BadArgument(); - return -1; - } - } - else { - PyErr_Format(PyExc_TypeError, - "can only assign array (not \"%.200s\") to array slice", - Py_TYPE(value)->tp_name); - return -1; - } - itemsize = self->ob_descr->itemsize; - /* for 'a[2:1] = ...', the insertion point is 'start', not 'stop' */ - if ((step > 0 && stop < start) || - (step < 0 && stop > start)) - stop = start; - if (step == 1) { - if (slicelength > needed) { - memmove(self->ob_item + (start + needed) * itemsize, - self->ob_item + stop * itemsize, - (Py_SIZE(self) - stop) * itemsize); - if (array_resize(self, Py_SIZE(self) + - needed - slicelength) < 0) - return -1; - } - else if (slicelength < needed) { - if (array_resize(self, Py_SIZE(self) + - needed - slicelength) < 0) - return -1; - memmove(self->ob_item + (start + needed) * itemsize, - self->ob_item + stop * itemsize, - (Py_SIZE(self) - start - needed) * itemsize); - } - if (needed > 0) - memcpy(self->ob_item + start * itemsize, - other->ob_item, needed * itemsize); - return 0; - } - else if (needed == 0) { - /* Delete slice */ - size_t cur; - Py_ssize_t i; - - if (step < 0) { - stop = start + 1; - start = stop + step * (slicelength - 1) - 1; - step = -step; - } - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - Py_ssize_t lim = step - 1; - - if (cur + step >= (size_t)Py_SIZE(self)) - lim = Py_SIZE(self) - cur - 1; - memmove(self->ob_item + (cur - i) * itemsize, - self->ob_item + (cur + 1) * itemsize, - lim * itemsize); - } - cur = start + slicelength * step; - if (cur < (size_t)Py_SIZE(self)) { - memmove(self->ob_item + (cur-slicelength) * itemsize, - self->ob_item + cur * itemsize, - (Py_SIZE(self) - cur) * itemsize); - } - if (array_resize(self, Py_SIZE(self) - slicelength) < 0) - return -1; - return 0; - } - else { - Py_ssize_t cur, i; - - if (needed != slicelength) { - PyErr_Format(PyExc_ValueError, - "attempt to assign array of size %zd " - "to extended slice of size %zd", - needed, slicelength); - return -1; - } - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - memcpy(self->ob_item + cur * itemsize, - other->ob_item + i * itemsize, - itemsize); - } - return 0; - } -} - -static PyMappingMethods array_as_mapping = { - (lenfunc)array_length, - (binaryfunc)array_subscr, - (objobjargproc)array_ass_subscr -}; - -static const void *emptybuf = ""; - -static Py_ssize_t -array_buffer_getreadbuf(arrayobject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "Accessing non-existent array segment"); - return -1; - } - *ptr = (void *)self->ob_item; - if (*ptr == NULL) - *ptr = emptybuf; - return Py_SIZE(self)*self->ob_descr->itemsize; -} - -static Py_ssize_t -array_buffer_getwritebuf(arrayobject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "Accessing non-existent array segment"); - return -1; - } - *ptr = (void *)self->ob_item; - if (*ptr == NULL) - *ptr = emptybuf; - return Py_SIZE(self)*self->ob_descr->itemsize; -} - -static Py_ssize_t -array_buffer_getsegcount(arrayobject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self)*self->ob_descr->itemsize; - return 1; -} - -static PySequenceMethods array_as_sequence = { - (lenfunc)array_length, /*sq_length*/ - (binaryfunc)array_concat, /*sq_concat*/ - (ssizeargfunc)array_repeat, /*sq_repeat*/ - (ssizeargfunc)array_item, /*sq_item*/ - (ssizessizeargfunc)array_slice, /*sq_slice*/ - (ssizeobjargproc)array_ass_item, /*sq_ass_item*/ - (ssizessizeobjargproc)array_ass_slice, /*sq_ass_slice*/ - (objobjproc)array_contains, /*sq_contains*/ - (binaryfunc)array_inplace_concat, /*sq_inplace_concat*/ - (ssizeargfunc)array_inplace_repeat /*sq_inplace_repeat*/ -}; - -static PyBufferProcs array_as_buffer = { - (readbufferproc)array_buffer_getreadbuf, - (writebufferproc)array_buffer_getwritebuf, - (segcountproc)array_buffer_getsegcount, - NULL, -}; - -static PyObject * -array_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - char c; - PyObject *initial = NULL, *it = NULL; - struct arraydescr *descr; - - if (type == &Arraytype && !_PyArg_NoKeywords("array.array()", kwds)) - return NULL; - - if (!PyArg_ParseTuple(args, "c|O:array", &c, &initial)) - return NULL; - - if (!(initial == NULL || PyList_Check(initial) - || PyString_Check(initial) || PyTuple_Check(initial) - || (c == 'u' && PyUnicode_Check(initial)))) { - it = PyObject_GetIter(initial); - if (it == NULL) - return NULL; - /* We set initial to NULL so that the subsequent code - will create an empty array of the appropriate type - and afterwards we can use array_iter_extend to populate - the array. - */ - initial = NULL; - } - for (descr = descriptors; descr->typecode != '\0'; descr++) { - if (descr->typecode == c) { - PyObject *a; - Py_ssize_t len; - - if (initial == NULL || !(PyList_Check(initial) - || PyTuple_Check(initial))) - len = 0; - else - len = PySequence_Size(initial); - - a = newarrayobject(type, len, descr); - if (a == NULL) - return NULL; - - if (len > 0) { - Py_ssize_t i; - for (i = 0; i < len; i++) { - PyObject *v = - PySequence_GetItem(initial, i); - if (v == NULL) { - Py_DECREF(a); - return NULL; - } - if (setarrayitem(a, i, v) != 0) { - Py_DECREF(v); - Py_DECREF(a); - return NULL; - } - Py_DECREF(v); - } - } else if (initial != NULL && PyString_Check(initial)) { - PyObject *t_initial, *v; - t_initial = PyTuple_Pack(1, initial); - if (t_initial == NULL) { - Py_DECREF(a); - return NULL; - } - v = array_fromstring((arrayobject *)a, - t_initial); - Py_DECREF(t_initial); - if (v == NULL) { - Py_DECREF(a); - return NULL; - } - Py_DECREF(v); -#ifdef Py_USING_UNICODE - } else if (initial != NULL && PyUnicode_Check(initial)) { - Py_ssize_t n = PyUnicode_GET_DATA_SIZE(initial); - if (n > 0) { - arrayobject *self = (arrayobject *)a; - char *item = self->ob_item; - item = (char *)PyMem_Realloc(item, n); - if (item == NULL) { - PyErr_NoMemory(); - Py_DECREF(a); - return NULL; - } - self->ob_item = item; - Py_SIZE(self) = n / sizeof(Py_UNICODE); - memcpy(item, PyUnicode_AS_DATA(initial), n); - self->allocated = Py_SIZE(self); - } -#endif - } - if (it != NULL) { - if (array_iter_extend((arrayobject *)a, it) == -1) { - Py_DECREF(it); - Py_DECREF(a); - return NULL; - } - Py_DECREF(it); - } - return a; - } - } - PyErr_SetString(PyExc_ValueError, - "bad typecode (must be c, b, B, u, h, H, i, I, l, L, f or d)"); - return NULL; -} - - -PyDoc_STRVAR(module_doc, -"This module defines an object type which can efficiently represent\n\ -an array of basic values: characters, integers, floating point\n\ -numbers. Arrays are sequence types and behave very much like lists,\n\ -except that the type of objects stored in them is constrained. The\n\ -type is specified at object creation time by using a type code, which\n\ -is a single character. The following type codes are defined:\n\ -\n\ - Type code C Type Minimum size in bytes \n\ - 'c' character 1 \n\ - 'b' signed integer 1 \n\ - 'B' unsigned integer 1 \n\ - 'u' Unicode character 2 \n\ - 'h' signed integer 2 \n\ - 'H' unsigned integer 2 \n\ - 'i' signed integer 2 \n\ - 'I' unsigned integer 2 \n\ - 'l' signed integer 4 \n\ - 'L' unsigned integer 4 \n\ - 'f' floating point 4 \n\ - 'd' floating point 8 \n\ -\n\ -The constructor is:\n\ -\n\ -array(typecode [, initializer]) -- create a new array\n\ -"); - -PyDoc_STRVAR(arraytype_doc, -"array(typecode [, initializer]) -> array\n\ -\n\ -Return a new array whose items are restricted by typecode, and\n\ -initialized from the optional initializer value, which must be a list,\n\ -string or iterable over elements of the appropriate type.\n\ -\n\ -Arrays represent basic values and behave very much like lists, except\n\ -the type of objects stored in them is constrained.\n\ -\n\ -Methods:\n\ -\n\ -append() -- append a new item to the end of the array\n\ -buffer_info() -- return information giving the current memory info\n\ -byteswap() -- byteswap all the items of the array\n\ -count() -- return number of occurrences of an object\n\ -extend() -- extend array by appending multiple elements from an iterable\n\ -fromfile() -- read items from a file object\n\ -fromlist() -- append items from the list\n\ -fromstring() -- append items from the string\n\ -index() -- return index of first occurrence of an object\n\ -insert() -- insert a new item into the array at a provided position\n\ -pop() -- remove and return item (default last)\n\ -read() -- DEPRECATED, use fromfile()\n\ -remove() -- remove first occurrence of an object\n\ -reverse() -- reverse the order of the items in the array\n\ -tofile() -- write all items to a file object\n\ -tolist() -- return the array converted to an ordinary list\n\ -tostring() -- return the array converted to a string\n\ -write() -- DEPRECATED, use tofile()\n\ -\n\ -Attributes:\n\ -\n\ -typecode -- the typecode character used to create the array\n\ -itemsize -- the length in bytes of one array item\n\ -"); - -static PyObject *array_iter(arrayobject *ao); - -static PyTypeObject Arraytype = { - PyVarObject_HEAD_INIT(NULL, 0) - "array.array", - sizeof(arrayobject), - 0, - (destructor)array_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)array_repr, /* tp_repr */ - 0, /* tp_as_number*/ - &array_as_sequence, /* tp_as_sequence*/ - &array_as_mapping, /* tp_as_mapping*/ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &array_as_buffer, /* tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - arraytype_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - array_richcompare, /* tp_richcompare */ - offsetof(arrayobject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)array_iter, /* tp_iter */ - 0, /* tp_iternext */ - array_methods, /* tp_methods */ - 0, /* tp_members */ - array_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - array_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - - -/*********************** Array Iterator **************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t index; - arrayobject *ao; - PyObject * (*getitem)(struct arrayobject *, Py_ssize_t); -} arrayiterobject; - -static PyTypeObject PyArrayIter_Type; - -#define PyArrayIter_Check(op) PyObject_TypeCheck(op, &PyArrayIter_Type) - -static PyObject * -array_iter(arrayobject *ao) -{ - arrayiterobject *it; - - if (!array_Check(ao)) { - PyErr_BadInternalCall(); - return NULL; - } - - it = PyObject_GC_New(arrayiterobject, &PyArrayIter_Type); - if (it == NULL) - return NULL; - - Py_INCREF(ao); - it->ao = ao; - it->index = 0; - it->getitem = ao->ob_descr->getitem; - PyObject_GC_Track(it); - return (PyObject *)it; -} - -static PyObject * -arrayiter_next(arrayiterobject *it) -{ - assert(PyArrayIter_Check(it)); - if (it->index < Py_SIZE(it->ao)) - return (*it->getitem)(it->ao, it->index++); - return NULL; -} - -static void -arrayiter_dealloc(arrayiterobject *it) -{ - PyObject_GC_UnTrack(it); - Py_XDECREF(it->ao); - PyObject_GC_Del(it); -} - -static int -arrayiter_traverse(arrayiterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->ao); - return 0; -} - -static PyTypeObject PyArrayIter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "arrayiterator", /* tp_name */ - sizeof(arrayiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)arrayiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)arrayiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)arrayiter_next, /* tp_iternext */ - 0, /* tp_methods */ -}; - - -/*********************** Install Module **************************/ - -/* No functions in array module. */ -static PyMethodDef a_methods[] = { - {NULL, NULL, 0, NULL} /* Sentinel */ -}; - - -PyMODINIT_FUNC -initarray(void) -{ - PyObject *m; - - Arraytype.ob_type = &PyType_Type; - PyArrayIter_Type.ob_type = &PyType_Type; - m = Py_InitModule3("array", a_methods, module_doc); - if (m == NULL) - return; - - Py_INCREF((PyObject *)&Arraytype); - PyModule_AddObject(m, "ArrayType", (PyObject *)&Arraytype); - Py_INCREF((PyObject *)&Arraytype); - PyModule_AddObject(m, "array", (PyObject *)&Arraytype); - /* No need to check the error here, the caller will do that */ -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/binascii.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/binascii.c deleted file mode 100644 index ee2d042..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/binascii.c +++ /dev/null @@ -1,1516 +0,0 @@ -/* -** Routines to represent binary data in ASCII and vice-versa -** -** This module currently supports the following encodings: -** uuencode: -** each line encodes 45 bytes (except possibly the last) -** First char encodes (binary) length, rest data -** each char encodes 6 bits, as follows: -** binary: 01234567 abcdefgh ijklmnop -** ascii: 012345 67abcd efghij klmnop -** ASCII encoding method is "excess-space": 000000 is encoded as ' ', etc. -** short binary data is zero-extended (so the bits are always in the -** right place), this does *not* reflect in the length. -** base64: -** Line breaks are insignificant, but lines are at most 76 chars -** each char encodes 6 bits, in similar order as uucode/hqx. Encoding -** is done via a table. -** Short binary data is filled (in ASCII) with '='. -** hqx: -** File starts with introductory text, real data starts and ends -** with colons. -** Data consists of three similar parts: info, datafork, resourcefork. -** Each part is protected (at the end) with a 16-bit crc -** The binary data is run-length encoded, and then ascii-fied: -** binary: 01234567 abcdefgh ijklmnop -** ascii: 012345 67abcd efghij klmnop -** ASCII encoding is table-driven, see the code. -** Short binary data results in the runt ascii-byte being output with -** the bits in the right place. -** -** While I was reading dozens of programs that encode or decode the formats -** here (documentation? hihi:-) I have formulated Jansen's Observation: -** -** Programs that encode binary data in ASCII are written in -** such a style that they are as unreadable as possible. Devices used -** include unnecessary global variables, burying important tables -** in unrelated sourcefiles, putting functions in include files, -** using seemingly-descriptive variable names for different purposes, -** calls to empty subroutines and a host of others. -** -** I have attempted to break with this tradition, but I guess that that -** does make the performance sub-optimal. Oh well, too bad... -** -** Jack Jansen, CWI, July 1995. -** -** Added support for quoted-printable encoding, based on rfc 1521 et al -** quoted-printable encoding specifies that non printable characters (anything -** below 32 and above 126) be encoded as =XX where XX is the hexadecimal value -** of the character. It also specifies some other behavior to enable 8bit data -** in a mail message with little difficulty (maximum line sizes, protecting -** some cases of whitespace, etc). -** -** Brandon Long, September 2001. -*/ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#ifdef USE_ZLIB_CRC32 -#include "zlib.h" -#endif - -static PyObject *Error; -static PyObject *Incomplete; - -/* -** hqx lookup table, ascii->binary. -*/ - -#define RUNCHAR 0x90 - -#define DONE 0x7F -#define SKIP 0x7E -#define FAIL 0x7D - -static unsigned char table_a2b_hqx[256] = { -/* ^@ ^A ^B ^C ^D ^E ^F ^G */ -/* 0*/ FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, -/* \b \t \n ^K ^L \r ^N ^O */ -/* 1*/ FAIL, FAIL, SKIP, FAIL, FAIL, SKIP, FAIL, FAIL, -/* ^P ^Q ^R ^S ^T ^U ^V ^W */ -/* 2*/ FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, -/* ^X ^Y ^Z ^[ ^\ ^] ^^ ^_ */ -/* 3*/ FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, -/* ! " # $ % & ' */ -/* 4*/ FAIL, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, -/* ( ) * + , - . / */ -/* 5*/ 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, FAIL, FAIL, -/* 0 1 2 3 4 5 6 7 */ -/* 6*/ 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, FAIL, -/* 8 9 : ; < = > ? */ -/* 7*/ 0x14, 0x15, DONE, FAIL, FAIL, FAIL, FAIL, FAIL, -/* @ A B C D E F G */ -/* 8*/ 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, -/* H I J K L M N O */ -/* 9*/ 0x1E, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, FAIL, -/* P Q R S T U V W */ -/*10*/ 0x25, 0x26, 0x27, 0x28, 0x29, 0x2A, 0x2B, FAIL, -/* X Y Z [ \ ] ^ _ */ -/*11*/ 0x2C, 0x2D, 0x2E, 0x2F, FAIL, FAIL, FAIL, FAIL, -/* ` a b c d e f g */ -/*12*/ 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, FAIL, -/* h i j k l m n o */ -/*13*/ 0x37, 0x38, 0x39, 0x3A, 0x3B, 0x3C, FAIL, FAIL, -/* p q r s t u v w */ -/*14*/ 0x3D, 0x3E, 0x3F, FAIL, FAIL, FAIL, FAIL, FAIL, -/* x y z { | } ~ ^? */ -/*15*/ FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, -/*16*/ FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, - FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, FAIL, -}; - -static unsigned char table_b2a_hqx[] = -"!\"#$%&'()*+,-012345689@ABCDEFGHIJKLMNPQRSTUVXYZ[`abcdefhijklmpqr"; - -static char table_a2b_base64[] = { - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, - 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1, 0,-1,-1, /* Note PAD->0 */ - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, - 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, - -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, - 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 -}; - -#define BASE64_PAD '=' - -/* Max binary chunk size; limited only by available memory */ -#define BASE64_MAXBIN (PY_SSIZE_T_MAX/2 - sizeof(PyStringObject) - 3) - -static unsigned char table_b2a_base64[] = -"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - - - -static unsigned short crctab_hqx[256] = { - 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7, - 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef, - 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6, - 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de, - 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485, - 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d, - 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4, - 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc, - 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823, - 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b, - 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12, - 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a, - 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41, - 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49, - 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70, - 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78, - 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f, - 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067, - 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e, - 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256, - 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d, - 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405, - 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c, - 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634, - 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab, - 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3, - 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a, - 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92, - 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9, - 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1, - 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8, - 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0, -}; - -PyDoc_STRVAR(doc_a2b_uu, "(ascii) -> bin. Decode a line of uuencoded data"); - -static PyObject * -binascii_a2b_uu(PyObject *self, PyObject *args) -{ - Py_buffer pascii; - unsigned char *ascii_data, *bin_data; - int leftbits = 0; - unsigned char this_ch; - unsigned int leftchar = 0; - PyObject *rv; - Py_ssize_t ascii_len, bin_len; - - if ( !PyArg_ParseTuple(args, "s*:a2b_uu", &pascii) ) - return NULL; - ascii_data = pascii.buf; - ascii_len = pascii.len; - - assert(ascii_len >= 0); - - /* First byte: binary data length (in bytes) */ - bin_len = (*ascii_data++ - ' ') & 077; - ascii_len--; - - /* Allocate the buffer */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) { - PyBuffer_Release(&pascii); - return NULL; - } - bin_data = (unsigned char *)PyString_AS_STRING(rv); - - for( ; bin_len > 0 ; ascii_len--, ascii_data++ ) { - /* XXX is it really best to add NULs if there's no more data */ - this_ch = (ascii_len > 0) ? *ascii_data : 0; - if ( this_ch == '\n' || this_ch == '\r' || ascii_len <= 0) { - /* - ** Whitespace. Assume some spaces got eaten at - ** end-of-line. (We check this later) - */ - this_ch = 0; - } else { - /* Check the character for legality - ** The 64 in stead of the expected 63 is because - ** there are a few uuencodes out there that use - ** '`' as zero instead of space. - */ - if ( this_ch < ' ' || this_ch > (' ' + 64)) { - PyErr_SetString(Error, "Illegal char"); - PyBuffer_Release(&pascii); - Py_DECREF(rv); - return NULL; - } - this_ch = (this_ch - ' ') & 077; - } - /* - ** Shift it in on the low end, and see if there's - ** a byte ready for output. - */ - leftchar = (leftchar << 6) | (this_ch); - leftbits += 6; - if ( leftbits >= 8 ) { - leftbits -= 8; - *bin_data++ = (leftchar >> leftbits) & 0xff; - leftchar &= ((1 << leftbits) - 1); - bin_len--; - } - } - /* - ** Finally, check that if there's anything left on the line - ** that it's whitespace only. - */ - while( ascii_len-- > 0 ) { - this_ch = *ascii_data++; - /* Extra '`' may be written as padding in some cases */ - if ( this_ch != ' ' && this_ch != ' '+64 && - this_ch != '\n' && this_ch != '\r' ) { - PyErr_SetString(Error, "Trailing garbage"); - PyBuffer_Release(&pascii); - Py_DECREF(rv); - return NULL; - } - } - PyBuffer_Release(&pascii); - return rv; -} - -PyDoc_STRVAR(doc_b2a_uu, "(bin) -> ascii. Uuencode line of data"); - -static PyObject * -binascii_b2a_uu(PyObject *self, PyObject *args) -{ - Py_buffer pbin; - unsigned char *ascii_data, *bin_data; - int leftbits = 0; - unsigned char this_ch; - unsigned int leftchar = 0; - PyObject *rv; - Py_ssize_t bin_len; - - if ( !PyArg_ParseTuple(args, "s*:b2a_uu", &pbin) ) - return NULL; - bin_data = pbin.buf; - bin_len = pbin.len; - if ( bin_len > 45 ) { - /* The 45 is a limit that appears in all uuencode's */ - PyErr_SetString(Error, "At most 45 bytes at once"); - PyBuffer_Release(&pbin); - return NULL; - } - - /* We're lazy and allocate to much (fixed up later) */ - if ( (rv=PyString_FromStringAndSize(NULL, 2 + (bin_len+2)/3*4)) == NULL ) { - PyBuffer_Release(&pbin); - return NULL; - } - ascii_data = (unsigned char *)PyString_AS_STRING(rv); - - /* Store the length */ - *ascii_data++ = ' ' + (bin_len & 077); - - for( ; bin_len > 0 || leftbits != 0 ; bin_len--, bin_data++ ) { - /* Shift the data (or padding) into our buffer */ - if ( bin_len > 0 ) /* Data */ - leftchar = (leftchar << 8) | *bin_data; - else /* Padding */ - leftchar <<= 8; - leftbits += 8; - - /* See if there are 6-bit groups ready */ - while ( leftbits >= 6 ) { - this_ch = (leftchar >> (leftbits-6)) & 0x3f; - leftbits -= 6; - *ascii_data++ = this_ch + ' '; - } - } - *ascii_data++ = '\n'; /* Append a courtesy newline */ - - /* rv is cleared on error */ - (void)_PyString_Resize(&rv, - (ascii_data - - (unsigned char *)PyString_AS_STRING(rv))); - PyBuffer_Release(&pbin); - return rv; -} - - -static int -binascii_find_valid(unsigned char *s, Py_ssize_t slen, int num) -{ - /* Finds & returns the (num+1)th - ** valid character for base64, or -1 if none. - */ - - int ret = -1; - unsigned char c, b64val; - - while ((slen > 0) && (ret == -1)) { - c = *s; - b64val = table_a2b_base64[c & 0x7f]; - if ( ((c <= 0x7f) && (b64val != (unsigned char)-1)) ) { - if (num == 0) - ret = *s; - num--; - } - - s++; - slen--; - } - return ret; -} - -PyDoc_STRVAR(doc_a2b_base64, "(ascii) -> bin. Decode a line of base64 data"); - -static PyObject * -binascii_a2b_base64(PyObject *self, PyObject *args) -{ - Py_buffer pascii; - unsigned char *ascii_data, *bin_data; - int leftbits = 0; - unsigned char this_ch; - unsigned int leftchar = 0; - PyObject *rv; - Py_ssize_t ascii_len, bin_len; - int quad_pos = 0; - - if ( !PyArg_ParseTuple(args, "s*:a2b_base64", &pascii) ) - return NULL; - ascii_data = pascii.buf; - ascii_len = pascii.len; - - assert(ascii_len >= 0); - - if (ascii_len > PY_SSIZE_T_MAX - 3) { - PyBuffer_Release(&pascii); - return PyErr_NoMemory(); - } - - bin_len = ((ascii_len+3)/4)*3; /* Upper bound, corrected later */ - - /* Allocate the buffer */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len)) == NULL ) { - PyBuffer_Release(&pascii); - return NULL; - } - bin_data = (unsigned char *)PyString_AS_STRING(rv); - bin_len = 0; - - for( ; ascii_len > 0; ascii_len--, ascii_data++) { - this_ch = *ascii_data; - - if (this_ch > 0x7f || - this_ch == '\r' || this_ch == '\n' || this_ch == ' ') - continue; - - /* Check for pad sequences and ignore - ** the invalid ones. - */ - if (this_ch == BASE64_PAD) { - if ( (quad_pos < 2) || - ((quad_pos == 2) && - (binascii_find_valid(ascii_data, ascii_len, 1) - != BASE64_PAD)) ) - { - continue; - } - else { - /* A pad sequence means no more input. - ** We've already interpreted the data - ** from the quad at this point. - */ - leftbits = 0; - break; - } - } - - this_ch = table_a2b_base64[*ascii_data]; - if ( this_ch == (unsigned char) -1 ) - continue; - - /* - ** Shift it in on the low end, and see if there's - ** a byte ready for output. - */ - quad_pos = (quad_pos + 1) & 0x03; - leftchar = (leftchar << 6) | (this_ch); - leftbits += 6; - - if ( leftbits >= 8 ) { - leftbits -= 8; - *bin_data++ = (leftchar >> leftbits) & 0xff; - bin_len++; - leftchar &= ((1 << leftbits) - 1); - } - } - - if (leftbits != 0) { - PyBuffer_Release(&pascii); - PyErr_SetString(Error, "Incorrect padding"); - Py_DECREF(rv); - return NULL; - } - - /* And set string size correctly. If the result string is empty - ** (because the input was all invalid) return the shared empty - ** string instead; _PyString_Resize() won't do this for us. - */ - if (bin_len > 0) { - /* rv is cleared on error */ - (void)_PyString_Resize(&rv, bin_len); - } - else { - Py_DECREF(rv); - rv = PyString_FromStringAndSize("", 0); - } - PyBuffer_Release(&pascii); - return rv; -} - -PyDoc_STRVAR(doc_b2a_base64, "(bin) -> ascii. Base64-code line of data"); - -static PyObject * -binascii_b2a_base64(PyObject *self, PyObject *args) -{ - Py_buffer pbuf; - unsigned char *ascii_data, *bin_data; - int leftbits = 0; - unsigned char this_ch; - unsigned int leftchar = 0; - PyObject *rv; - Py_ssize_t bin_len; - - if ( !PyArg_ParseTuple(args, "s*:b2a_base64", &pbuf) ) - return NULL; - bin_data = pbuf.buf; - bin_len = pbuf.len; - - assert(bin_len >= 0); - - if ( bin_len > BASE64_MAXBIN ) { - PyErr_SetString(Error, "Too much data for base64 line"); - PyBuffer_Release(&pbuf); - return NULL; - } - - /* We're lazy and allocate too much (fixed up later). - "+3" leaves room for up to two pad characters and a trailing - newline. Note that 'b' gets encoded as 'Yg==\n' (1 in, 5 out). */ - if ( (rv=PyString_FromStringAndSize(NULL, bin_len*2 + 3)) == NULL ) { - PyBuffer_Release(&pbuf); - return NULL; - } - ascii_data = (unsigned char *)PyString_AS_STRING(rv); - - for( ; bin_len > 0 ; bin_len--, bin_data++ ) { - /* Shift the data into our buffer */ - leftchar = (leftchar << 8) | *bin_data; - leftbits += 8; - - /* See if there are 6-bit groups ready */ - while ( leftbits >= 6 ) { - this_ch = (leftchar >> (leftbits-6)) & 0x3f; - leftbits -= 6; - *ascii_data++ = table_b2a_base64[this_ch]; - } - } - if ( leftbits == 2 ) { - *ascii_data++ = table_b2a_base64[(leftchar&3) << 4]; - *ascii_data++ = BASE64_PAD; - *ascii_data++ = BASE64_PAD; - } else if ( leftbits == 4 ) { - *ascii_data++ = table_b2a_base64[(leftchar&0xf) << 2]; - *ascii_data++ = BASE64_PAD; - } - *ascii_data++ = '\n'; /* Append a courtesy newline */ - - /* rv is cleared on error */ - (void)_PyString_Resize(&rv, - (ascii_data - - (unsigned char *)PyString_AS_STRING(rv))); - PyBuffer_Release(&pbuf); - return rv; -} - -PyDoc_STRVAR(doc_a2b_hqx, "ascii -> bin, done. Decode .hqx coding"); - -static PyObject * -binascii_a2b_hqx(PyObject *self, PyObject *args) -{ - Py_buffer pascii; - unsigned char *ascii_data, *bin_data; - int leftbits = 0; - unsigned char this_ch; - unsigned int leftchar = 0; - PyObject *rv; - Py_ssize_t len; - int done = 0; - - if ( !PyArg_ParseTuple(args, "s*:a2b_hqx", &pascii) ) - return NULL; - ascii_data = pascii.buf; - len = pascii.len; - - assert(len >= 0); - - if (len > PY_SSIZE_T_MAX - 2) { - PyBuffer_Release(&pascii); - return PyErr_NoMemory(); - } - - /* Allocate a string that is too big (fixed later) - Add two to the initial length to prevent interning which - would preclude subsequent resizing. */ - if ( (rv=PyString_FromStringAndSize(NULL, len+2)) == NULL ) { - PyBuffer_Release(&pascii); - return NULL; - } - bin_data = (unsigned char *)PyString_AS_STRING(rv); - - for( ; len > 0 ; len--, ascii_data++ ) { - /* Get the byte and look it up */ - this_ch = table_a2b_hqx[*ascii_data]; - if ( this_ch == SKIP ) - continue; - if ( this_ch == FAIL ) { - PyErr_SetString(Error, "Illegal char"); - PyBuffer_Release(&pascii); - Py_DECREF(rv); - return NULL; - } - if ( this_ch == DONE ) { - /* The terminating colon */ - done = 1; - break; - } - - /* Shift it into the buffer and see if any bytes are ready */ - leftchar = (leftchar << 6) | (this_ch); - leftbits += 6; - if ( leftbits >= 8 ) { - leftbits -= 8; - *bin_data++ = (leftchar >> leftbits) & 0xff; - leftchar &= ((1 << leftbits) - 1); - } - } - - if ( leftbits && !done ) { - PyErr_SetString(Incomplete, - "String has incomplete number of bytes"); - PyBuffer_Release(&pascii); - Py_DECREF(rv); - return NULL; - } - /* rv is cleared on error */ - if (_PyString_Resize(&rv, - (bin_data - - (unsigned char *)PyString_AS_STRING(rv))) == 0) { - PyObject *rrv = Py_BuildValue("Oi", rv, done); - PyBuffer_Release(&pascii); - Py_DECREF(rv); - return rrv; - } - - PyBuffer_Release(&pascii); - return NULL; -} - -PyDoc_STRVAR(doc_rlecode_hqx, "Binhex RLE-code binary data"); - -static PyObject * -binascii_rlecode_hqx(PyObject *self, PyObject *args) -{ - Py_buffer pbuf; - unsigned char *in_data, *out_data; - PyObject *rv; - unsigned char ch; - Py_ssize_t in, inend, len; - - if ( !PyArg_ParseTuple(args, "s*:rlecode_hqx", &pbuf) ) - return NULL; - in_data = pbuf.buf; - len = pbuf.len; - - assert(len >= 0); - - if (len > PY_SSIZE_T_MAX / 2 - 2) { - PyBuffer_Release(&pbuf); - return PyErr_NoMemory(); - } - - /* Worst case: output is twice as big as input (fixed later) */ - if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) { - PyBuffer_Release(&pbuf); - return NULL; - } - out_data = (unsigned char *)PyString_AS_STRING(rv); - - for( in=0; in 3 ) { - /* More than 3 in a row. Output RLE. */ - *out_data++ = ch; - *out_data++ = RUNCHAR; - *out_data++ = inend-in; - in = inend-1; - } else { - /* Less than 3. Output the byte itself */ - *out_data++ = ch; - } - } - } - /* rv is cleared on error */ - (void)_PyString_Resize(&rv, - (out_data - - (unsigned char *)PyString_AS_STRING(rv))); - PyBuffer_Release(&pbuf); - return rv; -} - -PyDoc_STRVAR(doc_b2a_hqx, "Encode .hqx data"); - -static PyObject * -binascii_b2a_hqx(PyObject *self, PyObject *args) -{ - Py_buffer pbin; - unsigned char *ascii_data, *bin_data; - int leftbits = 0; - unsigned char this_ch; - unsigned int leftchar = 0; - PyObject *rv; - Py_ssize_t len; - - if ( !PyArg_ParseTuple(args, "s*:b2a_hqx", &pbin) ) - return NULL; - bin_data = pbin.buf; - len = pbin.len; - - assert(len >= 0); - - if (len > PY_SSIZE_T_MAX / 2 - 2) { - PyBuffer_Release(&pbin); - return PyErr_NoMemory(); - } - - /* Allocate a buffer that is at least large enough */ - if ( (rv=PyString_FromStringAndSize(NULL, len*2+2)) == NULL ) { - PyBuffer_Release(&pbin); - return NULL; - } - ascii_data = (unsigned char *)PyString_AS_STRING(rv); - - for( ; len > 0 ; len--, bin_data++ ) { - /* Shift into our buffer, and output any 6bits ready */ - leftchar = (leftchar << 8) | *bin_data; - leftbits += 8; - while ( leftbits >= 6 ) { - this_ch = (leftchar >> (leftbits-6)) & 0x3f; - leftbits -= 6; - *ascii_data++ = table_b2a_hqx[this_ch]; - } - } - /* Output a possible runt byte */ - if ( leftbits ) { - leftchar <<= (6-leftbits); - *ascii_data++ = table_b2a_hqx[leftchar & 0x3f]; - } - /* rv is cleared on error */ - (void)_PyString_Resize(&rv, - (ascii_data - - (unsigned char *)PyString_AS_STRING(rv))); - PyBuffer_Release(&pbin); - return rv; -} - -PyDoc_STRVAR(doc_rledecode_hqx, "Decode hexbin RLE-coded string"); - -static PyObject * -binascii_rledecode_hqx(PyObject *self, PyObject *args) -{ - Py_buffer pin; - unsigned char *in_data, *out_data; - unsigned char in_byte, in_repeat; - PyObject *rv; - Py_ssize_t in_len, out_len, out_len_left; - - if ( !PyArg_ParseTuple(args, "s*:rledecode_hqx", &pin) ) - return NULL; - in_data = pin.buf; - in_len = pin.len; - - assert(in_len >= 0); - - /* Empty string is a special case */ - if ( in_len == 0 ) { - PyBuffer_Release(&pin); - return PyString_FromStringAndSize("", 0); - } - else if (in_len > PY_SSIZE_T_MAX / 2) { - PyBuffer_Release(&pin); - return PyErr_NoMemory(); - } - - /* Allocate a buffer of reasonable size. Resized when needed */ - out_len = in_len*2; - if ( (rv=PyString_FromStringAndSize(NULL, out_len)) == NULL ) { - PyBuffer_Release(&pin); - return NULL; - } - out_len_left = out_len; - out_data = (unsigned char *)PyString_AS_STRING(rv); - - /* - ** We need two macros here to get/put bytes and handle - ** end-of-buffer for input and output strings. - */ -#define INBYTE(b) \ - do { \ - if ( --in_len < 0 ) { \ - PyErr_SetString(Incomplete, ""); \ - Py_DECREF(rv); \ - PyBuffer_Release(&pin); \ - return NULL; \ - } \ - b = *in_data++; \ - } while(0) - -#define OUTBYTE(b) \ - do { \ - if ( --out_len_left < 0 ) { \ - if ( out_len > PY_SSIZE_T_MAX / 2) return PyErr_NoMemory(); \ - if (_PyString_Resize(&rv, 2*out_len) < 0) \ - { PyBuffer_Release(&pin); return NULL; } \ - out_data = (unsigned char *)PyString_AS_STRING(rv) \ - + out_len; \ - out_len_left = out_len-1; \ - out_len = out_len * 2; \ - } \ - *out_data++ = b; \ - } while(0) - - /* - ** Handle first byte separately (since we have to get angry - ** in case of an orphaned RLE code). - */ - INBYTE(in_byte); - - if (in_byte == RUNCHAR) { - INBYTE(in_repeat); - if (in_repeat != 0) { - /* Note Error, not Incomplete (which is at the end - ** of the string only). This is a programmer error. - */ - PyErr_SetString(Error, "Orphaned RLE code at start"); - PyBuffer_Release(&pin); - Py_DECREF(rv); - return NULL; - } - OUTBYTE(RUNCHAR); - } else { - OUTBYTE(in_byte); - } - - while( in_len > 0 ) { - INBYTE(in_byte); - - if (in_byte == RUNCHAR) { - INBYTE(in_repeat); - if ( in_repeat == 0 ) { - /* Just an escaped RUNCHAR value */ - OUTBYTE(RUNCHAR); - } else { - /* Pick up value and output a sequence of it */ - in_byte = out_data[-1]; - while ( --in_repeat > 0 ) - OUTBYTE(in_byte); - } - } else { - /* Normal byte */ - OUTBYTE(in_byte); - } - } - /* rv is cleared on error */ - (void)_PyString_Resize(&rv, - (out_data - - (unsigned char *)PyString_AS_STRING(rv))); - PyBuffer_Release(&pin); - return rv; -} - -PyDoc_STRVAR(doc_crc_hqx, -"(data, oldcrc) -> newcrc. Compute hqx CRC incrementally"); - -static PyObject * -binascii_crc_hqx(PyObject *self, PyObject *args) -{ - Py_buffer pin; - unsigned char *bin_data; - unsigned int crc; - Py_ssize_t len; - - if ( !PyArg_ParseTuple(args, "s*i:crc_hqx", &pin, &crc) ) - return NULL; - bin_data = pin.buf; - len = pin.len; - - while(len-- > 0) { - crc=((crc<<8)&0xff00)^crctab_hqx[((crc>>8)&0xff)^*bin_data++]; - } - - PyBuffer_Release(&pin); - return Py_BuildValue("i", crc); -} - -PyDoc_STRVAR(doc_crc32, -"(data, oldcrc = 0) -> newcrc. Compute CRC-32 incrementally"); - -#ifdef USE_ZLIB_CRC32 -/* This was taken from zlibmodule.c PyZlib_crc32 (but is PY_SSIZE_T_CLEAN) */ -static PyObject * -binascii_crc32(PyObject *self, PyObject *args) -{ - unsigned int crc32val = 0; /* crc32(0L, Z_NULL, 0) */ - Py_buffer pbuf; - Byte *buf; - Py_ssize_t len; - int signed_val; - - if (!PyArg_ParseTuple(args, "s*|I:crc32", &pbuf, &crc32val)) - return NULL; - /* In Python 2.x we return a signed integer regardless of native platform - * long size (the 32bit unsigned long is treated as 32-bit signed and sign - * extended into a 64-bit long inside the integer object). 3.0 does the - * right thing and returns unsigned. http://bugs.python.org/issue1202 */ - buf = (Byte*)pbuf.buf; - len = pbuf.len; - signed_val = crc32(crc32val, buf, len); - PyBuffer_Release(&pbuf); - return PyInt_FromLong(signed_val); -} -#else /* USE_ZLIB_CRC32 */ -/* Crc - 32 BIT ANSI X3.66 CRC checksum files - Also known as: ISO 3307 -**********************************************************************| -* *| -* Demonstration program to compute the 32-bit CRC used as the frame *| -* check sequence in ADCCP (ANSI X3.66, also known as FIPS PUB 71 *| -* and FED-STD-1003, the U.S. versions of CCITT's X.25 link-level *| -* protocol). The 32-bit FCS was added via the Federal Register, *| -* 1 June 1982, p.23798. I presume but don't know for certain that *| -* this polynomial is or will be included in CCITT V.41, which *| -* defines the 16-bit CRC (often called CRC-CCITT) polynomial. FIPS *| -* PUB 78 says that the 32-bit FCS reduces otherwise undetected *| -* errors by a factor of 10^-5 over 16-bit FCS. *| -* *| -**********************************************************************| - - Copyright (C) 1986 Gary S. Brown. You may use this program, or - code or tables extracted from it, as desired without restriction. - - First, the polynomial itself and its table of feedback terms. The - polynomial is - X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 - Note that we take it "backwards" and put the highest-order term in - the lowest-order bit. The X^32 term is "implied"; the LSB is the - X^31 term, etc. The X^0 term (usually shown as "+1") results in - the MSB being 1. - - Note that the usual hardware shift register implementation, which - is what we're using (we're merely optimizing it by doing eight-bit - chunks at a time) shifts bits into the lowest-order term. In our - implementation, that means shifting towards the right. Why do we - do it this way? Because the calculated CRC must be transmitted in - order from highest-order term to lowest-order term. UARTs transmit - characters in order from LSB to MSB. By storing the CRC this way, - we hand it to the UART in the order low-byte to high-byte; the UART - sends each low-bit to hight-bit; and the result is transmission bit - by bit from highest- to lowest-order term without requiring any bit - shuffling on our part. Reception works similarly. - - The feedback terms table consists of 256, 32-bit entries. Notes: - - 1. The table can be generated at runtime if desired; code to do so - is shown later. It might not be obvious, but the feedback - terms simply represent the results of eight shift/xor opera- - tions for all combinations of data and CRC register values. - - 2. The CRC accumulation logic is the same for all CRC polynomials, - be they sixteen or thirty-two bits wide. You simply choose the - appropriate table. Alternatively, because the table can be - generated at runtime, you can start by generating the table for - the polynomial in question and use exactly the same "updcrc", - if your application needn't simultaneously handle two CRC - polynomials. (Note, however, that XMODEM is strange.) - - 3. For 16-bit CRCs, the table entries need be only 16 bits wide; - of course, 32-bit entries work OK if the high 16 bits are zero. - - 4. The values must be right-shifted by eight bits by the "updcrc" - logic; the shift must be unsigned (bring in zeroes). On some - hardware you could probably optimize the shift in assembler by - using byte-swap instructions. -********************************************************************/ - -static unsigned int crc_32_tab[256] = { -0x00000000U, 0x77073096U, 0xee0e612cU, 0x990951baU, 0x076dc419U, -0x706af48fU, 0xe963a535U, 0x9e6495a3U, 0x0edb8832U, 0x79dcb8a4U, -0xe0d5e91eU, 0x97d2d988U, 0x09b64c2bU, 0x7eb17cbdU, 0xe7b82d07U, -0x90bf1d91U, 0x1db71064U, 0x6ab020f2U, 0xf3b97148U, 0x84be41deU, -0x1adad47dU, 0x6ddde4ebU, 0xf4d4b551U, 0x83d385c7U, 0x136c9856U, -0x646ba8c0U, 0xfd62f97aU, 0x8a65c9ecU, 0x14015c4fU, 0x63066cd9U, -0xfa0f3d63U, 0x8d080df5U, 0x3b6e20c8U, 0x4c69105eU, 0xd56041e4U, -0xa2677172U, 0x3c03e4d1U, 0x4b04d447U, 0xd20d85fdU, 0xa50ab56bU, -0x35b5a8faU, 0x42b2986cU, 0xdbbbc9d6U, 0xacbcf940U, 0x32d86ce3U, -0x45df5c75U, 0xdcd60dcfU, 0xabd13d59U, 0x26d930acU, 0x51de003aU, -0xc8d75180U, 0xbfd06116U, 0x21b4f4b5U, 0x56b3c423U, 0xcfba9599U, -0xb8bda50fU, 0x2802b89eU, 0x5f058808U, 0xc60cd9b2U, 0xb10be924U, -0x2f6f7c87U, 0x58684c11U, 0xc1611dabU, 0xb6662d3dU, 0x76dc4190U, -0x01db7106U, 0x98d220bcU, 0xefd5102aU, 0x71b18589U, 0x06b6b51fU, -0x9fbfe4a5U, 0xe8b8d433U, 0x7807c9a2U, 0x0f00f934U, 0x9609a88eU, -0xe10e9818U, 0x7f6a0dbbU, 0x086d3d2dU, 0x91646c97U, 0xe6635c01U, -0x6b6b51f4U, 0x1c6c6162U, 0x856530d8U, 0xf262004eU, 0x6c0695edU, -0x1b01a57bU, 0x8208f4c1U, 0xf50fc457U, 0x65b0d9c6U, 0x12b7e950U, -0x8bbeb8eaU, 0xfcb9887cU, 0x62dd1ddfU, 0x15da2d49U, 0x8cd37cf3U, -0xfbd44c65U, 0x4db26158U, 0x3ab551ceU, 0xa3bc0074U, 0xd4bb30e2U, -0x4adfa541U, 0x3dd895d7U, 0xa4d1c46dU, 0xd3d6f4fbU, 0x4369e96aU, -0x346ed9fcU, 0xad678846U, 0xda60b8d0U, 0x44042d73U, 0x33031de5U, -0xaa0a4c5fU, 0xdd0d7cc9U, 0x5005713cU, 0x270241aaU, 0xbe0b1010U, -0xc90c2086U, 0x5768b525U, 0x206f85b3U, 0xb966d409U, 0xce61e49fU, -0x5edef90eU, 0x29d9c998U, 0xb0d09822U, 0xc7d7a8b4U, 0x59b33d17U, -0x2eb40d81U, 0xb7bd5c3bU, 0xc0ba6cadU, 0xedb88320U, 0x9abfb3b6U, -0x03b6e20cU, 0x74b1d29aU, 0xead54739U, 0x9dd277afU, 0x04db2615U, -0x73dc1683U, 0xe3630b12U, 0x94643b84U, 0x0d6d6a3eU, 0x7a6a5aa8U, -0xe40ecf0bU, 0x9309ff9dU, 0x0a00ae27U, 0x7d079eb1U, 0xf00f9344U, -0x8708a3d2U, 0x1e01f268U, 0x6906c2feU, 0xf762575dU, 0x806567cbU, -0x196c3671U, 0x6e6b06e7U, 0xfed41b76U, 0x89d32be0U, 0x10da7a5aU, -0x67dd4accU, 0xf9b9df6fU, 0x8ebeeff9U, 0x17b7be43U, 0x60b08ed5U, -0xd6d6a3e8U, 0xa1d1937eU, 0x38d8c2c4U, 0x4fdff252U, 0xd1bb67f1U, -0xa6bc5767U, 0x3fb506ddU, 0x48b2364bU, 0xd80d2bdaU, 0xaf0a1b4cU, -0x36034af6U, 0x41047a60U, 0xdf60efc3U, 0xa867df55U, 0x316e8eefU, -0x4669be79U, 0xcb61b38cU, 0xbc66831aU, 0x256fd2a0U, 0x5268e236U, -0xcc0c7795U, 0xbb0b4703U, 0x220216b9U, 0x5505262fU, 0xc5ba3bbeU, -0xb2bd0b28U, 0x2bb45a92U, 0x5cb36a04U, 0xc2d7ffa7U, 0xb5d0cf31U, -0x2cd99e8bU, 0x5bdeae1dU, 0x9b64c2b0U, 0xec63f226U, 0x756aa39cU, -0x026d930aU, 0x9c0906a9U, 0xeb0e363fU, 0x72076785U, 0x05005713U, -0x95bf4a82U, 0xe2b87a14U, 0x7bb12baeU, 0x0cb61b38U, 0x92d28e9bU, -0xe5d5be0dU, 0x7cdcefb7U, 0x0bdbdf21U, 0x86d3d2d4U, 0xf1d4e242U, -0x68ddb3f8U, 0x1fda836eU, 0x81be16cdU, 0xf6b9265bU, 0x6fb077e1U, -0x18b74777U, 0x88085ae6U, 0xff0f6a70U, 0x66063bcaU, 0x11010b5cU, -0x8f659effU, 0xf862ae69U, 0x616bffd3U, 0x166ccf45U, 0xa00ae278U, -0xd70dd2eeU, 0x4e048354U, 0x3903b3c2U, 0xa7672661U, 0xd06016f7U, -0x4969474dU, 0x3e6e77dbU, 0xaed16a4aU, 0xd9d65adcU, 0x40df0b66U, -0x37d83bf0U, 0xa9bcae53U, 0xdebb9ec5U, 0x47b2cf7fU, 0x30b5ffe9U, -0xbdbdf21cU, 0xcabac28aU, 0x53b39330U, 0x24b4a3a6U, 0xbad03605U, -0xcdd70693U, 0x54de5729U, 0x23d967bfU, 0xb3667a2eU, 0xc4614ab8U, -0x5d681b02U, 0x2a6f2b94U, 0xb40bbe37U, 0xc30c8ea1U, 0x5a05df1bU, -0x2d02ef8dU -}; - -static PyObject * -binascii_crc32(PyObject *self, PyObject *args) -{ /* By Jim Ahlstrom; All rights transferred to CNRI */ - Py_buffer pbin; - unsigned char *bin_data; - unsigned int crc = 0U; /* initial value of CRC */ - Py_ssize_t len; - int result; - - if ( !PyArg_ParseTuple(args, "s*|I:crc32", &pbin, &crc) ) - return NULL; - bin_data = pbin.buf; - len = pbin.len; - - crc = ~ crc; - while (len-- > 0) - crc = crc_32_tab[(crc ^ *bin_data++) & 0xffU] ^ (crc >> 8); - /* Note: (crc >> 8) MUST zero fill on left */ - - result = (int)(crc ^ 0xFFFFFFFFU); - PyBuffer_Release(&pbin); - return PyInt_FromLong(result); -} -#endif /* USE_ZLIB_CRC32 */ - - -static PyObject * -binascii_hexlify(PyObject *self, PyObject *args) -{ - Py_buffer parg; - char* argbuf; - Py_ssize_t arglen; - PyObject *retval; - char* retbuf; - Py_ssize_t i, j; - - if (!PyArg_ParseTuple(args, "s*:b2a_hex", &parg)) - return NULL; - argbuf = parg.buf; - arglen = parg.len; - - assert(arglen >= 0); - if (arglen > PY_SSIZE_T_MAX / 2) { - PyBuffer_Release(&parg); - return PyErr_NoMemory(); - } - - retval = PyString_FromStringAndSize(NULL, arglen*2); - if (!retval) { - PyBuffer_Release(&parg); - return NULL; - } - retbuf = PyString_AS_STRING(retval); - - /* make hex version of string, taken from shamodule.c */ - for (i=j=0; i < arglen; i++) { - char c; - c = (argbuf[i] >> 4) & 0xf; - c = (c>9) ? c+'a'-10 : c + '0'; - retbuf[j++] = c; - c = argbuf[i] & 0xf; - c = (c>9) ? c+'a'-10 : c + '0'; - retbuf[j++] = c; - } - PyBuffer_Release(&parg); - return retval; -} - -PyDoc_STRVAR(doc_hexlify, -"b2a_hex(data) -> s; Hexadecimal representation of binary data.\n\ -\n\ -This function is also available as \"hexlify()\"."); - - -static int -to_int(int c) -{ - if (isdigit(c)) - return c - '0'; - else { - if (Py_ISUPPER(c)) - c = Py_TOLOWER(c); - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - } - return -1; -} - - -static PyObject * -binascii_unhexlify(PyObject *self, PyObject *args) -{ - Py_buffer parg; - char* argbuf; - Py_ssize_t arglen; - PyObject *retval; - char* retbuf; - Py_ssize_t i, j; - - if (!PyArg_ParseTuple(args, "s*:a2b_hex", &parg)) - return NULL; - argbuf = parg.buf; - arglen = parg.len; - - assert(arglen >= 0); - - /* XXX What should we do about strings with an odd length? Should - * we add an implicit leading zero, or a trailing zero? For now, - * raise an exception. - */ - if (arglen % 2) { - PyBuffer_Release(&parg); - PyErr_SetString(PyExc_TypeError, "Odd-length string"); - return NULL; - } - - retval = PyString_FromStringAndSize(NULL, (arglen/2)); - if (!retval) { - PyBuffer_Release(&parg); - return NULL; - } - retbuf = PyString_AS_STRING(retval); - - for (i=j=0; i < arglen; i += 2) { - int top = to_int(Py_CHARMASK(argbuf[i])); - int bot = to_int(Py_CHARMASK(argbuf[i+1])); - if (top == -1 || bot == -1) { - PyErr_SetString(PyExc_TypeError, - "Non-hexadecimal digit found"); - goto finally; - } - retbuf[j++] = (top << 4) + bot; - } - PyBuffer_Release(&parg); - return retval; - - finally: - PyBuffer_Release(&parg); - Py_DECREF(retval); - return NULL; -} - -PyDoc_STRVAR(doc_unhexlify, -"a2b_hex(hexstr) -> s; Binary data of hexadecimal representation.\n\ -\n\ -hexstr must contain an even number of hex digits (upper or lower case).\n\ -This function is also available as \"unhexlify()\""); - -static int table_hex[128] = { - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1, -1,-1,-1,-1, - -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,10,11,12, 13,14,15,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1 -}; - -#define hexval(c) table_hex[(unsigned int)(c)] - -#define MAXLINESIZE 76 - -PyDoc_STRVAR(doc_a2b_qp, "Decode a string of qp-encoded data"); - -static PyObject* -binascii_a2b_qp(PyObject *self, PyObject *args, PyObject *kwargs) -{ - Py_ssize_t in, out; - char ch; - Py_buffer pdata; - unsigned char *data, *odata; - Py_ssize_t datalen = 0; - PyObject *rv; - static char *kwlist[] = {"data", "header", NULL}; - int header = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|i", kwlist, &pdata, - &header)) - return NULL; - data = pdata.buf; - datalen = pdata.len; - - /* We allocate the output same size as input, this is overkill. - * The previous implementation used calloc() so we'll zero out the - * memory here too, since PyMem_Malloc() does not guarantee that. - */ - odata = (unsigned char *) PyMem_Malloc(datalen); - if (odata == NULL) { - PyBuffer_Release(&pdata); - PyErr_NoMemory(); - return NULL; - } - memset(odata, 0, datalen); - - in = out = 0; - while (in < datalen) { - if (data[in] == '=') { - in++; - if (in >= datalen) break; - /* Soft line breaks */ - if ((data[in] == '\n') || (data[in] == '\r')) { - if (data[in] != '\n') { - while (in < datalen && data[in] != '\n') in++; - } - if (in < datalen) in++; - } - else if (data[in] == '=') { - /* broken case from broken python qp */ - odata[out++] = '='; - in++; - } - else if (((data[in] >= 'A' && data[in] <= 'F') || - (data[in] >= 'a' && data[in] <= 'f') || - (data[in] >= '0' && data[in] <= '9')) && - ((data[in+1] >= 'A' && data[in+1] <= 'F') || - (data[in+1] >= 'a' && data[in+1] <= 'f') || - (data[in+1] >= '0' && data[in+1] <= '9'))) { - /* hexval */ - ch = hexval(data[in]) << 4; - in++; - ch |= hexval(data[in]); - in++; - odata[out++] = ch; - } - else { - odata[out++] = '='; - } - } - else if (header && data[in] == '_') { - odata[out++] = ' '; - in++; - } - else { - odata[out] = data[in]; - in++; - out++; - } - } - if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { - PyBuffer_Release(&pdata); - PyMem_Free(odata); - return NULL; - } - PyBuffer_Release(&pdata); - PyMem_Free(odata); - return rv; -} - -static int -to_hex (unsigned char ch, unsigned char *s) -{ - unsigned int uvalue = ch; - - s[1] = "0123456789ABCDEF"[uvalue % 16]; - uvalue = (uvalue / 16); - s[0] = "0123456789ABCDEF"[uvalue % 16]; - return 0; -} - -PyDoc_STRVAR(doc_b2a_qp, -"b2a_qp(data, quotetabs=0, istext=1, header=0) -> s; \n\ - Encode a string using quoted-printable encoding. \n\ -\n\ -On encoding, when istext is set, newlines are not encoded, and white \n\ -space at end of lines is. When istext is not set, \\r and \\n (CR/LF) are \n\ -both encoded. When quotetabs is set, space and tabs are encoded."); - -/* XXX: This is ridiculously complicated to be backward compatible - * (mostly) with the quopri module. It doesn't re-create the quopri - * module bug where text ending in CRLF has the CR encoded */ -static PyObject* -binascii_b2a_qp (PyObject *self, PyObject *args, PyObject *kwargs) -{ - Py_ssize_t in, out; - Py_buffer pdata; - unsigned char *data, *odata; - Py_ssize_t datalen = 0, odatalen = 0; - PyObject *rv; - unsigned int linelen = 0; - static char *kwlist[] = {"data", "quotetabs", "istext", - "header", NULL}; - int istext = 1; - int quotetabs = 0; - int header = 0; - unsigned char ch; - int crlf = 0; - unsigned char *p; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|iii", kwlist, &pdata, - "etabs, &istext, &header)) - return NULL; - data = pdata.buf; - datalen = pdata.len; - - /* See if this string is using CRLF line ends */ - /* XXX: this function has the side effect of converting all of - * the end of lines to be the same depending on this detection - * here */ - p = (unsigned char *) memchr(data, '\n', datalen); - if ((p != NULL) && (p > data) && (*(p-1) == '\r')) - crlf = 1; - - /* First, scan to see how many characters need to be encoded */ - in = 0; - while (in < datalen) { - if ((data[in] > 126) || - (data[in] == '=') || - (header && data[in] == '_') || - ((data[in] == '.') && (linelen == 0) && - (data[in+1] == '\n' || data[in+1] == '\r' || data[in+1] == 0)) || - (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || - ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || - ((data[in] < 33) && - (data[in] != '\r') && (data[in] != '\n') && - (quotetabs || - (!quotetabs && ((data[in] != '\t') && (data[in] != ' ')))))) - { - if ((linelen + 3) >= MAXLINESIZE) { - linelen = 0; - if (crlf) - odatalen += 3; - else - odatalen += 2; - } - linelen += 3; - odatalen += 3; - in++; - } - else { - if (istext && - ((data[in] == '\n') || - ((in+1 < datalen) && (data[in] == '\r') && - (data[in+1] == '\n')))) - { - linelen = 0; - /* Protect against whitespace on end of line */ - if (in && ((data[in-1] == ' ') || (data[in-1] == '\t'))) - odatalen += 2; - if (crlf) - odatalen += 2; - else - odatalen += 1; - if (data[in] == '\r') - in += 2; - else - in++; - } - else { - if ((in + 1 != datalen) && - (data[in+1] != '\n') && - (linelen + 1) >= MAXLINESIZE) { - linelen = 0; - if (crlf) - odatalen += 3; - else - odatalen += 2; - } - linelen++; - odatalen++; - in++; - } - } - } - - /* We allocate the output same size as input, this is overkill. - * The previous implementation used calloc() so we'll zero out the - * memory here too, since PyMem_Malloc() does not guarantee that. - */ - odata = (unsigned char *) PyMem_Malloc(odatalen); - if (odata == NULL) { - PyBuffer_Release(&pdata); - PyErr_NoMemory(); - return NULL; - } - memset(odata, 0, odatalen); - - in = out = linelen = 0; - while (in < datalen) { - if ((data[in] > 126) || - (data[in] == '=') || - (header && data[in] == '_') || - ((data[in] == '.') && (linelen == 0) && - (data[in+1] == '\n' || data[in+1] == '\r' || data[in+1] == 0)) || - (!istext && ((data[in] == '\r') || (data[in] == '\n'))) || - ((data[in] == '\t' || data[in] == ' ') && (in + 1 == datalen)) || - ((data[in] < 33) && - (data[in] != '\r') && (data[in] != '\n') && - (quotetabs || - (!quotetabs && ((data[in] != '\t') && (data[in] != ' ')))))) - { - if ((linelen + 3 )>= MAXLINESIZE) { - odata[out++] = '='; - if (crlf) odata[out++] = '\r'; - odata[out++] = '\n'; - linelen = 0; - } - odata[out++] = '='; - to_hex(data[in], &odata[out]); - out += 2; - in++; - linelen += 3; - } - else { - if (istext && - ((data[in] == '\n') || - ((in+1 < datalen) && (data[in] == '\r') && - (data[in+1] == '\n')))) - { - linelen = 0; - /* Protect against whitespace on end of line */ - if (out && ((odata[out-1] == ' ') || (odata[out-1] == '\t'))) { - ch = odata[out-1]; - odata[out-1] = '='; - to_hex(ch, &odata[out]); - out += 2; - } - - if (crlf) odata[out++] = '\r'; - odata[out++] = '\n'; - if (data[in] == '\r') - in += 2; - else - in++; - } - else { - if ((in + 1 != datalen) && - (data[in+1] != '\n') && - (linelen + 1) >= MAXLINESIZE) { - odata[out++] = '='; - if (crlf) odata[out++] = '\r'; - odata[out++] = '\n'; - linelen = 0; - } - linelen++; - if (header && data[in] == ' ') { - odata[out++] = '_'; - in++; - } - else { - odata[out++] = data[in++]; - } - } - } - } - if ((rv = PyString_FromStringAndSize((char *)odata, out)) == NULL) { - PyBuffer_Release(&pdata); - PyMem_Free(odata); - return NULL; - } - PyBuffer_Release(&pdata); - PyMem_Free(odata); - return rv; -} - -/* List of functions defined in the module */ - -static struct PyMethodDef binascii_module_methods[] = { - {"a2b_uu", binascii_a2b_uu, METH_VARARGS, doc_a2b_uu}, - {"b2a_uu", binascii_b2a_uu, METH_VARARGS, doc_b2a_uu}, - {"a2b_base64", binascii_a2b_base64, METH_VARARGS, doc_a2b_base64}, - {"b2a_base64", binascii_b2a_base64, METH_VARARGS, doc_b2a_base64}, - {"a2b_hqx", binascii_a2b_hqx, METH_VARARGS, doc_a2b_hqx}, - {"b2a_hqx", binascii_b2a_hqx, METH_VARARGS, doc_b2a_hqx}, - {"b2a_hex", binascii_hexlify, METH_VARARGS, doc_hexlify}, - {"a2b_hex", binascii_unhexlify, METH_VARARGS, doc_unhexlify}, - {"hexlify", binascii_hexlify, METH_VARARGS, doc_hexlify}, - {"unhexlify", binascii_unhexlify, METH_VARARGS, doc_unhexlify}, - {"rlecode_hqx", binascii_rlecode_hqx, METH_VARARGS, doc_rlecode_hqx}, - {"rledecode_hqx", binascii_rledecode_hqx, METH_VARARGS, - doc_rledecode_hqx}, - {"crc_hqx", binascii_crc_hqx, METH_VARARGS, doc_crc_hqx}, - {"crc32", binascii_crc32, METH_VARARGS, doc_crc32}, - {"a2b_qp", (PyCFunction)binascii_a2b_qp, METH_VARARGS | METH_KEYWORDS, - doc_a2b_qp}, - {"b2a_qp", (PyCFunction)binascii_b2a_qp, METH_VARARGS | METH_KEYWORDS, - doc_b2a_qp}, - {NULL, NULL} /* sentinel */ -}; - - -/* Initialization function for the module (*must* be called initbinascii) */ -PyDoc_STRVAR(doc_binascii, "Conversion between binary data and ASCII"); - -PyMODINIT_FUNC -initbinascii(void) -{ - PyObject *m, *d, *x; - - /* Create the module and add the functions */ - m = Py_InitModule("binascii", binascii_module_methods); - if (m == NULL) - return; - - d = PyModule_GetDict(m); - x = PyString_FromString(doc_binascii); - PyDict_SetItemString(d, "__doc__", x); - Py_XDECREF(x); - - Error = PyErr_NewException("binascii.Error", NULL, NULL); - PyDict_SetItemString(d, "Error", Error); - Incomplete = PyErr_NewException("binascii.Incomplete", NULL, NULL); - PyDict_SetItemString(d, "Incomplete", Incomplete); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cPickle.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cPickle.c deleted file mode 100644 index 11fb895..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cPickle.c +++ /dev/null @@ -1,6058 +0,0 @@ -#include "Python.h" -#include "cStringIO.h" -#include "structmember.h" - -PyDoc_STRVAR(cPickle_module_documentation, -"C implementation and optimization of the Python pickle module."); - -#ifndef Py_eval_input -#include -#define Py_eval_input eval_input -#endif /* Py_eval_input */ - -#define DEL_LIST_SLICE(list, from, to) (PyList_SetSlice(list, from, to, NULL)) - -#define WRITE_BUF_SIZE 256 - -/* Bump this when new opcodes are added to the pickle protocol. */ -#define HIGHEST_PROTOCOL 2 - -/* - * Note: The UNICODE macro controls the TCHAR meaning of the win32 API. Since - * all headers have already been included here, we can safely redefine it. - */ -#ifdef UNICODE -# undef UNICODE -#endif - -/* - * Pickle opcodes. These must be kept in synch with pickle.py. Extensive - * docs are in pickletools.py. - */ -#define MARK '(' -#define STOP '.' -#define POP '0' -#define POP_MARK '1' -#define DUP '2' -#define FLOAT 'F' -#define BINFLOAT 'G' -#define INT 'I' -#define BININT 'J' -#define BININT1 'K' -#define LONG 'L' -#define BININT2 'M' -#define NONE 'N' -#define PERSID 'P' -#define BINPERSID 'Q' -#define REDUCE 'R' -#define STRING 'S' -#define BINSTRING 'T' -#define SHORT_BINSTRING 'U' -#define UNICODE 'V' -#define BINUNICODE 'X' -#define APPEND 'a' -#define BUILD 'b' -#define GLOBAL 'c' -#define DICT 'd' -#define EMPTY_DICT '}' -#define APPENDS 'e' -#define GET 'g' -#define BINGET 'h' -#define INST 'i' -#define LONG_BINGET 'j' -#define LIST 'l' -#define EMPTY_LIST ']' -#define OBJ 'o' -#define PUT 'p' -#define BINPUT 'q' -#define LONG_BINPUT 'r' -#define SETITEM 's' -#define TUPLE 't' -#define EMPTY_TUPLE ')' -#define SETITEMS 'u' - -/* Protocol 2. */ -#define PROTO '\x80' /* identify pickle protocol */ -#define NEWOBJ '\x81' /* build object by applying cls.__new__ to argtuple */ -#define EXT1 '\x82' /* push object from extension registry; 1-byte index */ -#define EXT2 '\x83' /* ditto, but 2-byte index */ -#define EXT4 '\x84' /* ditto, but 4-byte index */ -#define TUPLE1 '\x85' /* build 1-tuple from stack top */ -#define TUPLE2 '\x86' /* build 2-tuple from two topmost stack items */ -#define TUPLE3 '\x87' /* build 3-tuple from three topmost stack items */ -#define NEWTRUE '\x88' /* push True */ -#define NEWFALSE '\x89' /* push False */ -#define LONG1 '\x8a' /* push long from < 256 bytes */ -#define LONG4 '\x8b' /* push really big long */ - -/* There aren't opcodes -- they're ways to pickle bools before protocol 2, - * so that unpicklers written before bools were introduced unpickle them - * as ints, but unpicklers after can recognize that bools were intended. - * Note that protocol 2 added direct ways to pickle bools. - */ -#undef TRUE -#define TRUE "I01\n" -#undef FALSE -#define FALSE "I00\n" - -/* Keep in synch with pickle.Pickler._BATCHSIZE. This is how many elements - * batch_list/dict() pumps out before doing APPENDS/SETITEMS. Nothing will - * break if this gets out of synch with pickle.py, but it's unclear that - * would help anything either. - */ -#define BATCHSIZE 1000 - -static char MARKv = MARK; - -static PyObject *PickleError; -static PyObject *PicklingError; -static PyObject *UnpickleableError; -static PyObject *UnpicklingError; -static PyObject *BadPickleGet; - -/* As the name says, an empty tuple. */ -static PyObject *empty_tuple; - -/* copy_reg.dispatch_table, {type_object: pickling_function} */ -static PyObject *dispatch_table; - -/* For EXT[124] opcodes. */ -/* copy_reg._extension_registry, {(module_name, function_name): code} */ -static PyObject *extension_registry; -/* copy_reg._inverted_registry, {code: (module_name, function_name)} */ -static PyObject *inverted_registry; -/* copy_reg._extension_cache, {code: object} */ -static PyObject *extension_cache; - -/* For looking up name pairs in copy_reg._extension_registry. */ -static PyObject *two_tuple; - -static PyObject *__class___str, *__getinitargs___str, *__dict___str, - *__getstate___str, *__setstate___str, *__name___str, *__reduce___str, - *__reduce_ex___str, - *write_str, *append_str, - *read_str, *readline_str, *__main___str, - *dispatch_table_str; - -/************************************************************************* - Internal Data type for pickle data. */ - -typedef struct { - PyObject_HEAD - Py_ssize_t length; /* number of initial slots in data currently used */ - Py_ssize_t size; /* number of slots in data allocated */ - PyObject **data; -} Pdata; - -static void -Pdata_dealloc(Pdata *self) -{ - Py_ssize_t i; - PyObject **p; - - for (i = self->length, p = self->data; --i >= 0; p++) { - Py_DECREF(*p); - } - if (self->data) - free(self->data); - PyObject_Del(self); -} - -static PyTypeObject PdataType = { - PyVarObject_HEAD_INIT(NULL, 0) "cPickle.Pdata", sizeof(Pdata), 0, - (destructor)Pdata_dealloc, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0L,0L,0L,0L, "" -}; - -#define Pdata_Check(O) (Py_TYPE(O) == &PdataType) - -static PyObject * -Pdata_New(void) -{ - Pdata *self; - - if (!(self = PyObject_New(Pdata, &PdataType))) - return NULL; - self->size = 8; - self->length = 0; - self->data = malloc(self->size * sizeof(PyObject*)); - if (self->data) - return (PyObject*)self; - Py_DECREF(self); - return PyErr_NoMemory(); -} - -static int -stackUnderflow(void) -{ - PyErr_SetString(UnpicklingError, "unpickling stack underflow"); - return -1; -} - -/* Retain only the initial clearto items. If clearto >= the current - * number of items, this is a (non-erroneous) NOP. - */ -static int -Pdata_clear(Pdata *self, Py_ssize_t clearto) -{ - Py_ssize_t i; - PyObject **p; - - if (clearto < 0) return stackUnderflow(); - if (clearto >= self->length) return 0; - - for (i = self->length, p = self->data + clearto; - --i >= clearto; - p++) { - Py_CLEAR(*p); - } - self->length = clearto; - - return 0; -} - -static int -Pdata_grow(Pdata *self) -{ - Py_ssize_t bigger; - Py_ssize_t nbytes; - - PyObject **tmp; - - if (self->size > (PY_SSIZE_T_MAX >> 1)) - goto nomemory; - bigger = self->size << 1; - if (bigger > (PY_SSIZE_T_MAX / sizeof(PyObject *))) - goto nomemory; - nbytes = bigger * sizeof(PyObject *); - tmp = realloc(self->data, nbytes); - if (tmp == NULL) - goto nomemory; - self->data = tmp; - self->size = bigger; - return 0; - - nomemory: - PyErr_NoMemory(); - return -1; -} - -/* D is a Pdata*. Pop the topmost element and store it into V, which - * must be an lvalue holding PyObject*. On stack underflow, UnpicklingError - * is raised and V is set to NULL. D and V may be evaluated several times. - */ -#define PDATA_POP(D, V) { \ - if ((D)->length) \ - (V) = (D)->data[--((D)->length)]; \ - else { \ - PyErr_SetString(UnpicklingError, "bad pickle data"); \ - (V) = NULL; \ - } \ -} - -/* PDATA_PUSH and PDATA_APPEND both push rvalue PyObject* O on to Pdata* - * D. If the Pdata stack can't be grown to hold the new value, both - * raise MemoryError and execute "return ER". The difference is in ownership - * of O after: _PUSH transfers ownership of O from the caller to the stack - * (no incref of O is done, and in case of error O is decrefed), while - * _APPEND pushes a new reference. - */ - -/* Push O on stack D, giving ownership of O to the stack. */ -#define PDATA_PUSH(D, O, ER) { \ - if (((Pdata*)(D))->length == ((Pdata*)(D))->size && \ - Pdata_grow((Pdata*)(D)) < 0) { \ - Py_DECREF(O); \ - return ER; \ - } \ - ((Pdata*)(D))->data[((Pdata*)(D))->length++] = (O); \ -} - -/* Push O on stack D, pushing a new reference. */ -#define PDATA_APPEND(D, O, ER) { \ - if (((Pdata*)(D))->length == ((Pdata*)(D))->size && \ - Pdata_grow((Pdata*)(D)) < 0) \ - return ER; \ - Py_INCREF(O); \ - ((Pdata*)(D))->data[((Pdata*)(D))->length++] = (O); \ -} - - -static PyObject * -Pdata_popTuple(Pdata *self, Py_ssize_t start) -{ - PyObject *r; - Py_ssize_t i, j, l; - - l = self->length-start; - r = PyTuple_New(l); - if (r == NULL) - return NULL; - for (i = start, j = 0 ; j < l; i++, j++) - PyTuple_SET_ITEM(r, j, self->data[i]); - - self->length = start; - return r; -} - -static PyObject * -Pdata_popList(Pdata *self, Py_ssize_t start) -{ - PyObject *r; - Py_ssize_t i, j, l; - - l=self->length-start; - if (!( r=PyList_New(l))) return NULL; - for (i=start, j=0 ; j < l; i++, j++) - PyList_SET_ITEM(r, j, self->data[i]); - - self->length=start; - return r; -} - -/*************************************************************************/ - -#define ARG_TUP(self, o) { \ - if (self->arg || (self->arg=PyTuple_New(1))) { \ - Py_XDECREF(PyTuple_GET_ITEM(self->arg,0)); \ - PyTuple_SET_ITEM(self->arg,0,o); \ - } \ - else { \ - Py_DECREF(o); \ - } \ -} - -#define FREE_ARG_TUP(self) { \ - if (Py_REFCNT(self->arg) > 1) { \ - Py_CLEAR(self->arg); \ - } \ - } - -typedef struct Picklerobject { - PyObject_HEAD - FILE *fp; - PyObject *write; - PyObject *file; - PyObject *memo; - PyObject *arg; - PyObject *pers_func; - PyObject *inst_pers_func; - - /* pickle protocol number, >= 0 */ - int proto; - - /* bool, true if proto > 0 */ - int bin; - - int fast; /* Fast mode doesn't save in memo, don't use if circ ref */ - Py_ssize_t (*write_func)(struct Picklerobject *, const char *, Py_ssize_t); - char *write_buf; - Py_ssize_t buf_size; - PyObject *dispatch_table; - int fast_container; /* count nested container dumps */ - PyObject *fast_memo; -} Picklerobject; - -#ifndef PY_CPICKLE_FAST_LIMIT -#define PY_CPICKLE_FAST_LIMIT 50 -#endif - -static PyTypeObject Picklertype; - -typedef struct Unpicklerobject { - PyObject_HEAD - FILE *fp; - PyObject *file; - PyObject *readline; - PyObject *read; - PyObject *memo; - PyObject *arg; - Pdata *stack; - PyObject *mark; - PyObject *pers_func; - PyObject *last_string; - Py_ssize_t *marks; - Py_ssize_t num_marks; - Py_ssize_t marks_size; - Py_ssize_t (*read_func)(struct Unpicklerobject *, char **, Py_ssize_t); - Py_ssize_t (*readline_func)(struct Unpicklerobject *, char **); - Py_ssize_t buf_size; - char *buf; - PyObject *find_class; -} Unpicklerobject; - -static PyTypeObject Unpicklertype; - -/* Forward decls that need the above structs */ -static int save(Picklerobject *, PyObject *, int); -static int put2(Picklerobject *, PyObject *); - -static -PyObject * -cPickle_ErrFormat(PyObject *ErrType, char *stringformat, char *format, ...) -{ - va_list va; - PyObject *args=0, *retval=0; - va_start(va, format); - - if (format) args = Py_VaBuildValue(format, va); - va_end(va); - if (format && ! args) return NULL; - if (stringformat && !(retval=PyString_FromString(stringformat))) - return NULL; - - if (retval) { - if (args) { - PyObject *v; - v=PyString_Format(retval, args); - Py_DECREF(retval); - Py_DECREF(args); - if (! v) return NULL; - retval=v; - } - } - else - if (args) retval=args; - else { - PyErr_SetObject(ErrType,Py_None); - return NULL; - } - PyErr_SetObject(ErrType,retval); - Py_DECREF(retval); - return NULL; -} - -static Py_ssize_t -write_file(Picklerobject *self, const char *s, Py_ssize_t n) -{ - size_t nbyteswritten; - - if (s == NULL) { - return 0; - } - - PyFile_IncUseCount((PyFileObject *)self->file); - Py_BEGIN_ALLOW_THREADS - nbyteswritten = fwrite(s, sizeof(char), n, self->fp); - Py_END_ALLOW_THREADS - PyFile_DecUseCount((PyFileObject *)self->file); - if (nbyteswritten != (size_t)n) { - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - - return n; -} - -static Py_ssize_t -write_cStringIO(Picklerobject *self, const char *s, Py_ssize_t n) -{ - Py_ssize_t len = n; - - if (s == NULL) { - return 0; - } - - while (n > INT_MAX) { - if (PycStringIO->cwrite((PyObject *)self->file, s, INT_MAX) != INT_MAX) { - return -1; - } - n -= INT_MAX; - } - - if (PycStringIO->cwrite((PyObject *)self->file, s, n) != n) { - return -1; - } - - return len; -} - -static Py_ssize_t -write_none(Picklerobject *self, const char *s, Py_ssize_t n) -{ - if (s == NULL) return 0; - return n; -} - -static Py_ssize_t -write_other(Picklerobject *self, const char *s, Py_ssize_t n) -{ - PyObject *py_str = 0, *junk = 0; - - if (s == NULL) { - if (!( self->buf_size )) return 0; - py_str = PyString_FromStringAndSize(self->write_buf, - self->buf_size); - if (!py_str) - return -1; - } - else { - if (self->buf_size && n > WRITE_BUF_SIZE - self->buf_size) { - if (write_other(self, NULL, 0) < 0) - return -1; - } - - if (n > WRITE_BUF_SIZE) { - if (!( py_str = - PyString_FromStringAndSize(s, n))) - return -1; - } - else { - memcpy(self->write_buf + self->buf_size, s, n); - self->buf_size += n; - return n; - } - } - - if (self->write) { - /* object with write method */ - ARG_TUP(self, py_str); - if (self->arg) { - junk = PyObject_Call(self->write, self->arg, NULL); - FREE_ARG_TUP(self); - } - if (junk) Py_DECREF(junk); - else return -1; - } - else - PDATA_PUSH(self->file, py_str, -1); - - self->buf_size = 0; - return n; -} - - -static Py_ssize_t -read_file(Unpicklerobject *self, char **s, Py_ssize_t n) -{ - size_t nbytesread; - - if (self->buf_size == 0) { - Py_ssize_t size; - - size = ((n < 32) ? 32 : n); - if (!( self->buf = (char *)malloc(size))) { - PyErr_NoMemory(); - return -1; - } - - self->buf_size = size; - } - else if (n > self->buf_size) { - char *newbuf = (char *)realloc(self->buf, n); - if (!newbuf) { - PyErr_NoMemory(); - return -1; - } - self->buf = newbuf; - self->buf_size = n; - } - - PyFile_IncUseCount((PyFileObject *)self->file); - Py_BEGIN_ALLOW_THREADS - nbytesread = fread(self->buf, sizeof(char), n, self->fp); - Py_END_ALLOW_THREADS - PyFile_DecUseCount((PyFileObject *)self->file); - if (nbytesread != (size_t)n) { - if (feof(self->fp)) { - PyErr_SetNone(PyExc_EOFError); - return -1; - } - - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - - *s = self->buf; - - return n; -} - - -static Py_ssize_t -readline_file(Unpicklerobject *self, char **s) -{ - Py_ssize_t i; - - if (self->buf_size == 0) { - if (!( self->buf = (char *)malloc(40))) { - PyErr_NoMemory(); - return -1; - } - self->buf_size = 40; - } - - i = 0; - while (1) { - Py_ssize_t bigger; - char *newbuf; - for (; i < (self->buf_size - 1); i++) { - if (feof(self->fp) || - (self->buf[i] = getc(self->fp)) == '\n') { - self->buf[i + 1] = '\0'; - *s = self->buf; - return i + 1; - } - } - if (self->buf_size > (PY_SSIZE_T_MAX >> 1)) { - PyErr_NoMemory(); - return -1; - } - bigger = self->buf_size << 1; - newbuf = (char *)realloc(self->buf, bigger); - if (newbuf == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buf = newbuf; - self->buf_size = bigger; - } -} - - -static Py_ssize_t -read_cStringIO(Unpicklerobject *self, char **s, Py_ssize_t n) -{ - Py_ssize_t len = n; - char *start, *end = NULL; - - while (1) { - int k; - char *ptr; - if (n > INT_MAX) - k = INT_MAX; - else - k = (int)n; - if (PycStringIO->cread((PyObject *)self->file, &ptr, k) != k) { - PyErr_SetNone(PyExc_EOFError); - return -1; - } - if (end == NULL) - start = ptr; - else if (ptr != end) { - /* non-continuous area */ - return -1; - } - if (n <= INT_MAX) - break; - end = ptr + INT_MAX; - n -= INT_MAX; - } - - *s = start; - - return len; -} - - -static Py_ssize_t -readline_cStringIO(Unpicklerobject *self, char **s) -{ - Py_ssize_t n = 0; - char *start = NULL, *end = NULL; - - while (1) { - int k; - char *ptr; - if ((k = PycStringIO->creadline((PyObject *)self->file, &ptr)) < 0) { - return -1; - } - n += k; - if (end == NULL) - start = ptr; - else if (ptr != end) { - /* non-continuous area */ - return -1; - } - if (k == 0 || ptr[k - 1] == '\n') - break; - end = ptr + k; - } - - *s = start; - - return n; -} - - -static Py_ssize_t -read_other(Unpicklerobject *self, char **s, Py_ssize_t n) -{ - PyObject *bytes, *str=0; - - if (!( bytes = PyInt_FromSsize_t(n))) return -1; - - ARG_TUP(self, bytes); - if (self->arg) { - str = PyObject_Call(self->read, self->arg, NULL); - FREE_ARG_TUP(self); - } - if (! str) return -1; - - Py_XDECREF(self->last_string); - self->last_string = str; - - if (! (*s = PyString_AsString(str))) return -1; - - if (PyString_GET_SIZE(str) != n) { - PyErr_SetNone(PyExc_EOFError); - return -1; - } - - return n; -} - - -static Py_ssize_t -readline_other(Unpicklerobject *self, char **s) -{ - PyObject *str; - Py_ssize_t str_size; - - if (!( str = PyObject_CallObject(self->readline, empty_tuple))) { - return -1; - } - - if ((str_size = PyString_Size(str)) < 0) - return -1; - - Py_XDECREF(self->last_string); - self->last_string = str; - - if (! (*s = PyString_AsString(str))) - return -1; - - return str_size; -} - -/* Copy the first n bytes from s into newly malloc'ed memory, plus a - * trailing 0 byte. Return a pointer to that, or NULL if out of memory. - * The caller is responsible for free()'ing the return value. - */ -static char * -pystrndup(const char *s, Py_ssize_t n) -{ - char *r = (char *)malloc(n+1); - if (r == NULL) - return (char*)PyErr_NoMemory(); - memcpy(r, s, n); - r[n] = 0; - return r; -} - - -static int -get(Picklerobject *self, PyObject *id) -{ - PyObject *value, *mv; - Py_ssize_t c_value; - char s[30]; - size_t len; - - if (!( mv = PyDict_GetItem(self->memo, id))) { - PyErr_SetObject(PyExc_KeyError, id); - return -1; - } - - if (!( value = PyTuple_GetItem(mv, 0))) - return -1; - - if (!( PyInt_Check(value))) { - PyErr_SetString(PicklingError, "no int where int expected in memo"); - return -1; - } - c_value = PyInt_AS_LONG((PyIntObject*)value); - - if (!self->bin) { - s[0] = GET; - PyOS_snprintf(s + 1, sizeof(s) - 1, - "%" PY_FORMAT_SIZE_T "d\n", c_value); - len = strlen(s); - } - else if (Pdata_Check(self->file)) { - if (write_other(self, NULL, 0) < 0) return -1; - PDATA_APPEND(self->file, mv, -1); - return 0; - } - else { - if (c_value < 256) { - s[0] = BINGET; - s[1] = (int)(c_value & 0xff); - len = 2; - } - else { - s[0] = LONG_BINGET; - s[1] = (int)(c_value & 0xff); - s[2] = (int)((c_value >> 8) & 0xff); - s[3] = (int)((c_value >> 16) & 0xff); - s[4] = (int)((c_value >> 24) & 0xff); - len = 5; - } - } - - if (self->write_func(self, s, len) < 0) - return -1; - - return 0; -} - - -static int -put(Picklerobject *self, PyObject *ob) -{ - if (Py_REFCNT(ob) < 2 || self->fast) - return 0; - - return put2(self, ob); -} - - -static int -put2(Picklerobject *self, PyObject *ob) -{ - char c_str[30]; - Py_ssize_t len, p; - int res = -1; - PyObject *py_ob_id = 0, *memo_len = 0, *t = 0; - - if (self->fast) - return 0; - - if ((p = PyDict_Size(self->memo)) < 0) - goto finally; - - /* Make sure memo keys are positive! */ - /* XXX Why? - * XXX And does "positive" really mean non-negative? - * XXX pickle.py starts with PUT index 0, not 1. This makes for - * XXX gratuitous differences between the pickling modules. - */ - p++; - - if (!( py_ob_id = PyLong_FromVoidPtr(ob))) - goto finally; - - if (!( memo_len = PyInt_FromLong(p))) - goto finally; - - if (!( t = PyTuple_New(2))) - goto finally; - - PyTuple_SET_ITEM(t, 0, memo_len); - Py_INCREF(memo_len); - PyTuple_SET_ITEM(t, 1, ob); - Py_INCREF(ob); - - if (PyDict_SetItem(self->memo, py_ob_id, t) < 0) - goto finally; - - if (!self->bin) { - c_str[0] = PUT; - PyOS_snprintf(c_str + 1, sizeof(c_str) - 1, - "%" PY_FORMAT_SIZE_T "d\n", p); - len = strlen(c_str); - } - else if (Pdata_Check(self->file)) { - if (write_other(self, NULL, 0) < 0) return -1; - PDATA_APPEND(self->file, memo_len, -1); - res=0; /* Job well done ;) */ - goto finally; - } - else { - if (p >= 256) { - c_str[0] = LONG_BINPUT; - c_str[1] = (int)(p & 0xff); - c_str[2] = (int)((p >> 8) & 0xff); - c_str[3] = (int)((p >> 16) & 0xff); - c_str[4] = (int)((p >> 24) & 0xff); - len = 5; - } - else { - c_str[0] = BINPUT; - c_str[1] = p; - len = 2; - } - } - - if (self->write_func(self, c_str, len) < 0) - goto finally; - - res = 0; - - finally: - Py_XDECREF(py_ob_id); - Py_XDECREF(memo_len); - Py_XDECREF(t); - - return res; -} - -static PyObject * -whichmodule(PyObject *global, PyObject *global_name) -{ - Py_ssize_t i, j; - PyObject *module = 0, *modules_dict = 0, - *global_name_attr = 0, *name = 0; - - module = PyObject_GetAttrString(global, "__module__"); - if (module) - return module; - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - - if (!( modules_dict = PySys_GetObject("modules"))) - return NULL; - - i = 0; - while ((j = PyDict_Next(modules_dict, &i, &name, &module))) { - - if (PyObject_Compare(name, __main___str)==0) continue; - - global_name_attr = PyObject_GetAttr(module, global_name); - if (!global_name_attr) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - continue; - } - - if (global_name_attr != global) { - Py_DECREF(global_name_attr); - continue; - } - - Py_DECREF(global_name_attr); - - break; - } - - /* The following implements the rule in pickle.py added in 1.5 - that used __main__ if no module is found. I don't actually - like this rule. jlf - */ - if (!j) { - name=__main___str; - } - - Py_INCREF(name); - return name; -} - - -static int -fast_save_enter(Picklerobject *self, PyObject *obj) -{ - /* if fast_container < 0, we're doing an error exit. */ - if (++self->fast_container >= PY_CPICKLE_FAST_LIMIT) { - PyObject *key = NULL; - if (self->fast_memo == NULL) { - self->fast_memo = PyDict_New(); - if (self->fast_memo == NULL) { - self->fast_container = -1; - return 0; - } - } - key = PyLong_FromVoidPtr(obj); - if (key == NULL) - return 0; - if (PyDict_GetItem(self->fast_memo, key)) { - Py_DECREF(key); - PyErr_Format(PyExc_ValueError, - "fast mode: can't pickle cyclic objects " - "including object type %s at %p", - Py_TYPE(obj)->tp_name, obj); - self->fast_container = -1; - return 0; - } - if (PyDict_SetItem(self->fast_memo, key, Py_None) < 0) { - Py_DECREF(key); - self->fast_container = -1; - return 0; - } - Py_DECREF(key); - } - return 1; -} - -int -fast_save_leave(Picklerobject *self, PyObject *obj) -{ - if (self->fast_container-- >= PY_CPICKLE_FAST_LIMIT) { - PyObject *key = PyLong_FromVoidPtr(obj); - if (key == NULL) - return 0; - if (PyDict_DelItem(self->fast_memo, key) < 0) { - Py_DECREF(key); - return 0; - } - Py_DECREF(key); - } - return 1; -} - -static int -save_none(Picklerobject *self, PyObject *args) -{ - static char none = NONE; - if (self->write_func(self, &none, 1) < 0) - return -1; - - return 0; -} - -static int -save_bool(Picklerobject *self, PyObject *args) -{ - static const char *buf[2] = {FALSE, TRUE}; - static char len[2] = {sizeof(FALSE)-1, sizeof(TRUE)-1}; - long l = PyInt_AS_LONG((PyIntObject *)args); - - if (self->proto >= 2) { - char opcode = l ? NEWTRUE : NEWFALSE; - if (self->write_func(self, &opcode, 1) < 0) - return -1; - } - else if (self->write_func(self, buf[l], len[l]) < 0) - return -1; - return 0; -} - -static int -save_int(Picklerobject *self, PyObject *args) -{ - char c_str[32]; - long l = PyInt_AS_LONG((PyIntObject *)args); - Py_ssize_t len = 0; - - if (!self->bin -#if SIZEOF_LONG > 4 - || l > 0x7fffffffL - || l < -0x80000000L -#endif - ) { - /* Text-mode pickle, or long too big to fit in the 4-byte - * signed BININT format: store as a string. - */ - c_str[0] = INT; - PyOS_snprintf(c_str + 1, sizeof(c_str) - 1, "%ld\n", l); - if (self->write_func(self, c_str, strlen(c_str)) < 0) - return -1; - } - else { - /* Binary pickle and l fits in a signed 4-byte int. */ - c_str[1] = (int)( l & 0xff); - c_str[2] = (int)((l >> 8) & 0xff); - c_str[3] = (int)((l >> 16) & 0xff); - c_str[4] = (int)((l >> 24) & 0xff); - - if ((c_str[4] == 0) && (c_str[3] == 0)) { - if (c_str[2] == 0) { - c_str[0] = BININT1; - len = 2; - } - else { - c_str[0] = BININT2; - len = 3; - } - } - else { - c_str[0] = BININT; - len = 5; - } - - if (self->write_func(self, c_str, len) < 0) - return -1; - } - - return 0; -} - - -static int -save_long(Picklerobject *self, PyObject *args) -{ - Py_ssize_t size; - int res = -1; - PyObject *repr = NULL; - - static char l = LONG; - - if (self->proto >= 2) { - /* Linear-time pickling. */ - size_t nbits; - size_t nbytes; - unsigned char *pdata; - char c_str[5]; - int i; - int sign = _PyLong_Sign(args); - - if (sign == 0) { - /* It's 0 -- an empty bytestring. */ - c_str[0] = LONG1; - c_str[1] = 0; - i = self->write_func(self, c_str, 2); - if (i < 0) goto finally; - res = 0; - goto finally; - } - nbits = _PyLong_NumBits(args); - if (nbits == (size_t)-1 && PyErr_Occurred()) - goto finally; - /* How many bytes do we need? There are nbits >> 3 full - * bytes of data, and nbits & 7 leftover bits. If there - * are any leftover bits, then we clearly need another - * byte. Wnat's not so obvious is that we *probably* - * need another byte even if there aren't any leftovers: - * the most-significant bit of the most-significant byte - * acts like a sign bit, and it's usually got a sense - * opposite of the one we need. The exception is longs - * of the form -(2**(8*j-1)) for j > 0. Such a long is - * its own 256's-complement, so has the right sign bit - * even without the extra byte. That's a pain to check - * for in advance, though, so we always grab an extra - * byte at the start, and cut it back later if possible. - */ - nbytes = (nbits >> 3) + 1; - if (nbytes > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, "long too large " - "to pickle"); - goto finally; - } - repr = PyString_FromStringAndSize(NULL, (int)nbytes); - if (repr == NULL) goto finally; - pdata = (unsigned char *)PyString_AS_STRING(repr); - i = _PyLong_AsByteArray((PyLongObject *)args, - pdata, nbytes, - 1 /* little endian */, 1 /* signed */); - if (i < 0) goto finally; - /* If the long is negative, this may be a byte more than - * needed. This is so iff the MSB is all redundant sign - * bits. - */ - if (sign < 0 && nbytes > 1 && pdata[nbytes - 1] == 0xff && - (pdata[nbytes - 2] & 0x80) != 0) - --nbytes; - - if (nbytes < 256) { - c_str[0] = LONG1; - c_str[1] = (char)nbytes; - size = 2; - } - else { - c_str[0] = LONG4; - size = (int)nbytes; - for (i = 1; i < 5; i++) { - c_str[i] = (char)(size & 0xff); - size >>= 8; - } - size = 5; - } - i = self->write_func(self, c_str, size); - if (i < 0) goto finally; - i = self->write_func(self, (char *)pdata, (int)nbytes); - if (i < 0) goto finally; - res = 0; - goto finally; - } - - /* proto < 2: write the repr and newline. This is quadratic-time - * (in the number of digits), in both directions. - */ - if (!( repr = PyObject_Repr(args))) - goto finally; - - if ((size = PyString_Size(repr)) < 0) - goto finally; - - if (self->write_func(self, &l, 1) < 0) - goto finally; - - if (self->write_func(self, - PyString_AS_STRING((PyStringObject *)repr), - size) < 0) - goto finally; - - if (self->write_func(self, "\n", 1) < 0) - goto finally; - - res = 0; - - finally: - Py_XDECREF(repr); - return res; -} - - -static int -save_float(Picklerobject *self, PyObject *args) -{ - double x = PyFloat_AS_DOUBLE((PyFloatObject *)args); - - if (self->bin) { - char str[9]; - str[0] = BINFLOAT; - if (_PyFloat_Pack8(x, (unsigned char *)&str[1], 0) < 0) - return -1; - if (self->write_func(self, str, 9) < 0) - return -1; - } - else { - int result = -1; - char *buf = NULL; - char op = FLOAT; - - if (self->write_func(self, &op, 1) < 0) - goto done; - - buf = PyOS_double_to_string(x, 'g', 17, 0, NULL); - if (!buf) { - PyErr_NoMemory(); - goto done; - } - - if (self->write_func(self, buf, strlen(buf)) < 0) - goto done; - - if (self->write_func(self, "\n", 1) < 0) - goto done; - - result = 0; -done: - PyMem_Free(buf); - return result; - } - - return 0; -} - - -static int -save_string(Picklerobject *self, PyObject *args, int doput) -{ - Py_ssize_t size, len; - PyObject *repr=0; - - if ((size = PyString_Size(args)) < 0) - return -1; - - if (!self->bin) { - char *repr_str; - - static char string = STRING; - - if (!( repr = PyObject_Repr(args))) - return -1; - - if ((len = PyString_Size(repr)) < 0) - goto err; - repr_str = PyString_AS_STRING((PyStringObject *)repr); - - if (self->write_func(self, &string, 1) < 0) - goto err; - - if (self->write_func(self, repr_str, len) < 0) - goto err; - - if (self->write_func(self, "\n", 1) < 0) - goto err; - - Py_XDECREF(repr); - } - else { - int i; - char c_str[5]; - - if (size < 256) { - c_str[0] = SHORT_BINSTRING; - c_str[1] = size; - len = 2; - } - else if (size <= INT_MAX) { - c_str[0] = BINSTRING; - for (i = 1; i < 5; i++) - c_str[i] = (int)(size >> ((i - 1) * 8)); - len = 5; - } - else - return -1; /* string too large */ - - if (self->write_func(self, c_str, len) < 0) - return -1; - - if (size > 128 && Pdata_Check(self->file)) { - if (write_other(self, NULL, 0) < 0) return -1; - PDATA_APPEND(self->file, args, -1); - } - else { - if (self->write_func(self, - PyString_AS_STRING( - (PyStringObject *)args), - size) < 0) - return -1; - } - } - - if (doput) - if (put(self, args) < 0) - return -1; - - return 0; - - err: - Py_XDECREF(repr); - return -1; -} - - -#ifdef Py_USING_UNICODE -/* A copy of PyUnicode_EncodeRawUnicodeEscape() that also translates - backslash and newline characters to \uXXXX escapes. */ -static PyObject * -modified_EncodeRawUnicodeEscape(const Py_UNICODE *s, Py_ssize_t size) -{ - PyObject *repr; - char *p; - char *q; - - static const char *hexdigit = "0123456789abcdef"; -#ifdef Py_UNICODE_WIDE - const Py_ssize_t expandsize = 10; -#else - const Py_ssize_t expandsize = 6; -#endif - - if (size > PY_SSIZE_T_MAX / expandsize) - return PyErr_NoMemory(); - - repr = PyString_FromStringAndSize(NULL, expandsize * size); - if (repr == NULL) - return NULL; - if (size == 0) - return repr; - - p = q = PyString_AS_STRING(repr); - while (size-- > 0) { - Py_UNICODE ch = *s++; -#ifdef Py_UNICODE_WIDE - /* Map 32-bit characters to '\Uxxxxxxxx' */ - if (ch >= 0x10000) { - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigit[(ch >> 28) & 0xf]; - *p++ = hexdigit[(ch >> 24) & 0xf]; - *p++ = hexdigit[(ch >> 20) & 0xf]; - *p++ = hexdigit[(ch >> 16) & 0xf]; - *p++ = hexdigit[(ch >> 12) & 0xf]; - *p++ = hexdigit[(ch >> 8) & 0xf]; - *p++ = hexdigit[(ch >> 4) & 0xf]; - *p++ = hexdigit[ch & 15]; - } - else -#else - /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ - if (ch >= 0xD800 && ch < 0xDC00) { - Py_UNICODE ch2; - Py_UCS4 ucs; - - ch2 = *s++; - size--; - if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { - ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigit[(ucs >> 28) & 0xf]; - *p++ = hexdigit[(ucs >> 24) & 0xf]; - *p++ = hexdigit[(ucs >> 20) & 0xf]; - *p++ = hexdigit[(ucs >> 16) & 0xf]; - *p++ = hexdigit[(ucs >> 12) & 0xf]; - *p++ = hexdigit[(ucs >> 8) & 0xf]; - *p++ = hexdigit[(ucs >> 4) & 0xf]; - *p++ = hexdigit[ucs & 0xf]; - continue; - } - /* Fall through: isolated surrogates are copied as-is */ - s--; - size++; - } -#endif - /* Map 16-bit characters to '\uxxxx' */ - if (ch >= 256 || ch == '\\' || ch == '\n') { - *p++ = '\\'; - *p++ = 'u'; - *p++ = hexdigit[(ch >> 12) & 0xf]; - *p++ = hexdigit[(ch >> 8) & 0xf]; - *p++ = hexdigit[(ch >> 4) & 0xf]; - *p++ = hexdigit[ch & 15]; - } - /* Copy everything else as-is */ - else - *p++ = (char) ch; - } - *p = '\0'; - _PyString_Resize(&repr, p - q); - return repr; -} - -static int -save_unicode(Picklerobject *self, PyObject *args, int doput) -{ - Py_ssize_t size, len; - PyObject *repr=0; - - if (!PyUnicode_Check(args)) - return -1; - - if (!self->bin) { - char *repr_str; - static char string = UNICODE; - - repr = modified_EncodeRawUnicodeEscape( - PyUnicode_AS_UNICODE(args), PyUnicode_GET_SIZE(args)); - if (!repr) - return -1; - - if ((len = PyString_Size(repr)) < 0) - goto err; - repr_str = PyString_AS_STRING((PyStringObject *)repr); - - if (self->write_func(self, &string, 1) < 0) - goto err; - - if (self->write_func(self, repr_str, len) < 0) - goto err; - - if (self->write_func(self, "\n", 1) < 0) - goto err; - - Py_XDECREF(repr); - } - else { - int i; - char c_str[5]; - - if (!( repr = PyUnicode_AsUTF8String(args))) - return -1; - - if ((size = PyString_Size(repr)) < 0) - goto err; - if (size > INT_MAX) - return -1; /* string too large */ - - c_str[0] = BINUNICODE; - for (i = 1; i < 5; i++) - c_str[i] = (int)(size >> ((i - 1) * 8)); - len = 5; - - if (self->write_func(self, c_str, len) < 0) - goto err; - - if (size > 128 && Pdata_Check(self->file)) { - if (write_other(self, NULL, 0) < 0) - goto err; - PDATA_APPEND(self->file, repr, -1); - } - else { - if (self->write_func(self, PyString_AS_STRING(repr), - size) < 0) - goto err; - } - - Py_DECREF(repr); - } - - if (doput) - if (put(self, args) < 0) - return -1; - - return 0; - - err: - Py_XDECREF(repr); - return -1; -} -#endif - -/* A helper for save_tuple. Push the len elements in tuple t on the stack. */ -static int -store_tuple_elements(Picklerobject *self, PyObject *t, int len) -{ - Py_ssize_t i; - int res = -1; /* guilty until proved innocent */ - - assert(PyTuple_Size(t) == len); - - for (i = 0; i < len; i++) { - PyObject *element = PyTuple_GET_ITEM(t, i); - - if (element == NULL) - goto finally; - if (save(self, element, 0) < 0) - goto finally; - } - res = 0; - - finally: - return res; -} - -/* Tuples are ubiquitous in the pickle protocols, so many techniques are - * used across protocols to minimize the space needed to pickle them. - * Tuples are also the only builtin immutable type that can be recursive - * (a tuple can be reached from itself), and that requires some subtle - * magic so that it works in all cases. IOW, this is a long routine. - */ -static int -save_tuple(Picklerobject *self, PyObject *args) -{ - PyObject *py_tuple_id = NULL; - Py_ssize_t len, i; - int res = -1; - - static char tuple = TUPLE; - static char pop = POP; - static char pop_mark = POP_MARK; - static char len2opcode[] = {EMPTY_TUPLE, TUPLE1, TUPLE2, TUPLE3}; - - if ((len = PyTuple_Size(args)) < 0) - goto finally; - - if (len == 0) { - char c_str[2]; - - if (self->proto) { - c_str[0] = EMPTY_TUPLE; - len = 1; - } - else { - c_str[0] = MARK; - c_str[1] = TUPLE; - len = 2; - } - if (self->write_func(self, c_str, len) >= 0) - res = 0; - /* Don't memoize an empty tuple. */ - goto finally; - } - - /* A non-empty tuple. */ - - /* id(tuple) isn't in the memo now. If it shows up there after - * saving the tuple elements, the tuple must be recursive, in - * which case we'll pop everything we put on the stack, and fetch - * its value from the memo. - */ - py_tuple_id = PyLong_FromVoidPtr(args); - if (py_tuple_id == NULL) - goto finally; - - if (len <= 3 && self->proto >= 2) { - /* Use TUPLE{1,2,3} opcodes. */ - if (store_tuple_elements(self, args, len) < 0) - goto finally; - if (PyDict_GetItem(self->memo, py_tuple_id)) { - /* pop the len elements */ - for (i = 0; i < len; ++i) - if (self->write_func(self, &pop, 1) < 0) - goto finally; - /* fetch from memo */ - if (get(self, py_tuple_id) < 0) - goto finally; - res = 0; - goto finally; - } - /* Not recursive. */ - if (self->write_func(self, len2opcode + len, 1) < 0) - goto finally; - goto memoize; - } - - /* proto < 2 and len > 0, or proto >= 2 and len > 3. - * Generate MARK elt1 elt2 ... TUPLE - */ - if (self->write_func(self, &MARKv, 1) < 0) - goto finally; - - if (store_tuple_elements(self, args, len) < 0) - goto finally; - - if (PyDict_GetItem(self->memo, py_tuple_id)) { - /* pop the stack stuff we pushed */ - if (self->bin) { - if (self->write_func(self, &pop_mark, 1) < 0) - goto finally; - } - else { - /* Note that we pop one more than len, to remove - * the MARK too. - */ - for (i = 0; i <= len; i++) - if (self->write_func(self, &pop, 1) < 0) - goto finally; - } - /* fetch from memo */ - if (get(self, py_tuple_id) >= 0) - res = 0; - goto finally; - } - - /* Not recursive. */ - if (self->write_func(self, &tuple, 1) < 0) - goto finally; - - memoize: - if (put(self, args) >= 0) - res = 0; - - finally: - Py_XDECREF(py_tuple_id); - return res; -} - -/* iter is an iterator giving items, and we batch up chunks of - * MARK item item ... item APPENDS - * opcode sequences. Calling code should have arranged to first create an - * empty list, or list-like object, for the APPENDS to operate on. - * Returns 0 on success, <0 on error. - */ -static int -batch_list(Picklerobject *self, PyObject *iter) -{ - PyObject *obj = NULL; - PyObject *firstitem = NULL; - int i, n; - - static char append = APPEND; - static char appends = APPENDS; - - assert(iter != NULL); - - if (self->proto == 0) { - /* APPENDS isn't available; do one at a time. */ - for (;;) { - obj = PyIter_Next(iter); - if (obj == NULL) { - if (PyErr_Occurred()) - return -1; - break; - } - i = save(self, obj, 0); - Py_DECREF(obj); - if (i < 0) - return -1; - if (self->write_func(self, &append, 1) < 0) - return -1; - } - return 0; - } - - /* proto > 0: write in batches of BATCHSIZE. */ - do { - /* Get first item */ - firstitem = PyIter_Next(iter); - if (firstitem == NULL) { - if (PyErr_Occurred()) - goto BatchFailed; - - /* nothing more to add */ - break; - } - - /* Try to get a second item */ - obj = PyIter_Next(iter); - if (obj == NULL) { - if (PyErr_Occurred()) - goto BatchFailed; - - /* Only one item to write */ - if (save(self, firstitem, 0) < 0) - goto BatchFailed; - if (self->write_func(self, &append, 1) < 0) - goto BatchFailed; - Py_CLEAR(firstitem); - break; - } - - /* More than one item to write */ - - /* Pump out MARK, items, APPENDS. */ - if (self->write_func(self, &MARKv, 1) < 0) - goto BatchFailed; - - if (save(self, firstitem, 0) < 0) - goto BatchFailed; - Py_CLEAR(firstitem); - n = 1; - - /* Fetch and save up to BATCHSIZE items */ - while (obj) { - if (save(self, obj, 0) < 0) - goto BatchFailed; - Py_CLEAR(obj); - n += 1; - - if (n == BATCHSIZE) - break; - - obj = PyIter_Next(iter); - if (obj == NULL) { - if (PyErr_Occurred()) - goto BatchFailed; - break; - } - } - - if (self->write_func(self, &appends, 1) < 0) - goto BatchFailed; - - } while (n == BATCHSIZE); - return 0; - -BatchFailed: - Py_XDECREF(firstitem); - Py_XDECREF(obj); - return -1; -} - -static int -save_list(Picklerobject *self, PyObject *args) -{ - int res = -1; - char s[3]; - Py_ssize_t len; - PyObject *iter; - - if (self->fast && !fast_save_enter(self, args)) - goto finally; - - /* Create an empty list. */ - if (self->bin) { - s[0] = EMPTY_LIST; - len = 1; - } - else { - s[0] = MARK; - s[1] = LIST; - len = 2; - } - - if (self->write_func(self, s, len) < 0) - goto finally; - - /* Get list length, and bow out early if empty. */ - if ((len = PyList_Size(args)) < 0) - goto finally; - - /* Memoize. */ - if (len == 0) { - if (put(self, args) >= 0) - res = 0; - goto finally; - } - if (put2(self, args) < 0) - goto finally; - - /* Materialize the list elements. */ - iter = PyObject_GetIter(args); - if (iter == NULL) - goto finally; - - if (Py_EnterRecursiveCall(" while pickling an object") == 0) - { - res = batch_list(self, iter); - Py_LeaveRecursiveCall(); - } - Py_DECREF(iter); - - finally: - if (self->fast && !fast_save_leave(self, args)) - res = -1; - - return res; -} - - -/* iter is an iterator giving (key, value) pairs, and we batch up chunks of - * MARK key value ... key value SETITEMS - * opcode sequences. Calling code should have arranged to first create an - * empty dict, or dict-like object, for the SETITEMS to operate on. - * Returns 0 on success, <0 on error. - * - * This is very much like batch_list(). The difference between saving - * elements directly, and picking apart two-tuples, is so long-winded at - * the C level, though, that attempts to combine these routines were too - * ugly to bear. - */ -static int -batch_dict(Picklerobject *self, PyObject *iter) -{ - PyObject *p = NULL; - PyObject *firstitem = NULL; - int i, n; - - static char setitem = SETITEM; - static char setitems = SETITEMS; - - assert(iter != NULL); - - if (self->proto == 0) { - /* SETITEMS isn't available; do one at a time. */ - for (;;) { - p = PyIter_Next(iter); - if (p == NULL) { - if (PyErr_Occurred()) - return -1; - break; - } - if (!PyTuple_Check(p) || PyTuple_Size(p) != 2) { - PyErr_SetString(PyExc_TypeError, "dict items " - "iterator must return 2-tuples"); - return -1; - } - i = save(self, PyTuple_GET_ITEM(p, 0), 0); - if (i >= 0) - i = save(self, PyTuple_GET_ITEM(p, 1), 0); - Py_DECREF(p); - if (i < 0) - return -1; - if (self->write_func(self, &setitem, 1) < 0) - return -1; - } - return 0; - } - - /* proto > 0: write in batches of BATCHSIZE. */ - do { - /* Get first item */ - firstitem = PyIter_Next(iter); - if (firstitem == NULL) { - if (PyErr_Occurred()) - goto BatchFailed; - - /* nothing more to add */ - break; - } - if (!PyTuple_Check(firstitem) || PyTuple_Size(firstitem) != 2) { - PyErr_SetString(PyExc_TypeError, "dict items " - "iterator must return 2-tuples"); - goto BatchFailed; - } - - /* Try to get a second item */ - p = PyIter_Next(iter); - if (p == NULL) { - if (PyErr_Occurred()) - goto BatchFailed; - - /* Only one item to write */ - if (save(self, PyTuple_GET_ITEM(firstitem, 0), 0) < 0) - goto BatchFailed; - if (save(self, PyTuple_GET_ITEM(firstitem, 1), 0) < 0) - goto BatchFailed; - if (self->write_func(self, &setitem, 1) < 0) - goto BatchFailed; - Py_CLEAR(firstitem); - break; - } - - /* More than one item to write */ - - /* Pump out MARK, items, SETITEMS. */ - if (self->write_func(self, &MARKv, 1) < 0) - goto BatchFailed; - - if (save(self, PyTuple_GET_ITEM(firstitem, 0), 0) < 0) - goto BatchFailed; - if (save(self, PyTuple_GET_ITEM(firstitem, 1), 0) < 0) - goto BatchFailed; - Py_CLEAR(firstitem); - n = 1; - - /* Fetch and save up to BATCHSIZE items */ - while (p) { - if (!PyTuple_Check(p) || PyTuple_Size(p) != 2) { - PyErr_SetString(PyExc_TypeError, "dict items " - "iterator must return 2-tuples"); - goto BatchFailed; - } - if (save(self, PyTuple_GET_ITEM(p, 0), 0) < 0) - goto BatchFailed; - if (save(self, PyTuple_GET_ITEM(p, 1), 0) < 0) - goto BatchFailed; - Py_CLEAR(p); - n += 1; - - if (n == BATCHSIZE) - break; - - p = PyIter_Next(iter); - if (p == NULL) { - if (PyErr_Occurred()) - goto BatchFailed; - break; - } - } - - if (self->write_func(self, &setitems, 1) < 0) - goto BatchFailed; - - } while (n == BATCHSIZE); - return 0; - -BatchFailed: - Py_XDECREF(firstitem); - Py_XDECREF(p); - return -1; -} - -/* This is a variant of batch_dict() above that specializes for dicts, with no - * support for dict subclasses. Like batch_dict(), we batch up chunks of - * MARK key value ... key value SETITEMS - * opcode sequences. Calling code should have arranged to first create an - * empty dict, or dict-like object, for the SETITEMS to operate on. - * Returns 0 on success, -1 on error. - * - * Note that this currently doesn't work for protocol 0. - */ -static int -batch_dict_exact(Picklerobject *self, PyObject *obj) -{ - PyObject *key = NULL, *value = NULL; - int i; - Py_ssize_t dict_size, ppos = 0; - - static char setitem = SETITEM; - static char setitems = SETITEMS; - - assert(obj != NULL); - assert(self->proto > 0); - - dict_size = PyDict_Size(obj); - - /* Special-case len(d) == 1 to save space. */ - if (dict_size == 1) { - PyDict_Next(obj, &ppos, &key, &value); - if (save(self, key, 0) < 0) - return -1; - if (save(self, value, 0) < 0) - return -1; - if (self->write_func(self, &setitem, 1) < 0) - return -1; - return 0; - } - - /* Write in batches of BATCHSIZE. */ - do { - i = 0; - if (self->write_func(self, &MARKv, 1) < 0) - return -1; - while (PyDict_Next(obj, &ppos, &key, &value)) { - if (save(self, key, 0) < 0) - return -1; - if (save(self, value, 0) < 0) - return -1; - if (++i == BATCHSIZE) - break; - } - if (self->write_func(self, &setitems, 1) < 0) - return -1; - if (PyDict_Size(obj) != dict_size) { - PyErr_Format( - PyExc_RuntimeError, - "dictionary changed size during iteration"); - return -1; - } - - } while (i == BATCHSIZE); - return 0; -} - -static int -save_dict(Picklerobject *self, PyObject *args) -{ - int res = -1; - char s[3]; - Py_ssize_t len; - - if (self->fast && !fast_save_enter(self, args)) - goto finally; - - /* Create an empty dict. */ - if (self->bin) { - s[0] = EMPTY_DICT; - len = 1; - } - else { - s[0] = MARK; - s[1] = DICT; - len = 2; - } - - if (self->write_func(self, s, len) < 0) - goto finally; - - /* Get dict size, and bow out early if empty. */ - if ((len = PyDict_Size(args)) < 0) - goto finally; - - if (len == 0) { - if (put(self, args) >= 0) - res = 0; - goto finally; - } - if (put2(self, args) < 0) - goto finally; - - /* Materialize the dict items. */ - if (PyDict_CheckExact(args) && self->proto > 0) { - /* We can take certain shortcuts if we know this is a dict and - not a dict subclass. */ - if (Py_EnterRecursiveCall(" while pickling an object") == 0) { - res = batch_dict_exact(self, args); - Py_LeaveRecursiveCall(); - } - } else { - PyObject *iter = PyObject_CallMethod(args, "iteritems", "()"); - if (iter == NULL) - goto finally; - if (Py_EnterRecursiveCall(" while pickling an object") == 0) { - res = batch_dict(self, iter); - Py_LeaveRecursiveCall(); - } - Py_DECREF(iter); - } - - finally: - if (self->fast && !fast_save_leave(self, args)) - res = -1; - - return res; -} - - -static int -save_inst(Picklerobject *self, PyObject *args) -{ - PyObject *class = 0, *module = 0, *name = 0, *state = 0, - *getinitargs_func = 0, *getstate_func = 0, *class_args = 0; - char *module_str, *name_str; - int module_size, name_size, res = -1; - - static char inst = INST, obj = OBJ, build = BUILD; - - if (self->fast && !fast_save_enter(self, args)) - goto finally; - - if (self->write_func(self, &MARKv, 1) < 0) - goto finally; - - if (!( class = PyObject_GetAttr(args, __class___str))) - goto finally; - - if (self->bin) { - if (save(self, class, 0) < 0) - goto finally; - } - - if ((getinitargs_func = PyObject_GetAttr(args, __getinitargs___str))) { - PyObject *element = 0; - Py_ssize_t i, len; - - if (!( class_args = - PyObject_Call(getinitargs_func, empty_tuple, NULL))) - goto finally; - - if ((len = PyObject_Size(class_args)) < 0) - goto finally; - - for (i = 0; i < len; i++) { - if (!( element = PySequence_GetItem(class_args, i))) - goto finally; - - if (save(self, element, 0) < 0) { - Py_DECREF(element); - goto finally; - } - - Py_DECREF(element); - } - } - else { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - goto finally; - } - - if (!self->bin) { - if (!( name = ((PyClassObject *)class)->cl_name )) { - PyErr_SetString(PicklingError, "class has no name"); - goto finally; - } - - if (!( module = whichmodule(class, name))) - goto finally; - - - if ((module_size = PyString_Size(module)) < 0 || - (name_size = PyString_Size(name)) < 0) - goto finally; - - module_str = PyString_AS_STRING((PyStringObject *)module); - name_str = PyString_AS_STRING((PyStringObject *)name); - - if (self->write_func(self, &inst, 1) < 0) - goto finally; - - if (self->write_func(self, module_str, module_size) < 0) - goto finally; - - if (self->write_func(self, "\n", 1) < 0) - goto finally; - - if (self->write_func(self, name_str, name_size) < 0) - goto finally; - - if (self->write_func(self, "\n", 1) < 0) - goto finally; - } - else if (self->write_func(self, &obj, 1) < 0) { - goto finally; - } - - if ((getstate_func = PyObject_GetAttr(args, __getstate___str))) { - state = PyObject_Call(getstate_func, empty_tuple, NULL); - if (!state) - goto finally; - } - else { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - goto finally; - - if (!( state = PyObject_GetAttr(args, __dict___str))) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - goto finally; - res = 0; - goto finally; - } - } - - if (!PyDict_Check(state)) { - if (put2(self, args) < 0) - goto finally; - } - else { - if (put(self, args) < 0) - goto finally; - } - - if (save(self, state, 0) < 0) - goto finally; - - if (self->write_func(self, &build, 1) < 0) - goto finally; - - res = 0; - - finally: - if (self->fast && !fast_save_leave(self, args)) - res = -1; - - Py_XDECREF(module); - Py_XDECREF(class); - Py_XDECREF(state); - Py_XDECREF(getinitargs_func); - Py_XDECREF(getstate_func); - Py_XDECREF(class_args); - - return res; -} - - -static int -save_global(Picklerobject *self, PyObject *args, PyObject *name) -{ - PyObject *global_name = 0, *module = 0, *mod = 0, *klass = 0; - char *name_str, *module_str; - int module_size, name_size, res = -1; - - static char global = GLOBAL; - - if (name) { - global_name = name; - Py_INCREF(global_name); - } - else { - if (!( global_name = PyObject_GetAttr(args, __name___str))) - goto finally; - } - - if (!( module = whichmodule(args, global_name))) - goto finally; - - if ((module_size = PyString_Size(module)) < 0 || - (name_size = PyString_Size(global_name)) < 0) - goto finally; - - module_str = PyString_AS_STRING((PyStringObject *)module); - name_str = PyString_AS_STRING((PyStringObject *)global_name); - - /* XXX This can be doing a relative import. Clearly it shouldn't, - but I don't know how to stop it. :-( */ - mod = PyImport_ImportModule(module_str); - if (mod == NULL) { - cPickle_ErrFormat(PicklingError, - "Can't pickle %s: import of module %s " - "failed", - "OS", args, module); - goto finally; - } - klass = PyObject_GetAttrString(mod, name_str); - if (klass == NULL) { - cPickle_ErrFormat(PicklingError, - "Can't pickle %s: attribute lookup %s.%s " - "failed", - "OSS", args, module, global_name); - goto finally; - } - if (klass != args) { - Py_DECREF(klass); - cPickle_ErrFormat(PicklingError, - "Can't pickle %s: it's not the same object " - "as %s.%s", - "OSS", args, module, global_name); - goto finally; - } - Py_DECREF(klass); - - if (self->proto >= 2) { - /* See whether this is in the extension registry, and if - * so generate an EXT opcode. - */ - PyObject *py_code; /* extension code as Python object */ - long code; /* extension code as C value */ - char c_str[5]; - int n; - - PyTuple_SET_ITEM(two_tuple, 0, module); - PyTuple_SET_ITEM(two_tuple, 1, global_name); - py_code = PyDict_GetItem(extension_registry, two_tuple); - if (py_code == NULL) - goto gen_global; /* not registered */ - - /* Verify py_code has the right type and value. */ - if (!PyInt_Check(py_code)) { - cPickle_ErrFormat(PicklingError, "Can't pickle %s: " - "extension code %s isn't an integer", - "OO", args, py_code); - goto finally; - } - code = PyInt_AS_LONG(py_code); - if (code <= 0 || code > 0x7fffffffL) { - cPickle_ErrFormat(PicklingError, "Can't pickle %s: " - "extension code %ld is out of range", - "Ol", args, code); - goto finally; - } - - /* Generate an EXT opcode. */ - if (code <= 0xff) { - c_str[0] = EXT1; - c_str[1] = (char)code; - n = 2; - } - else if (code <= 0xffff) { - c_str[0] = EXT2; - c_str[1] = (char)(code & 0xff); - c_str[2] = (char)((code >> 8) & 0xff); - n = 3; - } - else { - c_str[0] = EXT4; - c_str[1] = (char)(code & 0xff); - c_str[2] = (char)((code >> 8) & 0xff); - c_str[3] = (char)((code >> 16) & 0xff); - c_str[4] = (char)((code >> 24) & 0xff); - n = 5; - } - - if (self->write_func(self, c_str, n) >= 0) - res = 0; - goto finally; /* and don't memoize */ - } - - gen_global: - if (self->write_func(self, &global, 1) < 0) - goto finally; - - if (self->write_func(self, module_str, module_size) < 0) - goto finally; - - if (self->write_func(self, "\n", 1) < 0) - goto finally; - - if (self->write_func(self, name_str, name_size) < 0) - goto finally; - - if (self->write_func(self, "\n", 1) < 0) - goto finally; - - if (put(self, args) < 0) - goto finally; - - res = 0; - - finally: - Py_XDECREF(module); - Py_XDECREF(global_name); - Py_XDECREF(mod); - - return res; -} - -static int -save_pers(Picklerobject *self, PyObject *args, PyObject *f) -{ - PyObject *pid = 0; - Py_ssize_t size; - int res = -1; - - static char persid = PERSID, binpersid = BINPERSID; - - Py_INCREF(args); - ARG_TUP(self, args); - if (self->arg) { - pid = PyObject_Call(f, self->arg, NULL); - FREE_ARG_TUP(self); - } - if (! pid) return -1; - - if (pid != Py_None) { - if (!self->bin) { - if (!PyString_Check(pid)) { - PyErr_SetString(PicklingError, - "persistent id must be string"); - goto finally; - } - - if (self->write_func(self, &persid, 1) < 0) - goto finally; - - if ((size = PyString_Size(pid)) < 0) - goto finally; - - if (self->write_func(self, - PyString_AS_STRING( - (PyStringObject *)pid), - size) < 0) - goto finally; - - if (self->write_func(self, "\n", 1) < 0) - goto finally; - - res = 1; - goto finally; - } - else if (save(self, pid, 1) >= 0) { - if (self->write_func(self, &binpersid, 1) < 0) - res = -1; - else - res = 1; - } - - goto finally; - } - - res = 0; - - finally: - Py_XDECREF(pid); - - return res; -} - -/* We're saving ob, and args is the 2-thru-5 tuple returned by the - * appropriate __reduce__ method for ob. - */ -static int -save_reduce(Picklerobject *self, PyObject *args, PyObject *fn, PyObject *ob) -{ - PyObject *callable; - PyObject *argtup; - PyObject *state = NULL; - PyObject *listitems = Py_None; - PyObject *dictitems = Py_None; - Py_ssize_t size; - - int use_newobj = self->proto >= 2; - - static char reduce = REDUCE; - static char build = BUILD; - static char newobj = NEWOBJ; - - size = PyTuple_Size(args); - if (size < 2 || size > 5) { - cPickle_ErrFormat(PicklingError, "tuple returned by " - "%s must contain 2 through 5 elements", - "O", fn); - return -1; - } - - if (! PyArg_UnpackTuple(args, "save_reduce", 2, 5, - &callable, - &argtup, - &state, - &listitems, - &dictitems)) - return -1; - - if (!PyTuple_Check(argtup)) { - cPickle_ErrFormat(PicklingError, "Second element of " - "tuple returned by %s must be a tuple", - "O", fn); - return -1; - } - - if (state == Py_None) - state = NULL; - - if (listitems == Py_None) - listitems = NULL; - else if (!PyIter_Check(listitems)) { - cPickle_ErrFormat(PicklingError, "Fourth element of " - "tuple returned by %s must be an iterator, not %s", - "Os", fn, Py_TYPE(listitems)->tp_name); - return -1; - } - - if (dictitems == Py_None) - dictitems = NULL; - else if (!PyIter_Check(dictitems)) { - cPickle_ErrFormat(PicklingError, "Fifth element of " - "tuple returned by %s must be an iterator, not %s", - "Os", fn, Py_TYPE(dictitems)->tp_name); - return -1; - } - - /* Protocol 2 special case: if callable's name is __newobj__, use - * NEWOBJ. This consumes a lot of code. - */ - if (use_newobj) { - PyObject *temp = PyObject_GetAttr(callable, __name___str); - - if (temp == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return -1; - use_newobj = 0; - } - else { - use_newobj = PyString_Check(temp) && - strcmp(PyString_AS_STRING(temp), - "__newobj__") == 0; - Py_DECREF(temp); - } - } - if (use_newobj) { - PyObject *cls; - PyObject *newargtup; - Py_ssize_t n, i; - - /* Sanity checks. */ - n = PyTuple_Size(argtup); - if (n < 1) { - PyErr_SetString(PicklingError, "__newobj__ arglist " - "is empty"); - return -1; - } - - cls = PyTuple_GET_ITEM(argtup, 0); - if (! PyObject_HasAttrString(cls, "__new__")) { - PyErr_SetString(PicklingError, "args[0] from " - "__newobj__ args has no __new__"); - return -1; - } - - /* XXX How could ob be NULL? */ - if (ob != NULL) { - PyObject *ob_dot_class; - - ob_dot_class = PyObject_GetAttr(ob, __class___str); - if (ob_dot_class == NULL) { - if (PyErr_ExceptionMatches( - PyExc_AttributeError)) - PyErr_Clear(); - else - return -1; - } - i = ob_dot_class != cls; /* true iff a problem */ - Py_XDECREF(ob_dot_class); - if (i) { - PyErr_SetString(PicklingError, "args[0] from " - "__newobj__ args has the wrong class"); - return -1; - } - } - - /* Save the class and its __new__ arguments. */ - if (save(self, cls, 0) < 0) - return -1; - - newargtup = PyTuple_New(n-1); /* argtup[1:] */ - if (newargtup == NULL) - return -1; - for (i = 1; i < n; ++i) { - PyObject *temp = PyTuple_GET_ITEM(argtup, i); - Py_INCREF(temp); - PyTuple_SET_ITEM(newargtup, i-1, temp); - } - i = save(self, newargtup, 0); - Py_DECREF(newargtup); - if (i < 0) - return -1; - - /* Add NEWOBJ opcode. */ - if (self->write_func(self, &newobj, 1) < 0) - return -1; - } - else { - /* Not using NEWOBJ. */ - if (save(self, callable, 0) < 0 || - save(self, argtup, 0) < 0 || - self->write_func(self, &reduce, 1) < 0) - return -1; - } - - /* Memoize. */ - /* XXX How can ob be NULL? */ - if (ob != NULL) { - if (state && !PyDict_Check(state)) { - if (put2(self, ob) < 0) - return -1; - } - else if (put(self, ob) < 0) - return -1; - } - - - if (listitems && batch_list(self, listitems) < 0) - return -1; - - if (dictitems && batch_dict(self, dictitems) < 0) - return -1; - - if (state) { - if (save(self, state, 0) < 0 || - self->write_func(self, &build, 1) < 0) - return -1; - } - - return 0; -} - -static int -save(Picklerobject *self, PyObject *args, int pers_save) -{ - PyTypeObject *type; - PyObject *py_ob_id = 0, *__reduce__ = 0, *t = 0; - int res = -1; - int tmp; - - if (Py_EnterRecursiveCall(" while pickling an object")) - return -1; - - if (!pers_save && self->pers_func) { - if ((tmp = save_pers(self, args, self->pers_func)) != 0) { - res = tmp; - goto finally; - } - } - - if (args == Py_None) { - res = save_none(self, args); - goto finally; - } - - type = Py_TYPE(args); - - switch (type->tp_name[0]) { - case 'b': - if (args == Py_False || args == Py_True) { - res = save_bool(self, args); - goto finally; - } - break; - case 'i': - if (type == &PyInt_Type) { - res = save_int(self, args); - goto finally; - } - break; - - case 'l': - if (type == &PyLong_Type) { - res = save_long(self, args); - goto finally; - } - break; - - case 'f': - if (type == &PyFloat_Type) { - res = save_float(self, args); - goto finally; - } - break; - - case 't': - if (type == &PyTuple_Type && PyTuple_Size(args) == 0) { - res = save_tuple(self, args); - goto finally; - } - break; - - case 's': - if ((type == &PyString_Type) && (PyString_GET_SIZE(args) < 2)) { - res = save_string(self, args, 0); - goto finally; - } - break; - -#ifdef Py_USING_UNICODE - case 'u': - if ((type == &PyUnicode_Type) && (PyString_GET_SIZE(args) < 2)) { - res = save_unicode(self, args, 0); - goto finally; - } - break; -#endif - } - - if (Py_REFCNT(args) > 1) { - if (!( py_ob_id = PyLong_FromVoidPtr(args))) - goto finally; - - if (PyDict_GetItem(self->memo, py_ob_id)) { - if (get(self, py_ob_id) < 0) - goto finally; - - res = 0; - goto finally; - } - } - - switch (type->tp_name[0]) { - case 's': - if (type == &PyString_Type) { - res = save_string(self, args, 1); - goto finally; - } - break; - -#ifdef Py_USING_UNICODE - case 'u': - if (type == &PyUnicode_Type) { - res = save_unicode(self, args, 1); - goto finally; - } - break; -#endif - - case 't': - if (type == &PyTuple_Type) { - res = save_tuple(self, args); - goto finally; - } - if (type == &PyType_Type) { - res = save_global(self, args, NULL); - goto finally; - } - break; - - case 'l': - if (type == &PyList_Type) { - res = save_list(self, args); - goto finally; - } - break; - - case 'd': - if (type == &PyDict_Type) { - res = save_dict(self, args); - goto finally; - } - break; - - case 'i': - if (type == &PyInstance_Type) { - res = save_inst(self, args); - goto finally; - } - break; - - case 'c': - if (type == &PyClass_Type) { - res = save_global(self, args, NULL); - goto finally; - } - break; - - case 'f': - if (type == &PyFunction_Type) { - res = save_global(self, args, NULL); - if (res && PyErr_ExceptionMatches(PickleError)) { - /* fall back to reduce */ - PyErr_Clear(); - break; - } - goto finally; - } - break; - - case 'b': - if (type == &PyCFunction_Type) { - res = save_global(self, args, NULL); - goto finally; - } - } - - if (!pers_save && self->inst_pers_func) { - if ((tmp = save_pers(self, args, self->inst_pers_func)) != 0) { - res = tmp; - goto finally; - } - } - - /* Get a reduction callable, and call it. This may come from - * copy_reg.dispatch_table, the object's __reduce_ex__ method, - * or the object's __reduce__ method. - */ - __reduce__ = PyDict_GetItem(dispatch_table, (PyObject *)type); - if (__reduce__ != NULL) { - Py_INCREF(__reduce__); - Py_INCREF(args); - ARG_TUP(self, args); - if (self->arg) { - t = PyObject_Call(__reduce__, self->arg, NULL); - FREE_ARG_TUP(self); - } - } - else { - if (PyType_IsSubtype(type, &PyType_Type)) { - res = save_global(self, args, NULL); - goto finally; - } - - /* Check for a __reduce_ex__ method. */ - __reduce__ = PyObject_GetAttr(args, __reduce_ex___str); - if (__reduce__ != NULL) { - t = PyInt_FromLong(self->proto); - if (t != NULL) { - ARG_TUP(self, t); - t = NULL; - if (self->arg) { - t = PyObject_Call(__reduce__, - self->arg, NULL); - FREE_ARG_TUP(self); - } - } - } - else { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - goto finally; - /* Check for a __reduce__ method. */ - __reduce__ = PyObject_GetAttr(args, __reduce___str); - if (__reduce__ != NULL) { - t = PyObject_Call(__reduce__, - empty_tuple, NULL); - } - else { - PyErr_SetObject(UnpickleableError, args); - goto finally; - } - } - } - - if (t == NULL) - goto finally; - - if (PyString_Check(t)) { - res = save_global(self, args, t); - goto finally; - } - - if (!PyTuple_Check(t)) { - cPickle_ErrFormat(PicklingError, "Value returned by " - "%s must be string or tuple", - "O", __reduce__); - goto finally; - } - - res = save_reduce(self, t, __reduce__, args); - - finally: - Py_LeaveRecursiveCall(); - Py_XDECREF(py_ob_id); - Py_XDECREF(__reduce__); - Py_XDECREF(t); - - return res; -} - - -static int -dump(Picklerobject *self, PyObject *args) -{ - static char stop = STOP; - - if (self->proto >= 2) { - char bytes[2]; - - bytes[0] = PROTO; - assert(self->proto >= 0 && self->proto < 256); - bytes[1] = (char)self->proto; - if (self->write_func(self, bytes, 2) < 0) - return -1; - } - - if (save(self, args, 0) < 0) - return -1; - - if (self->write_func(self, &stop, 1) < 0) - return -1; - - if (self->write_func(self, NULL, 0) < 0) - return -1; - - return 0; -} - -static PyObject * -Pickle_clear_memo(Picklerobject *self, PyObject *args) -{ - if (self->memo) - PyDict_Clear(self->memo); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -Pickle_getvalue(Picklerobject *self, PyObject *args) -{ - Py_ssize_t l, i, rsize, ssize, clear=1, lm; - long ik; - PyObject *k, *r; - char *s, *p, *have_get; - Pdata *data; - - /* Can be called by Python code or C code */ - if (args && !PyArg_ParseTuple(args, "|i:getvalue", &clear)) - return NULL; - - /* Check to make sure we are based on a list */ - if (! Pdata_Check(self->file)) { - PyErr_SetString(PicklingError, - "Attempt to getvalue() a non-list-based pickler"); - return NULL; - } - - /* flush write buffer */ - if (write_other(self, NULL, 0) < 0) return NULL; - - data=(Pdata*)self->file; - l=data->length; - - /* set up an array to hold get/put status */ - lm = PyDict_Size(self->memo); - if (lm < 0) return NULL; - lm++; - have_get = malloc(lm); - if (have_get == NULL) return PyErr_NoMemory(); - memset(have_get, 0, lm); - - /* Scan for gets. */ - for (rsize = 0, i = l; --i >= 0; ) { - k = data->data[i]; - - if (PyString_Check(k)) - rsize += PyString_GET_SIZE(k); - - else if (PyInt_Check(k)) { /* put */ - ik = PyInt_AS_LONG((PyIntObject*)k); - if (ik >= lm || ik == 0) { - PyErr_SetString(PicklingError, - "Invalid get data"); - goto err; - } - if (have_get[ik]) /* with matching get */ - rsize += ik < 256 ? 2 : 5; - } - - else if (! (PyTuple_Check(k) && - PyTuple_GET_SIZE(k) == 2 && - PyInt_Check((k = PyTuple_GET_ITEM(k, 0)))) - ) { - PyErr_SetString(PicklingError, - "Unexpected data in internal list"); - goto err; - } - - else { /* put */ - ik = PyInt_AS_LONG((PyIntObject *)k); - if (ik >= lm || ik == 0) { - PyErr_SetString(PicklingError, - "Invalid get data"); - return NULL; - } - have_get[ik] = 1; - rsize += ik < 256 ? 2 : 5; - } - } - - /* Now generate the result */ - r = PyString_FromStringAndSize(NULL, rsize); - if (r == NULL) goto err; - s = PyString_AS_STRING((PyStringObject *)r); - - for (i = 0; i < l; i++) { - k = data->data[i]; - - if (PyString_Check(k)) { - ssize = PyString_GET_SIZE(k); - if (ssize) { - p=PyString_AS_STRING((PyStringObject *)k); - while (--ssize >= 0) - *s++ = *p++; - } - } - - else if (PyTuple_Check(k)) { /* get */ - ik = PyInt_AS_LONG((PyIntObject *) - PyTuple_GET_ITEM(k, 0)); - if (ik < 256) { - *s++ = BINGET; - *s++ = (int)(ik & 0xff); - } - else { - *s++ = LONG_BINGET; - *s++ = (int)(ik & 0xff); - *s++ = (int)((ik >> 8) & 0xff); - *s++ = (int)((ik >> 16) & 0xff); - *s++ = (int)((ik >> 24) & 0xff); - } - } - - else { /* put */ - ik = PyInt_AS_LONG((PyIntObject*)k); - - if (have_get[ik]) { /* with matching get */ - if (ik < 256) { - *s++ = BINPUT; - *s++ = (int)(ik & 0xff); - } - else { - *s++ = LONG_BINPUT; - *s++ = (int)(ik & 0xff); - *s++ = (int)((ik >> 8) & 0xff); - *s++ = (int)((ik >> 16) & 0xff); - *s++ = (int)((ik >> 24) & 0xff); - } - } - } - } - - if (clear) { - PyDict_Clear(self->memo); - Pdata_clear(data, 0); - } - - free(have_get); - return r; - err: - free(have_get); - return NULL; -} - -static PyObject * -Pickler_dump(Picklerobject *self, PyObject *args) -{ - PyObject *ob; - int get=0; - - if (!( PyArg_ParseTuple(args, "O|i:dump", &ob, &get))) - return NULL; - - if (dump(self, ob) < 0) - return NULL; - - if (get) return Pickle_getvalue(self, NULL); - - /* XXX Why does dump() return self? */ - Py_INCREF(self); - return (PyObject*)self; -} - - -static struct PyMethodDef Pickler_methods[] = -{ - {"dump", (PyCFunction)Pickler_dump, METH_VARARGS, - PyDoc_STR("dump(object) -- " - "Write an object in pickle format to the object's pickle stream")}, - {"clear_memo", (PyCFunction)Pickle_clear_memo, METH_NOARGS, - PyDoc_STR("clear_memo() -- Clear the picklers memo")}, - {"getvalue", (PyCFunction)Pickle_getvalue, METH_VARARGS, - PyDoc_STR("getvalue() -- Finish picking a list-based pickle")}, - {NULL, NULL} /* sentinel */ -}; - - -static Picklerobject * -newPicklerobject(PyObject *file, int proto) -{ - Picklerobject *self; - - if (proto < 0) - proto = HIGHEST_PROTOCOL; - if (proto > HIGHEST_PROTOCOL) { - PyErr_Format(PyExc_ValueError, "pickle protocol %d asked for; " - "the highest available protocol is %d", - proto, HIGHEST_PROTOCOL); - return NULL; - } - - self = PyObject_GC_New(Picklerobject, &Picklertype); - if (self == NULL) - return NULL; - self->proto = proto; - self->bin = proto > 0; - self->fp = NULL; - self->write = NULL; - self->memo = NULL; - self->arg = NULL; - self->pers_func = NULL; - self->inst_pers_func = NULL; - self->write_buf = NULL; - self->fast = 0; - self->fast_container = 0; - self->fast_memo = NULL; - self->buf_size = 0; - self->dispatch_table = NULL; - - self->file = NULL; - if (file) - Py_INCREF(file); - else { - file = Pdata_New(); - if (file == NULL) - goto err; - } - self->file = file; - - if (!( self->memo = PyDict_New())) - goto err; - - if (PyFile_Check(file)) { - self->fp = PyFile_AsFile(file); - if (self->fp == NULL) { - PyErr_SetString(PyExc_ValueError, - "I/O operation on closed file"); - goto err; - } - self->write_func = write_file; - } - else if (PycStringIO_OutputCheck(file)) { - self->write_func = write_cStringIO; - } - else if (file == Py_None) { - self->write_func = write_none; - } - else { - self->write_func = write_other; - - if (! Pdata_Check(file)) { - self->write = PyObject_GetAttr(file, write_str); - if (!self->write) { - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "argument must have 'write' " - "attribute"); - goto err; - } - } - - self->write_buf = (char *)PyMem_Malloc(WRITE_BUF_SIZE); - if (self->write_buf == NULL) { - PyErr_NoMemory(); - goto err; - } - } - - if (PyEval_GetRestricted()) { - /* Restricted execution, get private tables */ - PyObject *m = PyImport_ImportModule("copy_reg"); - - if (m == NULL) - goto err; - self->dispatch_table = PyObject_GetAttr(m, dispatch_table_str); - Py_DECREF(m); - if (self->dispatch_table == NULL) - goto err; - } - else { - self->dispatch_table = dispatch_table; - Py_INCREF(dispatch_table); - } - PyObject_GC_Track(self); - - return self; - - err: - Py_DECREF(self); - return NULL; -} - - -static PyObject * -get_Pickler(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"file", "protocol", NULL}; - PyObject *file = NULL; - int proto = 0; - - /* XXX - * The documented signature is Pickler(file, protocol=0), but this - * accepts Pickler() and Pickler(integer) too. The meaning then - * is clear as mud, undocumented, and not supported by pickle.py. - * I'm told Zope uses this, but I haven't traced into this code - * far enough to figure out what it means. - */ - if (!PyArg_ParseTuple(args, "|i:Pickler", &proto)) { - PyErr_Clear(); - proto = 0; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|i:Pickler", - kwlist, &file, &proto)) - return NULL; - } - return (PyObject *)newPicklerobject(file, proto); -} - - -static void -Pickler_dealloc(Picklerobject *self) -{ - PyObject_GC_UnTrack(self); - Py_XDECREF(self->write); - Py_XDECREF(self->memo); - Py_XDECREF(self->fast_memo); - Py_XDECREF(self->arg); - Py_XDECREF(self->file); - Py_XDECREF(self->pers_func); - Py_XDECREF(self->inst_pers_func); - Py_XDECREF(self->dispatch_table); - PyMem_Free(self->write_buf); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -Pickler_traverse(Picklerobject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->write); - Py_VISIT(self->memo); - Py_VISIT(self->fast_memo); - Py_VISIT(self->arg); - Py_VISIT(self->file); - Py_VISIT(self->pers_func); - Py_VISIT(self->inst_pers_func); - Py_VISIT(self->dispatch_table); - return 0; -} - -static int -Pickler_clear(Picklerobject *self) -{ - Py_CLEAR(self->write); - Py_CLEAR(self->memo); - Py_CLEAR(self->fast_memo); - Py_CLEAR(self->arg); - Py_CLEAR(self->file); - Py_CLEAR(self->pers_func); - Py_CLEAR(self->inst_pers_func); - Py_CLEAR(self->dispatch_table); - return 0; -} - -static PyObject * -Pickler_get_pers_func(Picklerobject *p) -{ - if (p->pers_func == NULL) - PyErr_SetString(PyExc_AttributeError, "persistent_id"); - else - Py_INCREF(p->pers_func); - return p->pers_func; -} - -static int -Pickler_set_pers_func(Picklerobject *p, PyObject *v) -{ - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "attribute deletion is not supported"); - return -1; - } - Py_XDECREF(p->pers_func); - Py_INCREF(v); - p->pers_func = v; - return 0; -} - -static int -Pickler_set_inst_pers_func(Picklerobject *p, PyObject *v) -{ - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "attribute deletion is not supported"); - return -1; - } - Py_XDECREF(p->inst_pers_func); - Py_INCREF(v); - p->inst_pers_func = v; - return 0; -} - -static PyObject * -Pickler_get_memo(Picklerobject *p) -{ - if (p->memo == NULL) - PyErr_SetString(PyExc_AttributeError, "memo"); - else - Py_INCREF(p->memo); - return p->memo; -} - -static int -Pickler_set_memo(Picklerobject *p, PyObject *v) -{ - if (v == NULL) { - PyErr_SetString(PyExc_TypeError, - "attribute deletion is not supported"); - return -1; - } - if (!PyDict_Check(v)) { - PyErr_SetString(PyExc_TypeError, "memo must be a dictionary"); - return -1; - } - Py_XDECREF(p->memo); - Py_INCREF(v); - p->memo = v; - return 0; -} - -static PyObject * -Pickler_get_error(Picklerobject *p) -{ - /* why is this an attribute on the Pickler? */ - Py_INCREF(PicklingError); - return PicklingError; -} - -static PyMemberDef Pickler_members[] = { - {"binary", T_INT, offsetof(Picklerobject, bin)}, - {"fast", T_INT, offsetof(Picklerobject, fast)}, - {NULL} -}; - -static PyGetSetDef Pickler_getsets[] = { - {"persistent_id", (getter)Pickler_get_pers_func, - (setter)Pickler_set_pers_func}, - {"inst_persistent_id", NULL, (setter)Pickler_set_inst_pers_func}, - {"memo", (getter)Pickler_get_memo, (setter)Pickler_set_memo}, - {"PicklingError", (getter)Pickler_get_error, NULL}, - {NULL} -}; - -PyDoc_STRVAR(Picklertype__doc__, -"Objects that know how to pickle objects\n"); - -static PyTypeObject Picklertype = { - PyVarObject_HEAD_INIT(NULL, 0) - "cPickle.Pickler", /*tp_name*/ - sizeof(Picklerobject), /*tp_basicsize*/ - 0, - (destructor)Pickler_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - Picklertype__doc__, /* tp_doc */ - (traverseproc)Pickler_traverse, /* tp_traverse */ - (inquiry)Pickler_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - Pickler_methods, /* tp_methods */ - Pickler_members, /* tp_members */ - Pickler_getsets, /* tp_getset */ -}; - -static PyObject * -find_class(PyObject *py_module_name, PyObject *py_global_name, PyObject *fc) -{ - PyObject *global = 0, *module; - - if (fc) { - if (fc==Py_None) { - PyErr_SetString(UnpicklingError, "Global and instance " - "pickles are not supported."); - return NULL; - } - return PyObject_CallFunctionObjArgs(fc, py_module_name, - py_global_name, NULL); - } - - module = PySys_GetObject("modules"); - if (module == NULL) - return NULL; - - module = PyDict_GetItem(module, py_module_name); - if (module == NULL) { - module = PyImport_Import(py_module_name); - if (!module) - return NULL; - global = PyObject_GetAttr(module, py_global_name); - Py_DECREF(module); - } - else - global = PyObject_GetAttr(module, py_global_name); - return global; -} - -static Py_ssize_t -marker(Unpicklerobject *self) -{ - if (self->num_marks < 1) { - PyErr_SetString(UnpicklingError, "could not find MARK"); - return -1; - } - - return self->marks[--self->num_marks]; -} - - -static int -load_none(Unpicklerobject *self) -{ - PDATA_APPEND(self->stack, Py_None, -1); - return 0; -} - -static int -bad_readline(void) -{ - PyErr_SetString(UnpicklingError, "pickle data was truncated"); - return -1; -} - -static int -load_int(Unpicklerobject *self) -{ - PyObject *py_int = 0; - char *endptr, *s; - Py_ssize_t len; - int res = -1; - long l; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - if (!( s=pystrndup(s,len))) return -1; - - errno = 0; - l = strtol(s, &endptr, 0); - - if (errno || (*endptr != '\n') || (endptr[1] != '\0')) { - /* Hm, maybe we've got something long. Let's try reading - it as a Python long object. */ - errno = 0; - py_int = PyLong_FromString(s, NULL, 0); - if (py_int == NULL) { - PyErr_SetString(PyExc_ValueError, - "could not convert string to int"); - goto finally; - } - } - else { - if (len == 3 && (l == 0 || l == 1)) { - if (!( py_int = PyBool_FromLong(l))) goto finally; - } - else { - if (!( py_int = PyInt_FromLong(l))) goto finally; - } - } - - free(s); - PDATA_PUSH(self->stack, py_int, -1); - return 0; - - finally: - free(s); - - return res; -} - -static int -load_bool(Unpicklerobject *self, PyObject *boolean) -{ - assert(boolean == Py_True || boolean == Py_False); - PDATA_APPEND(self->stack, boolean, -1); - return 0; -} - -/* s contains x bytes of a little-endian integer. Return its value as a - * C int. Obscure: when x is 1 or 2, this is an unsigned little-endian - * int, but when x is 4 it's a signed one. This is an historical source - * of x-platform bugs. - */ -static long -calc_binint(char *s, int x) -{ - unsigned char c; - int i; - long l; - - for (i = 0, l = 0L; i < x; i++) { - c = (unsigned char)s[i]; - l |= (long)c << (i * 8); - } -#if SIZEOF_LONG > 4 - /* Unlike BININT1 and BININT2, BININT (more accurately BININT4) - * is signed, so on a box with longs bigger than 4 bytes we need - * to extend a BININT's sign bit to the full width. - */ - if (x == 4 && l & (1L << 31)) - l |= (~0L) << 32; -#endif - return l; -} - - -static int -load_binintx(Unpicklerobject *self, char *s, int x) -{ - PyObject *py_int = 0; - long l; - - l = calc_binint(s, x); - - if (!( py_int = PyInt_FromLong(l))) - return -1; - - PDATA_PUSH(self->stack, py_int, -1); - return 0; -} - - -static int -load_binint(Unpicklerobject *self) -{ - char *s; - - if (self->read_func(self, &s, 4) < 0) - return -1; - - return load_binintx(self, s, 4); -} - - -static int -load_binint1(Unpicklerobject *self) -{ - char *s; - - if (self->read_func(self, &s, 1) < 0) - return -1; - - return load_binintx(self, s, 1); -} - - -static int -load_binint2(Unpicklerobject *self) -{ - char *s; - - if (self->read_func(self, &s, 2) < 0) - return -1; - - return load_binintx(self, s, 2); -} - -static int -load_long(Unpicklerobject *self) -{ - PyObject *l = 0; - char *end, *s; - Py_ssize_t len; - int res = -1; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - if (!( s=pystrndup(s,len))) return -1; - - if (!( l = PyLong_FromString(s, &end, 0))) - goto finally; - - free(s); - PDATA_PUSH(self->stack, l, -1); - return 0; - - finally: - free(s); - - return res; -} - -/* 'size' bytes contain the # of bytes of little-endian 256's-complement - * data following. - */ -static int -load_counted_long(Unpicklerobject *self, int size) -{ - Py_ssize_t i; - char *nbytes; - unsigned char *pdata; - PyObject *along; - - assert(size == 1 || size == 4); - i = self->read_func(self, &nbytes, size); - if (i < 0) return -1; - - size = calc_binint(nbytes, size); - if (size < 0) { - /* Corrupt or hostile pickle -- we never write one like - * this. - */ - PyErr_SetString(UnpicklingError, "LONG pickle has negative " - "byte count"); - return -1; - } - - if (size == 0) - along = PyLong_FromLong(0L); - else { - /* Read the raw little-endian bytes & convert. */ - i = self->read_func(self, (char **)&pdata, size); - if (i < 0) return -1; - along = _PyLong_FromByteArray(pdata, (size_t)size, - 1 /* little endian */, 1 /* signed */); - } - if (along == NULL) - return -1; - PDATA_PUSH(self->stack, along, -1); - return 0; -} - -static int -load_float(Unpicklerobject *self) -{ - PyObject *py_float = 0; - char *endptr, *s; - Py_ssize_t len; - int res = -1; - double d; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - if (!( s=pystrndup(s,len))) return -1; - - d = PyOS_string_to_double(s, &endptr, PyExc_OverflowError); - - if (d == -1.0 && PyErr_Occurred()) { - goto finally; - } else if ((endptr[0] != '\n') || (endptr[1] != '\0')) { - PyErr_SetString(PyExc_ValueError, - "could not convert string to float"); - goto finally; - } - - if (!( py_float = PyFloat_FromDouble(d))) - goto finally; - - free(s); - PDATA_PUSH(self->stack, py_float, -1); - return 0; - - finally: - free(s); - - return res; -} - -static int -load_binfloat(Unpicklerobject *self) -{ - PyObject *py_float; - double x; - char *p; - - if (self->read_func(self, &p, 8) < 0) - return -1; - - x = _PyFloat_Unpack8((unsigned char *)p, 0); - if (x == -1.0 && PyErr_Occurred()) - return -1; - - py_float = PyFloat_FromDouble(x); - if (py_float == NULL) - return -1; - - PDATA_PUSH(self->stack, py_float, -1); - return 0; -} - -static int -load_string(Unpicklerobject *self) -{ - PyObject *str = 0; - Py_ssize_t len; - int res = -1; - char *s, *p; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - if (!( s=pystrndup(s,len))) return -1; - - - /* Strip outermost quotes */ - while (len > 0 && s[len-1] <= ' ') - len--; - if (len > 1 && s[0]=='"' && s[len-1]=='"') { - s[len-1] = '\0'; - p = s + 1 ; - len -= 2; - } - else if (len > 1 && s[0]=='\'' && s[len-1]=='\'') { - s[len-1] = '\0'; - p = s + 1 ; - len -= 2; - } - else - goto insecure; - /********************************************/ - - str = PyString_DecodeEscape(p, len, NULL, 0, NULL); - free(s); - if (str) { - PDATA_PUSH(self->stack, str, -1); - res = 0; - } - return res; - - insecure: - free(s); - PyErr_SetString(PyExc_ValueError,"insecure string pickle"); - return -1; -} - - -static int -load_binstring(Unpicklerobject *self) -{ - PyObject *py_string = 0; - Py_ssize_t l; - char *s; - - if (self->read_func(self, &s, 4) < 0) return -1; - - l = calc_binint(s, 4); - if (l < 0) { - /* Corrupt or hostile pickle -- we never write one like - * this. - */ - PyErr_SetString(UnpicklingError, - "BINSTRING pickle has negative byte count"); - return -1; - } - - if (self->read_func(self, &s, l) < 0) - return -1; - - if (!( py_string = PyString_FromStringAndSize(s, l))) - return -1; - - PDATA_PUSH(self->stack, py_string, -1); - return 0; -} - - -static int -load_short_binstring(Unpicklerobject *self) -{ - PyObject *py_string = 0; - unsigned char l; - char *s; - - if (self->read_func(self, &s, 1) < 0) - return -1; - - l = (unsigned char)s[0]; - - if (self->read_func(self, &s, l) < 0) return -1; - - if (!( py_string = PyString_FromStringAndSize(s, l))) return -1; - - PDATA_PUSH(self->stack, py_string, -1); - return 0; -} - - -#ifdef Py_USING_UNICODE -static int -load_unicode(Unpicklerobject *self) -{ - PyObject *str = 0; - Py_ssize_t len; - char *s; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 1) return bad_readline(); - - if (!( str = PyUnicode_DecodeRawUnicodeEscape(s, len - 1, NULL))) - return -1; - - PDATA_PUSH(self->stack, str, -1); - return 0; -} -#endif - - -#ifdef Py_USING_UNICODE -static int -load_binunicode(Unpicklerobject *self) -{ - PyObject *unicode; - Py_ssize_t l; - char *s; - - if (self->read_func(self, &s, 4) < 0) return -1; - - l = calc_binint(s, 4); - if (l < 0) { - /* Corrupt or hostile pickle -- we never write one like - * this. - */ - PyErr_SetString(UnpicklingError, - "BINUNICODE pickle has negative byte count"); - return -1; - } - - if (self->read_func(self, &s, l) < 0) - return -1; - - if (!( unicode = PyUnicode_DecodeUTF8(s, l, NULL))) - return -1; - - PDATA_PUSH(self->stack, unicode, -1); - return 0; -} -#endif - - -static int -load_tuple(Unpicklerobject *self) -{ - PyObject *tup; - Py_ssize_t i; - - if ((i = marker(self)) < 0) return -1; - if (!( tup=Pdata_popTuple(self->stack, i))) return -1; - PDATA_PUSH(self->stack, tup, -1); - return 0; -} - -static int -load_counted_tuple(Unpicklerobject *self, int len) -{ - PyObject *tup = PyTuple_New(len); - - if (tup == NULL) - return -1; - - while (--len >= 0) { - PyObject *element; - - PDATA_POP(self->stack, element); - if (element == NULL) - return -1; - PyTuple_SET_ITEM(tup, len, element); - } - PDATA_PUSH(self->stack, tup, -1); - return 0; -} - -static int -load_empty_list(Unpicklerobject *self) -{ - PyObject *list; - - if (!( list=PyList_New(0))) return -1; - PDATA_PUSH(self->stack, list, -1); - return 0; -} - -static int -load_empty_dict(Unpicklerobject *self) -{ - PyObject *dict; - - if (!( dict=PyDict_New())) return -1; - PDATA_PUSH(self->stack, dict, -1); - return 0; -} - - -static int -load_list(Unpicklerobject *self) -{ - PyObject *list = 0; - Py_ssize_t i; - - if ((i = marker(self)) < 0) return -1; - if (!( list=Pdata_popList(self->stack, i))) return -1; - PDATA_PUSH(self->stack, list, -1); - return 0; -} - -static int -load_dict(Unpicklerobject *self) -{ - PyObject *dict, *key, *value; - Py_ssize_t i, j, k; - - if ((i = marker(self)) < 0) return -1; - j=self->stack->length; - - if (!( dict = PyDict_New())) return -1; - - for (k = i+1; k < j; k += 2) { - key =self->stack->data[k-1]; - value=self->stack->data[k ]; - if (PyDict_SetItem(dict, key, value) < 0) { - Py_DECREF(dict); - return -1; - } - } - Pdata_clear(self->stack, i); - PDATA_PUSH(self->stack, dict, -1); - return 0; -} - -static PyObject * -Instance_New(PyObject *cls, PyObject *args) -{ - PyObject *r = 0; - - if (PyClass_Check(cls)) { - int l; - - if ((l=PyObject_Size(args)) < 0) goto err; - if (!( l )) { - PyObject *__getinitargs__; - - __getinitargs__ = PyObject_GetAttr(cls, - __getinitargs___str); - if (!__getinitargs__) { - /* We have a class with no __getinitargs__, - so bypass usual construction */ - PyObject *inst; - - PyErr_Clear(); - if (!( inst=PyInstance_NewRaw(cls, NULL))) - goto err; - return inst; - } - Py_DECREF(__getinitargs__); - } - - if ((r=PyInstance_New(cls, args, NULL))) return r; - else goto err; - } - - if ((r=PyObject_CallObject(cls, args))) return r; - - err: - { - PyObject *tp, *v, *tb, *tmp_value; - - PyErr_Fetch(&tp, &v, &tb); - tmp_value = v; - /* NULL occurs when there was a KeyboardInterrupt */ - if (tmp_value == NULL) - tmp_value = Py_None; - if ((r = PyTuple_Pack(3, tmp_value, cls, args))) { - Py_XDECREF(v); - v=r; - } - PyErr_Restore(tp,v,tb); - } - return NULL; -} - - -static int -load_obj(Unpicklerobject *self) -{ - PyObject *class, *tup, *obj=0; - Py_ssize_t i; - - if ((i = marker(self)) < 0) return -1; - if (!( tup=Pdata_popTuple(self->stack, i+1))) return -1; - PDATA_POP(self->stack, class); - if (class) { - obj = Instance_New(class, tup); - Py_DECREF(class); - } - Py_DECREF(tup); - - if (! obj) return -1; - PDATA_PUSH(self->stack, obj, -1); - return 0; -} - - -static int -load_inst(Unpicklerobject *self) -{ - PyObject *tup, *class=0, *obj=0, *module_name, *class_name; - Py_ssize_t i, len; - char *s; - - if ((i = marker(self)) < 0) return -1; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - module_name = PyString_FromStringAndSize(s, len - 1); - if (!module_name) return -1; - - if ((len = self->readline_func(self, &s)) >= 0) { - if (len < 2) return bad_readline(); - if ((class_name = PyString_FromStringAndSize(s, len - 1))) { - class = find_class(module_name, class_name, - self->find_class); - Py_DECREF(class_name); - } - } - Py_DECREF(module_name); - - if (! class) return -1; - - if ((tup=Pdata_popTuple(self->stack, i))) { - obj = Instance_New(class, tup); - Py_DECREF(tup); - } - Py_DECREF(class); - - if (! obj) return -1; - - PDATA_PUSH(self->stack, obj, -1); - return 0; -} - -static int -load_newobj(Unpicklerobject *self) -{ - PyObject *args = NULL; - PyObject *clsraw = NULL; - PyTypeObject *cls; /* clsraw cast to its true type */ - PyObject *obj; - - /* Stack is ... cls argtuple, and we want to call - * cls.__new__(cls, *argtuple). - */ - PDATA_POP(self->stack, args); - if (args == NULL) goto Fail; - if (! PyTuple_Check(args)) { - PyErr_SetString(UnpicklingError, "NEWOBJ expected an arg " - "tuple."); - goto Fail; - } - - PDATA_POP(self->stack, clsraw); - cls = (PyTypeObject *)clsraw; - if (cls == NULL) goto Fail; - if (! PyType_Check(cls)) { - PyErr_SetString(UnpicklingError, "NEWOBJ class argument " - "isn't a type object"); - goto Fail; - } - if (cls->tp_new == NULL) { - PyErr_SetString(UnpicklingError, "NEWOBJ class argument " - "has NULL tp_new"); - goto Fail; - } - - /* Call __new__. */ - obj = cls->tp_new(cls, args, NULL); - if (obj == NULL) goto Fail; - - Py_DECREF(args); - Py_DECREF(clsraw); - PDATA_PUSH(self->stack, obj, -1); - return 0; - - Fail: - Py_XDECREF(args); - Py_XDECREF(clsraw); - return -1; -} - -static int -load_global(Unpicklerobject *self) -{ - PyObject *class = 0, *module_name = 0, *class_name = 0; - Py_ssize_t len; - char *s; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - module_name = PyString_FromStringAndSize(s, len - 1); - if (!module_name) return -1; - - if ((len = self->readline_func(self, &s)) >= 0) { - if (len < 2) { - Py_DECREF(module_name); - return bad_readline(); - } - if ((class_name = PyString_FromStringAndSize(s, len - 1))) { - class = find_class(module_name, class_name, - self->find_class); - Py_DECREF(class_name); - } - } - Py_DECREF(module_name); - - if (! class) return -1; - PDATA_PUSH(self->stack, class, -1); - return 0; -} - - -static int -load_persid(Unpicklerobject *self) -{ - PyObject *pid = 0; - Py_ssize_t len; - char *s; - - if (self->pers_func) { - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - - pid = PyString_FromStringAndSize(s, len - 1); - if (!pid) return -1; - - if (PyList_Check(self->pers_func)) { - if (PyList_Append(self->pers_func, pid) < 0) { - Py_DECREF(pid); - return -1; - } - } - else { - ARG_TUP(self, pid); - if (self->arg) { - pid = PyObject_Call(self->pers_func, self->arg, - NULL); - FREE_ARG_TUP(self); - } - } - - if (! pid) return -1; - - PDATA_PUSH(self->stack, pid, -1); - return 0; - } - else { - PyErr_SetString(UnpicklingError, - "A load persistent id instruction was encountered,\n" - "but no persistent_load function was specified."); - return -1; - } -} - -static int -load_binpersid(Unpicklerobject *self) -{ - PyObject *pid = 0; - - if (self->pers_func) { - PDATA_POP(self->stack, pid); - if (! pid) return -1; - - if (PyList_Check(self->pers_func)) { - if (PyList_Append(self->pers_func, pid) < 0) { - Py_DECREF(pid); - return -1; - } - } - else { - ARG_TUP(self, pid); - if (self->arg) { - pid = PyObject_Call(self->pers_func, self->arg, - NULL); - FREE_ARG_TUP(self); - } - if (! pid) return -1; - } - - PDATA_PUSH(self->stack, pid, -1); - return 0; - } - else { - PyErr_SetString(UnpicklingError, - "A load persistent id instruction was encountered,\n" - "but no persistent_load function was specified."); - return -1; - } -} - - -static int -load_pop(Unpicklerobject *self) -{ - Py_ssize_t len = self->stack->length; - - /* Note that we split the (pickle.py) stack into two stacks, - an object stack and a mark stack. We have to be clever and - pop the right one. We do this by looking at the top of the - mark stack first, and only signalling a stack underflow if - the object stack is empty and the mark stack doesn't match - our expectations. - */ - if (self->num_marks > 0 && self->marks[self->num_marks - 1] == len) { - self->num_marks--; - } else if (len > 0) { - len--; - Py_DECREF(self->stack->data[len]); - self->stack->length = len; - } else { - return stackUnderflow(); - } - return 0; -} - - -static int -load_pop_mark(Unpicklerobject *self) -{ - Py_ssize_t i; - - if ((i = marker(self)) < 0) - return -1; - - Pdata_clear(self->stack, i); - - return 0; -} - - -static int -load_dup(Unpicklerobject *self) -{ - PyObject *last; - Py_ssize_t len; - - if ((len = self->stack->length) <= 0) return stackUnderflow(); - last=self->stack->data[len-1]; - Py_INCREF(last); - PDATA_PUSH(self->stack, last, -1); - return 0; -} - - -static int -load_get(Unpicklerobject *self) -{ - PyObject *py_str = 0, *value = 0; - Py_ssize_t len; - char *s; - int rc; - - if ((len = self->readline_func(self, &s)) < 0) return -1; - if (len < 2) return bad_readline(); - - if (!( py_str = PyString_FromStringAndSize(s, len - 1))) return -1; - - value = PyDict_GetItem(self->memo, py_str); - if (! value) { - PyErr_SetObject(BadPickleGet, py_str); - rc = -1; - } - else { - PDATA_APPEND(self->stack, value, -1); - rc = 0; - } - - Py_DECREF(py_str); - return rc; -} - - -static int -load_binget(Unpicklerobject *self) -{ - PyObject *py_key = 0, *value = 0; - unsigned char key; - char *s; - int rc; - - if (self->read_func(self, &s, 1) < 0) return -1; - - key = (unsigned char)s[0]; - if (!( py_key = PyInt_FromLong((long)key))) return -1; - - value = PyDict_GetItem(self->memo, py_key); - if (! value) { - PyErr_SetObject(BadPickleGet, py_key); - rc = -1; - } - else { - PDATA_APPEND(self->stack, value, -1); - rc = 0; - } - - Py_DECREF(py_key); - return rc; -} - - -static int -load_long_binget(Unpicklerobject *self) -{ - PyObject *py_key = 0, *value = 0; - unsigned char c; - char *s; - Py_ssize_t key; - int rc; - - if (self->read_func(self, &s, 4) < 0) return -1; - - c = (unsigned char)s[0]; - key = (long)c; - c = (unsigned char)s[1]; - key |= (long)c << 8; - c = (unsigned char)s[2]; - key |= (long)c << 16; - c = (unsigned char)s[3]; - key |= (long)c << 24; - - if (!( py_key = PyInt_FromLong((long)key))) return -1; - - value = PyDict_GetItem(self->memo, py_key); - if (! value) { - PyErr_SetObject(BadPickleGet, py_key); - rc = -1; - } - else { - PDATA_APPEND(self->stack, value, -1); - rc = 0; - } - - Py_DECREF(py_key); - return rc; -} - -/* Push an object from the extension registry (EXT[124]). nbytes is - * the number of bytes following the opcode, holding the index (code) value. - */ -static int -load_extension(Unpicklerobject *self, int nbytes) -{ - char *codebytes; /* the nbytes bytes after the opcode */ - long code; /* calc_binint returns long */ - PyObject *py_code; /* code as a Python int */ - PyObject *obj; /* the object to push */ - PyObject *pair; /* (module_name, class_name) */ - PyObject *module_name, *class_name; - - assert(nbytes == 1 || nbytes == 2 || nbytes == 4); - if (self->read_func(self, &codebytes, nbytes) < 0) return -1; - code = calc_binint(codebytes, nbytes); - if (code <= 0) { /* note that 0 is forbidden */ - /* Corrupt or hostile pickle. */ - PyErr_SetString(UnpicklingError, "EXT specifies code <= 0"); - return -1; - } - - /* Look for the code in the cache. */ - py_code = PyInt_FromLong(code); - if (py_code == NULL) return -1; - obj = PyDict_GetItem(extension_cache, py_code); - if (obj != NULL) { - /* Bingo. */ - Py_DECREF(py_code); - PDATA_APPEND(self->stack, obj, -1); - return 0; - } - - /* Look up the (module_name, class_name) pair. */ - pair = PyDict_GetItem(inverted_registry, py_code); - if (pair == NULL) { - Py_DECREF(py_code); - PyErr_Format(PyExc_ValueError, "unregistered extension " - "code %ld", code); - return -1; - } - /* Since the extension registry is manipulable via Python code, - * confirm that pair is really a 2-tuple of strings. - */ - if (!PyTuple_Check(pair) || PyTuple_Size(pair) != 2 || - !PyString_Check(module_name = PyTuple_GET_ITEM(pair, 0)) || - !PyString_Check(class_name = PyTuple_GET_ITEM(pair, 1))) { - Py_DECREF(py_code); - PyErr_Format(PyExc_ValueError, "_inverted_registry[%ld] " - "isn't a 2-tuple of strings", code); - return -1; - } - /* Load the object. */ - obj = find_class(module_name, class_name, self->find_class); - if (obj == NULL) { - Py_DECREF(py_code); - return -1; - } - /* Cache code -> obj. */ - code = PyDict_SetItem(extension_cache, py_code, obj); - Py_DECREF(py_code); - if (code < 0) { - Py_DECREF(obj); - return -1; - } - PDATA_PUSH(self->stack, obj, -1); - return 0; -} - -static int -load_put(Unpicklerobject *self) -{ - PyObject *py_str = 0, *value = 0; - Py_ssize_t len, l; - char *s; - - if ((l = self->readline_func(self, &s)) < 0) return -1; - if (l < 2) return bad_readline(); - if (!( len=self->stack->length )) return stackUnderflow(); - if (!( py_str = PyString_FromStringAndSize(s, l - 1))) return -1; - value=self->stack->data[len-1]; - l=PyDict_SetItem(self->memo, py_str, value); - Py_DECREF(py_str); - return l; -} - - -static int -load_binput(Unpicklerobject *self) -{ - PyObject *py_key = 0, *value = 0; - unsigned char key; - char *s; - Py_ssize_t len; - - if (self->read_func(self, &s, 1) < 0) return -1; - if (!( (len=self->stack->length) > 0 )) return stackUnderflow(); - - key = (unsigned char)s[0]; - - if (!( py_key = PyInt_FromLong((long)key))) return -1; - value=self->stack->data[len-1]; - len=PyDict_SetItem(self->memo, py_key, value); - Py_DECREF(py_key); - return len; -} - - -static int -load_long_binput(Unpicklerobject *self) -{ - PyObject *py_key = 0, *value = 0; - Py_ssize_t key; - unsigned char c; - char *s; - Py_ssize_t len; - - if (self->read_func(self, &s, 4) < 0) return -1; - if (!( len=self->stack->length )) return stackUnderflow(); - - c = (unsigned char)s[0]; - key = (long)c; - c = (unsigned char)s[1]; - key |= (long)c << 8; - c = (unsigned char)s[2]; - key |= (long)c << 16; - c = (unsigned char)s[3]; - key |= (long)c << 24; - - if (!( py_key = PyInt_FromLong(key))) return -1; - value=self->stack->data[len-1]; - len=PyDict_SetItem(self->memo, py_key, value); - Py_DECREF(py_key); - return len; -} - - -static int -do_append(Unpicklerobject *self, Py_ssize_t x) -{ - PyObject *value = 0, *list = 0, *append_method = 0; - Py_ssize_t len, i; - - len=self->stack->length; - if (!( len >= x && x > 0 )) return stackUnderflow(); - /* nothing to do */ - if (len==x) return 0; - - list=self->stack->data[x-1]; - - if (PyList_Check(list)) { - PyObject *slice; - int list_len; - - slice=Pdata_popList(self->stack, x); - if (! slice) return -1; - list_len = PyList_GET_SIZE(list); - i=PyList_SetSlice(list, list_len, list_len, slice); - Py_DECREF(slice); - return i; - } - else { - - if (!( append_method = PyObject_GetAttr(list, append_str))) - return -1; - - for (i = x; i < len; i++) { - PyObject *junk; - - value=self->stack->data[i]; - junk=0; - ARG_TUP(self, value); - if (self->arg) { - junk = PyObject_Call(append_method, self->arg, - NULL); - FREE_ARG_TUP(self); - } - if (! junk) { - Pdata_clear(self->stack, i+1); - self->stack->length=x; - Py_DECREF(append_method); - return -1; - } - Py_DECREF(junk); - } - self->stack->length=x; - Py_DECREF(append_method); - } - - return 0; -} - - -static int -load_append(Unpicklerobject *self) -{ - return do_append(self, self->stack->length - 1); -} - - -static int -load_appends(Unpicklerobject *self) -{ - return do_append(self, marker(self)); -} - - -static Py_ssize_t -do_setitems(Unpicklerobject *self, Py_ssize_t x) -{ - PyObject *value = 0, *key = 0, *dict = 0; - Py_ssize_t len, i, r=0; - - if (!( (len=self->stack->length) >= x - && x > 0 )) return stackUnderflow(); - - dict=self->stack->data[x-1]; - - for (i = x+1; i < len; i += 2) { - key =self->stack->data[i-1]; - value=self->stack->data[i ]; - if (PyObject_SetItem(dict, key, value) < 0) { - r=-1; - break; - } - } - - Pdata_clear(self->stack, x); - - return r; -} - - -static int -load_setitem(Unpicklerobject *self) -{ - return do_setitems(self, self->stack->length - 2); -} - -static int -load_setitems(Unpicklerobject *self) -{ - return do_setitems(self, marker(self)); -} - - -static int -load_build(Unpicklerobject *self) -{ - PyObject *state, *inst, *slotstate; - PyObject *__setstate__; - PyObject *d_key, *d_value; - int res = -1; - Py_ssize_t i; - - /* Stack is ... instance, state. We want to leave instance at - * the stack top, possibly mutated via instance.__setstate__(state). - */ - if (self->stack->length < 2) - return stackUnderflow(); - PDATA_POP(self->stack, state); - if (state == NULL) - return -1; - inst = self->stack->data[self->stack->length - 1]; - - __setstate__ = PyObject_GetAttr(inst, __setstate___str); - if (__setstate__ != NULL) { - PyObject *junk = NULL; - - /* The explicit __setstate__ is responsible for everything. */ - ARG_TUP(self, state); - if (self->arg) { - junk = PyObject_Call(__setstate__, self->arg, NULL); - FREE_ARG_TUP(self); - } - Py_DECREF(__setstate__); - if (junk == NULL) - return -1; - Py_DECREF(junk); - return 0; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - - /* A default __setstate__. First see whether state embeds a - * slot state dict too (a proto 2 addition). - */ - if (PyTuple_Check(state) && PyTuple_Size(state) == 2) { - PyObject *temp = state; - state = PyTuple_GET_ITEM(temp, 0); - slotstate = PyTuple_GET_ITEM(temp, 1); - Py_INCREF(state); - Py_INCREF(slotstate); - Py_DECREF(temp); - } - else - slotstate = NULL; - - /* Set inst.__dict__ from the state dict (if any). */ - if (state != Py_None) { - PyObject *dict; - if (! PyDict_Check(state)) { - PyErr_SetString(UnpicklingError, "state is not a " - "dictionary"); - goto finally; - } - dict = PyObject_GetAttr(inst, __dict___str); - if (dict == NULL) - goto finally; - - i = 0; - while (PyDict_Next(state, &i, &d_key, &d_value)) { - /* normally the keys for instance attributes are - interned. we should try to do that here. */ - Py_INCREF(d_key); - if (PyString_CheckExact(d_key)) - PyString_InternInPlace(&d_key); - if (PyObject_SetItem(dict, d_key, d_value) < 0) { - Py_DECREF(d_key); - goto finally; - } - Py_DECREF(d_key); - } - Py_DECREF(dict); - } - - /* Also set instance attributes from the slotstate dict (if any). */ - if (slotstate != NULL) { - if (! PyDict_Check(slotstate)) { - PyErr_SetString(UnpicklingError, "slot state is not " - "a dictionary"); - goto finally; - } - i = 0; - while (PyDict_Next(slotstate, &i, &d_key, &d_value)) { - if (PyObject_SetAttr(inst, d_key, d_value) < 0) - goto finally; - } - } - res = 0; - - finally: - Py_DECREF(state); - Py_XDECREF(slotstate); - return res; -} - - -static int -load_mark(Unpicklerobject *self) -{ - Py_ssize_t s; - - /* Note that we split the (pickle.py) stack into two stacks, an - object stack and a mark stack. Here we push a mark onto the - mark stack. - */ - - if ((self->num_marks + 1) >= self->marks_size) { - Py_ssize_t *marks; - s=self->marks_size+20; - if (s <= self->num_marks) s=self->num_marks + 1; - if (self->marks == NULL) - marks=(Py_ssize_t *)malloc(s * sizeof(Py_ssize_t)); - else - marks=(Py_ssize_t *)realloc(self->marks, - s * sizeof(Py_ssize_t)); - if (!marks) { - PyErr_NoMemory(); - return -1; - } - self->marks = marks; - self->marks_size = s; - } - - self->marks[self->num_marks++] = self->stack->length; - - return 0; -} - -static int -load_reduce(Unpicklerobject *self) -{ - PyObject *callable = 0, *arg_tup = 0, *ob = 0; - - PDATA_POP(self->stack, arg_tup); - if (! arg_tup) return -1; - PDATA_POP(self->stack, callable); - if (callable) { - ob = Instance_New(callable, arg_tup); - Py_DECREF(callable); - } - Py_DECREF(arg_tup); - - if (! ob) return -1; - - PDATA_PUSH(self->stack, ob, -1); - return 0; -} - -/* Just raises an error if we don't know the protocol specified. PROTO - * is the first opcode for protocols >= 2. - */ -static int -load_proto(Unpicklerobject *self) -{ - int i; - char *protobyte; - - i = self->read_func(self, &protobyte, 1); - if (i < 0) - return -1; - - i = calc_binint(protobyte, 1); - /* No point checking for < 0, since calc_binint returns an unsigned - * int when chewing on 1 byte. - */ - assert(i >= 0); - if (i <= HIGHEST_PROTOCOL) - return 0; - - PyErr_Format(PyExc_ValueError, "unsupported pickle protocol: %d", i); - return -1; -} - -static PyObject * -load(Unpicklerobject *self) -{ - PyObject *err = 0, *val = 0; - char *s; - - self->num_marks = 0; - if (self->stack->length) Pdata_clear(self->stack, 0); - - while (1) { - if (self->read_func(self, &s, 1) < 0) - break; - - switch (s[0]) { - case NONE: - if (load_none(self) < 0) - break; - continue; - - case BININT: - if (load_binint(self) < 0) - break; - continue; - - case BININT1: - if (load_binint1(self) < 0) - break; - continue; - - case BININT2: - if (load_binint2(self) < 0) - break; - continue; - - case INT: - if (load_int(self) < 0) - break; - continue; - - case LONG: - if (load_long(self) < 0) - break; - continue; - - case LONG1: - if (load_counted_long(self, 1) < 0) - break; - continue; - - case LONG4: - if (load_counted_long(self, 4) < 0) - break; - continue; - - case FLOAT: - if (load_float(self) < 0) - break; - continue; - - case BINFLOAT: - if (load_binfloat(self) < 0) - break; - continue; - - case BINSTRING: - if (load_binstring(self) < 0) - break; - continue; - - case SHORT_BINSTRING: - if (load_short_binstring(self) < 0) - break; - continue; - - case STRING: - if (load_string(self) < 0) - break; - continue; - -#ifdef Py_USING_UNICODE - case UNICODE: - if (load_unicode(self) < 0) - break; - continue; - - case BINUNICODE: - if (load_binunicode(self) < 0) - break; - continue; -#endif - - case EMPTY_TUPLE: - if (load_counted_tuple(self, 0) < 0) - break; - continue; - - case TUPLE1: - if (load_counted_tuple(self, 1) < 0) - break; - continue; - - case TUPLE2: - if (load_counted_tuple(self, 2) < 0) - break; - continue; - - case TUPLE3: - if (load_counted_tuple(self, 3) < 0) - break; - continue; - - case TUPLE: - if (load_tuple(self) < 0) - break; - continue; - - case EMPTY_LIST: - if (load_empty_list(self) < 0) - break; - continue; - - case LIST: - if (load_list(self) < 0) - break; - continue; - - case EMPTY_DICT: - if (load_empty_dict(self) < 0) - break; - continue; - - case DICT: - if (load_dict(self) < 0) - break; - continue; - - case OBJ: - if (load_obj(self) < 0) - break; - continue; - - case INST: - if (load_inst(self) < 0) - break; - continue; - - case NEWOBJ: - if (load_newobj(self) < 0) - break; - continue; - - case GLOBAL: - if (load_global(self) < 0) - break; - continue; - - case APPEND: - if (load_append(self) < 0) - break; - continue; - - case APPENDS: - if (load_appends(self) < 0) - break; - continue; - - case BUILD: - if (load_build(self) < 0) - break; - continue; - - case DUP: - if (load_dup(self) < 0) - break; - continue; - - case BINGET: - if (load_binget(self) < 0) - break; - continue; - - case LONG_BINGET: - if (load_long_binget(self) < 0) - break; - continue; - - case GET: - if (load_get(self) < 0) - break; - continue; - - case EXT1: - if (load_extension(self, 1) < 0) - break; - continue; - - case EXT2: - if (load_extension(self, 2) < 0) - break; - continue; - - case EXT4: - if (load_extension(self, 4) < 0) - break; - continue; - case MARK: - if (load_mark(self) < 0) - break; - continue; - - case BINPUT: - if (load_binput(self) < 0) - break; - continue; - - case LONG_BINPUT: - if (load_long_binput(self) < 0) - break; - continue; - - case PUT: - if (load_put(self) < 0) - break; - continue; - - case POP: - if (load_pop(self) < 0) - break; - continue; - - case POP_MARK: - if (load_pop_mark(self) < 0) - break; - continue; - - case SETITEM: - if (load_setitem(self) < 0) - break; - continue; - - case SETITEMS: - if (load_setitems(self) < 0) - break; - continue; - - case STOP: - break; - - case PERSID: - if (load_persid(self) < 0) - break; - continue; - - case BINPERSID: - if (load_binpersid(self) < 0) - break; - continue; - - case REDUCE: - if (load_reduce(self) < 0) - break; - continue; - - case PROTO: - if (load_proto(self) < 0) - break; - continue; - - case NEWTRUE: - if (load_bool(self, Py_True) < 0) - break; - continue; - - case NEWFALSE: - if (load_bool(self, Py_False) < 0) - break; - continue; - - case '\0': - /* end of file */ - PyErr_SetNone(PyExc_EOFError); - break; - - default: - cPickle_ErrFormat(UnpicklingError, - "invalid load key, '%s'.", - "c", s[0]); - return NULL; - } - - break; - } - - if ((err = PyErr_Occurred())) { - if (err == PyExc_EOFError) { - PyErr_SetNone(PyExc_EOFError); - } - return NULL; - } - - PDATA_POP(self->stack, val); - return val; -} - - -/* No-load functions to support noload, which is used to - find persistent references. */ - -static int -noload_obj(Unpicklerobject *self) -{ - Py_ssize_t i; - - if ((i = marker(self)) < 0) return -1; - return Pdata_clear(self->stack, i+1); -} - - -static int -noload_inst(Unpicklerobject *self) -{ - Py_ssize_t i; - char *s; - - if ((i = marker(self)) < 0) return -1; - Pdata_clear(self->stack, i); - if (self->readline_func(self, &s) < 0) return -1; - if (self->readline_func(self, &s) < 0) return -1; - PDATA_APPEND(self->stack, Py_None, -1); - return 0; -} - -static int -noload_newobj(Unpicklerobject *self) -{ - PyObject *obj; - - PDATA_POP(self->stack, obj); /* pop argtuple */ - if (obj == NULL) return -1; - Py_DECREF(obj); - - PDATA_POP(self->stack, obj); /* pop cls */ - if (obj == NULL) return -1; - Py_DECREF(obj); - - PDATA_APPEND(self->stack, Py_None, -1); - return 0; -} - -static int -noload_global(Unpicklerobject *self) -{ - char *s; - - if (self->readline_func(self, &s) < 0) return -1; - if (self->readline_func(self, &s) < 0) return -1; - PDATA_APPEND(self->stack, Py_None,-1); - return 0; -} - -static int -noload_reduce(Unpicklerobject *self) -{ - - if (self->stack->length < 2) return stackUnderflow(); - Pdata_clear(self->stack, self->stack->length-2); - PDATA_APPEND(self->stack, Py_None,-1); - return 0; -} - -static int -noload_build(Unpicklerobject *self) { - - if (self->stack->length < 1) return stackUnderflow(); - Pdata_clear(self->stack, self->stack->length-1); - return 0; -} - -static int -noload_extension(Unpicklerobject *self, int nbytes) -{ - char *codebytes; - - assert(nbytes == 1 || nbytes == 2 || nbytes == 4); - if (self->read_func(self, &codebytes, nbytes) < 0) return -1; - PDATA_APPEND(self->stack, Py_None, -1); - return 0; -} - -static int -noload_append(Unpicklerobject *self) -{ - return Pdata_clear(self->stack, self->stack->length - 1); -} - -static int -noload_appends(Unpicklerobject *self) -{ - Py_ssize_t i; - if ((i = marker(self)) < 0) return -1; - return Pdata_clear(self->stack, i); -} - -static int -noload_setitem(Unpicklerobject *self) -{ - return Pdata_clear(self->stack, self->stack->length - 2); -} - -static int -noload_setitems(Unpicklerobject *self) -{ - Py_ssize_t i; - if ((i = marker(self)) < 0) return -1; - return Pdata_clear(self->stack, i); -} - -static PyObject * -noload(Unpicklerobject *self) -{ - PyObject *err = 0, *val = 0; - char *s; - - self->num_marks = 0; - Pdata_clear(self->stack, 0); - - while (1) { - if (self->read_func(self, &s, 1) < 0) - break; - - switch (s[0]) { - case NONE: - if (load_none(self) < 0) - break; - continue; - - case BININT: - if (load_binint(self) < 0) - break; - continue; - - case BININT1: - if (load_binint1(self) < 0) - break; - continue; - - case BININT2: - if (load_binint2(self) < 0) - break; - continue; - - case INT: - if (load_int(self) < 0) - break; - continue; - - case LONG: - if (load_long(self) < 0) - break; - continue; - - case LONG1: - if (load_counted_long(self, 1) < 0) - break; - continue; - - case LONG4: - if (load_counted_long(self, 4) < 0) - break; - continue; - - case FLOAT: - if (load_float(self) < 0) - break; - continue; - - case BINFLOAT: - if (load_binfloat(self) < 0) - break; - continue; - - case BINSTRING: - if (load_binstring(self) < 0) - break; - continue; - - case SHORT_BINSTRING: - if (load_short_binstring(self) < 0) - break; - continue; - - case STRING: - if (load_string(self) < 0) - break; - continue; - -#ifdef Py_USING_UNICODE - case UNICODE: - if (load_unicode(self) < 0) - break; - continue; - - case BINUNICODE: - if (load_binunicode(self) < 0) - break; - continue; -#endif - - case EMPTY_TUPLE: - if (load_counted_tuple(self, 0) < 0) - break; - continue; - - case TUPLE1: - if (load_counted_tuple(self, 1) < 0) - break; - continue; - - case TUPLE2: - if (load_counted_tuple(self, 2) < 0) - break; - continue; - - case TUPLE3: - if (load_counted_tuple(self, 3) < 0) - break; - continue; - - case TUPLE: - if (load_tuple(self) < 0) - break; - continue; - - case EMPTY_LIST: - if (load_empty_list(self) < 0) - break; - continue; - - case LIST: - if (load_list(self) < 0) - break; - continue; - - case EMPTY_DICT: - if (load_empty_dict(self) < 0) - break; - continue; - - case DICT: - if (load_dict(self) < 0) - break; - continue; - - case OBJ: - if (noload_obj(self) < 0) - break; - continue; - - case INST: - if (noload_inst(self) < 0) - break; - continue; - - case NEWOBJ: - if (noload_newobj(self) < 0) - break; - continue; - - case GLOBAL: - if (noload_global(self) < 0) - break; - continue; - - case APPEND: - if (noload_append(self) < 0) - break; - continue; - - case APPENDS: - if (noload_appends(self) < 0) - break; - continue; - - case BUILD: - if (noload_build(self) < 0) - break; - continue; - - case DUP: - if (load_dup(self) < 0) - break; - continue; - - case BINGET: - if (load_binget(self) < 0) - break; - continue; - - case LONG_BINGET: - if (load_long_binget(self) < 0) - break; - continue; - - case GET: - if (load_get(self) < 0) - break; - continue; - - case EXT1: - if (noload_extension(self, 1) < 0) - break; - continue; - - case EXT2: - if (noload_extension(self, 2) < 0) - break; - continue; - - case EXT4: - if (noload_extension(self, 4) < 0) - break; - continue; - - case MARK: - if (load_mark(self) < 0) - break; - continue; - - case BINPUT: - if (load_binput(self) < 0) - break; - continue; - - case LONG_BINPUT: - if (load_long_binput(self) < 0) - break; - continue; - - case PUT: - if (load_put(self) < 0) - break; - continue; - - case POP: - if (load_pop(self) < 0) - break; - continue; - - case POP_MARK: - if (load_pop_mark(self) < 0) - break; - continue; - - case SETITEM: - if (noload_setitem(self) < 0) - break; - continue; - - case SETITEMS: - if (noload_setitems(self) < 0) - break; - continue; - - case STOP: - break; - - case PERSID: - if (load_persid(self) < 0) - break; - continue; - - case BINPERSID: - if (load_binpersid(self) < 0) - break; - continue; - - case REDUCE: - if (noload_reduce(self) < 0) - break; - continue; - - case PROTO: - if (load_proto(self) < 0) - break; - continue; - - case NEWTRUE: - if (load_bool(self, Py_True) < 0) - break; - continue; - - case NEWFALSE: - if (load_bool(self, Py_False) < 0) - break; - continue; - default: - cPickle_ErrFormat(UnpicklingError, - "invalid load key, '%s'.", - "c", s[0]); - return NULL; - } - - break; - } - - if ((err = PyErr_Occurred())) { - if (err == PyExc_EOFError) { - PyErr_SetNone(PyExc_EOFError); - } - return NULL; - } - - PDATA_POP(self->stack, val); - return val; -} - - -static PyObject * -Unpickler_load(Unpicklerobject *self, PyObject *unused) -{ - return load(self); -} - -static PyObject * -Unpickler_noload(Unpicklerobject *self, PyObject *unused) -{ - return noload(self); -} - - -static struct PyMethodDef Unpickler_methods[] = { - {"load", (PyCFunction)Unpickler_load, METH_NOARGS, - PyDoc_STR("load() -- Load a pickle") - }, - {"noload", (PyCFunction)Unpickler_noload, METH_NOARGS, - PyDoc_STR( - "noload() -- not load a pickle, but go through most of the motions\n" - "\n" - "This function can be used to read past a pickle without instantiating\n" - "any objects or importing any modules. It can also be used to find all\n" - "persistent references without instantiating any objects or importing\n" - "any modules.\n") - }, - {NULL, NULL} /* sentinel */ -}; - - -static Unpicklerobject * -newUnpicklerobject(PyObject *f) -{ - Unpicklerobject *self; - - if (!( self = PyObject_GC_New(Unpicklerobject, &Unpicklertype))) - return NULL; - - self->file = NULL; - self->arg = NULL; - self->stack = (Pdata*)Pdata_New(); - self->pers_func = NULL; - self->last_string = NULL; - self->marks = NULL; - self->num_marks = 0; - self->marks_size = 0; - self->buf_size = 0; - self->read = NULL; - self->readline = NULL; - self->find_class = NULL; - - if (!( self->memo = PyDict_New())) - goto err; - - if (!self->stack) - goto err; - - Py_INCREF(f); - self->file = f; - - /* Set read, readline based on type of f */ - if (PyFile_Check(f)) { - self->fp = PyFile_AsFile(f); - if (self->fp == NULL) { - PyErr_SetString(PyExc_ValueError, - "I/O operation on closed file"); - goto err; - } - self->read_func = read_file; - self->readline_func = readline_file; - } - else if (PycStringIO_InputCheck(f)) { - self->fp = NULL; - self->read_func = read_cStringIO; - self->readline_func = readline_cStringIO; - } - else { - - self->fp = NULL; - self->read_func = read_other; - self->readline_func = readline_other; - - if (!( (self->readline = PyObject_GetAttr(f, readline_str)) && - (self->read = PyObject_GetAttr(f, read_str)))) { - PyErr_Clear(); - PyErr_SetString( PyExc_TypeError, - "argument must have 'read' and " - "'readline' attributes" ); - goto err; - } - } - PyObject_GC_Track(self); - - return self; - - err: - Py_DECREF((PyObject *)self); - return NULL; -} - - -static PyObject * -get_Unpickler(PyObject *self, PyObject *file) -{ - return (PyObject *)newUnpicklerobject(file); -} - - -static void -Unpickler_dealloc(Unpicklerobject *self) -{ - PyObject_GC_UnTrack((PyObject *)self); - Py_XDECREF(self->readline); - Py_XDECREF(self->read); - Py_XDECREF(self->file); - Py_XDECREF(self->memo); - Py_XDECREF(self->stack); - Py_XDECREF(self->pers_func); - Py_XDECREF(self->arg); - Py_XDECREF(self->last_string); - Py_XDECREF(self->find_class); - - if (self->marks) { - free(self->marks); - } - - if (self->buf_size) { - free(self->buf); - } - - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -Unpickler_traverse(Unpicklerobject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->readline); - Py_VISIT(self->read); - Py_VISIT(self->file); - Py_VISIT(self->memo); - Py_VISIT(self->stack); - Py_VISIT(self->pers_func); - Py_VISIT(self->arg); - Py_VISIT(self->last_string); - Py_VISIT(self->find_class); - return 0; -} - -static int -Unpickler_clear(Unpicklerobject *self) -{ - Py_CLEAR(self->readline); - Py_CLEAR(self->read); - Py_CLEAR(self->file); - Py_CLEAR(self->memo); - Py_CLEAR(self->stack); - Py_CLEAR(self->pers_func); - Py_CLEAR(self->arg); - Py_CLEAR(self->last_string); - Py_CLEAR(self->find_class); - return 0; -} - -static PyObject * -Unpickler_getattr(Unpicklerobject *self, char *name) -{ - if (!strcmp(name, "persistent_load")) { - if (!self->pers_func) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; - } - - Py_INCREF(self->pers_func); - return self->pers_func; - } - - if (!strcmp(name, "find_global")) { - if (!self->find_class) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; - } - - Py_INCREF(self->find_class); - return self->find_class; - } - - if (!strcmp(name, "memo")) { - if (!self->memo) { - PyErr_SetString(PyExc_AttributeError, name); - return NULL; - } - - Py_INCREF(self->memo); - return self->memo; - } - - if (!strcmp(name, "UnpicklingError")) { - Py_INCREF(UnpicklingError); - return UnpicklingError; - } - - return Py_FindMethod(Unpickler_methods, (PyObject *)self, name); -} - - -static int -Unpickler_setattr(Unpicklerobject *self, char *name, PyObject *value) -{ - - if (!strcmp(name, "persistent_load")) { - Py_XDECREF(self->pers_func); - self->pers_func = value; - Py_XINCREF(value); - return 0; - } - - if (!strcmp(name, "find_global")) { - Py_XDECREF(self->find_class); - self->find_class = value; - Py_XINCREF(value); - return 0; - } - - if (! value) { - PyErr_SetString(PyExc_TypeError, - "attribute deletion is not supported"); - return -1; - } - - if (strcmp(name, "memo") == 0) { - if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "memo must be a dictionary"); - return -1; - } - Py_XDECREF(self->memo); - self->memo = value; - Py_INCREF(value); - return 0; - } - - PyErr_SetString(PyExc_AttributeError, name); - return -1; -} - -/* --------------------------------------------------------------------------- - * Module-level functions. - */ - -/* dump(obj, file, protocol=0). */ -static PyObject * -cpm_dump(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"obj", "file", "protocol", NULL}; - PyObject *ob, *file, *res = NULL; - Picklerobject *pickler = 0; - int proto = 0; - - if (!( PyArg_ParseTupleAndKeywords(args, kwds, "OO|i", kwlist, - &ob, &file, &proto))) - goto finally; - - if (!( pickler = newPicklerobject(file, proto))) - goto finally; - - if (dump(pickler, ob) < 0) - goto finally; - - Py_INCREF(Py_None); - res = Py_None; - - finally: - Py_XDECREF(pickler); - - return res; -} - - -/* dumps(obj, protocol=0). */ -static PyObject * -cpm_dumps(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"obj", "protocol", NULL}; - PyObject *ob, *file = 0, *res = NULL; - Picklerobject *pickler = 0; - int proto = 0; - - if (!( PyArg_ParseTupleAndKeywords(args, kwds, "O|i:dumps", kwlist, - &ob, &proto))) - goto finally; - - if (!( file = PycStringIO->NewOutput(128))) - goto finally; - - if (!( pickler = newPicklerobject(file, proto))) - goto finally; - - if (dump(pickler, ob) < 0) - goto finally; - - res = PycStringIO->cgetvalue(file); - - finally: - Py_XDECREF(pickler); - Py_XDECREF(file); - - return res; -} - - -/* load(fileobj). */ -static PyObject * -cpm_load(PyObject *self, PyObject *ob) -{ - Unpicklerobject *unpickler = 0; - PyObject *res = NULL; - - if (!( unpickler = newUnpicklerobject(ob))) - goto finally; - - res = load(unpickler); - - finally: - Py_XDECREF(unpickler); - - return res; -} - - -/* loads(string) */ -static PyObject * -cpm_loads(PyObject *self, PyObject *args) -{ - PyObject *ob, *file = 0, *res = NULL; - Unpicklerobject *unpickler = 0; - - if (!( PyArg_ParseTuple(args, "S:loads", &ob))) - goto finally; - - if (!( file = PycStringIO->NewInput(ob))) - goto finally; - - if (!( unpickler = newUnpicklerobject(file))) - goto finally; - - res = load(unpickler); - - finally: - Py_XDECREF(file); - Py_XDECREF(unpickler); - - return res; -} - - -PyDoc_STRVAR(Unpicklertype__doc__, -"Objects that know how to unpickle"); - -static PyTypeObject Unpicklertype = { - PyVarObject_HEAD_INIT(NULL, 0) - "cPickle.Unpickler", /*tp_name*/ - sizeof(Unpicklerobject), /*tp_basicsize*/ - 0, - (destructor)Unpickler_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - (getattrfunc)Unpickler_getattr, /* tp_getattr */ - (setattrfunc)Unpickler_setattr, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - Unpicklertype__doc__, /* tp_doc */ - (traverseproc)Unpickler_traverse, /* tp_traverse */ - (inquiry)Unpickler_clear, /* tp_clear */ -}; - -static struct PyMethodDef cPickle_methods[] = { - {"dump", (PyCFunction)cpm_dump, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("dump(obj, file, protocol=0) -- " - "Write an object in pickle format to the given file.\n" - "\n" - "See the Pickler docstring for the meaning of optional argument proto.") - }, - - {"dumps", (PyCFunction)cpm_dumps, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("dumps(obj, protocol=0) -- " - "Return a string containing an object in pickle format.\n" - "\n" - "See the Pickler docstring for the meaning of optional argument proto.") - }, - - {"load", (PyCFunction)cpm_load, METH_O, - PyDoc_STR("load(file) -- Load a pickle from the given file")}, - - {"loads", (PyCFunction)cpm_loads, METH_VARARGS, - PyDoc_STR("loads(string) -- Load a pickle from the given string")}, - - {"Pickler", (PyCFunction)get_Pickler, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("Pickler(file, protocol=0) -- Create a pickler.\n" - "\n" - "This takes a file-like object for writing a pickle data stream.\n" - "The optional proto argument tells the pickler to use the given\n" - "protocol; supported protocols are 0, 1, 2. The default\n" - "protocol is 0, to be backwards compatible. (Protocol 0 is the\n" - "only protocol that can be written to a file opened in text\n" - "mode and read back successfully. When using a protocol higher\n" - "than 0, make sure the file is opened in binary mode, both when\n" - "pickling and unpickling.)\n" - "\n" - "Protocol 1 is more efficient than protocol 0; protocol 2 is\n" - "more efficient than protocol 1.\n" - "\n" - "Specifying a negative protocol version selects the highest\n" - "protocol version supported. The higher the protocol used, the\n" - "more recent the version of Python needed to read the pickle\n" - "produced.\n" - "\n" - "The file parameter must have a write() method that accepts a single\n" - "string argument. It can thus be an open file object, a StringIO\n" - "object, or any other custom object that meets this interface.\n") - }, - - {"Unpickler", (PyCFunction)get_Unpickler, METH_O, - PyDoc_STR("Unpickler(file) -- Create an unpickler.")}, - - { NULL, NULL } -}; - -static int -init_stuff(PyObject *module_dict) -{ - PyObject *copyreg, *t, *r; - -#define INIT_STR(S) if (!( S ## _str=PyString_InternFromString(#S))) return -1; - - if (PyType_Ready(&Unpicklertype) < 0) - return -1; - if (PyType_Ready(&Picklertype) < 0) - return -1; - - INIT_STR(__class__); - INIT_STR(__getinitargs__); - INIT_STR(__dict__); - INIT_STR(__getstate__); - INIT_STR(__setstate__); - INIT_STR(__name__); - INIT_STR(__main__); - INIT_STR(__reduce__); - INIT_STR(__reduce_ex__); - INIT_STR(write); - INIT_STR(append); - INIT_STR(read); - INIT_STR(readline); - INIT_STR(dispatch_table); - - if (!( copyreg = PyImport_ImportModule("copy_reg"))) - return -1; - - /* This is special because we want to use a different - one in restricted mode. */ - dispatch_table = PyObject_GetAttr(copyreg, dispatch_table_str); - if (!dispatch_table) return -1; - - extension_registry = PyObject_GetAttrString(copyreg, - "_extension_registry"); - if (!extension_registry) return -1; - - inverted_registry = PyObject_GetAttrString(copyreg, - "_inverted_registry"); - if (!inverted_registry) return -1; - - extension_cache = PyObject_GetAttrString(copyreg, - "_extension_cache"); - if (!extension_cache) return -1; - - Py_DECREF(copyreg); - - if (!(empty_tuple = PyTuple_New(0))) - return -1; - - two_tuple = PyTuple_New(2); - if (two_tuple == NULL) - return -1; - /* We use this temp container with no regard to refcounts, or to - * keeping containees alive. Exempt from GC, because we don't - * want anything looking at two_tuple() by magic. - */ - PyObject_GC_UnTrack(two_tuple); - - /* Ugh */ - if (!( t=PyImport_ImportModule("__builtin__"))) return -1; - if (PyDict_SetItemString(module_dict, "__builtins__", t) < 0) - return -1; - - if (!( t=PyDict_New())) return -1; - if (!( r=PyRun_String( - "def __str__(self):\n" - " return self.args and ('%s' % self.args[0]) or '(what)'\n", - Py_file_input, - module_dict, t) )) return -1; - Py_DECREF(r); - - PickleError = PyErr_NewException("cPickle.PickleError", NULL, t); - if (!PickleError) - return -1; - - Py_DECREF(t); - - PicklingError = PyErr_NewException("cPickle.PicklingError", - PickleError, NULL); - if (!PicklingError) - return -1; - - if (!( t=PyDict_New())) return -1; - if (!( r=PyRun_String( - "def __str__(self):\n" - " a=self.args\n" - " a=a and type(a[0]) or '(what)'\n" - " return 'Cannot pickle %s objects' % a\n" - , Py_file_input, - module_dict, t) )) return -1; - Py_DECREF(r); - - if (!( UnpickleableError = PyErr_NewException( - "cPickle.UnpickleableError", PicklingError, t))) - return -1; - - Py_DECREF(t); - - if (!( UnpicklingError = PyErr_NewException("cPickle.UnpicklingError", - PickleError, NULL))) - return -1; - - if (!( BadPickleGet = PyErr_NewException("cPickle.BadPickleGet", - UnpicklingError, NULL))) - return -1; - - if (PyDict_SetItemString(module_dict, "PickleError", - PickleError) < 0) - return -1; - - if (PyDict_SetItemString(module_dict, "PicklingError", - PicklingError) < 0) - return -1; - - if (PyDict_SetItemString(module_dict, "UnpicklingError", - UnpicklingError) < 0) - return -1; - - if (PyDict_SetItemString(module_dict, "UnpickleableError", - UnpickleableError) < 0) - return -1; - - if (PyDict_SetItemString(module_dict, "BadPickleGet", - BadPickleGet) < 0) - return -1; - - PycString_IMPORT; - - return 0; -} - -#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ -#define PyMODINIT_FUNC void -#endif -PyMODINIT_FUNC -initcPickle(void) -{ - PyObject *m, *d, *di, *v, *k; - Py_ssize_t i; - char *rev = "1.71"; /* XXX when does this change? */ - PyObject *format_version; - PyObject *compatible_formats; - - Py_TYPE(&Picklertype) = &PyType_Type; - Py_TYPE(&Unpicklertype) = &PyType_Type; - Py_TYPE(&PdataType) = &PyType_Type; - - /* Initialize some pieces. We need to do this before module creation, - * so we're forced to use a temporary dictionary. :( - */ - di = PyDict_New(); - if (!di) return; - if (init_stuff(di) < 0) return; - - /* Create the module and add the functions */ - m = Py_InitModule4("cPickle", cPickle_methods, - cPickle_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - if (m == NULL) - return; - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - v = PyString_FromString(rev); - PyDict_SetItemString(d, "__version__", v); - Py_XDECREF(v); - - /* Copy data from di. Waaa. */ - for (i=0; PyDict_Next(di, &i, &k, &v); ) { - if (PyObject_SetItem(d, k, v) < 0) { - Py_DECREF(di); - return; - } - } - Py_DECREF(di); - - i = PyModule_AddIntConstant(m, "HIGHEST_PROTOCOL", HIGHEST_PROTOCOL); - if (i < 0) - return; - - /* These are purely informational; no code uses them. */ - /* File format version we write. */ - format_version = PyString_FromString("2.0"); - /* Format versions we can read. */ - compatible_formats = Py_BuildValue("[sssss]", - "1.0", /* Original protocol 0 */ - "1.1", /* Protocol 0 + INST */ - "1.2", /* Original protocol 1 */ - "1.3", /* Protocol 1 + BINFLOAT */ - "2.0"); /* Original protocol 2 */ - PyDict_SetItemString(d, "format_version", format_version); - PyDict_SetItemString(d, "compatible_formats", compatible_formats); - Py_XDECREF(format_version); - Py_XDECREF(compatible_formats); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cStringIO.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cStringIO.c deleted file mode 100644 index 9710f33..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cStringIO.c +++ /dev/null @@ -1,779 +0,0 @@ - -#include "Python.h" -#include "import.h" -#include "cStringIO.h" -#include "structmember.h" - -PyDoc_STRVAR(cStringIO_module_documentation, -"A simple fast partial StringIO replacement.\n" -"\n" -"This module provides a simple useful replacement for\n" -"the StringIO module that is written in C. It does not provide the\n" -"full generality of StringIO, but it provides enough for most\n" -"applications and is especially useful in conjunction with the\n" -"pickle module.\n" -"\n" -"Usage:\n" -"\n" -" from cStringIO import StringIO\n" -"\n" -" an_output_stream=StringIO()\n" -" an_output_stream.write(some_stuff)\n" -" ...\n" -" value=an_output_stream.getvalue()\n" -"\n" -" an_input_stream=StringIO(a_string)\n" -" spam=an_input_stream.readline()\n" -" spam=an_input_stream.read(5)\n" -" an_input_stream.seek(0) # OK, start over\n" -" spam=an_input_stream.read() # and read it all\n" -" \n" -"If someone else wants to provide a more complete implementation,\n" -"go for it. :-) \n" -"\n" -"cStringIO.c,v 1.29 1999/06/15 14:10:27 jim Exp\n"); - -/* Declaration for file-like objects that manage data as strings - - The IOobject type should be though of as a common base type for - Iobjects, which provide input (read-only) StringIO objects and - Oobjects, which provide read-write objects. Most of the methods - depend only on common data. -*/ - -typedef struct { - PyObject_HEAD - char *buf; - Py_ssize_t pos, string_size; -} IOobject; - -#define IOOOBJECT(O) ((IOobject*)(O)) - -/* Declarations for objects of type StringO */ - -typedef struct { /* Subtype of IOobject */ - PyObject_HEAD - char *buf; - Py_ssize_t pos, string_size; - - Py_ssize_t buf_size; - int softspace; -} Oobject; - -/* Declarations for objects of type StringI */ - -typedef struct { /* Subtype of IOobject */ - PyObject_HEAD - char *buf; - Py_ssize_t pos, string_size; - Py_buffer pbuf; -} Iobject; - -/* IOobject (common) methods */ - -PyDoc_STRVAR(IO_flush__doc__, "flush(): does nothing."); - -static int -IO__opencheck(IOobject *self) { - if (!self->buf) { - PyErr_SetString(PyExc_ValueError, - "I/O operation on closed file"); - return 0; - } - return 1; -} - -static PyObject * -IO_get_closed(IOobject *self, void *closure) -{ - PyObject *result = Py_False; - - if (self->buf == NULL) - result = Py_True; - Py_INCREF(result); - return result; -} - -static PyGetSetDef file_getsetlist[] = { - {"closed", (getter)IO_get_closed, NULL, "True if the file is closed"}, - {0}, -}; - -static PyObject * -IO_flush(IOobject *self, PyObject *unused) { - - if (!IO__opencheck(self)) return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(IO_getval__doc__, -"getvalue([use_pos]) -- Get the string value." -"\n" -"If use_pos is specified and is a true value, then the string returned\n" -"will include only the text up to the current file position.\n"); - -static PyObject * -IO_cgetval(PyObject *self) { - if (!IO__opencheck(IOOOBJECT(self))) return NULL; - assert(IOOOBJECT(self)->pos >= 0); - return PyString_FromStringAndSize(((IOobject*)self)->buf, - ((IOobject*)self)->pos); -} - -static PyObject * -IO_getval(IOobject *self, PyObject *args) { - PyObject *use_pos=Py_None; - int b; - Py_ssize_t s; - - if (!IO__opencheck(self)) return NULL; - if (!PyArg_UnpackTuple(args,"getval", 0, 1,&use_pos)) return NULL; - - b = PyObject_IsTrue(use_pos); - if (b < 0) - return NULL; - if (b) { - s=self->pos; - if (s > self->string_size) s=self->string_size; - } - else - s=self->string_size; - assert(self->pos >= 0); - return PyString_FromStringAndSize(self->buf, s); -} - -PyDoc_STRVAR(IO_isatty__doc__, "isatty(): always returns 0"); - -static PyObject * -IO_isatty(IOobject *self, PyObject *unused) { - if (!IO__opencheck(self)) return NULL; - Py_INCREF(Py_False); - return Py_False; -} - -PyDoc_STRVAR(IO_read__doc__, -"read([s]) -- Read s characters, or the rest of the string"); - -static int -IO_cread(PyObject *self, char **output, Py_ssize_t n) { - Py_ssize_t l; - - if (!IO__opencheck(IOOOBJECT(self))) return -1; - assert(IOOOBJECT(self)->pos >= 0); - assert(IOOOBJECT(self)->string_size >= 0); - l = ((IOobject*)self)->string_size - ((IOobject*)self)->pos; - if (n < 0 || n > l) { - n = l; - if (n < 0) n=0; - } - if (n > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "length too large"); - return -1; - } - - *output=((IOobject*)self)->buf + ((IOobject*)self)->pos; - ((IOobject*)self)->pos += n; - return (int)n; -} - -static PyObject * -IO_read(IOobject *self, PyObject *args) { - Py_ssize_t n = -1; - char *output = NULL; - - if (!PyArg_ParseTuple(args, "|n:read", &n)) return NULL; - - if ( (n=IO_cread((PyObject*)self,&output,n)) < 0) return NULL; - - return PyString_FromStringAndSize(output, n); -} - -PyDoc_STRVAR(IO_readline__doc__, "readline() -- Read one line"); - -static int -IO_creadline(PyObject *self, char **output) { - char *n, *start, *end; - Py_ssize_t len; - - if (!IO__opencheck(IOOOBJECT(self))) return -1; - - n = start = ((IOobject*)self)->buf + ((IOobject*)self)->pos; - end = ((IOobject*)self)->buf + ((IOobject*)self)->string_size; - while (n < end && *n != '\n') - n++; - - if (n < end) n++; - - len = n - start; - if (len > INT_MAX) - len = INT_MAX; - - *output=start; - - assert(IOOOBJECT(self)->pos <= PY_SSIZE_T_MAX - len); - assert(IOOOBJECT(self)->pos >= 0); - assert(IOOOBJECT(self)->string_size >= 0); - - ((IOobject*)self)->pos += len; - return (int)len; -} - -static PyObject * -IO_readline(IOobject *self, PyObject *args) { - int n, m=-1; - char *output; - - if (args) - if (!PyArg_ParseTuple(args, "|i:readline", &m)) return NULL; - - if( (n=IO_creadline((PyObject*)self,&output)) < 0) return NULL; - if (m >= 0 && m < n) { - m = n - m; - n -= m; - self->pos -= m; - } - assert(IOOOBJECT(self)->pos >= 0); - return PyString_FromStringAndSize(output, n); -} - -PyDoc_STRVAR(IO_readlines__doc__, "readlines() -- Read all lines"); - -static PyObject * -IO_readlines(IOobject *self, PyObject *args) { - int n; - char *output; - PyObject *result, *line; - Py_ssize_t hint = 0, length = 0; - - if (!PyArg_ParseTuple(args, "|n:readlines", &hint)) return NULL; - - result = PyList_New(0); - if (!result) - return NULL; - - while (1){ - if ( (n = IO_creadline((PyObject*)self,&output)) < 0) - goto err; - if (n == 0) - break; - line = PyString_FromStringAndSize (output, n); - if (!line) - goto err; - if (PyList_Append (result, line) == -1) { - Py_DECREF (line); - goto err; - } - Py_DECREF (line); - length += n; - if (hint > 0 && length >= hint) - break; - } - return result; - err: - Py_DECREF(result); - return NULL; -} - -PyDoc_STRVAR(IO_reset__doc__, -"reset() -- Reset the file position to the beginning"); - -static PyObject * -IO_reset(IOobject *self, PyObject *unused) { - - if (!IO__opencheck(self)) return NULL; - - self->pos = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(IO_tell__doc__, "tell() -- get the current position."); - -static PyObject * -IO_tell(IOobject *self, PyObject *unused) { - - if (!IO__opencheck(self)) return NULL; - - assert(self->pos >= 0); - return PyInt_FromSsize_t(self->pos); -} - -PyDoc_STRVAR(IO_truncate__doc__, -"truncate(): truncate the file at the current position."); - -static PyObject * -IO_truncate(IOobject *self, PyObject *args) { - Py_ssize_t pos = -1; - - if (!IO__opencheck(self)) return NULL; - if (!PyArg_ParseTuple(args, "|n:truncate", &pos)) return NULL; - - if (PyTuple_Size(args) == 0) { - /* No argument passed, truncate to current position */ - pos = self->pos; - } - - if (pos < 0) { - errno = EINVAL; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - - if (self->string_size > pos) self->string_size = pos; - self->pos = self->string_size; - - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -IO_iternext(Iobject *self) -{ - PyObject *next; - next = IO_readline((IOobject *)self, NULL); - if (!next) - return NULL; - if (!PyString_GET_SIZE(next)) { - Py_DECREF(next); - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - return next; -} - - - - -/* Read-write object methods */ - -PyDoc_STRVAR(IO_seek__doc__, -"seek(position) -- set the current position\n" -"seek(position, mode) -- mode 0: absolute; 1: relative; 2: relative to EOF"); - -static PyObject * -IO_seek(Iobject *self, PyObject *args) { - Py_ssize_t position; - int mode = 0; - - if (!IO__opencheck(IOOOBJECT(self))) return NULL; - if (!PyArg_ParseTuple(args, "n|i:seek", &position, &mode)) - return NULL; - - if (mode == 2) { - position += self->string_size; - } - else if (mode == 1) { - position += self->pos; - } - - if (position < 0) position=0; - - self->pos=position; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(O_write__doc__, -"write(s) -- Write a string to the file" -"\n\nNote (hack:) writing None resets the buffer"); - - -static int -O_cwrite(PyObject *self, const char *c, Py_ssize_t len) { - Py_ssize_t newpos; - Oobject *oself; - char *newbuf; - - if (!IO__opencheck(IOOOBJECT(self))) return -1; - oself = (Oobject *)self; - - if (len > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "length too large"); - return -1; - } - assert(len >= 0); - if (oself->pos >= PY_SSIZE_T_MAX - len) { - PyErr_SetString(PyExc_OverflowError, - "new position too large"); - return -1; - } - newpos = oself->pos + len; - if (newpos >= oself->buf_size) { - size_t newsize = oself->buf_size; - newsize *= 2; - if (newsize <= (size_t)newpos || newsize > PY_SSIZE_T_MAX) { - assert(newpos < PY_SSIZE_T_MAX - 1); - newsize = newpos + 1; - } - newbuf = (char*)realloc(oself->buf, newsize); - if (!newbuf) { - PyErr_SetString(PyExc_MemoryError,"out of memory"); - return -1; - } - oself->buf_size = (Py_ssize_t)newsize; - oself->buf = newbuf; - } - - if (oself->string_size < oself->pos) { - /* In case of overseek, pad with null bytes the buffer region between - the end of stream and the current position. - - 0 lo string_size hi - | |<---used--->|<----------available----------->| - | | <--to pad-->|<---to write---> | - 0 buf position - */ - memset(oself->buf + oself->string_size, '\0', - (oself->pos - oself->string_size) * sizeof(char)); - } - - memcpy(oself->buf + oself->pos, c, len); - - oself->pos = newpos; - - if (oself->string_size < oself->pos) { - oself->string_size = oself->pos; - } - - return (int)len; -} - -static PyObject * -O_write(Oobject *self, PyObject *args) { - Py_buffer buf; - int result; - - if (!PyArg_ParseTuple(args, "s*:write", &buf)) return NULL; - - result = O_cwrite((PyObject*)self, buf.buf, buf.len); - PyBuffer_Release(&buf); - if (result < 0) return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(O_close__doc__, "close(): explicitly release resources held."); - -static PyObject * -O_close(Oobject *self, PyObject *unused) { - if (self->buf != NULL) free(self->buf); - self->buf = NULL; - - self->pos = self->string_size = self->buf_size = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(O_writelines__doc__, -"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable object\n" -"producing strings. This is equivalent to calling write() for each string."); -static PyObject * -O_writelines(Oobject *self, PyObject *args) { - PyObject *it, *s; - - it = PyObject_GetIter(args); - if (it == NULL) - return NULL; - while ((s = PyIter_Next(it)) != NULL) { - Py_ssize_t n; - char *c; - if (PyString_AsStringAndSize(s, &c, &n) == -1) { - Py_DECREF(it); - Py_DECREF(s); - return NULL; - } - if (O_cwrite((PyObject *)self, c, n) == -1) { - Py_DECREF(it); - Py_DECREF(s); - return NULL; - } - Py_DECREF(s); - } - - Py_DECREF(it); - - /* See if PyIter_Next failed */ - if (PyErr_Occurred()) - return NULL; - - Py_RETURN_NONE; -} -static struct PyMethodDef O_methods[] = { - /* Common methods: */ - {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, - {"getvalue", (PyCFunction)IO_getval, METH_VARARGS, IO_getval__doc__}, - {"isatty", (PyCFunction)IO_isatty, METH_NOARGS, IO_isatty__doc__}, - {"read", (PyCFunction)IO_read, METH_VARARGS, IO_read__doc__}, - {"readline", (PyCFunction)IO_readline, METH_VARARGS, IO_readline__doc__}, - {"readlines", (PyCFunction)IO_readlines,METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction)IO_reset, METH_NOARGS, IO_reset__doc__}, - {"seek", (PyCFunction)IO_seek, METH_VARARGS, IO_seek__doc__}, - {"tell", (PyCFunction)IO_tell, METH_NOARGS, IO_tell__doc__}, - {"truncate", (PyCFunction)IO_truncate, METH_VARARGS, IO_truncate__doc__}, - - /* Read-write StringIO specific methods: */ - {"close", (PyCFunction)O_close, METH_NOARGS, O_close__doc__}, - {"write", (PyCFunction)O_write, METH_VARARGS, O_write__doc__}, - {"writelines", (PyCFunction)O_writelines, METH_O, O_writelines__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static PyMemberDef O_memberlist[] = { - {"softspace", T_INT, offsetof(Oobject, softspace), 0, - "flag indicating that a space needs to be printed; used by print"}, - /* getattr(f, "closed") is implemented without this table */ - {NULL} /* Sentinel */ -}; - -static void -O_dealloc(Oobject *self) { - if (self->buf != NULL) - free(self->buf); - PyObject_Del(self); -} - -PyDoc_STRVAR(Otype__doc__, "Simple type for output to strings."); - -static PyTypeObject Otype = { - PyVarObject_HEAD_INIT(NULL, 0) - "cStringIO.StringO", /*tp_name*/ - sizeof(Oobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)O_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr */ - 0, /*tp_setattr */ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0 , /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro */ - 0, /*tp_setattro */ - 0, /*tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - Otype__doc__, /*tp_doc */ - 0, /*tp_traverse */ - 0, /*tp_clear */ - 0, /*tp_richcompare */ - 0, /*tp_weaklistoffset */ - PyObject_SelfIter, /*tp_iter */ - (iternextfunc)IO_iternext, /*tp_iternext */ - O_methods, /*tp_methods */ - O_memberlist, /*tp_members */ - file_getsetlist, /*tp_getset */ -}; - -static PyObject * -newOobject(int size) { - Oobject *self; - - self = PyObject_New(Oobject, &Otype); - if (self == NULL) - return NULL; - self->pos=0; - self->string_size = 0; - self->softspace = 0; - - self->buf = (char *)malloc(size); - if (!self->buf) { - PyErr_SetString(PyExc_MemoryError,"out of memory"); - self->buf_size = 0; - Py_DECREF(self); - return NULL; - } - - self->buf_size=size; - return (PyObject*)self; -} - -/* End of code for StringO objects */ -/* -------------------------------------------------------- */ - -static PyObject * -I_close(Iobject *self, PyObject *unused) { - PyBuffer_Release(&self->pbuf); - self->buf = NULL; - - self->pos = self->string_size = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -static struct PyMethodDef I_methods[] = { - /* Common methods: */ - {"flush", (PyCFunction)IO_flush, METH_NOARGS, IO_flush__doc__}, - {"getvalue", (PyCFunction)IO_getval, METH_VARARGS, IO_getval__doc__}, - {"isatty", (PyCFunction)IO_isatty, METH_NOARGS, IO_isatty__doc__}, - {"read", (PyCFunction)IO_read, METH_VARARGS, IO_read__doc__}, - {"readline", (PyCFunction)IO_readline, METH_VARARGS, IO_readline__doc__}, - {"readlines", (PyCFunction)IO_readlines,METH_VARARGS, IO_readlines__doc__}, - {"reset", (PyCFunction)IO_reset, METH_NOARGS, IO_reset__doc__}, - {"seek", (PyCFunction)IO_seek, METH_VARARGS, IO_seek__doc__}, - {"tell", (PyCFunction)IO_tell, METH_NOARGS, IO_tell__doc__}, - {"truncate", (PyCFunction)IO_truncate, METH_VARARGS, IO_truncate__doc__}, - - /* Read-only StringIO specific methods: */ - {"close", (PyCFunction)I_close, METH_NOARGS, O_close__doc__}, - {NULL, NULL} -}; - -static void -I_dealloc(Iobject *self) { - PyBuffer_Release(&self->pbuf); - PyObject_Del(self); -} - - -PyDoc_STRVAR(Itype__doc__, -"Simple type for treating strings as input file streams"); - -static PyTypeObject Itype = { - PyVarObject_HEAD_INIT(NULL, 0) - "cStringIO.StringI", /*tp_name*/ - sizeof(Iobject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)I_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /* tp_getattr */ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - Itype__doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)IO_iternext, /* tp_iternext */ - I_methods, /* tp_methods */ - 0, /* tp_members */ - file_getsetlist, /* tp_getset */ -}; - -static PyObject * -newIobject(PyObject *s) { - Iobject *self; - Py_buffer buf; - PyObject *args; - int result; - - args = Py_BuildValue("(O)", s); - if (args == NULL) - return NULL; - result = PyArg_ParseTuple(args, "s*:StringIO", &buf); - Py_DECREF(args); - if (!result) - return NULL; - - self = PyObject_New(Iobject, &Itype); - if (!self) { - PyBuffer_Release(&buf); - return NULL; - } - self->buf=buf.buf; - self->string_size=buf.len; - self->pbuf=buf; - self->pos=0; - - return (PyObject*)self; -} - -/* End of code for StringI objects */ -/* -------------------------------------------------------- */ - - -PyDoc_STRVAR(IO_StringIO__doc__, -"StringIO([s]) -- Return a StringIO-like stream for reading or writing"); - -static PyObject * -IO_StringIO(PyObject *self, PyObject *args) { - PyObject *s=0; - - if (!PyArg_UnpackTuple(args, "StringIO", 0, 1, &s)) return NULL; - - if (s) return newIobject(s); - return newOobject(128); -} - -/* List of methods defined in the module */ - -static struct PyMethodDef IO_methods[] = { - {"StringIO", (PyCFunction)IO_StringIO, - METH_VARARGS, IO_StringIO__doc__}, - {NULL, NULL} /* sentinel */ -}; - - -/* Initialization function for the module (*must* be called initcStringIO) */ - -static struct PycStringIO_CAPI CAPI = { - IO_cread, - IO_creadline, - O_cwrite, - IO_cgetval, - newOobject, - newIobject, - &Itype, - &Otype, -}; - -#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */ -#define PyMODINIT_FUNC void -#endif -PyMODINIT_FUNC -initcStringIO(void) { - PyObject *m, *d, *v; - - - /* Create the module and add the functions */ - m = Py_InitModule4("cStringIO", IO_methods, - cStringIO_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - if (m == NULL) return; - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - - /* Export C API */ - Py_TYPE(&Itype)=&PyType_Type; - Py_TYPE(&Otype)=&PyType_Type; - if (PyType_Ready(&Otype) < 0) return; - if (PyType_Ready(&Itype) < 0) return; - v = PyCapsule_New(&CAPI, PycStringIO_CAPSULE_NAME, NULL); - PyDict_SetItemString(d,"cStringIO_CAPI", v); - Py_XDECREF(v); - - /* Export Types */ - PyDict_SetItemString(d,"InputType", (PyObject*)&Itype); - PyDict_SetItemString(d,"OutputType", (PyObject*)&Otype); - - /* Maybe make certain warnings go away */ - if (0) PycString_IMPORT; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/README b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/README deleted file mode 100644 index 76589f5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/README +++ /dev/null @@ -1,79 +0,0 @@ -To generate or modify mapping headers -------------------------------------- -Mapping headers are imported from CJKCodecs as pre-generated form. -If you need to tweak or add something on it, please look at tools/ -subdirectory of CJKCodecs' distribution. - - - -Notes on implmentation characteristics of each codecs ------------------------------------------------------ - -1) Big5 codec - - The big5 codec maps the following characters as cp950 does rather - than conforming Unicode.org's that maps to 0xFFFD. - - BIG5 Unicode Description - - 0xA15A 0x2574 SPACING UNDERSCORE - 0xA1C3 0xFFE3 SPACING HEAVY OVERSCORE - 0xA1C5 0x02CD SPACING HEAVY UNDERSCORE - 0xA1FE 0xFF0F LT DIAG UP RIGHT TO LOW LEFT - 0xA240 0xFF3C LT DIAG UP LEFT TO LOW RIGHT - 0xA2CC 0x5341 HANGZHOU NUMERAL TEN - 0xA2CE 0x5345 HANGZHOU NUMERAL THIRTY - - Because unicode 0x5341, 0x5345, 0xFF0F, 0xFF3C is mapped to another - big5 codes already, a roundtrip compatibility is not guaranteed for - them. - - -2) cp932 codec - - To conform to Windows's real mapping, cp932 codec maps the following - codepoints in addition of the official cp932 mapping. - - CP932 Unicode Description - - 0x80 0x80 UNDEFINED - 0xA0 0xF8F0 UNDEFINED - 0xFD 0xF8F1 UNDEFINED - 0xFE 0xF8F2 UNDEFINED - 0xFF 0xF8F3 UNDEFINED - - -3) euc-jisx0213 codec - - The euc-jisx0213 codec maps JIS X 0213 Plane 1 code 0x2140 into - unicode U+FF3C instead of U+005C as on unicode.org's mapping. - Because euc-jisx0213 has REVERSE SOLIDUS on 0x5c already and A140 - is shown as a full width character, mapping to U+FF3C can make - more sense. - - The euc-jisx0213 codec is enabled to decode JIS X 0212 codes on - codeset 2. Because JIS X 0212 and JIS X 0213 Plane 2 don't have - overlapped by each other, it doesn't bother standard conformations - (and JIS X 0213 Plane 2 is intended to use so.) On encoding - sessions, the codec will try to encode kanji characters in this - order: - - JIS X 0213 Plane 1 -> JIS X 0213 Plane 2 -> JIS X 0212 - - -4) euc-jp codec - - The euc-jp codec is a compatibility instance on these points: - - U+FF3C FULLWIDTH REVERSE SOLIDUS is mapped to EUC-JP A1C0 (vice versa) - - U+00A5 YEN SIGN is mapped to EUC-JP 0x5c. (one way) - - U+203E OVERLINE is mapped to EUC-JP 0x7e. (one way) - - -5) shift-jis codec - - The shift-jis codec is mapping 0x20-0x7e area to U+20-U+7E directly - instead of using JIS X 0201 for compatibility. The differences are: - - U+005C REVERSE SOLIDUS is mapped to SHIFT-JIS 0x5c. - - U+007E TILDE is mapped to SHIFT-JIS 0x7e. - - U+FF3C FULL-WIDTH REVERSE SOLIDUS is mapped to SHIFT-JIS 815f. - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_cn.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_cn.c deleted file mode 100644 index c77f66e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_cn.c +++ /dev/null @@ -1,444 +0,0 @@ -/* - * _codecs_cn.c: Codecs collection for Mainland Chinese encodings - * - * Written by Hye-Shik Chang - */ - -#include "cjkcodecs.h" -#include "mappings_cn.h" - -/** - * hz is predefined as 100 on AIX. So we undefine it to avoid - * conflict against hz codec's. - */ -#ifdef _AIX -#undef hz -#endif - -/* GBK and GB2312 map differently in few code points that are listed below: - * - * gb2312 gbk - * A1A4 U+30FB KATAKANA MIDDLE DOT U+00B7 MIDDLE DOT - * A1AA U+2015 HORIZONTAL BAR U+2014 EM DASH - * A844 undefined U+2015 HORIZONTAL BAR - */ - -#define GBK_DECODE(dc1, dc2, assi) \ - if ((dc1) == 0xa1 && (dc2) == 0xaa) (assi) = 0x2014; \ - else if ((dc1) == 0xa8 && (dc2) == 0x44) (assi) = 0x2015; \ - else if ((dc1) == 0xa1 && (dc2) == 0xa4) (assi) = 0x00b7; \ - else TRYMAP_DEC(gb2312, assi, dc1 ^ 0x80, dc2 ^ 0x80); \ - else TRYMAP_DEC(gbkext, assi, dc1, dc2); - -#define GBK_ENCODE(code, assi) \ - if ((code) == 0x2014) (assi) = 0xa1aa; \ - else if ((code) == 0x2015) (assi) = 0xa844; \ - else if ((code) == 0x00b7) (assi) = 0xa1a4; \ - else if ((code) != 0x30fb && TRYMAP_ENC_COND(gbcommon, assi, code)); - -/* - * GB2312 codec - */ - -ENCODER(gb2312) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - TRYMAP_ENC(gbcommon, code, c); - else return 1; - - if (code & 0x8000) /* MSB set: GBK */ - return 1; - - OUT1((code >> 8) | 0x80) - OUT2((code & 0xFF) | 0x80) - NEXT(1, 2) - } - - return 0; -} - -DECODER(gb2312) -{ - while (inleft > 0) { - unsigned char c = **inbuf; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - TRYMAP_DEC(gb2312, **outbuf, c ^ 0x80, IN2 ^ 0x80) { - NEXT(2, 1) - } - else return 2; - } - - return 0; -} - - -/* - * GBK codec - */ - -ENCODER(gbk) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - - GBK_ENCODE(c, code) - else return 1; - - OUT1((code >> 8) | 0x80) - if (code & 0x8000) - OUT2((code & 0xFF)) /* MSB set: GBK */ - else - OUT2((code & 0xFF) | 0x80) /* MSB unset: GB2312 */ - NEXT(1, 2) - } - - return 0; -} - -DECODER(gbk) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - - GBK_DECODE(c, IN2, **outbuf) - else return 2; - - NEXT(2, 1) - } - - return 0; -} - - -/* - * GB18030 codec - */ - -ENCODER(gb18030) -{ - while (inleft > 0) { - ucs4_t c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1(c) - NEXT(1, 1) - continue; - } - - DECODE_SURROGATE(c) - if (c > 0x10FFFF) -#if Py_UNICODE_SIZE == 2 - return 2; /* surrogates pair */ -#else - return 1; -#endif - else if (c >= 0x10000) { - ucs4_t tc = c - 0x10000; - - REQUIRE_OUTBUF(4) - - OUT4((unsigned char)(tc % 10) + 0x30) - tc /= 10; - OUT3((unsigned char)(tc % 126) + 0x81) - tc /= 126; - OUT2((unsigned char)(tc % 10) + 0x30) - tc /= 10; - OUT1((unsigned char)(tc + 0x90)) - -#if Py_UNICODE_SIZE == 2 - NEXT(2, 4) /* surrogates pair */ -#else - NEXT(1, 4) -#endif - continue; - } - - REQUIRE_OUTBUF(2) - - GBK_ENCODE(c, code) - else TRYMAP_ENC(gb18030ext, code, c); - else { - const struct _gb18030_to_unibmp_ranges *utrrange; - - REQUIRE_OUTBUF(4) - - for (utrrange = gb18030_to_unibmp_ranges; - utrrange->first != 0; - utrrange++) - if (utrrange->first <= c && - c <= utrrange->last) { - Py_UNICODE tc; - - tc = c - utrrange->first + - utrrange->base; - - OUT4((unsigned char)(tc % 10) + 0x30) - tc /= 10; - OUT3((unsigned char)(tc % 126) + 0x81) - tc /= 126; - OUT2((unsigned char)(tc % 10) + 0x30) - tc /= 10; - OUT1((unsigned char)tc + 0x81) - - NEXT(1, 4) - break; - } - - if (utrrange->first == 0) - return 1; - continue; - } - - OUT1((code >> 8) | 0x80) - if (code & 0x8000) - OUT2((code & 0xFF)) /* MSB set: GBK or GB18030ext */ - else - OUT2((code & 0xFF) | 0x80) /* MSB unset: GB2312 */ - - NEXT(1, 2) - } - - return 0; -} - -DECODER(gb18030) -{ - while (inleft > 0) { - unsigned char c = IN1, c2; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - - c2 = IN2; - if (c2 >= 0x30 && c2 <= 0x39) { /* 4 bytes seq */ - const struct _gb18030_to_unibmp_ranges *utr; - unsigned char c3, c4; - ucs4_t lseq; - - REQUIRE_INBUF(4) - c3 = IN3; - c4 = IN4; - if (c < 0x81 || c3 < 0x81 || c4 < 0x30 || c4 > 0x39) - return 4; - c -= 0x81; c2 -= 0x30; - c3 -= 0x81; c4 -= 0x30; - - if (c < 4) { /* U+0080 - U+FFFF */ - lseq = ((ucs4_t)c * 10 + c2) * 1260 + - (ucs4_t)c3 * 10 + c4; - if (lseq < 39420) { - for (utr = gb18030_to_unibmp_ranges; - lseq >= (utr + 1)->base; - utr++) ; - OUT1(utr->first - utr->base + lseq) - NEXT(4, 1) - continue; - } - } - else if (c >= 15) { /* U+10000 - U+10FFFF */ - lseq = 0x10000 + (((ucs4_t)c-15) * 10 + c2) - * 1260 + (ucs4_t)c3 * 10 + c4; - if (lseq <= 0x10FFFF) { - WRITEUCS4(lseq); - NEXT_IN(4) - continue; - } - } - return 4; - } - - GBK_DECODE(c, c2, **outbuf) - else TRYMAP_DEC(gb18030ext, **outbuf, c, c2); - else return 2; - - NEXT(2, 1) - } - - return 0; -} - - -/* - * HZ codec - */ - -ENCODER_INIT(hz) -{ - state->i = 0; - return 0; -} - -ENCODER_RESET(hz) -{ - if (state->i != 0) { - WRITE2('~', '}') - state->i = 0; - NEXT_OUT(2) - } - return 0; -} - -ENCODER(hz) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - if (state->i == 0) { - WRITE1((unsigned char)c) - NEXT(1, 1) - } - else { - WRITE3('~', '}', (unsigned char)c) - NEXT(1, 3) - state->i = 0; - } - continue; - } - - UCS4INVALID(c) - - TRYMAP_ENC(gbcommon, code, c); - else return 1; - - if (code & 0x8000) /* MSB set: GBK */ - return 1; - - if (state->i == 0) { - WRITE4('~', '{', code >> 8, code & 0xff) - NEXT(1, 4) - state->i = 1; - } - else { - WRITE2(code >> 8, code & 0xff) - NEXT(1, 2) - } - } - - return 0; -} - -DECODER_INIT(hz) -{ - state->i = 0; - return 0; -} - -DECODER_RESET(hz) -{ - state->i = 0; - return 0; -} - -DECODER(hz) -{ - while (inleft > 0) { - unsigned char c = IN1; - - if (c == '~') { - unsigned char c2 = IN2; - - REQUIRE_INBUF(2) - if (c2 == '~') { - WRITE1('~') - NEXT(2, 1) - continue; - } - else if (c2 == '{' && state->i == 0) - state->i = 1; /* set GB */ - else if (c2 == '}' && state->i == 1) - state->i = 0; /* set ASCII */ - else if (c2 == '\n') - ; /* line-continuation */ - else - return 2; - NEXT(2, 0); - continue; - } - - if (c & 0x80) - return 1; - - if (state->i == 0) { /* ASCII mode */ - WRITE1(c) - NEXT(1, 1) - } - else { /* GB mode */ - REQUIRE_INBUF(2) - REQUIRE_OUTBUF(1) - TRYMAP_DEC(gb2312, **outbuf, c, IN2) { - NEXT(2, 1) - } - else - return 2; - } - } - - return 0; -} - - -BEGIN_MAPPINGS_LIST - MAPPING_DECONLY(gb2312) - MAPPING_DECONLY(gbkext) - MAPPING_ENCONLY(gbcommon) - MAPPING_ENCDEC(gb18030ext) -END_MAPPINGS_LIST - -BEGIN_CODECS_LIST - CODEC_STATELESS(gb2312) - CODEC_STATELESS(gbk) - CODEC_STATELESS(gb18030) - CODEC_STATEFUL(hz) -END_CODECS_LIST - -I_AM_A_MODULE_FOR(cn) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c deleted file mode 100644 index 5302b52..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_hk.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * _codecs_hk.c: Codecs collection for encodings from Hong Kong - * - * Written by Hye-Shik Chang - */ - -#define USING_IMPORTED_MAPS - -#include "cjkcodecs.h" -#include "mappings_hk.h" - -/* - * BIG5HKSCS codec - */ - -static const encode_map *big5_encmap = NULL; -static const decode_map *big5_decmap = NULL; - -CODEC_INIT(big5hkscs) -{ - static int initialized = 0; - - if (!initialized && IMPORT_MAP(tw, big5, &big5_encmap, &big5_decmap)) - return -1; - initialized = 1; - return 0; -} - -/* - * There are four possible pair unicode -> big5hkscs maps as in HKSCS 2004: - * U+00CA U+0304 -> 8862 (U+00CA alone is mapped to 8866) - * U+00CA U+030C -> 8864 - * U+00EA U+0304 -> 88a3 (U+00EA alone is mapped to 88a7) - * U+00EA U+030C -> 88a5 - * These are handled by not mapping tables but a hand-written code. - */ -static const DBCHAR big5hkscs_pairenc_table[4] = {0x8862, 0x8864, 0x88a3, 0x88a5}; - -ENCODER(big5hkscs) -{ - while (inleft > 0) { - ucs4_t c = **inbuf; - DBCHAR code; - Py_ssize_t insize; - - if (c < 0x80) { - REQUIRE_OUTBUF(1) - **outbuf = (unsigned char)c; - NEXT(1, 1) - continue; - } - - DECODE_SURROGATE(c) - insize = GET_INSIZE(c); - - REQUIRE_OUTBUF(2) - - if (c < 0x10000) { - TRYMAP_ENC(big5hkscs_bmp, code, c) { - if (code == MULTIC) { - if (inleft >= 2 && - ((c & 0xffdf) == 0x00ca) && - (((*inbuf)[1] & 0xfff7) == 0x0304)) { - code = big5hkscs_pairenc_table[ - ((c >> 4) | - ((*inbuf)[1] >> 3)) & 3]; - insize = 2; - } - else if (inleft < 2 && - !(flags & MBENC_FLUSH)) - return MBERR_TOOFEW; - else { - if (c == 0xca) - code = 0x8866; - else /* c == 0xea */ - code = 0x88a7; - } - } - } - else TRYMAP_ENC(big5, code, c); - else return 1; - } - else if (c < 0x20000) - return insize; - else if (c < 0x30000) { - TRYMAP_ENC(big5hkscs_nonbmp, code, c & 0xffff); - else return insize; - } - else - return insize; - - OUT1(code >> 8) - OUT2(code & 0xFF) - NEXT(insize, 2) - } - - return 0; -} - -#define BH2S(c1, c2) (((c1) - 0x87) * (0xfe - 0x40 + 1) + ((c2) - 0x40)) - -DECODER(big5hkscs) -{ - while (inleft > 0) { - unsigned char c = IN1; - ucs4_t decoded; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - - if (0xc6 > c || c > 0xc8 || (c < 0xc7 && IN2 < 0xa1)) { - TRYMAP_DEC(big5, **outbuf, c, IN2) { - NEXT(2, 1) - continue; - } - } - - TRYMAP_DEC(big5hkscs, decoded, c, IN2) - { - int s = BH2S(c, IN2); - const unsigned char *hintbase; - - assert(0x87 <= c && c <= 0xfe); - assert(0x40 <= IN2 && IN2 <= 0xfe); - - if (BH2S(0x87, 0x40) <= s && s <= BH2S(0xa0, 0xfe)) { - hintbase = big5hkscs_phint_0; - s -= BH2S(0x87, 0x40); - } - else if (BH2S(0xc6,0xa1) <= s && s <= BH2S(0xc8,0xfe)){ - hintbase = big5hkscs_phint_12130; - s -= BH2S(0xc6, 0xa1); - } - else if (BH2S(0xf9,0xd6) <= s && s <= BH2S(0xfe,0xfe)){ - hintbase = big5hkscs_phint_21924; - s -= BH2S(0xf9, 0xd6); - } - else - return MBERR_INTERNAL; - - if (hintbase[s >> 3] & (1 << (s & 7))) { - WRITEUCS4(decoded | 0x20000) - NEXT_IN(2) - } - else { - OUT1(decoded) - NEXT(2, 1) - } - continue; - } - - switch ((c << 8) | IN2) { - case 0x8862: WRITE2(0x00ca, 0x0304); break; - case 0x8864: WRITE2(0x00ca, 0x030c); break; - case 0x88a3: WRITE2(0x00ea, 0x0304); break; - case 0x88a5: WRITE2(0x00ea, 0x030c); break; - default: return 2; - } - - NEXT(2, 2) /* all decoded code points are pairs, above. */ - } - - return 0; -} - - -BEGIN_MAPPINGS_LIST - MAPPING_DECONLY(big5hkscs) - MAPPING_ENCONLY(big5hkscs_bmp) - MAPPING_ENCONLY(big5hkscs_nonbmp) -END_MAPPINGS_LIST - -BEGIN_CODECS_LIST - CODEC_STATELESS_WINIT(big5hkscs) -END_CODECS_LIST - -I_AM_A_MODULE_FOR(hk) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_iso2022.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_iso2022.c deleted file mode 100644 index 14fc643..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_iso2022.c +++ /dev/null @@ -1,1131 +0,0 @@ -/* - * _codecs_iso2022.c: Codecs collection for ISO-2022 encodings. - * - * Written by Hye-Shik Chang - */ - -#define USING_IMPORTED_MAPS -#define USING_BINARY_PAIR_SEARCH -#define EXTERN_JISX0213_PAIR -#define EMULATE_JISX0213_2000_ENCODE_INVALID MAP_UNMAPPABLE -#define EMULATE_JISX0213_2000_DECODE_INVALID MAP_UNMAPPABLE - -#include "cjkcodecs.h" -#include "alg_jisx0201.h" -#include "emu_jisx0213_2000.h" -#include "mappings_jisx0213_pair.h" - -/* STATE - - state->c[0-3] - - 00000000 - ||^^^^^| - |+-----+---- G0-3 Character Set - +----------- Is G0-3 double byte? - - state->c[4] - - 00000000 - || - |+---- Locked-Shift? - +----- ESC Throughout -*/ - -#define ESC 0x1B -#define SO 0x0E -#define SI 0x0F -#define LF 0x0A - -#define MAX_ESCSEQLEN 16 - -#define CHARSET_ISO8859_1 'A' -#define CHARSET_ASCII 'B' -#define CHARSET_ISO8859_7 'F' -#define CHARSET_JISX0201_K 'I' -#define CHARSET_JISX0201_R 'J' - -#define CHARSET_GB2312 ('A'|CHARSET_DBCS) -#define CHARSET_JISX0208 ('B'|CHARSET_DBCS) -#define CHARSET_KSX1001 ('C'|CHARSET_DBCS) -#define CHARSET_JISX0212 ('D'|CHARSET_DBCS) -#define CHARSET_GB2312_8565 ('E'|CHARSET_DBCS) -#define CHARSET_CNS11643_1 ('G'|CHARSET_DBCS) -#define CHARSET_CNS11643_2 ('H'|CHARSET_DBCS) -#define CHARSET_JISX0213_2000_1 ('O'|CHARSET_DBCS) -#define CHARSET_JISX0213_2 ('P'|CHARSET_DBCS) -#define CHARSET_JISX0213_2004_1 ('Q'|CHARSET_DBCS) -#define CHARSET_JISX0208_O ('@'|CHARSET_DBCS) - -#define CHARSET_DBCS 0x80 -#define ESCMARK(mark) ((mark) & 0x7f) - -#define IS_ESCEND(c) (((c) >= 'A' && (c) <= 'Z') || (c) == '@') -#define IS_ISO2022ESC(c2) \ - ((c2) == '(' || (c2) == ')' || (c2) == '$' || \ - (c2) == '.' || (c2) == '&') - /* this is not a complete list of ISO-2022 escape sequence headers. - * but, it's enough to implement CJK instances of iso-2022. */ - -#define MAP_UNMAPPABLE 0xFFFF -#define MAP_MULTIPLE_AVAIL 0xFFFE /* for JIS X 0213 */ - -#define F_SHIFTED 0x01 -#define F_ESCTHROUGHOUT 0x02 - -#define STATE_SETG(dn, v) ((state)->c[dn]) = (v); -#define STATE_GETG(dn) ((state)->c[dn]) - -#define STATE_G0 STATE_GETG(0) -#define STATE_G1 STATE_GETG(1) -#define STATE_G2 STATE_GETG(2) -#define STATE_G3 STATE_GETG(3) -#define STATE_SETG0(v) STATE_SETG(0, v) -#define STATE_SETG1(v) STATE_SETG(1, v) -#define STATE_SETG2(v) STATE_SETG(2, v) -#define STATE_SETG3(v) STATE_SETG(3, v) - -#define STATE_SETFLAG(f) ((state)->c[4]) |= (f); -#define STATE_GETFLAG(f) ((state)->c[4] & (f)) -#define STATE_CLEARFLAG(f) ((state)->c[4]) &= ~(f); -#define STATE_CLEARFLAGS() ((state)->c[4]) = 0; - -#define ISO2022_CONFIG ((const struct iso2022_config *)config) -#define CONFIG_ISSET(flag) (ISO2022_CONFIG->flags & (flag)) -#define CONFIG_DESIGNATIONS (ISO2022_CONFIG->designations) - -/* iso2022_config.flags */ -#define NO_SHIFT 0x01 -#define USE_G2 0x02 -#define USE_JISX0208_EXT 0x04 - -/*-*- internal data structures -*-*/ - -typedef int (*iso2022_init_func)(void); -typedef ucs4_t (*iso2022_decode_func)(const unsigned char *data); -typedef DBCHAR (*iso2022_encode_func)(const ucs4_t *data, Py_ssize_t *length); - -struct iso2022_designation { - unsigned char mark; - unsigned char plane; - unsigned char width; - iso2022_init_func initializer; - iso2022_decode_func decoder; - iso2022_encode_func encoder; -}; - -struct iso2022_config { - int flags; - const struct iso2022_designation *designations; /* non-ascii desigs */ -}; - -/*-*- iso-2022 codec implementation -*-*/ - -CODEC_INIT(iso2022) -{ - const struct iso2022_designation *desig = CONFIG_DESIGNATIONS; - for (desig = CONFIG_DESIGNATIONS; desig->mark; desig++) - if (desig->initializer != NULL && desig->initializer() != 0) - return -1; - return 0; -} - -ENCODER_INIT(iso2022) -{ - STATE_CLEARFLAGS() - STATE_SETG0(CHARSET_ASCII) - STATE_SETG1(CHARSET_ASCII) - return 0; -} - -ENCODER_RESET(iso2022) -{ - if (STATE_GETFLAG(F_SHIFTED)) { - WRITE1(SI) - NEXT_OUT(1) - STATE_CLEARFLAG(F_SHIFTED) - } - if (STATE_G0 != CHARSET_ASCII) { - WRITE3(ESC, '(', 'B') - NEXT_OUT(3) - STATE_SETG0(CHARSET_ASCII) - } - return 0; -} - -ENCODER(iso2022) -{ - while (inleft > 0) { - const struct iso2022_designation *dsg; - DBCHAR encoded; - ucs4_t c = **inbuf; - Py_ssize_t insize; - - if (c < 0x80) { - if (STATE_G0 != CHARSET_ASCII) { - WRITE3(ESC, '(', 'B') - STATE_SETG0(CHARSET_ASCII) - NEXT_OUT(3) - } - if (STATE_GETFLAG(F_SHIFTED)) { - WRITE1(SI) - STATE_CLEARFLAG(F_SHIFTED) - NEXT_OUT(1) - } - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - - DECODE_SURROGATE(c) - insize = GET_INSIZE(c); - - encoded = MAP_UNMAPPABLE; - for (dsg = CONFIG_DESIGNATIONS; dsg->mark; dsg++) { - Py_ssize_t length = 1; - encoded = dsg->encoder(&c, &length); - if (encoded == MAP_MULTIPLE_AVAIL) { - /* this implementation won't work for pair - * of non-bmp characters. */ - if (inleft < 2) { - if (!(flags & MBENC_FLUSH)) - return MBERR_TOOFEW; - length = -1; - } - else - length = 2; -#if Py_UNICODE_SIZE == 2 - if (length == 2) { - ucs4_t u4in[2]; - u4in[0] = (ucs4_t)IN1; - u4in[1] = (ucs4_t)IN2; - encoded = dsg->encoder(u4in, &length); - } else - encoded = dsg->encoder(&c, &length); -#else - encoded = dsg->encoder(&c, &length); -#endif - if (encoded != MAP_UNMAPPABLE) { - insize = length; - break; - } - } - else if (encoded != MAP_UNMAPPABLE) - break; - } - - if (!dsg->mark) - return 1; - assert(dsg->width == 1 || dsg->width == 2); - - switch (dsg->plane) { - case 0: /* G0 */ - if (STATE_GETFLAG(F_SHIFTED)) { - WRITE1(SI) - STATE_CLEARFLAG(F_SHIFTED) - NEXT_OUT(1) - } - if (STATE_G0 != dsg->mark) { - if (dsg->width == 1) { - WRITE3(ESC, '(', ESCMARK(dsg->mark)) - STATE_SETG0(dsg->mark) - NEXT_OUT(3) - } - else if (dsg->mark == CHARSET_JISX0208) { - WRITE3(ESC, '$', ESCMARK(dsg->mark)) - STATE_SETG0(dsg->mark) - NEXT_OUT(3) - } - else { - WRITE4(ESC, '$', '(', - ESCMARK(dsg->mark)) - STATE_SETG0(dsg->mark) - NEXT_OUT(4) - } - } - break; - case 1: /* G1 */ - if (STATE_G1 != dsg->mark) { - if (dsg->width == 1) { - WRITE3(ESC, ')', ESCMARK(dsg->mark)) - STATE_SETG1(dsg->mark) - NEXT_OUT(3) - } - else { - WRITE4(ESC, '$', ')', - ESCMARK(dsg->mark)) - STATE_SETG1(dsg->mark) - NEXT_OUT(4) - } - } - if (!STATE_GETFLAG(F_SHIFTED)) { - WRITE1(SO) - STATE_SETFLAG(F_SHIFTED) - NEXT_OUT(1) - } - break; - default: /* G2 and G3 is not supported: no encoding in - * CJKCodecs are using them yet */ - return MBERR_INTERNAL; - } - - if (dsg->width == 1) { - WRITE1((unsigned char)encoded) - NEXT_OUT(1) - } - else { - WRITE2(encoded >> 8, encoded & 0xff) - NEXT_OUT(2) - } - NEXT_IN(insize) - } - - return 0; -} - -DECODER_INIT(iso2022) -{ - STATE_CLEARFLAGS() - STATE_SETG0(CHARSET_ASCII) - STATE_SETG1(CHARSET_ASCII) - STATE_SETG2(CHARSET_ASCII) - return 0; -} - -DECODER_RESET(iso2022) -{ - STATE_SETG0(CHARSET_ASCII) - STATE_CLEARFLAG(F_SHIFTED) - return 0; -} - -static Py_ssize_t -iso2022processesc(const void *config, MultibyteCodec_State *state, - const unsigned char **inbuf, Py_ssize_t *inleft) -{ - unsigned char charset, designation; - Py_ssize_t i, esclen; - - for (i = 1;i < MAX_ESCSEQLEN;i++) { - if (i >= *inleft) - return MBERR_TOOFEW; - if (IS_ESCEND((*inbuf)[i])) { - esclen = i + 1; - break; - } - else if (CONFIG_ISSET(USE_JISX0208_EXT) && i+1 < *inleft && - (*inbuf)[i] == '&' && (*inbuf)[i+1] == '@') - i += 2; - } - - if (i >= MAX_ESCSEQLEN) - return 1; /* unterminated escape sequence */ - - switch (esclen) { - case 3: - if (IN2 == '$') { - charset = IN3 | CHARSET_DBCS; - designation = 0; - } - else { - charset = IN3; - if (IN2 == '(') designation = 0; - else if (IN2 == ')') designation = 1; - else if (CONFIG_ISSET(USE_G2) && IN2 == '.') - designation = 2; - else return 3; - } - break; - case 4: - if (IN2 != '$') - return 4; - - charset = IN4 | CHARSET_DBCS; - if (IN3 == '(') designation = 0; - else if (IN3 == ')') designation = 1; - else return 4; - break; - case 6: /* designation with prefix */ - if (CONFIG_ISSET(USE_JISX0208_EXT) && - (*inbuf)[3] == ESC && (*inbuf)[4] == '$' && - (*inbuf)[5] == 'B') { - charset = 'B' | CHARSET_DBCS; - designation = 0; - } - else - return 6; - break; - default: - return esclen; - } - - /* raise error when the charset is not designated for this encoding */ - if (charset != CHARSET_ASCII) { - const struct iso2022_designation *dsg; - - for (dsg = CONFIG_DESIGNATIONS; dsg->mark; dsg++) - if (dsg->mark == charset) - break; - if (!dsg->mark) - return esclen; - } - - STATE_SETG(designation, charset) - *inleft -= esclen; - (*inbuf) += esclen; - return 0; -} - -#define ISO8859_7_DECODE(c, assi) \ - if ((c) < 0xa0) (assi) = (c); \ - else if ((c) < 0xc0 && (0x288f3bc9L & (1L << ((c)-0xa0)))) \ - (assi) = (c); \ - else if ((c) >= 0xb4 && (c) <= 0xfe && ((c) >= 0xd4 || \ - (0xbffffd77L & (1L << ((c)-0xb4))))) \ - (assi) = 0x02d0 + (c); \ - else if ((c) == 0xa1) (assi) = 0x2018; \ - else if ((c) == 0xa2) (assi) = 0x2019; \ - else if ((c) == 0xaf) (assi) = 0x2015; - -static Py_ssize_t -iso2022processg2(const void *config, MultibyteCodec_State *state, - const unsigned char **inbuf, Py_ssize_t *inleft, - Py_UNICODE **outbuf, Py_ssize_t *outleft) -{ - /* not written to use encoder, decoder functions because only few - * encodings use G2 designations in CJKCodecs */ - if (STATE_G2 == CHARSET_ISO8859_1) { - if (IN3 < 0x80) - OUT1(IN3 + 0x80) - else - return 3; - } - else if (STATE_G2 == CHARSET_ISO8859_7) { - ISO8859_7_DECODE(IN3 ^ 0x80, **outbuf) - else return 3; - } - else if (STATE_G2 == CHARSET_ASCII) { - if (IN3 & 0x80) return 3; - else **outbuf = IN3; - } - else - return MBERR_INTERNAL; - - (*inbuf) += 3; - *inleft -= 3; - (*outbuf) += 1; - *outleft -= 1; - return 0; -} - -DECODER(iso2022) -{ - const struct iso2022_designation *dsgcache = NULL; - - while (inleft > 0) { - unsigned char c = IN1; - Py_ssize_t err; - - if (STATE_GETFLAG(F_ESCTHROUGHOUT)) { - /* ESC throughout mode: - * for non-iso2022 escape sequences */ - WRITE1(c) /* assume as ISO-8859-1 */ - NEXT(1, 1) - if (IS_ESCEND(c)) { - STATE_CLEARFLAG(F_ESCTHROUGHOUT) - } - continue; - } - - switch (c) { - case ESC: - REQUIRE_INBUF(2) - if (IS_ISO2022ESC(IN2)) { - err = iso2022processesc(config, state, - inbuf, &inleft); - if (err != 0) - return err; - } - else if (CONFIG_ISSET(USE_G2) && IN2 == 'N') {/* SS2 */ - REQUIRE_INBUF(3) - err = iso2022processg2(config, state, - inbuf, &inleft, outbuf, &outleft); - if (err != 0) - return err; - } - else { - WRITE1(ESC) - STATE_SETFLAG(F_ESCTHROUGHOUT) - NEXT(1, 1) - } - break; - case SI: - if (CONFIG_ISSET(NO_SHIFT)) - goto bypass; - STATE_CLEARFLAG(F_SHIFTED) - NEXT_IN(1) - break; - case SO: - if (CONFIG_ISSET(NO_SHIFT)) - goto bypass; - STATE_SETFLAG(F_SHIFTED) - NEXT_IN(1) - break; - case LF: - STATE_CLEARFLAG(F_SHIFTED) - WRITE1(LF) - NEXT(1, 1) - break; - default: - if (c < 0x20) /* C0 */ - goto bypass; - else if (c >= 0x80) - return 1; - else { - const struct iso2022_designation *dsg; - unsigned char charset; - ucs4_t decoded; - - if (STATE_GETFLAG(F_SHIFTED)) - charset = STATE_G1; - else - charset = STATE_G0; - - if (charset == CHARSET_ASCII) { -bypass: WRITE1(c) - NEXT(1, 1) - break; - } - - if (dsgcache != NULL && - dsgcache->mark == charset) - dsg = dsgcache; - else { - for (dsg = CONFIG_DESIGNATIONS; - dsg->mark != charset -#ifdef Py_DEBUG - && dsg->mark != '\0' -#endif - ;dsg++) - /* noop */; - assert(dsg->mark != '\0'); - dsgcache = dsg; - } - - REQUIRE_INBUF(dsg->width) - decoded = dsg->decoder(*inbuf); - if (decoded == MAP_UNMAPPABLE) - return dsg->width; - - if (decoded < 0x10000) { - WRITE1(decoded) - NEXT_OUT(1) - } - else if (decoded < 0x30000) { - WRITEUCS4(decoded) - } - else { /* JIS X 0213 pairs */ - WRITE2(decoded >> 16, decoded & 0xffff) - NEXT_OUT(2) - } - NEXT_IN(dsg->width) - } - break; - } - } - return 0; -} - -/*-*- mapping table holders -*-*/ - -#define ENCMAP(enc) static const encode_map *enc##_encmap = NULL; -#define DECMAP(enc) static const decode_map *enc##_decmap = NULL; - -/* kr */ -ENCMAP(cp949) -DECMAP(ksx1001) - -/* jp */ -ENCMAP(jisxcommon) -DECMAP(jisx0208) -DECMAP(jisx0212) -ENCMAP(jisx0213_bmp) -DECMAP(jisx0213_1_bmp) -DECMAP(jisx0213_2_bmp) -ENCMAP(jisx0213_emp) -DECMAP(jisx0213_1_emp) -DECMAP(jisx0213_2_emp) - -/* cn */ -ENCMAP(gbcommon) -DECMAP(gb2312) - -/* tw */ - -/*-*- mapping access functions -*-*/ - -static int -ksx1001_init(void) -{ - static int initialized = 0; - - if (!initialized && ( - IMPORT_MAP(kr, cp949, &cp949_encmap, NULL) || - IMPORT_MAP(kr, ksx1001, NULL, &ksx1001_decmap))) - return -1; - initialized = 1; - return 0; -} - -static ucs4_t -ksx1001_decoder(const unsigned char *data) -{ - ucs4_t u; - TRYMAP_DEC(ksx1001, u, data[0], data[1]) - return u; - else - return MAP_UNMAPPABLE; -} - -static DBCHAR -ksx1001_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - assert(*length == 1); - if (*data < 0x10000) { - TRYMAP_ENC(cp949, coded, *data) - if (!(coded & 0x8000)) - return coded; - } - return MAP_UNMAPPABLE; -} - -static int -jisx0208_init(void) -{ - static int initialized = 0; - - if (!initialized && ( - IMPORT_MAP(jp, jisxcommon, &jisxcommon_encmap, NULL) || - IMPORT_MAP(jp, jisx0208, NULL, &jisx0208_decmap))) - return -1; - initialized = 1; - return 0; -} - -static ucs4_t -jisx0208_decoder(const unsigned char *data) -{ - ucs4_t u; - if (data[0] == 0x21 && data[1] == 0x40) /* F/W REVERSE SOLIDUS */ - return 0xff3c; - else TRYMAP_DEC(jisx0208, u, data[0], data[1]) - return u; - else - return MAP_UNMAPPABLE; -} - -static DBCHAR -jisx0208_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - assert(*length == 1); - if (*data < 0x10000) { - if (*data == 0xff3c) /* F/W REVERSE SOLIDUS */ - return 0x2140; - else TRYMAP_ENC(jisxcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; - } - } - return MAP_UNMAPPABLE; -} - -static int -jisx0212_init(void) -{ - static int initialized = 0; - - if (!initialized && ( - IMPORT_MAP(jp, jisxcommon, &jisxcommon_encmap, NULL) || - IMPORT_MAP(jp, jisx0212, NULL, &jisx0212_decmap))) - return -1; - initialized = 1; - return 0; -} - -static ucs4_t -jisx0212_decoder(const unsigned char *data) -{ - ucs4_t u; - TRYMAP_DEC(jisx0212, u, data[0], data[1]) - return u; - else - return MAP_UNMAPPABLE; -} - -static DBCHAR -jisx0212_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - assert(*length == 1); - if (*data < 0x10000) { - TRYMAP_ENC(jisxcommon, coded, *data) { - if (coded & 0x8000) - return coded & 0x7fff; - } - } - return MAP_UNMAPPABLE; -} - -static int -jisx0213_init(void) -{ - static int initialized = 0; - - if (!initialized && ( - jisx0208_init() || - IMPORT_MAP(jp, jisx0213_bmp, - &jisx0213_bmp_encmap, NULL) || - IMPORT_MAP(jp, jisx0213_1_bmp, - NULL, &jisx0213_1_bmp_decmap) || - IMPORT_MAP(jp, jisx0213_2_bmp, - NULL, &jisx0213_2_bmp_decmap) || - IMPORT_MAP(jp, jisx0213_emp, - &jisx0213_emp_encmap, NULL) || - IMPORT_MAP(jp, jisx0213_1_emp, - NULL, &jisx0213_1_emp_decmap) || - IMPORT_MAP(jp, jisx0213_2_emp, - NULL, &jisx0213_2_emp_decmap) || - IMPORT_MAP(jp, jisx0213_pair, &jisx0213_pair_encmap, - &jisx0213_pair_decmap))) - return -1; - initialized = 1; - return 0; -} - -#define config ((void *)2000) -static ucs4_t -jisx0213_2000_1_decoder(const unsigned char *data) -{ - ucs4_t u; - EMULATE_JISX0213_2000_DECODE_PLANE1(u, data[0], data[1]) - else if (data[0] == 0x21 && data[1] == 0x40) /* F/W REVERSE SOLIDUS */ - return 0xff3c; - else TRYMAP_DEC(jisx0208, u, data[0], data[1]); - else TRYMAP_DEC(jisx0213_1_bmp, u, data[0], data[1]); - else TRYMAP_DEC(jisx0213_1_emp, u, data[0], data[1]) - u |= 0x20000; - else TRYMAP_DEC(jisx0213_pair, u, data[0], data[1]); - else - return MAP_UNMAPPABLE; - return u; -} - -static ucs4_t -jisx0213_2000_2_decoder(const unsigned char *data) -{ - ucs4_t u; - EMULATE_JISX0213_2000_DECODE_PLANE2(u, data[0], data[1]) - TRYMAP_DEC(jisx0213_2_bmp, u, data[0], data[1]); - else TRYMAP_DEC(jisx0213_2_emp, u, data[0], data[1]) - u |= 0x20000; - else - return MAP_UNMAPPABLE; - return u; -} -#undef config - -static ucs4_t -jisx0213_2004_1_decoder(const unsigned char *data) -{ - ucs4_t u; - if (data[0] == 0x21 && data[1] == 0x40) /* F/W REVERSE SOLIDUS */ - return 0xff3c; - else TRYMAP_DEC(jisx0208, u, data[0], data[1]); - else TRYMAP_DEC(jisx0213_1_bmp, u, data[0], data[1]); - else TRYMAP_DEC(jisx0213_1_emp, u, data[0], data[1]) - u |= 0x20000; - else TRYMAP_DEC(jisx0213_pair, u, data[0], data[1]); - else - return MAP_UNMAPPABLE; - return u; -} - -static ucs4_t -jisx0213_2004_2_decoder(const unsigned char *data) -{ - ucs4_t u; - TRYMAP_DEC(jisx0213_2_bmp, u, data[0], data[1]); - else TRYMAP_DEC(jisx0213_2_emp, u, data[0], data[1]) - u |= 0x20000; - else - return MAP_UNMAPPABLE; - return u; -} - -static DBCHAR -jisx0213_encoder(const ucs4_t *data, Py_ssize_t *length, void *config) -{ - DBCHAR coded; - - switch (*length) { - case 1: /* first character */ - if (*data >= 0x10000) { - if ((*data) >> 16 == 0x20000 >> 16) { - EMULATE_JISX0213_2000_ENCODE_EMP(coded, *data) - else TRYMAP_ENC(jisx0213_emp, coded, - (*data) & 0xffff) - return coded; - } - return MAP_UNMAPPABLE; - } - - EMULATE_JISX0213_2000_ENCODE_BMP(coded, *data) - else TRYMAP_ENC(jisx0213_bmp, coded, *data) { - if (coded == MULTIC) - return MAP_MULTIPLE_AVAIL; - } - else TRYMAP_ENC(jisxcommon, coded, *data) { - if (coded & 0x8000) - return MAP_UNMAPPABLE; - } - else - return MAP_UNMAPPABLE; - return coded; - case 2: /* second character of unicode pair */ - coded = find_pairencmap((ucs2_t)data[0], (ucs2_t)data[1], - jisx0213_pair_encmap, JISX0213_ENCPAIRS); - if (coded == DBCINV) { - *length = 1; - coded = find_pairencmap((ucs2_t)data[0], 0, - jisx0213_pair_encmap, JISX0213_ENCPAIRS); - if (coded == DBCINV) - return MAP_UNMAPPABLE; - } - else - return coded; - case -1: /* flush unterminated */ - *length = 1; - coded = find_pairencmap((ucs2_t)data[0], 0, - jisx0213_pair_encmap, JISX0213_ENCPAIRS); - if (coded == DBCINV) - return MAP_UNMAPPABLE; - else - return coded; - default: - return MAP_UNMAPPABLE; - } -} - -static DBCHAR -jisx0213_2000_1_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded = jisx0213_encoder(data, length, (void *)2000); - if (coded == MAP_UNMAPPABLE || coded == MAP_MULTIPLE_AVAIL) - return coded; - else if (coded & 0x8000) - return MAP_UNMAPPABLE; - else - return coded; -} - -static DBCHAR -jisx0213_2000_1_encoder_paironly(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - Py_ssize_t ilength = *length; - - coded = jisx0213_encoder(data, length, (void *)2000); - switch (ilength) { - case 1: - if (coded == MAP_MULTIPLE_AVAIL) - return MAP_MULTIPLE_AVAIL; - else - return MAP_UNMAPPABLE; - case 2: - if (*length != 2) - return MAP_UNMAPPABLE; - else - return coded; - default: - return MAP_UNMAPPABLE; - } -} - -static DBCHAR -jisx0213_2000_2_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded = jisx0213_encoder(data, length, (void *)2000); - if (coded == MAP_UNMAPPABLE || coded == MAP_MULTIPLE_AVAIL) - return coded; - else if (coded & 0x8000) - return coded & 0x7fff; - else - return MAP_UNMAPPABLE; -} - -static DBCHAR -jisx0213_2004_1_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded = jisx0213_encoder(data, length, NULL); - if (coded == MAP_UNMAPPABLE || coded == MAP_MULTIPLE_AVAIL) - return coded; - else if (coded & 0x8000) - return MAP_UNMAPPABLE; - else - return coded; -} - -static DBCHAR -jisx0213_2004_1_encoder_paironly(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - Py_ssize_t ilength = *length; - - coded = jisx0213_encoder(data, length, NULL); - switch (ilength) { - case 1: - if (coded == MAP_MULTIPLE_AVAIL) - return MAP_MULTIPLE_AVAIL; - else - return MAP_UNMAPPABLE; - case 2: - if (*length != 2) - return MAP_UNMAPPABLE; - else - return coded; - default: - return MAP_UNMAPPABLE; - } -} - -static DBCHAR -jisx0213_2004_2_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded = jisx0213_encoder(data, length, NULL); - if (coded == MAP_UNMAPPABLE || coded == MAP_MULTIPLE_AVAIL) - return coded; - else if (coded & 0x8000) - return coded & 0x7fff; - else - return MAP_UNMAPPABLE; -} - -static ucs4_t -jisx0201_r_decoder(const unsigned char *data) -{ - ucs4_t u; - JISX0201_R_DECODE(*data, u) - else return MAP_UNMAPPABLE; - return u; -} - -static DBCHAR -jisx0201_r_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - JISX0201_R_ENCODE(*data, coded) - else return MAP_UNMAPPABLE; - return coded; -} - -static ucs4_t -jisx0201_k_decoder(const unsigned char *data) -{ - ucs4_t u; - JISX0201_K_DECODE(*data ^ 0x80, u) - else return MAP_UNMAPPABLE; - return u; -} - -static DBCHAR -jisx0201_k_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - JISX0201_K_ENCODE(*data, coded) - else return MAP_UNMAPPABLE; - return coded - 0x80; -} - -static int -gb2312_init(void) -{ - static int initialized = 0; - - if (!initialized && ( - IMPORT_MAP(cn, gbcommon, &gbcommon_encmap, NULL) || - IMPORT_MAP(cn, gb2312, NULL, &gb2312_decmap))) - return -1; - initialized = 1; - return 0; -} - -static ucs4_t -gb2312_decoder(const unsigned char *data) -{ - ucs4_t u; - TRYMAP_DEC(gb2312, u, data[0], data[1]) - return u; - else - return MAP_UNMAPPABLE; -} - -static DBCHAR -gb2312_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - DBCHAR coded; - assert(*length == 1); - if (*data < 0x10000) { - TRYMAP_ENC(gbcommon, coded, *data) { - if (!(coded & 0x8000)) - return coded; - } - } - return MAP_UNMAPPABLE; -} - - -static ucs4_t -dummy_decoder(const unsigned char *data) -{ - return MAP_UNMAPPABLE; -} - -static DBCHAR -dummy_encoder(const ucs4_t *data, Py_ssize_t *length) -{ - return MAP_UNMAPPABLE; -} - -/*-*- registry tables -*-*/ - -#define REGISTRY_KSX1001_G0 { CHARSET_KSX1001, 0, 2, \ - ksx1001_init, \ - ksx1001_decoder, ksx1001_encoder } -#define REGISTRY_KSX1001_G1 { CHARSET_KSX1001, 1, 2, \ - ksx1001_init, \ - ksx1001_decoder, ksx1001_encoder } -#define REGISTRY_JISX0201_R { CHARSET_JISX0201_R, 0, 1, \ - NULL, \ - jisx0201_r_decoder, jisx0201_r_encoder } -#define REGISTRY_JISX0201_K { CHARSET_JISX0201_K, 0, 1, \ - NULL, \ - jisx0201_k_decoder, jisx0201_k_encoder } -#define REGISTRY_JISX0208 { CHARSET_JISX0208, 0, 2, \ - jisx0208_init, \ - jisx0208_decoder, jisx0208_encoder } -#define REGISTRY_JISX0208_O { CHARSET_JISX0208_O, 0, 2, \ - jisx0208_init, \ - jisx0208_decoder, jisx0208_encoder } -#define REGISTRY_JISX0212 { CHARSET_JISX0212, 0, 2, \ - jisx0212_init, \ - jisx0212_decoder, jisx0212_encoder } -#define REGISTRY_JISX0213_2000_1 { CHARSET_JISX0213_2000_1, 0, 2, \ - jisx0213_init, \ - jisx0213_2000_1_decoder, \ - jisx0213_2000_1_encoder } -#define REGISTRY_JISX0213_2000_1_PAIRONLY { CHARSET_JISX0213_2000_1, 0, 2, \ - jisx0213_init, \ - jisx0213_2000_1_decoder, \ - jisx0213_2000_1_encoder_paironly } -#define REGISTRY_JISX0213_2000_2 { CHARSET_JISX0213_2, 0, 2, \ - jisx0213_init, \ - jisx0213_2000_2_decoder, \ - jisx0213_2000_2_encoder } -#define REGISTRY_JISX0213_2004_1 { CHARSET_JISX0213_2004_1, 0, 2, \ - jisx0213_init, \ - jisx0213_2004_1_decoder, \ - jisx0213_2004_1_encoder } -#define REGISTRY_JISX0213_2004_1_PAIRONLY { CHARSET_JISX0213_2004_1, 0, 2, \ - jisx0213_init, \ - jisx0213_2004_1_decoder, \ - jisx0213_2004_1_encoder_paironly } -#define REGISTRY_JISX0213_2004_2 { CHARSET_JISX0213_2, 0, 2, \ - jisx0213_init, \ - jisx0213_2004_2_decoder, \ - jisx0213_2004_2_encoder } -#define REGISTRY_GB2312 { CHARSET_GB2312, 0, 2, \ - gb2312_init, \ - gb2312_decoder, gb2312_encoder } -#define REGISTRY_CNS11643_1 { CHARSET_CNS11643_1, 1, 2, \ - cns11643_init, \ - cns11643_1_decoder, cns11643_1_encoder } -#define REGISTRY_CNS11643_2 { CHARSET_CNS11643_2, 2, 2, \ - cns11643_init, \ - cns11643_2_decoder, cns11643_2_encoder } -#define REGISTRY_ISO8859_1 { CHARSET_ISO8859_1, 2, 1, \ - NULL, dummy_decoder, dummy_encoder } -#define REGISTRY_ISO8859_7 { CHARSET_ISO8859_7, 2, 1, \ - NULL, dummy_decoder, dummy_encoder } -#define REGISTRY_SENTINEL { 0, } -#define CONFIGDEF(var, attrs) \ - static const struct iso2022_config iso2022_##var##_config = { \ - attrs, iso2022_##var##_designations \ - }; - -static const struct iso2022_designation iso2022_kr_designations[] = { - REGISTRY_KSX1001_G1, REGISTRY_SENTINEL -}; -CONFIGDEF(kr, 0) - -static const struct iso2022_designation iso2022_jp_designations[] = { - REGISTRY_JISX0208, REGISTRY_JISX0201_R, REGISTRY_JISX0208_O, - REGISTRY_SENTINEL -}; -CONFIGDEF(jp, NO_SHIFT | USE_JISX0208_EXT) - -static const struct iso2022_designation iso2022_jp_1_designations[] = { - REGISTRY_JISX0208, REGISTRY_JISX0212, REGISTRY_JISX0201_R, - REGISTRY_JISX0208_O, REGISTRY_SENTINEL -}; -CONFIGDEF(jp_1, NO_SHIFT | USE_JISX0208_EXT) - -static const struct iso2022_designation iso2022_jp_2_designations[] = { - REGISTRY_JISX0208, REGISTRY_JISX0212, REGISTRY_KSX1001_G0, - REGISTRY_GB2312, REGISTRY_JISX0201_R, REGISTRY_JISX0208_O, - REGISTRY_ISO8859_1, REGISTRY_ISO8859_7, REGISTRY_SENTINEL -}; -CONFIGDEF(jp_2, NO_SHIFT | USE_G2 | USE_JISX0208_EXT) - -static const struct iso2022_designation iso2022_jp_2004_designations[] = { - REGISTRY_JISX0213_2004_1_PAIRONLY, REGISTRY_JISX0208, - REGISTRY_JISX0213_2004_1, REGISTRY_JISX0213_2004_2, REGISTRY_SENTINEL -}; -CONFIGDEF(jp_2004, NO_SHIFT | USE_JISX0208_EXT) - -static const struct iso2022_designation iso2022_jp_3_designations[] = { - REGISTRY_JISX0213_2000_1_PAIRONLY, REGISTRY_JISX0208, - REGISTRY_JISX0213_2000_1, REGISTRY_JISX0213_2000_2, REGISTRY_SENTINEL -}; -CONFIGDEF(jp_3, NO_SHIFT | USE_JISX0208_EXT) - -static const struct iso2022_designation iso2022_jp_ext_designations[] = { - REGISTRY_JISX0208, REGISTRY_JISX0212, REGISTRY_JISX0201_R, - REGISTRY_JISX0201_K, REGISTRY_JISX0208_O, REGISTRY_SENTINEL -}; -CONFIGDEF(jp_ext, NO_SHIFT | USE_JISX0208_EXT) - - -BEGIN_MAPPINGS_LIST - /* no mapping table here */ -END_MAPPINGS_LIST - -#define ISO2022_CODEC(variation) { \ - "iso2022_" #variation, \ - &iso2022_##variation##_config, \ - iso2022_codec_init, \ - _STATEFUL_METHODS(iso2022) \ -}, - -BEGIN_CODECS_LIST - ISO2022_CODEC(kr) - ISO2022_CODEC(jp) - ISO2022_CODEC(jp_1) - ISO2022_CODEC(jp_2) - ISO2022_CODEC(jp_2004) - ISO2022_CODEC(jp_3) - ISO2022_CODEC(jp_ext) -END_CODECS_LIST - -I_AM_A_MODULE_FOR(iso2022) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_jp.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_jp.c deleted file mode 100644 index d326618..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_jp.c +++ /dev/null @@ -1,731 +0,0 @@ -/* - * _codecs_jp.c: Codecs collection for Japanese encodings - * - * Written by Hye-Shik Chang - */ - -#define USING_BINARY_PAIR_SEARCH -#define EMPBASE 0x20000 - -#include "cjkcodecs.h" -#include "mappings_jp.h" -#include "mappings_jisx0213_pair.h" -#include "alg_jisx0201.h" -#include "emu_jisx0213_2000.h" - -/* - * CP932 codec - */ - -ENCODER(cp932) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - unsigned char c1, c2; - - if (c <= 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - else if (c >= 0xff61 && c <= 0xff9f) { - WRITE1(c - 0xfec0) - NEXT(1, 1) - continue; - } - else if (c >= 0xf8f0 && c <= 0xf8f3) { - /* Windows compatibility */ - REQUIRE_OUTBUF(1) - if (c == 0xf8f0) - OUT1(0xa0) - else - OUT1(c - 0xfef1 + 0xfd) - NEXT(1, 1) - continue; - } - - UCS4INVALID(c) - REQUIRE_OUTBUF(2) - - TRYMAP_ENC(cp932ext, code, c) { - OUT1(code >> 8) - OUT2(code & 0xff) - } - else TRYMAP_ENC(jisxcommon, code, c) { - if (code & 0x8000) /* MSB set: JIS X 0212 */ - return 1; - - /* JIS X 0208 */ - c1 = code >> 8; - c2 = code & 0xff; - c2 = (((c1 - 0x21) & 1) ? 0x5e : 0) + (c2 - 0x21); - c1 = (c1 - 0x21) >> 1; - OUT1(c1 < 0x1f ? c1 + 0x81 : c1 + 0xc1) - OUT2(c2 < 0x3f ? c2 + 0x40 : c2 + 0x41) - } - else if (c >= 0xe000 && c < 0xe758) { - /* User-defined area */ - c1 = (Py_UNICODE)(c - 0xe000) / 188; - c2 = (Py_UNICODE)(c - 0xe000) % 188; - OUT1(c1 + 0xf0) - OUT2(c2 < 0x3f ? c2 + 0x40 : c2 + 0x41) - } - else - return 1; - - NEXT(1, 2) - } - - return 0; -} - -DECODER(cp932) -{ - while (inleft > 0) { - unsigned char c = IN1, c2; - - REQUIRE_OUTBUF(1) - if (c <= 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - else if (c >= 0xa0 && c <= 0xdf) { - if (c == 0xa0) - OUT1(0xf8f0) /* half-width katakana */ - else - OUT1(0xfec0 + c) - NEXT(1, 1) - continue; - } - else if (c >= 0xfd/* && c <= 0xff*/) { - /* Windows compatibility */ - OUT1(0xf8f1 - 0xfd + c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - c2 = IN2; - - TRYMAP_DEC(cp932ext, **outbuf, c, c2); - else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)){ - if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; - - c = (c < 0xe0 ? c - 0x81 : c - 0xc1); - c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); - c = (2 * c + (c2 < 0x5e ? 0 : 1) + 0x21); - c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; - - TRYMAP_DEC(jisx0208, **outbuf, c, c2); - else return 2; - } - else if (c >= 0xf0 && c <= 0xf9) { - if ((c2 >= 0x40 && c2 <= 0x7e) || - (c2 >= 0x80 && c2 <= 0xfc)) - OUT1(0xe000 + 188 * (c - 0xf0) + - (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41)) - else - return 2; - } - else - return 2; - - NEXT(2, 1) - } - - return 0; -} - - -/* - * EUC-JIS-2004 codec - */ - -ENCODER(euc_jis_2004) -{ - while (inleft > 0) { - ucs4_t c = IN1; - DBCHAR code; - Py_ssize_t insize; - - if (c < 0x80) { - WRITE1(c) - NEXT(1, 1) - continue; - } - - DECODE_SURROGATE(c) - insize = GET_INSIZE(c); - - if (c <= 0xFFFF) { - EMULATE_JISX0213_2000_ENCODE_BMP(code, c) - else TRYMAP_ENC(jisx0213_bmp, code, c) { - if (code == MULTIC) { - if (inleft < 2) { - if (flags & MBENC_FLUSH) { - code = find_pairencmap( - (ucs2_t)c, 0, - jisx0213_pair_encmap, - JISX0213_ENCPAIRS); - if (code == DBCINV) - return 1; - } - else - return MBERR_TOOFEW; - } - else { - code = find_pairencmap( - (ucs2_t)c, (*inbuf)[1], - jisx0213_pair_encmap, - JISX0213_ENCPAIRS); - if (code == DBCINV) { - code = find_pairencmap( - (ucs2_t)c, 0, - jisx0213_pair_encmap, - JISX0213_ENCPAIRS); - if (code == DBCINV) - return 1; - } else - insize = 2; - } - } - } - else TRYMAP_ENC(jisxcommon, code, c); - else if (c >= 0xff61 && c <= 0xff9f) { - /* JIS X 0201 half-width katakana */ - WRITE2(0x8e, c - 0xfec0) - NEXT(1, 2) - continue; - } - else if (c == 0xff3c) - /* F/W REVERSE SOLIDUS (see NOTES) */ - code = 0x2140; - else if (c == 0xff5e) - /* F/W TILDE (see NOTES) */ - code = 0x2232; - else - return 1; - } - else if (c >> 16 == EMPBASE >> 16) { - EMULATE_JISX0213_2000_ENCODE_EMP(code, c) - else TRYMAP_ENC(jisx0213_emp, code, c & 0xffff); - else return insize; - } - else - return insize; - - if (code & 0x8000) { - /* Codeset 2 */ - WRITE3(0x8f, code >> 8, (code & 0xFF) | 0x80) - NEXT(insize, 3) - } else { - /* Codeset 1 */ - WRITE2((code >> 8) | 0x80, (code & 0xFF) | 0x80) - NEXT(insize, 2) - } - } - - return 0; -} - -DECODER(euc_jis_2004) -{ - while (inleft > 0) { - unsigned char c = IN1; - ucs4_t code; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - if (c == 0x8e) { - /* JIS X 0201 half-width katakana */ - unsigned char c2; - - REQUIRE_INBUF(2) - c2 = IN2; - if (c2 >= 0xa1 && c2 <= 0xdf) { - OUT1(0xfec0 + c2) - NEXT(2, 1) - } - else - return 2; - } - else if (c == 0x8f) { - unsigned char c2, c3; - - REQUIRE_INBUF(3) - c2 = IN2 ^ 0x80; - c3 = IN3 ^ 0x80; - - /* JIS X 0213 Plane 2 or JIS X 0212 (see NOTES) */ - EMULATE_JISX0213_2000_DECODE_PLANE2(**outbuf, c2, c3) - else TRYMAP_DEC(jisx0213_2_bmp, **outbuf, c2, c3) ; - else TRYMAP_DEC(jisx0213_2_emp, code, c2, c3) { - WRITEUCS4(EMPBASE | code) - NEXT_IN(3) - continue; - } - else TRYMAP_DEC(jisx0212, **outbuf, c2, c3) ; - else return 3; - NEXT(3, 1) - } - else { - unsigned char c2; - - REQUIRE_INBUF(2) - c ^= 0x80; - c2 = IN2 ^ 0x80; - - /* JIS X 0213 Plane 1 */ - EMULATE_JISX0213_2000_DECODE_PLANE1(**outbuf, c, c2) - else if (c == 0x21 && c2 == 0x40) **outbuf = 0xff3c; - else if (c == 0x22 && c2 == 0x32) **outbuf = 0xff5e; - else TRYMAP_DEC(jisx0208, **outbuf, c, c2); - else TRYMAP_DEC(jisx0213_1_bmp, **outbuf, c, c2); - else TRYMAP_DEC(jisx0213_1_emp, code, c, c2) { - WRITEUCS4(EMPBASE | code) - NEXT_IN(2) - continue; - } - else TRYMAP_DEC(jisx0213_pair, code, c, c2) { - WRITE2(code >> 16, code & 0xffff) - NEXT(2, 2) - continue; - } - else return 2; - NEXT(2, 1) - } - } - - return 0; -} - - -/* - * EUC-JP codec - */ - -ENCODER(euc_jp) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - - UCS4INVALID(c) - - TRYMAP_ENC(jisxcommon, code, c); - else if (c >= 0xff61 && c <= 0xff9f) { - /* JIS X 0201 half-width katakana */ - WRITE2(0x8e, c - 0xfec0) - NEXT(1, 2) - continue; - } -#ifndef STRICT_BUILD - else if (c == 0xff3c) /* FULL-WIDTH REVERSE SOLIDUS */ - code = 0x2140; - else if (c == 0xa5) { /* YEN SIGN */ - WRITE1(0x5c); - NEXT(1, 1) - continue; - } else if (c == 0x203e) { /* OVERLINE */ - WRITE1(0x7e); - NEXT(1, 1) - continue; - } -#endif - else - return 1; - - if (code & 0x8000) { - /* JIS X 0212 */ - WRITE3(0x8f, code >> 8, (code & 0xFF) | 0x80) - NEXT(1, 3) - } else { - /* JIS X 0208 */ - WRITE2((code >> 8) | 0x80, (code & 0xFF) | 0x80) - NEXT(1, 2) - } - } - - return 0; -} - -DECODER(euc_jp) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - if (c == 0x8e) { - /* JIS X 0201 half-width katakana */ - unsigned char c2; - - REQUIRE_INBUF(2) - c2 = IN2; - if (c2 >= 0xa1 && c2 <= 0xdf) { - OUT1(0xfec0 + c2) - NEXT(2, 1) - } - else - return 2; - } - else if (c == 0x8f) { - unsigned char c2, c3; - - REQUIRE_INBUF(3) - c2 = IN2; - c3 = IN3; - /* JIS X 0212 */ - TRYMAP_DEC(jisx0212, **outbuf, c2 ^ 0x80, c3 ^ 0x80) { - NEXT(3, 1) - } - else - return 3; - } - else { - unsigned char c2; - - REQUIRE_INBUF(2) - c2 = IN2; - /* JIS X 0208 */ -#ifndef STRICT_BUILD - if (c == 0xa1 && c2 == 0xc0) - /* FULL-WIDTH REVERSE SOLIDUS */ - **outbuf = 0xff3c; - else -#endif - TRYMAP_DEC(jisx0208, **outbuf, - c ^ 0x80, c2 ^ 0x80) ; - else return 2; - NEXT(2, 1) - } - } - - return 0; -} - - -/* - * SHIFT_JIS codec - */ - -ENCODER(shift_jis) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - unsigned char c1, c2; - -#ifdef STRICT_BUILD - JISX0201_R_ENCODE(c, code) -#else - if (c < 0x80) code = c; - else if (c == 0x00a5) code = 0x5c; /* YEN SIGN */ - else if (c == 0x203e) code = 0x7e; /* OVERLINE */ -#endif - else JISX0201_K_ENCODE(c, code) - else UCS4INVALID(c) - else code = NOCHAR; - - if (code < 0x80 || (code >= 0xa1 && code <= 0xdf)) { - REQUIRE_OUTBUF(1) - - OUT1((unsigned char)code) - NEXT(1, 1) - continue; - } - - REQUIRE_OUTBUF(2) - - if (code == NOCHAR) { - TRYMAP_ENC(jisxcommon, code, c); -#ifndef STRICT_BUILD - else if (c == 0xff3c) - code = 0x2140; /* FULL-WIDTH REVERSE SOLIDUS */ -#endif - else - return 1; - - if (code & 0x8000) /* MSB set: JIS X 0212 */ - return 1; - } - - c1 = code >> 8; - c2 = code & 0xff; - c2 = (((c1 - 0x21) & 1) ? 0x5e : 0) + (c2 - 0x21); - c1 = (c1 - 0x21) >> 1; - OUT1(c1 < 0x1f ? c1 + 0x81 : c1 + 0xc1) - OUT2(c2 < 0x3f ? c2 + 0x40 : c2 + 0x41) - NEXT(1, 2) - } - - return 0; -} - -DECODER(shift_jis) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - -#ifdef STRICT_BUILD - JISX0201_R_DECODE(c, **outbuf) -#else - if (c < 0x80) **outbuf = c; -#endif - else JISX0201_K_DECODE(c, **outbuf) - else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xea)){ - unsigned char c1, c2; - - REQUIRE_INBUF(2) - c2 = IN2; - if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; - - c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); - c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); - c1 = (2 * c1 + (c2 < 0x5e ? 0 : 1) + 0x21); - c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; - -#ifndef STRICT_BUILD - if (c1 == 0x21 && c2 == 0x40) { - /* FULL-WIDTH REVERSE SOLIDUS */ - OUT1(0xff3c) - NEXT(2, 1) - continue; - } -#endif - TRYMAP_DEC(jisx0208, **outbuf, c1, c2) { - NEXT(2, 1) - continue; - } - else - return 2; - } - else - return 2; - - NEXT(1, 1) /* JIS X 0201 */ - } - - return 0; -} - - -/* - * SHIFT_JIS-2004 codec - */ - -ENCODER(shift_jis_2004) -{ - while (inleft > 0) { - ucs4_t c = IN1; - DBCHAR code = NOCHAR; - int c1, c2; - Py_ssize_t insize; - - JISX0201_ENCODE(c, code) - else DECODE_SURROGATE(c) - - if (code < 0x80 || (code >= 0xa1 && code <= 0xdf)) { - WRITE1((unsigned char)code) - NEXT(1, 1) - continue; - } - - REQUIRE_OUTBUF(2) - insize = GET_INSIZE(c); - - if (code == NOCHAR) { - if (c <= 0xffff) { - EMULATE_JISX0213_2000_ENCODE_BMP(code, c) - else TRYMAP_ENC(jisx0213_bmp, code, c) { - if (code == MULTIC) { - if (inleft < 2) { - if (flags & MBENC_FLUSH) { - code = find_pairencmap - ((ucs2_t)c, 0, - jisx0213_pair_encmap, - JISX0213_ENCPAIRS); - if (code == DBCINV) - return 1; - } - else - return MBERR_TOOFEW; - } - else { - code = find_pairencmap( - (ucs2_t)c, IN2, - jisx0213_pair_encmap, - JISX0213_ENCPAIRS); - if (code == DBCINV) { - code = find_pairencmap( - (ucs2_t)c, 0, - jisx0213_pair_encmap, - JISX0213_ENCPAIRS); - if (code == DBCINV) - return 1; - } - else - insize = 2; - } - } - } - else TRYMAP_ENC(jisxcommon, code, c) { - /* abandon JIS X 0212 codes */ - if (code & 0x8000) - return 1; - } - else return 1; - } - else if (c >> 16 == EMPBASE >> 16) { - EMULATE_JISX0213_2000_ENCODE_EMP(code, c) - else TRYMAP_ENC(jisx0213_emp, code, c&0xffff); - else return insize; - } - else - return insize; - } - - c1 = code >> 8; - c2 = (code & 0xff) - 0x21; - - if (c1 & 0x80) { /* Plane 2 */ - if (c1 >= 0xee) c1 -= 0x87; - else if (c1 >= 0xac || c1 == 0xa8) c1 -= 0x49; - else c1 -= 0x43; - } - else /* Plane 1 */ - c1 -= 0x21; - - if (c1 & 1) c2 += 0x5e; - c1 >>= 1; - OUT1(c1 + (c1 < 0x1f ? 0x81 : 0xc1)) - OUT2(c2 + (c2 < 0x3f ? 0x40 : 0x41)) - - NEXT(insize, 2) - } - - return 0; -} - -DECODER(shift_jis_2004) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - JISX0201_DECODE(c, **outbuf) - else if ((c >= 0x81 && c <= 0x9f) || (c >= 0xe0 && c <= 0xfc)){ - unsigned char c1, c2; - ucs4_t code; - - REQUIRE_INBUF(2) - c2 = IN2; - if (c2 < 0x40 || (c2 > 0x7e && c2 < 0x80) || c2 > 0xfc) - return 2; - - c1 = (c < 0xe0 ? c - 0x81 : c - 0xc1); - c2 = (c2 < 0x80 ? c2 - 0x40 : c2 - 0x41); - c1 = (2 * c1 + (c2 < 0x5e ? 0 : 1)); - c2 = (c2 < 0x5e ? c2 : c2 - 0x5e) + 0x21; - - if (c1 < 0x5e) { /* Plane 1 */ - c1 += 0x21; - EMULATE_JISX0213_2000_DECODE_PLANE1(**outbuf, - c1, c2) - else TRYMAP_DEC(jisx0208, **outbuf, c1, c2) { - NEXT_OUT(1) - } - else TRYMAP_DEC(jisx0213_1_bmp, **outbuf, - c1, c2) { - NEXT_OUT(1) - } - else TRYMAP_DEC(jisx0213_1_emp, code, c1, c2) { - WRITEUCS4(EMPBASE | code) - } - else TRYMAP_DEC(jisx0213_pair, code, c1, c2) { - WRITE2(code >> 16, code & 0xffff) - NEXT_OUT(2) - } - else - return 2; - NEXT_IN(2) - } - else { /* Plane 2 */ - if (c1 >= 0x67) c1 += 0x07; - else if (c1 >= 0x63 || c1 == 0x5f) c1 -= 0x37; - else c1 -= 0x3d; - - EMULATE_JISX0213_2000_DECODE_PLANE2(**outbuf, - c1, c2) - else TRYMAP_DEC(jisx0213_2_bmp, **outbuf, - c1, c2) ; - else TRYMAP_DEC(jisx0213_2_emp, code, c1, c2) { - WRITEUCS4(EMPBASE | code) - NEXT_IN(2) - continue; - } - else - return 2; - NEXT(2, 1) - } - continue; - } - else - return 2; - - NEXT(1, 1) /* JIS X 0201 */ - } - - return 0; -} - - -BEGIN_MAPPINGS_LIST - MAPPING_DECONLY(jisx0208) - MAPPING_DECONLY(jisx0212) - MAPPING_ENCONLY(jisxcommon) - MAPPING_DECONLY(jisx0213_1_bmp) - MAPPING_DECONLY(jisx0213_2_bmp) - MAPPING_ENCONLY(jisx0213_bmp) - MAPPING_DECONLY(jisx0213_1_emp) - MAPPING_DECONLY(jisx0213_2_emp) - MAPPING_ENCONLY(jisx0213_emp) - MAPPING_ENCDEC(jisx0213_pair) - MAPPING_ENCDEC(cp932ext) -END_MAPPINGS_LIST - -BEGIN_CODECS_LIST - CODEC_STATELESS(shift_jis) - CODEC_STATELESS(cp932) - CODEC_STATELESS(euc_jp) - CODEC_STATELESS(shift_jis_2004) - CODEC_STATELESS(euc_jis_2004) - { "euc_jisx0213", (void *)2000, NULL, _STATELESS_METHODS(euc_jis_2004) }, - { "shift_jisx0213", (void *)2000, NULL, _STATELESS_METHODS(shift_jis_2004) }, -END_CODECS_LIST - -I_AM_A_MODULE_FOR(jp) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_kr.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_kr.c deleted file mode 100644 index 6c5f224..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_kr.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * _codecs_kr.c: Codecs collection for Korean encodings - * - * Written by Hye-Shik Chang - */ - -#include "cjkcodecs.h" -#include "mappings_kr.h" - -/* - * EUC-KR codec - */ - -#define EUCKR_JAMO_FIRSTBYTE 0xA4 -#define EUCKR_JAMO_FILLER 0xD4 - -static const unsigned char u2cgk_choseong[19] = { - 0xa1, 0xa2, 0xa4, 0xa7, 0xa8, 0xa9, 0xb1, 0xb2, - 0xb3, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xbb, - 0xbc, 0xbd, 0xbe -}; -static const unsigned char u2cgk_jungseong[21] = { - 0xbf, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, - 0xc7, 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, - 0xcf, 0xd0, 0xd1, 0xd2, 0xd3 -}; -static const unsigned char u2cgk_jongseong[28] = { - 0xd4, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, - 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xba, - 0xbb, 0xbc, 0xbd, 0xbe -}; - -ENCODER(euc_kr) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - TRYMAP_ENC(cp949, code, c); - else return 1; - - if ((code & 0x8000) == 0) { - /* KS X 1001 coded character */ - OUT1((code >> 8) | 0x80) - OUT2((code & 0xFF) | 0x80) - NEXT(1, 2) - } - else { /* Mapping is found in CP949 extension, - * but we encode it in KS X 1001:1998 Annex 3, - * make-up sequence for EUC-KR. */ - - REQUIRE_OUTBUF(8) - - /* syllable composition precedence */ - OUT1(EUCKR_JAMO_FIRSTBYTE) - OUT2(EUCKR_JAMO_FILLER) - - /* All code points in CP949 extension are in unicode - * Hangul Syllable area. */ - assert(0xac00 <= c && c <= 0xd7a3); - c -= 0xac00; - - OUT3(EUCKR_JAMO_FIRSTBYTE) - OUT4(u2cgk_choseong[c / 588]) - NEXT_OUT(4) - - OUT1(EUCKR_JAMO_FIRSTBYTE) - OUT2(u2cgk_jungseong[(c / 28) % 21]) - OUT3(EUCKR_JAMO_FIRSTBYTE) - OUT4(u2cgk_jongseong[c % 28]) - NEXT(1, 4) - } - } - - return 0; -} - -#define NONE 127 - -static const unsigned char cgk2u_choseong[] = { /* [A1, BE] */ - 0, 1, NONE, 2, NONE, NONE, 3, 4, - 5, NONE, NONE, NONE, NONE, NONE, NONE, NONE, - 6, 7, 8, NONE, 9, 10, 11, 12, - 13, 14, 15, 16, 17, 18 -}; -static const unsigned char cgk2u_jongseong[] = { /* [A1, BE] */ - 1, 2, 3, 4, 5, 6, 7, NONE, - 8, 9, 10, 11, 12, 13, 14, 15, - 16, 17, NONE, 18, 19, 20, 21, 22, - NONE, 23, 24, 25, 26, 27 -}; - -DECODER(euc_kr) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - - if (c == EUCKR_JAMO_FIRSTBYTE && - IN2 == EUCKR_JAMO_FILLER) { - /* KS X 1001:1998 Annex 3 make-up sequence */ - DBCHAR cho, jung, jong; - - REQUIRE_INBUF(8) - if ((*inbuf)[2] != EUCKR_JAMO_FIRSTBYTE || - (*inbuf)[4] != EUCKR_JAMO_FIRSTBYTE || - (*inbuf)[6] != EUCKR_JAMO_FIRSTBYTE) - return 8; - - c = (*inbuf)[3]; - if (0xa1 <= c && c <= 0xbe) - cho = cgk2u_choseong[c - 0xa1]; - else - cho = NONE; - - c = (*inbuf)[5]; - jung = (0xbf <= c && c <= 0xd3) ? c - 0xbf : NONE; - - c = (*inbuf)[7]; - if (c == EUCKR_JAMO_FILLER) - jong = 0; - else if (0xa1 <= c && c <= 0xbe) - jong = cgk2u_jongseong[c - 0xa1]; - else - jong = NONE; - - if (cho == NONE || jung == NONE || jong == NONE) - return 8; - - OUT1(0xac00 + cho*588 + jung*28 + jong); - NEXT(8, 1) - } - else TRYMAP_DEC(ksx1001, **outbuf, c ^ 0x80, IN2 ^ 0x80) { - NEXT(2, 1) - } - else - return 2; - } - - return 0; -} -#undef NONE - - -/* - * CP949 codec - */ - -ENCODER(cp949) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - TRYMAP_ENC(cp949, code, c); - else return 1; - - OUT1((code >> 8) | 0x80) - if (code & 0x8000) - OUT2(code & 0xFF) /* MSB set: CP949 */ - else - OUT2((code & 0xFF) | 0x80) /* MSB unset: ks x 1001 */ - NEXT(1, 2) - } - - return 0; -} - -DECODER(cp949) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - TRYMAP_DEC(ksx1001, **outbuf, c ^ 0x80, IN2 ^ 0x80); - else TRYMAP_DEC(cp949ext, **outbuf, c, IN2); - else return 2; - - NEXT(2, 1) - } - - return 0; -} - - -/* - * JOHAB codec - */ - -static const unsigned char u2johabidx_choseong[32] = { - 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, -}; -static const unsigned char u2johabidx_jungseong[32] = { - 0x03, 0x04, 0x05, 0x06, 0x07, - 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x1a, 0x1b, 0x1c, 0x1d, -}; -static const unsigned char u2johabidx_jongseong[32] = { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, -}; -static const DBCHAR u2johabjamo[] = { - 0x8841, 0x8c41, 0x8444, 0x9041, 0x8446, 0x8447, 0x9441, - 0x9841, 0x9c41, 0x844a, 0x844b, 0x844c, 0x844d, 0x844e, 0x844f, - 0x8450, 0xa041, 0xa441, 0xa841, 0x8454, 0xac41, 0xb041, 0xb441, - 0xb841, 0xbc41, 0xc041, 0xc441, 0xc841, 0xcc41, 0xd041, 0x8461, - 0x8481, 0x84a1, 0x84c1, 0x84e1, 0x8541, 0x8561, 0x8581, 0x85a1, - 0x85c1, 0x85e1, 0x8641, 0x8661, 0x8681, 0x86a1, 0x86c1, 0x86e1, - 0x8741, 0x8761, 0x8781, 0x87a1, -}; - -ENCODER(johab) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - - if (c >= 0xac00 && c <= 0xd7a3) { - c -= 0xac00; - code = 0x8000 | - (u2johabidx_choseong[c / 588] << 10) | - (u2johabidx_jungseong[(c / 28) % 21] << 5) | - u2johabidx_jongseong[c % 28]; - } - else if (c >= 0x3131 && c <= 0x3163) - code = u2johabjamo[c - 0x3131]; - else TRYMAP_ENC(cp949, code, c) { - unsigned char c1, c2, t2; - unsigned short t1; - - assert((code & 0x8000) == 0); - c1 = code >> 8; - c2 = code & 0xff; - if (((c1 >= 0x21 && c1 <= 0x2c) || - (c1 >= 0x4a && c1 <= 0x7d)) && - (c2 >= 0x21 && c2 <= 0x7e)) { - t1 = (c1 < 0x4a ? (c1 - 0x21 + 0x1b2) : - (c1 - 0x21 + 0x197)); - t2 = ((t1 & 1) ? 0x5e : 0) + (c2 - 0x21); - OUT1(t1 >> 1) - OUT2(t2 < 0x4e ? t2 + 0x31 : t2 + 0x43) - NEXT(1, 2) - continue; - } - else - return 1; - } - else - return 1; - - OUT1(code >> 8) - OUT2(code & 0xff) - NEXT(1, 2) - } - - return 0; -} - -#define FILL 0xfd -#define NONE 0xff - -static const unsigned char johabidx_choseong[32] = { - NONE, FILL, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, - 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, - 0x0e, 0x0f, 0x10, 0x11, 0x12, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, -}; -static const unsigned char johabidx_jungseong[32] = { - NONE, NONE, FILL, 0x00, 0x01, 0x02, 0x03, 0x04, - NONE, NONE, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, - NONE, NONE, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, - NONE, NONE, 0x11, 0x12, 0x13, 0x14, NONE, NONE, -}; -static const unsigned char johabidx_jongseong[32] = { - NONE, FILL, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, - 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, - 0x0f, 0x10, NONE, 0x11, 0x12, 0x13, 0x14, 0x15, - 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, NONE, NONE, -}; - -static const unsigned char johabjamo_choseong[32] = { - NONE, FILL, 0x31, 0x32, 0x34, 0x37, 0x38, 0x39, - 0x41, 0x42, 0x43, 0x45, 0x46, 0x47, 0x48, 0x49, - 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, NONE, NONE, NONE, - NONE, NONE, NONE, NONE, NONE, NONE, NONE, NONE, -}; -static const unsigned char johabjamo_jungseong[32] = { - NONE, NONE, FILL, 0x4f, 0x50, 0x51, 0x52, 0x53, - NONE, NONE, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, - NONE, NONE, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - NONE, NONE, 0x60, 0x61, 0x62, 0x63, NONE, NONE, -}; -static const unsigned char johabjamo_jongseong[32] = { - NONE, FILL, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, - 0x37, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x41, NONE, 0x42, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, NONE, NONE, -}; - -DECODER(johab) -{ - while (inleft > 0) { - unsigned char c = IN1, c2; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - c2 = IN2; - - if (c < 0xd8) { - /* johab hangul */ - unsigned char c_cho, c_jung, c_jong; - unsigned char i_cho, i_jung, i_jong; - - c_cho = (c >> 2) & 0x1f; - c_jung = ((c << 3) | c2 >> 5) & 0x1f; - c_jong = c2 & 0x1f; - - i_cho = johabidx_choseong[c_cho]; - i_jung = johabidx_jungseong[c_jung]; - i_jong = johabidx_jongseong[c_jong]; - - if (i_cho == NONE || i_jung == NONE || i_jong == NONE) - return 2; - - /* we don't use U+1100 hangul jamo yet. */ - if (i_cho == FILL) { - if (i_jung == FILL) { - if (i_jong == FILL) - OUT1(0x3000) - else - OUT1(0x3100 | - johabjamo_jongseong[c_jong]) - } - else { - if (i_jong == FILL) - OUT1(0x3100 | - johabjamo_jungseong[c_jung]) - else - return 2; - } - } else { - if (i_jung == FILL) { - if (i_jong == FILL) - OUT1(0x3100 | - johabjamo_choseong[c_cho]) - else - return 2; - } - else - OUT1(0xac00 + - i_cho * 588 + - i_jung * 28 + - (i_jong == FILL ? 0 : i_jong)) - } - NEXT(2, 1) - } else { - /* KS X 1001 except hangul jamos and syllables */ - if (c == 0xdf || c > 0xf9 || - c2 < 0x31 || (c2 >= 0x80 && c2 < 0x91) || - (c2 & 0x7f) == 0x7f || - (c == 0xda && (c2 >= 0xa1 && c2 <= 0xd3))) - return 2; - else { - unsigned char t1, t2; - - t1 = (c < 0xe0 ? 2 * (c - 0xd9) : - 2 * c - 0x197); - t2 = (c2 < 0x91 ? c2 - 0x31 : c2 - 0x43); - t1 = t1 + (t2 < 0x5e ? 0 : 1) + 0x21; - t2 = (t2 < 0x5e ? t2 : t2 - 0x5e) + 0x21; - - TRYMAP_DEC(ksx1001, **outbuf, t1, t2); - else return 2; - NEXT(2, 1) - } - } - } - - return 0; -} -#undef NONE -#undef FILL - - -BEGIN_MAPPINGS_LIST - MAPPING_DECONLY(ksx1001) - MAPPING_ENCONLY(cp949) - MAPPING_DECONLY(cp949ext) -END_MAPPINGS_LIST - -BEGIN_CODECS_LIST - CODEC_STATELESS(euc_kr) - CODEC_STATELESS(cp949) - CODEC_STATELESS(johab) -END_CODECS_LIST - -I_AM_A_MODULE_FOR(kr) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_tw.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_tw.c deleted file mode 100644 index 3f6204d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/_codecs_tw.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * _codecs_tw.c: Codecs collection for Taiwan's encodings - * - * Written by Hye-Shik Chang - */ - -#include "cjkcodecs.h" -#include "mappings_tw.h" - -/* - * BIG5 codec - */ - -ENCODER(big5) -{ - while (inleft > 0) { - Py_UNICODE c = **inbuf; - DBCHAR code; - - if (c < 0x80) { - REQUIRE_OUTBUF(1) - **outbuf = (unsigned char)c; - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - - TRYMAP_ENC(big5, code, c); - else return 1; - - OUT1(code >> 8) - OUT2(code & 0xFF) - NEXT(1, 2) - } - - return 0; -} - -DECODER(big5) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - TRYMAP_DEC(big5, **outbuf, c, IN2) { - NEXT(2, 1) - } - else return 2; - } - - return 0; -} - - -/* - * CP950 codec - */ - -ENCODER(cp950) -{ - while (inleft > 0) { - Py_UNICODE c = IN1; - DBCHAR code; - - if (c < 0x80) { - WRITE1((unsigned char)c) - NEXT(1, 1) - continue; - } - UCS4INVALID(c) - - REQUIRE_OUTBUF(2) - TRYMAP_ENC(cp950ext, code, c); - else TRYMAP_ENC(big5, code, c); - else return 1; - - OUT1(code >> 8) - OUT2(code & 0xFF) - NEXT(1, 2) - } - - return 0; -} - -DECODER(cp950) -{ - while (inleft > 0) { - unsigned char c = IN1; - - REQUIRE_OUTBUF(1) - - if (c < 0x80) { - OUT1(c) - NEXT(1, 1) - continue; - } - - REQUIRE_INBUF(2) - - TRYMAP_DEC(cp950ext, **outbuf, c, IN2); - else TRYMAP_DEC(big5, **outbuf, c, IN2); - else return 2; - - NEXT(2, 1) - } - - return 0; -} - - - -BEGIN_MAPPINGS_LIST - MAPPING_ENCDEC(big5) - MAPPING_ENCDEC(cp950ext) -END_MAPPINGS_LIST - -BEGIN_CODECS_LIST - CODEC_STATELESS(big5) - CODEC_STATELESS(cp950) -END_CODECS_LIST - -I_AM_A_MODULE_FOR(tw) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/alg_jisx0201.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/alg_jisx0201.h deleted file mode 100644 index 3f4e938..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/alg_jisx0201.h +++ /dev/null @@ -1,24 +0,0 @@ -#define JISX0201_R_ENCODE(c, assi) \ - if ((c) < 0x80 && (c) != 0x5c && (c) != 0x7e) \ - (assi) = (c); \ - else if ((c) == 0x00a5) (assi) = 0x5c; \ - else if ((c) == 0x203e) (assi) = 0x7e; -#define JISX0201_K_ENCODE(c, assi) \ - if ((c) >= 0xff61 && (c) <= 0xff9f) \ - (assi) = (c) - 0xfec0; -#define JISX0201_ENCODE(c, assi) \ - JISX0201_R_ENCODE(c, assi) \ - else JISX0201_K_ENCODE(c, assi) - -#define JISX0201_R_DECODE(c, assi) \ - if ((c) < 0x5c) (assi) = (c); \ - else if ((c) == 0x5c) (assi) = 0x00a5; \ - else if ((c) < 0x7e) (assi) = (c); \ - else if ((c) == 0x7e) (assi) = 0x203e; \ - else if ((c) == 0x7f) (assi) = 0x7f; -#define JISX0201_K_DECODE(c, assi) \ - if ((c) >= 0xa1 && (c) <= 0xdf) \ - (assi) = 0xfec0 + (c); -#define JISX0201_DECODE(c, assi) \ - JISX0201_R_DECODE(c, assi) \ - else JISX0201_K_DECODE(c, assi) diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/cjkcodecs.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/cjkcodecs.h deleted file mode 100644 index 9c2febc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/cjkcodecs.h +++ /dev/null @@ -1,398 +0,0 @@ -/* - * cjkcodecs.h: common header for cjkcodecs - * - * Written by Hye-Shik Chang - */ - -#ifndef _CJKCODECS_H_ -#define _CJKCODECS_H_ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "multibytecodec.h" - - -/* a unicode "undefined" code point */ -#define UNIINV 0xFFFE - -/* internal-use DBCS code points which aren't used by any charsets */ -#define NOCHAR 0xFFFF -#define MULTIC 0xFFFE -#define DBCINV 0xFFFD - -/* shorter macros to save source size of mapping tables */ -#define U UNIINV -#define N NOCHAR -#define M MULTIC -#define D DBCINV - -struct dbcs_index { - const ucs2_t *map; - unsigned char bottom, top; -}; -typedef struct dbcs_index decode_map; - -struct widedbcs_index { - const ucs4_t *map; - unsigned char bottom, top; -}; -typedef struct widedbcs_index widedecode_map; - -struct unim_index { - const DBCHAR *map; - unsigned char bottom, top; -}; -typedef struct unim_index encode_map; - -struct unim_index_bytebased { - const unsigned char *map; - unsigned char bottom, top; -}; - -struct dbcs_map { - const char *charset; - const struct unim_index *encmap; - const struct dbcs_index *decmap; -}; - -struct pair_encodemap { - ucs4_t uniseq; - DBCHAR code; -}; - -static const MultibyteCodec *codec_list; -static const struct dbcs_map *mapping_list; - -#define CODEC_INIT(encoding) \ - static int encoding##_codec_init(const void *config) - -#define ENCODER_INIT(encoding) \ - static int encoding##_encode_init( \ - MultibyteCodec_State *state, const void *config) -#define ENCODER(encoding) \ - static Py_ssize_t encoding##_encode( \ - MultibyteCodec_State *state, const void *config, \ - const Py_UNICODE **inbuf, Py_ssize_t inleft, \ - unsigned char **outbuf, Py_ssize_t outleft, int flags) -#define ENCODER_RESET(encoding) \ - static Py_ssize_t encoding##_encode_reset( \ - MultibyteCodec_State *state, const void *config, \ - unsigned char **outbuf, Py_ssize_t outleft) - -#define DECODER_INIT(encoding) \ - static int encoding##_decode_init( \ - MultibyteCodec_State *state, const void *config) -#define DECODER(encoding) \ - static Py_ssize_t encoding##_decode( \ - MultibyteCodec_State *state, const void *config, \ - const unsigned char **inbuf, Py_ssize_t inleft, \ - Py_UNICODE **outbuf, Py_ssize_t outleft) -#define DECODER_RESET(encoding) \ - static Py_ssize_t encoding##_decode_reset( \ - MultibyteCodec_State *state, const void *config) - -#if Py_UNICODE_SIZE == 4 -#define UCS4INVALID(code) \ - if ((code) > 0xFFFF) \ - return 1; -#else -#define UCS4INVALID(code) \ - if (0) ; -#endif - -#define NEXT_IN(i) \ - (*inbuf) += (i); \ - (inleft) -= (i); -#define NEXT_OUT(o) \ - (*outbuf) += (o); \ - (outleft) -= (o); -#define NEXT(i, o) \ - NEXT_IN(i) NEXT_OUT(o) - -#define REQUIRE_INBUF(n) \ - if (inleft < (n)) \ - return MBERR_TOOFEW; -#define REQUIRE_OUTBUF(n) \ - if (outleft < (n)) \ - return MBERR_TOOSMALL; - -#define IN1 ((*inbuf)[0]) -#define IN2 ((*inbuf)[1]) -#define IN3 ((*inbuf)[2]) -#define IN4 ((*inbuf)[3]) - -#define OUT1(c) ((*outbuf)[0]) = (c); -#define OUT2(c) ((*outbuf)[1]) = (c); -#define OUT3(c) ((*outbuf)[2]) = (c); -#define OUT4(c) ((*outbuf)[3]) = (c); - -#define WRITE1(c1) \ - REQUIRE_OUTBUF(1) \ - (*outbuf)[0] = (c1); -#define WRITE2(c1, c2) \ - REQUIRE_OUTBUF(2) \ - (*outbuf)[0] = (c1); \ - (*outbuf)[1] = (c2); -#define WRITE3(c1, c2, c3) \ - REQUIRE_OUTBUF(3) \ - (*outbuf)[0] = (c1); \ - (*outbuf)[1] = (c2); \ - (*outbuf)[2] = (c3); -#define WRITE4(c1, c2, c3, c4) \ - REQUIRE_OUTBUF(4) \ - (*outbuf)[0] = (c1); \ - (*outbuf)[1] = (c2); \ - (*outbuf)[2] = (c3); \ - (*outbuf)[3] = (c4); - -#if Py_UNICODE_SIZE == 2 -# define WRITEUCS4(c) \ - REQUIRE_OUTBUF(2) \ - (*outbuf)[0] = 0xd800 + (((c) - 0x10000) >> 10); \ - (*outbuf)[1] = 0xdc00 + (((c) - 0x10000) & 0x3ff); \ - NEXT_OUT(2) -#else -# define WRITEUCS4(c) \ - REQUIRE_OUTBUF(1) \ - **outbuf = (Py_UNICODE)(c); \ - NEXT_OUT(1) -#endif - -#define _TRYMAP_ENC(m, assi, val) \ - ((m)->map != NULL && (val) >= (m)->bottom && \ - (val)<= (m)->top && ((assi) = (m)->map[(val) - \ - (m)->bottom]) != NOCHAR) -#define TRYMAP_ENC_COND(charset, assi, uni) \ - _TRYMAP_ENC(&charset##_encmap[(uni) >> 8], assi, (uni) & 0xff) -#define TRYMAP_ENC(charset, assi, uni) \ - if TRYMAP_ENC_COND(charset, assi, uni) - -#define _TRYMAP_DEC(m, assi, val) \ - ((m)->map != NULL && (val) >= (m)->bottom && \ - (val)<= (m)->top && ((assi) = (m)->map[(val) - \ - (m)->bottom]) != UNIINV) -#define TRYMAP_DEC(charset, assi, c1, c2) \ - if _TRYMAP_DEC(&charset##_decmap[c1], assi, c2) - -#define _TRYMAP_ENC_MPLANE(m, assplane, asshi, asslo, val) \ - ((m)->map != NULL && (val) >= (m)->bottom && \ - (val)<= (m)->top && \ - ((assplane) = (m)->map[((val) - (m)->bottom)*3]) != 0 && \ - (((asshi) = (m)->map[((val) - (m)->bottom)*3 + 1]), 1) && \ - (((asslo) = (m)->map[((val) - (m)->bottom)*3 + 2]), 1)) -#define TRYMAP_ENC_MPLANE(charset, assplane, asshi, asslo, uni) \ - if _TRYMAP_ENC_MPLANE(&charset##_encmap[(uni) >> 8], \ - assplane, asshi, asslo, (uni) & 0xff) -#define TRYMAP_DEC_MPLANE(charset, assi, plane, c1, c2) \ - if _TRYMAP_DEC(&charset##_decmap[plane][c1], assi, c2) - -#if Py_UNICODE_SIZE == 2 -#define DECODE_SURROGATE(c) \ - if (c >> 10 == 0xd800 >> 10) { /* high surrogate */ \ - REQUIRE_INBUF(2) \ - if (IN2 >> 10 == 0xdc00 >> 10) { /* low surrogate */ \ - c = 0x10000 + ((ucs4_t)(c - 0xd800) << 10) + \ - ((ucs4_t)(IN2) - 0xdc00); \ - } \ - } -#define GET_INSIZE(c) ((c) > 0xffff ? 2 : 1) -#else -#define DECODE_SURROGATE(c) {;} -#define GET_INSIZE(c) 1 -#endif - -#define BEGIN_MAPPINGS_LIST static const struct dbcs_map _mapping_list[] = { -#define MAPPING_ENCONLY(enc) {#enc, (void*)enc##_encmap, NULL}, -#define MAPPING_DECONLY(enc) {#enc, NULL, (void*)enc##_decmap}, -#define MAPPING_ENCDEC(enc) {#enc, (void*)enc##_encmap, (void*)enc##_decmap}, -#define END_MAPPINGS_LIST \ - {"", NULL, NULL} }; \ - static const struct dbcs_map *mapping_list = \ - (const struct dbcs_map *)_mapping_list; - -#define BEGIN_CODECS_LIST static const MultibyteCodec _codec_list[] = { -#define _STATEFUL_METHODS(enc) \ - enc##_encode, \ - enc##_encode_init, \ - enc##_encode_reset, \ - enc##_decode, \ - enc##_decode_init, \ - enc##_decode_reset, -#define _STATELESS_METHODS(enc) \ - enc##_encode, NULL, NULL, \ - enc##_decode, NULL, NULL, -#define CODEC_STATEFUL(enc) { \ - #enc, NULL, NULL, \ - _STATEFUL_METHODS(enc) \ -}, -#define CODEC_STATELESS(enc) { \ - #enc, NULL, NULL, \ - _STATELESS_METHODS(enc) \ -}, -#define CODEC_STATELESS_WINIT(enc) { \ - #enc, NULL, \ - enc##_codec_init, \ - _STATELESS_METHODS(enc) \ -}, -#define END_CODECS_LIST \ - {"", NULL,} }; \ - static const MultibyteCodec *codec_list = \ - (const MultibyteCodec *)_codec_list; - -static PyObject * -getmultibytecodec(void) -{ - static PyObject *cofunc = NULL; - - if (cofunc == NULL) { - PyObject *mod = PyImport_ImportModuleNoBlock("_multibytecodec"); - if (mod == NULL) - return NULL; - cofunc = PyObject_GetAttrString(mod, "__create_codec"); - Py_DECREF(mod); - } - return cofunc; -} - -static PyObject * -getcodec(PyObject *self, PyObject *encoding) -{ - PyObject *codecobj, *r, *cofunc; - const MultibyteCodec *codec; - const char *enc; - - if (!PyString_Check(encoding)) { - PyErr_SetString(PyExc_TypeError, - "encoding name must be a string."); - return NULL; - } - - cofunc = getmultibytecodec(); - if (cofunc == NULL) - return NULL; - - enc = PyString_AS_STRING(encoding); - for (codec = codec_list; codec->encoding[0]; codec++) - if (strcmp(codec->encoding, enc) == 0) - break; - - if (codec->encoding[0] == '\0') { - PyErr_SetString(PyExc_LookupError, - "no such codec is supported."); - return NULL; - } - - codecobj = PyCapsule_New((void *)codec, PyMultibyteCodec_CAPSULE_NAME, NULL); - if (codecobj == NULL) - return NULL; - - r = PyObject_CallFunctionObjArgs(cofunc, codecobj, NULL); - Py_DECREF(codecobj); - - return r; -} - -static struct PyMethodDef __methods[] = { - {"getcodec", (PyCFunction)getcodec, METH_O, ""}, - {NULL, NULL}, -}; - -static int -register_maps(PyObject *module) -{ - const struct dbcs_map *h; - - for (h = mapping_list; h->charset[0] != '\0'; h++) { - char mhname[256] = "__map_"; - int r; - strcpy(mhname + sizeof("__map_") - 1, h->charset); - r = PyModule_AddObject(module, mhname, - PyCapsule_New((void *)h, PyMultibyteCodec_CAPSULE_NAME, NULL)); - if (r == -1) - return -1; - } - return 0; -} - -#ifdef USING_BINARY_PAIR_SEARCH -static DBCHAR -find_pairencmap(ucs2_t body, ucs2_t modifier, - const struct pair_encodemap *haystack, int haystacksize) -{ - int pos, min, max; - ucs4_t value = body << 16 | modifier; - - min = 0; - max = haystacksize; - - for (pos = haystacksize >> 1; min != max; pos = (min + max) >> 1) - if (value < haystack[pos].uniseq) { - if (max == pos) break; - else max = pos; - } - else if (value > haystack[pos].uniseq) { - if (min == pos) break; - else min = pos; - } - else - break; - - if (value == haystack[pos].uniseq) - return haystack[pos].code; - else - return DBCINV; -} -#endif - -#ifdef USING_IMPORTED_MAPS -#define IMPORT_MAP(locale, charset, encmap, decmap) \ - importmap("_codecs_" #locale, "__map_" #charset, \ - (const void**)encmap, (const void**)decmap) - -static int -importmap(const char *modname, const char *symbol, - const void **encmap, const void **decmap) -{ - PyObject *o, *mod; - - mod = PyImport_ImportModule((char *)modname); - if (mod == NULL) - return -1; - - o = PyObject_GetAttrString(mod, (char*)symbol); - if (o == NULL) - goto errorexit; - else if (!PyCapsule_IsValid(o, PyMultibyteCodec_CAPSULE_NAME)) { - PyErr_SetString(PyExc_ValueError, - "map data must be a Capsule."); - goto errorexit; - } - else { - struct dbcs_map *map; - map = PyCapsule_GetPointer(o, PyMultibyteCodec_CAPSULE_NAME); - if (encmap != NULL) - *encmap = map->encmap; - if (decmap != NULL) - *decmap = map->decmap; - Py_DECREF(o); - } - - Py_DECREF(mod); - return 0; - -errorexit: - Py_DECREF(mod); - return -1; -} -#endif - -#define I_AM_A_MODULE_FOR(loc) \ - void \ - init_codecs_##loc(void) \ - { \ - PyObject *m = Py_InitModule("_codecs_" #loc, __methods);\ - if (m != NULL) \ - (void)register_maps(m); \ - } - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/emu_jisx0213_2000.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/emu_jisx0213_2000.h deleted file mode 100644 index ca22858..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/emu_jisx0213_2000.h +++ /dev/null @@ -1,43 +0,0 @@ -/* These routines may be quite inefficient, but it's used only to emulate old - * standards. */ - -#ifndef EMULATE_JISX0213_2000_ENCODE_INVALID -#define EMULATE_JISX0213_2000_ENCODE_INVALID 1 -#endif - -#define EMULATE_JISX0213_2000_ENCODE_BMP(assi, c) \ - if (config == (void *)2000 && ( \ - (c) == 0x9B1C || (c) == 0x4FF1 || \ - (c) == 0x525D || (c) == 0x541E || \ - (c) == 0x5653 || (c) == 0x59F8 || \ - (c) == 0x5C5B || (c) == 0x5E77 || \ - (c) == 0x7626 || (c) == 0x7E6B)) \ - return EMULATE_JISX0213_2000_ENCODE_INVALID; \ - else if (config == (void *)2000 && (c) == 0x9B1D) \ - (assi) = 0x8000 | 0x7d3b; \ - -#define EMULATE_JISX0213_2000_ENCODE_EMP(assi, c) \ - if (config == (void *)2000 && (c) == 0x20B9F) \ - return EMULATE_JISX0213_2000_ENCODE_INVALID; - -#ifndef EMULATE_JISX0213_2000_DECODE_INVALID -#define EMULATE_JISX0213_2000_DECODE_INVALID 2 -#endif - -#define EMULATE_JISX0213_2000_DECODE_PLANE1(assi, c1, c2) \ - if (config == (void *)2000 && \ - (((c1) == 0x2E && (c2) == 0x21) || \ - ((c1) == 0x2F && (c2) == 0x7E) || \ - ((c1) == 0x4F && (c2) == 0x54) || \ - ((c1) == 0x4F && (c2) == 0x7E) || \ - ((c1) == 0x74 && (c2) == 0x27) || \ - ((c1) == 0x7E && (c2) == 0x7A) || \ - ((c1) == 0x7E && (c2) == 0x7B) || \ - ((c1) == 0x7E && (c2) == 0x7C) || \ - ((c1) == 0x7E && (c2) == 0x7D) || \ - ((c1) == 0x7E && (c2) == 0x7E))) \ - return EMULATE_JISX0213_2000_DECODE_INVALID; - -#define EMULATE_JISX0213_2000_DECODE_PLANE2(assi, c1, c2) \ - if (config == (void *)2000 && (c1) == 0x7D && (c2) == 0x3B) \ - (assi) = 0x9B1D; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_cn.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_cn.h deleted file mode 100644 index e6c89c6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_cn.h +++ /dev/null @@ -1,4103 +0,0 @@ -static const ucs2_t __gb2312_decmap[7482] = { -12288,12289,12290,12539,713,711,168,12291,12293,8213,65374,8214,8230,8216, -8217,8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303, -12310,12311,12304,12305,177,215,247,8758,8743,8744,8721,8719,8746,8745,8712, -8759,8730,8869,8741,8736,8978,8857,8747,8750,8801,8780,8776,8765,8733,8800, -8814,8815,8804,8805,8734,8757,8756,9794,9792,176,8242,8243,8451,65284,164, -65504,65505,8240,167,8470,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651, -9650,8251,8594,8592,8593,8595,12307,9352,9353,9354,9355,9356,9357,9358,9359, -9360,9361,9362,9363,9364,9365,9366,9367,9368,9369,9370,9371,9332,9333,9334, -9335,9336,9337,9338,9339,9340,9341,9342,9343,9344,9345,9346,9347,9348,9349, -9350,9351,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,U,U,12832,12833, -12834,12835,12836,12837,12838,12839,12840,12841,U,U,8544,8545,8546,8547,8548, -8549,8550,8551,8552,8553,8554,8555,65281,65282,65283,65509,65285,65286,65287, -65288,65289,65290,65291,65292,65293,65294,65295,65296,65297,65298,65299,65300, -65301,65302,65303,65304,65305,65306,65307,65308,65309,65310,65311,65312,65313, -65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324,65325,65326, -65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337,65338,65339, -65340,65341,65342,65343,65344,65345,65346,65347,65348,65349,65350,65351,65352, -65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363,65364,65365, -65366,65367,65368,65369,65370,65371,65372,65373,65507,12353,12354,12355,12356, -12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369, -12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382, -12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395, -12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408, -12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421, -12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434, -12435,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460, -12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473, -12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486, -12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499, -12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512, -12513,12514,12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525, -12526,12527,12528,12529,12530,12531,12532,12533,12534,913,914,915,916,917,918, -919,920,921,922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,U,U,U, -U,U,U,U,U,945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961, -963,964,965,966,967,968,969,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048, -1049,1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063, -1064,1065,1066,1067,1068,1069,1070,1071,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,1072, -1073,1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086, -1087,1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101, -1102,1103,257,225,462,224,275,233,283,232,299,237,464,236,333,243,466,242,363, -250,468,249,470,472,474,476,252,234,U,U,U,U,U,U,U,U,U,U,12549,12550,12551, -12552,12553,12554,12555,12556,12557,12558,12559,12560,12561,12562,12563,12564, -12565,12566,12567,12568,12569,12570,12571,12572,12573,12574,12575,12576,12577, -12578,12579,12580,12581,12582,12583,12584,12585,9472,9473,9474,9475,9476,9477, -9478,9479,9480,9481,9482,9483,9484,9485,9486,9487,9488,9489,9490,9491,9492, -9493,9494,9495,9496,9497,9498,9499,9500,9501,9502,9503,9504,9505,9506,9507, -9508,9509,9510,9511,9512,9513,9514,9515,9516,9517,9518,9519,9520,9521,9522, -9523,9524,9525,9526,9527,9528,9529,9530,9531,9532,9533,9534,9535,9536,9537, -9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,21834,38463,22467,25384, -21710,21769,21696,30353,30284,34108,30702,33406,30861,29233,38552,38797,27688, -23433,20474,25353,26263,23736,33018,26696,32942,26114,30414,20985,25942,29100, -32753,34948,20658,22885,25034,28595,33453,25420,25170,21485,21543,31494,20843, -30116,24052,25300,36299,38774,25226,32793,22365,38712,32610,29240,30333,26575, -30334,25670,20336,36133,25308,31255,26001,29677,25644,25203,33324,39041,26495, -29256,25198,25292,20276,29923,21322,21150,32458,37030,24110,26758,27036,33152, -32465,26834,30917,34444,38225,20621,35876,33502,32990,21253,35090,21093,34180, -38649,20445,22561,39281,23453,25265,25253,26292,35961,40077,29190,26479,30865, -24754,21329,21271,36744,32972,36125,38049,20493,29384,22791,24811,28953,34987, -22868,33519,26412,31528,23849,32503,29997,27893,36454,36856,36924,40763,27604, -37145,31508,24444,30887,34006,34109,27605,27609,27606,24065,24199,30201,38381, -25949,24330,24517,36767,22721,33218,36991,38491,38829,36793,32534,36140,25153, -20415,21464,21342,36776,36777,36779,36941,26631,24426,33176,34920,40150,24971, -21035,30250,24428,25996,28626,28392,23486,25672,20853,20912,26564,19993,31177, -39292,28851,30149,24182,29627,33760,25773,25320,38069,27874,21338,21187,25615, -38082,31636,20271,24091,33334,33046,33162,28196,27850,39539,25429,21340,21754, -34917,22496,19981,24067,27493,31807,37096,24598,25830,29468,35009,26448,25165, -36130,30572,36393,37319,24425,33756,34081,39184,21442,34453,27531,24813,24808, -28799,33485,33329,20179,27815,34255,25805,31961,27133,26361,33609,21397,31574, -20391,20876,27979,23618,36461,25554,21449,33580,33590,26597,30900,25661,23519, -23700,24046,35815,25286,26612,35962,25600,25530,34633,39307,35863,32544,38130, -20135,38416,39076,26124,29462,22330,23581,24120,38271,20607,32928,21378,25950, -30021,21809,20513,36229,25220,38046,26397,22066,28526,24034,21557,28818,36710, -25199,25764,25507,24443,28552,37108,33251,36784,23576,26216,24561,27785,38472, -36225,34924,25745,31216,22478,27225,25104,21576,20056,31243,24809,28548,35802, -25215,36894,39563,31204,21507,30196,25345,21273,27744,36831,24347,39536,32827, -40831,20360,23610,36196,32709,26021,28861,20805,20914,34411,23815,23456,25277, -37228,30068,36364,31264,24833,31609,20167,32504,30597,19985,33261,21021,20986, -27249,21416,36487,38148,38607,28353,38500,26970,30784,20648,30679,25616,35302, -22788,25571,24029,31359,26941,20256,33337,21912,20018,30126,31383,24162,24202, -38383,21019,21561,28810,25462,38180,22402,26149,26943,37255,21767,28147,32431, -34850,25139,32496,30133,33576,30913,38604,36766,24904,29943,35789,27492,21050, -36176,27425,32874,33905,22257,21254,20174,19995,20945,31895,37259,31751,20419, -36479,31713,31388,25703,23828,20652,33030,30209,31929,28140,32736,26449,23384, -23544,30923,25774,25619,25514,25387,38169,25645,36798,31572,30249,25171,22823, -21574,27513,20643,25140,24102,27526,20195,36151,34955,24453,36910,24608,32829, -25285,20025,21333,37112,25528,32966,26086,27694,20294,24814,28129,35806,24377, -34507,24403,25377,20826,33633,26723,20992,25443,36424,20498,23707,31095,23548, -21040,31291,24764,36947,30423,24503,24471,30340,36460,28783,30331,31561,30634, -20979,37011,22564,20302,28404,36842,25932,31515,29380,28068,32735,23265,25269, -24213,22320,33922,31532,24093,24351,36882,32532,39072,25474,28359,30872,28857, -20856,38747,22443,30005,20291,30008,24215,24806,22880,28096,27583,30857,21500, -38613,20939,20993,25481,21514,38035,35843,36300,29241,30879,34678,36845,35853, -21472,19969,30447,21486,38025,39030,40718,38189,23450,35746,20002,19996,20908, -33891,25026,21160,26635,20375,24683,20923,27934,20828,25238,26007,38497,35910, -36887,30168,37117,30563,27602,29322,29420,35835,22581,30585,36172,26460,38208, -32922,24230,28193,22930,31471,30701,38203,27573,26029,32526,22534,20817,38431, -23545,22697,21544,36466,25958,39039,22244,38045,30462,36929,25479,21702,22810, -22842,22427,36530,26421,36346,33333,21057,24816,22549,34558,23784,40517,20420, -39069,35769,23077,24694,21380,25212,36943,37122,39295,24681,32780,20799,32819, -23572,39285,27953,20108,36144,21457,32602,31567,20240,20047,38400,27861,29648, -34281,24070,30058,32763,27146,30718,38034,32321,20961,28902,21453,36820,33539, -36137,29359,39277,27867,22346,33459,26041,32938,25151,38450,22952,20223,35775, -32442,25918,33778,38750,21857,39134,32933,21290,35837,21536,32954,24223,27832, -36153,33452,37210,21545,27675,20998,32439,22367,28954,27774,31881,22859,20221, -24575,24868,31914,20016,23553,26539,34562,23792,38155,39118,30127,28925,36898, -20911,32541,35773,22857,20964,20315,21542,22827,25975,32932,23413,25206,25282, -36752,24133,27679,31526,20239,20440,26381,28014,28074,31119,34993,24343,29995, -25242,36741,20463,37340,26023,33071,33105,24220,33104,36212,21103,35206,36171, -22797,20613,20184,38428,29238,33145,36127,23500,35747,38468,22919,32538,21648, -22134,22030,35813,25913,27010,38041,30422,28297,24178,29976,26438,26577,31487, -32925,36214,24863,31174,25954,36195,20872,21018,38050,32568,32923,32434,23703, -28207,26464,31705,30347,39640,33167,32660,31957,25630,38224,31295,21578,21733, -27468,25601,25096,40509,33011,30105,21106,38761,33883,26684,34532,38401,38548, -38124,20010,21508,32473,26681,36319,32789,26356,24218,32697,22466,32831,26775, -24037,25915,21151,24685,40858,20379,36524,20844,23467,24339,24041,27742,25329, -36129,20849,38057,21246,27807,33503,29399,22434,26500,36141,22815,36764,33735, -21653,31629,20272,27837,23396,22993,40723,21476,34506,39592,35895,32929,25925, -39038,22266,38599,21038,29916,21072,23521,25346,35074,20054,25296,24618,26874, -20851,23448,20896,35266,31649,39302,32592,24815,28748,36143,20809,24191,36891, -29808,35268,22317,30789,24402,40863,38394,36712,39740,35809,30328,26690,26588, -36330,36149,21053,36746,28378,26829,38149,37101,22269,26524,35065,36807,21704, -39608,23401,28023,27686,20133,23475,39559,37219,25000,37039,38889,21547,28085, -23506,20989,21898,32597,32752,25788,25421,26097,25022,24717,28938,27735,27721, -22831,26477,33322,22741,22158,35946,27627,37085,22909,32791,21495,28009,21621, -21917,33655,33743,26680,31166,21644,20309,21512,30418,35977,38402,27827,28088, -36203,35088,40548,36154,22079,40657,30165,24456,29408,24680,21756,20136,27178, -34913,24658,36720,21700,28888,34425,40511,27946,23439,24344,32418,21897,20399, -29492,21564,21402,20505,21518,21628,20046,24573,29786,22774,33899,32993,34676, -29392,31946,28246,24359,34382,21804,25252,20114,27818,25143,33457,21719,21326, -29502,28369,30011,21010,21270,35805,27088,24458,24576,28142,22351,27426,29615, -26707,36824,32531,25442,24739,21796,30186,35938,28949,28067,23462,24187,33618, -24908,40644,30970,34647,31783,30343,20976,24822,29004,26179,24140,24653,35854, -28784,25381,36745,24509,24674,34516,22238,27585,24724,24935,21321,24800,26214, -36159,31229,20250,28905,27719,35763,35826,32472,33636,26127,23130,39746,27985, -28151,35905,27963,20249,28779,33719,25110,24785,38669,36135,31096,20987,22334, -22522,26426,30072,31293,31215,31637,32908,39269,36857,28608,35749,40481,23020, -32489,32521,21513,26497,26840,36753,31821,38598,21450,24613,30142,27762,21363, -23241,32423,25380,20960,33034,24049,34015,25216,20864,23395,20238,31085,21058, -24760,27982,23492,23490,35745,35760,26082,24524,38469,22931,32487,32426,22025, -26551,22841,20339,23478,21152,33626,39050,36158,30002,38078,20551,31292,20215, -26550,39550,23233,27516,30417,22362,23574,31546,38388,29006,20860,32937,33392, -22904,32516,33575,26816,26604,30897,30839,25315,25441,31616,20461,21098,20943, -33616,27099,37492,36341,36145,35265,38190,31661,20214,20581,33328,21073,39279, -28176,28293,28071,24314,20725,23004,23558,27974,27743,30086,33931,26728,22870, -35762,21280,37233,38477,34121,26898,30977,28966,33014,20132,37066,27975,39556, -23047,22204,25605,38128,30699,20389,33050,29409,35282,39290,32564,32478,21119, -25945,37237,36735,36739,21483,31382,25581,25509,30342,31224,34903,38454,25130, -21163,33410,26708,26480,25463,30571,31469,27905,32467,35299,22992,25106,34249, -33445,30028,20511,20171,30117,35819,23626,24062,31563,26020,37329,20170,27941, -35167,32039,38182,20165,35880,36827,38771,26187,31105,36817,28908,28024,23613, -21170,33606,20834,33550,30555,26230,40120,20140,24778,31934,31923,32463,20117, -35686,26223,39048,38745,22659,25964,38236,24452,30153,38742,31455,31454,20928, -28847,31384,25578,31350,32416,29590,38893,20037,28792,20061,37202,21417,25937, -26087,33276,33285,21646,23601,30106,38816,25304,29401,30141,23621,39545,33738, -23616,21632,30697,20030,27822,32858,25298,25454,24040,20855,36317,36382,38191, -20465,21477,24807,28844,21095,25424,40515,23071,20518,30519,21367,32482,25733, -25899,25225,25496,20500,29237,35273,20915,35776,32477,22343,33740,38055,20891, -21531,23803,20426,31459,27994,37089,39567,21888,21654,21345,21679,24320,25577, -26999,20975,24936,21002,22570,21208,22350,30733,30475,24247,24951,31968,25179, -25239,20130,28821,32771,25335,28900,38752,22391,33499,26607,26869,30933,39063, -31185,22771,21683,21487,28212,20811,21051,23458,35838,32943,21827,22438,24691, -22353,21549,31354,24656,23380,25511,25248,21475,25187,23495,26543,21741,31391, -33510,37239,24211,35044,22840,22446,25358,36328,33007,22359,31607,20393,24555, -23485,27454,21281,31568,29378,26694,30719,30518,26103,20917,20111,30420,23743, -31397,33909,22862,39745,20608,39304,24871,28291,22372,26118,25414,22256,25324, -25193,24275,38420,22403,25289,21895,34593,33098,36771,21862,33713,26469,36182, -34013,23146,26639,25318,31726,38417,20848,28572,35888,25597,35272,25042,32518, -28866,28389,29701,27028,29436,24266,37070,26391,28010,25438,21171,29282,32769, -20332,23013,37226,28889,28061,21202,20048,38647,38253,34174,30922,32047,20769, -22418,25794,32907,31867,27882,26865,26974,20919,21400,26792,29313,40654,31729, -29432,31163,28435,29702,26446,37324,40100,31036,33673,33620,21519,26647,20029, -21385,21169,30782,21382,21033,20616,20363,20432,30178,31435,31890,27813,38582, -21147,29827,21737,20457,32852,33714,36830,38256,24265,24604,28063,24088,25947, -33080,38142,24651,28860,32451,31918,20937,26753,31921,33391,20004,36742,37327, -26238,20142,35845,25769,32842,20698,30103,29134,23525,36797,28518,20102,25730, -38243,24278,26009,21015,35010,28872,21155,29454,29747,26519,30967,38678,20020, -37051,40158,28107,20955,36161,21533,25294,29618,33777,38646,40836,38083,20278, -32666,20940,28789,38517,23725,39046,21478,20196,28316,29705,27060,30827,39311, -30041,21016,30244,27969,26611,20845,40857,32843,21657,31548,31423,38534,22404, -25314,38471,27004,23044,25602,31699,28431,38475,33446,21346,39045,24208,28809, -25523,21348,34383,40065,40595,30860,38706,36335,36162,40575,28510,31108,24405, -38470,25134,39540,21525,38109,20387,26053,23653,23649,32533,34385,27695,24459, -29575,28388,32511,23782,25371,23402,28390,21365,20081,25504,30053,25249,36718, -20262,20177,27814,32438,35770,33821,34746,32599,36923,38179,31657,39585,35064, -33853,27931,39558,32476,22920,40635,29595,30721,34434,39532,39554,22043,21527, -22475,20080,40614,21334,36808,33033,30610,39314,34542,28385,34067,26364,24930, -28459,35881,33426,33579,30450,27667,24537,33725,29483,33541,38170,27611,30683, -38086,21359,33538,20882,24125,35980,36152,20040,29611,26522,26757,37238,38665, -29028,27809,30473,23186,38209,27599,32654,26151,23504,22969,23194,38376,38391, -20204,33804,33945,27308,30431,38192,29467,26790,23391,30511,37274,38753,31964, -36855,35868,24357,31859,31192,35269,27852,34588,23494,24130,26825,30496,32501, -20885,20813,21193,23081,32517,38754,33495,25551,30596,34256,31186,28218,24217, -22937,34065,28781,27665,25279,30399,25935,24751,38397,26126,34719,40483,38125, -21517,21629,35884,25720,25721,34321,27169,33180,30952,25705,39764,25273,26411, -33707,22696,40664,27819,28448,23518,38476,35851,29279,26576,25287,29281,20137, -22982,27597,22675,26286,24149,21215,24917,26408,30446,30566,29287,31302,25343, -21738,21584,38048,37027,23068,32435,27670,20035,22902,32784,22856,21335,30007, -38590,22218,25376,33041,24700,38393,28118,21602,39297,20869,23273,33021,22958, -38675,20522,27877,23612,25311,20320,21311,33147,36870,28346,34091,25288,24180, -30910,25781,25467,24565,23064,37247,40479,23615,25423,32834,23421,21870,38218, -38221,28037,24744,26592,29406,20957,23425,25319,27870,29275,25197,38062,32445, -33043,27987,20892,24324,22900,21162,24594,22899,26262,34384,30111,25386,25062, -31983,35834,21734,27431,40485,27572,34261,21589,20598,27812,21866,36276,29228, -24085,24597,29750,25293,25490,29260,24472,28227,27966,25856,28504,30424,30928, -30460,30036,21028,21467,20051,24222,26049,32810,32982,25243,21638,21032,28846, -34957,36305,27873,21624,32986,22521,35060,36180,38506,37197,20329,27803,21943, -30406,30768,25256,28921,28558,24429,34028,26842,30844,31735,33192,26379,40527, -25447,30896,22383,30738,38713,25209,25259,21128,29749,27607,21860,33086,30130, -30382,21305,30174,20731,23617,35692,31687,20559,29255,39575,39128,28418,29922, -31080,25735,30629,25340,39057,36139,21697,32856,20050,22378,33529,33805,24179, -20973,29942,35780,23631,22369,27900,39047,23110,30772,39748,36843,31893,21078, -25169,38138,20166,33670,33889,33769,33970,22484,26420,22275,26222,28006,35889, -26333,28689,26399,27450,26646,25114,22971,19971,20932,28422,26578,27791,20854, -26827,22855,27495,30054,23822,33040,40784,26071,31048,31041,39569,36215,23682, -20062,20225,21551,22865,30732,22120,27668,36804,24323,27773,27875,35755,25488, -24688,27965,29301,25190,38030,38085,21315,36801,31614,20191,35878,20094,40660, -38065,38067,21069,28508,36963,27973,35892,22545,23884,27424,27465,26538,21595, -33108,32652,22681,34103,24378,25250,27207,38201,25970,24708,26725,30631,20052, -20392,24039,38808,25772,32728,23789,20431,31373,20999,33540,19988,24623,31363, -38054,20405,20146,31206,29748,21220,33465,25810,31165,23517,27777,38738,36731, -27682,20542,21375,28165,25806,26228,27696,24773,39031,35831,24198,29756,31351, -31179,19992,37041,29699,27714,22234,37195,27845,36235,21306,34502,26354,36527, -23624,39537,28192,21462,23094,40843,36259,21435,22280,39079,26435,37275,27849, -20840,30154,25331,29356,21048,21149,32570,28820,30264,21364,40522,27063,30830, -38592,35033,32676,28982,29123,20873,26579,29924,22756,25880,22199,35753,39286, -25200,32469,24825,28909,22764,20161,20154,24525,38887,20219,35748,20995,22922, -32427,25172,20173,26085,25102,33592,33993,33635,34701,29076,28342,23481,32466, -20887,25545,26580,32905,33593,34837,20754,23418,22914,36785,20083,27741,20837, -35109,36719,38446,34122,29790,38160,38384,28070,33509,24369,25746,27922,33832, -33134,40131,22622,36187,19977,21441,20254,25955,26705,21971,20007,25620,39578, -25195,23234,29791,33394,28073,26862,20711,33678,30722,26432,21049,27801,32433, -20667,21861,29022,31579,26194,29642,33515,26441,23665,21024,29053,34923,38378, -38485,25797,36193,33203,21892,27733,25159,32558,22674,20260,21830,36175,26188, -19978,23578,35059,26786,25422,31245,28903,33421,21242,38902,23569,21736,37045, -32461,22882,36170,34503,33292,33293,36198,25668,23556,24913,28041,31038,35774, -30775,30003,21627,20280,36523,28145,23072,32453,31070,27784,23457,23158,29978, -32958,24910,28183,22768,29983,29989,29298,21319,32499,30465,30427,21097,32988, -22307,24072,22833,29422,26045,28287,35799,23608,34417,21313,30707,25342,26102, -20160,39135,34432,23454,35782,21490,30690,20351,23630,39542,22987,24335,31034, -22763,19990,26623,20107,25325,35475,36893,21183,26159,21980,22124,36866,20181, -20365,37322,39280,27663,24066,24643,23460,35270,35797,25910,25163,39318,23432, -23551,25480,21806,21463,30246,20861,34092,26530,26803,27530,25234,36755,21460, -33298,28113,30095,20070,36174,23408,29087,34223,26257,26329,32626,34560,40653, -40736,23646,26415,36848,26641,26463,25101,31446,22661,24246,25968,28465,24661, -21047,32781,25684,34928,29993,24069,26643,25332,38684,21452,29245,35841,27700, -30561,31246,21550,30636,39034,33308,35828,30805,26388,28865,26031,25749,22070, -24605,31169,21496,19997,27515,32902,23546,21987,22235,20282,20284,39282,24051, -26494,32824,24578,39042,36865,23435,35772,35829,25628,33368,25822,22013,33487, -37221,20439,32032,36895,31903,20723,22609,28335,23487,35785,32899,37240,33948, -31639,34429,38539,38543,32485,39635,30862,23681,31319,36930,38567,31071,23385, -25439,31499,34001,26797,21766,32553,29712,32034,38145,25152,22604,20182,23427, -22905,22612,29549,25374,36427,36367,32974,33492,25260,21488,27888,37214,22826, -24577,27760,22349,25674,36138,30251,28393,22363,27264,30192,28525,35885,35848, -22374,27631,34962,30899,25506,21497,28845,27748,22616,25642,22530,26848,33179, -21776,31958,20504,36538,28108,36255,28907,25487,28059,28372,32486,33796,26691, -36867,28120,38518,35752,22871,29305,34276,33150,30140,35466,26799,21076,36386, -38161,25552,39064,36420,21884,20307,26367,22159,24789,28053,21059,23625,22825, -28155,22635,30000,29980,24684,33300,33094,25361,26465,36834,30522,36339,36148, -38081,24086,21381,21548,28867,27712,24311,20572,20141,24237,25402,33351,36890, -26704,37230,30643,21516,38108,24420,31461,26742,25413,31570,32479,30171,20599, -25237,22836,36879,20984,31171,31361,22270,24466,36884,28034,23648,22303,21520, -20820,28237,22242,25512,39059,33151,34581,35114,36864,21534,23663,33216,25302, -25176,33073,40501,38464,39534,39548,26925,22949,25299,21822,25366,21703,34521, -27964,23043,29926,34972,27498,22806,35916,24367,28286,29609,39037,20024,28919, -23436,30871,25405,26202,30358,24779,23451,23113,19975,33109,27754,29579,20129, -26505,32593,24448,26106,26395,24536,22916,23041,24013,24494,21361,38886,36829, -26693,22260,21807,24799,20026,28493,32500,33479,33806,22996,20255,20266,23614, -32428,26410,34074,21619,30031,32963,21890,39759,20301,28205,35859,23561,24944, -21355,30239,28201,34442,25991,38395,32441,21563,31283,32010,38382,21985,32705, -29934,25373,34583,28065,31389,25105,26017,21351,25569,27779,24043,21596,38056, -20044,27745,35820,23627,26080,33436,26791,21566,21556,27595,27494,20116,25410, -21320,33310,20237,20398,22366,25098,38654,26212,29289,21247,21153,24735,35823, -26132,29081,26512,35199,30802,30717,26224,22075,21560,38177,29306,31232,24687, -24076,24713,33181,22805,24796,29060,28911,28330,27728,29312,27268,34989,24109, -20064,23219,21916,38115,27927,31995,38553,25103,32454,30606,34430,21283,38686, -36758,26247,23777,20384,29421,19979,21414,22799,21523,25472,38184,20808,20185, -40092,32420,21688,36132,34900,33335,38386,28046,24358,23244,26174,38505,29616, -29486,21439,33146,39301,32673,23466,38519,38480,32447,30456,21410,38262,39321, -31665,35140,28248,20065,32724,31077,35814,24819,21709,20139,39033,24055,27233, -20687,21521,35937,33831,30813,38660,21066,21742,22179,38144,28040,23477,28102, -26195,23567,23389,26657,32918,21880,31505,25928,26964,20123,27463,34638,38795, -21327,25375,25658,37034,26012,32961,35856,20889,26800,21368,34809,25032,27844, -27899,35874,23633,34218,33455,38156,27427,36763,26032,24571,24515,20449,34885, -26143,33125,29481,24826,20852,21009,22411,24418,37026,34892,37266,24184,26447, -24615,22995,20804,20982,33016,21256,27769,38596,29066,20241,20462,32670,26429, -21957,38152,31168,34966,32483,22687,25100,38656,34394,22040,39035,24464,35768, -33988,37207,21465,26093,24207,30044,24676,32110,23167,32490,32493,36713,21927, -23459,24748,26059,29572,36873,30307,30505,32474,38772,34203,23398,31348,38634, -34880,21195,29071,24490,26092,35810,23547,39535,24033,27529,27739,35757,35759, -36874,36805,21387,25276,40486,40493,21568,20011,33469,29273,34460,23830,34905, -28079,38597,21713,20122,35766,28937,21693,38409,28895,28153,30416,20005,30740, -34578,23721,24310,35328,39068,38414,28814,27839,22852,25513,30524,34893,28436, -33395,22576,29141,21388,30746,38593,21761,24422,28976,23476,35866,39564,27523, -22830,40495,31207,26472,25196,20335,30113,32650,27915,38451,27687,20208,30162, -20859,26679,28478,36992,33136,22934,29814,25671,23591,36965,31377,35875,23002, -21676,33280,33647,35201,32768,26928,22094,32822,29239,37326,20918,20063,39029, -25494,19994,21494,26355,33099,22812,28082,19968,22777,21307,25558,38129,20381, -20234,34915,39056,22839,36951,31227,20202,33008,30097,27778,23452,23016,24413, -26885,34433,20506,24050,20057,30691,20197,33402,25233,26131,37009,23673,20159, -24441,33222,36920,32900,30123,20134,35028,24847,27589,24518,20041,30410,28322, -35811,35758,35850,35793,24322,32764,32716,32462,33589,33643,22240,27575,38899, -38452,23035,21535,38134,28139,23493,39278,23609,24341,38544,21360,33521,27185, -23156,40560,24212,32552,33721,33828,33829,33639,34631,36814,36194,30408,24433, -39062,30828,26144,21727,25317,20323,33219,30152,24248,38605,36362,34553,21647, -27891,28044,27704,24703,21191,29992,24189,20248,24736,24551,23588,30001,37038, -38080,29369,27833,28216,37193,26377,21451,21491,20305,37321,35825,21448,24188, -36802,28132,20110,30402,27014,34398,24858,33286,20313,20446,36926,40060,24841, -28189,28180,38533,20104,23089,38632,19982,23679,31161,23431,35821,32701,29577, -22495,33419,37057,21505,36935,21947,23786,24481,24840,27442,29425,32946,35465, -28020,23507,35029,39044,35947,39533,40499,28170,20900,20803,22435,34945,21407, -25588,36757,22253,21592,22278,29503,28304,32536,36828,33489,24895,24616,38498, -26352,32422,36234,36291,38053,23731,31908,26376,24742,38405,32792,20113,37095, -21248,38504,20801,36816,34164,37213,26197,38901,23381,21277,30776,26434,26685, -21705,28798,23472,36733,20877,22312,21681,25874,26242,36190,36163,33039,33900, -36973,31967,20991,34299,26531,26089,28577,34468,36481,22122,36896,30338,28790, -29157,36131,25321,21017,27901,36156,24590,22686,24974,26366,36192,25166,21939, -28195,26413,36711,38113,38392,30504,26629,27048,21643,20045,28856,35784,25688, -25995,23429,31364,20538,23528,30651,27617,35449,31896,27838,30415,26025,36759, -23853,23637,34360,26632,21344,25112,31449,28251,32509,27167,31456,24432,28467, -24352,25484,28072,26454,19976,24080,36134,20183,32960,30260,38556,25307,26157, -25214,27836,36213,29031,32617,20806,32903,21484,36974,25240,21746,34544,36761, -32773,38167,34071,36825,27993,29645,26015,30495,29956,30759,33275,36126,38024, -20390,26517,30137,35786,38663,25391,38215,38453,33976,25379,30529,24449,29424, -20105,24596,25972,25327,27491,25919,24103,30151,37073,35777,33437,26525,25903, -21553,34584,30693,32930,33026,27713,20043,32455,32844,30452,26893,27542,25191, -20540,20356,22336,25351,27490,36286,21482,26088,32440,24535,25370,25527,33267, -33268,32622,24092,23769,21046,26234,31209,31258,36136,28825,30164,28382,27835, -31378,20013,30405,24544,38047,34935,32456,31181,32959,37325,20210,20247,33311, -21608,24030,27954,35788,31909,36724,32920,24090,21650,30385,23449,26172,39588, -29664,26666,34523,26417,29482,35832,35803,36880,31481,28891,29038,25284,30633, -22065,20027,33879,26609,21161,34496,36142,38136,31569,20303,27880,31069,39547, -25235,29226,25341,19987,30742,36716,25776,36186,31686,26729,24196,35013,22918, -25758,22766,29366,26894,38181,36861,36184,22368,32512,35846,20934,25417,25305, -21331,26700,29730,33537,37196,21828,30528,28796,27978,20857,21672,36164,23039, -28363,28100,23388,32043,20180,31869,28371,23376,33258,28173,23383,39683,26837, -36394,23447,32508,24635,32437,37049,36208,22863,25549,31199,36275,21330,26063, -31062,35781,38459,32452,38075,32386,22068,37257,26368,32618,23562,36981,26152, -24038,20304,26590,20570,20316,22352,24231,20109,19980,20800,19984,24319,21317, -19989,20120,19998,39730,23404,22121,20008,31162,20031,21269,20039,22829,29243, -21358,27664,22239,32996,39319,27603,30590,40727,20022,20127,40720,20060,20073, -20115,33416,23387,21868,22031,20164,21389,21405,21411,21413,21422,38757,36189, -21274,21493,21286,21294,21310,36188,21350,21347,20994,21000,21006,21037,21043, -21055,21056,21068,21086,21089,21084,33967,21117,21122,21121,21136,21139,20866, -32596,20155,20163,20169,20162,20200,20193,20203,20190,20251,20211,20258,20324, -20213,20261,20263,20233,20267,20318,20327,25912,20314,20317,20319,20311,20274, -20285,20342,20340,20369,20361,20355,20367,20350,20347,20394,20348,20396,20372, -20454,20456,20458,20421,20442,20451,20444,20433,20447,20472,20521,20556,20467, -20524,20495,20526,20525,20478,20508,20492,20517,20520,20606,20547,20565,20552, -20558,20588,20603,20645,20647,20649,20666,20694,20742,20717,20716,20710,20718, -20743,20747,20189,27709,20312,20325,20430,40864,27718,31860,20846,24061,40649, -39320,20865,22804,21241,21261,35335,21264,20971,22809,20821,20128,20822,20147, -34926,34980,20149,33044,35026,31104,23348,34819,32696,20907,20913,20925,20924, -20935,20886,20898,20901,35744,35750,35751,35754,35764,35765,35767,35778,35779, -35787,35791,35790,35794,35795,35796,35798,35800,35801,35804,35807,35808,35812, -35816,35817,35822,35824,35827,35830,35833,35836,35839,35840,35842,35844,35847, -35852,35855,35857,35858,35860,35861,35862,35865,35867,35864,35869,35871,35872, -35873,35877,35879,35882,35883,35886,35887,35890,35891,35893,35894,21353,21370, -38429,38434,38433,38449,38442,38461,38460,38466,38473,38484,38495,38503,38508, -38514,38516,38536,38541,38551,38576,37015,37019,37021,37017,37036,37025,37044, -37043,37046,37050,37048,37040,37071,37061,37054,37072,37060,37063,37075,37094, -37090,37084,37079,37083,37099,37103,37118,37124,37154,37150,37155,37169,37167, -37177,37187,37190,21005,22850,21154,21164,21165,21182,21759,21200,21206,21232, -21471,29166,30669,24308,20981,20988,39727,21430,24321,30042,24047,22348,22441, -22433,22654,22716,22725,22737,22313,22316,22314,22323,22329,22318,22319,22364, -22331,22338,22377,22405,22379,22406,22396,22395,22376,22381,22390,22387,22445, -22436,22412,22450,22479,22439,22452,22419,22432,22485,22488,22490,22489,22482, -22456,22516,22511,22520,22500,22493,22539,22541,22525,22509,22528,22558,22553, -22596,22560,22629,22636,22657,22665,22682,22656,39336,40729,25087,33401,33405, -33407,33423,33418,33448,33412,33422,33425,33431,33433,33451,33464,33470,33456, -33480,33482,33507,33432,33463,33454,33483,33484,33473,33449,33460,33441,33450, -33439,33476,33486,33444,33505,33545,33527,33508,33551,33543,33500,33524,33490, -33496,33548,33531,33491,33553,33562,33542,33556,33557,33504,33493,33564,33617, -33627,33628,33544,33682,33596,33588,33585,33691,33630,33583,33615,33607,33603, -33631,33600,33559,33632,33581,33594,33587,33638,33637,33640,33563,33641,33644, -33642,33645,33646,33712,33656,33715,33716,33696,33706,33683,33692,33669,33660, -33718,33705,33661,33720,33659,33688,33694,33704,33722,33724,33729,33793,33765, -33752,22535,33816,33803,33757,33789,33750,33820,33848,33809,33798,33748,33759, -33807,33795,33784,33785,33770,33733,33728,33830,33776,33761,33884,33873,33882, -33881,33907,33927,33928,33914,33929,33912,33852,33862,33897,33910,33932,33934, -33841,33901,33985,33997,34000,34022,33981,34003,33994,33983,33978,34016,33953, -33977,33972,33943,34021,34019,34060,29965,34104,34032,34105,34079,34106,34134, -34107,34047,34044,34137,34120,34152,34148,34142,34170,30626,34115,34162,34171, -34212,34216,34183,34191,34169,34222,34204,34181,34233,34231,34224,34259,34241, -34268,34303,34343,34309,34345,34326,34364,24318,24328,22844,22849,32823,22869, -22874,22872,21263,23586,23589,23596,23604,25164,25194,25247,25275,25290,25306, -25303,25326,25378,25334,25401,25419,25411,25517,25590,25457,25466,25486,25524, -25453,25516,25482,25449,25518,25532,25586,25592,25568,25599,25540,25566,25550, -25682,25542,25534,25669,25665,25611,25627,25632,25612,25638,25633,25694,25732, -25709,25750,25722,25783,25784,25753,25786,25792,25808,25815,25828,25826,25865, -25893,25902,24331,24530,29977,24337,21343,21489,21501,21481,21480,21499,21522, -21526,21510,21579,21586,21587,21588,21590,21571,21537,21591,21593,21539,21554, -21634,21652,21623,21617,21604,21658,21659,21636,21622,21606,21661,21712,21677, -21698,21684,21714,21671,21670,21715,21716,21618,21667,21717,21691,21695,21708, -21721,21722,21724,21673,21674,21668,21725,21711,21726,21787,21735,21792,21757, -21780,21747,21794,21795,21775,21777,21799,21802,21863,21903,21941,21833,21869, -21825,21845,21823,21840,21820,21815,21846,21877,21878,21879,21811,21808,21852, -21899,21970,21891,21937,21945,21896,21889,21919,21886,21974,21905,21883,21983, -21949,21950,21908,21913,21994,22007,21961,22047,21969,21995,21996,21972,21990, -21981,21956,21999,21989,22002,22003,21964,21965,21992,22005,21988,36756,22046, -22024,22028,22017,22052,22051,22014,22016,22055,22061,22104,22073,22103,22060, -22093,22114,22105,22108,22092,22100,22150,22116,22129,22123,22139,22140,22149, -22163,22191,22228,22231,22237,22241,22261,22251,22265,22271,22276,22282,22281, -22300,24079,24089,24084,24081,24113,24123,24124,24119,24132,24148,24155,24158, -24161,23692,23674,23693,23696,23702,23688,23704,23705,23697,23706,23708,23733, -23714,23741,23724,23723,23729,23715,23745,23735,23748,23762,23780,23755,23781, -23810,23811,23847,23846,23854,23844,23838,23814,23835,23896,23870,23860,23869, -23916,23899,23919,23901,23915,23883,23882,23913,23924,23938,23961,23965,35955, -23991,24005,24435,24439,24450,24455,24457,24460,24469,24473,24476,24488,24493, -24501,24508,34914,24417,29357,29360,29364,29367,29368,29379,29377,29390,29389, -29394,29416,29423,29417,29426,29428,29431,29441,29427,29443,29434,29435,29463, -29459,29473,29450,29470,29469,29461,29474,29497,29477,29484,29496,29489,29520, -29517,29527,29536,29548,29551,29566,33307,22821,39143,22820,22786,39267,39271, -39272,39273,39274,39275,39276,39284,39287,39293,39296,39300,39303,39306,39309, -39312,39313,39315,39316,39317,24192,24209,24203,24214,24229,24224,24249,24245, -24254,24243,36179,24274,24273,24283,24296,24298,33210,24516,24521,24534,24527, -24579,24558,24580,24545,24548,24574,24581,24582,24554,24557,24568,24601,24629, -24614,24603,24591,24589,24617,24619,24586,24639,24609,24696,24697,24699,24698, -24642,24682,24701,24726,24730,24749,24733,24707,24722,24716,24731,24812,24763, -24753,24797,24792,24774,24794,24756,24864,24870,24853,24867,24820,24832,24846, -24875,24906,24949,25004,24980,24999,25015,25044,25077,24541,38579,38377,38379, -38385,38387,38389,38390,38396,38398,38403,38404,38406,38408,38410,38411,38412, -38413,38415,38418,38421,38422,38423,38425,38426,20012,29247,25109,27701,27732, -27740,27722,27811,27781,27792,27796,27788,27752,27753,27764,27766,27782,27817, -27856,27860,27821,27895,27896,27889,27863,27826,27872,27862,27898,27883,27886, -27825,27859,27887,27902,27961,27943,27916,27971,27976,27911,27908,27929,27918, -27947,27981,27950,27957,27930,27983,27986,27988,27955,28049,28015,28062,28064, -27998,28051,28052,27996,28000,28028,28003,28186,28103,28101,28126,28174,28095, -28128,28177,28134,28125,28121,28182,28075,28172,28078,28203,28270,28238,28267, -28338,28255,28294,28243,28244,28210,28197,28228,28383,28337,28312,28384,28461, -28386,28325,28327,28349,28347,28343,28375,28340,28367,28303,28354,28319,28514, -28486,28487,28452,28437,28409,28463,28470,28491,28532,28458,28425,28457,28553, -28557,28556,28536,28530,28540,28538,28625,28617,28583,28601,28598,28610,28641, -28654,28638,28640,28655,28698,28707,28699,28729,28725,28751,28766,23424,23428, -23445,23443,23461,23480,29999,39582,25652,23524,23534,35120,23536,36423,35591, -36790,36819,36821,36837,36846,36836,36841,36838,36851,36840,36869,36868,36875, -36902,36881,36877,36886,36897,36917,36918,36909,36911,36932,36945,36946,36944, -36968,36952,36962,36955,26297,36980,36989,36994,37000,36995,37003,24400,24407, -24406,24408,23611,21675,23632,23641,23409,23651,23654,32700,24362,24361,24365, -33396,24380,39739,23662,22913,22915,22925,22953,22954,22947,22935,22986,22955, -22942,22948,22994,22962,22959,22999,22974,23045,23046,23005,23048,23011,23000, -23033,23052,23049,23090,23092,23057,23075,23059,23104,23143,23114,23125,23100, -23138,23157,33004,23210,23195,23159,23162,23230,23275,23218,23250,23252,23224, -23264,23267,23281,23254,23270,23256,23260,23305,23319,23318,23346,23351,23360, -23573,23580,23386,23397,23411,23377,23379,23394,39541,39543,39544,39546,39551, -39549,39552,39553,39557,39560,39562,39568,39570,39571,39574,39576,39579,39580, -39581,39583,39584,39586,39587,39589,39591,32415,32417,32419,32421,32424,32425, -32429,32432,32446,32448,32449,32450,32457,32459,32460,32464,32468,32471,32475, -32480,32481,32488,32491,32494,32495,32497,32498,32525,32502,32506,32507,32510, -32513,32514,32515,32519,32520,32523,32524,32527,32529,32530,32535,32537,32540, -32539,32543,32545,32546,32547,32548,32549,32550,32551,32554,32555,32556,32557, -32559,32560,32561,32562,32563,32565,24186,30079,24027,30014,37013,29582,29585, -29614,29602,29599,29647,29634,29649,29623,29619,29632,29641,29640,29669,29657, -39036,29706,29673,29671,29662,29626,29682,29711,29738,29787,29734,29733,29736, -29744,29742,29740,29723,29722,29761,29788,29783,29781,29785,29815,29805,29822, -29852,29838,29824,29825,29831,29835,29854,29864,29865,29840,29863,29906,29882, -38890,38891,38892,26444,26451,26462,26440,26473,26533,26503,26474,26483,26520, -26535,26485,26536,26526,26541,26507,26487,26492,26608,26633,26584,26634,26601, -26544,26636,26585,26549,26586,26547,26589,26624,26563,26552,26594,26638,26561, -26621,26674,26675,26720,26721,26702,26722,26692,26724,26755,26653,26709,26726, -26689,26727,26688,26686,26698,26697,26665,26805,26767,26740,26743,26771,26731, -26818,26990,26876,26911,26912,26873,26916,26864,26891,26881,26967,26851,26896, -26993,26937,26976,26946,26973,27012,26987,27008,27032,27000,26932,27084,27015, -27016,27086,27017,26982,26979,27001,27035,27047,27067,27051,27053,27092,27057, -27073,27082,27103,27029,27104,27021,27135,27183,27117,27159,27160,27237,27122, -27204,27198,27296,27216,27227,27189,27278,27257,27197,27176,27224,27260,27281, -27280,27305,27287,27307,29495,29522,27521,27522,27527,27524,27538,27539,27533, -27546,27547,27553,27562,36715,36717,36721,36722,36723,36725,36726,36728,36727, -36729,36730,36732,36734,36737,36738,36740,36743,36747,36749,36750,36751,36760, -36762,36558,25099,25111,25115,25119,25122,25121,25125,25124,25132,33255,29935, -29940,29951,29967,29969,29971,25908,26094,26095,26096,26122,26137,26482,26115, -26133,26112,28805,26359,26141,26164,26161,26166,26165,32774,26207,26196,26177, -26191,26198,26209,26199,26231,26244,26252,26279,26269,26302,26331,26332,26342, -26345,36146,36147,36150,36155,36157,36160,36165,36166,36168,36169,36167,36173, -36181,36185,35271,35274,35275,35276,35278,35279,35280,35281,29294,29343,29277, -29286,29295,29310,29311,29316,29323,29325,29327,29330,25352,25394,25520,25663, -25816,32772,27626,27635,27645,27637,27641,27653,27655,27654,27661,27669,27672, -27673,27674,27681,27689,27684,27690,27698,25909,25941,25963,29261,29266,29270, -29232,34402,21014,32927,32924,32915,32956,26378,32957,32945,32939,32941,32948, -32951,32999,33000,33001,33002,32987,32962,32964,32985,32973,32983,26384,32989, -33003,33009,33012,33005,33037,33038,33010,33020,26389,33042,35930,33078,33054, -33068,33048,33074,33096,33100,33107,33140,33113,33114,33137,33120,33129,33148, -33149,33133,33127,22605,23221,33160,33154,33169,28373,33187,33194,33228,26406, -33226,33211,33217,33190,27428,27447,27449,27459,27462,27481,39121,39122,39123, -39125,39129,39130,27571,24384,27586,35315,26000,40785,26003,26044,26054,26052, -26051,26060,26062,26066,26070,28800,28828,28822,28829,28859,28864,28855,28843, -28849,28904,28874,28944,28947,28950,28975,28977,29043,29020,29032,28997,29042, -29002,29048,29050,29080,29107,29109,29096,29088,29152,29140,29159,29177,29213, -29224,28780,28952,29030,29113,25150,25149,25155,25160,25161,31035,31040,31046, -31049,31067,31068,31059,31066,31074,31063,31072,31087,31079,31098,31109,31114, -31130,31143,31155,24529,24528,24636,24669,24666,24679,24641,24665,24675,24747, -24838,24845,24925,25001,24989,25035,25041,25094,32896,32895,27795,27894,28156, -30710,30712,30720,30729,30743,30744,30737,26027,30765,30748,30749,30777,30778, -30779,30751,30780,30757,30764,30755,30761,30798,30829,30806,30807,30758,30800, -30791,30796,30826,30875,30867,30874,30855,30876,30881,30883,30898,30905,30885, -30932,30937,30921,30956,30962,30981,30964,30995,31012,31006,31028,40859,40697, -40699,40700,30449,30468,30477,30457,30471,30472,30490,30498,30489,30509,30502, -30517,30520,30544,30545,30535,30531,30554,30568,30562,30565,30591,30605,30589, -30592,30604,30609,30623,30624,30640,30645,30653,30010,30016,30030,30027,30024, -30043,30066,30073,30083,32600,32609,32607,35400,32616,32628,32625,32633,32641, -32638,30413,30437,34866,38021,38022,38023,38027,38026,38028,38029,38031,38032, -38036,38039,38037,38042,38043,38044,38051,38052,38059,38058,38061,38060,38063, -38064,38066,38068,38070,38071,38072,38073,38074,38076,38077,38079,38084,38088, -38089,38090,38091,38092,38093,38094,38096,38097,38098,38101,38102,38103,38105, -38104,38107,38110,38111,38112,38114,38116,38117,38119,38120,38122,38121,38123, -38126,38127,38131,38132,38133,38135,38137,38140,38141,38143,38147,38146,38150, -38151,38153,38154,38157,38158,38159,38162,38163,38164,38165,38166,38168,38171, -38173,38174,38175,38178,38186,38187,38185,38188,38193,38194,38196,38198,38199, -38200,38204,38206,38207,38210,38197,38212,38213,38214,38217,38220,38222,38223, -38226,38227,38228,38230,38231,38232,38233,38235,38238,38239,38237,38241,38242, -38244,38245,38246,38247,38248,38249,38250,38251,38252,38255,38257,38258,38259, -38202,30695,30700,38601,31189,31213,31203,31211,31238,23879,31235,31234,31262, -31252,31289,31287,31313,40655,39333,31344,30344,30350,30355,30361,30372,29918, -29920,29996,40480,40482,40488,40489,40490,40491,40492,40498,40497,40502,40504, -40503,40505,40506,40510,40513,40514,40516,40518,40519,40520,40521,40523,40524, -40526,40529,40533,40535,40538,40539,40540,40542,40547,40550,40551,40552,40553, -40554,40555,40556,40561,40557,40563,30098,30100,30102,30112,30109,30124,30115, -30131,30132,30136,30148,30129,30128,30147,30146,30166,30157,30179,30184,30182, -30180,30187,30183,30211,30193,30204,30207,30224,30208,30213,30220,30231,30218, -30245,30232,30229,30233,30235,30268,30242,30240,30272,30253,30256,30271,30261, -30275,30270,30259,30285,30302,30292,30300,30294,30315,30319,32714,31462,31352, -31353,31360,31366,31368,31381,31398,31392,31404,31400,31405,31411,34916,34921, -34930,34941,34943,34946,34978,35014,34999,35004,35017,35042,35022,35043,35045, -35057,35098,35068,35048,35070,35056,35105,35097,35091,35099,35082,35124,35115, -35126,35137,35174,35195,30091,32997,30386,30388,30684,32786,32788,32790,32796, -32800,32802,32805,32806,32807,32809,32808,32817,32779,32821,32835,32838,32845, -32850,32873,32881,35203,39032,39040,39043,39049,39052,39053,39055,39060,39066, -39067,39070,39071,39073,39074,39077,39078,34381,34388,34412,34414,34431,34426, -34428,34427,34472,34445,34443,34476,34461,34471,34467,34474,34451,34473,34486, -34500,34485,34510,34480,34490,34481,34479,34505,34511,34484,34537,34545,34546, -34541,34547,34512,34579,34526,34548,34527,34520,34513,34563,34567,34552,34568, -34570,34573,34569,34595,34619,34590,34597,34606,34586,34622,34632,34612,34609, -34601,34615,34623,34690,34594,34685,34686,34683,34656,34672,34636,34670,34699, -34643,34659,34684,34660,34649,34661,34707,34735,34728,34770,34758,34696,34693, -34733,34711,34691,34731,34789,34732,34741,34739,34763,34771,34749,34769,34752, -34762,34779,34794,34784,34798,34838,34835,34814,34826,34843,34849,34873,34876, -32566,32578,32580,32581,33296,31482,31485,31496,31491,31492,31509,31498,31531, -31503,31559,31544,31530,31513,31534,31537,31520,31525,31524,31539,31550,31518, -31576,31578,31557,31605,31564,31581,31584,31598,31611,31586,31602,31601,31632, -31654,31655,31672,31660,31645,31656,31621,31658,31644,31650,31659,31668,31697, -31681,31692,31709,31706,31717,31718,31722,31756,31742,31740,31759,31766,31755, -31775,31786,31782,31800,31809,31808,33278,33281,33282,33284,33260,34884,33313, -33314,33315,33325,33327,33320,33323,33336,33339,33331,33332,33342,33348,33353, -33355,33359,33370,33375,33384,34942,34949,34952,35032,35039,35166,32669,32671, -32679,32687,32688,32690,31868,25929,31889,31901,31900,31902,31906,31922,31932, -31933,31937,31943,31948,31949,31944,31941,31959,31976,33390,26280,32703,32718, -32725,32741,32737,32742,32745,32750,32755,31992,32119,32166,32174,32327,32411, -40632,40628,36211,36228,36244,36241,36273,36199,36205,35911,35913,37194,37200, -37198,37199,37220,37218,37217,37232,37225,37231,37245,37246,37234,37236,37241, -37260,37253,37264,37261,37265,37282,37283,37290,37293,37294,37295,37301,37300, -37306,35925,40574,36280,36331,36357,36441,36457,36277,36287,36284,36282,36292, -36310,36311,36314,36318,36302,36303,36315,36294,36332,36343,36344,36323,36345, -36347,36324,36361,36349,36372,36381,36383,36396,36398,36387,36399,36410,36416, -36409,36405,36413,36401,36425,36417,36418,36433,36434,36426,36464,36470,36476, -36463,36468,36485,36495,36500,36496,36508,36510,35960,35970,35978,35973,35992, -35988,26011,35286,35294,35290,35292,35301,35307,35311,35390,35622,38739,38633, -38643,38639,38662,38657,38664,38671,38670,38698,38701,38704,38718,40832,40835, -40837,40838,40839,40840,40841,40842,40844,40702,40715,40717,38585,38588,38589, -38606,38610,30655,38624,37518,37550,37576,37694,37738,37834,37775,37950,37995, -40063,40066,40069,40070,40071,40072,31267,40075,40078,40080,40081,40082,40084, -40085,40090,40091,40094,40095,40096,40097,40098,40099,40101,40102,40103,40104, -40105,40107,40109,40110,40112,40113,40114,40115,40116,40117,40118,40119,40122, -40123,40124,40125,40132,40133,40134,40135,40138,40139,40140,40141,40142,40143, -40144,40147,40148,40149,40151,40152,40153,40156,40157,40159,40162,38780,38789, -38801,38802,38804,38831,38827,38819,38834,38836,39601,39600,39607,40536,39606, -39610,39612,39617,39616,39621,39618,39627,39628,39633,39749,39747,39751,39753, -39752,39757,39761,39144,39181,39214,39253,39252,39647,39649,39654,39663,39659, -39675,39661,39673,39688,39695,39699,39711,39715,40637,40638,32315,40578,40583, -40584,40587,40594,37846,40605,40607,40667,40668,40669,40672,40671,40674,40681, -40679,40677,40682,40687,40738,40748,40751,40761,40759,40765,40766,40772, -}; - -static const struct dbcs_index gb2312_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gb2312_decmap+0,33,126},{__gb2312_decmap+94, -49,124},{__gb2312_decmap+170,33,126},{__gb2312_decmap+264,33,115},{ -__gb2312_decmap+347,33,118},{__gb2312_decmap+433,33,88},{__gb2312_decmap+489, -33,113},{__gb2312_decmap+570,33,105},{__gb2312_decmap+643,36,111},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gb2312_decmap+719,33,126},{ -__gb2312_decmap+813,33,126},{__gb2312_decmap+907,33,126},{__gb2312_decmap+1001 -,33,126},{__gb2312_decmap+1095,33,126},{__gb2312_decmap+1189,33,126},{ -__gb2312_decmap+1283,33,126},{__gb2312_decmap+1377,33,126},{__gb2312_decmap+ -1471,33,126},{__gb2312_decmap+1565,33,126},{__gb2312_decmap+1659,33,126},{ -__gb2312_decmap+1753,33,126},{__gb2312_decmap+1847,33,126},{__gb2312_decmap+ -1941,33,126},{__gb2312_decmap+2035,33,126},{__gb2312_decmap+2129,33,126},{ -__gb2312_decmap+2223,33,126},{__gb2312_decmap+2317,33,126},{__gb2312_decmap+ -2411,33,126},{__gb2312_decmap+2505,33,126},{__gb2312_decmap+2599,33,126},{ -__gb2312_decmap+2693,33,126},{__gb2312_decmap+2787,33,126},{__gb2312_decmap+ -2881,33,126},{__gb2312_decmap+2975,33,126},{__gb2312_decmap+3069,33,126},{ -__gb2312_decmap+3163,33,126},{__gb2312_decmap+3257,33,126},{__gb2312_decmap+ -3351,33,126},{__gb2312_decmap+3445,33,126},{__gb2312_decmap+3539,33,126},{ -__gb2312_decmap+3633,33,126},{__gb2312_decmap+3727,33,126},{__gb2312_decmap+ -3821,33,126},{__gb2312_decmap+3915,33,126},{__gb2312_decmap+4009,33,126},{ -__gb2312_decmap+4103,33,126},{__gb2312_decmap+4197,33,126},{__gb2312_decmap+ -4291,33,126},{__gb2312_decmap+4385,33,121},{__gb2312_decmap+4474,33,126},{ -__gb2312_decmap+4568,33,126},{__gb2312_decmap+4662,33,126},{__gb2312_decmap+ -4756,33,126},{__gb2312_decmap+4850,33,126},{__gb2312_decmap+4944,33,126},{ -__gb2312_decmap+5038,33,126},{__gb2312_decmap+5132,33,126},{__gb2312_decmap+ -5226,33,126},{__gb2312_decmap+5320,33,126},{__gb2312_decmap+5414,33,126},{ -__gb2312_decmap+5508,33,126},{__gb2312_decmap+5602,33,126},{__gb2312_decmap+ -5696,33,126},{__gb2312_decmap+5790,33,126},{__gb2312_decmap+5884,33,126},{ -__gb2312_decmap+5978,33,126},{__gb2312_decmap+6072,33,126},{__gb2312_decmap+ -6166,33,126},{__gb2312_decmap+6260,33,126},{__gb2312_decmap+6354,33,126},{ -__gb2312_decmap+6448,33,126},{__gb2312_decmap+6542,33,126},{__gb2312_decmap+ -6636,33,126},{__gb2312_decmap+6730,33,126},{__gb2312_decmap+6824,33,126},{ -__gb2312_decmap+6918,33,126},{__gb2312_decmap+7012,33,126},{__gb2312_decmap+ -7106,33,126},{__gb2312_decmap+7200,33,126},{__gb2312_decmap+7294,33,126},{ -__gb2312_decmap+7388,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const ucs2_t __gbkext_decmap[14531] = { -19970,19972,19973,19974,19983,19986,19991,19999,20000,20001,20003,20006,20009, -20014,20015,20017,20019,20021,20023,20028,20032,20033,20034,20036,20038,20042, -20049,20053,20055,20058,20059,20066,20067,20068,20069,20071,20072,20074,20075, -20076,20077,20078,20079,20082,20084,20085,20086,20087,20088,20089,20090,20091, -20092,20093,20095,20096,20097,20098,20099,20100,20101,20103,20106,U,20112, -20118,20119,20121,20124,20125,20126,20131,20138,20143,20144,20145,20148,20150, -20151,20152,20153,20156,20157,20158,20168,20172,20175,20176,20178,20186,20187, -20188,20192,20194,20198,20199,20201,20205,20206,20207,20209,20212,20216,20217, -20218,20220,20222,20224,20226,20227,20228,20229,20230,20231,20232,20235,20236, -20242,20243,20244,20245,20246,20252,20253,20257,20259,20264,20265,20268,20269, -20270,20273,20275,20277,20279,20281,20283,20286,20287,20288,20289,20290,20292, -20293,20295,20296,20297,20298,20299,20300,20306,20308,20310,20321,20322,20326, -20328,20330,20331,20333,20334,20337,20338,20341,20343,20344,20345,20346,20349, -20352,20353,20354,20357,20358,20359,20362,20364,20366,20368,20370,20371,20373, -20374,20376,20377,20378,20380,20382,20383,20385,20386,20388,20395,20397,20400, -20401,20402,20403,20404,20406,20407,20408,20409,20410,20411,20412,20413,20414, -20416,20417,20418,20422,20423,20424,20425,20427,20428,20429,20434,20435,20436, -20437,20438,20441,20443,20448,20450,20452,20453,20455,20459,20460,20464,20466, -20468,20469,20470,20471,20473,20475,20476,20477,20479,20480,20481,20482,20483, -20484,20485,20486,20487,20488,20489,20490,U,20491,20494,20496,20497,20499, -20501,20502,20503,20507,20509,20510,20512,20514,20515,20516,20519,20523,20527, -20528,20529,20530,20531,20532,20533,20534,20535,20536,20537,20539,20541,20543, -20544,20545,20546,20548,20549,20550,20553,20554,20555,20557,20560,20561,20562, -20563,20564,20566,20567,20568,20569,20571,20573,20574,20575,20576,20577,20578, -20579,20580,20582,20583,20584,20585,20586,20587,20589,20590,20591,20592,20593, -20594,20595,20596,20597,20600,20601,20602,20604,20605,20609,20610,20611,20612, -20614,20615,20617,20618,20619,20620,20622,20623,20624,20625,20626,20627,20628, -20629,20630,20631,20632,20633,20634,20635,20636,20637,20638,20639,20640,20641, -20642,20644,20646,20650,20651,20653,20654,20655,20656,20657,20659,20660,20661, -20662,20663,20664,20665,20668,20669,20670,20671,20672,20673,20674,20675,20676, -20677,20678,20679,20680,20681,20682,20683,20684,20685,20686,20688,20689,20690, -20691,20692,20693,20695,20696,20697,20699,20700,20701,20702,20703,20704,20705, -20706,20707,20708,20709,20712,20713,20714,20715,20719,20720,20721,20722,20724, -20726,20727,20728,20729,20730,20732,20733,20734,20735,20736,20737,20738,20739, -20740,20741,20744,U,20745,20746,20748,20749,20750,20751,20752,20753,20755, -20756,20757,20758,20759,20760,20761,20762,20763,20764,20765,20766,20767,20768, -20770,20771,20772,20773,20774,20775,20776,20777,20778,20779,20780,20781,20782, -20783,20784,20785,20786,20787,20788,20789,20790,20791,20792,20793,20794,20795, -20796,20797,20798,20802,20807,20810,20812,20814,20815,20816,20818,20819,20823, -20824,20825,20827,20829,20830,20831,20832,20833,20835,20836,20838,20839,20841, -20842,20847,20850,20858,20862,20863,20867,20868,20870,20871,20874,20875,20878, -20879,20880,20881,20883,20884,20888,20890,20893,20894,20895,20897,20899,20902, -20903,20904,20905,20906,20909,20910,20916,20920,20921,20922,20926,20927,20929, -20930,20931,20933,20936,20938,20941,20942,20944,20946,20947,20948,20949,20950, -20951,20952,20953,20954,20956,20958,20959,20962,20963,20965,20966,20967,20968, -20969,20970,20972,20974,20977,20978,20980,20983,20990,20996,20997,21001,21003, -21004,21007,21008,21011,21012,21013,21020,21022,21023,21025,21026,21027,21029, -21030,21031,21034,21036,21039,21041,21042,21044,21045,21052,21054,21060,21061, -21062,21063,21064,21065,21067,21070,21071,21074,21075,21077,21079,21080,U, -21081,21082,21083,21085,21087,21088,21090,21091,21092,21094,21096,21099,21100, -21101,21102,21104,21105,21107,21108,21109,21110,21111,21112,21113,21114,21115, -21116,21118,21120,21123,21124,21125,21126,21127,21129,21130,21131,21132,21133, -21134,21135,21137,21138,21140,21141,21142,21143,21144,21145,21146,21148,21156, -21157,21158,21159,21166,21167,21168,21172,21173,21174,21175,21176,21177,21178, -21179,21180,21181,21184,21185,21186,21188,21189,21190,21192,21194,21196,21197, -21198,21199,21201,21203,21204,21205,21207,21209,21210,21211,21212,21213,21214, -21216,21217,21218,21219,21221,21222,21223,21224,21225,21226,21227,21228,21229, -21230,21231,21233,21234,21235,21236,21237,21238,21239,21240,21243,21244,21245, -21249,21250,21251,21252,21255,21257,21258,21259,21260,21262,21265,21266,21267, -21268,21272,21275,21276,21278,21279,21282,21284,21285,21287,21288,21289,21291, -21292,21293,21295,21296,21297,21298,21299,21300,21301,21302,21303,21304,21308, -21309,21312,21314,21316,21318,21323,21324,21325,21328,21332,21336,21337,21339, -21341,21349,21352,21354,21356,21357,21362,21366,21369,21371,21372,21373,21374, -21376,21377,21379,21383,21384,21386,21390,21391,U,21392,21393,21394,21395, -21396,21398,21399,21401,21403,21404,21406,21408,21409,21412,21415,21418,21419, -21420,21421,21423,21424,21425,21426,21427,21428,21429,21431,21432,21433,21434, -21436,21437,21438,21440,21443,21444,21445,21446,21447,21454,21455,21456,21458, -21459,21461,21466,21468,21469,21470,21473,21474,21479,21492,21498,21502,21503, -21504,21506,21509,21511,21515,21524,21528,21529,21530,21532,21538,21540,21541, -21546,21552,21555,21558,21559,21562,21565,21567,21569,21570,21572,21573,21575, -21577,21580,21581,21582,21583,21585,21594,21597,21598,21599,21600,21601,21603, -21605,21607,21609,21610,21611,21612,21613,21614,21615,21616,21620,21625,21626, -21630,21631,21633,21635,21637,21639,21640,21641,21642,21645,21649,21651,21655, -21656,21660,21662,21663,21664,21665,21666,21669,21678,21680,21682,21685,21686, -21687,21689,21690,21692,21694,21699,21701,21706,21707,21718,21720,21723,21728, -21729,21730,21731,21732,21739,21740,21743,21744,21745,21748,21749,21750,21751, -21752,21753,21755,21758,21760,21762,21763,21764,21765,21768,21770,21771,21772, -21773,21774,21778,21779,21781,21782,21783,21784,21785,21786,21788,21789,21790, -21791,21793,21797,21798,U,21800,21801,21803,21805,21810,21812,21813,21814, -21816,21817,21818,21819,21821,21824,21826,21829,21831,21832,21835,21836,21837, -21838,21839,21841,21842,21843,21844,21847,21848,21849,21850,21851,21853,21854, -21855,21856,21858,21859,21864,21865,21867,21871,21872,21873,21874,21875,21876, -21881,21882,21885,21887,21893,21894,21900,21901,21902,21904,21906,21907,21909, -21910,21911,21914,21915,21918,21920,21921,21922,21923,21924,21925,21926,21928, -21929,21930,21931,21932,21933,21934,21935,21936,21938,21940,21942,21944,21946, -21948,21951,21952,21953,21954,21955,21958,21959,21960,21962,21963,21966,21967, -21968,21973,21975,21976,21977,21978,21979,21982,21984,21986,21991,21993,21997, -21998,22000,22001,22004,22006,22008,22009,22010,22011,22012,22015,22018,22019, -22020,22021,22022,22023,22026,22027,22029,22032,22033,22034,22035,22036,22037, -22038,22039,22041,22042,22044,22045,22048,22049,22050,22053,22054,22056,22057, -22058,22059,22062,22063,22064,22067,22069,22071,22072,22074,22076,22077,22078, -22080,22081,22082,22083,22084,22085,22086,22087,22088,22089,22090,22091,22095, -22096,22097,22098,22099,22101,22102,22106,22107,22109,22110,22111,22112,22113, -U,22115,22117,22118,22119,22125,22126,22127,22128,22130,22131,22132,22133, -22135,22136,22137,22138,22141,22142,22143,22144,22145,22146,22147,22148,22151, -22152,22153,22154,22155,22156,22157,22160,22161,22162,22164,22165,22166,22167, -22168,22169,22170,22171,22172,22173,22174,22175,22176,22177,22178,22180,22181, -22182,22183,22184,22185,22186,22187,22188,22189,22190,22192,22193,22194,22195, -22196,22197,22198,22200,22201,22202,22203,22205,22206,22207,22208,22209,22210, -22211,22212,22213,22214,22215,22216,22217,22219,22220,22221,22222,22223,22224, -22225,22226,22227,22229,22230,22232,22233,22236,22243,22245,22246,22247,22248, -22249,22250,22252,22254,22255,22258,22259,22262,22263,22264,22267,22268,22272, -22273,22274,22277,22279,22283,22284,22285,22286,22287,22288,22289,22290,22291, -22292,22293,22294,22295,22296,22297,22298,22299,22301,22302,22304,22305,22306, -22308,22309,22310,22311,22315,22321,22322,22324,22325,22326,22327,22328,22332, -22333,22335,22337,22339,22340,22341,22342,22344,22345,22347,22354,22355,22356, -22357,22358,22360,22361,22370,22371,22373,22375,22380,22382,22384,22385,22386, -22388,22389,22392,22393,22394,22397,22398,22399,22400,U,22401,22407,22408, -22409,22410,22413,22414,22415,22416,22417,22420,22421,22422,22423,22424,22425, -22426,22428,22429,22430,22431,22437,22440,22442,22444,22447,22448,22449,22451, -22453,22454,22455,22457,22458,22459,22460,22461,22462,22463,22464,22465,22468, -22469,22470,22471,22472,22473,22474,22476,22477,22480,22481,22483,22486,22487, -22491,22492,22494,22497,22498,22499,22501,22502,22503,22504,22505,22506,22507, -22508,22510,22512,22513,22514,22515,22517,22518,22519,22523,22524,22526,22527, -22529,22531,22532,22533,22536,22537,22538,22540,22542,22543,22544,22546,22547, -22548,22550,22551,22552,22554,22555,22556,22557,22559,22562,22563,22565,22566, -22567,22568,22569,22571,22572,22573,22574,22575,22577,22578,22579,22580,22582, -22583,22584,22585,22586,22587,22588,22589,22590,22591,22592,22593,22594,22595, -22597,22598,22599,22600,22601,22602,22603,22606,22607,22608,22610,22611,22613, -22614,22615,22617,22618,22619,22620,22621,22623,22624,22625,22626,22627,22628, -22630,22631,22632,22633,22634,22637,22638,22639,22640,22641,22642,22643,22644, -22645,22646,22647,22648,22649,22650,22651,22652,22653,22655,22658,22660,22662, -22663,22664,22666,22667,22668,U,22669,22670,22671,22672,22673,22676,22677, -22678,22679,22680,22683,22684,22685,22688,22689,22690,22691,22692,22693,22694, -22695,22698,22699,22700,22701,22702,22703,22704,22705,22706,22707,22708,22709, -22710,22711,22712,22713,22714,22715,22717,22718,22719,22720,22722,22723,22724, -22726,22727,22728,22729,22730,22731,22732,22733,22734,22735,22736,22738,22739, -22740,22742,22743,22744,22745,22746,22747,22748,22749,22750,22751,22752,22753, -22754,22755,22757,22758,22759,22760,22761,22762,22765,22767,22769,22770,22772, -22773,22775,22776,22778,22779,22780,22781,22782,22783,22784,22785,22787,22789, -22790,22792,22793,22794,22795,22796,22798,22800,22801,22802,22803,22807,22808, -22811,22813,22814,22816,22817,22818,22819,22822,22824,22828,22832,22834,22835, -22837,22838,22843,22845,22846,22847,22848,22851,22853,22854,22858,22860,22861, -22864,22866,22867,22873,22875,22876,22877,22878,22879,22881,22883,22884,22886, -22887,22888,22889,22890,22891,22892,22893,22894,22895,22896,22897,22898,22901, -22903,22906,22907,22908,22910,22911,22912,22917,22921,22923,22924,22926,22927, -22928,22929,22932,22933,22936,22938,22939,22940,22941,22943,22944,22945,22946, -22950,U,22951,22956,22957,22960,22961,22963,22964,22965,22966,22967,22968, -22970,22972,22973,22975,22976,22977,22978,22979,22980,22981,22983,22984,22985, -22988,22989,22990,22991,22997,22998,23001,23003,23006,23007,23008,23009,23010, -23012,23014,23015,23017,23018,23019,23021,23022,23023,23024,23025,23026,23027, -23028,23029,23030,23031,23032,23034,23036,23037,23038,23040,23042,23050,23051, -23053,23054,23055,23056,23058,23060,23061,23062,23063,23065,23066,23067,23069, -23070,23073,23074,23076,23078,23079,23080,23082,23083,23084,23085,23086,23087, -23088,23091,23093,23095,23096,23097,23098,23099,23101,23102,23103,23105,23106, -23107,23108,23109,23111,23112,23115,23116,23117,23118,23119,23120,23121,23122, -23123,23124,23126,23127,23128,23129,23131,23132,23133,23134,23135,23136,23137, -23139,23140,23141,23142,23144,23145,23147,23148,23149,23150,23151,23152,23153, -23154,23155,23160,23161,23163,23164,23165,23166,23168,23169,23170,23171,23172, -23173,23174,23175,23176,23177,23178,23179,23180,23181,23182,23183,23184,23185, -23187,23188,23189,23190,23191,23192,23193,23196,23197,23198,23199,23200,23201, -23202,23203,23204,23205,23206,23207,23208,23209,23211,23212,U,23213,23214, -23215,23216,23217,23220,23222,23223,23225,23226,23227,23228,23229,23231,23232, -23235,23236,23237,23238,23239,23240,23242,23243,23245,23246,23247,23248,23249, -23251,23253,23255,23257,23258,23259,23261,23262,23263,23266,23268,23269,23271, -23272,23274,23276,23277,23278,23279,23280,23282,23283,23284,23285,23286,23287, -23288,23289,23290,23291,23292,23293,23294,23295,23296,23297,23298,23299,23300, -23301,23302,23303,23304,23306,23307,23308,23309,23310,23311,23312,23313,23314, -23315,23316,23317,23320,23321,23322,23323,23324,23325,23326,23327,23328,23329, -23330,23331,23332,23333,23334,23335,23336,23337,23338,23339,23340,23341,23342, -23343,23344,23345,23347,23349,23350,23352,23353,23354,23355,23356,23357,23358, -23359,23361,23362,23363,23364,23365,23366,23367,23368,23369,23370,23371,23372, -23373,23374,23375,23378,23382,23390,23392,23393,23399,23400,23403,23405,23406, -23407,23410,23412,23414,23415,23416,23417,23419,23420,23422,23423,23426,23430, -23434,23437,23438,23440,23441,23442,23444,23446,23455,23463,23464,23465,23468, -23469,23470,23471,23473,23474,23479,23482,23483,23484,23488,23489,23491,23496, -23497,23498,23499,23501,23502,23503,U,23505,23508,23509,23510,23511,23512, -23513,23514,23515,23516,23520,23522,23523,23526,23527,23529,23530,23531,23532, -23533,23535,23537,23538,23539,23540,23541,23542,23543,23549,23550,23552,23554, -23555,23557,23559,23560,23563,23564,23565,23566,23568,23570,23571,23575,23577, -23579,23582,23583,23584,23585,23587,23590,23592,23593,23594,23595,23597,23598, -23599,23600,23602,23603,23605,23606,23607,23619,23620,23622,23623,23628,23629, -23634,23635,23636,23638,23639,23640,23642,23643,23644,23645,23647,23650,23652, -23655,23656,23657,23658,23659,23660,23661,23664,23666,23667,23668,23669,23670, -23671,23672,23675,23676,23677,23678,23680,23683,23684,23685,23686,23687,23689, -23690,23691,23694,23695,23698,23699,23701,23709,23710,23711,23712,23713,23716, -23717,23718,23719,23720,23722,23726,23727,23728,23730,23732,23734,23737,23738, -23739,23740,23742,23744,23746,23747,23749,23750,23751,23752,23753,23754,23756, -23757,23758,23759,23760,23761,23763,23764,23765,23766,23767,23768,23770,23771, -23772,23773,23774,23775,23776,23778,23779,23783,23785,23787,23788,23790,23791, -23793,23794,23795,23796,23797,23798,23799,23800,23801,23802,23804,23805,23806, -23807,23808,U,23809,23812,23813,23816,23817,23818,23819,23820,23821,23823, -23824,23825,23826,23827,23829,23831,23832,23833,23834,23836,23837,23839,23840, -23841,23842,23843,23845,23848,23850,23851,23852,23855,23856,23857,23858,23859, -23861,23862,23863,23864,23865,23866,23867,23868,23871,23872,23873,23874,23875, -23876,23877,23878,23880,23881,23885,23886,23887,23888,23889,23890,23891,23892, -23893,23894,23895,23897,23898,23900,23902,23903,23904,23905,23906,23907,23908, -23909,23910,23911,23912,23914,23917,23918,23920,23921,23922,23923,23925,23926, -23927,23928,23929,23930,23931,23932,23933,23934,23935,23936,23937,23939,23940, -23941,23942,23943,23944,23945,23946,23947,23948,23949,23950,23951,23952,23953, -23954,23955,23956,23957,23958,23959,23960,23962,23963,23964,23966,23967,23968, -23969,23970,23971,23972,23973,23974,23975,23976,23977,23978,23979,23980,23981, -23982,23983,23984,23985,23986,23987,23988,23989,23990,23992,23993,23994,23995, -23996,23997,23998,23999,24000,24001,24002,24003,24004,24006,24007,24008,24009, -24010,24011,24012,24014,24015,24016,24017,24018,24019,24020,24021,24022,24023, -24024,24025,24026,24028,24031,24032,24035,24036,24042,24044,24045,U,24048, -24053,24054,24056,24057,24058,24059,24060,24063,24064,24068,24071,24073,24074, -24075,24077,24078,24082,24083,24087,24094,24095,24096,24097,24098,24099,24100, -24101,24104,24105,24106,24107,24108,24111,24112,24114,24115,24116,24117,24118, -24121,24122,24126,24127,24128,24129,24131,24134,24135,24136,24137,24138,24139, -24141,24142,24143,24144,24145,24146,24147,24150,24151,24152,24153,24154,24156, -24157,24159,24160,24163,24164,24165,24166,24167,24168,24169,24170,24171,24172, -24173,24174,24175,24176,24177,24181,24183,24185,24190,24193,24194,24195,24197, -24200,24201,24204,24205,24206,24210,24216,24219,24221,24225,24226,24227,24228, -24232,24233,24234,24235,24236,24238,24239,24240,24241,24242,24244,24250,24251, -24252,24253,24255,24256,24257,24258,24259,24260,24261,24262,24263,24264,24267, -24268,24269,24270,24271,24272,24276,24277,24279,24280,24281,24282,24284,24285, -24286,24287,24288,24289,24290,24291,24292,24293,24294,24295,24297,24299,24300, -24301,24302,24303,24304,24305,24306,24307,24309,24312,24313,24315,24316,24317, -24325,24326,24327,24329,24332,24333,24334,24336,24338,24340,24342,24345,24346, -24348,24349,24350,24353,24354,24355,24356,U,24360,24363,24364,24366,24368, -24370,24371,24372,24373,24374,24375,24376,24379,24381,24382,24383,24385,24386, -24387,24388,24389,24390,24391,24392,24393,24394,24395,24396,24397,24398,24399, -24401,24404,24409,24410,24411,24412,24414,24415,24416,24419,24421,24423,24424, -24427,24430,24431,24434,24436,24437,24438,24440,24442,24445,24446,24447,24451, -24454,24461,24462,24463,24465,24467,24468,24470,24474,24475,24477,24478,24479, -24480,24482,24483,24484,24485,24486,24487,24489,24491,24492,24495,24496,24497, -24498,24499,24500,24502,24504,24505,24506,24507,24510,24511,24512,24513,24514, -24519,24520,24522,24523,24526,24531,24532,24533,24538,24539,24540,24542,24543, -24546,24547,24549,24550,24552,24553,24556,24559,24560,24562,24563,24564,24566, -24567,24569,24570,24572,24583,24584,24585,24587,24588,24592,24593,24595,24599, -24600,24602,24606,24607,24610,24611,24612,24620,24621,24622,24624,24625,24626, -24627,24628,24630,24631,24632,24633,24634,24637,24638,24640,24644,24645,24646, -24647,24648,24649,24650,24652,24654,24655,24657,24659,24660,24662,24663,24664, -24667,24668,24670,24671,24672,24673,24677,24678,24686,24689,24690,24692,24693, -24695,24702,24704,U,24705,24706,24709,24710,24711,24712,24714,24715,24718, -24719,24720,24721,24723,24725,24727,24728,24729,24732,24734,24737,24738,24740, -24741,24743,24745,24746,24750,24752,24755,24757,24758,24759,24761,24762,24765, -24766,24767,24768,24769,24770,24771,24772,24775,24776,24777,24780,24781,24782, -24783,24784,24786,24787,24788,24790,24791,24793,24795,24798,24801,24802,24803, -24804,24805,24810,24817,24818,24821,24823,24824,24827,24828,24829,24830,24831, -24834,24835,24836,24837,24839,24842,24843,24844,24848,24849,24850,24851,24852, -24854,24855,24856,24857,24859,24860,24861,24862,24865,24866,24869,24872,24873, -24874,24876,24877,24878,24879,24880,24881,24882,24883,24884,24885,24886,24887, -24888,24889,24890,24891,24892,24893,24894,24896,24897,24898,24899,24900,24901, -24902,24903,24905,24907,24909,24911,24912,24914,24915,24916,24918,24919,24920, -24921,24922,24923,24924,24926,24927,24928,24929,24931,24932,24933,24934,24937, -24938,24939,24940,24941,24942,24943,24945,24946,24947,24948,24950,24952,24953, -24954,24955,24956,24957,24958,24959,24960,24961,24962,24963,24964,24965,24966, -24967,24968,24969,24970,24972,24973,24975,24976,24977,24978,24979,24981,U, -24982,24983,24984,24985,24986,24987,24988,24990,24991,24992,24993,24994,24995, -24996,24997,24998,25002,25003,25005,25006,25007,25008,25009,25010,25011,25012, -25013,25014,25016,25017,25018,25019,25020,25021,25023,25024,25025,25027,25028, -25029,25030,25031,25033,25036,25037,25038,25039,25040,25043,25045,25046,25047, -25048,25049,25050,25051,25052,25053,25054,25055,25056,25057,25058,25059,25060, -25061,25063,25064,25065,25066,25067,25068,25069,25070,25071,25072,25073,25074, -25075,25076,25078,25079,25080,25081,25082,25083,25084,25085,25086,25088,25089, -25090,25091,25092,25093,25095,25097,25107,25108,25113,25116,25117,25118,25120, -25123,25126,25127,25128,25129,25131,25133,25135,25136,25137,25138,25141,25142, -25144,25145,25146,25147,25148,25154,25156,25157,25158,25162,25167,25168,25173, -25174,25175,25177,25178,25180,25181,25182,25183,25184,25185,25186,25188,25189, -25192,25201,25202,25204,25205,25207,25208,25210,25211,25213,25217,25218,25219, -25221,25222,25223,25224,25227,25228,25229,25230,25231,25232,25236,25241,25244, -25245,25246,25251,25254,25255,25257,25258,25261,25262,25263,25264,25266,25267, -25268,25270,25271,25272,25274,25278,25280,25281,U,25283,25291,25295,25297, -25301,25309,25310,25312,25313,25316,25322,25323,25328,25330,25333,25336,25337, -25338,25339,25344,25347,25348,25349,25350,25354,25355,25356,25357,25359,25360, -25362,25363,25364,25365,25367,25368,25369,25372,25382,25383,25385,25388,25389, -25390,25392,25393,25395,25396,25397,25398,25399,25400,25403,25404,25406,25407, -25408,25409,25412,25415,25416,25418,25425,25426,25427,25428,25430,25431,25432, -25433,25434,25435,25436,25437,25440,25444,25445,25446,25448,25450,25451,25452, -25455,25456,25458,25459,25460,25461,25464,25465,25468,25469,25470,25471,25473, -25475,25476,25477,25478,25483,25485,25489,25491,25492,25493,25495,25497,25498, -25499,25500,25501,25502,25503,25505,25508,25510,25515,25519,25521,25522,25525, -25526,25529,25531,25533,25535,25536,25537,25538,25539,25541,25543,25544,25546, -25547,25548,25553,25555,25556,25557,25559,25560,25561,25562,25563,25564,25565, -25567,25570,25572,25573,25574,25575,25576,25579,25580,25582,25583,25584,25585, -25587,25589,25591,25593,25594,25595,25596,25598,25603,25604,25606,25607,25608, -25609,25610,25613,25614,25617,25618,25621,25622,25623,25624,25625,25626,25629, -25631,25634,25635,25636,U,25637,25639,25640,25641,25643,25646,25647,25648, -25649,25650,25651,25653,25654,25655,25656,25657,25659,25660,25662,25664,25666, -25667,25673,25675,25676,25677,25678,25679,25680,25681,25683,25685,25686,25687, -25689,25690,25691,25692,25693,25695,25696,25697,25698,25699,25700,25701,25702, -25704,25706,25707,25708,25710,25711,25712,25713,25714,25715,25716,25717,25718, -25719,25723,25724,25725,25726,25727,25728,25729,25731,25734,25736,25737,25738, -25739,25740,25741,25742,25743,25744,25747,25748,25751,25752,25754,25755,25756, -25757,25759,25760,25761,25762,25763,25765,25766,25767,25768,25770,25771,25775, -25777,25778,25779,25780,25782,25785,25787,25789,25790,25791,25793,25795,25796, -25798,25799,25800,25801,25802,25803,25804,25807,25809,25811,25812,25813,25814, -25817,25818,25819,25820,25821,25823,25824,25825,25827,25829,25831,25832,25833, -25834,25835,25836,25837,25838,25839,25840,25841,25842,25843,25844,25845,25846, -25847,25848,25849,25850,25851,25852,25853,25854,25855,25857,25858,25859,25860, -25861,25862,25863,25864,25866,25867,25868,25869,25870,25871,25872,25873,25875, -25876,25877,25878,25879,25881,25882,25883,25884,25885,25886,25887,25888,25889, -U,25890,25891,25892,25894,25895,25896,25897,25898,25900,25901,25904,25905, -25906,25907,25911,25914,25916,25917,25920,25921,25922,25923,25924,25926,25927, -25930,25931,25933,25934,25936,25938,25939,25940,25943,25944,25946,25948,25951, -25952,25953,25956,25957,25959,25960,25961,25962,25965,25966,25967,25969,25971, -25973,25974,25976,25977,25978,25979,25980,25981,25982,25983,25984,25985,25986, -25987,25988,25989,25990,25992,25993,25994,25997,25998,25999,26002,26004,26005, -26006,26008,26010,26013,26014,26016,26018,26019,26022,26024,26026,26028,26030, -26033,26034,26035,26036,26037,26038,26039,26040,26042,26043,26046,26047,26048, -26050,26055,26056,26057,26058,26061,26064,26065,26067,26068,26069,26072,26073, -26074,26075,26076,26077,26078,26079,26081,26083,26084,26090,26091,26098,26099, -26100,26101,26104,26105,26107,26108,26109,26110,26111,26113,26116,26117,26119, -26120,26121,26123,26125,26128,26129,26130,26134,26135,26136,26138,26139,26140, -26142,26145,26146,26147,26148,26150,26153,26154,26155,26156,26158,26160,26162, -26163,26167,26168,26169,26170,26171,26173,26175,26176,26178,26180,26181,26182, -26183,26184,26185,26186,26189,26190,26192,26193,26200,U,26201,26203,26204, -26205,26206,26208,26210,26211,26213,26215,26217,26218,26219,26220,26221,26225, -26226,26227,26229,26232,26233,26235,26236,26237,26239,26240,26241,26243,26245, -26246,26248,26249,26250,26251,26253,26254,26255,26256,26258,26259,26260,26261, -26264,26265,26266,26267,26268,26270,26271,26272,26273,26274,26275,26276,26277, -26278,26281,26282,26283,26284,26285,26287,26288,26289,26290,26291,26293,26294, -26295,26296,26298,26299,26300,26301,26303,26304,26305,26306,26307,26308,26309, -26310,26311,26312,26313,26314,26315,26316,26317,26318,26319,26320,26321,26322, -26323,26324,26325,26326,26327,26328,26330,26334,26335,26336,26337,26338,26339, -26340,26341,26343,26344,26346,26347,26348,26349,26350,26351,26353,26357,26358, -26360,26362,26363,26365,26369,26370,26371,26372,26373,26374,26375,26380,26382, -26383,26385,26386,26387,26390,26392,26393,26394,26396,26398,26400,26401,26402, -26403,26404,26405,26407,26409,26414,26416,26418,26419,26422,26423,26424,26425, -26427,26428,26430,26431,26433,26436,26437,26439,26442,26443,26445,26450,26452, -26453,26455,26456,26457,26458,26459,26461,26466,26467,26468,26470,26471,26475, -26476,26478,26481,26484,26486,U,26488,26489,26490,26491,26493,26496,26498, -26499,26501,26502,26504,26506,26508,26509,26510,26511,26513,26514,26515,26516, -26518,26521,26523,26527,26528,26529,26532,26534,26537,26540,26542,26545,26546, -26548,26553,26554,26555,26556,26557,26558,26559,26560,26562,26565,26566,26567, -26568,26569,26570,26571,26572,26573,26574,26581,26582,26583,26587,26591,26593, -26595,26596,26598,26599,26600,26602,26603,26605,26606,26610,26613,26614,26615, -26616,26617,26618,26619,26620,26622,26625,26626,26627,26628,26630,26637,26640, -26642,26644,26645,26648,26649,26650,26651,26652,26654,26655,26656,26658,26659, -26660,26661,26662,26663,26664,26667,26668,26669,26670,26671,26672,26673,26676, -26677,26678,26682,26683,26687,26695,26699,26701,26703,26706,26710,26711,26712, -26713,26714,26715,26716,26717,26718,26719,26730,26732,26733,26734,26735,26736, -26737,26738,26739,26741,26744,26745,26746,26747,26748,26749,26750,26751,26752, -26754,26756,26759,26760,26761,26762,26763,26764,26765,26766,26768,26769,26770, -26772,26773,26774,26776,26777,26778,26779,26780,26781,26782,26783,26784,26785, -26787,26788,26789,26793,26794,26795,26796,26798,26801,26802,26804,26806,26807, -26808,U,26809,26810,26811,26812,26813,26814,26815,26817,26819,26820,26821, -26822,26823,26824,26826,26828,26830,26831,26832,26833,26835,26836,26838,26839, -26841,26843,26844,26845,26846,26847,26849,26850,26852,26853,26854,26855,26856, -26857,26858,26859,26860,26861,26863,26866,26867,26868,26870,26871,26872,26875, -26877,26878,26879,26880,26882,26883,26884,26886,26887,26888,26889,26890,26892, -26895,26897,26899,26900,26901,26902,26903,26904,26905,26906,26907,26908,26909, -26910,26913,26914,26915,26917,26918,26919,26920,26921,26922,26923,26924,26926, -26927,26929,26930,26931,26933,26934,26935,26936,26938,26939,26940,26942,26944, -26945,26947,26948,26949,26950,26951,26952,26953,26954,26955,26956,26957,26958, -26959,26960,26961,26962,26963,26965,26966,26968,26969,26971,26972,26975,26977, -26978,26980,26981,26983,26984,26985,26986,26988,26989,26991,26992,26994,26995, -26996,26997,26998,27002,27003,27005,27006,27007,27009,27011,27013,27018,27019, -27020,27022,27023,27024,27025,27026,27027,27030,27031,27033,27034,27037,27038, -27039,27040,27041,27042,27043,27044,27045,27046,27049,27050,27052,27054,27055, -27056,27058,27059,27061,27062,27064,27065,27066,27068,27069,U,27070,27071, -27072,27074,27075,27076,27077,27078,27079,27080,27081,27083,27085,27087,27089, -27090,27091,27093,27094,27095,27096,27097,27098,27100,27101,27102,27105,27106, -27107,27108,27109,27110,27111,27112,27113,27114,27115,27116,27118,27119,27120, -27121,27123,27124,27125,27126,27127,27128,27129,27130,27131,27132,27134,27136, -27137,27138,27139,27140,27141,27142,27143,27144,27145,27147,27148,27149,27150, -27151,27152,27153,27154,27155,27156,27157,27158,27161,27162,27163,27164,27165, -27166,27168,27170,27171,27172,27173,27174,27175,27177,27179,27180,27181,27182, -27184,27186,27187,27188,27190,27191,27192,27193,27194,27195,27196,27199,27200, -27201,27202,27203,27205,27206,27208,27209,27210,27211,27212,27213,27214,27215, -27217,27218,27219,27220,27221,27222,27223,27226,27228,27229,27230,27231,27232, -27234,27235,27236,27238,27239,27240,27241,27242,27243,27244,27245,27246,27247, -27248,27250,27251,27252,27253,27254,27255,27256,27258,27259,27261,27262,27263, -27265,27266,27267,27269,27270,27271,27272,27273,27274,27275,27276,27277,27279, -27282,27283,27284,27285,27286,27288,27289,27290,27291,27292,27293,27294,27295, -27297,27298,27299,27300,27301,27302,U,27303,27304,27306,27309,27310,27311, -27312,27313,27314,27315,27316,27317,27318,27319,27320,27321,27322,27323,27324, -27325,27326,27327,27328,27329,27330,27331,27332,27333,27334,27335,27336,27337, -27338,27339,27340,27341,27342,27343,27344,27345,27346,27347,27348,27349,27350, -27351,27352,27353,27354,27355,27356,27357,27358,27359,27360,27361,27362,27363, -27364,27365,27366,27367,27368,27369,27370,27371,27372,27373,27374,27375,27376, -27377,27378,27379,27380,27381,27382,27383,27384,27385,27386,27387,27388,27389, -27390,27391,27392,27393,27394,27395,27396,27397,27398,27399,27400,27401,27402, -27403,27404,27405,27406,27407,27408,27409,27410,27411,27412,27413,27414,27415, -27416,27417,27418,27419,27420,27421,27422,27423,27429,27430,27432,27433,27434, -27435,27436,27437,27438,27439,27440,27441,27443,27444,27445,27446,27448,27451, -27452,27453,27455,27456,27457,27458,27460,27461,27464,27466,27467,27469,27470, -27471,27472,27473,27474,27475,27476,27477,27478,27479,27480,27482,27483,27484, -27485,27486,27487,27488,27489,27496,27497,27499,27500,27501,27502,27503,27504, -27505,27506,27507,27508,27509,27510,27511,27512,27514,27517,27518,27519,27520, -27525,27528,U,27532,27534,27535,27536,27537,27540,27541,27543,27544,27545, -27548,27549,27550,27551,27552,27554,27555,27556,27557,27558,27559,27560,27561, -27563,27564,27565,27566,27567,27568,27569,27570,27574,27576,27577,27578,27579, -27580,27581,27582,27584,27587,27588,27590,27591,27592,27593,27594,27596,27598, -27600,27601,27608,27610,27612,27613,27614,27615,27616,27618,27619,27620,27621, -27622,27623,27624,27625,27628,27629,27630,27632,27633,27634,27636,27638,27639, -27640,27642,27643,27644,27646,27647,27648,27649,27650,27651,27652,27656,27657, -27658,27659,27660,27662,27666,27671,27676,27677,27678,27680,27683,27685,27691, -27692,27693,27697,27699,27702,27703,27705,27706,27707,27708,27710,27711,27715, -27716,27717,27720,27723,27724,27725,27726,27727,27729,27730,27731,27734,27736, -27737,27738,27746,27747,27749,27750,27751,27755,27756,27757,27758,27759,27761, -27763,27765,27767,27768,27770,27771,27772,27775,27776,27780,27783,27786,27787, -27789,27790,27793,27794,27797,27798,27799,27800,27802,27804,27805,27806,27808, -27810,27816,27820,27823,27824,27828,27829,27830,27831,27834,27840,27841,27842, -27843,27846,27847,27848,27851,27853,27854,27855,27857,27858,27864,U,27865, -27866,27868,27869,27871,27876,27878,27879,27881,27884,27885,27890,27892,27897, -27903,27904,27906,27907,27909,27910,27912,27913,27914,27917,27919,27920,27921, -27923,27924,27925,27926,27928,27932,27933,27935,27936,27937,27938,27939,27940, -27942,27944,27945,27948,27949,27951,27952,27956,27958,27959,27960,27962,27967, -27968,27970,27972,27977,27980,27984,27989,27990,27991,27992,27995,27997,27999, -28001,28002,28004,28005,28007,28008,28011,28012,28013,28016,28017,28018,28019, -28021,28022,28025,28026,28027,28029,28030,28031,28032,28033,28035,28036,28038, -28039,28042,28043,28045,28047,28048,28050,28054,28055,28056,28057,28058,28060, -28066,28069,28076,28077,28080,28081,28083,28084,28086,28087,28089,28090,28091, -28092,28093,28094,28097,28098,28099,28104,28105,28106,28109,28110,28111,28112, -28114,28115,28116,28117,28119,28122,28123,28124,28127,28130,28131,28133,28135, -28136,28137,28138,28141,28143,28144,28146,28148,28149,28150,28152,28154,28157, -28158,28159,28160,28161,28162,28163,28164,28166,28167,28168,28169,28171,28175, -28178,28179,28181,28184,28185,28187,28188,28190,28191,28194,28198,28199,28200, -28202,28204,28206,28208,28209,28211,28213,U,28214,28215,28217,28219,28220, -28221,28222,28223,28224,28225,28226,28229,28230,28231,28232,28233,28234,28235, -28236,28239,28240,28241,28242,28245,28247,28249,28250,28252,28253,28254,28256, -28257,28258,28259,28260,28261,28262,28263,28264,28265,28266,28268,28269,28271, -28272,28273,28274,28275,28276,28277,28278,28279,28280,28281,28282,28283,28284, -28285,28288,28289,28290,28292,28295,28296,28298,28299,28300,28301,28302,28305, -28306,28307,28308,28309,28310,28311,28313,28314,28315,28317,28318,28320,28321, -28323,28324,28326,28328,28329,28331,28332,28333,28334,28336,28339,28341,28344, -28345,28348,28350,28351,28352,28355,28356,28357,28358,28360,28361,28362,28364, -28365,28366,28368,28370,28374,28376,28377,28379,28380,28381,28387,28391,28394, -28395,28396,28397,28398,28399,28400,28401,28402,28403,28405,28406,28407,28408, -28410,28411,28412,28413,28414,28415,28416,28417,28419,28420,28421,28423,28424, -28426,28427,28428,28429,28430,28432,28433,28434,28438,28439,28440,28441,28442, -28443,28444,28445,28446,28447,28449,28450,28451,28453,28454,28455,28456,28460, -28462,28464,28466,28468,28469,28471,28472,28473,28474,28475,28476,28477,28479, -28480,28481,28482,U,28483,28484,28485,28488,28489,28490,28492,28494,28495, -28496,28497,28498,28499,28500,28501,28502,28503,28505,28506,28507,28509,28511, -28512,28513,28515,28516,28517,28519,28520,28521,28522,28523,28524,28527,28528, -28529,28531,28533,28534,28535,28537,28539,28541,28542,28543,28544,28545,28546, -28547,28549,28550,28551,28554,28555,28559,28560,28561,28562,28563,28564,28565, -28566,28567,28568,28569,28570,28571,28573,28574,28575,28576,28578,28579,28580, -28581,28582,28584,28585,28586,28587,28588,28589,28590,28591,28592,28593,28594, -28596,28597,28599,28600,28602,28603,28604,28605,28606,28607,28609,28611,28612, -28613,28614,28615,28616,28618,28619,28620,28621,28622,28623,28624,28627,28628, -28629,28630,28631,28632,28633,28634,28635,28636,28637,28639,28642,28643,28644, -28645,28646,28647,28648,28649,28650,28651,28652,28653,28656,28657,28658,28659, -28660,28661,28662,28663,28664,28665,28666,28667,28668,28669,28670,28671,28672, -28673,28674,28675,28676,28677,28678,28679,28680,28681,28682,28683,28684,28685, -28686,28687,28688,28690,28691,28692,28693,28694,28695,28696,28697,28700,28701, -28702,28703,28704,28705,28706,28708,28709,28710,28711,28712,28713,28714,U, -28715,28716,28717,28718,28719,28720,28721,28722,28723,28724,28726,28727,28728, -28730,28731,28732,28733,28734,28735,28736,28737,28738,28739,28740,28741,28742, -28743,28744,28745,28746,28747,28749,28750,28752,28753,28754,28755,28756,28757, -28758,28759,28760,28761,28762,28763,28764,28765,28767,28768,28769,28770,28771, -28772,28773,28774,28775,28776,28777,28778,28782,28785,28786,28787,28788,28791, -28793,28794,28795,28797,28801,28802,28803,28804,28806,28807,28808,28811,28812, -28813,28815,28816,28817,28819,28823,28824,28826,28827,28830,28831,28832,28833, -28834,28835,28836,28837,28838,28839,28840,28841,28842,28848,28850,28852,28853, -28854,28858,28862,28863,28868,28869,28870,28871,28873,28875,28876,28877,28878, -28879,28880,28881,28882,28883,28884,28885,28886,28887,28890,28892,28893,28894, -28896,28897,28898,28899,28901,28906,28910,28912,28913,28914,28915,28916,28917, -28918,28920,28922,28923,28924,28926,28927,28928,28929,28930,28931,28932,28933, -28934,28935,28936,28939,28940,28941,28942,28943,28945,28946,28948,28951,28955, -28956,28957,28958,28959,28960,28961,28962,28963,28964,28965,28967,28968,28969, -28970,28971,28972,28973,28974,28978,28979,28980,U,28981,28983,28984,28985, -28986,28987,28988,28989,28990,28991,28992,28993,28994,28995,28996,28998,28999, -29000,29001,29003,29005,29007,29008,29009,29010,29011,29012,29013,29014,29015, -29016,29017,29018,29019,29021,29023,29024,29025,29026,29027,29029,29033,29034, -29035,29036,29037,29039,29040,29041,29044,29045,29046,29047,29049,29051,29052, -29054,29055,29056,29057,29058,29059,29061,29062,29063,29064,29065,29067,29068, -29069,29070,29072,29073,29074,29075,29077,29078,29079,29082,29083,29084,29085, -29086,29089,29090,29091,29092,29093,29094,29095,29097,29098,29099,29101,29102, -29103,29104,29105,29106,29108,29110,29111,29112,29114,29115,29116,29117,29118, -29119,29120,29121,29122,29124,29125,29126,29127,29128,29129,29130,29131,29132, -29133,29135,29136,29137,29138,29139,29142,29143,29144,29145,29146,29147,29148, -29149,29150,29151,29153,29154,29155,29156,29158,29160,29161,29162,29163,29164, -29165,29167,29168,29169,29170,29171,29172,29173,29174,29175,29176,29178,29179, -29180,29181,29182,29183,29184,29185,29186,29187,29188,29189,29191,29192,29193, -29194,29195,29196,29197,29198,29199,29200,29201,29202,29203,29204,29205,29206, -29207,29208,29209,29210,U,29211,29212,29214,29215,29216,29217,29218,29219, -29220,29221,29222,29223,29225,29227,29229,29230,29231,29234,29235,29236,29242, -29244,29246,29248,29249,29250,29251,29252,29253,29254,29257,29258,29259,29262, -29263,29264,29265,29267,29268,29269,29271,29272,29274,29276,29278,29280,29283, -29284,29285,29288,29290,29291,29292,29293,29296,29297,29299,29300,29302,29303, -29304,29307,29308,29309,29314,29315,29317,29318,29319,29320,29321,29324,29326, -29328,29329,29331,29332,29333,29334,29335,29336,29337,29338,29339,29340,29341, -29342,29344,29345,29346,29347,29348,29349,29350,29351,29352,29353,29354,29355, -29358,29361,29362,29363,29365,29370,29371,29372,29373,29374,29375,29376,29381, -29382,29383,29385,29386,29387,29388,29391,29393,29395,29396,29397,29398,29400, -29402,29403,183,U,U,U,U,U,8212,8560,8561,8562,8563,8564,8565,8566,8567,8568, -8569,65077,65078,65081,65082,65087,65088,65085,65086,65089,65090,65091,65092, -U,U,65083,65084,65079,65080,65073,U,65075,65076,714,715,729,8211,8213,8229, -8245,8453,8457,8598,8599,8600,8601,8725,8735,8739,8786,8806,8807,8895,9552, -9553,9554,9555,9556,9557,9558,9559,9560,9561,9562,9563,9564,9565,9566,9567, -9568,9569,9570,9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582, -9583,9584,9585,9586,9587,9601,9602,9603,9604,9605,9606,9607,U,9608,9609,9610, -9611,9612,9613,9614,9615,9619,9620,9621,9660,9661,9698,9699,9700,9701,9737, -8853,12306,12317,12318,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,593,U,324,328,U,609,12321,12322,12323,12324,12325,12326, -12327,12328,12329,12963,13198,13199,13212,13213,13214,13217,13252,13262,13265, -13266,13269,65072,65506,65508,U,8481,12849,U,8208,U,U,U,12540,12443,12444, -12541,12542,12294,12445,12446,65097,65098,65099,65100,65101,65102,65103,65104, -65105,65106,65108,65109,65110,65111,65113,65114,65115,65116,65117,65118,65119, -65120,65121,U,65122,65123,65124,65125,65126,65128,65129,65130,65131,U,U,U,U,U, -U,U,U,U,U,U,U,U,12295,29404,29405,29407,29410,29411,29412,29413,29414,29415, -29418,29419,29429,29430,29433,29437,29438,29439,29440,29442,29444,29445,29446, -29447,29448,29449,29451,29452,29453,29455,29456,29457,29458,29460,29464,29465, -29466,29471,29472,29475,29476,29478,29479,29480,29485,29487,29488,29490,29491, -29493,29494,29498,29499,29500,29501,29504,29505,29506,29507,29508,29509,29510, -29511,29512,U,29513,29514,29515,29516,29518,29519,29521,29523,29524,29525, -29526,29528,29529,29530,29531,29532,29533,29534,29535,29537,29538,29539,29540, -29541,29542,29543,29544,29545,29546,29547,29550,29552,29553,29554,29555,29556, -29557,29558,29559,29560,29561,29562,29563,29564,29565,29567,29568,29569,29570, -29571,29573,29574,29576,29578,29580,29581,29583,29584,29586,29587,29588,29589, -29591,29592,29593,29594,29596,29597,29598,29600,29601,29603,29604,29605,29606, -29607,29608,29610,29612,29613,29617,29620,29621,29622,29624,29625,29628,29629, -29630,29631,29633,29635,29636,29637,29638,29639,U,29643,29644,29646,29650, -29651,29652,29653,29654,29655,29656,29658,29659,29660,29661,29663,29665,29666, -29667,29668,29670,29672,29674,29675,29676,29678,29679,29680,29681,29683,29684, -29685,29686,29687,29688,29689,29690,29691,29692,29693,29694,29695,29696,29697, -29698,29700,29703,29704,29707,29708,29709,29710,29713,29714,29715,29716,29717, -29718,29719,29720,29721,29724,29725,29726,29727,29728,29729,29731,29732,29735, -29737,29739,29741,29743,29745,29746,29751,29752,29753,29754,29755,29757,29758, -29759,29760,29762,29763,29764,29765,29766,29767,29768,29769,29770,29771,29772, -29773,U,29774,29775,29776,29777,29778,29779,29780,29782,29784,29789,29792, -29793,29794,29795,29796,29797,29798,29799,29800,29801,29802,29803,29804,29806, -29807,29809,29810,29811,29812,29813,29816,29817,29818,29819,29820,29821,29823, -29826,29828,29829,29830,29832,29833,29834,29836,29837,29839,29841,29842,29843, -29844,29845,29846,29847,29848,29849,29850,29851,29853,29855,29856,29857,29858, -29859,29860,29861,29862,29866,29867,29868,29869,29870,29871,29872,29873,29874, -29875,29876,29877,29878,29879,29880,29881,29883,29884,29885,29886,29887,29888, -29889,29890,29891,29892,29893,29894,29895,U,29896,29897,29898,29899,29900, -29901,29902,29903,29904,29905,29907,29908,29909,29910,29911,29912,29913,29914, -29915,29917,29919,29921,29925,29927,29928,29929,29930,29931,29932,29933,29936, -29937,29938,29939,29941,29944,29945,29946,29947,29948,29949,29950,29952,29953, -29954,29955,29957,29958,29959,29960,29961,29962,29963,29964,29966,29968,29970, -29972,29973,29974,29975,29979,29981,29982,29984,29985,29986,29987,29988,29990, -29991,29994,29998,30004,30006,30009,30012,30013,30015,30017,30018,30019,30020, -30022,30023,30025,30026,30029,30032,30033,30034,30035,30037,30038,30039,30040, -U,30045,30046,30047,30048,30049,30050,30051,30052,30055,30056,30057,30059, -30060,30061,30062,30063,30064,30065,30067,30069,30070,30071,30074,30075,30076, -30077,30078,30080,30081,30082,30084,30085,30087,30088,30089,30090,30092,30093, -30094,30096,30099,30101,30104,30107,30108,30110,30114,30118,30119,30120,30121, -30122,30125,30134,30135,30138,30139,30143,30144,30145,30150,30155,30156,30158, -30159,30160,30161,30163,30167,30169,30170,30172,30173,30175,30176,30177,30181, -30185,30188,30189,30190,30191,30194,30195,30197,30198,30199,30200,30202,30203, -30205,30206,30210,30212,30214,30215,U,30216,30217,30219,30221,30222,30223, -30225,30226,30227,30228,30230,30234,30236,30237,30238,30241,30243,30247,30248, -30252,30254,30255,30257,30258,30262,30263,30265,30266,30267,30269,30273,30274, -30276,30277,30278,30279,30280,30281,30282,30283,30286,30287,30288,30289,30290, -30291,30293,30295,30296,30297,30298,30299,30301,30303,30304,30305,30306,30308, -30309,30310,30311,30312,30313,30314,30316,30317,30318,30320,30321,30322,30323, -30324,30325,30326,30327,30329,30330,30332,30335,30336,30337,30339,30341,30345, -30346,30348,30349,30351,30352,30354,30356,30357,30359,30360,30362,30363,U, -30364,30365,30366,30367,30368,30369,30370,30371,30373,30374,30375,30376,30377, -30378,30379,30380,30381,30383,30384,30387,30389,30390,30391,30392,30393,30394, -30395,30396,30397,30398,30400,30401,30403,30404,30407,30409,30411,30412,30419, -30421,30425,30426,30428,30429,30430,30432,30433,30434,30435,30436,30438,30439, -30440,30441,30442,30443,30444,30445,30448,30451,30453,30454,30455,30458,30459, -30461,30463,30464,30466,30467,30469,30470,30474,30476,30478,30479,30480,30481, -30482,30483,30484,30485,30486,30487,30488,30491,30492,30493,30494,30497,30499, -30500,30501,30503,30506,30507,U,30508,30510,30512,30513,30514,30515,30516, -30521,30523,30525,30526,30527,30530,30532,30533,30534,30536,30537,30538,30539, -30540,30541,30542,30543,30546,30547,30548,30549,30550,30551,30552,30553,30556, -30557,30558,30559,30560,30564,30567,30569,30570,30573,30574,30575,30576,30577, -30578,30579,30580,30581,30582,30583,30584,30586,30587,30588,30593,30594,30595, -30598,30599,30600,30601,30602,30603,30607,30608,30611,30612,30613,30614,30615, -30616,30617,30618,30619,30620,30621,30622,30625,30627,30628,30630,30632,30635, -30637,30638,30639,30641,30642,30644,30646,30647,30648,30649,30650,U,30652, -30654,30656,30657,30658,30659,30660,30661,30662,30663,30664,30665,30666,30667, -30668,30670,30671,30672,30673,30674,30675,30676,30677,30678,30680,30681,30682, -30685,30686,30687,30688,30689,30692,30694,30696,30698,30703,30704,30705,30706, -30708,30709,30711,30713,30714,30715,30716,30723,30724,30725,30726,30727,30728, -30730,30731,30734,30735,30736,30739,30741,30745,30747,30750,30752,30753,30754, -30756,30760,30762,30763,30766,30767,30769,30770,30771,30773,30774,30781,30783, -30785,30786,30787,30788,30790,30792,30793,30794,30795,30797,30799,30801,30803, -30804,30808,30809,30810,U,30811,30812,30814,30815,30816,30817,30818,30819, -30820,30821,30822,30823,30824,30825,30831,30832,30833,30834,30835,30836,30837, -30838,30840,30841,30842,30843,30845,30846,30847,30848,30849,30850,30851,30852, -30853,30854,30856,30858,30859,30863,30864,30866,30868,30869,30870,30873,30877, -30878,30880,30882,30884,30886,30888,30889,30890,30891,30892,30893,30894,30895, -30901,30902,30903,30904,30906,30907,30908,30909,30911,30912,30914,30915,30916, -30918,30919,30920,30924,30925,30926,30927,30929,30930,30931,30934,30935,30936, -30938,30939,30940,30941,30942,30943,30944,30945,30946,30947,U,30948,30949, -30950,30951,30953,30954,30955,30957,30958,30959,30960,30961,30963,30965,30966, -30968,30969,30971,30972,30973,30974,30975,30976,30978,30979,30980,30982,30983, -30984,30985,30986,30987,30988,30989,30990,30991,30992,30993,30994,30996,30997, -30998,30999,31000,31001,31002,31003,31004,31005,31007,31008,31009,31010,31011, -31013,31014,31015,31016,31017,31018,31019,31020,31021,31022,31023,31024,31025, -31026,31027,31029,31030,31031,31032,31033,31037,31039,31042,31043,31044,31045, -31047,31050,31051,31052,31053,31054,31055,31056,31057,31058,31060,31061,31064, -31065,31073,31075,U,31076,31078,31081,31082,31083,31084,31086,31088,31089, -31090,31091,31092,31093,31094,31097,31099,31100,31101,31102,31103,31106,31107, -31110,31111,31112,31113,31115,31116,31117,31118,31120,31121,31122,31123,31124, -31125,31126,31127,31128,31129,31131,31132,31133,31134,31135,31136,31137,31138, -31139,31140,31141,31142,31144,31145,31146,31147,31148,31149,31150,31151,31152, -31153,31154,31156,31157,31158,31159,31160,31164,31167,31170,31172,31173,31175, -31176,31178,31180,31182,31183,31184,31187,31188,31190,31191,31193,31194,31195, -31196,31197,31198,31200,31201,31202,31205,31208,31210,U,31212,31214,31217, -31218,31219,31220,31221,31222,31223,31225,31226,31228,31230,31231,31233,31236, -31237,31239,31240,31241,31242,31244,31247,31248,31249,31250,31251,31253,31254, -31256,31257,31259,31260,31261,31263,31265,31266,31268,31269,31270,31271,31272, -31273,31274,31275,31276,31277,31278,31279,31280,31281,31282,31284,31285,31286, -31288,31290,31294,31296,31297,31298,31299,31300,31301,31303,31304,31305,31306, -31307,31308,31309,31310,31311,31312,31314,31315,31316,31317,31318,31320,31321, -31322,31323,31324,31325,31326,31327,31328,31329,31330,31331,31332,31333,31334, -31335,31336,U,31337,31338,31339,31340,31341,31342,31343,31345,31346,31347, -31349,31355,31356,31357,31358,31362,31365,31367,31369,31370,31371,31372,31374, -31375,31376,31379,31380,31385,31386,31387,31390,31393,31394,31395,31396,31399, -31401,31402,31403,31406,31407,31408,31409,31410,31412,31413,31414,31415,31416, -31417,31418,31419,31420,31421,31422,31424,31425,31426,31427,31428,31429,31430, -31431,31432,31433,31434,31436,31437,31438,31439,31440,31441,31442,31443,31444, -31445,31447,31448,31450,31451,31452,31453,31457,31458,31460,31463,31464,31465, -31466,31467,31468,31470,31472,31473,31474,31475,U,31476,31477,31478,31479, -31480,31483,31484,31486,31488,31489,31490,31493,31495,31497,31500,31501,31502, -31504,31506,31507,31510,31511,31512,31514,31516,31517,31519,31521,31522,31523, -31527,31529,31533,31535,31536,31538,31540,31541,31542,31543,31545,31547,31549, -31551,31552,31553,31554,31555,31556,31558,31560,31562,31565,31566,31571,31573, -31575,31577,31580,31582,31583,31585,31587,31588,31589,31590,31591,31592,31593, -31594,31595,31596,31597,31599,31600,31603,31604,31606,31608,31610,31612,31613, -31615,31617,31618,31619,31620,31622,31623,31624,31625,31626,31627,31628,31630, -31631,U,31633,31634,31635,31638,31640,31641,31642,31643,31646,31647,31648, -31651,31652,31653,31662,31663,31664,31666,31667,31669,31670,31671,31673,31674, -31675,31676,31677,31678,31679,31680,31682,31683,31684,31685,31688,31689,31690, -31691,31693,31694,31695,31696,31698,31700,31701,31702,31703,31704,31707,31708, -31710,31711,31712,31714,31715,31716,31719,31720,31721,31723,31724,31725,31727, -31728,31730,31731,31732,31733,31734,31736,31737,31738,31739,31741,31743,31744, -31745,31746,31747,31748,31749,31750,31752,31753,31754,31757,31758,31760,31761, -31762,31763,31764,31765,31767,31768,31769,U,31770,31771,31772,31773,31774, -31776,31777,31778,31779,31780,31781,31784,31785,31787,31788,31789,31790,31791, -31792,31793,31794,31795,31796,31797,31798,31799,31801,31802,31803,31804,31805, -31806,31810,31811,31812,31813,31814,31815,31816,31817,31818,31819,31820,31822, -31823,31824,31825,31826,31827,31828,31829,31830,31831,31832,31833,31834,31835, -31836,31837,31838,31839,31840,31841,31842,31843,31844,31845,31846,31847,31848, -31849,31850,31851,31852,31853,31854,31855,31856,31857,31858,31861,31862,31863, -31864,31865,31866,31870,31871,31872,31873,31874,31875,31876,31877,31878,31879, -U,31880,31882,31883,31884,31885,31886,31887,31888,31891,31892,31894,31897, -31898,31899,31904,31905,31907,31910,31911,31912,31913,31915,31916,31917,31919, -31920,31924,31925,31926,31927,31928,31930,31931,31935,31936,31938,31939,31940, -31942,31945,31947,31950,31951,31952,31953,31954,31955,31956,31960,31962,31963, -31965,31966,31969,31970,31971,31972,31973,31974,31975,31977,31978,31979,31980, -31981,31982,31984,31985,31986,31987,31988,31989,31990,31991,31993,31994,31996, -31997,31998,31999,32000,32001,32002,32003,32004,32005,32006,32007,32008,32009, -32011,32012,32013,32014,32015,32016,U,32017,32018,32019,32020,32021,32022, -32023,32024,32025,32026,32027,32028,32029,32030,32031,32033,32035,32036,32037, -32038,32040,32041,32042,32044,32045,32046,32048,32049,32050,32051,32052,32053, -32054,32055,32056,32057,32058,32059,32060,32061,32062,32063,32064,32065,32066, -32067,32068,32069,32070,32071,32072,32073,32074,32075,32076,32077,32078,32079, -32080,32081,32082,32083,32084,32085,32086,32087,32088,32089,32090,32091,32092, -32093,32094,32095,32096,32097,32098,32099,32100,32101,32102,32103,32104,32105, -32106,32107,32108,32109,32111,32112,32113,32114,32115,32116,32117,32118,U, -32120,32121,32122,32123,32124,32125,32126,32127,32128,32129,32130,32131,32132, -32133,32134,32135,32136,32137,32138,32139,32140,32141,32142,32143,32144,32145, -32146,32147,32148,32149,32150,32151,32152,32153,32154,32155,32156,32157,32158, -32159,32160,32161,32162,32163,32164,32165,32167,32168,32169,32170,32171,32172, -32173,32175,32176,32177,32178,32179,32180,32181,32182,32183,32184,32185,32186, -32187,32188,32189,32190,32191,32192,32193,32194,32195,32196,32197,32198,32199, -32200,32201,32202,32203,32204,32205,32206,32207,32208,32209,32210,32211,32212, -32213,32214,32215,32216,32217,U,32218,32219,32220,32221,32222,32223,32224, -32225,32226,32227,32228,32229,32230,32231,32232,32233,32234,32235,32236,32237, -32238,32239,32240,32241,32242,32243,32244,32245,32246,32247,32248,32249,32250, -32251,32252,32253,32254,32255,32256,32257,32258,32259,32260,32261,32262,32263, -32264,32265,32266,32267,32268,32269,32270,32271,32272,32273,32274,32275,32276, -32277,32278,32279,32280,32281,32282,32283,32284,32285,32286,32287,32288,32289, -32290,32291,32292,32293,32294,32295,32296,32297,32298,32299,32300,32301,32302, -32303,32304,32305,32306,32307,32308,32309,32310,32311,32312,32313,U,32314, -32316,32317,32318,32319,32320,32322,32323,32324,32325,32326,32328,32329,32330, -32331,32332,32333,32334,32335,32336,32337,32338,32339,32340,32341,32342,32343, -32344,32345,32346,32347,32348,32349,32350,32351,32352,32353,32354,32355,32356, -32357,32358,32359,32360,32361,32362,32363,32364,32365,32366,32367,32368,32369, -32370,32371,32372,32373,32374,32375,32376,32377,32378,32379,32380,32381,32382, -32383,32384,32385,32387,32388,32389,32390,32391,32392,32393,32394,32395,32396, -32397,32398,32399,32400,32401,32402,32403,32404,32405,32406,32407,32408,32409, -32410,32412,32413,32414,U,32430,32436,32443,32444,32470,32484,32492,32505, -32522,32528,32542,32567,32569,32571,32572,32573,32574,32575,32576,32577,32579, -32582,32583,32584,32585,32586,32587,32588,32589,32590,32591,32594,32595,32598, -32601,32603,32604,32605,32606,32608,32611,32612,32613,32614,32615,32619,32620, -32621,32623,32624,32627,32629,32630,32631,32632,32634,32635,32636,32637,32639, -32640,32642,32643,32644,32645,32646,32647,32648,32649,32651,32653,32655,32656, -32657,32658,32659,32661,32662,32663,32664,32665,32667,32668,32672,32674,32675, -32677,32678,32680,32681,32682,32683,32684,32685,32686,32689,U,32691,32692, -32693,32694,32695,32698,32699,32702,32704,32706,32707,32708,32710,32711,32712, -32713,32715,32717,32719,32720,32721,32722,32723,32726,32727,32729,32730,32731, -32732,32733,32734,32738,32739,32740,32743,32744,32746,32747,32748,32749,32751, -32754,32756,32757,32758,32759,32760,32761,32762,32765,32766,32767,32770,32775, -32776,32777,32778,32782,32783,32785,32787,32794,32795,32797,32798,32799,32801, -32803,32804,32811,32812,32813,32814,32815,32816,32818,32820,32825,32826,32828, -32830,32832,32833,32836,32837,32839,32840,32841,32846,32847,32848,32849,32851, -32853,32854,32855,U,32857,32859,32860,32861,32862,32863,32864,32865,32866, -32867,32868,32869,32870,32871,32872,32875,32876,32877,32878,32879,32880,32882, -32883,32884,32885,32886,32887,32888,32889,32890,32891,32892,32893,32894,32897, -32898,32901,32904,32906,32909,32910,32911,32912,32913,32914,32916,32917,32919, -32921,32926,32931,32934,32935,32936,32940,32944,32947,32949,32950,32952,32953, -32955,32965,32967,32968,32969,32970,32971,32975,32976,32977,32978,32979,32980, -32981,32984,32991,32992,32994,32995,32998,33006,33013,33015,33017,33019,33022, -33023,33024,33025,33027,33028,33029,33031,33032,33035,U,33036,33045,33047, -33049,33051,33052,33053,33055,33056,33057,33058,33059,33060,33061,33062,33063, -33064,33065,33066,33067,33069,33070,33072,33075,33076,33077,33079,33081,33082, -33083,33084,33085,33087,33088,33089,33090,33091,33092,33093,33095,33097,33101, -33102,33103,33106,33110,33111,33112,33115,33116,33117,33118,33119,33121,33122, -33123,33124,33126,33128,33130,33131,33132,33135,33138,33139,33141,33142,33143, -33144,33153,33155,33156,33157,33158,33159,33161,33163,33164,33165,33166,33168, -33170,33171,33172,33173,33174,33175,33177,33178,33182,33183,33184,33185,33186, -33188,33189,U,33191,33193,33195,33196,33197,33198,33199,33200,33201,33202, -33204,33205,33206,33207,33208,33209,33212,33213,33214,33215,33220,33221,33223, -33224,33225,33227,33229,33230,33231,33232,33233,33234,33235,33236,33237,33238, -33239,33240,33241,33242,33243,33244,33245,33246,33247,33248,33249,33250,33252, -33253,33254,33256,33257,33259,33262,33263,33264,33265,33266,33269,33270,33271, -33272,33273,33274,33277,33279,33283,33287,33288,33289,33290,33291,33294,33295, -33297,33299,33301,33302,33303,33304,33305,33306,33309,33312,33316,33317,33318, -33319,33321,33326,33330,33338,33340,33341,33343,U,33344,33345,33346,33347, -33349,33350,33352,33354,33356,33357,33358,33360,33361,33362,33363,33364,33365, -33366,33367,33369,33371,33372,33373,33374,33376,33377,33378,33379,33380,33381, -33382,33383,33385,33386,33387,33388,33389,33393,33397,33398,33399,33400,33403, -33404,33408,33409,33411,33413,33414,33415,33417,33420,33424,33427,33428,33429, -33430,33434,33435,33438,33440,33442,33443,33447,33458,33461,33462,33466,33467, -33468,33471,33472,33474,33475,33477,33478,33481,33488,33494,33497,33498,33501, -33506,33511,33512,33513,33514,33516,33517,33518,33520,33522,33523,33525,33526, -33528,U,33530,33532,33533,33534,33535,33536,33546,33547,33549,33552,33554, -33555,33558,33560,33561,33565,33566,33567,33568,33569,33570,33571,33572,33573, -33574,33577,33578,33582,33584,33586,33591,33595,33597,33598,33599,33601,33602, -33604,33605,33608,33610,33611,33612,33613,33614,33619,33621,33622,33623,33624, -33625,33629,33634,33648,33649,33650,33651,33652,33653,33654,33657,33658,33662, -33663,33664,33665,33666,33667,33668,33671,33672,33674,33675,33676,33677,33679, -33680,33681,33684,33685,33686,33687,33689,33690,33693,33695,33697,33698,33699, -33700,33701,33702,33703,33708,33709,33710,U,33711,33717,33723,33726,33727, -33730,33731,33732,33734,33736,33737,33739,33741,33742,33744,33745,33746,33747, -33749,33751,33753,33754,33755,33758,33762,33763,33764,33766,33767,33768,33771, -33772,33773,33774,33775,33779,33780,33781,33782,33783,33786,33787,33788,33790, -33791,33792,33794,33797,33799,33800,33801,33802,33808,33810,33811,33812,33813, -33814,33815,33817,33818,33819,33822,33823,33824,33825,33826,33827,33833,33834, -33835,33836,33837,33838,33839,33840,33842,33843,33844,33845,33846,33847,33849, -33850,33851,33854,33855,33856,33857,33858,33859,33860,33861,33863,33864,33865, -U,33866,33867,33868,33869,33870,33871,33872,33874,33875,33876,33877,33878, -33880,33885,33886,33887,33888,33890,33892,33893,33894,33895,33896,33898,33902, -33903,33904,33906,33908,33911,33913,33915,33916,33917,33918,33919,33920,33921, -33923,33924,33925,33926,33930,33933,33935,33936,33937,33938,33939,33940,33941, -33942,33944,33946,33947,33949,33950,33951,33952,33954,33955,33956,33957,33958, -33959,33960,33961,33962,33963,33964,33965,33966,33968,33969,33971,33973,33974, -33975,33979,33980,33982,33984,33986,33987,33989,33990,33991,33992,33995,33996, -33998,33999,34002,34004,34005,34007,U,34008,34009,34010,34011,34012,34014, -34017,34018,34020,34023,34024,34025,34026,34027,34029,34030,34031,34033,34034, -34035,34036,34037,34038,34039,34040,34041,34042,34043,34045,34046,34048,34049, -34050,34051,34052,34053,34054,34055,34056,34057,34058,34059,34061,34062,34063, -34064,34066,34068,34069,34070,34072,34073,34075,34076,34077,34078,34080,34082, -34083,34084,34085,34086,34087,34088,34089,34090,34093,34094,34095,34096,34097, -34098,34099,34100,34101,34102,34110,34111,34112,34113,34114,34116,34117,34118, -34119,34123,34124,34125,34126,34127,34128,34129,34130,34131,34132,34133,U, -34135,34136,34138,34139,34140,34141,34143,34144,34145,34146,34147,34149,34150, -34151,34153,34154,34155,34156,34157,34158,34159,34160,34161,34163,34165,34166, -34167,34168,34172,34173,34175,34176,34177,34178,34179,34182,34184,34185,34186, -34187,34188,34189,34190,34192,34193,34194,34195,34196,34197,34198,34199,34200, -34201,34202,34205,34206,34207,34208,34209,34210,34211,34213,34214,34215,34217, -34219,34220,34221,34225,34226,34227,34228,34229,34230,34232,34234,34235,34236, -34237,34238,34239,34240,34242,34243,34244,34245,34246,34247,34248,34250,34251, -34252,34253,34254,34257,34258,U,34260,34262,34263,34264,34265,34266,34267, -34269,34270,34271,34272,34273,34274,34275,34277,34278,34279,34280,34282,34283, -34284,34285,34286,34287,34288,34289,34290,34291,34292,34293,34294,34295,34296, -34297,34298,34300,34301,34302,34304,34305,34306,34307,34308,34310,34311,34312, -34313,34314,34315,34316,34317,34318,34319,34320,34322,34323,34324,34325,34327, -34328,34329,34330,34331,34332,34333,34334,34335,34336,34337,34338,34339,34340, -34341,34342,34344,34346,34347,34348,34349,34350,34351,34352,34353,34354,34355, -34356,34357,34358,34359,34361,34362,34363,34365,34366,34367,34368,U,34369, -34370,34371,34372,34373,34374,34375,34376,34377,34378,34379,34380,34386,34387, -34389,34390,34391,34392,34393,34395,34396,34397,34399,34400,34401,34403,34404, -34405,34406,34407,34408,34409,34410,34413,34415,34416,34418,34419,34420,34421, -34422,34423,34424,34435,34436,34437,34438,34439,34440,34441,34446,34447,34448, -34449,34450,34452,34454,34455,34456,34457,34458,34459,34462,34463,34464,34465, -34466,34469,34470,34475,34477,34478,34482,34483,34487,34488,34489,34491,34492, -34493,34494,34495,34497,34498,34499,34501,34504,34508,34509,34514,34515,34517, -34518,34519,34522,34524,U,34525,34528,34529,34530,34531,34533,34534,34535, -34536,34538,34539,34540,34543,34549,34550,34551,34554,34555,34556,34557,34559, -34561,34564,34565,34566,34571,34572,34574,34575,34576,34577,34580,34582,34585, -34587,34589,34591,34592,34596,34598,34599,34600,34602,34603,34604,34605,34607, -34608,34610,34611,34613,34614,34616,34617,34618,34620,34621,34624,34625,34626, -34627,34628,34629,34630,34634,34635,34637,34639,34640,34641,34642,34644,34645, -34646,34648,34650,34651,34652,34653,34654,34655,34657,34658,34662,34663,34664, -34665,34666,34667,34668,34669,34671,34673,34674,34675,34677,U,34679,34680, -34681,34682,34687,34688,34689,34692,34694,34695,34697,34698,34700,34702,34703, -34704,34705,34706,34708,34709,34710,34712,34713,34714,34715,34716,34717,34718, -34720,34721,34722,34723,34724,34725,34726,34727,34729,34730,34734,34736,34737, -34738,34740,34742,34743,34744,34745,34747,34748,34750,34751,34753,34754,34755, -34756,34757,34759,34760,34761,34764,34765,34766,34767,34768,34772,34773,34774, -34775,34776,34777,34778,34780,34781,34782,34783,34785,34786,34787,34788,34790, -34791,34792,34793,34795,34796,34797,34799,34800,34801,34802,34803,34804,34805, -34806,34807,34808,U,34810,34811,34812,34813,34815,34816,34817,34818,34820, -34821,34822,34823,34824,34825,34827,34828,34829,34830,34831,34832,34833,34834, -34836,34839,34840,34841,34842,34844,34845,34846,34847,34848,34851,34852,34853, -34854,34855,34856,34857,34858,34859,34860,34861,34862,34863,34864,34865,34867, -34868,34869,34870,34871,34872,34874,34875,34877,34878,34879,34881,34882,34883, -34886,34887,34888,34889,34890,34891,34894,34895,34896,34897,34898,34899,34901, -34902,34904,34906,34907,34908,34909,34910,34911,34912,34918,34919,34922,34925, -34927,34929,34931,34932,34933,34934,34936,34937,34938,U,34939,34940,34944, -34947,34950,34951,34953,34954,34956,34958,34959,34960,34961,34963,34964,34965, -34967,34968,34969,34970,34971,34973,34974,34975,34976,34977,34979,34981,34982, -34983,34984,34985,34986,34988,34990,34991,34992,34994,34995,34996,34997,34998, -35000,35001,35002,35003,35005,35006,35007,35008,35011,35012,35015,35016,35018, -35019,35020,35021,35023,35024,35025,35027,35030,35031,35034,35035,35036,35037, -35038,35040,35041,35046,35047,35049,35050,35051,35052,35053,35054,35055,35058, -35061,35062,35063,35066,35067,35069,35071,35072,35073,35075,35076,35077,35078, -35079,35080,U,35081,35083,35084,35085,35086,35087,35089,35092,35093,35094, -35095,35096,35100,35101,35102,35103,35104,35106,35107,35108,35110,35111,35112, -35113,35116,35117,35118,35119,35121,35122,35123,35125,35127,35128,35129,35130, -35131,35132,35133,35134,35135,35136,35138,35139,35141,35142,35143,35144,35145, -35146,35147,35148,35149,35150,35151,35152,35153,35154,35155,35156,35157,35158, -35159,35160,35161,35162,35163,35164,35165,35168,35169,35170,35171,35172,35173, -35175,35176,35177,35178,35179,35180,35181,35182,35183,35184,35185,35186,35187, -35188,35189,35190,35191,35192,35193,35194,35196,U,35197,35198,35200,35202, -35204,35205,35207,35208,35209,35210,35211,35212,35213,35214,35215,35216,35217, -35218,35219,35220,35221,35222,35223,35224,35225,35226,35227,35228,35229,35230, -35231,35232,35233,35234,35235,35236,35237,35238,35239,35240,35241,35242,35243, -35244,35245,35246,35247,35248,35249,35250,35251,35252,35253,35254,35255,35256, -35257,35258,35259,35260,35261,35262,35263,35264,35267,35277,35283,35284,35285, -35287,35288,35289,35291,35293,35295,35296,35297,35298,35300,35303,35304,35305, -35306,35308,35309,35310,35312,35313,35314,35316,35317,35318,35319,35320,35321, -35322,U,35323,35324,35325,35326,35327,35329,35330,35331,35332,35333,35334, -35336,35337,35338,35339,35340,35341,35342,35343,35344,35345,35346,35347,35348, -35349,35350,35351,35352,35353,35354,35355,35356,35357,35358,35359,35360,35361, -35362,35363,35364,35365,35366,35367,35368,35369,35370,35371,35372,35373,35374, -35375,35376,35377,35378,35379,35380,35381,35382,35383,35384,35385,35386,35387, -35388,35389,35391,35392,35393,35394,35395,35396,35397,35398,35399,35401,35402, -35403,35404,35405,35406,35407,35408,35409,35410,35411,35412,35413,35414,35415, -35416,35417,35418,35419,35420,35421,35422,U,35423,35424,35425,35426,35427, -35428,35429,35430,35431,35432,35433,35434,35435,35436,35437,35438,35439,35440, -35441,35442,35443,35444,35445,35446,35447,35448,35450,35451,35452,35453,35454, -35455,35456,35457,35458,35459,35460,35461,35462,35463,35464,35467,35468,35469, -35470,35471,35472,35473,35474,35476,35477,35478,35479,35480,35481,35482,35483, -35484,35485,35486,35487,35488,35489,35490,35491,35492,35493,35494,35495,35496, -35497,35498,35499,35500,35501,35502,35503,35504,35505,35506,35507,35508,35509, -35510,35511,35512,35513,35514,35515,35516,35517,35518,35519,35520,35521,35522, -U,35523,35524,35525,35526,35527,35528,35529,35530,35531,35532,35533,35534, -35535,35536,35537,35538,35539,35540,35541,35542,35543,35544,35545,35546,35547, -35548,35549,35550,35551,35552,35553,35554,35555,35556,35557,35558,35559,35560, -35561,35562,35563,35564,35565,35566,35567,35568,35569,35570,35571,35572,35573, -35574,35575,35576,35577,35578,35579,35580,35581,35582,35583,35584,35585,35586, -35587,35588,35589,35590,35592,35593,35594,35595,35596,35597,35598,35599,35600, -35601,35602,35603,35604,35605,35606,35607,35608,35609,35610,35611,35612,35613, -35614,35615,35616,35617,35618,35619,U,35620,35621,35623,35624,35625,35626, -35627,35628,35629,35630,35631,35632,35633,35634,35635,35636,35637,35638,35639, -35640,35641,35642,35643,35644,35645,35646,35647,35648,35649,35650,35651,35652, -35653,35654,35655,35656,35657,35658,35659,35660,35661,35662,35663,35664,35665, -35666,35667,35668,35669,35670,35671,35672,35673,35674,35675,35676,35677,35678, -35679,35680,35681,35682,35683,35684,35685,35687,35688,35689,35690,35691,35693, -35694,35695,35696,35697,35698,35699,35700,35701,35702,35703,35704,35705,35706, -35707,35708,35709,35710,35711,35712,35713,35714,35715,35716,35717,35718,U, -35719,35720,35721,35722,35723,35724,35725,35726,35727,35728,35729,35730,35731, -35732,35733,35734,35735,35736,35737,35738,35739,35740,35741,35742,35743,35756, -35761,35771,35783,35792,35818,35849,35870,35896,35897,35898,35899,35900,35901, -35902,35903,35904,35906,35907,35908,35909,35912,35914,35915,35917,35918,35919, -35920,35921,35922,35923,35924,35926,35927,35928,35929,35931,35932,35933,35934, -35935,35936,35939,35940,35941,35942,35943,35944,35945,35948,35949,35950,35951, -35952,35953,35954,35956,35957,35958,35959,35963,35964,35965,35966,35967,35968, -35969,35971,35972,35974,35975,U,35976,35979,35981,35982,35983,35984,35985, -35986,35987,35989,35990,35991,35993,35994,35995,35996,35997,35998,35999,36000, -36001,36002,36003,36004,36005,36006,36007,36008,36009,36010,36011,36012,36013, -36014,36015,36016,36017,36018,36019,36020,36021,36022,36023,36024,36025,36026, -36027,36028,36029,36030,36031,36032,36033,36034,36035,36036,36037,36038,36039, -36040,36041,36042,36043,36044,36045,36046,36047,36048,36049,36050,36051,36052, -36053,36054,36055,36056,36057,36058,36059,36060,36061,36062,36063,36064,36065, -36066,36067,36068,36069,36070,36071,36072,36073,36074,36075,36076,U,36077, -36078,36079,36080,36081,36082,36083,36084,36085,36086,36087,36088,36089,36090, -36091,36092,36093,36094,36095,36096,36097,36098,36099,36100,36101,36102,36103, -36104,36105,36106,36107,36108,36109,36110,36111,36112,36113,36114,36115,36116, -36117,36118,36119,36120,36121,36122,36123,36124,36128,36177,36178,36183,36191, -36197,36200,36201,36202,36204,36206,36207,36209,36210,36216,36217,36218,36219, -36220,36221,36222,36223,36224,36226,36227,36230,36231,36232,36233,36236,36237, -36238,36239,36240,36242,36243,36245,36246,36247,36248,36249,36250,36251,36252, -36253,36254,36256,36257,U,36258,36260,36261,36262,36263,36264,36265,36266, -36267,36268,36269,36270,36271,36272,36274,36278,36279,36281,36283,36285,36288, -36289,36290,36293,36295,36296,36297,36298,36301,36304,36306,36307,36308,36309, -36312,36313,36316,36320,36321,36322,36325,36326,36327,36329,36333,36334,36336, -36337,36338,36340,36342,36348,36350,36351,36352,36353,36354,36355,36356,36358, -36359,36360,36363,36365,36366,36368,36369,36370,36371,36373,36374,36375,36376, -36377,36378,36379,36380,36384,36385,36388,36389,36390,36391,36392,36395,36397, -36400,36402,36403,36404,36406,36407,36408,36411,36412,36414,U,36415,36419, -36421,36422,36428,36429,36430,36431,36432,36435,36436,36437,36438,36439,36440, -36442,36443,36444,36445,36446,36447,36448,36449,36450,36451,36452,36453,36455, -36456,36458,36459,36462,36465,36467,36469,36471,36472,36473,36474,36475,36477, -36478,36480,36482,36483,36484,36486,36488,36489,36490,36491,36492,36493,36494, -36497,36498,36499,36501,36502,36503,36504,36505,36506,36507,36509,36511,36512, -36513,36514,36515,36516,36517,36518,36519,36520,36521,36522,36525,36526,36528, -36529,36531,36532,36533,36534,36535,36536,36537,36539,36540,36541,36542,36543, -36544,36545,36546,U,36547,36548,36549,36550,36551,36552,36553,36554,36555, -36556,36557,36559,36560,36561,36562,36563,36564,36565,36566,36567,36568,36569, -36570,36571,36572,36573,36574,36575,36576,36577,36578,36579,36580,36581,36582, -36583,36584,36585,36586,36587,36588,36589,36590,36591,36592,36593,36594,36595, -36596,36597,36598,36599,36600,36601,36602,36603,36604,36605,36606,36607,36608, -36609,36610,36611,36612,36613,36614,36615,36616,36617,36618,36619,36620,36621, -36622,36623,36624,36625,36626,36627,36628,36629,36630,36631,36632,36633,36634, -36635,36636,36637,36638,36639,36640,36641,36642,36643,U,36644,36645,36646, -36647,36648,36649,36650,36651,36652,36653,36654,36655,36656,36657,36658,36659, -36660,36661,36662,36663,36664,36665,36666,36667,36668,36669,36670,36671,36672, -36673,36674,36675,36676,36677,36678,36679,36680,36681,36682,36683,36684,36685, -36686,36687,36688,36689,36690,36691,36692,36693,36694,36695,36696,36697,36698, -36699,36700,36701,36702,36703,36704,36705,36706,36707,36708,36709,36714,36736, -36748,36754,36765,36768,36769,36770,36772,36773,36774,36775,36778,36780,36781, -36782,36783,36786,36787,36788,36789,36791,36792,36794,36795,36796,36799,36800, -36803,36806,U,36809,36810,36811,36812,36813,36815,36818,36822,36823,36826, -36832,36833,36835,36839,36844,36847,36849,36850,36852,36853,36854,36858,36859, -36860,36862,36863,36871,36872,36876,36878,36883,36885,36888,36889,36892,36899, -36900,36901,36903,36904,36905,36906,36907,36908,36912,36913,36914,36915,36916, -36919,36921,36922,36925,36927,36928,36931,36933,36934,36936,36937,36938,36939, -36940,36942,36948,36949,36950,36953,36954,36956,36957,36958,36959,36960,36961, -36964,36966,36967,36969,36970,36971,36972,36975,36976,36977,36978,36979,36982, -36983,36984,36985,36986,36987,36988,36990,36993,U,36996,36997,36998,36999, -37001,37002,37004,37005,37006,37007,37008,37010,37012,37014,37016,37018,37020, -37022,37023,37024,37028,37029,37031,37032,37033,37035,37037,37042,37047,37052, -37053,37055,37056,37058,37059,37062,37064,37065,37067,37068,37069,37074,37076, -37077,37078,37080,37081,37082,37086,37087,37088,37091,37092,37093,37097,37098, -37100,37102,37104,37105,37106,37107,37109,37110,37111,37113,37114,37115,37116, -37119,37120,37121,37123,37125,37126,37127,37128,37129,37130,37131,37132,37133, -37134,37135,37136,37137,37138,37139,37140,37141,37142,37143,37144,37146,37147, -37148,U,37149,37151,37152,37153,37156,37157,37158,37159,37160,37161,37162, -37163,37164,37165,37166,37168,37170,37171,37172,37173,37174,37175,37176,37178, -37179,37180,37181,37182,37183,37184,37185,37186,37188,37189,37191,37192,37201, -37203,37204,37205,37206,37208,37209,37211,37212,37215,37216,37222,37223,37224, -37227,37229,37235,37242,37243,37244,37248,37249,37250,37251,37252,37254,37256, -37258,37262,37263,37267,37268,37269,37270,37271,37272,37273,37276,37277,37278, -37279,37280,37281,37284,37285,37286,37287,37288,37289,37291,37292,37296,37297, -37298,37299,37302,37303,37304,37305,37307,U,37308,37309,37310,37311,37312, -37313,37314,37315,37316,37317,37318,37320,37323,37328,37330,37331,37332,37333, -37334,37335,37336,37337,37338,37339,37341,37342,37343,37344,37345,37346,37347, -37348,37349,37350,37351,37352,37353,37354,37355,37356,37357,37358,37359,37360, -37361,37362,37363,37364,37365,37366,37367,37368,37369,37370,37371,37372,37373, -37374,37375,37376,37377,37378,37379,37380,37381,37382,37383,37384,37385,37386, -37387,37388,37389,37390,37391,37392,37393,37394,37395,37396,37397,37398,37399, -37400,37401,37402,37403,37404,37405,37406,37407,37408,37409,37410,37411,37412, -U,37413,37414,37415,37416,37417,37418,37419,37420,37421,37422,37423,37424, -37425,37426,37427,37428,37429,37430,37431,37432,37433,37434,37435,37436,37437, -37438,37439,37440,37441,37442,37443,37444,37445,37446,37447,37448,37449,37450, -37451,37452,37453,37454,37455,37456,37457,37458,37459,37460,37461,37462,37463, -37464,37465,37466,37467,37468,37469,37470,37471,37472,37473,37474,37475,37476, -37477,37478,37479,37480,37481,37482,37483,37484,37485,37486,37487,37488,37489, -37490,37491,37493,37494,37495,37496,37497,37498,37499,37500,37501,37502,37503, -37504,37505,37506,37507,37508,37509,U,37510,37511,37512,37513,37514,37515, -37516,37517,37519,37520,37521,37522,37523,37524,37525,37526,37527,37528,37529, -37530,37531,37532,37533,37534,37535,37536,37537,37538,37539,37540,37541,37542, -37543,37544,37545,37546,37547,37548,37549,37551,37552,37553,37554,37555,37556, -37557,37558,37559,37560,37561,37562,37563,37564,37565,37566,37567,37568,37569, -37570,37571,37572,37573,37574,37575,37577,37578,37579,37580,37581,37582,37583, -37584,37585,37586,37587,37588,37589,37590,37591,37592,37593,37594,37595,37596, -37597,37598,37599,37600,37601,37602,37603,37604,37605,37606,37607,37608,U, -37609,37610,37611,37612,37613,37614,37615,37616,37617,37618,37619,37620,37621, -37622,37623,37624,37625,37626,37627,37628,37629,37630,37631,37632,37633,37634, -37635,37636,37637,37638,37639,37640,37641,37642,37643,37644,37645,37646,37647, -37648,37649,37650,37651,37652,37653,37654,37655,37656,37657,37658,37659,37660, -37661,37662,37663,37664,37665,37666,37667,37668,37669,37670,37671,37672,37673, -37674,37675,37676,37677,37678,37679,37680,37681,37682,37683,37684,37685,37686, -37687,37688,37689,37690,37691,37692,37693,37695,37696,37697,37698,37699,37700, -37701,37702,37703,37704,37705,U,37706,37707,37708,37709,37710,37711,37712, -37713,37714,37715,37716,37717,37718,37719,37720,37721,37722,37723,37724,37725, -37726,37727,37728,37729,37730,37731,37732,37733,37734,37735,37736,37737,37739, -37740,37741,37742,37743,37744,37745,37746,37747,37748,37749,37750,37751,37752, -37753,37754,37755,37756,37757,37758,37759,37760,37761,37762,37763,37764,37765, -37766,37767,37768,37769,37770,37771,37772,37773,37774,37776,37777,37778,37779, -37780,37781,37782,37783,37784,37785,37786,37787,37788,37789,37790,37791,37792, -37793,37794,37795,37796,37797,37798,37799,37800,37801,37802,37803,U,37804, -37805,37806,37807,37808,37809,37810,37811,37812,37813,37814,37815,37816,37817, -37818,37819,37820,37821,37822,37823,37824,37825,37826,37827,37828,37829,37830, -37831,37832,37833,37835,37836,37837,37838,37839,37840,37841,37842,37843,37844, -37845,37847,37848,37849,37850,37851,37852,37853,37854,37855,37856,37857,37858, -37859,37860,37861,37862,37863,37864,37865,37866,37867,37868,37869,37870,37871, -37872,37873,37874,37875,37876,37877,37878,37879,37880,37881,37882,37883,37884, -37885,37886,37887,37888,37889,37890,37891,37892,37893,37894,37895,37896,37897, -37898,37899,37900,37901,U,37902,37903,37904,37905,37906,37907,37908,37909, -37910,37911,37912,37913,37914,37915,37916,37917,37918,37919,37920,37921,37922, -37923,37924,37925,37926,37927,37928,37929,37930,37931,37932,37933,37934,37935, -37936,37937,37938,37939,37940,37941,37942,37943,37944,37945,37946,37947,37948, -37949,37951,37952,37953,37954,37955,37956,37957,37958,37959,37960,37961,37962, -37963,37964,37965,37966,37967,37968,37969,37970,37971,37972,37973,37974,37975, -37976,37977,37978,37979,37980,37981,37982,37983,37984,37985,37986,37987,37988, -37989,37990,37991,37992,37993,37994,37996,37997,37998,37999,U,38000,38001, -38002,38003,38004,38005,38006,38007,38008,38009,38010,38011,38012,38013,38014, -38015,38016,38017,38018,38019,38020,38033,38038,38040,38087,38095,38099,38100, -38106,38118,38139,38172,38176,38183,38195,38205,38211,38216,38219,38229,38234, -38240,38254,38260,38261,38263,38264,38265,38266,38267,38268,38269,38270,38272, -38273,38274,38275,38276,38277,38278,38279,38280,38281,38282,38283,38284,38285, -38286,38287,38288,38289,38290,38291,38292,38293,38294,38295,38296,38297,38298, -38299,38300,38301,38302,38303,38304,38305,38306,38307,38308,38309,38310,38311, -38312,38313,38314,U,38315,38316,38317,38318,38319,38320,38321,38322,38323, -38324,38325,38326,38327,38328,38329,38330,38331,38332,38333,38334,38335,38336, -38337,38338,38339,38340,38341,38342,38343,38344,38345,38346,38347,38348,38349, -38350,38351,38352,38353,38354,38355,38356,38357,38358,38359,38360,38361,38362, -38363,38364,38365,38366,38367,38368,38369,38370,38371,38372,38373,38374,38375, -38380,38399,38407,38419,38424,38427,38430,38432,38435,38436,38437,38438,38439, -38440,38441,38443,38444,38445,38447,38448,38455,38456,38457,38458,38462,38465, -38467,38474,38478,38479,38481,38482,38483,38486,38487,U,38488,38489,38490, -38492,38493,38494,38496,38499,38501,38502,38507,38509,38510,38511,38512,38513, -38515,38520,38521,38522,38523,38524,38525,38526,38527,38528,38529,38530,38531, -38532,38535,38537,38538,38540,38542,38545,38546,38547,38549,38550,38554,38555, -38557,38558,38559,38560,38561,38562,38563,38564,38565,38566,38568,38569,38570, -38571,38572,38573,38574,38575,38577,38578,38580,38581,38583,38584,38586,38587, -38591,38594,38595,38600,38602,38603,38608,38609,38611,38612,38614,38615,38616, -38617,38618,38619,38620,38621,38622,38623,38625,38626,38627,38628,38629,38630, -38631,38635,U,38636,38637,38638,38640,38641,38642,38644,38645,38648,38650, -38651,38652,38653,38655,38658,38659,38661,38666,38667,38668,38672,38673,38674, -38676,38677,38679,38680,38681,38682,38683,38685,38687,38688,38689,38690,38691, -38692,38693,38694,38695,38696,38697,38699,38700,38702,38703,38705,38707,38708, -38709,38710,38711,38714,38715,38716,38717,38719,38720,38721,38722,38723,38724, -38725,38726,38727,38728,38729,38730,38731,38732,38733,38734,38735,38736,38737, -38740,38741,38743,38744,38746,38748,38749,38751,38755,38756,38758,38759,38760, -38762,38763,38764,38765,38766,38767,38768,38769,U,38770,38773,38775,38776, -38777,38778,38779,38781,38782,38783,38784,38785,38786,38787,38788,38790,38791, -38792,38793,38794,38796,38798,38799,38800,38803,38805,38806,38807,38809,38810, -38811,38812,38813,38814,38815,38817,38818,38820,38821,38822,38823,38824,38825, -38826,38828,38830,38832,38833,38835,38837,38838,38839,38840,38841,38842,38843, -38844,38845,38846,38847,38848,38849,38850,38851,38852,38853,38854,38855,38856, -38857,38858,38859,38860,38861,38862,38863,38864,38865,38866,38867,38868,38869, -38870,38871,38872,38873,38874,38875,38876,38877,38878,38879,38880,38881,38882, -38883,U,38884,38885,38888,38894,38895,38896,38897,38898,38900,38903,38904, -38905,38906,38907,38908,38909,38910,38911,38912,38913,38914,38915,38916,38917, -38918,38919,38920,38921,38922,38923,38924,38925,38926,38927,38928,38929,38930, -38931,38932,38933,38934,38935,38936,38937,38938,38939,38940,38941,38942,38943, -38944,38945,38946,38947,38948,38949,38950,38951,38952,38953,38954,38955,38956, -38957,38958,38959,38960,38961,38962,38963,38964,38965,38966,38967,38968,38969, -38970,38971,38972,38973,38974,38975,38976,38977,38978,38979,38980,38981,38982, -38983,38984,38985,38986,38987,38988,38989,U,38990,38991,38992,38993,38994, -38995,38996,38997,38998,38999,39000,39001,39002,39003,39004,39005,39006,39007, -39008,39009,39010,39011,39012,39013,39014,39015,39016,39017,39018,39019,39020, -39021,39022,39023,39024,39025,39026,39027,39028,39051,39054,39058,39061,39065, -39075,39080,39081,39082,39083,39084,39085,39086,39087,39088,39089,39090,39091, -39092,39093,39094,39095,39096,39097,39098,39099,39100,39101,39102,39103,39104, -39105,39106,39107,39108,39109,39110,39111,39112,39113,39114,39115,39116,39117, -39119,39120,39124,39126,39127,39131,39132,39133,39136,39137,39138,39139,39140, -U,39141,39142,39145,39146,39147,39148,39149,39150,39151,39152,39153,39154, -39155,39156,39157,39158,39159,39160,39161,39162,39163,39164,39165,39166,39167, -39168,39169,39170,39171,39172,39173,39174,39175,39176,39177,39178,39179,39180, -39182,39183,39185,39186,39187,39188,39189,39190,39191,39192,39193,39194,39195, -39196,39197,39198,39199,39200,39201,39202,39203,39204,39205,39206,39207,39208, -39209,39210,39211,39212,39213,39215,39216,39217,39218,39219,39220,39221,39222, -39223,39224,39225,39226,39227,39228,39229,39230,39231,39232,39233,39234,39235, -39236,39237,39238,39239,39240,39241,U,39242,39243,39244,39245,39246,39247, -39248,39249,39250,39251,39254,39255,39256,39257,39258,39259,39260,39261,39262, -39263,39264,39265,39266,39268,39270,39283,39288,39289,39291,39294,39298,39299, -39305,39308,39310,39322,39323,39324,39325,39326,39327,39328,39329,39330,39331, -39332,39334,39335,39337,39338,39339,39340,39341,39342,39343,39344,39345,39346, -39347,39348,39349,39350,39351,39352,39353,39354,39355,39356,39357,39358,39359, -39360,39361,39362,39363,39364,39365,39366,39367,39368,39369,39370,39371,39372, -39373,39374,39375,39376,39377,39378,39379,39380,39381,39382,39383,39384,U, -39385,39386,39387,39388,39389,39390,39391,39392,39393,39394,39395,39396,39397, -39398,39399,39400,39401,39402,39403,39404,39405,39406,39407,39408,39409,39410, -39411,39412,39413,39414,39415,39416,39417,39418,39419,39420,39421,39422,39423, -39424,39425,39426,39427,39428,39429,39430,39431,39432,39433,39434,39435,39436, -39437,39438,39439,39440,39441,39442,39443,39444,39445,39446,39447,39448,39449, -39450,39451,39452,39453,39454,39455,39456,39457,39458,39459,39460,39461,39462, -39463,39464,39465,39466,39467,39468,39469,39470,39471,39472,39473,39474,39475, -39476,39477,39478,39479,39480,U,39481,39482,39483,39484,39485,39486,39487, -39488,39489,39490,39491,39492,39493,39494,39495,39496,39497,39498,39499,39500, -39501,39502,39503,39504,39505,39506,39507,39508,39509,39510,39511,39512,39513, -39514,39515,39516,39517,39518,39519,39520,39521,39522,39523,39524,39525,39526, -39527,39528,39529,39530,39531,39538,39555,39561,39565,39566,39572,39573,39577, -39590,39593,39594,39595,39596,39597,39598,39599,39602,39603,39604,39605,39609, -39611,39613,39614,39615,39619,39620,39622,39623,39624,39625,39626,39629,39630, -39631,39632,39634,39636,39637,39638,39639,39641,39642,39643,39644,U,39645, -39646,39648,39650,39651,39652,39653,39655,39656,39657,39658,39660,39662,39664, -39665,39666,39667,39668,39669,39670,39671,39672,39674,39676,39677,39678,39679, -39680,39681,39682,39684,39685,39686,39687,39689,39690,39691,39692,39693,39694, -39696,39697,39698,39700,39701,39702,39703,39704,39705,39706,39707,39708,39709, -39710,39712,39713,39714,39716,39717,39718,39719,39720,39721,39722,39723,39724, -39725,39726,39728,39729,39731,39732,39733,39734,39735,39736,39737,39738,39741, -39742,39743,39744,39750,39754,39755,39756,39758,39760,39762,39763,39765,39766, -39767,39768,39769,39770,U,39771,39772,39773,39774,39775,39776,39777,39778, -39779,39780,39781,39782,39783,39784,39785,39786,39787,39788,39789,39790,39791, -39792,39793,39794,39795,39796,39797,39798,39799,39800,39801,39802,39803,39804, -39805,39806,39807,39808,39809,39810,39811,39812,39813,39814,39815,39816,39817, -39818,39819,39820,39821,39822,39823,39824,39825,39826,39827,39828,39829,39830, -39831,39832,39833,39834,39835,39836,39837,39838,39839,39840,39841,39842,39843, -39844,39845,39846,39847,39848,39849,39850,39851,39852,39853,39854,39855,39856, -39857,39858,39859,39860,39861,39862,39863,39864,39865,39866,U,39867,39868, -39869,39870,39871,39872,39873,39874,39875,39876,39877,39878,39879,39880,39881, -39882,39883,39884,39885,39886,39887,39888,39889,39890,39891,39892,39893,39894, -39895,39896,39897,39898,39899,39900,39901,39902,39903,39904,39905,39906,39907, -39908,39909,39910,39911,39912,39913,39914,39915,39916,39917,39918,39919,39920, -39921,39922,39923,39924,39925,39926,39927,39928,39929,39930,39931,39932,39933, -39934,39935,39936,39937,39938,39939,39940,39941,39942,39943,39944,39945,39946, -39947,39948,39949,39950,39951,39952,39953,39954,39955,39956,39957,39958,39959, -39960,39961,39962,U,39963,39964,39965,39966,39967,39968,39969,39970,39971, -39972,39973,39974,39975,39976,39977,39978,39979,39980,39981,39982,39983,39984, -39985,39986,39987,39988,39989,39990,39991,39992,39993,39994,39995,39996,39997, -39998,39999,40000,40001,40002,40003,40004,40005,40006,40007,40008,40009,40010, -40011,40012,40013,40014,40015,40016,40017,40018,40019,40020,40021,40022,40023, -40024,40025,40026,40027,40028,40029,40030,40031,40032,40033,40034,40035,40036, -40037,40038,40039,40040,40041,40042,40043,40044,40045,40046,40047,40048,40049, -40050,40051,40052,40053,40054,40055,40056,40057,40058,U,40059,40061,40062, -40064,40067,40068,40073,40074,40076,40079,40083,40086,40087,40088,40089,40093, -40106,40108,40111,40121,40126,40127,40128,40129,40130,40136,40137,40145,40146, -40154,40155,40160,40161,40163,40164,40165,40166,40167,40168,40169,40170,40171, -40172,40173,40174,40175,40176,40177,40178,40179,40180,40181,40182,40183,40184, -40185,40186,40187,40188,40189,40190,40191,40192,40193,40194,40195,40196,40197, -40198,40199,40200,40201,40202,40203,40204,40205,40206,40207,40208,40209,40210, -40211,40212,40213,40214,40215,40216,40217,40218,40219,40220,40221,40222,40223, -40224,40225,U,40226,40227,40228,40229,40230,40231,40232,40233,40234,40235, -40236,40237,40238,40239,40240,40241,40242,40243,40244,40245,40246,40247,40248, -40249,40250,40251,40252,40253,40254,40255,40256,40257,40258,40259,40260,40261, -40262,40263,40264,40265,40266,40267,40268,40269,40270,40271,40272,40273,40274, -40275,40276,40277,40278,40279,40280,40281,40282,40283,40284,40285,40286,40287, -40288,40289,40290,40291,40292,40293,40294,40295,40296,40297,40298,40299,40300, -40301,40302,40303,40304,40305,40306,40307,40308,40309,40310,40311,40312,40313, -40314,40315,40316,40317,40318,40319,40320,40321,U,40322,40323,40324,40325, -40326,40327,40328,40329,40330,40331,40332,40333,40334,40335,40336,40337,40338, -40339,40340,40341,40342,40343,40344,40345,40346,40347,40348,40349,40350,40351, -40352,40353,40354,40355,40356,40357,40358,40359,40360,40361,40362,40363,40364, -40365,40366,40367,40368,40369,40370,40371,40372,40373,40374,40375,40376,40377, -40378,40379,40380,40381,40382,40383,40384,40385,40386,40387,40388,40389,40390, -40391,40392,40393,40394,40395,40396,40397,40398,40399,40400,40401,40402,40403, -40404,40405,40406,40407,40408,40409,40410,40411,40412,40413,40414,40415,40416, -40417,U,40418,40419,40420,40421,40422,40423,40424,40425,40426,40427,40428, -40429,40430,40431,40432,40433,40434,40435,40436,40437,40438,40439,40440,40441, -40442,40443,40444,40445,40446,40447,40448,40449,40450,40451,40452,40453,40454, -40455,40456,40457,40458,40459,40460,40461,40462,40463,40464,40465,40466,40467, -40468,40469,40470,40471,40472,40473,40474,40475,40476,40477,40478,40484,40487, -40494,40496,40500,40507,40508,40512,40525,40528,40530,40531,40532,40534,40537, -40541,40543,40544,40545,40546,40549,40558,40559,40562,40564,40565,40566,40567, -40568,40569,40570,40571,40572,40573,40576,U,40577,40579,40580,40581,40582, -40585,40586,40588,40589,40590,40591,40592,40593,40596,40597,40598,40599,40600, -40601,40602,40603,40604,40606,40608,40609,40610,40611,40612,40613,40615,40616, -40617,40618,40619,40620,40621,40622,40623,40624,40625,40626,40627,40629,40630, -40631,40633,40634,40636,40639,40640,40641,40642,40643,40645,40646,40647,40648, -40650,40651,40652,40656,40658,40659,40661,40662,40663,40665,40666,40670,40673, -40675,40676,40678,40680,40683,40684,40685,40686,40688,40689,40690,40691,40692, -40693,40694,40695,40696,40698,40701,40703,40704,40705,40706,40707,40708,40709, -U,40710,40711,40712,40713,40714,40716,40719,40721,40722,40724,40725,40726, -40728,40730,40731,40732,40733,40734,40735,40737,40739,40740,40741,40742,40743, -40744,40745,40746,40747,40749,40750,40752,40753,40754,40755,40756,40757,40758, -40760,40762,40764,40767,40768,40769,40770,40771,40773,40774,40775,40776,40777, -40778,40779,40780,40781,40782,40783,40786,40787,40788,40789,40790,40791,40792, -40793,40794,40795,40796,40797,40798,40799,40800,40801,40802,40803,40804,40805, -40806,40807,40808,40809,40810,40811,40812,40813,40814,40815,40816,40817,40818, -40819,40820,40821,40822,40823,40824,U,40825,40826,40827,40828,40829,40830, -40833,40834,40845,40846,40847,40848,40849,40850,40851,40852,40853,40854,40855, -40856,40860,40861,40862,40865,40866,40867,40868,40869,63788,63865,63893,63975, -63985,64012,64013,64014,64015,64017,64019,64020,64024,64031,64032,64033,64035, -64036,64039,64040,64041, -}; - -static const struct dbcs_index gbkext_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{__gbkext_decmap+0,64,254},{__gbkext_decmap+191,64, -254},{__gbkext_decmap+382,64,254},{__gbkext_decmap+573,64,254},{ -__gbkext_decmap+764,64,254},{__gbkext_decmap+955,64,254},{__gbkext_decmap+1146 -,64,254},{__gbkext_decmap+1337,64,254},{__gbkext_decmap+1528,64,254},{ -__gbkext_decmap+1719,64,254},{__gbkext_decmap+1910,64,254},{__gbkext_decmap+ -2101,64,254},{__gbkext_decmap+2292,64,254},{__gbkext_decmap+2483,64,254},{ -__gbkext_decmap+2674,64,254},{__gbkext_decmap+2865,64,254},{__gbkext_decmap+ -3056,64,254},{__gbkext_decmap+3247,64,254},{__gbkext_decmap+3438,64,254},{ -__gbkext_decmap+3629,64,254},{__gbkext_decmap+3820,64,254},{__gbkext_decmap+ -4011,64,254},{__gbkext_decmap+4202,64,254},{__gbkext_decmap+4393,64,254},{ -__gbkext_decmap+4584,64,254},{__gbkext_decmap+4775,64,254},{__gbkext_decmap+ -4966,64,254},{__gbkext_decmap+5157,64,254},{__gbkext_decmap+5348,64,254},{ -__gbkext_decmap+5539,64,254},{__gbkext_decmap+5730,64,254},{__gbkext_decmap+ -5921,64,254},{__gbkext_decmap+6112,164,170},{__gbkext_decmap+6119,161,170},{0, -0,0},{0,0,0},{0,0,0},{__gbkext_decmap+6129,224,245},{0,0,0},{__gbkext_decmap+ -6151,64,192},{__gbkext_decmap+6280,64,150},{__gbkext_decmap+6367,64,160},{ -__gbkext_decmap+6464,64,160},{__gbkext_decmap+6561,64,160},{__gbkext_decmap+ -6658,64,160},{__gbkext_decmap+6755,64,160},{__gbkext_decmap+6852,64,160},{ -__gbkext_decmap+6949,64,160},{__gbkext_decmap+7046,64,160},{__gbkext_decmap+ -7143,64,160},{__gbkext_decmap+7240,64,160},{__gbkext_decmap+7337,64,160},{ -__gbkext_decmap+7434,64,160},{__gbkext_decmap+7531,64,160},{__gbkext_decmap+ -7628,64,160},{__gbkext_decmap+7725,64,160},{__gbkext_decmap+7822,64,160},{ -__gbkext_decmap+7919,64,160},{__gbkext_decmap+8016,64,160},{__gbkext_decmap+ -8113,64,160},{__gbkext_decmap+8210,64,160},{__gbkext_decmap+8307,64,160},{ -__gbkext_decmap+8404,64,160},{__gbkext_decmap+8501,64,160},{__gbkext_decmap+ -8598,64,160},{__gbkext_decmap+8695,64,160},{__gbkext_decmap+8792,64,160},{ -__gbkext_decmap+8889,64,160},{__gbkext_decmap+8986,64,160},{__gbkext_decmap+ -9083,64,160},{__gbkext_decmap+9180,64,160},{__gbkext_decmap+9277,64,160},{ -__gbkext_decmap+9374,64,160},{__gbkext_decmap+9471,64,160},{__gbkext_decmap+ -9568,64,160},{__gbkext_decmap+9665,64,160},{__gbkext_decmap+9762,64,160},{ -__gbkext_decmap+9859,64,160},{__gbkext_decmap+9956,64,160},{__gbkext_decmap+ -10053,64,160},{__gbkext_decmap+10150,64,160},{__gbkext_decmap+10247,64,160},{ -__gbkext_decmap+10344,64,160},{__gbkext_decmap+10441,64,160},{__gbkext_decmap+ -10538,64,160},{__gbkext_decmap+10635,64,160},{__gbkext_decmap+10732,64,160},{ -__gbkext_decmap+10829,64,160},{__gbkext_decmap+10926,64,160},{__gbkext_decmap+ -11023,64,160},{__gbkext_decmap+11120,64,160},{__gbkext_decmap+11217,64,160},{ -__gbkext_decmap+11314,64,160},{__gbkext_decmap+11411,64,160},{__gbkext_decmap+ -11508,64,160},{__gbkext_decmap+11605,64,160},{__gbkext_decmap+11702,64,160},{ -__gbkext_decmap+11799,64,160},{__gbkext_decmap+11896,64,160},{__gbkext_decmap+ -11993,64,160},{__gbkext_decmap+12090,64,160},{__gbkext_decmap+12187,64,160},{ -__gbkext_decmap+12284,64,160},{__gbkext_decmap+12381,64,160},{__gbkext_decmap+ -12478,64,160},{__gbkext_decmap+12575,64,160},{__gbkext_decmap+12672,64,160},{ -__gbkext_decmap+12769,64,160},{__gbkext_decmap+12866,64,160},{__gbkext_decmap+ -12963,64,160},{__gbkext_decmap+13060,64,160},{__gbkext_decmap+13157,64,160},{ -__gbkext_decmap+13254,64,160},{__gbkext_decmap+13351,64,160},{__gbkext_decmap+ -13448,64,160},{__gbkext_decmap+13545,64,160},{__gbkext_decmap+13642,64,160},{ -__gbkext_decmap+13739,64,160},{__gbkext_decmap+13836,64,160},{__gbkext_decmap+ -13933,64,160},{__gbkext_decmap+14030,64,160},{__gbkext_decmap+14127,64,160},{ -__gbkext_decmap+14224,64,160},{__gbkext_decmap+14321,64,160},{__gbkext_decmap+ -14418,64,160},{__gbkext_decmap+14515,64,79},{0,0,0}, -}; - -static const DBCHAR __gbcommon_encmap[23231] = { -8552,N,N,8556,8487,N,N,N,N,N,N,N,8547,8512,N,N,N,N,N,41380,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8513,N,N,N,N,N,N,N,N,10276,10274, -N,N,N,N,N,N,10280,10278,10298,N,10284,10282,N,N,N,N,10288,10286,N,N,N,8514,N, -10292,10290,N,10297,10273,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10277,N,N,N,N,N,N, -N,10279,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10281,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,43197,N,N,N,43198,N,N,N,N,10285,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,10289,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10275, -N,10283,N,10287,N,10291,N,10293,N,10294,N,10295,N,10296,43195,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,43200,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8486,N,8485, -43072,43073,N,N,N,N,N,N,N,N,N,N,N,N,N,43074,9761,9762,9763,9764,9765,9766, -9767,9768,9769,9770,9771,9772,9773,9774,9775,9776,9777,N,9778,9779,9780,9781, -9782,9783,9784,N,N,N,N,N,N,N,9793,9794,9795,9796,9797,9798,9799,9800,9801, -9802,9803,9804,9805,9806,9807,9808,9809,N,9810,9811,9812,9813,9814,9815,9816, -10023,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10017,10018,10019,10020,10021,10022,10024, -10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10037, -10038,10039,10040,10041,10042,10043,10044,10045,10046,10047,10048,10049,10065, -10066,10067,10068,10069,10070,10072,10073,10074,10075,10076,10077,10078,10079, -10080,10081,10082,10083,10084,10085,10086,10087,10088,10089,10090,10091,10092, -10093,10094,10095,10096,10097,N,10071,43356,N,N,43075,41386,8490,8492,N,8494, -8495,N,N,8496,8497,N,N,N,N,N,N,N,43077,8493,N,N,N,N,N,N,N,N,N,8555,N,8548, -8549,N,43078,N,N,N,N,N,8569,8550,N,43079,N,N,N,43080,N,N,N,N,N,N,N,N,N,N,N,N, -8557,N,N,N,N,N,N,N,N,N,N,43353,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -8817,8818,8819,8820,8821,8822,8823,8824,8825,8826,8827,8828,N,N,N,N,41633, -41634,41635,41636,41637,41638,41639,41640,41641,41642,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,8571,8572,8570,8573,N,N,43081,43082,43083,43084,8522,N,N, -N,N,N,N,8519,N,8518,N,N,N,43085,N,N,N,N,8524,N,N,8536,8542,43086,8527,N,N, -43087,N,8526,N,8516,8517,8521,8520,8530,N,N,8531,N,N,N,N,N,8544,8543,8515, -8523,N,N,N,N,N,8535,N,N,N,N,N,N,N,N,N,N,8534,N,N,N,8533,N,N,N,N,N,43088,N,N,N, -N,N,N,N,N,N,N,N,N,N,8537,8532,N,N,8540,8541,43089,43090,N,N,N,N,N,N,8538,8539, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -43154,N,N,N,8529,N,N,N,N,N,N,N,N,N,N,N,8525,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,43091,8528,8793,8794,8795,8796,8797,8798,8799,8800,8801,8802, -N,N,N,N,N,N,N,N,N,N,8773,8774,8775,8776,8777,8778,8779,8780,8781,8782,8783, -8784,8785,8786,8787,8788,8789,8790,8791,8792,8753,8754,8755,8756,8757,8758, -8759,8760,8761,8762,8763,8764,8765,8766,8767,8768,8769,8770,8771,8772,10532, -10533,10534,10535,10536,10537,10538,10539,10540,10541,10542,10543,10544,10545, -10546,10547,10548,10549,10550,10551,10552,10553,10554,10555,10556,10557,10558, -10559,10560,10561,10562,10563,10564,10565,10566,10567,10568,10569,10570,10571, -10572,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582,10583,10584, -10585,10586,10587,10588,10589,10590,10591,10592,10593,10594,10595,10596,10597, -10598,10599,10600,10601,10602,10603,10604,10605,10606,10607,N,N,N,N,43092, -43093,43094,43095,43096,43097,43098,43099,43100,43101,43102,43103,43104,43105, -43106,43107,43108,43109,43110,43111,43112,43113,43114,43115,43116,43117,43118, -43119,43120,43121,43122,43123,43124,43125,43126,43127,N,N,N,N,N,N,N,N,N,N,N,N, -N,43128,43129,43130,43131,43132,43133,43134,43136,43137,43138,43139,43140, -43141,43142,43143,N,N,N,43144,43145,43146,N,N,N,N,N,N,N,N,N,N,8566,8565,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,8568,8567,N,N,N,N,N,N,N,N,43147,43148,N,N,N,N,N,N,N, -N,8564,8563,N,N,N,8560,N,N,8562,8561,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -43149,43150,43151,43152,8559,8558,N,N,43153,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -8546,N,8545,8481,8482,8483,8488,N,8489,43365,43414,8500,8501,8502,8503,8504, -8505,8506,8507,8510,8511,43155,8574,8498,8499,8508,8509,N,N,N,N,N,43156,43157, -N,N,43328,43329,43330,43331,43332,43333,43334,43335,43336,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,9249,9250,9251,9252,9253,9254,9255,9256,9257,9258, -9259,9260,9261,9262,9263,9264,9265,9266,9267,9268,9269,9270,9271,9272,9273, -9274,9275,9276,9277,9278,9279,9280,9281,9282,9283,9284,9285,9286,9287,9288, -9289,9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302,9303, -9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314,9315,9316,9317,9318, -9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,N,N,N,N,N,N, -N,43361,43362,43366,43367,N,N,9505,9506,9507,9508,9509,9510,9511,9512,9513, -9514,9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528, -9529,9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543, -9544,9545,9546,9547,9548,9549,9550,9551,9552,9553,9554,9555,9556,9557,9558, -9559,9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573, -9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9588, -9589,9590,N,N,N,N,8484,43360,43363,43364,10309,10310,10311,10312,10313,10314, -10315,10316,10317,10318,10319,10320,10321,10322,10323,10324,10325,10326,10327, -10328,10329,10330,10331,10332,10333,10334,10335,10336,10337,10338,10339,10340, -10341,10342,10343,10344,10345,8805,8806,8807,8808,8809,8810,8811,8812,8813, -8814,N,N,N,N,N,N,N,43354,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,43337,43338,43339,N,N,N,N,N,N,N,N,N,N,N,N,43340,43341,43342, -N,N,43343,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -43344,N,N,N,N,N,N,N,N,N,43345,N,N,43346,43347,N,N,43348,21051,13857,33088, -18015,33089,33090,33091,19826,21833,18557,18767,20290,22562,12859,21355,33092, -22564,13171,33093,22312,18258,22567,19008,33094,18288,12667,21045,13396,13867, -19263,22569,33095,33096,33097,13866,33098,16701,20815,33099,18725,22573,33100, -14454,20798,25436,22096,33101,33102,14177,33103,13358,33104,16729,33105,22588, -33106,19816,13604,20010,22135,33107,16502,15961,22575,33108,33109,33110,17483, -33111,15939,33112,22577,17204,21093,33113,22062,20058,21799,14965,14118,16470, -33114,17977,17746,18247,33115,14676,33116,13131,21074,33117,33118,22591,15941, -18034,21042,20272,20327,33119,33120,33121,33122,19049,33123,33124,22592,33125, -33126,33127,33128,33129,33130,17010,16978,33131,18537,33132,33133,33134,33135, -33136,33137,33138,33139,33140,33141,18220,33142,33143,33144,33145,33146,33147, -33148,16715,33149,21352,21881,33150,19010,13950,22561,21338,16247,33152,21574, -15141,22593,20069,15918,33153,33154,22568,33155,20807,20521,33156,33157,33158, -22589,22895,19830,16186,33159,15675,14885,21088,12922,14944,17462,33160,20333, -15913,19748,16705,33161,33162,33163,18263,22897,33164,22900,33165,33166,33167, -33168,18507,22633,33169,33170,33171,21082,18994,18506,22636,22634,22598,15734, -17997,13168,33172,22635,15729,15721,33173,18516,13395,33174,33175,16984,33176, -12886,22352,19019,19323,21836,14390,20297,33177,33178,33179,22874,22640,18218, -33180,22638,33181,13434,16750,21076,33182,33183,22637,33184,21063,22639,17223, -33185,33186,33187,20854,33188,22105,22642,33189,22645,15486,15451,33190,33191, -33192,18510,33193,14173,33194,14146,33195,18035,33196,33197,33198,33199,33200, -33201,33202,22648,21057,33203,33204,20073,15423,14204,14117,20573,33205,33206, -33207,33208,33209,22106,21317,15215,15201,22641,33210,33211,18721,20016,13355, -33212,22643,33213,18763,22646,16983,22647,33214,33215,20017,22649,33216,33217, -33218,12846,14656,33219,22819,33220,12393,33221,16742,33222,18796,33223,19269, -33224,19270,22820,33225,33226,33227,33228,33229,13672,33230,33231,13611,33232, -33233,33234,33235,33236,33237,20027,13645,22305,22388,21331,33238,19557,33239, -14926,33240,22818,22876,21344,22653,14192,22391,22654,22650,22817,17507,33241, -33242,21302,22644,22877,33243,22651,33244,17765,33245,33246,16464,33247,33248, -20848,12379,33249,33250,15441,22822,33251,22821,33252,33253,33254,33255,22828, -22830,33256,22827,19001,33257,33258,33259,22825,22070,33260,33261,33262,13150, -22824,33263,16509,33264,19020,33265,22826,33266,22823,33267,33268,22832,33269, -33270,13873,33271,33272,33273,14633,33274,21056,33275,33276,20288,33277,33278, -16962,33344,15684,21868,12896,18248,16235,22829,33345,22831,33346,20074,14958, -33347,33348,33349,33350,33351,18262,33352,33353,33354,33355,33356,33357,33358, -33359,33360,12643,33361,33362,33363,13401,13933,22836,33364,33365,33366,33367, -16161,33368,33369,33370,22878,18254,16510,22840,33371,33372,33373,33374,33375, -19287,14205,33376,22837,33377,22839,12579,21345,22841,33378,20549,33379,22838, -33380,33381,22833,33382,22834,16681,22835,33383,33384,15475,20574,14377,33385, -15971,33386,22845,33387,33388,33389,33390,22842,33391,12339,33392,33393,33394, -22850,33395,33396,33397,33398,33399,33400,33401,33402,33403,33404,33405,33406, -33408,22852,12598,33409,22847,33410,33411,13625,33412,15987,33413,33414,33415, -19528,14962,21072,33416,22851,33417,33418,15720,33419,13099,33420,33421,33422, -22853,15979,33423,22854,22843,17503,33424,22846,22849,22848,33425,33426,33427, -33428,33429,33430,33431,33432,33433,33434,33435,21806,33436,22069,33437,18275, -33438,33439,33440,33441,22856,33442,33443,33444,15449,22858,33445,33446,33447, -22844,33448,22859,17963,33449,33450,33451,33452,33453,22857,33454,33455,33456, -33457,22390,33458,19747,33459,33460,33461,33462,33463,33464,33465,33466,15649, -33467,33468,33469,33470,33471,33472,22860,33473,33474,33475,33476,33477,33478, -33479,33480,33481,17724,19765,33482,33483,33484,22861,33485,33486,22855,13093, -16254,33487,33488,33489,33490,14389,33491,33492,16508,33493,33494,33495,33496, -12408,33497,33498,33499,33500,33501,33502,33503,33504,33505,33506,33507,33508, -33509,33510,33511,33512,33513,33514,33515,33516,33517,13430,33518,22862,33519, -22863,13346,22864,33520,33521,13407,33522,33523,33524,33525,33526,12353,33527, -33528,33529,33530,33531,33532,33533,22865,18741,33534,33600,33601,33602,33603, -33604,33605,33606,33607,33608,33609,33610,33611,33612,33613,33614,33615,33616, -33617,20337,33618,33619,33620,33621,33622,33623,22866,33624,33625,33626,16709, -33627,33628,33629,33630,33631,33632,33633,33634,33635,33636,33637,22870,18734, -33638,33639,33640,33641,22869,22868,22871,33642,33643,33644,33645,19291,33646, -15657,33647,33648,33649,33650,33651,17959,33652,33653,33654,33655,33656,33657, -33658,33659,33660,33661,22867,22872,33662,33664,33665,22873,33666,33667,33668, -33669,33670,33671,18533,33672,33673,33674,33675,33676,33677,33678,33679,33680, -33681,33682,33683,33684,33685,16476,33686,33687,33688,33689,33690,33691,33692, -33693,33694,33695,33696,33697,33698,33699,33700,33701,33702,33703,33704,33705, -33706,33707,33708,33709,33710,33711,33712,33713,33714,13945,22563,21578,33715, -21546,20566,13156,21847,33716,20296,14690,33717,16203,33718,17250,33719,33720, -33721,13906,33722,33723,19779,22894,22896,33724,33725,33726,13619,33727,13877, -33728,33729,33730,33731,33732,15908,33733,33734,18539,33735,33736,18475,33737, -33738,12363,14635,16761,22882,33739,16444,14642,33740,14680,20555,12664,18020, -15967,13668,22344,33741,20856,15462,19038,33742,33743,15421,22886,22631,33744, -33745,17498,33746,33747,14420,18493,33748,33749,12897,21593,33750,33751,33752, -33753,17200,33754,33755,17249,23074,18527,33756,20532,33757,15996,17705,33758, -33759,33760,14682,33761,23075,33762,21545,23076,33763,33764,33765,33766,33767, -22907,13868,33768,33769,14187,12665,22908,13157,15990,33770,16246,21041,16484, -33771,33772,33773,13875,22910,22909,33774,33775,15931,33776,33777,33778,18016, -33779,22332,23073,33780,16697,33781,13682,16744,33782,33783,15477,33784,13397, -33785,33786,33787,33788,33789,33790,33856,33857,33858,16733,33859,17533,33860, -33861,15416,14130,33862,33863,14191,33864,33865,33866,33867,33868,33869,22892, -33870,17982,33871,16173,15179,33872,33873,13642,33874,23369,20567,33875,19769, -12348,13174,15223,23370,14895,33876,21604,13622,13683,22614,18512,33877,33878, -14166,18256,22615,33879,16175,33880,33881,23355,22616,33882,33883,20556,15150, -33884,33885,33886,27454,16720,16757,21618,14421,13364,33887,13173,33888,33889, -18750,33890,33891,33892,17744,33893,33894,33895,17753,16507,33896,12656,33897, -22617,14670,33898,13629,33899,33900,22618,33901,33902,22086,19234,18479,18738, -13388,16204,33903,14708,33904,22619,22620,13927,15425,19562,33905,33906,33907, -33908,33909,33910,20343,33911,22621,18224,33912,33913,14672,15651,33914,33915, -19550,33916,17994,33917,33918,33920,33921,33922,22624,33923,22622,33924,33925, -22623,33926,33927,33928,12414,33929,15975,33930,18979,15476,33931,33932,33933, -33934,14385,33935,33936,14446,33937,33938,33939,33940,33941,33942,33943,33944, -33945,33946,22626,33947,15691,33948,22628,22627,33949,33950,33951,33952,33953, -17788,33954,33955,33956,33957,33958,33959,33960,22629,33961,33962,22630,33963, -33964,33965,33966,33967,33968,33969,16678,33970,18480,12396,14630,15443,20081, -23357,16723,33971,33972,33973,33974,13871,22138,17708,15705,23358,23359,33975, -33976,33977,16504,15906,16461,33978,33979,33980,33981,33982,33983,33984,33985, -33986,33987,23360,19014,33988,33989,33990,12842,33991,33992,33993,21314,33994, -17251,33995,20779,33996,33997,33998,33999,23362,34000,16469,34001,34002,34003, -23363,34004,16177,34005,34006,34007,34008,34009,34010,17468,34011,34012,34013, -34014,18266,34015,34016,34017,34018,34019,34020,34021,34022,34023,34024,34025, -23364,34026,34027,34028,34029,34030,34031,34032,34033,22888,18775,34034,34035, -34036,14644,20080,21576,34037,34038,34039,34040,12412,13394,34041,20569,34042, -34043,34044,34045,22889,34046,24139,22891,34112,34113,34114,34115,22576,15151, -12593,34116,13143,22606,34117,34118,21585,34119,34120,15667,16239,34121,20283, -34122,34123,22608,34124,34125,34126,14155,34127,34128,34129,22609,34130,34131, -34132,34133,34134,34135,34136,34137,34138,34139,17957,18296,21053,34140,34141, -22610,17508,34142,18990,34143,18215,34144,22566,34145,18813,20071,15196,12395, -34146,34147,34148,15146,20525,34149,12592,22372,22335,34150,13605,17012,17487, -34151,34152,12841,34153,12855,34154,12645,24370,21820,16168,16940,22613,16945, -34155,22612,20052,34156,23136,34157,20032,34158,34159,22580,17198,21281,20003, -34160,15412,18484,16977,34161,15981,20534,34162,23137,34163,34164,34165,34166, -18276,34167,34168,13095,34169,13938,19580,16506,34170,34171,16503,34172,20793, -20833,22599,34173,34174,34176,34177,34178,34179,34180,12894,34181,34182,16485, -34183,14961,34184,34185,22600,34186,21549,34187,34188,20321,22601,34189,22602, -20291,34190,13176,15943,34191,34192,34193,34194,22603,34195,34196,34197,34198, -34199,34200,34201,23372,34202,34203,34204,34205,18469,34206,34207,34208,20312, -34209,18558,12878,34210,34211,34212,34213,34214,21334,12902,15408,21329,19243, -14132,34215,34216,34217,14114,34218,34219,19045,34220,18465,19036,12644,20592, -34221,17745,34222,34223,34224,23365,13694,34225,34226,16218,14661,15972,16749, -34227,24374,24373,22075,15696,21849,12360,13859,16201,19496,24371,18999,21330, -34228,22607,21046,14917,19262,19518,34229,24375,13680,24372,34230,34231,34232, -21365,34233,13140,14455,34234,24378,34235,14927,15402,13685,34236,19756,17275, -14963,16500,19778,20338,24376,20293,34237,16960,24377,17008,34238,34239,34240, -15997,34241,16735,19788,21111,14157,24385,34242,24388,34243,34244,14193,12361, -13910,14164,34245,14892,19581,16212,19249,18036,34246,22056,24389,34247,20066, -13107,34248,34249,20092,13365,34250,20039,14960,34251,20065,34252,20797,34253, -34254,24384,34255,34256,13428,34257,13130,34258,14438,24379,34259,34260,34261, -34262,17477,34263,24380,24381,24382,17723,24383,24386,21553,24387,34264,18234, -20056,34265,34266,34267,34268,34269,17496,34270,24394,34271,24399,34272,22108, -34273,34274,34275,34276,34277,34278,34279,34280,24393,24410,20022,34281,14919, -24398,24392,17758,34282,34283,18795,14964,17276,34284,34285,15959,34286,24390, -34287,24397,34288,17752,34289,34290,34291,34292,21798,14925,34293,15948,21309, -14400,34294,22116,34295,24391,14654,16167,34296,34297,16764,24395,24396,34298, -24400,34299,34300,34301,34302,34368,24411,24421,34369,24407,24406,22345,24419, -24420,25963,21031,24402,34370,16169,34371,21595,34372,16200,24404,34373,34374, -34375,20300,34376,34377,24413,34378,20810,34379,24414,12327,17975,24403,34380, -14949,34381,13919,19803,14718,21589,34382,34383,24415,20332,12325,24423,24401, -20806,24405,24408,24409,24412,34384,15145,34385,24416,24417,34386,24418,24422, -24424,21300,34387,34388,34389,34390,34391,14439,17718,24426,18778,16680,17476, -34392,34393,16222,20344,34394,34395,34396,21852,24430,34397,34398,34399,34400, -34401,34402,12856,34403,14943,24428,34404,23361,34405,20836,34406,34407,34408, -34409,19316,13373,34410,12326,34411,34412,34413,34414,34415,24433,19526,24434, -34416,34417,24429,34418,34419,34420,34421,34422,34423,24425,34424,34425,34426, -34427,24427,34428,24431,24432,15165,34429,34430,24435,34432,34433,24436,34434, -15139,34435,19035,20008,24615,13098,34436,24614,34437,34438,34439,24609,34440, -34441,34442,34443,24446,34444,19801,24444,34445,24442,34446,16208,22340,34447, -18764,34448,34449,24440,12321,34450,34451,34452,34453,34454,24445,34455,34456, -34457,34458,24443,24610,34459,34460,34461,34462,34463,24616,34464,34465,34466, -34467,14152,34468,34469,17953,18742,16434,24437,34470,34471,17726,34472,22596, -24441,17526,34473,34474,34475,34476,34477,34478,24611,24612,24613,20517,34479, -34480,24628,19556,34481,24625,34482,16166,24623,20025,24619,18758,34483,34484, -16430,24622,14957,14896,24617,34485,34486,34487,24438,34488,24627,34489,34490, -24632,34491,34492,34493,13357,24633,34494,34495,20274,14920,34496,24624,34497, -34498,34499,34500,34501,34502,34503,20602,34504,34505,34506,34507,34508,34509, -34510,34511,34512,24620,34513,21627,34514,24439,34515,17767,34516,24621,34517, -21367,34518,24630,24631,34519,34520,34521,34522,34523,24644,20577,34524,34525, -34526,24636,34527,34528,24649,24650,34529,34530,34531,24638,24618,18724,24641, -34532,24626,34533,34534,34535,34536,34537,19016,24643,34538,24629,34539,20043, -34540,19267,24653,24646,24642,34541,24651,34542,24634,24639,24640,34543,34544, -24645,34545,34546,24647,24648,34547,24652,34548,24635,34549,34550,34551,34552, -34553,19284,24661,34554,24662,24658,34555,34556,34557,34558,34624,34625,24656, -15438,34626,34627,24657,34628,14402,22597,34629,34630,34631,34632,34633,34634, -34635,34636,20586,34637,34638,17007,34639,34640,24655,24637,34641,34642,34643, -24660,24659,34644,34645,24663,34646,34647,34648,34649,24668,24664,34650,34651, -34652,22134,13104,34653,22380,34654,19259,34655,34656,24666,34657,20091,34658, -34659,34660,14937,34661,34662,34663,34664,34665,34666,34667,34668,34669,34670, -34671,34672,24673,24669,21037,34673,34674,34675,34676,34677,24674,34678,34679, -24667,24665,24671,34680,34681,24672,34682,34683,34684,34685,34686,24670,34688, -24676,34689,34690,34691,18039,22572,21611,24678,19017,34692,34693,34694,34695, -24677,34696,34697,34698,34699,14401,34700,34701,34702,34703,24679,24680,34704, -34705,34706,34707,34708,34709,34710,34711,24681,24675,34712,34713,34714,34715, -34716,34717,34718,14911,19559,34719,34720,34721,24682,34722,34723,34724,34725, -34726,34727,34728,34729,34730,34731,34732,34733,34734,34735,34736,20345,34737, -34738,34739,34740,34741,34742,34743,34744,34745,34746,34747,24683,34748,34749, -34750,34751,34752,34753,34754,18498,34755,34756,34757,34758,15680,34759,34760, -34761,34762,34763,34764,34765,34766,34767,34768,34769,34770,34771,17490,34772, -34773,34774,34775,34776,34777,34778,34779,34780,24684,34781,34782,24685,34783, -34784,18292,19268,34785,24686,15192,22582,21106,24687,19781,34786,13914,34787, -34788,34789,34790,34791,34792,24689,34793,21552,34794,34795,16423,13393,34796, -34797,20007,24688,34798,34799,34800,24690,14668,34801,34802,14714,19772,24691, -34803,34804,34805,18004,24692,34806,21554,34807,18470,24694,24693,34808,34809, -34810,34811,34812,34813,34814,34880,34881,34882,34883,34884,34885,34886,34887, -34888,34889,24695,34890,34891,19777,34892,34893,34894,18981,34895,34896,34897, -34898,21594,23383,23385,34899,23384,14695,23388,23389,13656,34900,34901,23386, -34902,34903,34904,34905,34906,23387,13089,23391,34907,34908,15224,34909,22071, -34910,23392,34911,34912,34913,34914,15993,34915,34916,14139,34917,23376,19502, -16178,15157,22392,16211,34918,34919,34920,34921,34922,16233,34923,34924,15457, -19507,23390,12371,20075,14168,22329,17986,34925,34926,16420,34927,19513,34928, -23399,23393,17978,23395,34929,23400,34930,17783,34931,34932,34933,23402,34934, -34935,23401,16192,34936,34937,34938,23398,23397,34939,34940,34941,34942,34944, -13369,16428,16930,23394,23396,34945,34946,34947,34948,20557,23405,34949,34950, -34951,34952,34953,16477,23410,34954,34955,34956,34957,34958,34959,34960,13922, -34961,34962,34963,34964,23411,23378,14648,21547,23404,34965,16209,23408,34966, -23377,34967,13670,34968,23403,16229,34969,34970,34971,23406,34972,23409,34973, -34974,34975,23417,34976,34977,34978,34979,34980,34981,34982,34983,34984,14625, -12323,34985,34986,34987,34988,34989,34990,34991,17009,34992,34993,13127,23407, -34994,34995,23416,34996,18002,23412,34997,34998,23413,23415,23414,34999,35000, -23422,35001,21362,12858,35002,35003,35004,23421,35005,35006,35007,35008,35009, -35010,35011,35012,23588,35013,23419,35014,35015,35016,35017,23418,35018,35019, -35020,23420,17760,15225,35021,35022,23587,35023,35024,23589,35025,19523,35026, -35027,35028,13905,23872,35029,35030,35031,23585,35032,23586,35033,35034,35035, -18229,35036,35037,35038,13929,35039,35040,35041,23591,35042,35043,35044,35045, -23590,35046,23593,12580,35047,35048,13644,35049,35050,35051,35052,35053,16176, -35054,35055,35056,35057,35058,20831,35059,35060,35061,35062,13890,35063,35064, -35065,35066,35067,35068,35069,35070,35136,35137,35138,35139,35140,35141,23592, -35142,35143,35144,35145,35146,35147,35148,19322,27507,35149,35150,35151,19292, -35152,35153,19326,35154,35155,35156,19521,35157,35158,35159,35160,35161,18555, -35162,35163,35164,35165,35166,35167,23594,35168,35169,35170,35171,35172,19566, -23595,35173,35174,35175,35176,35177,35178,35179,35180,35181,35182,35183,35184, -35185,35186,35187,35188,35189,23379,35190,23599,23596,35191,15923,35192,19067, -35193,35194,35195,23597,35196,35197,35198,35200,35201,35202,35203,35204,18762, -17465,35205,35206,35207,35208,35209,18237,23598,35210,35211,35212,21622,20582, -35213,35214,35215,35216,35217,35218,35219,35220,17451,13909,35221,35222,35223, -35224,35225,35226,35227,35228,35229,35230,35231,35232,35233,35234,35235,35236, -35237,35238,23380,35239,35240,35241,35242,12634,35243,35244,35245,23381,35246, -35247,35248,35249,35250,35251,35252,35253,35254,35255,35256,23382,35257,35258, -35259,14910,35260,35261,35262,35263,35264,35265,35266,35267,35268,35269,35270, -35271,35272,35273,18496,35274,35275,35276,35277,35278,35279,19007,18505,35280, -22323,35281,18809,35282,35283,16199,35284,35285,14968,35286,35287,21052,35288, -35289,35290,35291,35292,35293,35294,35295,25146,35296,13350,35297,35298,12600, -35299,35300,35301,35302,35303,14388,35304,20292,35305,35306,35307,35308,22887, -20262,19810,35309,35310,22893,13920,35311,21049,35312,35313,14651,35314,35315, -35316,35317,25145,25143,35318,13427,35319,19564,19499,14194,35320,22578,20843, -14907,35321,18983,35322,35323,19767,35324,35325,21060,16228,15440,13921,35326, -24133,35392,35393,35394,35395,24134,23356,35396,20825,35397,35398,18022,17486, -14190,35399,14172,35400,35401,16252,22368,35402,18037,35403,35404,12604,24136, -15665,19543,24138,35405,24137,35406,35407,35408,35409,35410,13676,35411,18781, -35412,35413,12354,35414,35415,35416,35417,35418,35419,35420,35421,35422,35423, -35424,35425,35426,17710,17707,35427,17484,35428,15465,19325,35429,35430,35431, -14915,35432,35433,35434,25977,18535,25978,19837,35435,22321,14398,17000,35436, -18513,35437,35438,25979,35439,35440,35441,35442,13898,15435,35443,35444,20861, -26145,35445,17262,35446,35447,35448,35449,26148,35450,35451,35452,35453,25982, -26149,19799,35454,35456,14145,25980,25981,26147,35457,35458,17501,26152,35459, -35460,26151,35461,35462,35463,35464,35465,35466,17219,35467,18014,35468,35469, -26154,35470,35471,35472,35473,35474,35475,35476,17463,35477,35478,35479,26146, -19004,35480,35481,35482,35483,15715,14659,26150,20565,20015,35484,35485,26153, -26160,35486,21030,35487,15658,26157,35488,35489,35490,35491,35492,26159,35493, -16465,35494,35495,21068,35496,35497,35498,15399,35499,35500,35501,35502,35503, -35504,35505,35506,35507,35508,35509,35510,26161,35511,21110,35512,35513,35514, -22347,35515,19838,35516,19806,16934,26155,26156,15679,26158,26163,35517,35518, -26162,35519,35520,35521,35522,26166,35523,26168,35524,35525,35526,35527,17519, -35528,35529,35530,17480,35531,35532,15978,18799,35533,35534,26167,35535,13936, -35536,35537,35538,17252,35539,35540,35541,35542,35543,35544,35545,21353,26164, -35546,26165,35547,18466,35548,35549,35550,35551,35552,26173,35553,35554,35555, -26169,35556,35557,35558,35559,35560,17989,35561,35562,19825,26171,35563,35564, -35565,35566,35567,35568,35569,35570,35571,35572,26172,35573,35574,35575,35576, -15209,35577,35578,35579,35580,35581,35582,35648,26174,35649,35650,35651,35652, -26170,35653,35654,16439,35655,35656,35657,35658,35659,35660,35661,35662,35663, -21284,26175,18804,26179,35664,35665,26180,35666,35667,35668,35669,20598,35670, -35671,35672,35673,35674,35675,35676,35677,35678,35679,35680,35681,35682,35683, -35684,35685,35686,35687,17213,35688,35689,35690,35691,35692,35693,35694,17220, -26178,35695,35696,35697,35698,35699,35700,35701,35702,35703,35704,35705,35706, -35707,35708,26177,35709,35710,35712,35713,35714,35715,35716,26183,20273,35717, -27508,35718,35719,26186,35720,35721,35722,35723,35724,26181,35725,35726,15454, -18729,35727,35728,35729,35730,35731,35732,15413,35733,35734,20307,35735,35736, -35737,35738,35739,26184,35740,26185,35741,26190,35742,26192,35743,35744,35745, -26193,35746,35747,35748,26187,13653,35749,26188,35750,35751,26191,35752,35753, -17499,35754,26182,35755,35756,35757,35758,35759,26189,35760,35761,35762,35763, -35764,35765,35766,35767,35768,35769,35770,35771,35772,35773,35774,35775,35776, -35777,35778,35779,35780,35781,35782,26194,35783,35784,35785,35786,35787,35788, -35789,35790,35791,35792,35793,35794,26196,26195,35795,35796,35797,35798,35799, -35800,35801,35802,35803,35804,35805,35806,35807,35808,35809,35810,35811,35812, -35813,35814,35815,35816,35817,35818,35819,35820,26197,35821,22904,35822,35823, -26198,35824,35825,35826,35827,35828,35829,35830,35831,26199,35832,35833,35834, -35835,35836,35837,35838,35904,35905,35906,35907,35908,35909,35910,35911,22355, -26205,35912,26206,16215,21584,35913,22358,13414,19311,26202,22595,22350,20514, -35914,17231,35915,35916,26207,15422,14658,26203,20775,35917,35918,14882,16975, -35919,22571,35920,35921,35922,19051,25966,35923,26204,35924,14197,35925,35926, -35927,35928,18534,35929,35930,17525,35931,35932,25906,17534,35933,19324,25907, -21804,35934,21358,19032,12338,35935,19278,19818,35936,35937,14954,35938,35939, -35940,25909,35941,25908,35942,22362,14681,22118,13864,19824,21067,12582,18997, -35943,13160,18803,16205,20603,19026,25910,15170,35944,35945,35946,20316,14636, -35947,35948,35949,35950,21591,35951,35952,14886,20839,20348,15442,35953,25911, -18525,35954,35955,35956,16237,12662,19294,35957,35958,15429,35959,15428,21114, -17244,16220,35960,35961,35962,35963,14395,35964,35965,35966,17218,35968,14894, -21538,35969,35970,35971,35972,35973,35974,35975,35976,35977,18270,17455,12908, -35978,14673,35979,35980,25915,16712,35981,35982,21807,35983,35984,35985,35986, -35987,25916,35988,25918,35989,35990,35991,35992,35993,35994,35995,13415,13908, -19266,20784,13628,35996,35997,19033,35998,14178,35999,36000,18788,36001,15659, -36002,36003,20030,22384,36004,36005,36006,36007,20513,36008,18777,36009,36010, -13947,26200,15458,36011,13118,36012,18768,36013,26201,13090,36014,36015,36016, -36017,24140,36018,21320,24141,36019,21026,36020,36021,36022,36023,24142,36024, -36025,36026,36027,15949,36028,36029,24143,36030,36031,36032,18988,21116,13151, -25962,17505,15905,20018,17522,15958,17960,12899,36033,36034,15955,36035,36036, -18300,19563,15724,20061,36037,36038,19002,17985,25964,20540,36039,36040,36041, -21817,36042,36043,36044,25965,36045,36046,36047,36048,19060,36049,19776,16965, -36050,25967,36051,16964,25968,36052,36053,36054,36055,36056,36057,36058,25976, -19789,36059,18749,36060,36061,36062,36063,36064,36065,36066,21081,24872,36067, -36068,36069,36070,21356,36071,19306,18033,36072,36073,36074,36075,36076,24876, -36077,36078,36079,24871,24873,36080,36081,24874,24879,36082,36083,12909,36084, -24875,14426,24877,24878,24880,13626,24881,36085,36086,36087,36088,36089,24883, -24888,36090,36091,36092,36093,36094,20818,36160,24886,24885,16747,36161,36162, -36163,24887,36164,21568,36165,24882,36166,24890,12342,36167,36168,36169,36170, -24884,36171,16249,36172,24889,36173,36174,24891,36175,36176,36177,36178,36179, -36180,24894,36181,36182,36183,36184,36185,36186,24892,36187,36188,36189,36190, -36191,36192,22085,36193,36194,36195,36196,36197,36198,36199,20287,36200,36201, -24893,24895,16973,36202,13931,36203,21368,36204,36205,18253,36206,36207,14181, -36208,36209,36210,36211,36212,36213,36214,36215,36216,36217,15998,36218,36219, -36220,36221,36222,36224,24896,24897,36225,36226,24903,13159,36227,36228,36229, -36230,36231,36232,18025,36233,36234,36235,36236,36237,13406,36238,20802,36239, -36240,36241,36242,24904,36243,36244,24902,36245,36246,36247,36248,36249,24901, -36250,24899,24898,36251,12608,36252,36253,36254,21816,24900,36255,36256,36257, -36258,36259,24907,36260,36261,36262,36263,36264,36265,36266,36267,24908,24906, -36268,36269,36270,36271,36272,36273,36274,36275,28538,36276,36277,24915,24914, -18230,36278,36279,36280,36281,36282,36283,36284,36285,36286,36287,36288,24905, -36289,36290,24910,36291,24912,36292,36293,36294,36295,36296,36297,36298,36299, -36300,36301,36302,24916,36303,24913,24909,36304,36305,24911,36306,36307,36308, -36309,24917,36310,36311,36312,36313,36314,36315,36316,36317,36318,36319,36320, -36321,36322,24918,36323,36324,36325,36326,36327,36328,36329,36330,36331,36332, -36333,36334,36335,36336,36337,36338,36339,36340,36341,36342,36343,36344,24919, -36345,36346,36347,24920,36348,36349,36350,36416,36417,36418,36419,36420,36421, -36422,36423,36424,36425,36426,36427,36428,36429,36430,36431,36432,36433,36434, -36435,36436,36437,24922,36438,36439,36440,36441,36442,36443,36444,36445,36446, -36447,36448,36449,36450,24923,36451,36452,36453,36454,36455,36456,36457,20001, -36458,36459,36460,36461,36462,36463,36464,36465,36466,36467,36468,36469,36470, -26461,36471,13352,22109,36472,36473,20786,13106,36474,36475,14628,22387,18249, -15966,14638,36476,20055,36477,36478,12910,23375,36480,15418,21073,19272,12365, -36481,36482,20335,36483,36484,36485,36486,36487,22883,15725,36488,36489,12626, -19024,12860,36490,19239,14123,36491,18982,36492,36493,36494,20259,36495,36496, -24696,21834,24699,36497,36498,24698,17729,19579,36499,16689,24697,22115,12847, -22084,13659,36500,36501,36502,36503,36504,36505,36506,36507,13432,22049,36508, -36509,36510,36511,36512,20271,12399,36513,36514,24700,36515,36516,36517,36518, -36519,24865,13091,36520,36521,24701,24702,17201,36522,36523,36524,36525,17245, -36526,24866,14201,36527,36528,36529,36530,36531,36532,15183,36533,36534,36535, -36536,36537,36538,36539,24867,17467,36540,36541,36542,36543,36544,24868,36545, -36546,24869,36547,36548,24870,13361,36549,36550,36551,36552,36553,36554,36555, -36556,36557,36558,36559,36560,36561,36562,36563,14409,17981,17514,36564,12834, -36565,20562,36566,26459,15171,21335,21316,36567,14691,25167,36568,36569,36570, -22319,36571,18284,12627,36572,36573,13362,25169,36574,36575,36576,20594,16942, -25168,36577,16226,21286,13655,25170,13674,36578,17261,14461,36579,14382,36580, -17747,14159,25172,36581,36582,36583,36584,25171,13896,22393,36585,36586,36587, -36588,36589,19749,36590,36591,36592,36593,36594,25176,36595,25174,19068,16181, -21305,25173,36596,36597,36598,36599,25175,36600,36601,36602,36603,36604,36605, -36606,36672,36673,36674,16686,16456,36675,36676,36677,36678,36679,36680,25179, -25178,16426,36681,36682,16718,36683,36684,36685,36686,25180,36687,36688,36689, -36690,36691,36692,36693,36694,36695,36696,36697,36698,25181,36699,25182,36700, -36701,36702,36703,36704,36705,36706,36707,36708,23368,36709,20819,19746,36710, -36711,15656,36712,36713,36714,24131,22565,16170,23373,21100,18042,17706,36715, -36716,36717,24132,36718,12631,24366,36719,36720,36721,19005,36722,24369,36723, -14637,36724,21117,36725,14373,14955,36726,36727,13146,36728,36729,36730,13660, -21829,36731,36732,36733,36734,17238,20306,15137,36736,25971,25970,36737,36738, -25972,36739,19812,36740,18549,36741,36742,36743,36744,36745,36746,36747,13615, -18239,36748,25974,36749,36750,36751,27696,36752,36753,36754,36755,36756,36757, -36758,36759,36760,36761,36762,36763,36764,36765,36766,25958,36767,14697,13617, -36768,16956,25960,25959,25961,36769,36770,36771,36772,21069,36773,36774,36775, -24938,20558,36776,19758,36777,20837,36778,36779,12874,12651,36780,12658,17773, -36781,36782,21827,21296,36783,24924,36784,36785,36786,24925,36787,21083,36788, -13113,12619,36789,36790,36791,19833,21879,24926,36792,15926,13437,36793,24927, -14940,24928,15154,16969,24929,36794,36795,36796,20588,36797,19773,36798,36799, -24930,36800,13635,17735,24931,36801,36802,24932,36803,36804,36805,36806,21369, -36807,36808,36809,36810,36811,36812,24933,36813,20781,36814,36815,24934,20002, -36816,36817,36818,36819,36820,36821,24935,36822,13634,36823,36824,36825,36826, -24936,15189,36827,36828,36829,36830,36831,20548,25184,12632,21092,36832,36833, -25185,36834,36835,15433,18508,36836,25187,27774,27773,24367,36837,36838,36839, -25186,22078,19836,17190,36840,36841,36842,25411,36843,36844,22098,25191,36845, -36846,25192,36847,36848,21319,36849,36850,25196,16236,36851,25197,25189,36852, -36853,13120,36854,36855,36856,17518,36857,36858,25198,36859,36860,20547,36861, -14966,25193,14174,15155,19500,19275,25188,25190,25194,25195,36862,36928,36929, -25207,36930,36931,25204,21621,25203,36932,36933,17709,36934,21882,17730,12864, -36935,36936,25199,36937,25202,16687,19260,36938,36939,13601,25209,36940,36941, -36942,15409,25201,20564,21561,25205,14678,25206,36943,36944,36945,18259,36946, -36947,36948,36949,36950,25200,36951,36952,36953,36954,36955,22364,27937,36956, -36957,25208,36958,27941,25214,19025,36959,36960,36961,36962,36963,36964,36965, -16693,36966,15184,36967,36968,16214,36969,14947,36970,36971,19233,36972,36973, -36974,27942,27939,36975,36976,27938,36977,36978,36979,36980,15190,27943,20596, -36981,36982,27940,14942,13943,25377,13874,19569,14631,36983,20258,18209,36984, -36985,16210,36986,36987,13937,36988,25210,25211,25213,25212,17493,25378,36989, -21313,36990,36992,36993,25383,18244,36994,36995,36996,36997,20260,36998,36999, -25385,14903,37000,37001,37002,37003,25384,37004,15194,37005,25379,37006,37007, -37008,25380,25386,37009,25382,37010,20082,21318,37011,37012,15164,37013,37014, -21571,37015,17530,37016,37017,27944,20604,25381,37018,17269,37019,25389,12591, -37020,25394,37021,37022,37023,15426,37024,37025,25388,13631,37026,37027,37028, -37029,37030,37031,37032,37033,18281,25392,37034,37035,37036,15914,19823,37037, -37038,37039,37040,37041,15219,37042,37043,37044,19560,37045,37046,25391,37047, -25393,37048,20263,25390,37049,20009,15197,37050,37051,37052,37053,37054,13675, -15973,12882,13133,37055,12601,25387,12881,13612,14687,13928,37056,37057,20331, -25399,37058,15180,37059,37060,18503,20554,37061,37062,37063,37064,37065,25400, -13166,37066,37067,37068,37069,27945,37070,21370,21348,37071,37072,37073,27946, -25401,21090,37074,37075,37076,37077,37078,25397,37079,37080,37081,37082,21342, -37083,37084,37085,37086,14416,25395,37087,37088,25398,14175,37089,25396,16418, -37090,37091,37092,25402,37093,37094,37095,37096,37097,37098,37099,37100,37101, -37102,37103,37104,37105,37106,37107,37108,37109,37110,37111,21560,37112,37113, -37114,37115,37116,37117,37118,37184,13384,37185,25403,37186,15173,37187,18807, -37188,37189,18789,37190,37191,37192,17469,37193,37194,37195,37196,37197,37198, -37199,27947,37200,37201,37202,37203,17021,37204,37205,37206,37207,15195,16174, -37208,37209,37210,37211,37212,37213,37214,20031,37215,37216,37217,37218,25404, -37219,16182,37220,37221,37222,37223,37224,37225,37226,37227,37228,37229,37230, -37231,37232,37233,37234,37235,37236,37237,37238,12655,37239,37240,21623,37241, -37242,37243,37244,37245,25406,37246,37248,37249,37250,37251,37252,37253,37254, -27949,37255,37256,37257,37258,37259,37260,37261,37262,37263,25407,14889,27948, -37264,37265,25405,37266,37267,37268,37269,37270,37271,37272,37273,37274,37275, -25408,37276,37277,37278,37279,37280,37281,14902,37282,37283,37284,13870,37285, -37286,37287,37288,37289,20536,37290,12355,27950,37291,37292,37293,37294,37295, -27951,16449,37296,25409,37297,37298,37299,37300,37301,37302,37303,37304,37305, -37306,37307,37308,37309,37310,37311,37312,37313,17715,37314,37315,37316,37317, -37318,37319,37320,37321,37322,37323,37324,37325,37326,37327,25410,37328,37329, -37330,37331,37332,37333,37334,37335,37336,23602,37337,37338,37339,37340,37341, -37342,27952,37343,14442,37344,20076,27175,20583,19065,18518,20279,13129,20050, -15716,37345,37346,25438,15218,27176,21821,37347,18013,27177,37348,37349,37350, -27178,37351,27180,27179,37352,27182,27181,37353,37354,37355,37356,15704,37357, -27183,37358,16958,37359,37360,37361,37362,13377,13431,37363,37364,15143,37365, -37366,37367,37368,37369,27750,27749,14143,19321,12642,37370,27751,37371,37372, -37373,18760,27752,27753,37374,19030,24144,12869,21626,37440,37441,17995,12359, -13426,18515,37442,37443,37444,19792,37445,37446,16184,37447,37448,37449,37450, -37451,37452,37453,16219,37454,37455,18212,22068,37456,16425,24145,18728,20847, -17700,12391,13110,18501,37457,37458,12386,37459,37460,14198,37461,37462,17786, -37463,37464,13939,37465,21842,13136,15420,37466,37467,37468,13101,37469,37470, -37471,37472,15985,12369,37473,37474,37475,37476,37477,37478,21078,19043,22309, -37479,19766,13878,16185,21851,37480,14375,17751,37481,37482,37483,24146,16217, -16981,18240,37484,15140,12584,37485,37486,17770,37487,37488,17787,19495,37489, -37490,37491,37492,12583,37493,37494,37495,13654,37496,37497,37498,17448,37499, -24147,20794,13161,37500,17266,37501,37502,14199,37504,22132,13603,12912,17460, -17513,16429,24148,37505,12392,17732,16736,37506,14677,37507,15964,19800,12366, -37508,19791,24150,15952,22334,24149,21840,12381,37509,37510,17506,37511,37512, -16931,15472,37513,21301,16441,17697,12838,21617,37514,37515,16424,19011,24151, -21884,37516,14640,37517,18477,19241,37518,24153,16189,37519,37520,37521,37522, -17972,22311,18992,17475,37523,13142,14674,37524,37525,37526,37527,22072,27260, -12340,37528,37529,37530,37531,16230,37532,37533,19572,37534,37535,37536,37537, -19802,37538,37539,37540,22079,16974,37541,20046,19490,20526,17491,13618,24152, -21877,15415,15187,37542,37543,12324,37544,17714,13420,37545,37546,37547,21873, -37548,37549,27261,37550,37551,37552,37553,37554,37555,24154,19750,37556,37557, -19820,37558,37559,37560,37561,20070,24156,37562,19761,16422,37563,37564,22333, -37565,24155,12358,14900,18771,17523,15976,37566,37567,37568,37569,12854,37570, -37571,37572,37573,37574,37575,37576,37577,16460,19312,37578,15473,15163,13623, -37579,37580,37581,17781,37582,24166,37583,37584,37585,24163,15965,37586,37587, -24159,37588,37589,37590,37591,13367,15709,37592,37593,24160,17517,37594,37595, -37596,37597,20294,37598,13664,37599,37600,37601,37602,13918,19034,13684,24165, -37603,21830,37604,24161,19533,18046,37605,17733,37606,37607,37608,21044,37609, -15986,37610,37611,37612,37613,37614,37615,37616,16979,37617,19517,13112,37618, -15699,37619,16216,19782,20826,13419,37620,24164,24157,24167,37621,27262,37622, -37623,16944,24162,37624,37625,22080,13607,37626,12916,37627,24168,37628,24178, -37629,37630,37696,37697,37698,24173,37699,24177,37700,37701,18528,37702,37703, -37704,22369,24175,17256,19553,37705,12901,37706,37707,37708,21054,37709,37710, -37711,37712,37713,37714,37715,24174,37716,24171,20053,37717,13351,37718,37719, -37720,37721,37722,16171,15934,37723,37724,15698,37725,37726,37727,37728,24169, -37729,21550,37730,24158,37731,24170,37732,37733,37734,37735,16447,37736,24172, -12915,14441,16935,37737,37738,15681,37739,37740,37741,37742,37743,24181,24184, -37744,37745,12843,13348,37746,37747,13418,18726,37748,37749,37750,37751,37752, -37753,24182,19281,37754,14435,37755,24183,24186,37756,37757,37758,37760,24185, -37761,37762,37763,19522,37764,12385,13422,37765,37766,37767,37768,37769,37770, -25914,37771,37772,37773,37774,37775,20527,37776,37777,12907,37778,27425,37779, -24180,37780,37781,18787,24179,12378,21025,12663,37782,19503,37783,37784,37785, -37786,37787,37788,37789,24176,37790,19236,37791,37792,37793,21802,37794,37795, -37796,37797,37798,24187,37799,37800,37801,37802,37803,37804,37805,37806,13405, -37807,17446,37808,37809,37810,24189,37811,37812,37813,37814,37815,37816,37817, -37818,37819,37820,17278,17441,24353,37821,37822,37823,37824,37825,37826,37827, -16716,37828,24188,15983,37829,17970,37830,37831,37832,37833,37834,37835,37836, -37837,37838,13125,18550,37839,37840,19258,24190,37841,37842,24356,37843,37844, -37845,37846,22322,37847,37848,37849,37850,37851,13111,37852,37853,37854,37855, -16707,37856,37857,18251,12837,13417,37858,22315,37859,37860,37861,37862,17516, -37863,24354,24355,37864,24357,37865,14899,37866,37867,37868,24358,37869,16478, -37870,37871,18755,37872,37873,37874,37875,37876,37877,37878,12889,18278,37879, -24359,37880,18268,37881,37882,37883,37884,24360,27426,37885,37886,37952,37953, -37954,19283,37955,37956,37957,24362,37958,24361,37959,12865,37960,37961,37962, -37963,37964,37965,37966,37967,37968,37969,37970,37971,37972,37973,37974,37975, -37976,37977,37978,37979,37980,37981,37982,37983,37984,17738,37985,37986,37987, -37988,37989,37990,37991,37992,24363,37993,37994,37995,37996,37997,37998,37999, -38000,21596,38001,38002,38003,38004,38005,18497,38006,38007,38008,38009,38010, -38011,38012,38013,38014,38016,38017,38018,24364,38019,38020,38021,38022,38023, -15984,38024,38025,24365,22055,38026,38027,38028,38029,27191,27446,19029,38030, -22652,14404,38031,14629,38032,38033,14149,21886,38034,38035,38036,38037,38038, -14666,38039,38040,20519,29773,38041,38042,13648,38043,38044,17268,38045,15944, -38046,38047,38048,27447,12349,38049,38050,15692,38051,16690,38052,12630,13096, -38053,38054,38055,14418,18722,38056,38057,13912,38058,38059,38060,38061,27448, -15924,38062,38063,38064,19069,38065,18243,38066,21883,38067,38068,14195,38069, -38070,38071,38072,38073,38074,38075,38076,38077,38078,38079,38080,38081,38082, -38083,20036,38084,38085,38086,21803,12659,38087,38088,38089,27699,12383,38090, -27701,38091,38092,38093,13879,38094,16719,38095,30074,20529,38096,38097,21861, -38098,20051,38099,38100,15727,13154,38101,14379,38102,21814,38103,27965,38104, -13903,38105,19257,20546,38106,38107,38108,38109,38110,38111,38112,38113,14141, -38114,38115,27702,18985,38116,38117,38118,17748,38119,27705,27704,16963,27703, -38120,38121,38122,38123,20605,27706,38124,27707,22373,38125,38126,27708,38127, -38128,38129,27709,18028,38130,38131,38132,38133,38134,38135,38136,38137,20062, -38138,15432,38139,38140,18517,13609,15945,22076,21607,38141,38142,20782,20593, -27192,27193,27194,14901,38208,38209,38210,38211,18993,16245,38212,38213,19834, -38214,38215,38216,38217,38218,27200,38219,12346,27198,38220,38221,16421,38222, -38223,38224,27195,38225,12925,38226,17271,15208,38227,38228,38229,21079,20084, -27199,38230,38231,38232,27196,38233,38234,38235,27203,38236,20551,21299,38237, -38238,38239,38240,13370,38241,17217,22386,38242,38243,38244,38245,21841,38246, -19015,38247,27205,38248,38249,27204,27207,27206,38250,38251,38252,38253,38254, -22119,38255,20308,38256,38257,27211,38258,15182,38259,38260,38261,38262,38263, -38264,38265,15738,18766,38266,38267,27212,38268,38269,18745,20350,27210,21582, -27213,27215,38270,38272,19821,38273,38274,38275,38276,27209,38277,27214,38278, -38279,20078,38280,15198,38281,13119,38282,38283,38284,38285,38286,18005,15920, -20090,38287,38288,38289,18279,38290,15911,27216,38291,38292,22087,38293,38294, -38295,16704,38296,38297,38298,21597,38299,27217,38300,38301,20286,38302,38303, -38304,38305,27218,38306,38307,38308,38309,19054,38310,38311,38312,38313,17711, -12341,38314,38315,38316,38317,38318,27220,38319,38320,38321,38322,38323,38324, -38325,38326,38327,27219,29791,38328,38329,38330,38331,38332,17466,38333,38334, -38335,38336,38337,12585,38338,38339,38340,38341,25951,38342,38343,38344,38345, -27221,38346,38347,38348,38349,38350,38351,38352,38353,38354,38355,38356,38357, -38358,38359,38360,38361,38362,38363,38364,38365,38366,38367,38368,38369,38370, -38371,19055,38372,27222,27223,18008,38373,38374,38375,38376,38377,38378,38379, -38380,27224,38381,38382,27225,38383,38384,38385,38386,38387,38388,21563,38389, -18298,21047,14460,38390,38391,27202,38392,12892,38393,38394,17020,38395,21624, -19558,22382,38396,38397,38398,38464,38465,38466,38467,21570,21328,27459,17779, -38468,14206,38469,38470,27476,38471,38472,38473,19255,27486,38474,16458,38475, -38476,38477,19835,38478,13103,38479,18010,38480,38481,38482,38483,38484,38485, -27516,38486,17470,38487,20020,17449,12606,21629,38488,19061,38489,22124,38490, -38491,18003,13924,38492,38493,38494,38495,15226,38496,38497,20576,38498,38499, -18737,38500,21587,18472,38501,38502,14411,38503,26686,18748,38504,38505,26683, -38506,16494,20563,12868,13413,38507,26684,38508,38509,21832,38510,38511,38512, -38513,38514,13893,38515,26685,19064,14428,19573,38516,38517,38518,16436,38519, -38520,20846,26687,26690,38521,38522,14908,38523,12589,15708,38524,27197,26691, -38525,26694,38526,26699,38528,38529,38530,38531,26700,38532,19273,12389,38533, -15403,38534,38535,14649,38536,38537,26689,38538,19831,38539,26698,38540,38541, -38542,38543,20086,38544,38545,38546,38547,21869,38548,16726,26692,38549,17206, -38550,14715,22054,26696,38551,38552,38553,19040,21606,38554,26688,38555,26693, -26695,38556,18233,14179,38557,26697,38558,16221,26706,38559,38560,26711,38561, -26709,15452,15439,26715,38562,38563,38564,38565,38566,38567,38568,38569,26718, -38570,26714,12666,38571,38572,38573,38574,38575,38576,38577,38578,38579,38580, -12376,17459,14412,18018,18494,18529,38581,38582,38583,26703,26708,26710,38584, -14705,26712,22389,38585,17531,38586,26716,38587,38588,12905,38589,38590,38591, -26705,38592,38593,15469,38594,38595,16194,26701,22137,38596,16760,12913,38597, -38598,38599,38600,38601,38602,38603,38604,26719,38605,19009,26713,38606,38607, -38608,38609,21796,38610,12650,21819,26702,26704,13872,26707,38611,26717,16440, -38612,19063,38613,19240,38614,38615,18012,16501,38616,38617,38618,38619,38620, -26729,38621,38622,38623,20515,38624,38625,38626,38627,38628,38629,38630,26738, -22122,38631,38632,38633,38634,38635,38636,38637,26720,26721,38638,38639,38640, -20857,14923,14457,38641,38642,14449,21588,26735,38643,26734,26732,14704,19538, -26726,20006,16242,38644,12344,26737,26736,38645,22336,38646,26724,38647,19753, -18723,38648,15160,15707,26730,38649,38650,38651,38652,38653,38654,38720,38721, -38722,38723,26722,26723,26725,13621,26727,18245,26731,26733,15664,22318,38724, -26744,38725,38726,38727,38728,38729,38730,38731,38732,26741,38733,19760,26742, -38734,38735,38736,38737,38738,38739,38740,38741,38742,16698,38743,26728,38744, -17207,12400,38745,38746,38747,38748,38749,38750,38751,38752,26740,38753,38754, -38755,26743,38756,38757,38758,14627,38759,38760,38761,38762,38763,38764,38765, -38766,38767,38768,18770,38769,38770,38771,17230,20064,16486,38772,38773,38774, -38775,19315,38776,19549,20533,38777,38778,19041,38779,26739,38780,38781,38782, -38784,38785,38786,38787,38788,38789,38790,15468,38791,26745,38792,38793,38794, -38795,38796,38797,17246,38798,18021,38799,14711,38800,38801,38802,38803,12404, -38804,38805,22360,38806,38807,15404,38808,17775,38809,38810,38811,38812,38813, -19524,38814,38815,26918,38816,38817,38818,38819,38820,38821,38822,38823,38824, -38825,18733,38826,26914,16482,38827,38828,38829,16195,38830,38831,38832,26750, -14679,38833,26747,38834,38835,38836,38837,26916,38838,38839,38840,21070,38841, -38842,38843,38844,38845,26915,38846,22066,22325,38847,26919,38848,15671,38849, -38850,38851,38852,38853,38854,38855,38856,38857,38858,38859,38860,26748,26749, -38861,38862,38863,26913,38864,38865,38866,38867,38868,38869,38870,38871,19798, -38872,38873,21036,38874,38875,38876,26930,38877,38878,38879,38880,26921,38881, -38882,38883,13354,38884,13371,38885,38886,26923,38887,38888,38889,38890,38891, -38892,38893,38894,38895,38896,38897,38898,38899,38900,38901,38902,38903,20520, -38904,38905,26917,38906,38907,13182,38908,38909,26924,16483,38910,26922,38976, -38977,26937,38978,38979,26936,38980,38981,38982,38983,26926,38984,38985,26746, -38986,38987,26920,38988,38989,38990,38991,38992,16172,26929,26938,38993,38994, -16933,38995,38996,38997,26927,38998,14405,38999,26925,39000,21340,26932,26933, -26935,39001,39002,39003,26951,39004,39005,39006,39007,39008,39009,16454,26949, -39010,39011,26928,39012,39013,26939,12401,39014,39015,39016,39017,39018,39019, -39020,39021,39022,39023,26940,21797,39024,39025,26942,39026,26943,39027,39028, -39029,26945,39030,39031,16753,39032,39033,18486,39034,39035,39036,26941,39037, -39038,39040,39041,39042,26946,39043,39044,39045,39046,39047,39048,39049,39050, -26947,39051,26931,39052,26934,39053,15153,39054,39055,39056,26944,39057,39058, -39059,39060,39061,39062,15479,39063,39064,39065,26948,26950,39066,39067,39068, -39069,39070,39071,39072,39073,39074,39075,39076,39077,26954,39078,39079,39080, -39081,26958,39082,39083,39084,39085,39086,39087,39088,39089,39090,39091,12891, -39092,26952,39093,39094,39095,39096,39097,39098,39099,39100,39101,39102,14126, -39103,39104,39105,39106,39107,39108,39109,39110,39111,39112,39113,39114,26955, -26956,39115,39116,39117,39118,39119,39120,21825,39121,17443,39122,39123,39124, -39125,39126,39127,26968,39128,14945,39129,39130,39131,39132,26953,39133,21283, -39134,39135,39136,26964,39137,39138,39139,39140,39141,39142,39143,26967,26960, -39144,39145,39146,39147,39148,26959,39149,39150,18241,39151,39152,39153,39154, -39155,39156,39157,39158,26962,39159,39160,39161,39162,39163,39164,39165,26969, -13128,39166,26963,39232,39233,39234,39235,39236,20336,39237,39238,39239,26957, -39240,39241,39242,39243,39244,39245,39246,39247,39248,39249,39250,13175,39251, -39252,39253,39254,39255,39256,39257,26966,39258,39259,26970,39260,39261,39262, -19508,39263,39264,39265,20269,39266,39267,39268,39269,39270,39271,39272,39273, -39274,26965,39275,26972,26971,39276,39277,39278,39279,39280,26974,39281,39282, -39283,39284,39285,39286,39287,39288,26961,39289,39290,39291,39292,39293,39294, -39296,39297,26973,39298,26975,17226,39299,39300,39301,39302,39303,39304,39305, -39306,39307,39308,39309,39310,39311,39312,39313,39314,39315,39316,39317,39318, -39319,39320,39321,39322,39323,39324,39325,39326,39327,39328,39329,39330,39331, -39332,39333,39334,39335,39336,39337,39338,39339,39340,39341,39342,39343,39344, -39345,39346,39347,39348,39349,39350,39351,39352,39353,39354,39355,39356,39357, -39358,39359,39360,39361,39362,39363,39364,39365,39366,39367,39368,39369,39370, -39371,39372,39373,39374,39375,39376,39377,39378,39379,39380,39381,39382,39383, -39384,39385,39386,39387,39388,39389,39390,39391,39392,39393,39394,39395,39396, -39397,39398,39399,39400,39401,39402,39403,39404,39405,39406,39407,39408,39409, -39410,39411,39412,39413,18231,13390,15158,20544,27683,39414,39415,17719,39416, -39417,39418,39419,39420,39421,39422,39488,39489,39490,21371,39491,39492,39493, -39494,27684,39495,27685,18011,39496,39497,39498,16238,39499,39500,39501,39502, -27686,39503,39504,27687,20522,39505,18232,39506,39507,14440,39508,39509,39510, -39511,39512,39513,39514,39515,39516,39517,39518,39519,27688,39520,39521,39522, -39523,39524,39525,39526,39527,22073,21885,13387,12861,20068,18023,39528,39529, -19809,39530,39531,39532,39533,39534,39535,39536,39537,39538,39539,39540,39541, -39542,39543,13429,39544,19264,15455,39545,39546,39547,39548,26978,26979,20842, -26981,39549,13433,26980,39550,20787,19042,12880,39552,26984,39553,39554,39555, -39556,26982,26983,39557,39558,22067,39559,39560,39561,26985,26986,39562,39563, -39564,39565,39566,26987,39567,39568,39569,39570,39571,39572,39573,39574,26988, -39575,39576,39577,39578,39579,39580,39581,39582,27695,17721,13902,39583,21107, -39584,39585,39586,39587,39588,39589,39590,13678,39591,15193,27697,39592,39593, -21091,39594,39595,39596,39597,39598,20067,39599,17464,39600,17215,39601,39602, -13886,22585,12616,12623,12625,17790,39603,12624,39604,17195,39605,39606,39607, -39608,39609,21809,39610,39611,39612,39613,39614,39615,39616,39617,27428,14913, -39618,39619,39620,19514,39621,39622,39623,27429,39624,27431,39625,39626,39627, -27432,39628,39629,39630,27430,39631,39632,39633,39634,39635,39636,39637,27433, -27435,27434,39638,39639,39640,39641,39642,27436,39643,19023,22581,17265,39644, -17189,18040,27437,17482,39645,27438,27439,27440,14165,39646,39647,39648,14202, -39649,27441,18274,39650,27443,39651,14884,20853,12337,27442,27444,39652,39653, -39654,13610,16968,18280,39655,27445,39656,19246,25439,39657,39658,21312,39659, -39660,39661,39662,22875,39663,39664,19745,22061,18291,39665,39666,39667,22880, -15203,39668,14906,25442,39669,39670,39671,39672,39673,20267,39674,39675,39676, -25440,18759,39677,14905,39678,39744,39745,20788,25441,18538,14639,15661,13144, -20059,39746,39747,19520,39748,39749,39750,25448,25449,19828,39751,39752,39753, -39754,39755,19501,39756,15411,39757,25450,39758,25451,39759,39760,20570,39761, -39762,39763,18043,14170,39764,39765,18271,21066,20054,39766,25444,25452,39767, -18802,13121,39768,39769,25447,39770,39771,18019,25445,39772,39773,27955,25446, -39774,39775,39776,39777,18739,39778,17766,39779,39780,39781,14645,39782,17211, -39783,25443,17725,16676,16985,12887,39784,25453,15142,17453,39785,25456,15962, -39786,39787,25467,25461,14931,39788,39789,39790,39791,14160,21325,39792,22094, -21843,14657,21812,20824,39793,39794,39795,39796,20537,18294,39797,39798,39799, -18474,12852,39800,17242,39801,39802,39803,25454,39804,39805,25468,25455,14120, -25463,25460,39806,39808,39809,14138,39810,39811,17698,39812,25462,17757,12840, -18044,39813,17504,39814,39815,22306,39816,16481,25465,39817,39818,25466,25469, -19497,25459,39819,21310,39820,12611,27956,25457,25458,39821,25464,20538,17987, -21619,25470,39822,39823,15712,39824,39825,25639,39826,39827,25638,39828,39829, -39830,20851,25635,39831,25641,39832,39833,39834,18551,39835,39836,39837,39838, -20276,39839,25640,25646,16997,39840,39841,13876,39842,39843,39844,39845,39846, -39847,15730,39848,25634,39849,39850,14953,25642,39851,39852,25644,39853,39854, -13949,22110,25650,39855,25645,39856,39857,39858,25633,39859,15214,19805,18210, -17737,39860,39861,16759,39862,25636,39863,18227,15660,15677,25637,39864,22343, -12898,39865,25643,15427,25647,39866,15211,25648,17704,25649,39867,39868,39869, -39870,21859,16163,39871,25658,39872,25655,39873,25659,39874,39875,25661,39876, -39877,18006,39878,39879,14918,16459,39880,39881,39882,14369,25652,39883,39884, -39885,39886,21537,39887,39888,14883,15742,39889,39890,39891,25660,39892,39893, -39894,39895,39896,19775,39897,39898,17529,39899,39900,20347,18790,39901,39902, -21311,39903,20305,39904,39905,25651,39906,25656,25657,19561,39907,39908,39909, -39910,39911,19534,39912,16468,25653,16688,25654,20048,39913,15169,13651,39914, -18547,15655,21831,18732,14370,25674,39915,39916,25676,20804,39917,39918,21050, -39919,39920,14893,39921,39922,14932,39923,39924,39925,39926,39927,39928,25667, -13677,39929,39930,39931,22349,25664,20349,25663,39932,39933,39934,16732,19530, -40000,40001,40002,40003,19047,40004,40005,40006,40007,17495,40008,19540,25672, -40009,40010,40011,25671,25665,40012,25668,13613,40013,40014,21337,40015,25670, -40016,40017,40018,40019,21113,13411,40020,15156,40021,40022,18798,40023,13374, -40024,40025,40026,15212,40027,20813,40028,19565,27957,40029,40030,40031,40032, -40033,40034,40035,40036,18277,40037,40038,40039,40040,21544,40041,25675,22357, -25666,40042,15653,25669,40043,40044,21350,40045,25673,18808,40046,40047,25662, -40048,40049,21349,40050,40051,18302,13897,40052,21628,12851,25687,40053,40054, -40055,20034,40056,25677,40057,20028,40058,14427,40059,40060,25686,40061,16202, -40062,40064,40065,21326,40066,17260,40067,40068,40069,40070,40071,40072,40073, -40074,17736,25688,40075,40076,40077,40078,40079,40080,40081,40082,19780,25679, -40083,40084,40085,40086,25684,25685,40087,14974,40088,20326,40089,40090,21823, -40091,40092,40093,25682,40094,40095,40096,40097,40098,40099,40100,40101,40102, -40103,40104,25680,40105,40106,25678,40107,40108,40109,40110,40111,40112,40113, -40114,40115,40116,40117,40118,40119,40120,40121,19813,18986,40122,40123,40124, -16419,40125,15654,25683,40126,40127,14408,40128,40129,40130,40131,40132,25703, -21556,40133,40134,40135,40136,40137,40138,40139,25691,40140,40141,40142,16751, -40143,40144,25705,40145,40146,21095,40147,40148,25695,40149,25696,40150,40151, -20266,40152,40153,40154,40155,19293,40156,25690,25681,40157,25701,40158,18524, -25699,40159,40160,17511,25698,40161,25697,40162,40163,40164,13180,25704,40165, -40166,40167,40168,13665,40169,40170,40171,22348,40172,40173,40174,25702,40175, -15148,40176,22354,19535,27512,40177,25700,40178,40179,14710,40180,40181,40182, -22093,25689,25692,17018,25694,40183,16971,16452,16976,40184,12661,19506,40185, -40186,40187,40188,40189,40190,40256,40257,40258,40259,13646,40260,40261,40262, -40263,25711,40264,40265,40266,40267,40268,40269,40270,40271,17967,40272,40273, -40274,18017,40275,40276,25717,40277,40278,40279,40280,40281,16937,40282,40283, -40284,16492,20829,25710,40285,40286,40287,40288,40289,40290,40291,40292,40293, -40294,17454,40295,40296,40297,25709,40298,40299,40300,40301,25718,25716,17022, -40302,25693,40303,25712,40304,19070,40305,21828,40306,40307,25713,40308,40309, -40310,40311,40312,40313,40314,20858,40315,40316,40317,40318,40320,40321,40322, -25707,25708,40323,40324,40325,25714,40326,20011,40327,40328,40329,40330,40331, -40332,40333,40334,40335,40336,17739,40337,40338,40339,18225,40340,16954,40341, -40342,40343,25706,40344,40345,40346,16714,40347,40348,40349,40350,40351,40352, -19510,13105,40353,40354,40355,25723,40356,25715,40357,40358,40359,25722,40360, -25725,40361,25724,40362,40363,40364,40365,40366,40367,40368,13134,40369,40370, -40371,13114,25719,40372,40373,25721,25720,17772,40374,40375,40376,40377,40378, -40379,40380,40381,40382,40383,40384,40385,40386,16445,40387,40388,40389,40390, -21608,40391,40392,40393,40394,40395,25890,40396,40397,40398,40399,40400,40401, -40402,40403,40404,40405,40406,12356,40407,40408,25892,40409,40410,25891,40411, -40412,40413,40414,40415,40416,15396,40417,25893,40418,40419,40420,40421,40422, -40423,25889,40424,40425,40426,40427,40428,40429,40430,25726,12660,40431,40432, -40433,40434,40435,40436,40437,40438,40439,40440,40441,25896,40442,25897,25894, -40443,40444,40445,40446,40512,40513,40514,40515,40516,40517,40518,40519,25895, -25898,40520,40521,40522,40523,40524,40525,40526,40527,40528,40529,40530,40531, -40532,40533,40534,40535,40536,40537,40538,40539,40540,40541,40542,40543,40544, -40545,40546,40547,40548,40549,40550,40551,40552,18009,40553,40554,40555,40556, -40557,40558,40559,40560,25899,25901,40561,40562,40563,40564,40565,40566,40567, -25900,40568,40569,40570,40571,40572,40573,40574,40576,40577,40578,40579,40580, -40581,40582,40583,40584,40585,25903,40586,40587,40588,25902,40589,40590,40591, -40592,40593,40594,40595,40596,40597,40598,40599,40600,40601,40602,40603,40604, -40605,40606,14688,40607,40608,25904,40609,40610,40611,40612,40613,40614,40615, -40616,40617,40618,40619,40620,40621,40622,25905,40623,40624,40625,40626,40627, -40628,40629,40630,40631,40632,40633,40634,15216,27745,17264,40635,13638,15186, -40636,40637,40638,40639,16745,21614,40640,15940,40641,40642,40643,22342,40644, -21590,12883,27710,40645,40646,40647,40648,27201,40649,40650,40651,16943,13366, -40652,40653,40654,20823,40655,40656,40657,13108,40658,18482,16187,27712,40659, -40660,22091,40661,40662,27711,27713,40663,40664,40665,40666,40667,40668,40669, -40670,40671,40672,40673,40674,40675,27717,15974,19519,17754,15932,40676,27718, -40677,12670,40678,40679,40680,27716,21800,13667,40681,27714,16694,13155,40682, -40683,27715,19256,16451,19582,40684,40685,40686,40687,16722,40688,27720,40689, -40690,40691,40692,40693,40694,40695,40696,40697,40698,40699,40700,40701,14950, -16467,40702,22130,40768,40769,40770,20812,40771,40772,40773,40774,16190,40775, -14131,18773,27719,15202,40776,19532,15741,18504,40777,20265,40778,40779,40780, -40781,40782,40783,40784,19817,40785,17771,40786,40787,40788,14185,40789,40790, -40791,40792,40793,40794,40795,40796,40797,40798,40799,20809,14904,40800,40801, -40802,40803,40804,27721,40805,40806,27722,40807,15168,27723,40808,27746,12602, -14169,40809,40810,40811,40812,40813,40814,40815,40816,40817,40818,40819,15673, -40820,40821,40822,40823,40824,40825,40826,40827,27724,20838,27725,40828,40829, -40830,40832,18491,40833,40834,40835,40836,40837,40838,40839,40840,40841,40842, -40843,40844,40845,40846,27729,40847,40848,40849,40850,27731,40851,15181,40852, -15461,40853,40854,40855,40856,40857,40858,40859,40860,40861,40862,40863,40864, -40865,27727,40866,18743,40867,40868,40869,40870,40871,17210,40872,27747,21845, -27728,40873,40874,40875,40876,40877,22131,40878,40879,40880,27730,27726,40881, -40882,40883,40884,27732,40885,27733,40886,40887,18751,40888,40889,40890,40891, -40892,40893,20264,40894,40895,40896,40897,40898,20572,40899,40900,40901,40902, -20780,40903,40904,40905,40906,18523,40907,40908,40909,27734,20085,40910,40911, -40912,40913,40914,19052,27738,40915,40916,40917,40918,40919,40920,40921,27737, -40922,40923,40924,12350,40925,40926,40927,40928,40929,40930,27735,40931,27736, -40932,40933,40934,27748,40935,40936,40937,40938,40939,40940,40941,40942,40943, -18492,40944,40945,40946,40947,40948,40949,40950,40951,40952,40953,16711,40954, -40955,40956,40957,40958,27740,20832,41024,41025,41026,41027,41028,41029,41030, -41031,41032,41033,27739,41034,41035,41036,41037,21615,41038,27741,41039,41040, -41041,41042,41043,41044,23366,41045,41046,41047,41048,41049,41050,41051,41052, -41053,41054,27742,41055,41056,41057,41058,41059,41060,41061,41062,41063,41064, -41065,41066,12588,41067,41068,41069,41070,41071,41072,41073,41074,41075,41076, -41077,41078,41079,41080,41081,41082,41083,41084,41085,41086,41088,41089,27743, -41090,41091,41092,41093,41094,41095,41096,41097,41098,41099,27744,41100,22310, -41101,17728,41102,41103,41104,27452,12334,41105,41106,41107,15988,14392,21039, -12374,13689,41108,22579,41109,19244,41110,25437,41111,41112,41113,41114,41115, -41116,41117,17964,12390,41118,41119,41120,17734,27449,41121,41122,41123,41124, -27450,41125,41126,41127,27451,41128,41129,20800,41130,17699,41131,27250,41132, -17458,41133,17461,16462,41134,41135,41136,27251,17473,41137,20079,41138,41139, -41140,41141,27248,27252,41142,41143,18812,41144,41145,18211,41146,41147,41148, -19544,20094,41149,41150,41151,27253,27254,20268,16487,41152,41153,27255,41154, -41155,41156,41157,41158,13887,27256,41159,27257,41160,27258,41161,41162,27259, -41163,41164,41165,41166,41167,41168,41169,41170,41171,41172,41173,41174,27249, -41175,41176,41177,41178,41179,41180,41181,41182,41183,41184,41185,41186,18478, -24939,41187,14136,24940,41188,41189,41190,24941,41191,22324,24942,24943,21324, -41192,41193,41194,41195,41196,41197,41198,24945,16241,24944,13650,41199,41200, -41201,12599,41202,41203,41204,41205,24947,24946,41206,14972,41207,24948,41208, -41209,41210,41211,14647,41212,15953,41213,41214,43584,43585,17532,43586,14941, -15686,43587,43588,43589,43590,43591,43592,24949,24951,43593,43594,13888,20289, -18984,24950,21880,21372,24952,24956,24953,43595,43596,24954,16490,43597,24958, -25121,16455,43598,43599,43600,43601,24955,43602,24957,43603,43604,43605,43606, -43607,43608,25125,43609,43610,43611,16724,43612,43613,43614,43615,25123,43616, -25128,12926,25122,43617,43618,43619,17229,12866,25127,25126,43620,43621,25124, -25129,43622,43623,25131,43624,43625,43626,20553,22125,17192,25132,43627,20311, -43628,43629,25134,43630,43631,14959,43632,43633,26976,25133,25130,43634,43635, -43636,43637,15147,21555,43638,43639,43640,43641,43642,43643,43644,43645,43646, -43648,43649,43650,43651,25136,43652,43653,25135,43654,26977,43655,43656,43657, -43658,25137,43659,43660,43661,43662,43663,43664,43665,43666,25138,43667,43668, -43669,43670,43671,43672,43673,43674,43675,43676,43677,25139,19489,43678,25140, -43679,43680,43840,43841,43842,43843,43844,43845,43846,43847,43848,43849,43850, -43851,25141,43852,43853,43854,43855,43856,20606,43857,43858,16970,43859,21361, -43860,19829,43861,43862,26464,43863,43864,26465,43865,43866,43867,43868,15937, -43869,43870,43871,43872,17002,43873,43874,43875,26468,43876,43877,26467,43878, -43879,43880,43881,43882,43883,19814,43884,17205,43885,43886,26466,15159,20310, -43887,16737,26473,43888,43889,43890,26472,43891,43892,26484,12835,43893,43894, -43895,43896,26474,43897,26470,43898,43899,43900,43901,43902,26476,26475,18746, -43904,43905,21860,43906,26469,14121,26471,43907,43908,43909,43910,43911,43912, -43913,26478,43914,43915,43916,43917,26483,43918,22121,43919,43920,43921,43922, -26477,43923,26482,43924,26481,43925,43926,43927,12384,43928,43929,43930,43931, -26485,43932,43933,43934,43935,43936,44096,44097,44098,44099,44100,44101,44102, -44103,44104,44105,44106,18290,44107,16453,16493,44108,44109,16752,26480,44110, -44111,44112,44113,26486,19318,44114,44115,44116,44117,44118,44119,44120,44121, -44122,26658,26657,44123,44124,44125,44126,44127,44128,22337,44129,44130,26490, -26489,44131,26491,44132,26487,44133,26494,44134,26493,44135,26492,44136,44137, -16725,18265,17789,17731,44138,44139,44140,44141,44142,18285,44143,44144,44145, -44146,26659,44147,44148,44149,44150,44151,44152,44153,44154,44155,44156,44157, -44158,44160,44161,44162,44163,44164,44165,44166,26662,44167,26661,44168,26663, -14967,26488,26660,44169,18544,18730,44170,44171,44172,44173,44174,44175,44176, -44177,44178,44179,44180,44181,44182,26665,44183,44184,14693,44185,44186,44187, -44188,44189,20862,26664,44190,44191,44192,44352,44353,44354,26666,44355,26669, -26670,44356,16679,44357,44358,44359,26671,44360,44361,44362,26672,44363,44364, -26668,44365,26676,44366,44367,44368,44369,44370,44371,44372,44373,44374,44375, -44376,26667,44377,26673,44378,44379,44380,44381,44382,44383,44384,44385,26677, -26674,26675,44386,44387,44388,44389,44390,44391,44392,44393,44394,44395,44396, -44397,44398,44399,44400,44401,26679,44402,44403,44404,44405,44406,44407,44408, -44409,44410,44411,44412,44413,44414,44416,44417,44418,44419,44420,44421,44422, -44423,44424,44425,26678,44426,44427,44428,44429,44430,44431,44432,44433,44434, -14671,44435,28716,44436,28717,44437,17968,12394,18495,44438,19807,44439,44440, -44441,44442,44443,44444,44445,20045,27185,44446,44447,44448,44608,27186,44609, -17983,13385,44610,44611,44612,44613,44614,44615,44616,27187,44617,44618,44619, -44620,21863,44621,44622,44623,44624,44625,44626,44627,44628,23929,44629,27188, -44630,27189,44631,27190,44632,44633,44634,44635,14410,24368,18805,44636,19568, -44637,44638,18810,44639,44640,44641,44642,44643,18811,44644,44645,21315,19238, -44646,14374,28718,12610,44647,25912,19567,21321,15447,18794,44648,13671,44649, -17488,13673,44650,28206,15149,44651,44652,26462,44653,28207,44654,44655,44656, -44657,13097,44658,44659,28210,44660,44661,28209,15719,44662,28208,20023,44663, -44664,44665,44666,17743,44667,44668,44669,44670,16756,23374,28211,20595,44672, -44673,44674,44675,44676,44677,44678,44679,16980,18024,44680,44681,44682,14124, -44683,44684,44685,44686,44687,44688,44689,28212,44690,13163,44691,44692,44693, -15227,28213,44694,44695,44696,44697,44698,26460,44699,44700,44701,28214,44702, -44703,15662,44704,44864,44865,44866,29026,44867,44868,44869,19048,44870,21065, -28762,44871,28763,44872,28764,16710,44873,14445,15950,44874,44875,28766,44876, -17713,28765,20849,44877,28768,12364,15722,44878,44879,44880,44881,44882,21087, -28767,44883,13359,14184,28774,28773,17955,28769,28770,13379,44884,44885,28771, -21870,44886,44887,19547,15954,15410,44888,44889,44890,28776,28775,28772,12833, -44891,22050,21304,15927,18476,44892,44893,28778,44894,44895,44896,44897,20855, -44898,22092,14939,28777,44899,13883,44900,44901,19764,44902,44903,17958,44904, -44905,44906,16673,28779,28782,44907,28781,28784,28780,44908,15166,28783,44909, -44910,44911,44912,19509,28786,44913,44914,13141,44915,44916,44917,44918,12628, -44919,44920,28787,44921,44922,28788,28790,13409,44923,28785,44924,28791,44925, -44926,44928,44929,28794,44930,28792,44931,44932,44933,28789,44934,44935,44936, -44937,28797,44938,28793,28796,28798,44939,28961,44940,44941,44942,20033,28964, -44943,28963,44944,16758,28795,19037,44945,44946,13425,12657,19505,44947,28966, -44948,44949,28967,44950,44951,28972,21838,28969,44952,44953,18483,44954,44955, -44956,28962,44957,28971,28968,28965,44958,44959,28970,44960,45120,45121,45122, -45123,45124,45125,45126,12329,28973,45127,45128,45129,45130,45131,45132,28975, -45133,28977,45134,45135,45136,45137,45138,28976,45139,28974,45140,45141,45142, -45143,20770,45144,45145,45146,45147,45148,45149,45150,28978,45151,45152,45153, -28979,45154,45155,45156,45157,45158,45159,45160,45161,14703,45162,45163,13639, -45164,12375,12377,45165,45166,45167,21613,45168,13636,45169,15700,15178,28711, -45170,45171,14430,45172,45173,28712,45174,45175,12328,45176,28713,45177,45178, -19822,45179,45180,28714,45181,45182,45184,45185,45186,45187,45188,45189,45190, -45191,28715,45192,45193,45194,45195,45196,45197,45198,45199,45200,17956,45201, -45202,22117,29028,45203,29029,45204,45205,45206,45207,45208,45209,45210,45211, -45212,45213,17267,45214,45215,21339,45216,45376,22097,17768,45377,21295,45378, -21094,45379,45380,28225,12347,21813,20814,15456,14928,45381,16248,45382,14407, -13633,17740,45383,45384,18978,45385,45386,45387,17227,45388,45389,45390,45391, -45392,28226,45393,45394,45395,45396,45397,45398,45399,45400,17471,13858,45401, -28012,17188,45402,22065,45403,45404,45405,20320,28015,45406,45407,17742,45408, -13916,45409,45410,18977,45411,45412,28013,45413,45414,28016,28017,17212,45415, -16180,45416,28014,45417,45418,45419,45420,45421,45422,45423,45424,45425,45426, -45427,28020,28018,45428,45429,45430,45431,21862,17247,45432,28019,45433,45434, -45435,28022,45436,21795,20771,45437,45438,45440,28021,45441,17232,45442,45443, -45444,45445,45446,28023,16244,15980,28024,45447,19575,45448,20827,45449,45450, -45451,22341,21878,45452,28028,45453,45454,45455,28027,45456,45457,45458,45459, -45460,45461,45462,45463,28025,28026,45464,45465,45466,45467,45468,45469,45470, -45471,28029,15910,45472,45632,45633,45634,45635,19247,28193,13885,45636,28194, -17472,45637,28030,45638,45639,15710,12871,45640,45641,45642,45643,45644,45645, -45646,45647,45648,45649,45650,45651,13891,45652,45653,45654,28197,22586,28195, -28198,45655,45656,45657,17257,13170,45658,45659,45660,45661,45662,45663,28199, -28196,20281,45664,45665,28200,17015,45666,45667,45668,45669,45670,45671,45672, -45673,45674,45675,45676,45677,28201,28202,45678,24107,45679,45680,17971,45681, -18246,45682,22133,13641,45683,19250,45684,45685,45686,28203,45687,45688,19755, -45689,28204,45690,45691,45692,45693,45694,21808,45696,28205,45697,30276,45698, -45699,45700,45701,45702,45703,45704,45705,45706,45707,45708,45709,45710,23367, -45711,45712,45713,45714,45715,45716,45717,45718,45719,13347,45720,45721,45722, -17196,29030,45723,45724,45725,45726,45727,19000,21075,45728,22058,45888,28530, -45889,15960,45890,15683,28531,13900,12331,45891,45892,45893,45894,18991,45895, -45896,27958,45897,27959,45898,45899,45900,45901,20089,14127,16243,27960,17003, -18736,45902,45903,45904,45905,45906,45907,27961,45908,45909,18038,16179,45910, -45911,45912,27964,17784,45913,20816,45914,22313,27962,27963,45915,20834,45916, -27967,27968,45917,27972,45918,45919,45920,27976,45921,27974,27982,21864,45922, -27977,45923,45924,27975,27966,45925,45926,17769,45927,45928,45929,17990,45930, -45931,18793,21586,27969,27970,27971,27973,45932,16505,45933,13345,45934,45935, -45936,45937,14696,45938,27984,45939,45940,45941,45942,27985,45943,27978,45944, -27983,45945,20088,45946,45947,19254,27980,27981,45948,45949,45950,45952,45953, -20341,45954,45955,45956,45957,45958,45959,45960,45961,45962,45963,45964,45965, -27986,16754,21298,27979,18487,45966,45967,45968,45969,45970,45971,45972,45973, -15471,45974,45975,45976,45977,17776,45978,45979,45980,45981,45982,45983,45984, -46144,46145,46146,27990,46147,13679,46148,46149,16949,12333,19305,46150,46151, -12590,46152,27988,46153,46154,46155,19819,13666,46156,27989,27987,27991,46157, -46158,13690,46159,27992,46160,27993,46161,27996,46162,12620,46163,46164,46165, -46166,46167,46168,46169,46170,17782,15470,27994,19516,12906,46171,46172,46173, -46174,27995,46175,46176,46177,46178,17515,46179,46180,13381,46181,46182,46183, -12405,46184,46185,46186,27999,16474,13416,46187,46188,46189,46190,17741,46191, -46192,46193,27997,16196,46194,46195,46196,27998,46197,46198,46199,46200,46201, -46202,46203,46204,46205,46206,46208,46209,46210,46211,17445,46212,46213,46214, -28000,46215,46216,46217,46218,46219,28001,46220,28003,46221,46222,16727,46223, -46224,15175,46225,46226,46227,46228,46229,46230,15672,46231,46232,46233,28002, -46234,46235,46236,46237,46238,46239,46240,46400,46401,46402,46403,46404,46405, -28004,46406,46407,46408,46409,46410,46411,46412,46413,46414,46415,28006,46416, -46417,46418,46419,46420,28005,46421,46422,46423,46424,46425,46426,46427,46428, -46429,46430,46431,46432,46433,46434,46435,28007,46436,46437,46438,46439,46440, -19006,27754,16497,46441,18791,46442,27755,18030,46443,46444,46445,46446,27756, -46447,18029,27757,46448,46449,46450,46451,46452,46453,46454,46455,46456,27760, -46457,46458,22374,27763,46459,46460,27761,27758,27759,22307,18801,19310,27764, -46461,27762,46462,46464,20329,46465,27766,17969,46466,46467,46468,46469,15424, -46470,27765,46471,46472,46473,46474,46475,46476,46477,13627,15222,46478,27767, -46479,46480,46481,46482,46483,22903,15739,46484,46485,16955,27768,46486,46487, -46488,46489,27769,46490,46491,46492,46493,14371,46494,46495,46496,46656,46657, -46658,46659,46660,46661,46662,27770,46663,46664,46665,46666,46667,46668,46669, -46670,46671,46672,46673,46674,27771,46675,46676,46677,46678,46679,46680,46681, -46682,46683,46684,46685,27772,46686,46687,46688,46689,46690,21357,22574,16491, -46691,18269,14924,46692,20579,19261,46693,19770,46694,46695,14417,46696,46697, -12668,46698,18287,46699,22102,46700,46701,46702,16198,17259,46703,46704,28533, -46705,46706,17240,46707,46708,46709,46710,46711,46712,22370,46713,46714,46715, -28535,13139,46716,18264,20845,46717,22088,46718,28536,46720,28534,46721,15229, -13126,46722,46723,46724,46725,46726,46727,46728,15701,46729,46730,21062,46731, -15200,46732,46733,20257,46734,28540,28539,46735,46736,28537,46737,46738,46739, -46740,13132,46741,18772,19248,46742,46743,46744,46745,46746,28542,46747,46748, -12382,46749,46750,22089,46751,46752,46912,28541,46913,13165,46914,46915,30293, -46916,46917,46918,46919,46920,46921,46922,46923,46924,46925,46926,46927,46928, -46929,46930,20040,46931,46932,46933,28706,46934,28705,46935,13630,15450,15228, -46936,14437,46937,46938,46939,46940,46941,46942,17474,46943,46944,46945,46946, -46947,46948,46949,46950,46951,46952,28707,46953,46954,46955,46956,46957,19307, -46958,46959,46960,46961,46962,46963,46964,46965,46966,46967,46968,46969,46970, -46971,46972,46973,46974,46976,46977,46978,46979,46980,46981,46982,28710,46983, -46984,46985,20776,46986,15935,18286,28982,28983,16213,46987,46988,46989,46990, -13353,28984,19771,46991,18260,21805,46992,28985,46993,28986,46994,46995,46996, -46997,18255,46998,46999,47000,21028,22095,47001,47002,28987,15697,13360,15933, -47003,47004,47005,13404,20049,47006,16223,28989,47007,47008,47168,47169,16250, -28988,47170,28991,47171,47172,47173,28990,28992,47174,47175,47176,47177,47178, -28993,47179,47180,47181,47182,47183,47184,47185,47186,47187,47188,47189,16766, -47190,47191,47192,47193,47194,47195,47196,47197,47198,47199,47200,16674,47201, -47202,47203,47204,47205,47206,47207,47208,47209,47210,19066,47211,47212,21822, -47213,47214,47215,47216,15930,15929,21826,47217,47218,16162,47219,19759,28981, -47220,47221,47222,47223,47224,47225,15711,47226,13899,47227,47228,47229,47230, -47232,47233,47234,47235,47236,22129,29507,47237,47238,29508,47239,14413,47240, -47241,47242,29510,29511,47243,12362,47244,29509,47245,29513,19313,47246,47247, -47248,29515,47249,20518,47250,47251,12618,29512,47252,47253,47254,29519,47255, -13649,47256,47257,29527,47258,29522,47259,47260,47261,29524,29523,14203,47262, -12607,47263,29518,29514,13658,47264,29520,47424,47425,29521,47426,29525,47427, -47428,47429,47430,29517,47431,15459,47432,16765,47433,29526,47434,47435,47436, -47437,47438,47439,29530,47440,29516,47441,13640,47442,15726,29532,47443,47444, -14116,16240,22142,19762,47445,13424,47446,12895,47447,29528,47448,29529,18744, -47449,29533,47450,47451,29534,47452,29537,47453,47454,47455,47456,47457,47458, -47459,47460,47461,47462,47463,29535,47464,47465,29539,29538,47466,47467,29531, -47468,16234,47469,13167,47470,29536,47471,47472,18217,47473,15474,47474,47475, -47476,47477,29547,47478,47479,47480,47481,47482,47483,47484,14655,47485,47486, -29540,47488,47489,47490,12845,15230,47491,19299,47492,47493,47494,47495,29549, -29545,47496,47497,47498,14684,29550,47499,47500,47501,29541,29542,29546,16993, -29548,29551,29544,15485,47502,47503,47504,20324,47505,47506,29552,47507,47508, -47509,29543,47510,47511,47512,47513,47514,47515,47516,47517,29554,47518,47519, -47520,47680,22317,17962,47681,47682,47683,47684,29555,47685,47686,47687,47688, -29553,47689,16936,47690,47691,47692,47693,47694,14429,29557,47695,47696,29556, -47697,47698,47699,13403,47700,47701,47702,29558,29559,47703,47704,47705,29560, -47706,47707,47708,16442,47709,47710,16489,47711,47712,47713,47714,47715,17777, -47716,47717,47718,47719,29563,47720,29562,47721,47722,47723,47724,47725,47726, -47727,47728,13400,47729,47730,47731,29566,29561,47732,47733,29564,47734,47735, -47736,47737,47738,47739,29565,47740,47741,47742,47744,47745,47746,47747,47748, -29729,47749,47750,47751,47752,47753,47754,29731,15177,47755,47756,29730,47757, -47758,47759,47760,47761,47762,47763,47764,47765,47766,47767,47768,47769,29732, -47770,47771,47772,47773,47774,47775,12862,29734,29733,47776,47936,47937,47938, -47939,47940,47941,47942,47943,47944,47945,15406,47946,47947,47948,47949,47950, -47951,47952,47953,47954,47955,47956,47957,47958,47959,47960,47961,47962,47963, -47964,47965,47966,47967,47968,47969,47970,47971,47972,47973,47974,47975,47976, -47977,47978,47979,47980,47981,47982,17239,22881,47983,47984,47985,47986,47987, -47988,16480,29772,22353,47989,47990,47991,47992,47993,47994,47995,47996,47997, -47998,48000,14171,48001,48002,48003,48004,48005,48006,48007,29774,16675,48008, -48009,17993,48010,13398,21811,48011,48012,48013,29776,29775,29777,19290,48014, -48015,29778,48016,21569,22112,48017,48018,48019,48020,14176,48021,48022,48023, -16696,48024,48025,16699,29779,15916,48026,48027,48028,48029,48030,13410,48031, -48032,29780,29781,15915,48192,48193,29782,48194,48195,48196,29787,48197,29783, -29786,48198,14973,48199,29784,29785,48200,48201,48202,48203,48204,48205,48206, -14434,19527,29788,48207,12890,48208,48209,17235,48210,48211,21603,16183,48212, -48213,48214,48215,48216,48217,48218,29789,48219,48220,48221,48222,48223,48224, -17716,48225,48226,48227,48228,48229,48230,48231,48232,29801,48233,48234,20277, -48235,48236,48237,48238,48239,48240,48241,48242,48243,48244,48245,48246,48247, -48248,20041,48249,48250,48251,48252,48253,48254,48256,48257,48258,48259,48260, -48261,48262,48263,48264,48265,48266,48267,48268,48269,48270,19288,48271,19319, -48272,48273,48274,48275,15732,48276,48277,48278,22351,48279,48280,48281,16475, -48282,48283,48284,48285,48286,48287,48288,48448,48449,48450,48451,48452,48453, -48454,48455,48456,48457,48458,48459,48460,48461,48462,48463,48464,48465,48466, -48467,48468,48469,48470,48471,48472,48473,48474,48475,48476,48477,48478,48479, -48480,48481,48482,48483,48484,48485,48486,48487,48488,48489,48490,48491,48492, -48493,48494,48495,48496,48497,48498,48499,48500,48501,48502,20597,48503,48504, -48505,48506,48507,48508,48509,48510,29802,48512,48513,48514,48515,48516,48517, -48518,48519,48520,48521,48522,48523,48524,48525,48526,48527,48528,48529,48530, -48531,48532,48533,48534,48535,48536,48537,48538,48539,48540,48541,48542,48543, -48544,48704,48705,48706,48707,48708,48709,48710,48711,48712,48713,48714,48715, -48716,29803,48717,48718,48719,48720,48721,48722,48723,29804,48724,48725,48726, -48727,48728,48729,48730,48731,48732,48733,48734,48735,48736,48737,48738,48739, -48740,48741,48742,48743,48744,48745,48746,48747,48748,48749,48750,48751,48752, -48753,48754,48755,48756,48757,48758,48759,48760,48761,48762,48763,48764,48765, -48766,48768,48769,48770,48771,48772,48773,48774,48775,48776,48777,48778,48779, -48780,48781,48782,48783,48784,48785,48786,48787,48788,48789,48790,48791,48792, -48793,48794,48795,48796,48797,48798,48799,48800,48960,48961,48962,48963,48964, -48965,48966,48967,48968,48969,48970,48971,48972,48973,48974,48975,48976,48977, -48978,48979,48980,48981,48982,48983,48984,48985,48986,48987,48988,48989,48990, -48991,48992,48993,48994,48995,48996,48997,48998,48999,49000,49001,49002,49003, -49004,49005,49006,49007,49008,49009,49010,49011,49012,49013,49014,49015,49016, -49017,49018,49019,49020,49021,49022,49024,30563,49025,49026,49027,49028,49029, -14129,49030,49031,49032,49033,49034,29805,49035,49036,49037,49038,49039,49040, -49041,49042,49043,49044,49045,49046,49047,49048,49049,49050,49051,49052,49053, -49054,49055,49056,49216,49217,49218,49219,49220,49221,49222,49223,49224,49225, -49226,49227,49228,49229,49230,49231,49232,49233,49234,49235,49236,49237,49238, -49239,49240,49241,49242,49243,49244,49245,49246,49247,49248,49249,49250,49251, -22379,49252,49253,49254,49255,49256,49257,49258,49259,49260,49261,49262,49263, -49264,49265,49266,49267,49268,49269,49270,49271,49272,49273,49274,49275,29806, -49276,49277,49278,26233,15936,26234,14956,26235,20299,26236,21564,15414,26237, -26238,15437,18514,20019,26401,49280,13375,26402,18740,14425,17481,49281,22365, -16986,14167,22077,20038,14148,49282,49283,17702,26403,20319,26404,26405,26406, -16695,22377,18800,20280,22063,22101,26407,12397,26408,26409,18780,21103,15917, -26410,12403,18526,15713,26411,18502,49284,26412,15206,14456,20772,26413,16999, -15992,15690,19763,26414,26415,15982,20581,49285,19303,19536,15436,26416,15400, -20599,26417,49286,20600,26418,26419,13378,26420,26421,18814,20012,17248,26423, -12609,13169,49287,26424,26425,22363,21824,26426,16972,22330,26427,26428,26429, -15466,17253,16450,26430,26431,15401,49288,26432,26433,26422,13904,26434,49289, -26435,26436,15162,13662,16966,12640,26437,21557,26438,14399,26440,26439,14188, -49290,26441,12920,26442,26443,26444,26445,26446,26447,26448,21287,19317,26449, -26450,26451,26452,18761,26453,26454,26455,26456,26457,15689,26458,29502,49291, -14423,49292,18481,49293,49294,49295,49296,49297,49298,49299,29503,49300,29504, -29505,49301,49302,49303,49304,49305,49306,49307,49308,49309,49310,14686,19832, -49311,49312,22632,14897,49472,16990,28215,49473,14115,49474,49475,49476,49477, -28217,49478,28216,12373,49479,49480,49481,49482,49483,28219,21846,22383,49484, -49485,49486,22083,49487,49488,28221,19056,49489,28220,49490,49491,49492,49493, -28222,49494,49495,49496,49497,28224,49498,49499,28223,49500,49501,49502,49503, -49504,49505,49506,49507,20850,49508,18236,49509,17216,49510,49511,49512,49513, -49514,14433,49515,49516,49517,49518,49519,16743,49520,49521,29766,20575,29767, -49522,20315,49523,49524,18490,49525,49526,29768,49527,49528,49529,49530,49531, -49532,49533,29769,29770,49534,29771,49536,49537,49538,49539,49540,22906,14462, -49541,49542,25969,21360,49543,29792,49544,20044,49545,49546,49547,13153,49548, -49549,49550,49551,28980,49552,21102,49553,29793,49554,49555,49556,49557,49558, -20328,29794,49559,49560,18252,49561,49562,49563,49564,49565,49566,13652,13412, -29796,49567,49568,49728,29795,29797,49729,49730,29798,49731,49732,49733,49734, -29799,49735,14898,12351,49736,29800,49737,49738,49739,49740,49741,49742,49743, -14125,21101,49744,49745,49746,21035,16463,49747,16188,27427,21855,27208,49748, -49749,49750,49751,29043,13944,19235,49752,49753,17485,49754,29031,49755,29032, -14459,29033,14916,21573,12370,49756,49757,29034,49758,49759,49760,29035,49761, -29036,49762,49763,29037,29038,29039,29041,29040,17749,49764,49765,49766,49767, -49768,49769,29042,49770,13946,49771,29044,21038,24135,19274,49772,49773,13148, -49774,13602,49775,14626,49776,49777,17524,29045,49778,49779,29046,49780,49781, -49782,16708,16763,22064,29047,49783,49784,49785,49786,29048,49787,16682,49788, -49789,49790,17976,49792,15963,49793,49794,49795,49796,49797,49798,49799,49800, -49801,49802,49803,49804,49805,49806,29049,13391,49807,49808,49809,49810,49811, -49812,29050,49813,49814,49815,49816,49817,49818,49819,49820,49821,49822,49823, -49824,49984,27954,27953,49985,49986,19296,21086,49987,19265,21848,49988,18530, -49989,16479,15393,49990,49991,49992,49993,49994,49995,27457,49996,49997,20516, -49998,22114,49999,13895,14424,27456,14414,50000,27455,13094,14665,22059,50001, -14196,14154,50002,50003,50004,15463,14142,27462,50005,27463,12345,16207,50006, -27461,21373,50007,27464,50008,50009,27465,50010,50011,14158,50012,27458,27460, -18806,22103,21837,20530,27471,20024,27472,50013,13608,50014,50015,50016,50017, -50018,12595,27474,19493,50019,50020,50021,50022,50023,50024,50025,17750,27475, -50026,27473,17759,27470,18980,27477,12411,50027,50028,14970,50029,50030,22583, -29027,50031,27466,27467,27468,27469,27478,26176,27481,50032,16232,21064,27479, -27484,14444,27480,50033,15674,50034,20568,50035,12343,50036,27485,17500,50037, -50038,50039,50040,22060,50041,50042,50043,13408,50044,50045,17014,15417,50046, -50048,27482,27483,21600,18026,17492,27487,17703,22901,50049,12849,50050,27492, -50051,15685,50052,50053,50054,27490,50055,50056,50057,50058,50059,50060,50061, -50062,50063,50064,50065,50066,50067,27491,50068,50069,14380,50070,19793,27493, -50071,50072,50073,27489,50074,16691,50075,50076,50077,50078,50079,17954,50080, -50240,50241,50242,50243,50244,50245,19571,50246,27494,50247,16432,21048,27495, -50248,50249,50250,14383,14381,50251,27496,18235,19827,50252,50253,50254,27498, -27499,50255,50256,50257,50258,50259,27501,50260,50261,50262,50263,20552,50264, -27506,50265,27502,50266,50267,50268,27505,18553,50269,20860,27500,50270,50271, -27497,50272,50273,50274,50275,14393,20313,17509,27503,27504,19546,19784,12402, -50276,27510,50277,50278,50279,50280,50281,27509,50282,12850,50283,50284,50285, -50286,14432,50287,27511,50288,50289,50290,50291,50292,50293,12652,50294,50295, -19525,17444,20261,50296,50297,50298,50299,50300,27513,50301,50302,27682,50304, -17778,50305,27514,50306,50307,50308,50309,50310,50311,50312,50313,18757,50314, -50315,50316,50317,50318,50319,25183,27518,50320,50321,50322,50323,19790,27681, -12635,21303,50324,50325,21084,50326,50327,50328,27517,50329,27515,50330,50331, -50332,50333,50334,50335,50336,50496,50497,50498,50499,50500,50501,50502,50503, -50504,50505,50506,50507,50508,50509,50510,13116,50511,50512,50513,27184,50514, -50515,22356,50516,29739,13172,50517,50518,50519,50520,50521,22081,22082,50522, -50523,50524,50525,50526,50527,21865,15946,50528,29735,50529,21032,29736,29737, -50530,29738,15947,21343,50531,50532,50533,50534,50535,18784,18785,50536,50537, -29506,50538,19046,50539,19570,50540,50541,50542,50543,50544,50545,25142,19252, -50546,20072,22107,50547,29741,29742,29743,50548,50549,50550,50551,29746,50552, -14909,29747,12387,29744,50553,29745,15650,12885,50554,29750,29751,13926,12848, -20303,29748,13356,50555,29749,50556,50557,29752,50558,50560,50561,50562,50563, -29753,50564,50565,19751,50566,29754,50567,29755,50568,50569,50570,29756,50571, -50572,50573,50574,50575,50576,50577,50578,19282,50579,29757,50580,50581,50582, -50583,29758,50584,50585,50586,50587,50588,50589,50590,50591,29759,50592,50752, -50753,50754,50755,29790,16700,15464,50756,18731,20830,25973,50757,50758,50759, -50760,23603,21077,50761,50762,23604,12332,23605,50763,50764,15706,50765,23609, -50766,50767,50768,22594,50769,23607,21363,50770,18774,23610,23606,50771,23611, -17186,50772,50773,50774,50775,23612,23621,23613,50776,50777,20063,22053,50778, -23631,50779,23629,50780,50781,23634,15718,16939,50782,23608,23627,23630,23614, -14162,12357,23623,20542,23617,15144,50783,14140,23628,50784,50785,23622,23615, -18267,50786,50787,50788,20799,23616,50789,50790,23626,50791,50792,23632,50793, -50794,20013,23618,50795,23619,23624,23625,12884,23633,19285,50796,21559,23643, -23647,19494,23654,50797,17255,23644,50798,50799,16193,23641,50800,12410,14646, -23653,23635,50801,23620,23638,18548,16224,50802,50803,50804,50805,18747,50806, -50807,50808,12605,50809,21282,50810,50811,23642,50812,50813,23637,50814,17979, -50816,23646,50817,50818,50819,50820,50821,22338,17199,14134,18257,17193,23650, -23640,23659,23636,50822,50823,23645,50824,15909,23639,50825,23648,50826,50827, -23651,23652,50828,23672,50829,50830,23649,23842,23655,50831,50832,50833,50834, -50835,50836,50837,50838,50839,50840,15467,13380,50841,50842,17187,12903,23674, -50843,23666,50844,23663,50845,23676,23662,21104,12904,50846,18519,18531,23675, -50847,23661,50848,51008,51009,23671,51010,51011,23669,51012,51013,15907,23668, -51014,12893,51015,51016,51017,51018,51019,23667,15478,23656,15172,51020,16499, -51021,51022,51023,51024,51025,15444,23657,23658,51026,23665,23670,23673,13620, -51027,18521,15207,23678,23677,21291,23841,23843,23845,21105,23844,23846,23847, -21033,51028,51029,51030,51031,51032,51033,51034,14921,23849,51035,51036,23862, -23857,23860,51037,51038,51039,51040,51041,51042,51043,23856,17998,51044,51045, -16498,51046,51047,51048,51049,18735,51050,51051,51052,23660,23854,51053,51054, -51055,51056,23863,51057,51058,23664,23855,51059,23864,51060,23852,51061,51062, -51063,51064,51065,51066,51067,23865,23859,23853,17450,51068,51069,51070,51072, -23848,16435,16683,23850,23851,51073,23858,15217,23861,21288,23866,51074,23867, -17191,51075,51076,23890,23868,51077,51078,51079,23889,51080,14653,51081,51082, -15957,51083,15994,51084,51085,14922,51086,51087,51088,51089,23882,51090,23877, -51091,23871,51092,51093,51094,12875,23875,51095,23883,12836,23893,51096,51097, -51098,23870,51099,51100,51101,18000,23888,51102,51103,51104,51264,51265,23892, -16738,14150,51266,51267,51268,51269,51270,23886,23887,51271,51272,51273,23876, -51274,51275,51276,23869,51277,23885,19537,51278,23881,51279,51280,51281,51282, -23874,17224,17980,20014,23884,51283,23880,51284,51285,51286,51287,51288,51289, -23873,51290,51291,51292,23878,16988,51293,51294,51295,51296,51297,51298,21289, -21290,23891,20340,18552,51299,51300,51301,51302,51303,51304,51305,51306,23910, -51307,51308,51309,51310,51311,51312,23879,51313,51314,51315,23904,16996,51316, -51317,51318,51319,51320,51321,51322,51323,23905,51324,51325,51326,51328,51329, -51330,51331,51332,51333,51334,23895,51335,51336,51337,51338,51339,22136,51340, -23897,23896,14448,23894,51341,51342,51343,51344,17999,51345,13869,51346,51347, -51348,51349,51350,23906,51351,14969,21601,23911,51352,51353,51354,13392,51355, -23898,51356,16251,23907,51357,23903,51358,23901,51359,51360,51520,51521,51522, -51523,51524,13657,51525,51526,51527,51528,23899,23900,23902,51529,15663,23908, -51530,23909,51531,51532,51533,51534,51535,51536,51537,51538,23925,51539,17225, -51540,51541,19298,51542,51543,51544,51545,23922,51546,51547,51548,51549,51550, -51551,51552,51553,51554,51555,51556,51557,51558,22625,51559,51560,18001,51561, -23924,51562,51563,51564,21876,23923,23920,51565,51566,23916,51567,23919,51568, -23912,51569,51570,20590,51571,51572,51573,51574,18520,23918,51575,51576,23913, -51577,51578,23914,19314,51579,23917,51580,51581,12621,51582,51584,51585,51586, -51587,51588,16438,51589,15419,23921,51590,51591,23927,51592,23926,23915,51593, -51594,51595,51596,51597,17774,51598,51599,51600,23931,51601,51602,51603,51604, -51605,51606,51607,51608,51609,51610,51611,24100,51612,51613,24099,51614,51615, -51616,51776,51777,51778,51779,51780,51781,51782,51783,51784,23928,51785,51786, -51787,51788,17263,51789,17019,51790,51791,51792,21857,51793,51794,20021,51795, -51796,51797,51798,23933,51799,12876,51800,51801,51802,51803,51804,51805,51806, -51807,51808,17512,19039,51809,51810,51811,51812,51813,51814,51815,51816,51817, -51818,18238,23930,23932,23934,24098,12330,12622,51819,51820,51821,51822,51823, -24108,51824,51825,51826,51827,24102,15670,18543,51828,51829,51830,51831,51832, -51833,51834,51835,51836,51837,51838,24097,51840,51841,24101,51842,51843,51844, -51845,24105,51846,51847,51848,51849,51850,24104,51851,51852,51853,24103,51854, -51855,51856,51857,51858,51859,51860,51861,51862,24109,51863,21580,51864,51865, -51866,51867,24115,24106,24110,51868,51869,16473,51870,51871,51872,52032,52033, -12577,24118,52034,24113,52035,52036,52037,52038,52039,52040,52041,24114,52042, -52043,52044,52045,52046,52047,52048,52049,52050,52051,52052,20774,24117,52053, -52054,52055,52056,52057,52058,52059,24111,52060,52061,52062,24112,52063,20541, -52064,52065,52066,24116,19053,24121,52067,52068,52069,52070,52071,52072,24120, -52073,24119,52074,52075,52076,52077,52078,52079,52080,24123,52081,52082,52083, -52084,52085,52086,52087,15717,52088,52089,52090,52091,52092,12888,17258,52093, -52094,24122,52096,17722,52097,52098,52099,52100,52101,52102,24124,52103,52104, -52105,52106,52107,52108,52109,19545,52110,52111,52112,52113,14122,52114,52115, -52116,52117,52118,52119,52120,52121,52122,52123,52124,52125,52126,52127,52128, -52288,52289,21605,52290,52291,52292,24125,52293,52294,52295,52296,52297,24127, -52298,52299,52300,52301,52302,52303,52304,52305,52306,52307,52308,17442,52309, -52310,52311,52312,24129,52313,52314,52315,52316,52317,52318,52319,52320,52321, -52322,52323,52324,52325,52326,52327,52328,24126,52329,24128,52330,52331,52332, -52333,52334,52335,52336,52337,52338,52339,52340,52341,52342,52343,21818,52344, -52345,52346,24130,52347,52348,52349,52350,52352,52353,52354,52355,52356,52357, -52358,52359,52360,52361,52362,52363,29230,15138,16946,17712,16967,52364,52365, -29231,52366,52367,52368,52369,52370,20585,52371,52372,52373,21341,52374,52375, -52376,27453,52377,52378,52379,52380,52381,52382,52383,52384,13158,29232,52544, -29233,52545,52546,18989,52547,52548,52549,52550,52551,52552,52553,14951,29235, -29237,29236,19300,20282,29234,18996,21071,17004,52554,52555,52556,52557,52558, -52559,52560,20035,29240,12406,29239,52561,52562,52563,52564,52565,29246,52566, -12879,52567,52568,52569,52570,52571,52572,20801,29242,52573,52574,52575,52576, -52577,29244,21609,52578,52579,29243,29238,29247,29245,52580,29241,52581,52582, -29255,29252,29254,52583,52584,29258,29250,29248,52585,52586,52587,29253,52588, -52589,52590,52591,52592,22139,52593,52594,52595,29249,52596,18297,18783,52597, -29256,14662,13616,52598,52599,29251,29257,29264,29270,52600,52601,15191,52602, -52603,52604,29269,19804,52605,22123,52606,52608,29266,29268,52609,52610,52611, -52612,14450,52613,52614,52615,52616,29259,52617,52618,52619,29262,17017,52620, -21853,29260,29261,29263,29267,52621,52622,52623,29273,21308,52624,52625,52626, -52627,13930,52628,19057,52629,14180,29271,52630,52631,52632,29272,29274,29277, -29275,52633,52634,29276,52635,52636,52637,52638,20817,29265,52639,19785,52640, -20047,22057,52800,29283,52801,17243,52802,29280,52803,52804,16431,29292,29278, -52805,29281,52806,52807,52808,29288,52809,52810,52811,52812,29282,52813,52814, -29287,52815,52816,29286,52817,52818,29289,52819,52820,52821,29279,52822,52823, -29284,29290,52824,52825,52826,52827,52828,52829,52830,21292,29285,12917,52831, -52832,29298,52833,20523,52834,52835,52836,52837,29301,52838,52839,52840,15176, -52841,29305,52842,52843,52844,52845,52846,52847,29296,52848,52849,29302,29304, -29306,52850,52851,52852,52853,52854,52855,52856,52857,29299,52858,29297,52859, -52860,52861,14971,52862,13691,52864,52865,52866,52867,29295,29303,29293,29294, -52868,52869,52870,29291,29478,52871,29475,52872,52873,29474,52874,52875,29300, -52876,18522,52877,52878,52879,52880,52881,29307,52882,52883,52884,29477,52885, -52886,52887,52888,52889,52890,52891,17272,52892,52893,52894,52895,52896,53056, -53057,53058,29309,53059,53060,29479,29481,29476,53061,29308,53062,53063,53064, -29483,53065,29482,53066,53067,53068,53069,16989,53070,53071,29486,53072,53073, -29488,53074,53075,53076,53077,53078,29473,53079,53080,53081,29489,29484,53082, -53083,53084,53085,53086,29487,29310,29485,53087,53088,53089,53090,53091,53092, -53093,29490,53094,53095,53096,53097,29492,53098,53099,53100,53101,29480,53102, -53103,53104,53105,29491,53106,53107,53108,29493,53109,53110,53111,53112,53113, -53114,53115,53116,53117,53118,20535,53120,53121,53122,53123,29496,53124,53125, -53126,53127,22905,53128,53129,53130,53131,53132,53133,29497,53134,53135,53136, -53137,53138,53139,53140,53141,29495,53142,18532,29494,53143,53144,53145,53146, -29498,53147,53148,53149,53150,53151,29499,13376,53152,53312,53313,53314,53315, -53316,53317,53318,53319,53320,53321,53322,53323,53324,53325,28227,53326,53327, -53328,53329,53330,53331,29500,53332,53333,29501,53334,53335,53336,20778,53337, -53338,53339,29740,20550,53340,53341,53342,53343,53344,53345,20560,20828,53346, -53347,53348,53349,53350,53351,20302,53352,53353,15702,53354,20803,53355,53356, -53357,53358,53359,53360,53361,14946,24937,21058,28994,12857,53362,53363,12653, -28995,53364,18752,13124,53365,22898,53366,19237,53367,28996,53368,53369,53370, -53371,22100,53372,53373,53374,53376,53377,28997,29760,28998,53378,21548,28999, -53379,12352,29761,53380,53381,29762,53382,53383,13436,53384,17755,53385,53386, -53387,53388,19515,53389,53390,53391,20580,53392,53393,53394,53395,53396,19808, -53397,53398,53399,53400,53401,29000,53402,22899,53403,53404,53405,53406,53407, -53408,12603,53568,20270,53569,53570,53571,14372,53572,53573,53574,53575,53576, -29002,53577,53578,53579,53580,29003,53581,53582,53583,53584,12867,16721,53585, -53586,22320,29001,53587,53588,29004,53589,53590,53591,53592,29006,53593,53594, -53595,22902,53596,21089,21539,53597,53598,29763,18489,53599,53600,53601,53602, -53603,29764,53604,53605,29005,29007,16227,29008,53606,53607,29012,53608,53609, -53610,53611,53612,53613,53614,29014,29009,53615,18769,17761,53616,53617,53618, -16995,14716,53619,53620,29011,53621,29013,53622,53623,53624,14675,53625,53626, -53627,53628,53629,53630,53632,29019,53633,53634,53635,53636,53637,14934,53638, -12413,29017,53639,53640,53641,53642,53643,29016,29010,29018,53644,53645,53646, -53647,53648,29015,53649,53650,53651,18540,53652,53653,53654,53655,19786,29021, -53656,53657,53658,53659,25917,53660,53661,53662,29020,53663,29022,53664,53824, -53825,53826,53827,53828,53829,53830,53831,53832,29023,53833,53834,20325,53835, -53836,53837,53838,53839,53840,53841,53842,53843,53844,53845,53846,53847,53848, -53849,53850,53851,53852,53853,53854,53855,53856,53857,53858,53859,29765,15731, -53860,53861,53862,53863,53864,53865,29024,53866,53867,53868,53869,53870,53871, -53872,53873,53874,53875,53876,53877,53878,53879,53880,53881,53882,53883,53884, -53885,29025,53886,53888,53889,20087,53890,21034,53891,29051,53892,53893,14386, -53894,53895,53896,53897,53898,53899,53900,53901,53902,53903,53904,53905,53906, -53907,53908,53909,53910,53911,53912,53913,53914,53915,53916,53917,53918,53919, -53920,54080,54081,54082,54083,54084,54085,54086,54087,54088,54089,54090,54091, -54092,54093,54094,54095,54096,54097,54098,54099,54100,54101,54102,54103,54104, -54105,54106,54107,54108,54109,54110,15483,14683,54111,14694,17241,19027,27240, -16448,15989,27241,27242,27243,54112,27244,27245,27246,27247,15687,54113,54114, -54115,30075,54116,54117,54118,30077,54119,30078,54120,30076,54121,54122,54123, -54124,15714,54125,30241,13349,54126,54127,54128,54129,30242,54130,54131,54132, -30243,54133,54134,54135,27698,54136,54137,54138,54139,54140,54141,54142,54144, -54145,54146,54147,54148,20820,54149,54150,54151,54152,54153,54154,22890,54155, -54156,54157,54158,54159,54160,54161,54162,54163,54164,54165,54166,54167,54168, -54169,54170,54171,54172,54173,54174,54175,54176,54336,54337,54338,54339,54340, -54341,54342,54343,54344,54345,54346,54347,54348,54349,54350,54351,54352,54353, -54354,54355,54356,54357,54358,54359,54360,54361,54362,54363,54364,54365,54366, -54367,30244,54368,54369,54370,54371,54372,54373,54374,54375,54376,28218,54377, -54378,54379,54380,54381,54382,54383,54384,54385,54386,54387,54388,54389,54390, -54391,54392,54393,54394,54395,54396,54397,54398,54400,54401,54402,54403,54404, -54405,54406,54407,54408,54409,54410,54411,54412,54413,54414,54415,54416,54417, -54418,54419,54420,54421,54422,54423,54424,54425,21810,54426,54427,54428,54429, -54430,54431,54432,54592,54593,54594,54595,54596,54597,54598,54599,21374,19548, -54600,54601,54602,54603,54604,54605,54606,54607,19012,54608,54609,54610,54611, -54612,54613,54614,54615,54616,54617,54618,54619,54620,54621,54622,54623,54624, -54625,54626,54627,54628,54629,54630,54631,54632,54633,54634,54635,54636,54637, -54638,54639,54640,54641,54642,54643,54644,54645,54646,54647,54648,54649,54650, -54651,54652,54653,54654,54656,54657,54658,54659,54660,54661,54662,54663,54664, -54665,54666,54667,54668,54669,54670,54671,54672,54673,54674,54675,54676,54677, -54678,54679,54680,54681,54682,54683,54684,54685,54686,54687,54688,54848,54849, -54850,54851,54852,54853,54854,54855,54856,54857,54858,54859,54860,54861,54862, -54863,54864,54865,54866,54867,54868,54869,54870,54871,54872,54873,54874,54875, -54876,54877,54878,54879,54880,54881,54882,25920,54883,54884,54885,54886,54887, -54888,54889,54890,54891,54892,54893,54894,54895,54896,54897,54898,54899,54900, -54901,54902,54903,54904,54905,54906,54907,54908,54909,54910,54912,54913,30245, -54914,54915,54916,54917,54918,54919,54920,54921,54922,54923,54924,54925,54926, -54927,54928,54929,54930,54931,54932,54933,54934,54935,54936,54937,54938,54939, -54940,54941,54942,54943,54944,55104,55105,55106,55107,55108,55109,55110,55111, -55112,55113,55114,55115,55116,55117,55118,55119,55120,55121,55122,55123,55124, -55125,55126,55127,55128,55129,55130,55131,55132,55133,55134,55135,15919,55136, -55137,55138,55139,55140,17961,55141,55142,55143,55144,55145,55146,55147,55148, -55149,55150,55151,55152,55153,55154,55155,55156,55157,55158,55159,55160,55161, -55162,55163,55164,55165,55166,55168,55169,55170,55171,55172,55173,55174,55175, -55176,55177,55178,55179,55180,55181,55182,55183,55184,55185,55186,55187,55188, -55189,55190,55191,55192,23077,15430,13865,14396,18511,15397,23078,23079,19542, -18499,23080,18045,55193,20789,21097,20790,15431,55194,15666,15204,23081,23082, -20808,23083,20589,13935,16987,55195,19279,14189,18792,14147,15991,22052,23084, -23085,17984,22375,18998,55196,21801,19295,21871,23086,22111,13386,23088,23087, -55197,21099,23089,23090,23091,19028,23092,18987,23093,23094,13135,22127,23095, -15152,13614,23096,23097,14702,20783,21096,23098,14403,20330,12911,23099,23100, -55198,15723,20060,21359,23101,20083,23102,21333,15205,23103,19253,19280,23104, -18283,22126,23105,17717,13889,23106,14156,16206,23107,23108,19245,23109,13687, -23110,16706,22331,23111,19512,55199,21098,17457,23112,13693,15185,23113,20531, -23114,23115,20029,23116,23117,23118,12919,23121,23119,20840,23120,17237,23122, -55200,23123,23124,23125,20539,21029,12409,23126,18219,23127,15735,17185,23128, -23129,17277,19511,23130,23131,16446,18007,23132,23133,18228,23134,23135,14664, -55360,55361,55362,55363,55364,55365,55366,55367,55368,15213,55369,55370,55371, -55372,13881,29816,55373,29817,55374,55375,19811,55376,55377,55378,55379,55380, -55381,55382,55383,30009,55384,55385,55386,55387,27488,55388,55389,55390,55391, -55392,55393,20339,15167,55394,55395,55396,55397,55398,55399,55400,14912,21541, -55401,55402,55403,55404,55405,55406,55407,24921,55408,55409,55410,55411,30068, -12586,12914,55412,55413,55414,55415,55416,55417,55418,30069,55419,55420,30071, -55421,55422,55424,14929,30070,55425,17202,55426,55427,55428,55429,55430,55431, -55432,30073,55433,55434,55435,30072,55436,55437,55438,55439,55440,55441,55442, -55443,55444,55445,55446,55447,55448,55449,55450,55451,55452,55453,55454,55455, -55456,55616,55617,55618,55619,55620,55621,55622,55623,55624,55625,55626,55627, -55628,55629,55630,55631,55632,55633,55634,55635,55636,55637,55638,55639,55640, -55641,55642,55643,55644,55645,55646,55647,55648,55649,55650,55651,55652,55653, -55654,55655,55656,55657,55658,55659,55660,55661,55662,55663,55664,55665,55666, -55667,55668,55669,55670,55671,55672,55673,55674,55675,55676,55677,55678,55680, -55681,55682,55683,55684,55685,55686,55687,55688,55689,55690,55691,55692,55693, -55694,55695,55696,55697,55698,55699,55700,55701,55702,55703,55704,55705,55706, -55707,55708,55709,55710,55711,55712,55872,55873,55874,55875,55876,55877,55878, -55879,55880,55881,55882,55883,55884,55885,55886,12596,21866,14394,55887,14641, -12870,21616,20301,12380,21835,15221,22090,14135,19504,17974,12641,14650,22140, -14689,14113,15482,27226,27227,19577,14707,27228,13435,17203,14161,14936,27229, -21620,27230,15446,15199,27231,16734,16952,21599,22346,27232,27233,27236,27234, -27235,18782,14387,13892,27237,19050,18765,13389,55888,55889,25177,17762,27238, -16437,55890,22328,27239,22316,18556,22611,22605,21598,55891,21625,18756,21294, -14419,13152,55892,18786,29814,55893,55894,55895,14933,55896,29815,55897,55898, -22367,55899,55900,29809,14384,21844,14415,18032,55901,55902,55903,55904,55905, -55906,55907,55908,55909,13123,55910,55911,29810,13100,55912,55913,55914,55915, -21565,18295,55916,55917,55918,55919,55920,29812,55921,55922,29811,55923,55924, -55925,55926,55927,55928,55929,55930,55931,55932,19531,55933,55934,55936,18468, -55937,55938,55939,55940,55941,55942,55943,55944,55945,55946,55947,55948,55949, -29813,55950,22371,17727,30016,55951,55952,30011,55953,30019,55954,30018,55955, -22074,30017,55956,55957,55958,21566,30020,55959,30028,55960,55961,55962,55963, -12367,13688,55964,30025,30026,55965,17756,55966,55967,55968,56128,30021,30022, -56129,56130,30023,30027,56131,15968,30024,14458,56132,56133,56134,30032,30035, -56135,56136,56137,16231,56138,14706,30012,30029,56139,56140,16951,56141,56142, -56143,19576,56144,15481,56145,30030,30031,30033,13925,30034,56146,30037,56147, -56148,56149,56150,56151,56152,56153,30013,56154,56155,56156,30036,21307,56157, -13164,56158,56159,19492,56160,56161,56162,56163,30038,56164,56165,56166,56167, -56168,56169,56170,56171,30039,15969,30040,56172,56173,19551,30043,56174,56175, -56176,56177,56178,12872,22361,56179,30041,56180,30042,30044,56181,30050,56182, -56183,56184,30048,56185,56186,56187,30047,30045,56188,56189,30049,56190,56192, -30046,30052,30053,56193,19555,56194,56195,25919,13624,30051,30056,19491,56196, -56197,56198,56199,56200,30054,30055,56201,56202,56203,56204,56205,56206,30014, -56207,56208,56209,56210,56211,56212,56213,56214,56215,56216,56217,56218,12612, -56219,56220,30015,56221,56222,13637,12900,56223,30060,30057,56224,13911,56384, -30061,56385,30058,56386,56387,56388,56389,56390,30059,56391,56392,13402,56393, -21610,56394,56395,56396,30062,56397,13177,56398,56399,56400,56401,56402,56403, -56404,30063,30065,56405,56406,56407,30064,56408,56409,56410,56411,56412,56413, -56414,30066,56415,30067,56416,56417,56418,56419,56420,56421,56422,56423,56424, -56425,56426,56427,18797,14634,56428,56429,18299,56430,56431,13923,56432,56433, -56434,56435,56436,56437,56438,19529,56439,56440,56441,56442,56443,56444,56445, -56446,56448,56449,56450,56451,56452,56453,56454,56455,56456,56457,56458,27174, -56459,56460,56461,56462,56463,56464,56465,56466,56467,56468,56469,56470,56471, -56472,56473,56474,56475,56476,56477,56478,56479,56480,56640,56641,56642,56643, -56644,56645,56646,56647,56648,56649,56650,56651,56652,56653,56654,56655,56656, -56657,56658,56659,56660,56661,56662,56663,56664,56665,56666,56667,56668,56669, -56670,56671,56672,56673,56674,56675,56676,56677,56678,56679,56680,56681,56682, -56683,56684,56685,56686,56687,56688,56689,56690,56691,56692,56693,56694,56695, -56696,56697,56698,56699,56700,56701,56702,56704,56705,56706,56707,56708,56709, -56710,56711,56712,56713,56714,56715,56716,56717,56718,56719,56720,56721,56722, -56723,56724,56725,56726,56727,56728,56729,56730,56731,56732,56733,56734,56735, -56736,56896,56897,56898,56899,56900,56901,56902,56903,56904,56905,56906,56907, -56908,56909,56910,56911,56912,56913,56914,56915,56916,56917,56918,56919,56920, -56921,56922,56923,56924,56925,56926,56927,56928,13109,21630,14700,20601,56929, -26989,22314,26990,16982,18541,14948,26991,26992,26993,22113,26994,26995,26997, -26996,26998,26999,18273,27000,21592,27001,15694,56930,27002,27003,15695,27004, -14376,16702,27005,12594,15188,14709,27006,56931,27169,27170,27171,14200,15405, -56932,19044,24654,21551,20285,21815,27172,21854,27173,20545,14652,56933,13383, -12633,56934,56935,56936,16433,56937,56938,56939,56940,12646,12647,56941,12648, -56942,56943,56944,56945,13117,18536,56946,56947,56948,56949,25921,56950,56951, -12639,56952,56953,56954,16713,13423,56955,56956,18216,21336,56957,18041,20792, -56958,14717,17013,56960,56961,56962,56963,56964,21293,56965,21579,15740,56966, -25922,14133,25923,56967,56968,15161,21858,56969,15736,21558,20005,16684,13145, -56970,56971,19574,56972,25926,25924,25928,56973,25930,25927,13647,17992,56974, -13692,25925,56975,19062,56976,56977,25929,56978,56979,56980,17236,12613,15395, -56981,56982,56983,22327,56984,56985,19787,19277,19018,19539,25932,25931,17510, -56986,56987,20769,20791,25933,56988,25936,56989,19768,22128,25935,13661,56990, -19774,56991,25937,13882,56992,57152,19752,14692,57153,19013,13137,19289,21612, -25938,14186,57154,57155,57156,25934,57157,57158,57159,57160,57161,57162,25941, -13438,25942,57163,57164,57165,57166,57167,25939,25940,57168,21085,57169,57170, -16991,12614,57171,21346,57172,57173,13917,19308,57174,25943,57175,57176,21366, -57177,57178,57179,57180,57181,12649,57182,13940,25946,25944,25945,13632,57183, -57184,57185,21061,25948,57186,57187,25950,57188,57189,57190,57191,57192,57193, -25949,18226,57194,21027,57195,57196,25947,57197,57198,57199,57200,21602,21850, -57201,57202,57203,57204,57205,25952,22385,57206,57207,57208,57209,57210,57211, -57212,25953,57213,12636,20859,57214,25954,25956,57216,57217,57218,57219,25955, -57220,57221,25957,57222,57223,57224,57225,57226,21080,57227,13643,57228,26463, -57229,23157,57230,23160,57231,23158,57232,23159,57233,57234,57235,23162,20559, -17479,57236,57237,12398,57238,57239,57240,20528,57241,23161,57242,21322,14890, -23330,18289,57243,23164,23163,18779,23165,57244,23329,22366,23166,16730,57245, -57246,23333,57247,57248,21364,57408,57409,23335,23332,57410,23336,57411,57412, -15676,57413,57414,57415,16457,23331,23334,22051,57416,23337,57417,57418,57419, -23341,57420,57421,57422,23342,23340,14914,57423,57424,57425,16164,23339,57426, -57427,57428,23338,21575,12863,57429,57430,23343,57431,14713,57432,23344,57433, -57434,57435,57436,13115,57437,57438,57439,13606,57440,57441,57442,57443,13884, -23345,57444,57445,57446,13941,57447,23346,57448,57449,57450,57451,57452,57453, -57454,57455,57456,57457,57458,57459,57460,57461,57462,57463,57464,57465,57466, -57467,12617,57468,57469,57470,57472,23348,57473,57474,57475,23347,23349,57476, -57477,57478,57479,57480,57481,57482,57483,57484,57485,57486,23351,57487,23350, -57488,57489,57490,57491,57492,57493,57494,23352,57495,57496,57497,57498,57499, -57500,57501,57502,57503,23353,57504,57664,23354,57665,57666,21327,29818,18293, -22339,17764,29820,29821,29819,57667,15942,57668,57669,57670,57671,20591,57672, -57673,14163,57674,57675,21581,19498,57676,57677,29986,29985,14888,29822,19286, -57678,57679,57680,29988,16466,57681,13162,57682,19754,29989,29987,15668,29992, -57683,29993,15693,17208,16225,19297,29994,57684,57685,57686,29990,29991,17520, -57687,57688,57689,57690,57691,29996,57692,13372,57693,22381,57694,13399,29995, -29998,57695,57696,29997,29999,20561,57697,57698,57699,57700,57701,57702,57703, -17233,18473,57704,57705,57706,57707,57708,57709,30000,30001,57710,57711,57712, -57713,57714,57715,30002,57716,57717,30003,30004,30005,57718,57719,57720,57721, -30007,30006,57722,57723,57724,57725,30008,57726,57728,57729,57730,57731,57732, -57733,57734,57735,57736,57737,57738,12873,57739,21332,19021,57740,16495,22104, -21040,16703,57741,15728,57742,57743,57744,57745,57746,57747,57748,57749,57750, -57751,14378,57752,57753,57754,57755,57756,57757,57758,57759,57760,57920,57921, -57922,57923,57924,57925,57926,57927,57928,57929,57930,57931,57932,57933,57934, -57935,57936,57937,57938,57939,57940,57941,57942,57943,57944,57945,57946,57947, -57948,57949,57950,57951,57952,57953,57954,57955,57956,57957,57958,57959,57960, -57961,57962,57963,57964,57965,57966,57967,57968,57969,57970,57971,57972,57973, -57974,57975,57976,57977,57978,57979,57980,57981,57982,57984,57985,57986,57987, -57988,57989,57990,57991,57992,57993,57994,57995,57996,57997,57998,57999,58000, -58001,58002,58003,58004,58005,58006,58007,58008,58009,58010,58011,58012,58013, -58014,58015,58016,58176,58177,58178,58179,58180,58181,58182,58183,58184,58185, -58186,58187,58188,58189,58190,58191,58192,58193,58194,58195,58196,58197,58198, -58199,58200,58201,58202,58203,58204,58205,58206,58207,58208,58209,58210,58211, -58212,58213,58214,58215,58216,58217,58218,58219,58220,58221,15480,58222,58223, -58224,58225,58226,58227,58228,58229,58230,58231,58232,58233,58234,58235,58236, -58237,58238,58240,58241,58242,58243,58244,58245,58246,58247,30278,58248,58249, -58250,58251,58252,58253,58254,58255,58256,58257,58258,58259,58260,58261,58262, -58263,58264,58265,58266,58267,58268,58269,58270,58271,58272,58432,58433,58434, -58435,58436,58437,30279,58438,58439,58440,58441,58442,58443,58444,58445,58446, -58447,58448,58449,58450,58451,58452,58453,58454,58455,58456,58457,58458,58459, -58460,58461,58462,30280,58463,58464,58465,58466,58467,58468,58469,58470,58471, -58472,58473,58474,58475,58476,58477,58478,58479,58480,58481,58482,58483,58484, -58485,58486,58487,58488,58489,58490,58491,58492,58493,58494,58496,58497,58498, -58499,58500,58501,58502,58503,58504,58505,58506,58507,58508,58509,58510,58511, -58512,58513,58514,58515,58516,58517,58518,58519,58520,58521,58522,58523,58524, -58525,58526,58527,58528,58688,58689,58690,58691,58692,58693,58694,58695,58696, -58697,58698,58699,58700,58701,58702,58703,58704,58705,58706,58707,58708,58709, -58710,58711,58712,58713,58714,58715,58716,58717,58718,58719,58720,58721,58722, -58723,58724,58725,58726,58727,58728,58729,58730,58731,58732,58733,58734,58735, -58736,58737,58738,58739,30281,58740,58741,58742,58743,58744,58745,58746,58747, -58748,58749,58750,58752,58753,58754,58755,58756,58757,58758,58759,58760,58761, -58762,58763,58764,58765,58766,58767,58768,58769,58770,58771,58772,58773,58774, -58775,58776,58777,58778,58779,58780,58781,58782,58783,30282,58784,58944,58945, -58946,58947,58948,58949,58950,58951,58952,58953,58954,58955,58956,58957,58958, -58959,58960,58961,58962,58963,58964,58965,58966,58967,58968,58969,58970,58971, -58972,58973,58974,58975,58976,58977,58978,30284,58979,58980,58981,58982,58983, -58984,58985,58986,58987,58988,58989,58990,58991,58992,58993,58994,58995,58996, -58997,58998,58999,59000,59001,59002,59003,59004,59005,59006,59008,59009,59010, -59011,59012,59013,59014,59015,59016,59017,59018,59019,59020,59021,59022,59023, -59024,59025,59026,59027,59028,59029,59030,59031,59032,59033,59034,59035,59036, -59037,30283,59038,59039,59040,59200,59201,59202,59203,59204,59205,59206,59207, -30569,59208,59209,59210,59211,59212,59213,59214,59215,59216,59217,59218,59219, -59220,59221,59222,59223,59224,59225,59226,59227,59228,59229,59230,59231,59232, -59233,59234,59235,59236,59237,59238,59239,59240,59241,59242,59243,59244,59245, -59246,59247,59248,59249,59250,59251,59252,59253,59254,59255,59256,59257,59258, -59259,59260,59261,59262,59264,59265,59266,59267,59268,59269,59270,59271,59272, -59273,59274,59275,59276,59277,59278,59279,59280,59281,59282,59283,59284,59285, -59286,59287,59288,59289,59290,59291,59292,59293,59294,59295,59296,59456,59457, -59458,59459,59460,59461,59462,59463,59464,59465,59466,59467,59468,59469,59470, -30285,59471,59472,59473,59474,59475,59476,59477,59478,59479,59480,59481,59482, -59483,59484,59485,59486,59487,59488,59489,59490,59491,59492,59493,59494,59495, -59496,59497,59498,59499,59500,59501,59502,59503,59504,59505,59506,59507,59508, -59509,59510,59511,59512,59513,59514,30286,59515,59516,59517,59518,59520,59521, -59522,59523,59524,59525,59526,59527,59528,59529,59530,59531,59532,59533,59534, -59535,59536,59537,59538,59539,59540,28228,28229,28230,21867,13860,28232,28231, -28233,28234,18213,28235,28236,59541,14128,13686,28237,28239,59542,28238,59543, -14406,28240,28241,28242,13915,13102,22099,17478,12597,14422,28243,28244,21567, -18261,15995,20057,14643,28246,28245,28248,28247,17701,28249,28250,18222,28251, -18223,28252,12839,28253,28254,28255,28256,28257,22378,28258,28259,15448,28260, -21323,19578,12844,16741,28261,18214,17197,59544,28262,28263,28264,28265,28266, -28267,28268,59545,28269,28270,28271,59546,59547,28272,28273,28274,28276,28275, -59548,28277,19757,16961,28278,28279,28280,21793,28281,20275,28282,28283,59549, -28284,28285,28449,28286,28450,14453,17274,28451,28452,15682,21055,12921,28453, -28454,28455,21112,28456,22141,28457,17996,59550,28458,28459,16692,28460,20346, -19320,28462,28461,13178,14712,28463,28464,20578,28465,28466,14182,20543,28467, -28468,28469,18545,19552,28470,28471,28472,28473,28474,21856,28475,13421,17194, -28476,59551,28477,28478,28479,59552,20093,28480,16992,13368,22326,15733,59712, -20295,28483,28481,28482,28484,13863,15484,15970,17228,28485,28486,59713,28487, -28495,28488,28489,28490,18242,28529,13901,28491,59714,28492,28493,13894,17214, -28494,59715,28496,28497,28498,21874,59716,28499,17527,59717,28500,17528,28501, -28502,14436,12407,28503,28504,28505,59718,28506,28507,28508,28509,59719,28510, -15925,28513,28511,28512,59720,28514,28515,16717,28516,28517,28518,28519,28520, -28521,28522,28523,28524,16472,59721,28525,16685,28526,28527,28528,59722,59723, -20322,59724,59725,59726,59727,59728,59729,59730,59731,13092,59732,59733,59734, -59735,59736,59737,59738,59739,59740,59741,59742,59743,59744,59745,59746,59747, -59748,59749,59750,59751,59752,59753,59754,59755,59756,59757,59758,59759,59760, -59761,59762,59763,59764,59765,59766,59767,59768,59769,59770,59771,59772,59773, -59774,59776,59777,59778,59779,59780,59781,59782,59783,59784,59785,59786,59787, -59788,59789,59790,59791,59792,59793,59794,59795,59796,59797,59798,59799,59800, -59801,59802,59803,59804,59805,59806,59807,59808,59968,59969,59970,59971,59972, -59973,59974,59975,59976,59977,59978,59979,59980,59981,59982,59983,59984,59985, -59986,59987,59988,59989,59990,59991,59992,59993,59994,59995,17221,25413,18753, -25414,59996,12629,20042,13363,18546,25415,20304,25416,15460,25417,25418,17222, -21794,17494,14699,20037,25419,17270,25420,59997,14119,14451,14930,25421,25422, -21572,25423,59998,25424,20811,25425,25426,25427,25428,20822,25429,12923,16443, -25430,59999,16427,25431,25432,25433,60000,25434,25435,60001,14391,23138,60002, -13907,60003,23140,23139,60004,60005,60006,60007,60008,60009,60010,23142,60011, -60012,60013,18542,60014,60015,23141,14144,20852,21109,21875,15703,60016,60017, -60018,60019,22376,23144,23143,60020,12322,19795,60021,23145,60022,14397,15434, -16957,16932,13122,23146,60023,16938,17456,15669,60024,60025,20318,60026,60027, -60028,23147,18754,60029,60030,60032,60033,60034,12637,60035,60036,60037,23148, -60038,13880,21562,60039,13181,60040,60041,23149,21577,20309,17763,60042,23150, -60043,60044,60045,60046,60047,23151,60048,23152,16746,19541,20317,60049,60050, -60051,60052,60053,60054,60055,60056,60057,60058,60059,60060,60061,21351,16929, -60062,23153,60063,60064,19301,60224,23154,60225,19302,21118,60226,60227,60228, -14452,60229,60230,23155,12335,20278,60231,60232,21839,60233,60234,60235,60236, -60237,60238,60239,60240,60241,60242,19309,60243,60244,60245,60246,60247,60248, -60249,60250,23156,60251,60252,25412,60253,60254,16677,60255,60256,30271,60257, -60258,30272,30273,17489,60259,18488,20835,60260,60261,20571,20805,15407,14669, -60262,28532,60263,60264,13382,21306,30274,13179,60265,60266,30275,60267,60268, -13681,60269,60270,60271,60272,60273,60274,60275,60276,60277,60278,30277,60279, -60280,60281,60282,60283,60284,60285,21354,30247,20777,60286,60288,60289,60290, -30249,60291,60292,60293,30248,60294,60295,16739,16471,60296,12578,60297,60298, -60299,60300,20077,60301,20584,30251,60302,60303,20342,60304,30250,21872,30252, -17209,60305,60306,60307,15220,30254,30253,60308,60309,60310,17502,60311,60312, -16728,60313,60314,60315,60316,60317,19242,60318,20284,60319,60320,60480,60481, -60482,60483,60484,60485,60486,60487,60488,30255,60489,60490,30256,60491,60492, -30257,60493,16950,60494,60495,60496,60497,60498,12372,17785,60499,60500,60501, -60502,30258,60503,60504,60505,60506,60507,60508,60509,60510,60511,60512,60513, -60514,60515,60516,60517,60518,60519,60520,60521,18272,30246,60522,60523,15928, -60524,60525,15922,60526,13669,60527,60528,14151,60529,16191,17234,17254,60530, -60531,22604,60532,60533,60534,14447,60535,60536,60537,60538,60539,60540,60541, -60542,60544,15737,20773,60545,12368,60546,60547,60548,60549,60550,30512,60551, -60552,60553,60554,60555,60556,60557,60558,30513,60559,60560,60561,60562,60563, -20524,60564,12336,60565,60566,60567,30514,30515,60568,30516,60569,60570,60571, -18250,60572,60573,60574,60575,60576,60736,60737,15951,60738,60739,30519,60740, -60741,60742,60743,60744,60745,60746,30518,60747,12638,60748,30517,60749,60750, -30520,60751,30521,60752,60753,60754,60755,60756,60757,60758,60759,60760,60761, -60762,60763,60764,60765,60766,60767,60768,60769,60770,60771,60772,60773,60774, -60775,60776,60777,60778,60779,60780,60781,60782,60783,60784,60785,60786,60787, -60788,60789,60790,60791,60792,60793,60794,60795,60796,60797,60798,60800,60801, -20004,18509,60802,14891,26680,26681,26682,15938,60803,60804,60805,60806,60807, -21108,60808,21583,18776,60809,60810,60811,60812,60813,60814,60815,60816,60817, -60818,60819,60820,60821,60822,60823,60824,60825,60826,60827,60828,60829,60830, -60831,60832,60992,60993,60994,60995,60996,60997,60998,60999,61000,61001,61002, -61003,61004,61005,61006,61007,61008,61009,61010,61011,61012,61013,61014,61015, -61016,61017,61018,61019,61020,61021,61022,61023,61024,61025,61026,61027,61028, -61029,61030,61031,61032,61033,61034,61035,61036,61037,61038,61039,61040,61041, -61042,61043,61044,61045,61046,61047,61048,61049,61050,61051,61052,61053,61054, -61056,61057,61058,61059,61060,61061,61062,61063,61064,61065,61066,61067,61068, -61069,61070,61071,61072,61073,61074,61075,61076,61077,61078,61079,61080,61081, -61082,61083,61084,61085,61086,61087,61088,61248,61249,61250,61251,61252,61253, -21043,13861,18282,29052,20334,19251,20587,26479,19815,14667,13913,29053,12388, -19276,29054,21540,16941,16748,17988,15921,29217,15445,61254,29218,29219,61255, -29220,21059,17973,61256,19783,29221,61257,21297,16197,19554,61258,29222,29223, -20821,13934,29224,29225,13663,29226,29227,61259,12924,29228,29229,18471,61260, -61261,61262,61263,61264,61265,61266,61267,61268,61269,61270,61271,61272,61273, -61274,61275,61276,61277,61278,61279,61280,61281,61282,61283,61284,61285,61286, -61287,61288,61289,61290,61291,61292,61293,61294,61295,61296,61297,14183,61298, -61299,27689,27690,27691,61300,27692,61301,61302,17966,27693,27694,61303,61304, -61305,14153,18995,61306,61307,61308,61309,61310,61312,61313,25144,30543,61314, -61315,61316,61317,61318,61319,61320,61321,61322,61323,61324,61325,61326,61327, -61328,61329,61330,61331,61332,61333,61334,61335,61336,61337,61338,61339,61340, -61341,61342,61343,61344,61504,61505,61506,61507,61508,30544,61509,61510,12877, -61511,61512,61513,61514,61515,61516,61517,61518,61519,61520,61521,61522,61523, -61524,61525,61526,61527,61528,61529,61530,61531,61532,61533,61534,61535,61536, -61537,61538,61539,30545,61540,61541,61542,61543,61544,61545,61546,61547,61548, -61549,61550,61551,61552,61553,61554,61555,61556,61557,61558,61559,61560,61561, -61562,61563,61564,61565,61566,61568,61569,61570,61571,61572,61573,61574,61575, -61576,61577,30547,30546,61578,61579,61580,61581,61582,61583,61584,61585,61586, -61587,61588,61589,61590,25147,61591,15394,61592,25148,25149,25150,25151,25152, -25153,14137,21115,15652,19022,12581,19271,61593,25154,13948,18500,25155,61594, -61595,15688,61596,12669,25156,61597,13942,25157,17497,61598,61599,25158,20314, -14685,25159,16417,61600,25160,12918,61760,25161,61761,16755,25162,25163,17016, -25164,25165,25166,19031,22584,22885,20323,61762,61763,61764,61765,61766,61767, -61768,61769,61770,61771,61772,28709,61773,61774,23600,61775,61776,61777,61778, -61779,61780,61781,61782,61783,61784,61785,61786,61787,61788,61789,61790,61791, -61792,61793,61794,61795,61796,61797,61798,61799,61800,61801,61802,61803,61804, -61805,61806,61807,61808,61809,61810,61811,61812,61813,61814,61815,61816,61817, -61818,61819,61820,61821,61822,61824,61825,61826,61827,61828,61829,61830,61831, -61832,61833,61834,61835,61836,61837,61838,61839,61840,61841,61842,61843,61844, -61845,61846,61847,61848,61849,61850,61851,61852,61853,61854,61855,61856,62016, -62017,62018,62019,62020,62021,62022,62023,62024,62025,62026,62027,62028,62029, -62030,62031,62032,62033,62034,62035,62036,62037,62038,62039,62040,62041,62042, -62043,62044,62045,62046,62047,62048,62049,62050,62051,62052,62053,62054,62055, -62056,62057,62058,62059,62060,62061,62062,62063,62064,62065,62066,62067,62068, -62069,62070,62071,62072,62073,62074,62075,62076,62077,62078,62080,62081,62082, -62083,62084,62085,62086,62087,62088,62089,62090,62091,62092,62093,62094,62095, -62096,62097,62098,62099,62100,62101,62102,62103,62104,62105,62106,62107,62108, -62109,62110,62111,62112,62272,62273,62274,62275,62276,62277,62278,62279,62280, -62281,62282,62283,62284,62285,62286,62287,62288,62289,17005,21542,19796,20785, -13147,18301,62290,12853,16959,26208,19003,26209,26210,15956,26211,22308,19797, -26213,15453,26212,26214,26215,17006,62291,15678,26216,16998,14887,26217,62292, -26218,13138,20841,62293,62294,16165,26219,18031,26220,26221,62295,62296,26222, -17965,26223,62297,18727,26224,26225,26226,25913,26227,26228,16994,26229,26230, -22120,26231,62298,26232,14663,62299,62300,62301,62302,62303,62304,62305,30523, -30522,62306,62307,62308,62309,30526,30524,14881,62310,30527,62311,30528,62312, -62313,62314,30530,30529,30532,62315,62316,30531,62317,62318,62319,62320,62321, -30533,30534,62322,62323,62324,62325,30535,62326,19304,62327,62328,62329,62330, -14431,62331,62332,62333,62334,62336,62337,30548,62338,30549,62339,62340,62341, -62342,30550,62343,62344,62345,62346,30552,62347,30554,62348,30551,62349,62350, -62351,62352,62353,62354,62355,62356,62357,30555,62358,30553,62359,62360,62361, -62362,62363,62364,62365,22359,62366,62367,62368,62528,30556,62529,62530,62531, -62532,62533,62534,30557,62535,62536,62537,30558,62538,62539,62540,62541,62542, -62543,62544,62545,62546,62547,62548,30559,62549,62550,62551,30560,62552,62553, -62554,62555,62556,62557,62558,62559,62560,62561,62562,23371,62563,62564,22570, -62565,62566,62567,62568,62569,62570,62571,62572,25975,14701,62573,62574,62575, -62576,16253,15210,30537,17991,30536,62577,30538,30540,30539,62578,62579,62580, -30541,62581,20026,62582,30542,62583,62584,17447,62585,62586,62587,62588,62589, -62590,62592,62593,62594,62595,62596,62597,62598,62599,62600,62601,62602,62603, -62604,62605,62606,62607,62608,62609,62610,62611,62612,62613,62614,62615,62616, -62617,62618,62619,62620,62621,62622,62623,62624,62784,62785,62786,62787,62788, -62789,62790,62791,62792,62793,62794,62795,62796,62797,62798,62799,62800,62801, -62802,62803,62804,62805,62806,62807,62808,62809,62810,62811,62812,62813,62814, -62815,62816,62817,62818,62819,62820,62821,62822,62823,62824,62825,62826,62827, -62828,62829,62830,62831,62832,62833,62834,62835,62836,62837,62838,62839,62840, -62841,62842,62843,62844,62845,62846,62848,62849,62850,62851,62852,62853,62854, -62855,62856,62857,62858,62859,62860,62861,62862,62863,62864,62865,62866,62867, -62868,62869,62870,62871,62872,62873,62874,62875,62876,62877,62878,62879,62880, -63040,63041,63042,63043,63044,63045,63046,63047,63048,63049,63050,63051,63052, -63053,63054,63055,63056,63057,63058,63059,63060,63061,63062,63063,63064,63065, -63066,63067,63068,63069,63070,63071,63072,63073,63074,63075,63076,63077,63078, -63079,63080,63081,63082,63083,63084,63085,63086,63087,63088,63089,63090,63091, -63092,63093,63094,63095,63096,63097,63098,63099,63100,63101,63102,63104,63105, -63106,63107,63108,63109,63110,63111,63112,63113,63114,63115,63116,63117,63118, -63119,63120,63121,63122,63123,63124,63125,63126,63127,63128,63129,63130,63131, -63132,63133,63134,63135,63136,63296,63297,63298,63299,63300,63301,63302,63303, -63304,63305,63306,63307,63308,63309,63310,63311,63312,63313,63314,63315,63316, -63317,63318,63319,63320,63321,63322,63323,63324,63325,63326,63327,63328,63329, -63330,63331,63332,63333,63334,63335,63336,63337,63338,63339,63340,63341,63342, -63343,63344,63345,63346,63347,63348,63349,63350,63351,63352,63353,63354,63355, -63356,63357,63358,63360,21347,63361,63362,30287,63363,16947,30288,63364,63365, -30289,30290,30291,30292,63366,63367,30294,63368,12587,30295,63369,30296,30297, -30298,63370,30299,30300,63371,63372,63373,63374,30301,30302,20298,63375,30303, -30304,30305,30306,30307,30308,16496,30309,30310,30311,30312,30313,63376,30314, -63377,30315,30316,63378,30317,30318,30319,30320,30321,30322,30323,30324,15912, -63379,30325,30326,30327,30328,63380,63381,63382,63383,63384,18554,30329,30330, -30331,30332,63385,63386,30333,30334,30497,30498,30499,30500,30501,63387,63388, -30502,30503,30504,12654,30505,30506,30507,63389,63390,30508,30509,16731,30510, -63391,63392,30511,63552,63553,63554,63555,63556,63557,63558,63559,63560,63561, -63562,63563,63564,63565,63566,63567,63568,63569,63570,63571,63572,63573,63574, -63575,63576,63577,63578,63579,63580,63581,63582,63583,63584,63585,63586,63587, -63588,63589,63590,63591,63592,63593,63594,63595,63596,63597,63598,63599,63600, -63601,63602,63603,63604,63605,63606,63607,63608,63609,63610,63611,63612,63613, -63614,63616,63617,63618,63619,63620,63621,63622,63623,63624,63625,63626,63627, -63628,63629,63630,63631,63632,63633,63634,63635,63636,63637,63638,63639,63640, -63641,63642,63643,63644,63645,63646,63647,63648,63808,63809,63810,63811,63812, -63813,63814,63815,63816,63817,63818,63819,63820,63821,63822,63823,63824,63825, -63826,63827,63828,63829,63830,63831,63832,63833,63834,63835,63836,63837,63838, -63839,63840,63841,63842,63843,63844,63845,63846,63847,63848,63849,63850,63851, -63852,63853,63854,63855,63856,63857,63858,63859,63860,63861,63862,63863,63864, -63865,63866,63867,63868,63869,63870,63872,63873,63874,63875,63876,63877,63878, -63879,63880,63881,63882,63883,63884,63885,63886,63887,63888,63889,63890,63891, -63892,63893,63894,63895,63896,63897,63898,63899,63900,63901,63902,63903,63904, -64064,64065,64066,64067,64068,64069,64070,64071,64072,64073,64074,64075,64076, -64077,64078,64079,64080,64081,64082,64083,64084,64085,64086,64087,64088,64089, -64090,64091,64092,64093,64094,64095,64096,64097,64098,64099,64100,64101,64102, -64103,64104,64105,64106,64107,64108,64109,64110,64111,64112,64113,64114,64115, -64116,64117,64118,64119,64120,64121,64122,64123,64124,64125,64126,64128,64129, -64130,64131,64132,64133,64134,64135,64136,64137,64138,64139,64140,64141,64142, -64143,64144,64145,64146,64147,64148,64149,64150,64151,64152,64153,64154,64155, -64156,64157,64158,64159,64160,64320,64321,64322,64323,64324,64325,64326,64327, -64328,64329,64330,64331,64332,64333,64334,64335,64336,64337,64338,64339,64340, -64341,64342,64343,64344,64345,64346,64347,17521,28719,15398,28720,17273,64348, -17720,20795,64349,28721,28722,28723,28724,28725,20796,64350,20844,64351,28727, -28726,21543,64352,19794,28728,28730,28729,28731,28732,64353,64354,14443,28733, -14952,64355,28734,28735,15977,28736,13932,28737,28738,28739,28740,18485,28741, -28742,64356,28743,17780,64357,28744,64358,64359,64360,28745,64361,28746,30525, -64362,28747,28748,28749,64363,28750,64364,64365,64366,64367,28751,14935,64368, -28752,28753,28754,28755,28756,28757,28758,28760,64369,64370,21285,28759,64371, -28761,64372,64373,64374,64375,64376,64377,64378,64379,64380,64381,30010,16953, -64382,64384,30564,64385,64386,64387,64388,30565,30566,64389,64390,30567,64391, -64392,64393,64394,64395,64396,30568,16948,64397,64398,64399,64400,64401,64402, -64403,64404,64405,30570,64406,30571,64407,64408,64409,64410,64411,64412,17011, -64413,64414,64415,64416,64576,64577,64578,64579,64580,64581,64582,64583,64584, -29808,64585,64586,64587,29807,64588,64589,17001,64590,30561,30562,64591,64592, -64593,64594,64595,15174,64596,64597,64598,64599,22884,64600,64601,64602,19058, -16488,28708,64603,14938,64604,64605,18221,64606,64607,64608,17452,64609,64610, -30572,30573,30574,64611,30576,30575,64612,30577,64613,64614,30580,64615,30579, -64616,30578,30581,64617,64618,64619,64620,30582,64621,64622,64623,64624,64625, -64626,64627,64628,64629,28009,64630,28010,28011,64631,30268,64632,64633,64634, -64635,64636,64637,64638,64640,64641,64642,64643,64644,30269,64645,30270,13862, -64646,22590,64647,64648,14660,64649,64650,64651,22587,64652,23601,64653,64654, -64655,64656,64657,64658,19059,64659,30583,64660,64661,64662,64663,64664,64665, -64666,64667,64668,30584,64669,64670,30585,64671,64672,64832,64833,64834,64835, -64836,30587,64837,30586,64838,12615,64839,30588,30589,64840,64841,64842,64843, -64844,30590,64845,64846,64847,64848,64849,64850,64851,64852,64853,64854,64855, -18027,27700,64856,64857,64858,64859,64860,64861,64862,64863,64864,64865,64866, -64867,64868,64869,64870,64871,64872,64873,64874,64875,64876,64877,64878,64879, -64880,64881,64882,64883,64884,64885,64886,64887,64888,64889,64890,64891,64892, -64893,64894,64896,64897,64898,64899,64900,64901,13149,30259,64902,64903,30260, -16740,30261,30262,30263,30264,30265,30266,18467,30267,64904,64905,64906,64907, -64908,64909,64910,64911,64912,64913,64914,64915,16762,14632,28008,64916,64917, -64918,14698,22879,64919,64920,64921,64922,64923,64924,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64925,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64926,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64927,N,N,N,N,N,N,N,N,N,64928, -65088,65089,65090,65091,N,65092,N,65093,65094,N,N,N,65095,N,N,N,N,N,N,65096, -65097,65098,N,65099,65100,N,N,65101,65102,65103,43349,42738,N,42740,42741, -42720,42721,42736,42737,42722,42723,42734,42735,42726,42727,42724,42725,42728, -42729,42730,42731,N,N,N,N,43368,43369,43370,43371,43372,43373,43374,43375, -43376,43377,N,43378,43379,43380,43381,N,43382,43383,43384,43385,43386,43387, -43388,43389,43390,43392,43393,43394,43395,43396,N,43397,43398,43399,43400, -8993,8994,8995,8551,8997,8998,8999,9000,9001,9002,9003,9004,9005,9006,9007, -9008,9009,9010,9011,9012,9013,9014,9015,9016,9017,9018,9019,9020,9021,9022, -9023,9024,9025,9026,9027,9028,9029,9030,9031,9032,9033,9034,9035,9036,9037, -9038,9039,9040,9041,9042,9043,9044,9045,9046,9047,9048,9049,9050,9051,9052, -9053,9054,9055,9056,9057,9058,9059,9060,9061,9062,9063,9064,9065,9066,9067, -9068,9069,9070,9071,9072,9073,9074,9075,9076,9077,9078,9079,9080,9081,9082, -9083,9084,9085,8491,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8553,8554,43350,9086,43351,8996, -}; - -static const struct unim_index gbcommon_encmap[256] = { -{__gbcommon_encmap+0,164,252},{__gbcommon_encmap+89,1,220},{__gbcommon_encmap+ -309,81,217},{__gbcommon_encmap+446,145,201},{__gbcommon_encmap+503,1,81},{0,0, -0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gbcommon_encmap+584, -16,59},{__gbcommon_encmap+628,3,153},{__gbcommon_encmap+779,8,191},{ -__gbcommon_encmap+963,18,18},{__gbcommon_encmap+964,96,155},{__gbcommon_encmap -+1024,0,229},{__gbcommon_encmap+1254,5,66},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gbcommon_encmap+1316,0,254},{ -__gbcommon_encmap+1571,5,41},{__gbcommon_encmap+1608,32,163},{ -__gbcommon_encmap+1740,142,213},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{__gbcommon_encmap+1812,0,255},{__gbcommon_encmap+2068,0,255},{ -__gbcommon_encmap+2324,0,255},{__gbcommon_encmap+2580,0,255},{ -__gbcommon_encmap+2836,0,255},{__gbcommon_encmap+3092,0,255},{ -__gbcommon_encmap+3348,0,255},{__gbcommon_encmap+3604,0,255},{ -__gbcommon_encmap+3860,0,255},{__gbcommon_encmap+4116,0,255},{ -__gbcommon_encmap+4372,0,255},{__gbcommon_encmap+4628,0,255},{ -__gbcommon_encmap+4884,0,255},{__gbcommon_encmap+5140,0,255},{ -__gbcommon_encmap+5396,0,255},{__gbcommon_encmap+5652,0,255},{ -__gbcommon_encmap+5908,0,255},{__gbcommon_encmap+6164,0,255},{ -__gbcommon_encmap+6420,0,255},{__gbcommon_encmap+6676,0,255},{ -__gbcommon_encmap+6932,0,255},{__gbcommon_encmap+7188,0,255},{ -__gbcommon_encmap+7444,0,255},{__gbcommon_encmap+7700,0,255},{ -__gbcommon_encmap+7956,0,255},{__gbcommon_encmap+8212,0,255},{ -__gbcommon_encmap+8468,0,255},{__gbcommon_encmap+8724,0,255},{ -__gbcommon_encmap+8980,0,255},{__gbcommon_encmap+9236,0,255},{ -__gbcommon_encmap+9492,0,255},{__gbcommon_encmap+9748,0,255},{ -__gbcommon_encmap+10004,0,255},{__gbcommon_encmap+10260,0,255},{ -__gbcommon_encmap+10516,0,255},{__gbcommon_encmap+10772,0,255},{ -__gbcommon_encmap+11028,0,255},{__gbcommon_encmap+11284,0,255},{ -__gbcommon_encmap+11540,0,255},{__gbcommon_encmap+11796,0,255},{ -__gbcommon_encmap+12052,0,255},{__gbcommon_encmap+12308,0,255},{ -__gbcommon_encmap+12564,0,255},{__gbcommon_encmap+12820,0,255},{ -__gbcommon_encmap+13076,0,255},{__gbcommon_encmap+13332,0,255},{ -__gbcommon_encmap+13588,0,255},{__gbcommon_encmap+13844,0,255},{ -__gbcommon_encmap+14100,0,255},{__gbcommon_encmap+14356,0,255},{ -__gbcommon_encmap+14612,0,255},{__gbcommon_encmap+14868,0,255},{ -__gbcommon_encmap+15124,0,255},{__gbcommon_encmap+15380,0,255},{ -__gbcommon_encmap+15636,0,255},{__gbcommon_encmap+15892,0,255},{ -__gbcommon_encmap+16148,0,255},{__gbcommon_encmap+16404,0,255},{ -__gbcommon_encmap+16660,0,255},{__gbcommon_encmap+16916,0,255},{ -__gbcommon_encmap+17172,0,255},{__gbcommon_encmap+17428,0,255},{ -__gbcommon_encmap+17684,0,255},{__gbcommon_encmap+17940,0,255},{ -__gbcommon_encmap+18196,0,255},{__gbcommon_encmap+18452,0,255},{ -__gbcommon_encmap+18708,0,255},{__gbcommon_encmap+18964,0,255},{ -__gbcommon_encmap+19220,0,255},{__gbcommon_encmap+19476,0,255},{ -__gbcommon_encmap+19732,0,255},{__gbcommon_encmap+19988,0,255},{ -__gbcommon_encmap+20244,0,255},{__gbcommon_encmap+20500,0,255},{ -__gbcommon_encmap+20756,0,255},{__gbcommon_encmap+21012,0,255},{ -__gbcommon_encmap+21268,0,255},{__gbcommon_encmap+21524,0,255},{ -__gbcommon_encmap+21780,0,255},{__gbcommon_encmap+22036,0,255},{ -__gbcommon_encmap+22292,0,255},{__gbcommon_encmap+22548,0,165},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{__gbcommon_encmap+22714,44,241},{__gbcommon_encmap+22912,12,41},{0,0,0},{0, -0,0},{0,0,0},{__gbcommon_encmap+22942,48,107},{__gbcommon_encmap+23002,1,229}, -}; - -static const ucs2_t __gb18030ext_decmap[2729] = { -58566,58567,58568,58569,58570,58571,58572,58573,58574,58575,58576,58577,58578, -58579,58580,58581,58582,58583,58584,58585,58586,58587,58588,58589,58590,58591, -58592,58593,58594,58595,58596,58597,58598,58599,58600,58601,58602,58603,58604, -58605,58606,58607,58608,58609,58610,58611,58612,58613,58614,58615,58616,58617, -58618,58619,58620,58621,58622,58623,58624,58625,58626,58627,58628,U,58629, -58630,58631,58632,58633,58634,58635,58636,58637,58638,58639,58640,58641,58642, -58643,58644,58645,58646,58647,58648,58649,58650,58651,58652,58653,58654,58655, -58656,58657,58658,58659,58660,58661,58662,58663,58664,58665,58666,58667,58668, -58669,58670,58671,58672,58673,58674,58675,58676,58677,58678,58679,58680,58681, -58682,58683,58684,58685,58686,58687,58688,58689,58690,58691,58692,58693,58694, -58695,58696,58697,58698,58699,58700,58701,58702,58703,58704,58705,58706,58707, -58708,58709,58710,58711,58712,58713,58714,58715,58716,58717,58718,58719,58720, -58721,58722,58723,58724,U,58725,58726,58727,58728,58729,58730,58731,58732, -58733,58734,58735,58736,58737,58738,58739,58740,58741,58742,58743,58744,58745, -58746,58747,58748,58749,58750,58751,58752,58753,58754,58755,58756,58757,U,U,U, -U,U,U,U,U,U,U,59238,59239,59240,59241,59242,59243,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,8364, -59245,U,U,U,U,U,U,U,U,U,U,59246,59247,U,U,U,U,U,U,U,U,U,U,U,U,59248,59249, -58758,58759,58760,58761,58762,58763,58764,58765,58766,58767,58768,58769,58770, -58771,58772,58773,58774,58775,58776,58777,58778,58779,58780,58781,58782,58783, -58784,58785,58786,58787,58788,58789,58790,58791,58792,58793,58794,58795,58796, -58797,58798,58799,58800,58801,58802,58803,58804,58805,58806,58807,58808,58809, -58810,58811,58812,58813,58814,58815,58816,58817,58818,58819,58820,U,58821, -58822,58823,58824,58825,58826,58827,58828,58829,58830,58831,58832,58833,58834, -58835,58836,58837,58838,58839,58840,58841,58842,58843,58844,58845,58846,58847, -58848,58849,58850,58851,58852,58853,58854,58855,58856,58857,58858,58859,58860, -58861,58862,58863,58864,58865,58866,58867,58868,58869,58870,58871,58872,58873, -58874,58875,58876,58877,58878,58879,58880,58881,58882,58883,58884,58885,58886, -58887,58888,58889,58890,58891,58892,58893,58894,58895,58896,58897,58898,58899, -58900,58901,58902,58903,58904,58905,58906,58907,58908,58909,58910,58911,58912, -58913,58914,58915,58916,U,58917,58918,58919,58920,58921,58922,58923,58924, -58925,58926,58927,58928,58929,58930,58931,58932,58933,58934,58935,58936,58937, -58938,58939,58940,58941,58942,58943,58944,58945,58946,58947,58948,58949,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,59250,59251,59252,59253,59254,59255,59256,59257,59258,59259,59260,58950, -58951,58952,58953,58954,58955,58956,58957,58958,58959,58960,58961,58962,58963, -58964,58965,58966,58967,58968,58969,58970,58971,58972,58973,58974,58975,58976, -58977,58978,58979,58980,58981,58982,58983,58984,58985,58986,58987,58988,58989, -58990,58991,58992,58993,58994,58995,58996,58997,58998,58999,59000,59001,59002, -59003,59004,59005,59006,59007,59008,59009,59010,59011,59012,U,59013,59014, -59015,59016,59017,59018,59019,59020,59021,59022,59023,59024,59025,59026,59027, -59028,59029,59030,59031,59032,59033,59034,59035,59036,59037,59038,59039,59040, -59041,59042,59043,59044,59045,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,59261,59262,59263,59264,59265, -59266,59267,59268,59046,59047,59048,59049,59050,59051,59052,59053,59054,59055, -59056,59057,59058,59059,59060,59061,59062,59063,59064,59065,59066,59067,59068, -59069,59070,59071,59072,59073,59074,59075,59076,59077,59078,59079,59080,59081, -59082,59083,59084,59085,59086,59087,59088,59089,59090,59091,59092,59093,59094, -59095,59096,59097,59098,59099,59100,59101,59102,59103,59104,59105,59106,59107, -59108,U,59109,59110,59111,59112,59113,59114,59115,59116,59117,59118,59119, -59120,59121,59122,59123,59124,59125,59126,59127,59128,59129,59130,59131,59132, -59133,59134,59135,59136,59137,59138,59139,59140,59141,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,59269,59270,59271,59272,59273,59274,59275,59276,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,59277,59278,59279,59280,59281,59282, -59283,U,U,U,U,U,U,U,U,U,U,U,U,59284,59285,U,U,U,U,U,59286,U,U,59287,59288, -59289,59290,59291,59292,59293,59294,59295,59142,59143,59144,59145,59146,59147, -59148,59149,59150,59151,59152,59153,59154,59155,59156,59157,59158,59159,59160, -59161,59162,59163,59164,59165,59166,59167,59168,59169,59170,59171,59172,59173, -59174,59175,59176,59177,59178,59179,59180,59181,59182,59183,59184,59185,59186, -59187,59188,59189,59190,59191,59192,59193,59194,59195,59196,59197,59198,59199, -59200,59201,59202,59203,59204,U,59205,59206,59207,59208,59209,59210,59211, -59212,59213,59214,59215,59216,59217,59218,59219,59220,59221,59222,59223,59224, -59225,59226,59227,59228,59229,59230,59231,59232,59233,59234,59235,59236,59237, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,59296,59297, -59298,59299,59300,59301,59302,59303,59304,59305,59306,59307,59308,59309,59310, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,59311,59312, -59313,59314,59315,59316,59317,59318,59319,59320,59321,59322,59323,59324,59325, -59326,59327,59328,59329,59330,59331,59332,59333,59334,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,59335,U,U,505,U,59337,59338,59339,59340,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,59341,59342, -59343,59344,59345,59346,59347,59348,59349,59350,59351,59352,59353,59354,59355, -59356,59357,59358,59359,59360,59361,59362,U,U,59363,U,59364,59365,59366,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -12350,12272,12273,12274,12275,12276,12277,12278,12279,12280,12281,12282,12283, -U,59380,59381,59382,59383,59384,59385,59386,59387,59388,59389,59390,59391, -59392,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,59393,59394,59395,59396,59397,59398,59399,59400,59401,59402,59403,59404, -59405,59406,59407,57344,57345,57346,57347,57348,57349,57350,57351,57352,57353, -57354,57355,57356,57357,57358,57359,57360,57361,57362,57363,57364,57365,57366, -57367,57368,57369,57370,57371,57372,57373,57374,57375,57376,57377,57378,57379, -57380,57381,57382,57383,57384,57385,57386,57387,57388,57389,57390,57391,57392, -57393,57394,57395,57396,57397,57398,57399,57400,57401,57402,57403,57404,57405, -57406,57407,57408,57409,57410,57411,57412,57413,57414,57415,57416,57417,57418, -57419,57420,57421,57422,57423,57424,57425,57426,57427,57428,57429,57430,57431, -57432,57433,57434,57435,57436,57437,57438,57439,57440,57441,57442,57443,57444, -57445,57446,57447,57448,57449,57450,57451,57452,57453,57454,57455,57456,57457, -57458,57459,57460,57461,57462,57463,57464,57465,57466,57467,57468,57469,57470, -57471,57472,57473,57474,57475,57476,57477,57478,57479,57480,57481,57482,57483, -57484,57485,57486,57487,57488,57489,57490,57491,57492,57493,57494,57495,57496, -57497,57498,57499,57500,57501,57502,57503,57504,57505,57506,57507,57508,57509, -57510,57511,57512,57513,57514,57515,57516,57517,57518,57519,57520,57521,57522, -57523,57524,57525,57526,57527,57528,57529,57530,57531,57532,57533,57534,57535, -57536,57537,57538,57539,57540,57541,57542,57543,57544,57545,57546,57547,57548, -57549,57550,57551,57552,57553,57554,57555,57556,57557,57558,57559,57560,57561, -57562,57563,57564,57565,57566,57567,57568,57569,57570,57571,57572,57573,57574, -57575,57576,57577,57578,57579,57580,57581,57582,57583,57584,57585,57586,57587, -57588,57589,57590,57591,57592,57593,57594,57595,57596,57597,57598,57599,57600, -57601,57602,57603,57604,57605,57606,57607,57608,57609,57610,57611,57612,57613, -57614,57615,57616,57617,57618,57619,57620,57621,57622,57623,57624,57625,57626, -57627,57628,57629,57630,57631,57632,57633,57634,57635,57636,57637,57638,57639, -57640,57641,57642,57643,57644,57645,57646,57647,57648,57649,57650,57651,57652, -57653,57654,57655,57656,57657,57658,57659,57660,57661,57662,57663,57664,57665, -57666,57667,57668,57669,57670,57671,57672,57673,57674,57675,57676,57677,57678, -57679,57680,57681,57682,57683,57684,57685,57686,57687,57688,57689,57690,57691, -57692,57693,57694,57695,57696,57697,57698,57699,57700,57701,57702,57703,57704, -57705,57706,57707,57708,57709,57710,57711,57712,57713,57714,57715,57716,57717, -57718,57719,57720,57721,57722,57723,57724,57725,57726,57727,57728,57729,57730, -57731,57732,57733,57734,57735,57736,57737,57738,57739,57740,57741,57742,57743, -57744,57745,57746,57747,57748,57749,57750,57751,57752,57753,57754,57755,57756, -57757,57758,57759,57760,57761,57762,57763,57764,57765,57766,57767,57768,57769, -57770,57771,57772,57773,57774,57775,57776,57777,57778,57779,57780,57781,57782, -57783,57784,57785,57786,57787,57788,57789,57790,57791,57792,57793,57794,57795, -57796,57797,57798,57799,57800,57801,57802,57803,57804,57805,57806,57807,57808, -57809,57810,57811,57812,57813,57814,57815,57816,57817,57818,57819,57820,57821, -57822,57823,57824,57825,57826,57827,57828,57829,57830,57831,57832,57833,57834, -57835,57836,57837,57838,57839,57840,57841,57842,57843,57844,57845,57846,57847, -57848,57849,57850,57851,57852,57853,57854,57855,57856,57857,57858,57859,57860, -57861,57862,57863,57864,57865,57866,57867,57868,57869,57870,57871,57872,57873, -57874,57875,57876,57877,57878,57879,57880,57881,57882,57883,57884,57885,57886, -57887,57888,57889,57890,57891,57892,57893,57894,57895,57896,57897,57898,57899, -57900,57901,57902,57903,57904,57905,57906,57907,59408,59409,59410,59411,59412, -57908,57909,57910,57911,57912,57913,57914,57915,57916,57917,57918,57919,57920, -57921,57922,57923,57924,57925,57926,57927,57928,57929,57930,57931,57932,57933, -57934,57935,57936,57937,57938,57939,57940,57941,57942,57943,57944,57945,57946, -57947,57948,57949,57950,57951,57952,57953,57954,57955,57956,57957,57958,57959, -57960,57961,57962,57963,57964,57965,57966,57967,57968,57969,57970,57971,57972, -57973,57974,57975,57976,57977,57978,57979,57980,57981,57982,57983,57984,57985, -57986,57987,57988,57989,57990,57991,57992,57993,57994,57995,57996,57997,57998, -57999,58000,58001,58002,58003,58004,58005,58006,58007,58008,58009,58010,58011, -58012,58013,58014,58015,58016,58017,58018,58019,58020,58021,58022,58023,58024, -58025,58026,58027,58028,58029,58030,58031,58032,58033,58034,58035,58036,58037, -58038,58039,58040,58041,58042,58043,58044,58045,58046,58047,58048,58049,58050, -58051,58052,58053,58054,58055,58056,58057,58058,58059,58060,58061,58062,58063, -58064,58065,58066,58067,58068,58069,58070,58071,58072,58073,58074,58075,58076, -58077,58078,58079,58080,58081,58082,58083,58084,58085,58086,58087,58088,58089, -58090,58091,58092,58093,58094,58095,58096,58097,58098,58099,58100,58101,58102, -58103,58104,58105,58106,58107,58108,58109,58110,58111,58112,58113,58114,58115, -58116,58117,58118,58119,58120,58121,58122,58123,58124,58125,58126,58127,58128, -58129,58130,58131,58132,58133,58134,58135,58136,58137,58138,58139,58140,58141, -58142,58143,58144,58145,58146,58147,58148,58149,58150,58151,58152,58153,58154, -58155,58156,58157,58158,58159,58160,58161,58162,58163,58164,58165,58166,58167, -58168,58169,58170,58171,58172,58173,58174,58175,58176,58177,58178,58179,58180, -58181,58182,58183,58184,58185,58186,58187,58188,58189,58190,58191,58192,58193, -58194,58195,58196,58197,58198,58199,58200,58201,58202,58203,58204,58205,58206, -58207,58208,58209,58210,58211,58212,58213,58214,58215,58216,58217,58218,58219, -58220,58221,58222,58223,58224,58225,58226,58227,58228,58229,58230,58231,58232, -58233,58234,58235,58236,58237,58238,58239,58240,58241,58242,58243,58244,58245, -58246,58247,58248,58249,58250,58251,58252,58253,58254,58255,58256,58257,58258, -58259,58260,58261,58262,58263,58264,58265,58266,58267,58268,58269,58270,58271, -58272,58273,58274,58275,58276,58277,58278,58279,58280,58281,58282,58283,58284, -58285,58286,58287,58288,58289,58290,58291,58292,58293,58294,58295,58296,58297, -58298,58299,58300,58301,58302,58303,58304,58305,58306,58307,58308,58309,58310, -58311,58312,58313,58314,58315,58316,58317,58318,58319,58320,58321,58322,58323, -58324,58325,58326,58327,58328,58329,58330,58331,58332,58333,58334,58335,58336, -58337,58338,58339,58340,58341,58342,58343,58344,58345,58346,58347,58348,58349, -58350,58351,58352,58353,58354,58355,58356,58357,58358,58359,58360,58361,58362, -58363,58364,58365,58366,58367,58368,58369,58370,58371,58372,58373,58374,58375, -58376,58377,58378,58379,58380,58381,58382,58383,58384,58385,58386,58387,58388, -58389,58390,58391,58392,58393,58394,58395,58396,58397,58398,58399,58400,58401, -58402,58403,58404,58405,58406,58407,58408,58409,58410,58411,58412,58413,58414, -58415,58416,58417,58418,58419,58420,58421,58422,58423,58424,58425,58426,58427, -58428,58429,58430,58431,58432,58433,58434,58435,58436,58437,58438,58439,58440, -58441,58442,58443,58444,58445,58446,58447,58448,58449,58450,58451,58452,58453, -58454,58455,58456,58457,58458,58459,58460,58461,58462,58463,58464,58465,58466, -58467,58468,58469,58470,58471,11905,59414,59415,59416,11908,13427,13383,11912, -11915,59422,13726,13850,13838,11916,11927,14702,14616,59430,14799,14815,14963, -14800,59435,59436,15182,15470,15584,11943,59441,59442,11946,16470,16735,11950, -17207,11955,11958,11959,59451,17329,17324,11963,17373,17622,18017,17996,59459, -U,18211,18217,18300,18317,11978,18759,18810,18813,18818,18819,18821,18822, -18847,18843,18871,18870,59476,59477,19619,19615,19616,19617,19575,19618,19731, -19732,19733,19734,19735,19736,19737,19886,59492,58472,58473,58474,58475,58476, -58477,58478,58479,58480,58481,58482,58483,58484,58485,58486,58487,58488,58489, -58490,58491,58492,58493,58494,58495,58496,58497,58498,58499,58500,58501,58502, -58503,58504,58505,58506,58507,58508,58509,58510,58511,58512,58513,58514,58515, -58516,58517,58518,58519,58520,58521,58522,58523,58524,58525,58526,58527,58528, -58529,58530,58531,58532,58533,58534,58535,58536,58537,58538,58539,58540,58541, -58542,58543,58544,58545,58546,58547,58548,58549,58550,58551,58552,58553,58554, -58555,58556,58557,58558,58559,58560,58561,58562,58563,58564,58565, -}; - -static const struct dbcs_index gb18030ext_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gb18030ext_decmap+0,64, -160},{__gb18030ext_decmap+97,64,254},{__gb18030ext_decmap+288,64,160},{ -__gb18030ext_decmap+385,64,254},{__gb18030ext_decmap+576,64,254},{ -__gb18030ext_decmap+767,64,254},{__gb18030ext_decmap+958,64,254},{ -__gb18030ext_decmap+1149,150,254},{__gb18030ext_decmap+1254,88,254},{ -__gb18030ext_decmap+1421,161,254},{__gb18030ext_decmap+1515,161,254},{ -__gb18030ext_decmap+1609,161,254},{__gb18030ext_decmap+1703,161,254},{ -__gb18030ext_decmap+1797,161,254},{__gb18030ext_decmap+1891,161,254},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__gb18030ext_decmap+1985,250,254},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gb18030ext_decmap -+1990,161,254},{__gb18030ext_decmap+2084,161,254},{__gb18030ext_decmap+2178, -161,254},{__gb18030ext_decmap+2272,161,254},{__gb18030ext_decmap+2366,161,254 -},{__gb18030ext_decmap+2460,161,254},{__gb18030ext_decmap+2554,80,254},{0,0,0 -}, -}; - -static const DBCHAR __gb18030ext_encmap[3227] = { -43199,41699,65104,N,N,65108,N,N,N,65111,N,N,65112,65117,N,N,N,N,N,N,N,N,N,N, -65118,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65131,N,N,65134,N,N,N,65137,N,N,N,N,65139, -N,N,65140,65141,N,N,N,65145,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65156,43402,43403, -43404,43405,43406,43407,43408,43409,43410,43411,43412,43413,43401,65110,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,65109,65114,65116,N,N,N,N,N,N,N,N,N,N,N,65115,65120,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65119,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65122,65125,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65123, -65124,65128,65129,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,65130,65135,65136,65138,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65144,N,N,N,N,65143,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65146,65147,65149, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65148,65152,N,N,N,N,N,65153,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -65154,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65155,65157,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65158, -N,N,65159,N,N,N,N,65160,65161,N,65162,65163,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,65165,N,N,N,65164,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65167, -65166,65174,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,65171,65172,65173,65175,65170,65176,65177,65178,65179,65180,65181, -65182,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65183, -43681,43682,43683,43684,43685,43686,43687,43688,43689,43690,43691,43692,43693, -43694,43695,43696,43697,43698,43699,43700,43701,43702,43703,43704,43705,43706, -43707,43708,43709,43710,43711,43712,43713,43714,43715,43716,43717,43718,43719, -43720,43721,43722,43723,43724,43725,43726,43727,43728,43729,43730,43731,43732, -43733,43734,43735,43736,43737,43738,43739,43740,43741,43742,43743,43744,43745, -43746,43747,43748,43749,43750,43751,43752,43753,43754,43755,43756,43757,43758, -43759,43760,43761,43762,43763,43764,43765,43766,43767,43768,43769,43770,43771, -43772,43773,43774,43937,43938,43939,43940,43941,43942,43943,43944,43945,43946, -43947,43948,43949,43950,43951,43952,43953,43954,43955,43956,43957,43958,43959, -43960,43961,43962,43963,43964,43965,43966,43967,43968,43969,43970,43971,43972, -43973,43974,43975,43976,43977,43978,43979,43980,43981,43982,43983,43984,43985, -43986,43987,43988,43989,43990,43991,43992,43993,43994,43995,43996,43997,43998, -43999,44000,44001,44002,44003,44004,44005,44006,44007,44008,44009,44010,44011, -44012,44013,44014,44015,44016,44017,44018,44019,44020,44021,44022,44023,44024, -44025,44026,44027,44028,44029,44030,44193,44194,44195,44196,44197,44198,44199, -44200,44201,44202,44203,44204,44205,44206,44207,44208,44209,44210,44211,44212, -44213,44214,44215,44216,44217,44218,44219,44220,44221,44222,44223,44224,44225, -44226,44227,44228,44229,44230,44231,44232,44233,44234,44235,44236,44237,44238, -44239,44240,44241,44242,44243,44244,44245,44246,44247,44248,44249,44250,44251, -44252,44253,44254,44255,44256,44257,44258,44259,44260,44261,44262,44263,44264, -44265,44266,44267,44268,44269,44270,44271,44272,44273,44274,44275,44276,44277, -44278,44279,44280,44281,44282,44283,44284,44285,44286,44449,44450,44451,44452, -44453,44454,44455,44456,44457,44458,44459,44460,44461,44462,44463,44464,44465, -44466,44467,44468,44469,44470,44471,44472,44473,44474,44475,44476,44477,44478, -44479,44480,44481,44482,44483,44484,44485,44486,44487,44488,44489,44490,44491, -44492,44493,44494,44495,44496,44497,44498,44499,44500,44501,44502,44503,44504, -44505,44506,44507,44508,44509,44510,44511,44512,44513,44514,44515,44516,44517, -44518,44519,44520,44521,44522,44523,44524,44525,44526,44527,44528,44529,44530, -44531,44532,44533,44534,44535,44536,44537,44538,44539,44540,44541,44542,44705, -44706,44707,44708,44709,44710,44711,44712,44713,44714,44715,44716,44717,44718, -44719,44720,44721,44722,44723,44724,44725,44726,44727,44728,44729,44730,44731, -44732,44733,44734,44735,44736,44737,44738,44739,44740,44741,44742,44743,44744, -44745,44746,44747,44748,44749,44750,44751,44752,44753,44754,44755,44756,44757, -44758,44759,44760,44761,44762,44763,44764,44765,44766,44767,44768,44769,44770, -44771,44772,44773,44774,44775,44776,44777,44778,44779,44780,44781,44782,44783, -44784,44785,44786,44787,44788,44789,44790,44791,44792,44793,44794,44795,44796, -44797,44798,44961,44962,44963,44964,44965,44966,44967,44968,44969,44970,44971, -44972,44973,44974,44975,44976,44977,44978,44979,44980,44981,44982,44983,44984, -44985,44986,44987,44988,44989,44990,44991,44992,44993,44994,44995,44996,44997, -44998,44999,45000,45001,45002,45003,45004,45005,45006,45007,45008,45009,45010, -45011,45012,45013,45014,45015,45016,45017,45018,45019,45020,45021,45022,45023, -45024,45025,45026,45027,45028,45029,45030,45031,45032,45033,45034,45035,45036, -45037,45038,45039,45040,45041,45042,45043,45044,45045,45046,45047,45048,45049, -45050,45051,45052,45053,45054,63649,63650,63651,63652,63653,63654,63655,63656, -63657,63658,63659,63660,63661,63662,63663,63664,63665,63666,63667,63668,63669, -63670,63671,63672,63673,63674,63675,63676,63677,63678,63679,63680,63681,63682, -63683,63684,63685,63686,63687,63688,63689,63690,63691,63692,63693,63694,63695, -63696,63697,63698,63699,63700,63701,63702,63703,63704,63705,63706,63707,63708, -63709,63710,63711,63712,63713,63714,63715,63716,63717,63718,63719,63720,63721, -63722,63723,63724,63725,63726,63727,63728,63729,63730,63731,63732,63733,63734, -63735,63736,63737,63738,63739,63740,63741,63742,63905,63906,63907,63908,63909, -63910,63911,63912,63913,63914,63915,63916,63917,63918,63919,63920,63921,63922, -63923,63924,63925,63926,63927,63928,63929,63930,63931,63932,63933,63934,63935, -63936,63937,63938,63939,63940,63941,63942,63943,63944,63945,63946,63947,63948, -63949,63950,63951,63952,63953,63954,63955,63956,63957,63958,63959,63960,63961, -63962,63963,63964,63965,63966,63967,63968,63969,63970,63971,63972,63973,63974, -63975,63976,63977,63978,63979,63980,63981,63982,63983,63984,63985,63986,63987, -63988,63989,63990,63991,63992,63993,63994,63995,63996,63997,63998,64161,64162, -64163,64164,64165,64166,64167,64168,64169,64170,64171,64172,64173,64174,64175, -64176,64177,64178,64179,64180,64181,64182,64183,64184,64185,64186,64187,64188, -64189,64190,64191,64192,64193,64194,64195,64196,64197,64198,64199,64200,64201, -64202,64203,64204,64205,64206,64207,64208,64209,64210,64211,64212,64213,64214, -64215,64216,64217,64218,64219,64220,64221,64222,64223,64224,64225,64226,64227, -64228,64229,64230,64231,64232,64233,64234,64235,64236,64237,64238,64239,64240, -64241,64242,64243,64244,64245,64246,64247,64248,64249,64250,64251,64252,64253, -64254,64417,64418,64419,64420,64421,64422,64423,64424,64425,64426,64427,64428, -64429,64430,64431,64432,64433,64434,64435,64436,64437,64438,64439,64440,64441, -64442,64443,64444,64445,64446,64447,64448,64449,64450,64451,64452,64453,64454, -64455,64456,64457,64458,64459,64460,64461,64462,64463,64464,64465,64466,64467, -64468,64469,64470,64471,64472,64473,64474,64475,64476,64477,64478,64479,64480, -64481,64482,64483,64484,64485,64486,64487,64488,64489,64490,64491,64492,64493, -64494,64495,64496,64497,64498,64499,64500,64501,64502,64503,64504,64505,64506, -64507,64508,64509,64510,64673,64674,64675,64676,64677,64678,64679,64680,64681, -64682,64683,64684,64685,64686,64687,64688,64689,64690,64691,64692,64693,64694, -64695,64696,64697,64698,64699,64700,64701,64702,64703,64704,64705,64706,64707, -64708,64709,64710,64711,64712,64713,64714,64715,64716,64717,64718,64719,64720, -64721,64722,64723,64724,64725,64726,64727,64728,64729,64730,64731,64732,64733, -64734,64735,64736,64737,64738,64739,64740,64741,64742,64743,64744,64745,64746, -64747,64748,64749,64750,64751,64752,64753,64754,64755,64756,64757,64758,64759, -64760,64761,64762,64763,64764,64765,64766,64929,64930,64931,64932,64933,64934, -64935,64936,64937,64938,64939,64940,64941,64942,64943,64944,64945,64946,64947, -64948,64949,64950,64951,64952,64953,64954,64955,64956,64957,64958,64959,64960, -64961,64962,64963,64964,64965,64966,64967,64968,64969,64970,64971,64972,64973, -64974,64975,64976,64977,64978,64979,64980,64981,64982,64983,64984,64985,64986, -64987,64988,64989,64990,64991,64992,64993,64994,64995,64996,64997,64998,64999, -65000,65001,65002,65003,65004,65005,65006,65007,65008,65009,65010,65011,65012, -65013,65014,65015,65016,65017,65018,65019,65020,65021,65022,65185,65186,65187, -65188,65189,65190,65191,65192,65193,65194,65195,65196,65197,65198,65199,65200, -65201,65202,65203,65204,65205,65206,65207,65208,65209,65210,65211,65212,65213, -65214,65215,65216,65217,65218,65219,65220,65221,65222,65223,65224,65225,65226, -65227,65228,65229,65230,65231,65232,65233,65234,65235,65236,65237,65238,65239, -65240,65241,65242,65243,65244,65245,65246,65247,65248,65249,65250,65251,65252, -65253,65254,65255,65256,65257,65258,65259,65260,65261,65262,65263,65264,65265, -65266,65267,65268,65269,65270,65271,65272,65273,65274,65275,65276,65277,65278, -41280,41281,41282,41283,41284,41285,41286,41287,41288,41289,41290,41291,41292, -41293,41294,41295,41296,41297,41298,41299,41300,41301,41302,41303,41304,41305, -41306,41307,41308,41309,41310,41311,41312,41313,41314,41315,41316,41317,41318, -41319,41320,41321,41322,41323,41324,41325,41326,41327,41328,41329,41330,41331, -41332,41333,41334,41335,41336,41337,41338,41339,41340,41341,41342,41344,41345, -41346,41347,41348,41349,41350,41351,41352,41353,41354,41355,41356,41357,41358, -41359,41360,41361,41362,41363,41364,41365,41366,41367,41368,41369,41370,41371, -41372,41373,41374,41375,41376,41536,41537,41538,41539,41540,41541,41542,41543, -41544,41545,41546,41547,41548,41549,41550,41551,41552,41553,41554,41555,41556, -41557,41558,41559,41560,41561,41562,41563,41564,41565,41566,41567,41568,41569, -41570,41571,41572,41573,41574,41575,41576,41577,41578,41579,41580,41581,41582, -41583,41584,41585,41586,41587,41588,41589,41590,41591,41592,41593,41594,41595, -41596,41597,41598,41600,41601,41602,41603,41604,41605,41606,41607,41608,41609, -41610,41611,41612,41613,41614,41615,41616,41617,41618,41619,41620,41621,41622, -41623,41624,41625,41626,41627,41628,41629,41630,41631,41632,41792,41793,41794, -41795,41796,41797,41798,41799,41800,41801,41802,41803,41804,41805,41806,41807, -41808,41809,41810,41811,41812,41813,41814,41815,41816,41817,41818,41819,41820, -41821,41822,41823,41824,41825,41826,41827,41828,41829,41830,41831,41832,41833, -41834,41835,41836,41837,41838,41839,41840,41841,41842,41843,41844,41845,41846, -41847,41848,41849,41850,41851,41852,41853,41854,41856,41857,41858,41859,41860, -41861,41862,41863,41864,41865,41866,41867,41868,41869,41870,41871,41872,41873, -41874,41875,41876,41877,41878,41879,41880,41881,41882,41883,41884,41885,41886, -41887,41888,42048,42049,42050,42051,42052,42053,42054,42055,42056,42057,42058, -42059,42060,42061,42062,42063,42064,42065,42066,42067,42068,42069,42070,42071, -42072,42073,42074,42075,42076,42077,42078,42079,42080,42081,42082,42083,42084, -42085,42086,42087,42088,42089,42090,42091,42092,42093,42094,42095,42096,42097, -42098,42099,42100,42101,42102,42103,42104,42105,42106,42107,42108,42109,42110, -42112,42113,42114,42115,42116,42117,42118,42119,42120,42121,42122,42123,42124, -42125,42126,42127,42128,42129,42130,42131,42132,42133,42134,42135,42136,42137, -42138,42139,42140,42141,42142,42143,42144,42304,42305,42306,42307,42308,42309, -42310,42311,42312,42313,42314,42315,42316,42317,42318,42319,42320,42321,42322, -42323,42324,42325,42326,42327,42328,42329,42330,42331,42332,42333,42334,42335, -42336,42337,42338,42339,42340,42341,42342,42343,42344,42345,42346,42347,42348, -42349,42350,42351,42352,42353,42354,42355,42356,42357,42358,42359,42360,42361, -42362,42363,42364,42365,42366,42368,42369,42370,42371,42372,42373,42374,42375, -42376,42377,42378,42379,42380,42381,42382,42383,42384,42385,42386,42387,42388, -42389,42390,42391,42392,42393,42394,42395,42396,42397,42398,42399,42400,42560, -42561,42562,42563,42564,42565,42566,42567,42568,42569,42570,42571,42572,42573, -42574,42575,42576,42577,42578,42579,42580,42581,42582,42583,42584,42585,42586, -42587,42588,42589,42590,42591,42592,42593,42594,42595,42596,42597,42598,42599, -42600,42601,42602,42603,42604,42605,42606,42607,42608,42609,42610,42611,42612, -42613,42614,42615,42616,42617,42618,42619,42620,42621,42622,42624,42625,42626, -42627,42628,42629,42630,42631,42632,42633,42634,42635,42636,42637,42638,42639, -42640,42641,42642,42643,42644,42645,42646,42647,42648,42649,42650,42651,42652, -42653,42654,42655,42656,42816,42817,42818,42819,42820,42821,42822,42823,42824, -42825,42826,42827,42828,42829,42830,42831,42832,42833,42834,42835,42836,42837, -42838,42839,42840,42841,42842,42843,42844,42845,42846,42847,42848,42849,42850, -42851,42852,42853,42854,42855,42856,42857,42858,42859,42860,42861,42862,42863, -42864,42865,42866,42867,42868,42869,42870,42871,42872,42873,42874,42875,42876, -42877,42878,42880,42881,42882,42883,42884,42885,42886,42887,42888,42889,42890, -42891,42892,42893,42894,42895,42896,42897,42898,42899,42900,42901,42902,42903, -42904,42905,42906,42907,42908,42909,42910,42911,42912,41643,41644,41645,41646, -41647,41648,N,41700,41711,41712,41725,41726,42228,42229,42230,42231,42232, -42233,42234,42235,42236,42237,42238,42487,42488,42489,42490,42491,42492,42493, -42494,42681,42682,42683,42684,42685,42686,42687,42688,42713,42714,42715,42716, -42717,42718,42719,42732,42733,42739,42742,42743,42744,42745,42746,42747,42748, -42749,42750,42946,42947,42948,42949,42950,42951,42952,42953,42954,42955,42956, -42957,42958,42959,42960,42994,42995,42996,42997,42998,42999,43000,43001,43002, -43003,43004,43005,43006,43158,43159,43160,43161,43162,43163,43164,43165,43166, -43167,43168,43196,N,43201,43202,43203,43204,43242,43243,43244,43245,43246, -43247,43248,43249,43250,43251,43252,43253,43254,43255,43256,43257,43258,43259, -43260,43261,43262,43352,43355,43357,43358,43359,N,N,N,N,N,N,N,N,N,N,N,N,N, -43415,43416,43417,43418,43419,43420,43421,43422,43423,43424,43425,43426,43427, -43504,43505,43506,43507,43508,43509,43510,43511,43512,43513,43514,43515,43516, -43517,43518,55290,55291,55292,55293,55294,N,65105,65106,65107,N,N,N,N,N,65113, -N,N,N,N,N,N,N,65121,N,N,N,N,65126,65127,N,N,N,N,65132,65133,N,N,N,N,N,N,N,N, -65142,N,N,N,N,N,N,N,65150,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65168,65169,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,65184, -}; - -static const struct unim_index gb18030ext_encmap[256] = { -{0,0,0},{__gb18030ext_encmap+0,249,249},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__gb18030ext_encmap+1,172,172 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{__gb18030ext_encmap+2,129,202},{ -__gb18030ext_encmap+76,240,251},{__gb18030ext_encmap+88,62,62},{0,0,0},{0,0,0 -},{0,0,0},{__gb18030ext_encmap+89,71,115},{__gb18030ext_encmap+134,158,158},{ -__gb18030ext_encmap+135,14,26},{0,0,0},{0,0,0},{__gb18030ext_encmap+148,24,223 -},{__gb18030ext_encmap+348,115,115},{__gb18030ext_encmap+349,78,78},{ -__gb18030ext_encmap+350,110,224},{0,0,0},{0,0,0},{0,0,0},{__gb18030ext_encmap+ -465,86,86},{__gb18030ext_encmap+466,95,95},{0,0,0},{__gb18030ext_encmap+467, -55,221},{__gb18030ext_encmap+634,214,214},{0,0,0},{__gb18030ext_encmap+635,76, -97},{__gb18030ext_encmap+657,35,141},{0,0,0},{__gb18030ext_encmap+764,71,183}, -{0,0,0},{0,0,0},{__gb18030ext_encmap+877,119,163},{__gb18030ext_encmap+922,19, -174},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{__gb18030ext_encmap+1078,0,255},{__gb18030ext_encmap+1334,0,255 -},{__gb18030ext_encmap+1590,0,255},{__gb18030ext_encmap+1846,0,255},{ -__gb18030ext_encmap+2102,0,255},{__gb18030ext_encmap+2358,0,255},{ -__gb18030ext_encmap+2614,0,255},{__gb18030ext_encmap+2870,0,255},{ -__gb18030ext_encmap+3126,0,100},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - - -static const struct _gb18030_to_unibmp_ranges { - Py_UNICODE first, last; - DBCHAR base; -} gb18030_to_unibmp_ranges[] = { -{128,163,0},{165,166,36},{169,175,38},{178,182,45},{184,214,50},{216,223,81},{ -226,231,89},{235,235,95},{238,241,96},{244,246,100},{248,248,103},{251,251,104 -},{253,256,105},{258,274,109},{276,282,126},{284,298,133},{300,323,148},{325, -327,172},{329,332,175},{334,362,179},{364,461,208},{463,463,306},{465,465,307 -},{467,467,308},{469,469,309},{471,471,310},{473,473,311},{475,475,312},{477, -504,313},{506,592,341},{594,608,428},{610,710,443},{712,712,544},{716,728,545 -},{730,912,558},{930,930,741},{938,944,742},{962,962,749},{970,1024,750},{1026 -,1039,805},{1104,1104,819},{1106,8207,820},{8209,8210,7922},{8215,8215,7924},{ -8218,8219,7925},{8222,8228,7927},{8231,8239,7934},{8241,8241,7943},{8244,8244, -7944},{8246,8250,7945},{8252,8363,7950},{8365,8450,8062},{8452,8452,8148},{ -8454,8456,8149},{8458,8469,8152},{8471,8480,8164},{8482,8543,8174},{8556,8559, -8236},{8570,8591,8240},{8596,8597,8262},{8602,8711,8264},{8713,8718,8374},{ -8720,8720,8380},{8722,8724,8381},{8726,8729,8384},{8731,8732,8388},{8737,8738, -8390},{8740,8740,8392},{8742,8742,8393},{8748,8749,8394},{8751,8755,8396},{ -8760,8764,8401},{8766,8775,8406},{8777,8779,8416},{8781,8785,8419},{8787,8799, -8424},{8802,8803,8437},{8808,8813,8439},{8816,8852,8445},{8854,8856,8482},{ -8858,8868,8485},{8870,8894,8496},{8896,8977,8521},{8979,9311,8603},{9322,9331, -8936},{9372,9471,8946},{9548,9551,9046},{9588,9600,9050},{9616,9618,9063},{ -9622,9631,9066},{9634,9649,9076},{9652,9659,9092},{9662,9669,9100},{9672,9674, -9108},{9676,9677,9111},{9680,9697,9113},{9702,9732,9131},{9735,9736,9162},{ -9738,9791,9164},{9793,9793,9218},{9795,11904,9219},{11906,11907,11329},{11909, -11911,11331},{11913,11914,11334},{11917,11926,11336},{11928,11942,11346},{ -11944,11945,11361},{11947,11949,11363},{11951,11954,11366},{11956,11957,11370 -},{11960,11962,11372},{11964,11977,11375},{11979,12271,11389},{12284,12287, -11682},{12292,12292,11686},{12312,12316,11687},{12319,12320,11692},{12330, -12349,11694},{12351,12352,11714},{12436,12442,11716},{12447,12448,11723},{ -12535,12539,11725},{12543,12548,11730},{12586,12831,11736},{12842,12848,11982 -},{12850,12962,11989},{12964,13197,12102},{13200,13211,12336},{13215,13216, -12348},{13218,13251,12350},{13253,13261,12384},{13263,13264,12393},{13267, -13268,12395},{13270,13382,12397},{13384,13426,12510},{13428,13725,12553},{ -13727,13837,12851},{13839,13849,12962},{13851,14615,12973},{14617,14701,13738 -},{14703,14798,13823},{14801,14814,13919},{14816,14962,13933},{14964,15181, -14080},{15183,15469,14298},{15471,15583,14585},{15585,16469,14698},{16471, -16734,15583},{16736,17206,15847},{17208,17323,16318},{17325,17328,16434},{ -17330,17372,16438},{17374,17621,16481},{17623,17995,16729},{17997,18016,17102 -},{18018,18210,17122},{18212,18216,17315},{18218,18299,17320},{18301,18316, -17402},{18318,18758,17418},{18760,18809,17859},{18811,18812,17909},{18814, -18817,17911},{18820,18820,17915},{18823,18842,17916},{18844,18846,17936},{ -18848,18869,17939},{18872,19574,17961},{19576,19614,18664},{19620,19730,18703 -},{19738,19885,18814},{19887,19967,18962},{40870,55295,19043},{59244,59244, -33469},{59336,59336,33470},{59367,59379,33471},{59413,59413,33484},{59417, -59421,33485},{59423,59429,33490},{59431,59434,33497},{59437,59440,33501},{ -59443,59450,33505},{59452,59458,33513},{59460,59475,33520},{59478,59491,33536 -},{59493,63787,33550},{63789,63864,37845},{63866,63892,37921},{63894,63974, -37948},{63976,63984,38029},{63986,64011,38038},{64016,64016,38064},{64018, -64018,38065},{64021,64023,38066},{64025,64030,38069},{64034,64034,38075},{ -64037,64038,38076},{64042,65071,38078},{65074,65074,39108},{65093,65096,39109 -},{65107,65107,39113},{65112,65112,39114},{65127,65127,39115},{65132,65280, -39116},{65375,65503,39265},{65510,65535,39394},{0,0,39420}}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_hk.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_hk.h deleted file mode 100644 index 3a7c76c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_hk.h +++ /dev/null @@ -1,2378 +0,0 @@ -static const ucs2_t __big5hkscs_decmap[6219] = { -17392,19506,17923,17830,17784,29287,19831,17843,31921,19682,31941,15253,18230, -18244,19527,19520,17087,13847,29522,28299,28882,19543,41809,18255,17882,19589, -31852,19719,19108,18081,27427,29221,23124,6755,15878,16225,26189,22267,U, -32149,22813,35769,15860,38708,31727,23515,7518,23204,13861,40624,23249,23479, -23804,26478,34195,39237,29793,29853,12736,12737,12738,12739,12740,268,12741, -209,205,12742,12743,203,8168,12744,202,12745,12746,12747,12748,270,12749, -12750,256,193,461,192,274,201,282,200,332,211,465,210,U,7870,U,7872,202,257, -225,462,224,593,275,233,283,232,299,237,464,236,333,243,466,242,363,250,468, -249,470,472,474,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,476,252,U,7871,U,7873,234,609,9178,9179,41897,4421,U,25866,U,U,20029, -28381,40270,37343,U,U,30517,25745,20250,20264,20392,20822,20852,20892,20964, -21153,21160,21307,21326,21457,21464,22242,22768,22788,22791,22834,22836,23398, -23454,23455,23706,24198,24635,25993,26622,26628,26725,27982,28860,30005,32420, -32428,32442,32455,32463,32479,32518,32567,33402,33487,33647,35270,35774,35810, -36710,36711,36718,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,29713,31996,32205,26950,31433,21031,U,U,U,U,37260,30904,37214,32956,U, -36107,33014,2535,U,U,32927,40647,19661,40393,40460,19518,40438,28686,40458, -41267,13761,U,28314,33342,29977,U,18705,39532,39567,40857,31111,33900,7626, -1488,10982,20004,20097,20096,20103,20159,20203,20279,13388,20413,15944,20483, -20616,13437,13459,13477,20870,22789,20955,20988,20997,20105,21113,21136,21287, -13767,21417,13649,21424,13651,21442,21539,13677,13682,13953,21651,21667,21684, -21689,21712,21743,21784,21795,21800,13720,21823,13733,13759,21975,13765,32132, -21797,U,3138,3349,20779,21904,11462,14828,833,36422,19896,38117,16467,32958, -30586,11320,14900,18389,33117,27122,19946,25821,3452,4020,3285,4340,25741, -36478,3734,3083,3940,11433,33366,17619,U,3398,39501,33001,18420,20135,11458, -39602,14951,38388,16365,13574,21191,38868,30920,11588,40302,38933,U,17369, -24741,25780,21731,11596,11210,4215,14843,4207,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,26330,26390,31136,25834,20562,3139,36456, -8609,35660,1841,U,18443,425,16378,22643,11661,U,17864,1276,24727,3916,3478, -21881,16571,17338,U,19124,10854,4253,33194,39157,3484,25465,14846,10101,36288, -22177,25724,15939,U,42497,3593,10959,11465,U,4296,14786,14738,14854,33435, -13688,24137,8391,22098,3889,11442,38688,13500,27709,20027,U,U,30068,11915, -8712,42587,36045,3706,3124,26652,32659,4303,10243,10553,13819,20963,3724,3981, -3754,16275,3888,3399,4431,3660,U,3755,2985,3400,4288,4413,16377,9878,25650, -4013,13300,30265,11214,3454,3455,11345,11349,14872,3736,4295,3886,42546,27472, -36050,36249,36042,38314,21708,33476,21945,U,40643,39974,39606,30558,11758, -28992,33133,33004,23580,25970,33076,14231,21343,32957,37302,3834,3599,3703, -3835,13789,19947,13833,3286,22191,10165,4297,3600,3704,4216,4424,33287,5205, -3705,20048,11684,23124,4125,4126,4341,4342,22428,3601,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30356,33485,4021,3707,20862,14083, -4022,4480,21208,41661,18906,6202,16759,33404,22681,21096,13850,22333,31666, -23400,18432,19244,40743,18919,39967,39821,23412,12605,22011,13810,22153,20008, -22786,7105,63608,38737,134,20059,20155,13630,23587,24401,24516,14586,25164, -25909,27514,27701,27706,28780,29227,20012,29357,18665,32594,31035,31993,32595, -25194,13505,U,25419,32770,32896,26130,26961,21341,34916,35265,30898,35744, -36125,38021,38264,38271,38376,36367,38886,39029,39118,39134,39267,38928,40060, -40479,40644,27503,63751,20023,135,38429,25143,38050,20539,28158,40051,40870, -15817,34959,16718,28791,23797,19232,20941,13657,23856,24866,35378,36775,37366, -29073,26393,29626,12929,41223,15499,6528,19216,30948,29698,20910,34575,16393, -27235,41658,16931,34319,2671,31274,39239,35562,38741,28749,21284,8318,37876, -30425,35299,40871,30685,20131,20464,20668,20015,20247,40872,21556,32139,22674, -22736,7606,24210,24217,24514,10002,25995,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13305,26905,27203,15459,27903,U,29184,17669, -29580,16091,18963,23317,29881,35715,23716,22165,31379,31724,31939,32364,33528, -34199,40873,34960,40874,36537,40875,36815,34143,39392,37409,40876,36281,5183, -16497,17058,23066,U,U,U,39016,26475,17014,22333,U,34262,18811,33471,28941, -19585,28020,23931,27413,28606,40877,40878,23446,40879,26343,32347,28247,31178, -15752,17603,12886,10134,17306,17718,U,23765,15130,35577,23672,15634,13649, -23928,40882,29015,17752,16620,7715,19575,14712,13386,420,27713,35532,20404, -569,22975,33132,38998,39162,24379,2975,U,8641,35181,16642,18107,36985,16135, -40883,41397,16632,14294,18167,27718,16764,34482,29695,17773,14548,21658,17761, -17691,19849,19579,19830,17898,16328,19215,13921,17630,17597,16877,23870,23880, -23894,15868,14351,23972,23993,14368,14392,24130,24253,24357,24451,14600,14612, -14655,14669,24791,24893,23781,14729,25015,25017,25039,14776,25132,25232,25317, -25368,14840,22193,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,14851,25570,25595,25607,25690,14923,25792,23829,22049,40863,14999, -25990,15037,26111,26195,15090,26258,15138,26390,15170,26532,26624,15192,26698, -26756,15218,15217,15227,26889,26947,29276,26980,27039,27013,15292,27094,15325, -27237,27252,27249,27266,15340,27289,15346,27307,27317,27348,27382,27521,27585, -27626,27765,27818,15563,27906,27910,27942,28033,15599,28068,28081,28181,28184, -28201,28294,35264,28347,28386,28378,40831,28392,28393,28452,28468,15686,16193, -28545,28606,15722,15733,29111,23705,15754,28716,15761,28752,28756,28783,28799, -28809,805,17345,13809,3800,16087,22462,28371,28990,22496,13902,27042,35817, -23412,31305,22753,38105,31333,31357,22956,31419,31408,31426,31427,29137,25741, -16842,31450,31453,31466,16879,21682,23553,31499,31573,31529,21262,23806,31650, -31599,33692,23476,27775,31696,33825,31634,U,23840,15789,23653,33938,31738,U, -31797,23745,31812,31875,18562,31910,26237,17784,31945,31943,31974,31860,31987, -31989,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -32359,17693,28228,32093,28374,29837,32137,32171,28981,32179,U,16471,24617, -32228,15635,32245,6137,32229,33645,U,24865,24922,32366,32402,17195,37996, -32295,32576,32577,32583,31030,25296,39393,32663,25425,32675,5729,104,17756, -14182,17667,33594,32762,25737,U,32776,32797,U,32815,41095,27843,32827,32828, -32865,10004,18825,26150,15843,26344,26405,32935,35400,33031,33050,22704,9974, -27775,25752,20408,25831,5258,33304,6238,27219,19045,19093,17530,33321,2829, -27218,15742,20473,5373,34018,33634,27402,18855,13616,6003,15864,33450,26907, -63892,16859,34123,33488,33562,3606,6068,14017,12669,13658,33403,33506,33560, -16011,28067,27397,27543,13774,15807,33565,21996,33669,17675,28069,33708,U, -33747,13438,28372,27223,34138,13462,28226,12015,33880,23524,33905,15827,17636, -27303,33866,15541,31064,U,27542,28279,28227,34014,U,33681,17568,33939,34020, -23697,16960,23744,17731,34100,23282,28313,17703,34163,17686,26559,34326,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34341,34363, -34241,28808,34306,5506,28877,63922,17770,34344,13896,6306,21495,29594,34430, -34673,41208,34798,11303,34737,34778,34831,22113,34412,26710,17935,34885,34886, -30176,15801,30180,34910,34972,18011,34996,34997,25537,35013,30583,30479,35207, -35210,U,U,35239,35260,35365,35303,31012,31421,35484,30611,37374,35472,31321, -31465,31546,16271,18195,31544,29052,35596,35615,21552,21861,35647,35660,35661, -35497,19066,35728,35739,35503,5855,17941,34895,35995,32084,32143,63956,14117, -32083,36054,32152,32189,36114,36099,6416,36059,28764,36113,19657,16080,36265, -32770,4116,18826,15228,33212,28940,31463,36525,36534,36547,37588,36633,36653, -33637,33810,36773,37635,41631,2640,36787,18730,35294,34109,15803,24312,12898, -36857,40980,34492,34049,8997,14720,28375,36919,34108,31422,36961,34156,34315, -37032,34579,37060,34534,37038,U,37223,15088,37289,37316,31916,35123,7817, -37390,27807,37441,37474,21945,U,35526,15515,35596,21979,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,3377,37676,37739,35553,35819, -28815,23235,35554,35557,18789,37444,35820,35897,35839,37747,37979,36540,38277, -38310,37926,38304,28662,17081,9850,34520,4732,15918,18911,27676,38523,38550, -16748,38563,28373,25050,38582,30965,35552,38589,21452,18849,27832,628,25616, -37039,37093,19153,6421,13066,38705,34370,38710,18959,17725,17797,19177,28789, -23361,38683,U,37333,38743,23370,37355,38751,37925,20688,12471,12476,38793, -38815,38833,38846,38848,38866,38880,21612,38894,29724,37939,U,38901,37917, -31098,19153,38964,38963,38987,39014,15118,29045,15697,1584,16732,22278,39114, -39095,39112,39111,19199,27943,5843,21936,39137,39142,39148,37752,39225,18985, -19314,38999,39173,39413,39436,39483,39440,39512,22309,14020,37041,39893,39648, -39650,39685,39668,19470,39700,39725,34304,20532,39732,27048,14531,12413,39760, -39744,40254,23109,6243,39822,16971,39938,39935,39948,40552,40404,40887,41362, -41387,41185,41251,41439,40318,40323,41268,40462,26760,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40388,8539,41363,41504,6459,41523, -40249,41145,41652,40592,40597,40606,40610,19764,40618,40623,17252,40641,15200, -14821,15645,20274,14270,35883,40706,40712,19350,37924,28066,40727,U,40761, -22175,22154,40773,39352,37003,38898,33919,40802,40809,31452,40846,29206,19390, -18805,18875,29047,18936,17224,19025,29598,35802,6394,31135,35198,36406,37737, -37875,35396,37612,37761,37835,35180,17593,29207,16107,30578,31299,28880,17523, -17400,29054,6127,28835,6334,13721,16071,6277,21551,6136,14114,5883,6201,14049, -6004,6353,24395,14115,5824,22363,18981,5118,4776,5062,5302,34051,13990,U, -33877,18836,29029,15921,21852,16123,28754,17652,14062,39325,28454,26617,14131, -15381,15847,22636,6434,26640,16471,14143,16609,16523,16655,27681,21707,22174, -26289,22162,4063,2984,3597,37830,35603,37788,20216,20779,14361,17462,20156, -1125,895,20299,20362,22097,23144,427,971,14745,778,1044,13365,20265,704,36531, -629,35546,524,20120,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,20685,20749,20386,20227,18958,16010,20290,20526,20588,20609,20428, -20453,20568,20732,U,U,U,U,28278,13717,15929,16063,28018,6276,16009,20904, -20931,1504,17629,1187,1170,1169,36218,35484,1806,21081,21156,2163,21217,U, -18042,29068,17292,3104,18860,4324,27089,3613,U,16094,29849,29716,29782,29592, -19342,19132,16525,21456,13700,29199,16585,21940,837,21709,3014,22301,37469, -38644,37734,22493,22413,22399,13886,22731,23193,35398,5882,5999,5904,23084, -22968,37519,23166,23247,23058,22854,6643,6241,17045,14069,27909,29763,23073, -24195,23169,35799,1043,37856,29836,4867,28933,18802,37896,35323,37821,14240, -23582,23710,24158,24136,6550,6524,15086,24269,23375,6403,6404,14081,6304, -14045,5886,14035,33066,35399,7610,13426,35240,24332,24334,6439,6059,23147, -5947,23364,34324,30205,34912,24702,10336,9771,24539,16056,9647,9662,37000, -28531,25024,62,70,9755,24985,24984,24693,11419,11527,18132,37197,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25713,18021,11114, -14889,11042,13392,39146,11896,25399,42075,25782,25393,25553,18915,11623,25252, -11425,25659,25963,26994,15348,12430,12973,18825,12971,21773,13024,6361,37951, -26318,12937,12723,15072,16784,21892,35618,21903,5884,21851,21541,30958,12547, -6186,12852,13412,12815,12674,17097,26254,27940,26219,19347,26160,30832,7659, -26211,13010,13025,26142,22642,14545,14394,14268,15257,14242,13310,29904,15254, -26511,17962,26806,26654,15300,27326,14435,14293,17543,27187,27218,27337,27397, -6418,25873,26776,27212,15319,27258,27479,16320,15514,37792,37618,35818,35531, -37513,32798,35292,37991,28069,28427,18924,U,16255,15759,28164,16444,23101, -28170,22599,27940,30786,28987,17178,17014,28913,29264,29319,29332,18319,18213, -20857,19108,1515,29818,16120,13919,19018,18711,24545,16134,16049,19167,35875, -16181,24743,16115,29900,29756,37767,29751,17567,28138,17745,30083,16227,19673, -19718,16216,30037,30323,42438,15129,29800,35532,18859,18830,15099,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15821,19022,16127, -18885,18675,37370,22322,37698,35555,6244,20703,21025,20967,30584,12850,30478, -30479,30587,18071,14209,14942,18672,29752,29851,16063,19130,19143,16584,19094, -25006,37639,21889,30750,30861,30856,30930,29648,31065,30529,22243,16654,U, -33942,31141,27181,16122,31290,31220,16750,5862,16690,37429,31217,3404,18828, -665,15802,5998,13719,21867,13680,13994,468,3085,31458,23129,9973,23215,23196, -23053,603,30960,23082,23494,31486,16889,31837,31853,16913,23475,24252,24230, -31949,18937,6064,31886,31868,31918,27314,32220,32263,32211,32590,25185,24924, -31560,32151,24194,17002,27509,2326,26582,78,13775,22468,25618,25592,18786, -32733,31527,2092,23273,23875,31500,24078,39398,34373,39523,27164,13375,14818, -18935,26029,39455,26016,33920,28967,27857,17642,33079,17410,32966,33033,33090, -26548,39107,27202,33378,33381,27217,33875,28071,34320,29211,23174,16767,6208, -23339,6305,23268,6360,34464,63932,15759,34861,29730,23042,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34926,20293,34951,35007,35046, -35173,35149,22147,35156,30597,30596,35829,35801,35740,35321,16045,33955,18165, -18127,14322,35389,35356,37960,24397,37419,17028,26068,28969,28868,6213,40301, -35999,36073,32220,22938,30659,23024,17262,14036,36394,36519,19465,36656,36682, -17140,27736,28603,8993,18587,28537,28299,6106,39913,14005,18735,37051,U,21873, -18694,37307,37892,35403,16482,35580,37927,35869,35899,34021,35371,38297,38311, -38295,38294,36148,29765,16066,18687,19010,17386,16103,12837,38543,36583,36454, -36453,16076,18925,19064,16366,29714,29803,16124,38721,37040,26695,18973,37011, -22495,U,37736,35209,35878,35631,25534,37562,23313,35689,18748,29689,16923, -38811,38769,39224,3878,24001,35781,19122,38943,38106,37622,38359,37349,17600, -35664,19047,35684,39132,35397,16128,37418,18725,33812,39227,39245,31494,15869, -39323,19311,39338,39516,35685,22728,27279,39457,23294,39471,39153,19344,39240, -39356,19389,19351,37757,22642,4866,22562,18872,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,5352,30788,10015,15800,26821,15741, -37976,14631,24912,10113,10603,24839,40015,40019,40059,39989,39952,39807,39887, -40493,39839,41461,41214,40225,19630,16644,40472,19632,40204,41396,41197,41203, -39215,40357,33981,28178,28639,27522,34300,17715,28068,28292,28144,33824,34286, -28160,14295,24676,31202,13724,13888,18733,18910,15714,37851,37566,37704,703, -30905,37495,37965,20452,13376,36964,21853,30781,30804,30902,30795,5975,12745, -18753,13978,20338,28634,28633,U,28702,21524,16821,22459,22771,22410,40214, -22487,28980,13487,16812,29163,27712,20375,U,6069,35401,24844,23246,23051, -17084,17544,14124,19323,35324,37819,37816,6358,3869,33906,27840,5139,17146, -11302,17345,22932,15799,26433,32168,24923,24740,18873,18827,35322,37605,29666, -16105,29876,35683,6303,16097,19123,27352,29683,29691,16086,19006,19092,6105, -19046,935,5156,18917,29768,18710,28837,18806,37508,29670,37727,1278,37681, -35534,35350,37766,35815,21973,18741,35458,29035,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,18755,3327,22180,1562,3051,3256,21762, -31172,6138,32254,5826,19024,6226,17710,37889,14090,35520,18861,22960,6335, -6275,29828,23201,14050,15707,14000,37471,23161,35457,6242,37748,15565,2740, -19094,14730,20724,15721,15692,5020,29045,17147,33304,28175,37092,17643,27991, -32335,28775,27823,15574,16365,15917,28162,28428,15727,1013,30033,14012,13512, -18048,16090,18545,22980,37486,18750,36673,35868,27584,22546,22472,14038,5202, -28926,17250,19057,12259,4784,9149,26809,26983,5016,13541,31732,14047,35459, -14294,13306,19615,27162,13997,27831,33854,17631,17614,27942,27985,27778,28638, -28439,28937,33597,5946,33773,27776,28755,6107,22921,23170,6067,23137,23153, -6405,16892,14125,23023,5948,14023,29070,37776,26266,17061,23150,23083,17043, -27179,16121,30518,17499,17098,28957,16985,35297,20400,27944,23746,17614,32333, -17341,27148,16982,4868,28838,28979,17385,15781,27871,63525,19023,32357,23019, -23855,15859,24412,19037,6111,32164,33830,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,21637,15098,13056,532,22398,2261,1561,16357, -8094,41654,28675,37211,23920,29583,31955,35417,37920,20424,32743,29389,29456, -31476,29496,29497,22262,29505,29512,16041,31512,36972,29173,18674,29665,33270, -16074,30476,16081,27810,22269,29721,29726,29727,16098,16112,16116,16122,29907, -16142,16211,30018,30061,30066,30093,16252,30152,30172,16320,30285,16343,30324, -16348,30330,20316,29064,22051,35200,22633,16413,30531,16441,26465,16453,13787, -30616,16490,16495,23646,30654,30667,22770,30744,28857,30748,16552,30777,30791, -30801,30822,33864,21813,31027,26627,31026,16643,16649,31121,31129,36795,31238, -36796,16743,31377,16818,31420,33401,16836,31439,31451,16847,20001,31586,31596, -31611,31762,31771,16992,17018,31867,31900,17036,31928,17044,31981,36755,28864, -3279,32207,32212,32208,32253,32686,32692,29343,17303,32800,32805,31545,32814, -32817,32852,15820,22452,28832,32951,33001,17389,33036,29482,33038,33042,30048, -33044,17409,15161,33110,33113,33114,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,17427,22586,33148,33156,17445,33171,17453,33189, -22511,33217,33252,33364,17551,33446,33398,33482,33496,33535,17584,33623,38505, -27018,33797,28917,33892,24803,33928,17668,33982,34017,34040,34064,34104,34130, -17723,34159,34160,34272,17783,34418,34450,34482,34543,38469,34699,17926,17943, -34990,35071,35108,35143,35217,31079,35369,35384,35476,35508,35921,36052,36082, -36124,18328,22623,36291,18413,20206,36410,21976,22356,36465,22005,36528,18487, -36558,36578,36580,36589,36594,36791,36801,36810,36812,36915,39364,18605,39136, -37395,18718,37416,37464,37483,37553,37550,37567,37603,37611,37619,37620,37629, -37699,37764,37805,18757,18769,40639,37911,21249,37917,37933,37950,18794,37972, -38009,38189,38306,18855,38388,38451,18917,26528,18980,38720,18997,38834,38850, -22100,19172,24808,39097,19225,39153,22596,39182,39193,20916,39196,39223,39234, -39261,39266,19312,39365,19357,39484,39695,31363,39785,39809,39901,39921,39924, -19565,39968,14191,7106,40265,39994,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,40702,22096,40339,40381,40384,40444,38134,36790, -40571,40620,40625,40637,40646,38108,40674,40689,40696,31432,40772,148,695,928, -26906,38083,22956,1239,22592,38081,14265,1493,1557,1654,5818,22359,29043,2754, -2765,3007,21610,63547,3019,21662,3067,3131,3155,3173,3196,24807,3213,22138, -3253,3293,3309,3439,3506,3528,26965,39983,34725,3588,3598,3799,3984,3885,3699, -23584,4028,24075,4188,4175,4214,26398,4219,4232,4246,13895,4287,4307,4399, -4411,21348,33965,4835,4981,4918,35713,5495,5657,6083,6087,20088,28859,6189, -6506,6701,6725,7210,7280,7340,7880,25283,7893,7957,29080,26709,8261,27113, -14024,8828,9175,9210,10026,10353,10575,33533,10599,10643,10965,35237,10984, -36768,11022,38840,11071,38983,39613,11340,U,11400,11447,23528,11528,11538, -11703,11669,11842,12148,12236,12339,12390,13087,13278,24497,26184,26303,31353, -13671,13811,U,18874,U,13850,14102,U,838,22709,26382,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,26904,15015,30295,24546,15889,16057, -30206,8346,18640,19128,16665,35482,17134,17165,16443,17204,17302,19013,1482, -20946,1553,22943,7848,15294,15615,17412,17622,22408,18036,14747,18223,34280, -39369,14178,8643,35678,35662,U,18450,18683,18965,29193,19136,3192,22885,20133, -20358,1913,36570,20524,21135,22335,29041,21145,21529,16202,19111,21948,21574, -21614,27474,U,13427,21823,30258,21854,18200,21858,21862,22471,18751,22621, -20582,13563,13260,U,22787,18300,35144,23214,23433,23558,7568,22433,29009,U, -24834,31762,36950,25010,20378,35682,25602,25674,23899,27639,U,25732,6428, -35562,18934,25736,16367,25874,19392,26047,26293,10011,37989,22497,24981,23079, -63693,U,22201,17697,26364,20074,18740,38486,28047,27837,13848,35191,26521, -26734,25617,26718,U,26823,31554,37056,2577,26918,U,26937,31301,U,27130,39462, -27181,13919,25705,33,31107,27188,27483,23852,13593,U,27549,18128,27812,30011, -34917,28078,22710,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,14108,9613,28747,29133,15444,29312,29317,37505,8570,29323,37680,29414, -18896,27705,38047,29776,3832,34855,35061,10534,33907,6065,28344,18986,6176, -14756,14009,U,U,17727,26294,40109,39076,35139,30668,30808,22230,16607,5642, -14753,14127,33000,5061,29101,33638,31197,37288,U,19639,28847,35243,31229, -31242,31499,32102,16762,31555,31102,32777,28597,41695,27139,33560,21410,28167, -37823,26678,38749,33135,32803,27061,5101,12847,32840,23941,35888,32899,22293, -38947,35145,23979,18824,26046,27093,21458,19109,16257,15377,26422,32912,33012, -33070,8097,33103,33161,33199,33306,33542,33583,33674,13770,33896,34474,18682, -25574,35158,30728,37461,35256,17394,35303,17375,35304,35654,35796,23032,35849, -U,36805,37100,U,37136,37180,15863,37214,19146,36816,29327,22155,38119,38377, -38320,38328,38706,39121,39241,39274,39363,39464,39694,40282,40347,32415,40696, -40739,19620,38215,41619,29090,41727,19857,36882,42443,19868,3228,36798,21953, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,36794, -9392,36793,19091,17673,32383,28502,27313,20202,13540,35628,30877,14138,36480, -6133,32804,35692,35737,31294,26287,15851,30293,15543,22069,22870,20122,24193, -25176,22207,3693,36366,23405,16008,19614,25566,U,6134,6267,25904,22061,23626, -21530,21265,15814,40344,19581,22050,22046,32585,24280,22901,15680,34672,19996, -4074,3401,14010,33047,40286,36120,30267,40005,30286,30649,37701,21554,33096, -33527,22053,33074,33816,32957,21994,31074,22083,21526,3741,13774,22021,22001, -26353,33506,13869,30004,22000,21946,21655,21874,3137,3222,24272,20808,3702, -11362,3746,40619,32090,21982,4213,25245,38765,21652,36045,29174,37238,25596, -25529,25598,21865,11075,40050,11955,20890,13535,3495,20903,21581,21790,21779, -30310,36397,26762,30129,32950,34820,34694,35015,33206,33820,4289,17644,29444, -18182,23440,33547,26771,22139,9972,32047,16803,32115,28368,29366,37232,4569, -37384,15612,42665,3756,3833,29286,7330,18254,20418,32761,4075,16634,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40029,25887,11680, -18675,18400,40316,4076,3594,U,30115,4077,U,24648,4487,29091,32398,40272,19994, -19972,13687,23309,27826,21351,13996,14812,21373,13989,17944,22682,19310,33325, -21579,22442,23189,2425,U,14930,9317,29556,40620,19721,39917,15614,40752,19547, -20393,38302,40926,33884,15798,29362,26547,14112,25390,32037,16119,15916,14890, -36872,21196,15988,13946,17897,1166,30272,23280,3766,30842,32558,22695,16575, -22140,39819,23924,30292,42036,40581,19681,U,14331,24857,12506,17394,U,22109, -4777,22439,18787,40454,21044,28846,13741,U,40316,31830,39737,22494,5996,23635, -25811,38096,25397,29028,34477,3368,27938,19170,3441,U,20990,7951,23950,38659, -7633,40577,36940,31519,39682,23761,31651,25192,25397,39679,31695,39722,31870, -U,31810,31878,39957,31740,39689,U,39963,18750,40794,21875,23491,20477,40600, -20466,21088,15878,21201,22375,20566,22967,24082,38856,40363,36700,21609,38836, -39232,38842,21292,24880,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,26924,21466,39946,40194,19515,38465,27008,20646,30022,5997, -39386,21107,U,37209,38529,37212,U,37201,36503,25471,27939,27338,22033,37262, -30074,25221,1020,29519,31856,23585,15613,U,18713,30422,39837,20010,3284,33726, -34882,U,23626,27072,U,22394,21023,24053,20174,27697,498,20281,21660,21722, -21146,36226,13822,U,13811,U,27474,37244,40869,39831,38958,39092,39610,40616, -40580,29050,31508,U,27642,34840,32632,U,22048,42570,36471,40787,U,36308,36431, -40476,36353,25218,33661,36392,36469,31443,19063,31294,30936,27882,35431,30215, -35418,40742,27854,34774,30147,41650,30803,63552,36108,29410,29553,35629,29442, -29937,36075,19131,34351,24506,34976,17591,U,6203,28165,U,35454,9499,U,24829, -30311,39639,40260,37742,39823,34805,U,U,36087,29484,38689,39856,13782,29362, -19463,31825,39242,24921,24921,19460,40598,24957,U,22367,24943,25254,25145,U, -14940,25058,21418,13301,25444,26626,13778,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23895,35778,36826,36409,U,20697,7494,30982, -21298,38456,3899,16485,U,30718,U,31938,24346,31962,31277,32870,32867,32077, -29957,29938,35220,33306,26380,32866,29830,32859,29936,33027,30500,35209,26572, -30035,28369,34729,34766,33224,34700,35401,36013,35651,30507,29944,34010,13877, -27058,36262,U,35241,U,28089,34753,16401,29927,15835,29046,24740,24988,15569,U, -24695,U,32625,35629,U,24809,19326,21024,15384,15559,24279,30294,21809,6468, -4862,39171,28124,28845,23745,25005,35343,13943,238,26694,20238,17762,23327, -25420,40784,40614,25195,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321, -9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,8560,8561,8562,8563,8564, -8565,8566,8567,8568,8569,20022,20031,20101,20128,20866,20886,20907,21241, -21304,21353,21430,22794,23424,24027,12083,24191,U,24400,24417,25908,U,30098,U, -36789,U,168,710,12541,12542,12445,12446,U,U,12293,12294,12295,12540,65339, -65341,10045,12353,12354,12355,12356,12357,12358,12359,12360,12361,12362,12363, -12364,12365,12366,12367,12368,12369,12370,12371,12372,12373,12374,12375,12376, -12377,12378,12379,12380,12381,12382,12383,12384,12385,12386,12387,12388,12389, -12390,12391,12392,12393,12394,12395,12396,12397,12398,12399,12400,12401,12402, -12403,12404,12405,12406,12407,12408,12409,12410,12411,12412,12413,12414,12415, -12416,12417,12418,12419,12420,12421,12422,12423,12424,12425,12426,12427,12428, -12429,12430,12431,12432,12433,12434,12435,12449,12450,12451,12452,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12453,12454,12455, -12456,12457,12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468, -12469,12470,12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481, -12482,12483,12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494, -12495,12496,12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507, -12508,12509,12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520, -12521,12522,12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533, -12534,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052, -1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067, -1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081, -1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096, -1097,1098,1099,1100,1101,1102,1103,8679,8632,8633,12751,204,20058,138,20994, -17553,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -40880,20872,40881,30215,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,65506,65508,65287,65282,12849,8470,8481,12443,12444, -11904,11908,11910,11911,11912,11914,11916,11917,11925,11932,11933,11941,11943, -11946,11948,11950,11958,11964,11966,11974,11978,11980,11981,11983,11990,11991, -11998,12003,U,U,U,643,592,603,596,629,339,248,331,650,618,30849,37561,35023, -22715,24658,31911,23290,9556,9574,9559,9568,9580,9571,9562,9577,9565,9554, -9572,9557,9566,9578,9569,9560,9575,9563,9555,9573,9558,9567,9579,9570,9561, -9576,9564,9553,9552,9581,9582,9584,9583,65517,1351,37595,1503,16325,34124, -17077,29679,20917,13897,18754,35300,37700,6619,33518,15560,30780,26436,25311, -18739,35242,672,27571,4869,20395,9453,20488,27945,31364,13824,19121,9491,U, -894,24484,896,839,28379,1055,U,20737,13434,20750,39020,14147,33814,18852,1159, -20832,13236,20842,3071,8444,741,9520,1422,12851,6531,23426,34685,1459,15513, -20914,20920,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,40244,20937,20943,20945,15580,20947,19110,20915,20962,21314,20973,33741, -26942,14125,24443,21003,21030,21052,21173,21079,21140,21177,21189,31765,34114, -21216,34317,27411,U,35550,21833,28377,16256,2388,16364,21299,U,3042,27851, -5926,26651,29653,24650,16042,14540,5864,29149,17570,21357,21364,34475,21374,U, -5526,5651,30694,21395,35483,21408,21419,21422,29607,22386,16217,29596,21441, -21445,27721,20041,22526,21465,15019,2959,21472,16363,11683,21494,3191,21523, -28793,21803,26199,27995,21613,27475,3444,21853,21647,21668,18342,5901,3805, -15796,3405,35260,9880,21831,19693,21551,29719,21894,21929,U,6359,16442,17746, -17461,26291,4276,22071,26317,12938,26276,26285,22093,22095,30961,22257,38791, -21502,22272,22255,22253,35686,13859,4687,22342,16805,27758,28811,22338,14001, -27774,22502,5142,22531,5204,17251,22566,19445,22620,22698,13665,22752,22748, -4668,22779,23551,22339,41296,17016,37843,13729,22815,26790,14019,28249,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,5694,23076, -21843,5778,34053,22985,3406,27777,27946,6108,23001,6139,6066,28070,28017,6184, -5845,23033,28229,23211,23139,14054,18857,U,14088,23190,29797,23251,28577,9556, -15749,6417,14130,5816,24195,21200,23414,25992,23420,31246,16388,18525,516, -23509,24928,6708,22988,1445,23539,23453,19728,23557,6980,23571,29646,23572, -7333,27432,23625,18653,23685,23785,23791,23947,7673,7735,23824,23832,23878, -7844,23738,24023,33532,14381,18689,8265,8563,33415,14390,15298,24110,27274,U, -24186,17596,3283,21414,20151,U,21416,6001,24073,24308,33922,24313,24315,14496, -24316,26686,37915,24333,449,63636,15070,18606,4922,24378,26760,9168,U,9329, -24419,38845,28270,24434,37696,35382,24487,23990,15711,21072,8042,28920,9832, -37334,670,35369,24625,26245,6263,14691,15815,13881,22416,10164,31089,15936, -24734,U,24755,18818,18831,31315,29860,20705,23200,24932,33828,24898,63654, -28370,24961,20980,1622,24967,23466,16311,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,10335,25043,35741,39261,25040,14642,10624, -10433,24611,24924,25886,25483,280,25285,6000,25301,11789,25452,18911,14871, -25656,25592,5006,6140,U,28554,11830,38932,16524,22301,25825,25829,38011,14950, -25658,14935,25933,28438,18984,18979,25989,25965,25951,12414,26037,18752,19255, -26065,16600,6185,26080,26083,24543,13312,26136,12791,12792,26180,12708,12709, -26187,3701,26215,20966,26227,U,7741,12849,34292,12744,21267,30661,10487,39332, -26370,17308,18977,15147,27130,14274,U,26471,26466,16845,37101,26583,17641, -26658,28240,37436,26625,13286,28064,26717,13423,27105,27147,35551,26995,26819, -13773,26881,26880,15666,14849,13884,15232,26540,26977,35402,17148,26934,27032, -15265,969,33635,20624,27129,13913,8490,27205,14083,27293,15347,26545,27336, -37276,15373,27421,2339,24798,27445,27508,10189,28341,15067,949,6488,14144, -21537,15194,27617,16124,27612,27703,9355,18673,27473,27738,33318,27769,15804, -17605,15805,16804,18700,18688,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,15561,14053,15595,3378,39811,12793,9361,32655,26679,27941, -28065,28139,28054,27996,28284,28420,18815,16517,28274,34099,28532,20935,U,U, -33838,35617,U,15919,29779,16258,31180,28239,23185,12363,28664,14093,28573, -15920,28410,5271,16445,17749,37872,28484,28508,15694,28532,37232,15675,28575, -16708,28627,16529,16725,16441,16368,16308,16703,20959,16726,16727,16704,25053, -28747,28798,28839,28801,28876,28885,28886,28895,16644,15848,29108,29078,17015, -28971,28997,23176,29002,U,23708,17253,29007,37730,17089,28972,17498,18983, -18978,29114,35816,28861,29198,37954,29205,22801,37955,29220,37697,22021,29230, -29248,18804,26813,29269,29271,15957,12356,26637,28477,29314,U,29483,18467, -34859,18669,34820,29480,29486,29647,29610,3130,27182,29641,29769,16866,5863, -18980,26147,14021,18871,18829,18939,29687,29717,26883,18982,29753,1475,16087, -U,10413,29792,36530,29767,29668,29814,33721,29804,14128,29812,37873,27180, -29826,18771,19084,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,16735,19065,35727,23366,35843,6302,29896,6536,29966,U,29982,36569, -6731,23511,36524,37765,30029,30026,30055,30062,20354,16132,19731,30094,29789, -30110,30132,30210,30252,30289,30287,30319,30326,25589,30352,33263,14328,26897, -26894,30369,30373,30391,30412,28575,33890,20637,20861,7708,30494,30502,30528, -25775,21024,30552,12972,30639,35172,35176,5825,30708,U,4982,18962,26826,30895, -30919,30931,38565,31022,21984,30935,31028,30897,30220,36792,34948,35627,24707, -9756,31110,35072,26882,31104,22615,31133,31545,31036,31145,28202,28966,16040, -31174,37133,31188, -}; - -static const struct dbcs_index big5hkscs_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__big5hkscs_decmap+0,64,121},{__big5hkscs_decmap+58,64,170},{ -__big5hkscs_decmap+165,64,254},{__big5hkscs_decmap+356,64,254},{ -__big5hkscs_decmap+547,64,253},{__big5hkscs_decmap+737,64,254},{ -__big5hkscs_decmap+928,64,254},{__big5hkscs_decmap+1119,64,254},{ -__big5hkscs_decmap+1310,64,253},{__big5hkscs_decmap+1500,64,254},{ -__big5hkscs_decmap+1691,64,254},{__big5hkscs_decmap+1882,64,254},{ -__big5hkscs_decmap+2073,64,254},{__big5hkscs_decmap+2264,64,254},{ -__big5hkscs_decmap+2455,64,254},{__big5hkscs_decmap+2646,64,254},{ -__big5hkscs_decmap+2837,64,254},{__big5hkscs_decmap+3028,64,254},{ -__big5hkscs_decmap+3219,64,254},{__big5hkscs_decmap+3410,64,254},{ -__big5hkscs_decmap+3601,64,254},{__big5hkscs_decmap+3792,64,254},{ -__big5hkscs_decmap+3983,64,254},{__big5hkscs_decmap+4174,64,254},{ -__big5hkscs_decmap+4365,64,254},{__big5hkscs_decmap+4556,64,254},{0,0,0},{0,0, -0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__big5hkscs_decmap+4747, -161,254},{__big5hkscs_decmap+4841,64,254},{__big5hkscs_decmap+5032,64,254},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__big5hkscs_decmap+5223,214,254},{__big5hkscs_decmap+5264,64,254},{ -__big5hkscs_decmap+5455,64,254},{__big5hkscs_decmap+5646,64,254},{ -__big5hkscs_decmap+5837,64,254},{__big5hkscs_decmap+6028,64,254},{0,0,0}, -}; - -static const unsigned char big5hkscs_phint_0[] = { -32,5,95,68,15,82,130,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,208,44,4,0,0,0,0,0,0,0, -0,0,0,0,0,0,0,0,0,0,0,0,0,192,0,4,0,0,0,0,0,0,0,0,0,0,0,0,1,22,0,15,0,0,0,0,0, -32,87,43,247,252,110,242,144,11,0,0,0,192,237,164,15,38,193,155,118,242,239, -222,251,250,247,15,50,68,175,254,239,5,0,0,0,224,251,71,128,193,2,0,132,100,4, -130,64,32,162,130,133,164,145,0,16,1,0,0,0,144,72,12,0,48,0,84,3,48,68,24,19, -53,137,38,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,64,0,32,43,153,32,16,99,40,36, -1,0,0,0,0,80,96,212,0,210,42,24,157,104,53,151,79,216,248,32,196,130,28,40,2, -0,0,0,0,214,81,10,224,0,129,134,22,67,196,53,17,55,96,230,122,109,5,12,61,0,0, -0,0,153,57,128,7,34,254,129,144,24,144,12,116,48,208,160,9,41,21,253,4,0,0,0, -0,223,128,64,8,8,176,219,196,96,237,118,125,249,29,228,211,133,166,205,5,0,0, -0,0,12,0,110,186,9,47,96,84,0,30,120,104,34,112,86,158,37,243,142,7,0,0,0,192, -94,44,188,155,223,93,108,109,4,67,96,54,74,96,216,62,7,196,200,1,0,0,0,160, -177,197,98,11,12,34,62,204,37,184,1,174,237,92,104,13,148,74,181,0,0,0,0,0, -244,3,18,17,16,68,2,53,144,235,14,153,7,209,202,5,130,161,160,0,0,0,0,52,24, -160,137,231,156,91,8,132,3,2,218,144,236,219,135,133,191,162,45,0,0,0,0,118, -58,118,98,130,148,24,1,24,125,254,141,87,39,19,210,91,55,25,12,0,0,0,0,110, -139,33,145,0,0,0,64,0,0,0,2,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0, -0,0,0,0,0,0,0,2,0,0,0,0,0,0,142,120,110,95,63,126,221,61,247,252,155,252,174, -210,255,143,107,1,0,0,0,192,159,255,234,186,186,93,188,115,159,250,216,214, -222,37,75,94,151,218,42,1,0,0,0,224,182,153,27,216,116,230,79,21,191,41,230, -255,38,117,109,227,255,155,82,0,0,0,0,80,96,126,111,153,169,80,14,0,128,16, -216,35,0,37,16,144,244,235,117,0,0,0,0,208,219,0,160,152,178,123,6,82,32,152, -22,200,61,9,0,0,1,0,0,0,0,0,0,0,4,40,200,34,0,2,0,0,16,32,130,80,64,48,1,0,16, -0,4,0,0,0,0,74,4,1,16,20,0,128,0,4,255,253,36, -}; - -static const unsigned char big5hkscs_phint_12130[] = { -0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, -0,0,0,128,2,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0, -}; - -static const unsigned char big5hkscs_phint_21924[] = { -0,0,0,0,0,26,172,248,250,90,192,250,51,0,0,0,0,0,129,0,160,156,130,144,9,1, -180,192,176,3,86,2,160,66,45,136,1,0,0,0,0,146,119,139,96,5,201,33,6,70,56,96, -72,192,180,36,222,132,224,192,36,0,0,0,0,205,80,197,52,192,40,162,173,124,153, -24,88,18,34,196,66,162,83,142,30,0,0,0,128,52,135,11,21,209,64,250,61,0,4,210, -5,72,8,22,230,28,165,0,8,0,0,0,192,45,22,20,128,24,58,212,25,136,28,138,4, -}; - -static const DBCHAR __big5hkscs_bmp_encmap[26401] = { -50904,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34905,34903,N,N,N,N,N,N, -34909,34907,M,N,N,N,N,N,N,N,34913,34911,N,N,N,N,N,N,N,N,N,N,N,N,34922,34920,N, -N,N,N,N,N,34927,34925,M,N,34931,34929,N,N,N,N,34935,34933,N,N,N,N,51451,34939, -34937,N,34978,34902,34919,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34906,34924,N,N,N,N, -N,N,34908,34926,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34928,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,51452,34910,34932,N,N,N,N,N,51450,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34936,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,34904,34921,N,34930,34912,34934,N,34938,N,34940,N,34941,N,34942,N,34977, -51446,34923,N,N,51448,N,N,N,N,N,N,51447,N,N,N,N,N,34984,N,N,N,N,N,N,N,N,51454, -N,N,N,N,N,N,N,N,N,N,51449,N,N,N,N,N,N,N,N,N,N,N,N,N,51445,N,N,N,N,N,N,51453,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,50905,51193,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -51187,51188,51189,51190,51191,51192,51194,51195,51196,51197,51198,51264,51265, -51266,51267,51268,51269,51270,51271,51272,51273,51274,51275,51276,51277,51278, -51279,51280,51281,51282,51283,51284,51285,51286,51287,51288,51289,51290,51292, -51293,51294,51295,51296,51297,51298,51299,51300,51301,51302,51303,51304,51305, -51306,51307,51308,51309,51310,51311,51312,51313,51314,51315,51316,51317,N, -51291,34915,34980,34917,34982,51410,N,N,N,N,N,N,N,N,N,N,51411,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,50869,50870, -50871,50872,50873,50874,50875,50876,50877,50878,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,51319,51320,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,51318,34985,34986,50849,50850,50851, -50852,50853,50854,50855,50856,50857,50858,N,N,N,N,N,N,N,N,N,N,50859,50860, -50861,50862,50863,50864,50865,50866,50867,50868,63993,63992,63974,63983,63965, -63976,63985,63967,63980,63989,63971,63982,63991,63973,63977,63986,63968,63979, -63988,63970,63975,63984,63966,63981,63990,63972,63978,63987,63969,63994,63995, -63997,63996,50918,51414,N,N,N,51415,N,51416,51417,51418,N,51419,N,51420,51421, -N,N,N,N,N,N,N,51422,N,N,N,N,N,N,51423,51424,N,N,N,N,N,N,N,51425,N,51426,N,N, -51427,N,51428,N,51429,N,N,N,N,N,N,N,51430,N,N,N,N,N,51431,N,51432,N,N,N,N,N,N, -N,51433,N,N,N,51434,N,51435,51436,N,51437,N,N,N,N,N,N,51438,51439,N,N,N,N,N,N, -51440,N,N,N,N,51441,50893,50912,50913,50914,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,50919,50920,50921,50922,50923,50924,50925,50926,50927,50928,50929,50930, -50931,50932,50933,50934,50935,50936,50937,50938,50939,50940,50941,50942,51008, -51009,51010,51011,51012,51013,51014,51015,51016,51017,51018,51019,51020,51021, -51022,51023,51024,51025,51026,51027,51028,51029,51030,51031,51032,51033,51034, -51035,51036,51037,51038,51039,51040,51041,51042,51043,51044,51045,51046,51047, -51048,51049,51050,51051,51052,51053,51054,51055,51056,51057,51058,51059,51060, -51061,51062,51063,51064,51065,51066,N,N,N,N,N,N,N,51412,51413,50908,50909,N,N, -51067,51068,51069,51070,51105,51106,51107,51108,51109,51110,51111,51112,51113, -51114,51115,51116,51117,51118,51119,51120,51121,51122,51123,51124,51125,51126, -51127,51128,51129,51130,51131,51132,51133,51134,51135,51136,51137,51138,51139, -51140,51141,51142,51143,51144,51145,51146,51147,51148,51149,51150,51151,51152, -51153,51154,51155,51156,51157,51158,51159,51160,51161,51162,51163,51164,51165, -51166,51167,51168,51169,51170,51171,51172,51173,51174,51175,51176,51177,51178, -51179,51180,51181,51182,51183,51184,51185,51186,N,N,N,N,N,50915,50906,50907, -34880,34881,34882,34883,34884,34886,34889,34890,34893,34895,34896,34897,34898, -34900,34901,51321,51409,37495,N,N,N,N,N,N,N,N,N,N,38623,N,N,N,N,N,N,N,N,N, -36084,N,35285,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37837,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,39903,N,N,N,N,N,N,64104,N,N,35290,36697,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,35291,N,N,36701,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35292,N,N,N,N,N, -N,N,N,N,38647,N,N,N,N,N,N,N,N,N,N,N,N,35546,N,N,N,N,35804,N,N,N,N,N,N,38875,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40531,N,N,N,N,40362,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,39914,35438,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35784, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35304,N,35306,N,N,N,N,N,35915,N,N,N,N,N,N, -N,64368,N,N,N,N,N,N,N,N,N,N,N,35309,N,N,38109,N,35310,N,N,N,N,40628,35539,N,N, -N,N,N,N,N,N,N,N,N,37595,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38107,35321,N,N,N, -N,N,N,N,N,64378,N,N,N,35323,N,N,N,N,N,N,N,40700,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,35324,N,35263,N,N,N,35326,N,35302,N,N,40262,N,N,N,40430,N,N,N,41086,N,N,N, -41064,N,N,N,N,39145,N,35688,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36349,35774, -40921,N,N,N,N,N,N,N,35563,N,N,40919,35690,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40028,N, -35761,N,N,N,N,N,N,N,N,64350,N,34672,N,N,N,N,N,N,N,40435,N,N,N,N,N,N,N,41168,N, -N,N,64614,N,N,N,N,37609,N,N,N,N,N,N,N,N,39660,36779,64072,N,N,N,N,36421,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40047,N,36188,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40670,N,N,N,N,N,N,35311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,38633,N,N,N,N,N,N,N,N,N,N,40635,N,N,N,N,38110,N,40632,N,N,N,38842,64357,N, -N,N,38358,N,N,N,40123,N,N,38874,N,N,N,N,36677,N,64381,37208,65124,N,38998, -39757,N,N,N,N,N,N,N,N,N,N,37723,38343,N,38887,N,N,N,N,N,N,37721,N,N,N,37365, -38840,N,N,64930,64438,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37626,37719,N,35750,N,N,N,N, -64441,N,38832,N,N,64964,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40097,N,N,N,N,N,37362, -37369,N,36849,N,N,N,N,N,N,38725,38995,N,N,65144,N,64449,37457,N,N,N,N,N,N, -40365,N,N,N,N,N,64876,N,N,64107,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,39874,N,N,N,N,N,N,N,N,N,N,N,N,39547,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35680,N,N,N,N,N,N,N,N,37707, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39613,N,N,N,N,37303,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36171,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,38324,N,N,N,N,N,65221,N,N,40688,36196,N,N,N,N,N,N,N,N,N, -37481,N,N,N,N,N,N,36199,N,N,N,N,N,N,N,N,N,N,N,N,64490,N,N,N,N,N,N,N,N,64495,N, -36200,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,37867,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64578,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37222,N,N,N,N,N,N,N,N, -64205,N,N,N,N,37853,N,N,36178,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,35788,36205,N,N,N,N,N,N,N,N,N,N,N,36206,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,38568,N,N,N,N,N,N,N,N,N,N,64678,N,N,N,N,N,N,N,N,N,N,N, -N,36207,N,N,N,N,N,N,N,N,N,N,N,N,N,36208,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,64612,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36083,N,N,N,N,N,N,N,36960,N, -N,N,N,N,N,N,N,36212,38851,N,N,N,N,N,N,N,35536,N,N,N,N,N,N,37492,N,39870,N,N,N, -N,N,40136,N,N,40122,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36216,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40633,N,N,N,N,N,38234, -N,N,37300,N,N,N,N,N,N,35400,N,N,N,N,N,N,N,N,N,N,N,36221,N,N,35453,N,N,35522, -64842,N,36257,N,N,35537,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64692,35655,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37796,40666,N,N,N,N,N,N,N,N,N,35409,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,36262,N,N,N,N,N,N,40645,N,N,N,N,64708,N,N,N,N,41080,N, -38069,N,N,N,N,N,N,N,64706,35435,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36267,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64232,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36269,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64585,N,37825,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36975,N,36272,N,N,N,N,N,N,N,N,38014,37114,N,N,N,N,N,N,N,N,N,N, -38009,N,N,N,N,N,N,N,N,36274,N,N,N,N,N,N,N,N,64750,N,N,N,N,N,N,N,N,N,N,N,N,N, -39291,N,N,N,N,N,N,N,N,36276,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36279,N, -N,N,N,N,N,N,37299,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36283,36282,N,N,N,N,N,N,N,N, -36284,36932,N,N,N,64844,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34635,37860,N, -N,37856,N,N,N,N,N,N,N,64851,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,36291,N,39864,N,N,N,64496,N,37865,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37878, -N,N,N,N,N,36293,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36298,N,N,N,N,N,36300,64861,37813, -64865,N,N,N,40184,N,N,N,37458,N,N,41192,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40101,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35926,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,36310,N,38848,N,N,N,41182,N,N,N,N,38866,N,N,N,N,N,64165,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,64931,N,N,N,36315,36074,36527,N,N,N,N,N,N,N,N,N,37301,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64841,N,N,N,N,N,N,N,N,64977,N,N,N,N,N,N,N, -N,N,N,36331,N,N,N,N,N,38854,N,64974,N,N,37116,N,N,N,N,N,N,N,N,N,N,N,N,N,64601, -N,N,38614,N,N,N,N,N,N,38853,36335,N,N,N,N,38871,N,N,N,N,N,36336,N,N,N,N,N,N,N, -38566,N,N,N,N,N,N,N,64447,N,N,36063,N,36339,N,N,N,N,37961,N,36341,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,39026,N,N,N,N,N,N,N,36459,N,N,N,N,N,N,64253,N,N,N,N, -N,N,N,N,N,N,36688,N,N,N,N,N,N,40396,64613,N,35908,N,N,39278,38049,N,N,N,N,N, -36707,N,N,N,N,N,N,N,41178,N,N,N,N,N,N,N,N,N,N,N,37459,65001,N,N,40373,N,N,N,N, -N,N,N,39033,34666,N,N,40285,N,N,N,N,36195,38505,40816,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,64618,N,N,35527,N,N,N,N,35287,N,N,N,N,N,N,N,N,N,N,N,N,65101,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40669,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,65275,39100,64204,N,N,38320,N,N,N,37988,N,N,N,N,N,N,37743,N,N,N,N,N,N, -38073,N,N,38380,N,N,N,N,37358,N,N,39107,N,38390,N,N,N,36861,39109,N,N,N,N, -38758,65134,N,N,38877,36010,N,N,37586,N,N,38753,39115,N,N,N,N,38384,N,38749,N, -37347,N,N,N,N,39116,N,N,37993,39117,N,N,N,N,N,39118,N,38396,N,N,38051,38498,N, -N,N,65206,N,37987,36167,N,N,N,N,N,N,39120,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39121,N,N,N,N,38005,64224,N,N,N,N,N,N,N,N,N,38002,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39126,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,35568,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39129,N,N,N,N,N,N,N,36186,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,39131,N,N,N,N,39133,N,N,N,N,N,N,N,N,39080,N,N,N,N,N,N,N,35437,N,N,N,N,N, -N,N,N,N,N,N,35579,35502,64457,N,N,N,N,35933,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,39140,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39142,N,N,N,N, -N,N,N,N,N,N,N,39144,N,N,N,N,N,N,N,N,N,N,N,N,N,35405,N,N,N,37463,N,N,N,N,N,N,N, -N,N,N,38367,N,N,41132,N,N,N,N,39147,N,N,N,N,39148,N,36035,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39156,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35512,N,N,N,40679,N,N,N,N, -N,N,N,N,38076,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64721,N,N,N,N,N,N,40134,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36170,N,40574,36164,39166,65000,N,N,N,N, -39232,N,N,N,N,38089,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,38099,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39238,N,N,N,N,37056,N,38097,N,N,N, -N,N,N,N,N,N,N,N,N,N,36174,N,N,38259,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37826,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39240,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,39243,N,N,N,N,N,36437,N,N,N,N,39246,N,N,N,N,N,N,N,N,N, -N,N,36606,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36191,N,36441,N,N,N,N,N,N,N,N,N, -38124,38127,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35936,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36724,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,39253,N,N,N,N,N,N,N,N,N,38212,N,N,N,N,N,N,N,N,N,N,N,36043, -N,N,N,39254,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39257,N,N,N,N,N,N,N,39259,N,N,N, -N,N,N,N,N,N,N,N,N,N,36036,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64069,N,N,N, -37047,N,N,38723,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38349,N,N,N,N,N,N,38857,64848, -36537,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38342,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39271,N,N, -36067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35513,N,N, -N,N,N,N,36348,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35446,N,N,N,N,N, -40273,N,N,N,N,N,N,N,N,N,N,N,N,N,39283,N,N,34624,N,40271,39290,38244,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39329,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39333,N,N,N,N,N, -N,N,39335,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,36589,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39341,N,51326,N,N,N,N,N,N, -N,N,N,N,N,N,N,37998,36720,N,64208,N,N,N,N,N,N,N,N,N,N,N,N,N,39347,N,N,N,N,N,N, -41043,N,N,N,N,N,36190,N,N,38492,N,N,36064,N,64890,N,N,N,N,N,N,N,N,38910,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37565,36189,38909,N,N,N,N,36708,N,N,N,N,64759,38242, -38861,40548,N,N,N,N,N,N,N,37452,36553,39356,N,N,N,N,40357,N,36692,N,N,N,N,N,N, -N,N,N,N,36732,N,N,N,N,36181,N,36514,N,N,N,N,N,N,N,N,N,36730,N,N,N,N,N,N,38830, -N,N,N,N,38600,N,N,36068,N,N,N,N,39363,N,37078,N,40126,N,N,N,36726,N,N,N,N,N,N, -N,N,N,N,N,N,N,38000,64331,N,N,64970,N,N,36079,N,N,N,36551,N,N,N,N,36180,41209, -N,N,N,N,N,N,N,36777,N,N,36177,N,N,N,N,N,N,N,N,N,39367,34628,N,N,N,N,N,N,N,N,N, -N,N,N,37079,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -34627,N,N,N,N,N,N,N,N,N,N,N,N,34631,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34648,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40671, -36185,34626,N,N,39374,N,N,N,N,N,N,N,N,36794,N,N,N,N,N,36843,N,39375,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36802,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37577,N,N,N,N,N,38876,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34653,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,36165,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38323,40057,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38322,N, -36172,36827,N,N,N,N,39907,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,34636,N,N,N,N,N,N,N,N,N,N,N,N,N,34637,N,N,N,N,N,N,N,N,N,40570,34647,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,39918,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39390,N,N,N, -N,N,N,N,N,N,N,N,N,N,64250,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35410,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,39393,N,N,N,N,N,N,35431,35765,N,N,N,N,N,N,N,N,N,N,35500,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39401,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,64458,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38878,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38353,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39413,64586,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39849,N,N,N,N,N,N,N,N,N,N,N,N,64476,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,65110,N,N,N,N,N,40612,N,N,N,N,N,N,40265,38363,N,N,N,N,N,N,N,N,N,N,35269, -N,N,N,N,N,N,N,N,N,N,N,N,39416,N,N,N,N,N,N,38500,N,N,N,N,36949,N,N,38612,N,N,N, -N,N,N,N,38780,N,N,N,N,N,N,38477,N,38881,N,N,N,N,N,N,39496,N,N,N,N,N,N,N,N,N,N, -N,39497,N,65149,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37034,N,N,N,N,39504,N,N,N,N, -N,N,N,37703,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36568,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37065,N,N,N,N,N,39509,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37052,N,N,N,N,N,39512,N,35768,37077,N,N,N,N,N,N,N,N,N,N,N,N,N,38465,N,N, -N,N,N,N,39514,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39516,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,38850,N,N,N,N,N,N,N,N,N,N,N,N,N,34652,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35515,N,N,N,39850,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37109,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39520,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,37189,35928,N,N,N,N,N,N,N,N,39523,N,N,N,N,N,N,35913,N,N,N,N,N,N,N,N, -N,N,N,35766,N,N,N,N,N,N,N,N,N,N,64719,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38507, -39534,N,37199,N,N,N,N,N,N,N,N,38726,N,N,41190,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37591,N,38517,N,N,37844,N,N,37307,38521,N,N,N,N,N,39536,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38520,37325,N,40010,41071,N,N,41066,N, -N,N,N,N,N,37215,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,34625,N,N,N,N,N,N,N,N,40869,N,N,35258,N,34639,N,N,N,N,N,N,34638,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,34645,N,N,N,40653,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39545,N,N,N,N,N,N,N,N,N,36082,N,N,N,36183,N,40398,N,N,N,36050,N,N,N,34649,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40307,N,N,N,N,N,N,N,N, -N,38585,N,38588,N,N,N,N,N,N,40145,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35255,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40686,34633,N,N,N,N,N,N,N,N,N,N, -64323,34651,N,40649,N,N,N,N,N,N,64467,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37294,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,36184,34630,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36182,N,N,N,N,N,N,N, -40312,N,N,N,N,N,N,N,N,N,N,40315,40627,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40626,N,40406,N,N,N,N,39247,N,N,35278,N,N,N,35776,N,40900,N,35796,N,N,35954, -N,N,N,N,N,N,50879,35833,N,N,N,N,N,35142,N,50880,N,N,N,N,N,N,N,N,N,64229,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,51323,35782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40023,N,N,N, -N,N,N,N,N,N,N,N,N,N,39675,N,N,N,N,N,N,N,35280,35279,N,N,N,50881,N,35281,N, -35298,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37502,N,40378,N,N,N,N,N,50882,N,N,35951,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64504,N,N,N,35783,37483,N,N,35282,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,40911,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40361,35283,N,N,39394,N,N,N,N,N,N,N,N,N,37479,37540,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,35955,N,N,35150,N,N,N,N,N,N,N,N,N,N,N,N,N,35151,37496,N,N,N,N,N,N, -N,N,37302,N,N,N,N,35284,N,40914,N,N,N,N,N,N,N,N,37543,N,N,38306,N,N,N,N,N, -37486,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,38634,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37487,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37539,N,N,N,N,N,35152,N,N,64087,N,N,N,N,39014,N, -N,N,36088,N,N,N,N,N,N,N,N,35286,N,N,N,N,N,N,N,N,N,N,39090,N,N,N,37547,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38622,37548,N,N,N,N,N,N,N,N,N,N,35952,N, -40814,N,N,N,N,N,N,36594,N,N,N,40812,35288,N,N,N,N,64089,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37544,N,N,N,N,N,37219,N,N, -N,N,N,N,35904,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40819,N, -37549,N,N,N,N,N,N,N,N,N,N,N,N,N,39913,N,N,N,N,N,37545,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,37546,N,N,N,N,N,N,35289,N,N,N,N,N,N,N,64854,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,40872,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35953, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37537,N,N,37091,N,N,N,N,N,N,N,N,41126,N,N,N,N, -N,38059,N,64626,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38852,N,N,N,N,N,N,N,37550, -64103,N,N,N,N,N,N,N,N,N,N,N,37538,64105,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,37480,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35153,N,N,N,N,N,N,N,N,N,64111,N,N,N,N,N,N,N,N,N, -64113,N,N,N,N,N,N,N,N,N,35154,N,N,N,N,37978,N,N,N,N,N,N,N,N,50883,N,N,N,35293, -N,51362,N,N,N,N,N,N,N,N,N,N,N,N,N,50884,N,N,N,40530,N,35155,N,N,N,N,N,N,N,N,N, -N,40533,37562,N,N,50885,N,N,35931,N,N,N,64125,64168,39528,64071,N,N,64126,N,N, -N,N,N,N,N,N,N,N,37563,N,N,N,64950,N,64162,N,N,N,N,N,64163,N,64164,39860,64166, -N,N,N,N,N,N,N,35295,N,N,N,64987,N,N,64169,N,35156,N,N,N,N,N,N,N,N,64171,N,N,N, -N,N,N,64634,N,N,N,N,N,N,N,35296,N,40783,51325,N,N,35297,N,N,N,N,N,64176,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40909,41191,N,N,N,N,N,64177,35238,N,N,N,N,N,N, -N,N,N,N,N,N,40698,N,N,N,N,N,N,N,64178,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,64180,N,37572,N,N,N,N,N,N,40815,N,N,N,N,N,N,N,35760,N,N,N,N,N,N,N, -N,N,N,40876,N,N,N,N,N,35299,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39891, -35300,N,N,N,64181,N,N,N,N,N,40917,N,N,N,N,N,N,35157,N,N,37573,N,N,N,35158,N,N, -N,N,N,N,N,N,N,N,N,N,64179,N,N,N,64182,N,N,N,N,N,N,N,N,N,N,N,64183,N,N,N,N,N,N, -40668,N,N,N,64452,40817,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64186,37575,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,50886,39500,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35944,N,N,35301,N,N,N,N,40829,N,N,N,N,N, -41129,64196,N,N,N,N,50887,N,N,35159,N,N,N,N,N,N,64170,N,N,N,N,N,N,N,N,N,N,N, -35160,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35811,N,35681,N,N,N,N,39665,N,N,40631,N, -50888,N,N,N,64209,N,N,N,N,N,N,64210,N,N,N,N,N,N,N,N,40634,64212,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64217,N,N,N,N,N,N,N,N,N,N,N,N,64219,N,40160,N,N,N, -64503,N,64506,35303,41082,64220,N,N,64221,N,35305,N,N,N,N,N,50889,N,N,N,N,N,N, -N,N,N,N,64226,35307,N,N,64227,N,N,N,N,N,N,37064,N,N,N,37594,35161,40181,N,N,N, -N,N,35162,64231,40866,N,N,N,N,N,64234,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,64237,36781,N,N,N,N,N,N,64345,64239,38639,N,40428,N,N,N,40394,N,N,N,N,N,N, -64877,N,35308,N,N,N,N,N,N,N,N,N,N,N,64324,N,N,40418,N,35957,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40640,N,40534,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,40825,39623,N,N,64244,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,39073,N,N,N,N,N,N,N,N,N,64248,N,N,N,35312,40519,N,N,40439,N,N,N,N,40915, -N,39626,N,N,N,N,35313,64249,N,N,N,N,N,N,N,N,N,N,N,N,N,36442,N,35314,N,N,N,N, -35315,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37469,35665,37600,N,N,35316,N,N,N,N,N, -N,N,N,N,40916,N,N,N,N,N,N,N,N,35449,N,N,N,N,N,N,N,N,N,N,N,35317,38823,N,N,N,N, -N,N,N,N,N,N,37818,N,N,N,N,N,40536,N,N,N,N,35318,N,N,N,N,N,40535,N,N,N,N,35319, -N,35393,N,N,35320,N,N,64241,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35322,N,N,N, -N,N,N,N,64322,N,64191,N,N,N,N,N,N,N,N,N,64419,N,N,N,N,N,N,N,N,N,64247,N,N,N,N, -N,N,N,N,N,N,N,40526,N,38108,N,N,N,N,N,38362,40440,40810,N,N,N,N,N,35511,N,N,N, -N,N,N,N,N,N,N,N,N,64326,N,N,N,N,N,N,N,N,N,35398,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64327,N,N,N,N,N,N,37192,N,N,N,37598,N,N,N,N,35667,40438,N, -39898,N,N,N,N,40318,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35325,39396,N,N, -N,N,N,40515,N,N,N,N,N,N,N,N,N,N,N,40425,N,36690,N,N,N,40437,40432,N,N,N,39399, -N,N,N,N,N,35773,40431,N,N,N,N,N,N,N,N,N,N,N,40887,N,N,N,N,N,N,N,N,N,N,N,N, -40400,N,40939,36265,40399,39137,N,40421,N,N,N,N,N,N,N,40392,N,N,N,N,N,N,N,N,N, -64335,N,N,N,N,N,N,N,N,N,N,N,40427,N,N,N,N,N,N,N,N,N,64340,N,64341,39586,N, -35542,N,39519,N,N,N,N,N,N,N,N,40693,N,N,N,36791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39634,40554,40680,N,N,N,N,N,N,N,N,N,N,N,N,35775,37314,40290, -N,N,N,N,N,N,37472,N,N,N,N,N,N,N,N,N,N,N,37470,37313,N,35525,N,N,38819,N,N,N,N, -N,N,N,N,N,N,35692,N,36222,N,N,N,N,N,N,N,40020,N,N,N,N,N,40381,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,40133,N,N,N,N,N,N,N,N,N,N,N,35163,N,N,N,N,N,N,N,N, -N,N,64348,N,64347,N,64343,N,N,N,N,N,N,N,N,N,34661,N,39111,64346,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40174,N,N,N,N,N,N,N,37602,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,38055,N,N,N,N,N,N,N,N,N,N,36044,N,39892,N,N,64356,64374,N,N, -64352,N,N,N,N,N,N,N,N,N,N,N,N,N,39397,N,N,39618,N,N,N,37371,N,N,N,41075,N,N,N, -N,N,N,N,40818,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40908,N,N,N,39077,37608,N,N, -N,N,N,N,N,N,39868,N,38643,N,N,37607,N,N,64615,N,N,N,N,N,N,N,N,N,N,N,35709,N,N, -N,N,39924,N,N,N,N,N,40695,N,N,40641,N,N,N,N,N,N,N,N,N,39279,N,N,N,N,N,N,38641, -N,N,36417,N,N,N,N,N,38218,N,N,N,38886,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38645,N,N,N, -N,N,37606,40770,N,N,N,N,N,N,N,64359,N,N,N,N,N,N,N,N,39337,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,64230,64361,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38885,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,38525,N,N,N,64364,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39330,N,N,N,N,N, -39611,N,N,N,39525,N,N,37966,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64366,N,N, -39391,N,N,N,N,N,N,N,N,N,39139,N,N,37460,N,N,N,N,N,38523,35503,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35959,N,N,N,N,N,N,35759,40637,N,N, -N,N,N,N,N,N,N,N,N,N,40678,N,N,64367,N,N,N,N,N,36577,N,N,N,N,39805,40062,N,N,N, -N,63961,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37610,N,N,N,N,35960,N,N,N,N,N,N,N,N,N,N, -N,64370,N,N,N,64369,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35164,N,39152,38642,N,N,N,N, -N,N,N,64372,35777,N,35165,35294,N,35166,N,N,50890,N,N,N,N,N,N,65090,N,N,N,N,N, -N,N,N,N,N,N,34664,N,64379,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35167,N,35168,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,39885,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40403,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,38988,N,N,N,N,N,N,N,N,N,N,38738,N,N,N,N,N,38339,N,N,N,N, -39862,N,N,N,N,N,N,N,N,N,N,N,N,39609,N,N,N,38835,N,N,N,N,N,N,40820,37617,N,N,N, -N,N,N,36090,N,N,N,N,38879,N,N,N,N,64422,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64427,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39031,N,N,N,38996,38341,N,N,N,N,N,N,N,40277, -64434,38270,N,N,N,N,N,N,N,N,38722,N,38118,N,N,N,N,37621,N,N,N,N,N,N,N,36037,N, -N,N,N,N,N,37629,N,N,64418,N,N,40017,N,N,38121,39004,37616,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,37964,N,N,N,N,N,N,N,37227,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35704,N,N,N, -N,38114,N,N,N,N,N,N,N,38991,N,64437,N,N,N,N,37489,N,N,37733,N,N,39003,N,N, -38992,N,N,N,N,N,N,N,38844,N,N,N,N,37619,N,N,37696,38989,N,N,N,38258,N,65007,N, -N,N,N,N,N,N,N,64961,N,N,N,N,64442,N,N,37611,N,N,N,N,N,N,64627,38839,N,N,34671, -N,N,N,N,N,N,64436,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37031,N,N,N,N, -N,N,N,N,N,N,38721,37620,N,34674,N,64444,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38263, -N,N,N,N,N,N,N,N,N,N,N,40674,N,36728,N,N,N,N,N,N,N,63964,N,N,N,38514,40629,N,N, -N,38475,N,N,N,36012,N,N,N,N,N,N,N,N,N,41210,N,N,N,N,N,N,N,N,N,N,N,38261,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37082,N,N,37735,N,65188,N,N,N,37087,N,N,N, -N,37716,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35169,N,35764,N,N,N,N, -40384,N,N,N,N,N,N,36424,N,64453,N,N,N,N,N,64455,N,N,N,50891,N,64121,N,N,N,N,N, -N,N,N,N,N,N,N,N,40551,N,N,N,N,N,36057,N,N,N,N,N,N,64466,35170,35171,N,N,N,N,N, -N,N,N,N,N,64637,N,N,N,N,N,N,N,N,N,N,N,N,34675,N,N,N,N,N,N,N,N,N,N,N,40811,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64460,N,65198,N,N,N,34669,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64465,N,N,N,N,N,N,N,N,N,N,N,64373,64468,N,N,N,N,N,N,N, -N,N,N,N,N,N,64470,64472,N,N,N,N,N,N,N,35677,N,37708,N,39650,N,N,35785,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64475,40905, -N,N,N,N,N,N,N,N,40772,N,N,N,N,N,N,N,N,N,N,39149,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,36073,N,N,N,N,N,N,N,N,N,N,N,N,64477,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,36338,35172,N,65010,N,37709,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,64487,N,N,N,N,N,N,41202,39016,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40792,N,N,N,36070,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36211,N,N,N,64478,N,N,N,N,N, -64479,N,N,N,N,N,35912,N,N,N,N,N,N,34676,64483,N,N,N,N,36264,N,N,64484,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40053,N,N,39032,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36192,N,N,N,N,N,N,N,64485,N,36193,N,N,N,N,N,N,N,N,N,N,N,N,N,36194,41121,N,N,N, -40000,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39085,N,N,N,40682,N,N,N,36076,N, -N,36052,N,N,N,N,N,N,N,N,N,40171,N,N,N,N,N,64480,N,N,40785,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36197,N,N,N,N,N,N,40177,N,N,N,N,N,N,N,N,N,N,64600,N,N, -36198,N,N,N,N,N,N,N,38484,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64488,N,N, -N,50892,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40910,64508,N,39652, -N,N,N,N,N,N,40821,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64497, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36201,N,N,N,N,N,37711,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,37710,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,64500,N,N,N,N,50894,N,N,N,64451,N,N,35173,N,N,N,N,N,N,N,N,N,N,N,35962,N, -N,N,N,N,N,35963,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,36202,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37715,N,N,40443,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64509,N,N,N,36953,64576,N, -64577,64579,37729,64582,37730,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36203,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64588,36094,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,38328,N,N,50896,35786,N,N,N,N,N,N,N,N,N,N,39034,N,N,N,N,50897,N, -64593,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64596,N,N,N,N,N,N,N,N,64175,N,N,N,N,N,N,N, -36204,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64097,N, -N,64599,N,N,N,N,N,N,N,N,N,39792,N,N,N,N,N,N,N,N,41041,N,N,N,N,N,N,N,35964,N, -35787,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37742,N,N,N,64725,64681,N,N, -N,N,N,N,N,N,N,N,N,N,N,64609,N,N,N,N,N,N,N,N,N,35174,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,64203,N,N,N,N,N,N,N,63962,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,37754,N,41184,N,N,N,N,N,N,37739,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64619,N,N,N,N,N,41180,N,N,37992,N,N,N,N,N,N, -N,N,N,N,N,64621,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,36209,N,N,N,N,N,N,64868,N,N,N,N,39354,N,N,N,39632,39521,41189,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41051,38572,N,N,N,N,38720,N,N,N,N,N,N,N,N,N,N,N, -N,40689,N,N,N,N,N,N,N,N,35917,N,N,N,N,N,N,N,N,N,N,N,N,N,40830,N,N,N,N,N,N,N,N, -N,N,N,N,36210,N,N,N,N,64630,N,N,N,N,N,N,N,N,N,N,N,N,N,38569,N,N,N,N,N,N,N,N, -41070,N,N,64682,N,N,N,64461,N,N,N,64628,N,N,N,N,N,N,N,N,N,N,41076,N,N,N,N,N,N, -N,N,N,N,N,N,N,41073,N,N,N,64633,N,N,N,N,N,64636,N,N,N,N,N,N,N,N,N,N,N,N,N, -40016,N,N,37753,37752,N,N,41181,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,36213,N,36214,N,N,N,N,N,N,37748,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36215,64677, -N,N,64674,N,N,N,N,N,N,37059,N,N,N,N,N,N,N,41081,36217,N,N,N,N,N,N,N,N,N,N, -35836,N,41078,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35789,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40794,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40948,N,N,40890,N,N,N,N,N,N,N,N,N,N,36218,N,N,N,N,N,N,N,N,N,N,N,N, -40517,N,N,N,N,N,N,37808,N,41077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39750,N,64686,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64688,N,N,N,N,N,N,N,N,N, -64081,N,N,N,N,N,36219,36220,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40662,N, -N,37804,N,N,N,40795,N,37801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41084,N,N,N,N,N,N,N,64690,N,N,N,N,N,N,N, -N,N,N,N,N,35521,N,N,N,N,N,40884,N,N,N,N,N,N,N,N,N,N,N,64684,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40524, -N,N,N,N,N,N,N,36805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37805,N,N,N,N,N,N,N,N,N,N,N, -N,40387,N,N,N,36258,N,N,N,40266,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64694,N,N, -36259,40523,N,40525,36260,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35581,N,N,N,N,N,64693,N,64707,37810,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36261,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37793,N,N,N,N,N,N,N,N,N,N,35526,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,35419,N,N,N,35149,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,65236,N,N,N,N,35448,N,37803,N,N,N,N,N,N,N,N,N,36263,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,40773,N,N,N,N,N,N,N,N,N,35414,N,N,N,64703,N,N,N,64704,N,36582, -N,N,35492,35139,N,N,N,N,N,N,37875,N,N,N,N,N,N,N,N,N,N,N,N,64683,40610,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,40391,N,N,N,50898,35790,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,64709,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64715,N,N,N,N,N,N,N,N, -N,N,N,37811,N,64714,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64713,36268, -N,64454,35175,N,35966,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64717,N,N,N,N,N,N,N,N,40179,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,64720,N,N,38331,N,N,N,N,N,N,N,N,N,N,N,64723,N,N,64724,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36270,64727,N,N,N,N,N,37851,N,N,N,N, -65123,N,N,N,N,N,N,N,N,N,N,N,N,37845,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64730,N,N,N,39793,N,N,64733,N,34660,N,N,N,N,N,36271,N,N,N,64242,N,N,N,N,N,N,N, -N,N,N,N,37848,N,N,N,64735,N,N,N,37843,N,N,N,N,N,N,N,64737,N,N,N,N,N,N,N,N,N, -36470,N,N,N,N,N,N,N,64610,N,N,N,N,N,N,N,N,37841,N,N,N,36273,N,N,N,N,N,N,N, -39001,N,N,N,N,N,N,N,N,N,64338,N,N,N,N,N,N,N,N,64339,N,N,N,N,N,64333,N,N,40127, -N,N,N,N,N,N,N,N,39794,N,N,N,N,N,N,N,N,N,N,N,N,N,64336,37822,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36059,N,N,N,N,N,N,N,N,N,40433,64747,N,N,N,N,N,N, -N,N,N,41147,N,39806,N,N,N,N,N,N,N,36275,N,N,35922,N,N,N,N,39656,N,N,N,N,N,N, -36572,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40185,N,N,N,N,N,N,N,N,N,N,N,N,N,64080,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39143,64755,N,N,N,N, -64754,N,N,N,36042,N,N,34677,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,37861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39513,N,N,N,36277,N,N,N,N, -N,N,N,64845,N,N,N,N,64862,N,N,N,N,N,N,N,N,N,N,N,N,N,36733,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,38215,64758,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,37456,N,N,N,N,35176,36278,64763,41085,39164,35177,N,N, -N,N,N,N,N,N,65103,N,N,37462,N,N,N,N,N,N,N,N,N,N,64201,N,N,37864,N,N,N,64760,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40163,64937,N,N,N,N,N,N,64580,N,N,N,N,N,N, -N,N,38464,N,N,36280,N,N,N,N,N,N,N,N,N,N,39754,36793,N,N,N,N,N,N,64766,N,N,N,N, -N,N,N,35178,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36281, -N,N,N,37246,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37876,N,N,N,N,N,N,N,N,N,N,N,N,N, -64380,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37863,N,N,38895,N,N,N,65098,N,N,N,N,N, -64837,N,38565,N,N,N,N,65248,64840,64839,65266,65130,N,N,N,N,N,36285,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39841,36002,39607,36604,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40865,N,N,N,N,N,N,N,N,N,64849,N,N,N,N,N,N,N,64173,N,N,N,N,36286,N,N,35236,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,39641,N,N,N,N,N,N,N,N,N,N,N,64846,N,N,36288,N,N,38896, -N,N,N,N,N,N,N,N,N,N,37812,64836,N,N,N,N,N,N,N,N,N,N,N,N,40871,N,N,N,N,36290,N, -N,N,N,39350,N,N,N,N,N,N,N,N,N,N,N,N,N,64850,N,N,N,N,N,N,36289,N,N,36422,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,41169,N,N,N,N,N,N,N,N,N,N,N,N,N,40906,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,37583,N,N,N,40180,36292,N,N,N,N,N,N,N,N,N,N,64833,N,N,N,N,N,N, -N,39756,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64855,64751,40158,N,N,N,N,N,N,N,64834, -39020,N,N,N,N,N,N,N,N,N,N,N,N,N,38905,N,38232,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39006,65147,38093,N,N,N,N,N,37870,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36003,N,64858, -N,N,N,N,N,N,37877,N,N,N,N,N,37871,36586,N,N,N,36699,N,N,N,N,N,N,N,N,N,N,N, -35934,N,36294,N,N,N,N,N,N,N,N,N,N,N,36296,N,N,36295,N,N,N,N,N,37879,N,N,N,N,N, -N,N,36297,N,N,N,N,N,N,N,64498,N,N,N,N,38512,N,N,N,N,N,N,N,N,N,36299,N,N,N, -64860,N,N,N,N,N,N,N,N,N,36709,N,N,N,36301,N,N,N,N,N,40360,38137,N,N,36302,N,N, -N,N,N,N,N,N,37866,N,N,N,N,N,N,N,N,N,64863,37872,40886,N,N,N,N,N,N,N,N,N,36303, -N,N,N,38755,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36304, -37873,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64866,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64869,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40923,N,N,N,N,37880,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35831,N,N,N,N,64870,N,N,N,N,N,35791,N,N,N,N,N,N,36305,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,36306,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,64881,N,N,N,N,64879,N,N,N,N,N,N,N,N,36307,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40935,37053,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40912,N,N,N,35792,N,64882, -N,40110,35793,N,N,35547,N,N,N,N,N,N,N,N,N,N,N,64228,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,38350,N,64886,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64354,N,N,N,N,N,N,36308, -N,N,N,64888,N,N,N,N,N,36579,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36982,N,N,39110,N,N,N,N,N,N,N,36309,N,N,N,N,38865,N,N,40630,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64199,N,N,41026,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,39027,N,N,N,N,N,N,N,N,N,N,40956,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,36005,36311,N,N,37627,36312,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,37967,N,36313,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,35179,N,N,N,N,N,N,N,N,38862,N,N,N,64243,64942,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64431,37559,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36314,N,N,N,N,N,N,N,N,N,N,N,N,N,40026,N,N,N,N,N,N,64941,N,N,N,N,N,N,N,N,N,N,N, -N,N,36316,37956,N,N,N,N,N,N,N,N,N,N,N,36317,N,N,N,N,N,N,N,41174,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35905,38869,N,37962,N,N,N,N,N, -37965,N,N,N,N,38859,N,N,N,N,N,36318,N,N,36319,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36320,65273,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,64960,64761,N,N,N,N,N,N,36061,N,64382,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37555,N,N,N,N,N,64943,N,N,N,N,N,N,N,N,N,36321,N,N,N,N, -38355,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35265,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64872,N,N,40119,N,N,36323,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,64192,36325,64100,N,35143,N,N,N,N,36324,N,N,N,N,N,36327, -36328,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64967,64944,N,N,N,N,N,N,37957,38870,N,N, -N,N,N,N,N,N,N,64710,38980,N,N,N,N,N,N,N,N,N,N,N,N,36329,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,36330,N,N,N,N,N,N,N,N,65104,N,N,N,N,N,N,64972,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40359,N,N,N,N,N,64973,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64975,N,N,N,N,38354,N,N,N,N,N,N,N,36333,N,N,N,N,N,N,N,N,64698,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,64965,N,64978,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40156,N,N,N,N,N,38351,N,N,36334,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64980, -N,N,N,N,N,38636,38635,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37046,N,64963,39083,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38638, -N,N,N,N,N,N,N,N,N,N,N,N,N,36340,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64992,N,35943,N,N,36342,N,N,N,36343,N,N,N,N,N,N,N,36858,N,N,N,N, -N,N,N,N,N,N,38864,N,N,N,N,35794,N,N,36344,N,N,N,N,N,37081,N,35911,N,64240,N,N, -N,N,64993,36345,N,64995,N,N,N,N,N,N,N,36346,N,64355,N,N,N,37030,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39280,N,N,37355,N,38768,39023,64994,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39154,N,39676,35180,65021,N,N,39262,N,N,N,38333,N,N,N,N,N,N,N,64996, -N,N,N,37350,N,N,N,N,64997,64998,N,N,N,N,N,N,N,N,64999,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,37972,N,N,N,39352,N,N,N,N,N,N,N,N,38889,37702,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,39011,N,N,N,N,N,N,N,N,N,N,N,38332,N,65005,65015,N,N,N, -N,N,N,39024,38646,36521,N,N,N,N,N,37969,N,N,36419,N,35674,N,N,N,N,65006,N,N,N, -N,65008,N,N,N,N,65012,N,39925,N,N,N,N,N,36078,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,38782,N,N,N,N,N,39893,N,39619,N,38856,41179,37328,N,N,40932,N,36829,N, -37353,N,N,N,N,N,N,N,N,N,39136,N,N,N,37578,N,38999,N,N,35921,N,N,N,N,65003,N, -39753,N,N,N,N,N,N,N,N,N,40310,40623,N,N,N,N,N,N,N,N,N,40140,N,N,N,N,N,N,65002, -N,N,36337,N,N,65019,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36435,N,N,N,N, -N,N,N,N,N,N,N,64207,N,N,N,N,N,N,N,N,N,N,N,N,N,38649,N,N,N,N,N,N,N,N,N,39103, -40521,36007,N,N,N,N,N,N,N,N,39882,N,N,N,N,65022,37596,N,N,N,N,N,65089,37324, -37346,N,N,N,N,N,N,N,N,N,N,N,N,65092,34655,N,N,N,N,N,35795,N,N,65095,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,65096,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37973,N,N,N,N, -65099,N,65100,N,N,N,N,36287,N,N,N,N,N,N,N,N,N,40568,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,65105,N,N,N,N,37974,N,N,N,N,N,N,N,40289,N,N,N,N, -37975,N,N,N,N,N,N,N,N,N,N,39270,N,N,N,N,N,N,N,N,N,N,N,N,N,35797,N,N,N,N,41065, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39092,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,41033,41036,N,40549,N,N,N,N,N,N,N,N,N,N,N,39093,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65112,N,39285,65107,41061,N,65113,N,N,N,N, -N,N,N,N,N,39095,39096,N,N,N,N,N,N,N,39098,N,N,N,N,N,N,39099,N,N,N,N,N,N,40892, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41034,N,N, -40647,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36009,N,N,39086,N,N,N,N,N, -N,N,N,37590,N,N,N,64225,N,37332,N,N,N,N,N,N,N,N,64222,N,N,65115,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,35923,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65118,N,N,N,N,64471,65114, -38085,N,N,N,N,64202,N,N,N,N,N,N,N,N,N,N,N,39105,38748,N,65140,N,38771,N,N,N,N, -N,N,N,N,64070,N,N,N,38756,N,N,N,65128,N,38478,N,38757,35930,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,35233,38394,N,37588,65129,N,64325,N,39112,N,N,37103,N,39113,39114,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37997,38071,65132,N,N,37995,N,N,N, -N,N,N,37628,N,38379,N,65139,38766,65119,N,N,N,N,N,N,N,N,N,64957,N,N,37589,N,N, -N,N,N,N,65209,N,N,65137,34680,N,N,N,64443,N,N,38010,N,N,38395,65143,N,N,N,N,N, -N,N,65145,N,65141,N,N,N,37981,N,N,N,N,N,N,N,65148,N,N,N,N,N,N,N,N,N,37700, -36518,N,N,N,N,N,N,N,N,N,N,N,37587,N,38072,N,34681,N,N,N,N,N,N,64625,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,38750,N,N,N,N,36013,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65191,N,N, -N,37994,N,N,N,37859,N,N,39119,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41177,N,N, -N,N,N,N,N,N,41151,41037,41144,N,N,N,N,N,41166,41143,N,N,N,N,N,N,N,N,65193,N,N, -N,N,N,N,N,N,N,N,35267,N,N,N,N,65195,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40436,35181,N,N,N,N,N,40059,N,N,N,N,N,N,39122,N,N,N,40873,N,N,N,65202,N,N, -65201,N,N,N,38873,N,41156,N,38006,N,N,N,N,N,N,N,N,N,N,39288,N,N,N,N,N,N,65203, -N,N,N,N,N,39123,65204,N,N,N,39124,N,N,N,N,N,N,N,40889,N,N,N,N,N,N,N,N,38001,N, -N,N,N,N,N,N,N,N,39125,65208,N,N,N,50900,N,N,N,N,N,N,N,N,N,N,N,65210,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40540,N,N,65211,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41028,N, -N,N,N,39127,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39128,65212,N,N,N,N,40958,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65213,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40413,N,N,N,N,40673,N,N,N,N,N,N,N,N,N,N,N,N,39130, -40415,65215,N,65214,N,N,40683,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40537,41052,N, -N,N,N,N,N,N,65216,N,N,N,38007,39132,N,65217,N,N,N,39134,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,65219,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65224,N,N,N,65225,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65226,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -65227,N,N,N,N,N,N,N,N,N,40898,N,N,35947,39108,N,38064,38065,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,65233,N,N,N,N,N,41153,N,65234,N,N,N,N,41165,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,65235,N,N,39141,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65238, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37348,N,N,N,N,36807,38062,N, -35407,38066,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36820,N,N,N,N,39146, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65240,N,N,N,N,N,N,N,N,N,40416,N,N, -N,N,39150,N,N,N,N,38340,N,64744,N,N,N,N,N,39151,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,35950,N,N,N,N,N,N,N,N,64216,N,N,N,N,N,N,N,N,N,N,N,N,N,65244,N,N,N,N,N,N,N, -N,N,41134,40268,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39153,N,N,N,39155,N,38081,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39157,N,N,64079,38626,N,N,N,N, -37968,N,38562,N,N,39158,N,N,N,38629,N,N,N,N,N,39159,N,41030,38627,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39160,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40676,N,N,N, -N,N,N,63958,N,N,N,N,N,N,38083,N,N,N,N,38082,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65249,N,65257,N,N,N,N,38628,N,35244,38619,N,N, -N,N,N,N,N,N,N,N,N,N,N,65250,N,N,N,N,N,N,N,N,N,N,38084,65251,N,N,N,65255,40955, -N,N,N,N,N,N,N,N,N,N,N,35929,N,N,N,N,N,N,N,N,N,37833,N,38120,64342,N,N,N,37061, -41128,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,65253,N,N,N,39165,39163,65256,N,36543,N,N,N,N,35800,65271,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36712,38086,N,N,N,N,N,N,N,N,40426,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64617,N,N,N,N,N,N,N,N,N,N,N,N,40154,N,65267,N,N,40050, -N,N,65264,35273,N,N,N,N,N,N,N,N,N,39233,N,N,N,N,N,N,N,39234,N,N,N,65269,N, -37335,N,N,N,N,N,38092,N,N,N,65272,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,38824,N,65276,N,N,N,36062,N,64959,N,N,N,N,N,N,N,65278,N,N,N,N,N,N,N,N, -N,N,N,N,N,38609,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38101,N,N,38096,39236,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35939,N,N,41139,N,N, -N,N,N,N,N,N,N,N,N,N,38095,N,N,N,40954,N,N,N,N,37349,N,40042,N,N,N,36425,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36428,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36429,N,N,N,N,N,39539,N,N,N,N,N,N,N,N,N,N,N,N,N,39239,N, -36017,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36432,N,N,N,N,N, -N,N,N,N,N,36431,39241,N,N,N,N,N,36433,36434,N,N,N,N,39602,35237,N,N,N,N,N, -39244,N,N,N,40952,N,N,N,N,N,N,36438,39245,37322,36439,N,N,N,N,38113,N,N,N,N, -36935,N,36824,36440,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38123,36444,38227,N, -N,N,N,N,N,N,40933,N,N,N,N,N,N,N,N,N,N,40790,N,N,N,N,N,N,N,38223,N,36446,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,39274,N,N,N,N,N,N,N,N,40036,40153,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,36445,N,N,N,N,N,N,N,N,N,N,N,N,39248,N,N,N,N,N,N,N,N,N,39249,N,N, -36450,N,N,N,N,N,N,N,N,N,N,N,39250,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36456,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36449,40793,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35763,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40797,36454,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36018,N,N,N,N,N,N,N,N,N,N,N, -N,N,36462,N,40804,39251,N,N,64184,N,N,N,N,N,39252,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36464,N,N,N,N,N,N,N,N,N,N,N,N,40801,N,36466,N,N,N,N,N,N, -N,N,N,N,N,N,41067,N,N,N,N,40768,N,N,N,N,N,N,38125,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,38126,N,N,40893,N,N,N,36475,N,N,N,N,N,N,39255,38135,N,40799,N,N,N,N,36467,N, -N,40802,N,N,N,N,N,N,N,38134,N,N,N,N,N,N,N,N,N,N,N,N,N,39256,N,N,N,N,N,N,N,N,N, -36469,63963,N,N,N,N,36978,N,38136,N,N,N,N,N,N,N,N,N,39258,N,N,N,N,N,N,N,N,N, -41136,36019,N,N,N,36473,N,36472,N,N,N,38131,N,N,N,N,N,39087,N,N,N,N,N,N,41138, -N,N,N,N,N,N,N,N,N,N,N,36474,N,N,N,N,N,N,39260,N,N,N,N,N,36476,N,36477,N,N,N, -35801,N,N,35234,40663,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,41142,N,N,N,N,N,N,N,N,N,N,N,N,40514,N,N,36516,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36519,N,35958,N,N,N,N,N,N,N,N,N,34663,N,38210,N,N,N,N,N,N,N,N,N,N,N,N,39037,N, -N,N,38741,N,N,36520,N,N,N,N,N,N,N,36522,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,35235,N,39264,39266,N,N,38140,39265,N,N,N,N,N,N,N,38138,N,N,N,N,N, -N,N,36526,36530,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36528,N,N,N,N,N,N,N,39267,38826, -38139,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36539,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,36060,N,N,N,N,N,N,N,N,N,39030,N,36513,N,N,N,N,36020,N, -36535,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40358,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40624, -N,N,N,36536,N,N,N,N,N,N,N,N,N,N,N,N,40304,N,N,N,N,35182,N,N,N,N,N,N,N,35183,N, -N,N,N,N,N,N,N,N,N,N,N,N,35184,N,N,N,N,N,N,N,N,N,N,N,N,35185,N,N,N,N,N,N,N, -35186,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35187,35188,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35189,N,N,N, -N,N,N,N,N,36540,36541,N,N,N,N,N,36542,N,40401,N,N,N,N,38141,N,N,N,35799,35802, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41186,N,N,N,N,N,N, -40937,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64936,N,N,N,35559,N,N,N, -36546,N,N,N,N,N,N,N,N,N,N,N,36548,N,N,N,N,N,N,N,N,N,N,39268,N,N,N,N,N,39269,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38222,N,N,N,N,N,N,N,N,N,39091,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36555,35807, -N,N,N,N,N,36558,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36559,N,N,39272,N,N,N, -N,39273,N,N,N,N,N,N,N,N,39275,36561,N,39276,N,N,N,N,N,N,N,N,N,36564,36565,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39277,N,N,N,N,N,N,41150,N,N,N,N,N, -36566,41148,41141,N,N,41140,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35253,N,N,N, -N,N,N,N,36573,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40541,39281,N,N,N,N,35246,40424,N,N, -N,N,N,N,N,N,38245,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,39282,N,N,35676,N,N,N,N,N,N,N,N,N,35249,41152,N,N,N,36575,N,38246,N,N, -39284,N,39286,N,N,N,39287,N,39289,N,N,40410,N,N,36576,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37724,N,N,N,N,N,N,N,40422,N,35679,N,N,38243,N,N,N,N,N,N,N,N,N,N,38247,N, -N,N,N,N,40419,N,N,N,N,N,N,N,N,N,N,N,N,N,39292,N,N,39293,39294,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,36091,35675,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39331,N,N,N,N,N,N,N, -39332,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39334,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39336,N,N,N,N,35518,N,N,N,N,N,N,N,N,N,N,N,40545,N,N,N,N,N,N,N,N,N,N,39338,N,N, -N,N,N,N,41160,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39339,N,N, -N,N,N,N,N,N,N,N,65220,N,N,N,N,N,N,39106,36584,N,41146,N,N,N,N,N,N,N,N,N,N,N, -64887,N,N,36590,N,N,N,40639,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35266,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39340,N,N,N,N,N,N,N,N,N,N,N,N,N,38251,N,N,38252, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39343,N,N,39242,35190,36680,N,N,N,N,N,N,N,N,N, -N,N,64494,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39342,N, -N,N,36603,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36048,N,N,N,N,35666,N,N,N,N, -N,39344,N,N,N,N,35191,36673,N,N,N,N,N,N,N,39345,N,N,N,N,N,N,N,N,N,36681,N,N,N, -N,N,N,N,N,N,N,N,64077,N,N,N,N,N,N,N,N,40420,36021,N,N,N,64489,39764,N,39346, -40552,N,N,N,N,N,N,N,N,N,N,N,N,36682,N,36674,N,N,36689,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38982,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,39348,N,N,N,N,N,N,N,N,N,N,36597,64853,N,N,40141,N,N,N,N,N,N,N, -N,35192,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36691,N,N,N,N,N,N,N,N,N,N,N, -36719,N,N,N,N,N,N,N,N,N,N,36451,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36694,N,N,N,N,N, -N,N,N,N,N,N,N,65142,N,N,N,N,40902,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64172,N,N,N,N,N, -36696,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38984,39351,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,38501,N,64108,N,40423,N,N,N,40546,N,N,N,38604,36455,N,N, -64629,N,39038,N,N,N,N,N,N,N,64953,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38908,N,N,N,N, -N,N,N,N,N,39161,N,36710,N,N,N,N,N,N,N,N,38254,N,37445,N,N,36704,N,N,N,40657,N, -N,N,N,N,65229,N,39353,N,N,N,N,N,N,N,N,N,N,N,N,36706,38732,N,N,N,N,N,N,N,N,N,N, -N,N,37319,38239,N,N,N,N,N,N,N,39355,N,N,N,N,N,N,N,N,N,36461,36721,N,N,38091,N, -N,N,N,N,N,N,N,N,N,N,N,38321,N,N,N,N,N,N,N,N,N,39666,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,38595,39357,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41167,N, -N,N,36717,N,N,39358,36596,N,36722,38372,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39359,37442,N,64421,N,N,N,N,N,N,N,N,N,N,39360,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64948,36727,N,N,N,39361,N,N,N,N,N,N,N,N,N, -64185,N,N,N,N,N,N,N,N,36672,64068,N,N,N,N,N,39362,N,N,N,N,N,N,N,36700,N,N,N,N, -36029,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39364,39365,N,N,36731,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34678,N,N,N,36022,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36771,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36046,N,N,N,N,N,N,N,N,N,39366,N,N,N,N,N,N,N,N, -N,N,N,N,N,38605,N,N,N,N,N,N,N,N,N,N,N,N,N,38599,36773,N,N,N,N,N,N,N,N,N,N, -64187,N,35937,38256,N,N,N,37736,N,36734,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36778,N,N,N,N,N,N,41040,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37075,N,N,38230,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36792,N,N,N,N,N,39368,N,N,N,N,N,N,N,N,N,N,N,36783,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39369,N,N,N,N,N,N,N,N,N,N,N,N,N,38265,N,N,N,N,N,N,N,N,N,N,N,N,40777, -N,N,N,N,39370,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39371,40405,36784,N,N, -N,N,N,N,N,N,N,N,N,64122,N,N,N,N,N,N,N,N,40543,N,N,N,N,39373,41161,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39643,N,N,N,41158,N,N,N,N,N,N,N,36788,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,41175,N,N,N,N,N,N,N,N,N,N,N,N,41159,N,N,N,N,N,N,N, -41027,N,N,N,36789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36786,N,N,N,N,N,N, -41057,40542,N,N,N,N,N,N,N,N,N,N,36790,N,N,N,N,N,N,N,N,40936,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40114,N,N,N,N,N,38268,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40903, -N,N,36795,36796,N,N,N,N,N,N,N,N,36844,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36800,N, -37738,N,N,N,35812,40060,N,N,N,N,N,N,N,N,38305,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,65260,N,N,38307,N,N,N,N,N,N,N,35909,36024,N,N,N,N,N,N,N,N,N,N,N, -36801,N,N,N,41042,N,N,N,N,N,N,N,N,N,N,N,N,N,39376,N,N,N,N,N,36803,36804,N,N,N, -N,N,N,N,N,N,38308,N,N,N,N,N,36806,N,40544,N,N,N,N,N,N,N,63960,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38309,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40115,N,N,N,N,N, -N,N,N,N,39377,65265,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,39378,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40130,N,N,N,39379,N,N,N,N,N,38311,N,N,N,N,N,N,38313,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,38310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40029,N,N,N,N,N,N,N,N,39138,N,N, -N,N,N,N,36809,N,41154,36810,N,N,N,N,N,N,39380,N,N,41145,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39768,N,36813,N,41172,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36814,N,N, -N,N,35813,N,N,N,N,35193,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,36816,38326,N,N,N,N,N,N,N,N,N,N,N,N,39382,N,38373,N,N,N,N,N,N,N,N,N, -N,N,N,39383,N,N,N,N,38325,N,N,N,N,N,N,N,N,N,N,N,41162,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40957,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,41048,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36822,N,N,N,39384,N,N,N,N,N,N,N, -36819,N,N,N,N,N,N,N,N,N,N,N,N,36837,N,N,N,N,N,36841,N,N,N,N,39385,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36087,N,N,N,N,N,N,N,N,N,N,N,N,N,37500,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,40005,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36072,36830,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,36831,N,N,N,N,N,N,N,N,N,N,N,N,N,41035,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36834,N,N,N,41164,N,N,N,N,N,N,N,N,36835,36836,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39876,N,N,N,39932,N,N,N,N,N,N,38476,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,39670,N,36014,N,N,N,N,N,N,N,N,N,N,N,N,36839,N,N,N,N, -N,N,N,N,N,N,36840,N,N,N,N,35815,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,35194,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,35195,39386,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36845,N,N,N,38336,N,N,N,N,N,N,N,N,N,N,N,N,N,41163,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40520,N,N,N,N,N,N,39387,N,36851, -N,N,N,N,36857,N,N,N,N,N,N,N,N,N,N,N,N,N,38337,N,41038,N,N,N,N,N,N,39388,N,N,N, -N,41060,36855,N,N,N,N,N,N,N,35248,41032,N,N,N,N,36859,36854,N,N,N,N,N,40412,N, -N,N,39389,35816,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37569,N,N,N,N,N,N,N,40918,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41170,N,N,36928, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35524,N,N,39392,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,40944,40947,N,N,N,N,N,N,N,N,N,N,N,N,40383,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,40950,N,38344,N,N,40538,N,N,N,N,N,N,N,N,N,N,N,N, -39395,N,N,N,N,N,N,N,N,N,N,N,35402,N,N,N,N,N,N,N,N,40945,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,35495,N,N,N,N,N,N,N,N,39398,N,N,N,40951,N,40941,N,N, -N,N,N,N,35420,N,40366,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,38345,N,N,N,N,N,36936,N,N,39400,N,N,N,N,N,36937,N,N,36026, -N,N,37041,N,N,N,N,N,N,36938,N,N,N,N,N,N,N,N,N,N,39402,N,N,N,N,N,N,N,N,N,N,N, -39889,N,N,N,N,N,N,N,39403,N,39404,N,N,N,N,N,N,N,N,39405,N,N,N,N,39406,36940,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36941,N,N,38347,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,38882,N,N,N,N,N,N,N,N,38348,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40824,N,N, -N,N,N,N,N,N,N,35196,35197,N,N,N,N,N,N,35198,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39261,N,N,N,N,N,N,N,N,N,N,N,N,39770,N,N, -N,N,36944,N,35919,N,N,N,N,N,N,N,N,N,N,N,36948,N,50902,39592,39407,65259,40355, -40353,39235,39237,N,40317,N,N,39408,N,N,N,N,N,N,N,N,39409,N,39410,N,N,36028, -40288,N,N,N,N,N,N,N,N,N,41123,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36955,40667,N,N,N,N,N,N,N,N,N,40313,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39411,N,N,N,36962,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,40789,N,N,N,N,N,N,N,N,N,39929,N,N,N,N,N,N,N,N,N,N,36965,N,N, -38624,N,N,N,N,N,N,N,39102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36968,N,N,N, -N,N,36972,N,N,N,N,N,N,N,N,N,N,N,N,38360,N,N,N,N,N,N,N,N,36970,40882,N,N,N,N,N, -N,N,40878,N,N,40880,N,35245,N,N,N,N,N,N,N,N,36974,N,N,N,N,N,N,N,N,40561,N,N,N, -N,N,40522,N,N,N,N,N,40924,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35243,N,40888,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36976,N,N,N,N,N,N,N,N,N,N,N,N, -35683,N,N,N,N,38364,N,N,N,N,N,N,N,N,36977,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64606,N,N,N,N,N,N,N,N,35145,N,N,N,N,N,38491,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35920,N,N,N,38054,N,N,N,36821,40563,N,N,N,N,N,36981,N,N,N,N,39415,N,N,N,N,N,N, -N,N,N,N,N,N,N,36031,N,N,N,N,N,N,39417,N,38499,38329,N,N,N,N,N,N,N,N,N,38100,N, -N,N,N,N,N,64762,N,N,N,N,36983,N,N,37035,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40269, -N,N,39418,N,N,N,N,37603,N,38843,N,N,36984,N,N,N,N,N,N,N,N,39419,N,N,38880,N,N, -N,N,N,N,N,N,38620,N,N,N,N,N,N,N,N,N,40104,N,N,38770,N,N,N,N,37952,N,N,N,N,N, -37618,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39421,N,N, -39420,N,N,N,N,N,N,N,63959,38474,N,N,N,38616,39422,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36939,N,N,N,N,N,N,64065,N,N,N,N,N,N,N,39488,N,38747,N,N,N,N,N, -39489,37341,N,N,N,N,N,37884,39490,39491,N,38489,N,N,N,N,N,N,39492,36945,N,N,N, -38079,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37026,N,N,N,40107,38774,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64597,65093,38056,39493, -64075,40417,N,N,38617,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38772,N,N, -65013,N,N,N,37605,N,38469,37338,N,37027,N,N,41055,N,N,N,N,37039,38847,N,N,N, -37196,N,N,N,N,38522,N,N,N,37342,N,N,39494,65200,38777,37996,N,N,N,N,N,N,N,N, -39000,N,N,N,N,N,N,N,N,N,N,N,37478,N,N,N,37883,N,N,N,N,N,N,N,N,N,N,N,N,39495,N, -N,N,N,N,N,N,N,N,N,38729,N,N,38728,N,37706,N,40162,N,N,N,N,N,N,37476,N,N,N,N, -37343,N,N,N,N,N,N,N,64377,N,N,N,N,N,N,N,38615,N,N,N,N,37699,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,64971,65146,N,37339,35946,38831,N,N,38365,N,N,N,37704,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,39499,N,N,N,64581,N,39501,N,N,N,N,N,N,37308,37090,37044,38369, -N,N,N,N,N,39502,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39503,N,N,N,65088,65091,N,N,N, -N,N,N,N,N,N,38621,N,N,N,N,N,N,39505,N,N,N,38567,N,N,37040,N,N,N,N,N,N,N,N,N, -40014,N,37955,N,N,N,N,36538,N,N,N,N,N,N,N,N,N,N,N,N,39506,N,64705,N,N,N,N,N,N, -N,N,N,35817,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40111,N,N,35837, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39612,N,39608,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39598,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39591,39507,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,40308,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35818,N,N,N,N,N,N,35819,N,N,N,N,N,37042,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,38377,38376,N,38374,N,N,N,N,N,N,37045,N,39508,N,N,N, -37043,38375,N,N,35664,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35820,N,N,N, -N,N,N,N,N,N,N,N,39510,35835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39511,N, -N,N,N,41130,N,N,N,N,N,N,N,N,40870,N,N,N,39372,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40025,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39349,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,37054,N,N,N,N,N,40879,N,N,N,N,N,N,N,N,N,N,N,N,N,38386,N,N,N,N,N,N,37055,N, -N,N,N,N,N,N,N,N,N,N,N,37057,N,65252,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37060,N,N, -N,N,N,N,37063,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37604,40786,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,37083,N,N,N,N,N,41062,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37074,N,N,34667,N,37076,N,N,N,N,N,N,N,N,N,39515,38397,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,35780,N,N,N,35942,N,37086,N,N,N,N,N,40164,N,37089,N,N,N,N,N,N,N,N,N,N,N, -N,N,40518,N,N,N,38481,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64344,N,37094, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38480,N,N,N,37095,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,37096,39517,N,40826,N,N,N,39772,N,40828,N,N,64594,37097,N,37098,N, -39518,N,N,N,N,N,40822,N,N,N,N,N,N,N,N,N,37099,N,N,N,N,N,N,N,N,N,N,N,N,N,37100, -N,N,N,N,N,35822,N,N,N,N,N,N,N,37102,N,N,N,37318,N,N,37106,64700,35444,N,N,N,N, -N,N,N,N,N,38487,N,N,N,40175,N,N,N,N,N,N,N,N,N,N,40927,N,N,N,N,37111,37110,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39774,N,N,N,37112,N,N,N,N,N,N,N,N,N,N,36092,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,37113,N,36041,N,N,N,64106,N,N,N,N,N,N,N,N,35823,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40928,N,N,37186,N,39522,N,N,N,N,N, -N,N,N,N,38249,N,N,N,37188,37187,N,37185,N,N,N,35824,N,N,N,N,N,N,N,N,N,N,N,N,N, -38496,N,35825,N,39414,37193,N,N,N,N,37194,N,N,N,N,N,37195,N,N,N,N,39524,N,N,N, -35519,39526,N,N,N,N,N,N,N,N,N,N,39527,N,N,39529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39530,38482,37197,N,38502,N,N,N,N,40827,N,39531,N,N,N,N, -N,N,N,41068,N,N,38503,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39532,N,N,N,N,39533,35826, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38506,N,N,N,N,N,N,N,N,64746,N,N,N,N,N,38508,N, -N,N,N,N,N,N,N,N,N,N,N,N,37316,N,N,N,38519,N,N,N,N,N,N,N,39412,39535,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40875,N,N,N,N,N,36030,36545,N,N,N,N,38229,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37202,37203,N,N,N,37205,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38237,N,38513,N,N,N,N,40045,N,N,N,N,N,N,N,N,38515,N,N,N,N,N,N,N,N,N,N,N,37204, -39537,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37206,N,N,N,38509, -N,N,N,N,N,N,38231,N,N,N,N,N,N,N,N,35270,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35271,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,35434,N,N,N,35671,N,N,N,40929,N,N,39775,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41053,N,N,N,N,N,N,N,N,37211,N,37212,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37214,N,N,N,N,N,N,N,N,N,N,40796,40791,N,N,N,N,N, -N,40805,N,N,N,N,N,39538,N,N,N,N,37216,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40798,N,N,37217,N,N,N,N,N,N,37220,N,N,N,N,40769,N,N,N,N,N,N,37225,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,37224,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39540,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38578,N,39541,N,64933,N,N,N,N, -N,N,N,40681,N,35770,37229,41056,N,N,N,N,N,N,N,40926,N,N,N,N,N,40899,N,38581,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41063,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,38579,N,N,N,N,N,N,N,N,N,N,N,N,N,39542,N,N,N,N,N,N,N,N,N,N,N, -38357,N,N,N,40650,N,N,N,39543,N,N,39544,N,N,N,N,N,N,N,N,N,N,37232,37231,N,N,N, -N,N,N,N,40867,N,37233,N,N,N,38577,N,N,N,N,40803,N,N,N,N,N,40807,N,N,N,35769, -39546,N,N,N,N,N,35670,N,N,N,N,N,N,N,N,39642,N,N,N,N,N,38576,N,N,N,N,39550,N,N, -N,N,N,N,N,N,N,N,40414,N,N,N,N,N,N,N,N,N,38573,N,N,N,38574,N,N,N,N,N,N,N,N,N, -40609,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40528,N,N,N,N,N,N,N,N,38575, -35828,40868,N,N,N,N,N,N,N,N,N,38589,N,N,N,N,N,N,N,N,N,38644,N,N,N,N,N,N,N,N,N, -N,38584,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64161,N,N,N,N,37287,N,N,N,N,N,N,N, -N,N,N,41054,N,N,N,N,39549,N,N,N,N,35144,N,40625,N,N,N,N,N,N,N,N,N,N,N,N,N, -40411,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38335,35443,N,N,N,N,N,N,N,N,N,N,N,N,N,40702, -N,37242,N,N,N,N,37243,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39587,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,38594,N,N,N,N,N,40823,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39588,N, -N,39589,N,N,N,37281,N,N,N,N,35256,N,N,N,N,N,N,N,N,N,N,37235,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39590,35261,N, -35257,N,37245,N,N,N,N,N,N,N,N,N,38587,N,N,N,40946,N,N,35829,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,39593,N,N,N,N,N,40788,N,N,40931,40685,N,N,N,N,N,N,N,N,N,N,37290,N,N,N, -N,37291,41072,N,40813,N,N,N,N,N,37292,N,N,N,37293,N,N,N,41213,N,40930,N,37295, -40513,39594,N,N,37296,N,39595,N,N,N,N,N,N,N,N,N,N,N,39596,N,39498,N,37298,N,N, -35830,N,39597,35254,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39599, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,39600,N,N,N,N,N,N,39601,N,N,N,N,N,39585,37305,N,N, -N,N,N,37306,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37310,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41025,35767,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37312,N,N,N,N,N,N,N,N,N,N,39603, -37315,N,N,N,N,N,N,N,N,N,N,41212,N,N,40942,N,N,N,N,N,N,40809,N,N,N,N,N,N,N, -37320,N,N,N,N,N,N,37321,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36326,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37323,N,N,N,N,N,N,N,N,N,N,35272,N,N,N,N,N,36266,N,N,N,N, -N,40925,35907,35949,35956,36023,36025,36027,36032,36055,36056,36058,51361, -51363,36077,36168,35832,51408,N,N,N,N,51407,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,50916,N, -50917,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,51405,N,51406,N,N,N,N,N,N,N,N,63998, -}; - -static const struct unim_index big5hkscs_bmp_encmap[256] = { -{__big5hkscs_bmp_encmap+0,168,252},{__big5hkscs_bmp_encmap+85,0,220},{ -__big5hkscs_bmp_encmap+306,80,198},{0,0,0},{__big5hkscs_bmp_encmap+425,1,81},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__big5hkscs_bmp_encmap+506,190, -193},{0,0,0},{0,0,0},{__big5hkscs_bmp_encmap+510,22,231},{0,0,0},{ -__big5hkscs_bmp_encmap+720,218,219},{__big5hkscs_bmp_encmap+722,96,125},{ -__big5hkscs_bmp_encmap+752,80,112},{0,0,0},{__big5hkscs_bmp_encmap+785,61,61}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__big5hkscs_bmp_encmap+786, -128,227},{__big5hkscs_bmp_encmap+886,51,51},{__big5hkscs_bmp_encmap+887,5,254 -},{__big5hkscs_bmp_encmap+1137,192,207},{__big5hkscs_bmp_encmap+1153,49,49},{ -0,0,0},{__big5hkscs_bmp_encmap+1154,53,251},{__big5hkscs_bmp_encmap+1353,6,254 -},{__big5hkscs_bmp_encmap+1602,9,245},{__big5hkscs_bmp_encmap+1839,1,251},{ -__big5hkscs_bmp_encmap+2090,15,250},{__big5hkscs_bmp_encmap+2326,8,254},{ -__big5hkscs_bmp_encmap+2573,1,251},{__big5hkscs_bmp_encmap+2824,14,244},{ -__big5hkscs_bmp_encmap+3055,13,239},{__big5hkscs_bmp_encmap+3282,18,253},{ -__big5hkscs_bmp_encmap+3518,6,255},{__big5hkscs_bmp_encmap+3768,0,250},{ -__big5hkscs_bmp_encmap+4019,4,250},{__big5hkscs_bmp_encmap+4266,2,249},{ -__big5hkscs_bmp_encmap+4514,17,252},{__big5hkscs_bmp_encmap+4750,43,242},{ -__big5hkscs_bmp_encmap+4950,1,244},{__big5hkscs_bmp_encmap+5194,3,234},{ -__big5hkscs_bmp_encmap+5426,3,247},{__big5hkscs_bmp_encmap+5671,19,244},{ -__big5hkscs_bmp_encmap+5897,0,250},{__big5hkscs_bmp_encmap+6148,6,231},{ -__big5hkscs_bmp_encmap+6374,15,255},{__big5hkscs_bmp_encmap+6615,16,192},{ -__big5hkscs_bmp_encmap+6792,4,237},{__big5hkscs_bmp_encmap+7026,7,156},{ -__big5hkscs_bmp_encmap+7176,4,248},{__big5hkscs_bmp_encmap+7421,3,253},{ -__big5hkscs_bmp_encmap+7672,3,252},{__big5hkscs_bmp_encmap+7922,1,254},{ -__big5hkscs_bmp_encmap+8176,2,249},{__big5hkscs_bmp_encmap+8424,1,254},{ -__big5hkscs_bmp_encmap+8678,19,239},{__big5hkscs_bmp_encmap+8899,2,251},{ -__big5hkscs_bmp_encmap+9149,5,253},{__big5hkscs_bmp_encmap+9398,0,254},{ -__big5hkscs_bmp_encmap+9653,3,251},{__big5hkscs_bmp_encmap+9902,2,249},{ -__big5hkscs_bmp_encmap+10150,2,254},{__big5hkscs_bmp_encmap+10403,13,255},{ -__big5hkscs_bmp_encmap+10646,5,252},{__big5hkscs_bmp_encmap+10894,16,245},{ -__big5hkscs_bmp_encmap+11124,9,252},{__big5hkscs_bmp_encmap+11368,12,223},{ -__big5hkscs_bmp_encmap+11580,35,253},{__big5hkscs_bmp_encmap+11799,7,226},{ -__big5hkscs_bmp_encmap+12019,44,229},{__big5hkscs_bmp_encmap+12205,24,254},{ -__big5hkscs_bmp_encmap+12436,7,234},{__big5hkscs_bmp_encmap+12664,10,255},{ -__big5hkscs_bmp_encmap+12910,24,241},{__big5hkscs_bmp_encmap+13128,2,254},{ -__big5hkscs_bmp_encmap+13381,0,202},{__big5hkscs_bmp_encmap+13584,0,250},{ -__big5hkscs_bmp_encmap+13835,3,246},{__big5hkscs_bmp_encmap+14079,5,250},{ -__big5hkscs_bmp_encmap+14325,28,255},{__big5hkscs_bmp_encmap+14553,2,254},{ -__big5hkscs_bmp_encmap+14806,2,250},{__big5hkscs_bmp_encmap+15055,4,248},{ -__big5hkscs_bmp_encmap+15300,3,254},{__big5hkscs_bmp_encmap+15552,5,246},{ -__big5hkscs_bmp_encmap+15794,0,226},{__big5hkscs_bmp_encmap+16021,2,251},{ -__big5hkscs_bmp_encmap+16271,2,248},{__big5hkscs_bmp_encmap+16518,5,220},{ -__big5hkscs_bmp_encmap+16734,2,217},{__big5hkscs_bmp_encmap+16950,12,254},{ -__big5hkscs_bmp_encmap+17193,8,245},{__big5hkscs_bmp_encmap+17431,6,244},{ -__big5hkscs_bmp_encmap+17670,6,254},{__big5hkscs_bmp_encmap+17919,11,252},{ -__big5hkscs_bmp_encmap+18161,18,252},{__big5hkscs_bmp_encmap+18396,37,254},{ -__big5hkscs_bmp_encmap+18614,7,223},{__big5hkscs_bmp_encmap+18831,6,250},{ -__big5hkscs_bmp_encmap+19076,2,246},{__big5hkscs_bmp_encmap+19321,3,246},{ -__big5hkscs_bmp_encmap+19565,24,255},{__big5hkscs_bmp_encmap+19797,11,237},{ -__big5hkscs_bmp_encmap+20024,5,248},{__big5hkscs_bmp_encmap+20268,3,252},{ -__big5hkscs_bmp_encmap+20518,2,239},{__big5hkscs_bmp_encmap+20756,112,245},{ -__big5hkscs_bmp_encmap+20890,4,255},{__big5hkscs_bmp_encmap+21142,0,231},{ -__big5hkscs_bmp_encmap+21374,28,249},{__big5hkscs_bmp_encmap+21596,12,226},{ -__big5hkscs_bmp_encmap+21811,81,247},{__big5hkscs_bmp_encmap+21978,3,212},{ -__big5hkscs_bmp_encmap+22188,1,242},{__big5hkscs_bmp_encmap+22430,25,249},{ -__big5hkscs_bmp_encmap+22655,8,196},{__big5hkscs_bmp_encmap+22844,81,254},{ -__big5hkscs_bmp_encmap+23018,8,253},{__big5hkscs_bmp_encmap+23264,3,244},{ -__big5hkscs_bmp_encmap+23506,1,246},{__big5hkscs_bmp_encmap+23752,45,244},{ -__big5hkscs_bmp_encmap+23952,29,244},{__big5hkscs_bmp_encmap+24168,3,245},{ -__big5hkscs_bmp_encmap+24411,20,245},{__big5hkscs_bmp_encmap+24637,14,245},{ -__big5hkscs_bmp_encmap+24869,12,255},{__big5hkscs_bmp_encmap+25113,2,255},{ -__big5hkscs_bmp_encmap+25367,2,124},{__big5hkscs_bmp_encmap+25490,2,252},{ -__big5hkscs_bmp_encmap+25741,10,254},{__big5hkscs_bmp_encmap+25986,2,179},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{__big5hkscs_bmp_encmap+26164,7,7},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{__big5hkscs_bmp_encmap+26165,2,237}, -}; - -static const DBCHAR __big5hkscs_nonbmp_encmap[29306] = { -40049,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37749,N,N,N,N,N, -N,N,37750,N,N,N,N,N,N,N,38216,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,36550,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35781,35834, -N,N,51324,N,N,N,N,N,N,N,N,N,39604,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34894,34891, -51322,34888,N,N,N,34887,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,41206,34885,N,34899,N,N,N,N,N,N,N,N,N,64685,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36085,N,N,N,N,35501,N,37490,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,64583,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38111,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40913,64459,N,N,N,N,N,N,N,37501,N,N,N,N,N,N,N, -39076,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36089,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38119, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37067,37499,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38104,N,N,N,N,64607,N, -64084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39605,N,N,N,N,N,N,N,38618, -37497,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64116,37493,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36347,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35401,N,N,N,37599,39804,64099,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,64096,37485,64098,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39606,N,N,N,N,N,N,38763,N,N,N,N,N,N,N,N,N,N,N,N, -N,64874,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64852,N,37491,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38872,N,N,N,N, -N,N,40891,37698,37494,N,N,N,N,N,N,N,N,N,N,64101,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37484,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64110,N,N,N,N,N,N,40672,N,N,37568,37567,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,37566,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39610,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35507,N,38773,64064,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64118,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64464,N,N,N,N,N,N,N,N,N,N,N,N,N,64123,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,65133,N,N,N,N,N,N,39859,N,N,N,N,N,35276,N,N,N,N,39614,N,N,N,N,N, -N,N,N,N,64066,37564,N,N,N,N,N,N,N,N,N,N,37980,39861,N,N,N,39615,N,N,N,39079, -38820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37117,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64635,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39616,37571,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35498,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39888,38224,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37574,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39078,38214,N,N,N,N,N,N,N,N,N,N,N,N,64867,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64194,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40643,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35250,40038,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36947,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,35938,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,38849,N,N,N,N,N,N,N,N,N,N,N,N,N,39620,N,N,N,N,N,N,N,N,N,N,39621,36591,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,64233,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36160,N,N,N,N,N,N,N,N, -37474,35575,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39622,N,N,N,N,N,N,37601, -N,N,N,N,39625,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64198,N,N,N,N,N,N,N, -N,38821,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39627,N,N,N,64114,35422,N,38112,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,37580,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35557, -N,N,N,N,N,65116,39628,N,N,N,N,N,40441,35395,35494,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,39629,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39630,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,64238,39884,N,N,N,39631,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39633,N,N,N,N,N,N, -N,N,40442,N,N,N,N,N,40316,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39635,N,N,38822,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39263,N,N,N,64502, -40901,35417,35691,N,N,N,N,N,N,39636,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39637,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38818,35396,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40778,N,N,N,N,N,N,N,N,37025,64932,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35428, -35570,35576,40408,N,N,38102,64254,64423,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,39638,N,40781,N,N,64246,N,N,N,N,N,N,N,35415,N,35651, -35652,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35510,N,N,N,N,N,35520,N,N,N, -N,N,N,N,N,N,N,40532,N,N,N,N,N,N,N,N,N,N,39639,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39640,39644,N,N,N,N,35530,40616,N,N,37475,39645,35685,35695,35710,N, -N,N,N,36675,N,N,N,N,N,N,37584,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35572,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40382,N,N,N,N,N,39649,N,64734,40445,35686, -35696,35701,35556,35748,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35565,N,N,N,N,N,N,N,N, -N,35421,N,35656,N,N,N,N,40429,N,N,N,N,40512,N,N,N,N,N,N,N,35567,35574,40566,N, -N,N,N,N,N,N,N,N,40675,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,39646,36350,N,N,N,N,64252,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,40113,40567,35684,35687,38731,N,N,N,N,N,N,N,N,38483,N,N,N,N,N,N,39648, -35658,N,35569,35543,N,N,N,N,N,N,N,N,N,41131,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35509,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35423,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35566,N,N,39647,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35582,N,N,N,N,N,N,35416, -35747,35751,N,N,N,N,N,39651,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,37473,N,N,N,N,N,N,N,N,N,N,40407,40573,40615,40619,36930,N,N, -N,N,N,N,N,N,35705,35706,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39654,N,N,N,N,N,N,N,N,N,N,N,N,39653, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35454,N,N,N,N,N,40516,39655,35452,35697,N, -N,39657,N,N,N,N,N,N,N,N,N,N,N,N,39658,N,N,N,N,N,N,N,N,N,N,N,N,N,39659,N,N,N,N, -N,N,35517,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64334,N,N,N,N,N,N,N,N,N, -N,39661,35577,40547,N,N,N,N,N,35657,35534,35694,N,N,N,N,N,35560,N,N,N,39662,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37582,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35418,35707, -35708,39663,N,N,N,N,N,N,N,N,N,N,N,39664,N,35578,N,N,N,N,N,N,N,35137,N,N,35698, -N,N,N,N,N,N,35571,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35752,N,N,N,N,N,N,40622,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40562,64371, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64351,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37050,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37374,40694, -N,N,N,N,N,N,38893,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39667,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,41198,38524,37701,39022,64086,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39669,N,N, -N,64587,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39668,65246,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64695,N,N,N,N,N,N,N,N,N,38897,N,N,N,38855,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40139, -37440,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,40168,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37373,38734,N,N,64360,N,N,N,N,N,N,N, -N,N,N,N,N,N,38764,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36034,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38888,N,64362,35700,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,36583,N,N,N,N,N,N,N,N,N,N,N,N,64968,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,37441,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38561,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,36595,39671,N,N,N,N,N,N,N,N,N,N,36774,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,64214,40135,N,N,N,N,N,N,N,N,64215,N,N,N,N,N,39672,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64417,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36549,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64420,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,64450,N,39617,N,N,N,N,N,37370,65243,38827,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37191,N,64433,N,N,N,N,N,N,N,N,N,36842,N,N,N,N,N,N,38098,65121,64206,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,37613,37363,37830,N,37722,64251,N,N,37615,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64200,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38983,37734,38997,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38630,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40771,40874,38106,37614,64687,64507,N, -36601,37366,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37732,N,N,N,N,38133,40118,64429, -38990,36676,38653,N,N,N,N,N,N,N,N,N,N,N,N,N,39673,N,N,N,39674,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,38761,38356,38987,64426,N,N,39036,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,37354,N,N,N,N,N,40367,40389,N,37361,36529,38825,64428,64696,40121,N,N,N,N, -N,N,N,64432,64722,37835,N,N,39677,N,N,N,N,N,N,N,N,N,N,N,37364,35756,41045,N,N, -N,N,38260,N,N,N,N,38334,N,N,N,N,N,N,N,N,N,N,N,N,38829,N,N,N,N,N,N,N,N,N,N,N, -36585,N,N,37624,38846,37228,38058,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64611,N, -N,N,40390,N,N,N,N,N,N,N,38837,37560,37359,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,65190,38752,37720,38262,36780,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,37356,38836,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37367,N,N,N,N, -38730,64329,38264,37820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,37334,37717,37718,38993,N,N,N,N,N,N,N,N,N,N,36856,64448,37874,N,N, -37072,N,N,N,N,N,N,40004,N,N,N,N,N,37461,N,N,N,N,37731,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,37285,N,N,N,N,N,N,N,N,41197,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,64875,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39678,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,37713,N,N,N,35927,N,N,64120,N,N,N,N,65192,N,N,N,N,N,N,N,N,N,N,N,N,N,37712, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64076,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37623,39744,N,N,N,N,N,N,64462,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,39745,N,N,N,N,N,65197,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,34657,64469,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35778,39548,39746,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39747,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40569,N,N,64473,N,N, -N,N,N,N,39748,41127,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34670,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,39923,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,35961,N,N,N,37726,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35275,N,N,N,N, -N,N,40787,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37847,N,N,N,N,N,N, -N,N,N,N,N,N,N,64481,65232,N,N,N,N,N,N,36081,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,64482,N,N,N,N,N,64739,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,36980,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64486,N,N,N,39863,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,39749,N,N,N,N,N,N,N,N,N,N,N,N,39751,40784,N,N,N,N,N,39752,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64603, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,39081,N,N,40189,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,34892,39755,N,N,N,64492,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35945,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39848,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35541,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64115,64857,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37282,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64493,N,N,N,N,N,N,40105,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35496,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36162,N,39875,35553,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39758,38352,N, -N,N,36959,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38894,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64590,N,N,N,N,N,N,39759,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39760,40646,N,N,N,N,N, -N,N,N,N,N,N,64592,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64883,N,N, -N,N,N,64935,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40354, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64088,64094,N,N,N,N,N,N,N,41049,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64117,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64446,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40098,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37744, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,37745,37751,65263,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37741,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64605,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,37048,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35580,N, -64321,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40555,38115,36578,35965,N,36567,N,N,N,N,N,N, -40013,N,N,N,38563,N,N,N,N,N,N,N,N,N,N,39761,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35523,N,N,N,N,N,N,N,N,N,N,N,38570,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36066,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64616,35693,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64871,35561,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64673,37740,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,39762,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65136,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,64680,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64745,40116,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,35562,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39763,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39765,N,N,N,38571,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,64679,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39766,35516,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35531,N,N,N,N,N,39767,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,35277,N,39769,39771,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37797,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39773,N,N, -N,40527,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37795,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35451,N,N,N,35650,38736,36787,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35408,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39776,N,N,N,N,35653,N,N,N,35654,N,N,N,N,N,N,N,N,N,N,N,N,40446,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39778,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37755,N,N,N,N,N,37809,N,N,N,N,N,N,N,35424,N,N,N,N,N,N,N, -N,35544,N,N,N,N,39779,N,N,N,N,N,N,N,N,N,N,35433,N,N,N,35399,N,N,35532,37756, -39781,N,N,N,N,N,N,N,N,N,39782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35442,N,N,N,N,N,N,N,35450,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37807,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35504,N,N,N,N,N,N,N,39784, -N,N,N,N,N,N,N,N,N,N,40611,N,N,64236,35703,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39783,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35673,64689,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64699,N,N,N,N,N,N,N,N,N,N,N, -39785,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37800,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35552,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,40529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36703,39786,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,39787,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38892,39788,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,65102,N,N,N,N,N,N,64962,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37223, -64716,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37814,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37092,N,N,N,N,37093,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40690,37834,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,35772,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36678,N,N, -N,N,37839,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64731,64732,N,N,N,N,N,N,N,N,N,N,N,N,N,37824,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,64742,38631,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64728,64729,64934,37838,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,38385,N,N,N,N,N,N,N,N,N,40169,N,64740,38063,64119,37836,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36065,N,N,N,N,N, -N,N,N,N,N,N,36954,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35924,N,N,N,N,N,N,N,37823,64337,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,37817,65239,37815,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37849,N,N,N,N,N,N,N,N,N,N,N,N,N,37819,37850, -39075,N,N,N,N,N,N,N,N,N,37073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39790,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64112,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39915,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39791,N,N,N,N,N,N,N,64764,N,N,N,N,N,N,N,N,N,N,N,N,N,35648,41083,N,N,N,36001, -38903,N,N,N,37858,64726,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38233,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37798,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64832,N,N,37727,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38898,40054,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,36600,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36075,N,N,N,N,N,N,N,N,36679,N,N,N,N,N,N,N,N,N,N,N,N,39796,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37556,N, -N,N,37357,N,N,38610,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64838,36687,38217,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39797,64092,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,34641,N,N,39801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64843,N,N,N,38611,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64856,N,N,N,N,N,37983,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,41205,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,37443,N,N,N,N,N,N,38906,N,N,N,N,N,N,N,N,N,N,N,N, -40409,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38900,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37453,64859,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,39802,N,N,N,N,N,N,N,N,N,40661,N,N,N,N,N,N,N,N,N,N,N,N,64174,N,40137,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,37464,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,36552,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,38068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37857,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37855,N,N,N,N,N,64752, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37868,38902,38607,37854,35535,39842,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64873,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37714,N,N,N,N,N,N, -N,N,N,N,N,39074,36071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64878, -36004,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64124,37882,36988,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,36711,N,40375,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41193, -64078,64929,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40564,40895,40651,39865,40404,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38841,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36593,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38267, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40658,38739,38564,36798,38105,36952,64889,64891,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36570,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36602,34658,N,N,N,N,N,N,N,N,N,N,39845,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,40665,38868,37051,64956,64966,37448,N,N,N,N,N,N,N, -37557,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,40385,37561,37542,36683,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39846,N,N,N,N,N,37558,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36416,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,40664,37982,39007,38094,37450,64880,37991,N,N,N,N,N,N,N, -N,N,N,N,36332,N,N,N,N,N,N,N,N,39896,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,34659,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37960,64193, -40183,64958,N,N,N,N,N,N,N,N,N,N,N,N,36826,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64985,N,N,64638,N,N,N,N,N,N,N,N,37881,N,N, -N,N,64067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,64235,64195,38867,38393,40008,64984,41176,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64983,64330,39855,37963,64969, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36524,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64946,N,N, -N,N,N,37466,64701,37593,N,N,N,64981,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37597,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37465,N,N,N,N,N,N,N,N,N,N,36080, -38586,N,N,N,N,N,N,N,N,N,N,37467,N,N,N,N,N,N,N,N,N,39851,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64986,64990,N,N,N,64979,N, -N,N,N,N,N,N,N,N,35910,N,N,N,N,N,N,64982,64988,64989,N,N,N,N,37118,N,N,65185,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35757,N,N,40152,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40557,64892, -64353,N,N,N,N,N,N,38648,N,N,N,N,N,N,N,N,38640,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64756,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65120,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38994,38479,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37230,N,N,N, -N,N,N,N,N,N,N,39021,N,N,39012,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,37971,65004,64376,N,N,N,N,N,N,N,N,N,N,N,38330,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,39005,N,37625,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39002,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,34640,N,65014,N,N,N,N,N,N,N,37840,39010,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39853,N,N,N,N,N,N,N, -N,N,N,N,38735,39854,N,N,N,N,N,N,N,N,N,N,N,N,37970,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39856,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37330,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38890,64363,37297,65011,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37579,N,N,N, -N,N,N,N,N,N,39857,N,N,N,N,N,64748,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,39019,N,N,N,38737,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39025,38383,N,N,N,N,N,N,N,40691,N,N,N,N, -N,37352,39866,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64332,37482,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65016,39009,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,37351,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37869,38724,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,37345,N,N,64501,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39017,N,N,N,N, -35426,N,N,39867,36008,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40021,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36471,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35506,40636,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37862,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37794,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39869,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37757,40550,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37977,N,N,N,N,N,N,N,N,N,39871,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,37976,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40613,39879,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,65108,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36468,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,35798,N,N,N,N,N,N,38070,64884,39104,38053,N,N,N,N,N,N,N, -39880,N,N,N,38381,64894,64491,N,N,N,N,N,N,N,N,N,N,64893,N,N,N,N,N,N,N,N,N, -38767,37985,N,40897,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38359,N,N,N, -64082,40024,N,N,N,N,N,N,N,N,N,40808,39911,64718,38632,64073,38817,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38221,40696,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,65097,37326,38769,N,N,N,N,36047,N,N,N,64945,N,N,64622,N,N,N,N,N, -40178,37816,36931,38745,38103,65126,38013,64623,N,N,N,N,37446,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64109,N,N,36599,N,64439,N,38012,37581,38834,N,N,N,N,N,N,N,N,N, -65125,38526,38744,39799,37327,N,N,N,N,N,N,N,N,N,38052,N,N,N,N,N,N,N,N,N,N, -40109,N,N,N,N,N,N,N,N,N,35755,N,N,N,38613,64691,N,N,N,37806,N,38765,N,N,N,N,N, -N,37958,38391,N,N,N,N,N,N,N,N,40006,38235,37329,38132,N,65127,37541,N,N,N, -65247,36011,N,39881,N,N,N,N,N,N,N,N,N,N,N,64749,65018,64712,65122,37372,65131, -65017,64711,37198,40120,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38759,N,N,N, -38382,N,N,39858,N,N,N,N,37984,N,N,N,38050,39029,38828,37331,N,N,N,N,N,N,N,N,N, -N,N,39035,N,N,N,N,N,N,N,36587,38762,38494,N,N,N,N,N,N,N,N,N,38891,N,N,N,N,N, -40953,38392,65186,36838,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65150,N,N,N,N,N,N, -40356,38760,36588,38077,N,N,N,N,N,N,N,N,N,N,N,N,N,37979,40182,64167,39897,N,N, -N,N,N,N,N,N,N,64093,38486,38754,N,N,N,N,N,N,38074,41039,37592,N,N,N,39883,N,N, -N,N,N,N,38075,N,N,40287,N,N,N,N,N,N,37071,N,N,N,N,N,N,N,N,N,N,N,N,N,37989,N,N, -40780,N,N,N,N,N,N,37080,36187,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40638,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64365,38346,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,40386,38904,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36860,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38003, -38004,N,N,N,N,N,N,N,N,N,N,N,N,65207,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35403,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35413,35689,35548,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35702,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39886,N,35432,41208,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,39135,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,65205,N,N,N,39887,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38651,N, -N,39931,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40654,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36581,N, -N,N,N,N,N,N,N,N,40571,39890,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,35493,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,65230,35397,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,40444,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65231,35749,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35914,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,35564,N,N,64736,38061,65237,38060,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64602,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39894, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,35439,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35753,36447,N,N,40395,N, -64743,39895,N,N,N,N,N,N,N,N,N,N,N,37832,N,N,N,N,N,N,N,N,N,37360,36832,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39899,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37101,N,39900,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36179,41196,N,N,N, -39162,N,N,N,N,N,N,N,N,N,39904,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37831,37449,38625,39906,N,N,N,39908,N,N,36833,39909,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38080,N,N,37827,N,N,N,N,N,N,N,N,N,N,37829,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36985,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38779,N,N,N,N,N, -36990,N,N,N,N,65254,65094,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40376,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,37488,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38312,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36016,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,38088,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39097,37184,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64702,N,N,N,N,N,N,N,37207,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35762,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64223,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,39910,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38467,36420,40015,65268, -N,N,N,N,N,39912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37852,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38511,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36426,39917,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37622,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40377,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,36430,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,64463,34656,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40642, -N,N,N,N,N,N,38117,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39920,38116,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,38225,35771,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39921,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,38128,36452,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38122,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36705,N,N,N,39780,36443,N,N,N,N, -39922,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40894,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40393,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36460,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36723,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,36015,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,36725,36465,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36448,36458,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,35916,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38226,38228, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35540,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40379,38211,37630,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,38130,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38129,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41194,40402,41137,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37368, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37986,39844, -36525,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40621,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38608,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65262,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,35508,N,N,N,N,N,N,N,N,N,N,N,N,38743,35447,39927,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36533,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41069, -36534,38742,38208,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,41203,38078,N,N,N,39930,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64991,40380,N,N,N,N,N,N,N, -N,38142,N,N,N,N,N,N,N,N,35803,41214,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,36544,40775,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35806,41211,N,N,N,N, -36547,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38473,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,65218,N,N,38220,39933,N,N,N,N,N,N,N,N,N,N,N,N,N,37068, -40032,38219,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39934,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40048,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,40003,N,N,N,40007,36556,N,N,N,36436,N,N,N,N,N,N,N,N,N,N,36580, -40009,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35678,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38238,N,N,N,N,N,N,N, -N,N,N,N,N,38236,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40011,35809,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36569,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40372,N, -37471,N,N,N,40012,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,35489,N,N,N,N,N,N,N,N,N,N,N,N,N,36571,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40022,35490,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38740,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40030,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40660,38248,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,41155,35558,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,41207,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40033,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64589,N,40539,N,N,N,N,N,N,N,N,40553,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40035,65223,N,N,65222,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40039,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40041,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,37221,N,N,N,N,N,N,N,N,N,N,N,N,40167,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,35412,N,N,N,N,N,N,N,40044,40046,65117,N,N,N,N,N,40051,N, -N,N,N,N,N,N,N,N,N,N,N,N,38250,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38253,36592,36685,N, -N,N,N,36598,N,N,N,N,N,N,N,N,64188,N,36053,N,N,N,N,N,N,N,N,N,N,N,N,N,34654,N,N, -N,N,64474,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,35660,64885,39901,64245,N,N,N,N,N,N,N,40052,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,38213,N,N,N,N,N,N,N,N,N,N,N,N,38598,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,36714,36686,N,N,N,N,N,40056,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64085,N,N,N,N,N,N,N,N,N,N,N,N,38884,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40001,37468,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38650,36086,N,N,N,N,36173,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64358,36453,38985, -64424,38978,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40058,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38907,37066,N,N,N,N,40027,N,N,38733, -N,N,36563,N,N,N,N,N,N,N,N,N,N,N,N,N,38241,40779,40885,37842,64938,38976,37190, -39015,64090,64425,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,38977,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,36051,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64765,64939,37309,36684,38601,36693,64430,38255,N,N, -N,N,N,N,40061,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,41200,N,N,N,N,N,N,N,N,N,N,N,N,N,37999,64940,N,N,N,N, -38603,38606,N,N,N,N,41046,N,40161,N,N,N,N,N,N,N,N,N,N,38596,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -36702,36716,36515,64435,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64595,N,N,N,64947,N,N,N,N,36715,N,N,N,N,N,N,N,N,N,N, -N,N,38602,N,N,N,N,N,N,34643,N,N,N,N,N,N,N,N,N,N,N,N,N,36729,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,40559,41157,64632,36418,36698,37058,36517,36961,37455,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37747,64949,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,65228,N,64445,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36054, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38979,38597, -35260,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40099,N,N,N,N,N,N,37451,38986, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,36772,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,41201,40699,40146,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,36775,N,N,N,N,34644,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64604,38981,N,N,36934,36049,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65274,38240,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,40776,37447,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37115,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40100,38257,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,34629,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40102,N,N,N,N, -40103,N,N,N,N,N,40106,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,40659,N,N,N,40560,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40108,34642,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36782,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,36176,38269,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40112,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38838,N,41149,35551,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40618,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,36797,N,N,N,36799,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37737, -39847,51364,N,N,N,N,65258,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,39905,N,N,N,N,N,N,35649,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,40374,41195,39843,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,35745,36808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,35148,39008,N,N,N,N,N,N,N,N,N,N,38087,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,35672,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38315,38314,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,40131,40132,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37846,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,40364,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35814,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35441,36817,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,39381,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37108,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35491,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40142,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40148,40149,N,N,N,64456,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40371,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64624,N,N,N,N,N,36823,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39795,N,N,N,N,N,N,N,N,N,N,64091,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36818,36964,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39094, -38504,N,N,N,N,40150,N,N,N,N,N,N,N,N,N,N,N,N,39101,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36828,65270,36825,N,N,N,N,N,N,N,N,N,N,N,N,N, -38209,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,34668,N,N,N,N,38899,39928,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -34650,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34632,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34634,40556,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36850,36846,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40151,N,N,N,N,N,N,N,N,N,N,N,N,40558,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35392,N, -N,N,N,N,N,N,N,N,N,36847,N,N,N,N,N,N,N,N,36852,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36853,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38338,39018,N,38863,40677,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40572, -36929,N,N,N,N,N,N,40155,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37953,N,N,N,N, -40166,40368,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,40170,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40173,N,N,N,N,N,N,N,N,N,N,N,N, -40186,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,35682,35406,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40138,35430,N,N,N,N,N,N,N,N,N,N,40187,40188,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40190,N,N,N,N,N, -N,N,N,N,N,N,N,N,35411,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40165,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40256,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40257,N,N,N,N,N,N,N,N,N,N,N,N,36933,35699, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38858,N,40258,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,35425,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,35758,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35538,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,35746,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40434, -40259,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40159,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,40260,N,N,N,N,N,N,N,N,N,N,36554,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36942,N,N,N,N,N,N,N,36531,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,40949,N,N,N,N,N,N,N,N,N,N,N,N,40261,36943,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,40263,N,N,N,35274,N,N,N,N,N,N,40117,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64510, -36958,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36963,36951,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36966,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,39872,N,N,N,N,N,N,N,N,N,N,N,64741,37218,N,N,N,N,N,N,N,N,N,N,36967,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36769,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,36770,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40264,64211,N,N,N,N,N,N,36175,N,N,N,N,N,N,N,N,N,36957,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37049,N,N,N,N,N,N,N,N,N,N,N,N,N,36971, -35932,N,N,N,36969,65111,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,65109,36979,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -39919,40176,N,N,N,N,N,N,N,N,N,N,N,N,40267,N,N,N,N,N,N,N,N,N,N,N,N,N,65241,N,N, -N,65242,N,N,N,37344,36163,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37336,N,N,N,N,N,N,N, -N,N,N,38470,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37728, -N,64083,40147,N,N,N,N,N,N,N,N,N,N,N,N,40270,N,N,N,64320,N,N,N,36322,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37954,N,36950,N,N,39013,N,35948, -64074,N,N,40272,40274,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38319,38746,37705,38727, -41204,N,N,N,N,N,N,38776,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36815,N,N,N,64608,N,N,N,N, -N,N,N,N,35918,N,N,N,64598,N,N,N,N,N,N,N,N,N,N,N,N,N,37340,38497,37612,37725, -36574,38654,64847,38366,N,N,N,N,N,N,N,N,N,N,N,N,N,39088,41024,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38845,38781,38901, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39852,64218,37570,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38833,N,N,N,N,N,36987,N, -N,N,N,37886,38011,N,38775,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64190,64835,37062, -37028,37032,38057,N,37033,N,N,N,N,35941,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38368,36989,N,N,N,N,N,N,37477,N,N,N,N,N,N,N,N,N,N,N,N,N,64954,37828,N,N,N,N,N, -N,N,N,65261,40363,41187,N,38472,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40275,N,N,N,N,N,35497,N,39877,N,38493,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -38751,38495,38510,64349,N,N,N,N,N,40369,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65187,N,N,N,N,N,N,N,N,N,40370,N,N,38318,64675,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34665,N,N,N,N,N,N,N,N, -41122,N,N,38485,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40276,N,N,37697,N,38317,37333,N,N, -N,N,N,N,N,N,N,N,N,N,38778,65020,36423,37885,37029,37036,N,N,N,N,N,N,N,N,38316, -N,N,N,N,N,N,N,N,N,37038,65189,N,N,N,N,N,40278,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,38883,38370,N,N,N,N,N,37990,N,N,38471,N,N,N,N,37304,N,N,N,N,40172,N,N,N,N, -N,N,N,N,37037,N,38371,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35663, -N,N,35555,N,N,N,N,35661,38378,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35662,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36033, -35821,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,37337,N,N,41124,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38389,38388,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40883,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,65199,N,N,N,N,N,65138,37498,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65196,N,N,N,N,N,N,N,N,N,N,N, -N,N,38387,40280,36166,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37746,N,N,37317,N,N,N,N,N,N, -N,38466,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37069,38398, -37209,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40037,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38860,37070,N,N,N,N,N,N,40281,64757,65277,N,N, -40283,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,40284,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37758,N,N,N,N,N,N,N,N,N,N, -N,N,N,39084,N,N,40286,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64976,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64864,N, -N,N,N,N,N,N,N,N,N,N,40143,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37085,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37088,37107,N,N,39089,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37104,N,N,N,N, -N,N,N,N,N,N,N,37821,N,N,N,N,N,N,N,N,38327,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40774,N,N,N,N,N,N,N,N,36427,38488,N,N,N,N,N,N,N,N,N,N,35404,N,40291,40655,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40293,N,N,N,N,N,N,N,40294,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38490,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40292,N,N,N,N,N,N,N,N,N,N,35436,35545,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40295, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,35440,35827,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37200,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,40129,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,40296,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37799,N,N,N,N,N,N,38516,N,N,N,N,N,N,N,N,36093,41199,N,37201,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38593,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34679,N,35940,38518,40297,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,64676,N,N,N,N,N,N,N,N,N,N,N,N,40298,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37454,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,40299,N,N,N,N,N,39873,40300,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,35429,37213,N,N,N,N,N,N,N,N,40301,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37210,35906,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40128,37226,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,40302,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,40614,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40397,N,N,40303,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35259,40697,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,38580,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,37234,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -40648,N,N,N,34673,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35669,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,40305,40306,N,N,N,N,N,N,N,N,N,N,N,N,40652,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,37236,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,40656,36956,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,36562,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37288,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37239,N,N,N,N,N,N,N,N,N,N,N, -38591,N,N,N,N,N,38592,N,N,N,N,36785,N,N,N,N,N,38583,35925,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37240,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35262, -37244,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64375,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37237,37283,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,37238,N,N,N,N,N,N,N,N,38590,36169,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,37241,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,38582,37284,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -37286,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40309,N,N,N,N,N,N,N,N,N,N,N,36946,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41029,N,37289,N,39082,N,N,N,35935,N,N,35754,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40157,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40311,34646,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,35136,40684,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,37802,38008,N,N,N,N,40314,35529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35659,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40940,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -35554,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,40565,39028,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,39624,N,N,N,N,41031, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,35779,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64584,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64631,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,40018,36605,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36776,N,N,N,N,N,N,N,N,N, -38266,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,36848, -}; - -static const struct unim_index big5hkscs_nonbmp_encmap[256] = { -{__big5hkscs_nonbmp_encmap+0,33,238},{__big5hkscs_nonbmp_encmap+206,12,242},{ -__big5hkscs_nonbmp_encmap+437,4,229},{__big5hkscs_nonbmp_encmap+663,10,252},{ -__big5hkscs_nonbmp_encmap+906,19,254},{__big5hkscs_nonbmp_encmap+1142,71,235}, -{__big5hkscs_nonbmp_encmap+1307,17,118},{__big5hkscs_nonbmp_encmap+1409,14,121 -},{__big5hkscs_nonbmp_encmap+1517,44,213},{__big5hkscs_nonbmp_encmap+1687,22, -231},{__big5hkscs_nonbmp_encmap+1897,17,205},{__big5hkscs_nonbmp_encmap+2086, -13,255},{__big5hkscs_nonbmp_encmap+2329,11,255},{__big5hkscs_nonbmp_encmap+ -2574,21,200},{__big5hkscs_nonbmp_encmap+2754,4,251},{__big5hkscs_nonbmp_encmap -+3002,29,237},{__big5hkscs_nonbmp_encmap+3211,20,246},{ -__big5hkscs_nonbmp_encmap+3438,47,217},{__big5hkscs_nonbmp_encmap+3609,60,254 -},{__big5hkscs_nonbmp_encmap+3804,2,254},{__big5hkscs_nonbmp_encmap+4057,19, -253},{__big5hkscs_nonbmp_encmap+4292,119,150},{__big5hkscs_nonbmp_encmap+4324, -10,254},{__big5hkscs_nonbmp_encmap+4569,13,252},{__big5hkscs_nonbmp_encmap+ -4809,32,250},{__big5hkscs_nonbmp_encmap+5028,3,243},{__big5hkscs_nonbmp_encmap -+5269,45,99},{__big5hkscs_nonbmp_encmap+5324,68,194},{ -__big5hkscs_nonbmp_encmap+5451,42,172},{__big5hkscs_nonbmp_encmap+5582,70,249 -},{__big5hkscs_nonbmp_encmap+5762,28,213},{__big5hkscs_nonbmp_encmap+5948,15, -232},{__big5hkscs_nonbmp_encmap+6166,69,252},{__big5hkscs_nonbmp_encmap+6350, -42,195},{__big5hkscs_nonbmp_encmap+6504,8,124},{__big5hkscs_nonbmp_encmap+6621 -,33,250},{__big5hkscs_nonbmp_encmap+6839,101,237},{__big5hkscs_nonbmp_encmap+ -6976,19,190},{__big5hkscs_nonbmp_encmap+7148,27,246},{ -__big5hkscs_nonbmp_encmap+7368,18,205},{__big5hkscs_nonbmp_encmap+7556,3,247}, -{__big5hkscs_nonbmp_encmap+7801,38,147},{__big5hkscs_nonbmp_encmap+7911,102, -232},{__big5hkscs_nonbmp_encmap+8042,14,206},{__big5hkscs_nonbmp_encmap+8235, -38,201},{__big5hkscs_nonbmp_encmap+8399,7,238},{__big5hkscs_nonbmp_encmap+8631 -,13,239},{__big5hkscs_nonbmp_encmap+8858,116,227},{__big5hkscs_nonbmp_encmap+ -8970,51,218},{__big5hkscs_nonbmp_encmap+9138,3,249},{__big5hkscs_nonbmp_encmap -+9385,15,225},{__big5hkscs_nonbmp_encmap+9596,0,254},{ -__big5hkscs_nonbmp_encmap+9851,0,229},{__big5hkscs_nonbmp_encmap+10081,25,243 -},{__big5hkscs_nonbmp_encmap+10300,0,238},{__big5hkscs_nonbmp_encmap+10539,3, -215},{__big5hkscs_nonbmp_encmap+10752,58,58},{__big5hkscs_nonbmp_encmap+10753, -194,194},{__big5hkscs_nonbmp_encmap+10754,167,250},{__big5hkscs_nonbmp_encmap+ -10838,26,90},{__big5hkscs_nonbmp_encmap+10903,99,255},{ -__big5hkscs_nonbmp_encmap+11060,64,248},{__big5hkscs_nonbmp_encmap+11245,6,252 -},{__big5hkscs_nonbmp_encmap+11492,53,240},{__big5hkscs_nonbmp_encmap+11680, -17,236},{__big5hkscs_nonbmp_encmap+11900,4,252},{__big5hkscs_nonbmp_encmap+ -12149,27,250},{__big5hkscs_nonbmp_encmap+12373,13,248},{ -__big5hkscs_nonbmp_encmap+12609,4,214},{__big5hkscs_nonbmp_encmap+12820,5,200 -},{__big5hkscs_nonbmp_encmap+13016,24,212},{__big5hkscs_nonbmp_encmap+13205,6, -224},{__big5hkscs_nonbmp_encmap+13424,18,255},{__big5hkscs_nonbmp_encmap+13662 -,0,251},{__big5hkscs_nonbmp_encmap+13914,14,233},{__big5hkscs_nonbmp_encmap+ -14134,15,245},{__big5hkscs_nonbmp_encmap+14365,9,217},{ -__big5hkscs_nonbmp_encmap+14574,6,235},{__big5hkscs_nonbmp_encmap+14804,59,167 -},{__big5hkscs_nonbmp_encmap+14913,14,194},{__big5hkscs_nonbmp_encmap+15094, -44,157},{__big5hkscs_nonbmp_encmap+15208,43,231},{__big5hkscs_nonbmp_encmap+ -15397,32,216},{__big5hkscs_nonbmp_encmap+15582,14,19},{ -__big5hkscs_nonbmp_encmap+15588,25,154},{__big5hkscs_nonbmp_encmap+15718,49, -224},{__big5hkscs_nonbmp_encmap+15894,5,246},{__big5hkscs_nonbmp_encmap+16136, -6,225},{__big5hkscs_nonbmp_encmap+16356,87,225},{__big5hkscs_nonbmp_encmap+ -16495,3,204},{__big5hkscs_nonbmp_encmap+16697,84,233},{ -__big5hkscs_nonbmp_encmap+16847,116,232},{__big5hkscs_nonbmp_encmap+16964,1, -254},{__big5hkscs_nonbmp_encmap+17218,32,67},{__big5hkscs_nonbmp_encmap+17254, -14,216},{__big5hkscs_nonbmp_encmap+17457,26,226},{__big5hkscs_nonbmp_encmap+ -17658,41,165},{__big5hkscs_nonbmp_encmap+17783,2,221},{ -__big5hkscs_nonbmp_encmap+18003,88,208},{__big5hkscs_nonbmp_encmap+18124,53, -248},{__big5hkscs_nonbmp_encmap+18320,2,152},{__big5hkscs_nonbmp_encmap+18471, -18,191},{__big5hkscs_nonbmp_encmap+18645,18,252},{__big5hkscs_nonbmp_encmap+ -18880,22,204},{__big5hkscs_nonbmp_encmap+19063,28,199},{ -__big5hkscs_nonbmp_encmap+19235,14,250},{__big5hkscs_nonbmp_encmap+19472,45,82 -},{__big5hkscs_nonbmp_encmap+19510,5,247},{__big5hkscs_nonbmp_encmap+19753,33, -209},{__big5hkscs_nonbmp_encmap+19930,34,240},{__big5hkscs_nonbmp_encmap+20137 -,0,215},{__big5hkscs_nonbmp_encmap+20353,38,223},{__big5hkscs_nonbmp_encmap+ -20539,14,248},{__big5hkscs_nonbmp_encmap+20774,9,205},{ -__big5hkscs_nonbmp_encmap+20971,27,230},{__big5hkscs_nonbmp_encmap+21175,82, -255},{__big5hkscs_nonbmp_encmap+21349,34,134},{__big5hkscs_nonbmp_encmap+21450 -,116,254},{__big5hkscs_nonbmp_encmap+21589,7,148},{__big5hkscs_nonbmp_encmap+ -21731,15,204},{__big5hkscs_nonbmp_encmap+21921,88,200},{ -__big5hkscs_nonbmp_encmap+22034,36,253},{__big5hkscs_nonbmp_encmap+22252,10, -244},{__big5hkscs_nonbmp_encmap+22487,6,244},{__big5hkscs_nonbmp_encmap+22726, -18,197},{__big5hkscs_nonbmp_encmap+22906,47,220},{__big5hkscs_nonbmp_encmap+ -23080,77,79},{__big5hkscs_nonbmp_encmap+23083,46,249},{ -__big5hkscs_nonbmp_encmap+23287,2,244},{__big5hkscs_nonbmp_encmap+23530,46,188 -},{__big5hkscs_nonbmp_encmap+23673,7,226},{__big5hkscs_nonbmp_encmap+23893,6, -138},{__big5hkscs_nonbmp_encmap+24026,18,130},{__big5hkscs_nonbmp_encmap+24139 -,1,244},{__big5hkscs_nonbmp_encmap+24383,0,230},{__big5hkscs_nonbmp_encmap+ -24614,15,19},{__big5hkscs_nonbmp_encmap+24619,4,43},{__big5hkscs_nonbmp_encmap -+24659,51,252},{__big5hkscs_nonbmp_encmap+24861,15,252},{ -__big5hkscs_nonbmp_encmap+25099,12,255},{__big5hkscs_nonbmp_encmap+25343,3,210 -},{__big5hkscs_nonbmp_encmap+25551,52,185},{__big5hkscs_nonbmp_encmap+25685, -15,231},{__big5hkscs_nonbmp_encmap+25902,197,197},{__big5hkscs_nonbmp_encmap+ -25903,121,237},{__big5hkscs_nonbmp_encmap+26020,13,235},{0,0,0},{0,0,0},{ -__big5hkscs_nonbmp_encmap+26243,29,231},{__big5hkscs_nonbmp_encmap+26446,158, -244},{0,0,0},{__big5hkscs_nonbmp_encmap+26533,32,212},{ -__big5hkscs_nonbmp_encmap+26714,16,250},{__big5hkscs_nonbmp_encmap+26949,3,201 -},{__big5hkscs_nonbmp_encmap+27148,40,77},{__big5hkscs_nonbmp_encmap+27186,5, -213},{__big5hkscs_nonbmp_encmap+27395,115,173},{__big5hkscs_nonbmp_encmap+ -27454,62,246},{__big5hkscs_nonbmp_encmap+27639,6,248},{ -__big5hkscs_nonbmp_encmap+27882,35,222},{__big5hkscs_nonbmp_encmap+28070,20, -254},{__big5hkscs_nonbmp_encmap+28305,7,245},{__big5hkscs_nonbmp_encmap+28544, -32,255},{__big5hkscs_nonbmp_encmap+28768,81,169},{__big5hkscs_nonbmp_encmap+ -28857,52,91},{__big5hkscs_nonbmp_encmap+28897,198,203},{ -__big5hkscs_nonbmp_encmap+28903,1,169},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__big5hkscs_nonbmp_encmap+29072,37,205},{__big5hkscs_nonbmp_encmap+29241,148, -212},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jisx0213_pair.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jisx0213_pair.h deleted file mode 100644 index 3f1424f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jisx0213_pair.h +++ /dev/null @@ -1,59 +0,0 @@ -#define JISX0213_ENCPAIRS 46 -#ifdef EXTERN_JISX0213_PAIR -static const struct widedbcs_index *jisx0213_pair_decmap; -static const struct pair_encodemap *jisx0213_pair_encmap; -#else -static const ucs4_t __jisx0213_pair_decmap[49] = { -810234010,810365082,810496154,810627226,810758298,816525466,816656538, -816787610,816918682,817049754,817574042,818163866,818426010,838283418, -15074048,U,U,U,39060224,39060225,42730240,42730241,39387904,39387905,39453440, -39453441,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,48825061,48562921, -}; - -static const struct widedbcs_index jisx0213_pair_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_pair_decmap -+0,119,123},{__jisx0213_pair_decmap+5,119,126},{__jisx0213_pair_decmap+13,120, -120},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_pair_decmap+14,68,102},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const struct pair_encodemap jisx0213_pair_encmap[JISX0213_ENCPAIRS] = { -{0x00e60000,0x295c},{0x00e60300,0x2b44},{0x02540000,0x2b38},{0x02540300,0x2b48 -},{0x02540301,0x2b49},{0x02590000,0x2b30},{0x02590300,0x2b4c},{0x02590301, -0x2b4d},{0x025a0000,0x2b43},{0x025a0300,0x2b4e},{0x025a0301,0x2b4f},{ -0x028c0000,0x2b37},{0x028c0300,0x2b4a},{0x028c0301,0x2b4b},{0x02e50000,0x2b60 -},{0x02e502e9,0x2b66},{0x02e90000,0x2b64},{0x02e902e5,0x2b65},{0x304b0000, -0x242b},{0x304b309a,0x2477},{0x304d0000,0x242d},{0x304d309a,0x2478},{ -0x304f0000,0x242f},{0x304f309a,0x2479},{0x30510000,0x2431},{0x3051309a,0x247a -},{0x30530000,0x2433},{0x3053309a,0x247b},{0x30ab0000,0x252b},{0x30ab309a, -0x2577},{0x30ad0000,0x252d},{0x30ad309a,0x2578},{0x30af0000,0x252f},{ -0x30af309a,0x2579},{0x30b10000,0x2531},{0x30b1309a,0x257a},{0x30b30000,0x2533 -},{0x30b3309a,0x257b},{0x30bb0000,0x253b},{0x30bb309a,0x257c},{0x30c40000, -0x2544},{0x30c4309a,0x257d},{0x30c80000,0x2548},{0x30c8309a,0x257e},{ -0x31f70000,0x2675},{0x31f7309a,0x2678}, -}; -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jp.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jp.h deleted file mode 100644 index 1dd865c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_jp.h +++ /dev/null @@ -1,4765 +0,0 @@ -static const ucs2_t __jisx0208_decmap[6956] = { -12288,12289,12290,65292,65294,12539,65306,65307,65311,65281,12443,12444,180, -65344,168,65342,65507,65343,12541,12542,12445,12446,12291,20189,12293,12294, -12295,12540,8213,8208,65295,92,12316,8214,65372,8230,8229,8216,8217,8220,8221, -65288,65289,12308,12309,65339,65341,65371,65373,12296,12297,12298,12299,12300, -12301,12302,12303,12304,12305,65291,8722,177,215,247,65309,8800,65308,65310, -8806,8807,8734,8756,9794,9792,176,8242,8243,8451,65509,65284,162,163,65285, -65283,65286,65290,65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651, -9650,9661,9660,8251,12306,8594,8592,8593,8595,12307,U,U,U,U,U,U,U,U,U,U,U, -8712,8715,8838,8839,8834,8835,8746,8745,U,U,U,U,U,U,U,U,8743,8744,172,8658, -8660,8704,8707,U,U,U,U,U,U,U,U,U,U,U,8736,8869,8978,8706,8711,8801,8786,8810, -8811,8730,8765,8733,8757,8747,8748,U,U,U,U,U,U,U,8491,8240,9839,9837,9834, -8224,8225,182,U,U,U,U,9711,65296,65297,65298,65299,65300,65301,65302,65303, -65304,65305,U,U,U,U,U,U,U,65313,65314,65315,65316,65317,65318,65319,65320, -65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332,65333, -65334,65335,65336,65337,65338,U,U,U,U,U,U,65345,65346,65347,65348,65349,65350, -65351,65352,65353,65354,65355,65356,65357,65358,65359,65360,65361,65362,65363, -65364,65365,65366,65367,65368,65369,65370,12353,12354,12355,12356,12357,12358, -12359,12360,12361,12362,12363,12364,12365,12366,12367,12368,12369,12370,12371, -12372,12373,12374,12375,12376,12377,12378,12379,12380,12381,12382,12383,12384, -12385,12386,12387,12388,12389,12390,12391,12392,12393,12394,12395,12396,12397, -12398,12399,12400,12401,12402,12403,12404,12405,12406,12407,12408,12409,12410, -12411,12412,12413,12414,12415,12416,12417,12418,12419,12420,12421,12422,12423, -12424,12425,12426,12427,12428,12429,12430,12431,12432,12433,12434,12435,12449, -12450,12451,12452,12453,12454,12455,12456,12457,12458,12459,12460,12461,12462, -12463,12464,12465,12466,12467,12468,12469,12470,12471,12472,12473,12474,12475, -12476,12477,12478,12479,12480,12481,12482,12483,12484,12485,12486,12487,12488, -12489,12490,12491,12492,12493,12494,12495,12496,12497,12498,12499,12500,12501, -12502,12503,12504,12505,12506,12507,12508,12509,12510,12511,12512,12513,12514, -12515,12516,12517,12518,12519,12520,12521,12522,12523,12524,12525,12526,12527, -12528,12529,12530,12531,12532,12533,12534,913,914,915,916,917,918,919,920,921, -922,923,924,925,926,927,928,929,931,932,933,934,935,936,937,U,U,U,U,U,U,U,U, -945,946,947,948,949,950,951,952,953,954,955,956,957,958,959,960,961,963,964, -965,966,967,968,969,1040,1041,1042,1043,1044,1045,1025,1046,1047,1048,1049, -1050,1051,1052,1053,1054,1055,1056,1057,1058,1059,1060,1061,1062,1063,1064, -1065,1066,1067,1068,1069,1070,1071,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,1072,1073, -1074,1075,1076,1077,1105,1078,1079,1080,1081,1082,1083,1084,1085,1086,1087, -1088,1089,1090,1091,1092,1093,1094,1095,1096,1097,1098,1099,1100,1101,1102, -1103,9472,9474,9484,9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487, -9491,9499,9495,9507,9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520, -9509,9528,9538,20124,21782,23043,38463,21696,24859,25384,23030,36898,33909, -33564,31312,24746,25569,28197,26093,33894,33446,39925,26771,22311,26017,25201, -23451,22992,34427,39156,32098,32190,39822,25110,31903,34999,23433,24245,25353, -26263,26696,38343,38797,26447,20197,20234,20301,20381,20553,22258,22839,22996, -23041,23561,24799,24847,24944,26131,26885,28858,30031,30064,31227,32173,32239, -32963,33806,34915,35586,36949,36986,21307,20117,20133,22495,32946,37057,30959, -19968,22769,28322,36920,31282,33576,33419,39983,20801,21360,21693,21729,22240, -23035,24341,39154,28139,32996,34093,38498,38512,38560,38907,21515,21491,23431, -28879,32701,36802,38632,21359,40284,31418,19985,30867,33276,28198,22040,21764, -27421,34074,39995,23013,21417,28006,29916,38287,22082,20113,36939,38642,33615, -39180,21473,21942,23344,24433,26144,26355,26628,27704,27891,27945,29787,30408, -31310,38964,33521,34907,35424,37613,28082,30123,30410,39365,24742,35585,36234, -38322,27022,21421,20870,22290,22576,22852,23476,24310,24616,25513,25588,27839, -28436,28814,28948,29017,29141,29503,32257,33398,33489,34199,36960,37467,40219, -22633,26044,27738,29989,20985,22830,22885,24448,24540,25276,26106,27178,27431, -27572,29579,32705,35158,40236,40206,40644,23713,27798,33659,20740,23627,25014, -33222,26742,29281,20057,20474,21368,24681,28201,31311,38899,19979,21270,20206, -20309,20285,20385,20339,21152,21487,22025,22799,23233,23478,23521,31185,26247, -26524,26550,27468,27827,28779,29634,31117,31166,31292,31623,33457,33499,33540, -33655,33775,33747,34662,35506,22057,36008,36838,36942,38686,34442,20420,23784, -25105,29273,30011,33253,33469,34558,36032,38597,39187,39381,20171,20250,35299, -22238,22602,22730,24315,24555,24618,24724,24674,25040,25106,25296,25913,39745, -26214,26800,28023,28784,30028,30342,32117,33445,34809,38283,38542,35997,20977, -21182,22806,21683,23475,23830,24936,27010,28079,30861,33995,34903,35442,37799, -39608,28012,39336,34521,22435,26623,34510,37390,21123,22151,21508,24275,25313, -25785,26684,26680,27579,29554,30906,31339,35226,35282,36203,36611,37101,38307, -38548,38761,23398,23731,27005,38989,38990,25499,31520,27179,27263,26806,39949, -28511,21106,21917,24688,25324,27963,28167,28369,33883,35088,36676,19988,39993, -21494,26907,27194,38788,26666,20828,31427,33970,37340,37772,22107,40232,26658, -33541,33841,31909,21000,33477,29926,20094,20355,20896,23506,21002,21208,21223, -24059,21914,22570,23014,23436,23448,23515,24178,24185,24739,24863,24931,25022, -25563,25954,26577,26707,26874,27454,27475,27735,28450,28567,28485,29872,29976, -30435,30475,31487,31649,31777,32233,32566,32752,32925,33382,33694,35251,35532, -36011,36996,37969,38291,38289,38306,38501,38867,39208,33304,20024,21547,23736, -24012,29609,30284,30524,23721,32747,36107,38593,38929,38996,39000,20225,20238, -21361,21916,22120,22522,22855,23305,23492,23696,24076,24190,24524,25582,26426, -26071,26082,26399,26827,26820,27231,24112,27589,27671,27773,30079,31048,23395, -31232,32000,24509,35215,35352,36020,36215,36556,36637,39138,39438,39740,20096, -20605,20736,22931,23452,25135,25216,25836,27450,29344,30097,31047,32681,34811, -35516,35696,25516,33738,38816,21513,21507,21931,26708,27224,35440,30759,26485, -40653,21364,23458,33050,34384,36870,19992,20037,20167,20241,21450,21560,23470, -24339,24613,25937,26429,27714,27762,27875,28792,29699,31350,31406,31496,32026, -31998,32102,26087,29275,21435,23621,24040,25298,25312,25369,28192,34394,35377, -36317,37624,28417,31142,39770,20136,20139,20140,20379,20384,20689,20807,31478, -20849,20982,21332,21281,21375,21483,21932,22659,23777,24375,24394,24623,24656, -24685,25375,25945,27211,27841,29378,29421,30703,33016,33029,33288,34126,37111, -37857,38911,39255,39514,20208,20957,23597,26241,26989,23616,26354,26997,29577, -26704,31873,20677,21220,22343,24062,37670,26020,27427,27453,29748,31105,31165, -31563,32202,33465,33740,34943,35167,35641,36817,37329,21535,37504,20061,20534, -21477,21306,29399,29590,30697,33510,36527,39366,39368,39378,20855,24858,34398, -21936,31354,20598,23507,36935,38533,20018,27355,37351,23633,23624,25496,31391, -27795,38772,36705,31402,29066,38536,31874,26647,32368,26705,37740,21234,21531, -34219,35347,32676,36557,37089,21350,34952,31041,20418,20670,21009,20804,21843, -22317,29674,22411,22865,24418,24452,24693,24950,24935,25001,25522,25658,25964, -26223,26690,28179,30054,31293,31995,32076,32153,32331,32619,33550,33610,34509, -35336,35427,35686,36605,38938,40335,33464,36814,39912,21127,25119,25731,28608, -38553,26689,20625,27424,27770,28500,31348,32080,34880,35363,26376,20214,20537, -20518,20581,20860,21048,21091,21927,22287,22533,23244,24314,25010,25080,25331, -25458,26908,27177,29309,29356,29486,30740,30831,32121,30476,32937,35211,35609, -36066,36562,36963,37749,38522,38997,39443,40568,20803,21407,21427,24187,24358, -28187,28304,29572,29694,32067,33335,35328,35578,38480,20046,20491,21476,21628, -22266,22993,23396,24049,24235,24359,25144,25925,26543,28246,29392,31946,34996, -32929,32993,33776,34382,35463,36328,37431,38599,39015,40723,20116,20114,20237, -21320,21577,21566,23087,24460,24481,24735,26791,27278,29786,30849,35486,35492, -35703,37264,20062,39881,20132,20348,20399,20505,20502,20809,20844,21151,21177, -21246,21402,21475,21521,21518,21897,22353,22434,22909,23380,23389,23439,24037, -24039,24055,24184,24195,24218,24247,24344,24658,24908,25239,25304,25511,25915, -26114,26179,26356,26477,26657,26775,27083,27743,27946,28009,28207,28317,30002, -30343,30828,31295,31968,32005,32024,32094,32177,32789,32771,32943,32945,33108, -33167,33322,33618,34892,34913,35611,36002,36092,37066,37237,37489,30783,37628, -38308,38477,38917,39321,39640,40251,21083,21163,21495,21512,22741,25335,28640, -35946,36703,40633,20811,21051,21578,22269,31296,37239,40288,40658,29508,28425, -33136,29969,24573,24794,39592,29403,36796,27492,38915,20170,22256,22372,22718, -23130,24680,25031,26127,26118,26681,26801,28151,30165,32058,33390,39746,20123, -20304,21449,21766,23919,24038,24046,26619,27801,29811,30722,35408,37782,35039, -22352,24231,25387,20661,20652,20877,26368,21705,22622,22971,23472,24425,25165, -25505,26685,27507,28168,28797,37319,29312,30741,30758,31085,25998,32048,33756, -35009,36617,38555,21092,22312,26448,32618,36001,20916,22338,38442,22586,27018, -32948,21682,23822,22524,30869,40442,20316,21066,21643,25662,26152,26388,26613, -31364,31574,32034,37679,26716,39853,31545,21273,20874,21047,23519,25334,25774, -25830,26413,27578,34217,38609,30352,39894,25420,37638,39851,30399,26194,19977, -20632,21442,23665,24808,25746,25955,26719,29158,29642,29987,31639,32386,34453, -35715,36059,37240,39184,26028,26283,27531,20181,20180,20282,20351,21050,21496, -21490,21987,22235,22763,22987,22985,23039,23376,23629,24066,24107,24535,24605, -25351,25903,23388,26031,26045,26088,26525,27490,27515,27663,29509,31049,31169, -31992,32025,32043,32930,33026,33267,35222,35422,35433,35430,35468,35566,36039, -36060,38604,39164,27503,20107,20284,20365,20816,23383,23546,24904,25345,26178, -27425,28363,27835,29246,29885,30164,30913,31034,32780,32819,33258,33940,36766, -27728,40575,24335,35672,40235,31482,36600,23437,38635,19971,21489,22519,22833, -23241,23460,24713,28287,28422,30142,36074,23455,34048,31712,20594,26612,33437, -23649,34122,32286,33294,20889,23556,25448,36198,26012,29038,31038,32023,32773, -35613,36554,36974,34503,37034,20511,21242,23610,26451,28796,29237,37196,37320, -37675,33509,23490,24369,24825,20027,21462,23432,25163,26417,27530,29417,29664, -31278,33131,36259,37202,39318,20754,21463,21610,23551,25480,27193,32172,38656, -22234,21454,21608,23447,23601,24030,20462,24833,25342,27954,31168,31179,32066, -32333,32722,33261,33311,33936,34886,35186,35728,36468,36655,36913,37195,37228, -38598,37276,20160,20303,20805,21313,24467,25102,26580,27713,28171,29539,32294, -37325,37507,21460,22809,23487,28113,31069,32302,31899,22654,29087,20986,34899, -36848,20426,23803,26149,30636,31459,33308,39423,20934,24490,26092,26991,27529, -28147,28310,28516,30462,32020,24033,36981,37255,38918,20966,21021,25152,26257, -26329,28186,24246,32210,32626,26360,34223,34295,35576,21161,21465,22899,24207, -24464,24661,37604,38500,20663,20767,21213,21280,21319,21484,21736,21830,21809, -22039,22888,22974,23100,23477,23558,23567,23569,23578,24196,24202,24288,24432, -25215,25220,25307,25484,25463,26119,26124,26157,26230,26494,26786,27167,27189, -27836,28040,28169,28248,28988,28966,29031,30151,30465,30813,30977,31077,31216, -31456,31505,31911,32057,32918,33750,33931,34121,34909,35059,35359,35388,35412, -35443,35937,36062,37284,37478,37758,37912,38556,38808,19978,19976,19998,20055, -20887,21104,22478,22580,22732,23330,24120,24773,25854,26465,26454,27972,29366, -30067,31331,33976,35698,37304,37664,22065,22516,39166,25325,26893,27542,29165, -32340,32887,33394,35302,39135,34645,36785,23611,20280,20449,20405,21767,23072, -23517,23529,24515,24910,25391,26032,26187,26862,27035,28024,28145,30003,30137, -30495,31070,31206,32051,33251,33455,34218,35242,35386,36523,36763,36914,37341, -38663,20154,20161,20995,22645,22764,23563,29978,23613,33102,35338,36805,38499, -38765,31525,35535,38920,37218,22259,21416,36887,21561,22402,24101,25512,27700, -28810,30561,31883,32736,34928,36930,37204,37648,37656,38543,29790,39620,23815, -23913,25968,26530,36264,38619,25454,26441,26905,33733,38935,38592,35070,28548, -25722,23544,19990,28716,30045,26159,20932,21046,21218,22995,24449,24615,25104, -25919,25972,26143,26228,26866,26646,27491,28165,29298,29983,30427,31934,32854, -22768,35069,35199,35488,35475,35531,36893,37266,38738,38745,25993,31246,33030, -38587,24109,24796,25114,26021,26132,26512,30707,31309,31821,32318,33034,36012, -36196,36321,36447,30889,20999,25305,25509,25666,25240,35373,31363,31680,35500, -38634,32118,33292,34633,20185,20808,21315,21344,23459,23554,23574,24029,25126, -25159,25776,26643,26676,27849,27973,27927,26579,28508,29006,29053,26059,31359, -31661,32218,32330,32680,33146,33307,33337,34214,35438,36046,36341,36984,36983, -37549,37521,38275,39854,21069,21892,28472,28982,20840,31109,32341,33203,31950, -22092,22609,23720,25514,26366,26365,26970,29401,30095,30094,30990,31062,31199, -31895,32032,32068,34311,35380,38459,36961,40736,20711,21109,21452,21474,20489, -21930,22766,22863,29245,23435,23652,21277,24803,24819,25436,25475,25407,25531, -25805,26089,26361,24035,27085,27133,28437,29157,20105,30185,30456,31379,31967, -32207,32156,32865,33609,33624,33900,33980,34299,35013,36208,36865,36973,37783, -38684,39442,20687,22679,24974,33235,34101,36104,36896,20419,20596,21063,21363, -24687,25417,26463,28204,36275,36895,20439,23646,36042,26063,32154,21330,34966, -20854,25539,23384,23403,23562,25613,26449,36956,20182,22810,22826,27760,35409, -21822,22549,22949,24816,25171,26561,33333,26965,38464,39364,39464,20307,22534, -23550,32784,23729,24111,24453,24608,24907,25140,26367,27888,28382,32974,33151, -33492,34955,36024,36864,36910,38538,40667,39899,20195,21488,22823,31532,37261, -38988,40441,28381,28711,21331,21828,23429,25176,25246,25299,27810,28655,29730, -35351,37944,28609,35582,33592,20967,34552,21482,21481,20294,36948,36784,22890, -33073,24061,31466,36799,26842,35895,29432,40008,27197,35504,20025,21336,22022, -22374,25285,25506,26086,27470,28129,28251,28845,30701,31471,31658,32187,32829, -32966,34507,35477,37723,22243,22727,24382,26029,26262,27264,27573,30007,35527, -20516,30693,22320,24347,24677,26234,27744,30196,31258,32622,33268,34584,36933, -39347,31689,30044,31481,31569,33988,36880,31209,31378,33590,23265,30528,20013, -20210,23449,24544,25277,26172,26609,27880,34411,34935,35387,37198,37619,39376, -27159,28710,29482,33511,33879,36015,19969,20806,20939,21899,23541,24086,24115, -24193,24340,24373,24427,24500,25074,25361,26274,26397,28526,29266,30010,30522, -32884,33081,33144,34678,35519,35548,36229,36339,37530,38263,38914,40165,21189, -25431,30452,26389,27784,29645,36035,37806,38515,27941,22684,26894,27084,36861, -37786,30171,36890,22618,26626,25524,27131,20291,28460,26584,36795,34086,32180, -37716,26943,28528,22378,22775,23340,32044,29226,21514,37347,40372,20141,20302, -20572,20597,21059,35998,21576,22564,23450,24093,24213,24237,24311,24351,24716, -25269,25402,25552,26799,27712,30855,31118,31243,32224,33351,35330,35558,36420, -36883,37048,37165,37336,40718,27877,25688,25826,25973,28404,30340,31515,36969, -37841,28346,21746,24505,25764,36685,36845,37444,20856,22635,22825,23637,24215, -28155,32399,29980,36028,36578,39003,28857,20253,27583,28593,30000,38651,20814, -21520,22581,22615,22956,23648,24466,26007,26460,28193,30331,33759,36077,36884, -37117,37709,30757,30778,21162,24230,22303,22900,24594,20498,20826,20908,20941, -20992,21776,22612,22616,22871,23445,23798,23947,24764,25237,25645,26481,26691, -26812,26847,30423,28120,28271,28059,28783,29128,24403,30168,31095,31561,31572, -31570,31958,32113,21040,33891,34153,34276,35342,35588,35910,36367,36867,36879, -37913,38518,38957,39472,38360,20685,21205,21516,22530,23566,24999,25758,27934, -30643,31461,33012,33796,36947,37509,23776,40199,21311,24471,24499,28060,29305, -30563,31167,31716,27602,29420,35501,26627,27233,20984,31361,26932,23626,40182, -33515,23493,37193,28702,22136,23663,24775,25958,27788,35930,36929,38931,21585, -26311,37389,22856,37027,20869,20045,20970,34201,35598,28760,25466,37707,26978, -39348,32260,30071,21335,26976,36575,38627,27741,20108,23612,24336,36841,21250, -36049,32905,34425,24319,26085,20083,20837,22914,23615,38894,20219,22922,24525, -35469,28641,31152,31074,23527,33905,29483,29105,24180,24565,25467,25754,29123, -31896,20035,24316,20043,22492,22178,24745,28611,32013,33021,33075,33215,36786, -35223,34468,24052,25226,25773,35207,26487,27874,27966,29750,30772,23110,32629, -33453,39340,20467,24259,25309,25490,25943,26479,30403,29260,32972,32954,36649, -37197,20493,22521,23186,26757,26995,29028,29437,36023,22770,36064,38506,36889, -34687,31204,30695,33833,20271,21093,21338,25293,26575,27850,30333,31636,31893, -33334,34180,36843,26333,28448,29190,32283,33707,39361,40614,20989,31665,30834, -31672,32903,31560,27368,24161,32908,30033,30048,20843,37474,28300,30330,37271, -39658,20240,32624,25244,31567,38309,40169,22138,22617,34532,38588,20276,21028, -21322,21453,21467,24070,25644,26001,26495,27710,27726,29256,29359,29677,30036, -32321,33324,34281,36009,31684,37318,29033,38930,39151,25405,26217,30058,30436, -30928,34115,34542,21290,21329,21542,22915,24199,24444,24754,25161,25209,25259, -26000,27604,27852,30130,30382,30865,31192,32203,32631,32933,34987,35513,36027, -36991,38750,39131,27147,31800,20633,23614,24494,26503,27608,29749,30473,32654, -40763,26570,31255,21305,30091,39661,24422,33181,33777,32920,24380,24517,30050, -31558,36924,26727,23019,23195,32016,30334,35628,20469,24426,27161,27703,28418, -29922,31080,34920,35413,35961,24287,25551,30149,31186,33495,37672,37618,33948, -34541,39981,21697,24428,25996,27996,28693,36007,36051,38971,25935,29942,19981, -20184,22496,22827,23142,23500,20904,24067,24220,24598,25206,25975,26023,26222, -28014,29238,31526,33104,33178,33433,35676,36000,36070,36212,38428,38468,20398, -25771,27494,33310,33889,34154,37096,23553,26963,39080,33914,34135,20239,21103, -24489,24133,26381,31119,33145,35079,35206,28149,24343,25173,27832,20175,29289, -39826,20998,21563,22132,22707,24996,25198,28954,22894,31881,31966,32027,38640, -25991,32862,19993,20341,20853,22592,24163,24179,24330,26564,20006,34109,38281, -38491,31859,38913,20731,22721,30294,30887,21029,30629,34065,31622,20559,22793, -29255,31687,32232,36794,36820,36941,20415,21193,23081,24321,38829,20445,33303, -37610,22275,25429,27497,29995,35036,36628,31298,21215,22675,24917,25098,26286, -27597,31807,33769,20515,20472,21253,21574,22577,22857,23453,23792,23791,23849, -24214,25265,25447,25918,26041,26379,27861,27873,28921,30770,32299,32990,33459, -33804,34028,34562,35090,35370,35914,37030,37586,39165,40179,40300,20047,20129, -20621,21078,22346,22952,24125,24536,24537,25151,26292,26395,26576,26834,20882, -32033,32938,33192,35584,35980,36031,37502,38450,21536,38956,21271,20693,21340, -22696,25778,26420,29287,30566,31302,37350,21187,27809,27526,22528,24140,22868, -26412,32763,20961,30406,25705,30952,39764,40635,22475,22969,26151,26522,27598, -21737,27097,24149,33180,26517,39850,26622,40018,26717,20134,20451,21448,25273, -26411,27819,36804,20397,32365,40639,19975,24930,28288,28459,34067,21619,26410, -39749,24051,31637,23724,23494,34588,28234,34001,31252,33032,22937,31885,27665, -30496,21209,22818,28961,29279,30683,38695,40289,26891,23167,23064,20901,21517, -21629,26126,30431,36855,37528,40180,23018,29277,28357,20813,26825,32191,32236, -38754,40634,25720,27169,33538,22916,23391,27611,29467,30450,32178,32791,33945, -20786,26408,40665,30446,26466,21247,39173,23588,25147,31870,36016,21839,24758, -32011,38272,21249,20063,20918,22812,29242,32822,37326,24357,30690,21380,24441, -32004,34220,35379,36493,38742,26611,34222,37971,24841,24840,27833,30290,35565, -36664,21807,20305,20778,21191,21451,23461,24189,24736,24962,25558,26377,26586, -28263,28044,29494,29495,30001,31056,35029,35480,36938,37009,37109,38596,34701, -22805,20104,20313,19982,35465,36671,38928,20653,24188,22934,23481,24248,25562, -25594,25793,26332,26954,27096,27915,28342,29076,29992,31407,32650,32768,33865, -33993,35201,35617,36362,36965,38525,39178,24958,25233,27442,27779,28020,32716, -32764,28096,32645,34746,35064,26469,33713,38972,38647,27931,32097,33853,37226, -20081,21365,23888,27396,28651,34253,34349,35239,21033,21519,23653,26446,26792, -29702,29827,30178,35023,35041,37324,38626,38520,24459,29575,31435,33870,25504, -30053,21129,27969,28316,29705,30041,30827,31890,38534,31452,40845,20406,24942, -26053,34396,20102,20142,20698,20001,20940,23534,26009,26753,28092,29471,30274, -30637,31260,31975,33391,35538,36988,37327,38517,38936,21147,32209,20523,21400, -26519,28107,29136,29747,33256,36650,38563,40023,40607,29792,22593,28057,32047, -39006,20196,20278,20363,20919,21169,23994,24604,29618,31036,33491,37428,38583, -38646,38666,40599,40802,26278,27508,21015,21155,28872,35010,24265,24651,24976, -28451,29001,31806,32244,32879,34030,36899,37676,21570,39791,27347,28809,36034, -36335,38706,21172,23105,24266,24324,26391,27004,27028,28010,28431,29282,29436, -31725,32769,32894,34635,37070,20845,40595,31108,32907,37682,35542,20525,21644, -35441,27498,36036,33031,24785,26528,40434,20121,20120,39952,35435,34241,34152, -26880,28286,30871,33109,24332,19984,19989,20010,20017,20022,20028,20031,20034, -20054,20056,20098,20101,35947,20106,33298,24333,20110,20126,20127,20128,20130, -20144,20147,20150,20174,20173,20164,20166,20162,20183,20190,20205,20191,20215, -20233,20314,20272,20315,20317,20311,20295,20342,20360,20367,20376,20347,20329, -20336,20369,20335,20358,20374,20760,20436,20447,20430,20440,20443,20433,20442, -20432,20452,20453,20506,20520,20500,20522,20517,20485,20252,20470,20513,20521, -20524,20478,20463,20497,20486,20547,20551,26371,20565,20560,20552,20570,20566, -20588,20600,20608,20634,20613,20660,20658,20681,20682,20659,20674,20694,20702, -20709,20717,20707,20718,20729,20725,20745,20737,20738,20758,20757,20756,20762, -20769,20794,20791,20796,20795,20799,20800,20818,20812,20820,20834,31480,20841, -20842,20846,20864,20866,22232,20876,20873,20879,20881,20883,20885,20886,20900, -20902,20898,20905,20906,20907,20915,20913,20914,20912,20917,20925,20933,20937, -20955,20960,34389,20969,20973,20976,20981,20990,20996,21003,21012,21006,21031, -21034,21038,21043,21049,21071,21060,21067,21068,21086,21076,21098,21108,21097, -21107,21119,21117,21133,21140,21138,21105,21128,21137,36776,36775,21164,21165, -21180,21173,21185,21197,21207,21214,21219,21222,39149,21216,21235,21237,21240, -21241,21254,21256,30008,21261,21264,21263,21269,21274,21283,21295,21297,21299, -21304,21312,21318,21317,19991,21321,21325,20950,21342,21353,21358,22808,21371, -21367,21378,21398,21408,21414,21413,21422,21424,21430,21443,31762,38617,21471, -26364,29166,21486,21480,21485,21498,21505,21565,21568,21548,21549,21564,21550, -21558,21545,21533,21582,21647,21621,21646,21599,21617,21623,21616,21650,21627, -21632,21622,21636,21648,21638,21703,21666,21688,21669,21676,21700,21704,21672, -21675,21698,21668,21694,21692,21720,21733,21734,21775,21780,21757,21742,21741, -21754,21730,21817,21824,21859,21836,21806,21852,21829,21846,21847,21816,21811, -21853,21913,21888,21679,21898,21919,21883,21886,21912,21918,21934,21884,21891, -21929,21895,21928,21978,21957,21983,21956,21980,21988,21972,22036,22007,22038, -22014,22013,22043,22009,22094,22096,29151,22068,22070,22066,22072,22123,22116, -22063,22124,22122,22150,22144,22154,22176,22164,22159,22181,22190,22198,22196, -22210,22204,22209,22211,22208,22216,22222,22225,22227,22231,22254,22265,22272, -22271,22276,22281,22280,22283,22285,22291,22296,22294,21959,22300,22310,22327, -22328,22350,22331,22336,22351,22377,22464,22408,22369,22399,22409,22419,22432, -22451,22436,22442,22448,22467,22470,22484,22482,22483,22538,22486,22499,22539, -22553,22557,22642,22561,22626,22603,22640,27584,22610,22589,22649,22661,22713, -22687,22699,22714,22750,22715,22712,22702,22725,22739,22737,22743,22745,22744, -22757,22748,22756,22751,22767,22778,22777,22779,22780,22781,22786,22794,22800, -22811,26790,22821,22828,22829,22834,22840,22846,31442,22869,22864,22862,22874, -22872,22882,22880,22887,22892,22889,22904,22913,22941,20318,20395,22947,22962, -22982,23016,23004,22925,23001,23002,23077,23071,23057,23068,23049,23066,23104, -23148,23113,23093,23094,23138,23146,23194,23228,23230,23243,23234,23229,23267, -23255,23270,23273,23254,23290,23291,23308,23307,23318,23346,23248,23338,23350, -23358,23363,23365,23360,23377,23381,23386,23387,23397,23401,23408,23411,23413, -23416,25992,23418,23424,23427,23462,23480,23491,23495,23497,23508,23504,23524, -23526,23522,23518,23525,23531,23536,23542,23539,23557,23559,23560,23565,23571, -23584,23586,23592,23608,23609,23617,23622,23630,23635,23632,23631,23409,23660, -23662,20066,23670,23673,23692,23697,23700,22939,23723,23739,23734,23740,23735, -23749,23742,23751,23769,23785,23805,23802,23789,23948,23786,23819,23829,23831, -23900,23839,23835,23825,23828,23842,23834,23833,23832,23884,23890,23886,23883, -23916,23923,23926,23943,23940,23938,23970,23965,23980,23982,23997,23952,23991, -23996,24009,24013,24019,24018,24022,24027,24043,24050,24053,24075,24090,24089, -24081,24091,24118,24119,24132,24131,24128,24142,24151,24148,24159,24162,24164, -24135,24181,24182,24186,40636,24191,24224,24257,24258,24264,24272,24271,24278, -24291,24285,24282,24283,24290,24289,24296,24297,24300,24305,24307,24304,24308, -24312,24318,24323,24329,24413,24412,24331,24337,24342,24361,24365,24376,24385, -24392,24396,24398,24367,24401,24406,24407,24409,24417,24429,24435,24439,24451, -24450,24447,24458,24456,24465,24455,24478,24473,24472,24480,24488,24493,24508, -24534,24571,24548,24568,24561,24541,24755,24575,24609,24672,24601,24592,24617, -24590,24625,24603,24597,24619,24614,24591,24634,24666,24641,24682,24695,24671, -24650,24646,24653,24675,24643,24676,24642,24684,24683,24665,24705,24717,24807, -24707,24730,24708,24731,24726,24727,24722,24743,24715,24801,24760,24800,24787, -24756,24560,24765,24774,24757,24792,24909,24853,24838,24822,24823,24832,24820, -24826,24835,24865,24827,24817,24845,24846,24903,24894,24872,24871,24906,24895, -24892,24876,24884,24893,24898,24900,24947,24951,24920,24921,24922,24939,24948, -24943,24933,24945,24927,24925,24915,24949,24985,24982,24967,25004,24980,24986, -24970,24977,25003,25006,25036,25034,25033,25079,25032,25027,25030,25018,25035, -32633,25037,25062,25059,25078,25082,25076,25087,25085,25084,25086,25088,25096, -25097,25101,25100,25108,25115,25118,25121,25130,25134,25136,25138,25139,25153, -25166,25182,25187,25179,25184,25192,25212,25218,25225,25214,25234,25235,25238, -25300,25219,25236,25303,25297,25275,25295,25343,25286,25812,25288,25308,25292, -25290,25282,25287,25243,25289,25356,25326,25329,25383,25346,25352,25327,25333, -25424,25406,25421,25628,25423,25494,25486,25472,25515,25462,25507,25487,25481, -25503,25525,25451,25449,25534,25577,25536,25542,25571,25545,25554,25590,25540, -25622,25652,25606,25619,25638,25654,25885,25623,25640,25615,25703,25711,25718, -25678,25898,25749,25747,25765,25769,25736,25788,25818,25810,25797,25799,25787, -25816,25794,25841,25831,33289,25824,25825,25260,25827,25839,25900,25846,25844, -25842,25850,25856,25853,25880,25884,25861,25892,25891,25899,25908,25909,25911, -25910,25912,30027,25928,25942,25941,25933,25944,25950,25949,25970,25976,25986, -25987,35722,26011,26015,26027,26039,26051,26054,26049,26052,26060,26066,26075, -26073,26080,26081,26097,26482,26122,26115,26107,26483,26165,26166,26164,26140, -26191,26180,26185,26177,26206,26205,26212,26215,26216,26207,26210,26224,26243, -26248,26254,26249,26244,26264,26269,26305,26297,26313,26302,26300,26308,26296, -26326,26330,26336,26175,26342,26345,26352,26357,26359,26383,26390,26398,26406, -26407,38712,26414,26431,26422,26433,26424,26423,26438,26462,26464,26457,26467, -26468,26505,26480,26537,26492,26474,26508,26507,26534,26529,26501,26551,26607, -26548,26604,26547,26601,26552,26596,26590,26589,26594,26606,26553,26574,26566, -26599,27292,26654,26694,26665,26688,26701,26674,26702,26803,26667,26713,26723, -26743,26751,26783,26767,26797,26772,26781,26779,26755,27310,26809,26740,26805, -26784,26810,26895,26765,26750,26881,26826,26888,26840,26914,26918,26849,26892, -26829,26836,26855,26837,26934,26898,26884,26839,26851,26917,26873,26848,26863, -26920,26922,26906,26915,26913,26822,27001,26999,26972,27000,26987,26964,27006, -26990,26937,26996,26941,26969,26928,26977,26974,26973,27009,26986,27058,27054, -27088,27071,27073,27091,27070,27086,23528,27082,27101,27067,27075,27047,27182, -27025,27040,27036,27029,27060,27102,27112,27138,27163,27135,27402,27129,27122, -27111,27141,27057,27166,27117,27156,27115,27146,27154,27329,27171,27155,27204, -27148,27250,27190,27256,27207,27234,27225,27238,27208,27192,27170,27280,27277, -27296,27268,27298,27299,27287,34327,27323,27331,27330,27320,27315,27308,27358, -27345,27359,27306,27354,27370,27387,27397,34326,27386,27410,27414,39729,27423, -27448,27447,30428,27449,39150,27463,27459,27465,27472,27481,27476,27483,27487, -27489,27512,27513,27519,27520,27524,27523,27533,27544,27541,27550,27556,27562, -27563,27567,27570,27569,27571,27575,27580,27590,27595,27603,27615,27628,27627, -27635,27631,40638,27656,27667,27668,27675,27684,27683,27742,27733,27746,27754, -27778,27789,27802,27777,27803,27774,27752,27763,27794,27792,27844,27889,27859, -27837,27863,27845,27869,27822,27825,27838,27834,27867,27887,27865,27882,27935, -34893,27958,27947,27965,27960,27929,27957,27955,27922,27916,28003,28051,28004, -27994,28025,27993,28046,28053,28644,28037,28153,28181,28170,28085,28103,28134, -28088,28102,28140,28126,28108,28136,28114,28101,28154,28121,28132,28117,28138, -28142,28205,28270,28206,28185,28274,28255,28222,28195,28267,28203,28278,28237, -28191,28227,28218,28238,28196,28415,28189,28216,28290,28330,28312,28361,28343, -28371,28349,28335,28356,28338,28372,28373,28303,28325,28354,28319,28481,28433, -28748,28396,28408,28414,28479,28402,28465,28399,28466,28364,28478,28435,28407, -28550,28538,28536,28545,28544,28527,28507,28659,28525,28546,28540,28504,28558, -28561,28610,28518,28595,28579,28577,28580,28601,28614,28586,28639,28629,28652, -28628,28632,28657,28654,28635,28681,28683,28666,28689,28673,28687,28670,28699, -28698,28532,28701,28696,28703,28720,28734,28722,28753,28771,28825,28818,28847, -28913,28844,28856,28851,28846,28895,28875,28893,28889,28937,28925,28956,28953, -29029,29013,29064,29030,29026,29004,29014,29036,29071,29179,29060,29077,29096, -29100,29143,29113,29118,29138,29129,29140,29134,29152,29164,29159,29173,29180, -29177,29183,29197,29200,29211,29224,29229,29228,29232,29234,29243,29244,29247, -29248,29254,29259,29272,29300,29310,29314,29313,29319,29330,29334,29346,29351, -29369,29362,29379,29382,29380,29390,29394,29410,29408,29409,29433,29431,20495, -29463,29450,29468,29462,29469,29492,29487,29481,29477,29502,29518,29519,40664, -29527,29546,29544,29552,29560,29557,29563,29562,29640,29619,29646,29627,29632, -29669,29678,29662,29858,29701,29807,29733,29688,29746,29754,29781,29759,29791, -29785,29761,29788,29801,29808,29795,29802,29814,29822,29835,29854,29863,29898, -29903,29908,29681,29920,29923,29927,29929,29934,29938,29936,29937,29944,29943, -29956,29955,29957,29964,29966,29965,29973,29971,29982,29990,29996,30012,30020, -30029,30026,30025,30043,30022,30042,30057,30052,30055,30059,30061,30072,30070, -30086,30087,30068,30090,30089,30082,30100,30106,30109,30117,30115,30146,30131, -30147,30133,30141,30136,30140,30129,30157,30154,30162,30169,30179,30174,30206, -30207,30204,30209,30192,30202,30194,30195,30219,30221,30217,30239,30247,30240, -30241,30242,30244,30260,30256,30267,30279,30280,30278,30300,30296,30305,30306, -30312,30313,30314,30311,30316,30320,30322,30326,30328,30332,30336,30339,30344, -30347,30350,30358,30355,30361,30362,30384,30388,30392,30393,30394,30402,30413, -30422,30418,30430,30433,30437,30439,30442,34351,30459,30472,30471,30468,30505, -30500,30494,30501,30502,30491,30519,30520,30535,30554,30568,30571,30555,30565, -30591,30590,30585,30606,30603,30609,30624,30622,30640,30646,30649,30655,30652, -30653,30651,30663,30669,30679,30682,30684,30691,30702,30716,30732,30738,31014, -30752,31018,30789,30862,30836,30854,30844,30874,30860,30883,30901,30890,30895, -30929,30918,30923,30932,30910,30908,30917,30922,30956,30951,30938,30973,30964, -30983,30994,30993,31001,31020,31019,31040,31072,31063,31071,31066,31061,31059, -31098,31103,31114,31133,31143,40779,31146,31150,31155,31161,31162,31177,31189, -31207,31212,31201,31203,31240,31245,31256,31257,31264,31263,31104,31281,31291, -31294,31287,31299,31319,31305,31329,31330,31337,40861,31344,31353,31357,31368, -31383,31381,31384,31382,31401,31432,31408,31414,31429,31428,31423,36995,31431, -31434,31437,31439,31445,31443,31449,31450,31453,31457,31458,31462,31469,31472, -31490,31503,31498,31494,31539,31512,31513,31518,31541,31528,31542,31568,31610, -31492,31565,31499,31564,31557,31605,31589,31604,31591,31600,31601,31596,31598, -31645,31640,31647,31629,31644,31642,31627,31634,31631,31581,31641,31691,31681, -31692,31695,31668,31686,31709,31721,31761,31764,31718,31717,31840,31744,31751, -31763,31731,31735,31767,31757,31734,31779,31783,31786,31775,31799,31787,31805, -31820,31811,31828,31823,31808,31824,31832,31839,31844,31830,31845,31852,31861, -31875,31888,31908,31917,31906,31915,31905,31912,31923,31922,31921,31918,31929, -31933,31936,31941,31938,31960,31954,31964,31970,39739,31983,31986,31988,31990, -31994,32006,32002,32028,32021,32010,32069,32075,32046,32050,32063,32053,32070, -32115,32086,32078,32114,32104,32110,32079,32099,32147,32137,32091,32143,32125, -32155,32186,32174,32163,32181,32199,32189,32171,32317,32162,32175,32220,32184, -32159,32176,32216,32221,32228,32222,32251,32242,32225,32261,32266,32291,32289, -32274,32305,32287,32265,32267,32290,32326,32358,32315,32309,32313,32323,32311, -32306,32314,32359,32349,32342,32350,32345,32346,32377,32362,32361,32380,32379, -32387,32213,32381,36782,32383,32392,32393,32396,32402,32400,32403,32404,32406, -32398,32411,32412,32568,32570,32581,32588,32589,32590,32592,32593,32597,32596, -32600,32607,32608,32616,32617,32615,32632,32642,32646,32643,32648,32647,32652, -32660,32670,32669,32666,32675,32687,32690,32697,32686,32694,32696,35697,32709, -32710,32714,32725,32724,32737,32742,32745,32755,32761,39132,32774,32772,32779, -32786,32792,32793,32796,32801,32808,32831,32827,32842,32838,32850,32856,32858, -32863,32866,32872,32883,32882,32880,32886,32889,32893,32895,32900,32902,32901, -32923,32915,32922,32941,20880,32940,32987,32997,32985,32989,32964,32986,32982, -33033,33007,33009,33051,33065,33059,33071,33099,38539,33094,33086,33107,33105, -33020,33137,33134,33125,33126,33140,33155,33160,33162,33152,33154,33184,33173, -33188,33187,33119,33171,33193,33200,33205,33214,33208,33213,33216,33218,33210, -33225,33229,33233,33241,33240,33224,33242,33247,33248,33255,33274,33275,33278, -33281,33282,33285,33287,33290,33293,33296,33302,33321,33323,33336,33331,33344, -33369,33368,33373,33370,33375,33380,33378,33384,33386,33387,33326,33393,33399, -33400,33406,33421,33426,33451,33439,33467,33452,33505,33507,33503,33490,33524, -33523,33530,33683,33539,33531,33529,33502,33542,33500,33545,33497,33589,33588, -33558,33586,33585,33600,33593,33616,33605,33583,33579,33559,33560,33669,33690, -33706,33695,33698,33686,33571,33678,33671,33674,33660,33717,33651,33653,33696, -33673,33704,33780,33811,33771,33742,33789,33795,33752,33803,33729,33783,33799, -33760,33778,33805,33826,33824,33725,33848,34054,33787,33901,33834,33852,34138, -33924,33911,33899,33965,33902,33922,33897,33862,33836,33903,33913,33845,33994, -33890,33977,33983,33951,34009,33997,33979,34010,34000,33985,33990,34006,33953, -34081,34047,34036,34071,34072,34092,34079,34069,34068,34044,34112,34147,34136, -34120,34113,34306,34123,34133,34176,34212,34184,34193,34186,34216,34157,34196, -34203,34282,34183,34204,34167,34174,34192,34249,34234,34255,34233,34256,34261, -34269,34277,34268,34297,34314,34323,34315,34302,34298,34310,34338,34330,34352, -34367,34381,20053,34388,34399,34407,34417,34451,34467,34473,34474,34443,34444, -34486,34479,34500,34502,34480,34505,34851,34475,34516,34526,34537,34540,34527, -34523,34543,34578,34566,34568,34560,34563,34555,34577,34569,34573,34553,34570, -34612,34623,34615,34619,34597,34601,34586,34656,34655,34680,34636,34638,34676, -34647,34664,34670,34649,34643,34659,34666,34821,34722,34719,34690,34735,34763, -34749,34752,34768,38614,34731,34756,34739,34759,34758,34747,34799,34802,34784, -34831,34829,34814,34806,34807,34830,34770,34833,34838,34837,34850,34849,34865, -34870,34873,34855,34875,34884,34882,34898,34905,34910,34914,34923,34945,34942, -34974,34933,34941,34997,34930,34946,34967,34962,34990,34969,34978,34957,34980, -34992,35007,34993,35011,35012,35028,35032,35033,35037,35065,35074,35068,35060, -35048,35058,35076,35084,35082,35091,35139,35102,35109,35114,35115,35137,35140, -35131,35126,35128,35148,35101,35168,35166,35174,35172,35181,35178,35183,35188, -35191,35198,35203,35208,35210,35219,35224,35233,35241,35238,35244,35247,35250, -35258,35261,35263,35264,35290,35292,35293,35303,35316,35320,35331,35350,35344, -35340,35355,35357,35365,35382,35393,35419,35410,35398,35400,35452,35437,35436, -35426,35461,35458,35460,35496,35489,35473,35493,35494,35482,35491,35524,35533, -35522,35546,35563,35571,35559,35556,35569,35604,35552,35554,35575,35550,35547, -35596,35591,35610,35553,35606,35600,35607,35616,35635,38827,35622,35627,35646, -35624,35649,35660,35663,35662,35657,35670,35675,35674,35691,35679,35692,35695, -35700,35709,35712,35724,35726,35730,35731,35734,35737,35738,35898,35905,35903, -35912,35916,35918,35920,35925,35938,35948,35960,35962,35970,35977,35973,35978, -35981,35982,35988,35964,35992,25117,36013,36010,36029,36018,36019,36014,36022, -36040,36033,36068,36067,36058,36093,36090,36091,36100,36101,36106,36103,36111, -36109,36112,40782,36115,36045,36116,36118,36199,36205,36209,36211,36225,36249, -36290,36286,36282,36303,36314,36310,36300,36315,36299,36330,36331,36319,36323, -36348,36360,36361,36351,36381,36382,36368,36383,36418,36405,36400,36404,36426, -36423,36425,36428,36432,36424,36441,36452,36448,36394,36451,36437,36470,36466, -36476,36481,36487,36485,36484,36491,36490,36499,36497,36500,36505,36522,36513, -36524,36528,36550,36529,36542,36549,36552,36555,36571,36579,36604,36603,36587, -36606,36618,36613,36629,36626,36633,36627,36636,36639,36635,36620,36646,36659, -36667,36665,36677,36674,36670,36684,36681,36678,36686,36695,36700,36706,36707, -36708,36764,36767,36771,36781,36783,36791,36826,36837,36834,36842,36847,36999, -36852,36869,36857,36858,36881,36885,36897,36877,36894,36886,36875,36903,36918, -36917,36921,36856,36943,36944,36945,36946,36878,36937,36926,36950,36952,36958, -36968,36975,36982,38568,36978,36994,36989,36993,36992,37002,37001,37007,37032, -37039,37041,37045,37090,37092,25160,37083,37122,37138,37145,37170,37168,37194, -37206,37208,37219,37221,37225,37235,37234,37259,37257,37250,37282,37291,37295, -37290,37301,37300,37306,37312,37313,37321,37323,37328,37334,37343,37345,37339, -37372,37365,37366,37406,37375,37396,37420,37397,37393,37470,37463,37445,37449, -37476,37448,37525,37439,37451,37456,37532,37526,37523,37531,37466,37583,37561, -37559,37609,37647,37626,37700,37678,37657,37666,37658,37667,37690,37685,37691, -37724,37728,37756,37742,37718,37808,37804,37805,37780,37817,37846,37847,37864, -37861,37848,37827,37853,37840,37832,37860,37914,37908,37907,37891,37895,37904, -37942,37931,37941,37921,37946,37953,37970,37956,37979,37984,37986,37982,37994, -37417,38000,38005,38007,38013,37978,38012,38014,38017,38015,38274,38279,38282, -38292,38294,38296,38297,38304,38312,38311,38317,38332,38331,38329,38334,38346, -28662,38339,38349,38348,38357,38356,38358,38364,38369,38373,38370,38433,38440, -38446,38447,38466,38476,38479,38475,38519,38492,38494,38493,38495,38502,38514, -38508,38541,38552,38549,38551,38570,38567,38577,38578,38576,38580,38582,38584, -38585,38606,38603,38601,38605,35149,38620,38669,38613,38649,38660,38662,38664, -38675,38670,38673,38671,38678,38681,38692,38698,38704,38713,38717,38718,38724, -38726,38728,38722,38729,38748,38752,38756,38758,38760,21202,38763,38769,38777, -38789,38780,38785,38778,38790,38795,38799,38800,38812,38824,38822,38819,38835, -38836,38851,38854,38856,38859,38876,38893,40783,38898,31455,38902,38901,38927, -38924,38968,38948,38945,38967,38973,38982,38991,38987,39019,39023,39024,39025, -39028,39027,39082,39087,39089,39094,39108,39107,39110,39145,39147,39171,39177, -39186,39188,39192,39201,39197,39198,39204,39200,39212,39214,39229,39230,39234, -39241,39237,39248,39243,39249,39250,39244,39253,39319,39320,39333,39341,39342, -39356,39391,39387,39389,39384,39377,39405,39406,39409,39410,39419,39416,39425, -39439,39429,39394,39449,39467,39479,39493,39490,39488,39491,39486,39509,39501, -39515,39511,39519,39522,39525,39524,39529,39531,39530,39597,39600,39612,39616, -39631,39633,39635,39636,39646,39647,39650,39651,39654,39663,39659,39662,39668, -39665,39671,39675,39686,39704,39706,39711,39714,39715,39717,39719,39720,39721, -39722,39726,39727,39730,39748,39747,39759,39757,39758,39761,39768,39796,39827, -39811,39825,39830,39831,39839,39840,39848,39860,39872,39882,39865,39878,39887, -39889,39890,39907,39906,39908,39892,39905,39994,39922,39921,39920,39957,39956, -39945,39955,39948,39942,39944,39954,39946,39940,39982,39963,39973,39972,39969, -39984,40007,39986,40006,39998,40026,40032,40039,40054,40056,40167,40172,40176, -40201,40200,40171,40195,40198,40234,40230,40367,40227,40223,40260,40213,40210, -40257,40255,40254,40262,40264,40285,40286,40292,40273,40272,40281,40306,40329, -40327,40363,40303,40314,40346,40356,40361,40370,40388,40385,40379,40376,40378, -40390,40399,40386,40409,40403,40440,40422,40429,40431,40445,40474,40475,40478, -40565,40569,40573,40577,40584,40587,40588,40594,40597,40593,40605,40613,40617, -40632,40618,40621,38753,40652,40654,40655,40656,40660,40668,40670,40669,40672, -40677,40680,40687,40692,40694,40695,40697,40699,40700,40701,40711,40712,30391, -40725,40737,40748,40766,40778,40786,40788,40803,40799,40800,40801,40806,40807, -40812,40810,40823,40818,40822,40853,40860,40864,22575,27079,36953,29796,20956, -29081, -}; - -static const struct dbcs_index jisx0208_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0208_decmap+0,33,126},{__jisx0208_decmap -+94,33,126},{__jisx0208_decmap+188,48,122},{__jisx0208_decmap+263,33,115},{ -__jisx0208_decmap+346,33,118},{__jisx0208_decmap+432,33,88},{__jisx0208_decmap -+488,33,113},{__jisx0208_decmap+569,33,64},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{__jisx0208_decmap+601,33,126},{__jisx0208_decmap+695,33, -126},{__jisx0208_decmap+789,33,126},{__jisx0208_decmap+883,33,126},{ -__jisx0208_decmap+977,33,126},{__jisx0208_decmap+1071,33,126},{ -__jisx0208_decmap+1165,33,126},{__jisx0208_decmap+1259,33,126},{ -__jisx0208_decmap+1353,33,126},{__jisx0208_decmap+1447,33,126},{ -__jisx0208_decmap+1541,33,126},{__jisx0208_decmap+1635,33,126},{ -__jisx0208_decmap+1729,33,126},{__jisx0208_decmap+1823,33,126},{ -__jisx0208_decmap+1917,33,126},{__jisx0208_decmap+2011,33,126},{ -__jisx0208_decmap+2105,33,126},{__jisx0208_decmap+2199,33,126},{ -__jisx0208_decmap+2293,33,126},{__jisx0208_decmap+2387,33,126},{ -__jisx0208_decmap+2481,33,126},{__jisx0208_decmap+2575,33,126},{ -__jisx0208_decmap+2669,33,126},{__jisx0208_decmap+2763,33,126},{ -__jisx0208_decmap+2857,33,126},{__jisx0208_decmap+2951,33,126},{ -__jisx0208_decmap+3045,33,126},{__jisx0208_decmap+3139,33,126},{ -__jisx0208_decmap+3233,33,126},{__jisx0208_decmap+3327,33,126},{ -__jisx0208_decmap+3421,33,126},{__jisx0208_decmap+3515,33,83},{ -__jisx0208_decmap+3566,33,126},{__jisx0208_decmap+3660,33,126},{ -__jisx0208_decmap+3754,33,126},{__jisx0208_decmap+3848,33,126},{ -__jisx0208_decmap+3942,33,126},{__jisx0208_decmap+4036,33,126},{ -__jisx0208_decmap+4130,33,126},{__jisx0208_decmap+4224,33,126},{ -__jisx0208_decmap+4318,33,126},{__jisx0208_decmap+4412,33,126},{ -__jisx0208_decmap+4506,33,126},{__jisx0208_decmap+4600,33,126},{ -__jisx0208_decmap+4694,33,126},{__jisx0208_decmap+4788,33,126},{ -__jisx0208_decmap+4882,33,126},{__jisx0208_decmap+4976,33,126},{ -__jisx0208_decmap+5070,33,126},{__jisx0208_decmap+5164,33,126},{ -__jisx0208_decmap+5258,33,126},{__jisx0208_decmap+5352,33,126},{ -__jisx0208_decmap+5446,33,126},{__jisx0208_decmap+5540,33,126},{ -__jisx0208_decmap+5634,33,126},{__jisx0208_decmap+5728,33,126},{ -__jisx0208_decmap+5822,33,126},{__jisx0208_decmap+5916,33,126},{ -__jisx0208_decmap+6010,33,126},{__jisx0208_decmap+6104,33,126},{ -__jisx0208_decmap+6198,33,126},{__jisx0208_decmap+6292,33,126},{ -__jisx0208_decmap+6386,33,126},{__jisx0208_decmap+6480,33,126},{ -__jisx0208_decmap+6574,33,126},{__jisx0208_decmap+6668,33,126},{ -__jisx0208_decmap+6762,33,126},{__jisx0208_decmap+6856,33,126},{ -__jisx0208_decmap+6950,33,38},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const ucs2_t __jisx0212_decmap[6179] = { -728,711,184,729,733,175,731,730,126,900,901,U,U,U,U,U,U,U,U,161,166,191,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,186,170, -169,174,8482,164,8470,902,904,905,906,938,U,908,U,910,939,U,911,U,U,U,U,940, -941,942,943,970,912,972,962,973,971,944,974,1026,1027,1028,1029,1030,1031, -1032,1033,1034,1035,1036,1038,1039,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,1106,1107,1108,1109,1110,1111,1112,1113,1114,1115, -1116,1118,1119,198,272,U,294,U,306,U,321,319,U,330,216,338,U,358,222,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,230,273,240,295,305,307,312,322,320,329,331,248,339, -223,359,254,193,192,196,194,258,461,256,260,197,195,262,264,268,199,266,270, -201,200,203,202,282,278,274,280,U,284,286,290,288,292,205,204,207,206,463,304, -298,302,296,308,310,313,317,315,323,327,325,209,211,210,214,212,465,336,332, -213,340,344,342,346,348,352,350,356,354,218,217,220,219,364,467,368,362,370, -366,360,471,475,473,469,372,221,376,374,377,381,379,225,224,228,226,259,462, -257,261,229,227,263,265,269,231,267,271,233,232,235,234,283,279,275,281,501, -285,287,U,289,293,237,236,239,238,464,U,299,303,297,309,311,314,318,316,324, -328,326,241,243,242,246,244,466,337,333,245,341,345,343,347,349,353,351,357, -355,250,249,252,251,365,468,369,363,371,367,361,472,476,474,470,373,253,255, -375,378,382,380,19970,19972,19973,19980,19986,19999,20003,20004,20008,20011, -20014,20015,20016,20021,20032,20033,20036,20039,20049,20058,20060,20067,20072, -20073,20084,20085,20089,20095,20109,20118,20119,20125,20143,20153,20163,20176, -20186,20187,20192,20193,20194,20200,20207,20209,20211,20213,20221,20222,20223, -20224,20226,20227,20232,20235,20236,20242,20245,20246,20247,20249,20270,20273, -20320,20275,20277,20279,20281,20283,20286,20288,20290,20296,20297,20299,20300, -20306,20308,20310,20312,20319,20323,20330,20332,20334,20337,20343,20344,20345, -20346,20349,20350,20353,20354,20356,20357,20361,20362,20364,20366,20368,20370, -20371,20372,20375,20377,20378,20382,20383,20402,20407,20409,20411,20412,20413, -20414,20416,20417,20421,20422,20424,20425,20427,20428,20429,20431,20434,20444, -20448,20450,20464,20466,20476,20477,20479,20480,20481,20484,20487,20490,20492, -20494,20496,20499,20503,20504,20507,20508,20509,20510,20514,20519,20526,20528, -20530,20531,20533,20544,20545,20546,20549,20550,20554,20556,20558,20561,20562, -20563,20567,20569,20575,20576,20578,20579,20582,20583,20586,20589,20592,20593, -20539,20609,20611,20612,20614,20618,20622,20623,20624,20626,20627,20628,20630, -20635,20636,20638,20639,20640,20641,20642,20650,20655,20656,20665,20666,20669, -20672,20675,20676,20679,20684,20686,20688,20691,20692,20696,20700,20701,20703, -20706,20708,20710,20712,20713,20719,20721,20726,20730,20734,20739,20742,20743, -20744,20747,20748,20749,20750,20722,20752,20759,20761,20763,20764,20765,20766, -20771,20775,20776,20780,20781,20783,20785,20787,20788,20789,20792,20793,20802, -20810,20815,20819,20821,20823,20824,20831,20836,20838,20862,20867,20868,20875, -20878,20888,20893,20897,20899,20909,20920,20922,20924,20926,20927,20930,20936, -20943,20945,20946,20947,20949,20952,20958,20962,20965,20974,20978,20979,20980, -20983,20993,20994,20997,21010,21011,21013,21014,21016,21026,21032,21041,21042, -21045,21052,21061,21065,21077,21079,21080,21082,21084,21087,21088,21089,21094, -21102,21111,21112,21113,21120,21122,21125,21130,21132,21139,21141,21142,21143, -21144,21146,21148,21156,21157,21158,21159,21167,21168,21174,21175,21176,21178, -21179,21181,21184,21188,21190,21192,21196,21199,21201,21204,21206,21211,21212, -21217,21221,21224,21225,21226,21228,21232,21233,21236,21238,21239,21248,21251, -21258,21259,21260,21265,21267,21272,21275,21276,21278,21279,21285,21287,21288, -21289,21291,21292,21293,21296,21298,21301,21308,21309,21310,21314,21324,21323, -21337,21339,21345,21347,21349,21356,21357,21362,21369,21374,21379,21383,21384, -21390,21395,21396,21401,21405,21409,21412,21418,21419,21423,21426,21428,21429, -21431,21432,21434,21437,21440,21445,21455,21458,21459,21461,21466,21469,21470, -21472,21478,21479,21493,21506,21523,21530,21537,21543,21544,21546,21551,21553, -21556,21557,21571,21572,21575,21581,21583,21598,21602,21604,21606,21607,21609, -21611,21613,21614,21620,21631,21633,21635,21637,21640,21641,21645,21649,21653, -21654,21660,21663,21665,21670,21671,21673,21674,21677,21678,21681,21687,21689, -21690,21691,21695,21702,21706,21709,21710,21728,21738,21740,21743,21750,21756, -21758,21759,21760,21761,21765,21768,21769,21772,21773,21774,21781,21802,21803, -21810,21813,21814,21819,21820,21821,21825,21831,21833,21834,21837,21840,21841, -21848,21850,21851,21854,21856,21857,21860,21862,21887,21889,21890,21894,21896, -21902,21903,21905,21906,21907,21908,21911,21923,21924,21933,21938,21951,21953, -21955,21958,21961,21963,21964,21966,21969,21970,21971,21975,21976,21979,21982, -21986,21993,22006,22015,22021,22024,22026,22029,22030,22031,22032,22033,22034, -22041,22060,22064,22067,22069,22071,22073,22075,22076,22077,22079,22080,22081, -22083,22084,22086,22089,22091,22093,22095,22100,22110,22112,22113,22114,22115, -22118,22121,22125,22127,22129,22130,22133,22148,22149,22152,22155,22156,22165, -22169,22170,22173,22174,22175,22182,22183,22184,22185,22187,22188,22189,22193, -22195,22199,22206,22213,22217,22218,22219,22223,22224,22220,22221,22233,22236, -22237,22239,22241,22244,22245,22246,22247,22248,22257,22251,22253,22262,22263, -22273,22274,22279,22282,22284,22289,22293,22298,22299,22301,22304,22306,22307, -22308,22309,22313,22314,22316,22318,22319,22323,22324,22333,22334,22335,22341, -22342,22348,22349,22354,22370,22373,22375,22376,22379,22381,22382,22383,22384, -22385,22387,22388,22389,22391,22393,22394,22395,22396,22398,22401,22403,22412, -22420,22423,22425,22426,22428,22429,22430,22431,22433,22421,22439,22440,22441, -22444,22456,22461,22471,22472,22476,22479,22485,22493,22494,22500,22502,22503, -22505,22509,22512,22517,22518,22520,22525,22526,22527,22531,22532,22536,22537, -22497,22540,22541,22555,22558,22559,22560,22566,22567,22573,22578,22585,22591, -22601,22604,22605,22607,22608,22613,22623,22625,22628,22631,22632,22648,22652, -22655,22656,22657,22663,22664,22665,22666,22668,22669,22671,22672,22676,22678, -22685,22688,22689,22690,22694,22697,22705,22706,22724,22716,22722,22728,22733, -22734,22736,22738,22740,22742,22746,22749,22753,22754,22761,22771,22789,22790, -22795,22796,22802,22803,22804,34369,22813,22817,22819,22820,22824,22831,22832, -22835,22837,22838,22847,22851,22854,22866,22867,22873,22875,22877,22878,22879, -22881,22883,22891,22893,22895,22898,22901,22902,22905,22907,22908,22923,22924, -22926,22930,22933,22935,22943,22948,22951,22957,22958,22959,22960,22963,22967, -22970,22972,22977,22979,22980,22984,22986,22989,22994,23005,23006,23007,23011, -23012,23015,23022,23023,23025,23026,23028,23031,23040,23044,23052,23053,23054, -23058,23059,23070,23075,23076,23079,23080,23082,23085,23088,23108,23109,23111, -23112,23116,23120,23125,23134,23139,23141,23143,23149,23159,23162,23163,23166, -23179,23184,23187,23190,23193,23196,23198,23199,23200,23202,23207,23212,23217, -23218,23219,23221,23224,23226,23227,23231,23236,23238,23240,23247,23258,23260, -23264,23269,23274,23278,23285,23286,23293,23296,23297,23304,23319,23348,23321, -23323,23325,23329,23333,23341,23352,23361,23371,23372,23378,23382,23390,23400, -23406,23407,23420,23421,23422,23423,23425,23428,23430,23434,23438,23440,23441, -23443,23444,23446,23464,23465,23468,23469,23471,23473,23474,23479,23482,23484, -23488,23489,23501,23503,23510,23511,23512,23513,23514,23520,23535,23537,23540, -23549,23564,23575,23582,23583,23587,23590,23593,23595,23596,23598,23600,23602, -23605,23606,23641,23642,23644,23650,23651,23655,23656,23657,23661,23664,23668, -23669,23674,23675,23676,23677,23687,23688,23690,23695,23698,23709,23711,23712, -23714,23715,23718,23722,23730,23732,23733,23738,23753,23755,23762,23773,23767, -23790,23793,23794,23796,23809,23814,23821,23826,23851,23843,23844,23846,23847, -23857,23860,23865,23869,23871,23874,23875,23878,23880,23893,23889,23897,23882, -23903,23904,23905,23906,23908,23914,23917,23920,23929,23930,23934,23935,23937, -23939,23944,23946,23954,23955,23956,23957,23961,23963,23967,23968,23975,23979, -23984,23988,23992,23993,24003,24007,24011,24016,24014,24024,24025,24032,24036, -24041,24056,24057,24064,24071,24077,24082,24084,24085,24088,24095,24096,24110, -24104,24114,24117,24126,24139,24144,24137,24145,24150,24152,24155,24156,24158, -24168,24170,24171,24172,24173,24174,24176,24192,24203,24206,24226,24228,24229, -24232,24234,24236,24241,24243,24253,24254,24255,24262,24268,24267,24270,24273, -24274,24276,24277,24284,24286,24293,24299,24322,24326,24327,24328,24334,24345, -24348,24349,24353,24354,24355,24356,24360,24363,24364,24366,24368,24372,24374, -24379,24381,24383,24384,24388,24389,24391,24397,24400,24404,24408,24411,24416, -24419,24420,24423,24431,24434,24436,24437,24440,24442,24445,24446,24457,24461, -24463,24470,24476,24477,24482,24487,24491,24484,24492,24495,24496,24497,24504, -24516,24519,24520,24521,24523,24528,24529,24530,24531,24532,24542,24545,24546, -24552,24553,24554,24556,24557,24558,24559,24562,24563,24566,24570,24572,24583, -24586,24589,24595,24596,24599,24600,24602,24607,24612,24621,24627,24629,24640, -24647,24648,24649,24652,24657,24660,24662,24663,24669,24673,24679,24689,24702, -24703,24706,24710,24712,24714,24718,24721,24723,24725,24728,24733,24734,24738, -24740,24741,24744,24752,24753,24759,24763,24766,24770,24772,24776,24777,24778, -24779,24782,24783,24788,24789,24793,24795,24797,24798,24802,24805,24818,24821, -24824,24828,24829,24834,24839,24842,24844,24848,24849,24850,24851,24852,24854, -24855,24857,24860,24862,24866,24874,24875,24880,24881,24885,24886,24887,24889, -24897,24901,24902,24905,24926,24928,24940,24946,24952,24955,24956,24959,24960, -24961,24963,24964,24971,24973,24978,24979,24983,24984,24988,24989,24991,24992, -24997,25000,25002,25005,25016,25017,25020,25024,25025,25026,25038,25039,25045, -25052,25053,25054,25055,25057,25058,25063,25065,25061,25068,25069,25071,25089, -25091,25092,25095,25107,25109,25116,25120,25122,25123,25127,25129,25131,25145, -25149,25154,25155,25156,25158,25164,25168,25169,25170,25172,25174,25178,25180, -25188,25197,25199,25203,25210,25213,25229,25230,25231,25232,25254,25256,25267, -25270,25271,25274,25278,25279,25284,25294,25301,25302,25306,25322,25330,25332, -25340,25341,25347,25348,25354,25355,25357,25360,25363,25366,25368,25385,25386, -25389,25397,25398,25401,25404,25409,25410,25411,25412,25414,25418,25419,25422, -25426,25427,25428,25432,25435,25445,25446,25452,25453,25457,25460,25461,25464, -25468,25469,25471,25474,25476,25479,25482,25488,25492,25493,25497,25498,25502, -25508,25510,25517,25518,25519,25533,25537,25541,25544,25550,25553,25555,25556, -25557,25564,25568,25573,25578,25580,25586,25587,25589,25592,25593,25609,25610, -25616,25618,25620,25624,25630,25632,25634,25636,25637,25641,25642,25647,25648, -25653,25661,25663,25675,25679,25681,25682,25683,25684,25690,25691,25692,25693, -25695,25696,25697,25699,25709,25715,25716,25723,25725,25733,25735,25743,25744, -25745,25752,25753,25755,25757,25759,25761,25763,25766,25768,25772,25779,25789, -25790,25791,25796,25801,25802,25803,25804,25806,25808,25809,25813,25815,25828, -25829,25833,25834,25837,25840,25845,25847,25851,25855,25857,25860,25864,25865, -25866,25871,25875,25876,25878,25881,25883,25886,25887,25890,25894,25897,25902, -25905,25914,25916,25917,25923,25927,25929,25936,25938,25940,25951,25952,25959, -25963,25978,25981,25985,25989,25994,26002,26005,26008,26013,26016,26019,26022, -26030,26034,26035,26036,26047,26050,26056,26057,26062,26064,26068,26070,26072, -26079,26096,26098,26100,26101,26105,26110,26111,26112,26116,26120,26121,26125, -26129,26130,26133,26134,26141,26142,26145,26146,26147,26148,26150,26153,26154, -26155,26156,26158,26160,26161,26163,26169,26167,26176,26181,26182,26186,26188, -26193,26190,26199,26200,26201,26203,26204,26208,26209,26363,26218,26219,26220, -26238,26227,26229,26239,26231,26232,26233,26235,26240,26236,26251,26252,26253, -26256,26258,26265,26266,26267,26268,26271,26272,26276,26285,26289,26290,26293, -26299,26303,26304,26306,26307,26312,26316,26318,26319,26324,26331,26335,26344, -26347,26348,26350,26362,26373,26375,26382,26387,26393,26396,26400,26402,26419, -26430,26437,26439,26440,26444,26452,26453,26461,26470,26476,26478,26484,26486, -26491,26497,26500,26510,26511,26513,26515,26518,26520,26521,26523,26544,26545, -26546,26549,26555,26556,26557,26617,26560,26562,26563,26565,26568,26569,26578, -26583,26585,26588,26593,26598,26608,26610,26614,26615,26706,26644,26649,26653, -26655,26664,26663,26668,26669,26671,26672,26673,26675,26683,26687,26692,26693, -26698,26700,26709,26711,26712,26715,26731,26734,26735,26736,26737,26738,26741, -26745,26746,26747,26748,26754,26756,26758,26760,26774,26776,26778,26780,26785, -26787,26789,26793,26794,26798,26802,26811,26821,26824,26828,26831,26832,26833, -26835,26838,26841,26844,26845,26853,26856,26858,26859,26860,26861,26864,26865, -26869,26870,26875,26876,26877,26886,26889,26890,26896,26897,26899,26902,26903, -26929,26931,26933,26936,26939,26946,26949,26953,26958,26967,26971,26979,26980, -26981,26982,26984,26985,26988,26992,26993,26994,27002,27003,27007,27008,27021, -27026,27030,27032,27041,27045,27046,27048,27051,27053,27055,27063,27064,27066, -27068,27077,27080,27089,27094,27095,27106,27109,27118,27119,27121,27123,27125, -27134,27136,27137,27139,27151,27153,27157,27162,27165,27168,27172,27176,27184, -27186,27188,27191,27195,27198,27199,27205,27206,27209,27210,27214,27216,27217, -27218,27221,27222,27227,27236,27239,27242,27249,27251,27262,27265,27267,27270, -27271,27273,27275,27281,27291,27293,27294,27295,27301,27307,27311,27312,27313, -27316,27325,27326,27327,27334,27337,27336,27340,27344,27348,27349,27350,27356, -27357,27364,27367,27372,27376,27377,27378,27388,27389,27394,27395,27398,27399, -27401,27407,27408,27409,27415,27419,27422,27428,27432,27435,27436,27439,27445, -27446,27451,27455,27462,27466,27469,27474,27478,27480,27485,27488,27495,27499, -27502,27504,27509,27517,27518,27522,27525,27543,27547,27551,27552,27554,27555, -27560,27561,27564,27565,27566,27568,27576,27577,27581,27582,27587,27588,27593, -27596,27606,27610,27617,27619,27622,27623,27630,27633,27639,27641,27647,27650, -27652,27653,27657,27661,27662,27664,27666,27673,27679,27686,27687,27688,27692, -27694,27699,27701,27702,27706,27707,27711,27722,27723,27725,27727,27730,27732, -27737,27739,27740,27755,27757,27759,27764,27766,27768,27769,27771,27781,27782, -27783,27785,27796,27797,27799,27800,27804,27807,27824,27826,27828,27842,27846, -27853,27855,27856,27857,27858,27860,27862,27866,27868,27872,27879,27881,27883, -27884,27886,27890,27892,27908,27911,27914,27918,27919,27921,27923,27930,27942, -27943,27944,27751,27950,27951,27953,27961,27964,27967,27991,27998,27999,28001, -28005,28007,28015,28016,28028,28034,28039,28049,28050,28052,28054,28055,28056, -28074,28076,28084,28087,28089,28093,28095,28100,28104,28106,28110,28111,28118, -28123,28125,28127,28128,28130,28133,28137,28143,28144,28148,28150,28156,28160, -28164,28190,28194,28199,28210,28214,28217,28219,28220,28228,28229,28232,28233, -28235,28239,28241,28242,28243,28244,28247,28252,28253,28254,28258,28259,28264, -28275,28283,28285,28301,28307,28313,28320,28327,28333,28334,28337,28339,28347, -28351,28352,28353,28355,28359,28360,28362,28365,28366,28367,28395,28397,28398, -28409,28411,28413,28420,28424,28426,28428,28429,28438,28440,28442,28443,28454, -28457,28458,28463,28464,28467,28470,28475,28476,28461,28495,28497,28498,28499, -28503,28505,28506,28509,28510,28513,28514,28520,28524,28541,28542,28547,28551, -28552,28555,28556,28557,28560,28562,28563,28564,28566,28570,28575,28576,28581, -28582,28583,28584,28590,28591,28592,28597,28598,28604,28613,28615,28616,28618, -28634,28638,28648,28649,28656,28661,28665,28668,28669,28672,28677,28678,28679, -28685,28695,28704,28707,28719,28724,28727,28729,28732,28739,28740,28744,28745, -28746,28747,28756,28757,28765,28766,28750,28772,28773,28780,28782,28789,28790, -28798,28801,28805,28806,28820,28821,28822,28823,28824,28827,28836,28843,28848, -28849,28852,28855,28874,28881,28883,28884,28885,28886,28888,28892,28900,28922, -28931,28932,28933,28934,28935,28939,28940,28943,28958,28960,28971,28973,28975, -28976,28977,28984,28993,28997,28998,28999,29002,29003,29008,29010,29015,29018, -29020,29022,29024,29032,29049,29056,29061,29063,29068,29074,29082,29083,29088, -29090,29103,29104,29106,29107,29114,29119,29120,29121,29124,29131,29132,29139, -29142,29145,29146,29148,29176,29182,29184,29191,29192,29193,29203,29207,29210, -29213,29215,29220,29227,29231,29236,29240,29241,29249,29250,29251,29253,29262, -29263,29264,29267,29269,29270,29274,29276,29278,29280,29283,29288,29291,29294, -29295,29297,29303,29304,29307,29308,29311,29316,29321,29325,29326,29331,29339, -29352,29357,29358,29361,29364,29374,29377,29383,29385,29388,29397,29398,29400, -29407,29413,29427,29428,29434,29435,29438,29442,29444,29445,29447,29451,29453, -29458,29459,29464,29465,29470,29474,29476,29479,29480,29484,29489,29490,29493, -29498,29499,29501,29507,29517,29520,29522,29526,29528,29533,29534,29535,29536, -29542,29543,29545,29547,29548,29550,29551,29553,29559,29561,29564,29568,29569, -29571,29573,29574,29582,29584,29587,29589,29591,29592,29596,29598,29599,29600, -29602,29605,29606,29610,29611,29613,29621,29623,29625,29628,29629,29631,29637, -29638,29641,29643,29644,29647,29650,29651,29654,29657,29661,29665,29667,29670, -29671,29673,29684,29685,29687,29689,29690,29691,29693,29695,29696,29697,29700, -29703,29706,29713,29722,29723,29732,29734,29736,29737,29738,29739,29740,29741, -29742,29743,29744,29745,29753,29760,29763,29764,29766,29767,29771,29773,29777, -29778,29783,29789,29794,29798,29799,29800,29803,29805,29806,29809,29810,29824, -29825,29829,29830,29831,29833,29839,29840,29841,29842,29848,29849,29850,29852, -29855,29856,29857,29859,29862,29864,29865,29866,29867,29870,29871,29873,29874, -29877,29881,29883,29887,29896,29897,29900,29904,29907,29912,29914,29915,29918, -29919,29924,29928,29930,29931,29935,29940,29946,29947,29948,29951,29958,29970, -29974,29975,29984,29985,29988,29991,29993,29994,29999,30006,30009,30013,30014, -30015,30016,30019,30023,30024,30030,30032,30034,30039,30046,30047,30049,30063, -30065,30073,30074,30075,30076,30077,30078,30081,30085,30096,30098,30099,30101, -30105,30108,30114,30116,30132,30138,30143,30144,30145,30148,30150,30156,30158, -30159,30167,30172,30175,30176,30177,30180,30183,30188,30190,30191,30193,30201, -30208,30210,30211,30212,30215,30216,30218,30220,30223,30226,30227,30229,30230, -30233,30235,30236,30237,30238,30243,30245,30246,30249,30253,30258,30259,30261, -30264,30265,30266,30268,30282,30272,30273,30275,30276,30277,30281,30283,30293, -30297,30303,30308,30309,30317,30318,30319,30321,30324,30337,30341,30348,30349, -30357,30363,30364,30365,30367,30368,30370,30371,30372,30373,30374,30375,30376, -30378,30381,30397,30401,30405,30409,30411,30412,30414,30420,30425,30432,30438, -30440,30444,30448,30449,30454,30457,30460,30464,30470,30474,30478,30482,30484, -30485,30487,30489,30490,30492,30498,30504,30509,30510,30511,30516,30517,30518, -30521,30525,30526,30530,30533,30534,30538,30541,30542,30543,30546,30550,30551, -30556,30558,30559,30560,30562,30564,30567,30570,30572,30576,30578,30579,30580, -30586,30589,30592,30596,30604,30605,30612,30613,30614,30618,30623,30626,30631, -30634,30638,30639,30641,30645,30654,30659,30665,30673,30674,30677,30681,30686, -30687,30688,30692,30694,30698,30700,30704,30705,30708,30712,30715,30725,30726, -30729,30733,30734,30737,30749,30753,30754,30755,30765,30766,30768,30773,30775, -30787,30788,30791,30792,30796,30798,30802,30812,30814,30816,30817,30819,30820, -30824,30826,30830,30842,30846,30858,30863,30868,30872,30881,30877,30878,30879, -30884,30888,30892,30893,30896,30897,30898,30899,30907,30909,30911,30919,30920, -30921,30924,30926,30930,30931,30933,30934,30948,30939,30943,30944,30945,30950, -30954,30962,30963,30976,30966,30967,30970,30971,30975,30982,30988,30992,31002, -31004,31006,31007,31008,31013,31015,31017,31021,31025,31028,31029,31035,31037, -31039,31044,31045,31046,31050,31051,31055,31057,31060,31064,31067,31068,31079, -31081,31083,31090,31097,31099,31100,31102,31115,31116,31121,31123,31124,31125, -31126,31128,31131,31132,31137,31144,31145,31147,31151,31153,31156,31160,31163, -31170,31172,31175,31176,31178,31183,31188,31190,31194,31197,31198,31200,31202, -31205,31210,31211,31213,31217,31224,31228,31234,31235,31239,31241,31242,31244, -31249,31253,31259,31262,31265,31271,31275,31277,31279,31280,31284,31285,31288, -31289,31290,31300,31301,31303,31304,31308,31317,31318,31321,31324,31325,31327, -31328,31333,31335,31338,31341,31349,31352,31358,31360,31362,31365,31366,31370, -31371,31376,31377,31380,31390,31392,31395,31404,31411,31413,31417,31419,31420, -31430,31433,31436,31438,31441,31451,31464,31465,31467,31468,31473,31476,31483, -31485,31486,31495,31508,31519,31523,31527,31529,31530,31531,31533,31534,31535, -31536,31537,31540,31549,31551,31552,31553,31559,31566,31573,31584,31588,31590, -31593,31594,31597,31599,31602,31603,31607,31620,31625,31630,31632,31633,31638, -31643,31646,31648,31653,31660,31663,31664,31666,31669,31670,31674,31675,31676, -31677,31682,31685,31688,31690,31700,31702,31703,31705,31706,31707,31720,31722, -31730,31732,31733,31736,31737,31738,31740,31742,31745,31746,31747,31748,31750, -31753,31755,31756,31758,31759,31769,31771,31776,31781,31782,31784,31788,31793, -31795,31796,31798,31801,31802,31814,31818,31829,31825,31826,31827,31833,31834, -31835,31836,31837,31838,31841,31843,31847,31849,31853,31854,31856,31858,31865, -31868,31869,31878,31879,31887,31892,31902,31904,31910,31920,31926,31927,31930, -31931,31932,31935,31940,31943,31944,31945,31949,31951,31955,31956,31957,31959, -31961,31962,31965,31974,31977,31979,31989,32003,32007,32008,32009,32015,32017, -32018,32019,32022,32029,32030,32035,32038,32042,32045,32049,32060,32061,32062, -32064,32065,32071,32072,32077,32081,32083,32087,32089,32090,32092,32093,32101, -32103,32106,32112,32120,32122,32123,32127,32129,32130,32131,32133,32134,32136, -32139,32140,32141,32145,32150,32151,32157,32158,32166,32167,32170,32179,32182, -32183,32185,32194,32195,32196,32197,32198,32204,32205,32206,32215,32217,32256, -32226,32229,32230,32234,32235,32237,32241,32245,32246,32249,32250,32264,32272, -32273,32277,32279,32284,32285,32288,32295,32296,32300,32301,32303,32307,32310, -32319,32324,32325,32327,32334,32336,32338,32344,32351,32353,32354,32357,32363, -32366,32367,32371,32376,32382,32385,32390,32391,32394,32397,32401,32405,32408, -32410,32413,32414,32572,32571,32573,32574,32575,32579,32580,32583,32591,32594, -32595,32603,32604,32605,32609,32611,32612,32613,32614,32621,32625,32637,32638, -32639,32640,32651,32653,32655,32656,32657,32662,32663,32668,32673,32674,32678, -32682,32685,32692,32700,32703,32704,32707,32712,32718,32719,32731,32735,32739, -32741,32744,32748,32750,32751,32754,32762,32765,32766,32767,32775,32776,32778, -32781,32782,32783,32785,32787,32788,32790,32797,32798,32799,32800,32804,32806, -32812,32814,32816,32820,32821,32823,32825,32826,32828,32830,32832,32836,32864, -32868,32870,32877,32881,32885,32897,32904,32910,32924,32926,32934,32935,32939, -32952,32953,32968,32973,32975,32978,32980,32981,32983,32984,32992,33005,33006, -33008,33010,33011,33014,33017,33018,33022,33027,33035,33046,33047,33048,33052, -33054,33056,33060,33063,33068,33072,33077,33082,33084,33093,33095,33098,33100, -33106,33111,33120,33121,33127,33128,33129,33133,33135,33143,33153,33168,33156, -33157,33158,33163,33166,33174,33176,33179,33182,33186,33198,33202,33204,33211, -33227,33219,33221,33226,33230,33231,33237,33239,33243,33245,33246,33249,33252, -33259,33260,33264,33265,33266,33269,33270,33272,33273,33277,33279,33280,33283, -33295,33299,33300,33305,33306,33309,33313,33314,33320,33330,33332,33338,33347, -33348,33349,33350,33355,33358,33359,33361,33366,33372,33376,33379,33383,33389, -33396,33403,33405,33407,33408,33409,33411,33412,33415,33417,33418,33422,33425, -33428,33430,33432,33434,33435,33440,33441,33443,33444,33447,33448,33449,33450, -33454,33456,33458,33460,33463,33466,33468,33470,33471,33478,33488,33493,33498, -33504,33506,33508,33512,33514,33517,33519,33526,33527,33533,33534,33536,33537, -33543,33544,33546,33547,33620,33563,33565,33566,33567,33569,33570,33580,33581, -33582,33584,33587,33591,33594,33596,33597,33602,33603,33604,33607,33613,33614, -33617,33621,33622,33623,33648,33656,33661,33663,33664,33666,33668,33670,33677, -33682,33684,33685,33688,33689,33691,33692,33693,33702,33703,33705,33708,33726, -33727,33728,33735,33737,33743,33744,33745,33748,33757,33619,33768,33770,33782, -33784,33785,33788,33793,33798,33802,33807,33809,33813,33817,33709,33839,33849, -33861,33863,33864,33866,33869,33871,33873,33874,33878,33880,33881,33882,33884, -33888,33892,33893,33895,33898,33904,33907,33908,33910,33912,33916,33917,33921, -33925,33938,33939,33941,33950,33958,33960,33961,33962,33967,33969,33972,33978, -33981,33982,33984,33986,33991,33992,33996,33999,34003,34012,34023,34026,34031, -34032,34033,34034,34039,34098,34042,34043,34045,34050,34051,34055,34060,34062, -34064,34076,34078,34082,34083,34084,34085,34087,34090,34091,34095,34099,34100, -34102,34111,34118,34127,34128,34129,34130,34131,34134,34137,34140,34141,34142, -34143,34144,34145,34146,34148,34155,34159,34169,34170,34171,34173,34175,34177, -34181,34182,34185,34187,34188,34191,34195,34200,34205,34207,34208,34210,34213, -34215,34228,34230,34231,34232,34236,34237,34238,34239,34242,34247,34250,34251, -34254,34221,34264,34266,34271,34272,34278,34280,34285,34291,34294,34300,34303, -34304,34308,34309,34317,34318,34320,34321,34322,34328,34329,34331,34334,34337, -34343,34345,34358,34360,34362,34364,34365,34368,34370,34374,34386,34387,34390, -34391,34392,34393,34397,34400,34401,34402,34403,34404,34409,34412,34415,34421, -34422,34423,34426,34445,34449,34454,34456,34458,34460,34465,34470,34471,34472, -34477,34481,34483,34484,34485,34487,34488,34489,34495,34496,34497,34499,34501, -34513,34514,34517,34519,34522,34524,34528,34531,34533,34535,34440,34554,34556, -34557,34564,34565,34567,34571,34574,34575,34576,34579,34580,34585,34590,34591, -34593,34595,34600,34606,34607,34609,34610,34617,34618,34620,34621,34622,34624, -34627,34629,34637,34648,34653,34657,34660,34661,34671,34673,34674,34683,34691, -34692,34693,34694,34695,34696,34697,34699,34700,34704,34707,34709,34711,34712, -34713,34718,34720,34723,34727,34732,34733,34734,34737,34741,34750,34751,34753, -34760,34761,34762,34766,34773,34774,34777,34778,34780,34783,34786,34787,34788, -34794,34795,34797,34801,34803,34808,34810,34815,34817,34819,34822,34825,34826, -34827,34832,34841,34834,34835,34836,34840,34842,34843,34844,34846,34847,34856, -34861,34862,34864,34866,34869,34874,34876,34881,34883,34885,34888,34889,34890, -34891,34894,34897,34901,34902,34904,34906,34908,34911,34912,34916,34921,34929, -34937,34939,34944,34968,34970,34971,34972,34975,34976,34984,34986,35002,35005, -35006,35008,35018,35019,35020,35021,35022,35025,35026,35027,35035,35038,35047, -35055,35056,35057,35061,35063,35073,35078,35085,35086,35087,35093,35094,35096, -35097,35098,35100,35104,35110,35111,35112,35120,35121,35122,35125,35129,35130, -35134,35136,35138,35141,35142,35145,35151,35154,35159,35162,35163,35164,35169, -35170,35171,35179,35182,35184,35187,35189,35194,35195,35196,35197,35209,35213, -35216,35220,35221,35227,35228,35231,35232,35237,35248,35252,35253,35254,35255, -35260,35284,35285,35286,35287,35288,35301,35305,35307,35309,35313,35315,35318, -35321,35325,35327,35332,35333,35335,35343,35345,35346,35348,35349,35358,35360, -35362,35364,35366,35371,35372,35375,35381,35383,35389,35390,35392,35395,35397, -35399,35401,35405,35406,35411,35414,35415,35416,35420,35421,35425,35429,35431, -35445,35446,35447,35449,35450,35451,35454,35455,35456,35459,35462,35467,35471, -35472,35474,35478,35479,35481,35487,35495,35497,35502,35503,35507,35510,35511, -35515,35518,35523,35526,35528,35529,35530,35537,35539,35540,35541,35543,35549, -35551,35564,35568,35572,35573,35574,35580,35583,35589,35590,35595,35601,35612, -35614,35615,35594,35629,35632,35639,35644,35650,35651,35652,35653,35654,35656, -35666,35667,35668,35673,35661,35678,35683,35693,35702,35704,35705,35708,35710, -35713,35716,35717,35723,35725,35727,35732,35733,35740,35742,35743,35896,35897, -35901,35902,35909,35911,35913,35915,35919,35921,35923,35924,35927,35928,35931, -35933,35929,35939,35940,35942,35944,35945,35949,35955,35957,35958,35963,35966, -35974,35975,35979,35984,35986,35987,35993,35995,35996,36004,36025,36026,36037, -36038,36041,36043,36047,36054,36053,36057,36061,36065,36072,36076,36079,36080, -36082,36085,36087,36088,36094,36095,36097,36099,36105,36114,36119,36123,36197, -36201,36204,36206,36223,36226,36228,36232,36237,36240,36241,36245,36254,36255, -36256,36262,36267,36268,36271,36274,36277,36279,36281,36283,36288,36293,36294, -36295,36296,36298,36302,36305,36308,36309,36311,36313,36324,36325,36327,36332, -36336,36284,36337,36338,36340,36349,36353,36356,36357,36358,36363,36369,36372, -36374,36384,36385,36386,36387,36390,36391,36401,36403,36406,36407,36408,36409, -36413,36416,36417,36427,36429,36430,36431,36436,36443,36444,36445,36446,36449, -36450,36457,36460,36461,36463,36464,36465,36473,36474,36475,36482,36483,36489, -36496,36498,36501,36506,36507,36509,36510,36514,36519,36521,36525,36526,36531, -36533,36538,36539,36544,36545,36547,36548,36551,36559,36561,36564,36572,36584, -36590,36592,36593,36599,36601,36602,36589,36608,36610,36615,36616,36623,36624, -36630,36631,36632,36638,36640,36641,36643,36645,36647,36648,36652,36653,36654, -36660,36661,36662,36663,36666,36672,36673,36675,36679,36687,36689,36690,36691, -36692,36693,36696,36701,36702,36709,36765,36768,36769,36772,36773,36774,36789, -36790,36792,36798,36800,36801,36806,36810,36811,36813,36816,36818,36819,36821, -36832,36835,36836,36840,36846,36849,36853,36854,36859,36862,36866,36868,36872, -36876,36888,36891,36904,36905,36911,36906,36908,36909,36915,36916,36919,36927, -36931,36932,36940,36955,36957,36962,36966,36967,36972,36976,36980,36985,36997, -37000,37003,37004,37006,37008,37013,37015,37016,37017,37019,37024,37025,37026, -37029,37040,37042,37043,37044,37046,37053,37068,37054,37059,37060,37061,37063, -37064,37077,37079,37080,37081,37084,37085,37087,37093,37074,37110,37099,37103, -37104,37108,37118,37119,37120,37124,37125,37126,37128,37133,37136,37140,37142, -37143,37144,37146,37148,37150,37152,37157,37154,37155,37159,37161,37166,37167, -37169,37172,37174,37175,37177,37178,37180,37181,37187,37191,37192,37199,37203, -37207,37209,37210,37211,37217,37220,37223,37229,37236,37241,37242,37243,37249, -37251,37253,37254,37258,37262,37265,37267,37268,37269,37272,37278,37281,37286, -37288,37292,37293,37294,37296,37297,37298,37299,37302,37307,37308,37309,37311, -37314,37315,37317,37331,37332,37335,37337,37338,37342,37348,37349,37353,37354, -37356,37357,37358,37359,37360,37361,37367,37369,37371,37373,37376,37377,37380, -37381,37382,37383,37385,37386,37388,37392,37394,37395,37398,37400,37404,37405, -37411,37412,37413,37414,37416,37422,37423,37424,37427,37429,37430,37432,37433, -37434,37436,37438,37440,37442,37443,37446,37447,37450,37453,37454,37455,37457, -37464,37465,37468,37469,37472,37473,37477,37479,37480,37481,37486,37487,37488, -37493,37494,37495,37496,37497,37499,37500,37501,37503,37512,37513,37514,37517, -37518,37522,37527,37529,37535,37536,37540,37541,37543,37544,37547,37551,37554, -37558,37560,37562,37563,37564,37565,37567,37568,37569,37570,37571,37573,37574, -37575,37576,37579,37580,37581,37582,37584,37587,37589,37591,37592,37593,37596, -37597,37599,37600,37601,37603,37605,37607,37608,37612,37614,37616,37625,37627, -37631,37632,37634,37640,37645,37649,37652,37653,37660,37661,37662,37663,37665, -37668,37669,37671,37673,37674,37683,37684,37686,37687,37703,37704,37705,37712, -37713,37714,37717,37719,37720,37722,37726,37732,37733,37735,37737,37738,37741, -37743,37744,37745,37747,37748,37750,37754,37757,37759,37760,37761,37762,37768, -37770,37771,37773,37775,37778,37781,37784,37787,37790,37793,37795,37796,37798, -37800,37803,37812,37813,37814,37818,37801,37825,37828,37829,37830,37831,37833, -37834,37835,37836,37837,37843,37849,37852,37854,37855,37858,37862,37863,37881, -37879,37880,37882,37883,37885,37889,37890,37892,37896,37897,37901,37902,37903, -37909,37910,37911,37919,37934,37935,37937,37938,37939,37940,37947,37951,37949, -37955,37957,37960,37962,37964,37973,37977,37980,37983,37985,37987,37992,37995, -37997,37998,37999,38001,38002,38020,38019,38264,38265,38270,38276,38280,38284, -38285,38286,38301,38302,38303,38305,38310,38313,38315,38316,38324,38326,38330, -38333,38335,38342,38344,38345,38347,38352,38353,38354,38355,38361,38362,38365, -38366,38367,38368,38372,38374,38429,38430,38434,38436,38437,38438,38444,38449, -38451,38455,38456,38457,38458,38460,38461,38465,38482,38484,38486,38487,38488, -38497,38510,38516,38523,38524,38526,38527,38529,38530,38531,38532,38537,38545, -38550,38554,38557,38559,38564,38565,38566,38569,38574,38575,38579,38586,38602, -38610,23986,38616,38618,38621,38622,38623,38633,38639,38641,38650,38658,38659, -38661,38665,38682,38683,38685,38689,38690,38691,38696,38705,38707,38721,38723, -38730,38734,38735,38741,38743,38744,38746,38747,38755,38759,38762,38766,38771, -38774,38775,38776,38779,38781,38783,38784,38793,38805,38806,38807,38809,38810, -38814,38815,38818,38828,38830,38833,38834,38837,38838,38840,38841,38842,38844, -38846,38847,38849,38852,38853,38855,38857,38858,38860,38861,38862,38864,38865, -38868,38871,38872,38873,38877,38878,38880,38875,38881,38884,38895,38897,38900, -38903,38904,38906,38919,38922,38937,38925,38926,38932,38934,38940,38942,38944, -38947,38950,38955,38958,38959,38960,38962,38963,38965,38949,38974,38980,38983, -38986,38993,38994,38995,38998,38999,39001,39002,39010,39011,39013,39014,39018, -39020,39083,39085,39086,39088,39092,39095,39096,39098,39099,39103,39106,39109, -39112,39116,39137,39139,39141,39142,39143,39146,39155,39158,39170,39175,39176, -39185,39189,39190,39191,39194,39195,39196,39199,39202,39206,39207,39211,39217, -39218,39219,39220,39221,39225,39226,39227,39228,39232,39233,39238,39239,39240, -39245,39246,39252,39256,39257,39259,39260,39262,39263,39264,39323,39325,39327, -39334,39344,39345,39346,39349,39353,39354,39357,39359,39363,39369,39379,39380, -39385,39386,39388,39390,39399,39402,39403,39404,39408,39412,39413,39417,39421, -39422,39426,39427,39428,39435,39436,39440,39441,39446,39454,39456,39458,39459, -39460,39463,39469,39470,39475,39477,39478,39480,39495,39489,39492,39498,39499, -39500,39502,39505,39508,39510,39517,39594,39596,39598,39599,39602,39604,39605, -39606,39609,39611,39614,39615,39617,39619,39622,39624,39630,39632,39634,39637, -39638,39639,39643,39644,39648,39652,39653,39655,39657,39660,39666,39667,39669, -39673,39674,39677,39679,39680,39681,39682,39683,39684,39685,39688,39689,39691, -39692,39693,39694,39696,39698,39702,39705,39707,39708,39712,39718,39723,39725, -39731,39732,39733,39735,39737,39738,39741,39752,39755,39756,39765,39766,39767, -39771,39774,39777,39779,39781,39782,39784,39786,39787,39788,39789,39790,39795, -39797,39799,39800,39801,39807,39808,39812,39813,39814,39815,39817,39818,39819, -39821,39823,39824,39828,39834,39837,39838,39846,39847,39849,39852,39856,39857, -39858,39863,39864,39867,39868,39870,39871,39873,39879,39880,39886,39888,39895, -39896,39901,39903,39909,39911,39914,39915,39919,39923,39927,39928,39929,39930, -39933,39935,39936,39938,39947,39951,39953,39958,39960,39961,39962,39964,39966, -39970,39971,39974,39975,39976,39977,39978,39985,39989,39990,39991,39997,40001, -40003,40004,40005,40009,40010,40014,40015,40016,40019,40020,40022,40024,40027, -40029,40030,40031,40035,40041,40042,40028,40043,40040,40046,40048,40050,40053, -40055,40059,40166,40178,40183,40185,40203,40194,40209,40215,40216,40220,40221, -40222,40239,40240,40242,40243,40244,40250,40252,40261,40253,40258,40259,40263, -40266,40275,40276,40287,40291,40290,40293,40297,40298,40299,40304,40310,40311, -40315,40316,40318,40323,40324,40326,40330,40333,40334,40338,40339,40341,40342, -40343,40344,40353,40362,40364,40366,40369,40373,40377,40380,40383,40387,40391, -40393,40394,40404,40405,40406,40407,40410,40414,40415,40416,40421,40423,40425, -40427,40430,40432,40435,40436,40446,40458,40450,40455,40462,40464,40465,40466, -40469,40470,40473,40476,40477,40570,40571,40572,40576,40578,40579,40580,40581, -40583,40590,40591,40598,40600,40603,40606,40612,40616,40620,40622,40623,40624, -40627,40628,40629,40646,40648,40651,40661,40671,40676,40679,40684,40685,40686, -40688,40689,40690,40693,40696,40703,40706,40707,40713,40719,40720,40721,40722, -40724,40726,40727,40729,40730,40731,40735,40738,40742,40746,40747,40751,40753, -40754,40756,40759,40761,40762,40764,40765,40767,40769,40771,40772,40773,40774, -40775,40787,40789,40790,40791,40792,40794,40797,40798,40808,40809,40813,40814, -40815,40816,40817,40819,40821,40826,40829,40847,40848,40849,40850,40852,40854, -40855,40862,40865,40866,40867,40869, -}; - -static const struct dbcs_index jisx0212_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0212_decmap+0,47,113},{0,0,0},{ -0,0,0},{0,0,0},{__jisx0212_decmap+67,97,124},{__jisx0212_decmap+95,66,126},{0, -0,0},{__jisx0212_decmap+156,33,80},{__jisx0212_decmap+204,33,119},{ -__jisx0212_decmap+291,33,119},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__jisx0212_decmap+378,33,126},{__jisx0212_decmap+472,33,126},{ -__jisx0212_decmap+566,33,126},{__jisx0212_decmap+660,33,126},{ -__jisx0212_decmap+754,33,126},{__jisx0212_decmap+848,33,126},{ -__jisx0212_decmap+942,33,126},{__jisx0212_decmap+1036,33,126},{ -__jisx0212_decmap+1130,33,126},{__jisx0212_decmap+1224,33,126},{ -__jisx0212_decmap+1318,33,126},{__jisx0212_decmap+1412,33,126},{ -__jisx0212_decmap+1506,33,126},{__jisx0212_decmap+1600,33,126},{ -__jisx0212_decmap+1694,33,126},{__jisx0212_decmap+1788,33,126},{ -__jisx0212_decmap+1882,33,126},{__jisx0212_decmap+1976,33,126},{ -__jisx0212_decmap+2070,33,126},{__jisx0212_decmap+2164,33,126},{ -__jisx0212_decmap+2258,33,126},{__jisx0212_decmap+2352,33,126},{ -__jisx0212_decmap+2446,33,126},{__jisx0212_decmap+2540,33,126},{ -__jisx0212_decmap+2634,33,126},{__jisx0212_decmap+2728,33,126},{ -__jisx0212_decmap+2822,33,126},{__jisx0212_decmap+2916,33,126},{ -__jisx0212_decmap+3010,33,126},{__jisx0212_decmap+3104,33,126},{ -__jisx0212_decmap+3198,33,126},{__jisx0212_decmap+3292,33,126},{ -__jisx0212_decmap+3386,33,126},{__jisx0212_decmap+3480,33,126},{ -__jisx0212_decmap+3574,33,126},{__jisx0212_decmap+3668,33,126},{ -__jisx0212_decmap+3762,33,126},{__jisx0212_decmap+3856,33,126},{ -__jisx0212_decmap+3950,33,126},{__jisx0212_decmap+4044,33,126},{ -__jisx0212_decmap+4138,33,126},{__jisx0212_decmap+4232,33,126},{ -__jisx0212_decmap+4326,33,126},{__jisx0212_decmap+4420,33,126},{ -__jisx0212_decmap+4514,33,126},{__jisx0212_decmap+4608,33,126},{ -__jisx0212_decmap+4702,33,126},{__jisx0212_decmap+4796,33,126},{ -__jisx0212_decmap+4890,33,126},{__jisx0212_decmap+4984,33,126},{ -__jisx0212_decmap+5078,33,126},{__jisx0212_decmap+5172,33,126},{ -__jisx0212_decmap+5266,33,126},{__jisx0212_decmap+5360,33,126},{ -__jisx0212_decmap+5454,33,126},{__jisx0212_decmap+5548,33,126},{ -__jisx0212_decmap+5642,33,126},{__jisx0212_decmap+5736,33,126},{ -__jisx0212_decmap+5830,33,126},{__jisx0212_decmap+5924,33,126},{ -__jisx0212_decmap+6018,33,126},{__jisx0212_decmap+6112,33,99},{0,0,0},{0,0,0}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __jisxcommon_encmap[22016] = { -8512,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41527, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41538, -8561,8562,41584,N,41539,8568,8495,41581,41580,N,8780,N,41582,41524,8555,8542, -N,N,8493,N,8825,N,41521,N,41579,N,N,N,N,41540,43554,43553,43556,43562,43555, -43561,43297,43566,43570,43569,43572,43571,43584,43583,43586,43585,N,43600, -43602,43601,43604,43608,43603,8543,43308,43619,43618,43621,43620,43634,43312, -43342,43810,43809,43812,43818,43811,43817,43329,43822,43826,43825,43828,43827, -43840,43839,43842,43841,43331,43856,43858,43857,43860,43864,43859,8544,43340, -43875,43874,43877,43876,43890,43344,43891,43559,43815,43557,43813,43560,43816, -43563,43819,43564,43820,43567,43823,43565,43821,43568,43824,43298,43330,43575, -43831,N,N,43574,43830,43576,43832,43573,43829,43578,43834,43579,43835,43581, -43837,43580,N,43582,43838,43300,43332,43591,43847,43589,43845,N,N,43590,43846, -43588,43333,43302,43334,43592,43848,43593,43849,43335,43594,43850,43596,43852, -43595,43851,43305,43337,43304,43336,43597,43853,43599,43855,43598,43854,43338, -43307,43339,43607,43863,N,N,43606,43862,43309,43341,43609,43865,43611,43867, -43610,43866,43612,43868,43613,43869,43615,43871,43614,43870,43617,43873,43616, -43872,43311,43343,43628,43884,43625,43881,43622,43878,43627,43883,43624,43880, -43626,43882,43633,43889,43636,43892,43635,43637,43893,43639,43895,43638,43894, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -43558,43814,43587,43843,43605,43861,43623,43879,43632,43888,43629,43885,43631, -43887,43630,43886,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43833,41520, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41519,41522,41526,41525,N,41523,41528,41529, -42593,N,42594,42595,42596,N,42599,N,42601,42604,42614,9761,9762,9763,9764, -9765,9766,9767,9768,9769,9770,9771,9772,9773,9774,9775,9776,9777,N,9778,9779, -9780,9781,9782,9783,9784,42597,42602,42609,42610,42611,42612,42619,9793,9794, -9795,9796,9797,9798,9799,9800,9801,9802,9803,9804,9805,9806,9807,9808,9809, -42616,9810,9811,9812,9813,9814,9815,9816,42613,42618,42615,42617,42620,10023, -42818,42819,42820,42821,42822,42823,42824,42825,42826,42827,42828,N,42829, -42830,10017,10018,10019,10020,10021,10022,10024,10025,10026,10027,10028,10029, -10030,10031,10032,10033,10034,10035,10036,10037,10038,10039,10040,10041,10042, -10043,10044,10045,10046,10047,10048,10049,10065,10066,10067,10068,10069,10070, -10072,10073,10074,10075,10076,10077,10078,10079,10080,10081,10082,10083,10084, -10085,10086,10087,10088,10089,10090,10091,10092,10093,10094,10095,10096,10097, -N,10071,42866,42867,42868,42869,42870,42871,42872,42873,42874,42875,42876,N, -42877,42878,8510,N,N,N,N,8509,8514,N,8518,8519,N,N,8520,8521,N,N,8823,8824,N, -N,N,8517,8516,N,N,N,N,N,N,N,N,N,8819,N,8556,8557,N,N,N,N,N,N,N,8744,8558,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41585,N,N,N,N,N,N,N,N,N,N,N,41583,N,N,N,N,N,N, -N,N,8818,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8747,8748,8746,8749,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8781,N,8782,8783,N,8799,8784,N,N,N, -8800,8762,N,N,8763,N,N,N,N,N,N,8541,N,N,N,N,N,N,N,8805,N,N,8807,8551,N,8796,N, -N,N,N,N,N,8778,8779,8769,8768,8809,8810,N,N,N,N,N,N,N,8552,8808,N,N,N,N,N,N,N, -8806,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8802,N,N,N,N,N,N,N,N,N,N,N,N,N, -8546,8801,N,N,N,N,8549,8550,N,N,8803,8804,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,8766,8767,N,N,8764,8765,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,8797,8798,10273,10284,10274,10285,N,N,N,N,N,N,N,N,10275,N,N,10286, -10276,N,N,10287,10278,N,N,10289,10277,N,N,10288,10279,10300,N,N,10295,N,N, -10290,10281,10302,N,N,10297,N,N,10292,10280,N,N,10296,10301,N,N,10291,10282,N, -N,10298,10303,N,N,10293,10283,N,N,10299,N,N,10304,N,N,N,N,N,N,N,N,10294,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,8739,8738,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8741,8740,N,N,N,N,N,N,N,N, -8743,8742,N,N,N,N,N,N,N,N,8737,8574,N,N,N,8571,N,N,8573,8572,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8830,8570,8569,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,8554,N,8553,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8822,N,N,8821,N,8820,8481,8482,8483,8503,N, -8505,8506,8507,8530,8531,8532,8533,8534,8535,8536,8537,8538,8539,8745,8750, -8524,8525,N,N,N,N,N,N,8513,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,9249,9250,9251,9252,9253,9254,9255,9256,9257,9258,9259, -9260,9261,9262,9263,9264,9265,9266,9267,9268,9269,9270,9271,9272,9273,9274, -9275,9276,9277,9278,9279,9280,9281,9282,9283,9284,9285,9286,9287,9288,9289, -9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302,9303,9304, -9305,9306,9307,9308,9309,9310,9311,9312,9313,9314,9315,9316,9317,9318,9319, -9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,N,N,N,N,N,N,N, -8491,8492,8501,8502,N,N,9505,9506,9507,9508,9509,9510,9511,9512,9513,9514, -9515,9516,9517,9518,9519,9520,9521,9522,9523,9524,9525,9526,9527,9528,9529, -9530,9531,9532,9533,9534,9535,9536,9537,9538,9539,9540,9541,9542,9543,9544, -9545,9546,9547,9548,9549,9550,9551,9552,9553,9554,9555,9556,9557,9558,9559, -9560,9561,9562,9563,9564,9565,9566,9567,9568,9569,9570,9571,9572,9573,9574, -9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,9586,9587,9588,9589, -9590,N,N,N,N,8486,8508,8499,8500,12396,17274,45089,15415,45090,45091,N,19324, -15974,15152,15973,12860,45092,18772,19775,N,20514,12591,45093,N,13166,20515, -16420,21058,13654,19002,N,N,N,N,15975,45094,N,20030,N,45095,45096,N,19010,N, -45097,N,20516,45098,N,17254,45099,45100,45101,20517,13946,N,N,45102,20518,N, -13405,17200,N,15463,20519,N,N,20520,45103,45104,20521,18229,45105,13655,N, -45106,N,N,N,18231,N,18019,14403,19251,N,45107,N,N,N,26953,20522,15976,20523, -12853,45108,N,45109,13925,14448,19561,N,N,22054,45110,N,N,N,N,45111,45112,N,N, -N,N,N,N,N,19824,N,18045,45113,45114,N,N,N,45115,N,N,N,N,13349,45116,13621,N, -20524,N,N,20525,20027,N,19773,16744,20527,15222,18035,45117,20530,N,N,12606, -14431,N,14430,12390,45118,45119,20299,20298,N,14899,12321,45120,20531,20532, -20533,19252,20534,N,14450,12391,19314,N,13692,N,N,13693,13694,17506,20028, -45121,20535,N,N,20536,N,N,20537,N,N,45122,16205,N,N,N,N,N,15674,16206,20542, -45123,20540,N,20541,13656,N,N,14883,12912,N,20539,20538,18985,45124,N,N,N, -15174,15173,16958,20543,18773,16487,45125,45126,N,8504,20544,20546,45127, -45128,45129,16997,20065,12362,N,N,45130,N,N,N,N,20545,12862,45131,13892,45132, -17255,45133,N,45134,14191,20547,N,N,N,18212,N,45135,45136,45137,45138,13419, -45139,45140,N,N,N,N,45141,20548,12363,45142,45143,14432,13420,18810,18482, -13657,45144,N,N,45145,45146,45147,N,45148,12913,N,20583,17729,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,45149,18284,20550,45150,N,45152,18492,45153,20066,45154,16173, -45155,15175,45156,15223,12864,45157,N,45158,N,45159,17489,N,N,17186,20554, -45160,45161,N,45162,45163,12364,17507,15675,14900,19748,45164,16974,45165, -12863,45166,20553,45167,19774,20549,20551,14958,20552,21796,45168,45151,N,N, -45169,N,N,N,N,N,20560,45170,N,45171,N,45172,20563,20561,45173,N,12866,N,19003, -20555,45174,45175,45176,45177,20559,14451,45178,45179,15176,N,45180,45181, -13350,45182,45345,20564,N,20556,45346,45347,20067,45348,15224,45349,20557, -45350,20562,45351,45352,45353,N,20565,45354,20558,45355,45356,13857,N,12365, -45357,45358,13858,12865,N,N,N,N,N,N,N,N,N,21797,N,19321,18798,14452,N,N,45359, -N,N,16175,20023,45360,N,45361,N,45362,45363,45364,45365,19032,45366,45367, -14136,16933,12900,45368,45369,N,45370,45371,15699,45372,45373,45374,20569, -45375,20574,20572,45376,N,20567,N,N,16943,20570,N,20573,20571,45377,19037,N, -20568,45378,16174,45379,19315,20575,20576,N,N,N,N,N,N,N,N,15652,20589,45380,N, -45381,18256,N,18742,20584,N,19056,N,12854,N,45382,45383,20588,45384,45385, -45386,N,N,45387,20582,20591,45388,N,16722,45389,14404,45390,18268,45391,24647, -45392,20590,17757,45393,20579,N,14454,45394,45395,14453,20577,45396,45397, -45398,45399,15450,N,20585,45400,19055,17229,20581,14193,45401,20578,20586, -20580,20049,20587,20289,45402,N,45403,N,45404,45405,N,45406,13926,N,N,14192,N, -45430,N,N,N,N,45407,45408,45409,20592,N,45410,45411,20593,20597,12366,45412,N, -45413,N,45414,19024,20596,45415,45416,45417,N,20595,20599,45418,N,45419,20598, -N,17508,N,N,45420,45421,N,45422,45423,N,14194,45424,45425,N,N,45426,N,20600, -45427,N,N,45428,45429,15429,N,16934,17509,13942,N,20601,N,N,N,N,13622,N,N, -20602,45431,N,45432,45433,20604,45434,N,N,N,45435,N,N,19253,45436,45437,45438, -14182,45601,45602,45603,N,45604,N,15153,18551,20603,45605,45606,N,45607,45608, -45609,45610,45611,N,N,N,N,N,N,N,45612,N,14917,19779,N,45613,45614,N,20606, -20771,20605,14916,N,15741,N,45615,45616,N,N,45617,14137,N,45618,N,20772,45619, -45620,13903,N,45621,N,20769,20770,N,45622,17967,45623,16764,45624,13859,N, -45625,45626,19277,20773,N,45627,N,20029,N,45628,45629,20774,45630,N,N,45631, -20777,45632,20775,45633,16718,45634,45635,N,N,N,20776,20778,45636,N,45637, -45649,N,N,20780,45638,N,N,20779,45639,19016,N,N,45640,13623,20782,20783,45641, -12847,N,45642,45643,45644,20781,N,45645,45646,45647,45648,N,45650,N,15476,N, -20786,20785,20784,45651,20566,45652,20787,45653,45654,45655,45656,15742,N, -20788,N,45657,N,N,N,45658,45659,N,19749,N,45660,45661,N,45662,N,45663,19545, -45664,45665,45666,N,20790,45667,45668,20789,20792,20791,N,N,20793,20794,12404, -45669,14389,14139,15676,17275,13860,16488,14455,45670,14702,20796,19528,17734, -45671,15225,N,20795,45672,20797,45673,N,45674,45675,N,17758,N,13173,N,N,45676, -N,N,20798,N,45677,18046,45678,N,16692,20800,20801,18476,14456,20283,20802,N,N, -13862,N,N,N,19004,16950,13937,17717,N,N,N,14195,N,45679,N,20803,N,20804,45680, -45681,18018,12639,N,N,20807,14973,45682,20806,14918,45683,20808,26222,20809, -19265,20810,N,20811,20812,15977,45684,15436,N,N,N,45685,N,N,13351,45686,20815, -45687,20813,19517,20814,N,18778,20816,20817,20818,17759,45688,N,N,20822,20820, -20821,20819,14947,20823,19562,20068,45689,N,45690,N,45691,20824,45692,45693,N, -N,45694,N,16424,20825,15706,N,45857,20826,N,17276,20031,17760,N,45858,N,45859, -45860,45861,N,45862,21061,N,45863,N,N,20827,29733,13893,45864,N,20828,19294, -45865,N,N,45866,15720,17020,N,20830,18020,N,N,20831,45867,N,20832,13102,45868, -45869,45870,20833,13863,45871,17996,12666,15696,N,N,18465,20834,17761,45872, -45873,16207,20835,45874,18988,16474,13346,N,13353,20836,N,N,20838,N,N,14138, -45875,45876,20837,45877,45878,20083,45879,N,N,N,N,15721,N,N,N,N,45880,N,18493, -19020,N,20839,45881,19832,20840,N,N,N,20841,N,17790,45882,45883,20842,N,45884, -16425,14974,14196,20843,15177,14703,45885,N,N,N,N,N,N,17510,20845,45886,N, -16935,N,45887,14959,20846,20847,16688,N,20844,N,N,N,N,20849,45888,19254,45889, -45890,N,45891,14692,45892,N,20848,45893,45894,45895,N,14197,14942,18285,45896, -N,N,20852,20850,N,N,N,45897,18811,15978,20859,13156,20853,20851,16719,N,45898, -45899,45900,N,N,N,20855,N,20854,45901,N,45902,13124,N,45903,N,14176,20860, -20013,45904,N,45905,20856,N,N,N,20861,20858,45906,20857,45907,45908,45909, -45910,N,45911,20047,45912,N,N,14457,12867,N,N,20084,45913,45914,45915,45916,N, -15733,17752,14693,21026,21027,N,45917,45918,20069,N,N,20267,21029,45919,45920, -45921,14458,45922,45923,21028,45924,13103,N,45925,21030,N,19286,45926,17468, -45927,19750,45928,19033,N,N,45929,21031,N,45930,N,45931,28757,N,45932,17968, -45933,21032,13354,19507,N,45934,45935,15905,21033,19047,21037,45936,16426, -21034,13904,45937,21035,13355,45938,45939,45940,N,45941,N,N,N,45942,45943, -14126,21038,45944,21039,45945,45946,21040,21041,15451,N,N,N,14459,19550,45947, -19560,18039,45948,N,19057,21042,N,21043,N,45949,45950,46113,21045,N,21047, -21046,46114,N,46115,N,21048,12861,19276,46116,14972,21049,46117,46118,16729, -46119,46120,15906,13865,N,21050,N,46121,N,46122,46123,46124,18523,46125,46126, -46127,N,21051,46128,21052,46129,21053,N,46130,N,N,21054,18724,13928,12389, -46131,46132,46133,17983,21055,15677,46134,16489,N,21057,21056,15907,14433, -21059,18494,46136,46135,21060,N,N,N,18524,16948,17006,13864,N,N,18030,17201, -46137,18286,46138,19278,N,21062,N,16490,46139,N,46140,N,46141,14133,N,N,21063, -N,N,46142,46143,21064,12588,12405,13421,46144,16936,13649,19825,N,21067,12855, -46145,N,21066,N,N,46146,13866,N,N,21068,46147,19569,N,N,46148,46149,N,N,N,N,N, -46150,N,N,N,N,46151,46152,N,21069,N,20050,46153,14460,N,N,46154,N,14390,21070, -46155,N,N,46156,21072,21071,N,16223,12601,46157,46158,N,12638,21073,46159, -21074,N,46160,14391,46161,46162,21075,46163,46164,N,46165,13678,N,46166,N,N, -46167,N,15154,21076,N,46168,N,N,19316,14901,13658,19751,16720,18495,15485, -46169,N,N,46170,46171,15687,46172,15464,15477,N,15734,46173,18496,N,46174, -46175,21079,46176,12611,16721,14461,14405,13927,46177,46178,21083,17185,17022, -13867,15908,21084,21082,12868,16998,15416,15179,12582,N,46179,13168,14694, -15178,N,21085,21086,46180,13641,13126,N,N,N,14695,13640,17503,12581,17969, -19518,14625,19833,17735,14462,N,46181,N,N,N,N,N,N,46182,14127,N,21095,N,13923, -19274,46183,N,N,N,N,18525,46184,46185,21094,46186,13406,21089,21090,21092, -46187,N,46188,N,N,46189,46190,21093,N,13659,16225,N,18989,21091,21087,14435,N, -21088,N,20260,46191,46192,N,19058,46193,17512,14434,14704,N,N,46194,21096, -46195,N,18013,N,N,N,N,N,N,N,N,N,N,N,N,46196,21100,N,N,46197,N,46198,N,46199, -46200,15486,46201,15478,46202,N,46203,46204,N,21103,21101,N,19491,46205,21098, -21107,21102,N,N,N,21105,14406,19519,N,46206,21106,46369,N,46370,21108,46371, -21110,N,46372,46373,N,14960,20290,46374,21099,21097,21109,46375,21104,N,N, -46376,46377,N,N,N,N,N,46378,N,N,46379,N,46380,21112,N,21283,21114,46381,46382, -21118,46383,46384,21281,21115,46385,46386,21310,N,46387,14953,13105,N,N,N, -46388,21113,46389,46390,46391,21285,12406,21284,46392,12325,18762,21282,N, -21116,N,46393,21111,21117,14920,46394,N,N,46395,46396,N,N,N,N,N,N,N,N,N,21286, -N,N,N,N,N,N,N,46397,12407,21295,N,N,21287,21288,N,15909,19305,46398,N,46399, -21293,21292,46400,N,N,17711,N,N,N,46401,N,N,N,21294,N,46402,21291,46403,46404, -46405,46406,N,N,12596,46407,14902,16176,46408,46409,N,N,46410,46411,46412, -21289,17762,N,N,N,21290,46413,12322,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -46414,46415,N,N,21300,19747,N,15911,46416,21306,N,46417,46418,N,21305,21296,N, -46419,46420,46421,16963,N,21297,46422,N,N,17007,21302,15910,46423,N,46424, -46425,N,21299,46426,N,19556,46427,46428,N,14140,N,N,21303,21304,46429,N,46430, -46431,21301,21307,46432,N,46433,46434,N,21298,46435,N,46436,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,21313,21318,N,21314,46437,21309,46438,46439,21319,16689, -N,46440,21321,46441,14626,21311,17277,N,N,46442,46443,N,46444,46445,46446, -46447,N,N,46448,21315,21308,13357,N,13422,13157,21316,21312,N,N,N,46449,46450, -N,N,14198,21322,21320,16723,13642,13868,46451,21317,N,13940,N,46452,N,N,N, -12612,N,N,N,N,N,N,N,N,46453,N,46454,N,46455,21326,21324,46456,21543,N,46457,N, -46458,46459,N,46460,N,N,46461,46462,46625,21329,N,N,46626,46627,N,21323,46628, -21327,N,46629,21325,N,N,46630,15180,21328,N,N,N,N,46631,N,N,N,N,N,N,N,N,N,N,N, -N,46632,21331,N,21336,N,N,N,21334,21333,46633,46634,17202,N,46635,12869,46636, -N,N,46637,46638,46639,46640,46641,46642,N,21330,N,21332,15912,12595,46643,N, -21335,N,N,N,N,N,N,N,N,N,N,N,N,N,12894,N,N,46644,N,N,21346,46645,15996,21342, -46646,21340,46647,21341,46648,21343,46649,N,46650,46651,46652,N,46653,46654, -46655,12605,46656,46657,N,46658,N,N,46659,N,46660,16697,46661,21337,46662, -21338,N,N,N,46663,N,N,N,N,N,N,13178,N,N,46664,N,46665,46666,46667,46668,21345, -N,46669,N,13423,46670,21348,21344,21347,46671,N,46672,N,46673,46674,N,18990, -46675,N,N,18005,N,18488,N,N,N,N,N,21350,N,N,N,46676,46677,21349,13125,46678,N, -21351,46679,46680,N,N,21354,N,N,N,N,21353,46681,N,N,N,46682,46683,N,N,46684, -46685,46686,21352,N,18233,N,N,21355,46687,46688,46689,46690,N,46691,46692, -46693,21356,N,N,46694,N,46695,21358,N,21357,46696,N,N,N,N,21360,N,46697,N, -21363,21361,21359,21362,N,46698,N,N,21364,46699,46700,46701,46704,46705,21365, -46702,46703,21366,N,21367,N,N,N,21368,20805,46706,15484,15181,46707,46708, -12915,46709,12408,46710,N,17220,46711,46712,46713,46714,46715,N,N,46717,N, -46718,21369,N,14884,46716,12367,16222,N,N,46881,46882,N,21370,14407,N,N,14705, -N,21372,21371,46883,46884,19040,21373,N,N,46885,21537,21374,46886,21538,46887, -21539,N,14199,N,46888,12640,21540,N,46889,21542,N,21541,N,46890,46891,21544, -46892,N,17754,46893,N,46894,46895,46896,46897,21545,12341,14943,46898,46899,N, -46900,14141,46901,46902,17231,N,N,46903,46904,N,N,21546,21547,N,N,21549,N, -46905,46906,46907,21550,N,14948,N,N,46908,46909,13905,N,N,19255,N,46910,46911, -21548,21551,14913,14627,46912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21555,46913,N,14885, -46914,17203,46915,46916,21552,17498,46917,N,46918,46919,46920,46921,46922,N, -46923,46924,46925,N,46926,N,46927,46928,46929,46930,N,46931,21556,N,46932, -16226,46933,N,N,N,N,21554,21557,N,14143,46934,N,N,N,N,N,N,21558,46935,46944,N, -46936,N,46937,46938,N,46939,46940,46941,46942,21559,46943,14628,13120,21561,N, -N,46945,46946,46947,21562,N,46948,N,N,N,21563,N,N,21560,N,N,N,N,46949,N,N,N,N, -46950,N,N,21553,N,N,21564,N,N,21565,46951,46952,N,N,19300,46953,N,15979,46954, -N,N,21567,21568,21566,46955,21570,N,N,N,N,N,18232,46956,46957,12392,18774, -46974,N,21571,46958,N,46959,46960,N,46961,N,N,N,46962,N,N,46963,N,N,N,15997, -46964,46965,15417,46966,18269,13424,N,14955,46967,46968,46969,19289,N,17970, -46970,46971,14200,16975,N,46972,46973,21569,21572,47137,47138,N,N,N,N,N,N,N, -16964,N,N,N,21573,N,47139,N,21574,47140,47141,47142,21576,N,N,17513,N,47143, -47144,N,N,13358,N,N,47145,N,29729,12641,19059,47146,N,15980,17736,N,N,N,47147, -14950,N,N,21582,N,47148,19005,20061,N,N,N,N,N,N,N,47149,12916,21578,47150, -47151,N,47152,47153,16698,21581,N,17763,47154,N,17737,17764,18489,17485,N,N,N, -14921,47155,N,47156,21577,N,47157,N,N,47158,47159,12662,N,17718,N,N,N,N,21579, -N,21575,N,N,16208,N,N,47160,21583,N,N,47161,N,15694,47162,47163,47164,N,13869, -N,21584,N,47165,47166,47167,47168,N,47169,47170,N,47171,47172,N,N,19048,47173, -N,47174,16765,N,N,N,N,17478,47175,N,21586,47176,47177,47178,N,N,N,47179,N, -19279,47180,N,21587,N,N,21592,N,N,47181,47182,18991,N,N,N,N,21591,21585,21588, -21590,47184,N,14886,N,N,19017,47185,N,47183,21593,N,17221,47186,N,12917,N, -15981,47187,47188,N,47189,21595,47190,21594,47191,14696,47192,21596,21598, -21597,47193,N,21600,47194,21589,21602,N,47195,47196,N,21601,21599,N,N,N,47197, -N,15182,16209,N,16724,21603,16444,12397,18276,47198,N,N,N,17499,N,21605,21604, -21606,21607,21608,21609,N,N,47199,47200,N,N,19025,21610,47201,47202,N,N,12870, -21611,N,47203,47204,47205,19772,13104,N,21065,15688,16959,21612,19563,47207,N, -N,N,47208,19508,47209,47210,21614,N,16999,47211,17719,16960,18775,21615,21616, -12667,47212,47213,15418,21617,47214,N,47215,47216,12368,21618,N,N,N,N,N,21619, -47217,N,N,N,47218,12642,N,47219,13425,18016,19060,N,N,N,N,21623,16725,21622, -14144,47220,47221,19291,21621,N,17765,21625,47222,21624,47223,N,47224,47225, -47226,21627,47227,21626,47228,N,12668,N,21628,15913,21630,17189,47229,21629, -47230,18995,47393,N,N,47394,15735,17755,47395,47396,N,21793,47397,N,47398, -47399,14629,N,N,N,21794,18209,18526,19537,N,N,N,N,N,18213,47400,47401,21803, -47402,N,N,N,47403,13624,N,47404,19781,47405,N,19503,N,22060,N,21795,N,47406,N, -N,N,21798,47407,16965,N,47408,19256,N,N,N,17738,47409,47410,47411,47412,N, -21799,47413,N,N,N,47414,N,19301,47415,14922,47416,N,15914,N,N,47417,N,47418, -47419,N,21800,N,47420,15184,47421,15183,N,47422,N,N,12345,14408,47423,16427, -12369,N,N,N,N,21804,21805,N,21802,47424,47425,47426,N,N,N,47427,47428,12600, -13359,47429,21801,N,19525,18737,N,N,47430,47431,N,47432,47433,N,47434,N,12328, -47435,N,N,N,12409,N,N,N,15185,47436,12370,N,12323,47437,N,N,N,N,21810,N,N, -47438,47439,47440,N,N,21808,47441,47442,N,N,N,N,19516,N,21811,N,21809,N,47443, -21807,16177,N,N,47444,47445,21806,N,47446,47447,19034,47448,N,N,47449,N,14436, -47450,N,N,N,N,21815,21816,N,N,N,N,N,15915,N,N,N,21812,20268,N,N,47451,47452, -18252,47453,47454,21814,N,N,47455,N,N,N,47456,N,N,N,N,47457,N,N,N,N,14887,N,N, -N,47458,N,N,N,21817,47459,N,47460,18776,47461,N,N,21818,N,21813,47462,N,N,N,N, -N,N,N,N,N,47463,N,N,47464,47465,N,N,47466,19515,N,N,N,N,N,N,N,N,N,N,N,47467,N, -N,N,N,47468,N,18270,47469,N,N,47470,N,N,47471,21819,18738,47472,N,47473,47474, -47475,N,47476,N,N,N,N,47477,N,N,N,N,47478,N,N,N,N,47479,47480,47481,N,47482,N, -N,47483,N,47484,47485,21820,21824,21821,47486,N,12871,21823,N,47649,N,47650,N, -47651,15419,N,21822,14201,N,N,47652,21836,N,N,N,N,N,21829,21826,N,N,47653,N, -47654,N,N,N,47655,17252,N,21825,N,47656,21827,N,N,21828,47657,N,N,N,47658,N,N, -N,N,N,N,47659,47660,N,N,N,21830,21831,N,47661,47662,47663,N,N,N,N,N,N,47664, -13426,N,21833,21832,N,N,N,N,N,N,N,N,N,21834,47665,N,47667,N,47668,N,47669,N,N, -N,47670,15982,N,N,47671,N,N,N,N,21837,N,17500,47672,N,N,12613,N,21835,N,47666, -N,21838,N,47673,N,N,N,N,N,21839,N,21842,47674,N,21840,N,21841,N,N,N,N,N,47675, -47676,N,N,N,15186,21843,47677,N,14630,21844,47678,15226,16952,N,21845,21846, -15194,14631,47679,19538,N,N,N,13608,14409,21847,13144,N,47680,21848,N,16953,N, -N,47681,47682,21849,22051,N,21850,N,21851,N,N,21852,N,21854,N,47683,47684, -47685,47686,21855,47687,N,21856,47688,17008,47689,12583,15465,12354,47690, -16727,13360,15413,47691,14632,47692,47693,N,47694,47695,17766,47696,15649, -13361,17256,17514,12344,13625,19061,N,15426,N,N,13650,16491,15420,19752,21857, -N,47697,47698,N,N,47699,47700,13660,47701,14923,47702,47703,13106,12643,15916, -12872,47704,21858,19782,47705,N,47706,N,N,15689,47707,47708,15460,21859,13427, -18002,19497,21860,N,21861,N,N,18777,47709,N,47710,21863,N,13352,13943,21862,N, -47711,47712,47713,47714,47715,13362,N,16178,21867,15137,47716,12873,21866,N, -21864,21868,21865,18219,23629,16179,N,21869,N,N,20032,47717,21870,47718,N, -21872,47719,17278,21871,N,16419,N,15227,N,N,47720,16976,15479,18805,16492,N, -15437,21873,15917,21874,21875,12371,16954,16210,47721,21876,17971,15918,N, -15919,N,21877,N,N,16493,47722,N,N,15920,N,N,N,47723,47724,21878,N,21879,47725, -19552,N,47726,N,21880,47727,N,47728,47729,13894,47730,N,47731,15650,47732,N,N, -47733,47734,N,21881,21882,15452,16172,18036,16212,18552,18210,13897,21883,N,N, -N,13679,21884,N,13950,N,17999,12848,N,15187,21885,22050,22049,13949,N,21886,N, -17720,N,N,N,47735,47736,N,47737,N,16944,N,17739,15432,47738,47739,16728,19834, -N,47740,47741,47742,N,N,22052,47905,22053,18006,47906,15155,N,N,47907,47908, -22055,N,N,22056,47909,47910,47911,47912,N,N,N,N,N,N,N,N,N,47913,47914,N,47915, -N,22057,N,N,47916,13428,22058,47917,N,22059,N,N,N,N,N,N,N,N,47918,N,47919, -47920,12844,47921,47922,N,N,47923,N,16699,13412,47924,22061,19496,N,N,N,N, -16978,47925,13145,47926,47927,22063,22065,13407,N,47928,22062,22064,N,22067,N, -N,N,N,N,N,22066,N,22068,N,47929,N,47930,N,N,N,N,N,N,47931,N,N,N,N,47933,N, -22069,N,N,N,47932,N,N,17981,13870,N,N,N,N,N,N,12901,22070,22075,N,N,22073, -47934,19063,19062,47935,47936,N,47937,N,17767,N,N,N,22072,15700,N,22071,47938, -N,N,N,N,47939,16242,N,N,N,22076,N,47940,14954,N,N,22082,47941,N,22083,22077, -13107,22078,22087,22086,22085,22081,N,N,N,22080,N,N,22084,47943,47944,N,47945, -47946,N,19064,N,47942,N,N,N,N,N,47947,N,N,47948,N,N,N,N,47949,N,N,N,47950,N, -47951,N,N,47952,47953,N,N,47954,N,47955,N,47959,22091,22088,N,22090,N,19826, -47957,22089,N,N,47956,N,N,N,47958,N,N,22079,N,N,47960,47961,47962,47963,N, -47964,N,N,N,N,16243,47965,N,22092,47966,N,14903,47967,N,N,22093,N,N,22094,N,N, -47968,47969,N,N,N,47970,47971,N,47972,22097,47973,22096,N,N,22095,47974,N, -47975,17768,22074,N,N,N,22103,N,47976,47977,47978,47979,N,N,N,47980,N,47981,N, -22099,N,47982,47983,N,22098,N,N,N,N,47984,N,N,N,47985,22100,N,22101,N,47986,N, -58996,N,47987,N,N,22104,47988,47989,20070,N,22105,22102,N,N,N,N,N,47990,N,N,N, -47991,N,22106,N,47992,13408,22107,47994,N,47993,N,22109,22108,N,N,22110,N, -47995,47996,N,22111,N,16494,15651,N,47997,15716,N,16739,47998,14633,14904, -14634,13680,48161,N,22112,N,N,14905,N,N,14410,22113,19494,18243,22114,N,14635, -48162,48163,N,13356,N,17191,13906,48164,N,15188,18779,N,N,18497,48165,N,N,N, -22115,13429,48166,N,N,N,22118,48167,N,48168,48169,17441,N,48170,22117,22116, -22119,N,17515,N,48171,48172,N,N,N,N,16227,N,N,48174,N,N,15189,N,16458,48173, -16979,13602,N,48175,17442,N,48176,22120,22121,15983,N,N,N,N,19257,48177,N, -22124,N,N,22123,22122,18813,N,22131,N,48180,N,48178,19290,N,22125,N,48179, -48181,N,N,22127,19307,48182,22126,48183,N,N,48184,48185,N,48186,22128,N,18472, -22129,19006,22130,N,N,N,48187,N,48188,48189,48190,48191,48192,N,48193,N,13363, -19007,18223,22132,22133,N,14636,13364,22134,14392,19780,19753,13430,22136, -48194,17443,N,14637,15921,N,N,18527,N,N,15922,48195,N,N,48196,15736,N,N,N,N,N, -17516,19065,17721,N,N,14638,N,18780,N,N,N,22137,N,48197,N,48198,48199,17753, -14914,48200,N,48201,14411,48202,17517,N,N,N,48203,N,48204,N,12355,15726,14639, -19783,N,N,N,N,48205,48206,48207,N,22138,22139,18257,N,N,48208,N,22140,20087, -20269,48210,48209,N,48211,22142,22141,48212,48213,13127,48214,48215,22305,N,N, -N,22308,22309,48216,22307,48217,18752,15923,22311,22310,22306,N,48218,N,N, -22312,22313,N,48219,22314,N,N,N,22317,22315,N,22316,22318,N,12644,17518,22319, -N,14202,12918,18230,N,22320,18043,19035,48220,22321,20270,N,48221,48222,48223, -22322,19008,22325,20513,20529,48224,15408,18037,22326,N,13661,17444,12410, -22327,18982,14640,48225,N,17232,48226,48227,N,17519,N,48228,48229,48230,48231, -19567,14393,14412,48232,22328,N,48233,48234,22329,48235,22335,48236,15461,N,N, -48237,17445,48238,13871,22330,N,N,48239,18731,48240,17222,48241,48242,22331,N, -N,48243,48244,N,48245,22332,N,13872,N,22333,48246,22334,N,48247,22336,N,17782, -48248,N,22337,22338,48249,22339,N,48250,22324,22323,N,N,48251,22340,14145, -48252,48253,N,18727,48254,N,14924,18743,17446,18763,22341,N,48417,15924,12614, -48418,22342,48419,48420,N,22343,48421,19570,48422,N,18528,48423,48424,22346, -12669,16428,22345,22344,14146,16980,N,22350,22348,48425,22347,20007,14437, -48426,N,48427,15737,22349,17740,15678,N,N,48428,17984,22353,22352,N,N,48429, -48430,22351,N,22354,14438,48431,N,48434,N,N,48432,22355,18812,15707,48433, -48435,22356,18553,48436,48437,48438,N,17985,17447,N,N,N,48439,17712,N,N,22357, -13611,N,N,N,N,N,16180,48440,18732,N,48441,48442,48443,N,48444,13431,18214,N,N, -48445,48446,48447,48448,48449,N,22358,15190,19258,19259,N,N,12670,22363,48450, -N,17257,48451,48452,N,22360,N,N,N,48453,48454,48455,12919,48456,48457,48458, -48459,22573,22362,48460,48461,N,18224,48462,N,22361,N,48463,22359,48464,14714, -N,22365,48465,N,N,48466,N,N,48467,22371,22377,22369,N,17756,48468,48469,22374, -18781,48470,48471,22368,48472,22373,20071,15191,N,48473,16981,22366,N,N,48474, -13662,22376,16429,12645,22370,12920,22375,N,48475,N,13873,N,22372,N,48476,N, -48477,N,N,N,N,22378,N,N,N,N,N,48478,22380,22390,22388,N,N,22385,48479,48480, -48481,22384,20088,48482,22386,N,N,13874,48483,14641,N,48484,15738,48485,48486, -N,22393,22379,N,N,48487,N,22383,22367,48488,12922,22387,22389,17233,N,48489, -14888,12856,22381,22392,22391,13875,N,16937,13158,48490,N,N,N,14147,N,22382,N, -N,N,N,N,N,48491,48492,N,22394,48493,22397,22561,N,48494,N,48495,15421,48496, -22567,17520,22395,48497,N,N,48498,22565,48499,12921,48500,22563,22564,48501,N, -22398,22562,N,48502,48503,14439,19754,N,48504,13365,48505,48506,12633,22566, -48507,18234,12333,N,N,N,N,N,48508,48509,18529,22364,22572,22576,19557,48510, -22569,N,N,48673,17769,22574,48674,N,N,N,48675,N,48676,15984,22575,18007,48677, -48678,48679,48680,N,N,48681,48682,N,20295,N,22571,48683,48684,N,N,22577,48685, -14715,48686,16459,48687,48688,12372,22570,22568,48689,16730,N,48690,N,22396, -15156,N,N,N,N,N,N,N,16966,22589,48691,16731,22584,48692,22581,22582,48693, -15462,22585,22588,48694,48695,22583,15653,48696,22586,N,N,22580,48697,19580, -19579,48698,N,48699,22590,22591,12373,48700,48701,48702,48703,48704,22579, -48705,48706,N,48707,13938,12326,48708,N,48709,13366,N,22587,48710,N,N,N,N, -22595,22594,N,48711,48712,22599,N,N,N,48713,48714,N,N,22600,48715,48716,48717, -N,48718,N,N,22598,22601,22593,22597,N,48719,22602,N,22603,48720,48721,22592, -15228,48722,22596,16982,14642,22578,16181,N,N,N,N,22616,N,19049,N,N,22606, -22607,22608,N,N,22615,48723,22614,48724,N,19325,13367,N,22612,N,14149,13108,N, -N,22609,48725,N,20024,22611,12374,22613,48726,22604,22610,22617,14148,22605, -48727,N,N,48728,48729,N,19805,48730,48731,48732,19755,48733,48734,N,N,22620,N, -N,22624,48735,N,48736,16766,N,20089,22625,48737,48738,22622,N,22619,48739, -48740,22618,22623,N,48741,48742,N,48743,48744,N,N,N,18992,48745,N,17972,48746, -14150,48747,22626,22621,48748,22627,N,N,N,14203,N,N,N,12849,N,48749,48750, -22635,N,48751,N,13368,N,48752,48753,48754,22633,N,N,22634,14889,22632,22630, -22629,22636,22628,22638,48755,48756,12923,N,N,N,N,48757,N,N,N,N,N,N,48758, -48759,48760,48761,N,48762,48763,22640,N,48766,22639,48764,N,48765,N,N,48929, -48930,N,48931,N,N,17448,N,22643,N,22641,22631,14204,N,22642,N,22646,22645, -22647,22644,22648,48932,N,48933,48934,N,N,48935,22649,22650,19050,N,22652, -22651,15679,N,16430,12902,12924,48936,22653,48937,12351,N,N,N,16460,22654, -48938,27715,22817,14177,48939,22818,48940,48941,N,N,16495,48942,N,48943,22819, -48944,N,N,22820,13626,22821,N,22822,22823,16983,N,N,N,14413,48945,N,19553,N, -48946,N,19260,15722,22824,48947,48948,48949,N,48950,16496,28221,18530,N,15466, -48951,14925,22825,N,48952,48953,48954,16967,48955,18983,48956,N,17009,N,48957, -22828,48958,N,22826,N,22829,N,N,22827,48959,N,N,N,22830,N,N,N,N,48960,18993, -48961,N,12343,N,48962,N,N,18782,N,N,18531,48963,N,22831,48964,22834,15925, -13627,N,22832,22839,15926,N,N,N,N,22833,18244,N,N,48965,48966,48967,48968, -19806,22835,22836,22840,17770,22837,14643,16478,N,N,22854,18484,N,17010,N,N,N, -N,N,N,N,48969,N,48970,N,N,18532,23085,N,N,N,N,19066,N,48971,N,17521,48972, -48973,N,19317,48974,22843,12833,17258,48975,48976,N,N,22852,N,48977,17204, -22846,22853,22848,22855,22851,N,22850,18287,48978,22844,12925,22842,13681, -17011,22838,48979,48980,22841,14644,16475,48981,15927,22849,18258,N,N,13682, -13128,N,N,N,N,N,N,N,N,48982,N,13159,16161,22857,22862,N,22858,48983,14205, -48984,22863,15138,14697,N,N,N,N,48985,48986,15654,22845,15229,22860,48987, -48988,N,N,15192,22861,12356,48989,48990,22856,48991,N,N,48992,17449,N,48993,N, -N,48994,N,48995,13683,N,N,N,N,N,13876,N,N,N,N,N,N,N,22859,12327,48996,48997, -14915,N,48998,N,16182,N,N,N,N,N,48999,49000,N,N,49001,17522,N,49002,18516, -22865,16734,N,49003,49004,49005,49006,N,49007,N,N,16938,49008,49009,15147, -22866,49010,22868,22864,N,49011,49012,49013,19041,N,17469,49014,N,N,49015, -16732,N,N,N,N,N,N,N,N,49016,49017,19067,15438,22880,N,22879,49018,49019,16248, -N,N,49020,14206,N,49021,49022,22873,15929,49185,N,18024,18225,49186,49187,N, -49188,22871,N,49189,16733,49190,N,N,49191,15480,22876,49192,N,15928,N,22870, -22875,49193,N,18259,N,49194,49195,22869,N,14113,49196,49197,13149,N,N,49198, -22877,20011,14926,17205,22874,49199,16476,49200,14645,16228,12646,16700,22872, -13637,49201,49202,49203,N,N,14151,N,17487,22878,N,N,N,N,N,16735,N,49204,22881, -N,22883,49205,N,16951,22889,49206,22884,N,49207,22886,N,N,N,N,49208,18753, -17523,49209,22887,49210,49211,49212,19756,N,N,N,19784,13369,49213,N,N,N,49214, -12334,N,22885,N,49215,N,N,N,22882,49216,N,49217,N,13432,N,N,N,49218,49219, -12647,49220,22888,N,49221,49222,19785,22892,N,N,49223,49224,N,N,16955,N,22899, -49225,N,49226,22893,49227,N,22890,22897,49228,N,N,N,22867,N,49229,N,49230,N, -49231,N,49232,49233,22894,N,22898,49234,49235,N,18498,17771,N,49236,49237,N,N, -N,22891,49238,22895,N,N,N,14152,N,N,49239,14961,49240,N,N,16477,N,N,N,N,N,N,N, -N,49241,N,N,22903,49242,N,49243,49244,49245,49246,N,N,N,17702,N,49247,49248, -49249,49250,N,49251,49252,49253,N,49254,N,N,N,22900,N,19296,N,N,N,49255,N, -22901,N,N,N,49256,49257,N,22902,N,19534,N,16418,49258,N,49259,N,N,N,N,N,14178, -N,49260,N,49261,22909,N,N,N,N,N,N,49262,49263,49264,15157,22906,N,22905,N,N, -49265,49266,18226,49267,N,49268,17973,49269,N,49270,N,49271,17713,22907,49272, -N,49273,22908,N,18799,49274,18245,15139,N,16497,N,19280,49275,N,N,N,N,N,13129, -N,23077,22910,49276,49277,49278,N,19786,23079,N,49441,23075,N,23076,N,49442, -49443,49444,49445,16736,49446,N,49447,49448,23074,N,22847,49449,N,49450,23078, -N,23073,N,N,N,N,N,23083,23084,17703,23086,49451,49452,15140,23081,N,49453, -49454,N,13628,49455,N,23087,49456,23080,23091,N,23090,49457,23089,49458,N,N, -23092,49459,N,23094,15985,49460,23093,49461,N,N,49462,23097,N,N,49463,49464, -49465,N,N,N,N,49466,N,N,N,49467,49468,N,49469,N,23095,49470,N,49471,23096, -22896,49472,49473,N,N,49474,23099,23098,N,49475,N,N,49476,22904,23100,23088,N, -49477,15193,N,49478,N,N,23101,23102,23104,23103,23105,12926,49479,14646,49480, -49481,19068,16431,N,N,N,49482,N,14414,N,49483,23107,49484,N,N,N,23110,N,18770, -49485,13663,49486,N,49487,23109,23108,18260,23111,13877,N,N,N,23113,23112, -49488,49489,N,13370,15158,N,N,18008,49490,N,N,N,49491,14153,N,N,N,16244,N, -23114,N,16432,17704,N,18783,23115,N,49492,N,N,49493,N,N,N,49494,23116,23117,N, -49495,N,19000,21853,16454,49496,N,18764,N,14936,N,18533,18499,49497,N,N,49498, -N,17741,49499,20033,N,23119,15440,49500,N,23120,49501,12342,N,49502,13908, -16461,49503,18784,N,N,N,23121,15170,17223,49504,15195,16183,N,49505,49506, -49507,N,N,23122,N,19069,N,N,12663,15196,N,49508,N,23125,49509,23123,23126, -20025,23124,N,49510,49511,N,16507,23127,N,49512,16946,49513,N,23128,N,49514,N, -49515,13434,49516,23130,N,23129,N,N,N,49517,23131,23132,13435,N,N,18044,17206, -13676,15197,16737,N,N,15708,12336,N,N,49518,23133,49519,N,49520,49521,N,N,N, -49522,12834,23137,N,N,49523,49524,49525,N,14647,23136,49526,N,14891,15930, -49527,49528,23135,N,15931,49529,19520,14890,N,49530,49531,12375,16462,49532, -49533,N,N,N,N,N,23142,49534,49697,16433,12615,49698,49699,49700,49701,15701, -49702,19302,14962,49703,49704,49705,49706,15932,49707,16423,49708,49709,N, -49710,23141,23139,23140,49712,N,49711,N,N,17259,N,N,23334,49713,23146,15230, -14648,23144,49714,49715,N,N,23145,49716,16184,49717,N,49719,23143,N,49718, -15151,N,N,N,N,49720,49721,49722,N,49723,49724,23148,23147,23152,49725,49726, -23153,N,23149,N,13090,23150,23151,18517,49728,49729,49730,N,18785,14154,23154, -N,N,49732,16434,49733,15933,49735,49736,49737,17234,49738,49740,N,49731,49734, -49739,13895,N,23155,23159,N,N,12875,23156,23158,N,49741,49742,49743,23157,N, -49744,15723,49745,N,N,N,17224,12357,23160,49746,49747,49748,49749,23161,N, -49750,49751,N,17450,N,49752,N,20081,N,N,N,N,15171,N,49753,19051,N,N,49754, -49755,N,19261,49756,N,N,23330,23163,N,49757,23166,N,23165,49758,49759,23162, -49760,49761,23329,N,N,18014,49762,23164,N,N,49763,N,49764,49765,N,N,N,N,49766, -N,23331,N,N,15724,23332,49767,19787,18296,N,49768,23333,N,N,N,N,N,23335,N, -49769,23336,N,49770,49771,N,49772,N,23337,N,13898,12616,14649,23338,N,23339, -15729,16738,49773,49727,21080,16702,16701,16984,14919,N,N,20594,N,49774,N, -49775,14190,19757,N,19070,N,18814,49776,23340,N,N,N,49777,14963,17471,23341, -20271,N,49778,N,19262,49779,17451,23342,13436,49780,N,49781,N,N,N,23343,23344, -19546,N,19492,19318,19292,15141,23346,N,N,15467,N,49782,19281,N,23348,23351, -23350,N,13433,N,N,13664,49783,23347,N,23349,N,N,N,49784,23352,49785,49786, -16249,N,N,49787,N,19835,12361,14944,16956,N,15453,49788,49789,15987,N,N,23355, -N,N,17742,49790,23353,16939,23354,15986,19549,23356,23357,19816,49953,N,N,N, -23362,N,49954,14650,49955,18261,23359,17772,23134,23138,49956,13647,49957, -18247,N,N,N,49958,23361,N,15934,18500,N,49959,N,N,49960,23367,N,18554,N,23358, -N,23364,23363,N,49961,49962,16463,49963,N,49964,N,19309,49965,20051,49966, -49967,19303,49968,12876,15198,N,N,20296,23366,16245,N,N,N,23365,N,N,23360,N,N, -N,N,N,14415,49969,49970,49971,23372,23370,49972,12877,23368,23374,23380,N, -49973,49974,49975,N,N,49977,16968,49978,49979,19009,49980,23382,N,49981,49982, -18722,N,N,N,23381,18288,19263,13371,49983,16503,15680,N,N,49984,17491,49985, -19758,N,49986,23377,23376,N,N,49987,23378,N,23375,N,49988,23383,N,23373,N,N, -23371,N,23379,23369,49989,17260,49990,19576,15430,14964,49991,49992,N,49976,N, -14906,N,N,19311,13121,17486,17994,12617,N,N,N,N,N,N,N,N,N,N,N,N,N,N,16498, -49994,N,16436,14122,N,49995,N,N,N,49996,23385,49997,N,14651,13180,N,N,N,N, -49999,49998,23387,13172,23393,50000,50001,N,50002,50003,50004,23390,50005, -16499,N,N,N,13131,14892,N,50006,13130,14927,N,50007,23388,14181,14155,17773, -50008,50009,23386,N,12358,N,50010,N,50011,23389,23391,N,13901,14124,49993, -13372,13643,50012,N,50013,50014,23394,N,50015,14969,19313,N,15159,N,N,N,23395, -N,N,N,18736,N,N,N,50016,N,N,50017,50018,50019,50020,50021,N,23407,50022,12851, -23396,N,50023,50024,50025,50026,N,23413,23397,N,20034,50027,23404,50028,18271, -50029,N,50030,N,N,N,N,23412,N,23399,N,N,N,12340,23401,N,50031,14652,50032,N, -50033,23403,50034,23402,N,23398,23409,50035,15935,50036,N,50037,21613,14440, -19836,50038,50039,N,N,23400,50040,17524,13091,14893,50041,23392,N,23408,13153, -N,N,23406,23410,50042,17774,N,N,N,N,N,N,N,13438,50043,23602,N,50044,19529, -23415,13437,50045,23422,N,50046,50209,50210,19264,50211,23585,23587,50212, -23591,23417,50213,17194,N,50214,50215,N,17775,23595,23420,N,23592,N,50216,N, -23586,50217,N,50218,50219,50220,50221,16185,23596,50222,50223,16435,N,N,50224, -50225,N,N,23594,13373,50226,50227,50228,20304,23414,N,N,23590,12376,50229,N, -23416,50230,50231,19514,23421,16162,17479,23411,50232,50233,23589,50234,N,N, -50235,50236,N,16250,23599,13169,14369,N,N,N,N,23601,23418,23600,N,23593,23419, -N,23597,N,23598,N,N,N,N,N,23615,50237,N,50238,17998,50239,23588,N,50240,23611, -N,50241,N,23613,N,17496,N,N,50242,N,N,50243,N,N,N,50244,19788,N,N,N,50245,N,N, -N,N,18806,23608,16970,N,50246,N,23614,16703,50247,23605,23618,23617,N,18031, -23616,18026,50248,50249,50250,50251,N,50252,50253,23620,23607,50254,13896, -23610,15709,50255,50256,50257,18272,23612,13899,N,23604,23606,23603,50258, -50259,20272,13146,23609,50260,50261,23619,13109,N,N,N,N,N,N,N,14951,N,N,50262, -12637,N,N,23636,50263,N,20273,23639,50264,N,50265,N,N,16186,23638,N,N,N,23637, -50266,N,N,N,50267,50268,23634,50269,N,N,50270,N,50271,23622,50272,N,23651, -23621,N,23640,N,N,50273,50274,N,50275,23632,50276,N,23627,23624,N,23625,N, -23633,N,50277,N,29730,50278,N,23630,14653,17480,16740,23628,N,23623,50279,N, -23626,N,N,50280,50281,19789,19306,N,N,N,23631,23641,N,N,N,50282,N,N,50283,N, -23649,23642,N,N,23655,N,23653,50284,50285,N,50286,23648,50287,N,50288,N,N,N, -23647,N,17488,N,16741,50289,23645,50290,50291,23643,50292,N,23650,N,N,N,N, -23656,18549,23662,N,N,50293,N,50294,23657,23660,23654,50295,N,17268,N,18744, -50296,23644,N,50297,23652,15936,50298,19535,23672,23659,50299,N,N,N,50300, -14370,12835,13151,N,N,23635,N,50301,N,50302,N,50465,15937,23664,50466,23671, -15481,13170,50467,N,17198,50468,50469,N,N,N,N,23661,50470,50471,23666,23670, -50472,50473,13878,N,N,50474,N,50475,50476,50477,N,N,50478,50479,N,13644,23668, -N,50480,N,N,N,13601,N,17995,23667,N,50481,N,23669,50482,N,N,50483,N,N,N,N,N,N, -50484,23663,50485,N,N,N,N,23665,N,N,N,N,N,50486,13152,17225,50487,N,50488, -23676,N,50489,50490,N,50491,N,50492,N,23674,14441,N,23673,50493,N,N,N,N,N, -23841,N,N,N,50494,23384,50495,50496,50497,23675,N,23677,23678,N,50498,N,N,N,N, -23852,50499,23848,N,23405,50500,50501,50502,N,23847,50503,N,N,N,23846,N,N, -23843,N,50504,50505,50506,N,23658,23845,23844,N,N,50507,N,50509,50508,N,N, -50510,N,N,N,50511,23850,N,20262,50512,50513,50514,N,N,N,23853,13947,50515, -50516,23849,23851,N,N,N,N,50517,N,N,50518,18471,N,23854,N,50519,N,N,N,50520, -50521,50522,N,N,N,N,N,N,N,23858,23855,50523,50524,50525,50526,19827,23856, -50527,50528,N,50529,23646,N,N,N,N,50530,50531,50532,23859,N,N,N,23860,50533,N, -N,N,50534,N,12597,50535,23862,14183,15393,N,13909,50536,N,N,12836,50537,N,N, -50538,50539,N,N,50540,N,N,19807,N,N,50541,50542,23864,23863,23866,13629,50543, -N,13910,13374,50544,N,N,N,23869,N,N,50545,23868,N,23870,50546,N,12878,50547, -17207,N,23871,N,50548,13375,23873,N,50549,N,50550,23872,N,23874,N,50551,N, -23875,50552,23876,15199,16437,14881,N,18800,50553,N,19042,20292,50554,N,N, -50555,15221,50556,N,N,14928,20082,50557,N,N,23877,23878,N,15200,N,50558,50721, -23879,23880,N,50722,23882,23881,50723,19288,N,N,15710,15468,15172,N,23883,N,N, -N,N,N,N,N,23885,16163,50724,23884,N,N,50725,N,N,23886,50726,50727,N,50728, -50729,23887,N,N,N,50730,50731,23888,23889,50732,50733,50734,23890,50735,23892, -23891,23893,12837,17226,N,23894,50736,50737,15142,13132,23895,50738,50739, -17730,21580,N,N,50740,50741,13603,23896,N,N,50742,N,23897,50743,19052,19304,N, -N,N,17991,23898,18534,N,50744,N,18555,N,50745,19539,N,N,N,23899,N,50746,N, -50747,N,N,50748,50749,N,N,N,23901,23900,N,50750,23903,N,50751,N,23902,N,N,N, -50752,N,50753,N,N,N,N,N,50754,50755,N,50756,50757,N,N,23905,50758,N,N,N,50759, -50760,15201,50761,19505,50762,23906,23907,N,N,13604,N,50763,N,23908,N,N,N, -50764,N,N,N,23910,23909,N,50765,50766,50767,N,N,N,50768,N,50769,N,N,N,N,50770, -16229,50771,50772,18745,12618,N,50773,50774,N,N,18501,50775,17525,15681,13665, -N,N,N,N,N,N,N,50776,50777,N,50778,18502,50779,15406,N,50780,N,50781,23912,N, -13376,N,50782,12664,50783,50784,18034,23911,14654,17235,N,23913,N,N,N,N,50998, -23921,N,23914,50785,N,50786,N,50787,16961,N,13666,23922,50788,N,50789,N,50790, -50791,14184,50792,N,13605,23920,N,N,23918,23915,19808,N,50793,50794,50795, -17472,50796,N,N,18009,23916,N,N,23924,N,23923,14115,50797,50798,12845,50799, -50800,14907,23917,23919,50801,N,N,50802,N,19287,17012,N,N,N,N,N,N,N,N,19319,N, -N,23932,N,50803,23933,50804,12879,50805,N,N,N,18984,19581,24097,15395,15938, -23928,23934,12648,N,13879,50806,N,23925,23930,50807,N,N,16500,18289,N,18535, -50808,N,50809,50810,50811,50812,23927,50813,19233,50814,23929,N,24100,50977, -24098,50978,23931,N,N,50979,19234,18248,13667,N,17701,N,50980,17261,50981, -24101,50982,50983,N,50984,24099,16985,23926,50985,12619,50986,50987,N,N,50988, -N,N,50989,19790,24112,N,50990,50991,N,50992,24111,50993,N,N,N,16502,N,24108, -50994,19820,N,N,17974,24102,N,N,N,N,N,17477,50995,50996,50997,12620,14655, -24105,N,N,50999,51000,N,51001,15655,24110,N,24109,24104,N,24107,51002,N,13160, -51003,24106,18249,51004,N,20014,N,N,15988,16501,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,51005,N,24118,24116,N,18765,N,51006,51007,N,51008,N,24113,24115,51009, -12602,51010,N,14656,20274,N,13117,N,18786,51011,51012,N,N,N,19809,N,N,13092, -16187,24117,N,N,51013,N,N,N,N,N,51014,N,N,24122,N,51015,15939,N,N,N,19760,N, -24119,N,N,51016,51017,24114,51018,24120,51019,51020,51021,20062,N,17779,17986, -N,N,N,N,N,N,N,N,N,N,N,N,N,51022,N,51023,N,N,13110,N,N,12629,N,51024,24126,N, -51025,24129,51026,N,N,20035,51027,N,51028,19812,N,N,N,51029,24136,24130,24127, -51030,N,51031,20052,24133,N,51032,51033,N,15690,24135,N,N,24140,51034,N,17777, -24138,N,51035,N,51036,24132,51037,51038,17208,51039,N,24139,51040,24128,N, -24134,51041,24141,12412,24131,N,24142,51042,51043,16188,N,15711,51044,18981, -51045,14894,N,24123,24137,17722,51046,51047,N,N,N,51048,16438,N,13161,14929, -15940,24125,15682,N,N,N,N,N,N,N,14156,N,24124,N,N,N,24146,15725,14394,N,24161, -51049,24155,13684,17743,51050,24150,24159,12335,12594,51051,N,12857,N,24152, -16940,24143,24145,14657,N,N,51052,N,N,N,51053,N,24162,51054,24157,51055,51056, -N,24149,N,N,N,N,24156,51057,51058,N,N,51059,51060,19499,51061,N,24154,24158, -51062,N,51063,51064,51065,51066,N,14416,51067,15941,N,N,17209,51068,51069, -51070,24148,N,N,51233,51234,N,N,N,19759,51235,N,N,24151,N,N,24144,17778,N,N, -24147,51236,N,N,24153,N,N,N,N,51237,N,51238,20305,15422,19326,N,24163,N,N,N,N, -N,N,N,N,N,18478,51239,N,24175,14395,N,N,51240,N,N,15712,N,24165,51241,N,N, -20015,14658,N,24178,51242,N,12398,N,N,24176,N,51243,N,N,24164,N,N,51244,51245, -24170,N,51246,24172,51247,N,N,19791,24167,N,N,17710,51248,N,24169,N,51249, -51250,51251,24177,51252,24171,19527,N,51253,51254,24166,51255,15394,24190, -51256,51257,51258,N,13162,N,24168,24173,24174,N,N,N,N,N,N,N,17004,16986,N,N,N, -N,N,N,N,N,N,N,N,N,51259,24182,51260,51261,24188,N,N,24186,N,17705,N,N,24355, -24183,51262,N,51263,N,51264,24184,24160,13689,18746,N,51265,N,15423,N,51266, -14711,51267,N,51268,51269,N,20275,N,24180,N,24354,12649,16742,51270,N,51271,N, -51272,51273,N,N,N,N,18297,N,13377,20090,N,N,51274,N,N,51275,51276,19489,17490, -51283,N,51277,51278,24187,24189,51279,N,N,51280,N,16690,N,N,51281,51282,N, -24353,24185,N,24179,N,N,N,13379,N,N,N,N,N,N,N,N,N,51284,N,51285,51286,51287, -14185,N,N,51288,24367,51289,51290,24362,16504,51291,51292,13155,N,51293,51294, -N,15713,N,24371,N,51295,N,N,N,51296,24364,17452,24361,17497,N,N,N,24396,N,N,N, -24358,N,24357,N,24366,51297,51298,N,24360,24359,24365,51299,16417,N,24356, -51300,51301,N,N,51302,51303,51304,24368,N,51305,24369,51306,51307,51308,N, -51309,13378,N,N,51310,N,N,N,N,51311,51312,24374,N,24373,24375,51313,51314, -51315,51316,N,24378,N,N,N,51317,51318,51319,17731,N,24372,N,51320,51321,N,N, -24376,N,N,51322,N,N,N,14179,17017,24370,18235,N,51323,24377,51324,51325,N, -51326,N,N,N,N,N,N,N,N,N,24382,24380,N,N,24383,N,51489,24386,N,N,51490,24379, -14698,18216,N,N,24121,N,N,N,51491,51492,N,19828,24381,N,24385,17013,51493, -24384,N,24363,N,51494,28521,N,N,51495,24389,N,51496,51497,24393,51498,24391,N, -N,N,51499,51500,51501,N,24387,N,24388,N,51502,N,24392,N,24390,N,N,N,18766,N, -51503,24398,N,24395,24394,N,24397,18004,24399,51504,N,N,51505,N,N,17269,17005, -N,N,N,N,16421,N,N,51506,24400,N,24402,N,51507,N,N,51508,N,51509,N,N,51510,N, -24401,N,N,N,N,51511,51512,N,N,N,51513,51514,51515,51516,24181,N,51521,N,N, -24403,N,N,51517,51518,N,N,18023,N,N,N,N,51519,51520,N,N,N,N,24404,51522,51523, -N,N,N,N,N,12880,51524,N,51525,17780,13093,N,N,N,N,51526,51527,N,13668,N,N,N, -15454,14930,51528,N,N,51529,N,N,N,51530,51531,N,N,20263,16230,N,N,N,12650,N,N, -N,24406,N,51532,51533,51534,51535,51536,24405,N,51537,N,N,N,N,N,N,N,N,51538,N, -N,N,N,N,N,51539,24409,17210,24412,24407,51540,51541,N,24411,51542,N,N,51543, -24410,17728,12377,N,N,N,N,N,N,N,N,N,N,N,N,N,20085,N,51544,24414,N,N,N,12584,N, -51545,N,51546,51547,51548,51549,N,51550,24416,N,N,51551,24415,N,24413,N,N,N,N, -51552,N,N,N,N,N,N,N,N,N,N,N,N,24408,N,N,N,N,N,N,N,19235,51553,N,N,24418,51554, -51555,51556,51557,51558,N,24417,N,51559,51560,N,N,51561,N,N,N,N,12651,N,N,N,N, -24420,18994,N,24419,N,51562,N,51563,19509,N,N,N,N,15943,N,N,N,N,51564,N,51565, -N,51566,51567,51568,N,N,N,N,16691,N,51569,N,N,N,15942,N,N,N,N,51570,N,N,N, -51571,51572,51573,N,20091,51574,51575,24426,N,16505,N,51576,N,51577,N,N,24422, -24427,51578,N,12652,51579,N,51580,N,51581,N,51582,N,24425,N,18273,24421,24424, -15944,51745,18513,N,N,24428,N,15441,N,N,N,N,N,N,N,N,N,N,51746,N,N,N,16506,N,N, -51747,N,N,N,24431,51748,N,51749,24423,N,14119,N,51750,N,N,24429,N,N,51751,N, -19792,24432,N,N,N,29734,51752,51753,N,N,N,15695,51754,N,51755,N,N,N,N,N,24433, -N,N,N,24434,N,N,51756,51757,18222,51758,51759,N,N,N,N,N,24436,51760,N,N,N, -24437,51761,51762,51763,N,18227,51764,N,N,N,17781,24439,N,51765,51766,N,24441, -N,20053,N,24438,51767,24440,12653,51768,24435,N,51769,51770,N,51771,N,N,21339, -24442,N,N,N,N,16743,15160,24444,N,N,N,N,24443,16164,21081,N,N,N,N,N,N,24445,N, -N,51772,24609,N,24430,24446,N,51773,24610,51774,N,N,N,N,N,18298,51775,51776, -51777,N,N,N,24611,N,N,24612,N,N,51778,N,N,N,51779,N,N,51780,24613,N,51781,N, -51782,N,N,N,N,51783,N,N,N,24614,N,17502,51784,24616,24615,N,51785,24617,N, -24618,N,51786,15455,18787,N,51787,51788,19564,24619,24620,16726,15396,24621, -24622,51789,51790,51791,N,51792,24623,19026,18503,N,N,24624,18263,N,51793, -51794,51795,N,17453,51796,N,51797,51798,N,24625,12903,51799,13677,51800,19526, -51801,19510,51802,12852,20276,51803,N,N,N,19282,51804,18986,N,51805,N,N,51806, -51807,N,51808,16439,N,24626,N,N,51809,51810,17987,N,51811,51812,14371,24627, -51813,14932,24629,24628,N,51814,N,N,24630,N,51815,N,N,N,51816,51817,N,N,N, -24631,51818,N,N,24632,N,N,N,N,51819,N,N,N,N,13630,N,24633,N,N,N,N,24634,51820, -N,N,N,14372,51821,51822,18504,N,51823,24636,N,51824,N,15989,N,N,24635,N,N,N,N, -51825,N,N,51826,13880,24637,24639,N,24638,51827,N,51828,N,N,51829,N,24640,N, -14417,N,24641,N,N,51830,51831,13929,51832,16704,N,14717,N,N,N,51833,24643, -24644,24642,N,N,51834,N,N,N,15469,N,N,17992,13881,N,N,N,N,N,51835,51836,N,N, -24646,17196,24645,51837,51838,20277,18274,52001,52002,N,52003,52004,N,52005,N, -N,24649,52006,N,52007,N,N,N,N,52008,52009,N,N,24651,24648,52010,52011,N,19540, -24650,24652,52012,20036,N,N,52013,N,52014,24656,N,52015,52016,24655,17270, -18221,52017,N,14373,24654,N,52018,52019,N,24653,52020,19761,19762,N,N,52021, -52022,N,52023,24657,12654,N,N,N,52024,14710,15202,N,N,N,N,N,N,N,52025,24658, -24659,52026,N,52027,N,N,N,52028,24661,52029,N,N,N,N,52030,52031,52032,52033,N, -N,15683,N,N,52034,52035,24663,52036,24662,52037,52038,N,52039,52040,24664, -52041,13133,N,N,24666,N,52042,24665,52043,24668,24667,52044,N,N,N,52045,52046, -N,52047,14396,52048,52049,20008,N,13900,N,12838,N,N,52050,N,52051,N,N,52052,N, -52053,13930,52054,52055,N,N,N,52056,N,52057,52058,52059,N,52060,N,N,52061, -52062,N,N,13409,52063,52064,N,52065,N,N,N,N,20072,24670,N,52066,N,52067,N, -52068,N,24672,52069,52070,N,52071,24673,N,12881,N,N,52072,52073,N,24669,52074, -15161,52075,52076,17473,24671,52077,N,N,52078,52079,N,N,52080,N,N,52081,N,N,N, -52082,24676,N,15470,52083,N,52084,N,24674,52085,52086,N,52087,14142,N,N,18505, -24675,N,N,24702,N,N,52088,52089,N,52090,24681,52091,52092,52093,N,52094,14397, -52257,52258,52259,N,13669,52260,24678,19837,52261,N,20016,52262,N,N,N,N,N,N, -52263,N,N,N,N,N,N,N,N,52264,52265,N,N,N,N,N,N,17014,N,52266,24680,52267,N, -52268,52269,52270,52271,52272,52273,52274,52275,52276,52277,24682,20054,13911, -18556,18250,N,N,52278,24683,N,N,N,N,24685,52279,24688,N,52280,52281,N,52282, -52283,N,N,N,52284,N,52285,N,N,N,52286,52287,N,N,24684,N,52288,N,24687,14442, -12621,24689,52289,16240,24686,20060,N,52290,24692,29732,N,52291,52292,52293, -24690,24693,52294,N,52295,52296,24679,24691,52297,52298,14908,N,N,24694,N,N,N, -N,N,N,N,24695,N,52299,52300,N,19838,N,52301,52302,52303,N,52304,N,24696,N,N,N, -52305,52306,52307,52308,N,N,N,N,N,52309,52310,52311,N,52312,N,24697,52313, -52314,52315,24677,52316,N,N,52317,24698,52318,52319,52320,52321,N,N,52322, -52323,13380,52324,52325,N,N,52326,N,N,N,52327,N,52328,N,15397,N,52329,N,N,N,N, -N,N,N,N,52330,52331,24699,N,52332,N,N,24700,52333,N,N,52334,24701,N,N,N,52335, -N,52336,52337,12603,N,52338,52339,24865,N,18747,24866,52340,N,13348,24867, -52341,24868,52342,52343,N,N,24869,52344,24871,24872,24870,N,52345,N,18771, -24874,24873,N,52346,52347,52348,N,N,52349,24876,24875,24877,52350,N,N,N,N,N, -24878,24880,24879,N,N,14713,52513,24882,N,24881,52514,52515,13381,N,16211,N, -17724,N,24883,16440,52516,52517,N,15162,52518,12665,24884,52519,19793,52520, -52521,19043,24885,N,N,52522,17732,19763,14659,16189,N,N,52523,17227,21044, -52524,17454,12904,24886,52525,52526,52527,52528,N,N,52529,24887,N,24892,52530, -52531,24890,24889,23106,13094,24888,52532,12378,52533,18474,52534,N,18506,N,N, -52535,N,20017,24893,24891,17244,16422,52536,52537,18475,52538,18733,N,24895, -20012,14157,24896,N,24894,18518,24897,N,24898,N,52539,12379,52540,N,15990, -24903,N,24900,18029,24899,52541,52542,52543,52544,52545,52546,13606,N,52547, -24906,N,N,52548,24901,24902,N,24905,24904,18725,N,N,16706,16705,52549,13631, -52550,52551,24907,52552,N,N,N,52553,24908,N,52554,24909,N,N,N,N,52555,24911, -52556,24910,N,N,N,N,N,12630,N,N,N,N,N,24919,18536,24913,52557,24915,N,N,24917, -16190,52558,N,24918,24916,15424,52559,52560,52561,24912,24914,52562,18754, -52563,15945,N,N,24921,N,52564,24920,52565,52566,N,N,24922,N,15398,14895,N, -52567,17783,24923,N,17483,52568,N,24925,52569,52570,52571,20001,24924,52572,N, -N,52573,N,16745,N,N,52574,N,52575,52576,24930,52577,24932,24933,17236,N,N,N,N, -52578,24931,N,24928,N,24926,24927,52579,24929,52580,52581,52582,N,N,52583, -52584,24936,52585,24934,52586,24935,N,52587,N,N,52588,52589,N,52590,52591,N,N, -52592,N,52593,52594,52595,52596,24937,24939,24940,24941,52597,24942,52598, -52599,24938,N,52600,N,N,N,52601,N,N,24944,N,52602,52603,24943,52604,N,N,52605, -52606,52769,24945,52770,N,N,N,52772,52773,20037,52774,52775,52776,24948,24946, -24947,52777,52771,52778,13410,N,N,N,N,N,19582,N,N,52779,19018,N,24950,52780,N, -N,24949,N,N,52781,N,24951,24952,N,52782,52783,N,24956,24953,24954,24955,N, -24957,52784,52785,52786,24958,52787,25121,N,52788,N,25122,N,25123,N,18479, -17744,25124,18290,18740,N,25125,52789,N,25126,17706,52790,13095,14660,25127,N, -N,25128,52791,52792,25129,N,15145,N,N,25131,N,52793,25130,N,N,25132,25133, -52794,52795,52796,N,52797,52798,N,52799,52800,52801,52802,52803,52804,52805,N, -52806,N,N,52807,18537,N,25134,N,N,N,25135,N,N,29545,25136,25137,25138,N,N, -52808,N,15150,N,52809,25139,18262,N,52810,19295,N,12622,52811,12631,52812, -52813,25140,52814,N,N,N,25142,N,52815,N,25141,17776,N,52816,N,16441,23865,N, -25143,19521,52817,25144,N,13382,18519,25145,52818,25146,52819,N,25147,N,52820, -N,19548,N,52821,52822,19541,N,17470,N,52823,N,16746,52824,N,25149,52825,N, -15714,52826,15946,N,N,25152,N,52827,25151,25150,18557,52828,13383,14377,N, -52829,N,N,N,52830,N,52831,52832,N,52833,N,52834,52835,25158,52836,N,25155, -16191,19506,N,52837,N,25154,25156,25157,N,52838,25153,N,N,N,52839,52840,52841, -N,N,N,N,52842,52843,52844,25159,25160,52845,17455,N,13411,52846,52847,N,17253, -N,52848,N,N,52849,52850,25161,N,N,52851,N,N,52852,52853,52854,N,N,52855,N,N,N, -52856,52857,N,N,25162,25165,52858,N,52859,52860,52861,16231,52862,17988,53025, -25166,19283,53026,25163,N,53027,25164,53028,N,N,N,53029,N,53030,53031,53032,N, -N,N,N,25169,53033,N,N,53034,25168,25167,53035,N,N,N,53036,N,N,N,N,N,N,25171, -53037,53038,25170,N,N,25172,N,N,53039,53040,53041,N,N,N,53042,N,N,N,25174, -53043,25173,N,53044,N,N,19021,N,53045,N,N,53046,N,15702,20038,53047,53048, -25175,53049,N,17975,N,53050,25176,N,N,25177,N,25181,25179,25180,53051,25178,N, -N,N,53052,N,N,N,25182,N,53053,N,N,N,25183,N,N,N,53054,53055,N,N,53056,N,25184, -N,53057,25185,19511,25186,N,53058,53059,53060,N,19568,25187,53061,17230,53062, -18282,N,13931,53063,N,53064,17211,25188,13882,53065,53066,N,16464,53067,N,N,N, -53068,N,N,53069,25189,14909,N,N,53070,53071,N,N,53072,N,N,25190,53073,53074,N, -N,53075,25191,N,14374,14933,N,N,N,N,N,N,N,53076,N,N,25193,53077,53078,53079,N, -17750,14934,13646,N,N,N,N,N,53080,53081,N,53082,N,19236,N,18251,53083,N,53084, -N,N,17751,N,N,N,N,14684,N,N,N,53085,53086,25195,N,53087,53088,N,N,N,53089,N, -53090,N,N,N,53091,N,N,N,N,N,N,N,N,N,53092,15947,53093,N,53094,53095,N,53096, -53097,N,N,N,53098,N,53099,20018,14661,N,53100,14375,N,N,18467,N,25197,N,N,N,N, -N,53101,N,25199,N,53102,N,N,14443,N,N,N,N,25198,17526,N,N,53103,N,25201,13111, -25196,53104,N,18538,N,12592,53105,14956,N,20306,53106,N,25200,N,N,53108,53109, -53110,N,53107,N,25202,53111,N,N,19019,53112,16473,25204,N,53113,53114,N,25205, -53115,53116,53117,53118,N,25203,N,N,N,N,13134,53281,25211,53282,25210,53283,N, -15399,N,N,N,25212,25207,53284,53285,53286,25213,25208,53287,N,53288,N,18520, -25206,53289,53290,25209,53291,53292,N,N,N,25378,53294,N,N,N,53295,53296,53297, -N,N,53293,N,53298,25377,19297,N,53299,N,25214,N,N,12395,N,N,53300,53301,25380, -N,53303,53304,N,N,53305,53306,N,25379,N,53307,53302,15948,N,N,N,N,53308,25381, -N,N,N,N,53309,N,16707,N,53310,25383,25382,N,N,N,N,N,N,25384,53311,N,53312,N, -53313,53314,53315,N,N,N,N,53316,25192,53317,N,53318,25194,25386,25385,53319,N, -N,N,53320,N,N,53321,53322,N,N,N,N,15400,53323,20073,53324,15442,53325,25387, -14135,N,N,53326,53327,53328,13632,13607,15203,53329,53330,N,N,N,53331,19764, -53332,N,25393,53333,25392,16708,25389,53334,N,25391,53335,53336,15691,16192, -25390,25388,N,18218,N,N,15949,N,53337,18748,53338,N,53339,N,14935,N,N,N,N, -53340,N,N,N,N,17784,N,53341,25394,53342,53343,N,53344,25395,25417,13912,N,N, -20285,16693,N,N,N,N,25396,53345,53346,12882,17527,18977,N,53347,N,53348,53349, -53350,53351,N,53352,N,N,53353,53354,25397,N,N,N,53355,N,N,N,N,13690,25398, -53356,53357,25400,53358,N,N,25401,53359,18217,53360,N,25402,53361,N,N,N,53362, -25403,25404,53363,N,13913,12883,17989,15656,15204,53364,N,53365,N,N,53366, -53367,25405,53368,15657,N,N,N,53369,N,12874,18755,N,53370,25406,53371,N,18539, -N,53372,N,N,53373,53374,16709,53537,25409,53538,25410,18281,53539,16193,25407, -N,17249,53540,53541,25408,53542,N,N,15950,53543,N,N,N,N,N,N,53544,N,N,12380, -53545,13609,N,53546,53547,N,N,N,53548,25411,53549,53550,17528,53551,25412, -16455,N,N,53552,N,N,19501,53553,N,18723,25413,25414,17237,53554,20039,N,53555, -25416,25415,53556,N,N,N,N,N,53557,N,N,N,53558,N,53559,15471,53560,53561,25418, -12400,N,53562,53563,N,25421,53564,53565,53566,25419,12884,14158,25420,14662, -14706,N,19046,25422,53567,53568,19284,53569,53570,25424,N,N,53571,16465,12623, -12858,12332,N,N,N,N,53572,53573,25423,N,53574,N,N,53575,53576,N,53577,53578, -25425,25426,15991,N,53579,N,53580,N,25427,53581,13135,N,53582,N,N,25429,N,N,N, -14186,53583,13670,N,53584,25430,13941,N,N,25431,53585,16508,53586,17997,53587, -16480,14965,53588,53589,N,25432,N,53590,53591,N,N,N,N,53592,53593,17250,16747, -53594,25434,25436,25433,25435,N,N,N,N,N,53595,14114,53596,N,N,53597,N,N,N,N,N, -25437,14118,N,53598,N,13671,19794,25439,N,N,53599,N,53600,25440,N,N,53601, -12590,53602,53603,N,N,25443,N,N,N,13174,25442,25441,53604,25445,25438,53605, -25446,20009,53606,25447,53607,25448,N,53608,21620,25450,N,25449,N,N,N,25451, -25452,53609,20021,25453,N,28783,15951,25454,25455,15703,N,17976,25456,N,53610, -53611,17192,53612,53613,25457,N,17212,25458,53614,N,N,53615,N,13861,N,20799, -17245,15411,53616,N,53617,53618,13384,25459,N,25634,N,25462,53619,13672,N, -25461,25636,N,N,N,25460,N,15952,N,N,53620,N,N,N,25464,25465,N,17707,N,N,25466, -53621,13150,N,N,53622,N,16218,18788,53623,25468,53624,53625,53626,17000,53627, -53628,53629,53630,53793,N,25463,53794,25467,25469,N,N,14971,N,N,N,53795,N, -53796,53797,53798,N,N,N,25638,18734,53799,18470,17785,N,13914,25637,25635, -53800,18485,25470,17246,17787,N,17786,53801,14966,N,N,N,N,N,N,25656,N,N,53802, -N,N,N,53803,25640,53804,25642,N,53805,53806,N,25645,53807,25646,53808,25643, -25644,53809,53810,25641,25639,N,53811,N,N,25633,N,N,N,N,N,N,N,N,N,53812,N, -19023,12885,N,53813,N,25653,N,25650,53814,25655,53815,53816,25654,N,18291, -19495,53817,15163,25648,25657,25652,53818,25651,25647,53819,25649,53820,13385, -N,N,N,53821,N,N,N,N,17213,N,53822,16509,N,53823,53824,18466,53825,N,25662, -53826,53827,N,18468,N,53828,53829,53830,53831,N,N,16481,25659,53832,N,18511, -53833,25663,19027,53834,17243,53835,25658,25660,N,N,25661,N,N,N,N,53836,N, -53837,53838,N,53839,53840,53841,N,25664,N,N,15428,N,N,N,17990,25669,25668,N, -53842,25665,53843,N,N,20278,N,N,N,N,53844,25674,53845,53846,25678,25675,53847, -53848,53849,N,53850,N,53851,25671,53852,53853,53854,53855,N,53856,25672,N, -53857,N,53858,53859,25677,53860,53861,N,25666,21077,25673,25667,N,N,25676,N, -53862,N,53863,N,N,N,25682,53864,13386,N,25679,N,53865,53866,25680,53867,N, -25681,25684,53868,N,N,N,N,53869,N,53870,53871,N,53872,25683,18550,53873,53874, -N,N,25685,20092,19053,25690,N,N,25687,N,N,53875,N,N,N,53876,N,25686,16466,N, -25689,25691,53878,53879,53880,25688,53877,25695,N,25692,53881,53882,53883, -53884,53885,53886,25693,25670,54049,N,54050,25694,25696,N,54051,N,54052,N,N, -25697,54053,54054,N,54055,N,54056,19014,N,25698,N,N,N,54057,N,N,54058,54059, -19554,N,N,13902,14121,25699,N,N,54060,54061,N,18996,N,16232,N,19504,N,54062, -25700,N,20019,N,54063,18292,N,16710,18228,N,N,15693,N,N,54064,12352,54065, -25705,25703,N,25701,13345,54066,15953,25706,N,N,25704,N,25702,25710,N,54067, -25709,25708,25707,N,N,54068,54069,N,25711,54070,54071,54072,25712,16442,54073, -25713,N,25715,N,54074,25714,N,54075,54076,54077,14418,N,N,54078,16696,54079,N, -N,25717,54080,54081,54082,17788,54083,25716,54084,54085,N,25718,54086,18997, -16748,14663,N,25719,N,N,N,54087,20040,N,54088,N,54089,N,N,N,25721,N,N,25722,N, -25723,54090,25724,N,15205,N,25725,14159,N,N,13674,13610,N,25889,54091,19571, -14664,25726,54092,54093,54094,25892,19558,N,18236,N,54095,18739,54096,54097, -54098,15715,25891,54099,15443,14665,15206,13673,18998,25890,54100,54101,N, -16711,19266,14967,54102,N,N,54103,N,N,N,54104,15207,17501,54105,25895,20063, -14937,54106,25896,16194,N,25898,N,N,N,15954,14896,N,54107,54108,54109,25897, -54110,54111,15658,14398,16712,25893,25899,54112,54113,N,N,25894,14160,54114, -25902,25906,14187,54115,N,54116,N,N,25901,54117,N,54118,54119,25910,54120, -54121,14666,N,N,19821,12348,25907,N,54122,13675,54123,25904,N,54124,N,N,N, -25905,N,54125,17789,25903,25900,N,13096,16484,N,54126,14376,54127,54128,N, -25912,N,54129,N,54130,54131,54132,N,54133,54134,N,54135,25909,N,54136,54137, -54138,N,25911,N,54139,N,25908,N,N,54140,54141,N,14161,16947,25913,16750,54142, -54305,25926,N,N,25922,25916,N,N,54306,54307,N,N,54308,25920,15482,12381,25915, -25923,25927,14667,19542,54309,17494,25917,54310,54311,25925,54312,25914,17214, -N,25919,12349,19530,N,N,54313,54314,54315,54316,54317,25918,N,N,13915,18540, -54318,54319,54320,16749,N,20048,15727,N,N,25966,N,54321,25928,54322,16510,N, -25924,25929,25931,N,17529,25934,54324,N,25930,54325,54326,N,19028,13387,54327, -54328,19531,54329,N,12382,N,54330,25933,N,20093,54331,54332,N,N,54333,54334, -25932,54323,12655,N,N,18028,25935,N,N,54335,25942,25936,25943,N,N,N,N,54336, -54337,25939,N,N,54338,N,54339,N,N,N,18299,54340,54341,15434,25941,54342,25938, -25944,25937,N,N,15684,54343,54344,N,N,19237,54345,54346,15692,54347,N,25940, -25952,54348,N,25948,54349,25951,N,25949,25953,25947,N,25921,16467,54350,N, -18507,N,25950,54351,54352,25945,54353,N,N,16673,14162,N,15659,54354,N,54355,N, -54356,N,16165,16694,25956,N,54357,25958,25959,N,N,25955,25957,54358,N,54359, -54360,N,N,54361,25946,25954,N,25962,25961,54362,N,19322,54363,54364,14123,N,N, -54365,N,N,N,N,54366,25960,N,25964,25963,25967,54367,25969,N,54368,15164,25965, -N,N,54369,54370,25970,25971,54371,N,25972,54372,25978,17723,25974,54373,25973, -25975,25976,54374,25977,N,54375,N,54376,25979,25980,54377,54378,13388,N,25981, -N,25982,54380,54379,54381,54382,54383,N,N,N,54384,54385,26145,N,54386,N,N,N,N, -26146,26147,26148,54387,26149,26150,54388,54389,26152,26151,N,N,26153,N,N, -54390,54391,54392,N,26154,26155,54393,N,54394,54395,54396,54397,26158,26156, -26157,14945,14163,N,54398,17238,N,18483,54561,15728,N,N,18253,N,18541,26159, -22637,N,N,N,54562,54563,54564,54565,N,26160,26162,N,19813,26161,26164,26163,N, -19795,54566,26165,54567,18558,54568,54569,54570,N,N,26166,N,54571,54572,N,N, -26169,N,54573,26168,26167,N,N,54574,54575,26170,14130,N,54576,N,16674,13633, -54577,N,N,54578,26174,26171,N,N,26172,N,54579,N,26175,N,26176,26173,N,N,54580, -12585,N,54581,54582,12839,N,54583,N,26178,26179,N,54584,N,26180,N,19810,N, -54585,54586,N,N,15660,N,26182,26181,N,N,N,N,N,54587,N,N,N,54588,16233,26183,N, -54589,N,54590,26184,N,54591,26185,N,13413,54592,N,54593,54594,13389,N,54595, -26186,N,N,N,N,N,26187,54596,19293,19811,54597,54598,54599,19796,20279,N,14669, -26190,15444,26189,54600,54601,N,54602,26191,15401,54603,54604,54605,16977, -54606,26192,54607,54608,14668,54609,19543,26193,26194,N,N,26195,54610,54611, -54612,54613,26196,N,N,54614,N,54615,N,26197,N,N,N,54616,N,54617,N,54618,N,N, -15402,54619,54620,19565,54621,N,54622,54623,26199,54624,17215,54625,26198, -54626,N,N,N,54627,N,26201,N,N,N,26200,N,N,N,N,N,N,N,26202,N,N,N,16443,N,26203, -N,26204,N,N,N,19001,26205,54628,16751,26206,N,54629,N,54630,N,26207,N,N,N,N, -54631,N,20094,26210,54632,26209,26208,17456,54633,26211,16166,N,26212,N,N,N, -26213,20280,26214,N,54634,N,N,26215,26217,26216,18469,54635,18041,N,20286, -18473,N,54636,N,N,N,N,26219,N,N,15955,N,18730,N,26220,26218,54637,13390,54638, -N,N,14420,15208,N,N,18542,54639,54640,N,14378,19267,54641,26223,26221,N,14670, -N,14671,12393,N,14952,N,N,N,54642,54643,18265,N,N,N,N,N,N,N,N,12383,26228,N, -17216,N,54644,N,N,N,18264,54645,16987,54646,N,N,54647,N,54648,54649,26230, -54650,54651,26226,26229,26224,N,26227,19238,N,54652,14421,N,N,12413,26225,N,N, -N,N,N,N,N,54653,54654,26232,54817,26233,54818,54819,17977,N,54820,N,13883, -54821,54822,N,26406,18237,54823,15209,54824,N,13884,16456,20294,19502,26231, -16468,54825,N,N,N,N,N,N,N,N,N,N,54826,54827,54828,N,13651,26234,54829,N,54830, -N,54831,N,N,26236,54832,N,N,54833,N,26235,N,N,54834,N,N,26237,54835,17190,N, -18238,N,54836,N,N,N,17457,54837,N,54838,N,26403,N,N,N,N,N,N,54839,26402,54840, -N,N,54841,26238,54842,N,16213,N,18789,26405,54843,26404,14672,20307,N,54844,N, -N,N,N,N,N,N,26421,54845,54846,N,N,N,26409,26410,54847,54848,54849,N,15472,N, -54850,26408,54851,14712,26407,N,N,26411,N,N,54852,17458,18978,16675,N,N,N,N, -16988,26415,54853,26416,26412,54855,54856,54857,N,26413,N,26414,54858,N,N, -54859,14673,54854,N,N,26422,N,26418,54860,N,54861,N,18790,54862,19308,18728, -54863,N,26417,N,54864,26420,26419,N,N,N,19268,26423,N,N,N,N,54865,N,26424,N, -54866,16695,54867,26425,N,N,26427,N,26431,54868,N,26428,26426,18239,26429,N, -26430,54870,N,54871,12850,N,26437,26432,54872,54869,N,26433,54873,54874,N, -26434,N,16929,N,54875,N,54876,26436,26435,26438,54877,N,54878,54879,26439, -26440,54880,N,16195,54881,12905,N,26441,20055,N,15403,54882,54883,15661,N,N, -54884,54885,54886,15210,17239,54887,54888,N,54889,54890,26442,26443,12593, -54891,26444,54892,54893,26445,26446,54894,N,26447,N,26448,13885,23082,26449,N, -16485,26450,15435,54895,26451,N,20528,54896,54897,N,26452,19038,13404,54898, -54899,16676,15704,54900,18801,15662,N,54901,54902,N,N,N,N,N,54903,26453,14674, -26454,18508,N,26468,N,N,N,54904,26456,54905,16969,18293,14399,26455,16677, -54906,N,N,N,N,N,26457,N,N,54907,54908,54909,54910,17530,N,N,N,55073,N,N,55074, -55075,N,55076,N,N,N,N,55077,N,26459,26458,26461,N,55078,26460,N,26462,55079,N, -26464,55080,26463,N,13391,55081,26465,N,26466,26467,N,55082,14897,20041,N, -26469,16167,N,55083,N,12656,26470,26471,N,N,55084,N,55085,26472,55086,55087, -55088,N,55089,55090,N,N,55091,N,55092,55093,12402,N,26473,55094,N,N,55095, -26474,N,55096,N,55097,N,55098,18791,55099,55100,N,15431,N,26476,55101,55102,N, -55103,55104,13097,12338,55105,55106,55107,55108,26475,26478,18254,55109,16196, -55110,12886,55111,19239,55112,N,N,55113,14173,13916,55114,26477,55115,12906, -55116,55117,N,N,N,N,N,13347,55118,N,N,N,N,N,N,N,N,N,55119,12657,26482,20074, -16989,55120,N,18756,N,26494,55121,12887,26492,N,26490,26481,55122,26479,55123, -26480,55124,15459,13932,17271,55125,N,55126,18001,N,55127,N,55128,N,12625,N, -26484,26483,N,55129,55130,N,26489,26485,26488,N,55131,55132,55133,55134,19536, -26487,12888,13181,26491,55135,55136,26493,55137,55138,N,N,14164,N,N,N,N,N,N,N, -26659,26668,26669,N,N,55140,12331,55141,55142,55143,N,55144,55145,26676,N,N,N, -N,12401,N,N,26667,55146,55147,55148,26666,55149,26661,26660,55150,26658,26657, -17251,55151,17019,26663,55152,N,55153,55154,N,N,26662,N,55155,55156,55157, -26665,N,55158,N,16752,14165,N,N,55159,55160,12609,26664,55161,14675,55358, -55139,55162,55163,55164,16753,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -55165,N,N,26682,N,26683,N,12889,55166,N,N,12846,26680,55329,N,55330,55331,N, -55332,N,55333,26670,55334,26678,N,26685,26679,N,N,55335,26677,N,N,N,55336, -26486,55337,55338,26675,N,55339,55340,26671,55341,55342,55343,13392,26673, -26684,N,26674,N,N,N,55344,55345,26686,55346,26672,18300,55347,55372,N,N,N, -19817,N,N,N,26681,N,N,N,N,N,N,N,26703,55348,55349,55350,26695,N,N,N,16251,N, -55351,N,55352,13638,N,13917,N,26690,55353,55354,55355,N,12891,55356,N,15956,N, -26693,N,N,N,14938,55357,N,17745,26698,N,N,N,N,N,N,N,55359,19054,55360,26689,N, -N,N,12890,14422,18729,26699,N,26687,N,55361,26696,55362,55363,N,26706,55364, -26691,55365,N,26692,17978,N,55366,26697,N,N,55367,26694,19240,26700,12384, -55368,N,55369,N,26688,N,55370,N,N,N,55371,N,N,N,N,N,N,26702,N,26701,N,N,N,N,N, -N,18283,26708,N,26719,N,N,55373,N,13182,N,N,N,26722,N,N,26704,55374,N,N,26709, -19822,N,N,N,N,N,N,N,55375,26718,55376,55377,19797,55378,N,N,55379,20010,55380, -N,55381,55382,N,N,N,55383,17272,55384,55385,55386,13163,55387,N,N,N,55388, -18802,26724,17953,55389,55390,12337,55391,N,26717,55392,26713,16754,26707, -26715,26720,55393,18220,N,55394,55395,12330,55396,26712,55397,26721,18808,N, -55398,55399,N,N,N,55400,26716,N,26711,55401,N,N,N,N,N,15957,N,N,N,N,15663,N, -55402,55403,15404,55404,N,N,N,19544,N,N,18759,N,55405,26727,N,26736,N,N,N,N, -55406,N,55407,55408,55409,N,N,26714,N,55410,N,55411,13175,N,55412,N,N,N,15992, -26725,55413,26730,16755,55414,55415,26726,55416,26733,55417,N,17247,N,26734, -55418,55419,19798,26723,13112,55420,26729,N,55421,26732,19500,N,55422,N,N, -26735,N,N,26728,26731,N,55585,N,N,N,N,N,N,N,N,N,N,55586,N,N,55587,N,19241,N, -20257,55588,55589,55590,55591,N,26739,N,N,55592,N,N,55594,55595,26746,55596,N, -26738,15427,N,55597,55598,N,N,26705,55599,N,N,N,N,55600,N,55601,N,55602,19022, -N,19490,26745,26744,N,26740,26741,N,12598,N,55603,N,55604,26743,N,26737,55605, -55606,55607,55608,17493,55609,N,N,55610,55611,26742,12414,N,55612,N,N,55593, -55613,55614,16930,55615,N,N,N,N,N,N,19011,N,55616,26747,26913,N,18521,N,N, -55617,N,26750,15958,15433,26915,N,N,13886,55618,55619,55620,55621,55622,N, -26916,55623,18809,26749,55624,26710,N,55625,55626,55627,55628,55629,55630, -55631,26748,55632,N,N,N,20303,17954,18803,55633,N,26923,N,55634,N,N,N,N,N,N,N, -26929,N,55635,55636,55637,N,55638,26930,55639,26917,55640,N,N,18294,55641, -55642,26927,26919,55643,26921,55644,55645,N,N,55646,26931,26920,N,55647,26924, -N,N,12658,55648,18021,N,26925,26928,55649,N,55650,55651,N,55652,N,26918,55653, -16678,55654,26922,15143,16197,14128,19572,55668,19577,15730,N,N,N,N,55655,N, -55656,55657,55658,26935,26933,N,55659,55660,55661,55662,N,20302,55663,N,N,N,N, -55664,N,26932,55665,55666,N,19829,55667,26934,26936,N,N,N,N,26937,N,N,55669,N, -55670,N,26940,26938,N,55671,55672,N,N,N,17955,26939,55673,N,55674,18509,26926, -N,N,55675,N,N,N,N,N,55676,N,N,55677,15731,N,26941,26946,16756,55678,N,26945, -55841,55842,N,26914,N,55843,55844,26947,16713,N,N,26942,26944,N,55845,55846,N, -55847,55848,55849,26943,N,N,23857,23842,55850,55851,26949,55852,N,N,55853,N,N, -55854,26948,N,N,N,N,55855,N,55856,N,N,N,19830,N,25148,26950,N,N,N,N,N,55857,N, -55858,N,55859,N,55860,55861,N,26951,55862,47206,55863,N,N,N,55864,N,N,N,N,N,N, -26952,14423,N,13652,N,55865,55866,26954,20829,55867,55868,55869,55870,13685,N, -20026,55871,13939,26955,55872,55873,55874,55875,55876,N,N,26956,N,55877,N, -17262,55878,N,N,55879,N,26957,N,N,N,55880,55881,55882,N,18042,55883,12346,N,N, -N,N,N,N,N,N,N,N,N,N,55917,N,12899,26962,26963,55884,N,N,N,55885,N,26958,N, -15165,55886,N,55887,N,55888,N,55889,N,N,N,N,55890,N,26959,18242,N,55891,55892, -55893,26960,26961,26971,N,55894,N,26965,26968,55895,N,55896,55897,55898,26964, -55899,55900,55901,N,N,N,N,N,55902,55903,55904,N,55905,26966,55906,26967,15448, -N,26969,N,17217,N,14166,13122,N,N,55907,55908,N,26972,55909,N,55910,N,13119, -55911,26977,55912,N,26973,26976,55913,N,N,55914,18490,55915,N,55916,N,26974,N, -N,26975,18760,18522,26978,N,N,N,N,N,N,N,N,17021,26988,55918,26984,55919,55920, -12907,26982,N,19242,26983,55921,55922,26980,55923,26981,26986,26989,55924,N, -26987,55925,55926,55927,26985,26979,55928,55929,N,N,N,17240,55930,26996,N, -19498,N,55931,55932,N,55933,N,55934,N,26994,N,N,56097,26995,N,N,N,N,56098, -56099,N,56100,56101,N,26990,N,N,26992,N,56102,56103,26993,56104,56105,56106, -26991,56107,N,N,56108,N,56109,N,N,N,16486,N,20281,27000,56110,27001,N,N,N,N, -27169,N,16170,N,27003,56111,27006,N,N,N,56112,N,26998,26997,56113,N,27170, -56114,56115,12892,N,27004,N,27171,N,N,N,27005,56116,N,56117,56118,N,27002,N, -17459,N,26999,N,N,56119,N,N,N,18280,N,N,27175,56120,56121,56122,56123,56124, -56125,56126,N,56127,56128,19771,N,N,56129,N,N,56130,N,56131,N,56132,56133, -56134,N,N,N,N,56135,27174,56136,N,27173,56137,N,N,N,56138,N,N,N,27182,56139, -56140,56141,27176,N,56142,N,27184,N,56143,N,N,N,N,19814,27187,N,27178,56144, -56145,27179,56146,N,N,27183,N,27186,27185,56147,56148,56149,27177,N,N,56150,N, -27180,N,27197,N,N,56151,56152,N,N,56153,56154,N,56155,N,N,56156,27190,N,56157, -56158,56159,N,N,N,N,N,56160,56161,N,56162,N,27188,N,56163,27189,56164,N,N, -27194,27195,56165,13098,56166,13634,N,N,27193,56167,56168,N,56169,N,27172, -56170,N,N,56171,56172,56173,N,27192,27196,27191,56174,27198,56176,56177,56178, -27200,27199,N,56179,56175,56180,56181,56182,N,56183,56184,N,27202,27201,26970, -N,N,N,27206,56185,N,N,N,N,56186,56187,N,56188,27203,56189,N,N,56190,27204,N,N, -27205,56353,27207,56354,N,N,N,14188,56355,27209,56356,27208,56357,15664,N, -56358,56359,56360,56361,14676,24103,56362,N,N,56363,27210,15697,N,56364,56365, -13113,56366,27211,56367,12626,56368,15959,27212,56369,56370,14677,27213,12385, -56371,N,N,N,18749,56372,N,27214,N,N,N,N,16234,56373,27221,N,N,27218,N,17263,N, -56374,N,56375,N,27219,27216,13918,56376,27215,27222,N,N,N,N,N,14134,N,N,16990, -N,27228,N,N,N,N,27224,N,N,N,16949,27223,56377,27226,56378,56379,56380,N,27217, -56381,56382,N,27227,N,27229,N,N,N,56383,N,56384,18543,N,N,27225,N,27230,27232, -N,N,14419,27220,N,12353,N,N,56385,N,N,56386,56387,27231,56388,14939,20086, -27233,27234,16757,N,N,N,N,56389,56390,56391,56392,56393,20002,N,56394,56395, -56396,27235,19765,N,N,27236,27237,N,56397,19044,27238,56398,14912,N,20003,N,N, -N,N,N,56399,27243,N,N,N,N,N,N,56400,56401,56402,27244,15960,27242,56403,N, -56404,19815,27239,N,N,27241,16445,16254,56405,27240,N,27245,N,56406,18979,N,N, -27247,N,27246,56407,56408,56409,13164,N,19243,27248,N,56410,56411,N,56412, -56413,56414,N,56415,27260,27250,N,56416,N,N,N,N,27251,56417,56418,56419,N, -27252,27253,N,N,N,N,56420,56421,56422,N,N,56423,27257,N,27258,56424,56425, -27256,N,N,56426,N,56427,27254,56428,27249,27255,56429,56430,N,N,56431,N,N, -27259,28727,N,56432,N,N,56433,N,N,N,12840,56434,N,N,56435,56436,56437,N,27262, -13919,27261,56438,56439,56440,27426,N,27425,N,N,N,27428,56441,N,27427,56442, -27429,56443,N,15665,56444,27430,56445,N,27431,N,N,56446,56609,56610,56611, -27432,16446,N,19799,N,27433,N,N,18980,18246,27434,56612,27435,14379,N,56613,N, -13612,56614,N,N,27436,56615,56616,15211,18241,27437,N,13136,56617,56618,N,N, -56619,56620,27438,N,N,N,56621,27440,19831,N,27439,16198,N,27441,N,N,27442, -56622,N,27443,13393,56623,56624,56625,56626,N,N,27444,N,56627,27445,N,27446, -27447,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,13137,N,56628,56629,56630,56631,56632, -N,27448,N,27449,27450,N,N,N,N,N,12914,N,56633,16168,27451,N,56634,N,56635,N, -56636,N,N,N,56637,N,56638,27452,N,56639,N,27453,56640,N,N,N,56641,N,56642, -14400,N,17531,27454,56643,56644,N,56645,14167,N,16214,N,27457,N,17956,56646, -27456,56647,56648,14129,56649,56650,27455,17015,13613,N,N,27458,N,27459,56651, -15961,56652,N,56653,14189,56654,27460,56655,N,N,N,19244,56656,56657,16479,N, -56658,N,13686,N,19573,16714,56659,27461,56660,N,N,16199,17264,15962,56661, -56662,N,56663,27462,N,56664,N,56665,27465,56666,27466,56667,N,N,N,56668,56669, -N,14910,16962,27464,56670,15963,18750,56671,56672,56673,N,N,27463,56674,56675, -15212,N,12627,56676,27470,14168,N,56677,15214,56678,N,15213,N,20301,27469, -27468,16679,N,13645,20291,13114,15964,N,56679,56680,56681,N,56682,56683,56684, -27467,N,56685,56686,56687,N,27472,56688,27473,27471,56689,14424,N,19776,N, -56690,15215,18215,N,56691,56692,27476,56693,16448,N,17218,56694,56695,19766, -56696,27479,N,N,N,14444,56697,16447,27475,N,27480,14445,27477,27478,56698, -27474,56699,N,N,16482,17993,56700,56701,17199,N,12893,56702,N,N,56865,56866,N, -18544,N,56867,13635,N,56868,17460,N,N,27483,56869,27481,N,56870,17228,56871, -56872,56873,16449,13394,27482,N,16219,N,56874,20042,56875,56876,56877,20288, -56878,N,N,27484,27495,17461,56879,27494,56880,27491,27499,27492,N,27488,N, -17532,27487,N,N,N,27485,56881,19745,15216,N,56882,27489,N,27486,56883,56884, -56885,27493,15732,N,14401,N,56886,N,17018,56887,19269,12634,12386,N,17957, -56888,56889,27497,N,N,56895,56890,27496,N,18022,N,27501,56891,N,N,27490,N, -27500,27502,N,14380,27498,14678,56892,15445,56893,56894,27503,19800,N,N,N,N, -27506,N,27509,N,N,27507,18741,56896,N,N,56897,N,N,27504,N,N,N,56898,N,13920,N, -N,56899,N,27508,N,N,27510,56900,56901,56902,56903,56904,N,56905,27514,N,N, -27511,56910,27513,27512,N,N,56906,56907,56908,N,27515,N,15409,56909,27517, -27516,18792,N,56911,27681,N,N,N,56912,N,N,14169,N,N,N,N,27518,27682,56913,N, -27683,13636,26177,15993,N,27684,N,56914,14446,56915,56916,N,N,56917,27685, -56918,N,27686,56919,N,15166,56920,56921,N,N,N,N,23118,56922,27687,56923,27688, -56924,15666,N,27689,27690,56925,56926,27691,N,N,27692,27693,N,56927,N,56928, -56929,17195,56930,56931,27694,N,N,56932,56933,27696,N,27695,N,N,N,56934,17958, -56935,27697,56936,19245,56937,27698,N,27699,56938,27700,56939,N,56940,56941, -27701,N,56942,56943,56946,18010,56944,N,56945,N,N,N,15965,27702,56947,56948,N, -56949,N,56950,56951,14699,20526,27703,56952,N,N,N,N,N,56953,N,56954,56955,N, -27704,18751,27705,56956,27713,N,56957,N,N,N,27706,N,N,27708,56958,57121,N, -27707,27709,57122,19270,27710,27711,N,57123,N,57124,57125,27712,N,N,N,27714, -57126,N,57127,57128,13101,17511,N,18793,14946,14679,N,57129,N,N,18767,12895, -18510,27717,13395,16469,27716,27721,17273,19555,N,27719,27720,13614,N,27722, -18275,16991,57130,57131,18545,17725,27718,N,19271,12908,27724,20264,17474, -20293,57132,57133,15217,27723,57134,16945,57135,N,27740,16680,57136,N,18040,N, -18768,N,57138,57137,N,N,57139,27727,15167,15218,57140,15966,N,18277,57141, -14381,27726,27725,N,18794,N,57142,N,15425,N,57143,17746,N,57144,57145,N,57146, -N,N,57147,N,57148,57149,N,27729,27730,14680,27728,57150,57151,57152,N,57153, -27731,27732,N,27734,16931,57154,27733,13414,N,27736,N,27735,27737,N,57155, -27739,27741,N,27742,57156,N,N,N,57157,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,16470,57158,15439,27743,N,57159,N,13138,57160,27744, -57161,N,16758,27745,N,27746,18795,N,N,13615,N,N,N,N,N,N,N,57162,N,27747,57163, -N,57164,17462,N,N,57165,N,12635,N,N,57166,N,N,57167,57168,N,N,N,57169,N,N,N, -27748,N,N,N,N,57170,57171,57172,N,N,15473,N,N,57173,N,16246,N,N,57174,57175,N, -N,57176,N,N,57177,16941,N,57178,N,57179,N,57180,27751,57181,57199,N,27750,N, -57182,N,27749,N,N,57183,57184,57185,57186,N,57187,27757,27755,N,57188,27752,N, -57189,N,N,57190,57191,27754,57192,N,57193,27753,27756,N,13687,N,27760,N,16471, -N,27761,57194,57195,N,57196,14425,N,27758,27759,57197,N,N,20265,57198,57200, -57201,17463,57202,16681,N,N,N,N,N,N,27762,57203,N,27765,57204,N,N,57205,57206, -57207,N,27763,27764,19801,57208,N,N,N,17959,27768,57209,N,N,57210,N,57211,N,N, -N,N,N,N,27766,27767,27769,57212,57213,57214,57377,N,N,57378,57379,N,N,27945,N, -N,N,N,N,27772,57380,N,57381,27773,27771,57382,57383,57384,57385,N,N,N,57386,N, -N,57387,57388,27770,N,17533,N,N,27937,27941,27938,27774,57389,27939,57390, -57391,57392,27940,N,N,N,57393,27947,N,N,N,27942,N,57394,57395,57396,57397, -16472,27944,57398,57399,27946,27943,N,N,N,N,57400,N,N,57401,57402,N,57403, -57404,57405,27949,N,15667,N,27948,N,N,57406,57407,57408,27950,N,N,N,N,27951, -57409,57410,27954,27953,N,27952,N,57411,27956,27955,N,19574,N,N,57412,27958, -57413,27957,27959,57414,N,N,N,27960,57415,57416,N,57417,57418,N,N,27962,57419, -N,N,N,N,57420,N,57421,27961,16200,27963,57422,57423,13933,27964,27966,N,57424, -N,57425,N,N,N,N,57426,57427,N,N,27967,N,57428,57429,N,57430,57431,27968,27965, -57432,27969,N,15446,27970,13616,14131,N,57433,N,57434,14382,N,57435,N,N,N,N,N, -N,27971,57436,N,N,18032,N,N,17726,27972,N,N,N,N,57437,N,N,27975,N,57444,57438, -N,57439,57440,N,N,N,N,N,57441,15412,57442,57443,27974,27973,14170,27976,57445, -N,57446,13139,N,27978,N,57447,57448,14940,27977,N,27986,N,N,57449,57450,N, -27980,27982,19045,27979,57451,57452,57453,27981,N,27985,27983,13617,57454, -27984,57455,57456,N,57457,N,57458,27987,57459,57460,18266,20056,N,57461,57462, -57463,15668,N,N,N,27988,57464,57465,57466,57467,19746,27990,57468,27989,N,N, -27993,19777,57469,57470,27992,57633,13165,27991,27996,57634,N,27995,N,N,27994, -17714,27997,57635,N,57636,57637,57638,57639,57640,N,27998,57641,N,N,N,27999, -57642,57643,14700,N,14117,28000,28001,28002,57644,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -16201,28003,57645,15405,28004,57646,57647,N,28005,57648,57649,57650,21025, -20862,N,N,N,N,28006,25968,28007,17188,16171,18240,N,N,57651,57652,28008,57653, -N,19029,17492,14718,N,57654,17193,57655,57656,12586,N,19320,16215,57657,N,N,N, -57658,57659,N,57660,14174,N,57661,13921,57662,57663,19030,57664,N,N,N,N,28009, -N,N,N,N,N,57665,N,28011,57666,57667,28010,12896,N,57668,18038,28012,18295,N, -17715,57669,28013,15698,57670,N,N,28015,57671,57672,19522,28030,28017,28018, -57673,N,17481,57674,16992,16759,57675,17960,57676,28016,13653,N,57677,N,N, -28025,57678,28022,28197,17961,17248,28019,N,17534,17747,28020,28024,16224, -57679,18279,17484,57680,N,16450,28023,16942,16932,28021,12329,20258,N,N,N, -28026,57681,57682,57684,N,57685,57686,16993,57683,N,15669,16202,57687,57688, -28028,28027,57689,12399,28029,N,N,18735,N,28199,57690,N,18011,16235,57691, -57692,17241,N,13944,N,28198,19767,12607,57693,19031,12897,28193,28194,28195, -28196,17979,17187,12387,28200,N,28201,29731,N,57694,16957,57695,28202,N,12659, -16716,57696,14383,N,19802,57697,57698,28203,17708,N,N,57699,16760,15447,28204, -57700,N,28207,N,57701,15717,28205,16683,16682,57702,12388,N,20043,28209,N, -18546,28211,28210,28208,25444,13396,57703,N,28014,57704,28213,28212,57705, -57706,N,57707,28214,57708,19768,N,N,N,57709,N,57710,57711,57712,N,57713,N,N,N, -N,57714,57715,57716,18017,N,57717,19246,N,28215,N,15449,N,N,N,N,28216,57718, -28217,57719,57720,57721,28218,57722,N,17697,N,N,N,N,57723,57725,N,N,12394,N, -57726,57889,57890,N,57891,57892,N,14681,N,57724,N,20282,N,N,N,57901,N,N,57893, -N,57894,57895,57896,N,28222,57897,57898,N,57899,N,14132,28219,N,28220,57900,N, -N,18804,N,N,57903,N,13140,N,57904,57905,N,N,N,57906,19769,57902,13887,N,N,N,N, -N,17748,57907,57908,57909,N,28223,N,57910,57911,57912,N,57913,N,N,N,N,57914,N, -N,57915,N,28224,N,57916,N,57917,57918,57919,28225,57920,N,57921,N,57922,N, -57923,N,57925,57926,N,57924,N,57927,N,57928,N,N,N,17698,57929,57930,28227, -57931,28226,N,57932,N,57933,57934,N,57935,57936,N,57937,57938,N,N,N,N,N,57939, -N,N,N,57940,57941,18003,28228,15670,15456,18267,17265,57942,N,N,15474,57943, -16236,N,28229,57944,28230,57945,57946,57947,N,N,N,N,N,57948,16221,28231,57949, -28232,N,57950,N,28233,19823,N,15671,57951,N,N,N,N,28235,28234,57952,14682,N, -14707,15168,57953,57954,57955,N,N,N,N,N,57956,28238,57957,N,57958,57959,15718, -N,28237,57960,28236,N,17001,57961,N,14447,57962,16451,57963,57964,57965,N, -18480,57966,N,N,N,15673,N,57967,N,N,57968,28239,N,15967,N,57969,N,57970,N, -28242,28240,57971,57972,57973,28241,57974,57975,57976,57977,28244,28243,57978, -N,15994,N,28245,57979,57980,57981,N,57982,28246,28247,58145,58146,N,58147, -18512,14931,15457,28248,N,28249,20004,15685,19566,20044,28250,13922,N,58148, -58149,N,28251,58150,17699,58151,58152,28254,13176,16203,58153,28252,N,28253,N, -17504,58154,58155,19285,13948,N,58156,58157,N,58158,58159,58160,58161,58162, -58163,N,N,N,28256,28257,58164,N,58165,N,58166,28255,58167,N,28259,58168,58169, -N,N,58170,58171,58172,58173,N,58174,58175,N,58176,18015,13123,N,58177,28263, -58178,58179,28260,28262,58180,N,58181,N,N,N,58182,58183,28258,N,N,N,N,58184, -58185,58186,58187,N,58188,28495,N,N,28261,N,58189,58190,58191,N,N,58192,20075, -58193,58194,14426,58195,58196,58197,N,58198,N,58199,28271,58200,N,58201,58202, -17716,28266,58203,58204,28269,28267,58205,28272,N,58206,58207,58208,28273, -58209,N,N,N,N,N,28265,58210,58211,28278,12660,58212,58213,28264,N,58214,58215, -18477,N,28268,58216,15968,58217,58218,58219,N,N,N,N,58220,58221,58222,14683,N, -N,N,58223,58224,58225,58226,58227,N,58228,58229,58230,19272,58231,13924,N,N, -15686,N,17980,N,N,58232,58233,58234,N,N,58235,58236,N,N,16685,58237,28276,N, -28270,28275,58238,19523,58401,17464,28277,28274,N,N,58402,58403,N,N,N,58404, -58405,N,58406,58407,N,N,58408,N,16684,N,58409,N,N,58410,N,N,N,58411,28281, -58412,28280,58413,58414,58415,58416,N,58417,58418,58419,58420,58421,N,58422, -58423,58424,58425,N,N,58426,58427,58428,58429,28279,58430,N,19247,58431,N, -58432,N,58433,58434,58435,N,N,58436,58437,N,58438,58439,58440,N,58441,15739, -58442,N,58443,58444,28282,19039,N,58445,12628,58446,N,58447,N,18758,17266,N,N, -N,N,13688,58448,28284,58449,14685,N,N,58450,58451,N,58452,N,N,N,15148,N,58453, -N,N,N,N,58454,N,28283,16237,58455,N,N,58456,58457,N,N,16238,28449,28451,N, -58458,58459,58460,58461,15995,58462,28450,28452,58463,58464,13907,58465,18757, -58466,58467,15458,20259,N,28286,14968,N,N,20287,58468,58469,28454,58470,58471, -N,N,28453,28455,N,N,N,N,N,N,N,N,28285,N,N,58472,58473,58474,N,18025,N,17749,N, -N,58475,58476,58477,N,17495,58478,28460,58479,58480,N,58481,17219,28456,N, -58482,N,28457,N,N,N,58483,58484,N,58485,N,58486,58487,N,14125,58488,28459, -58489,58490,58491,N,58492,58493,14384,58494,N,N,N,58657,N,28458,58658,15969, -58659,58660,58661,58662,N,N,N,N,N,58663,N,58664,58665,13177,58666,N,58667,N,N, -58668,N,28464,58669,14911,16761,58670,N,17482,58671,N,N,58672,N,N,58673,N, -58674,58675,N,58676,13115,58677,58683,N,58678,28462,28463,17475,N,28461,N,N,N, -58679,58680,58681,N,N,28465,58682,N,N,N,N,N,N,58684,N,28471,58685,58686,58687, -58688,28474,58689,58690,58691,58692,58693,N,N,28473,17709,N,58694,N,N,28466, -28467,28470,58695,N,N,58696,28472,58697,58698,N,13888,58699,N,28475,28469, -58700,58701,28468,N,N,N,N,N,N,N,N,N,N,N,N,N,N,58703,58704,58702,58705,58706,N, -58707,58708,58709,28479,58710,N,N,28480,58711,58712,N,N,N,58713,58714,58715, -28481,N,N,28478,28477,58716,58717,58718,15970,17962,28476,N,N,N,N,58719,N, -28485,N,N,N,N,N,N,N,N,N,28483,N,N,58720,58721,N,58722,58723,58724,58725,28484, -28482,N,17016,N,28486,58726,N,58728,N,58727,N,28487,N,58729,28489,58730,N,N, -58731,N,58732,N,58733,N,N,N,N,13397,28488,19578,N,58734,N,N,N,58735,28500, -28490,58736,N,28493,58737,28491,58738,28492,58739,N,N,N,N,58740,N,28494,58741, -N,58742,58743,58744,28496,58745,58746,N,N,28497,N,28498,N,N,N,N,28501,28499, -28502,28504,N,28503,N,58748,58747,17465,58749,58750,N,N,N,N,58913,N,19559,N, -28505,16686,58914,N,N,28506,58915,19012,28507,13099,58916,58917,58918,12604,N, -13399,N,13398,28508,N,28509,N,28510,28511,N,N,N,58919,58920,58921,28512,58922, -13400,13141,14686,18486,58923,28514,28513,58924,N,58925,58926,28515,N,N,N,N, -12636,N,58927,N,58928,N,N,28518,58929,28517,28516,58930,28519,58931,N,N,N, -28522,N,N,58932,12359,58933,58934,28520,58935,28524,28523,N,N,58936,58937, -58938,58939,28526,28525,28527,N,17966,58940,58941,N,28528,58942,58943,58944, -58945,28529,28531,N,58946,28530,58947,18796,58948,58949,N,N,28532,58950,N, -58951,58952,58953,N,28533,N,14949,N,58954,N,28534,28535,N,58955,19273,58956,N, -N,N,58957,58958,58959,58960,16715,58961,58962,N,12324,16971,58963,28536,N, -18797,N,N,N,N,N,N,28539,28537,14687,N,28538,14402,N,58964,N,58965,N,58966, -58967,58968,N,N,19013,28541,28705,28542,28706,N,58969,12577,16216,15740,13401, -28707,N,N,N,18278,N,28709,N,58970,N,12578,N,28708,17476,58971,20045,17963, -28540,20006,N,14385,58972,58973,19803,58974,58975,N,58976,58977,58978,58979, -13945,20020,N,14120,58980,16994,26401,N,28710,13100,16239,N,58981,N,N,13142, -28712,58982,28713,28711,14180,58983,14941,15971,58984,N,58985,12579,N,N,20057, -58986,58987,58988,28715,28206,58989,28714,N,N,N,58990,58991,28718,28716,28717, -58992,28719,N,28720,20076,28721,28722,58993,16457,18491,N,N,N,16253,13415,N,N, -19770,12909,15672,14427,N,28725,58994,28724,15219,28726,28723,N,N,15144,58995, -N,N,28730,27181,N,58997,21078,58998,16247,28728,58999,59000,59001,N,N,20005, -18033,N,N,N,N,12587,59002,16483,15414,N,N,N,59003,18999,59004,12608,N,N,N, -20077,19819,N,28731,59005,17733,15483,N,59006,59169,28732,59170,28733,16204, -28734,59171,20078,N,N,28729,28736,28738,N,28737,N,28735,N,N,28739,N,N,28740, -59172,59173,16762,59174,12898,N,N,59175,59176,59177,28741,N,N,19512,59178,N, -28742,N,N,N,N,N,28743,59179,20266,59180,N,N,N,N,23345,28744,N,N,N,28745,28746, -N,N,59181,28750,59182,28747,N,28748,N,28749,28751,59183,N,N,N,59184,59185,N,N, -16452,N,N,59186,19575,59187,59188,16453,59189,59190,28752,N,18547,N,28753, -29523,19532,59191,28754,N,28755,59192,28756,13143,59193,28758,N,16217,59194,N, -N,28759,N,59195,14116,N,59196,59197,59198,28760,28764,59199,28762,59200,N, -59201,59202,28763,N,N,13171,28761,28765,N,N,59203,N,28766,N,12360,N,28767, -28768,N,N,N,N,59204,59205,59206,15972,59207,59208,N,28769,N,59209,59210,13639, -N,59211,28772,N,N,28771,N,28770,N,N,27505,59212,19036,59213,N,N,59214,59215, -28773,28774,59216,59217,N,59218,59219,59220,N,59221,N,59222,59223,N,59224,N, -28775,59225,59226,28776,59227,28777,59228,59229,28778,59230,59231,59232,N, -59233,59234,N,13402,59235,N,N,59236,59237,59238,N,59242,28779,59239,59240,N, -59241,59243,N,N,59244,N,N,N,N,N,N,N,N,28780,18211,59245,N,59246,28782,12859, -59247,28785,28784,59248,59249,N,59250,12580,N,N,N,13889,19015,17466,14882,N, -14688,15719,59251,16220,N,59252,N,28787,59254,59255,28786,19778,13416,18514, -18012,59256,N,59257,16252,20046,59253,14171,N,59258,N,59259,N,59260,28790,N, -59261,28789,59432,59262,N,N,N,N,59425,19275,17964,59426,59427,59428,N,59429, -59430,12624,59431,N,28791,28788,N,N,18769,19818,28792,59433,N,N,N,N,N,59434,N, -28793,59435,N,N,59436,28795,17002,13147,13148,28794,N,59437,59438,59439,13417, -14386,59440,59441,13418,59442,59443,17727,N,N,20064,N,N,N,59444,59445,N,59446, -59447,14428,N,N,59448,28796,59449,N,N,28797,28798,28961,N,28963,28962,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,18807,N,28964,59450,N,59451,59452,28965,59453,28966,N,N,59454, -N,28967,59455,59456,N,59457,59458,N,N,N,59459,N,N,59460,28969,28968,59461, -28970,N,59462,N,N,N,59463,N,N,N,N,N,N,N,N,N,N,N,N,N,N,18548,26188,N,N,16169,N, -59464,13618,59465,N,59466,59467,59468,N,28971,59469,28972,N,21036,23867,18515, -N,N,12411,59470,12347,N,59471,N,N,N,N,N,15220,19248,15998,59472,28973,N,19551, -N,59473,59474,28974,19804,N,12610,N,N,N,15169,59475,28975,12910,28976,59476, -59477,59478,28977,N,59479,59480,59481,28979,28980,59482,28982,28978,59483,N, -28981,N,59484,59485,13403,N,N,59486,28983,N,28984,N,N,59487,59488,59489,59490, -59491,N,N,N,59492,59493,59494,59495,28985,28986,N,59496,59497,28987,N,N,28989, -59498,59499,59500,28988,N,28991,28994,59501,59502,N,28990,28992,28993,N,59503, -28995,N,13890,59504,59505,N,59506,59507,N,59508,59509,59510,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,15475,28996,28997,14689,N,59511,N,59512,N,59513,N,N,N,N,N,28998, -59514,N,13118,N,N,N,18255,28999,29000,N,59515,59516,59517,17242,18027,59518,N, -N,N,59681,59682,N,29001,59683,N,59684,N,18301,N,59685,16972,12632,13934,N, -13935,59686,N,N,N,N,N,N,17267,29006,13936,59687,59688,12911,N,N,29005,59689, -59690,29003,59691,29004,59692,29002,N,N,29016,N,N,N,N,59693,N,N,59694,59695, -59696,29007,29008,N,59697,29009,29010,N,59698,59699,N,N,29012,59700,N,29011,N, -59701,59702,15705,29013,59703,59704,59705,29015,N,N,N,N,N,59706,59707,N,13619, -29014,59708,59709,16763,14387,N,N,59710,N,N,29017,N,N,N,N,59711,N,59712,N, -59713,59714,59715,N,N,59716,16973,N,N,29018,N,59717,59718,N,17965,N,N,59719,N, -59720,59721,29019,59722,N,N,N,N,N,29024,N,29022,59724,29021,29023,59725,29020, -N,59723,N,N,59726,59727,59728,29026,59729,N,N,59730,N,N,59731,29025,59732, -29028,N,N,13891,29027,N,59733,N,29029,N,N,29030,N,29032,29031,N,N,N,29033, -29035,29034,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,14716,N,59734,N,59735, -29036,59736,59737,29037,N,59738,N,59739,59740,59741,N,13116,59742,N,59743, -29038,N,59744,59745,29039,59746,N,59747,16241,N,59748,N,59749,N,N,N,N,N,59750, -29040,59751,29041,59752,29042,29043,59753,59754,59755,14690,N,N,59756,59757,N, -29044,29045,59758,N,29046,29047,59759,59760,29048,59761,N,59762,18481,29050, -59763,18726,29051,29049,N,29053,59764,59765,29052,59766,N,29054,N,59767,59768, -29217,N,59769,N,59770,59771,59772,59773,59774,59937,59938,29218,N,59939,59940, -N,59941,59942,59943,59944,N,59945,N,59946,N,N,N,59947,N,29219,59948,29220, -59949,59950,N,N,29221,59951,N,29222,29223,N,29224,59952,29225,29226,29227, -29228,59953,N,59954,29229,29230,N,23861,29231,59955,59956,59957,N,59958,N, -59959,59960,25720,13620,59961,N,N,N,13089,14898,29233,29232,19493,N,N,59962,N, -N,59963,59964,29235,29236,29234,N,29237,N,N,19298,59965,59966,59967,29238,N, -13691,59968,N,N,59969,N,N,59970,N,59971,N,59972,59973,N,59974,N,59975,59976, -59977,59978,59979,20261,N,N,N,59980,29239,59981,N,59982,59983,59984,N,N,N,N,N, -59985,59986,N,N,29241,59987,59988,59989,59990,N,59991,59992,59993,N,59994, -12350,59995,59996,29242,18987,29240,59997,N,29243,29244,N,N,59998,N,N,59999, -60000,29245,29246,N,N,N,N,N,60001,60002,29247,60003,19310,15149,60004,14970, -16687,N,60005,60006,60007,N,29248,N,N,60008,60009,29251,N,60010,60011,N,60012, -60013,29249,60014,N,N,N,N,29252,60015,60016,14449,29250,N,N,N,60017,29253, -60018,29254,29255,N,29259,N,15146,60019,60020,N,N,16996,N,60021,N,60022,N, -29260,29257,29256,29258,60023,N,60024,14175,N,60025,60026,N,N,N,60027,29264, -29263,29262,60028,N,12339,N,60029,60030,60193,60194,N,N,60195,N,60196,60197,N, -60198,N,29274,N,29270,N,29271,29267,29273,60199,29269,13154,N,60200,20300, -60201,29272,29268,29266,29265,60202,N,60203,60204,60205,29276,60206,N,60207,N, -N,29279,60208,60209,29278,29277,60210,60211,60212,60213,60214,N,N,18761,29275, -12403,29280,60215,29282,N,N,60216,60217,60218,N,13167,29261,12599,N,60219, -29284,N,N,60220,N,60221,60222,60223,29283,29281,17197,60224,60225,N,N,N,60226, -60227,60228,N,19312,60229,60230,N,60231,20058,60232,N,29285,60233,60240,60234, -60235,60236,29286,N,N,60237,N,N,N,29287,60242,60238,60239,60241,N,N,60243,N, -60244,N,60245,N,N,60246,29288,60247,29289,N,N,60248,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,17467,60249,29290,N,18487,N,29295,29291,N,N,N, -29292,N,60250,19249,19524,N,18000,60251,N,60252,60254,29296,N,N,29297,17982, -29294,29293,N,60253,N,N,12842,N,N,60255,29305,N,N,29304,N,60256,60257,N,N, -12661,60258,60259,60260,29302,N,N,N,29301,N,N,29299,N,13179,N,29298,15410, -12841,N,N,60261,60262,N,60263,60264,60265,N,N,N,N,N,60266,14691,60267,60269, -29308,29307,N,29306,60270,60271,29303,60268,29309,60272,29310,N,60273,N,N,N,N, -N,29477,29476,N,60274,60275,N,N,N,N,29478,N,N,12589,29473,29474,60276,14708, -19513,60278,60277,29475,60279,N,N,N,60280,60281,60282,19250,N,N,29483,60283,N, -29479,N,N,N,60284,60285,N,N,29484,60286,60449,N,60450,N,N,N,N,60451,60452,N, -60453,29481,N,29480,60454,N,N,60455,60456,14172,N,N,60457,60458,N,60459,60460, -60461,60462,N,29485,N,N,N,N,N,N,60463,N,N,29486,N,N,N,N,29487,60464,29482, -60465,N,60466,29300,N,60467,29488,N,17505,60468,N,N,29492,60469,29493,29491, -60470,N,N,60471,N,29490,29496,60472,29489,N,29494,60473,N,60474,60475,N,N,N,N, -29495,N,N,N,29498,60476,60477,60478,60479,N,29497,60480,N,N,N,60481,60482, -60483,N,N,N,N,60484,29500,60485,N,60486,N,60487,N,29501,60488,29502,60489,N, -20297,60490,60491,N,N,N,29499,17003,14957,N,N,29503,60492,60494,N,N,N,N,60495, -N,N,60493,N,N,N,60496,N,60497,60498,60499,N,N,60500,60501,N,N,60502,29504, -29505,60503,60504,29506,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29507,N,N,14388,29508,60505,60506, -60507,29509,N,15407,60508,29510,60509,60510,60511,60512,N,60513,29511,N,N, -29512,29513,N,60514,60515,N,29516,29514,20284,N,29515,60516,20079,60517,N,N, -60518,N,29517,60519,20059,N,N,N,N,60520,29518,18302,N,60521,29519,29521,N, -60522,29522,60523,60524,60525,N,N,60526,60527,60528,N,N,29520,14701,19533, -19299,22135,N,23904,19323,N,N,N,N,12843,N,60529,N,60530,N,N,60531,29524,13648, -29525,29526,29527,N,14709,N,29528,60532,N,N,24660,19547,N,16995,29529,29531, -29530,60533,29532,N,N,N,60534,29533,N,60535,29534,N,N,N,60536,60537,60538, -29535,60539,60540,60541,N,29536,60542,29537,29538,60705,29539,N,29540,29541, -29542,N,60706,60707,60708,N,N,N,29543,29544,60709,N,N,N,N,17700,60710,60711, -60712,60713,14429,60714,29546,60715,60716,N,60717,60718,60719,N,N,N,60720, -16717,29547,60721,N,N,N,60722,N,N,N,60723,60724,29548,N,N,60725,N,60726,60727, -N,60728,N,N,60729,N,60730,60731,18721,60732,60733,29549,60734,N,60735,N,60736, -60737,60738,60739,60740,N,N,29550,25399,N,N,27738,28781,N,N,29551,60741,29552, -60742,60743,60744,60745,N,60746,N,N,60747,60748,29554,29555,29556,20080,29553, -N,N,29557,29558,60749,60750,29560,N,29559,60751,60752,60753,60754,60755,29562, -60756,N,60757,29563,29561,N,N,60758,N,N,60759,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -20022,N,60760,60761,60762,60763,N,60764,29564,60765,60766,N,N,N,N,29565,25428, -60767,N,29566,60768,60769,60770,N,60771,8490,N,8564,8560,8563,8565,N,8522, -8523,8566,8540,8484,N,8485,8511,9008,9009,9010,9011,9012,9013,9014,9015,9016, -9017,8487,8488,8547,8545,8548,8489,8567,9025,9026,9027,9028,9029,9030,9031, -9032,9033,9034,9035,9036,9037,9038,9039,9040,9041,9042,9043,9044,9045,9046, -9047,9048,9049,9050,8526,N,8527,8496,8498,8494,9057,9058,9059,9060,9061,9062, -9063,9064,9065,9066,9067,9068,9069,9070,9071,9072,9073,9074,9075,9076,9077, -9078,9079,9080,9081,9082,8528,8515,8529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8497, -N,8559, -}; - -static const struct unim_index jisxcommon_encmap[256] = { -{__jisxcommon_encmap+0,92,255},{__jisxcommon_encmap+164,0,245},{ -__jisxcommon_encmap+410,199,221},{__jisxcommon_encmap+433,132,206},{ -__jisxcommon_encmap+508,1,95},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{__jisxcommon_encmap+603,16,59},{__jisxcommon_encmap+647,3,212},{ -__jisxcommon_encmap+857,0,165},{__jisxcommon_encmap+1023,18,18},{0,0,0},{ -__jisxcommon_encmap+1024,0,239},{__jisxcommon_encmap+1264,5,111},{0,0,0},{0,0, -0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__jisxcommon_encmap+1371,0,254},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisxcommon_encmap+1626,0,255},{ -__jisxcommon_encmap+1882,0,255},{__jisxcommon_encmap+2138,0,254},{ -__jisxcommon_encmap+2393,0,254},{__jisxcommon_encmap+2648,0,255},{ -__jisxcommon_encmap+2904,0,250},{__jisxcommon_encmap+3155,1,255},{ -__jisxcommon_encmap+3410,0,255},{__jisxcommon_encmap+3666,5,255},{ -__jisxcommon_encmap+3917,0,255},{__jisxcommon_encmap+4173,0,253},{ -__jisxcommon_encmap+4427,2,255},{__jisxcommon_encmap+4681,0,253},{ -__jisxcommon_encmap+4935,0,255},{__jisxcommon_encmap+5191,1,253},{ -__jisxcommon_encmap+5444,1,254},{__jisxcommon_encmap+5698,0,255},{ -__jisxcommon_encmap+5954,1,255},{__jisxcommon_encmap+6209,7,253},{ -__jisxcommon_encmap+6456,0,255},{__jisxcommon_encmap+6712,0,255},{ -__jisxcommon_encmap+6968,1,250},{__jisxcommon_encmap+7218,6,255},{ -__jisxcommon_encmap+7468,0,255},{__jisxcommon_encmap+7724,0,255},{ -__jisxcommon_encmap+7980,0,255},{__jisxcommon_encmap+8236,2,253},{ -__jisxcommon_encmap+8488,0,255},{__jisxcommon_encmap+8744,0,253},{ -__jisxcommon_encmap+8998,2,255},{__jisxcommon_encmap+9252,2,244},{ -__jisxcommon_encmap+9495,4,252},{__jisxcommon_encmap+9744,0,255},{ -__jisxcommon_encmap+10000,1,254},{__jisxcommon_encmap+10254,0,253},{ -__jisxcommon_encmap+10508,3,255},{__jisxcommon_encmap+10761,0,254},{ -__jisxcommon_encmap+11016,2,255},{__jisxcommon_encmap+11270,0,255},{ -__jisxcommon_encmap+11526,3,255},{__jisxcommon_encmap+11779,0,254},{ -__jisxcommon_encmap+12034,0,252},{__jisxcommon_encmap+12287,2,255},{ -__jisxcommon_encmap+12541,0,252},{__jisxcommon_encmap+12794,0,255},{ -__jisxcommon_encmap+13050,2,254},{__jisxcommon_encmap+13303,0,254},{ -__jisxcommon_encmap+13558,0,251},{__jisxcommon_encmap+13810,0,158},{ -__jisxcommon_encmap+13969,54,255},{__jisxcommon_encmap+14171,0,254},{ -__jisxcommon_encmap+14426,2,255},{__jisxcommon_encmap+14680,0,254},{ -__jisxcommon_encmap+14935,0,253},{__jisxcommon_encmap+15189,1,255},{ -__jisxcommon_encmap+15444,0,255},{__jisxcommon_encmap+15700,0,254},{ -__jisxcommon_encmap+15955,0,255},{__jisxcommon_encmap+16211,1,254},{ -__jisxcommon_encmap+16465,1,255},{__jisxcommon_encmap+16720,0,255},{ -__jisxcommon_encmap+16976,0,159},{__jisxcommon_encmap+17136,55,255},{ -__jisxcommon_encmap+17337,1,255},{__jisxcommon_encmap+17592,1,254},{ -__jisxcommon_encmap+17846,0,254},{__jisxcommon_encmap+18101,0,255},{ -__jisxcommon_encmap+18357,0,255},{__jisxcommon_encmap+18613,0,255},{ -__jisxcommon_encmap+18869,0,253},{__jisxcommon_encmap+19123,1,132},{ -__jisxcommon_encmap+19255,119,230},{__jisxcommon_encmap+19367,28,251},{ -__jisxcommon_encmap+19591,0,255},{__jisxcommon_encmap+19847,1,254},{ -__jisxcommon_encmap+20101,2,255},{__jisxcommon_encmap+20355,1,255},{ -__jisxcommon_encmap+20610,0,255},{__jisxcommon_encmap+20866,0,249},{ -__jisxcommon_encmap+21116,2,254},{__jisxcommon_encmap+21369,2,255},{ -__jisxcommon_encmap+21623,2,165},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0, -0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{__jisxcommon_encmap+21787,1,229}, -}; - -static const ucs2_t __cp932ext_decmap[969] = { -65340,65374,8741,65372,8230,8229,8216,8217,8220,8221,65288,65289,12308,12309, -65339,65341,65371,65373,12296,12297,12298,12299,12300,12301,12302,12303,12304, -12305,65291,65293,177,215,U,247,65309,8800,65308,65310,8806,8807,8734,8756, -9794,9792,176,8242,8243,8451,65509,65284,65504,65505,65285,65283,65286,65290, -65312,167,9734,9733,9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660, -8251,12306,8594,8592,8593,8595,12307,U,U,U,U,U,U,U,U,U,U,U,8712,8715,8838, -8839,8834,8835,8746,8745,U,U,U,U,U,U,U,U,8743,8744,65506,9312,9313,9314,9315, -9316,9317,9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330, -9331,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,U,13129,13076,13090, -13133,13080,13095,13059,13110,13137,13143,13069,13094,13091,13099,13130,13115, -13212,13213,13214,13198,13199,13252,13217,U,U,U,U,U,U,U,U,13179,U,12317,12319, -8470,13261,8481,12964,12965,12966,12967,12968,12849,12850,12857,13182,13181, -13180,8786,8801,8747,8750,8721,8730,8869,8736,8735,8895,8757,8745,8746,32394, -35100,37704,37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193, -20220,20224,20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479, -20510,20550,20592,20546,20628,20724,20696,20810,20836,20893,20926,20972,21013, -21148,21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660, -21642,21673,21759,21894,22361,22373,22444,22472,22471,64015,U,64016,22686, -22706,22795,22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532, -23582,23718,23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353, -24372,24423,24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887, -24880,24984,25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121, -26158,26142,26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362, -26382,63785,26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032, -27106,27184,27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759, -27866,27908,28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199, -28220,28351,28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020, -28998,28999,64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654, -29667,29650,29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063, -30338,30364,30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024, -64024,64025,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072, -32092,32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782, -33864,33972,34131,34137,U,34155,64031,34224,64032,64033,34823,35061,35346, -35383,35449,35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214, -64035,36559,64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357, -37358,37348,37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433, -37479,37543,37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669, -37665,37627,64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880, -37937,37957,37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735, -38737,38741,38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797, -39794,39823,39857,39867,39936,40304,40299,64045,40473,40657,U,U,8560,8561, -8562,8563,8564,8565,8566,8567,8568,8569,65506,65508,65287,65282,8560,8561, -8562,8563,8564,8565,8566,8567,8568,8569,8544,8545,8546,8547,8548,8549,8550, -8551,8552,8553,65506,65508,65287,65282,12849,8470,8481,8757,32394,35100,37704, -37512,34012,20425,28859,26161,26824,37625,26363,24389,20008,20193,20220,20224, -20227,20281,20310,20370,20362,20378,20372,20429,20544,20514,20479,20510,20550, -20592,20546,20628,20724,20696,20810,U,20836,20893,20926,20972,21013,21148, -21158,21184,21211,21248,21255,21284,21362,21395,21426,21469,64014,21660,21642, -21673,21759,21894,22361,22373,22444,22472,22471,64015,64016,22686,22706,22795, -22867,22875,22877,22883,22948,22970,23382,23488,29999,23512,23532,23582,23718, -23738,23797,23847,23891,64017,23874,23917,23992,23993,24016,24353,24372,24423, -24503,24542,24669,24709,24714,24798,24789,24864,24818,24849,24887,24880,24984, -25107,25254,25589,25696,25757,25806,25934,26112,26133,26171,26121,26158,26142, -26148,26213,26199,26201,64018,26227,26265,26272,26290,26303,26362,26382,63785, -26470,26555,26706,26560,26625,26692,26831,64019,26984,64020,27032,27106,27184, -27243,27206,27251,27262,27362,27364,27606,27711,27740,27782,27759,27866,27908, -28039,28015,28054,28076,28111,28152,28146,28156,28217,28252,28199,28220,28351, -28552,28597,28661,28677,28679,28712,28805,28843,28943,28932,29020,28998,28999, -64021,29121,29182,29361,29374,29476,64022,29559,29629,29641,29654,29667,29650, -29703,29685,29734,29738,29737,29742,29794,29833,29855,29953,30063,30338,30364, -30366,30363,30374,64023,30534,21167,30753,30798,30820,30842,31024,64024,64025, -U,64026,31124,64027,31131,31441,31463,64028,31467,31646,64029,32072,32092, -32183,32160,32214,32338,32583,32673,64030,33537,33634,33663,33735,33782,33864, -33972,34131,34137,34155,64031,34224,64032,64033,34823,35061,35346,35383,35449, -35495,35518,35551,64034,35574,35667,35711,36080,36084,36114,36214,64035,36559, -64036,64037,36967,37086,64038,37141,37159,37338,37335,37342,37357,37358,37348, -37349,37382,37392,37386,37434,37440,37436,37454,37465,37457,37433,37479,37543, -37495,37496,37607,37591,37593,37584,64039,37589,37600,37587,37669,37665,37627, -64040,37662,37631,37661,37634,37744,37719,37796,37830,37854,37880,37937,37957, -37960,38290,63964,64041,38557,38575,38707,38715,38723,38733,38735,38737,38741, -38999,39013,64042,64043,39207,64044,39326,39502,39641,39644,39797,39794,39823, -39857,39867,39936,40304,40299,64045,40473,40657, -}; - -static const struct dbcs_index cp932ext_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{__cp932ext_decmap+0,95,202},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{__cp932ext_decmap+108,64,156},{0,0,0},{0,0,0},{0,0,0},{0,0, -0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{__cp932ext_decmap+201,64,252},{__cp932ext_decmap+390,64,252},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__cp932ext_decmap+579,64,252},{__cp932ext_decmap+768,64,252},{ -__cp932ext_decmap+957,64,75},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __cp932ext_encmap[9686] = { -34690,N,N,N,N,N,N,N,N,N,N,34692,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -34644,34645,34646,34647,34648,34649,34650,34651,34652,34653,N,N,N,N,N,N,61167, -61168,61169,61170,61171,61172,61173,61174,61175,61176,34708,N,N,N,N,N,N,N,N,N, -N,N,N,N,34712,N,N,N,N,N,33121,N,N,N,N,N,N,N,N,34707,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,34713,34624,34625,34626,34627,34628,34629,34630, -34631,34632,34633,34634,34635,34636,34637,34638,34639,34640,34641,34642,34643, -34688,N,34689,34698,34699,N,N,N,N,N,N,34700,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,34693,34694,34695,34696,34697,34661,N,N,N,N,N,N,N,N,N, -34665,N,N,N,N,N,N,34656,N,N,N,34659,N,N,N,N,N,N,N,N,N,34657,34667,N,N,34666, -34660,N,N,N,34668,N,N,N,N,N,N,N,N,N,N,34662,N,N,N,N,34670,N,N,N,N,N,N,N,N,N,N, -N,N,N,34655,34669,N,N,34658,N,N,N,34663,N,N,N,N,N,34664,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,34686,34703,34702,34701,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,34674,34675,N,N,N,N,N,N,N,N,N,N,N,N,34671,34672,34673, -N,N,34677,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -34676,N,N,N,N,N,N,N,N,34691,60748,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,60749,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60750, -60751,N,N,60752,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60753,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,60754,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60756,N,N,N,N,N,N,N, -60755,N,60758,N,N,N,N,N,60757,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60741,N,N,N,60759,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,60762,60763,N,N,N,60761,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,60760,N,60766,N,N,N,60764,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60765,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60767,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,60769,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,60768,60770,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60771,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,60772,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,60773,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60774,60775,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,60776,N,N,N,N,N,N,N,N,N,60777,N,N,N,N,N,N,N,N,61019,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,60778,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60779, -60780,N,N,N,N,N,N,60781,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,60782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,60783,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -60784,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60785,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -60786,60789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60788,N,N,N,N,N,N,N,N,N,N,N,N, -60790,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,60791,60792,60793,N,N,N,N,N,N,N,N,N,N,N,60794,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60795,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60797,60796,60801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,60802,60803,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,60804,N,N,N,N,N,N,N,60805,N,60806,N,N,N,N,N,60807,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,60808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -60809,60810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60811,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60813,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,60814,60815,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60816,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,60817,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60818,60819,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60822,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,60820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60823,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60824,60825,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60826,60827,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,60828,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60747,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60829,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60830,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60831,60832,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60833,N,N, -N,N,60834,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,60836,N,N,N,N,N,N,N,N,60835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60838, -60839,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60837,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60841,N, -N,N,N,N,N,60840,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60842,60843,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60844,60845,60846,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,60847,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60848,60849,60850,N,N,N,N,N, -N,N,N,60853,N,N,N,N,N,N,N,N,N,N,N,60851,N,N,N,N,N,N,N,N,60855,N,N,N,N,N,60856, -N,N,N,N,N,N,N,N,N,60854,N,N,60743,N,N,N,N,N,N,N,N,N,60852,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60858,N,60859,N,N,N,N,N,N,N,N,N,N,N,60857,N, -N,N,N,N,N,N,N,N,N,N,N,N,60861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,60862,N,N,N,N,N,N,60863,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,60864,N,N,N,N,N,N,N,N,N,N,N,N,60865,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,60866,60746,60867,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60869,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60870,N,N,N,N,60872, -60873,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60874,N,N,N,N,N,N, -N,N,N,N,N,N,N,60871,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,60744,N,N,N,N,N,N,60875,60877,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60879,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60880,60881,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60883,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60882,N,N,N,N,N,N,N,60884,N,N,N,N,N,N,N, -N,N,N,60885,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60886,N,60887,60888, -60889,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60890,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,60892,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -60891,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,60893,60894,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,60896,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60895,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,60897,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60898,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60899,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60901,N,N,N,N,N,60900,N, -N,N,60902,60905,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60903,N,N,60906,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60904,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,60907,60908,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60909,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,60910,60911,N,60912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,60913,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60914,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60915,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,60742,60917,N,N,N,N,N,N,N,N,N,N,60916,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,60919,60920,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60918,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60922,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -60923,60924,N,N,N,N,N,N,N,N,N,N,N,N,60992,60993,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60995,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60996,N,N,N,N,N,N,N,N,N,N,N,60997, -N,N,N,N,N,N,N,N,61000,N,N,N,60998,N,N,N,N,N,N,N,N,N,N,N,N,60999,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,61002,61001,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,61003,N,N,61005,61004,N,N,N,61006,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61007, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61008,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61009,61010,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60812, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61011,61012,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61015,61013,N,61014,N,N,N,N,N,N,N,61016,61018, -61020,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,61021,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61022,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61023,61024,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,61028,N,N,N,N,N,N,61030,61031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,61032,N,N,N,61034,61035,61037,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61038, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61040,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,61039,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,61041,61042,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60736,61043,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,61044,61046,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61047,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61048,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61049,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61050,61051,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61052,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60740,61053,N,N,N,N, -N,61054,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61056,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,61058,61061,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61062,60737,61063,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61064,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61065,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61066,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,61067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,61068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61070, -61071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,61072,61073,N,N,N,61074,61075,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,61076,61078,61081,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,61082,61084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61085,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61087,N,N,61086,N,N,N,61088,N,N,N, -N,N,61091,61092,N,N,N,N,N,N,N,61089,61090,61093,N,N,N,61095,N,N,N,N,N,61094,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61102,61096,N,61098,N,N,N,61097,N,N,N,N,N,N,N,N,N,N,N,N,N,61099,N,N,61101,N,N, -N,N,N,N,N,61100,N,N,N,N,N,N,N,N,N,N,N,N,N,61103,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61105,61106,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60739,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61104,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61110,N,N,61114,N,61112,N,61108,N,61109, -N,N,N,N,N,N,61113,N,N,N,N,N,N,61107,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60745,N, -61117,N,N,N,61120,61122,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61121,61119,N,N,61116,N,N,N,61115,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,60738,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61124,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61123,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61125,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61126,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61127,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,61128,61129,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61130,N,N,61131, -61132,61135,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61136,61137,N,N,N,N,N,N,N,61138, -N,N,N,N,N,N,N,61139,N,N,N,N,N,N,N,N,N,61140,N,61141,N,61142,N,N,N,61143,61144, -N,N,N,N,N,N,N,N,N,N,N,N,N,61145,61148,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61150,61151,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,61152,N,N,61153,61155,N,N,61154,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,61156,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,61157,N,N,N,N,N,N,N,N,N,61158,61159,61161,N,N,N,N,61160,61163,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61164,60868,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61133,60787,60798,60800,60821,60860,60876,60878, -60921,60994,61017,61025,61026,61027,61029,61033,61036,61045,61057,61059,61060, -61069,61077,61079,61080,61083,61111,61118,61134,61146,61147,61149,61162,61180, -N,N,N,N,61179,N,N,N,N,N,33148,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,33119,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,33120,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,33169, -33170,33226,N,61178, -}; - -static const struct unim_index cp932ext_encmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp932ext_encmap+0,22,121},{__cp932ext_encmap -+100,17,191},{0,0,0},{__cp932ext_encmap+275,96,115},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__cp932ext_encmap+295,29,31},{0,0,0},{__cp932ext_encmap+298,49,168},{ -__cp932ext_encmap+418,3,205},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{__cp932ext_encmap+621,40,252},{__cp932ext_encmap+834,0,255},{ -__cp932ext_encmap+1090,30,244},{__cp932ext_encmap+1305,74,236},{ -__cp932ext_encmap+1468,21,219},{__cp932ext_encmap+1667,0,221},{ -__cp932ext_encmap+1889,138,255},{__cp932ext_encmap+2007,134,134},{0,0,0},{ -__cp932ext_encmap+2008,89,200},{__cp932ext_encmap+2120,158,178},{ -__cp932ext_encmap+2141,11,186},{0,0,0},{__cp932ext_encmap+2317,86,236},{ -__cp932ext_encmap+2468,30,245},{__cp932ext_encmap+2684,39,208},{0,0,0},{ -__cp932ext_encmap+2854,33,222},{__cp932ext_encmap+3044,93,242},{ -__cp932ext_encmap+3194,17,152},{__cp932ext_encmap+3330,19,166},{ -__cp932ext_encmap+3478,245,245},{__cp932ext_encmap+3479,96,206},{ -__cp932ext_encmap+3590,78,78},{__cp932ext_encmap+3591,0,251},{ -__cp932ext_encmap+3843,14,192},{__cp932ext_encmap+4022,1,207},{ -__cp932ext_encmap+4229,104,226},{__cp932ext_encmap+4352,48,228},{ -__cp932ext_encmap+4533,214,214},{__cp932ext_encmap+4534,63,218},{ -__cp932ext_encmap+4690,4,252},{__cp932ext_encmap+4939,39,191},{ -__cp932ext_encmap+5092,136,245},{__cp932ext_encmap+5202,5,187},{ -__cp932ext_encmap+5385,4,254},{__cp932ext_encmap+5636,177,190},{ -__cp932ext_encmap+5650,36,245},{__cp932ext_encmap+5860,7,159},{ -__cp932ext_encmap+6013,1,111},{__cp932ext_encmap+6124,130,166},{ -__cp932ext_encmap+6161,70,70},{__cp932ext_encmap+6162,33,122},{ -__cp932ext_encmap+6252,48,155},{__cp932ext_encmap+6360,209,235},{ -__cp932ext_encmap+6387,158,158},{0,0,0},{__cp932ext_encmap+6388,72,214},{ -__cp932ext_encmap+6531,82,138},{__cp932ext_encmap+6588,71,161},{0,0,0},{0,0,0 -},{0,0,0},{__cp932ext_encmap+6679,1,246},{__cp932ext_encmap+6925,72,220},{ -__cp932ext_encmap+7074,83,176},{0,0,0},{0,0,0},{__cp932ext_encmap+7168,7,245}, -{__cp932ext_encmap+7407,28,28},{__cp932ext_encmap+7408,18,246},{ -__cp932ext_encmap+7637,83,127},{__cp932ext_encmap+7682,240,244},{ -__cp932ext_encmap+7687,18,118},{__cp932ext_encmap+7788,207,207},{0,0,0},{ -__cp932ext_encmap+7789,103,222},{__cp932ext_encmap+7909,21,238},{ -__cp932ext_encmap+8127,6,255},{__cp932ext_encmap+8377,2,248},{ -__cp932ext_encmap+8624,49,72},{__cp932ext_encmap+8648,146,146},{ -__cp932ext_encmap+8649,157,175},{__cp932ext_encmap+8668,51,85},{ -__cp932ext_encmap+8703,87,101},{__cp932ext_encmap+8718,39,158},{ -__cp932ext_encmap+8838,78,220},{__cp932ext_encmap+8981,114,187},{ -__cp932ext_encmap+9055,0,0},{__cp932ext_encmap+9056,107,112},{ -__cp932ext_encmap+9062,25,209},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp932ext_encmap+9247 -,41,220},{__cp932ext_encmap+9427,14,45},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__cp932ext_encmap+9459,2,228}, -}; - -static const ucs2_t __jisx0213_1_bmp_decmap[2197] = { -65287,65282,65293,126,12339,12340,12341,12347,12348,12543,12447,U,U,U,U,U,U,U, -U,8836,8837,8842,8843,8713,8709,8965,8966,U,U,U,U,U,U,U,8853,8854,8855,8741, -8742,10629,10630,12312,12313,12310,12311,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,8802, -8771,8773,8776,8822,8823,8596,U,U,U,U,U,U,U,U,9838,9835,9836,9833,9655,9654, -9665,9664,8599,8600,8598,8601,8644,8680,8678,8679,8681,10548,10549,U,U,U,U,U, -U,U,U,U,U,10687,9673,12349,65094,65093,9702,8226,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,8723,8501,8463,13259,8467,8487,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12448,8211,10746,10747,12363,U,12365,U,12367,U, -12369,U,12371,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12436,12437, -12438,12459,U,12461,U,12463,U,12465,U,12467,U,U,U,U,U,U,U,12475,U,U,U,U,U,U,U, -U,12484,U,U,U,12488,9828,9824,9826,9830,9825,9829,9831,9827,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,962,9461,9462,9463,9464,9465,9466,9467,9468, -9469,9470,9750,9751,12320,9742,9728,9729,9730,9731,9832,9649,12784,12785, -12786,12787,12788,12789,12790,12791,12792,12793,U,12794,12795,12796,12797, -12798,12799,9150,9151,9152,9153,9154,9155,9156,9157,9158,9159,9160,9161,9162, -9163,9164,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -12535,12536,12537,12538,8922,8923,8531,8532,8533,10003,8984,9251,9166,12881, -12882,12883,12884,12885,12886,12887,12888,12889,12890,12891,12892,12893,12894, -12895,12977,12978,12979,12980,12981,12982,12983,12984,12985,12986,12987,12988, -12989,12990,12991,U,U,U,U,U,U,U,U,9680,9681,9682,9683,8252,8263,8264,8265,461, -462,464,7742,7743,504,505,465,466,468,470,472,474,476,8364,160,161,164,166, -169,170,171,173,174,175,178,179,183,184,185,186,187,188,189,190,191,192,193, -194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212, -213,214,216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232, -233,234,235,236,237,238,239,240,241,242,243,244,245,246,248,249,250,251,252, -253,254,255,256,298,362,274,332,257,299,363,275,333,260,728,321,317,346,352, -350,356,377,381,379,261,731,322,318,347,711,353,351,357,378,733,382,380,340, -258,313,262,268,280,282,270,323,327,336,344,366,368,354,341,259,314,263,269, -281,283,271,273,324,328,337,345,367,369,355,729,264,284,292,308,348,364,265, -285,293,309,349,365,625,651,638,643,658,620,622,633,648,598,627,637,642,656, -635,621,607,626,669,654,609,331,624,641,295,661,660,614,664,450,595,599,644, -608,403,339,338,616,649,600,629,601,604,606,592,623,650,612,652,596,593,594, -653,613,674,673,597,657,634,615,602,U,509,8048,8049,U,U,U,U,U,U,U,U,8050,8051, -865,712,716,720,721,774,8255,779,769,772,768,783,780,770,741,742,743,744,745, -U,U,805,812,825,796,799,800,776,829,809,815,734,804,816,828,820,797,798,792, -793,810,826,827,771,794,10102,10103,10104,10105,10106,10107,10108,10109,10110, -10111,9451,9452,9453,9454,9455,9456,9457,9458,9459,9460,8560,8561,8562,8563, -8564,8565,8566,8567,8568,8569,8570,8571,9424,9425,9426,9427,9428,9429,9430, -9431,9432,9433,9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445, -9446,9447,9448,9449,13008,13009,13010,13011,13012,13013,13014,13015,13016, -13017,13018,13019,13020,13021,13022,13023,13024,13025,13026,13027,13050,13033, -13029,13037,13036,U,U,U,U,U,U,U,U,U,8273,8258,9312,9313,9314,9315,9316,9317, -9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,8544, -8545,8546,8547,8548,8549,8550,8551,8552,8553,8554,13129,13076,13090,13133, -13080,13095,13059,13110,13137,13143,13069,13094,13091,13099,13130,13115,13212, -13213,13214,13198,13199,13252,13217,8555,U,U,U,U,U,U,U,13179,12317,12319,8470, -13261,8481,12964,12965,12966,12967,12968,12849,12850,12857,13182,13181,13180, -U,U,U,8750,U,U,U,U,8735,8895,U,U,U,10070,9758,20465,U,13314,20008,20015,20016, -20109,20193,20221,20223,20227,20235,20320,20296,20297,20310,20319,20330,20332, -20350,20362,20372,20375,64048,20425,20448,20481,20482,20494,20504,20519,20526, -20544,20539,20545,20628,20684,20722,20688,20710,64049,20742,20739,20747,20766, -20789,20810,64050,20821,20823,13493,20893,20931,20938,20958,20962,20974,20993, -13531,21011,21013,21065,21079,21089,21139,21192,64051,21196,21200,21206,21211, -64052,21232,21243,21248,21255,21276,64053,21345,21347,21373,21395,21405,21426, -21522,21543,21581,21660,21611,21620,21631,21640,21654,21665,21673,21702,21759, -21774,21803,21813,21840,21854,21889,21894,21902,64054,21933,21966,64055,22024, -22030,22075,22089,22134,22118,64056,22127,22129,22130,22169,22174,22185,22188, -22195,22217,22218,22282,U,22305,22319,22323,22324,22384,22391,22396,22428, -64015,U,22456,22471,22472,22479,22500,22509,22517,22518,22527,22537,64016, -22625,22628,64057,22652,22665,22686,64058,22697,U,22738,22734,22740,22746, -22752,22761,22796,34369,22877,22893,22923,22930,22948,22979,22994,23005,23059, -23075,23143,23149,23159,23166,23172,23198,23207,23236,U,23321,23333,21085, -23361,23382,23421,23443,23512,23532,23570,23582,23587,23595,14221,23650,64059, -64060,U,23674,23695,23711,23715,23722,23738,23755,23760,23762,23796,U,14306, -23821,23847,64017,23878,23879,23891,23882,23917,23937,23968,23972,23975,23992, -24011,21534,22099,24034,24084,24088,24152,24158,24254,63784,24267,24313,24320, -24322,24327,24349,24355,24372,24374,24381,24384,24389,24404,24408,24420,24423, -24445,24457,24476,24487,24495,24501,24503,24521,24542,24545,24553,24589,24596, -24600,24627,24629,24647,64061,24733,24734,24779,24788,24789,24797,24824,24860, -24875,24880,24887,64062,24973,64063,25020,25017,64064,25122,25150,25155,25174, -25178,25199,25221,25284,25302,25340,25354,25368,25401,25411,25445,25468,25573, -25581,25589,25616,25620,25634,25721,25681,25696,25709,25806,25790,25791,25796, -25802,25808,25847,25851,25890,25897,64065,25959,26013,64066,26112,26121,26133, -26142,26170,26146,26148,26155,26160,26161,26163,26363,26184,26188,U,26201, -26202,26209,26213,26227,26231,26232,26253,64067,26272,26290,26299,26310,26312, -15138,26331,26344,26362,26387,63785,26419,26470,26439,26440,26491,26497,26515, -26520,26523,26555,26617,26560,26583,26620,26625,26706,26653,26668,26673,26715, -26738,26741,64068,26787,26789,26802,26824,26832,26856,26861,26864,26865,26876, -26890,26953,U,26933,26946,26967,26979,26980,26984,27008,64020,27045,27053, -27087,15286,15299,27106,27113,27114,27125,27126,27151,27157,U,27195,27198, -27205,27216,27222,27227,27243,27251,U,27273,27284,27293,27294,27301,27364, -27367,15375,63773,27419,27422,27436,27445,27462,27478,27488,27493,27495,27511, -27522,27561,27565,63856,27599,27606,27607,27647,27653,27664,27699,27737,27740, -27818,27764,27766,27781,27782,27800,27804,27899,27846,27860,27872,27883,27886, -U,27908,27918,27950,27953,27961,27967,27992,28005,64069,28034,28039,28041, -28052,28074,28076,28095,28100,28118,28122,28123,28125,28156,64070,28212,28228, -28252,28254,28331,28337,28353,28359,28366,28432,28442,64071,28458,28463,28467, -28497,28505,28510,28513,28514,28542,28552,28556,28557,28564,28576,28583,28598, -28604,28615,28618,28665,28656,28661,28677,28678,28712,28746,28765,28766,28750, -28772,28789,28805,28836,28843,28855,28884,28888,28900,28943,28971,28958,28960, -28974,28976,28998,28999,29009,64072,29010,29020,29024,29032,64021,29061,29063, -29074,29121,29114,29124,29182,29184,29205,29269,29270,15935,29325,29339,29374, -29376,29435,U,29479,29480,64022,29520,29542,29564,29589,29599,29600,29602, -29606,29611,29641,29647,29654,29657,29667,29673,29703,29706,29722,29723,64074, -29734,29736,29738,29739,29740,29742,29743,29744,29764,29766,29767,29771,29783, -29794,29803,29805,29830,29831,29833,29848,29852,29855,29859,29840,29862,29864, -29865,29877,29887,29896,29897,29914,29951,29953,29975,29999,30063,30073,30098, -16242,30158,30180,30208,30210,30216,30229,30230,30233,30238,30253,30261,30275, -30283,30308,30309,30317,30319,30321,30337,30363,30365,30366,30374,30378,30390, -30405,30412,30414,30420,30438,30449,30460,30474,30489,30516,30518,30534,30541, -30542,30556,30559,30562,30586,30592,30612,30634,30688,30765,30787,30798,30799, -30801,30824,30830,64075,30896,U,30893,30948,30962,30976,30967,31004,31022, -31025,31028,64076,64077,31045,31046,64078,64079,64080,31068,64081,64025,64026, -31097,64082,64083,64027,31128,31153,31160,31176,31178,U,31188,31198,31211, -31213,31235,64084,31289,31325,31341,64085,31365,31392,U,31411,31419,31438, -31467,31485,31506,31533,31547,31559,31566,31584,31597,31599,31602,31646,64086, -31703,31705,31745,31793,31774,31776,31795,31798,16996,U,31833,31853,31865, -31887,31892,31904,31932,31957,31961,31965,32007,32008,32019,32029,32035,32049, -32065,32072,32083,32092,32122,32131,32139,32160,32166,32194,32204,32214,32227, -64087,32296,32264,32273,32277,64089,32327,32338,32353,32394,32397,32583,64090, -32657,32663,32703,32718,32731,32735,32748,32750,32762,64091,32788,32806,32821, -32823,32828,32970,32983,32992,33011,33048,33098,33120,33127,33128,33133,33211, -33226,33231,33239,64092,17491,17499,33376,33396,U,33422,33441,33443,33444, -33449,33454,33463,33470,33471,33478,33493,33533,33534,33536,33537,33634,33570, -33581,33594,33603,33607,33617,33621,33661,33670,33682,33688,33703,33705,33727, -33728,33735,33743,33745,33761,33770,33793,33798,33802,64095,33864,33887,33904, -33907,33925,33950,33967,33972,33978,33984,33986,U,34098,34078,34083,34095, -34137,34148,64031,34221,34170,34188,34191,34210,34224,34251,34254,34285,34322, -34303,34308,34309,34320,U,34328,34345,34360,34391,34395,63798,34402,17821, -34412,34421,34456,34488,34554,34556,34557,34571,34673,34695,34696,34732,34733, -34741,17898,34774,34796,34822,34826,34832,34836,34847,34968,34986,35018,35022, -U,35061,35100,64096,35096,35097,35098,35111,35120,35122,35129,35136,35220, -64097,35284,35301,35318,35346,35349,35362,35383,35399,35406,35421,35425,35445, -35449,35495,35536,35551,35572,35574,64034,64098,64099,35654,35668,35673,35689, -35741,35913,35944,64100,36065,36084,36088,36094,64101,36114,36123,36271,36302, -36305,36311,36384,36387,36413,36464,36475,U,36544,18500,36602,36638,36653, -36662,36692,U,36774,36789,36836,36840,36846,36872,36909,64103,37000,37013, -37015,37017,37019,37026,37043,37054,37060,37061,37063,37079,37085,37086,37103, -37108,64038,37140,37141,37142,37154,37155,37159,37167,37169,37172,37181,37192, -37211,37251,37278,37292,37297,37308,37335,37371,37348,37349,37357,37361,37383, -37392,37432,37433,37434,37436,37440,37443,37455,37496,37512,37570,37579,37580, -37587,37600,37631,37636,37663,37665,37669,37704,37705,37706,37732,37733,37738, -37744,37787,37795,37818,37830,37854,37855,37892,37885,37939,37962,37987,37995, -38001,38002,38286,38303,38310,38313,38316,38326,38333,38347,38352,38355,18864, -38362,38366,38488,38532,63964,38557,38564,38565,38610,38622,64104,38633,38639, -38707,38715,38733,38734,38735,38746,38766,38771,38805,38830,38842,38849,38857, -38878,38875,38900,64105,38922,38942,38955,38960,64106,38994,38995,38998,38999, -39001,39002,63952,39013,39020,39098,39112,39143,39256,39326,39426,39427,39460, -39469,39470,39480,39498,39502,39506,39606,39617,39619,39630,39638,39673,39682, -39688,39712,19479,39725,39774,39801,39782,39794,39797,39812,39818,39823,39838, -39847,39873,39886,39909,39928,39933,39936,39971,40001,40015,40016,40019,40035, -40037,40055,40221,40222,40259,40263,40274,40291,40304,40316,40330,40342,40384, -40364,40380,40407,U,40423,40455,40469,40572,40606,40612,40620,40623,40628, -40629,40643,40657,40720,40761,40791,40848,40852,40855,40866,23032,23643,24183, -30246,32363, -}; - -static const struct dbcs_index jisx0213_1_bmp_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_1_bmp_decmap+0,47,125},{ -__jisx0213_1_bmp_decmap+79,33,126},{__jisx0213_1_bmp_decmap+173,43,118},{ -__jisx0213_1_bmp_decmap+249,43,72},{__jisx0213_1_bmp_decmap+279,57,126},{ -__jisx0213_1_bmp_decmap+349,66,126},{__jisx0213_1_bmp_decmap+410,65,124},{ -__jisx0213_1_bmp_decmap+470,33,126},{__jisx0213_1_bmp_decmap+564,33,126},{ -__jisx0213_1_bmp_decmap+658,33,126},{__jisx0213_1_bmp_decmap+752,33,126},{ -__jisx0213_1_bmp_decmap+846,33,126},{__jisx0213_1_bmp_decmap+940,33,126},{ -__jisx0213_1_bmp_decmap+1034,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_1_bmp_decmap+ -1128,85,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__jisx0213_1_bmp_decmap+1170,39,126},{__jisx0213_1_bmp_decmap+1258,33,126},{ -__jisx0213_1_bmp_decmap+1352,33,126},{__jisx0213_1_bmp_decmap+1446,33,126},{ -__jisx0213_1_bmp_decmap+1540,33,125},{__jisx0213_1_bmp_decmap+1633,33,126},{ -__jisx0213_1_bmp_decmap+1727,33,126},{__jisx0213_1_bmp_decmap+1821,33,126},{ -__jisx0213_1_bmp_decmap+1915,33,126},{__jisx0213_1_bmp_decmap+2009,33,126},{ -__jisx0213_1_bmp_decmap+2103,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const ucs2_t __jisx0213_2_bmp_decmap[2425] = { -19970,19983,19986,20009,20011,20014,20032,20039,20040,U,20049,13318,U,20058, -20073,20125,13356,13358,20153,20155,U,20156,20163,20168,20176,20203,20186, -20209,20213,20224,20246,20324,20279,20286,20308,20312,U,20343,20344,20346, -20349,20354,20357,20370,20378,20454,20402,20414,20421,20427,20431,20434,13418, -20466,20480,20496,20499,20508,20510,20514,13416,20546,20550,20558,20563,20567, -20579,20582,20586,20592,20643,20616,20626,20627,20629,20630,20636,20650,U, -20657,20666,20667,20676,20679,20723,U,20686,U,20692,20697,20705,20713,13458, -20744,U,20759,20763,U,20832,U,20851,20867,20875,13500,20888,20899,20909,13511, -20924,U,U,20979,20980,20994,21010,21014,U,21077,21084,21100,21111,21124,21122, -U,21144,U,21156,21158,21167,21178,21179,21194,13599,21201,U,21239,21258,21259, -21284,21301,21310,21314,U,U,21351,21356,21370,21412,21428,U,21431,21440,U, -13661,13662,21461,21466,13667,21492,21493,21589,21540,21544,13678,21571,21602, -21606,21612,21642,21645,21653,21664,21670,21677,21678,21687,21690,21695,21699, -U,21740,21743,21745,21747,21760,21761,21769,21820,21825,13734,21831,21834, -13736,21856,21857,21860,U,21885,21890,21896,21905,13765,21970,U,U,21951,21961, -21964,21969,21981,13786,21986,U,21993,22056,U,22023,22032,22064,22071,13812, -22077,22079,22080,22087,22110,22112,22125,13829,22152,22156,22165,22170,22173, -22184,22189,22194,22213,22221,22239,22248,22262,22263,U,22293,22307,U,22313,U, -22341,22342,22348,22349,U,22376,22383,22387,22388,22389,22395,U,U,22444,22426, -22429,22430,22440,22487,U,22476,U,U,22494,22502,22512,13898,22520,22523,22525, -22532,22558,22560,22567,22578,22585,U,22601,22604,22631,22666,22667,22669, -22671,22672,22676,22685,22698,22705,U,22723,22733,22754,22771,22772,22789, -22790,22795,22797,22804,22820,U,13969,22845,13977,22854,13974,U,22875,22879,U, -22901,22902,22908,22943,22958,22972,22984,22989,23006,23011,23012,23015,23022, -U,U,14031,23052,23053,23063,23079,23085,23125,23141,23162,23179,23196,23199, -23200,23202,23217,23219,23221,23226,23231,23258,23260,23264,23269,23280,23278, -23285,23296,23304,23319,23348,23341,23372,23378,23400,23407,23420,23423,23425, -23428,23446,23468,14177,23488,14178,23502,23510,14188,14187,23537,23549,14197, -23555,23593,23600,U,23647,23651,23655,23656,23657,23664,U,U,23676,U,U,23688, -23690,14273,U,U,23712,23714,23718,23719,U,23725,23733,U,23753,U,U,23814,23824, -23851,23837,23840,23844,23846,23857,23865,23874,14312,23905,23914,14324,23920, -U,14333,23944,14336,23954,23956,23959,23961,23984,23986,23988,U,23993,24017, -24023,24024,24032,U,24036,24041,14383,24064,14390,24082,24085,14400,24095, -24110,24126,24137,14428,24150,14433,24171,24172,24173,24174,U,24229,24234, -24236,24249,24255,24262,24274,24281,U,24317,24328,24334,24348,U,24350,24391, -24419,24434,24446,24463,24482,24484,24504,24516,14586,24519,24523,24530,24531, -24532,24546,24558,24559,24563,24572,14615,24599,24610,24612,14618,24652,24703, -24714,24725,24744,U,24752,24753,24766,24776,24793,24795,24814,24818,24821, -24848,24850,24851,24857,24862,24890,14703,24897,24902,24928,24956,U,24978, -24979,24983,24984,24997,25000,25005,U,25045,25053,25055,25077,U,25109,25123, -25129,25158,25164,25169,25170,25185,25188,25211,25197,25203,25241,25254,25301, -U,25341,25347,25357,25360,U,U,25394,25397,25403,25404,25409,25412,25422,U, -25433,U,U,25452,25476,25497,U,25492,25533,25591,25556,25557,25564,25568,25579, -25580,25586,25609,25630,25637,25641,25647,25690,25691,25693,25715,25725,25735, -25745,25757,25759,25803,25804,25813,25815,U,25828,25829,25855,25860,14958, -25871,25876,25878,14963,25886,25906,25924,25940,25963,25978,25985,25988,25989, -25994,26034,26037,26040,26047,26050,26057,26068,15062,26098,26105,26108,26116, -26120,26145,26154,26181,26193,26190,15082,U,26199,26203,26211,U,U,26218,26219, -26220,26221,26235,26240,26256,26258,26265,15118,26285,26289,26293,15130,26303, -15132,26348,15063,26369,26373,26386,U,26393,U,U,26444,26445,26452,26461,U,U,U, -26484,26486,U,26514,U,33635,26640,26544,26546,26563,26568,26578,26585,26587, -26608,26615,U,U,U,26648,26655,26669,U,26675,26683,26686,26692,26693,26697, -26700,26709,26711,15223,26731,26734,26746,26748,26754,26768,26774,15213,26776, -26777,26778,26780,26794,26795,26804,26811,26875,U,U,64019,26819,26821,26828, -26831,26838,26841,26852,26853,26860,26871,26883,26887,15239,15240,U,26939, -15245,26950,26985,26988,26994,27002,27007,27026,15268,27030,27032,27046,27056, -27063,27066,27068,27072,27089,27094,U,U,27184,U,U,27107,27118,27119,27123, -15309,27124,27134,27153,27162,27165,U,27186,27187,27188,27199,27206,27209, -27258,27214,27218,27236,U,27262,27267,27275,15344,27281,27295,27297,U,27307, -27325,27334,27348,27344,27356,27357,U,U,27372,27377,27378,27379,27389,U,27403, -27407,27408,27409,U,27415,15398,27439,27466,27480,27500,27509,27514,27521, -27547,27566,U,27581,27582,27591,27592,27593,27610,27622,27623,27630,27633, -27650,27658,27662,27701,27702,27706,U,27711,27725,27739,27757,27780,27785, -15555,27796,27797,27799,27821,27842,27856,15570,27862,27866,27868,27881,27884, -27885,U,27904,27914,27940,27942,27943,27751,27951,27964,27995,27998,28000, -28016,28032,28033,28042,28045,28049,28056,U,28183,U,U,U,28075,28078,28084, -28098,27956,28104,28110,28111,28112,28127,28137,28150,28214,28190,28194,28199, -15633,28210,28220,28232,28233,28235,28236,28239,28241,28243,28244,28247,28259, -15646,28307,28327,28340,28351,28355,28362,28377,28469,28395,28409,28411,28426, -28428,28440,28453,28470,28476,U,28498,28503,28506,28512,28520,28568,28541, -28560,28566,28606,28575,28581,28591,15716,28597,28616,28617,28634,28638,28649, -U,28668,28672,28679,28682,28707,U,28729,28730,28732,28739,28743,28747,15770, -28756,28773,28777,28780,28782,28790,28798,28801,28806,28821,28823,28859,U, -28831,28849,U,28908,28874,28881,28883,28892,28931,28932,28934,28935,28936, -28940,15808,28975,28977,29008,29002,29011,29022,15828,29078,29056,29083,29088, -29090,29102,29103,29107,U,29131,29139,29145,29148,29191,15877,64073,29227, -29236,29240,29241,20012,29250,29267,29271,29283,U,29294,29295,29304,29311, -29326,U,29357,29358,29360,29361,29377,15968,29388,15974,15976,29427,29434, -29447,29458,29464,29465,16003,29497,29484,29489,29491,29501,29522,16020,29547, -29548,U,29550,29551,29553,29559,29569,29573,29578,29588,29592,29596,29598, -29605,29608,29621,29623,29625,29628,29631,29637,29643,29665,29671,29689,29715, -29690,29697,29732,29745,29753,29779,29760,29763,29773,29778,29789,29809,29825, -29829,29832,U,29842,29847,29849,29856,29857,29861,29866,29867,29881,29883, -29882,29910,29912,29918,29935,29931,U,29946,U,29984,29988,29994,16215,U,30013, -30014,30016,30024,30030,30032,30034,30060,30066,30065,30074,30077,30078,30081, -U,30092,16245,30114,16247,30128,30135,30143,30144,30150,30159,30163,30173, -30175,30176,30183,30188,30190,30193,30201,30211,30232,30215,30223,16302,U, -30227,30235,30236,U,30245,30248,30268,30259,U,16329,30273,U,30281,30293,16343, -30318,30357,30364,30369,30368,30375,30376,30383,U,30409,U,30440,30444,U,30487, -30490,30509,30517,16441,U,U,30552,30560,30570,U,30578,30588,30589,U,16472, -30618,30623,30626,30628,30633,30686,30687,30692,30694,30698,30700,16531,30704, -30708,30715,U,30725,30726,30729,30733,30745,30753,30764,30791,30820,30826,U, -30858,30868,30884,30877,30878,30879,30907,30920,30924,30926,30933,30944,30945, -30950,30969,30970,30971,30974,U,30992,31003,31024,31013,31035,31050,31064, -31067,16645,31079,31090,31124,31125,31126,31131,31137,31145,31156,31163,31170, -31175,31180,31181,31190,16712,U,U,16719,31242,31249,31253,31259,31262,16739, -31277,31288,31303,31308,31318,31321,31324,31327,31328,31335,31338,31349,31352, -31362,31370,31376,31395,31404,U,16820,31417,31420,31422,16831,31436,31441, -31463,31464,31476,U,U,31495,U,31549,31527,31530,31534,31535,31537,16870,16883, -31615,31553,16878,31573,31609,31588,31590,31593,31603,U,16903,31632,31633, -31643,16910,31663,31669,31676,31685,31690,U,U,31700,31702,31706,31722,31728, -31747,31755,31758,31759,31782,31813,31818,31825,31831,31838,31841,31849,31854, -31855,31856,U,U,U,31910,U,31926,31927,31935,U,31940,U,31944,31949,U,31959,U, -31974,31979,U,31989,32003,32009,17094,32018,32030,U,U,32061,32062,32064,32071, -U,U,17110,32089,32090,32106,32112,17117,32127,U,32134,32136,32140,32151,U, -32157,32167,32170,32182,32183,32192,32215,32217,32230,32241,32249,17154,U, -64088,32272,32279,32285,32288,32295,32300,32325,32371,32373,32382,32390,32391, -17195,32401,32408,32410,17219,32572,32571,32574,32579,32580,32591,13505,U, -32594,U,32609,32611,32612,32621,32637,32638,U,32656,20859,U,32662,32668,32685, -U,32707,32719,32739,32741,32751,32754,32770,32778,32776,32782,32785,32790, -32804,32812,32816,32835,32870,32881,32885,32891,32921,32924,32932,32935,32952, -U,32965,32981,32984,32998,U,33037,33013,33019,17390,33077,33046,33054,17392, -33060,33063,33068,U,33085,17416,33129,17431,33153,17436,33156,33157,17442, -33176,33202,33217,33219,33238,33243,U,33252,U,33260,U,33277,33279,U,33284,U, -33305,33313,33314,U,33330,33332,33340,33350,33353,33349,U,33355,17526,33359, -17530,33367,U,33372,33379,U,64093,64094,33401,17553,33405,33407,33411,33418, -33427,33447,33448,33458,33460,33466,33468,33506,33512,33527,33543,33544,33548, -33620,33563,33565,33584,33596,33604,33623,17598,33663,17620,17587,33677,33684, -33685,33691,33693,33737,33744,33748,33757,33765,33785,33807,33809,33813,U, -33815,33849,33866,33871,33873,33874,33881,33882,33884,U,33893,33910,33912, -33916,33921,17677,34012,33943,33958,33982,17672,33998,33999,34003,U,34023, -34026,34031,34032,34033,34042,34045,34060,34075,34084,34085,34091,34100,34127, -34159,17701,17731,34110,34129,34131,34142,34145,34146,U,34171,34173,34175, -34177,34182,34195,34205,34207,34231,34236,34247,34250,34264,34265,34271,34273, -34278,34294,34304,34321,34334,34337,34340,34343,U,34361,34364,U,34368,64032, -34387,34390,34415,34423,34426,34439,34441,34445,34449,34460,34461,34472,64033, -34481,34483,34497,34499,34513,34517,34519,34531,34534,17848,34565,34567,34574, -34576,34579,34585,34591,34593,34595,34609,34618,34622,34624,34627,34641,34648, -34660,34661,34674,34684,U,U,34727,34697,34699,34707,34720,U,17893,34750,U, -34753,34766,34805,34783,U,34787,34789,34790,34794,34795,34797,34817,34819, -34827,34835,34856,34862,34866,34876,17935,34890,34904,34911,34916,U,U,34921,U, -34927,34976,35004,35005,35006,35008,35026,U,35025,35027,35035,35056,35057, -17985,35073,U,35127,U,35138,35141,35145,U,18021,35170,35200,35209,35216,35231, -35248,35255,35286,35288,35307,18081,35313,35315,35325,35327,18095,35345,35348, -U,35361,35381,35390,35397,35405,35416,35502,35472,35511,35518,35543,35580,U, -35594,35589,35597,35612,35615,35629,35651,18188,35665,35678,35702,35711,35713, -35723,35732,35733,35740,35742,35897,U,35901,U,U,35909,35911,35919,35924,35927, -35945,35949,35955,U,35987,35986,35993,18276,35995,36004,36054,36053,36057,U, -36080,36081,U,36105,36110,36204,36228,36245,36262,U,36294,36296,36313,36332, -36364,18429,36349,36358,U,36372,36374,36385,36386,36391,U,18454,36406,36409, -36427,36436,36450,36460,36461,36463,36504,36510,36526,36531,36533,36534,36539, -U,36561,36564,18510,36601,U,36608,36616,36631,36651,36672,36682,36696,U,36772, -36788,64102,36790,U,36801,36806,64036,36810,36813,36819,36821,36832,36849, -36853,36859,36866,36876,36919,U,36931,36932,36957,36997,37004,37008,38429, -37025,18613,37040,37046,37059,37064,U,37084,37087,U,37110,37106,37120,37099, -37118,37119,37124,37126,37144,37148,37150,37175,37177,37178,37190,37191,37207, -37209,37217,37220,37236,37241,37253,37262,37288,37294,37299,37302,37315,37316, -37338,U,U,37356,37358,37377,37386,37398,37399,U,37427,37442,37447,37450,37454, -37457,37462,37465,37472,37473,37477,37479,37480,U,U,37500,37501,37503,37513, -37517,37527,37529,37535,37543,37547,U,U,37554,37567,37568,37574,37582,37584, -37591,37593,37605,37607,37649,37623,37625,37627,37634,37645,37653,37661,37662, -37671,37673,U,U,37703,37713,37719,37722,37739,37745,37747,37793,U,U,37768, -37771,37775,37790,37877,U,U,37873,37825,37831,37852,37858,37863,37897,37903, -37910,37911,37883,37938,37940,37947,37957,U,U,37997,37999,38264,38265,38278, -38284,38285,U,38315,38324,U,38344,U,U,38444,38451,38452,U,38460,38465,38497,U, -38530,U,38554,U,18919,38569,38575,38579,38586,38589,18938,U,38616,38618,38621, -18948,38676,38691,18985,38710,38721,38727,38741,38743,38747,38762,U,U,38806, -38810,38814,38818,38833,38834,38846,38860,38865,38868,38872,38873,38881,38897, -38916,38925,38926,38932,38934,19132,U,38947,38962,38963,38949,38983,39014, -39083,39085,39088,U,39095,39096,39099,39100,39103,39106,39111,39115,39136,U, -39137,39139,39141,39146,39152,39153,39155,39176,19259,U,39190,39191,U,39194, -39195,39196,U,39217,39218,39219,39226,39227,39228,39232,39233,39238,39245, -39246,39260,39263,39264,39331,39334,39353,39357,39359,39363,39369,39380,39385, -39390,U,39408,39417,39420,39434,39441,39446,39450,39456,39473,39478,39492, -39500,39512,19394,39599,19402,39607,19410,39609,U,39622,39632,39634,39637, -19432,39644,39648,39653,39657,39683,39692,39696,39698,39702,39708,39723,39731, -39741,19488,39755,39779,39781,39787,39788,39795,39798,39799,39846,39852,39857, -U,U,39858,39864,39870,39879,39923,39896,39901,39911,39914,39915,39919,39918,U, -39930,U,39927,U,39958,39960,39961,39962,39965,39970,39975,39977,39978,U,39985, -39990,39991,40005,40028,U,40009,40010,U,40020,40024,40027,40029,40031,40041, -40042,40043,40045,40046,40048,40050,40053,40058,40166,40178,40203,40194,U, -40209,40215,40216,U,19652,U,40242,19665,40258,40266,40287,40290,U,40297,40299, -U,40307,40310,40311,40318,40324,40333,40345,40353,40383,40373,40377,40381, -40387,40391,40393,40406,40410,40415,40416,40419,40436,19719,40458,40450,40461, -40473,40476,40477,40571,U,40576,40581,40603,40616,U,40637,U,40671,40679,40686, -40703,40706,19831,40707,40727,40729,40751,40759,40762,40765,40769,40773,40774, -40787,40789,40792,U,40797,U,40809,U,40813,40816,40821, -}; - -static const struct dbcs_index jisx0213_2_bmp_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_bmp_decmap+0,34,126},{0,0,0},{ -__jisx0213_2_bmp_decmap+93,33,126},{__jisx0213_2_bmp_decmap+187,33,126},{ -__jisx0213_2_bmp_decmap+281,33,125},{0,0,0},{0,0,0},{__jisx0213_2_bmp_decmap+ -374,33,126},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_bmp_decmap+468,33,126},{ -__jisx0213_2_bmp_decmap+562,33,126},{__jisx0213_2_bmp_decmap+656,33,126},{ -__jisx0213_2_bmp_decmap+750,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__jisx0213_2_bmp_decmap+844,33,126},{__jisx0213_2_bmp_decmap+938,33,126},{ -__jisx0213_2_bmp_decmap+1032,33,126},{__jisx0213_2_bmp_decmap+1126,33,126},{ -__jisx0213_2_bmp_decmap+1220,34,126},{__jisx0213_2_bmp_decmap+1313,33,126},{ -__jisx0213_2_bmp_decmap+1407,33,126},{__jisx0213_2_bmp_decmap+1501,33,126},{ -__jisx0213_2_bmp_decmap+1595,33,125},{__jisx0213_2_bmp_decmap+1688,35,126},{ -__jisx0213_2_bmp_decmap+1780,33,126},{__jisx0213_2_bmp_decmap+1874,33,125},{ -__jisx0213_2_bmp_decmap+1967,34,125},{__jisx0213_2_bmp_decmap+2059,34,126},{ -__jisx0213_2_bmp_decmap+2152,33,126},{__jisx0213_2_bmp_decmap+2246,33,126},{ -__jisx0213_2_bmp_decmap+2340,33,117},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __jisx0213_bmp_encmap[27287] = { -8754,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10530, -10531,N,N,10532,N,10533,N,N,10534,10535,10536,N,10537,10538,10539,N,N,10540, -10541,N,N,N,10542,10543,10544,10545,10546,10547,10548,10549,10550,10551,10552, -10553,10554,10555,10556,10557,10558,10559,10560,10561,10562,10563,10564,10565, -10566,10567,10568,10569,10570,10571,10572,10573,N,10574,10575,10576,10577, -10578,10579,10580,10581,10582,10583,10584,10585,10586,10587,M,10589,10590, -10591,10592,10593,10594,10595,10596,10597,10598,10599,10600,10601,10602,10603, -10604,N,10605,10606,10607,10608,10609,10610,10611,10612,10613,10618,10810, -10825,10785,10796,10812,10827,10841,10847,N,N,10813,10828,10816,10831,N,10832, -10616,10621,N,N,N,N,10814,10829,10815,10830,10842,10848,N,N,N,N,N,N,10843, -10849,N,10877,N,N,10614,10619,N,N,N,N,N,N,N,N,10844,10850,N,N,N,10811,10826,N, -N,10788,10799,N,N,10787,10798,10817,10833,N,N,10818,10834,N,N,10874,10617, -10622,N,N,10819,10835,11051,11050,10809,10824,N,N,10820,10836,10789,10800, -10845,10851,10791,10803,10790,10802,10823,10839,10792,10804,N,N,N,N,10615, -10620,10846,10852,10821,10837,10822,10838,N,N,N,N,N,N,N,10793,10805,10795, -10808,10794,10807,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11049,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -11044,N,N,N,N,N,N,N,N,N,N,10351,10352,N,10353,10358,10359,N,10360,N,10361,N, -10362,N,10363,N,10364,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -10356,10357,N,N,N,11077,11059,11065,11066,11045,M,11071,10862,11046,11054,M,M, -N,11057,N,11058,10869,11048,10873,N,N,11062,11068,11042,11074,11052,N,N,N, -10858,10868,10859,11060,10875,10853,10870,10863,N,11055,N,N,N,10860,11073, -10867,N,10864,10855,N,N,10876,10865,10856,11047,N,N,N,10861,11053,11061,10854, -M,11067,10872,N,10866,11072,10857,N,11041,10878,N,N,11043,N,N,N,N,10871,N,N,N, -11070,11069,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,10801,11091,N,N,N,11092,N,N,N,11093,11094,N,N,N,N,N,N,10786,10840,N, -10797,N,10806,11121,N,N,N,N,N,N,M,11105,11106,11107,M,11100,11098,11103,11133, -11099,N,11095,N,11117,N,N,11097,11102,N,N,11101,N,N,N,N,N,N,N,N,11128,11129, -11134,N,11114,11126,11127,11115,11116,N,N,N,11122,11111,N,N,N,11119,11130,N, -11112,N,N,11120,11123,N,N,N,11125,N,N,N,N,11113,11131,11132,11124,11118,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11090,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,9817,10354,10355,11078,11079,11088,11089,9084,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,9024,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,10347,N,N,11096,N,N,11390,N,N,N,N,10348,10349,10350,N,N,N,N,N,N,N,11389,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,10529,9053,N,N,N,9055,N,N,11618,N,N,N,N,N,N,N,N,N,N,11620, -N,N,N,N,N,9056,N,N,N,N,N,N,N,N,N,N,N,N,N,9052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,10104,10105,10106,N,N,N,N,N,N,N,N,N,N,11573,11574, -11575,11576,11577,11578,11579,11580,11581,11582,11583,11607,N,N,N,N,11317, -11318,11319,11320,11321,11322,11323,11324,11325,11326,11327,11328,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8817,N,8999,8997,8998,9000,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9001,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9003,9004, -9002,9005,8775,N,N,N,8774,N,N,N,N,N,N,N,N,N,9051,N,N,N,N,N,N,N,N,N,N,N,11640, -N,N,N,N,N,8788,8789,N,N,N,N,N,N,N,11635,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,8812,N,8813,N,N,8814,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8811, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8815,8816,N,N,N,N,N,N,N,N,N,N,N,N,8770, -8771,N,N,N,N,8772,8773,N,N,N,N,N,N,N,N,N,8785,8786,8787,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11641,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10102,10103,8776,8777,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,10108,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10050,10051,10052,10053,10054,10055, -10056,10057,10058,10059,10060,10061,10062,10063,10064,N,10110,10109,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11553,11554,11555,11556,11557,11558,11559, -11560,11561,11562,11563,11564,11565,11566,11567,11568,11569,11570,11571,11572, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,11329,11330,11331,11332,11333,11334,11335,11336, -11337,11338,11339,11340,11341,11342,11343,11344,11345,11346,11347,11348,11349, -11350,11351,11352,11353,11354,N,11307,11308,11309,11310,11311,11312,11313, -11314,11315,11316,9818,9819,9820,9821,9822,9823,9824,9825,9826,9827,9837,N,N, -N,N,8994,8993,N,N,N,N,N,N,N,N,8996,8995,N,N,N,N,N,N,N,9019,N,N,N,N,N,N,10343, -10344,10345,10346,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9023,9832,9833,9834, -9835,N,N,N,N,N,N,N,N,N,N,9831,N,N,N,N,N,N,N,9828,9829,N,N,N,N,N,N,11646,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9786,9789,9787,9792,9785,9790, -9788,9791,9836,8829,N,8827,8828,N,8826,10107,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,11645,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,11297,11298,11299,11300,11301,11302,11303,11304,11305,11306,9006, -9007,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,8790,8791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,9018,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,9085,9086,8794,8795,8792,8793,N,N,N,11616,N,11617,9830,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8755,8756,8757,N,N,N,N,N,8758,8759,9020,N,N,N, -N,N,N,N,N,N,N,N,N,N,M,N,M,N,M,N,M,N,M,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,9332,9333,9334,N,N,N,N,N,N,N,N,8761,9083,N,N,N,N,N,N,N,N,N,N,M,N,M, -N,M,N,M,N,M,N,N,N,N,N,N,N,M,N,N,N,N,N,N,N,N,M,N,N,N,M,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10098, -10099,10100,10101,N,N,N,N,8760,9838,9839,9840,9841,9842,9843,9844,M,9846,9847, -9849,9850,9851,9852,9853,9854,11626,11627,N,N,N,N,N,N,11628,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,10305,10306,10307,10308,10309,10310,10311,10312, -10313,10314,10315,10316,10317,10318,10319,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,11621,11622,11623,11624,11625,N,N,N,N,N,N,N,N,10320, -10321,10322,10323,10324,10325,10326,10327,10328,10329,10330,10331,10332,10333, -10334,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11355,11356,11357,11358,11359,11360, -11361,11362,11363,11364,11365,11366,11367,11368,11369,11370,11371,11372,11373, -11374,N,11377,N,N,N,11376,N,N,11379,11378,N,N,N,N,N,N,N,N,N,N,N,N,11375,11590, -N,N,N,N,N,N,N,N,N,11594,N,N,N,N,N,N,11585,N,N,N,11588,N,N,N,N,N,N,N,N,N,11586, -11596,N,N,11595,11589,N,N,N,11597,N,N,N,N,N,N,N,N,N,N,11591,N,N,N,N,11599,N,N, -N,N,N,N,N,N,N,N,N,N,N,11584,11598,N,N,11587,N,N,N,11592,N,N,N,N,N,11593,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11615,11631, -11630,11629,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11603,11604,N,N,N,N,N,N,N,N,N,N,N,N, -11600,11601,11602,N,N,11606,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,11605,N,N,N,N,N,N,9054,N,11619,11811,N,N,N,41261,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41266,N,41267, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41310,N,41302,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41342,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11859,N,N,N,N,N,N,41771,N,N,N,N, -62568,N,N,N,N,N,41775,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11867,41800,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41821,41822,N,N,N,N,41825,N,N,N,N,N,N,N, -N,N,N,41831,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42019,N,42022,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,42040,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42050,42058,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42105,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42303,N,N,N,N,42307,N,N,42305,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,42327,43043,43045,N,N,N,N,N,N,N,N,43049,43048,N,N,N,N,N, -N,N,N,43052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20319,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,43070,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,20335,N,N,N,N,N,43094,N,N,N,N,N,N,N,N,N,N,N,43097,N,N,N,N,N,N,N,N,43100, -43102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,43119,N,N,N,N,N,N,43121,N,N,N,N,N,N,N,N,N,43124,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43129,N,N,N,N,43131,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44091,44102,N,N,44106, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,44128,44379,N,N,N,N,44383,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -44401,44598,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44412,44590,N,N,N,N,N,N,N,N,N, -N,N,44594,N,44596,N,N,N,N,N,30025,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,44653,N,N,N,N,N,N,N,N,N,44645,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,44840,44841,N,N,N,N,44844,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -44852,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30078,N,N,N,N,N,N,N,N,N,N,N,N,30241,N, -N,N,N,N,N,N,N,N,44872,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,44893,30266,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44919,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -60987,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60994,61041,N,N,N,N,N,N,N,N,N,N,N,N,61054,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61248,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,61268,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,61296,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61303,61480,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30566,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,61503,N,N,N,N,N,61505,N,61506,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,61513,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61520,61748,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30797,N,N,61766,N,61768,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,61788,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,61799,N,N,N,N,N,N,N,N,N,N,N,N,N,61804,61986,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61997,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -62009,62052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62068,N,N,N, -N,N,N,62071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62077,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62259,N,N,N,N,N,N, -N,N,N,N,62263,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,62279,N,N,N,N,N,N,N,62283,N,N,N,N,62280,62291,N,N,N,N,N,N,62295,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,31085,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62507,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,62518,N,N,N,N,N,N,62523,62542,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62557,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,62561,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62782,N,62786,62792,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,62794,N,N,N,N,62796,N,N,N,N,N,62799,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -31321,N,N,N,N,N,N,N,31322,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -62828,N,N,N,62830,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62839,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63029,N,N,N,N,N,N,N,N, -N,N,63026,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63028,63065,N,N,N,N,63060, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63085,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63086,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31569,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63340,N,N,N,N,31584, -63524,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,63546,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,63555,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63566,N, -N,N,N,N,N,N,N,N,N,N,N,N,63571,63595,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63785,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63807,63817,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -31819,N,N,N,N,N,N,N,N,N,63836,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64039,32088,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64362,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,64368,64373,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,64376,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64567,64597,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64806,N,N,N,N,N,N,N,64808,N,N,N, -N,N,N,N,64810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64817,32318,N,N,N,N,N, -N,N,N,64831,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,65066,N,N,N,N,N,N,N,N,N,N,N,N,65069,65099,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65120,41250,N,N,N,N,N, -N,N,N,N,N,N,N,41251,N,N,41252,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11812, -41253,N,41254,61486,N,41255,11813,11814,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41256,N, -N,N,N,N,N,41257,41258,N,N,N,N,N,N,N,N,41260,N,N,N,N,N,N,N,N,41263,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,41264,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,11815,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41265,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41268,N,41269,41271,N,N,N,N,N,N,41272,N,N,N,N, -41273,N,N,N,N,N,N,N,41274,N,N,N,N,N,N,N,N,N,41276,N,N,N,N,N,N,11816,N,N,N,N,N, -N,N,N,N,41275,N,N,N,N,N,41277,N,N,N,41278,N,N,N,N,N,N,N,11817,N,11818,41279,N, -N,11819,N,N,N,N,N,N,N,11820,N,N,N,N,N,N,N,N,N,N,41280,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41282,N,N,N,N,N,N,41283,N,N,N,N,N,N,N, -N,N,11822,11823,N,N,N,N,N,N,N,N,N,N,41284,N,11824,N,41285,N,N,N,N,N,N,11825, -11821,N,N,N,41281,N,N,N,N,N,11826,N,11827,N,N,N,N,N,N,N,N,N,N,41287,41288,N, -41289,N,N,41290,11828,N,N,N,41291,N,N,41292,N,N,N,N,11829,N,N,N,N,N,N,N,41293, -N,11830,N,N,11831,N,N,41294,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41296,N,N,N,N,N,N,N,N,N,N,N,41297,N,N,N,N,N,N,41298,N,N,N,11833,N,41299,N,N,N, -41300,N,N,41301,N,N,N,N,N,N,N,N,N,N,N,N,N,11834,N,N,N,N,N,41295,N,N,N,N,N,N,N, -N,N,N,11809,41303,41304,11835,11836,N,N,N,N,N,N,N,N,N,N,N,11837,N,41305,N,N, -41306,N,N,N,N,11838,N,N,N,41307,N,41308,N,N,N,41309,N,N,N,N,11839,N,N,N,N,N,N, -11840,N,N,N,N,N,N,N,N,N,N,N,N,11842,N,N,N,N,11841,11843,41311,N,N,N,41312,N,N, -N,N,N,N,N,41313,N,N,N,N,41314,N,N,N,41315,N,N,N,N,N,N,N,N,N,N,N,41316,N,N, -41317,N,N,N,41318,N,N,N,N,N,41319,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,41321,N,N,N,N,N,N,N,N,N,41322,41323,11844,41324,41325,N,N,N,N,N,41326,N,N,N, -N,N,N,41320,N,N,N,N,N,N,41327,N,N,N,N,N,N,41329,N,N,N,N,N,N,N,N,41330,41331,N, -N,N,N,N,N,N,N,41332,N,N,41333,N,N,N,N,11845,N,41336,N,11847,N,N,N,41338,N,N,N, -N,41339,N,N,N,N,N,N,N,41340,N,N,N,N,11848,N,N,41341,N,N,N,N,N,N,N,N,11846, -41334,11851,N,N,11850,N,41761,N,N,11852,N,N,N,N,N,N,N,N,N,N,N,41763,N,N,N, -41764,N,N,11853,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11854,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,11855,N,N,N,N,N,N,N,N,N,N,11857,N,11858,N,N,N,N,N, -N,N,N,41766,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41768,N,N,N,N,N,N,N,62580,N,N, -N,N,N,N,N,41769,N,N,N,N,N,N,N,41770,N,N,N,N,N,N,N,N,N,N,N,N,41772,N,N,N,N, -11860,N,N,N,N,N,41773,N,N,N,N,N,N,N,N,N,41774,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41776,N,N,N,N,N,N,11861,N,N,N,N,N,N,11862,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,11863,N,N,N,11864,N,N,N,N,N,N,N,N,N,N,N,11865,N,N,N,N,41779,41780,11866, -41781,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41782,11868,N,11869,41783,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,11870,N,N,N,N,N,N,N,N,N,N,N,41785,N,11871,N,N,N,N,41786,12158,N,N,N, -11872,N,N,N,N,N,N,N,N,N,N,41787,N,N,N,N,N,N,N,N,N,N,41788,N,N,N,N,N,N,N,N,N,N, -41790,N,41789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11873,N,N,N,N,41792,N,N,N,N,N,N,N,N, -N,N,N,41794,N,41795,N,N,N,N,N,N,N,N,41796,N,N,N,N,N,N,N,N,N,N,41797,41798,N,N, -N,N,N,N,N,N,N,N,N,N,11874,N,41799,N,11876,N,N,N,11877,41801,N,N,N,N,11878,N,N, -N,N,11879,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11881,N,N,N,N,N,N,41803,N,N, -N,11882,11883,N,N,N,N,N,N,11884,N,N,41804,41805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,11885,N,N,N,N,N,N,N,41806,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41807,N,N,N,N,N,N, -N,N,41808,N,N,N,41809,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,11887,N,11888,N,N,N,41812,N,N,N,N,41813,N,N,N,N,N,N,N,N,N,N,N,N,N,41814,N, -N,11889,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11890,N,N,N,N,N,N,N,N,N, -11891,N,N,N,N,N,N,41815,N,N,N,N,N,N,N,N,N,N,N,N,N,11892,N,41816,N,N,41818,N,N, -N,N,N,N,N,N,41819,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41823,N,N,N,N,41824, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41826,41827,11893,N,N,N,N,N, -N,N,N,N,N,N,20350,N,N,N,N,N,41829,N,N,11894,41830,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,41832,N,N,N,N,N,N,N,N,N,11895,N,N,N,N,N,N,N,41828,N,N, -N,N,N,N,N,N,N,N,N,N,41833,N,N,N,41834,N,N,N,N,11897,41835,N,N,N,N,N,N,N,11898, -N,N,N,N,N,N,N,N,N,N,11899,N,N,N,N,N,N,N,N,11900,N,41836,N,N,41837,N,N,N,N,N,N, -N,41838,11901,N,N,N,N,N,11896,N,N,N,41839,11902,N,N,N,N,41840,N,N,12065,N,N,N, -41841,41842,N,N,N,N,N,N,N,N,41843,N,N,41844,N,N,N,N,41845,N,N,N,41846,N,N, -12066,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,41848,N,N,41849,N,41850,N,41851,N,N,N,N,N,N,N,N,N,N,N,12067,41852,41853,N,N, -N,N,N,N,N,41854,N,N,N,N,12068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,12069,N,N,N,N,N,N,N,N,N,12070,N,N,N,N,N,N,42017,N,N,N,N,42018,N,N,N,N, -N,42020,N,N,42021,N,N,N,N,N,12071,N,N,N,N,N,N,N,N,N,N,N,N,N,12072,N,42023, -42024,N,N,42025,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42027,N,N,N, -12073,42028,N,N,N,12074,N,42029,N,N,N,N,N,12075,N,N,42030,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,12077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -42035,N,N,N,N,N,N,N,N,N,42036,N,N,42037,N,12078,N,N,42038,42032,N,N,N,N,N,N,N, -N,N,N,42039,N,N,N,N,42041,N,N,N,N,N,N,42043,42046,12080,N,N,N,N,N,12081,N, -42047,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42044,N,N,N,N,N,N,N,42048, -N,N,N,N,N,N,42049,N,N,N,12082,N,42051,N,42052,42053,N,N,N,N,N,N,42054,N,12083, -N,N,N,N,N,N,N,N,N,29735,N,N,N,N,N,N,N,N,N,N,42055,N,42056,N,N,N,N,N,12085,N,N, -N,N,N,N,42057,N,12087,N,12088,12089,N,N,N,12084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,42059,N,N,N,42060,N,N,N,N,N,N,N,N,42061,N,N,N,12090,42062,N,N,42063,12091, -N,N,N,N,N,N,N,N,N,42064,12092,N,N,12093,42065,N,N,N,N,42066,12094,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,42067,N,N,N,12095,12096,N,N,42068,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,42069,N,N,N,N,N,N,N,N,42070,N,N,N,N,N,N,N,N,N,N,N,N,N,42071,42072, -12097,N,N,N,N,N,N,N,N,N,N,42074,N,N,N,N,N,N,N,N,N,N,N,12099,N,42075,N,N,N,N,N, -42077,N,N,N,N,N,12100,N,N,N,12101,12102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42079, -42080,N,N,N,N,N,42081,42082,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,42084,N,N,N,N,N,N,42085,12103,N,N,42086,42087,42088,N,12104,N,N,N,42089, -12105,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42093,N,12106, -42094,42095,N,N,N,N,N,N,N,N,N,42096,N,N,N,42092,N,N,N,N,N,N,N,N,N,N,N,12109,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,12110,12111,N,N,N,42099,N,N,12112,N,N,N,N,N,N,N, -42097,N,N,N,N,N,N,42102,N,N,N,N,N,12113,N,42103,N,N,N,N,N,N,12114,N,N,42104,N, -N,N,N,12115,12116,N,42106,N,N,42107,N,42108,N,12117,42109,N,N,N,N,12118,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42110,N,42273,N,N,N,N,N,N,42274,N,N,N,N,N,N, -N,N,N,N,42275,N,N,N,N,N,N,42276,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42278,N,N,42279, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,12120,N,N,12121,N,N,42280,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,12123,N,N,N,N,N,N,N,N,N,N,N,N,12124,42281,42282,N, -42283,N,42284,42285,N,N,N,42286,N,N,N,N,N,N,N,N,42287,12125,N,N,N,N,N,N,N,N,N, -N,12127,42288,N,N,N,N,N,N,42289,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42291,N,N,N, -N,N,N,N,N,N,42292,12130,N,N,N,12129,N,12131,N,N,N,N,N,12132,N,N,N,N,N,12133,N, -42293,N,N,N,N,N,N,12134,N,N,N,N,N,N,N,N,N,42294,42295,42296,42297,N,N,N,N, -42298,12135,42299,N,N,N,N,N,N,42300,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42301,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42304,N,N,N,N,N,N,N,N,42306,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42309,N,12137,N,42310,N,N,N,N,N,N,N,N,N,N,N,N, -N,12138,N,N,N,N,N,N,N,42312,42313,N,N,N,N,N,42314,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -12139,N,N,N,N,N,N,12140,N,N,N,N,N,N,N,N,N,N,N,N,42315,N,N,N,N,12141,N,N,N,N,N, -N,N,N,N,42316,N,N,N,N,N,N,N,N,N,N,N,N,N,42317,N,N,N,N,N,N,12142,N,N,N,N,42318, -N,N,N,N,42319,N,N,N,N,12143,N,N,N,N,N,N,N,N,N,N,12144,42320,N,N,N,N,42321, -42322,N,N,42323,N,N,N,N,N,N,42324,N,N,N,N,N,N,N,N,N,32378,42328,42329,N,N,N,N, -N,12145,N,N,N,42330,N,N,N,N,N,N,N,N,N,N,N,12146,N,N,N,42331,N,N,N,N,N,42332,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -42333,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42334,N,12147,N,N,N,N,N,12148,N,N,N,N,N,N, -N,N,N,12149,N,N,42335,N,N,N,12150,N,N,N,N,N,12151,N,N,N,N,N,N,42336,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,42337,N,12152,42338,42339,N,42340,N,N,N,N,12153,N,N,N,N, -N,N,N,N,N,42341,N,42342,N,42343,N,N,N,N,42344,N,N,N,N,42345,N,N,N,N,12154,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42346,N,42347,N,N,N,42348,N,N,N,N,42349, -N,N,N,N,N,N,N,N,42351,N,42350,N,N,N,N,42352,42353,N,N,N,N,N,N,N,42354,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,42355,N,12156,N,N,N,N,N,N,N,N,N,N,N,12157,N,N,N,N,N,N,N, -42357,N,N,N,N,N,N,42356,N,N,N,N,N,N,N,N,N,N,N,N,20309,N,N,N,N,N,N,N,N,N,N, -42358,N,N,N,N,N,42359,N,N,N,20310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42360,N,N, -N,N,N,N,42361,N,N,N,N,N,N,N,N,N,N,N,N,42362,20311,N,42363,N,42364,N,N,42365,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,20312,N,N,43041,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,43042,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43044,N,N,N,N,N,N,N,N,N,N,N, -N,N,43046,N,N,N,N,N,N,N,43047,N,20313,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -20314,N,N,N,N,43050,N,N,N,N,N,N,N,N,N,N,N,43051,43053,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,20315,N,N,N,N,N,N,N,N,N,N,N,20316,N,N,N,N,20317,N,N,N,N,N,43054,N,20318,N, -N,N,N,43055,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,32379,N,N,N,43057,N,N,20320,43058,N,N,N,43059,43060,43061,N, -N,N,N,N,N,43062,N,N,N,N,N,N,N,N,N,20324,N,43065,N,N,N,N,N,N,N,N,N,N,N,43068,N, -43069,N,N,N,N,20325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20326,43073,N,43074,20327,N, -N,43075,43076,N,N,20328,N,N,43078,N,N,N,N,N,N,N,43079,N,N,N,N,20329,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,43081,N,20330,N,N,N,N,20331,N,20332,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20333,43084,N,N,N,N,N,N,20336,N,N, -43085,N,N,N,N,N,N,N,N,N,N,N,N,43087,N,N,43088,N,N,N,43089,N,43090,20337,N,N,N, -43086,N,N,N,N,N,43091,N,N,N,N,N,N,N,43092,N,N,N,N,N,N,N,N,43093,N,N,N,20339, -20340,N,N,20342,N,N,N,N,N,N,N,N,20341,N,N,N,N,N,N,N,N,N,N,N,N,N,43095,N,N,N,N, -N,N,N,N,43096,N,N,20343,N,N,43098,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20344,N,N,N, -N,N,N,43101,N,N,N,N,N,N,N,N,N,43103,N,43104,N,N,43105,N,43106,N,N,N,N,N,N, -20345,N,N,N,20346,N,N,20347,N,N,N,N,N,N,N,N,43107,N,43108,N,43109,N,N,N,20348, -43111,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20349,N,N,N,N,N,43112,N,N,N,N,N,43113, -43114,N,N,N,N,N,N,N,43115,N,29736,N,43117,N,N,N,N,43118,43120,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,43122,N,29737,43123,N,N,29738,N,N,N,N,N,N,43125,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,43126,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43127,N,N,N,N,N,N,N,N,N,N, -43128,N,N,N,N,N,N,N,N,N,N,N,N,43130,N,29739,N,N,N,N,N,29740,N,N,N,N,N,N,N,N,N, -N,N,N,43132,43133,43134,44065,N,N,N,N,N,N,N,N,32380,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44067,N,N,N,N, -44068,N,44069,N,N,N,N,N,N,N,N,N,N,N,N,44070,N,N,N,N,29741,44071,N,N,N,N,N,N, -44072,N,N,N,N,29743,N,N,N,N,N,N,44073,N,N,N,N,N,N,44074,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29744,N,N,N,44076,29745,N,29746,N,N,N, -N,29747,44077,N,N,N,N,N,44078,N,N,N,N,N,N,N,N,N,N,N,N,N,44079,29748,44081,N,N, -N,N,29749,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29750,N,29751,N,N,N,N,N,N,29752,N,N, -29753,N,N,N,N,29754,N,44082,N,N,N,N,N,N,N,N,N,N,N,N,29755,N,N,N,29756,N,N,N,N, -N,N,N,N,N,N,44083,29757,N,N,29758,N,N,N,N,N,N,N,N,N,N,44084,N,N,N,N,N,N,N,N,N, -N,29759,44085,N,N,N,N,N,N,N,N,N,N,29760,N,N,N,N,N,44086,N,N,N,N,N,N,N,N,N,N,N, -N,29761,N,N,N,N,N,44087,N,44088,N,N,29762,N,N,N,N,N,N,N,29763,N,N,N,N,N,29764, -N,29765,44089,N,N,N,N,N,N,N,N,N,N,N,44090,N,N,44092,N,29766,N,44093,N,N,N,N,N, -N,44094,44095,44096,N,N,N,N,N,N,N,N,N,29767,N,N,29768,44097,N,N,N,N,N,N,29769, -N,N,N,N,44098,44099,N,N,N,44100,N,N,N,N,N,N,N,N,44101,29770,N,N,N,N,N,N,29771, -N,N,44103,29772,N,N,N,N,N,N,N,N,N,44104,N,44105,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -29773,N,29774,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29775,N,N,N,N,44107,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,44108,N,N,N,N,N,N,N,N,N,N,44109,N,N,N,N,N,N,N,N,N,N,44110,N,N,N,N, -N,N,N,29777,29778,N,N,N,N,N,N,N,N,N,44111,N,N,N,N,N,N,N,44113,44114,N,N,N,N,N, -N,N,N,N,N,N,N,44115,N,N,N,N,N,N,N,N,N,44116,N,N,29779,N,N,N,N,N,N,N,N,29780, -29781,N,N,N,44117,N,44118,N,29782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44119,N,N,N, -44120,N,N,44121,N,N,29783,44122,N,44123,44124,N,N,N,N,N,44125,N,N,29784,N, -44126,N,N,N,N,N,N,N,N,N,N,N,N,29785,N,N,N,N,29786,N,N,N,N,N,N,29787,N,N,44127, -N,N,N,N,N,N,44129,N,N,N,N,44130,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,44131,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44132,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,29789,N,N,N,N,44134,44135,N,N,N,44136,44137,N,N,N,N,N, -N,N,N,N,N,N,N,44138,N,N,44139,N,N,N,N,44140,N,N,N,N,N,N,N,N,N,N,N,29792,N,N, -29791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44142,N,N,N,N,N,N,N, -44143,N,44144,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44145,44147,N,N,N,N,N, -N,N,N,N,N,N,N,29794,44148,N,N,N,N,N,44149,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,29795,N,N,N,N,29796,N,N,44150,N,N,N,N,N,44151,N,N,N,N,44152,44153,N,N,N, -29797,N,N,N,29798,N,N,N,N,N,N,44154,N,N,44155,N,N,N,N,N,N,N,N,44157,N,29799,N, -N,N,44158,N,N,N,N,N,N,N,44156,N,N,N,N,N,N,N,N,N,29800,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,44321,N,N,N,N,N,N,N,N,N,N,N,N,44322,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44323, -29802,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,29803,44325,44326,N,N,N,N,N,N,29804,N,N,44327,N,N,44328,N,N,N,N,N,N,N,29805, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44331,N,N,44332,N,N,N,29806, -N,44333,44334,N,N,N,N,44335,N,29807,44336,N,N,N,N,N,N,N,N,N,44337,N,N,N,N,N,N, -N,N,N,N,44339,N,N,N,N,N,N,N,N,N,N,N,29808,N,N,N,N,N,N,44342,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,29809,N,N,N,N,N,N,N,44343,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44346,N,N, -N,N,44344,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,44347,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44349,44350,N,N,N,N,N,N, -44351,N,N,N,44352,N,N,N,N,29810,N,N,N,N,N,44353,44354,29811,N,N,N,N,44355,N,N, -29812,N,44348,44356,N,N,N,N,N,N,29813,N,N,N,29814,N,N,N,N,N,N,N,N,N,44357,N,N, -N,29815,N,N,44358,N,N,N,44359,N,N,N,N,N,44360,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29817,N,N,N,N,N,N,N,N,44361,44362,N,44363,N, -N,29818,N,N,N,N,N,N,N,N,N,N,N,N,29819,N,N,N,N,N,44364,N,N,N,N,N,29816,N,N,N, -44365,N,N,N,N,N,N,N,N,N,44366,N,N,N,N,N,N,N,N,N,44367,N,N,N,N,N,N,N,N,N,N,N, -44368,N,44369,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -29821,29822,N,N,N,N,29985,N,N,N,N,N,29986,44370,44371,N,29820,N,29987,N,N,N,N, -44372,N,44373,N,N,N,N,N,N,N,N,N,N,N,N,44375,44376,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,29988,N,N,N,29989,N,N,N,44377,44378,N,N,N,N,N,N,N,N,N,N,44380,N,N,N,N, -44381,N,44382,N,N,N,N,N,N,N,44384,N,N,N,29990,N,N,N,N,N,N,29991,N,N,N,N,N,N,N, -N,44385,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44386,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -44387,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29993,N,N,N,44388,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,44389,N,N,N,N,N,N,44390,N,N,44391,44392,N,N,N,N,44393,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,29994,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44394,N,N, -44395,N,N,44396,N,N,N,N,N,N,44397,N,N,44398,N,N,N,N,N,N,44399,N,N,N,N,N,N,N,N, -N,N,44400,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44402,N,N, -N,N,N,N,44403,N,N,44404,29996,N,N,N,44405,N,N,N,44406,29997,N,N,N,N,N,N,N,N,N, -N,N,29998,N,N,N,N,N,N,N,N,29999,N,N,44407,30001,N,30002,N,N,N,N,N,44408,30003, -N,N,N,N,30004,30005,N,30006,N,N,N,N,N,N,30000,N,N,N,N,N,N,N,N,N,N,44409,N,N, -30008,N,N,N,30009,N,44411,N,N,44410,N,N,N,N,N,44414,N,30011,30012,44577,N,N,N, -N,N,30013,N,44578,N,30014,N,N,N,N,44581,44582,44583,44584,N,N,N,N,N,30015,N,N, -N,30016,30017,N,N,44585,N,N,N,N,44586,N,N,N,N,N,N,N,N,N,N,N,N,30018,N,N,44587, -N,44588,N,N,N,N,N,N,44589,N,N,N,N,N,N,30020,N,N,N,N,N,N,N,N,N,N,N,N,44591,N,N, -N,44592,30021,N,N,44593,N,N,N,N,N,30022,N,N,N,44595,N,N,N,N,N,N,30023,N,30024, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30026,N,N,N,N,N,N,N,N,N,N,N,N,30027,N,N,N, -44597,N,N,N,N,N,N,N,N,N,N,N,N,N,30028,30007,44599,N,N,N,44600,N,N,N,N,N,N,N,N, -N,N,N,N,44601,30029,N,N,N,N,N,44603,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,30031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30033,30034,N,N,N,44606, -44607,N,N,N,N,N,N,44608,N,N,N,N,N,N,N,N,44609,N,N,N,N,N,N,N,N,30032,N,N,N,N,N, -N,N,N,N,N,N,N,N,44613,N,44614,N,N,N,N,30035,N,N,N,N,N,30036,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,44616,30037,N,N,N,N,30038,N,N,30039,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,44620,N,44621,N,N,N,N,N,N,N,N,30040,N,N,N,N,30042,N,N,44622,N,N,N, -N,44623,N,N,N,N,N,N,N,N,N,44624,N,N,N,N,30043,N,44625,N,44626,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,44627,N,N,N,N,N,N,44628,N,30041,N,N,30044,30045,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,44619,N,N,N,N,N,N,N,44632,N,N,N,N,30047,N,44633,N,N,N,N, -N,N,N,N,N,N,N,N,30048,44634,N,N,N,30049,N,44636,N,N,N,N,N,N,N,44637,N,N,44638, -N,N,N,N,N,44639,44640,N,N,N,44641,N,N,44642,N,N,N,N,N,30046,N,N,44643,N,44644, -N,N,N,30050,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44646,N,N,44647,N,N,N,30051,N,N, -30052,N,N,N,N,44648,N,44649,N,N,N,N,N,44650,N,N,N,N,N,N,N,N,N,N,N,N,N,44651,N, -N,N,N,N,44652,N,44654,44655,44656,N,44657,N,N,N,N,N,N,30054,N,30055,N,N,N,N, -44658,44659,N,N,N,N,N,N,30056,N,44660,N,N,N,N,N,N,44661,N,N,N,N,N,N,N,44666,N, -44667,N,N,30057,N,N,N,44668,N,N,44669,30058,N,N,N,N,N,44670,N,N,44833,N,N,N,N, -N,N,N,N,N,N,44834,44835,N,N,30059,N,N,N,44836,30060,N,N,30061,30062,N,N,N,N,N, -44837,N,N,N,44662,30063,44838,N,N,N,44839,N,N,30064,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30067,N,N,N,N,N, -44843,N,N,N,N,N,N,30068,N,N,N,44845,N,N,30065,N,N,N,N,N,N,N,N,N,N,N,N,N,30069, -N,N,N,N,N,N,N,N,N,N,N,30070,30071,N,N,N,30072,44846,N,N,44847,N,N,N,N,N,44848, -N,N,N,N,N,N,N,44849,N,N,N,N,44850,30073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -44851,N,N,N,44853,N,44854,N,N,N,N,N,N,N,N,N,N,N,N,30075,44855,N,N,N,N,N,N, -30076,N,N,44856,N,N,N,N,N,N,44857,N,N,44858,N,44859,N,N,N,44860,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,30077,N,44861,N,N,N,N,44862,N,N,N,N,N,N,N,N,N,N,N,30242,44868,N, -N,N,N,N,30243,30244,N,N,N,44869,44870,N,N,N,44871,44873,30245,30246,N,N,N,N,N, -N,N,44874,30247,N,44875,N,N,N,30248,N,N,N,N,44876,N,N,44877,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,44865,N,44879,44880,44881,N,N,N,N,N,N,30250,N,N,30251,44882, -N,N,N,N,N,30252,44883,N,N,44884,N,N,N,N,44886,N,30253,N,44887,N,N,N,30254,N,N, -N,N,30255,N,N,N,N,N,N,N,N,44888,N,N,N,N,N,N,30256,N,N,N,N,N,N,N,30257,N,N,N,N, -N,N,44885,N,N,N,44890,N,N,N,N,44891,N,N,N,N,N,30259,N,44892,N,N,N,N,N,44894,N, -N,30260,N,N,N,N,N,N,N,N,30261,30262,44895,N,44896,N,N,N,30263,N,N,N,N,N,44898, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44899,N,N,N,N,N,N,N,N,44900,N,N,N,N,N,N,N,N, -N,44902,N,N,N,44901,N,N,N,N,N,N,N,44903,44904,N,N,N,N,N,N,30264,N,N,30265,N,N, -N,N,44907,N,N,N,N,44908,44909,44910,N,N,N,N,N,N,N,N,N,44911,44913,N,N,N,44914, -44915,44916,N,N,N,N,N,44918,N,N,N,30268,N,N,30269,N,N,N,N,N,N,N,N,N,N,N,N,N, -30270,N,N,44920,N,N,N,N,N,30271,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30272,N,N,N, -44921,N,N,N,N,N,N,N,N,N,N,N,30273,N,44922,N,N,N,N,N,N,N,30274,N,N,N,N,30275,N, -30276,N,N,N,N,44923,N,N,N,N,N,N,N,N,44924,N,30277,N,N,44925,N,N,N,N,N,N,44926, -30278,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60961,N,N,N,N,N,N,N,N,N, -N,N,N,N,30279,N,N,N,30280,60962,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60964,60965,N,N,N, -N,N,N,N,N,60966,60967,60968,N,N,N,N,N,30282,N,N,N,N,N,N,30283,30284,N,N,60969, -N,N,N,N,N,N,N,N,N,N,N,60970,60971,N,N,N,N,N,N,60972,N,N,60973,N,N,N,N,N,N,N,N, -N,N,N,N,N,30285,60974,N,N,30286,N,N,N,N,60975,N,N,N,60976,N,30287,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30288,N,60977,60978,N, -N,N,60979,N,N,N,N,60981,N,N,N,N,N,N,N,N,N,N,N,N,N,60982,N,N,N,N,N,N,N,N,N,N,N, -30289,N,60983,30290,N,N,N,N,N,N,N,N,N,N,61007,N,N,N,N,N,60984,N,N,N,N,N,N, -30292,N,30293,N,N,N,N,N,N,N,N,N,N,N,N,N,60985,30294,30295,N,N,60986,N,N,N,N,N, -N,N,N,N,N,60988,60989,N,60990,30296,N,N,N,30297,N,N,N,N,N,N,N,N,N,N,N,N,N, -30291,N,N,60991,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,60992,N,N,N,30299,N,N, -N,N,N,N,N,N,N,60993,N,N,N,30300,N,60995,N,N,N,60996,N,60997,N,N,N,30301,N,N,N, -N,N,N,N,N,60998,N,30302,60999,61000,30303,N,N,N,N,N,N,N,N,N,N,N,N,30298,61002, -N,N,N,30305,N,N,N,N,N,61003,N,N,N,30306,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,61004,N,61005,61006,N,N,N,N,N,N,30307,61008,N,30308,N,N,61029,N,N,N,N, -30309,N,N,61009,N,N,30310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -30311,N,N,61010,N,N,61011,N,61012,N,N,N,N,30312,N,N,N,N,N,N,N,N,N,N,61013,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,61014,61015,30314,N,N,N,N,30315,N,30316,61016,N,N, -61017,N,N,N,61018,N,N,30317,N,N,N,61019,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -30318,61025,30319,N,61026,N,N,N,N,N,61027,N,N,N,N,N,N,N,N,N,N,30320,N,N,61028, -N,30321,N,N,N,61030,N,N,N,N,N,61031,61032,61033,N,N,N,N,N,30322,N,N,N,30323, -30324,N,30325,N,61034,N,N,N,N,N,N,N,N,N,61035,N,N,N,N,N,N,N,N,N,N,N,N,61036,N, -N,N,N,N,30326,61021,N,N,N,N,N,N,61038,N,N,N,61039,N,N,N,N,61040,N,N,N,N,N,N,N, -N,N,N,61042,N,30328,N,61037,N,N,N,N,N,61043,N,N,N,N,N,N,N,30329,N,N,N,61044, -61045,N,61046,61047,N,N,61048,N,61049,N,61050,61051,N,N,61052,N,N,N,N,30330,N, -30331,N,N,N,N,61053,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61217,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,61218,N,N,N,30332,N,N,N,N,N,30333,N,N,61219,N,N,N,N,N,N,N,N,N,N,61220,N, -30334,N,61221,N,N,N,30497,N,N,61222,N,N,N,30498,N,N,N,N,N,N,N,N,N,N,61223,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61225,N,N,N,N,N,N,N,N,N,N,N,N,N,61226,N,61227, -61228,N,61229,N,N,N,30499,N,N,N,N,N,N,N,61230,N,30500,N,N,N,N,N,N,N,N,N,N, -61231,N,N,N,N,30502,N,N,N,N,30503,N,N,N,30504,N,61224,61232,N,N,N,N,N,61233,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30505,61235,N,N,N,N,61236,N,30506,61237, -N,N,N,30507,N,61238,30508,30509,N,N,N,N,N,61239,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,61241,30510,N,N,N,N,N,N,N,N,N,30511,N,N,N,30512,30513,N,N,61242,N,N, -N,30514,N,61243,N,61240,N,N,N,N,N,N,61245,30515,N,N,N,N,61246,N,30516,N,N,N,N, -N,N,N,61247,N,N,N,N,N,61249,30517,N,N,N,N,N,30518,N,61244,N,N,N,N,N,N,N,N, -30519,61250,61251,30520,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61252,N,N,N,61253,N,N,N, -N,N,N,N,N,N,N,61254,N,N,N,N,N,N,30522,N,N,N,N,30523,N,N,N,30521,N,N,61256, -61257,N,N,N,N,30524,30525,61258,N,N,61259,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,61260,N,N,N,N,30526,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61262,61263,N, -61264,N,N,N,N,N,N,61265,N,N,N,61266,N,N,30527,61267,N,N,30530,N,N,N,N,N,61269, -N,N,N,N,N,N,N,N,30528,30529,N,N,N,N,N,30531,61270,N,N,N,61271,N,N,61272,N, -61273,N,N,N,N,N,N,30532,61274,N,N,N,N,N,N,N,61275,N,N,61276,N,N,N,30533,61277, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,61278,N,61279,N,N,N,N,N,N,N,61282,N,N,N,N,30534,N, -N,N,N,N,N,30535,N,N,N,N,N,61283,N,N,N,N,N,30536,N,N,N,61280,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,61286,N,N,N,N,N,N,61287,N,61288,30537,N,N,N,30538,N,N,N,61289,N,N,N, -N,N,N,N,30539,N,N,N,N,N,N,N,61285,61290,61291,N,61292,61293,61294,N,N,N,61295, -N,N,30540,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30542,N,30543,N,N,N,N,N,N,N,N,N,N,30541, -N,N,30544,61297,30545,61298,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30546, -30547,N,N,61300,N,N,N,N,N,61299,30548,30550,61301,N,N,N,N,N,N,N,N,30551,N, -61302,N,30552,N,N,N,N,N,N,N,30553,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,61305,N,N,N,N,30555,N,30556,N,N,N,N,N,N,N,N,N,N,30557,N,N,N,61304,N,N,N,N, -61306,N,N,N,N,61307,N,61308,N,N,N,N,N,N,N,N,N,N,N,61309,61310,N,N,N,61473,N,N, -N,N,N,N,30559,N,N,N,N,N,N,30558,N,N,30560,N,N,N,N,N,N,61475,N,N,N,N,N,N,N, -61476,N,N,N,N,N,61477,N,N,61478,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,30561,30562,N,N,N,N,N,N,61479,N,N,N,N,N,N,N,N,N,N,N,N,N, -30563,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61482,N,N,N,N,N,N,N,N,61483,N, -N,N,61484,61485,N,N,N,N,N,N,N,N,61487,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61488,N, -30564,30565,61489,N,N,N,N,N,N,N,N,N,N,N,61490,N,N,N,N,N,N,N,N,N,N,61492,61493, -N,N,N,N,N,N,N,N,61494,N,N,N,N,N,N,61495,N,N,N,N,N,N,N,N,N,N,N,N,N,30567,61496, -N,N,N,N,N,N,N,N,N,N,N,N,30568,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61498,61499,N, -61500,61501,N,N,N,N,N,N,N,N,N,N,N,N,30569,N,30570,61502,N,N,N,N,N,N,N,N,N,N, -61504,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,61507,N,N,N,N,N,N,61508,30571,61509,N,N,N,N,N,N,N,N,N,N,61510,N,N,N,N,N, -61511,61512,N,N,N,N,N,N,N,N,N,N,N,N,N,30573,30574,N,N,N,61515,N,N,N,N,61516,N, -61517,N,N,N,N,N,61514,N,N,N,61518,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30576,N, -61519,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30577,N,N,N,N,61521,61522,N,61524, -61525,N,61526,N,N,N,N,N,61527,N,N,N,N,30578,N,N,N,N,61528,N,N,N,61529,N,N,N,N, -61530,N,N,N,N,N,N,N,N,N,61531,30579,N,N,61532,N,N,N,61533,N,61534,30580,30581, -N,30582,N,N,61535,30583,N,61536,N,N,30584,N,N,N,N,N,N,N,N,N,61537,N,61538,N, -61539,N,N,61540,N,N,61541,N,N,N,N,N,61542,N,N,N,30585,N,61543,N,N,N,30586,N,N, -N,N,N,N,30587,N,N,30588,N,N,N,N,N,N,N,61544,N,30589,N,N,N,61545,N,30590,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,61546,61548,61549,N,N,N,N,N,30753,N,N,30754,N,N,N,N,N, -N,N,N,61547,N,N,N,N,N,N,30755,30756,N,N,N,N,N,N,N,N,61550,N,30758,N,30759,N, -30760,30761,30762,N,30763,30764,30765,61551,N,N,N,N,N,N,N,61552,N,N,N,N,N,N, -61554,N,N,61555,30766,N,30767,30768,N,N,N,30769,N,61556,N,N,N,N,61557,61553,N, -N,N,30770,N,N,N,N,N,61558,N,N,N,N,30771,N,N,N,N,N,N,N,N,30772,N,30773,N,N,N, -61559,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61560,N,N,N,61561,30774,30775,61562,30776, -N,N,N,N,N,N,30781,N,61564,N,N,N,N,61565,30777,61566,N,N,30778,N,N,30779,61729, -61730,N,30780,N,61731,30782,N,30783,30784,61732,61733,N,N,N,N,N,N,N,N,N,30785, -N,N,N,61734,61736,61735,N,N,N,30786,N,N,N,N,N,N,N,N,30787,30788,N,N,N,N,N,N,N, -N,N,N,N,N,61737,N,61738,N,30789,N,N,N,61739,N,N,N,N,N,N,N,N,N,N,N,N,61741,N,N, -N,61740,N,N,N,N,N,N,N,N,N,N,61743,N,N,N,N,30790,30791,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,30792,N,N,N,N,N,N,N,N,61745,N,N,N,61746,N,N,N,N,N,61747,N,N, -N,N,30793,N,N,N,N,N,N,N,N,N,N,N,N,N,61750,61751,N,61752,N,N,N,N,N,N,N,61753,N, -N,N,N,N,61754,N,61755,N,61756,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,61757,N,N,30794,N,61759,61758,N,N,N,N,N,N,30795,61760,N,N,61761,61762,N,N, -61763,N,N,N,N,N,N,N,N,N,N,61765,N,N,N,N,N,30796,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61767,N,N,N,N,N,N,N,N,N,N,N,N,N,61769,N,N,N,N,N,N,61770,N,N,N,N,N,N,N,61771, -61772,N,N,N,N,N,61773,N,N,N,N,N,N,N,30798,61774,N,N,N,61775,N,N,N,N,N,N,N,N,N, -61776,N,61777,61778,N,N,N,30799,N,N,61779,N,N,N,N,61780,N,61781,N,N,61782,N,N, -N,N,N,N,N,61783,30800,N,30801,61784,N,N,N,61786,30802,N,N,N,N,N,N,61787,N,N,N, -61790,N,30803,30804,N,61785,30805,N,61791,61792,N,30806,N,N,N,N,N,N,61794, -32381,N,61795,N,N,N,N,30807,N,N,N,N,N,61797,N,30808,N,N,N,N,N,N,61796,N,N,N,N, -61800,N,30809,N,N,N,N,N,61802,N,30810,N,N,N,N,N,N,N,N,N,61803,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,30811,30812,N,N,N,N,N,N,N,30813,61805,30814,N,30815,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,30816,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61806,N,N,N,N,N, -30817,61807,30818,30819,N,61809,61808,N,N,N,N,30820,61810,61811,N,30821,N,N,N, -N,61812,N,N,N,N,N,N,30822,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30823,N,N,N,61814,N,N, -30824,N,30825,N,N,N,N,N,30826,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30827,N,61816, -N,N,N,61817,N,N,N,N,30828,N,N,N,N,N,N,N,N,N,N,30829,30830,N,N,N,N,N,N,N,N,N,N, -N,N,61819,N,30831,61820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61821,N,N,N,N,N,N, -30832,61822,30833,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30834,N,N,N,N,N,N,30835,30836, -N,N,N,N,N,N,N,N,N,61989,N,N,N,30837,N,N,30838,61990,N,30839,N,N,N,N,N,N,N, -61991,N,N,N,N,N,N,N,61993,N,N,N,N,N,N,N,30840,N,61994,61995,N,N,30841,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30842,N,N,N,N,N,61998,N,N,N,N,61999,N,N,62000,N, -62001,N,N,N,N,62002,30843,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62003,62004,30844,N,N,N, -62005,N,62006,N,N,N,62007,N,62008,N,N,N,62010,N,N,N,62011,N,N,N,N,N,N,62012, -62014,62015,N,N,62016,N,N,N,62017,N,N,N,N,N,N,N,N,N,N,N,62018,N,N,N,N,N,N,N, -62019,N,N,N,N,N,N,N,N,N,N,62020,30845,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,31009,N,N,N,62021,N,N,N,N,N,N,31010,31011,N,31012,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,62022,N,N,N,31013,N,62023,N,N,N,31014,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,62025,N,N,N,N,N,N,N,N,N,62026,N,N,N,N,N,N,N,N,62028, -62029,62030,N,N,N,N,62027,N,N,N,N,N,N,N,N,31018,N,N,31016,N,N,N,N,N,N,N,N,N,N, -62031,N,N,N,N,N,N,N,N,N,N,N,N,62032,N,N,N,62033,N,62034,N,N,N,N,N,N,62035,N,N, -N,N,N,N,N,N,N,N,62036,62037,N,N,31019,N,62038,N,N,N,N,N,N,N,N,N,N,N,31020,N,N, -N,N,31022,N,62039,62040,62041,N,N,62042,31021,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -62044,N,N,N,N,N,N,N,N,N,N,62045,31023,N,N,N,N,N,N,N,N,62047,N,N,N,N,N,N,N,N, -31024,N,62046,31025,N,N,31026,N,N,N,N,N,N,62048,N,N,N,N,N,N,N,N,N,31029,31030, -N,N,N,62049,N,N,N,N,N,N,N,N,N,N,N,N,N,62050,N,N,62051,31034,N,N,N,N,N,N,N,N,N, -N,62053,N,N,N,N,N,N,N,N,N,N,62054,N,N,N,N,N,N,31038,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,62055,62056,62057,N,31042,N,N,62058,N,N,N,N,N,62059, -N,N,N,N,N,N,N,62060,N,N,N,N,N,N,N,31043,N,N,62061,N,N,N,31044,N,N,62062,N,N,N, -N,N,N,62063,N,N,N,N,62064,31045,N,31046,N,62065,62066,N,N,N,N,N,N,31048,N, -62067,N,N,N,N,N,N,N,31049,N,N,N,N,N,N,N,N,N,N,N,N,31050,N,31051,31052,N,N,N,N, -N,N,62072,N,N,N,N,N,N,62073,N,N,N,62074,N,N,N,N,N,62075,N,N,62076,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,62078,N,N,N,N,N,N,N,N,N,N,62241,31054,N,N,N,N,N,N,N,N,N,N,N,N, -N,62242,N,N,N,N,62243,N,N,N,N,N,N,N,N,N,62244,N,N,62245,N,N,62246,31055,N, -62247,62248,N,N,N,N,N,N,62249,N,N,62250,N,N,31056,N,N,N,N,N,N,N,62251,N,N, -62252,N,N,N,N,N,N,N,N,N,62253,N,N,31058,N,N,N,N,62254,N,N,N,N,N,62255,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,31059,N,N,62256,N,N,N,N,N,N,N,N,62257,N,N,N,N,N,N,31061, -N,N,N,N,N,62260,N,31062,62261,N,62262,N,N,N,N,N,N,N,N,N,N,N,N,N,62264,N,31063, -N,N,62265,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62266,62267,N,N,31064,N,N, -N,N,N,N,N,N,62268,N,N,N,N,N,N,N,N,31065,62271,N,N,N,N,N,N,N,N,N,N,31066,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62274,N,N,62275,N,N,31067,62276,62277,N, -62278,N,N,N,N,N,N,N,N,N,31068,N,62273,N,N,N,62282,N,N,N,N,N,31069,N,N,N,N,N,N, -31070,N,N,N,N,N,N,62284,N,N,N,N,N,N,N,N,N,N,31071,N,N,N,62286,N,62287,N,N, -62288,N,N,N,31072,N,31073,N,N,31074,62289,N,N,N,N,N,62285,N,N,N,N,N,62281,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,62292,62293,N,N,N,N,N,N,N,N,N,62294,N,N,31075,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,62296,N,N,N,N,N,62297,N,N,N,N,N,N,62298,N,N,N,N,N, -N,N,N,62299,N,N,N,N,62300,N,N,N,N,N,N,N,N,N,62303,N,62304,31077,N,31078,62305, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62306,N,N,N,N,N,62307,31079,N,62308,N,N,N,N,N,N, -N,62309,N,N,62310,62311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31081,N,31082,N,N,N,N,N, -62312,N,N,N,N,N,N,N,N,N,N,31080,N,31083,N,N,31084,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -62313,N,N,N,N,62314,N,N,N,N,N,N,62315,N,N,N,N,N,62316,N,31087,N,N,N,N,62317,N, -N,62318,N,N,N,N,N,N,N,62319,N,N,N,31088,62320,62321,62322,N,N,N,N,N,N,N,N, -31089,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31090,N,N,N,N,31091,N,N,N,N,N, -N,N,N,N,N,N,31092,N,N,N,N,N,62326,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62328,62329,N, -N,N,N,31093,N,N,62330,N,N,N,N,62332,N,N,N,62334,N,N,N,N,62497,N,N,N,N,N,N,N, -31094,N,62499,N,31095,N,N,N,31096,N,N,N,N,N,N,N,N,62501,N,N,N,N,62502,N,N,N,N, -N,N,N,N,N,62504,62505,N,N,N,31097,31098,62506,N,N,N,N,N,N,N,N,62508,31099,N,N, -N,N,N,N,N,N,N,31100,62509,N,N,N,N,31101,N,N,N,N,N,N,N,N,N,N,N,N,N,31102,N,N,N, -N,N,N,N,N,N,N,N,62512,62513,N,62514,31265,N,N,N,N,N,62515,31266,N,N,N,N,N,N,N, -N,N,N,31267,N,N,N,N,N,62519,62520,N,31268,N,N,N,N,N,N,N,N,N,N,N,N,N,62521,N,N, -N,N,N,62522,N,N,N,N,N,N,N,N,N,31269,N,N,N,N,62524,N,N,N,31270,N,N,62526,N, -62527,N,N,31271,62528,N,N,N,N,N,N,N,N,N,N,62529,N,N,N,N,N,62531,N,N,31272,N,N, -N,N,N,31273,62532,N,N,62533,N,N,N,N,N,N,N,N,N,N,N,62534,62535,N,N,N,N,N,N,N,N, -62536,N,31274,N,N,N,N,N,N,N,N,N,31275,N,N,N,N,N,N,N,N,N,31276,62537,N,62538,N, -N,N,N,N,N,N,N,N,31277,N,N,62539,N,N,N,N,N,N,N,N,N,N,62540,N,N,N,N,N,N,N,62541, -31280,N,N,N,N,N,N,N,62545,31281,N,N,N,31282,N,62546,N,N,N,N,N,62547,N,N,62548, -N,N,N,N,N,N,62549,31279,N,N,N,62550,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,62551,N,31284,N,N,N,N,N,N,N,N,N,N,31285,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -31286,N,N,N,N,N,N,N,N,N,32382,N,N,N,N,N,N,N,62552,N,62553,N,N,N,N,N,N,N,N, -62554,N,N,N,N,N,N,N,62555,62556,N,N,31287,N,N,31288,N,N,N,62558,N,N,N,N,N,N, -62559,N,62560,62563,62562,N,62564,N,N,N,N,62565,62566,N,N,31289,N,N,N,N,N,N,N, -62567,N,N,62570,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62572,N,62573,62574,N,N,N,N,N,N,N, -N,62575,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62576,62577,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,62579,31291,N,N,N,N,62582,31292,N,N,N,N,62583,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,62584,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31293,N,N,N,62586,N,N,N,N,N,N,N, -N,N,N,31294,62587,N,N,N,N,N,N,N,N,N,N,N,31295,N,N,N,31296,N,N,N,62588,N,62589, -N,N,N,N,N,N,31297,N,31298,62590,N,N,62753,N,N,N,N,N,N,N,31299,62754,N,N,N,N,N, -62756,N,62755,N,N,N,62757,N,N,62758,N,N,31301,N,62759,N,N,N,N,N,N,N,N,N,N,N,N, -N,62760,N,31302,N,N,N,N,N,62761,N,N,N,62762,N,N,N,N,31303,N,31304,N,N,N,N, -31305,N,N,N,N,N,N,62763,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,62764,N,N,N,N,N,N,N,N,N,N,62765,N,N,N,62766,N,N,N,N,N,62767,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62768,N,N,62769,N,N,N,N, -N,N,N,62770,N,N,62771,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62772,N,N,N,N,N,N,N,N,N, -N,N,N,62774,N,N,N,N,31306,N,N,N,N,N,N,N,N,N,N,62775,N,31307,62776,N,N,N,N,N,N, -N,31308,N,N,N,N,N,62777,N,N,N,N,N,N,N,N,N,N,N,N,31309,N,62780,N,N,N,N,N,62781, -62779,N,N,N,N,N,N,N,N,62784,N,31310,N,N,N,N,N,62785,N,N,N,N,N,62787,N,N,62788, -N,N,N,N,62789,N,N,N,N,N,N,N,N,62783,N,N,N,N,N,N,N,62791,N,N,N,N,N,N,N,N,N,N,N, -N,31311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31312,N,N,N,N,N,N,31313, -31314,62793,N,N,N,31315,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62795,N,N,62797, -62798,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62800,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,62801,N,N,N,N,N,N,N,N,31316,N,N,N,N,N,62802,N,62803,N,N,N, -N,N,N,31317,N,N,N,N,31318,N,N,N,N,N,N,62804,31319,N,N,N,62805,N,N,N,N,N,N,N,N, -62807,N,N,N,N,N,N,N,62809,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62811,N,62812,62814, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62816,N,N,N,N,N,N,N,62817,62818,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,62820,N,62821,N,N,N,N,N,N,N,62822,N,N,N,N,N,N,N,N, -62825,62823,N,N,62824,N,62827,N,N,N,62829,N,N,N,N,N,N,N,62831,N,N,N,N,62833,N, -N,N,31323,N,N,62834,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31324,N,N,N,N,62838,N,N,N, -62840,N,62841,N,N,N,62842,N,N,N,N,N,N,62843,N,N,N,31326,N,N,N,N,62844,N,N,N,N, -N,N,N,N,N,N,N,N,N,31327,N,31328,31329,N,N,62845,62846,31330,N,N,N,N,31331,N,N, -N,63009,N,63010,N,N,31332,N,N,63011,N,63012,N,31333,31334,N,N,N,N,N,N,31335,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,31336,N,N,N,N,N,N,N,N,N,N,N,N,63013,N,N,N,N,N,63014, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,63015,N,N,N,N,N,31337,31338,31339,31340,N,N,N,N,N, -63016,63017,N,N,N,63018,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63020,N,63021,N,N,N,N, -31342,N,N,N,N,N,N,N,N,N,N,31343,N,N,63022,N,N,N,N,N,N,N,N,N,31344,N,63023,N,N, -N,N,N,N,31345,63024,N,N,31346,N,N,N,N,N,N,N,N,N,31347,N,N,63019,31348,N,63025, -N,N,N,N,N,N,N,N,N,N,31341,44618,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,31349,N,63027,N,N,N,N,N,N,31350,N,N,N,N,N,N,63030,N,N,N,N,31351,N,63031, -63032,N,N,31352,N,N,63033,N,63034,N,N,N,N,N,N,N,N,N,31353,N,31354,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31355,31356,N,N,N,N,N,N,31357,N,63035,N,N,N,N,N, -31358,63036,31521,N,N,63037,N,N,N,N,N,N,N,N,63038,N,N,N,31522,N,N,N,63039,N,N, -N,N,31523,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63040,31524,N,N,N,N,31525,N,N,N,31526,N, -N,N,N,63041,N,63042,N,N,N,63043,N,63045,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,63046,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31528,N,63047,N, -N,N,N,63048,N,63049,63050,N,N,N,N,N,N,63051,63052,N,63053,N,N,31529,N,N,N,N,N, -63055,N,N,N,N,N,N,N,N,N,N,31530,N,N,31531,N,N,63056,N,63057,N,N,N,63058,N,N,N, -N,63059,N,N,N,31532,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63062,N,N,N,N,N,N,31533, -N,N,N,N,N,N,N,63063,N,N,N,N,N,N,N,N,31534,N,N,N,N,31535,N,N,N,N,N,31536,N,N,N, -63064,N,31537,N,31538,N,N,N,N,N,N,N,N,N,N,N,63066,63067,N,N,N,63068,N,N,N,N,N, -N,N,N,63061,N,N,N,N,N,N,N,N,N,N,63070,N,N,63071,N,N,N,N,63072,63073,63074,N,N, -N,N,N,N,N,N,63075,N,N,63076,63077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63078,N,N,31541, -N,N,N,N,31542,63079,63080,N,N,N,N,N,63081,N,N,N,31543,N,N,31540,N,63082,N,N,N, -N,N,N,N,N,N,63087,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63083,N,63088,N,63089,N,N,N, -N,N,31544,N,N,N,N,63090,N,N,63091,63092,N,31545,N,N,N,N,N,N,N,N,N,N,63084,N,N, -N,N,N,N,N,N,N,N,31548,63094,N,63095,N,63096,N,63097,N,N,N,N,63098,N,N,N,N,N, -31549,N,N,31550,N,N,N,63099,N,N,N,N,N,N,N,N,N,63100,N,63101,N,N,31551,N,N,N,N, -N,N,N,N,N,N,31547,N,N,31552,N,N,N,N,N,N,63267,N,N,N,N,63268,N,N,N,N,N,N,N,N,N, -N,63269,N,N,63270,31553,N,N,31554,N,N,N,N,N,N,N,N,N,63271,63272,N,N,N,N,N, -63273,N,63274,N,N,N,N,63275,N,N,N,N,N,N,31555,N,N,N,N,N,N,N,N,63276,N,N,N,N,N, -N,N,N,31557,63277,N,N,N,31558,31559,N,N,N,N,N,N,N,N,N,N,31560,63278,31556,N,N, -N,N,N,31562,N,N,N,N,N,63279,N,N,63280,N,N,63281,N,N,63282,N,31563,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,31564,63284,N,N,63285,N,N,N,63287,12136,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,63289,N,N,63290,31565,N,N,N,31566,N,N,N,N,N,N,31568,N,N,N,N,N,N,N, -N,N,31570,N,N,63291,N,N,N,N,N,31571,N,63292,N,N,63293,N,N,N,N,N,N,N,N,N,N,N,N, -63294,N,63295,N,N,N,63296,N,N,N,63297,N,N,N,N,N,N,31572,N,N,N,63298,63299,N,N, -N,N,N,N,N,N,N,N,63300,N,N,N,N,N,N,N,N,63302,N,63303,N,N,N,N,31573,N,N,N,N,N,N, -N,N,63304,N,63305,N,N,N,N,N,N,N,N,N,N,N,N,N,63306,N,N,N,63307,N,63308,N,N,N,N, -N,N,N,N,N,N,N,63309,N,N,63310,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31574,N, -31575,31576,63312,N,63313,N,N,N,31577,N,N,63314,N,63315,N,N,63316,N,N,N,N,N, -63317,N,N,N,N,N,63318,N,63319,N,63320,N,N,N,N,N,N,N,N,N,N,N,N,N,63321,N,N,N,N, -N,N,N,N,63322,N,N,N,63323,N,63324,N,N,63325,N,N,N,N,N,N,N,N,N,N,N,N,N,63326,N, -N,N,N,N,N,63327,N,N,N,N,N,N,N,N,N,N,N,63328,63329,N,N,N,N,N,N,N,N,N,N,N,31578, -63330,N,N,N,N,N,N,N,N,N,63331,N,N,N,N,N,N,N,N,N,N,31579,31580,63335,N,63336,N, -N,N,N,N,N,N,63337,N,N,N,N,N,N,N,N,N,N,N,N,63338,N,N,N,N,N,N,63334,N,N,N,N, -31581,31582,N,N,N,N,N,N,N,31583,N,N,N,N,N,N,N,N,63341,N,N,63343,N,N,N,N,N,N,N, -N,N,N,N,N,63344,N,N,N,N,N,N,N,31585,N,N,N,N,N,N,N,N,63346,N,N,N,63348,N,63349, -63350,N,N,N,63351,63352,31586,63353,N,N,N,N,N,N,N,63345,63354,N,63355,N,N, -31587,N,N,N,31588,63356,N,N,N,N,31589,N,N,63357,31590,N,N,N,N,N,N,N,N,N,N, -31591,N,N,N,N,N,N,N,N,63358,N,N,N,N,N,63521,N,N,N,63522,N,N,N,N,N,N,N,N,N, -63523,N,N,N,N,N,N,N,N,N,N,N,N,N,63525,N,N,N,N,N,N,N,N,N,N,N,N,N,63526,N,N,N,N, -N,N,63527,N,N,N,N,63528,N,N,N,N,63531,N,N,N,N,N,63533,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31592,N,N,N,N,N,N,N, -63534,N,N,N,N,N,N,N,N,N,31593,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63535,63536, -63537,N,63538,N,N,N,N,N,N,N,N,N,31594,N,N,N,31595,N,N,63541,63539,63542,N,N,N, -N,N,N,N,63543,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63544,63545,N,N,N,31597, -63547,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31600,31601,31602,N,31598,N, -N,N,N,N,N,N,N,N,N,31603,N,N,N,N,N,N,N,N,31604,N,31605,N,N,N,N,63549,N,31606,N, -N,N,N,N,N,31607,N,63551,N,N,63552,N,N,N,63553,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,63556,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,63557,N,N,N,N,N,N,N,N,63558,N,N,N,N,N,N,63559,N,N,N,31608,N,N,N,N,N,N,N,N,N, -N,63560,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63561,N,N,N,N,N,N,63562,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31610,N,63563,N,63564,N,N,N,N,N,N,N, -N,N,N,N,N,31611,N,N,N,N,N,63565,N,N,N,N,N,63567,N,63568,N,N,31612,N,N,N,N,N,N, -63569,N,63570,63572,31613,N,63573,31614,N,N,N,N,N,N,N,N,N,N,N,63575,31777,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63576,N,31778,N,N,N,N,N,N,63577,N,N,N,N,N,N, -63578,N,31779,N,N,N,N,N,63579,31780,N,N,N,N,N,N,N,N,N,63580,N,N,N,N,31781,N,N, -N,31782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31783,N,N,N,31784,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63582,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,31785,N,N,N,N,N,N,63581,N,N,N,N,N,N,N,N,63583,N,N,N,N,N,N,63584,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,31786,N,N,N,N,N,N,63585,N,N,N,N,N,N,N,31787,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,31788,N,31789,N,N,N,N,N,63586,63589,N,N,N,N,63588, -N,N,63590,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63591,N,N,63592,N,N,N,N,N,N,N,N,N,N,N,N, -N,63593,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63594,N,N,31793,N,N,N,N,N,N, -N,N,N,N,63596,N,N,31794,N,N,N,N,31795,N,N,N,N,63597,N,N,N,N,N,N,N,N,N,N,31796, -N,N,N,N,N,N,N,N,N,N,N,N,63598,N,N,N,N,N,N,N,N,63599,N,63600,N,N,N,N,N,N,N,N,N, -63601,N,N,N,N,N,N,N,N,63602,63603,N,N,N,N,N,N,63604,31797,63605,63606,N,N,N, -63608,N,N,N,N,N,N,N,63611,N,63612,N,31798,N,N,N,N,N,63613,N,N,N,N,63614,N,N, -63777,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31799,63778,N,N,N,63779,N,N,N,N,N,63780, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63783,63782,N,N,N, -N,N,63784,N,63786,N,N,N,N,N,N,N,N,63787,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63789,63788,N,N, -63790,N,N,N,N,N,N,N,31801,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63792,63793,N,N,31802,N, -N,N,31803,N,N,N,N,N,31804,63795,N,N,N,N,63796,N,N,N,31806,N,N,N,N,N,N,N,N, -31807,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,63797,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63798,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,63799,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63800,N,N,N,N,N,N, -N,N,31808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63802,N,63803,N,N,N,N,N, -31809,N,N,31810,N,N,N,N,N,31811,N,63804,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -63805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63808,63809,N,N,N,N,N,63806,N,N,N,N,N,N, -N,63811,N,63812,N,N,N,N,N,N,N,N,N,31812,63813,63814,31813,N,N,N,63815,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,63818,N,N,63819,N,N,N,31814,N,N,N,N,N,N,N,N,N,N,N,N,N, -63820,N,N,N,N,N,N,N,N,63821,N,N,N,N,N,N,N,N,N,N,N,N,N,63822,N,N,N,N,N,N,N,N,N, -63823,63824,N,63825,31815,N,N,N,N,N,N,N,N,N,N,31816,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63826,N,N,N,N,N,63827,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,63828,N,N,N,N,63829,N,63830,63831,N,N,N,N,63832,N,N,N,N,31818,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,63834,N,N,63835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63837,31820,63839,N,N,N,N,N,N,N,63840,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,63841,N,N,N,N,N,N,31821,N,N,N,N,N,N,N,N,N,N,N,N,63842,N, -31822,N,N,N,N,N,N,N,N,31823,N,N,N,N,N,N,N,N,N,63843,N,N,N,N,N,N,N,N,N,63844,N, -N,N,N,N,N,N,N,N,31824,N,N,N,63845,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,63847,N,31826,N,N,N,N,N,N,N,N,N,N,N,N,N,63848, -31827,63850,N,N,N,N,N,N,N,N,N,N,63852,N,N,N,N,63853,N,N,N,63855,N,N,63856,N,N, -N,N,N,63857,N,63858,N,N,N,N,N,N,N,N,N,N,63859,N,N,N,31828,N,N,N,31829,N,N,N,N, -N,31830,N,N,63860,N,N,N,63861,N,N,N,N,N,63862,63863,N,N,N,N,N,31831,N,N,N, -63864,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31832,N, -N,N,N,N,N,N,N,N,63865,N,N,N,N,N,N,N,N,N,N,N,63867,63868,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,63869,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64034,N,N,31834,N,N,N,64035,N,N,N,64036,N,N,N, -N,31835,N,31836,N,31837,N,31838,N,N,N,N,N,64038,31839,N,N,N,N,N,N,N,N,N,N,N,N, -N,64040,N,N,31840,N,N,64041,N,N,N,N,N,N,N,31841,N,N,N,N,64042,31842,31843,N, -31844,64043,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31845,N,N,N,N,64045,31846,31847,64046, -N,N,N,N,N,N,N,N,N,N,N,64051,N,N,N,31848,N,N,64049,N,31849,N,64048,N,N,N,N,N,N, -N,64052,64053,64050,N,N,N,64054,N,64055,N,N,N,N,N,N,N,N,N,N,N,N,N,31851,31852, -31853,N,64056,N,N,N,64057,N,64058,N,N,N,31854,31855,N,N,N,31856,N,N,N,N,N,N,N, -31857,N,31858,N,N,31859,N,N,64059,N,64060,64061,N,N,31860,N,N,N,N,N,N,N,N, -64062,64063,31861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64064,N,64065,N,31862,N,N,N,N,N, -64066,N,N,64067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64068,N,N,N,N,64069,N,N,N,N,N,N, -N,N,N,31863,N,64070,N,N,N,N,N,N,N,N,64071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31864, -N,N,N,N,N,N,N,N,N,64072,N,N,N,31865,N,64073,N,N,31866,N,64074,N,N,64075,N,N,N, -N,N,31867,N,N,N,N,N,N,64076,64077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31868,N, -N,64078,N,N,N,N,N,N,N,N,N,31870,32033,N,N,N,N,N,N,64081,32034,64082,N,N,32035, -N,N,N,N,N,N,N,N,N,31869,64083,N,N,N,N,N,32036,N,N,64084,N,N,N,N,N,32037,N,N,N, -N,N,64085,64086,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64088,N, -N,N,N,32038,32039,32040,N,32041,N,N,N,32042,N,64089,32043,N,N,N,64090,N,N, -64091,N,N,N,64092,32044,N,64093,N,N,N,N,64094,N,N,64095,N,N,N,N,N,N,64096, -64097,N,N,N,64098,N,64099,64100,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32045,N,N,N, -64103,64104,N,64105,N,N,N,N,N,N,N,N,32046,64106,N,N,N,64107,N,N,N,N,N,N,N,N,N, -64108,N,64109,N,N,N,N,N,64110,N,N,N,N,N,N,N,64111,N,N,N,64112,N,N,N,N,N,N, -64115,N,N,N,N,N,N,N,N,N,N,N,N,64116,64117,N,32047,N,N,N,64118,N,N,N,N,32048, -32049,N,64119,N,64120,N,N,32050,N,N,N,64121,N,64122,N,N,N,N,N,N,32051,N,N,N,N, -64123,N,64124,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64290,N,64291,N,64292,N,N,N,32052, -64293,N,32053,N,N,N,N,N,N,N,N,64294,N,N,N,64125,N,N,N,64295,N,N,N,N,N,N,N, -64296,64297,32054,N,32055,N,N,N,32056,N,64298,N,64299,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64302,32057,32058,32059,N,N,N,N,N,N,64303,N, -N,N,N,N,64304,N,N,64305,N,N,N,N,N,N,N,N,N,32060,32061,N,N,N,N,32062,64306,N,N, -N,N,32063,64307,N,64308,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64312,N,N, -64313,N,N,N,64314,N,N,N,N,N,N,N,N,N,N,N,32064,N,N,64315,N,N,64309,N,32065,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32066,N,N,N,N,N,N,64320,N,N,N,N,32067, -64321,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64322,N,32068,32069,N,N,64323,N, -N,N,N,64324,N,N,N,N,N,N,N,N,N,64319,N,N,N,64316,N,N,N,N,N,64329,N,32071,32070, -N,N,N,N,64325,N,N,N,N,N,64326,N,N,N,N,N,N,64327,64328,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,64330,32072,64331,N,N,N,N,N,N,64332,N,N,N,N,N,N,N, -N,N,64333,N,N,N,N,32073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32074, -N,N,N,N,N,N,N,32075,N,64336,N,64337,N,32076,32077,64338,64339,N,N,N,N,N,N,N,N, -N,N,N,N,64340,N,N,N,N,N,64341,64342,32078,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -32079,N,N,N,N,N,N,32080,N,N,32081,N,64344,32082,N,N,N,N,N,N,N,64345,N,32083,N, -N,N,N,N,N,32084,N,N,N,N,N,N,N,N,N,N,64347,N,N,32085,N,N,N,N,32086,N,N,32087,N, -N,N,N,N,N,32089,N,N,N,32090,64037,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64350,N,N,N,N,N, -N,64351,64352,N,N,N,N,N,N,N,64354,N,N,N,N,64355,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,32091,N,N,N,N,N,N,N,N,64356,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,64358,N,32092,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,64360,N,N,32094,N,N,N,N,N,N,32095,32096,N,N,N,64363,N,N,N,N,N,64364,N,N, -N,64365,N,N,N,N,N,N,64366,N,N,64367,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -32097,N,N,N,N,N,64370,N,64371,N,N,64372,32098,N,N,N,N,N,N,N,N,N,N,32100,N,N,N, -N,N,32101,64374,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64375,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,32102,N,N,64377,N,N,N,N,32103,N,N,N,N,N,64378,N,N,N,N,N,64379,N,N,N,N,N, -32104,32105,32106,N,N,N,N,N,64380,N,64381,N,N,32107,64382,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,64545,N,N,N,32108,N,N,N,N,32109,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,32110,64548,N,N,N,64549,N,N,N,64550,N,N,N,64551,N, -N,N,N,N,N,N,N,N,N,N,32111,N,N,64552,64553,N,N,N,N,N,N,N,32112,N,N,N,64554,N,N, -32113,N,N,N,N,N,N,N,32114,N,N,64555,N,N,N,N,64556,N,N,64557,N,N,N,64558,64559, -N,32116,N,N,32115,N,N,64560,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64561,N,N,32117, -64562,N,N,N,N,N,32119,N,N,64563,64564,N,N,N,N,N,64565,N,64566,N,N,N,N,N,N,N, -32120,N,N,N,N,64569,N,64572,N,N,N,N,N,32121,N,N,N,N,32122,N,64570,64571,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64573,N,N,N,N,N,N,N,N,N,N,32124,32125,N,N, -32126,32289,N,32290,32291,N,N,N,N,N,N,N,N,N,N,32293,64574,N,N,N,N,N,32294,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64575,N,64576,N,N,64577,N,N,N,N,N,N, -64579,64580,N,32295,64581,64582,N,N,64583,N,N,64584,N,N,N,N,64585,32296,N,N, -64586,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64587,64589,N,64590,N,64591,N, -32297,N,N,64592,N,N,N,N,N,64593,64594,N,64595,64596,N,N,N,N,N,N,N,N,N,N,N,N,N, -64599,64600,N,N,64602,64603,64604,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64606,64607,64608,N,N,N,N,N,N,64609,64610,64611,N,N,N,64612,64613,N,N,N,N, -64614,N,N,N,N,N,N,64615,64616,N,N,N,N,N,N,N,N,N,32298,N,N,N,64617,N,N,64618, -64619,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32299,N,N,N,N,64620,N,N, -64621,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64622,N,N,N,64623,N,64624,N,N,N, -64625,N,N,N,N,N,64626,N,N,N,N,N,N,N,N,N,N,64627,N,N,N,N,64628,N,N,N,N,64629,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64631,N,N,N,N,N,N,N,N,64632,N,N,64633,32300, -32301,N,N,N,N,N,N,64634,N,N,N,N,N,N,64635,N,N,N,N,64636,N,N,N,64637,N,N,N,N,N, -64638,N,N,N,32302,N,N,N,N,N,N,N,N,32303,32304,N,N,64801,N,N,N,N,64802,N,32305, -N,N,N,N,N,N,N,N,N,N,N,64803,N,N,N,N,N,32306,N,64804,N,32307,N,N,N,32308,N,N,N, -N,N,64805,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,64807,N,N,N,N,N,N,32309,64809,N,64811,N,N,N,N,N,N,N, -32310,N,32311,N,N,64813,N,N,N,N,N,N,N,32312,N,64814,N,64815,N,N,64816,32313,N, -N,N,N,N,64818,N,N,N,64819,N,N,N,N,64820,N,N,N,64821,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,32314,32315,64822,N,N,N,N,32316,N,N,N,64823,N,N,N,64824,N,64825,N,N,N, -64826,N,N,N,N,N,64827,N,N,N,32317,N,N,N,N,N,N,N,N,N,N,64828,N,32319,N,N,N,N,N, -64829,N,N,N,N,N,N,N,N,N,64830,N,N,N,N,N,N,N,N,N,N,N,N,N,64832,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,32320,N,N,N,N,64833,N,64834,32322,N,N,N,N,64835,64836,N,N, -N,N,N,32323,64837,N,32324,64838,64839,N,32321,N,N,N,N,N,N,N,N,N,N,32325,N,N,N, -N,N,32326,N,N,N,N,32327,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32328,N,N,N,N,N,N,N,64840, -32329,N,N,N,N,64841,N,N,N,N,64842,64845,N,N,N,N,N,64846,N,N,N,N,N,64847,N,N, -32330,N,N,N,N,N,64848,N,N,N,N,N,N,32331,N,N,N,N,N,N,N,N,N,64850,N,N,N,N,64851, -N,N,N,N,N,N,N,32332,N,64852,N,N,64853,64854,N,N,64856,64855,N,N,N,64849,N,N,N, -64860,32333,N,64858,N,N,32334,32335,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64862,N,64863,64864,64865,N,N,64866,N,N,N,N,64867,32336,N,N,N,64868,N,64869, -64870,N,N,N,N,N,N,64872,N,N,N,N,64873,64874,N,N,N,N,N,N,N,N,N,32337,N,N,N, -64875,N,N,N,64878,64879,N,N,N,N,32338,32339,N,N,32340,64881,N,N,N,64882,N,N, -64883,64876,64884,N,64885,N,N,N,32341,N,32342,N,N,N,64886,64887,64888,N,64889, -64890,N,64891,N,64892,N,N,64893,N,32343,N,N,64894,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65057,N,N,N,N,N,N,N,N,N,N,N,65058,65060,N,N,N,N, -N,N,N,N,65059,N,N,N,N,N,65062,N,N,N,N,N,65063,65064,N,N,N,N,32344,32345,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65068,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65070, -32346,N,N,N,32347,N,N,65071,N,N,N,N,N,N,N,32348,N,N,N,N,N,N,N,N,N,N,N,N,65072, -N,N,65073,32349,N,N,N,N,N,65075,N,65076,N,N,N,N,32350,N,N,65078,N,N,65079, -65080,N,N,N,N,32351,N,65081,N,N,N,N,N,65082,N,N,N,N,N,32352,N,N,65083,N,N,N,N, -N,N,N,N,32353,N,N,65084,N,N,N,N,N,N,N,65085,N,N,N,N,N,N,N,N,N,N,32355,N,N,N,N, -N,N,N,N,65087,N,N,N,65088,N,N,32356,65089,N,65086,32354,N,N,65090,N,N,N,65091, -N,65092,N,N,N,N,N,N,N,N,N,N,N,N,65093,32357,N,N,65094,N,N,N,N,65095,65096,N,N, -65097,N,N,N,32359,N,N,N,N,N,N,N,N,N,N,N,N,65098,65101,N,N,N,N,32360,N,N,65100, -N,N,65102,N,N,N,N,N,N,N,32361,N,N,N,65103,N,N,65104,65105,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,65106,32362,N,N,N,65108,N,N,N,N,65109,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,65110,N,N,32363,N,N,N,N,N,32364,N,N,N,65111,N,N,N,32365,N,N,32366, -N,N,N,N,32367,32368,N,N,N,N,N,N,N,65113,N,N,N,N,N,32369,N,N,N,N,N,N,N,N,N,N,N, -N,N,32370,N,N,N,N,N,N,N,N,N,N,N,N,N,65115,N,N,N,N,N,N,N,65116,N,N,N,N,N,N, -65117,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65118,65119,65121,N,N,N,N,N,N,N,N,N,N,N, -N,32371,N,N,N,N,N,N,65122,N,65123,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -65124,N,N,N,N,N,N,N,65125,N,32372,65126,N,N,65127,N,N,N,65128,N,N,N,65129, -65130,N,N,N,N,N,N,N,N,N,N,N,N,65131,N,65132,N,32373,65133,N,N,N,N,65135,N,N,N, -N,N,N,N,N,N,N,N,65137,N,N,N,65139,N,N,65140,N,N,N,N,65141,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32374,N,N,N,32375,N,N,32376,N,N,N,N,N,N,N,N,N, -N,32377,30267,N,N,N,N,N,N,N,N,N,N,29742,30030,N,N,N,N,N,N,N,N,N,N,N,N,31567,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30281,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -32292,N,N,N,N,N,N,N,N,N,N,N,32093,12107,12119,20338,N,44665,30074,30554,30575, -N,N,31036,31037,31041,N,N,N,31546,63288,63301,31790,N,63854,N,31850,N,N,N,N,N, -N,N,N,N,11832,11849,11856,11875,11880,11886,12076,12079,12086,12122,12126, -20321,20322,29776,29788,29790,29793,29992,29995,30019,30053,30313,30327,30501, -30549,61481,30757,31015,31027,31028,31031,31032,31033,31035,31039,31040,31053, -31057,31076,31278,62544,31283,31290,31300,31320,62836,62837,31527,31599,31609, -31791,31792,31800,31805,63849,31833,32099,32118,32123,9022,9021,8752,N,N,N,N, -8751,N,N,N,N,N,8753, -}; - -static const struct unim_index jisx0213_bmp_encmap[256] = { -{__jisx0213_bmp_encmap+0,126,255},{__jisx0213_bmp_encmap+130,0,253},{ -__jisx0213_bmp_encmap+384,80,233},{__jisx0213_bmp_encmap+538,0,194},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_bmp_encmap+733,62,63 -},{__jisx0213_bmp_encmap+735,112,115},{__jisx0213_bmp_encmap+739,19,172},{ -__jisx0213_bmp_encmap+893,15,233},{__jisx0213_bmp_encmap+1112,5,219},{ -__jisx0213_bmp_encmap+1327,5,206},{__jisx0213_bmp_encmap+1529,35,254},{ -__jisx0213_bmp_encmap+1749,177,230},{__jisx0213_bmp_encmap+1803,0,110},{ -__jisx0213_bmp_encmap+1914,19,127},{0,0,0},{__jisx0213_bmp_encmap+2023,52,251 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_bmp_encmap+2223, -22,255},{__jisx0213_bmp_encmap+2457,240,255},{__jisx0213_bmp_encmap+2473,49, -250},{__jisx0213_bmp_encmap+2675,3,205},{__jisx0213_bmp_encmap+2878,2,219},{ -__jisx0213_bmp_encmap+3096,31,244},{__jisx0213_bmp_encmap+3310,5,207},{ -__jisx0213_bmp_encmap+3513,97,253},{__jisx0213_bmp_encmap+3670,0,250},{ -__jisx0213_bmp_encmap+3921,23,111},{__jisx0213_bmp_encmap+4010,110,234},{ -__jisx0213_bmp_encmap+4135,14,240},{__jisx0213_bmp_encmap+4362,15,210},{ -__jisx0213_bmp_encmap+4558,17,212},{__jisx0213_bmp_encmap+4754,5,148},{ -__jisx0213_bmp_encmap+4898,87,215},{__jisx0213_bmp_encmap+5027,57,147},{ -__jisx0213_bmp_encmap+5118,5,243},{__jisx0213_bmp_encmap+5357,7,221},{ -__jisx0213_bmp_encmap+5572,2,240},{__jisx0213_bmp_encmap+5811,8,212},{ -__jisx0213_bmp_encmap+6016,8,234},{__jisx0213_bmp_encmap+6243,15,175},{ -__jisx0213_bmp_encmap+6404,12,253},{__jisx0213_bmp_encmap+6646,22,181},{ -__jisx0213_bmp_encmap+6806,176,250},{__jisx0213_bmp_encmap+6881,4,188},{ -__jisx0213_bmp_encmap+7066,59,232},{__jisx0213_bmp_encmap+7240,23,209},{ -__jisx0213_bmp_encmap+7427,7,119},{__jisx0213_bmp_encmap+7540,2,255},{ -__jisx0213_bmp_encmap+7794,0,242},{__jisx0213_bmp_encmap+8037,0,243},{ -__jisx0213_bmp_encmap+8281,3,244},{__jisx0213_bmp_encmap+8523,1,251},{ -__jisx0213_bmp_encmap+8774,0,245},{__jisx0213_bmp_encmap+9020,18,255},{ -__jisx0213_bmp_encmap+9258,0,233},{__jisx0213_bmp_encmap+9492,7,247},{ -__jisx0213_bmp_encmap+9733,10,255},{__jisx0213_bmp_encmap+9979,4,244},{ -__jisx0213_bmp_encmap+10220,5,248},{__jisx0213_bmp_encmap+10464,12,245},{ -__jisx0213_bmp_encmap+10698,0,253},{__jisx0213_bmp_encmap+10952,3,244},{ -__jisx0213_bmp_encmap+11194,6,233},{__jisx0213_bmp_encmap+11422,0,253},{ -__jisx0213_bmp_encmap+11676,0,252},{__jisx0213_bmp_encmap+11929,13,248},{ -__jisx0213_bmp_encmap+12165,16,245},{__jisx0213_bmp_encmap+12395,21,253},{ -__jisx0213_bmp_encmap+12628,3,247},{__jisx0213_bmp_encmap+12873,9,255},{ -__jisx0213_bmp_encmap+13120,4,252},{__jisx0213_bmp_encmap+13369,0,251},{ -__jisx0213_bmp_encmap+13621,1,252},{__jisx0213_bmp_encmap+13873,1,252},{ -__jisx0213_bmp_encmap+14125,3,254},{__jisx0213_bmp_encmap+14377,15,253},{ -__jisx0213_bmp_encmap+14616,11,255},{__jisx0213_bmp_encmap+14861,2,251},{ -__jisx0213_bmp_encmap+15111,0,252},{__jisx0213_bmp_encmap+15364,23,251},{ -__jisx0213_bmp_encmap+15593,10,252},{__jisx0213_bmp_encmap+15836,0,236},{ -__jisx0213_bmp_encmap+16073,3,254},{__jisx0213_bmp_encmap+16325,0,251},{ -__jisx0213_bmp_encmap+16577,7,250},{__jisx0213_bmp_encmap+16821,1,255},{ -__jisx0213_bmp_encmap+17076,1,249},{__jisx0213_bmp_encmap+17325,0,252},{ -__jisx0213_bmp_encmap+17578,10,251},{__jisx0213_bmp_encmap+17820,5,254},{ -__jisx0213_bmp_encmap+18070,0,237},{__jisx0213_bmp_encmap+18308,3,253},{ -__jisx0213_bmp_encmap+18559,7,240},{__jisx0213_bmp_encmap+18793,1,245},{ -__jisx0213_bmp_encmap+19038,3,249},{__jisx0213_bmp_encmap+19285,8,154},{ -__jisx0213_bmp_encmap+19432,59,250},{__jisx0213_bmp_encmap+19624,2,251},{ -__jisx0213_bmp_encmap+19874,13,255},{__jisx0213_bmp_encmap+20117,4,254},{ -__jisx0213_bmp_encmap+20368,0,249},{__jisx0213_bmp_encmap+20618,1,253},{ -__jisx0213_bmp_encmap+20871,12,255},{__jisx0213_bmp_encmap+21115,0,253},{ -__jisx0213_bmp_encmap+21369,5,245},{__jisx0213_bmp_encmap+21610,1,245},{ -__jisx0213_bmp_encmap+21855,1,255},{__jisx0213_bmp_encmap+22110,17,252},{ -__jisx0213_bmp_encmap+22346,5,158},{__jisx0213_bmp_encmap+22500,57,254},{ -__jisx0213_bmp_encmap+22698,9,253},{__jisx0213_bmp_encmap+22943,6,250},{ -__jisx0213_bmp_encmap+23188,0,251},{__jisx0213_bmp_encmap+23440,2,255},{ -__jisx0213_bmp_encmap+23694,0,251},{__jisx0213_bmp_encmap+23946,1,255},{ -__jisx0213_bmp_encmap+24201,2,253},{__jisx0213_bmp_encmap+24453,4,114},{ -__jisx0213_bmp_encmap+24564,120,222},{__jisx0213_bmp_encmap+24667,29,239},{ -__jisx0213_bmp_encmap+24878,20,244},{__jisx0213_bmp_encmap+25103,4,243},{ -__jisx0213_bmp_encmap+25343,8,252},{__jisx0213_bmp_encmap+25588,2,249},{ -__jisx0213_bmp_encmap+25836,2,253},{__jisx0213_bmp_encmap+26088,0,242},{ -__jisx0213_bmp_encmap+26331,2,244},{__jisx0213_bmp_encmap+26574,2,255},{ -__jisx0213_bmp_encmap+26828,2,162},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_bmp_encmap+26989 -,29,220},{__jisx0213_bmp_encmap+27181,15,106},{0,0,0},{0,0,0},{0,0,0},{ -__jisx0213_bmp_encmap+27273,69,70},{__jisx0213_bmp_encmap+27275,2,13}, -}; - -static const ucs2_t __jisx0213_1_emp_decmap[340] = { -11,4669,U,U,U,U,U,U,U,U,U,4891,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,5230,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,6333,2975,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,5812,U,U,U,U,U,U,U,U,U,U,7732,12740,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -13764,14143,U,U,U,U,U,U,U,U,14179,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15614,18417,21646,21774,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22385,U,U,U,U,U,U,U,U,U,U,U, -U,22980,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23969,27391,28224,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28916,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30340,33399,U,U,U,U,U,U,U,33741,41360, -}; - -static const struct dbcs_index jisx0213_1_emp_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__jisx0213_1_emp_decmap+0,34,34},{__jisx0213_1_emp_decmap+1,66,123},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{__jisx0213_1_emp_decmap+59,84,110},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_1_emp_decmap+86,58,114},{ -__jisx0213_1_emp_decmap+143,41,96},{__jisx0213_1_emp_decmap+199,108,108},{ -__jisx0213_1_emp_decmap+200,126,126},{__jisx0213_1_emp_decmap+201,41,110},{ -__jisx0213_1_emp_decmap+271,93,93},{__jisx0213_1_emp_decmap+272,51,108},{ -__jisx0213_1_emp_decmap+330,73,81},{0,0,0},{__jisx0213_1_emp_decmap+339,102, -102},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const ucs2_t __jisx0213_2_emp_decmap[2053] = { -137,U,U,U,U,U,U,U,U,U,162,U,U,164,U,U,U,U,U,U,U,418,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,531,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,811,U,U,U,U,U,U,897,U,881,1017,U,U,1098,U,1289,U,U,U,U,U,U,U,U,U, -1494,1576,U,U,U,U,U,1871,U,U,U,U,U,U,2055,U,2106,U,U,U,U,U,U,U,U,2233,U,U,U,U, -U,U,U,2428,2461,U,U,U,U,U,2771,U,U,2845,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,3397,3553,U,U,U,U,U,U,3733,3693,U,U,U,U,U,U,U,3684,U,U,3935,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,4609,U,U,4693,U,4731,U,U,U, -U,4724,U,U,U,U,U,U,4836,4823,U,U,U,U,U,U,4861,U,4918,4932,5060,U,U,U,U,U,U,U, -U,U,U,U,U,5229,U,U,U,U,U,U,U,U,U,U,U,5591,U,U,U,U,U,27689,U,U,5703,U,U,U,U,U, -U,U,U,U,U,U,U,U,5894,5954,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,6595,7254,U,U,U,U,U,U,7469,7493,U,7544,7522,U,U,U, -7585,7580,U,U,U,U,7570,U,U,7607,U,7648,7731,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -7966,U,U,U,U,U,U,U,U,U,U,8054,U,U,U,U,U,8186,8571,U,U,U,U,U,U,U,U,8990,U,U,U, -U,9133,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,9971,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,10331,U,U,U,U,U,U,U,10411,U,U,U,U,10639, -10936,U,U,U,U,11087,11088,U,U,U,U,U,U,U,11078,U,11293,11174,U,U,U,11300,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,11745,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12739,12789,12726,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13170,U,13267,13266,U,U,U,U,13264,13284, -13269,U,U,13274,U,13279,U,U,U,U,U,U,U,U,U,U,U,13386,13393,13387,U,U,U,13413,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13540,13658,13716,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,13881,13895,U,13880,13882,U,U,U,U,U,U,U,U,U,U, -14108,U,U,U,U,U,U,U,U,U,U,14092,U,U,U,U,U,U,U,14180,U,U,U,U,U,U,U,14335,14311, -U,U,U,U,U,14372,U,U,U,U,14397,15000,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15487,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,15616,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -15680,U,15866,15865,15827,16254,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,16534, -U,U,U,U,U,16643,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,16838,U,U,16894,17340,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,17961,U,U,U,U,U,18085,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,18582,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,19021,19286,U,19311,U,U,U,U,19478,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,19732,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,19982,U,U, -U,20023,U,U,U,U,20074,U,U,20107,U,U,U,U,U,U,U,U,U,U,U,20554,U,20565,U,U,20770, -20905,U,20965,20941,U,U,U,21022,U,U,U,21068,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -21550,U,U,U,U,U,U,U,U,U,U,21721,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,21927,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22441,22452,22996,U,U,U,U,U,U,U, -U,U,U,23268,23267,U,23281,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23474,U,U,U,U,U,U, -U,U,U,U,23627,23652,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24110,24150,24165, -U,24162,U,U,U,24280,U,24258,24296,U,24355,U,U,24412,U,U,U,U,U,U,24544,24532,U, -U,U,U,24588,24571,U,U,U,U,U,U,U,24599,U,U,U,U,24672,U,U,U,U,U,U,U,U,U,U,U,U, -24813,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25200,U,25222,U,U,U,U, -U,U,25420,U,U,15630,U,U,U,25602,26238,U,U,U,U,26288,U,U,U,U,U,U,U,U,U,U,U, -26397,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,26845,U,26858,U,26961,U,U,26991,U,27101,U, -U,U,27166,U,U,U,U,U,U,27224,U,U,U,U,U,27276,U,U,27319,27763,U,U,U,U,U,U,U,U,U, -27869,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28261,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,28564,U,U,U,U,U,U,U,U,28664,28662,28663,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,28941,U,U,28985,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29659,29658,U,U,U,U,U,29694,U,U,29712,U,U,U,U, -29769,30229,30228,U,30257,U,U,U,U,U,U,U,30355,U,U,U,U,U,U,U,30478,U,30499,U,U, -U,30546,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31109,U,U,U,U,U,U,U,U,U,U,U,U, -31364,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31667,U,31678,31687,31928,U,U,U,U, -U,U,U,U,U,32160,U,U,32272,U,U,U,U,U,U,32695,U,U,U,U,U,U,U,U,32906,U,U,U,U,U, -32955,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33410,U,U,U,U,33523,U,U,U,U,U,U,U,33804, -U,U,U,U,33877,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34155,U,U,U,34248,34249,U,U,U,U,U,U, -U,U,U,U,34519,U,U,34554,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,35145,35142,U,U,U,U,U,U,35179,U,U,U,U,U,U,U,U,U,U,U,U,U,35207,35208,U, -U,U,U,U,U,U,U,U,U,35258,35259,U,U,U,U,U,U,U,U,U,U,U,35358,35369,U,U,U,U,U,U,U, -U,U,U,35441,35395,U,U,U,U,U,U,U,U,35481,35533,U,U,U,U,U,35556,35549,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,35777,35823,U,U,U,U,U,U,U,36112,U,U,36209,U,36347,36383,U, -U,U,36406,U,U,U,36489,U,36587,U,36658,U,U,U,U,U,U,U,36856,37536,37553,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38032,U,U,U,U,U,U,U,U,U,38351,U,U,U,U,U,U,U,U, -U,38527,U,U,U,U,U,U,U,U,U,38640,U,U,38681,U,U,U,38736,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,39110,39538,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,40411,40509,U,U,U,U,U,U,U,U,U,U,U,U,40469,U,40586,U,40521,U, -U,U,U,U,U,U,U,U,40644,U,U,U,U,U,40681,U,U,40667,40910,U,U,U,41007,U,40986,U,U, -U,U,U,U,41209,U,U,41090,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,8728,U,U,U,U,41868,U,42039,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,42481,U, -42498,U,42522,U,U,U,42674, -}; - -static const struct dbcs_index jisx0213_2_emp_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_emp_decmap+0,33,121},{0,0,0},{ -__jisx0213_2_emp_decmap+89,34,119},{__jisx0213_2_emp_decmap+175,42,117},{ -__jisx0213_2_emp_decmap+251,37,126},{0,0,0},{0,0,0},{__jisx0213_2_emp_decmap+ -341,48,108},{0,0,0},{0,0,0},{0,0,0},{__jisx0213_2_emp_decmap+402,34,114},{ -__jisx0213_2_emp_decmap+483,36,125},{__jisx0213_2_emp_decmap+573,35,120},{ -__jisx0213_2_emp_decmap+659,42,117},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -__jisx0213_2_emp_decmap+735,35,96},{__jisx0213_2_emp_decmap+797,50,100},{ -__jisx0213_2_emp_decmap+848,34,123},{__jisx0213_2_emp_decmap+938,46,122},{ -__jisx0213_2_emp_decmap+1015,33,118},{__jisx0213_2_emp_decmap+1101,50,125},{ -__jisx0213_2_emp_decmap+1177,34,121},{__jisx0213_2_emp_decmap+1265,53,115},{ -__jisx0213_2_emp_decmap+1328,68,126},{__jisx0213_2_emp_decmap+1387,33,115},{ -__jisx0213_2_emp_decmap+1470,41,122},{__jisx0213_2_emp_decmap+1552,37,126},{ -__jisx0213_2_emp_decmap+1642,33,126},{__jisx0213_2_emp_decmap+1736,33,113},{ -__jisx0213_2_emp_decmap+1817,34,118},{__jisx0213_2_emp_decmap+1902,44,112},{ -__jisx0213_2_emp_decmap+1971,37,118},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __jisx0213_emp_encmap[8787] = { -11810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,41249,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41259,N,41262,41270,41286,41328,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,41337,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41335,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41762,41765,41767, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,41777,41778,41784,41791,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41793,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,41802,41810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,41811,41817,41820,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20308,41847,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42026,42042,N,N,N, -N,N,N,N,N,42034,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,42033,42045,42073,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -12098,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42076,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42083,N,N,N,N,N,N,42078,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,42091,N,N,N,N,N,N,N,N,N,N,N,N,42090,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,42098,12108,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,42100,N,N,N,N,N,N,N,N,N,N,N,N,N,42101,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42277,42290, -12128,42302,42311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -20323,42325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,42326,12155,42366,43056, -43063,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43064,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43067,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,43066,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43077,N,N,N,N,N, -N,N,N,N,43072,N,N,N,N,43071,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43080,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -43082,43083,20334,43099,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43110,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -43116,44066,65107,44075,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -44080,44112,44133,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,44141,44146,44324,44338,N,N,N,N,N,N,N,N,44329,44330,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,44341,44340,N,N,N,N,N,N,44345,44374,44580,N,N,N,N,N,N,N,N,N,N,N,N, -44413,30010,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44579,44602,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44610, -N,44605,44604,N,44612,N,N,N,N,44615,N,N,N,N,44617,N,N,N,N,44611,44629,44631,N, -N,N,N,N,44630,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44635,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -44663,44664,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44842,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30066, -44866,44863,44867,N,N,N,N,N,N,N,N,N,N,N,N,44864,44889,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,44878,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,30249,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -30258,44897,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44906,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,44905,44912,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44917, -60963,60980,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30304,61001,N,N,N,N,N,N,N,N,N,N,N,N,N,62581,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,61020,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,61024,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,61023,61022,61234,61255,61261,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61281,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61284, -61474,61491,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,61497,30572,61523,61563,61742,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,61744,61749,61764,61789,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61793,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -61798,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61801, -61813,N,N,N,N,N,N,N,N,N,N,61815,61818,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61985, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61988,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61987,61992,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,61996, -62013,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30846,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62024,31017,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62043,31047,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,62069,N,N,N,N,N,N,N,N,N,N,62070,31060,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -62258,62270,62269,N,N,N,N,N,N,N,N,N,N,N,N,62272,62290,62301,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62302,31086,62323,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62324,N,N,N,N,N,N,N,N,N,N,N, -62327,N,N,62325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62333,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,62331,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62498,62500,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,62503,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,62511,N,N,N,N,N,N,N,N,N,N,N,62510,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62517,62516,N,N,N,N,N,N,N,N,N,N,62525,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62530,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62543,62569,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,62571,62578,62585,62773,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62778,62790,62806,N,N, -N,N,N,N,N,N,N,N,N,N,62808,62810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,62813,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,62815,62819,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,62826,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,62832,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,62835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,31325,42308,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,63044,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63054, -31539,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -63069,63093,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63265,63266,63102,31561, -63283,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,63286,63333,63332,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,63339,63342,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63347, -63530,63529,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63532,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,31596,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63540,63548,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,63550,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63554,63574,63587,63607,N,N,N,N,N,N,N,N,N,N, -63609,N,N,N,N,N,N,N,N,63610,63781,63791,63794,63801,63810,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -63816,31817,N,N,N,N,N,N,N,N,N,N,63833,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,63838,31825,63846,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,63851,63866,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -63870,64033,64044,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,64047,64080,N,N,64079,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64087,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64101,64102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64113,64114,64126,N,N,N,N,N,N,N,N,N,N,64289,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64301,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64300,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64310, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64311,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64318,N,N,N,N,N,N, -64317,64334,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,64335,64343,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64346, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64348,64349,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,64353,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64357,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64359,64361,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,64369,64546,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64547,64568,64578, -64588,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64598,64601,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64605,64630,64812,64843,64857,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64844, -N,N,N,N,N,N,N,N,N,N,N,64861,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -64859,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,64871,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,64880,N,N,N,N,N,N,N,N,N,N,N,N,N,64877,65061,65067,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,65065,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65077,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65074,32358,65112,65114,65134, -65136,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65138,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,65142, -}; - -static const struct unim_index jisx0213_emp_encmap[256] = { -{__jisx0213_emp_encmap+0,11,164},{__jisx0213_emp_encmap+154,162,162},{ -__jisx0213_emp_encmap+155,19,19},{__jisx0213_emp_encmap+156,43,249},{ -__jisx0213_emp_encmap+363,74,74},{__jisx0213_emp_encmap+364,9,214},{ -__jisx0213_emp_encmap+570,40,40},{__jisx0213_emp_encmap+571,79,79},{ -__jisx0213_emp_encmap+572,7,185},{__jisx0213_emp_encmap+751,124,157},{ -__jisx0213_emp_encmap+785,211,211},{__jisx0213_emp_encmap+786,29,159},{0,0,0}, -{__jisx0213_emp_encmap+917,69,225},{__jisx0213_emp_encmap+1074,100,149},{ -__jisx0213_emp_encmap+1124,95,95},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+1125, -1,253},{__jisx0213_emp_encmap+1378,27,196},{__jisx0213_emp_encmap+1548,109,110 -},{__jisx0213_emp_encmap+1550,215,215},{__jisx0213_emp_encmap+1551,71,180},{ -__jisx0213_emp_encmap+1661,6,66},{__jisx0213_emp_encmap+1722,189,189},{ -__jisx0213_emp_encmap+1723,195,195},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+ -1724,86,86},{__jisx0213_emp_encmap+1725,45,224},{__jisx0213_emp_encmap+1905, -51,52},{__jisx0213_emp_encmap+1907,30,250},{0,0,0},{__jisx0213_emp_encmap+2128 -,123,123},{__jisx0213_emp_encmap+2129,24,24},{__jisx0213_emp_encmap+2130,30, -173},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+2274,243,243},{0,0,0},{ -__jisx0213_emp_encmap+2275,91,171},{__jisx0213_emp_encmap+2356,143,143},{ -__jisx0213_emp_encmap+2357,184,184},{__jisx0213_emp_encmap+2358,70,166},{ -__jisx0213_emp_encmap+2455,29,36},{__jisx0213_emp_encmap+2463,225,225},{0,0,0 -},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+2464,182,245},{0,0,0},{ -__jisx0213_emp_encmap+2528,114,228},{__jisx0213_emp_encmap+2643,74,228},{ -__jisx0213_emp_encmap+2798,90,196},{__jisx0213_emp_encmap+2905,56,71},{ -__jisx0213_emp_encmap+2921,12,255},{__jisx0213_emp_encmap+3165,36,61},{0,0,0}, -{__jisx0213_emp_encmap+3191,152,152},{0,0,0},{__jisx0213_emp_encmap+3192,127, -254},{__jisx0213_emp_encmap+3320,0,250},{0,0,0},{__jisx0213_emp_encmap+3571, -126,126},{__jisx0213_emp_encmap+3572,150,150},{__jisx0213_emp_encmap+3573,3, -254},{0,0,0},{__jisx0213_emp_encmap+3825,188,188},{0,0,0},{0,0,0},{ -__jisx0213_emp_encmap+3826,41,165},{__jisx0213_emp_encmap+3951,241,241},{ -__jisx0213_emp_encmap+3952,150,150},{0,0,0},{__jisx0213_emp_encmap+3953,77,77 -},{__jisx0213_emp_encmap+3954,86,111},{__jisx0213_emp_encmap+3980,22,22},{ -__jisx0213_emp_encmap+3981,20,20},{__jisx0213_emp_encmap+3982,14,139},{0,0,0}, -{__jisx0213_emp_encmap+4108,74,85},{__jisx0213_emp_encmap+4120,34,229},{ -__jisx0213_emp_encmap+4316,30,76},{0,0,0},{__jisx0213_emp_encmap+4363,46,217}, -{__jisx0213_emp_encmap+4535,14,167},{0,0,0},{__jisx0213_emp_encmap+4689,113, -180},{0,0,0},{__jisx0213_emp_encmap+4757,196,212},{__jisx0213_emp_encmap+4774, -227,241},{__jisx0213_emp_encmap+4789,178,178},{__jisx0213_emp_encmap+4790,75, -100},{__jisx0213_emp_encmap+4816,161,161},{__jisx0213_emp_encmap+4817,46,232}, -{__jisx0213_emp_encmap+5004,35,251},{__jisx0213_emp_encmap+5221,12,237},{0,0,0 -},{__jisx0213_emp_encmap+5447,112,134},{__jisx0213_emp_encmap+5470,76,76},{ -__jisx0213_emp_encmap+5471,2,2},{0,0,0},{__jisx0213_emp_encmap+5472,126,176},{ -__jisx0213_emp_encmap+5523,29,29},{__jisx0213_emp_encmap+5524,221,234},{ -__jisx0213_emp_encmap+5538,81,221},{__jisx0213_emp_encmap+5679,30,255},{0,0,0 -},{__jisx0213_emp_encmap+5905,41,221},{0,0,0},{__jisx0213_emp_encmap+6086,64, -101},{__jisx0213_emp_encmap+6124,148,248},{__jisx0213_emp_encmap+6225,244,244 -},{__jisx0213_emp_encmap+6226,13,57},{0,0,0},{__jisx0213_emp_encmap+6271,218, -254},{__jisx0213_emp_encmap+6308,16,73},{0,0,0},{__jisx0213_emp_encmap+6366, -20,147},{__jisx0213_emp_encmap+6494,14,82},{0,0,0},{__jisx0213_emp_encmap+6563 -,133,133},{__jisx0213_emp_encmap+6564,132,132},{__jisx0213_emp_encmap+6565, -179,199},{__jisx0213_emp_encmap+6586,184,184},{__jisx0213_emp_encmap+6587,160, -160},{__jisx0213_emp_encmap+6588,16,16},{__jisx0213_emp_encmap+6589,183,183},{ -__jisx0213_emp_encmap+6590,138,187},{0,0,0},{__jisx0213_emp_encmap+6640,119, -243},{__jisx0213_emp_encmap+6765,205,205},{__jisx0213_emp_encmap+6766,12,85},{ -__jisx0213_emp_encmap+6840,107,201},{__jisx0213_emp_encmap+6935,215,250},{0,0, -0},{0,0,0},{__jisx0213_emp_encmap+6971,70,187},{__jisx0213_emp_encmap+7089,30, -228},{__jisx0213_emp_encmap+7288,193,239},{0,0,0},{__jisx0213_emp_encmap+7335, -16,251},{__jisx0213_emp_encmap+7571,31,235},{__jisx0213_emp_encmap+7776,50,248 -},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+7975,160,177},{0,0,0},{ -__jisx0213_emp_encmap+7993,144,144},{__jisx0213_emp_encmap+7994,207,207},{ -__jisx0213_emp_encmap+7995,127,240},{__jisx0213_emp_encmap+8109,25,80},{ -__jisx0213_emp_encmap+8165,198,198},{0,0,0},{__jisx0213_emp_encmap+8166,114, -114},{0,0,0},{0,0,0},{__jisx0213_emp_encmap+8167,219,219},{ -__jisx0213_emp_encmap+8168,21,233},{__jisx0213_emp_encmap+8381,206,206},{ -__jisx0213_emp_encmap+8382,26,249},{__jisx0213_emp_encmap+8606,144,144},{0,0,0 -},{__jisx0213_emp_encmap+8607,140,140},{__jisx0213_emp_encmap+8608,55,55},{ -__jisx0213_emp_encmap+8609,241,241},{__jisx0213_emp_encmap+8610,2,178},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0}, -}; - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_kr.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_kr.h deleted file mode 100644 index 31f66d5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_kr.h +++ /dev/null @@ -1,3251 +0,0 @@ -static const ucs2_t __ksx1001_decmap[8264] = { -12288,12289,12290,183,8229,8230,168,12291,173,8213,8741,65340,8764,8216,8217, -8220,8221,12308,12309,12296,12297,12298,12299,12300,12301,12302,12303,12304, -12305,177,215,247,8800,8804,8805,8734,8756,176,8242,8243,8451,8491,65504, -65505,65509,9794,9792,8736,8869,8978,8706,8711,8801,8786,167,8251,9734,9733, -9675,9679,9678,9671,9670,9633,9632,9651,9650,9661,9660,8594,8592,8593,8595, -8596,12307,8810,8811,8730,8765,8733,8757,8747,8748,8712,8715,8838,8839,8834, -8835,8746,8745,8743,8744,65506,8658,8660,8704,8707,180,65374,711,728,733,730, -729,184,731,161,191,720,8750,8721,8719,164,8457,8240,9665,9664,9655,9654,9828, -9824,9825,9829,9831,9827,8857,9672,9635,9680,9681,9618,9636,9637,9640,9639, -9638,9641,9832,9743,9742,9756,9758,182,8224,8225,8597,8599,8601,8598,8600, -9837,9833,9834,9836,12927,12828,8470,13255,8482,13250,13272,8481,8364,174, -65281,65282,65283,65284,65285,65286,65287,65288,65289,65290,65291,65292,65293, -65294,65295,65296,65297,65298,65299,65300,65301,65302,65303,65304,65305,65306, -65307,65308,65309,65310,65311,65312,65313,65314,65315,65316,65317,65318,65319, -65320,65321,65322,65323,65324,65325,65326,65327,65328,65329,65330,65331,65332, -65333,65334,65335,65336,65337,65338,65339,65510,65341,65342,65343,65344,65345, -65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356,65357,65358, -65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369,65370,65371, -65372,65373,65507,12593,12594,12595,12596,12597,12598,12599,12600,12601,12602, -12603,12604,12605,12606,12607,12608,12609,12610,12611,12612,12613,12614,12615, -12616,12617,12618,12619,12620,12621,12622,12623,12624,12625,12626,12627,12628, -12629,12630,12631,12632,12633,12634,12635,12636,12637,12638,12639,12640,12641, -12642,12643,12644,12645,12646,12647,12648,12649,12650,12651,12652,12653,12654, -12655,12656,12657,12658,12659,12660,12661,12662,12663,12664,12665,12666,12667, -12668,12669,12670,12671,12672,12673,12674,12675,12676,12677,12678,12679,12680, -12681,12682,12683,12684,12685,12686,8560,8561,8562,8563,8564,8565,8566,8567, -8568,8569,U,U,U,U,U,8544,8545,8546,8547,8548,8549,8550,8551,8552,8553,U,U,U,U, -U,U,U,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931, -932,933,934,935,936,937,U,U,U,U,U,U,U,U,945,946,947,948,949,950,951,952,953, -954,955,956,957,958,959,960,961,963,964,965,966,967,968,969,9472,9474,9484, -9488,9496,9492,9500,9516,9508,9524,9532,9473,9475,9487,9491,9499,9495,9507, -9523,9515,9531,9547,9504,9519,9512,9527,9535,9501,9520,9509,9528,9538,9490, -9489,9498,9497,9494,9493,9486,9485,9502,9503,9505,9506,9510,9511,9513,9514, -9517,9518,9521,9522,9525,9526,9529,9530,9533,9534,9536,9537,9539,9540,9541, -9542,9543,9544,9545,9546,13205,13206,13207,8467,13208,13252,13219,13220,13221, -13222,13209,13210,13211,13212,13213,13214,13215,13216,13217,13218,13258,13197, -13198,13199,13263,13192,13193,13256,13223,13224,13232,13233,13234,13235,13236, -13237,13238,13239,13240,13241,13184,13185,13186,13187,13188,13242,13243,13244, -13245,13246,13247,13200,13201,13202,13203,13204,8486,13248,13249,13194,13195, -13196,13270,13253,13229,13230,13231,13275,13225,13226,13227,13228,13277,13264, -13267,13251,13257,13276,13254,198,208,170,294,U,306,U,319,321,216,338,186,222, -358,330,U,12896,12897,12898,12899,12900,12901,12902,12903,12904,12905,12906, -12907,12908,12909,12910,12911,12912,12913,12914,12915,12916,12917,12918,12919, -12920,12921,12922,12923,9424,9425,9426,9427,9428,9429,9430,9431,9432,9433, -9434,9435,9436,9437,9438,9439,9440,9441,9442,9443,9444,9445,9446,9447,9448, -9449,9312,9313,9314,9315,9316,9317,9318,9319,9320,9321,9322,9323,9324,9325, -9326,189,8531,8532,188,190,8539,8540,8541,8542,230,273,240,295,305,307,312, -320,322,248,339,223,254,359,331,329,12800,12801,12802,12803,12804,12805,12806, -12807,12808,12809,12810,12811,12812,12813,12814,12815,12816,12817,12818,12819, -12820,12821,12822,12823,12824,12825,12826,12827,9372,9373,9374,9375,9376,9377, -9378,9379,9380,9381,9382,9383,9384,9385,9386,9387,9388,9389,9390,9391,9392, -9393,9394,9395,9396,9397,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341, -9342,9343,9344,9345,9346,185,178,179,8308,8319,8321,8322,8323,8324,12353, -12354,12355,12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366, -12367,12368,12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379, -12380,12381,12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392, -12393,12394,12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405, -12406,12407,12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418, -12419,12420,12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431, -12432,12433,12434,12435,12449,12450,12451,12452,12453,12454,12455,12456,12457, -12458,12459,12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470, -12471,12472,12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483, -12484,12485,12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496, -12497,12498,12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509, -12510,12511,12512,12513,12514,12515,12516,12517,12518,12519,12520,12521,12522, -12523,12524,12525,12526,12527,12528,12529,12530,12531,12532,12533,12534,1040, -1041,1042,1043,1044,1045,1025,1046,1047,1048,1049,1050,1051,1052,1053,1054, -1055,1056,1057,1058,1059,1060,1061,1062,1063,1064,1065,1066,1067,1068,1069, -1070,1071,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,1072,1073,1074,1075,1076,1077,1105, -1078,1079,1080,1081,1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092, -1093,1094,1095,1096,1097,1098,1099,1100,1101,1102,1103,44032,44033,44036, -44039,44040,44041,44042,44048,44049,44050,44051,44052,44053,44054,44055,44057, -44058,44059,44060,44061,44064,44068,44076,44077,44079,44080,44081,44088,44089, -44092,44096,44107,44109,44116,44120,44124,44144,44145,44148,44151,44152,44154, -44160,44161,44163,44164,44165,44166,44169,44170,44171,44172,44176,44180,44188, -44189,44191,44192,44193,44200,44201,44202,44204,44207,44208,44216,44217,44219, -44220,44221,44225,44228,44232,44236,44245,44247,44256,44257,44260,44263,44264, -44266,44268,44271,44272,44273,44275,44277,44278,44284,44285,44288,44292,44294, -44300,44301,44303,44305,44312,44316,44320,44329,44332,44333,44340,44341,44344, -44348,44356,44357,44359,44361,44368,44372,44376,44385,44387,44396,44397,44400, -44403,44404,44405,44406,44411,44412,44413,44415,44417,44418,44424,44425,44428, -44432,44444,44445,44452,44471,44480,44481,44484,44488,44496,44497,44499,44508, -44512,44516,44536,44537,44540,44543,44544,44545,44552,44553,44555,44557,44564, -44592,44593,44596,44599,44600,44602,44608,44609,44611,44613,44614,44618,44620, -44621,44622,44624,44628,44630,44636,44637,44639,44640,44641,44645,44648,44649, -44652,44656,44664,44665,44667,44668,44669,44676,44677,44684,44732,44733,44734, -44736,44740,44748,44749,44751,44752,44753,44760,44761,44764,44776,44779,44781, -44788,44792,44796,44807,44808,44813,44816,44844,44845,44848,44850,44852,44860, -44861,44863,44865,44866,44867,44872,44873,44880,44892,44893,44900,44901,44921, -44928,44932,44936,44944,44945,44949,44956,44984,44985,44988,44992,44999,45000, -45001,45003,45005,45006,45012,45020,45032,45033,45040,45041,45044,45048,45056, -45057,45060,45068,45072,45076,45084,45085,45096,45124,45125,45128,45130,45132, -45134,45139,45140,45141,45143,45145,45149,45180,45181,45184,45188,45196,45197, -45199,45201,45208,45209,45210,45212,45215,45216,45217,45218,45224,45225,45227, -45228,45229,45230,45231,45233,45235,45236,45237,45240,45244,45252,45253,45255, -45256,45257,45264,45265,45268,45272,45280,45285,45320,45321,45323,45324,45328, -45330,45331,45336,45337,45339,45340,45341,45347,45348,45349,45352,45356,45364, -45365,45367,45368,45369,45376,45377,45380,45384,45392,45393,45396,45397,45400, -45404,45408,45432,45433,45436,45440,45442,45448,45449,45451,45453,45458,45459, -45460,45464,45468,45480,45516,45520,45524,45532,45533,45535,45544,45545,45548, -45552,45561,45563,45565,45572,45573,45576,45579,45580,45588,45589,45591,45593, -45600,45620,45628,45656,45660,45664,45672,45673,45684,45685,45692,45700,45701, -45705,45712,45713,45716,45720,45721,45722,45728,45729,45731,45733,45734,45738, -45740,45744,45748,45768,45769,45772,45776,45778,45784,45785,45787,45789,45794, -45796,45797,45798,45800,45803,45804,45805,45806,45807,45811,45812,45813,45815, -45816,45817,45818,45819,45823,45824,45825,45828,45832,45840,45841,45843,45844, -45845,45852,45908,45909,45910,45912,45915,45916,45918,45919,45924,45925,45927, -45929,45931,45934,45936,45937,45940,45944,45952,45953,45955,45956,45957,45964, -45968,45972,45984,45985,45992,45996,46020,46021,46024,46027,46028,46030,46032, -46036,46037,46039,46041,46043,46045,46048,46052,46056,46076,46096,46104,46108, -46112,46120,46121,46123,46132,46160,46161,46164,46168,46176,46177,46179,46181, -46188,46208,46216,46237,46244,46248,46252,46261,46263,46265,46272,46276,46280, -46288,46293,46300,46301,46304,46307,46308,46310,46316,46317,46319,46321,46328, -46356,46357,46360,46363,46364,46372,46373,46375,46376,46377,46378,46384,46385, -46388,46392,46400,46401,46403,46404,46405,46411,46412,46413,46416,46420,46428, -46429,46431,46432,46433,46496,46497,46500,46504,46506,46507,46512,46513,46515, -46516,46517,46523,46524,46525,46528,46532,46540,46541,46543,46544,46545,46552, -46572,46608,46609,46612,46616,46629,46636,46644,46664,46692,46696,46748,46749, -46752,46756,46763,46764,46769,46804,46832,46836,46840,46848,46849,46853,46888, -46889,46892,46895,46896,46904,46905,46907,46916,46920,46924,46932,46933,46944, -46948,46952,46960,46961,46963,46965,46972,46973,46976,46980,46988,46989,46991, -46992,46993,46994,46998,46999,47000,47001,47004,47008,47016,47017,47019,47020, -47021,47028,47029,47032,47047,47049,47084,47085,47088,47092,47100,47101,47103, -47104,47105,47111,47112,47113,47116,47120,47128,47129,47131,47133,47140,47141, -47144,47148,47156,47157,47159,47160,47161,47168,47172,47185,47187,47196,47197, -47200,47204,47212,47213,47215,47217,47224,47228,47245,47272,47280,47284,47288, -47296,47297,47299,47301,47308,47312,47316,47325,47327,47329,47336,47337,47340, -47344,47352,47353,47355,47357,47364,47384,47392,47420,47421,47424,47428,47436, -47439,47441,47448,47449,47452,47456,47464,47465,47467,47469,47476,47477,47480, -47484,47492,47493,47495,47497,47498,47501,47502,47532,47533,47536,47540,47548, -47549,47551,47553,47560,47561,47564,47566,47567,47568,47569,47570,47576,47577, -47579,47581,47582,47585,47587,47588,47589,47592,47596,47604,47605,47607,47608, -47609,47610,47616,47617,47624,47637,47672,47673,47676,47680,47682,47688,47689, -47691,47693,47694,47699,47700,47701,47704,47708,47716,47717,47719,47720,47721, -47728,47729,47732,47736,47747,47748,47749,47751,47756,47784,47785,47787,47788, -47792,47794,47800,47801,47803,47805,47812,47816,47832,47833,47868,47872,47876, -47885,47887,47889,47896,47900,47904,47913,47915,47924,47925,47926,47928,47931, -47932,47933,47934,47940,47941,47943,47945,47949,47951,47952,47956,47960,47969, -47971,47980,48008,48012,48016,48036,48040,48044,48052,48055,48064,48068,48072, -48080,48083,48120,48121,48124,48127,48128,48130,48136,48137,48139,48140,48141, -48143,48145,48148,48149,48150,48151,48152,48155,48156,48157,48158,48159,48164, -48165,48167,48169,48173,48176,48177,48180,48184,48192,48193,48195,48196,48197, -48201,48204,48205,48208,48221,48260,48261,48264,48267,48268,48270,48276,48277, -48279,48281,48282,48288,48289,48292,48295,48296,48304,48305,48307,48308,48309, -48316,48317,48320,48324,48333,48335,48336,48337,48341,48344,48348,48372,48373, -48374,48376,48380,48388,48389,48391,48393,48400,48404,48420,48428,48448,48456, -48457,48460,48464,48472,48473,48484,48488,48512,48513,48516,48519,48520,48521, -48522,48528,48529,48531,48533,48537,48538,48540,48548,48560,48568,48596,48597, -48600,48604,48617,48624,48628,48632,48640,48643,48645,48652,48653,48656,48660, -48668,48669,48671,48708,48709,48712,48716,48718,48724,48725,48727,48729,48730, -48731,48736,48737,48740,48744,48746,48752,48753,48755,48756,48757,48763,48764, -48765,48768,48772,48780,48781,48783,48784,48785,48792,48793,48808,48848,48849, -48852,48855,48856,48864,48867,48868,48869,48876,48897,48904,48905,48920,48921, -48923,48924,48925,48960,48961,48964,48968,48976,48977,48981,49044,49072,49093, -49100,49101,49104,49108,49116,49119,49121,49212,49233,49240,49244,49248,49256, -49257,49296,49297,49300,49304,49312,49313,49315,49317,49324,49325,49327,49328, -49331,49332,49333,49334,49340,49341,49343,49344,49345,49349,49352,49353,49356, -49360,49368,49369,49371,49372,49373,49380,49381,49384,49388,49396,49397,49399, -49401,49408,49412,49416,49424,49429,49436,49437,49438,49439,49440,49443,49444, -49446,49447,49452,49453,49455,49456,49457,49462,49464,49465,49468,49472,49480, -49481,49483,49484,49485,49492,49493,49496,49500,49508,49509,49511,49512,49513, -49520,49524,49528,49541,49548,49549,49550,49552,49556,49558,49564,49565,49567, -49569,49573,49576,49577,49580,49584,49597,49604,49608,49612,49620,49623,49624, -49632,49636,49640,49648,49649,49651,49660,49661,49664,49668,49676,49677,49679, -49681,49688,49689,49692,49695,49696,49704,49705,49707,49709,49711,49713,49714, -49716,49736,49744,49745,49748,49752,49760,49765,49772,49773,49776,49780,49788, -49789,49791,49793,49800,49801,49808,49816,49819,49821,49828,49829,49832,49836, -49837,49844,49845,49847,49849,49884,49885,49888,49891,49892,49899,49900,49901, -49903,49905,49910,49912,49913,49915,49916,49920,49928,49929,49932,49933,49939, -49940,49941,49944,49948,49956,49957,49960,49961,49989,50024,50025,50028,50032, -50034,50040,50041,50044,50045,50052,50056,50060,50112,50136,50137,50140,50143, -50144,50146,50152,50153,50157,50164,50165,50168,50184,50192,50212,50220,50224, -50228,50236,50237,50248,50276,50277,50280,50284,50292,50293,50297,50304,50324, -50332,50360,50364,50409,50416,50417,50420,50424,50426,50431,50432,50433,50444, -50448,50452,50460,50472,50473,50476,50480,50488,50489,50491,50493,50500,50501, -50504,50505,50506,50508,50509,50510,50515,50516,50517,50519,50520,50521,50525, -50526,50528,50529,50532,50536,50544,50545,50547,50548,50549,50556,50557,50560, -50564,50567,50572,50573,50575,50577,50581,50583,50584,50588,50592,50601,50612, -50613,50616,50617,50619,50620,50621,50622,50628,50629,50630,50631,50632,50633, -50634,50636,50638,50640,50641,50644,50648,50656,50657,50659,50661,50668,50669, -50670,50672,50676,50678,50679,50684,50685,50686,50687,50688,50689,50693,50694, -50695,50696,50700,50704,50712,50713,50715,50716,50724,50725,50728,50732,50733, -50734,50736,50739,50740,50741,50743,50745,50747,50752,50753,50756,50760,50768, -50769,50771,50772,50773,50780,50781,50784,50796,50799,50801,50808,50809,50812, -50816,50824,50825,50827,50829,50836,50837,50840,50844,50852,50853,50855,50857, -50864,50865,50868,50872,50873,50874,50880,50881,50883,50885,50892,50893,50896, -50900,50908,50909,50912,50913,50920,50921,50924,50928,50936,50937,50941,50948, -50949,50952,50956,50964,50965,50967,50969,50976,50977,50980,50984,50992,50993, -50995,50997,50999,51004,51005,51008,51012,51018,51020,51021,51023,51025,51026, -51027,51028,51029,51030,51031,51032,51036,51040,51048,51051,51060,51061,51064, -51068,51069,51070,51075,51076,51077,51079,51080,51081,51082,51086,51088,51089, -51092,51094,51095,51096,51098,51104,51105,51107,51108,51109,51110,51116,51117, -51120,51124,51132,51133,51135,51136,51137,51144,51145,51148,51150,51152,51160, -51165,51172,51176,51180,51200,51201,51204,51208,51210,51216,51217,51219,51221, -51222,51228,51229,51232,51236,51244,51245,51247,51249,51256,51260,51264,51272, -51273,51276,51277,51284,51312,51313,51316,51320,51322,51328,51329,51331,51333, -51334,51335,51339,51340,51341,51348,51357,51359,51361,51368,51388,51389,51396, -51400,51404,51412,51413,51415,51417,51424,51425,51428,51445,51452,51453,51456, -51460,51461,51462,51468,51469,51471,51473,51480,51500,51508,51536,51537,51540, -51544,51552,51553,51555,51564,51568,51572,51580,51592,51593,51596,51600,51608, -51609,51611,51613,51648,51649,51652,51655,51656,51658,51664,51665,51667,51669, -51670,51673,51674,51676,51677,51680,51682,51684,51687,51692,51693,51695,51696, -51697,51704,51705,51708,51712,51720,51721,51723,51724,51725,51732,51736,51753, -51788,51789,51792,51796,51804,51805,51807,51808,51809,51816,51837,51844,51864, -51900,51901,51904,51908,51916,51917,51919,51921,51923,51928,51929,51936,51948, -51956,51976,51984,51988,51992,52000,52001,52033,52040,52041,52044,52048,52056, -52057,52061,52068,52088,52089,52124,52152,52180,52196,52199,52201,52236,52237, -52240,52244,52252,52253,52257,52258,52263,52264,52265,52268,52270,52272,52280, -52281,52283,52284,52285,52286,52292,52293,52296,52300,52308,52309,52311,52312, -52313,52320,52324,52326,52328,52336,52341,52376,52377,52380,52384,52392,52393, -52395,52396,52397,52404,52405,52408,52412,52420,52421,52423,52425,52432,52436, -52452,52460,52464,52481,52488,52489,52492,52496,52504,52505,52507,52509,52516, -52520,52524,52537,52572,52576,52580,52588,52589,52591,52593,52600,52616,52628, -52629,52632,52636,52644,52645,52647,52649,52656,52676,52684,52688,52712,52716, -52720,52728,52729,52731,52733,52740,52744,52748,52756,52761,52768,52769,52772, -52776,52784,52785,52787,52789,52824,52825,52828,52831,52832,52833,52840,52841, -52843,52845,52852,52853,52856,52860,52868,52869,52871,52873,52880,52881,52884, -52888,52896,52897,52899,52900,52901,52908,52909,52929,52964,52965,52968,52971, -52972,52980,52981,52983,52984,52985,52992,52993,52996,53000,53008,53009,53011, -53013,53020,53024,53028,53036,53037,53039,53040,53041,53048,53076,53077,53080, -53084,53092,53093,53095,53097,53104,53105,53108,53112,53120,53125,53132,53153, -53160,53168,53188,53216,53217,53220,53224,53232,53233,53235,53237,53244,53248, -53252,53265,53272,53293,53300,53301,53304,53308,53316,53317,53319,53321,53328, -53332,53336,53344,53356,53357,53360,53364,53372,53373,53377,53412,53413,53416, -53420,53428,53429,53431,53433,53440,53441,53444,53448,53449,53456,53457,53459, -53460,53461,53468,53469,53472,53476,53484,53485,53487,53488,53489,53496,53517, -53552,53553,53556,53560,53562,53568,53569,53571,53572,53573,53580,53581,53584, -53588,53596,53597,53599,53601,53608,53612,53628,53636,53640,53664,53665,53668, -53672,53680,53681,53683,53685,53690,53692,53696,53720,53748,53752,53767,53769, -53776,53804,53805,53808,53812,53820,53821,53823,53825,53832,53852,53860,53888, -53889,53892,53896,53904,53905,53909,53916,53920,53924,53932,53937,53944,53945, -53948,53951,53952,53954,53960,53961,53963,53972,53976,53980,53988,53989,54000, -54001,54004,54008,54016,54017,54019,54021,54028,54029,54030,54032,54036,54038, -54044,54045,54047,54048,54049,54053,54056,54057,54060,54064,54072,54073,54075, -54076,54077,54084,54085,54140,54141,54144,54148,54156,54157,54159,54160,54161, -54168,54169,54172,54176,54184,54185,54187,54189,54196,54200,54204,54212,54213, -54216,54217,54224,54232,54241,54243,54252,54253,54256,54260,54268,54269,54271, -54273,54280,54301,54336,54340,54364,54368,54372,54381,54383,54392,54393,54396, -54399,54400,54402,54408,54409,54411,54413,54420,54441,54476,54480,54484,54492, -54495,54504,54508,54512,54520,54523,54525,54532,54536,54540,54548,54549,54551, -54588,54589,54592,54596,54604,54605,54607,54609,54616,54617,54620,54624,54629, -54632,54633,54635,54637,54644,54645,54648,54652,54660,54661,54663,54664,54665, -54672,54693,54728,54729,54732,54736,54738,54744,54745,54747,54749,54756,54757, -54760,54764,54772,54773,54775,54777,54784,54785,54788,54792,54800,54801,54803, -54804,54805,54812,54816,54820,54829,54840,54841,54844,54848,54853,54856,54857, -54859,54861,54865,54868,54869,54872,54876,54887,54889,54896,54897,54900,54915, -54917,54924,54925,54928,54932,54941,54943,54945,54952,54956,54960,54969,54971, -54980,54981,54984,54988,54993,54996,54999,55001,55008,55012,55016,55024,55029, -55036,55037,55040,55044,55057,55064,55065,55068,55072,55080,55081,55083,55085, -55092,55093,55096,55100,55108,55111,55113,55120,55121,55124,55126,55127,55128, -55129,55136,55137,55139,55141,55145,55148,55152,55156,55164,55165,55169,55176, -55177,55180,55184,55192,55193,55195,55197,20285,20339,20551,20729,21152,21487, -21621,21733,22025,23233,23478,26247,26550,26551,26607,27468,29634,30146,31292, -33499,33540,34903,34952,35382,36040,36303,36603,36838,39381,21051,21364,21508, -24682,24932,27580,29647,33050,35258,35282,38307,20355,21002,22718,22904,23014, -24178,24185,25031,25536,26438,26604,26751,28567,30286,30475,30965,31240,31487, -31777,32925,33390,33393,35563,38291,20075,21917,26359,28212,30883,31469,33883, -35088,34638,38824,21208,22350,22570,23884,24863,25022,25121,25954,26577,27204, -28187,29976,30131,30435,30640,32058,37039,37969,37970,40853,21283,23724,30002, -32987,37440,38296,21083,22536,23004,23713,23831,24247,24378,24394,24951,27743, -30074,30086,31968,32115,32177,32652,33108,33313,34193,35137,35611,37628,38477, -40007,20171,20215,20491,20977,22607,24887,24894,24936,25913,27114,28433,30117, -30342,30422,31623,33445,33995,63744,37799,38283,21888,23458,22353,63745,31923, -32697,37301,20520,21435,23621,24040,25298,25454,25818,25831,28192,28844,31067, -36317,36382,63746,36989,37445,37624,20094,20214,20581,24062,24314,24838,26967, -33137,34388,36423,37749,39467,20062,20625,26480,26688,20745,21133,21138,27298, -30652,37392,40660,21163,24623,36850,20552,25001,25581,25802,26684,27268,28608, -33160,35233,38548,22533,29309,29356,29956,32121,32365,32937,35211,35700,36963, -40273,25225,27770,28500,32080,32570,35363,20860,24906,31645,35609,37463,37772, -20140,20435,20510,20670,20742,21185,21197,21375,22384,22659,24218,24465,24950, -25004,25806,25964,26223,26299,26356,26775,28039,28805,28913,29855,29861,29898, -30169,30828,30956,31455,31478,32069,32147,32789,32831,33051,33686,35686,36629, -36885,37857,38915,38968,39514,39912,20418,21843,22586,22865,23395,23622,24760, -25106,26690,26800,26856,28330,30028,30328,30926,31293,31995,32363,32380,35336, -35489,35903,38542,40388,21476,21481,21578,21617,22266,22993,23396,23611,24235, -25335,25911,25925,25970,26272,26543,27073,27837,30204,30352,30590,31295,32660, -32771,32929,33167,33510,33533,33776,34241,34865,34996,35493,63747,36764,37678, -38599,39015,39640,40723,21741,26011,26354,26767,31296,35895,40288,22256,22372, -23825,26118,26801,26829,28414,29736,34974,39908,27752,63748,39592,20379,20844, -20849,21151,23380,24037,24656,24685,25329,25511,25915,29657,31354,34467,36002, -38799,20018,23521,25096,26524,29916,31185,33747,35463,35506,36328,36942,37707, -38982,24275,27112,34303,37101,63749,20896,23448,23532,24931,26874,27454,28748, -29743,29912,31649,32592,33733,35264,36011,38364,39208,21038,24669,25324,36866, -20362,20809,21281,22745,24291,26336,27960,28826,29378,29654,31568,33009,37979, -21350,25499,32619,20054,20608,22602,22750,24618,24871,25296,27088,39745,23439, -32024,32945,36703,20132,20689,21676,21932,23308,23968,24039,25898,25934,26657, -27211,29409,30350,30703,32094,32761,33184,34126,34527,36611,36686,37066,39171, -39509,39851,19992,20037,20061,20167,20465,20855,21246,21312,21475,21477,21646, -22036,22389,22434,23495,23943,24272,25084,25304,25937,26552,26601,27083,27472, -27590,27628,27714,28317,28792,29399,29590,29699,30655,30697,31350,32127,32777, -33276,33285,33290,33503,34914,35635,36092,36544,36881,37041,37476,37558,39378, -39493,40169,40407,40860,22283,23616,33738,38816,38827,40628,21531,31384,32676, -35033,36557,37089,22528,23624,25496,31391,23470,24339,31353,31406,33422,36524, -20518,21048,21240,21367,22280,25331,25458,27402,28099,30519,21413,29527,34152, -36470,38357,26426,27331,28528,35437,36556,39243,63750,26231,27512,36020,39740, -63751,21483,22317,22862,25542,27131,29674,30789,31418,31429,31998,33909,35215, -36211,36917,38312,21243,22343,30023,31584,33740,37406,63752,27224,20811,21067, -21127,25119,26840,26997,38553,20677,21156,21220,25027,26020,26681,27135,29822, -31563,33465,33771,35250,35641,36817,39241,63753,20170,22935,25810,26129,27278, -29748,31105,31165,33449,34942,34943,35167,63754,37670,20235,21450,24613,25201, -27762,32026,32102,20120,20834,30684,32943,20225,20238,20854,20864,21980,22120, -22331,22522,22524,22804,22855,22931,23492,23696,23822,24049,24190,24524,25216, -26071,26083,26398,26399,26462,26827,26820,27231,27450,27683,27773,27778,28103, -29592,29734,29738,29826,29859,30072,30079,30849,30959,31041,31047,31048,31098, -31637,32000,32186,32648,32774,32813,32908,35352,35663,35912,36215,37665,37668, -39138,39249,39438,39439,39525,40594,32202,20342,21513,25326,26708,37329,21931, -20794,63755,63756,23068,25062,63757,25295,25343,63758,63759,63760,63761,63762, -63763,37027,63764,63765,63766,63767,63768,35582,63769,63770,63771,63772,26262, -63773,29014,63774,63775,38627,63776,25423,25466,21335,63777,26511,26976,28275, -63778,30007,63779,63780,63781,32013,63782,63783,34930,22218,23064,63784,63785, -63786,63787,63788,20035,63789,20839,22856,26608,32784,63790,22899,24180,25754, -31178,24565,24684,25288,25467,23527,23511,21162,63791,22900,24361,24594,63792, -63793,63794,29785,63795,63796,63797,63798,63799,63800,39377,63801,63802,63803, -63804,63805,63806,63807,63808,63809,63810,63811,28611,63812,63813,33215,36786, -24817,63814,63815,33126,63816,63817,23615,63818,63819,63820,63821,63822,63823, -63824,63825,23273,35365,26491,32016,63826,63827,63828,63829,63830,63831,33021, -63832,63833,23612,27877,21311,28346,22810,33590,20025,20150,20294,21934,22296, -22727,24406,26039,26086,27264,27573,28237,30701,31471,31774,32222,34507,34962, -37170,37723,25787,28606,29562,30136,36948,21846,22349,25018,25812,26311,28129, -28251,28525,28601,30192,32835,33213,34113,35203,35527,35674,37663,27795,30035, -31572,36367,36957,21776,22530,22616,24162,25095,25758,26848,30070,31958,34739, -40680,20195,22408,22382,22823,23565,23729,24118,24453,25140,25825,29619,33274, -34955,36024,38538,40667,23429,24503,24755,20498,20992,21040,22294,22581,22615, -23566,23648,23798,23947,24230,24466,24764,25361,25481,25623,26691,26873,27330, -28120,28193,28372,28644,29182,30428,30585,31153,31291,33796,35241,36077,36339, -36424,36867,36884,36947,37117,37709,38518,38876,27602,28678,29272,29346,29544, -30563,31167,31716,32411,35712,22697,24775,25958,26109,26302,27788,28958,29129, -35930,38931,20077,31361,20189,20908,20941,21205,21516,24999,26481,26704,26847, -27934,28540,30140,30643,31461,33012,33891,37509,20828,26007,26460,26515,30168, -31431,33651,63834,35910,36887,38957,23663,33216,33434,36929,36975,37389,24471, -23965,27225,29128,30331,31561,34276,35588,37159,39472,21895,25078,63835,30313, -32645,34367,34746,35064,37007,63836,27931,28889,29662,32097,33853,63837,37226, -39409,63838,20098,21365,27396,27410,28734,29211,34349,40478,21068,36771,23888, -25829,25900,27414,28651,31811,32412,34253,35172,35261,25289,33240,34847,24266, -26391,28010,29436,29701,29807,34690,37086,20358,23821,24480,33802,20919,25504, -30053,20142,20486,20841,20937,26753,27153,31918,31921,31975,33391,35538,36635, -37327,20406,20791,21237,21570,24300,24942,25150,26053,27354,28670,31018,34268, -34851,38317,39522,39530,40599,40654,21147,26310,27511,28701,31019,36706,38722, -24976,25088,25891,28451,29001,29833,32244,32879,34030,36646,36899,37706,20925, -21015,21155,27916,28872,35010,24265,25986,27566,28610,31806,29557,20196,20278, -22265,63839,23738,23994,24604,29618,31533,32666,32718,32838,36894,37428,38646, -38728,38936,40801,20363,28583,31150,37300,38583,21214,63840,25736,25796,27347, -28510,28696,29200,30439,32769,34310,34396,36335,36613,38706,39791,40442,40565, -30860,31103,32160,33737,37636,40575,40595,35542,22751,24324,26407,28711,29903, -31840,32894,20769,28712,29282,30922,36034,36058,36084,38647,20102,20698,23534, -24278,26009,29134,30274,30637,32842,34044,36988,39719,40845,22744,23105,23650, -27155,28122,28431,30267,32047,32311,34078,35128,37860,38475,21129,26066,26611, -27060,27969,28316,28687,29705,29792,30041,30244,30827,35628,39006,20845,25134, -38520,20374,20523,23833,28138,32184,36650,24459,24900,26647,63841,38534,21202, -32907,20956,20940,26974,31260,32190,33777,38517,20442,21033,21400,21519,21774, -23653,24743,26446,26792,28012,29313,29432,29702,29827,63842,30178,31852,32633, -32696,33673,35023,35041,37324,37328,38626,39881,21533,28542,29136,29848,34298, -36522,38563,40023,40607,26519,28107,29747,33256,38678,30764,31435,31520,31890, -25705,29802,30194,30908,30952,39340,39764,40635,23518,24149,28448,33180,33707, -37000,19975,21325,23081,24018,24398,24930,25405,26217,26364,28415,28459,28771, -30622,33836,34067,34875,36627,39237,39995,21788,25273,26411,27819,33545,35178, -38778,20129,22916,24536,24537,26395,32178,32596,33426,33579,33725,36638,37017, -22475,22969,23186,23504,26151,26522,26757,27599,29028,32629,36023,36067,36993, -39749,33032,35978,38476,39488,40613,23391,27667,29467,30450,30431,33804,20906, -35219,20813,20885,21193,26825,27796,30468,30496,32191,32236,38754,40629,28357, -34065,20901,21517,21629,26126,26269,26919,28319,30399,30609,33559,33986,34719, -37225,37528,40180,34946,20398,20882,21215,22982,24125,24917,25720,25721,26286, -26576,27169,27597,27611,29279,29281,29761,30520,30683,32791,33468,33541,35584, -35624,35980,26408,27792,29287,30446,30566,31302,40361,27519,27794,22818,26406, -33945,21359,22675,22937,24287,25551,26164,26483,28218,29483,31447,33495,37672, -21209,24043,25006,25035,25098,25287,25771,26080,26969,27494,27595,28961,29687, -30045,32326,33310,33538,34154,35491,36031,38695,40289,22696,40664,20497,21006, -21563,21839,25991,27766,32010,32011,32862,34442,38272,38639,21247,27797,29289, -21619,23194,23614,23883,24396,24494,26410,26806,26979,28220,28228,30473,31859, -32654,34183,35598,36855,38753,40692,23735,24758,24845,25003,25935,26107,26108, -27665,27887,29599,29641,32225,38292,23494,34588,35600,21085,21338,25293,25615, -25778,26420,27192,27850,29632,29854,31636,31893,32283,33162,33334,34180,36843, -38649,39361,20276,21322,21453,21467,25292,25644,25856,26001,27075,27886,28504, -29677,30036,30242,30436,30460,30928,30971,31020,32070,33324,34784,36820,38930, -39151,21187,25300,25765,28196,28497,30332,36299,37297,37474,39662,39747,20515, -20621,22346,22952,23592,24135,24439,25151,25918,26041,26049,26121,26507,27036, -28354,30917,32033,32938,33152,33323,33459,33953,34444,35370,35607,37030,38450, -40848,20493,20467,63843,22521,24472,25308,25490,26479,28227,28953,30403,32972, -32986,35060,35061,35097,36064,36649,37197,38506,20271,20336,24091,26575,26658, -30333,30334,39748,24161,27146,29033,29140,30058,63844,32321,34115,34281,39132, -20240,31567,32624,38309,20961,24070,26805,27710,27726,27867,29359,31684,33539, -27861,29754,20731,21128,22721,25816,27287,29863,30294,30887,34327,38370,38713, -63845,21342,24321,35722,36776,36783,37002,21029,30629,40009,40712,19993,20482, -20853,23643,24183,26142,26170,26564,26821,28851,29953,30149,31177,31453,36647, -39200,39432,20445,22561,22577,23542,26222,27493,27921,28282,28541,29668,29995, -33769,35036,35091,35676,36628,20239,20693,21264,21340,23443,24489,26381,31119, -33145,33583,34068,35079,35206,36665,36667,39333,39954,26412,20086,20472,22857, -23553,23791,23792,25447,26834,28925,29090,29739,32299,34028,34562,36898,37586, -40179,19981,20184,20463,20613,21078,21103,21542,21648,22496,22827,23142,23386, -23413,23500,24220,63846,25206,25975,26023,28014,28325,29238,31526,31807,32566, -33104,33105,33178,33344,33433,33705,35331,36000,36070,36091,36212,36282,37096, -37340,38428,38468,39385,40167,21271,20998,21545,22132,22707,22868,22894,24575, -24996,25198,26128,27774,28954,30406,31881,31966,32027,33452,36033,38640,63847, -20315,24343,24447,25282,23849,26379,26842,30844,32323,40300,19989,20633,21269, -21290,21329,22915,23138,24199,24754,24970,25161,25209,26000,26503,27047,27604, -27606,27607,27608,27832,63848,29749,30202,30738,30865,31189,31192,31875,32203, -32737,32933,33086,33218,33778,34586,35048,35513,35692,36027,37145,38750,39131, -40763,22188,23338,24428,25996,27315,27567,27996,28657,28693,29277,29613,36007, -36051,38971,24977,27703,32856,39425,20045,20107,20123,20181,20282,20284,20351, -20447,20735,21490,21496,21766,21987,22235,22763,22882,23057,23531,23546,23556, -24051,24107,24473,24605,25448,26012,26031,26614,26619,26797,27515,27801,27863, -28195,28681,29509,30722,31038,31040,31072,31169,31721,32023,32114,32902,33293, -33678,34001,34503,35039,35408,35422,35613,36060,36198,36781,37034,39164,39391, -40605,21066,63849,26388,63850,20632,21034,23665,25955,27733,29642,29987,30109, -31639,33948,37240,38704,20087,25746,27578,29022,34217,19977,63851,26441,26862, -28183,33439,34072,34923,25591,28545,37394,39087,19978,20663,20687,20767,21830, -21930,22039,23360,23577,23776,24120,24202,24224,24258,24819,26705,27233,28248, -29245,29248,29376,30456,31077,31665,32724,35059,35316,35443,35937,36062,38684, -22622,29885,36093,21959,63852,31329,32034,33394,29298,29983,29989,63853,31513, -22661,22779,23996,24207,24246,24464,24661,25234,25471,25933,26257,26329,26360, -26646,26866,29312,29790,31598,32110,32214,32626,32997,33298,34223,35199,35475, -36893,37604,40653,40736,22805,22893,24109,24796,26132,26227,26512,27728,28101, -28511,30707,30889,33990,37323,37675,20185,20682,20808,21892,23307,23459,25159, -25982,26059,28210,29053,29697,29764,29831,29887,30316,31146,32218,32341,32680, -33146,33203,33337,34330,34796,35445,36323,36984,37521,37925,39245,39854,21352, -23633,26964,27844,27945,28203,33292,34203,35131,35373,35498,38634,40807,21089, -26297,27570,32406,34814,36109,38275,38493,25885,28041,29166,63854,22478,22995, -23468,24615,24826,25104,26143,26207,29481,29689,30427,30465,31596,32854,32882, -33125,35488,37266,19990,21218,27506,27927,31237,31545,32048,63855,36016,21484, -22063,22609,23477,23567,23569,24034,25152,25475,25620,26157,26803,27836,28040, -28335,28703,28836,29138,29990,30095,30094,30233,31505,31712,31787,32032,32057, -34092,34157,34311,35380,36877,36961,37045,37559,38902,39479,20439,23660,26463, -28049,31903,32396,35606,36118,36895,23403,24061,25613,33984,36956,39137,29575, -23435,24730,26494,28126,35359,35494,36865,38924,21047,63856,28753,30862,37782, -34928,37335,20462,21463,22013,22234,22402,22781,23234,23432,23723,23744,24101, -24833,25101,25163,25480,25628,25910,25976,27193,27530,27700,27929,28465,29159, -29417,29560,29703,29874,30246,30561,31168,31319,31466,31929,32143,32172,32353, -32670,33065,33585,33936,34010,34282,34966,35504,35728,36664,36930,36995,37228, -37526,37561,38539,38567,38568,38614,38656,38920,39318,39635,39706,21460,22654, -22809,23408,23487,28113,28506,29087,29729,29881,32901,33789,24033,24455,24490, -24642,26092,26642,26991,27219,27529,27957,28147,29667,30462,30636,31565,32020, -33059,33308,33600,34036,34147,35426,35524,37255,37662,38918,39348,25100,34899, -36848,37477,23815,23847,23913,29791,33181,34664,28629,25342,32722,35126,35186, -19998,20056,20711,21213,21319,25215,26119,32361,34821,38494,20365,21273,22070, -22987,23204,23608,23630,23629,24066,24337,24643,26045,26159,26178,26558,26612, -29468,30690,31034,32709,33940,33997,35222,35430,35433,35553,35925,35962,22516, -23508,24335,24687,25325,26893,27542,28252,29060,31698,34645,35672,36606,39135, -39166,20280,20353,20449,21627,23072,23480,24892,26032,26216,29180,30003,31070, -32051,33102,33251,33688,34218,34254,34563,35338,36523,36763,63857,36805,22833, -23460,23526,24713,23529,23563,24515,27777,63858,28145,28683,29978,33455,35574, -20160,21313,63859,38617,27663,20126,20420,20818,21854,23077,23784,25105,29273, -33469,33706,34558,34905,35357,38463,38597,39187,40201,40285,22538,23731,23997, -24132,24801,24853,25569,27138,28197,37122,37716,38990,39952,40823,23433,23736, -25353,26191,26696,30524,38593,38797,38996,39839,26017,35585,36555,38332,21813, -23721,24022,24245,26263,30284,33780,38343,22739,25276,29390,40232,20208,22830, -24591,26171,27523,31207,40230,21395,21696,22467,23830,24859,26326,28079,30861, -33406,38552,38724,21380,25212,25494,28082,32266,33099,38989,27387,32588,40367, -40474,20063,20539,20918,22812,24825,25590,26928,29242,32822,63860,37326,24369, -63861,63862,32004,33509,33903,33979,34277,36493,63863,20335,63864,63865,22756, -23363,24665,25562,25880,25965,26264,63866,26954,27171,27915,28673,29036,30162, -30221,31155,31344,63867,32650,63868,35140,63869,35731,37312,38525,63870,39178, -22276,24481,26044,28417,30208,31142,35486,39341,39770,40812,20740,25014,25233, -27277,33222,20547,22576,24422,28937,35328,35578,23420,34326,20474,20796,22196, -22852,25513,28153,23978,26989,20870,20104,20313,63871,63872,63873,22914,63874, -63875,27487,27741,63876,29877,30998,63877,33287,33349,33593,36671,36701,63878, -39192,63879,63880,63881,20134,63882,22495,24441,26131,63883,63884,30123,32377, -35695,63885,36870,39515,22181,22567,23032,23071,23476,63886,24310,63887,63888, -25424,25403,63889,26941,27783,27839,28046,28051,28149,28436,63890,28895,28982, -29017,63891,29123,29141,63892,30799,30831,63893,31605,32227,63894,32303,63895, -34893,36575,63896,63897,63898,37467,63899,40182,63900,63901,63902,24709,28037, -63903,29105,63904,63905,38321,21421,63906,63907,63908,26579,63909,28814,28976, -29744,33398,33490,63910,38331,39653,40573,26308,63911,29121,33865,63912,63913, -22603,63914,63915,23992,24433,63916,26144,26254,27001,27054,27704,27891,28214, -28481,28634,28699,28719,29008,29151,29552,63917,29787,63918,29908,30408,31310, -32403,63919,63920,33521,35424,36814,63921,37704,63922,38681,63923,63924,20034, -20522,63925,21000,21473,26355,27757,28618,29450,30591,31330,33454,34269,34306, -63926,35028,35427,35709,35947,63927,37555,63928,38675,38928,20116,20237,20425, -20658,21320,21566,21555,21978,22626,22714,22887,23067,23524,24735,63929,25034, -25942,26111,26212,26791,27738,28595,28879,29100,29522,31613,34568,35492,39986, -40711,23627,27779,29508,29577,37434,28331,29797,30239,31337,32277,34314,20800, -22725,25793,29934,29973,30320,32705,37013,38605,39252,28198,29926,31401,31402, -33253,34521,34680,35355,23113,23436,23451,26785,26880,28003,29609,29715,29740, -30871,32233,32747,33048,33109,33694,35916,38446,38929,26352,24448,26106,26505, -27754,29579,20525,23043,27498,30702,22806,23916,24013,29477,30031,63930,63931, -20709,20985,22575,22829,22934,23002,23525,63932,63933,23970,25303,25622,25747, -25854,63934,26332,63935,27208,63936,29183,29796,63937,31368,31407,32327,32350, -32768,33136,63938,34799,35201,35616,36953,63939,36992,39250,24958,27442,28020, -32287,35109,36785,20433,20653,20887,21191,22471,22665,23481,24248,24898,27029, -28044,28263,28342,29076,29794,29992,29996,32883,33592,33993,36362,37780,37854, -63940,20110,20305,20598,20778,21448,21451,21491,23431,23507,23588,24858,24962, -26100,29275,29591,29760,30402,31056,31121,31161,32006,32701,33419,34261,34398, -36802,36935,37109,37354,38533,38632,38633,21206,24423,26093,26161,26671,29020, -31286,37057,38922,20113,63941,27218,27550,28560,29065,32792,33464,34131,36939, -38549,38642,38907,34074,39729,20112,29066,38596,20803,21407,21729,22291,22290, -22435,23195,23236,23491,24616,24895,25588,27781,27961,28274,28304,29232,29503, -29783,33489,34945,36677,36960,63942,38498,39000,40219,26376,36234,37470,20301, -20553,20702,21361,22285,22996,23041,23561,24944,26256,28205,29234,29771,32239, -32963,33806,33894,34111,34655,34907,35096,35586,36949,38859,39759,20083,20369, -20754,20842,63943,21807,21929,23418,23461,24188,24189,24254,24736,24799,24840, -24841,25540,25912,26377,63944,26580,26586,63945,26977,26978,27833,27943,63946, -28216,63947,28641,29494,29495,63948,29788,30001,63949,30290,63950,63951,32173, -33278,33848,35029,35480,35547,35565,36400,36418,36938,36926,36986,37193,37321, -37742,63952,63953,22537,63954,27603,32905,32946,63955,63956,20801,22891,23609, -63957,63958,28516,29607,32996,36103,63959,37399,38287,63960,63961,63962,63963, -32895,25102,28700,32104,34701,63964,22432,24681,24903,27575,35518,37504,38577, -20057,21535,28139,34093,38512,38899,39150,25558,27875,37009,20957,25033,33210, -40441,20381,20506,20736,23452,24847,25087,25836,26885,27589,30097,30691,32681, -33380,34191,34811,34915,35516,35696,37291,20108,20197,20234,63965,63966,22839, -23016,63967,24050,24347,24411,24609,63968,63969,63970,63971,29246,29669,63972, -30064,30157,63973,31227,63974,32780,32819,32900,33505,33617,63975,63976,36029, -36019,36999,63977,63978,39156,39180,63979,63980,28727,30410,32714,32716,32764, -35610,20154,20161,20995,21360,63981,21693,22240,23035,23493,24341,24525,28270, -63982,63983,32106,33589,63984,34451,35469,63985,38765,38775,63986,63987,19968, -20314,20350,22777,26085,28322,36920,37808,39353,20219,22764,22922,23001,24641, -63988,63989,31252,63990,33615,36035,20837,21316,63991,63992,63993,20173,21097, -23381,33471,20180,21050,21672,22985,23039,23376,23383,23388,24675,24904,28363, -28825,29038,29574,29943,30133,30913,32043,32773,33258,33576,34071,34249,35566, -36039,38604,20316,21242,22204,26027,26152,28796,28856,29237,32189,33421,37196, -38592,40306,23409,26855,27544,28538,30430,23697,26283,28507,31668,31786,34870, -38620,19976,20183,21280,22580,22715,22767,22892,23559,24115,24196,24373,25484, -26290,26454,27167,27299,27404,28479,29254,63994,29520,29835,31456,31911,33144, -33247,33255,33674,33900,34083,34196,34255,35037,36115,37292,38263,38556,20877, -21705,22312,23472,25165,26448,26685,26771,28221,28371,28797,32289,35009,36001, -36617,40779,40782,29229,31631,35533,37658,20295,20302,20786,21632,22992,24213, -25269,26485,26990,27159,27822,28186,29401,29482,30141,31672,32053,33511,33785, -33879,34295,35419,36015,36487,36889,37048,38606,40799,21219,21514,23265,23490, -25688,25973,28404,29380,63995,30340,31309,31515,31821,32318,32735,33659,35627, -36042,36196,36321,36447,36842,36857,36969,37841,20291,20346,20659,20840,20856, -21069,21098,22625,22652,22880,23560,23637,24283,24731,25136,26643,27583,27656, -28593,29006,29728,30000,30008,30033,30322,31564,31627,31661,31686,32399,35438, -36670,36681,37439,37523,37666,37931,38651,39002,39019,39198,20999,25130,25240, -27993,30308,31434,31680,32118,21344,23742,24215,28472,28857,31896,38673,39822, -40670,25509,25722,34678,19969,20117,20141,20572,20597,21576,22979,23450,24128, -24237,24311,24449,24773,25402,25919,25972,26060,26230,26232,26622,26984,27273, -27491,27712,28096,28136,28191,28254,28702,28833,29582,29693,30010,30555,30855, -31118,31243,31357,31934,32142,33351,35330,35562,35998,37165,37194,37336,37478, -37580,37664,38662,38742,38748,38914,40718,21046,21137,21884,22564,24093,24351, -24716,25552,26799,28639,31085,31532,33229,34234,35069,35576,36420,37261,38500, -38555,38717,38988,40778,20430,20806,20939,21161,22066,24340,24427,25514,25805, -26089,26177,26362,26361,26397,26781,26839,27133,28437,28526,29031,29157,29226, -29866,30522,31062,31066,31199,31264,31381,31895,31967,32068,32368,32903,34299, -34468,35412,35519,36249,36481,36896,36973,37347,38459,38613,40165,26063,31751, -36275,37827,23384,23562,21330,25305,29469,20519,23447,24478,24752,24939,26837, -28121,29742,31278,32066,32156,32305,33131,36394,36405,37758,37912,20304,22352, -24038,24231,25387,32618,20027,20303,20367,20570,23005,32964,21610,21608,22014, -22863,23449,24030,24282,26205,26417,26609,26666,27880,27954,28234,28557,28855, -29664,30087,31820,32002,32044,32162,33311,34523,35387,35461,36208,36490,36659, -36913,37198,37202,37956,39376,31481,31909,20426,20737,20934,22472,23535,23803, -26201,27197,27994,28310,28652,28940,30063,31459,34850,36897,36981,38603,39423, -33537,20013,20210,34886,37325,21373,27355,26987,27713,33914,22686,24974,26366, -25327,28893,29969,30151,32338,33976,35657,36104,20043,21482,21675,22320,22336, -24535,25345,25351,25711,25903,26088,26234,26525,26547,27490,27744,27802,28460, -30693,30757,31049,31063,32025,32930,33026,33267,33437,33463,34584,35468,63996, -36100,36286,36978,30452,31257,31287,32340,32887,21767,21972,22645,25391,25634, -26185,26187,26733,27035,27524,27941,28337,29645,29800,29857,30043,30137,30433, -30494,30603,31206,32265,32285,33275,34095,34967,35386,36049,36587,36784,36914, -37805,38499,38515,38663,20356,21489,23018,23241,24089,26702,29894,30142,31209, -31378,33187,34541,36074,36300,36845,26015,26389,63997,22519,28503,32221,36655, -37878,38598,24501,25074,28548,19988,20376,20511,21449,21983,23919,24046,27425, -27492,30923,31642,63998,36425,36554,36974,25417,25662,30528,31364,37679,38015, -40810,25776,28591,29158,29864,29914,31428,31762,32386,31922,32408,35738,36106, -38013,39184,39244,21049,23519,25830,26413,32046,20717,21443,22649,24920,24921, -25082,26028,31449,35730,35734,20489,20513,21109,21809,23100,24288,24432,24884, -25950,26124,26166,26274,27085,28356,28466,29462,30241,31379,33081,33369,33750, -33980,20661,22512,23488,23528,24425,25505,30758,32181,33756,34081,37319,37365, -20874,26613,31574,36012,20932,22971,24765,34389,20508,63999,21076,23610,24957, -25114,25299,25842,26021,28364,30240,33034,36448,38495,38587,20191,21315,21912, -22825,24029,25797,27849,28154,29588,31359,33307,34214,36068,36368,36983,37351, -38369,38433,38854,20984,21746,21894,24505,25764,28552,32180,36639,36685,37941, -20681,23574,27838,28155,29979,30651,31805,31844,35449,35522,22558,22974,24086, -25463,29266,30090,30571,35548,36028,36626,24307,26228,28152,32893,33729,35531, -38737,39894,64000,21059,26367,28053,28399,32224,35558,36910,36958,39636,21021, -21119,21736,24980,25220,25307,26786,26898,26970,27189,28818,28966,30813,30977, -30990,31186,31245,32918,33400,33493,33609,34121,35970,36229,37218,37259,37294, -20419,22225,29165,30679,34560,35320,23544,24534,26449,37032,21474,22618,23541, -24740,24961,25696,32317,32880,34085,37507,25774,20652,23828,26368,22684,25277, -25512,26894,27000,27166,28267,30394,31179,33467,33833,35535,36264,36861,37138, -37195,37276,37648,37656,37786,38619,39478,39949,19985,30044,31069,31482,31569, -31689,32302,33988,36441,36468,36600,36880,26149,26943,29763,20986,26414,40668, -20805,24544,27798,34802,34909,34935,24756,33205,33795,36101,21462,21561,22068, -23094,23601,28810,32736,32858,33030,33261,36259,37257,39519,40434,20596,20164, -21408,24827,28204,23652,20360,20516,21988,23769,24159,24677,26772,27835,28100, -29118,30164,30196,30305,31258,31305,32199,32251,32622,33268,34473,36636,38601, -39347,40786,21063,21189,39149,35242,19971,26578,28422,20405,23522,26517,27784, -28024,29723,30759,37341,37756,34756,31204,31281,24555,20182,21668,21822,22702, -22949,24816,25171,25302,26422,26965,33333,38464,39345,39389,20524,21331,21828, -22396,64001,25176,64002,25826,26219,26589,28609,28655,29730,29752,35351,37944, -21585,22022,22374,24392,24986,27470,28760,28845,32187,35477,22890,33067,25506, -30472,32829,36010,22612,25645,27067,23445,24081,28271,64003,34153,20812,21488, -22826,24608,24907,27526,27760,27888,31518,32974,33492,36294,37040,39089,64004, -25799,28580,25745,25860,20814,21520,22303,35342,24927,26742,64005,30171,31570, -32113,36890,22534,27084,33151,35114,36864,38969,20600,22871,22956,25237,36879, -39722,24925,29305,38358,22369,23110,24052,25226,25773,25850,26487,27874,27966, -29228,29750,30772,32631,33453,36315,38935,21028,22338,26495,29256,29923,36009, -36774,37393,38442,20843,21485,25420,20329,21764,24726,25943,27803,28031,29260, -29437,31255,35207,35997,24429,28558,28921,33192,24846,20415,20559,25153,29255, -31687,32232,32745,36941,38829,39449,36022,22378,24179,26544,33805,35413,21536, -23318,24163,24290,24330,25987,32954,34109,38281,38491,20296,21253,21261,21263, -21638,21754,22275,24067,24598,25243,25265,25429,64006,27873,28006,30129,30770, -32990,33071,33502,33889,33970,34957,35090,36875,37610,39165,39825,24133,26292, -26333,28689,29190,64007,20469,21117,24426,24915,26451,27161,28418,29922,31080, -34920,35961,39111,39108,39491,21697,31263,26963,35575,35914,39080,39342,24444, -25259,30130,30382,34987,36991,38466,21305,24380,24517,27852,29644,30050,30091, -31558,33534,39325,20047,36924,19979,20309,21414,22799,24264,26160,27827,29781, -33655,34662,36032,36944,38686,39957,22737,23416,34384,35604,40372,23506,24680, -24717,26097,27735,28450,28579,28698,32597,32752,38289,38290,38480,38867,21106, -36676,20989,21547,21688,21859,21898,27323,28085,32216,33382,37532,38519,40569, -21512,21704,30418,34532,38308,38356,38492,20130,20233,23022,23270,24055,24658, -25239,26477,26689,27782,28207,32568,32923,33322,64008,64009,38917,20133,20565, -21683,22419,22874,23401,23475,25032,26999,28023,28707,34809,35299,35442,35559, -36994,39405,39608,21182,26680,20502,24184,26447,33607,34892,20139,21521,22190, -29670,37141,38911,39177,39255,39321,22099,22687,34395,35377,25010,27382,29563, -36562,27463,38570,39511,22869,29184,36203,38761,20436,23796,24358,25080,26203, -27883,28843,29572,29625,29694,30505,30541,32067,32098,32291,33335,34898,64010, -36066,37449,39023,23377,31348,34880,38913,23244,20448,21332,22846,23805,25406, -28025,29433,33029,33031,33698,37583,38960,20136,20804,21009,22411,24418,27842, -28366,28677,28752,28847,29074,29673,29801,33610,34722,34913,36872,37026,37795, -39336,20846,24407,24800,24935,26291,34137,36426,37295,38795,20046,20114,21628, -22741,22778,22909,23733,24359,25142,25160,26122,26215,27627,28009,28111,28246, -28408,28564,28640,28649,28765,29392,29733,29786,29920,30355,31068,31946,32286, -32993,33446,33899,33983,34382,34399,34676,35703,35946,37804,38912,39013,24785, -25110,37239,23130,26127,28151,28222,29759,39746,24573,24794,31503,21700,24344, -27742,27859,27946,28888,32005,34425,35340,40251,21270,21644,23301,27194,28779, -30069,31117,31166,33457,33775,35441,35649,36008,38772,64011,25844,25899,30906, -30907,31339,20024,21914,22864,23462,24187,24739,25563,27489,26213,26707,28185, -29029,29872,32008,36996,39529,39973,27963,28369,29502,35905,38346,20976,24140, -24488,24653,24822,24880,24908,26179,26180,27045,27841,28255,28361,28514,29004, -29852,30343,31681,31783,33618,34647,36945,38541,40643,21295,22238,24315,24458, -24674,24724,25079,26214,26371,27292,28142,28590,28784,29546,32362,33214,33588, -34516,35496,36036,21123,29554,23446,27243,37892,21742,22150,23389,25928,25989, -26313,26783,28045,28102,29243,32948,37237,39501,20399,20505,21402,21518,21564, -21897,21957,24127,24460,26429,29030,29661,36869,21211,21235,22628,22734,28932, -29071,29179,34224,35347,26248,34216,21927,26244,29002,33841,21321,21913,27585, -24409,24509,25582,26249,28999,35569,36637,40638,20241,25658,28875,30054,34407, -24676,35662,40440,20807,20982,21256,27958,33016,40657,26133,27427,28824,30165, -21507,23673,32007,35350,27424,27453,27462,21560,24688,27965,32725,33288,20694, -20958,21916,22123,22221,23020,23305,24076,24985,24984,25137,26206,26342,29081, -29113,29114,29351,31143,31232,32690,35440, -}; - -static const struct dbcs_index ksx1001_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__ksx1001_decmap+0,33,126},{__ksx1001_decmap+ -94,33,103},{__ksx1001_decmap+165,33,126},{__ksx1001_decmap+259,33,126},{ -__ksx1001_decmap+353,33,120},{__ksx1001_decmap+441,33,100},{__ksx1001_decmap+ -509,33,111},{__ksx1001_decmap+588,33,126},{__ksx1001_decmap+682,33,126},{ -__ksx1001_decmap+776,33,115},{__ksx1001_decmap+859,33,118},{__ksx1001_decmap+ -945,33,113},{0,0,0},{0,0,0},{0,0,0},{__ksx1001_decmap+1026,33,126},{ -__ksx1001_decmap+1120,33,126},{__ksx1001_decmap+1214,33,126},{__ksx1001_decmap -+1308,33,126},{__ksx1001_decmap+1402,33,126},{__ksx1001_decmap+1496,33,126},{ -__ksx1001_decmap+1590,33,126},{__ksx1001_decmap+1684,33,126},{__ksx1001_decmap -+1778,33,126},{__ksx1001_decmap+1872,33,126},{__ksx1001_decmap+1966,33,126},{ -__ksx1001_decmap+2060,33,126},{__ksx1001_decmap+2154,33,126},{__ksx1001_decmap -+2248,33,126},{__ksx1001_decmap+2342,33,126},{__ksx1001_decmap+2436,33,126},{ -__ksx1001_decmap+2530,33,126},{__ksx1001_decmap+2624,33,126},{__ksx1001_decmap -+2718,33,126},{__ksx1001_decmap+2812,33,126},{__ksx1001_decmap+2906,33,126},{ -__ksx1001_decmap+3000,33,126},{__ksx1001_decmap+3094,33,126},{__ksx1001_decmap -+3188,33,126},{__ksx1001_decmap+3282,33,126},{0,0,0},{__ksx1001_decmap+3376, -33,126},{__ksx1001_decmap+3470,33,126},{__ksx1001_decmap+3564,33,126},{ -__ksx1001_decmap+3658,33,126},{__ksx1001_decmap+3752,33,126},{__ksx1001_decmap -+3846,33,126},{__ksx1001_decmap+3940,33,126},{__ksx1001_decmap+4034,33,126},{ -__ksx1001_decmap+4128,33,126},{__ksx1001_decmap+4222,33,126},{__ksx1001_decmap -+4316,33,126},{__ksx1001_decmap+4410,33,126},{__ksx1001_decmap+4504,33,126},{ -__ksx1001_decmap+4598,33,126},{__ksx1001_decmap+4692,33,126},{__ksx1001_decmap -+4786,33,126},{__ksx1001_decmap+4880,33,126},{__ksx1001_decmap+4974,33,126},{ -__ksx1001_decmap+5068,33,126},{__ksx1001_decmap+5162,33,126},{__ksx1001_decmap -+5256,33,126},{__ksx1001_decmap+5350,33,126},{__ksx1001_decmap+5444,33,126},{ -__ksx1001_decmap+5538,33,126},{__ksx1001_decmap+5632,33,126},{__ksx1001_decmap -+5726,33,126},{__ksx1001_decmap+5820,33,126},{__ksx1001_decmap+5914,33,126},{ -__ksx1001_decmap+6008,33,126},{__ksx1001_decmap+6102,33,126},{__ksx1001_decmap -+6196,33,126},{__ksx1001_decmap+6290,33,126},{__ksx1001_decmap+6384,33,126},{ -__ksx1001_decmap+6478,33,126},{__ksx1001_decmap+6572,33,126},{__ksx1001_decmap -+6666,33,126},{__ksx1001_decmap+6760,33,126},{__ksx1001_decmap+6854,33,126},{ -__ksx1001_decmap+6948,33,126},{__ksx1001_decmap+7042,33,126},{__ksx1001_decmap -+7136,33,126},{__ksx1001_decmap+7230,33,126},{__ksx1001_decmap+7324,33,126},{ -__ksx1001_decmap+7418,33,126},{__ksx1001_decmap+7512,33,126},{__ksx1001_decmap -+7606,33,126},{__ksx1001_decmap+7700,33,126},{__ksx1001_decmap+7794,33,126},{ -__ksx1001_decmap+7888,33,126},{__ksx1001_decmap+7982,33,126},{__ksx1001_decmap -+8076,33,126},{__ksx1001_decmap+8170,33,126},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -}, -}; - -static const ucs2_t __cp949ext_decmap[9650] = { -44034,44035,44037,44038,44043,44044,44045,44046,44047,44056,44062,44063,44065, -44066,44067,44069,44070,44071,44072,44073,44074,44075,44078,44082,44083,44084, -U,U,U,U,U,U,44085,44086,44087,44090,44091,44093,44094,44095,44097,44098,44099, -44100,44101,44102,44103,44104,44105,44106,44108,44110,44111,44112,44113,44114, -44115,44117,U,U,U,U,U,U,44118,44119,44121,44122,44123,44125,44126,44127,44128, -44129,44130,44131,44132,44133,44134,44135,44136,44137,44138,44139,44140,44141, -44142,44143,44146,44147,44149,44150,44153,44155,44156,44157,44158,44159,44162, -44167,44168,44173,44174,44175,44177,44178,44179,44181,44182,44183,44184,44185, -44186,44187,44190,44194,44195,44196,44197,44198,44199,44203,44205,44206,44209, -44210,44211,44212,44213,44214,44215,44218,44222,44223,44224,44226,44227,44229, -44230,44231,44233,44234,44235,44237,44238,44239,44240,44241,44242,44243,44244, -44246,44248,44249,44250,44251,44252,44253,44254,44255,44258,44259,44261,44262, -44265,44267,44269,44270,44274,44276,44279,44280,44281,44282,44283,44286,44287, -44289,44290,44291,44293,44295,44296,44297,44298,44299,44302,44304,44306,44307, -44308,44309,44310,44311,44313,44314,44315,44317,44318,44319,44321,44322,44323, -44324,44325,44326,44327,44328,44330,44331,44334,44335,44336,44337,44338,44339, -U,U,U,U,U,U,44342,44343,44345,44346,44347,44349,44350,44351,44352,44353,44354, -44355,44358,44360,44362,44363,44364,44365,44366,44367,44369,44370,44371,44373, -44374,44375,U,U,U,U,U,U,44377,44378,44379,44380,44381,44382,44383,44384,44386, -44388,44389,44390,44391,44392,44393,44394,44395,44398,44399,44401,44402,44407, -44408,44409,44410,44414,44416,44419,44420,44421,44422,44423,44426,44427,44429, -44430,44431,44433,44434,44435,44436,44437,44438,44439,44440,44441,44442,44443, -44446,44447,44448,44449,44450,44451,44453,44454,44455,44456,44457,44458,44459, -44460,44461,44462,44463,44464,44465,44466,44467,44468,44469,44470,44472,44473, -44474,44475,44476,44477,44478,44479,44482,44483,44485,44486,44487,44489,44490, -44491,44492,44493,44494,44495,44498,44500,44501,44502,44503,44504,44505,44506, -44507,44509,44510,44511,44513,44514,44515,44517,44518,44519,44520,44521,44522, -44523,44524,44525,44526,44527,44528,44529,44530,44531,44532,44533,44534,44535, -44538,44539,44541,44542,44546,44547,44548,44549,44550,44551,44554,44556,44558, -44559,44560,44561,44562,44563,44565,44566,44567,44568,44569,44570,44571,44572, -U,U,U,U,U,U,44573,44574,44575,44576,44577,44578,44579,44580,44581,44582,44583, -44584,44585,44586,44587,44588,44589,44590,44591,44594,44595,44597,44598,44601, -44603,44604,U,U,U,U,U,U,44605,44606,44607,44610,44612,44615,44616,44617,44619, -44623,44625,44626,44627,44629,44631,44632,44633,44634,44635,44638,44642,44643, -44644,44646,44647,44650,44651,44653,44654,44655,44657,44658,44659,44660,44661, -44662,44663,44666,44670,44671,44672,44673,44674,44675,44678,44679,44680,44681, -44682,44683,44685,44686,44687,44688,44689,44690,44691,44692,44693,44694,44695, -44696,44697,44698,44699,44700,44701,44702,44703,44704,44705,44706,44707,44708, -44709,44710,44711,44712,44713,44714,44715,44716,44717,44718,44719,44720,44721, -44722,44723,44724,44725,44726,44727,44728,44729,44730,44731,44735,44737,44738, -44739,44741,44742,44743,44744,44745,44746,44747,44750,44754,44755,44756,44757, -44758,44759,44762,44763,44765,44766,44767,44768,44769,44770,44771,44772,44773, -44774,44775,44777,44778,44780,44782,44783,44784,44785,44786,44787,44789,44790, -44791,44793,44794,44795,44797,44798,44799,44800,44801,44802,44803,44804,44805, -U,U,U,U,U,U,44806,44809,44810,44811,44812,44814,44815,44817,44818,44819,44820, -44821,44822,44823,44824,44825,44826,44827,44828,44829,44830,44831,44832,44833, -44834,44835,U,U,U,U,U,U,44836,44837,44838,44839,44840,44841,44842,44843,44846, -44847,44849,44851,44853,44854,44855,44856,44857,44858,44859,44862,44864,44868, -44869,44870,44871,44874,44875,44876,44877,44878,44879,44881,44882,44883,44884, -44885,44886,44887,44888,44889,44890,44891,44894,44895,44896,44897,44898,44899, -44902,44903,44904,44905,44906,44907,44908,44909,44910,44911,44912,44913,44914, -44915,44916,44917,44918,44919,44920,44922,44923,44924,44925,44926,44927,44929, -44930,44931,44933,44934,44935,44937,44938,44939,44940,44941,44942,44943,44946, -44947,44948,44950,44951,44952,44953,44954,44955,44957,44958,44959,44960,44961, -44962,44963,44964,44965,44966,44967,44968,44969,44970,44971,44972,44973,44974, -44975,44976,44977,44978,44979,44980,44981,44982,44983,44986,44987,44989,44990, -44991,44993,44994,44995,44996,44997,44998,45002,45004,45007,45008,45009,45010, -45011,45013,45014,45015,45016,45017,45018,45019,45021,45022,45023,45024,45025, -U,U,U,U,U,U,45026,45027,45028,45029,45030,45031,45034,45035,45036,45037,45038, -45039,45042,45043,45045,45046,45047,45049,45050,45051,45052,45053,45054,45055, -45058,45059,U,U,U,U,U,U,45061,45062,45063,45064,45065,45066,45067,45069,45070, -45071,45073,45074,45075,45077,45078,45079,45080,45081,45082,45083,45086,45087, -45088,45089,45090,45091,45092,45093,45094,45095,45097,45098,45099,45100,45101, -45102,45103,45104,45105,45106,45107,45108,45109,45110,45111,45112,45113,45114, -45115,45116,45117,45118,45119,45120,45121,45122,45123,45126,45127,45129,45131, -45133,45135,45136,45137,45138,45142,45144,45146,45147,45148,45150,45151,45152, -45153,45154,45155,45156,45157,45158,45159,45160,45161,45162,45163,45164,45165, -45166,45167,45168,45169,45170,45171,45172,45173,45174,45175,45176,45177,45178, -45179,45182,45183,45185,45186,45187,45189,45190,45191,45192,45193,45194,45195, -45198,45200,45202,45203,45204,45205,45206,45207,45211,45213,45214,45219,45220, -45221,45222,45223,45226,45232,45234,45238,45239,45241,45242,45243,45245,45246, -45247,45248,45249,45250,45251,45254,45258,45259,45260,45261,45262,45263,45266, -U,U,U,U,U,U,45267,45269,45270,45271,45273,45274,45275,45276,45277,45278,45279, -45281,45282,45283,45284,45286,45287,45288,45289,45290,45291,45292,45293,45294, -45295,45296,U,U,U,U,U,U,45297,45298,45299,45300,45301,45302,45303,45304,45305, -45306,45307,45308,45309,45310,45311,45312,45313,45314,45315,45316,45317,45318, -45319,45322,45325,45326,45327,45329,45332,45333,45334,45335,45338,45342,45343, -45344,45345,45346,45350,45351,45353,45354,45355,45357,45358,45359,45360,45361, -45362,45363,45366,45370,45371,45372,45373,45374,45375,45378,45379,45381,45382, -45383,45385,45386,45387,45388,45389,45390,45391,45394,45395,45398,45399,45401, -45402,45403,45405,45406,45407,45409,45410,45411,45412,45413,45414,45415,45416, -45417,45418,45419,45420,45421,45422,45423,45424,45425,45426,45427,45428,45429, -45430,45431,45434,45435,45437,45438,45439,45441,45443,45444,45445,45446,45447, -45450,45452,45454,45455,45456,45457,45461,45462,45463,45465,45466,45467,45469, -45470,45471,45472,45473,45474,45475,45476,45477,45478,45479,45481,45482,45483, -45484,45485,45486,45487,45488,45489,45490,45491,45492,45493,45494,45495,45496, -U,U,U,U,U,U,45497,45498,45499,45500,45501,45502,45503,45504,45505,45506,45507, -45508,45509,45510,45511,45512,45513,45514,45515,45517,45518,45519,45521,45522, -45523,45525,U,U,U,U,U,U,45526,45527,45528,45529,45530,45531,45534,45536,45537, -45538,45539,45540,45541,45542,45543,45546,45547,45549,45550,45551,45553,45554, -45555,45556,45557,45558,45559,45560,45562,45564,45566,45567,45568,45569,45570, -45571,45574,45575,45577,45578,45581,45582,45583,45584,45585,45586,45587,45590, -45592,45594,45595,45596,45597,45598,45599,45601,45602,45603,45604,45605,45606, -45607,45608,45609,45610,45611,45612,45613,45614,45615,45616,45617,45618,45619, -45621,45622,45623,45624,45625,45626,45627,45629,45630,45631,45632,45633,45634, -45635,45636,45637,45638,45639,45640,45641,45642,45643,45644,45645,45646,45647, -45648,45649,45650,45651,45652,45653,45654,45655,45657,45658,45659,45661,45662, -45663,45665,45666,45667,45668,45669,45670,45671,45674,45675,45676,45677,45678, -45679,45680,45681,45682,45683,45686,45687,45688,45689,45690,45691,45693,45694, -45695,45696,45697,45698,45699,45702,45703,45704,45706,45707,45708,45709,45710, -U,U,U,U,U,U,45711,45714,45715,45717,45718,45719,45723,45724,45725,45726,45727, -45730,45732,45735,45736,45737,45739,45741,45742,45743,45745,45746,45747,45749, -45750,45751,U,U,U,U,U,U,45752,45753,45754,45755,45756,45757,45758,45759,45760, -45761,45762,45763,45764,45765,45766,45767,45770,45771,45773,45774,45775,45777, -45779,45780,45781,45782,45783,45786,45788,45790,45791,45792,45793,45795,45799, -45801,45802,45808,45809,45810,45814,45820,45821,45822,45826,45827,45829,45830, -45831,45833,45834,45835,45836,45837,45838,45839,45842,45846,45847,45848,45849, -45850,45851,45853,45854,45855,45856,45857,45858,45859,45860,45861,45862,45863, -45864,45865,45866,45867,45868,45869,45870,45871,45872,45873,45874,45875,45876, -45877,45878,45879,45880,45881,45882,45883,45884,45885,45886,45887,45888,45889, -45890,45891,45892,45893,45894,45895,45896,45897,45898,45899,45900,45901,45902, -45903,45904,45905,45906,45907,45911,45913,45914,45917,45920,45921,45922,45923, -45926,45928,45930,45932,45933,45935,45938,45939,45941,45942,45943,45945,45946, -45947,45948,45949,45950,45951,45954,45958,45959,45960,45961,45962,45963,45965, -U,U,U,U,U,U,45966,45967,45969,45970,45971,45973,45974,45975,45976,45977,45978, -45979,45980,45981,45982,45983,45986,45987,45988,45989,45990,45991,45993,45994, -45995,45997,U,U,U,U,U,U,45998,45999,46000,46001,46002,46003,46004,46005,46006, -46007,46008,46009,46010,46011,46012,46013,46014,46015,46016,46017,46018,46019, -46022,46023,46025,46026,46029,46031,46033,46034,46035,46038,46040,46042,46044, -46046,46047,46049,46050,46051,46053,46054,46055,46057,46058,46059,46060,46061, -46062,46063,46064,46065,46066,46067,46068,46069,46070,46071,46072,46073,46074, -46075,46077,46078,46079,46080,46081,46082,46083,46084,46085,46086,46087,46088, -46089,46090,46091,46092,46093,46094,46095,46097,46098,46099,46100,46101,46102, -46103,46105,46106,46107,46109,46110,46111,46113,46114,46115,46116,46117,46118, -46119,46122,46124,46125,46126,46127,46128,46129,46130,46131,46133,46134,46135, -46136,46137,46138,46139,46140,46141,46142,46143,46144,46145,46146,46147,46148, -46149,46150,46151,46152,46153,46154,46155,46156,46157,46158,46159,46162,46163, -46165,46166,46167,46169,46170,46171,46172,46173,46174,46175,46178,46180,46182, -U,U,U,U,U,U,46183,46184,46185,46186,46187,46189,46190,46191,46192,46193,46194, -46195,46196,46197,46198,46199,46200,46201,46202,46203,46204,46205,46206,46207, -46209,46210,U,U,U,U,U,U,46211,46212,46213,46214,46215,46217,46218,46219,46220, -46221,46222,46223,46224,46225,46226,46227,46228,46229,46230,46231,46232,46233, -46234,46235,46236,46238,46239,46240,46241,46242,46243,46245,46246,46247,46249, -46250,46251,46253,46254,46255,46256,46257,46258,46259,46260,46262,46264,46266, -46267,46268,46269,46270,46271,46273,46274,46275,46277,46278,46279,46281,46282, -46283,46284,46285,46286,46287,46289,46290,46291,46292,46294,46295,46296,46297, -46298,46299,46302,46303,46305,46306,46309,46311,46312,46313,46314,46315,46318, -46320,46322,46323,46324,46325,46326,46327,46329,46330,46331,46332,46333,46334, -46335,46336,46337,46338,46339,46340,46341,46342,46343,46344,46345,46346,46347, -46348,46349,46350,46351,46352,46353,46354,46355,46358,46359,46361,46362,46365, -46366,46367,46368,46369,46370,46371,46374,46379,46380,46381,46382,46383,46386, -46387,46389,46390,46391,46393,46394,46395,46396,46397,46398,46399,46402,46406, -U,U,U,U,U,U,46407,46408,46409,46410,46414,46415,46417,46418,46419,46421,46422, -46423,46424,46425,46426,46427,46430,46434,46435,46436,46437,46438,46439,46440, -46441,46442,U,U,U,U,U,U,46443,46444,46445,46446,46447,46448,46449,46450,46451, -46452,46453,46454,46455,46456,46457,46458,46459,46460,46461,46462,46463,46464, -46465,46466,46467,46468,46469,46470,46471,46472,46473,46474,46475,46476,46477, -46478,46479,46480,46481,46482,46483,46484,46485,46486,46487,46488,46489,46490, -46491,46492,46493,46494,46495,46498,46499,46501,46502,46503,46505,46508,46509, -46510,46511,46514,46518,46519,46520,46521,46522,46526,46527,46529,46530,46531, -46533,46534,46535,46536,46537,46538,46539,46542,46546,46547,46548,46549,46550, -46551,46553,46554,46555,46556,46557,46558,46559,46560,46561,46562,46563,46564, -46565,46566,46567,46568,46569,46570,46571,46573,46574,46575,46576,46577,46578, -46579,46580,46581,46582,46583,46584,46585,46586,46587,46588,46589,46590,46591, -46592,46593,46594,46595,46596,46597,46598,46599,46600,46601,46602,46603,46604, -46605,46606,46607,46610,46611,46613,46614,46615,46617,46618,46619,46620,46621, -U,U,U,U,U,U,46622,46623,46624,46625,46626,46627,46628,46630,46631,46632,46633, -46634,46635,46637,46638,46639,46640,46641,46642,46643,46645,46646,46647,46648, -46649,46650,U,U,U,U,U,U,46651,46652,46653,46654,46655,46656,46657,46658,46659, -46660,46661,46662,46663,46665,46666,46667,46668,46669,46670,46671,46672,46673, -46674,46675,46676,46677,46678,46679,46680,46681,46682,46683,46684,46685,46686, -46687,46688,46689,46690,46691,46693,46694,46695,46697,46698,46699,46700,46701, -46702,46703,46704,46705,46706,46707,46708,46709,46710,46711,46712,46713,46714, -46715,46716,46717,46718,46719,46720,46721,46722,46723,46724,46725,46726,46727, -46728,46729,46730,46731,46732,46733,46734,46735,46736,46737,46738,46739,46740, -46741,46742,46743,46744,46745,46746,46747,46750,46751,46753,46754,46755,46757, -46758,46759,46760,46761,46762,46765,46766,46767,46768,46770,46771,46772,46773, -46774,46775,46776,46777,46778,46779,46780,46781,46782,46783,46784,46785,46786, -46787,46788,46789,46790,46791,46792,46793,46794,46795,46796,46797,46798,46799, -46800,46801,46802,46803,46805,46806,46807,46808,46809,46810,46811,46812,46813, -U,U,U,U,U,U,46814,46815,46816,46817,46818,46819,46820,46821,46822,46823,46824, -46825,46826,46827,46828,46829,46830,46831,46833,46834,46835,46837,46838,46839, -46841,46842,U,U,U,U,U,U,46843,46844,46845,46846,46847,46850,46851,46852,46854, -46855,46856,46857,46858,46859,46860,46861,46862,46863,46864,46865,46866,46867, -46868,46869,46870,46871,46872,46873,46874,46875,46876,46877,46878,46879,46880, -46881,46882,46883,46884,46885,46886,46887,46890,46891,46893,46894,46897,46898, -46899,46900,46901,46902,46903,46906,46908,46909,46910,46911,46912,46913,46914, -46915,46917,46918,46919,46921,46922,46923,46925,46926,46927,46928,46929,46930, -46931,46934,46935,46936,46937,46938,46939,46940,46941,46942,46943,46945,46946, -46947,46949,46950,46951,46953,46954,46955,46956,46957,46958,46959,46962,46964, -46966,46967,46968,46969,46970,46971,46974,46975,46977,46978,46979,46981,46982, -46983,46984,46985,46986,46987,46990,46995,46996,46997,47002,47003,47005,47006, -47007,47009,47010,47011,47012,47013,47014,47015,47018,47022,47023,47024,47025, -47026,47027,47030,47031,47033,47034,47035,47036,47037,47038,47039,47040,47041, -U,U,U,U,U,U,47042,47043,47044,47045,47046,47048,47050,47051,47052,47053,47054, -47055,47056,47057,47058,47059,47060,47061,47062,47063,47064,47065,47066,47067, -47068,47069,U,U,U,U,U,U,47070,47071,47072,47073,47074,47075,47076,47077,47078, -47079,47080,47081,47082,47083,47086,47087,47089,47090,47091,47093,47094,47095, -47096,47097,47098,47099,47102,47106,47107,47108,47109,47110,47114,47115,47117, -47118,47119,47121,47122,47123,47124,47125,47126,47127,47130,47132,47134,47135, -47136,47137,47138,47139,47142,47143,47145,47146,47147,47149,47150,47151,47152, -47153,47154,47155,47158,47162,47163,47164,47165,47166,47167,47169,47170,47171, -47173,47174,47175,47176,47177,47178,47179,47180,47181,47182,47183,47184,47186, -47188,47189,47190,47191,47192,47193,47194,47195,47198,47199,47201,47202,47203, -47205,47206,47207,47208,47209,47210,47211,47214,47216,47218,47219,47220,47221, -47222,47223,47225,47226,47227,47229,47230,47231,47232,47233,47234,47235,47236, -47237,47238,47239,47240,47241,47242,47243,47244,47246,47247,47248,47249,47250, -47251,47252,47253,47254,47255,47256,47257,47258,47259,47260,47261,47262,47263, -U,U,U,U,U,U,47264,47265,47266,47267,47268,47269,47270,47271,47273,47274,47275, -47276,47277,47278,47279,47281,47282,47283,47285,47286,47287,47289,47290,47291, -47292,47293,U,U,U,U,U,U,47294,47295,47298,47300,47302,47303,47304,47305,47306, -47307,47309,47310,47311,47313,47314,47315,47317,47318,47319,47320,47321,47322, -47323,47324,47326,47328,47330,47331,47332,47333,47334,47335,47338,47339,47341, -47342,47343,47345,47346,47347,47348,47349,47350,47351,47354,47356,47358,47359, -47360,47361,47362,47363,47365,47366,47367,47368,47369,47370,47371,47372,47373, -47374,47375,47376,47377,47378,47379,47380,47381,47382,47383,47385,47386,47387, -47388,47389,47390,47391,47393,47394,47395,47396,47397,47398,47399,47400,47401, -47402,47403,47404,47405,47406,47407,47408,47409,47410,47411,47412,47413,47414, -47415,47416,47417,47418,47419,47422,47423,47425,47426,47427,47429,47430,47431, -47432,47433,47434,47435,47437,47438,47440,47442,47443,47444,47445,47446,47447, -47450,47451,47453,47454,47455,47457,47458,47459,47460,47461,47462,47463,47466, -47468,47470,47471,47472,47473,47474,47475,47478,47479,47481,47482,47483,47485, -U,U,U,U,U,U,47486,47487,47488,47489,47490,47491,47494,47496,47499,47500,47503, -47504,47505,47506,47507,47508,47509,47510,47511,47512,47513,47514,47515,47516, -47517,47518,U,U,U,U,U,U,47519,47520,47521,47522,47523,47524,47525,47526,47527, -47528,47529,47530,47531,47534,47535,47537,47538,47539,47541,47542,47543,47544, -47545,47546,47547,47550,47552,47554,47555,47556,47557,47558,47559,47562,47563, -47565,47571,47572,47573,47574,47575,47578,47580,47583,47584,47586,47590,47591, -47593,47594,47595,47597,47598,47599,47600,47601,47602,47603,47606,47611,47612, -47613,47614,47615,47618,47619,47620,47621,47622,47623,47625,47626,47627,47628, -47629,47630,47631,47632,47633,47634,47635,47636,47638,47639,47640,47641,47642, -47643,47644,47645,47646,47647,47648,47649,47650,47651,47652,47653,47654,47655, -47656,47657,47658,47659,47660,47661,47662,47663,47664,47665,47666,47667,47668, -47669,47670,47671,47674,47675,47677,47678,47679,47681,47683,47684,47685,47686, -47687,47690,47692,47695,47696,47697,47698,47702,47703,47705,47706,47707,47709, -47710,47711,47712,47713,47714,47715,47718,47722,47723,47724,47725,47726,47727, -U,U,U,U,U,U,47730,47731,47733,47734,47735,47737,47738,47739,47740,47741,47742, -47743,47744,47745,47746,47750,47752,47753,47754,47755,47757,47758,47759,47760, -47761,47762,U,U,U,U,U,U,47763,47764,47765,47766,47767,47768,47769,47770,47771, -47772,47773,47774,47775,47776,47777,47778,47779,47780,47781,47782,47783,47786, -47789,47790,47791,47793,47795,47796,47797,47798,47799,47802,47804,47806,47807, -47808,47809,47810,47811,47813,47814,47815,47817,47818,47819,47820,47821,47822, -47823,47824,47825,47826,47827,47828,47829,47830,47831,47834,47835,47836,47837, -47838,47839,47840,47841,47842,47843,47844,47845,47846,47847,47848,47849,47850, -47851,47852,47853,47854,47855,47856,47857,47858,47859,47860,47861,47862,47863, -47864,47865,47866,47867,47869,47870,47871,47873,47874,47875,47877,47878,47879, -47880,47881,47882,47883,47884,47886,47888,47890,47891,47892,47893,47894,47895, -47897,47898,47899,47901,47902,47903,47905,47906,47907,47908,47909,47910,47911, -47912,47914,47916,47917,47918,47919,47920,47921,47922,47923,47927,47929,47930, -47935,47936,47937,47938,47939,47942,47944,47946,47947,47948,47950,47953,47954, -U,U,U,U,U,U,47955,47957,47958,47959,47961,47962,47963,47964,47965,47966,47967, -47968,47970,47972,47973,47974,47975,47976,47977,47978,47979,47981,47982,47983, -47984,47985,U,U,U,U,U,U,47986,47987,47988,47989,47990,47991,47992,47993,47994, -47995,47996,47997,47998,47999,48000,48001,48002,48003,48004,48005,48006,48007, -48009,48010,48011,48013,48014,48015,48017,48018,48019,48020,48021,48022,48023, -48024,48025,48026,48027,48028,48029,48030,48031,48032,48033,48034,48035,48037, -48038,48039,48041,48042,48043,48045,48046,48047,48048,48049,48050,48051,48053, -48054,48056,48057,48058,48059,48060,48061,48062,48063,48065,48066,48067,48069, -48070,48071,48073,48074,48075,48076,48077,48078,48079,48081,48082,48084,48085, -48086,48087,48088,48089,48090,48091,48092,48093,48094,48095,48096,48097,48098, -48099,48100,48101,48102,48103,48104,48105,48106,48107,48108,48109,48110,48111, -48112,48113,48114,48115,48116,48117,48118,48119,48122,48123,48125,48126,48129, -48131,48132,48133,48134,48135,48138,48142,48144,48146,48147,48153,48154,48160, -48161,48162,48163,48166,48168,48170,48171,48172,48174,48175,48178,48179,48181, -U,U,U,U,U,U,48182,48183,48185,48186,48187,48188,48189,48190,48191,48194,48198, -48199,48200,48202,48203,48206,48207,48209,48210,48211,48212,48213,48214,48215, -48216,48217,U,U,U,U,U,U,48218,48219,48220,48222,48223,48224,48225,48226,48227, -48228,48229,48230,48231,48232,48233,48234,48235,48236,48237,48238,48239,48240, -48241,48242,48243,48244,48245,48246,48247,48248,48249,48250,48251,48252,48253, -48254,48255,48256,48257,48258,48259,48262,48263,48265,48266,48269,48271,48272, -48273,48274,48275,48278,48280,48283,48284,48285,48286,48287,48290,48291,48293, -48294,48297,48298,48299,48300,48301,48302,48303,48306,48310,48311,48312,48313, -48314,48315,48318,48319,48321,48322,48323,48325,48326,48327,48328,48329,48330, -48331,48332,48334,48338,48339,48340,48342,48343,48345,48346,48347,48349,48350, -48351,48352,48353,48354,48355,48356,48357,48358,48359,48360,48361,48362,48363, -48364,48365,48366,48367,48368,48369,48370,48371,48375,48377,48378,48379,48381, -48382,48383,48384,48385,48386,48387,48390,48392,48394,48395,48396,48397,48398, -48399,48401,48402,48403,48405,48406,48407,48408,48409,48410,48411,48412,48413, -U,U,U,U,U,U,48414,48415,48416,48417,48418,48419,48421,48422,48423,48424,48425, -48426,48427,48429,48430,48431,48432,48433,48434,48435,48436,48437,48438,48439, -48440,48441,U,U,U,U,U,U,48442,48443,48444,48445,48446,48447,48449,48450,48451, -48452,48453,48454,48455,48458,48459,48461,48462,48463,48465,48466,48467,48468, -48469,48470,48471,48474,48475,48476,48477,48478,48479,48480,48481,48482,48483, -48485,48486,48487,48489,48490,48491,48492,48493,48494,48495,48496,48497,48498, -48499,48500,48501,48502,48503,48504,48505,48506,48507,48508,48509,48510,48511, -48514,48515,48517,48518,48523,48524,48525,48526,48527,48530,48532,48534,48535, -48536,48539,48541,48542,48543,48544,48545,48546,48547,48549,48550,48551,48552, -48553,48554,48555,48556,48557,48558,48559,48561,48562,48563,48564,48565,48566, -48567,48569,48570,48571,48572,48573,48574,48575,48576,48577,48578,48579,48580, -48581,48582,48583,48584,48585,48586,48587,48588,48589,48590,48591,48592,48593, -48594,48595,48598,48599,48601,48602,48603,48605,48606,48607,48608,48609,48610, -48611,48612,48613,48614,48615,48616,48618,48619,48620,48621,48622,48623,48625, -U,U,U,U,U,U,48626,48627,48629,48630,48631,48633,48634,48635,48636,48637,48638, -48639,48641,48642,48644,48646,48647,48648,48649,48650,48651,48654,48655,48657, -48658,48659,U,U,U,U,U,U,48661,48662,48663,48664,48665,48666,48667,48670,48672, -48673,48674,48675,48676,48677,48678,48679,48680,48681,48682,48683,48684,48685, -48686,48687,48688,48689,48690,48691,48692,48693,48694,48695,48696,48697,48698, -48699,48700,48701,48702,48703,48704,48705,48706,48707,48710,48711,48713,48714, -48715,48717,48719,48720,48721,48722,48723,48726,48728,48732,48733,48734,48735, -48738,48739,48741,48742,48743,48745,48747,48748,48749,48750,48751,48754,48758, -48759,48760,48761,48762,48766,48767,48769,48770,48771,48773,48774,48775,48776, -48777,48778,48779,48782,48786,48787,48788,48789,48790,48791,48794,48795,48796, -48797,48798,48799,48800,48801,48802,48803,48804,48805,48806,48807,48809,48810, -48811,48812,48813,48814,48815,48816,48817,48818,48819,48820,48821,48822,48823, -48824,48825,48826,48827,48828,48829,48830,48831,48832,48833,48834,48835,48836, -48837,48838,48839,48840,48841,48842,48843,48844,48845,48846,48847,48850,48851, -U,U,U,U,U,U,48853,48854,48857,48858,48859,48860,48861,48862,48863,48865,48866, -48870,48871,48872,48873,48874,48875,48877,48878,48879,48880,48881,48882,48883, -48884,48885,U,U,U,U,U,U,48886,48887,48888,48889,48890,48891,48892,48893,48894, -48895,48896,48898,48899,48900,48901,48902,48903,48906,48907,48908,48909,48910, -48911,48912,48913,48914,48915,48916,48917,48918,48919,48922,48926,48927,48928, -48929,48930,48931,48932,48933,48934,48935,48936,48937,48938,48939,48940,48941, -48942,48943,48944,48945,48946,48947,48948,48949,48950,48951,48952,48953,48954, -48955,48956,48957,48958,48959,48962,48963,48965,48966,48967,48969,48970,48971, -48972,48973,48974,48975,48978,48979,48980,48982,48983,48984,48985,48986,48987, -48988,48989,48990,48991,48992,48993,48994,48995,48996,48997,48998,48999,49000, -49001,49002,49003,49004,49005,49006,49007,49008,49009,49010,49011,49012,49013, -49014,49015,49016,49017,49018,49019,49020,49021,49022,49023,49024,49025,49026, -49027,49028,49029,49030,49031,49032,49033,49034,49035,49036,49037,49038,49039, -49040,49041,49042,49043,49045,49046,49047,49048,49049,49050,49051,49052,49053, -U,U,U,U,U,U,49054,49055,49056,49057,49058,49059,49060,49061,49062,49063,49064, -49065,49066,49067,49068,49069,49070,49071,49073,49074,49075,49076,49077,49078, -49079,49080,U,U,U,U,U,U,49081,49082,49083,49084,49085,49086,49087,49088,49089, -49090,49091,49092,49094,49095,49096,49097,49098,49099,49102,49103,49105,49106, -49107,49109,49110,49111,49112,49113,49114,49115,49117,49118,49120,49122,49123, -49124,49125,49126,49127,49128,49129,49130,49131,49132,49133,49134,49135,49136, -49137,49138,49139,49140,49141,49142,49143,49144,49145,49146,49147,49148,49149, -49150,49151,49152,49153,49154,49155,49156,49157,49158,49159,49160,49161,49162, -49163,49164,49165,49166,49167,49168,49169,49170,49171,49172,49173,49174,49175, -49176,49177,49178,49179,49180,49181,49182,49183,49184,49185,49186,49187,49188, -49189,49190,49191,49192,49193,49194,49195,49196,49197,49198,49199,49200,49201, -49202,49203,49204,49205,49206,49207,49208,49209,49210,49211,49213,49214,49215, -49216,49217,49218,49219,49220,49221,49222,49223,49224,49225,49226,49227,49228, -49229,49230,49231,49232,49234,49235,49236,49237,49238,49239,49241,49242,49243, -U,U,U,U,U,U,49245,49246,49247,49249,49250,49251,49252,49253,49254,49255,49258, -49259,49260,49261,49262,49263,49264,49265,49266,49267,49268,49269,49270,49271, -49272,49273,U,U,U,U,U,U,49274,49275,49276,49277,49278,49279,49280,49281,49282, -49283,49284,49285,49286,49287,49288,49289,49290,49291,49292,49293,49294,49295, -49298,49299,49301,49302,49303,49305,49306,49307,49308,49309,49310,49311,49314, -49316,49318,49319,49320,49321,49322,49323,49326,49329,49330,49335,49336,49337, -49338,49339,49342,49346,49347,49348,49350,49351,49354,49355,49357,49358,49359, -49361,49362,49363,49364,49365,49366,49367,49370,49374,49375,49376,49377,49378, -49379,49382,49383,49385,49386,49387,49389,49390,49391,49392,49393,49394,49395, -49398,49400,49402,49403,49404,49405,49406,49407,49409,49410,49411,49413,49414, -49415,49417,49418,49419,49420,49421,49422,49423,49425,49426,49427,49428,49430, -49431,49432,49433,49434,49435,49441,49442,49445,49448,49449,49450,49451,49454, -49458,49459,49460,49461,49463,49466,49467,49469,49470,49471,49473,49474,49475, -49476,49477,49478,49479,49482,49486,49487,49488,49489,49490,49491,49494,49495, -U,U,U,U,U,U,49497,49498,49499,49501,49502,49503,49504,49505,49506,49507,49510, -49514,49515,49516,49517,49518,49519,49521,49522,49523,49525,49526,49527,49529, -49530,49531,U,U,U,U,U,U,49532,49533,49534,49535,49536,49537,49538,49539,49540, -49542,49543,49544,49545,49546,49547,49551,49553,49554,49555,49557,49559,49560, -49561,49562,49563,49566,49568,49570,49571,49572,49574,49575,49578,49579,49581, -49582,49583,49585,49586,49587,49588,49589,49590,49591,49592,49593,49594,49595, -49596,49598,49599,49600,49601,49602,49603,49605,49606,49607,49609,49610,49611, -49613,49614,49615,49616,49617,49618,49619,49621,49622,49625,49626,49627,49628, -49629,49630,49631,49633,49634,49635,49637,49638,49639,49641,49642,49643,49644, -49645,49646,49647,49650,49652,49653,49654,49655,49656,49657,49658,49659,49662, -49663,49665,49666,49667,49669,49670,49671,49672,49673,49674,49675,49678,49680, -49682,49683,49684,49685,49686,49687,49690,49691,49693,49694,49697,49698,49699, -49700,49701,49702,49703,49706,49708,49710,49712,49715,49717,49718,49719,49720, -49721,49722,49723,49724,49725,49726,49727,49728,49729,49730,49731,49732,49733, -U,U,U,U,U,U,49734,49735,49737,49738,49739,49740,49741,49742,49743,49746,49747, -49749,49750,49751,49753,49754,49755,49756,49757,49758,49759,49761,49762,49763, -49764,49766,U,U,U,U,U,U,49767,49768,49769,49770,49771,49774,49775,49777,49778, -49779,49781,49782,49783,49784,49785,49786,49787,49790,49792,49794,49795,49796, -49797,49798,49799,49802,49803,49804,49805,49806,49807,49809,49810,49811,49812, -49813,49814,49815,49817,49818,49820,49822,49823,49824,49825,49826,49827,49830, -49831,49833,49834,49835,49838,49839,49840,49841,49842,49843,49846,49848,49850, -49851,49852,49853,49854,49855,49856,49857,49858,49859,49860,49861,49862,49863, -49864,49865,49866,49867,49868,49869,49870,49871,49872,49873,49874,49875,49876, -49877,49878,49879,49880,49881,49882,49883,49886,49887,49889,49890,49893,49894, -49895,49896,49897,49898,49902,49904,49906,49907,49908,49909,49911,49914,49917, -49918,49919,49921,49922,49923,49924,49925,49926,49927,49930,49931,49934,49935, -49936,49937,49938,49942,49943,49945,49946,49947,49949,49950,49951,49952,49953, -49954,49955,49958,49959,49962,49963,49964,49965,49966,49967,49968,49969,49970, -U,U,U,U,U,U,49971,49972,49973,49974,49975,49976,49977,49978,49979,49980,49981, -49982,49983,49984,49985,49986,49987,49988,49990,49991,49992,49993,49994,49995, -49996,49997,U,U,U,U,U,U,49998,49999,50000,50001,50002,50003,50004,50005,50006, -50007,50008,50009,50010,50011,50012,50013,50014,50015,50016,50017,50018,50019, -50020,50021,50022,50023,50026,50027,50029,50030,50031,50033,50035,50036,50037, -50038,50039,50042,50043,50046,50047,50048,50049,50050,50051,50053,50054,50055, -50057,50058,50059,50061,50062,50063,50064,50065,50066,50067,50068,50069,50070, -50071,50072,50073,50074,50075,50076,50077,50078,50079,50080,50081,50082,50083, -50084,50085,50086,50087,50088,50089,50090,50091,50092,50093,50094,50095,50096, -50097,50098,50099,50100,50101,50102,50103,50104,50105,50106,50107,50108,50109, -50110,50111,50113,50114,50115,50116,50117,50118,50119,50120,50121,50122,50123, -50124,50125,50126,50127,50128,50129,50130,50131,50132,50133,50134,50135,50138, -50139,50141,50142,50145,50147,50148,50149,50150,50151,50154,50155,50156,50158, -50159,50160,50161,50162,50163,50166,50167,50169,50170,50171,50172,50173,50174, -U,U,U,U,U,U,50175,50176,50177,50178,50179,50180,50181,50182,50183,50185,50186, -50187,50188,50189,50190,50191,50193,50194,50195,50196,50197,50198,50199,50200, -50201,50202,U,U,U,U,U,U,50203,50204,50205,50206,50207,50208,50209,50210,50211, -50213,50214,50215,50216,50217,50218,50219,50221,50222,50223,50225,50226,50227, -50229,50230,50231,50232,50233,50234,50235,50238,50239,50240,50241,50242,50243, -50244,50245,50246,50247,50249,50250,50251,50252,50253,50254,50255,50256,50257, -50258,50259,50260,50261,50262,50263,50264,50265,50266,50267,50268,50269,50270, -50271,50272,50273,50274,50275,50278,50279,50281,50282,50283,50285,50286,50287, -50288,50289,50290,50291,50294,50295,50296,50298,50299,50300,50301,50302,50303, -50305,50306,50307,50308,50309,50310,50311,50312,50313,50314,50315,50316,50317, -50318,50319,50320,50321,50322,50323,50325,50326,50327,50328,50329,50330,50331, -50333,50334,50335,50336,50337,50338,50339,50340,50341,50342,50343,50344,50345, -50346,50347,50348,50349,50350,50351,50352,50353,50354,50355,50356,50357,50358, -50359,50361,50362,50363,50365,50366,50367,50368,50369,50370,50371,50372,50373, -U,U,U,U,U,U,50374,50375,50376,50377,50378,50379,50380,50381,50382,50383,50384, -50385,50386,50387,50388,50389,50390,50391,50392,50393,50394,50395,50396,50397, -50398,50399,U,U,U,U,U,U,50400,50401,50402,50403,50404,50405,50406,50407,50408, -50410,50411,50412,50413,50414,50415,50418,50419,50421,50422,50423,50425,50427, -50428,50429,50430,50434,50435,50436,50437,50438,50439,50440,50441,50442,50443, -50445,50446,50447,50449,50450,50451,50453,50454,50455,50456,50457,50458,50459, -50461,50462,50463,50464,50465,50466,50467,50468,50469,50470,50471,50474,50475, -50477,50478,50479,50481,50482,50483,50484,50485,50486,50487,50490,50492,50494, -50495,50496,50497,50498,50499,50502,50503,50507,50511,50512,50513,50514,50518, -50522,50523,50524,50527,50530,50531,50533,50534,50535,50537,50538,50539,50540, -50541,50542,50543,50546,50550,50551,50552,50553,50554,50555,50558,50559,50561, -50562,50563,50565,50566,50568,50569,50570,50571,50574,50576,50578,50579,50580, -50582,50585,50586,50587,50589,50590,50591,50593,50594,50595,50596,50597,50598, -50599,50600,50602,50603,50604,50605,50606,50607,50608,50609,50610,50611,50614, -U,U,U,U,U,U,50615,50618,50623,50624,50625,50626,50627,50635,50637,50639,50642, -50643,50645,50646,50647,50649,50650,50651,50652,50653,50654,50655,50658,50660, -50662,50663,U,U,U,U,U,U,50664,50665,50666,50667,50671,50673,50674,50675,50677, -50680,50681,50682,50683,50690,50691,50692,50697,50698,50699,50701,50702,50703, -50705,50706,50707,50708,50709,50710,50711,50714,50717,50718,50719,50720,50721, -50722,50723,50726,50727,50729,50730,50731,50735,50737,50738,50742,50744,50746, -50748,50749,50750,50751,50754,50755,50757,50758,50759,50761,50762,50763,50764, -50765,50766,50767,50770,50774,50775,50776,50777,50778,50779,50782,50783,50785, -50786,50787,50788,50789,50790,50791,50792,50793,50794,50795,50797,50798,50800, -50802,50803,50804,50805,50806,50807,50810,50811,50813,50814,50815,50817,50818, -50819,50820,50821,50822,50823,50826,50828,50830,50831,50832,50833,50834,50835, -50838,50839,50841,50842,50843,50845,50846,50847,50848,50849,50850,50851,50854, -50856,50858,50859,50860,50861,50862,50863,50866,50867,50869,50870,50871,50875, -50876,50877,50878,50879,50882,50884,50886,50887,50888,50889,50890,50891,50894, -U,U,U,U,U,U,50895,50897,50898,50899,50901,50902,50903,50904,50905,50906,50907, -50910,50911,50914,50915,50916,50917,50918,50919,50922,50923,50925,50926,50927, -50929,50930,U,U,U,U,U,U,50931,50932,50933,50934,50935,50938,50939,50940,50942, -50943,50944,50945,50946,50947,50950,50951,50953,50954,50955,50957,50958,50959, -50960,50961,50962,50963,50966,50968,50970,50971,50972,50973,50974,50975,50978, -50979,50981,50982,50983,50985,50986,50987,50988,50989,50990,50991,50994,50996, -50998,51000,51001,51002,51003,51006,51007,51009,51010,51011,51013,51014,51015, -51016,51017,51019,51022,51024,51033,51034,51035,51037,51038,51039,51041,51042, -51043,51044,51045,51046,51047,51049,51050,51052,51053,51054,51055,51056,51057, -51058,51059,51062,51063,51065,51066,51067,51071,51072,51073,51074,51078,51083, -51084,51085,51087,51090,51091,51093,51097,51099,51100,51101,51102,51103,51106, -51111,51112,51113,51114,51115,51118,51119,51121,51122,51123,51125,51126,51127, -51128,51129,51130,51131,51134,51138,51139,51140,51141,51142,51143,51146,51147, -51149,51151,51153,51154,51155,51156,51157,51158,51159,51161,51162,51163,51164, -U,U,U,U,U,U,51166,51167,51168,51169,51170,51171,51173,51174,51175,51177,51178, -51179,51181,51182,51183,51184,51185,51186,51187,51188,51189,51190,51191,51192, -51193,51194,U,U,U,U,U,U,51195,51196,51197,51198,51199,51202,51203,51205,51206, -51207,51209,51211,51212,51213,51214,51215,51218,51220,51223,51224,51225,51226, -51227,51230,51231,51233,51234,51235,51237,51238,51239,51240,51241,51242,51243, -51246,51248,51250,51251,51252,51253,51254,51255,51257,51258,51259,51261,51262, -51263,51265,51266,51267,51268,51269,51270,51271,51274,51275,51278,51279,51280, -51281,51282,51283,51285,51286,51287,51288,51289,51290,51291,51292,51293,51294, -51295,51296,51297,51298,51299,51300,51301,51302,51303,51304,51305,51306,51307, -51308,51309,51310,51311,51314,51315,51317,51318,51319,51321,51323,51324,51325, -51326,51327,51330,51332,51336,51337,51338,51342,51343,51344,51345,51346,51347, -51349,51350,51351,51352,51353,51354,51355,51356,51358,51360,51362,51363,51364, -51365,51366,51367,51369,51370,51371,51372,51373,51374,51375,51376,51377,51378, -51379,51380,51381,51382,51383,51384,51385,51386,51387,51390,51391,51392,51393, -U,U,U,U,U,U,51394,51395,51397,51398,51399,51401,51402,51403,51405,51406,51407, -51408,51409,51410,51411,51414,51416,51418,51419,51420,51421,51422,51423,51426, -51427,51429,U,U,U,U,U,U,51430,51431,51432,51433,51434,51435,51436,51437,51438, -51439,51440,51441,51442,51443,51444,51446,51447,51448,51449,51450,51451,51454, -51455,51457,51458,51459,51463,51464,51465,51466,51467,51470,51472,51474,51475, -51476,51477,51478,51479,51481,51482,51483,51484,51485,51486,51487,51488,51489, -51490,51491,51492,51493,51494,51495,51496,51497,51498,51499,U,U,U,U,U,U,51501, -51502,51503,51504,51505,51506,51507,51509,51510,51511,51512,51513,51514,51515, -51516,51517,51518,51519,51520,51521,51522,51523,51524,51525,51526,51527,U,U,U, -U,U,U,51528,51529,51530,51531,51532,51533,51534,51535,51538,51539,51541,51542, -51543,51545,51546,51547,51548,51549,51550,51551,51554,51556,51557,51558,51559, -51560,51561,51562,51563,51565,51566,51567,51569,51570,51571,51573,51574,51575, -51576,51577,51578,51579,51581,51582,51583,51584,51585,51586,51587,51588,51589, -51590,51591,51594,51595,51597,51598,51599,U,U,U,U,U,U,51601,51602,51603,51604, -51605,51606,51607,51610,51612,51614,51615,51616,51617,51618,51619,51620,51621, -51622,51623,51624,51625,51626,51627,51628,51629,51630,U,U,U,U,U,U,51631,51632, -51633,51634,51635,51636,51637,51638,51639,51640,51641,51642,51643,51644,51645, -51646,51647,51650,51651,51653,51654,51657,51659,51660,51661,51662,51663,51666, -51668,51671,51672,51675,51678,51679,51681,51683,51685,51686,51688,51689,51690, -51691,51694,51698,51699,51700,51701,51702,51703,51706,51707,51709,51710,51711, -51713,51714,51715,51716,U,U,U,U,U,U,51717,51718,51719,51722,51726,51727,51728, -51729,51730,51731,51733,51734,51735,51737,51738,51739,51740,51741,51742,51743, -51744,51745,51746,51747,51748,51749,U,U,U,U,U,U,51750,51751,51752,51754,51755, -51756,51757,51758,51759,51760,51761,51762,51763,51764,51765,51766,51767,51768, -51769,51770,51771,51772,51773,51774,51775,51776,51777,51778,51779,51780,51781, -51782,51783,51784,51785,51786,51787,51790,51791,51793,51794,51795,51797,51798, -51799,51800,51801,51802,51803,51806,51810,51811,51812,51813,51814,51815,51817, -51818,U,U,U,U,U,U,51819,51820,51821,51822,51823,51824,51825,51826,51827,51828, -51829,51830,51831,51832,51833,51834,51835,51836,51838,51839,51840,51841,51842, -51843,51845,51846,U,U,U,U,U,U,51847,51848,51849,51850,51851,51852,51853,51854, -51855,51856,51857,51858,51859,51860,51861,51862,51863,51865,51866,51867,51868, -51869,51870,51871,51872,51873,51874,51875,51876,51877,51878,51879,51880,51881, -51882,51883,51884,51885,51886,51887,51888,51889,51890,51891,51892,51893,51894, -51895,51896,51897,51898,51899,51902,51903,51905,51906,51907,51909,U,U,U,U,U,U, -51910,51911,51912,51913,51914,51915,51918,51920,51922,51924,51925,51926,51927, -51930,51931,51932,51933,51934,51935,51937,51938,51939,51940,51941,51942,51943, -U,U,U,U,U,U,51944,51945,51946,51947,51949,51950,51951,51952,51953,51954,51955, -51957,51958,51959,51960,51961,51962,51963,51964,51965,51966,51967,51968,51969, -51970,51971,51972,51973,51974,51975,51977,51978,51979,51980,51981,51982,51983, -51985,51986,51987,51989,51990,51991,51993,51994,51995,51996,51997,51998,51999, -52002,52003,52004,52005,52006,52007,52008,52009,U,U,U,U,U,U,52010,52011,52012, -52013,52014,52015,52016,52017,52018,52019,52020,52021,52022,52023,52024,52025, -52026,52027,52028,52029,52030,52031,52032,52034,52035,52036,U,U,U,U,U,U,52037, -52038,52039,52042,52043,52045,52046,52047,52049,52050,52051,52052,52053,52054, -52055,52058,52059,52060,52062,52063,52064,52065,52066,52067,52069,52070,52071, -52072,52073,52074,52075,52076,52077,52078,52079,52080,52081,52082,52083,52084, -52085,52086,52087,52090,52091,52092,52093,52094,52095,52096,52097,52098,52099, -52100,52101,52102,52103,52104,U,U,U,U,U,U,52105,52106,52107,52108,52109,52110, -52111,52112,52113,52114,52115,52116,52117,52118,52119,52120,52121,52122,52123, -52125,52126,52127,52128,52129,52130,52131,U,U,U,U,U,U,52132,52133,52134,52135, -52136,52137,52138,52139,52140,52141,52142,52143,52144,52145,52146,52147,52148, -52149,52150,52151,52153,52154,52155,52156,52157,52158,52159,52160,52161,52162, -52163,52164,52165,52166,52167,52168,52169,52170,52171,52172,52173,52174,52175, -52176,52177,52178,52179,52181,52182,52183,52184,52185,52186,52187,52188,52189, -52190,52191,U,U,U,U,U,U,52192,52193,52194,52195,52197,52198,52200,52202,52203, -52204,52205,52206,52207,52208,52209,52210,52211,52212,52213,52214,52215,52216, -52217,52218,52219,52220,U,U,U,U,U,U,52221,52222,52223,52224,52225,52226,52227, -52228,52229,52230,52231,52232,52233,52234,52235,52238,52239,52241,52242,52243, -52245,52246,52247,52248,52249,52250,52251,52254,52255,52256,52259,52260,52261, -52262,52266,52267,52269,52271,52273,52274,52275,52276,52277,52278,52279,52282, -52287,52288,52289,52290,52291,52294,52295,52297,52298,52299,52301,52302,U,U,U, -U,U,U,52303,52304,52305,52306,52307,52310,52314,52315,52316,52317,52318,52319, -52321,52322,52323,52325,52327,52329,52330,52331,52332,52333,52334,52335,52337, -52338,U,U,U,U,U,U,52339,52340,52342,52343,52344,52345,52346,52347,52348,52349, -52350,52351,52352,52353,52354,52355,52356,52357,52358,52359,52360,52361,52362, -52363,52364,52365,52366,52367,52368,52369,52370,52371,52372,52373,52374,52375, -52378,52379,52381,52382,52383,52385,52386,52387,52388,52389,52390,52391,52394, -52398,52399,52400,52401,52402,52403,52406,52407,52409,U,U,U,U,U,U,52410,52411, -52413,52414,52415,52416,52417,52418,52419,52422,52424,52426,52427,52428,52429, -52430,52431,52433,52434,52435,52437,52438,52439,52440,52441,52442,U,U,U,U,U,U, -52443,52444,52445,52446,52447,52448,52449,52450,52451,52453,52454,52455,52456, -52457,52458,52459,52461,52462,52463,52465,52466,52467,52468,52469,52470,52471, -52472,52473,52474,52475,52476,52477,52478,52479,52480,52482,52483,52484,52485, -52486,52487,52490,52491,52493,52494,52495,52497,52498,52499,52500,52501,52502, -52503,52506,52508,52510,52511,52512,U,U,U,U,U,U,52513,52514,52515,52517,52518, -52519,52521,52522,52523,52525,52526,52527,52528,52529,52530,52531,52532,52533, -52534,52535,52536,52538,52539,52540,52541,52542,U,U,U,U,U,U,52543,52544,52545, -52546,52547,52548,52549,52550,52551,52552,52553,52554,52555,52556,52557,52558, -52559,52560,52561,52562,52563,52564,52565,52566,52567,52568,52569,52570,52571, -52573,52574,52575,52577,52578,52579,52581,52582,52583,52584,52585,52586,52587, -52590,52592,52594,52595,52596,52597,52598,52599,52601,52602,52603,52604,52605, -52606,52607,52608,U,U,U,U,U,U,52609,52610,52611,52612,52613,52614,52615,52617, -52618,52619,52620,52621,52622,52623,52624,52625,52626,52627,52630,52631,52633, -52634,52635,52637,52638,52639,U,U,U,U,U,U,52640,52641,52642,52643,52646,52648, -52650,52651,52652,52653,52654,52655,52657,52658,52659,52660,52661,52662,52663, -52664,52665,52666,52667,52668,52669,52670,52671,52672,52673,52674,52675,52677, -52678,52679,52680,52681,52682,52683,52685,52686,52687,52689,52690,52691,52692, -52693,52694,52695,52696,52697,52698,52699,52700,52701,52702,52703,52704,52705, -U,U,U,U,U,U,52706,52707,52708,52709,52710,52711,52713,52714,52715,52717,52718, -52719,52721,52722,52723,52724,52725,52726,52727,52730,52732,52734,52735,52736, -52737,52738,U,U,U,U,U,U,52739,52741,52742,52743,52745,52746,52747,52749,52750, -52751,52752,52753,52754,52755,52757,52758,52759,52760,52762,52763,52764,52765, -52766,52767,52770,52771,52773,52774,52775,52777,52778,52779,52780,52781,52782, -52783,52786,52788,52790,52791,52792,52793,52794,52795,52796,52797,52798,52799, -52800,52801,52802,52803,52804,52805,52806,52807,52808,52809,U,U,U,U,U,U,52810, -52811,52812,52813,52814,52815,52816,52817,52818,52819,52820,52821,52822,52823, -52826,52827,52829,52830,52834,52835,52836,52837,52838,52839,52842,52844,U,U,U, -U,U,U,52846,52847,52848,52849,52850,52851,52854,52855,52857,52858,52859,52861, -52862,52863,52864,52865,52866,52867,52870,52872,52874,52875,52876,52877,52878, -52879,52882,52883,52885,52886,52887,52889,52890,52891,52892,52893,52894,52895, -52898,52902,52903,52904,52905,52906,52907,52910,52911,52912,52913,52914,52915, -52916,52917,52918,52919,52920,52921,52922,U,U,U,U,U,U,52923,52924,52925,52926, -52927,52928,52930,52931,52932,52933,52934,52935,52936,52937,52938,52939,52940, -52941,52942,52943,52944,52945,52946,52947,52948,52949,U,U,U,U,U,U,52950,52951, -52952,52953,52954,52955,52956,52957,52958,52959,52960,52961,52962,52963,52966, -52967,52969,52970,52973,52974,52975,52976,52977,52978,52979,52982,52986,52987, -52988,52989,52990,52991,52994,52995,52997,52998,52999,53001,53002,53003,53004, -53005,53006,53007,53010,53012,53014,53015,53016,53017,53018,53019,53021,53022, -53023,53025,53026,53027,U,U,U,U,U,U,53029,53030,53031,53032,53033,53034,53035, -53038,53042,53043,53044,53045,53046,53047,53049,53050,53051,53052,53053,53054, -53055,53056,53057,53058,53059,53060,U,U,U,U,U,U,53061,53062,53063,53064,53065, -53066,53067,53068,53069,53070,53071,53072,53073,53074,53075,53078,53079,53081, -53082,53083,53085,53086,53087,53088,53089,53090,53091,53094,53096,53098,53099, -53100,53101,53102,53103,53106,53107,53109,53110,53111,53113,53114,53115,53116, -53117,53118,53119,53121,53122,53123,53124,53126,53127,53128,53129,53130,53131, -53133,U,U,U,U,U,U,53134,53135,53136,53137,53138,53139,53140,53141,53142,53143, -53144,53145,53146,53147,53148,53149,53150,53151,53152,53154,53155,53156,53157, -53158,53159,53161,U,U,U,U,U,U,53162,53163,53164,53165,53166,53167,53169,53170, -53171,53172,53173,53174,53175,53176,53177,53178,53179,53180,53181,53182,53183, -53184,53185,53186,53187,53189,53190,53191,53192,53193,53194,53195,53196,53197, -53198,53199,53200,53201,53202,53203,53204,53205,53206,53207,53208,53209,53210, -53211,53212,53213,53214,53215,53218,53219,53221,53222,53223,53225,U,U,U,U,U,U, -53226,53227,53228,53229,53230,53231,53234,53236,53238,53239,53240,53241,53242, -53243,53245,53246,53247,53249,53250,53251,53253,53254,53255,53256,53257,53258, -U,U,U,U,U,U,53259,53260,53261,53262,53263,53264,53266,53267,53268,53269,53270, -53271,53273,53274,53275,53276,53277,53278,53279,53280,53281,53282,53283,53284, -53285,53286,53287,53288,53289,53290,53291,53292,53294,53295,53296,53297,53298, -53299,53302,53303,53305,53306,53307,53309,53310,53311,53312,53313,53314,53315, -53318,53320,53322,53323,53324,53325,53326,53327,U,U,U,U,U,U,53329,53330,53331, -53333,53334,53335,53337,53338,53339,53340,53341,53342,53343,53345,53346,53347, -53348,53349,53350,53351,53352,53353,53354,53355,53358,53359,U,U,U,U,U,U,53361, -53362,53363,53365,53366,53367,53368,53369,53370,53371,53374,53375,53376,53378, -53379,53380,53381,53382,53383,53384,53385,53386,53387,53388,53389,53390,53391, -53392,53393,53394,53395,53396,53397,53398,53399,53400,53401,53402,53403,53404, -53405,53406,53407,53408,53409,53410,53411,53414,53415,53417,53418,53419,53421, -53422,53423,53424,53425,53426,U,U,U,U,U,U,53427,53430,53432,53434,53435,53436, -53437,53438,53439,53442,53443,53445,53446,53447,53450,53451,53452,53453,53454, -53455,53458,53462,53463,53464,53465,53466,U,U,U,U,U,U,53467,53470,53471,53473, -53474,53475,53477,53478,53479,53480,53481,53482,53483,53486,53490,53491,53492, -53493,53494,53495,53497,53498,53499,53500,53501,53502,53503,53504,53505,53506, -53507,53508,53509,53510,53511,53512,53513,53514,53515,53516,53518,53519,53520, -53521,53522,53523,53524,53525,53526,53527,53528,53529,53530,53531,53532,53533, -53534,53535,U,U,U,U,U,U,53536,53537,53538,53539,53540,53541,53542,53543,53544, -53545,53546,53547,53548,53549,53550,53551,53554,53555,53557,53558,53559,53561, -53563,53564,53565,53566,U,U,U,U,U,U,53567,53570,53574,53575,53576,53577,53578, -53579,53582,53583,53585,53586,53587,53589,53590,53591,53592,53593,53594,53595, -53598,53600,53602,53603,53604,53605,53606,53607,53609,53610,53611,53613,53614, -53615,53616,53617,53618,53619,53620,53621,53622,53623,53624,53625,53626,53627, -53629,53630,53631,53632,53633,53634,53635,53637,53638,53639,53641,53642,U,U,U, -U,U,U,53643,53644,53645,53646,53647,53648,53649,53650,53651,53652,53653,53654, -53655,53656,53657,53658,53659,53660,53661,53662,53663,53666,53667,53669,53670, -53671,U,U,U,U,U,U,53673,53674,53675,53676,53677,53678,53679,53682,53684,53686, -53687,53688,53689,53691,53693,53694,53695,53697,53698,53699,53700,53701,53702, -53703,53704,53705,53706,53707,53708,53709,53710,53711,53712,53713,53714,53715, -53716,53717,53718,53719,53721,53722,53723,53724,53725,53726,53727,53728,53729, -53730,53731,53732,53733,53734,53735,53736,53737,53738,U,U,U,U,U,U,53739,53740, -53741,53742,53743,53744,53745,53746,53747,53749,53750,53751,53753,53754,53755, -53756,53757,53758,53759,53760,53761,53762,53763,53764,53765,53766,U,U,U,U,U,U, -53768,53770,53771,53772,53773,53774,53775,53777,53778,53779,53780,53781,53782, -53783,53784,53785,53786,53787,53788,53789,53790,53791,53792,53793,53794,53795, -53796,53797,53798,53799,53800,53801,53802,53803,53806,53807,53809,53810,53811, -53813,53814,53815,53816,53817,53818,53819,53822,53824,53826,53827,53828,53829, -53830,53831,53833,53834,53835,53836,U,U,U,U,U,U,53837,53838,53839,53840,53841, -53842,53843,53844,53845,53846,53847,53848,53849,53850,53851,53853,53854,53855, -53856,53857,53858,53859,53861,53862,53863,53864,U,U,U,U,U,U,53865,53866,53867, -53868,53869,53870,53871,53872,53873,53874,53875,53876,53877,53878,53879,53880, -53881,53882,53883,53884,53885,53886,53887,53890,53891,53893,53894,53895,53897, -53898,53899,53900,53901,53902,53903,53906,53907,53908,53910,53911,53912,53913, -53914,53915,53917,53918,53919,53921,53922,53923,53925,53926,53927,53928,53929, -53930,53931,53933,U,U,U,U,U,U,53934,53935,53936,53938,53939,53940,53941,53942, -53943,53946,53947,53949,53950,53953,53955,53956,53957,53958,53959,53962,53964, -53965,53966,53967,53968,53969,U,U,U,U,U,U,53970,53971,53973,53974,53975,53977, -53978,53979,53981,53982,53983,53984,53985,53986,53987,53990,53991,53992,53993, -53994,53995,53996,53997,53998,53999,54002,54003,54005,54006,54007,54009,54010, -54011,54012,54013,54014,54015,54018,54020,54022,54023,54024,54025,54026,54027, -54031,54033,54034,54035,54037,54039,54040,54041,54042,54043,54046,54050,54051, -U,U,U,U,U,U,54052,54054,54055,54058,54059,54061,54062,54063,54065,54066,54067, -54068,54069,54070,54071,54074,54078,54079,54080,54081,54082,54083,54086,54087, -54088,54089,U,U,U,U,U,U,54090,54091,54092,54093,54094,54095,54096,54097,54098, -54099,54100,54101,54102,54103,54104,54105,54106,54107,54108,54109,54110,54111, -54112,54113,54114,54115,54116,54117,54118,54119,54120,54121,54122,54123,54124, -54125,54126,54127,54128,54129,54130,54131,54132,54133,54134,54135,54136,54137, -54138,54139,54142,54143,54145,54146,54147,54149,54150,54151,U,U,U,U,U,U,54152, -54153,54154,54155,54158,54162,54163,54164,54165,54166,54167,54170,54171,54173, -54174,54175,54177,54178,54179,54180,54181,54182,54183,54186,54188,54190,U,U,U, -U,U,U,54191,54192,54193,54194,54195,54197,54198,54199,54201,54202,54203,54205, -54206,54207,54208,54209,54210,54211,54214,54215,54218,54219,54220,54221,54222, -54223,54225,54226,54227,54228,54229,54230,54231,54233,54234,54235,54236,54237, -54238,54239,54240,54242,54244,54245,54246,54247,54248,54249,54250,54251,54254, -54255,54257,54258,54259,54261,54262,54263,U,U,U,U,U,U,54264,54265,54266,54267, -54270,54272,54274,54275,54276,54277,54278,54279,54281,54282,54283,54284,54285, -54286,54287,54288,54289,54290,54291,54292,54293,54294,U,U,U,U,U,U,54295,54296, -54297,54298,54299,54300,54302,54303,54304,54305,54306,54307,54308,54309,54310, -54311,54312,54313,54314,54315,54316,54317,54318,54319,54320,54321,54322,54323, -54324,54325,54326,54327,54328,54329,54330,54331,54332,54333,54334,54335,54337, -54338,54339,54341,54342,54343,54344,54345,54346,54347,54348,54349,54350,54351, -54352,54353,54354,54355,U,U,U,U,U,U,54356,54357,54358,54359,54360,54361,54362, -54363,54365,54366,54367,54369,54370,54371,54373,54374,54375,54376,54377,54378, -54379,54380,54382,54384,54385,54386,U,U,U,U,U,U,54387,54388,54389,54390,54391, -54394,54395,54397,54398,54401,54403,54404,54405,54406,54407,54410,54412,54414, -54415,54416,54417,54418,54419,54421,54422,54423,54424,54425,54426,54427,54428, -54429,54430,54431,54432,54433,54434,54435,54436,54437,54438,54439,54440,54442, -54443,54444,54445,54446,54447,54448,54449,54450,54451,54452,54453,54454,54455, -54456,U,U,U,U,U,U,54457,54458,54459,54460,54461,54462,54463,54464,54465,54466, -54467,54468,54469,54470,54471,54472,54473,54474,54475,54477,54478,54479,54481, -54482,54483,54485,U,U,U,U,U,U,54486,54487,54488,54489,54490,54491,54493,54494, -54496,54497,54498,54499,54500,54501,54502,54503,54505,54506,54507,54509,54510, -54511,54513,54514,54515,54516,54517,54518,54519,54521,54522,54524,54526,54527, -54528,54529,54530,54531,54533,54534,54535,54537,54538,54539,54541,54542,54543, -54544,54545,54546,54547,54550,54552,54553,54554,54555,54556,54557,U,U,U,U,U,U, -54558,54559,54560,54561,54562,54563,54564,54565,54566,54567,54568,54569,54570, -54571,54572,54573,54574,54575,54576,54577,54578,54579,54580,54581,54582,54583, -U,U,U,U,U,U,54584,54585,54586,54587,54590,54591,54593,54594,54595,54597,54598, -54599,54600,54601,54602,54603,54606,54608,54610,54611,54612,54613,54614,54615, -54618,54619,54621,54622,54623,54625,54626,54627,54628,54630,54631,54634,54636, -54638,54639,54640,54641,54642,54643,54646,54647,54649,54650,54651,54653,54654, -54655,54656,54657,54658,54659,54662,54666,54667,U,U,U,U,U,U,54668,54669,54670, -54671,54673,54674,54675,54676,54677,54678,54679,54680,54681,54682,54683,54684, -54685,54686,54687,54688,54689,54690,54691,54692,54694,54695,U,U,U,U,U,U,54696, -54697,54698,54699,54700,54701,54702,54703,54704,54705,54706,54707,54708,54709, -54710,54711,54712,54713,54714,54715,54716,54717,54718,54719,54720,54721,54722, -54723,54724,54725,54726,54727,54730,54731,54733,54734,54735,54737,54739,54740, -54741,54742,54743,54746,54748,54750,54751,54752,54753,54754,54755,54758,54759, -54761,54762,54763,54765,54766,U,U,U,U,U,U,54767,54768,54769,54770,54771,54774, -54776,54778,54779,54780,54781,54782,54783,54786,54787,54789,54790,54791,54793, -54794,54795,54796,54797,54798,54799,54802,U,U,U,U,U,U,54806,54807,54808,54809, -54810,54811,54813,54814,54815,54817,54818,54819,54821,54822,54823,54824,54825, -54826,54827,54828,54830,54831,54832,54833,54834,54835,54836,54837,54838,54839, -54842,54843,54845,54846,54847,54849,54850,54851,54852,54854,54855,54858,54860, -54862,54863,54864,54866,54867,54870,54871,54873,54874,54875,54877,54878,54879, -54880,54881,U,U,U,U,U,U,54882,54883,54884,54885,54886,54888,54890,54891,54892, -54893,54894,54895,54898,54899,54901,54902,54903,54904,54905,54906,54907,54908, -54909,54910,54911,54912,U,U,U,U,U,U,54913,54914,54916,54918,54919,54920,54921, -54922,54923,54926,54927,54929,54930,54931,54933,54934,54935,54936,54937,54938, -54939,54940,54942,54944,54946,54947,54948,54949,54950,54951,54953,54954,54955, -54957,54958,54959,54961,54962,54963,54964,54965,54966,54967,54968,54970,54972, -54973,54974,54975,54976,54977,54978,54979,54982,54983,54985,54986,54987,U,U,U, -U,U,U,54989,54990,54991,54992,54994,54995,54997,54998,55000,55002,55003,55004, -55005,55006,55007,55009,55010,55011,55013,55014,55015,55017,55018,55019,55020, -55021,U,U,U,U,U,U,55022,55023,55025,55026,55027,55028,55030,55031,55032,55033, -55034,55035,55038,55039,55041,55042,55043,55045,55046,55047,55048,55049,55050, -55051,55052,55053,55054,55055,55056,55058,55059,55060,55061,55062,55063,55066, -55067,55069,55070,55071,55073,55074,55075,55076,55077,55078,55079,55082,55084, -55086,55087,55088,55089,55090,55091,55094,55095,55097,U,U,U,U,U,U,55098,55099, -55101,55102,55103,55104,55105,55106,55107,55109,55110,55112,55114,55115,55116, -55117,55118,55119,55122,55123,55125,55130,55131,55132,55133,55134,U,U,U,U,U,U, -55135,55138,55140,55142,55143,55144,55146,55147,55149,55150,55151,55153,55154, -55155,55157,55158,55159,55160,55161,55162,55163,55166,55167,55168,55170,55171, -55172,55173,55174,55175,55178,55179,55181,55182,55183,55185,55186,55187,55188, -55189,55190,55191,55194,55196,55198,55199,55200,55201,55202,55203, -}; - -static const struct dbcs_index cp949ext_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{__cp949ext_decmap+0,65,254},{__cp949ext_decmap+190, -65,254},{__cp949ext_decmap+380,65,254},{__cp949ext_decmap+570,65,254},{ -__cp949ext_decmap+760,65,254},{__cp949ext_decmap+950,65,254},{ -__cp949ext_decmap+1140,65,254},{__cp949ext_decmap+1330,65,254},{ -__cp949ext_decmap+1520,65,254},{__cp949ext_decmap+1710,65,254},{ -__cp949ext_decmap+1900,65,254},{__cp949ext_decmap+2090,65,254},{ -__cp949ext_decmap+2280,65,254},{__cp949ext_decmap+2470,65,254},{ -__cp949ext_decmap+2660,65,254},{__cp949ext_decmap+2850,65,254},{ -__cp949ext_decmap+3040,65,254},{__cp949ext_decmap+3230,65,254},{ -__cp949ext_decmap+3420,65,254},{__cp949ext_decmap+3610,65,254},{ -__cp949ext_decmap+3800,65,254},{__cp949ext_decmap+3990,65,254},{ -__cp949ext_decmap+4180,65,254},{__cp949ext_decmap+4370,65,254},{ -__cp949ext_decmap+4560,65,254},{__cp949ext_decmap+4750,65,254},{ -__cp949ext_decmap+4940,65,254},{__cp949ext_decmap+5130,65,254},{ -__cp949ext_decmap+5320,65,254},{__cp949ext_decmap+5510,65,254},{ -__cp949ext_decmap+5700,65,254},{__cp949ext_decmap+5890,65,254},{ -__cp949ext_decmap+6080,65,160},{__cp949ext_decmap+6176,65,160},{ -__cp949ext_decmap+6272,65,160},{__cp949ext_decmap+6368,65,160},{ -__cp949ext_decmap+6464,65,160},{__cp949ext_decmap+6560,65,160},{ -__cp949ext_decmap+6656,65,160},{__cp949ext_decmap+6752,65,160},{ -__cp949ext_decmap+6848,65,160},{__cp949ext_decmap+6944,65,160},{ -__cp949ext_decmap+7040,65,160},{__cp949ext_decmap+7136,65,160},{ -__cp949ext_decmap+7232,65,160},{__cp949ext_decmap+7328,65,160},{ -__cp949ext_decmap+7424,65,160},{__cp949ext_decmap+7520,65,160},{ -__cp949ext_decmap+7616,65,160},{__cp949ext_decmap+7712,65,160},{ -__cp949ext_decmap+7808,65,160},{__cp949ext_decmap+7904,65,160},{ -__cp949ext_decmap+8000,65,160},{__cp949ext_decmap+8096,65,160},{ -__cp949ext_decmap+8192,65,160},{__cp949ext_decmap+8288,65,160},{ -__cp949ext_decmap+8384,65,160},{__cp949ext_decmap+8480,65,160},{ -__cp949ext_decmap+8576,65,160},{__cp949ext_decmap+8672,65,160},{ -__cp949ext_decmap+8768,65,160},{__cp949ext_decmap+8864,65,160},{ -__cp949ext_decmap+8960,65,160},{__cp949ext_decmap+9056,65,160},{ -__cp949ext_decmap+9152,65,160},{__cp949ext_decmap+9248,65,160},{ -__cp949ext_decmap+9344,65,160},{__cp949ext_decmap+9440,65,160},{ -__cp949ext_decmap+9536,65,160},{__cp949ext_decmap+9632,65,82},{0,0,0},{0,0,0}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __cp949_encmap[33133] = { -8750,N,N,8756,N,N,8535,8487,N,10275,N,N,8489,8807,N,8518,8510,10615,10616, -8741,N,8786,8484,8748,10614,10284,N,10361,10358,10362,8751,N,N,N,N,N,N,10273, -N,N,N,N,N,N,N,N,N,10274,N,N,N,N,N,N,8511,10282,N,N,N,N,N,10285,10540,N,N,N,N, -N,N,10529,N,N,N,N,N,N,N,N,N,10531,N,N,N,N,N,N,8512,10538,N,N,N,N,N,10541, -10530,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10276,10532,N,N,N,N,N,N,N,N,N, -10533,10278,10534,N,N,N,N,10535,N,N,N,N,N,N,10280,10536,10281,10537,N,N,N,N,N, -N,10544,10287,10543,N,N,N,N,N,N,10283,10539,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,10286,10542,8743,N,N,N,N,N,N,N,N,8752,N,N,N,N,N,N,N,8744,8747,8746,8749,N, -8745,9537,9538,9539,9540,9541,9542,9543,9544,9545,9546,9547,9548,9549,9550, -9551,9552,9553,N,9554,9555,9556,9557,9558,9559,9560,N,N,N,N,N,N,N,9569,9570, -9571,9572,9573,9574,9575,9576,9577,9578,9579,9580,9581,9582,9583,9584,9585,N, -9586,9587,9588,9589,9590,9591,9592,11303,N,N,N,N,N,N,N,N,N,N,N,N,N,N,11297, -11298,11299,11300,11301,11302,11304,11305,11306,11307,11308,11309,11310,11311, -11312,11313,11314,11315,11316,11317,11318,11319,11320,11321,11322,11323,11324, -11325,11326,11327,11328,11329,11345,11346,11347,11348,11349,11350,11352,11353, -11354,11355,11356,11357,11358,11359,11360,11361,11362,11363,11364,11365,11366, -11367,11368,11369,11370,11371,11372,11373,11374,11375,11376,11377,N,11351, -8490,N,N,8494,8495,N,N,8496,8497,N,N,8787,8788,N,N,N,8485,8486,N,N,N,N,N,N,N, -N,N,8758,N,8519,8520,N,N,N,N,N,N,N,8536,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -10617,N,N,N,N,N,N,N,N,N,N,10618,N,10619,10620,10621,10622,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8806,8521,N,N,N,N,N, -8757,N,N,N,N,N,N,N,N,N,10020,N,N,8800,N,N,N,N,N,N,N,N,N,N,8805,8802,N,N,N, -10073,N,N,N,N,8522,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,10359,10360,N,N,N,N,N,N,10363,10364,10365,10366,N,9520, -9521,9522,9523,9524,9525,9526,9527,9528,9529,N,N,N,N,N,N,9505,9506,9507,9508, -9509,9510,9511,9512,9513,9514,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -8551,8552,8550,8553,8554,8789,8792,8790,8793,8791,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,8737,N,8738,8739,N,8531,8740,N,N,N,8532,8564,N,N,8565,N,N,N,8755,N,8754, -N,N,N,N,N,N,N,N,8558,N,N,8560,8516,N,8528,N,N,N,N,8491,N,8572,8573,8571,8570, -8562,8563,N,8753,N,N,N,N,N,8517,8561,N,N,N,N,N,N,8493,8559,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,8534,N,N,N,N,N,N,N,N,N,N,N,N,N,8513,8533,N,N,8514,8515, -N,N,N,N,8556,8557,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8568,8569,N,N, -8566,8567,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8769,N,N,N,N,N,N,N,N,N,N,N,8529, -8530,10343,10344,10345,10346,10347,10348,10349,10350,10351,10352,10353,10354, -10355,10356,10357,N,N,N,N,N,10599,10600,10601,10602,10603,10604,10605,10606, -10607,10608,10609,10610,10611,10612,10613,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,10573,10574,10575,10576,10577,10578,10579,10580,10581,10582, -10583,10584,10585,10586,10587,10588,10589,10590,10591,10592,10593,10594,10595, -10596,10597,10598,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10317, -10318,10319,10320,10321,10322,10323,10324,10325,10326,10327,10328,10329,10330, -10331,10332,10333,10334,10335,10336,10337,10338,10339,10340,10341,10342,9761, -9772,9762,9773,N,N,N,N,N,N,N,N,9763,9800,9799,9774,9764,9794,9793,9775,9766, -9798,9797,9777,9765,9796,9795,9776,9767,9788,9801,9802,9783,9803,9804,9778, -9769,9790,9805,9806,9785,9807,9808,9780,9768,9809,9810,9784,9789,9811,9812, -9779,9770,9813,9814,9786,9791,9815,9816,9781,9771,9817,9818,9787,9819,9820, -9792,9821,9822,9823,9824,9825,9826,9827,9828,9782,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8774,N,N,N,N,N,N,N,N,N,N,N,N,N,8545,8544,N, -8771,8775,8776,8779,8778,8777,8780,N,N,N,N,N,N,N,N,8547,8546,N,N,8762,8761,N, -N,N,N,8549,8548,N,N,8760,8759,N,N,N,N,8543,8542,8770,N,N,8539,N,N,8541,8540, -8772,8773,8538,8537,N,N,N,N,N,N,N,8783,8782,N,N,N,N,N,N,N,N,N,N,N,N,8784,N, -8785,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8527,N, -8526,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,8764,8765,N, -8768,8763,8766,N,8767,8781,8795,8796,N,8797,8794,8481,8482,8483,8488,N,N,N,N, -8500,8501,8502,8503,8504,8505,8506,8507,8508,8509,N,8555,8498,8499,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -10785,10786,10787,10788,10789,10790,10791,10792,10793,10794,10795,10796,10797, -10798,10799,10800,10801,10802,10803,10804,10805,10806,10807,10808,10809,10810, -10811,10812,10813,10814,10815,10816,10817,10818,10819,10820,10821,10822,10823, -10824,10825,10826,10827,10828,10829,10830,10831,10832,10833,10834,10835,10836, -10837,10838,10839,10840,10841,10842,10843,10844,10845,10846,10847,10848,10849, -10850,10851,10852,10853,10854,10855,10856,10857,10858,10859,10860,10861,10862, -10863,10864,10865,10866,10867,N,N,N,N,N,N,N,N,N,N,N,N,N,11041,11042,11043, -11044,11045,11046,11047,11048,11049,11050,11051,11052,11053,11054,11055,11056, -11057,11058,11059,11060,11061,11062,11063,11064,11065,11066,11067,11068,11069, -11070,11071,11072,11073,11074,11075,11076,11077,11078,11079,11080,11081,11082, -11083,11084,11085,11086,11087,11088,11089,11090,11091,11092,11093,11094,11095, -11096,11097,11098,11099,11100,11101,11102,11103,11104,11105,11106,11107,11108, -11109,11110,11111,11112,11113,11114,11115,11116,11117,11118,11119,11120,11121, -11122,11123,11124,11125,11126,9249,9250,9251,9252,9253,9254,9255,9256,9257, -9258,9259,9260,9261,9262,9263,9264,9265,9266,9267,9268,9269,9270,9271,9272, -9273,9274,9275,9276,9277,9278,9279,9280,9281,9282,9283,9284,9285,9286,9287, -9288,9289,9290,9291,9292,9293,9294,9295,9296,9297,9298,9299,9300,9301,9302, -9303,9304,9305,9306,9307,9308,9309,9310,9311,9312,9313,9314,9315,9316,9317, -9318,9319,9320,9321,9322,9323,9324,9325,9326,9327,9328,9329,9330,9331,9332, -9333,9334,9335,9336,9337,9338,9339,9340,9341,9342,10545,10546,10547,10548, -10549,10550,10551,10552,10553,10554,10555,10556,10557,10558,10559,10560,10561, -10562,10563,10564,10565,10566,10567,10568,10569,10570,10571,10572,8799,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,10289,10290,10291,10292, -10293,10294,10295,10296,10297,10298,10299,10300,10301,10302,10303,10304,10305, -10306,10307,10308,10309,10310,10311,10312,10313,10314,10315,10316,N,N,N,8798, -10057,10058,10059,10060,10061,N,N,N,10042,10043,10076,10077,10078,10038,10039, -10040,10068,10069,10070,10071,10072,10017,10018,10019,10021,10027,10028,10029, -10030,10031,10032,10033,10034,10035,10036,10023,10024,10025,10026,10045,10046, -10085,10086,10087,10088,10081,10082,10083,10047,10048,10049,10050,10051,10052, -10053,10054,10055,10056,10062,10063,10064,10065,10066,10067,10074,10075,8803, -10092,10022,10080,10095,8801,10044,10093,10037,N,N,N,N,10041,10090,N,N,10091, -N,N,10079,N,8804,N,N,10084,10094,10089,27753,28491,N,30290,N,N,N,22578,27995, -24370,24382,31035,N,23668,N,N,N,30052,N,N,29478,23904,24870,N,20088,23600,N,N, -N,N,25386,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29033,N,N,N,N,19834,N,N,N,N,N,31791, -21281,N,28971,N,N,N,N,N,N,26449,21036,N,20089,N,N,N,N,N,29053,N,24127,31546, -31033,N,N,N,N,N,N,20050,N,25387,27488,N,N,N,20090,19319,25893,N,N,N,N,N,N,N,N, -N,N,N,19041,N,21580,N,N,N,N,N,27233,N,N,23651,24365,N,N,N,N,N,N,19307,N,N,N, -21807,N,N,N,22133,N,25976,N,N,24128,27683,N,26957,N,27175,26998,31547,N,26473, -28492,N,N,20582,N,N,24129,N,N,25644,N,N,22604,31089,N,20063,31268,26162,N, -31355,N,N,31293,19528,28493,21845,N,N,N,N,N,N,N,21282,N,N,N,27729,N,N,N,N,N, -25639,27730,N,N,30257,N,N,20091,N,N,20561,19263,N,27940,N,N,N,N,N,N,27944, -24130,30306,27996,23669,24633,N,N,N,21582,N,29749,N,N,N,21339,22069,27684,N,N, -N,N,N,N,N,N,N,N,25702,N,29034,N,N,N,19308,19264,N,N,N,27762,20586,N,N,N,N,N,N, -N,31090,27685,20575,N,26474,20587,23633,23401,32076,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,23383,N,N,N,N,23137,N,22070,N,25439,N,24131,N, -24132,18977,N,N,N,N,N,28268,N,N,21283,28215,30799,N,N,N,N,27208,28216,28972, -28965,26958,N,N,N,31036,N,N,N,25977,27754,23894,27970,N,N,N,N,N,N,N,N,N,N,N,N, -30757,N,N,N,N,N,25914,23384,N,N,18978,N,N,20813,N,N,N,28269,N,N,N,27755,24133, -N,25440,N,19017,29289,N,21838,N,30262,N,20034,22087,N,25396,N,28973,N,27234,N, -N,N,N,22338,N,29479,N,N,19818,N,27502,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22834, -32037,N,N,N,N,N,30293,21858,N,N,N,N,N,N,N,N,30773,N,N,19573,30005,25645,N,N,N, -N,26475,29013,N,N,N,28731,N,N,26933,N,19529,31317,N,N,24916,N,N,22358,N,N, -23617,N,24134,31343,25441,N,N,N,N,N,N,N,N,N,N,N,N,24947,23670,N,20092,N,23364, -N,30833,N,N,23652,N,25967,23601,N,N,N,21846,N,N,29530,N,19265,N,23363,N,N,N, -22906,21358,N,N,N,31288,N,N,32038,27503,N,29734,N,19530,29480,N,29531,N,23335, -30263,N,20326,28786,19290,N,26450,22339,30320,26718,N,N,N,N,N,N,N,N,N,N,N,N,N, -25894,N,N,N,N,N,N,N,25959,N,N,N,18979,19495,27209,N,N,N,N,N,30774,N,N,N,N,N, -31269,N,N,N,N,28974,N,28494,N,N,N,N,N,N,N,N,19309,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -30256,28495,26959,N,30558,N,N,N,N,N,N,N,20051,N,N,N,N,23671,N,N,N,N,N,N,N, -23336,N,N,N,19320,N,N,N,N,N,N,24353,23905,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -30026,26934,N,N,N,N,26476,28270,N,29552,N,24383,N,N,N,N,N,N,19531,N,N,N,N,N,N, -20545,N,N,N,29778,24634,N,N,N,N,24384,N,20064,N,N,N,23634,32106,N,N,N,22134,N, -N,N,27210,N,N,N,N,N,N,26729,N,25388,N,N,N,N,N,29520,N,N,N,N,N,N,N,N,N,N,N, -18980,N,23416,N,N,N,24135,27504,29014,N,N,25954,N,19532,N,N,19323,N,N,N,N,N,N, -N,N,27235,N,N,N,N,N,N,N,N,N,N,N,N,24385,N,22125,N,N,N,N,N,N,N,N,26960,N,N,N,N, -N,N,N,28217,N,N,N,N,21859,N,N,20819,N,25968,N,N,N,26676,27459,N,27178,31356, -30070,28732,32084,24635,20035,N,20538,30522,22643,30541,N,N,N,25646,N,N,N,N,N, -N,N,N,N,21599,N,N,N,N,N,20583,N,N,27773,N,21038,28271,21847,27236,30754,19819, -22335,31537,N,N,19820,N,N,N,23602,20588,20093,28272,N,N,N,19522,N,N,N,20589,N, -N,N,N,N,25975,N,N,N,29564,N,N,28194,N,N,N,N,22835,N,N,22644,N,26935,N,N,N,N,N, -N,N,N,20014,N,N,N,N,22818,N,N,N,N,22641,N,21583,N,N,N,N,N,N,N,N,N,25895,21842, -N,N,N,N,N,22057,N,N,N,N,N,N,29730,N,29015,N,N,21848,N,28733,22352,21584,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,22351,27498,32107,N,N,23405,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -31813,19266,N,N,N,N,32085,N,29768,26730,30067,N,N,31070,21359,N,N,27731,N,N, -23874,28471,26452,N,19018,N,N,N,22907,N,N,31357,N,N,N,N,N,22058,N,N,N,N,N, -29816,N,N,N,N,N,N,30583,23596,N,N,N,22359,24354,N,N,N,20030,N,21360,N,N,N,N,N, -28708,24940,20327,29515,27945,19006,N,N,N,N,N,N,N,29807,N,N,N,30286,N,N,24187, -20539,21815,28273,N,N,N,N,N,N,29736,N,23672,N,N,N,N,19239,N,23118,N,N,N,24678, -N,N,N,N,N,N,N,27941,28274,N,N,N,N,23673,N,N,31068,N,N,29532,N,N,N,N,N,N,N, -30834,N,29817,N,N,N,31857,N,N,N,20540,23417,22321,N,N,N,19324,N,N,N,28709, -19325,N,N,N,N,N,N,N,N,21876,N,N,N,19821,18981,N,N,22059,20546,N,N,N,N,28734, -21053,19492,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31286,N,N,19533,N,23162,N, -30287,N,26936,N,22645,N,N,N,19534,N,N,N,N,22349,N,N,21585,26989,N,19051,22882, -N,32050,N,25389,22092,22836,N,N,24871,28243,20547,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -32051,N,21860,N,N,20328,N,27971,20530,N,N,20094,23080,30800,N,N,32086,N,N,N,N, -30801,N,30802,23635,N,N,N,N,23906,31609,23873,N,25397,N,N,N,N,N,N,27997,20036, -N,19233,N,N,N,N,N,N,23907,N,N,N,N,31837,N,N,N,N,N,N,N,N,N,31023,N,N,N,N,N, -21115,20257,25640,N,29750,27774,N,N,25390,26477,32065,23138,N,N,22579,N,N,N, -23908,28783,30321,31344,N,N,20853,N,N,23119,N,23636,N,23590,N,28479,N,N,N,N,N, -20047,N,24665,N,N,N,N,N,N,22870,27732,27211,N,N,19007,21808,N,20329,N,N,N,N,N, -29037,N,19535,N,N,N,N,25720,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25709,N,N,N,N,22360,N, -32039,N,N,N,N,27179,30258,N,N,N,N,20336,31037,N,N,N,N,N,N,26228,N,N,N,N,N,N,N, -N,N,N,N,N,N,19291,N,N,N,N,N,N,N,29521,N,N,N,N,26961,29481,20576,26962,N,23139, -N,N,N,N,N,N,25170,N,30242,24948,N,N,N,23140,N,N,N,N,N,26453,30015,20258,19759, -20259,N,N,N,19760,29054,20515,24879,30755,N,18982,30523,29290,24136,26963,N,N, -N,N,24137,32094,19008,N,N,N,31082,20814,28244,N,21586,22819,32040,22361,30542, -31294,N,N,N,N,N,N,N,N,N,20310,N,22384,N,27489,30789,N,N,N,N,N,23674,N,N,23875, -N,31071,N,N,N,N,N,N,N,26479,N,N,N,N,32101,30243,N,22908,32041,N,26478,N,N,N, -21861,N,N,N,N,N,28496,N,19761,N,N,N,N,N,N,30498,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,28978,N,28977,N,N,N,N,N,N,19762,N,23083,N,18983,N,N,N,N,N,25442, -31548,22820,N,N,28218,N,N,N,N,N,30803,N,N,N,N,N,31610,N,20260,N,23675,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30307,N,N,N,27946,N,N,29217,20065,N,N,N,N,N,N, -31270,N,N,N,N,31072,N,N,N,N,27734,N,N,25710,31009,N,N,31599,N,N,N,31083,28195, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27180,N,N,N,18984,N,N,29818,N,N, -N,N,19798,31862,N,N,N,29769,N,N,N,N,N,N,N,30804,30758,N,24138,29254,N,N,N,N,N, -N,22362,N,21328,N,N,N,N,N,N,N,N,N,N,N,22597,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,27238,N,29533,N,N,N,25690,N,N,N,N,N,N,N,N,30308,N,N,N,N,N,30322,N,24386,N,N, -N,N,N,N,N,N,22909,N,N,N,19574,N,N,21306,N,N,N,N,N,N,N,25647,N,N,N,N,31073,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28710,N,N,N,19283,N,N,N,24636,N, -29770,21626,N,32042,31074,N,N,N,N,N,N,N,N,N,N,N,N,N,29751,32066,31792,N,32108, -19042,N,N,N,N,N,N,N,N,N,32061,N,27239,24387,20818,20066,N,21284,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,32043,N,24416,N,N,N,N,N,N,N,N,N,N,N,N,29255,N,N, -N,N,N,26480,N,20590,N,N,29482,N,N,N,24139,30264,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,24949,28979,30499,N,N,18985,N,N,N,N,N,N,N,N,N,N,20261,N,N, -24388,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24880,N,N,28735,N,30244,N, -25398,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31302,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20591,N,N,32109,N,N,N,N,N,N,N,N,23876,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,31863,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,26175,N,N,N,N,N,N,24109,N,31295,N,N,N,N,N,25969,N,N,N,N,N,N,N, -27972,N,N,N,N,N,N,N,N,N,N,N,N,N,21029,N,N,32110,N,N,N,30006,N,N,N,N,N,N,N,N, -24950,24140,N,N,31838,N,27735,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19805,N,N,N,N,N,N, -N,N,22071,19763,30805,25944,N,N,N,20330,N,N,20304,N,27212,N,N,N,N,27182,27181, -N,N,21361,N,21285,N,N,N,N,N,N,30543,N,N,N,N,N,N,N,N,28196,N,N,N,N,20516,N,N, -29218,N,N,N,N,N,N,N,N,N,N,20592,N,N,N,N,29219,N,30584,N,N,N,N,20531,N,N,23337, -N,N,21307,19052,N,28966,19285,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30567,N,N,19806,N, -30500,N,N,N,30784,N,N,N,21341,N,19536,N,N,N,N,20262,N,N,N,N,N,N,30323,N,N,N,N, -N,24951,N,N,N,N,N,21340,N,N,31358,N,N,N,N,N,N,N,31271,N,N,N,N,N,N,N,N,N,N,N,N, -27481,N,20263,27183,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,25711,N,N,N,26937,29016,N,N,22616,N,N,24690,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,26164,23676,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29553,N,N,N,25424,N,N,29307,N, -23366,20593,N,20594,20316,N,21329,N,N,19505,30552,N,19240,27452,25662,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29788,N,N,23618,N,N,28711,N,N,26176,N,N,19053,N, -N,N,N,26731,25960,23619,N,N,27998,21362,N,N,N,N,19575,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,20052,26411,N,N,N,19267,N,24881,N,N,30514,N,N,21363,21330,N,30016,N,N,N, -24413,N,N,28275,26481,N,32052,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29256,N,N,N, -29522,N,N,28276,N,25171,N,N,N,N,19537,N,24426,N,N,N,26938,N,N,N,N,N,N,N,N,N, -22871,N,N,N,N,N,N,N,N,30029,N,29042,31303,N,N,N,N,N,N,N,N,22904,21570,N,N,N,N, -30309,N,N,N,N,23877,N,N,N,N,N,N,26482,27999,N,N,19019,N,N,23418,N,N,N,26677,N, -21286,N,N,N,N,N,N,32053,N,N,31049,N,25698,N,31549,N,N,22308,20037,N,N,N,N, -20053,22118,N,N,N,N,25917,N,N,N,N,N,N,24141,27763,N,N,28000,N,N,N,N,N,N,N,N,N, -27756,31550,24427,N,24952,31038,N,N,N,N,20595,24618,26722,N,N,25172,21117,N, -25896,N,N,N,N,N,22867,N,N,N,N,21342,N,29752,30524,23677,N,26732,25703,N,N, -25463,N,N,N,N,N,27688,N,N,N,N,N,N,31345,N,N,N,N,N,25970,N,N,20596,21039,23653, -N,N,N,N,20517,28980,31793,19576,N,N,23878,31313,N,30559,N,N,31272,N,N,N,N,N, -28277,N,24142,N,N,N,N,26483,N,N,30508,27460,28001,24619,23879,N,N,N,N,21043, -21055,N,N,N,19020,N,N,N,N,31551,N,N,N,N,25981,23909,22605,N,N,N,N,N,27764,N,N, -N,N,N,N,N,N,20597,N,N,26733,20562,N,22872,N,N,N,N,N,N,N,N,N,N,N,30310,N,N, -23338,N,N,N,30560,N,N,N,N,N,N,N,N,N,N,N,N,22617,N,29731,N,N,29789,N,N,N,N, -28497,N,N,22837,N,N,27947,N,25399,N,N,N,N,28219,19764,N,24691,27213,N,N,N,N, -27765,26734,N,19241,28975,N,N,N,N,N,N,N,N,19021,N,27689,N,29291,N,32111,N, -31091,N,N,N,N,N,N,N,N,N,26177,N,N,27736,N,N,N,27948,27214,N,26719,N,N,N,N,N,N, -N,N,N,N,N,N,N,24143,N,N,N,N,N,N,21030,N,N,26484,20822,N,N,26178,25443,N,N,N,N, -25648,N,N,N,22580,N,N,N,N,N,N,N,N,N,N,N,N,30245,N,N,N,N,N,29534,N,N,N,N,22309, -N,N,N,N,30568,N,N,26694,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31590,N,N,N,N,N,N,N, -23910,N,N,N,23678,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,22618,N,N,N,N,N,N,N,23084,27184,N,N,N,N,N,N,N,N, -25400,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,18986,24953,N, -27185,N,N,N,N,29292,N,N,31342,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28245,N, -N,N,N,31092,N,N,21100,31611,N,N,N,32112,N,24637,20067,N,N,N,N,N,N,N,N,N,30790, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24110,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,24389,N,N,25918,N,N,N,N,N,N,N,N,N,N,N,N,27949,31338,N,N,19822,27942,N, -27950,28781,N,23841,N,27951,31864,N,22635,N,N,N,19577,19765,N,N,N,N,31273,N, -24925,N,N,N,N,25173,27983,N,N,N,23842,N,N,31050,N,27240,N,25965,N,N,N,N,N,N,N, -N,21355,N,26964,24954,25676,N,24932,26695,N,N,20059,N,N,N,23637,N,30517,31859, -28787,20015,28981,28498,26696,27505,N,N,N,N,N,19284,24638,25464,27241,31794,N, -N,N,N,N,24692,N,20320,N,28197,N,N,31274,26179,24882,18987,N,25444,26939,N,N,N, -N,N,25174,29554,N,28246,27186,20598,27737,23115,20264,N,N,N,N,23843,N,N,N, -22619,N,31054,26965,25425,N,N,21052,N,N,N,N,N,N,22572,29516,N,19835,30294,N, -26485,26735,25465,21051,29555,25467,N,24144,20016,N,22135,29017,N,N,N,N,N, -30017,23620,N,30011,N,24145,23654,N,N,24146,N,N,28002,28278,27215,28782,25468, -N,21343,21364,24883,N,24884,N,N,N,N,29779,N,N,24390,N,N,N,N,N,N,N,N,N,N,26966, -N,N,N,23339,N,N,N,N,N,N,N,N,30246,N,N,N,N,N,N,25401,27461,29737,19766,21113,N, -23085,21091,20305,N,N,N,N,19292,19578,N,20317,N,N,26665,N,25403,25402,N,N, -24666,N,N,N,28279,N,N,N,N,N,23603,N,N,N,N,21365,N,22310,N,30261,22363,N,N,N,N, -N,N,24917,N,N,21610,N,24355,N,N,N,N,N,N,N,32095,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,20599,27988,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19242,N,N,N,N,N,N,N, -25691,N,24955,19234,N,N,N,N,21344,N,25663,N,31552,N,23102,25677,N,22073,N,N,N, -28480,N,24956,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30265,N,N,N,N,N, -N,24391,N,N,N,N,N,N,N,25649,N,N,N,N,N,N,23655,23656,N,N,N,31318,N,21366,N,N,N, -N,29018,N,31346,25213,N,N,N,N,N,21839,20600,N,N,19807,N,N,30027,N,25712,19243, -N,22340,N,N,N,N,N,N,N,N,N,N,N,N,N,25214,N,23898,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,23086,19054,N,N,N,21817,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25377,N,N,26723,N,N,29483,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,20265,N,N,N,21367,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -21617,N,N,20068,N,26738,N,N,N,N,N,N,N,25973,N,N,N,N,N,N,N,N,N,N,N,N,N,26414,N, -22074,N,24428,25664,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,26724,N,N,N,N,22581,N,N,N, -25692,N,N,N,N,N,N,29753,28982,N,N,25182,24885,N,N,19823,28967,20069,19293,N,N, -22883,N,N,29484,N,N,20601,27691,24147,30569,N,N,31093,N,N,N,N,N,24926,19310, -25404,30806,N,N,23406,N,N,N,N,N,32113,N,N,N,N,30518,N,N,N,N,29790,N,N,29293,N, -23385,N,28712,N,N,N,N,N,N,N,24957,N,N,N,N,N,24148,N,24620,N,N,N,N,N,28003,N,N, -21345,N,24392,N,N,N,N,22838,N,32044,28499,N,N,N,25665,30827,N,23340,N,N,N,N, -31814,N,N,N,N,N,N,N,N,22573,N,N,N,N,N,N,N,N,N,30266,N,23391,21331,30791,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,19022,30785,21044,N,N,23604,31289,19023,N,31795,27242, -27243,20602,N,N,N,N,N,28004,N,N,23911,N,N,24393,N,N,N,N,24429,N,N,N,N,N,28220, -N,28481,N,N,19538,N,23844,N,N,N,24394,N,N,N,N,N,21368,28968,N,N,N,19767,N, -28500,N,N,N,N,N,N,N,25693,24430,19244,26940,N,N,N,N,N,27244,N,N,N,24395,N,N,N, -N,N,31039,22063,21830,N,N,N,N,N,20266,N,N,20009,N,N,22136,N,N,N,28983,28280,N, -N,N,22873,29535,N,30792,20038,N,N,N,N,N,N,N,N,21862,N,N,N,N,N,N,29798,N,N, -26181,28501,N,N,19311,31839,23591,N,N,22119,N,N,N,N,N,30793,N,N,N,N,25426,N, -25405,N,20321,28736,27738,N,23895,31600,N,N,27692,N,N,N,28713,N,N,N,N,N,N, -31319,31553,N,21056,N,N,N,N,N,N,N,25904,N,N,N,28005,N,N,N,N,19245,N,31024,N,N, -N,N,N,N,N,N,N,N,N,30501,N,19246,N,23087,N,22582,N,N,N,N,N,N,N,21287,31538,N, -32068,N,27693,N,N,N,N,N,N,31521,N,N,N,25961,26990,N,29556,30835,28737,24111, -30768,N,N,29536,26415,N,N,N,N,N,23341,N,26165,N,N,31016,N,N,23896,26713,28502, -N,N,N,21346,N,25183,N,N,31840,22344,32045,N,N,N,24431,19539,21369,N,N,N,N, -21616,23367,24149,N,N,N,N,28788,N,21840,25945,N,N,N,N,N,N,31815,23638,25184,N, -N,N,23088,N,N,N,N,N,N,29475,N,21356,N,29771,N,N,N,32069,N,N,N,N,N,25469,N, -31025,N,N,N,N,N,N,20603,27739,N,N,N,N,N,N,N,N,30012,29220,22606,22607,N,N,N,N, -N,N,30071,N,N,N,N,N,N,N,N,N,N,30305,N,N,N,N,N,N,N,N,N,21047,N,N,N,N,N,N,N, -31596,N,23880,25704,N,N,21057,N,N,N,30807,N,N,N,N,N,22075,24150,N,N,30525, -27694,N,N,N,20577,N,24693,27187,N,20054,N,N,N,N,19493,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,27766,25185,25406,N,N,N,N,N,N,N,N,N,31816,N,N,19824,N,31094,N,N, -24432,N,N,N,25919,N,N,N,20031,N,N,N,N,31841,27952,32081,30267,N,N,31055,27482, -19009,N,21048,19825,N,25427,32102,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -26221,N,N,N,25466,N,N,28714,31056,N,N,N,N,N,N,31842,N,30759,N,N,N,24933,28281, -N,N,N,26486,27245,N,N,31796,30018,N,N,22364,N,N,N,N,N,N,N,N,28789,N,23912, -21357,30076,N,23103,N,19579,N,N,N,21370,29732,N,N,N,N,N,N,N,28503,N,21571,N,N, -N,N,N,N,N,N,N,31587,N,N,N,N,N,N,N,N,31597,N,24621,N,N,27246,31539,25666,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,30311,21085,N,24396,N,N,31817,N,N,25897,24694,30259, -24958,N,N,N,N,19312,N,27247,27248,N,N,N,23104,30772,27506,N,N,N,N,N,25667,N,N, -N,N,26967,25713,N,N,N,19055,N,N,N,N,N,N,N,20055,N,N,N,N,N,N,N,N,31818,N,N,N, -29537,N,N,19268,N,N,N,N,25445,N,19269,27188,N,N,26941,N,22345,N,N,27483,27953, -N,19523,30526,31819,N,N,N,N,N,N,30836,N,22839,N,N,29523,29524,N,N,N,30564,N, -30545,N,N,22583,20017,19010,N,N,31540,19270,N,N,28790,N,N,21863,N,27216,N,N,N, -N,N,19540,19247,N,N,N,N,N,29738,26927,N,N,30019,26968,N,N,N,N,N,N,N,23913,N,N, -N,29043,N,21883,24123,N,N,29819,N,N,N,32115,32114,30502,N,N,N,N,N,N,N,N,N, -23881,N,N,21587,N,19496,N,23105,19541,N,22884,N,N,N,31306,N,N,N,25955,N,N,N, -21308,N,N,N,19056,N,N,N,N,20548,N,N,N,19024,31275,27499,26488,22885,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20823,N,N,N,N,N,N,N,N,N,N,N,29476,N, -N,N,21627,31843,31320,N,29525,N,20267,N,N,27507,21884,N,N,N,N,N,N,21332,19836, -N,22886,N,25209,25121,27476,N,24695,25650,19580,N,N,N,31588,N,N,N,29739,N,N,N, -N,20541,N,19057,N,N,N,N,N,N,N,N,28472,N,N,N,22336,N,28282,32116,N,N,21347,N, -31554,N,N,N,N,N,N,N,21864,23342,24886,30775,N,N,N,N,N,24639,31555,23914,N, -25122,N,28198,N,N,N,N,N,30312,N,N,N,N,30325,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,23882,N,N,20578,N,N,N,N,23846,N,N,23915,N,N,25721,N,N,25391,20604,N,N, -N,29820,N,N,N,N,19516,30570,N,N,N,N,N,N,25956,24433,N,N,30561,N,31095,28473,N, -N,30808,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31017,N,N,N,N,N,30809,N,N,N,28221,N,N,N, -22598,N,N,25699,30030,N,N,N,N,23897,N,N,N,N,22887,21049,21827,N,N,23141,23120, -N,20825,20056,N,19294,29740,23163,N,30313,26739,20268,28784,N,29821,23368,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,20032,25428,20815,29045,N,19826,N,20331,N,N,N,19768, -N,N,N,N,N,N,25382,20826,29221,N,N,N,N,N,29222,N,25678,N,N,N,N,N,N,N,21371,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28969,N,N,N,29257,N,N,N,N,N,N,N, -N,N,N,28504,26185,N,22584,31347,N,N,N,N,N,N,N,N,N,N,29493,N,N,30756,N,N,20851, -26184,N,N,N,N,30810,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,23657,24151,N,N,N,N,N, -19295,N,N,N,20332,N,N,N,N,29791,N,N,20852,21050,N,N,N,24434,N,N,N,24887,N,N,N, -N,25123,21372,N,N,28006,N,N,N,N,N,23369,N,N,N,25722,N,20318,N,N,20048,N,N,N,N, -21843,29557,30510,N,N,28488,N,19827,30031,25971,28738,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,19025,N,N,N,27249,N,20518,N,N,N,N,N,N,N,N,22874,28715,N,N,N, -N,N,27495,N,N,N,25920,31797,N,N,N,N,N,25668,N,N,N,N,N,N,N,N,N,N,N,19497,32070, -N,N,N,N,N,27189,N,25898,24378,24927,N,23121,N,N,N,N,24888,N,26740,21373,N,N,N, -N,25124,N,N,N,N,N,29258,N,N,N,N,N,N,N,N,N,23142,30515,N,N,N,N,N,N,N,N,N,N,N,N, -32077,N,N,N,29494,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28247,N,N, -N,N,N,N,N,30020,N,N,N,N,N,N,N,N,22564,N,N,N,N,N,29223,N,N,N,N,N,N,N,N,22840, -22841,28489,N,N,N,N,N,N,N,N,N,N,N,N,N,22094,N,N,N,N,N,N,N,N,30539,24366,26741, -N,N,N,N,N,N,21045,N,N,N,21333,N,N,N,N,N,29772,23164,N,N,N,N,N,22888,N,30571, -30025,N,29500,N,23122,N,N,N,N,N,N,N,N,21301,N,N,N,N,N,26678,N,N,22095,29754,N, -30537,N,N,19498,N,N,28739,19542,N,N,N,20563,N,21309,N,N,N,23419,N,19296,N,N,N, -N,N,N,21348,30327,N,N,21818,29517,19297,N,N,N,N,27508,N,N,N,N,N,29741,N,31786, -N,N,N,N,N,30572,N,N,N,26742,23143,N,N,N,30540,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,25921,N,N,N,N,24686,N,N,N,N,N,21885,N,N,N,N,N,N,20070,31787,21819,N,N, -29224,N,N,N,N,N,N,25125,19769,27250,19271,N,19828,N,N,23343,28505,N,N,N,N,N, -19770,N,N,31865,N,N,N,N,24435,20071,23106,N,20269,N,N,N,N,26489,30760,N,N,N,N, -N,N,29538,N,N,N,19058,24356,N,N,21572,N,N,N,N,N,19543,25922,N,N,N,N,19771,N, -28506,28248,N,23847,25126,N,N,N,N,N,24640,N,N,N,22064,30794,N,31866,N,22910,N, -N,N,N,24112,N,N,N,23916,23144,N,N,N,N,N,21600,N,22137,N,19799,24152,N,N,29304, -N,25686,N,N,20549,29742,N,23848,N,N,N,27973,29526,N,N,24153,25446,N,N,N,N,N,N, -21288,N,23344,N,N,25946,25407,N,N,N,23345,N,N,N,21865,N,N,N,N,N,24641,28507,N, -N,28777,N,N,22322,N,N,N,N,20605,N,N,N,N,N,N,N,N,22889,N,N,20606,N,27757,21289, -N,29225,28740,N,N,25186,26991,N,N,N,31057,N,N,26969,N,N,N,N,N,26714,23107, -23108,21573,N,26490,19808,25392,N,23346,31556,N,29539,N,22821,31591,23883, -20564,N,26166,24622,32090,N,N,N,N,N,N,N,N,23605,24696,26417,N,N,N,N,30064,N, -22620,27974,N,N,N,N,24889,N,25408,31040,26992,N,N,22875,N,29540,N,N,N,23606, -25705,N,N,N,N,N,28741,25409,31820,31821,N,N,N,N,29259,N,29260,N,N,N,25679,N,N, -N,N,N,N,N,N,N,29019,N,31321,N,28984,32117,24697,N,N,N,N,26491,31799,31844, -31557,25447,22585,N,30328,N,N,23621,19544,N,N,N,24623,29799,N,28508,20348, -28509,N,29226,N,N,N,N,N,N,N,N,N,32062,N,N,18988,32059,32071,N,N,N,N,26418,N, -27217,24436,N,N,N,N,20844,25694,25923,N,N,N,N,22822,N,N,19772,N,29541,N,N,N,N, -N,N,N,N,27989,N,N,22842,N,N,N,28007,31541,30828,N,N,N,N,24679,N,19545,N,N, -21574,N,N,N,N,N,26405,N,21877,21310,N,31867,N,N,N,N,N,N,N,N,N,N,N,N,25714,N,N, -24437,N,N,26744,30829,N,N,20039,N,N,N,N,N,32118,N,N,N,N,N,N,N,N,N,26712,N, -19800,26454,19546,N,N,19043,24438,28743,28742,N,22586,N,29044,29808,30028,N,N, -31845,N,N,N,N,27205,27251,N,23899,N,23639,N,N,N,N,N,N,24189,29305,N,21831,N,N, -N,22608,N,28744,20769,20770,N,N,N,N,N,N,22868,22120,22858,N,23089,22599,23650, -29518,30068,N,N,28985,N,N,23123,N,30314,N,N,N,20341,N,N,32046,N,N,N,N,N,N,N,N, -19026,N,N,24372,N,N,N,N,22365,31290,28199,30013,N,30837,N,N,28008,N,N,N,N,N, -21601,N,20771,24918,N,N,N,N,N,N,N,N,N,N,N,N,N,31096,N,23370,19321,21588,N, -22876,N,28222,N,30573,N,N,N,21102,N,N,24934,30585,N,N,N,N,N,N,N,23917,N,26715, -N,23347,N,N,N,20855,24624,N,N,21602,N,30295,N,22393,N,N,22621,N,19837,29227,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19773,30786,N,N,29228,N,N,18989,18990,20270,N, -N,N,N,N,25410,N,N,N,N,N,23607,N,N,N,N,N,N,N,N,N,N,23386,22843,19059,30291, -26232,27253,N,N,N,N,N,27254,N,N,30329,N,N,N,N,N,N,N,N,N,N,N,20271,N,N,19027,N, -N,18991,21040,28986,N,22323,25411,29565,24154,N,N,N,N,24155,N,N,28510,25187, -28283,N,N,24439,22346,N,N,N,N,N,N,N,N,N,20072,23387,N,N,N,N,N,N,N,28987,N,N,N, -N,26993,N,N,N,N,N,N,N,N,31287,20550,N,N,19499,28200,N,N,19322,31097,19581, -21374,N,N,N,N,25680,N,N,N,N,N,29294,N,21589,24397,N,31800,20816,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29261,N,N,N,N,N,N,N,N,30546,N,N,N,N,N,N,N,N, -19028,N,21849,N,N,N,22622,N,N,N,N,N,N,N,N,N,19801,N,N,N,28201,30268,N,N,19547, -N,N,N,N,N,28745,N,31868,N,26697,29822,N,N,N,N,26492,22366,N,N,N,N,24156,N, -28716,19582,19809,N,24890,N,23407,23090,N,N,N,N,N,N,N,N,N,N,N,N,N,20773,23608, -N,N,N,22646,N,20772,N,19810,N,N,N,N,23658,N,N,28791,N,28746,20542,N,23900,N,N, -N,N,21590,21334,N,N,N,N,N,N,27984,19745,N,N,N,N,N,24373,N,N,N,24440,N,N,N,N,N, -N,21537,20018,26698,N,N,N,N,27509,N,N,N,N,N,N,N,25429,30032,N,N,N,29985,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22823,N,N,N,N,N,N,N,N,25899,N,N,N,N,N,N,N,N, -N,N,N,N,26187,N,30065,N,N,N,N,N,N,N,N,N,N,25925,N,N,N,N,N,N,N,N,31011,24667, -30315,N,19313,N,22890,29986,N,N,N,22353,N,20856,27256,27257,23091,N,N,N,N, -28511,N,N,29039,N,25974,28223,25188,N,N,N,N,N,20543,N,31276,30033,26419,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,26942,N,N,N,N,N,29262,23348,N, -N,N,N,N,N,N,N,31822,N,23918,N,N,N,N,N,N,26420,N,N,N,N,N,22324,N,N,N,N,N,N, -30516,N,N,N,N,N,19774,N,23145,N,N,N,N,N,N,N,20272,30553,29542,N,N,20057,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20010,N,19272,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,20519,N,28747,N,20551,25669,N,N,N,N,N,N,N,23392,N,N,N,N,N,N,21850,N, -22311,N,N,N,28224,N,30838,N,N,N,N,30034,28009,N,22844,N,25926,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,29987,N,N,23124,25127,31612,N,N,29020,N,N,N,N,N,N,19060,N,N, -N,26746,N,N,20073,N,N,N,N,N,N,27000,25189,N,N,N,N,20537,21618,N,N,N,N,N,20774, -N,24398,N,N,N,N,N,N,N,N,N,31860,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21290, -N,N,N,19500,N,N,N,N,28512,N,N,N,25957,20565,N,N,N,N,N,N,N,N,23420,N,N,N,N, -31846,N,N,N,N,N,19326,28010,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24113,N,N,N,N,N,N,N, -31075,N,N,N,N,N,N,21538,20342,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22096,N,N,N,N,N,N, -21866,29038,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31307,N,N,N,N, -25889,21809,N,N,N,N,N,20333,N,28011,N,N,N,N,N,21810,N,N,N,21820,N,N,N,N,N,N,N, -N,N,32098,29485,N,32091,N,N,N,N,N,N,N,N,N,N,N,N,N,N,26928,N,N,N,N,N,N,N,20775, -N,N,32099,20019,N,N,N,N,N,N,N,32100,31310,N,N,N,N,18992,N,30503,N,20273,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,26146,N,31798,29229,28513,29486,23622,22891,N,N,N,26720, -N,N,N,N,N,N,N,24872,N,N,N,N,21878,20349,N,N,24157,N,N,N,22865,N,N,N,25706, -29263,N,30527,N,N,25190,25128,N,N,N,N,N,N,N,N,N,N,N,25430,N,27985,N,N,N,N,N, -27001,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22065,24114,N,N,24680,N,N,21291,N,27484,N, -N,24367,N,19011,N,N,28284,N,32067,N,N,N,27510,20274,N,N,N,N,22892,N,22845,N, -22623,N,N,21560,27454,23919,N,23920,23921,23922,N,N,22846,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,31558,20275,28285,N,N,N,N,N,N,25643,N,23109,N,22636,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,20776,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25129,N,N,24124,26421,N,N, -N,N,N,23408,N,28514,29040,20276,N,N,N,N,N,N,N,N,N,N,N,23409,N,24625,N,N,N,N, -24357,N,31058,N,N,26493,N,N,26147,31601,19248,29230,N,N,N,N,N,N,N,19815,N, -26716,N,N,26455,N,N,30528,N,20579,N,N,N,23073,N,N,N,19517,N,N,20777,23884,N,N, -25470,20778,26666,N,27190,31098,26188,30296,N,N,N,21575,N,N,N,22859,N,22866, -21323,22647,23081,30072,N,N,24158,29231,30761,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -22600,N,N,28225,N,N,N,N,31041,N,N,N,N,23923,27258,N,30269,24891,19775,29780, -26189,N,31823,31522,N,24668,N,N,N,N,29755,23125,N,31026,N,N,N,N,N,N,31602,N, -23414,N,24159,N,N,N,23410,N,N,N,N,N,30812,30574,27496,N,21114,N,N,28988,N,N, -31322,N,N,23146,23110,30529,N,N,26422,25927,22060,N,N,N,N,23623,N,N,N,N,N, -24873,N,25130,N,21798,N,N,21591,N,N,N,N,N,N,29264,N,27259,N,24669,31603,N,N,N, -N,N,N,N,28989,N,N,25191,32087,N,20040,27191,N,31808,N,32103,30575,N,N,22325,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28474,29021,N,24115,N,N,N,N,N,N, -26699,N,N,30813,N,N,31559,21832,N,22367,N,23849,N,N,N,N,N,26929,N,N,31277, -30297,31348,N,N,N,N,N,30762,N,N,N,N,N,26222,N,19548,24892,24687,N,N,26943, -31869,26190,N,N,24919,N,26191,N,29809,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,25715,N,N,25723,N,N,31076,N,N,N,N,N,N,N,N,N,N,28515,N,N,20334,30270, -24626,31870,20779,N,N,N,22394,N,N,N,31560,N,25175,N,N,N,N,N,N,21539,28792, -22312,N,N,N,24935,N,N,21311,N,N,N,N,N,N,28516,N,22341,27490,N,N,31847,N,N, -25634,N,25192,N,26192,N,31592,29800,25972,29756,29781,24374,N,31801,28226, -19061,N,N,N,28517,19298,21540,N,24160,23165,25670,26686,N,N,N,N,24670,30260, -27218,N,31099,N,N,24642,N,19044,N,26423,N,27261,N,22877,N,23092,28202,31593,N, -N,N,N,23371,23093,N,N,N,N,N,28990,N,N,21292,N,N,N,N,N,N,N,N,31561,N,24399,N,N, -21312,25431,N,28518,31824,N,N,N,N,N,N,N,26944,N,N,N,30035,N,N,27740,30519,N,N, -27192,20857,N,N,N,N,N,N,23624,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27193, -N,N,N,N,N,29022,N,N,N,N,N,22326,20277,N,22824,N,N,27758,N,N,23850,N,N,N,N, -19746,26670,N,N,N,24893,N,29265,N,N,N,N,26945,N,N,N,21116,N,N,N,N,N,N,N,23349, -N,29543,22654,N,N,N,31825,N,27954,29743,N,31523,N,N,31809,N,28203,21541,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29810,N,N,N,N,28249,N,N,N,31562, -N,N,N,N,N,19811,22587,25947,30839,N,N,N,30292,N,N,N,N,N,N,N,N,22313,N,19273,N, -N,26193,28748,N,N,N,N,N,N,N,N,N,N,22574,N,31059,21886,N,N,N,N,N,N,N,22588, -29232,N,N,N,N,25131,29544,N,N,N,N,N,28482,N,N,N,N,N,N,28012,N,26424,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,23166,N,N,19518,N,N,29308,23147,N,25176,27990,N,N,22097, -24627,N,N,31826,N,27464,N,N,N,N,N,N,N,N,21313,28749,N,20343,N,N,N,N,N,N,N,N,N, -27986,N,21592,23625,22385,N,N,24379,N,N,29477,N,N,N,29773,N,N,N,N,28991,30769, -N,27002,N,N,N,31563,N,N,19029,N,N,N,N,N,N,N,N,N,N,N,31060,30538,N,N,22088,N,N, -N,N,N,N,31848,29501,N,28286,N,26494,N,N,N,N,N,21314,N,N,N,N,21302,N,19501, -30330,22066,21080,N,N,N,N,N,N,26456,N,N,N,N,N,N,N,N,N,N,25381,N,N,N,N,26425,N, -N,N,N,28717,31564,27425,N,N,21542,N,N,N,N,31565,N,21821,29023,N,N,30331,N, -24116,N,N,N,N,N,N,N,N,N,N,N,N,21867,25928,N,N,N,31524,21561,N,N,24161,N,25635, -N,N,N,22327,N,30830,N,N,N,24117,N,N,22098,N,31061,26426,27477,21879,28519, -24894,N,N,N,31278,N,N,N,22121,22126,N,N,N,N,N,N,26427,N,N,N,N,N,N,N,27723,N,N, -N,N,N,N,21811,N,N,N,N,N,N,N,N,N,N,N,N,N,20020,N,N,N,31525,24942,N,N,N,N,N,N, -30504,N,N,N,N,31566,N,N,N,N,N,22589,N,N,N,N,N,N,N,31613,N,N,N,N,31849,N,N,N,N, -N,N,N,20278,N,N,N,27975,28204,N,N,N,N,N,N,N,19549,N,N,N,N,30247,N,N,N,26234,N, -N,N,29988,N,N,N,N,N,32092,27955,20041,N,N,N,N,N,N,28520,N,N,24895,N,N,N,N,N,N, -31323,19299,30505,N,31526,N,N,N,23609,N,N,N,28992,27976,28483,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,22061,N,N,32078,N,N,N,26657,N,N,N,N,N,N,N,N,31604,21799,N,N,N, -29046,N,26195,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19550,N,N,N,N,N,N,N,30770,N,N, -N,23659,32054,N,N,N,N,25962,N,N,29024,N,N,N,N,N,N,N,N,N,N,N,N,23372,23885,N,N, -N,21576,N,N,22893,N,N,N,N,29989,N,N,N,N,N,N,N,N,N,26235,N,N,N,N,N,26196,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,32072,N,22049,32063,N,31827,N,28449,N,26428,N,N,N,N, -N,20846,N,N,26197,N,N,26994,N,24368,N,N,N,N,N,22624,31802,32047,28750,N,23393, -N,N,25929,N,27956,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24643,N,N,N,N,N,N,25432,N,N,N,N, -27003,27176,N,N,N,N,32055,N,N,31527,N,26946,N,N,N,N,32119,N,N,N,N,N,25177,N,N, -23660,N,N,N,N,N,N,N,N,N,26658,N,N,N,N,26224,N,N,N,N,N,N,N,32120,32121,N,N,N, -30271,N,N,26407,N,26199,N,N,N,N,21619,21577,N,N,N,N,22138,N,22386,N,24896,N, -23394,26200,N,N,N,N,N,N,N,N,N,26429,N,N,N,N,N,28751,29502,25132,N,N,N,N,N, -30007,24688,N,N,N,N,N,N,N,N,N,N,N,N,32056,25448,N,21543,26748,31314,N,N,N,N,N, -30831,N,N,N,N,N,N,N,N,N,22099,N,N,N,N,N,N,N,N,N,N,21812,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,28752,N,30576,28211,N,N,27194,N,27219,N,N,27977,23851,N,N,N,25900,32033, -N,24400,27699,N,24401,N,N,N,N,N,28013,30776,30586,N,N,N,30763,N,N,N,N,N,29792, -N,N,N,N,N,21562,25651,N,26970,N,24118,N,22847,N,22848,22127,N,N,N,N,22860,N, -23082,N,N,N,N,N,N,N,N,24421,N,N,N,N,N,N,30565,N,N,N,19506,N,N,24441,22368,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21563,N,N,N,N, -32122,N,N,N,N,19507,N,N,23411,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24402,N,20042,N, -28250,N,N,N,N,N,N,N,N,N,25700,N,31567,N,N,N,N,N,N,20279,N,28227,N,N,N,N,N,N,N, -20074,N,N,N,N,N,N,N,25133,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22369,31349,N,N,21833, -30764,26457,N,N,N,N,N,N,N,N,N,N,N,29545,N,N,N,N,22637,25412,28785,N,N,N,N,N,N, -N,26725,N,N,N,24698,28228,22878,N,N,N,N,N,N,N,N,N,N,27426,27427,N,N,N,N,N,N, -31810,27195,N,N,N,N,26667,24162,N,N,N,N,N,N,N,N,N,N,28015,N,26659,N,N,N,N, -20337,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21564,N,31850,N,N,N,N,N,26430,N,31858,N, -N,22068,N,N,25134,N,21303,31308,N,N,N,N,N,N,N,N,31324,N,27957,24931,N,26668,N, -26717,N,N,28521,N,N,N,N,N,29757,N,20280,26971,20780,N,N,N,N,N,N,23111,N,N,N,N, -N,N,N,27465,N,26700,N,N,N,24119,N,N,N,N,22076,21349,N,N,N,N,N,31325,N,N,N,N,N, -N,23126,N,18993,N,N,N,N,N,N,23112,24358,N,31027,29266,N,19012,N,N,N,N,N,N, -20043,N,N,19829,N,N,N,32048,21800,N,28993,N,N,25193,23626,27700,31296,N,N, -31528,20520,N,N,23148,N,N,N,N,N,N,N,N,N,22894,N,24699,N,N,N,28522,31326,24644, -N,20281,N,21834,22370,25135,N,22328,N,N,N,N,N,N,N,N,N,26701,N,N,N,N,N,N,N, -30298,N,N,N,N,28450,25178,30332,N,N,31568,20781,N,19812,N,20782,23661,26702,N, -28793,20021,26236,N,N,22395,20566,23925,30577,N,30333,N,23415,N,N,N,N,31594, -26972,22849,N,30066,24645,N,N,N,N,N,N,27220,N,N,N,N,N,N,N,N,N,31042,N,27196,N, -21061,31569,26432,27429,N,24442,25378,22329,N,26947,N,26749,26671,N,N,29267, -31529,22565,N,N,N,N,21835,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20552,N,N,N,20783,22371, -N,N,N,24646,N,22050,N,28016,N,N,N,N,N,N,N,N,N,N,N,N,22387,N,N,N,31828,N,23127, -19551,N,29268,N,20784,N,19552,N,23421,29503,N,28753,N,N,N,N,N,31803,N,25136,N, -N,26149,N,N,N,25179,N,N,N,24414,N,24647,N,N,N,N,N,N,29295,N,N,N,19553,N,N,N,N, -22122,N,N,N,N,26434,N,N,N,20022,N,29504,N,19838,N,N,N,31570,N,30840,30587,N,N, -26687,N,N,N,N,N,N,N,26679,N,N,N,N,N,N,N,N,27958,23610,N,N,19508,N,N,N,N,N,N,N, -N,N,N,N,N,29047,N,N,N,26680,N,N,19062,N,25636,29782,N,N,N,24422,N,N,N,24359,N, -24423,24897,N,26948,N,N,23627,26949,N,N,N,28451,27430,19235,25449,N,N,N,20859, -28452,N,28523,N,N,N,N,N,N,N,N,N,N,N,N,20532,N,N,N,N,19747,N,N,26726,N,28453,N, -21324,23149,N,N,N,N,22330,N,29269,30053,22895,N,N,N,N,31028,N,N,21844,32079,N, -N,N,23395,N,N,N,N,29025,27702,N,N,N,N,31614,21335,N,20785,N,19249,N,N,N,N, -20786,N,N,N,N,N,N,19250,28994,N,N,29793,31029,N,N,24899,24898,N,27511,N,N,N,N, -N,N,N,N,N,N,N,24360,N,N,N,N,N,N,N,19274,N,N,N,N,N,26169,N,N,N,N,N,30814,31018, -19063,N,27959,N,N,21304,29270,N,N,21593,28229,29296,N,N,N,18994,N,N,23611,N, -29048,N,N,N,N,N,27703,N,N,N,N,25930,N,30272,32093,N,N,21603,19554,N,30548,N,N, -N,N,N,N,22373,N,N,N,N,N,N,N,N,N,N,N,N,N,21315,N,22566,N,30273,N,N,N,N,N,23926, -N,19776,25948,N,N,N,N,N,N,N,N,N,N,N,N,25931,N,N,N,N,N,N,N,N,N,N,N,24900,N,N,N, -N,N,26672,29744,29546,23150,N,22331,N,25137,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,22314,N,N,N,N,N,N,22139,N,N,N,N,N,N,N,N,N,25695,N,19030,N,N,N,27432,N,N, -N,23422,N,N,N,N,N,N,N,N,N,N,30274,N,N,28475,N,N,N,N,21629,N,N,24648,N,N,N, -26681,N,28454,N,N,N,N,N,19748,N,N,21620,23329,23388,23389,N,N,N,N,N,28252,N, -19275,31829,N,N,N,N,N,N,20075,N,19777,N,N,31571,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,31019,N,N,N,N,N,N,N,N,N,N,N,30036,N,N,N,N,22825,N,N, -26973,23373,N,N,23886,N,26435,N,27724,N,N,N,N,N,N,N,31084,N,N,N,19276,N,N,N,N, -24700,21544,N,27987,22639,N,29271,N,19064,23151,N,N,22100,N,N,N,N,N,N,22861,N, -N,N,22638,N,29249,N,N,N,24403,N,N,N,23152,N,25194,24701,N,N,22648,N,N,N,30511, -23094,N,19031,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29272,N,22649,N,N,N,N,N,N,N, -N,31327,N,N,N,N,N,N,N,N,N,N,N,N,N,20335,22850,N,28754,N,25681,N,N,N,29495,N,N, -N,N,N,N,N,N,N,N,N,N,31328,N,N,N,N,N,N,N,N,N,N,N,N,N,28524,N,N,N,N,N,25138,N, -21565,N,N,22862,N,N,N,N,29794,N,N,N,N,N,N,N,N,N,N,N,N,N,21545,N,N,N,N,19778, -26458,N,N,N,N,N,N,N,N,N,N,N,29273,N,N,N,N,N,22826,N,N,N,N,N,N,N,N,N,N,N,N, -22590,N,N,N,N,N,N,23597,N,N,N,N,N,N,25195,22140,N,N,19065,N,N,21594,N,N,N,N,N, -N,N,29783,19489,N,N,20282,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30008, -N,N,N,22851,20584,N,N,N,N,N,25413,27512,N,29233,N,N,N,20283,N,N,N,21293,26721, -20076,N,N,N,24628,24163,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,23927,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,29234,29558,30299,N,N,N,N,22398,N,N,N,N,N,30815,N,30578,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,20521,N,N,N,N,N,N,N,N,N,26202,N,N,N,N,N,N,N,N,N,N, -N,N,N,29990,N,N,N,N,N,N,N,N,N,N,N,N,N,22332,19555,N,N,26203,N,N,N,N,N,N,N,N,N, -N,N,N,23901,N,N,N,N,20787,N,N,N,N,N,28525,N,N,N,N,22110,25716,24943,N,N,23928, -N,N,N,N,N,26703,N,N,N,N,N,N,N,N,N,N,N,19045,N,N,N,23585,N,24629,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,31788,31789,22567,N,N,N,N,27960,N,N,N,23350,N,N,N,N,22128, -29487,N,N,19749,N,23153,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22568,N, -N,N,19556,N,N,20788,N,N,N,N,N,19032,N,N,N,N,N,23154,29991,N,N,N,N,N,N,N,N,N,N, -N,N,29992,N,N,N,N,N,N,N,26150,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21868, -21880,23155,N,N,N,N,N,N,N,N,N,N,N,N,N,25414,N,N,N,24164,N,24165,20789,N,N,N,N, -N,20790,20791,29235,N,N,N,N,N,N,26974,N,N,N,N,N,28755,29236,N,N,28756,19300, -31572,30054,25450,N,24166,N,N,N,N,24404,N,N,30841,N,N,N,N,28718,N,N,N,N,N,N,N, -N,N,N,N,N,20792,N,N,N,N,22111,N,20567,N,N,N,N,N,N,N,N,N,N,N,31777,28526,23640, -N,26975,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25949,32123,N,N,24649,N,N,N, -22089,N,N,21546,N,25932,N,N,N,N,N,26976,N,N,N,20568,31778,21566,25139,24167,N, -N,N,N,N,N,N,23612,21046,30037,N,N,N,N,N,20001,29993,N,N,23929,N,N,23930,N,N,N, -N,N,N,28757,N,N,N,N,30303,N,29274,25707,N,29297,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,27705,32124,N,N,N,N,24874,N,N,19033,N,N,28527,N,29994,N,N,N,N,N,N,27769,N, -N,30765,N,29250,30275,N,22354,N,N,31010,28758,N,N,N,N,N,N,N,N,N,N,N,N,N,28794, -N,N,30304,N,N,N,N,26995,29251,N,N,N,21547,18995,19750,N,19779,19802,N,N,N,N,N, -22863,N,N,30276,N,N,N,28253,26436,N,N,N,N,N,N,N,N,25140,N,N,N,N,N,N,N,N,N, -24418,26459,N,N,N,N,N,N,26673,N,31790,N,N,N,N,25933,N,N,N,31339,N,20284,N,N, -20322,19830,N,N,28528,N,29758,N,21581,N,N,29496,N,N,N,26913,N,N,N,N,N,N,N,N,N, -29298,29547,N,28759,N,N,20311,N,N,N,N,N,N,20319,N,N,N,N,N,N,N,N,N,26688,26689, -N,N,N,20323,26914,N,N,N,N,N,N,N,N,N,N,20522,N,N,N,N,N,N,N,N,N,29505,20523,N, -21604,N,N,28476,22561,N,N,N,N,N,N,N,N,N,N,N,22879,N,29527,N,N,N,23613,N,19557, -28017,N,N,29026,N,21595,N,N,N,N,25141,N,N,19046,N,21294,N,N,N,N,N,N,19558,N,N, -29011,30055,N,N,N,N,19034,31598,N,24901,N,N,N,N,N,N,N,24425,N,28254,N,N,30530, -N,22562,N,N,N,N,N,23852,N,N,N,N,N,28719,22077,N,N,N,N,N,N,N,N,N,N,N,24875,N,N, -N,N,N,N,N,N,N,N,N,N,31030,N,N,21621,N,20553,28455,25196,N,23402,20044,30056, -30549,N,21325,N,29566,N,N,N,N,N,N,N,N,N,20533,N,N,N,N,N,N,N,N,N,N,N,24702,N, -24443,N,N,N,N,N,N,26205,N,N,N,N,N,N,N,26660,N,N,N,N,N,N,N,N,N,19277,N,N,N, -28456,N,N,N,28212,N,N,N,N,23128,20793,N,24361,N,N,29488,N,N,19524,N,N,N,20023, -N,N,N,N,N,N,N,N,N,N,N,28457,N,N,N,24405,N,N,27991,N,N,N,28230,N,N,N,N,N,N,N, -28477,31830,N,N,23412,N,28458,30777,N,30057,N,N,N,N,N,N,N,N,25433,N,N,N,N,N,N, -N,N,N,N,N,N,N,24902,N,N,N,21567,N,N,N,N,24168,28778,N,N,N,N,N,N,N,N,N,N,29506, -N,N,N,N,N,N,N,N,N,N,N,21295,N,N,19035,N,N,N,N,N,31831,N,N,27992,24903,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,29784,22067,23853,N,N,N,21822,N,N,N,N,N,N,N,N,28995, -28255,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22123,N,N,N,29785,N,N,N,N,N,N,N, -22374,N,N,N,N,N,N,23095,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,23931,N,N,N,N,N,23887,N, -N,N,N,N,N,N,N,22563,N,N,23129,N,28760,28484,N,N,N,N,N,N,24920,N,N,N,N,N,29012, -N,28018,N,N,N,N,N,N,21851,N,N,21852,29508,19287,N,N,N,N,N,25142,N,N,N,N,28529, -N,N,N,N,N,N,N,N,N,N,N,31573,N,N,N,N,N,N,N,N,N,N,N,21336,N,N,N,N,N,N,N,23888, -28761,19251,N,N,N,N,N,N,21853,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19751,N,N, -20524,20794,N,28996,N,25907,31605,26977,32096,31804,N,23074,23075,N,21025,N,N, -21103,N,N,N,25197,N,N,24169,20060,29237,20580,23889,N,N,N,N,24904,23351,24419, -N,N,N,N,N,N,N,N,27961,28997,N,29519,22315,24876,N,N,25451,N,28231,N,N,N,24905, -19066,N,N,N,N,N,N,N,28795,31329,28762,19559,23156,N,N,N,N,N,N,N,N,N,19519,N,N, -N,N,N,N,N,N,N,N,N,N,N,20077,N,N,21801,31330,N,N,N,20581,N,27478,N,27743,N,N,N, -24444,N,N,30550,24170,19252,N,N,28478,N,N,19509,N,N,N,N,N,20285,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,28530,25143,N,N,N,19560,N,N,N,N,N,N,N,N,28796,N,N,N,22112,N, -28998,N,N,N,N,N,N,N,N,N,25144,27435,N,N,N,19253,22609,N,29774,29559,N,N,22342, -N,20795,30506,N,27978,22355,22650,N,N,N,N,N,N,N,30277,N,N,20812,23932,N,N,N,N, -N,N,N,N,N,N,24445,N,31077,N,24650,N,N,29309,21296,N,29811,23113,N,26206,N,N,N, -N,30778,26704,N,N,22651,N,N,27221,N,N,N,N,22051,N,N,N,N,N,N,30278,29275,25724, -N,N,N,N,N,N,N,N,N,N,26674,N,N,N,N,N,23130,N,29276,31574,26930,N,28205,N,31331, -N,N,N,N,N,N,N,23662,N,N,30058,26208,N,28797,N,N,N,N,N,22316,N,N,N,N,N,30021, -28256,N,N,23397,N,23902,N,N,22896,26915,N,N,N,N,N,N,N,N,N,N,29049,N,29252, -24651,N,N,N,N,N,N,N,N,26916,N,N,25145,N,N,N,N,N,N,N,25393,31851,19752,N,19510, -N,N,28763,N,N,N,N,N,N,N,N,26170,N,N,19753,N,N,N,N,N,29507,N,N,N,N,N,N,N,N,N, -24921,N,N,28459,N,N,N,26437,N,N,24681,N,29509,N,N,21568,21823,23854,N,31100,N, -19520,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25890,N,N,N,20024,N,N,N,22610,31062,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28970,20049,N,N,30279,N,23403,N,24446,N, -N,22625,N,30579,N,22375,N,N,N,N,N,N,N,N,N,N,N,21630,N,N,20796,N,25935,N,19254, -N,23096,N,N,N,N,N,19780,N,N,N,N,N,22078,N,N,N,25146,N,N,N,N,N,20312,N,N,N, -24652,27513,N,N,N,N,N,N,N,N,32125,N,N,N,N,N,22376,19288,N,N,N,26978,N,N,N, -26682,N,N,N,25415,N,N,N,N,27725,N,27726,N,22079,N,N,N,25383,N,24406,32104,N,N, -N,N,N,N,N,N,N,28257,30248,23933,N,N,N,N,N,N,N,30779,N,26705,N,N,N,N,31063,N,N, -N,N,N,N,N,N,20078,N,N,27727,26917,22101,N,19781,N,27962,20797,N,N,20286,N,N, -27707,N,N,N,21041,N,N,N,N,19561,N,22852,27004,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,20798,N,N,N,N,N,27708,N,N,25901,N,N,N,N,N,N,30512,N,19562,N,N,N,21316, -N,N,22080,N,N,N,22141,N,N,N,N,N,N,N,N,N,N,N,24865,N,24125,N,30249,N,N,N,23076, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22052,30022,N,24866,26950,N,N,N,29253,N,N,N,N, -N,29801,22124,27475,N,N,N,N,27709,25180,24171,28764,N,27455,N,22350,20799,N,N, -N,N,N,N,N,N,N,29995,N,N,N,N,31101,N,19036,N,N,N,19782,29238,N,N,23934,N,N,N, -19511,23352,N,N,N,N,20585,N,20061,27456,N,32034,N,N,N,N,N,30795,N,N,N,N,N,N,N, -N,27222,28976,N,N,N,N,N,N,N,23374,N,30531,N,N,N,N,N,N,N,N,N,N,N,23375,19236,N, -N,30816,N,N,31575,N,N,27466,24609,N,N,N,N,N,N,N,N,N,N,N,20045,N,N,21596,N,N,N, -32088,N,N,N,N,21110,29239,N,N,31350,30250,31351,22630,N,29745,N,N,N,N,N,N,N,N, -N,N,N,N,N,26706,N,19013,19563,N,N,N,N,N,N,N,25198,N,N,N,N,N,25147,N,30509,N,N, -N,30817,N,N,N,N,N,N,N,N,N,29548,N,N,N,N,24097,N,N,N,N,N,N,N,N,N,N,N,N,25725,N, -N,25452,N,23855,23856,N,N,19255,26707,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24867, -21088,N,N,N,N,28798,N,N,N,N,26918,19314,N,N,N,N,N,N,28019,23641,24653,N,N,N,N, -30554,23353,N,N,N,N,N,N,N,19502,N,23131,N,N,N,N,19783,N,N,N,N,N,N,N,N,N,N, -23857,N,22575,25379,N,N,20079,N,N,29299,N,N,N,N,30771,N,N,N,N,N,N,N,N,N,N, -24654,N,30077,N,N,N,N,27500,N,N,21317,31852,21083,21611,N,24098,N,N,N,25958,N, -N,N,N,N,N,28720,N,N,N,N,N,N,N,N,N,N,21828,N,N,N,N,N,N,28020,N,N,N,25453,N, -26690,N,28021,22396,N,27963,N,N,30251,N,N,N,N,N,29240,30280,N,N,N,N,N,21350, -29277,20287,N,27436,20288,N,26152,32105,N,20289,N,24671,24172,N,N,N,N,24610,N, -N,N,N,N,N,N,N,29759,25199,N,22897,28999,N,19256,N,N,N,N,N,N,N,N,31102,23354, -23157,N,N,N,N,N,N,N,N,30316,23132,31332,N,24655,N,N,N,N,N,N,23858,N,N,N,N, -26153,N,28531,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29549,N,N,N,N,N,N,N,N,N,N, -27514,N,31078,N,N,N,N,N,N,N,19037,21854,N,19038,24420,N,N,N,26237,N,29996,N,N, -N,N,N,25717,N,N,N,N,N,N,N,N,N,N,N,N,26979,N,27979,20324,N,N,N,22611,N,N,N,N,N, -N,23859,21612,N,N,29241,N,24375,N,N,N,N,N,19278,31576,N,N,20569,N,N,23890, -30580,26460,25637,N,31779,N,23355,N,N,N,29242,27005,20554,N,30038,22853,25652, -N,27943,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27197,26238,N,30532,29997,N,22880,N, -N,N,18996,N,N,30818,20290,N,27710,N,N,N,25908,19784,28232,N,N,N,N,N,N,N,N,N, -26440,N,N,N,N,N,N,N,N,N,N,N,19785,31031,29032,22898,23413,18997,22854,N,N,N, -22601,N,N,N,N,N,N,N,N,N,N,N,N,N,22827,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27964,N, -N,22612,N,N,N,23642,N,25148,N,N,31853,27744,21118,N,26951,26154,N,N,N,N,N,N, -25200,N,N,N,N,N,N,31291,N,29998,31530,N,N,N,N,27771,N,27711,31832,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21605,N,N,N,31043,N,N,N, -28258,N,N,N,N,N,N,N,N,N,N,N,N,N,22377,28022,N,N,N,24173,N,N,N,N,N,N,N,19564,N, -25454,N,N,N,N,N,26708,N,N,N,31352,N,N,N,N,N,N,23860,25653,22576,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,22613,N,N,N,29802,N,N,N,20025,N,N,N,22113,20306,N,20534,N, -N,N,N,N,N,20002,N,N,29550,N,N,N,N,N,29560,N,N,N,N,N,N,N,N,N,N,N,N,23628,N, -20555,N,N,N,31780,19786,22356,24099,N,25696,N,N,N,N,28233,N,N,N,25181,30078, -21548,N,N,N,N,N,21841,N,22640,30787,27223,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,30039,N,N,22591,N,N,N,N,32064,N,N,N,N,N,N,27437,N,N,N,N,21802, -N,N,N,N,N,N,N,N,N,N,N,26408,N,N,N,N,N,N,N,N,N,N,N,N,N,28234,N,N,N,19047,N,N,N, -N,N,30819,N,21597,N,N,27224,N,N,N,N,31577,28023,N,N,25909,N,N,N,N,N,20525,N,N, -N,N,29041,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25149,N,N,N,25416,N,N,N,N, -22869,N,N,24362,N,N,N,N,23356,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30820,N,N,N,N,N, -29050,N,N,25910,29551,N,N,31578,24928,N,22828,N,30059,N,24630,N,N,26952,N, -19279,N,25417,N,N,N,24174,N,N,N,N,N,N,N,N,25150,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,23663,N,22053,N,N,N,N,N,25201,N,N,N,N,N,N,N,22142,22817,N,22592,23643,N,N, -27965,24376,N,27173,N,N,N,22317,N,N,29561,N,28024,N,30023,N,N,N,N,N,N,24906, -27491,N,29278,N,N,N,N,N,N,N,N,N,N,N,N,N,30796,N,27225,N,21318,N,23398,N,N,N,N, -N,29999,N,N,N,N,20080,N,N,N,N,27006,N,N,N,N,N,31542,N,N,N,N,N,N,N,N,N,25202,N, -N,N,N,20338,30521,22899,N,N,24907,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -23133,N,N,23097,N,N,N,N,N,N,N,27515,N,19257,N,N,28025,N,N,N,N,N,N,24672,N,N,N, -N,N,N,N,N,N,N,29760,N,32060,24369,25455,N,N,N,N,24611,32057,N,N,N,N,N,N,N,N,N, -28721,N,N,N,N,N,N,19787,N,N,N,N,N,N,N,27966,N,N,N,21824,25456,28026,N,N,N,N,N, -26980,N,N,N,N,N,N,21869,26461,N,N,N,N,N,N,21622,25911,N,N,N,23399,25151,N,N,N, -N,N,N,N,N,N,N,N,N,28235,N,N,22388,28765,N,N,N,20011,26462,N,N,N,22102,24908,N, -N,26675,N,N,N,N,N,N,N,N,N,N,N,25966,23586,N,N,24656,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,21813,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21793,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,31579,N,31051,N,N,N,19315,29733,N,N,N,N,N,31304,22103,N,26981,31580,N,N, -N,N,N,N,N,32080,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31606,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,23077,N,23357,N,N,N,N,N,N,27746,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19831, -28766,N,N,N,N,30281,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -24175,N,N,N,21297,N,N,N,N,N,N,N,N,31854,N,N,N,N,26691,N,29000,N,N,N,20081,N,N, -N,N,31085,N,N,N,N,N,N,N,N,29300,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25654,30009,N, -23664,25457,N,N,N,N,26661,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29243,N,24100,N,23116, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,19049,N,N,N,N,N,N,25434,N,31833,N,N,N,N,N,N,N,27226,N,N,N, -N,N,N,31044,N,25380,N,N,N,N,N,N,N,N,N,N,N,31581,N,28490,N,26692,N,N,N,N,N,N,N, -N,N,21836,N,N,N,N,N,N,N,N,N,N,27479,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22829,N, -N,31531,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21337,N,N,N,N,N,N,21794,N,N,N,N,N,N,N, -N,N,30302,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,23158,N,N,N,N, -N,N,N,N,N,N,N,24657,N,N,26920,N,N,30073,N,N,N,N,N,N,31279,N,27516,N,N,24682, -25394,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,21829,N,N,29027,21870, -N,N,N,N,N,N,N,N,N,N,N,N,N,19788,N,N,N,N,27993,N,N,N,N,22593,N,N,N,N,31340,N,N, -N,N,N,29035,N,N,N,N,N,31292,26210,N,N,N,N,31333,25210,N,N,N,18998,N,25655,N, -27227,N,30074,N,N,N,31532,20291,27517,N,N,N,N,30842,N,N,24377,N,N,N,N,24945,N, -21028,N,N,N,N,30075,N,N,N,N,N,N,20570,20571,N,27198,22833,N,N,N,N,N,18999,N,N, -21351,N,30821,N,N,N,N,21298,N,N,N,25152,29279,N,N,N,N,N,N,19813,N,N,N,N,N,N,N, -N,N,N,N,N,31020,N,N,N,N,N,N,N,N,19789,N,N,N,N,N,N,N,N,N,N,N,N,28206,22062,N,N, -N,N,N,N,N,N,N,N,N,N,22378,N,N,N,N,26464,27438,N,N,N,20313,N,N,23629,28027,N, -24176,N,22379,N,N,N,N,N,N,24101,N,N,N,N,N,N,N,N,N,N,24407,23376,23377,N,N, -21795,N,N,N,N,28722,23644,N,N,N,N,N,N,N,N,19048,N,30822,23630,N,N,N,N,27228, -23378,N,N,N,N,N,N,N,N,N,N,N,26931,N,N,N,N,30555,N,N,N,N,N,N,N,N,N,N,N,25384,N, -22318,N,N,24673,N,N,N,N,N,19258,N,N,25937,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,20572,N,N,N,N,21825,N,N,N,N,N,22602,N,N,N,N,N,N,N,25385,N,N,N, -N,N,N,N,N,N,N,N,N,24612,N,26921,N,21319,N,N,23645,30766,N,N,N,19512,N,N,N, -20526,N,N,N,22642,N,N,25418,N,N,N,N,N,N,N,N,N,N,19503,N,N,N,N,N,N,N,21549, -30289,N,N,N,N,N,N,N,20556,N,N,N,N,N,N,N,19014,N,N,21826,N,N,20026,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,19015,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31280,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,24408,N,N,N,30010,25963,N,28532,23861,N,N,N,N,19754,N, -25458,N,31607,N,30544,N,N,N,N,32058,N,N,32097,30334,20800,N,N,26693,N,25656,N, -24936,N,N,N,19521,N,21101,N,N,N,N,23358,N,N,24674,N,N,N,31305,N,N,24909,N, -19000,N,N,N,29280,29001,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24177,N,N,N, -28767,30788,N,N,N,N,N,28236,N,N,24178,N,26441,N,25203,26465,N,N,25419,N,N, -25420,N,N,N,20344,28460,N,32126,31781,31281,24409,N,24658,N,N,N,29786,N,N,N,N, -N,N,N,N,N,N,N,29002,N,20003,N,N,N,N,29244,27747,N,N,N,N,N,24613,N,30507,N,N, -27439,N,N,N,N,N,25950,N,24868,19755,N,22900,26662,19790,24937,N,31855,N,24675, -N,N,N,N,N,25153,N,20004,N,N,N,N,N,N,24102,N,N,27518,N,27485,28768,N,N,29787,N, -25204,N,N,21320,N,N,N,29803,N,28213,N,30040,N,N,21855,N,N,N,22117,N,N,N,N, -27440,29795,N,N,N,N,25421,N,N,N,N,29812,31282,N,N,28533,19039,N,27441,27967,N, -N,32073,N,N,N,N,25638,31012,28723,N,25964,N,N,N,20839,22855,25687,27229,N, -21623,N,N,N,N,N,N,N,N,N,23098,N,23117,N,N,N,31052,N,24922,23359,N,19525,27728, -19259,N,24179,N,N,26922,N,N,N,N,N,N,N,22856,N,N,28259,22333,N,N,N,N,N,N,20292, -N,N,N,N,N,20557,N,N,N,N,N,N,N,31782,N,N,N,N,N,N,N,29051,N,N,N,N,32082,20801,N, -N,N,N,N,N,N,N,25435,N,21321,N,23631,N,N,N,N,N,N,N,N,N,19565,N,N,N,N,N,24103,N, -N,26171,27681,N,N,N,19513,N,N,31582,N,N,N,N,N,26466,N,N,21569,N,N,N,N,N,N,N,N, -N,23592,N,N,N,N,N,25154,N,29528,25939,N,N,29529,N,N,N,29510,19803,N,N,N,N,N,N, -N,19756,N,31811,N,N,N,N,21607,N,20802,N,31013,N,26709,N,N,N,N,N,N,N,N,25422,N, -N,N,N,21578,N,N,N,N,N,N,24410,N,N,N,N,N,N,N,N,31583,26467,N,N,N,N,N,N,N,N,N,N, -N,N,N,30843,25423,N,N,N,N,N,N,N,30000,N,N,N,N,N,N,N,22631,N,22857,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,30767,28534,N,23862,28207,19832,N,N,N,N,24120,31783,30588, -30513,20027,29729,N,N,28237,24878,N,N,27715,20350,N,30783,22626,21352,N,N, -24104,29796,27714,N,22901,31045,23891,22129,27772,31856,N,N,27968,19001,N, -28260,N,N,N,N,N,N,29281,N,24121,N,N,N,N,N,N,22130,N,24180,N,24411,N,23379,N, -31335,22627,29761,N,23863,N,N,N,29301,N,N,21550,N,N,N,N,N,N,22131,N,N,N,N,N,N, -23864,20293,24415,29246,30241,N,27467,29052,N,29511,N,N,24683,N,N,N,N,N,28028, -N,N,24923,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,28261,N,24181,N,N,N,N,31315,N,N,N,N,29003,N,N,20527,23865,N,N,20803,N, -N,N,N,N,N,N,N,N,N,N,N,N,30001,N,N,N,N,27206,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28769, -N,N,N,N,N,N,N,N,N,30252,N,N,N,N,30041,N,N,N,N,N,N,N,N,N,N,28779,N,N,N,N,N,N, -23866,N,N,N,29247,N,N,N,N,N,N,N,30533,N,N,N,N,23330,29302,N,N,19002,N,N,N,N,N, -N,N,N,N,N,N,30581,N,19301,N,N,N,28262,N,24659,N,N,N,N,20005,N,N,N,N,N,N,22104, -N,N,N,21551,26953,N,N,N,N,21326,29762,N,N,N,N,N,N,N,N,N,N,N,N,N,19302,N,N,N,N, -N,N,N,N,N,N,N,28961,N,N,N,N,N,27442,N,N,N,N,28962,N,N,N,N,N,N,N,N,N,N,N,N, -27443,N,28724,N,N,19316,21552,29490,31543,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30060,N, -N,N,N,N,28263,29746,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30061,N,20339,N,N,N, -N,N,N,N,N,N,N,28770,N,N,N,N,N,28238,N,N,29004,N,N,25912,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22389,25459,20325,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,20294,N,N,N,N,N,N,N,N,N,29491,25688,20345,20314,N,N,N,N,31309,N,N, -N,N,N,N,N,N,N,N,N,N,26211,N,N,N,N,N,N,N,N,N,N,N,29282,N,N,N,N,N,N,N,N,N,N,N,N, -30062,N,N,19003,N,N,25436,20082,N,22105,N,N,N,28208,N,N,N,N,N,N,N,N,29797, -22594,23632,19566,N,N,N,N,N,21856,30282,32074,22614,29775,N,N,N,N,N,N,22054, -23614,N,23380,22343,N,N,N,N,29310,N,N,N,29005,N,N,N,N,25155,23646,N,23647,N,N, -28461,26155,N,N,N,N,31069,27199,N,N,N,28462,N,N,N,29776,20083,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,26156,N,20062,N,N,21881,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25460, -19792,N,N,N,N,N,N,21816,N,N,30589,N,23593,N,N,N,N,24182,N,23594,29283,26932, -21084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,26982,N,N,25462,N,N,N,N,N,N,N,N,26442,N,N, -20558,N,N,23159,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19004,N,N,N,28264,23134,N, -29303,N,N,25211,N,19494,N,N,N,N,23099,N,28265,N,N,N,30042,30556,24938,20033, -21553,N,32049,26173,N,31533,N,N,30823,N,24910,N,30562,30063,20295,N,N,21554, -19567,N,21608,N,28239,30551,N,N,24614,22081,24924,28771,29028,23665,22055,N,N, -N,N,N,N,N,N,N,N,29813,N,N,29006,29284,N,N,20528,N,N,27759,N,N,N,31034,N,27445, -N,N,21613,25156,N,N,N,N,26983,N,N,27444,27169,N,30780,20006,N,31046,31834,N, -21555,21305,27230,N,N,N,26923,N,N,24929,21327,29814,N,27200,24911,N,19514,N,N, -N,N,N,28266,N,N,N,28772,29492,21614,N,N,29248,N,N,29029,N,29763,24660,N,27446, -N,22305,19304,N,31021,26925,22628,31283,25157,31805,N,N,27716,22577,N,23595,N, -N,N,N,21796,N,27497,N,N,N,26683,N,N,N,22615,N,N,N,N,N,N,N,N,31534,20833,N,N, -23360,N,30014,N,24183,N,N,N,N,19067,30534,20296,N,N,N,24912,N,N,28240,N,N,N,N, -N,N,N,N,26996,N,N,N,N,N,N,N,N,20084,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -21837,N,N,20315,N,N,N,N,N,N,23867,N,N,N,N,20012,N,N,N,N,N,N,N,26984,N,N,N,N,N, -N,N,21556,25671,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,30043,N,N,31297,N,N,N,24105,N,N, -N,N,N,N,N,N,N,N,N,N,N,21624,N,N,N,N,N,28535,N,N,N,N,21299,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,27447,28536,30044,27980,23381,29007,N,N,N,29008,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,30002,N,N,N,N,N,N,22830,21804,N,25158,N,N,N,N,N,N,N,N, -32035,N,31589,24363,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25205,N,30253,N,30003,N,28725, -N,N,N,N,24869,N,N,N,N,N,N,N,N,N,30045,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27682,28029, -N,30004,31544,N,23331,N,N,22090,19289,N,N,N,N,N,N,N,N,N,N,25940,N,N,N,N,N,N, -29562,N,27448,N,24631,22380,29036,25903,21857,22381,20817,N,N,N,N,N,24946, -28537,N,N,N,23868,30300,N,N,N,N,N,28773,N,N,N,29764,N,N,26985,N,N,N,N,N,N,N,N, -N,N,29563,21615,N,N,19490,30590,24380,N,N,N,N,27469,N,N,N,N,N,N,20535,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22082,N,N,N,N,N,26669,N,N,N,N,28463,19237,N, -N,N,N,19305,N,N,N,31336,N,N,N,N,N,N,N,N,N,N,N,N,N,19526,N,N,N,26215,N,N,27207, -N,N,N,23332,N,20297,25212,28538,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,27486,N,N,30024,N,21598,N,N,N,N,N,N,N,N,N,N,N,24661,N,28464,N,N,25159,N, -22831,N,N,N,31079,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,26469,N,N,20298, -24913,N,25160,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28539,N,N,31353,N,N,23666,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,24615,N,N,N,N,N,30824,N,N,N,N,N,N,N,N,N,N,N,N, -N,19306,N,N,N,19260,22114,N,N,N,N,N,N,N,N,N,N,N,30046,N,N,N,N,N,N,N,30047,N, -28214,N,N,N,25206,21322,28540,20804,28465,N,20805,N,20574,N,22881,N,N,24632,N, -N,19793,29497,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,26444,N,22056, -20007,N,21557,N,N,N,N,N,N,25672,N,N,N,N,N,N,21300,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,27449,N,N,N,N,N,N,19317,N,N,N,N,N,N,30301,N,28963,N,N,N,N,N,N,N,N,N,N, -N,N,N,19527,N,N,N,N,N,N,N,26954,N,24944,N,N,N,30048,N,N,N,N,N,N,N,N,31535,N,N, -N,19281,N,N,N,N,31584,29285,N,N,27760,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -28780,N,N,N,N,N,N,N,N,N,N,N,N,N,28267,N,N,N,N,N,N,N,N,N,N,N,N,26955,N,N,19568, -N,N,22319,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29473,31861,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,28964,N,N,N,N,N,N,N,N,N,N,N,N,24662,N,N,N,N,N,28466,N,N,N,N,N, -N,N,N,N,29777,N,N,30497,N,N,N,N,N,N,N,N,N,N,N,29009,N,N,N,N,N,N,N,N,N,N,N,N, -19068,19069,N,N,N,N,N,N,N,N,20046,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,29512,N,29498,28030,N,N,N,N,N,N,N,N,23078,N,N,24684,N,N, -N,N,N,30797,N,19282,N,N,N,27470,N,31064,31065,19040,23114,N,N,N,19238,N,N,N,N, -N,N,N,N,N,N,19016,31086,23404,N,N,20529,N,N,N,N,21871,N,N,N,26227,N,N,N,N,N,N, -N,N,N,26402,25689,N,N,N,N,N,N,N,N,N,N,25697,N,N,31812,N,N,N,N,N,N,N,N,N,31087, -20340,30566,N,N,N,N,N,20028,N,N,N,N,29765,23587,23869,N,N,N,N,29766,N,N,N,N,N, -N,N,N,30753,N,N,N,26710,N,N,N,23361,N,N,N,N,N,N,N,N,28774,N,N,N,25657,30317,N, -31022,N,23870,N,N,N,N,N,N,22320,22632,19261,N,N,31066,N,N,N,N,N,N,N,N,N,N, -30798,31088,24685,25395,29747,N,N,27202,29286,28726,N,N,N,N,N,23382,N,N,N,N,N, -27492,N,N,29287,N,22357,21558,31080,22337,N,N,N,N,25941,N,N,N,N,N,N,N,26986, -22348,N,N,N,21353,25161,N,31835,19757,N,N,N,N,N,19504,27170,N,N,25718,20544,N, -28727,28193,N,N,N,N,N,N,22390,N,N,N,25162,25163,N,31311,N,N,N,N,N,N,27487,N,N, -N,N,N,22091,N,N,N,29748,N,N,N,N,27981,25682,N,N,27177,25658,29474,19794,N, -30283,N,29030,27969,26684,28241,N,N,N,N,N,N,28775,25164,N,N,25642,N,30049, -27994,N,N,N,N,N,22382,20849,N,N,N,N,26987,26988,24676,N,N,N,N,23079,23892,N, -27171,N,N,N,22083,22132,N,23135,N,28467,25165,N,N,N,N,N,28541,29288,N,N,N,N,N, -N,N,N,N,28485,N,26471,N,N,22397,N,N,26446,N,N,24412,N,31047,N,N,N,N,N,N,N,N, -22902,N,N,N,N,N,N,N,N,24364,N,22106,N,N,N,N,N,N,23588,N,N,N,28728,N,N,N,N, -21882,N,25719,N,N,N,22084,N,N,N,N,N,N,N,N,29804,N,N,N,N,28542,N,N,N,N,N,28705, -N,24106,N,N,23100,22652,N,N,N,N,N,N,31316,N,N,N,27749,N,N,N,N,N,N,31784,N,N, -27750,N,N,22603,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31545,N,25683,N,19833,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,20307,N,N,N,N,N,N,N,19050,N,N,20308,N,30781,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29767,N,N,N,N,27231,N,N,N,N,N,N,N,31067, -N,N,N,N,N,N,N,N,21559,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27493,N,N, -24914,N,N,N,N,27172,N,N,N,31298,31585,31341,28706,19569,N,31267,25207,N,25166, -N,26997,N,24939,N,N,N,26472,26711,23160,21579,N,N,N,30582,22085,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,21609,N,N,31354,N,N,N,N,N,N,N,19570,30557,N,24122,N, -N,N,N,N,N,N,N,N,N,20008,N,N,N,N,N,28729,25726,25673,N,N,N,N,N,25684,N,N,N, -27203,N,28468,N,N,N,22334,N,N,N,N,N,N,31586,N,19795,N,N,N,28469,N,N,N,31337,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31014,N,N,N,N,N,N,24381,N,30535,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,30845,N,N,30844,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -24107,23400,N,N,25437,N,24930,20806,N,N,N,N,N,N,N,N,N,N,30288,27494,23161,N,N, -N,N,27719,N,N,N,N,N,N,N,24184,30825,25438,20085,N,N,N,N,N,31299,25943,N,27720, -N,N,N,29513,N,N,25659,N,N,N,N,26158,N,N,N,N,N,28470,N,23615,N,N,N,N,N,N,N, -20029,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22595,N,N,N, -20559,N,20346,29514,24663,N,N,N,20807,26926,N,26685,N,N,31300,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25167,N,N,31301,N,N,N,31032,N,N,N,N,N,N,N,23648, -N,N,31536,N,N,N,22569,25951,31015,N,N,30318,N,30284,25208,N,N,N,N,27761,N,N,N, -N,N,N,N,23136,N,N,N,N,N,N,N,N,N,N,N,N,N,N,29010,21068,20299,N,N,19005,N,N,N, -23871,N,N,N,30319,N,24185,N,N,N,N,N,N,N,N,N,N,N,N,N,31284,N,N,N,21805,N,N,N,N, -N,N,N,N,N,N,N,N,N,29031,24126,N,N,N,N,N,N,23616,N,N,N,N,N,20808,20809,N,N,N,N, -N,N,N,N,N,30782,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19318,N,N,N,N,21625,N,N,N,N, -N,30050,24915,N,N,N,N,N,N,N,N,22633,N,N,30846,N,20300,N,N,N,N,N,N,N,32036,N,N, -N,N,N,N,N,20086,N,31312,N,N,19571,26174,N,N,N,30254,N,N,21872,N,N,20810,N,N,N, -31806,21873,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19817,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,31285,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,25168, -29815,N,N,N,19796,N,N,N,N,N,N,N,N,N,N,N,N,26403,N,N,N,N,N,N,N,N,23333,25169,N, -N,N,N,N,N,N,N,N,N,N,N,22306,N,N,30563,N,N,N,N,N,N,27174,N,N,N,N,N,N,N,N,N,N, -20513,N,N,N,N,20058,31595,23334,23390,22629,N,N,N,N,N,N,N,N,N,27232,N,N,N,N, -22570,N,N,N,N,N,25952,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22107,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28486,N,N,30826,N,N,N,N,N,N, -N,N,N,N,N,N,N,25685,N,N,N,N,N,N,N,N,N,N,N,20087,N,N,24664,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22383,N,N,N,N,N,N,N,N,N,N,N,N,29805,N,N,N,N,N, -N,N,N,N,N,N,N,N,19814,N,N,N,19572,30051,N,N,25674,N,23649,N,N,31048,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,31807,N,N,N,N,N,N,N,N,N,N,N,N,26663,N,N,N,N,N,N,N,N,22596, -N,N,N,N,N,N,N,N,N,N,N,19262,N,23598,N,N,N,N,N,N,N,N,N,N,N,N,N,22391,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28776,N,23872,N,20301,N,N,N,N,N,N,N,N,N, -23667,22832,N,26217,25660,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,27204,N,N,N,N,N,N, -N,N,N,N,25708,N,25701,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,31608,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,19515,N,N,N,N,N,N,N,N,N,N,N,25661,N,N,19804,22903, -N,N,N,N,N,N,N,N,N,N,23903,N,N,N,N,N,27982,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22864, -N,N,N,N,N,25891,N,N,N,N,31053,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,19758,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,20302,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,30255,N,N,N,N,N,32083,27501,22108,25892,N,N,N,21814,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22109, -N,N,N,31081,N,N,N,26404,N,22115,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,20811, -22116,N,N,N,21874,N,N,N,N,N,24186,N,22392,N,N,N,N,N,22634,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,20309,22653,N,N,N,N,N,22571,N,N,32075,N,N,N,N,31836,N,N,N,N,N,N,N,N,N, -24616,21875,N,N,32089,N,N,19491,N,N,N,22905,N,N,21354,30069,N,28487,N,N,N,N,N, -N,N,N,N,21338,N,N,N,N,N,N,N,N,N,N,N,23101,26664,23599,N,N,N,N,N,28707,N,N,N,N, -19797,N,N,N,N,N,N,N,N,N,N,N,N,24617,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,24108,N,N,N,N,N,N,N,N,N,N,N,N,N,N,28730,28209,N,N,28210,N,N,N,30285, -N,N,N,N,N,N,N,N,N,N,N,N,28242,N,22086,N,N,N,N,N,24677,N,N,29499,N,25953,N,N,N, -N,N,N,N,N,N,N,25675,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,22307,N,N,23362, -N,N,N,N,19070,N,N,N,N,N,N,20303,12321,12322,33089,33090,12323,33091,33092, -12324,12325,12326,12327,33093,33094,33095,33096,33097,12328,12329,12330,12331, -12332,12333,12334,12335,33098,12336,12337,12338,12339,12340,33099,33100,12341, -33101,33102,33103,12342,33104,33105,33106,33107,33108,33109,33110,12343,12344, -33111,12345,12346,12347,33112,33113,33114,33121,33122,33123,12348,12349,33124, -33125,12350,33126,33127,33128,12351,33129,33130,33131,33132,33133,33134,33135, -33136,33137,33138,12352,33139,12353,33140,33141,33142,33143,33144,33145,12354, -33146,33153,33154,12355,33155,33156,33157,12356,33158,33159,33160,33161,33162, -33163,33164,33165,33166,33167,33168,33169,33170,33171,33172,33173,33174,33175, -33176,12357,12358,33177,33178,12359,33179,33180,12360,12361,33181,12362,33182, -33183,33184,33185,33186,12363,12364,33187,12365,12366,12367,12368,33188,33189, -12369,12370,12371,12372,33190,33191,33192,12373,33193,33194,33195,12374,33196, -33197,33198,33199,33200,33201,33202,12375,12376,33203,12377,12378,12379,33204, -33205,33206,33207,33208,33209,12380,12381,12382,33210,12383,33211,33212,12384, -12385,33213,33214,33215,33216,33217,33218,33219,12386,12387,33220,12388,12389, -12390,33221,33222,33223,12391,33224,33225,12392,33226,33227,33228,12393,33229, -33230,33231,12394,33232,33233,33234,33235,33236,33237,33238,33239,12395,33240, -12396,33241,33242,33243,33244,33245,33246,33247,33248,12397,12398,33249,33250, -12399,33251,33252,12400,12401,33253,12402,33254,12403,33255,33256,12404,12405, -12406,33257,12407,33258,12408,12409,33259,33260,33261,33262,33263,12410,12411, -33264,33265,12412,33266,33267,33268,12413,33269,12414,33270,33271,33272,33273, -33274,12577,12578,33275,12579,33276,12580,33277,33278,33345,33346,33347,33348, -12581,33349,33350,33351,12582,33352,33353,33354,12583,33355,33356,33357,33358, -33359,33360,33361,33362,12584,33363,33364,12585,12586,33365,33366,33367,33368, -33369,33370,12587,12588,33377,33378,12589,33379,33380,33381,12590,33382,33383, -33384,33385,33386,33387,33388,12591,12592,33389,12593,33390,12594,33391,33392, -33393,33394,33395,33396,12595,33397,33398,33399,12596,33400,33401,33402,12597, -33409,33410,33411,33412,33413,33414,33415,33416,12598,33417,12599,33418,33419, -33420,33421,33422,33423,33424,33425,12600,12601,33426,33427,12602,33428,33429, -12603,12604,12605,12606,33430,33431,33432,33433,12607,12608,12609,33434,12610, -33435,12611,12612,33436,33437,33438,33439,33440,12613,12614,33441,33442,12615, -33443,33444,33445,12616,33446,33447,33448,33449,33450,33451,33452,33453,33454, -33455,33456,12617,12618,33457,33458,33459,33460,33461,33462,12619,33463,33464, -33465,33466,33467,33468,33469,33470,33471,33472,33473,33474,33475,33476,33477, -33478,33479,33480,12620,33481,33482,33483,33484,33485,33486,33487,33488,12621, -12622,33489,33490,12623,33491,33492,33493,12624,33494,33495,33496,33497,33498, -33499,33500,12625,12626,33501,12627,33502,33503,33504,33505,33506,33507,33508, -33509,12628,33510,33511,33512,12629,33513,33514,33515,12630,33516,33517,33518, -33519,33520,33521,33522,33523,33524,33525,33526,33527,33528,33529,33530,33531, -33532,33533,33534,12631,12632,33601,33602,12633,33603,33604,12634,12635,12636, -33605,33606,33607,33608,33609,33610,12637,12638,33611,12639,33612,12640,33613, -33614,33615,33616,33617,33618,12641,33619,33620,33621,33622,33623,33624,33625, -33626,33633,33634,33635,33636,33637,33638,33639,33640,33641,33642,33643,33644, -33645,33646,33647,33648,33649,33650,33651,12642,12643,33652,33653,12644,33654, -33655,12645,12646,33656,12647,33657,33658,33665,33666,33667,12648,12649,33668, -12650,33669,12651,12652,33670,33671,33672,12653,33673,12654,12655,12656,33674, -12657,33675,33676,33677,12658,33678,12659,33679,33680,33681,33682,33683,12660, -12661,33684,12662,12663,12664,33685,33686,33687,12665,33688,33689,12666,12667, -33690,33691,12668,33692,33693,33694,12669,33695,33696,33697,33698,33699,33700, -33701,12670,12833,33702,12834,12835,12836,33703,33704,33705,33706,33707,33708, -12837,12838,33709,33710,33711,33712,33713,33714,12839,33715,33716,33717,33718, -33719,33720,33721,33722,33723,33724,33725,33726,33727,33728,33729,33730,33731, -33732,33733,33734,33735,33736,33737,33738,33739,33740,33741,33742,33743,33744, -33745,33746,33747,33748,33749,33750,33751,33752,33753,33754,33755,33756,33757, -33758,33759,33760,33761,12840,12841,12842,33762,12843,33763,33764,33765,12844, -33766,33767,33768,33769,33770,33771,33772,12845,12846,33773,12847,12848,12849, -33774,33775,33776,33777,33778,33779,12850,12851,33780,33781,12852,33782,33783, -33784,33785,33786,33787,33788,33789,33790,33857,33858,12853,33859,33860,12854, -33861,12855,33862,33863,33864,33865,33866,33867,12856,33868,33869,33870,12857, -33871,33872,33873,12858,33874,33875,33876,33877,33878,33879,33880,33881,33882, -33889,12859,12860,33890,33891,33892,33893,12861,33894,33895,12862,33896,33897, -33898,33899,33900,33901,33902,33903,33904,33905,33906,33907,33908,33909,33910, -33911,33912,33913,33914,33921,33922,33923,33924,33925,33926,33927,33928,12863, -12864,33929,33930,12865,33931,12866,33932,12867,33933,33934,33935,33936,33937, -33938,33939,12868,12869,33940,12870,33941,12871,12872,12873,33942,33943,33944, -33945,12874,12875,33946,33947,33948,33949,33950,33951,12876,33952,33953,33954, -33955,33956,33957,33958,33959,33960,33961,33962,12877,12878,33963,33964,33965, -33966,33967,33968,12879,12880,33969,33970,33971,33972,33973,33974,33975,33976, -33977,33978,33979,33980,33981,33982,33983,33984,33985,33986,33987,12881,33988, -33989,33990,33991,33992,33993,12882,33994,33995,33996,12883,33997,33998,33999, -12884,34000,34001,34002,34003,34004,34005,34006,12885,12886,34007,34008,34009, -12887,34010,34011,34012,34013,34014,34015,12888,34016,34017,34018,34019,34020, -34021,34022,34023,34024,34025,34026,34027,34028,34029,34030,34031,34032,34033, -34034,34035,34036,34037,34038,34039,34040,34041,34042,12889,12890,34043,34044, -12891,34045,34046,34113,12892,34114,34115,34116,34117,34118,34119,12893,12894, -12895,34120,12896,34121,12897,12898,34122,34123,34124,34125,34126,12899,34127, -34128,34129,34130,34131,34132,34133,12900,34134,34135,34136,34137,34138,34145, -34146,34147,34148,34149,34150,12901,12902,34151,34152,34153,34154,34155,34156, -12903,12904,34157,34158,12905,34159,34160,34161,12906,34162,34163,34164,34165, -34166,34167,34168,12907,12908,34169,34170,12909,34177,34178,34179,34180,34181, -34182,34183,12910,34184,34185,34186,12911,34187,34188,34189,12912,34190,34191, -34192,34193,34194,34195,34196,12913,12914,34197,34198,34199,34200,34201,34202, -34203,34204,34205,34206,12915,34207,34208,34209,34210,34211,34212,34213,34214, -34215,34216,34217,34218,34219,34220,34221,34222,34223,34224,34225,34226,34227, -34228,34229,34230,34231,34232,34233,12916,12917,34234,34235,12918,34236,12919, -34237,12920,34238,12921,34239,34240,34241,34242,12922,12923,12924,34243,12925, -34244,12926,34245,34246,34247,13089,34248,34249,34250,34251,34252,34253,34254, -34255,34256,34257,34258,34259,34260,34261,34262,34263,34264,34265,34266,34267, -34268,34269,34270,34271,34272,34273,34274,34275,34276,34277,13090,13091,34278, -34279,13092,34280,34281,34282,13093,34283,34284,34285,34286,34287,34288,34289, -13094,13095,34290,13096,34291,13097,34292,34293,34294,34295,34296,34297,13098, -13099,13100,34298,13101,34299,34300,13102,13103,13104,13105,34301,34302,34369, -34370,34371,13106,13107,34372,13108,13109,13110,13111,13112,34373,13113,34374, -13114,13115,13116,34375,34376,13117,34377,34378,34379,13118,34380,34381,34382, -34383,34384,34385,34386,13119,13120,34387,13121,13122,13123,34388,34389,34390, -34391,34392,34393,13124,13125,34394,34401,13126,34402,34403,34404,13127,34405, -34406,34407,34408,34409,34410,34411,13128,34412,34413,34414,34415,13129,34416, -34417,34418,34419,34420,34421,34422,34423,34424,34425,34426,34433,34434,34435, -34436,34437,34438,34439,34440,34441,34442,34443,34444,34445,34446,34447,34448, -34449,34450,34451,34452,34453,34454,34455,13130,13131,34456,13132,13133,34457, -34458,34459,13134,34460,13135,13136,34461,34462,34463,34464,13137,13138,34465, -13139,13140,13141,34466,34467,34468,34469,34470,13142,13143,13144,34471,34472, -13145,34473,34474,34475,13146,34476,34477,34478,34479,34480,34481,34482,13147, -13148,34483,13149,13150,13151,34484,34485,34486,34487,34488,34489,13152,13153, -34490,34491,13154,34492,34493,34494,13155,34495,34496,34497,34498,34499,34500, -34501,13156,13157,34502,34503,13158,13159,34504,34505,13160,34506,34507,34508, -13161,34509,34510,34511,13162,34512,34513,34514,34515,34516,34517,34518,34519, -34520,34521,34522,34523,34524,34525,34526,34527,34528,34529,34530,34531,34532, -34533,34534,13163,13164,34535,34536,13165,34537,34538,34539,13166,34540,13167, -34541,34542,34543,34544,34545,13168,13169,34546,13170,34547,13171,34548,34549, -34550,34551,13172,13173,13174,34552,34553,34554,13175,34555,34556,34557,13176, -34558,34625,34626,34627,34628,34629,34630,34631,34632,34633,34634,13177,34635, -34636,34637,34638,34639,34640,34641,34642,34643,34644,34645,34646,34647,34648, -34649,34650,34657,34658,34659,34660,34661,34662,34663,34664,34665,34666,34667, -34668,34669,34670,34671,34672,34673,34674,34675,13178,34676,34677,34678,13179, -34679,34680,34681,13180,34682,34689,34690,34691,34692,34693,34694,13181,13182, -34695,13345,34696,34697,34698,34699,34700,34701,34702,34703,13346,13347,34704, -34705,13348,34706,34707,34708,13349,34709,34710,34711,34712,34713,34714,34715, -34716,13350,34717,13351,34718,13352,34719,34720,34721,34722,34723,34724,13353, -13354,34725,34726,13355,34727,34728,13356,13357,34729,34730,34731,34732,34733, -34734,34735,13358,13359,34736,13360,34737,13361,34738,34739,34740,34741,34742, -34743,13362,34744,34745,34746,34747,34748,34749,34750,34751,34752,34753,34754, -34755,34756,34757,34758,34759,34760,34761,34762,13363,34763,34764,34765,34766, -34767,34768,34769,13364,34770,34771,34772,34773,34774,34775,34776,34777,34778, -34779,34780,34781,34782,34783,34784,34785,34786,34787,34788,34789,34790,34791, -34792,34793,34794,34795,34796,13365,34797,34798,34799,13366,34800,34801,34802, -13367,34803,34804,34805,34806,34807,34808,34809,13368,13369,34810,34811,34812, -34813,34814,34881,34882,34883,34884,34885,13370,13371,34886,34887,34888,34889, -34890,34891,13372,34892,34893,34894,34895,34896,34897,34898,13373,13374,34899, -34900,34901,13375,34902,34903,34904,34905,34906,34913,13376,13377,34914,34915, -13378,34916,34917,34918,13379,13380,13381,34919,34920,34921,34922,34923,13382, -13383,34924,13384,34925,13385,13386,34926,34927,34928,13387,34929,13388,34930, -34931,34932,13389,34933,34934,34935,13390,34936,34937,34938,34945,34946,34947, -34948,34949,34950,34951,34952,34953,34954,34955,34956,34957,34958,34959,34960, -13391,13392,34961,34962,13393,34963,34964,34965,13394,34966,13395,34967,34968, -34969,34970,34971,13396,13397,34972,13398,34973,13399,34974,34975,34976,34977, -13400,34978,13401,13402,13403,34979,13404,34980,34981,13405,13406,13407,13408, -13409,34982,34983,34984,13410,13411,13412,34985,13413,13414,13415,13416,13417, -34986,34987,34988,13418,13419,13420,34989,34990,13421,34991,34992,34993,13422, -34994,34995,34996,34997,34998,34999,35000,13423,13424,35001,13425,13426,13427, -35002,35003,35004,35005,35006,35007,13428,35008,35009,35010,35011,35012,35013, -35014,35015,35016,35017,35018,35019,35020,35021,35022,35023,35024,35025,35026, -35027,35028,35029,35030,35031,35032,35033,35034,35035,35036,35037,35038,35039, -35040,35041,35042,35043,35044,35045,35046,35047,35048,35049,35050,35051,35052, -35053,35054,35055,35056,35057,35058,35059,35060,35061,35062,13429,13430,13431, -35063,13432,35064,35065,13433,13434,35066,13435,13436,35067,35068,35069,35070, -13437,13438,35137,13601,35138,13602,35139,13603,35140,35141,13604,35142,13605, -13606,35143,35144,13607,35145,35146,35147,13608,35148,35149,35150,35151,35152, -35153,35154,13609,13610,35155,13611,13612,13613,35156,35157,35158,35159,35160, -35161,13614,35162,35169,35170,13615,35171,35172,35173,13616,35174,35175,35176, -35177,35178,35179,35180,35181,35182,35183,35184,13617,13618,35185,35186,35187, -35188,35189,35190,13619,35191,35192,35193,13620,35194,35201,35202,35203,35204, -35205,35206,35207,35208,35209,35210,35211,35212,35213,35214,35215,35216,35217, -35218,35219,35220,35221,35222,13621,13622,35223,35224,13623,35225,35226,13624, -13625,35227,13626,35228,13627,35229,35230,35231,13628,13629,35232,13630,35233, -13631,35234,13632,35235,13633,35236,35237,13634,35238,35239,35240,13635,35241, -35242,35243,13636,35244,35245,35246,35247,35248,35249,35250,35251,35252,35253, -35254,35255,35256,35257,35258,35259,35260,35261,35262,13637,35263,35264,35265, -35266,35267,35268,35269,35270,35271,35272,35273,35274,35275,35276,35277,35278, -35279,35280,35281,13638,35282,35283,35284,35285,35286,35287,35288,13639,35289, -35290,35291,13640,35292,35293,35294,13641,35295,35296,35297,35298,35299,35300, -35301,13642,13643,35302,13644,35303,35304,35305,35306,35307,35308,35309,35310, -13645,35311,35312,35313,35314,35315,35316,35317,35318,35319,35320,35321,35322, -35323,35324,35325,35326,35393,35394,35395,35396,35397,35398,35399,35400,35401, -35402,35403,13646,13647,35404,35405,13648,35406,35407,35408,13649,35409,35410, -35411,35412,35413,35414,35415,13650,13651,35416,13652,35417,13653,35418,35425, -35426,35427,35428,35429,13654,35430,35431,35432,35433,35434,35435,35436,35437, -35438,35439,35440,35441,35442,35443,35444,35445,35446,35447,35448,13655,35449, -35450,35457,35458,35459,35460,35461,13656,35462,35463,35464,35465,35466,35467, -35468,35469,35470,35471,35472,35473,35474,35475,35476,35477,35478,35479,35480, -35481,13657,35482,35483,35484,35485,35486,35487,13658,35488,35489,35490,13659, -35491,35492,35493,13660,35494,35495,35496,35497,35498,35499,35500,35501,13661, -35502,13662,35503,13663,35504,35505,35506,35507,35508,35509,13664,35510,35511, -35512,13665,35513,35514,35515,13666,35516,35517,35518,35519,35520,35521,35522, -13667,35523,35524,35525,35526,13668,35527,35528,35529,35530,35531,35532,13669, -13670,35533,35534,13671,35535,35536,13672,13673,35537,13674,35538,35539,35540, -35541,35542,13675,13676,35543,13677,35544,13678,35545,35546,35547,35548,35549, -35550,13679,35551,35552,35553,35554,35555,35556,35557,35558,35559,35560,35561, -35562,35563,35564,35565,35566,35567,35568,35569,35570,35571,35572,35573,35574, -35575,35576,35577,13680,13681,35578,35579,13682,35580,35581,13683,13684,35582, -35649,35650,35651,35652,35653,35654,13685,13686,35655,13687,13688,13689,13690, -35656,35657,35658,35659,35660,13691,13692,35661,35662,13693,35663,35664,35665, -13694,35666,35667,35668,35669,35670,35671,35672,13857,13858,35673,13859,13860, -13861,35674,35681,35682,35683,35684,13862,13863,13864,35685,35686,13865,35687, -35688,35689,13866,35690,35691,35692,35693,35694,35695,35696,13867,13868,35697, -13869,13870,13871,35698,35699,35700,35701,35702,35703,35704,35705,35706,35713, -35714,35715,35716,35717,35718,35719,35720,35721,35722,35723,35724,35725,35726, -35727,35728,35729,35730,35731,35732,35733,35734,35735,35736,35737,35738,35739, -35740,35741,35742,35743,35744,35745,35746,35747,35748,35749,35750,35751,35752, -35753,35754,35755,35756,35757,35758,35759,35760,35761,35762,35763,35764,35765, -13872,13873,35766,35767,13874,35768,35769,35770,13875,35771,13876,13877,35772, -35773,35774,35775,13878,13879,35776,13880,13881,13882,35777,35778,35779,35780, -35781,13883,13884,13885,35782,35783,13886,35784,35785,35786,13887,35787,35788, -35789,35790,35791,35792,35793,13888,13889,35794,13890,13891,13892,35795,35796, -35797,35798,35799,35800,13893,35801,35802,35803,35804,35805,35806,35807,35808, -35809,35810,35811,35812,35813,35814,35815,35816,35817,35818,35819,13894,35820, -35821,35822,35823,35824,35825,35826,35827,35828,35829,35830,35831,35832,35833, -35834,35835,35836,35837,35838,35905,35906,35907,35908,35909,35910,35911,35912, -35913,35914,35915,35916,35917,35918,35919,35920,13895,13896,35921,35922,13897, -35923,35924,35925,13898,35926,35927,35928,35929,35930,35937,35938,35939,35940, -35941,35942,35943,13899,35944,35945,35946,35947,35948,35949,13900,35950,35951, -35952,35953,35954,35955,35956,13901,35957,35958,35959,35960,35961,35962,35969, -35970,35971,35972,35973,35974,35975,35976,35977,35978,35979,35980,35981,13902, -35982,35983,35984,35985,35986,35987,35988,35989,35990,35991,35992,35993,35994, -35995,35996,35997,35998,35999,36000,36001,36002,36003,36004,36005,36006,36007, -36008,13903,36009,36010,36011,13904,36012,36013,36014,36015,36016,36017,36018, -36019,36020,36021,36022,36023,36024,36025,36026,36027,36028,36029,36030,36031, -36032,36033,36034,36035,36036,36037,36038,36039,36040,36041,36042,36043,36044, -36045,36046,36047,36048,36049,36050,36051,36052,36053,36054,36055,36056,36057, -36058,36059,36060,36061,36062,13905,13906,36063,36064,13907,36065,36066,36067, -13908,36068,36069,36070,36071,36072,36073,13909,13910,36074,36075,36076,36077, -13911,36078,36079,36080,36081,36082,36083,36084,36085,36086,36087,36088,36089, -36090,36091,36092,36093,36094,36161,36162,36163,36164,36165,36166,36167,36168, -36169,36170,36171,36172,36173,36174,36175,36176,36177,13912,36178,36179,36180, -36181,36182,36183,36184,36185,36186,36193,36194,36195,36196,36197,36198,36199, -36200,36201,36202,36203,36204,36205,36206,36207,36208,36209,36210,13913,36211, -36212,36213,13914,36214,36215,36216,13915,36217,36218,36225,36226,36227,36228, -36229,13916,13917,36230,36231,36232,13918,36233,36234,36235,36236,36237,36238, -36239,36240,36241,36242,36243,36244,36245,36246,36247,36248,36249,36250,36251, -36252,36253,36254,36255,36256,36257,36258,36259,36260,36261,36262,36263,36264, -36265,36266,13919,13920,36267,36268,13921,36269,36270,13922,13923,36271,36272, -36273,36274,36275,36276,36277,13924,13925,36278,13926,36279,36280,36281,36282, -36283,36284,36285,36286,13927,36287,36288,36289,13928,36290,36291,36292,13929, -36293,36294,36295,36296,36297,36298,36299,13930,13931,36300,36301,36302,36303, -36304,36305,36306,36307,36308,36309,13932,36310,36311,36312,13933,36313,36314, -36315,13934,36316,36317,36318,36319,36320,36321,36322,13935,13936,36323,13937, -36324,13938,36325,36326,36327,36328,36329,36330,13939,13940,36331,36332,13941, -36333,36334,36335,13942,36336,36337,36338,36339,36340,36341,36342,13943,13944, -36343,13945,13946,13947,13948,36344,36345,36346,13949,13950,14113,14114,36347, -36348,14115,36349,36350,36417,14116,36418,36419,36420,36421,36422,36423,36424, -14117,14118,36425,14119,14120,14121,36426,36427,36428,36429,36430,36431,14122, -14123,36432,36433,14124,36434,36435,36436,36437,36438,36439,36440,36441,36442, -36449,36450,36451,36452,36453,14125,36454,14126,36455,36456,36457,36458,36459, -36460,36461,36462,36463,36464,36465,36466,36467,36468,36469,36470,36471,36472, -36473,36474,36481,36482,36483,36484,36485,36486,36487,36488,36489,36490,36491, -36492,36493,36494,14127,14128,36495,36496,14129,36497,36498,36499,14130,36500, -36501,36502,36503,36504,36505,36506,14131,14132,36507,14133,14134,14135,36508, -36509,36510,36511,36512,14136,14137,14138,36513,36514,14139,36515,36516,36517, -14140,36518,36519,36520,36521,36522,36523,36524,14141,14142,36525,14143,36526, -14144,36527,36528,36529,36530,36531,36532,14145,14146,36533,36534,14147,36535, -36536,36537,14148,36538,36539,36540,36541,36542,36543,36544,14149,14150,36545, -14151,14152,14153,36546,36547,36548,36549,36550,36551,14154,36552,36553,36554, -14155,36555,36556,36557,36558,36559,36560,36561,36562,36563,36564,36565,36566, -14156,36567,14157,36568,36569,36570,36571,36572,36573,36574,36575,14158,14159, -36576,36577,14160,36578,36579,36580,14161,36581,36582,36583,36584,36585,36586, -36587,14162,14163,36588,14164,36589,14165,36590,36591,36592,36593,36594,36595, -14166,36596,36597,36598,14167,36599,36600,36601,36602,36603,36604,36605,36606, -36673,36674,36675,36676,36677,36678,36679,36680,14168,36681,36682,36683,36684, -36685,36686,36687,36688,36689,36690,36691,36692,36693,36694,36695,36696,36697, -36698,36705,36706,36707,36708,36709,36710,36711,36712,14169,36713,36714,36715, -36716,36717,36718,36719,14170,36720,36721,36722,14171,36723,36724,36725,14172, -36726,36727,36728,36729,36730,36737,36738,14173,14174,36739,14175,36740,14176, -36741,36742,36743,36744,36745,36746,14177,36747,36748,36749,14178,36750,36751, -36752,14179,36753,36754,36755,36756,36757,36758,36759,36760,14180,36761,14181, -36762,14182,36763,36764,36765,36766,36767,36768,14183,14184,36769,36770,14185, -36771,36772,36773,14186,36774,36775,36776,36777,36778,36779,36780,14187,14188, -36781,14189,36782,14190,36783,36784,36785,36786,36787,36788,14191,36789,36790, -36791,36792,36793,36794,36795,36796,36797,36798,36799,36800,36801,36802,36803, -36804,36805,36806,36807,14192,36808,36809,36810,36811,36812,36813,36814,14193, -36815,36816,36817,36818,36819,36820,36821,36822,36823,36824,36825,36826,36827, -36828,36829,36830,36831,36832,36833,36834,36835,36836,36837,36838,36839,36840, -36841,14194,14195,36842,36843,14196,36844,36845,36846,14197,36847,36848,36849, -36850,36851,36852,36853,14198,36854,36855,14199,36856,14200,36857,36858,36859, -36860,36861,36862,14201,14202,36929,36930,14203,36931,36932,36933,14204,36934, -36935,36936,36937,36938,36939,36940,14205,14206,36941,14369,36942,14370,36943, -36944,36945,36946,36947,36948,14371,14372,36949,36950,14373,36951,36952,36953, -14374,36954,36961,36962,36963,36964,36965,36966,14375,14376,36967,14377,36968, -14378,14379,36969,36970,14380,14381,36971,36972,36973,36974,36975,36976,36977, -36978,36979,36980,36981,36982,36983,36984,36985,36986,36993,36994,36995,36996, -36997,36998,36999,37000,37001,37002,37003,37004,37005,14382,14383,37006,37007, -14384,37008,37009,37010,14385,37011,37012,37013,37014,37015,37016,37017,14386, -14387,37018,14388,37019,14389,37020,37021,37022,37023,37024,37025,14390,14391, -37026,37027,14392,37028,14393,14394,14395,14396,14397,37029,37030,37031,37032, -37033,14398,14399,37034,14400,37035,14401,14402,37036,37037,14403,37038,14404, -14405,14406,37039,37040,14407,37041,37042,37043,14408,37044,37045,37046,37047, -37048,37049,37050,14409,14410,37051,14411,14412,14413,14414,37052,37053,37054, -37055,37056,14415,14416,37057,37058,37059,37060,37061,37062,14417,37063,37064, -37065,37066,37067,37068,37069,37070,37071,37072,37073,37074,14418,37075,37076, -37077,37078,37079,37080,37081,37082,37083,37084,37085,37086,37087,37088,37089, -37090,37091,37092,37093,37094,37095,37096,37097,37098,37099,37100,37101,37102, -37103,37104,37105,37106,37107,37108,14419,14420,37109,37110,14421,37111,37112, -37113,14422,37114,14423,37115,37116,37117,37118,37185,14424,14425,37186,14426, -37187,14427,14428,37188,37189,37190,37191,14429,14430,14431,37192,37193,14432, -37194,37195,37196,14433,37197,37198,37199,37200,37201,37202,37203,14434,14435, -37204,14436,14437,14438,37205,37206,37207,37208,37209,37210,14439,14440,37217, -37218,14441,37219,37220,37221,14442,37222,37223,37224,37225,37226,37227,37228, -37229,37230,37231,14443,14444,14445,37232,14446,37233,37234,37235,37236,14447, -37237,37238,37239,37240,37241,37242,37249,37250,37251,37252,37253,37254,37255, -37256,37257,37258,37259,37260,37261,37262,37263,37264,37265,37266,37267,37268, -37269,14448,14449,37270,14450,14451,37271,37272,37273,14452,37274,14453,37275, -37276,37277,37278,37279,14454,14455,37280,14456,37281,14457,37282,37283,37284, -37285,37286,37287,14458,37288,37289,37290,14459,37291,37292,37293,37294,37295, -37296,37297,37298,37299,37300,37301,37302,37303,37304,37305,14460,14461,37306, -37307,37308,37309,37310,37311,37312,37313,37314,37315,37316,37317,37318,37319, -37320,37321,37322,37323,37324,37325,37326,37327,37328,37329,37330,37331,37332, -37333,37334,37335,37336,37337,37338,37339,14462,37340,37341,37342,14625,37343, -37344,37345,14626,37346,37347,37348,37349,37350,37351,37352,37353,14627,37354, -14628,37355,14629,37356,37357,37358,37359,37360,37361,14630,37362,37363,37364, -14631,37365,37366,37367,14632,37368,37369,37370,37371,37372,37373,37374,37441, -14633,37442,14634,37443,37444,37445,37446,37447,37448,37449,37450,14635,14636, -14637,37451,14638,37452,37453,14639,14640,14641,14642,37454,37455,37456,37457, -37458,14643,14644,37459,14645,37460,14646,37461,37462,37463,14647,37464,14648, -14649,37465,37466,37473,14650,37474,37475,37476,14651,37477,37478,37479,37480, -37481,37482,37483,37484,14652,37485,14653,37486,37487,37488,37489,37490,37491, -37492,37493,14654,37494,37495,37496,37497,37498,37505,37506,37507,37508,37509, -37510,37511,37512,37513,37514,37515,37516,37517,37518,37519,37520,37521,37522, -37523,37524,37525,37526,14655,37527,37528,37529,14656,37530,37531,37532,14657, -37533,37534,37535,37536,37537,37538,37539,37540,37541,37542,37543,37544,37545, -37546,37547,37548,37549,37550,37551,14658,37552,37553,37554,14659,37555,37556, -37557,14660,37558,37559,37560,37561,37562,37563,37564,14661,37565,37566,14662, -37567,37568,37569,37570,37571,37572,37573,37574,14663,37575,37576,37577,14664, -37578,37579,37580,14665,37581,37582,37583,37584,37585,37586,37587,14666,37588, -37589,14667,37590,37591,37592,37593,37594,37595,37596,37597,37598,37599,37600, -37601,37602,37603,37604,37605,37606,37607,37608,37609,37610,37611,37612,37613, -37614,37615,37616,37617,37618,37619,37620,37621,37622,37623,37624,37625,14668, -14669,37626,37627,14670,37628,37629,14671,14672,37630,14673,37697,37698,37699, -37700,37701,14674,14675,37702,14676,14677,14678,37703,14679,37704,14680,37705, -37706,14681,14682,14683,14684,14685,37707,37708,14686,14687,14688,14689,14690, -37709,37710,37711,37712,14691,14692,37713,14693,37714,14694,37715,37716,37717, -14695,37718,37719,14696,14697,37720,37721,14698,37722,37729,37730,14699,37731, -37732,37733,37734,37735,37736,37737,14700,14701,37738,14702,14703,14704,37739, -37740,37741,14705,37742,37743,14706,14707,37744,37745,14708,37746,37747,37748, -37749,37750,37751,37752,37753,37754,37761,37762,37763,14709,37764,37765,37766, -37767,37768,37769,37770,37771,37772,37773,37774,37775,37776,37777,37778,37779, -37780,37781,37782,37783,37784,37785,37786,37787,37788,37789,37790,37791,37792, -37793,37794,37795,37796,37797,37798,37799,37800,37801,14710,14711,37802,37803, -14712,37804,37805,14713,14714,37806,14715,37807,37808,37809,37810,37811,14716, -14717,37812,14718,37813,14881,14882,37814,37815,37816,37817,37818,14883,14884, -37819,37820,14885,37821,37822,14886,14887,37823,37824,37825,37826,37827,37828, -37829,14888,14889,37830,14890,14891,14892,37831,37832,37833,37834,37835,37836, -14893,14894,37837,37838,14895,37839,37840,37841,14896,37842,37843,37844,37845, -37846,37847,37848,37849,14897,37850,14898,14899,14900,37851,37852,37853,14901, -37854,37855,14902,37856,37857,37858,14903,37859,37860,37861,37862,37863,37864, -37865,37866,37867,37868,37869,37870,37871,37872,37873,37874,37875,37876,37877, -37878,37879,37880,37881,14904,14905,14906,37882,14907,37883,37884,37885,14908, -37886,37953,37954,37955,37956,37957,37958,14909,14910,37959,14911,37960,14912, -37961,37962,37963,37964,37965,37966,14913,37967,37968,37969,14914,37970,37971, -37972,37973,37974,37975,37976,37977,37978,37985,37986,37987,37988,37989,37990, -14915,37991,37992,37993,37994,37995,37996,37997,14916,37998,37999,38000,38001, -38002,38003,38004,38005,38006,38007,38008,38009,38010,38017,38018,38019,38020, -38021,38022,14917,38023,38024,38025,38026,38027,38028,38029,14918,14919,38030, -38031,14920,38032,38033,38034,14921,38035,38036,38037,38038,38039,38040,38041, -14922,14923,38042,38043,38044,38045,38046,38047,38048,38049,38050,38051,14924, -38052,38053,38054,14925,38055,38056,38057,38058,38059,38060,38061,38062,38063, -38064,38065,38066,38067,38068,38069,38070,38071,38072,38073,38074,38075,38076, -38077,14926,14927,38078,38079,14928,38080,38081,14929,14930,14931,14932,38082, -38083,38084,38085,38086,14933,14934,38087,14935,38088,14936,38089,38090,38091, -14937,14938,38092,14939,38093,38094,38095,38096,38097,38098,38099,14940,38100, -38101,38102,38103,38104,38105,38106,38107,38108,38109,38110,14941,38111,38112, -38113,38114,38115,38116,38117,14942,38118,38119,38120,38121,38122,38123,38124, -38125,38126,38127,38128,38129,38130,38131,38132,38133,38134,38135,38136,38137, -38138,38139,38140,38141,38142,38209,38210,14943,14944,38211,38212,14945,38213, -38214,38215,14946,38216,38217,38218,38219,38220,38221,38222,38223,38224,38225, -38226,38227,14947,38228,38229,38230,38231,38232,38233,14948,38234,38241,38242, -14949,38243,38244,38245,14950,38246,38247,38248,38249,38250,38251,38252,14951, -38253,38254,14952,38255,14953,38256,38257,38258,38259,38260,38261,14954,14955, -38262,38263,14956,38264,38265,38266,14957,38273,38274,38275,38276,38277,38278, -38279,14958,14959,38280,14960,38281,38282,38283,38284,38285,38286,38287,38288, -38289,38290,38291,38292,38293,38294,38295,38296,38297,38298,38299,38300,38301, -38302,38303,38304,38305,38306,38307,38308,38309,38310,38311,38312,38313,38314, -38315,38316,14961,14962,38317,38318,14963,38319,38320,38321,14964,38322,14965, -38323,38324,38325,38326,38327,14966,14967,38328,14968,38329,14969,14970,14971, -38330,38331,38332,38333,14972,14973,38334,38335,14974,38336,38337,38338,15137, -38339,15138,38340,38341,38342,38343,38344,15139,15140,38345,15141,15142,15143, -38346,38347,38348,38349,38350,15144,15145,15146,38351,38352,15147,38353,38354, -38355,15148,38356,38357,38358,38359,38360,38361,38362,15149,15150,38363,15151, -15152,15153,38364,38365,38366,38367,38368,38369,15154,15155,38370,38371,38372, -38373,38374,38375,38376,38377,38378,38379,38380,38381,38382,38383,15156,38384, -38385,38386,38387,38388,38389,38390,38391,38392,38393,38394,38395,38396,38397, -38398,38465,38466,38467,38468,38469,38470,38471,38472,38473,38474,38475,38476, -38477,38478,38479,38480,38481,38482,38483,38484,38485,38486,38487,38488,15157, -15158,38489,38490,15159,38497,38498,15160,15161,38499,38500,38501,38502,38503, -38504,38505,15162,38506,38507,15163,15164,15165,38508,38509,38510,38511,38512, -38513,15166,38514,38515,38516,38517,38518,38519,38520,38521,38522,38529,38530, -38531,38532,38533,38534,38535,38536,38537,38538,38539,15167,38540,38541,38542, -38543,38544,38545,15168,15169,38546,38547,38548,38549,38550,38551,38552,38553, -38554,38555,38556,38557,38558,38559,15170,15171,38560,15172,15173,15174,38561, -38562,38563,38564,38565,38566,38567,38568,38569,38570,38571,38572,38573,38574, -38575,38576,38577,38578,38579,38580,38581,38582,38583,38584,38585,38586,38587, -38588,38589,38590,38591,38592,38593,38594,15175,15176,38595,38596,15177,38597, -38598,38599,15178,38600,38601,38602,38603,38604,38605,38606,15179,15180,38607, -38608,38609,15181,38610,38611,38612,38613,38614,38615,38616,38617,38618,38619, -38620,38621,38622,38623,38624,38625,38626,38627,38628,38629,38630,38631,38632, -38633,38634,38635,38636,38637,38638,38639,38640,38641,38642,38643,38644,38645, -38646,38647,38648,38649,38650,38651,38652,38653,38654,38721,38722,38723,38724, -38725,38726,38727,38728,38729,38730,38731,38732,38733,38734,38735,38736,38737, -15182,38738,38739,38740,38741,38742,38743,38744,38745,38746,38753,38754,38755, -38756,38757,38758,38759,38760,38761,38762,38763,38764,38765,38766,38767,38768, -38769,38770,15183,38771,38772,38773,38774,38775,38776,38777,38778,38785,38786, -38787,38788,38789,38790,38791,38792,38793,38794,38795,38796,15184,38797,38798, -38799,38800,38801,38802,15185,15186,38803,38804,15187,38805,38806,38807,15188, -38808,38809,38810,38811,38812,38813,38814,15189,38815,38816,15190,38817,15191, -38818,38819,38820,38821,38822,38823,38824,38825,38826,38827,38828,38829,38830, -38831,38832,38833,38834,38835,38836,38837,38838,38839,38840,38841,38842,38843, -38844,38845,38846,38847,38848,38849,38850,38851,38852,38853,38854,38855,38856, -38857,38858,38859,38860,38861,38862,38863,38864,38865,38866,38867,38868,38869, -38870,38871,38872,38873,38874,38875,38876,38877,38878,38879,38880,38881,38882, -38883,38884,38885,38886,38887,38888,38889,38890,38891,38892,38893,38894,38895, -38896,38897,38898,38899,38900,38901,38902,38903,38904,38905,38906,38907,15192, -38908,38909,38910,38977,38978,38979,38980,38981,38982,38983,38984,38985,38986, -38987,38988,38989,38990,38991,38992,38993,15193,38994,38995,38996,38997,38998, -38999,15194,39000,39001,39002,15195,39009,39010,39011,15196,39012,39013,39014, -39015,39016,39017,39018,15197,15198,39019,39020,39021,39022,39023,39024,39025, -39026,39027,39028,39029,39030,39031,39032,39033,39034,39041,39042,39043,39044, -39045,39046,39047,39048,39049,39050,39051,39052,39053,39054,39055,39056,39057, -39058,39059,39060,39061,39062,15199,15200,39063,39064,15201,39065,39066,39067, -15202,39068,39069,39070,39071,39072,39073,39074,15203,15204,39075,15205,39076, -15206,39077,39078,39079,39080,39081,39082,15207,15208,39083,15209,15210,39084, -39085,15211,15212,15213,15214,39086,39087,39088,39089,39090,15215,15216,39091, -15217,15218,15219,39092,39093,39094,15220,39095,39096,15221,15222,39097,39098, -15223,39099,39100,39101,15224,39102,39103,39104,39105,39106,39107,39108,15225, -15226,39109,15227,15228,15229,39110,39111,39112,39113,39114,39115,15230,15393, -39116,39117,15394,39118,39119,39120,15395,39121,39122,39123,39124,39125,39126, -39127,15396,15397,39128,15398,39129,15399,39130,39131,39132,39133,39134,39135, -15400,39136,39137,39138,15401,39139,39140,39141,15402,39142,39143,39144,39145, -39146,39147,39148,15403,39149,39150,39151,39152,15404,39153,39154,39155,39156, -39157,39158,15405,15406,15407,15408,15409,39159,39160,15410,15411,39161,15412, -15413,39162,39163,39164,39165,15414,15415,39166,15416,15417,15418,39233,39234, -39235,39236,15419,39237,15420,15421,39238,39239,15422,39240,39241,39242,15423, -39243,39244,39245,39246,39247,39248,39249,15424,15425,39250,15426,15427,15428, -39251,39252,39253,39254,39255,39256,15429,15430,39257,39258,15431,39265,39266, -39267,15432,39268,39269,39270,39271,39272,39273,39274,15433,15434,39275,15435, -15436,15437,39276,39277,39278,39279,39280,39281,15438,39282,39283,39284,15439, -39285,39286,39287,15440,39288,39289,39290,39297,39298,39299,39300,39301,39302, -39303,39304,39305,15441,39306,39307,39308,39309,39310,39311,15442,15443,15444, -39312,15445,39313,39314,39315,15446,39316,15447,39317,39318,39319,39320,39321, -15448,15449,39322,15450,39323,15451,39324,39325,39326,15452,39327,39328,15453, -15454,39329,39330,15455,39331,39332,39333,15456,39334,39335,39336,39337,39338, -39339,39340,39341,39342,39343,39344,39345,15457,39346,39347,39348,39349,39350, -39351,15458,39352,39353,39354,15459,39355,39356,39357,15460,39358,39359,39360, -39361,39362,39363,39364,15461,39365,39366,15462,15463,39367,39368,39369,39370, -39371,39372,39373,15464,39374,39375,39376,15465,39377,39378,39379,15466,39380, -39381,39382,39383,39384,39385,39386,15467,15468,39387,15469,39388,39389,39390, -39391,39392,39393,39394,39395,15470,15471,39396,39397,15472,39398,39399,39400, -15473,39401,39402,39403,39404,39405,39406,39407,15474,15475,39408,15476,39409, -15477,39410,39411,39412,39413,39414,39415,15478,15479,39416,39417,15480,39418, -39419,15481,15482,39420,39421,39422,39489,39490,39491,39492,15483,15484,39493, -15485,39494,15486,39495,15649,39496,15650,15651,39497,15652,39498,39499,39500, -39501,39502,39503,39504,39505,39506,39507,39508,39509,39510,39511,39512,39513, -39514,39521,39522,15653,39523,39524,39525,39526,39527,39528,39529,15654,15655, -39530,39531,15656,39532,39533,39534,15657,39535,39536,39537,39538,39539,39540, -39541,15658,39542,39543,39544,39545,15659,39546,39553,39554,39555,39556,39557, -15660,15661,39558,39559,15662,39560,39561,39562,15663,39563,39564,39565,39566, -39567,39568,39569,15664,15665,39570,15666,39571,15667,39572,39573,39574,39575, -39576,39577,15668,15669,39578,39579,39580,39581,39582,39583,15670,39584,39585, -39586,39587,39588,39589,39590,15671,39591,39592,15672,39593,15673,39594,39595, -39596,39597,39598,39599,15674,15675,39600,39601,15676,39602,39603,39604,15677, -15678,39605,39606,39607,39608,39609,39610,15679,15680,39611,15681,39612,15682, -39613,39614,39615,39616,39617,39618,39619,39620,39621,39622,39623,39624,39625, -39626,39627,39628,39629,39630,39631,39632,39633,39634,39635,39636,39637,39638, -39639,39640,39641,39642,39643,39644,39645,39646,15683,15684,39647,39648,15685, -39649,39650,15686,15687,39651,39652,39653,39654,39655,39656,15688,15689,15690, -39657,15691,39658,15692,39659,39660,39661,39662,15693,39663,15694,15695,39664, -15696,15697,39665,39666,39667,15698,39668,39669,39670,39671,39672,39673,39674, -15699,15700,39675,39676,15701,15702,39677,39678,39745,39746,39747,15703,15704, -15705,39748,39749,15706,39750,39751,39752,15707,39753,39754,39755,39756,39757, -39758,39759,15708,15709,39760,39761,15710,15711,39762,39763,39764,39765,39766, -39767,39768,39769,39770,39777,39778,39779,39780,39781,39782,39783,39784,39785, -39786,39787,39788,39789,39790,39791,39792,39793,39794,15712,39795,39796,39797, -39798,39799,39800,39801,39802,39809,39810,39811,39812,39813,39814,39815,39816, -39817,39818,39819,39820,39821,39822,39823,39824,39825,39826,39827,39828,39829, -39830,39831,39832,39833,39834,15713,15714,39835,39836,15715,39837,39838,39839, -15716,39840,15717,39841,39842,39843,39844,39845,15718,15719,39846,39847,15720, -15721,39848,39849,39850,39851,39852,39853,15722,39854,39855,39856,15723,39857, -39858,39859,15724,39860,39861,39862,39863,39864,39865,39866,39867,39868,39869, -39870,39871,39872,39873,39874,39875,39876,39877,39878,39879,39880,39881,39882, -39883,39884,39885,39886,39887,39888,39889,39890,39891,39892,39893,39894,39895, -39896,39897,39898,39899,39900,39901,39902,39903,39904,39905,39906,39907,39908, -39909,39910,15725,39911,39912,39913,39914,39915,39916,39917,39918,39919,39920, -39921,39922,39923,39924,39925,39926,39927,39928,39929,39930,39931,39932,39933, -15726,15727,39934,40001,15728,40002,40003,15729,15730,40004,15731,40005,40006, -40007,40008,40009,15732,15733,40010,40011,40012,15734,40013,40014,40015,40016, -40017,40018,15735,15736,40019,40020,15737,40021,40022,40023,40024,40025,40026, -40033,40034,40035,40036,40037,40038,40039,40040,40041,15738,40042,40043,40044, -40045,40046,40047,40048,15739,40049,40050,40051,40052,40053,40054,40055,40056, -40057,40058,40065,40066,40067,40068,40069,40070,40071,40072,40073,15740,40074, -40075,40076,40077,40078,40079,40080,15741,40081,40082,40083,15742,40084,40085, -40086,15905,40087,40088,40089,40090,40091,40092,40093,15906,15907,40094,40095, -40096,40097,40098,40099,40100,40101,40102,40103,15908,40104,40105,40106,40107, -40108,40109,40110,40111,40112,40113,40114,40115,40116,40117,40118,40119,40120, -40121,40122,40123,40124,40125,40126,40127,40128,40129,40130,15909,15910,40131, -40132,15911,40133,40134,40135,15912,40136,40137,40138,40139,40140,40141,40142, -15913,15914,40143,40144,40145,15915,40146,40147,40148,40149,40150,40151,15916, -40152,40153,40154,40155,40156,40157,40158,40159,40160,40161,40162,40163,40164, -40165,40166,40167,40168,40169,40170,15917,40171,40172,40173,40174,40175,40176, -40177,15918,40178,40179,40180,40181,40182,40183,40184,40185,40186,40187,40188, -40189,40190,40257,40258,40259,40260,40261,40262,40263,40264,40265,40266,40267, -40268,40269,40270,15919,40271,40272,40273,15920,40274,40275,40276,40277,40278, -40279,40280,40281,40282,40289,40290,40291,40292,40293,40294,40295,40296,40297, -40298,40299,40300,40301,40302,40303,40304,40305,40306,40307,40308,40309,40310, -40311,40312,40313,40314,40321,40322,40323,40324,40325,40326,40327,40328,40329, -15921,40330,40331,40332,40333,40334,40335,15922,15923,40336,40337,15924,40338, -40339,40340,15925,40341,15926,40342,40343,40344,40345,15927,15928,15929,40346, -40347,40348,40349,40350,40351,40352,40353,40354,40355,15930,40356,40357,40358, -15931,40359,40360,40361,15932,40362,40363,40364,40365,40366,40367,40368,15933, -40369,40370,40371,40372,40373,40374,40375,40376,40377,40378,40379,15934,15935, -40380,40381,15936,40382,40383,40384,15937,40385,40386,40387,40388,40389,40390, -40391,15938,15939,40392,15940,40393,15941,40394,40395,40396,40397,40398,40399, -15942,15943,40400,40401,15944,15945,15946,40402,15947,15948,15949,40403,40404, -40405,40406,15950,15951,15952,40407,15953,15954,15955,40408,40409,40410,15956, -15957,40411,15958,15959,40412,40413,15960,40414,40415,40416,15961,40417,40418, -40419,40420,40421,40422,40423,15962,15963,40424,15964,15965,15966,40425,40426, -40427,40428,40429,40430,15967,15968,40431,40432,15969,40433,40434,40435,15970, -40436,40437,15971,40438,40439,40440,40441,15972,15973,40442,15974,40443,15975, -40444,40445,40446,15976,40513,15977,15978,40514,40515,40516,15979,40517,40518, -40519,15980,40520,40521,40522,40523,40524,40525,40526,40527,15981,40528,40529, -40530,40531,40532,40533,40534,40535,40536,40537,15982,15983,40538,40545,15984, -15985,40546,15986,15987,15988,15989,40547,40548,40549,40550,40551,15990,15991, -15992,15993,15994,15995,15996,40552,15997,40553,15998,40554,16161,16162,40555, -40556,16163,40557,40558,40559,16164,40560,40561,40562,40563,40564,40565,40566, -16165,16166,40567,16167,40568,16168,40569,40570,40577,40578,40579,40580,16169, -16170,16171,40581,16172,40582,40583,40584,16173,40585,16174,16175,40586,40587, -40588,40589,16176,16177,16178,16179,16180,16181,40590,40591,40592,16182,16183, -16184,16185,40593,40594,40595,16186,40596,40597,40598,16187,40599,40600,40601, -40602,40603,40604,40605,16188,16189,40606,16190,16191,40607,40608,40609,40610, -40611,40612,40613,16192,16193,40614,40615,16194,40616,40617,40618,16195,16196, -16197,40619,16198,40620,40621,16199,16200,16201,40622,16202,40623,16203,40624, -16204,40625,40626,40627,40628,16205,16206,40629,40630,16207,40631,40632,40633, -16208,40634,40635,40636,40637,40638,40639,40640,16209,16210,40641,16211,16212, -16213,40642,40643,40644,40645,40646,40647,16214,16215,40648,40649,16216,40650, -40651,40652,40653,40654,40655,40656,40657,40658,40659,40660,16217,40661,40662, -16218,40663,16219,40664,40665,40666,40667,40668,40669,16220,16221,40670,40671, -16222,40672,40673,40674,16223,40675,40676,40677,40678,40679,40680,40681,16224, -16225,40682,16226,40683,16227,40684,40685,40686,40687,40688,40689,16228,16229, -40690,40691,16230,40692,40693,40694,16231,40695,40696,40697,40698,40699,40700, -40701,16232,16233,40702,16234,40769,16235,40770,40771,40772,40773,40774,40775, -16236,16237,40776,40777,16238,40778,40779,40780,16239,16240,16241,40781,40782, -40783,40784,40785,16242,16243,40786,16244,40787,16245,40788,40789,40790,40791, -40792,40793,16246,16247,40794,40801,16248,40802,40803,40804,16249,40805,40806, -40807,40808,40809,40810,40811,16250,16251,40812,40813,16252,16253,40814,40815, -40816,40817,40818,40819,16254,16417,40820,40821,16418,40822,40823,40824,16419, -40825,40826,40833,40834,40835,40836,40837,16420,16421,40838,40839,40840,16422, -40841,40842,40843,40844,40845,40846,16423,16424,40847,40848,16425,40849,40850, -40851,16426,40852,40853,40854,40855,40856,40857,40858,16427,16428,40859,16429, -40860,16430,40861,40862,40863,40864,40865,40866,16431,16432,40867,40868,16433, -40869,40870,40871,16434,40872,40873,40874,40875,40876,40877,40878,16435,16436, -40879,16437,40880,16438,40881,16439,40882,40883,40884,40885,16440,16441,40886, -40887,16442,40888,40889,40890,16443,40891,40892,40893,40894,40895,16444,40896, -16445,16446,40897,16447,40898,16448,16449,16450,16451,16452,16453,16454,16455, -40899,40900,40901,16456,40902,40903,40904,16457,40905,40906,40907,40908,40909, -40910,40911,16458,40912,40913,16459,40914,40915,40916,40917,40918,40919,40920, -40921,16460,16461,40922,40923,16462,40924,40925,40926,16463,16464,16465,40927, -40928,40929,40930,16466,16467,16468,40931,16469,16470,16471,16472,40932,40933, -40934,16473,40935,16474,16475,40936,40937,16476,40938,16477,16478,16479,40939, -16480,40940,40941,40942,40943,40944,16481,16482,40945,16483,16484,16485,16486, -40946,40947,40948,40949,40950,16487,16488,40951,40952,16489,40953,40954,40955, -16490,40956,40957,40958,41025,41026,41027,41028,16491,16492,41029,16493,16494, -16495,41030,41031,41032,41033,41034,41035,16496,16497,41036,41037,16498,41038, -16499,41039,16500,41040,41041,41042,41043,41044,41045,41046,16501,41047,41048, -41049,41050,16502,41057,41058,41059,41060,41061,41062,16503,41063,41064,41065, -16504,41066,41067,41068,16505,41069,41070,41071,41072,41073,41074,41075,41076, -41077,41078,41079,41080,41081,41082,41089,41090,41091,41092,41093,16506,16507, -41094,41095,16508,41096,41097,41098,16509,41099,16510,41100,41101,41102,41103, -41104,16673,16674,41105,16675,41106,16676,16677,41107,41108,41109,41110,41111, -16678,16679,41112,41113,16680,41114,41115,41116,16681,41117,41118,41119,41120, -41121,41122,41123,16682,16683,41124,16684,41125,16685,41126,41127,41128,41129, -41130,41131,16686,41132,41133,41134,16687,41135,41136,41137,16688,41138,41139, -41140,41141,41142,41143,41144,16689,16690,41145,41146,16691,16692,41147,41148, -41149,41150,41151,41152,16693,41153,41154,41155,41156,41157,41158,41159,41160, -41161,41162,41163,41164,41165,41166,41167,41168,41169,41170,41171,41172,41173, -41174,41175,41176,41177,41178,41179,16694,16695,41180,41181,16696,41182,41183, -41184,16697,41185,16698,41186,41187,41188,41189,41190,16699,16700,41191,16701, -41192,16702,16703,16704,41193,41194,41195,16705,16706,16707,41196,41197,41198, -41199,41200,41201,16708,41202,41203,41204,41205,41206,41207,41208,41209,16709, -41210,16710,41211,16711,41212,41213,41214,41281,41282,41283,16712,41284,41285, -41286,41287,41288,41289,41290,41291,41292,41293,41294,41295,41296,41297,41298, -41299,41300,41301,41302,16713,16714,41303,41304,41305,41306,41313,41314,16715, -41315,41316,41317,16716,41318,41319,41320,16717,41321,41322,41323,41324,41325, -41326,41327,16718,16719,41328,16720,41329,16721,41330,41331,41332,41333,41334, -41335,16722,16723,41336,41337,16724,41338,41345,41346,41347,41348,41349,41350, -41351,41352,41353,41354,41355,41356,41357,41358,41359,16725,41360,41361,41362, -41363,41364,41365,16726,16727,41366,41367,16728,41368,41369,41370,16729,16730, -16731,41371,41372,41373,41374,41375,16732,16733,41376,16734,41537,16735,41538, -41539,41540,41541,41542,41543,16736,41544,41545,41546,41547,41548,41549,41550, -41551,41552,41553,41554,41555,41556,41557,41558,41559,41560,41561,41562,16737, -41569,41570,41571,41572,41573,41574,41575,16738,41576,41577,41578,41579,41580, -41581,41582,41583,41584,41585,41586,41587,41588,41589,41590,41591,41592,41593, -41594,41601,41602,41603,41604,41605,41606,41607,41608,16739,16740,41609,41610, -16741,41611,41612,41613,16742,41614,41615,41616,41617,41618,41619,41620,16743, -16744,41621,16745,41622,41623,41624,41625,41626,41627,41628,41629,16746,41630, -41631,41632,16747,41793,41794,41795,16748,41796,41797,41798,41799,41800,41801, -41802,16749,41803,41804,41805,41806,41807,41808,41809,41810,41811,41812,41813, -16750,16751,41814,41815,16752,41816,41817,41818,16753,41825,41826,41827,41828, -41829,41830,41831,16754,16755,41832,16756,41833,16757,41834,41835,41836,41837, -41838,41839,41840,41841,41842,41843,41844,41845,41846,41847,41848,41849,41850, -41857,41858,41859,41860,41861,41862,41863,41864,41865,41866,41867,41868,41869, -41870,41871,41872,41873,16758,16759,41874,41875,16760,41876,41877,16761,16762, -41878,16763,41879,41880,41881,41882,41883,16764,16765,41884,16766,41885,16929, -16930,41886,41887,16931,16932,41888,16933,16934,42049,42050,16935,42051,16936, -42052,16937,42053,42054,16938,42055,42056,42057,42058,16939,16940,42059,16941, -16942,16943,42060,42061,42062,42063,42064,42065,16944,16945,42066,42067,16946, -42068,42069,42070,16947,42071,42072,42073,42074,42081,42082,42083,16948,16949, -42084,16950,16951,16952,42085,42086,42087,42088,42089,42090,16953,42091,42092, -42093,16954,42094,42095,42096,42097,42098,42099,42100,42101,42102,42103,42104, -42105,42106,42113,42114,42115,16955,42116,42117,42118,42119,42120,42121,42122, -42123,42124,42125,42126,42127,42128,42129,42130,42131,42132,42133,42134,42135, -42136,42137,42138,42139,42140,42141,42142,42143,42144,42305,42306,42307,42308, -42309,16956,16957,42310,42311,16958,42312,42313,42314,16959,42315,42316,42317, -42318,42319,42320,42321,16960,16961,42322,16962,16963,16964,42323,42324,42325, -42326,42327,42328,16965,42329,42330,42337,42338,42339,42340,42341,42342,42343, -42344,42345,42346,42347,42348,42349,42350,42351,42352,42353,42354,16966,42355, -42356,42357,42358,42359,42360,16967,42361,42362,42369,42370,42371,42372,42373, -42374,42375,42376,42377,42378,42379,42380,42381,42382,42383,42384,42385,16968, -42386,42387,42388,42389,42390,42391,42392,42393,42394,42395,42396,42397,42398, -42399,42400,42561,42562,42563,42564,42565,42566,42567,42568,42569,42570,42571, -42572,42573,42574,42575,42576,42577,42578,42579,42580,16969,16970,42581,42582, -16971,42583,42584,42585,16972,42586,42593,42594,42595,42596,42597,42598,16973, -16974,42599,16975,42600,16976,42601,16977,42602,42603,42604,42605,16978,16979, -42606,42607,42608,42609,42610,42611,16980,42612,42613,42614,42615,42616,42617, -42618,42625,42626,42627,42628,16981,42629,42630,42631,42632,42633,42634,42635, -16982,42636,42637,42638,42639,42640,42641,42642,42643,42644,42645,42646,42647, -42648,42649,42650,42651,42652,42653,42654,16983,42655,42656,42817,42818,42819, -42820,42821,16984,42822,42823,42824,16985,42825,42826,42827,16986,42828,42829, -42830,42831,42832,42833,42834,16987,16988,42835,42836,42837,42838,42839,42840, -42841,42842,42849,42850,42851,42852,42853,42854,42855,42856,42857,42858,42859, -42860,42861,42862,42863,42864,42865,42866,42867,42868,42869,42870,42871,16989, -42872,42873,42874,42881,42882,42883,16990,16991,42884,42885,16992,42886,42887, -42888,16993,42889,42890,42891,42892,42893,42894,42895,16994,16995,42896,42897, -42898,16996,42899,42900,42901,42902,42903,42904,16997,42905,42906,42907,42908, -42909,42910,42911,42912,43073,43074,43075,43076,43077,43078,43079,43080,43081, -43082,43083,16998,16999,43084,43085,43086,43087,43088,43089,43090,43091,43092, -43093,43094,43095,43096,43097,43098,43105,43106,43107,43108,43109,43110,43111, -43112,43113,43114,43115,43116,43117,43118,43119,43120,43121,43122,43123,17000, -43124,43125,43126,43127,43128,43129,43130,43137,43138,43139,43140,43141,43142, -43143,43144,43145,43146,43147,43148,43149,43150,43151,43152,43153,43154,43155, -43156,17001,43157,43158,43159,43160,43161,43162,43163,43164,43165,43166,43167, -43168,43329,43330,43331,43332,43333,43334,43335,43336,43337,43338,43339,43340, -43341,43342,43343,17002,43344,43345,43346,43347,43348,43349,43350,43351,43352, -43353,43354,43361,43362,43363,43364,17003,43365,43366,17004,43367,17005,43368, -43369,43370,43371,43372,43373,43374,43375,43376,43377,43378,43379,43380,43381, -43382,43383,43384,43385,43386,43393,43394,43395,43396,43397,43398,43399,43400, -43401,43402,43403,43404,43405,43406,43407,17006,17007,43408,43409,17008,43410, -43411,43412,17009,43413,43414,43415,43416,43417,43418,43419,17010,17011,43420, -43421,43422,17012,17013,43423,43424,43585,43586,17014,17015,17016,43587,43588, -17017,43589,17018,43590,17019,43591,43592,43593,43594,43595,43596,43597,17020, -17021,43598,17022,17185,17186,17187,43599,43600,43601,43602,43603,17188,17189, -43604,43605,17190,43606,43607,43608,17191,43609,43610,43617,43618,43619,43620, -43621,17192,17193,43622,17194,17195,17196,43623,43624,43625,43626,43627,43628, -17197,43629,43630,43631,17198,43632,17199,43633,17200,43634,43635,43636,43637, -43638,43639,43640,17201,43641,43642,43649,43650,17202,43651,43652,43653,43654, -43655,43656,43657,43658,43659,43660,43661,43662,43663,43664,43665,43666,43667, -43668,43669,43670,43671,43672,43673,43674,43675,43676,43677,43678,43679,43680, -43841,43842,43843,43844,17203,17204,43845,43846,17205,43847,43848,43849,17206, -43850,43851,43852,43853,43854,43855,43856,17207,17208,43857,17209,17210,17211, -43858,43859,43860,43861,43862,43863,17212,17213,43864,43865,17214,43866,43873, -43874,17215,43875,43876,43877,43878,43879,43880,43881,17216,17217,43882,17218, -43883,17219,43884,43885,43886,43887,43888,43889,17220,43890,43891,43892,17221, -43893,43894,43895,43896,43897,43898,43905,43906,43907,43908,43909,43910,43911, -43912,43913,17222,43914,43915,43916,43917,43918,43919,43920,17223,43921,43922, -43923,17224,43924,43925,43926,43927,43928,43929,43930,43931,43932,43933,43934, -43935,43936,44097,44098,44099,17225,44100,44101,44102,44103,44104,44105,17226, -17227,44106,44107,17228,44108,44109,44110,17229,44111,44112,44113,44114,44115, -44116,44117,17230,17231,44118,17232,44119,17233,44120,44121,44122,44129,44130, -44131,17234,44132,44133,44134,17235,44135,44136,44137,17236,44138,44139,44140, -44141,44142,44143,44144,44145,44146,44147,44148,44149,17237,44150,44151,44152, -44153,44154,44161,44162,44163,44164,44165,44166,44167,44168,44169,44170,44171, -44172,44173,44174,44175,44176,44177,44178,44179,44180,44181,44182,44183,44184, -44185,44186,44187,44188,44189,17238,44190,44191,44192,17239,44353,44354,44355, -17240,44356,44357,44358,44359,44360,44361,44362,17241,17242,44363,17243,44364, -17244,44365,44366,44367,44368,44369,44370,17245,44371,44372,44373,44374,44375, -44376,44377,44378,44385,44386,44387,44388,44389,44390,44391,17246,44392,44393, -44394,44395,44396,44397,44398,44399,44400,44401,44402,17247,17248,44403,44404, -17249,44405,44406,44407,17250,44408,44409,44410,44417,44418,44419,44420,17251, -17252,44421,17253,44422,17254,44423,44424,44425,44426,44427,44428,17255,44429, -44430,44431,44432,44433,44434,44435,44436,44437,44438,44439,44440,44441,44442, -44443,44444,44445,44446,44447,17256,44448,44609,44610,44611,44612,44613,44614, -17257,44615,44616,44617,17258,44618,44619,44620,44621,44622,44623,44624,44625, -44626,44627,44628,44629,44630,44631,44632,44633,44634,44641,44642,44643,44644, -44645,44646,17259,44647,44648,44649,17260,44650,44651,44652,17261,44653,44654, -44655,44656,44657,44658,44659,17262,17263,44660,17264,44661,17265,44662,44663, -44664,44665,44666,44673,17266,44674,44675,44676,17267,44677,44678,44679,17268, -44680,44681,44682,44683,44684,44685,44686,17269,44687,44688,44689,44690,17270, -44691,44692,44693,44694,44695,44696,17271,17272,44697,44698,17273,44699,44700, -44701,17274,44702,44703,44704,44865,44866,44867,44868,17275,17276,44869,17277, -44870,17278,44871,44872,44873,44874,44875,44876,44877,44878,44879,44880,44881, -44882,44883,44884,44885,44886,44887,44888,44889,44890,44897,44898,44899,44900, -44901,44902,44903,44904,44905,44906,44907,44908,44909,44910,17441,17442,44911, -44912,17443,44913,44914,17444,17445,17446,44915,44916,44917,44918,44919,44920, -17447,17448,44921,17449,44922,17450,44929,44930,44931,44932,44933,44934,17451, -17452,44935,44936,17453,44937,44938,44939,17454,44940,44941,44942,44943,44944, -44945,44946,17455,17456,44947,17457,44948,17458,44949,44950,44951,44952,44953, -44954,17459,17460,44955,44956,17461,44957,44958,44959,17462,44960,45121,45122, -45123,45124,45125,45126,17463,17464,45127,17465,17466,17467,45128,45129,45130, -45131,45132,45133,17468,17469,45134,45135,45136,45137,45138,45139,45140,45141, -45142,45143,45144,45145,45146,45153,45154,45155,45156,45157,45158,17470,45159, -45160,45161,45162,45163,45164,45165,45166,45167,45168,45169,45170,45171,45172, -45173,45174,45175,45176,45177,45178,45185,45186,45187,45188,45189,45190,45191, -45192,45193,45194,45195,45196,45197,45198,17471,17472,45199,45200,17473,45201, -45202,17474,17475,45203,45204,45205,45206,45207,45208,45209,17476,17477,45210, -17478,17479,17480,45211,45212,45213,45214,45215,45216,17481,17482,45377,45378, -17483,45379,45380,45381,17484,45382,45383,45384,45385,45386,45387,45388,17485, -17486,45389,17487,45390,17488,45391,45392,45393,45394,45395,45396,17489,45397, -45398,45399,17490,45400,45401,45402,17491,45409,45410,45411,45412,45413,45414, -45415,17492,17493,45416,17494,17495,17496,45417,45418,45419,45420,45421,45422, -17497,45423,45424,45425,45426,45427,45428,45429,45430,45431,45432,45433,45434, -45441,45442,45443,45444,45445,45446,45447,45448,45449,45450,45451,45452,45453, -45454,45455,17498,17499,45456,45457,17500,45458,45459,45460,17501,45461,45462, -45463,45464,45465,45466,45467,17502,17503,45468,17504,45469,17505,45470,45471, -45472,45633,45634,45635,17506,17507,45636,45637,17508,45638,45639,45640,17509, -45641,45642,45643,45644,45645,45646,45647,17510,45648,45649,45650,45651,17511, -45652,45653,45654,45655,45656,45657,17512,45658,45665,45666,45667,45668,45669, -45670,45671,45672,45673,45674,45675,45676,45677,45678,45679,45680,45681,45682, -45683,17513,45684,45685,45686,45687,45688,45689,17514,45690,45697,45698,45699, -45700,45701,45702,17515,45703,45704,45705,45706,45707,45708,45709,45710,45711, -45712,45713,45714,45715,45716,45717,45718,45719,45720,45721,17516,45722,45723, -45724,45725,45726,45727,45728,45889,45890,45891,45892,45893,45894,45895,45896, -45897,45898,45899,45900,45901,45902,45903,45904,45905,45906,45907,45908,17517, -17518,45909,45910,17519,45911,45912,45913,17520,45914,45921,45922,45923,45924, -45925,45926,17521,17522,45927,17523,45928,17524,45929,45930,45931,45932,45933, -45934,17525,45935,45936,45937,17526,45938,45939,45940,17527,45941,45942,45943, -45944,45945,45946,45953,45954,45955,45956,45957,45958,17528,45959,45960,45961, -45962,45963,45964,17529,45965,45966,45967,45968,45969,45970,45971,45972,45973, -45974,45975,45976,45977,45978,45979,45980,45981,45982,45983,45984,17530,46145, -46146,46147,46148,46149,46150,17531,17532,46151,46152,17533,46153,46154,46155, -17534,46156,46157,46158,46159,46160,46161,46162,17697,17698,46163,17699,46164, -17700,46165,46166,46167,46168,46169,46170,17701,46177,46178,46179,17702,46180, -46181,46182,17703,46183,46184,46185,46186,46187,46188,46189,17704,46190,46191, -46192,46193,46194,46195,46196,46197,46198,46199,46200,17705,17706,46201,46202, -17707,46209,46210,46211,17708,46212,46213,46214,46215,46216,46217,46218,17709, -17710,46219,46220,46221,17711,46222,46223,46224,46225,46226,46227,46228,46229, -46230,46231,46232,46233,46234,46235,46236,46237,46238,46239,46240,46401,46402, -46403,46404,46405,46406,46407,46408,46409,46410,46411,46412,46413,46414,46415, -17712,17713,46416,46417,17714,46418,46419,46420,17715,46421,46422,46423,46424, -46425,46426,46433,17716,17717,46434,17718,46435,17719,46436,46437,46438,46439, -46440,46441,17720,17721,46442,46443,17722,46444,46445,46446,17723,17724,46447, -46448,46449,46450,46451,46452,17725,17726,46453,17727,17728,17729,46454,46455, -46456,46457,46458,46465,17730,17731,46466,46467,17732,46468,46469,46470,17733, -46471,46472,46473,46474,46475,46476,46477,17734,17735,46478,17736,17737,17738, -46479,46480,46481,46482,46483,46484,17739,46485,46486,46487,46488,46489,46490, -46491,46492,46493,46494,46495,46496,46657,46658,46659,46660,46661,46662,46663, -46664,17740,46665,46666,46667,46668,46669,46670,46671,46672,46673,46674,46675, -46676,46677,46678,46679,46680,46681,46682,46689,46690,46691,46692,46693,46694, -46695,46696,46697,46698,46699,46700,46701,46702,46703,46704,17741,17742,46705, -46706,17743,46707,46708,46709,17744,46710,17745,46711,46712,46713,46714,46721, -17746,17747,46722,17748,17749,17750,46723,46724,46725,46726,46727,46728,17751, -17752,46729,46730,17753,46731,46732,46733,17754,46734,46735,46736,46737,46738, -46739,46740,17755,17756,46741,17757,46742,17758,46743,46744,46745,46746,46747, -46748,17759,46749,46750,46751,17760,46752,46913,46914,46915,46916,46917,46918, -46919,46920,46921,46922,46923,46924,46925,46926,17761,46927,46928,46929,46930, -46931,46932,46933,17762,46934,46935,46936,17763,46937,46938,46945,46946,46947, -46948,46949,46950,46951,46952,46953,46954,46955,46956,46957,46958,46959,46960, -46961,46962,46963,46964,46965,17764,17765,46966,46967,17766,46968,46969,46970, -17767,46977,46978,46979,46980,46981,46982,46983,17768,17769,46984,17770,46985, -17771,46986,46987,46988,46989,17772,46990,17773,46991,46992,46993,17774,46994, -46995,46996,46997,46998,46999,47000,47001,47002,47003,47004,47005,47006,47007, -47008,47169,47170,47171,47172,47173,47174,47175,47176,17775,47177,47178,47179, -47180,47181,47182,47183,47184,47185,47186,47187,47188,47189,47190,47191,47192, -47193,47194,47201,47202,47203,47204,47205,47206,47207,47208,47209,17776,47210, -47211,47212,17777,47213,47214,47215,47216,47217,47218,47219,47220,47221,47222, -47223,47224,47225,47226,17778,47233,17779,47234,47235,47236,47237,47238,47239, -17780,47240,47241,47242,47243,47244,47245,47246,47247,47248,47249,47250,47251, -47252,47253,47254,47255,47256,47257,47258,47259,47260,47261,47262,47263,47264, -47425,47426,17781,17782,47427,47428,17783,47429,47430,47431,17784,47432,47433, -47434,47435,47436,47437,47438,17785,17786,47439,17787,47440,17788,47441,47442, -47443,47444,47445,47446,17789,47447,47448,47449,47450,47457,47458,47459,47460, -47461,47462,47463,47464,47465,47466,47467,47468,47469,47470,47471,17790,47472, -47473,47474,47475,47476,47477,47478,17953,47479,47480,47481,47482,47489,47490, -47491,47492,47493,47494,47495,47496,47497,47498,47499,47500,47501,47502,47503, -47504,47505,47506,47507,47508,47509,47510,47511,17954,17955,47512,47513,17956, -47514,47515,47516,17957,47517,47518,47519,47520,47681,47682,47683,17958,17959, -47684,47685,47686,17960,47687,47688,47689,47690,47691,47692,17961,47693,47694, -47695,17962,47696,47697,47698,17963,47699,47700,47701,47702,47703,47704,47705, -17964,47706,47713,47714,47715,17965,47716,47717,47718,47719,47720,47721,17966, -17967,47722,47723,17968,47724,47725,17969,17970,47726,17971,47727,47728,47729, -47730,47731,17972,17973,47732,17974,47733,47734,47735,47736,47737,47738,47745, -47746,17975,47747,47748,47749,17976,47750,47751,47752,17977,47753,47754,47755, -47756,47757,47758,47759,17978,17979,47760,47761,47762,47763,47764,47765,47766, -47767,47768,47769,17980,17981,47770,47771,17982,47772,47773,47774,17983,47775, -47776,47937,47938,47939,47940,47941,17984,17985,47942,17986,47943,17987,47944, -47945,47946,47947,47948,47949,17988,17989,17990,47950,17991,47951,47952,47953, -17992,47954,17993,47955,47956,47957,47958,47959,17994,17995,47960,17996,17997, -17998,47961,47962,47969,17999,47970,47971,18000,18001,47972,47973,18002,47974, -47975,47976,18003,47977,47978,47979,47980,47981,47982,47983,18004,18005,47984, -18006,18007,18008,47985,47986,47987,47988,47989,47990,18009,18010,47991,47992, -47993,47994,48001,48002,48003,48004,48005,48006,48007,48008,48009,48010,48011, -48012,48013,48014,48015,48016,48017,48018,48019,48020,48021,48022,48023,48024, -48025,48026,48027,48028,48029,48030,48031,48032,48193,48194,48195,48196,48197, -48198,48199,48200,48201,48202,48203,48204,48205,48206,48207,48208,48209,48210, -18011,18012,48211,48212,18013,48213,48214,48215,18014,48216,48217,48218,48225, -48226,48227,48228,18015,18016,48229,18017,18018,18019,48230,48231,48232,48233, -48234,48235,18020,18021,48236,48237,18022,48238,48239,48240,18023,48241,48242, -48243,48244,48245,48246,48247,18024,18025,48248,18026,48249,18027,48250,48257, -48258,48259,48260,48261,18028,48262,48263,48264,18029,48265,48266,48267,18030, -48268,48269,48270,48271,48272,48273,48274,18031,18032,48275,48276,18033,18034, -48277,48278,48279,48280,48281,48282,18035,48283,48284,48285,48286,48287,48288, -48449,18036,48450,48451,48452,48453,48454,48455,48456,48457,18037,48458,18038, -48459,48460,48461,48462,48463,48464,48465,48466,18039,18040,48467,48468,18041, -48469,48470,48471,18042,48472,48473,48474,48481,48482,48483,48484,18043,18044, -48485,18045,48486,18046,48487,48488,48489,48490,48491,48492,18209,48493,48494, -48495,48496,48497,48498,48499,48500,48501,48502,48503,48504,48505,48506,48513, -48514,48515,48516,48517,48518,18210,48519,48520,48521,48522,48523,48524,48525, -48526,48527,48528,48529,48530,48531,48532,48533,48534,48535,48536,48537,48538, -48539,48540,48541,48542,48543,48544,48705,48706,48707,48708,48709,48710,48711, -48712,18211,48713,48714,48715,18212,48716,48717,48718,48719,48720,48721,48722, -48723,48724,48725,48726,48727,48728,48729,48730,48737,48738,48739,48740,48741, -48742,48743,48744,18213,48745,48746,48747,18214,48748,48749,48750,18215,48751, -48752,48753,48754,48755,48756,48757,48758,18216,48759,18217,48760,48761,48762, -48769,48770,48771,48772,48773,18218,18219,48774,48775,18220,48776,48777,18221, -18222,48778,18223,48779,48780,48781,48782,48783,18224,18225,48784,18226,48785, -18227,48786,48787,48788,48789,48790,48791,18228,48792,48793,48794,48795,48796, -48797,48798,48799,48800,48961,48962,48963,48964,48965,48966,48967,48968,48969, -48970,48971,18229,48972,48973,48974,48975,48976,48977,48978,48979,48980,48981, -48982,48983,48984,48985,48986,48993,48994,48995,48996,48997,48998,48999,49000, -49001,49002,49003,49004,49005,49006,49007,49008,49009,49010,49011,18230,49012, -49013,49014,18231,49015,49016,49017,18232,49018,49025,49026,49027,49028,49029, -49030,18233,49031,49032,18234,49033,49034,49035,49036,49037,49038,49039,49040, -18235,49041,49042,49043,18236,49044,49045,49046,18237,49047,49048,49049,49050, -49051,49052,49053,18238,49054,49055,18239,49056,18240,49217,49218,49219,49220, -49221,49222,18241,49223,49224,49225,18242,49226,49227,49228,18243,49229,49230, -49231,49232,49233,49234,49235,18244,18245,49236,18246,49237,49238,49239,49240, -49241,49242,49249,49250,49251,49252,49253,49254,49255,49256,49257,49258,49259, -49260,49261,49262,49263,49264,49265,49266,49267,49268,49269,49270,49271,49272, -49273,49274,49281,49282,49283,49284,18247,18248,49285,49286,18249,49287,49288, -49289,18250,49290,49291,49292,49293,49294,49295,49296,18251,18252,49297,18253, -49298,18254,49299,49300,49301,49302,49303,49304,18255,18256,49305,49306,18257, -49307,49308,49309,18258,49310,49311,49312,49473,18259,49474,49475,18260,18261, -49476,18262,49477,18263,49478,49479,49480,49481,49482,49483,18264,18265,49484, -49485,18266,49486,49487,49488,18267,49489,49490,49491,49492,49493,49494,49495, -18268,18269,49496,18270,18271,18272,49497,49498,49505,49506,49507,49508,18273, -49509,49510,49511,49512,49513,49514,49515,49516,49517,49518,49519,49520,49521, -49522,49523,49524,49525,49526,49527,49528,18274,49529,49530,49537,49538,49539, -49540,49541,49542,49543,49544,49545,49546,49547,49548,49549,49550,49551,49552, -49553,49554,49555,49556,49557,49558,49559,49560,49561,49562,49563,49564,49565, -49566,49567,49568,18275,18276,49729,49730,18277,49731,49732,49733,18278,49734, -18279,49735,49736,49737,49738,49739,18280,18281,49740,18282,49741,18283,49742, -49743,49744,49745,49746,49747,18284,18285,49748,49749,18286,49750,49751,49752, -18287,49753,49754,49761,49762,49763,49764,49765,18288,18289,49766,18290,49767, -18291,49768,49769,49770,49771,49772,49773,18292,18293,49774,49775,18294,49776, -49777,49778,18295,49779,49780,49781,49782,49783,49784,49785,18296,18297,49786, -18298,18299,18300,49793,49794,49795,49796,49797,49798,18301,49799,49800,49801, -18302,49802,49803,49804,18465,49805,49806,49807,49808,49809,49810,49811,49812, -18466,49813,49814,49815,49816,49817,49818,49819,49820,49821,49822,18467,18468, -49823,49824,18469,49985,49986,49987,18470,49988,49989,49990,49991,18471,49992, -49993,18472,18473,49994,18474,49995,18475,49996,49997,49998,18476,49999,50000, -18477,18478,50001,50002,18479,50003,50004,50005,18480,50006,50007,50008,50009, -50010,50017,50018,50019,50020,50021,18481,50022,18482,50023,50024,50025,50026, -50027,50028,18483,18484,50029,50030,18485,50031,50032,50033,50034,50035,50036, -50037,50038,50039,50040,50041,50042,50049,50050,18486,50051,18487,50052,50053, -50054,50055,50056,50057,18488,18489,50058,50059,18490,50060,50061,50062,18491, -50063,50064,50065,50066,50067,50068,50069,50070,18492,50071,18493,50072,18494, -50073,50074,50075,50076,50077,50078,18495,50079,50080,50241,18496,50242,50243, -50244,18497,50245,50246,50247,50248,50249,50250,50251,50252,18498,50253,18499, -50254,50255,50256,50257,50258,50259,50260,50261,18500,18501,50262,50263,18502, -50264,50265,50266,18503,50273,50274,50275,50276,18504,50277,50278,18505,50279, -50280,18506,50281,18507,50282,50283,50284,50285,50286,50287,18508,50288,50289, -50290,18509,50291,50292,50293,18510,50294,50295,50296,50297,50298,50305,50306, -18511,50307,50308,50309,50310,18512,50311,50312,50313,50314,50315,50316,18513, -18514,50317,50318,18515,50319,50320,50321,18516,50322,50323,50324,50325,50326, -50327,50328,50329,50330,50331,50332,50333,18517,50334,50335,50336,50497,50498, -50499,18518,18519,50500,50501,18520,50502,50503,50504,18521,50505,50506,50507, -50508,50509,50510,50511,18522,18523,50512,18524,50513,18525,50514,50515,50516, -50517,50518,50519,18526,18527,50520,50521,18528,50522,50529,50530,18529,50531, -50532,50533,50534,50535,50536,50537,18530,50538,50539,18531,50540,18532,50541, -50542,50543,50544,50545,50546,18533,18534,50547,50548,18535,50549,18536,18537, -18538,18539,50550,50551,50552,50553,50554,50561,18540,18541,50562,18542,50563, -18543,50564,50565,50566,18544,50567,50568,18545,50569,50570,50571,18546,50572, -50573,50574,18547,50575,50576,50577,50578,50579,50580,50581,18548,18549,50582, -50583,50584,18550,50585,50586,50587,50588,50589,50590,18551,18552,50591,50592, -18553,50753,50754,50755,18554,50756,50757,50758,50759,50760,50761,50762,18555, -18556,50763,18557,50764,18558,50765,50766,50767,50768,50769,50770,19280,19286, -19303,19791,19816,20013,20347,20514,20536,20560,20573,20820,20821,20824,20827, -20828,20829,20830,20831,20832,20834,20835,20836,20837,20838,20840,20841,20842, -20843,20845,20847,20848,20850,20854,20858,20860,20861,20862,21026,21027,21031, -21032,21033,21034,21035,21037,21042,21054,21058,21059,21060,21062,21063,21064, -21065,21066,21067,21069,21070,21071,21072,21073,21074,21075,21076,21077,21078, -21079,21081,21082,21086,21087,21089,21090,21092,21093,21094,21095,21096,21097, -21098,21099,21104,21105,21106,21107,21108,21109,21111,21112,21606,21628,21797, -21803,21806,22072,22093,22347,22372,23365,23396,23589,23845,23893,23924,24188, -24190,24371,24417,24424,24689,24877,24941,25461,25633,25641,25902,25905,25906, -25913,25915,25916,25924,25934,25936,25938,25942,25978,25979,25980,25982,26145, -26148,26151,26157,26159,26160,26161,26163,26167,26168,26172,26180,26182,26183, -26186,26194,26198,26201,26204,26207,26209,26212,26213,26214,26216,26218,26219, -26220,26223,26225,26226,26229,26230,26231,26233,26401,26406,26409,26410,26412, -26413,26416,26431,26433,26438,26439,26443,26445,26447,26448,26451,26463,26468, -26470,26487,26727,26728,26736,26737,26743,26745,26747,26750,26919,26924,26956, -26999,27201,27237,27252,27255,27260,27262,27428,27431,27433,27434,27450,27451, -27453,27457,27458,27462,27463,27468,27471,27472,27473,27474,27480,27686,27687, -27690,27695,27696,27697,27698,27701,27704,27706,27712,27713,27717,27718,27721, -27722,27733,27741,27742,27745,27748,27751,27752,27767,27768,27770,27937,27938, -27939,28014,28251,29245,29306,29489,29735,29806,30324,30326,30520,30536,30547, -30811,30832,31265,31266,31334,31785,8993,8994,8995,8996,8997,8998,8999,9000, -9001,9002,9003,9004,9005,9006,9007,9008,9009,9010,9011,9012,9013,9014,9015, -9016,9017,9018,9019,9020,9021,9022,9023,9024,9025,9026,9027,9028,9029,9030, -9031,9032,9033,9034,9035,9036,9037,9038,9039,9040,9041,9042,9043,9044,9045, -9046,9047,9048,9049,9050,9051,8492,9053,9054,9055,9056,9057,9058,9059,9060, -9061,9062,9063,9064,9065,9066,9067,9068,9069,9070,9071,9072,9073,9074,9075, -9076,9077,9078,9079,9080,9081,9082,9083,9084,9085,8742,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,8523,8524,8574,9086,N,8525,9052, -}; - -static const struct unim_index cp949_encmap[256] = { -{__cp949_encmap+0,161,254},{__cp949_encmap+94,17,103},{__cp949_encmap+181,199, -221},{__cp949_encmap+204,145,201},{__cp949_encmap+261,1,81},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp949_encmap+342,21,172},{ -__cp949_encmap+494,3,212},{__cp949_encmap+704,0,165},{__cp949_encmap+870,18,18 -},{__cp949_encmap+871,96,233},{__cp949_encmap+1009,0,209},{__cp949_encmap+1219 -,5,109},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{__cp949_encmap+1324,0,246},{__cp949_encmap+1571,49,142},{__cp949_encmap+ -1665,0,127},{__cp949_encmap+1793,128,221},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{__cp949_encmap+1887,0,251},{__cp949_encmap+2139,1,250},{ -__cp949_encmap+2389,2,255},{__cp949_encmap+2643,0,253},{__cp949_encmap+2897,0, -255},{__cp949_encmap+3153,5,248},{__cp949_encmap+3397,3,250},{__cp949_encmap+ -3645,4,254},{__cp949_encmap+3896,6,250},{__cp949_encmap+4141,3,252},{ -__cp949_encmap+4391,0,253},{__cp949_encmap+4645,15,255},{__cp949_encmap+4886, -1,233},{__cp949_encmap+5119,5,250},{__cp949_encmap+5365,1,253},{__cp949_encmap -+5618,7,254},{__cp949_encmap+5866,2,251},{__cp949_encmap+6116,1,255},{ -__cp949_encmap+6371,15,251},{__cp949_encmap+6608,1,255},{__cp949_encmap+6863, -0,255},{__cp949_encmap+7119,1,247},{__cp949_encmap+7366,13,254},{ -__cp949_encmap+7608,0,255},{__cp949_encmap+7864,6,255},{__cp949_encmap+8114,0, -254},{__cp949_encmap+8369,18,250},{__cp949_encmap+8602,0,255},{__cp949_encmap+ -8858,2,251},{__cp949_encmap+9108,4,236},{__cp949_encmap+9341,8,243},{ -__cp949_encmap+9577,11,251},{__cp949_encmap+9818,23,255},{__cp949_encmap+10051 -,1,254},{__cp949_encmap+10305,1,253},{__cp949_encmap+10558,4,255},{ -__cp949_encmap+10810,0,253},{__cp949_encmap+11064,10,254},{__cp949_encmap+ -11309,1,247},{__cp949_encmap+11556,1,252},{__cp949_encmap+11808,0,254},{ -__cp949_encmap+12063,1,243},{__cp949_encmap+12306,2,251},{__cp949_encmap+12556 -,1,251},{__cp949_encmap+12807,0,255},{__cp949_encmap+13063,15,233},{ -__cp949_encmap+13282,7,254},{__cp949_encmap+13530,0,251},{__cp949_encmap+13782 -,9,156},{__cp949_encmap+13930,54,252},{__cp949_encmap+14129,0,253},{ -__cp949_encmap+14383,2,254},{__cp949_encmap+14636,5,254},{__cp949_encmap+14886 -,1,253},{__cp949_encmap+15139,3,252},{__cp949_encmap+15389,17,255},{ -__cp949_encmap+15628,2,254},{__cp949_encmap+15881,0,254},{__cp949_encmap+16136 -,5,253},{__cp949_encmap+16385,7,248},{__cp949_encmap+16627,0,254},{ -__cp949_encmap+16882,0,154},{__cp949_encmap+17037,55,253},{__cp949_encmap+ -17236,4,243},{__cp949_encmap+17476,10,254},{__cp949_encmap+17721,3,253},{ -__cp949_encmap+17972,0,253},{__cp949_encmap+18226,2,245},{__cp949_encmap+18470 -,13,252},{__cp949_encmap+18710,4,246},{__cp949_encmap+18953,4,127},{ -__cp949_encmap+19077,119,226},{__cp949_encmap+19185,28,251},{__cp949_encmap+ -19409,0,255},{__cp949_encmap+19665,0,254},{__cp949_encmap+19920,3,255},{ -__cp949_encmap+20173,1,238},{__cp949_encmap+20411,26,232},{__cp949_encmap+ -20618,13,246},{__cp949_encmap+20852,9,250},{__cp949_encmap+21094,26,244},{ -__cp949_encmap+21313,7,156},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp949_encmap+21463,0,255},{ -__cp949_encmap+21719,0,255},{__cp949_encmap+21975,0,255},{__cp949_encmap+22231 -,0,255},{__cp949_encmap+22487,0,255},{__cp949_encmap+22743,0,255},{ -__cp949_encmap+22999,0,255},{__cp949_encmap+23255,0,255},{__cp949_encmap+23511 -,0,255},{__cp949_encmap+23767,0,255},{__cp949_encmap+24023,0,255},{ -__cp949_encmap+24279,0,255},{__cp949_encmap+24535,0,255},{__cp949_encmap+24791 -,0,255},{__cp949_encmap+25047,0,255},{__cp949_encmap+25303,0,255},{ -__cp949_encmap+25559,0,255},{__cp949_encmap+25815,0,255},{__cp949_encmap+26071 -,0,255},{__cp949_encmap+26327,0,255},{__cp949_encmap+26583,0,255},{ -__cp949_encmap+26839,0,255},{__cp949_encmap+27095,0,255},{__cp949_encmap+27351 -,0,255},{__cp949_encmap+27607,0,255},{__cp949_encmap+27863,0,255},{ -__cp949_encmap+28119,0,255},{__cp949_encmap+28375,0,255},{__cp949_encmap+28631 -,0,255},{__cp949_encmap+28887,0,255},{__cp949_encmap+29143,0,255},{ -__cp949_encmap+29399,0,255},{__cp949_encmap+29655,0,255},{__cp949_encmap+29911 -,0,255},{__cp949_encmap+30167,0,255},{__cp949_encmap+30423,0,255},{ -__cp949_encmap+30679,0,255},{__cp949_encmap+30935,0,255},{__cp949_encmap+31191 -,0,255},{__cp949_encmap+31447,0,255},{__cp949_encmap+31703,0,255},{ -__cp949_encmap+31959,0,255},{__cp949_encmap+32215,0,255},{__cp949_encmap+32471 -,0,163},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp949_encmap+32635,0,255},{ -__cp949_encmap+32891,0,11},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp949_encmap+ -32903,1,230}, -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_tw.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_tw.h deleted file mode 100644 index fa2fb81..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/mappings_tw.h +++ /dev/null @@ -1,2633 +0,0 @@ -static const ucs2_t __big5_decmap[16702] = { -12288,65292,12289,12290,65294,8226,65307,65306,65311,65281,65072,8230,8229, -65104,65380,65106,183,65108,65109,65110,65111,65372,8211,65073,8212,65075, -9588,65076,65103,65288,65289,65077,65078,65371,65373,65079,65080,12308,12309, -65081,65082,12304,12305,65083,65084,12298,12299,65085,65086,12296,12297,65087, -65088,12300,12301,65089,65090,12302,12303,65091,65092,65113,65114,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,65115,65116,65117, -65118,8216,8217,8220,8221,12317,12318,8245,8242,65283,65286,65290,8251,167, -12291,9675,9679,9651,9650,9678,9734,9733,9671,9670,9633,9632,9661,9660,12963, -8453,8254,65507,65343,717,65097,65098,65101,65102,65099,65100,65119,65120, -65121,65291,65293,215,247,177,8730,65308,65310,65309,8806,8807,8800,8734,8786, -8801,65122,65123,65124,65125,65126,8764,8745,8746,8869,8736,8735,8895,13266, -13265,8747,8750,8757,8756,9792,9794,9793,9737,8593,8595,8592,8594,8598,8599, -8601,8600,8741,8739,65295,65340,65295,65340,65284,165,12306,162,163,65285, -65312,8451,8457,65129,65130,65131,13269,13212,13213,13214,13262,13217,13198, -13199,13252,176,20825,20827,20830,20829,20833,20835,21991,29929,31950,9601, -9602,9603,9604,9605,9606,9607,9608,9615,9614,9613,9612,9611,9610,9609,9532, -9524,9516,9508,9500,9620,9472,9474,9621,9484,9488,9492,9496,9581,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,9582,9584,9583,9552, -9566,9578,9569,9698,9699,9701,9700,9585,9586,9587,65296,65297,65298,65299, -65300,65301,65302,65303,65304,65305,8544,8545,8546,8547,8548,8549,8550,8551, -8552,8553,12321,12322,12323,12324,12325,12326,12327,12328,12329,21313,21316, -21317,65313,65314,65315,65316,65317,65318,65319,65320,65321,65322,65323,65324, -65325,65326,65327,65328,65329,65330,65331,65332,65333,65334,65335,65336,65337, -65338,65345,65346,65347,65348,65349,65350,65351,65352,65353,65354,65355,65356, -65357,65358,65359,65360,65361,65362,65363,65364,65365,65366,65367,65368,65369, -65370,913,914,915,916,917,918,919,920,921,922,923,924,925,926,927,928,929,931, -932,933,934,935,936,937,945,946,947,948,949,950,951,952,953,954,955,956,957, -958,959,960,961,963,964,965,966,967,968,969,12549,12550,12551,12552,12553, -12554,12555,12556,12557,12558,12559,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,12560,12561,12562,12563,12564,12565,12566,12567, -12568,12569,12570,12571,12572,12573,12574,12575,12576,12577,12578,12579,12580, -12581,12582,12583,12584,12585,729,713,714,711,715,19968,20057,19969,19971, -20035,20061,20102,20108,20154,20799,20837,20843,20960,20992,20993,21147,21269, -21313,21340,21448,19977,19979,19976,19978,20011,20024,20961,20037,20040,20063, -20062,20110,20129,20800,20995,21242,21315,21449,21475,22303,22763,22805,22823, -22899,23376,23377,23379,23544,23567,23586,23608,23665,24029,24037,24049,24050, -24051,24062,24178,24318,24331,24339,25165,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,19985,19984,19981,20013,20016,20025,20043, -23609,20104,20113,20117,20114,20116,20130,20161,20160,20163,20166,20167,20173, -20170,20171,20164,20803,20801,20839,20845,20846,20844,20887,20982,20998,20999, -21000,21243,21246,21247,21270,21305,21320,21319,21317,21342,21380,21451,21450, -21453,22764,22825,22827,22826,22829,23380,23569,23588,23610,23663,24052,24187, -24319,24340,24341,24515,25096,25142,25163,25166,25903,25991,26007,26020,26041, -26085,26352,26376,26408,27424,27490,27513,27595,27604,27611,27663,27700,28779, -29226,29238,29243,29255,29273,29275,29356,29579,19993,19990,19989,19988,19992, -20027,20045,20047,20046,20197,20184,20180,20181,20182,20183,20195,20196,20185, -20190,20805,20804,20873,20874,20908,20985,20986,20984,21002,21152,21151,21253, -21254,21271,21277,20191,21322,21321,21345,21344,21359,21358,21435,21487,21476, -21491,21484,21486,21481,21480,21500,21496,21493,21483,21478,21482,21490,21489, -21488,21477,21485,21499,22235,22234,22806,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22830,22833,22900,22902,23381,23427,23612, -24040,24039,24038,24066,24067,24179,24188,24321,24344,24343,24517,25098,25171, -25172,25170,25169,26021,26086,26414,26412,26410,26411,26413,27491,27597,27665, -27664,27704,27713,27712,27710,29359,29572,29577,29916,29926,29976,29983,29992, -29993,30000,30001,30002,30003,30091,30333,30382,30399,30446,30683,30690,30707, -31034,31166,31348,31435,19998,19999,20050,20051,20073,20121,20132,20134,20133, -20223,20233,20249,20234,20245,20237,20240,20241,20239,20210,20214,20219,20208, -20211,20221,20225,20235,20809,20807,20806,20808,20840,20849,20877,20912,21015, -21009,21010,21006,21014,21155,21256,21281,21280,21360,21361,21513,21519,21516, -21514,21520,21505,21515,21508,21521,21517,21512,21507,21518,21510,21522,22240, -22238,22237,22323,22320,22312,22317,22316,22319,22313,22809,22810,22839,22840, -22916,22904,22915,22909,22905,22914,22913,23383,23384,23431,23432,23429,23433, -23546,23574,23673,24030,24070,24182,24180,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24335,24347,24537,24534,25102,25100,25101, -25104,25187,25179,25176,25910,26089,26088,26092,26093,26354,26355,26377,26429, -26420,26417,26421,27425,27492,27515,27670,27741,27735,27737,27743,27744,27728, -27733,27745,27739,27725,27726,28784,29279,29277,30334,31481,31859,31992,32566, -32650,32701,32769,32771,32780,32786,32819,32895,32905,32907,32908,33251,33258, -33267,33276,33292,33307,33311,33390,33394,33406,34411,34880,34892,34915,35199, -38433,20018,20136,20301,20303,20295,20311,20318,20276,20315,20309,20272,20304, -20305,20285,20282,20280,20291,20308,20284,20294,20323,20316,20320,20271,20302, -20278,20313,20317,20296,20314,20812,20811,20813,20853,20918,20919,21029,21028, -21033,21034,21032,21163,21161,21162,21164,21283,21363,21365,21533,21549,21534, -21566,21542,21582,21543,21574,21571,21555,21576,21570,21531,21545,21578,21561, -21563,21560,21550,21557,21558,21536,21564,21568,21553,21547,21535,21548,22250, -22256,22244,22251,22346,22353,22336,22349,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22343,22350,22334,22352,22351,22331,22767, -22846,22941,22930,22952,22942,22947,22937,22934,22925,22948,22931,22922,22949, -23389,23388,23386,23387,23436,23435,23439,23596,23616,23617,23615,23614,23696, -23697,23700,23692,24043,24076,24207,24199,24202,24311,24324,24351,24420,24418, -24439,24441,24536,24524,24535,24525,24561,24555,24568,24554,25106,25105,25220, -25239,25238,25216,25206,25225,25197,25226,25212,25214,25209,25203,25234,25199, -25240,25198,25237,25235,25233,25222,25913,25915,25912,26097,26356,26463,26446, -26447,26448,26449,26460,26454,26462,26441,26438,26464,26451,26455,27493,27599, -27714,27742,27801,27777,27784,27785,27781,27803,27754,27770,27792,27760,27788, -27752,27798,27794,27773,27779,27762,27774,27764,27782,27766,27789,27796,27800, -27778,28790,28796,28797,28792,29282,29281,29280,29380,29378,29590,29996,29995, -30007,30008,30338,30447,30691,31169,31168,31167,31350,31995,32597,32918,32915, -32925,32920,32923,32922,32946,33391,33426,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33419,33421,35211,35282,35328,35895,35910, -35925,35997,36196,36208,36275,36523,36554,36763,36784,36802,36806,36805,36804, -24033,37009,37026,37034,37030,37027,37193,37318,37324,38450,38446,38449,38442, -38444,20006,20054,20083,20107,20123,20126,20139,20140,20335,20381,20365,20339, -20351,20332,20379,20363,20358,20355,20336,20341,20360,20329,20347,20374,20350, -20367,20369,20346,20820,20818,20821,20841,20855,20854,20856,20925,20989,21051, -21048,21047,21050,21040,21038,21046,21057,21182,21179,21330,21332,21331,21329, -21350,21367,21368,21369,21462,21460,21463,21619,21621,21654,21624,21653,21632, -21627,21623,21636,21650,21638,21628,21648,21617,21622,21644,21658,21602,21608, -21643,21629,21646,22266,22403,22391,22378,22377,22369,22374,22372,22396,22812, -22857,22855,22856,22852,22868,22974,22971,22996,22969,22958,22993,22982,22992, -22989,22987,22995,22986,22959,22963,22994,22981,23391,23396,23395,23447,23450, -23448,23452,23449,23451,23578,23624,23621,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23622,23735,23713,23736,23721,23723,23729, -23731,24088,24090,24086,24085,24091,24081,24184,24218,24215,24220,24213,24214, -24310,24358,24359,24361,24448,24449,24447,24444,24541,24544,24573,24565,24575, -24591,24596,24623,24629,24598,24618,24597,24609,24615,24617,24619,24603,25110, -25109,25151,25150,25152,25215,25289,25292,25284,25279,25282,25273,25298,25307, -25259,25299,25300,25291,25288,25256,25277,25276,25296,25305,25287,25293,25269, -25306,25265,25304,25302,25303,25286,25260,25294,25918,26023,26044,26106,26132, -26131,26124,26118,26114,26126,26112,26127,26133,26122,26119,26381,26379,26477, -26507,26517,26481,26524,26483,26487,26503,26525,26519,26479,26480,26495,26505, -26494,26512,26485,26522,26515,26492,26474,26482,27427,27494,27495,27519,27667, -27675,27875,27880,27891,27825,27852,27877,27827,27837,27838,27836,27874,27819, -27861,27859,27832,27844,27833,27841,27822,27863,27845,27889,27839,27835,27873, -27867,27850,27820,27887,27868,27862,27872,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28821,28814,28818,28810,28825,29228,29229, -29240,29256,29287,29289,29376,29390,29401,29399,29392,29609,29608,29599,29611, -29605,30013,30109,30105,30106,30340,30402,30450,30452,30693,30717,31038,31040, -31041,31177,31176,31354,31353,31482,31998,32596,32652,32651,32773,32954,32933, -32930,32945,32929,32939,32937,32948,32938,32943,33253,33278,33293,33459,33437, -33433,33453,33469,33439,33465,33457,33452,33445,33455,33464,33443,33456,33470, -33463,34382,34417,21021,34920,36555,36814,36820,36817,37045,37048,37041,37046, -37319,37329,38263,38272,38428,38464,38463,38459,38468,38466,38585,38632,38738, -38750,20127,20141,20142,20449,20405,20399,20415,20448,20433,20431,20445,20419, -20406,20440,20447,20426,20439,20398,20432,20420,20418,20442,20430,20446,20407, -20823,20882,20881,20896,21070,21059,21066,21069,21068,21067,21063,21191,21193, -21187,21185,21261,21335,21371,21402,21467,21676,21696,21672,21710,21705,21688, -21670,21683,21703,21698,21693,21674,21697,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,21700,21704,21679,21675,21681,21691,21673, -21671,21695,22271,22402,22411,22432,22435,22434,22478,22446,22419,22869,22865, -22863,22862,22864,23004,23000,23039,23011,23016,23043,23013,23018,23002,23014, -23041,23035,23401,23459,23462,23460,23458,23461,23553,23630,23631,23629,23627, -23769,23762,24055,24093,24101,24095,24189,24224,24230,24314,24328,24365,24421, -24456,24453,24458,24459,24455,24460,24457,24594,24605,24608,24613,24590,24616, -24653,24688,24680,24674,24646,24643,24684,24683,24682,24676,25153,25308,25366, -25353,25340,25325,25345,25326,25341,25351,25329,25335,25327,25324,25342,25332, -25361,25346,25919,25925,26027,26045,26082,26149,26157,26144,26151,26159,26143, -26152,26161,26148,26359,26623,26579,26609,26580,26576,26604,26550,26543,26613, -26601,26607,26564,26577,26548,26586,26597,26552,26575,26590,26611,26544,26585, -26594,26589,26578,27498,27523,27526,27573,27602,27607,27679,27849,27915,27954, -27946,27969,27941,27916,27953,27934,27927,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,27963,27965,27966,27958,27931,27893,27961, -27943,27960,27945,27950,27957,27918,27947,28843,28858,28851,28844,28847,28845, -28856,28846,28836,29232,29298,29295,29300,29417,29408,29409,29623,29642,29627, -29618,29645,29632,29619,29978,29997,30031,30028,30030,30027,30123,30116,30117, -30114,30115,30328,30342,30343,30344,30408,30406,30403,30405,30465,30457,30456, -30473,30475,30462,30460,30471,30684,30722,30740,30732,30733,31046,31049,31048, -31047,31161,31162,31185,31186,31179,31359,31361,31487,31485,31869,32002,32005, -32000,32009,32007,32004,32006,32568,32654,32703,32772,32784,32781,32785,32822, -32982,32997,32986,32963,32964,32972,32993,32987,32974,32990,32996,32989,33268, -33314,33511,33539,33541,33507,33499,33510,33540,33509,33538,33545,33490,33495, -33521,33537,33500,33492,33489,33502,33491,33503,33519,33542,34384,34425,34427, -34426,34893,34923,35201,35284,35336,35330,35331,35998,36000,36212,36211,36276, -36557,36556,36848,36838,36834,36842,36837,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,36845,36843,36836,36840,37066,37070,37057, -37059,37195,37194,37325,38274,38480,38475,38476,38477,38754,38761,38859,38893, -38899,38913,39080,39131,39135,39318,39321,20056,20147,20492,20493,20515,20463, -20518,20517,20472,20521,20502,20486,20540,20511,20506,20498,20497,20474,20480, -20500,20520,20465,20513,20491,20505,20504,20467,20462,20525,20522,20478,20523, -20489,20860,20900,20901,20898,20941,20940,20934,20939,21078,21084,21076,21083, -21085,21290,21375,21407,21405,21471,21736,21776,21761,21815,21756,21733,21746, -21766,21754,21780,21737,21741,21729,21769,21742,21738,21734,21799,21767,21757, -21775,22275,22276,22466,22484,22475,22467,22537,22799,22871,22872,22874,23057, -23064,23068,23071,23067,23059,23020,23072,23075,23081,23077,23052,23049,23403, -23640,23472,23475,23478,23476,23470,23477,23481,23480,23556,23633,23637,23632, -23789,23805,23803,23786,23784,23792,23798,23809,23796,24046,24109,24107,24235, -24237,24231,24369,24466,24465,24464,24665,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24675,24677,24656,24661,24685,24681,24687, -24708,24735,24730,24717,24724,24716,24709,24726,25159,25331,25352,25343,25422, -25406,25391,25429,25410,25414,25423,25417,25402,25424,25405,25386,25387,25384, -25421,25420,25928,25929,26009,26049,26053,26178,26185,26191,26179,26194,26188, -26181,26177,26360,26388,26389,26391,26657,26680,26696,26694,26707,26681,26690, -26708,26665,26803,26647,26700,26705,26685,26612,26704,26688,26684,26691,26666, -26693,26643,26648,26689,27530,27529,27575,27683,27687,27688,27686,27684,27888, -28010,28053,28040,28039,28006,28024,28023,27993,28051,28012,28041,28014,27994, -28020,28009,28044,28042,28025,28037,28005,28052,28874,28888,28900,28889,28872, -28879,29241,29305,29436,29433,29437,29432,29431,29574,29677,29705,29678,29664, -29674,29662,30036,30045,30044,30042,30041,30142,30149,30151,30130,30131,30141, -30140,30137,30146,30136,30347,30384,30410,30413,30414,30505,30495,30496,30504, -30697,30768,30759,30776,30749,30772,30775,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30757,30765,30752,30751,30770,31061,31056, -31072,31071,31062,31070,31069,31063,31066,31204,31203,31207,31199,31206,31209, -31192,31364,31368,31449,31494,31505,31881,32033,32023,32011,32010,32032,32034, -32020,32016,32021,32026,32028,32013,32025,32027,32570,32607,32660,32709,32705, -32774,32792,32789,32793,32791,32829,32831,33009,33026,33008,33029,33005,33012, -33030,33016,33011,33032,33021,33034,33020,33007,33261,33260,33280,33296,33322, -33323,33320,33324,33467,33579,33618,33620,33610,33592,33616,33609,33589,33588, -33615,33586,33593,33590,33559,33600,33585,33576,33603,34388,34442,34474,34451, -34468,34473,34444,34467,34460,34928,34935,34945,34946,34941,34937,35352,35344, -35342,35340,35349,35338,35351,35347,35350,35343,35345,35912,35962,35961,36001, -36002,36215,36524,36562,36564,36559,36785,36865,36870,36855,36864,36858,36852, -36867,36861,36869,36856,37013,37089,37085,37090,37202,37197,37196,37336,37341, -37335,37340,37337,38275,38498,38499,38497,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38491,38493,38500,38488,38494,38587,39138, -39340,39592,39640,39717,39730,39740,20094,20602,20605,20572,20551,20547,20556, -20570,20553,20581,20598,20558,20565,20597,20596,20599,20559,20495,20591,20589, -20828,20885,20976,21098,21103,21202,21209,21208,21205,21264,21263,21273,21311, -21312,21310,21443,26364,21830,21866,21862,21828,21854,21857,21827,21834,21809, -21846,21839,21845,21807,21860,21816,21806,21852,21804,21859,21811,21825,21847, -22280,22283,22281,22495,22533,22538,22534,22496,22500,22522,22530,22581,22519, -22521,22816,22882,23094,23105,23113,23142,23146,23104,23100,23138,23130,23110, -23114,23408,23495,23493,23492,23490,23487,23494,23561,23560,23559,23648,23644, -23645,23815,23814,23822,23835,23830,23842,23825,23849,23828,23833,23844,23847, -23831,24034,24120,24118,24115,24119,24247,24248,24246,24245,24254,24373,24375, -24407,24428,24425,24427,24471,24473,24478,24472,24481,24480,24476,24703,24739, -24713,24736,24744,24779,24756,24806,24765,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24773,24763,24757,24796,24764,24792,24789, -24774,24799,24760,24794,24775,25114,25115,25160,25504,25511,25458,25494,25506, -25509,25463,25447,25496,25514,25457,25513,25481,25475,25499,25451,25512,25476, -25480,25497,25505,25516,25490,25487,25472,25467,25449,25448,25466,25949,25942, -25937,25945,25943,21855,25935,25944,25941,25940,26012,26011,26028,26063,26059, -26060,26062,26205,26202,26212,26216,26214,26206,26361,21207,26395,26753,26799, -26786,26771,26805,26751,26742,26801,26791,26775,26800,26755,26820,26797,26758, -26757,26772,26781,26792,26783,26785,26754,27442,27578,27627,27628,27691,28046, -28092,28147,28121,28082,28129,28108,28132,28155,28154,28165,28103,28107,28079, -28113,28078,28126,28153,28088,28151,28149,28101,28114,28186,28085,28122,28139, -28120,28138,28145,28142,28136,28102,28100,28074,28140,28095,28134,28921,28937, -28938,28925,28911,29245,29309,29313,29468,29467,29462,29459,29465,29575,29701, -29706,29699,29702,29694,29709,29920,29942,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29943,29980,29986,30053,30054,30050,30064, -30095,30164,30165,30133,30154,30157,30350,30420,30418,30427,30519,30526,30524, -30518,30520,30522,30827,30787,30798,31077,31080,31085,31227,31378,31381,31520, -31528,31515,31532,31526,31513,31518,31534,31890,31895,31893,32070,32067,32113, -32046,32057,32060,32064,32048,32051,32068,32047,32066,32050,32049,32573,32670, -32666,32716,32718,32722,32796,32842,32838,33071,33046,33059,33067,33065,33072, -33060,33282,33333,33335,33334,33337,33678,33694,33688,33656,33698,33686,33725, -33707,33682,33674,33683,33673,33696,33655,33659,33660,33670,33703,34389,24426, -34503,34496,34486,34500,34485,34502,34507,34481,34479,34505,34899,34974,34952, -34987,34962,34966,34957,34955,35219,35215,35370,35357,35363,35365,35377,35373, -35359,35355,35362,35913,35930,36009,36012,36011,36008,36010,36007,36199,36198, -36286,36282,36571,36575,36889,36877,36890,36887,36899,36895,36893,36880,36885, -36894,36896,36879,36898,36886,36891,36884,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,37096,37101,37117,37207,37326,37365,37350, -37347,37351,37357,37353,38281,38506,38517,38515,38520,38512,38516,38518,38519, -38508,38592,38634,38633,31456,31455,38914,38915,39770,40165,40565,40575,40613, -40635,20642,20621,20613,20633,20625,20608,20630,20632,20634,26368,20977,21106, -21108,21109,21097,21214,21213,21211,21338,21413,21883,21888,21927,21884,21898, -21917,21912,21890,21916,21930,21908,21895,21899,21891,21939,21934,21919,21822, -21938,21914,21947,21932,21937,21886,21897,21931,21913,22285,22575,22570,22580, -22564,22576,22577,22561,22557,22560,22777,22778,22880,23159,23194,23167,23186, -23195,23207,23411,23409,23506,23500,23507,23504,23562,23563,23601,23884,23888, -23860,23879,24061,24133,24125,24128,24131,24190,24266,24257,24258,24260,24380, -24429,24489,24490,24488,24785,24801,24754,24758,24800,24860,24867,24826,24853, -24816,24827,24820,24936,24817,24846,24822,24841,24832,24850,25119,25161,25507, -25484,25551,25536,25577,25545,25542,25549,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25554,25571,25552,25569,25558,25581,25582, -25462,25588,25578,25563,25682,25562,25593,25950,25958,25954,25955,26001,26000, -26031,26222,26224,26228,26230,26223,26257,26234,26238,26231,26366,26367,26399, -26397,26874,26837,26848,26840,26839,26885,26847,26869,26862,26855,26873,26834, -26866,26851,26827,26829,26893,26898,26894,26825,26842,26990,26875,27454,27450, -27453,27544,27542,27580,27631,27694,27695,27692,28207,28216,28244,28193,28210, -28263,28234,28192,28197,28195,28187,28251,28248,28196,28246,28270,28205,28198, -28271,28212,28237,28218,28204,28227,28189,28222,28363,28297,28185,28238,28259, -28228,28274,28265,28255,28953,28954,28966,28976,28961,28982,29038,28956,29260, -29316,29312,29494,29477,29492,29481,29754,29738,29747,29730,29733,29749,29750, -29748,29743,29723,29734,29736,29989,29990,30059,30058,30178,30171,30179,30169, -30168,30174,30176,30331,30332,30358,30355,30388,30428,30543,30701,30813,30828, -30831,31245,31240,31243,31237,31232,31384,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31383,31382,31461,31459,31561,31574,31558, -31568,31570,31572,31565,31563,31567,31569,31903,31909,32094,32080,32104,32085, -32043,32110,32114,32097,32102,32098,32112,32115,21892,32724,32725,32779,32850, -32901,33109,33108,33099,33105,33102,33081,33094,33086,33100,33107,33140,33298, -33308,33769,33795,33784,33805,33760,33733,33803,33729,33775,33777,33780,33879, -33802,33776,33804,33740,33789,33778,33738,33848,33806,33796,33756,33799,33748, -33759,34395,34527,34521,34541,34516,34523,34532,34512,34526,34903,35009,35010, -34993,35203,35222,35387,35424,35413,35422,35388,35393,35412,35419,35408,35398, -35380,35386,35382,35414,35937,35970,36015,36028,36019,36029,36033,36027,36032, -36020,36023,36022,36031,36024,36234,36229,36225,36302,36317,36299,36314,36305, -36300,36315,36294,36603,36600,36604,36764,36910,36917,36913,36920,36914,36918, -37122,37109,37129,37118,37219,37221,37327,37396,37397,37411,37385,37406,37389, -37392,37383,37393,38292,38287,38283,38289,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38291,38290,38286,38538,38542,38539,38525, -38533,38534,38541,38514,38532,38593,38597,38596,38598,38599,38639,38642,38860, -38917,38918,38920,39143,39146,39151,39145,39154,39149,39342,39341,40643,40653, -40657,20098,20653,20661,20658,20659,20677,20670,20652,20663,20667,20655,20679, -21119,21111,21117,21215,21222,21220,21218,21219,21295,21983,21992,21971,21990, -21966,21980,21959,21969,21987,21988,21999,21978,21985,21957,21958,21989,21961, -22290,22291,22622,22609,22616,22615,22618,22612,22635,22604,22637,22602,22626, -22610,22603,22887,23233,23241,23244,23230,23229,23228,23219,23234,23218,23913, -23919,24140,24185,24265,24264,24338,24409,24492,24494,24858,24847,24904,24863, -24819,24859,24825,24833,24840,24910,24908,24900,24909,24894,24884,24871,24845, -24838,24887,25121,25122,25619,25662,25630,25642,25645,25661,25644,25615,25628, -25620,25613,25654,25622,25623,25606,25964,26015,26032,26263,26249,26247,26248, -26262,26244,26264,26253,26371,27028,26989,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,26970,26999,26976,26964,26997,26928,27010, -26954,26984,26987,26974,26963,27001,27014,26973,26979,26971,27463,27506,27584, -27583,27603,27645,28322,28335,28371,28342,28354,28304,28317,28359,28357,28325, -28312,28348,28346,28331,28369,28310,28316,28356,28372,28330,28327,28340,29006, -29017,29033,29028,29001,29031,29020,29036,29030,29004,29029,29022,28998,29032, -29014,29242,29266,29495,29509,29503,29502,29807,29786,29781,29791,29790,29761, -29759,29785,29787,29788,30070,30072,30208,30192,30209,30194,30193,30202,30207, -30196,30195,30430,30431,30555,30571,30566,30558,30563,30585,30570,30572,30556, -30565,30568,30562,30702,30862,30896,30871,30872,30860,30857,30844,30865,30867, -30847,31098,31103,31105,33836,31165,31260,31258,31264,31252,31263,31262,31391, -31392,31607,31680,31584,31598,31591,31921,31923,31925,32147,32121,32145,32129, -32143,32091,32622,32617,32618,32626,32681,32680,32676,32854,32856,32902,32900, -33137,33136,33144,33125,33134,33139,33131,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33145,33146,33126,33285,33351,33922,33911, -33853,33841,33909,33894,33899,33865,33900,33883,33852,33845,33889,33891,33897, -33901,33862,34398,34396,34399,34553,34579,34568,34567,34560,34558,34555,34562, -34563,34566,34570,34905,35039,35028,35033,35036,35032,35037,35041,35018,35029, -35026,35228,35299,35435,35442,35443,35430,35433,35440,35463,35452,35427,35488, -35441,35461,35437,35426,35438,35436,35449,35451,35390,35432,35938,35978,35977, -36042,36039,36040,36036,36018,36035,36034,36037,36321,36319,36328,36335,36339, -36346,36330,36324,36326,36530,36611,36617,36606,36618,36767,36786,36939,36938, -36947,36930,36948,36924,36949,36944,36935,36943,36942,36941,36945,36926,36929, -37138,37143,37228,37226,37225,37321,37431,37463,37432,37437,37440,37438,37467, -37451,37476,37457,37428,37449,37453,37445,37433,37439,37466,38296,38552,38548, -38549,38605,38603,38601,38602,38647,38651,38649,38646,38742,38772,38774,38928, -38929,38931,38922,38930,38924,39164,39156,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,39165,39166,39347,39345,39348,39649,40169, -40578,40718,40723,40736,20711,20718,20709,20694,20717,20698,20693,20687,20689, -20721,20686,20713,20834,20979,21123,21122,21297,21421,22014,22016,22043,22039, -22013,22036,22022,22025,22029,22030,22007,22038,22047,22024,22032,22006,22296, -22294,22645,22654,22659,22675,22666,22649,22661,22653,22781,22821,22818,22820, -22890,22889,23265,23270,23273,23255,23254,23256,23267,23413,23518,23527,23521, -23525,23526,23528,23522,23524,23519,23565,23650,23940,23943,24155,24163,24149, -24151,24148,24275,24278,24330,24390,24432,24505,24903,24895,24907,24951,24930, -24931,24927,24922,24920,24949,25130,25735,25688,25684,25764,25720,25695,25722, -25681,25703,25652,25709,25723,25970,26017,26071,26070,26274,26280,26269,27036, -27048,27029,27073,27054,27091,27083,27035,27063,27067,27051,27060,27088,27085, -27053,27084,27046,27075,27043,27465,27468,27699,28467,28436,28414,28435,28404, -28457,28478,28448,28460,28431,28418,28450,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28415,28399,28422,28465,28472,28466,28451, -28437,28459,28463,28552,28458,28396,28417,28402,28364,28407,29076,29081,29053, -29066,29060,29074,29246,29330,29334,29508,29520,29796,29795,29802,29808,29805, -29956,30097,30247,30221,30219,30217,30227,30433,30435,30596,30589,30591,30561, -30913,30879,30887,30899,30889,30883,31118,31119,31117,31278,31281,31402,31401, -31469,31471,31649,31637,31627,31605,31639,31645,31636,31631,31672,31623,31620, -31929,31933,31934,32187,32176,32156,32189,32190,32160,32202,32180,32178,32177, -32186,32162,32191,32181,32184,32173,32210,32199,32172,32624,32736,32737,32735, -32862,32858,32903,33104,33152,33167,33160,33162,33151,33154,33255,33274,33287, -33300,33310,33355,33993,33983,33990,33988,33945,33950,33970,33948,33995,33976, -33984,34003,33936,33980,34001,33994,34623,34588,34619,34594,34597,34612,34584, -34645,34615,34601,35059,35074,35060,35065,35064,35069,35048,35098,35055,35494, -35468,35486,35491,35469,35489,35475,35492,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,35498,35493,35496,35480,35473,35482,35495, -35946,35981,35980,36051,36049,36050,36203,36249,36245,36348,36628,36626,36629, -36627,36771,36960,36952,36956,36963,36953,36958,36962,36957,36955,37145,37144, -37150,37237,37240,37239,37236,37496,37504,37509,37528,37526,37499,37523,37532, -37544,37500,37521,38305,38312,38313,38307,38309,38308,38553,38556,38555,38604, -38610,38656,38780,38789,38902,38935,38936,39087,39089,39171,39173,39180,39177, -39361,39599,39600,39654,39745,39746,40180,40182,40179,40636,40763,40778,20740, -20736,20731,20725,20729,20738,20744,20745,20741,20956,21127,21128,21129,21133, -21130,21232,21426,22062,22075,22073,22066,22079,22068,22057,22099,22094,22103, -22132,22070,22063,22064,22656,22687,22686,22707,22684,22702,22697,22694,22893, -23305,23291,23307,23285,23308,23304,23534,23532,23529,23531,23652,23653,23965, -23956,24162,24159,24161,24290,24282,24287,24285,24291,24288,24392,24433,24503, -24501,24950,24935,24942,24925,24917,24962,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24956,24944,24939,24958,24999,24976,25003, -24974,25004,24986,24996,24980,25006,25134,25705,25711,25721,25758,25778,25736, -25744,25776,25765,25747,25749,25769,25746,25774,25773,25771,25754,25772,25753, -25762,25779,25973,25975,25976,26286,26283,26292,26289,27171,27167,27112,27137, -27166,27161,27133,27169,27155,27146,27123,27138,27141,27117,27153,27472,27470, -27556,27589,27590,28479,28540,28548,28497,28518,28500,28550,28525,28507,28536, -28526,28558,28538,28528,28516,28567,28504,28373,28527,28512,28511,29087,29100, -29105,29096,29270,29339,29518,29527,29801,29835,29827,29822,29824,30079,30240, -30249,30239,30244,30246,30241,30242,30362,30394,30436,30606,30599,30604,30609, -30603,30923,30917,30906,30922,30910,30933,30908,30928,31295,31292,31296,31293, -31287,31291,31407,31406,31661,31665,31684,31668,31686,31687,31681,31648,31692, -31946,32224,32244,32239,32251,32216,32236,32221,32232,32227,32218,32222,32233, -32158,32217,32242,32249,32629,32631,32687,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,32745,32806,33179,33180,33181,33184,33178, -33176,34071,34109,34074,34030,34092,34093,34067,34065,34083,34081,34068,34028, -34085,34047,34054,34690,34676,34678,34656,34662,34680,34664,34649,34647,34636, -34643,34907,34909,35088,35079,35090,35091,35093,35082,35516,35538,35527,35524, -35477,35531,35576,35506,35529,35522,35519,35504,35542,35533,35510,35513,35547, -35916,35918,35948,36064,36062,36070,36068,36076,36077,36066,36067,36060,36074, -36065,36205,36255,36259,36395,36368,36381,36386,36367,36393,36383,36385,36382, -36538,36637,36635,36639,36649,36646,36650,36636,36638,36645,36969,36974,36968, -36973,36983,37168,37165,37159,37169,37255,37257,37259,37251,37573,37563,37559, -37610,37548,37604,37569,37555,37564,37586,37575,37616,37554,38317,38321,38660, -38662,38663,38665,38752,38797,38795,38799,38945,38955,38940,39091,39178,39187, -39186,39192,39389,39376,39391,39387,39377,39381,39378,39385,39607,39662,39663, -39719,39749,39748,39799,39791,40198,40201,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40195,40617,40638,40654,22696,40786,20754, -20760,20756,20752,20757,20864,20906,20957,21137,21139,21235,22105,22123,22137, -22121,22116,22136,22122,22120,22117,22129,22127,22124,22114,22134,22721,22718, -22727,22725,22894,23325,23348,23416,23536,23566,24394,25010,24977,25001,24970, -25037,25014,25022,25034,25032,25136,25797,25793,25803,25787,25788,25818,25796, -25799,25794,25805,25791,25810,25812,25790,25972,26310,26313,26297,26308,26311, -26296,27197,27192,27194,27225,27243,27224,27193,27204,27234,27233,27211,27207, -27189,27231,27208,27481,27511,27653,28610,28593,28577,28611,28580,28609,28583, -28595,28608,28601,28598,28582,28576,28596,29118,29129,29136,29138,29128,29141, -29113,29134,29145,29148,29123,29124,29544,29852,29859,29848,29855,29854,29922, -29964,29965,30260,30264,30266,30439,30437,30624,30622,30623,30629,30952,30938, -30956,30951,31142,31309,31310,31302,31308,31307,31418,31705,31761,31689,31716, -31707,31713,31721,31718,31957,31958,32266,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,32273,32264,32283,32291,32286,32285,32265, -32272,32633,32690,32752,32753,32750,32808,33203,33193,33192,33275,33288,33368, -33369,34122,34137,34120,34152,34153,34115,34121,34157,34154,34142,34691,34719, -34718,34722,34701,34913,35114,35122,35109,35115,35105,35242,35238,35558,35578, -35563,35569,35584,35548,35559,35566,35582,35585,35586,35575,35565,35571,35574, -35580,35947,35949,35987,36084,36420,36401,36404,36418,36409,36405,36667,36655, -36664,36659,36776,36774,36981,36980,36984,36978,36988,36986,37172,37266,37664, -37686,37624,37683,37679,37666,37628,37675,37636,37658,37648,37670,37665,37653, -37678,37657,38331,38567,38568,38570,38613,38670,38673,38678,38669,38675,38671, -38747,38748,38758,38808,38960,38968,38971,38967,38957,38969,38948,39184,39208, -39198,39195,39201,39194,39405,39394,39409,39608,39612,39675,39661,39720,39825, -40213,40227,40230,40232,40210,40219,40664,40660,40845,40860,20778,20767,20769, -20786,21237,22158,22144,22160,22149,22151,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22159,22741,22739,22737,22734,23344,23338, -23332,23418,23607,23656,23996,23994,23997,23992,24171,24396,24509,25033,25026, -25031,25062,25035,25138,25140,25806,25802,25816,25824,25840,25830,25836,25841, -25826,25837,25986,25987,26329,26326,27264,27284,27268,27298,27292,27355,27299, -27262,27287,27280,27296,27484,27566,27610,27656,28632,28657,28639,28640,28635, -28644,28651,28655,28544,28652,28641,28649,28629,28654,28656,29159,29151,29166, -29158,29157,29165,29164,29172,29152,29237,29254,29552,29554,29865,29872,29862, -29864,30278,30274,30284,30442,30643,30634,30640,30636,30631,30637,30703,30967, -30970,30964,30959,30977,31143,31146,31319,31423,31751,31757,31742,31735,31756, -31712,31968,31964,31966,31970,31967,31961,31965,32302,32318,32326,32311,32306, -32323,32299,32317,32305,32325,32321,32308,32313,32328,32309,32319,32303,32580, -32755,32764,32881,32882,32880,32879,32883,33222,33219,33210,33218,33216,33215, -33213,33225,33214,33256,33289,33393,34218,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34180,34174,34204,34193,34196,34223,34203, -34183,34216,34186,34407,34752,34769,34739,34770,34758,34731,34747,34746,34760, -34763,35131,35126,35140,35128,35133,35244,35598,35607,35609,35611,35594,35616, -35613,35588,35600,35905,35903,35955,36090,36093,36092,36088,36091,36264,36425, -36427,36424,36426,36676,36670,36674,36677,36671,36991,36989,36996,36993,36994, -36992,37177,37283,37278,37276,37709,37762,37672,37749,37706,37733,37707,37656, -37758,37740,37723,37744,37722,37716,38346,38347,38348,38344,38342,38577,38584, -38614,38684,38686,38816,38867,38982,39094,39221,39425,39423,39854,39851,39850, -39853,40251,40255,40587,40655,40670,40668,40669,40667,40766,40779,21474,22165, -22190,22745,22744,23352,24413,25059,25139,25844,25842,25854,25862,25850,25851, -25847,26039,26332,26406,27315,27308,27331,27323,27320,27330,27310,27311,27487, -27512,27567,28681,28683,28670,28678,28666,28689,28687,29179,29180,29182,29176, -29559,29557,29863,29887,29973,30294,30296,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30290,30653,30655,30651,30652,30990,31150, -31329,31330,31328,31428,31429,31787,31783,31786,31774,31779,31777,31975,32340, -32341,32350,32346,32353,32338,32345,32584,32761,32763,32887,32886,33229,33231, -33290,34255,34217,34253,34256,34249,34224,34234,34233,34214,34799,34796,34802, -34784,35206,35250,35316,35624,35641,35628,35627,35920,36101,36441,36451,36454, -36452,36447,36437,36544,36681,36685,36999,36995,37000,37291,37292,37328,37780, -37770,37782,37794,37811,37806,37804,37808,37784,37786,37783,38356,38358,38352, -38357,38626,38620,38617,38619,38622,38692,38819,38822,38829,38905,38989,38991, -38988,38990,38995,39098,39230,39231,39229,39214,39333,39438,39617,39683,39686, -39759,39758,39757,39882,39881,39933,39880,39872,40273,40285,40288,40672,40725, -40748,20787,22181,22750,22751,22754,23541,40848,24300,25074,25079,25078,25077, -25856,25871,26336,26333,27365,27357,27354,27347,28699,28703,28712,28698,28701, -28693,28696,29190,29197,29272,29346,29560,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29562,29885,29898,29923,30087,30086,30303, -30305,30663,31001,31153,31339,31337,31806,31807,31800,31805,31799,31808,32363, -32365,32377,32361,32362,32645,32371,32694,32697,32696,33240,34281,34269,34282, -34261,34276,34277,34295,34811,34821,34829,34809,34814,35168,35167,35158,35166, -35649,35676,35672,35657,35674,35662,35663,35654,35673,36104,36106,36476,36466, -36487,36470,36460,36474,36468,36692,36686,36781,37002,37003,37297,37294,37857, -37841,37855,37827,37832,37852,37853,37846,37858,37837,37848,37860,37847,37864, -38364,38580,38627,38698,38695,38753,38876,38907,39006,39000,39003,39100,39237, -39241,39446,39449,39693,39912,39911,39894,39899,40329,40289,40306,40298,40300, -40594,40599,40595,40628,21240,22184,22199,22198,22196,22204,22756,23360,23363, -23421,23542,24009,25080,25082,25880,25876,25881,26342,26407,27372,28734,28720, -28722,29200,29563,29903,30306,30309,31014,31018,31020,31019,31431,31478,31820, -31811,31821,31983,31984,36782,32381,32380,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,32386,32588,32768,33242,33382,34299,34297, -34321,34298,34310,34315,34311,34314,34836,34837,35172,35258,35320,35696,35692, -35686,35695,35679,35691,36111,36109,36489,36481,36485,36482,37300,37323,37912, -37891,37885,38369,38704,39108,39250,39249,39336,39467,39472,39479,39477,39955, -39949,40569,40629,40680,40751,40799,40803,40801,20791,20792,22209,22208,22210, -22804,23660,24013,25084,25086,25885,25884,26005,26345,27387,27396,27386,27570, -28748,29211,29351,29910,29908,30313,30675,31824,32399,32396,32700,34327,34349, -34330,34851,34850,34849,34847,35178,35180,35261,35700,35703,35709,36115,36490, -36493,36491,36703,36783,37306,37934,37939,37941,37946,37944,37938,37931,38370, -38712,38713,38706,38911,39015,39013,39255,39493,39491,39488,39486,39631,39764, -39761,39981,39973,40367,40372,40386,40376,40605,40687,40729,40796,40806,40807, -20796,20795,22216,22218,22217,23423,24020,24018,24398,25087,25892,27402,27489, -28753,28760,29568,29924,30090,30318,30316,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31155,31840,31839,32894,32893,33247,35186, -35183,35324,35712,36118,36119,36497,36499,36705,37192,37956,37969,37970,38717, -38718,38851,38849,39019,39253,39509,39501,39634,39706,40009,39985,39998,39995, -40403,40407,40756,40812,40810,40852,22220,24022,25088,25891,25899,25898,26348, -27408,29914,31434,31844,31843,31845,32403,32406,32404,33250,34360,34367,34865, -35722,37008,37007,37987,37984,37988,38760,39023,39260,39514,39515,39511,39635, -39636,39633,40020,40023,40022,40421,40607,40692,22225,22761,25900,28766,30321, -30322,30679,32592,32648,34870,34873,34914,35731,35730,35734,33399,36123,37312, -37994,38722,38728,38724,38854,39024,39519,39714,39768,40031,40441,40442,40572, -40573,40711,40823,40818,24307,27414,28771,31852,31854,34875,35264,36513,37313, -38002,38000,39025,39262,39638,39715,40652,28772,30682,35738,38007,38857,39522, -39525,32412,35740,36522,37317,38013,38014,38012,40055,40056,40695,35924,38015, -40474,29224,39530,39729,40475,40478,31858,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12542,12445,12446,12293,12353,12354,12355, -12356,12357,12358,12359,12360,12361,12362,12363,12364,12365,12366,12367,12368, -12369,12370,12371,12372,12373,12374,12375,12376,12377,12378,12379,12380,12381, -12382,12383,12384,12385,12386,12387,12388,12389,12390,12391,12392,12393,12394, -12395,12396,12397,12398,12399,12400,12401,12402,12403,12404,12405,12406,12407, -12408,12409,12410,12411,12412,12413,12414,12415,12416,12417,12418,12419,12420, -12421,12422,12423,12424,12425,12426,12427,12428,12429,12430,12431,12432,12433, -12434,12435,12449,12450,12451,12452,12453,12454,12455,12456,12457,12458,12459, -12460,12461,12462,12463,12464,12465,12466,12467,12468,12469,12470,12471,12472, -12473,12474,12475,12476,12477,12478,12479,12480,12481,12482,12483,12484,12485, -12486,12487,12488,12489,12490,12491,12492,12493,12494,12495,12496,12497,12498, -12499,12500,12501,12502,12503,12504,12505,12506,12507,12508,12509,12510,12511, -12512,12513,12514,12515,12516,12517,12518,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,12519,12520,12521,12522,12523,12524,12525, -12526,12527,12528,12529,12530,12531,12532,12533,12534,1044,1045,1025,1046, -1047,1048,1049,1050,1051,1052,1059,1060,1061,1062,1063,1064,1065,1066,1067, -1068,1069,1070,1071,1072,1073,1074,1075,1076,1077,1105,1078,1079,1080,1081, -1082,1083,1084,1085,1086,1087,1088,1089,1090,1091,1092,1093,1094,1095,1096, -1097,1098,1099,1100,1101,1102,1103,9312,9313,9314,9315,9316,9317,9318,9319, -9320,9321,9332,9333,9334,9335,9336,9337,9338,9339,9340,9341,20034,20060,20981, -21274,21378,19975,19980,20039,20109,22231,64012,23662,24435,19983,20871,19982, -20014,20115,20162,20169,20168,20888,21244,21356,21433,22304,22787,22828,23568, -24063,26081,27571,27596,27668,29247,20017,20028,20200,20188,20201,20193,20189, -20186,21004,21276,21324,22306,22307,22807,22831,23425,23428,23570,23611,23668, -23667,24068,24192,24194,24521,25097,25168,27669,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,27702,27715,27711,27707,29358,29360, -29578,31160,32906,38430,20238,20248,20268,20213,20244,20209,20224,20215,20232, -20253,20226,20229,20258,20243,20228,20212,20242,20913,21011,21001,21008,21158, -21282,21279,21325,21386,21511,22241,22239,22318,22314,22324,22844,22912,22908, -22917,22907,22910,22903,22911,23382,23573,23589,23676,23674,23675,23678,24031, -24181,24196,24322,24346,24436,24533,24532,24527,25180,25182,25188,25185,25190, -25186,25177,25184,25178,25189,26095,26094,26430,26425,26424,26427,26426,26431, -26428,26419,27672,27718,27730,27740,27727,27722,27732,27723,27724,28785,29278, -29364,29365,29582,29994,30335,31349,32593,33400,33404,33408,33405,33407,34381, -35198,37017,37015,37016,37019,37012,38434,38436,38432,38435,20310,20283,20322, -20297,20307,20324,20286,20327,20306,20319,20289,20312,20269,20275,20287,20321, -20879,20921,21020,21022,21025,21165,21166,21257,21347,21362,21390,21391,21552, -21559,21546,21588,21573,21529,21532,21541,21528,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,21565,21583,21569,21544,21540,21575, -22254,22247,22245,22337,22341,22348,22345,22347,22354,22790,22848,22950,22936, -22944,22935,22926,22946,22928,22927,22951,22945,23438,23442,23592,23594,23693, -23695,23688,23691,23689,23698,23690,23686,23699,23701,24032,24074,24078,24203, -24201,24204,24200,24205,24325,24349,24440,24438,24530,24529,24528,24557,24552, -24558,24563,24545,24548,24547,24570,24559,24567,24571,24576,24564,25146,25219, -25228,25230,25231,25236,25223,25201,25211,25210,25200,25217,25224,25207,25213, -25202,25204,25911,26096,26100,26099,26098,26101,26437,26439,26457,26453,26444, -26440,26461,26445,26458,26443,27600,27673,27674,27768,27751,27755,27780,27787, -27791,27761,27759,27753,27802,27757,27783,27797,27804,27750,27763,27749,27771, -27790,28788,28794,29283,29375,29373,29379,29382,29377,29370,29381,29589,29591, -29587,29588,29586,30010,30009,30100,30101,30337,31037,32820,32917,32921,32912, -32914,32924,33424,33423,33413,33422,33425,33427,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33418,33411,33412,35960,36809,36799, -37023,37025,37029,37022,37031,37024,38448,38440,38447,38445,20019,20376,20348, -20357,20349,20352,20359,20342,20340,20361,20356,20343,20300,20375,20330,20378, -20345,20353,20344,20368,20380,20372,20382,20370,20354,20373,20331,20334,20894, -20924,20926,21045,21042,21043,21062,21041,21180,21258,21259,21308,21394,21396, -21639,21631,21633,21649,21634,21640,21611,21626,21630,21605,21612,21620,21606, -21645,21615,21601,21600,21656,21603,21607,21604,22263,22265,22383,22386,22381, -22379,22385,22384,22390,22400,22389,22395,22387,22388,22370,22376,22397,22796, -22853,22965,22970,22991,22990,22962,22988,22977,22966,22972,22979,22998,22961, -22973,22976,22984,22964,22983,23394,23397,23443,23445,23620,23623,23726,23716, -23712,23733,23727,23720,23724,23711,23715,23725,23714,23722,23719,23709,23717, -23734,23728,23718,24087,24084,24089,24360,24354,24355,24356,24404,24450,24446, -24445,24542,24549,24621,24614,24601,24626,24587,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24628,24586,24599,24627,24602,24606, -24620,24610,24589,24592,24622,24595,24593,24588,24585,24604,25108,25149,25261, -25268,25297,25278,25258,25270,25290,25262,25267,25263,25275,25257,25264,25272, -25917,26024,26043,26121,26108,26116,26130,26120,26107,26115,26123,26125,26117, -26109,26129,26128,26358,26378,26501,26476,26510,26514,26486,26491,26520,26502, -26500,26484,26509,26508,26490,26527,26513,26521,26499,26493,26497,26488,26489, -26516,27429,27520,27518,27614,27677,27795,27884,27883,27886,27865,27830,27860, -27821,27879,27831,27856,27842,27834,27843,27846,27885,27890,27858,27869,27828, -27786,27805,27776,27870,27840,27952,27853,27847,27824,27897,27855,27881,27857, -28820,28824,28805,28819,28806,28804,28817,28822,28802,28826,28803,29290,29398, -29387,29400,29385,29404,29394,29396,29402,29388,29393,29604,29601,29613,29606, -29602,29600,29612,29597,29917,29928,30015,30016,30014,30092,30104,30383,30451, -30449,30448,30453,30712,30716,30713,30715,30714,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30711,31042,31039,31173,31352,31355, -31483,31861,31997,32821,32911,32942,32931,32952,32949,32941,33312,33440,33472, -33451,33434,33432,33435,33461,33447,33454,33468,33438,33466,33460,33448,33441, -33449,33474,33444,33475,33462,33442,34416,34415,34413,34414,35926,36818,36811, -36819,36813,36822,36821,36823,37042,37044,37039,37043,37040,38457,38461,38460, -38458,38467,20429,20421,20435,20402,20425,20427,20417,20436,20444,20441,20411, -20403,20443,20423,20438,20410,20416,20409,20460,21060,21065,21184,21186,21309, -21372,21399,21398,21401,21400,21690,21665,21677,21669,21711,21699,33549,21687, -21678,21718,21686,21701,21702,21664,21616,21692,21666,21694,21618,21726,21680, -22453,22430,22431,22436,22412,22423,22429,22427,22420,22424,22415,22425,22437, -22426,22421,22772,22797,22867,23009,23006,23022,23040,23025,23005,23034,23037, -23036,23030,23012,23026,23031,23003,23017,23027,23029,23008,23038,23028,23021, -23464,23628,23760,23768,23756,23767,23755,23771,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23774,23770,23753,23751,23754,23766, -23763,23764,23759,23752,23750,23758,23775,23800,24057,24097,24098,24099,24096, -24100,24240,24228,24226,24219,24227,24229,24327,24366,24406,24454,24631,24633, -24660,24690,24670,24645,24659,24647,24649,24667,24652,24640,24642,24671,24612, -24644,24664,24678,24686,25154,25155,25295,25357,25355,25333,25358,25347,25323, -25337,25359,25356,25336,25334,25344,25363,25364,25338,25365,25339,25328,25921, -25923,26026,26047,26166,26145,26162,26165,26140,26150,26146,26163,26155,26170, -26141,26164,26169,26158,26383,26384,26561,26610,26568,26554,26588,26555,26616, -26584,26560,26551,26565,26603,26596,26591,26549,26573,26547,26615,26614,26606, -26595,26562,26553,26574,26599,26608,26546,26620,26566,26605,26572,26542,26598, -26587,26618,26569,26570,26563,26602,26571,27432,27522,27524,27574,27606,27608, -27616,27680,27681,27944,27956,27949,27935,27964,27967,27922,27914,27866,27955, -27908,27929,27962,27930,27921,27904,27933,27970,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,27905,27928,27959,27907,27919,27968, -27911,27936,27948,27912,27938,27913,27920,28855,28831,28862,28849,28848,28833, -28852,28853,28841,29249,29257,29258,29292,29296,29299,29294,29386,29412,29416, -29419,29407,29418,29414,29411,29573,29644,29634,29640,29637,29625,29622,29621, -29620,29675,29631,29639,29630,29635,29638,29624,29643,29932,29934,29998,30023, -30024,30119,30122,30329,30404,30472,30467,30468,30469,30474,30455,30459,30458, -30695,30696,30726,30737,30738,30725,30736,30735,30734,30729,30723,30739,31050, -31052,31051,31045,31044,31189,31181,31183,31190,31182,31360,31358,31441,31488, -31489,31866,31864,31865,31871,31872,31873,32003,32008,32001,32600,32657,32653, -32702,32775,32782,32783,32788,32823,32984,32967,32992,32977,32968,32962,32976, -32965,32995,32985,32988,32970,32981,32969,32975,32983,32998,32973,33279,33313, -33428,33497,33534,33529,33543,33512,33536,33493,33594,33515,33494,33524,33516, -33505,33522,33525,33548,33531,33526,33520,33514,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33508,33504,33530,33523,33517,34423, -34420,34428,34419,34881,34894,34919,34922,34921,35283,35332,35335,36210,36835, -36833,36846,36832,37105,37053,37055,37077,37061,37054,37063,37067,37064,37332, -37331,38484,38479,38481,38483,38474,38478,20510,20485,20487,20499,20514,20528, -20507,20469,20468,20531,20535,20524,20470,20471,20503,20508,20512,20519,20533, -20527,20529,20494,20826,20884,20883,20938,20932,20933,20936,20942,21089,21082, -21074,21086,21087,21077,21090,21197,21262,21406,21798,21730,21783,21778,21735, -21747,21732,21786,21759,21764,21768,21739,21777,21765,21745,21770,21755,21751, -21752,21728,21774,21763,21771,22273,22274,22476,22578,22485,22482,22458,22470, -22461,22460,22456,22454,22463,22471,22480,22457,22465,22798,22858,23065,23062, -23085,23086,23061,23055,23063,23050,23070,23091,23404,23463,23469,23468,23555, -23638,23636,23788,23807,23790,23793,23799,23808,23801,24105,24104,24232,24238, -24234,24236,24371,24368,24423,24669,24666,24679,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24641,24738,24712,24704,24722,24705, -24733,24707,24725,24731,24727,24711,24732,24718,25113,25158,25330,25360,25430, -25388,25412,25413,25398,25411,25572,25401,25419,25418,25404,25385,25409,25396, -25432,25428,25433,25389,25415,25395,25434,25425,25400,25431,25408,25416,25930, -25926,26054,26051,26052,26050,26186,26207,26183,26193,26386,26387,26655,26650, -26697,26674,26675,26683,26699,26703,26646,26673,26652,26677,26667,26669,26671, -26702,26692,26676,26653,26642,26644,26662,26664,26670,26701,26682,26661,26656, -27436,27439,27437,27441,27444,27501,32898,27528,27622,27620,27624,27619,27618, -27623,27685,28026,28003,28004,28022,27917,28001,28050,27992,28002,28013,28015, -28049,28045,28143,28031,28038,27998,28007,28000,28055,28016,28028,27999,28034, -28056,27951,28008,28043,28030,28032,28036,27926,28035,28027,28029,28021,28048, -28892,28883,28881,28893,28875,32569,28898,28887,28882,28894,28896,28884,28877, -28869,28870,28871,28890,28878,28897,29250,29304,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29303,29302,29440,29434,29428,29438, -29430,29427,29435,29441,29651,29657,29669,29654,29628,29671,29667,29673,29660, -29650,29659,29652,29661,29658,29655,29656,29672,29918,29919,29940,29941,29985, -30043,30047,30128,30145,30139,30148,30144,30143,30134,30138,30346,30409,30493, -30491,30480,30483,30482,30499,30481,30485,30489,30490,30498,30503,30755,30764, -30754,30773,30767,30760,30766,30763,30753,30761,30771,30762,30769,31060,31067, -31055,31068,31059,31058,31057,31211,31212,31200,31214,31213,31210,31196,31198, -31197,31366,31369,31365,31371,31372,31370,31367,31448,31504,31492,31507,31493, -31503,31496,31498,31502,31497,31506,31876,31889,31882,31884,31880,31885,31877, -32030,32029,32017,32014,32024,32022,32019,32031,32018,32015,32012,32604,32609, -32606,32608,32605,32603,32662,32658,32707,32706,32704,32790,32830,32825,33018, -33010,33017,33013,33025,33019,33024,33281,33327,33317,33587,33581,33604,33561, -33617,33573,33622,33599,33601,33574,33564,33570,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33602,33614,33563,33578,33544,33596, -33613,33558,33572,33568,33591,33583,33577,33607,33605,33612,33619,33566,33580, -33611,33575,33608,34387,34386,34466,34472,34454,34445,34449,34462,34439,34455, -34438,34443,34458,34437,34469,34457,34465,34471,34453,34456,34446,34461,34448, -34452,34883,34884,34925,34933,34934,34930,34944,34929,34943,34927,34947,34942, -34932,34940,35346,35911,35927,35963,36004,36003,36214,36216,36277,36279,36278, -36561,36563,36862,36853,36866,36863,36859,36868,36860,36854,37078,37088,37081, -37082,37091,37087,37093,37080,37083,37079,37084,37092,37200,37198,37199,37333, -37346,37338,38492,38495,38588,39139,39647,39727,20095,20592,20586,20577,20574, -20576,20563,20555,20573,20594,20552,20557,20545,20571,20554,20578,20501,20549, -20575,20585,20587,20579,20580,20550,20544,20590,20595,20567,20561,20944,21099, -21101,21100,21102,21206,21203,21293,21404,21877,21878,21820,21837,21840,21812, -21802,21841,21858,21814,21813,21808,21842,21829,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,21772,21810,21861,21838,21817,21832, -21805,21819,21824,21835,22282,22279,22523,22548,22498,22518,22492,22516,22528, -22509,22525,22536,22520,22539,22515,22479,22535,22510,22499,22514,22501,22508, -22497,22542,22524,22544,22503,22529,22540,22513,22505,22512,22541,22532,22876, -23136,23128,23125,23143,23134,23096,23093,23149,23120,23135,23141,23148,23123, -23140,23127,23107,23133,23122,23108,23131,23112,23182,23102,23117,23097,23116, -23152,23145,23111,23121,23126,23106,23132,23410,23406,23489,23488,23641,23838, -23819,23837,23834,23840,23820,23848,23821,23846,23845,23823,23856,23826,23843, -23839,23854,24126,24116,24241,24244,24249,24242,24243,24374,24376,24475,24470, -24479,24714,24720,24710,24766,24752,24762,24787,24788,24783,24804,24793,24797, -24776,24753,24795,24759,24778,24767,24771,24781,24768,25394,25445,25482,25474, -25469,25533,25502,25517,25501,25495,25515,25486,25455,25479,25488,25454,25519, -25461,25500,25453,25518,25468,25508,25403,25503,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25464,25477,25473,25489,25485,25456, -25939,26061,26213,26209,26203,26201,26204,26210,26392,26745,26759,26768,26780, -26733,26734,26798,26795,26966,26735,26787,26796,26793,26741,26740,26802,26767, -26743,26770,26748,26731,26738,26794,26752,26737,26750,26779,26774,26763,26784, -26761,26788,26744,26747,26769,26764,26762,26749,27446,27443,27447,27448,27537, -27535,27533,27534,27532,27690,28096,28075,28084,28083,28276,28076,28137,28130, -28087,28150,28116,28160,28104,28128,28127,28118,28094,28133,28124,28125,28123, -28148,28106,28093,28141,28144,28090,28117,28098,28111,28105,28112,28146,28115, -28157,28119,28109,28131,28091,28922,28941,28919,28951,28916,28940,28912,28932, -28915,28944,28924,28927,28934,28947,28928,28920,28918,28939,28930,28942,29310, -29307,29308,29311,29469,29463,29447,29457,29464,29450,29448,29439,29455,29470, -29576,29686,29688,29685,29700,29697,29693,29703,29696,29690,29692,29695,29708, -29707,29684,29704,30052,30051,30158,30162,30159,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30155,30156,30161,30160,30351,30345, -30419,30521,30511,30509,30513,30514,30516,30515,30525,30501,30523,30517,30792, -30802,30793,30797,30794,30796,30758,30789,30800,31076,31079,31081,31082,31075, -31083,31073,31163,31226,31224,31222,31223,31375,31380,31376,31541,31559,31540, -31525,31536,31522,31524,31539,31512,31530,31517,31537,31531,31533,31535,31538, -31544,31514,31523,31892,31896,31894,31907,32053,32061,32056,32054,32058,32069, -32044,32041,32065,32071,32062,32063,32074,32059,32040,32611,32661,32668,32669, -32667,32714,32715,32717,32720,32721,32711,32719,32713,32799,32798,32795,32839, -32835,32840,33048,33061,33049,33051,33069,33055,33068,33054,33057,33045,33063, -33053,33058,33297,33336,33331,33338,33332,33330,33396,33680,33699,33704,33677, -33658,33651,33700,33652,33679,33665,33685,33689,33653,33684,33705,33661,33667, -33676,33693,33691,33706,33675,33662,33701,33711,33672,33687,33712,33663,33702, -33671,33710,33654,33690,34393,34390,34495,34487,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34498,34497,34501,34490,34480,34504, -34489,34483,34488,34508,34484,34491,34492,34499,34493,34494,34898,34953,34965, -34984,34978,34986,34970,34961,34977,34975,34968,34983,34969,34971,34967,34980, -34988,34956,34963,34958,35202,35286,35289,35285,35376,35367,35372,35358,35897, -35899,35932,35933,35965,36005,36221,36219,36217,36284,36290,36281,36287,36289, -36568,36574,36573,36572,36567,36576,36577,36900,36875,36881,36892,36876,36897, -37103,37098,37104,37108,37106,37107,37076,37099,37100,37097,37206,37208,37210, -37203,37205,37356,37364,37361,37363,37368,37348,37369,37354,37355,37367,37352, -37358,38266,38278,38280,38524,38509,38507,38513,38511,38591,38762,38916,39141, -39319,20635,20629,20628,20638,20619,20643,20611,20620,20622,20637,20584,20636, -20626,20610,20615,20831,20948,21266,21265,21412,21415,21905,21928,21925,21933, -21879,22085,21922,21907,21896,21903,21941,21889,21923,21906,21924,21885,21900, -21926,21887,21909,21921,21902,22284,22569,22583,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,22553,22558,22567,22563,22568,22517, -22600,22565,22556,22555,22579,22591,22582,22574,22585,22584,22573,22572,22587, -22881,23215,23188,23199,23162,23202,23198,23160,23206,23164,23205,23212,23189, -23214,23095,23172,23178,23191,23171,23179,23209,23163,23165,23180,23196,23183, -23187,23197,23530,23501,23499,23508,23505,23498,23502,23564,23600,23863,23875, -23915,23873,23883,23871,23861,23889,23886,23893,23859,23866,23890,23869,23857, -23897,23874,23865,23881,23864,23868,23858,23862,23872,23877,24132,24129,24408, -24486,24485,24491,24777,24761,24780,24802,24782,24772,24852,24818,24842,24854, -24837,24821,24851,24824,24828,24830,24769,24835,24856,24861,24848,24831,24836, -24843,25162,25492,25521,25520,25550,25573,25576,25583,25539,25757,25587,25546, -25568,25590,25557,25586,25589,25697,25567,25534,25565,25564,25540,25560,25555, -25538,25543,25548,25547,25544,25584,25559,25561,25906,25959,25962,25956,25948, -25960,25957,25996,26013,26014,26030,26064,26066,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,26236,26220,26235,26240,26225,26233, -26218,26226,26369,26892,26835,26884,26844,26922,26860,26858,26865,26895,26838, -26871,26859,26852,26870,26899,26896,26867,26849,26887,26828,26888,26992,26804, -26897,26863,26822,26900,26872,26832,26877,26876,26856,26891,26890,26903,26830, -26824,26845,26846,26854,26868,26833,26886,26836,26857,26901,26917,26823,27449, -27451,27455,27452,27540,27543,27545,27541,27581,27632,27634,27635,27696,28156, -28230,28231,28191,28233,28296,28220,28221,28229,28258,28203,28223,28225,28253, -28275,28188,28211,28235,28224,28241,28219,28163,28206,28254,28264,28252,28257, -28209,28200,28256,28273,28267,28217,28194,28208,28243,28261,28199,28280,28260, -28279,28245,28281,28242,28262,28213,28214,28250,28960,28958,28975,28923,28974, -28977,28963,28965,28962,28978,28959,28968,28986,28955,29259,29274,29320,29321, -29318,29317,29323,29458,29451,29488,29474,29489,29491,29479,29490,29485,29478, -29475,29493,29452,29742,29740,29744,29739,29718,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29722,29729,29741,29745,29732,29731, -29725,29737,29728,29746,29947,29999,30063,30060,30183,30170,30177,30182,30173, -30175,30180,30167,30357,30354,30426,30534,30535,30532,30541,30533,30538,30542, -30539,30540,30686,30700,30816,30820,30821,30812,30829,30833,30826,30830,30832, -30825,30824,30814,30818,31092,31091,31090,31088,31234,31242,31235,31244,31236, -31385,31462,31460,31562,31547,31556,31560,31564,31566,31552,31576,31557,31906, -31902,31912,31905,32088,32111,32099,32083,32086,32103,32106,32079,32109,32092, -32107,32082,32084,32105,32081,32095,32078,32574,32575,32613,32614,32674,32672, -32673,32727,32849,32847,32848,33022,32980,33091,33098,33106,33103,33095,33085, -33101,33082,33254,33262,33271,33272,33273,33284,33340,33341,33343,33397,33595, -33743,33785,33827,33728,33768,33810,33767,33764,33788,33782,33808,33734,33736, -33771,33763,33727,33793,33757,33765,33752,33791,33761,33739,33742,33750,33781, -33737,33801,33807,33758,33809,33798,33730,33779,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33749,33786,33735,33745,33770,33811, -33731,33772,33774,33732,33787,33751,33762,33819,33755,33790,34520,34530,34534, -34515,34531,34522,34538,34525,34539,34524,34540,34537,34519,34536,34513,34888, -34902,34901,35002,35031,35001,35000,35008,35006,34998,35004,34999,35005,34994, -35073,35017,35221,35224,35223,35293,35290,35291,35406,35405,35385,35417,35392, -35415,35416,35396,35397,35410,35400,35409,35402,35404,35407,35935,35969,35968, -36026,36030,36016,36025,36021,36228,36224,36233,36312,36307,36301,36295,36310, -36316,36303,36309,36313,36296,36311,36293,36591,36599,36602,36601,36582,36590, -36581,36597,36583,36584,36598,36587,36593,36588,36596,36585,36909,36916,36911, -37126,37164,37124,37119,37116,37128,37113,37115,37121,37120,37127,37125,37123, -37217,37220,37215,37218,37216,37377,37386,37413,37379,37402,37414,37391,37388, -37376,37394,37375,37373,37382,37380,37415,37378,37404,37412,37401,37399,37381, -37398,38267,38285,38284,38288,38535,38526,38536,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38537,38531,38528,38594,38600,38595, -38641,38640,38764,38768,38766,38919,39081,39147,40166,40697,20099,20100,20150, -20669,20671,20678,20654,20676,20682,20660,20680,20674,20656,20673,20666,20657, -20683,20681,20662,20664,20951,21114,21112,21115,21116,21955,21979,21964,21968, -21963,21962,21981,21952,21972,21956,21993,21951,21970,21901,21967,21973,21986, -21974,21960,22002,21965,21977,21954,22292,22611,22632,22628,22607,22605,22601, -22639,22613,22606,22621,22617,22629,22619,22589,22627,22641,22780,23239,23236, -23243,23226,23224,23217,23221,23216,23231,23240,23227,23238,23223,23232,23242, -23220,23222,23245,23225,23184,23510,23512,23513,23583,23603,23921,23907,23882, -23909,23922,23916,23902,23912,23911,23906,24048,24143,24142,24138,24141,24139, -24261,24268,24262,24267,24263,24384,24495,24493,24823,24905,24906,24875,24901, -24886,24882,24878,24902,24879,24911,24873,24896,25120,37224,25123,25125,25124, -25541,25585,25579,25616,25618,25609,25632,25636,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25651,25667,25631,25621,25624,25657, -25655,25634,25635,25612,25638,25648,25640,25665,25653,25647,25610,25626,25664, -25637,25639,25611,25575,25627,25646,25633,25614,25967,26002,26067,26246,26252, -26261,26256,26251,26250,26265,26260,26232,26400,26982,26975,26936,26958,26978, -26993,26943,26949,26986,26937,26946,26967,26969,27002,26952,26953,26933,26988, -26931,26941,26981,26864,27000,26932,26985,26944,26991,26948,26998,26968,26945, -26996,26956,26939,26955,26935,26972,26959,26961,26930,26962,26927,27003,26940, -27462,27461,27459,27458,27464,27457,27547,64013,27643,27644,27641,27639,27640, -28315,28374,28360,28303,28352,28319,28307,28308,28320,28337,28345,28358,28370, -28349,28353,28318,28361,28343,28336,28365,28326,28367,28338,28350,28355,28380, -28376,28313,28306,28302,28301,28324,28321,28351,28339,28368,28362,28311,28334, -28323,28999,29012,29010,29027,29024,28993,29021,29026,29042,29048,29034,29025, -28994,29016,28995,29003,29040,29023,29008,29011,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28996,29005,29018,29263,29325,29324, -29329,29328,29326,29500,29506,29499,29498,29504,29514,29513,29764,29770,29771, -29778,29777,29783,29760,29775,29776,29774,29762,29766,29773,29780,29921,29951, -29950,29949,29981,30073,30071,27011,30191,30223,30211,30199,30206,30204,30201, -30200,30224,30203,30198,30189,30197,30205,30361,30389,30429,30549,30559,30560, -30546,30550,30554,30569,30567,30548,30553,30573,30688,30855,30874,30868,30863, -30852,30869,30853,30854,30881,30851,30841,30873,30848,30870,30843,31100,31106, -31101,31097,31249,31256,31257,31250,31255,31253,31266,31251,31259,31248,31395, -31394,31390,31467,31590,31588,31597,31604,31593,31602,31589,31603,31601,31600, -31585,31608,31606,31587,31922,31924,31919,32136,32134,32128,32141,32127,32133, -32122,32142,32123,32131,32124,32140,32148,32132,32125,32146,32621,32619,32615, -32616,32620,32678,32677,32679,32731,32732,32801,33124,33120,33143,33116,33129, -33115,33122,33138,26401,33118,33142,33127,33135,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33092,33121,33309,33353,33348,33344, -33346,33349,34033,33855,33878,33910,33913,33935,33933,33893,33873,33856,33926, -33895,33840,33869,33917,33882,33881,33908,33907,33885,34055,33886,33847,33850, -33844,33914,33859,33912,33842,33861,33833,33753,33867,33839,33858,33837,33887, -33904,33849,33870,33868,33874,33903,33989,33934,33851,33863,33846,33843,33896, -33918,33860,33835,33888,33876,33902,33872,34571,34564,34551,34572,34554,34518, -34549,34637,34552,34574,34569,34561,34550,34573,34565,35030,35019,35021,35022, -35038,35035,35034,35020,35024,35205,35227,35295,35301,35300,35297,35296,35298, -35292,35302,35446,35462,35455,35425,35391,35447,35458,35460,35445,35459,35457, -35444,35450,35900,35915,35914,35941,35940,35942,35974,35972,35973,36044,36200, -36201,36241,36236,36238,36239,36237,36243,36244,36240,36242,36336,36320,36332, -36337,36334,36304,36329,36323,36322,36327,36338,36331,36340,36614,36607,36609, -36608,36613,36615,36616,36610,36619,36946,36927,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,36932,36937,36925,37136,37133,37135, -37137,37142,37140,37131,37134,37230,37231,37448,37458,37424,37434,37478,37427, -37477,37470,37507,37422,37450,37446,37485,37484,37455,37472,37479,37487,37430, -37473,37488,37425,37460,37475,37456,37490,37454,37459,37452,37462,37426,38303, -38300,38302,38299,38546,38547,38545,38551,38606,38650,38653,38648,38645,38771, -38775,38776,38770,38927,38925,38926,39084,39158,39161,39343,39346,39344,39349, -39597,39595,39771,40170,40173,40167,40576,40701,20710,20692,20695,20712,20723, -20699,20714,20701,20708,20691,20716,20720,20719,20707,20704,20952,21120,21121, -21225,21227,21296,21420,22055,22037,22028,22034,22012,22031,22044,22017,22035, -22018,22010,22045,22020,22015,22009,22665,22652,22672,22680,22662,22657,22655, -22644,22667,22650,22663,22673,22670,22646,22658,22664,22651,22676,22671,22782, -22891,23260,23278,23269,23253,23274,23258,23277,23275,23283,23266,23264,23259, -23276,23262,23261,23257,23272,23263,23415,23520,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,23523,23651,23938,23936,23933,23942, -23930,23937,23927,23946,23945,23944,23934,23932,23949,23929,23935,24152,24153, -24147,24280,24273,24279,24270,24284,24277,24281,24274,24276,24388,24387,24431, -24502,24876,24872,24897,24926,24945,24947,24914,24915,24946,24940,24960,24948, -24916,24954,24923,24933,24891,24938,24929,24918,25129,25127,25131,25643,25677, -25691,25693,25716,25718,25714,25715,25725,25717,25702,25766,25678,25730,25694, -25692,25675,25683,25696,25680,25727,25663,25708,25707,25689,25701,25719,25971, -26016,26273,26272,26271,26373,26372,26402,27057,27062,27081,27040,27086,27030, -27056,27052,27068,27025,27033,27022,27047,27021,27049,27070,27055,27071,27076, -27069,27044,27092,27065,27082,27034,27087,27059,27027,27050,27041,27038,27097, -27031,27024,27074,27061,27045,27078,27466,27469,27467,27550,27551,27552,27587, -27588,27646,28366,28405,28401,28419,28453,28408,28471,28411,28462,28425,28494, -28441,28442,28455,28440,28475,28434,28397,28426,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,28470,28531,28409,28398,28461,28480, -28464,28476,28469,28395,28423,28430,28483,28421,28413,28406,28473,28444,28412, -28474,28447,28429,28446,28424,28449,29063,29072,29065,29056,29061,29058,29071, -29051,29062,29057,29079,29252,29267,29335,29333,29331,29507,29517,29521,29516, -29794,29811,29809,29813,29810,29799,29806,29952,29954,29955,30077,30096,30230, -30216,30220,30229,30225,30218,30228,30392,30593,30588,30597,30594,30574,30592, -30575,30590,30595,30898,30890,30900,30893,30888,30846,30891,30878,30885,30880, -30892,30882,30884,31128,31114,31115,31126,31125,31124,31123,31127,31112,31122, -31120,31275,31306,31280,31279,31272,31270,31400,31403,31404,31470,31624,31644, -31626,31633,31632,31638,31629,31628,31643,31630,31621,31640,21124,31641,31652, -31618,31931,31935,31932,31930,32167,32183,32194,32163,32170,32193,32192,32197, -32157,32206,32196,32198,32203,32204,32175,32185,32150,32188,32159,32166,32174, -32169,32161,32201,32627,32738,32739,32741,32734,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,32804,32861,32860,33161,33158,33155, -33159,33165,33164,33163,33301,33943,33956,33953,33951,33978,33998,33986,33964, -33966,33963,33977,33972,33985,33997,33962,33946,33969,34000,33949,33959,33979, -33954,33940,33991,33996,33947,33961,33967,33960,34006,33944,33974,33999,33952, -34007,34004,34002,34011,33968,33937,34401,34611,34595,34600,34667,34624,34606, -34590,34593,34585,34587,34627,34604,34625,34622,34630,34592,34610,34602,34605, -34620,34578,34618,34609,34613,34626,34598,34599,34616,34596,34586,34608,34577, -35063,35047,35057,35058,35066,35070,35054,35068,35062,35067,35056,35052,35051, -35229,35233,35231,35230,35305,35307,35304,35499,35481,35467,35474,35471,35478, -35901,35944,35945,36053,36047,36055,36246,36361,36354,36351,36365,36349,36362, -36355,36359,36358,36357,36350,36352,36356,36624,36625,36622,36621,37155,37148, -37152,37154,37151,37149,37146,37156,37153,37147,37242,37234,37241,37235,37541, -37540,37494,37531,37498,37536,37524,37546,37517,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,37542,37530,37547,37497,37527,37503, -37539,37614,37518,37506,37525,37538,37501,37512,37537,37514,37510,37516,37529, -37543,37502,37511,37545,37533,37515,37421,38558,38561,38655,38744,38781,38778, -38782,38787,38784,38786,38779,38788,38785,38783,38862,38861,38934,39085,39086, -39170,39168,39175,39325,39324,39363,39353,39355,39354,39362,39357,39367,39601, -39651,39655,39742,39743,39776,39777,39775,40177,40178,40181,40615,20735,20739, -20784,20728,20742,20743,20726,20734,20747,20748,20733,20746,21131,21132,21233, -21231,22088,22082,22092,22069,22081,22090,22089,22086,22104,22106,22080,22067, -22077,22060,22078,22072,22058,22074,22298,22699,22685,22705,22688,22691,22703, -22700,22693,22689,22783,23295,23284,23293,23287,23286,23299,23288,23298,23289, -23297,23303,23301,23311,23655,23961,23959,23967,23954,23970,23955,23957,23968, -23964,23969,23962,23966,24169,24157,24160,24156,32243,24283,24286,24289,24393, -24498,24971,24963,24953,25009,25008,24994,24969,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,24987,24979,25007,25005,24991,24978, -25002,24993,24973,24934,25011,25133,25710,25712,25750,25760,25733,25751,25756, -25743,25739,25738,25740,25763,25759,25704,25777,25752,25974,25978,25977,25979, -26034,26035,26293,26288,26281,26290,26295,26282,26287,27136,27142,27159,27109, -27128,27157,27121,27108,27168,27135,27116,27106,27163,27165,27134,27175,27122, -27118,27156,27127,27111,27200,27144,27110,27131,27149,27132,27115,27145,27140, -27160,27173,27151,27126,27174,27143,27124,27158,27473,27557,27555,27554,27558, -27649,27648,27647,27650,28481,28454,28542,28551,28614,28562,28557,28553,28556, -28514,28495,28549,28506,28566,28534,28524,28546,28501,28530,28498,28496,28503, -28564,28563,28509,28416,28513,28523,28541,28519,28560,28499,28555,28521,28543, -28565,28515,28535,28522,28539,29106,29103,29083,29104,29088,29082,29097,29109, -29085,29093,29086,29092,29089,29098,29084,29095,29107,29336,29338,29528,29522, -29534,29535,29536,29533,29531,29537,29530,29529,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,29538,29831,29833,29834,29830,29825, -29821,29829,29832,29820,29817,29960,29959,30078,30245,30238,30233,30237,30236, -30243,30234,30248,30235,30364,30365,30366,30363,30605,30607,30601,30600,30925, -30907,30927,30924,30929,30926,30932,30920,30915,30916,30921,31130,31137,31136, -31132,31138,31131,27510,31289,31410,31412,31411,31671,31691,31678,31660,31694, -31663,31673,31690,31669,31941,31944,31948,31947,32247,32219,32234,32231,32215, -32225,32259,32250,32230,32246,32241,32240,32238,32223,32630,32684,32688,32685, -32749,32747,32746,32748,32742,32744,32868,32871,33187,33183,33182,33173,33186, -33177,33175,33302,33359,33363,33362,33360,33358,33361,34084,34107,34063,34048, -34089,34062,34057,34061,34079,34058,34087,34076,34043,34091,34042,34056,34060, -34036,34090,34034,34069,34039,34027,34035,34044,34066,34026,34025,34070,34046, -34088,34077,34094,34050,34045,34078,34038,34097,34086,34023,34024,34032,34031, -34041,34072,34080,34096,34059,34073,34095,34402,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,34646,34659,34660,34679,34785,34675, -34648,34644,34651,34642,34657,34650,34641,34654,34669,34666,34640,34638,34655, -34653,34671,34668,34682,34670,34652,34661,34639,34683,34677,34658,34663,34665, -34906,35077,35084,35092,35083,35095,35096,35097,35078,35094,35089,35086,35081, -35234,35236,35235,35309,35312,35308,35535,35526,35512,35539,35537,35540,35541, -35515,35543,35518,35520,35525,35544,35523,35514,35517,35545,35902,35917,35983, -36069,36063,36057,36072,36058,36061,36071,36256,36252,36257,36251,36384,36387, -36389,36388,36398,36373,36379,36374,36369,36377,36390,36391,36372,36370,36376, -36371,36380,36375,36378,36652,36644,36632,36634,36640,36643,36630,36631,36979, -36976,36975,36967,36971,37167,37163,37161,37162,37170,37158,37166,37253,37254, -37258,37249,37250,37252,37248,37584,37571,37572,37568,37593,37558,37583,37617, -37599,37592,37609,37591,37597,37580,37615,37570,37608,37578,37576,37582,37606, -37581,37589,37577,37600,37598,37607,37585,37587,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,37557,37601,37574,37556,38268,38316, -38315,38318,38320,38564,38562,38611,38661,38664,38658,38746,38794,38798,38792, -38864,38863,38942,38941,38950,38953,38952,38944,38939,38951,39090,39176,39162, -39185,39188,39190,39191,39189,39388,39373,39375,39379,39380,39374,39369,39382, -39384,39371,39383,39372,39603,39660,39659,39667,39666,39665,39750,39747,39783, -39796,39793,39782,39798,39797,39792,39784,39780,39788,40188,40186,40189,40191, -40183,40199,40192,40185,40187,40200,40197,40196,40579,40659,40719,40720,20764, -20755,20759,20762,20753,20958,21300,21473,22128,22112,22126,22131,22118,22115, -22125,22130,22110,22135,22300,22299,22728,22717,22729,22719,22714,22722,22716, -22726,23319,23321,23323,23329,23316,23315,23312,23318,23336,23322,23328,23326, -23535,23980,23985,23977,23975,23989,23984,23982,23978,23976,23986,23981,23983, -23988,24167,24168,24166,24175,24297,24295,24294,24296,24293,24395,24508,24989, -25000,24982,25029,25012,25030,25025,25036,25018,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,25023,25016,24972,25815,25814,25808, -25807,25801,25789,25737,25795,25819,25843,25817,25907,25983,25980,26018,26312, -26302,26304,26314,26315,26319,26301,26299,26298,26316,26403,27188,27238,27209, -27239,27186,27240,27198,27229,27245,27254,27227,27217,27176,27226,27195,27199, -27201,27242,27236,27216,27215,27220,27247,27241,27232,27196,27230,27222,27221, -27213,27214,27206,27477,27476,27478,27559,27562,27563,27592,27591,27652,27651, -27654,28589,28619,28579,28615,28604,28622,28616,28510,28612,28605,28574,28618, -28584,28676,28581,28590,28602,28588,28586,28623,28607,28600,28578,28617,28587, -28621,28591,28594,28592,29125,29122,29119,29112,29142,29120,29121,29131,29140, -29130,29127,29135,29117,29144,29116,29126,29146,29147,29341,29342,29545,29542, -29543,29548,29541,29547,29546,29823,29850,29856,29844,29842,29845,29857,29963, -30080,30255,30253,30257,30269,30259,30268,30261,30258,30256,30395,30438,30618, -30621,30625,30620,30619,30626,30627,30613,30617,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30615,30941,30953,30949,30954,30942, -30947,30939,30945,30946,30957,30943,30944,31140,31300,31304,31303,31414,31416, -31413,31409,31415,31710,31715,31719,31709,31701,31717,31706,31720,31737,31700, -31722,31714,31708,31723,31704,31711,31954,31956,31959,31952,31953,32274,32289, -32279,32268,32287,32288,32275,32270,32284,32277,32282,32290,32267,32271,32278, -32269,32276,32293,32292,32579,32635,32636,32634,32689,32751,32810,32809,32876, -33201,33190,33198,33209,33205,33195,33200,33196,33204,33202,33207,33191,33266, -33365,33366,33367,34134,34117,34155,34125,34131,34145,34136,34112,34118,34148, -34113,34146,34116,34129,34119,34147,34110,34139,34161,34126,34158,34165,34133, -34151,34144,34188,34150,34141,34132,34149,34156,34403,34405,34404,34715,34703, -34711,34707,34706,34696,34689,34710,34712,34681,34695,34723,34693,34704,34705, -34717,34692,34708,34716,34714,34697,35102,35110,35120,35117,35118,35111,35121, -35106,35113,35107,35119,35116,35103,35313,35552,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,35554,35570,35572,35573,35549,35604, -35556,35551,35568,35528,35550,35553,35560,35583,35567,35579,35985,35986,35984, -36085,36078,36081,36080,36083,36204,36206,36261,36263,36403,36414,36408,36416, -36421,36406,36412,36413,36417,36400,36415,36541,36662,36654,36661,36658,36665, -36663,36660,36982,36985,36987,36998,37114,37171,37173,37174,37267,37264,37265, -37261,37263,37671,37662,37640,37663,37638,37647,37754,37688,37692,37659,37667, -37650,37633,37702,37677,37646,37645,37579,37661,37626,37669,37651,37625,37623, -37684,37634,37668,37631,37673,37689,37685,37674,37652,37644,37643,37630,37641, -37632,37627,37654,38332,38349,38334,38329,38330,38326,38335,38325,38333,38569, -38612,38667,38674,38672,38809,38807,38804,38896,38904,38965,38959,38962,39204, -39199,39207,39209,39326,39406,39404,39397,39396,39408,39395,39402,39401,39399, -39609,39615,39604,39611,39670,39674,39673,39671,39731,39808,39813,39815,39804, -39806,39803,39810,39827,39826,39824,39802,39829,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,39805,39816,40229,40215,40224,40222, -40212,40233,40221,40216,40226,40208,40217,40223,40584,40582,40583,40622,40621, -40661,40662,40698,40722,40765,20774,20773,20770,20772,20768,20777,21236,22163, -22156,22157,22150,22148,22147,22142,22146,22143,22145,22742,22740,22735,22738, -23341,23333,23346,23331,23340,23335,23334,23343,23342,23419,23537,23538,23991, -24172,24170,24510,24507,25027,25013,25020,25063,25056,25061,25060,25064,25054, -25839,25833,25827,25835,25828,25832,25985,25984,26038,26074,26322,27277,27286, -27265,27301,27273,27295,27291,27297,27294,27271,27283,27278,27285,27267,27304, -27300,27281,27263,27302,27290,27269,27276,27282,27483,27565,27657,28620,28585, -28660,28628,28643,28636,28653,28647,28646,28638,28658,28637,28642,28648,29153, -29169,29160,29170,29156,29168,29154,29555,29550,29551,29847,29874,29867,29840, -29866,29869,29873,29861,29871,29968,29969,29970,29967,30084,30275,30280,30281, -30279,30372,30441,30645,30635,30642,30647,30646,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,30644,30641,30632,30704,30963,30973, -30978,30971,30972,30962,30981,30969,30974,30980,31147,31144,31324,31323,31318, -31320,31316,31322,31422,31424,31425,31749,31759,31730,31744,31743,31739,31758, -31732,31755,31731,31746,31753,31747,31745,31736,31741,31750,31728,31729,31760, -31754,31976,32301,32316,32322,32307,38984,32312,32298,32329,32320,32327,32297, -32332,32304,32315,32310,32324,32314,32581,32639,32638,32637,32756,32754,32812, -33211,33220,33228,33226,33221,33223,33212,33257,33371,33370,33372,34179,34176, -34191,34215,34197,34208,34187,34211,34171,34212,34202,34206,34167,34172,34185, -34209,34170,34168,34135,34190,34198,34182,34189,34201,34205,34177,34210,34178, -34184,34181,34169,34166,34200,34192,34207,34408,34750,34730,34733,34757,34736, -34732,34745,34741,34748,34734,34761,34755,34754,34764,34743,34735,34756,34762, -34740,34742,34751,34744,34749,34782,34738,35125,35123,35132,35134,35137,35154, -35127,35138,35245,35247,35246,35314,35315,35614,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,35608,35606,35601,35589,35595,35618, -35599,35602,35605,35591,35597,35592,35590,35612,35603,35610,35919,35952,35954, -35953,35951,35989,35988,36089,36207,36430,36429,36435,36432,36428,36423,36675, -36672,36997,36990,37176,37274,37282,37275,37273,37279,37281,37277,37280,37793, -37763,37807,37732,37718,37703,37756,37720,37724,37750,37705,37712,37713,37728, -37741,37775,37708,37738,37753,37719,37717,37714,37711,37745,37751,37755,37729, -37726,37731,37735,37760,37710,37721,38343,38336,38345,38339,38341,38327,38574, -38576,38572,38688,38687,38680,38685,38681,38810,38817,38812,38814,38813,38869, -38868,38897,38977,38980,38986,38985,38981,38979,39205,39211,39212,39210,39219, -39218,39215,39213,39217,39216,39320,39331,39329,39426,39418,39412,39415,39417, -39416,39414,39419,39421,39422,39420,39427,39614,39678,39677,39681,39676,39752, -39834,39848,39838,39835,39846,39841,39845,39844,39814,39842,39840,39855,40243, -40257,40295,40246,40238,40239,40241,40248,40240,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40261,40258,40259,40254,40247,40256, -40253,32757,40237,40586,40585,40589,40624,40648,40666,40699,40703,40740,40739, -40738,40788,40864,20785,20781,20782,22168,22172,22167,22170,22173,22169,22896, -23356,23657,23658,24000,24173,24174,25048,25055,25069,25070,25073,25066,25072, -25067,25046,25065,25855,25860,25853,25848,25857,25859,25852,26004,26075,26330, -26331,26328,27333,27321,27325,27361,27334,27322,27318,27319,27335,27316,27309, -27486,27593,27659,28679,28684,28685,28673,28677,28692,28686,28671,28672,28667, -28710,28668,28663,28682,29185,29183,29177,29187,29181,29558,29880,29888,29877, -29889,29886,29878,29883,29890,29972,29971,30300,30308,30297,30288,30291,30295, -30298,30374,30397,30444,30658,30650,30975,30988,30995,30996,30985,30992,30994, -30993,31149,31148,31327,31772,31785,31769,31776,31775,31789,31773,31782,31784, -31778,31781,31792,32348,32336,32342,32355,32344,32354,32351,32337,32352,32343, -32339,32693,32691,32759,32760,32885,33233,33234,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,33232,33375,33374,34228,34246,34240, -34243,34242,34227,34229,34237,34247,34244,34239,34251,34254,34248,34245,34225, -34230,34258,34340,34232,34231,34238,34409,34791,34790,34786,34779,34795,34794, -34789,34783,34803,34788,34772,34780,34771,34797,34776,34787,34724,34775,34777, -34817,34804,34792,34781,35155,35147,35151,35148,35142,35152,35153,35145,35626, -35623,35619,35635,35632,35637,35655,35631,35644,35646,35633,35621,35639,35622, -35638,35630,35620,35643,35645,35642,35906,35957,35993,35992,35991,36094,36100, -36098,36096,36444,36450,36448,36439,36438,36446,36453,36455,36443,36442,36449, -36445,36457,36436,36678,36679,36680,36683,37160,37178,37179,37182,37288,37285, -37287,37295,37290,37813,37772,37778,37815,37787,37789,37769,37799,37774,37802, -37790,37798,37781,37768,37785,37791,37773,37809,37777,37810,37796,37800,37812, -37795,37797,38354,38355,38353,38579,38615,38618,24002,38623,38616,38621,38691, -38690,38693,38828,38830,38824,38827,38820,38826,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38818,38821,38871,38873,38870,38872, -38906,38992,38993,38994,39096,39233,39228,39226,39439,39435,39433,39437,39428, -39441,39434,39429,39431,39430,39616,39644,39688,39684,39685,39721,39733,39754, -39756,39755,39879,39878,39875,39871,39873,39861,39864,39891,39862,39876,39865, -39869,40284,40275,40271,40266,40283,40267,40281,40278,40268,40279,40274,40276, -40287,40280,40282,40590,40588,40671,40705,40704,40726,40741,40747,40746,40745, -40744,40780,40789,20788,20789,21142,21239,21428,22187,22189,22182,22183,22186, -22188,22746,22749,22747,22802,23357,23358,23359,24003,24176,24511,25083,25863, -25872,25869,25865,25868,25870,25988,26078,26077,26334,27367,27360,27340,27345, -27353,27339,27359,27356,27344,27371,27343,27341,27358,27488,27568,27660,28697, -28711,28704,28694,28715,28705,28706,28707,28713,28695,28708,28700,28714,29196, -29194,29191,29186,29189,29349,29350,29348,29347,29345,29899,29893,29879,29891, -29974,30304,30665,30666,30660,30705,31005,31003,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31009,31004,30999,31006,31152,31335, -31336,31795,31804,31801,31788,31803,31980,31978,32374,32373,32376,32368,32375, -32367,32378,32370,32372,32360,32587,32586,32643,32646,32695,32765,32766,32888, -33239,33237,33380,33377,33379,34283,34289,34285,34265,34273,34280,34266,34263, -34284,34290,34296,34264,34271,34275,34268,34257,34288,34278,34287,34270,34274, -34816,34810,34819,34806,34807,34825,34828,34827,34822,34812,34824,34815,34826, -34818,35170,35162,35163,35159,35169,35164,35160,35165,35161,35208,35255,35254, -35318,35664,35656,35658,35648,35667,35670,35668,35659,35669,35665,35650,35666, -35671,35907,35959,35958,35994,36102,36103,36105,36268,36266,36269,36267,36461, -36472,36467,36458,36463,36475,36546,36690,36689,36687,36688,36691,36788,37184, -37183,37296,37293,37854,37831,37839,37826,37850,37840,37881,37868,37836,37849, -37801,37862,37834,37844,37870,37859,37845,37828,37838,37824,37842,37863,38269, -38362,38363,38625,38697,38699,38700,38696,38694,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,38835,38839,38838,38877,38878,38879, -39004,39001,39005,38999,39103,39101,39099,39102,39240,39239,39235,39334,39335, -39450,39445,39461,39453,39460,39451,39458,39456,39463,39459,39454,39452,39444, -39618,39691,39690,39694,39692,39735,39914,39915,39904,39902,39908,39910,39906, -39920,39892,39895,39916,39900,39897,39909,39893,39905,39898,40311,40321,40330, -40324,40328,40305,40320,40312,40326,40331,40332,40317,40299,40308,40309,40304, -40297,40325,40307,40315,40322,40303,40313,40319,40327,40296,40596,40593,40640, -40700,40749,40768,40769,40781,40790,40791,40792,21303,22194,22197,22195,22755, -23365,24006,24007,24302,24303,24512,24513,25081,25879,25878,25877,25875,26079, -26344,26339,26340,27379,27376,27370,27368,27385,27377,27374,27375,28732,28725, -28719,28727,28724,28721,28738,28728,28735,28730,28729,28736,28731,28723,28737, -29203,29204,29352,29565,29564,29882,30379,30378,30398,30445,30668,30670,30671, -30669,30706,31013,31011,31015,31016,31012,31017,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,31154,31342,31340,31341,31479,31817, -31816,31818,31815,31813,31982,32379,32382,32385,32384,32698,32767,32889,33243, -33241,33291,33384,33385,34338,34303,34305,34302,34331,34304,34294,34308,34313, -34309,34316,34301,34841,34832,34833,34839,34835,34838,35171,35174,35257,35319, -35680,35690,35677,35688,35683,35685,35687,35693,36270,36486,36488,36484,36697, -36694,36695,36693,36696,36698,37005,37187,37185,37303,37301,37298,37299,37899, -37907,37883,37920,37903,37908,37886,37909,37904,37928,37913,37901,37877,37888, -37879,37895,37902,37910,37906,37882,37897,37880,37898,37887,37884,37900,37878, -37905,37894,38366,38368,38367,38702,38703,38841,38843,38909,38910,39008,39010, -39011,39007,39105,39106,39248,39246,39257,39244,39243,39251,39474,39476,39473, -39468,39466,39478,39465,39470,39480,39469,39623,39626,39622,39696,39698,39697, -39947,39944,39927,39941,39954,39928,40000,39943,39950,39942,39959,39956,39945, -40351,40345,40356,40349,40338,40344,40336,40347,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40352,40340,40348,40362,40343,40353, -40346,40354,40360,40350,40355,40383,40361,40342,40358,40359,40601,40603,40602, -40677,40676,40679,40678,40752,40750,40795,40800,40798,40797,40793,40849,20794, -20793,21144,21143,22211,22205,22206,23368,23367,24011,24015,24305,25085,25883, -27394,27388,27395,27384,27392,28739,28740,28746,28744,28745,28741,28742,29213, -29210,29209,29566,29975,30314,30672,31021,31025,31023,31828,31827,31986,32394, -32391,32392,32395,32390,32397,32589,32699,32816,33245,34328,34346,34342,34335, -34339,34332,34329,34343,34350,34337,34336,34345,34334,34341,34857,34845,34843, -34848,34852,34844,34859,34890,35181,35177,35182,35179,35322,35705,35704,35653, -35706,35707,36112,36116,36271,36494,36492,36702,36699,36701,37190,37188,37189, -37305,37951,37947,37942,37929,37949,37948,37936,37945,37930,37943,37932,37952, -37937,38373,38372,38371,38709,38714,38847,38881,39012,39113,39110,39104,39256, -39254,39481,39485,39494,39492,39490,39489,39482,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,39487,39629,39701,39703,39704,39702, -39738,39762,39979,39965,39964,39980,39971,39976,39977,39972,39969,40375,40374, -40380,40385,40391,40394,40399,40382,40389,40387,40379,40373,40398,40377,40378, -40364,40392,40369,40365,40396,40371,40397,40370,40570,40604,40683,40686,40685, -40731,40728,40730,40753,40782,40805,40804,40850,20153,22214,22213,22219,22897, -23371,23372,24021,24017,24306,25889,25888,25894,25890,27403,27400,27401,27661, -28757,28758,28759,28754,29214,29215,29353,29567,29912,29909,29913,29911,30317, -30381,31029,31156,31344,31345,31831,31836,31833,31835,31834,31988,31985,32401, -32591,32647,33246,33387,34356,34357,34355,34348,34354,34358,34860,34856,34854, -34858,34853,35185,35263,35262,35323,35710,35716,35714,35718,35717,35711,36117, -36501,36500,36506,36498,36496,36502,36503,36704,36706,37191,37964,37968,37962, -37963,37967,37959,37957,37960,37961,37958,38719,38883,39018,39017,39115,39252, -39259,39502,39507,39508,39500,39503,39496,39498,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,39497,39506,39504,39632,39705,39723, -39739,39766,39765,40006,40008,39999,40004,39993,39987,40001,39996,39991,39988, -39986,39997,39990,40411,40402,40414,40410,40395,40400,40412,40401,40415,40425, -40409,40408,40406,40437,40405,40413,40630,40688,40757,40755,40754,40770,40811, -40853,40866,20797,21145,22760,22759,22898,23373,24024,34863,24399,25089,25091, -25092,25897,25893,26006,26347,27409,27410,27407,27594,28763,28762,29218,29570, -29569,29571,30320,30676,31847,31846,32405,33388,34362,34368,34361,34364,34353, -34363,34366,34864,34866,34862,34867,35190,35188,35187,35326,35724,35726,35723, -35720,35909,36121,36504,36708,36707,37308,37986,37973,37981,37975,37982,38852, -38853,38912,39510,39513,39710,39711,39712,40018,40024,40016,40010,40013,40011, -40021,40025,40012,40014,40443,40439,40431,40419,40427,40440,40420,40438,40417, -40430,40422,40434,40432,40418,40428,40436,40435,40424,40429,40642,40656,40690, -40691,40710,40732,40760,40759,40758,40771,40783,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40817,40816,40814,40815,22227,22221, -23374,23661,25901,26349,26350,27411,28767,28769,28765,28768,29219,29915,29925, -30677,31032,31159,31158,31850,32407,32649,33389,34371,34872,34871,34869,34891, -35732,35733,36510,36511,36512,36509,37310,37309,37314,37995,37992,37993,38629, -38726,38723,38727,38855,38885,39518,39637,39769,40035,40039,40038,40034,40030, -40032,40450,40446,40455,40451,40454,40453,40448,40449,40457,40447,40445,40452, -40608,40734,40774,40820,40821,40822,22228,25902,26040,27416,27417,27415,27418, -28770,29222,29354,30680,30681,31033,31849,31851,31990,32410,32408,32411,32409, -33248,33249,34374,34375,34376,35193,35194,35196,35195,35327,35736,35737,36517, -36516,36515,37998,37997,37999,38001,38003,38729,39026,39263,40040,40046,40045, -40459,40461,40464,40463,40466,40465,40609,40693,40713,40775,40824,40827,40826, -40825,22302,28774,31855,34876,36274,36518,37315,38004,38008,38006,38005,39520, -40052,40051,40049,40053,40468,40467,40694,40714,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,40868,28776,28773,31991,34410,34878, -34877,34879,35742,35996,36521,36553,38731,39027,39028,39116,39265,39339,39524, -39526,39527,39716,40469,40471,40776,25095,27422,29223,34380,36520,38018,38016, -38017,39529,39528,39726,40473,29225,34379,35743,38019,40057,40631,30325,39531, -40058,40477,28777,28778,40612,40830,40777,40856, -}; - -static const struct dbcs_index big5_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__big5_decmap+0,64,254},{ -__big5_decmap+191,64,254},{__big5_decmap+382,64,191},{__big5_decmap+510,64,254 -},{__big5_decmap+701,64,254},{__big5_decmap+892,64,254},{__big5_decmap+1083, -64,254},{__big5_decmap+1274,64,254},{__big5_decmap+1465,64,254},{__big5_decmap -+1656,64,254},{__big5_decmap+1847,64,254},{__big5_decmap+2038,64,254},{ -__big5_decmap+2229,64,254},{__big5_decmap+2420,64,254},{__big5_decmap+2611,64, -254},{__big5_decmap+2802,64,254},{__big5_decmap+2993,64,254},{__big5_decmap+ -3184,64,254},{__big5_decmap+3375,64,254},{__big5_decmap+3566,64,254},{ -__big5_decmap+3757,64,254},{__big5_decmap+3948,64,254},{__big5_decmap+4139,64, -254},{__big5_decmap+4330,64,254},{__big5_decmap+4521,64,254},{__big5_decmap+ -4712,64,254},{__big5_decmap+4903,64,254},{__big5_decmap+5094,64,254},{ -__big5_decmap+5285,64,254},{__big5_decmap+5476,64,254},{__big5_decmap+5667,64, -254},{__big5_decmap+5858,64,254},{__big5_decmap+6049,64,254},{__big5_decmap+ -6240,64,254},{__big5_decmap+6431,64,254},{__big5_decmap+6622,64,254},{ -__big5_decmap+6813,64,254},{__big5_decmap+7004,64,254},{__big5_decmap+7195,64, -252},{0,0,0},{__big5_decmap+7384,64,254},{__big5_decmap+7575,64,254},{ -__big5_decmap+7766,64,254},{__big5_decmap+7957,64,254},{__big5_decmap+8148,64, -254},{__big5_decmap+8339,64,254},{__big5_decmap+8530,64,254},{__big5_decmap+ -8721,64,254},{__big5_decmap+8912,64,254},{__big5_decmap+9103,64,254},{ -__big5_decmap+9294,64,254},{__big5_decmap+9485,64,254},{__big5_decmap+9676,64, -254},{__big5_decmap+9867,64,254},{__big5_decmap+10058,64,254},{__big5_decmap+ -10249,64,254},{__big5_decmap+10440,64,254},{__big5_decmap+10631,64,254},{ -__big5_decmap+10822,64,254},{__big5_decmap+11013,64,254},{__big5_decmap+11204, -64,254},{__big5_decmap+11395,64,254},{__big5_decmap+11586,64,254},{ -__big5_decmap+11777,64,254},{__big5_decmap+11968,64,254},{__big5_decmap+12159, -64,254},{__big5_decmap+12350,64,254},{__big5_decmap+12541,64,254},{ -__big5_decmap+12732,64,254},{__big5_decmap+12923,64,254},{__big5_decmap+13114, -64,254},{__big5_decmap+13305,64,254},{__big5_decmap+13496,64,254},{ -__big5_decmap+13687,64,254},{__big5_decmap+13878,64,254},{__big5_decmap+14069, -64,254},{__big5_decmap+14260,64,254},{__big5_decmap+14451,64,254},{ -__big5_decmap+14642,64,254},{__big5_decmap+14833,64,254},{__big5_decmap+15024, -64,254},{__big5_decmap+15215,64,254},{__big5_decmap+15406,64,254},{ -__big5_decmap+15597,64,254},{__big5_decmap+15788,64,254},{__big5_decmap+15979, -64,254},{__big5_decmap+16170,64,254},{__big5_decmap+16361,64,254},{ -__big5_decmap+16552,64,213},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __big5_encmap[21764] = { -41542,41543,N,41540,N,41393,N,N,N,N,N,N,N,N,41560,41427,N,N,N,N,N,41296,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41425,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41426,41918,N,41916,41917,41919, -N,41413,N,N,N,N,N,N,N,N,N,N,N,41915,41796,41797,41798,41799,41800,41801,41802, -41803,41804,41805,41806,41807,41808,41809,41810,41811,41812,N,41813,41814, -41815,41816,41817,41818,41819,N,N,N,N,N,N,N,41820,41821,41822,41823,41824, -41825,41826,41827,41828,41829,41830,41831,41832,41833,41834,41835,41836,N, -41837,41838,41839,41840,41841,41842,41843,51123,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,51121,51122,51124,51125,51126,51127,51128,51129,51130,N,N,N,N,N,N,51131, -51132,51133,51134,51135,51136,51137,51138,51139,51140,51141,51142,51143,51144, -51145,51146,51147,51148,51149,51151,51152,51153,51154,51155,51156,51157,51158, -51159,51160,51161,51162,51163,51164,51165,51166,51167,51168,51169,51170,51171, -51172,51173,51174,51175,51176,N,51150,41302,41304,N,N,N,41381,41382,N,N,41383, -41384,N,N,N,N,41285,N,N,41292,41291,N,N,N,N,N,N,N,N,N,N,N,41388,N,N,41387,N,N, -N,N,N,41392,N,N,41410,41546,N,41409,N,N,N,41547,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41657,41658, -41659,41660,41661,41662,41663,41664,41665,41666,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41462,41460,41463,41461,N,N, -41464,41465,41467,41466,41428,N,N,N,41435,41448,41447,N,N,41469,N,41468,N,N,N, -41444,41445,41452,N,N,41453,N,N,N,N,N,41455,41454,N,N,N,N,N,N,41443,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41436,N,N,N,N,N,N,N,N,N,N,N,N,N,41434,41437,N, -N,N,N,41432,41433,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41446,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41449,51177,51178,51179,51180,51181, -51182,51183,51184,51185,51186,N,N,N,N,N,N,N,N,N,N,51187,51188,51189,51190, -51191,51192,51193,51194,51195,51196,41591,N,41592,N,N,N,N,N,N,N,N,N,41594,N,N, -N,41595,N,N,N,41596,N,N,N,41597,N,N,N,41589,N,N,N,N,N,N,N,41588,N,N,N,N,N,N,N, -41587,N,N,N,N,N,N,N,41586,N,N,N,N,N,N,N,41585,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,41636,N,N,N,N,N,N,N,N,N,N,N,N,N,41637,N,N,41639,N,N,N,N,N,N,N,N,41638,N, -N,41598,41633,41635,41634,41644,41645,41646,41306,N,N,N,N,N,N,N,N,N,N,N,N, -41570,41571,41572,41573,41574,41575,41576,41577,41584,41583,41582,41581,41580, -41579,41578,N,N,N,N,41590,41593,N,N,N,N,N,N,N,N,N,N,41405,41404,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,41398,41397,N,N,N,N,N,N,N,N,41407,41406,N,N,N,N,N,N,N,N, -41403,41402,N,N,N,41395,N,N,41399,41396,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41640,41641,41643,41642,41401,41400,N,N,41459,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41456,41458,41457,41280,41282,41283,41394,N,50852,N,N,41329,41330,41325,41326, -41333,41334,41337,41338,41321,41322,41541,N,41317,41318,N,N,N,N,N,N,N,41385, -41386,N,N,41667,41668,41669,41670,41671,41672,41673,41674,41675,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,50853,50854,50855,50856,50857,50858,50859, -50860,50861,50862,50863,50864,50865,50866,50867,50868,50869,50870,50871,50872, -50873,50874,50875,50876,50877,50878,50879,50880,50881,50882,50883,50884,50885, -50886,50887,50888,50889,50890,50891,50892,50893,50894,50895,50896,50897,50898, -50899,50900,50901,50902,50903,50904,50905,50906,50907,50908,50909,50910,50911, -50912,50913,50914,50915,50916,50917,50918,50919,50920,50921,50922,50923,50924, -50925,50926,50927,50928,50929,50930,50931,50932,50933,50934,50935,N,N,N,N,N,N, -N,N,N,50850,50851,N,N,50936,50937,50938,50939,50940,50941,50942,51008,51009, -51010,51011,51012,51013,51014,51015,51016,51017,51018,51019,51020,51021,51022, -51023,51024,51025,51026,51027,51028,51029,51030,51031,51032,51033,51034,51035, -51036,51037,51038,51039,51040,51041,51042,51043,51044,51045,51046,51047,51048, -51049,51050,51051,51052,51053,51054,51055,51056,51057,51058,51059,51060,51061, -51062,51063,51064,51065,51066,51067,51068,51069,51070,51105,51106,51107,51108, -51109,51110,51111,51112,51113,51114,51115,51116,51117,51118,51119,51120,N,N,N, -N,N,N,N,50849,41844,41845,41846,41847,41848,41849,41850,41851,41852,41853, -41854,41889,41890,41891,41892,41893,41894,41895,41896,41897,41898,41899,41900, -41901,41902,41903,41904,41905,41906,41907,41908,41909,41910,41911,41912,41913, -41914,41408,41557,41558,N,N,N,N,N,N,N,N,N,N,N,N,41552,41553,41554,N,N,41556,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41559,N,N,N, -N,N,N,N,N,N,41555,N,N,41451,41450,N,N,41551,42048,42050,N,42051,N,N,N,51525, -42070,42068,42071,42069,51526,42147,51535,51533,42146,42145,N,N,42306,42305, -42304,N,42307,42238,N,N,N,N,42464,42465,N,N,N,N,N,N,43203,N,N,N,N,42072,N, -42148,51536,N,42149,51555,42730,52145,N,N,N,N,42073,42150,N,42308,51556,N,N,N, -N,N,51520,42052,N,42075,N,51527,42076,N,N,42151,N,42309,42311,42310,N,N,42466, -42467,N,N,43204,N,44476,42049,N,N,51521,42053,42078,42077,N,N,N,N,N,N,N,N,N, -42468,N,N,N,N,N,N,N,N,N,43205,N,N,N,N,N,N,N,N,N,N,45230,54347,N,N,46787,56497, -56498,N,42054,N,42153,N,N,43206,42055,51528,42079,N,N,42154,42156,51537,42157, -42155,N,N,N,42469,N,43207,N,N,43208,43845,N,42080,42158,N,42470,42472,42471,N, -42731,N,N,43209,43210,43846,43847,N,N,N,N,44477,N,N,56499,N,N,63190,42056,N,N, -N,N,N,42160,42159,51538,42161,42167,N,42162,42163,51540,51539,42165,42166,N, -42164,N,N,N,N,N,N,42314,42315,42316,42317,42313,42320,51562,N,51558,51561, -42321,42337,N,51560,N,42318,42319,42312,N,N,51557,51559,N,N,N,N,N,N,42485, -51632,42482,42486,51642,51630,42483,51634,N,N,N,42484,N,42487,N,42473,51633, -42488,51637,N,51641,51638,N,N,51635,42474,42476,42489,N,42478,51627,42481, -42479,42480,51643,51640,51631,42477,N,N,51628,42475,N,N,N,51636,N,N,N,N,51639, -N,N,N,N,N,N,N,N,N,51629,51814,N,42818,42740,N,N,51815,42737,N,42820,N,42745,N, -42744,51803,42748,42743,51808,51816,N,51812,N,42746,N,N,42749,42734,42823, -51805,N,N,52157,42732,42819,42733,42741,42742,51810,51806,42747,42739,51802, -42735,51813,42821,42824,42738,42816,42822,42736,51811,42817,51817,51804,42750, -51807,N,N,51809,N,43224,52159,52171,43216,N,52172,43211,43221,N,N,43214,52153, -43222,52152,52156,52163,52161,43230,43225,52147,52149,43227,43215,52150,52162, -52169,43220,52155,52148,43219,52151,43223,52154,N,43218,N,43213,N,43228,52164, -43229,52168,N,52166,52170,43226,52158,52146,N,52160,43217,52165,43212,52167,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,43862,43850,N,N,52704,52712,N,43849,43857,43869,N, -52718,52716,52711,N,N,N,43851,52717,52707,43865,43856,43864,52702,N,52714,N, -52705,43860,52706,N,52701,43867,43854,43863,43853,N,52703,52708,N,52715,43861, -43858,52710,43866,52713,52709,43855,43868,43859,43852,43848,N,N,N,N,N,N,N,N,N, -N,52719,N,44503,44481,N,44497,N,44502,53456,53455,53460,53461,44484,N,44493,N, -N,N,44506,44494,N,N,N,N,53449,44487,53450,N,44508,N,44499,44478,44479,53469, -45247,N,44492,44491,53451,44495,54363,44486,53462,44501,44500,44490,53454, -53463,N,53448,44489,53464,44498,53452,44480,N,44483,44482,53465,44496,44485, -44505,44507,53459,44504,N,53467,53453,53468,N,53457,N,53466,N,53458,N,N,N,N, -44488,N,N,N,54371,54359,N,45235,N,54364,54370,45234,54357,45238,54361,54354, -45236,54358,45241,45246,N,54375,N,54353,N,45242,N,54374,N,N,45237,54360,45233, -54355,54351,54365,54352,54350,54362,54368,54369,45239,N,N,55387,54366,54349, -54367,N,45249,54372,45248,54348,N,54356,54373,45244,45243,45240,45245,N,N, -45231,N,N,45232,N,N,46024,N,55390,55383,N,46021,N,55391,N,N,N,55381,55384, -46020,55385,N,N,46023,55389,N,55379,55378,46025,N,46026,46022,46027,55377, -55388,55386,55380,N,N,N,46019,55382,N,N,N,N,N,N,N,N,46794,46788,56503,46797, -56509,56512,46790,46791,56506,46789,56515,46795,56516,N,56511,46796,N,56500, -46793,56501,N,56510,56508,N,56504,46792,56502,46798,56507,56514,56505,56513,N, -N,47542,47539,N,47540,N,57593,57585,47538,47535,57586,N,N,47537,57589,N,57591, -N,N,57598,N,N,57597,57592,47534,57584,47532,57587,47543,57590,N,57594,47536, -47533,57596,57595,47541,N,57588,N,48120,58604,N,58601,48121,N,48119,N,58608, -58605,58598,48118,N,48122,58599,48117,48125,58602,58603,48123,48124,58609, -58606,58607,N,N,N,48810,59640,48807,59637,48809,48811,N,59638,48808,N,59639,N, -59636,N,N,49270,60605,49271,60603,N,60604,60602,60601,N,N,60606,49269,N,N, -61368,61369,N,58600,61367,49272,50015,61931,61932,N,50391,50392,62913,62912, -50540,50539,63440,N,42057,42081,42169,N,42168,42323,42322,42492,42491,42493, -42490,N,42826,42825,42827,N,N,N,N,43232,N,43231,43233,N,43870,N,41561,53470, -41562,45250,41564,41563,55392,N,41565,47544,41566,N,42058,N,42170,42494,43234, -N,42059,42173,42171,42172,N,N,42560,N,N,N,42828,43236,43235,43237,N,N,N,44509, -N,N,N,48812,N,N,N,N,N,N,51534,N,42324,42325,N,N,42561,N,51818,N,43872,43871, -53472,53471,45251,N,42174,51541,N,N,N,N,N,52173,N,43873,N,44512,N,44510,44511, -N,N,N,N,48813,N,42326,N,N,N,42562,51644,N,N,N,N,42829,42830,N,51819,N,N,52174, -43238,52175,N,N,N,N,N,53474,53475,44515,N,53476,N,53473,44516,44514,44513, -53477,N,54376,N,N,N,55393,N,N,56517,57664,N,N,N,48126,48814,59641,N,42060, -42074,N,N,N,N,N,N,N,N,N,N,N,N,N,N,45252,46029,N,47545,N,51522,42175,N,42329, -42327,42328,N,N,43239,42061,42062,N,42082,N,N,42176,42177,42178,51646,42330,N, -51563,N,42566,N,51647,42564,42565,51645,N,N,42567,42563,N,N,N,N,51820,43756, -51821,N,N,51822,N,N,42832,42831,N,N,42835,42833,42834,N,N,N,43245,N,43244, -52180,52177,52178,N,52176,43246,43242,43241,N,43243,43240,N,N,N,N,N,43247,N, -43875,52720,N,52179,43880,N,52721,43876,43879,43878,43877,43874,N,N,N,53480,N, -44519,53483,44517,N,N,N,53479,44520,44518,44521,53481,53482,N,53478,53484,N,N, -N,N,N,N,46033,45253,54377,54379,54378,54380,45254,N,N,46030,N,46031,46032,N, -46800,56519,N,56518,56520,56521,46801,N,46799,57665,57666,47547,47546,58202,N, -N,48192,48193,48194,48196,58610,58611,48195,N,N,N,48815,N,48816,N,N,61933, -62915,62914,63441,N,42063,N,N,N,42332,42331,N,N,42568,N,N,51648,N,N,42837, -42838,42836,42839,51823,51824,N,N,N,N,N,N,N,N,N,N,N,N,43249,52181,N,43248,N, -52722,43884,52723,43883,N,N,N,43881,N,43882,N,N,N,53485,N,N,N,N,45255,54382,N, -45258,54381,45541,45257,45256,N,46036,N,46035,46034,46802,N,N,46805,46806, -46804,N,46803,N,N,57667,N,57668,N,N,N,58613,48197,58612,N,48817,60607,49273,N, -61934,50261,N,42083,42179,51542,N,42180,42181,42333,42334,N,42569,51825,52182, -52183,N,43885,53486,45260,45259,55395,55394,N,N,42064,42182,42335,N,45261, -51523,N,51564,42336,N,51650,42571,42570,51649,42840,N,N,N,N,N,N,44522,N,N, -54383,N,46807,57669,47548,N,N,59642,N,N,62461,N,42183,N,N,52184,52724,45264, -45262,45263,42065,N,42084,41677,42186,N,42185,42184,42339,42338,N,51565,51651, -N,N,N,43253,43250,43252,43251,N,N,43886,N,N,46037,N,42066,N,42187,N,42341, -42340,N,51826,N,N,43254,N,N,N,N,N,51543,N,42343,42342,42572,42573,51827,42841, -N,42842,N,43255,43256,43257,N,43887,52725,N,N,44523,N,N,51524,N,42188,N,N,N,N, -N,51652,N,N,N,51828,51829,N,N,52185,N,52186,N,52727,52726,52729,52728,43888,N, -54384,44525,53487,44524,N,N,N,N,55396,46038,N,55397,N,N,N,N,57670,47549,N,N,N, -N,48198,N,61935,N,N,N,N,51544,N,42344,N,N,N,N,N,N,N,45265,N,N,N,N,42067,42085, -42190,42189,N,42191,N,N,N,N,N,N,43259,N,43258,43260,N,N,N,43889,N,N,N,44526,N, -59643,49743,42086,42346,42361,42356,N,42351,42350,42357,42355,42348,42362, -42349,42345,42360,42359,42358,42347,N,42354,N,N,42353,N,N,42363,42352,42579,N, -42585,42581,N,42587,51653,42584,42574,42577,42580,42576,42583,42586,42575, -42578,42582,42588,N,N,N,N,N,51838,51835,N,42855,51836,42843,42845,42869,42864, -N,N,N,51877,51837,42847,42849,51876,42856,51832,42868,42870,42844,42861,N, -51830,42867,N,42852,N,42862,42863,51831,42860,42858,N,42859,42865,51873,42846, -N,42866,51875,42854,42851,N,51834,42850,51878,42853,N,42857,N,N,N,42848,51874, -N,N,N,N,51833,N,N,N,N,N,N,N,N,N,N,N,52203,52202,43343,52205,52207,52196,52199, -52206,43344,N,N,52193,52197,N,N,52201,52809,43339,52813,43261,52198,43262, -43340,43333,43329,N,52194,43332,43337,43346,52195,52188,43331,52189,52191,N, -43334,N,43336,52187,52192,N,N,43345,43341,52200,43347,N,43338,52190,43335,N,N, -43330,43328,N,52204,N,43342,N,N,N,N,N,52808,52731,52811,N,N,52733,43896,43944, -43892,43943,43901,43940,43890,52732,52803,43939,52815,43941,N,43897,N,N,52805, -52802,43895,N,52730,43942,52810,43900,52812,43945,43891,43902,43899,52800, -43937,52806,52807,43898,43938,43894,N,N,N,N,43893,52734,N,N,N,N,N,N,52804,N,N, -N,N,N,N,N,52814,N,53572,44539,53489,N,53494,44532,44608,53492,44527,44537, -44542,53499,N,44538,44541,N,N,53502,44533,53493,N,N,N,53570,53571,N,44535, -53569,44531,44611,N,53496,44529,N,53574,53497,53501,44534,44610,53498,44540, -53568,53575,54433,N,53573,44612,44528,53500,53491,N,44536,N,N,53490,N,N,53495, -N,N,N,N,N,N,N,N,N,N,N,53488,44609,N,N,54391,N,45284,54439,45282,45279,54396, -45275,54434,45286,54390,54395,54394,44530,45281,54437,N,54440,54387,N,46056,N, -54441,45287,N,45273,45270,54398,45267,N,54438,N,45274,54442,N,54388,54436, -45277,54389,54392,54397,N,N,45278,45276,45288,N,N,N,N,45283,N,45271,45522,N, -45272,54393,45285,45280,54435,45269,N,N,N,45268,N,N,N,N,N,N,N,N,N,N,54385, -54386,55402,N,N,N,46039,46042,55413,46062,55416,46040,55409,46046,46052,46525, -N,N,46050,55406,46063,46043,46051,55414,56535,55419,55407,N,55398,55411,55405, -46049,55417,N,N,46045,46065,46058,N,46047,46044,N,46055,N,55418,55404,55410, -55412,55400,55415,46041,55399,N,46048,46064,46060,55401,46054,N,N,46061,46057, -46053,N,55408,N,N,N,N,N,46059,N,N,N,56533,56529,N,56544,56522,56531,46821, -46822,46814,56540,46824,56527,56526,56524,56542,46812,56536,56525,46815,56534, -46810,56530,56537,56539,N,N,56543,46819,56523,46813,56528,N,46808,N,46820, -56538,46816,46817,46823,46811,41567,46809,56532,N,N,N,N,N,46818,N,N,56541,N,N, -N,47565,47560,N,57685,57681,N,57675,47554,47550,57684,47551,57678,57680,N, -57683,N,47556,N,47563,47557,N,N,57673,47558,47559,57676,47564,N,57674,57679, -47555,57672,47561,47553,N,N,N,47552,57677,57682,N,47562,N,N,N,N,N,N,N,57671,N, -48205,58695,N,58692,N,48199,48211,48212,N,48202,58690,48204,58617,48210,N, -58694,48201,58696,48200,N,58691,58693,48203,58689,58618,58615,N,N,55403,58621, -N,58614,58620,58619,N,58616,N,48207,N,N,N,N,48206,N,N,N,48208,58622,48818, -58688,N,N,N,59717,N,59645,N,48830,59714,48822,48826,59713,N,48825,48821,48824, -48819,48829,59715,59646,48828,59644,48827,59716,59712,48209,N,48831,59718, -48823,48820,N,N,N,N,60614,60616,49275,60617,60615,60613,60612,49277,60611, -49278,N,N,N,N,60609,60610,49274,49313,49276,N,N,60608,N,49744,N,61372,61370, -61375,61373,N,61371,61374,N,N,N,N,N,N,N,50016,61938,61939,50262,N,61940,61936, -61941,61937,49745,N,N,N,62462,62529,50265,62528,50264,50263,N,N,N,N,50266, -62917,62918,N,50394,50393,50395,62916,N,63192,63191,N,50541,50543,50542,63193, -50632,63654,N,N,N,50673,N,63653,63726,N,N,51529,N,N,42365,42364,N,42591,42590, -51655,42589,51654,N,N,42873,51881,N,51880,N,N,42871,42874,N,N,51879,N,42872,N, -N,N,N,N,N,52208,N,52209,43348,N,N,N,N,43946,53576,53577,44613,44614,N,N,54444, -45289,45291,54443,45290,55420,46066,N,N,N,N,46825,46826,56545,N,47567,N,47566, -N,58697,59720,59719,N,63851,42087,51545,N,51566,51567,N,N,N,N,42594,42598, -51657,N,42596,42595,51656,42597,42593,N,N,42592,51658,N,N,N,N,N,N,42918,N,N, -42915,N,42877,51882,N,N,N,51883,N,42913,N,51885,42875,51886,51884,42878,42914, -42917,42916,42876,51887,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43353,52222,N,43355,N, -43354,N,52288,43352,43351,52213,N,52212,N,52210,52215,52214,52211,52220,52221, -52218,52216,43350,N,N,N,52219,43356,52289,N,N,52217,N,43947,43349,N,N,N,N,N,N, -N,43948,52820,N,N,52826,N,N,N,43954,52824,52830,N,52821,52825,52827,52829, -52823,N,52822,52817,52818,43949,N,43951,43950,52819,52828,N,N,N,N,N,N,N,N, -43953,N,N,N,N,N,N,52816,53587,N,53586,53591,53582,N,53585,53584,N,53588,N, -53592,44615,44618,N,N,53583,53589,N,N,N,44617,53578,N,43952,54458,53590,N, -53581,N,44616,53580,N,N,N,N,N,N,54449,N,N,45292,45296,54465,54447,54461,45297, -54463,N,54469,N,54473,N,N,54464,54452,54460,N,54474,54472,54462,54457,54450, -55462,54448,45301,54455,45302,45298,54445,54467,54453,54451,54470,45299,N, -54476,45293,45295,54459,54454,44619,45294,54456,54471,54475,54466,N,54468,N,N, -N,54446,N,N,N,N,55457,N,55466,55465,46074,55458,N,46075,46073,N,55460,46070, -55464,N,55459,55461,55421,46068,N,55474,55473,55470,46067,46071,46072,53579, -55467,46069,45300,55469,55422,55472,55471,N,55475,N,56559,N,55468,N,N,N,N,N,N, -N,N,55463,56551,46836,46839,46834,56550,56554,56549,N,46828,46838,56546,46832, -56553,N,46830,46829,56556,46831,56558,N,56555,46827,N,N,N,46837,56560,56548, -56557,N,N,56547,N,N,46833,N,46835,N,56552,N,56561,N,N,57693,47568,57699,N,N, -47573,57695,57702,57687,47575,47569,57692,48213,57691,57700,47570,N,47574, -57690,57696,57701,57686,47572,57694,N,N,57698,57704,57688,57697,N,47571,57703, -N,N,N,57689,N,N,N,48217,58699,48215,48214,58701,58706,N,58702,N,58705,48220,N, -48805,48219,N,58698,58704,N,48218,58703,N,58700,N,48216,N,N,N,N,N,N,59725,N, -59727,59722,48833,59724,N,48832,59726,N,N,48835,59728,48834,59721,59723,N,N,N, -N,49317,60620,N,49316,60621,49315,60619,49314,60618,N,49747,49746,61942,61944, -N,61943,50017,50018,N,N,50019,62530,50267,N,N,63443,63442,50674,N,42088,42192, -N,N,42919,N,N,N,N,52831,N,N,N,N,46076,46077,N,56562,47576,57705,58707,51546,N, -N,51888,N,N,N,N,N,52290,52832,53593,44620,N,N,61945,N,50396,42089,42366,51568, -N,42599,42600,N,43357,N,N,N,45303,N,47578,N,47579,47577,N,42090,N,42193,42195, -42194,51547,42196,42401,51569,N,42402,N,N,N,N,N,42601,42602,N,N,N,51659,N, -42920,N,51889,N,N,N,43361,52291,N,43359,43360,43358,53594,N,N,N,43958,43957, -43959,43956,N,52833,43362,43955,N,44621,44622,N,44623,N,54477,N,N,N,46078, -55476,45304,N,N,N,N,46840,N,47581,47580,57706,N,48221,48836,N,61376,63194, -63444,42091,42403,N,42404,51665,42604,42607,N,51663,51661,42606,51664,51666, -51660,42609,42608,42605,42603,51662,N,N,N,N,42931,N,N,42928,51894,51897,51896, -N,42922,42930,N,N,42927,51893,51891,42926,N,N,N,42921,42924,N,51892,51899, -51895,42925,42929,42932,51890,51898,42923,N,N,N,N,N,43367,43375,N,52303,52296, -43376,52307,52292,52299,N,N,43366,52293,43364,52300,52304,43363,N,52305,52298, -N,52301,N,43378,43369,52308,52306,N,43374,43372,52297,43371,52295,52294,43370, -43368,43377,43373,43365,N,52302,N,43961,N,43968,52847,43960,52839,52835,N, -52851,52834,N,43963,52844,43966,43969,N,43964,52848,43967,N,44630,52854,52836, -N,N,52838,52845,52849,52853,52850,52843,52846,N,N,52840,43971,52842,52841, -52852,43962,52837,43970,N,43965,N,N,N,N,N,44636,53602,N,44635,N,N,53600,N, -44624,N,44629,N,53599,53596,53601,44625,53595,N,44628,44626,N,53603,44627, -44631,N,N,44632,N,44634,N,N,N,44633,N,N,N,53597,53598,N,N,N,N,53604,N,54484, -45305,55490,54483,54502,N,N,45376,N,54500,N,45310,45306,54509,54493,54496,N, -45379,54506,54498,45307,45380,N,54503,54501,N,N,54486,54507,54495,54490,N, -54480,54508,54492,54479,N,45378,54497,54510,54494,54482,54487,54478,N,45377,N, -54491,54488,45308,54481,N,54505,45309,N,54489,54485,N,N,54504,N,N,N,N,N,N, -46144,55483,N,55480,55497,55485,55498,N,46146,N,N,N,55494,55491,N,N,N,N,N, -55492,55495,55499,N,54499,55501,56647,N,46147,55502,55478,55488,N,55493,N,N, -46145,46148,55500,55503,55482,55479,N,N,55481,N,N,55486,55484,46149,N,55496,N, -N,55487,N,55489,55477,56570,56568,46914,46912,56643,56569,56644,56640,56567, -56646,56566,56573,46846,46845,46844,56571,56641,46841,46913,N,56564,N,56574, -56563,56572,46842,56642,56565,46843,56645,N,N,N,N,N,N,N,57710,47586,47585, -47587,57722,57712,57718,57707,57721,57720,57724,57717,47582,57716,47588,N, -57709,47583,N,57723,47584,57711,57714,57719,57713,57708,N,N,N,N,57715,58709, -48225,58712,58711,58714,58716,N,48223,N,58710,N,58708,58717,58715,58713,N, -58719,N,58718,48227,48222,N,48224,48226,N,N,58720,59735,N,N,59734,59733,N, -59736,59729,N,59730,59738,59731,N,48837,59740,N,59739,59732,N,60625,49320, -60623,60628,60627,59737,N,49319,N,60626,60622,60630,60629,49318,N,60624,N, -48838,N,N,N,49748,N,N,N,61377,61946,61947,61948,50268,N,N,50269,N,62531,N, -62920,62919,N,N,63195,63196,63445,63655,N,42092,42093,N,42094,42197,42405, -51667,42610,42611,N,42935,42936,42934,42933,N,43379,N,N,52309,43381,43380, -52310,N,N,N,43972,N,44637,53605,N,54512,N,45381,46151,54511,46150,N,47589,N, -57725,48839,N,49321,60631,N,50270,N,50544,N,51570,N,42406,51571,42614,N,42612, -42613,42615,N,42938,42937,N,51900,42939,N,N,51901,52311,N,52312,N,43382,43384, -43386,43383,43387,43385,N,N,N,N,N,43976,43973,43975,43977,43974,53606,52855,N, -N,N,53608,53607,44643,N,44639,N,N,44640,44642,44644,44641,N,44646,44645,N,N,N, -N,N,45386,54514,54513,45385,N,45384,45383,45387,45382,N,N,55509,55506,46153, -55505,55510,N,46155,55508,46152,46154,55507,N,56648,N,56649,56650,N,N,N,N, -47590,47598,57726,47592,47596,57761,47597,47593,47594,47591,47595,48230,55504, -48231,48229,N,48228,59741,48840,60632,60633,N,N,50020,50271,N,42095,N,42616, -43978,N,53609,44647,N,N,45390,45389,45388,46156,46157,55511,47599,48841,42096, -51548,42198,51572,N,N,51668,42617,N,N,N,43388,N,N,N,N,56651,N,N,42097,N,42199, -51669,N,N,51902,N,51903,N,42940,N,N,N,55512,46158,N,56652,N,N,N,49322,42098, -42152,42200,51573,42407,N,42944,42943,42941,42942,N,N,52313,43390,43425,52314, -43389,N,N,43982,52856,43981,43979,43980,44650,44648,N,N,53611,44649,53610,N, -44638,54515,N,N,45392,45393,N,N,45391,N,47600,57762,48232,48233,N,58721,49323, -61378,61379,N,50397,63656,51531,42201,N,42099,N,51575,51574,N,N,N,N,42618, -51671,51672,51670,N,51673,N,N,N,N,N,N,N,51911,N,51906,51908,51910,51907,42948, -51904,N,51905,42945,42946,51909,51912,42947,51913,N,N,N,N,N,N,N,52328,N,52322, -52317,43427,52325,52323,52316,52329,52332,52327,52320,43429,52326,43430,52321, -52324,52315,52319,52331,43431,N,43432,N,52318,52330,43426,43428,N,N,N,N,N,N,N, -N,N,N,N,N,N,52907,52900,52906,52899,52901,52861,52859,N,52908,52905,52857,N, -43984,52903,52904,N,52902,52860,52858,43983,52898,52862,N,N,52897,52909,N,N,N, -N,N,N,N,N,44655,N,44654,N,53612,44651,53614,N,44656,53615,N,N,44659,N,44657, -53616,52910,53618,N,44653,N,44652,N,53613,53617,44658,N,N,N,N,45395,45394,N,N, -N,54517,54521,54523,45396,54526,N,45400,54593,N,45402,N,45398,45406,N,45403, -54519,45397,N,54518,54516,54595,54520,N,45399,54594,45404,54525,54524,45405, -54522,45401,N,N,N,N,54596,N,54592,55527,55534,55523,46161,55519,55535,55513, -55532,55530,55524,N,55533,55526,N,55518,55536,55516,55529,55514,N,55537,N, -46162,N,55531,56655,55517,46159,N,55521,N,46160,55520,55525,N,N,55522,N,N,N, -55528,N,N,N,N,56659,N,N,N,56662,56654,N,56656,N,56661,56660,46915,N,55515, -56658,N,N,46916,N,56653,56657,N,N,N,N,57769,N,57776,57767,N,57774,57765,57773, -57777,57764,57768,57763,N,47601,N,57766,47602,57772,57771,57770,N,N,57775,N,N, -N,N,58725,58727,48235,58728,N,58723,N,58722,58732,N,58730,48234,58733,58724, -58729,58731,58726,N,N,N,N,59745,59750,59744,59749,N,59742,59752,59748,59753, -59747,59743,59751,N,59754,59746,N,60634,49327,N,49325,N,49324,49326,N,N,61380, -N,61810,61949,N,N,62532,62533,N,50272,N,62921,N,50398,N,62922,N,63198,50546,N, -50545,63197,50633,N,63446,N,N,N,N,42100,42619,51674,51914,43189,45407,N,N, -42101,42410,42409,42408,N,N,42949,N,N,44660,N,56663,42102,42103,42104,42202,N, -N,43985,N,52911,N,N,N,46163,42105,51549,42411,42412,51576,N,42620,N,N,N,51915, -N,42950,N,51916,N,N,43438,N,N,52334,43436,43435,52333,43433,52335,43434,43437, -N,43986,N,43988,52915,52912,52913,52914,52916,43987,N,N,53620,53619,N,44662,N, -44661,N,N,N,N,N,45410,54598,N,45409,45411,45408,N,N,N,N,46165,54597,N,46166, -55539,N,46167,55538,46164,N,N,N,N,56666,56668,46917,56667,56665,56664,N,N,N, -57780,47607,47605,N,47606,57778,57779,N,47603,58737,58735,N,48237,58736,48238, -48236,47604,N,N,59757,59755,59756,58734,60636,49328,60635,61381,61382,59758, -61950,N,42106,42413,42622,51675,42621,N,43439,46918,N,42203,42414,43989,46168, -N,51577,N,51578,N,51676,N,N,42952,51920,51918,42953,51917,51919,51921,N,42951, -N,N,N,N,N,43443,43444,43441,N,N,43440,52920,43442,N,N,N,43990,N,52919,52921, -52918,52922,43991,44665,53621,N,53623,44663,53624,44664,53622,N,52917,54599, -54602,54603,54600,45415,45414,45412,45413,54601,N,N,N,N,45416,N,N,46170,46171, -N,46172,56669,56671,56673,46920,46919,46169,56672,56670,N,57784,N,N,57782, -57788,47608,57789,57786,47609,57783,57781,57787,48240,58739,57785,48242,58740, -48241,48244,58741,48239,48243,N,59763,59761,59760,59762,59759,N,N,50022,N, -62534,62535,N,62923,63199,50773,N,N,43445,42954,N,N,43992,N,N,N,42107,42204, -42415,51677,N,42955,51922,N,52923,43993,N,47610,42108,N,N,N,42657,N,N,46921, -42109,42205,42206,N,42417,42416,N,51678,42658,N,51923,N,42956,N,N,52337,52338, -52339,N,43446,43447,52336,43448,N,N,N,43994,52924,N,53626,44666,N,53625,N, -45417,54604,45418,54605,N,N,N,46173,N,N,N,56674,N,N,57791,57790,N,47611,N, -48245,58742,48842,59764,49329,N,50547,63448,N,N,N,N,52340,N,52925,45419,55540, -46922,N,N,N,49749,N,N,N,N,42958,N,42957,43995,N,53627,N,45421,45891,45422, -45420,46174,N,57792,47612,48246,N,51532,51679,N,51925,42959,51924,42960,N,N, -43452,52343,52342,43451,43449,43450,52341,N,N,43997,52926,44000,43996,44002, -43998,43999,44001,N,N,N,44669,44668,44667,N,N,N,54607,45423,45426,45424,N, -54606,45429,N,45425,54608,45428,45427,N,N,N,55542,55541,N,46177,46175,46176, -55543,46923,56676,46924,56675,N,N,58743,N,N,48248,57793,48247,N,47613,N,60638, -59765,49330,60637,62016,62536,62537,N,42207,N,42418,N,N,N,51579,N,N,42962, -42964,N,51682,51928,51927,51926,N,51681,51680,42660,42963,42961,42659,N,N,N, -43453,52344,N,43454,51933,N,51935,51934,52345,N,N,51930,N,42968,42966,N,51929, -51931,51937,N,42965,N,51932,51941,43456,N,51938,42967,N,51936,51939,N,43455,N, -43457,51940,N,N,N,N,N,N,N,N,52399,52386,52350,52398,52393,44007,43458,52394, -52397,44003,52396,43459,43464,43462,52387,N,52348,52389,43469,52400,44004, -52390,N,44005,43465,52392,N,52941,44006,52347,43466,44008,43467,43463,43468, -52391,52346,52395,43460,N,N,52349,52388,52385,43461,N,52927,N,52928,N,N,N,N,N, -N,52938,53665,52939,44014,52942,52932,44013,52934,N,52935,N,N,52937,44009,N,N, -44707,N,N,52933,52929,44708,N,N,52943,44670,53629,52936,N,53628,52931,52940,N, -N,44012,44705,44018,44706,52944,53630,44011,44710,44017,44016,44015,44709, -52945,44711,44010,N,52930,N,N,N,N,N,N,N,N,N,N,N,N,45430,53668,53670,N,53672, -44712,44718,54611,53676,53667,45432,54609,N,44717,44715,53678,N,54610,N,53669, -N,44716,53673,44719,53675,N,N,44714,53674,53677,53671,N,44713,45433,N,53666, -45431,N,N,N,N,45434,N,N,N,N,N,N,N,54613,54622,46180,N,45436,45475,46181,54624, -45482,55545,54614,45474,45477,45438,54612,54626,54629,55625,N,54627,55549, -45473,45480,45484,54621,55544,54625,45435,55546,54628,55548,54617,N,46178,N, -54615,54616,45479,N,N,45478,54619,45483,54623,45476,54620,N,45481,46182,46179, -55547,N,54618,N,45437,N,N,N,N,N,N,N,N,N,46187,46191,55616,46929,46189,55620, -46193,56677,55622,46931,46185,46188,55623,N,55624,55630,46195,46932,N,55626, -55631,55619,46942,N,46933,46194,55617,55632,N,46941,46192,46926,55629,N,46196, -55621,55550,46186,55618,N,55627,N,46925,46930,46183,55628,N,46928,N,N,N,46184, -N,N,N,46940,57795,56688,N,56680,57794,N,56684,56686,N,N,56683,N,46939,N,56682, -46943,N,N,N,57810,N,N,46938,47680,56689,57796,N,N,46936,56681,56685,47614, -46927,56678,56679,47681,46935,46937,46934,56687,N,N,57800,57801,57806,48253, -57813,N,47687,N,47686,57808,N,48252,57797,47685,N,57812,47683,47684,N,57809, -58794,48250,46190,N,57811,48291,57803,N,48251,N,48290,57798,57802,57799,57805, -47688,48249,47682,N,58746,57807,N,48289,N,48292,N,57804,N,48254,58745,N,N,N,N, -N,58750,48846,58744,59811,58793,48296,N,48294,48844,58790,58786,48300,N,59768, -N,N,N,48298,58785,N,59766,N,58789,N,58792,58749,N,48299,N,N,48293,59767,48845, -58791,48295,48297,58788,48301,58787,58748,58747,48843,58795,59770,60640,48848, -N,59810,N,59774,N,60641,N,48849,59809,N,59772,49332,60639,N,59769,59771,49333, -48851,49331,48850,49335,59773,48847,N,N,N,N,N,N,N,N,61391,N,61383,N,N,N,N,N, -60647,61384,60643,N,N,49750,60645,60644,49334,60642,60646,61392,61388,61390,N, -61385,61386,N,61389,61387,50023,N,N,50026,50025,50024,50273,62538,50274,62017, -50399,62924,50400,50548,50634,63449,N,63450,63451,N,N,63930,42208,51580,42419, -N,42662,42663,42661,N,42664,42970,42969,N,52401,43471,43470,N,N,53679,45485, -45486,N,N,N,46197,56690,46944,46945,56692,56694,56693,N,57815,N,57814,47689, -57816,N,58796,48302,N,48852,N,49336,49751,49337,N,42209,N,N,N,51942,N,N,52402, -43473,43472,43474,44019,52946,52947,N,N,53680,44720,45487,46198,55633,42210,N, -42110,42211,N,51581,42423,42422,42420,42421,N,N,N,42667,51689,51691,42666, -51683,N,51684,N,51690,51686,51688,42665,51685,51692,51687,N,N,N,N,N,N,42977, -42986,42984,51952,51949,51957,42982,51958,N,42975,51955,N,42981,51951,51950, -42979,51956,42980,43475,42974,51953,N,51943,42971,N,42990,51948,51954,42976, -42978,N,51944,N,51945,51946,N,42989,42983,42988,51947,42987,42973,42972,42985, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43489,52414,52407,43484,43503,52403,52410,52412, -52415,43498,N,52411,52404,43496,52408,N,52416,43481,N,52413,43491,43490,52406, -43479,N,N,43480,N,43478,N,43502,43494,43488,43476,52409,43487,43477,43495, -43504,52948,43492,52405,43482,43485,43486,N,43500,43501,43499,43493,43497, -43483,44020,N,N,N,N,N,N,N,N,N,N,N,N,N,N,52954,44097,44024,44026,44096,52966, -44029,53681,44721,44099,52951,52959,44030,52958,52955,52963,52965,44023,44027, -44098,44723,52960,44025,44101,52953,N,N,N,44028,44722,44022,N,52950,52957, -52949,52952,52956,53682,44100,N,52961,52962,52964,44021,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,44737,53694,44735,44736,53684,53700,N,44726,N,N,54630,53702,53696, -N,53687,N,53705,53690,44732,54653,53693,44734,44725,N,53707,53695,44728,53688, -53685,53686,44729,53701,53708,44731,53692,53691,44739,44738,44724,44730,44733, -53704,N,N,53698,44727,53683,53706,53697,53699,53703,N,N,N,N,N,N,N,N,N,N,54631, -N,45495,45515,45514,N,45503,N,54649,54645,54642,54694,45498,45490,N,N,54647, -46248,45494,54689,N,45516,45513,54651,54634,N,N,45512,54691,54633,45501,45505, -54690,N,54643,45506,45500,54632,N,46200,54693,54641,45511,54644,54692,45510,N, -55634,N,45491,54639,45496,45507,N,45502,54648,54638,54636,54654,45488,45508, -45492,46199,54652,45493,N,45489,45504,45499,45497,54640,45509,54637,54650, -54646,55636,55635,N,N,N,N,N,N,N,N,N,N,N,54635,55652,N,46202,N,55658,55641, -55655,56695,46205,55659,55662,46204,55644,55661,55660,46206,55637,46201,46243, -N,46241,55657,N,55647,46245,55664,55656,55665,46253,46251,55654,55653,N,55651, -55645,46244,N,46242,53689,55638,N,56759,55639,46203,46250,56697,N,46246,46247, -55640,55663,56696,55648,55643,46249,55649,55646,N,N,46254,46960,N,N,56700, -56753,56758,56746,46956,56763,46953,56698,N,56699,46946,46955,56740,46958, -46959,56741,N,56754,56760,46954,N,46948,56739,56701,56762,56744,56745,56702, -56756,56747,56757,56749,N,46949,57817,46952,46950,56761,56752,56748,N,N,56737, -47699,56751,46957,56743,N,56742,N,N,N,46951,46947,57838,56755,56750,N,56738,N, -N,N,N,N,N,N,57833,N,57818,57829,N,57836,47697,46252,57834,47692,N,N,N,47691, -57841,N,57819,57832,57820,57831,47695,57835,55650,N,N,N,57842,57827,47698, -58810,48303,N,57840,57839,47700,58797,48304,58798,N,57823,57824,57821,57826, -57822,57843,47694,48305,47696,47701,N,57825,N,57837,N,N,57830,N,N,58801,N, -47690,48308,59818,58806,58805,58807,N,N,58804,48309,N,48315,48312,N,48313, -58799,58802,58812,48321,48319,N,58803,55642,48306,58809,58800,N,48322,58808, -47693,48311,57828,N,N,48314,N,48318,48320,48317,48316,N,48310,58811,48307, -48323,N,N,N,N,N,N,N,48856,48857,59817,48866,48863,N,48854,48861,59819,48859, -48853,N,48860,N,59816,49339,48855,N,48862,49338,59815,59814,N,48864,N,48865,N, -59813,59812,49340,59822,48858,59820,N,N,N,N,49341,N,49346,60650,60652,N,49343, -N,60653,60649,N,60651,49344,49347,N,60648,49342,49345,49753,59821,49752,N,N, -49758,61396,N,49756,49757,61399,61395,49754,61393,50027,61397,N,61398,61394,N, -49755,62018,N,62021,N,N,62022,62020,62023,50028,62019,N,N,62542,50276,62541, -62540,62539,50275,50277,N,62925,50402,50401,N,N,63201,63200,63203,50635,50549, -63453,63202,N,N,63452,50637,50636,50675,63657,63727,42212,N,N,55666,59823,N,N, -42668,51959,42993,42991,N,42992,N,52417,43505,44102,N,52967,N,52968,N,44103, -53710,N,44740,44741,53709,N,N,N,N,45523,N,45519,N,54695,45526,45525,45518, -45521,45524,45520,N,N,55670,45517,46255,N,N,N,46257,46258,55669,55672,46256, -55667,55671,N,55668,N,46961,N,N,56764,N,N,47702,57844,48867,48324,58813,48325, -48326,58815,58814,58816,59825,N,N,59824,60655,60654,49348,49349,62024,N,N, -42213,N,N,N,N,55673,N,N,N,46260,46259,56765,N,61400,50403,63454,42214,N,44742, -N,45528,45527,55674,55675,46962,57845,47703,59826,N,42215,42424,N,43506,52418, -N,52969,44104,45529,N,55676,46261,46963,N,58817,58818,N,N,60656,49759,63728, -42216,N,52419,43507,44105,N,52970,N,44743,53714,53712,53713,44744,53711,N,N,N, -N,45531,45532,54696,45533,45530,55677,N,55678,56766,N,N,47705,47704,N,N,60657, -61401,N,62026,62025,62543,N,51550,44106,N,N,42217,42425,N,42670,42669,N,N, -42671,42672,51694,51693,51960,42994,51963,51962,51961,51964,N,N,N,N,43508, -52425,52421,52430,43515,N,43513,52426,52422,52429,43512,43584,52424,52420, -43518,52427,43511,52428,43514,43516,52432,52431,52423,43510,43509,43517,N,N,N, -N,N,N,52975,52981,N,44112,44109,52972,52977,N,44115,44107,52976,44110,44113,N, -N,52979,N,44108,52984,44111,N,44114,52973,52978,52982,52974,52971,N,N,52983, -52980,N,N,N,N,N,N,44752,44745,44748,N,44751,N,53717,N,44746,53715,N,44750,N,N, -44747,N,53718,44749,N,N,N,N,N,N,54700,45535,54699,54701,45534,45539,53716,N, -54698,54702,N,45536,54697,45538,N,45537,N,55719,N,55714,N,46262,46266,46263, -55717,55720,N,46264,N,46265,46270,56775,55718,46268,55715,55713,N,46269,N, -55716,N,N,N,46969,N,56767,46966,46967,46965,56772,56771,56768,46971,N,N,56770, -46267,N,N,56774,56769,46968,46964,46970,56773,N,N,N,47708,N,57848,57847,57846, -47706,N,N,N,N,N,47707,58821,58824,48328,N,N,48327,58825,58820,48330,58822,N, -48329,58819,N,58823,48873,48870,59835,59834,N,59833,59828,N,59829,N,N,N,48871, -N,48868,48872,59827,48869,59830,59831,59836,N,N,59832,N,N,60658,N,N,N,49351,N, -61404,49350,61402,61403,49760,50030,62027,N,50029,N,N,62545,62546,N,50278,N, -62544,50404,N,63455,50638,63658,63659,N,42218,N,42673,42674,42995,N,52433, -44116,44753,45540,N,N,45266,N,46271,46272,46028,55721,N,46972,57850,57849,N,N, -42219,42675,52434,43586,N,43585,N,52985,52986,N,53719,53720,44754,44755,N, -44756,54703,N,N,45542,N,46274,N,46273,56776,57210,57851,59837,N,N,49761,50279, -42220,N,42428,42429,42427,42430,42426,N,N,42678,N,51702,42677,42679,N,N,51697, -51696,51699,51698,51701,42676,51695,51700,N,N,N,N,N,51965,43005,51966,52035, -43004,N,52039,52034,52037,42997,42998,42999,43000,N,43072,N,52033,43002,43073, -N,52032,52038,N,43001,52036,43003,42996,43006,N,N,N,N,N,N,N,N,N,43607,N,52436, -43587,N,43597,43598,43590,43608,43592,52444,43603,52439,43593,52454,52455, -52447,52440,43606,52452,43601,43599,N,52453,N,52451,52443,52435,52442,43594,N, -43600,N,43588,52446,52445,52437,N,43602,52449,52438,43605,52456,43589,N,43596, -52441,52450,43604,N,43591,43595,N,52448,N,N,N,N,N,N,N,N,N,N,N,N,N,N,53083, -44124,44137,N,53078,53068,44130,53066,44123,53061,44133,53074,52990,53057,N,N, -N,N,53060,52987,53073,53089,44128,53062,53080,N,52989,53087,53088,53091,53082, -53067,53075,44134,44121,44129,44141,44118,44120,N,N,N,53059,44138,44131,53085, -53056,44140,44135,53065,N,N,44139,53072,53064,44132,53084,53076,N,44126,53090, -53063,44122,53081,53071,44127,53077,44119,52988,44136,44771,44125,53070,53069, -53058,N,53086,N,53079,N,N,44117,53740,44778,53741,N,53729,44767,44779,N,53722, -N,53731,53739,N,53721,53748,44757,N,N,N,53747,53742,N,53743,44765,44776,53733, -N,53734,53744,53735,N,53730,53724,53725,53738,53732,N,N,44758,44762,53746, -53726,44774,44770,N,N,44773,44780,44763,44775,53737,44777,44760,N,44759,53723, -N,53727,44768,53745,53736,53728,44772,44769,N,44761,44764,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,54724,N,54708,54709,54713,N,54728,54725,N,54718,54717, -45549,54721,54736,54704,N,54737,54723,54741,54729,45548,54727,45543,45564, -45554,N,45558,45557,54705,N,54734,54740,54732,54739,N,N,54720,54706,54738, -54722,45546,45559,N,54731,45552,N,N,N,54730,54707,45560,N,45562,54733,45563, -45545,54714,54735,N,N,45551,45561,54716,54726,54711,54715,45556,54710,45544, -45553,45550,54719,44766,55744,45547,N,N,N,N,N,N,N,N,N,N,N,N,N,N,45555,N,55747, -55769,55758,46294,N,46289,55741,46290,55757,N,55750,55763,46286,55723,55765, -46276,55731,46279,46278,N,46295,N,55725,55759,55760,46281,46277,55739,N,46288, -55734,N,55761,46284,55753,55766,55728,55733,55727,N,46283,55746,56798,55729, -46287,55738,55762,46282,55735,55732,55749,46285,46275,46297,55752,55751,55724, -46280,55764,55740,55742,N,55755,55754,55722,46291,46293,55730,55737,55745, -46292,55736,55748,55767,N,55756,N,N,N,N,N,N,N,N,N,N,N,N,N,55768,N,N,N,N,55726, -N,N,N,N,56818,47014,N,56816,56795,56800,56793,N,56812,56779,56786,N,56810, -56820,56796,N,56783,56802,56807,56787,N,56804,56784,N,N,56791,56792,47016, -56811,56809,N,56780,56814,N,56815,56817,47020,47012,N,54712,56788,56806,56789, -47009,47025,56813,47023,47019,56778,47011,N,56781,47024,N,56797,56777,N,47017, -56801,56785,47018,56794,46974,46296,56803,55743,56782,N,N,56808,47013,56805, -47010,56799,47021,56790,56819,N,N,N,N,N,N,47015,57030,N,N,47022,N,N,N,N,N,N, -57930,57928,N,57950,57926,N,57944,46973,47711,57922,57949,N,57927,57941,47716, -47709,N,57947,N,57920,57946,N,47727,57937,57953,47725,57929,47710,57931,57945, -47719,57924,47723,47713,57933,57923,57852,N,57943,47720,57952,57853,47717,N, -57939,N,47718,57925,57936,57932,57934,N,47712,57951,47726,57935,N,57954,N,N, -57854,57940,47715,47724,47722,57921,57942,47721,N,N,47714,57938,N,N,N,N,57948, -N,N,N,N,N,N,N,N,58837,N,58833,58829,58849,58846,48333,N,N,58853,58836,48344, -58843,N,N,58832,58842,48341,58862,N,58859,58845,58830,N,N,58850,58852,48337, -58840,58835,58826,48334,48342,N,58855,48343,58827,58861,58848,58854,48340,N,N, -58851,N,58858,N,48345,N,48339,58844,58831,58863,58828,58856,48336,N,58838,N, -58839,48335,48332,58834,48338,N,48331,N,58857,58860,58841,59850,N,N,N,N,N,N,N, -N,N,59842,N,59838,48886,N,N,48875,48880,48876,59852,59863,48874,59844,59853, -58847,59854,N,N,48881,N,59869,48885,48888,59840,N,48884,N,59867,59868,59858, -59857,59849,N,N,59859,59866,59865,N,48879,48877,59851,59848,N,59845,59864, -48887,59862,48883,48882,N,59856,N,59839,59841,59843,59861,59855,48878,N,59846, -N,59860,N,N,N,N,N,N,59847,N,N,N,N,N,N,N,49359,60741,49352,60661,N,60737,49354, -60744,N,60668,N,60663,N,N,60745,60659,60670,N,49361,60740,60746,60669,49353, -60736,60660,49360,N,N,60743,60665,49356,N,60667,60664,49362,60666,49355,49358, -60739,60662,60742,N,60738,N,N,N,49763,61415,49768,49769,N,N,N,49762,61414,N, -61411,61412,49766,61406,61410,49765,N,61407,N,N,N,N,49767,49764,N,61405,61409, -61413,N,N,N,62033,62030,62039,N,62038,62036,62031,N,50034,N,N,N,N,N,62032, -50033,49357,62035,50032,62040,62034,62029,61408,N,N,N,50031,N,62028,62550,N, -62549,62037,50280,N,62553,62554,62548,62552,N,62547,N,N,N,N,62929,62551,50407, -50405,62927,62930,N,62926,62928,50406,N,N,N,63205,63206,50550,63204,N,N,N, -63458,50639,63456,63457,63660,N,N,50774,63731,63729,63730,63732,N,N,N,63931,N, -42221,42680,N,43609,N,52457,N,N,53092,N,N,N,53749,53751,N,53750,N,53752,45565, -54743,53753,N,54742,54744,54745,55770,46299,55771,55773,46300,46298,55772,N, -56826,56824,56823,N,56822,56821,47026,56825,47728,57955,57957,47729,57956, -48347,N,48346,58864,N,N,59871,59870,59872,N,N,48889,N,60747,49363,N,61416, -49770,62041,50551,42222,42431,42681,43074,43610,43611,N,N,44142,N,N,53754,N,N, -N,N,47027,N,N,N,59089,48890,49771,42223,N,42682,N,N,52459,43612,52458,N,53093, -44143,53094,N,44144,N,53756,44782,44781,N,54750,54748,54749,54747,N,54746,N,N, -55774,55777,46302,55775,46301,55776,N,56827,N,N,57958,57959,57960,N,58867, -58866,48348,58865,58868,59873,N,N,59874,59875,N,60748,49364,49772,62042,N, -50408,51551,N,44145,53095,44783,N,N,45566,N,46303,55778,N,47029,47028,N,N, -57961,57962,48349,48350,59877,59876,61417,63459,42224,51552,42432,N,43075, -52040,N,44146,47030,42225,N,53096,44147,53097,N,49365,42226,N,N,52460,N,53098, -N,53826,53825,53758,N,53757,53827,53824,N,N,45632,45633,N,N,46304,55779,N, -55780,55781,N,N,N,56897,56898,56896,N,56829,56830,47031,57963,58871,58870, -58869,58872,59879,59878,48891,59880,N,49366,60749,N,61418,62043,63207,N,42227, -42434,42433,N,43613,51553,51582,42683,N,51703,52041,52042,43614,N,52461,N, -44148,53099,53100,N,44784,44788,53828,44787,44785,44786,N,54751,45634,46307,N, -46305,46306,55782,N,N,47730,42228,N,51617,N,42435,N,N,51620,N,N,42438,51619, -42437,42436,43076,51618,N,N,51704,N,N,N,51708,51710,51776,42693,42694,51707, -42689,N,51705,N,51709,42690,N,42685,N,42686,N,42692,51706,42684,43077,42687, -42688,42691,N,N,N,52059,52057,52044,43089,52051,43084,52045,N,52053,N,52050, -43087,52049,43094,52058,43096,N,43098,N,52043,N,43085,52060,N,43092,43095,N, -52549,43079,43102,43093,52046,43082,43097,52054,43080,43081,52547,52047,43088, -43099,52061,52048,43086,N,43091,52462,43100,52055,43090,N,43101,43078,52052, -43083,52056,52548,N,N,N,N,N,N,N,N,N,N,N,N,N,43626,43642,52469,43633,N,52555, -43618,N,43621,52546,N,52467,52471,43629,43631,52474,43638,43624,43622,43623, -43637,52551,43632,52473,52475,43630,43635,52476,52554,N,44149,43641,N,43619, -52553,N,52557,52472,52559,52544,43628,52468,43627,43645,43634,N,52466,53109, -43640,43644,52545,52550,N,43646,43639,43625,43615,N,43620,N,52470,43616,52558, -N,52464,52463,52477,52465,43643,44789,43636,52478,43617,N,44198,N,N,N,52556, -53116,53153,N,53156,53111,N,N,53159,53162,53164,53108,44150,44155,53833,44205, -53157,53165,53115,53107,N,N,N,53860,44158,53154,53112,53114,44197,N,53117, -44157,53104,53160,N,53163,N,N,44154,N,44200,53101,44202,44152,44206,53161, -53103,44203,53854,52552,44156,44151,53110,53102,44204,44196,53155,44201,44199, -53113,44193,53105,44194,44195,53106,53158,44153,53118,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,53836,44797,44867,N,N,N,53845,53851,53847,53834,53837,53830, -53831,44874,44794,53846,53855,44869,44790,N,44864,53838,44866,53839,53849,N,N, -N,44868,53864,53832,44796,44795,44872,53829,53862,53850,53863,53857,53843, -53858,N,53852,53861,53859,44873,53844,44793,44792,44865,44871,53856,44870, -53841,45635,N,53865,53840,53835,44798,44875,44791,N,53848,53853,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,45669,54753,54757,N,45650,45648,N,N,45639,54755,54754, -45659,N,54760,45653,N,54778,54855,45636,54775,54768,45671,54752,N,54780,N, -45668,45656,45667,45646,54764,54782,54774,45647,45641,54853,N,54781,54848, -45649,45657,54850,54762,54779,54767,54852,45662,45638,45660,54772,54770,54771, -45651,54766,54765,45640,54759,54854,45642,54769,45672,N,45666,54758,45663, -45661,45670,54776,45665,53842,54777,45664,54849,45637,54773,45655,54761,45654, -N,45652,45644,45643,55783,54851,54763,N,N,55804,N,45645,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,46401,45658,46318,55798,46332,N,55786,46315,46311,55881,46317, -46321,46316,46325,55885,55876,N,N,55793,46330,46324,55805,46308,55882,55875, -46312,55799,46327,55893,55894,N,46309,55880,46329,55803,55789,55790,46333, -55794,55801,55795,N,46331,46404,55791,55784,55785,N,55787,46314,55800,N,46328, -46402,N,N,55802,55891,55883,46310,55889,46322,N,46320,N,55895,46319,55873, -55796,55806,46407,55877,55874,55792,46403,55887,55884,55892,46313,55872,46406, -N,55879,N,N,46323,46326,N,55878,46405,55797,54756,N,N,55888,55886,55890,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,55788,46400,N,N,N,56929,56928,56902,47037,N,56927,56905, -56906,N,47047,56936,47042,56926,N,56899,47048,47038,56914,56904,56907,56931, -47032,56938,56930,47041,56919,47052,N,N,47051,47045,N,N,56937,47033,56917, -56908,56921,56933,47053,N,47035,56916,N,56909,47044,N,47043,56912,56922,56932, -56903,56913,47036,56923,47049,47040,56910,47039,56901,56915,56935,46334,47792, -56918,57964,56920,56934,47046,56911,47034,47050,48368,56900,N,56925,N,N,N, -56924,N,N,N,N,N,N,N,N,N,N,N,N,N,N,58026,47789,57981,58020,47778,N,57966,47791, -N,47735,57965,58032,47793,57969,58019,N,57971,58035,58031,47733,47777,58963, -47790,47741,57967,N,58030,47779,58027,58040,57973,57982,N,N,58038,58028,47740, -N,N,57980,47734,47732,47784,N,N,57978,57975,57976,N,58034,N,58039,58037,47738, -58041,47742,47783,N,57968,58874,57977,N,47736,47788,47785,47739,58021,57972, -47786,58023,47780,47782,47731,N,58025,58017,57970,47781,58033,58036,57979, -58024,N,47737,48351,58022,58873,N,58029,N,N,N,N,N,N,N,N,N,N,57974,58948,58958, -48354,58957,58969,48356,58955,N,58959,48367,N,58950,48359,N,58962,59888,48371, -48370,58964,58947,58974,48365,N,48355,58967,N,58971,58976,58965,58953,48358, -48361,48369,48364,N,58956,58018,N,N,58952,58975,48360,N,48363,58977,48352, -58966,58875,58972,49375,N,58954,N,48353,58949,48357,58876,47787,58945,N,58970, -58946,58944,48362,N,58968,N,58878,58961,58960,58973,58951,48366,N,N,N,N,N,N, -59891,N,48969,48894,59968,59883,48961,59895,48968,48963,59893,60751,59899, -59970,59898,59881,59896,59972,59974,48893,59973,48964,48970,N,48967,N,59902, -48966,59897,N,59885,59890,N,59901,48965,48962,48892,48960,59889,N,58877,59884, -59887,59969,59892,59882,60750,59971,59886,59900,N,N,N,N,60753,49379,N,N,49367, -N,N,49371,60755,60761,60759,49369,49370,49377,60762,60754,49372,N,60758,60757, -60763,49378,N,49373,49376,60756,49380,49374,49381,49368,60760,N,60752,N,N, -61431,N,N,49777,61428,61430,N,49775,61426,61427,61422,N,N,59894,61423,49776, -61419,N,49773,61432,49774,61420,61421,61425,49779,N,49778,N,N,61424,50040, -62047,62053,50041,62044,50038,50035,62055,50039,N,50036,62046,62049,62050, -62051,62054,N,61429,62045,50037,62052,62056,62048,N,N,N,62557,50282,62560, -50283,62568,62559,62556,N,62558,62562,62565,62564,62567,62555,N,50281,62563, -62566,62569,62561,62931,62932,62936,62937,N,62934,62935,62933,N,50409,N,N,N,N, -50552,63211,N,N,63208,63209,63210,50553,N,63461,63460,N,63663,50676,63661, -63664,63662,63733,50775,50789,63907,63852,N,63906,63952,63953,42229,N,N,N,N, -42695,51777,N,N,52062,N,43103,N,43106,N,52063,N,43104,43105,N,N,N,N,52568, -52570,52565,52562,52564,N,N,N,43684,N,N,N,43682,N,N,52566,43683,52563,52560, -43681,52567,N,52561,43685,52569,N,N,N,N,53167,N,53171,N,N,44215,N,N,N,N,53174, -N,44207,44210,44212,44214,44211,53170,53169,N,44209,53172,53173,N,53166,44213, -N,44208,N,N,N,53168,N,N,N,N,N,N,53879,53880,53881,44880,N,44876,53870,N,53878, -53883,44881,N,53868,53874,53867,53877,N,N,53873,44877,44879,53882,N,53866, -53869,53875,N,53876,53884,53872,N,44878,N,N,N,N,N,N,N,N,N,N,45677,54862,N,N, -54864,54860,N,54872,54858,54871,45673,54856,55899,54866,45676,N,54867,54870,N, -54874,N,54863,N,54868,N,N,45674,45675,54873,54861,54857,54875,N,54865,N,N, -54869,N,N,N,54859,N,46408,46409,55909,46415,N,55897,55906,55896,46412,55904, -55902,N,55903,46410,N,55907,N,N,N,N,N,55900,55898,46411,55901,55905,N,N,N, -46413,N,N,N,55908,N,N,N,N,N,N,56944,56951,56953,56993,N,47066,56939,N,47058,N, -56954,47063,56994,47054,N,56957,N,56941,56958,56940,N,47068,N,56952,47055, -56995,N,47060,56945,47065,56956,56943,56950,56946,56942,47057,47064,47062, -47059,47067,47056,56949,N,47061,N,46414,N,56955,N,56947,N,N,N,N,N,56948,N,N, -58049,N,47796,N,N,58045,58051,58047,N,47798,58046,58050,58042,N,58044,47797,N, -N,N,N,58048,58043,N,47799,N,47794,N,N,58052,N,47795,58983,58980,58992,58986, -58988,48372,58982,58990,N,N,58989,58987,N,58993,48375,58984,58991,N,48373,N,N, -58979,58981,48374,58978,58994,N,58985,N,N,59978,48977,N,N,59989,59987,48971, -59977,59980,59981,59976,48981,48982,59975,59990,59985,48975,48972,59984,59982, -N,N,48978,59986,48973,N,48974,N,59983,48976,59979,N,59988,48979,59991,59992, -48980,N,N,49383,49390,60764,60770,N,60768,49386,49385,49382,60766,N,N,N,49388, -49387,49384,N,60769,60765,60767,N,49389,N,N,N,49783,61435,N,49780,49781,61437, -49782,61434,61433,62060,61436,N,62061,50042,62059,N,N,62058,N,62057,50043,N,N, -50284,N,N,62570,62571,N,N,N,N,62940,62939,50410,N,62938,63212,63213,N,N,63462, -63665,N,N,63734,63932,50809,63942,42230,N,43686,43687,N,N,44216,N,N,N,N,49391, -42231,N,43688,44882,47069,42232,N,45678,47800,51554,N,53175,53885,N,58053,N, -49392,42233,43689,53176,53177,55910,46416,N,N,56996,N,N,47070,58054,N,N,48376, -N,50044,42234,55911,42235,N,42697,51778,42696,43109,43108,43107,52064,N,N,N, -43690,N,43691,52571,N,53178,N,53181,44218,53179,N,44217,53180,44219,N,53922, -53921,53886,44883,N,54877,54878,45679,54876,54879,46418,45680,N,N,46417,55915, -55914,N,55912,55913,N,55916,56998,56997,57001,N,57000,56999,47801,58057,N, -58056,47802,58055,58995,N,58996,48377,N,59993,59994,N,N,62066,50045,62065, -62064,62062,62063,50411,62572,63214,63735,N,42236,N,51621,42439,51622,N,N,N, -51779,51780,N,N,N,N,52070,N,N,52066,N,52065,43692,52069,43111,52067,43110, -52071,52068,N,N,52575,53182,52573,52580,N,43693,N,43696,52581,52577,N,52578,N, -52572,43695,52574,43694,52579,N,52576,N,N,53186,44221,44222,N,53189,53183,N, -53188,N,53184,44220,53187,53185,N,N,N,N,N,N,N,53928,53925,N,53927,44888,44887, -44885,53924,53929,44884,44886,53926,54887,53923,53930,N,N,N,N,N,54882,54886,N, -54885,55918,55929,N,N,54888,N,54883,55917,45684,N,N,45683,54881,54884,45685,N, -45682,45681,54880,54889,N,N,N,55920,55927,N,46420,55926,55923,N,46422,N,N,N, -55925,N,N,55919,55921,55924,55922,46421,55928,46419,47071,N,N,57005,57004, -57002,N,47074,47073,57006,N,57003,58058,47803,47072,N,N,N,57008,57007,N,58061, -58059,48378,N,47804,58060,58998,N,N,N,N,48379,58997,59006,59005,59003,N,59002, -58999,59000,59001,59004,59041,N,N,59999,59996,59997,48983,59995,60001,60000, -59998,N,60772,60773,49393,N,49394,60771,N,49785,61438,49784,50046,N,50081, -50285,62574,62573,62941,63215,50554,63464,63463,63465,42440,53190,44889,45686, -54890,42441,51623,42237,N,N,51781,N,N,N,52076,52074,52075,52072,43112,52073,N, -N,N,N,N,52589,N,43699,52587,52583,52586,N,52582,43701,52585,N,43698,43697,N, -43700,52588,52584,N,N,N,N,44226,44229,53198,53197,53196,44223,53205,53195,N, -44225,53935,N,53202,53200,44228,N,53192,53203,N,53194,53204,53201,53193,N, -44224,53206,53191,44227,N,N,N,N,53940,53931,53942,N,53934,53945,53946,53932, -53944,53941,53939,53943,44895,N,44893,N,N,53937,N,53933,N,53936,53947,53938, -44894,53199,N,44890,44892,N,N,N,N,N,54904,54893,54891,N,54892,N,54899,N,54900, -54896,45691,54901,54898,54895,N,45689,54894,45687,45690,54897,54905,44891, -45688,54903,54902,45692,N,N,N,N,N,N,N,N,55934,N,N,N,55969,46432,N,55975,N,N, -55977,55970,46426,55974,55973,46427,46433,N,46434,55976,46424,55933,55931, -55971,55930,46431,55932,55972,55978,46425,46430,46428,46429,N,N,N,46423,N,N,N, -N,47081,57015,47080,57019,N,57009,N,57020,N,N,N,57010,57011,N,57021,57018, -57016,57017,57013,57012,N,57022,47077,N,57014,N,47082,47076,47083,47084,N, -47079,47078,N,N,58062,47806,47805,N,N,58067,N,48380,47807,N,N,47809,58068, -47075,47808,58064,58066,58063,N,58065,N,N,N,59051,N,N,59050,59047,48448,60002, -48449,59046,N,48382,N,59048,59045,59042,59049,59043,59044,48381,N,N,N,N,60777, -N,60006,N,60005,60007,N,60774,48986,N,60003,N,48984,N,48988,48987,60004,60008, -N,48985,N,60781,49397,49786,49398,49395,60778,60776,N,60779,N,60782,49396, -60780,60775,N,N,61506,61509,62069,61504,N,62575,61510,N,50082,61508,49787, -61505,61507,61511,62070,N,62068,N,N,N,N,50083,62067,N,N,N,50286,N,N,N,N,50413, -63217,50412,63219,63216,63218,50640,63666,42442,52590,53948,53949,45693,57023, -48989,50084,50555,63667,42443,N,52591,41568,N,N,53207,N,53208,N,N,N,N,N,53950, -53951,45694,45729,N,N,N,55979,N,57026,57025,57024,58069,N,58070,58071,47810,N, -N,59053,59052,N,N,60009,48990,48991,N,60786,60783,60784,60785,61513,61512, -49788,62071,62942,42444,N,44230,N,45730,57027,N,42445,N,53952,45731,N,N,46435, -46436,N,42446,42447,51782,43114,43113,44231,53209,55980,42448,42449,42450, -42451,N,N,N,43115,43116,52078,52077,N,N,43702,52594,52592,52593,N,N,N,N,N,N, -53210,53211,N,N,44235,44233,N,44234,44232,N,N,N,N,44896,N,N,N,N,44900,44899, -53953,44898,44897,N,53954,N,N,45734,54907,54906,45732,45733,N,N,N,46438,46437, -55982,N,N,55981,45735,N,N,N,N,N,47085,57029,47086,57028,N,N,N,58072,59054, -48450,60010,N,N,N,60787,N,50086,50085,N,N,50556,42452,52595,N,N,45736,58073, -47811,N,N,52079,52080,N,N,52596,43704,43705,N,N,43703,N,N,N,N,44239,44240, -44237,44238,N,53212,N,N,53213,44236,N,N,N,N,53955,N,44904,44905,N,45739,53961, -N,44910,44908,53962,53957,44907,44906,44901,53960,53959,53956,44909,N,53958, -44902,N,44903,N,N,45740,54945,54946,45741,54908,54910,54948,54947,54909,N, -45737,45738,N,55990,46443,46442,55984,46440,N,55987,46444,55988,46445,55985, -46439,46441,55989,N,55986,55983,N,N,N,N,N,57042,N,57031,47088,47091,47090, -47095,47094,57043,57041,57034,57038,57037,47092,57040,57036,57044,57035,47093, -47087,47089,N,57033,N,N,N,N,58075,47815,58079,47814,58076,47813,N,57032,57039, -58078,N,47816,58080,58077,58074,N,N,59057,59061,59063,59059,59058,59056,48453, -48451,48456,48457,59060,48454,59055,48455,47812,59062,48452,N,N,N,60012,N, -60011,60019,60013,60018,60015,48992,60017,N,N,48993,N,48994,N,60016,60014,N,N, -N,N,49400,60788,N,N,49399,60791,60789,60790,N,N,49401,N,N,N,61517,N,49825, -61518,N,N,49789,61519,49790,61516,61520,N,61514,N,N,50087,62072,50088,50287,N, -61515,50288,N,N,N,50414,62943,N,50558,63220,50557,N,63466,50677,50678,N,N, -63948,N,N,44241,53214,N,46446,46447,42453,42698,51783,N,52081,43117,N,43706,N, -44242,44243,44244,54950,53963,44911,N,N,45742,54949,N,N,55992,46449,N,55991, -46448,N,N,57045,48458,59067,59064,59065,59066,N,N,N,N,N,60792,N,61521,N,N,N, -62577,62576,N,63221,42454,52597,44912,N,N,N,46450,57046,N,N,58081,N,48459, -60020,N,61522,62578,42455,N,N,43707,44247,53215,44248,44246,N,44245,53964, -44913,N,N,44914,44915,N,N,N,45744,54951,45743,N,N,N,N,N,55993,45745,46451, -57047,47096,47097,N,47817,N,47818,48460,48996,60021,48995,N,60793,49402,N, -61523,62579,42456,43118,52600,52599,43708,52598,43709,52601,N,53221,44251, -44250,53223,53222,44255,N,44254,44249,N,53217,53218,53219,N,44256,53216,44252, -53220,44253,N,N,N,N,53967,53971,53969,53968,N,53972,N,N,N,53973,53974,53966,N, -53965,N,44917,44918,N,53975,53970,N,54960,N,53976,44919,44916,N,N,N,54954,N, -54953,N,54955,54956,54958,54957,54962,45749,45746,45750,54952,45751,54961, -45748,54959,45747,N,N,N,N,N,55996,55998,55994,55995,N,N,55999,56001,56002, -55997,56000,46452,N,N,57051,N,57056,57048,57052,N,N,57057,57053,47098,47171,N, -47101,57049,57050,47822,47174,47102,N,47172,47100,57055,47173,57054,47169, -47099,47170,57058,58086,58088,N,N,N,N,N,N,N,N,N,47168,N,N,58083,47820,58089, -47821,58087,58082,58085,58090,47819,58084,N,48462,59071,59070,N,48465,48463, -59068,48461,59069,N,48464,N,N,N,60029,N,60065,N,60030,60022,60026,60025,60023, -48998,48999,48997,60024,60027,60028,N,49000,N,49472,60835,N,49404,60795,49406, -49473,N,N,49405,60834,60796,49403,60833,60794,60798,60797,N,N,61525,49828, -49829,49826,N,49827,N,N,61524,N,62075,N,N,50089,N,62073,62074,N,62580,62583, -62581,62582,62944,N,N,50415,63467,63668,N,50679,63736,63737,50790,42457,44257, -N,56003,N,57059,N,42458,43119,N,43710,N,53224,53225,44920,N,N,56004,46453, -47175,49474,60836,62076,62584,42459,N,N,N,52641,52602,52604,52606,52605,52603, -43711,44258,53234,N,53229,53226,N,N,53233,N,N,44260,44261,53232,53231,53230, -53227,53228,53235,44259,N,N,N,N,N,N,N,N,44924,N,44964,44963,53985,53979,53977, -N,44961,54969,44922,53982,53986,53988,53984,53978,44962,53983,53981,44921, -53989,44965,53987,44925,53980,N,44926,44923,N,N,N,N,N,N,N,N,N,N,45753,N,54970, -N,N,54963,54965,54967,N,54968,54966,45754,N,54971,N,54964,N,N,N,N,N,N,N,N,N, -56008,46454,56016,N,56005,N,56017,N,56006,56007,N,N,56015,56014,56011,45752, -46455,56009,56012,46456,56013,56010,N,N,N,N,N,N,N,57070,N,57074,47182,N,58096, -47185,57072,N,N,57069,57064,57066,57067,57060,N,47181,N,N,47180,N,47176,57063, -N,47183,N,47184,57062,57065,57073,47178,47179,57071,57061,N,N,N,58098,47824, -58100,57068,58102,47828,58103,58099,N,47825,58095,47827,58092,58097,58101, -58094,N,N,47177,N,58091,47826,58093,N,N,N,N,N,48468,59073,48472,N,48470,N,N, -47823,N,59080,59081,48467,N,N,59079,59082,48469,48466,59075,59072,59077,59074, -48473,59076,N,N,59078,48471,N,N,N,N,49002,60072,N,60066,60070,60076,60077, -60073,60074,60071,N,60068,N,49004,49001,60067,60069,N,49003,60075,N,49478,N,N, -60842,60837,49477,N,N,49475,N,60844,49476,60840,60841,60838,60845,61526,49479, -60839,N,60846,60843,N,N,N,61530,N,N,61527,N,49830,N,61531,61533,61532,61528, -61529,N,N,62115,N,50090,N,62078,62114,62077,62116,N,N,62113,N,62586,62589, -62585,50289,62587,62588,62590,50290,50292,50291,62945,N,62947,N,62946,N,N,N, -63222,N,N,63669,63738,42460,N,N,52082,43712,52643,43713,43714,52642,N,53240, -53239,44262,44265,44264,44263,53236,53238,53237,N,N,53992,44967,53996,53995, -53994,53990,44966,44970,44973,N,N,44974,53991,53993,44972,44971,44969,44968, -54978,N,54976,54972,45755,N,54973,45756,54974,54975,54977,N,45757,N,N,56021,N, -56020,56019,56018,N,N,N,N,57078,47186,N,57075,57077,N,47187,N,47188,57076,N,N, -N,N,N,58177,N,58105,58106,N,47831,47829,47830,58179,N,58178,58110,58109,58108, -58107,58176,58104,N,59083,59088,59086,N,N,N,59085,59084,59087,N,60078,N,49005, -49480,60848,N,49481,60847,61535,61534,49831,N,62117,50091,62625,50593,63223,N, -63671,63670,51624,44266,44267,54979,N,47190,42461,43122,43121,43120,N,N,N, -52644,N,N,43716,43715,N,44270,N,53242,53245,53243,N,44268,44269,N,N,53241, -53244,N,44981,N,N,N,54003,54005,54004,44978,53999,N,N,44976,44975,N,44979, -44977,N,44980,54002,53997,53998,54001,54000,N,N,N,N,N,N,N,54982,54983,54981,N, -54980,45758,46461,N,56022,56024,56026,46460,N,N,46458,N,56023,46459,56025, -46457,N,N,57153,57079,57082,57086,47194,57084,N,57083,57080,57081,47192,57152, -47191,N,47196,47195,47193,N,57085,N,N,N,58185,N,58184,N,N,58180,N,N,47832, -58183,58182,47833,N,N,N,N,N,48478,N,59090,N,48479,48475,48477,N,48474,48476,N, -N,N,60079,N,49008,60081,60080,N,58181,49010,49009,49006,49007,N,N,N,N,N,60853, -N,60851,49482,60852,N,60854,60850,60849,N,N,61536,49834,49832,49833,N,N,N,N, -62118,62119,50093,N,50092,62627,62628,62626,N,63224,63225,N,N,42462,51784, -43123,N,52645,43718,43717,52646,N,N,53312,44271,53246,44272,N,N,44982,54008, -54006,54012,44983,54007,54011,54009,54010,N,N,54984,54986,N,45759,N,54985, -45760,46498,46497,46462,56027,N,N,N,N,57156,47197,47198,N,57155,57154,N,N,N,N, -58186,47835,47834,58187,58188,N,48481,48480,N,60085,59091,59093,59092,60084, -60082,60086,60083,N,49011,N,N,N,60855,49483,60856,60857,N,N,49835,49836,N, -50293,N,N,50641,42463,N,N,N,N,N,53313,N,N,N,N,N,N,54013,44984,N,N,N,N,N,46010, -46009,N,N,46500,56029,46499,56028,N,N,N,N,57157,N,47836,58189,47837,N,N,N,N,N, -N,50294,62629,N,42699,43719,52647,N,44274,N,44273,53314,53315,N,N,54080,54082, -44985,N,54084,54087,54085,N,N,N,54086,54083,54014,44986,54088,54081,N,N,N,N, -54995,45766,55004,45763,N,54997,45767,N,45761,N,54992,55005,54993,54990,45765, -N,45762,N,54996,54999,45764,55000,45768,55001,54991,54998,55002,54994,54989, -54987,N,N,55003,N,N,56031,N,N,N,N,56036,N,N,N,56032,56038,46503,54988,56033, -46501,56030,46508,56034,46507,56035,46509,46504,46510,46505,N,46506,N,46502,N, -56037,N,N,N,N,N,N,N,47201,57168,N,57171,57159,57164,57158,47203,N,57162,N,N,N, -57160,47202,N,57167,57166,57163,57165,57161,47841,57170,47199,57169,N,N,N,N,N, -N,N,N,N,58205,N,47848,58200,N,47847,58190,N,58192,47840,58197,58196,58199, -47845,58194,58193,N,N,47844,47839,58195,47842,58201,58203,N,58198,58191,47843, -N,N,48489,47838,N,N,58204,N,N,N,N,N,N,N,59097,48482,N,59099,N,48483,N,N,48485, -59102,N,59094,47846,59100,N,N,N,N,59096,N,47200,48488,N,N,48484,N,48486,48487, -N,49014,59101,59095,48490,N,59098,N,N,N,N,N,60096,60091,N,N,60101,49012,60093, -49016,60099,60090,60087,60102,49489,49017,60098,60088,49015,60092,49019,60089, -60094,49018,60097,60100,N,N,N,N,60875,60876,60860,60867,60865,N,N,49487,60872, -60095,N,60863,N,60873,49486,60862,60861,60871,60868,60870,N,60858,60874,49484, -N,60869,60878,60866,49488,49485,60864,60859,60877,49013,N,N,N,N,N,N,N,61539,N, -N,61537,61543,49840,61541,61540,49842,61546,49841,N,61547,61544,49838,61545, -61538,49839,49837,62123,61542,N,N,61548,N,N,62120,N,N,N,50098,50096,62122,N, -62124,62121,50097,50094,50095,50099,N,N,50296,N,62634,N,62633,62631,62630, -62632,N,50295,50297,N,N,50416,N,N,62949,62948,N,N,63226,N,63228,63230,63229, -63227,N,N,50595,50594,N,N,50643,50642,50644,63469,63468,N,63739,63672,63740, -50776,N,50777,63853,N,N,50814,42700,N,52648,N,N,53317,53318,53316,N,N,44275,N, -53319,53320,53321,N,N,54089,54095,N,N,54093,44987,54091,N,54092,54094,N,N,N, -54090,45769,N,55006,45771,55008,45770,55007,N,N,N,N,N,56040,46511,N,56042, -56039,55009,N,46512,N,N,56041,N,N,N,N,N,N,57174,N,47204,57172,47205,57173, -47206,N,N,N,47849,58209,58206,58208,47850,47851,58207,N,N,N,N,N,59103,N,N, -59104,N,48491,59106,59105,N,41569,N,60106,60107,60103,N,60104,49020,49021, -60105,N,49495,N,N,49491,49496,49492,49494,49490,N,49493,N,N,N,N,49843,60879,N, -62126,N,62125,N,62635,50298,50299,63297,62950,N,63296,N,63741,63908,42701,N,N, -43124,N,52649,43720,44278,53324,44276,53322,44281,44277,44282,44280,53323, -44279,44991,44990,54106,44999,54099,54105,44995,54098,54104,54102,44994,44996, -54101,44989,54100,45000,44997,45001,44998,54097,54096,54103,44992,44988,44993, -N,N,N,N,N,55024,55017,N,46517,55016,N,45775,45782,45779,45785,45784,45780,N, -55010,55013,N,55012,45776,55014,55023,45777,55011,55020,55021,45778,55018, -45783,45773,45781,55015,45772,55019,N,N,55022,N,N,N,56059,56050,46514,56057, -56054,56046,56055,46516,56047,N,56043,N,N,47212,56052,N,46513,56058,N,46520, -46522,56045,N,N,46521,56048,46515,56056,56049,56053,N,56051,46518,56044,46523, -45774,46519,46524,N,N,N,N,N,47208,57181,57183,57185,57189,N,57179,57177,47210, -N,57184,57188,57180,57176,N,57175,N,N,N,57186,57178,57182,47211,N,47209,57190, -47207,57187,N,58226,N,N,N,N,N,47854,58218,48504,58228,47857,58232,47863,58213, -N,N,58229,58210,N,58231,58214,N,47870,47867,58230,58224,47853,47861,47860,N, -47859,47865,N,58211,47866,58225,47862,47852,58227,47855,47856,47864,58216, -58215,58212,N,58220,58217,58221,47869,N,58233,47858,58222,58223,N,58219,N,N,N, -47868,N,N,N,N,59111,48496,48505,48501,59108,N,48498,48502,59120,48492,59112,N, -48500,N,N,59115,59110,48499,48503,59109,N,48497,N,59119,48494,59118,59117, -48506,58738,48493,N,59116,59107,N,48507,59114,48495,59113,N,N,N,N,49058,49063, -49022,60120,60111,60123,60115,60121,49064,49057,60108,60114,60124,60117,60122, -60110,N,N,60118,49059,60116,49062,49061,60112,60113,60109,60119,49060,60126, -60125,N,N,N,60890,60886,49503,N,60880,49497,49513,60892,49505,49501,60883, -49508,49511,60894,49500,60885,49509,60896,60893,60881,49504,49498,49512,60888, -49507,60882,49502,60895,49506,49499,60889,49510,60887,N,N,60891,N,N,N,61550, -61556,49849,61559,49844,49845,61551,61558,61553,49850,49847,N,61549,N,49846, -61555,61557,49848,61554,61552,N,N,N,N,62136,50103,50104,50100,N,50101,N,62132, -62130,N,62134,50106,62135,62128,62127,62131,62129,50102,62133,62636,50302, -50301,62637,N,62639,62638,50337,N,N,N,62955,62952,62953,N,62951,62954,50418, -62956,N,50417,N,63298,N,50645,50647,63470,50646,63673,63808,63810,63742,63809, -50796,42702,N,44283,53871,45002,N,N,45786,56060,56061,N,N,N,60127,49514,60897, -N,N,49851,N,62138,62137,50338,62957,N,63299,50680,51785,N,N,43721,43125,N,N, -53325,N,N,54112,54107,54111,54109,45003,54110,54108,N,55025,N,56062,56128, -57193,57194,47214,47215,57192,57195,57191,47213,N,47936,N,47216,58234,N,48508, -59121,48509,N,49065,60130,60128,60129,60900,60899,60898,N,N,N,62139,N,50105, -62140,63300,50681,63674,42703,43723,43722,53327,44284,N,N,53326,54114,N,45004, -55026,54113,N,N,N,45788,55029,55027,55028,45787,N,56130,56131,56129,N,47219, -57197,57196,57198,47218,47217,N,N,59122,59124,N,48510,59123,60131,49066,61561, -N,61560,50107,62141,50109,50108,62640,62958,50419,42704,53328,44285,54117, -45006,54116,54115,N,45005,N,55035,N,55037,55030,55031,45789,55032,45790,55036, -55033,55034,45791,N,46526,46527,N,56132,N,N,N,57199,57200,N,58238,47939,47937, -47938,58235,58236,N,58237,59129,N,59130,48545,59127,59126,59128,59125,49069, -60132,49067,49068,60902,49515,60901,61352,N,61562,61563,49852,N,49853,49516, -62142,62143,62641,50339,42705,N,42706,44286,43724,45007,53329,N,N,N,46528, -42707,44353,53330,53331,44352,44354,42708,N,53332,45009,54118,45011,45008, -45010,N,55105,45792,N,55104,55038,N,57201,N,N,58273,N,48546,N,49070,60134, -60133,N,60903,N,N,N,62959,N,N,42709,52083,52650,44355,53333,N,54120,N,N,N, -45012,54119,45013,N,N,N,55107,N,N,45794,55106,55108,N,45793,N,N,N,N,56134, -56135,56133,46529,N,N,N,47220,N,47221,N,47941,N,58275,58274,47940,N,N,N,N,N, -59131,N,N,59132,N,N,N,N,60135,N,N,49520,49519,49517,49518,49521,N,61564,49855, -49854,62144,62642,N,N,N,50597,50596,42710,N,N,53755,N,47223,46530,47222,47942, -N,42711,51625,42712,42713,N,N,52651,52086,N,52087,43127,N,52084,43126,N,43129, -52085,43131,43130,52088,43128,N,N,N,43729,43727,52653,N,43726,N,N,N,43731, -43733,43730,N,52656,52652,43734,N,43728,43132,N,43732,52655,N,N,52654,N,43725, -N,N,N,N,N,N,N,53339,44359,44360,53341,N,53335,53338,53347,53345,N,44361,53351, -44364,53348,53340,53337,N,N,56137,53346,44356,53349,53334,53343,44358,44363, -53344,44367,44365,N,53336,44362,N,53342,44366,44357,53350,N,N,N,N,N,N,45018,N, -45027,45016,45014,54122,45022,45019,54124,N,N,45021,54123,54121,54126,45026, -45024,56136,54127,54125,45015,N,N,45017,45020,N,45023,N,45025,N,N,N,N,N,N,N,N, -N,N,55118,45796,N,55109,55111,N,55112,N,55120,55116,55114,N,55117,55121,45797, -45801,55110,N,55119,N,45799,N,45798,55115,55113,N,45795,45800,N,N,N,N,N,N,N,N, -46536,56145,N,N,56143,46538,N,N,N,N,56138,57249,N,46537,56142,N,N,56139,46533, -46539,56144,46535,56141,47943,46534,56140,46540,46532,46531,N,N,N,N,N,57207, -57205,N,57211,N,57203,57250,57208,N,57202,47227,47267,57213,N,57206,N,47230,N, -N,47228,57214,47225,47224,57209,47229,46541,N,57212,57204,47226,47265,47266,N, -N,N,N,47948,47944,N,47949,58278,N,N,58277,58279,47946,58276,47947,58282,58281, -58280,N,47945,N,N,N,N,N,59201,N,59204,48552,59203,48551,48547,48548,48549, -59200,59134,48550,N,59202,59133,N,N,60137,60147,49073,49072,N,60141,60143,N, -60138,N,60142,60136,60145,49071,60144,60140,N,60146,N,60139,49524,60904,60910, -49528,49530,49527,49526,N,49525,49523,60905,60908,49522,60909,N,49529,60907,N, -60906,49856,N,49857,61601,61565,61566,N,N,62146,N,62145,50110,62644,50340, -62643,N,62960,63301,50598,63811,63812,50648,42714,N,43735,56146,47950,49531, -60911,42715,N,45029,45028,56147,N,N,N,60148,42716,44368,N,N,56148,56149,56150, -47951,49074,42717,N,43736,53352,45030,54128,45802,N,56151,47268,N,47952,49075, -49532,49858,62645,42718,43737,N,N,45031,55122,46542,N,47953,58283,59205,N,N,N, -N,42719,46543,57251,47954,42720,52657,53353,44369,N,N,54130,N,N,45034,N,45032, -45033,45035,N,N,54129,N,N,55127,55124,55126,45803,45805,45804,55123,45806, -55125,N,56152,56153,N,56154,57254,N,57255,N,57253,57256,N,47269,N,57252,N, -47955,N,N,59210,59206,59209,59211,59208,59207,N,60149,60150,60151,49076,49077, -60913,60912,60914,N,61603,61602,N,62148,N,62149,62147,N,50341,N,62646,62647,N, -63302,63471,63675,42721,43133,N,49533,42722,N,55128,56155,N,50753,51786,N,N,N, -51787,51789,42723,51790,51788,N,N,52130,52131,52091,N,N,N,N,52129,43169,N, -43170,52092,52090,52089,52093,43134,52094,53354,N,N,N,52662,43740,52661,52663, -N,43739,52668,43743,52658,52672,52678,43750,52675,43747,N,52665,52671,52673,N, -52660,43746,43741,52666,43748,43751,43745,N,43738,52670,52664,52677,43753, -43749,43744,52669,45036,52667,43742,43752,N,52659,N,52674,52676,N,N,N,N,N,N,N, -N,N,N,N,N,N,44386,44380,44388,44385,53361,53364,44381,N,53355,N,44374,44384,N, -44387,44389,53410,53367,N,44373,53409,44377,44375,44370,53359,N,53374,53363, -53366,53413,N,44390,53373,44382,53368,53412,53365,53369,53372,N,N,53357,53411, -53371,N,N,53356,53360,44383,44378,44371,44376,44372,44391,53358,54181,44379,N, -N,53370,52801,N,N,N,N,N,N,N,N,54184,45050,N,54134,N,54179,54141,N,54194,N, -54186,N,54142,N,54185,54136,54140,54197,45053,54189,54180,45037,54195,54132,N, -54188,N,45052,45047,54131,45045,45044,45049,54187,45041,45048,53362,56156, -54182,N,N,54138,45051,54139,54177,45054,54133,54191,N,54190,54198,45043,45040, -54196,54192,54183,54178,45046,45042,54135,45038,54193,45039,N,54137,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,55134,55136,55141,55161,45820, -45810,N,55133,45821,45822,55144,55151,55157,N,55138,N,55145,N,N,45888,55159, -55154,45818,45816,55150,55146,55132,45807,55137,55129,N,45815,45817,55142, -55139,45812,55155,45809,55140,55162,55148,N,55147,45808,N,45819,N,45811,55130, -55135,55152,55158,45889,55131,55143,55149,45814,N,N,55160,55153,55156,N,N,N,N, -N,N,N,N,N,N,N,N,45813,N,56172,56160,46551,56189,56231,56234,46549,56168,56227, -56169,56183,46562,56179,46559,N,56180,56157,N,56228,N,N,46568,56225,56181, -56236,56176,57288,N,56239,46566,56174,56186,46569,46548,56178,56237,56171, -56164,56175,N,56163,56161,46544,56229,56170,56232,N,56233,46552,46557,46553, -46561,56190,46554,56182,56166,N,46546,56158,56226,56235,56165,46560,56240, -56177,56173,N,46545,46565,N,56188,46567,N,56184,46556,46550,46558,46547,46564, -56185,56167,56187,56162,56230,N,N,N,N,N,N,N,56238,N,N,N,N,N,N,N,56159,N,N,N,N, -N,57287,N,57309,47189,57292,N,57290,57269,47273,57285,57305,57281,47281,57304, -57279,46563,57295,57280,57302,47280,47272,N,57258,57266,N,57291,57283,57308, -57286,47286,57303,N,47277,N,57289,57297,57270,57296,N,57313,57265,57298,N, -57311,N,57259,46555,N,57273,57272,47279,N,57276,57278,57293,57310,47282,N, -47283,N,57264,47275,57268,57306,47284,N,47276,47278,47285,57312,57299,57294,N, -N,57275,57274,47274,57260,47271,57284,57261,57282,N,N,57271,57307,N,N,N,47270, -N,N,N,57267,N,N,N,N,N,N,57263,57301,57262,47968,58323,N,N,58306,N,N,58284, -58314,47960,58299,58309,47963,58302,47961,58287,58317,58286,58305,N,58285,N,N, -58303,58312,58310,58298,58293,58291,N,58292,58311,58322,58300,47962,N,58295,N, -58315,N,47965,58294,58288,58304,47969,N,N,47957,47966,58296,58290,N,47959, -57300,47958,58307,N,47956,47971,47964,58308,58297,58289,58316,58301,47970, -58320,47967,58319,N,58313,58318,N,N,N,58321,N,N,N,N,N,N,N,N,N,N,N,59251,59252, -59239,59238,59234,48564,N,48556,59254,59253,57257,59231,59235,59229,N,59248, -59233,N,59255,59226,59224,59236,59246,59241,48566,59215,N,59245,N,N,N,48567, -57277,59227,59218,59221,59259,59228,59219,59217,59214,N,48560,59237,48559, -48563,59232,59240,48553,59256,59260,48555,N,59223,59243,59247,59220,59257, -48562,N,48561,59212,48565,59250,59222,59242,59216,59230,59225,48557,48558, -59244,59261,59258,59249,N,N,N,N,N,N,N,N,N,59213,N,48554,60233,N,60224,60227,N, -49083,60229,60153,60225,60231,49080,49084,49078,N,N,60155,60236,N,N,60230,N, -60156,60245,60239,60152,60998,60158,49079,N,60234,N,60244,49087,N,60241,60157, -60228,60232,60226,60246,60243,60240,49081,49082,49086,60154,60247,49085,60237, -N,N,60235,N,N,N,60238,61011,60992,60997,61010,60996,60923,60993,N,49570,N, -60916,61005,61007,60915,49569,61009,61001,49576,61008,60994,49578,60921,60242, -61002,60999,60917,61013,49572,N,N,49573,60919,61000,N,61012,61003,60925,49575, -49571,61004,60926,61014,60920,60995,61006,60922,60924,N,49867,60918,49577, -49860,49534,N,N,N,N,49574,49864,61619,N,61609,61604,61610,61620,61624,61623, -49866,49865,N,N,61611,61625,61614,61606,N,61608,61607,61613,61618,61605,61612, -61617,49863,N,61615,N,49861,61616,49859,49862,62165,61621,N,N,50114,N,62157, -62161,62153,62156,N,62164,50112,62169,62162,N,62154,62170,62163,50115,50116, -62167,N,62155,50111,50113,62150,62158,62152,N,62168,62166,62151,62159,N,N,N, -62654,50117,62160,50343,50345,50342,N,62659,62651,62649,62653,62650,N,N,62655, -62657,50346,50348,N,62656,50349,50347,62658,N,N,N,N,50344,N,N,N,N,N,50420, -62961,62967,50422,62652,62966,N,62973,62964,62971,62970,62648,62965,61622, -62974,62963,62968,N,62972,62962,N,63306,50421,62969,N,N,63476,63307,63305, -63303,63304,63308,N,50649,63474,63472,63477,63475,N,63478,50650,63473,N,N, -63676,N,N,63813,63814,63815,N,N,63943,63933,51791,43754,N,44392,N,54200,54199, -45120,45890,55164,N,N,55163,N,46570,47288,N,47287,47289,N,58324,59262,60248, -60250,60249,N,49579,61015,61626,63909,42724,N,52681,52682,52680,52679,43755,N, -53417,53415,N,N,53414,N,44393,44395,44394,53416,N,N,N,N,N,N,N,N,54212,54209, -54207,N,N,45121,54210,45126,54204,54219,N,54221,54205,N,45123,54222,54217, -54203,54208,54218,54214,54211,N,45128,54220,54206,N,N,54215,54201,45127,45124, -54213,N,54216,54202,45125,45122,N,N,N,N,45900,55205,45899,N,55208,55211,45896, -45894,55166,55209,55207,55204,55212,55213,55215,55216,55165,45893,55202,55201, -55214,45895,55203,45897,45892,55206,45901,N,45898,55210,N,N,N,46577,56255,N, -56244,46574,N,57319,56253,56241,46572,56246,46575,56250,56248,46578,46571,N,N, -56242,56245,46576,N,56243,N,56254,56252,56247,56249,56251,46573,N,N,N,N,N,N,N, -57320,57326,57316,57322,47290,57318,47296,N,N,47295,47294,57325,47297,47298, -57315,57328,47299,47293,47292,57324,47300,57314,57317,57327,57323,N,N,58356, -58345,47291,N,N,N,N,47978,58333,58354,58334,47973,N,58331,N,58340,58332,47975, -58326,58353,47976,58350,58351,58327,47981,58342,N,58336,58343,58330,N,58355, -58347,58341,58325,47977,58348,N,47980,58352,N,58346,47974,58344,N,58338,47972, -58329,58337,58349,58335,N,N,58339,N,N,N,N,N,48577,57321,59314,59323,59313, -59309,59306,48578,59304,47979,59297,48576,59303,48575,59308,59305,59321,59316, -59310,59315,48571,59307,59326,59298,59299,59322,48572,59327,48574,59328,59312, -58328,59318,59311,59320,59317,N,N,N,59302,48569,59325,48570,59300,48573,60260, -59319,59324,N,N,N,N,N,60257,48568,49088,60267,60263,N,60261,60256,60271,N,N,N, -49092,N,60252,60264,60265,60255,60254,60268,N,60258,60253,60259,N,60270,60251, -60269,60266,49090,49089,N,N,49091,60262,61643,N,N,N,N,N,61017,49585,61021, -61018,61025,61031,61020,N,61040,49582,61034,61023,61035,61030,61037,61022, -49587,49586,61024,61038,61016,61036,49580,N,61028,61027,61032,61019,49584,N, -49588,61026,61033,49589,61029,N,N,N,N,49581,49583,61639,61637,N,N,61644,61641, -61645,N,61630,61638,61649,61039,61634,49871,59301,61629,61642,61636,61633, -61628,61627,61648,N,61632,61631,49869,61640,N,49868,N,N,49870,61635,61647,N, -62174,62175,N,50121,62172,50118,62180,N,50122,62182,62171,61646,62184,62173,N, -50119,62179,N,62181,62176,62183,62178,62177,50120,N,N,62661,62662,N,62664, -50350,50351,62665,62663,N,62660,N,63042,63045,63041,N,50426,63043,50425,50424, -50423,63044,63313,63311,N,63310,63040,63312,63046,63309,N,63481,63447,63479, -50651,63480,63482,N,63679,50682,63678,63677,50683,N,50778,63854,63911,63910, -63912,42725,53418,N,54223,54224,N,N,N,56256,N,63047,63680,42726,44396,53419,N, -N,N,55217,45902,N,56258,56257,46579,N,47301,59329,48579,N,48580,N,N,N,49093, -50684,42727,N,N,N,53420,43757,53422,53421,44397,N,54225,N,54232,45129,54230, -54228,N,54235,54226,54227,45130,N,45134,N,N,54236,45133,54234,54231,54229, -45131,45132,54233,N,N,N,N,45904,55218,N,45909,55234,45908,55236,N,N,55224, -45906,55235,N,55219,45907,55231,55227,55229,55223,55230,N,N,45903,55226,N, -55225,55221,N,55232,N,N,55228,55220,N,55222,45905,55233,N,N,N,N,46582,56269,N, -N,N,56265,56267,56262,56261,56259,N,56266,56268,56264,N,56263,46580,46581,N,N, -N,N,N,N,56271,47309,57330,57336,57331,57332,N,57337,N,47311,N,47303,47310, -57329,56260,47306,47304,57335,57334,47305,47307,57333,47302,N,47308,N,N,N,N,N, -58358,47988,N,N,58434,58433,N,58363,47990,58432,58359,58360,47982,47984,N, -58365,58357,47986,47985,58361,58366,58364,47987,58362,56270,47983,N,N,59330, -59337,48582,N,59341,48586,59333,59331,N,59340,N,48581,59339,48583,48584,59332, -48585,59338,59334,59335,59336,47989,N,N,N,60272,60284,N,49098,60279,60281,N, -49096,60273,60277,N,60280,49094,49097,60283,60275,60276,60282,60274,60278, -49095,61042,N,61041,49591,61047,49593,N,N,49590,61043,49594,61044,N,N,61045, -61048,N,49592,N,61654,N,N,61657,N,61651,61653,N,N,61652,61655,61656,61046, -61650,N,N,50125,62188,62191,62193,62186,62187,62190,62192,50126,50124,50123, -62189,62185,62666,50352,N,62667,N,N,63049,50427,63051,50428,63048,63050,50600, -N,63314,50599,63485,63484,N,63483,N,N,63816,63817,63819,63818,N,51792,42728,N, -44398,55237,46583,N,57338,49872,N,62194,N,N,43171,N,N,N,45911,N,N,N,45910,N, -56272,46584,56274,56273,N,N,57339,47312,58435,58438,58437,N,58436,59342,59344, -59343,N,49100,N,N,N,49099,N,49595,61049,61051,61050,N,N,49873,N,N,N,62196, -62195,N,62668,50353,N,N,50429,63316,63315,50779,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,43172,53423,44399,55240,55238,N,N,55239,56276,56277,57411,56275,N,57340, -57409,57408,57410,47313,57342,57341,57412,N,58441,58439,N,58440,59347,59345,N, -N,59346,60285,61052,61053,49874,N,62197,62669,50354,N,63052,63317,50601,N, -63486,63820,43173,N,44401,44402,53424,N,N,53425,44400,N,45140,N,45138,N,45137, -45144,45136,45145,54237,45142,N,45139,45143,45141,45135,N,N,45919,N,45913, -55244,45918,N,N,45920,45914,N,45915,N,55242,N,N,45912,N,55243,45917,N,N,55241, -45916,N,N,46660,N,46662,N,N,56280,46661,46585,46589,N,47332,57417,56282,46590, -N,N,56285,56286,46659,N,56288,N,56290,N,56291,56279,56278,56292,46658,56289, -56287,N,46656,46587,46663,56283,56284,56281,N,46657,N,N,46588,N,46586,57416, -47327,47322,N,N,47317,N,47333,47318,N,47314,47329,47326,47328,N,47319,47324, -47315,47316,57424,57421,57413,57418,N,47330,57425,47331,47321,N,N,57415,N, -57423,57419,57422,57420,47325,57414,47320,N,N,N,58444,47992,47995,N,58446,N, -48037,58445,47997,N,48591,58447,N,48036,58443,48038,N,N,N,47993,N,47323,47996, -N,47994,47998,48034,47991,48039,48035,N,48033,58442,N,N,N,N,48598,N,48594,N,N, -N,48601,N,59350,48602,59362,59355,48587,59363,59357,48597,59358,N,48596,59361, -48590,59359,59349,48589,60330,48595,N,48592,N,48600,N,59348,N,59352,48588, -59351,59353,59354,48599,59356,59360,59364,N,48603,49106,60325,60331,60328, -60286,60332,60321,N,60327,N,49101,49107,60333,N,N,49103,N,49113,49108,60335, -60329,49104,60322,49114,60323,60324,49115,49112,48593,N,49102,60336,49116,N, -49109,60334,49105,49110,49111,N,49603,61092,61101,61098,61100,N,49600,61093,N, -61099,49596,61095,49604,61091,61096,61103,60326,61097,61090,49597,61089,49598, -61104,49599,61102,49602,61054,N,49601,N,61094,61660,61674,61669,61671,61659, -49875,N,61658,49878,49877,N,61673,61665,61662,61668,N,61661,N,61663,61672, -61670,N,49876,61677,61675,61666,61676,61667,N,62201,50127,62273,N,N,63055, -50134,61664,62199,50130,62200,62205,N,N,50132,50133,62198,62272,62274,62202, -62204,62206,62203,62275,50129,50135,50131,N,50128,62672,N,50359,62670,N,N, -62674,N,62675,50357,62676,62673,N,62671,50360,50356,62677,N,50358,50355,N,N,N, -50430,N,N,50496,63054,63053,63056,63057,N,50497,63318,63323,50602,N,63320,N, -63319,63322,63321,N,63555,N,50652,63554,63552,N,63553,N,N,N,50686,50685,63681, -63682,50752,N,63821,63822,50791,N,50797,N,63913,63944,43174,N,55245,N,55246, -57426,58448,59365,49606,N,49605,61678,62276,N,63556,43175,54238,45146,45921, -57428,57427,48604,59366,48605,61105,49879,N,N,N,50806,43176,52683,54239,N,N, -45922,N,55247,55248,N,56293,N,46664,47334,N,57430,57429,57431,N,58449,58450, -48040,49117,48606,49118,N,61109,61106,61108,61107,49607,N,61679,62278,62277, -52132,45148,45147,54240,N,55249,N,N,56295,56294,46665,N,57433,57434,57432,N,N, -47336,47335,N,48042,48041,N,59367,60339,60337,60338,49119,61111,61110,N,61682, -61681,61680,62279,N,63914,43177,44403,N,44404,45149,45150,54242,54241,55250,N, -45928,45926,45923,45927,45925,45924,N,N,46666,56298,N,47341,46668,46673,56300, -46675,46674,46677,56299,56296,46671,46667,46669,56297,46676,46672,46670,47343, -47342,47340,47344,N,47338,47339,N,47337,N,57435,N,N,58452,N,48044,48045,48043, -N,58451,N,58453,N,59370,59372,N,48615,59373,48608,59369,48607,48617,48613, -48614,48610,59368,48609,59374,59371,N,48616,N,48611,48612,60341,N,60343,60342, -N,60344,49120,60340,N,N,49611,61112,49608,49612,49610,49609,61683,61686,N, -61685,N,61684,49880,62280,62281,50136,62282,50137,N,N,50362,N,50361,63058,N,N, -50498,63059,63324,50603,50604,N,63557,N,50754,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43178,N,45930,45929,57436,57437,N,48046, -60345,48618,60346,61113,43179,N,53426,44406,44405,N,54243,45151,54244,55253,N, -55252,N,55251,N,N,56302,46680,N,N,56301,46679,N,N,N,56303,46678,N,57439,57442, -57440,57441,57445,57438,57446,57443,57444,48048,58454,N,N,48047,N,59378,59376, -N,N,48619,59375,59377,N,48620,N,60347,N,60348,49613,N,62284,62286,62283,62285, -62678,63060,N,N,63855,43180,44407,54245,54247,54246,N,55256,45932,N,55254,N, -45931,55257,N,55258,55255,N,N,56315,46688,56307,56313,N,N,46683,46686,56306, -46681,56310,57452,46685,N,56305,N,56311,56308,56314,56304,56312,46684,46687, -56309,46682,N,47346,57448,47345,57455,57454,47352,N,47353,57456,47347,57453, -47351,57458,57449,N,57451,47348,57447,57450,57457,47349,57459,N,N,N,N,N,47350, -N,48049,58459,58465,58457,58466,N,58456,58461,58467,58464,58463,58462,N,58455, -58460,N,N,58458,N,48625,48622,59387,59457,59459,59456,59384,59386,59461,59458, -59388,59462,59385,59460,48623,48629,48627,59379,48628,48624,59380,59382,59381, -59389,59390,N,48626,N,48621,N,N,59383,N,60358,49122,N,60349,49123,49126,60354, -N,60351,49125,N,N,60355,60356,60350,60359,60352,60357,49124,N,49121,60353,N, -61119,49616,49614,49617,49615,61118,61115,61114,N,61117,N,N,61116,61765,49886, -61691,61690,N,49881,61761,61760,61687,61763,61692,49885,61689,61762,61688, -49882,49884,61693,49883,61694,N,61764,62290,N,50142,62287,N,62291,N,N,50139, -62289,50144,N,50141,N,62288,N,50143,62292,50138,N,N,N,N,50364,50366,N,62681, -50365,62679,50140,62680,50363,50499,50501,63062,50500,63061,N,63329,50605, -63328,50606,63326,63325,63330,63331,63558,N,63327,N,N,63686,63683,63684,63685, -50780,N,63825,63824,63823,63856,N,63934,63915,50798,43181,45152,N,N,N,N,N, -47354,N,N,N,N,N,N,N,48630,N,N,60360,N,N,49887,N,62293,N,N,N,N,N,N,63916,43182, -43758,44409,44408,N,45155,N,54248,45153,54249,45154,N,N,55263,55259,N,N,45933, -55262,55261,55260,45934,55264,55265,N,N,N,56387,56385,56389,56390,56396,N, -56392,56394,N,56386,56316,N,56393,N,N,56395,56388,56391,56317,46690,56384, -56318,46689,46691,N,47357,57461,57463,57462,57467,47355,N,57464,57460,57465, -57466,47356,47358,57468,N,58471,58470,N,58468,58469,48051,48053,48050,48052, -59469,59470,59465,N,59466,48632,48637,48631,48638,48633,59467,N,N,59468,59464, -48704,48635,N,N,48634,48636,N,59463,N,60362,49128,N,N,60364,49130,60367,60363, -60361,60366,49129,60365,N,49127,N,N,49619,49622,61121,N,49620,61120,49618, -49621,61766,61767,61768,49888,N,61769,N,49889,50146,62296,62297,62295,62294, -62298,50145,62685,62683,62684,62686,62682,62687,63064,N,63065,63063,50502, -63332,50607,63333,63560,63559,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,43183,46692,N,N, -47424,N,N,N,48054,N,N,49132,N,49131,N,N,N,N,50147,50300,50503,43184,45156, -47425,N,62299,N,N,N,N,N,N,N,N,N,N,52134,N,N,43185,N,43188,43187,43186,N,N, -52133,N,52685,N,52687,43759,N,N,43761,52684,52686,43760,52689,52688,52690,N,N, -N,N,N,N,N,N,53430,53428,44412,53427,44451,44414,44411,N,44452,N,44413,44450,N, -44449,53429,N,44410,N,N,N,45162,54251,54257,45159,45166,N,45161,54254,54256, -45164,54250,54253,45160,45157,54252,45163,54255,45165,45158,N,N,N,N,55267, -55270,45936,N,45946,45942,55268,N,N,45950,45943,45948,45938,N,45935,45937, -45949,55269,45941,45944,45940,45945,55271,45947,45939,55266,N,N,N,N,N,N,N,N, -56397,46693,56399,N,46695,46697,N,56398,46694,46698,N,46696,N,N,N,47431,57507, -47439,57470,N,47440,47429,N,57505,N,N,47434,N,57506,47427,47426,N,47437,47436, -47435,47433,47438,57469,47428,47430,47432,N,N,48056,48059,N,48063,48057,48062, -48060,N,48055,N,48061,48058,N,N,N,59474,48707,48705,N,59475,N,48708,48706, -59473,59472,N,49136,59471,49134,49133,60368,48709,49135,60369,49138,60370, -49137,49624,61123,49623,49628,49626,49627,49891,49625,61122,60371,49890,49892, -N,50148,50149,N,62688,N,50654,50653,43190,N,N,51797,45167,N,51794,51795,51793, -N,51796,N,N,52138,52135,52140,52136,43191,43194,N,52137,43193,52139,N,N,43192, -N,N,N,N,52693,52695,43764,52691,52694,52692,43762,43765,N,43763,N,N,N,N,53432, -53436,53433,N,44455,N,44456,N,53435,N,53437,53439,N,44453,53438,N,N,44454,N,N, -N,N,N,55278,53434,54258,54267,54265,54260,54261,54266,54268,45169,N,54263, -54259,45168,45170,54262,54269,54264,N,N,45985,55281,55273,55279,55280,45986,N, -55272,55274,53431,55276,55277,55275,46700,N,N,N,56406,60372,56407,56404,45987, -46702,56403,56409,56408,46699,56412,56402,56411,56400,56410,56405,46701,N, -57514,N,57509,57515,57510,57508,57511,47441,N,57513,N,57512,47442,48065,48064, -58478,58481,58473,58477,48066,58476,58474,58480,58475,58472,58479,N,59481, -48712,61770,59478,59479,59477,56401,48711,59482,59476,48710,48713,59480,60373, -49139,60374,60375,N,61124,49629,61771,61772,N,N,61773,62301,62300,62690,N, -62689,63067,63068,63066,63334,50608,43195,44458,44457,45173,45172,54336,54337, -54270,N,45171,55285,N,55286,55282,45988,55283,N,55284,N,N,N,N,56415,56417, -56413,56416,46703,56414,46704,N,N,56691,47445,47444,N,47443,N,57516,57517,N,N, -58483,58485,48070,48067,N,48069,48068,58484,58482,N,N,N,N,N,59489,59486,59487, -48717,59488,59483,59484,48714,N,48715,59485,48716,N,60379,N,60380,60377,60378, -49140,60376,N,N,N,N,N,61128,61125,61127,49632,61131,49631,61129,61132,61130, -61126,49630,N,61775,N,61776,61774,N,61778,49893,49894,62303,50151,61777,62302, -50150,62693,62694,50367,62692,N,62691,N,63069,50504,N,63561,63688,63687,N, -50755,50781,63689,63857,N,50799,43196,43766,N,47446,N,50368,43197,44459,45989, -46705,49895,43767,N,53441,53440,54338,N,45176,45174,45178,54340,N,45177,45175, -N,N,N,N,54339,45992,55292,N,45991,45993,55362,45995,55294,55360,55287,45994, -55363,N,N,55289,N,55290,55288,45990,N,55361,55291,55293,N,N,N,56429,N,56428, -56426,56418,56433,56421,56431,56438,56430,46713,N,46709,56419,N,56425,46711,N, -56424,46712,46714,56427,N,46706,46707,56439,56437,N,56436,56422,N,56434,N, -46710,N,N,N,N,46708,56435,56420,56423,56432,N,N,N,N,N,58554,57527,N,57520, -57539,57548,57523,47457,N,57536,47447,47449,47461,57521,N,N,47450,47452,47462, -47451,N,N,N,N,47460,57529,N,57518,47458,57528,47454,57546,47459,57544,57532, -57542,47456,57519,57545,57540,N,57547,47448,N,N,47463,47453,N,N,57525,N,57533, -57537,N,57541,47455,57524,57522,57534,N,N,N,N,57531,57530,N,57535,57538,N, -57543,N,N,N,58488,N,48071,58532,58490,48076,48080,58541,58549,58534,48072,N, -58538,57526,N,48073,58545,58550,58542,N,58544,58553,58546,58494,58537,N,N, -48081,N,48077,58492,58539,48075,58533,48074,58547,58530,58489,48078,58552,N,N, -58491,58543,58540,58535,58487,58486,58529,58548,48079,58551,58493,58531,48722, -N,N,N,N,N,48730,48725,59556,59553,59495,48720,N,N,N,48719,48726,N,N,N,59493, -48724,59505,59491,59492,48718,59555,48728,59508,59513,59507,60398,59503,59511, -59509,59496,59490,59517,48727,59518,N,59512,N,59501,59499,59494,N,N,N,59502, -59515,59498,59514,59554,N,N,48723,N,59510,59516,59506,59500,48721,N,N,N,58536, -59504,48729,59497,N,N,N,N,N,60404,49143,60403,60400,60484,49147,N,60481,60408, -60483,60393,60406,N,49149,N,60385,N,60383,60482,N,60480,60414,60397,60396, -60386,49216,N,60392,60402,60413,49219,60485,N,49640,49221,49150,60390,N,60399, -60382,60384,49141,49218,49146,60391,60407,60401,49217,60381,49635,60409,60412, -49148,N,60395,49220,49145,N,N,N,49144,60405,60411,49142,N,60388,60410,N,N, -60389,N,N,N,N,N,N,N,N,N,60394,61138,N,61143,49637,49639,61149,49633,61164, -61155,61144,61145,61154,N,49646,61153,61137,61152,61140,61165,49645,49643, -61141,N,61160,N,61146,61159,N,61161,61136,49638,N,61162,N,N,61150,N,49642, -61147,N,N,49644,61156,N,N,N,49636,61142,61157,N,61151,60387,61158,61139,N, -49641,N,61163,N,49634,61134,N,N,N,N,61792,61785,49897,N,61780,61795,61787, -61148,N,61797,61781,N,49896,61791,49898,49906,49904,61793,49905,61783,N,61784, -61789,61794,N,61133,49899,61802,61799,61803,61790,61786,61800,62314,61788,N, -49902,N,49901,61135,49903,61796,61798,49900,61801,61779,N,61782,N,N,N,N,N,N,N, -N,62323,N,62307,50155,62321,N,N,62305,50156,N,62316,N,62312,50161,62322,62306, -62309,50153,62324,N,62317,62320,50159,50164,50162,62313,62308,N,50157,50158, -62304,50154,N,50152,50160,62319,50163,N,62315,62325,50165,N,N,N,62311,N,62318, -N,N,N,N,N,N,62707,62786,62709,62716,62310,62714,62697,62784,50371,62701,62718, -62708,N,N,50370,N,N,62788,62710,N,62715,62717,62695,62785,62706,62711,62699, -62703,62787,62713,62696,62700,62702,62712,N,50369,62705,N,N,N,N,N,N,62698,N,N, -N,N,N,N,N,62704,63073,63078,50511,63080,N,50505,N,63076,63082,50510,50506,N, -50507,63072,63079,50509,63077,50508,63071,63075,63074,N,63070,63081,N,N,N, -50609,63341,63344,63340,63342,63343,63337,63338,63335,N,N,63339,63336,50610, -50611,N,N,63563,N,63565,N,N,N,N,N,63564,63566,N,50656,N,63562,50655,50657,N,N, -N,63691,63692,50756,63690,N,63827,63826,63828,50783,63829,50782,63830,63858, -63861,63860,50792,63859,N,N,N,50802,50800,50801,50807,63936,63937,63935,63945, -43768,N,N,55364,56440,59557,62326,N,N,43769,N,44460,45179,N,N,55365,N,55366, -45996,N,46717,56442,56441,46755,46716,56443,46718,46754,46753,46715,N,N,N, -47464,N,N,57552,57550,N,57551,57549,N,48082,N,48085,48087,48086,N,N,48083, -48084,N,59559,59558,48731,59560,N,59561,48732,N,N,N,60493,60491,61171,N,60489, -60490,49222,60486,60494,60488,60492,61167,N,N,61169,N,61170,49651,61166,49650, -61168,49647,49648,49649,60487,N,N,49909,61806,61804,61805,49907,49910,49908,N, -N,N,62327,62328,50166,N,62789,62791,62790,50372,50512,63085,63084,63083,43770, -N,51626,N,51800,42729,51798,51801,51799,N,N,N,52142,N,43201,N,43202,52144, -43199,52143,52141,43200,43198,N,N,N,N,N,N,52696,52699,43773,52698,52697,N, -43772,43771,N,43840,52700,43774,N,N,N,N,N,53446,44462,44463,44464,53447,53443, -44461,53444,N,53445,53442,N,N,N,45220,N,N,45217,54341,45218,45221,54342,N, -45182,45180,45181,45219,N,N,N,N,N,45997,55369,46005,55368,N,55371,46001,55370, -46763,45999,46002,45998,46003,46004,46000,N,N,N,55367,46759,56445,N,56483,N,N, -56482,46764,46760,46761,56444,56446,56481,46756,46758,N,46762,46757,N,N,57555, -57553,57554,47466,47467,N,57556,47465,48088,N,48090,48089,N,58555,N,N,58556, -59563,N,59562,N,N,49223,49224,60495,49225,N,61174,N,61172,N,61173,49652,N, -61807,50167,N,N,N,49653,43841,N,45222,54343,N,N,55372,46006,46765,56484,56486, -46767,46766,46768,46769,56485,47470,47471,47469,48091,47468,57557,N,N,N,48092, -59564,60496,49226,49654,61808,61812,49913,61809,49914,49912,61813,49915,61811, -N,62329,49911,50168,N,63693,N,N,43842,46008,46007,N,N,N,N,46770,56488,56487, -46771,N,N,57561,47475,47472,57560,47474,57558,47473,N,57559,N,58557,48093,N, -59567,N,48733,59565,48734,48735,59566,48736,N,60497,N,49230,49227,49232,60499, -49228,60498,49231,N,N,49229,N,61177,61179,N,N,49655,61178,49656,61176,61175,N, -61815,61814,49916,61816,62334,50170,62333,62330,50169,62331,62332,N,62792, -62793,50373,N,50515,N,N,63086,N,N,50513,50514,63087,N,N,50612,50613,63345,N,N, -50757,63695,50759,N,63694,63696,50758,63831,N,63917,N,N,N,N,N,N,43843,N,N,N, -47476,N,58558,N,59568,49233,49234,N,43844,N,48737,50171,44465,N,N,N,49235,N, -50658,44466,55373,N,56489,N,56491,N,56490,N,57565,57562,47477,N,47478,57563, -57564,N,58560,58565,48094,58559,58561,58568,58563,58567,58564,58562,58566, -48095,N,N,59571,N,59569,48739,N,48738,59570,48740,N,N,N,N,60502,N,N,60501, -49236,60500,61180,N,61182,61249,61248,N,49657,61181,61857,49917,61821,61858, -49918,N,61819,N,61822,61820,61817,49984,61818,N,N,N,N,62369,N,N,62371,62370,N, -62794,N,62795,N,N,N,63088,N,50615,N,50614,63567,63568,50760,63697,N,50793,N, -44467,46772,58570,58569,59573,59572,N,N,49658,61251,61250,61861,61859,61862, -61860,N,N,50172,62372,62373,62374,N,63089,N,63346,N,63698,N,N,N,N,N,N,N,44468, -N,N,60503,61252,N,44469,N,N,48096,N,60504,49985,61863,50173,N,62796,62797, -50516,63569,44470,46011,46012,55374,46773,46774,56492,46775,N,47482,N,47484, -57567,57568,57566,47479,47480,47483,47481,N,N,58571,48097,48098,N,N,59580, -48743,59575,59574,N,59579,48741,N,N,49243,N,59576,59581,59578,59577,N,48742,N, -49241,N,60506,49237,N,60507,N,N,60505,N,49240,49238,49242,N,49239,N,N,N,N,N, -61253,N,61258,61254,61257,49659,N,60884,61256,61255,N,49988,49986,49989,49987, -61864,61865,61866,49990,N,N,N,62378,50240,62376,N,50241,62375,62377,50174, -62801,62798,N,62799,62800,63090,50518,N,50517,N,63348,63347,50616,N,N,N,50659, -50761,50784,63832,63918,63919,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44471,56493,N,N,57569, -58572,58573,48099,N,48100,59582,48744,N,N,49660,N,61867,N,49991,62381,50242, -62380,62382,62379,63093,62802,62803,N,50374,N,63092,N,N,63091,N,63349,63920,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,44472,N,N,N,44473,N,N,45223,54344,N,55375,N,46776,N, -46779,46777,56494,N,46781,N,46778,N,N,46780,N,47486,N,57570,N,N,57571,59584,N, -47485,47521,47522,58575,N,58574,48101,N,48102,N,58576,59583,48104,48745,N, -48103,N,N,N,49244,59585,48747,48746,59586,59589,59587,59588,48748,N,49249, -49247,N,N,49246,60509,N,49248,N,N,60508,61259,N,60510,49245,60511,61262,61260, -61261,61266,49995,61265,61268,61267,61264,61263,N,49661,N,N,N,N,61870,N,61869, -49994,49992,49993,N,61868,N,62385,N,50243,N,62384,62383,50244,N,62808,62807,N, -62805,N,62804,50376,50375,62809,63350,50617,63095,50519,63094,62806,N,63351, -50660,N,50785,63833,N,63921,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,44474,55376,61269,44475, -N,N,58578,58577,60512,N,N,61271,N,61270,N,49996,62386,62387,50377,N,N,63922, -45224,46783,46782,57572,57574,47524,57573,47523,47525,57575,N,N,N,58580,58582, -58581,N,58584,N,N,N,48105,58583,58579,N,N,N,58585,N,59596,N,59599,59601,59591, -59595,59592,48750,48753,48755,59593,59594,48754,59597,59600,59598,48756,N, -48752,59590,48749,N,48751,N,N,49251,60518,60516,60515,N,60521,N,60520,60519,N, -60514,49250,60513,N,60517,49252,N,N,61274,N,61278,61275,61277,61276,61273, -61279,61282,61280,61281,49728,49662,61272,61283,61875,61878,61880,61879,N, -61873,61877,61872,N,61874,49997,61871,N,61876,N,N,62400,62389,50245,N,N,50246, -62388,62393,62399,62391,62398,N,62395,N,62394,62397,62392,62390,N,62396,N, -62816,62814,50378,62813,62819,62817,N,50379,62812,62810,N,62811,50381,62815, -50380,62818,63096,63102,N,N,63097,50523,63137,50522,63101,63100,50521,63099, -50520,63098,N,63357,63393,63358,N,63355,50619,63352,63356,63395,N,63394,63353, -63354,50618,63570,50663,N,63571,50661,50662,N,N,63699,50762,63862,N,50794,N, -63923,50795,63924,63925,63939,63938,50810,63949,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,45225,N,N,57577,N,57576,N,48106,48107,58586,N,59602,60524,N,N, -48757,49253,60522,N,60525,49254,N,61284,60523,61881,49998,62401,N,N,N,62822, -62820,N,N,62821,N,N,63138,N,50524,63396,50666,50620,50664,50665,63700,50786,N, -45226,N,N,N,61882,N,N,54345,N,47526,N,58587,N,N,48108,58588,N,N,N,59604,59603, -49256,48758,48759,N,59607,59606,59605,N,N,60526,60529,N,60528,60527,49255, -61288,61286,61285,61287,N,49999,61884,61885,50000,N,61883,N,62403,62402,62405, -50247,62404,N,62823,62825,62824,N,N,63139,63142,63140,63141,63397,50621,N,N,N, -63572,63573,63574,N,50763,50787,63926,45227,N,48760,49257,61886,N,63398,N,N, -63940,54346,N,50811,45228,60530,N,61887,N,62406,N,N,63143,63399,45229,N,58589, -58590,N,48109,48110,59609,48762,48761,59608,N,61289,N,61888,61890,61889,50003, -50002,50001,N,50526,63144,N,50525,63401,63400,N,50764,63701,46013,57578,N,N,N, -58593,58591,58592,N,N,59618,N,59613,59610,59617,N,N,N,59619,N,N,48764,59616, -59612,N,N,59611,59615,59614,48763,N,N,60541,60536,60534,60577,60535,N,60531,N, -60537,N,N,60532,61298,60533,60578,N,N,N,N,N,N,N,60540,49258,60539,60538,N, -60542,N,N,N,N,61290,61293,N,N,61292,N,61300,61295,61299,N,61297,61296,61294,N, -61291,N,49731,49730,N,49732,49729,61301,N,N,N,N,N,61896,61899,N,61897,61901,N, -N,N,61902,N,61894,50008,61895,N,61893,61900,N,61892,61891,50007,50005,50004,N, -N,N,N,N,N,N,N,61898,62415,62421,50250,62416,N,62419,62423,50251,62418,N,62410, -N,62409,62422,62413,N,62411,62420,62412,50249,50248,N,62407,62408,62417,N,N,N, -62414,N,N,N,N,N,N,62828,62831,N,N,N,N,50006,62829,62835,62833,62827,62838,N, -62826,N,50383,62834,N,N,N,62830,50382,62837,N,N,62836,N,N,N,N,63147,63146,N,N, -N,63153,N,63149,63152,50528,N,N,63150,63151,N,63145,63148,50527,N,N,N,50623, -63412,63407,63411,N,63414,63410,N,63406,N,50625,63409,63413,50624,63404,62832, -63408,N,N,63405,N,63402,N,63403,50622,63578,63580,63583,63579,63584,N,63577,N, -63575,N,50667,63581,50669,50668,63576,63582,N,N,N,N,63706,50765,63707,N,63705, -63702,N,N,63704,63703,63834,N,N,N,N,63836,63835,N,N,63865,N,63864,63863,63866, -N,50803,50804,63946,63950,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,46014,56495,57581,N,47527,57579,N,N,57580,N,N,N,58594,58595,48113,48111, -58596,48112,59624,N,59627,59621,59628,59620,59622,N,59623,59626,N,N,48801, -59631,59630,48765,59625,59629,48766,N,N,N,N,N,N,60588,N,49263,N,60583,49259,N, -60580,60586,60589,N,49264,N,60585,60582,60590,60581,N,60587,49260,N,60579, -49261,N,49262,60584,N,N,N,61353,61306,61307,61310,61308,N,61302,N,N,61305, -61349,61309,N,N,49733,N,61351,61348,49734,61350,61303,61346,61347,N,61345,N,N, -N,N,61906,61908,61911,N,N,61905,N,50009,61913,61904,61914,N,61910,61912,61916, -61909,61917,61907,61903,50010,N,61915,50011,50253,N,N,N,N,N,61304,62449,62440, -50255,62436,50256,N,N,62445,62439,62429,50254,62442,62437,62438,N,62424,62431, -62446,N,62443,N,62435,N,62447,62430,62425,62444,N,62427,62441,62432,62448, -62428,50252,62426,62433,62434,N,N,N,62845,N,62843,N,62882,N,62894,62885,62844, -62840,62887,62846,62883,62842,62890,62839,62881,62886,62888,62891,62841,N, -62895,62896,62889,62893,62884,N,63169,63172,N,50529,N,63171,63176,63174,50530, -63165,63155,63154,50532,63167,63168,63164,63156,N,63161,62892,N,63157,50531, -63163,N,63162,N,63158,63170,N,63159,63419,63173,63175,63166,63160,63420,63422, -63416,50626,N,63429,63427,50627,63426,63425,63418,63415,63421,63430,63417, -63423,N,63593,63598,63588,63591,50670,63595,N,63602,63424,N,63589,63599,63603, -63594,63587,63597,N,63596,63601,63600,63428,63592,63586,63590,50766,50767, -63585,N,63718,63709,63717,63714,63715,63708,63711,63719,63713,63712,63710,N, -63716,N,63837,N,63838,N,63840,63839,63842,63841,63868,63867,63927,N,63928,N, -63941,50808,50812,N,63951,50813,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,46015,N,N,N,50384,63177,N, -50768,50769,N,46016,57582,N,47528,59632,N,N,60592,60593,60591,61355,61354, -49735,61919,61356,61918,N,N,62451,50257,50259,62450,N,N,50258,N,62897,62899, -62898,63178,50533,N,50671,63720,63843,N,N,63954,46017,N,58597,N,48802,N,N,N, -60595,60594,N,61357,N,N,N,50260,50385,63431,63947,N,N,N,46018,48114,N,48803,N, -62452,N,63604,46784,N,N,N,N,61358,N,N,N,50788,46785,48804,49736,63605,46786,N, -59633,49266,60596,60597,N,49265,N,61359,49740,49738,49739,49737,61920,50012,N, -N,N,62901,62900,62903,62902,50386,N,N,63179,N,63181,63180,50534,63432,N,63606, -63607,50672,63844,63869,50805,N,56496,60598,61360,62453,57583,N,61361,61922, -61921,N,N,N,N,63608,50770,N,63845,63870,N,N,N,47529,59634,59635,N,60599,47530, -N,50013,61923,N,63183,50535,63184,63182,63609,N,63721,N,47531,N,61364,61363, -61362,61924,N,N,61928,61927,61926,61925,50014,62454,62905,50387,62904,63185, -63435,63434,50628,63433,63612,63611,63610,N,N,48115,N,60600,49741,N,62455, -62456,63436,63613,N,N,63722,63846,63929,63956,48116,49742,61929,62457,63186, -63614,N,N,48806,N,61365,61930,62458,62459,62460,62910,N,62906,50536,62909, -62908,50388,62907,50390,N,50389,63188,63187,50537,50538,N,N,50630,63437,50629, -N,63651,63652,63650,63649,50772,N,63723,63724,63725,50771,63847,63850,63849, -63848,N,N,63955,N,N,N,N,N,N,N,N,N,N,N,N,N,N,49267,N,N,50021,62911,63189,N, -50631,63438,N,N,63957,N,N,N,49268,N,N,N,61366,N,63439,N,63905,51530,56828, -41290,41303,N,41305,41307,41311,41312,41315,41316,41319,41320,41323,41324, -41327,41328,41331,41332,41335,41336,41339,41340,N,N,N,N,41414,41415,41418, -41419,41416,41417,41308,41293,N,41295,N,41297,41298,41299,41300,N,41341,41342, -41377,41378,41379,41380,41420,41421,41422,41438,41439,41440,41441,41442,N,N, -41548,41549,41550,41289,N,41389,41539,41544,41390,N,41309,41310,41391,41423, -41281,41424,41284,41537,41647,41648,41649,41650,41651,41652,41653,41654,41655, -41656,41287,41286,41429,41431,41430,41288,41545,41679,41680,41681,41682,41683, -41684,41685,41686,41687,41688,41689,41690,41691,41692,41693,41694,41695,41696, -41697,41698,41699,41700,41701,41702,41703,41704,N,41538,N,N,41412,N,41705, -41706,41707,41708,41709,41710,41711,41712,41713,41714,41715,41716,41717,41718, -41719,41720,41721,41722,41723,41724,41725,41726,41792,41793,41794,41795,41313, -41301,41314,N,N,N,N,N,N,41294,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41411, -}; - -static const struct unim_index big5_encmap[256] = { -{__big5_encmap+0,162,247},{0,0,0},{__big5_encmap+86,199,217},{__big5_encmap+ -105,145,201},{__big5_encmap+162,1,81},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{__big5_encmap+243,19,62},{__big5_encmap+287,3,153},{ -__big5_encmap+438,26,191},{0,0,0},{__big5_encmap+604,96,125},{__big5_encmap+ -634,0,229},{__big5_encmap+864,5,66},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{__big5_encmap+926,0,254},{__big5_encmap+1181, -5,41},{__big5_encmap+1218,163,163},{__big5_encmap+1219,142,213},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__big5_encmap+1291,0,255},{ -__big5_encmap+1547,0,254},{__big5_encmap+1802,0,255},{__big5_encmap+2058,0,253 -},{__big5_encmap+2312,0,255},{__big5_encmap+2568,5,252},{__big5_encmap+2816,1, -255},{__big5_encmap+3071,1,255},{__big5_encmap+3326,0,255},{__big5_encmap+3582 -,1,253},{__big5_encmap+3835,0,255},{__big5_encmap+4091,3,255},{__big5_encmap+ -4344,0,255},{__big5_encmap+4600,1,250},{__big5_encmap+4850,1,255},{ -__big5_encmap+5105,0,255},{__big5_encmap+5361,2,255},{__big5_encmap+5615,1,255 -},{__big5_encmap+5870,0,255},{__big5_encmap+6126,0,255},{__big5_encmap+6382,0, -255},{__big5_encmap+6638,0,249},{__big5_encmap+6888,6,255},{__big5_encmap+7138 -,0,253},{__big5_encmap+7392,0,255},{__big5_encmap+7648,0,255},{__big5_encmap+ -7904,18,253},{__big5_encmap+8140,4,255},{__big5_encmap+8392,0,252},{ -__big5_encmap+8645,0,255},{__big5_encmap+8901,0,249},{__big5_encmap+9151,0,253 -},{__big5_encmap+9405,0,255},{__big5_encmap+9661,0,255},{__big5_encmap+9917,0, -255},{__big5_encmap+10173,0,255},{__big5_encmap+10429,1,255},{__big5_encmap+ -10684,0,255},{__big5_encmap+10940,0,255},{__big5_encmap+11196,0,255},{ -__big5_encmap+11452,0,254},{__big5_encmap+11707,1,253},{__big5_encmap+11960,2, -255},{__big5_encmap+12214,1,251},{__big5_encmap+12465,0,255},{__big5_encmap+ -12721,0,255},{__big5_encmap+12977,0,254},{__big5_encmap+13232,0,251},{ -__big5_encmap+13484,3,156},{__big5_encmap+13638,54,255},{__big5_encmap+13840, -0,254},{__big5_encmap+14095,0,255},{__big5_encmap+14351,0,254},{__big5_encmap+ -14606,0,255},{__big5_encmap+14862,1,255},{__big5_encmap+15117,0,255},{ -__big5_encmap+15373,0,254},{__big5_encmap+15628,0,255},{__big5_encmap+15884,0, -254},{__big5_encmap+16139,1,255},{__big5_encmap+16394,0,255},{__big5_encmap+ -16650,0,159},{__big5_encmap+16810,55,254},{__big5_encmap+17010,0,255},{ -__big5_encmap+17266,0,255},{__big5_encmap+17522,0,255},{__big5_encmap+17778,0, -255},{__big5_encmap+18034,0,255},{__big5_encmap+18290,0,255},{__big5_encmap+ -18546,0,255},{__big5_encmap+18802,0,131},{__big5_encmap+18934,119,229},{ -__big5_encmap+19045,28,255},{__big5_encmap+19273,0,255},{__big5_encmap+19529, -0,254},{__big5_encmap+19784,0,255},{__big5_encmap+20040,1,254},{__big5_encmap+ -20294,1,253},{__big5_encmap+20547,5,255},{__big5_encmap+20798,0,255},{ -__big5_encmap+21054,0,255},{__big5_encmap+21310,0,164},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{__big5_encmap+21475,12,13},{0,0,0},{0,0,0},{0,0,0},{__big5_encmap+21477,48, -107},{__big5_encmap+21537,1,227}, -}; - -static const ucs2_t __cp950ext_decmap[224] = { -8231,U,U,U,U,U,U,U,U,65105,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,U,U,U,U,U,175,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U,U, -U,U,U,U,U,U,U,65374,U,U,U,U,U,U,U,U,U,U,U,U,U,U,8853,8857,8725,65128,U,65509, -U,65504,65505,8364,30849,37561,35023,22715,24658,31911,23290,9556,9574,9559, -9568,9580,9571,9562,9577,9565,9554,9572,9557,9566,9578,9569,9560,9575,9563, -9555,9573,9558,9567,9579,9570,9561,9576,9564,9553,9552,9581,9582,9584,9583, -9619, -}; - -static const struct dbcs_index cp950ext_decmap[256] = { -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_decmap+0,69,243 -},{__cp950ext_decmap+175,65,71},{__cp950ext_decmap+182,225,225},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_decmap+183,214,254 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -}; - -static const DBCHAR __cp950ext_encmap[581] = { -41410,41285,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41953,41537,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -41458,N,N,N,41459,63992,63974,63983,63965,63976,63985,63967,63980,63989,63971, -63982,63991,63973,N,63986,63968,N,63988,63970,63975,63984,63966,63981,63990, -63972,N,63987,63969,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,63998,63961,63964,63962,63958,63963,63960,63959,41294,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41538,41470,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41536,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,41443,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N, -N,N,N,41542,41543,N,N,N,41540, -}; - -static const struct unim_index cp950ext_encmap[256] = { -{__cp950ext_encmap+0,175,175},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}, -{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_encmap+1,39,172},{0, -0,0},{__cp950ext_encmap+135,21,153},{0,0,0},{0,0,0},{__cp950ext_encmap+268,81, -147},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{__cp950ext_encmap+335,187,187},{0,0,0},{__cp950ext_encmap+ -336,250,250},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_encmap+337, -82,82},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_encmap+338,129,129},{0,0,0},{ -0,0,0},{0,0,0},{__cp950ext_encmap+339,167,167},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_encmap+ -340,207,207},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{__cp950ext_encmap+341,185,185},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{ -0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0 -},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0, -0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{__cp950ext_encmap+342,81,104},{ -__cp950ext_encmap+366,15,229}, -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.c deleted file mode 100644 index 882fbdd..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.c +++ /dev/null @@ -1,1832 +0,0 @@ -/* - * multibytecodec.c: Common Multibyte Codec Implementation - * - * Written by Hye-Shik Chang - */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "multibytecodec.h" - -typedef struct { - const Py_UNICODE *inbuf, *inbuf_top, *inbuf_end; - unsigned char *outbuf, *outbuf_end; - PyObject *excobj, *outobj; -} MultibyteEncodeBuffer; - -typedef struct { - const unsigned char *inbuf, *inbuf_top, *inbuf_end; - Py_UNICODE *outbuf, *outbuf_end; - PyObject *excobj, *outobj; -} MultibyteDecodeBuffer; - -PyDoc_STRVAR(MultibyteCodec_Encode__doc__, -"I.encode(unicode[, errors]) -> (string, length consumed)\n\ -\n\ -Return an encoded string version of `unicode'. errors may be given to\n\ -set a different error handling scheme. Default is 'strict' meaning that\n\ -encoding errors raise a UnicodeEncodeError. Other possible values are\n\ -'ignore', 'replace' and 'xmlcharrefreplace' as well as any other name\n\ -registered with codecs.register_error that can handle UnicodeEncodeErrors."); - -PyDoc_STRVAR(MultibyteCodec_Decode__doc__, -"I.decode(string[, errors]) -> (unicodeobject, length consumed)\n\ -\n\ -Decodes `string' using I, an MultibyteCodec instance. errors may be given\n\ -to set a different error handling scheme. Default is 'strict' meaning\n\ -that encoding errors raise a UnicodeDecodeError. Other possible values\n\ -are 'ignore' and 'replace' as well as any other name registered with\n\ -codecs.register_error that is able to handle UnicodeDecodeErrors."); - -static char *codeckwarglist[] = {"input", "errors", NULL}; -static char *incnewkwarglist[] = {"errors", NULL}; -static char *incrementalkwarglist[] = {"input", "final", NULL}; -static char *streamkwarglist[] = {"stream", "errors", NULL}; - -static PyObject *multibytecodec_encode(MultibyteCodec *, - MultibyteCodec_State *, const Py_UNICODE **, Py_ssize_t, - PyObject *, int); - -#define MBENC_RESET MBENC_MAX<<1 /* reset after an encoding session */ - -static PyObject * -make_tuple(PyObject *object, Py_ssize_t len) -{ - PyObject *v, *w; - - if (object == NULL) - return NULL; - - v = PyTuple_New(2); - if (v == NULL) { - Py_DECREF(object); - return NULL; - } - PyTuple_SET_ITEM(v, 0, object); - - w = PyInt_FromSsize_t(len); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyTuple_SET_ITEM(v, 1, w); - - return v; -} - -static PyObject * -internal_error_callback(const char *errors) -{ - if (errors == NULL || strcmp(errors, "strict") == 0) - return ERROR_STRICT; - else if (strcmp(errors, "ignore") == 0) - return ERROR_IGNORE; - else if (strcmp(errors, "replace") == 0) - return ERROR_REPLACE; - else - return PyString_FromString(errors); -} - -static PyObject * -call_error_callback(PyObject *errors, PyObject *exc) -{ - PyObject *args, *cb, *r; - - assert(PyString_Check(errors)); - cb = PyCodec_LookupError(PyString_AS_STRING(errors)); - if (cb == NULL) - return NULL; - - args = PyTuple_New(1); - if (args == NULL) { - Py_DECREF(cb); - return NULL; - } - - PyTuple_SET_ITEM(args, 0, exc); - Py_INCREF(exc); - - r = PyObject_CallObject(cb, args); - Py_DECREF(args); - Py_DECREF(cb); - return r; -} - -static PyObject * -codecctx_errors_get(MultibyteStatefulCodecContext *self) -{ - const char *errors; - - if (self->errors == ERROR_STRICT) - errors = "strict"; - else if (self->errors == ERROR_IGNORE) - errors = "ignore"; - else if (self->errors == ERROR_REPLACE) - errors = "replace"; - else { - Py_INCREF(self->errors); - return self->errors; - } - - return PyString_FromString(errors); -} - -static int -codecctx_errors_set(MultibyteStatefulCodecContext *self, PyObject *value, - void *closure) -{ - PyObject *cb; - - if (!PyString_Check(value)) { - PyErr_SetString(PyExc_TypeError, "errors must be a string"); - return -1; - } - - cb = internal_error_callback(PyString_AS_STRING(value)); - if (cb == NULL) - return -1; - - ERROR_DECREF(self->errors); - self->errors = cb; - return 0; -} - -/* This getset handlers list is used by all the stateful codec objects */ -static PyGetSetDef codecctx_getsets[] = { - {"errors", (getter)codecctx_errors_get, - (setter)codecctx_errors_set, - PyDoc_STR("how to treat errors")}, - {NULL,} -}; - -static int -expand_encodebuffer(MultibyteEncodeBuffer *buf, Py_ssize_t esize) -{ - Py_ssize_t orgpos, orgsize, incsize; - - orgpos = (Py_ssize_t)((char *)buf->outbuf - - PyString_AS_STRING(buf->outobj)); - orgsize = PyString_GET_SIZE(buf->outobj); - incsize = (esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize); - - if (orgsize > PY_SSIZE_T_MAX - incsize) { - PyErr_NoMemory(); - return -1; - } - - if (_PyString_Resize(&buf->outobj, orgsize + incsize) == -1) - return -1; - - buf->outbuf = (unsigned char *)PyString_AS_STRING(buf->outobj) +orgpos; - buf->outbuf_end = (unsigned char *)PyString_AS_STRING(buf->outobj) - + PyString_GET_SIZE(buf->outobj); - - return 0; -} -#define REQUIRE_ENCODEBUFFER(buf, s) do { \ - if ((s) < 0 || (s) > (buf)->outbuf_end - (buf)->outbuf) \ - if (expand_encodebuffer(buf, s) == -1) \ - goto errorexit; \ -} while(0) - -static int -expand_decodebuffer(MultibyteDecodeBuffer *buf, Py_ssize_t esize) -{ - Py_ssize_t orgpos, orgsize; - - orgpos = (Py_ssize_t)(buf->outbuf - PyUnicode_AS_UNICODE(buf->outobj)); - orgsize = PyUnicode_GET_SIZE(buf->outobj); - if (PyUnicode_Resize(&buf->outobj, orgsize + ( - esize < (orgsize >> 1) ? (orgsize >> 1) | 1 : esize)) == -1) - return -1; - - buf->outbuf = PyUnicode_AS_UNICODE(buf->outobj) + orgpos; - buf->outbuf_end = PyUnicode_AS_UNICODE(buf->outobj) - + PyUnicode_GET_SIZE(buf->outobj); - - return 0; -} -#define REQUIRE_DECODEBUFFER(buf, s) do { \ - if ((s) < 0 || (s) > (buf)->outbuf_end - (buf)->outbuf) \ - if (expand_decodebuffer(buf, s) == -1) \ - goto errorexit; \ -} while(0) - - -/** - * MultibyteCodec object - */ - -static int -multibytecodec_encerror(MultibyteCodec *codec, - MultibyteCodec_State *state, - MultibyteEncodeBuffer *buf, - PyObject *errors, Py_ssize_t e) -{ - PyObject *retobj = NULL, *retstr = NULL, *tobj; - Py_ssize_t retstrsize, newpos; - Py_ssize_t esize, start, end; - const char *reason; - - if (e > 0) { - reason = "illegal multibyte sequence"; - esize = e; - } - else { - switch (e) { - case MBERR_TOOSMALL: - REQUIRE_ENCODEBUFFER(buf, -1); - return 0; /* retry it */ - case MBERR_TOOFEW: - reason = "incomplete multibyte sequence"; - esize = (Py_ssize_t)(buf->inbuf_end - buf->inbuf); - break; - case MBERR_INTERNAL: - PyErr_SetString(PyExc_RuntimeError, - "internal codec error"); - return -1; - default: - PyErr_SetString(PyExc_RuntimeError, - "unknown runtime error"); - return -1; - } - } - - if (errors == ERROR_REPLACE) { - const Py_UNICODE replchar = '?', *inbuf = &replchar; - Py_ssize_t r; - - for (;;) { - Py_ssize_t outleft; - - outleft = (Py_ssize_t)(buf->outbuf_end - buf->outbuf); - r = codec->encode(state, codec->config, &inbuf, 1, - &buf->outbuf, outleft, 0); - if (r == MBERR_TOOSMALL) { - REQUIRE_ENCODEBUFFER(buf, -1); - continue; - } - else - break; - } - - if (r != 0) { - REQUIRE_ENCODEBUFFER(buf, 1); - *buf->outbuf++ = '?'; - } - } - if (errors == ERROR_IGNORE || errors == ERROR_REPLACE) { - buf->inbuf += esize; - return 0; - } - - start = (Py_ssize_t)(buf->inbuf - buf->inbuf_top); - end = start + esize; - - /* use cached exception object if available */ - if (buf->excobj == NULL) { - buf->excobj = PyUnicodeEncodeError_Create(codec->encoding, - buf->inbuf_top, - buf->inbuf_end - buf->inbuf_top, - start, end, reason); - if (buf->excobj == NULL) - goto errorexit; - } - else - if (PyUnicodeEncodeError_SetStart(buf->excobj, start) != 0 || - PyUnicodeEncodeError_SetEnd(buf->excobj, end) != 0 || - PyUnicodeEncodeError_SetReason(buf->excobj, reason) != 0) - goto errorexit; - - if (errors == ERROR_STRICT) { - PyCodec_StrictErrors(buf->excobj); - goto errorexit; - } - - retobj = call_error_callback(errors, buf->excobj); - if (retobj == NULL) - goto errorexit; - - if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || - !PyUnicode_Check((tobj = PyTuple_GET_ITEM(retobj, 0))) || - !(PyInt_Check(PyTuple_GET_ITEM(retobj, 1)) || - PyLong_Check(PyTuple_GET_ITEM(retobj, 1)))) { - PyErr_SetString(PyExc_TypeError, - "encoding error handler must return " - "(unicode, int) tuple"); - goto errorexit; - } - - { - const Py_UNICODE *uraw = PyUnicode_AS_UNICODE(tobj); - - retstr = multibytecodec_encode(codec, state, &uraw, - PyUnicode_GET_SIZE(tobj), ERROR_STRICT, - MBENC_FLUSH); - if (retstr == NULL) - goto errorexit; - } - - retstrsize = PyString_GET_SIZE(retstr); - if (retstrsize > 0) { - REQUIRE_ENCODEBUFFER(buf, retstrsize); - memcpy(buf->outbuf, PyString_AS_STRING(retstr), retstrsize); - buf->outbuf += retstrsize; - } - - newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); - if (newpos < 0 && !PyErr_Occurred()) - newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top); - if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, - "position %zd from error handler out of bounds", - newpos); - goto errorexit; - } - buf->inbuf = buf->inbuf_top + newpos; - - Py_DECREF(retobj); - Py_DECREF(retstr); - return 0; - -errorexit: - Py_XDECREF(retobj); - Py_XDECREF(retstr); - return -1; -} - -static int -multibytecodec_decerror(MultibyteCodec *codec, - MultibyteCodec_State *state, - MultibyteDecodeBuffer *buf, - PyObject *errors, Py_ssize_t e) -{ - PyObject *retobj = NULL, *retuni = NULL; - Py_ssize_t retunisize, newpos; - const char *reason; - Py_ssize_t esize, start, end; - - if (e > 0) { - reason = "illegal multibyte sequence"; - esize = e; - } - else { - switch (e) { - case MBERR_TOOSMALL: - REQUIRE_DECODEBUFFER(buf, -1); - return 0; /* retry it */ - case MBERR_TOOFEW: - reason = "incomplete multibyte sequence"; - esize = (Py_ssize_t)(buf->inbuf_end - buf->inbuf); - break; - case MBERR_INTERNAL: - PyErr_SetString(PyExc_RuntimeError, - "internal codec error"); - return -1; - default: - PyErr_SetString(PyExc_RuntimeError, - "unknown runtime error"); - return -1; - } - } - - if (errors == ERROR_REPLACE) { - REQUIRE_DECODEBUFFER(buf, 1); - *buf->outbuf++ = Py_UNICODE_REPLACEMENT_CHARACTER; - } - if (errors == ERROR_IGNORE || errors == ERROR_REPLACE) { - buf->inbuf += esize; - return 0; - } - - start = (Py_ssize_t)(buf->inbuf - buf->inbuf_top); - end = start + esize; - - /* use cached exception object if available */ - if (buf->excobj == NULL) { - buf->excobj = PyUnicodeDecodeError_Create(codec->encoding, - (const char *)buf->inbuf_top, - (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top), - start, end, reason); - if (buf->excobj == NULL) - goto errorexit; - } - else - if (PyUnicodeDecodeError_SetStart(buf->excobj, start) || - PyUnicodeDecodeError_SetEnd(buf->excobj, end) || - PyUnicodeDecodeError_SetReason(buf->excobj, reason)) - goto errorexit; - - if (errors == ERROR_STRICT) { - PyCodec_StrictErrors(buf->excobj); - goto errorexit; - } - - retobj = call_error_callback(errors, buf->excobj); - if (retobj == NULL) - goto errorexit; - - if (!PyTuple_Check(retobj) || PyTuple_GET_SIZE(retobj) != 2 || - !PyUnicode_Check((retuni = PyTuple_GET_ITEM(retobj, 0))) || - !(PyInt_Check(PyTuple_GET_ITEM(retobj, 1)) || - PyLong_Check(PyTuple_GET_ITEM(retobj, 1)))) { - PyErr_SetString(PyExc_TypeError, - "decoding error handler must return " - "(unicode, int) tuple"); - goto errorexit; - } - - retunisize = PyUnicode_GET_SIZE(retuni); - if (retunisize > 0) { - REQUIRE_DECODEBUFFER(buf, retunisize); - memcpy((char *)buf->outbuf, PyUnicode_AS_DATA(retuni), - retunisize * Py_UNICODE_SIZE); - buf->outbuf += retunisize; - } - - newpos = PyInt_AsSsize_t(PyTuple_GET_ITEM(retobj, 1)); - if (newpos < 0 && !PyErr_Occurred()) - newpos += (Py_ssize_t)(buf->inbuf_end - buf->inbuf_top); - if (newpos < 0 || buf->inbuf_top + newpos > buf->inbuf_end) { - PyErr_Clear(); - PyErr_Format(PyExc_IndexError, - "position %zd from error handler out of bounds", - newpos); - goto errorexit; - } - buf->inbuf = buf->inbuf_top + newpos; - Py_DECREF(retobj); - return 0; - -errorexit: - Py_XDECREF(retobj); - return -1; -} - -static PyObject * -multibytecodec_encode(MultibyteCodec *codec, - MultibyteCodec_State *state, - const Py_UNICODE **data, Py_ssize_t datalen, - PyObject *errors, int flags) -{ - MultibyteEncodeBuffer buf; - Py_ssize_t finalsize, r = 0; - - if (datalen == 0 && !(flags & MBENC_RESET)) - return PyString_FromString(""); - - buf.excobj = NULL; - buf.inbuf = buf.inbuf_top = *data; - buf.inbuf_end = buf.inbuf_top + datalen; - - if (datalen > (PY_SSIZE_T_MAX - 16) / 2) { - PyErr_NoMemory(); - goto errorexit; - } - - buf.outobj = PyString_FromStringAndSize(NULL, datalen * 2 + 16); - if (buf.outobj == NULL) - goto errorexit; - buf.outbuf = (unsigned char *)PyString_AS_STRING(buf.outobj); - buf.outbuf_end = buf.outbuf + PyString_GET_SIZE(buf.outobj); - - while (buf.inbuf < buf.inbuf_end) { - Py_ssize_t inleft, outleft; - - /* we don't reuse inleft and outleft here. - * error callbacks can relocate the cursor anywhere on buffer*/ - inleft = (Py_ssize_t)(buf.inbuf_end - buf.inbuf); - outleft = (Py_ssize_t)(buf.outbuf_end - buf.outbuf); - r = codec->encode(state, codec->config, &buf.inbuf, inleft, - &buf.outbuf, outleft, flags); - if ((r == 0) || (r == MBERR_TOOFEW && !(flags & MBENC_FLUSH))) - break; - else if (multibytecodec_encerror(codec, state, &buf, errors,r)) - goto errorexit; - else if (r == MBERR_TOOFEW) - break; - } - - if (codec->encreset != NULL && (flags & MBENC_RESET)) - for (;;) { - Py_ssize_t outleft; - - outleft = (Py_ssize_t)(buf.outbuf_end - buf.outbuf); - r = codec->encreset(state, codec->config, &buf.outbuf, - outleft); - if (r == 0) - break; - else if (multibytecodec_encerror(codec, state, - &buf, errors, r)) - goto errorexit; - } - - finalsize = (Py_ssize_t)((char *)buf.outbuf - - PyString_AS_STRING(buf.outobj)); - - if (finalsize != PyString_GET_SIZE(buf.outobj)) - if (_PyString_Resize(&buf.outobj, finalsize) == -1) - goto errorexit; - - *data = buf.inbuf; - Py_XDECREF(buf.excobj); - return buf.outobj; - -errorexit: - Py_XDECREF(buf.excobj); - Py_XDECREF(buf.outobj); - return NULL; -} - -static PyObject * -MultibyteCodec_Encode(MultibyteCodecObject *self, - PyObject *args, PyObject *kwargs) -{ - MultibyteCodec_State state; - Py_UNICODE *data; - PyObject *errorcb, *r, *arg, *ucvt; - const char *errors = NULL; - Py_ssize_t datalen; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|z:encode", - codeckwarglist, &arg, &errors)) - return NULL; - - if (PyUnicode_Check(arg)) - ucvt = NULL; - else { - arg = ucvt = PyObject_Unicode(arg); - if (arg == NULL) - return NULL; - else if (!PyUnicode_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "couldn't convert the object to unicode."); - Py_DECREF(ucvt); - return NULL; - } - } - - data = PyUnicode_AS_UNICODE(arg); - datalen = PyUnicode_GET_SIZE(arg); - - errorcb = internal_error_callback(errors); - if (errorcb == NULL) { - Py_XDECREF(ucvt); - return NULL; - } - - if (self->codec->encinit != NULL && - self->codec->encinit(&state, self->codec->config) != 0) - goto errorexit; - r = multibytecodec_encode(self->codec, &state, - (const Py_UNICODE **)&data, datalen, errorcb, - MBENC_FLUSH | MBENC_RESET); - if (r == NULL) - goto errorexit; - - ERROR_DECREF(errorcb); - Py_XDECREF(ucvt); - return make_tuple(r, datalen); - -errorexit: - ERROR_DECREF(errorcb); - Py_XDECREF(ucvt); - return NULL; -} - -static PyObject * -MultibyteCodec_Decode(MultibyteCodecObject *self, - PyObject *args, PyObject *kwargs) -{ - MultibyteCodec_State state; - MultibyteDecodeBuffer buf; - PyObject *errorcb; - Py_buffer pdata; - const char *data, *errors = NULL; - Py_ssize_t datalen, finalsize; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|z:decode", - codeckwarglist, &pdata, &errors)) - return NULL; - data = pdata.buf; - datalen = pdata.len; - - errorcb = internal_error_callback(errors); - if (errorcb == NULL) { - PyBuffer_Release(&pdata); - return NULL; - } - - if (datalen == 0) { - PyBuffer_Release(&pdata); - ERROR_DECREF(errorcb); - return make_tuple(PyUnicode_FromUnicode(NULL, 0), 0); - } - - buf.excobj = NULL; - buf.inbuf = buf.inbuf_top = (unsigned char *)data; - buf.inbuf_end = buf.inbuf_top + datalen; - buf.outobj = PyUnicode_FromUnicode(NULL, datalen); - if (buf.outobj == NULL) - goto errorexit; - buf.outbuf = PyUnicode_AS_UNICODE(buf.outobj); - buf.outbuf_end = buf.outbuf + PyUnicode_GET_SIZE(buf.outobj); - - if (self->codec->decinit != NULL && - self->codec->decinit(&state, self->codec->config) != 0) - goto errorexit; - - while (buf.inbuf < buf.inbuf_end) { - Py_ssize_t inleft, outleft, r; - - inleft = (Py_ssize_t)(buf.inbuf_end - buf.inbuf); - outleft = (Py_ssize_t)(buf.outbuf_end - buf.outbuf); - - r = self->codec->decode(&state, self->codec->config, - &buf.inbuf, inleft, &buf.outbuf, outleft); - if (r == 0) - break; - else if (multibytecodec_decerror(self->codec, &state, - &buf, errorcb, r)) - goto errorexit; - } - - finalsize = (Py_ssize_t)(buf.outbuf - - PyUnicode_AS_UNICODE(buf.outobj)); - - if (finalsize != PyUnicode_GET_SIZE(buf.outobj)) - if (PyUnicode_Resize(&buf.outobj, finalsize) == -1) - goto errorexit; - - PyBuffer_Release(&pdata); - Py_XDECREF(buf.excobj); - ERROR_DECREF(errorcb); - return make_tuple(buf.outobj, datalen); - -errorexit: - PyBuffer_Release(&pdata); - ERROR_DECREF(errorcb); - Py_XDECREF(buf.excobj); - Py_XDECREF(buf.outobj); - - return NULL; -} - -static struct PyMethodDef multibytecodec_methods[] = { - {"encode", (PyCFunction)MultibyteCodec_Encode, - METH_VARARGS | METH_KEYWORDS, - MultibyteCodec_Encode__doc__}, - {"decode", (PyCFunction)MultibyteCodec_Decode, - METH_VARARGS | METH_KEYWORDS, - MultibyteCodec_Decode__doc__}, - {NULL, NULL}, -}; - -static void -multibytecodec_dealloc(MultibyteCodecObject *self) -{ - PyObject_Del(self); -} - -static PyTypeObject MultibyteCodec_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MultibyteCodec", /* tp_name */ - sizeof(MultibyteCodecObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)multibytecodec_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iterext */ - multibytecodec_methods, /* tp_methods */ -}; - - -/** - * Utility functions for stateful codec mechanism - */ - -#define STATEFUL_DCTX(o) ((MultibyteStatefulDecoderContext *)(o)) -#define STATEFUL_ECTX(o) ((MultibyteStatefulEncoderContext *)(o)) - -static PyObject * -encoder_encode_stateful(MultibyteStatefulEncoderContext *ctx, - PyObject *unistr, int final) -{ - PyObject *ucvt, *r = NULL; - Py_UNICODE *inbuf, *inbuf_end, *inbuf_tmp = NULL; - Py_ssize_t datalen, origpending; - - if (PyUnicode_Check(unistr)) - ucvt = NULL; - else { - unistr = ucvt = PyObject_Unicode(unistr); - if (unistr == NULL) - return NULL; - else if (!PyUnicode_Check(unistr)) { - PyErr_SetString(PyExc_TypeError, - "couldn't convert the object to unicode."); - Py_DECREF(ucvt); - return NULL; - } - } - - datalen = PyUnicode_GET_SIZE(unistr); - origpending = ctx->pendingsize; - - if (origpending > 0) { - if (datalen > PY_SSIZE_T_MAX - ctx->pendingsize) { - PyErr_NoMemory(); - /* inbuf_tmp == NULL */ - goto errorexit; - } - inbuf_tmp = PyMem_New(Py_UNICODE, datalen + ctx->pendingsize); - if (inbuf_tmp == NULL) - goto errorexit; - memcpy(inbuf_tmp, ctx->pending, - Py_UNICODE_SIZE * ctx->pendingsize); - memcpy(inbuf_tmp + ctx->pendingsize, - PyUnicode_AS_UNICODE(unistr), - Py_UNICODE_SIZE * datalen); - datalen += ctx->pendingsize; - ctx->pendingsize = 0; - inbuf = inbuf_tmp; - } - else - inbuf = (Py_UNICODE *)PyUnicode_AS_UNICODE(unistr); - - inbuf_end = inbuf + datalen; - - r = multibytecodec_encode(ctx->codec, &ctx->state, - (const Py_UNICODE **)&inbuf, datalen, - ctx->errors, final ? MBENC_FLUSH | MBENC_RESET : 0); - if (r == NULL) { - /* recover the original pending buffer */ - if (origpending > 0) - memcpy(ctx->pending, inbuf_tmp, - Py_UNICODE_SIZE * origpending); - ctx->pendingsize = origpending; - goto errorexit; - } - - if (inbuf < inbuf_end) { - ctx->pendingsize = (Py_ssize_t)(inbuf_end - inbuf); - if (ctx->pendingsize > MAXENCPENDING) { - /* normal codecs can't reach here */ - ctx->pendingsize = 0; - PyErr_SetString(PyExc_UnicodeError, - "pending buffer overflow"); - goto errorexit; - } - memcpy(ctx->pending, inbuf, - ctx->pendingsize * Py_UNICODE_SIZE); - } - - if (inbuf_tmp != NULL) - PyMem_Del(inbuf_tmp); - Py_XDECREF(ucvt); - return r; - -errorexit: - if (inbuf_tmp != NULL) - PyMem_Del(inbuf_tmp); - Py_XDECREF(r); - Py_XDECREF(ucvt); - return NULL; -} - -static int -decoder_append_pending(MultibyteStatefulDecoderContext *ctx, - MultibyteDecodeBuffer *buf) -{ - Py_ssize_t npendings; - - npendings = (Py_ssize_t)(buf->inbuf_end - buf->inbuf); - if (npendings + ctx->pendingsize > MAXDECPENDING || - npendings > PY_SSIZE_T_MAX - ctx->pendingsize) { - PyErr_SetString(PyExc_UnicodeError, "pending buffer overflow"); - return -1; - } - memcpy(ctx->pending + ctx->pendingsize, buf->inbuf, npendings); - ctx->pendingsize += npendings; - return 0; -} - -static int -decoder_prepare_buffer(MultibyteDecodeBuffer *buf, const char *data, - Py_ssize_t size) -{ - buf->inbuf = buf->inbuf_top = (const unsigned char *)data; - buf->inbuf_end = buf->inbuf_top + size; - if (buf->outobj == NULL) { /* only if outobj is not allocated yet */ - buf->outobj = PyUnicode_FromUnicode(NULL, size); - if (buf->outobj == NULL) - return -1; - buf->outbuf = PyUnicode_AS_UNICODE(buf->outobj); - buf->outbuf_end = buf->outbuf + - PyUnicode_GET_SIZE(buf->outobj); - } - - return 0; -} - -static int -decoder_feed_buffer(MultibyteStatefulDecoderContext *ctx, - MultibyteDecodeBuffer *buf) -{ - while (buf->inbuf < buf->inbuf_end) { - Py_ssize_t inleft, outleft; - Py_ssize_t r; - - inleft = (Py_ssize_t)(buf->inbuf_end - buf->inbuf); - outleft = (Py_ssize_t)(buf->outbuf_end - buf->outbuf); - - r = ctx->codec->decode(&ctx->state, ctx->codec->config, - &buf->inbuf, inleft, &buf->outbuf, outleft); - if (r == 0 || r == MBERR_TOOFEW) - break; - else if (multibytecodec_decerror(ctx->codec, &ctx->state, - buf, ctx->errors, r)) - return -1; - } - return 0; -} - - -/** - * MultibyteIncrementalEncoder object - */ - -static PyObject * -mbiencoder_encode(MultibyteIncrementalEncoderObject *self, - PyObject *args, PyObject *kwargs) -{ - PyObject *data; - int final = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O|i:encode", - incrementalkwarglist, &data, &final)) - return NULL; - - return encoder_encode_stateful(STATEFUL_ECTX(self), data, final); -} - -static PyObject * -mbiencoder_reset(MultibyteIncrementalEncoderObject *self) -{ - if (self->codec->decreset != NULL && - self->codec->decreset(&self->state, self->codec->config) != 0) - return NULL; - self->pendingsize = 0; - - Py_RETURN_NONE; -} - -static struct PyMethodDef mbiencoder_methods[] = { - {"encode", (PyCFunction)mbiencoder_encode, - METH_VARARGS | METH_KEYWORDS, NULL}, - {"reset", (PyCFunction)mbiencoder_reset, - METH_NOARGS, NULL}, - {NULL, NULL}, -}; - -static PyObject * -mbiencoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - MultibyteIncrementalEncoderObject *self; - PyObject *codec = NULL; - char *errors = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s:IncrementalEncoder", - incnewkwarglist, &errors)) - return NULL; - - self = (MultibyteIncrementalEncoderObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - codec = PyObject_GetAttrString((PyObject *)type, "codec"); - if (codec == NULL) - goto errorexit; - if (!MultibyteCodec_Check(codec)) { - PyErr_SetString(PyExc_TypeError, "codec is unexpected type"); - goto errorexit; - } - - self->codec = ((MultibyteCodecObject *)codec)->codec; - self->pendingsize = 0; - self->errors = internal_error_callback(errors); - if (self->errors == NULL) - goto errorexit; - if (self->codec->encinit != NULL && - self->codec->encinit(&self->state, self->codec->config) != 0) - goto errorexit; - - Py_DECREF(codec); - return (PyObject *)self; - -errorexit: - Py_XDECREF(self); - Py_XDECREF(codec); - return NULL; -} - -static int -mbiencoder_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - return 0; -} - -static int -mbiencoder_traverse(MultibyteIncrementalEncoderObject *self, - visitproc visit, void *arg) -{ - if (ERROR_ISCUSTOM(self->errors)) - Py_VISIT(self->errors); - return 0; -} - -static void -mbiencoder_dealloc(MultibyteIncrementalEncoderObject *self) -{ - PyObject_GC_UnTrack(self); - ERROR_DECREF(self->errors); - Py_TYPE(self)->tp_free(self); -} - -static PyTypeObject MultibyteIncrementalEncoder_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MultibyteIncrementalEncoder", /* tp_name */ - sizeof(MultibyteIncrementalEncoderObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)mbiencoder_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)mbiencoder_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iterext */ - mbiencoder_methods, /* tp_methods */ - 0, /* tp_members */ - codecctx_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - mbiencoder_init, /* tp_init */ - 0, /* tp_alloc */ - mbiencoder_new, /* tp_new */ -}; - - -/** - * MultibyteIncrementalDecoder object - */ - -static PyObject * -mbidecoder_decode(MultibyteIncrementalDecoderObject *self, - PyObject *args, PyObject *kwargs) -{ - MultibyteDecodeBuffer buf; - char *data, *wdata = NULL; - Py_buffer pdata; - Py_ssize_t wsize, finalsize = 0, size, origpending; - int final = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "s*|i:decode", - incrementalkwarglist, &pdata, &final)) - return NULL; - data = pdata.buf; - size = pdata.len; - - buf.outobj = buf.excobj = NULL; - origpending = self->pendingsize; - - if (self->pendingsize == 0) { - wsize = size; - wdata = data; - } - else { - if (size > PY_SSIZE_T_MAX - self->pendingsize) { - PyErr_NoMemory(); - goto errorexit; - } - wsize = size + self->pendingsize; - wdata = PyMem_Malloc(wsize); - if (wdata == NULL) - goto errorexit; - memcpy(wdata, self->pending, self->pendingsize); - memcpy(wdata + self->pendingsize, data, size); - self->pendingsize = 0; - } - - if (decoder_prepare_buffer(&buf, wdata, wsize) != 0) - goto errorexit; - - if (decoder_feed_buffer(STATEFUL_DCTX(self), &buf)) - goto errorexit; - - if (final && buf.inbuf < buf.inbuf_end) { - if (multibytecodec_decerror(self->codec, &self->state, - &buf, self->errors, MBERR_TOOFEW)) { - /* recover the original pending buffer */ - memcpy(self->pending, wdata, origpending); - self->pendingsize = origpending; - goto errorexit; - } - } - - if (buf.inbuf < buf.inbuf_end) { /* pending sequence still exists */ - if (decoder_append_pending(STATEFUL_DCTX(self), &buf) != 0) - goto errorexit; - } - - finalsize = (Py_ssize_t)(buf.outbuf - PyUnicode_AS_UNICODE(buf.outobj)); - if (finalsize != PyUnicode_GET_SIZE(buf.outobj)) - if (PyUnicode_Resize(&buf.outobj, finalsize) == -1) - goto errorexit; - - PyBuffer_Release(&pdata); - if (wdata != data) - PyMem_Del(wdata); - Py_XDECREF(buf.excobj); - return buf.outobj; - -errorexit: - PyBuffer_Release(&pdata); - if (wdata != NULL && wdata != data) - PyMem_Del(wdata); - Py_XDECREF(buf.excobj); - Py_XDECREF(buf.outobj); - return NULL; -} - -static PyObject * -mbidecoder_reset(MultibyteIncrementalDecoderObject *self) -{ - if (self->codec->decreset != NULL && - self->codec->decreset(&self->state, self->codec->config) != 0) - return NULL; - self->pendingsize = 0; - - Py_RETURN_NONE; -} - -static struct PyMethodDef mbidecoder_methods[] = { - {"decode", (PyCFunction)mbidecoder_decode, - METH_VARARGS | METH_KEYWORDS, NULL}, - {"reset", (PyCFunction)mbidecoder_reset, - METH_NOARGS, NULL}, - {NULL, NULL}, -}; - -static PyObject * -mbidecoder_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - MultibyteIncrementalDecoderObject *self; - PyObject *codec = NULL; - char *errors = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|s:IncrementalDecoder", - incnewkwarglist, &errors)) - return NULL; - - self = (MultibyteIncrementalDecoderObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - codec = PyObject_GetAttrString((PyObject *)type, "codec"); - if (codec == NULL) - goto errorexit; - if (!MultibyteCodec_Check(codec)) { - PyErr_SetString(PyExc_TypeError, "codec is unexpected type"); - goto errorexit; - } - - self->codec = ((MultibyteCodecObject *)codec)->codec; - self->pendingsize = 0; - self->errors = internal_error_callback(errors); - if (self->errors == NULL) - goto errorexit; - if (self->codec->decinit != NULL && - self->codec->decinit(&self->state, self->codec->config) != 0) - goto errorexit; - - Py_DECREF(codec); - return (PyObject *)self; - -errorexit: - Py_XDECREF(self); - Py_XDECREF(codec); - return NULL; -} - -static int -mbidecoder_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - return 0; -} - -static int -mbidecoder_traverse(MultibyteIncrementalDecoderObject *self, - visitproc visit, void *arg) -{ - if (ERROR_ISCUSTOM(self->errors)) - Py_VISIT(self->errors); - return 0; -} - -static void -mbidecoder_dealloc(MultibyteIncrementalDecoderObject *self) -{ - PyObject_GC_UnTrack(self); - ERROR_DECREF(self->errors); - Py_TYPE(self)->tp_free(self); -} - -static PyTypeObject MultibyteIncrementalDecoder_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MultibyteIncrementalDecoder", /* tp_name */ - sizeof(MultibyteIncrementalDecoderObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)mbidecoder_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)mbidecoder_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iterext */ - mbidecoder_methods, /* tp_methods */ - 0, /* tp_members */ - codecctx_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - mbidecoder_init, /* tp_init */ - 0, /* tp_alloc */ - mbidecoder_new, /* tp_new */ -}; - - -/** - * MultibyteStreamReader object - */ - -static PyObject * -mbstreamreader_iread(MultibyteStreamReaderObject *self, - const char *method, Py_ssize_t sizehint) -{ - MultibyteDecodeBuffer buf; - PyObject *cres; - Py_ssize_t rsize, finalsize = 0; - - if (sizehint == 0) - return PyUnicode_FromUnicode(NULL, 0); - - buf.outobj = buf.excobj = NULL; - cres = NULL; - - for (;;) { - int endoffile; - - if (sizehint < 0) - cres = PyObject_CallMethod(self->stream, - (char *)method, NULL); - else - cres = PyObject_CallMethod(self->stream, - (char *)method, "i", sizehint); - if (cres == NULL) - goto errorexit; - - if (!PyString_Check(cres)) { - PyErr_SetString(PyExc_TypeError, - "stream function returned a " - "non-string object"); - goto errorexit; - } - - endoffile = (PyString_GET_SIZE(cres) == 0); - - if (self->pendingsize > 0) { - PyObject *ctr; - char *ctrdata; - - if (PyString_GET_SIZE(cres) > PY_SSIZE_T_MAX - self->pendingsize) { - PyErr_NoMemory(); - goto errorexit; - } - rsize = PyString_GET_SIZE(cres) + self->pendingsize; - ctr = PyString_FromStringAndSize(NULL, rsize); - if (ctr == NULL) - goto errorexit; - ctrdata = PyString_AS_STRING(ctr); - memcpy(ctrdata, self->pending, self->pendingsize); - memcpy(ctrdata + self->pendingsize, - PyString_AS_STRING(cres), - PyString_GET_SIZE(cres)); - Py_DECREF(cres); - cres = ctr; - self->pendingsize = 0; - } - - rsize = PyString_GET_SIZE(cres); - if (decoder_prepare_buffer(&buf, PyString_AS_STRING(cres), - rsize) != 0) - goto errorexit; - - if (rsize > 0 && decoder_feed_buffer( - (MultibyteStatefulDecoderContext *)self, &buf)) - goto errorexit; - - if (endoffile || sizehint < 0) { - if (buf.inbuf < buf.inbuf_end && - multibytecodec_decerror(self->codec, &self->state, - &buf, self->errors, MBERR_TOOFEW)) - goto errorexit; - } - - if (buf.inbuf < buf.inbuf_end) { /* pending sequence exists */ - if (decoder_append_pending(STATEFUL_DCTX(self), - &buf) != 0) - goto errorexit; - } - - finalsize = (Py_ssize_t)(buf.outbuf - - PyUnicode_AS_UNICODE(buf.outobj)); - Py_DECREF(cres); - cres = NULL; - - if (sizehint < 0 || finalsize != 0 || rsize == 0) - break; - - sizehint = 1; /* read 1 more byte and retry */ - } - - if (finalsize != PyUnicode_GET_SIZE(buf.outobj)) - if (PyUnicode_Resize(&buf.outobj, finalsize) == -1) - goto errorexit; - - Py_XDECREF(cres); - Py_XDECREF(buf.excobj); - return buf.outobj; - -errorexit: - Py_XDECREF(cres); - Py_XDECREF(buf.excobj); - Py_XDECREF(buf.outobj); - return NULL; -} - -static PyObject * -mbstreamreader_read(MultibyteStreamReaderObject *self, PyObject *args) -{ - PyObject *sizeobj = NULL; - Py_ssize_t size; - - if (!PyArg_UnpackTuple(args, "read", 0, 1, &sizeobj)) - return NULL; - - if (sizeobj == Py_None || sizeobj == NULL) - size = -1; - else if (PyInt_Check(sizeobj)) - size = PyInt_AsSsize_t(sizeobj); - else { - PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); - return NULL; - } - - return mbstreamreader_iread(self, "read", size); -} - -static PyObject * -mbstreamreader_readline(MultibyteStreamReaderObject *self, PyObject *args) -{ - PyObject *sizeobj = NULL; - Py_ssize_t size; - - if (!PyArg_UnpackTuple(args, "readline", 0, 1, &sizeobj)) - return NULL; - - if (sizeobj == Py_None || sizeobj == NULL) - size = -1; - else if (PyInt_Check(sizeobj)) - size = PyInt_AsSsize_t(sizeobj); - else { - PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); - return NULL; - } - - return mbstreamreader_iread(self, "readline", size); -} - -static PyObject * -mbstreamreader_readlines(MultibyteStreamReaderObject *self, PyObject *args) -{ - PyObject *sizehintobj = NULL, *r, *sr; - Py_ssize_t sizehint; - - if (!PyArg_UnpackTuple(args, "readlines", 0, 1, &sizehintobj)) - return NULL; - - if (sizehintobj == Py_None || sizehintobj == NULL) - sizehint = -1; - else if (PyInt_Check(sizehintobj)) - sizehint = PyInt_AsSsize_t(sizehintobj); - else { - PyErr_SetString(PyExc_TypeError, "arg 1 must be an integer"); - return NULL; - } - - r = mbstreamreader_iread(self, "read", sizehint); - if (r == NULL) - return NULL; - - sr = PyUnicode_Splitlines(r, 1); - Py_DECREF(r); - return sr; -} - -static PyObject * -mbstreamreader_reset(MultibyteStreamReaderObject *self) -{ - if (self->codec->decreset != NULL && - self->codec->decreset(&self->state, self->codec->config) != 0) - return NULL; - self->pendingsize = 0; - - Py_RETURN_NONE; -} - -static struct PyMethodDef mbstreamreader_methods[] = { - {"read", (PyCFunction)mbstreamreader_read, - METH_VARARGS, NULL}, - {"readline", (PyCFunction)mbstreamreader_readline, - METH_VARARGS, NULL}, - {"readlines", (PyCFunction)mbstreamreader_readlines, - METH_VARARGS, NULL}, - {"reset", (PyCFunction)mbstreamreader_reset, - METH_NOARGS, NULL}, - {NULL, NULL}, -}; - -static PyMemberDef mbstreamreader_members[] = { - {"stream", T_OBJECT, - offsetof(MultibyteStreamReaderObject, stream), - READONLY, NULL}, - {NULL,} -}; - -static PyObject * -mbstreamreader_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - MultibyteStreamReaderObject *self; - PyObject *stream, *codec = NULL; - char *errors = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|s:StreamReader", - streamkwarglist, &stream, &errors)) - return NULL; - - self = (MultibyteStreamReaderObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - codec = PyObject_GetAttrString((PyObject *)type, "codec"); - if (codec == NULL) - goto errorexit; - if (!MultibyteCodec_Check(codec)) { - PyErr_SetString(PyExc_TypeError, "codec is unexpected type"); - goto errorexit; - } - - self->codec = ((MultibyteCodecObject *)codec)->codec; - self->stream = stream; - Py_INCREF(stream); - self->pendingsize = 0; - self->errors = internal_error_callback(errors); - if (self->errors == NULL) - goto errorexit; - if (self->codec->decinit != NULL && - self->codec->decinit(&self->state, self->codec->config) != 0) - goto errorexit; - - Py_DECREF(codec); - return (PyObject *)self; - -errorexit: - Py_XDECREF(self); - Py_XDECREF(codec); - return NULL; -} - -static int -mbstreamreader_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - return 0; -} - -static int -mbstreamreader_traverse(MultibyteStreamReaderObject *self, - visitproc visit, void *arg) -{ - if (ERROR_ISCUSTOM(self->errors)) - Py_VISIT(self->errors); - Py_VISIT(self->stream); - return 0; -} - -static void -mbstreamreader_dealloc(MultibyteStreamReaderObject *self) -{ - PyObject_GC_UnTrack(self); - ERROR_DECREF(self->errors); - Py_XDECREF(self->stream); - Py_TYPE(self)->tp_free(self); -} - -static PyTypeObject MultibyteStreamReader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MultibyteStreamReader", /* tp_name */ - sizeof(MultibyteStreamReaderObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)mbstreamreader_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)mbstreamreader_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iterext */ - mbstreamreader_methods, /* tp_methods */ - mbstreamreader_members, /* tp_members */ - codecctx_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - mbstreamreader_init, /* tp_init */ - 0, /* tp_alloc */ - mbstreamreader_new, /* tp_new */ -}; - - -/** - * MultibyteStreamWriter object - */ - -static int -mbstreamwriter_iwrite(MultibyteStreamWriterObject *self, - PyObject *unistr) -{ - PyObject *str, *wr; - - str = encoder_encode_stateful(STATEFUL_ECTX(self), unistr, 0); - if (str == NULL) - return -1; - - wr = PyObject_CallMethod(self->stream, "write", "O", str); - Py_DECREF(str); - if (wr == NULL) - return -1; - - Py_DECREF(wr); - return 0; -} - -static PyObject * -mbstreamwriter_write(MultibyteStreamWriterObject *self, PyObject *strobj) -{ - if (mbstreamwriter_iwrite(self, strobj)) - return NULL; - else - Py_RETURN_NONE; -} - -static PyObject * -mbstreamwriter_writelines(MultibyteStreamWriterObject *self, PyObject *lines) -{ - PyObject *strobj; - int i, r; - - if (!PySequence_Check(lines)) { - PyErr_SetString(PyExc_TypeError, - "arg must be a sequence object"); - return NULL; - } - - for (i = 0; i < PySequence_Length(lines); i++) { - /* length can be changed even within this loop */ - strobj = PySequence_GetItem(lines, i); - if (strobj == NULL) - return NULL; - - r = mbstreamwriter_iwrite(self, strobj); - Py_DECREF(strobj); - if (r == -1) - return NULL; - } - - Py_RETURN_NONE; -} - -static PyObject * -mbstreamwriter_reset(MultibyteStreamWriterObject *self) -{ - const Py_UNICODE *pending; - PyObject *pwrt; - - pending = self->pending; - pwrt = multibytecodec_encode(self->codec, &self->state, - &pending, self->pendingsize, self->errors, - MBENC_FLUSH | MBENC_RESET); - /* some pending buffer can be truncated when UnicodeEncodeError is - * raised on 'strict' mode. but, 'reset' method is designed to - * reset the pending buffer or states so failed string sequence - * ought to be missed */ - self->pendingsize = 0; - if (pwrt == NULL) - return NULL; - - if (PyString_Size(pwrt) > 0) { - PyObject *wr; - wr = PyObject_CallMethod(self->stream, "write", "O", pwrt); - if (wr == NULL) { - Py_DECREF(pwrt); - return NULL; - } - } - Py_DECREF(pwrt); - - Py_RETURN_NONE; -} - -static PyObject * -mbstreamwriter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - MultibyteStreamWriterObject *self; - PyObject *stream, *codec = NULL; - char *errors = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|s:StreamWriter", - streamkwarglist, &stream, &errors)) - return NULL; - - self = (MultibyteStreamWriterObject *)type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - codec = PyObject_GetAttrString((PyObject *)type, "codec"); - if (codec == NULL) - goto errorexit; - if (!MultibyteCodec_Check(codec)) { - PyErr_SetString(PyExc_TypeError, "codec is unexpected type"); - goto errorexit; - } - - self->codec = ((MultibyteCodecObject *)codec)->codec; - self->stream = stream; - Py_INCREF(stream); - self->pendingsize = 0; - self->errors = internal_error_callback(errors); - if (self->errors == NULL) - goto errorexit; - if (self->codec->encinit != NULL && - self->codec->encinit(&self->state, self->codec->config) != 0) - goto errorexit; - - Py_DECREF(codec); - return (PyObject *)self; - -errorexit: - Py_XDECREF(self); - Py_XDECREF(codec); - return NULL; -} - -static int -mbstreamwriter_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - return 0; -} - -static int -mbstreamwriter_traverse(MultibyteStreamWriterObject *self, - visitproc visit, void *arg) -{ - if (ERROR_ISCUSTOM(self->errors)) - Py_VISIT(self->errors); - Py_VISIT(self->stream); - return 0; -} - -static void -mbstreamwriter_dealloc(MultibyteStreamWriterObject *self) -{ - PyObject_GC_UnTrack(self); - ERROR_DECREF(self->errors); - Py_XDECREF(self->stream); - Py_TYPE(self)->tp_free(self); -} - -static struct PyMethodDef mbstreamwriter_methods[] = { - {"write", (PyCFunction)mbstreamwriter_write, - METH_O, NULL}, - {"writelines", (PyCFunction)mbstreamwriter_writelines, - METH_O, NULL}, - {"reset", (PyCFunction)mbstreamwriter_reset, - METH_NOARGS, NULL}, - {NULL, NULL}, -}; - -static PyMemberDef mbstreamwriter_members[] = { - {"stream", T_OBJECT, - offsetof(MultibyteStreamWriterObject, stream), - READONLY, NULL}, - {NULL,} -}; - -static PyTypeObject MultibyteStreamWriter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "MultibyteStreamWriter", /* tp_name */ - sizeof(MultibyteStreamWriterObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)mbstreamwriter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)mbstreamwriter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iterext */ - mbstreamwriter_methods, /* tp_methods */ - mbstreamwriter_members, /* tp_members */ - codecctx_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - mbstreamwriter_init, /* tp_init */ - 0, /* tp_alloc */ - mbstreamwriter_new, /* tp_new */ -}; - - -/** - * Exposed factory function - */ - -static PyObject * -__create_codec(PyObject *ignore, PyObject *arg) -{ - MultibyteCodecObject *self; - MultibyteCodec *codec; - - if (!PyCapsule_IsValid(arg, PyMultibyteCodec_CAPSULE_NAME)) { - PyErr_SetString(PyExc_ValueError, "argument type invalid"); - return NULL; - } - - codec = PyCapsule_GetPointer(arg, PyMultibyteCodec_CAPSULE_NAME); - if (codec->codecinit != NULL && codec->codecinit(codec->config) != 0) - return NULL; - - self = PyObject_New(MultibyteCodecObject, &MultibyteCodec_Type); - if (self == NULL) - return NULL; - self->codec = codec; - - return (PyObject *)self; -} - -static struct PyMethodDef __methods[] = { - {"__create_codec", (PyCFunction)__create_codec, METH_O}, - {NULL, NULL}, -}; - -PyMODINIT_FUNC -init_multibytecodec(void) -{ - int i; - PyObject *m; - PyTypeObject *typelist[] = { - &MultibyteIncrementalEncoder_Type, - &MultibyteIncrementalDecoder_Type, - &MultibyteStreamReader_Type, - &MultibyteStreamWriter_Type, - NULL - }; - - if (PyType_Ready(&MultibyteCodec_Type) < 0) - return; - - m = Py_InitModule("_multibytecodec", __methods); - if (m == NULL) - return; - - for (i = 0; typelist[i] != NULL; i++) { - if (PyType_Ready(typelist[i]) < 0) - return; - Py_INCREF(typelist[i]); - PyModule_AddObject(m, typelist[i]->tp_name, - (PyObject *)typelist[i]); - } - - if (PyErr_Occurred()) - Py_FatalError("can't initialize the _multibytecodec module"); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.h deleted file mode 100644 index 2efa037..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cjkcodecs/multibytecodec.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * multibytecodec.h: Common Multibyte Codec Implementation - * - * Written by Hye-Shik Chang - */ - -#ifndef _PYTHON_MULTIBYTECODEC_H_ -#define _PYTHON_MULTIBYTECODEC_H_ -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef uint32_t -typedef uint32_t ucs4_t; -#else -typedef unsigned int ucs4_t; -#endif - -#ifdef uint16_t -typedef uint16_t ucs2_t, DBCHAR; -#else -typedef unsigned short ucs2_t, DBCHAR; -#endif - -typedef union { - void *p; - int i; - unsigned char c[8]; - ucs2_t u2[4]; - ucs4_t u4[2]; -} MultibyteCodec_State; - -typedef int (*mbcodec_init)(const void *config); -typedef Py_ssize_t (*mbencode_func)(MultibyteCodec_State *state, - const void *config, - const Py_UNICODE **inbuf, Py_ssize_t inleft, - unsigned char **outbuf, Py_ssize_t outleft, - int flags); -typedef int (*mbencodeinit_func)(MultibyteCodec_State *state, - const void *config); -typedef Py_ssize_t (*mbencodereset_func)(MultibyteCodec_State *state, - const void *config, - unsigned char **outbuf, Py_ssize_t outleft); -typedef Py_ssize_t (*mbdecode_func)(MultibyteCodec_State *state, - const void *config, - const unsigned char **inbuf, Py_ssize_t inleft, - Py_UNICODE **outbuf, Py_ssize_t outleft); -typedef int (*mbdecodeinit_func)(MultibyteCodec_State *state, - const void *config); -typedef Py_ssize_t (*mbdecodereset_func)(MultibyteCodec_State *state, - const void *config); - -typedef struct { - const char *encoding; - const void *config; - mbcodec_init codecinit; - mbencode_func encode; - mbencodeinit_func encinit; - mbencodereset_func encreset; - mbdecode_func decode; - mbdecodeinit_func decinit; - mbdecodereset_func decreset; -} MultibyteCodec; - -typedef struct { - PyObject_HEAD - MultibyteCodec *codec; -} MultibyteCodecObject; - -#define MultibyteCodec_Check(op) ((op)->ob_type == &MultibyteCodec_Type) - -#define _MultibyteStatefulCodec_HEAD \ - PyObject_HEAD \ - MultibyteCodec *codec; \ - MultibyteCodec_State state; \ - PyObject *errors; -typedef struct { - _MultibyteStatefulCodec_HEAD -} MultibyteStatefulCodecContext; - -#define MAXENCPENDING 2 -#define _MultibyteStatefulEncoder_HEAD \ - _MultibyteStatefulCodec_HEAD \ - Py_UNICODE pending[MAXENCPENDING]; \ - Py_ssize_t pendingsize; -typedef struct { - _MultibyteStatefulEncoder_HEAD -} MultibyteStatefulEncoderContext; - -#define MAXDECPENDING 8 -#define _MultibyteStatefulDecoder_HEAD \ - _MultibyteStatefulCodec_HEAD \ - unsigned char pending[MAXDECPENDING]; \ - Py_ssize_t pendingsize; -typedef struct { - _MultibyteStatefulDecoder_HEAD -} MultibyteStatefulDecoderContext; - -typedef struct { - _MultibyteStatefulEncoder_HEAD -} MultibyteIncrementalEncoderObject; - -typedef struct { - _MultibyteStatefulDecoder_HEAD -} MultibyteIncrementalDecoderObject; - -typedef struct { - _MultibyteStatefulDecoder_HEAD - PyObject *stream; -} MultibyteStreamReaderObject; - -typedef struct { - _MultibyteStatefulEncoder_HEAD - PyObject *stream; -} MultibyteStreamWriterObject; - -/* positive values for illegal sequences */ -#define MBERR_TOOSMALL (-1) /* insufficient output buffer space */ -#define MBERR_TOOFEW (-2) /* incomplete input buffer */ -#define MBERR_INTERNAL (-3) /* internal runtime error */ - -#define ERROR_STRICT (PyObject *)(1) -#define ERROR_IGNORE (PyObject *)(2) -#define ERROR_REPLACE (PyObject *)(3) -#define ERROR_ISCUSTOM(p) ((p) < ERROR_STRICT || ERROR_REPLACE < (p)) -#define ERROR_DECREF(p) do { \ - if (p != NULL && ERROR_ISCUSTOM(p)) { \ - Py_DECREF(p); \ - } \ -} while (0); - -#define MBENC_FLUSH 0x0001 /* encode all characters encodable */ -#define MBENC_MAX MBENC_FLUSH - -#define PyMultibyteCodec_CAPSULE_NAME "multibytecodec.__map_*" - - -#ifdef __cplusplus -} -#endif -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/cmathmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/cmathmodule.c deleted file mode 100644 index 1c51ee5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/cmathmodule.c +++ /dev/null @@ -1,1217 +0,0 @@ -/* Complex math module */ - -/* much code borrowed from mathmodule.c */ - -#include "Python.h" -#include "_math.h" -/* we need DBL_MAX, DBL_MIN, DBL_EPSILON, DBL_MANT_DIG and FLT_RADIX from - float.h. We assume that FLT_RADIX is either 2 or 16. */ -#include - -#if (FLT_RADIX != 2 && FLT_RADIX != 16) -#error "Modules/cmathmodule.c expects FLT_RADIX to be 2 or 16" -#endif - -#ifndef M_LN2 -#define M_LN2 (0.6931471805599453094) /* natural log of 2 */ -#endif - -#ifndef M_LN10 -#define M_LN10 (2.302585092994045684) /* natural log of 10 */ -#endif - -/* - CM_LARGE_DOUBLE is used to avoid spurious overflow in the sqrt, log, - inverse trig and inverse hyperbolic trig functions. Its log is used in the - evaluation of exp, cos, cosh, sin, sinh, tan, and tanh to avoid unnecessary - overflow. - */ - -#define CM_LARGE_DOUBLE (DBL_MAX/4.) -#define CM_SQRT_LARGE_DOUBLE (sqrt(CM_LARGE_DOUBLE)) -#define CM_LOG_LARGE_DOUBLE (log(CM_LARGE_DOUBLE)) -#define CM_SQRT_DBL_MIN (sqrt(DBL_MIN)) - -/* - CM_SCALE_UP is an odd integer chosen such that multiplication by - 2**CM_SCALE_UP is sufficient to turn a subnormal into a normal. - CM_SCALE_DOWN is (-(CM_SCALE_UP+1)/2). These scalings are used to compute - square roots accurately when the real and imaginary parts of the argument - are subnormal. -*/ - -#if FLT_RADIX==2 -#define CM_SCALE_UP (2*(DBL_MANT_DIG/2) + 1) -#elif FLT_RADIX==16 -#define CM_SCALE_UP (4*DBL_MANT_DIG+1) -#endif -#define CM_SCALE_DOWN (-(CM_SCALE_UP+1)/2) - -/* forward declarations */ -static Py_complex c_asinh(Py_complex); -static Py_complex c_atanh(Py_complex); -static Py_complex c_cosh(Py_complex); -static Py_complex c_sinh(Py_complex); -static Py_complex c_sqrt(Py_complex); -static Py_complex c_tanh(Py_complex); -static PyObject * math_error(void); - -/* Code to deal with special values (infinities, NaNs, etc.). */ - -/* special_type takes a double and returns an integer code indicating - the type of the double as follows: -*/ - -enum special_types { - ST_NINF, /* 0, negative infinity */ - ST_NEG, /* 1, negative finite number (nonzero) */ - ST_NZERO, /* 2, -0. */ - ST_PZERO, /* 3, +0. */ - ST_POS, /* 4, positive finite number (nonzero) */ - ST_PINF, /* 5, positive infinity */ - ST_NAN /* 6, Not a Number */ -}; - -static enum special_types -special_type(double d) -{ - if (Py_IS_FINITE(d)) { - if (d != 0) { - if (copysign(1., d) == 1.) - return ST_POS; - else - return ST_NEG; - } - else { - if (copysign(1., d) == 1.) - return ST_PZERO; - else - return ST_NZERO; - } - } - if (Py_IS_NAN(d)) - return ST_NAN; - if (copysign(1., d) == 1.) - return ST_PINF; - else - return ST_NINF; -} - -#define SPECIAL_VALUE(z, table) \ - if (!Py_IS_FINITE((z).real) || !Py_IS_FINITE((z).imag)) { \ - errno = 0; \ - return table[special_type((z).real)] \ - [special_type((z).imag)]; \ - } - -#define P Py_MATH_PI -#define P14 0.25*Py_MATH_PI -#define P12 0.5*Py_MATH_PI -#define P34 0.75*Py_MATH_PI -#define INF Py_HUGE_VAL -#define N Py_NAN -#define U -9.5426319407711027e33 /* unlikely value, used as placeholder */ - -/* First, the C functions that do the real work. Each of the c_* - functions computes and returns the C99 Annex G recommended result - and also sets errno as follows: errno = 0 if no floating-point - exception is associated with the result; errno = EDOM if C99 Annex - G recommends raising divide-by-zero or invalid for this result; and - errno = ERANGE where the overflow floating-point signal should be - raised. -*/ - -static Py_complex acos_special_values[7][7]; - -static Py_complex -c_acos(Py_complex z) -{ - Py_complex s1, s2, r; - - SPECIAL_VALUE(z, acos_special_values); - - if (fabs(z.real) > CM_LARGE_DOUBLE || fabs(z.imag) > CM_LARGE_DOUBLE) { - /* avoid unnecessary overflow for large arguments */ - r.real = atan2(fabs(z.imag), z.real); - /* split into cases to make sure that the branch cut has the - correct continuity on systems with unsigned zeros */ - if (z.real < 0.) { - r.imag = -copysign(log(hypot(z.real/2., z.imag/2.)) + - M_LN2*2., z.imag); - } else { - r.imag = copysign(log(hypot(z.real/2., z.imag/2.)) + - M_LN2*2., -z.imag); - } - } else { - s1.real = 1.-z.real; - s1.imag = -z.imag; - s1 = c_sqrt(s1); - s2.real = 1.+z.real; - s2.imag = z.imag; - s2 = c_sqrt(s2); - r.real = 2.*atan2(s1.real, s2.real); - r.imag = m_asinh(s2.real*s1.imag - s2.imag*s1.real); - } - errno = 0; - return r; -} - -PyDoc_STRVAR(c_acos_doc, -"acos(x)\n" -"\n" -"Return the arc cosine of x."); - - -static Py_complex acosh_special_values[7][7]; - -static Py_complex -c_acosh(Py_complex z) -{ - Py_complex s1, s2, r; - - SPECIAL_VALUE(z, acosh_special_values); - - if (fabs(z.real) > CM_LARGE_DOUBLE || fabs(z.imag) > CM_LARGE_DOUBLE) { - /* avoid unnecessary overflow for large arguments */ - r.real = log(hypot(z.real/2., z.imag/2.)) + M_LN2*2.; - r.imag = atan2(z.imag, z.real); - } else { - s1.real = z.real - 1.; - s1.imag = z.imag; - s1 = c_sqrt(s1); - s2.real = z.real + 1.; - s2.imag = z.imag; - s2 = c_sqrt(s2); - r.real = m_asinh(s1.real*s2.real + s1.imag*s2.imag); - r.imag = 2.*atan2(s1.imag, s2.real); - } - errno = 0; - return r; -} - -PyDoc_STRVAR(c_acosh_doc, -"acosh(x)\n" -"\n" -"Return the inverse hyperbolic cosine of x."); - - -static Py_complex -c_asin(Py_complex z) -{ - /* asin(z) = -i asinh(iz) */ - Py_complex s, r; - s.real = -z.imag; - s.imag = z.real; - s = c_asinh(s); - r.real = s.imag; - r.imag = -s.real; - return r; -} - -PyDoc_STRVAR(c_asin_doc, -"asin(x)\n" -"\n" -"Return the arc sine of x."); - - -static Py_complex asinh_special_values[7][7]; - -static Py_complex -c_asinh(Py_complex z) -{ - Py_complex s1, s2, r; - - SPECIAL_VALUE(z, asinh_special_values); - - if (fabs(z.real) > CM_LARGE_DOUBLE || fabs(z.imag) > CM_LARGE_DOUBLE) { - if (z.imag >= 0.) { - r.real = copysign(log(hypot(z.real/2., z.imag/2.)) + - M_LN2*2., z.real); - } else { - r.real = -copysign(log(hypot(z.real/2., z.imag/2.)) + - M_LN2*2., -z.real); - } - r.imag = atan2(z.imag, fabs(z.real)); - } else { - s1.real = 1.+z.imag; - s1.imag = -z.real; - s1 = c_sqrt(s1); - s2.real = 1.-z.imag; - s2.imag = z.real; - s2 = c_sqrt(s2); - r.real = m_asinh(s1.real*s2.imag-s2.real*s1.imag); - r.imag = atan2(z.imag, s1.real*s2.real-s1.imag*s2.imag); - } - errno = 0; - return r; -} - -PyDoc_STRVAR(c_asinh_doc, -"asinh(x)\n" -"\n" -"Return the inverse hyperbolic sine of x."); - - -static Py_complex -c_atan(Py_complex z) -{ - /* atan(z) = -i atanh(iz) */ - Py_complex s, r; - s.real = -z.imag; - s.imag = z.real; - s = c_atanh(s); - r.real = s.imag; - r.imag = -s.real; - return r; -} - -/* Windows screws up atan2 for inf and nan, and alpha Tru64 5.1 doesn't follow - C99 for atan2(0., 0.). */ -static double -c_atan2(Py_complex z) -{ - if (Py_IS_NAN(z.real) || Py_IS_NAN(z.imag)) - return Py_NAN; - if (Py_IS_INFINITY(z.imag)) { - if (Py_IS_INFINITY(z.real)) { - if (copysign(1., z.real) == 1.) - /* atan2(+-inf, +inf) == +-pi/4 */ - return copysign(0.25*Py_MATH_PI, z.imag); - else - /* atan2(+-inf, -inf) == +-pi*3/4 */ - return copysign(0.75*Py_MATH_PI, z.imag); - } - /* atan2(+-inf, x) == +-pi/2 for finite x */ - return copysign(0.5*Py_MATH_PI, z.imag); - } - if (Py_IS_INFINITY(z.real) || z.imag == 0.) { - if (copysign(1., z.real) == 1.) - /* atan2(+-y, +inf) = atan2(+-0, +x) = +-0. */ - return copysign(0., z.imag); - else - /* atan2(+-y, -inf) = atan2(+-0., -x) = +-pi. */ - return copysign(Py_MATH_PI, z.imag); - } - return atan2(z.imag, z.real); -} - -PyDoc_STRVAR(c_atan_doc, -"atan(x)\n" -"\n" -"Return the arc tangent of x."); - - -static Py_complex atanh_special_values[7][7]; - -static Py_complex -c_atanh(Py_complex z) -{ - Py_complex r; - double ay, h; - - SPECIAL_VALUE(z, atanh_special_values); - - /* Reduce to case where z.real >= 0., using atanh(z) = -atanh(-z). */ - if (z.real < 0.) { - return c_neg(c_atanh(c_neg(z))); - } - - ay = fabs(z.imag); - if (z.real > CM_SQRT_LARGE_DOUBLE || ay > CM_SQRT_LARGE_DOUBLE) { - /* - if abs(z) is large then we use the approximation - atanh(z) ~ 1/z +/- i*pi/2 (+/- depending on the sign - of z.imag) - */ - h = hypot(z.real/2., z.imag/2.); /* safe from overflow */ - r.real = z.real/4./h/h; - /* the two negations in the next line cancel each other out - except when working with unsigned zeros: they're there to - ensure that the branch cut has the correct continuity on - systems that don't support signed zeros */ - r.imag = -copysign(Py_MATH_PI/2., -z.imag); - errno = 0; - } else if (z.real == 1. && ay < CM_SQRT_DBL_MIN) { - /* C99 standard says: atanh(1+/-0.) should be inf +/- 0i */ - if (ay == 0.) { - r.real = INF; - r.imag = z.imag; - errno = EDOM; - } else { - r.real = -log(sqrt(ay)/sqrt(hypot(ay, 2.))); - r.imag = copysign(atan2(2., -ay)/2, z.imag); - errno = 0; - } - } else { - r.real = m_log1p(4.*z.real/((1-z.real)*(1-z.real) + ay*ay))/4.; - r.imag = -atan2(-2.*z.imag, (1-z.real)*(1+z.real) - ay*ay)/2.; - errno = 0; - } - return r; -} - -PyDoc_STRVAR(c_atanh_doc, -"atanh(x)\n" -"\n" -"Return the inverse hyperbolic tangent of x."); - - -static Py_complex -c_cos(Py_complex z) -{ - /* cos(z) = cosh(iz) */ - Py_complex r; - r.real = -z.imag; - r.imag = z.real; - r = c_cosh(r); - return r; -} - -PyDoc_STRVAR(c_cos_doc, -"cos(x)\n" -"\n" -"Return the cosine of x."); - - -/* cosh(infinity + i*y) needs to be dealt with specially */ -static Py_complex cosh_special_values[7][7]; - -static Py_complex -c_cosh(Py_complex z) -{ - Py_complex r; - double x_minus_one; - - /* special treatment for cosh(+/-inf + iy) if y is not a NaN */ - if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) { - if (Py_IS_INFINITY(z.real) && Py_IS_FINITE(z.imag) && - (z.imag != 0.)) { - if (z.real > 0) { - r.real = copysign(INF, cos(z.imag)); - r.imag = copysign(INF, sin(z.imag)); - } - else { - r.real = copysign(INF, cos(z.imag)); - r.imag = -copysign(INF, sin(z.imag)); - } - } - else { - r = cosh_special_values[special_type(z.real)] - [special_type(z.imag)]; - } - /* need to set errno = EDOM if y is +/- infinity and x is not - a NaN */ - if (Py_IS_INFINITY(z.imag) && !Py_IS_NAN(z.real)) - errno = EDOM; - else - errno = 0; - return r; - } - - if (fabs(z.real) > CM_LOG_LARGE_DOUBLE) { - /* deal correctly with cases where cosh(z.real) overflows but - cosh(z) does not. */ - x_minus_one = z.real - copysign(1., z.real); - r.real = cos(z.imag) * cosh(x_minus_one) * Py_MATH_E; - r.imag = sin(z.imag) * sinh(x_minus_one) * Py_MATH_E; - } else { - r.real = cos(z.imag) * cosh(z.real); - r.imag = sin(z.imag) * sinh(z.real); - } - /* detect overflow, and set errno accordingly */ - if (Py_IS_INFINITY(r.real) || Py_IS_INFINITY(r.imag)) - errno = ERANGE; - else - errno = 0; - return r; -} - -PyDoc_STRVAR(c_cosh_doc, -"cosh(x)\n" -"\n" -"Return the hyperbolic cosine of x."); - - -/* exp(infinity + i*y) and exp(-infinity + i*y) need special treatment for - finite y */ -static Py_complex exp_special_values[7][7]; - -static Py_complex -c_exp(Py_complex z) -{ - Py_complex r; - double l; - - if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) { - if (Py_IS_INFINITY(z.real) && Py_IS_FINITE(z.imag) - && (z.imag != 0.)) { - if (z.real > 0) { - r.real = copysign(INF, cos(z.imag)); - r.imag = copysign(INF, sin(z.imag)); - } - else { - r.real = copysign(0., cos(z.imag)); - r.imag = copysign(0., sin(z.imag)); - } - } - else { - r = exp_special_values[special_type(z.real)] - [special_type(z.imag)]; - } - /* need to set errno = EDOM if y is +/- infinity and x is not - a NaN and not -infinity */ - if (Py_IS_INFINITY(z.imag) && - (Py_IS_FINITE(z.real) || - (Py_IS_INFINITY(z.real) && z.real > 0))) - errno = EDOM; - else - errno = 0; - return r; - } - - if (z.real > CM_LOG_LARGE_DOUBLE) { - l = exp(z.real-1.); - r.real = l*cos(z.imag)*Py_MATH_E; - r.imag = l*sin(z.imag)*Py_MATH_E; - } else { - l = exp(z.real); - r.real = l*cos(z.imag); - r.imag = l*sin(z.imag); - } - /* detect overflow, and set errno accordingly */ - if (Py_IS_INFINITY(r.real) || Py_IS_INFINITY(r.imag)) - errno = ERANGE; - else - errno = 0; - return r; -} - -PyDoc_STRVAR(c_exp_doc, -"exp(x)\n" -"\n" -"Return the exponential value e**x."); - - -static Py_complex log_special_values[7][7]; - -static Py_complex -c_log(Py_complex z) -{ - /* - The usual formula for the real part is log(hypot(z.real, z.imag)). - There are four situations where this formula is potentially - problematic: - - (1) the absolute value of z is subnormal. Then hypot is subnormal, - so has fewer than the usual number of bits of accuracy, hence may - have large relative error. This then gives a large absolute error - in the log. This can be solved by rescaling z by a suitable power - of 2. - - (2) the absolute value of z is greater than DBL_MAX (e.g. when both - z.real and z.imag are within a factor of 1/sqrt(2) of DBL_MAX) - Again, rescaling solves this. - - (3) the absolute value of z is close to 1. In this case it's - difficult to achieve good accuracy, at least in part because a - change of 1ulp in the real or imaginary part of z can result in a - change of billions of ulps in the correctly rounded answer. - - (4) z = 0. The simplest thing to do here is to call the - floating-point log with an argument of 0, and let its behaviour - (returning -infinity, signaling a floating-point exception, setting - errno, or whatever) determine that of c_log. So the usual formula - is fine here. - - */ - - Py_complex r; - double ax, ay, am, an, h; - - SPECIAL_VALUE(z, log_special_values); - - ax = fabs(z.real); - ay = fabs(z.imag); - - if (ax > CM_LARGE_DOUBLE || ay > CM_LARGE_DOUBLE) { - r.real = log(hypot(ax/2., ay/2.)) + M_LN2; - } else if (ax < DBL_MIN && ay < DBL_MIN) { - if (ax > 0. || ay > 0.) { - /* catch cases where hypot(ax, ay) is subnormal */ - r.real = log(hypot(ldexp(ax, DBL_MANT_DIG), - ldexp(ay, DBL_MANT_DIG))) - DBL_MANT_DIG*M_LN2; - } - else { - /* log(+/-0. +/- 0i) */ - r.real = -INF; - r.imag = atan2(z.imag, z.real); - errno = EDOM; - return r; - } - } else { - h = hypot(ax, ay); - if (0.71 <= h && h <= 1.73) { - am = ax > ay ? ax : ay; /* max(ax, ay) */ - an = ax > ay ? ay : ax; /* min(ax, ay) */ - r.real = m_log1p((am-1)*(am+1)+an*an)/2.; - } else { - r.real = log(h); - } - } - r.imag = atan2(z.imag, z.real); - errno = 0; - return r; -} - - -static Py_complex -c_log10(Py_complex z) -{ - Py_complex r; - int errno_save; - - r = c_log(z); - errno_save = errno; /* just in case the divisions affect errno */ - r.real = r.real / M_LN10; - r.imag = r.imag / M_LN10; - errno = errno_save; - return r; -} - -PyDoc_STRVAR(c_log10_doc, -"log10(x)\n" -"\n" -"Return the base-10 logarithm of x."); - - -static Py_complex -c_sin(Py_complex z) -{ - /* sin(z) = -i sin(iz) */ - Py_complex s, r; - s.real = -z.imag; - s.imag = z.real; - s = c_sinh(s); - r.real = s.imag; - r.imag = -s.real; - return r; -} - -PyDoc_STRVAR(c_sin_doc, -"sin(x)\n" -"\n" -"Return the sine of x."); - - -/* sinh(infinity + i*y) needs to be dealt with specially */ -static Py_complex sinh_special_values[7][7]; - -static Py_complex -c_sinh(Py_complex z) -{ - Py_complex r; - double x_minus_one; - - /* special treatment for sinh(+/-inf + iy) if y is finite and - nonzero */ - if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) { - if (Py_IS_INFINITY(z.real) && Py_IS_FINITE(z.imag) - && (z.imag != 0.)) { - if (z.real > 0) { - r.real = copysign(INF, cos(z.imag)); - r.imag = copysign(INF, sin(z.imag)); - } - else { - r.real = -copysign(INF, cos(z.imag)); - r.imag = copysign(INF, sin(z.imag)); - } - } - else { - r = sinh_special_values[special_type(z.real)] - [special_type(z.imag)]; - } - /* need to set errno = EDOM if y is +/- infinity and x is not - a NaN */ - if (Py_IS_INFINITY(z.imag) && !Py_IS_NAN(z.real)) - errno = EDOM; - else - errno = 0; - return r; - } - - if (fabs(z.real) > CM_LOG_LARGE_DOUBLE) { - x_minus_one = z.real - copysign(1., z.real); - r.real = cos(z.imag) * sinh(x_minus_one) * Py_MATH_E; - r.imag = sin(z.imag) * cosh(x_minus_one) * Py_MATH_E; - } else { - r.real = cos(z.imag) * sinh(z.real); - r.imag = sin(z.imag) * cosh(z.real); - } - /* detect overflow, and set errno accordingly */ - if (Py_IS_INFINITY(r.real) || Py_IS_INFINITY(r.imag)) - errno = ERANGE; - else - errno = 0; - return r; -} - -PyDoc_STRVAR(c_sinh_doc, -"sinh(x)\n" -"\n" -"Return the hyperbolic sine of x."); - - -static Py_complex sqrt_special_values[7][7]; - -static Py_complex -c_sqrt(Py_complex z) -{ - /* - Method: use symmetries to reduce to the case when x = z.real and y - = z.imag are nonnegative. Then the real part of the result is - given by - - s = sqrt((x + hypot(x, y))/2) - - and the imaginary part is - - d = (y/2)/s - - If either x or y is very large then there's a risk of overflow in - computation of the expression x + hypot(x, y). We can avoid this - by rewriting the formula for s as: - - s = 2*sqrt(x/8 + hypot(x/8, y/8)) - - This costs us two extra multiplications/divisions, but avoids the - overhead of checking for x and y large. - - If both x and y are subnormal then hypot(x, y) may also be - subnormal, so will lack full precision. We solve this by rescaling - x and y by a sufficiently large power of 2 to ensure that x and y - are normal. - */ - - - Py_complex r; - double s,d; - double ax, ay; - - SPECIAL_VALUE(z, sqrt_special_values); - - if (z.real == 0. && z.imag == 0.) { - r.real = 0.; - r.imag = z.imag; - return r; - } - - ax = fabs(z.real); - ay = fabs(z.imag); - - if (ax < DBL_MIN && ay < DBL_MIN && (ax > 0. || ay > 0.)) { - /* here we catch cases where hypot(ax, ay) is subnormal */ - ax = ldexp(ax, CM_SCALE_UP); - s = ldexp(sqrt(ax + hypot(ax, ldexp(ay, CM_SCALE_UP))), - CM_SCALE_DOWN); - } else { - ax /= 8.; - s = 2.*sqrt(ax + hypot(ax, ay/8.)); - } - d = ay/(2.*s); - - if (z.real >= 0.) { - r.real = s; - r.imag = copysign(d, z.imag); - } else { - r.real = d; - r.imag = copysign(s, z.imag); - } - errno = 0; - return r; -} - -PyDoc_STRVAR(c_sqrt_doc, -"sqrt(x)\n" -"\n" -"Return the square root of x."); - - -static Py_complex -c_tan(Py_complex z) -{ - /* tan(z) = -i tanh(iz) */ - Py_complex s, r; - s.real = -z.imag; - s.imag = z.real; - s = c_tanh(s); - r.real = s.imag; - r.imag = -s.real; - return r; -} - -PyDoc_STRVAR(c_tan_doc, -"tan(x)\n" -"\n" -"Return the tangent of x."); - - -/* tanh(infinity + i*y) needs to be dealt with specially */ -static Py_complex tanh_special_values[7][7]; - -static Py_complex -c_tanh(Py_complex z) -{ - /* Formula: - - tanh(x+iy) = (tanh(x)(1+tan(y)^2) + i tan(y)(1-tanh(x))^2) / - (1+tan(y)^2 tanh(x)^2) - - To avoid excessive roundoff error, 1-tanh(x)^2 is better computed - as 1/cosh(x)^2. When abs(x) is large, we approximate 1-tanh(x)^2 - by 4 exp(-2*x) instead, to avoid possible overflow in the - computation of cosh(x). - - */ - - Py_complex r; - double tx, ty, cx, txty, denom; - - /* special treatment for tanh(+/-inf + iy) if y is finite and - nonzero */ - if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) { - if (Py_IS_INFINITY(z.real) && Py_IS_FINITE(z.imag) - && (z.imag != 0.)) { - if (z.real > 0) { - r.real = 1.0; - r.imag = copysign(0., - 2.*sin(z.imag)*cos(z.imag)); - } - else { - r.real = -1.0; - r.imag = copysign(0., - 2.*sin(z.imag)*cos(z.imag)); - } - } - else { - r = tanh_special_values[special_type(z.real)] - [special_type(z.imag)]; - } - /* need to set errno = EDOM if z.imag is +/-infinity and - z.real is finite */ - if (Py_IS_INFINITY(z.imag) && Py_IS_FINITE(z.real)) - errno = EDOM; - else - errno = 0; - return r; - } - - /* danger of overflow in 2.*z.imag !*/ - if (fabs(z.real) > CM_LOG_LARGE_DOUBLE) { - r.real = copysign(1., z.real); - r.imag = 4.*sin(z.imag)*cos(z.imag)*exp(-2.*fabs(z.real)); - } else { - tx = tanh(z.real); - ty = tan(z.imag); - cx = 1./cosh(z.real); - txty = tx*ty; - denom = 1. + txty*txty; - r.real = tx*(1.+ty*ty)/denom; - r.imag = ((ty/denom)*cx)*cx; - } - errno = 0; - return r; -} - -PyDoc_STRVAR(c_tanh_doc, -"tanh(x)\n" -"\n" -"Return the hyperbolic tangent of x."); - - -static PyObject * -cmath_log(PyObject *self, PyObject *args) -{ - Py_complex x; - Py_complex y; - - if (!PyArg_ParseTuple(args, "D|D", &x, &y)) - return NULL; - - errno = 0; - PyFPE_START_PROTECT("complex function", return 0) - x = c_log(x); - if (PyTuple_GET_SIZE(args) == 2) { - y = c_log(y); - x = c_quot(x, y); - } - PyFPE_END_PROTECT(x) - if (errno != 0) - return math_error(); - return PyComplex_FromCComplex(x); -} - -PyDoc_STRVAR(cmath_log_doc, -"log(x[, base]) -> the logarithm of x to the given base.\n\ -If the base not specified, returns the natural logarithm (base e) of x."); - - -/* And now the glue to make them available from Python: */ - -static PyObject * -math_error(void) -{ - if (errno == EDOM) - PyErr_SetString(PyExc_ValueError, "math domain error"); - else if (errno == ERANGE) - PyErr_SetString(PyExc_OverflowError, "math range error"); - else /* Unexpected math error */ - PyErr_SetFromErrno(PyExc_ValueError); - return NULL; -} - -static PyObject * -math_1(PyObject *args, Py_complex (*func)(Py_complex)) -{ - Py_complex x,r ; - if (!PyArg_ParseTuple(args, "D", &x)) - return NULL; - errno = 0; - PyFPE_START_PROTECT("complex function", return 0); - r = (*func)(x); - PyFPE_END_PROTECT(r); - if (errno == EDOM) { - PyErr_SetString(PyExc_ValueError, "math domain error"); - return NULL; - } - else if (errno == ERANGE) { - PyErr_SetString(PyExc_OverflowError, "math range error"); - return NULL; - } - else { - return PyComplex_FromCComplex(r); - } -} - -#define FUNC1(stubname, func) \ - static PyObject * stubname(PyObject *self, PyObject *args) { \ - return math_1(args, func); \ - } - -FUNC1(cmath_acos, c_acos) -FUNC1(cmath_acosh, c_acosh) -FUNC1(cmath_asin, c_asin) -FUNC1(cmath_asinh, c_asinh) -FUNC1(cmath_atan, c_atan) -FUNC1(cmath_atanh, c_atanh) -FUNC1(cmath_cos, c_cos) -FUNC1(cmath_cosh, c_cosh) -FUNC1(cmath_exp, c_exp) -FUNC1(cmath_log10, c_log10) -FUNC1(cmath_sin, c_sin) -FUNC1(cmath_sinh, c_sinh) -FUNC1(cmath_sqrt, c_sqrt) -FUNC1(cmath_tan, c_tan) -FUNC1(cmath_tanh, c_tanh) - -static PyObject * -cmath_phase(PyObject *self, PyObject *args) -{ - Py_complex z; - double phi; - if (!PyArg_ParseTuple(args, "D:phase", &z)) - return NULL; - errno = 0; - PyFPE_START_PROTECT("arg function", return 0) - phi = c_atan2(z); - PyFPE_END_PROTECT(phi) - if (errno != 0) - return math_error(); - else - return PyFloat_FromDouble(phi); -} - -PyDoc_STRVAR(cmath_phase_doc, -"phase(z) -> float\n\n\ -Return argument, also known as the phase angle, of a complex."); - -static PyObject * -cmath_polar(PyObject *self, PyObject *args) -{ - Py_complex z; - double r, phi; - if (!PyArg_ParseTuple(args, "D:polar", &z)) - return NULL; - PyFPE_START_PROTECT("polar function", return 0) - phi = c_atan2(z); /* should not cause any exception */ - r = c_abs(z); /* sets errno to ERANGE on overflow; otherwise 0 */ - PyFPE_END_PROTECT(r) - if (errno != 0) - return math_error(); - else - return Py_BuildValue("dd", r, phi); -} - -PyDoc_STRVAR(cmath_polar_doc, -"polar(z) -> r: float, phi: float\n\n\ -Convert a complex from rectangular coordinates to polar coordinates. r is\n\ -the distance from 0 and phi the phase angle."); - -/* - rect() isn't covered by the C99 standard, but it's not too hard to - figure out 'spirit of C99' rules for special value handing: - - rect(x, t) should behave like exp(log(x) + it) for positive-signed x - rect(x, t) should behave like -exp(log(-x) + it) for negative-signed x - rect(nan, t) should behave like exp(nan + it), except that rect(nan, 0) - gives nan +- i0 with the sign of the imaginary part unspecified. - -*/ - -static Py_complex rect_special_values[7][7]; - -static PyObject * -cmath_rect(PyObject *self, PyObject *args) -{ - Py_complex z; - double r, phi; - if (!PyArg_ParseTuple(args, "dd:rect", &r, &phi)) - return NULL; - errno = 0; - PyFPE_START_PROTECT("rect function", return 0) - - /* deal with special values */ - if (!Py_IS_FINITE(r) || !Py_IS_FINITE(phi)) { - /* if r is +/-infinity and phi is finite but nonzero then - result is (+-INF +-INF i), but we need to compute cos(phi) - and sin(phi) to figure out the signs. */ - if (Py_IS_INFINITY(r) && (Py_IS_FINITE(phi) - && (phi != 0.))) { - if (r > 0) { - z.real = copysign(INF, cos(phi)); - z.imag = copysign(INF, sin(phi)); - } - else { - z.real = -copysign(INF, cos(phi)); - z.imag = -copysign(INF, sin(phi)); - } - } - else { - z = rect_special_values[special_type(r)] - [special_type(phi)]; - } - /* need to set errno = EDOM if r is a nonzero number and phi - is infinite */ - if (r != 0. && !Py_IS_NAN(r) && Py_IS_INFINITY(phi)) - errno = EDOM; - else - errno = 0; - } - else if (phi == 0.0) { - /* Workaround for buggy results with phi=-0.0 on OS X 10.8. See - bugs.python.org/issue18513. */ - z.real = r; - z.imag = r * phi; - errno = 0; - } - else { - z.real = r * cos(phi); - z.imag = r * sin(phi); - errno = 0; - } - - PyFPE_END_PROTECT(z) - if (errno != 0) - return math_error(); - else - return PyComplex_FromCComplex(z); -} - -PyDoc_STRVAR(cmath_rect_doc, -"rect(r, phi) -> z: complex\n\n\ -Convert from polar coordinates to rectangular coordinates."); - -static PyObject * -cmath_isnan(PyObject *self, PyObject *args) -{ - Py_complex z; - if (!PyArg_ParseTuple(args, "D:isnan", &z)) - return NULL; - return PyBool_FromLong(Py_IS_NAN(z.real) || Py_IS_NAN(z.imag)); -} - -PyDoc_STRVAR(cmath_isnan_doc, -"isnan(z) -> bool\n\ -Checks if the real or imaginary part of z not a number (NaN)"); - -static PyObject * -cmath_isinf(PyObject *self, PyObject *args) -{ - Py_complex z; - if (!PyArg_ParseTuple(args, "D:isnan", &z)) - return NULL; - return PyBool_FromLong(Py_IS_INFINITY(z.real) || - Py_IS_INFINITY(z.imag)); -} - -PyDoc_STRVAR(cmath_isinf_doc, -"isinf(z) -> bool\n\ -Checks if the real or imaginary part of z is infinite."); - - -PyDoc_STRVAR(module_doc, -"This module is always available. It provides access to mathematical\n" -"functions for complex numbers."); - -static PyMethodDef cmath_methods[] = { - {"acos", cmath_acos, METH_VARARGS, c_acos_doc}, - {"acosh", cmath_acosh, METH_VARARGS, c_acosh_doc}, - {"asin", cmath_asin, METH_VARARGS, c_asin_doc}, - {"asinh", cmath_asinh, METH_VARARGS, c_asinh_doc}, - {"atan", cmath_atan, METH_VARARGS, c_atan_doc}, - {"atanh", cmath_atanh, METH_VARARGS, c_atanh_doc}, - {"cos", cmath_cos, METH_VARARGS, c_cos_doc}, - {"cosh", cmath_cosh, METH_VARARGS, c_cosh_doc}, - {"exp", cmath_exp, METH_VARARGS, c_exp_doc}, - {"isinf", cmath_isinf, METH_VARARGS, cmath_isinf_doc}, - {"isnan", cmath_isnan, METH_VARARGS, cmath_isnan_doc}, - {"log", cmath_log, METH_VARARGS, cmath_log_doc}, - {"log10", cmath_log10, METH_VARARGS, c_log10_doc}, - {"phase", cmath_phase, METH_VARARGS, cmath_phase_doc}, - {"polar", cmath_polar, METH_VARARGS, cmath_polar_doc}, - {"rect", cmath_rect, METH_VARARGS, cmath_rect_doc}, - {"sin", cmath_sin, METH_VARARGS, c_sin_doc}, - {"sinh", cmath_sinh, METH_VARARGS, c_sinh_doc}, - {"sqrt", cmath_sqrt, METH_VARARGS, c_sqrt_doc}, - {"tan", cmath_tan, METH_VARARGS, c_tan_doc}, - {"tanh", cmath_tanh, METH_VARARGS, c_tanh_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -initcmath(void) -{ - PyObject *m; - - m = Py_InitModule3("cmath", cmath_methods, module_doc); - if (m == NULL) - return; - - PyModule_AddObject(m, "pi", - PyFloat_FromDouble(Py_MATH_PI)); - PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E)); - - /* initialize special value tables */ - -#define INIT_SPECIAL_VALUES(NAME, BODY) { Py_complex* p = (Py_complex*)NAME; BODY } -#define C(REAL, IMAG) p->real = REAL; p->imag = IMAG; ++p; - - INIT_SPECIAL_VALUES(acos_special_values, { - C(P34,INF) C(P,INF) C(P,INF) C(P,-INF) C(P,-INF) C(P34,-INF) C(N,INF) - C(P12,INF) C(U,U) C(U,U) C(U,U) C(U,U) C(P12,-INF) C(N,N) - C(P12,INF) C(U,U) C(P12,0.) C(P12,-0.) C(U,U) C(P12,-INF) C(P12,N) - C(P12,INF) C(U,U) C(P12,0.) C(P12,-0.) C(U,U) C(P12,-INF) C(P12,N) - C(P12,INF) C(U,U) C(U,U) C(U,U) C(U,U) C(P12,-INF) C(N,N) - C(P14,INF) C(0.,INF) C(0.,INF) C(0.,-INF) C(0.,-INF) C(P14,-INF) C(N,INF) - C(N,INF) C(N,N) C(N,N) C(N,N) C(N,N) C(N,-INF) C(N,N) - }) - - INIT_SPECIAL_VALUES(acosh_special_values, { - C(INF,-P34) C(INF,-P) C(INF,-P) C(INF,P) C(INF,P) C(INF,P34) C(INF,N) - C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(0.,-P12) C(0.,P12) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(0.,-P12) C(0.,P12) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N) - C(INF,-P14) C(INF,-0.) C(INF,-0.) C(INF,0.) C(INF,0.) C(INF,P14) C(INF,N) - C(INF,N) C(N,N) C(N,N) C(N,N) C(N,N) C(INF,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(asinh_special_values, { - C(-INF,-P14) C(-INF,-0.) C(-INF,-0.) C(-INF,0.) C(-INF,0.) C(-INF,P14) C(-INF,N) - C(-INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(-INF,P12) C(N,N) - C(-INF,-P12) C(U,U) C(-0.,-0.) C(-0.,0.) C(U,U) C(-INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N) - C(INF,-P14) C(INF,-0.) C(INF,-0.) C(INF,0.) C(INF,0.) C(INF,P14) C(INF,N) - C(INF,N) C(N,N) C(N,-0.) C(N,0.) C(N,N) C(INF,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(atanh_special_values, { - C(-0.,-P12) C(-0.,-P12) C(-0.,-P12) C(-0.,P12) C(-0.,P12) C(-0.,P12) C(-0.,N) - C(-0.,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(-0.,P12) C(N,N) - C(-0.,-P12) C(U,U) C(-0.,-0.) C(-0.,0.) C(U,U) C(-0.,P12) C(-0.,N) - C(0.,-P12) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(0.,P12) C(0.,N) - C(0.,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(0.,P12) C(N,N) - C(0.,-P12) C(0.,-P12) C(0.,-P12) C(0.,P12) C(0.,P12) C(0.,P12) C(0.,N) - C(0.,-P12) C(N,N) C(N,N) C(N,N) C(N,N) C(0.,P12) C(N,N) - }) - - INIT_SPECIAL_VALUES(cosh_special_values, { - C(INF,N) C(U,U) C(INF,0.) C(INF,-0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(N,0.) C(U,U) C(1.,0.) C(1.,-0.) C(U,U) C(N,0.) C(N,0.) - C(N,0.) C(U,U) C(1.,-0.) C(1.,0.) C(U,U) C(N,0.) C(N,0.) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(INF,N) C(U,U) C(INF,-0.) C(INF,0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(N,N) C(N,0.) C(N,0.) C(N,N) C(N,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(exp_special_values, { - C(0.,0.) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(0.,0.) C(0.,0.) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(N,N) C(U,U) C(1.,-0.) C(1.,0.) C(U,U) C(N,N) C(N,N) - C(N,N) C(U,U) C(1.,-0.) C(1.,0.) C(U,U) C(N,N) C(N,N) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(INF,N) C(U,U) C(INF,-0.) C(INF,0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(N,N) C(N,-0.) C(N,0.) C(N,N) C(N,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(log_special_values, { - C(INF,-P34) C(INF,-P) C(INF,-P) C(INF,P) C(INF,P) C(INF,P34) C(INF,N) - C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(-INF,-P) C(-INF,P) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(-INF,-0.) C(-INF,0.) C(U,U) C(INF,P12) C(N,N) - C(INF,-P12) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,P12) C(N,N) - C(INF,-P14) C(INF,-0.) C(INF,-0.) C(INF,0.) C(INF,0.) C(INF,P14) C(INF,N) - C(INF,N) C(N,N) C(N,N) C(N,N) C(N,N) C(INF,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(sinh_special_values, { - C(INF,N) C(U,U) C(-INF,-0.) C(-INF,0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(0.,N) C(U,U) C(-0.,-0.) C(-0.,0.) C(U,U) C(0.,N) C(0.,N) - C(0.,N) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(0.,N) C(0.,N) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(INF,N) C(U,U) C(INF,-0.) C(INF,0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(N,N) C(N,-0.) C(N,0.) C(N,N) C(N,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(sqrt_special_values, { - C(INF,-INF) C(0.,-INF) C(0.,-INF) C(0.,INF) C(0.,INF) C(INF,INF) C(N,INF) - C(INF,-INF) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,INF) C(N,N) - C(INF,-INF) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(INF,INF) C(N,N) - C(INF,-INF) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(INF,INF) C(N,N) - C(INF,-INF) C(U,U) C(U,U) C(U,U) C(U,U) C(INF,INF) C(N,N) - C(INF,-INF) C(INF,-0.) C(INF,-0.) C(INF,0.) C(INF,0.) C(INF,INF) C(INF,N) - C(INF,-INF) C(N,N) C(N,N) C(N,N) C(N,N) C(INF,INF) C(N,N) - }) - - INIT_SPECIAL_VALUES(tanh_special_values, { - C(-1.,0.) C(U,U) C(-1.,-0.) C(-1.,0.) C(U,U) C(-1.,0.) C(-1.,0.) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(N,N) C(U,U) C(-0.,-0.) C(-0.,0.) C(U,U) C(N,N) C(N,N) - C(N,N) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(N,N) C(N,N) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(1.,0.) C(U,U) C(1.,-0.) C(1.,0.) C(U,U) C(1.,0.) C(1.,0.) - C(N,N) C(N,N) C(N,-0.) C(N,0.) C(N,N) C(N,N) C(N,N) - }) - - INIT_SPECIAL_VALUES(rect_special_values, { - C(INF,N) C(U,U) C(-INF,0.) C(-INF,-0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(0.,0.) C(U,U) C(-0.,0.) C(-0.,-0.) C(U,U) C(0.,0.) C(0.,0.) - C(0.,0.) C(U,U) C(0.,-0.) C(0.,0.) C(U,U) C(0.,0.) C(0.,0.) - C(N,N) C(U,U) C(U,U) C(U,U) C(U,U) C(N,N) C(N,N) - C(INF,N) C(U,U) C(INF,-0.) C(INF,0.) C(U,U) C(INF,N) C(INF,N) - C(N,N) C(N,N) C(N,0.) C(N,0.) C(N,N) C(N,N) C(N,N) - }) -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/datetimemodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/datetimemodule.c deleted file mode 100644 index 655f70d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/datetimemodule.c +++ /dev/null @@ -1,5117 +0,0 @@ -/* C implementation for the date/time type documented at - * http://www.zope.org/Members/fdrake/DateTimeWiki/FrontPage - */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "modsupport.h" -#include "structmember.h" - -#include - -#include "timefuncs.h" - -/* Differentiate between building the core module and building extension - * modules. - */ -#ifndef Py_BUILD_CORE -#define Py_BUILD_CORE -#endif -#include "datetime.h" -#undef Py_BUILD_CORE - -/* We require that C int be at least 32 bits, and use int virtually - * everywhere. In just a few cases we use a temp long, where a Python - * API returns a C long. In such cases, we have to ensure that the - * final result fits in a C int (this can be an issue on 64-bit boxes). - */ -#if SIZEOF_INT < 4 -# error "datetime.c requires that C int have at least 32 bits" -#endif - -#define MINYEAR 1 -#define MAXYEAR 9999 -#define MAXORDINAL 3652059 /* date(9999,12,31).toordinal() */ - -/* Nine decimal digits is easy to communicate, and leaves enough room - * so that two delta days can be added w/o fear of overflowing a signed - * 32-bit int, and with plenty of room left over to absorb any possible - * carries from adding seconds. - */ -#define MAX_DELTA_DAYS 999999999 - -/* Rename the long macros in datetime.h to more reasonable short names. */ -#define GET_YEAR PyDateTime_GET_YEAR -#define GET_MONTH PyDateTime_GET_MONTH -#define GET_DAY PyDateTime_GET_DAY -#define DATE_GET_HOUR PyDateTime_DATE_GET_HOUR -#define DATE_GET_MINUTE PyDateTime_DATE_GET_MINUTE -#define DATE_GET_SECOND PyDateTime_DATE_GET_SECOND -#define DATE_GET_MICROSECOND PyDateTime_DATE_GET_MICROSECOND - -/* Date accessors for date and datetime. */ -#define SET_YEAR(o, v) (((o)->data[0] = ((v) & 0xff00) >> 8), \ - ((o)->data[1] = ((v) & 0x00ff))) -#define SET_MONTH(o, v) (PyDateTime_GET_MONTH(o) = (v)) -#define SET_DAY(o, v) (PyDateTime_GET_DAY(o) = (v)) - -/* Date/Time accessors for datetime. */ -#define DATE_SET_HOUR(o, v) (PyDateTime_DATE_GET_HOUR(o) = (v)) -#define DATE_SET_MINUTE(o, v) (PyDateTime_DATE_GET_MINUTE(o) = (v)) -#define DATE_SET_SECOND(o, v) (PyDateTime_DATE_GET_SECOND(o) = (v)) -#define DATE_SET_MICROSECOND(o, v) \ - (((o)->data[7] = ((v) & 0xff0000) >> 16), \ - ((o)->data[8] = ((v) & 0x00ff00) >> 8), \ - ((o)->data[9] = ((v) & 0x0000ff))) - -/* Time accessors for time. */ -#define TIME_GET_HOUR PyDateTime_TIME_GET_HOUR -#define TIME_GET_MINUTE PyDateTime_TIME_GET_MINUTE -#define TIME_GET_SECOND PyDateTime_TIME_GET_SECOND -#define TIME_GET_MICROSECOND PyDateTime_TIME_GET_MICROSECOND -#define TIME_SET_HOUR(o, v) (PyDateTime_TIME_GET_HOUR(o) = (v)) -#define TIME_SET_MINUTE(o, v) (PyDateTime_TIME_GET_MINUTE(o) = (v)) -#define TIME_SET_SECOND(o, v) (PyDateTime_TIME_GET_SECOND(o) = (v)) -#define TIME_SET_MICROSECOND(o, v) \ - (((o)->data[3] = ((v) & 0xff0000) >> 16), \ - ((o)->data[4] = ((v) & 0x00ff00) >> 8), \ - ((o)->data[5] = ((v) & 0x0000ff))) - -/* Delta accessors for timedelta. */ -#define GET_TD_DAYS(o) (((PyDateTime_Delta *)(o))->days) -#define GET_TD_SECONDS(o) (((PyDateTime_Delta *)(o))->seconds) -#define GET_TD_MICROSECONDS(o) (((PyDateTime_Delta *)(o))->microseconds) - -#define SET_TD_DAYS(o, v) ((o)->days = (v)) -#define SET_TD_SECONDS(o, v) ((o)->seconds = (v)) -#define SET_TD_MICROSECONDS(o, v) ((o)->microseconds = (v)) - -/* p is a pointer to a time or a datetime object; HASTZINFO(p) returns - * p->hastzinfo. - */ -#define HASTZINFO(p) (((_PyDateTime_BaseTZInfo *)(p))->hastzinfo) - -/* M is a char or int claiming to be a valid month. The macro is equivalent - * to the two-sided Python test - * 1 <= M <= 12 - */ -#define MONTH_IS_SANE(M) ((unsigned int)(M) - 1 < 12) - -/* Forward declarations. */ -static PyTypeObject PyDateTime_DateType; -static PyTypeObject PyDateTime_DateTimeType; -static PyTypeObject PyDateTime_DeltaType; -static PyTypeObject PyDateTime_TimeType; -static PyTypeObject PyDateTime_TZInfoType; - -/* --------------------------------------------------------------------------- - * Math utilities. - */ - -/* k = i+j overflows iff k differs in sign from both inputs, - * iff k^i has sign bit set and k^j has sign bit set, - * iff (k^i)&(k^j) has sign bit set. - */ -#define SIGNED_ADD_OVERFLOWED(RESULT, I, J) \ - ((((RESULT) ^ (I)) & ((RESULT) ^ (J))) < 0) - -/* Compute Python divmod(x, y), returning the quotient and storing the - * remainder into *r. The quotient is the floor of x/y, and that's - * the real point of this. C will probably truncate instead (C99 - * requires truncation; C89 left it implementation-defined). - * Simplification: we *require* that y > 0 here. That's appropriate - * for all the uses made of it. This simplifies the code and makes - * the overflow case impossible (divmod(LONG_MIN, -1) is the only - * overflow case). - */ -static int -divmod(int x, int y, int *r) -{ - int quo; - - assert(y > 0); - quo = x / y; - *r = x - quo * y; - if (*r < 0) { - --quo; - *r += y; - } - assert(0 <= *r && *r < y); - return quo; -} - -/* Round a double to the nearest long. |x| must be small enough to fit - * in a C long; this is not checked. - */ -static long -round_to_long(double x) -{ - if (x >= 0.0) - x = floor(x + 0.5); - else - x = ceil(x - 0.5); - return (long)x; -} - -/* --------------------------------------------------------------------------- - * General calendrical helper functions - */ - -/* For each month ordinal in 1..12, the number of days in that month, - * and the number of days before that month in the same year. These - * are correct for non-leap years only. - */ -static int _days_in_month[] = { - 0, /* unused; this vector uses 1-based indexing */ - 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 -}; - -static int _days_before_month[] = { - 0, /* unused; this vector uses 1-based indexing */ - 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334 -}; - -/* year -> 1 if leap year, else 0. */ -static int -is_leap(int year) -{ - /* Cast year to unsigned. The result is the same either way, but - * C can generate faster code for unsigned mod than for signed - * mod (especially for % 4 -- a good compiler should just grab - * the last 2 bits when the LHS is unsigned). - */ - const unsigned int ayear = (unsigned int)year; - return ayear % 4 == 0 && (ayear % 100 != 0 || ayear % 400 == 0); -} - -/* year, month -> number of days in that month in that year */ -static int -days_in_month(int year, int month) -{ - assert(month >= 1); - assert(month <= 12); - if (month == 2 && is_leap(year)) - return 29; - else - return _days_in_month[month]; -} - -/* year, month -> number of days in year preceeding first day of month */ -static int -days_before_month(int year, int month) -{ - int days; - - assert(month >= 1); - assert(month <= 12); - days = _days_before_month[month]; - if (month > 2 && is_leap(year)) - ++days; - return days; -} - -/* year -> number of days before January 1st of year. Remember that we - * start with year 1, so days_before_year(1) == 0. - */ -static int -days_before_year(int year) -{ - int y = year - 1; - /* This is incorrect if year <= 0; we really want the floor - * here. But so long as MINYEAR is 1, the smallest year this - * can see is 0 (this can happen in some normalization endcases), - * so we'll just special-case that. - */ - assert (year >= 0); - if (y >= 0) - return y*365 + y/4 - y/100 + y/400; - else { - assert(y == -1); - return -366; - } -} - -/* Number of days in 4, 100, and 400 year cycles. That these have - * the correct values is asserted in the module init function. - */ -#define DI4Y 1461 /* days_before_year(5); days in 4 years */ -#define DI100Y 36524 /* days_before_year(101); days in 100 years */ -#define DI400Y 146097 /* days_before_year(401); days in 400 years */ - -/* ordinal -> year, month, day, considering 01-Jan-0001 as day 1. */ -static void -ord_to_ymd(int ordinal, int *year, int *month, int *day) -{ - int n, n1, n4, n100, n400, leapyear, preceding; - - /* ordinal is a 1-based index, starting at 1-Jan-1. The pattern of - * leap years repeats exactly every 400 years. The basic strategy is - * to find the closest 400-year boundary at or before ordinal, then - * work with the offset from that boundary to ordinal. Life is much - * clearer if we subtract 1 from ordinal first -- then the values - * of ordinal at 400-year boundaries are exactly those divisible - * by DI400Y: - * - * D M Y n n-1 - * -- --- ---- ---------- ---------------- - * 31 Dec -400 -DI400Y -DI400Y -1 - * 1 Jan -399 -DI400Y +1 -DI400Y 400-year boundary - * ... - * 30 Dec 000 -1 -2 - * 31 Dec 000 0 -1 - * 1 Jan 001 1 0 400-year boundary - * 2 Jan 001 2 1 - * 3 Jan 001 3 2 - * ... - * 31 Dec 400 DI400Y DI400Y -1 - * 1 Jan 401 DI400Y +1 DI400Y 400-year boundary - */ - assert(ordinal >= 1); - --ordinal; - n400 = ordinal / DI400Y; - n = ordinal % DI400Y; - *year = n400 * 400 + 1; - - /* Now n is the (non-negative) offset, in days, from January 1 of - * year, to the desired date. Now compute how many 100-year cycles - * precede n. - * Note that it's possible for n100 to equal 4! In that case 4 full - * 100-year cycles precede the desired day, which implies the - * desired day is December 31 at the end of a 400-year cycle. - */ - n100 = n / DI100Y; - n = n % DI100Y; - - /* Now compute how many 4-year cycles precede it. */ - n4 = n / DI4Y; - n = n % DI4Y; - - /* And now how many single years. Again n1 can be 4, and again - * meaning that the desired day is December 31 at the end of the - * 4-year cycle. - */ - n1 = n / 365; - n = n % 365; - - *year += n100 * 100 + n4 * 4 + n1; - if (n1 == 4 || n100 == 4) { - assert(n == 0); - *year -= 1; - *month = 12; - *day = 31; - return; - } - - /* Now the year is correct, and n is the offset from January 1. We - * find the month via an estimate that's either exact or one too - * large. - */ - leapyear = n1 == 3 && (n4 != 24 || n100 == 3); - assert(leapyear == is_leap(*year)); - *month = (n + 50) >> 5; - preceding = (_days_before_month[*month] + (*month > 2 && leapyear)); - if (preceding > n) { - /* estimate is too large */ - *month -= 1; - preceding -= days_in_month(*year, *month); - } - n -= preceding; - assert(0 <= n); - assert(n < days_in_month(*year, *month)); - - *day = n + 1; -} - -/* year, month, day -> ordinal, considering 01-Jan-0001 as day 1. */ -static int -ymd_to_ord(int year, int month, int day) -{ - return days_before_year(year) + days_before_month(year, month) + day; -} - -/* Day of week, where Monday==0, ..., Sunday==6. 1/1/1 was a Monday. */ -static int -weekday(int year, int month, int day) -{ - return (ymd_to_ord(year, month, day) + 6) % 7; -} - -/* Ordinal of the Monday starting week 1 of the ISO year. Week 1 is the - * first calendar week containing a Thursday. - */ -static int -iso_week1_monday(int year) -{ - int first_day = ymd_to_ord(year, 1, 1); /* ord of 1/1 */ - /* 0 if 1/1 is a Monday, 1 if a Tue, etc. */ - int first_weekday = (first_day + 6) % 7; - /* ordinal of closest Monday at or before 1/1 */ - int week1_monday = first_day - first_weekday; - - if (first_weekday > 3) /* if 1/1 was Fri, Sat, Sun */ - week1_monday += 7; - return week1_monday; -} - -/* --------------------------------------------------------------------------- - * Range checkers. - */ - -/* Check that -MAX_DELTA_DAYS <= days <= MAX_DELTA_DAYS. If so, return 0. - * If not, raise OverflowError and return -1. - */ -static int -check_delta_day_range(int days) -{ - if (-MAX_DELTA_DAYS <= days && days <= MAX_DELTA_DAYS) - return 0; - PyErr_Format(PyExc_OverflowError, - "days=%d; must have magnitude <= %d", - days, MAX_DELTA_DAYS); - return -1; -} - -/* Check that date arguments are in range. Return 0 if they are. If they - * aren't, raise ValueError and return -1. - */ -static int -check_date_args(int year, int month, int day) -{ - - if (year < MINYEAR || year > MAXYEAR) { - PyErr_SetString(PyExc_ValueError, - "year is out of range"); - return -1; - } - if (month < 1 || month > 12) { - PyErr_SetString(PyExc_ValueError, - "month must be in 1..12"); - return -1; - } - if (day < 1 || day > days_in_month(year, month)) { - PyErr_SetString(PyExc_ValueError, - "day is out of range for month"); - return -1; - } - return 0; -} - -/* Check that time arguments are in range. Return 0 if they are. If they - * aren't, raise ValueError and return -1. - */ -static int -check_time_args(int h, int m, int s, int us) -{ - if (h < 0 || h > 23) { - PyErr_SetString(PyExc_ValueError, - "hour must be in 0..23"); - return -1; - } - if (m < 0 || m > 59) { - PyErr_SetString(PyExc_ValueError, - "minute must be in 0..59"); - return -1; - } - if (s < 0 || s > 59) { - PyErr_SetString(PyExc_ValueError, - "second must be in 0..59"); - return -1; - } - if (us < 0 || us > 999999) { - PyErr_SetString(PyExc_ValueError, - "microsecond must be in 0..999999"); - return -1; - } - return 0; -} - -/* --------------------------------------------------------------------------- - * Normalization utilities. - */ - -/* One step of a mixed-radix conversion. A "hi" unit is equivalent to - * factor "lo" units. factor must be > 0. If *lo is less than 0, or - * at least factor, enough of *lo is converted into "hi" units so that - * 0 <= *lo < factor. The input values must be such that int overflow - * is impossible. - */ -static void -normalize_pair(int *hi, int *lo, int factor) -{ - assert(factor > 0); - assert(lo != hi); - if (*lo < 0 || *lo >= factor) { - const int num_hi = divmod(*lo, factor, lo); - const int new_hi = *hi + num_hi; - assert(! SIGNED_ADD_OVERFLOWED(new_hi, *hi, num_hi)); - *hi = new_hi; - } - assert(0 <= *lo && *lo < factor); -} - -/* Fiddle days (d), seconds (s), and microseconds (us) so that - * 0 <= *s < 24*3600 - * 0 <= *us < 1000000 - * The input values must be such that the internals don't overflow. - * The way this routine is used, we don't get close. - */ -static void -normalize_d_s_us(int *d, int *s, int *us) -{ - if (*us < 0 || *us >= 1000000) { - normalize_pair(s, us, 1000000); - /* |s| can't be bigger than about - * |original s| + |original us|/1000000 now. - */ - - } - if (*s < 0 || *s >= 24*3600) { - normalize_pair(d, s, 24*3600); - /* |d| can't be bigger than about - * |original d| + - * (|original s| + |original us|/1000000) / (24*3600) now. - */ - } - assert(0 <= *s && *s < 24*3600); - assert(0 <= *us && *us < 1000000); -} - -/* Fiddle years (y), months (m), and days (d) so that - * 1 <= *m <= 12 - * 1 <= *d <= days_in_month(*y, *m) - * The input values must be such that the internals don't overflow. - * The way this routine is used, we don't get close. - */ -static int -normalize_y_m_d(int *y, int *m, int *d) -{ - int dim; /* # of days in month */ - - /* This gets muddy: the proper range for day can't be determined - * without knowing the correct month and year, but if day is, e.g., - * plus or minus a million, the current month and year values make - * no sense (and may also be out of bounds themselves). - * Saying 12 months == 1 year should be non-controversial. - */ - if (*m < 1 || *m > 12) { - --*m; - normalize_pair(y, m, 12); - ++*m; - /* |y| can't be bigger than about - * |original y| + |original m|/12 now. - */ - } - assert(1 <= *m && *m <= 12); - - /* Now only day can be out of bounds (year may also be out of bounds - * for a datetime object, but we don't care about that here). - * If day is out of bounds, what to do is arguable, but at least the - * method here is principled and explainable. - */ - dim = days_in_month(*y, *m); - if (*d < 1 || *d > dim) { - /* Move day-1 days from the first of the month. First try to - * get off cheap if we're only one day out of range - * (adjustments for timezone alone can't be worse than that). - */ - if (*d == 0) { - --*m; - if (*m > 0) - *d = days_in_month(*y, *m); - else { - --*y; - *m = 12; - *d = 31; - } - } - else if (*d == dim + 1) { - /* move forward a day */ - ++*m; - *d = 1; - if (*m > 12) { - *m = 1; - ++*y; - } - } - else { - int ordinal = ymd_to_ord(*y, *m, 1) + - *d - 1; - if (ordinal < 1 || ordinal > MAXORDINAL) { - goto error; - } else { - ord_to_ymd(ordinal, y, m, d); - return 0; - } - } - } - assert(*m > 0); - assert(*d > 0); - if (MINYEAR <= *y && *y <= MAXYEAR) - return 0; - error: - PyErr_SetString(PyExc_OverflowError, - "date value out of range"); - return -1; - -} - -/* Fiddle out-of-bounds months and days so that the result makes some kind - * of sense. The parameters are both inputs and outputs. Returns < 0 on - * failure, where failure means the adjusted year is out of bounds. - */ -static int -normalize_date(int *year, int *month, int *day) -{ - return normalize_y_m_d(year, month, day); -} - -/* Force all the datetime fields into range. The parameters are both - * inputs and outputs. Returns < 0 on error. - */ -static int -normalize_datetime(int *year, int *month, int *day, - int *hour, int *minute, int *second, - int *microsecond) -{ - normalize_pair(second, microsecond, 1000000); - normalize_pair(minute, second, 60); - normalize_pair(hour, minute, 60); - normalize_pair(day, hour, 24); - return normalize_date(year, month, day); -} - -/* --------------------------------------------------------------------------- - * Basic object allocation: tp_alloc implementations. These allocate - * Python objects of the right size and type, and do the Python object- - * initialization bit. If there's not enough memory, they return NULL after - * setting MemoryError. All data members remain uninitialized trash. - * - * We abuse the tp_alloc "nitems" argument to communicate whether a tzinfo - * member is needed. This is ugly, imprecise, and possibly insecure. - * tp_basicsize for the time and datetime types is set to the size of the - * struct that has room for the tzinfo member, so subclasses in Python will - * allocate enough space for a tzinfo member whether or not one is actually - * needed. That's the "ugly and imprecise" parts. The "possibly insecure" - * part is that PyType_GenericAlloc() (which subclasses in Python end up - * using) just happens today to effectively ignore the nitems argument - * when tp_itemsize is 0, which it is for these type objects. If that - * changes, perhaps the callers of tp_alloc slots in this file should - * be changed to force a 0 nitems argument unless the type being allocated - * is a base type implemented in this file (so that tp_alloc is time_alloc - * or datetime_alloc below, which know about the nitems abuse). - */ - -static PyObject * -time_alloc(PyTypeObject *type, Py_ssize_t aware) -{ - PyObject *self; - - self = (PyObject *) - PyObject_MALLOC(aware ? - sizeof(PyDateTime_Time) : - sizeof(_PyDateTime_BaseTime)); - if (self == NULL) - return (PyObject *)PyErr_NoMemory(); - PyObject_INIT(self, type); - return self; -} - -static PyObject * -datetime_alloc(PyTypeObject *type, Py_ssize_t aware) -{ - PyObject *self; - - self = (PyObject *) - PyObject_MALLOC(aware ? - sizeof(PyDateTime_DateTime) : - sizeof(_PyDateTime_BaseDateTime)); - if (self == NULL) - return (PyObject *)PyErr_NoMemory(); - PyObject_INIT(self, type); - return self; -} - -/* --------------------------------------------------------------------------- - * Helpers for setting object fields. These work on pointers to the - * appropriate base class. - */ - -/* For date and datetime. */ -static void -set_date_fields(PyDateTime_Date *self, int y, int m, int d) -{ - self->hashcode = -1; - SET_YEAR(self, y); - SET_MONTH(self, m); - SET_DAY(self, d); -} - -/* --------------------------------------------------------------------------- - * Create various objects, mostly without range checking. - */ - -/* Create a date instance with no range checking. */ -static PyObject * -new_date_ex(int year, int month, int day, PyTypeObject *type) -{ - PyDateTime_Date *self; - - self = (PyDateTime_Date *) (type->tp_alloc(type, 0)); - if (self != NULL) - set_date_fields(self, year, month, day); - return (PyObject *) self; -} - -#define new_date(year, month, day) \ - new_date_ex(year, month, day, &PyDateTime_DateType) - -/* Create a datetime instance with no range checking. */ -static PyObject * -new_datetime_ex(int year, int month, int day, int hour, int minute, - int second, int usecond, PyObject *tzinfo, PyTypeObject *type) -{ - PyDateTime_DateTime *self; - char aware = tzinfo != Py_None; - - self = (PyDateTime_DateTime *) (type->tp_alloc(type, aware)); - if (self != NULL) { - self->hastzinfo = aware; - set_date_fields((PyDateTime_Date *)self, year, month, day); - DATE_SET_HOUR(self, hour); - DATE_SET_MINUTE(self, minute); - DATE_SET_SECOND(self, second); - DATE_SET_MICROSECOND(self, usecond); - if (aware) { - Py_INCREF(tzinfo); - self->tzinfo = tzinfo; - } - } - return (PyObject *)self; -} - -#define new_datetime(y, m, d, hh, mm, ss, us, tzinfo) \ - new_datetime_ex(y, m, d, hh, mm, ss, us, tzinfo, \ - &PyDateTime_DateTimeType) - -/* Create a time instance with no range checking. */ -static PyObject * -new_time_ex(int hour, int minute, int second, int usecond, - PyObject *tzinfo, PyTypeObject *type) -{ - PyDateTime_Time *self; - char aware = tzinfo != Py_None; - - self = (PyDateTime_Time *) (type->tp_alloc(type, aware)); - if (self != NULL) { - self->hastzinfo = aware; - self->hashcode = -1; - TIME_SET_HOUR(self, hour); - TIME_SET_MINUTE(self, minute); - TIME_SET_SECOND(self, second); - TIME_SET_MICROSECOND(self, usecond); - if (aware) { - Py_INCREF(tzinfo); - self->tzinfo = tzinfo; - } - } - return (PyObject *)self; -} - -#define new_time(hh, mm, ss, us, tzinfo) \ - new_time_ex(hh, mm, ss, us, tzinfo, &PyDateTime_TimeType) - -/* Create a timedelta instance. Normalize the members iff normalize is - * true. Passing false is a speed optimization, if you know for sure - * that seconds and microseconds are already in their proper ranges. In any - * case, raises OverflowError and returns NULL if the normalized days is out - * of range). - */ -static PyObject * -new_delta_ex(int days, int seconds, int microseconds, int normalize, - PyTypeObject *type) -{ - PyDateTime_Delta *self; - - if (normalize) - normalize_d_s_us(&days, &seconds, µseconds); - assert(0 <= seconds && seconds < 24*3600); - assert(0 <= microseconds && microseconds < 1000000); - - if (check_delta_day_range(days) < 0) - return NULL; - - self = (PyDateTime_Delta *) (type->tp_alloc(type, 0)); - if (self != NULL) { - self->hashcode = -1; - SET_TD_DAYS(self, days); - SET_TD_SECONDS(self, seconds); - SET_TD_MICROSECONDS(self, microseconds); - } - return (PyObject *) self; -} - -#define new_delta(d, s, us, normalize) \ - new_delta_ex(d, s, us, normalize, &PyDateTime_DeltaType) - -/* --------------------------------------------------------------------------- - * tzinfo helpers. - */ - -/* Ensure that p is None or of a tzinfo subclass. Return 0 if OK; if not - * raise TypeError and return -1. - */ -static int -check_tzinfo_subclass(PyObject *p) -{ - if (p == Py_None || PyTZInfo_Check(p)) - return 0; - PyErr_Format(PyExc_TypeError, - "tzinfo argument must be None or of a tzinfo subclass, " - "not type '%s'", - Py_TYPE(p)->tp_name); - return -1; -} - -/* Return tzinfo.methname(tzinfoarg), without any checking of results. - * If tzinfo is None, returns None. - */ -static PyObject * -call_tzinfo_method(PyObject *tzinfo, char *methname, PyObject *tzinfoarg) -{ - PyObject *result; - - assert(tzinfo && methname && tzinfoarg); - assert(check_tzinfo_subclass(tzinfo) >= 0); - if (tzinfo == Py_None) { - result = Py_None; - Py_INCREF(result); - } - else - result = PyObject_CallMethod(tzinfo, methname, "O", tzinfoarg); - return result; -} - -/* If self has a tzinfo member, return a BORROWED reference to it. Else - * return NULL, which is NOT AN ERROR. There are no error returns here, - * and the caller must not decref the result. - */ -static PyObject * -get_tzinfo_member(PyObject *self) -{ - PyObject *tzinfo = NULL; - - if (PyDateTime_Check(self) && HASTZINFO(self)) - tzinfo = ((PyDateTime_DateTime *)self)->tzinfo; - else if (PyTime_Check(self) && HASTZINFO(self)) - tzinfo = ((PyDateTime_Time *)self)->tzinfo; - - return tzinfo; -} - -/* Call getattr(tzinfo, name)(tzinfoarg), and extract an int from the - * result. tzinfo must be an instance of the tzinfo class. If the method - * returns None, this returns 0 and sets *none to 1. If the method doesn't - * return None or timedelta, TypeError is raised and this returns -1. If it - * returnsa timedelta and the value is out of range or isn't a whole number - * of minutes, ValueError is raised and this returns -1. - * Else *none is set to 0 and the integer method result is returned. - */ -static int -call_utc_tzinfo_method(PyObject *tzinfo, char *name, PyObject *tzinfoarg, - int *none) -{ - PyObject *u; - int result = -1; - - assert(tzinfo != NULL); - assert(PyTZInfo_Check(tzinfo)); - assert(tzinfoarg != NULL); - - *none = 0; - u = call_tzinfo_method(tzinfo, name, tzinfoarg); - if (u == NULL) - return -1; - - else if (u == Py_None) { - result = 0; - *none = 1; - } - else if (PyDelta_Check(u)) { - const int days = GET_TD_DAYS(u); - if (days < -1 || days > 0) - result = 24*60; /* trigger ValueError below */ - else { - /* next line can't overflow because we know days - * is -1 or 0 now - */ - int ss = days * 24 * 3600 + GET_TD_SECONDS(u); - result = divmod(ss, 60, &ss); - if (ss || GET_TD_MICROSECONDS(u)) { - PyErr_Format(PyExc_ValueError, - "tzinfo.%s() must return a " - "whole number of minutes", - name); - result = -1; - } - } - } - else { - PyErr_Format(PyExc_TypeError, - "tzinfo.%s() must return None or " - "timedelta, not '%s'", - name, Py_TYPE(u)->tp_name); - } - - Py_DECREF(u); - if (result < -1439 || result > 1439) { - PyErr_Format(PyExc_ValueError, - "tzinfo.%s() returned %d; must be in " - "-1439 .. 1439", - name, result); - result = -1; - } - return result; -} - -/* Call tzinfo.utcoffset(tzinfoarg), and extract an integer from the - * result. tzinfo must be an instance of the tzinfo class. If utcoffset() - * returns None, call_utcoffset returns 0 and sets *none to 1. If uctoffset() - * doesn't return None or timedelta, TypeError is raised and this returns -1. - * If utcoffset() returns an invalid timedelta (out of range, or not a whole - * # of minutes), ValueError is raised and this returns -1. Else *none is - * set to 0 and the offset is returned (as int # of minutes east of UTC). - */ -static int -call_utcoffset(PyObject *tzinfo, PyObject *tzinfoarg, int *none) -{ - return call_utc_tzinfo_method(tzinfo, "utcoffset", tzinfoarg, none); -} - -/* Call tzinfo.name(tzinfoarg), and return the offset as a timedelta or None. - */ -static PyObject * -offset_as_timedelta(PyObject *tzinfo, char *name, PyObject *tzinfoarg) { - PyObject *result; - - assert(tzinfo && name && tzinfoarg); - if (tzinfo == Py_None) { - result = Py_None; - Py_INCREF(result); - } - else { - int none; - int offset = call_utc_tzinfo_method(tzinfo, name, tzinfoarg, - &none); - if (offset < 0 && PyErr_Occurred()) - return NULL; - if (none) { - result = Py_None; - Py_INCREF(result); - } - else - result = new_delta(0, offset * 60, 0, 1); - } - return result; -} - -/* Call tzinfo.dst(tzinfoarg), and extract an integer from the - * result. tzinfo must be an instance of the tzinfo class. If dst() - * returns None, call_dst returns 0 and sets *none to 1. If dst() - & doesn't return None or timedelta, TypeError is raised and this - * returns -1. If dst() returns an invalid timedelta for a UTC offset, - * ValueError is raised and this returns -1. Else *none is set to 0 and - * the offset is returned (as an int # of minutes east of UTC). - */ -static int -call_dst(PyObject *tzinfo, PyObject *tzinfoarg, int *none) -{ - return call_utc_tzinfo_method(tzinfo, "dst", tzinfoarg, none); -} - -/* Call tzinfo.tzname(tzinfoarg), and return the result. tzinfo must be - * an instance of the tzinfo class or None. If tzinfo isn't None, and - * tzname() doesn't return None or a string, TypeError is raised and this - * returns NULL. - */ -static PyObject * -call_tzname(PyObject *tzinfo, PyObject *tzinfoarg) -{ - PyObject *result; - - assert(tzinfo != NULL); - assert(check_tzinfo_subclass(tzinfo) >= 0); - assert(tzinfoarg != NULL); - - if (tzinfo == Py_None) { - result = Py_None; - Py_INCREF(result); - } - else - result = PyObject_CallMethod(tzinfo, "tzname", "O", tzinfoarg); - - if (result != NULL && result != Py_None && ! PyString_Check(result)) { - PyErr_Format(PyExc_TypeError, "tzinfo.tzname() must " - "return None or a string, not '%s'", - Py_TYPE(result)->tp_name); - Py_DECREF(result); - result = NULL; - } - return result; -} - -typedef enum { - /* an exception has been set; the caller should pass it on */ - OFFSET_ERROR, - - /* type isn't date, datetime, or time subclass */ - OFFSET_UNKNOWN, - - /* date, - * datetime with !hastzinfo - * datetime with None tzinfo, - * datetime where utcoffset() returns None - * time with !hastzinfo - * time with None tzinfo, - * time where utcoffset() returns None - */ - OFFSET_NAIVE, - - /* time or datetime where utcoffset() doesn't return None */ - OFFSET_AWARE -} naivety; - -/* Classify an object as to whether it's naive or offset-aware. See - * the "naivety" typedef for details. If the type is aware, *offset is set - * to minutes east of UTC (as returned by the tzinfo.utcoffset() method). - * If the type is offset-naive (or unknown, or error), *offset is set to 0. - * tzinfoarg is the argument to pass to the tzinfo.utcoffset() method. - */ -static naivety -classify_utcoffset(PyObject *op, PyObject *tzinfoarg, int *offset) -{ - int none; - PyObject *tzinfo; - - assert(tzinfoarg != NULL); - *offset = 0; - tzinfo = get_tzinfo_member(op); /* NULL means no tzinfo, not error */ - if (tzinfo == Py_None) - return OFFSET_NAIVE; - if (tzinfo == NULL) { - /* note that a datetime passes the PyDate_Check test */ - return (PyTime_Check(op) || PyDate_Check(op)) ? - OFFSET_NAIVE : OFFSET_UNKNOWN; - } - *offset = call_utcoffset(tzinfo, tzinfoarg, &none); - if (*offset == -1 && PyErr_Occurred()) - return OFFSET_ERROR; - return none ? OFFSET_NAIVE : OFFSET_AWARE; -} - -/* Classify two objects as to whether they're naive or offset-aware. - * This isn't quite the same as calling classify_utcoffset() twice: for - * binary operations (comparison and subtraction), we generally want to - * ignore the tzinfo members if they're identical. This is by design, - * so that results match "naive" expectations when mixing objects from a - * single timezone. So in that case, this sets both offsets to 0 and - * both naiveties to OFFSET_NAIVE. - * The function returns 0 if everything's OK, and -1 on error. - */ -static int -classify_two_utcoffsets(PyObject *o1, int *offset1, naivety *n1, - PyObject *tzinfoarg1, - PyObject *o2, int *offset2, naivety *n2, - PyObject *tzinfoarg2) -{ - if (get_tzinfo_member(o1) == get_tzinfo_member(o2)) { - *offset1 = *offset2 = 0; - *n1 = *n2 = OFFSET_NAIVE; - } - else { - *n1 = classify_utcoffset(o1, tzinfoarg1, offset1); - if (*n1 == OFFSET_ERROR) - return -1; - *n2 = classify_utcoffset(o2, tzinfoarg2, offset2); - if (*n2 == OFFSET_ERROR) - return -1; - } - return 0; -} - -/* repr is like "someclass(arg1, arg2)". If tzinfo isn't None, - * stuff - * ", tzinfo=" + repr(tzinfo) - * before the closing ")". - */ -static PyObject * -append_keyword_tzinfo(PyObject *repr, PyObject *tzinfo) -{ - PyObject *temp; - - assert(PyString_Check(repr)); - assert(tzinfo); - if (tzinfo == Py_None) - return repr; - /* Get rid of the trailing ')'. */ - assert(PyString_AsString(repr)[PyString_Size(repr)-1] == ')'); - temp = PyString_FromStringAndSize(PyString_AsString(repr), - PyString_Size(repr) - 1); - Py_DECREF(repr); - if (temp == NULL) - return NULL; - repr = temp; - - /* Append ", tzinfo=". */ - PyString_ConcatAndDel(&repr, PyString_FromString(", tzinfo=")); - - /* Append repr(tzinfo). */ - PyString_ConcatAndDel(&repr, PyObject_Repr(tzinfo)); - - /* Add a closing paren. */ - PyString_ConcatAndDel(&repr, PyString_FromString(")")); - return repr; -} - -/* --------------------------------------------------------------------------- - * String format helpers. - */ - -static PyObject * -format_ctime(PyDateTime_Date *date, int hours, int minutes, int seconds) -{ - static const char *DayNames[] = { - "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" - }; - static const char *MonthNames[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - char buffer[128]; - int wday = weekday(GET_YEAR(date), GET_MONTH(date), GET_DAY(date)); - - PyOS_snprintf(buffer, sizeof(buffer), "%s %s %2d %02d:%02d:%02d %04d", - DayNames[wday], MonthNames[GET_MONTH(date) - 1], - GET_DAY(date), hours, minutes, seconds, - GET_YEAR(date)); - return PyString_FromString(buffer); -} - -/* Add an hours & minutes UTC offset string to buf. buf has no more than - * buflen bytes remaining. The UTC offset is gotten by calling - * tzinfo.uctoffset(tzinfoarg). If that returns None, \0 is stored into - * *buf, and that's all. Else the returned value is checked for sanity (an - * integer in range), and if that's OK it's converted to an hours & minutes - * string of the form - * sign HH sep MM - * Returns 0 if everything is OK. If the return value from utcoffset() is - * bogus, an appropriate exception is set and -1 is returned. - */ -static int -format_utcoffset(char *buf, size_t buflen, const char *sep, - PyObject *tzinfo, PyObject *tzinfoarg) -{ - int offset; - int hours; - int minutes; - char sign; - int none; - - assert(buflen >= 1); - - offset = call_utcoffset(tzinfo, tzinfoarg, &none); - if (offset == -1 && PyErr_Occurred()) - return -1; - if (none) { - *buf = '\0'; - return 0; - } - sign = '+'; - if (offset < 0) { - sign = '-'; - offset = - offset; - } - hours = divmod(offset, 60, &minutes); - PyOS_snprintf(buf, buflen, "%c%02d%s%02d", sign, hours, sep, minutes); - return 0; -} - -static PyObject * -make_freplacement(PyObject *object) -{ - char freplacement[64]; - if (PyTime_Check(object)) - sprintf(freplacement, "%06d", TIME_GET_MICROSECOND(object)); - else if (PyDateTime_Check(object)) - sprintf(freplacement, "%06d", DATE_GET_MICROSECOND(object)); - else - sprintf(freplacement, "%06d", 0); - - return PyString_FromStringAndSize(freplacement, strlen(freplacement)); -} - -/* I sure don't want to reproduce the strftime code from the time module, - * so this imports the module and calls it. All the hair is due to - * giving special meanings to the %z, %Z and %f format codes via a - * preprocessing step on the format string. - * tzinfoarg is the argument to pass to the object's tzinfo method, if - * needed. - */ -static PyObject * -wrap_strftime(PyObject *object, const char *format, size_t format_len, - PyObject *timetuple, PyObject *tzinfoarg) -{ - PyObject *result = NULL; /* guilty until proved innocent */ - - PyObject *zreplacement = NULL; /* py string, replacement for %z */ - PyObject *Zreplacement = NULL; /* py string, replacement for %Z */ - PyObject *freplacement = NULL; /* py string, replacement for %f */ - - const char *pin; /* pointer to next char in input format */ - char ch; /* next char in input format */ - - PyObject *newfmt = NULL; /* py string, the output format */ - char *pnew; /* pointer to available byte in output format */ - size_t totalnew; /* number bytes total in output format buffer, - exclusive of trailing \0 */ - size_t usednew; /* number bytes used so far in output format buffer */ - - const char *ptoappend; /* ptr to string to append to output buffer */ - size_t ntoappend; /* # of bytes to append to output buffer */ - - assert(object && format && timetuple); - - /* Give up if the year is before 1900. - * Python strftime() plays games with the year, and different - * games depending on whether envar PYTHON2K is set. This makes - * years before 1900 a nightmare, even if the platform strftime - * supports them (and not all do). - * We could get a lot farther here by avoiding Python's strftime - * wrapper and calling the C strftime() directly, but that isn't - * an option in the Python implementation of this module. - */ - { - long year; - PyObject *pyyear = PySequence_GetItem(timetuple, 0); - if (pyyear == NULL) return NULL; - assert(PyInt_Check(pyyear)); - year = PyInt_AsLong(pyyear); - Py_DECREF(pyyear); - if (year < 1900) { - PyErr_Format(PyExc_ValueError, "year=%ld is before " - "1900; the datetime strftime() " - "methods require year >= 1900", - year); - return NULL; - } - } - - /* Scan the input format, looking for %z/%Z/%f escapes, building - * a new format. Since computing the replacements for those codes - * is expensive, don't unless they're actually used. - */ - if (format_len > INT_MAX - 1) { - PyErr_NoMemory(); - goto Done; - } - - totalnew = format_len + 1; /* realistic if no %z/%Z/%f */ - newfmt = PyString_FromStringAndSize(NULL, totalnew); - if (newfmt == NULL) goto Done; - pnew = PyString_AsString(newfmt); - usednew = 0; - - pin = format; - while ((ch = *pin++) != '\0') { - if (ch != '%') { - ptoappend = pin - 1; - ntoappend = 1; - } - else if ((ch = *pin++) == '\0') { - /* There's a lone trailing %; doesn't make sense. */ - PyErr_SetString(PyExc_ValueError, "strftime format " - "ends with raw %"); - goto Done; - } - /* A % has been seen and ch is the character after it. */ - else if (ch == 'z') { - if (zreplacement == NULL) { - /* format utcoffset */ - char buf[100]; - PyObject *tzinfo = get_tzinfo_member(object); - zreplacement = PyString_FromString(""); - if (zreplacement == NULL) goto Done; - if (tzinfo != Py_None && tzinfo != NULL) { - assert(tzinfoarg != NULL); - if (format_utcoffset(buf, - sizeof(buf), - "", - tzinfo, - tzinfoarg) < 0) - goto Done; - Py_DECREF(zreplacement); - zreplacement = PyString_FromString(buf); - if (zreplacement == NULL) goto Done; - } - } - assert(zreplacement != NULL); - ptoappend = PyString_AS_STRING(zreplacement); - ntoappend = PyString_GET_SIZE(zreplacement); - } - else if (ch == 'Z') { - /* format tzname */ - if (Zreplacement == NULL) { - PyObject *tzinfo = get_tzinfo_member(object); - Zreplacement = PyString_FromString(""); - if (Zreplacement == NULL) goto Done; - if (tzinfo != Py_None && tzinfo != NULL) { - PyObject *temp; - assert(tzinfoarg != NULL); - temp = call_tzname(tzinfo, tzinfoarg); - if (temp == NULL) goto Done; - if (temp != Py_None) { - assert(PyString_Check(temp)); - /* Since the tzname is getting - * stuffed into the format, we - * have to double any % signs - * so that strftime doesn't - * treat them as format codes. - */ - Py_DECREF(Zreplacement); - Zreplacement = PyObject_CallMethod( - temp, "replace", - "ss", "%", "%%"); - Py_DECREF(temp); - if (Zreplacement == NULL) - goto Done; - if (!PyString_Check(Zreplacement)) { - PyErr_SetString(PyExc_TypeError, "tzname.replace() did not return a string"); - goto Done; - } - } - else - Py_DECREF(temp); - } - } - assert(Zreplacement != NULL); - ptoappend = PyString_AS_STRING(Zreplacement); - ntoappend = PyString_GET_SIZE(Zreplacement); - } - else if (ch == 'f') { - /* format microseconds */ - if (freplacement == NULL) { - freplacement = make_freplacement(object); - if (freplacement == NULL) - goto Done; - } - assert(freplacement != NULL); - assert(PyString_Check(freplacement)); - ptoappend = PyString_AS_STRING(freplacement); - ntoappend = PyString_GET_SIZE(freplacement); - } - else { - /* percent followed by neither z nor Z */ - ptoappend = pin - 2; - ntoappend = 2; - } - - /* Append the ntoappend chars starting at ptoappend to - * the new format. - */ - assert(ptoappend != NULL); - assert(ntoappend >= 0); - if (ntoappend == 0) - continue; - while (usednew + ntoappend > totalnew) { - size_t bigger = totalnew << 1; - if ((bigger >> 1) != totalnew) { /* overflow */ - PyErr_NoMemory(); - goto Done; - } - if (_PyString_Resize(&newfmt, bigger) < 0) - goto Done; - totalnew = bigger; - pnew = PyString_AsString(newfmt) + usednew; - } - memcpy(pnew, ptoappend, ntoappend); - pnew += ntoappend; - usednew += ntoappend; - assert(usednew <= totalnew); - } /* end while() */ - - if (_PyString_Resize(&newfmt, usednew) < 0) - goto Done; - { - PyObject *time = PyImport_ImportModuleNoBlock("time"); - if (time == NULL) - goto Done; - result = PyObject_CallMethod(time, "strftime", "OO", - newfmt, timetuple); - Py_DECREF(time); - } - Done: - Py_XDECREF(freplacement); - Py_XDECREF(zreplacement); - Py_XDECREF(Zreplacement); - Py_XDECREF(newfmt); - return result; -} - -static char * -isoformat_date(PyDateTime_Date *dt, char buffer[], int bufflen) -{ - int x; - x = PyOS_snprintf(buffer, bufflen, - "%04d-%02d-%02d", - GET_YEAR(dt), GET_MONTH(dt), GET_DAY(dt)); - assert(bufflen >= x); - return buffer + x; -} - -static char * -isoformat_time(PyDateTime_DateTime *dt, char buffer[], int bufflen) -{ - int x; - int us = DATE_GET_MICROSECOND(dt); - - x = PyOS_snprintf(buffer, bufflen, - "%02d:%02d:%02d", - DATE_GET_HOUR(dt), - DATE_GET_MINUTE(dt), - DATE_GET_SECOND(dt)); - assert(bufflen >= x); - if (us) - x += PyOS_snprintf(buffer + x, bufflen - x, ".%06d", us); - assert(bufflen >= x); - return buffer + x; -} - -/* --------------------------------------------------------------------------- - * Wrap functions from the time module. These aren't directly available - * from C. Perhaps they should be. - */ - -/* Call time.time() and return its result (a Python float). */ -static PyObject * -time_time(void) -{ - PyObject *result = NULL; - PyObject *time = PyImport_ImportModuleNoBlock("time"); - - if (time != NULL) { - result = PyObject_CallMethod(time, "time", "()"); - Py_DECREF(time); - } - return result; -} - -/* Build a time.struct_time. The weekday and day number are automatically - * computed from the y,m,d args. - */ -static PyObject * -build_struct_time(int y, int m, int d, int hh, int mm, int ss, int dstflag) -{ - PyObject *time; - PyObject *result = NULL; - - time = PyImport_ImportModuleNoBlock("time"); - if (time != NULL) { - result = PyObject_CallMethod(time, "struct_time", - "((iiiiiiiii))", - y, m, d, - hh, mm, ss, - weekday(y, m, d), - days_before_month(y, m) + d, - dstflag); - Py_DECREF(time); - } - return result; -} - -/* --------------------------------------------------------------------------- - * Miscellaneous helpers. - */ - -/* For obscure reasons, we need to use tp_richcompare instead of tp_compare. - * The comparisons here all most naturally compute a cmp()-like result. - * This little helper turns that into a bool result for rich comparisons. - */ -static PyObject * -diff_to_bool(int diff, int op) -{ - PyObject *result; - int istrue; - - switch (op) { - case Py_EQ: istrue = diff == 0; break; - case Py_NE: istrue = diff != 0; break; - case Py_LE: istrue = diff <= 0; break; - case Py_GE: istrue = diff >= 0; break; - case Py_LT: istrue = diff < 0; break; - case Py_GT: istrue = diff > 0; break; - default: - assert(! "op unknown"); - istrue = 0; /* To shut up compiler */ - } - result = istrue ? Py_True : Py_False; - Py_INCREF(result); - return result; -} - -/* Raises a "can't compare" TypeError and returns NULL. */ -static PyObject * -cmperror(PyObject *a, PyObject *b) -{ - PyErr_Format(PyExc_TypeError, - "can't compare %s to %s", - Py_TYPE(a)->tp_name, Py_TYPE(b)->tp_name); - return NULL; -} - -/* --------------------------------------------------------------------------- - * Cached Python objects; these are set by the module init function. - */ - -/* Conversion factors. */ -static PyObject *us_per_us = NULL; /* 1 */ -static PyObject *us_per_ms = NULL; /* 1000 */ -static PyObject *us_per_second = NULL; /* 1000000 */ -static PyObject *us_per_minute = NULL; /* 1e6 * 60 as Python int */ -static PyObject *us_per_hour = NULL; /* 1e6 * 3600 as Python long */ -static PyObject *us_per_day = NULL; /* 1e6 * 3600 * 24 as Python long */ -static PyObject *us_per_week = NULL; /* 1e6*3600*24*7 as Python long */ -static PyObject *seconds_per_day = NULL; /* 3600*24 as Python int */ - -/* --------------------------------------------------------------------------- - * Class implementations. - */ - -/* - * PyDateTime_Delta implementation. - */ - -/* Convert a timedelta to a number of us, - * (24*3600*self.days + self.seconds)*1000000 + self.microseconds - * as a Python int or long. - * Doing mixed-radix arithmetic by hand instead is excruciating in C, - * due to ubiquitous overflow possibilities. - */ -static PyObject * -delta_to_microseconds(PyDateTime_Delta *self) -{ - PyObject *x1 = NULL; - PyObject *x2 = NULL; - PyObject *x3 = NULL; - PyObject *result = NULL; - - x1 = PyInt_FromLong(GET_TD_DAYS(self)); - if (x1 == NULL) - goto Done; - x2 = PyNumber_Multiply(x1, seconds_per_day); /* days in seconds */ - if (x2 == NULL) - goto Done; - Py_DECREF(x1); - x1 = NULL; - - /* x2 has days in seconds */ - x1 = PyInt_FromLong(GET_TD_SECONDS(self)); /* seconds */ - if (x1 == NULL) - goto Done; - x3 = PyNumber_Add(x1, x2); /* days and seconds in seconds */ - if (x3 == NULL) - goto Done; - Py_DECREF(x1); - Py_DECREF(x2); - x2 = NULL; - - /* x3 has days+seconds in seconds */ - x1 = PyNumber_Multiply(x3, us_per_second); /* us */ - if (x1 == NULL) - goto Done; - Py_DECREF(x3); - x3 = NULL; - - /* x1 has days+seconds in us */ - x2 = PyInt_FromLong(GET_TD_MICROSECONDS(self)); - if (x2 == NULL) - goto Done; - result = PyNumber_Add(x1, x2); - -Done: - Py_XDECREF(x1); - Py_XDECREF(x2); - Py_XDECREF(x3); - return result; -} - -/* Convert a number of us (as a Python int or long) to a timedelta. - */ -static PyObject * -microseconds_to_delta_ex(PyObject *pyus, PyTypeObject *type) -{ - int us; - int s; - int d; - long temp; - - PyObject *tuple = NULL; - PyObject *num = NULL; - PyObject *result = NULL; - - tuple = PyNumber_Divmod(pyus, us_per_second); - if (tuple == NULL) - goto Done; - - num = PyTuple_GetItem(tuple, 1); /* us */ - if (num == NULL) - goto Done; - temp = PyLong_AsLong(num); - num = NULL; - if (temp == -1 && PyErr_Occurred()) - goto Done; - assert(0 <= temp && temp < 1000000); - us = (int)temp; - if (us < 0) { - /* The divisor was positive, so this must be an error. */ - assert(PyErr_Occurred()); - goto Done; - } - - num = PyTuple_GetItem(tuple, 0); /* leftover seconds */ - if (num == NULL) - goto Done; - Py_INCREF(num); - Py_DECREF(tuple); - - tuple = PyNumber_Divmod(num, seconds_per_day); - if (tuple == NULL) - goto Done; - Py_DECREF(num); - - num = PyTuple_GetItem(tuple, 1); /* seconds */ - if (num == NULL) - goto Done; - temp = PyLong_AsLong(num); - num = NULL; - if (temp == -1 && PyErr_Occurred()) - goto Done; - assert(0 <= temp && temp < 24*3600); - s = (int)temp; - - if (s < 0) { - /* The divisor was positive, so this must be an error. */ - assert(PyErr_Occurred()); - goto Done; - } - - num = PyTuple_GetItem(tuple, 0); /* leftover days */ - if (num == NULL) - goto Done; - Py_INCREF(num); - temp = PyLong_AsLong(num); - if (temp == -1 && PyErr_Occurred()) - goto Done; - d = (int)temp; - if ((long)d != temp) { - PyErr_SetString(PyExc_OverflowError, "normalized days too " - "large to fit in a C int"); - goto Done; - } - result = new_delta_ex(d, s, us, 0, type); - -Done: - Py_XDECREF(tuple); - Py_XDECREF(num); - return result; -} - -#define microseconds_to_delta(pymicros) \ - microseconds_to_delta_ex(pymicros, &PyDateTime_DeltaType) - -static PyObject * -multiply_int_timedelta(PyObject *intobj, PyDateTime_Delta *delta) -{ - PyObject *pyus_in; - PyObject *pyus_out; - PyObject *result; - - pyus_in = delta_to_microseconds(delta); - if (pyus_in == NULL) - return NULL; - - pyus_out = PyNumber_Multiply(pyus_in, intobj); - Py_DECREF(pyus_in); - if (pyus_out == NULL) - return NULL; - - result = microseconds_to_delta(pyus_out); - Py_DECREF(pyus_out); - return result; -} - -static PyObject * -divide_timedelta_int(PyDateTime_Delta *delta, PyObject *intobj) -{ - PyObject *pyus_in; - PyObject *pyus_out; - PyObject *result; - - pyus_in = delta_to_microseconds(delta); - if (pyus_in == NULL) - return NULL; - - pyus_out = PyNumber_FloorDivide(pyus_in, intobj); - Py_DECREF(pyus_in); - if (pyus_out == NULL) - return NULL; - - result = microseconds_to_delta(pyus_out); - Py_DECREF(pyus_out); - return result; -} - -static PyObject * -delta_add(PyObject *left, PyObject *right) -{ - PyObject *result = Py_NotImplemented; - - if (PyDelta_Check(left) && PyDelta_Check(right)) { - /* delta + delta */ - /* The C-level additions can't overflow because of the - * invariant bounds. - */ - int days = GET_TD_DAYS(left) + GET_TD_DAYS(right); - int seconds = GET_TD_SECONDS(left) + GET_TD_SECONDS(right); - int microseconds = GET_TD_MICROSECONDS(left) + - GET_TD_MICROSECONDS(right); - result = new_delta(days, seconds, microseconds, 1); - } - - if (result == Py_NotImplemented) - Py_INCREF(result); - return result; -} - -static PyObject * -delta_negative(PyDateTime_Delta *self) -{ - return new_delta(-GET_TD_DAYS(self), - -GET_TD_SECONDS(self), - -GET_TD_MICROSECONDS(self), - 1); -} - -static PyObject * -delta_positive(PyDateTime_Delta *self) -{ - /* Could optimize this (by returning self) if this isn't a - * subclass -- but who uses unary + ? Approximately nobody. - */ - return new_delta(GET_TD_DAYS(self), - GET_TD_SECONDS(self), - GET_TD_MICROSECONDS(self), - 0); -} - -static PyObject * -delta_abs(PyDateTime_Delta *self) -{ - PyObject *result; - - assert(GET_TD_MICROSECONDS(self) >= 0); - assert(GET_TD_SECONDS(self) >= 0); - - if (GET_TD_DAYS(self) < 0) - result = delta_negative(self); - else - result = delta_positive(self); - - return result; -} - -static PyObject * -delta_subtract(PyObject *left, PyObject *right) -{ - PyObject *result = Py_NotImplemented; - - if (PyDelta_Check(left) && PyDelta_Check(right)) { - /* delta - delta */ - /* The C-level additions can't overflow because of the - * invariant bounds. - */ - int days = GET_TD_DAYS(left) - GET_TD_DAYS(right); - int seconds = GET_TD_SECONDS(left) - GET_TD_SECONDS(right); - int microseconds = GET_TD_MICROSECONDS(left) - - GET_TD_MICROSECONDS(right); - result = new_delta(days, seconds, microseconds, 1); - } - - if (result == Py_NotImplemented) - Py_INCREF(result); - return result; -} - -/* This is more natural as a tp_compare, but doesn't work then: for whatever - * reason, Python's try_3way_compare ignores tp_compare unless - * PyInstance_Check returns true, but these aren't old-style classes. - */ -static PyObject * -delta_richcompare(PyDateTime_Delta *self, PyObject *other, int op) -{ - int diff = 42; /* nonsense */ - - if (PyDelta_Check(other)) { - diff = GET_TD_DAYS(self) - GET_TD_DAYS(other); - if (diff == 0) { - diff = GET_TD_SECONDS(self) - GET_TD_SECONDS(other); - if (diff == 0) - diff = GET_TD_MICROSECONDS(self) - - GET_TD_MICROSECONDS(other); - } - } - else if (op == Py_EQ || op == Py_NE) - diff = 1; /* any non-zero value will do */ - - else /* stop this from falling back to address comparison */ - return cmperror((PyObject *)self, other); - - return diff_to_bool(diff, op); -} - -static PyObject *delta_getstate(PyDateTime_Delta *self); - -static long -delta_hash(PyDateTime_Delta *self) -{ - if (self->hashcode == -1) { - PyObject *temp = delta_getstate(self); - if (temp != NULL) { - self->hashcode = PyObject_Hash(temp); - Py_DECREF(temp); - } - } - return self->hashcode; -} - -static PyObject * -delta_multiply(PyObject *left, PyObject *right) -{ - PyObject *result = Py_NotImplemented; - - if (PyDelta_Check(left)) { - /* delta * ??? */ - if (PyInt_Check(right) || PyLong_Check(right)) - result = multiply_int_timedelta(right, - (PyDateTime_Delta *) left); - } - else if (PyInt_Check(left) || PyLong_Check(left)) - result = multiply_int_timedelta(left, - (PyDateTime_Delta *) right); - - if (result == Py_NotImplemented) - Py_INCREF(result); - return result; -} - -static PyObject * -delta_divide(PyObject *left, PyObject *right) -{ - PyObject *result = Py_NotImplemented; - - if (PyDelta_Check(left)) { - /* delta * ??? */ - if (PyInt_Check(right) || PyLong_Check(right)) - result = divide_timedelta_int( - (PyDateTime_Delta *)left, - right); - } - - if (result == Py_NotImplemented) - Py_INCREF(result); - return result; -} - -/* Fold in the value of the tag ("seconds", "weeks", etc) component of a - * timedelta constructor. sofar is the # of microseconds accounted for - * so far, and there are factor microseconds per current unit, the number - * of which is given by num. num * factor is added to sofar in a - * numerically careful way, and that's the result. Any fractional - * microseconds left over (this can happen if num is a float type) are - * added into *leftover. - * Note that there are many ways this can give an error (NULL) return. - */ -static PyObject * -accum(const char* tag, PyObject *sofar, PyObject *num, PyObject *factor, - double *leftover) -{ - PyObject *prod; - PyObject *sum; - - assert(num != NULL); - - if (PyInt_Check(num) || PyLong_Check(num)) { - prod = PyNumber_Multiply(num, factor); - if (prod == NULL) - return NULL; - sum = PyNumber_Add(sofar, prod); - Py_DECREF(prod); - return sum; - } - - if (PyFloat_Check(num)) { - double dnum; - double fracpart; - double intpart; - PyObject *x; - PyObject *y; - - /* The Plan: decompose num into an integer part and a - * fractional part, num = intpart + fracpart. - * Then num * factor == - * intpart * factor + fracpart * factor - * and the LHS can be computed exactly in long arithmetic. - * The RHS is again broken into an int part and frac part. - * and the frac part is added into *leftover. - */ - dnum = PyFloat_AsDouble(num); - if (dnum == -1.0 && PyErr_Occurred()) - return NULL; - fracpart = modf(dnum, &intpart); - x = PyLong_FromDouble(intpart); - if (x == NULL) - return NULL; - - prod = PyNumber_Multiply(x, factor); - Py_DECREF(x); - if (prod == NULL) - return NULL; - - sum = PyNumber_Add(sofar, prod); - Py_DECREF(prod); - if (sum == NULL) - return NULL; - - if (fracpart == 0.0) - return sum; - /* So far we've lost no information. Dealing with the - * fractional part requires float arithmetic, and may - * lose a little info. - */ - assert(PyInt_Check(factor) || PyLong_Check(factor)); - if (PyInt_Check(factor)) - dnum = (double)PyInt_AsLong(factor); - else - dnum = PyLong_AsDouble(factor); - - dnum *= fracpart; - fracpart = modf(dnum, &intpart); - x = PyLong_FromDouble(intpart); - if (x == NULL) { - Py_DECREF(sum); - return NULL; - } - - y = PyNumber_Add(sum, x); - Py_DECREF(sum); - Py_DECREF(x); - *leftover += fracpart; - return y; - } - - PyErr_Format(PyExc_TypeError, - "unsupported type for timedelta %s component: %s", - tag, Py_TYPE(num)->tp_name); - return NULL; -} - -static PyObject * -delta_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *self = NULL; - - /* Argument objects. */ - PyObject *day = NULL; - PyObject *second = NULL; - PyObject *us = NULL; - PyObject *ms = NULL; - PyObject *minute = NULL; - PyObject *hour = NULL; - PyObject *week = NULL; - - PyObject *x = NULL; /* running sum of microseconds */ - PyObject *y = NULL; /* temp sum of microseconds */ - double leftover_us = 0.0; - - static char *keywords[] = { - "days", "seconds", "microseconds", "milliseconds", - "minutes", "hours", "weeks", NULL - }; - - if (PyArg_ParseTupleAndKeywords(args, kw, "|OOOOOOO:__new__", - keywords, - &day, &second, &us, - &ms, &minute, &hour, &week) == 0) - goto Done; - - x = PyInt_FromLong(0); - if (x == NULL) - goto Done; - -#define CLEANUP \ - Py_DECREF(x); \ - x = y; \ - if (x == NULL) \ - goto Done - - if (us) { - y = accum("microseconds", x, us, us_per_us, &leftover_us); - CLEANUP; - } - if (ms) { - y = accum("milliseconds", x, ms, us_per_ms, &leftover_us); - CLEANUP; - } - if (second) { - y = accum("seconds", x, second, us_per_second, &leftover_us); - CLEANUP; - } - if (minute) { - y = accum("minutes", x, minute, us_per_minute, &leftover_us); - CLEANUP; - } - if (hour) { - y = accum("hours", x, hour, us_per_hour, &leftover_us); - CLEANUP; - } - if (day) { - y = accum("days", x, day, us_per_day, &leftover_us); - CLEANUP; - } - if (week) { - y = accum("weeks", x, week, us_per_week, &leftover_us); - CLEANUP; - } - if (leftover_us) { - /* Round to nearest whole # of us, and add into x. */ - PyObject *temp = PyLong_FromLong(round_to_long(leftover_us)); - if (temp == NULL) { - Py_DECREF(x); - goto Done; - } - y = PyNumber_Add(x, temp); - Py_DECREF(temp); - CLEANUP; - } - - self = microseconds_to_delta_ex(x, type); - Py_DECREF(x); -Done: - return self; - -#undef CLEANUP -} - -static int -delta_nonzero(PyDateTime_Delta *self) -{ - return (GET_TD_DAYS(self) != 0 - || GET_TD_SECONDS(self) != 0 - || GET_TD_MICROSECONDS(self) != 0); -} - -static PyObject * -delta_repr(PyDateTime_Delta *self) -{ - if (GET_TD_MICROSECONDS(self) != 0) - return PyString_FromFormat("%s(%d, %d, %d)", - Py_TYPE(self)->tp_name, - GET_TD_DAYS(self), - GET_TD_SECONDS(self), - GET_TD_MICROSECONDS(self)); - if (GET_TD_SECONDS(self) != 0) - return PyString_FromFormat("%s(%d, %d)", - Py_TYPE(self)->tp_name, - GET_TD_DAYS(self), - GET_TD_SECONDS(self)); - - return PyString_FromFormat("%s(%d)", - Py_TYPE(self)->tp_name, - GET_TD_DAYS(self)); -} - -static PyObject * -delta_str(PyDateTime_Delta *self) -{ - int days = GET_TD_DAYS(self); - int seconds = GET_TD_SECONDS(self); - int us = GET_TD_MICROSECONDS(self); - int hours; - int minutes; - char buf[100]; - char *pbuf = buf; - size_t buflen = sizeof(buf); - int n; - - minutes = divmod(seconds, 60, &seconds); - hours = divmod(minutes, 60, &minutes); - - if (days) { - n = PyOS_snprintf(pbuf, buflen, "%d day%s, ", days, - (days == 1 || days == -1) ? "" : "s"); - if (n < 0 || (size_t)n >= buflen) - goto Fail; - pbuf += n; - buflen -= (size_t)n; - } - - n = PyOS_snprintf(pbuf, buflen, "%d:%02d:%02d", - hours, minutes, seconds); - if (n < 0 || (size_t)n >= buflen) - goto Fail; - pbuf += n; - buflen -= (size_t)n; - - if (us) { - n = PyOS_snprintf(pbuf, buflen, ".%06d", us); - if (n < 0 || (size_t)n >= buflen) - goto Fail; - pbuf += n; - } - - return PyString_FromStringAndSize(buf, pbuf - buf); - - Fail: - PyErr_SetString(PyExc_SystemError, "goofy result from PyOS_snprintf"); - return NULL; -} - -/* Pickle support, a simple use of __reduce__. */ - -/* __getstate__ isn't exposed */ -static PyObject * -delta_getstate(PyDateTime_Delta *self) -{ - return Py_BuildValue("iii", GET_TD_DAYS(self), - GET_TD_SECONDS(self), - GET_TD_MICROSECONDS(self)); -} - -static PyObject * -delta_total_seconds(PyObject *self) -{ - PyObject *total_seconds; - PyObject *total_microseconds; - PyObject *one_million; - - total_microseconds = delta_to_microseconds((PyDateTime_Delta *)self); - if (total_microseconds == NULL) - return NULL; - - one_million = PyLong_FromLong(1000000L); - if (one_million == NULL) { - Py_DECREF(total_microseconds); - return NULL; - } - - total_seconds = PyNumber_TrueDivide(total_microseconds, one_million); - - Py_DECREF(total_microseconds); - Py_DECREF(one_million); - return total_seconds; -} - -static PyObject * -delta_reduce(PyDateTime_Delta* self) -{ - return Py_BuildValue("ON", Py_TYPE(self), delta_getstate(self)); -} - -#define OFFSET(field) offsetof(PyDateTime_Delta, field) - -static PyMemberDef delta_members[] = { - - {"days", T_INT, OFFSET(days), READONLY, - PyDoc_STR("Number of days.")}, - - {"seconds", T_INT, OFFSET(seconds), READONLY, - PyDoc_STR("Number of seconds (>= 0 and less than 1 day).")}, - - {"microseconds", T_INT, OFFSET(microseconds), READONLY, - PyDoc_STR("Number of microseconds (>= 0 and less than 1 second).")}, - {NULL} -}; - -static PyMethodDef delta_methods[] = { - {"total_seconds", (PyCFunction)delta_total_seconds, METH_NOARGS, - PyDoc_STR("Total seconds in the duration.")}, - - {"__reduce__", (PyCFunction)delta_reduce, METH_NOARGS, - PyDoc_STR("__reduce__() -> (cls, state)")}, - - {NULL, NULL}, -}; - -static char delta_doc[] = -PyDoc_STR("Difference between two datetime values."); - -static PyNumberMethods delta_as_number = { - delta_add, /* nb_add */ - delta_subtract, /* nb_subtract */ - delta_multiply, /* nb_multiply */ - delta_divide, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - (unaryfunc)delta_negative, /* nb_negative */ - (unaryfunc)delta_positive, /* nb_positive */ - (unaryfunc)delta_abs, /* nb_absolute */ - (inquiry)delta_nonzero, /* nb_nonzero */ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - 0, /*nb_coerce*/ - 0, /*nb_int*/ - 0, /*nb_long*/ - 0, /*nb_float*/ - 0, /*nb_oct*/ - 0, /*nb_hex*/ - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - 0, /*nb_inplace_divide*/ - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - delta_divide, /* nb_floor_divide */ - 0, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ -}; - -static PyTypeObject PyDateTime_DeltaType = { - PyVarObject_HEAD_INIT(NULL, 0) - "datetime.timedelta", /* tp_name */ - sizeof(PyDateTime_Delta), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)delta_repr, /* tp_repr */ - &delta_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)delta_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)delta_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - delta_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)delta_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - delta_methods, /* tp_methods */ - delta_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - delta_new, /* tp_new */ - 0, /* tp_free */ -}; - -/* - * PyDateTime_Date implementation. - */ - -/* Accessor properties. */ - -static PyObject * -date_year(PyDateTime_Date *self, void *unused) -{ - return PyInt_FromLong(GET_YEAR(self)); -} - -static PyObject * -date_month(PyDateTime_Date *self, void *unused) -{ - return PyInt_FromLong(GET_MONTH(self)); -} - -static PyObject * -date_day(PyDateTime_Date *self, void *unused) -{ - return PyInt_FromLong(GET_DAY(self)); -} - -static PyGetSetDef date_getset[] = { - {"year", (getter)date_year}, - {"month", (getter)date_month}, - {"day", (getter)date_day}, - {NULL} -}; - -/* Constructors. */ - -static char *date_kws[] = {"year", "month", "day", NULL}; - -static PyObject * -date_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *self = NULL; - PyObject *state; - int year; - int month; - int day; - - /* Check for invocation from pickle with __getstate__ state */ - if (PyTuple_GET_SIZE(args) == 1 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_DATE_DATASIZE && - MONTH_IS_SANE(PyString_AS_STRING(state)[2])) - { - PyDateTime_Date *me; - - me = (PyDateTime_Date *) (type->tp_alloc(type, 0)); - if (me != NULL) { - char *pdata = PyString_AS_STRING(state); - memcpy(me->data, pdata, _PyDateTime_DATE_DATASIZE); - me->hashcode = -1; - } - return (PyObject *)me; - } - - if (PyArg_ParseTupleAndKeywords(args, kw, "iii", date_kws, - &year, &month, &day)) { - if (check_date_args(year, month, day) < 0) - return NULL; - self = new_date_ex(year, month, day, type); - } - return self; -} - -/* Return new date from localtime(t). */ -static PyObject * -date_local_from_time_t(PyObject *cls, double ts) -{ - struct tm *tm; - time_t t; - PyObject *result = NULL; - - t = _PyTime_DoubleToTimet(ts); - if (t == (time_t)-1 && PyErr_Occurred()) - return NULL; - tm = localtime(&t); - if (tm) - result = PyObject_CallFunction(cls, "iii", - tm->tm_year + 1900, - tm->tm_mon + 1, - tm->tm_mday); - else - PyErr_SetString(PyExc_ValueError, - "timestamp out of range for " - "platform localtime() function"); - return result; -} - -/* Return new date from current time. - * We say this is equivalent to fromtimestamp(time.time()), and the - * only way to be sure of that is to *call* time.time(). That's not - * generally the same as calling C's time. - */ -static PyObject * -date_today(PyObject *cls, PyObject *dummy) -{ - PyObject *time; - PyObject *result; - - time = time_time(); - if (time == NULL) - return NULL; - - /* Note well: today() is a class method, so this may not call - * date.fromtimestamp. For example, it may call - * datetime.fromtimestamp. That's why we need all the accuracy - * time.time() delivers; if someone were gonzo about optimization, - * date.today() could get away with plain C time(). - */ - result = PyObject_CallMethod(cls, "fromtimestamp", "O", time); - Py_DECREF(time); - return result; -} - -/* Return new date from given timestamp (Python timestamp -- a double). */ -static PyObject * -date_fromtimestamp(PyObject *cls, PyObject *args) -{ - double timestamp; - PyObject *result = NULL; - - if (PyArg_ParseTuple(args, "d:fromtimestamp", ×tamp)) - result = date_local_from_time_t(cls, timestamp); - return result; -} - -/* Return new date from proleptic Gregorian ordinal. Raises ValueError if - * the ordinal is out of range. - */ -static PyObject * -date_fromordinal(PyObject *cls, PyObject *args) -{ - PyObject *result = NULL; - int ordinal; - - if (PyArg_ParseTuple(args, "i:fromordinal", &ordinal)) { - int year; - int month; - int day; - - if (ordinal < 1) - PyErr_SetString(PyExc_ValueError, "ordinal must be " - ">= 1"); - else { - ord_to_ymd(ordinal, &year, &month, &day); - result = PyObject_CallFunction(cls, "iii", - year, month, day); - } - } - return result; -} - -/* - * Date arithmetic. - */ - -/* date + timedelta -> date. If arg negate is true, subtract the timedelta - * instead. - */ -static PyObject * -add_date_timedelta(PyDateTime_Date *date, PyDateTime_Delta *delta, int negate) -{ - PyObject *result = NULL; - int year = GET_YEAR(date); - int month = GET_MONTH(date); - int deltadays = GET_TD_DAYS(delta); - /* C-level overflow is impossible because |deltadays| < 1e9. */ - int day = GET_DAY(date) + (negate ? -deltadays : deltadays); - - if (normalize_date(&year, &month, &day) >= 0) - result = new_date(year, month, day); - return result; -} - -static PyObject * -date_add(PyObject *left, PyObject *right) -{ - if (PyDateTime_Check(left) || PyDateTime_Check(right)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - if (PyDate_Check(left)) { - /* date + ??? */ - if (PyDelta_Check(right)) - /* date + delta */ - return add_date_timedelta((PyDateTime_Date *) left, - (PyDateTime_Delta *) right, - 0); - } - else { - /* ??? + date - * 'right' must be one of us, or we wouldn't have been called - */ - if (PyDelta_Check(left)) - /* delta + date */ - return add_date_timedelta((PyDateTime_Date *) right, - (PyDateTime_Delta *) left, - 0); - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static PyObject * -date_subtract(PyObject *left, PyObject *right) -{ - if (PyDateTime_Check(left) || PyDateTime_Check(right)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - if (PyDate_Check(left)) { - if (PyDate_Check(right)) { - /* date - date */ - int left_ord = ymd_to_ord(GET_YEAR(left), - GET_MONTH(left), - GET_DAY(left)); - int right_ord = ymd_to_ord(GET_YEAR(right), - GET_MONTH(right), - GET_DAY(right)); - return new_delta(left_ord - right_ord, 0, 0, 0); - } - if (PyDelta_Check(right)) { - /* date - delta */ - return add_date_timedelta((PyDateTime_Date *) left, - (PyDateTime_Delta *) right, - 1); - } - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -/* Various ways to turn a date into a string. */ - -static PyObject * -date_repr(PyDateTime_Date *self) -{ - char buffer[1028]; - const char *type_name; - - type_name = Py_TYPE(self)->tp_name; - PyOS_snprintf(buffer, sizeof(buffer), "%s(%d, %d, %d)", - type_name, - GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - - return PyString_FromString(buffer); -} - -static PyObject * -date_isoformat(PyDateTime_Date *self) -{ - char buffer[128]; - - isoformat_date(self, buffer, sizeof(buffer)); - return PyString_FromString(buffer); -} - -/* str() calls the appropriate isoformat() method. */ -static PyObject * -date_str(PyDateTime_Date *self) -{ - return PyObject_CallMethod((PyObject *)self, "isoformat", "()"); -} - - -static PyObject * -date_ctime(PyDateTime_Date *self) -{ - return format_ctime(self, 0, 0, 0); -} - -static PyObject * -date_strftime(PyDateTime_Date *self, PyObject *args, PyObject *kw) -{ - /* This method can be inherited, and needs to call the - * timetuple() method appropriate to self's class. - */ - PyObject *result; - PyObject *tuple; - const char *format; - Py_ssize_t format_len; - static char *keywords[] = {"format", NULL}; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, - &format, &format_len)) - return NULL; - - tuple = PyObject_CallMethod((PyObject *)self, "timetuple", "()"); - if (tuple == NULL) - return NULL; - result = wrap_strftime((PyObject *)self, format, format_len, tuple, - (PyObject *)self); - Py_DECREF(tuple); - return result; -} - -static PyObject * -date_format(PyDateTime_Date *self, PyObject *args) -{ - PyObject *format; - - if (!PyArg_ParseTuple(args, "O:__format__", &format)) - return NULL; - - /* Check for str or unicode */ - if (PyString_Check(format)) { - /* If format is zero length, return str(self) */ - if (PyString_GET_SIZE(format) == 0) - return PyObject_Str((PyObject *)self); - } else if (PyUnicode_Check(format)) { - /* If format is zero length, return str(self) */ - if (PyUnicode_GET_SIZE(format) == 0) - return PyObject_Unicode((PyObject *)self); - } else { - PyErr_Format(PyExc_ValueError, - "__format__ expects str or unicode, not %.200s", - Py_TYPE(format)->tp_name); - return NULL; - } - return PyObject_CallMethod((PyObject *)self, "strftime", "O", format); -} - -/* ISO methods. */ - -static PyObject * -date_isoweekday(PyDateTime_Date *self) -{ - int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - - return PyInt_FromLong(dow + 1); -} - -static PyObject * -date_isocalendar(PyDateTime_Date *self) -{ - int year = GET_YEAR(self); - int week1_monday = iso_week1_monday(year); - int today = ymd_to_ord(year, GET_MONTH(self), GET_DAY(self)); - int week; - int day; - - week = divmod(today - week1_monday, 7, &day); - if (week < 0) { - --year; - week1_monday = iso_week1_monday(year); - week = divmod(today - week1_monday, 7, &day); - } - else if (week >= 52 && today >= iso_week1_monday(year + 1)) { - ++year; - week = 0; - } - return Py_BuildValue("iii", year, week + 1, day + 1); -} - -/* Miscellaneous methods. */ - -/* This is more natural as a tp_compare, but doesn't work then: for whatever - * reason, Python's try_3way_compare ignores tp_compare unless - * PyInstance_Check returns true, but these aren't old-style classes. - */ -static PyObject * -date_richcompare(PyDateTime_Date *self, PyObject *other, int op) -{ - int diff = 42; /* nonsense */ - - if (PyDate_Check(other)) - diff = memcmp(self->data, ((PyDateTime_Date *)other)->data, - _PyDateTime_DATE_DATASIZE); - - else if (PyObject_HasAttrString(other, "timetuple")) { - /* A hook for other kinds of date objects. */ - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - else if (op == Py_EQ || op == Py_NE) - diff = 1; /* any non-zero value will do */ - - else /* stop this from falling back to address comparison */ - return cmperror((PyObject *)self, other); - - return diff_to_bool(diff, op); -} - -static PyObject * -date_timetuple(PyDateTime_Date *self) -{ - return build_struct_time(GET_YEAR(self), - GET_MONTH(self), - GET_DAY(self), - 0, 0, 0, -1); -} - -static PyObject * -date_replace(PyDateTime_Date *self, PyObject *args, PyObject *kw) -{ - PyObject *clone; - PyObject *tuple; - int year = GET_YEAR(self); - int month = GET_MONTH(self); - int day = GET_DAY(self); - - if (! PyArg_ParseTupleAndKeywords(args, kw, "|iii:replace", date_kws, - &year, &month, &day)) - return NULL; - tuple = Py_BuildValue("iii", year, month, day); - if (tuple == NULL) - return NULL; - clone = date_new(Py_TYPE(self), tuple, NULL); - Py_DECREF(tuple); - return clone; -} - -static PyObject *date_getstate(PyDateTime_Date *self); - -static long -date_hash(PyDateTime_Date *self) -{ - if (self->hashcode == -1) { - PyObject *temp = date_getstate(self); - if (temp != NULL) { - self->hashcode = PyObject_Hash(temp); - Py_DECREF(temp); - } - } - return self->hashcode; -} - -static PyObject * -date_toordinal(PyDateTime_Date *self) -{ - return PyInt_FromLong(ymd_to_ord(GET_YEAR(self), GET_MONTH(self), - GET_DAY(self))); -} - -static PyObject * -date_weekday(PyDateTime_Date *self) -{ - int dow = weekday(GET_YEAR(self), GET_MONTH(self), GET_DAY(self)); - - return PyInt_FromLong(dow); -} - -/* Pickle support, a simple use of __reduce__. */ - -/* __getstate__ isn't exposed */ -static PyObject * -date_getstate(PyDateTime_Date *self) -{ - return Py_BuildValue( - "(N)", - PyString_FromStringAndSize((char *)self->data, - _PyDateTime_DATE_DATASIZE)); -} - -static PyObject * -date_reduce(PyDateTime_Date *self, PyObject *arg) -{ - return Py_BuildValue("(ON)", Py_TYPE(self), date_getstate(self)); -} - -static PyMethodDef date_methods[] = { - - /* Class methods: */ - - {"fromtimestamp", (PyCFunction)date_fromtimestamp, METH_VARARGS | - METH_CLASS, - PyDoc_STR("timestamp -> local date from a POSIX timestamp (like " - "time.time()).")}, - - {"fromordinal", (PyCFunction)date_fromordinal, METH_VARARGS | - METH_CLASS, - PyDoc_STR("int -> date corresponding to a proleptic Gregorian " - "ordinal.")}, - - {"today", (PyCFunction)date_today, METH_NOARGS | METH_CLASS, - PyDoc_STR("Current date or datetime: same as " - "self.__class__.fromtimestamp(time.time()).")}, - - /* Instance methods: */ - - {"ctime", (PyCFunction)date_ctime, METH_NOARGS, - PyDoc_STR("Return ctime() style string.")}, - - {"strftime", (PyCFunction)date_strftime, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("format -> strftime() style string.")}, - - {"__format__", (PyCFunction)date_format, METH_VARARGS, - PyDoc_STR("Formats self with strftime.")}, - - {"timetuple", (PyCFunction)date_timetuple, METH_NOARGS, - PyDoc_STR("Return time tuple, compatible with time.localtime().")}, - - {"isocalendar", (PyCFunction)date_isocalendar, METH_NOARGS, - PyDoc_STR("Return a 3-tuple containing ISO year, week number, and " - "weekday.")}, - - {"isoformat", (PyCFunction)date_isoformat, METH_NOARGS, - PyDoc_STR("Return string in ISO 8601 format, YYYY-MM-DD.")}, - - {"isoweekday", (PyCFunction)date_isoweekday, METH_NOARGS, - PyDoc_STR("Return the day of the week represented by the date.\n" - "Monday == 1 ... Sunday == 7")}, - - {"toordinal", (PyCFunction)date_toordinal, METH_NOARGS, - PyDoc_STR("Return proleptic Gregorian ordinal. January 1 of year " - "1 is day 1.")}, - - {"weekday", (PyCFunction)date_weekday, METH_NOARGS, - PyDoc_STR("Return the day of the week represented by the date.\n" - "Monday == 0 ... Sunday == 6")}, - - {"replace", (PyCFunction)date_replace, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("Return date with new specified fields.")}, - - {"__reduce__", (PyCFunction)date_reduce, METH_NOARGS, - PyDoc_STR("__reduce__() -> (cls, state)")}, - - {NULL, NULL} -}; - -static char date_doc[] = -PyDoc_STR("date(year, month, day) --> date object"); - -static PyNumberMethods date_as_number = { - date_add, /* nb_add */ - date_subtract, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - 0, /* nb_nonzero */ -}; - -static PyTypeObject PyDateTime_DateType = { - PyVarObject_HEAD_INIT(NULL, 0) - "datetime.date", /* tp_name */ - sizeof(PyDateTime_Date), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)date_repr, /* tp_repr */ - &date_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)date_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)date_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - date_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)date_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - date_methods, /* tp_methods */ - 0, /* tp_members */ - date_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - date_new, /* tp_new */ - 0, /* tp_free */ -}; - -/* - * PyDateTime_TZInfo implementation. - */ - -/* This is a pure abstract base class, so doesn't do anything beyond - * raising NotImplemented exceptions. Real tzinfo classes need - * to derive from this. This is mostly for clarity, and for efficiency in - * datetime and time constructors (their tzinfo arguments need to - * be subclasses of this tzinfo class, which is easy and quick to check). - * - * Note: For reasons having to do with pickling of subclasses, we have - * to allow tzinfo objects to be instantiated. This wasn't an issue - * in the Python implementation (__init__() could raise NotImplementedError - * there without ill effect), but doing so in the C implementation hit a - * brick wall. - */ - -static PyObject * -tzinfo_nogo(const char* methodname) -{ - PyErr_Format(PyExc_NotImplementedError, - "a tzinfo subclass must implement %s()", - methodname); - return NULL; -} - -/* Methods. A subclass must implement these. */ - -static PyObject * -tzinfo_tzname(PyDateTime_TZInfo *self, PyObject *dt) -{ - return tzinfo_nogo("tzname"); -} - -static PyObject * -tzinfo_utcoffset(PyDateTime_TZInfo *self, PyObject *dt) -{ - return tzinfo_nogo("utcoffset"); -} - -static PyObject * -tzinfo_dst(PyDateTime_TZInfo *self, PyObject *dt) -{ - return tzinfo_nogo("dst"); -} - -static PyObject * -tzinfo_fromutc(PyDateTime_TZInfo *self, PyDateTime_DateTime *dt) -{ - int y, m, d, hh, mm, ss, us; - - PyObject *result; - int off, dst; - int none; - int delta; - - if (! PyDateTime_Check(dt)) { - PyErr_SetString(PyExc_TypeError, - "fromutc: argument must be a datetime"); - return NULL; - } - if (! HASTZINFO(dt) || dt->tzinfo != (PyObject *)self) { - PyErr_SetString(PyExc_ValueError, "fromutc: dt.tzinfo " - "is not self"); - return NULL; - } - - off = call_utcoffset(dt->tzinfo, (PyObject *)dt, &none); - if (off == -1 && PyErr_Occurred()) - return NULL; - if (none) { - PyErr_SetString(PyExc_ValueError, "fromutc: non-None " - "utcoffset() result required"); - return NULL; - } - - dst = call_dst(dt->tzinfo, (PyObject *)dt, &none); - if (dst == -1 && PyErr_Occurred()) - return NULL; - if (none) { - PyErr_SetString(PyExc_ValueError, "fromutc: non-None " - "dst() result required"); - return NULL; - } - - y = GET_YEAR(dt); - m = GET_MONTH(dt); - d = GET_DAY(dt); - hh = DATE_GET_HOUR(dt); - mm = DATE_GET_MINUTE(dt); - ss = DATE_GET_SECOND(dt); - us = DATE_GET_MICROSECOND(dt); - - delta = off - dst; - mm += delta; - if ((mm < 0 || mm >= 60) && - normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us) < 0) - return NULL; - result = new_datetime(y, m, d, hh, mm, ss, us, dt->tzinfo); - if (result == NULL) - return result; - - dst = call_dst(dt->tzinfo, result, &none); - if (dst == -1 && PyErr_Occurred()) - goto Fail; - if (none) - goto Inconsistent; - if (dst == 0) - return result; - - mm += dst; - if ((mm < 0 || mm >= 60) && - normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us) < 0) - goto Fail; - Py_DECREF(result); - result = new_datetime(y, m, d, hh, mm, ss, us, dt->tzinfo); - return result; - -Inconsistent: - PyErr_SetString(PyExc_ValueError, "fromutc: tz.dst() gave" - "inconsistent results; cannot convert"); - - /* fall thru to failure */ -Fail: - Py_DECREF(result); - return NULL; -} - -/* - * Pickle support. This is solely so that tzinfo subclasses can use - * pickling -- tzinfo itself is supposed to be uninstantiable. - */ - -static PyObject * -tzinfo_reduce(PyObject *self) -{ - PyObject *args, *state, *tmp; - PyObject *getinitargs, *getstate; - - tmp = PyTuple_New(0); - if (tmp == NULL) - return NULL; - - getinitargs = PyObject_GetAttrString(self, "__getinitargs__"); - if (getinitargs != NULL) { - args = PyObject_CallObject(getinitargs, tmp); - Py_DECREF(getinitargs); - if (args == NULL) { - Py_DECREF(tmp); - return NULL; - } - } - else { - PyErr_Clear(); - args = tmp; - Py_INCREF(args); - } - - getstate = PyObject_GetAttrString(self, "__getstate__"); - if (getstate != NULL) { - state = PyObject_CallObject(getstate, tmp); - Py_DECREF(getstate); - if (state == NULL) { - Py_DECREF(args); - Py_DECREF(tmp); - return NULL; - } - } - else { - PyObject **dictptr; - PyErr_Clear(); - state = Py_None; - dictptr = _PyObject_GetDictPtr(self); - if (dictptr && *dictptr && PyDict_Size(*dictptr)) - state = *dictptr; - Py_INCREF(state); - } - - Py_DECREF(tmp); - - if (state == Py_None) { - Py_DECREF(state); - return Py_BuildValue("(ON)", Py_TYPE(self), args); - } - else - return Py_BuildValue("(ONN)", Py_TYPE(self), args, state); -} - -static PyMethodDef tzinfo_methods[] = { - - {"tzname", (PyCFunction)tzinfo_tzname, METH_O, - PyDoc_STR("datetime -> string name of time zone.")}, - - {"utcoffset", (PyCFunction)tzinfo_utcoffset, METH_O, - PyDoc_STR("datetime -> minutes east of UTC (negative for " - "west of UTC).")}, - - {"dst", (PyCFunction)tzinfo_dst, METH_O, - PyDoc_STR("datetime -> DST offset in minutes east of UTC.")}, - - {"fromutc", (PyCFunction)tzinfo_fromutc, METH_O, - PyDoc_STR("datetime in UTC -> datetime in local time.")}, - - {"__reduce__", (PyCFunction)tzinfo_reduce, METH_NOARGS, - PyDoc_STR("-> (cls, state)")}, - - {NULL, NULL} -}; - -static char tzinfo_doc[] = -PyDoc_STR("Abstract base class for time zone info objects."); - -statichere PyTypeObject PyDateTime_TZInfoType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "datetime.tzinfo", /* tp_name */ - sizeof(PyDateTime_TZInfo), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - tzinfo_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - tzinfo_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - 0, /* tp_free */ -}; - -/* - * PyDateTime_Time implementation. - */ - -/* Accessor properties. - */ - -static PyObject * -time_hour(PyDateTime_Time *self, void *unused) -{ - return PyInt_FromLong(TIME_GET_HOUR(self)); -} - -static PyObject * -time_minute(PyDateTime_Time *self, void *unused) -{ - return PyInt_FromLong(TIME_GET_MINUTE(self)); -} - -/* The name time_second conflicted with some platform header file. */ -static PyObject * -py_time_second(PyDateTime_Time *self, void *unused) -{ - return PyInt_FromLong(TIME_GET_SECOND(self)); -} - -static PyObject * -time_microsecond(PyDateTime_Time *self, void *unused) -{ - return PyInt_FromLong(TIME_GET_MICROSECOND(self)); -} - -static PyObject * -time_tzinfo(PyDateTime_Time *self, void *unused) -{ - PyObject *result = HASTZINFO(self) ? self->tzinfo : Py_None; - Py_INCREF(result); - return result; -} - -static PyGetSetDef time_getset[] = { - {"hour", (getter)time_hour}, - {"minute", (getter)time_minute}, - {"second", (getter)py_time_second}, - {"microsecond", (getter)time_microsecond}, - {"tzinfo", (getter)time_tzinfo}, - {NULL} -}; - -/* - * Constructors. - */ - -static char *time_kws[] = {"hour", "minute", "second", "microsecond", - "tzinfo", NULL}; - -static PyObject * -time_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *self = NULL; - PyObject *state; - int hour = 0; - int minute = 0; - int second = 0; - int usecond = 0; - PyObject *tzinfo = Py_None; - - /* Check for invocation from pickle with __getstate__ state */ - if (PyTuple_GET_SIZE(args) >= 1 && - PyTuple_GET_SIZE(args) <= 2 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_TIME_DATASIZE && - ((unsigned char) (PyString_AS_STRING(state)[0])) < 24) - { - PyDateTime_Time *me; - char aware; - - if (PyTuple_GET_SIZE(args) == 2) { - tzinfo = PyTuple_GET_ITEM(args, 1); - if (check_tzinfo_subclass(tzinfo) < 0) { - PyErr_SetString(PyExc_TypeError, "bad " - "tzinfo state arg"); - return NULL; - } - } - aware = (char)(tzinfo != Py_None); - me = (PyDateTime_Time *) (type->tp_alloc(type, aware)); - if (me != NULL) { - char *pdata = PyString_AS_STRING(state); - - memcpy(me->data, pdata, _PyDateTime_TIME_DATASIZE); - me->hashcode = -1; - me->hastzinfo = aware; - if (aware) { - Py_INCREF(tzinfo); - me->tzinfo = tzinfo; - } - } - return (PyObject *)me; - } - - if (PyArg_ParseTupleAndKeywords(args, kw, "|iiiiO", time_kws, - &hour, &minute, &second, &usecond, - &tzinfo)) { - if (check_time_args(hour, minute, second, usecond) < 0) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; - self = new_time_ex(hour, minute, second, usecond, tzinfo, - type); - } - return self; -} - -/* - * Destructor. - */ - -static void -time_dealloc(PyDateTime_Time *self) -{ - if (HASTZINFO(self)) { - Py_XDECREF(self->tzinfo); - } - Py_TYPE(self)->tp_free((PyObject *)self); -} - -/* - * Indirect access to tzinfo methods. - */ - -/* These are all METH_NOARGS, so don't need to check the arglist. */ -static PyObject * -time_utcoffset(PyDateTime_Time *self, PyObject *unused) { - return offset_as_timedelta(HASTZINFO(self) ? self->tzinfo : Py_None, - "utcoffset", Py_None); -} - -static PyObject * -time_dst(PyDateTime_Time *self, PyObject *unused) { - return offset_as_timedelta(HASTZINFO(self) ? self->tzinfo : Py_None, - "dst", Py_None); -} - -static PyObject * -time_tzname(PyDateTime_Time *self, PyObject *unused) { - return call_tzname(HASTZINFO(self) ? self->tzinfo : Py_None, - Py_None); -} - -/* - * Various ways to turn a time into a string. - */ - -static PyObject * -time_repr(PyDateTime_Time *self) -{ - char buffer[100]; - const char *type_name = Py_TYPE(self)->tp_name; - int h = TIME_GET_HOUR(self); - int m = TIME_GET_MINUTE(self); - int s = TIME_GET_SECOND(self); - int us = TIME_GET_MICROSECOND(self); - PyObject *result = NULL; - - if (us) - PyOS_snprintf(buffer, sizeof(buffer), - "%s(%d, %d, %d, %d)", type_name, h, m, s, us); - else if (s) - PyOS_snprintf(buffer, sizeof(buffer), - "%s(%d, %d, %d)", type_name, h, m, s); - else - PyOS_snprintf(buffer, sizeof(buffer), - "%s(%d, %d)", type_name, h, m); - result = PyString_FromString(buffer); - if (result != NULL && HASTZINFO(self)) - result = append_keyword_tzinfo(result, self->tzinfo); - return result; -} - -static PyObject * -time_str(PyDateTime_Time *self) -{ - return PyObject_CallMethod((PyObject *)self, "isoformat", "()"); -} - -static PyObject * -time_isoformat(PyDateTime_Time *self, PyObject *unused) -{ - char buf[100]; - PyObject *result; - /* Reuse the time format code from the datetime type. */ - PyDateTime_DateTime datetime; - PyDateTime_DateTime *pdatetime = &datetime; - - /* Copy over just the time bytes. */ - memcpy(pdatetime->data + _PyDateTime_DATE_DATASIZE, - self->data, - _PyDateTime_TIME_DATASIZE); - - isoformat_time(pdatetime, buf, sizeof(buf)); - result = PyString_FromString(buf); - if (result == NULL || ! HASTZINFO(self) || self->tzinfo == Py_None) - return result; - - /* We need to append the UTC offset. */ - if (format_utcoffset(buf, sizeof(buf), ":", self->tzinfo, - Py_None) < 0) { - Py_DECREF(result); - return NULL; - } - PyString_ConcatAndDel(&result, PyString_FromString(buf)); - return result; -} - -static PyObject * -time_strftime(PyDateTime_Time *self, PyObject *args, PyObject *kw) -{ - PyObject *result; - PyObject *tuple; - const char *format; - Py_ssize_t format_len; - static char *keywords[] = {"format", NULL}; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "s#:strftime", keywords, - &format, &format_len)) - return NULL; - - /* Python's strftime does insane things with the year part of the - * timetuple. The year is forced to (the otherwise nonsensical) - * 1900 to worm around that. - */ - tuple = Py_BuildValue("iiiiiiiii", - 1900, 1, 1, /* year, month, day */ - TIME_GET_HOUR(self), - TIME_GET_MINUTE(self), - TIME_GET_SECOND(self), - 0, 1, -1); /* weekday, daynum, dst */ - if (tuple == NULL) - return NULL; - assert(PyTuple_Size(tuple) == 9); - result = wrap_strftime((PyObject *)self, format, format_len, tuple, - Py_None); - Py_DECREF(tuple); - return result; -} - -/* - * Miscellaneous methods. - */ - -/* This is more natural as a tp_compare, but doesn't work then: for whatever - * reason, Python's try_3way_compare ignores tp_compare unless - * PyInstance_Check returns true, but these aren't old-style classes. - */ -static PyObject * -time_richcompare(PyDateTime_Time *self, PyObject *other, int op) -{ - int diff; - naivety n1, n2; - int offset1, offset2; - - if (! PyTime_Check(other)) { - if (op == Py_EQ || op == Py_NE) { - PyObject *result = op == Py_EQ ? Py_False : Py_True; - Py_INCREF(result); - return result; - } - /* Stop this from falling back to address comparison. */ - return cmperror((PyObject *)self, other); - } - if (classify_two_utcoffsets((PyObject *)self, &offset1, &n1, Py_None, - other, &offset2, &n2, Py_None) < 0) - return NULL; - assert(n1 != OFFSET_UNKNOWN && n2 != OFFSET_UNKNOWN); - /* If they're both naive, or both aware and have the same offsets, - * we get off cheap. Note that if they're both naive, offset1 == - * offset2 == 0 at this point. - */ - if (n1 == n2 && offset1 == offset2) { - diff = memcmp(self->data, ((PyDateTime_Time *)other)->data, - _PyDateTime_TIME_DATASIZE); - return diff_to_bool(diff, op); - } - - if (n1 == OFFSET_AWARE && n2 == OFFSET_AWARE) { - assert(offset1 != offset2); /* else last "if" handled it */ - /* Convert everything except microseconds to seconds. These - * can't overflow (no more than the # of seconds in 2 days). - */ - offset1 = TIME_GET_HOUR(self) * 3600 + - (TIME_GET_MINUTE(self) - offset1) * 60 + - TIME_GET_SECOND(self); - offset2 = TIME_GET_HOUR(other) * 3600 + - (TIME_GET_MINUTE(other) - offset2) * 60 + - TIME_GET_SECOND(other); - diff = offset1 - offset2; - if (diff == 0) - diff = TIME_GET_MICROSECOND(self) - - TIME_GET_MICROSECOND(other); - return diff_to_bool(diff, op); - } - - assert(n1 != n2); - PyErr_SetString(PyExc_TypeError, - "can't compare offset-naive and " - "offset-aware times"); - return NULL; -} - -static long -time_hash(PyDateTime_Time *self) -{ - if (self->hashcode == -1) { - naivety n; - int offset; - PyObject *temp; - - n = classify_utcoffset((PyObject *)self, Py_None, &offset); - assert(n != OFFSET_UNKNOWN); - if (n == OFFSET_ERROR) - return -1; - - /* Reduce this to a hash of another object. */ - if (offset == 0) - temp = PyString_FromStringAndSize((char *)self->data, - _PyDateTime_TIME_DATASIZE); - else { - int hour; - int minute; - - assert(n == OFFSET_AWARE); - assert(HASTZINFO(self)); - hour = divmod(TIME_GET_HOUR(self) * 60 + - TIME_GET_MINUTE(self) - offset, - 60, - &minute); - if (0 <= hour && hour < 24) - temp = new_time(hour, minute, - TIME_GET_SECOND(self), - TIME_GET_MICROSECOND(self), - Py_None); - else - temp = Py_BuildValue("iiii", - hour, minute, - TIME_GET_SECOND(self), - TIME_GET_MICROSECOND(self)); - } - if (temp != NULL) { - self->hashcode = PyObject_Hash(temp); - Py_DECREF(temp); - } - } - return self->hashcode; -} - -static PyObject * -time_replace(PyDateTime_Time *self, PyObject *args, PyObject *kw) -{ - PyObject *clone; - PyObject *tuple; - int hh = TIME_GET_HOUR(self); - int mm = TIME_GET_MINUTE(self); - int ss = TIME_GET_SECOND(self); - int us = TIME_GET_MICROSECOND(self); - PyObject *tzinfo = HASTZINFO(self) ? self->tzinfo : Py_None; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "|iiiiO:replace", - time_kws, - &hh, &mm, &ss, &us, &tzinfo)) - return NULL; - tuple = Py_BuildValue("iiiiO", hh, mm, ss, us, tzinfo); - if (tuple == NULL) - return NULL; - clone = time_new(Py_TYPE(self), tuple, NULL); - Py_DECREF(tuple); - return clone; -} - -static int -time_nonzero(PyDateTime_Time *self) -{ - int offset; - int none; - - if (TIME_GET_SECOND(self) || TIME_GET_MICROSECOND(self)) { - /* Since utcoffset is in whole minutes, nothing can - * alter the conclusion that this is nonzero. - */ - return 1; - } - offset = 0; - if (HASTZINFO(self) && self->tzinfo != Py_None) { - offset = call_utcoffset(self->tzinfo, Py_None, &none); - if (offset == -1 && PyErr_Occurred()) - return -1; - } - return (TIME_GET_MINUTE(self) - offset + TIME_GET_HOUR(self)*60) != 0; -} - -/* Pickle support, a simple use of __reduce__. */ - -/* Let basestate be the non-tzinfo data string. - * If tzinfo is None, this returns (basestate,), else (basestate, tzinfo). - * So it's a tuple in any (non-error) case. - * __getstate__ isn't exposed. - */ -static PyObject * -time_getstate(PyDateTime_Time *self) -{ - PyObject *basestate; - PyObject *result = NULL; - - basestate = PyString_FromStringAndSize((char *)self->data, - _PyDateTime_TIME_DATASIZE); - if (basestate != NULL) { - if (! HASTZINFO(self) || self->tzinfo == Py_None) - result = PyTuple_Pack(1, basestate); - else - result = PyTuple_Pack(2, basestate, self->tzinfo); - Py_DECREF(basestate); - } - return result; -} - -static PyObject * -time_reduce(PyDateTime_Time *self, PyObject *arg) -{ - return Py_BuildValue("(ON)", Py_TYPE(self), time_getstate(self)); -} - -static PyMethodDef time_methods[] = { - - {"isoformat", (PyCFunction)time_isoformat, METH_NOARGS, - PyDoc_STR("Return string in ISO 8601 format, HH:MM:SS[.mmmmmm]" - "[+HH:MM].")}, - - {"strftime", (PyCFunction)time_strftime, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("format -> strftime() style string.")}, - - {"__format__", (PyCFunction)date_format, METH_VARARGS, - PyDoc_STR("Formats self with strftime.")}, - - {"utcoffset", (PyCFunction)time_utcoffset, METH_NOARGS, - PyDoc_STR("Return self.tzinfo.utcoffset(self).")}, - - {"tzname", (PyCFunction)time_tzname, METH_NOARGS, - PyDoc_STR("Return self.tzinfo.tzname(self).")}, - - {"dst", (PyCFunction)time_dst, METH_NOARGS, - PyDoc_STR("Return self.tzinfo.dst(self).")}, - - {"replace", (PyCFunction)time_replace, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("Return time with new specified fields.")}, - - {"__reduce__", (PyCFunction)time_reduce, METH_NOARGS, - PyDoc_STR("__reduce__() -> (cls, state)")}, - - {NULL, NULL} -}; - -static char time_doc[] = -PyDoc_STR("time([hour[, minute[, second[, microsecond[, tzinfo]]]]]) --> a time object\n\ -\n\ -All arguments are optional. tzinfo may be None, or an instance of\n\ -a tzinfo subclass. The remaining arguments may be ints or longs.\n"); - -static PyNumberMethods time_as_number = { - 0, /* nb_add */ - 0, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - (inquiry)time_nonzero, /* nb_nonzero */ -}; - -statichere PyTypeObject PyDateTime_TimeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "datetime.time", /* tp_name */ - sizeof(PyDateTime_Time), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)time_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)time_repr, /* tp_repr */ - &time_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)time_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)time_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - time_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)time_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - time_methods, /* tp_methods */ - 0, /* tp_members */ - time_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - time_alloc, /* tp_alloc */ - time_new, /* tp_new */ - 0, /* tp_free */ -}; - -/* - * PyDateTime_DateTime implementation. - */ - -/* Accessor properties. Properties for day, month, and year are inherited - * from date. - */ - -static PyObject * -datetime_hour(PyDateTime_DateTime *self, void *unused) -{ - return PyInt_FromLong(DATE_GET_HOUR(self)); -} - -static PyObject * -datetime_minute(PyDateTime_DateTime *self, void *unused) -{ - return PyInt_FromLong(DATE_GET_MINUTE(self)); -} - -static PyObject * -datetime_second(PyDateTime_DateTime *self, void *unused) -{ - return PyInt_FromLong(DATE_GET_SECOND(self)); -} - -static PyObject * -datetime_microsecond(PyDateTime_DateTime *self, void *unused) -{ - return PyInt_FromLong(DATE_GET_MICROSECOND(self)); -} - -static PyObject * -datetime_tzinfo(PyDateTime_DateTime *self, void *unused) -{ - PyObject *result = HASTZINFO(self) ? self->tzinfo : Py_None; - Py_INCREF(result); - return result; -} - -static PyGetSetDef datetime_getset[] = { - {"hour", (getter)datetime_hour}, - {"minute", (getter)datetime_minute}, - {"second", (getter)datetime_second}, - {"microsecond", (getter)datetime_microsecond}, - {"tzinfo", (getter)datetime_tzinfo}, - {NULL} -}; - -/* - * Constructors. - */ - -static char *datetime_kws[] = { - "year", "month", "day", "hour", "minute", "second", - "microsecond", "tzinfo", NULL -}; - -static PyObject * -datetime_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *self = NULL; - PyObject *state; - int year; - int month; - int day; - int hour = 0; - int minute = 0; - int second = 0; - int usecond = 0; - PyObject *tzinfo = Py_None; - - /* Check for invocation from pickle with __getstate__ state */ - if (PyTuple_GET_SIZE(args) >= 1 && - PyTuple_GET_SIZE(args) <= 2 && - PyString_Check(state = PyTuple_GET_ITEM(args, 0)) && - PyString_GET_SIZE(state) == _PyDateTime_DATETIME_DATASIZE && - MONTH_IS_SANE(PyString_AS_STRING(state)[2])) - { - PyDateTime_DateTime *me; - char aware; - - if (PyTuple_GET_SIZE(args) == 2) { - tzinfo = PyTuple_GET_ITEM(args, 1); - if (check_tzinfo_subclass(tzinfo) < 0) { - PyErr_SetString(PyExc_TypeError, "bad " - "tzinfo state arg"); - return NULL; - } - } - aware = (char)(tzinfo != Py_None); - me = (PyDateTime_DateTime *) (type->tp_alloc(type , aware)); - if (me != NULL) { - char *pdata = PyString_AS_STRING(state); - - memcpy(me->data, pdata, _PyDateTime_DATETIME_DATASIZE); - me->hashcode = -1; - me->hastzinfo = aware; - if (aware) { - Py_INCREF(tzinfo); - me->tzinfo = tzinfo; - } - } - return (PyObject *)me; - } - - if (PyArg_ParseTupleAndKeywords(args, kw, "iii|iiiiO", datetime_kws, - &year, &month, &day, &hour, &minute, - &second, &usecond, &tzinfo)) { - if (check_date_args(year, month, day) < 0) - return NULL; - if (check_time_args(hour, minute, second, usecond) < 0) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; - self = new_datetime_ex(year, month, day, - hour, minute, second, usecond, - tzinfo, type); - } - return self; -} - -/* TM_FUNC is the shared type of localtime() and gmtime(). */ -typedef struct tm *(*TM_FUNC)(const time_t *timer); - -/* Internal helper. - * Build datetime from a time_t and a distinct count of microseconds. - * Pass localtime or gmtime for f, to control the interpretation of timet. - */ -static PyObject * -datetime_from_timet_and_us(PyObject *cls, TM_FUNC f, time_t timet, int us, - PyObject *tzinfo) -{ - struct tm *tm; - PyObject *result = NULL; - - tm = f(&timet); - if (tm) { - /* The platform localtime/gmtime may insert leap seconds, - * indicated by tm->tm_sec > 59. We don't care about them, - * except to the extent that passing them on to the datetime - * constructor would raise ValueError for a reason that - * made no sense to the user. - */ - if (tm->tm_sec > 59) - tm->tm_sec = 59; - result = PyObject_CallFunction(cls, "iiiiiiiO", - tm->tm_year + 1900, - tm->tm_mon + 1, - tm->tm_mday, - tm->tm_hour, - tm->tm_min, - tm->tm_sec, - us, - tzinfo); - } - else - PyErr_SetString(PyExc_ValueError, - "timestamp out of range for " - "platform localtime()/gmtime() function"); - return result; -} - -/* Internal helper. - * Build datetime from a Python timestamp. Pass localtime or gmtime for f, - * to control the interpretation of the timestamp. Since a double doesn't - * have enough bits to cover a datetime's full range of precision, it's - * better to call datetime_from_timet_and_us provided you have a way - * to get that much precision (e.g., C time() isn't good enough). - */ -static PyObject * -datetime_from_timestamp(PyObject *cls, TM_FUNC f, double timestamp, - PyObject *tzinfo) -{ - time_t timet; - double fraction; - int us; - - timet = _PyTime_DoubleToTimet(timestamp); - if (timet == (time_t)-1 && PyErr_Occurred()) - return NULL; - fraction = timestamp - (double)timet; - us = (int)round_to_long(fraction * 1e6); - if (us < 0) { - /* Truncation towards zero is not what we wanted - for negative numbers (Python's mod semantics) */ - timet -= 1; - us += 1000000; - } - /* If timestamp is less than one microsecond smaller than a - * full second, round up. Otherwise, ValueErrors are raised - * for some floats. */ - if (us == 1000000) { - timet += 1; - us = 0; - } - return datetime_from_timet_and_us(cls, f, timet, us, tzinfo); -} - -/* Internal helper. - * Build most accurate possible datetime for current time. Pass localtime or - * gmtime for f as appropriate. - */ -static PyObject * -datetime_best_possible(PyObject *cls, TM_FUNC f, PyObject *tzinfo) -{ -#ifdef HAVE_GETTIMEOFDAY - struct timeval t; - -#ifdef GETTIMEOFDAY_NO_TZ - gettimeofday(&t); -#else - gettimeofday(&t, (struct timezone *)NULL); -#endif - return datetime_from_timet_and_us(cls, f, t.tv_sec, (int)t.tv_usec, - tzinfo); - -#else /* ! HAVE_GETTIMEOFDAY */ - /* No flavor of gettimeofday exists on this platform. Python's - * time.time() does a lot of other platform tricks to get the - * best time it can on the platform, and we're not going to do - * better than that (if we could, the better code would belong - * in time.time()!) We're limited by the precision of a double, - * though. - */ - PyObject *time; - double dtime; - - time = time_time(); - if (time == NULL) - return NULL; - dtime = PyFloat_AsDouble(time); - Py_DECREF(time); - if (dtime == -1.0 && PyErr_Occurred()) - return NULL; - return datetime_from_timestamp(cls, f, dtime, tzinfo); -#endif /* ! HAVE_GETTIMEOFDAY */ -} - -/* Return best possible local time -- this isn't constrained by the - * precision of a timestamp. - */ -static PyObject * -datetime_now(PyObject *cls, PyObject *args, PyObject *kw) -{ - PyObject *self; - PyObject *tzinfo = Py_None; - static char *keywords[] = {"tz", NULL}; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "|O:now", keywords, - &tzinfo)) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; - - self = datetime_best_possible(cls, - tzinfo == Py_None ? localtime : gmtime, - tzinfo); - if (self != NULL && tzinfo != Py_None) { - /* Convert UTC to tzinfo's zone. */ - PyObject *temp = self; - self = PyObject_CallMethod(tzinfo, "fromutc", "O", self); - Py_DECREF(temp); - } - return self; -} - -/* Return best possible UTC time -- this isn't constrained by the - * precision of a timestamp. - */ -static PyObject * -datetime_utcnow(PyObject *cls, PyObject *dummy) -{ - return datetime_best_possible(cls, gmtime, Py_None); -} - -/* Return new local datetime from timestamp (Python timestamp -- a double). */ -static PyObject * -datetime_fromtimestamp(PyObject *cls, PyObject *args, PyObject *kw) -{ - PyObject *self; - double timestamp; - PyObject *tzinfo = Py_None; - static char *keywords[] = {"timestamp", "tz", NULL}; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "d|O:fromtimestamp", - keywords, ×tamp, &tzinfo)) - return NULL; - if (check_tzinfo_subclass(tzinfo) < 0) - return NULL; - - self = datetime_from_timestamp(cls, - tzinfo == Py_None ? localtime : gmtime, - timestamp, - tzinfo); - if (self != NULL && tzinfo != Py_None) { - /* Convert UTC to tzinfo's zone. */ - PyObject *temp = self; - self = PyObject_CallMethod(tzinfo, "fromutc", "O", self); - Py_DECREF(temp); - } - return self; -} - -/* Return new UTC datetime from timestamp (Python timestamp -- a double). */ -static PyObject * -datetime_utcfromtimestamp(PyObject *cls, PyObject *args) -{ - double timestamp; - PyObject *result = NULL; - - if (PyArg_ParseTuple(args, "d:utcfromtimestamp", ×tamp)) - result = datetime_from_timestamp(cls, gmtime, timestamp, - Py_None); - return result; -} - -/* Return new datetime from time.strptime(). */ -static PyObject * -datetime_strptime(PyObject *cls, PyObject *args) -{ - static PyObject *module = NULL; - PyObject *result = NULL, *obj, *st = NULL, *frac = NULL; - const char *string, *format; - - if (!PyArg_ParseTuple(args, "ss:strptime", &string, &format)) - return NULL; - - if (module == NULL && - (module = PyImport_ImportModuleNoBlock("_strptime")) == NULL) - return NULL; - - /* _strptime._strptime returns a two-element tuple. The first - element is a time.struct_time object. The second is the - microseconds (which are not defined for time.struct_time). */ - obj = PyObject_CallMethod(module, "_strptime", "ss", string, format); - if (obj != NULL) { - int i, good_timetuple = 1; - long int ia[7]; - if (PySequence_Check(obj) && PySequence_Size(obj) == 2) { - st = PySequence_GetItem(obj, 0); - frac = PySequence_GetItem(obj, 1); - if (st == NULL || frac == NULL) - good_timetuple = 0; - /* copy y/m/d/h/m/s values out of the - time.struct_time */ - if (good_timetuple && - PySequence_Check(st) && - PySequence_Size(st) >= 6) { - for (i=0; i < 6; i++) { - PyObject *p = PySequence_GetItem(st, i); - if (p == NULL) { - good_timetuple = 0; - break; - } - if (PyInt_Check(p)) - ia[i] = PyInt_AsLong(p); - else - good_timetuple = 0; - Py_DECREF(p); - } - } - else - good_timetuple = 0; - /* follow that up with a little dose of microseconds */ - if (good_timetuple && PyInt_Check(frac)) - ia[6] = PyInt_AsLong(frac); - else - good_timetuple = 0; - } - else - good_timetuple = 0; - if (good_timetuple) - result = PyObject_CallFunction(cls, "iiiiiii", - ia[0], ia[1], ia[2], - ia[3], ia[4], ia[5], - ia[6]); - else - PyErr_SetString(PyExc_ValueError, - "unexpected value from _strptime._strptime"); - } - Py_XDECREF(obj); - Py_XDECREF(st); - Py_XDECREF(frac); - return result; -} - -/* Return new datetime from date/datetime and time arguments. */ -static PyObject * -datetime_combine(PyObject *cls, PyObject *args, PyObject *kw) -{ - static char *keywords[] = {"date", "time", NULL}; - PyObject *date; - PyObject *time; - PyObject *result = NULL; - - if (PyArg_ParseTupleAndKeywords(args, kw, "O!O!:combine", keywords, - &PyDateTime_DateType, &date, - &PyDateTime_TimeType, &time)) { - PyObject *tzinfo = Py_None; - - if (HASTZINFO(time)) - tzinfo = ((PyDateTime_Time *)time)->tzinfo; - result = PyObject_CallFunction(cls, "iiiiiiiO", - GET_YEAR(date), - GET_MONTH(date), - GET_DAY(date), - TIME_GET_HOUR(time), - TIME_GET_MINUTE(time), - TIME_GET_SECOND(time), - TIME_GET_MICROSECOND(time), - tzinfo); - } - return result; -} - -/* - * Destructor. - */ - -static void -datetime_dealloc(PyDateTime_DateTime *self) -{ - if (HASTZINFO(self)) { - Py_XDECREF(self->tzinfo); - } - Py_TYPE(self)->tp_free((PyObject *)self); -} - -/* - * Indirect access to tzinfo methods. - */ - -/* These are all METH_NOARGS, so don't need to check the arglist. */ -static PyObject * -datetime_utcoffset(PyDateTime_DateTime *self, PyObject *unused) { - return offset_as_timedelta(HASTZINFO(self) ? self->tzinfo : Py_None, - "utcoffset", (PyObject *)self); -} - -static PyObject * -datetime_dst(PyDateTime_DateTime *self, PyObject *unused) { - return offset_as_timedelta(HASTZINFO(self) ? self->tzinfo : Py_None, - "dst", (PyObject *)self); -} - -static PyObject * -datetime_tzname(PyDateTime_DateTime *self, PyObject *unused) { - return call_tzname(HASTZINFO(self) ? self->tzinfo : Py_None, - (PyObject *)self); -} - -/* - * datetime arithmetic. - */ - -/* factor must be 1 (to add) or -1 (to subtract). The result inherits - * the tzinfo state of date. - */ -static PyObject * -add_datetime_timedelta(PyDateTime_DateTime *date, PyDateTime_Delta *delta, - int factor) -{ - /* Note that the C-level additions can't overflow, because of - * invariant bounds on the member values. - */ - int year = GET_YEAR(date); - int month = GET_MONTH(date); - int day = GET_DAY(date) + GET_TD_DAYS(delta) * factor; - int hour = DATE_GET_HOUR(date); - int minute = DATE_GET_MINUTE(date); - int second = DATE_GET_SECOND(date) + GET_TD_SECONDS(delta) * factor; - int microsecond = DATE_GET_MICROSECOND(date) + - GET_TD_MICROSECONDS(delta) * factor; - - assert(factor == 1 || factor == -1); - if (normalize_datetime(&year, &month, &day, - &hour, &minute, &second, µsecond) < 0) - return NULL; - else - return new_datetime(year, month, day, - hour, minute, second, microsecond, - HASTZINFO(date) ? date->tzinfo : Py_None); -} - -static PyObject * -datetime_add(PyObject *left, PyObject *right) -{ - if (PyDateTime_Check(left)) { - /* datetime + ??? */ - if (PyDelta_Check(right)) - /* datetime + delta */ - return add_datetime_timedelta( - (PyDateTime_DateTime *)left, - (PyDateTime_Delta *)right, - 1); - } - else if (PyDelta_Check(left)) { - /* delta + datetime */ - return add_datetime_timedelta((PyDateTime_DateTime *) right, - (PyDateTime_Delta *) left, - 1); - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static PyObject * -datetime_subtract(PyObject *left, PyObject *right) -{ - PyObject *result = Py_NotImplemented; - - if (PyDateTime_Check(left)) { - /* datetime - ??? */ - if (PyDateTime_Check(right)) { - /* datetime - datetime */ - naivety n1, n2; - int offset1, offset2; - int delta_d, delta_s, delta_us; - - if (classify_two_utcoffsets(left, &offset1, &n1, left, - right, &offset2, &n2, - right) < 0) - return NULL; - assert(n1 != OFFSET_UNKNOWN && n2 != OFFSET_UNKNOWN); - if (n1 != n2) { - PyErr_SetString(PyExc_TypeError, - "can't subtract offset-naive and " - "offset-aware datetimes"); - return NULL; - } - delta_d = ymd_to_ord(GET_YEAR(left), - GET_MONTH(left), - GET_DAY(left)) - - ymd_to_ord(GET_YEAR(right), - GET_MONTH(right), - GET_DAY(right)); - /* These can't overflow, since the values are - * normalized. At most this gives the number of - * seconds in one day. - */ - delta_s = (DATE_GET_HOUR(left) - - DATE_GET_HOUR(right)) * 3600 + - (DATE_GET_MINUTE(left) - - DATE_GET_MINUTE(right)) * 60 + - (DATE_GET_SECOND(left) - - DATE_GET_SECOND(right)); - delta_us = DATE_GET_MICROSECOND(left) - - DATE_GET_MICROSECOND(right); - /* (left - offset1) - (right - offset2) = - * (left - right) + (offset2 - offset1) - */ - delta_s += (offset2 - offset1) * 60; - result = new_delta(delta_d, delta_s, delta_us, 1); - } - else if (PyDelta_Check(right)) { - /* datetime - delta */ - result = add_datetime_timedelta( - (PyDateTime_DateTime *)left, - (PyDateTime_Delta *)right, - -1); - } - } - - if (result == Py_NotImplemented) - Py_INCREF(result); - return result; -} - -/* Various ways to turn a datetime into a string. */ - -static PyObject * -datetime_repr(PyDateTime_DateTime *self) -{ - char buffer[1000]; - const char *type_name = Py_TYPE(self)->tp_name; - PyObject *baserepr; - - if (DATE_GET_MICROSECOND(self)) { - PyOS_snprintf(buffer, sizeof(buffer), - "%s(%d, %d, %d, %d, %d, %d, %d)", - type_name, - GET_YEAR(self), GET_MONTH(self), GET_DAY(self), - DATE_GET_HOUR(self), DATE_GET_MINUTE(self), - DATE_GET_SECOND(self), - DATE_GET_MICROSECOND(self)); - } - else if (DATE_GET_SECOND(self)) { - PyOS_snprintf(buffer, sizeof(buffer), - "%s(%d, %d, %d, %d, %d, %d)", - type_name, - GET_YEAR(self), GET_MONTH(self), GET_DAY(self), - DATE_GET_HOUR(self), DATE_GET_MINUTE(self), - DATE_GET_SECOND(self)); - } - else { - PyOS_snprintf(buffer, sizeof(buffer), - "%s(%d, %d, %d, %d, %d)", - type_name, - GET_YEAR(self), GET_MONTH(self), GET_DAY(self), - DATE_GET_HOUR(self), DATE_GET_MINUTE(self)); - } - baserepr = PyString_FromString(buffer); - if (baserepr == NULL || ! HASTZINFO(self)) - return baserepr; - return append_keyword_tzinfo(baserepr, self->tzinfo); -} - -static PyObject * -datetime_str(PyDateTime_DateTime *self) -{ - return PyObject_CallMethod((PyObject *)self, "isoformat", "(s)", " "); -} - -static PyObject * -datetime_isoformat(PyDateTime_DateTime *self, PyObject *args, PyObject *kw) -{ - char sep = 'T'; - static char *keywords[] = {"sep", NULL}; - char buffer[100]; - char *cp; - PyObject *result; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|c:isoformat", keywords, - &sep)) - return NULL; - cp = isoformat_date((PyDateTime_Date *)self, buffer, sizeof(buffer)); - assert(cp != NULL); - *cp++ = sep; - cp = isoformat_time(self, cp, sizeof(buffer) - (cp - buffer)); - result = PyString_FromStringAndSize(buffer, cp - buffer); - if (result == NULL || ! HASTZINFO(self)) - return result; - - /* We need to append the UTC offset. */ - if (format_utcoffset(buffer, sizeof(buffer), ":", self->tzinfo, - (PyObject *)self) < 0) { - Py_DECREF(result); - return NULL; - } - PyString_ConcatAndDel(&result, PyString_FromString(buffer)); - return result; -} - -static PyObject * -datetime_ctime(PyDateTime_DateTime *self) -{ - return format_ctime((PyDateTime_Date *)self, - DATE_GET_HOUR(self), - DATE_GET_MINUTE(self), - DATE_GET_SECOND(self)); -} - -/* Miscellaneous methods. */ - -/* This is more natural as a tp_compare, but doesn't work then: for whatever - * reason, Python's try_3way_compare ignores tp_compare unless - * PyInstance_Check returns true, but these aren't old-style classes. - */ -static PyObject * -datetime_richcompare(PyDateTime_DateTime *self, PyObject *other, int op) -{ - int diff; - naivety n1, n2; - int offset1, offset2; - - if (! PyDateTime_Check(other)) { - /* If other has a "timetuple" attr, that's an advertised - * hook for other classes to ask to get comparison control. - * However, date instances have a timetuple attr, and we - * don't want to allow that comparison. Because datetime - * is a subclass of date, when mixing date and datetime - * in a comparison, Python gives datetime the first shot - * (it's the more specific subtype). So we can stop that - * combination here reliably. - */ - if (PyObject_HasAttrString(other, "timetuple") && - ! PyDate_Check(other)) { - /* A hook for other kinds of datetime objects. */ - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - if (op == Py_EQ || op == Py_NE) { - PyObject *result = op == Py_EQ ? Py_False : Py_True; - Py_INCREF(result); - return result; - } - /* Stop this from falling back to address comparison. */ - return cmperror((PyObject *)self, other); - } - - if (classify_two_utcoffsets((PyObject *)self, &offset1, &n1, - (PyObject *)self, - other, &offset2, &n2, - other) < 0) - return NULL; - assert(n1 != OFFSET_UNKNOWN && n2 != OFFSET_UNKNOWN); - /* If they're both naive, or both aware and have the same offsets, - * we get off cheap. Note that if they're both naive, offset1 == - * offset2 == 0 at this point. - */ - if (n1 == n2 && offset1 == offset2) { - diff = memcmp(self->data, ((PyDateTime_DateTime *)other)->data, - _PyDateTime_DATETIME_DATASIZE); - return diff_to_bool(diff, op); - } - - if (n1 == OFFSET_AWARE && n2 == OFFSET_AWARE) { - PyDateTime_Delta *delta; - - assert(offset1 != offset2); /* else last "if" handled it */ - delta = (PyDateTime_Delta *)datetime_subtract((PyObject *)self, - other); - if (delta == NULL) - return NULL; - diff = GET_TD_DAYS(delta); - if (diff == 0) - diff = GET_TD_SECONDS(delta) | - GET_TD_MICROSECONDS(delta); - Py_DECREF(delta); - return diff_to_bool(diff, op); - } - - assert(n1 != n2); - PyErr_SetString(PyExc_TypeError, - "can't compare offset-naive and " - "offset-aware datetimes"); - return NULL; -} - -static long -datetime_hash(PyDateTime_DateTime *self) -{ - if (self->hashcode == -1) { - naivety n; - int offset; - PyObject *temp; - - n = classify_utcoffset((PyObject *)self, (PyObject *)self, - &offset); - assert(n != OFFSET_UNKNOWN); - if (n == OFFSET_ERROR) - return -1; - - /* Reduce this to a hash of another object. */ - if (n == OFFSET_NAIVE) - temp = PyString_FromStringAndSize( - (char *)self->data, - _PyDateTime_DATETIME_DATASIZE); - else { - int days; - int seconds; - - assert(n == OFFSET_AWARE); - assert(HASTZINFO(self)); - days = ymd_to_ord(GET_YEAR(self), - GET_MONTH(self), - GET_DAY(self)); - seconds = DATE_GET_HOUR(self) * 3600 + - (DATE_GET_MINUTE(self) - offset) * 60 + - DATE_GET_SECOND(self); - temp = new_delta(days, - seconds, - DATE_GET_MICROSECOND(self), - 1); - } - if (temp != NULL) { - self->hashcode = PyObject_Hash(temp); - Py_DECREF(temp); - } - } - return self->hashcode; -} - -static PyObject * -datetime_replace(PyDateTime_DateTime *self, PyObject *args, PyObject *kw) -{ - PyObject *clone; - PyObject *tuple; - int y = GET_YEAR(self); - int m = GET_MONTH(self); - int d = GET_DAY(self); - int hh = DATE_GET_HOUR(self); - int mm = DATE_GET_MINUTE(self); - int ss = DATE_GET_SECOND(self); - int us = DATE_GET_MICROSECOND(self); - PyObject *tzinfo = HASTZINFO(self) ? self->tzinfo : Py_None; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "|iiiiiiiO:replace", - datetime_kws, - &y, &m, &d, &hh, &mm, &ss, &us, - &tzinfo)) - return NULL; - tuple = Py_BuildValue("iiiiiiiO", y, m, d, hh, mm, ss, us, tzinfo); - if (tuple == NULL) - return NULL; - clone = datetime_new(Py_TYPE(self), tuple, NULL); - Py_DECREF(tuple); - return clone; -} - -static PyObject * -datetime_astimezone(PyDateTime_DateTime *self, PyObject *args, PyObject *kw) -{ - int y, m, d, hh, mm, ss, us; - PyObject *result; - int offset, none; - - PyObject *tzinfo; - static char *keywords[] = {"tz", NULL}; - - if (! PyArg_ParseTupleAndKeywords(args, kw, "O!:astimezone", keywords, - &PyDateTime_TZInfoType, &tzinfo)) - return NULL; - - if (!HASTZINFO(self) || self->tzinfo == Py_None) - goto NeedAware; - - /* Conversion to self's own time zone is a NOP. */ - if (self->tzinfo == tzinfo) { - Py_INCREF(self); - return (PyObject *)self; - } - - /* Convert self to UTC. */ - offset = call_utcoffset(self->tzinfo, (PyObject *)self, &none); - if (offset == -1 && PyErr_Occurred()) - return NULL; - if (none) - goto NeedAware; - - y = GET_YEAR(self); - m = GET_MONTH(self); - d = GET_DAY(self); - hh = DATE_GET_HOUR(self); - mm = DATE_GET_MINUTE(self); - ss = DATE_GET_SECOND(self); - us = DATE_GET_MICROSECOND(self); - - mm -= offset; - if ((mm < 0 || mm >= 60) && - normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us) < 0) - return NULL; - - /* Attach new tzinfo and let fromutc() do the rest. */ - result = new_datetime(y, m, d, hh, mm, ss, us, tzinfo); - if (result != NULL) { - PyObject *temp = result; - - result = PyObject_CallMethod(tzinfo, "fromutc", "O", temp); - Py_DECREF(temp); - } - return result; - -NeedAware: - PyErr_SetString(PyExc_ValueError, "astimezone() cannot be applied to " - "a naive datetime"); - return NULL; -} - -static PyObject * -datetime_timetuple(PyDateTime_DateTime *self) -{ - int dstflag = -1; - - if (HASTZINFO(self) && self->tzinfo != Py_None) { - int none; - - dstflag = call_dst(self->tzinfo, (PyObject *)self, &none); - if (dstflag == -1 && PyErr_Occurred()) - return NULL; - - if (none) - dstflag = -1; - else if (dstflag != 0) - dstflag = 1; - - } - return build_struct_time(GET_YEAR(self), - GET_MONTH(self), - GET_DAY(self), - DATE_GET_HOUR(self), - DATE_GET_MINUTE(self), - DATE_GET_SECOND(self), - dstflag); -} - -static PyObject * -datetime_getdate(PyDateTime_DateTime *self) -{ - return new_date(GET_YEAR(self), - GET_MONTH(self), - GET_DAY(self)); -} - -static PyObject * -datetime_gettime(PyDateTime_DateTime *self) -{ - return new_time(DATE_GET_HOUR(self), - DATE_GET_MINUTE(self), - DATE_GET_SECOND(self), - DATE_GET_MICROSECOND(self), - Py_None); -} - -static PyObject * -datetime_gettimetz(PyDateTime_DateTime *self) -{ - return new_time(DATE_GET_HOUR(self), - DATE_GET_MINUTE(self), - DATE_GET_SECOND(self), - DATE_GET_MICROSECOND(self), - HASTZINFO(self) ? self->tzinfo : Py_None); -} - -static PyObject * -datetime_utctimetuple(PyDateTime_DateTime *self) -{ - int y = GET_YEAR(self); - int m = GET_MONTH(self); - int d = GET_DAY(self); - int hh = DATE_GET_HOUR(self); - int mm = DATE_GET_MINUTE(self); - int ss = DATE_GET_SECOND(self); - int us = 0; /* microseconds are ignored in a timetuple */ - int offset = 0; - - if (HASTZINFO(self) && self->tzinfo != Py_None) { - int none; - - offset = call_utcoffset(self->tzinfo, (PyObject *)self, &none); - if (offset == -1 && PyErr_Occurred()) - return NULL; - } - /* Even if offset is 0, don't call timetuple() -- tm_isdst should be - * 0 in a UTC timetuple regardless of what dst() says. - */ - if (offset) { - /* Subtract offset minutes & normalize. */ - int stat; - - mm -= offset; - stat = normalize_datetime(&y, &m, &d, &hh, &mm, &ss, &us); - if (stat < 0) { - /* At the edges, it's possible we overflowed - * beyond MINYEAR or MAXYEAR. - */ - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Clear(); - else - return NULL; - } - } - return build_struct_time(y, m, d, hh, mm, ss, 0); -} - -/* Pickle support, a simple use of __reduce__. */ - -/* Let basestate be the non-tzinfo data string. - * If tzinfo is None, this returns (basestate,), else (basestate, tzinfo). - * So it's a tuple in any (non-error) case. - * __getstate__ isn't exposed. - */ -static PyObject * -datetime_getstate(PyDateTime_DateTime *self) -{ - PyObject *basestate; - PyObject *result = NULL; - - basestate = PyString_FromStringAndSize((char *)self->data, - _PyDateTime_DATETIME_DATASIZE); - if (basestate != NULL) { - if (! HASTZINFO(self) || self->tzinfo == Py_None) - result = PyTuple_Pack(1, basestate); - else - result = PyTuple_Pack(2, basestate, self->tzinfo); - Py_DECREF(basestate); - } - return result; -} - -static PyObject * -datetime_reduce(PyDateTime_DateTime *self, PyObject *arg) -{ - return Py_BuildValue("(ON)", Py_TYPE(self), datetime_getstate(self)); -} - -static PyMethodDef datetime_methods[] = { - - /* Class methods: */ - - {"now", (PyCFunction)datetime_now, - METH_VARARGS | METH_KEYWORDS | METH_CLASS, - PyDoc_STR("[tz] -> new datetime with tz's local day and time.")}, - - {"utcnow", (PyCFunction)datetime_utcnow, - METH_NOARGS | METH_CLASS, - PyDoc_STR("Return a new datetime representing UTC day and time.")}, - - {"fromtimestamp", (PyCFunction)datetime_fromtimestamp, - METH_VARARGS | METH_KEYWORDS | METH_CLASS, - PyDoc_STR("timestamp[, tz] -> tz's local time from POSIX timestamp.")}, - - {"utcfromtimestamp", (PyCFunction)datetime_utcfromtimestamp, - METH_VARARGS | METH_CLASS, - PyDoc_STR("timestamp -> UTC datetime from a POSIX timestamp " - "(like time.time()).")}, - - {"strptime", (PyCFunction)datetime_strptime, - METH_VARARGS | METH_CLASS, - PyDoc_STR("string, format -> new datetime parsed from a string " - "(like time.strptime()).")}, - - {"combine", (PyCFunction)datetime_combine, - METH_VARARGS | METH_KEYWORDS | METH_CLASS, - PyDoc_STR("date, time -> datetime with same date and time fields")}, - - /* Instance methods: */ - - {"date", (PyCFunction)datetime_getdate, METH_NOARGS, - PyDoc_STR("Return date object with same year, month and day.")}, - - {"time", (PyCFunction)datetime_gettime, METH_NOARGS, - PyDoc_STR("Return time object with same time but with tzinfo=None.")}, - - {"timetz", (PyCFunction)datetime_gettimetz, METH_NOARGS, - PyDoc_STR("Return time object with same time and tzinfo.")}, - - {"ctime", (PyCFunction)datetime_ctime, METH_NOARGS, - PyDoc_STR("Return ctime() style string.")}, - - {"timetuple", (PyCFunction)datetime_timetuple, METH_NOARGS, - PyDoc_STR("Return time tuple, compatible with time.localtime().")}, - - {"utctimetuple", (PyCFunction)datetime_utctimetuple, METH_NOARGS, - PyDoc_STR("Return UTC time tuple, compatible with time.localtime().")}, - - {"isoformat", (PyCFunction)datetime_isoformat, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("[sep] -> string in ISO 8601 format, " - "YYYY-MM-DDTHH:MM:SS[.mmmmmm][+HH:MM].\n\n" - "sep is used to separate the year from the time, and " - "defaults to 'T'.")}, - - {"utcoffset", (PyCFunction)datetime_utcoffset, METH_NOARGS, - PyDoc_STR("Return self.tzinfo.utcoffset(self).")}, - - {"tzname", (PyCFunction)datetime_tzname, METH_NOARGS, - PyDoc_STR("Return self.tzinfo.tzname(self).")}, - - {"dst", (PyCFunction)datetime_dst, METH_NOARGS, - PyDoc_STR("Return self.tzinfo.dst(self).")}, - - {"replace", (PyCFunction)datetime_replace, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("Return datetime with new specified fields.")}, - - {"astimezone", (PyCFunction)datetime_astimezone, METH_VARARGS | METH_KEYWORDS, - PyDoc_STR("tz -> convert to local time in new timezone tz\n")}, - - {"__reduce__", (PyCFunction)datetime_reduce, METH_NOARGS, - PyDoc_STR("__reduce__() -> (cls, state)")}, - - {NULL, NULL} -}; - -static char datetime_doc[] = -PyDoc_STR("datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])\n\ -\n\ -The year, month and day arguments are required. tzinfo may be None, or an\n\ -instance of a tzinfo subclass. The remaining arguments may be ints or longs.\n"); - -static PyNumberMethods datetime_as_number = { - datetime_add, /* nb_add */ - datetime_subtract, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - 0, /* nb_nonzero */ -}; - -statichere PyTypeObject PyDateTime_DateTimeType = { - PyObject_HEAD_INIT(NULL) - 0, /* ob_size */ - "datetime.datetime", /* tp_name */ - sizeof(PyDateTime_DateTime), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)datetime_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)datetime_repr, /* tp_repr */ - &datetime_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)datetime_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)datetime_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - datetime_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)datetime_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - datetime_methods, /* tp_methods */ - 0, /* tp_members */ - datetime_getset, /* tp_getset */ - &PyDateTime_DateType, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - datetime_alloc, /* tp_alloc */ - datetime_new, /* tp_new */ - 0, /* tp_free */ -}; - -/* --------------------------------------------------------------------------- - * Module methods and initialization. - */ - -static PyMethodDef module_methods[] = { - {NULL, NULL} -}; - -/* C API. Clients get at this via PyDateTime_IMPORT, defined in - * datetime.h. - */ -static PyDateTime_CAPI CAPI = { - &PyDateTime_DateType, - &PyDateTime_DateTimeType, - &PyDateTime_TimeType, - &PyDateTime_DeltaType, - &PyDateTime_TZInfoType, - new_date_ex, - new_datetime_ex, - new_time_ex, - new_delta_ex, - datetime_fromtimestamp, - date_fromtimestamp -}; - - -PyMODINIT_FUNC -initdatetime(void) -{ - PyObject *m; /* a module object */ - PyObject *d; /* its dict */ - PyObject *x; - - m = Py_InitModule3("datetime", module_methods, - "Fast implementation of the datetime type."); - if (m == NULL) - return; - - if (PyType_Ready(&PyDateTime_DateType) < 0) - return; - if (PyType_Ready(&PyDateTime_DateTimeType) < 0) - return; - if (PyType_Ready(&PyDateTime_DeltaType) < 0) - return; - if (PyType_Ready(&PyDateTime_TimeType) < 0) - return; - if (PyType_Ready(&PyDateTime_TZInfoType) < 0) - return; - - /* timedelta values */ - d = PyDateTime_DeltaType.tp_dict; - - x = new_delta(0, 0, 1, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return; - Py_DECREF(x); - - x = new_delta(-MAX_DELTA_DAYS, 0, 0, 0); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return; - Py_DECREF(x); - - x = new_delta(MAX_DELTA_DAYS, 24*3600-1, 1000000-1, 0); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return; - Py_DECREF(x); - - /* date values */ - d = PyDateTime_DateType.tp_dict; - - x = new_date(1, 1, 1); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return; - Py_DECREF(x); - - x = new_date(MAXYEAR, 12, 31); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return; - Py_DECREF(x); - - x = new_delta(1, 0, 0, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return; - Py_DECREF(x); - - /* time values */ - d = PyDateTime_TimeType.tp_dict; - - x = new_time(0, 0, 0, 0, Py_None); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return; - Py_DECREF(x); - - x = new_time(23, 59, 59, 999999, Py_None); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return; - Py_DECREF(x); - - x = new_delta(0, 0, 1, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return; - Py_DECREF(x); - - /* datetime values */ - d = PyDateTime_DateTimeType.tp_dict; - - x = new_datetime(1, 1, 1, 0, 0, 0, 0, Py_None); - if (x == NULL || PyDict_SetItemString(d, "min", x) < 0) - return; - Py_DECREF(x); - - x = new_datetime(MAXYEAR, 12, 31, 23, 59, 59, 999999, Py_None); - if (x == NULL || PyDict_SetItemString(d, "max", x) < 0) - return; - Py_DECREF(x); - - x = new_delta(0, 0, 1, 0); - if (x == NULL || PyDict_SetItemString(d, "resolution", x) < 0) - return; - Py_DECREF(x); - - /* module initialization */ - PyModule_AddIntConstant(m, "MINYEAR", MINYEAR); - PyModule_AddIntConstant(m, "MAXYEAR", MAXYEAR); - - Py_INCREF(&PyDateTime_DateType); - PyModule_AddObject(m, "date", (PyObject *) &PyDateTime_DateType); - - Py_INCREF(&PyDateTime_DateTimeType); - PyModule_AddObject(m, "datetime", - (PyObject *)&PyDateTime_DateTimeType); - - Py_INCREF(&PyDateTime_TimeType); - PyModule_AddObject(m, "time", (PyObject *) &PyDateTime_TimeType); - - Py_INCREF(&PyDateTime_DeltaType); - PyModule_AddObject(m, "timedelta", (PyObject *) &PyDateTime_DeltaType); - - Py_INCREF(&PyDateTime_TZInfoType); - PyModule_AddObject(m, "tzinfo", (PyObject *) &PyDateTime_TZInfoType); - - x = PyCapsule_New(&CAPI, PyDateTime_CAPSULE_NAME, NULL); - if (x == NULL) - return; - PyModule_AddObject(m, "datetime_CAPI", x); - - /* A 4-year cycle has an extra leap day over what we'd get from - * pasting together 4 single years. - */ - assert(DI4Y == 4 * 365 + 1); - assert(DI4Y == days_before_year(4+1)); - - /* Similarly, a 400-year cycle has an extra leap day over what we'd - * get from pasting together 4 100-year cycles. - */ - assert(DI400Y == 4 * DI100Y + 1); - assert(DI400Y == days_before_year(400+1)); - - /* OTOH, a 100-year cycle has one fewer leap day than we'd get from - * pasting together 25 4-year cycles. - */ - assert(DI100Y == 25 * DI4Y - 1); - assert(DI100Y == days_before_year(100+1)); - - us_per_us = PyInt_FromLong(1); - us_per_ms = PyInt_FromLong(1000); - us_per_second = PyInt_FromLong(1000000); - us_per_minute = PyInt_FromLong(60000000); - seconds_per_day = PyInt_FromLong(24 * 3600); - if (us_per_us == NULL || us_per_ms == NULL || us_per_second == NULL || - us_per_minute == NULL || seconds_per_day == NULL) - return; - - /* The rest are too big for 32-bit ints, but even - * us_per_week fits in 40 bits, so doubles should be exact. - */ - us_per_hour = PyLong_FromDouble(3600000000.0); - us_per_day = PyLong_FromDouble(86400000000.0); - us_per_week = PyLong_FromDouble(604800000000.0); - if (us_per_hour == NULL || us_per_day == NULL || us_per_week == NULL) - return; -} - -/* --------------------------------------------------------------------------- -Some time zone algebra. For a datetime x, let - x.n = x stripped of its timezone -- its naive time. - x.o = x.utcoffset(), and assuming that doesn't raise an exception or - return None - x.d = x.dst(), and assuming that doesn't raise an exception or - return None - x.s = x's standard offset, x.o - x.d - -Now some derived rules, where k is a duration (timedelta). - -1. x.o = x.s + x.d - This follows from the definition of x.s. - -2. If x and y have the same tzinfo member, x.s = y.s. - This is actually a requirement, an assumption we need to make about - sane tzinfo classes. - -3. The naive UTC time corresponding to x is x.n - x.o. - This is again a requirement for a sane tzinfo class. - -4. (x+k).s = x.s - This follows from #2, and that datimetimetz+timedelta preserves tzinfo. - -5. (x+k).n = x.n + k - Again follows from how arithmetic is defined. - -Now we can explain tz.fromutc(x). Let's assume it's an interesting case -(meaning that the various tzinfo methods exist, and don't blow up or return -None when called). - -The function wants to return a datetime y with timezone tz, equivalent to x. -x is already in UTC. - -By #3, we want - - y.n - y.o = x.n [1] - -The algorithm starts by attaching tz to x.n, and calling that y. So -x.n = y.n at the start. Then it wants to add a duration k to y, so that [1] -becomes true; in effect, we want to solve [2] for k: - - (y+k).n - (y+k).o = x.n [2] - -By #1, this is the same as - - (y+k).n - ((y+k).s + (y+k).d) = x.n [3] - -By #5, (y+k).n = y.n + k, which equals x.n + k because x.n=y.n at the start. -Substituting that into [3], - - x.n + k - (y+k).s - (y+k).d = x.n; the x.n terms cancel, leaving - k - (y+k).s - (y+k).d = 0; rearranging, - k = (y+k).s - (y+k).d; by #4, (y+k).s == y.s, so - k = y.s - (y+k).d - -On the RHS, (y+k).d can't be computed directly, but y.s can be, and we -approximate k by ignoring the (y+k).d term at first. Note that k can't be -very large, since all offset-returning methods return a duration of magnitude -less than 24 hours. For that reason, if y is firmly in std time, (y+k).d must -be 0, so ignoring it has no consequence then. - -In any case, the new value is - - z = y + y.s [4] - -It's helpful to step back at look at [4] from a higher level: it's simply -mapping from UTC to tz's standard time. - -At this point, if - - z.n - z.o = x.n [5] - -we have an equivalent time, and are almost done. The insecurity here is -at the start of daylight time. Picture US Eastern for concreteness. The wall -time jumps from 1:59 to 3:00, and wall hours of the form 2:MM don't make good -sense then. The docs ask that an Eastern tzinfo class consider such a time to -be EDT (because it's "after 2"), which is a redundant spelling of 1:MM EST -on the day DST starts. We want to return the 1:MM EST spelling because that's -the only spelling that makes sense on the local wall clock. - -In fact, if [5] holds at this point, we do have the standard-time spelling, -but that takes a bit of proof. We first prove a stronger result. What's the -difference between the LHS and RHS of [5]? Let - - diff = x.n - (z.n - z.o) [6] - -Now - z.n = by [4] - (y + y.s).n = by #5 - y.n + y.s = since y.n = x.n - x.n + y.s = since z and y are have the same tzinfo member, - y.s = z.s by #2 - x.n + z.s - -Plugging that back into [6] gives - - diff = - x.n - ((x.n + z.s) - z.o) = expanding - x.n - x.n - z.s + z.o = cancelling - - z.s + z.o = by #2 - z.d - -So diff = z.d. - -If [5] is true now, diff = 0, so z.d = 0 too, and we have the standard-time -spelling we wanted in the endcase described above. We're done. Contrarily, -if z.d = 0, then we have a UTC equivalent, and are also done. - -If [5] is not true now, diff = z.d != 0, and z.d is the offset we need to -add to z (in effect, z is in tz's standard time, and we need to shift the -local clock into tz's daylight time). - -Let - - z' = z + z.d = z + diff [7] - -and we can again ask whether - - z'.n - z'.o = x.n [8] - -If so, we're done. If not, the tzinfo class is insane, according to the -assumptions we've made. This also requires a bit of proof. As before, let's -compute the difference between the LHS and RHS of [8] (and skipping some of -the justifications for the kinds of substitutions we've done several times -already): - - diff' = x.n - (z'.n - z'.o) = replacing z'.n via [7] - x.n - (z.n + diff - z'.o) = replacing diff via [6] - x.n - (z.n + x.n - (z.n - z.o) - z'.o) = - x.n - z.n - x.n + z.n - z.o + z'.o = cancel x.n - - z.n + z.n - z.o + z'.o = cancel z.n - - z.o + z'.o = #1 twice - -z.s - z.d + z'.s + z'.d = z and z' have same tzinfo - z'.d - z.d - -So z' is UTC-equivalent to x iff z'.d = z.d at this point. If they are equal, -we've found the UTC-equivalent so are done. In fact, we stop with [7] and -return z', not bothering to compute z'.d. - -How could z.d and z'd differ? z' = z + z.d [7], so merely moving z' by -a dst() offset, and starting *from* a time already in DST (we know z.d != 0), -would have to change the result dst() returns: we start in DST, and moving -a little further into it takes us out of DST. - -There isn't a sane case where this can happen. The closest it gets is at -the end of DST, where there's an hour in UTC with no spelling in a hybrid -tzinfo class. In US Eastern, that's 5:MM UTC = 0:MM EST = 1:MM EDT. During -that hour, on an Eastern clock 1:MM is taken as being in standard time (6:MM -UTC) because the docs insist on that, but 0:MM is taken as being in daylight -time (4:MM UTC). There is no local time mapping to 5:MM UTC. The local -clock jumps from 1:59 back to 1:00 again, and repeats the 1:MM hour in -standard time. Since that's what the local clock *does*, we want to map both -UTC hours 5:MM and 6:MM to 1:MM Eastern. The result is ambiguous -in local time, but so it goes -- it's the way the local clock works. - -When x = 5:MM UTC is the input to this algorithm, x.o=0, y.o=-5 and y.d=0, -so z=0:MM. z.d=60 (minutes) then, so [5] doesn't hold and we keep going. -z' = z + z.d = 1:MM then, and z'.d=0, and z'.d - z.d = -60 != 0 so [8] -(correctly) concludes that z' is not UTC-equivalent to x. - -Because we know z.d said z was in daylight time (else [5] would have held and -we would have stopped then), and we know z.d != z'.d (else [8] would have held -and we would have stopped then), and there are only 2 possible values dst() can -return in Eastern, it follows that z'.d must be 0 (which it is in the example, -but the reasoning doesn't depend on the example -- it depends on there being -two possible dst() outcomes, one zero and the other non-zero). Therefore -z' must be in standard time, and is the spelling we want in this case. - -Note again that z' is not UTC-equivalent as far as the hybrid tzinfo class is -concerned (because it takes z' as being in standard time rather than the -daylight time we intend here), but returning it gives the real-life "local -clock repeats an hour" behavior when mapping the "unspellable" UTC hour into -tz. - -When the input is 6:MM, z=1:MM and z.d=0, and we stop at once, again with -the 1:MM standard time spelling we want. - -So how can this break? One of the assumptions must be violated. Two -possibilities: - -1) [2] effectively says that y.s is invariant across all y belong to a given - time zone. This isn't true if, for political reasons or continental drift, - a region decides to change its base offset from UTC. - -2) There may be versions of "double daylight" time where the tail end of - the analysis gives up a step too early. I haven't thought about that - enough to say. - -In any case, it's clear that the default fromutc() is strong enough to handle -"almost all" time zones: so long as the standard offset is invariant, it -doesn't matter if daylight time transition points change from year to year, or -if daylight time is skipped in some years; it doesn't matter how large or -small dst() may get within its bounds; and it doesn't even matter if some -perverse time zone returns a negative dst()). So a breaking case must be -pretty bizarre, and a tzinfo subclass can override fromutc() if it is. ---------------------------------------------------------------------------- */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/COPYING b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/COPYING deleted file mode 100644 index 9c86f4d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/COPYING +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - and Clark Cooper -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/ascii.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/ascii.h deleted file mode 100644 index 73b2712..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/ascii.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define ASCII_A 0x41 -#define ASCII_B 0x42 -#define ASCII_C 0x43 -#define ASCII_D 0x44 -#define ASCII_E 0x45 -#define ASCII_F 0x46 -#define ASCII_G 0x47 -#define ASCII_H 0x48 -#define ASCII_I 0x49 -#define ASCII_J 0x4A -#define ASCII_K 0x4B -#define ASCII_L 0x4C -#define ASCII_M 0x4D -#define ASCII_N 0x4E -#define ASCII_O 0x4F -#define ASCII_P 0x50 -#define ASCII_Q 0x51 -#define ASCII_R 0x52 -#define ASCII_S 0x53 -#define ASCII_T 0x54 -#define ASCII_U 0x55 -#define ASCII_V 0x56 -#define ASCII_W 0x57 -#define ASCII_X 0x58 -#define ASCII_Y 0x59 -#define ASCII_Z 0x5A - -#define ASCII_a 0x61 -#define ASCII_b 0x62 -#define ASCII_c 0x63 -#define ASCII_d 0x64 -#define ASCII_e 0x65 -#define ASCII_f 0x66 -#define ASCII_g 0x67 -#define ASCII_h 0x68 -#define ASCII_i 0x69 -#define ASCII_j 0x6A -#define ASCII_k 0x6B -#define ASCII_l 0x6C -#define ASCII_m 0x6D -#define ASCII_n 0x6E -#define ASCII_o 0x6F -#define ASCII_p 0x70 -#define ASCII_q 0x71 -#define ASCII_r 0x72 -#define ASCII_s 0x73 -#define ASCII_t 0x74 -#define ASCII_u 0x75 -#define ASCII_v 0x76 -#define ASCII_w 0x77 -#define ASCII_x 0x78 -#define ASCII_y 0x79 -#define ASCII_z 0x7A - -#define ASCII_0 0x30 -#define ASCII_1 0x31 -#define ASCII_2 0x32 -#define ASCII_3 0x33 -#define ASCII_4 0x34 -#define ASCII_5 0x35 -#define ASCII_6 0x36 -#define ASCII_7 0x37 -#define ASCII_8 0x38 -#define ASCII_9 0x39 - -#define ASCII_TAB 0x09 -#define ASCII_SPACE 0x20 -#define ASCII_EXCL 0x21 -#define ASCII_QUOT 0x22 -#define ASCII_AMP 0x26 -#define ASCII_APOS 0x27 -#define ASCII_MINUS 0x2D -#define ASCII_PERIOD 0x2E -#define ASCII_COLON 0x3A -#define ASCII_SEMI 0x3B -#define ASCII_LT 0x3C -#define ASCII_EQUALS 0x3D -#define ASCII_GT 0x3E -#define ASCII_LSQB 0x5B -#define ASCII_RSQB 0x5D -#define ASCII_UNDERSCORE 0x5F -#define ASCII_LPAREN 0x28 -#define ASCII_RPAREN 0x29 -#define ASCII_FF 0x0C -#define ASCII_SLASH 0x2F -#define ASCII_HASH 0x23 -#define ASCII_PIPE 0x7C -#define ASCII_COMMA 0x2C diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/asciitab.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/asciitab.h deleted file mode 100644 index 2ef65c7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/asciitab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat.h deleted file mode 100644 index ff5a2e7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat.h +++ /dev/null @@ -1,1049 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_INCLUDED -#define Expat_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler -#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler -#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler -#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg -#endif - -#include -#include "expat_external.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct XML_ParserStruct; -typedef struct XML_ParserStruct *XML_Parser; - -/* Should this be defined using stdbool.h when C99 is available? */ -typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) - -/* The XML_Status enum gives the possible return values for several - API functions. The preprocessor #defines are included so this - stanza can be added to code that still needs to support older - versions of Expat 1.95.x: - - #ifndef XML_STATUS_OK - #define XML_STATUS_OK 1 - #define XML_STATUS_ERROR 0 - #endif - - Otherwise, the #define hackery is quite ugly and would have been - dropped. -*/ -enum XML_Status { - XML_STATUS_ERROR = 0, -#define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1, -#define XML_STATUS_OK XML_STATUS_OK - XML_STATUS_SUSPENDED = 2 -#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED -}; - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, - /* Added in 1.95.7. */ - XML_ERROR_UNBOUND_PREFIX, - /* Added in 1.95.8. */ - XML_ERROR_UNDECLARING_PREFIX, - XML_ERROR_INCOMPLETE_PE, - XML_ERROR_XML_DECL, - XML_ERROR_TEXT_DECL, - XML_ERROR_PUBLICID, - XML_ERROR_SUSPENDED, - XML_ERROR_NOT_SUSPENDED, - XML_ERROR_ABORTED, - XML_ERROR_FINISHED, - XML_ERROR_SUSPEND_PE, - /* Added in 2.0. */ - XML_ERROR_RESERVED_PREFIX_XML, - XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI -}; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be - XML_CQUANT_NONE, and the other fields will be zero or NULL. - If type == XML_CTYPE_MIXED, then quant will be NONE or REP and - numchildren will contain number of elements that may be mixed in - and children point to an array of XML_Content cells that will be - all of XML_CTYPE_NAME type with no quantification. - - If type == XML_CTYPE_NAME, then the name points to the name, and - the numchildren field will be zero and children will be NULL. The - quant fields indicates any quantifiers placed on the name. - - CHOICE and SEQ will have name NULL, the number of children in - numchildren and children will point, recursively, to an array - of XML_Content cells. - - The EMPTY, ANY, and MIXED types will only occur at top level. -*/ - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -/* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. -*/ -typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -XMLPARSEAPI(void) -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -/* The Attlist declaration handler is called for *each* attribute. So - a single Attlist declaration with multiple attributes declared will - generate multiple calls to this handler. The "default" parameter - may be NULL in the case of the "#IMPLIED" or "#REQUIRED" - keyword. The "isrequired" parameter will be true and the default - value will be NULL in the case of "#REQUIRED". If "isrequired" is - true and default is non-NULL, then this is a "#FIXED" default. -*/ -typedef void (XMLCALL *XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -XMLPARSEAPI(void) -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - -/* The XML declaration handler is called for *both* XML declarations - and text declarations. The way to distinguish is that the version - parameter will be NULL for text declarations. The encoding - parameter may be NULL for XML declarations. The standalone - parameter will be -1, 0, or 1 indicating respectively that there - was no standalone parameter in the declaration, that it was given - as no, or that it was given as yes. -*/ -typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -XMLPARSEAPI(void) -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -/* Constructs a new parser; encoding is the encoding specified by the - external protocol or NULL if there is none specified. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate(const XML_Char *encoding); - -/* Constructs a new parser and namespace processor. Element type - names and attribute names that belong to a namespace will be - expanded; unprefixed attribute names are never expanded; unprefixed - element type names are expanded only if there is a default - namespace. The expanded name is the concatenation of the namespace - URI, the namespace separator character, and the local part of the - name. If the namespace separator is '\0' then the namespace URI - and the local part will be concatenated without any separator. - It is a programming error to use the separator '\0' with namespace - triplets (see XML_SetReturnNSTriplet). -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -/* Constructs a new parser using the memory management suite referred to - by memsuite. If memsuite is NULL, then use the standard library memory - suite. If namespaceSeparator is non-NULL it creates a parser with - namespace processing as described above. The character pointed at - will serve as the namespace separator. - - All further memory operations used for the created parser will come from - the given suite. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -/* Prepare a parser object to be re-used. This is particularly - valuable when memory allocation overhead is disproportionatly high, - such as when a large number of small documnents need to be parsed. - All handlers are cleared from the parser, except for the - unknownEncodingHandler. The parser's external state is re-initialized - except for the values of ns and ns_triplets. - - Added in Expat 1.95.3. -*/ -XMLPARSEAPI(XML_Bool) -XML_ParserReset(XML_Parser parser, const XML_Char *encoding); - -/* atts is array of name/value pairs, terminated by 0; - names and values are 0 terminated. -*/ -typedef void (XMLCALL *XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (XMLCALL *XML_EndElementHandler) (void *userData, - const XML_Char *name); - - -/* s is not 0 terminated. */ -typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); - -/* target and data are 0 terminated */ -typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); - -/* data is 0 terminated */ -typedef void (XMLCALL *XML_CommentHandler) (void *userData, - const XML_Char *data); - -typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); -typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); - -/* This is called for any characters in the XML document for which - there is no applicable handler. This includes both characters that - are part of markup which is of a kind that is not reported - (comments, markup declarations), or characters that are part of a - construct which could be reported but for which no handler has been - supplied. The characters are passed exactly as they were in the XML - document except that they will be encoded in UTF-8 or UTF-16. - Line boundaries are not normalized. Note that a byte order mark - character is not passed to the default handler. There are no - guarantees about how characters are divided between calls to the - default handler: for example, a comment might be split between - multiple calls. -*/ -typedef void (XMLCALL *XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); - -/* This is called for the start of the DOCTYPE declaration, before - any DTD or internal subset is parsed. -*/ -typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); - -/* This is called for the start of the DOCTYPE declaration when the - closing > is encountered, but after processing any external - subset. -*/ -typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); - -/* This is called for entity declarations. The is_parameter_entity - argument will be non-zero if the entity is a parameter entity, zero - otherwise. - - For internal entities (), value will - be non-NULL and systemId, publicID, and notationName will be NULL. - The value string is NOT nul-terminated; the length is provided in - the value_length argument. Since it is legal to have zero-length - values, do not use this argument to test for internal entities. - - For external entities, value will be NULL and systemId will be - non-NULL. The publicId argument will be NULL unless a public - identifier was provided. The notationName argument will have a - non-NULL value only for unparsed entity declarations. - - Note that is_parameter_entity can't be changed to XML_Bool, since - that would break binary compatibility. -*/ -typedef void (XMLCALL *XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -XMLPARSEAPI(void) -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -/* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. - It is provided here for backward compatibility. - - This is called for a declaration of an unparsed (NDATA) entity. - The base argument is whatever was set by XML_SetBase. The - entityName, systemId and notationName arguments will never be - NULL. The other arguments may be. -*/ -typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -/* This is called for a declaration of notation. The base argument is - whatever was set by XML_SetBase. The notationName will never be - NULL. The other arguments can be. -*/ -typedef void (XMLCALL *XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* When namespace processing is enabled, these are called once for - each namespace declaration. The call to the start and end element - handlers occur between the calls to the start and end namespace - declaration handlers. For an xmlns attribute, prefix will be - NULL. For an xmlns="" attribute, uri will be NULL. -*/ -typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); - -/* This is called if the document is not standalone, that is, it has an - external subset or a reference to a parameter entity, but does not - have standalone="yes". If this handler returns XML_STATUS_ERROR, - then processing will not continue, and the parser will return a - XML_ERROR_NOT_STANDALONE error. - If parameter entity parsing is enabled, then in addition to the - conditions above this handler will only be called if the referenced - entity was actually read. -*/ -typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); - -/* This is called for a reference to an external parsed general - entity. The referenced entity is not automatically parsed. The - application can parse it immediately or later using - XML_ExternalEntityParserCreate. - - The parser argument is the parser parsing the entity containing the - reference; it can be passed as the parser argument to - XML_ExternalEntityParserCreate. The systemId argument is the - system identifier as specified in the entity declaration; it will - not be NULL. - - The base argument is the system identifier that should be used as - the base for resolving systemId if systemId was relative; this is - set by XML_SetBase; it may be NULL. - - The publicId argument is the public identifier as specified in the - entity declaration, or NULL if none was specified; the whitespace - in the public identifier will have been normalized as required by - the XML spec. - - The context argument specifies the parsing context in the format - expected by the context argument to XML_ExternalEntityParserCreate; - context is valid only until the handler returns, so if the - referenced entity is to be parsed later, it must be copied. - context is NULL only when the entity is a parameter entity. - - The handler should return XML_STATUS_ERROR if processing should not - continue because of a fatal error in the handling of the external - entity. In this case the calling parser will return an - XML_ERROR_EXTERNAL_ENTITY_HANDLING error. - - Note that unlike other handlers the first argument is the parser, - not userData. -*/ -typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* This is called in two situations: - 1) An entity reference is encountered for which no declaration - has been read *and* this is not an error. - 2) An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler has been called. - Note: skipped parameter entities in declarations and skipped general - entities in attribute values cannot be reported, because - the event would be out of sync with the reporting of the - declarations or attribute values -*/ -typedef void (XMLCALL *XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); - -/* This structure is filled in by the XML_UnknownEncodingHandler to - provide information to the parser about encodings that are unknown - to the parser. - - The map[b] member gives information about byte sequences whose - first byte is b. - - If map[b] is c where c is >= 0, then b by itself encodes the - Unicode scalar value c. - - If map[b] is -1, then the byte sequence is malformed. - - If map[b] is -n, where n >= 2, then b is the first byte of an - n-byte sequence that encodes a single Unicode scalar value. - - The data member will be passed as the first argument to the convert - function. - - The convert function is used to convert multibyte sequences; s will - point to a n-byte sequence where map[(unsigned char)*s] == -n. The - convert function must return the Unicode scalar value represented - by this byte sequence or -1 if the byte sequence is malformed. - - The convert function may be NULL if the encoding is a single-byte - encoding, that is if map[b] >= -1 for all bytes b. - - When the parser is finished with the encoding, then if release is - not NULL, it will call release passing it the data member; once - release has been called, the convert function will not be called - again. - - Expat places certain restrictions on the encodings that are supported - using this mechanism. - - 1. Every ASCII character that can appear in a well-formed XML document, - other than the characters - - $@\^`{}~ - - must be represented by a single byte, and that byte must be the - same byte that represents that character in ASCII. - - 2. No character may require more than 4 bytes to encode. - - 3. All characters encoded must have Unicode scalar values <= - 0xFFFF, (i.e., characters that would be encoded by surrogates in - UTF-16 are not allowed). Note that this restriction doesn't - apply to the built-in support for UTF-8 and UTF-16. - - 4. No Unicode character may be encoded by more than one distinct - sequence of bytes. -*/ -typedef struct { - int map[256]; - void *data; - int (XMLCALL *convert)(void *data, const char *s); - void (XMLCALL *release)(void *data); -} XML_Encoding; - -/* This is called for an encoding that is unknown to the parser. - - The encodingHandlerData argument is that which was passed as the - second argument to XML_SetUnknownEncodingHandler. - - The name argument gives the name of the encoding as specified in - the encoding declaration. - - If the callback can provide information about the encoding, it must - fill in the XML_Encoding structure, and return XML_STATUS_OK. - Otherwise it must return XML_STATUS_ERROR. - - If info does not describe a suitable encoding, then the parser will - return an XML_UNKNOWN_ENCODING error. -*/ -typedef int (XMLCALL *XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -XMLPARSEAPI(void) -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -XMLPARSEAPI(void) -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler handler); - -XMLPARSEAPI(void) -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler handler); - -XMLPARSEAPI(void) -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -XMLPARSEAPI(void) -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -XMLPARSEAPI(void) -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -XMLPARSEAPI(void) -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -XMLPARSEAPI(void) -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -XMLPARSEAPI(void) -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -/* This sets the default handler and also inhibits expansion of - internal entities. These entity references will be passed to the - default handler, or to the skipped entity handler, if one is set. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -/* This sets the default handler but does not inhibit expansion of - internal entities. The entity reference will not be passed to the - default handler. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -XMLPARSEAPI(void) -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -/* If a non-NULL value for arg is specified here, then it will be - passed as the first argument to the external entity ref handler - instead of the parser object. -*/ -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, - void *arg); - -XMLPARSEAPI(void) -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); - -XMLPARSEAPI(void) -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -/* This can be called within a handler for a start element, end - element, processing instruction or character data. It causes the - corresponding markup to be passed to the default handler. -*/ -XMLPARSEAPI(void) -XML_DefaultCurrent(XML_Parser parser); - -/* If do_nst is non-zero, and namespace processing is in effect, and - a name has a prefix (i.e. an explicit namespace qualifier) then - that name is returned as a triplet in a single string separated by - the separator character specified when the parser was created: URI - + sep + local_name + sep + prefix. - - If do_nst is zero, then namespace information is returned in the - default manner (URI + sep + local_name) whether or not the name - has a prefix. - - Note: Calling XML_SetReturnNSTriplet after XML_Parse or - XML_ParseBuffer has no effect. -*/ - -XMLPARSEAPI(void) -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -/* This value is passed as the userData argument to callbacks. */ -XMLPARSEAPI(void) -XML_SetUserData(XML_Parser parser, void *userData); - -/* Returns the last value set by XML_SetUserData or NULL. */ -#define XML_GetUserData(parser) (*(void **)(parser)) - -/* This is equivalent to supplying an encoding argument to - XML_ParserCreate. On success XML_SetEncoding returns non-zero, - zero otherwise. - Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer - has no effect and returns XML_STATUS_ERROR. -*/ -XMLPARSEAPI(enum XML_Status) -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -/* If this function is called, then the parser will be passed as the - first argument to callbacks instead of userData. The userData will - still be accessible using XML_GetUserData. -*/ -XMLPARSEAPI(void) -XML_UseParserAsHandlerArg(XML_Parser parser); - -/* If useDTD == XML_TRUE is passed to this function, then the parser - will assume that there is an external subset, even if none is - specified in the document. In such a case the parser will call the - externalEntityRefHandler with a value of NULL for the systemId - argument (the publicId and context arguments will be NULL as well). - Note: For the purpose of checking WFC: Entity Declared, passing - useDTD == XML_TRUE will make the parser behave as if the document - had a DTD with an external subset. - Note: If this function is called, then this must be done before - the first call to XML_Parse or XML_ParseBuffer, since it will - have no effect after that. Returns - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. - Note: If the document does not have a DOCTYPE declaration at all, - then startDoctypeDeclHandler and endDoctypeDeclHandler will not - be called, despite an external subset being parsed. - Note: If XML_DTD is not defined when Expat is compiled, returns - XML_ERROR_FEATURE_REQUIRES_XML_DTD. -*/ -XMLPARSEAPI(enum XML_Error) -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - - -/* Sets the base to be used for resolving relative URIs in system - identifiers in declarations. Resolving relative identifiers is - left to the application: this value will be passed through as the - base argument to the XML_ExternalEntityRefHandler, - XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base - argument will be copied. Returns XML_STATUS_ERROR if out of memory, - XML_STATUS_OK otherwise. -*/ -XMLPARSEAPI(enum XML_Status) -XML_SetBase(XML_Parser parser, const XML_Char *base); - -XMLPARSEAPI(const XML_Char *) -XML_GetBase(XML_Parser parser); - -/* Returns the number of the attribute/value pairs passed in last call - to the XML_StartElementHandler that were specified in the start-tag - rather than defaulted. Each attribute/value pair counts as 2; thus - this correspondds to an index into the atts array passed to the - XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -/* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetIdAttributeIndex(XML_Parser parser); - -#ifdef XML_ATTR_INFO -/* Source file byte offsets for the start and end of attribute names and values. - The value indices are exclusive of surrounding quotes; thus in a UTF-8 source - file an attribute value of "blah" will yield: - info->valueEnd - info->valueStart = 4 bytes. -*/ -typedef struct { - XML_Index nameStart; /* Offset to beginning of the attribute name. */ - XML_Index nameEnd; /* Offset after the attribute name's last byte. */ - XML_Index valueStart; /* Offset to beginning of the attribute value. */ - XML_Index valueEnd; /* Offset after the attribute value's last byte. */ -} XML_AttrInfo; - -/* Returns an array of XML_AttrInfo structures for the attribute/value pairs - passed in last call to the XML_StartElementHandler that were specified - in the start-tag rather than defaulted. Each attribute/value pair counts - as 1; thus the number of entries in the array is - XML_GetSpecifiedAttributeCount(parser) / 2. -*/ -XMLPARSEAPI(const XML_AttrInfo *) -XML_GetAttributeInfo(XML_Parser parser); -#endif - -/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is - detected. The last call to XML_Parse must have isFinal true; len - may be zero for this call (or any other). - - Though the return values for these functions has always been - described as a Boolean value, the implementation, at least for the - 1.95.x series, has always returned exactly one of the XML_Status - values. -*/ -XMLPARSEAPI(enum XML_Status) -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -XMLPARSEAPI(void *) -XML_GetBuffer(XML_Parser parser, int len); - -XMLPARSEAPI(enum XML_Status) -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. - Must be called from within a call-back handler, except when aborting - (resumable = 0) an already suspended parser. Some call-backs may - still follow because they would otherwise get lost. Examples: - - endElementHandler() for empty elements when stopped in - startElementHandler(), - - endNameSpaceDeclHandler() when stopped in endElementHandler(), - and possibly others. - - Can be called from most handlers, including DTD related call-backs, - except when parsing an external parameter entity and resumable != 0. - Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. - Possible error codes: - - XML_ERROR_SUSPENDED: when suspending an already suspended parser. - - XML_ERROR_FINISHED: when the parser has already finished. - - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. - - When resumable != 0 (true) then parsing is suspended, that is, - XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. - Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() - return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. - - *Note*: - This will be applied to the current parser instance only, that is, if - there is a parent parser then it will continue parsing when the - externalEntityRefHandler() returns. It is up to the implementation of - the externalEntityRefHandler() to call XML_StopParser() on the parent - parser (recursively), if one wants to stop parsing altogether. - - When suspended, parsing can be resumed by calling XML_ResumeParser(). -*/ -XMLPARSEAPI(enum XML_Status) -XML_StopParser(XML_Parser parser, XML_Bool resumable); - -/* Resumes parsing after it has been suspended with XML_StopParser(). - Must not be called from within a handler call-back. Returns same - status codes as XML_Parse() or XML_ParseBuffer(). - Additional error code XML_ERROR_NOT_SUSPENDED possible. - - *Note*: - This must be called on the most deeply nested child parser instance - first, and on its parent parser only after the child parser has finished, - to be applied recursively until the document entity's parser is restarted. - That is, the parent parser will not resume by itself and it is up to the - application to call XML_ResumeParser() on it at the appropriate moment. -*/ -XMLPARSEAPI(enum XML_Status) -XML_ResumeParser(XML_Parser parser); - -enum XML_Parsing { - XML_INITIALIZED, - XML_PARSING, - XML_FINISHED, - XML_SUSPENDED -}; - -typedef struct { - enum XML_Parsing parsing; - XML_Bool finalBuffer; -} XML_ParsingStatus; - -/* Returns status of parser with respect to being initialized, parsing, - finished, or suspended and processing the final buffer. - XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, - XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED -*/ -XMLPARSEAPI(void) -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); - -/* Creates an XML_Parser object that can parse an external general - entity; context is a '\0'-terminated string specifying the parse - context; encoding is a '\0'-terminated string giving the name of - the externally specified encoding, or NULL if there is no - externally specified encoding. The context string consists of a - sequence of tokens separated by formfeeds (\f); a token consisting - of a name specifies that the general entity of the name is open; a - token of the form prefix=uri specifies the namespace for a - particular prefix; a token of the form =uri specifies the default - namespace. This can be called at any point after the first call to - an ExternalEntityRefHandler so longer as the parser has not yet - been freed. The new parser is completely independent and may - safely be used in a separate thread. The handlers and userData are - initialized from the parser argument. Returns NULL if out of memory. - Otherwise returns a new XML_Parser object. -*/ -XMLPARSEAPI(XML_Parser) -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -/* Controls parsing of parameter entities (including the external DTD - subset). If parsing of parameter entities is enabled, then - references to external parameter entities (including the external - DTD subset) will be passed to the handler set with - XML_SetExternalEntityRefHandler. The context passed will be 0. - - Unlike external general entities, external parameter entities can - only be parsed synchronously. If the external parameter entity is - to be parsed, it must be parsed during the call to the external - entity ref handler: the complete sequence of - XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and - XML_ParserFree calls must be made during this call. After - XML_ExternalEntityParserCreate has been called to create the parser - for the external parameter entity (context must be 0 for this - call), it is illegal to make any calls on the old parser until - XML_ParserFree has been called on the newly created parser. - If the library has been compiled without support for parameter - entity parsing (ie without XML_DTD being defined), then - XML_SetParamEntityParsing will return 0 if parsing of parameter - entities is requested; otherwise it will return non-zero. - Note: If XML_SetParamEntityParsing is called after XML_Parse or - XML_ParseBuffer, then it has no effect and will always return 0. -*/ -XMLPARSEAPI(int) -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -/* Sets the hash salt to use for internal hash calculations. - Helps in preventing DoS attacks based on predicting hash - function behavior. This must be called before parsing is started. - Returns 1 if successful, 0 when called after parsing has started. -*/ -XMLPARSEAPI(int) -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt); - -#define XML_HAS_SET_HASH_SALT /* Python Only: Defined for pyexpat.c. */ - -/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then - XML_GetErrorCode returns information about the error. -*/ -XMLPARSEAPI(enum XML_Error) -XML_GetErrorCode(XML_Parser parser); - -/* These functions return information about the current parse - location. They may be called from any callback called to report - some parse event; in this case the location is the location of the - first of the sequence of characters that generated the event. When - called from callbacks generated by declarations in the document - prologue, the location identified isn't as neatly defined, but will - be within the relevant markup. When called outside of the callback - functions, the position indicated will be just past the last parse - event (regardless of whether there was an associated callback). - - They may also be called after returning from a call to XML_Parse - or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then - the location is the location of the character at which the error - was detected; otherwise the location is the location of the last - parse event, as described above. -*/ -XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); -XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); -XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); - -/* Return the number of bytes in the current event. - Returns 0 if the event is in an internal entity. -*/ -XMLPARSEAPI(int) -XML_GetCurrentByteCount(XML_Parser parser); - -/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets - the integer pointed to by offset to the offset within this buffer - of the current parse position, and sets the integer pointed to by size - to the size of this buffer (the number of input bytes). Otherwise - returns a NULL pointer. Also returns a NULL pointer if a parse isn't - active. - - NOTE: The character pointer returned should not be used outside - the handler that makes the call. -*/ -XMLPARSEAPI(const char *) -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -/* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -/* Frees the content model passed to the element declaration handler */ -XMLPARSEAPI(void) -XML_FreeContentModel(XML_Parser parser, XML_Content *model); - -/* Exposing the memory handling functions used in Expat */ -XMLPARSEAPI(void *) -XML_MemMalloc(XML_Parser parser, size_t size); - -XMLPARSEAPI(void *) -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); - -XMLPARSEAPI(void) -XML_MemFree(XML_Parser parser, void *ptr); - -/* Frees memory used by the parser. */ -XMLPARSEAPI(void) -XML_ParserFree(XML_Parser parser); - -/* Returns a string describing the error. */ -XMLPARSEAPI(const XML_LChar *) -XML_ErrorString(enum XML_Error code); - -/* Return a string containing the version number of this expat */ -XMLPARSEAPI(const XML_LChar *) -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -/* Return an XML_Expat_Version structure containing numeric version - number information for this version of expat. -*/ -XMLPARSEAPI(XML_Expat_Version) -XML_ExpatVersionInfo(void); - -/* Added in Expat 1.95.5. */ -enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR, - XML_FEATURE_NS, - XML_FEATURE_LARGE_SIZE, - XML_FEATURE_ATTR_INFO - /* Additional features must be added to the end of this enum. */ -}; - -typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; -} XML_Feature; - -XMLPARSEAPI(const XML_Feature *) -XML_GetFeatureList(void); - - -/* Expat follows the GNU/Linux convention of odd number minor version for - beta/development releases and even number minor version for stable - releases. Micro is bumped with each release, and set to 0 with each - change to major or minor version. -*/ -#define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_INCLUDED */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat_external.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat_external.h deleted file mode 100644 index 8210f41..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/expat_external.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_External_INCLUDED -#define Expat_External_INCLUDED 1 - -/* External API definitions */ - -/* Namespace external symbols to allow multiple libexpat version to - co-exist. */ -#include "pyexpatns.h" - -#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -#define XML_USE_MSC_EXTENSIONS 1 -#endif - -/* Expat tries very hard to make the API boundary very specifically - defined. There are two macros defined to control this boundary; - each of these can be defined before including this header to - achieve some different behavior, but doing so it not recommended or - tested frequently. - - XMLCALL - The calling convention to use for all calls across the - "library boundary." This will default to cdecl, and - try really hard to tell the compiler that's what we - want. - - XMLIMPORT - Whatever magic is needed to note that a function is - to be imported from a dynamically loaded library - (.dll, .so, or .sl, depending on your platform). - - The XMLCALL macro was added in Expat 1.95.7. The only one which is - expected to be directly useful in client code is XMLCALL. - - Note that on at least some Unix versions, the Expat library must be - compiled with the cdecl calling convention as the default since - system headers may assume the cdecl convention. -*/ -#ifndef XMLCALL -#if defined(_MSC_VER) -#define XMLCALL __cdecl -#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) -#define XMLCALL __attribute__((cdecl)) -#else -/* For any platform which uses this definition and supports more than - one calling convention, we need to extend this definition to - declare the convention used on that platform, if it's possible to - do so. - - If this is the case for your platform, please file a bug report - with information on how to identify your platform via the C - pre-processor and how to specify the same calling convention as the - platform's malloc() implementation. -*/ -#define XMLCALL -#endif -#endif /* not defined XMLCALL */ - - -#if !defined(XML_STATIC) && !defined(XMLIMPORT) -#ifndef XML_BUILDING_EXPAT -/* using Expat from an application */ - -#ifdef XML_USE_MSC_EXTENSIONS -#define XMLIMPORT __declspec(dllimport) -#endif - -#endif -#endif /* not defined XML_STATIC */ - - -/* If we didn't define it above, define it away: */ -#ifndef XMLIMPORT -#define XMLIMPORT -#endif - - -#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE -#endif - -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ -#ifdef XML_UNICODE_WCHAR_T -typedef wchar_t XML_Char; -typedef wchar_t XML_LChar; -#else -typedef unsigned short XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ -typedef char XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE */ - -#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -typedef __int64 XML_Index; -typedef unsigned __int64 XML_Size; -#else -typedef long long XML_Index; -typedef unsigned long long XML_Size; -#endif -#else -typedef long XML_Index; -typedef unsigned long XML_Size; -#endif /* XML_LARGE_SIZE */ - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_External_INCLUDED */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/iasciitab.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/iasciitab.h deleted file mode 100644 index 980686f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/iasciitab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/internal.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/internal.h deleted file mode 100644 index 3da3b78..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/internal.h +++ /dev/null @@ -1,73 +0,0 @@ -/* internal.h - - Internal definitions used by Expat. This is not needed to compile - client code. - - The following calling convention macros are defined for frequently - called functions: - - FASTCALL - Used for those internal functions that have a simple - body and a low number of arguments and local variables. - - PTRCALL - Used for functions called though function pointers. - - PTRFASTCALL - Like PTRCALL, but for low number of arguments. - - inline - Used for selected internal functions for which inlining - may improve performance on some platforms. - - Note: Use of these macros is based on judgement, not hard rules, - and therefore subject to change. -*/ - -#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) -/* We'll use this version by default only where we know it helps. - - regparm() generates warnings on Solaris boxes. See SF bug #692878. - - Instability reported with egcs on a RedHat Linux 7.3. - Let's comment out: - #define FASTCALL __attribute__((stdcall, regparm(3))) - and let's try this: -*/ -#define FASTCALL __attribute__((regparm(3))) -#define PTRFASTCALL __attribute__((regparm(3))) -#endif - -/* Using __fastcall seems to have an unexpected negative effect under - MS VC++, especially for function pointers, so we won't use it for - now on that platform. It may be reconsidered for a future release - if it can be made more effective. - Likely reason: __fastcall on Windows is like stdcall, therefore - the compiler cannot perform stack optimizations for call clusters. -*/ - -/* Make sure all of these are defined if they aren't already. */ - -#ifndef FASTCALL -#define FASTCALL -#endif - -#ifndef PTRCALL -#define PTRCALL -#endif - -#ifndef PTRFASTCALL -#define PTRFASTCALL -#endif - -#ifndef XML_MIN_SIZE -#if !defined(__cplusplus) && !defined(inline) -#ifdef __GNUC__ -#define inline __inline -#endif /* __GNUC__ */ -#endif -#endif /* XML_MIN_SIZE */ - -#ifdef __cplusplus -#define inline inline -#else -#ifndef inline -#define inline -#endif -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/latin1tab.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/latin1tab.h deleted file mode 100644 index 0c5b1ca..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/latin1tab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/nametab.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/nametab.h deleted file mode 100644 index adea34c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/nametab.h +++ /dev/null @@ -1,150 +0,0 @@ -static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, -}; -static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/utf8tab.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/utf8tab.h deleted file mode 100644 index 3419601..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/utf8tab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - - -/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, -/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlparse.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlparse.c deleted file mode 100644 index dfbc9d5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlparse.c +++ /dev/null @@ -1,6403 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include /* memset(), memcpy() */ -#include -#include /* UINT_MAX */ -#include /* time() */ - -#define XML_BUILDING_EXPAT 1 - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -#include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "ascii.h" -#include "expat.h" - -#ifdef XML_UNICODE -#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX -#define XmlConvert XmlUtf16Convert -#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS -#define XmlEncode XmlUtf16Encode -/* Using pointer subtraction to convert to integer type. */ -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1)) -typedef unsigned short ICHAR; -#else -#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX -#define XmlConvert XmlUtf8Convert -#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS -#define XmlEncode XmlUtf8Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) -typedef char ICHAR; -#endif - - -#ifndef XML_NS - -#define XmlInitEncodingNS XmlInitEncoding -#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding -#undef XmlGetInternalEncodingNS -#define XmlGetInternalEncodingNS XmlGetInternalEncoding -#define XmlParseXmlDeclNS XmlParseXmlDecl - -#endif - -#ifdef XML_UNICODE - -#ifdef XML_UNICODE_WCHAR_T -#define XML_T(x) (const wchar_t)x -#define XML_L(x) L ## x -#else -#define XML_T(x) (const unsigned short)x -#define XML_L(x) x -#endif - -#else - -#define XML_T(x) x -#define XML_L(x) x - -#endif - -/* Round up n to be a multiple of sz, where sz is a power of 2. */ -#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) - -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ - -#include "internal.h" -#include "xmltok.h" -#include "xmlrole.h" - -typedef const XML_Char *KEY; - -typedef struct { - KEY name; -} NAMED; - -typedef struct { - NAMED **v; - unsigned char power; - size_t size; - size_t used; - const XML_Memory_Handling_Suite *mem; -} HASH_TABLE; - -/* Basic character hash algorithm, taken from Python's string hash: - h = h * 1000003 ^ character, the constant being a prime number. - -*/ -#ifdef XML_UNICODE -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned short)(c)) -#else -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned char)(c)) -#endif - -/* For probing (after a collision) we need a step size relative prime - to the hash table size, which is a power of 2. We use double-hashing, - since we can calculate a second hash value cheaply by taking those bits - of the first hash value that were discarded (masked out) when the table - index was calculated: index = hash & mask, where mask = table->size - 1. - We limit the maximum step size to table->size / 4 (mask >> 2) and make - it odd, since odd numbers are always relative prime to a power of 2. -*/ -#define SECOND_HASH(hash, mask, power) \ - ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2)) -#define PROBE_STEP(hash, mask, power) \ - ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1)) - -typedef struct { - NAMED **p; - NAMED **end; -} HASH_TABLE_ITER; - -#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ -#define INIT_DATA_BUF_SIZE 1024 -#define INIT_ATTS_SIZE 16 -#define INIT_ATTS_VERSION 0xFFFFFFFF -#define INIT_BLOCK_SIZE 1024 -#define INIT_BUFFER_SIZE 1024 - -#define EXPAND_SPARE 24 - -typedef struct binding { - struct prefix *prefix; - struct binding *nextTagBinding; - struct binding *prevPrefixBinding; - const struct attribute_id *attId; - XML_Char *uri; - int uriLen; - int uriAlloc; -} BINDING; - -typedef struct prefix { - const XML_Char *name; - BINDING *binding; -} PREFIX; - -typedef struct { - const XML_Char *str; - const XML_Char *localPart; - const XML_Char *prefix; - int strLen; - int uriLen; - int prefixLen; -} TAG_NAME; - -/* TAG represents an open element. - The name of the element is stored in both the document and API - encodings. The memory buffer 'buf' is a separately-allocated - memory area which stores the name. During the XML_Parse()/ - XMLParseBuffer() when the element is open, the memory for the 'raw' - version of the name (in the document encoding) is shared with the - document buffer. If the element is open across calls to - XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to - contain the 'raw' name as well. - - A parser re-uses these structures, maintaining a list of allocated - TAG objects in a free list. -*/ -typedef struct tag { - struct tag *parent; /* parent of this element */ - const char *rawName; /* tagName in the original encoding */ - int rawNameLength; - TAG_NAME name; /* tagName in the API encoding */ - char *buf; /* buffer for name components */ - char *bufEnd; /* end of the buffer */ - BINDING *bindings; -} TAG; - -typedef struct { - const XML_Char *name; - const XML_Char *textPtr; - int textLen; /* length in XML_Chars */ - int processed; /* # of processed bytes - when suspended */ - const XML_Char *systemId; - const XML_Char *base; - const XML_Char *publicId; - const XML_Char *notation; - XML_Bool open; - XML_Bool is_param; - XML_Bool is_internal; /* true if declared in internal subset outside PE */ -} ENTITY; - -typedef struct { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - int firstchild; - int lastchild; - int childcnt; - int nextsib; -} CONTENT_SCAFFOLD; - -#define INIT_SCAFFOLD_ELEMENTS 32 - -typedef struct block { - struct block *next; - int size; - XML_Char s[1]; -} BLOCK; - -typedef struct { - BLOCK *blocks; - BLOCK *freeBlocks; - const XML_Char *end; - XML_Char *ptr; - XML_Char *start; - const XML_Memory_Handling_Suite *mem; -} STRING_POOL; - -/* The XML_Char before the name is used to determine whether - an attribute has been specified. */ -typedef struct attribute_id { - XML_Char *name; - PREFIX *prefix; - XML_Bool maybeTokenized; - XML_Bool xmlns; -} ATTRIBUTE_ID; - -typedef struct { - const ATTRIBUTE_ID *id; - XML_Bool isCdata; - const XML_Char *value; -} DEFAULT_ATTRIBUTE; - -typedef struct { - unsigned long version; - unsigned long hash; - const XML_Char *uriName; -} NS_ATT; - -typedef struct { - const XML_Char *name; - PREFIX *prefix; - const ATTRIBUTE_ID *idAtt; - int nDefaultAtts; - int allocDefaultAtts; - DEFAULT_ATTRIBUTE *defaultAtts; -} ELEMENT_TYPE; - -typedef struct { - HASH_TABLE generalEntities; - HASH_TABLE elementTypes; - HASH_TABLE attributeIds; - HASH_TABLE prefixes; - STRING_POOL pool; - STRING_POOL entityValuePool; - /* false once a parameter entity reference has been skipped */ - XML_Bool keepProcessing; - /* true once an internal or external PE reference has been encountered; - this includes the reference to an external subset */ - XML_Bool hasParamEntityRefs; - XML_Bool standalone; -#ifdef XML_DTD - /* indicates if external PE has been read */ - XML_Bool paramEntityRead; - HASH_TABLE paramEntities; -#endif /* XML_DTD */ - PREFIX defaultPrefix; - /* === scaffolding for building content model === */ - XML_Bool in_eldecl; - CONTENT_SCAFFOLD *scaffold; - unsigned contentStringLen; - unsigned scaffSize; - unsigned scaffCount; - int scaffLevel; - int *scaffIndex; -} DTD; - -typedef struct open_internal_entity { - const char *internalEventPtr; - const char *internalEventEndPtr; - struct open_internal_entity *next; - ENTITY *entity; - int startTagLevel; - XML_Bool betweenDecl; /* WFC: PE Between Declarations */ -} OPEN_INTERNAL_ENTITY; - -typedef enum XML_Error PTRCALL Processor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr); - -static Processor prologProcessor; -static Processor prologInitProcessor; -static Processor contentProcessor; -static Processor cdataSectionProcessor; -#ifdef XML_DTD -static Processor ignoreSectionProcessor; -static Processor externalParEntProcessor; -static Processor externalParEntInitProcessor; -static Processor entityValueProcessor; -static Processor entityValueInitProcessor; -#endif /* XML_DTD */ -static Processor epilogProcessor; -static Processor errorProcessor; -static Processor externalEntityInitProcessor; -static Processor externalEntityInitProcessor2; -static Processor externalEntityInitProcessor3; -static Processor externalEntityContentProcessor; -static Processor internalEntityProcessor; - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next); -static enum XML_Error -initializeEncoding(XML_Parser parser); -static enum XML_Error -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, - const char *end, int tok, const char *next, const char **nextPtr, - XML_Bool haveMore); -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl); -static enum XML_Error -doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, - const char *start, const char *end, const char **endPtr, - XML_Bool haveMore); -static enum XML_Error -doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); -#ifdef XML_DTD -static enum XML_Error -doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); -#endif /* XML_DTD */ - -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *, const char *s, - TAG_NAME *tagNamePtr, BINDING **bindingsPtr); -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr); -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, - XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser); -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); -static enum XML_Error -storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end); -static int -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static void -reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); - -static const XML_Char * getContext(XML_Parser parser); -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context); - -static void FASTCALL normalizePublicId(XML_Char *s); - -static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms); -/* do not call if parentParser != NULL */ -static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms); -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms); -static int -dtdCopy(XML_Parser oldParser, - DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms); -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *, STRING_POOL *, const HASH_TABLE *); -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize); -static void FASTCALL -hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms); -static void FASTCALL hashTableClear(HASH_TABLE *); -static void FASTCALL hashTableDestroy(HASH_TABLE *); -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); - -static void FASTCALL -poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms); -static void FASTCALL poolClear(STRING_POOL *); -static void FASTCALL poolDestroy(STRING_POOL *); -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s); -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s); - -static int FASTCALL nextScaffoldPart(XML_Parser parser); -static XML_Content * build_model(XML_Parser parser); -static ELEMENT_TYPE * -getElementType(XML_Parser parser, const ENCODING *enc, - const char *ptr, const char *end); - -static unsigned long generate_hash_secret_salt(void); -static XML_Bool startParsing(XML_Parser parser); - -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd); - -static void -parserInit(XML_Parser parser, const XML_Char *encodingName); - -#define poolStart(pool) ((pool)->start) -#define poolEnd(pool) ((pool)->ptr) -#define poolLength(pool) ((pool)->ptr - (pool)->start) -#define poolChop(pool) ((void)--(pool->ptr)) -#define poolLastChar(pool) (((pool)->ptr)[-1]) -#define poolDiscard(pool) ((pool)->ptr = (pool)->start) -#define poolFinish(pool) ((pool)->start = (pool)->ptr) -#define poolAppendChar(pool, c) \ - (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ - ? 0 \ - : ((*((pool)->ptr)++ = c), 1)) - -struct XML_ParserStruct { - /* The first member must be userData so that the XML_GetUserData - macro works. */ - void *m_userData; - void *m_handlerArg; - char *m_buffer; - const XML_Memory_Handling_Suite m_mem; - /* first character to be parsed */ - const char *m_bufferPtr; - /* past last character to be parsed */ - char *m_bufferEnd; - /* allocated end of buffer */ - const char *m_bufferLim; - XML_Index m_parseEndByteIndex; - const char *m_parseEndPtr; - XML_Char *m_dataBuf; - XML_Char *m_dataBufEnd; - XML_StartElementHandler m_startElementHandler; - XML_EndElementHandler m_endElementHandler; - XML_CharacterDataHandler m_characterDataHandler; - XML_ProcessingInstructionHandler m_processingInstructionHandler; - XML_CommentHandler m_commentHandler; - XML_StartCdataSectionHandler m_startCdataSectionHandler; - XML_EndCdataSectionHandler m_endCdataSectionHandler; - XML_DefaultHandler m_defaultHandler; - XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; - XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; - XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; - XML_NotationDeclHandler m_notationDeclHandler; - XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; - XML_NotStandaloneHandler m_notStandaloneHandler; - XML_ExternalEntityRefHandler m_externalEntityRefHandler; - XML_Parser m_externalEntityRefHandlerArg; - XML_SkippedEntityHandler m_skippedEntityHandler; - XML_UnknownEncodingHandler m_unknownEncodingHandler; - XML_ElementDeclHandler m_elementDeclHandler; - XML_AttlistDeclHandler m_attlistDeclHandler; - XML_EntityDeclHandler m_entityDeclHandler; - XML_XmlDeclHandler m_xmlDeclHandler; - const ENCODING *m_encoding; - INIT_ENCODING m_initEncoding; - const ENCODING *m_internalEncoding; - const XML_Char *m_protocolEncodingName; - XML_Bool m_ns; - XML_Bool m_ns_triplets; - void *m_unknownEncodingMem; - void *m_unknownEncodingData; - void *m_unknownEncodingHandlerData; - void (XMLCALL *m_unknownEncodingRelease)(void *); - PROLOG_STATE m_prologState; - Processor *m_processor; - enum XML_Error m_errorCode; - const char *m_eventPtr; - const char *m_eventEndPtr; - const char *m_positionPtr; - OPEN_INTERNAL_ENTITY *m_openInternalEntities; - OPEN_INTERNAL_ENTITY *m_freeInternalEntities; - XML_Bool m_defaultExpandInternalEntities; - int m_tagLevel; - ENTITY *m_declEntity; - const XML_Char *m_doctypeName; - const XML_Char *m_doctypeSysid; - const XML_Char *m_doctypePubid; - const XML_Char *m_declAttributeType; - const XML_Char *m_declNotationName; - const XML_Char *m_declNotationPublicId; - ELEMENT_TYPE *m_declElementType; - ATTRIBUTE_ID *m_declAttributeId; - XML_Bool m_declAttributeIsCdata; - XML_Bool m_declAttributeIsId; - DTD *m_dtd; - const XML_Char *m_curBase; - TAG *m_tagStack; - TAG *m_freeTagList; - BINDING *m_inheritedBindings; - BINDING *m_freeBindingList; - int m_attsSize; - int m_nSpecifiedAtts; - int m_idAttIndex; - ATTRIBUTE *m_atts; - NS_ATT *m_nsAtts; - unsigned long m_nsAttsVersion; - unsigned char m_nsAttsPower; -#ifdef XML_ATTR_INFO - XML_AttrInfo *m_attInfo; -#endif - POSITION m_position; - STRING_POOL m_tempPool; - STRING_POOL m_temp2Pool; - char *m_groupConnector; - unsigned int m_groupSize; - XML_Char m_namespaceSeparator; - XML_Parser m_parentParser; - XML_ParsingStatus m_parsingStatus; -#ifdef XML_DTD - XML_Bool m_isParamEntity; - XML_Bool m_useForeignDTD; - enum XML_ParamEntityParsing m_paramEntityParsing; -#endif - unsigned long m_hash_secret_salt; -}; - -#define MALLOC(s) (parser->m_mem.malloc_fcn((s))) -#define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s))) -#define FREE(p) (parser->m_mem.free_fcn((p))) - -#define userData (parser->m_userData) -#define handlerArg (parser->m_handlerArg) -#define startElementHandler (parser->m_startElementHandler) -#define endElementHandler (parser->m_endElementHandler) -#define characterDataHandler (parser->m_characterDataHandler) -#define processingInstructionHandler \ - (parser->m_processingInstructionHandler) -#define commentHandler (parser->m_commentHandler) -#define startCdataSectionHandler \ - (parser->m_startCdataSectionHandler) -#define endCdataSectionHandler (parser->m_endCdataSectionHandler) -#define defaultHandler (parser->m_defaultHandler) -#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) -#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) -#define unparsedEntityDeclHandler \ - (parser->m_unparsedEntityDeclHandler) -#define notationDeclHandler (parser->m_notationDeclHandler) -#define startNamespaceDeclHandler \ - (parser->m_startNamespaceDeclHandler) -#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) -#define notStandaloneHandler (parser->m_notStandaloneHandler) -#define externalEntityRefHandler \ - (parser->m_externalEntityRefHandler) -#define externalEntityRefHandlerArg \ - (parser->m_externalEntityRefHandlerArg) -#define internalEntityRefHandler \ - (parser->m_internalEntityRefHandler) -#define skippedEntityHandler (parser->m_skippedEntityHandler) -#define unknownEncodingHandler (parser->m_unknownEncodingHandler) -#define elementDeclHandler (parser->m_elementDeclHandler) -#define attlistDeclHandler (parser->m_attlistDeclHandler) -#define entityDeclHandler (parser->m_entityDeclHandler) -#define xmlDeclHandler (parser->m_xmlDeclHandler) -#define encoding (parser->m_encoding) -#define initEncoding (parser->m_initEncoding) -#define internalEncoding (parser->m_internalEncoding) -#define unknownEncodingMem (parser->m_unknownEncodingMem) -#define unknownEncodingData (parser->m_unknownEncodingData) -#define unknownEncodingHandlerData \ - (parser->m_unknownEncodingHandlerData) -#define unknownEncodingRelease (parser->m_unknownEncodingRelease) -#define protocolEncodingName (parser->m_protocolEncodingName) -#define ns (parser->m_ns) -#define ns_triplets (parser->m_ns_triplets) -#define prologState (parser->m_prologState) -#define processor (parser->m_processor) -#define errorCode (parser->m_errorCode) -#define eventPtr (parser->m_eventPtr) -#define eventEndPtr (parser->m_eventEndPtr) -#define positionPtr (parser->m_positionPtr) -#define position (parser->m_position) -#define openInternalEntities (parser->m_openInternalEntities) -#define freeInternalEntities (parser->m_freeInternalEntities) -#define defaultExpandInternalEntities \ - (parser->m_defaultExpandInternalEntities) -#define tagLevel (parser->m_tagLevel) -#define buffer (parser->m_buffer) -#define bufferPtr (parser->m_bufferPtr) -#define bufferEnd (parser->m_bufferEnd) -#define parseEndByteIndex (parser->m_parseEndByteIndex) -#define parseEndPtr (parser->m_parseEndPtr) -#define bufferLim (parser->m_bufferLim) -#define dataBuf (parser->m_dataBuf) -#define dataBufEnd (parser->m_dataBufEnd) -#define _dtd (parser->m_dtd) -#define curBase (parser->m_curBase) -#define declEntity (parser->m_declEntity) -#define doctypeName (parser->m_doctypeName) -#define doctypeSysid (parser->m_doctypeSysid) -#define doctypePubid (parser->m_doctypePubid) -#define declAttributeType (parser->m_declAttributeType) -#define declNotationName (parser->m_declNotationName) -#define declNotationPublicId (parser->m_declNotationPublicId) -#define declElementType (parser->m_declElementType) -#define declAttributeId (parser->m_declAttributeId) -#define declAttributeIsCdata (parser->m_declAttributeIsCdata) -#define declAttributeIsId (parser->m_declAttributeIsId) -#define freeTagList (parser->m_freeTagList) -#define freeBindingList (parser->m_freeBindingList) -#define inheritedBindings (parser->m_inheritedBindings) -#define tagStack (parser->m_tagStack) -#define atts (parser->m_atts) -#define attsSize (parser->m_attsSize) -#define nSpecifiedAtts (parser->m_nSpecifiedAtts) -#define idAttIndex (parser->m_idAttIndex) -#define nsAtts (parser->m_nsAtts) -#define nsAttsVersion (parser->m_nsAttsVersion) -#define nsAttsPower (parser->m_nsAttsPower) -#define attInfo (parser->m_attInfo) -#define tempPool (parser->m_tempPool) -#define temp2Pool (parser->m_temp2Pool) -#define groupConnector (parser->m_groupConnector) -#define groupSize (parser->m_groupSize) -#define namespaceSeparator (parser->m_namespaceSeparator) -#define parentParser (parser->m_parentParser) -#define ps_parsing (parser->m_parsingStatus.parsing) -#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer) -#ifdef XML_DTD -#define isParamEntity (parser->m_isParamEntity) -#define useForeignDTD (parser->m_useForeignDTD) -#define paramEntityParsing (parser->m_paramEntityParsing) -#endif /* XML_DTD */ -#define hash_secret_salt (parser->m_hash_secret_salt) - -XML_Parser XMLCALL -XML_ParserCreate(const XML_Char *encodingName) -{ - return XML_ParserCreate_MM(encodingName, NULL, NULL); -} - -XML_Parser XMLCALL -XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) -{ - XML_Char tmp[2]; - *tmp = nsSep; - return XML_ParserCreate_MM(encodingName, NULL, tmp); -} - -static const XML_Char implicitContext[] = { - ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p, - ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, - ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, - ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, - ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, - ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' -}; - -static unsigned long -generate_hash_secret_salt(void) -{ - unsigned int seed = time(NULL) % UINT_MAX; - srand(seed); - return rand(); -} - -static XML_Bool /* only valid for root parser */ -startParsing(XML_Parser parser) -{ - /* hash functions must be initialized before setContext() is called */ - if (hash_secret_salt == 0) - hash_secret_salt = generate_hash_secret_salt(); - if (ns) { - /* implicit context only set for root parser, since child - parsers (i.e. external entity parsers) will inherit it - */ - return setContext(parser, implicitContext); - } - return XML_TRUE; -} - -XML_Parser XMLCALL -XML_ParserCreate_MM(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep) -{ - return parserCreate(encodingName, memsuite, nameSep, NULL); -} - -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd) -{ - XML_Parser parser; - - if (memsuite) { - XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser) - memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); - mtemp->malloc_fcn = memsuite->malloc_fcn; - mtemp->realloc_fcn = memsuite->realloc_fcn; - mtemp->free_fcn = memsuite->free_fcn; - } - } - else { - XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); - mtemp->malloc_fcn = malloc; - mtemp->realloc_fcn = realloc; - mtemp->free_fcn = free; - } - } - - if (!parser) - return parser; - - buffer = NULL; - bufferLim = NULL; - - attsSize = INIT_ATTS_SIZE; - atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE)); - if (atts == NULL) { - FREE(parser); - return NULL; - } -#ifdef XML_ATTR_INFO - attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo)); - if (attInfo == NULL) { - FREE(atts); - FREE(parser); - return NULL; - } -#endif - dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); - if (dataBuf == NULL) { - FREE(atts); -#ifdef XML_ATTR_INFO - FREE(attInfo); -#endif - FREE(parser); - return NULL; - } - dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; - - if (dtd) - _dtd = dtd; - else { - _dtd = dtdCreate(&parser->m_mem); - if (_dtd == NULL) { - FREE(dataBuf); - FREE(atts); -#ifdef XML_ATTR_INFO - FREE(attInfo); -#endif - FREE(parser); - return NULL; - } - } - - freeBindingList = NULL; - freeTagList = NULL; - freeInternalEntities = NULL; - - groupSize = 0; - groupConnector = NULL; - - unknownEncodingHandler = NULL; - unknownEncodingHandlerData = NULL; - - namespaceSeparator = ASCII_EXCL; - ns = XML_FALSE; - ns_triplets = XML_FALSE; - - nsAtts = NULL; - nsAttsVersion = 0; - nsAttsPower = 0; - - poolInit(&tempPool, &(parser->m_mem)); - poolInit(&temp2Pool, &(parser->m_mem)); - parserInit(parser, encodingName); - - if (encodingName && !protocolEncodingName) { - XML_ParserFree(parser); - return NULL; - } - - if (nameSep) { - ns = XML_TRUE; - internalEncoding = XmlGetInternalEncodingNS(); - namespaceSeparator = *nameSep; - } - else { - internalEncoding = XmlGetInternalEncoding(); - } - - return parser; -} - -static void -parserInit(XML_Parser parser, const XML_Char *encodingName) -{ - processor = prologInitProcessor; - XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); - curBase = NULL; - XmlInitEncoding(&initEncoding, &encoding, 0); - userData = NULL; - handlerArg = NULL; - startElementHandler = NULL; - endElementHandler = NULL; - characterDataHandler = NULL; - processingInstructionHandler = NULL; - commentHandler = NULL; - startCdataSectionHandler = NULL; - endCdataSectionHandler = NULL; - defaultHandler = NULL; - startDoctypeDeclHandler = NULL; - endDoctypeDeclHandler = NULL; - unparsedEntityDeclHandler = NULL; - notationDeclHandler = NULL; - startNamespaceDeclHandler = NULL; - endNamespaceDeclHandler = NULL; - notStandaloneHandler = NULL; - externalEntityRefHandler = NULL; - externalEntityRefHandlerArg = parser; - skippedEntityHandler = NULL; - elementDeclHandler = NULL; - attlistDeclHandler = NULL; - entityDeclHandler = NULL; - xmlDeclHandler = NULL; - bufferPtr = buffer; - bufferEnd = buffer; - parseEndByteIndex = 0; - parseEndPtr = NULL; - declElementType = NULL; - declAttributeId = NULL; - declEntity = NULL; - doctypeName = NULL; - doctypeSysid = NULL; - doctypePubid = NULL; - declAttributeType = NULL; - declNotationName = NULL; - declNotationPublicId = NULL; - declAttributeIsCdata = XML_FALSE; - declAttributeIsId = XML_FALSE; - memset(&position, 0, sizeof(POSITION)); - errorCode = XML_ERROR_NONE; - eventPtr = NULL; - eventEndPtr = NULL; - positionPtr = NULL; - openInternalEntities = NULL; - defaultExpandInternalEntities = XML_TRUE; - tagLevel = 0; - tagStack = NULL; - inheritedBindings = NULL; - nSpecifiedAtts = 0; - unknownEncodingMem = NULL; - unknownEncodingRelease = NULL; - unknownEncodingData = NULL; - parentParser = NULL; - ps_parsing = XML_INITIALIZED; -#ifdef XML_DTD - isParamEntity = XML_FALSE; - useForeignDTD = XML_FALSE; - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif - hash_secret_salt = 0; -} - -/* moves list of bindings to freeBindingList */ -static void FASTCALL -moveToFreeBindingList(XML_Parser parser, BINDING *bindings) -{ - while (bindings) { - BINDING *b = bindings; - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - } -} - -XML_Bool XMLCALL -XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) -{ - TAG *tStk; - OPEN_INTERNAL_ENTITY *openEntityList; - if (parentParser) - return XML_FALSE; - /* move tagStack to freeTagList */ - tStk = tagStack; - while (tStk) { - TAG *tag = tStk; - tStk = tStk->parent; - tag->parent = freeTagList; - moveToFreeBindingList(parser, tag->bindings); - tag->bindings = NULL; - freeTagList = tag; - } - /* move openInternalEntities to freeInternalEntities */ - openEntityList = openInternalEntities; - while (openEntityList) { - OPEN_INTERNAL_ENTITY *openEntity = openEntityList; - openEntityList = openEntity->next; - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - moveToFreeBindingList(parser, inheritedBindings); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - poolClear(&tempPool); - poolClear(&temp2Pool); - parserInit(parser, encodingName); - dtdReset(_dtd, &parser->m_mem); - return XML_TRUE; -} - -enum XML_Status XMLCALL -XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - /* Block after XML_Parse()/XML_ParseBuffer() has been called. - XXX There's no way for the caller to determine which of the - XXX possible error cases caused the XML_STATUS_ERROR return. - */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return XML_STATUS_ERROR; - if (encodingName == NULL) - protocolEncodingName = NULL; - else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); - if (!protocolEncodingName) - return XML_STATUS_ERROR; - } - return XML_STATUS_OK; -} - -XML_Parser XMLCALL -XML_ExternalEntityParserCreate(XML_Parser oldParser, - const XML_Char *context, - const XML_Char *encodingName) -{ - XML_Parser parser = oldParser; - DTD *newDtd = NULL; - DTD *oldDtd = _dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; - - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; -#ifdef XML_DTD - enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; -#endif - XML_Bool oldns_triplets = ns_triplets; - /* Note that the new parser shares the same hash secret as the old - parser, so that dtdCopy and copyEntityTable can lookup values - from hash tables associated with either parser without us having - to worry which hash secrets each table has. - */ - unsigned long oldhash_secret_salt = hash_secret_salt; - -#ifdef XML_DTD - if (!context) - newDtd = oldDtd; -#endif /* XML_DTD */ - - /* Note that the magical uses of the pre-processor to make field - access look more like C++ require that `parser' be overwritten - here. This makes this function more painful to follow than it - would be otherwise. - */ - if (ns) { - XML_Char tmp[2]; - *tmp = namespaceSeparator; - parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd); - } - else { - parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd); - } - - if (!parser) - return NULL; - - startElementHandler = oldStartElementHandler; - endElementHandler = oldEndElementHandler; - characterDataHandler = oldCharacterDataHandler; - processingInstructionHandler = oldProcessingInstructionHandler; - commentHandler = oldCommentHandler; - startCdataSectionHandler = oldStartCdataSectionHandler; - endCdataSectionHandler = oldEndCdataSectionHandler; - defaultHandler = oldDefaultHandler; - unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; - notationDeclHandler = oldNotationDeclHandler; - startNamespaceDeclHandler = oldStartNamespaceDeclHandler; - endNamespaceDeclHandler = oldEndNamespaceDeclHandler; - notStandaloneHandler = oldNotStandaloneHandler; - externalEntityRefHandler = oldExternalEntityRefHandler; - skippedEntityHandler = oldSkippedEntityHandler; - unknownEncodingHandler = oldUnknownEncodingHandler; - elementDeclHandler = oldElementDeclHandler; - attlistDeclHandler = oldAttlistDeclHandler; - entityDeclHandler = oldEntityDeclHandler; - xmlDeclHandler = oldXmlDeclHandler; - declElementType = oldDeclElementType; - userData = oldUserData; - if (oldUserData == oldHandlerArg) - handlerArg = userData; - else - handlerArg = parser; - if (oldExternalEntityRefHandlerArg != oldParser) - externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; - defaultExpandInternalEntities = oldDefaultExpandInternalEntities; - ns_triplets = oldns_triplets; - hash_secret_salt = oldhash_secret_salt; - parentParser = oldParser; -#ifdef XML_DTD - paramEntityParsing = oldParamEntityParsing; - prologState.inEntityValue = oldInEntityValue; - if (context) { -#endif /* XML_DTD */ - if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem) - || !setContext(parser, context)) { - XML_ParserFree(parser); - return NULL; - } - processor = externalEntityInitProcessor; -#ifdef XML_DTD - } - else { - /* The DTD instance referenced by _dtd is shared between the document's - root parser and external PE parsers, therefore one does not need to - call setContext. In addition, one also *must* not call setContext, - because this would overwrite existing prefix->binding pointers in - _dtd with ones that get destroyed with the external PE parser. - This would leave those prefixes with dangling pointers. - */ - isParamEntity = XML_TRUE; - XmlPrologStateInitExternalEntity(&prologState); - processor = externalParEntInitProcessor; - } -#endif /* XML_DTD */ - return parser; -} - -static void FASTCALL -destroyBindings(BINDING *bindings, XML_Parser parser) -{ - for (;;) { - BINDING *b = bindings; - if (!b) - break; - bindings = b->nextTagBinding; - FREE(b->uri); - FREE(b); - } -} - -void XMLCALL -XML_ParserFree(XML_Parser parser) -{ - TAG *tagList; - OPEN_INTERNAL_ENTITY *entityList; - if (parser == NULL) - return; - /* free tagStack and freeTagList */ - tagList = tagStack; - for (;;) { - TAG *p; - if (tagList == NULL) { - if (freeTagList == NULL) - break; - tagList = freeTagList; - freeTagList = NULL; - } - p = tagList; - tagList = tagList->parent; - FREE(p->buf); - destroyBindings(p->bindings, parser); - FREE(p); - } - /* free openInternalEntities and freeInternalEntities */ - entityList = openInternalEntities; - for (;;) { - OPEN_INTERNAL_ENTITY *openEntity; - if (entityList == NULL) { - if (freeInternalEntities == NULL) - break; - entityList = freeInternalEntities; - freeInternalEntities = NULL; - } - openEntity = entityList; - entityList = entityList->next; - FREE(openEntity); - } - - destroyBindings(freeBindingList, parser); - destroyBindings(inheritedBindings, parser); - poolDestroy(&tempPool); - poolDestroy(&temp2Pool); -#ifdef XML_DTD - /* external parameter entity parsers share the DTD structure - parser->m_dtd with the root parser, so we must not destroy it - */ - if (!isParamEntity && _dtd) -#else - if (_dtd) -#endif /* XML_DTD */ - dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem); - FREE((void *)atts); -#ifdef XML_ATTR_INFO - FREE((void *)attInfo); -#endif - FREE(groupConnector); - FREE(buffer); - FREE(dataBuf); - FREE(nsAtts); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - FREE(parser); -} - -void XMLCALL -XML_UseParserAsHandlerArg(XML_Parser parser) -{ - handlerArg = parser; -} - -enum XML_Error XMLCALL -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) -{ -#ifdef XML_DTD - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; - useForeignDTD = useDTD; - return XML_ERROR_NONE; -#else - return XML_ERROR_FEATURE_REQUIRES_XML_DTD; -#endif -} - -void XMLCALL -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return; - ns_triplets = do_nst ? XML_TRUE : XML_FALSE; -} - -void XMLCALL -XML_SetUserData(XML_Parser parser, void *p) -{ - if (handlerArg == userData) - handlerArg = userData = p; - else - userData = p; -} - -enum XML_Status XMLCALL -XML_SetBase(XML_Parser parser, const XML_Char *p) -{ - if (p) { - p = poolCopyString(&_dtd->pool, p); - if (!p) - return XML_STATUS_ERROR; - curBase = p; - } - else - curBase = NULL; - return XML_STATUS_OK; -} - -const XML_Char * XMLCALL -XML_GetBase(XML_Parser parser) -{ - return curBase; -} - -int XMLCALL -XML_GetSpecifiedAttributeCount(XML_Parser parser) -{ - return nSpecifiedAtts; -} - -int XMLCALL -XML_GetIdAttributeIndex(XML_Parser parser) -{ - return idAttIndex; -} - -#ifdef XML_ATTR_INFO -const XML_AttrInfo * XMLCALL -XML_GetAttributeInfo(XML_Parser parser) -{ - return attInfo; -} -#endif - -void XMLCALL -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end) -{ - startElementHandler = start; - endElementHandler = end; -} - -void XMLCALL -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler start) { - startElementHandler = start; -} - -void XMLCALL -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler end) { - endElementHandler = end; -} - -void XMLCALL -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler) -{ - characterDataHandler = handler; -} - -void XMLCALL -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler) -{ - processingInstructionHandler = handler; -} - -void XMLCALL -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler) -{ - commentHandler = handler; -} - -void XMLCALL -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end) -{ - startCdataSectionHandler = start; - endCdataSectionHandler = end; -} - -void XMLCALL -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; -} - -void XMLCALL -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; -} - -void XMLCALL -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_FALSE; -} - -void XMLCALL -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_TRUE; -} - -void XMLCALL -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end) -{ - startDoctypeDeclHandler = start; - endDoctypeDeclHandler = end; -} - -void XMLCALL -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; -} - -void XMLCALL -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; -} - -void XMLCALL -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler) -{ - unparsedEntityDeclHandler = handler; -} - -void XMLCALL -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler) -{ - notationDeclHandler = handler; -} - -void XMLCALL -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end) -{ - startNamespaceDeclHandler = start; - endNamespaceDeclHandler = end; -} - -void XMLCALL -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; -} - -void XMLCALL -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; -} - -void XMLCALL -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler) -{ - notStandaloneHandler = handler; -} - -void XMLCALL -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler) -{ - externalEntityRefHandler = handler; -} - -void XMLCALL -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) -{ - if (arg) - externalEntityRefHandlerArg = (XML_Parser)arg; - else - externalEntityRefHandlerArg = parser; -} - -void XMLCALL -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler) -{ - skippedEntityHandler = handler; -} - -void XMLCALL -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *data) -{ - unknownEncodingHandler = handler; - unknownEncodingHandlerData = data; -} - -void XMLCALL -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl) -{ - elementDeclHandler = eldecl; -} - -void XMLCALL -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl) -{ - attlistDeclHandler = attdecl; -} - -void XMLCALL -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler) -{ - entityDeclHandler = handler; -} - -void XMLCALL -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; -} - -int XMLCALL -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing peParsing) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return 0; -#ifdef XML_DTD - paramEntityParsing = peParsing; - return 1; -#else - return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; -#endif -} - -int XMLCALL -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return 0; - hash_secret_salt = hash_salt; - return 1; -} - -enum XML_Status XMLCALL -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - default: - ps_parsing = XML_PARSING; - } - - if (len == 0) { - ps_finalBuffer = (XML_Bool)isFinal; - if (!isFinal) - return XML_STATUS_OK; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - - /* If data are left over from last buffer, and we now know that these - data are the final chunk of input, then we have to check them again - to detect errors based on that fact. - */ - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); - - if (errorCode == XML_ERROR_NONE) { - switch (ps_parsing) { - case XML_SUSPENDED: - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return XML_STATUS_SUSPENDED; - case XML_INITIALIZED: - case XML_PARSING: - ps_parsing = XML_FINISHED; - /* fall through */ - default: - return XML_STATUS_OK; - } - } - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } -#ifndef XML_CONTEXT_BYTES - else if (bufferPtr == bufferEnd) { - const char *end; - int nLeftOver; - enum XML_Error result; - parseEndByteIndex += len; - positionPtr = s; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, s, parseEndPtr = s + len, &end); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (isFinal) { - ps_parsing = XML_FINISHED; - return XML_STATUS_OK; - } - /* fall through */ - default: - result = XML_STATUS_OK; - } - } - - XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; - if (nLeftOver) { - if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = (buffer == NULL - ? (char *)MALLOC(len * 2) - : (char *)REALLOC(buffer, len * 2)); - if (temp == NULL) { - errorCode = XML_ERROR_NO_MEMORY; - eventPtr = eventEndPtr = NULL; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - buffer = temp; - bufferLim = buffer + len * 2; - } - memcpy(buffer, end, nLeftOver); - } - bufferPtr = buffer; - bufferEnd = buffer + nLeftOver; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - eventPtr = bufferPtr; - eventEndPtr = bufferPtr; - return result; - } -#endif /* not defined XML_CONTEXT_BYTES */ - else { - void *buff = XML_GetBuffer(parser, len); - if (buff == NULL) - return XML_STATUS_ERROR; - else { - memcpy(buff, s, len); - return XML_ParseBuffer(parser, len, isFinal); - } - } -} - -enum XML_Status XMLCALL -XML_ParseBuffer(XML_Parser parser, int len, int isFinal) -{ - const char *start; - enum XML_Status result = XML_STATUS_OK; - - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - default: - ps_parsing = XML_PARSING; - } - - start = bufferPtr; - positionPtr = start; - bufferEnd += len; - parseEndPtr = bufferEnd; - parseEndByteIndex += len; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, start, parseEndPtr, &bufferPtr); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (isFinal) { - ps_parsing = XML_FINISHED; - return result; - } - default: ; /* should not happen */ - } - } - - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return result; -} - -void * XMLCALL -XML_GetBuffer(XML_Parser parser, int len) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return NULL; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return NULL; - default: ; - } - - if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ - int neededSize = len + (int)(bufferEnd - bufferPtr); -#ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); - - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - neededSize += keep; -#endif /* defined XML_CONTEXT_BYTES */ - if (neededSize <= bufferLim - buffer) { -#ifdef XML_CONTEXT_BYTES - if (keep < bufferPtr - buffer) { - int offset = (int)(bufferPtr - buffer) - keep; - memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); - bufferEnd -= offset; - bufferPtr -= offset; - } -#else - memmove(buffer, bufferPtr, bufferEnd - bufferPtr); - bufferEnd = buffer + (bufferEnd - bufferPtr); - bufferPtr = buffer; -#endif /* not defined XML_CONTEXT_BYTES */ - } - else { - char *newBuf; - int bufferSize = (int)(bufferLim - bufferPtr); - if (bufferSize == 0) - bufferSize = INIT_BUFFER_SIZE; - do { - bufferSize *= 2; - } while (bufferSize < neededSize); - newBuf = (char *)MALLOC(bufferSize); - if (newBuf == 0) { - errorCode = XML_ERROR_NO_MEMORY; - return NULL; - } - bufferLim = newBuf + bufferSize; -#ifdef XML_CONTEXT_BYTES - if (bufferPtr) { - int keep = (int)(bufferPtr - buffer); - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); - FREE(buffer); - buffer = newBuf; - bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; - bufferPtr = buffer + keep; - } - else { - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; - } -#else - if (bufferPtr) { - memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); - FREE(buffer); - } - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; -#endif /* not defined XML_CONTEXT_BYTES */ - } - eventPtr = eventEndPtr = NULL; - positionPtr = NULL; - } - return bufferEnd; -} - -enum XML_Status XMLCALL -XML_StopParser(XML_Parser parser, XML_Bool resumable) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - if (resumable) { - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - } - ps_parsing = XML_FINISHED; - break; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - default: - if (resumable) { -#ifdef XML_DTD - if (isParamEntity) { - errorCode = XML_ERROR_SUSPEND_PE; - return XML_STATUS_ERROR; - } -#endif - ps_parsing = XML_SUSPENDED; - } - else - ps_parsing = XML_FINISHED; - } - return XML_STATUS_OK; -} - -enum XML_Status XMLCALL -XML_ResumeParser(XML_Parser parser) -{ - enum XML_Status result = XML_STATUS_OK; - - if (ps_parsing != XML_SUSPENDED) { - errorCode = XML_ERROR_NOT_SUSPENDED; - return XML_STATUS_ERROR; - } - ps_parsing = XML_PARSING; - - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (ps_finalBuffer) { - ps_parsing = XML_FINISHED; - return result; - } - default: ; - } - } - - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return result; -} - -void XMLCALL -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) -{ - assert(status != NULL); - *status = parser->m_parsingStatus; -} - -enum XML_Error XMLCALL -XML_GetErrorCode(XML_Parser parser) -{ - return errorCode; -} - -XML_Index XMLCALL -XML_GetCurrentByteIndex(XML_Parser parser) -{ - if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); - return -1; -} - -int XMLCALL -XML_GetCurrentByteCount(XML_Parser parser) -{ - if (eventEndPtr && eventPtr) - return (int)(eventEndPtr - eventPtr); - return 0; -} - -const char * XMLCALL -XML_GetInputContext(XML_Parser parser, int *offset, int *size) -{ -#ifdef XML_CONTEXT_BYTES - if (eventPtr && buffer) { - *offset = (int)(eventPtr - buffer); - *size = (int)(bufferEnd - buffer); - return buffer; - } -#endif /* defined XML_CONTEXT_BYTES */ - return (char *) 0; -} - -XML_Size XMLCALL -XML_GetCurrentLineNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.lineNumber + 1; -} - -XML_Size XMLCALL -XML_GetCurrentColumnNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.columnNumber; -} - -void XMLCALL -XML_FreeContentModel(XML_Parser parser, XML_Content *model) -{ - FREE(model); -} - -void * XMLCALL -XML_MemMalloc(XML_Parser parser, size_t size) -{ - return MALLOC(size); -} - -void * XMLCALL -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) -{ - return REALLOC(ptr, size); -} - -void XMLCALL -XML_MemFree(XML_Parser parser, void *ptr) -{ - FREE(ptr); -} - -void XMLCALL -XML_DefaultCurrent(XML_Parser parser) -{ - if (defaultHandler) { - if (openInternalEntities) - reportDefault(parser, - internalEncoding, - openInternalEntities->internalEventPtr, - openInternalEntities->internalEventEndPtr); - else - reportDefault(parser, encoding, eventPtr, eventEndPtr); - } -} - -const XML_LChar * XMLCALL -XML_ErrorString(enum XML_Error code) -{ - static const XML_LChar* const message[] = { - 0, - XML_L("out of memory"), - XML_L("syntax error"), - XML_L("no element found"), - XML_L("not well-formed (invalid token)"), - XML_L("unclosed token"), - XML_L("partial character"), - XML_L("mismatched tag"), - XML_L("duplicate attribute"), - XML_L("junk after document element"), - XML_L("illegal parameter entity reference"), - XML_L("undefined entity"), - XML_L("recursive entity reference"), - XML_L("asynchronous entity"), - XML_L("reference to invalid character number"), - XML_L("reference to binary entity"), - XML_L("reference to external entity in attribute"), - XML_L("XML or text declaration not at start of entity"), - XML_L("unknown encoding"), - XML_L("encoding specified in XML declaration is incorrect"), - XML_L("unclosed CDATA section"), - XML_L("error in processing external entity reference"), - XML_L("document is not standalone"), - XML_L("unexpected parser state - please send a bug report"), - XML_L("entity declared in parameter entity"), - XML_L("requested feature requires XML_DTD support in Expat"), - XML_L("cannot change setting once parsing has begun"), - XML_L("unbound prefix"), - XML_L("must not undeclare prefix"), - XML_L("incomplete markup in parameter entity"), - XML_L("XML declaration not well-formed"), - XML_L("text declaration not well-formed"), - XML_L("illegal character(s) in public id"), - XML_L("parser suspended"), - XML_L("parser not suspended"), - XML_L("parsing aborted"), - XML_L("parsing finished"), - XML_L("cannot suspend in external parameter entity"), - XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"), - XML_L("reserved prefix (xmlns) must not be declared or undeclared"), - XML_L("prefix must not be bound to one of the reserved namespace names") - }; - if (code > 0 && code < sizeof(message)/sizeof(message[0])) - return message[code]; - return NULL; -} - -const XML_LChar * XMLCALL -XML_ExpatVersion(void) { - - /* V1 is used to string-ize the version number. However, it would - string-ize the actual version macro *names* unless we get them - substituted before being passed to V1. CPP is defined to expand - a macro, then rescan for more expansions. Thus, we use V2 to expand - the version macros, then CPP will expand the resulting V1() macro - with the correct numerals. */ - /* ### I'm assuming cpp is portable in this respect... */ - -#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c) -#define V2(a,b,c) XML_L("expat_")V1(a,b,c) - - return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - -#undef V1 -#undef V2 -} - -XML_Expat_Version XMLCALL -XML_ExpatVersionInfo(void) -{ - XML_Expat_Version version; - - version.major = XML_MAJOR_VERSION; - version.minor = XML_MINOR_VERSION; - version.micro = XML_MICRO_VERSION; - - return version; -} - -const XML_Feature * XMLCALL -XML_GetFeatureList(void) -{ - static const XML_Feature features[] = { - {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), - sizeof(XML_Char)}, - {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), - sizeof(XML_LChar)}, -#ifdef XML_UNICODE - {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0}, -#endif -#ifdef XML_UNICODE_WCHAR_T - {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0}, -#endif -#ifdef XML_DTD - {XML_FEATURE_DTD, XML_L("XML_DTD"), 0}, -#endif -#ifdef XML_CONTEXT_BYTES - {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), - XML_CONTEXT_BYTES}, -#endif -#ifdef XML_MIN_SIZE - {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0}, -#endif -#ifdef XML_NS - {XML_FEATURE_NS, XML_L("XML_NS"), 0}, -#endif -#ifdef XML_LARGE_SIZE - {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0}, -#endif -#ifdef XML_ATTR_INFO - {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0}, -#endif - {XML_FEATURE_END, NULL, 0} - }; - - return features; -} - -/* Initially tag->rawName always points into the parse buffer; - for those TAG instances opened while the current parse buffer was - processed, and not yet closed, we need to store tag->rawName in a more - permanent location, since the parse buffer is about to be discarded. -*/ -static XML_Bool -storeRawNames(XML_Parser parser) -{ - TAG *tag = tagStack; - while (tag) { - int bufSize; - int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); - char *rawNameBuf = tag->buf + nameLen; - /* Stop if already stored. Since tagStack is a stack, we can stop - at the first entry that has already been copied; everything - below it in the stack is already been accounted for in a - previous call to this function. - */ - if (tag->rawName == rawNameBuf) - break; - /* For re-use purposes we need to ensure that the - size of tag->buf is a multiple of sizeof(XML_Char). - */ - bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); - if (bufSize > tag->bufEnd - tag->buf) { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_FALSE; - /* if tag->name.str points to tag->buf (only when namespace - processing is off) then we have to update it - */ - if (tag->name.str == (XML_Char *)tag->buf) - tag->name.str = (XML_Char *)temp; - /* if tag->name.localPart is set (when namespace processing is on) - then update it as well, since it will always point into tag->buf - */ - if (tag->name.localPart) - tag->name.localPart = (XML_Char *)temp + (tag->name.localPart - - (XML_Char *)tag->buf); - tag->buf = temp; - tag->bufEnd = temp + bufSize; - rawNameBuf = temp + nameLen; - } - memcpy(rawNameBuf, tag->rawName, tag->rawNameLength); - tag->rawName = rawNameBuf; - tag = tag->parent; - } - return XML_TRUE; -} - -static enum XML_Error PTRCALL -contentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 0, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - } - return result; -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = externalEntityInitProcessor2; - return externalEntityInitProcessor2(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor2(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_BOM: - /* If we are at the end of the buffer, this would cause the next stage, - i.e. externalEntityInitProcessor3, to pass control directly to - doContent (by detecting XML_TOK_NONE) without processing any xml text - declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. - */ - if (next == end && !ps_finalBuffer) { - *endPtr = next; - return XML_ERROR_NONE; - } - start = next; - break; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityInitProcessor3; - return externalEntityInitProcessor3(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor3(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - int tok; - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - eventPtr = start; - tok = XmlContentTok(encoding, start, end, &next); - eventEndPtr = next; - - switch (tok) { - case XML_TOK_XML_DECL: - { - enum XML_Error result; - result = processXmlDecl(parser, 1, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *endPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - start = next; - } - } - break; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityContentProcessor; - tagLevel = 1; - return externalEntityContentProcessor(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityContentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 1, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - } - return result; -} - -static enum XML_Error -doContent(XML_Parser parser, - int startTagLevel, - const ENCODING *enc, - const char *s, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - /* save one level of indirection */ - DTD * const dtd = _dtd; - - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - - for (;;) { - const char *next = s; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_TRAILING_CR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - *eventEndPP = end; - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - /* We are at the end of the final buffer, should we check for - XML_SUSPENDED, XML_FINISHED? - */ - if (startTagLevel == 0) - return XML_ERROR_NO_ELEMENTS; - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (startTagLevel > 0) { - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_NO_ELEMENTS; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (characterDataHandler) - characterDataHandler(handlerArg, &ch, 1); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&dtd->pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity or default handler. - */ - if (!dtd->hasParamEntityRefs || dtd->standalone) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->notation) - return XML_ERROR_BINARY_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - if (!defaultExpandInternalEntities) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, entity->name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - result = processInternalEntity(parser, entity, XML_FALSE); - if (result != XML_ERROR_NONE) - return result; - } - else if (externalEntityRefHandler) { - const XML_Char *context; - entity->open = XML_TRUE; - context = getContext(parser); - entity->open = XML_FALSE; - if (!context) - return XML_ERROR_NO_MEMORY; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - context, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - poolDiscard(&tempPool); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - case XML_TOK_START_TAG_NO_ATTS: - /* fall through */ - case XML_TOK_START_TAG_WITH_ATTS: - { - TAG *tag; - enum XML_Error result; - XML_Char *toPtr; - if (freeTagList) { - tag = freeTagList; - freeTagList = freeTagList->parent; - } - else { - tag = (TAG *)MALLOC(sizeof(TAG)); - if (!tag) - return XML_ERROR_NO_MEMORY; - tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE); - if (!tag->buf) { - FREE(tag); - return XML_ERROR_NO_MEMORY; - } - tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; - } - tag->bindings = NULL; - tag->parent = tagStack; - tagStack = tag; - tag->name.localPart = NULL; - tag->name.prefix = NULL; - tag->rawName = s + enc->minBytesPerChar; - tag->rawNameLength = XmlNameLength(enc, tag->rawName); - ++tagLevel; - { - const char *rawNameEnd = tag->rawName + tag->rawNameLength; - const char *fromPtr = tag->rawName; - toPtr = (XML_Char *)tag->buf; - for (;;) { - int bufSize; - int convLen; - XmlConvert(enc, - &fromPtr, rawNameEnd, - (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); - convLen = (int)(toPtr - (XML_Char *)tag->buf); - if (fromPtr == rawNameEnd) { - tag->name.strLen = convLen; - break; - } - bufSize = (int)(tag->bufEnd - tag->buf) << 1; - { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - tag->buf = temp; - tag->bufEnd = temp + bufSize; - toPtr = (XML_Char *)temp + convLen; - } - } - } - tag->name.str = (XML_Char *)tag->buf; - *toPtr = XML_T('\0'); - result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); - if (result) - return result; - if (startElementHandler) - startElementHandler(handlerArg, tag->name.str, - (const XML_Char **)atts); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - break; - } - case XML_TOK_EMPTY_ELEMENT_NO_ATTS: - /* fall through */ - case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: - { - const char *rawName = s + enc->minBytesPerChar; - enum XML_Error result; - BINDING *bindings = NULL; - XML_Bool noElmHandlers = XML_TRUE; - TAG_NAME name; - name.str = poolStoreString(&tempPool, enc, rawName, - rawName + XmlNameLength(enc, rawName)); - if (!name.str) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - result = storeAtts(parser, enc, s, &name, &bindings); - if (result) - return result; - poolFinish(&tempPool); - if (startElementHandler) { - startElementHandler(handlerArg, name.str, (const XML_Char **)atts); - noElmHandlers = XML_FALSE; - } - if (endElementHandler) { - if (startElementHandler) - *eventPP = *eventEndPP; - endElementHandler(handlerArg, name.str); - noElmHandlers = XML_FALSE; - } - if (noElmHandlers && defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - break; - case XML_TOK_END_TAG: - if (tagLevel == startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - else { - int len; - const char *rawName; - TAG *tag = tagStack; - tagStack = tag->parent; - tag->parent = freeTagList; - freeTagList = tag; - rawName = s + enc->minBytesPerChar*2; - len = XmlNameLength(enc, rawName); - if (len != tag->rawNameLength - || memcmp(tag->rawName, rawName, len) != 0) { - *eventPP = rawName; - return XML_ERROR_TAG_MISMATCH; - } - --tagLevel; - if (endElementHandler) { - const XML_Char *localPart; - const XML_Char *prefix; - XML_Char *uri; - localPart = tag->name.localPart; - if (ns && localPart) { - /* localPart and prefix may have been overwritten in - tag->name.str, since this points to the binding->uri - buffer which gets re-used; so we have to add them again - */ - uri = (XML_Char *)tag->name.str + tag->name.uriLen; - /* don't need to check for space - already done in storeAtts() */ - while (*localPart) *uri++ = *localPart++; - prefix = (XML_Char *)tag->name.prefix; - if (ns_triplets && prefix) { - *uri++ = namespaceSeparator; - while (*prefix) *uri++ = *prefix++; - } - *uri = XML_T('\0'); - } - endElementHandler(handlerArg, tag->name.str); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - while (tag->bindings) { - BINDING *b = tag->bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - tag->bindings = tag->bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - } - break; - case XML_TOK_CHAR_REF: - { - int n = XmlCharRefNumber(enc, s); - if (n < 0) - return XML_ERROR_BAD_CHAR_REF; - if (characterDataHandler) { - XML_Char buf[XML_ENCODE_MAX]; - characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_CDATA_SECT_OPEN: - { - enum XML_Error result; - if (startCdataSectionHandler) - startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the - transformation and writes the characters out escaping them as - necessary. This case will fail to work if we leave out the - following two lines (because & and < inside CDATA sections will - be incorrectly escaped). - - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. - */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = cdataSectionProcessor; - return result; - } - } - break; - case XML_TOK_TRAILING_RSQB: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)end - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - /* We are at the end of the final buffer, should we check for - XML_SUSPENDED, XML_FINISHED? - */ - if (startTagLevel == 0) { - *eventPP = end; - return XML_ERROR_NO_ELEMENTS; - } - if (tagLevel != startTagLevel) { - *eventPP = end; - return XML_ERROR_ASYNC_ENTITY; - } - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; - } - } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - default: - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - *eventPP = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } - /* not reached */ -} - -/* Precondition: all arguments must be non-NULL; - Purpose: - - normalize attributes - - check attributes for well-formedness - - generate namespace aware attribute names (URI, prefix) - - build list of attributes for startElementHandler - - default attributes - - process namespace declarations (check and report them) - - generate namespace aware element name (URI, prefix) -*/ -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *enc, - const char *attStr, TAG_NAME *tagNamePtr, - BINDING **bindingsPtr) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - ELEMENT_TYPE *elementType; - int nDefaultAtts; - const XML_Char **appAtts; /* the attribute list for the application */ - int attIndex = 0; - int prefixLen; - int i; - int n; - XML_Char *uri; - int nPrefixes = 0; - BINDING *binding; - const XML_Char *localPart; - - /* lookup the element type name */ - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str,0); - if (!elementType) { - const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str); - if (!name) - return XML_ERROR_NO_MEMORY; - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name, - sizeof(ELEMENT_TYPE)); - if (!elementType) - return XML_ERROR_NO_MEMORY; - if (ns && !setElementTypePrefix(parser, elementType)) - return XML_ERROR_NO_MEMORY; - } - nDefaultAtts = elementType->nDefaultAtts; - - /* get the attributes from the tokenizer */ - n = XmlGetAttributes(enc, attStr, attsSize, atts); - if (n + nDefaultAtts > attsSize) { - int oldAttsSize = attsSize; - ATTRIBUTE *temp; -#ifdef XML_ATTR_INFO - XML_AttrInfo *temp2; -#endif - attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; - temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - atts = temp; -#ifdef XML_ATTR_INFO - temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); - if (temp2 == NULL) - return XML_ERROR_NO_MEMORY; - attInfo = temp2; -#endif - if (n > oldAttsSize) - XmlGetAttributes(enc, attStr, n, atts); - } - - appAtts = (const XML_Char **)atts; - for (i = 0; i < n; i++) { - ATTRIBUTE *currAtt = &atts[i]; -#ifdef XML_ATTR_INFO - XML_AttrInfo *currAttInfo = &attInfo[i]; -#endif - /* add the name and value to the attribute list */ - ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name, - currAtt->name - + XmlNameLength(enc, currAtt->name)); - if (!attId) - return XML_ERROR_NO_MEMORY; -#ifdef XML_ATTR_INFO - currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name); - currAttInfo->nameEnd = currAttInfo->nameStart + - XmlNameLength(enc, currAtt->name); - currAttInfo->valueStart = parseEndByteIndex - - (parseEndPtr - currAtt->valuePtr); - currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd); -#endif - /* Detect duplicate attributes by their QNames. This does not work when - namespace processing is turned on and different prefixes for the same - namespace are used. For this case we have a check further down. - */ - if ((attId->name)[-1]) { - if (enc == encoding) - eventPtr = atts[i].name; - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - (attId->name)[-1] = 1; - appAtts[attIndex++] = attId->name; - if (!atts[i].normalized) { - enum XML_Error result; - XML_Bool isCdata = XML_TRUE; - - /* figure out whether declared as other than CDATA */ - if (attId->maybeTokenized) { - int j; - for (j = 0; j < nDefaultAtts; j++) { - if (attId == elementType->defaultAtts[j].id) { - isCdata = elementType->defaultAtts[j].isCdata; - break; - } - } - } - - /* normalize the attribute value */ - result = storeAttributeValue(parser, enc, isCdata, - atts[i].valuePtr, atts[i].valueEnd, - &tempPool); - if (result) - return result; - appAtts[attIndex] = poolStart(&tempPool); - poolFinish(&tempPool); - } - else { - /* the value did not need normalizing */ - appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, - atts[i].valueEnd); - if (appAtts[attIndex] == 0) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - /* handle prefixed attribute names */ - if (attId->prefix) { - if (attId->xmlns) { - /* deal with namespace declarations here */ - enum XML_Error result = addBinding(parser, attId->prefix, attId, - appAtts[attIndex], bindingsPtr); - if (result) - return result; - --attIndex; - } - else { - /* deal with other prefixed names later */ - attIndex++; - nPrefixes++; - (attId->name)[-1] = 2; - } - } - else - attIndex++; - } - - /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */ - nSpecifiedAtts = attIndex; - if (elementType->idAtt && (elementType->idAtt->name)[-1]) { - for (i = 0; i < attIndex; i += 2) - if (appAtts[i] == elementType->idAtt->name) { - idAttIndex = i; - break; - } - } - else - idAttIndex = -1; - - /* do attribute defaulting */ - for (i = 0; i < nDefaultAtts; i++) { - const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i; - if (!(da->id->name)[-1] && da->value) { - if (da->id->prefix) { - if (da->id->xmlns) { - enum XML_Error result = addBinding(parser, da->id->prefix, da->id, - da->value, bindingsPtr); - if (result) - return result; - } - else { - (da->id->name)[-1] = 2; - nPrefixes++; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - else { - (da->id->name)[-1] = 1; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - } - appAtts[attIndex] = 0; - - /* expand prefixed attribute names, check for duplicates, - and clear flags that say whether attributes were specified */ - i = 0; - if (nPrefixes) { - int j; /* hash table index */ - unsigned long version = nsAttsVersion; - int nsAttsSize = (int)1 << nsAttsPower; - /* size of hash table must be at least 2 * (# of prefixed attributes) */ - if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ - NS_ATT *temp; - /* hash table size must also be a power of 2 and >= 8 */ - while (nPrefixes >> nsAttsPower++); - if (nsAttsPower < 3) - nsAttsPower = 3; - nsAttsSize = (int)1 << nsAttsPower; - temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); - if (!temp) - return XML_ERROR_NO_MEMORY; - nsAtts = temp; - version = 0; /* force re-initialization of nsAtts hash table */ - } - /* using a version flag saves us from initializing nsAtts every time */ - if (!version) { /* initialize version flags when version wraps around */ - version = INIT_ATTS_VERSION; - for (j = nsAttsSize; j != 0; ) - nsAtts[--j].version = version; - } - nsAttsVersion = --version; - - /* expand prefixed names and check for duplicates */ - for (; i < attIndex; i += 2) { - const XML_Char *s = appAtts[i]; - if (s[-1] == 2) { /* prefixed */ - ATTRIBUTE_ID *id; - const BINDING *b; - unsigned long uriHash = hash_secret_salt; - ((XML_Char *)s)[-1] = 0; /* clear flag */ - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); - b = id->prefix->binding; - if (!b) - return XML_ERROR_UNBOUND_PREFIX; - - /* as we expand the name we also calculate its hash value */ - for (j = 0; j < b->uriLen; j++) { - const XML_Char c = b->uri[j]; - if (!poolAppendChar(&tempPool, c)) - return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); - } - while (*s++ != XML_T(ASCII_COLON)) - ; - do { /* copies null terminator */ - const XML_Char c = *s; - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); - } while (*s++); - - { /* Check hash table for duplicate of expanded name (uriName). - Derived from code in lookup(parser, HASH_TABLE *table, ...). - */ - unsigned char step = 0; - unsigned long mask = nsAttsSize - 1; - j = uriHash & mask; /* index into hash table */ - while (nsAtts[j].version == version) { - /* for speed we compare stored hash values first */ - if (uriHash == nsAtts[j].hash) { - const XML_Char *s1 = poolStart(&tempPool); - const XML_Char *s2 = nsAtts[j].uriName; - /* s1 is null terminated, but not s2 */ - for (; *s1 == *s2 && *s1 != 0; s1++, s2++); - if (*s1 == 0) - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - if (!step) - step = PROBE_STEP(uriHash, mask, nsAttsPower); - j < step ? (j += nsAttsSize - step) : (j -= step); - } - } - - if (ns_triplets) { /* append namespace separator and prefix */ - tempPool.ptr[-1] = namespaceSeparator; - s = b->prefix->name; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - } - - /* store expanded name in attribute list */ - s = poolStart(&tempPool); - poolFinish(&tempPool); - appAtts[i] = s; - - /* fill empty slot with new version, uriName and hash value */ - nsAtts[j].version = version; - nsAtts[j].hash = uriHash; - nsAtts[j].uriName = s; - - if (!--nPrefixes) { - i += 2; - break; - } - } - else /* not prefixed */ - ((XML_Char *)s)[-1] = 0; /* clear flag */ - } - } - /* clear flags for the remaining attributes */ - for (; i < attIndex; i += 2) - ((XML_Char *)(appAtts[i]))[-1] = 0; - for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) - binding->attId->name[-1] = 0; - - if (!ns) - return XML_ERROR_NONE; - - /* expand the element type name */ - if (elementType->prefix) { - binding = elementType->prefix->binding; - if (!binding) - return XML_ERROR_UNBOUND_PREFIX; - localPart = tagNamePtr->str; - while (*localPart++ != XML_T(ASCII_COLON)) - ; - } - else if (dtd->defaultPrefix.binding) { - binding = dtd->defaultPrefix.binding; - localPart = tagNamePtr->str; - } - else - return XML_ERROR_NONE; - prefixLen = 0; - if (ns_triplets && binding->prefix->name) { - for (; binding->prefix->name[prefixLen++];) - ; /* prefixLen includes null terminator */ - } - tagNamePtr->localPart = localPart; - tagNamePtr->uriLen = binding->uriLen; - tagNamePtr->prefix = binding->prefix->name; - tagNamePtr->prefixLen = prefixLen; - for (i = 0; localPart[i++];) - ; /* i includes null terminator */ - n = i + binding->uriLen + prefixLen; - if (n > binding->uriAlloc) { - TAG *p; - uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); - if (!uri) - return XML_ERROR_NO_MEMORY; - binding->uriAlloc = n + EXPAND_SPARE; - memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); - for (p = tagStack; p; p = p->parent) - if (p->name.str == binding->uri) - p->name.str = uri; - FREE(binding->uri); - binding->uri = uri; - } - /* if namespaceSeparator != '\0' then uri includes it already */ - uri = binding->uri + binding->uriLen; - memcpy(uri, localPart, i * sizeof(XML_Char)); - /* we always have a namespace separator between localPart and prefix */ - if (prefixLen) { - uri += i - 1; - *uri = namespaceSeparator; /* replace null terminator */ - memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); - } - tagNamePtr->str = binding->uri; - return XML_ERROR_NONE; -} - -/* addBinding() overwrites the value of prefix->binding without checking. - Therefore one must keep track of the old value outside of addBinding(). -*/ -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr) -{ - static const XML_Char xmlNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, - ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH, - ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, - ASCII_e, '\0' - }; - static const int xmlLen = - (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1; - static const XML_Char xmlnsNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0, - ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s, - ASCII_SLASH, '\0' - }; - static const int xmlnsLen = - (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1; - - XML_Bool mustBeXML = XML_FALSE; - XML_Bool isXML = XML_TRUE; - XML_Bool isXMLNS = XML_TRUE; - - BINDING *b; - int len; - - /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */ - if (*uri == XML_T('\0') && prefix->name) - return XML_ERROR_UNDECLARING_PREFIX; - - if (prefix->name - && prefix->name[0] == XML_T(ASCII_x) - && prefix->name[1] == XML_T(ASCII_m) - && prefix->name[2] == XML_T(ASCII_l)) { - - /* Not allowed to bind xmlns */ - if (prefix->name[3] == XML_T(ASCII_n) - && prefix->name[4] == XML_T(ASCII_s) - && prefix->name[5] == XML_T('\0')) - return XML_ERROR_RESERVED_PREFIX_XMLNS; - - if (prefix->name[3] == XML_T('\0')) - mustBeXML = XML_TRUE; - } - - for (len = 0; uri[len]; len++) { - if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len])) - isXML = XML_FALSE; - - if (!mustBeXML && isXMLNS - && (len > xmlnsLen || uri[len] != xmlnsNamespace[len])) - isXMLNS = XML_FALSE; - } - isXML = isXML && len == xmlLen; - isXMLNS = isXMLNS && len == xmlnsLen; - - if (mustBeXML != isXML) - return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML - : XML_ERROR_RESERVED_NAMESPACE_URI; - - if (isXMLNS) - return XML_ERROR_RESERVED_NAMESPACE_URI; - - if (namespaceSeparator) - len++; - if (freeBindingList) { - b = freeBindingList; - if (len > b->uriAlloc) { - XML_Char *temp = (XML_Char *)REALLOC(b->uri, - sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - b->uri = temp; - b->uriAlloc = len + EXPAND_SPARE; - } - freeBindingList = b->nextTagBinding; - } - else { - b = (BINDING *)MALLOC(sizeof(BINDING)); - if (!b) - return XML_ERROR_NO_MEMORY; - b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) { - FREE(b); - return XML_ERROR_NO_MEMORY; - } - b->uriAlloc = len + EXPAND_SPARE; - } - b->uriLen = len; - memcpy(b->uri, uri, len * sizeof(XML_Char)); - if (namespaceSeparator) - b->uri[len - 1] = namespaceSeparator; - b->prefix = prefix; - b->attId = attId; - b->prevPrefixBinding = prefix->binding; - /* NULL binding when default namespace undeclared */ - if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix) - prefix->binding = NULL; - else - prefix->binding = b; - b->nextTagBinding = *bindingsPtr; - *bindingsPtr = b; - /* if attId == NULL then we are not starting a namespace scope */ - if (attId && startNamespaceDeclHandler) - startNamespaceDeclHandler(handlerArg, prefix->name, - prefix->binding ? uri : 0); - return XML_ERROR_NONE; -} - -/* The idea here is to avoid using stack for each CDATA section when - the whole file is parsed with one call. -*/ -static enum XML_Error PTRCALL -cdataSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doCdataSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result != XML_ERROR_NONE) - return result; - if (start) { - if (parentParser) { /* we are parsing an external entity */ - processor = externalEntityContentProcessor; - return externalEntityContentProcessor(parser, start, end, endPtr); - } - else { - processor = contentProcessor; - return contentProcessor(parser, start, end, endPtr); - } - } - return result; -} - -/* startPtr gets set to non-null if the section is closed, and to null if - the section is not yet closed. -*/ -static enum XML_Error -doCdataSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - - for (;;) { - const char *next; - int tok = XmlCdataSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_CDATA_SECT_CLOSE: - if (endCdataSectionHandler) - endCdataSectionHandler(handlerArg); -#if 0 - /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - *nextPtr = next; - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - else - return XML_ERROR_NONE; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; - } - } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_CDATA_SECTION; - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - - *eventPP = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } - /* not reached */ -} - -#ifdef XML_DTD - -/* The idea here is to avoid using stack for each IGNORE section when - the whole file is parsed with one call. -*/ -static enum XML_Error PTRCALL -ignoreSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result != XML_ERROR_NONE) - return result; - if (start) { - processor = prologProcessor; - return prologProcessor(parser, start, end, endPtr); - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null - if the section is not yet closed. -*/ -static enum XML_Error -doIgnoreSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *next; - int tok; - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - tok = XmlIgnoreSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_IGNORE_SECT: - if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - *nextPtr = next; - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - else - return XML_ERROR_NONE; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - /* not reached */ -} - -#endif /* XML_DTD */ - -static enum XML_Error -initializeEncoding(XML_Parser parser) -{ - const char *s; -#ifdef XML_UNICODE - char encodingBuf[128]; - if (!protocolEncodingName) - s = NULL; - else { - int i; - for (i = 0; protocolEncodingName[i]; i++) { - if (i == sizeof(encodingBuf) - 1 - || (protocolEncodingName[i] & ~0x7f) != 0) { - encodingBuf[0] = '\0'; - break; - } - encodingBuf[i] = (char)protocolEncodingName[i]; - } - encodingBuf[i] = '\0'; - s = encodingBuf; - } -#else - s = protocolEncodingName; -#endif - if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) - return XML_ERROR_NONE; - return handleUnknownEncoding(parser, protocolEncodingName); -} - -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next) -{ - const char *encodingName = NULL; - const XML_Char *storedEncName = NULL; - const ENCODING *newEncoding = NULL; - const char *version = NULL; - const char *versionend; - const XML_Char *storedversion = NULL; - int standalone = -1; - if (!(ns - ? XmlParseXmlDeclNS - : XmlParseXmlDecl)(isGeneralTextEntity, - encoding, - s, - next, - &eventPtr, - &version, - &versionend, - &encodingName, - &newEncoding, - &standalone)) { - if (isGeneralTextEntity) - return XML_ERROR_TEXT_DECL; - else - return XML_ERROR_XML_DECL; - } - if (!isGeneralTextEntity && standalone == 1) { - _dtd->standalone = XML_TRUE; -#ifdef XML_DTD - if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif /* XML_DTD */ - } - if (xmlDeclHandler) { - if (encodingName != NULL) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - poolFinish(&temp2Pool); - } - if (version) { - storedversion = poolStoreString(&temp2Pool, - encoding, - version, - versionend - encoding->minBytesPerChar); - if (!storedversion) - return XML_ERROR_NO_MEMORY; - } - xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); - } - else if (defaultHandler) - reportDefault(parser, encoding, s, next); - if (protocolEncodingName == NULL) { - if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { - eventPtr = encodingName; - return XML_ERROR_INCORRECT_ENCODING; - } - encoding = newEncoding; - } - else if (encodingName) { - enum XML_Error result; - if (!storedEncName) { - storedEncName = poolStoreString( - &temp2Pool, encoding, encodingName, - encodingName + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - } - result = handleUnknownEncoding(parser, storedEncName); - poolClear(&temp2Pool); - if (result == XML_ERROR_UNKNOWN_ENCODING) - eventPtr = encodingName; - return result; - } - } - - if (storedEncName || storedversion) - poolClear(&temp2Pool); - - return XML_ERROR_NONE; -} - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (unknownEncodingHandler) { - XML_Encoding info; - int i; - for (i = 0; i < 256; i++) - info.map[i] = -1; - info.convert = NULL; - info.data = NULL; - info.release = NULL; - if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, - &info)) { - ENCODING *enc; - unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); - if (!unknownEncodingMem) { - if (info.release) - info.release(info.data); - return XML_ERROR_NO_MEMORY; - } - enc = (ns - ? XmlInitUnknownEncodingNS - : XmlInitUnknownEncoding)(unknownEncodingMem, - info.map, - info.convert, - info.data); - if (enc) { - unknownEncodingData = info.data; - unknownEncodingRelease = info.release; - encoding = enc; - return XML_ERROR_NONE; - } - } - if (info.release != NULL) - info.release(info.data); - } - return XML_ERROR_UNKNOWN_ENCODING; -} - -static enum XML_Error PTRCALL -prologInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = prologProcessor; - return prologProcessor(parser, s, end, nextPtr); -} - -#ifdef XML_DTD - -static enum XML_Error PTRCALL -externalParEntInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - - /* we know now that XML_Parse(Buffer) has been called, - so we consider the external parameter entity read */ - _dtd->paramEntityRead = XML_TRUE; - - if (prologState.inEntityValue) { - processor = entityValueInitProcessor; - return entityValueInitProcessor(parser, s, end, nextPtr); - } - else { - processor = externalParEntProcessor; - return externalParEntProcessor(parser, s, end, nextPtr); - } -} - -static enum XML_Error PTRCALL -entityValueInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - int tok; - const char *start = s; - const char *next = start; - eventPtr = start; - - for (;;) { - tok = XmlPrologTok(encoding, start, end, &next); - eventEndPtr = next; - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - /* found end of entity value - can store it now */ - return storeEntityValue(parser, encoding, s, end); - } - else if (tok == XML_TOK_XML_DECL) { - enum XML_Error result; - result = processXmlDecl(parser, 0, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - *nextPtr = next; - } - /* stop scanning for text declaration - we found one */ - processor = entityValueProcessor; - return entityValueProcessor(parser, next, end, nextPtr); - } - /* If we are at the end of the buffer, this would cause XmlPrologTok to - return XML_TOK_NONE on the next call, which would then cause the - function to exit with *nextPtr set to s - that is what we want for other - tokens, but not for the BOM - we would rather like to skip it; - then, when this routine is entered the next time, XmlPrologTok will - return XML_TOK_INVALID, since the BOM is still in the buffer - */ - else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) { - *nextPtr = next; - return XML_ERROR_NONE; - } - start = next; - eventPtr = start; - } -} - -static enum XML_Error PTRCALL -externalParEntProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok; - - tok = XmlPrologTok(encoding, s, end, &next); - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - } - /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. - However, when parsing an external subset, doProlog will not accept a BOM - as valid, and report a syntax error, so we have to skip the BOM - */ - else if (tok == XML_TOK_BOM) { - s = next; - tok = XmlPrologTok(encoding, s, end, &next); - } - - processor = prologProcessor; - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); -} - -static enum XML_Error PTRCALL -entityValueProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *start = s; - const char *next = s; - const ENCODING *enc = encoding; - int tok; - - for (;;) { - tok = XmlPrologTok(enc, start, end, &next); - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - /* found end of entity value - can store it now */ - return storeEntityValue(parser, enc, s, end); - } - start = next; - } -} - -#endif /* XML_DTD */ - -static enum XML_Error PTRCALL -prologProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); -} - -static enum XML_Error -doProlog(XML_Parser parser, - const ENCODING *enc, - const char *s, - const char *end, - int tok, - const char *next, - const char **nextPtr, - XML_Bool haveMore) -{ -#ifdef XML_DTD - static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' }; -#endif /* XML_DTD */ - static const XML_Char atypeCDATA[] = - { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; - static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' }; - static const XML_Char atypeIDREF[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; - static const XML_Char atypeIDREFS[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; - static const XML_Char atypeENTITY[] = - { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; - static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N, - ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; - static const XML_Char atypeNMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; - static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, - ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; - static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T, - ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' }; - static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' }; - static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' }; - - /* save one level of indirection */ - DTD * const dtd = _dtd; - - const char **eventPP; - const char **eventEndPP; - enum XML_Content_Quant quant; - - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - - for (;;) { - int role; - XML_Bool handleDefault = XML_TRUE; - *eventPP = s; - *eventEndPP = next; - if (tok <= 0) { - if (haveMore && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case -XML_TOK_PROLOG_S: - tok = -tok; - break; - case XML_TOK_NONE: -#ifdef XML_DTD - /* for internal PE NOT referenced between declarations */ - if (enc != encoding && !openInternalEntities->betweenDecl) { - *nextPtr = s; - return XML_ERROR_NONE; - } - /* WFC: PE Between Declarations - must check that PE contains - complete markup, not only for external PEs, but also for - internal PEs if the reference occurs between declarations. - */ - if (isParamEntity || enc != encoding) { - if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) - == XML_ROLE_ERROR) - return XML_ERROR_INCOMPLETE_PE; - *nextPtr = s; - return XML_ERROR_NONE; - } -#endif /* XML_DTD */ - return XML_ERROR_NO_ELEMENTS; - default: - tok = -tok; - next = end; - break; - } - } - role = XmlTokenRole(&prologState, tok, s, next, enc); - switch (role) { - case XML_ROLE_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 0, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_NAME: - if (startDoctypeDeclHandler) { - doctypeName = poolStoreString(&tempPool, enc, s, next); - if (!doctypeName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - doctypePubid = NULL; - handleDefault = XML_FALSE; - } - doctypeSysid = NULL; /* always initialize to NULL */ - break; - case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: - if (startDoctypeDeclHandler) { - startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, - doctypePubid, 1); - doctypeName = NULL; - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - break; -#ifdef XML_DTD - case XML_ROLE_TEXT_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; -#endif /* XML_DTD */ - case XML_ROLE_DOCTYPE_PUBLIC_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; -#endif /* XML_DTD */ - dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - XML_Char *pubId; - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - pubId = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!pubId) - return XML_ERROR_NO_MEMORY; - normalizePublicId(pubId); - poolFinish(&tempPool); - doctypePubid = pubId; - handleDefault = XML_FALSE; - goto alreadyChecked; - } - /* fall through */ - case XML_ROLE_ENTITY_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - alreadyChecked: - if (dtd->keepProcessing && declEntity) { - XML_Char *tem = poolStoreString(&dtd->pool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declEntity->publicId = tem; - poolFinish(&dtd->pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_CLOSE: - if (doctypeName) { - startDoctypeDeclHandler(handlerArg, doctypeName, - doctypeSysid, doctypePubid, 0); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - /* doctypeSysid will be non-NULL in the case of a previous - XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler - was not set, indicating an external subset - */ -#ifdef XML_DTD - if (doctypeSysid || useForeignDTD) { - XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; - dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - if (useForeignDTD) - entity->base = curBase; - dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - /* if we didn't read the foreign DTD then this means that there - is no external subset and we must reset dtd->hasParamEntityRefs - */ - else if (!doctypeSysid) - dtd->hasParamEntityRefs = hadParamEntityRefs; - /* end of DTD - no need to update dtd->keepProcessing */ - } - useForeignDTD = XML_FALSE; - } -#endif /* XML_DTD */ - if (endDoctypeDeclHandler) { - endDoctypeDeclHandler(handlerArg); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_INSTANCE_START: -#ifdef XML_DTD - /* if there is no DOCTYPE declaration then now is the - last chance to read the foreign DTD - */ - if (useForeignDTD) { - XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; - dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - entity->base = curBase; - dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - /* if we didn't read the foreign DTD then this means that there - is no external subset and we must reset dtd->hasParamEntityRefs - */ - else - dtd->hasParamEntityRefs = hadParamEntityRefs; - /* end of DTD - no need to update dtd->keepProcessing */ - } - } -#endif /* XML_DTD */ - processor = contentProcessor; - return contentProcessor(parser, s, end, nextPtr); - case XML_ROLE_ATTLIST_ELEMENT_NAME: - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_NAME: - declAttributeId = getAttributeId(parser, enc, s, next); - if (!declAttributeId) - return XML_ERROR_NO_MEMORY; - declAttributeIsCdata = XML_FALSE; - declAttributeType = NULL; - declAttributeIsId = XML_FALSE; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_CDATA: - declAttributeIsCdata = XML_TRUE; - declAttributeType = atypeCDATA; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ID: - declAttributeIsId = XML_TRUE; - declAttributeType = atypeID; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREF: - declAttributeType = atypeIDREF; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: - declAttributeType = atypeIDREFS; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: - declAttributeType = atypeENTITY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: - declAttributeType = atypeENTITIES; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: - declAttributeType = atypeNMTOKEN; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: - declAttributeType = atypeNMTOKENS; - checkAttListDeclHandler: - if (dtd->keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTRIBUTE_ENUM_VALUE: - case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: - if (dtd->keepProcessing && attlistDeclHandler) { - const XML_Char *prefix; - if (declAttributeType) { - prefix = enumValueSep; - } - else { - prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE - ? notationPrefix - : enumValueStart); - } - if (!poolAppendString(&tempPool, prefix)) - return XML_ERROR_NO_MEMORY; - if (!poolAppend(&tempPool, enc, s, next)) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: - case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: - if (dtd->keepProcessing) { - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, declAttributeIsId, - 0, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: - case XML_ROLE_FIXED_ATTRIBUTE_VALUE: - if (dtd->keepProcessing) { - const XML_Char *attVal; - enum XML_Error result = - storeAttributeValue(parser, enc, declAttributeIsCdata, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar, - &dtd->pool); - if (result) - return result; - attVal = poolStart(&dtd->pool); - poolFinish(&dtd->pool); - /* ID attributes aren't allowed to have a default */ - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, XML_FALSE, attVal, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - attVal, - role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_ENTITY_VALUE: - if (dtd->keepProcessing) { - enum XML_Error result = storeEntityValue(parser, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (declEntity) { - declEntity->textPtr = poolStart(&dtd->entityValuePool); - declEntity->textLen = (int)(poolLength(&dtd->entityValuePool)); - poolFinish(&dtd->entityValuePool); - if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - declEntity->textPtr, - declEntity->textLen, - curBase, 0, 0, 0); - handleDefault = XML_FALSE; - } - } - else - poolDiscard(&dtd->entityValuePool); - if (result != XML_ERROR_NONE) - return result; - } - break; - case XML_ROLE_DOCTYPE_SYSTEM_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; -#endif /* XML_DTD */ - dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - doctypeSysid = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (doctypeSysid == NULL) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } -#ifdef XML_DTD - else - /* use externalSubsetName to make doctypeSysid non-NULL - for the case where no startDoctypeDeclHandler is set */ - doctypeSysid = externalSubsetName; -#endif /* XML_DTD */ - if (!dtd->standalone -#ifdef XML_DTD - && !paramEntityParsing -#endif /* XML_DTD */ - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; -#ifndef XML_DTD - break; -#else /* XML_DTD */ - if (!declEntity) { - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - declEntity->publicId = NULL; - } - /* fall through */ -#endif /* XML_DTD */ - case XML_ROLE_ENTITY_SYSTEM_ID: - if (dtd->keepProcessing && declEntity) { - declEntity->systemId = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!declEntity->systemId) - return XML_ERROR_NO_MEMORY; - declEntity->base = curBase; - poolFinish(&dtd->pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_COMPLETE: - if (dtd->keepProcessing && declEntity && entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - 0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - 0); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_NOTATION_NAME: - if (dtd->keepProcessing && declEntity) { - declEntity->notation = poolStoreString(&dtd->pool, enc, s, next); - if (!declEntity->notation) - return XML_ERROR_NO_MEMORY; - poolFinish(&dtd->pool); - if (unparsedEntityDeclHandler) { - *eventEndPP = s; - unparsedEntityDeclHandler(handlerArg, - declEntity->name, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - else if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_GENERAL_ENTITY_NAME: - { - if (XmlPredefinedEntityName(enc, s, next)) { - declEntity = NULL; - break; - } - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_FALSE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - } - break; - case XML_ROLE_PARAM_ENTITY_NAME: -#ifdef XML_DTD - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, - name, sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_TRUE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd->pool); - declEntity = NULL; - } -#else /* not XML_DTD */ - declEntity = NULL; -#endif /* XML_DTD */ - break; - case XML_ROLE_NOTATION_NAME: - declNotationPublicId = NULL; - declNotationName = NULL; - if (notationDeclHandler) { - declNotationName = poolStoreString(&tempPool, enc, s, next); - if (!declNotationName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - if (declNotationName) { /* means notationDeclHandler != NULL */ - XML_Char *tem = poolStoreString(&tempPool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declNotationPublicId = tem; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_SYSTEM_ID: - if (declNotationName && notationDeclHandler) { - const XML_Char *systemId - = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!systemId) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - systemId, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_NOTATION_NO_SYSTEM_ID: - if (declNotationPublicId && notationDeclHandler) { - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - 0, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_ERROR: - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: - /* PE references in internal subset are - not allowed within declarations. */ - return XML_ERROR_PARAM_ENTITY_REF; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - default: - return XML_ERROR_SYNTAX; - } -#ifdef XML_DTD - case XML_ROLE_IGNORE_SECT: - { - enum XML_Error result; - if (defaultHandler) - reportDefault(parser, enc, s, next); - handleDefault = XML_FALSE; - result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = ignoreSectionProcessor; - return result; - } - } - break; -#endif /* XML_DTD */ - case XML_ROLE_GROUP_OPEN: - if (prologState.level >= groupSize) { - if (groupSize) { - char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - groupConnector = temp; - if (dtd->scaffIndex) { - int *temp = (int *)REALLOC(dtd->scaffIndex, - groupSize * sizeof(int)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - dtd->scaffIndex = temp; - } - } - else { - groupConnector = (char *)MALLOC(groupSize = 32); - if (!groupConnector) - return XML_ERROR_NO_MEMORY; - } - } - groupConnector[prologState.level] = 0; - if (dtd->in_eldecl) { - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd->scaffIndex[dtd->scaffLevel] = myindex; - dtd->scaffLevel++; - dtd->scaffold[myindex].type = XML_CTYPE_SEQ; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_GROUP_SEQUENCE: - if (groupConnector[prologState.level] == ASCII_PIPE) - return XML_ERROR_SYNTAX; - groupConnector[prologState.level] = ASCII_COMMA; - if (dtd->in_eldecl && elementDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_GROUP_CHOICE: - if (groupConnector[prologState.level] == ASCII_COMMA) - return XML_ERROR_SYNTAX; - if (dtd->in_eldecl - && !groupConnector[prologState.level] - && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - != XML_CTYPE_MIXED) - ) { - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - = XML_CTYPE_CHOICE; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - groupConnector[prologState.level] = ASCII_PIPE; - break; - case XML_ROLE_PARAM_ENTITY_REF: -#ifdef XML_DTD - case XML_ROLE_INNER_PARAM_ENTITY_REF: - dtd->hasParamEntityRefs = XML_TRUE; - if (!paramEntityParsing) - dtd->keepProcessing = dtd->standalone; - else { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&dtd->pool); - /* first, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity handler - */ - if (prologState.documentEntity && - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs)) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - dtd->keepProcessing = dtd->standalone; - /* cannot report skipped entities in declarations */ - if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { - skippedEntityHandler(handlerArg, name, 1); - handleDefault = XML_FALSE; - } - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - XML_Bool betweenDecl = - (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE); - result = processInternalEntity(parser, entity, betweenDecl); - if (result != XML_ERROR_NONE) - return result; - handleDefault = XML_FALSE; - break; - } - if (externalEntityRefHandler) { - dtd->paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - } - entity->open = XML_FALSE; - handleDefault = XML_FALSE; - if (!dtd->paramEntityRead) { - dtd->keepProcessing = dtd->standalone; - break; - } - } - else { - dtd->keepProcessing = dtd->standalone; - break; - } - } -#endif /* XML_DTD */ - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - break; - - /* Element declaration stuff */ - - case XML_ROLE_ELEMENT_NAME: - if (elementDeclHandler) { - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - dtd->scaffLevel = 0; - dtd->scaffCount = 0; - dtd->in_eldecl = XML_TRUE; - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ANY: - case XML_ROLE_CONTENT_EMPTY: - if (dtd->in_eldecl) { - if (elementDeclHandler) { - XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); - if (!content) - return XML_ERROR_NO_MEMORY; - content->quant = XML_CQUANT_NONE; - content->name = NULL; - content->numchildren = 0; - content->children = NULL; - content->type = ((role == XML_ROLE_CONTENT_ANY) ? - XML_CTYPE_ANY : - XML_CTYPE_EMPTY); - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, content); - handleDefault = XML_FALSE; - } - dtd->in_eldecl = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_PCDATA: - if (dtd->in_eldecl) { - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - = XML_CTYPE_MIXED; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ELEMENT: - quant = XML_CQUANT_NONE; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_OPT: - quant = XML_CQUANT_OPT; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_REP: - quant = XML_CQUANT_REP; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_PLUS: - quant = XML_CQUANT_PLUS; - elementContent: - if (dtd->in_eldecl) { - ELEMENT_TYPE *el; - const XML_Char *name; - int nameLen; - const char *nxt = (quant == XML_CQUANT_NONE - ? next - : next - enc->minBytesPerChar); - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd->scaffold[myindex].type = XML_CTYPE_NAME; - dtd->scaffold[myindex].quant = quant; - el = getElementType(parser, enc, s, nxt); - if (!el) - return XML_ERROR_NO_MEMORY; - name = el->name; - dtd->scaffold[myindex].name = name; - nameLen = 0; - for (; name[nameLen++]; ); - dtd->contentStringLen += nameLen; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_GROUP_CLOSE: - quant = XML_CQUANT_NONE; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_OPT: - quant = XML_CQUANT_OPT; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_REP: - quant = XML_CQUANT_REP; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_PLUS: - quant = XML_CQUANT_PLUS; - closeGroup: - if (dtd->in_eldecl) { - if (elementDeclHandler) - handleDefault = XML_FALSE; - dtd->scaffLevel--; - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant; - if (dtd->scaffLevel == 0) { - if (!handleDefault) { - XML_Content *model = build_model(parser); - if (!model) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, model); - } - dtd->in_eldecl = XML_FALSE; - dtd->contentStringLen = 0; - } - } - break; - /* End element declaration stuff */ - - case XML_ROLE_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_NONE: - switch (tok) { - case XML_TOK_BOM: - handleDefault = XML_FALSE; - break; - } - break; - case XML_ROLE_DOCTYPE_NONE: - if (startDoctypeDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ENTITY_NONE: - if (dtd->keepProcessing && entityDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_NOTATION_NONE: - if (notationDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTLIST_NONE: - if (dtd->keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ELEMENT_NONE: - if (elementDeclHandler) - handleDefault = XML_FALSE; - break; - } /* end of big switch */ - - if (handleDefault && defaultHandler) - reportDefault(parser, enc, s, next); - - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - s = next; - tok = XmlPrologTok(enc, s, end, &next); - } - } - /* not reached */ -} - -static enum XML_Error PTRCALL -epilogProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - processor = epilogProcessor; - eventPtr = s; - for (;;) { - const char *next = NULL; - int tok = XmlPrologTok(encoding, s, end, &next); - eventEndPtr = next; - switch (tok) { - /* report partial linebreak - it might be the last token */ - case -XML_TOK_PROLOG_S: - if (defaultHandler) { - reportDefault(parser, encoding, s, next); - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - } - *nextPtr = next; - return XML_ERROR_NONE; - case XML_TOK_NONE: - *nextPtr = s; - return XML_ERROR_NONE; - case XML_TOK_PROLOG_S: - if (defaultHandler) - reportDefault(parser, encoding, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_INVALID: - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - default: - return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; - } - eventPtr = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } -} - -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl) -{ - const char *textStart, *textEnd; - const char *next; - enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity; - - if (freeInternalEntities) { - openEntity = freeInternalEntities; - freeInternalEntities = openEntity->next; - } - else { - openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY)); - if (!openEntity) - return XML_ERROR_NO_MEMORY; - } - entity->open = XML_TRUE; - entity->processed = 0; - openEntity->next = openInternalEntities; - openInternalEntities = openEntity; - openEntity->entity = entity; - openEntity->startTagLevel = tagLevel; - openEntity->betweenDecl = betweenDecl; - openEntity->internalEventPtr = NULL; - openEntity->internalEventEndPtr = NULL; - textStart = (char *)entity->textPtr; - textEnd = (char *)(entity->textPtr + entity->textLen); - -#ifdef XML_DTD - if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else -#endif /* XML_DTD */ - result = doContent(parser, tagLevel, internalEncoding, textStart, - textEnd, &next, XML_FALSE); - - if (result == XML_ERROR_NONE) { - if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - textStart); - processor = internalEntityProcessor; - } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - } - return result; -} - -static enum XML_Error PTRCALL -internalEntityProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - ENTITY *entity; - const char *textStart, *textEnd; - const char *next; - enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities; - if (!openEntity) - return XML_ERROR_UNEXPECTED_STATE; - - entity = openEntity->entity; - textStart = ((char *)entity->textPtr) + entity->processed; - textEnd = (char *)(entity->textPtr + entity->textLen); - -#ifdef XML_DTD - if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else -#endif /* XML_DTD */ - result = doContent(parser, openEntity->startTagLevel, internalEncoding, - textStart, textEnd, &next, XML_FALSE); - - if (result != XML_ERROR_NONE) - return result; - else if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - (char *)entity->textPtr); - return result; - } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - -#ifdef XML_DTD - if (entity->is_param) { - int tok; - processor = prologProcessor; - tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, nextPtr, - (XML_Bool)!ps_finalBuffer); - } - else -#endif /* XML_DTD */ - { - processor = contentProcessor; - /* see externalEntityContentProcessor vs contentProcessor */ - return doContent(parser, parentParser ? 1 : 0, encoding, s, end, - nextPtr, (XML_Bool)!ps_finalBuffer); - } -} - -static enum XML_Error PTRCALL -errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - return errorCode; -} - -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, - end, pool); - if (result) - return result; - if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) - poolChop(pool); - if (!poolAppendChar(pool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - return XML_ERROR_NONE; -} - -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - for (;;) { - const char *next; - int tok = XmlAttributeValueTok(enc, ptr, end, &next); - switch (tok) { - case XML_TOK_NONE: - return XML_ERROR_NONE; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, ptr); - if (n < 0) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - if (!isCdata - && n == 0x20 /* space */ - && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (!poolAppendChar(pool, buf[i])) - return XML_ERROR_NO_MEMORY; - } - } - break; - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, ptr, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_TRAILING_CR: - next = ptr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_ATTRIBUTE_VALUE_S: - case XML_TOK_DATA_NEWLINE: - if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - if (!poolAppendChar(pool, 0x20)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - char checkEntityDecl; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (!poolAppendChar(pool, ch)) - return XML_ERROR_NO_MEMORY; - break; - } - name = poolStoreString(&temp2Pool, enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&temp2Pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal. - */ - if (pool == &dtd->pool) /* are we called from prolog? */ - checkEntityDecl = -#ifdef XML_DTD - prologState.documentEntity && -#endif /* XML_DTD */ - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs); - else /* if (pool == &tempPool): we are called from content */ - checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone; - if (checkEntityDecl) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - /* Cannot report skipped entity here - see comments on - skippedEntityHandler. - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - /* Cannot call the default handler because this would be - out of sync with the call to the startElementHandler. - if ((pool == &tempPool) && defaultHandler) - reportDefault(parser, enc, ptr, next); - */ - break; - } - if (entity->open) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - if (entity->notation) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BINARY_ENTITY_REF; - } - if (!entity->textPtr) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; - } - else { - enum XML_Error result; - const XML_Char *textEnd = entity->textPtr + entity->textLen; - entity->open = XML_TRUE; - result = appendAttributeValue(parser, internalEncoding, isCdata, - (char *)entity->textPtr, - (char *)textEnd, pool); - entity->open = XML_FALSE; - if (result) - return result; - } - } - break; - default: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_UNEXPECTED_STATE; - } - ptr = next; - } - /* not reached */ -} - -static enum XML_Error -storeEntityValue(XML_Parser parser, - const ENCODING *enc, - const char *entityTextPtr, - const char *entityTextEnd) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - STRING_POOL *pool = &(dtd->entityValuePool); - enum XML_Error result = XML_ERROR_NONE; -#ifdef XML_DTD - int oldInEntityValue = prologState.inEntityValue; - prologState.inEntityValue = 1; -#endif /* XML_DTD */ - /* never return Null for the value argument in EntityDeclHandler, - since this would indicate an external entity; therefore we - have to make sure that entityValuePool.start is not null */ - if (!pool->blocks) { - if (!poolGrow(pool)) - return XML_ERROR_NO_MEMORY; - } - - for (;;) { - const char *next; - int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: -#ifdef XML_DTD - if (isParamEntity || enc != encoding) { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&tempPool, enc, - entityTextPtr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&tempPool); - if (!entity) { - /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ - /* cannot report skipped entity here - see comments on - skippedEntityHandler - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - dtd->keepProcessing = dtd->standalone; - goto endEntityValue; - } - if (entity->open) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_RECURSIVE_ENTITY_REF; - goto endEntityValue; - } - if (entity->systemId) { - if (externalEntityRefHandler) { - dtd->paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; - goto endEntityValue; - } - entity->open = XML_FALSE; - if (!dtd->paramEntityRead) - dtd->keepProcessing = dtd->standalone; - } - else - dtd->keepProcessing = dtd->standalone; - } - else { - entity->open = XML_TRUE; - result = storeEntityValue(parser, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr - + entity->textLen)); - entity->open = XML_FALSE; - if (result) - goto endEntityValue; - } - break; - } -#endif /* XML_DTD */ - /* In the internal subset, PE references are not legal - within markup declarations, e.g entity values in this case. */ - eventPtr = entityTextPtr; - result = XML_ERROR_PARAM_ENTITY_REF; - goto endEntityValue; - case XML_TOK_NONE: - result = XML_ERROR_NONE; - goto endEntityValue; - case XML_TOK_ENTITY_REF: - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, entityTextPtr, next)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - break; - case XML_TOK_TRAILING_CR: - next = entityTextPtr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_DATA_NEWLINE: - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = 0xA; - break; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, entityTextPtr); - if (n < 0) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - for (i = 0; i < n; i++) { - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = buf[i]; - } - } - break; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - default: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_UNEXPECTED_STATE; - goto endEntityValue; - } - entityTextPtr = next; - } -endEntityValue: -#ifdef XML_DTD - prologState.inEntityValue = oldInEntityValue; -#endif /* XML_DTD */ - return result; -} - -static void FASTCALL -normalizeLines(XML_Char *s) -{ - XML_Char *p; - for (;; s++) { - if (*s == XML_T('\0')) - return; - if (*s == 0xD) - break; - } - p = s; - do { - if (*s == 0xD) { - *p++ = 0xA; - if (*++s == 0xA) - s++; - } - else - *p++ = *s++; - } while (*s); - *p = XML_T('\0'); -} - -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - const XML_Char *target; - XML_Char *data; - const char *tem; - if (!processingInstructionHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - start += enc->minBytesPerChar * 2; - tem = start + XmlNameLength(enc, start); - target = poolStoreString(&tempPool, enc, start, tem); - if (!target) - return 0; - poolFinish(&tempPool); - data = poolStoreString(&tempPool, enc, - XmlSkipS(enc, tem), - end - enc->minBytesPerChar*2); - if (!data) - return 0; - normalizeLines(data); - processingInstructionHandler(handlerArg, target, data); - poolClear(&tempPool); - return 1; -} - -static int -reportComment(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - XML_Char *data; - if (!commentHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - data = poolStoreString(&tempPool, - enc, - start + enc->minBytesPerChar * 4, - end - enc->minBytesPerChar * 3); - if (!data) - return 0; - normalizeLines(data); - commentHandler(handlerArg, data); - poolClear(&tempPool); - return 1; -} - -static void -reportDefault(XML_Parser parser, const ENCODING *enc, - const char *s, const char *end) -{ - if (MUST_CONVERT(enc, s)) { - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - do { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); - *eventPP = s; - } while (s != end); - } - else - defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); -} - - -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, - XML_Bool isId, const XML_Char *value, XML_Parser parser) -{ - DEFAULT_ATTRIBUTE *att; - if (value || isId) { - /* The handling of default attributes gets messed up if we have - a default which duplicates a non-default. */ - int i; - for (i = 0; i < type->nDefaultAtts; i++) - if (attId == type->defaultAtts[i].id) - return 1; - if (isId && !type->idAtt && !attId->xmlns) - type->idAtt = attId; - } - if (type->nDefaultAtts == type->allocDefaultAtts) { - if (type->allocDefaultAtts == 0) { - type->allocDefaultAtts = 8; - type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts - * sizeof(DEFAULT_ATTRIBUTE)); - if (!type->defaultAtts) - return 0; - } - else { - DEFAULT_ATTRIBUTE *temp; - int count = type->allocDefaultAtts * 2; - temp = (DEFAULT_ATTRIBUTE *) - REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); - if (temp == NULL) - return 0; - type->allocDefaultAtts = count; - type->defaultAtts = temp; - } - } - att = type->defaultAtts + type->nDefaultAtts; - att->id = attId; - att->value = value; - att->isCdata = isCdata; - if (!isCdata) - attId->maybeTokenized = XML_TRUE; - type->nDefaultAtts += 1; - return 1; -} - -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *name; - for (name = elementType->name; *name; name++) { - if (*name == XML_T(ASCII_COLON)) { - PREFIX *prefix; - const XML_Char *s; - for (s = elementType->name; s != name; s++) { - if (!poolAppendChar(&dtd->pool, *s)) - return 0; - } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return 0; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (!prefix) - return 0; - if (prefix->name == poolStart(&dtd->pool)) - poolFinish(&dtd->pool); - else - poolDiscard(&dtd->pool); - elementType->prefix = prefix; - - } - } - return 1; -} - -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - ATTRIBUTE_ID *id; - const XML_Char *name; - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return NULL; - name = poolStoreString(&dtd->pool, enc, start, end); - if (!name) - return NULL; - /* skip quotation mark - its storage will be re-used (like in name[-1]) */ - ++name; - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, sizeof(ATTRIBUTE_ID)); - if (!id) - return NULL; - if (id->name != name) - poolDiscard(&dtd->pool); - else { - poolFinish(&dtd->pool); - if (!ns) - ; - else if (name[0] == XML_T(ASCII_x) - && name[1] == XML_T(ASCII_m) - && name[2] == XML_T(ASCII_l) - && name[3] == XML_T(ASCII_n) - && name[4] == XML_T(ASCII_s) - && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) { - if (name[5] == XML_T('\0')) - id->prefix = &dtd->defaultPrefix; - else - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, sizeof(PREFIX)); - id->xmlns = XML_TRUE; - } - else { - int i; - for (i = 0; name[i]; i++) { - /* attributes without prefix are *not* in the default namespace */ - if (name[i] == XML_T(ASCII_COLON)) { - int j; - for (j = 0; j < i; j++) { - if (!poolAppendChar(&dtd->pool, name[j])) - return NULL; - } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return NULL; - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (id->prefix->name == poolStart(&dtd->pool)) - poolFinish(&dtd->pool); - else - poolDiscard(&dtd->pool); - break; - } - } - } - } - return id; -} - -#define CONTEXT_SEP XML_T(ASCII_FF) - -static const XML_Char * -getContext(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - HASH_TABLE_ITER iter; - XML_Bool needSep = XML_FALSE; - - if (dtd->defaultPrefix.binding) { - int i; - int len; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) - return NULL; - len = dtd->defaultPrefix.binding->uriLen; - if (namespaceSeparator) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - hashTableIterInit(&iter, &(dtd->prefixes)); - for (;;) { - int i; - int len; - const XML_Char *s; - PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); - if (!prefix) - break; - if (!prefix->binding) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = prefix->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return NULL; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) - return NULL; - len = prefix->binding->uriLen; - if (namespaceSeparator) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - - hashTableIterInit(&iter, &(dtd->generalEntities)); - for (;;) { - const XML_Char *s; - ENTITY *e = (ENTITY *)hashTableIterNext(&iter); - if (!e) - break; - if (!e->open) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = e->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return 0; - needSep = XML_TRUE; - } - - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return NULL; - return tempPool.start; -} - -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *s = context; - - while (*context != XML_T('\0')) { - if (*s == CONTEXT_SEP || *s == XML_T('\0')) { - ENTITY *e; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - e = (ENTITY *)lookup(parser, &dtd->generalEntities, poolStart(&tempPool), 0); - if (e) - e->open = XML_TRUE; - if (*s != XML_T('\0')) - s++; - context = s; - poolDiscard(&tempPool); - } - else if (*s == XML_T(ASCII_EQUALS)) { - PREFIX *prefix; - if (poolLength(&tempPool) == 0) - prefix = &dtd->defaultPrefix; - else { - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&tempPool), - sizeof(PREFIX)); - if (!prefix) - return XML_FALSE; - if (prefix->name == poolStart(&tempPool)) { - prefix->name = poolCopyString(&dtd->pool, prefix->name); - if (!prefix->name) - return XML_FALSE; - } - poolDiscard(&tempPool); - } - for (context = s + 1; - *context != CONTEXT_SEP && *context != XML_T('\0'); - context++) - if (!poolAppendChar(&tempPool, *context)) - return XML_FALSE; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - if (addBinding(parser, prefix, NULL, poolStart(&tempPool), - &inheritedBindings) != XML_ERROR_NONE) - return XML_FALSE; - poolDiscard(&tempPool); - if (*context != XML_T('\0')) - ++context; - s = context; - } - else { - if (!poolAppendChar(&tempPool, *s)) - return XML_FALSE; - s++; - } - } - return XML_TRUE; -} - -static void FASTCALL -normalizePublicId(XML_Char *publicId) -{ - XML_Char *p = publicId; - XML_Char *s; - for (s = publicId; *s; s++) { - switch (*s) { - case 0x20: - case 0xD: - case 0xA: - if (p != publicId && p[-1] != 0x20) - *p++ = 0x20; - break; - default: - *p++ = *s; - } - } - if (p != publicId && p[-1] == 0x20) - --p; - *p = XML_T('\0'); -} - -static DTD * -dtdCreate(const XML_Memory_Handling_Suite *ms) -{ - DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD)); - if (p == NULL) - return p; - poolInit(&(p->pool), ms); - poolInit(&(p->entityValuePool), ms); - hashTableInit(&(p->generalEntities), ms); - hashTableInit(&(p->elementTypes), ms); - hashTableInit(&(p->attributeIds), ms); - hashTableInit(&(p->prefixes), ms); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableInit(&(p->paramEntities), ms); -#endif /* XML_DTD */ - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - p->scaffIndex = NULL; - p->scaffold = NULL; - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; - return p; -} - -static void -dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - ms->free_fcn(e->defaultAtts); - } - hashTableClear(&(p->generalEntities)); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableClear(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableClear(&(p->elementTypes)); - hashTableClear(&(p->attributeIds)); - hashTableClear(&(p->prefixes)); - poolClear(&(p->pool)); - poolClear(&(p->entityValuePool)); - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - - ms->free_fcn(p->scaffIndex); - p->scaffIndex = NULL; - ms->free_fcn(p->scaffold); - p->scaffold = NULL; - - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; -} - -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - ms->free_fcn(e->defaultAtts); - } - hashTableDestroy(&(p->generalEntities)); -#ifdef XML_DTD - hashTableDestroy(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableDestroy(&(p->elementTypes)); - hashTableDestroy(&(p->attributeIds)); - hashTableDestroy(&(p->prefixes)); - poolDestroy(&(p->pool)); - poolDestroy(&(p->entityValuePool)); - if (isDocEntity) { - ms->free_fcn(p->scaffIndex); - ms->free_fcn(p->scaffold); - } - ms->free_fcn(p); -} - -/* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise. - The new DTD has already been initialized. -*/ -static int -dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - - /* Copy the prefix table. */ - - hashTableIterInit(&iter, &(oldDtd->prefixes)); - for (;;) { - const XML_Char *name; - const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); - if (!oldP) - break; - name = poolCopyString(&(newDtd->pool), oldP->name); - if (!name) - return 0; - if (!lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX))) - return 0; - } - - hashTableIterInit(&iter, &(oldDtd->attributeIds)); - - /* Copy the attribute id table. */ - - for (;;) { - ATTRIBUTE_ID *newA; - const XML_Char *name; - const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); - - if (!oldA) - break; - /* Remember to allocate the scratch byte before the name. */ - if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) - return 0; - name = poolCopyString(&(newDtd->pool), oldA->name); - if (!name) - return 0; - ++name; - newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name, - sizeof(ATTRIBUTE_ID)); - if (!newA) - return 0; - newA->maybeTokenized = oldA->maybeTokenized; - if (oldA->prefix) { - newA->xmlns = oldA->xmlns; - if (oldA->prefix == &oldDtd->defaultPrefix) - newA->prefix = &newDtd->defaultPrefix; - else - newA->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), - oldA->prefix->name, 0); - } - } - - /* Copy the element type table. */ - - hashTableIterInit(&iter, &(oldDtd->elementTypes)); - - for (;;) { - int i; - ELEMENT_TYPE *newE; - const XML_Char *name; - const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(&(newDtd->pool), oldE->name); - if (!name) - return 0; - newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name, - sizeof(ELEMENT_TYPE)); - if (!newE) - return 0; - if (oldE->nDefaultAtts) { - newE->defaultAtts = (DEFAULT_ATTRIBUTE *) - ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); - if (!newE->defaultAtts) { - ms->free_fcn(newE); - return 0; - } - } - if (oldE->idAtt) - newE->idAtt = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->idAtt->name, 0); - newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; - if (oldE->prefix) - newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), - oldE->prefix->name, 0); - for (i = 0; i < newE->nDefaultAtts; i++) { - newE->defaultAtts[i].id = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); - newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; - if (oldE->defaultAtts[i].value) { - newE->defaultAtts[i].value - = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); - if (!newE->defaultAtts[i].value) - return 0; - } - else - newE->defaultAtts[i].value = NULL; - } - } - - /* Copy the entity tables. */ - if (!copyEntityTable(oldParser, - &(newDtd->generalEntities), - &(newDtd->pool), - &(oldDtd->generalEntities))) - return 0; - -#ifdef XML_DTD - if (!copyEntityTable(oldParser, - &(newDtd->paramEntities), - &(newDtd->pool), - &(oldDtd->paramEntities))) - return 0; - newDtd->paramEntityRead = oldDtd->paramEntityRead; -#endif /* XML_DTD */ - - newDtd->keepProcessing = oldDtd->keepProcessing; - newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs; - newDtd->standalone = oldDtd->standalone; - - /* Don't want deep copying for scaffolding */ - newDtd->in_eldecl = oldDtd->in_eldecl; - newDtd->scaffold = oldDtd->scaffold; - newDtd->contentStringLen = oldDtd->contentStringLen; - newDtd->scaffSize = oldDtd->scaffSize; - newDtd->scaffLevel = oldDtd->scaffLevel; - newDtd->scaffIndex = oldDtd->scaffIndex; - - return 1; -} /* End dtdCopy */ - -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *newTable, - STRING_POOL *newPool, - const HASH_TABLE *oldTable) -{ - HASH_TABLE_ITER iter; - const XML_Char *cachedOldBase = NULL; - const XML_Char *cachedNewBase = NULL; - - hashTableIterInit(&iter, oldTable); - - for (;;) { - ENTITY *newE; - const XML_Char *name; - const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(newPool, oldE->name); - if (!name) - return 0; - newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY)); - if (!newE) - return 0; - if (oldE->systemId) { - const XML_Char *tem = poolCopyString(newPool, oldE->systemId); - if (!tem) - return 0; - newE->systemId = tem; - if (oldE->base) { - if (oldE->base == cachedOldBase) - newE->base = cachedNewBase; - else { - cachedOldBase = oldE->base; - tem = poolCopyString(newPool, cachedOldBase); - if (!tem) - return 0; - cachedNewBase = newE->base = tem; - } - } - if (oldE->publicId) { - tem = poolCopyString(newPool, oldE->publicId); - if (!tem) - return 0; - newE->publicId = tem; - } - } - else { - const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, - oldE->textLen); - if (!tem) - return 0; - newE->textPtr = tem; - newE->textLen = oldE->textLen; - } - if (oldE->notation) { - const XML_Char *tem = poolCopyString(newPool, oldE->notation); - if (!tem) - return 0; - newE->notation = tem; - } - newE->is_param = oldE->is_param; - newE->is_internal = oldE->is_internal; - } - return 1; -} - -#define INIT_POWER 6 - -static XML_Bool FASTCALL -keyeq(KEY s1, KEY s2) -{ - for (; *s1 == *s2; s1++, s2++) - if (*s1 == 0) - return XML_TRUE; - return XML_FALSE; -} - -static unsigned long FASTCALL -hash(XML_Parser parser, KEY s) -{ - unsigned long h = hash_secret_salt; - while (*s) - h = CHAR_HASH(h, *s++); - return h; -} - -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) -{ - size_t i; - if (table->size == 0) { - size_t tsize; - if (!createSize) - return NULL; - table->power = INIT_POWER; - /* table->size is a power of 2 */ - table->size = (size_t)1 << INIT_POWER; - tsize = table->size * sizeof(NAMED *); - table->v = (NAMED **)table->mem->malloc_fcn(tsize); - if (!table->v) { - table->size = 0; - return NULL; - } - memset(table->v, 0, tsize); - i = hash(parser, name) & ((unsigned long)table->size - 1); - } - else { - unsigned long h = hash(parser, name); - unsigned long mask = (unsigned long)table->size - 1; - unsigned char step = 0; - i = h & mask; - while (table->v[i]) { - if (keyeq(name, table->v[i]->name)) - return table->v[i]; - if (!step) - step = PROBE_STEP(h, mask, table->power); - i < step ? (i += table->size - step) : (i -= step); - } - if (!createSize) - return NULL; - - /* check for overflow (table is half full) */ - if (table->used >> (table->power - 1)) { - unsigned char newPower = table->power + 1; - size_t newSize = (size_t)1 << newPower; - unsigned long newMask = (unsigned long)newSize - 1; - size_t tsize = newSize * sizeof(NAMED *); - NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize); - if (!newV) - return NULL; - memset(newV, 0, tsize); - for (i = 0; i < table->size; i++) - if (table->v[i]) { - unsigned long newHash = hash(parser, table->v[i]->name); - size_t j = newHash & newMask; - step = 0; - while (newV[j]) { - if (!step) - step = PROBE_STEP(newHash, newMask, newPower); - j < step ? (j += newSize - step) : (j -= step); - } - newV[j] = table->v[i]; - } - table->mem->free_fcn(table->v); - table->v = newV; - table->power = newPower; - table->size = newSize; - i = h & newMask; - step = 0; - while (table->v[i]) { - if (!step) - step = PROBE_STEP(h, newMask, newPower); - i < step ? (i += newSize - step) : (i -= step); - } - } - } - table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize); - if (!table->v[i]) - return NULL; - memset(table->v[i], 0, createSize); - table->v[i]->name = name; - (table->used)++; - return table->v[i]; -} - -static void FASTCALL -hashTableClear(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - table->mem->free_fcn(table->v[i]); - table->v[i] = NULL; - } - table->used = 0; -} - -static void FASTCALL -hashTableDestroy(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) - table->mem->free_fcn(table->v[i]); - table->mem->free_fcn(table->v); -} - -static void FASTCALL -hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) -{ - p->power = 0; - p->size = 0; - p->used = 0; - p->v = NULL; - p->mem = ms; -} - -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ - iter->p = table->v; - iter->end = iter->p + table->size; -} - -static NAMED * FASTCALL -hashTableIterNext(HASH_TABLE_ITER *iter) -{ - while (iter->p != iter->end) { - NAMED *tem = *(iter->p)++; - if (tem) - return tem; - } - return NULL; -} - -static void FASTCALL -poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) -{ - pool->blocks = NULL; - pool->freeBlocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; - pool->mem = ms; -} - -static void FASTCALL -poolClear(STRING_POOL *pool) -{ - if (!pool->freeBlocks) - pool->freeBlocks = pool->blocks; - else { - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - p->next = pool->freeBlocks; - pool->freeBlocks = p; - p = tem; - } - } - pool->blocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; -} - -static void FASTCALL -poolDestroy(STRING_POOL *pool) -{ - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } - p = pool->freeBlocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } -} - -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (;;) { - XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if (ptr == end) - break; - if (!poolGrow(pool)) - return NULL; - } - return pool->start; -} - -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s) -{ - do { - if (!poolAppendChar(pool, *s)) - return NULL; - } while (*s++); - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (; n > 0; --n, s++) { - if (!poolAppendChar(pool, *s)) - return NULL; - } - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s) -{ - while (*s) { - if (!poolAppendChar(pool, *s)) - return NULL; - s++; - } - return pool->start; -} - -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!poolAppend(pool, enc, ptr, end)) - return NULL; - if (pool->ptr == pool->end && !poolGrow(pool)) - return NULL; - *(pool->ptr)++ = 0; - return pool->start; -} - -static XML_Bool FASTCALL -poolGrow(STRING_POOL *pool) -{ - if (pool->freeBlocks) { - if (pool->start == 0) { - pool->blocks = pool->freeBlocks; - pool->freeBlocks = pool->freeBlocks->next; - pool->blocks->next = NULL; - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - pool->ptr = pool->start; - return XML_TRUE; - } - if (pool->end - pool->start < pool->freeBlocks->size) { - BLOCK *tem = pool->freeBlocks->next; - pool->freeBlocks->next = pool->blocks; - pool->blocks = pool->freeBlocks; - pool->freeBlocks = tem; - memcpy(pool->blocks->s, pool->start, - (pool->end - pool->start) * sizeof(XML_Char)); - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - return XML_TRUE; - } - } - if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (int)(pool->end - pool->start)*2; - BLOCK *temp = (BLOCK *) - pool->mem->realloc_fcn(pool->blocks, - (offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char))); - if (temp == NULL) - return XML_FALSE; - pool->blocks = temp; - pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + blockSize; - } - else { - BLOCK *tem; - int blockSize = (int)(pool->end - pool->start); - if (blockSize < INIT_BLOCK_SIZE) - blockSize = INIT_BLOCK_SIZE; - else - blockSize *= 2; - tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); - if (!tem) - return XML_FALSE; - tem->size = blockSize; - tem->next = pool->blocks; - pool->blocks = tem; - if (pool->ptr != pool->start) - memcpy(tem->s, pool->start, - (pool->ptr - pool->start) * sizeof(XML_Char)); - pool->ptr = tem->s + (pool->ptr - pool->start); - pool->start = tem->s; - pool->end = tem->s + blockSize; - } - return XML_TRUE; -} - -static int FASTCALL -nextScaffoldPart(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - CONTENT_SCAFFOLD * me; - int next; - - if (!dtd->scaffIndex) { - dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); - if (!dtd->scaffIndex) - return -1; - dtd->scaffIndex[0] = 0; - } - - if (dtd->scaffCount >= dtd->scaffSize) { - CONTENT_SCAFFOLD *temp; - if (dtd->scaffold) { - temp = (CONTENT_SCAFFOLD *) - REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd->scaffSize *= 2; - } - else { - temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS - * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS; - } - dtd->scaffold = temp; - } - next = dtd->scaffCount++; - me = &dtd->scaffold[next]; - if (dtd->scaffLevel) { - CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]]; - if (parent->lastchild) { - dtd->scaffold[parent->lastchild].nextsib = next; - } - if (!parent->childcnt) - parent->firstchild = next; - parent->lastchild = next; - parent->childcnt++; - } - me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; - return next; -} - -static void -build_node(XML_Parser parser, - int src_node, - XML_Content *dest, - XML_Content **contpos, - XML_Char **strpos) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - dest->type = dtd->scaffold[src_node].type; - dest->quant = dtd->scaffold[src_node].quant; - if (dest->type == XML_CTYPE_NAME) { - const XML_Char *src; - dest->name = *strpos; - src = dtd->scaffold[src_node].name; - for (;;) { - *(*strpos)++ = *src; - if (!*src) - break; - src++; - } - dest->numchildren = 0; - dest->children = NULL; - } - else { - unsigned int i; - int cn; - dest->numchildren = dtd->scaffold[src_node].childcnt; - dest->children = *contpos; - *contpos += dest->numchildren; - for (i = 0, cn = dtd->scaffold[src_node].firstchild; - i < dest->numchildren; - i++, cn = dtd->scaffold[cn].nextsib) { - build_node(parser, cn, &(dest->children[i]), contpos, strpos); - } - dest->name = NULL; - } -} - -static XML_Content * -build_model (XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - XML_Content *ret; - XML_Content *cpos; - XML_Char * str; - int allocsize = (dtd->scaffCount * sizeof(XML_Content) - + (dtd->contentStringLen * sizeof(XML_Char))); - - ret = (XML_Content *)MALLOC(allocsize); - if (!ret) - return NULL; - - str = (XML_Char *) (&ret[dtd->scaffCount]); - cpos = &ret[1]; - - build_node(parser, 0, ret, &cpos, &str); - return ret; -} - -static ELEMENT_TYPE * -getElementType(XML_Parser parser, - const ENCODING *enc, - const char *ptr, - const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end); - ELEMENT_TYPE *ret; - - if (!name) - return NULL; - ret = (ELEMENT_TYPE *) lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); - if (!ret) - return NULL; - if (ret->name != name) - poolDiscard(&dtd->pool); - else { - poolFinish(&dtd->pool); - if (!setElementTypePrefix(parser, ret)) - return NULL; - } - return ret; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.c deleted file mode 100644 index c452cb8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.c +++ /dev/null @@ -1,1336 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#else -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat_external.h" -#include "internal.h" -#include "xmlrole.h" -#include "ascii.h" - -/* Doesn't check: - - that ,| are not mixed in a model group - content of literals - -*/ - -static const char KW_ANY[] = { - ASCII_A, ASCII_N, ASCII_Y, '\0' }; -static const char KW_ATTLIST[] = { - ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; -static const char KW_CDATA[] = { - ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_DOCTYPE[] = { - ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; -static const char KW_ELEMENT[] = { - ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; -static const char KW_EMPTY[] = { - ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; -static const char KW_ENTITIES[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, - '\0' }; -static const char KW_ENTITY[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; -static const char KW_FIXED[] = { - ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; -static const char KW_ID[] = { - ASCII_I, ASCII_D, '\0' }; -static const char KW_IDREF[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; -static const char KW_IDREFS[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; -#ifdef XML_DTD -static const char KW_IGNORE[] = { - ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; -#endif -static const char KW_IMPLIED[] = { - ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; -#ifdef XML_DTD -static const char KW_INCLUDE[] = { - ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; -#endif -static const char KW_NDATA[] = { - ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_NMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; -static const char KW_NMTOKENS[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, - '\0' }; -static const char KW_NOTATION[] = - { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, - '\0' }; -static const char KW_PCDATA[] = { - ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_PUBLIC[] = { - ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; -static const char KW_REQUIRED[] = { - ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, - '\0' }; -static const char KW_SYSTEM[] = { - ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; - -#ifndef MIN_BYTES_PER_CHAR -#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) -#endif - -#ifdef XML_DTD -#define setTopLevel(state) \ - ((state)->handler = ((state)->documentEntity \ - ? internalSubset \ - : externalSubset1)) -#else /* not XML_DTD */ -#define setTopLevel(state) ((state)->handler = internalSubset) -#endif /* not XML_DTD */ - -typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - -static PROLOG_HANDLER - prolog0, prolog1, prolog2, - doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, - internalSubset, - entity0, entity1, entity2, entity3, entity4, entity5, entity6, - entity7, entity8, entity9, entity10, - notation0, notation1, notation2, notation3, notation4, - attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, - attlist7, attlist8, attlist9, - element0, element1, element2, element3, element4, element5, element6, - element7, -#ifdef XML_DTD - externalSubset0, externalSubset1, - condSect0, condSect1, condSect2, -#endif /* XML_DTD */ - declClose, - error; - -static int FASTCALL common(PROLOG_STATE *state, int tok); - -static int PTRCALL -prolog0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - state->handler = prolog1; - return XML_ROLE_NONE; - case XML_TOK_XML_DECL: - state->handler = prolog1; - return XML_ROLE_XML_DECL; - case XML_TOK_PI: - state->handler = prolog1; - return XML_ROLE_PI; - case XML_TOK_COMMENT: - state->handler = prolog1; - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -prolog1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -prolog2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -doctype0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = doctype1; - return XML_ROLE_DOCTYPE_NAME; - } - return common(state, tok); -} - -static int PTRCALL -doctype1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = doctype3; - return XML_ROLE_DOCTYPE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = doctype2; - return XML_ROLE_DOCTYPE_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -doctype2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype3; - return XML_ROLE_DOCTYPE_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -doctype3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype4; - return XML_ROLE_DOCTYPE_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -doctype4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int PTRCALL -doctype5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int PTRCALL -internalSubset(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ENTITY)) { - state->handler = entity0; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ATTLIST)) { - state->handler = attlist0; - return XML_ROLE_ATTLIST_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ELEMENT)) { - state->handler = element0; - return XML_ROLE_ELEMENT_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_NOTATION)) { - state->handler = notation0; - return XML_ROLE_NOTATION_NONE; - } - break; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_PARAM_ENTITY_REF: - return XML_ROLE_PARAM_ENTITY_REF; - case XML_TOK_CLOSE_BRACKET: - state->handler = doctype5; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NONE: - return XML_ROLE_NONE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int PTRCALL -externalSubset0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - state->handler = externalSubset1; - if (tok == XML_TOK_XML_DECL) - return XML_ROLE_TEXT_DECL; - return externalSubset1(state, tok, ptr, end, enc); -} - -static int PTRCALL -externalSubset1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_COND_SECT_OPEN: - state->handler = condSect0; - return XML_ROLE_NONE; - case XML_TOK_COND_SECT_CLOSE: - if (state->includeLevel == 0) - break; - state->includeLevel -= 1; - return XML_ROLE_NONE; - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_BRACKET: - break; - case XML_TOK_NONE: - if (state->includeLevel) - break; - return XML_ROLE_NONE; - default: - return internalSubset(state, tok, ptr, end, enc); - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int PTRCALL -entity0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_PERCENT: - state->handler = entity1; - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity2; - return XML_ROLE_GENERAL_ENTITY_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity7; - return XML_ROLE_PARAM_ENTITY_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity4; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity3; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -entity3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity4; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity5; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { - state->handler = entity6; - return XML_ROLE_ENTITY_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -entity6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_NOTATION_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity9; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity8; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -entity8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity9; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity10; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity10(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - } - return common(state, tok); -} - -static int PTRCALL -notation0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - state->handler = notation1; - return XML_ROLE_NOTATION_NAME; - } - return common(state, tok); -} - -static int PTRCALL -notation1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = notation3; - return XML_ROLE_NOTATION_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = notation2; - return XML_ROLE_NOTATION_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -notation2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = notation4; - return XML_ROLE_NOTATION_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -notation3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -notation4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NOTATION_NO_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -attlist0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist1; - return XML_ROLE_ATTLIST_ELEMENT_NAME; - } - return common(state, tok); -} - -static int PTRCALL -attlist1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist2; - return XML_ROLE_ATTRIBUTE_NAME; - } - return common(state, tok); -} - -static int PTRCALL -attlist2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - { - static const char * const types[] = { - KW_CDATA, - KW_ID, - KW_IDREF, - KW_IDREFS, - KW_ENTITY, - KW_ENTITIES, - KW_NMTOKEN, - KW_NMTOKENS, - }; - int i; - for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) - if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { - state->handler = attlist8; - return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; - } - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { - state->handler = attlist5; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NMTOKEN: - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist4; - return XML_ROLE_ATTRIBUTE_ENUM_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OPEN_PAREN: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - state->handler = attlist7; - return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -/* default value */ -static int PTRCALL -attlist8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_IMPLIED)) { - state->handler = attlist1; - return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_REQUIRED)) { - state->handler = attlist1; - return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_FIXED)) { - state->handler = attlist9; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_FIXED_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -element0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element1; - return XML_ROLE_ELEMENT_NAME; - } - return common(state, tok); -} - -static int PTRCALL -element1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_EMPTY; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_ANY; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = element2; - state->level = 1; - return XML_ROLE_GROUP_OPEN; - } - return common(state, tok); -} - -static int PTRCALL -element2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_PCDATA)) { - state->handler = element3; - return XML_ROLE_CONTENT_PCDATA; - } - break; - case XML_TOK_OPEN_PAREN: - state->level = 2; - state->handler = element6; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int PTRCALL -element3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int PTRCALL -element4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element5; - return XML_ROLE_CONTENT_ELEMENT; - } - return common(state, tok); -} - -static int PTRCALL -element5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int PTRCALL -element6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_OPEN_PAREN: - state->level += 1; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int PTRCALL -element7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_CLOSE_PAREN_QUESTION: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_OPT; - case XML_TOK_CLOSE_PAREN_PLUS: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_PLUS; - case XML_TOK_COMMA: - state->handler = element6; - return XML_ROLE_GROUP_SEQUENCE; - case XML_TOK_OR: - state->handler = element6; - return XML_ROLE_GROUP_CHOICE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int PTRCALL -condSect0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { - state->handler = condSect1; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { - state->handler = condSect2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -condSect1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - state->includeLevel += 1; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static int PTRCALL -condSect2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - return XML_ROLE_IGNORE_SECT; - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int PTRCALL -declClose(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return state->role_none; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return state->role_none; - } - return common(state, tok); -} - -static int PTRCALL -error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - return XML_ROLE_NONE; -} - -static int FASTCALL -common(PROLOG_STATE *state, int tok) -{ -#ifdef XML_DTD - if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) - return XML_ROLE_INNER_PARAM_ENTITY_REF; -#endif - state->handler = error; - return XML_ROLE_ERROR; -} - -void -XmlPrologStateInit(PROLOG_STATE *state) -{ - state->handler = prolog0; -#ifdef XML_DTD - state->documentEntity = 1; - state->includeLevel = 0; - state->inEntityValue = 0; -#endif /* XML_DTD */ -} - -#ifdef XML_DTD - -void -XmlPrologStateInitExternalEntity(PROLOG_STATE *state) -{ - state->handler = externalSubset0; - state->documentEntity = 0; - state->includeLevel = 0; -} - -#endif /* XML_DTD */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.h deleted file mode 100644 index 25be6b0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmlrole.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlRole_INCLUDED -#define XmlRole_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt -#endif - -#include "xmltok.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - XML_ROLE_ERROR = -1, - XML_ROLE_NONE = 0, - XML_ROLE_XML_DECL, - XML_ROLE_INSTANCE_START, - XML_ROLE_DOCTYPE_NONE, - XML_ROLE_DOCTYPE_NAME, - XML_ROLE_DOCTYPE_SYSTEM_ID, - XML_ROLE_DOCTYPE_PUBLIC_ID, - XML_ROLE_DOCTYPE_INTERNAL_SUBSET, - XML_ROLE_DOCTYPE_CLOSE, - XML_ROLE_GENERAL_ENTITY_NAME, - XML_ROLE_PARAM_ENTITY_NAME, - XML_ROLE_ENTITY_NONE, - XML_ROLE_ENTITY_VALUE, - XML_ROLE_ENTITY_SYSTEM_ID, - XML_ROLE_ENTITY_PUBLIC_ID, - XML_ROLE_ENTITY_COMPLETE, - XML_ROLE_ENTITY_NOTATION_NAME, - XML_ROLE_NOTATION_NONE, - XML_ROLE_NOTATION_NAME, - XML_ROLE_NOTATION_SYSTEM_ID, - XML_ROLE_NOTATION_NO_SYSTEM_ID, - XML_ROLE_NOTATION_PUBLIC_ID, - XML_ROLE_ATTRIBUTE_NAME, - XML_ROLE_ATTRIBUTE_TYPE_CDATA, - XML_ROLE_ATTRIBUTE_TYPE_ID, - XML_ROLE_ATTRIBUTE_TYPE_IDREF, - XML_ROLE_ATTRIBUTE_TYPE_IDREFS, - XML_ROLE_ATTRIBUTE_TYPE_ENTITY, - XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, - XML_ROLE_ATTRIBUTE_ENUM_VALUE, - XML_ROLE_ATTRIBUTE_NOTATION_VALUE, - XML_ROLE_ATTLIST_NONE, - XML_ROLE_ATTLIST_ELEMENT_NAME, - XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, - XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, - XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, - XML_ROLE_FIXED_ATTRIBUTE_VALUE, - XML_ROLE_ELEMENT_NONE, - XML_ROLE_ELEMENT_NAME, - XML_ROLE_CONTENT_ANY, - XML_ROLE_CONTENT_EMPTY, - XML_ROLE_CONTENT_PCDATA, - XML_ROLE_GROUP_OPEN, - XML_ROLE_GROUP_CLOSE, - XML_ROLE_GROUP_CLOSE_REP, - XML_ROLE_GROUP_CLOSE_OPT, - XML_ROLE_GROUP_CLOSE_PLUS, - XML_ROLE_GROUP_CHOICE, - XML_ROLE_GROUP_SEQUENCE, - XML_ROLE_CONTENT_ELEMENT, - XML_ROLE_CONTENT_ELEMENT_REP, - XML_ROLE_CONTENT_ELEMENT_OPT, - XML_ROLE_CONTENT_ELEMENT_PLUS, - XML_ROLE_PI, - XML_ROLE_COMMENT, -#ifdef XML_DTD - XML_ROLE_TEXT_DECL, - XML_ROLE_IGNORE_SECT, - XML_ROLE_INNER_PARAM_ENTITY_REF, -#endif /* XML_DTD */ - XML_ROLE_PARAM_ENTITY_REF -}; - -typedef struct prolog_state { - int (PTRCALL *handler) (struct prolog_state *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - unsigned level; - int role_none; -#ifdef XML_DTD - unsigned includeLevel; - int documentEntity; - int inEntityValue; -#endif /* XML_DTD */ -} PROLOG_STATE; - -void XmlPrologStateInit(PROLOG_STATE *); -#ifdef XML_DTD -void XmlPrologStateInitExternalEntity(PROLOG_STATE *); -#endif /* XML_DTD */ - -#define XmlTokenRole(state, tok, ptr, end, enc) \ - (((state)->handler)(state, tok, ptr, end, enc)) - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlRole_INCLUDED */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.c deleted file mode 100644 index e0e3545..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.c +++ /dev/null @@ -1,1651 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#else -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat_external.h" -#include "internal.h" -#include "xmltok.h" -#include "nametab.h" - -#ifdef XML_DTD -#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) -#else -#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ -#endif - -#define VTABLE1 \ - { PREFIX(prologTok), PREFIX(contentTok), \ - PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ - { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ - PREFIX(sameName), \ - PREFIX(nameMatchesAscii), \ - PREFIX(nameLength), \ - PREFIX(skipS), \ - PREFIX(getAtts), \ - PREFIX(charRefNumber), \ - PREFIX(predefinedEntityName), \ - PREFIX(updatePosition), \ - PREFIX(isPublicId) - -#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) - -#define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) - -/* A 2 byte UTF-8 representation splits the characters 11 bits between - the bottom 5 and 6 bits of the bytes. We need 8 bits to index into - pages, 3 bits to add to that index and 5 bits to generate the mask. -*/ -#define UTF8_GET_NAMING2(pages, byte) \ - (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ - + ((((byte)[0]) & 3) << 1) \ - + ((((byte)[1]) >> 5) & 1)] \ - & (1 << (((byte)[1]) & 0x1F))) - -/* A 3 byte UTF-8 representation splits the characters 16 bits between - the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index - into pages, 3 bits to add to that index and 5 bits to generate the - mask. -*/ -#define UTF8_GET_NAMING3(pages, byte) \ - (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ - + ((((byte)[1]) >> 2) & 0xF)] \ - << 3) \ - + ((((byte)[1]) & 3) << 1) \ - + ((((byte)[2]) >> 5) & 1)] \ - & (1 << (((byte)[2]) & 0x1F))) - -#define UTF8_GET_NAMING(pages, p, n) \ - ((n) == 2 \ - ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ - : ((n) == 3 \ - ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ - : 0)) - -/* Detection of invalid UTF-8 sequences is based on Table 3.1B - of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ - with the additional restriction of not allowing the Unicode - code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE). - Implementation details: - (A & 0x80) == 0 means A < 0x80 - and - (A & 0xC0) == 0xC0 means A > 0xBF -*/ - -#define UTF8_INVALID2(p) \ - ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) - -#define UTF8_INVALID3(p) \ - (((p)[2] & 0x80) == 0 \ - || \ - ((*p) == 0xEF && (p)[1] == 0xBF \ - ? \ - (p)[2] > 0xBD \ - : \ - ((p)[2] & 0xC0) == 0xC0) \ - || \ - ((*p) == 0xE0 \ - ? \ - (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) - -#define UTF8_INVALID4(p) \ - (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ - || \ - ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ - || \ - ((*p) == 0xF0 \ - ? \ - (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) - -static int PTRFASTCALL -isNever(const ENCODING *enc, const char *p) -{ - return 0; -} - -static int PTRFASTCALL -utf8_isName2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isName3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); -} - -#define utf8_isName4 isNever - -static int PTRFASTCALL -utf8_isNmstrt2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isNmstrt3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); -} - -#define utf8_isNmstrt4 isNever - -static int PTRFASTCALL -utf8_isInvalid2(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID2((const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isInvalid3(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID3((const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isInvalid4(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID4((const unsigned char *)p); -} - -struct normal_encoding { - ENCODING enc; - unsigned char type[256]; -#ifdef XML_MIN_SIZE - int (PTRFASTCALL *byteType)(const ENCODING *, const char *); - int (PTRFASTCALL *isNameMin)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *); - int (PTRFASTCALL *byteToAscii)(const ENCODING *, const char *); - int (PTRCALL *charMatches)(const ENCODING *, const char *, int); -#endif /* XML_MIN_SIZE */ - int (PTRFASTCALL *isName2)(const ENCODING *, const char *); - int (PTRFASTCALL *isName3)(const ENCODING *, const char *); - int (PTRFASTCALL *isName4)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid2)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid3)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid4)(const ENCODING *, const char *); -}; - -#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) - -#ifdef XML_MIN_SIZE - -#define STANDARD_VTABLE(E) \ - E ## byteType, \ - E ## isNameMin, \ - E ## isNmstrtMin, \ - E ## byteToAscii, \ - E ## charMatches, - -#else - -#define STANDARD_VTABLE(E) /* as nothing */ - -#endif - -#define NORMAL_VTABLE(E) \ - E ## isName2, \ - E ## isName3, \ - E ## isName4, \ - E ## isNmstrt2, \ - E ## isNmstrt3, \ - E ## isNmstrt4, \ - E ## isInvalid2, \ - E ## isInvalid3, \ - E ## isInvalid4 - -static int FASTCALL checkCharRefNumber(int); - -#include "xmltok_impl.h" -#include "ascii.h" - -#ifdef XML_MIN_SIZE -#define sb_isNameMin isNever -#define sb_isNmstrtMin isNever -#endif - -#ifdef XML_MIN_SIZE -#define MINBPC(enc) ((enc)->minBytesPerChar) -#else -/* minimum bytes per character */ -#define MINBPC(enc) 1 -#endif - -#define SB_BYTE_TYPE(enc, p) \ - (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) - -#ifdef XML_MIN_SIZE -static int PTRFASTCALL -sb_byteType(const ENCODING *enc, const char *p) -{ - return SB_BYTE_TYPE(enc, p); -} -#define BYTE_TYPE(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) -#else -#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) -#endif - -#ifdef XML_MIN_SIZE -#define BYTE_TO_ASCII(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) -static int PTRFASTCALL -sb_byteToAscii(const ENCODING *enc, const char *p) -{ - return *p; -} -#else -#define BYTE_TO_ASCII(enc, p) (*(p)) -#endif - -#define IS_NAME_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) -#define IS_NMSTRT_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) -#define IS_INVALID_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) - -#ifdef XML_MIN_SIZE -#define IS_NAME_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) -#else -#define IS_NAME_CHAR_MINBPC(enc, p) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) -#endif - -#ifdef XML_MIN_SIZE -#define CHAR_MATCHES(enc, p, c) \ - (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) -static int PTRCALL -sb_charMatches(const ENCODING *enc, const char *p, int c) -{ - return *p == c; -} -#else -/* c is an ASCII character */ -#define CHAR_MATCHES(enc, p, c) (*(p) == c) -#endif - -#define PREFIX(ident) normal_ ## ident -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ - UTF8_cval1 = 0x00, - UTF8_cval2 = 0xc0, - UTF8_cval3 = 0xe0, - UTF8_cval4 = 0xf0 -}; - -static void PTRCALL -utf8_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - char *to; - const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) - if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) - break; - } - for (to = *toP, from = *fromP; from != fromLim; from++, to++) - *to = *from; - *fromP = from; - *toP = to; -} - -static void PTRCALL -utf8_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - unsigned short *to = *toP; - const char *from = *fromP; - while (from != fromLim && to != toLim) { - switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { - case BT_LEAD2: - *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); - from += 2; - break; - case BT_LEAD3: - *to++ = (unsigned short)(((from[0] & 0xf) << 12) - | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); - from += 3; - break; - case BT_LEAD4: - { - unsigned long n; - if (to + 1 == toLim) - goto after; - n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) - | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); - n -= 0x10000; - to[0] = (unsigned short)((n >> 10) | 0xD800); - to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); - to += 2; - from += 4; - } - break; - default: - *to++ = *from++; - break; - } - } -after: - *fromP = from; - *toP = to; -} - -#ifdef XML_NS -static const struct normal_encoding utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; -#endif - -static const struct normal_encoding utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#ifdef XML_NS - -static const struct normal_encoding internal_utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "iasciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#endif - -static const struct normal_encoding internal_utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -static void PTRCALL -latin1_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - for (;;) { - unsigned char c; - if (*fromP == fromLim) - break; - c = (unsigned char)**fromP; - if (c & 0x80) { - if (toLim - *toP < 2) - break; - *(*toP)++ = (char)((c >> 6) | UTF8_cval2); - *(*toP)++ = (char)((c & 0x3f) | 0x80); - (*fromP)++; - } - else { - if (*toP == toLim) - break; - *(*toP)++ = *(*fromP)++; - } - } -} - -static void PTRCALL -latin1_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = (unsigned char)*(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding latin1_encoding_ns = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding latin1_encoding = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -static void PTRCALL -ascii_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = *(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding ascii_encoding_ns = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding ascii_encoding = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -static int PTRFASTCALL -unicode_byte_type(char hi, char lo) -{ - switch ((unsigned char)hi) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - return BT_LEAD4; - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return BT_TRAIL; - case 0xFF: - switch ((unsigned char)lo) { - case 0xFF: - case 0xFE: - return BT_NONXML; - } - break; - } - return BT_NONASCII; -} - -#define DEFINE_UTF16_TO_UTF8(E) \ -static void PTRCALL \ -E ## toUtf8(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - char **toP, const char *toLim) \ -{ \ - const char *from; \ - for (from = *fromP; from != fromLim; from += 2) { \ - int plane; \ - unsigned char lo2; \ - unsigned char lo = GET_LO(from); \ - unsigned char hi = GET_HI(from); \ - switch (hi) { \ - case 0: \ - if (lo < 0x80) { \ - if (*toP == toLim) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = lo; \ - break; \ - } \ - /* fall through */ \ - case 0x1: case 0x2: case 0x3: \ - case 0x4: case 0x5: case 0x6: case 0x7: \ - if (toLim - *toP < 2) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - default: \ - if (toLim - *toP < 3) { \ - *fromP = from; \ - return; \ - } \ - /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ - *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ - *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ - if (toLim - *toP < 4) { \ - *fromP = from; \ - return; \ - } \ - plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ - *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ - *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ - from += 2; \ - lo2 = GET_LO(from); \ - *(*toP)++ = (((lo & 0x3) << 4) \ - | ((GET_HI(from) & 0x3) << 2) \ - | (lo2 >> 6) \ - | 0x80); \ - *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ - break; \ - } \ - } \ - *fromP = from; \ -} - -#define DEFINE_UTF16_TO_UTF16(E) \ -static void PTRCALL \ -E ## toUtf16(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - unsigned short **toP, const unsigned short *toLim) \ -{ \ - /* Avoid copying first half only of surrogate */ \ - if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ - fromLim -= 2; \ - for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ - *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ -} - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) -#define GET_LO(ptr) ((unsigned char)(ptr)[0]) -#define GET_HI(ptr) ((unsigned char)(ptr)[1]) - -DEFINE_UTF16_TO_UTF8(little2_) -DEFINE_UTF16_TO_UTF16(little2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) -#define GET_LO(ptr) ((unsigned char)(ptr)[1]) -#define GET_HI(ptr) ((unsigned char)(ptr)[0]) - -DEFINE_UTF16_TO_UTF8(big2_) -DEFINE_UTF16_TO_UTF16(big2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define LITTLE2_BYTE_TYPE(enc, p) \ - ((p)[1] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ - : unicode_byte_type((p)[1], (p)[0])) -#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) -#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) -#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) -#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) - -#ifdef XML_MIN_SIZE - -static int PTRFASTCALL -little2_byteType(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TYPE(enc, p); -} - -static int PTRFASTCALL -little2_byteToAscii(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TO_ASCII(enc, p); -} - -static int PTRCALL -little2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return LITTLE2_CHAR_MATCHES(enc, p, c); -} - -static int PTRFASTCALL -little2_isNameMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int PTRFASTCALL -little2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) little2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding little2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding little2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#if BYTEORDER != 4321 - -#ifdef XML_NS - -static const struct normal_encoding internal_little2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding internal_little2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - - -#define BIG2_BYTE_TYPE(enc, p) \ - ((p)[0] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ - : unicode_byte_type((p)[0], (p)[1])) -#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) -#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) -#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) -#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) - -#ifdef XML_MIN_SIZE - -static int PTRFASTCALL -big2_byteType(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TYPE(enc, p); -} - -static int PTRFASTCALL -big2_byteToAscii(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TO_ASCII(enc, p); -} - -static int PTRCALL -big2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return BIG2_CHAR_MATCHES(enc, p, c); -} - -static int PTRFASTCALL -big2_isNameMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int PTRFASTCALL -big2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) big2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding big2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding big2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#if BYTEORDER != 1234 - -#ifdef XML_NS - -static const struct normal_encoding internal_big2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding internal_big2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -#undef PREFIX - -static int FASTCALL -streqci(const char *s1, const char *s2) -{ - for (;;) { - char c1 = *s1++; - char c2 = *s2++; - if (ASCII_a <= c1 && c1 <= ASCII_z) - c1 += ASCII_A - ASCII_a; - if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; - if (c1 != c2) - return 0; - if (!c1) - break; - } - return 1; -} - -static void PTRCALL -initUpdatePosition(const ENCODING *enc, const char *ptr, - const char *end, POSITION *pos) -{ - normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); -} - -static int -toAscii(const ENCODING *enc, const char *ptr, const char *end) -{ - char buf[1]; - char *p = buf; - XmlUtf8Convert(enc, &ptr, end, &p, p + 1); - if (p == buf) - return -1; - else - return buf[0]; -} - -static int FASTCALL -isSpace(int c) -{ - switch (c) { - case 0x20: - case 0xD: - case 0xA: - case 0x9: - return 1; - } - return 0; -} - -/* Return 1 if there's just optional white space or there's an S - followed by name=val. -*/ -static int -parsePseudoAttribute(const ENCODING *enc, - const char *ptr, - const char *end, - const char **namePtr, - const char **nameEndPtr, - const char **valPtr, - const char **nextTokPtr) -{ - int c; - char open; - if (ptr == end) { - *namePtr = NULL; - return 1; - } - if (!isSpace(toAscii(enc, ptr, end))) { - *nextTokPtr = ptr; - return 0; - } - do { - ptr += enc->minBytesPerChar; - } while (isSpace(toAscii(enc, ptr, end))); - if (ptr == end) { - *namePtr = NULL; - return 1; - } - *namePtr = ptr; - for (;;) { - c = toAscii(enc, ptr, end); - if (c == -1) { - *nextTokPtr = ptr; - return 0; - } - if (c == ASCII_EQUALS) { - *nameEndPtr = ptr; - break; - } - if (isSpace(c)) { - *nameEndPtr = ptr; - do { - ptr += enc->minBytesPerChar; - } while (isSpace(c = toAscii(enc, ptr, end))); - if (c != ASCII_EQUALS) { - *nextTokPtr = ptr; - return 0; - } - break; - } - ptr += enc->minBytesPerChar; - } - if (ptr == *namePtr) { - *nextTokPtr = ptr; - return 0; - } - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - while (isSpace(c)) { - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - } - if (c != ASCII_QUOT && c != ASCII_APOS) { - *nextTokPtr = ptr; - return 0; - } - open = (char)c; - ptr += enc->minBytesPerChar; - *valPtr = ptr; - for (;; ptr += enc->minBytesPerChar) { - c = toAscii(enc, ptr, end); - if (c == open) - break; - if (!(ASCII_a <= c && c <= ASCII_z) - && !(ASCII_A <= c && c <= ASCII_Z) - && !(ASCII_0 <= c && c <= ASCII_9) - && c != ASCII_PERIOD - && c != ASCII_MINUS - && c != ASCII_UNDERSCORE) { - *nextTokPtr = ptr; - return 0; - } - } - *nextTokPtr = ptr + enc->minBytesPerChar; - return 1; -} - -static const char KW_version[] = { - ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' -}; - -static const char KW_encoding[] = { - ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' -}; - -static const char KW_standalone[] = { - ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, - ASCII_n, ASCII_e, '\0' -}; - -static const char KW_yes[] = { - ASCII_y, ASCII_e, ASCII_s, '\0' -}; - -static const char KW_no[] = { - ASCII_n, ASCII_o, '\0' -}; - -static int -doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, - const char *, - const char *), - int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - const char *val = NULL; - const char *name = NULL; - const char *nameEnd = NULL; - ptr += 5 * enc->minBytesPerChar; - end -= 2 * enc->minBytesPerChar; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) - || !name) { - *badPtr = ptr; - return 0; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { - if (!isGeneralTextEntity) { - *badPtr = name; - return 0; - } - } - else { - if (versionPtr) - *versionPtr = val; - if (versionEndPtr) - *versionEndPtr = ptr; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) { - if (isGeneralTextEntity) { - /* a TextDecl must have an EncodingDecl */ - *badPtr = ptr; - return 0; - } - return 1; - } - } - if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { - int c = toAscii(enc, val, end); - if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { - *badPtr = val; - return 0; - } - if (encodingName) - *encodingName = val; - if (encoding) - *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) - return 1; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) - || isGeneralTextEntity) { - *badPtr = name; - return 0; - } - if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { - if (standalone) - *standalone = 1; - } - else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { - if (standalone) - *standalone = 0; - } - else { - *badPtr = val; - return 0; - } - while (isSpace(toAscii(enc, ptr, end))) - ptr += enc->minBytesPerChar; - if (ptr != end) { - *badPtr = ptr; - return 0; - } - return 1; -} - -static int FASTCALL -checkCharRefNumber(int result) -{ - switch (result >> 8) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return -1; - case 0: - if (latin1_encoding.type[result] == BT_NONXML) - return -1; - break; - case 0xFF: - if (result == 0xFFFE || result == 0xFFFF) - return -1; - break; - } - return result; -} - -int FASTCALL -XmlUtf8Encode(int c, char *buf) -{ - enum { - /* minN is minimum legal resulting value for N byte sequence */ - min2 = 0x80, - min3 = 0x800, - min4 = 0x10000 - }; - - if (c < 0) - return 0; - if (c < min2) { - buf[0] = (char)(c | UTF8_cval1); - return 1; - } - if (c < min3) { - buf[0] = (char)((c >> 6) | UTF8_cval2); - buf[1] = (char)((c & 0x3f) | 0x80); - return 2; - } - if (c < min4) { - buf[0] = (char)((c >> 12) | UTF8_cval3); - buf[1] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[2] = (char)((c & 0x3f) | 0x80); - return 3; - } - if (c < 0x110000) { - buf[0] = (char)((c >> 18) | UTF8_cval4); - buf[1] = (char)(((c >> 12) & 0x3f) | 0x80); - buf[2] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[3] = (char)((c & 0x3f) | 0x80); - return 4; - } - return 0; -} - -int FASTCALL -XmlUtf16Encode(int charNum, unsigned short *buf) -{ - if (charNum < 0) - return 0; - if (charNum < 0x10000) { - buf[0] = (unsigned short)charNum; - return 1; - } - if (charNum < 0x110000) { - charNum -= 0x10000; - buf[0] = (unsigned short)((charNum >> 10) + 0xD800); - buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00); - return 2; - } - return 0; -} - -struct unknown_encoding { - struct normal_encoding normal; - CONVERTER convert; - void *userData; - unsigned short utf16[256]; - char utf8[256][4]; -}; - -#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) - -int -XmlSizeOfUnknownEncoding(void) -{ - return sizeof(struct unknown_encoding); -} - -static int PTRFASTCALL -unknown_isName(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); -} - -static int PTRFASTCALL -unknown_isNmstrt(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); -} - -static int PTRFASTCALL -unknown_isInvalid(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; -} - -static void PTRCALL -unknown_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - char buf[XML_UTF8_ENCODE_MAX]; - for (;;) { - const char *utf8; - int n; - if (*fromP == fromLim) - break; - utf8 = uenc->utf8[(unsigned char)**fromP]; - n = *utf8++; - if (n == 0) { - int c = uenc->convert(uenc->userData, *fromP); - n = XmlUtf8Encode(c, buf); - if (n > toLim - *toP) - break; - utf8 = buf; - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else { - if (n > toLim - *toP) - break; - (*fromP)++; - } - do { - *(*toP)++ = *utf8++; - } while (--n != 0); - } -} - -static void PTRCALL -unknown_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - while (*fromP != fromLim && *toP != toLim) { - unsigned short c = uenc->utf16[(unsigned char)**fromP]; - if (c == 0) { - c = (unsigned short) - uenc->convert(uenc->userData, *fromP); - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else - (*fromP)++; - *(*toP)++ = c; - } -} - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ - int i; - struct unknown_encoding *e = (struct unknown_encoding *)mem; - for (i = 0; i < (int)sizeof(struct normal_encoding); i++) - ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; - for (i = 0; i < 128; i++) - if (latin1_encoding.type[i] != BT_OTHER - && latin1_encoding.type[i] != BT_NONXML - && table[i] != i) - return 0; - for (i = 0; i < 256; i++) { - int c = table[i]; - if (c == -1) { - e->normal.type[i] = BT_MALFORM; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else if (c < 0) { - if (c < -4) - return 0; - e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); - e->utf8[i][0] = 0; - e->utf16[i] = 0; - } - else if (c < 0x80) { - if (latin1_encoding.type[c] != BT_OTHER - && latin1_encoding.type[c] != BT_NONXML - && c != i) - return 0; - e->normal.type[i] = latin1_encoding.type[c]; - e->utf8[i][0] = 1; - e->utf8[i][1] = (char)c; - e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); - } - else if (checkCharRefNumber(c) < 0) { - e->normal.type[i] = BT_NONXML; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else { - if (c > 0xFFFF) - return 0; - if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NMSTRT; - else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NAME; - else - e->normal.type[i] = BT_OTHER; - e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); - e->utf16[i] = (unsigned short)c; - } - } - e->userData = userData; - e->convert = convert; - if (convert) { - e->normal.isName2 = unknown_isName; - e->normal.isName3 = unknown_isName; - e->normal.isName4 = unknown_isName; - e->normal.isNmstrt2 = unknown_isNmstrt; - e->normal.isNmstrt3 = unknown_isNmstrt; - e->normal.isNmstrt4 = unknown_isNmstrt; - e->normal.isInvalid2 = unknown_isInvalid; - e->normal.isInvalid3 = unknown_isInvalid; - e->normal.isInvalid4 = unknown_isInvalid; - } - e->normal.enc.utf8Convert = unknown_toUtf8; - e->normal.enc.utf16Convert = unknown_toUtf16; - return &(e->normal.enc); -} - -/* If this enumeration is changed, getEncodingIndex and encodings -must also be changed. */ -enum { - UNKNOWN_ENC = -1, - ISO_8859_1_ENC = 0, - US_ASCII_ENC, - UTF_8_ENC, - UTF_16_ENC, - UTF_16BE_ENC, - UTF_16LE_ENC, - /* must match encodingNames up to here */ - NO_ENC -}; - -static const char KW_ISO_8859_1[] = { - ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, - ASCII_MINUS, ASCII_1, '\0' -}; -static const char KW_US_ASCII[] = { - ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, - '\0' -}; -static const char KW_UTF_8[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' -}; -static const char KW_UTF_16[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' -}; -static const char KW_UTF_16BE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, - '\0' -}; -static const char KW_UTF_16LE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, - '\0' -}; - -static int FASTCALL -getEncodingIndex(const char *name) -{ - static const char * const encodingNames[] = { - KW_ISO_8859_1, - KW_US_ASCII, - KW_UTF_8, - KW_UTF_16, - KW_UTF_16BE, - KW_UTF_16LE, - }; - int i; - if (name == NULL) - return NO_ENC; - for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) - if (streqci(name, encodingNames[i])) - return i; - return UNKNOWN_ENC; -} - -/* For binary compatibility, we store the index of the encoding - specified at initialization in the isUtf16 member. -*/ - -#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) -#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) - -/* This is what detects the encoding. encodingTable maps from - encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of - the external (protocol) specified encoding; state is - XML_CONTENT_STATE if we're parsing an external text entity, and - XML_PROLOG_STATE otherwise. -*/ - - -static int -initScan(const ENCODING * const *encodingTable, - const INIT_ENCODING *enc, - int state, - const char *ptr, - const char *end, - const char **nextTokPtr) -{ - const ENCODING **encPtr; - - if (ptr == end) - return XML_TOK_NONE; - encPtr = enc->encPtr; - if (ptr + 1 == end) { - /* only a single byte available for auto-detection */ -#ifndef XML_DTD /* FIXME */ - /* a well-formed document entity must have more than one byte */ - if (state != XML_CONTENT_STATE) - return XML_TOK_PARTIAL; -#endif - /* so we're parsing an external text entity... */ - /* if UTF-16 was externally specified, then we need at least 2 bytes */ - switch (INIT_ENC_INDEX(enc)) { - case UTF_16_ENC: - case UTF_16LE_ENC: - case UTF_16BE_ENC: - return XML_TOK_PARTIAL; - } - switch ((unsigned char)*ptr) { - case 0xFE: - case 0xFF: - case 0xEF: /* possibly first byte of UTF-8 BOM */ - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - /* fall through */ - case 0x00: - case 0x3C: - return XML_TOK_PARTIAL; - } - } - else { - switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { - case 0xFEFF: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XML_TOK_BOM; - /* 00 3C is handled in the default case */ - case 0x3C00: - if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC - || INIT_ENC_INDEX(enc) == UTF_16_ENC) - && state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - case 0xFFFE: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XML_TOK_BOM; - case 0xEFBB: - /* Maybe a UTF-8 BOM (EF BB BF) */ - /* If there's an explicitly specified (external) encoding - of ISO-8859-1 or some flavour of UTF-16 - and this is an external text entity, - don't look for the BOM, - because it might be a legal data. - */ - if (state == XML_CONTENT_STATE) { - int e = INIT_ENC_INDEX(enc); - if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC - || e == UTF_16LE_ENC || e == UTF_16_ENC) - break; - } - if (ptr + 2 == end) - return XML_TOK_PARTIAL; - if ((unsigned char)ptr[2] == 0xBF) { - *nextTokPtr = ptr + 3; - *encPtr = encodingTable[UTF_8_ENC]; - return XML_TOK_BOM; - } - break; - default: - if (ptr[0] == '\0') { - /* 0 isn't a legal data character. Furthermore a document - entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 is if it is an - external parsed general entity that's labelled as - UTF-16LE. - */ - if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) - break; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - else if (ptr[1] == '\0') { - /* We could recover here in the case: - - parsing an external entity - - second byte is 0 - - no externally specified encoding - - no encoding declaration - by assuming UTF-16LE. But we don't, because this would mean when - presented just with a single byte, we couldn't reliably determine - whether we needed further bytes. - */ - if (state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - break; - } - } - *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); -} - - -#define NS(x) x -#define ns(x) x -#define XML_TOK_NS_C -#include "xmltok_ns.c" -#undef XML_TOK_NS_C -#undef NS -#undef ns - -#ifdef XML_NS - -#define NS(x) x ## NS -#define ns(x) x ## _ns - -#define XML_TOK_NS_C -#include "xmltok_ns.c" -#undef XML_TOK_NS_C - -#undef NS -#undef ns - -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ - ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); - if (enc) - ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; - return enc; -} - -#endif /* XML_NS */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.h deleted file mode 100644 index 497611f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok.h +++ /dev/null @@ -1,316 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlTok_INCLUDED -#define XmlTok_INCLUDED 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* The following token may be returned by XmlContentTok */ -#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be - start of illegal ]]> sequence */ -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_NONE -4 /* The string to be scanned is empty */ -#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; - might be part of CRLF sequence */ -#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ -#define XML_TOK_PARTIAL -1 /* only part of a token */ -#define XML_TOK_INVALID 0 - -/* The following tokens are returned by XmlContentTok; some are also - returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. -*/ -#define XML_TOK_START_TAG_WITH_ATTS 1 -#define XML_TOK_START_TAG_NO_ATTS 2 -#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ -#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 -#define XML_TOK_END_TAG 5 -#define XML_TOK_DATA_CHARS 6 -#define XML_TOK_DATA_NEWLINE 7 -#define XML_TOK_CDATA_SECT_OPEN 8 -#define XML_TOK_ENTITY_REF 9 -#define XML_TOK_CHAR_REF 10 /* numeric character reference */ - -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_PI 11 /* processing instruction */ -#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ -#define XML_TOK_COMMENT 13 -#define XML_TOK_BOM 14 /* Byte order mark */ - -/* The following tokens are returned only by XmlPrologTok */ -#define XML_TOK_PROLOG_S 15 -#define XML_TOK_DECL_OPEN 16 /* */ -#define XML_TOK_NAME 18 -#define XML_TOK_NMTOKEN 19 -#define XML_TOK_POUND_NAME 20 /* #name */ -#define XML_TOK_OR 21 /* | */ -#define XML_TOK_PERCENT 22 -#define XML_TOK_OPEN_PAREN 23 -#define XML_TOK_CLOSE_PAREN 24 -#define XML_TOK_OPEN_BRACKET 25 -#define XML_TOK_CLOSE_BRACKET 26 -#define XML_TOK_LITERAL 27 -#define XML_TOK_PARAM_ENTITY_REF 28 -#define XML_TOK_INSTANCE_START 29 - -/* The following occur only in element type declarations */ -#define XML_TOK_NAME_QUESTION 30 /* name? */ -#define XML_TOK_NAME_ASTERISK 31 /* name* */ -#define XML_TOK_NAME_PLUS 32 /* name+ */ -#define XML_TOK_COND_SECT_OPEN 33 /* */ -#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ -#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ -#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ -#define XML_TOK_COMMA 38 - -/* The following token is returned only by XmlAttributeValueTok */ -#define XML_TOK_ATTRIBUTE_VALUE_S 39 - -/* The following token is returned only by XmlCdataSectionTok */ -#define XML_TOK_CDATA_SECT_CLOSE 40 - -/* With namespace processing this is returned by XmlPrologTok for a - name with a colon. -*/ -#define XML_TOK_PREFIXED_NAME 41 - -#ifdef XML_DTD -#define XML_TOK_IGNORE_SECT 42 -#endif /* XML_DTD */ - -#ifdef XML_DTD -#define XML_N_STATES 4 -#else /* not XML_DTD */ -#define XML_N_STATES 3 -#endif /* not XML_DTD */ - -#define XML_PROLOG_STATE 0 -#define XML_CONTENT_STATE 1 -#define XML_CDATA_SECTION_STATE 2 -#ifdef XML_DTD -#define XML_IGNORE_SECTION_STATE 3 -#endif /* XML_DTD */ - -#define XML_N_LITERAL_TYPES 2 -#define XML_ATTRIBUTE_VALUE_LITERAL 0 -#define XML_ENTITY_VALUE_LITERAL 1 - -/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ -#define XML_UTF8_ENCODE_MAX 4 -/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ -#define XML_UTF16_ENCODE_MAX 2 - -typedef struct position { - /* first line and first column are 0 not 1 */ - XML_Size lineNumber; - XML_Size columnNumber; -} POSITION; - -typedef struct { - const char *name; - const char *valuePtr; - const char *valueEnd; - char normalized; -} ATTRIBUTE; - -struct encoding; -typedef struct encoding ENCODING; - -typedef int (PTRCALL *SCANNER)(const ENCODING *, - const char *, - const char *, - const char **); - -struct encoding { - SCANNER scanners[XML_N_STATES]; - SCANNER literalScanners[XML_N_LITERAL_TYPES]; - int (PTRCALL *sameName)(const ENCODING *, - const char *, - const char *); - int (PTRCALL *nameMatchesAscii)(const ENCODING *, - const char *, - const char *, - const char *); - int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); - const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); - int (PTRCALL *getAtts)(const ENCODING *enc, - const char *ptr, - int attsMax, - ATTRIBUTE *atts); - int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); - int (PTRCALL *predefinedEntityName)(const ENCODING *, - const char *, - const char *); - void (PTRCALL *updatePosition)(const ENCODING *, - const char *ptr, - const char *end, - POSITION *); - int (PTRCALL *isPublicId)(const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr); - void (PTRCALL *utf8Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - char **toP, - const char *toLim); - void (PTRCALL *utf16Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - unsigned short **toP, - const unsigned short *toLim); - int minBytesPerChar; - char isUtf8; - char isUtf16; -}; - -/* Scan the string starting at ptr until the end of the next complete - token, but do not scan past eptr. Return an integer giving the - type of token. - - Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. - - Return XML_TOK_PARTIAL when the string does not contain a complete - token; nextTokPtr will not be set. - - Return XML_TOK_INVALID when the string does not start a valid - token; nextTokPtr will be set to point to the character which made - the token invalid. - - Otherwise the string starts with a valid token; nextTokPtr will be - set to point to the character following the end of that token. - - Each data character counts as a single token, but adjacent data - characters may be returned together. Similarly for characters in - the prolog outside literals, comments and processing instructions. -*/ - - -#define XmlTok(enc, state, ptr, end, nextTokPtr) \ - (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) - -#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) - -#define XmlContentTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) - -#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) - -#ifdef XML_DTD - -#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) - -#endif /* XML_DTD */ - -/* This is used for performing a 2nd-level tokenization on the content - of a literal that has already been returned by XmlTok. -*/ -#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ - (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) - -#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) - -#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ - (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) - -#define XmlNameLength(enc, ptr) \ - (((enc)->nameLength)(enc, ptr)) - -#define XmlSkipS(enc, ptr) \ - (((enc)->skipS)(enc, ptr)) - -#define XmlGetAttributes(enc, ptr, attsMax, atts) \ - (((enc)->getAtts)(enc, ptr, attsMax, atts)) - -#define XmlCharRefNumber(enc, ptr) \ - (((enc)->charRefNumber)(enc, ptr)) - -#define XmlPredefinedEntityName(enc, ptr, end) \ - (((enc)->predefinedEntityName)(enc, ptr, end)) - -#define XmlUpdatePosition(enc, ptr, end, pos) \ - (((enc)->updatePosition)(enc, ptr, end, pos)) - -#define XmlIsPublicId(enc, ptr, end, badPtr) \ - (((enc)->isPublicId)(enc, ptr, end, badPtr)) - -#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) - -#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) - -typedef struct { - ENCODING initEnc; - const ENCODING **encPtr; -} INIT_ENCODING; - -int XmlParseXmlDecl(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncoding(void); -const ENCODING *XmlGetUtf16InternalEncoding(void); -int FASTCALL XmlUtf8Encode(int charNumber, char *buf); -int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); -int XmlSizeOfUnknownEncoding(void); - - -typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData); - -int XmlParseXmlDeclNS(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncodingNS(void); -const ENCODING *XmlGetUtf16InternalEncodingNS(void); -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData); -#ifdef __cplusplus -} -#endif - -#endif /* not XmlTok_INCLUDED */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.c deleted file mode 100644 index b13afac..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.c +++ /dev/null @@ -1,1783 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* This file is included! */ -#ifdef XML_TOK_IMPL_C - -#ifndef IS_INVALID_CHAR -#define IS_INVALID_CHAR(enc, ptr, n) (0) -#endif - -#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_INVALID_CHAR(enc, ptr, n)) { \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define INVALID_CASES(ptr, nextTokPtr) \ - INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ - case BT_NONXML: \ - case BT_MALFORM: \ - case BT_TRAIL: \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; - -#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NAME_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - case BT_DIGIT: \ - case BT_NAME: \ - case BT_MINUS: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) - -#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) - -#ifndef PREFIX -#define PREFIX(ident) ident -#endif - -/* ptr points to character following " */ - switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { - case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - /* fall through */ - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DECL_OPEN; - case BT_NMSTRT: - case BT_HEX: - ptr += MINBPC(enc); - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, - const char *end, int *tokPtr) -{ - int upper = 0; - *tokPtr = XML_TOK_PI; - if (end - ptr != MINBPC(enc)*3) - return 1; - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_x: - break; - case ASCII_X: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_m: - break; - case ASCII_M: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - break; - case ASCII_L: - upper = 1; - break; - default: - return 1; - } - if (upper) - return 0; - *tokPtr = XML_TOK_XML_DECL; - return 1; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CDATA_SECT_CLOSE; - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - case BT_RSQB: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_LT: - return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_AMP: - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_RSQB: - if (ptr + MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { - ptr += MINBPC(enc); - break; - } - if (ptr + 2*MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { - ptr += MINBPC(enc); - break; - } - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_INVALID; - } - } - /* fall through */ - case BT_AMP: - case BT_LT: - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following "%" */ - -static int PTRCALL -PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_PERCENT; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_PARAM_ENTITY_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_CR: case BT_LF: case BT_S: - case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: - *nextTokPtr = ptr; - return XML_TOK_POUND_NAME; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -XML_TOK_POUND_NAME; -} - -static int PTRCALL -PREFIX(scanLit)(int open, const ENCODING *enc, - const char *ptr, const char *end, - const char **nextTokPtr) -{ - while (ptr != end) { - int t = BYTE_TYPE(enc, ptr); - switch (t) { - INVALID_CASES(ptr, nextTokPtr) - case BT_QUOT: - case BT_APOS: - ptr += MINBPC(enc); - if (t != open) - break; - if (ptr == end) - return -XML_TOK_LITERAL; - *nextTokPtr = ptr; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - case BT_GT: case BT_PERCNT: case BT_LSQB: - return XML_TOK_LITERAL; - default: - return XML_TOK_INVALID; - } - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int tok; - if (ptr == end) - return XML_TOK_NONE; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_QUOT: - return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_APOS: - return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LT: - { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_EXCL: - return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_NMSTRT: - case BT_HEX: - case BT_NONASCII: - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - *nextTokPtr = ptr - MINBPC(enc); - return XML_TOK_INSTANCE_START; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - case BT_CR: - if (ptr + MINBPC(enc) == end) { - *nextTokPtr = end; - /* indicate that this might be part of a CR/LF pair */ - return -XML_TOK_PROLOG_S; - } - /* fall through */ - case BT_S: case BT_LF: - for (;;) { - ptr += MINBPC(enc); - if (ptr == end) - break; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_LF: - break; - case BT_CR: - /* don't split CR/LF pair */ - if (ptr + MINBPC(enc) != end) - break; - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - } - } - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - case BT_PERCNT: - return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_COMMA: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COMMA; - case BT_LSQB: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_BRACKET; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_BRACKET; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_COND_SECT_CLOSE; - } - } - *nextTokPtr = ptr; - return XML_TOK_CLOSE_BRACKET; - case BT_LPAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_PAREN; - case BT_RPAR: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_PAREN; - switch (BYTE_TYPE(enc, ptr)) { - case BT_AST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_ASTERISK; - case BT_QUEST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_QUESTION; - case BT_PLUS: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_PLUS; - case BT_CR: case BT_LF: case BT_S: - case BT_GT: case BT_COMMA: case BT_VERBAR: - case BT_RPAR: - *nextTokPtr = ptr; - return XML_TOK_CLOSE_PAREN; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_VERBAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OR; - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DECL_CLOSE; - case BT_NUM: - return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NAME; \ - break; \ - } \ - if (IS_NAME_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NMTOKEN; \ - break; \ - } \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NMSTRT: - case BT_HEX: - tok = XML_TOK_NAME; - ptr += MINBPC(enc); - break; - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: -#ifdef XML_NS - case BT_COLON: -#endif - tok = XML_TOK_NMTOKEN; - ptr += MINBPC(enc); - break; - case BT_NONASCII: - if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NAME; - break; - } - if (IS_NAME_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NMTOKEN; - break; - } - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: case BT_RPAR: case BT_COMMA: - case BT_VERBAR: case BT_LSQB: case BT_PERCNT: - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return tok; -#ifdef XML_NS - case BT_COLON: - ptr += MINBPC(enc); - switch (tok) { - case XML_TOK_NAME: - if (ptr == end) - return XML_TOK_PARTIAL; - tok = XML_TOK_PREFIXED_NAME; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - default: - tok = XML_TOK_NMTOKEN; - break; - } - break; - case XML_TOK_PREFIXED_NAME: - tok = XML_TOK_NMTOKEN; - break; - } - break; -#endif - case BT_PLUS: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_PLUS; - case BT_AST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_ASTERISK; - case BT_QUEST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_QUESTION; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -tok; -} - -static int PTRCALL -PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LT: - /* this is for inside entity references */ - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_S: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_ATTRIBUTE_VALUE_S; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -static int PTRCALL -PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_PERCNT: - if (ptr == start) { - int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), - end, nextTokPtr); - return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -#ifdef XML_DTD - -static int PTRCALL -PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - int level = 0; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - end = ptr + n; - } - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_LT: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { - ++level; - ptr += MINBPC(enc); - } - } - break; - case BT_RSQB: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr += MINBPC(enc); - if (level == 0) { - *nextTokPtr = ptr; - return XML_TOK_IGNORE_SECT; - } - --level; - } - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -#endif /* XML_DTD */ - -static int PTRCALL -PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr) -{ - ptr += MINBPC(enc); - end -= MINBPC(enc); - for (; ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - case BT_MINUS: - case BT_APOS: - case BT_LPAR: - case BT_RPAR: - case BT_PLUS: - case BT_COMMA: - case BT_SOL: - case BT_EQUALS: - case BT_QUEST: - case BT_CR: - case BT_LF: - case BT_SEMI: - case BT_EXCL: - case BT_AST: - case BT_PERCNT: - case BT_NUM: -#ifdef XML_NS - case BT_COLON: -#endif - break; - case BT_S: - if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { - *badPtr = ptr; - return 0; - } - break; - case BT_NAME: - case BT_NMSTRT: - if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) - break; - default: - switch (BYTE_TO_ASCII(enc, ptr)) { - case 0x24: /* $ */ - case 0x40: /* @ */ - break; - default: - *badPtr = ptr; - return 0; - } - break; - } - } - return 1; -} - -/* This must only be called for a well-formed start-tag or empty - element tag. Returns the number of attributes. Pointers to the - first attsMax attributes are stored in atts. -*/ - -static int PTRCALL -PREFIX(getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts) -{ - enum { other, inName, inValue } state = inName; - int nAtts = 0; - int open = 0; /* defined when state == inValue; - initialization just to shut up compilers */ - - for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { -#define START_NAME \ - if (state == other) { \ - if (nAtts < attsMax) { \ - atts[nAtts].name = ptr; \ - atts[nAtts].normalized = 1; \ - } \ - state = inName; \ - } -#define LEAD_CASE(n) \ - case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: - case BT_HEX: - START_NAME - break; -#undef START_NAME - case BT_QUOT: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_QUOT; - } - else if (open == BT_QUOT) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_APOS: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_APOS; - } - else if (open == BT_APOS) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_AMP: - if (nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_S: - if (state == inName) - state = other; - else if (state == inValue - && nAtts < attsMax - && atts[nAtts].normalized - && (ptr == atts[nAtts].valuePtr - || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE - || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE - || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) - atts[nAtts].normalized = 0; - break; - case BT_CR: case BT_LF: - /* This case ensures that the first attribute name is counted - Apart from that we could just change state on the quote. */ - if (state == inName) - state = other; - else if (state == inValue && nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_GT: - case BT_SOL: - if (state != inValue) - return nAtts; - break; - default: - break; - } - } - /* not reached */ -} - -static int PTRFASTCALL -PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) -{ - int result = 0; - /* skip &# */ - ptr += 2*MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_x)) { - for (ptr += MINBPC(enc); - !CHAR_MATCHES(enc, ptr, ASCII_SEMI); - ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - switch (c) { - case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: - case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: - result <<= 4; - result |= (c - ASCII_0); - break; - case ASCII_A: case ASCII_B: case ASCII_C: - case ASCII_D: case ASCII_E: case ASCII_F: - result <<= 4; - result += 10 + (c - ASCII_A); - break; - case ASCII_a: case ASCII_b: case ASCII_c: - case ASCII_d: case ASCII_e: case ASCII_f: - result <<= 4; - result += 10 + (c - ASCII_a); - break; - } - if (result >= 0x110000) - return -1; - } - } - else { - for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - result *= 10; - result += (c - ASCII_0); - if (result >= 0x110000) - return -1; - } - } - return checkCharRefNumber(result); -} - -static int PTRCALL -PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, - const char *end) -{ - switch ((end - ptr)/MINBPC(enc)) { - case 2: - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - return ASCII_LT; - case ASCII_g: - return ASCII_GT; - } - } - break; - case 3: - if (CHAR_MATCHES(enc, ptr, ASCII_a)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_m)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) - return ASCII_AMP; - } - } - break; - case 4: - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_q: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_u)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_t)) - return ASCII_QUOT; - } - } - break; - case ASCII_a: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_s)) - return ASCII_APOS; - } - } - break; - } - } - return 0; -} - -static int PTRCALL -PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr1)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (*ptr1++ != *ptr2++) \ - return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) -#undef LEAD_CASE - /* fall through */ - if (*ptr1++ != *ptr2++) - return 0; - break; - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 1) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 2) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 3) { - if (*ptr2++ != *ptr1++) - return 0; - } - } - } - break; - default: - if (MINBPC(enc) == 1 && *ptr1 == *ptr2) - return 1; - switch (BYTE_TYPE(enc, ptr2)) { - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - return 0; - default: - return 1; - } - } - } - /* not reached */ -} - -static int PTRCALL -PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, - const char *end1, const char *ptr2) -{ - for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (ptr1 == end1) - return 0; - if (!CHAR_MATCHES(enc, ptr1, *ptr2)) - return 0; - } - return ptr1 == end1; -} - -static int PTRFASTCALL -PREFIX(nameLength)(const ENCODING *enc, const char *ptr) -{ - const char *start = ptr; - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - ptr += MINBPC(enc); - break; - default: - return (int)(ptr - start); - } - } -} - -static const char * PTRFASTCALL -PREFIX(skipS)(const ENCODING *enc, const char *ptr) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_LF: - case BT_CR: - case BT_S: - ptr += MINBPC(enc); - break; - default: - return ptr; - } - } -} - -static void PTRCALL -PREFIX(updatePosition)(const ENCODING *enc, - const char *ptr, - const char *end, - POSITION *pos) -{ - while (ptr < end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_LF: - pos->columnNumber = (XML_Size)-1; - pos->lineNumber++; - ptr += MINBPC(enc); - break; - case BT_CR: - pos->lineNumber++; - ptr += MINBPC(enc); - if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - pos->columnNumber = (XML_Size)-1; - break; - default: - ptr += MINBPC(enc); - break; - } - pos->columnNumber++; - } -} - -#undef DO_LEAD_CASE -#undef MULTIBYTE_CASES -#undef INVALID_CASES -#undef CHECK_NAME_CASE -#undef CHECK_NAME_CASES -#undef CHECK_NMSTRT_CASE -#undef CHECK_NMSTRT_CASES - -#endif /* XML_TOK_IMPL_C */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.h deleted file mode 100644 index 94c7db6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -enum { - BT_NONXML, - BT_MALFORM, - BT_LT, - BT_AMP, - BT_RSQB, - BT_LEAD2, - BT_LEAD3, - BT_LEAD4, - BT_TRAIL, - BT_CR, - BT_LF, - BT_GT, - BT_QUOT, - BT_APOS, - BT_EQUALS, - BT_QUEST, - BT_EXCL, - BT_SOL, - BT_SEMI, - BT_NUM, - BT_LSQB, - BT_S, - BT_NMSTRT, - BT_COLON, - BT_HEX, - BT_DIGIT, - BT_NAME, - BT_MINUS, - BT_OTHER, /* known not to be a name or name start character */ - BT_NONASCII, /* might be a name or name start character */ - BT_PERCNT, - BT_LPAR, - BT_RPAR, - BT_AST, - BT_PLUS, - BT_COMMA, - BT_VERBAR -}; - -#include diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_ns.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_ns.c deleted file mode 100644 index 6f44256..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/expat/xmltok_ns.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* This file is included! */ -#ifdef XML_TOK_NS_C - -const ENCODING * -NS(XmlGetUtf8InternalEncoding)(void) -{ - return &ns(internal_utf8_encoding).enc; -} - -const ENCODING * -NS(XmlGetUtf16InternalEncoding)(void) -{ -#if BYTEORDER == 1234 - return &ns(internal_little2_encoding).enc; -#elif BYTEORDER == 4321 - return &ns(internal_big2_encoding).enc; -#else - const short n = 1; - return (*(const char *)&n - ? &ns(internal_little2_encoding).enc - : &ns(internal_big2_encoding).enc); -#endif -} - -static const ENCODING * const NS(encodings)[] = { - &ns(latin1_encoding).enc, - &ns(ascii_encoding).enc, - &ns(utf8_encoding).enc, - &ns(big2_encoding).enc, - &ns(big2_encoding).enc, - &ns(little2_encoding).enc, - &ns(utf8_encoding).enc /* NO_ENC */ -}; - -static int PTRCALL -NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_PROLOG_STATE, ptr, end, nextTokPtr); -} - -static int PTRCALL -NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_CONTENT_STATE, ptr, end, nextTokPtr); -} - -int -NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, - const char *name) -{ - int i = getEncodingIndex(name); - if (i == UNKNOWN_ENC) - return 0; - SET_INIT_ENC_INDEX(p, i); - p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); - p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); - p->initEnc.updatePosition = initUpdatePosition; - p->encPtr = encPtr; - *encPtr = &(p->initEnc); - return 1; -} - -static const ENCODING * -NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) -{ -#define ENCODING_MAX 128 - char buf[ENCODING_MAX]; - char *p = buf; - int i; - XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); - if (ptr != end) - return 0; - *p = 0; - if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) - return enc; - i = getEncodingIndex(buf); - if (i == UNKNOWN_ENC) - return 0; - return NS(encodings)[i]; -} - -int -NS(XmlParseXmlDecl)(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - return doParseXmlDecl(NS(findEncoding), - isGeneralTextEntity, - enc, - ptr, - end, - badPtr, - versionPtr, - versionEndPtr, - encodingName, - encoding, - standalone); -} - -#endif /* XML_TOK_NS_C */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/future_builtins.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/future_builtins.c deleted file mode 100644 index 47696d5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/future_builtins.c +++ /dev/null @@ -1,105 +0,0 @@ - -/* future_builtins module */ - -/* This module provides functions that will be builtins in Python 3.0, - but that conflict with builtins that already exist in Python - 2.x. */ - - -#include "Python.h" - -PyDoc_STRVAR(module_doc, -"This module provides functions that will be builtins in Python 3.0,\n\ -but that conflict with builtins that already exist in Python 2.x.\n\ -\n\ -Functions:\n\ -\n\ -ascii(arg) -- Returns the canonical string representation of an object.\n\ -filter(pred, iterable) -- Returns an iterator yielding those items of \n\ - iterable for which pred(item) is true.\n\ -hex(arg) -- Returns the hexadecimal representation of an integer.\n\ -map(func, *iterables) -- Returns an iterator that computes the function \n\ - using arguments from each of the iterables.\n\ -oct(arg) -- Returns the octal representation of an integer.\n\ -zip(iter1 [,iter2 [...]]) -- Returns a zip object whose .next() method \n\ - returns a tuple where the i-th element comes from the i-th iterable \n\ - argument.\n\ -\n\ -The typical usage of this module is to replace existing builtins in a\n\ -module's namespace:\n \n\ -from future_builtins import ascii, filter, map, hex, oct, zip\n"); - -static PyObject * -builtin_hex(PyObject *self, PyObject *v) -{ - return PyNumber_ToBase(v, 16); -} - -PyDoc_STRVAR(hex_doc, -"hex(number) -> string\n\ -\n\ -Return the hexadecimal representation of an integer or long integer."); - - -static PyObject * -builtin_oct(PyObject *self, PyObject *v) -{ - return PyNumber_ToBase(v, 8); -} - -PyDoc_STRVAR(oct_doc, -"oct(number) -> string\n\ -\n\ -Return the octal representation of an integer or long integer."); - - -static PyObject * -builtin_ascii(PyObject *self, PyObject *v) -{ - return PyObject_Repr(v); -} - -PyDoc_STRVAR(ascii_doc, -"ascii(object) -> string\n\ -\n\ -Return the same as repr(). In Python 3.x, the repr() result will\n\ -contain printable characters unescaped, while the ascii() result\n\ -will have such characters backslash-escaped."); - -/* List of functions exported by this module */ - -static PyMethodDef module_functions[] = { - {"hex", builtin_hex, METH_O, hex_doc}, - {"oct", builtin_oct, METH_O, oct_doc}, - {"ascii", builtin_ascii, METH_O, ascii_doc}, - {NULL, NULL} /* Sentinel */ -}; - - -/* Initialize this module. */ - -PyMODINIT_FUNC -initfuture_builtins(void) -{ - PyObject *m, *itertools, *iter_func; - char *it_funcs[] = {"imap", "ifilter", "izip", NULL}; - char **cur_func; - - m = Py_InitModule3("future_builtins", module_functions, module_doc); - if (m == NULL) - return; - - itertools = PyImport_ImportModuleNoBlock("itertools"); - if (itertools == NULL) - return; - - /* If anything in the following loop fails, we fall through. */ - for (cur_func = it_funcs; *cur_func; ++cur_func){ - iter_func = PyObject_GetAttrString(itertools, *cur_func); - if (iter_func == NULL || - PyModule_AddObject(m, *cur_func+1, iter_func) < 0) - break; - } - Py_DECREF(itertools); - /* any other initialization needed */ -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/gcmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/gcmodule.c deleted file mode 100644 index 1746887..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/gcmodule.c +++ /dev/null @@ -1,1570 +0,0 @@ -/* - - Reference Cycle Garbage Collection - ================================== - - Neil Schemenauer - - Based on a post on the python-dev list. Ideas from Guido van Rossum, - Eric Tiedemann, and various others. - - http://www.arctrix.com/nas/python/gc/ - http://www.python.org/pipermail/python-dev/2000-March/003869.html - http://www.python.org/pipermail/python-dev/2000-March/004010.html - http://www.python.org/pipermail/python-dev/2000-March/004022.html - - For a highlevel view of the collection process, read the collect - function. - -*/ - -#include "Python.h" -#include "frameobject.h" /* for PyFrame_ClearFreeList */ - -/* Get an object's GC head */ -#define AS_GC(o) ((PyGC_Head *)(o)-1) - -/* Get the object given the GC head */ -#define FROM_GC(g) ((PyObject *)(((PyGC_Head *)g)+1)) - -/*** Global GC state ***/ - -struct gc_generation { - PyGC_Head head; - int threshold; /* collection threshold */ - int count; /* count of allocations or collections of younger - generations */ -}; - -#define NUM_GENERATIONS 3 -#define GEN_HEAD(n) (&generations[n].head) - -/* linked lists of container objects */ -static struct gc_generation generations[NUM_GENERATIONS] = { - /* PyGC_Head, threshold, count */ - {{{GEN_HEAD(0), GEN_HEAD(0), 0}}, 700, 0}, - {{{GEN_HEAD(1), GEN_HEAD(1), 0}}, 10, 0}, - {{{GEN_HEAD(2), GEN_HEAD(2), 0}}, 10, 0}, -}; - -PyGC_Head *_PyGC_generation0 = GEN_HEAD(0); - -static int enabled = 1; /* automatic collection enabled? */ - -/* true if we are currently running the collector */ -static int collecting = 0; - -/* list of uncollectable objects */ -static PyObject *garbage = NULL; - -/* Python string to use if unhandled exception occurs */ -static PyObject *gc_str = NULL; - -/* Python string used to look for __del__ attribute. */ -static PyObject *delstr = NULL; - -/* This is the number of objects who survived the last full collection. It - approximates the number of long lived objects tracked by the GC. - - (by "full collection", we mean a collection of the oldest generation). -*/ -static Py_ssize_t long_lived_total = 0; - -/* This is the number of objects who survived all "non-full" collections, - and are awaiting to undergo a full collection for the first time. - -*/ -static Py_ssize_t long_lived_pending = 0; - -/* - NOTE: about the counting of long-lived objects. - - To limit the cost of garbage collection, there are two strategies; - - make each collection faster, e.g. by scanning fewer objects - - do less collections - This heuristic is about the latter strategy. - - In addition to the various configurable thresholds, we only trigger a - full collection if the ratio - long_lived_pending / long_lived_total - is above a given value (hardwired to 25%). - - The reason is that, while "non-full" collections (i.e., collections of - the young and middle generations) will always examine roughly the same - number of objects -- determined by the aforementioned thresholds --, - the cost of a full collection is proportional to the total number of - long-lived objects, which is virtually unbounded. - - Indeed, it has been remarked that doing a full collection every - of object creations entails a dramatic performance - degradation in workloads which consist in creating and storing lots of - long-lived objects (e.g. building a large list of GC-tracked objects would - show quadratic performance, instead of linear as expected: see issue #4074). - - Using the above ratio, instead, yields amortized linear performance in - the total number of objects (the effect of which can be summarized - thusly: "each full garbage collection is more and more costly as the - number of objects grows, but we do fewer and fewer of them"). - - This heuristic was suggested by Martin von Löwis on python-dev in - June 2008. His original analysis and proposal can be found at: - http://mail.python.org/pipermail/python-dev/2008-June/080579.html -*/ - -/* - NOTE: about untracking of mutable objects. - - Certain types of container cannot participate in a reference cycle, and - so do not need to be tracked by the garbage collector. Untracking these - objects reduces the cost of garbage collections. However, determining - which objects may be untracked is not free, and the costs must be - weighed against the benefits for garbage collection. - - There are two possible strategies for when to untrack a container: - - i) When the container is created. - ii) When the container is examined by the garbage collector. - - Tuples containing only immutable objects (integers, strings etc, and - recursively, tuples of immutable objects) do not need to be tracked. - The interpreter creates a large number of tuples, many of which will - not survive until garbage collection. It is therefore not worthwhile - to untrack eligible tuples at creation time. - - Instead, all tuples except the empty tuple are tracked when created. - During garbage collection it is determined whether any surviving tuples - can be untracked. A tuple can be untracked if all of its contents are - already not tracked. Tuples are examined for untracking in all garbage - collection cycles. It may take more than one cycle to untrack a tuple. - - Dictionaries containing only immutable objects also do not need to be - tracked. Dictionaries are untracked when created. If a tracked item is - inserted into a dictionary (either as a key or value), the dictionary - becomes tracked. During a full garbage collection (all generations), - the collector will untrack any dictionaries whose contents are not - tracked. - - The module provides the python function is_tracked(obj), which returns - the CURRENT tracking status of the object. Subsequent garbage - collections may change the tracking status of the object. - - Untracking of certain containers was introduced in issue #4688, and - the algorithm was refined in response to issue #14775. -*/ - -/* set for debugging information */ -#define DEBUG_STATS (1<<0) /* print collection statistics */ -#define DEBUG_COLLECTABLE (1<<1) /* print collectable objects */ -#define DEBUG_UNCOLLECTABLE (1<<2) /* print uncollectable objects */ -#define DEBUG_INSTANCES (1<<3) /* print instances */ -#define DEBUG_OBJECTS (1<<4) /* print other objects */ -#define DEBUG_SAVEALL (1<<5) /* save all garbage in gc.garbage */ -#define DEBUG_LEAK DEBUG_COLLECTABLE | \ - DEBUG_UNCOLLECTABLE | \ - DEBUG_INSTANCES | \ - DEBUG_OBJECTS | \ - DEBUG_SAVEALL -static int debug; -static PyObject *tmod = NULL; - -/*-------------------------------------------------------------------------- -gc_refs values. - -Between collections, every gc'ed object has one of two gc_refs values: - -GC_UNTRACKED - The initial state; objects returned by PyObject_GC_Malloc are in this - state. The object doesn't live in any generation list, and its - tp_traverse slot must not be called. - -GC_REACHABLE - The object lives in some generation list, and its tp_traverse is safe to - call. An object transitions to GC_REACHABLE when PyObject_GC_Track - is called. - -During a collection, gc_refs can temporarily take on other states: - ->= 0 - At the start of a collection, update_refs() copies the true refcount - to gc_refs, for each object in the generation being collected. - subtract_refs() then adjusts gc_refs so that it equals the number of - times an object is referenced directly from outside the generation - being collected. - gc_refs remains >= 0 throughout these steps. - -GC_TENTATIVELY_UNREACHABLE - move_unreachable() then moves objects not reachable (whether directly or - indirectly) from outside the generation into an "unreachable" set. - Objects that are found to be reachable have gc_refs set to GC_REACHABLE - again. Objects that are found to be unreachable have gc_refs set to - GC_TENTATIVELY_UNREACHABLE. It's "tentatively" because the pass doing - this can't be sure until it ends, and GC_TENTATIVELY_UNREACHABLE may - transition back to GC_REACHABLE. - - Only objects with GC_TENTATIVELY_UNREACHABLE still set are candidates - for collection. If it's decided not to collect such an object (e.g., - it has a __del__ method), its gc_refs is restored to GC_REACHABLE again. ----------------------------------------------------------------------------- -*/ -#define GC_UNTRACKED _PyGC_REFS_UNTRACKED -#define GC_REACHABLE _PyGC_REFS_REACHABLE -#define GC_TENTATIVELY_UNREACHABLE _PyGC_REFS_TENTATIVELY_UNREACHABLE - -#define IS_TRACKED(o) ((AS_GC(o))->gc.gc_refs != GC_UNTRACKED) -#define IS_REACHABLE(o) ((AS_GC(o))->gc.gc_refs == GC_REACHABLE) -#define IS_TENTATIVELY_UNREACHABLE(o) ( \ - (AS_GC(o))->gc.gc_refs == GC_TENTATIVELY_UNREACHABLE) - -/*** list functions ***/ - -static void -gc_list_init(PyGC_Head *list) -{ - list->gc.gc_prev = list; - list->gc.gc_next = list; -} - -static int -gc_list_is_empty(PyGC_Head *list) -{ - return (list->gc.gc_next == list); -} - -#if 0 -/* This became unused after gc_list_move() was introduced. */ -/* Append `node` to `list`. */ -static void -gc_list_append(PyGC_Head *node, PyGC_Head *list) -{ - node->gc.gc_next = list; - node->gc.gc_prev = list->gc.gc_prev; - node->gc.gc_prev->gc.gc_next = node; - list->gc.gc_prev = node; -} -#endif - -/* Remove `node` from the gc list it's currently in. */ -static void -gc_list_remove(PyGC_Head *node) -{ - node->gc.gc_prev->gc.gc_next = node->gc.gc_next; - node->gc.gc_next->gc.gc_prev = node->gc.gc_prev; - node->gc.gc_next = NULL; /* object is not currently tracked */ -} - -/* Move `node` from the gc list it's currently in (which is not explicitly - * named here) to the end of `list`. This is semantically the same as - * gc_list_remove(node) followed by gc_list_append(node, list). - */ -static void -gc_list_move(PyGC_Head *node, PyGC_Head *list) -{ - PyGC_Head *new_prev; - PyGC_Head *current_prev = node->gc.gc_prev; - PyGC_Head *current_next = node->gc.gc_next; - /* Unlink from current list. */ - current_prev->gc.gc_next = current_next; - current_next->gc.gc_prev = current_prev; - /* Relink at end of new list. */ - new_prev = node->gc.gc_prev = list->gc.gc_prev; - new_prev->gc.gc_next = list->gc.gc_prev = node; - node->gc.gc_next = list; -} - -/* append list `from` onto list `to`; `from` becomes an empty list */ -static void -gc_list_merge(PyGC_Head *from, PyGC_Head *to) -{ - PyGC_Head *tail; - assert(from != to); - if (!gc_list_is_empty(from)) { - tail = to->gc.gc_prev; - tail->gc.gc_next = from->gc.gc_next; - tail->gc.gc_next->gc.gc_prev = tail; - to->gc.gc_prev = from->gc.gc_prev; - to->gc.gc_prev->gc.gc_next = to; - } - gc_list_init(from); -} - -static Py_ssize_t -gc_list_size(PyGC_Head *list) -{ - PyGC_Head *gc; - Py_ssize_t n = 0; - for (gc = list->gc.gc_next; gc != list; gc = gc->gc.gc_next) { - n++; - } - return n; -} - -/* Append objects in a GC list to a Python list. - * Return 0 if all OK, < 0 if error (out of memory for list). - */ -static int -append_objects(PyObject *py_list, PyGC_Head *gc_list) -{ - PyGC_Head *gc; - for (gc = gc_list->gc.gc_next; gc != gc_list; gc = gc->gc.gc_next) { - PyObject *op = FROM_GC(gc); - if (op != py_list) { - if (PyList_Append(py_list, op)) { - return -1; /* exception */ - } - } - } - return 0; -} - -/*** end of list stuff ***/ - - -/* Set all gc_refs = ob_refcnt. After this, gc_refs is > 0 for all objects - * in containers, and is GC_REACHABLE for all tracked gc objects not in - * containers. - */ -static void -update_refs(PyGC_Head *containers) -{ - PyGC_Head *gc = containers->gc.gc_next; - for (; gc != containers; gc = gc->gc.gc_next) { - assert(gc->gc.gc_refs == GC_REACHABLE); - gc->gc.gc_refs = Py_REFCNT(FROM_GC(gc)); - /* Python's cyclic gc should never see an incoming refcount - * of 0: if something decref'ed to 0, it should have been - * deallocated immediately at that time. - * Possible cause (if the assert triggers): a tp_dealloc - * routine left a gc-aware object tracked during its teardown - * phase, and did something-- or allowed something to happen -- - * that called back into Python. gc can trigger then, and may - * see the still-tracked dying object. Before this assert - * was added, such mistakes went on to allow gc to try to - * delete the object again. In a debug build, that caused - * a mysterious segfault, when _Py_ForgetReference tried - * to remove the object from the doubly-linked list of all - * objects a second time. In a release build, an actual - * double deallocation occurred, which leads to corruption - * of the allocator's internal bookkeeping pointers. That's - * so serious that maybe this should be a release-build - * check instead of an assert? - */ - assert(gc->gc.gc_refs != 0); - } -} - -/* A traversal callback for subtract_refs. */ -static int -visit_decref(PyObject *op, void *data) -{ - assert(op != NULL); - if (PyObject_IS_GC(op)) { - PyGC_Head *gc = AS_GC(op); - /* We're only interested in gc_refs for objects in the - * generation being collected, which can be recognized - * because only they have positive gc_refs. - */ - assert(gc->gc.gc_refs != 0); /* else refcount was too small */ - if (gc->gc.gc_refs > 0) - gc->gc.gc_refs--; - } - return 0; -} - -/* Subtract internal references from gc_refs. After this, gc_refs is >= 0 - * for all objects in containers, and is GC_REACHABLE for all tracked gc - * objects not in containers. The ones with gc_refs > 0 are directly - * reachable from outside containers, and so can't be collected. - */ -static void -subtract_refs(PyGC_Head *containers) -{ - traverseproc traverse; - PyGC_Head *gc = containers->gc.gc_next; - for (; gc != containers; gc=gc->gc.gc_next) { - traverse = Py_TYPE(FROM_GC(gc))->tp_traverse; - (void) traverse(FROM_GC(gc), - (visitproc)visit_decref, - NULL); - } -} - -/* A traversal callback for move_unreachable. */ -static int -visit_reachable(PyObject *op, PyGC_Head *reachable) -{ - if (PyObject_IS_GC(op)) { - PyGC_Head *gc = AS_GC(op); - const Py_ssize_t gc_refs = gc->gc.gc_refs; - - if (gc_refs == 0) { - /* This is in move_unreachable's 'young' list, but - * the traversal hasn't yet gotten to it. All - * we need to do is tell move_unreachable that it's - * reachable. - */ - gc->gc.gc_refs = 1; - } - else if (gc_refs == GC_TENTATIVELY_UNREACHABLE) { - /* This had gc_refs = 0 when move_unreachable got - * to it, but turns out it's reachable after all. - * Move it back to move_unreachable's 'young' list, - * and move_unreachable will eventually get to it - * again. - */ - gc_list_move(gc, reachable); - gc->gc.gc_refs = 1; - } - /* Else there's nothing to do. - * If gc_refs > 0, it must be in move_unreachable's 'young' - * list, and move_unreachable will eventually get to it. - * If gc_refs == GC_REACHABLE, it's either in some other - * generation so we don't care about it, or move_unreachable - * already dealt with it. - * If gc_refs == GC_UNTRACKED, it must be ignored. - */ - else { - assert(gc_refs > 0 - || gc_refs == GC_REACHABLE - || gc_refs == GC_UNTRACKED); - } - } - return 0; -} - -/* Move the unreachable objects from young to unreachable. After this, - * all objects in young have gc_refs = GC_REACHABLE, and all objects in - * unreachable have gc_refs = GC_TENTATIVELY_UNREACHABLE. All tracked - * gc objects not in young or unreachable still have gc_refs = GC_REACHABLE. - * All objects in young after this are directly or indirectly reachable - * from outside the original young; and all objects in unreachable are - * not. - */ -static void -move_unreachable(PyGC_Head *young, PyGC_Head *unreachable) -{ - PyGC_Head *gc = young->gc.gc_next; - - /* Invariants: all objects "to the left" of us in young have gc_refs - * = GC_REACHABLE, and are indeed reachable (directly or indirectly) - * from outside the young list as it was at entry. All other objects - * from the original young "to the left" of us are in unreachable now, - * and have gc_refs = GC_TENTATIVELY_UNREACHABLE. All objects to the - * left of us in 'young' now have been scanned, and no objects here - * or to the right have been scanned yet. - */ - - while (gc != young) { - PyGC_Head *next; - - if (gc->gc.gc_refs) { - /* gc is definitely reachable from outside the - * original 'young'. Mark it as such, and traverse - * its pointers to find any other objects that may - * be directly reachable from it. Note that the - * call to tp_traverse may append objects to young, - * so we have to wait until it returns to determine - * the next object to visit. - */ - PyObject *op = FROM_GC(gc); - traverseproc traverse = Py_TYPE(op)->tp_traverse; - assert(gc->gc.gc_refs > 0); - gc->gc.gc_refs = GC_REACHABLE; - (void) traverse(op, - (visitproc)visit_reachable, - (void *)young); - next = gc->gc.gc_next; - if (PyTuple_CheckExact(op)) { - _PyTuple_MaybeUntrack(op); - } - } - else { - /* This *may* be unreachable. To make progress, - * assume it is. gc isn't directly reachable from - * any object we've already traversed, but may be - * reachable from an object we haven't gotten to yet. - * visit_reachable will eventually move gc back into - * young if that's so, and we'll see it again. - */ - next = gc->gc.gc_next; - gc_list_move(gc, unreachable); - gc->gc.gc_refs = GC_TENTATIVELY_UNREACHABLE; - } - gc = next; - } -} - -/* Return true if object has a finalization method. - * CAUTION: An instance of an old-style class has to be checked for a - *__del__ method, and earlier versions of this used to call PyObject_HasAttr, - * which in turn could call the class's __getattr__ hook (if any). That - * could invoke arbitrary Python code, mutating the object graph in arbitrary - * ways, and that was the source of some excruciatingly subtle bugs. - */ -static int -has_finalizer(PyObject *op) -{ - if (PyInstance_Check(op)) { - assert(delstr != NULL); - return _PyInstance_Lookup(op, delstr) != NULL; - } - else if (PyType_HasFeature(op->ob_type, Py_TPFLAGS_HEAPTYPE)) - return op->ob_type->tp_del != NULL; - else if (PyGen_CheckExact(op)) - return PyGen_NeedsFinalizing((PyGenObject *)op); - else - return 0; -} - -/* Try to untrack all currently tracked dictionaries */ -static void -untrack_dicts(PyGC_Head *head) -{ - PyGC_Head *next, *gc = head->gc.gc_next; - while (gc != head) { - PyObject *op = FROM_GC(gc); - next = gc->gc.gc_next; - if (PyDict_CheckExact(op)) - _PyDict_MaybeUntrack(op); - gc = next; - } -} - -/* Move the objects in unreachable with __del__ methods into `finalizers`. - * Objects moved into `finalizers` have gc_refs set to GC_REACHABLE; the - * objects remaining in unreachable are left at GC_TENTATIVELY_UNREACHABLE. - */ -static void -move_finalizers(PyGC_Head *unreachable, PyGC_Head *finalizers) -{ - PyGC_Head *gc; - PyGC_Head *next; - - /* March over unreachable. Move objects with finalizers into - * `finalizers`. - */ - for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) { - PyObject *op = FROM_GC(gc); - - assert(IS_TENTATIVELY_UNREACHABLE(op)); - next = gc->gc.gc_next; - - if (has_finalizer(op)) { - gc_list_move(gc, finalizers); - gc->gc.gc_refs = GC_REACHABLE; - } - } -} - -/* A traversal callback for move_finalizer_reachable. */ -static int -visit_move(PyObject *op, PyGC_Head *tolist) -{ - if (PyObject_IS_GC(op)) { - if (IS_TENTATIVELY_UNREACHABLE(op)) { - PyGC_Head *gc = AS_GC(op); - gc_list_move(gc, tolist); - gc->gc.gc_refs = GC_REACHABLE; - } - } - return 0; -} - -/* Move objects that are reachable from finalizers, from the unreachable set - * into finalizers set. - */ -static void -move_finalizer_reachable(PyGC_Head *finalizers) -{ - traverseproc traverse; - PyGC_Head *gc = finalizers->gc.gc_next; - for (; gc != finalizers; gc = gc->gc.gc_next) { - /* Note that the finalizers list may grow during this. */ - traverse = Py_TYPE(FROM_GC(gc))->tp_traverse; - (void) traverse(FROM_GC(gc), - (visitproc)visit_move, - (void *)finalizers); - } -} - -/* Clear all weakrefs to unreachable objects, and if such a weakref has a - * callback, invoke it if necessary. Note that it's possible for such - * weakrefs to be outside the unreachable set -- indeed, those are precisely - * the weakrefs whose callbacks must be invoked. See gc_weakref.txt for - * overview & some details. Some weakrefs with callbacks may be reclaimed - * directly by this routine; the number reclaimed is the return value. Other - * weakrefs with callbacks may be moved into the `old` generation. Objects - * moved into `old` have gc_refs set to GC_REACHABLE; the objects remaining in - * unreachable are left at GC_TENTATIVELY_UNREACHABLE. When this returns, - * no object in `unreachable` is weakly referenced anymore. - */ -static int -handle_weakrefs(PyGC_Head *unreachable, PyGC_Head *old) -{ - PyGC_Head *gc; - PyObject *op; /* generally FROM_GC(gc) */ - PyWeakReference *wr; /* generally a cast of op */ - PyGC_Head wrcb_to_call; /* weakrefs with callbacks to call */ - PyGC_Head *next; - int num_freed = 0; - - gc_list_init(&wrcb_to_call); - - /* Clear all weakrefs to the objects in unreachable. If such a weakref - * also has a callback, move it into `wrcb_to_call` if the callback - * needs to be invoked. Note that we cannot invoke any callbacks until - * all weakrefs to unreachable objects are cleared, lest the callback - * resurrect an unreachable object via a still-active weakref. We - * make another pass over wrcb_to_call, invoking callbacks, after this - * pass completes. - */ - for (gc = unreachable->gc.gc_next; gc != unreachable; gc = next) { - PyWeakReference **wrlist; - - op = FROM_GC(gc); - assert(IS_TENTATIVELY_UNREACHABLE(op)); - next = gc->gc.gc_next; - - if (! PyType_SUPPORTS_WEAKREFS(Py_TYPE(op))) - continue; - - /* It supports weakrefs. Does it have any? */ - wrlist = (PyWeakReference **) - PyObject_GET_WEAKREFS_LISTPTR(op); - - /* `op` may have some weakrefs. March over the list, clear - * all the weakrefs, and move the weakrefs with callbacks - * that must be called into wrcb_to_call. - */ - for (wr = *wrlist; wr != NULL; wr = *wrlist) { - PyGC_Head *wrasgc; /* AS_GC(wr) */ - - /* _PyWeakref_ClearRef clears the weakref but leaves - * the callback pointer intact. Obscure: it also - * changes *wrlist. - */ - assert(wr->wr_object == op); - _PyWeakref_ClearRef(wr); - assert(wr->wr_object == Py_None); - if (wr->wr_callback == NULL) - continue; /* no callback */ - - /* Headache time. `op` is going away, and is weakly referenced by - * `wr`, which has a callback. Should the callback be invoked? If wr - * is also trash, no: - * - * 1. There's no need to call it. The object and the weakref are - * both going away, so it's legitimate to pretend the weakref is - * going away first. The user has to ensure a weakref outlives its - * referent if they want a guarantee that the wr callback will get - * invoked. - * - * 2. It may be catastrophic to call it. If the callback is also in - * cyclic trash (CT), then although the CT is unreachable from - * outside the current generation, CT may be reachable from the - * callback. Then the callback could resurrect insane objects. - * - * Since the callback is never needed and may be unsafe in this case, - * wr is simply left in the unreachable set. Note that because we - * already called _PyWeakref_ClearRef(wr), its callback will never - * trigger. - * - * OTOH, if wr isn't part of CT, we should invoke the callback: the - * weakref outlived the trash. Note that since wr isn't CT in this - * case, its callback can't be CT either -- wr acted as an external - * root to this generation, and therefore its callback did too. So - * nothing in CT is reachable from the callback either, so it's hard - * to imagine how calling it later could create a problem for us. wr - * is moved to wrcb_to_call in this case. - */ - if (IS_TENTATIVELY_UNREACHABLE(wr)) - continue; - assert(IS_REACHABLE(wr)); - - /* Create a new reference so that wr can't go away - * before we can process it again. - */ - Py_INCREF(wr); - - /* Move wr to wrcb_to_call, for the next pass. */ - wrasgc = AS_GC(wr); - assert(wrasgc != next); /* wrasgc is reachable, but - next isn't, so they can't - be the same */ - gc_list_move(wrasgc, &wrcb_to_call); - } - } - - /* Invoke the callbacks we decided to honor. It's safe to invoke them - * because they can't reference unreachable objects. - */ - while (! gc_list_is_empty(&wrcb_to_call)) { - PyObject *temp; - PyObject *callback; - - gc = wrcb_to_call.gc.gc_next; - op = FROM_GC(gc); - assert(IS_REACHABLE(op)); - assert(PyWeakref_Check(op)); - wr = (PyWeakReference *)op; - callback = wr->wr_callback; - assert(callback != NULL); - - /* copy-paste of weakrefobject.c's handle_callback() */ - temp = PyObject_CallFunctionObjArgs(callback, wr, NULL); - if (temp == NULL) - PyErr_WriteUnraisable(callback); - else - Py_DECREF(temp); - - /* Give up the reference we created in the first pass. When - * op's refcount hits 0 (which it may or may not do right now), - * op's tp_dealloc will decref op->wr_callback too. Note - * that the refcount probably will hit 0 now, and because this - * weakref was reachable to begin with, gc didn't already - * add it to its count of freed objects. Example: a reachable - * weak value dict maps some key to this reachable weakref. - * The callback removes this key->weakref mapping from the - * dict, leaving no other references to the weakref (excepting - * ours). - */ - Py_DECREF(op); - if (wrcb_to_call.gc.gc_next == gc) { - /* object is still alive -- move it */ - gc_list_move(gc, old); - } - else - ++num_freed; - } - - return num_freed; -} - -static void -debug_instance(char *msg, PyInstanceObject *inst) -{ - char *cname; - /* simple version of instance_repr */ - PyObject *classname = inst->in_class->cl_name; - if (classname != NULL && PyString_Check(classname)) - cname = PyString_AsString(classname); - else - cname = "?"; - PySys_WriteStderr("gc: %.100s <%.100s instance at %p>\n", - msg, cname, inst); -} - -static void -debug_cycle(char *msg, PyObject *op) -{ - if ((debug & DEBUG_INSTANCES) && PyInstance_Check(op)) { - debug_instance(msg, (PyInstanceObject *)op); - } - else if (debug & DEBUG_OBJECTS) { - PySys_WriteStderr("gc: %.100s <%.100s %p>\n", - msg, Py_TYPE(op)->tp_name, op); - } -} - -/* Handle uncollectable garbage (cycles with finalizers, and stuff reachable - * only from such cycles). - * If DEBUG_SAVEALL, all objects in finalizers are appended to the module - * garbage list (a Python list), else only the objects in finalizers with - * __del__ methods are appended to garbage. All objects in finalizers are - * merged into the old list regardless. - * Returns 0 if all OK, <0 on error (out of memory to grow the garbage list). - * The finalizers list is made empty on a successful return. - */ -static int -handle_finalizers(PyGC_Head *finalizers, PyGC_Head *old) -{ - PyGC_Head *gc = finalizers->gc.gc_next; - - if (garbage == NULL) { - garbage = PyList_New(0); - if (garbage == NULL) - Py_FatalError("gc couldn't create gc.garbage list"); - } - for (; gc != finalizers; gc = gc->gc.gc_next) { - PyObject *op = FROM_GC(gc); - - if ((debug & DEBUG_SAVEALL) || has_finalizer(op)) { - if (PyList_Append(garbage, op) < 0) - return -1; - } - } - - gc_list_merge(finalizers, old); - return 0; -} - -/* Break reference cycles by clearing the containers involved. This is - * tricky business as the lists can be changing and we don't know which - * objects may be freed. It is possible I screwed something up here. - */ -static void -delete_garbage(PyGC_Head *collectable, PyGC_Head *old) -{ - inquiry clear; - - while (!gc_list_is_empty(collectable)) { - PyGC_Head *gc = collectable->gc.gc_next; - PyObject *op = FROM_GC(gc); - - assert(IS_TENTATIVELY_UNREACHABLE(op)); - if (debug & DEBUG_SAVEALL) { - PyList_Append(garbage, op); - } - else { - if ((clear = Py_TYPE(op)->tp_clear) != NULL) { - Py_INCREF(op); - clear(op); - Py_DECREF(op); - } - } - if (collectable->gc.gc_next == gc) { - /* object is still alive, move it, it may die later */ - gc_list_move(gc, old); - gc->gc.gc_refs = GC_REACHABLE; - } - } -} - -/* Clear all free lists - * All free lists are cleared during the collection of the highest generation. - * Allocated items in the free list may keep a pymalloc arena occupied. - * Clearing the free lists may give back memory to the OS earlier. - */ -static void -clear_freelists(void) -{ - (void)PyMethod_ClearFreeList(); - (void)PyFrame_ClearFreeList(); - (void)PyCFunction_ClearFreeList(); - (void)PyTuple_ClearFreeList(); -#ifdef Py_USING_UNICODE - (void)PyUnicode_ClearFreeList(); -#endif - (void)PyInt_ClearFreeList(); - (void)PyFloat_ClearFreeList(); -} - -static double -get_time(void) -{ - double result = 0; - if (tmod != NULL) { - PyObject *f = PyObject_CallMethod(tmod, "time", NULL); - if (f == NULL) { - PyErr_Clear(); - } - else { - if (PyFloat_Check(f)) - result = PyFloat_AsDouble(f); - Py_DECREF(f); - } - } - return result; -} - -/* This is the main function. Read this to understand how the - * collection process works. */ -static Py_ssize_t -collect(int generation) -{ - int i; - Py_ssize_t m = 0; /* # objects collected */ - Py_ssize_t n = 0; /* # unreachable objects that couldn't be collected */ - PyGC_Head *young; /* the generation we are examining */ - PyGC_Head *old; /* next older generation */ - PyGC_Head unreachable; /* non-problematic unreachable trash */ - PyGC_Head finalizers; /* objects with, & reachable from, __del__ */ - PyGC_Head *gc; - double t1 = 0.0; - - if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); - if (delstr == NULL) - Py_FatalError("gc couldn't allocate \"__del__\""); - } - - if (debug & DEBUG_STATS) { - PySys_WriteStderr("gc: collecting generation %d...\n", - generation); - PySys_WriteStderr("gc: objects in each generation:"); - for (i = 0; i < NUM_GENERATIONS; i++) - PySys_WriteStderr(" %" PY_FORMAT_SIZE_T "d", - gc_list_size(GEN_HEAD(i))); - t1 = get_time(); - PySys_WriteStderr("\n"); - } - - /* update collection and allocation counters */ - if (generation+1 < NUM_GENERATIONS) - generations[generation+1].count += 1; - for (i = 0; i <= generation; i++) - generations[i].count = 0; - - /* merge younger generations with one we are currently collecting */ - for (i = 0; i < generation; i++) { - gc_list_merge(GEN_HEAD(i), GEN_HEAD(generation)); - } - - /* handy references */ - young = GEN_HEAD(generation); - if (generation < NUM_GENERATIONS-1) - old = GEN_HEAD(generation+1); - else - old = young; - - /* Using ob_refcnt and gc_refs, calculate which objects in the - * container set are reachable from outside the set (i.e., have a - * refcount greater than 0 when all the references within the - * set are taken into account). - */ - update_refs(young); - subtract_refs(young); - - /* Leave everything reachable from outside young in young, and move - * everything else (in young) to unreachable. - * NOTE: This used to move the reachable objects into a reachable - * set instead. But most things usually turn out to be reachable, - * so it's more efficient to move the unreachable things. - */ - gc_list_init(&unreachable); - move_unreachable(young, &unreachable); - - /* Move reachable objects to next generation. */ - if (young != old) { - if (generation == NUM_GENERATIONS - 2) { - long_lived_pending += gc_list_size(young); - } - gc_list_merge(young, old); - } - else { - /* We only untrack dicts in full collections, to avoid quadratic - dict build-up. See issue #14775. */ - untrack_dicts(young); - long_lived_pending = 0; - long_lived_total = gc_list_size(young); - } - - /* All objects in unreachable are trash, but objects reachable from - * finalizers can't safely be deleted. Python programmers should take - * care not to create such things. For Python, finalizers means - * instance objects with __del__ methods. Weakrefs with callbacks - * can also call arbitrary Python code but they will be dealt with by - * handle_weakrefs(). - */ - gc_list_init(&finalizers); - move_finalizers(&unreachable, &finalizers); - /* finalizers contains the unreachable objects with a finalizer; - * unreachable objects reachable *from* those are also uncollectable, - * and we move those into the finalizers list too. - */ - move_finalizer_reachable(&finalizers); - - /* Collect statistics on collectable objects found and print - * debugging information. - */ - for (gc = unreachable.gc.gc_next; gc != &unreachable; - gc = gc->gc.gc_next) { - m++; - if (debug & DEBUG_COLLECTABLE) { - debug_cycle("collectable", FROM_GC(gc)); - } - } - - /* Clear weakrefs and invoke callbacks as necessary. */ - m += handle_weakrefs(&unreachable, old); - - /* Call tp_clear on objects in the unreachable set. This will cause - * the reference cycles to be broken. It may also cause some objects - * in finalizers to be freed. - */ - delete_garbage(&unreachable, old); - - /* Collect statistics on uncollectable objects found and print - * debugging information. */ - for (gc = finalizers.gc.gc_next; - gc != &finalizers; - gc = gc->gc.gc_next) { - n++; - if (debug & DEBUG_UNCOLLECTABLE) - debug_cycle("uncollectable", FROM_GC(gc)); - } - if (debug & DEBUG_STATS) { - double t2 = get_time(); - if (m == 0 && n == 0) - PySys_WriteStderr("gc: done"); - else - PySys_WriteStderr( - "gc: done, " - "%" PY_FORMAT_SIZE_T "d unreachable, " - "%" PY_FORMAT_SIZE_T "d uncollectable", - n+m, n); - if (t1 && t2) { - PySys_WriteStderr(", %.4fs elapsed", t2-t1); - } - PySys_WriteStderr(".\n"); - } - - /* Append instances in the uncollectable set to a Python - * reachable list of garbage. The programmer has to deal with - * this if they insist on creating this type of structure. - */ - (void)handle_finalizers(&finalizers, old); - - /* Clear free list only during the collection of the highest - * generation */ - if (generation == NUM_GENERATIONS-1) { - clear_freelists(); - } - - if (PyErr_Occurred()) { - if (gc_str == NULL) - gc_str = PyString_FromString("garbage collection"); - PyErr_WriteUnraisable(gc_str); - Py_FatalError("unexpected exception during garbage collection"); - } - return n+m; -} - -static Py_ssize_t -collect_generations(void) -{ - int i; - Py_ssize_t n = 0; - - /* Find the oldest generation (highest numbered) where the count - * exceeds the threshold. Objects in the that generation and - * generations younger than it will be collected. */ - for (i = NUM_GENERATIONS-1; i >= 0; i--) { - if (generations[i].count > generations[i].threshold) { - /* Avoid quadratic performance degradation in number - of tracked objects. See comments at the beginning - of this file, and issue #4074. - */ - if (i == NUM_GENERATIONS - 1 - && long_lived_pending < long_lived_total / 4) - continue; - n = collect(i); - break; - } - } - return n; -} - -PyDoc_STRVAR(gc_enable__doc__, -"enable() -> None\n" -"\n" -"Enable automatic garbage collection.\n"); - -static PyObject * -gc_enable(PyObject *self, PyObject *noargs) -{ - enabled = 1; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(gc_disable__doc__, -"disable() -> None\n" -"\n" -"Disable automatic garbage collection.\n"); - -static PyObject * -gc_disable(PyObject *self, PyObject *noargs) -{ - enabled = 0; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(gc_isenabled__doc__, -"isenabled() -> status\n" -"\n" -"Returns true if automatic garbage collection is enabled.\n"); - -static PyObject * -gc_isenabled(PyObject *self, PyObject *noargs) -{ - return PyBool_FromLong((long)enabled); -} - -PyDoc_STRVAR(gc_collect__doc__, -"collect([generation]) -> n\n" -"\n" -"With no arguments, run a full collection. The optional argument\n" -"may be an integer specifying which generation to collect. A ValueError\n" -"is raised if the generation number is invalid.\n\n" -"The number of unreachable objects is returned.\n"); - -static PyObject * -gc_collect(PyObject *self, PyObject *args, PyObject *kws) -{ - static char *keywords[] = {"generation", NULL}; - int genarg = NUM_GENERATIONS - 1; - Py_ssize_t n; - - if (!PyArg_ParseTupleAndKeywords(args, kws, "|i", keywords, &genarg)) - return NULL; - - else if (genarg < 0 || genarg >= NUM_GENERATIONS) { - PyErr_SetString(PyExc_ValueError, "invalid generation"); - return NULL; - } - - if (collecting) - n = 0; /* already collecting, don't do anything */ - else { - collecting = 1; - n = collect(genarg); - collecting = 0; - } - - return PyInt_FromSsize_t(n); -} - -PyDoc_STRVAR(gc_set_debug__doc__, -"set_debug(flags) -> None\n" -"\n" -"Set the garbage collection debugging flags. Debugging information is\n" -"written to sys.stderr.\n" -"\n" -"flags is an integer and can have the following bits turned on:\n" -"\n" -" DEBUG_STATS - Print statistics during collection.\n" -" DEBUG_COLLECTABLE - Print collectable objects found.\n" -" DEBUG_UNCOLLECTABLE - Print unreachable but uncollectable objects found.\n" -" DEBUG_INSTANCES - Print instance objects.\n" -" DEBUG_OBJECTS - Print objects other than instances.\n" -" DEBUG_SAVEALL - Save objects to gc.garbage rather than freeing them.\n" -" DEBUG_LEAK - Debug leaking programs (everything but STATS).\n"); - -static PyObject * -gc_set_debug(PyObject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, "i:set_debug", &debug)) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(gc_get_debug__doc__, -"get_debug() -> flags\n" -"\n" -"Get the garbage collection debugging flags.\n"); - -static PyObject * -gc_get_debug(PyObject *self, PyObject *noargs) -{ - return Py_BuildValue("i", debug); -} - -PyDoc_STRVAR(gc_set_thresh__doc__, -"set_threshold(threshold0, [threshold1, threshold2]) -> None\n" -"\n" -"Sets the collection thresholds. Setting threshold0 to zero disables\n" -"collection.\n"); - -static PyObject * -gc_set_thresh(PyObject *self, PyObject *args) -{ - int i; - if (!PyArg_ParseTuple(args, "i|ii:set_threshold", - &generations[0].threshold, - &generations[1].threshold, - &generations[2].threshold)) - return NULL; - for (i = 2; i < NUM_GENERATIONS; i++) { - /* generations higher than 2 get the same threshold */ - generations[i].threshold = generations[2].threshold; - } - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(gc_get_thresh__doc__, -"get_threshold() -> (threshold0, threshold1, threshold2)\n" -"\n" -"Return the current collection thresholds\n"); - -static PyObject * -gc_get_thresh(PyObject *self, PyObject *noargs) -{ - return Py_BuildValue("(iii)", - generations[0].threshold, - generations[1].threshold, - generations[2].threshold); -} - -PyDoc_STRVAR(gc_get_count__doc__, -"get_count() -> (count0, count1, count2)\n" -"\n" -"Return the current collection counts\n"); - -static PyObject * -gc_get_count(PyObject *self, PyObject *noargs) -{ - return Py_BuildValue("(iii)", - generations[0].count, - generations[1].count, - generations[2].count); -} - -static int -referrersvisit(PyObject* obj, PyObject *objs) -{ - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(objs); i++) - if (PyTuple_GET_ITEM(objs, i) == obj) - return 1; - return 0; -} - -static int -gc_referrers_for(PyObject *objs, PyGC_Head *list, PyObject *resultlist) -{ - PyGC_Head *gc; - PyObject *obj; - traverseproc traverse; - for (gc = list->gc.gc_next; gc != list; gc = gc->gc.gc_next) { - obj = FROM_GC(gc); - traverse = Py_TYPE(obj)->tp_traverse; - if (obj == objs || obj == resultlist) - continue; - if (traverse(obj, (visitproc)referrersvisit, objs)) { - if (PyList_Append(resultlist, obj) < 0) - return 0; /* error */ - } - } - return 1; /* no error */ -} - -PyDoc_STRVAR(gc_get_referrers__doc__, -"get_referrers(*objs) -> list\n\ -Return the list of objects that directly refer to any of objs."); - -static PyObject * -gc_get_referrers(PyObject *self, PyObject *args) -{ - int i; - PyObject *result = PyList_New(0); - if (!result) return NULL; - - for (i = 0; i < NUM_GENERATIONS; i++) { - if (!(gc_referrers_for(args, GEN_HEAD(i), result))) { - Py_DECREF(result); - return NULL; - } - } - return result; -} - -/* Append obj to list; return true if error (out of memory), false if OK. */ -static int -referentsvisit(PyObject *obj, PyObject *list) -{ - return PyList_Append(list, obj) < 0; -} - -PyDoc_STRVAR(gc_get_referents__doc__, -"get_referents(*objs) -> list\n\ -Return the list of objects that are directly referred to by objs."); - -static PyObject * -gc_get_referents(PyObject *self, PyObject *args) -{ - Py_ssize_t i; - PyObject *result = PyList_New(0); - - if (result == NULL) - return NULL; - - for (i = 0; i < PyTuple_GET_SIZE(args); i++) { - traverseproc traverse; - PyObject *obj = PyTuple_GET_ITEM(args, i); - - if (! PyObject_IS_GC(obj)) - continue; - traverse = Py_TYPE(obj)->tp_traverse; - if (! traverse) - continue; - if (traverse(obj, (visitproc)referentsvisit, result)) { - Py_DECREF(result); - return NULL; - } - } - return result; -} - -PyDoc_STRVAR(gc_get_objects__doc__, -"get_objects() -> [...]\n" -"\n" -"Return a list of objects tracked by the collector (excluding the list\n" -"returned).\n"); - -static PyObject * -gc_get_objects(PyObject *self, PyObject *noargs) -{ - int i; - PyObject* result; - - result = PyList_New(0); - if (result == NULL) - return NULL; - for (i = 0; i < NUM_GENERATIONS; i++) { - if (append_objects(result, GEN_HEAD(i))) { - Py_DECREF(result); - return NULL; - } - } - return result; -} - -PyDoc_STRVAR(gc_is_tracked__doc__, -"is_tracked(obj) -> bool\n" -"\n" -"Returns true if the object is tracked by the garbage collector.\n" -"Simple atomic objects will return false.\n" -); - -static PyObject * -gc_is_tracked(PyObject *self, PyObject *obj) -{ - PyObject *result; - - if (PyObject_IS_GC(obj) && IS_TRACKED(obj)) - result = Py_True; - else - result = Py_False; - Py_INCREF(result); - return result; -} - - -PyDoc_STRVAR(gc__doc__, -"This module provides access to the garbage collector for reference cycles.\n" -"\n" -"enable() -- Enable automatic garbage collection.\n" -"disable() -- Disable automatic garbage collection.\n" -"isenabled() -- Returns true if automatic collection is enabled.\n" -"collect() -- Do a full collection right now.\n" -"get_count() -- Return the current collection counts.\n" -"set_debug() -- Set debugging flags.\n" -"get_debug() -- Get debugging flags.\n" -"set_threshold() -- Set the collection thresholds.\n" -"get_threshold() -- Return the current the collection thresholds.\n" -"get_objects() -- Return a list of all objects tracked by the collector.\n" -"is_tracked() -- Returns true if a given object is tracked.\n" -"get_referrers() -- Return the list of objects that refer to an object.\n" -"get_referents() -- Return the list of objects that an object refers to.\n"); - -static PyMethodDef GcMethods[] = { - {"enable", gc_enable, METH_NOARGS, gc_enable__doc__}, - {"disable", gc_disable, METH_NOARGS, gc_disable__doc__}, - {"isenabled", gc_isenabled, METH_NOARGS, gc_isenabled__doc__}, - {"set_debug", gc_set_debug, METH_VARARGS, gc_set_debug__doc__}, - {"get_debug", gc_get_debug, METH_NOARGS, gc_get_debug__doc__}, - {"get_count", gc_get_count, METH_NOARGS, gc_get_count__doc__}, - {"set_threshold", gc_set_thresh, METH_VARARGS, gc_set_thresh__doc__}, - {"get_threshold", gc_get_thresh, METH_NOARGS, gc_get_thresh__doc__}, - {"collect", (PyCFunction)gc_collect, - METH_VARARGS | METH_KEYWORDS, gc_collect__doc__}, - {"get_objects", gc_get_objects,METH_NOARGS, gc_get_objects__doc__}, - {"is_tracked", gc_is_tracked, METH_O, gc_is_tracked__doc__}, - {"get_referrers", gc_get_referrers, METH_VARARGS, - gc_get_referrers__doc__}, - {"get_referents", gc_get_referents, METH_VARARGS, - gc_get_referents__doc__}, - {NULL, NULL} /* Sentinel */ -}; - -PyMODINIT_FUNC -initgc(void) -{ - PyObject *m; - - m = Py_InitModule4("gc", - GcMethods, - gc__doc__, - NULL, - PYTHON_API_VERSION); - if (m == NULL) - return; - - if (garbage == NULL) { - garbage = PyList_New(0); - if (garbage == NULL) - return; - } - Py_INCREF(garbage); - if (PyModule_AddObject(m, "garbage", garbage) < 0) - return; - - /* Importing can't be done in collect() because collect() - * can be called via PyGC_Collect() in Py_Finalize(). - * This wouldn't be a problem, except that is - * reset to 0 before calling collect which trips up - * the import and triggers an assertion. - */ - if (tmod == NULL) { - tmod = PyImport_ImportModuleNoBlock("time"); - if (tmod == NULL) - PyErr_Clear(); - } - -#define ADD_INT(NAME) if (PyModule_AddIntConstant(m, #NAME, NAME) < 0) return - ADD_INT(DEBUG_STATS); - ADD_INT(DEBUG_COLLECTABLE); - ADD_INT(DEBUG_UNCOLLECTABLE); - ADD_INT(DEBUG_INSTANCES); - ADD_INT(DEBUG_OBJECTS); - ADD_INT(DEBUG_SAVEALL); - ADD_INT(DEBUG_LEAK); -#undef ADD_INT -} - -/* API to invoke gc.collect() from C */ -Py_ssize_t -PyGC_Collect(void) -{ - Py_ssize_t n; - - if (collecting) - n = 0; /* already collecting, don't do anything */ - else { - collecting = 1; - n = collect(NUM_GENERATIONS - 1); - collecting = 0; - } - - return n; -} - -/* for debugging */ -void -_PyGC_Dump(PyGC_Head *g) -{ - _PyObject_Dump(FROM_GC(g)); -} - -/* extension modules might be compiled with GC support so these - functions must always be available */ - -#undef PyObject_GC_Track -#undef PyObject_GC_UnTrack -#undef PyObject_GC_Del -#undef _PyObject_GC_Malloc - -void -PyObject_GC_Track(void *op) -{ - _PyObject_GC_TRACK(op); -} - -/* for binary compatibility with 2.2 */ -void -_PyObject_GC_Track(PyObject *op) -{ - PyObject_GC_Track(op); -} - -void -PyObject_GC_UnTrack(void *op) -{ - /* Obscure: the Py_TRASHCAN mechanism requires that we be able to - * call PyObject_GC_UnTrack twice on an object. - */ - if (IS_TRACKED(op)) - _PyObject_GC_UNTRACK(op); -} - -/* for binary compatibility with 2.2 */ -void -_PyObject_GC_UnTrack(PyObject *op) -{ - PyObject_GC_UnTrack(op); -} - -PyObject * -_PyObject_GC_Malloc(size_t basicsize) -{ - PyObject *op; - PyGC_Head *g; - if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head)) - return PyErr_NoMemory(); - g = (PyGC_Head *)PyObject_MALLOC( - sizeof(PyGC_Head) + basicsize); - if (g == NULL) - return PyErr_NoMemory(); - g->gc.gc_refs = GC_UNTRACKED; - generations[0].count++; /* number of allocated GC objects */ - if (generations[0].count > generations[0].threshold && - enabled && - generations[0].threshold && - !collecting && - !PyErr_Occurred()) { - collecting = 1; - collect_generations(); - collecting = 0; - } - op = FROM_GC(g); - return op; -} - -PyObject * -_PyObject_GC_New(PyTypeObject *tp) -{ - PyObject *op = _PyObject_GC_Malloc(_PyObject_SIZE(tp)); - if (op != NULL) - op = PyObject_INIT(op, tp); - return op; -} - -PyVarObject * -_PyObject_GC_NewVar(PyTypeObject *tp, Py_ssize_t nitems) -{ - const size_t size = _PyObject_VAR_SIZE(tp, nitems); - PyVarObject *op = (PyVarObject *) _PyObject_GC_Malloc(size); - if (op != NULL) - op = PyObject_INIT_VAR(op, tp, nitems); - return op; -} - -PyVarObject * -_PyObject_GC_Resize(PyVarObject *op, Py_ssize_t nitems) -{ - const size_t basicsize = _PyObject_VAR_SIZE(Py_TYPE(op), nitems); - PyGC_Head *g = AS_GC(op); - if (basicsize > PY_SSIZE_T_MAX - sizeof(PyGC_Head)) - return (PyVarObject *)PyErr_NoMemory(); - g = (PyGC_Head *)PyObject_REALLOC(g, sizeof(PyGC_Head) + basicsize); - if (g == NULL) - return (PyVarObject *)PyErr_NoMemory(); - op = (PyVarObject *) FROM_GC(g); - Py_SIZE(op) = nitems; - return op; -} - -void -PyObject_GC_Del(void *op) -{ - PyGC_Head *g = AS_GC(op); - if (IS_TRACKED(op)) - gc_list_remove(g); - if (generations[0].count > 0) { - generations[0].count--; - } - PyObject_FREE(g); -} - -/* for binary compatibility with 2.2 */ -#undef _PyObject_GC_Del -void -_PyObject_GC_Del(PyObject *op) -{ - PyObject_GC_Del(op); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/getbuildinfo.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/getbuildinfo.c deleted file mode 100644 index d2529b3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/getbuildinfo.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "Python.h" - -#ifndef DONT_HAVE_STDIO_H -#include -#endif - -#ifndef DATE -#ifdef __DATE__ -#define DATE __DATE__ -#else -#define DATE "xx/xx/xx" -#endif -#endif - -#ifndef TIME -#ifdef __TIME__ -#define TIME __TIME__ -#else -#define TIME "xx:xx:xx" -#endif -#endif - -/* on unix, SVNVERSION is passed on the command line. - * on Windows, the string is interpolated using - * subwcrev.exe - */ -#ifndef SVNVERSION -#define SVNVERSION "$WCRANGE$$WCMODS?M:$" -#endif - -/* XXX Only unix build process has been tested */ -#ifndef HGVERSION -#define HGVERSION "" -#endif -#ifndef HGTAG -#define HGTAG "" -#endif -#ifndef HGBRANCH -#define HGBRANCH "" -#endif - -const char * -Py_GetBuildInfo(void) -{ - static char buildinfo[50 + sizeof(HGVERSION) + - ((sizeof(HGTAG) > sizeof(HGBRANCH)) ? - sizeof(HGTAG) : sizeof(HGBRANCH))]; - const char *revision = _Py_hgversion(); - const char *sep = *revision ? ":" : ""; - const char *hgid = _Py_hgidentifier(); - if (!(*hgid)) - hgid = "default"; - PyOS_snprintf(buildinfo, sizeof(buildinfo), - "%s%s%s, %.20s, %.9s", hgid, sep, revision, - DATE, TIME); - return buildinfo; -} - -const char * -_Py_svnversion(void) -{ - /* the following string can be modified by subwcrev.exe */ - static const char svnversion[] = SVNVERSION; - if (svnversion[0] != '$') - return svnversion; /* it was interpolated, or passed on command line */ - return "Unversioned directory"; -} - -const char * -_Py_hgversion(void) -{ - return HGVERSION; -} - -const char * -_Py_hgidentifier(void) -{ - const char *hgtag, *hgid; - hgtag = HGTAG; - if ((*hgtag) && strcmp(hgtag, "tip") != 0) - hgid = hgtag; - else - hgid = HGBRANCH; - return hgid; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/itertoolsmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/itertoolsmodule.c deleted file mode 100644 index 0279a72..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/itertoolsmodule.c +++ /dev/null @@ -1,4143 +0,0 @@ - -#include "Python.h" -#include "structmember.h" - -/* Itertools module written and maintained - by Raymond D. Hettinger - Copyright (c) 2003 Python Software Foundation. - All rights reserved. -*/ - - -/* groupby object ***********************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *it; - PyObject *keyfunc; - PyObject *tgtkey; - PyObject *currkey; - PyObject *currvalue; -} groupbyobject; - -static PyTypeObject groupby_type; -static PyObject *_grouper_create(groupbyobject *, PyObject *); - -static PyObject * -groupby_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - static char *kwargs[] = {"iterable", "key", NULL}; - groupbyobject *gbo; - PyObject *it, *keyfunc = Py_None; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:groupby", kwargs, - &it, &keyfunc)) - return NULL; - - gbo = (groupbyobject *)type->tp_alloc(type, 0); - if (gbo == NULL) - return NULL; - gbo->tgtkey = NULL; - gbo->currkey = NULL; - gbo->currvalue = NULL; - gbo->keyfunc = keyfunc; - Py_INCREF(keyfunc); - gbo->it = PyObject_GetIter(it); - if (gbo->it == NULL) { - Py_DECREF(gbo); - return NULL; - } - return (PyObject *)gbo; -} - -static void -groupby_dealloc(groupbyobject *gbo) -{ - PyObject_GC_UnTrack(gbo); - Py_XDECREF(gbo->it); - Py_XDECREF(gbo->keyfunc); - Py_XDECREF(gbo->tgtkey); - Py_XDECREF(gbo->currkey); - Py_XDECREF(gbo->currvalue); - Py_TYPE(gbo)->tp_free(gbo); -} - -static int -groupby_traverse(groupbyobject *gbo, visitproc visit, void *arg) -{ - Py_VISIT(gbo->it); - Py_VISIT(gbo->keyfunc); - Py_VISIT(gbo->tgtkey); - Py_VISIT(gbo->currkey); - Py_VISIT(gbo->currvalue); - return 0; -} - -static PyObject * -groupby_next(groupbyobject *gbo) -{ - PyObject *newvalue, *newkey, *r, *grouper, *tmp; - - /* skip to next iteration group */ - for (;;) { - if (gbo->currkey == NULL) - /* pass */; - else if (gbo->tgtkey == NULL) - break; - else { - int rcmp; - - rcmp = PyObject_RichCompareBool(gbo->tgtkey, - gbo->currkey, Py_EQ); - if (rcmp == -1) - return NULL; - else if (rcmp == 0) - break; - } - - newvalue = PyIter_Next(gbo->it); - if (newvalue == NULL) - return NULL; - - if (gbo->keyfunc == Py_None) { - newkey = newvalue; - Py_INCREF(newvalue); - } else { - newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, - newvalue, NULL); - if (newkey == NULL) { - Py_DECREF(newvalue); - return NULL; - } - } - - tmp = gbo->currkey; - gbo->currkey = newkey; - Py_XDECREF(tmp); - - tmp = gbo->currvalue; - gbo->currvalue = newvalue; - Py_XDECREF(tmp); - } - - Py_INCREF(gbo->currkey); - tmp = gbo->tgtkey; - gbo->tgtkey = gbo->currkey; - Py_XDECREF(tmp); - - grouper = _grouper_create(gbo, gbo->tgtkey); - if (grouper == NULL) - return NULL; - - r = PyTuple_Pack(2, gbo->currkey, grouper); - Py_DECREF(grouper); - return r; -} - -PyDoc_STRVAR(groupby_doc, -"groupby(iterable[, keyfunc]) -> create an iterator which returns\n\ -(key, sub-iterator) grouped by each value of key(value).\n"); - -static PyTypeObject groupby_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.groupby", /* tp_name */ - sizeof(groupbyobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)groupby_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - groupby_doc, /* tp_doc */ - (traverseproc)groupby_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)groupby_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - groupby_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* _grouper object (internal) ************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *parent; - PyObject *tgtkey; -} _grouperobject; - -static PyTypeObject _grouper_type; - -static PyObject * -_grouper_create(groupbyobject *parent, PyObject *tgtkey) -{ - _grouperobject *igo; - - igo = PyObject_GC_New(_grouperobject, &_grouper_type); - if (igo == NULL) - return NULL; - igo->parent = (PyObject *)parent; - Py_INCREF(parent); - igo->tgtkey = tgtkey; - Py_INCREF(tgtkey); - - PyObject_GC_Track(igo); - return (PyObject *)igo; -} - -static void -_grouper_dealloc(_grouperobject *igo) -{ - PyObject_GC_UnTrack(igo); - Py_DECREF(igo->parent); - Py_DECREF(igo->tgtkey); - PyObject_GC_Del(igo); -} - -static int -_grouper_traverse(_grouperobject *igo, visitproc visit, void *arg) -{ - Py_VISIT(igo->parent); - Py_VISIT(igo->tgtkey); - return 0; -} - -static PyObject * -_grouper_next(_grouperobject *igo) -{ - groupbyobject *gbo = (groupbyobject *)igo->parent; - PyObject *newvalue, *newkey, *r; - int rcmp; - - if (gbo->currvalue == NULL) { - newvalue = PyIter_Next(gbo->it); - if (newvalue == NULL) - return NULL; - - if (gbo->keyfunc == Py_None) { - newkey = newvalue; - Py_INCREF(newvalue); - } else { - newkey = PyObject_CallFunctionObjArgs(gbo->keyfunc, - newvalue, NULL); - if (newkey == NULL) { - Py_DECREF(newvalue); - return NULL; - } - } - - assert(gbo->currkey == NULL); - gbo->currkey = newkey; - gbo->currvalue = newvalue; - } - - assert(gbo->currkey != NULL); - rcmp = PyObject_RichCompareBool(igo->tgtkey, gbo->currkey, Py_EQ); - if (rcmp <= 0) - /* got any error or current group is end */ - return NULL; - - r = gbo->currvalue; - gbo->currvalue = NULL; - Py_CLEAR(gbo->currkey); - - return r; -} - -static PyTypeObject _grouper_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools._grouper", /* tp_name */ - sizeof(_grouperobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)_grouper_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)_grouper_traverse,/* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)_grouper_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - - -/* tee object and with supporting function and objects ***************/ - -/* The teedataobject pre-allocates space for LINKCELLS number of objects. - To help the object fit neatly inside cache lines (space for 16 to 32 - pointers), the value should be a multiple of 16 minus space for - the other structure members including PyHEAD overhead. The larger the - value, the less memory overhead per object and the less time spent - allocating/deallocating new links. The smaller the number, the less - wasted space and the more rapid freeing of older data. -*/ -#define LINKCELLS 57 - -typedef struct { - PyObject_HEAD - PyObject *it; - int numread; - PyObject *nextlink; - PyObject *(values[LINKCELLS]); -} teedataobject; - -typedef struct { - PyObject_HEAD - teedataobject *dataobj; - int index; - PyObject *weakreflist; -} teeobject; - -static PyTypeObject teedataobject_type; - -static PyObject * -teedataobject_new(PyObject *it) -{ - teedataobject *tdo; - - tdo = PyObject_GC_New(teedataobject, &teedataobject_type); - if (tdo == NULL) - return NULL; - - tdo->numread = 0; - tdo->nextlink = NULL; - Py_INCREF(it); - tdo->it = it; - PyObject_GC_Track(tdo); - return (PyObject *)tdo; -} - -static PyObject * -teedataobject_jumplink(teedataobject *tdo) -{ - if (tdo->nextlink == NULL) - tdo->nextlink = teedataobject_new(tdo->it); - Py_XINCREF(tdo->nextlink); - return tdo->nextlink; -} - -static PyObject * -teedataobject_getitem(teedataobject *tdo, int i) -{ - PyObject *value; - - assert(i < LINKCELLS); - if (i < tdo->numread) - value = tdo->values[i]; - else { - /* this is the lead iterator, so fetch more data */ - assert(i == tdo->numread); - value = PyIter_Next(tdo->it); - if (value == NULL) - return NULL; - tdo->numread++; - tdo->values[i] = value; - } - Py_INCREF(value); - return value; -} - -static int -teedataobject_traverse(teedataobject *tdo, visitproc visit, void * arg) -{ - int i; - Py_VISIT(tdo->it); - for (i = 0; i < tdo->numread; i++) - Py_VISIT(tdo->values[i]); - Py_VISIT(tdo->nextlink); - return 0; -} - -static void -teedataobject_safe_decref(PyObject *obj) -{ - while (obj && Py_TYPE(obj) == &teedataobject_type && - Py_REFCNT(obj) == 1) { - PyObject *nextlink = ((teedataobject *)obj)->nextlink; - ((teedataobject *)obj)->nextlink = NULL; - Py_DECREF(obj); - obj = nextlink; - } - Py_XDECREF(obj); -} - -static int -teedataobject_clear(teedataobject *tdo) -{ - int i; - PyObject *tmp; - - Py_CLEAR(tdo->it); - for (i=0 ; inumread ; i++) - Py_CLEAR(tdo->values[i]); - tmp = tdo->nextlink; - tdo->nextlink = NULL; - teedataobject_safe_decref(tmp); - return 0; -} - -static void -teedataobject_dealloc(teedataobject *tdo) -{ - PyObject_GC_UnTrack(tdo); - teedataobject_clear(tdo); - PyObject_GC_Del(tdo); -} - -PyDoc_STRVAR(teedataobject_doc, "Data container common to multiple tee objects."); - -static PyTypeObject teedataobject_type = { - PyVarObject_HEAD_INIT(0, 0) /* Must fill in type value later */ - "itertools.tee_dataobject", /* tp_name */ - sizeof(teedataobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)teedataobject_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - teedataobject_doc, /* tp_doc */ - (traverseproc)teedataobject_traverse, /* tp_traverse */ - (inquiry)teedataobject_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -static PyTypeObject tee_type; - -static PyObject * -tee_next(teeobject *to) -{ - PyObject *value, *link; - - if (to->index >= LINKCELLS) { - link = teedataobject_jumplink(to->dataobj); - if (link == NULL) - return NULL; - Py_DECREF(to->dataobj); - to->dataobj = (teedataobject *)link; - to->index = 0; - } - value = teedataobject_getitem(to->dataobj, to->index); - if (value == NULL) - return NULL; - to->index++; - return value; -} - -static int -tee_traverse(teeobject *to, visitproc visit, void *arg) -{ - Py_VISIT((PyObject *)to->dataobj); - return 0; -} - -static PyObject * -tee_copy(teeobject *to) -{ - teeobject *newto; - - newto = PyObject_GC_New(teeobject, &tee_type); - if (newto == NULL) - return NULL; - Py_INCREF(to->dataobj); - newto->dataobj = to->dataobj; - newto->index = to->index; - newto->weakreflist = NULL; - PyObject_GC_Track(newto); - return (PyObject *)newto; -} - -PyDoc_STRVAR(teecopy_doc, "Returns an independent iterator."); - -static PyObject * -tee_fromiterable(PyObject *iterable) -{ - teeobject *to; - PyObject *it = NULL; - - it = PyObject_GetIter(iterable); - if (it == NULL) - return NULL; - if (PyObject_TypeCheck(it, &tee_type)) { - to = (teeobject *)tee_copy((teeobject *)it); - goto done; - } - - to = PyObject_GC_New(teeobject, &tee_type); - if (to == NULL) - goto done; - to->dataobj = (teedataobject *)teedataobject_new(it); - if (!to->dataobj) { - PyObject_GC_Del(to); - to = NULL; - goto done; - } - - to->index = 0; - to->weakreflist = NULL; - PyObject_GC_Track(to); -done: - Py_XDECREF(it); - return (PyObject *)to; -} - -static PyObject * -tee_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *iterable; - - if (!PyArg_UnpackTuple(args, "tee", 1, 1, &iterable)) - return NULL; - return tee_fromiterable(iterable); -} - -static int -tee_clear(teeobject *to) -{ - if (to->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) to); - Py_CLEAR(to->dataobj); - return 0; -} - -static void -tee_dealloc(teeobject *to) -{ - PyObject_GC_UnTrack(to); - tee_clear(to); - PyObject_GC_Del(to); -} - -PyDoc_STRVAR(teeobject_doc, -"Iterator wrapped to make it copyable"); - -static PyMethodDef tee_methods[] = { - {"__copy__", (PyCFunction)tee_copy, METH_NOARGS, teecopy_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject tee_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.tee", /* tp_name */ - sizeof(teeobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)tee_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - teeobject_doc, /* tp_doc */ - (traverseproc)tee_traverse, /* tp_traverse */ - (inquiry)tee_clear, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(teeobject, weakreflist), /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)tee_next, /* tp_iternext */ - tee_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - tee_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -static PyObject * -tee(PyObject *self, PyObject *args) -{ - Py_ssize_t i, n=2; - PyObject *it, *iterable, *copyable, *result; - - if (!PyArg_ParseTuple(args, "O|n", &iterable, &n)) - return NULL; - if (n < 0) { - PyErr_SetString(PyExc_ValueError, "n must be >= 0"); - return NULL; - } - result = PyTuple_New(n); - if (result == NULL) - return NULL; - if (n == 0) - return result; - it = PyObject_GetIter(iterable); - if (it == NULL) { - Py_DECREF(result); - return NULL; - } - if (!PyObject_HasAttrString(it, "__copy__")) { - copyable = tee_fromiterable(it); - Py_DECREF(it); - if (copyable == NULL) { - Py_DECREF(result); - return NULL; - } - } else - copyable = it; - PyTuple_SET_ITEM(result, 0, copyable); - for (i=1 ; i tuple of n independent iterators."); - - -/* cycle object **********************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *it; - PyObject *saved; - int firstpass; -} cycleobject; - -static PyTypeObject cycle_type; - -static PyObject * -cycle_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *it; - PyObject *iterable; - PyObject *saved; - cycleobject *lz; - - if (type == &cycle_type && !_PyArg_NoKeywords("cycle()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "cycle", 1, 1, &iterable)) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(iterable); - if (it == NULL) - return NULL; - - saved = PyList_New(0); - if (saved == NULL) { - Py_DECREF(it); - return NULL; - } - - /* create cycleobject structure */ - lz = (cycleobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - Py_DECREF(saved); - return NULL; - } - lz->it = it; - lz->saved = saved; - lz->firstpass = 0; - - return (PyObject *)lz; -} - -static void -cycle_dealloc(cycleobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->saved); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -cycle_traverse(cycleobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - Py_VISIT(lz->saved); - return 0; -} - -static PyObject * -cycle_next(cycleobject *lz) -{ - PyObject *item; - PyObject *it; - PyObject *tmp; - - while (1) { - item = PyIter_Next(lz->it); - if (item != NULL) { - if (!lz->firstpass && PyList_Append(lz->saved, item)) { - Py_DECREF(item); - return NULL; - } - return item; - } - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - else - return NULL; - } - if (PyList_Size(lz->saved) == 0) - return NULL; - it = PyObject_GetIter(lz->saved); - if (it == NULL) - return NULL; - tmp = lz->it; - lz->it = it; - lz->firstpass = 1; - Py_DECREF(tmp); - } -} - -PyDoc_STRVAR(cycle_doc, -"cycle(iterable) --> cycle object\n\ -\n\ -Return elements from the iterable until it is exhausted.\n\ -Then repeat the sequence indefinitely."); - -static PyTypeObject cycle_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.cycle", /* tp_name */ - sizeof(cycleobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)cycle_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - cycle_doc, /* tp_doc */ - (traverseproc)cycle_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)cycle_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - cycle_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* dropwhile object **********************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *func; - PyObject *it; - long start; -} dropwhileobject; - -static PyTypeObject dropwhile_type; - -static PyObject * -dropwhile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *func, *seq; - PyObject *it; - dropwhileobject *lz; - - if (type == &dropwhile_type && !_PyArg_NoKeywords("dropwhile()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "dropwhile", 2, 2, &func, &seq)) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - return NULL; - - /* create dropwhileobject structure */ - lz = (dropwhileobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - return NULL; - } - Py_INCREF(func); - lz->func = func; - lz->it = it; - lz->start = 0; - - return (PyObject *)lz; -} - -static void -dropwhile_dealloc(dropwhileobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->func); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -dropwhile_traverse(dropwhileobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - Py_VISIT(lz->func); - return 0; -} - -static PyObject * -dropwhile_next(dropwhileobject *lz) -{ - PyObject *item, *good; - PyObject *it = lz->it; - long ok; - PyObject *(*iternext)(PyObject *); - - iternext = *Py_TYPE(it)->tp_iternext; - for (;;) { - item = iternext(it); - if (item == NULL) - return NULL; - if (lz->start == 1) - return item; - - good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); - if (good == NULL) { - Py_DECREF(item); - return NULL; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - if (ok == 0) { - lz->start = 1; - return item; - } - Py_DECREF(item); - if (ok < 0) - return NULL; - } -} - -PyDoc_STRVAR(dropwhile_doc, -"dropwhile(predicate, iterable) --> dropwhile object\n\ -\n\ -Drop items from the iterable while predicate(item) is true.\n\ -Afterwards, return every element until the iterable is exhausted."); - -static PyTypeObject dropwhile_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.dropwhile", /* tp_name */ - sizeof(dropwhileobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dropwhile_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - dropwhile_doc, /* tp_doc */ - (traverseproc)dropwhile_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dropwhile_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - dropwhile_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* takewhile object **********************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *func; - PyObject *it; - long stop; -} takewhileobject; - -static PyTypeObject takewhile_type; - -static PyObject * -takewhile_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *func, *seq; - PyObject *it; - takewhileobject *lz; - - if (type == &takewhile_type && !_PyArg_NoKeywords("takewhile()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "takewhile", 2, 2, &func, &seq)) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - return NULL; - - /* create takewhileobject structure */ - lz = (takewhileobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - return NULL; - } - Py_INCREF(func); - lz->func = func; - lz->it = it; - lz->stop = 0; - - return (PyObject *)lz; -} - -static void -takewhile_dealloc(takewhileobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->func); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -takewhile_traverse(takewhileobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - Py_VISIT(lz->func); - return 0; -} - -static PyObject * -takewhile_next(takewhileobject *lz) -{ - PyObject *item, *good; - PyObject *it = lz->it; - long ok; - - if (lz->stop == 1) - return NULL; - - item = (*Py_TYPE(it)->tp_iternext)(it); - if (item == NULL) - return NULL; - - good = PyObject_CallFunctionObjArgs(lz->func, item, NULL); - if (good == NULL) { - Py_DECREF(item); - return NULL; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - if (ok > 0) - return item; - Py_DECREF(item); - if (ok == 0) - lz->stop = 1; - return NULL; -} - -PyDoc_STRVAR(takewhile_doc, -"takewhile(predicate, iterable) --> takewhile object\n\ -\n\ -Return successive entries from an iterable as long as the \n\ -predicate evaluates to true for each entry."); - -static PyTypeObject takewhile_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.takewhile", /* tp_name */ - sizeof(takewhileobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)takewhile_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - takewhile_doc, /* tp_doc */ - (traverseproc)takewhile_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)takewhile_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - takewhile_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* islice object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *it; - Py_ssize_t next; - Py_ssize_t stop; - Py_ssize_t step; - Py_ssize_t cnt; -} isliceobject; - -static PyTypeObject islice_type; - -static PyObject * -islice_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *seq; - Py_ssize_t start=0, stop=-1, step=1; - PyObject *it, *a1=NULL, *a2=NULL, *a3=NULL; - Py_ssize_t numargs; - isliceobject *lz; - - if (type == &islice_type && !_PyArg_NoKeywords("islice()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "islice", 2, 4, &seq, &a1, &a2, &a3)) - return NULL; - - numargs = PyTuple_Size(args); - if (numargs == 2) { - if (a1 != Py_None) { - stop = PyInt_AsSsize_t(a1); - if (stop == -1) { - if (PyErr_Occurred()) - PyErr_Clear(); - PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be None or an integer: 0 <= x <= maxint."); - return NULL; - } - } - } else { - if (a1 != Py_None) - start = PyInt_AsSsize_t(a1); - if (start == -1 && PyErr_Occurred()) - PyErr_Clear(); - if (a2 != Py_None) { - stop = PyInt_AsSsize_t(a2); - if (stop == -1) { - if (PyErr_Occurred()) - PyErr_Clear(); - PyErr_SetString(PyExc_ValueError, - "Stop argument for islice() must be None or an integer: 0 <= x <= maxint."); - return NULL; - } - } - } - if (start<0 || stop<-1) { - PyErr_SetString(PyExc_ValueError, - "Indices for islice() must be None or an integer: 0 <= x <= maxint."); - return NULL; - } - - if (a3 != NULL) { - if (a3 != Py_None) - step = PyInt_AsSsize_t(a3); - if (step == -1 && PyErr_Occurred()) - PyErr_Clear(); - } - if (step<1) { - PyErr_SetString(PyExc_ValueError, - "Step for islice() must be a positive integer or None."); - return NULL; - } - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - return NULL; - - /* create isliceobject structure */ - lz = (isliceobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - return NULL; - } - lz->it = it; - lz->next = start; - lz->stop = stop; - lz->step = step; - lz->cnt = 0L; - - return (PyObject *)lz; -} - -static void -islice_dealloc(isliceobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -islice_traverse(isliceobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - return 0; -} - -static PyObject * -islice_next(isliceobject *lz) -{ - PyObject *item; - PyObject *it = lz->it; - Py_ssize_t stop = lz->stop; - Py_ssize_t oldnext; - PyObject *(*iternext)(PyObject *); - - if (it == NULL) - return NULL; - - iternext = *Py_TYPE(it)->tp_iternext; - while (lz->cnt < lz->next) { - item = iternext(it); - if (item == NULL) - goto empty; - Py_DECREF(item); - lz->cnt++; - } - if (stop != -1 && lz->cnt >= stop) - goto empty; - item = iternext(it); - if (item == NULL) - goto empty; - lz->cnt++; - oldnext = lz->next; - /* The (size_t) cast below avoids the danger of undefined - behaviour from signed integer overflow. */ - lz->next += (size_t)lz->step; - if (lz->next < oldnext || (stop != -1 && lz->next > stop)) - lz->next = stop; - return item; - -empty: - Py_CLEAR(lz->it); - return NULL; -} - -PyDoc_STRVAR(islice_doc, -"islice(iterable, [start,] stop [, step]) --> islice object\n\ -\n\ -Return an iterator whose next() method returns selected values from an\n\ -iterable. If start is specified, will skip all preceding elements;\n\ -otherwise, start defaults to zero. Step defaults to one. If\n\ -specified as another value, step determines how many values are \n\ -skipped between successive calls. Works like a slice() on a list\n\ -but returns an iterator."); - -static PyTypeObject islice_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.islice", /* tp_name */ - sizeof(isliceobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)islice_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - islice_doc, /* tp_doc */ - (traverseproc)islice_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)islice_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - islice_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* starmap object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *func; - PyObject *it; -} starmapobject; - -static PyTypeObject starmap_type; - -static PyObject * -starmap_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *func, *seq; - PyObject *it; - starmapobject *lz; - - if (type == &starmap_type && !_PyArg_NoKeywords("starmap()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "starmap", 2, 2, &func, &seq)) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - return NULL; - - /* create starmapobject structure */ - lz = (starmapobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - return NULL; - } - Py_INCREF(func); - lz->func = func; - lz->it = it; - - return (PyObject *)lz; -} - -static void -starmap_dealloc(starmapobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->func); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -starmap_traverse(starmapobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - Py_VISIT(lz->func); - return 0; -} - -static PyObject * -starmap_next(starmapobject *lz) -{ - PyObject *args; - PyObject *result; - PyObject *it = lz->it; - - args = (*Py_TYPE(it)->tp_iternext)(it); - if (args == NULL) - return NULL; - if (!PyTuple_CheckExact(args)) { - PyObject *newargs = PySequence_Tuple(args); - Py_DECREF(args); - if (newargs == NULL) - return NULL; - args = newargs; - } - result = PyObject_Call(lz->func, args, NULL); - Py_DECREF(args); - return result; -} - -PyDoc_STRVAR(starmap_doc, -"starmap(function, sequence) --> starmap object\n\ -\n\ -Return an iterator whose values are returned from the function evaluated\n\ -with a argument tuple taken from the given sequence."); - -static PyTypeObject starmap_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.starmap", /* tp_name */ - sizeof(starmapobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)starmap_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - starmap_doc, /* tp_doc */ - (traverseproc)starmap_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)starmap_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - starmap_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* imap object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *iters; - PyObject *func; -} imapobject; - -static PyTypeObject imap_type; - -static PyObject * -imap_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *it, *iters, *func; - imapobject *lz; - Py_ssize_t numargs, i; - - if (type == &imap_type && !_PyArg_NoKeywords("imap()", kwds)) - return NULL; - - numargs = PyTuple_Size(args); - if (numargs < 2) { - PyErr_SetString(PyExc_TypeError, - "imap() must have at least two arguments."); - return NULL; - } - - iters = PyTuple_New(numargs-1); - if (iters == NULL) - return NULL; - - for (i=1 ; itp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(iters); - return NULL; - } - lz->iters = iters; - func = PyTuple_GET_ITEM(args, 0); - Py_INCREF(func); - lz->func = func; - - return (PyObject *)lz; -} - -static void -imap_dealloc(imapobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->iters); - Py_XDECREF(lz->func); - Py_TYPE(lz)->tp_free(lz); -} - -static int -imap_traverse(imapobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->iters); - Py_VISIT(lz->func); - return 0; -} - -/* -imap() is an iterator version of __builtins__.map() except that it does -not have the None fill-in feature. That was intentionally left out for -the following reasons: - - 1) Itertools are designed to be easily combined and chained together. - Having all tools stop with the shortest input is a unifying principle - that makes it easier to combine finite iterators (supplying data) with - infinite iterators like count() and repeat() (for supplying sequential - or constant arguments to a function). - - 2) In typical use cases for combining itertools, having one finite data - supplier run out before another is likely to be an error condition which - should not pass silently by automatically supplying None. - - 3) The use cases for automatic None fill-in are rare -- not many functions - do something useful when a parameter suddenly switches type and becomes - None. - - 4) If a need does arise, it can be met by __builtins__.map() or by - writing: chain(iterable, repeat(None)). - - 5) Similar toolsets in Haskell and SML do not have automatic None fill-in. -*/ - -static PyObject * -imap_next(imapobject *lz) -{ - PyObject *val; - PyObject *argtuple; - PyObject *result; - Py_ssize_t numargs, i; - - numargs = PyTuple_Size(lz->iters); - argtuple = PyTuple_New(numargs); - if (argtuple == NULL) - return NULL; - - for (i=0 ; iiters, i)); - if (val == NULL) { - Py_DECREF(argtuple); - return NULL; - } - PyTuple_SET_ITEM(argtuple, i, val); - } - if (lz->func == Py_None) - return argtuple; - result = PyObject_Call(lz->func, argtuple, NULL); - Py_DECREF(argtuple); - return result; -} - -PyDoc_STRVAR(imap_doc, -"imap(func, *iterables) --> imap object\n\ -\n\ -Make an iterator that computes the function using arguments from\n\ -each of the iterables. Like map() except that it returns\n\ -an iterator instead of a list and that it stops when the shortest\n\ -iterable is exhausted instead of filling in None for shorter\n\ -iterables."); - -static PyTypeObject imap_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.imap", /* tp_name */ - sizeof(imapobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)imap_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - imap_doc, /* tp_doc */ - (traverseproc)imap_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)imap_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - imap_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* chain object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *source; /* Iterator over input iterables */ - PyObject *active; /* Currently running input iterator */ -} chainobject; - -static PyTypeObject chain_type; - -static PyObject * -chain_new_internal(PyTypeObject *type, PyObject *source) -{ - chainobject *lz; - - lz = (chainobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(source); - return NULL; - } - - lz->source = source; - lz->active = NULL; - return (PyObject *)lz; -} - -static PyObject * -chain_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *source; - - if (type == &chain_type && !_PyArg_NoKeywords("chain()", kwds)) - return NULL; - - source = PyObject_GetIter(args); - if (source == NULL) - return NULL; - - return chain_new_internal(type, source); -} - -static PyObject * -chain_new_from_iterable(PyTypeObject *type, PyObject *arg) -{ - PyObject *source; - - source = PyObject_GetIter(arg); - if (source == NULL) - return NULL; - - return chain_new_internal(type, source); -} - -static void -chain_dealloc(chainobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->active); - Py_XDECREF(lz->source); - Py_TYPE(lz)->tp_free(lz); -} - -static int -chain_traverse(chainobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->source); - Py_VISIT(lz->active); - return 0; -} - -static PyObject * -chain_next(chainobject *lz) -{ - PyObject *item; - - if (lz->source == NULL) - return NULL; /* already stopped */ - - if (lz->active == NULL) { - PyObject *iterable = PyIter_Next(lz->source); - if (iterable == NULL) { - Py_CLEAR(lz->source); - return NULL; /* no more input sources */ - } - lz->active = PyObject_GetIter(iterable); - Py_DECREF(iterable); - if (lz->active == NULL) { - Py_CLEAR(lz->source); - return NULL; /* input not iterable */ - } - } - item = PyIter_Next(lz->active); - if (item != NULL) - return item; - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - else - return NULL; /* input raised an exception */ - } - Py_CLEAR(lz->active); - return chain_next(lz); /* recurse and use next active */ -} - -PyDoc_STRVAR(chain_doc, -"chain(*iterables) --> chain object\n\ -\n\ -Return a chain object whose .next() method returns elements from the\n\ -first iterable until it is exhausted, then elements from the next\n\ -iterable, until all of the iterables are exhausted."); - -PyDoc_STRVAR(chain_from_iterable_doc, -"chain.from_iterable(iterable) --> chain object\n\ -\n\ -Alternate chain() contructor taking a single iterable argument\n\ -that evaluates lazily."); - -static PyMethodDef chain_methods[] = { - {"from_iterable", (PyCFunction) chain_new_from_iterable, METH_O | METH_CLASS, - chain_from_iterable_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject chain_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.chain", /* tp_name */ - sizeof(chainobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)chain_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - chain_doc, /* tp_doc */ - (traverseproc)chain_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)chain_next, /* tp_iternext */ - chain_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - chain_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* product object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *pools; /* tuple of pool tuples */ - Py_ssize_t *indices; /* one index per pool */ - PyObject *result; /* most recently returned result tuple */ - int stopped; /* set to 1 when the product iterator is exhausted */ -} productobject; - -static PyTypeObject product_type; - -static PyObject * -product_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - productobject *lz; - Py_ssize_t nargs, npools, repeat=1; - PyObject *pools = NULL; - Py_ssize_t *indices = NULL; - Py_ssize_t i; - - if (kwds != NULL) { - char *kwlist[] = {"repeat", 0}; - PyObject *tmpargs = PyTuple_New(0); - if (tmpargs == NULL) - return NULL; - if (!PyArg_ParseTupleAndKeywords(tmpargs, kwds, "|n:product", kwlist, &repeat)) { - Py_DECREF(tmpargs); - return NULL; - } - Py_DECREF(tmpargs); - if (repeat < 0) { - PyErr_SetString(PyExc_ValueError, - "repeat argument cannot be negative"); - return NULL; - } - } - - assert(PyTuple_CheckExact(args)); - if (repeat == 0) { - nargs = 0; - } else { - nargs = PyTuple_GET_SIZE(args); - if ((size_t)nargs > PY_SSIZE_T_MAX/sizeof(Py_ssize_t)/repeat) { - PyErr_SetString(PyExc_OverflowError, "repeat argument too large"); - return NULL; - } - } - npools = nargs * repeat; - - indices = PyMem_New(Py_ssize_t, npools); - if (indices == NULL) { - PyErr_NoMemory(); - goto error; - } - - pools = PyTuple_New(npools); - if (pools == NULL) - goto error; - - for (i=0; i < nargs ; ++i) { - PyObject *item = PyTuple_GET_ITEM(args, i); - PyObject *pool = PySequence_Tuple(item); - if (pool == NULL) - goto error; - PyTuple_SET_ITEM(pools, i, pool); - indices[i] = 0; - } - for ( ; i < npools; ++i) { - PyObject *pool = PyTuple_GET_ITEM(pools, i - nargs); - Py_INCREF(pool); - PyTuple_SET_ITEM(pools, i, pool); - indices[i] = 0; - } - - /* create productobject structure */ - lz = (productobject *)type->tp_alloc(type, 0); - if (lz == NULL) - goto error; - - lz->pools = pools; - lz->indices = indices; - lz->result = NULL; - lz->stopped = 0; - - return (PyObject *)lz; - -error: - if (indices != NULL) - PyMem_Free(indices); - Py_XDECREF(pools); - return NULL; -} - -static void -product_dealloc(productobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->pools); - Py_XDECREF(lz->result); - if (lz->indices != NULL) - PyMem_Free(lz->indices); - Py_TYPE(lz)->tp_free(lz); -} - -static int -product_traverse(productobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->pools); - Py_VISIT(lz->result); - return 0; -} - -static PyObject * -product_next(productobject *lz) -{ - PyObject *pool; - PyObject *elem; - PyObject *oldelem; - PyObject *pools = lz->pools; - PyObject *result = lz->result; - Py_ssize_t npools = PyTuple_GET_SIZE(pools); - Py_ssize_t i; - - if (lz->stopped) - return NULL; - - if (result == NULL) { - /* On the first pass, return an initial tuple filled with the - first element from each pool. */ - result = PyTuple_New(npools); - if (result == NULL) - goto empty; - lz->result = result; - for (i=0; i < npools; i++) { - pool = PyTuple_GET_ITEM(pools, i); - if (PyTuple_GET_SIZE(pool) == 0) - goto empty; - elem = PyTuple_GET_ITEM(pool, 0); - Py_INCREF(elem); - PyTuple_SET_ITEM(result, i, elem); - } - } else { - Py_ssize_t *indices = lz->indices; - - /* Copy the previous result tuple or re-use it if available */ - if (Py_REFCNT(result) > 1) { - PyObject *old_result = result; - result = PyTuple_New(npools); - if (result == NULL) - goto empty; - lz->result = result; - for (i=0; i < npools; i++) { - elem = PyTuple_GET_ITEM(old_result, i); - Py_INCREF(elem); - PyTuple_SET_ITEM(result, i, elem); - } - Py_DECREF(old_result); - } - /* Now, we've got the only copy so we can update it in-place */ - assert (npools==0 || Py_REFCNT(result) == 1); - - /* Update the pool indices right-to-left. Only advance to the - next pool when the previous one rolls-over */ - for (i=npools-1 ; i >= 0 ; i--) { - pool = PyTuple_GET_ITEM(pools, i); - indices[i]++; - if (indices[i] == PyTuple_GET_SIZE(pool)) { - /* Roll-over and advance to next pool */ - indices[i] = 0; - elem = PyTuple_GET_ITEM(pool, 0); - Py_INCREF(elem); - oldelem = PyTuple_GET_ITEM(result, i); - PyTuple_SET_ITEM(result, i, elem); - Py_DECREF(oldelem); - } else { - /* No rollover. Just increment and stop here. */ - elem = PyTuple_GET_ITEM(pool, indices[i]); - Py_INCREF(elem); - oldelem = PyTuple_GET_ITEM(result, i); - PyTuple_SET_ITEM(result, i, elem); - Py_DECREF(oldelem); - break; - } - } - - /* If i is negative, then the indices have all rolled-over - and we're done. */ - if (i < 0) - goto empty; - } - - Py_INCREF(result); - return result; - -empty: - lz->stopped = 1; - return NULL; -} - -PyDoc_STRVAR(product_doc, -"product(*iterables) --> product object\n\ -\n\ -Cartesian product of input iterables. Equivalent to nested for-loops.\n\n\ -For example, product(A, B) returns the same as: ((x,y) for x in A for y in B).\n\ -The leftmost iterators are in the outermost for-loop, so the output tuples\n\ -cycle in a manner similar to an odometer (with the rightmost element changing\n\ -on every iteration).\n\n\ -To compute the product of an iterable with itself, specify the number\n\ -of repetitions with the optional repeat keyword argument. For example,\n\ -product(A, repeat=4) means the same as product(A, A, A, A).\n\n\ -product('ab', range(3)) --> ('a',0) ('a',1) ('a',2) ('b',0) ('b',1) ('b',2)\n\ -product((0,1), (0,1), (0,1)) --> (0,0,0) (0,0,1) (0,1,0) (0,1,1) (1,0,0) ..."); - -static PyTypeObject product_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.product", /* tp_name */ - sizeof(productobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)product_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - product_doc, /* tp_doc */ - (traverseproc)product_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)product_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - product_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* combinations object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *pool; /* input converted to a tuple */ - Py_ssize_t *indices; /* one index per result element */ - PyObject *result; /* most recently returned result tuple */ - Py_ssize_t r; /* size of result tuple */ - int stopped; /* set to 1 when the combinations iterator is exhausted */ -} combinationsobject; - -static PyTypeObject combinations_type; - -static PyObject * -combinations_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - combinationsobject *co; - Py_ssize_t n; - Py_ssize_t r; - PyObject *pool = NULL; - PyObject *iterable = NULL; - Py_ssize_t *indices = NULL; - Py_ssize_t i; - static char *kwargs[] = {"iterable", "r", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:combinations", kwargs, - &iterable, &r)) - return NULL; - - pool = PySequence_Tuple(iterable); - if (pool == NULL) - goto error; - n = PyTuple_GET_SIZE(pool); - if (r < 0) { - PyErr_SetString(PyExc_ValueError, "r must be non-negative"); - goto error; - } - - indices = PyMem_New(Py_ssize_t, r); - if (indices == NULL) { - PyErr_NoMemory(); - goto error; - } - - for (i=0 ; itp_alloc(type, 0); - if (co == NULL) - goto error; - - co->pool = pool; - co->indices = indices; - co->result = NULL; - co->r = r; - co->stopped = r > n ? 1 : 0; - - return (PyObject *)co; - -error: - if (indices != NULL) - PyMem_Free(indices); - Py_XDECREF(pool); - return NULL; -} - -static void -combinations_dealloc(combinationsobject *co) -{ - PyObject_GC_UnTrack(co); - Py_XDECREF(co->pool); - Py_XDECREF(co->result); - if (co->indices != NULL) - PyMem_Free(co->indices); - Py_TYPE(co)->tp_free(co); -} - -static int -combinations_traverse(combinationsobject *co, visitproc visit, void *arg) -{ - Py_VISIT(co->pool); - Py_VISIT(co->result); - return 0; -} - -static PyObject * -combinations_next(combinationsobject *co) -{ - PyObject *elem; - PyObject *oldelem; - PyObject *pool = co->pool; - Py_ssize_t *indices = co->indices; - PyObject *result = co->result; - Py_ssize_t n = PyTuple_GET_SIZE(pool); - Py_ssize_t r = co->r; - Py_ssize_t i, j, index; - - if (co->stopped) - return NULL; - - if (result == NULL) { - /* On the first pass, initialize result tuple using the indices */ - result = PyTuple_New(r); - if (result == NULL) - goto empty; - co->result = result; - for (i=0; i 1) { - PyObject *old_result = result; - result = PyTuple_New(r); - if (result == NULL) - goto empty; - co->result = result; - for (i=0; i= 0 && indices[i] == i+n-r ; i--) - ; - - /* If i is negative, then the indices are all at - their maximum value and we're done. */ - if (i < 0) - goto empty; - - /* Increment the current index which we know is not at its - maximum. Then move back to the right setting each index - to its lowest possible value (one higher than the index - to its left -- this maintains the sort order invariant). */ - indices[i]++; - for (j=i+1 ; jstopped = 1; - return NULL; -} - -PyDoc_STRVAR(combinations_doc, -"combinations(iterable, r) --> combinations object\n\ -\n\ -Return successive r-length combinations of elements in the iterable.\n\n\ -combinations(range(4), 3) --> (0,1,2), (0,1,3), (0,2,3), (1,2,3)"); - -static PyTypeObject combinations_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.combinations", /* tp_name */ - sizeof(combinationsobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)combinations_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - combinations_doc, /* tp_doc */ - (traverseproc)combinations_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)combinations_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - combinations_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* combinations with replacement object *******************************************/ - -/* Equivalent to: - - def combinations_with_replacement(iterable, r): - "combinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC" - # number items returned: (n+r-1)! / r! / (n-1)! - pool = tuple(iterable) - n = len(pool) - indices = [0] * r - yield tuple(pool[i] for i in indices) - while 1: - for i in reversed(range(r)): - if indices[i] != n - 1: - break - else: - return - indices[i:] = [indices[i] + 1] * (r - i) - yield tuple(pool[i] for i in indices) - - def combinations_with_replacement2(iterable, r): - 'Alternate version that filters from product()' - pool = tuple(iterable) - n = len(pool) - for indices in product(range(n), repeat=r): - if sorted(indices) == list(indices): - yield tuple(pool[i] for i in indices) -*/ -typedef struct { - PyObject_HEAD - PyObject *pool; /* input converted to a tuple */ - Py_ssize_t *indices; /* one index per result element */ - PyObject *result; /* most recently returned result tuple */ - Py_ssize_t r; /* size of result tuple */ - int stopped; /* set to 1 when the cwr iterator is exhausted */ -} cwrobject; - -static PyTypeObject cwr_type; - -static PyObject * -cwr_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - cwrobject *co; - Py_ssize_t n; - Py_ssize_t r; - PyObject *pool = NULL; - PyObject *iterable = NULL; - Py_ssize_t *indices = NULL; - Py_ssize_t i; - static char *kwargs[] = {"iterable", "r", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "On:combinations_with_replacement", kwargs, - &iterable, &r)) - return NULL; - - pool = PySequence_Tuple(iterable); - if (pool == NULL) - goto error; - n = PyTuple_GET_SIZE(pool); - if (r < 0) { - PyErr_SetString(PyExc_ValueError, "r must be non-negative"); - goto error; - } - - indices = PyMem_New(Py_ssize_t, r); - if (indices == NULL) { - PyErr_NoMemory(); - goto error; - } - - for (i=0 ; itp_alloc(type, 0); - if (co == NULL) - goto error; - - co->pool = pool; - co->indices = indices; - co->result = NULL; - co->r = r; - co->stopped = !n && r; - - return (PyObject *)co; - -error: - if (indices != NULL) - PyMem_Free(indices); - Py_XDECREF(pool); - return NULL; -} - -static void -cwr_dealloc(cwrobject *co) -{ - PyObject_GC_UnTrack(co); - Py_XDECREF(co->pool); - Py_XDECREF(co->result); - if (co->indices != NULL) - PyMem_Free(co->indices); - Py_TYPE(co)->tp_free(co); -} - -static int -cwr_traverse(cwrobject *co, visitproc visit, void *arg) -{ - Py_VISIT(co->pool); - Py_VISIT(co->result); - return 0; -} - -static PyObject * -cwr_next(cwrobject *co) -{ - PyObject *elem; - PyObject *oldelem; - PyObject *pool = co->pool; - Py_ssize_t *indices = co->indices; - PyObject *result = co->result; - Py_ssize_t n = PyTuple_GET_SIZE(pool); - Py_ssize_t r = co->r; - Py_ssize_t i, j, index; - - if (co->stopped) - return NULL; - - if (result == NULL) { - /* On the first pass, initialize result tuple using the indices */ - result = PyTuple_New(r); - if (result == NULL) - goto empty; - co->result = result; - for (i=0; i 1) { - PyObject *old_result = result; - result = PyTuple_New(r); - if (result == NULL) - goto empty; - co->result = result; - for (i=0; i= 0 && indices[i] == n-1; i--) - ; - - /* If i is negative, then the indices are all at - their maximum value and we're done. */ - if (i < 0) - goto empty; - - /* Increment the current index which we know is not at its - maximum. Then set all to the right to the same value. */ - indices[i]++; - for (j=i+1 ; jstopped = 1; - return NULL; -} - -PyDoc_STRVAR(cwr_doc, -"combinations_with_replacement(iterable, r) --> combinations_with_replacement object\n\ -\n\ -Return successive r-length combinations of elements in the iterable\n\ -allowing individual elements to have successive repeats.\n\ -combinations_with_replacement('ABC', 2) --> AA AB AC BB BC CC"); - -static PyTypeObject cwr_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.combinations_with_replacement", /* tp_name */ - sizeof(cwrobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)cwr_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - cwr_doc, /* tp_doc */ - (traverseproc)cwr_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)cwr_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - cwr_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* permutations object ************************************************************ - -def permutations(iterable, r=None): - 'permutations(range(3), 2) --> (0,1) (0,2) (1,0) (1,2) (2,0) (2,1)' - pool = tuple(iterable) - n = len(pool) - r = n if r is None else r - indices = range(n) - cycles = range(n-r+1, n+1)[::-1] - yield tuple(pool[i] for i in indices[:r]) - while n: - for i in reversed(range(r)): - cycles[i] -= 1 - if cycles[i] == 0: - indices[i:] = indices[i+1:] + indices[i:i+1] - cycles[i] = n - i - else: - j = cycles[i] - indices[i], indices[-j] = indices[-j], indices[i] - yield tuple(pool[i] for i in indices[:r]) - break - else: - return -*/ - -typedef struct { - PyObject_HEAD - PyObject *pool; /* input converted to a tuple */ - Py_ssize_t *indices; /* one index per element in the pool */ - Py_ssize_t *cycles; /* one rollover counter per element in the result */ - PyObject *result; /* most recently returned result tuple */ - Py_ssize_t r; /* size of result tuple */ - int stopped; /* set to 1 when the permutations iterator is exhausted */ -} permutationsobject; - -static PyTypeObject permutations_type; - -static PyObject * -permutations_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - permutationsobject *po; - Py_ssize_t n; - Py_ssize_t r; - PyObject *robj = Py_None; - PyObject *pool = NULL; - PyObject *iterable = NULL; - Py_ssize_t *indices = NULL; - Py_ssize_t *cycles = NULL; - Py_ssize_t i; - static char *kwargs[] = {"iterable", "r", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:permutations", kwargs, - &iterable, &robj)) - return NULL; - - pool = PySequence_Tuple(iterable); - if (pool == NULL) - goto error; - n = PyTuple_GET_SIZE(pool); - - r = n; - if (robj != Py_None) { - r = PyInt_AsSsize_t(robj); - if (r == -1 && PyErr_Occurred()) - goto error; - } - if (r < 0) { - PyErr_SetString(PyExc_ValueError, "r must be non-negative"); - goto error; - } - - indices = PyMem_New(Py_ssize_t, n); - cycles = PyMem_New(Py_ssize_t, r); - if (indices == NULL || cycles == NULL) { - PyErr_NoMemory(); - goto error; - } - - for (i=0 ; itp_alloc(type, 0); - if (po == NULL) - goto error; - - po->pool = pool; - po->indices = indices; - po->cycles = cycles; - po->result = NULL; - po->r = r; - po->stopped = r > n ? 1 : 0; - - return (PyObject *)po; - -error: - if (indices != NULL) - PyMem_Free(indices); - if (cycles != NULL) - PyMem_Free(cycles); - Py_XDECREF(pool); - return NULL; -} - -static void -permutations_dealloc(permutationsobject *po) -{ - PyObject_GC_UnTrack(po); - Py_XDECREF(po->pool); - Py_XDECREF(po->result); - PyMem_Free(po->indices); - PyMem_Free(po->cycles); - Py_TYPE(po)->tp_free(po); -} - -static int -permutations_traverse(permutationsobject *po, visitproc visit, void *arg) -{ - Py_VISIT(po->pool); - Py_VISIT(po->result); - return 0; -} - -static PyObject * -permutations_next(permutationsobject *po) -{ - PyObject *elem; - PyObject *oldelem; - PyObject *pool = po->pool; - Py_ssize_t *indices = po->indices; - Py_ssize_t *cycles = po->cycles; - PyObject *result = po->result; - Py_ssize_t n = PyTuple_GET_SIZE(pool); - Py_ssize_t r = po->r; - Py_ssize_t i, j, k, index; - - if (po->stopped) - return NULL; - - if (result == NULL) { - /* On the first pass, initialize result tuple using the indices */ - result = PyTuple_New(r); - if (result == NULL) - goto empty; - po->result = result; - for (i=0; i 1) { - PyObject *old_result = result; - result = PyTuple_New(r); - if (result == NULL) - goto empty; - po->result = result; - for (i=0; i=0 ; i--) { - cycles[i] -= 1; - if (cycles[i] == 0) { - /* rotatation: indices[i:] = indices[i+1:] + indices[i:i+1] */ - index = indices[i]; - for (j=i ; jstopped = 1; - return NULL; -} - -PyDoc_STRVAR(permutations_doc, -"permutations(iterable[, r]) --> permutations object\n\ -\n\ -Return successive r-length permutations of elements in the iterable.\n\n\ -permutations(range(3), 2) --> (0,1), (0,2), (1,0), (1,2), (2,0), (2,1)"); - -static PyTypeObject permutations_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.permutations", /* tp_name */ - sizeof(permutationsobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)permutations_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - permutations_doc, /* tp_doc */ - (traverseproc)permutations_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)permutations_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - permutations_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* compress object ************************************************************/ - -/* Equivalent to: - - def compress(data, selectors): - "compress('ABCDEF', [1,0,1,0,1,1]) --> A C E F" - return (d for d, s in izip(data, selectors) if s) -*/ - -typedef struct { - PyObject_HEAD - PyObject *data; - PyObject *selectors; -} compressobject; - -static PyTypeObject compress_type; - -static PyObject * -compress_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *seq1, *seq2; - PyObject *data=NULL, *selectors=NULL; - compressobject *lz; - static char *kwargs[] = {"data", "selectors", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OO:compress", kwargs, &seq1, &seq2)) - return NULL; - - data = PyObject_GetIter(seq1); - if (data == NULL) - goto fail; - selectors = PyObject_GetIter(seq2); - if (selectors == NULL) - goto fail; - - /* create compressobject structure */ - lz = (compressobject *)type->tp_alloc(type, 0); - if (lz == NULL) - goto fail; - lz->data = data; - lz->selectors = selectors; - return (PyObject *)lz; - -fail: - Py_XDECREF(data); - Py_XDECREF(selectors); - return NULL; -} - -static void -compress_dealloc(compressobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->data); - Py_XDECREF(lz->selectors); - Py_TYPE(lz)->tp_free(lz); -} - -static int -compress_traverse(compressobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->data); - Py_VISIT(lz->selectors); - return 0; -} - -static PyObject * -compress_next(compressobject *lz) -{ - PyObject *data = lz->data, *selectors = lz->selectors; - PyObject *datum, *selector; - PyObject *(*datanext)(PyObject *) = *Py_TYPE(data)->tp_iternext; - PyObject *(*selectornext)(PyObject *) = *Py_TYPE(selectors)->tp_iternext; - int ok; - - while (1) { - /* Steps: get datum, get selector, evaluate selector. - Order is important (to match the pure python version - in terms of which input gets a chance to raise an - exception first). - */ - - datum = datanext(data); - if (datum == NULL) - return NULL; - - selector = selectornext(selectors); - if (selector == NULL) { - Py_DECREF(datum); - return NULL; - } - - ok = PyObject_IsTrue(selector); - Py_DECREF(selector); - if (ok == 1) - return datum; - Py_DECREF(datum); - if (ok == -1) - return NULL; - } -} - -PyDoc_STRVAR(compress_doc, -"compress(data, selectors) --> iterator over selected data\n\ -\n\ -Return data elements corresponding to true selector elements.\n\ -Forms a shorter iterator from selected data elements using the\n\ -selectors to choose the data elements."); - -static PyTypeObject compress_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.compress", /* tp_name */ - sizeof(compressobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)compress_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - compress_doc, /* tp_doc */ - (traverseproc)compress_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)compress_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - compress_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* ifilter object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *func; - PyObject *it; -} ifilterobject; - -static PyTypeObject ifilter_type; - -static PyObject * -ifilter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *func, *seq; - PyObject *it; - ifilterobject *lz; - - if (type == &ifilter_type && !_PyArg_NoKeywords("ifilter()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "ifilter", 2, 2, &func, &seq)) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - return NULL; - - /* create ifilterobject structure */ - lz = (ifilterobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - return NULL; - } - Py_INCREF(func); - lz->func = func; - lz->it = it; - - return (PyObject *)lz; -} - -static void -ifilter_dealloc(ifilterobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->func); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -ifilter_traverse(ifilterobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - Py_VISIT(lz->func); - return 0; -} - -static PyObject * -ifilter_next(ifilterobject *lz) -{ - PyObject *item; - PyObject *it = lz->it; - long ok; - PyObject *(*iternext)(PyObject *); - - iternext = *Py_TYPE(it)->tp_iternext; - for (;;) { - item = iternext(it); - if (item == NULL) - return NULL; - - if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) { - ok = PyObject_IsTrue(item); - } else { - PyObject *good; - good = PyObject_CallFunctionObjArgs(lz->func, - item, NULL); - if (good == NULL) { - Py_DECREF(item); - return NULL; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - } - if (ok > 0) - return item; - Py_DECREF(item); - if (ok < 0) - return NULL; - } -} - -PyDoc_STRVAR(ifilter_doc, -"ifilter(function or None, sequence) --> ifilter object\n\ -\n\ -Return those items of sequence for which function(item) is true.\n\ -If function is None, return the items that are true."); - -static PyTypeObject ifilter_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.ifilter", /* tp_name */ - sizeof(ifilterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)ifilter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - ifilter_doc, /* tp_doc */ - (traverseproc)ifilter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)ifilter_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - ifilter_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* ifilterfalse object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *func; - PyObject *it; -} ifilterfalseobject; - -static PyTypeObject ifilterfalse_type; - -static PyObject * -ifilterfalse_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *func, *seq; - PyObject *it; - ifilterfalseobject *lz; - - if (type == &ifilterfalse_type && - !_PyArg_NoKeywords("ifilterfalse()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "ifilterfalse", 2, 2, &func, &seq)) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - return NULL; - - /* create ifilterfalseobject structure */ - lz = (ifilterfalseobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(it); - return NULL; - } - Py_INCREF(func); - lz->func = func; - lz->it = it; - - return (PyObject *)lz; -} - -static void -ifilterfalse_dealloc(ifilterfalseobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->func); - Py_XDECREF(lz->it); - Py_TYPE(lz)->tp_free(lz); -} - -static int -ifilterfalse_traverse(ifilterfalseobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->it); - Py_VISIT(lz->func); - return 0; -} - -static PyObject * -ifilterfalse_next(ifilterfalseobject *lz) -{ - PyObject *item; - PyObject *it = lz->it; - long ok; - PyObject *(*iternext)(PyObject *); - - iternext = *Py_TYPE(it)->tp_iternext; - for (;;) { - item = iternext(it); - if (item == NULL) - return NULL; - - if (lz->func == Py_None || lz->func == (PyObject *)&PyBool_Type) { - ok = PyObject_IsTrue(item); - } else { - PyObject *good; - good = PyObject_CallFunctionObjArgs(lz->func, - item, NULL); - if (good == NULL) { - Py_DECREF(item); - return NULL; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - } - if (ok == 0) - return item; - Py_DECREF(item); - if (ok < 0) - return NULL; - } -} - -PyDoc_STRVAR(ifilterfalse_doc, -"ifilterfalse(function or None, sequence) --> ifilterfalse object\n\ -\n\ -Return those items of sequence for which function(item) is false.\n\ -If function is None, return the items that are false."); - -static PyTypeObject ifilterfalse_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.ifilterfalse", /* tp_name */ - sizeof(ifilterfalseobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)ifilterfalse_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - ifilterfalse_doc, /* tp_doc */ - (traverseproc)ifilterfalse_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)ifilterfalse_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - ifilterfalse_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* count object ************************************************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t cnt; - PyObject *long_cnt; - PyObject *long_step; -} countobject; - -/* Counting logic and invariants: - -fast_mode: when cnt an integer < PY_SSIZE_T_MAX and no step is specified. - - assert(cnt != PY_SSIZE_T_MAX && long_cnt == NULL && long_step==PyInt(1)); - Advances with: cnt += 1 - When count hits Y_SSIZE_T_MAX, switch to slow_mode. - -slow_mode: when cnt == PY_SSIZE_T_MAX, step is not int(1), or cnt is a float. - - assert(cnt == PY_SSIZE_T_MAX && long_cnt != NULL && long_step != NULL); - All counting is done with python objects (no overflows or underflows). - Advances with: long_cnt += long_step - Step may be zero -- effectively a slow version of repeat(cnt). - Either long_cnt or long_step may be a float, Fraction, or Decimal. -*/ - -static PyTypeObject count_type; - -static PyObject * -count_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - countobject *lz; - int slow_mode = 0; - Py_ssize_t cnt = 0; - PyObject *long_cnt = NULL; - PyObject *long_step = NULL; - static char *kwlist[] = {"start", "step", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO:count", - kwlist, &long_cnt, &long_step)) - return NULL; - - if ((long_cnt != NULL && !PyNumber_Check(long_cnt)) || - (long_step != NULL && !PyNumber_Check(long_step))) { - PyErr_SetString(PyExc_TypeError, "a number is required"); - return NULL; - } - - if (long_cnt != NULL) { - cnt = PyInt_AsSsize_t(long_cnt); - if ((cnt == -1 && PyErr_Occurred()) || !PyInt_Check(long_cnt)) { - PyErr_Clear(); - slow_mode = 1; - } - Py_INCREF(long_cnt); - } else { - cnt = 0; - long_cnt = PyInt_FromLong(0); - } - - /* If not specified, step defaults to 1 */ - if (long_step == NULL) { - long_step = PyInt_FromLong(1); - if (long_step == NULL) { - Py_DECREF(long_cnt); - return NULL; - } - } else - Py_INCREF(long_step); - - assert(long_cnt != NULL && long_step != NULL); - - /* Fast mode only works when the step is 1 */ - if (!PyInt_Check(long_step) || - PyInt_AS_LONG(long_step) != 1) { - slow_mode = 1; - } - - if (slow_mode) - cnt = PY_SSIZE_T_MAX; - else - Py_CLEAR(long_cnt); - - assert((cnt != PY_SSIZE_T_MAX && long_cnt == NULL && !slow_mode) || - (cnt == PY_SSIZE_T_MAX && long_cnt != NULL && slow_mode)); - assert(slow_mode || - (PyInt_Check(long_step) && PyInt_AS_LONG(long_step) == 1)); - - /* create countobject structure */ - lz = (countobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_XDECREF(long_cnt); - return NULL; - } - lz->cnt = cnt; - lz->long_cnt = long_cnt; - lz->long_step = long_step; - - return (PyObject *)lz; -} - -static void -count_dealloc(countobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->long_cnt); - Py_XDECREF(lz->long_step); - Py_TYPE(lz)->tp_free(lz); -} - -static int -count_traverse(countobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->long_cnt); - Py_VISIT(lz->long_step); - return 0; -} - -static PyObject * -count_nextlong(countobject *lz) -{ - PyObject *long_cnt; - PyObject *stepped_up; - - long_cnt = lz->long_cnt; - if (long_cnt == NULL) { - /* Switch to slow_mode */ - long_cnt = PyInt_FromSsize_t(PY_SSIZE_T_MAX); - if (long_cnt == NULL) - return NULL; - } - assert(lz->cnt == PY_SSIZE_T_MAX && long_cnt != NULL); - - stepped_up = PyNumber_Add(long_cnt, lz->long_step); - if (stepped_up == NULL) - return NULL; - lz->long_cnt = stepped_up; - return long_cnt; -} - -static PyObject * -count_next(countobject *lz) -{ - if (lz->cnt == PY_SSIZE_T_MAX) - return count_nextlong(lz); - return PyInt_FromSsize_t(lz->cnt++); -} - -static PyObject * -count_repr(countobject *lz) -{ - PyObject *cnt_repr, *step_repr = NULL; - PyObject *result = NULL; - - if (lz->cnt != PY_SSIZE_T_MAX) - return PyString_FromFormat("count(%zd)", lz->cnt); - - cnt_repr = PyObject_Repr(lz->long_cnt); - if (cnt_repr == NULL) - return NULL; - - if (PyInt_Check(lz->long_step) && PyInt_AS_LONG(lz->long_step) == 1) { - /* Don't display step when it is an integer equal to 1 */ - result = PyString_FromFormat("count(%s)", - PyString_AS_STRING(cnt_repr)); - } else { - step_repr = PyObject_Repr(lz->long_step); - if (step_repr != NULL) - result = PyString_FromFormat("count(%s, %s)", - PyString_AS_STRING(cnt_repr), - PyString_AS_STRING(step_repr)); - } - Py_DECREF(cnt_repr); - Py_XDECREF(step_repr); - return result; -} - -static PyObject * -count_reduce(countobject *lz) -{ - if (lz->cnt == PY_SSIZE_T_MAX) - return Py_BuildValue("O(OO)", Py_TYPE(lz), lz->long_cnt, lz->long_step); - return Py_BuildValue("O(n)", Py_TYPE(lz), lz->cnt); -} - -PyDoc_STRVAR(count_reduce_doc, "Return state information for pickling."); - -static PyMethodDef count_methods[] = { - {"__reduce__", (PyCFunction)count_reduce, METH_NOARGS, - count_reduce_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(count_doc, - "count(start=0, step=1) --> count object\n\ -\n\ -Return a count object whose .next() method returns consecutive values.\n\ -Equivalent to:\n\n\ - def count(firstval=0, step=1):\n\ - x = firstval\n\ - while 1:\n\ - yield x\n\ - x += step\n"); - -static PyTypeObject count_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.count", /* tp_name */ - sizeof(countobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)count_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)count_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - count_doc, /* tp_doc */ - (traverseproc)count_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)count_next, /* tp_iternext */ - count_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - count_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* izip object ************************************************************/ - -#include "Python.h" - -typedef struct { - PyObject_HEAD - Py_ssize_t tuplesize; - PyObject *ittuple; /* tuple of iterators */ - PyObject *result; -} izipobject; - -static PyTypeObject izip_type; - -static PyObject * -izip_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - izipobject *lz; - Py_ssize_t i; - PyObject *ittuple; /* tuple of iterators */ - PyObject *result; - Py_ssize_t tuplesize = PySequence_Length(args); - - if (type == &izip_type && !_PyArg_NoKeywords("izip()", kwds)) - return NULL; - - /* args must be a tuple */ - assert(PyTuple_Check(args)); - - /* obtain iterators */ - ittuple = PyTuple_New(tuplesize); - if (ittuple == NULL) - return NULL; - for (i=0; i < tuplesize; ++i) { - PyObject *item = PyTuple_GET_ITEM(args, i); - PyObject *it = PyObject_GetIter(item); - if (it == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, - "izip argument #%zd must support iteration", - i+1); - Py_DECREF(ittuple); - return NULL; - } - PyTuple_SET_ITEM(ittuple, i, it); - } - - /* create a result holder */ - result = PyTuple_New(tuplesize); - if (result == NULL) { - Py_DECREF(ittuple); - return NULL; - } - for (i=0 ; i < tuplesize ; i++) { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(result, i, Py_None); - } - - /* create izipobject structure */ - lz = (izipobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(ittuple); - Py_DECREF(result); - return NULL; - } - lz->ittuple = ittuple; - lz->tuplesize = tuplesize; - lz->result = result; - - return (PyObject *)lz; -} - -static void -izip_dealloc(izipobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->ittuple); - Py_XDECREF(lz->result); - Py_TYPE(lz)->tp_free(lz); -} - -static int -izip_traverse(izipobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->ittuple); - Py_VISIT(lz->result); - return 0; -} - -static PyObject * -izip_next(izipobject *lz) -{ - Py_ssize_t i; - Py_ssize_t tuplesize = lz->tuplesize; - PyObject *result = lz->result; - PyObject *it; - PyObject *item; - PyObject *olditem; - - if (tuplesize == 0) - return NULL; - if (Py_REFCNT(result) == 1) { - Py_INCREF(result); - for (i=0 ; i < tuplesize ; i++) { - it = PyTuple_GET_ITEM(lz->ittuple, i); - item = (*Py_TYPE(it)->tp_iternext)(it); - if (item == NULL) { - Py_DECREF(result); - return NULL; - } - olditem = PyTuple_GET_ITEM(result, i); - PyTuple_SET_ITEM(result, i, item); - Py_DECREF(olditem); - } - } else { - result = PyTuple_New(tuplesize); - if (result == NULL) - return NULL; - for (i=0 ; i < tuplesize ; i++) { - it = PyTuple_GET_ITEM(lz->ittuple, i); - item = (*Py_TYPE(it)->tp_iternext)(it); - if (item == NULL) { - Py_DECREF(result); - return NULL; - } - PyTuple_SET_ITEM(result, i, item); - } - } - return result; -} - -PyDoc_STRVAR(izip_doc, -"izip(iter1 [,iter2 [...]]) --> izip object\n\ -\n\ -Return a izip object whose .next() method returns a tuple where\n\ -the i-th element comes from the i-th iterable argument. The .next()\n\ -method continues until the shortest iterable in the argument sequence\n\ -is exhausted and then it raises StopIteration. Works like the zip()\n\ -function but consumes less memory by returning an iterator instead of\n\ -a list."); - -static PyTypeObject izip_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.izip", /* tp_name */ - sizeof(izipobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)izip_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - izip_doc, /* tp_doc */ - (traverseproc)izip_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)izip_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - izip_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* repeat object ************************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *element; - Py_ssize_t cnt; -} repeatobject; - -static PyTypeObject repeat_type; - -static PyObject * -repeat_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - repeatobject *ro; - PyObject *element; - Py_ssize_t cnt = -1, n_kwds = 0; - static char *kwargs[] = {"object", "times", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|n:repeat", kwargs, - &element, &cnt)) - return NULL; - - if (kwds != NULL) - n_kwds = PyDict_Size(kwds); - /* Does user supply times argument? */ - if ((PyTuple_Size(args) + n_kwds == 2) && cnt < 0) - cnt = 0; - - ro = (repeatobject *)type->tp_alloc(type, 0); - if (ro == NULL) - return NULL; - Py_INCREF(element); - ro->element = element; - ro->cnt = cnt; - return (PyObject *)ro; -} - -static void -repeat_dealloc(repeatobject *ro) -{ - PyObject_GC_UnTrack(ro); - Py_XDECREF(ro->element); - Py_TYPE(ro)->tp_free(ro); -} - -static int -repeat_traverse(repeatobject *ro, visitproc visit, void *arg) -{ - Py_VISIT(ro->element); - return 0; -} - -static PyObject * -repeat_next(repeatobject *ro) -{ - if (ro->cnt == 0) - return NULL; - if (ro->cnt > 0) - ro->cnt--; - Py_INCREF(ro->element); - return ro->element; -} - -static PyObject * -repeat_repr(repeatobject *ro) -{ - PyObject *result, *objrepr; - - objrepr = PyObject_Repr(ro->element); - if (objrepr == NULL) - return NULL; - - if (ro->cnt == -1) - result = PyString_FromFormat("repeat(%s)", - PyString_AS_STRING(objrepr)); - else - result = PyString_FromFormat("repeat(%s, %zd)", - PyString_AS_STRING(objrepr), ro->cnt); - Py_DECREF(objrepr); - return result; -} - -static PyObject * -repeat_len(repeatobject *ro) -{ - if (ro->cnt == -1) { - PyErr_SetString(PyExc_TypeError, "len() of unsized object"); - return NULL; - } - return PyInt_FromSize_t(ro->cnt); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef repeat_methods[] = { - {"__length_hint__", (PyCFunction)repeat_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(repeat_doc, -"repeat(object [,times]) -> create an iterator which returns the object\n\ -for the specified number of times. If not specified, returns the object\n\ -endlessly."); - -static PyTypeObject repeat_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.repeat", /* tp_name */ - sizeof(repeatobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)repeat_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)repeat_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - repeat_doc, /* tp_doc */ - (traverseproc)repeat_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)repeat_next, /* tp_iternext */ - repeat_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - repeat_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* iziplongest object ************************************************************/ - -#include "Python.h" - -typedef struct { - PyObject_HEAD - Py_ssize_t tuplesize; - Py_ssize_t numactive; - PyObject *ittuple; /* tuple of iterators */ - PyObject *result; - PyObject *fillvalue; -} iziplongestobject; - -static PyTypeObject iziplongest_type; - -static PyObject * -izip_longest_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - iziplongestobject *lz; - Py_ssize_t i; - PyObject *ittuple; /* tuple of iterators */ - PyObject *result; - PyObject *fillvalue = Py_None; - Py_ssize_t tuplesize = PySequence_Length(args); - - if (kwds != NULL && PyDict_CheckExact(kwds) && PyDict_Size(kwds) > 0) { - fillvalue = PyDict_GetItemString(kwds, "fillvalue"); - if (fillvalue == NULL || PyDict_Size(kwds) > 1) { - PyErr_SetString(PyExc_TypeError, - "izip_longest() got an unexpected keyword argument"); - return NULL; - } - } - - /* args must be a tuple */ - assert(PyTuple_Check(args)); - - /* obtain iterators */ - ittuple = PyTuple_New(tuplesize); - if (ittuple == NULL) - return NULL; - for (i=0; i < tuplesize; ++i) { - PyObject *item = PyTuple_GET_ITEM(args, i); - PyObject *it = PyObject_GetIter(item); - if (it == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, - "izip_longest argument #%zd must support iteration", - i+1); - Py_DECREF(ittuple); - return NULL; - } - PyTuple_SET_ITEM(ittuple, i, it); - } - - /* create a result holder */ - result = PyTuple_New(tuplesize); - if (result == NULL) { - Py_DECREF(ittuple); - return NULL; - } - for (i=0 ; i < tuplesize ; i++) { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(result, i, Py_None); - } - - /* create iziplongestobject structure */ - lz = (iziplongestobject *)type->tp_alloc(type, 0); - if (lz == NULL) { - Py_DECREF(ittuple); - Py_DECREF(result); - return NULL; - } - lz->ittuple = ittuple; - lz->tuplesize = tuplesize; - lz->numactive = tuplesize; - lz->result = result; - Py_INCREF(fillvalue); - lz->fillvalue = fillvalue; - return (PyObject *)lz; -} - -static void -izip_longest_dealloc(iziplongestobject *lz) -{ - PyObject_GC_UnTrack(lz); - Py_XDECREF(lz->ittuple); - Py_XDECREF(lz->result); - Py_XDECREF(lz->fillvalue); - Py_TYPE(lz)->tp_free(lz); -} - -static int -izip_longest_traverse(iziplongestobject *lz, visitproc visit, void *arg) -{ - Py_VISIT(lz->ittuple); - Py_VISIT(lz->result); - Py_VISIT(lz->fillvalue); - return 0; -} - -static PyObject * -izip_longest_next(iziplongestobject *lz) -{ - Py_ssize_t i; - Py_ssize_t tuplesize = lz->tuplesize; - PyObject *result = lz->result; - PyObject *it; - PyObject *item; - PyObject *olditem; - - if (tuplesize == 0) - return NULL; - if (lz->numactive == 0) - return NULL; - if (Py_REFCNT(result) == 1) { - Py_INCREF(result); - for (i=0 ; i < tuplesize ; i++) { - it = PyTuple_GET_ITEM(lz->ittuple, i); - if (it == NULL) { - Py_INCREF(lz->fillvalue); - item = lz->fillvalue; - } else { - item = PyIter_Next(it); - if (item == NULL) { - lz->numactive -= 1; - if (lz->numactive == 0 || PyErr_Occurred()) { - lz->numactive = 0; - Py_DECREF(result); - return NULL; - } else { - Py_INCREF(lz->fillvalue); - item = lz->fillvalue; - PyTuple_SET_ITEM(lz->ittuple, i, NULL); - Py_DECREF(it); - } - } - } - olditem = PyTuple_GET_ITEM(result, i); - PyTuple_SET_ITEM(result, i, item); - Py_DECREF(olditem); - } - } else { - result = PyTuple_New(tuplesize); - if (result == NULL) - return NULL; - for (i=0 ; i < tuplesize ; i++) { - it = PyTuple_GET_ITEM(lz->ittuple, i); - if (it == NULL) { - Py_INCREF(lz->fillvalue); - item = lz->fillvalue; - } else { - item = PyIter_Next(it); - if (item == NULL) { - lz->numactive -= 1; - if (lz->numactive == 0 || PyErr_Occurred()) { - lz->numactive = 0; - Py_DECREF(result); - return NULL; - } else { - Py_INCREF(lz->fillvalue); - item = lz->fillvalue; - PyTuple_SET_ITEM(lz->ittuple, i, NULL); - Py_DECREF(it); - } - } - } - PyTuple_SET_ITEM(result, i, item); - } - } - return result; -} - -PyDoc_STRVAR(izip_longest_doc, -"izip_longest(iter1 [,iter2 [...]], [fillvalue=None]) --> izip_longest object\n\ -\n\ -Return an izip_longest object whose .next() method returns a tuple where\n\ -the i-th element comes from the i-th iterable argument. The .next()\n\ -method continues until the longest iterable in the argument sequence\n\ -is exhausted and then it raises StopIteration. When the shorter iterables\n\ -are exhausted, the fillvalue is substituted in their place. The fillvalue\n\ -defaults to None or can be specified by a keyword argument.\n\ -"); - -static PyTypeObject iziplongest_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "itertools.izip_longest", /* tp_name */ - sizeof(iziplongestobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)izip_longest_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - izip_longest_doc, /* tp_doc */ - (traverseproc)izip_longest_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)izip_longest_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - izip_longest_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* module level code ********************************************************/ - -PyDoc_STRVAR(module_doc, -"Functional tools for creating and using iterators.\n\ -\n\ -Infinite iterators:\n\ -count([n]) --> n, n+1, n+2, ...\n\ -cycle(p) --> p0, p1, ... plast, p0, p1, ...\n\ -repeat(elem [,n]) --> elem, elem, elem, ... endlessly or up to n times\n\ -\n\ -Iterators terminating on the shortest input sequence:\n\ -chain(p, q, ...) --> p0, p1, ... plast, q0, q1, ... \n\ -compress(data, selectors) --> (d[0] if s[0]), (d[1] if s[1]), ...\n\ -dropwhile(pred, seq) --> seq[n], seq[n+1], starting when pred fails\n\ -groupby(iterable[, keyfunc]) --> sub-iterators grouped by value of keyfunc(v)\n\ -ifilter(pred, seq) --> elements of seq where pred(elem) is True\n\ -ifilterfalse(pred, seq) --> elements of seq where pred(elem) is False\n\ -islice(seq, [start,] stop [, step]) --> elements from\n\ - seq[start:stop:step]\n\ -imap(fun, p, q, ...) --> fun(p0, q0), fun(p1, q1), ...\n\ -starmap(fun, seq) --> fun(*seq[0]), fun(*seq[1]), ...\n\ -tee(it, n=2) --> (it1, it2 , ... itn) splits one iterator into n\n\ -takewhile(pred, seq) --> seq[0], seq[1], until pred fails\n\ -izip(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... \n\ -izip_longest(p, q, ...) --> (p[0], q[0]), (p[1], q[1]), ... \n\ -\n\ -Combinatoric generators:\n\ -product(p, q, ... [repeat=1]) --> cartesian product\n\ -permutations(p[, r])\n\ -combinations(p, r)\n\ -combinations_with_replacement(p, r)\n\ -"); - - -static PyMethodDef module_methods[] = { - {"tee", (PyCFunction)tee, METH_VARARGS, tee_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -inititertools(void) -{ - int i; - PyObject *m; - char *name; - PyTypeObject *typelist[] = { - &combinations_type, - &cwr_type, - &cycle_type, - &dropwhile_type, - &takewhile_type, - &islice_type, - &starmap_type, - &imap_type, - &chain_type, - &compress_type, - &ifilter_type, - &ifilterfalse_type, - &count_type, - &izip_type, - &iziplongest_type, - &permutations_type, - &product_type, - &repeat_type, - &groupby_type, - NULL - }; - - Py_TYPE(&teedataobject_type) = &PyType_Type; - m = Py_InitModule3("itertools", module_methods, module_doc); - if (m == NULL) - return; - - for (i=0 ; typelist[i] != NULL ; i++) { - if (PyType_Ready(typelist[i]) < 0) - return; - name = strchr(typelist[i]->tp_name, '.'); - assert (name != NULL); - Py_INCREF(typelist[i]); - PyModule_AddObject(m, name+1, (PyObject *)typelist[i]); - } - - if (PyType_Ready(&teedataobject_type) < 0) - return; - if (PyType_Ready(&tee_type) < 0) - return; - if (PyType_Ready(&_grouper_type) < 0) - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/mathmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/mathmodule.c deleted file mode 100644 index 99dcf39..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/mathmodule.c +++ /dev/null @@ -1,1634 +0,0 @@ -/* Math module -- standard C math library functions, pi and e */ - -/* Here are some comments from Tim Peters, extracted from the - discussion attached to http://bugs.python.org/issue1640. They - describe the general aims of the math module with respect to - special values, IEEE-754 floating-point exceptions, and Python - exceptions. - -These are the "spirit of 754" rules: - -1. If the mathematical result is a real number, but of magnitude too -large to approximate by a machine float, overflow is signaled and the -result is an infinity (with the appropriate sign). - -2. If the mathematical result is a real number, but of magnitude too -small to approximate by a machine float, underflow is signaled and the -result is a zero (with the appropriate sign). - -3. At a singularity (a value x such that the limit of f(y) as y -approaches x exists and is an infinity), "divide by zero" is signaled -and the result is an infinity (with the appropriate sign). This is -complicated a little by that the left-side and right-side limits may -not be the same; e.g., 1/x approaches +inf or -inf as x approaches 0 -from the positive or negative directions. In that specific case, the -sign of the zero determines the result of 1/0. - -4. At a point where a function has no defined result in the extended -reals (i.e., the reals plus an infinity or two), invalid operation is -signaled and a NaN is returned. - -And these are what Python has historically /tried/ to do (but not -always successfully, as platform libm behavior varies a lot): - -For #1, raise OverflowError. - -For #2, return a zero (with the appropriate sign if that happens by -accident ;-)). - -For #3 and #4, raise ValueError. It may have made sense to raise -Python's ZeroDivisionError in #3, but historically that's only been -raised for division by zero and mod by zero. - -*/ - -/* - In general, on an IEEE-754 platform the aim is to follow the C99 - standard, including Annex 'F', whenever possible. Where the - standard recommends raising the 'divide-by-zero' or 'invalid' - floating-point exceptions, Python should raise a ValueError. Where - the standard recommends raising 'overflow', Python should raise an - OverflowError. In all other circumstances a value should be - returned. - */ - -#include "Python.h" -#include "_math.h" - -#ifdef _OSF_SOURCE -/* OSF1 5.1 doesn't make this available with XOPEN_SOURCE_EXTENDED defined */ -extern double copysign(double, double); -#endif - -/* - sin(pi*x), giving accurate results for all finite x (especially x - integral or close to an integer). This is here for use in the - reflection formula for the gamma function. It conforms to IEEE - 754-2008 for finite arguments, but not for infinities or nans. -*/ - -static const double pi = 3.141592653589793238462643383279502884197; -static const double sqrtpi = 1.772453850905516027298167483341145182798; - -static double -sinpi(double x) -{ - double y, r; - int n; - /* this function should only ever be called for finite arguments */ - assert(Py_IS_FINITE(x)); - y = fmod(fabs(x), 2.0); - n = (int)round(2.0*y); - assert(0 <= n && n <= 4); - switch (n) { - case 0: - r = sin(pi*y); - break; - case 1: - r = cos(pi*(y-0.5)); - break; - case 2: - /* N.B. -sin(pi*(y-1.0)) is *not* equivalent: it would give - -0.0 instead of 0.0 when y == 1.0. */ - r = sin(pi*(1.0-y)); - break; - case 3: - r = -cos(pi*(y-1.5)); - break; - case 4: - r = sin(pi*(y-2.0)); - break; - default: - assert(0); /* should never get here */ - r = -1.23e200; /* silence gcc warning */ - } - return copysign(1.0, x)*r; -} - -/* Implementation of the real gamma function. In extensive but non-exhaustive - random tests, this function proved accurate to within <= 10 ulps across the - entire float domain. Note that accuracy may depend on the quality of the - system math functions, the pow function in particular. Special cases - follow C99 annex F. The parameters and method are tailored to platforms - whose double format is the IEEE 754 binary64 format. - - Method: for x > 0.0 we use the Lanczos approximation with parameters N=13 - and g=6.024680040776729583740234375; these parameters are amongst those - used by the Boost library. Following Boost (again), we re-express the - Lanczos sum as a rational function, and compute it that way. The - coefficients below were computed independently using MPFR, and have been - double-checked against the coefficients in the Boost source code. - - For x < 0.0 we use the reflection formula. - - There's one minor tweak that deserves explanation: Lanczos' formula for - Gamma(x) involves computing pow(x+g-0.5, x-0.5) / exp(x+g-0.5). For many x - values, x+g-0.5 can be represented exactly. However, in cases where it - can't be represented exactly the small error in x+g-0.5 can be magnified - significantly by the pow and exp calls, especially for large x. A cheap - correction is to multiply by (1 + e*g/(x+g-0.5)), where e is the error - involved in the computation of x+g-0.5 (that is, e = computed value of - x+g-0.5 - exact value of x+g-0.5). Here's the proof: - - Correction factor - ----------------- - Write x+g-0.5 = y-e, where y is exactly representable as an IEEE 754 - double, and e is tiny. Then: - - pow(x+g-0.5,x-0.5)/exp(x+g-0.5) = pow(y-e, x-0.5)/exp(y-e) - = pow(y, x-0.5)/exp(y) * C, - - where the correction_factor C is given by - - C = pow(1-e/y, x-0.5) * exp(e) - - Since e is tiny, pow(1-e/y, x-0.5) ~ 1-(x-0.5)*e/y, and exp(x) ~ 1+e, so: - - C ~ (1-(x-0.5)*e/y) * (1+e) ~ 1 + e*(y-(x-0.5))/y - - But y-(x-0.5) = g+e, and g+e ~ g. So we get C ~ 1 + e*g/y, and - - pow(x+g-0.5,x-0.5)/exp(x+g-0.5) ~ pow(y, x-0.5)/exp(y) * (1 + e*g/y), - - Note that for accuracy, when computing r*C it's better to do - - r + e*g/y*r; - - than - - r * (1 + e*g/y); - - since the addition in the latter throws away most of the bits of - information in e*g/y. -*/ - -#define LANCZOS_N 13 -static const double lanczos_g = 6.024680040776729583740234375; -static const double lanczos_g_minus_half = 5.524680040776729583740234375; -static const double lanczos_num_coeffs[LANCZOS_N] = { - 23531376880.410759688572007674451636754734846804940, - 42919803642.649098768957899047001988850926355848959, - 35711959237.355668049440185451547166705960488635843, - 17921034426.037209699919755754458931112671403265390, - 6039542586.3520280050642916443072979210699388420708, - 1439720407.3117216736632230727949123939715485786772, - 248874557.86205415651146038641322942321632125127801, - 31426415.585400194380614231628318205362874684987640, - 2876370.6289353724412254090516208496135991145378768, - 186056.26539522349504029498971604569928220784236328, - 8071.6720023658162106380029022722506138218516325024, - 210.82427775157934587250973392071336271166969580291, - 2.5066282746310002701649081771338373386264310793408 -}; - -/* denominator is x*(x+1)*...*(x+LANCZOS_N-2) */ -static const double lanczos_den_coeffs[LANCZOS_N] = { - 0.0, 39916800.0, 120543840.0, 150917976.0, 105258076.0, 45995730.0, - 13339535.0, 2637558.0, 357423.0, 32670.0, 1925.0, 66.0, 1.0}; - -/* gamma values for small positive integers, 1 though NGAMMA_INTEGRAL */ -#define NGAMMA_INTEGRAL 23 -static const double gamma_integral[NGAMMA_INTEGRAL] = { - 1.0, 1.0, 2.0, 6.0, 24.0, 120.0, 720.0, 5040.0, 40320.0, 362880.0, - 3628800.0, 39916800.0, 479001600.0, 6227020800.0, 87178291200.0, - 1307674368000.0, 20922789888000.0, 355687428096000.0, - 6402373705728000.0, 121645100408832000.0, 2432902008176640000.0, - 51090942171709440000.0, 1124000727777607680000.0, -}; - -/* Lanczos' sum L_g(x), for positive x */ - -static double -lanczos_sum(double x) -{ - double num = 0.0, den = 0.0; - int i; - assert(x > 0.0); - /* evaluate the rational function lanczos_sum(x). For large - x, the obvious algorithm risks overflow, so we instead - rescale the denominator and numerator of the rational - function by x**(1-LANCZOS_N) and treat this as a - rational function in 1/x. This also reduces the error for - larger x values. The choice of cutoff point (5.0 below) is - somewhat arbitrary; in tests, smaller cutoff values than - this resulted in lower accuracy. */ - if (x < 5.0) { - for (i = LANCZOS_N; --i >= 0; ) { - num = num * x + lanczos_num_coeffs[i]; - den = den * x + lanczos_den_coeffs[i]; - } - } - else { - for (i = 0; i < LANCZOS_N; i++) { - num = num / x + lanczos_num_coeffs[i]; - den = den / x + lanczos_den_coeffs[i]; - } - } - return num/den; -} - -static double -m_tgamma(double x) -{ - double absx, r, y, z, sqrtpow; - - /* special cases */ - if (!Py_IS_FINITE(x)) { - if (Py_IS_NAN(x) || x > 0.0) - return x; /* tgamma(nan) = nan, tgamma(inf) = inf */ - else { - errno = EDOM; - return Py_NAN; /* tgamma(-inf) = nan, invalid */ - } - } - if (x == 0.0) { - errno = EDOM; - return 1.0/x; /* tgamma(+-0.0) = +-inf, divide-by-zero */ - } - - /* integer arguments */ - if (x == floor(x)) { - if (x < 0.0) { - errno = EDOM; /* tgamma(n) = nan, invalid for */ - return Py_NAN; /* negative integers n */ - } - if (x <= NGAMMA_INTEGRAL) - return gamma_integral[(int)x - 1]; - } - absx = fabs(x); - - /* tiny arguments: tgamma(x) ~ 1/x for x near 0 */ - if (absx < 1e-20) { - r = 1.0/x; - if (Py_IS_INFINITY(r)) - errno = ERANGE; - return r; - } - - /* large arguments: assuming IEEE 754 doubles, tgamma(x) overflows for - x > 200, and underflows to +-0.0 for x < -200, not a negative - integer. */ - if (absx > 200.0) { - if (x < 0.0) { - return 0.0/sinpi(x); - } - else { - errno = ERANGE; - return Py_HUGE_VAL; - } - } - - y = absx + lanczos_g_minus_half; - /* compute error in sum */ - if (absx > lanczos_g_minus_half) { - /* note: the correction can be foiled by an optimizing - compiler that (incorrectly) thinks that an expression like - a + b - a - b can be optimized to 0.0. This shouldn't - happen in a standards-conforming compiler. */ - double q = y - absx; - z = q - lanczos_g_minus_half; - } - else { - double q = y - lanczos_g_minus_half; - z = q - absx; - } - z = z * lanczos_g / y; - if (x < 0.0) { - r = -pi / sinpi(absx) / absx * exp(y) / lanczos_sum(absx); - r -= z * r; - if (absx < 140.0) { - r /= pow(y, absx - 0.5); - } - else { - sqrtpow = pow(y, absx / 2.0 - 0.25); - r /= sqrtpow; - r /= sqrtpow; - } - } - else { - r = lanczos_sum(absx) / exp(y); - r += z * r; - if (absx < 140.0) { - r *= pow(y, absx - 0.5); - } - else { - sqrtpow = pow(y, absx / 2.0 - 0.25); - r *= sqrtpow; - r *= sqrtpow; - } - } - if (Py_IS_INFINITY(r)) - errno = ERANGE; - return r; -} - -/* - lgamma: natural log of the absolute value of the Gamma function. - For large arguments, Lanczos' formula works extremely well here. -*/ - -static double -m_lgamma(double x) -{ - double r, absx; - - /* special cases */ - if (!Py_IS_FINITE(x)) { - if (Py_IS_NAN(x)) - return x; /* lgamma(nan) = nan */ - else - return Py_HUGE_VAL; /* lgamma(+-inf) = +inf */ - } - - /* integer arguments */ - if (x == floor(x) && x <= 2.0) { - if (x <= 0.0) { - errno = EDOM; /* lgamma(n) = inf, divide-by-zero for */ - return Py_HUGE_VAL; /* integers n <= 0 */ - } - else { - return 0.0; /* lgamma(1) = lgamma(2) = 0.0 */ - } - } - - absx = fabs(x); - /* tiny arguments: lgamma(x) ~ -log(fabs(x)) for small x */ - if (absx < 1e-20) - return -log(absx); - - /* Lanczos' formula */ - if (x > 0.0) { - /* we could save a fraction of a ulp in accuracy by having a - second set of numerator coefficients for lanczos_sum that - absorbed the exp(-lanczos_g) term, and throwing out the - lanczos_g subtraction below; it's probably not worth it. */ - r = log(lanczos_sum(x)) - lanczos_g + - (x-0.5)*(log(x+lanczos_g-0.5)-1); - } - else { - r = log(pi) - log(fabs(sinpi(absx))) - log(absx) - - (log(lanczos_sum(absx)) - lanczos_g + - (absx-0.5)*(log(absx+lanczos_g-0.5)-1)); - } - if (Py_IS_INFINITY(r)) - errno = ERANGE; - return r; -} - -/* - Implementations of the error function erf(x) and the complementary error - function erfc(x). - - Method: following 'Numerical Recipes' by Flannery, Press et. al. (2nd ed., - Cambridge University Press), we use a series approximation for erf for - small x, and a continued fraction approximation for erfc(x) for larger x; - combined with the relations erf(-x) = -erf(x) and erfc(x) = 1.0 - erf(x), - this gives us erf(x) and erfc(x) for all x. - - The series expansion used is: - - erf(x) = x*exp(-x*x)/sqrt(pi) * [ - 2/1 + 4/3 x**2 + 8/15 x**4 + 16/105 x**6 + ...] - - The coefficient of x**(2k-2) here is 4**k*factorial(k)/factorial(2*k). - This series converges well for smallish x, but slowly for larger x. - - The continued fraction expansion used is: - - erfc(x) = x*exp(-x*x)/sqrt(pi) * [1/(0.5 + x**2 -) 0.5/(2.5 + x**2 - ) - 3.0/(4.5 + x**2 - ) 7.5/(6.5 + x**2 - ) ...] - - after the first term, the general term has the form: - - k*(k-0.5)/(2*k+0.5 + x**2 - ...). - - This expansion converges fast for larger x, but convergence becomes - infinitely slow as x approaches 0.0. The (somewhat naive) continued - fraction evaluation algorithm used below also risks overflow for large x; - but for large x, erfc(x) == 0.0 to within machine precision. (For - example, erfc(30.0) is approximately 2.56e-393). - - Parameters: use series expansion for abs(x) < ERF_SERIES_CUTOFF and - continued fraction expansion for ERF_SERIES_CUTOFF <= abs(x) < - ERFC_CONTFRAC_CUTOFF. ERFC_SERIES_TERMS and ERFC_CONTFRAC_TERMS are the - numbers of terms to use for the relevant expansions. */ - -#define ERF_SERIES_CUTOFF 1.5 -#define ERF_SERIES_TERMS 25 -#define ERFC_CONTFRAC_CUTOFF 30.0 -#define ERFC_CONTFRAC_TERMS 50 - -/* - Error function, via power series. - - Given a finite float x, return an approximation to erf(x). - Converges reasonably fast for small x. -*/ - -static double -m_erf_series(double x) -{ - double x2, acc, fk, result; - int i, saved_errno; - - x2 = x * x; - acc = 0.0; - fk = (double)ERF_SERIES_TERMS + 0.5; - for (i = 0; i < ERF_SERIES_TERMS; i++) { - acc = 2.0 + x2 * acc / fk; - fk -= 1.0; - } - /* Make sure the exp call doesn't affect errno; - see m_erfc_contfrac for more. */ - saved_errno = errno; - result = acc * x * exp(-x2) / sqrtpi; - errno = saved_errno; - return result; -} - -/* - Complementary error function, via continued fraction expansion. - - Given a positive float x, return an approximation to erfc(x). Converges - reasonably fast for x large (say, x > 2.0), and should be safe from - overflow if x and nterms are not too large. On an IEEE 754 machine, with x - <= 30.0, we're safe up to nterms = 100. For x >= 30.0, erfc(x) is smaller - than the smallest representable nonzero float. */ - -static double -m_erfc_contfrac(double x) -{ - double x2, a, da, p, p_last, q, q_last, b, result; - int i, saved_errno; - - if (x >= ERFC_CONTFRAC_CUTOFF) - return 0.0; - - x2 = x*x; - a = 0.0; - da = 0.5; - p = 1.0; p_last = 0.0; - q = da + x2; q_last = 1.0; - for (i = 0; i < ERFC_CONTFRAC_TERMS; i++) { - double temp; - a += da; - da += 2.0; - b = da + x2; - temp = p; p = b*p - a*p_last; p_last = temp; - temp = q; q = b*q - a*q_last; q_last = temp; - } - /* Issue #8986: On some platforms, exp sets errno on underflow to zero; - save the current errno value so that we can restore it later. */ - saved_errno = errno; - result = p / q * x * exp(-x2) / sqrtpi; - errno = saved_errno; - return result; -} - -/* Error function erf(x), for general x */ - -static double -m_erf(double x) -{ - double absx, cf; - - if (Py_IS_NAN(x)) - return x; - absx = fabs(x); - if (absx < ERF_SERIES_CUTOFF) - return m_erf_series(x); - else { - cf = m_erfc_contfrac(absx); - return x > 0.0 ? 1.0 - cf : cf - 1.0; - } -} - -/* Complementary error function erfc(x), for general x. */ - -static double -m_erfc(double x) -{ - double absx, cf; - - if (Py_IS_NAN(x)) - return x; - absx = fabs(x); - if (absx < ERF_SERIES_CUTOFF) - return 1.0 - m_erf_series(x); - else { - cf = m_erfc_contfrac(absx); - return x > 0.0 ? cf : 2.0 - cf; - } -} - -/* - wrapper for atan2 that deals directly with special cases before - delegating to the platform libm for the remaining cases. This - is necessary to get consistent behaviour across platforms. - Windows, FreeBSD and alpha Tru64 are amongst platforms that don't - always follow C99. -*/ - -static double -m_atan2(double y, double x) -{ - if (Py_IS_NAN(x) || Py_IS_NAN(y)) - return Py_NAN; - if (Py_IS_INFINITY(y)) { - if (Py_IS_INFINITY(x)) { - if (copysign(1., x) == 1.) - /* atan2(+-inf, +inf) == +-pi/4 */ - return copysign(0.25*Py_MATH_PI, y); - else - /* atan2(+-inf, -inf) == +-pi*3/4 */ - return copysign(0.75*Py_MATH_PI, y); - } - /* atan2(+-inf, x) == +-pi/2 for finite x */ - return copysign(0.5*Py_MATH_PI, y); - } - if (Py_IS_INFINITY(x) || y == 0.) { - if (copysign(1., x) == 1.) - /* atan2(+-y, +inf) = atan2(+-0, +x) = +-0. */ - return copysign(0., y); - else - /* atan2(+-y, -inf) = atan2(+-0., -x) = +-pi. */ - return copysign(Py_MATH_PI, y); - } - return atan2(y, x); -} - -/* - Various platforms (Solaris, OpenBSD) do nonstandard things for log(0), - log(-ve), log(NaN). Here are wrappers for log and log10 that deal with - special values directly, passing positive non-special values through to - the system log/log10. - */ - -static double -m_log(double x) -{ - if (Py_IS_FINITE(x)) { - if (x > 0.0) - return log(x); - errno = EDOM; - if (x == 0.0) - return -Py_HUGE_VAL; /* log(0) = -inf */ - else - return Py_NAN; /* log(-ve) = nan */ - } - else if (Py_IS_NAN(x)) - return x; /* log(nan) = nan */ - else if (x > 0.0) - return x; /* log(inf) = inf */ - else { - errno = EDOM; - return Py_NAN; /* log(-inf) = nan */ - } -} - -static double -m_log10(double x) -{ - if (Py_IS_FINITE(x)) { - if (x > 0.0) - return log10(x); - errno = EDOM; - if (x == 0.0) - return -Py_HUGE_VAL; /* log10(0) = -inf */ - else - return Py_NAN; /* log10(-ve) = nan */ - } - else if (Py_IS_NAN(x)) - return x; /* log10(nan) = nan */ - else if (x > 0.0) - return x; /* log10(inf) = inf */ - else { - errno = EDOM; - return Py_NAN; /* log10(-inf) = nan */ - } -} - - -/* Call is_error when errno != 0, and where x is the result libm - * returned. is_error will usually set up an exception and return - * true (1), but may return false (0) without setting up an exception. - */ -static int -is_error(double x) -{ - int result = 1; /* presumption of guilt */ - assert(errno); /* non-zero errno is a precondition for calling */ - if (errno == EDOM) - PyErr_SetString(PyExc_ValueError, "math domain error"); - - else if (errno == ERANGE) { - /* ANSI C generally requires libm functions to set ERANGE - * on overflow, but also generally *allows* them to set - * ERANGE on underflow too. There's no consistency about - * the latter across platforms. - * Alas, C99 never requires that errno be set. - * Here we suppress the underflow errors (libm functions - * should return a zero on underflow, and +- HUGE_VAL on - * overflow, so testing the result for zero suffices to - * distinguish the cases). - * - * On some platforms (Ubuntu/ia64) it seems that errno can be - * set to ERANGE for subnormal results that do *not* underflow - * to zero. So to be safe, we'll ignore ERANGE whenever the - * function result is less than one in absolute value. - */ - if (fabs(x) < 1.0) - result = 0; - else - PyErr_SetString(PyExc_OverflowError, - "math range error"); - } - else - /* Unexpected math error */ - PyErr_SetFromErrno(PyExc_ValueError); - return result; -} - -/* - math_1 is used to wrap a libm function f that takes a double - arguments and returns a double. - - The error reporting follows these rules, which are designed to do - the right thing on C89/C99 platforms and IEEE 754/non IEEE 754 - platforms. - - - a NaN result from non-NaN inputs causes ValueError to be raised - - an infinite result from finite inputs causes OverflowError to be - raised if can_overflow is 1, or raises ValueError if can_overflow - is 0. - - if the result is finite and errno == EDOM then ValueError is - raised - - if the result is finite and nonzero and errno == ERANGE then - OverflowError is raised - - The last rule is used to catch overflow on platforms which follow - C89 but for which HUGE_VAL is not an infinity. - - For the majority of one-argument functions these rules are enough - to ensure that Python's functions behave as specified in 'Annex F' - of the C99 standard, with the 'invalid' and 'divide-by-zero' - floating-point exceptions mapping to Python's ValueError and the - 'overflow' floating-point exception mapping to OverflowError. - math_1 only works for functions that don't have singularities *and* - the possibility of overflow; fortunately, that covers everything we - care about right now. -*/ - -static PyObject * -math_1(PyObject *arg, double (*func) (double), int can_overflow) -{ - double x, r; - x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - errno = 0; - PyFPE_START_PROTECT("in math_1", return 0); - r = (*func)(x); - PyFPE_END_PROTECT(r); - if (Py_IS_NAN(r)) { - if (!Py_IS_NAN(x)) - errno = EDOM; - else - errno = 0; - } - else if (Py_IS_INFINITY(r)) { - if (Py_IS_FINITE(x)) - errno = can_overflow ? ERANGE : EDOM; - else - errno = 0; - } - if (errno && is_error(r)) - return NULL; - else - return PyFloat_FromDouble(r); -} - -/* variant of math_1, to be used when the function being wrapped is known to - set errno properly (that is, errno = EDOM for invalid or divide-by-zero, - errno = ERANGE for overflow). */ - -static PyObject * -math_1a(PyObject *arg, double (*func) (double)) -{ - double x, r; - x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - errno = 0; - PyFPE_START_PROTECT("in math_1a", return 0); - r = (*func)(x); - PyFPE_END_PROTECT(r); - if (errno && is_error(r)) - return NULL; - return PyFloat_FromDouble(r); -} - -/* - math_2 is used to wrap a libm function f that takes two double - arguments and returns a double. - - The error reporting follows these rules, which are designed to do - the right thing on C89/C99 platforms and IEEE 754/non IEEE 754 - platforms. - - - a NaN result from non-NaN inputs causes ValueError to be raised - - an infinite result from finite inputs causes OverflowError to be - raised. - - if the result is finite and errno == EDOM then ValueError is - raised - - if the result is finite and nonzero and errno == ERANGE then - OverflowError is raised - - The last rule is used to catch overflow on platforms which follow - C89 but for which HUGE_VAL is not an infinity. - - For most two-argument functions (copysign, fmod, hypot, atan2) - these rules are enough to ensure that Python's functions behave as - specified in 'Annex F' of the C99 standard, with the 'invalid' and - 'divide-by-zero' floating-point exceptions mapping to Python's - ValueError and the 'overflow' floating-point exception mapping to - OverflowError. -*/ - -static PyObject * -math_2(PyObject *args, double (*func) (double, double), char *funcname) -{ - PyObject *ox, *oy; - double x, y, r; - if (! PyArg_UnpackTuple(args, funcname, 2, 2, &ox, &oy)) - return NULL; - x = PyFloat_AsDouble(ox); - y = PyFloat_AsDouble(oy); - if ((x == -1.0 || y == -1.0) && PyErr_Occurred()) - return NULL; - errno = 0; - PyFPE_START_PROTECT("in math_2", return 0); - r = (*func)(x, y); - PyFPE_END_PROTECT(r); - if (Py_IS_NAN(r)) { - if (!Py_IS_NAN(x) && !Py_IS_NAN(y)) - errno = EDOM; - else - errno = 0; - } - else if (Py_IS_INFINITY(r)) { - if (Py_IS_FINITE(x) && Py_IS_FINITE(y)) - errno = ERANGE; - else - errno = 0; - } - if (errno && is_error(r)) - return NULL; - else - return PyFloat_FromDouble(r); -} - -#define FUNC1(funcname, func, can_overflow, docstring) \ - static PyObject * math_##funcname(PyObject *self, PyObject *args) { \ - return math_1(args, func, can_overflow); \ - }\ - PyDoc_STRVAR(math_##funcname##_doc, docstring); - -#define FUNC1A(funcname, func, docstring) \ - static PyObject * math_##funcname(PyObject *self, PyObject *args) { \ - return math_1a(args, func); \ - }\ - PyDoc_STRVAR(math_##funcname##_doc, docstring); - -#define FUNC2(funcname, func, docstring) \ - static PyObject * math_##funcname(PyObject *self, PyObject *args) { \ - return math_2(args, func, #funcname); \ - }\ - PyDoc_STRVAR(math_##funcname##_doc, docstring); - -FUNC1(acos, acos, 0, - "acos(x)\n\nReturn the arc cosine (measured in radians) of x.") -FUNC1(acosh, m_acosh, 0, - "acosh(x)\n\nReturn the inverse hyperbolic cosine of x.") -FUNC1(asin, asin, 0, - "asin(x)\n\nReturn the arc sine (measured in radians) of x.") -FUNC1(asinh, m_asinh, 0, - "asinh(x)\n\nReturn the inverse hyperbolic sine of x.") -FUNC1(atan, atan, 0, - "atan(x)\n\nReturn the arc tangent (measured in radians) of x.") -FUNC2(atan2, m_atan2, - "atan2(y, x)\n\nReturn the arc tangent (measured in radians) of y/x.\n" - "Unlike atan(y/x), the signs of both x and y are considered.") -FUNC1(atanh, m_atanh, 0, - "atanh(x)\n\nReturn the inverse hyperbolic tangent of x.") -FUNC1(ceil, ceil, 0, - "ceil(x)\n\nReturn the ceiling of x as a float.\n" - "This is the smallest integral value >= x.") -FUNC2(copysign, copysign, - "copysign(x, y)\n\nReturn x with the sign of y.") -FUNC1(cos, cos, 0, - "cos(x)\n\nReturn the cosine of x (measured in radians).") -FUNC1(cosh, cosh, 1, - "cosh(x)\n\nReturn the hyperbolic cosine of x.") -FUNC1A(erf, m_erf, - "erf(x)\n\nError function at x.") -FUNC1A(erfc, m_erfc, - "erfc(x)\n\nComplementary error function at x.") -FUNC1(exp, exp, 1, - "exp(x)\n\nReturn e raised to the power of x.") -FUNC1(expm1, m_expm1, 1, - "expm1(x)\n\nReturn exp(x)-1.\n" - "This function avoids the loss of precision involved in the direct " - "evaluation of exp(x)-1 for small x.") -FUNC1(fabs, fabs, 0, - "fabs(x)\n\nReturn the absolute value of the float x.") -FUNC1(floor, floor, 0, - "floor(x)\n\nReturn the floor of x as a float.\n" - "This is the largest integral value <= x.") -FUNC1A(gamma, m_tgamma, - "gamma(x)\n\nGamma function at x.") -FUNC1A(lgamma, m_lgamma, - "lgamma(x)\n\nNatural logarithm of absolute value of Gamma function at x.") -FUNC1(log1p, m_log1p, 1, - "log1p(x)\n\nReturn the natural logarithm of 1+x (base e).\n" - "The result is computed in a way which is accurate for x near zero.") -FUNC1(sin, sin, 0, - "sin(x)\n\nReturn the sine of x (measured in radians).") -FUNC1(sinh, sinh, 1, - "sinh(x)\n\nReturn the hyperbolic sine of x.") -FUNC1(sqrt, sqrt, 0, - "sqrt(x)\n\nReturn the square root of x.") -FUNC1(tan, tan, 0, - "tan(x)\n\nReturn the tangent of x (measured in radians).") -FUNC1(tanh, tanh, 0, - "tanh(x)\n\nReturn the hyperbolic tangent of x.") - -/* Precision summation function as msum() by Raymond Hettinger in - , - enhanced with the exact partials sum and roundoff from Mark - Dickinson's post at . - See those links for more details, proofs and other references. - - Note 1: IEEE 754R floating point semantics are assumed, - but the current implementation does not re-establish special - value semantics across iterations (i.e. handling -Inf + Inf). - - Note 2: No provision is made for intermediate overflow handling; - therefore, sum([1e+308, 1e-308, 1e+308]) returns 1e+308 while - sum([1e+308, 1e+308, 1e-308]) raises an OverflowError due to the - overflow of the first partial sum. - - Note 3: The intermediate values lo, yr, and hi are declared volatile so - aggressive compilers won't algebraically reduce lo to always be exactly 0.0. - Also, the volatile declaration forces the values to be stored in memory as - regular doubles instead of extended long precision (80-bit) values. This - prevents double rounding because any addition or subtraction of two doubles - can be resolved exactly into double-sized hi and lo values. As long as the - hi value gets forced into a double before yr and lo are computed, the extra - bits in downstream extended precision operations (x87 for example) will be - exactly zero and therefore can be losslessly stored back into a double, - thereby preventing double rounding. - - Note 4: A similar implementation is in Modules/cmathmodule.c. - Be sure to update both when making changes. - - Note 5: The signature of math.fsum() differs from __builtin__.sum() - because the start argument doesn't make sense in the context of - accurate summation. Since the partials table is collapsed before - returning a result, sum(seq2, start=sum(seq1)) may not equal the - accurate result returned by sum(itertools.chain(seq1, seq2)). -*/ - -#define NUM_PARTIALS 32 /* initial partials array size, on stack */ - -/* Extend the partials array p[] by doubling its size. */ -static int /* non-zero on error */ -_fsum_realloc(double **p_ptr, Py_ssize_t n, - double *ps, Py_ssize_t *m_ptr) -{ - void *v = NULL; - Py_ssize_t m = *m_ptr; - - m += m; /* double */ - if (n < m && m < (PY_SSIZE_T_MAX / sizeof(double))) { - double *p = *p_ptr; - if (p == ps) { - v = PyMem_Malloc(sizeof(double) * m); - if (v != NULL) - memcpy(v, ps, sizeof(double) * n); - } - else - v = PyMem_Realloc(p, sizeof(double) * m); - } - if (v == NULL) { /* size overflow or no memory */ - PyErr_SetString(PyExc_MemoryError, "math.fsum partials"); - return 1; - } - *p_ptr = (double*) v; - *m_ptr = m; - return 0; -} - -/* Full precision summation of a sequence of floats. - - def msum(iterable): - partials = [] # sorted, non-overlapping partial sums - for x in iterable: - i = 0 - for y in partials: - if abs(x) < abs(y): - x, y = y, x - hi = x + y - lo = y - (hi - x) - if lo: - partials[i] = lo - i += 1 - x = hi - partials[i:] = [x] - return sum_exact(partials) - - Rounded x+y stored in hi with the roundoff stored in lo. Together hi+lo - are exactly equal to x+y. The inner loop applies hi/lo summation to each - partial so that the list of partial sums remains exact. - - Sum_exact() adds the partial sums exactly and correctly rounds the final - result (using the round-half-to-even rule). The items in partials remain - non-zero, non-special, non-overlapping and strictly increasing in - magnitude, but possibly not all having the same sign. - - Depends on IEEE 754 arithmetic guarantees and half-even rounding. -*/ - -static PyObject* -math_fsum(PyObject *self, PyObject *seq) -{ - PyObject *item, *iter, *sum = NULL; - Py_ssize_t i, j, n = 0, m = NUM_PARTIALS; - double x, y, t, ps[NUM_PARTIALS], *p = ps; - double xsave, special_sum = 0.0, inf_sum = 0.0; - volatile double hi, yr, lo; - - iter = PyObject_GetIter(seq); - if (iter == NULL) - return NULL; - - PyFPE_START_PROTECT("fsum", Py_DECREF(iter); return NULL) - - for(;;) { /* for x in iterable */ - assert(0 <= n && n <= m); - assert((m == NUM_PARTIALS && p == ps) || - (m > NUM_PARTIALS && p != NULL)); - - item = PyIter_Next(iter); - if (item == NULL) { - if (PyErr_Occurred()) - goto _fsum_error; - break; - } - x = PyFloat_AsDouble(item); - Py_DECREF(item); - if (PyErr_Occurred()) - goto _fsum_error; - - xsave = x; - for (i = j = 0; j < n; j++) { /* for y in partials */ - y = p[j]; - if (fabs(x) < fabs(y)) { - t = x; x = y; y = t; - } - hi = x + y; - yr = hi - x; - lo = y - yr; - if (lo != 0.0) - p[i++] = lo; - x = hi; - } - - n = i; /* ps[i:] = [x] */ - if (x != 0.0) { - if (! Py_IS_FINITE(x)) { - /* a nonfinite x could arise either as - a result of intermediate overflow, or - as a result of a nan or inf in the - summands */ - if (Py_IS_FINITE(xsave)) { - PyErr_SetString(PyExc_OverflowError, - "intermediate overflow in fsum"); - goto _fsum_error; - } - if (Py_IS_INFINITY(xsave)) - inf_sum += xsave; - special_sum += xsave; - /* reset partials */ - n = 0; - } - else if (n >= m && _fsum_realloc(&p, n, ps, &m)) - goto _fsum_error; - else - p[n++] = x; - } - } - - if (special_sum != 0.0) { - if (Py_IS_NAN(inf_sum)) - PyErr_SetString(PyExc_ValueError, - "-inf + inf in fsum"); - else - sum = PyFloat_FromDouble(special_sum); - goto _fsum_error; - } - - hi = 0.0; - if (n > 0) { - hi = p[--n]; - /* sum_exact(ps, hi) from the top, stop when the sum becomes - inexact. */ - while (n > 0) { - x = hi; - y = p[--n]; - assert(fabs(y) < fabs(x)); - hi = x + y; - yr = hi - x; - lo = y - yr; - if (lo != 0.0) - break; - } - /* Make half-even rounding work across multiple partials. - Needed so that sum([1e-16, 1, 1e16]) will round-up the last - digit to two instead of down to zero (the 1e-16 makes the 1 - slightly closer to two). With a potential 1 ULP rounding - error fixed-up, math.fsum() can guarantee commutativity. */ - if (n > 0 && ((lo < 0.0 && p[n-1] < 0.0) || - (lo > 0.0 && p[n-1] > 0.0))) { - y = lo * 2.0; - x = hi + y; - yr = x - hi; - if (y == yr) - hi = x; - } - } - sum = PyFloat_FromDouble(hi); - -_fsum_error: - PyFPE_END_PROTECT(hi) - Py_DECREF(iter); - if (p != ps) - PyMem_Free(p); - return sum; -} - -#undef NUM_PARTIALS - -PyDoc_STRVAR(math_fsum_doc, -"fsum(iterable)\n\n\ -Return an accurate floating point sum of values in the iterable.\n\ -Assumes IEEE-754 floating point arithmetic."); - -static PyObject * -math_factorial(PyObject *self, PyObject *arg) -{ - long i, x; - PyObject *result, *iobj, *newresult; - - if (PyFloat_Check(arg)) { - PyObject *lx; - double dx = PyFloat_AS_DOUBLE((PyFloatObject *)arg); - if (!(Py_IS_FINITE(dx) && dx == floor(dx))) { - PyErr_SetString(PyExc_ValueError, - "factorial() only accepts integral values"); - return NULL; - } - lx = PyLong_FromDouble(dx); - if (lx == NULL) - return NULL; - x = PyLong_AsLong(lx); - Py_DECREF(lx); - } - else - x = PyInt_AsLong(arg); - - if (x == -1 && PyErr_Occurred()) - return NULL; - if (x < 0) { - PyErr_SetString(PyExc_ValueError, - "factorial() not defined for negative values"); - return NULL; - } - - result = (PyObject *)PyInt_FromLong(1); - if (result == NULL) - return NULL; - for (i=1 ; i<=x ; i++) { - iobj = (PyObject *)PyInt_FromLong(i); - if (iobj == NULL) - goto error; - newresult = PyNumber_Multiply(result, iobj); - Py_DECREF(iobj); - if (newresult == NULL) - goto error; - Py_DECREF(result); - result = newresult; - } - return result; - -error: - Py_DECREF(result); - return NULL; -} - -PyDoc_STRVAR(math_factorial_doc, -"factorial(x) -> Integral\n" -"\n" -"Find x!. Raise a ValueError if x is negative or non-integral."); - -static PyObject * -math_trunc(PyObject *self, PyObject *number) -{ - return PyObject_CallMethod(number, "__trunc__", NULL); -} - -PyDoc_STRVAR(math_trunc_doc, -"trunc(x:Real) -> Integral\n" -"\n" -"Truncates x to the nearest Integral toward 0. Uses the __trunc__ magic method."); - -static PyObject * -math_frexp(PyObject *self, PyObject *arg) -{ - int i; - double x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - /* deal with special cases directly, to sidestep platform - differences */ - if (Py_IS_NAN(x) || Py_IS_INFINITY(x) || !x) { - i = 0; - } - else { - PyFPE_START_PROTECT("in math_frexp", return 0); - x = frexp(x, &i); - PyFPE_END_PROTECT(x); - } - return Py_BuildValue("(di)", x, i); -} - -PyDoc_STRVAR(math_frexp_doc, -"frexp(x)\n" -"\n" -"Return the mantissa and exponent of x, as pair (m, e).\n" -"m is a float and e is an int, such that x = m * 2.**e.\n" -"If x is 0, m and e are both 0. Else 0.5 <= abs(m) < 1.0."); - -static PyObject * -math_ldexp(PyObject *self, PyObject *args) -{ - double x, r; - PyObject *oexp; - long exp; - int overflow; - if (! PyArg_ParseTuple(args, "dO:ldexp", &x, &oexp)) - return NULL; - - if (PyLong_Check(oexp) || PyInt_Check(oexp)) { - /* on overflow, replace exponent with either LONG_MAX - or LONG_MIN, depending on the sign. */ - exp = PyLong_AsLongAndOverflow(oexp, &overflow); - if (exp == -1 && PyErr_Occurred()) - return NULL; - if (overflow) - exp = overflow < 0 ? LONG_MIN : LONG_MAX; - } - else { - PyErr_SetString(PyExc_TypeError, - "Expected an int or long as second argument " - "to ldexp."); - return NULL; - } - - if (x == 0. || !Py_IS_FINITE(x)) { - /* NaNs, zeros and infinities are returned unchanged */ - r = x; - errno = 0; - } else if (exp > INT_MAX) { - /* overflow */ - r = copysign(Py_HUGE_VAL, x); - errno = ERANGE; - } else if (exp < INT_MIN) { - /* underflow to +-0 */ - r = copysign(0., x); - errno = 0; - } else { - errno = 0; - PyFPE_START_PROTECT("in math_ldexp", return 0); - r = ldexp(x, (int)exp); - PyFPE_END_PROTECT(r); - if (Py_IS_INFINITY(r)) - errno = ERANGE; - } - - if (errno && is_error(r)) - return NULL; - return PyFloat_FromDouble(r); -} - -PyDoc_STRVAR(math_ldexp_doc, -"ldexp(x, i)\n\n\ -Return x * (2**i)."); - -static PyObject * -math_modf(PyObject *self, PyObject *arg) -{ - double y, x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - /* some platforms don't do the right thing for NaNs and - infinities, so we take care of special cases directly. */ - if (!Py_IS_FINITE(x)) { - if (Py_IS_INFINITY(x)) - return Py_BuildValue("(dd)", copysign(0., x), x); - else if (Py_IS_NAN(x)) - return Py_BuildValue("(dd)", x, x); - } - - errno = 0; - PyFPE_START_PROTECT("in math_modf", return 0); - x = modf(x, &y); - PyFPE_END_PROTECT(x); - return Py_BuildValue("(dd)", x, y); -} - -PyDoc_STRVAR(math_modf_doc, -"modf(x)\n" -"\n" -"Return the fractional and integer parts of x. Both results carry the sign\n" -"of x and are floats."); - -/* A decent logarithm is easy to compute even for huge longs, but libm can't - do that by itself -- loghelper can. func is log or log10, and name is - "log" or "log10". Note that overflow of the result isn't possible: a long - can contain no more than INT_MAX * SHIFT bits, so has value certainly less - than 2**(2**64 * 2**16) == 2**2**80, and log2 of that is 2**80, which is - small enough to fit in an IEEE single. log and log10 are even smaller. - However, intermediate overflow is possible for a long if the number of bits - in that long is larger than PY_SSIZE_T_MAX. */ - -static PyObject* -loghelper(PyObject* arg, double (*func)(double), char *funcname) -{ - /* If it is long, do it ourselves. */ - if (PyLong_Check(arg)) { - double x, result; - Py_ssize_t e; - - /* Negative or zero inputs give a ValueError. */ - if (Py_SIZE(arg) <= 0) { - PyErr_SetString(PyExc_ValueError, - "math domain error"); - return NULL; - } - - x = PyLong_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) { - if (!PyErr_ExceptionMatches(PyExc_OverflowError)) - return NULL; - /* Here the conversion to double overflowed, but it's possible - to compute the log anyway. Clear the exception and continue. */ - PyErr_Clear(); - x = _PyLong_Frexp((PyLongObject *)arg, &e); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - /* Value is ~= x * 2**e, so the log ~= log(x) + log(2) * e. */ - result = func(x) + func(2.0) * e; - } - else - /* Successfully converted x to a double. */ - result = func(x); - return PyFloat_FromDouble(result); - } - - /* Else let libm handle it by itself. */ - return math_1(arg, func, 0); -} - -static PyObject * -math_log(PyObject *self, PyObject *args) -{ - PyObject *arg; - PyObject *base = NULL; - PyObject *num, *den; - PyObject *ans; - - if (!PyArg_UnpackTuple(args, "log", 1, 2, &arg, &base)) - return NULL; - - num = loghelper(arg, m_log, "log"); - if (num == NULL || base == NULL) - return num; - - den = loghelper(base, m_log, "log"); - if (den == NULL) { - Py_DECREF(num); - return NULL; - } - - ans = PyNumber_Divide(num, den); - Py_DECREF(num); - Py_DECREF(den); - return ans; -} - -PyDoc_STRVAR(math_log_doc, -"log(x[, base])\n\n\ -Return the logarithm of x to the given base.\n\ -If the base not specified, returns the natural logarithm (base e) of x."); - -static PyObject * -math_log10(PyObject *self, PyObject *arg) -{ - return loghelper(arg, m_log10, "log10"); -} - -PyDoc_STRVAR(math_log10_doc, -"log10(x)\n\nReturn the base 10 logarithm of x."); - -static PyObject * -math_fmod(PyObject *self, PyObject *args) -{ - PyObject *ox, *oy; - double r, x, y; - if (! PyArg_UnpackTuple(args, "fmod", 2, 2, &ox, &oy)) - return NULL; - x = PyFloat_AsDouble(ox); - y = PyFloat_AsDouble(oy); - if ((x == -1.0 || y == -1.0) && PyErr_Occurred()) - return NULL; - /* fmod(x, +/-Inf) returns x for finite x. */ - if (Py_IS_INFINITY(y) && Py_IS_FINITE(x)) - return PyFloat_FromDouble(x); - errno = 0; - PyFPE_START_PROTECT("in math_fmod", return 0); - r = fmod(x, y); - PyFPE_END_PROTECT(r); - if (Py_IS_NAN(r)) { - if (!Py_IS_NAN(x) && !Py_IS_NAN(y)) - errno = EDOM; - else - errno = 0; - } - if (errno && is_error(r)) - return NULL; - else - return PyFloat_FromDouble(r); -} - -PyDoc_STRVAR(math_fmod_doc, -"fmod(x, y)\n\nReturn fmod(x, y), according to platform C." -" x % y may differ."); - -static PyObject * -math_hypot(PyObject *self, PyObject *args) -{ - PyObject *ox, *oy; - double r, x, y; - if (! PyArg_UnpackTuple(args, "hypot", 2, 2, &ox, &oy)) - return NULL; - x = PyFloat_AsDouble(ox); - y = PyFloat_AsDouble(oy); - if ((x == -1.0 || y == -1.0) && PyErr_Occurred()) - return NULL; - /* hypot(x, +/-Inf) returns Inf, even if x is a NaN. */ - if (Py_IS_INFINITY(x)) - return PyFloat_FromDouble(fabs(x)); - if (Py_IS_INFINITY(y)) - return PyFloat_FromDouble(fabs(y)); - errno = 0; - PyFPE_START_PROTECT("in math_hypot", return 0); - r = hypot(x, y); - PyFPE_END_PROTECT(r); - if (Py_IS_NAN(r)) { - if (!Py_IS_NAN(x) && !Py_IS_NAN(y)) - errno = EDOM; - else - errno = 0; - } - else if (Py_IS_INFINITY(r)) { - if (Py_IS_FINITE(x) && Py_IS_FINITE(y)) - errno = ERANGE; - else - errno = 0; - } - if (errno && is_error(r)) - return NULL; - else - return PyFloat_FromDouble(r); -} - -PyDoc_STRVAR(math_hypot_doc, -"hypot(x, y)\n\nReturn the Euclidean distance, sqrt(x*x + y*y)."); - -/* pow can't use math_2, but needs its own wrapper: the problem is - that an infinite result can arise either as a result of overflow - (in which case OverflowError should be raised) or as a result of - e.g. 0.**-5. (for which ValueError needs to be raised.) -*/ - -static PyObject * -math_pow(PyObject *self, PyObject *args) -{ - PyObject *ox, *oy; - double r, x, y; - int odd_y; - - if (! PyArg_UnpackTuple(args, "pow", 2, 2, &ox, &oy)) - return NULL; - x = PyFloat_AsDouble(ox); - y = PyFloat_AsDouble(oy); - if ((x == -1.0 || y == -1.0) && PyErr_Occurred()) - return NULL; - - /* deal directly with IEEE specials, to cope with problems on various - platforms whose semantics don't exactly match C99 */ - r = 0.; /* silence compiler warning */ - if (!Py_IS_FINITE(x) || !Py_IS_FINITE(y)) { - errno = 0; - if (Py_IS_NAN(x)) - r = y == 0. ? 1. : x; /* NaN**0 = 1 */ - else if (Py_IS_NAN(y)) - r = x == 1. ? 1. : y; /* 1**NaN = 1 */ - else if (Py_IS_INFINITY(x)) { - odd_y = Py_IS_FINITE(y) && fmod(fabs(y), 2.0) == 1.0; - if (y > 0.) - r = odd_y ? x : fabs(x); - else if (y == 0.) - r = 1.; - else /* y < 0. */ - r = odd_y ? copysign(0., x) : 0.; - } - else if (Py_IS_INFINITY(y)) { - if (fabs(x) == 1.0) - r = 1.; - else if (y > 0. && fabs(x) > 1.0) - r = y; - else if (y < 0. && fabs(x) < 1.0) { - r = -y; /* result is +inf */ - if (x == 0.) /* 0**-inf: divide-by-zero */ - errno = EDOM; - } - else - r = 0.; - } - } - else { - /* let libm handle finite**finite */ - errno = 0; - PyFPE_START_PROTECT("in math_pow", return 0); - r = pow(x, y); - PyFPE_END_PROTECT(r); - /* a NaN result should arise only from (-ve)**(finite - non-integer); in this case we want to raise ValueError. */ - if (!Py_IS_FINITE(r)) { - if (Py_IS_NAN(r)) { - errno = EDOM; - } - /* - an infinite result here arises either from: - (A) (+/-0.)**negative (-> divide-by-zero) - (B) overflow of x**y with x and y finite - */ - else if (Py_IS_INFINITY(r)) { - if (x == 0.) - errno = EDOM; - else - errno = ERANGE; - } - } - } - - if (errno && is_error(r)) - return NULL; - else - return PyFloat_FromDouble(r); -} - -PyDoc_STRVAR(math_pow_doc, -"pow(x, y)\n\nReturn x**y (x to the power of y)."); - -static const double degToRad = Py_MATH_PI / 180.0; -static const double radToDeg = 180.0 / Py_MATH_PI; - -static PyObject * -math_degrees(PyObject *self, PyObject *arg) -{ - double x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(x * radToDeg); -} - -PyDoc_STRVAR(math_degrees_doc, -"degrees(x)\n\n\ -Convert angle x from radians to degrees."); - -static PyObject * -math_radians(PyObject *self, PyObject *arg) -{ - double x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(x * degToRad); -} - -PyDoc_STRVAR(math_radians_doc, -"radians(x)\n\n\ -Convert angle x from degrees to radians."); - -static PyObject * -math_isnan(PyObject *self, PyObject *arg) -{ - double x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_NAN(x)); -} - -PyDoc_STRVAR(math_isnan_doc, -"isnan(x) -> bool\n\n\ -Check if float x is not a number (NaN)."); - -static PyObject * -math_isinf(PyObject *self, PyObject *arg) -{ - double x = PyFloat_AsDouble(arg); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_INFINITY(x)); -} - -PyDoc_STRVAR(math_isinf_doc, -"isinf(x) -> bool\n\n\ -Check if float x is infinite (positive or negative)."); - -static PyMethodDef math_methods[] = { - {"acos", math_acos, METH_O, math_acos_doc}, - {"acosh", math_acosh, METH_O, math_acosh_doc}, - {"asin", math_asin, METH_O, math_asin_doc}, - {"asinh", math_asinh, METH_O, math_asinh_doc}, - {"atan", math_atan, METH_O, math_atan_doc}, - {"atan2", math_atan2, METH_VARARGS, math_atan2_doc}, - {"atanh", math_atanh, METH_O, math_atanh_doc}, - {"ceil", math_ceil, METH_O, math_ceil_doc}, - {"copysign", math_copysign, METH_VARARGS, math_copysign_doc}, - {"cos", math_cos, METH_O, math_cos_doc}, - {"cosh", math_cosh, METH_O, math_cosh_doc}, - {"degrees", math_degrees, METH_O, math_degrees_doc}, - {"erf", math_erf, METH_O, math_erf_doc}, - {"erfc", math_erfc, METH_O, math_erfc_doc}, - {"exp", math_exp, METH_O, math_exp_doc}, - {"expm1", math_expm1, METH_O, math_expm1_doc}, - {"fabs", math_fabs, METH_O, math_fabs_doc}, - {"factorial", math_factorial, METH_O, math_factorial_doc}, - {"floor", math_floor, METH_O, math_floor_doc}, - {"fmod", math_fmod, METH_VARARGS, math_fmod_doc}, - {"frexp", math_frexp, METH_O, math_frexp_doc}, - {"fsum", math_fsum, METH_O, math_fsum_doc}, - {"gamma", math_gamma, METH_O, math_gamma_doc}, - {"hypot", math_hypot, METH_VARARGS, math_hypot_doc}, - {"isinf", math_isinf, METH_O, math_isinf_doc}, - {"isnan", math_isnan, METH_O, math_isnan_doc}, - {"ldexp", math_ldexp, METH_VARARGS, math_ldexp_doc}, - {"lgamma", math_lgamma, METH_O, math_lgamma_doc}, - {"log", math_log, METH_VARARGS, math_log_doc}, - {"log1p", math_log1p, METH_O, math_log1p_doc}, - {"log10", math_log10, METH_O, math_log10_doc}, - {"modf", math_modf, METH_O, math_modf_doc}, - {"pow", math_pow, METH_VARARGS, math_pow_doc}, - {"radians", math_radians, METH_O, math_radians_doc}, - {"sin", math_sin, METH_O, math_sin_doc}, - {"sinh", math_sinh, METH_O, math_sinh_doc}, - {"sqrt", math_sqrt, METH_O, math_sqrt_doc}, - {"tan", math_tan, METH_O, math_tan_doc}, - {"tanh", math_tanh, METH_O, math_tanh_doc}, - {"trunc", math_trunc, METH_O, math_trunc_doc}, - {NULL, NULL} /* sentinel */ -}; - - -PyDoc_STRVAR(module_doc, -"This module is always available. It provides access to the\n" -"mathematical functions defined by the C standard."); - -PyMODINIT_FUNC -initmath(void) -{ - PyObject *m; - - m = Py_InitModule3("math", math_methods, module_doc); - if (m == NULL) - goto finally; - - PyModule_AddObject(m, "pi", PyFloat_FromDouble(Py_MATH_PI)); - PyModule_AddObject(m, "e", PyFloat_FromDouble(Py_MATH_E)); - - finally: - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/md5.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/md5.c deleted file mode 100644 index 53dbbc6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/md5.c +++ /dev/null @@ -1,394 +0,0 @@ -/* - Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.c is L. Peter Deutsch - . Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order - either statically or dynamically; added missing #include - in library. - 2002-03-11 lpd Corrected argument list for main(), and added int return - type, in test program and T value program. - 2002-02-21 lpd Added missing #include in test program. - 2000-07-03 lpd Patched to eliminate warnings about "constant is - unsigned in ANSI C, signed in traditional"; made test program - self-checking. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). - 1999-05-03 lpd Original version. - */ - -#include "md5.h" -#include -#include - -#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ -#ifdef ARCH_IS_BIG_ENDIAN -# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) -#else -# define BYTE_ORDER 0 -#endif - -#define T_MASK ((md5_word_t)~0) -#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) -#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) -#define T3 0x242070db -#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) -#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) -#define T6 0x4787c62a -#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) -#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) -#define T9 0x698098d8 -#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) -#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) -#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) -#define T13 0x6b901122 -#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) -#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) -#define T16 0x49b40821 -#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) -#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) -#define T19 0x265e5a51 -#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) -#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) -#define T22 0x02441453 -#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) -#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) -#define T25 0x21e1cde6 -#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) -#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) -#define T28 0x455a14ed -#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) -#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) -#define T31 0x676f02d9 -#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) -#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) -#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) -#define T35 0x6d9d6122 -#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) -#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) -#define T38 0x4bdecfa9 -#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) -#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) -#define T41 0x289b7ec6 -#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) -#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) -#define T44 0x04881d05 -#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) -#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) -#define T47 0x1fa27cf8 -#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) -#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) -#define T50 0x432aff97 -#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) -#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) -#define T53 0x655b59c3 -#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) -#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) -#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) -#define T57 0x6fa87e4f -#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) -#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) -#define T60 0x4e0811a1 -#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) -#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) -#define T63 0x2ad7d2bb -#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) - - -static void -md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) -{ - md5_word_t - a = pms->abcd[0], b = pms->abcd[1], - c = pms->abcd[2], d = pms->abcd[3]; - md5_word_t t; -#if BYTE_ORDER > 0 - /* Define storage only for big-endian CPUs. */ - md5_word_t X[16]; -#else - /* Define storage for little-endian or both types of CPUs. */ - md5_word_t xbuf[16]; - const md5_word_t *X; -#endif - - { -#if BYTE_ORDER == 0 - /* - * Determine dynamically whether this is a big-endian or - * little-endian machine, since we can use a more efficient - * algorithm on the latter. - */ - static const int w = 1; - - if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ -#endif -#if BYTE_ORDER <= 0 /* little-endian */ - { - /* - * On little-endian machines, we can process properly aligned - * data without copying it. - */ - if (!((data - (const md5_byte_t *)0) & 3)) { - /* data are properly aligned */ - X = (const md5_word_t *)data; - } else { - /* not aligned */ - memcpy(xbuf, data, 64); - X = xbuf; - } - } -#endif -#if BYTE_ORDER == 0 - else /* dynamic big-endian */ -#endif -#if BYTE_ORDER >= 0 /* big-endian */ - { - /* - * On big-endian machines, we must arrange the bytes in the - * right order. - */ - const md5_byte_t *xp = data; - int i; - -# if BYTE_ORDER == 0 - X = xbuf; /* (dynamic only) */ -# else -# define xbuf X /* (static only) */ -# endif - for (i = 0; i < 16; ++i, xp += 4) - xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); - } -#endif - } - -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) - - /* Round 1. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ -#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + F(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 7, T1); - SET(d, a, b, c, 1, 12, T2); - SET(c, d, a, b, 2, 17, T3); - SET(b, c, d, a, 3, 22, T4); - SET(a, b, c, d, 4, 7, T5); - SET(d, a, b, c, 5, 12, T6); - SET(c, d, a, b, 6, 17, T7); - SET(b, c, d, a, 7, 22, T8); - SET(a, b, c, d, 8, 7, T9); - SET(d, a, b, c, 9, 12, T10); - SET(c, d, a, b, 10, 17, T11); - SET(b, c, d, a, 11, 22, T12); - SET(a, b, c, d, 12, 7, T13); - SET(d, a, b, c, 13, 12, T14); - SET(c, d, a, b, 14, 17, T15); - SET(b, c, d, a, 15, 22, T16); -#undef SET - - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ -#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + G(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 1, 5, T17); - SET(d, a, b, c, 6, 9, T18); - SET(c, d, a, b, 11, 14, T19); - SET(b, c, d, a, 0, 20, T20); - SET(a, b, c, d, 5, 5, T21); - SET(d, a, b, c, 10, 9, T22); - SET(c, d, a, b, 15, 14, T23); - SET(b, c, d, a, 4, 20, T24); - SET(a, b, c, d, 9, 5, T25); - SET(d, a, b, c, 14, 9, T26); - SET(c, d, a, b, 3, 14, T27); - SET(b, c, d, a, 8, 20, T28); - SET(a, b, c, d, 13, 5, T29); - SET(d, a, b, c, 2, 9, T30); - SET(c, d, a, b, 7, 14, T31); - SET(b, c, d, a, 12, 20, T32); -#undef SET - - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + H(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 5, 4, T33); - SET(d, a, b, c, 8, 11, T34); - SET(c, d, a, b, 11, 16, T35); - SET(b, c, d, a, 14, 23, T36); - SET(a, b, c, d, 1, 4, T37); - SET(d, a, b, c, 4, 11, T38); - SET(c, d, a, b, 7, 16, T39); - SET(b, c, d, a, 10, 23, T40); - SET(a, b, c, d, 13, 4, T41); - SET(d, a, b, c, 0, 11, T42); - SET(c, d, a, b, 3, 16, T43); - SET(b, c, d, a, 6, 23, T44); - SET(a, b, c, d, 9, 4, T45); - SET(d, a, b, c, 12, 11, T46); - SET(c, d, a, b, 15, 16, T47); - SET(b, c, d, a, 2, 23, T48); -#undef SET - - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ -#define I(x, y, z) ((y) ^ ((x) | ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + I(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 6, T49); - SET(d, a, b, c, 7, 10, T50); - SET(c, d, a, b, 14, 15, T51); - SET(b, c, d, a, 5, 21, T52); - SET(a, b, c, d, 12, 6, T53); - SET(d, a, b, c, 3, 10, T54); - SET(c, d, a, b, 10, 15, T55); - SET(b, c, d, a, 1, 21, T56); - SET(a, b, c, d, 8, 6, T57); - SET(d, a, b, c, 15, 10, T58); - SET(c, d, a, b, 6, 15, T59); - SET(b, c, d, a, 13, 21, T60); - SET(a, b, c, d, 4, 6, T61); - SET(d, a, b, c, 11, 10, T62); - SET(c, d, a, b, 2, 15, T63); - SET(b, c, d, a, 9, 21, T64); -#undef SET - - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ - pms->abcd[0] += a; - pms->abcd[1] += b; - pms->abcd[2] += c; - pms->abcd[3] += d; -} - -void -md5_init(md5_state_t *pms) -{ - pms->count[0] = pms->count[1] = 0; - pms->abcd[0] = 0x67452301; - pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; - pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; - pms->abcd[3] = 0x10325476; -} - -void -md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes) -{ - const md5_byte_t *p = data; - unsigned int left = nbytes; - unsigned int offset = (pms->count[0] >> 3) & 63; - md5_word_t nbits = (md5_word_t)(nbytes << 3); - - if (nbytes <= 0) - return; - - /* this special case is handled recursively */ - if (nbytes > INT_MAX - offset) { - unsigned int overlap; - - /* handle the append in two steps to prevent overflow */ - overlap = 64 - offset; - - md5_append(pms, data, overlap); - md5_append(pms, data + overlap, nbytes - overlap); - return; - } - - /* Update the message length. */ - pms->count[1] += nbytes >> 29; - pms->count[0] += nbits; - if (pms->count[0] < nbits) - pms->count[1]++; - - /* Process an initial partial block. */ - if (offset) { - unsigned int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); - - memcpy(pms->buf + offset, p, copy); - if (offset + copy < 64) - return; - p += copy; - left -= copy; - md5_process(pms, pms->buf); - } - - /* Process full blocks. */ - for (; left >= 64; p += 64, left -= 64) - md5_process(pms, p); - - /* Process a final partial block. */ - if (left) - memcpy(pms->buf, p, left); -} - -void -md5_finish(md5_state_t *pms, md5_byte_t digest[16]) -{ - static const md5_byte_t pad[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - md5_byte_t data[8]; - int i; - - /* Save the length before padding. */ - for (i = 0; i < 8; ++i) - data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); - /* Pad to 56 bytes mod 64. */ - md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); - /* Append the length. */ - md5_append(pms, data, 8); - for (i = 0; i < 16; ++i) - digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/md5.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/md5.h deleted file mode 100644 index 55560b3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/md5.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id$ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.h is L. Peter Deutsch - . Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Removed support for non-ANSI compilers; removed - references to Ghostscript; clarified derivation from RFC 1321; - now handles byte order either statically or dynamically. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke . - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This package supports both compile-time and run-time determination of CPU - * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be - * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is - * defined as non-zero, the code will be compiled to run only on big-endian - * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to - * run on either big- or little-endian CPUs, but will run slightly less - * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -void md5_init(md5_state_t *pms); - -/* Append a string to the message. */ -void md5_append(md5_state_t *pms, const md5_byte_t *data, unsigned int nbytes); - -/* Finish the message and return the digest. */ -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/md5module.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/md5module.c deleted file mode 100644 index 04c969d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/md5module.c +++ /dev/null @@ -1,339 +0,0 @@ - -/* MD5 module */ - -/* This module provides an interface to the RSA Data Security, - Inc. MD5 Message-Digest Algorithm, described in RFC 1321. - It requires the files md5c.c and md5.h (which are slightly changed - from the versions in the RFC to avoid the "global.h" file.) */ - - -/* MD5 objects */ - -#include "Python.h" -#include "structmember.h" -#include "md5.h" - -typedef struct { - PyObject_HEAD - md5_state_t md5; /* the context holder */ -} md5object; - -static PyTypeObject MD5type; - -#define is_md5object(v) ((v)->ob_type == &MD5type) - -static md5object * -newmd5object(void) -{ - md5object *md5p; - - md5p = PyObject_New(md5object, &MD5type); - if (md5p == NULL) - return NULL; - - md5_init(&md5p->md5); /* actual initialisation */ - return md5p; -} - - -/* MD5 methods */ - -static void -md5_dealloc(md5object *md5p) -{ - PyObject_Del(md5p); -} - - -/* MD5 methods-as-attributes */ - -static PyObject * -md5_update(md5object *self, PyObject *args) -{ - Py_buffer view; - Py_ssize_t n; - unsigned char *buf; - - if (!PyArg_ParseTuple(args, "s*:update", &view)) - return NULL; - - n = view.len; - buf = (unsigned char *) view.buf; - while (n > 0) { - Py_ssize_t nbytes; - if (n > INT_MAX) - nbytes = INT_MAX; - else - nbytes = n; - md5_append(&self->md5, buf, - Py_SAFE_DOWNCAST(nbytes, Py_ssize_t, unsigned int)); - buf += nbytes; - n -= nbytes; - } - - PyBuffer_Release(&view); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(update_doc, -"update (arg)\n\ -\n\ -Update the md5 object with the string arg. Repeated calls are\n\ -equivalent to a single call with the concatenation of all the\n\ -arguments."); - - -static PyObject * -md5_digest(md5object *self) -{ - md5_state_t mdContext; - unsigned char aDigest[16]; - - /* make a temporary copy, and perform the final */ - mdContext = self->md5; - md5_finish(&mdContext, aDigest); - - return PyString_FromStringAndSize((char *)aDigest, 16); -} - -PyDoc_STRVAR(digest_doc, -"digest() -> string\n\ -\n\ -Return the digest of the strings passed to the update() method so\n\ -far. This is a 16-byte string which may contain non-ASCII characters,\n\ -including null bytes."); - - -static PyObject * -md5_hexdigest(md5object *self) -{ - md5_state_t mdContext; - unsigned char digest[16]; - unsigned char hexdigest[32]; - int i, j; - - /* make a temporary copy, and perform the final */ - mdContext = self->md5; - md5_finish(&mdContext, digest); - - /* Make hex version of the digest */ - for(i=j=0; i<16; i++) { - char c; - c = (digest[i] >> 4) & 0xf; - c = (c>9) ? c+'a'-10 : c + '0'; - hexdigest[j++] = c; - c = (digest[i] & 0xf); - c = (c>9) ? c+'a'-10 : c + '0'; - hexdigest[j++] = c; - } - return PyString_FromStringAndSize((char*)hexdigest, 32); -} - - -PyDoc_STRVAR(hexdigest_doc, -"hexdigest() -> string\n\ -\n\ -Like digest(), but returns the digest as a string of hexadecimal digits."); - - -static PyObject * -md5_copy(md5object *self) -{ - md5object *md5p; - - if ((md5p = newmd5object()) == NULL) - return NULL; - - md5p->md5 = self->md5; - - return (PyObject *)md5p; -} - -PyDoc_STRVAR(copy_doc, -"copy() -> md5 object\n\ -\n\ -Return a copy (``clone'') of the md5 object."); - - -static PyMethodDef md5_methods[] = { - {"update", (PyCFunction)md5_update, METH_VARARGS, update_doc}, - {"digest", (PyCFunction)md5_digest, METH_NOARGS, digest_doc}, - {"hexdigest", (PyCFunction)md5_hexdigest, METH_NOARGS, hexdigest_doc}, - {"copy", (PyCFunction)md5_copy, METH_NOARGS, copy_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -md5_get_block_size(PyObject *self, void *closure) -{ - return PyInt_FromLong(64); -} - -static PyObject * -md5_get_digest_size(PyObject *self, void *closure) -{ - return PyInt_FromLong(16); -} - -static PyObject * -md5_get_name(PyObject *self, void *closure) -{ - return PyString_FromStringAndSize("MD5", 3); -} - -static PyGetSetDef md5_getseters[] = { - {"digest_size", - (getter)md5_get_digest_size, NULL, - NULL, - NULL}, - {"block_size", - (getter)md5_get_block_size, NULL, - NULL, - NULL}, - {"name", - (getter)md5_get_name, NULL, - NULL, - NULL}, - /* the old md5 and sha modules support 'digest_size' as in PEP 247. - * the old sha module also supported 'digestsize'. ugh. */ - {"digestsize", - (getter)md5_get_digest_size, NULL, - NULL, - NULL}, - {NULL} /* Sentinel */ -}; - - -PyDoc_STRVAR(module_doc, -"This module implements the interface to RSA's MD5 message digest\n\ -algorithm (see also Internet RFC 1321). Its use is quite\n\ -straightforward: use the new() to create an md5 object. You can now\n\ -feed this object with arbitrary strings using the update() method, and\n\ -at any point you can ask it for the digest (a strong kind of 128-bit\n\ -checksum, a.k.a. ``fingerprint'') of the concatenation of the strings\n\ -fed to it so far using the digest() method.\n\ -\n\ -Functions:\n\ -\n\ -new([arg]) -- return a new md5 object, initialized with arg if provided\n\ -md5([arg]) -- DEPRECATED, same as new, but for compatibility\n\ -\n\ -Special Objects:\n\ -\n\ -MD5Type -- type object for md5 objects"); - -PyDoc_STRVAR(md5type_doc, -"An md5 represents the object used to calculate the MD5 checksum of a\n\ -string of information.\n\ -\n\ -Methods:\n\ -\n\ -update() -- updates the current digest with an additional string\n\ -digest() -- return the current digest value\n\ -hexdigest() -- return the current digest as a string of hexadecimal digits\n\ -copy() -- return a copy of the current md5 object"); - -static PyTypeObject MD5type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_md5.md5", /*tp_name*/ - sizeof(md5object), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)md5_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - md5type_doc, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - md5_methods, /*tp_methods*/ - 0, /*tp_members*/ - md5_getseters, /*tp_getset*/ -}; - - -/* MD5 functions */ - -static PyObject * -MD5_new(PyObject *self, PyObject *args) -{ - md5object *md5p; - Py_buffer view = { 0 }; - Py_ssize_t n; - unsigned char *buf; - - if (!PyArg_ParseTuple(args, "|s*:new", &view)) - return NULL; - - if ((md5p = newmd5object()) == NULL) { - PyBuffer_Release(&view); - return NULL; - } - - n = view.len; - buf = (unsigned char *) view.buf; - while (n > 0) { - Py_ssize_t nbytes; - if (n > INT_MAX) - nbytes = INT_MAX; - else - nbytes = n; - md5_append(&md5p->md5, buf, - Py_SAFE_DOWNCAST(nbytes, Py_ssize_t, unsigned int)); - buf += nbytes; - n -= nbytes; - } - PyBuffer_Release(&view); - - return (PyObject *)md5p; -} - -PyDoc_STRVAR(new_doc, -"new([arg]) -> md5 object\n\ -\n\ -Return a new md5 object. If arg is present, the method call update(arg)\n\ -is made."); - - -/* List of functions exported by this module */ - -static PyMethodDef md5_functions[] = { - {"new", (PyCFunction)MD5_new, METH_VARARGS, new_doc}, - {NULL, NULL} /* Sentinel */ -}; - - -/* Initialize this module. */ - -PyMODINIT_FUNC -init_md5(void) -{ - PyObject *m, *d; - - Py_TYPE(&MD5type) = &PyType_Type; - if (PyType_Ready(&MD5type) < 0) - return; - m = Py_InitModule3("_md5", md5_functions, module_doc); - if (m == NULL) - return; - d = PyModule_GetDict(m); - PyDict_SetItemString(d, "MD5Type", (PyObject *)&MD5type); - PyModule_AddIntConstant(m, "digest_size", 16); - /* No need to check the error here, the caller will do that */ -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/operator.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/operator.c deleted file mode 100644 index 92d4a1f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/operator.c +++ /dev/null @@ -1,930 +0,0 @@ - -#include "Python.h" - -PyDoc_STRVAR(operator_doc, -"Operator interface.\n\ -\n\ -This module exports a set of functions implemented in C corresponding\n\ -to the intrinsic operators of Python. For example, operator.add(x, y)\n\ -is equivalent to the expression x+y. The function names are those\n\ -used for special methods; variants without leading and trailing\n\ -'__' are also provided for convenience."); - -#define spam1(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a1) { \ - return AOP(a1); } - -#define spam2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2; \ - if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ - return AOP(a1,a2); } - -#define spamoi(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1; int a2; \ - if(! PyArg_ParseTuple(a,"Oi:" #OP,&a1,&a2)) return NULL; \ - return AOP(a1,a2); } - -#define spam2n(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2; \ - if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ - if(-1 == AOP(a1,a2)) return NULL; \ - Py_INCREF(Py_None); \ - return Py_None; } - -#define spam3n(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2, *a3; \ - if(! PyArg_UnpackTuple(a,#OP,3,3,&a1,&a2,&a3)) return NULL; \ - if(-1 == AOP(a1,a2,a3)) return NULL; \ - Py_INCREF(Py_None); \ - return Py_None; } - -#define spami(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a1) { \ - long r; \ - if(-1 == (r=AOP(a1))) return NULL; \ - return PyBool_FromLong(r); } - -#define spami2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2; long r; \ - if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ - if(-1 == (r=AOP(a1,a2))) return NULL; \ - return PyInt_FromLong(r); } - -#define spamn2(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2; Py_ssize_t r; \ - if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ - if(-1 == (r=AOP(a1,a2))) return NULL; \ - return PyInt_FromSsize_t(r); } - -#define spami2b(OP,AOP) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2; long r; \ - if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ - if(-1 == (r=AOP(a1,a2))) return NULL; \ - return PyBool_FromLong(r); } - -#define spamrc(OP,A) static PyObject *OP(PyObject *s, PyObject *a) { \ - PyObject *a1, *a2; \ - if(! PyArg_UnpackTuple(a,#OP,2,2,&a1,&a2)) return NULL; \ - return PyObject_RichCompare(a1,a2,A); } - -/* Deprecated operators that need warnings. */ -static int -op_isCallable(PyObject *x) -{ - if (PyErr_WarnPy3k("operator.isCallable() is not supported in 3.x. " - "Use hasattr(obj, '__call__').", 1) < 0) - return -1; - return PyCallable_Check(x); -} - -static int -op_sequenceIncludes(PyObject *seq, PyObject* ob) -{ - if (PyErr_WarnPy3k("operator.sequenceIncludes() is not supported " - "in 3.x. Use operator.contains().", 1) < 0) - return -1; - return PySequence_Contains(seq, ob); -} - -spami(isCallable , op_isCallable) -spami(isNumberType , PyNumber_Check) -spami(truth , PyObject_IsTrue) -spam2(op_add , PyNumber_Add) -spam2(op_sub , PyNumber_Subtract) -spam2(op_mul , PyNumber_Multiply) -spam2(op_div , PyNumber_Divide) -spam2(op_floordiv , PyNumber_FloorDivide) -spam2(op_truediv , PyNumber_TrueDivide) -spam2(op_mod , PyNumber_Remainder) -spam1(op_neg , PyNumber_Negative) -spam1(op_pos , PyNumber_Positive) -spam1(op_abs , PyNumber_Absolute) -spam1(op_inv , PyNumber_Invert) -spam1(op_invert , PyNumber_Invert) -spam2(op_lshift , PyNumber_Lshift) -spam2(op_rshift , PyNumber_Rshift) -spami(op_not_ , PyObject_Not) -spam2(op_and_ , PyNumber_And) -spam2(op_xor , PyNumber_Xor) -spam2(op_or_ , PyNumber_Or) -spam2(op_iadd , PyNumber_InPlaceAdd) -spam2(op_isub , PyNumber_InPlaceSubtract) -spam2(op_imul , PyNumber_InPlaceMultiply) -spam2(op_idiv , PyNumber_InPlaceDivide) -spam2(op_ifloordiv , PyNumber_InPlaceFloorDivide) -spam2(op_itruediv , PyNumber_InPlaceTrueDivide) -spam2(op_imod , PyNumber_InPlaceRemainder) -spam2(op_ilshift , PyNumber_InPlaceLshift) -spam2(op_irshift , PyNumber_InPlaceRshift) -spam2(op_iand , PyNumber_InPlaceAnd) -spam2(op_ixor , PyNumber_InPlaceXor) -spam2(op_ior , PyNumber_InPlaceOr) -spami(isSequenceType , PySequence_Check) -spam2(op_concat , PySequence_Concat) -spamoi(op_repeat , PySequence_Repeat) -spam2(op_iconcat , PySequence_InPlaceConcat) -spamoi(op_irepeat , PySequence_InPlaceRepeat) -spami2b(op_contains , PySequence_Contains) -spami2b(sequenceIncludes, op_sequenceIncludes) -spamn2(indexOf , PySequence_Index) -spamn2(countOf , PySequence_Count) -spami(isMappingType , PyMapping_Check) -spam2(op_getitem , PyObject_GetItem) -spam2n(op_delitem , PyObject_DelItem) -spam3n(op_setitem , PyObject_SetItem) -spamrc(op_lt , Py_LT) -spamrc(op_le , Py_LE) -spamrc(op_eq , Py_EQ) -spamrc(op_ne , Py_NE) -spamrc(op_gt , Py_GT) -spamrc(op_ge , Py_GE) - -static PyObject* -op_pow(PyObject *s, PyObject *a) -{ - PyObject *a1, *a2; - if (PyArg_UnpackTuple(a,"pow", 2, 2, &a1, &a2)) - return PyNumber_Power(a1, a2, Py_None); - return NULL; -} - -static PyObject* -op_ipow(PyObject *s, PyObject *a) -{ - PyObject *a1, *a2; - if (PyArg_UnpackTuple(a,"ipow", 2, 2, &a1, &a2)) - return PyNumber_InPlacePower(a1, a2, Py_None); - return NULL; -} - -static PyObject * -op_index(PyObject *s, PyObject *a) -{ - return PyNumber_Index(a); -} - -static PyObject* -is_(PyObject *s, PyObject *a) -{ - PyObject *a1, *a2, *result = NULL; - if (PyArg_UnpackTuple(a,"is_", 2, 2, &a1, &a2)) { - result = (a1 == a2) ? Py_True : Py_False; - Py_INCREF(result); - } - return result; -} - -static PyObject* -is_not(PyObject *s, PyObject *a) -{ - PyObject *a1, *a2, *result = NULL; - if (PyArg_UnpackTuple(a,"is_not", 2, 2, &a1, &a2)) { - result = (a1 != a2) ? Py_True : Py_False; - Py_INCREF(result); - } - return result; -} - -static PyObject* -op_getslice(PyObject *s, PyObject *a) -{ - PyObject *a1; - Py_ssize_t a2, a3; - - if (!PyArg_ParseTuple(a, "Onn:getslice", &a1, &a2, &a3)) - return NULL; - return PySequence_GetSlice(a1, a2, a3); -} - -static PyObject* -op_setslice(PyObject *s, PyObject *a) -{ - PyObject *a1, *a4; - Py_ssize_t a2, a3; - - if (!PyArg_ParseTuple(a, "OnnO:setslice", &a1, &a2, &a3, &a4)) - return NULL; - - if (-1 == PySequence_SetSlice(a1, a2, a3, a4)) - return NULL; - - Py_RETURN_NONE; -} - -static PyObject* -op_delslice(PyObject *s, PyObject *a) -{ - PyObject *a1; - Py_ssize_t a2, a3; - - if (!PyArg_ParseTuple(a, "Onn:delslice", &a1, &a2, &a3)) - return NULL; - - if (-1 == PySequence_DelSlice(a1, a2, a3)) - return NULL; - - Py_RETURN_NONE; -} - -#undef spam1 -#undef spam2 -#undef spam1o -#undef spam1o -#define spam1(OP,DOC) {#OP, OP, METH_VARARGS, PyDoc_STR(DOC)}, -#define spam2(OP,ALTOP,DOC) {#OP, op_##OP, METH_VARARGS, PyDoc_STR(DOC)}, \ - {#ALTOP, op_##OP, METH_VARARGS, PyDoc_STR(DOC)}, -#define spam1o(OP,DOC) {#OP, OP, METH_O, PyDoc_STR(DOC)}, -#define spam2o(OP,ALTOP,DOC) {#OP, op_##OP, METH_O, PyDoc_STR(DOC)}, \ - {#ALTOP, op_##OP, METH_O, PyDoc_STR(DOC)}, - - - -/* compare_digest **********************************************************/ - -/* - * timing safe compare - * - * Returns 1 of the strings are equal. - * In case of len(a) != len(b) the function tries to keep the timing - * dependent on the length of b. CPU cache locally may still alter timing - * a bit. - */ -static int -_tscmp(const unsigned char *a, const unsigned char *b, - Py_ssize_t len_a, Py_ssize_t len_b) -{ - /* The volatile type declarations make sure that the compiler has no - * chance to optimize and fold the code in any way that may change - * the timing. - */ - volatile Py_ssize_t length; - volatile const unsigned char *left; - volatile const unsigned char *right; - Py_ssize_t i; - unsigned char result; - - /* loop count depends on length of b */ - length = len_b; - left = NULL; - right = b; - - /* don't use else here to keep the amount of CPU instructions constant, - * volatile forces re-evaluation - * */ - if (len_a == length) { - left = *((volatile const unsigned char**)&a); - result = 0; - } - if (len_a != length) { - left = b; - result = 1; - } - - for (i=0; i < length; i++) { - result |= *left++ ^ *right++; - } - - return (result == 0); -} - -PyDoc_STRVAR(compare_digest__doc__, -"compare_digest(a, b) -> bool\n" -"\n" -"Return 'a == b'. This function uses an approach designed to prevent\n" -"timing analysis, making it appropriate for cryptography.\n" -"a and b must both be of the same type: either str (ASCII only),\n" -"or any type that supports the buffer protocol (e.g. bytes).\n" -"\n" -"Note: If a and b are of different lengths, or if an error occurs,\n" -"a timing attack could theoretically reveal information about the\n" -"types and lengths of a and b--but not their values.\n"); - -static PyObject* -compare_digest(PyObject *self, PyObject *args) -{ - PyObject *a, *b; - int rc; - - if (!PyArg_ParseTuple(args, "OO:compare_digest", &a, &b)) { - return NULL; - } - - /* Unicode string */ - if (PyUnicode_Check(a) && PyUnicode_Check(b)) { - rc = _tscmp((const unsigned char *)PyUnicode_AS_DATA(a), - (const unsigned char *)PyUnicode_AS_DATA(b), - PyUnicode_GET_DATA_SIZE(a), - PyUnicode_GET_DATA_SIZE(b)); - } - /* fallback to buffer interface for bytes, bytesarray and other */ - else { - Py_buffer view_a; - Py_buffer view_b; - - if (PyObject_CheckBuffer(a) == 0 && PyObject_CheckBuffer(b) == 0) { - PyErr_Format(PyExc_TypeError, - "unsupported operand types(s) or combination of types: " - "'%.100s' and '%.100s'", - Py_TYPE(a)->tp_name, Py_TYPE(b)->tp_name); - return NULL; - } - - if (PyObject_GetBuffer(a, &view_a, PyBUF_SIMPLE) == -1) { - return NULL; - } - if (view_a.ndim > 1) { - PyErr_SetString(PyExc_BufferError, - "Buffer must be single dimension"); - PyBuffer_Release(&view_a); - return NULL; - } - - if (PyObject_GetBuffer(b, &view_b, PyBUF_SIMPLE) == -1) { - PyBuffer_Release(&view_a); - return NULL; - } - if (view_b.ndim > 1) { - PyErr_SetString(PyExc_BufferError, - "Buffer must be single dimension"); - PyBuffer_Release(&view_a); - PyBuffer_Release(&view_b); - return NULL; - } - - rc = _tscmp((const unsigned char*)view_a.buf, - (const unsigned char*)view_b.buf, - view_a.len, - view_b.len); - - PyBuffer_Release(&view_a); - PyBuffer_Release(&view_b); - } - - return PyBool_FromLong(rc); -} - -static struct PyMethodDef operator_methods[] = { - -spam1o(isCallable, - "isCallable(a) -- Same as callable(a).") -spam1o(isNumberType, - "isNumberType(a) -- Return True if a has a numeric type, False otherwise.") -spam1o(isSequenceType, - "isSequenceType(a) -- Return True if a has a sequence type, False otherwise.") -spam1o(truth, - "truth(a) -- Return True if a is true, False otherwise.") -spam2(contains,__contains__, - "contains(a, b) -- Same as b in a (note reversed operands).") -spam1(sequenceIncludes, - "sequenceIncludes(a, b) -- Same as b in a (note reversed operands; deprecated).") -spam1(indexOf, - "indexOf(a, b) -- Return the first index of b in a.") -spam1(countOf, - "countOf(a, b) -- Return the number of times b occurs in a.") -spam1o(isMappingType, - "isMappingType(a) -- Return True if a has a mapping type, False otherwise.") - -spam1(is_, "is_(a, b) -- Same as a is b.") -spam1(is_not, "is_not(a, b) -- Same as a is not b.") -spam2o(index, __index__, "index(a) -- Same as a.__index__()") -spam2(add,__add__, "add(a, b) -- Same as a + b.") -spam2(sub,__sub__, "sub(a, b) -- Same as a - b.") -spam2(mul,__mul__, "mul(a, b) -- Same as a * b.") -spam2(div,__div__, "div(a, b) -- Same as a / b when __future__.division is not in effect.") -spam2(floordiv,__floordiv__, "floordiv(a, b) -- Same as a // b.") -spam2(truediv,__truediv__, "truediv(a, b) -- Same as a / b when __future__.division is in effect.") -spam2(mod,__mod__, "mod(a, b) -- Same as a % b.") -spam2o(neg,__neg__, "neg(a) -- Same as -a.") -spam2o(pos,__pos__, "pos(a) -- Same as +a.") -spam2o(abs,__abs__, "abs(a) -- Same as abs(a).") -spam2o(inv,__inv__, "inv(a) -- Same as ~a.") -spam2o(invert,__invert__, "invert(a) -- Same as ~a.") -spam2(lshift,__lshift__, "lshift(a, b) -- Same as a << b.") -spam2(rshift,__rshift__, "rshift(a, b) -- Same as a >> b.") -spam2o(not_,__not__, "not_(a) -- Same as not a.") -spam2(and_,__and__, "and_(a, b) -- Same as a & b.") -spam2(xor,__xor__, "xor(a, b) -- Same as a ^ b.") -spam2(or_,__or__, "or_(a, b) -- Same as a | b.") -spam2(iadd,__iadd__, "a = iadd(a, b) -- Same as a += b.") -spam2(isub,__isub__, "a = isub(a, b) -- Same as a -= b.") -spam2(imul,__imul__, "a = imul(a, b) -- Same as a *= b.") -spam2(idiv,__idiv__, "a = idiv(a, b) -- Same as a /= b when __future__.division is not in effect.") -spam2(ifloordiv,__ifloordiv__, "a = ifloordiv(a, b) -- Same as a //= b.") -spam2(itruediv,__itruediv__, "a = itruediv(a, b) -- Same as a /= b when __future__.division is in effect.") -spam2(imod,__imod__, "a = imod(a, b) -- Same as a %= b.") -spam2(ilshift,__ilshift__, "a = ilshift(a, b) -- Same as a <<= b.") -spam2(irshift,__irshift__, "a = irshift(a, b) -- Same as a >>= b.") -spam2(iand,__iand__, "a = iand(a, b) -- Same as a &= b.") -spam2(ixor,__ixor__, "a = ixor(a, b) -- Same as a ^= b.") -spam2(ior,__ior__, "a = ior(a, b) -- Same as a |= b.") -spam2(concat,__concat__, - "concat(a, b) -- Same as a + b, for a and b sequences.") -spam2(repeat,__repeat__, - "repeat(a, b) -- Return a * b, where a is a sequence, and b is an integer.") -spam2(iconcat,__iconcat__, - "a = iconcat(a, b) -- Same as a += b, for a and b sequences.") -spam2(irepeat,__irepeat__, - "a = irepeat(a, b) -- Same as a *= b, where a is a sequence, and b is an integer.") -spam2(getitem,__getitem__, - "getitem(a, b) -- Same as a[b].") -spam2(setitem,__setitem__, - "setitem(a, b, c) -- Same as a[b] = c.") -spam2(delitem,__delitem__, - "delitem(a, b) -- Same as del a[b].") -spam2(pow,__pow__, "pow(a, b) -- Same as a ** b.") -spam2(ipow,__ipow__, "a = ipow(a, b) -- Same as a **= b.") -spam2(getslice,__getslice__, - "getslice(a, b, c) -- Same as a[b:c].") -spam2(setslice,__setslice__, -"setslice(a, b, c, d) -- Same as a[b:c] = d.") -spam2(delslice,__delslice__, -"delslice(a, b, c) -- Same as del a[b:c].") -spam2(lt,__lt__, "lt(a, b) -- Same as ab.") -spam2(ge,__ge__, "ge(a, b) -- Same as a>=b.") - - {"_compare_digest", (PyCFunction)compare_digest, METH_VARARGS, - compare_digest__doc__}, - {NULL, NULL} /* sentinel */ - -}; - -/* itemgetter object **********************************************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t nitems; - PyObject *item; -} itemgetterobject; - -static PyTypeObject itemgetter_type; - -static PyObject * -itemgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - itemgetterobject *ig; - PyObject *item; - Py_ssize_t nitems; - - if (!_PyArg_NoKeywords("itemgetter()", kwds)) - return NULL; - - nitems = PyTuple_GET_SIZE(args); - if (nitems <= 1) { - if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &item)) - return NULL; - } else - item = args; - - /* create itemgetterobject structure */ - ig = PyObject_GC_New(itemgetterobject, &itemgetter_type); - if (ig == NULL) - return NULL; - - Py_INCREF(item); - ig->item = item; - ig->nitems = nitems; - - PyObject_GC_Track(ig); - return (PyObject *)ig; -} - -static void -itemgetter_dealloc(itemgetterobject *ig) -{ - PyObject_GC_UnTrack(ig); - Py_XDECREF(ig->item); - PyObject_GC_Del(ig); -} - -static int -itemgetter_traverse(itemgetterobject *ig, visitproc visit, void *arg) -{ - Py_VISIT(ig->item); - return 0; -} - -static PyObject * -itemgetter_call(itemgetterobject *ig, PyObject *args, PyObject *kw) -{ - PyObject *obj, *result; - Py_ssize_t i, nitems=ig->nitems; - - if (!PyArg_UnpackTuple(args, "itemgetter", 1, 1, &obj)) - return NULL; - if (nitems == 1) - return PyObject_GetItem(obj, ig->item); - - assert(PyTuple_Check(ig->item)); - assert(PyTuple_GET_SIZE(ig->item) == nitems); - - result = PyTuple_New(nitems); - if (result == NULL) - return NULL; - - for (i=0 ; i < nitems ; i++) { - PyObject *item, *val; - item = PyTuple_GET_ITEM(ig->item, i); - val = PyObject_GetItem(obj, item); - if (val == NULL) { - Py_DECREF(result); - return NULL; - } - PyTuple_SET_ITEM(result, i, val); - } - return result; -} - -PyDoc_STRVAR(itemgetter_doc, -"itemgetter(item, ...) --> itemgetter object\n\ -\n\ -Return a callable object that fetches the given item(s) from its operand.\n\ -After f = itemgetter(2), the call f(r) returns r[2].\n\ -After g = itemgetter(2, 5, 3), the call g(r) returns (r[2], r[5], r[3])"); - -static PyTypeObject itemgetter_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "operator.itemgetter", /* tp_name */ - sizeof(itemgetterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)itemgetter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)itemgetter_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - itemgetter_doc, /* tp_doc */ - (traverseproc)itemgetter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - itemgetter_new, /* tp_new */ - 0, /* tp_free */ -}; - - -/* attrgetter object **********************************************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t nattrs; - PyObject *attr; -} attrgetterobject; - -static PyTypeObject attrgetter_type; - -static PyObject * -attrgetter_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - attrgetterobject *ag; - PyObject *attr; - Py_ssize_t nattrs; - - if (!_PyArg_NoKeywords("attrgetter()", kwds)) - return NULL; - - nattrs = PyTuple_GET_SIZE(args); - if (nattrs <= 1) { - if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &attr)) - return NULL; - } else - attr = args; - - /* create attrgetterobject structure */ - ag = PyObject_GC_New(attrgetterobject, &attrgetter_type); - if (ag == NULL) - return NULL; - - Py_INCREF(attr); - ag->attr = attr; - ag->nattrs = nattrs; - - PyObject_GC_Track(ag); - return (PyObject *)ag; -} - -static void -attrgetter_dealloc(attrgetterobject *ag) -{ - PyObject_GC_UnTrack(ag); - Py_XDECREF(ag->attr); - PyObject_GC_Del(ag); -} - -static int -attrgetter_traverse(attrgetterobject *ag, visitproc visit, void *arg) -{ - Py_VISIT(ag->attr); - return 0; -} - -static PyObject * -dotted_getattr(PyObject *obj, PyObject *attr) -{ - char *s, *p; - -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(attr)) { - attr = _PyUnicode_AsDefaultEncodedString(attr, NULL); - if (attr == NULL) - return NULL; - } -#endif - - if (!PyString_Check(attr)) { - PyErr_SetString(PyExc_TypeError, - "attribute name must be a string"); - return NULL; - } - - s = PyString_AS_STRING(attr); - Py_INCREF(obj); - for (;;) { - PyObject *newobj, *str; - p = strchr(s, '.'); - str = p ? PyString_FromStringAndSize(s, (p-s)) : - PyString_FromString(s); - if (str == NULL) { - Py_DECREF(obj); - return NULL; - } - newobj = PyObject_GetAttr(obj, str); - Py_DECREF(str); - Py_DECREF(obj); - if (newobj == NULL) - return NULL; - obj = newobj; - if (p == NULL) break; - s = p+1; - } - - return obj; -} - -static PyObject * -attrgetter_call(attrgetterobject *ag, PyObject *args, PyObject *kw) -{ - PyObject *obj, *result; - Py_ssize_t i, nattrs=ag->nattrs; - - if (!PyArg_UnpackTuple(args, "attrgetter", 1, 1, &obj)) - return NULL; - if (ag->nattrs == 1) - return dotted_getattr(obj, ag->attr); - - assert(PyTuple_Check(ag->attr)); - assert(PyTuple_GET_SIZE(ag->attr) == nattrs); - - result = PyTuple_New(nattrs); - if (result == NULL) - return NULL; - - for (i=0 ; i < nattrs ; i++) { - PyObject *attr, *val; - attr = PyTuple_GET_ITEM(ag->attr, i); - val = dotted_getattr(obj, attr); - if (val == NULL) { - Py_DECREF(result); - return NULL; - } - PyTuple_SET_ITEM(result, i, val); - } - return result; -} - -PyDoc_STRVAR(attrgetter_doc, -"attrgetter(attr, ...) --> attrgetter object\n\ -\n\ -Return a callable object that fetches the given attribute(s) from its operand.\n\ -After f = attrgetter('name'), the call f(r) returns r.name.\n\ -After g = attrgetter('name', 'date'), the call g(r) returns (r.name, r.date).\n\ -After h = attrgetter('name.first', 'name.last'), the call h(r) returns\n\ -(r.name.first, r.name.last)."); - -static PyTypeObject attrgetter_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "operator.attrgetter", /* tp_name */ - sizeof(attrgetterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)attrgetter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)attrgetter_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - attrgetter_doc, /* tp_doc */ - (traverseproc)attrgetter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - attrgetter_new, /* tp_new */ - 0, /* tp_free */ -}; - - -/* methodcaller object **********************************************************/ - -typedef struct { - PyObject_HEAD - PyObject *name; - PyObject *args; - PyObject *kwds; -} methodcallerobject; - -static PyTypeObject methodcaller_type; - -static PyObject * -methodcaller_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - methodcallerobject *mc; - PyObject *name, *newargs; - - if (PyTuple_GET_SIZE(args) < 1) { - PyErr_SetString(PyExc_TypeError, "methodcaller needs at least " - "one argument, the method name"); - return NULL; - } - - /* create methodcallerobject structure */ - mc = PyObject_GC_New(methodcallerobject, &methodcaller_type); - if (mc == NULL) - return NULL; - - newargs = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); - if (newargs == NULL) { - Py_DECREF(mc); - return NULL; - } - mc->args = newargs; - - name = PyTuple_GET_ITEM(args, 0); - Py_INCREF(name); - mc->name = name; - - Py_XINCREF(kwds); - mc->kwds = kwds; - - PyObject_GC_Track(mc); - return (PyObject *)mc; -} - -static void -methodcaller_dealloc(methodcallerobject *mc) -{ - PyObject_GC_UnTrack(mc); - Py_XDECREF(mc->name); - Py_XDECREF(mc->args); - Py_XDECREF(mc->kwds); - PyObject_GC_Del(mc); -} - -static int -methodcaller_traverse(methodcallerobject *mc, visitproc visit, void *arg) -{ - Py_VISIT(mc->args); - Py_VISIT(mc->kwds); - return 0; -} - -static PyObject * -methodcaller_call(methodcallerobject *mc, PyObject *args, PyObject *kw) -{ - PyObject *method, *obj, *result; - - if (!PyArg_UnpackTuple(args, "methodcaller", 1, 1, &obj)) - return NULL; - method = PyObject_GetAttr(obj, mc->name); - if (method == NULL) - return NULL; - result = PyObject_Call(method, mc->args, mc->kwds); - Py_DECREF(method); - return result; -} - -PyDoc_STRVAR(methodcaller_doc, -"methodcaller(name, ...) --> methodcaller object\n\ -\n\ -Return a callable object that calls the given method on its operand.\n\ -After f = methodcaller('name'), the call f(r) returns r.name().\n\ -After g = methodcaller('name', 'date', foo=1), the call g(r) returns\n\ -r.name('date', foo=1)."); - -static PyTypeObject methodcaller_type = { - PyVarObject_HEAD_INIT(NULL, 0) - "operator.methodcaller", /* tp_name */ - sizeof(methodcallerobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)methodcaller_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)methodcaller_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - methodcaller_doc, /* tp_doc */ - (traverseproc)methodcaller_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - methodcaller_new, /* tp_new */ - 0, /* tp_free */ -}; - - -/* Initialization function for the module (*must* be called initoperator) */ - -PyMODINIT_FUNC -initoperator(void) -{ - PyObject *m; - - /* Create the module and add the functions */ - m = Py_InitModule4("operator", operator_methods, operator_doc, - (PyObject*)NULL, PYTHON_API_VERSION); - if (m == NULL) - return; - - if (PyType_Ready(&itemgetter_type) < 0) - return; - Py_INCREF(&itemgetter_type); - PyModule_AddObject(m, "itemgetter", (PyObject *)&itemgetter_type); - - if (PyType_Ready(&attrgetter_type) < 0) - return; - Py_INCREF(&attrgetter_type); - PyModule_AddObject(m, "attrgetter", (PyObject *)&attrgetter_type); - - if (PyType_Ready(&methodcaller_type) < 0) - return; - Py_INCREF(&methodcaller_type); - PyModule_AddObject(m, "methodcaller", (PyObject *)&methodcaller_type); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/parsermodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/parsermodule.c deleted file mode 100644 index 6e3f1c8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/parsermodule.c +++ /dev/null @@ -1,3493 +0,0 @@ -/* parsermodule.c - * - * Copyright 1995-1996 by Fred L. Drake, Jr. and Virginia Polytechnic - * Institute and State University, Blacksburg, Virginia, USA. - * Portions copyright 1991-1995 by Stichting Mathematisch Centrum, - * Amsterdam, The Netherlands. Copying is permitted under the terms - * associated with the main Python distribution, with the additional - * restriction that this additional notice be included and maintained - * on all distributed copies. - * - * This module serves to replace the original parser module written - * by Guido. The functionality is not matched precisely, but the - * original may be implemented on top of this. This is desirable - * since the source of the text to be parsed is now divorced from - * this interface. - * - * Unlike the prior interface, the ability to give a parse tree - * produced by Python code as a tuple to the compiler is enabled by - * this module. See the documentation for more details. - * - * I've added some annotations that help with the lint code-checking - * program, but they're not complete by a long shot. The real errors - * that lint detects are gone, but there are still warnings with - * Py_[X]DECREF() and Py_[X]INCREF() macros. The lint annotations - * look like "NOTE(...)". - */ - -#include "Python.h" /* general Python API */ -#include "Python-ast.h" /* mod_ty */ -#include "graminit.h" /* symbols defined in the grammar */ -#include "node.h" /* internal parser structure */ -#include "errcode.h" /* error codes for PyNode_*() */ -#include "token.h" /* token definitions */ -#include "grammar.h" -#include "parsetok.h" - /* ISTERMINAL() / ISNONTERMINAL() */ -#include "compile.h" -#undef Yield -#include "ast.h" -#include "pyarena.h" - -extern grammar _PyParser_Grammar; /* From graminit.c */ - -#ifdef lint -#include -#else -#define NOTE(x) -#endif - -/* String constants used to initialize module attributes. - * - */ -static char parser_copyright_string[] = -"Copyright 1995-1996 by Virginia Polytechnic Institute & State\n\ -University, Blacksburg, Virginia, USA, and Fred L. Drake, Jr., Reston,\n\ -Virginia, USA. Portions copyright 1991-1995 by Stichting Mathematisch\n\ -Centrum, Amsterdam, The Netherlands."; - - -PyDoc_STRVAR(parser_doc_string, -"This is an interface to Python's internal parser."); - -static char parser_version_string[] = "0.5"; - - -typedef PyObject* (*SeqMaker) (Py_ssize_t length); -typedef int (*SeqInserter) (PyObject* sequence, - Py_ssize_t index, - PyObject* element); - -/* The function below is copyrighted by Stichting Mathematisch Centrum. The - * original copyright statement is included below, and continues to apply - * in full to the function immediately following. All other material is - * original, copyrighted by Fred L. Drake, Jr. and Virginia Polytechnic - * Institute and State University. Changes were made to comply with the - * new naming conventions. Added arguments to provide support for creating - * lists as well as tuples, and optionally including the line numbers. - */ - - -static PyObject* -node2tuple(node *n, /* node to convert */ - SeqMaker mkseq, /* create sequence */ - SeqInserter addelem, /* func. to add elem. in seq. */ - int lineno, /* include line numbers? */ - int col_offset) /* include column offsets? */ -{ - if (n == NULL) { - Py_INCREF(Py_None); - return (Py_None); - } - if (ISNONTERMINAL(TYPE(n))) { - int i; - PyObject *v; - PyObject *w; - - v = mkseq(1 + NCH(n) + (TYPE(n) == encoding_decl)); - if (v == NULL) - return (v); - w = PyInt_FromLong(TYPE(n)); - if (w == NULL) { - Py_DECREF(v); - return ((PyObject*) NULL); - } - (void) addelem(v, 0, w); - for (i = 0; i < NCH(n); i++) { - w = node2tuple(CHILD(n, i), mkseq, addelem, lineno, col_offset); - if (w == NULL) { - Py_DECREF(v); - return ((PyObject*) NULL); - } - (void) addelem(v, i+1, w); - } - - if (TYPE(n) == encoding_decl) - (void) addelem(v, i+1, PyString_FromString(STR(n))); - return (v); - } - else if (ISTERMINAL(TYPE(n))) { - PyObject *result = mkseq(2 + lineno + col_offset); - if (result != NULL) { - (void) addelem(result, 0, PyInt_FromLong(TYPE(n))); - (void) addelem(result, 1, PyString_FromString(STR(n))); - if (lineno == 1) - (void) addelem(result, 2, PyInt_FromLong(n->n_lineno)); - if (col_offset == 1) - (void) addelem(result, 3, PyInt_FromLong(n->n_col_offset)); - } - return (result); - } - else { - PyErr_SetString(PyExc_SystemError, - "unrecognized parse tree node type"); - return ((PyObject*) NULL); - } -} -/* - * End of material copyrighted by Stichting Mathematisch Centrum. - */ - - - -/* There are two types of intermediate objects we're interested in: - * 'eval' and 'exec' types. These constants can be used in the st_type - * field of the object type to identify which any given object represents. - * These should probably go in an external header to allow other extensions - * to use them, but then, we really should be using C++ too. ;-) - */ - -#define PyST_EXPR 1 -#define PyST_SUITE 2 - - -/* These are the internal objects and definitions required to implement the - * ST type. Most of the internal names are more reminiscent of the 'old' - * naming style, but the code uses the new naming convention. - */ - -static PyObject* -parser_error = 0; - - -typedef struct { - PyObject_HEAD /* standard object header */ - node* st_node; /* the node* returned by the parser */ - int st_type; /* EXPR or SUITE ? */ - PyCompilerFlags st_flags; /* Parser and compiler flags */ -} PyST_Object; - - -static void parser_free(PyST_Object *st); -static PyObject* parser_sizeof(PyST_Object *, void *); -static int parser_compare(PyST_Object *left, PyST_Object *right); -static PyObject *parser_getattr(PyObject *self, char *name); -static PyObject* parser_compilest(PyST_Object *, PyObject *, PyObject *); -static PyObject* parser_isexpr(PyST_Object *, PyObject *, PyObject *); -static PyObject* parser_issuite(PyST_Object *, PyObject *, PyObject *); -static PyObject* parser_st2list(PyST_Object *, PyObject *, PyObject *); -static PyObject* parser_st2tuple(PyST_Object *, PyObject *, PyObject *); - -#define PUBLIC_METHOD_TYPE (METH_VARARGS|METH_KEYWORDS) - -static PyMethodDef -parser_methods[] = { - {"compile", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, - PyDoc_STR("Compile this ST object into a code object.")}, - {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, - PyDoc_STR("Determines if this ST object was created from an expression.")}, - {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, - PyDoc_STR("Determines if this ST object was created from a suite.")}, - {"tolist", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates a list-tree representation of this ST.")}, - {"totuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates a tuple-tree representation of this ST.")}, - {"__sizeof__", (PyCFunction)parser_sizeof, METH_NOARGS, - PyDoc_STR("Returns size in memory, in bytes.")}, - {NULL, NULL, 0, NULL} -}; - -static -PyTypeObject PyST_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "parser.st", /* tp_name */ - (int) sizeof(PyST_Object), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)parser_free, /* tp_dealloc */ - 0, /* tp_print */ - parser_getattr, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)parser_compare, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - - /* Functions to access object as input/output buffer */ - 0, /* tp_as_buffer */ - - Py_TPFLAGS_DEFAULT, /* tp_flags */ - - /* __doc__ */ - "Intermediate representation of a Python parse tree.", - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - parser_methods, /* tp_methods */ -}; /* PyST_Type */ - - -static int -parser_compare_nodes(node *left, node *right) -{ - int j; - - if (TYPE(left) < TYPE(right)) - return (-1); - - if (TYPE(right) < TYPE(left)) - return (1); - - if (ISTERMINAL(TYPE(left))) - return (strcmp(STR(left), STR(right))); - - if (NCH(left) < NCH(right)) - return (-1); - - if (NCH(right) < NCH(left)) - return (1); - - for (j = 0; j < NCH(left); ++j) { - int v = parser_compare_nodes(CHILD(left, j), CHILD(right, j)); - - if (v != 0) - return (v); - } - return (0); -} - - -/* int parser_compare(PyST_Object* left, PyST_Object* right) - * - * Comparison function used by the Python operators ==, !=, <, >, <=, >= - * This really just wraps a call to parser_compare_nodes() with some easy - * checks and protection code. - * - */ -static int -parser_compare(PyST_Object *left, PyST_Object *right) -{ - if (left == right) - return (0); - - if ((left == 0) || (right == 0)) - return (-1); - - return (parser_compare_nodes(left->st_node, right->st_node)); -} - - -/* parser_newstobject(node* st) - * - * Allocates a new Python object representing an ST. This is simply the - * 'wrapper' object that holds a node* and allows it to be passed around in - * Python code. - * - */ -static PyObject* -parser_newstobject(node *st, int type) -{ - PyST_Object* o = PyObject_New(PyST_Object, &PyST_Type); - - if (o != 0) { - o->st_node = st; - o->st_type = type; - o->st_flags.cf_flags = 0; - } - else { - PyNode_Free(st); - } - return ((PyObject*)o); -} - - -/* void parser_free(PyST_Object* st) - * - * This is called by a del statement that reduces the reference count to 0. - * - */ -static void -parser_free(PyST_Object *st) -{ - PyNode_Free(st->st_node); - PyObject_Del(st); -} - - -/* parser_st2tuple(PyObject* self, PyObject* args, PyObject* kw) - * - * This provides conversion from a node* to a tuple object that can be - * returned to the Python-level caller. The ST object is not modified. - * - */ -static PyObject* -parser_st2tuple(PyST_Object *self, PyObject *args, PyObject *kw) -{ - PyObject *line_option = 0; - PyObject *col_option = 0; - PyObject *res = 0; - int ok; - - static char *keywords[] = {"ast", "line_info", "col_info", NULL}; - - if (self == NULL) { - ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|OO:st2tuple", keywords, - &PyST_Type, &self, &line_option, - &col_option); - } - else - ok = PyArg_ParseTupleAndKeywords(args, kw, "|OO:totuple", &keywords[1], - &line_option, &col_option); - if (ok != 0) { - int lineno = 0; - int col_offset = 0; - if (line_option != NULL) { - lineno = PyObject_IsTrue(line_option); - if (lineno < 0) - return NULL; - } - if (col_option != NULL) { - col_offset = PyObject_IsTrue(col_option); - if (col_offset < 0) - return NULL; - } - /* - * Convert ST into a tuple representation. Use Guido's function, - * since it's known to work already. - */ - res = node2tuple(((PyST_Object*)self)->st_node, - PyTuple_New, PyTuple_SetItem, lineno, col_offset); - } - return (res); -} - -static PyObject* -parser_ast2tuple(PyST_Object *self, PyObject *args, PyObject *kw) -{ - if (PyErr_WarnPy3k("ast2tuple is removed in 3.x; use st2tuple", 1) < 0) - return NULL; - return parser_st2tuple(self, args, kw); -} - - -/* parser_st2list(PyObject* self, PyObject* args, PyObject* kw) - * - * This provides conversion from a node* to a list object that can be - * returned to the Python-level caller. The ST object is not modified. - * - */ -static PyObject* -parser_st2list(PyST_Object *self, PyObject *args, PyObject *kw) -{ - PyObject *line_option = 0; - PyObject *col_option = 0; - PyObject *res = 0; - int ok; - - static char *keywords[] = {"ast", "line_info", "col_info", NULL}; - - if (self == NULL) - ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|OO:st2list", keywords, - &PyST_Type, &self, &line_option, - &col_option); - else - ok = PyArg_ParseTupleAndKeywords(args, kw, "|OO:tolist", &keywords[1], - &line_option, &col_option); - if (ok) { - int lineno = 0; - int col_offset = 0; - if (line_option != 0) { - lineno = PyObject_IsTrue(line_option); - if (lineno < 0) - return NULL; - } - if (col_option != 0) { - col_offset = PyObject_IsTrue(col_option); - if (col_offset < 0) - return NULL; - } - /* - * Convert ST into a tuple representation. Use Guido's function, - * since it's known to work already. - */ - res = node2tuple(self->st_node, - PyList_New, PyList_SetItem, lineno, col_offset); - } - return (res); -} - -static PyObject* -parser_ast2list(PyST_Object *self, PyObject *args, PyObject *kw) -{ - if (PyErr_WarnPy3k("ast2list is removed in 3.x; use st2list", 1) < 0) - return NULL; - return parser_st2list(self, args, kw); -} - - -/* parser_compilest(PyObject* self, PyObject* args) - * - * This function creates code objects from the parse tree represented by - * the passed-in data object. An optional file name is passed in as well. - * - */ -static PyObject* -parser_compilest(PyST_Object *self, PyObject *args, PyObject *kw) -{ - PyObject* res = 0; - PyArena* arena; - mod_ty mod; - char* str = ""; - int ok; - - static char *keywords[] = {"ast", "filename", NULL}; - - if (self == NULL) - ok = PyArg_ParseTupleAndKeywords(args, kw, "O!|s:compilest", keywords, - &PyST_Type, &self, &str); - else - ok = PyArg_ParseTupleAndKeywords(args, kw, "|s:compile", &keywords[1], - &str); - - if (ok) { - arena = PyArena_New(); - if (arena) { - mod = PyAST_FromNode(self->st_node, &(self->st_flags), str, arena); - if (mod) { - res = (PyObject *)PyAST_Compile(mod, str, &(self->st_flags), arena); - } - PyArena_Free(arena); - } - } - - return (res); -} - -static PyObject* -parser_compileast(PyST_Object *self, PyObject *args, PyObject *kw) -{ - if (PyErr_WarnPy3k("compileast is removed in 3.x; use compilest", 1) < 0) - return NULL; - return parser_compilest(self, args, kw); -} - - -/* PyObject* parser_isexpr(PyObject* self, PyObject* args) - * PyObject* parser_issuite(PyObject* self, PyObject* args) - * - * Checks the passed-in ST object to determine if it is an expression or - * a statement suite, respectively. The return is a Python truth value. - * - */ -static PyObject* -parser_isexpr(PyST_Object *self, PyObject *args, PyObject *kw) -{ - PyObject* res = 0; - int ok; - - static char *keywords[] = {"ast", NULL}; - - if (self == NULL) - ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:isexpr", keywords, - &PyST_Type, &self); - else - ok = PyArg_ParseTupleAndKeywords(args, kw, ":isexpr", &keywords[1]); - - if (ok) { - /* Check to see if the ST represents an expression or not. */ - res = (self->st_type == PyST_EXPR) ? Py_True : Py_False; - Py_INCREF(res); - } - return (res); -} - - -static PyObject* -parser_issuite(PyST_Object *self, PyObject *args, PyObject *kw) -{ - PyObject* res = 0; - int ok; - - static char *keywords[] = {"ast", NULL}; - - if (self == NULL) - ok = PyArg_ParseTupleAndKeywords(args, kw, "O!:issuite", keywords, - &PyST_Type, &self); - else - ok = PyArg_ParseTupleAndKeywords(args, kw, ":issuite", &keywords[1]); - - if (ok) { - /* Check to see if the ST represents an expression or not. */ - res = (self->st_type == PyST_EXPR) ? Py_False : Py_True; - Py_INCREF(res); - } - return (res); -} - - -static PyObject* -parser_getattr(PyObject *self, char *name) -{ - return (Py_FindMethod(parser_methods, self, name)); -} - - -/* err_string(char* message) - * - * Sets the error string for an exception of type ParserError. - * - */ -static void -err_string(char *message) -{ - PyErr_SetString(parser_error, message); -} - - -/* PyObject* parser_do_parse(PyObject* args, int type) - * - * Internal function to actually execute the parse and return the result if - * successful or set an exception if not. - * - */ -static PyObject* -parser_do_parse(PyObject *args, PyObject *kw, char *argspec, int type) -{ - char* string = 0; - PyObject* res = 0; - int flags = 0; - perrdetail err; - - static char *keywords[] = {"source", NULL}; - - if (PyArg_ParseTupleAndKeywords(args, kw, argspec, keywords, &string)) { - node* n = PyParser_ParseStringFlagsFilenameEx(string, NULL, - &_PyParser_Grammar, - (type == PyST_EXPR) - ? eval_input : file_input, - &err, &flags); - - if (n) { - res = parser_newstobject(n, type); - if (res) - ((PyST_Object *)res)->st_flags.cf_flags = flags & PyCF_MASK; - } - else - PyParser_SetError(&err); - } - return (res); -} - - -/* PyObject* parser_expr(PyObject* self, PyObject* args) - * PyObject* parser_suite(PyObject* self, PyObject* args) - * - * External interfaces to the parser itself. Which is called determines if - * the parser attempts to recognize an expression ('eval' form) or statement - * suite ('exec' form). The real work is done by parser_do_parse() above. - * - */ -static PyObject* -parser_expr(PyST_Object *self, PyObject *args, PyObject *kw) -{ - NOTE(ARGUNUSED(self)) - return (parser_do_parse(args, kw, "s:expr", PyST_EXPR)); -} - - -static PyObject* -parser_suite(PyST_Object *self, PyObject *args, PyObject *kw) -{ - NOTE(ARGUNUSED(self)) - return (parser_do_parse(args, kw, "s:suite", PyST_SUITE)); -} - - - -/* This is the messy part of the code. Conversion from a tuple to an ST - * object requires that the input tuple be valid without having to rely on - * catching an exception from the compiler. This is done to allow the - * compiler itself to remain fast, since most of its input will come from - * the parser directly, and therefore be known to be syntactically correct. - * This validation is done to ensure that we don't core dump the compile - * phase, returning an exception instead. - * - * Two aspects can be broken out in this code: creating a node tree from - * the tuple passed in, and verifying that it is indeed valid. It may be - * advantageous to expand the number of ST types to include funcdefs and - * lambdadefs to take advantage of the optimizer, recognizing those STs - * here. They are not necessary, and not quite as useful in a raw form. - * For now, let's get expressions and suites working reliably. - */ - - -static node* build_node_tree(PyObject *tuple); -static int validate_expr_tree(node *tree); -static int validate_file_input(node *tree); -static int validate_encoding_decl(node *tree); - -/* PyObject* parser_tuple2st(PyObject* self, PyObject* args) - * - * This is the public function, called from the Python code. It receives a - * single tuple object from the caller, and creates an ST object if the - * tuple can be validated. It does this by checking the first code of the - * tuple, and, if acceptable, builds the internal representation. If this - * step succeeds, the internal representation is validated as fully as - * possible with the various validate_*() routines defined below. - * - * This function must be changed if support is to be added for PyST_FRAGMENT - * ST objects. - * - */ -static PyObject* -parser_tuple2st(PyST_Object *self, PyObject *args, PyObject *kw) -{ - NOTE(ARGUNUSED(self)) - PyObject *st = 0; - PyObject *tuple; - node *tree; - - static char *keywords[] = {"sequence", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "O:sequence2st", keywords, - &tuple)) - return (0); - if (!PySequence_Check(tuple)) { - PyErr_SetString(PyExc_ValueError, - "sequence2st() requires a single sequence argument"); - return (0); - } - /* - * Convert the tree to the internal form before checking it. - */ - tree = build_node_tree(tuple); - if (tree != 0) { - int start_sym = TYPE(tree); - if (start_sym == eval_input) { - /* Might be an eval form. */ - if (validate_expr_tree(tree)) - st = parser_newstobject(tree, PyST_EXPR); - else - PyNode_Free(tree); - } - else if (start_sym == file_input) { - /* This looks like an exec form so far. */ - if (validate_file_input(tree)) - st = parser_newstobject(tree, PyST_SUITE); - else - PyNode_Free(tree); - } - else if (start_sym == encoding_decl) { - /* This looks like an encoding_decl so far. */ - if (validate_encoding_decl(tree)) - st = parser_newstobject(tree, PyST_SUITE); - else - PyNode_Free(tree); - } - else { - /* This is a fragment, at best. */ - PyNode_Free(tree); - err_string("parse tree does not use a valid start symbol"); - } - } - /* Make sure we raise an exception on all errors. We should never - * get this, but we'd do well to be sure something is done. - */ - if (st == NULL && !PyErr_Occurred()) - err_string("unspecified ST error occurred"); - - return st; -} - -static PyObject* -parser_tuple2ast(PyST_Object *self, PyObject *args, PyObject *kw) -{ - if (PyErr_WarnPy3k("tuple2ast is removed in 3.x; use tuple2st", 1) < 0) - return NULL; - return parser_tuple2st(self, args, kw); -} - -static PyObject * -parser_sizeof(PyST_Object *st, void *unused) -{ - Py_ssize_t res; - - res = sizeof(PyST_Object) + _PyNode_SizeOf(st->st_node); - return PyLong_FromSsize_t(res); -} - - -/* node* build_node_children() - * - * Iterate across the children of the current non-terminal node and build - * their structures. If successful, return the root of this portion of - * the tree, otherwise, 0. Any required exception will be specified already, - * and no memory will have been deallocated. - * - */ -static node* -build_node_children(PyObject *tuple, node *root, int *line_num) -{ - Py_ssize_t len = PyObject_Size(tuple); - Py_ssize_t i; - int err; - - for (i = 1; i < len; ++i) { - /* elem must always be a sequence, however simple */ - PyObject* elem = PySequence_GetItem(tuple, i); - int ok = elem != NULL; - long type = 0; - char *strn = 0; - - if (ok) - ok = PySequence_Check(elem); - if (ok) { - PyObject *temp = PySequence_GetItem(elem, 0); - if (temp == NULL) - ok = 0; - else { - ok = PyInt_Check(temp); - if (ok) - type = PyInt_AS_LONG(temp); - Py_DECREF(temp); - } - } - if (!ok) { - PyObject *err = Py_BuildValue("os", elem, - "Illegal node construct."); - PyErr_SetObject(parser_error, err); - Py_XDECREF(err); - Py_XDECREF(elem); - return (0); - } - if (ISTERMINAL(type)) { - Py_ssize_t len = PyObject_Size(elem); - PyObject *temp; - - if ((len != 2) && (len != 3)) { - err_string("terminal nodes must have 2 or 3 entries"); - return 0; - } - temp = PySequence_GetItem(elem, 1); - if (temp == NULL) - return 0; - if (!PyString_Check(temp)) { - PyErr_Format(parser_error, - "second item in terminal node must be a string," - " found %s", - Py_TYPE(temp)->tp_name); - Py_DECREF(temp); - return 0; - } - if (len == 3) { - PyObject *o = PySequence_GetItem(elem, 2); - if (o != NULL) { - if (PyInt_Check(o)) - *line_num = PyInt_AS_LONG(o); - else { - PyErr_Format(parser_error, - "third item in terminal node must be an" - " integer, found %s", - Py_TYPE(temp)->tp_name); - Py_DECREF(o); - Py_DECREF(temp); - return 0; - } - Py_DECREF(o); - } - } - len = PyString_GET_SIZE(temp) + 1; - strn = (char *)PyObject_MALLOC(len); - if (strn != NULL) - (void) memcpy(strn, PyString_AS_STRING(temp), len); - Py_DECREF(temp); - } - else if (!ISNONTERMINAL(type)) { - /* - * It has to be one or the other; this is an error. - * Raise an exception. - */ - PyObject *err = Py_BuildValue("os", elem, "unknown node type."); - PyErr_SetObject(parser_error, err); - Py_XDECREF(err); - Py_XDECREF(elem); - return (0); - } - err = PyNode_AddChild(root, type, strn, *line_num, 0); - if (err == E_NOMEM) { - PyObject_FREE(strn); - return (node *) PyErr_NoMemory(); - } - if (err == E_OVERFLOW) { - PyObject_FREE(strn); - PyErr_SetString(PyExc_ValueError, - "unsupported number of child nodes"); - return NULL; - } - - if (ISNONTERMINAL(type)) { - node* new_child = CHILD(root, i - 1); - - if (new_child != build_node_children(elem, new_child, line_num)) { - Py_XDECREF(elem); - return (0); - } - } - else if (type == NEWLINE) { /* It's true: we increment the */ - ++(*line_num); /* line number *after* the newline! */ - } - Py_XDECREF(elem); - } - return root; -} - - -static node* -build_node_tree(PyObject *tuple) -{ - node* res = 0; - PyObject *temp = PySequence_GetItem(tuple, 0); - long num = -1; - - if (temp != NULL) - num = PyInt_AsLong(temp); - Py_XDECREF(temp); - if (ISTERMINAL(num)) { - /* - * The tuple is simple, but it doesn't start with a start symbol. - * Raise an exception now and be done with it. - */ - tuple = Py_BuildValue("os", tuple, - "Illegal syntax-tree; cannot start with terminal symbol."); - PyErr_SetObject(parser_error, tuple); - Py_XDECREF(tuple); - } - else if (ISNONTERMINAL(num)) { - /* - * Not efficient, but that can be handled later. - */ - int line_num = 0; - PyObject *encoding = NULL; - - if (num == encoding_decl) { - encoding = PySequence_GetItem(tuple, 2); - /* tuple isn't borrowed anymore here, need to DECREF */ - tuple = PySequence_GetSlice(tuple, 0, 2); - } - res = PyNode_New(num); - if (res != NULL) { - if (res != build_node_children(tuple, res, &line_num)) { - PyNode_Free(res); - res = NULL; - } - if (res && encoding) { - Py_ssize_t len; - len = PyString_GET_SIZE(encoding) + 1; - res->n_str = (char *)PyObject_MALLOC(len); - if (res->n_str != NULL) - (void) memcpy(res->n_str, PyString_AS_STRING(encoding), len); - Py_DECREF(encoding); - Py_DECREF(tuple); - } - } - } - else { - /* The tuple is illegal -- if the number is neither TERMINAL nor - * NONTERMINAL, we can't use it. Not sure the implementation - * allows this condition, but the API doesn't preclude it. - */ - PyObject *err = Py_BuildValue("os", tuple, - "Illegal component tuple."); - PyErr_SetObject(parser_error, err); - Py_XDECREF(err); - } - - return (res); -} - - -/* - * Validation routines used within the validation section: - */ -static int validate_terminal(node *terminal, int type, char *string); - -#define validate_ampersand(ch) validate_terminal(ch, AMPER, "&") -#define validate_circumflex(ch) validate_terminal(ch, CIRCUMFLEX, "^") -#define validate_colon(ch) validate_terminal(ch, COLON, ":") -#define validate_comma(ch) validate_terminal(ch, COMMA, ",") -#define validate_dedent(ch) validate_terminal(ch, DEDENT, "") -#define validate_equal(ch) validate_terminal(ch, EQUAL, "=") -#define validate_indent(ch) validate_terminal(ch, INDENT, (char*)NULL) -#define validate_lparen(ch) validate_terminal(ch, LPAR, "(") -#define validate_newline(ch) validate_terminal(ch, NEWLINE, (char*)NULL) -#define validate_rparen(ch) validate_terminal(ch, RPAR, ")") -#define validate_semi(ch) validate_terminal(ch, SEMI, ";") -#define validate_star(ch) validate_terminal(ch, STAR, "*") -#define validate_vbar(ch) validate_terminal(ch, VBAR, "|") -#define validate_doublestar(ch) validate_terminal(ch, DOUBLESTAR, "**") -#define validate_dot(ch) validate_terminal(ch, DOT, ".") -#define validate_at(ch) validate_terminal(ch, AT, "@") -#define validate_name(ch, str) validate_terminal(ch, NAME, str) - -#define VALIDATER(n) static int validate_##n(node *tree) - -VALIDATER(node); VALIDATER(small_stmt); -VALIDATER(class); VALIDATER(node); -VALIDATER(parameters); VALIDATER(suite); -VALIDATER(testlist); VALIDATER(varargslist); -VALIDATER(fpdef); VALIDATER(fplist); -VALIDATER(stmt); VALIDATER(simple_stmt); -VALIDATER(expr_stmt); VALIDATER(power); -VALIDATER(print_stmt); VALIDATER(del_stmt); -VALIDATER(return_stmt); VALIDATER(list_iter); -VALIDATER(raise_stmt); VALIDATER(import_stmt); -VALIDATER(import_name); VALIDATER(import_from); -VALIDATER(global_stmt); VALIDATER(list_if); -VALIDATER(assert_stmt); VALIDATER(list_for); -VALIDATER(exec_stmt); VALIDATER(compound_stmt); -VALIDATER(while); VALIDATER(for); -VALIDATER(try); VALIDATER(except_clause); -VALIDATER(test); VALIDATER(and_test); -VALIDATER(not_test); VALIDATER(comparison); -VALIDATER(comp_op); VALIDATER(expr); -VALIDATER(xor_expr); VALIDATER(and_expr); -VALIDATER(shift_expr); VALIDATER(arith_expr); -VALIDATER(term); VALIDATER(factor); -VALIDATER(atom); VALIDATER(lambdef); -VALIDATER(trailer); VALIDATER(subscript); -VALIDATER(subscriptlist); VALIDATER(sliceop); -VALIDATER(exprlist); VALIDATER(dictorsetmaker); -VALIDATER(arglist); VALIDATER(argument); -VALIDATER(listmaker); VALIDATER(yield_stmt); -VALIDATER(testlist1); VALIDATER(comp_for); -VALIDATER(comp_iter); VALIDATER(comp_if); -VALIDATER(testlist_comp); VALIDATER(yield_expr); -VALIDATER(yield_or_testlist); VALIDATER(or_test); -VALIDATER(old_test); VALIDATER(old_lambdef); - -#undef VALIDATER - -#define is_even(n) (((n) & 1) == 0) -#define is_odd(n) (((n) & 1) == 1) - - -static int -validate_ntype(node *n, int t) -{ - if (TYPE(n) != t) { - PyErr_Format(parser_error, "Expected node type %d, got %d.", - t, TYPE(n)); - return 0; - } - return 1; -} - - -/* Verifies that the number of child nodes is exactly 'num', raising - * an exception if it isn't. The exception message does not indicate - * the exact number of nodes, allowing this to be used to raise the - * "right" exception when the wrong number of nodes is present in a - * specific variant of a statement's syntax. This is commonly used - * in that fashion. - */ -static int -validate_numnodes(node *n, int num, const char *const name) -{ - if (NCH(n) != num) { - PyErr_Format(parser_error, - "Illegal number of children for %s node.", name); - return 0; - } - return 1; -} - - -static int -validate_terminal(node *terminal, int type, char *string) -{ - int res = (validate_ntype(terminal, type) - && ((string == 0) || (strcmp(string, STR(terminal)) == 0))); - - if (!res && !PyErr_Occurred()) { - PyErr_Format(parser_error, - "Illegal terminal: expected \"%s\"", string); - } - return (res); -} - - -/* X (',' X) [','] - */ -static int -validate_repeating_list(node *tree, int ntype, int (*vfunc)(node *), - const char *const name) -{ - int nch = NCH(tree); - int res = (nch && validate_ntype(tree, ntype) - && vfunc(CHILD(tree, 0))); - - if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 1, name); - else { - if (is_even(nch)) - res = validate_comma(CHILD(tree, --nch)); - if (res && nch > 1) { - int pos = 1; - for ( ; res && pos < nch; pos += 2) - res = (validate_comma(CHILD(tree, pos)) - && vfunc(CHILD(tree, pos + 1))); - } - } - return (res); -} - - -/* validate_class() - * - * classdef: - * 'class' NAME ['(' testlist ')'] ':' suite - */ -static int -validate_class(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, classdef) && - ((nch == 4) || (nch == 6) || (nch == 7))); - - if (res) { - res = (validate_name(CHILD(tree, 0), "class") - && validate_ntype(CHILD(tree, 1), NAME) - && validate_colon(CHILD(tree, nch - 2)) - && validate_suite(CHILD(tree, nch - 1))); - } - else { - (void) validate_numnodes(tree, 4, "class"); - } - - if (res) { - if (nch == 7) { - res = ((validate_lparen(CHILD(tree, 2)) && - validate_testlist(CHILD(tree, 3)) && - validate_rparen(CHILD(tree, 4)))); - } - else if (nch == 6) { - res = (validate_lparen(CHILD(tree,2)) && - validate_rparen(CHILD(tree,3))); - } - } - return (res); -} - - -/* if_stmt: - * 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite] - */ -static int -validate_if(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, if_stmt) - && (nch >= 4) - && validate_name(CHILD(tree, 0), "if") - && validate_test(CHILD(tree, 1)) - && validate_colon(CHILD(tree, 2)) - && validate_suite(CHILD(tree, 3))); - - if (res && ((nch % 4) == 3)) { - /* ... 'else' ':' suite */ - res = (validate_name(CHILD(tree, nch - 3), "else") - && validate_colon(CHILD(tree, nch - 2)) - && validate_suite(CHILD(tree, nch - 1))); - nch -= 3; - } - else if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 4, "if"); - if ((nch % 4) != 0) - /* Will catch the case for nch < 4 */ - res = validate_numnodes(tree, 0, "if"); - else if (res && (nch > 4)) { - /* ... ('elif' test ':' suite)+ ... */ - int j = 4; - while ((j < nch) && res) { - res = (validate_name(CHILD(tree, j), "elif") - && validate_colon(CHILD(tree, j + 2)) - && validate_test(CHILD(tree, j + 1)) - && validate_suite(CHILD(tree, j + 3))); - j += 4; - } - } - return (res); -} - - -/* parameters: - * '(' [varargslist] ')' - * - */ -static int -validate_parameters(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, parameters) && ((nch == 2) || (nch == 3)); - - if (res) { - res = (validate_lparen(CHILD(tree, 0)) - && validate_rparen(CHILD(tree, nch - 1))); - if (res && (nch == 3)) - res = validate_varargslist(CHILD(tree, 1)); - } - else { - (void) validate_numnodes(tree, 2, "parameters"); - } - return (res); -} - - -/* validate_suite() - * - * suite: - * simple_stmt - * | NEWLINE INDENT stmt+ DEDENT - */ -static int -validate_suite(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, suite) && ((nch == 1) || (nch >= 4))); - - if (res && (nch == 1)) - res = validate_simple_stmt(CHILD(tree, 0)); - else if (res) { - /* NEWLINE INDENT stmt+ DEDENT */ - res = (validate_newline(CHILD(tree, 0)) - && validate_indent(CHILD(tree, 1)) - && validate_stmt(CHILD(tree, 2)) - && validate_dedent(CHILD(tree, nch - 1))); - - if (res && (nch > 4)) { - int i = 3; - --nch; /* forget the DEDENT */ - for ( ; res && (i < nch); ++i) - res = validate_stmt(CHILD(tree, i)); - } - else if (nch < 4) - res = validate_numnodes(tree, 4, "suite"); - } - return (res); -} - - -static int -validate_testlist(node *tree) -{ - return (validate_repeating_list(tree, testlist, - validate_test, "testlist")); -} - - -static int -validate_testlist1(node *tree) -{ - return (validate_repeating_list(tree, testlist1, - validate_test, "testlist1")); -} - - -static int -validate_testlist_safe(node *tree) -{ - return (validate_repeating_list(tree, testlist_safe, - validate_old_test, "testlist_safe")); -} - - -/* '*' NAME [',' '**' NAME] | '**' NAME - */ -static int -validate_varargslist_trailer(node *tree, int start) -{ - int nch = NCH(tree); - int res = 0; - int sym; - - if (nch <= start) { - err_string("expected variable argument trailer for varargslist"); - return 0; - } - sym = TYPE(CHILD(tree, start)); - if (sym == STAR) { - /* - * ('*' NAME [',' '**' NAME] - */ - if (nch-start == 2) - res = validate_name(CHILD(tree, start+1), NULL); - else if (nch-start == 5) - res = (validate_name(CHILD(tree, start+1), NULL) - && validate_comma(CHILD(tree, start+2)) - && validate_doublestar(CHILD(tree, start+3)) - && validate_name(CHILD(tree, start+4), NULL)); - } - else if (sym == DOUBLESTAR) { - /* - * '**' NAME - */ - if (nch-start == 2) - res = validate_name(CHILD(tree, start+1), NULL); - } - if (!res) - err_string("illegal variable argument trailer for varargslist"); - return res; -} - - -/* validate_varargslist() - * - * varargslist: - * (fpdef ['=' test] ',')* - * ('*' NAME [',' '**' NAME] - * | '**' NAME) - * | fpdef ['=' test] (',' fpdef ['=' test])* [','] - * - */ -static int -validate_varargslist(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, varargslist) && (nch != 0); - int sym; - - if (!res) - return 0; - if (nch < 1) { - err_string("varargslist missing child nodes"); - return 0; - } - sym = TYPE(CHILD(tree, 0)); - if (sym == STAR || sym == DOUBLESTAR) - /* whole thing matches: - * '*' NAME [',' '**' NAME] | '**' NAME - */ - res = validate_varargslist_trailer(tree, 0); - else if (sym == fpdef) { - int i = 0; - - sym = TYPE(CHILD(tree, nch-1)); - if (sym == NAME) { - /* - * (fpdef ['=' test] ',')+ - * ('*' NAME [',' '**' NAME] - * | '**' NAME) - */ - /* skip over (fpdef ['=' test] ',')+ */ - while (res && (i+2 <= nch)) { - res = validate_fpdef(CHILD(tree, i)); - ++i; - if (res && TYPE(CHILD(tree, i)) == EQUAL && (i+2 <= nch)) { - res = (validate_equal(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - if (res) - i += 2; - } - if (res && i < nch) { - res = validate_comma(CHILD(tree, i)); - ++i; - if (res && i < nch - && (TYPE(CHILD(tree, i)) == DOUBLESTAR - || TYPE(CHILD(tree, i)) == STAR)) - break; - } - } - /* ... '*' NAME [',' '**' NAME] | '**' NAME - * i --^^^ - */ - if (res) - res = validate_varargslist_trailer(tree, i); - } - else { - /* - * fpdef ['=' test] (',' fpdef ['=' test])* [','] - */ - /* strip trailing comma node */ - if (sym == COMMA) { - res = validate_comma(CHILD(tree, nch-1)); - if (!res) - return 0; - --nch; - } - /* - * fpdef ['=' test] (',' fpdef ['=' test])* - */ - res = validate_fpdef(CHILD(tree, 0)); - ++i; - if (res && (i+2 <= nch) && TYPE(CHILD(tree, i)) == EQUAL) { - res = (validate_equal(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - i += 2; - } - /* - * ... (',' fpdef ['=' test])* - * i ---^^^ - */ - while (res && (nch - i) >= 2) { - res = (validate_comma(CHILD(tree, i)) - && validate_fpdef(CHILD(tree, i+1))); - i += 2; - if (res && (nch - i) >= 2 && TYPE(CHILD(tree, i)) == EQUAL) { - res = (validate_equal(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - i += 2; - } - } - if (res && nch - i != 0) { - res = 0; - err_string("illegal formation for varargslist"); - } - } - } - return res; -} - - -/* list_iter: list_for | list_if - */ -static int -validate_list_iter(node *tree) -{ - int res = (validate_ntype(tree, list_iter) - && validate_numnodes(tree, 1, "list_iter")); - if (res && TYPE(CHILD(tree, 0)) == list_for) - res = validate_list_for(CHILD(tree, 0)); - else - res = validate_list_if(CHILD(tree, 0)); - - return res; -} - -/* comp_iter: comp_for | comp_if - */ -static int -validate_comp_iter(node *tree) -{ - int res = (validate_ntype(tree, comp_iter) - && validate_numnodes(tree, 1, "comp_iter")); - if (res && TYPE(CHILD(tree, 0)) == comp_for) - res = validate_comp_for(CHILD(tree, 0)); - else - res = validate_comp_if(CHILD(tree, 0)); - - return res; -} - -/* list_for: 'for' exprlist 'in' testlist [list_iter] - */ -static int -validate_list_for(node *tree) -{ - int nch = NCH(tree); - int res; - - if (nch == 5) - res = validate_list_iter(CHILD(tree, 4)); - else - res = validate_numnodes(tree, 4, "list_for"); - - if (res) - res = (validate_name(CHILD(tree, 0), "for") - && validate_exprlist(CHILD(tree, 1)) - && validate_name(CHILD(tree, 2), "in") - && validate_testlist_safe(CHILD(tree, 3))); - - return res; -} - -/* comp_for: 'for' exprlist 'in' test [comp_iter] - */ -static int -validate_comp_for(node *tree) -{ - int nch = NCH(tree); - int res; - - if (nch == 5) - res = validate_comp_iter(CHILD(tree, 4)); - else - res = validate_numnodes(tree, 4, "comp_for"); - - if (res) - res = (validate_name(CHILD(tree, 0), "for") - && validate_exprlist(CHILD(tree, 1)) - && validate_name(CHILD(tree, 2), "in") - && validate_or_test(CHILD(tree, 3))); - - return res; -} - -/* list_if: 'if' old_test [list_iter] - */ -static int -validate_list_if(node *tree) -{ - int nch = NCH(tree); - int res; - - if (nch == 3) - res = validate_list_iter(CHILD(tree, 2)); - else - res = validate_numnodes(tree, 2, "list_if"); - - if (res) - res = (validate_name(CHILD(tree, 0), "if") - && validate_old_test(CHILD(tree, 1))); - - return res; -} - -/* comp_if: 'if' old_test [comp_iter] - */ -static int -validate_comp_if(node *tree) -{ - int nch = NCH(tree); - int res; - - if (nch == 3) - res = validate_comp_iter(CHILD(tree, 2)); - else - res = validate_numnodes(tree, 2, "comp_if"); - - if (res) - res = (validate_name(CHILD(tree, 0), "if") - && validate_old_test(CHILD(tree, 1))); - - return res; -} - -/* validate_fpdef() - * - * fpdef: - * NAME - * | '(' fplist ')' - */ -static int -validate_fpdef(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, fpdef); - - if (res) { - if (nch == 1) - res = validate_ntype(CHILD(tree, 0), NAME); - else if (nch == 3) - res = (validate_lparen(CHILD(tree, 0)) - && validate_fplist(CHILD(tree, 1)) - && validate_rparen(CHILD(tree, 2))); - else - res = validate_numnodes(tree, 1, "fpdef"); - } - return (res); -} - - -static int -validate_fplist(node *tree) -{ - return (validate_repeating_list(tree, fplist, - validate_fpdef, "fplist")); -} - - -/* simple_stmt | compound_stmt - * - */ -static int -validate_stmt(node *tree) -{ - int res = (validate_ntype(tree, stmt) - && validate_numnodes(tree, 1, "stmt")); - - if (res) { - tree = CHILD(tree, 0); - - if (TYPE(tree) == simple_stmt) - res = validate_simple_stmt(tree); - else - res = validate_compound_stmt(tree); - } - return (res); -} - - -/* small_stmt (';' small_stmt)* [';'] NEWLINE - * - */ -static int -validate_simple_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, simple_stmt) - && (nch >= 2) - && validate_small_stmt(CHILD(tree, 0)) - && validate_newline(CHILD(tree, nch - 1))); - - if (nch < 2) - res = validate_numnodes(tree, 2, "simple_stmt"); - --nch; /* forget the NEWLINE */ - if (res && is_even(nch)) - res = validate_semi(CHILD(tree, --nch)); - if (res && (nch > 2)) { - int i; - - for (i = 1; res && (i < nch); i += 2) - res = (validate_semi(CHILD(tree, i)) - && validate_small_stmt(CHILD(tree, i + 1))); - } - return (res); -} - - -static int -validate_small_stmt(node *tree) -{ - int nch = NCH(tree); - int res = validate_numnodes(tree, 1, "small_stmt"); - - if (res) { - int ntype = TYPE(CHILD(tree, 0)); - - if ( (ntype == expr_stmt) - || (ntype == print_stmt) - || (ntype == del_stmt) - || (ntype == pass_stmt) - || (ntype == flow_stmt) - || (ntype == import_stmt) - || (ntype == global_stmt) - || (ntype == assert_stmt) - || (ntype == exec_stmt)) - res = validate_node(CHILD(tree, 0)); - else { - res = 0; - err_string("illegal small_stmt child type"); - } - } - else if (nch == 1) { - res = 0; - PyErr_Format(parser_error, - "Unrecognized child node of small_stmt: %d.", - TYPE(CHILD(tree, 0))); - } - return (res); -} - - -/* compound_stmt: - * if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated - */ -static int -validate_compound_stmt(node *tree) -{ - int res = (validate_ntype(tree, compound_stmt) - && validate_numnodes(tree, 1, "compound_stmt")); - int ntype; - - if (!res) - return (0); - - tree = CHILD(tree, 0); - ntype = TYPE(tree); - if ( (ntype == if_stmt) - || (ntype == while_stmt) - || (ntype == for_stmt) - || (ntype == try_stmt) - || (ntype == with_stmt) - || (ntype == funcdef) - || (ntype == classdef) - || (ntype == decorated)) - res = validate_node(tree); - else { - res = 0; - PyErr_Format(parser_error, - "Illegal compound statement type: %d.", TYPE(tree)); - } - return (res); -} - -static int -validate_yield_or_testlist(node *tree) -{ - if (TYPE(tree) == yield_expr) - return validate_yield_expr(tree); - else - return validate_testlist(tree); -} - -static int -validate_expr_stmt(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, expr_stmt) - && is_odd(nch) - && validate_testlist(CHILD(tree, 0))); - - if (res && nch == 3 - && TYPE(CHILD(tree, 1)) == augassign) { - res = validate_numnodes(CHILD(tree, 1), 1, "augassign") - && validate_yield_or_testlist(CHILD(tree, 2)); - - if (res) { - char *s = STR(CHILD(CHILD(tree, 1), 0)); - - res = (strcmp(s, "+=") == 0 - || strcmp(s, "-=") == 0 - || strcmp(s, "*=") == 0 - || strcmp(s, "/=") == 0 - || strcmp(s, "//=") == 0 - || strcmp(s, "%=") == 0 - || strcmp(s, "&=") == 0 - || strcmp(s, "|=") == 0 - || strcmp(s, "^=") == 0 - || strcmp(s, "<<=") == 0 - || strcmp(s, ">>=") == 0 - || strcmp(s, "**=") == 0); - if (!res) - err_string("illegal augmented assignment operator"); - } - } - else { - for (j = 1; res && (j < nch); j += 2) - res = validate_equal(CHILD(tree, j)) - && validate_yield_or_testlist(CHILD(tree, j + 1)); - } - return (res); -} - - -/* print_stmt: - * - * 'print' ( [ test (',' test)* [','] ] - * | '>>' test [ (',' test)+ [','] ] ) - */ -static int -validate_print_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, print_stmt) - && (nch > 0) - && validate_name(CHILD(tree, 0), "print")); - - if (res && nch > 1) { - int sym = TYPE(CHILD(tree, 1)); - int i = 1; - int allow_trailing_comma = 1; - - if (sym == test) - res = validate_test(CHILD(tree, i++)); - else { - if (nch < 3) - res = validate_numnodes(tree, 3, "print_stmt"); - else { - res = (validate_ntype(CHILD(tree, i), RIGHTSHIFT) - && validate_test(CHILD(tree, i+1))); - i += 2; - allow_trailing_comma = 0; - } - } - if (res) { - /* ... (',' test)* [','] */ - while (res && i+2 <= nch) { - res = (validate_comma(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - allow_trailing_comma = 1; - i += 2; - } - if (res && !allow_trailing_comma) - res = validate_numnodes(tree, i, "print_stmt"); - else if (res && i < nch) - res = validate_comma(CHILD(tree, i)); - } - } - return (res); -} - - -static int -validate_del_stmt(node *tree) -{ - return (validate_numnodes(tree, 2, "del_stmt") - && validate_name(CHILD(tree, 0), "del") - && validate_exprlist(CHILD(tree, 1))); -} - - -static int -validate_return_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, return_stmt) - && ((nch == 1) || (nch == 2)) - && validate_name(CHILD(tree, 0), "return")); - - if (res && (nch == 2)) - res = validate_testlist(CHILD(tree, 1)); - - return (res); -} - - -static int -validate_raise_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, raise_stmt) - && ((nch == 1) || (nch == 2) || (nch == 4) || (nch == 6))); - - if (res) { - res = validate_name(CHILD(tree, 0), "raise"); - if (res && (nch >= 2)) - res = validate_test(CHILD(tree, 1)); - if (res && nch > 2) { - res = (validate_comma(CHILD(tree, 2)) - && validate_test(CHILD(tree, 3))); - if (res && (nch > 4)) - res = (validate_comma(CHILD(tree, 4)) - && validate_test(CHILD(tree, 5))); - } - } - else - (void) validate_numnodes(tree, 2, "raise"); - if (res && (nch == 4)) - res = (validate_comma(CHILD(tree, 2)) - && validate_test(CHILD(tree, 3))); - - return (res); -} - - -/* yield_expr: 'yield' [testlist] - */ -static int -validate_yield_expr(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, yield_expr) - && ((nch == 1) || (nch == 2)) - && validate_name(CHILD(tree, 0), "yield")); - - if (res && (nch == 2)) - res = validate_testlist(CHILD(tree, 1)); - - return (res); -} - - -/* yield_stmt: yield_expr - */ -static int -validate_yield_stmt(node *tree) -{ - return (validate_ntype(tree, yield_stmt) - && validate_numnodes(tree, 1, "yield_stmt") - && validate_yield_expr(CHILD(tree, 0))); -} - - -static int -validate_import_as_name(node *tree) -{ - int nch = NCH(tree); - int ok = validate_ntype(tree, import_as_name); - - if (ok) { - if (nch == 1) - ok = validate_name(CHILD(tree, 0), NULL); - else if (nch == 3) - ok = (validate_name(CHILD(tree, 0), NULL) - && validate_name(CHILD(tree, 1), "as") - && validate_name(CHILD(tree, 2), NULL)); - else - ok = validate_numnodes(tree, 3, "import_as_name"); - } - return ok; -} - - -/* dotted_name: NAME ("." NAME)* - */ -static int -validate_dotted_name(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, dotted_name) - && is_odd(nch) - && validate_name(CHILD(tree, 0), NULL)); - int i; - - for (i = 1; res && (i < nch); i += 2) { - res = (validate_dot(CHILD(tree, i)) - && validate_name(CHILD(tree, i+1), NULL)); - } - return res; -} - - -/* dotted_as_name: dotted_name [NAME NAME] - */ -static int -validate_dotted_as_name(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, dotted_as_name); - - if (res) { - if (nch == 1) - res = validate_dotted_name(CHILD(tree, 0)); - else if (nch == 3) - res = (validate_dotted_name(CHILD(tree, 0)) - && validate_name(CHILD(tree, 1), "as") - && validate_name(CHILD(tree, 2), NULL)); - else { - res = 0; - err_string("illegal number of children for dotted_as_name"); - } - } - return res; -} - - -/* dotted_as_name (',' dotted_as_name)* */ -static int -validate_dotted_as_names(node *tree) -{ - int nch = NCH(tree); - int res = is_odd(nch) && validate_dotted_as_name(CHILD(tree, 0)); - int i; - - for (i = 1; res && (i < nch); i += 2) - res = (validate_comma(CHILD(tree, i)) - && validate_dotted_as_name(CHILD(tree, i + 1))); - return (res); -} - - -/* import_as_name (',' import_as_name)* [','] */ -static int -validate_import_as_names(node *tree) -{ - int nch = NCH(tree); - int res = validate_import_as_name(CHILD(tree, 0)); - int i; - - for (i = 1; res && (i + 1 < nch); i += 2) - res = (validate_comma(CHILD(tree, i)) - && validate_import_as_name(CHILD(tree, i + 1))); - return (res); -} - - -/* 'import' dotted_as_names */ -static int -validate_import_name(node *tree) -{ - return (validate_ntype(tree, import_name) - && validate_numnodes(tree, 2, "import_name") - && validate_name(CHILD(tree, 0), "import") - && validate_dotted_as_names(CHILD(tree, 1))); -} - -/* Helper function to count the number of leading dots in - * 'from ...module import name' - */ -static int -count_from_dots(node *tree) -{ - int i; - for (i = 1; i < NCH(tree); i++) - if (TYPE(CHILD(tree, i)) != DOT) - break; - return i-1; -} - -/* import_from: ('from' ('.'* dotted_name | '.'+) - * 'import' ('*' | '(' import_as_names ')' | import_as_names)) - */ -static int -validate_import_from(node *tree) -{ - int nch = NCH(tree); - int ndots = count_from_dots(tree); - int havename = (TYPE(CHILD(tree, ndots + 1)) == dotted_name); - int offset = ndots + havename; - int res = validate_ntype(tree, import_from) - && (offset >= 1) - && (nch >= 3 + offset) - && validate_name(CHILD(tree, 0), "from") - && (!havename || validate_dotted_name(CHILD(tree, ndots + 1))) - && validate_name(CHILD(tree, offset + 1), "import"); - - if (res && TYPE(CHILD(tree, offset + 2)) == LPAR) - res = ((nch == offset + 5) - && validate_lparen(CHILD(tree, offset + 2)) - && validate_import_as_names(CHILD(tree, offset + 3)) - && validate_rparen(CHILD(tree, offset + 4))); - else if (res && TYPE(CHILD(tree, offset + 2)) != STAR) - res = validate_import_as_names(CHILD(tree, offset + 2)); - return (res); -} - - -/* import_stmt: import_name | import_from */ -static int -validate_import_stmt(node *tree) -{ - int nch = NCH(tree); - int res = validate_numnodes(tree, 1, "import_stmt"); - - if (res) { - int ntype = TYPE(CHILD(tree, 0)); - - if (ntype == import_name || ntype == import_from) - res = validate_node(CHILD(tree, 0)); - else { - res = 0; - err_string("illegal import_stmt child type"); - } - } - else if (nch == 1) { - res = 0; - PyErr_Format(parser_error, - "Unrecognized child node of import_stmt: %d.", - TYPE(CHILD(tree, 0))); - } - return (res); -} - - - - -static int -validate_global_stmt(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, global_stmt) - && is_even(nch) && (nch >= 2)); - - if (!res && !PyErr_Occurred()) - err_string("illegal global statement"); - - if (res) - res = (validate_name(CHILD(tree, 0), "global") - && validate_ntype(CHILD(tree, 1), NAME)); - for (j = 2; res && (j < nch); j += 2) - res = (validate_comma(CHILD(tree, j)) - && validate_ntype(CHILD(tree, j + 1), NAME)); - - return (res); -} - - -/* exec_stmt: - * - * 'exec' expr ['in' test [',' test]] - */ -static int -validate_exec_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, exec_stmt) - && ((nch == 2) || (nch == 4) || (nch == 6)) - && validate_name(CHILD(tree, 0), "exec") - && validate_expr(CHILD(tree, 1))); - - if (!res && !PyErr_Occurred()) - err_string("illegal exec statement"); - if (res && (nch > 2)) - res = (validate_name(CHILD(tree, 2), "in") - && validate_test(CHILD(tree, 3))); - if (res && (nch == 6)) - res = (validate_comma(CHILD(tree, 4)) - && validate_test(CHILD(tree, 5))); - - return (res); -} - - -/* assert_stmt: - * - * 'assert' test [',' test] - */ -static int -validate_assert_stmt(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, assert_stmt) - && ((nch == 2) || (nch == 4)) - && (validate_name(CHILD(tree, 0), "assert")) - && validate_test(CHILD(tree, 1))); - - if (!res && !PyErr_Occurred()) - err_string("illegal assert statement"); - if (res && (nch > 2)) - res = (validate_comma(CHILD(tree, 2)) - && validate_test(CHILD(tree, 3))); - - return (res); -} - - -static int -validate_while(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, while_stmt) - && ((nch == 4) || (nch == 7)) - && validate_name(CHILD(tree, 0), "while") - && validate_test(CHILD(tree, 1)) - && validate_colon(CHILD(tree, 2)) - && validate_suite(CHILD(tree, 3))); - - if (res && (nch == 7)) - res = (validate_name(CHILD(tree, 4), "else") - && validate_colon(CHILD(tree, 5)) - && validate_suite(CHILD(tree, 6))); - - return (res); -} - - -static int -validate_for(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, for_stmt) - && ((nch == 6) || (nch == 9)) - && validate_name(CHILD(tree, 0), "for") - && validate_exprlist(CHILD(tree, 1)) - && validate_name(CHILD(tree, 2), "in") - && validate_testlist(CHILD(tree, 3)) - && validate_colon(CHILD(tree, 4)) - && validate_suite(CHILD(tree, 5))); - - if (res && (nch == 9)) - res = (validate_name(CHILD(tree, 6), "else") - && validate_colon(CHILD(tree, 7)) - && validate_suite(CHILD(tree, 8))); - - return (res); -} - - -/* try_stmt: - * 'try' ':' suite (except_clause ':' suite)+ ['else' ':' suite] - ['finally' ':' suite] - * | 'try' ':' suite 'finally' ':' suite - * - */ -static int -validate_try(node *tree) -{ - int nch = NCH(tree); - int pos = 3; - int res = (validate_ntype(tree, try_stmt) - && (nch >= 6) && ((nch % 3) == 0)); - - if (res) - res = (validate_name(CHILD(tree, 0), "try") - && validate_colon(CHILD(tree, 1)) - && validate_suite(CHILD(tree, 2)) - && validate_colon(CHILD(tree, nch - 2)) - && validate_suite(CHILD(tree, nch - 1))); - else if (!PyErr_Occurred()) { - const char* name = "except"; - if (TYPE(CHILD(tree, nch - 3)) != except_clause) - name = STR(CHILD(tree, nch - 3)); - - PyErr_Format(parser_error, - "Illegal number of children for try/%s node.", name); - } - /* Handle try/finally statement */ - if (res && (TYPE(CHILD(tree, pos)) == NAME) && - (strcmp(STR(CHILD(tree, pos)), "finally") == 0)) { - res = (validate_numnodes(tree, 6, "try/finally") - && validate_colon(CHILD(tree, 4)) - && validate_suite(CHILD(tree, 5))); - return (res); - } - /* try/except statement: skip past except_clause sections */ - while (res && pos < nch && (TYPE(CHILD(tree, pos)) == except_clause)) { - res = (validate_except_clause(CHILD(tree, pos)) - && validate_colon(CHILD(tree, pos + 1)) - && validate_suite(CHILD(tree, pos + 2))); - pos += 3; - } - /* skip else clause */ - if (res && pos < nch && (TYPE(CHILD(tree, pos)) == NAME) && - (strcmp(STR(CHILD(tree, pos)), "else") == 0)) { - res = (validate_colon(CHILD(tree, pos + 1)) - && validate_suite(CHILD(tree, pos + 2))); - pos += 3; - } - if (res && pos < nch) { - /* last clause must be a finally */ - res = (validate_name(CHILD(tree, pos), "finally") - && validate_numnodes(tree, pos + 3, "try/except/finally") - && validate_colon(CHILD(tree, pos + 1)) - && validate_suite(CHILD(tree, pos + 2))); - } - return (res); -} - - -static int -validate_except_clause(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, except_clause) - && ((nch == 1) || (nch == 2) || (nch == 4)) - && validate_name(CHILD(tree, 0), "except")); - - if (res && (nch > 1)) - res = validate_test(CHILD(tree, 1)); - if (res && (nch == 4)) { - if (TYPE(CHILD(tree, 2)) == NAME) - res = validate_name(CHILD(tree, 2), "as"); - else - res = validate_comma(CHILD(tree, 2)); - res = res && validate_test(CHILD(tree, 3)); - } - return (res); -} - - -static int -validate_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, test) && is_odd(nch); - - if (res && (TYPE(CHILD(tree, 0)) == lambdef)) - res = ((nch == 1) - && validate_lambdef(CHILD(tree, 0))); - else if (res) { - res = validate_or_test(CHILD(tree, 0)); - res = (res && (nch == 1 || (nch == 5 && - validate_name(CHILD(tree, 1), "if") && - validate_or_test(CHILD(tree, 2)) && - validate_name(CHILD(tree, 3), "else") && - validate_test(CHILD(tree, 4))))); - } - return (res); -} - -static int -validate_old_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, old_test) && (nch == 1); - - if (res && (TYPE(CHILD(tree, 0)) == old_lambdef)) - res = (validate_old_lambdef(CHILD(tree, 0))); - else if (res) { - res = (validate_or_test(CHILD(tree, 0))); - } - return (res); -} - -static int -validate_or_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, or_test) && is_odd(nch); - - if (res) { - int pos; - res = validate_and_test(CHILD(tree, 0)); - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_name(CHILD(tree, pos), "or") - && validate_and_test(CHILD(tree, pos + 1))); - } - return (res); -} - - -static int -validate_and_test(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, and_test) - && is_odd(nch) - && validate_not_test(CHILD(tree, 0))); - - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_name(CHILD(tree, pos), "and") - && validate_not_test(CHILD(tree, 0))); - - return (res); -} - - -static int -validate_not_test(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, not_test) && ((nch == 1) || (nch == 2)); - - if (res) { - if (nch == 2) - res = (validate_name(CHILD(tree, 0), "not") - && validate_not_test(CHILD(tree, 1))); - else if (nch == 1) - res = validate_comparison(CHILD(tree, 0)); - } - return (res); -} - - -static int -validate_comparison(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, comparison) - && is_odd(nch) - && validate_expr(CHILD(tree, 0))); - - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_comp_op(CHILD(tree, pos)) - && validate_expr(CHILD(tree, pos + 1))); - - return (res); -} - - -static int -validate_comp_op(node *tree) -{ - int res = 0; - int nch = NCH(tree); - - if (!validate_ntype(tree, comp_op)) - return (0); - if (nch == 1) { - /* - * Only child will be a terminal with a well-defined symbolic name - * or a NAME with a string of either 'is' or 'in' - */ - tree = CHILD(tree, 0); - switch (TYPE(tree)) { - case LESS: - case GREATER: - case EQEQUAL: - case EQUAL: - case LESSEQUAL: - case GREATEREQUAL: - case NOTEQUAL: - res = 1; - break; - case NAME: - res = ((strcmp(STR(tree), "in") == 0) - || (strcmp(STR(tree), "is") == 0)); - if (!res) { - PyErr_Format(parser_error, - "illegal operator '%s'", STR(tree)); - } - break; - default: - err_string("illegal comparison operator type"); - break; - } - } - else if ((res = validate_numnodes(tree, 2, "comp_op")) != 0) { - res = (validate_ntype(CHILD(tree, 0), NAME) - && validate_ntype(CHILD(tree, 1), NAME) - && (((strcmp(STR(CHILD(tree, 0)), "is") == 0) - && (strcmp(STR(CHILD(tree, 1)), "not") == 0)) - || ((strcmp(STR(CHILD(tree, 0)), "not") == 0) - && (strcmp(STR(CHILD(tree, 1)), "in") == 0)))); - if (!res && !PyErr_Occurred()) - err_string("unknown comparison operator"); - } - return (res); -} - - -static int -validate_expr(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, expr) - && is_odd(nch) - && validate_xor_expr(CHILD(tree, 0))); - - for (j = 2; res && (j < nch); j += 2) - res = (validate_xor_expr(CHILD(tree, j)) - && validate_vbar(CHILD(tree, j - 1))); - - return (res); -} - - -static int -validate_xor_expr(node *tree) -{ - int j; - int nch = NCH(tree); - int res = (validate_ntype(tree, xor_expr) - && is_odd(nch) - && validate_and_expr(CHILD(tree, 0))); - - for (j = 2; res && (j < nch); j += 2) - res = (validate_circumflex(CHILD(tree, j - 1)) - && validate_and_expr(CHILD(tree, j))); - - return (res); -} - - -static int -validate_and_expr(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, and_expr) - && is_odd(nch) - && validate_shift_expr(CHILD(tree, 0))); - - for (pos = 1; res && (pos < nch); pos += 2) - res = (validate_ampersand(CHILD(tree, pos)) - && validate_shift_expr(CHILD(tree, pos + 1))); - - return (res); -} - - -static int -validate_chain_two_ops(node *tree, int (*termvalid)(node *), int op1, int op2) - { - int pos = 1; - int nch = NCH(tree); - int res = (is_odd(nch) - && (*termvalid)(CHILD(tree, 0))); - - for ( ; res && (pos < nch); pos += 2) { - if (TYPE(CHILD(tree, pos)) != op1) - res = validate_ntype(CHILD(tree, pos), op2); - if (res) - res = (*termvalid)(CHILD(tree, pos + 1)); - } - return (res); -} - - -static int -validate_shift_expr(node *tree) -{ - return (validate_ntype(tree, shift_expr) - && validate_chain_two_ops(tree, validate_arith_expr, - LEFTSHIFT, RIGHTSHIFT)); -} - - -static int -validate_arith_expr(node *tree) -{ - return (validate_ntype(tree, arith_expr) - && validate_chain_two_ops(tree, validate_term, PLUS, MINUS)); -} - - -static int -validate_term(node *tree) -{ - int pos = 1; - int nch = NCH(tree); - int res = (validate_ntype(tree, term) - && is_odd(nch) - && validate_factor(CHILD(tree, 0))); - - for ( ; res && (pos < nch); pos += 2) - res = (((TYPE(CHILD(tree, pos)) == STAR) - || (TYPE(CHILD(tree, pos)) == SLASH) - || (TYPE(CHILD(tree, pos)) == DOUBLESLASH) - || (TYPE(CHILD(tree, pos)) == PERCENT)) - && validate_factor(CHILD(tree, pos + 1))); - - return (res); -} - - -/* factor: - * - * factor: ('+'|'-'|'~') factor | power - */ -static int -validate_factor(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, factor) - && (((nch == 2) - && ((TYPE(CHILD(tree, 0)) == PLUS) - || (TYPE(CHILD(tree, 0)) == MINUS) - || (TYPE(CHILD(tree, 0)) == TILDE)) - && validate_factor(CHILD(tree, 1))) - || ((nch == 1) - && validate_power(CHILD(tree, 0))))); - return (res); -} - - -/* power: - * - * power: atom trailer* ('**' factor)* - */ -static int -validate_power(node *tree) -{ - int pos = 1; - int nch = NCH(tree); - int res = (validate_ntype(tree, power) && (nch >= 1) - && validate_atom(CHILD(tree, 0))); - - while (res && (pos < nch) && (TYPE(CHILD(tree, pos)) == trailer)) - res = validate_trailer(CHILD(tree, pos++)); - if (res && (pos < nch)) { - if (!is_even(nch - pos)) { - err_string("illegal number of nodes for 'power'"); - return (0); - } - for ( ; res && (pos < (nch - 1)); pos += 2) - res = (validate_doublestar(CHILD(tree, pos)) - && validate_factor(CHILD(tree, pos + 1))); - } - return (res); -} - - -static int -validate_atom(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = validate_ntype(tree, atom); - - if (res && nch < 1) - res = validate_numnodes(tree, nch+1, "atom"); - if (res) { - switch (TYPE(CHILD(tree, 0))) { - case LPAR: - res = ((nch <= 3) - && (validate_rparen(CHILD(tree, nch - 1)))); - - if (res && (nch == 3)) { - if (TYPE(CHILD(tree, 1))==yield_expr) - res = validate_yield_expr(CHILD(tree, 1)); - else - res = validate_testlist_comp(CHILD(tree, 1)); - } - break; - case LSQB: - if (nch == 2) - res = validate_ntype(CHILD(tree, 1), RSQB); - else if (nch == 3) - res = (validate_listmaker(CHILD(tree, 1)) - && validate_ntype(CHILD(tree, 2), RSQB)); - else { - res = 0; - err_string("illegal list display atom"); - } - break; - case LBRACE: - res = ((nch <= 3) - && validate_ntype(CHILD(tree, nch - 1), RBRACE)); - - if (res && (nch == 3)) - res = validate_dictorsetmaker(CHILD(tree, 1)); - break; - case BACKQUOTE: - res = ((nch == 3) - && validate_testlist1(CHILD(tree, 1)) - && validate_ntype(CHILD(tree, 2), BACKQUOTE)); - break; - case NAME: - case NUMBER: - res = (nch == 1); - break; - case STRING: - for (pos = 1; res && (pos < nch); ++pos) - res = validate_ntype(CHILD(tree, pos), STRING); - break; - default: - res = 0; - break; - } - } - return (res); -} - - -/* listmaker: - * test ( list_for | (',' test)* [','] ) - */ -static int -validate_listmaker(node *tree) -{ - int nch = NCH(tree); - int ok = nch; - - if (nch == 0) - err_string("missing child nodes of listmaker"); - else - ok = validate_test(CHILD(tree, 0)); - - /* - * list_for | (',' test)* [','] - */ - if (nch == 2 && TYPE(CHILD(tree, 1)) == list_for) - ok = validate_list_for(CHILD(tree, 1)); - else { - /* (',' test)* [','] */ - int i = 1; - while (ok && nch - i >= 2) { - ok = (validate_comma(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - i += 2; - } - if (ok && i == nch-1) - ok = validate_comma(CHILD(tree, i)); - else if (i != nch) { - ok = 0; - err_string("illegal trailing nodes for listmaker"); - } - } - return ok; -} - -/* testlist_comp: - * test ( comp_for | (',' test)* [','] ) - */ -static int -validate_testlist_comp(node *tree) -{ - int nch = NCH(tree); - int ok = nch; - - if (nch == 0) - err_string("missing child nodes of testlist_comp"); - else { - ok = validate_test(CHILD(tree, 0)); - } - - /* - * comp_for | (',' test)* [','] - */ - if (nch == 2 && TYPE(CHILD(tree, 1)) == comp_for) - ok = validate_comp_for(CHILD(tree, 1)); - else { - /* (',' test)* [','] */ - int i = 1; - while (ok && nch - i >= 2) { - ok = (validate_comma(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - i += 2; - } - if (ok && i == nch-1) - ok = validate_comma(CHILD(tree, i)); - else if (i != nch) { - ok = 0; - err_string("illegal trailing nodes for testlist_comp"); - } - } - return ok; -} - -/* decorator: - * '@' dotted_name [ '(' [arglist] ')' ] NEWLINE - */ -static int -validate_decorator(node *tree) -{ - int ok; - int nch = NCH(tree); - ok = (validate_ntype(tree, decorator) && - (nch == 3 || nch == 5 || nch == 6) && - validate_at(CHILD(tree, 0)) && - validate_dotted_name(CHILD(tree, 1)) && - validate_newline(RCHILD(tree, -1))); - - if (ok && nch != 3) { - ok = (validate_lparen(CHILD(tree, 2)) && - validate_rparen(RCHILD(tree, -2))); - - if (ok && nch == 6) - ok = validate_arglist(CHILD(tree, 3)); - } - - return ok; -} - -/* decorators: - * decorator+ - */ -static int -validate_decorators(node *tree) -{ - int i, nch, ok; - nch = NCH(tree); - ok = validate_ntype(tree, decorators) && nch >= 1; - - for (i = 0; ok && i < nch; ++i) - ok = validate_decorator(CHILD(tree, i)); - - return ok; -} - -/* with_item: - * test ['as' expr] - */ -static int -validate_with_item(node *tree) -{ - int nch = NCH(tree); - int ok = (validate_ntype(tree, with_item) - && (nch == 1 || nch == 3) - && validate_test(CHILD(tree, 0))); - if (ok && nch == 3) - ok = (validate_name(CHILD(tree, 1), "as") - && validate_expr(CHILD(tree, 2))); - return ok; -} - -/* with_stmt: - * 0 1 ... -2 -1 - * 'with' with_item (',' with_item)* ':' suite - */ -static int -validate_with_stmt(node *tree) -{ - int i; - int nch = NCH(tree); - int ok = (validate_ntype(tree, with_stmt) - && (nch % 2 == 0) - && validate_name(CHILD(tree, 0), "with") - && validate_colon(RCHILD(tree, -2)) - && validate_suite(RCHILD(tree, -1))); - for (i = 1; ok && i < nch - 2; i += 2) - ok = validate_with_item(CHILD(tree, i)); - return ok; -} - -/* funcdef: - * - * -5 -4 -3 -2 -1 - * 'def' NAME parameters ':' suite - */ -static int -validate_funcdef(node *tree) -{ - int nch = NCH(tree); - int ok = (validate_ntype(tree, funcdef) - && (nch == 5) - && validate_name(RCHILD(tree, -5), "def") - && validate_ntype(RCHILD(tree, -4), NAME) - && validate_colon(RCHILD(tree, -2)) - && validate_parameters(RCHILD(tree, -3)) - && validate_suite(RCHILD(tree, -1))); - return ok; -} - - -/* decorated - * decorators (classdef | funcdef) - */ -static int -validate_decorated(node *tree) -{ - int nch = NCH(tree); - int ok = (validate_ntype(tree, decorated) - && (nch == 2) - && validate_decorators(RCHILD(tree, -2))); - if (TYPE(RCHILD(tree, -1)) == funcdef) - ok = ok && validate_funcdef(RCHILD(tree, -1)); - else - ok = ok && validate_class(RCHILD(tree, -1)); - return ok; -} - -static int -validate_lambdef(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, lambdef) - && ((nch == 3) || (nch == 4)) - && validate_name(CHILD(tree, 0), "lambda") - && validate_colon(CHILD(tree, nch - 2)) - && validate_test(CHILD(tree, nch - 1))); - - if (res && (nch == 4)) - res = validate_varargslist(CHILD(tree, 1)); - else if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 3, "lambdef"); - - return (res); -} - - -static int -validate_old_lambdef(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, old_lambdef) - && ((nch == 3) || (nch == 4)) - && validate_name(CHILD(tree, 0), "lambda") - && validate_colon(CHILD(tree, nch - 2)) - && validate_test(CHILD(tree, nch - 1))); - - if (res && (nch == 4)) - res = validate_varargslist(CHILD(tree, 1)); - else if (!res && !PyErr_Occurred()) - (void) validate_numnodes(tree, 3, "old_lambdef"); - - return (res); -} - - -/* arglist: - * - * (argument ',')* (argument [','] | '*' test [',' '**' test] | '**' test) - */ -static int -validate_arglist(node *tree) -{ - int nch = NCH(tree); - int i = 0; - int ok = 1; - - if (nch <= 0) - /* raise the right error from having an invalid number of children */ - return validate_numnodes(tree, nch + 1, "arglist"); - - if (nch > 1) { - for (i=0; i= 2) { - /* skip leading (argument ',') */ - ok = (validate_argument(CHILD(tree, i)) - && validate_comma(CHILD(tree, i+1))); - if (ok) - i += 2; - else - PyErr_Clear(); - } - ok = 1; - if (nch-i > 0) { - /* - * argument | '*' test [',' '**' test] | '**' test - */ - int sym = TYPE(CHILD(tree, i)); - - if (sym == argument) { - ok = validate_argument(CHILD(tree, i)); - if (ok && i+1 != nch) { - err_string("illegal arglist specification" - " (extra stuff on end)"); - ok = 0; - } - } - else if (sym == STAR) { - ok = validate_star(CHILD(tree, i)); - if (ok && (nch-i == 2)) - ok = validate_test(CHILD(tree, i+1)); - else if (ok && (nch-i == 5)) - ok = (validate_test(CHILD(tree, i+1)) - && validate_comma(CHILD(tree, i+2)) - && validate_doublestar(CHILD(tree, i+3)) - && validate_test(CHILD(tree, i+4))); - else { - err_string("illegal use of '*' in arglist"); - ok = 0; - } - } - else if (sym == DOUBLESTAR) { - if (nch-i == 2) - ok = (validate_doublestar(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - else { - err_string("illegal use of '**' in arglist"); - ok = 0; - } - } - else { - err_string("illegal arglist specification"); - ok = 0; - } - } - return (ok); -} - - - -/* argument: - * - * [test '='] test [comp_for] - */ -static int -validate_argument(node *tree) -{ - int nch = NCH(tree); - int res = (validate_ntype(tree, argument) - && ((nch == 1) || (nch == 2) || (nch == 3)) - && validate_test(CHILD(tree, 0))); - - if (res && (nch == 2)) - res = validate_comp_for(CHILD(tree, 1)); - else if (res && (nch == 3)) - res = (validate_equal(CHILD(tree, 1)) - && validate_test(CHILD(tree, 2))); - - return (res); -} - - - -/* trailer: - * - * '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME - */ -static int -validate_trailer(node *tree) -{ - int nch = NCH(tree); - int res = validate_ntype(tree, trailer) && ((nch == 2) || (nch == 3)); - - if (res) { - switch (TYPE(CHILD(tree, 0))) { - case LPAR: - res = validate_rparen(CHILD(tree, nch - 1)); - if (res && (nch == 3)) - res = validate_arglist(CHILD(tree, 1)); - break; - case LSQB: - res = (validate_numnodes(tree, 3, "trailer") - && validate_subscriptlist(CHILD(tree, 1)) - && validate_ntype(CHILD(tree, 2), RSQB)); - break; - case DOT: - res = (validate_numnodes(tree, 2, "trailer") - && validate_ntype(CHILD(tree, 1), NAME)); - break; - default: - res = 0; - break; - } - } - else { - (void) validate_numnodes(tree, 2, "trailer"); - } - return (res); -} - - -/* subscriptlist: - * - * subscript (',' subscript)* [','] - */ -static int -validate_subscriptlist(node *tree) -{ - return (validate_repeating_list(tree, subscriptlist, - validate_subscript, "subscriptlist")); -} - - -/* subscript: - * - * '.' '.' '.' | test | [test] ':' [test] [sliceop] - */ -static int -validate_subscript(node *tree) -{ - int offset = 0; - int nch = NCH(tree); - int res = validate_ntype(tree, subscript) && (nch >= 1) && (nch <= 4); - - if (!res) { - if (!PyErr_Occurred()) - err_string("invalid number of arguments for subscript node"); - return (0); - } - if (TYPE(CHILD(tree, 0)) == DOT) - /* take care of ('.' '.' '.') possibility */ - return (validate_numnodes(tree, 3, "subscript") - && validate_dot(CHILD(tree, 0)) - && validate_dot(CHILD(tree, 1)) - && validate_dot(CHILD(tree, 2))); - if (nch == 1) { - if (TYPE(CHILD(tree, 0)) == test) - res = validate_test(CHILD(tree, 0)); - else - res = validate_colon(CHILD(tree, 0)); - return (res); - } - /* Must be [test] ':' [test] [sliceop], - * but at least one of the optional components will - * be present, but we don't know which yet. - */ - if ((TYPE(CHILD(tree, 0)) != COLON) || (nch == 4)) { - res = validate_test(CHILD(tree, 0)); - offset = 1; - } - if (res) - res = validate_colon(CHILD(tree, offset)); - if (res) { - int rem = nch - ++offset; - if (rem) { - if (TYPE(CHILD(tree, offset)) == test) { - res = validate_test(CHILD(tree, offset)); - ++offset; - --rem; - } - if (res && rem) - res = validate_sliceop(CHILD(tree, offset)); - } - } - return (res); -} - - -static int -validate_sliceop(node *tree) -{ - int nch = NCH(tree); - int res = ((nch == 1) || validate_numnodes(tree, 2, "sliceop")) - && validate_ntype(tree, sliceop); - if (!res && !PyErr_Occurred()) { - res = validate_numnodes(tree, 1, "sliceop"); - } - if (res) - res = validate_colon(CHILD(tree, 0)); - if (res && (nch == 2)) - res = validate_test(CHILD(tree, 1)); - - return (res); -} - - -static int -validate_exprlist(node *tree) -{ - return (validate_repeating_list(tree, exprlist, - validate_expr, "exprlist")); -} - - -/* - * dictorsetmaker: - * - * (test ':' test (comp_for | (',' test ':' test)* [','])) | - * (test (comp_for | (',' test)* [','])) - */ -static int -validate_dictorsetmaker(node *tree) -{ - int nch = NCH(tree); - int ok = validate_ntype(tree, dictorsetmaker); - int i = 0; - int check_trailing_comma = 0; - - assert(nch > 0); - - if (ok && (nch == 1 || TYPE(CHILD(tree, 1)) == COMMA)) { - /* We got a set: - * test (',' test)* [','] - */ - ok = validate_test(CHILD(tree, i++)); - while (ok && nch - i >= 2) { - ok = (validate_comma(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1))); - i += 2; - } - check_trailing_comma = 1; - } - else if (ok && TYPE(CHILD(tree, 1)) == comp_for) { - /* We got a set comprehension: - * test comp_for - */ - ok = (validate_test(CHILD(tree, 0)) - && validate_comp_for(CHILD(tree, 1))); - } - else if (ok && NCH(tree) > 3 && TYPE(CHILD(tree, 3)) == comp_for) { - /* We got a dict comprehension: - * test ':' test comp_for - */ - ok = (validate_test(CHILD(tree, 0)) - && validate_colon(CHILD(tree, 1)) - && validate_test(CHILD(tree, 2)) - && validate_comp_for(CHILD(tree, 3))); - } - else if (ok) { - /* We got a dict: - * test ':' test (',' test ':' test)* [','] - */ - if (nch >= 3) { - ok = (validate_test(CHILD(tree, i)) - && validate_colon(CHILD(tree, i+1)) - && validate_test(CHILD(tree, i+2))); - i += 3; - } - else { - ok = 0; - err_string("illegal number of nodes for dictorsetmaker"); - } - - while (ok && nch - i >= 4) { - ok = (validate_comma(CHILD(tree, i)) - && validate_test(CHILD(tree, i+1)) - && validate_colon(CHILD(tree, i+2)) - && validate_test(CHILD(tree, i+3))); - i += 4; - } - check_trailing_comma = 1; - } - if (ok && check_trailing_comma) { - if (i == nch-1) - ok = validate_comma(CHILD(tree, i)); - else if (i != nch) { - ok = 0; - err_string("illegal trailing nodes for dictorsetmaker"); - } - } - - return ok; -} - - -static int -validate_eval_input(node *tree) -{ - int pos; - int nch = NCH(tree); - int res = (validate_ntype(tree, eval_input) - && (nch >= 2) - && validate_testlist(CHILD(tree, 0)) - && validate_ntype(CHILD(tree, nch - 1), ENDMARKER)); - - for (pos = 1; res && (pos < (nch - 1)); ++pos) - res = validate_ntype(CHILD(tree, pos), NEWLINE); - - return (res); -} - - -static int -validate_node(node *tree) -{ - int nch = 0; /* num. children on current node */ - int res = 1; /* result value */ - node* next = 0; /* node to process after this one */ - - while (res && (tree != 0)) { - nch = NCH(tree); - next = 0; - switch (TYPE(tree)) { - /* - * Definition nodes. - */ - case funcdef: - res = validate_funcdef(tree); - break; - case with_stmt: - res = validate_with_stmt(tree); - break; - case classdef: - res = validate_class(tree); - break; - case decorated: - res = validate_decorated(tree); - break; - /* - * "Trivial" parse tree nodes. - * (Why did I call these trivial?) - */ - case stmt: - res = validate_stmt(tree); - break; - case small_stmt: - /* - * expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt - * | import_stmt | global_stmt | exec_stmt | assert_stmt - */ - res = validate_small_stmt(tree); - break; - case flow_stmt: - res = (validate_numnodes(tree, 1, "flow_stmt") - && ((TYPE(CHILD(tree, 0)) == break_stmt) - || (TYPE(CHILD(tree, 0)) == continue_stmt) - || (TYPE(CHILD(tree, 0)) == yield_stmt) - || (TYPE(CHILD(tree, 0)) == return_stmt) - || (TYPE(CHILD(tree, 0)) == raise_stmt))); - if (res) - next = CHILD(tree, 0); - else if (nch == 1) - err_string("illegal flow_stmt type"); - break; - case yield_stmt: - res = validate_yield_stmt(tree); - break; - /* - * Compound statements. - */ - case simple_stmt: - res = validate_simple_stmt(tree); - break; - case compound_stmt: - res = validate_compound_stmt(tree); - break; - /* - * Fundamental statements. - */ - case expr_stmt: - res = validate_expr_stmt(tree); - break; - case print_stmt: - res = validate_print_stmt(tree); - break; - case del_stmt: - res = validate_del_stmt(tree); - break; - case pass_stmt: - res = (validate_numnodes(tree, 1, "pass") - && validate_name(CHILD(tree, 0), "pass")); - break; - case break_stmt: - res = (validate_numnodes(tree, 1, "break") - && validate_name(CHILD(tree, 0), "break")); - break; - case continue_stmt: - res = (validate_numnodes(tree, 1, "continue") - && validate_name(CHILD(tree, 0), "continue")); - break; - case return_stmt: - res = validate_return_stmt(tree); - break; - case raise_stmt: - res = validate_raise_stmt(tree); - break; - case import_stmt: - res = validate_import_stmt(tree); - break; - case import_name: - res = validate_import_name(tree); - break; - case import_from: - res = validate_import_from(tree); - break; - case global_stmt: - res = validate_global_stmt(tree); - break; - case exec_stmt: - res = validate_exec_stmt(tree); - break; - case assert_stmt: - res = validate_assert_stmt(tree); - break; - case if_stmt: - res = validate_if(tree); - break; - case while_stmt: - res = validate_while(tree); - break; - case for_stmt: - res = validate_for(tree); - break; - case try_stmt: - res = validate_try(tree); - break; - case suite: - res = validate_suite(tree); - break; - /* - * Expression nodes. - */ - case testlist: - res = validate_testlist(tree); - break; - case yield_expr: - res = validate_yield_expr(tree); - break; - case testlist1: - res = validate_testlist1(tree); - break; - case test: - res = validate_test(tree); - break; - case and_test: - res = validate_and_test(tree); - break; - case not_test: - res = validate_not_test(tree); - break; - case comparison: - res = validate_comparison(tree); - break; - case exprlist: - res = validate_exprlist(tree); - break; - case comp_op: - res = validate_comp_op(tree); - break; - case expr: - res = validate_expr(tree); - break; - case xor_expr: - res = validate_xor_expr(tree); - break; - case and_expr: - res = validate_and_expr(tree); - break; - case shift_expr: - res = validate_shift_expr(tree); - break; - case arith_expr: - res = validate_arith_expr(tree); - break; - case term: - res = validate_term(tree); - break; - case factor: - res = validate_factor(tree); - break; - case power: - res = validate_power(tree); - break; - case atom: - res = validate_atom(tree); - break; - - default: - /* Hopefully never reached! */ - err_string("unrecognized node type"); - res = 0; - break; - } - tree = next; - } - return (res); -} - - -static int -validate_expr_tree(node *tree) -{ - int res = validate_eval_input(tree); - - if (!res && !PyErr_Occurred()) - err_string("could not validate expression tuple"); - - return (res); -} - - -/* file_input: - * (NEWLINE | stmt)* ENDMARKER - */ -static int -validate_file_input(node *tree) -{ - int j; - int nch = NCH(tree) - 1; - int res = ((nch >= 0) - && validate_ntype(CHILD(tree, nch), ENDMARKER)); - - for (j = 0; res && (j < nch); ++j) { - if (TYPE(CHILD(tree, j)) == stmt) - res = validate_stmt(CHILD(tree, j)); - else - res = validate_newline(CHILD(tree, j)); - } - /* This stays in to prevent any internal failures from getting to the - * user. Hopefully, this won't be needed. If a user reports getting - * this, we have some debugging to do. - */ - if (!res && !PyErr_Occurred()) - err_string("VALIDATION FAILURE: report this to the maintainer!"); - - return (res); -} - -static int -validate_encoding_decl(node *tree) -{ - int nch = NCH(tree); - int res = ((nch == 1) - && validate_file_input(CHILD(tree, 0))); - - if (!res && !PyErr_Occurred()) - err_string("Error Parsing encoding_decl"); - - return res; -} - -static PyObject* -pickle_constructor = NULL; - - -static PyObject* -parser__pickler(PyObject *self, PyObject *args) -{ - NOTE(ARGUNUSED(self)) - PyObject *result = NULL; - PyObject *st = NULL; - PyObject *empty_dict = NULL; - - if (PyArg_ParseTuple(args, "O!:_pickler", &PyST_Type, &st)) { - PyObject *newargs; - PyObject *tuple; - - if ((empty_dict = PyDict_New()) == NULL) - goto finally; - if ((newargs = Py_BuildValue("Oi", st, 1)) == NULL) - goto finally; - tuple = parser_st2tuple((PyST_Object*)NULL, newargs, empty_dict); - if (tuple != NULL) { - result = Py_BuildValue("O(O)", pickle_constructor, tuple); - Py_DECREF(tuple); - } - Py_DECREF(empty_dict); - Py_DECREF(newargs); - } - finally: - Py_XDECREF(empty_dict); - - return (result); -} - - -/* Functions exported by this module. Most of this should probably - * be converted into an ST object with methods, but that is better - * done directly in Python, allowing subclasses to be created directly. - * We'd really have to write a wrapper around it all anyway to allow - * inheritance. - */ -static PyMethodDef parser_functions[] = { - {"ast2tuple", (PyCFunction)parser_ast2tuple, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates a tuple-tree representation of an ST.")}, - {"ast2list", (PyCFunction)parser_ast2list, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates a list-tree representation of an ST.")}, - {"compileast", (PyCFunction)parser_compileast,PUBLIC_METHOD_TYPE, - PyDoc_STR("Compiles an ST object into a code object.")}, - {"compilest", (PyCFunction)parser_compilest, PUBLIC_METHOD_TYPE, - PyDoc_STR("Compiles an ST object into a code object.")}, - {"expr", (PyCFunction)parser_expr, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates an ST object from an expression.")}, - {"isexpr", (PyCFunction)parser_isexpr, PUBLIC_METHOD_TYPE, - PyDoc_STR("Determines if an ST object was created from an expression.")}, - {"issuite", (PyCFunction)parser_issuite, PUBLIC_METHOD_TYPE, - PyDoc_STR("Determines if an ST object was created from a suite.")}, - {"suite", (PyCFunction)parser_suite, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates an ST object from a suite.")}, - {"sequence2ast", (PyCFunction)parser_tuple2ast, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates an ST object from a tree representation.")}, - {"sequence2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates an ST object from a tree representation.")}, - {"st2tuple", (PyCFunction)parser_st2tuple, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates a tuple-tree representation of an ST.")}, - {"st2list", (PyCFunction)parser_st2list, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates a list-tree representation of an ST.")}, - {"tuple2ast", (PyCFunction)parser_tuple2ast, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates an ST object from a tree representation.")}, - {"tuple2st", (PyCFunction)parser_tuple2st, PUBLIC_METHOD_TYPE, - PyDoc_STR("Creates an ST object from a tree representation.")}, - - /* private stuff: support pickle module */ - {"_pickler", (PyCFunction)parser__pickler, METH_VARARGS, - PyDoc_STR("Returns the pickle magic to allow ST objects to be pickled.")}, - - {NULL, NULL, 0, NULL} - }; - - -PyMODINIT_FUNC initparser(void); /* supply a prototype */ - -PyMODINIT_FUNC -initparser(void) -{ - PyObject *module, *copyreg; - - Py_TYPE(&PyST_Type) = &PyType_Type; - module = Py_InitModule("parser", parser_functions); - if (module == NULL) - return; - - if (parser_error == 0) - parser_error = PyErr_NewException("parser.ParserError", NULL, NULL); - - if (parser_error == 0) - /* caller will check PyErr_Occurred() */ - return; - /* CAUTION: The code next used to skip bumping the refcount on - * parser_error. That's a disaster if initparser() gets called more - * than once. By incref'ing, we ensure that each module dict that - * gets created owns its reference to the shared parser_error object, - * and the file static parser_error vrbl owns a reference too. - */ - Py_INCREF(parser_error); - if (PyModule_AddObject(module, "ParserError", parser_error) != 0) - return; - - Py_INCREF(&PyST_Type); - PyModule_AddObject(module, "ASTType", (PyObject*)&PyST_Type); - Py_INCREF(&PyST_Type); - PyModule_AddObject(module, "STType", (PyObject*)&PyST_Type); - - PyModule_AddStringConstant(module, "__copyright__", - parser_copyright_string); - PyModule_AddStringConstant(module, "__doc__", - parser_doc_string); - PyModule_AddStringConstant(module, "__version__", - parser_version_string); - - /* Register to support pickling. - * If this fails, the import of this module will fail because an - * exception will be raised here; should we clear the exception? - */ - copyreg = PyImport_ImportModuleNoBlock("copy_reg"); - if (copyreg != NULL) { - PyObject *func, *pickler; - - func = PyObject_GetAttrString(copyreg, "pickle"); - pickle_constructor = PyObject_GetAttrString(module, "sequence2st"); - pickler = PyObject_GetAttrString(module, "_pickler"); - Py_XINCREF(pickle_constructor); - if ((func != NULL) && (pickle_constructor != NULL) - && (pickler != NULL)) { - PyObject *res; - - res = PyObject_CallFunctionObjArgs(func, &PyST_Type, pickler, - pickle_constructor, NULL); - Py_XDECREF(res); - } - Py_XDECREF(func); - Py_XDECREF(pickle_constructor); - Py_XDECREF(pickler); - Py_DECREF(copyreg); - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/pyexpat.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/pyexpat.c deleted file mode 100644 index 093eb82..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/pyexpat.c +++ /dev/null @@ -1,2143 +0,0 @@ -#include "Python.h" -#include - -#include "frameobject.h" -#include "expat.h" - -#include "pyexpat.h" - -#define XML_COMBINED_VERSION (10000*XML_MAJOR_VERSION+100*XML_MINOR_VERSION+XML_MICRO_VERSION) - -#ifndef PyDoc_STRVAR - -/* - * fdrake says: - * Don't change the PyDoc_STR macro definition to (str), because - * '''the parentheses cause compile failures - * ("non-constant static initializer" or something like that) - * on some platforms (Irix?)''' - */ -#define PyDoc_STR(str) str -#define PyDoc_VAR(name) static char name[] -#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) -#endif - -#if (PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION < 2) -/* In Python 2.0 and 2.1, disabling Unicode was not possible. */ -#define Py_USING_UNICODE -#else -#define FIX_TRACE -#endif - -enum HandlerTypes { - StartElement, - EndElement, - ProcessingInstruction, - CharacterData, - UnparsedEntityDecl, - NotationDecl, - StartNamespaceDecl, - EndNamespaceDecl, - Comment, - StartCdataSection, - EndCdataSection, - Default, - DefaultHandlerExpand, - NotStandalone, - ExternalEntityRef, - StartDoctypeDecl, - EndDoctypeDecl, - EntityDecl, - XmlDecl, - ElementDecl, - AttlistDecl, -#if XML_COMBINED_VERSION >= 19504 - SkippedEntity, -#endif - _DummyDecl -}; - -static PyObject *ErrorObject; - -/* ----------------------------------------------------- */ - -/* Declarations for objects of type xmlparser */ - -typedef struct { - PyObject_HEAD - - XML_Parser itself; - int returns_unicode; /* True if Unicode strings are returned; - if false, UTF-8 strings are returned */ - int ordered_attributes; /* Return attributes as a list. */ - int specified_attributes; /* Report only specified attributes. */ - int in_callback; /* Is a callback active? */ - int ns_prefixes; /* Namespace-triplets mode? */ - XML_Char *buffer; /* Buffer used when accumulating characters */ - /* NULL if not enabled */ - int buffer_size; /* Size of buffer, in XML_Char units */ - int buffer_used; /* Buffer units in use */ - PyObject *intern; /* Dictionary to intern strings */ - PyObject **handlers; -} xmlparseobject; - -#define CHARACTER_DATA_BUFFER_SIZE 8192 - -static PyTypeObject Xmlparsetype; - -typedef void (*xmlhandlersetter)(XML_Parser self, void *meth); -typedef void* xmlhandler; - -struct HandlerInfo { - const char *name; - xmlhandlersetter setter; - xmlhandler handler; - PyCodeObject *tb_code; - PyObject *nameobj; -}; - -static struct HandlerInfo handler_info[64]; - -/* Set an integer attribute on the error object; return true on success, - * false on an exception. - */ -static int -set_error_attr(PyObject *err, char *name, int value) -{ - PyObject *v = PyInt_FromLong(value); - - if (v == NULL || PyObject_SetAttrString(err, name, v) == -1) { - Py_XDECREF(v); - return 0; - } - Py_DECREF(v); - return 1; -} - -/* Build and set an Expat exception, including positioning - * information. Always returns NULL. - */ -static PyObject * -set_error(xmlparseobject *self, enum XML_Error code) -{ - PyObject *err; - char buffer[256]; - XML_Parser parser = self->itself; - int lineno = XML_GetErrorLineNumber(parser); - int column = XML_GetErrorColumnNumber(parser); - - /* There is no risk of overflowing this buffer, since - even for 64-bit integers, there is sufficient space. */ - sprintf(buffer, "%.200s: line %i, column %i", - XML_ErrorString(code), lineno, column); - err = PyObject_CallFunction(ErrorObject, "s", buffer); - if ( err != NULL - && set_error_attr(err, "code", code) - && set_error_attr(err, "offset", column) - && set_error_attr(err, "lineno", lineno)) { - PyErr_SetObject(ErrorObject, err); - } - Py_XDECREF(err); - return NULL; -} - -static int -have_handler(xmlparseobject *self, int type) -{ - PyObject *handler = self->handlers[type]; - return handler != NULL; -} - -static PyObject * -get_handler_name(struct HandlerInfo *hinfo) -{ - PyObject *name = hinfo->nameobj; - if (name == NULL) { - name = PyString_FromString(hinfo->name); - hinfo->nameobj = name; - } - Py_XINCREF(name); - return name; -} - - -#ifdef Py_USING_UNICODE -/* Convert a string of XML_Chars into a Unicode string. - Returns None if str is a null pointer. */ - -static PyObject * -conv_string_to_unicode(const XML_Char *str) -{ - /* XXX currently this code assumes that XML_Char is 8-bit, - and hence in UTF-8. */ - /* UTF-8 from Expat, Unicode desired */ - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyUnicode_DecodeUTF8(str, strlen(str), "strict"); -} - -static PyObject * -conv_string_len_to_unicode(const XML_Char *str, int len) -{ - /* XXX currently this code assumes that XML_Char is 8-bit, - and hence in UTF-8. */ - /* UTF-8 from Expat, Unicode desired */ - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyUnicode_DecodeUTF8((const char *)str, len, "strict"); -} -#endif - -/* Convert a string of XML_Chars into an 8-bit Python string. - Returns None if str is a null pointer. */ - -static PyObject * -conv_string_to_utf8(const XML_Char *str) -{ - /* XXX currently this code assumes that XML_Char is 8-bit, - and hence in UTF-8. */ - /* UTF-8 from Expat, UTF-8 desired */ - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(str); -} - -static PyObject * -conv_string_len_to_utf8(const XML_Char *str, int len) -{ - /* XXX currently this code assumes that XML_Char is 8-bit, - and hence in UTF-8. */ - /* UTF-8 from Expat, UTF-8 desired */ - if (str == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromStringAndSize((const char *)str, len); -} - -/* Callback routines */ - -static void clear_handlers(xmlparseobject *self, int initial); - -/* This handler is used when an error has been detected, in the hope - that actual parsing can be terminated early. This will only help - if an external entity reference is encountered. */ -static int -error_external_entity_ref_handler(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - return 0; -} - -/* Dummy character data handler used when an error (exception) has - been detected, and the actual parsing can be terminated early. - This is needed since character data handler can't be safely removed - from within the character data handler, but can be replaced. It is - used only from the character data handler trampoline, and must be - used right after `flag_error()` is called. */ -static void -noop_character_data_handler(void *userData, const XML_Char *data, int len) -{ - /* Do nothing. */ -} - -static void -flag_error(xmlparseobject *self) -{ - clear_handlers(self, 0); - XML_SetExternalEntityRefHandler(self->itself, - error_external_entity_ref_handler); -} - -static PyCodeObject* -getcode(enum HandlerTypes slot, char* func_name, int lineno) -{ - if (handler_info[slot].tb_code == NULL) { - handler_info[slot].tb_code = - PyCode_NewEmpty(__FILE__, func_name, lineno); - } - return handler_info[slot].tb_code; -} - -#ifdef FIX_TRACE -static int -trace_frame(PyThreadState *tstate, PyFrameObject *f, int code, PyObject *val) -{ - int result = 0; - if (!tstate->use_tracing || tstate->tracing) - return 0; - if (tstate->c_profilefunc != NULL) { - tstate->tracing++; - result = tstate->c_profilefunc(tstate->c_profileobj, - f, code , val); - tstate->use_tracing = ((tstate->c_tracefunc != NULL) - || (tstate->c_profilefunc != NULL)); - tstate->tracing--; - if (result) - return result; - } - if (tstate->c_tracefunc != NULL) { - tstate->tracing++; - result = tstate->c_tracefunc(tstate->c_traceobj, - f, code , val); - tstate->use_tracing = ((tstate->c_tracefunc != NULL) - || (tstate->c_profilefunc != NULL)); - tstate->tracing--; - } - return result; -} - -static int -trace_frame_exc(PyThreadState *tstate, PyFrameObject *f) -{ - PyObject *type, *value, *traceback, *arg; - int err; - - if (tstate->c_tracefunc == NULL) - return 0; - - PyErr_Fetch(&type, &value, &traceback); - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } -#if PY_VERSION_HEX < 0x02040000 - arg = Py_BuildValue("(OOO)", type, value, traceback); -#else - arg = PyTuple_Pack(3, type, value, traceback); -#endif - if (arg == NULL) { - PyErr_Restore(type, value, traceback); - return 0; - } - err = trace_frame(tstate, f, PyTrace_EXCEPTION, arg); - Py_DECREF(arg); - if (err == 0) - PyErr_Restore(type, value, traceback); - else { - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(traceback); - } - return err; -} -#endif - -static PyObject* -call_with_frame(PyCodeObject *c, PyObject* func, PyObject* args, - xmlparseobject *self) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyFrameObject *f; - PyObject *res; - - if (c == NULL) - return NULL; - - f = PyFrame_New(tstate, c, PyEval_GetGlobals(), NULL); - if (f == NULL) - return NULL; - tstate->frame = f; -#ifdef FIX_TRACE - if (trace_frame(tstate, f, PyTrace_CALL, Py_None) < 0) { - return NULL; - } -#endif - res = PyEval_CallObject(func, args); - if (res == NULL) { - if (tstate->curexc_traceback == NULL) - PyTraceBack_Here(f); - XML_StopParser(self->itself, XML_FALSE); -#ifdef FIX_TRACE - if (trace_frame_exc(tstate, f) < 0) { - return NULL; - } - } - else { - if (trace_frame(tstate, f, PyTrace_RETURN, res) < 0) { - Py_XDECREF(res); - res = NULL; - } - } -#else - } -#endif - tstate->frame = f->f_back; - Py_DECREF(f); - return res; -} - -#ifndef Py_USING_UNICODE -#define STRING_CONV_FUNC conv_string_to_utf8 -#else -/* Python 2.0 and later versions, when built with Unicode support */ -#define STRING_CONV_FUNC (self->returns_unicode \ - ? conv_string_to_unicode : conv_string_to_utf8) -#endif - -static PyObject* -string_intern(xmlparseobject *self, const char* str) -{ - PyObject *result = STRING_CONV_FUNC(str); - PyObject *value; - /* result can be NULL if the unicode conversion failed. */ - if (!result) - return result; - if (!self->intern) - return result; - value = PyDict_GetItem(self->intern, result); - if (!value) { - if (PyDict_SetItem(self->intern, result, result) == 0) - return result; - else - return NULL; - } - Py_INCREF(value); - Py_DECREF(result); - return value; -} - -/* Return 0 on success, -1 on exception. - * flag_error() will be called before return if needed. - */ -static int -call_character_handler(xmlparseobject *self, const XML_Char *buffer, int len) -{ - PyObject *args; - PyObject *temp; - - if (!have_handler(self, CharacterData)) - return -1; - - args = PyTuple_New(1); - if (args == NULL) - return -1; -#ifdef Py_USING_UNICODE - temp = (self->returns_unicode - ? conv_string_len_to_unicode(buffer, len) - : conv_string_len_to_utf8(buffer, len)); -#else - temp = conv_string_len_to_utf8(buffer, len); -#endif - if (temp == NULL) { - Py_DECREF(args); - flag_error(self); - XML_SetCharacterDataHandler(self->itself, - noop_character_data_handler); - return -1; - } - PyTuple_SET_ITEM(args, 0, temp); - /* temp is now a borrowed reference; consider it unused. */ - self->in_callback = 1; - temp = call_with_frame(getcode(CharacterData, "CharacterData", __LINE__), - self->handlers[CharacterData], args, self); - /* temp is an owned reference again, or NULL */ - self->in_callback = 0; - Py_DECREF(args); - if (temp == NULL) { - flag_error(self); - XML_SetCharacterDataHandler(self->itself, - noop_character_data_handler); - return -1; - } - Py_DECREF(temp); - return 0; -} - -static int -flush_character_buffer(xmlparseobject *self) -{ - int rc; - if (self->buffer == NULL || self->buffer_used == 0) - return 0; - rc = call_character_handler(self, self->buffer, self->buffer_used); - self->buffer_used = 0; - return rc; -} - -static void -my_CharacterDataHandler(void *userData, const XML_Char *data, int len) -{ - xmlparseobject *self = (xmlparseobject *) userData; - if (self->buffer == NULL) - call_character_handler(self, data, len); - else { - if ((self->buffer_used + len) > self->buffer_size) { - if (flush_character_buffer(self) < 0) - return; - /* handler might have changed; drop the rest on the floor - * if there isn't a handler anymore - */ - if (!have_handler(self, CharacterData)) - return; - } - if (len > self->buffer_size) { - call_character_handler(self, data, len); - self->buffer_used = 0; - } - else { - memcpy(self->buffer + self->buffer_used, - data, len * sizeof(XML_Char)); - self->buffer_used += len; - } - } -} - -static void -my_StartElementHandler(void *userData, - const XML_Char *name, const XML_Char *atts[]) -{ - xmlparseobject *self = (xmlparseobject *)userData; - - if (have_handler(self, StartElement)) { - PyObject *container, *rv, *args; - int i, max; - - if (flush_character_buffer(self) < 0) - return; - /* Set max to the number of slots filled in atts[]; max/2 is - * the number of attributes we need to process. - */ - if (self->specified_attributes) { - max = XML_GetSpecifiedAttributeCount(self->itself); - } - else { - max = 0; - while (atts[max] != NULL) - max += 2; - } - /* Build the container. */ - if (self->ordered_attributes) - container = PyList_New(max); - else - container = PyDict_New(); - if (container == NULL) { - flag_error(self); - return; - } - for (i = 0; i < max; i += 2) { - PyObject *n = string_intern(self, (XML_Char *) atts[i]); - PyObject *v; - if (n == NULL) { - flag_error(self); - Py_DECREF(container); - return; - } - v = STRING_CONV_FUNC((XML_Char *) atts[i+1]); - if (v == NULL) { - flag_error(self); - Py_DECREF(container); - Py_DECREF(n); - return; - } - if (self->ordered_attributes) { - PyList_SET_ITEM(container, i, n); - PyList_SET_ITEM(container, i+1, v); - } - else if (PyDict_SetItem(container, n, v)) { - flag_error(self); - Py_DECREF(n); - Py_DECREF(v); - return; - } - else { - Py_DECREF(n); - Py_DECREF(v); - } - } - args = string_intern(self, name); - if (args != NULL) - args = Py_BuildValue("(NN)", args, container); - if (args == NULL) { - Py_DECREF(container); - return; - } - /* Container is now a borrowed reference; ignore it. */ - self->in_callback = 1; - rv = call_with_frame(getcode(StartElement, "StartElement", __LINE__), - self->handlers[StartElement], args, self); - self->in_callback = 0; - Py_DECREF(args); - if (rv == NULL) { - flag_error(self); - return; - } - Py_DECREF(rv); - } -} - -#define RC_HANDLER(RC, NAME, PARAMS, INIT, PARAM_FORMAT, CONVERSION, \ - RETURN, GETUSERDATA) \ -static RC \ -my_##NAME##Handler PARAMS {\ - xmlparseobject *self = GETUSERDATA ; \ - PyObject *args = NULL; \ - PyObject *rv = NULL; \ - INIT \ -\ - if (have_handler(self, NAME)) { \ - if (flush_character_buffer(self) < 0) \ - return RETURN; \ - args = Py_BuildValue PARAM_FORMAT ;\ - if (!args) { flag_error(self); return RETURN;} \ - self->in_callback = 1; \ - rv = call_with_frame(getcode(NAME,#NAME,__LINE__), \ - self->handlers[NAME], args, self); \ - self->in_callback = 0; \ - Py_DECREF(args); \ - if (rv == NULL) { \ - flag_error(self); \ - return RETURN; \ - } \ - CONVERSION \ - Py_DECREF(rv); \ - } \ - return RETURN; \ -} - -#define VOID_HANDLER(NAME, PARAMS, PARAM_FORMAT) \ - RC_HANDLER(void, NAME, PARAMS, ;, PARAM_FORMAT, ;, ;,\ - (xmlparseobject *)userData) - -#define INT_HANDLER(NAME, PARAMS, PARAM_FORMAT)\ - RC_HANDLER(int, NAME, PARAMS, int rc=0;, PARAM_FORMAT, \ - rc = PyInt_AsLong(rv);, rc, \ - (xmlparseobject *)userData) - -VOID_HANDLER(EndElement, - (void *userData, const XML_Char *name), - ("(N)", string_intern(self, name))) - -VOID_HANDLER(ProcessingInstruction, - (void *userData, - const XML_Char *target, - const XML_Char *data), - ("(NO&)", string_intern(self, target), STRING_CONV_FUNC,data)) - -VOID_HANDLER(UnparsedEntityDecl, - (void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName), - ("(NNNNN)", - string_intern(self, entityName), string_intern(self, base), - string_intern(self, systemId), string_intern(self, publicId), - string_intern(self, notationName))) - -#ifndef Py_USING_UNICODE -VOID_HANDLER(EntityDecl, - (void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName), - ("NiNNNNN", - string_intern(self, entityName), is_parameter_entity, - conv_string_len_to_utf8(value, value_length), - string_intern(self, base), string_intern(self, systemId), - string_intern(self, publicId), - string_intern(self, notationName))) -#else -VOID_HANDLER(EntityDecl, - (void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName), - ("NiNNNNN", - string_intern(self, entityName), is_parameter_entity, - (self->returns_unicode - ? conv_string_len_to_unicode(value, value_length) - : conv_string_len_to_utf8(value, value_length)), - string_intern(self, base), string_intern(self, systemId), - string_intern(self, publicId), - string_intern(self, notationName))) -#endif - -VOID_HANDLER(XmlDecl, - (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone), - ("(O&O&i)", - STRING_CONV_FUNC,version, STRING_CONV_FUNC,encoding, - standalone)) - -static PyObject * -conv_content_model(XML_Content * const model, - PyObject *(*conv_string)(const XML_Char *)) -{ - PyObject *result = NULL; - PyObject *children = PyTuple_New(model->numchildren); - int i; - - if (children != NULL) { - assert(model->numchildren < INT_MAX); - for (i = 0; i < (int)model->numchildren; ++i) { - PyObject *child = conv_content_model(&model->children[i], - conv_string); - if (child == NULL) { - Py_XDECREF(children); - return NULL; - } - PyTuple_SET_ITEM(children, i, child); - } - result = Py_BuildValue("(iiO&N)", - model->type, model->quant, - conv_string,model->name, children); - } - return result; -} - -static void -my_ElementDeclHandler(void *userData, - const XML_Char *name, - XML_Content *model) -{ - xmlparseobject *self = (xmlparseobject *)userData; - PyObject *args = NULL; - - if (have_handler(self, ElementDecl)) { - PyObject *rv = NULL; - PyObject *modelobj, *nameobj; - - if (flush_character_buffer(self) < 0) - goto finally; -#ifdef Py_USING_UNICODE - modelobj = conv_content_model(model, - (self->returns_unicode - ? conv_string_to_unicode - : conv_string_to_utf8)); -#else - modelobj = conv_content_model(model, conv_string_to_utf8); -#endif - if (modelobj == NULL) { - flag_error(self); - goto finally; - } - nameobj = string_intern(self, name); - if (nameobj == NULL) { - Py_DECREF(modelobj); - flag_error(self); - goto finally; - } - args = Py_BuildValue("NN", nameobj, modelobj); - if (args == NULL) { - Py_DECREF(modelobj); - flag_error(self); - goto finally; - } - self->in_callback = 1; - rv = call_with_frame(getcode(ElementDecl, "ElementDecl", __LINE__), - self->handlers[ElementDecl], args, self); - self->in_callback = 0; - if (rv == NULL) { - flag_error(self); - goto finally; - } - Py_DECREF(rv); - } - finally: - Py_XDECREF(args); - XML_FreeContentModel(self->itself, model); - return; -} - -VOID_HANDLER(AttlistDecl, - (void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired), - ("(NNO&O&i)", - string_intern(self, elname), string_intern(self, attname), - STRING_CONV_FUNC,att_type, STRING_CONV_FUNC,dflt, - isrequired)) - -#if XML_COMBINED_VERSION >= 19504 -VOID_HANDLER(SkippedEntity, - (void *userData, - const XML_Char *entityName, - int is_parameter_entity), - ("Ni", - string_intern(self, entityName), is_parameter_entity)) -#endif - -VOID_HANDLER(NotationDecl, - (void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId), - ("(NNNN)", - string_intern(self, notationName), string_intern(self, base), - string_intern(self, systemId), string_intern(self, publicId))) - -VOID_HANDLER(StartNamespaceDecl, - (void *userData, - const XML_Char *prefix, - const XML_Char *uri), - ("(NN)", - string_intern(self, prefix), string_intern(self, uri))) - -VOID_HANDLER(EndNamespaceDecl, - (void *userData, - const XML_Char *prefix), - ("(N)", string_intern(self, prefix))) - -VOID_HANDLER(Comment, - (void *userData, const XML_Char *data), - ("(O&)", STRING_CONV_FUNC,data)) - -VOID_HANDLER(StartCdataSection, - (void *userData), - ("()")) - -VOID_HANDLER(EndCdataSection, - (void *userData), - ("()")) - -#ifndef Py_USING_UNICODE -VOID_HANDLER(Default, - (void *userData, const XML_Char *s, int len), - ("(N)", conv_string_len_to_utf8(s,len))) - -VOID_HANDLER(DefaultHandlerExpand, - (void *userData, const XML_Char *s, int len), - ("(N)", conv_string_len_to_utf8(s,len))) -#else -VOID_HANDLER(Default, - (void *userData, const XML_Char *s, int len), - ("(N)", (self->returns_unicode - ? conv_string_len_to_unicode(s,len) - : conv_string_len_to_utf8(s,len)))) - -VOID_HANDLER(DefaultHandlerExpand, - (void *userData, const XML_Char *s, int len), - ("(N)", (self->returns_unicode - ? conv_string_len_to_unicode(s,len) - : conv_string_len_to_utf8(s,len)))) -#endif - -INT_HANDLER(NotStandalone, - (void *userData), - ("()")) - -RC_HANDLER(int, ExternalEntityRef, - (XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId), - int rc=0;, - ("(O&NNN)", - STRING_CONV_FUNC,context, string_intern(self, base), - string_intern(self, systemId), string_intern(self, publicId)), - rc = PyInt_AsLong(rv);, rc, - XML_GetUserData(parser)) - -/* XXX UnknownEncodingHandler */ - -VOID_HANDLER(StartDoctypeDecl, - (void *userData, const XML_Char *doctypeName, - const XML_Char *sysid, const XML_Char *pubid, - int has_internal_subset), - ("(NNNi)", string_intern(self, doctypeName), - string_intern(self, sysid), string_intern(self, pubid), - has_internal_subset)) - -VOID_HANDLER(EndDoctypeDecl, (void *userData), ("()")) - -/* ---------------------------------------------------------------- */ - -static PyObject * -get_parse_result(xmlparseobject *self, int rv) -{ - if (PyErr_Occurred()) { - return NULL; - } - if (rv == 0) { - return set_error(self, XML_GetErrorCode(self->itself)); - } - if (flush_character_buffer(self) < 0) { - return NULL; - } - return PyInt_FromLong(rv); -} - -PyDoc_STRVAR(xmlparse_Parse__doc__, -"Parse(data[, isfinal])\n\ -Parse XML data. `isfinal' should be true at end of input."); - -static PyObject * -xmlparse_Parse(xmlparseobject *self, PyObject *args) -{ - char *s; - int slen; - int isFinal = 0; - - if (!PyArg_ParseTuple(args, "s#|i:Parse", &s, &slen, &isFinal)) - return NULL; - - return get_parse_result(self, XML_Parse(self->itself, s, slen, isFinal)); -} - -/* File reading copied from cPickle */ - -#define BUF_SIZE 2048 - -static int -readinst(char *buf, int buf_size, PyObject *meth) -{ - PyObject *arg = NULL; - PyObject *bytes = NULL; - PyObject *str = NULL; - int len = -1; - - if ((bytes = PyInt_FromLong(buf_size)) == NULL) - goto finally; - - if ((arg = PyTuple_New(1)) == NULL) { - Py_DECREF(bytes); - goto finally; - } - - PyTuple_SET_ITEM(arg, 0, bytes); - -#if PY_VERSION_HEX < 0x02020000 - str = PyObject_CallObject(meth, arg); -#else - str = PyObject_Call(meth, arg, NULL); -#endif - if (str == NULL) - goto finally; - - /* XXX what to do if it returns a Unicode string? */ - if (!PyString_Check(str)) { - PyErr_Format(PyExc_TypeError, - "read() did not return a string object (type=%.400s)", - Py_TYPE(str)->tp_name); - goto finally; - } - len = PyString_GET_SIZE(str); - if (len > buf_size) { - PyErr_Format(PyExc_ValueError, - "read() returned too much data: " - "%i bytes requested, %i returned", - buf_size, len); - goto finally; - } - memcpy(buf, PyString_AsString(str), len); -finally: - Py_XDECREF(arg); - Py_XDECREF(str); - return len; -} - -PyDoc_STRVAR(xmlparse_ParseFile__doc__, -"ParseFile(file)\n\ -Parse XML data from file-like object."); - -static PyObject * -xmlparse_ParseFile(xmlparseobject *self, PyObject *f) -{ - int rv = 1; - PyObject *readmethod = NULL; - - readmethod = PyObject_GetAttrString(f, "read"); - if (readmethod == NULL) { - PyErr_SetString(PyExc_TypeError, - "argument must have 'read' attribute"); - return NULL; - - } - for (;;) { - int bytes_read; - void *buf = XML_GetBuffer(self->itself, BUF_SIZE); - if (buf == NULL) { - Py_XDECREF(readmethod); - return get_parse_result(self, 0); - } - - bytes_read = readinst(buf, BUF_SIZE, readmethod); - if (bytes_read < 0) { - Py_XDECREF(readmethod); - return NULL; - } - - rv = XML_ParseBuffer(self->itself, bytes_read, bytes_read == 0); - if (PyErr_Occurred()) { - Py_XDECREF(readmethod); - return NULL; - } - - if (!rv || bytes_read == 0) - break; - } - Py_XDECREF(readmethod); - return get_parse_result(self, rv); -} - -PyDoc_STRVAR(xmlparse_SetBase__doc__, -"SetBase(base_url)\n\ -Set the base URL for the parser."); - -static PyObject * -xmlparse_SetBase(xmlparseobject *self, PyObject *args) -{ - char *base; - - if (!PyArg_ParseTuple(args, "s:SetBase", &base)) - return NULL; - if (!XML_SetBase(self->itself, base)) { - return PyErr_NoMemory(); - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(xmlparse_GetBase__doc__, -"GetBase() -> url\n\ -Return base URL string for the parser."); - -static PyObject * -xmlparse_GetBase(xmlparseobject *self, PyObject *unused) -{ - return Py_BuildValue("z", XML_GetBase(self->itself)); -} - -PyDoc_STRVAR(xmlparse_GetInputContext__doc__, -"GetInputContext() -> string\n\ -Return the untranslated text of the input that caused the current event.\n\ -If the event was generated by a large amount of text (such as a start tag\n\ -for an element with many attributes), not all of the text may be available."); - -static PyObject * -xmlparse_GetInputContext(xmlparseobject *self, PyObject *unused) -{ - if (self->in_callback) { - int offset, size; - const char *buffer - = XML_GetInputContext(self->itself, &offset, &size); - - if (buffer != NULL) - return PyString_FromStringAndSize(buffer + offset, - size - offset); - else - Py_RETURN_NONE; - } - else - Py_RETURN_NONE; -} - -PyDoc_STRVAR(xmlparse_ExternalEntityParserCreate__doc__, -"ExternalEntityParserCreate(context[, encoding])\n\ -Create a parser for parsing an external entity based on the\n\ -information passed to the ExternalEntityRefHandler."); - -static PyObject * -xmlparse_ExternalEntityParserCreate(xmlparseobject *self, PyObject *args) -{ - char *context; - char *encoding = NULL; - xmlparseobject *new_parser; - int i; - - if (!PyArg_ParseTuple(args, "z|s:ExternalEntityParserCreate", - &context, &encoding)) { - return NULL; - } - -#ifndef Py_TPFLAGS_HAVE_GC - /* Python versions 2.0 and 2.1 */ - new_parser = PyObject_New(xmlparseobject, &Xmlparsetype); -#else - /* Python versions 2.2 and later */ - new_parser = PyObject_GC_New(xmlparseobject, &Xmlparsetype); -#endif - - if (new_parser == NULL) - return NULL; - new_parser->buffer_size = self->buffer_size; - new_parser->buffer_used = 0; - if (self->buffer != NULL) { - new_parser->buffer = malloc(new_parser->buffer_size); - if (new_parser->buffer == NULL) { -#ifndef Py_TPFLAGS_HAVE_GC - /* Code for versions 2.0 and 2.1 */ - PyObject_Del(new_parser); -#else - /* Code for versions 2.2 and later. */ - PyObject_GC_Del(new_parser); -#endif - return PyErr_NoMemory(); - } - } - else - new_parser->buffer = NULL; - new_parser->returns_unicode = self->returns_unicode; - new_parser->ordered_attributes = self->ordered_attributes; - new_parser->specified_attributes = self->specified_attributes; - new_parser->in_callback = 0; - new_parser->ns_prefixes = self->ns_prefixes; - new_parser->itself = XML_ExternalEntityParserCreate(self->itself, context, - encoding); - new_parser->handlers = 0; - new_parser->intern = self->intern; - Py_XINCREF(new_parser->intern); -#ifdef Py_TPFLAGS_HAVE_GC - PyObject_GC_Track(new_parser); -#else - PyObject_GC_Init(new_parser); -#endif - - if (!new_parser->itself) { - Py_DECREF(new_parser); - return PyErr_NoMemory(); - } - - XML_SetUserData(new_parser->itself, (void *)new_parser); - - /* allocate and clear handlers first */ - for (i = 0; handler_info[i].name != NULL; i++) - /* do nothing */; - - new_parser->handlers = malloc(sizeof(PyObject *) * i); - if (!new_parser->handlers) { - Py_DECREF(new_parser); - return PyErr_NoMemory(); - } - clear_handlers(new_parser, 1); - - /* then copy handlers from self */ - for (i = 0; handler_info[i].name != NULL; i++) { - PyObject *handler = self->handlers[i]; - if (handler != NULL) { - Py_INCREF(handler); - new_parser->handlers[i] = handler; - handler_info[i].setter(new_parser->itself, - handler_info[i].handler); - } - } - return (PyObject *)new_parser; -} - -PyDoc_STRVAR(xmlparse_SetParamEntityParsing__doc__, -"SetParamEntityParsing(flag) -> success\n\ -Controls parsing of parameter entities (including the external DTD\n\ -subset). Possible flag values are XML_PARAM_ENTITY_PARSING_NEVER,\n\ -XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE and\n\ -XML_PARAM_ENTITY_PARSING_ALWAYS. Returns true if setting the flag\n\ -was successful."); - -static PyObject* -xmlparse_SetParamEntityParsing(xmlparseobject *p, PyObject* args) -{ - int flag; - if (!PyArg_ParseTuple(args, "i", &flag)) - return NULL; - flag = XML_SetParamEntityParsing(p->itself, flag); - return PyInt_FromLong(flag); -} - - -#if XML_COMBINED_VERSION >= 19505 -PyDoc_STRVAR(xmlparse_UseForeignDTD__doc__, -"UseForeignDTD([flag])\n\ -Allows the application to provide an artificial external subset if one is\n\ -not specified as part of the document instance. This readily allows the\n\ -use of a 'default' document type controlled by the application, while still\n\ -getting the advantage of providing document type information to the parser.\n\ -'flag' defaults to True if not provided."); - -static PyObject * -xmlparse_UseForeignDTD(xmlparseobject *self, PyObject *args) -{ - PyObject *flagobj = NULL; - int flag = 1; - enum XML_Error rc; - if (!PyArg_ParseTuple(args, "|O:UseForeignDTD", &flagobj)) - return NULL; - if (flagobj != NULL) { - flag = PyObject_IsTrue(flagobj); - if (flag < 0) - return NULL; - } - rc = XML_UseForeignDTD(self->itself, flag ? XML_TRUE : XML_FALSE); - if (rc != XML_ERROR_NONE) { - return set_error(self, rc); - } - Py_INCREF(Py_None); - return Py_None; -} -#endif - -static struct PyMethodDef xmlparse_methods[] = { - {"Parse", (PyCFunction)xmlparse_Parse, - METH_VARARGS, xmlparse_Parse__doc__}, - {"ParseFile", (PyCFunction)xmlparse_ParseFile, - METH_O, xmlparse_ParseFile__doc__}, - {"SetBase", (PyCFunction)xmlparse_SetBase, - METH_VARARGS, xmlparse_SetBase__doc__}, - {"GetBase", (PyCFunction)xmlparse_GetBase, - METH_NOARGS, xmlparse_GetBase__doc__}, - {"ExternalEntityParserCreate", (PyCFunction)xmlparse_ExternalEntityParserCreate, - METH_VARARGS, xmlparse_ExternalEntityParserCreate__doc__}, - {"SetParamEntityParsing", (PyCFunction)xmlparse_SetParamEntityParsing, - METH_VARARGS, xmlparse_SetParamEntityParsing__doc__}, - {"GetInputContext", (PyCFunction)xmlparse_GetInputContext, - METH_NOARGS, xmlparse_GetInputContext__doc__}, -#if XML_COMBINED_VERSION >= 19505 - {"UseForeignDTD", (PyCFunction)xmlparse_UseForeignDTD, - METH_VARARGS, xmlparse_UseForeignDTD__doc__}, -#endif - {NULL, NULL} /* sentinel */ -}; - -/* ---------- */ - - -#ifdef Py_USING_UNICODE - -/* pyexpat international encoding support. - Make it as simple as possible. -*/ - -static char template_buffer[257]; -PyObject *template_string = NULL; - -static void -init_template_buffer(void) -{ - int i; - for (i = 0; i < 256; i++) { - template_buffer[i] = i; - } - template_buffer[256] = 0; -} - -static int -PyUnknownEncodingHandler(void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info) -{ - PyUnicodeObject *_u_string = NULL; - int result = 0; - int i; - - /* Yes, supports only 8bit encodings */ - _u_string = (PyUnicodeObject *) - PyUnicode_Decode(template_buffer, 256, name, "replace"); - - if (_u_string == NULL) - return result; - - if (PyUnicode_GET_SIZE(_u_string) != 256) { - Py_DECREF(_u_string); - PyErr_SetString(PyExc_ValueError, - "multi-byte encodings are not supported"); - return result; - } - - for (i = 0; i < 256; i++) { - /* Stupid to access directly, but fast */ - Py_UNICODE c = _u_string->str[i]; - if (c == Py_UNICODE_REPLACEMENT_CHARACTER) - info->map[i] = -1; - else - info->map[i] = c; - } - info->data = NULL; - info->convert = NULL; - info->release = NULL; - result = 1; - Py_DECREF(_u_string); - return result; -} - -#endif - -static PyObject * -newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern) -{ - int i; - xmlparseobject *self; - -#ifdef Py_TPFLAGS_HAVE_GC - /* Code for versions 2.2 and later */ - self = PyObject_GC_New(xmlparseobject, &Xmlparsetype); -#else - self = PyObject_New(xmlparseobject, &Xmlparsetype); -#endif - if (self == NULL) - return NULL; - -#ifdef Py_USING_UNICODE - self->returns_unicode = 1; -#else - self->returns_unicode = 0; -#endif - - self->buffer = NULL; - self->buffer_size = CHARACTER_DATA_BUFFER_SIZE; - self->buffer_used = 0; - self->ordered_attributes = 0; - self->specified_attributes = 0; - self->in_callback = 0; - self->ns_prefixes = 0; - self->handlers = NULL; - if (namespace_separator != NULL) { - self->itself = XML_ParserCreateNS(encoding, *namespace_separator); - } - else { - self->itself = XML_ParserCreate(encoding); - } -#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT) - /* This feature was added upstream in libexpat 2.1.0. Our expat copy - * has a backport of this feature where we also define XML_HAS_SET_HASH_SALT - * to indicate that we can still use it. */ - XML_SetHashSalt(self->itself, - (unsigned long)_Py_HashSecret.prefix); -#endif - self->intern = intern; - Py_XINCREF(self->intern); -#ifdef Py_TPFLAGS_HAVE_GC - PyObject_GC_Track(self); -#else - PyObject_GC_Init(self); -#endif - if (self->itself == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "XML_ParserCreate failed"); - Py_DECREF(self); - return NULL; - } - XML_SetUserData(self->itself, (void *)self); -#ifdef Py_USING_UNICODE - XML_SetUnknownEncodingHandler(self->itself, - (XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL); -#endif - - for (i = 0; handler_info[i].name != NULL; i++) - /* do nothing */; - - self->handlers = malloc(sizeof(PyObject *) * i); - if (!self->handlers) { - Py_DECREF(self); - return PyErr_NoMemory(); - } - clear_handlers(self, 1); - - return (PyObject*)self; -} - - -static void -xmlparse_dealloc(xmlparseobject *self) -{ - int i; -#ifdef Py_TPFLAGS_HAVE_GC - PyObject_GC_UnTrack(self); -#else - PyObject_GC_Fini(self); -#endif - if (self->itself != NULL) - XML_ParserFree(self->itself); - self->itself = NULL; - - if (self->handlers != NULL) { - PyObject *temp; - for (i = 0; handler_info[i].name != NULL; i++) { - temp = self->handlers[i]; - self->handlers[i] = NULL; - Py_XDECREF(temp); - } - free(self->handlers); - self->handlers = NULL; - } - if (self->buffer != NULL) { - free(self->buffer); - self->buffer = NULL; - } - Py_XDECREF(self->intern); -#ifndef Py_TPFLAGS_HAVE_GC - /* Code for versions 2.0 and 2.1 */ - PyObject_Del(self); -#else - /* Code for versions 2.2 and later. */ - PyObject_GC_Del(self); -#endif -} - -static int -handlername2int(const char *name) -{ - int i; - for (i = 0; handler_info[i].name != NULL; i++) { - if (strcmp(name, handler_info[i].name) == 0) { - return i; - } - } - return -1; -} - -static PyObject * -get_pybool(int istrue) -{ - PyObject *result = istrue ? Py_True : Py_False; - Py_INCREF(result); - return result; -} - -static PyObject * -xmlparse_getattr(xmlparseobject *self, char *name) -{ - int handlernum = handlername2int(name); - - if (handlernum != -1) { - PyObject *result = self->handlers[handlernum]; - if (result == NULL) - result = Py_None; - Py_INCREF(result); - return result; - } - if (name[0] == 'E') { - if (strcmp(name, "ErrorCode") == 0) - return PyInt_FromLong((long) - XML_GetErrorCode(self->itself)); - if (strcmp(name, "ErrorLineNumber") == 0) - return PyInt_FromLong((long) - XML_GetErrorLineNumber(self->itself)); - if (strcmp(name, "ErrorColumnNumber") == 0) - return PyInt_FromLong((long) - XML_GetErrorColumnNumber(self->itself)); - if (strcmp(name, "ErrorByteIndex") == 0) - return PyInt_FromLong((long) - XML_GetErrorByteIndex(self->itself)); - } - if (name[0] == 'C') { - if (strcmp(name, "CurrentLineNumber") == 0) - return PyInt_FromLong((long) - XML_GetCurrentLineNumber(self->itself)); - if (strcmp(name, "CurrentColumnNumber") == 0) - return PyInt_FromLong((long) - XML_GetCurrentColumnNumber(self->itself)); - if (strcmp(name, "CurrentByteIndex") == 0) - return PyInt_FromLong((long) - XML_GetCurrentByteIndex(self->itself)); - } - if (name[0] == 'b') { - if (strcmp(name, "buffer_size") == 0) - return PyInt_FromLong((long) self->buffer_size); - if (strcmp(name, "buffer_text") == 0) - return get_pybool(self->buffer != NULL); - if (strcmp(name, "buffer_used") == 0) - return PyInt_FromLong((long) self->buffer_used); - } - if (strcmp(name, "namespace_prefixes") == 0) - return get_pybool(self->ns_prefixes); - if (strcmp(name, "ordered_attributes") == 0) - return get_pybool(self->ordered_attributes); - if (strcmp(name, "returns_unicode") == 0) - return get_pybool((long) self->returns_unicode); - if (strcmp(name, "specified_attributes") == 0) - return get_pybool((long) self->specified_attributes); - if (strcmp(name, "intern") == 0) { - if (self->intern == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - else { - Py_INCREF(self->intern); - return self->intern; - } - } - -#define APPEND(list, str) \ - do { \ - PyObject *o = PyString_FromString(str); \ - if (o != NULL) \ - PyList_Append(list, o); \ - Py_XDECREF(o); \ - } while (0) - - if (strcmp(name, "__members__") == 0) { - int i; - PyObject *rc = PyList_New(0); - if (!rc) - return NULL; - for (i = 0; handler_info[i].name != NULL; i++) { - PyObject *o = get_handler_name(&handler_info[i]); - if (o != NULL) - PyList_Append(rc, o); - Py_XDECREF(o); - } - APPEND(rc, "ErrorCode"); - APPEND(rc, "ErrorLineNumber"); - APPEND(rc, "ErrorColumnNumber"); - APPEND(rc, "ErrorByteIndex"); - APPEND(rc, "CurrentLineNumber"); - APPEND(rc, "CurrentColumnNumber"); - APPEND(rc, "CurrentByteIndex"); - APPEND(rc, "buffer_size"); - APPEND(rc, "buffer_text"); - APPEND(rc, "buffer_used"); - APPEND(rc, "namespace_prefixes"); - APPEND(rc, "ordered_attributes"); - APPEND(rc, "returns_unicode"); - APPEND(rc, "specified_attributes"); - APPEND(rc, "intern"); - -#undef APPEND - return rc; - } - return Py_FindMethod(xmlparse_methods, (PyObject *)self, name); -} - -static int -sethandler(xmlparseobject *self, const char *name, PyObject* v) -{ - int handlernum = handlername2int(name); - if (handlernum >= 0) { - xmlhandler c_handler = NULL; - PyObject *temp = self->handlers[handlernum]; - - if (v == Py_None) { - /* If this is the character data handler, and a character - data handler is already active, we need to be more - careful. What we can safely do is replace the existing - character data handler callback function with a no-op - function that will refuse to call Python. The downside - is that this doesn't completely remove the character - data handler from the C layer if there's any callback - active, so Expat does a little more work than it - otherwise would, but that's really an odd case. A more - elaborate system of handlers and state could remove the - C handler more effectively. */ - if (handlernum == CharacterData && self->in_callback) - c_handler = noop_character_data_handler; - v = NULL; - } - else if (v != NULL) { - Py_INCREF(v); - c_handler = handler_info[handlernum].handler; - } - self->handlers[handlernum] = v; - Py_XDECREF(temp); - handler_info[handlernum].setter(self->itself, c_handler); - return 1; - } - return 0; -} - -static int -xmlparse_setattr(xmlparseobject *self, char *name, PyObject *v) -{ - /* Set attribute 'name' to value 'v'. v==NULL means delete */ - if (v == NULL) { - PyErr_SetString(PyExc_RuntimeError, "Cannot delete attribute"); - return -1; - } - if (strcmp(name, "buffer_text") == 0) { - int b = PyObject_IsTrue(v); - if (b < 0) - return -1; - if (b) { - if (self->buffer == NULL) { - self->buffer = malloc(self->buffer_size); - if (self->buffer == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buffer_used = 0; - } - } - else if (self->buffer != NULL) { - if (flush_character_buffer(self) < 0) - return -1; - free(self->buffer); - self->buffer = NULL; - } - return 0; - } - if (strcmp(name, "namespace_prefixes") == 0) { - int b = PyObject_IsTrue(v); - if (b < 0) - return -1; - self->ns_prefixes = b; - XML_SetReturnNSTriplet(self->itself, self->ns_prefixes); - return 0; - } - if (strcmp(name, "ordered_attributes") == 0) { - int b = PyObject_IsTrue(v); - if (b < 0) - return -1; - self->ordered_attributes = b; - return 0; - } - if (strcmp(name, "returns_unicode") == 0) { - int b = PyObject_IsTrue(v); - if (b < 0) - return -1; -#ifndef Py_USING_UNICODE - if (b) { - PyErr_SetString(PyExc_ValueError, - "Unicode support not available"); - return -1; - } -#endif - self->returns_unicode = b; - return 0; - } - if (strcmp(name, "specified_attributes") == 0) { - int b = PyObject_IsTrue(v); - if (b < 0) - return -1; - self->specified_attributes = b; - return 0; - } - - if (strcmp(name, "buffer_size") == 0) { - long new_buffer_size; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, "buffer_size must be an integer"); - return -1; - } - - new_buffer_size=PyInt_AS_LONG(v); - /* trivial case -- no change */ - if (new_buffer_size == self->buffer_size) { - return 0; - } - - if (new_buffer_size <= 0) { - PyErr_SetString(PyExc_ValueError, "buffer_size must be greater than zero"); - return -1; - } - - /* check maximum */ - if (new_buffer_size > INT_MAX) { - char errmsg[100]; - sprintf(errmsg, "buffer_size must not be greater than %i", INT_MAX); - PyErr_SetString(PyExc_ValueError, errmsg); - return -1; - } - - if (self->buffer != NULL) { - /* there is already a buffer */ - if (self->buffer_used != 0) { - flush_character_buffer(self); - } - /* free existing buffer */ - free(self->buffer); - } - self->buffer = malloc(new_buffer_size); - if (self->buffer == NULL) { - PyErr_NoMemory(); - return -1; - } - self->buffer_size = new_buffer_size; - return 0; - } - - if (strcmp(name, "CharacterDataHandler") == 0) { - /* If we're changing the character data handler, flush all - * cached data with the old handler. Not sure there's a - * "right" thing to do, though, but this probably won't - * happen. - */ - if (flush_character_buffer(self) < 0) - return -1; - } - if (sethandler(self, name, v)) { - return 0; - } - PyErr_SetString(PyExc_AttributeError, name); - return -1; -} - -#ifdef WITH_CYCLE_GC -static int -xmlparse_traverse(xmlparseobject *op, visitproc visit, void *arg) -{ - int i; - for (i = 0; handler_info[i].name != NULL; i++) - Py_VISIT(op->handlers[i]); - return 0; -} - -static int -xmlparse_clear(xmlparseobject *op) -{ - clear_handlers(op, 0); - Py_CLEAR(op->intern); - return 0; -} -#endif - -PyDoc_STRVAR(Xmlparsetype__doc__, "XML parser"); - -static PyTypeObject Xmlparsetype = { - PyVarObject_HEAD_INIT(NULL, 0) - "pyexpat.xmlparser", /*tp_name*/ - sizeof(xmlparseobject) + PyGC_HEAD_SIZE,/*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)xmlparse_dealloc, /*tp_dealloc*/ - (printfunc)0, /*tp_print*/ - (getattrfunc)xmlparse_getattr, /*tp_getattr*/ - (setattrfunc)xmlparse_setattr, /*tp_setattr*/ - (cmpfunc)0, /*tp_compare*/ - (reprfunc)0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)0, /*tp_hash*/ - (ternaryfunc)0, /*tp_call*/ - (reprfunc)0, /*tp_str*/ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ -#ifdef Py_TPFLAGS_HAVE_GC - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /*tp_flags*/ -#else - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_GC, /*tp_flags*/ -#endif - Xmlparsetype__doc__, /* tp_doc - Documentation string */ -#ifdef WITH_CYCLE_GC - (traverseproc)xmlparse_traverse, /* tp_traverse */ - (inquiry)xmlparse_clear /* tp_clear */ -#else - 0, 0 -#endif -}; - -/* End of code for xmlparser objects */ -/* -------------------------------------------------------- */ - -PyDoc_STRVAR(pyexpat_ParserCreate__doc__, -"ParserCreate([encoding[, namespace_separator]]) -> parser\n\ -Return a new XML parser object."); - -static PyObject * -pyexpat_ParserCreate(PyObject *notused, PyObject *args, PyObject *kw) -{ - char *encoding = NULL; - char *namespace_separator = NULL; - PyObject *intern = NULL; - PyObject *result; - int intern_decref = 0; - static char *kwlist[] = {"encoding", "namespace_separator", - "intern", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|zzO:ParserCreate", kwlist, - &encoding, &namespace_separator, &intern)) - return NULL; - if (namespace_separator != NULL - && strlen(namespace_separator) > 1) { - PyErr_SetString(PyExc_ValueError, - "namespace_separator must be at most one" - " character, omitted, or None"); - return NULL; - } - /* Explicitly passing None means no interning is desired. - Not passing anything means that a new dictionary is used. */ - if (intern == Py_None) - intern = NULL; - else if (intern == NULL) { - intern = PyDict_New(); - if (!intern) - return NULL; - intern_decref = 1; - } - else if (!PyDict_Check(intern)) { - PyErr_SetString(PyExc_TypeError, "intern must be a dictionary"); - return NULL; - } - - result = newxmlparseobject(encoding, namespace_separator, intern); - if (intern_decref) { - Py_DECREF(intern); - } - return result; -} - -PyDoc_STRVAR(pyexpat_ErrorString__doc__, -"ErrorString(errno) -> string\n\ -Returns string error for given number."); - -static PyObject * -pyexpat_ErrorString(PyObject *self, PyObject *args) -{ - long code = 0; - - if (!PyArg_ParseTuple(args, "l:ErrorString", &code)) - return NULL; - return Py_BuildValue("z", XML_ErrorString((int)code)); -} - -/* List of methods defined in the module */ - -static struct PyMethodDef pyexpat_methods[] = { - {"ParserCreate", (PyCFunction)pyexpat_ParserCreate, - METH_VARARGS|METH_KEYWORDS, pyexpat_ParserCreate__doc__}, - {"ErrorString", (PyCFunction)pyexpat_ErrorString, - METH_VARARGS, pyexpat_ErrorString__doc__}, - - {NULL, (PyCFunction)NULL, 0, NULL} /* sentinel */ -}; - -/* Module docstring */ - -PyDoc_STRVAR(pyexpat_module_documentation, -"Python wrapper for Expat parser."); - -/* Initialization function for the module */ - -#ifndef MODULE_NAME -#define MODULE_NAME "pyexpat" -#endif - -#ifndef MODULE_INITFUNC -#define MODULE_INITFUNC initpyexpat -#endif - -#ifndef PyMODINIT_FUNC -# ifdef MS_WINDOWS -# define PyMODINIT_FUNC __declspec(dllexport) void -# else -# define PyMODINIT_FUNC void -# endif -#endif - -PyMODINIT_FUNC MODULE_INITFUNC(void); /* avoid compiler warnings */ - -PyMODINIT_FUNC -MODULE_INITFUNC(void) -{ - PyObject *m, *d; - PyObject *errmod_name = PyString_FromString(MODULE_NAME ".errors"); - PyObject *errors_module; - PyObject *modelmod_name; - PyObject *model_module; - PyObject *sys_modules; - PyObject *version; - static struct PyExpat_CAPI capi; - PyObject* capi_object; - - if (errmod_name == NULL) - return; - modelmod_name = PyString_FromString(MODULE_NAME ".model"); - if (modelmod_name == NULL) - return; - - Py_TYPE(&Xmlparsetype) = &PyType_Type; - - /* Create the module and add the functions */ - m = Py_InitModule3(MODULE_NAME, pyexpat_methods, - pyexpat_module_documentation); - if (m == NULL) - return; - - /* Add some symbolic constants to the module */ - if (ErrorObject == NULL) { - ErrorObject = PyErr_NewException("xml.parsers.expat.ExpatError", - NULL, NULL); - if (ErrorObject == NULL) - return; - } - Py_INCREF(ErrorObject); - PyModule_AddObject(m, "error", ErrorObject); - Py_INCREF(ErrorObject); - PyModule_AddObject(m, "ExpatError", ErrorObject); - Py_INCREF(&Xmlparsetype); - PyModule_AddObject(m, "XMLParserType", (PyObject *) &Xmlparsetype); - - version = PyString_FromString(PY_VERSION); - if (!version) - return; - PyModule_AddObject(m, "__version__", version); - PyModule_AddStringConstant(m, "EXPAT_VERSION", - (char *) XML_ExpatVersion()); - { - XML_Expat_Version info = XML_ExpatVersionInfo(); - PyModule_AddObject(m, "version_info", - Py_BuildValue("(iii)", info.major, - info.minor, info.micro)); - } -#ifdef Py_USING_UNICODE - init_template_buffer(); -#endif - /* XXX When Expat supports some way of figuring out how it was - compiled, this should check and set native_encoding - appropriately. - */ - PyModule_AddStringConstant(m, "native_encoding", "UTF-8"); - - sys_modules = PySys_GetObject("modules"); - d = PyModule_GetDict(m); - errors_module = PyDict_GetItem(d, errmod_name); - if (errors_module == NULL) { - errors_module = PyModule_New(MODULE_NAME ".errors"); - if (errors_module != NULL) { - PyDict_SetItem(sys_modules, errmod_name, errors_module); - /* gives away the reference to errors_module */ - PyModule_AddObject(m, "errors", errors_module); - } - } - Py_DECREF(errmod_name); - model_module = PyDict_GetItem(d, modelmod_name); - if (model_module == NULL) { - model_module = PyModule_New(MODULE_NAME ".model"); - if (model_module != NULL) { - PyDict_SetItem(sys_modules, modelmod_name, model_module); - /* gives away the reference to model_module */ - PyModule_AddObject(m, "model", model_module); - } - } - Py_DECREF(modelmod_name); - if (errors_module == NULL || model_module == NULL) - /* Don't core dump later! */ - return; - -#if XML_COMBINED_VERSION > 19505 - { - const XML_Feature *features = XML_GetFeatureList(); - PyObject *list = PyList_New(0); - if (list == NULL) - /* just ignore it */ - PyErr_Clear(); - else { - int i = 0; - for (; features[i].feature != XML_FEATURE_END; ++i) { - int ok; - PyObject *item = Py_BuildValue("si", features[i].name, - features[i].value); - if (item == NULL) { - Py_DECREF(list); - list = NULL; - break; - } - ok = PyList_Append(list, item); - Py_DECREF(item); - if (ok < 0) { - PyErr_Clear(); - break; - } - } - if (list != NULL) - PyModule_AddObject(m, "features", list); - } - } -#endif - -#define MYCONST(name) \ - PyModule_AddStringConstant(errors_module, #name, \ - (char*)XML_ErrorString(name)) - - MYCONST(XML_ERROR_NO_MEMORY); - MYCONST(XML_ERROR_SYNTAX); - MYCONST(XML_ERROR_NO_ELEMENTS); - MYCONST(XML_ERROR_INVALID_TOKEN); - MYCONST(XML_ERROR_UNCLOSED_TOKEN); - MYCONST(XML_ERROR_PARTIAL_CHAR); - MYCONST(XML_ERROR_TAG_MISMATCH); - MYCONST(XML_ERROR_DUPLICATE_ATTRIBUTE); - MYCONST(XML_ERROR_JUNK_AFTER_DOC_ELEMENT); - MYCONST(XML_ERROR_PARAM_ENTITY_REF); - MYCONST(XML_ERROR_UNDEFINED_ENTITY); - MYCONST(XML_ERROR_RECURSIVE_ENTITY_REF); - MYCONST(XML_ERROR_ASYNC_ENTITY); - MYCONST(XML_ERROR_BAD_CHAR_REF); - MYCONST(XML_ERROR_BINARY_ENTITY_REF); - MYCONST(XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF); - MYCONST(XML_ERROR_MISPLACED_XML_PI); - MYCONST(XML_ERROR_UNKNOWN_ENCODING); - MYCONST(XML_ERROR_INCORRECT_ENCODING); - MYCONST(XML_ERROR_UNCLOSED_CDATA_SECTION); - MYCONST(XML_ERROR_EXTERNAL_ENTITY_HANDLING); - MYCONST(XML_ERROR_NOT_STANDALONE); - MYCONST(XML_ERROR_UNEXPECTED_STATE); - MYCONST(XML_ERROR_ENTITY_DECLARED_IN_PE); - MYCONST(XML_ERROR_FEATURE_REQUIRES_XML_DTD); - MYCONST(XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING); - /* Added in Expat 1.95.7. */ - MYCONST(XML_ERROR_UNBOUND_PREFIX); - /* Added in Expat 1.95.8. */ - MYCONST(XML_ERROR_UNDECLARING_PREFIX); - MYCONST(XML_ERROR_INCOMPLETE_PE); - MYCONST(XML_ERROR_XML_DECL); - MYCONST(XML_ERROR_TEXT_DECL); - MYCONST(XML_ERROR_PUBLICID); - MYCONST(XML_ERROR_SUSPENDED); - MYCONST(XML_ERROR_NOT_SUSPENDED); - MYCONST(XML_ERROR_ABORTED); - MYCONST(XML_ERROR_FINISHED); - MYCONST(XML_ERROR_SUSPEND_PE); - - PyModule_AddStringConstant(errors_module, "__doc__", - "Constants used to describe error conditions."); - -#undef MYCONST - -#define MYCONST(c) PyModule_AddIntConstant(m, #c, c) - MYCONST(XML_PARAM_ENTITY_PARSING_NEVER); - MYCONST(XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE); - MYCONST(XML_PARAM_ENTITY_PARSING_ALWAYS); -#undef MYCONST - -#define MYCONST(c) PyModule_AddIntConstant(model_module, #c, c) - PyModule_AddStringConstant(model_module, "__doc__", - "Constants used to interpret content model information."); - - MYCONST(XML_CTYPE_EMPTY); - MYCONST(XML_CTYPE_ANY); - MYCONST(XML_CTYPE_MIXED); - MYCONST(XML_CTYPE_NAME); - MYCONST(XML_CTYPE_CHOICE); - MYCONST(XML_CTYPE_SEQ); - - MYCONST(XML_CQUANT_NONE); - MYCONST(XML_CQUANT_OPT); - MYCONST(XML_CQUANT_REP); - MYCONST(XML_CQUANT_PLUS); -#undef MYCONST - - /* initialize pyexpat dispatch table */ - capi.size = sizeof(capi); - capi.magic = PyExpat_CAPI_MAGIC; - capi.MAJOR_VERSION = XML_MAJOR_VERSION; - capi.MINOR_VERSION = XML_MINOR_VERSION; - capi.MICRO_VERSION = XML_MICRO_VERSION; - capi.ErrorString = XML_ErrorString; - capi.GetErrorCode = XML_GetErrorCode; - capi.GetErrorColumnNumber = XML_GetErrorColumnNumber; - capi.GetErrorLineNumber = XML_GetErrorLineNumber; - capi.Parse = XML_Parse; - capi.ParserCreate_MM = XML_ParserCreate_MM; - capi.ParserFree = XML_ParserFree; - capi.SetCharacterDataHandler = XML_SetCharacterDataHandler; - capi.SetCommentHandler = XML_SetCommentHandler; - capi.SetDefaultHandlerExpand = XML_SetDefaultHandlerExpand; - capi.SetElementHandler = XML_SetElementHandler; - capi.SetNamespaceDeclHandler = XML_SetNamespaceDeclHandler; - capi.SetProcessingInstructionHandler = XML_SetProcessingInstructionHandler; - capi.SetUnknownEncodingHandler = XML_SetUnknownEncodingHandler; - capi.SetUserData = XML_SetUserData; - - /* export using capsule */ - capi_object = PyCapsule_New(&capi, PyExpat_CAPSULE_NAME, NULL); - if (capi_object) - PyModule_AddObject(m, "expat_CAPI", capi_object); -} - -static void -clear_handlers(xmlparseobject *self, int initial) -{ - int i = 0; - PyObject *temp; - - for (; handler_info[i].name != NULL; i++) { - if (initial) - self->handlers[i] = NULL; - else { - temp = self->handlers[i]; - self->handlers[i] = NULL; - Py_XDECREF(temp); - handler_info[i].setter(self->itself, NULL); - } - } -} - -static struct HandlerInfo handler_info[] = { - {"StartElementHandler", - (xmlhandlersetter)XML_SetStartElementHandler, - (xmlhandler)my_StartElementHandler}, - {"EndElementHandler", - (xmlhandlersetter)XML_SetEndElementHandler, - (xmlhandler)my_EndElementHandler}, - {"ProcessingInstructionHandler", - (xmlhandlersetter)XML_SetProcessingInstructionHandler, - (xmlhandler)my_ProcessingInstructionHandler}, - {"CharacterDataHandler", - (xmlhandlersetter)XML_SetCharacterDataHandler, - (xmlhandler)my_CharacterDataHandler}, - {"UnparsedEntityDeclHandler", - (xmlhandlersetter)XML_SetUnparsedEntityDeclHandler, - (xmlhandler)my_UnparsedEntityDeclHandler}, - {"NotationDeclHandler", - (xmlhandlersetter)XML_SetNotationDeclHandler, - (xmlhandler)my_NotationDeclHandler}, - {"StartNamespaceDeclHandler", - (xmlhandlersetter)XML_SetStartNamespaceDeclHandler, - (xmlhandler)my_StartNamespaceDeclHandler}, - {"EndNamespaceDeclHandler", - (xmlhandlersetter)XML_SetEndNamespaceDeclHandler, - (xmlhandler)my_EndNamespaceDeclHandler}, - {"CommentHandler", - (xmlhandlersetter)XML_SetCommentHandler, - (xmlhandler)my_CommentHandler}, - {"StartCdataSectionHandler", - (xmlhandlersetter)XML_SetStartCdataSectionHandler, - (xmlhandler)my_StartCdataSectionHandler}, - {"EndCdataSectionHandler", - (xmlhandlersetter)XML_SetEndCdataSectionHandler, - (xmlhandler)my_EndCdataSectionHandler}, - {"DefaultHandler", - (xmlhandlersetter)XML_SetDefaultHandler, - (xmlhandler)my_DefaultHandler}, - {"DefaultHandlerExpand", - (xmlhandlersetter)XML_SetDefaultHandlerExpand, - (xmlhandler)my_DefaultHandlerExpandHandler}, - {"NotStandaloneHandler", - (xmlhandlersetter)XML_SetNotStandaloneHandler, - (xmlhandler)my_NotStandaloneHandler}, - {"ExternalEntityRefHandler", - (xmlhandlersetter)XML_SetExternalEntityRefHandler, - (xmlhandler)my_ExternalEntityRefHandler}, - {"StartDoctypeDeclHandler", - (xmlhandlersetter)XML_SetStartDoctypeDeclHandler, - (xmlhandler)my_StartDoctypeDeclHandler}, - {"EndDoctypeDeclHandler", - (xmlhandlersetter)XML_SetEndDoctypeDeclHandler, - (xmlhandler)my_EndDoctypeDeclHandler}, - {"EntityDeclHandler", - (xmlhandlersetter)XML_SetEntityDeclHandler, - (xmlhandler)my_EntityDeclHandler}, - {"XmlDeclHandler", - (xmlhandlersetter)XML_SetXmlDeclHandler, - (xmlhandler)my_XmlDeclHandler}, - {"ElementDeclHandler", - (xmlhandlersetter)XML_SetElementDeclHandler, - (xmlhandler)my_ElementDeclHandler}, - {"AttlistDeclHandler", - (xmlhandlersetter)XML_SetAttlistDeclHandler, - (xmlhandler)my_AttlistDeclHandler}, -#if XML_COMBINED_VERSION >= 19504 - {"SkippedEntityHandler", - (xmlhandlersetter)XML_SetSkippedEntityHandler, - (xmlhandler)my_SkippedEntityHandler}, -#endif - - {NULL, NULL, NULL} /* sentinel */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/python.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/python.c deleted file mode 100644 index a7446e7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/python.c +++ /dev/null @@ -1,24 +0,0 @@ -/* Minimal main program -- everything is loaded from the library */ - -#include "Python.h" - -#ifdef __FreeBSD__ -#include -#endif - -int -main(int argc, char **argv) -{ - /* 754 requires that FP exceptions run in "no stop" mode by default, - * and until C vendors implement C99's ways to control FP exceptions, - * Python requires non-stop mode. Alas, some platforms enable FP - * exceptions by default. Here we disable them. - */ -#ifdef __FreeBSD__ - fp_except_t m; - - m = fpgetmask(); - fpsetmask(m & ~FP_X_OFL); -#endif - return Py_Main(argc, argv); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/sha256module.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/sha256module.c deleted file mode 100644 index 9fe72f9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/sha256module.c +++ /dev/null @@ -1,706 +0,0 @@ -/* SHA256 module */ - -/* This module provides an interface to NIST's SHA-256 and SHA-224 Algorithms */ - -/* See below for information about the original code this module was - based upon. Additional work performed by: - - Andrew Kuchling (amk@amk.ca) - Greg Stein (gstein@lyra.org) - Trevor Perrin (trevp@trevp.net) - - Copyright (C) 2005 Gregory P. Smith (greg@krypto.org) - Licensed to PSF under a Contributor Agreement. - -*/ - -/* SHA objects */ - -#include "Python.h" -#include "structmember.h" - - -/* Endianness testing and definitions */ -#define TestEndianness(variable) {int i=1; variable=PCT_BIG_ENDIAN;\ - if (*((char*)&i)==1) variable=PCT_LITTLE_ENDIAN;} - -#define PCT_LITTLE_ENDIAN 1 -#define PCT_BIG_ENDIAN 0 - -/* Some useful types */ - -typedef unsigned char SHA_BYTE; - -#if SIZEOF_INT == 4 -typedef unsigned int SHA_INT32; /* 32-bit integer */ -#else -/* not defined. compilation will die. */ -#endif - -/* The SHA block size and message digest sizes, in bytes */ - -#define SHA_BLOCKSIZE 64 -#define SHA_DIGESTSIZE 32 - -/* The structure for storing SHA info */ - -typedef struct { - PyObject_HEAD - SHA_INT32 digest[8]; /* Message digest */ - SHA_INT32 count_lo, count_hi; /* 64-bit bit count */ - SHA_BYTE data[SHA_BLOCKSIZE]; /* SHA data buffer */ - int Endianness; - int local; /* unprocessed amount in data */ - int digestsize; -} SHAobject; - -/* When run on a little-endian CPU we need to perform byte reversal on an - array of longwords. */ - -static void longReverse(SHA_INT32 *buffer, int byteCount, int Endianness) -{ - SHA_INT32 value; - - if ( Endianness == PCT_BIG_ENDIAN ) - return; - - byteCount /= sizeof(*buffer); - while (byteCount--) { - value = *buffer; - value = ( ( value & 0xFF00FF00L ) >> 8 ) | \ - ( ( value & 0x00FF00FFL ) << 8 ); - *buffer++ = ( value << 16 ) | ( value >> 16 ); - } -} - -static void SHAcopy(SHAobject *src, SHAobject *dest) -{ - dest->Endianness = src->Endianness; - dest->local = src->local; - dest->digestsize = src->digestsize; - dest->count_lo = src->count_lo; - dest->count_hi = src->count_hi; - memcpy(dest->digest, src->digest, sizeof(src->digest)); - memcpy(dest->data, src->data, sizeof(src->data)); -} - - -/* ------------------------------------------------------------------------ - * - * This code for the SHA-256 algorithm was noted as public domain. The - * original headers are pasted below. - * - * Several changes have been made to make it more compatible with the - * Python environment and desired interface. - * - */ - -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * gurantee it works. - * - * Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org - */ - - -/* SHA256 by Tom St Denis */ - -/* Various logical functions */ -#define ROR(x, y)\ -( ((((unsigned long)(x)&0xFFFFFFFFUL)>>(unsigned long)((y)&31)) | \ -((unsigned long)(x)<<(unsigned long)(32-((y)&31)))) & 0xFFFFFFFFUL) -#define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) -#define S(x, n) ROR((x),(n)) -#define R(x, n) (((x)&0xFFFFFFFFUL)>>(n)) -#define Sigma0(x) (S(x, 2) ^ S(x, 13) ^ S(x, 22)) -#define Sigma1(x) (S(x, 6) ^ S(x, 11) ^ S(x, 25)) -#define Gamma0(x) (S(x, 7) ^ S(x, 18) ^ R(x, 3)) -#define Gamma1(x) (S(x, 17) ^ S(x, 19) ^ R(x, 10)) - - -static void -sha_transform(SHAobject *sha_info) -{ - int i; - SHA_INT32 S[8], W[64], t0, t1; - - memcpy(W, sha_info->data, sizeof(sha_info->data)); - longReverse(W, (int)sizeof(sha_info->data), sha_info->Endianness); - - for (i = 16; i < 64; ++i) { - W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; - } - for (i = 0; i < 8; ++i) { - S[i] = sha_info->digest[i]; - } - - /* Compress */ -#define RND(a,b,c,d,e,f,g,h,i,ki) \ - t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],0,0x428a2f98); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],1,0x71374491); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],2,0xb5c0fbcf); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],3,0xe9b5dba5); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],4,0x3956c25b); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],5,0x59f111f1); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],6,0x923f82a4); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],7,0xab1c5ed5); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],8,0xd807aa98); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],9,0x12835b01); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],10,0x243185be); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],11,0x550c7dc3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],12,0x72be5d74); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],13,0x80deb1fe); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],14,0x9bdc06a7); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],15,0xc19bf174); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],16,0xe49b69c1); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],17,0xefbe4786); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],18,0x0fc19dc6); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],19,0x240ca1cc); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],20,0x2de92c6f); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],21,0x4a7484aa); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],22,0x5cb0a9dc); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],23,0x76f988da); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],24,0x983e5152); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],25,0xa831c66d); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],26,0xb00327c8); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],27,0xbf597fc7); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],28,0xc6e00bf3); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],29,0xd5a79147); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],30,0x06ca6351); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],31,0x14292967); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],32,0x27b70a85); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],33,0x2e1b2138); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],34,0x4d2c6dfc); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],35,0x53380d13); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],36,0x650a7354); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],37,0x766a0abb); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],38,0x81c2c92e); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],39,0x92722c85); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],40,0xa2bfe8a1); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],41,0xa81a664b); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],42,0xc24b8b70); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],43,0xc76c51a3); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],44,0xd192e819); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],45,0xd6990624); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],46,0xf40e3585); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],47,0x106aa070); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],48,0x19a4c116); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],49,0x1e376c08); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],50,0x2748774c); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],51,0x34b0bcb5); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],52,0x391c0cb3); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],53,0x4ed8aa4a); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],54,0x5b9cca4f); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],55,0x682e6ff3); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],56,0x748f82ee); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],57,0x78a5636f); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],58,0x84c87814); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],59,0x8cc70208); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],60,0x90befffa); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],61,0xa4506ceb); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,0xbef9a3f7); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,0xc67178f2); - -#undef RND - - /* feedback */ - for (i = 0; i < 8; i++) { - sha_info->digest[i] = sha_info->digest[i] + S[i]; - } - -} - - - -/* initialize the SHA digest */ - -static void -sha_init(SHAobject *sha_info) -{ - TestEndianness(sha_info->Endianness) - sha_info->digest[0] = 0x6A09E667L; - sha_info->digest[1] = 0xBB67AE85L; - sha_info->digest[2] = 0x3C6EF372L; - sha_info->digest[3] = 0xA54FF53AL; - sha_info->digest[4] = 0x510E527FL; - sha_info->digest[5] = 0x9B05688CL; - sha_info->digest[6] = 0x1F83D9ABL; - sha_info->digest[7] = 0x5BE0CD19L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; - sha_info->digestsize = 32; -} - -static void -sha224_init(SHAobject *sha_info) -{ - TestEndianness(sha_info->Endianness) - sha_info->digest[0] = 0xc1059ed8L; - sha_info->digest[1] = 0x367cd507L; - sha_info->digest[2] = 0x3070dd17L; - sha_info->digest[3] = 0xf70e5939L; - sha_info->digest[4] = 0xffc00b31L; - sha_info->digest[5] = 0x68581511L; - sha_info->digest[6] = 0x64f98fa7L; - sha_info->digest[7] = 0xbefa4fa4L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; - sha_info->digestsize = 28; -} - - -/* update the SHA digest */ - -static void -sha_update(SHAobject *sha_info, SHA_BYTE *buffer, int count) -{ - int i; - SHA_INT32 clo; - - clo = sha_info->count_lo + ((SHA_INT32) count << 3); - if (clo < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo = clo; - sha_info->count_hi += (SHA_INT32) count >> 29; - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - sha_transform(sha_info); - } - else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - sha_transform(sha_info); - } - memcpy(sha_info->data, buffer, count); - sha_info->local = count; -} - -/* finish computing the SHA digest */ - -static void -sha_final(unsigned char digest[SHA_DIGESTSIZE], SHAobject *sha_info) -{ - int count; - SHA_INT32 lo_bit_count, hi_bit_count; - - lo_bit_count = sha_info->count_lo; - hi_bit_count = sha_info->count_hi; - count = (int) ((lo_bit_count >> 3) & 0x3f); - ((SHA_BYTE *) sha_info->data)[count++] = 0x80; - if (count > SHA_BLOCKSIZE - 8) { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - count); - sha_transform(sha_info); - memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8); - } - else { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - 8 - count); - } - - /* GJS: note that we add the hi/lo in big-endian. sha_transform will - swap these values into host-order. */ - sha_info->data[56] = (hi_bit_count >> 24) & 0xff; - sha_info->data[57] = (hi_bit_count >> 16) & 0xff; - sha_info->data[58] = (hi_bit_count >> 8) & 0xff; - sha_info->data[59] = (hi_bit_count >> 0) & 0xff; - sha_info->data[60] = (lo_bit_count >> 24) & 0xff; - sha_info->data[61] = (lo_bit_count >> 16) & 0xff; - sha_info->data[62] = (lo_bit_count >> 8) & 0xff; - sha_info->data[63] = (lo_bit_count >> 0) & 0xff; - sha_transform(sha_info); - digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); - digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); - digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); - digest[ 3] = (unsigned char) ((sha_info->digest[0] ) & 0xff); - digest[ 4] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); - digest[ 5] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); - digest[ 6] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); - digest[ 7] = (unsigned char) ((sha_info->digest[1] ) & 0xff); - digest[ 8] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); - digest[ 9] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); - digest[10] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); - digest[11] = (unsigned char) ((sha_info->digest[2] ) & 0xff); - digest[12] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); - digest[13] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); - digest[14] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); - digest[15] = (unsigned char) ((sha_info->digest[3] ) & 0xff); - digest[16] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); - digest[17] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); - digest[18] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); - digest[19] = (unsigned char) ((sha_info->digest[4] ) & 0xff); - digest[20] = (unsigned char) ((sha_info->digest[5] >> 24) & 0xff); - digest[21] = (unsigned char) ((sha_info->digest[5] >> 16) & 0xff); - digest[22] = (unsigned char) ((sha_info->digest[5] >> 8) & 0xff); - digest[23] = (unsigned char) ((sha_info->digest[5] ) & 0xff); - digest[24] = (unsigned char) ((sha_info->digest[6] >> 24) & 0xff); - digest[25] = (unsigned char) ((sha_info->digest[6] >> 16) & 0xff); - digest[26] = (unsigned char) ((sha_info->digest[6] >> 8) & 0xff); - digest[27] = (unsigned char) ((sha_info->digest[6] ) & 0xff); - digest[28] = (unsigned char) ((sha_info->digest[7] >> 24) & 0xff); - digest[29] = (unsigned char) ((sha_info->digest[7] >> 16) & 0xff); - digest[30] = (unsigned char) ((sha_info->digest[7] >> 8) & 0xff); - digest[31] = (unsigned char) ((sha_info->digest[7] ) & 0xff); -} - -/* - * End of copied SHA code. - * - * ------------------------------------------------------------------------ - */ - -static PyTypeObject SHA224type; -static PyTypeObject SHA256type; - - -static SHAobject * -newSHA224object(void) -{ - return (SHAobject *)PyObject_New(SHAobject, &SHA224type); -} - -static SHAobject * -newSHA256object(void) -{ - return (SHAobject *)PyObject_New(SHAobject, &SHA256type); -} - -/* Internal methods for a hash object */ - -static void -SHA_dealloc(PyObject *ptr) -{ - PyObject_Del(ptr); -} - - -/* External methods for a hash object */ - -PyDoc_STRVAR(SHA256_copy__doc__, "Return a copy of the hash object."); - -static PyObject * -SHA256_copy(SHAobject *self, PyObject *unused) -{ - SHAobject *newobj; - - if (Py_TYPE(self) == &SHA256type) { - if ( (newobj = newSHA256object())==NULL) - return NULL; - } else { - if ( (newobj = newSHA224object())==NULL) - return NULL; - } - - SHAcopy(self, newobj); - return (PyObject *)newobj; -} - -PyDoc_STRVAR(SHA256_digest__doc__, -"Return the digest value as a string of binary data."); - -static PyObject * -SHA256_digest(SHAobject *self, PyObject *unused) -{ - unsigned char digest[SHA_DIGESTSIZE]; - SHAobject temp; - - SHAcopy(self, &temp); - sha_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, self->digestsize); -} - -PyDoc_STRVAR(SHA256_hexdigest__doc__, -"Return the digest value as a string of hexadecimal digits."); - -static PyObject * -SHA256_hexdigest(SHAobject *self, PyObject *unused) -{ - unsigned char digest[SHA_DIGESTSIZE]; - SHAobject temp; - PyObject *retval; - char *hex_digest; - int i, j; - - /* Get the raw (binary) digest value */ - SHAcopy(self, &temp); - sha_final(digest, &temp); - - /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); - if (!retval) - return NULL; - hex_digest = PyString_AsString(retval); - if (!hex_digest) { - Py_DECREF(retval); - return NULL; - } - - /* Make hex version of the digest */ - for(i=j=0; idigestsize; i++) { - char c; - c = (digest[i] >> 4) & 0xf; - c = (c>9) ? c+'a'-10 : c + '0'; - hex_digest[j++] = c; - c = (digest[i] & 0xf); - c = (c>9) ? c+'a'-10 : c + '0'; - hex_digest[j++] = c; - } - return retval; -} - -PyDoc_STRVAR(SHA256_update__doc__, -"Update this hash object's state with the provided string."); - -static PyObject * -SHA256_update(SHAobject *self, PyObject *args) -{ - Py_buffer buf; - - if (!PyArg_ParseTuple(args, "s*:update", &buf)) - return NULL; - - sha_update(self, buf.buf, buf.len); - - PyBuffer_Release(&buf); - Py_RETURN_NONE; -} - -static PyMethodDef SHA_methods[] = { - {"copy", (PyCFunction)SHA256_copy, METH_NOARGS, SHA256_copy__doc__}, - {"digest", (PyCFunction)SHA256_digest, METH_NOARGS, SHA256_digest__doc__}, - {"hexdigest", (PyCFunction)SHA256_hexdigest, METH_NOARGS, SHA256_hexdigest__doc__}, - {"update", (PyCFunction)SHA256_update, METH_VARARGS, SHA256_update__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -SHA256_get_block_size(PyObject *self, void *closure) -{ - return PyInt_FromLong(SHA_BLOCKSIZE); -} - -static PyObject * -SHA256_get_name(PyObject *self, void *closure) -{ - if (((SHAobject *)self)->digestsize == 32) - return PyString_FromStringAndSize("SHA256", 6); - else - return PyString_FromStringAndSize("SHA224", 6); -} - -static PyGetSetDef SHA_getseters[] = { - {"block_size", - (getter)SHA256_get_block_size, NULL, - NULL, - NULL}, - {"name", - (getter)SHA256_get_name, NULL, - NULL, - NULL}, - {NULL} /* Sentinel */ -}; - -static PyMemberDef SHA_members[] = { - {"digest_size", T_INT, offsetof(SHAobject, digestsize), READONLY, NULL}, - /* the old md5 and sha modules support 'digest_size' as in PEP 247. - * the old sha module also supported 'digestsize'. ugh. */ - {"digestsize", T_INT, offsetof(SHAobject, digestsize), READONLY, NULL}, - {NULL} /* Sentinel */ -}; - -static PyTypeObject SHA224type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_sha256.sha224", /*tp_name*/ - sizeof(SHAobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - SHA_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - SHA_methods, /* tp_methods */ - SHA_members, /* tp_members */ - SHA_getseters, /* tp_getset */ -}; - -static PyTypeObject SHA256type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_sha256.sha256", /*tp_name*/ - sizeof(SHAobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - SHA_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - SHA_methods, /* tp_methods */ - SHA_members, /* tp_members */ - SHA_getseters, /* tp_getset */ -}; - - -/* The single module-level function: new() */ - -PyDoc_STRVAR(SHA256_new__doc__, -"Return a new SHA-256 hash object; optionally initialized with a string."); - -static PyObject * -SHA256_new(PyObject *self, PyObject *args, PyObject *kwdict) -{ - static char *kwlist[] = {"string", NULL}; - SHAobject *new; - Py_buffer buf = { 0 }; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist, - &buf)) { - return NULL; - } - - if ((new = newSHA256object()) == NULL) { - PyBuffer_Release(&buf); - return NULL; - } - - sha_init(new); - - if (PyErr_Occurred()) { - Py_DECREF(new); - PyBuffer_Release(&buf); - return NULL; - } - if (buf.len > 0) { - sha_update(new, buf.buf, buf.len); - } - PyBuffer_Release(&buf); - - return (PyObject *)new; -} - -PyDoc_STRVAR(SHA224_new__doc__, -"Return a new SHA-224 hash object; optionally initialized with a string."); - -static PyObject * -SHA224_new(PyObject *self, PyObject *args, PyObject *kwdict) -{ - static char *kwlist[] = {"string", NULL}; - SHAobject *new; - Py_buffer buf = { 0 }; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist, - &buf)) { - return NULL; - } - - if ((new = newSHA224object()) == NULL) { - PyBuffer_Release(&buf); - return NULL; - } - - sha224_init(new); - - if (PyErr_Occurred()) { - Py_DECREF(new); - PyBuffer_Release(&buf); - return NULL; - } - if (buf.len > 0) { - sha_update(new, buf.buf, buf.len); - } - PyBuffer_Release(&buf); - - return (PyObject *)new; -} - - -/* List of functions exported by this module */ - -static struct PyMethodDef SHA_functions[] = { - {"sha256", (PyCFunction)SHA256_new, METH_VARARGS|METH_KEYWORDS, SHA256_new__doc__}, - {"sha224", (PyCFunction)SHA224_new, METH_VARARGS|METH_KEYWORDS, SHA224_new__doc__}, - {NULL, NULL} /* Sentinel */ -}; - - -/* Initialize this module. */ - -#define insint(n,v) { PyModule_AddIntConstant(m,n,v); } - -PyMODINIT_FUNC -init_sha256(void) -{ - PyObject *m; - - Py_TYPE(&SHA224type) = &PyType_Type; - if (PyType_Ready(&SHA224type) < 0) - return; - Py_TYPE(&SHA256type) = &PyType_Type; - if (PyType_Ready(&SHA256type) < 0) - return; - m = Py_InitModule("_sha256", SHA_functions); - if (m == NULL) - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/sha512module.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/sha512module.c deleted file mode 100644 index 79537e6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/sha512module.c +++ /dev/null @@ -1,774 +0,0 @@ -/* SHA512 module */ - -/* This module provides an interface to NIST's SHA-512 and SHA-384 Algorithms */ - -/* See below for information about the original code this module was - based upon. Additional work performed by: - - Andrew Kuchling (amk@amk.ca) - Greg Stein (gstein@lyra.org) - Trevor Perrin (trevp@trevp.net) - - Copyright (C) 2005 Gregory P. Smith (greg@krypto.org) - Licensed to PSF under a Contributor Agreement. - -*/ - -/* SHA objects */ - -#include "Python.h" -#include "structmember.h" - -#ifdef PY_LONG_LONG /* If no PY_LONG_LONG, don't compile anything! */ - -/* Endianness testing and definitions */ -#define TestEndianness(variable) {int i=1; variable=PCT_BIG_ENDIAN;\ - if (*((char*)&i)==1) variable=PCT_LITTLE_ENDIAN;} - -#define PCT_LITTLE_ENDIAN 1 -#define PCT_BIG_ENDIAN 0 - -/* Some useful types */ - -typedef unsigned char SHA_BYTE; - -#if SIZEOF_INT == 4 -typedef unsigned int SHA_INT32; /* 32-bit integer */ -typedef unsigned PY_LONG_LONG SHA_INT64; /* 64-bit integer */ -#else -/* not defined. compilation will die. */ -#endif - -/* The SHA block size and message digest sizes, in bytes */ - -#define SHA_BLOCKSIZE 128 -#define SHA_DIGESTSIZE 64 - -/* The structure for storing SHA info */ - -typedef struct { - PyObject_HEAD - SHA_INT64 digest[8]; /* Message digest */ - SHA_INT32 count_lo, count_hi; /* 64-bit bit count */ - SHA_BYTE data[SHA_BLOCKSIZE]; /* SHA data buffer */ - int Endianness; - int local; /* unprocessed amount in data */ - int digestsize; -} SHAobject; - -/* When run on a little-endian CPU we need to perform byte reversal on an - array of longwords. */ - -static void longReverse(SHA_INT64 *buffer, int byteCount, int Endianness) -{ - SHA_INT64 value; - - if ( Endianness == PCT_BIG_ENDIAN ) - return; - - byteCount /= sizeof(*buffer); - while (byteCount--) { - value = *buffer; - - ((unsigned char*)buffer)[0] = (unsigned char)(value >> 56) & 0xff; - ((unsigned char*)buffer)[1] = (unsigned char)(value >> 48) & 0xff; - ((unsigned char*)buffer)[2] = (unsigned char)(value >> 40) & 0xff; - ((unsigned char*)buffer)[3] = (unsigned char)(value >> 32) & 0xff; - ((unsigned char*)buffer)[4] = (unsigned char)(value >> 24) & 0xff; - ((unsigned char*)buffer)[5] = (unsigned char)(value >> 16) & 0xff; - ((unsigned char*)buffer)[6] = (unsigned char)(value >> 8) & 0xff; - ((unsigned char*)buffer)[7] = (unsigned char)(value ) & 0xff; - - buffer++; - } -} - -static void SHAcopy(SHAobject *src, SHAobject *dest) -{ - dest->Endianness = src->Endianness; - dest->local = src->local; - dest->digestsize = src->digestsize; - dest->count_lo = src->count_lo; - dest->count_hi = src->count_hi; - memcpy(dest->digest, src->digest, sizeof(src->digest)); - memcpy(dest->data, src->data, sizeof(src->data)); -} - - -/* ------------------------------------------------------------------------ - * - * This code for the SHA-512 algorithm was noted as public domain. The - * original headers are pasted below. - * - * Several changes have been made to make it more compatible with the - * Python environment and desired interface. - * - */ - -/* LibTomCrypt, modular cryptographic library -- Tom St Denis - * - * LibTomCrypt is a library that provides various cryptographic - * algorithms in a highly modular and flexible manner. - * - * The library is free for all purposes without any express - * gurantee it works. - * - * Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org - */ - - -/* SHA512 by Tom St Denis */ - -/* Various logical functions */ -#define ROR64(x, y) \ - ( ((((x) & Py_ULL(0xFFFFFFFFFFFFFFFF))>>((unsigned PY_LONG_LONG)(y) & 63)) | \ - ((x)<<((unsigned PY_LONG_LONG)(64-((y) & 63))))) & Py_ULL(0xFFFFFFFFFFFFFFFF)) -#define Ch(x,y,z) (z ^ (x & (y ^ z))) -#define Maj(x,y,z) (((x | y) & z) | (x & y)) -#define S(x, n) ROR64((x),(n)) -#define R(x, n) (((x) & Py_ULL(0xFFFFFFFFFFFFFFFF)) >> ((unsigned PY_LONG_LONG)n)) -#define Sigma0(x) (S(x, 28) ^ S(x, 34) ^ S(x, 39)) -#define Sigma1(x) (S(x, 14) ^ S(x, 18) ^ S(x, 41)) -#define Gamma0(x) (S(x, 1) ^ S(x, 8) ^ R(x, 7)) -#define Gamma1(x) (S(x, 19) ^ S(x, 61) ^ R(x, 6)) - - -static void -sha512_transform(SHAobject *sha_info) -{ - int i; - SHA_INT64 S[8], W[80], t0, t1; - - memcpy(W, sha_info->data, sizeof(sha_info->data)); - longReverse(W, (int)sizeof(sha_info->data), sha_info->Endianness); - - for (i = 16; i < 80; ++i) { - W[i] = Gamma1(W[i - 2]) + W[i - 7] + Gamma0(W[i - 15]) + W[i - 16]; - } - for (i = 0; i < 8; ++i) { - S[i] = sha_info->digest[i]; - } - - /* Compress */ -#define RND(a,b,c,d,e,f,g,h,i,ki) \ - t0 = h + Sigma1(e) + Ch(e, f, g) + ki + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; - - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],0,Py_ULL(0x428a2f98d728ae22)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],1,Py_ULL(0x7137449123ef65cd)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],2,Py_ULL(0xb5c0fbcfec4d3b2f)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],3,Py_ULL(0xe9b5dba58189dbbc)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],4,Py_ULL(0x3956c25bf348b538)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],5,Py_ULL(0x59f111f1b605d019)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],6,Py_ULL(0x923f82a4af194f9b)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],7,Py_ULL(0xab1c5ed5da6d8118)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],8,Py_ULL(0xd807aa98a3030242)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],9,Py_ULL(0x12835b0145706fbe)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],10,Py_ULL(0x243185be4ee4b28c)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],11,Py_ULL(0x550c7dc3d5ffb4e2)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],12,Py_ULL(0x72be5d74f27b896f)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],13,Py_ULL(0x80deb1fe3b1696b1)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],14,Py_ULL(0x9bdc06a725c71235)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],15,Py_ULL(0xc19bf174cf692694)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],16,Py_ULL(0xe49b69c19ef14ad2)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],17,Py_ULL(0xefbe4786384f25e3)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],18,Py_ULL(0x0fc19dc68b8cd5b5)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],19,Py_ULL(0x240ca1cc77ac9c65)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],20,Py_ULL(0x2de92c6f592b0275)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],21,Py_ULL(0x4a7484aa6ea6e483)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],22,Py_ULL(0x5cb0a9dcbd41fbd4)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],23,Py_ULL(0x76f988da831153b5)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],24,Py_ULL(0x983e5152ee66dfab)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],25,Py_ULL(0xa831c66d2db43210)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],26,Py_ULL(0xb00327c898fb213f)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],27,Py_ULL(0xbf597fc7beef0ee4)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],28,Py_ULL(0xc6e00bf33da88fc2)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],29,Py_ULL(0xd5a79147930aa725)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],30,Py_ULL(0x06ca6351e003826f)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],31,Py_ULL(0x142929670a0e6e70)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],32,Py_ULL(0x27b70a8546d22ffc)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],33,Py_ULL(0x2e1b21385c26c926)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],34,Py_ULL(0x4d2c6dfc5ac42aed)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],35,Py_ULL(0x53380d139d95b3df)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],36,Py_ULL(0x650a73548baf63de)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],37,Py_ULL(0x766a0abb3c77b2a8)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],38,Py_ULL(0x81c2c92e47edaee6)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],39,Py_ULL(0x92722c851482353b)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],40,Py_ULL(0xa2bfe8a14cf10364)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],41,Py_ULL(0xa81a664bbc423001)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],42,Py_ULL(0xc24b8b70d0f89791)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],43,Py_ULL(0xc76c51a30654be30)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],44,Py_ULL(0xd192e819d6ef5218)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],45,Py_ULL(0xd69906245565a910)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],46,Py_ULL(0xf40e35855771202a)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],47,Py_ULL(0x106aa07032bbd1b8)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],48,Py_ULL(0x19a4c116b8d2d0c8)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],49,Py_ULL(0x1e376c085141ab53)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],50,Py_ULL(0x2748774cdf8eeb99)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],51,Py_ULL(0x34b0bcb5e19b48a8)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],52,Py_ULL(0x391c0cb3c5c95a63)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],53,Py_ULL(0x4ed8aa4ae3418acb)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],54,Py_ULL(0x5b9cca4f7763e373)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],55,Py_ULL(0x682e6ff3d6b2b8a3)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],56,Py_ULL(0x748f82ee5defb2fc)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],57,Py_ULL(0x78a5636f43172f60)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],58,Py_ULL(0x84c87814a1f0ab72)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],59,Py_ULL(0x8cc702081a6439ec)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],60,Py_ULL(0x90befffa23631e28)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],61,Py_ULL(0xa4506cebde82bde9)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],62,Py_ULL(0xbef9a3f7b2c67915)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],63,Py_ULL(0xc67178f2e372532b)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],64,Py_ULL(0xca273eceea26619c)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],65,Py_ULL(0xd186b8c721c0c207)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],66,Py_ULL(0xeada7dd6cde0eb1e)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],67,Py_ULL(0xf57d4f7fee6ed178)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],68,Py_ULL(0x06f067aa72176fba)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],69,Py_ULL(0x0a637dc5a2c898a6)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],70,Py_ULL(0x113f9804bef90dae)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],71,Py_ULL(0x1b710b35131c471b)); - RND(S[0],S[1],S[2],S[3],S[4],S[5],S[6],S[7],72,Py_ULL(0x28db77f523047d84)); - RND(S[7],S[0],S[1],S[2],S[3],S[4],S[5],S[6],73,Py_ULL(0x32caab7b40c72493)); - RND(S[6],S[7],S[0],S[1],S[2],S[3],S[4],S[5],74,Py_ULL(0x3c9ebe0a15c9bebc)); - RND(S[5],S[6],S[7],S[0],S[1],S[2],S[3],S[4],75,Py_ULL(0x431d67c49c100d4c)); - RND(S[4],S[5],S[6],S[7],S[0],S[1],S[2],S[3],76,Py_ULL(0x4cc5d4becb3e42b6)); - RND(S[3],S[4],S[5],S[6],S[7],S[0],S[1],S[2],77,Py_ULL(0x597f299cfc657e2a)); - RND(S[2],S[3],S[4],S[5],S[6],S[7],S[0],S[1],78,Py_ULL(0x5fcb6fab3ad6faec)); - RND(S[1],S[2],S[3],S[4],S[5],S[6],S[7],S[0],79,Py_ULL(0x6c44198c4a475817)); - -#undef RND - - /* feedback */ - for (i = 0; i < 8; i++) { - sha_info->digest[i] = sha_info->digest[i] + S[i]; - } - -} - - - -/* initialize the SHA digest */ - -static void -sha512_init(SHAobject *sha_info) -{ - TestEndianness(sha_info->Endianness) - sha_info->digest[0] = Py_ULL(0x6a09e667f3bcc908); - sha_info->digest[1] = Py_ULL(0xbb67ae8584caa73b); - sha_info->digest[2] = Py_ULL(0x3c6ef372fe94f82b); - sha_info->digest[3] = Py_ULL(0xa54ff53a5f1d36f1); - sha_info->digest[4] = Py_ULL(0x510e527fade682d1); - sha_info->digest[5] = Py_ULL(0x9b05688c2b3e6c1f); - sha_info->digest[6] = Py_ULL(0x1f83d9abfb41bd6b); - sha_info->digest[7] = Py_ULL(0x5be0cd19137e2179); - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; - sha_info->digestsize = 64; -} - -static void -sha384_init(SHAobject *sha_info) -{ - TestEndianness(sha_info->Endianness) - sha_info->digest[0] = Py_ULL(0xcbbb9d5dc1059ed8); - sha_info->digest[1] = Py_ULL(0x629a292a367cd507); - sha_info->digest[2] = Py_ULL(0x9159015a3070dd17); - sha_info->digest[3] = Py_ULL(0x152fecd8f70e5939); - sha_info->digest[4] = Py_ULL(0x67332667ffc00b31); - sha_info->digest[5] = Py_ULL(0x8eb44a8768581511); - sha_info->digest[6] = Py_ULL(0xdb0c2e0d64f98fa7); - sha_info->digest[7] = Py_ULL(0x47b5481dbefa4fa4); - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; - sha_info->digestsize = 48; -} - - -/* update the SHA digest */ - -static void -sha512_update(SHAobject *sha_info, SHA_BYTE *buffer, int count) -{ - int i; - SHA_INT32 clo; - - clo = sha_info->count_lo + ((SHA_INT32) count << 3); - if (clo < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo = clo; - sha_info->count_hi += (SHA_INT32) count >> 29; - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - sha512_transform(sha_info); - } - else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - sha512_transform(sha_info); - } - memcpy(sha_info->data, buffer, count); - sha_info->local = count; -} - -/* finish computing the SHA digest */ - -static void -sha512_final(unsigned char digest[SHA_DIGESTSIZE], SHAobject *sha_info) -{ - int count; - SHA_INT32 lo_bit_count, hi_bit_count; - - lo_bit_count = sha_info->count_lo; - hi_bit_count = sha_info->count_hi; - count = (int) ((lo_bit_count >> 3) & 0x7f); - ((SHA_BYTE *) sha_info->data)[count++] = 0x80; - if (count > SHA_BLOCKSIZE - 16) { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - count); - sha512_transform(sha_info); - memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 16); - } - else { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - 16 - count); - } - - /* GJS: note that we add the hi/lo in big-endian. sha512_transform will - swap these values into host-order. */ - sha_info->data[112] = 0; - sha_info->data[113] = 0; - sha_info->data[114] = 0; - sha_info->data[115] = 0; - sha_info->data[116] = 0; - sha_info->data[117] = 0; - sha_info->data[118] = 0; - sha_info->data[119] = 0; - sha_info->data[120] = (hi_bit_count >> 24) & 0xff; - sha_info->data[121] = (hi_bit_count >> 16) & 0xff; - sha_info->data[122] = (hi_bit_count >> 8) & 0xff; - sha_info->data[123] = (hi_bit_count >> 0) & 0xff; - sha_info->data[124] = (lo_bit_count >> 24) & 0xff; - sha_info->data[125] = (lo_bit_count >> 16) & 0xff; - sha_info->data[126] = (lo_bit_count >> 8) & 0xff; - sha_info->data[127] = (lo_bit_count >> 0) & 0xff; - sha512_transform(sha_info); - digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 56) & 0xff); - digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 48) & 0xff); - digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 40) & 0xff); - digest[ 3] = (unsigned char) ((sha_info->digest[0] >> 32) & 0xff); - digest[ 4] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); - digest[ 5] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); - digest[ 6] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); - digest[ 7] = (unsigned char) ((sha_info->digest[0] ) & 0xff); - digest[ 8] = (unsigned char) ((sha_info->digest[1] >> 56) & 0xff); - digest[ 9] = (unsigned char) ((sha_info->digest[1] >> 48) & 0xff); - digest[10] = (unsigned char) ((sha_info->digest[1] >> 40) & 0xff); - digest[11] = (unsigned char) ((sha_info->digest[1] >> 32) & 0xff); - digest[12] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); - digest[13] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); - digest[14] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); - digest[15] = (unsigned char) ((sha_info->digest[1] ) & 0xff); - digest[16] = (unsigned char) ((sha_info->digest[2] >> 56) & 0xff); - digest[17] = (unsigned char) ((sha_info->digest[2] >> 48) & 0xff); - digest[18] = (unsigned char) ((sha_info->digest[2] >> 40) & 0xff); - digest[19] = (unsigned char) ((sha_info->digest[2] >> 32) & 0xff); - digest[20] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); - digest[21] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); - digest[22] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); - digest[23] = (unsigned char) ((sha_info->digest[2] ) & 0xff); - digest[24] = (unsigned char) ((sha_info->digest[3] >> 56) & 0xff); - digest[25] = (unsigned char) ((sha_info->digest[3] >> 48) & 0xff); - digest[26] = (unsigned char) ((sha_info->digest[3] >> 40) & 0xff); - digest[27] = (unsigned char) ((sha_info->digest[3] >> 32) & 0xff); - digest[28] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); - digest[29] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); - digest[30] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); - digest[31] = (unsigned char) ((sha_info->digest[3] ) & 0xff); - digest[32] = (unsigned char) ((sha_info->digest[4] >> 56) & 0xff); - digest[33] = (unsigned char) ((sha_info->digest[4] >> 48) & 0xff); - digest[34] = (unsigned char) ((sha_info->digest[4] >> 40) & 0xff); - digest[35] = (unsigned char) ((sha_info->digest[4] >> 32) & 0xff); - digest[36] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); - digest[37] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); - digest[38] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); - digest[39] = (unsigned char) ((sha_info->digest[4] ) & 0xff); - digest[40] = (unsigned char) ((sha_info->digest[5] >> 56) & 0xff); - digest[41] = (unsigned char) ((sha_info->digest[5] >> 48) & 0xff); - digest[42] = (unsigned char) ((sha_info->digest[5] >> 40) & 0xff); - digest[43] = (unsigned char) ((sha_info->digest[5] >> 32) & 0xff); - digest[44] = (unsigned char) ((sha_info->digest[5] >> 24) & 0xff); - digest[45] = (unsigned char) ((sha_info->digest[5] >> 16) & 0xff); - digest[46] = (unsigned char) ((sha_info->digest[5] >> 8) & 0xff); - digest[47] = (unsigned char) ((sha_info->digest[5] ) & 0xff); - digest[48] = (unsigned char) ((sha_info->digest[6] >> 56) & 0xff); - digest[49] = (unsigned char) ((sha_info->digest[6] >> 48) & 0xff); - digest[50] = (unsigned char) ((sha_info->digest[6] >> 40) & 0xff); - digest[51] = (unsigned char) ((sha_info->digest[6] >> 32) & 0xff); - digest[52] = (unsigned char) ((sha_info->digest[6] >> 24) & 0xff); - digest[53] = (unsigned char) ((sha_info->digest[6] >> 16) & 0xff); - digest[54] = (unsigned char) ((sha_info->digest[6] >> 8) & 0xff); - digest[55] = (unsigned char) ((sha_info->digest[6] ) & 0xff); - digest[56] = (unsigned char) ((sha_info->digest[7] >> 56) & 0xff); - digest[57] = (unsigned char) ((sha_info->digest[7] >> 48) & 0xff); - digest[58] = (unsigned char) ((sha_info->digest[7] >> 40) & 0xff); - digest[59] = (unsigned char) ((sha_info->digest[7] >> 32) & 0xff); - digest[60] = (unsigned char) ((sha_info->digest[7] >> 24) & 0xff); - digest[61] = (unsigned char) ((sha_info->digest[7] >> 16) & 0xff); - digest[62] = (unsigned char) ((sha_info->digest[7] >> 8) & 0xff); - digest[63] = (unsigned char) ((sha_info->digest[7] ) & 0xff); -} - -/* - * End of copied SHA code. - * - * ------------------------------------------------------------------------ - */ - -static PyTypeObject SHA384type; -static PyTypeObject SHA512type; - - -static SHAobject * -newSHA384object(void) -{ - return (SHAobject *)PyObject_New(SHAobject, &SHA384type); -} - -static SHAobject * -newSHA512object(void) -{ - return (SHAobject *)PyObject_New(SHAobject, &SHA512type); -} - -/* Internal methods for a hash object */ - -static void -SHA512_dealloc(PyObject *ptr) -{ - PyObject_Del(ptr); -} - - -/* External methods for a hash object */ - -PyDoc_STRVAR(SHA512_copy__doc__, "Return a copy of the hash object."); - -static PyObject * -SHA512_copy(SHAobject *self, PyObject *unused) -{ - SHAobject *newobj; - - if (((PyObject*)self)->ob_type == &SHA512type) { - if ( (newobj = newSHA512object())==NULL) - return NULL; - } else { - if ( (newobj = newSHA384object())==NULL) - return NULL; - } - - SHAcopy(self, newobj); - return (PyObject *)newobj; -} - -PyDoc_STRVAR(SHA512_digest__doc__, -"Return the digest value as a string of binary data."); - -static PyObject * -SHA512_digest(SHAobject *self, PyObject *unused) -{ - unsigned char digest[SHA_DIGESTSIZE]; - SHAobject temp; - - SHAcopy(self, &temp); - sha512_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, self->digestsize); -} - -PyDoc_STRVAR(SHA512_hexdigest__doc__, -"Return the digest value as a string of hexadecimal digits."); - -static PyObject * -SHA512_hexdigest(SHAobject *self, PyObject *unused) -{ - unsigned char digest[SHA_DIGESTSIZE]; - SHAobject temp; - PyObject *retval; - char *hex_digest; - int i, j; - - /* Get the raw (binary) digest value */ - SHAcopy(self, &temp); - sha512_final(digest, &temp); - - /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, self->digestsize * 2); - if (!retval) - return NULL; - hex_digest = PyString_AsString(retval); - if (!hex_digest) { - Py_DECREF(retval); - return NULL; - } - - /* Make hex version of the digest */ - for (i=j=0; idigestsize; i++) { - char c; - c = (digest[i] >> 4) & 0xf; - c = (c>9) ? c+'a'-10 : c + '0'; - hex_digest[j++] = c; - c = (digest[i] & 0xf); - c = (c>9) ? c+'a'-10 : c + '0'; - hex_digest[j++] = c; - } - return retval; -} - -PyDoc_STRVAR(SHA512_update__doc__, -"Update this hash object's state with the provided string."); - -static PyObject * -SHA512_update(SHAobject *self, PyObject *args) -{ - Py_buffer buf; - - if (!PyArg_ParseTuple(args, "s*:update", &buf)) - return NULL; - - sha512_update(self, buf.buf, buf.len); - - PyBuffer_Release(&buf); - Py_RETURN_NONE; -} - -static PyMethodDef SHA_methods[] = { - {"copy", (PyCFunction)SHA512_copy, METH_NOARGS, SHA512_copy__doc__}, - {"digest", (PyCFunction)SHA512_digest, METH_NOARGS, SHA512_digest__doc__}, - {"hexdigest", (PyCFunction)SHA512_hexdigest, METH_NOARGS, SHA512_hexdigest__doc__}, - {"update", (PyCFunction)SHA512_update, METH_VARARGS, SHA512_update__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -SHA512_get_block_size(PyObject *self, void *closure) -{ - return PyInt_FromLong(SHA_BLOCKSIZE); -} - -static PyObject * -SHA512_get_name(PyObject *self, void *closure) -{ - if (((SHAobject *)self)->digestsize == 64) - return PyString_FromStringAndSize("SHA512", 6); - else - return PyString_FromStringAndSize("SHA384", 6); -} - -static PyGetSetDef SHA_getseters[] = { - {"block_size", - (getter)SHA512_get_block_size, NULL, - NULL, - NULL}, - {"name", - (getter)SHA512_get_name, NULL, - NULL, - NULL}, - {NULL} /* Sentinel */ -}; - -static PyMemberDef SHA_members[] = { - {"digest_size", T_INT, offsetof(SHAobject, digestsize), READONLY, NULL}, - /* the old md5 and sha modules support 'digest_size' as in PEP 247. - * the old sha module also supported 'digestsize'. ugh. */ - {"digestsize", T_INT, offsetof(SHAobject, digestsize), READONLY, NULL}, - {NULL} /* Sentinel */ -}; - -static PyTypeObject SHA384type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_sha512.sha384", /*tp_name*/ - sizeof(SHAobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - SHA512_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - SHA_methods, /* tp_methods */ - SHA_members, /* tp_members */ - SHA_getseters, /* tp_getset */ -}; - -static PyTypeObject SHA512type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_sha512.sha512", /*tp_name*/ - sizeof(SHAobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - SHA512_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - SHA_methods, /* tp_methods */ - SHA_members, /* tp_members */ - SHA_getseters, /* tp_getset */ -}; - - -/* The single module-level function: new() */ - -PyDoc_STRVAR(SHA512_new__doc__, -"Return a new SHA-512 hash object; optionally initialized with a string."); - -static PyObject * -SHA512_new(PyObject *self, PyObject *args, PyObject *kwdict) -{ - static char *kwlist[] = {"string", NULL}; - SHAobject *new; - Py_buffer buf = { 0 }; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist, - &buf)) { - return NULL; - } - - if ((new = newSHA512object()) == NULL) { - PyBuffer_Release(&buf); - return NULL; - } - - sha512_init(new); - - if (PyErr_Occurred()) { - Py_DECREF(new); - PyBuffer_Release(&buf); - return NULL; - } - if (buf.len > 0) { - sha512_update(new, buf.buf, buf.len); - } - PyBuffer_Release(&buf); - - return (PyObject *)new; -} - -PyDoc_STRVAR(SHA384_new__doc__, -"Return a new SHA-384 hash object; optionally initialized with a string."); - -static PyObject * -SHA384_new(PyObject *self, PyObject *args, PyObject *kwdict) -{ - static char *kwlist[] = {"string", NULL}; - SHAobject *new; - Py_buffer buf = { 0 }; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist, - &buf)) { - return NULL; - } - - if ((new = newSHA384object()) == NULL) { - PyBuffer_Release(&buf); - return NULL; - } - - sha384_init(new); - - if (PyErr_Occurred()) { - Py_DECREF(new); - PyBuffer_Release(&buf); - return NULL; - } - if (buf.len > 0) { - sha512_update(new, buf.buf, buf.len); - } - PyBuffer_Release(&buf); - - return (PyObject *)new; -} - - -/* List of functions exported by this module */ - -static struct PyMethodDef SHA_functions[] = { - {"sha512", (PyCFunction)SHA512_new, METH_VARARGS|METH_KEYWORDS, SHA512_new__doc__}, - {"sha384", (PyCFunction)SHA384_new, METH_VARARGS|METH_KEYWORDS, SHA384_new__doc__}, - {NULL, NULL} /* Sentinel */ -}; - - -/* Initialize this module. */ - -#define insint(n,v) { PyModule_AddIntConstant(m,n,v); } - -PyMODINIT_FUNC -init_sha512(void) -{ - PyObject *m; - - Py_TYPE(&SHA384type) = &PyType_Type; - if (PyType_Ready(&SHA384type) < 0) - return; - Py_TYPE(&SHA512type) = &PyType_Type; - if (PyType_Ready(&SHA512type) < 0) - return; - m = Py_InitModule("_sha512", SHA_functions); - if (m == NULL) - return; -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/shamodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/shamodule.c deleted file mode 100644 index f634b5b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/shamodule.c +++ /dev/null @@ -1,623 +0,0 @@ -/* SHA module */ - -/* This module provides an interface to NIST's Secure Hash Algorithm */ - -/* See below for information about the original code this module was - based upon. Additional work performed by: - - Andrew Kuchling (amk@amk.ca) - Greg Stein (gstein@lyra.org) - - Copyright (C) 2005 Gregory P. Smith (greg@krypto.org) - Licensed to PSF under a Contributor Agreement. - -*/ - -/* SHA objects */ - -#include "Python.h" -#include "structmember.h" - - -/* Endianness testing and definitions */ -#define TestEndianness(variable) {int i=1; variable=PCT_BIG_ENDIAN;\ - if (*((char*)&i)==1) variable=PCT_LITTLE_ENDIAN;} - -#define PCT_LITTLE_ENDIAN 1 -#define PCT_BIG_ENDIAN 0 - -/* Some useful types */ - -typedef unsigned char SHA_BYTE; - -#if SIZEOF_INT == 4 -typedef unsigned int SHA_INT32; /* 32-bit integer */ -#else -/* not defined. compilation will die. */ -#endif - -/* The SHA block size and message digest sizes, in bytes */ - -#define SHA_BLOCKSIZE 64 -#define SHA_DIGESTSIZE 20 - -/* The structure for storing SHS info */ - -typedef struct { - PyObject_HEAD - SHA_INT32 digest[5]; /* Message digest */ - SHA_INT32 count_lo, count_hi; /* 64-bit bit count */ - SHA_BYTE data[SHA_BLOCKSIZE]; /* SHA data buffer */ - int Endianness; - int local; /* unprocessed amount in data */ -} SHAobject; - -/* When run on a little-endian CPU we need to perform byte reversal on an - array of longwords. */ - -static void longReverse(SHA_INT32 *buffer, int byteCount, int Endianness) -{ - SHA_INT32 value; - - if ( Endianness == PCT_BIG_ENDIAN ) - return; - - byteCount /= sizeof(*buffer); - while (byteCount--) { - value = *buffer; - value = ( ( value & 0xFF00FF00L ) >> 8 ) | \ - ( ( value & 0x00FF00FFL ) << 8 ); - *buffer++ = ( value << 16 ) | ( value >> 16 ); - } -} - -static void SHAcopy(SHAobject *src, SHAobject *dest) -{ - dest->Endianness = src->Endianness; - dest->local = src->local; - dest->count_lo = src->count_lo; - dest->count_hi = src->count_hi; - memcpy(dest->digest, src->digest, sizeof(src->digest)); - memcpy(dest->data, src->data, sizeof(src->data)); -} - - -/* ------------------------------------------------------------------------ - * - * This code for the SHA algorithm was noted as public domain. The original - * headers are pasted below. - * - * Several changes have been made to make it more compatible with the - * Python environment and desired interface. - * - */ - -/* NIST Secure Hash Algorithm */ -/* heavily modified by Uwe Hollerbach */ -/* from Peter C. Gutmann's implementation as found in */ -/* Applied Cryptography by Bruce Schneier */ -/* Further modifications to include the "UNRAVEL" stuff, below */ - -/* This code is in the public domain */ - -/* UNRAVEL should be fastest & biggest */ -/* UNROLL_LOOPS should be just as big, but slightly slower */ -/* both undefined should be smallest and slowest */ - -#define UNRAVEL -/* #define UNROLL_LOOPS */ - -/* The SHA f()-functions. The f1 and f3 functions can be optimized to - save one boolean operation each - thanks to Rich Schroeppel, - rcs@cs.arizona.edu for discovering this */ - -/*#define f1(x,y,z) ((x & y) | (~x & z)) // Rounds 0-19 */ -#define f1(x,y,z) (z ^ (x & (y ^ z))) /* Rounds 0-19 */ -#define f2(x,y,z) (x ^ y ^ z) /* Rounds 20-39 */ -/*#define f3(x,y,z) ((x & y) | (x & z) | (y & z)) // Rounds 40-59 */ -#define f3(x,y,z) ((x & y) | (z & (x | y))) /* Rounds 40-59 */ -#define f4(x,y,z) (x ^ y ^ z) /* Rounds 60-79 */ - -/* SHA constants */ - -#define CONST1 0x5a827999L /* Rounds 0-19 */ -#define CONST2 0x6ed9eba1L /* Rounds 20-39 */ -#define CONST3 0x8f1bbcdcL /* Rounds 40-59 */ -#define CONST4 0xca62c1d6L /* Rounds 60-79 */ - -/* 32-bit rotate */ - -#define R32(x,n) ((x << n) | (x >> (32 - n))) - -/* the generic case, for when the overall rotation is not unraveled */ - -#define FG(n) \ - T = R32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n; \ - E = D; D = C; C = R32(B,30); B = A; A = T - -/* specific cases, for when the overall rotation is unraveled */ - -#define FA(n) \ - T = R32(A,5) + f##n(B,C,D) + E + *WP++ + CONST##n; B = R32(B,30) - -#define FB(n) \ - E = R32(T,5) + f##n(A,B,C) + D + *WP++ + CONST##n; A = R32(A,30) - -#define FC(n) \ - D = R32(E,5) + f##n(T,A,B) + C + *WP++ + CONST##n; T = R32(T,30) - -#define FD(n) \ - C = R32(D,5) + f##n(E,T,A) + B + *WP++ + CONST##n; E = R32(E,30) - -#define FE(n) \ - B = R32(C,5) + f##n(D,E,T) + A + *WP++ + CONST##n; D = R32(D,30) - -#define FT(n) \ - A = R32(B,5) + f##n(C,D,E) + T + *WP++ + CONST##n; C = R32(C,30) - -/* do SHA transformation */ - -static void -sha_transform(SHAobject *sha_info) -{ - int i; - SHA_INT32 T, A, B, C, D, E, W[80], *WP; - - memcpy(W, sha_info->data, sizeof(sha_info->data)); - longReverse(W, (int)sizeof(sha_info->data), sha_info->Endianness); - - for (i = 16; i < 80; ++i) { - W[i] = W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16]; - - /* extra rotation fix */ - W[i] = R32(W[i], 1); - } - A = sha_info->digest[0]; - B = sha_info->digest[1]; - C = sha_info->digest[2]; - D = sha_info->digest[3]; - E = sha_info->digest[4]; - WP = W; -#ifdef UNRAVEL - FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); FC(1); FD(1); - FE(1); FT(1); FA(1); FB(1); FC(1); FD(1); FE(1); FT(1); FA(1); FB(1); - FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); FE(2); FT(2); - FA(2); FB(2); FC(2); FD(2); FE(2); FT(2); FA(2); FB(2); FC(2); FD(2); - FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); FA(3); FB(3); - FC(3); FD(3); FE(3); FT(3); FA(3); FB(3); FC(3); FD(3); FE(3); FT(3); - FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); FC(4); FD(4); - FE(4); FT(4); FA(4); FB(4); FC(4); FD(4); FE(4); FT(4); FA(4); FB(4); - sha_info->digest[0] += E; - sha_info->digest[1] += T; - sha_info->digest[2] += A; - sha_info->digest[3] += B; - sha_info->digest[4] += C; -#else /* !UNRAVEL */ -#ifdef UNROLL_LOOPS - FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); - FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); FG(1); - FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); - FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); FG(2); - FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); - FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); FG(3); - FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); - FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); FG(4); -#else /* !UNROLL_LOOPS */ - for (i = 0; i < 20; ++i) { FG(1); } - for (i = 20; i < 40; ++i) { FG(2); } - for (i = 40; i < 60; ++i) { FG(3); } - for (i = 60; i < 80; ++i) { FG(4); } -#endif /* !UNROLL_LOOPS */ - sha_info->digest[0] += A; - sha_info->digest[1] += B; - sha_info->digest[2] += C; - sha_info->digest[3] += D; - sha_info->digest[4] += E; -#endif /* !UNRAVEL */ -} - -/* initialize the SHA digest */ - -static void -sha_init(SHAobject *sha_info) -{ - TestEndianness(sha_info->Endianness) - - sha_info->digest[0] = 0x67452301L; - sha_info->digest[1] = 0xefcdab89L; - sha_info->digest[2] = 0x98badcfeL; - sha_info->digest[3] = 0x10325476L; - sha_info->digest[4] = 0xc3d2e1f0L; - sha_info->count_lo = 0L; - sha_info->count_hi = 0L; - sha_info->local = 0; -} - -/* update the SHA digest */ - -static void -sha_update(SHAobject *sha_info, SHA_BYTE *buffer, unsigned int count) -{ - unsigned int i; - SHA_INT32 clo; - - clo = sha_info->count_lo + ((SHA_INT32) count << 3); - if (clo < sha_info->count_lo) { - ++sha_info->count_hi; - } - sha_info->count_lo = clo; - sha_info->count_hi += (SHA_INT32) count >> 29; - if (sha_info->local) { - i = SHA_BLOCKSIZE - sha_info->local; - if (i > count) { - i = count; - } - memcpy(((SHA_BYTE *) sha_info->data) + sha_info->local, buffer, i); - count -= i; - buffer += i; - sha_info->local += i; - if (sha_info->local == SHA_BLOCKSIZE) { - sha_transform(sha_info); - } - else { - return; - } - } - while (count >= SHA_BLOCKSIZE) { - memcpy(sha_info->data, buffer, SHA_BLOCKSIZE); - buffer += SHA_BLOCKSIZE; - count -= SHA_BLOCKSIZE; - sha_transform(sha_info); - } - memcpy(sha_info->data, buffer, count); - sha_info->local = count; -} - -/* finish computing the SHA digest */ - -static void -sha_final(unsigned char digest[20], SHAobject *sha_info) -{ - int count; - SHA_INT32 lo_bit_count, hi_bit_count; - - lo_bit_count = sha_info->count_lo; - hi_bit_count = sha_info->count_hi; - count = (int) ((lo_bit_count >> 3) & 0x3f); - ((SHA_BYTE *) sha_info->data)[count++] = 0x80; - if (count > SHA_BLOCKSIZE - 8) { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - count); - sha_transform(sha_info); - memset((SHA_BYTE *) sha_info->data, 0, SHA_BLOCKSIZE - 8); - } - else { - memset(((SHA_BYTE *) sha_info->data) + count, 0, - SHA_BLOCKSIZE - 8 - count); - } - - /* GJS: note that we add the hi/lo in big-endian. sha_transform will - swap these values into host-order. */ - sha_info->data[56] = (hi_bit_count >> 24) & 0xff; - sha_info->data[57] = (hi_bit_count >> 16) & 0xff; - sha_info->data[58] = (hi_bit_count >> 8) & 0xff; - sha_info->data[59] = (hi_bit_count >> 0) & 0xff; - sha_info->data[60] = (lo_bit_count >> 24) & 0xff; - sha_info->data[61] = (lo_bit_count >> 16) & 0xff; - sha_info->data[62] = (lo_bit_count >> 8) & 0xff; - sha_info->data[63] = (lo_bit_count >> 0) & 0xff; - sha_transform(sha_info); - digest[ 0] = (unsigned char) ((sha_info->digest[0] >> 24) & 0xff); - digest[ 1] = (unsigned char) ((sha_info->digest[0] >> 16) & 0xff); - digest[ 2] = (unsigned char) ((sha_info->digest[0] >> 8) & 0xff); - digest[ 3] = (unsigned char) ((sha_info->digest[0] ) & 0xff); - digest[ 4] = (unsigned char) ((sha_info->digest[1] >> 24) & 0xff); - digest[ 5] = (unsigned char) ((sha_info->digest[1] >> 16) & 0xff); - digest[ 6] = (unsigned char) ((sha_info->digest[1] >> 8) & 0xff); - digest[ 7] = (unsigned char) ((sha_info->digest[1] ) & 0xff); - digest[ 8] = (unsigned char) ((sha_info->digest[2] >> 24) & 0xff); - digest[ 9] = (unsigned char) ((sha_info->digest[2] >> 16) & 0xff); - digest[10] = (unsigned char) ((sha_info->digest[2] >> 8) & 0xff); - digest[11] = (unsigned char) ((sha_info->digest[2] ) & 0xff); - digest[12] = (unsigned char) ((sha_info->digest[3] >> 24) & 0xff); - digest[13] = (unsigned char) ((sha_info->digest[3] >> 16) & 0xff); - digest[14] = (unsigned char) ((sha_info->digest[3] >> 8) & 0xff); - digest[15] = (unsigned char) ((sha_info->digest[3] ) & 0xff); - digest[16] = (unsigned char) ((sha_info->digest[4] >> 24) & 0xff); - digest[17] = (unsigned char) ((sha_info->digest[4] >> 16) & 0xff); - digest[18] = (unsigned char) ((sha_info->digest[4] >> 8) & 0xff); - digest[19] = (unsigned char) ((sha_info->digest[4] ) & 0xff); -} - -/* - * End of copied SHA code. - * - * ------------------------------------------------------------------------ - */ - -static PyTypeObject SHAtype; - - -static SHAobject * -newSHAobject(void) -{ - return (SHAobject *)PyObject_New(SHAobject, &SHAtype); -} - -/* Internal methods for a hashing object */ - -static void -SHA_dealloc(PyObject *ptr) -{ - PyObject_Del(ptr); -} - - -/* External methods for a hashing object */ - -PyDoc_STRVAR(SHA_copy__doc__, "Return a copy of the hashing object."); - -static PyObject * -SHA_copy(SHAobject *self, PyObject *unused) -{ - SHAobject *newobj; - - if ( (newobj = newSHAobject())==NULL) - return NULL; - - SHAcopy(self, newobj); - return (PyObject *)newobj; -} - -PyDoc_STRVAR(SHA_digest__doc__, -"Return the digest value as a string of binary data."); - -static PyObject * -SHA_digest(SHAobject *self, PyObject *unused) -{ - unsigned char digest[SHA_DIGESTSIZE]; - SHAobject temp; - - SHAcopy(self, &temp); - sha_final(digest, &temp); - return PyString_FromStringAndSize((const char *)digest, sizeof(digest)); -} - -PyDoc_STRVAR(SHA_hexdigest__doc__, -"Return the digest value as a string of hexadecimal digits."); - -static PyObject * -SHA_hexdigest(SHAobject *self, PyObject *unused) -{ - unsigned char digest[SHA_DIGESTSIZE]; - SHAobject temp; - PyObject *retval; - char *hex_digest; - int i, j; - - /* Get the raw (binary) digest value */ - SHAcopy(self, &temp); - sha_final(digest, &temp); - - /* Create a new string */ - retval = PyString_FromStringAndSize(NULL, sizeof(digest) * 2); - if (!retval) - return NULL; - hex_digest = PyString_AsString(retval); - if (!hex_digest) { - Py_DECREF(retval); - return NULL; - } - - /* Make hex version of the digest */ - for(i=j=0; i> 4) & 0xf; - c = (c>9) ? c+'a'-10 : c + '0'; - hex_digest[j++] = c; - c = (digest[i] & 0xf); - c = (c>9) ? c+'a'-10 : c + '0'; - hex_digest[j++] = c; - } - return retval; -} - -PyDoc_STRVAR(SHA_update__doc__, -"Update this hashing object's state with the provided string."); - -static PyObject * -SHA_update(SHAobject *self, PyObject *args) -{ - Py_buffer view; - Py_ssize_t n; - unsigned char *buf; - - if (!PyArg_ParseTuple(args, "s*:update", &view)) - return NULL; - - n = view.len; - buf = (unsigned char *) view.buf; - while (n > 0) { - Py_ssize_t nbytes; - if (n > INT_MAX) - nbytes = INT_MAX; - else - nbytes = n; - sha_update(self, buf, - Py_SAFE_DOWNCAST(nbytes, Py_ssize_t, unsigned int)); - buf += nbytes; - n -= nbytes; - } - - PyBuffer_Release(&view); - Py_RETURN_NONE; -} - -static PyMethodDef SHA_methods[] = { - {"copy", (PyCFunction)SHA_copy, METH_NOARGS, SHA_copy__doc__}, - {"digest", (PyCFunction)SHA_digest, METH_NOARGS, SHA_digest__doc__}, - {"hexdigest", (PyCFunction)SHA_hexdigest, METH_NOARGS, SHA_hexdigest__doc__}, - {"update", (PyCFunction)SHA_update, METH_VARARGS, SHA_update__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -SHA_get_block_size(PyObject *self, void *closure) -{ - return PyInt_FromLong(SHA_BLOCKSIZE); -} - -static PyObject * -SHA_get_digest_size(PyObject *self, void *closure) -{ - return PyInt_FromLong(SHA_DIGESTSIZE); -} - -static PyObject * -SHA_get_name(PyObject *self, void *closure) -{ - return PyString_FromStringAndSize("SHA1", 4); -} - -static PyGetSetDef SHA_getseters[] = { - {"digest_size", - (getter)SHA_get_digest_size, NULL, - NULL, - NULL}, - {"block_size", - (getter)SHA_get_block_size, NULL, - NULL, - NULL}, - {"name", - (getter)SHA_get_name, NULL, - NULL, - NULL}, - /* the old md5 and sha modules support 'digest_size' as in PEP 247. - * the old sha module also supported 'digestsize'. ugh. */ - {"digestsize", - (getter)SHA_get_digest_size, NULL, - NULL, - NULL}, - {NULL} /* Sentinel */ -}; - -static PyTypeObject SHAtype = { - PyVarObject_HEAD_INIT(NULL, 0) - "_sha.sha", /*tp_name*/ - sizeof(SHAobject), /*tp_size*/ - 0, /*tp_itemsize*/ - /* methods */ - SHA_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - SHA_methods, /* tp_methods */ - 0, /* tp_members */ - SHA_getseters, /* tp_getset */ -}; - - -/* The single module-level function: new() */ - -PyDoc_STRVAR(SHA_new__doc__, -"Return a new SHA hashing object. An optional string argument\n\ -may be provided; if present, this string will be automatically\n\ -hashed."); - -static PyObject * -SHA_new(PyObject *self, PyObject *args, PyObject *kwdict) -{ - static char *kwlist[] = {"string", NULL}; - SHAobject *new; - Py_buffer view = { 0 }; - Py_ssize_t n; - unsigned char *buf; - - if (!PyArg_ParseTupleAndKeywords(args, kwdict, "|s*:new", kwlist, - &view)) { - return NULL; - } - - if ((new = newSHAobject()) == NULL) { - PyBuffer_Release(&view); - return NULL; - } - - sha_init(new); - - if (PyErr_Occurred()) { - Py_DECREF(new); - PyBuffer_Release(&view); - return NULL; - } - - n = view.len; - buf = (unsigned char *) view.buf; - while (n > 0) { - Py_ssize_t nbytes; - if (n > INT_MAX) - nbytes = INT_MAX; - else - nbytes = n; - sha_update(new, buf, - Py_SAFE_DOWNCAST(nbytes, Py_ssize_t, unsigned int)); - buf += nbytes; - n -= nbytes; - } - - PyBuffer_Release(&view); - - return (PyObject *)new; -} - - -/* List of functions exported by this module */ - -static struct PyMethodDef SHA_functions[] = { - {"new", (PyCFunction)SHA_new, METH_VARARGS|METH_KEYWORDS, SHA_new__doc__}, - {NULL, NULL} /* Sentinel */ -}; - - -/* Initialize this module. */ - -#define insint(n,v) { PyModule_AddIntConstant(m,n,v); } - -PyMODINIT_FUNC -init_sha(void) -{ - PyObject *m; - - Py_TYPE(&SHAtype) = &PyType_Type; - if (PyType_Ready(&SHAtype) < 0) - return; - m = Py_InitModule("_sha", SHA_functions); - if (m == NULL) - return; - - /* Add some symbolic constants to the module */ - insint("blocksize", 1); /* For future use, in case some hash - functions require an integral number of - blocks */ - insint("digestsize", 20); - insint("digest_size", 20); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/signalmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/signalmodule.c deleted file mode 100644 index d7beb80..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/signalmodule.c +++ /dev/null @@ -1,1011 +0,0 @@ - -/* Signal module -- many thanks to Lance Ellinghaus */ - -/* XXX Signals should be recorded per thread, now we have thread state. */ - -#include "Python.h" -#include "intrcheck.h" - -#ifdef MS_WINDOWS -#include -#ifdef HAVE_PROCESS_H -#include -#endif -#endif - -#ifdef HAVE_SIGNAL_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif - -#ifndef SIG_ERR -#define SIG_ERR ((PyOS_sighandler_t)(-1)) -#endif - -#if defined(PYOS_OS2) && !defined(PYCC_GCC) -#define NSIG 12 -#include -#endif - -#ifndef NSIG -# if defined(_NSIG) -# define NSIG _NSIG /* For BSD/SysV */ -# elif defined(_SIGMAX) -# define NSIG (_SIGMAX + 1) /* For QNX */ -# elif defined(SIGMAX) -# define NSIG (SIGMAX + 1) /* For djgpp */ -# else -# define NSIG 64 /* Use a reasonable default value */ -# endif -#endif - - -/* - NOTES ON THE INTERACTION BETWEEN SIGNALS AND THREADS - - When threads are supported, we want the following semantics: - - - only the main thread can set a signal handler - - any thread can get a signal handler - - signals are only delivered to the main thread - - I.e. we don't support "synchronous signals" like SIGFPE (catching - this doesn't make much sense in Python anyway) nor do we support - signals as a means of inter-thread communication, since not all - thread implementations support that (at least our thread library - doesn't). - - We still have the problem that in some implementations signals - generated by the keyboard (e.g. SIGINT) are delivered to all - threads (e.g. SGI), while in others (e.g. Solaris) such signals are - delivered to one random thread (an intermediate possibility would - be to deliver it to the main thread -- POSIX?). For now, we have - a working implementation that works in all three cases -- the - handler ignores signals if getpid() isn't the same as in the main - thread. XXX This is a hack. - - GNU pth is a user-space threading library, and as such, all threads - run within the same process. In this case, if the currently running - thread is not the main_thread, send the signal to the main_thread. -*/ - -#ifdef WITH_THREAD -#include /* For pid_t */ -#include "pythread.h" -static long main_thread; -static pid_t main_pid; -#endif - -static struct { - int tripped; - PyObject *func; -} Handlers[NSIG]; - -static sig_atomic_t wakeup_fd = -1; - -/* Speed up sigcheck() when none tripped */ -static volatile sig_atomic_t is_tripped = 0; - -static PyObject *DefaultHandler; -static PyObject *IgnoreHandler; -static PyObject *IntHandler; - -/* On Solaris 8, gcc will produce a warning that the function - declaration is not a prototype. This is caused by the definition of - SIG_DFL as (void (*)())0; the correct declaration would have been - (void (*)(int))0. */ - -static PyOS_sighandler_t old_siginthandler = SIG_DFL; - -#ifdef HAVE_GETITIMER -static PyObject *ItimerError; - -/* auxiliary functions for setitimer/getitimer */ -static void -timeval_from_double(double d, struct timeval *tv) -{ - tv->tv_sec = floor(d); - tv->tv_usec = fmod(d, 1.0) * 1000000.0; -} - -Py_LOCAL_INLINE(double) -double_from_timeval(struct timeval *tv) -{ - return tv->tv_sec + (double)(tv->tv_usec / 1000000.0); -} - -static PyObject * -itimer_retval(struct itimerval *iv) -{ - PyObject *r, *v; - - r = PyTuple_New(2); - if (r == NULL) - return NULL; - - if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_value)))) { - Py_DECREF(r); - return NULL; - } - - PyTuple_SET_ITEM(r, 0, v); - - if(!(v = PyFloat_FromDouble(double_from_timeval(&iv->it_interval)))) { - Py_DECREF(r); - return NULL; - } - - PyTuple_SET_ITEM(r, 1, v); - - return r; -} -#endif - -static PyObject * -signal_default_int_handler(PyObject *self, PyObject *args) -{ - PyErr_SetNone(PyExc_KeyboardInterrupt); - return NULL; -} - -PyDoc_STRVAR(default_int_handler_doc, -"default_int_handler(...)\n\ -\n\ -The default handler for SIGINT installed by Python.\n\ -It raises KeyboardInterrupt."); - - -static int -checksignals_witharg(void * unused) -{ - return PyErr_CheckSignals(); -} - -static void -trip_signal(int sig_num) -{ - Handlers[sig_num].tripped = 1; - if (is_tripped) - return; - /* Set is_tripped after setting .tripped, as it gets - cleared in PyErr_CheckSignals() before .tripped. */ - is_tripped = 1; - Py_AddPendingCall(checksignals_witharg, NULL); - if (wakeup_fd != -1) - write(wakeup_fd, "\0", 1); -} - -static void -signal_handler(int sig_num) -{ - int save_errno = errno; - -#if defined(WITH_THREAD) && defined(WITH_PTH) - if (PyThread_get_thread_ident() != main_thread) { - pth_raise(*(pth_t *) main_thread, sig_num); - } - else -#endif - { -#ifdef WITH_THREAD - /* See NOTES section above */ - if (getpid() == main_pid) -#endif - { - trip_signal(sig_num); - } - -#ifndef HAVE_SIGACTION -#ifdef SIGCHLD - /* To avoid infinite recursion, this signal remains - reset until explicit re-instated. - Don't clear the 'func' field as it is our pointer - to the Python handler... */ - if (sig_num != SIGCHLD) -#endif - /* If the handler was not set up with sigaction, reinstall it. See - * Python/pythonrun.c for the implementation of PyOS_setsig which - * makes this true. See also issue8354. */ - PyOS_setsig(sig_num, signal_handler); -#endif - } - - /* Issue #10311: asynchronously executing signal handlers should not - mutate errno under the feet of unsuspecting C code. */ - errno = save_errno; -} - - -#ifdef HAVE_ALARM -static PyObject * -signal_alarm(PyObject *self, PyObject *args) -{ - int t; - if (!PyArg_ParseTuple(args, "i:alarm", &t)) - return NULL; - /* alarm() returns the number of seconds remaining */ - return PyInt_FromLong((long)alarm(t)); -} - -PyDoc_STRVAR(alarm_doc, -"alarm(seconds)\n\ -\n\ -Arrange for SIGALRM to arrive after the given number of seconds."); -#endif - -#ifdef HAVE_PAUSE -static PyObject * -signal_pause(PyObject *self) -{ - Py_BEGIN_ALLOW_THREADS - (void)pause(); - Py_END_ALLOW_THREADS - /* make sure that any exceptions that got raised are propagated - * back into Python - */ - if (PyErr_CheckSignals()) - return NULL; - - Py_INCREF(Py_None); - return Py_None; -} -PyDoc_STRVAR(pause_doc, -"pause()\n\ -\n\ -Wait until a signal arrives."); - -#endif - - -static PyObject * -signal_signal(PyObject *self, PyObject *args) -{ - PyObject *obj; - int sig_num; - PyObject *old_handler; - void (*func)(int); - if (!PyArg_ParseTuple(args, "iO:signal", &sig_num, &obj)) - return NULL; -#ifdef MS_WINDOWS - /* Validate that sig_num is one of the allowable signals */ - switch (sig_num) { - case SIGABRT: break; -#ifdef SIGBREAK - /* Issue #10003: SIGBREAK is not documented as permitted, but works - and corresponds to CTRL_BREAK_EVENT. */ - case SIGBREAK: break; -#endif - case SIGFPE: break; - case SIGILL: break; - case SIGINT: break; - case SIGSEGV: break; - case SIGTERM: break; - default: - PyErr_SetString(PyExc_ValueError, "invalid signal value"); - return NULL; - } -#endif -#ifdef WITH_THREAD - if (PyThread_get_thread_ident() != main_thread) { - PyErr_SetString(PyExc_ValueError, - "signal only works in main thread"); - return NULL; - } -#endif - if (sig_num < 1 || sig_num >= NSIG) { - PyErr_SetString(PyExc_ValueError, - "signal number out of range"); - return NULL; - } - if (obj == IgnoreHandler) - func = SIG_IGN; - else if (obj == DefaultHandler) - func = SIG_DFL; - else if (!PyCallable_Check(obj)) { - PyErr_SetString(PyExc_TypeError, -"signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object"); - return NULL; - } - else - func = signal_handler; - if (PyOS_setsig(sig_num, func) == SIG_ERR) { - PyErr_SetFromErrno(PyExc_RuntimeError); - return NULL; - } - old_handler = Handlers[sig_num].func; - Handlers[sig_num].tripped = 0; - Py_INCREF(obj); - Handlers[sig_num].func = obj; - if (old_handler != NULL) - return old_handler; - else - Py_RETURN_NONE; -} - -PyDoc_STRVAR(signal_doc, -"signal(sig, action) -> action\n\ -\n\ -Set the action for the given signal. The action can be SIG_DFL,\n\ -SIG_IGN, or a callable Python object. The previous action is\n\ -returned. See getsignal() for possible return values.\n\ -\n\ -*** IMPORTANT NOTICE ***\n\ -A signal handler function is called with two arguments:\n\ -the first is the signal number, the second is the interrupted stack frame."); - - -static PyObject * -signal_getsignal(PyObject *self, PyObject *args) -{ - int sig_num; - PyObject *old_handler; - if (!PyArg_ParseTuple(args, "i:getsignal", &sig_num)) - return NULL; - if (sig_num < 1 || sig_num >= NSIG) { - PyErr_SetString(PyExc_ValueError, - "signal number out of range"); - return NULL; - } - old_handler = Handlers[sig_num].func; - if (old_handler != NULL) { - Py_INCREF(old_handler); - return old_handler; - } - else { - Py_RETURN_NONE; - } -} - -PyDoc_STRVAR(getsignal_doc, -"getsignal(sig) -> action\n\ -\n\ -Return the current action for the given signal. The return value can be:\n\ -SIG_IGN -- if the signal is being ignored\n\ -SIG_DFL -- if the default action for the signal is in effect\n\ -None -- if an unknown handler is in effect\n\ -anything else -- the callable Python object used as a handler"); - -#ifdef HAVE_SIGINTERRUPT -PyDoc_STRVAR(siginterrupt_doc, -"siginterrupt(sig, flag) -> None\n\ -change system call restart behaviour: if flag is False, system calls\n\ -will be restarted when interrupted by signal sig, else system calls\n\ -will be interrupted."); - -static PyObject * -signal_siginterrupt(PyObject *self, PyObject *args) -{ - int sig_num; - int flag; - - if (!PyArg_ParseTuple(args, "ii:siginterrupt", &sig_num, &flag)) - return NULL; - if (sig_num < 1 || sig_num >= NSIG) { - PyErr_SetString(PyExc_ValueError, - "signal number out of range"); - return NULL; - } - if (siginterrupt(sig_num, flag)<0) { - PyErr_SetFromErrno(PyExc_RuntimeError); - return NULL; - } - - Py_INCREF(Py_None); - return Py_None; -} - -#endif - -static PyObject * -signal_set_wakeup_fd(PyObject *self, PyObject *args) -{ - struct stat buf; - int fd, old_fd; - if (!PyArg_ParseTuple(args, "i:set_wakeup_fd", &fd)) - return NULL; -#ifdef WITH_THREAD - if (PyThread_get_thread_ident() != main_thread) { - PyErr_SetString(PyExc_ValueError, - "set_wakeup_fd only works in main thread"); - return NULL; - } -#endif - if (fd != -1 && (!_PyVerify_fd(fd) || fstat(fd, &buf) != 0)) { - PyErr_SetString(PyExc_ValueError, "invalid fd"); - return NULL; - } - old_fd = wakeup_fd; - wakeup_fd = fd; - return PyLong_FromLong(old_fd); -} - -PyDoc_STRVAR(set_wakeup_fd_doc, -"set_wakeup_fd(fd) -> fd\n\ -\n\ -Sets the fd to be written to (with '\\0') when a signal\n\ -comes in. A library can use this to wakeup select or poll.\n\ -The previous fd is returned.\n\ -\n\ -The fd must be non-blocking."); - -/* C API for the same, without all the error checking */ -int -PySignal_SetWakeupFd(int fd) -{ - int old_fd = wakeup_fd; - if (fd < 0) - fd = -1; - wakeup_fd = fd; - return old_fd; -} - - -#ifdef HAVE_SETITIMER -static PyObject * -signal_setitimer(PyObject *self, PyObject *args) -{ - double first; - double interval = 0; - int which; - struct itimerval new, old; - - if(!PyArg_ParseTuple(args, "id|d:setitimer", &which, &first, &interval)) - return NULL; - - timeval_from_double(first, &new.it_value); - timeval_from_double(interval, &new.it_interval); - /* Let OS check "which" value */ - if (setitimer(which, &new, &old) != 0) { - PyErr_SetFromErrno(ItimerError); - return NULL; - } - - return itimer_retval(&old); -} - -PyDoc_STRVAR(setitimer_doc, -"setitimer(which, seconds[, interval])\n\ -\n\ -Sets given itimer (one of ITIMER_REAL, ITIMER_VIRTUAL\n\ -or ITIMER_PROF) to fire after value seconds and after\n\ -that every interval seconds.\n\ -The itimer can be cleared by setting seconds to zero.\n\ -\n\ -Returns old values as a tuple: (delay, interval)."); -#endif - - -#ifdef HAVE_GETITIMER -static PyObject * -signal_getitimer(PyObject *self, PyObject *args) -{ - int which; - struct itimerval old; - - if (!PyArg_ParseTuple(args, "i:getitimer", &which)) - return NULL; - - if (getitimer(which, &old) != 0) { - PyErr_SetFromErrno(ItimerError); - return NULL; - } - - return itimer_retval(&old); -} - -PyDoc_STRVAR(getitimer_doc, -"getitimer(which)\n\ -\n\ -Returns current value of given itimer."); -#endif - - -/* List of functions defined in the module */ -static PyMethodDef signal_methods[] = { -#ifdef HAVE_ALARM - {"alarm", signal_alarm, METH_VARARGS, alarm_doc}, -#endif -#ifdef HAVE_SETITIMER - {"setitimer", signal_setitimer, METH_VARARGS, setitimer_doc}, -#endif -#ifdef HAVE_GETITIMER - {"getitimer", signal_getitimer, METH_VARARGS, getitimer_doc}, -#endif - {"signal", signal_signal, METH_VARARGS, signal_doc}, - {"getsignal", signal_getsignal, METH_VARARGS, getsignal_doc}, - {"set_wakeup_fd", signal_set_wakeup_fd, METH_VARARGS, set_wakeup_fd_doc}, -#ifdef HAVE_SIGINTERRUPT - {"siginterrupt", signal_siginterrupt, METH_VARARGS, siginterrupt_doc}, -#endif -#ifdef HAVE_PAUSE - {"pause", (PyCFunction)signal_pause, - METH_NOARGS,pause_doc}, -#endif - {"default_int_handler", signal_default_int_handler, - METH_VARARGS, default_int_handler_doc}, - {NULL, NULL} /* sentinel */ -}; - - -PyDoc_STRVAR(module_doc, -"This module provides mechanisms to use signal handlers in Python.\n\ -\n\ -Functions:\n\ -\n\ -alarm() -- cause SIGALRM after a specified time [Unix only]\n\ -setitimer() -- cause a signal (described below) after a specified\n\ - float time and the timer may restart then [Unix only]\n\ -getitimer() -- get current value of timer [Unix only]\n\ -signal() -- set the action for a given signal\n\ -getsignal() -- get the signal action for a given signal\n\ -pause() -- wait until a signal arrives [Unix only]\n\ -default_int_handler() -- default SIGINT handler\n\ -\n\ -signal constants:\n\ -SIG_DFL -- used to refer to the system default handler\n\ -SIG_IGN -- used to ignore the signal\n\ -NSIG -- number of defined signals\n\ -SIGINT, SIGTERM, etc. -- signal numbers\n\ -\n\ -itimer constants:\n\ -ITIMER_REAL -- decrements in real time, and delivers SIGALRM upon\n\ - expiration\n\ -ITIMER_VIRTUAL -- decrements only when the process is executing,\n\ - and delivers SIGVTALRM upon expiration\n\ -ITIMER_PROF -- decrements both when the process is executing and\n\ - when the system is executing on behalf of the process.\n\ - Coupled with ITIMER_VIRTUAL, this timer is usually\n\ - used to profile the time spent by the application\n\ - in user and kernel space. SIGPROF is delivered upon\n\ - expiration.\n\ -\n\n\ -*** IMPORTANT NOTICE ***\n\ -A signal handler function is called with two arguments:\n\ -the first is the signal number, the second is the interrupted stack frame."); - -PyMODINIT_FUNC -initsignal(void) -{ - PyObject *m, *d, *x; - int i; - -#ifdef WITH_THREAD - main_thread = PyThread_get_thread_ident(); - main_pid = getpid(); -#endif - - /* Create the module and add the functions */ - m = Py_InitModule3("signal", signal_methods, module_doc); - if (m == NULL) - return; - - /* Add some symbolic constants to the module */ - d = PyModule_GetDict(m); - - x = DefaultHandler = PyLong_FromVoidPtr((void *)SIG_DFL); - if (!x || PyDict_SetItemString(d, "SIG_DFL", x) < 0) - goto finally; - - x = IgnoreHandler = PyLong_FromVoidPtr((void *)SIG_IGN); - if (!x || PyDict_SetItemString(d, "SIG_IGN", x) < 0) - goto finally; - - x = PyInt_FromLong((long)NSIG); - if (!x || PyDict_SetItemString(d, "NSIG", x) < 0) - goto finally; - Py_DECREF(x); - - x = IntHandler = PyDict_GetItemString(d, "default_int_handler"); - if (!x) - goto finally; - Py_INCREF(IntHandler); - - Handlers[0].tripped = 0; - for (i = 1; i < NSIG; i++) { - void (*t)(int); - t = PyOS_getsig(i); - Handlers[i].tripped = 0; - if (t == SIG_DFL) - Handlers[i].func = DefaultHandler; - else if (t == SIG_IGN) - Handlers[i].func = IgnoreHandler; - else - Handlers[i].func = Py_None; /* None of our business */ - Py_INCREF(Handlers[i].func); - } - if (Handlers[SIGINT].func == DefaultHandler) { - /* Install default int handler */ - Py_INCREF(IntHandler); - Py_DECREF(Handlers[SIGINT].func); - Handlers[SIGINT].func = IntHandler; - old_siginthandler = PyOS_setsig(SIGINT, signal_handler); - } - -#ifdef SIGHUP - x = PyInt_FromLong(SIGHUP); - PyDict_SetItemString(d, "SIGHUP", x); - Py_XDECREF(x); -#endif -#ifdef SIGINT - x = PyInt_FromLong(SIGINT); - PyDict_SetItemString(d, "SIGINT", x); - Py_XDECREF(x); -#endif -#ifdef SIGBREAK - x = PyInt_FromLong(SIGBREAK); - PyDict_SetItemString(d, "SIGBREAK", x); - Py_XDECREF(x); -#endif -#ifdef SIGQUIT - x = PyInt_FromLong(SIGQUIT); - PyDict_SetItemString(d, "SIGQUIT", x); - Py_XDECREF(x); -#endif -#ifdef SIGILL - x = PyInt_FromLong(SIGILL); - PyDict_SetItemString(d, "SIGILL", x); - Py_XDECREF(x); -#endif -#ifdef SIGTRAP - x = PyInt_FromLong(SIGTRAP); - PyDict_SetItemString(d, "SIGTRAP", x); - Py_XDECREF(x); -#endif -#ifdef SIGIOT - x = PyInt_FromLong(SIGIOT); - PyDict_SetItemString(d, "SIGIOT", x); - Py_XDECREF(x); -#endif -#ifdef SIGABRT - x = PyInt_FromLong(SIGABRT); - PyDict_SetItemString(d, "SIGABRT", x); - Py_XDECREF(x); -#endif -#ifdef SIGEMT - x = PyInt_FromLong(SIGEMT); - PyDict_SetItemString(d, "SIGEMT", x); - Py_XDECREF(x); -#endif -#ifdef SIGFPE - x = PyInt_FromLong(SIGFPE); - PyDict_SetItemString(d, "SIGFPE", x); - Py_XDECREF(x); -#endif -#ifdef SIGKILL - x = PyInt_FromLong(SIGKILL); - PyDict_SetItemString(d, "SIGKILL", x); - Py_XDECREF(x); -#endif -#ifdef SIGBUS - x = PyInt_FromLong(SIGBUS); - PyDict_SetItemString(d, "SIGBUS", x); - Py_XDECREF(x); -#endif -#ifdef SIGSEGV - x = PyInt_FromLong(SIGSEGV); - PyDict_SetItemString(d, "SIGSEGV", x); - Py_XDECREF(x); -#endif -#ifdef SIGSYS - x = PyInt_FromLong(SIGSYS); - PyDict_SetItemString(d, "SIGSYS", x); - Py_XDECREF(x); -#endif -#ifdef SIGPIPE - x = PyInt_FromLong(SIGPIPE); - PyDict_SetItemString(d, "SIGPIPE", x); - Py_XDECREF(x); -#endif -#ifdef SIGALRM - x = PyInt_FromLong(SIGALRM); - PyDict_SetItemString(d, "SIGALRM", x); - Py_XDECREF(x); -#endif -#ifdef SIGTERM - x = PyInt_FromLong(SIGTERM); - PyDict_SetItemString(d, "SIGTERM", x); - Py_XDECREF(x); -#endif -#ifdef SIGUSR1 - x = PyInt_FromLong(SIGUSR1); - PyDict_SetItemString(d, "SIGUSR1", x); - Py_XDECREF(x); -#endif -#ifdef SIGUSR2 - x = PyInt_FromLong(SIGUSR2); - PyDict_SetItemString(d, "SIGUSR2", x); - Py_XDECREF(x); -#endif -#ifdef SIGCLD - x = PyInt_FromLong(SIGCLD); - PyDict_SetItemString(d, "SIGCLD", x); - Py_XDECREF(x); -#endif -#ifdef SIGCHLD - x = PyInt_FromLong(SIGCHLD); - PyDict_SetItemString(d, "SIGCHLD", x); - Py_XDECREF(x); -#endif -#ifdef SIGPWR - x = PyInt_FromLong(SIGPWR); - PyDict_SetItemString(d, "SIGPWR", x); - Py_XDECREF(x); -#endif -#ifdef SIGIO - x = PyInt_FromLong(SIGIO); - PyDict_SetItemString(d, "SIGIO", x); - Py_XDECREF(x); -#endif -#ifdef SIGURG - x = PyInt_FromLong(SIGURG); - PyDict_SetItemString(d, "SIGURG", x); - Py_XDECREF(x); -#endif -#ifdef SIGWINCH - x = PyInt_FromLong(SIGWINCH); - PyDict_SetItemString(d, "SIGWINCH", x); - Py_XDECREF(x); -#endif -#ifdef SIGPOLL - x = PyInt_FromLong(SIGPOLL); - PyDict_SetItemString(d, "SIGPOLL", x); - Py_XDECREF(x); -#endif -#ifdef SIGSTOP - x = PyInt_FromLong(SIGSTOP); - PyDict_SetItemString(d, "SIGSTOP", x); - Py_XDECREF(x); -#endif -#ifdef SIGTSTP - x = PyInt_FromLong(SIGTSTP); - PyDict_SetItemString(d, "SIGTSTP", x); - Py_XDECREF(x); -#endif -#ifdef SIGCONT - x = PyInt_FromLong(SIGCONT); - PyDict_SetItemString(d, "SIGCONT", x); - Py_XDECREF(x); -#endif -#ifdef SIGTTIN - x = PyInt_FromLong(SIGTTIN); - PyDict_SetItemString(d, "SIGTTIN", x); - Py_XDECREF(x); -#endif -#ifdef SIGTTOU - x = PyInt_FromLong(SIGTTOU); - PyDict_SetItemString(d, "SIGTTOU", x); - Py_XDECREF(x); -#endif -#ifdef SIGVTALRM - x = PyInt_FromLong(SIGVTALRM); - PyDict_SetItemString(d, "SIGVTALRM", x); - Py_XDECREF(x); -#endif -#ifdef SIGPROF - x = PyInt_FromLong(SIGPROF); - PyDict_SetItemString(d, "SIGPROF", x); - Py_XDECREF(x); -#endif -#ifdef SIGXCPU - x = PyInt_FromLong(SIGXCPU); - PyDict_SetItemString(d, "SIGXCPU", x); - Py_XDECREF(x); -#endif -#ifdef SIGXFSZ - x = PyInt_FromLong(SIGXFSZ); - PyDict_SetItemString(d, "SIGXFSZ", x); - Py_XDECREF(x); -#endif -#ifdef SIGRTMIN - x = PyInt_FromLong(SIGRTMIN); - PyDict_SetItemString(d, "SIGRTMIN", x); - Py_XDECREF(x); -#endif -#ifdef SIGRTMAX - x = PyInt_FromLong(SIGRTMAX); - PyDict_SetItemString(d, "SIGRTMAX", x); - Py_XDECREF(x); -#endif -#ifdef SIGINFO - x = PyInt_FromLong(SIGINFO); - PyDict_SetItemString(d, "SIGINFO", x); - Py_XDECREF(x); -#endif - -#ifdef ITIMER_REAL - x = PyLong_FromLong(ITIMER_REAL); - PyDict_SetItemString(d, "ITIMER_REAL", x); - Py_DECREF(x); -#endif -#ifdef ITIMER_VIRTUAL - x = PyLong_FromLong(ITIMER_VIRTUAL); - PyDict_SetItemString(d, "ITIMER_VIRTUAL", x); - Py_DECREF(x); -#endif -#ifdef ITIMER_PROF - x = PyLong_FromLong(ITIMER_PROF); - PyDict_SetItemString(d, "ITIMER_PROF", x); - Py_DECREF(x); -#endif - -#if defined (HAVE_SETITIMER) || defined (HAVE_GETITIMER) - ItimerError = PyErr_NewException("signal.ItimerError", - PyExc_IOError, NULL); - if (ItimerError != NULL) - PyDict_SetItemString(d, "ItimerError", ItimerError); -#endif - -#ifdef CTRL_C_EVENT - x = PyInt_FromLong(CTRL_C_EVENT); - PyDict_SetItemString(d, "CTRL_C_EVENT", x); - Py_DECREF(x); -#endif - -#ifdef CTRL_BREAK_EVENT - x = PyInt_FromLong(CTRL_BREAK_EVENT); - PyDict_SetItemString(d, "CTRL_BREAK_EVENT", x); - Py_DECREF(x); -#endif - - if (!PyErr_Occurred()) - return; - - /* Check for errors */ - finally: - return; -} - -static void -finisignal(void) -{ - int i; - PyObject *func; - - PyOS_setsig(SIGINT, old_siginthandler); - old_siginthandler = SIG_DFL; - - for (i = 1; i < NSIG; i++) { - func = Handlers[i].func; - Handlers[i].tripped = 0; - Handlers[i].func = NULL; - if (i != SIGINT && func != NULL && func != Py_None && - func != DefaultHandler && func != IgnoreHandler) - PyOS_setsig(i, SIG_DFL); - Py_XDECREF(func); - } - - Py_XDECREF(IntHandler); - IntHandler = NULL; - Py_XDECREF(DefaultHandler); - DefaultHandler = NULL; - Py_XDECREF(IgnoreHandler); - IgnoreHandler = NULL; -} - - -/* Declared in pyerrors.h */ -int -PyErr_CheckSignals(void) -{ - int i; - PyObject *f; - - if (!is_tripped) - return 0; - -#ifdef WITH_THREAD - if (PyThread_get_thread_ident() != main_thread) - return 0; -#endif - - /* - * The is_tripped variable is meant to speed up the calls to - * PyErr_CheckSignals (both directly or via pending calls) when no - * signal has arrived. This variable is set to 1 when a signal arrives - * and it is set to 0 here, when we know some signals arrived. This way - * we can run the registered handlers with no signals blocked. - * - * NOTE: with this approach we can have a situation where is_tripped is - * 1 but we have no more signals to handle (Handlers[i].tripped - * is 0 for every signal i). This won't do us any harm (except - * we're gonna spent some cycles for nothing). This happens when - * we receive a signal i after we zero is_tripped and before we - * check Handlers[i].tripped. - */ - is_tripped = 0; - - if (!(f = (PyObject *)PyEval_GetFrame())) - f = Py_None; - - for (i = 1; i < NSIG; i++) { - if (Handlers[i].tripped) { - PyObject *result = NULL; - PyObject *arglist = Py_BuildValue("(iO)", i, f); - Handlers[i].tripped = 0; - - if (arglist) { - result = PyEval_CallObject(Handlers[i].func, - arglist); - Py_DECREF(arglist); - } - if (!result) - return -1; - - Py_DECREF(result); - } - } - - return 0; -} - - -/* Replacements for intrcheck.c functionality - * Declared in pyerrors.h - */ -void -PyErr_SetInterrupt(void) -{ - trip_signal(SIGINT); -} - -void -PyOS_InitInterrupts(void) -{ - initsignal(); - _PyImport_FixupExtension("signal", "signal"); -} - -void -PyOS_FiniInterrupts(void) -{ - finisignal(); -} - -int -PyOS_InterruptOccurred(void) -{ - if (Handlers[SIGINT].tripped) { -#ifdef WITH_THREAD - if (PyThread_get_thread_ident() != main_thread) - return 0; -#endif - Handlers[SIGINT].tripped = 0; - return 1; - } - return 0; -} - -static void -_clear_pending_signals(void) -{ - int i; - if (!is_tripped) - return; - is_tripped = 0; - for (i = 1; i < NSIG; ++i) { - Handlers[i].tripped = 0; - } -} - -void -PyOS_AfterFork(void) -{ - /* Clear the signal flags after forking so that they aren't handled - * in both processes if they came in just before the fork() but before - * the interpreter had an opportunity to call the handlers. issue9535. */ - _clear_pending_signals(); -#ifdef WITH_THREAD - /* PyThread_ReInitTLS() must be called early, to make sure that the TLS API - * can be called safely. */ - PyThread_ReInitTLS(); - PyEval_ReInitThreads(); - main_thread = PyThread_get_thread_ident(); - main_pid = getpid(); - _PyImport_ReInitLock(); -#endif -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/socketmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/socketmodule.c deleted file mode 100644 index 834025c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/socketmodule.c +++ /dev/null @@ -1,5556 +0,0 @@ -/* Socket module */ - -/* - -This module provides an interface to Berkeley socket IPC. - -Limitations: - -- Only AF_INET, AF_INET6 and AF_UNIX address families are supported in a - portable manner, though AF_PACKET, AF_NETLINK and AF_TIPC are supported - under Linux. -- No read/write operations (use sendall/recv or makefile instead). -- Additional restrictions apply on some non-Unix platforms (compensated - for by socket.py). - -Module interface: - -- socket.error: exception raised for socket specific errors -- socket.gaierror: exception raised for getaddrinfo/getnameinfo errors, - a subclass of socket.error -- socket.herror: exception raised for gethostby* errors, - a subclass of socket.error -- socket.fromfd(fd, family, type[, proto]) --> new socket object (created - from an existing file descriptor) -- socket.gethostbyname(hostname) --> host IP address (string: 'dd.dd.dd.dd') -- socket.gethostbyaddr(IP address) --> (hostname, [alias, ...], [IP addr, ...]) -- socket.gethostname() --> host name (string: 'spam' or 'spam.domain.com') -- socket.getprotobyname(protocolname) --> protocol number -- socket.getservbyname(servicename[, protocolname]) --> port number -- socket.getservbyport(portnumber[, protocolname]) --> service name -- socket.socket([family[, type [, proto]]]) --> new socket object -- socket.socketpair([family[, type [, proto]]]) --> (socket, socket) -- socket.ntohs(16 bit value) --> new int object -- socket.ntohl(32 bit value) --> new int object -- socket.htons(16 bit value) --> new int object -- socket.htonl(32 bit value) --> new int object -- socket.getaddrinfo(host, port [, family, socktype, proto, flags]) - --> List of (family, socktype, proto, canonname, sockaddr) -- socket.getnameinfo(sockaddr, flags) --> (host, port) -- socket.AF_INET, socket.SOCK_STREAM, etc.: constants from -- socket.has_ipv6: boolean value indicating if IPv6 is supported -- socket.inet_aton(IP address) -> 32-bit packed IP representation -- socket.inet_ntoa(packed IP) -> IP address string -- socket.getdefaulttimeout() -> None | float -- socket.setdefaulttimeout(None | float) -- an Internet socket address is a pair (hostname, port) - where hostname can be anything recognized by gethostbyname() - (including the dd.dd.dd.dd notation) and port is in host byte order -- where a hostname is returned, the dd.dd.dd.dd notation is used -- a UNIX domain socket address is a string specifying the pathname -- an AF_PACKET socket address is a tuple containing a string - specifying the ethernet interface and an integer specifying - the Ethernet protocol number to be received. For example: - ("eth0",0x1234). Optional 3rd,4th,5th elements in the tuple - specify packet-type and ha-type/addr. -- an AF_TIPC socket address is expressed as - (addr_type, v1, v2, v3 [, scope]); where addr_type can be one of: - TIPC_ADDR_NAMESEQ, TIPC_ADDR_NAME, and TIPC_ADDR_ID; - and scope can be one of: - TIPC_ZONE_SCOPE, TIPC_CLUSTER_SCOPE, and TIPC_NODE_SCOPE. - The meaning of v1, v2 and v3 depends on the value of addr_type: - if addr_type is TIPC_ADDR_NAME: - v1 is the server type - v2 is the port identifier - v3 is ignored - if addr_type is TIPC_ADDR_NAMESEQ: - v1 is the server type - v2 is the lower port number - v3 is the upper port number - if addr_type is TIPC_ADDR_ID: - v1 is the node - v2 is the ref - v3 is ignored - - -Local naming conventions: - -- names starting with sock_ are socket object methods -- names starting with socket_ are module-level functions -- names starting with PySocket are exported through socketmodule.h - -*/ - -#ifdef __APPLE__ - /* - * inet_aton is not available on OSX 10.3, yet we want to use a binary - * that was build on 10.4 or later to work on that release, weak linking - * comes to the rescue. - */ -# pragma weak inet_aton -#endif - -#include "Python.h" -#include "structmember.h" -#include "timefuncs.h" - -#ifndef INVALID_SOCKET /* MS defines this */ -#define INVALID_SOCKET (-1) -#endif - -#undef MAX -#define MAX(x, y) ((x) < (y) ? (y) : (x)) - -/* Socket object documentation */ -PyDoc_STRVAR(sock_doc, -"socket([family[, type[, proto]]]) -> socket object\n\ -\n\ -Open a socket of the given type. The family argument specifies the\n\ -address family; it defaults to AF_INET. The type argument specifies\n\ -whether this is a stream (SOCK_STREAM, this is the default)\n\ -or datagram (SOCK_DGRAM) socket. The protocol argument defaults to 0,\n\ -specifying the default protocol. Keyword arguments are accepted.\n\ -\n\ -A socket object represents one endpoint of a network connection.\n\ -\n\ -Methods of socket objects (keyword arguments not allowed):\n\ -\n\ -accept() -- accept a connection, returning new socket and client address\n\ -bind(addr) -- bind the socket to a local address\n\ -close() -- close the socket\n\ -connect(addr) -- connect the socket to a remote address\n\ -connect_ex(addr) -- connect, return an error code instead of an exception\n\ -dup() -- return a new socket object identical to the current one [*]\n\ -fileno() -- return underlying file descriptor\n\ -getpeername() -- return remote address [*]\n\ -getsockname() -- return local address\n\ -getsockopt(level, optname[, buflen]) -- get socket options\n\ -gettimeout() -- return timeout or None\n\ -listen(n) -- start listening for incoming connections\n\ -makefile([mode, [bufsize]]) -- return a file object for the socket [*]\n\ -recv(buflen[, flags]) -- receive data\n\ -recv_into(buffer[, nbytes[, flags]]) -- receive data (into a buffer)\n\ -recvfrom(buflen[, flags]) -- receive data and sender\'s address\n\ -recvfrom_into(buffer[, nbytes, [, flags])\n\ - -- receive data and sender\'s address (into a buffer)\n\ -sendall(data[, flags]) -- send all data\n\ -send(data[, flags]) -- send data, may not send all of it\n\ -sendto(data[, flags], addr) -- send data to a given address\n\ -setblocking(0 | 1) -- set or clear the blocking I/O flag\n\ -setsockopt(level, optname, value) -- set socket options\n\ -settimeout(None | float) -- set or clear the timeout\n\ -shutdown(how) -- shut down traffic in one or both directions\n\ -\n\ - [*] not available on all platforms!"); - -/* XXX This is a terrible mess of platform-dependent preprocessor hacks. - I hope some day someone can clean this up please... */ - -/* Hacks for gethostbyname_r(). On some non-Linux platforms, the configure - script doesn't get this right, so we hardcode some platform checks below. - On the other hand, not all Linux versions agree, so there the settings - computed by the configure script are needed! */ - -#ifndef linux -# undef HAVE_GETHOSTBYNAME_R_3_ARG -# undef HAVE_GETHOSTBYNAME_R_5_ARG -# undef HAVE_GETHOSTBYNAME_R_6_ARG -#endif - -#ifndef WITH_THREAD -# undef HAVE_GETHOSTBYNAME_R -#endif - -#ifdef HAVE_GETHOSTBYNAME_R -# if defined(_AIX) || defined(__osf__) -# define HAVE_GETHOSTBYNAME_R_3_ARG -# elif defined(__sun) || defined(__sgi) -# define HAVE_GETHOSTBYNAME_R_5_ARG -# elif defined(linux) -/* Rely on the configure script */ -# else -# undef HAVE_GETHOSTBYNAME_R -# endif -#endif - -#if !defined(HAVE_GETHOSTBYNAME_R) && defined(WITH_THREAD) && \ - !defined(MS_WINDOWS) -# define USE_GETHOSTBYNAME_LOCK -#endif - -/* To use __FreeBSD_version */ -#ifdef HAVE_SYS_PARAM_H -#include -#endif -/* On systems on which getaddrinfo() is believed to not be thread-safe, - (this includes the getaddrinfo emulation) protect access with a lock. */ -#if defined(WITH_THREAD) && (defined(__APPLE__) || \ - (defined(__FreeBSD__) && __FreeBSD_version+0 < 503000) || \ - defined(__OpenBSD__) || defined(__NetBSD__) || \ - defined(__VMS) || !defined(HAVE_GETADDRINFO)) -#define USE_GETADDRINFO_LOCK -#endif - -#ifdef USE_GETADDRINFO_LOCK -#define ACQUIRE_GETADDRINFO_LOCK PyThread_acquire_lock(netdb_lock, 1); -#define RELEASE_GETADDRINFO_LOCK PyThread_release_lock(netdb_lock); -#else -#define ACQUIRE_GETADDRINFO_LOCK -#define RELEASE_GETADDRINFO_LOCK -#endif - -#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK) -# include "pythread.h" -#endif - -#if defined(PYCC_VACPP) -# include -# include -# include -# include -# include -#endif - -#if defined(__VMS) -# include -#endif - -#if defined(PYOS_OS2) -# define INCL_DOS -# define INCL_DOSERRORS -# define INCL_NOPMAPI -# include -#endif - -#if defined(__sgi) && _COMPILER_VERSION>700 && !_SGIAPI -/* make sure that the reentrant (gethostbyaddr_r etc) - functions are declared correctly if compiling with - MIPSPro 7.x in ANSI C mode (default) */ - -/* XXX Using _SGIAPI is the wrong thing, - but I don't know what the right thing is. */ -#undef _SGIAPI /* to avoid warning */ -#define _SGIAPI 1 - -#undef _XOPEN_SOURCE -#include -#include -#include -#ifdef _SS_ALIGNSIZE -#define HAVE_GETADDRINFO 1 -#define HAVE_GETNAMEINFO 1 -#endif - -#define HAVE_INET_PTON -#include -#endif - -/* Irix 6.5 fails to define this variable at all. This is needed - for both GCC and SGI's compiler. I'd say that the SGI headers - are just busted. Same thing for Solaris. */ -#if (defined(__sgi) || defined(sun)) && !defined(INET_ADDRSTRLEN) -#define INET_ADDRSTRLEN 16 -#endif - -/* Generic includes */ -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -/* Generic socket object definitions and includes */ -#define PySocket_BUILDING_SOCKET -#include "socketmodule.h" - -/* Addressing includes */ - -#ifndef MS_WINDOWS - -/* Non-MS WINDOWS includes */ -# include - -/* Headers needed for inet_ntoa() and inet_addr() */ -# ifdef __BEOS__ -# include -# elif defined(PYOS_OS2) && defined(PYCC_VACPP) -# include -typedef size_t socklen_t; -# else -# include -# endif - -# ifndef RISCOS -# include -# else -# include -# include -# define NO_DUP -int h_errno; /* not used */ -# define INET_ADDRSTRLEN 16 -# endif - -#else - -/* MS_WINDOWS includes */ -# ifdef HAVE_FCNTL_H -# include -# endif - -#endif - -#include - -#ifndef offsetof -# define offsetof(type, member) ((size_t)(&((type *)0)->member)) -#endif - -#ifndef O_NONBLOCK -# define O_NONBLOCK O_NDELAY -#endif - -/* include Python's addrinfo.h unless it causes trouble */ -#if defined(__sgi) && _COMPILER_VERSION>700 && defined(_SS_ALIGNSIZE) - /* Do not include addinfo.h on some newer IRIX versions. - * _SS_ALIGNSIZE is defined in sys/socket.h by 6.5.21, - * for example, but not by 6.5.10. - */ -#elif defined(_MSC_VER) && _MSC_VER>1201 - /* Do not include addrinfo.h for MSVC7 or greater. 'addrinfo' and - * EAI_* constants are defined in (the already included) ws2tcpip.h. - */ -#else -# include "addrinfo.h" -#endif - -#ifndef HAVE_INET_PTON -#if !defined(NTDDI_VERSION) || (NTDDI_VERSION < NTDDI_LONGHORN) -int inet_pton(int af, const char *src, void *dst); -const char *inet_ntop(int af, const void *src, char *dst, socklen_t size); -#endif -#endif - -#ifdef __APPLE__ -/* On OS X, getaddrinfo returns no error indication of lookup - failure, so we must use the emulation instead of the libinfo - implementation. Unfortunately, performing an autoconf test - for this bug would require DNS access for the machine performing - the configuration, which is not acceptable. Therefore, we - determine the bug just by checking for __APPLE__. If this bug - gets ever fixed, perhaps checking for sys/version.h would be - appropriate, which is 10/0 on the system with the bug. */ -#ifndef HAVE_GETNAMEINFO -/* This bug seems to be fixed in Jaguar. Ths easiest way I could - Find to check for Jaguar is that it has getnameinfo(), which - older releases don't have */ -#undef HAVE_GETADDRINFO -#endif - -#ifdef HAVE_INET_ATON -#define USE_INET_ATON_WEAKLINK -#endif - -#endif - -/* I know this is a bad practice, but it is the easiest... */ -#if !defined(HAVE_GETADDRINFO) -/* avoid clashes with the C library definition of the symbol. */ -#define getaddrinfo fake_getaddrinfo -#define gai_strerror fake_gai_strerror -#define freeaddrinfo fake_freeaddrinfo -#include "getaddrinfo.c" -#endif -#if !defined(HAVE_GETNAMEINFO) -#define getnameinfo fake_getnameinfo -#include "getnameinfo.c" -#endif - -#if defined(MS_WINDOWS) || defined(__BEOS__) -/* BeOS suffers from the same socket dichotomy as Win32... - [cjh] */ -/* seem to be a few differences in the API */ -#define SOCKETCLOSE closesocket -#define NO_DUP /* Actually it exists on NT 3.5, but what the heck... */ -#endif - -#ifdef MS_WIN32 -#define EAFNOSUPPORT WSAEAFNOSUPPORT -#define snprintf _snprintf -#endif - -#if defined(PYOS_OS2) && !defined(PYCC_GCC) -#define SOCKETCLOSE soclose -#define NO_DUP /* Sockets are Not Actual File Handles under OS/2 */ -#endif - -#ifndef SOCKETCLOSE -#define SOCKETCLOSE close -#endif - -#if (defined(HAVE_BLUETOOTH_H) || defined(HAVE_BLUETOOTH_BLUETOOTH_H)) && !defined(__NetBSD__) && !defined(__DragonFly__) -#define USE_BLUETOOTH 1 -#if defined(__FreeBSD__) -#define BTPROTO_L2CAP BLUETOOTH_PROTO_L2CAP -#define BTPROTO_RFCOMM BLUETOOTH_PROTO_RFCOMM -#define BTPROTO_HCI BLUETOOTH_PROTO_HCI -#define SOL_HCI SOL_HCI_RAW -#define HCI_FILTER SO_HCI_RAW_FILTER -#define sockaddr_l2 sockaddr_l2cap -#define sockaddr_rc sockaddr_rfcomm -#define hci_dev hci_node -#define _BT_L2_MEMB(sa, memb) ((sa)->l2cap_##memb) -#define _BT_RC_MEMB(sa, memb) ((sa)->rfcomm_##memb) -#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb) -#elif defined(__NetBSD__) || defined(__DragonFly__) -#define sockaddr_l2 sockaddr_bt -#define sockaddr_rc sockaddr_bt -#define sockaddr_hci sockaddr_bt -#define sockaddr_sco sockaddr_bt -#define SOL_HCI BTPROTO_HCI -#define HCI_DATA_DIR SO_HCI_DIRECTION -#define _BT_L2_MEMB(sa, memb) ((sa)->bt_##memb) -#define _BT_RC_MEMB(sa, memb) ((sa)->bt_##memb) -#define _BT_HCI_MEMB(sa, memb) ((sa)->bt_##memb) -#define _BT_SCO_MEMB(sa, memb) ((sa)->bt_##memb) -#else -#define _BT_L2_MEMB(sa, memb) ((sa)->l2_##memb) -#define _BT_RC_MEMB(sa, memb) ((sa)->rc_##memb) -#define _BT_HCI_MEMB(sa, memb) ((sa)->hci_##memb) -#define _BT_SCO_MEMB(sa, memb) ((sa)->sco_##memb) -#endif -#endif - -#ifdef __VMS -/* TCP/IP Services for VMS uses a maximum send/recv buffer length */ -#define SEGMENT_SIZE (32 * 1024 -1) -#endif - -#define SAS2SA(x) ((struct sockaddr *)(x)) - -/* - * Constants for getnameinfo() - */ -#if !defined(NI_MAXHOST) -#define NI_MAXHOST 1025 -#endif -#if !defined(NI_MAXSERV) -#define NI_MAXSERV 32 -#endif - -/* XXX There's a problem here: *static* functions are not supposed to have - a Py prefix (or use CapitalizedWords). Later... */ - -/* Global variable holding the exception type for errors detected - by this module (but not argument type or memory errors, etc.). */ -static PyObject *socket_error; -static PyObject *socket_herror; -static PyObject *socket_gaierror; -static PyObject *socket_timeout; - -#ifdef RISCOS -/* Global variable which is !=0 if Python is running in a RISC OS taskwindow */ -static int taskwindow; -#endif - -/* A forward reference to the socket type object. - The sock_type variable contains pointers to various functions, - some of which call new_sockobject(), which uses sock_type, so - there has to be a circular reference. */ -static PyTypeObject sock_type; - -#if defined(HAVE_POLL_H) -#include -#elif defined(HAVE_SYS_POLL_H) -#include -#endif - -#ifdef HAVE_POLL -/* Instead of select(), we'll use poll() since poll() works on any fd. */ -#define IS_SELECTABLE(s) 1 -/* Can we call select() with this socket without a buffer overrun? */ -#else -/* If there's no timeout left, we don't have to call select, so it's a safe, - * little white lie. */ -#define IS_SELECTABLE(s) (_PyIsSelectable_fd((s)->sock_fd) || (s)->sock_timeout <= 0.0) -#endif - -static PyObject* -select_error(void) -{ - PyErr_SetString(socket_error, "unable to select on socket"); - return NULL; -} - -#ifdef MS_WINDOWS -#ifndef WSAEAGAIN -#define WSAEAGAIN WSAEWOULDBLOCK -#endif -#define CHECK_ERRNO(expected) \ - (WSAGetLastError() == WSA ## expected) -#else -#define CHECK_ERRNO(expected) \ - (errno == expected) -#endif - -/* Convenience function to raise an error according to errno - and return a NULL pointer from a function. */ - -static PyObject * -set_error(void) -{ -#ifdef MS_WINDOWS - int err_no = WSAGetLastError(); - /* PyErr_SetExcFromWindowsErr() invokes FormatMessage() which - recognizes the error codes used by both GetLastError() and - WSAGetLastError */ - if (err_no) - return PyErr_SetExcFromWindowsErr(socket_error, err_no); -#endif - -#if defined(PYOS_OS2) && !defined(PYCC_GCC) - if (sock_errno() != NO_ERROR) { - APIRET rc; - ULONG msglen; - char outbuf[100]; - int myerrorcode = sock_errno(); - - /* Retrieve socket-related error message from MPTN.MSG file */ - rc = DosGetMessage(NULL, 0, outbuf, sizeof(outbuf), - myerrorcode - SOCBASEERR + 26, - "mptn.msg", - &msglen); - if (rc == NO_ERROR) { - PyObject *v; - - /* OS/2 doesn't guarantee a terminator */ - outbuf[msglen] = '\0'; - if (strlen(outbuf) > 0) { - /* If non-empty msg, trim CRLF */ - char *lastc = &outbuf[ strlen(outbuf)-1 ]; - while (lastc > outbuf && - isspace(Py_CHARMASK(*lastc))) { - /* Trim trailing whitespace (CRLF) */ - *lastc-- = '\0'; - } - } - v = Py_BuildValue("(is)", myerrorcode, outbuf); - if (v != NULL) { - PyErr_SetObject(socket_error, v); - Py_DECREF(v); - } - return NULL; - } - } -#endif - -#if defined(RISCOS) - if (_inet_error.errnum != NULL) { - PyObject *v; - v = Py_BuildValue("(is)", errno, _inet_err()); - if (v != NULL) { - PyErr_SetObject(socket_error, v); - Py_DECREF(v); - } - return NULL; - } -#endif - - return PyErr_SetFromErrno(socket_error); -} - - -static PyObject * -set_herror(int h_error) -{ - PyObject *v; - -#ifdef HAVE_HSTRERROR - v = Py_BuildValue("(is)", h_error, (char *)hstrerror(h_error)); -#else - v = Py_BuildValue("(is)", h_error, "host not found"); -#endif - if (v != NULL) { - PyErr_SetObject(socket_herror, v); - Py_DECREF(v); - } - - return NULL; -} - - -static PyObject * -set_gaierror(int error) -{ - PyObject *v; - -#ifdef EAI_SYSTEM - /* EAI_SYSTEM is not available on Windows XP. */ - if (error == EAI_SYSTEM) - return set_error(); -#endif - -#ifdef HAVE_GAI_STRERROR - v = Py_BuildValue("(is)", error, gai_strerror(error)); -#else - v = Py_BuildValue("(is)", error, "getaddrinfo failed"); -#endif - if (v != NULL) { - PyErr_SetObject(socket_gaierror, v); - Py_DECREF(v); - } - - return NULL; -} - -#ifdef __VMS -/* Function to send in segments */ -static int -sendsegmented(int sock_fd, char *buf, int len, int flags) -{ - int n = 0; - int remaining = len; - - while (remaining > 0) { - unsigned int segment; - - segment = (remaining >= SEGMENT_SIZE ? SEGMENT_SIZE : remaining); - n = send(sock_fd, buf, segment, flags); - if (n < 0) { - return n; - } - remaining -= segment; - buf += segment; - } /* end while */ - - return len; -} -#endif - -/* Function to perform the setting of socket blocking mode - internally. block = (1 | 0). */ -static int -internal_setblocking(PySocketSockObject *s, int block) -{ -#ifndef RISCOS -#ifndef MS_WINDOWS - int delay_flag; -#endif -#endif - - Py_BEGIN_ALLOW_THREADS -#ifdef __BEOS__ - block = !block; - setsockopt(s->sock_fd, SOL_SOCKET, SO_NONBLOCK, - (void *)(&block), sizeof(int)); -#else -#ifndef RISCOS -#ifndef MS_WINDOWS -#if defined(PYOS_OS2) && !defined(PYCC_GCC) - block = !block; - ioctl(s->sock_fd, FIONBIO, (caddr_t)&block, sizeof(block)); -#elif defined(__VMS) - block = !block; - ioctl(s->sock_fd, FIONBIO, (unsigned int *)&block); -#else /* !PYOS_OS2 && !__VMS */ - delay_flag = fcntl(s->sock_fd, F_GETFL, 0); - if (block) - delay_flag &= (~O_NONBLOCK); - else - delay_flag |= O_NONBLOCK; - fcntl(s->sock_fd, F_SETFL, delay_flag); -#endif /* !PYOS_OS2 */ -#else /* MS_WINDOWS */ - block = !block; - ioctlsocket(s->sock_fd, FIONBIO, (u_long*)&block); -#endif /* MS_WINDOWS */ -#else /* RISCOS */ - block = !block; - socketioctl(s->sock_fd, FIONBIO, (u_long*)&block); -#endif /* RISCOS */ -#endif /* __BEOS__ */ - Py_END_ALLOW_THREADS - - /* Since these don't return anything */ - return 1; -} - -/* Do a select()/poll() on the socket, if necessary (sock_timeout > 0). - The argument writing indicates the direction. - This does not raise an exception; we'll let our caller do that - after they've reacquired the interpreter lock. - Returns 1 on timeout, -1 on error, 0 otherwise. */ -static int -internal_select_ex(PySocketSockObject *s, int writing, double interval) -{ - int n; - - /* Nothing to do unless we're in timeout mode (not non-blocking) */ - if (s->sock_timeout <= 0.0) - return 0; - - /* Guard against closed socket */ - if (s->sock_fd < 0) - return 0; - - /* Handling this condition here simplifies the select loops */ - if (interval < 0.0) - return 1; - - /* Prefer poll, if available, since you can poll() any fd - * which can't be done with select(). */ -#ifdef HAVE_POLL - { - struct pollfd pollfd; - int timeout; - - pollfd.fd = s->sock_fd; - pollfd.events = writing ? POLLOUT : POLLIN; - - /* s->sock_timeout is in seconds, timeout in ms */ - timeout = (int)(interval * 1000 + 0.5); - n = poll(&pollfd, 1, timeout); - } -#else - { - /* Construct the arguments to select */ - fd_set fds; - struct timeval tv; - tv.tv_sec = (int)interval; - tv.tv_usec = (int)((interval - tv.tv_sec) * 1e6); - FD_ZERO(&fds); - FD_SET(s->sock_fd, &fds); - - /* See if the socket is ready */ - if (writing) - n = select(s->sock_fd+1, NULL, &fds, NULL, &tv); - else - n = select(s->sock_fd+1, &fds, NULL, NULL, &tv); - } -#endif - - if (n < 0) - return -1; - if (n == 0) - return 1; - return 0; -} - -static int -internal_select(PySocketSockObject *s, int writing) -{ - return internal_select_ex(s, writing, s->sock_timeout); -} - -/* - Two macros for automatic retry of select() in case of false positives - (for example, select() could indicate a socket is ready for reading - but the data then discarded by the OS because of a wrong checksum). - Here is an example of use: - - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 0, interval); - if (!timeout) - outlen = recv(s->sock_fd, cbuf, len, flags); - Py_END_ALLOW_THREADS - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - return -1; - } - END_SELECT_LOOP(s) -*/ -#define BEGIN_SELECT_LOOP(s) \ - { \ - double deadline, interval = s->sock_timeout; \ - int has_timeout = s->sock_timeout > 0.0; \ - if (has_timeout) { \ - deadline = _PyTime_FloatTime() + s->sock_timeout; \ - } \ - while (1) { \ - errno = 0; - -#define END_SELECT_LOOP(s) \ - if (!has_timeout || \ - (!CHECK_ERRNO(EWOULDBLOCK) && !CHECK_ERRNO(EAGAIN))) \ - break; \ - interval = deadline - _PyTime_FloatTime(); \ - } \ - } - -/* Initialize a new socket object. */ - -static double defaulttimeout = -1.0; /* Default timeout for new sockets */ - -PyMODINIT_FUNC -init_sockobject(PySocketSockObject *s, - SOCKET_T fd, int family, int type, int proto) -{ -#ifdef RISCOS - int block = 1; -#endif - s->sock_fd = fd; - s->sock_family = family; - s->sock_type = type; - s->sock_proto = proto; - s->sock_timeout = defaulttimeout; - - s->errorhandler = &set_error; - - if (defaulttimeout >= 0.0) - internal_setblocking(s, 0); - -#ifdef RISCOS - if (taskwindow) - socketioctl(s->sock_fd, 0x80046679, (u_long*)&block); -#endif -} - - -/* Create a new socket object. - This just creates the object and initializes it. - If the creation fails, return NULL and set an exception (implicit - in NEWOBJ()). */ - -static PySocketSockObject * -new_sockobject(SOCKET_T fd, int family, int type, int proto) -{ - PySocketSockObject *s; - s = (PySocketSockObject *) - PyType_GenericNew(&sock_type, NULL, NULL); - if (s != NULL) - init_sockobject(s, fd, family, type, proto); - return s; -} - - -/* Lock to allow python interpreter to continue, but only allow one - thread to be in gethostbyname or getaddrinfo */ -#if defined(USE_GETHOSTBYNAME_LOCK) || defined(USE_GETADDRINFO_LOCK) -static PyThread_type_lock netdb_lock; -#endif - - -/* Convert a string specifying a host name or one of a few symbolic - names to a numeric IP address. This usually calls gethostbyname() - to do the work; the names "" and "" are special. - Return the length (IPv4 should be 4 bytes), or negative if - an error occurred; then an exception is raised. */ - -static int -setipaddr(char *name, struct sockaddr *addr_ret, size_t addr_ret_size, int af) -{ - struct addrinfo hints, *res; - int error; - int d1, d2, d3, d4; - char ch; - - memset((void *) addr_ret, '\0', sizeof(*addr_ret)); - if (name[0] == '\0') { - int siz; - memset(&hints, 0, sizeof(hints)); - hints.ai_family = af; - hints.ai_socktype = SOCK_DGRAM; /*dummy*/ - hints.ai_flags = AI_PASSIVE; - Py_BEGIN_ALLOW_THREADS - ACQUIRE_GETADDRINFO_LOCK - error = getaddrinfo(NULL, "0", &hints, &res); - Py_END_ALLOW_THREADS - /* We assume that those thread-unsafe getaddrinfo() versions - *are* safe regarding their return value, ie. that a - subsequent call to getaddrinfo() does not destroy the - outcome of the first call. */ - RELEASE_GETADDRINFO_LOCK - if (error) { - set_gaierror(error); - return -1; - } - switch (res->ai_family) { - case AF_INET: - siz = 4; - break; -#ifdef ENABLE_IPV6 - case AF_INET6: - siz = 16; - break; -#endif - default: - freeaddrinfo(res); - PyErr_SetString(socket_error, - "unsupported address family"); - return -1; - } - if (res->ai_next) { - freeaddrinfo(res); - PyErr_SetString(socket_error, - "wildcard resolved to multiple address"); - return -1; - } - if (res->ai_addrlen < addr_ret_size) - addr_ret_size = res->ai_addrlen; - memcpy(addr_ret, res->ai_addr, addr_ret_size); - freeaddrinfo(res); - return siz; - } - if (name[0] == '<' && strcmp(name, "") == 0) { - struct sockaddr_in *sin; - if (af != AF_INET && af != AF_UNSPEC) { - PyErr_SetString(socket_error, - "address family mismatched"); - return -1; - } - sin = (struct sockaddr_in *)addr_ret; - memset((void *) sin, '\0', sizeof(*sin)); - sin->sin_family = AF_INET; -#ifdef HAVE_SOCKADDR_SA_LEN - sin->sin_len = sizeof(*sin); -#endif - sin->sin_addr.s_addr = INADDR_BROADCAST; - return sizeof(sin->sin_addr); - } - if (sscanf(name, "%d.%d.%d.%d%c", &d1, &d2, &d3, &d4, &ch) == 4 && - 0 <= d1 && d1 <= 255 && 0 <= d2 && d2 <= 255 && - 0 <= d3 && d3 <= 255 && 0 <= d4 && d4 <= 255) { - struct sockaddr_in *sin; - sin = (struct sockaddr_in *)addr_ret; - sin->sin_addr.s_addr = htonl( - ((long) d1 << 24) | ((long) d2 << 16) | - ((long) d3 << 8) | ((long) d4 << 0)); - sin->sin_family = AF_INET; -#ifdef HAVE_SOCKADDR_SA_LEN - sin->sin_len = sizeof(*sin); -#endif - return 4; - } - memset(&hints, 0, sizeof(hints)); - hints.ai_family = af; - Py_BEGIN_ALLOW_THREADS - ACQUIRE_GETADDRINFO_LOCK - error = getaddrinfo(name, NULL, &hints, &res); -#if defined(__digital__) && defined(__unix__) - if (error == EAI_NONAME && af == AF_UNSPEC) { - /* On Tru64 V5.1, numeric-to-addr conversion fails - if no address family is given. Assume IPv4 for now.*/ - hints.ai_family = AF_INET; - error = getaddrinfo(name, NULL, &hints, &res); - } -#endif - Py_END_ALLOW_THREADS - RELEASE_GETADDRINFO_LOCK /* see comment in setipaddr() */ - if (error) { - set_gaierror(error); - return -1; - } - if (res->ai_addrlen < addr_ret_size) - addr_ret_size = res->ai_addrlen; - memcpy((char *) addr_ret, res->ai_addr, addr_ret_size); - freeaddrinfo(res); - switch (addr_ret->sa_family) { - case AF_INET: - return 4; -#ifdef ENABLE_IPV6 - case AF_INET6: - return 16; -#endif - default: - PyErr_SetString(socket_error, "unknown address family"); - return -1; - } -} - - -/* Create a string object representing an IP address. - This is always a string of the form 'dd.dd.dd.dd' (with variable - size numbers). */ - -static PyObject * -makeipaddr(struct sockaddr *addr, int addrlen) -{ - char buf[NI_MAXHOST]; - int error; - - error = getnameinfo(addr, addrlen, buf, sizeof(buf), NULL, 0, - NI_NUMERICHOST); - if (error) { - set_gaierror(error); - return NULL; - } - return PyString_FromString(buf); -} - - -#ifdef USE_BLUETOOTH -/* Convert a string representation of a Bluetooth address into a numeric - address. Returns the length (6), or raises an exception and returns -1 if - an error occurred. */ - -static int -setbdaddr(char *name, bdaddr_t *bdaddr) -{ - unsigned int b0, b1, b2, b3, b4, b5; - char ch; - int n; - - n = sscanf(name, "%X:%X:%X:%X:%X:%X%c", - &b5, &b4, &b3, &b2, &b1, &b0, &ch); - if (n == 6 && (b0 | b1 | b2 | b3 | b4 | b5) < 256) { - bdaddr->b[0] = b0; - bdaddr->b[1] = b1; - bdaddr->b[2] = b2; - bdaddr->b[3] = b3; - bdaddr->b[4] = b4; - bdaddr->b[5] = b5; - return 6; - } else { - PyErr_SetString(socket_error, "bad bluetooth address"); - return -1; - } -} - -/* Create a string representation of the Bluetooth address. This is always a - string of the form 'XX:XX:XX:XX:XX:XX' where XX is a two digit hexadecimal - value (zero padded if necessary). */ - -static PyObject * -makebdaddr(bdaddr_t *bdaddr) -{ - char buf[(6 * 2) + 5 + 1]; - - sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", - bdaddr->b[5], bdaddr->b[4], bdaddr->b[3], - bdaddr->b[2], bdaddr->b[1], bdaddr->b[0]); - return PyString_FromString(buf); -} -#endif - - -/* Create an object representing the given socket address, - suitable for passing it back to bind(), connect() etc. - The family field of the sockaddr structure is inspected - to determine what kind of address it really is. */ - -/*ARGSUSED*/ -static PyObject * -makesockaddr(int sockfd, struct sockaddr *addr, int addrlen, int proto) -{ - if (addrlen == 0) { - /* No address -- may be recvfrom() from known socket */ - Py_INCREF(Py_None); - return Py_None; - } - -#ifdef __BEOS__ - /* XXX: BeOS version of accept() doesn't set family correctly */ - addr->sa_family = AF_INET; -#endif - - switch (addr->sa_family) { - - case AF_INET: - { - struct sockaddr_in *a; - PyObject *addrobj = makeipaddr(addr, sizeof(*a)); - PyObject *ret = NULL; - if (addrobj) { - a = (struct sockaddr_in *)addr; - ret = Py_BuildValue("Oi", addrobj, ntohs(a->sin_port)); - Py_DECREF(addrobj); - } - return ret; - } - -#if defined(AF_UNIX) - case AF_UNIX: - { - struct sockaddr_un *a = (struct sockaddr_un *) addr; -#ifdef linux - if (a->sun_path[0] == 0) { /* Linux abstract namespace */ - addrlen -= offsetof(struct sockaddr_un, sun_path); - return PyString_FromStringAndSize(a->sun_path, - addrlen); - } - else -#endif /* linux */ - { - /* regular NULL-terminated string */ - return PyString_FromString(a->sun_path); - } - } -#endif /* AF_UNIX */ - -#if defined(AF_NETLINK) - case AF_NETLINK: - { - struct sockaddr_nl *a = (struct sockaddr_nl *) addr; - return Py_BuildValue("II", a->nl_pid, a->nl_groups); - } -#endif /* AF_NETLINK */ - -#ifdef ENABLE_IPV6 - case AF_INET6: - { - struct sockaddr_in6 *a; - PyObject *addrobj = makeipaddr(addr, sizeof(*a)); - PyObject *ret = NULL; - if (addrobj) { - a = (struct sockaddr_in6 *)addr; - ret = Py_BuildValue("OiII", - addrobj, - ntohs(a->sin6_port), - ntohl(a->sin6_flowinfo), - a->sin6_scope_id); - Py_DECREF(addrobj); - } - return ret; - } -#endif - -#ifdef USE_BLUETOOTH - case AF_BLUETOOTH: - switch (proto) { - - case BTPROTO_L2CAP: - { - struct sockaddr_l2 *a = (struct sockaddr_l2 *) addr; - PyObject *addrobj = makebdaddr(&_BT_L2_MEMB(a, bdaddr)); - PyObject *ret = NULL; - if (addrobj) { - ret = Py_BuildValue("Oi", - addrobj, - _BT_L2_MEMB(a, psm)); - Py_DECREF(addrobj); - } - return ret; - } - - case BTPROTO_RFCOMM: - { - struct sockaddr_rc *a = (struct sockaddr_rc *) addr; - PyObject *addrobj = makebdaddr(&_BT_RC_MEMB(a, bdaddr)); - PyObject *ret = NULL; - if (addrobj) { - ret = Py_BuildValue("Oi", - addrobj, - _BT_RC_MEMB(a, channel)); - Py_DECREF(addrobj); - } - return ret; - } - - case BTPROTO_HCI: - { - struct sockaddr_hci *a = (struct sockaddr_hci *) addr; -#if defined(__NetBSD__) || defined(__DragonFly__) - return makebdaddr(&_BT_HCI_MEMB(a, bdaddr)); -#else - PyObject *ret = NULL; - ret = Py_BuildValue("i", _BT_HCI_MEMB(a, dev)); - return ret; -#endif - } - -#if !defined(__FreeBSD__) - case BTPROTO_SCO: - { - struct sockaddr_sco *a = (struct sockaddr_sco *) addr; - return makebdaddr(&_BT_SCO_MEMB(a, bdaddr)); - } -#endif - - default: - PyErr_SetString(PyExc_ValueError, - "Unknown Bluetooth protocol"); - return NULL; - } -#endif - -#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFNAME) - case AF_PACKET: - { - struct sockaddr_ll *a = (struct sockaddr_ll *)addr; - char *ifname = ""; - struct ifreq ifr; - /* need to look up interface name give index */ - if (a->sll_ifindex) { - ifr.ifr_ifindex = a->sll_ifindex; - if (ioctl(sockfd, SIOCGIFNAME, &ifr) == 0) - ifname = ifr.ifr_name; - } - return Py_BuildValue("shbhs#", - ifname, - ntohs(a->sll_protocol), - a->sll_pkttype, - a->sll_hatype, - a->sll_addr, - a->sll_halen); - } -#endif - -#ifdef HAVE_LINUX_TIPC_H - case AF_TIPC: - { - struct sockaddr_tipc *a = (struct sockaddr_tipc *) addr; - if (a->addrtype == TIPC_ADDR_NAMESEQ) { - return Py_BuildValue("IIIII", - a->addrtype, - a->addr.nameseq.type, - a->addr.nameseq.lower, - a->addr.nameseq.upper, - a->scope); - } else if (a->addrtype == TIPC_ADDR_NAME) { - return Py_BuildValue("IIIII", - a->addrtype, - a->addr.name.name.type, - a->addr.name.name.instance, - a->addr.name.name.instance, - a->scope); - } else if (a->addrtype == TIPC_ADDR_ID) { - return Py_BuildValue("IIIII", - a->addrtype, - a->addr.id.node, - a->addr.id.ref, - 0, - a->scope); - } else { - PyErr_SetString(PyExc_ValueError, - "Invalid address type"); - return NULL; - } - } -#endif - - /* More cases here... */ - - default: - /* If we don't know the address family, don't raise an - exception -- return it as a tuple. */ - return Py_BuildValue("is#", - addr->sa_family, - addr->sa_data, - sizeof(addr->sa_data)); - - } -} - - -/* Parse a socket address argument according to the socket object's - address family. Return 1 if the address was in the proper format, - 0 of not. The address is returned through addr_ret, its length - through len_ret. */ - -static int -getsockaddrarg(PySocketSockObject *s, PyObject *args, - struct sockaddr *addr_ret, int *len_ret) -{ - switch (s->sock_family) { - -#if defined(AF_UNIX) - case AF_UNIX: - { - struct sockaddr_un* addr; - char *path; - int len; - if (!PyArg_Parse(args, "t#", &path, &len)) - return 0; - - addr = (struct sockaddr_un*)addr_ret; -#ifdef linux - if (len > 0 && path[0] == 0) { - /* Linux abstract namespace extension */ - if (len > sizeof addr->sun_path) { - PyErr_SetString(socket_error, - "AF_UNIX path too long"); - return 0; - } - } - else -#endif /* linux */ - { - /* regular NULL-terminated string */ - if (len >= sizeof addr->sun_path) { - PyErr_SetString(socket_error, - "AF_UNIX path too long"); - return 0; - } - addr->sun_path[len] = 0; - } - addr->sun_family = s->sock_family; - memcpy(addr->sun_path, path, len); -#if defined(PYOS_OS2) - *len_ret = sizeof(*addr); -#else - *len_ret = len + offsetof(struct sockaddr_un, sun_path); -#endif - return 1; - } -#endif /* AF_UNIX */ - -#if defined(AF_NETLINK) - case AF_NETLINK: - { - struct sockaddr_nl* addr; - int pid, groups; - addr = (struct sockaddr_nl *)addr_ret; - if (!PyTuple_Check(args)) { - PyErr_Format( - PyExc_TypeError, - "getsockaddrarg: " - "AF_NETLINK address must be tuple, not %.500s", - Py_TYPE(args)->tp_name); - return 0; - } - if (!PyArg_ParseTuple(args, "II:getsockaddrarg", &pid, &groups)) - return 0; - addr->nl_family = AF_NETLINK; - addr->nl_pid = pid; - addr->nl_groups = groups; - *len_ret = sizeof(*addr); - return 1; - } -#endif - - case AF_INET: - { - struct sockaddr_in* addr; - char *host; - int port, result; - if (!PyTuple_Check(args)) { - PyErr_Format( - PyExc_TypeError, - "getsockaddrarg: " - "AF_INET address must be tuple, not %.500s", - Py_TYPE(args)->tp_name); - return 0; - } - if (!PyArg_ParseTuple(args, "eti:getsockaddrarg", - "idna", &host, &port)) - return 0; - addr=(struct sockaddr_in*)addr_ret; - result = setipaddr(host, (struct sockaddr *)addr, - sizeof(*addr), AF_INET); - PyMem_Free(host); - if (result < 0) - return 0; - if (port < 0 || port > 0xffff) { - PyErr_SetString( - PyExc_OverflowError, - "getsockaddrarg: port must be 0-65535."); - return 0; - } - addr->sin_family = AF_INET; - addr->sin_port = htons((short)port); - *len_ret = sizeof *addr; - return 1; - } - -#ifdef ENABLE_IPV6 - case AF_INET6: - { - struct sockaddr_in6* addr; - char *host; - int port, result; - unsigned int flowinfo, scope_id; - flowinfo = scope_id = 0; - if (!PyTuple_Check(args)) { - PyErr_Format( - PyExc_TypeError, - "getsockaddrarg: " - "AF_INET6 address must be tuple, not %.500s", - Py_TYPE(args)->tp_name); - return 0; - } - if (!PyArg_ParseTuple(args, "eti|II", - "idna", &host, &port, &flowinfo, - &scope_id)) { - return 0; - } - addr = (struct sockaddr_in6*)addr_ret; - result = setipaddr(host, (struct sockaddr *)addr, - sizeof(*addr), AF_INET6); - PyMem_Free(host); - if (result < 0) - return 0; - if (port < 0 || port > 0xffff) { - PyErr_SetString( - PyExc_OverflowError, - "getsockaddrarg: port must be 0-65535."); - return 0; - } - if (flowinfo > 0xfffff) { - PyErr_SetString( - PyExc_OverflowError, - "getsockaddrarg: flowinfo must be 0-1048575."); - return 0; - } - addr->sin6_family = s->sock_family; - addr->sin6_port = htons((short)port); - addr->sin6_flowinfo = htonl(flowinfo); - addr->sin6_scope_id = scope_id; - *len_ret = sizeof *addr; - return 1; - } -#endif - -#ifdef USE_BLUETOOTH - case AF_BLUETOOTH: - { - switch (s->sock_proto) { - case BTPROTO_L2CAP: - { - struct sockaddr_l2 *addr; - char *straddr; - - addr = (struct sockaddr_l2 *)addr_ret; - memset(addr, 0, sizeof(struct sockaddr_l2)); - _BT_L2_MEMB(addr, family) = AF_BLUETOOTH; - if (!PyArg_ParseTuple(args, "si", &straddr, - &_BT_L2_MEMB(addr, psm))) { - PyErr_SetString(socket_error, "getsockaddrarg: " - "wrong format"); - return 0; - } - if (setbdaddr(straddr, &_BT_L2_MEMB(addr, bdaddr)) < 0) - return 0; - - *len_ret = sizeof *addr; - return 1; - } - case BTPROTO_RFCOMM: - { - struct sockaddr_rc *addr; - char *straddr; - - addr = (struct sockaddr_rc *)addr_ret; - _BT_RC_MEMB(addr, family) = AF_BLUETOOTH; - if (!PyArg_ParseTuple(args, "si", &straddr, - &_BT_RC_MEMB(addr, channel))) { - PyErr_SetString(socket_error, "getsockaddrarg: " - "wrong format"); - return 0; - } - if (setbdaddr(straddr, &_BT_RC_MEMB(addr, bdaddr)) < 0) - return 0; - - *len_ret = sizeof *addr; - return 1; - } - case BTPROTO_HCI: - { - struct sockaddr_hci *addr = (struct sockaddr_hci *)addr_ret; -#if defined(__NetBSD__) || defined(__DragonFly__) - char *straddr = PyBytes_AS_STRING(args); - - _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; - if (straddr == NULL) { - PyErr_SetString(socket_error, "getsockaddrarg: " - "wrong format"); - return 0; - } - if (setbdaddr(straddr, &_BT_HCI_MEMB(addr, bdaddr)) < 0) - return 0; -#else - _BT_HCI_MEMB(addr, family) = AF_BLUETOOTH; - if (!PyArg_ParseTuple(args, "i", &_BT_HCI_MEMB(addr, dev))) { - PyErr_SetString(socket_error, "getsockaddrarg: " - "wrong format"); - return 0; - } -#endif - *len_ret = sizeof *addr; - return 1; - } -#if !defined(__FreeBSD__) - case BTPROTO_SCO: - { - struct sockaddr_sco *addr; - char *straddr; - - addr = (struct sockaddr_sco *)addr_ret; - _BT_SCO_MEMB(addr, family) = AF_BLUETOOTH; - straddr = PyString_AsString(args); - if (straddr == NULL) { - PyErr_SetString(socket_error, "getsockaddrarg: " - "wrong format"); - return 0; - } - if (setbdaddr(straddr, &_BT_SCO_MEMB(addr, bdaddr)) < 0) - return 0; - - *len_ret = sizeof *addr; - return 1; - } -#endif - default: - PyErr_SetString(socket_error, "getsockaddrarg: unknown Bluetooth protocol"); - return 0; - } - } -#endif - -#if defined(HAVE_NETPACKET_PACKET_H) && defined(SIOCGIFINDEX) - case AF_PACKET: - { - struct sockaddr_ll* addr; - struct ifreq ifr; - char *interfaceName; - int protoNumber; - int hatype = 0; - int pkttype = 0; - char *haddr = NULL; - unsigned int halen = 0; - - if (!PyTuple_Check(args)) { - PyErr_Format( - PyExc_TypeError, - "getsockaddrarg: " - "AF_PACKET address must be tuple, not %.500s", - Py_TYPE(args)->tp_name); - return 0; - } - if (!PyArg_ParseTuple(args, "si|iis#", &interfaceName, - &protoNumber, &pkttype, &hatype, - &haddr, &halen)) - return 0; - strncpy(ifr.ifr_name, interfaceName, sizeof(ifr.ifr_name)); - ifr.ifr_name[(sizeof(ifr.ifr_name))-1] = '\0'; - if (ioctl(s->sock_fd, SIOCGIFINDEX, &ifr) < 0) { - s->errorhandler(); - return 0; - } - if (halen > 8) { - PyErr_SetString(PyExc_ValueError, - "Hardware address must be 8 bytes or less"); - return 0; - } - if (protoNumber < 0 || protoNumber > 0xffff) { - PyErr_SetString( - PyExc_OverflowError, - "getsockaddrarg: protoNumber must be 0-65535."); - return 0; - } - addr = (struct sockaddr_ll*)addr_ret; - addr->sll_family = AF_PACKET; - addr->sll_protocol = htons((short)protoNumber); - addr->sll_ifindex = ifr.ifr_ifindex; - addr->sll_pkttype = pkttype; - addr->sll_hatype = hatype; - if (halen != 0) { - memcpy(&addr->sll_addr, haddr, halen); - } - addr->sll_halen = halen; - *len_ret = sizeof *addr; - return 1; - } -#endif - -#ifdef HAVE_LINUX_TIPC_H - case AF_TIPC: - { - unsigned int atype, v1, v2, v3; - unsigned int scope = TIPC_CLUSTER_SCOPE; - struct sockaddr_tipc *addr; - - if (!PyTuple_Check(args)) { - PyErr_Format( - PyExc_TypeError, - "getsockaddrarg: " - "AF_TIPC address must be tuple, not %.500s", - Py_TYPE(args)->tp_name); - return 0; - } - - if (!PyArg_ParseTuple(args, - "IIII|I;Invalid TIPC address format", - &atype, &v1, &v2, &v3, &scope)) - return 0; - - addr = (struct sockaddr_tipc *) addr_ret; - memset(addr, 0, sizeof(struct sockaddr_tipc)); - - addr->family = AF_TIPC; - addr->scope = scope; - addr->addrtype = atype; - - if (atype == TIPC_ADDR_NAMESEQ) { - addr->addr.nameseq.type = v1; - addr->addr.nameseq.lower = v2; - addr->addr.nameseq.upper = v3; - } else if (atype == TIPC_ADDR_NAME) { - addr->addr.name.name.type = v1; - addr->addr.name.name.instance = v2; - } else if (atype == TIPC_ADDR_ID) { - addr->addr.id.node = v1; - addr->addr.id.ref = v2; - } else { - /* Shouldn't happen */ - PyErr_SetString(PyExc_TypeError, "Invalid address type"); - return 0; - } - - *len_ret = sizeof(*addr); - - return 1; - } -#endif - - /* More cases here... */ - - default: - PyErr_SetString(socket_error, "getsockaddrarg: bad family"); - return 0; - - } -} - - -/* Get the address length according to the socket object's address family. - Return 1 if the family is known, 0 otherwise. The length is returned - through len_ret. */ - -static int -getsockaddrlen(PySocketSockObject *s, socklen_t *len_ret) -{ - switch (s->sock_family) { - -#if defined(AF_UNIX) - case AF_UNIX: - { - *len_ret = sizeof (struct sockaddr_un); - return 1; - } -#endif /* AF_UNIX */ -#if defined(AF_NETLINK) - case AF_NETLINK: - { - *len_ret = sizeof (struct sockaddr_nl); - return 1; - } -#endif - - case AF_INET: - { - *len_ret = sizeof (struct sockaddr_in); - return 1; - } - -#ifdef ENABLE_IPV6 - case AF_INET6: - { - *len_ret = sizeof (struct sockaddr_in6); - return 1; - } -#endif - -#ifdef USE_BLUETOOTH - case AF_BLUETOOTH: - { - switch(s->sock_proto) - { - - case BTPROTO_L2CAP: - *len_ret = sizeof (struct sockaddr_l2); - return 1; - case BTPROTO_RFCOMM: - *len_ret = sizeof (struct sockaddr_rc); - return 1; - case BTPROTO_HCI: - *len_ret = sizeof (struct sockaddr_hci); - return 1; -#if !defined(__FreeBSD__) - case BTPROTO_SCO: - *len_ret = sizeof (struct sockaddr_sco); - return 1; -#endif - default: - PyErr_SetString(socket_error, "getsockaddrlen: " - "unknown BT protocol"); - return 0; - - } - } -#endif - -#ifdef HAVE_NETPACKET_PACKET_H - case AF_PACKET: - { - *len_ret = sizeof (struct sockaddr_ll); - return 1; - } -#endif - -#ifdef HAVE_LINUX_TIPC_H - case AF_TIPC: - { - *len_ret = sizeof (struct sockaddr_tipc); - return 1; - } -#endif - - /* More cases here... */ - - default: - PyErr_SetString(socket_error, "getsockaddrlen: bad family"); - return 0; - - } -} - - -/* s.accept() method */ - -static PyObject * -sock_accept(PySocketSockObject *s) -{ - sock_addr_t addrbuf; - SOCKET_T newfd; - socklen_t addrlen; - PyObject *sock = NULL; - PyObject *addr = NULL; - PyObject *res = NULL; - int timeout; - - if (!getsockaddrlen(s, &addrlen)) - return NULL; - memset(&addrbuf, 0, addrlen); - - newfd = INVALID_SOCKET; - - if (!IS_SELECTABLE(s)) - return select_error(); - - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 0, interval); - if (!timeout) - newfd = accept(s->sock_fd, SAS2SA(&addrbuf), &addrlen); - Py_END_ALLOW_THREADS - - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - return NULL; - } - END_SELECT_LOOP(s) - - if (newfd == INVALID_SOCKET) - return s->errorhandler(); - - /* Create the new object with unspecified family, - to avoid calls to bind() etc. on it. */ - sock = (PyObject *) new_sockobject(newfd, - s->sock_family, - s->sock_type, - s->sock_proto); - - if (sock == NULL) { - SOCKETCLOSE(newfd); - goto finally; - } - addr = makesockaddr(s->sock_fd, SAS2SA(&addrbuf), - addrlen, s->sock_proto); - if (addr == NULL) - goto finally; - - res = PyTuple_Pack(2, sock, addr); - -finally: - Py_XDECREF(sock); - Py_XDECREF(addr); - return res; -} - -PyDoc_STRVAR(accept_doc, -"accept() -> (socket object, address info)\n\ -\n\ -Wait for an incoming connection. Return a new socket representing the\n\ -connection, and the address of the client. For IP sockets, the address\n\ -info is a pair (hostaddr, port)."); - -/* s.setblocking(flag) method. Argument: - False -- non-blocking mode; same as settimeout(0) - True -- blocking mode; same as settimeout(None) -*/ - -static PyObject * -sock_setblocking(PySocketSockObject *s, PyObject *arg) -{ - long block; - - block = PyInt_AsLong(arg); - if (block == -1 && PyErr_Occurred()) - return NULL; - - s->sock_timeout = block ? -1.0 : 0.0; - internal_setblocking(s, block); - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setblocking_doc, -"setblocking(flag)\n\ -\n\ -Set the socket to blocking (flag is true) or non-blocking (false).\n\ -setblocking(True) is equivalent to settimeout(None);\n\ -setblocking(False) is equivalent to settimeout(0.0)."); - -/* s.settimeout(timeout) method. Argument: - None -- no timeout, blocking mode; same as setblocking(True) - 0.0 -- non-blocking mode; same as setblocking(False) - > 0 -- timeout mode; operations time out after timeout seconds - < 0 -- illegal; raises an exception -*/ -static PyObject * -sock_settimeout(PySocketSockObject *s, PyObject *arg) -{ - double timeout; - - if (arg == Py_None) - timeout = -1.0; - else { - timeout = PyFloat_AsDouble(arg); - if (timeout < 0.0) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_ValueError, - "Timeout value out of range"); - return NULL; - } - } - - s->sock_timeout = timeout; - internal_setblocking(s, timeout < 0.0); - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(settimeout_doc, -"settimeout(timeout)\n\ -\n\ -Set a timeout on socket operations. 'timeout' can be a float,\n\ -giving in seconds, or None. Setting a timeout of None disables\n\ -the timeout feature and is equivalent to setblocking(1).\n\ -Setting a timeout of zero is the same as setblocking(0)."); - -/* s.gettimeout() method. - Returns the timeout associated with a socket. */ -static PyObject * -sock_gettimeout(PySocketSockObject *s) -{ - if (s->sock_timeout < 0.0) { - Py_INCREF(Py_None); - return Py_None; - } - else - return PyFloat_FromDouble(s->sock_timeout); -} - -PyDoc_STRVAR(gettimeout_doc, -"gettimeout() -> timeout\n\ -\n\ -Returns the timeout in seconds (float) associated with socket \n\ -operations. A timeout of None indicates that timeouts on socket \n\ -operations are disabled."); - -#ifdef RISCOS -/* s.sleeptaskw(1 | 0) method */ - -static PyObject * -sock_sleeptaskw(PySocketSockObject *s,PyObject *arg) -{ - int block; - block = PyInt_AsLong(arg); - if (block == -1 && PyErr_Occurred()) - return NULL; - Py_BEGIN_ALLOW_THREADS - socketioctl(s->sock_fd, 0x80046679, (u_long*)&block); - Py_END_ALLOW_THREADS - - Py_INCREF(Py_None); - return Py_None; -} -PyDoc_STRVAR(sleeptaskw_doc, -"sleeptaskw(flag)\n\ -\n\ -Allow sleeps in taskwindows."); -#endif - - -/* s.setsockopt() method. - With an integer third argument, sets an integer option. - With a string third argument, sets an option from a buffer; - use optional built-in module 'struct' to encode the string. */ - -static PyObject * -sock_setsockopt(PySocketSockObject *s, PyObject *args) -{ - int level; - int optname; - int res; - char *buf; - int buflen; - int flag; - - if (PyArg_ParseTuple(args, "iii:setsockopt", - &level, &optname, &flag)) { - buf = (char *) &flag; - buflen = sizeof flag; - } - else { - PyErr_Clear(); - if (!PyArg_ParseTuple(args, "iis#:setsockopt", - &level, &optname, &buf, &buflen)) - return NULL; - } - res = setsockopt(s->sock_fd, level, optname, (void *)buf, buflen); - if (res < 0) - return s->errorhandler(); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setsockopt_doc, -"setsockopt(level, option, value)\n\ -\n\ -Set a socket option. See the Unix manual for level and option.\n\ -The value argument can either be an integer or a string."); - - -/* s.getsockopt() method. - With two arguments, retrieves an integer option. - With a third integer argument, retrieves a string buffer of that size; - use optional built-in module 'struct' to decode the string. */ - -static PyObject * -sock_getsockopt(PySocketSockObject *s, PyObject *args) -{ - int level; - int optname; - int res; - PyObject *buf; - socklen_t buflen = 0; - -#ifdef __BEOS__ - /* We have incomplete socket support. */ - PyErr_SetString(socket_error, "getsockopt not supported"); - return NULL; -#else - - if (!PyArg_ParseTuple(args, "ii|i:getsockopt", - &level, &optname, &buflen)) - return NULL; - - if (buflen == 0) { - int flag = 0; - socklen_t flagsize = sizeof flag; - res = getsockopt(s->sock_fd, level, optname, - (void *)&flag, &flagsize); - if (res < 0) - return s->errorhandler(); - return PyInt_FromLong(flag); - } -#ifdef __VMS - /* socklen_t is unsigned so no negative test is needed, - test buflen == 0 is previously done */ - if (buflen > 1024) { -#else - if (buflen <= 0 || buflen > 1024) { -#endif - PyErr_SetString(socket_error, - "getsockopt buflen out of range"); - return NULL; - } - buf = PyString_FromStringAndSize((char *)NULL, buflen); - if (buf == NULL) - return NULL; - res = getsockopt(s->sock_fd, level, optname, - (void *)PyString_AS_STRING(buf), &buflen); - if (res < 0) { - Py_DECREF(buf); - return s->errorhandler(); - } - _PyString_Resize(&buf, buflen); - return buf; -#endif /* __BEOS__ */ -} - -PyDoc_STRVAR(getsockopt_doc, -"getsockopt(level, option[, buffersize]) -> value\n\ -\n\ -Get a socket option. See the Unix manual for level and option.\n\ -If a nonzero buffersize argument is given, the return value is a\n\ -string of that length; otherwise it is an integer."); - - -/* s.bind(sockaddr) method */ - -static PyObject * -sock_bind(PySocketSockObject *s, PyObject *addro) -{ - sock_addr_t addrbuf; - int addrlen; - int res; - - if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = bind(s->sock_fd, SAS2SA(&addrbuf), addrlen); - Py_END_ALLOW_THREADS - if (res < 0) - return s->errorhandler(); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(bind_doc, -"bind(address)\n\ -\n\ -Bind the socket to a local address. For IP sockets, the address is a\n\ -pair (host, port); the host must refer to the local host. For raw packet\n\ -sockets the address is a tuple (ifname, proto [,pkttype [,hatype]])"); - - -/* s.close() method. - Set the file descriptor to -1 so operations tried subsequently - will surely fail. */ - -static PyObject * -sock_close(PySocketSockObject *s) -{ - SOCKET_T fd; - - if ((fd = s->sock_fd) != -1) { - s->sock_fd = -1; - Py_BEGIN_ALLOW_THREADS - (void) SOCKETCLOSE(fd); - Py_END_ALLOW_THREADS - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(close_doc, -"close()\n\ -\n\ -Close the socket. It cannot be used after this call."); - -static int -internal_connect(PySocketSockObject *s, struct sockaddr *addr, int addrlen, - int *timeoutp) -{ - int res, timeout; - - timeout = 0; - res = connect(s->sock_fd, addr, addrlen); - -#ifdef MS_WINDOWS - - if (s->sock_timeout > 0.0) { - if (res < 0 && WSAGetLastError() == WSAEWOULDBLOCK && - IS_SELECTABLE(s)) { - /* This is a mess. Best solution: trust select */ - fd_set fds; - fd_set fds_exc; - struct timeval tv; - tv.tv_sec = (int)s->sock_timeout; - tv.tv_usec = (int)((s->sock_timeout - tv.tv_sec) * 1e6); - FD_ZERO(&fds); - FD_SET(s->sock_fd, &fds); - FD_ZERO(&fds_exc); - FD_SET(s->sock_fd, &fds_exc); - res = select(s->sock_fd+1, NULL, &fds, &fds_exc, &tv); - if (res == 0) { - res = WSAEWOULDBLOCK; - timeout = 1; - } else if (res > 0) { - if (FD_ISSET(s->sock_fd, &fds)) - /* The socket is in the writeable set - this - means connected */ - res = 0; - else { - /* As per MS docs, we need to call getsockopt() - to get the underlying error */ - int res_size = sizeof res; - /* It must be in the exception set */ - assert(FD_ISSET(s->sock_fd, &fds_exc)); - if (0 == getsockopt(s->sock_fd, SOL_SOCKET, SO_ERROR, - (char *)&res, &res_size)) - /* getsockopt also clears WSAGetLastError, - so reset it back. */ - WSASetLastError(res); - else - res = WSAGetLastError(); - } - } - /* else if (res < 0) an error occurred */ - } - } - - if (res < 0) - res = WSAGetLastError(); - -#else - - if (s->sock_timeout > 0.0) { - if (res < 0 && errno == EINPROGRESS && IS_SELECTABLE(s)) { - timeout = internal_select(s, 1); - if (timeout == 0) { - /* Bug #1019808: in case of an EINPROGRESS, - use getsockopt(SO_ERROR) to get the real - error. */ - socklen_t res_size = sizeof res; - (void)getsockopt(s->sock_fd, SOL_SOCKET, - SO_ERROR, &res, &res_size); - if (res == EISCONN) - res = 0; - errno = res; - } - else if (timeout == -1) { - res = errno; /* had error */ - } - else - res = EWOULDBLOCK; /* timed out */ - } - } - - if (res < 0) - res = errno; - -#endif - *timeoutp = timeout; - - return res; -} - -/* s.connect(sockaddr) method */ - -static PyObject * -sock_connect(PySocketSockObject *s, PyObject *addro) -{ - sock_addr_t addrbuf; - int addrlen; - int res; - int timeout; - - if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - res = internal_connect(s, SAS2SA(&addrbuf), addrlen, &timeout); - Py_END_ALLOW_THREADS - - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - return NULL; - } - if (res != 0) - return s->errorhandler(); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(connect_doc, -"connect(address)\n\ -\n\ -Connect the socket to a remote address. For IP sockets, the address\n\ -is a pair (host, port)."); - - -/* s.connect_ex(sockaddr) method */ - -static PyObject * -sock_connect_ex(PySocketSockObject *s, PyObject *addro) -{ - sock_addr_t addrbuf; - int addrlen; - int res; - int timeout; - - if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - res = internal_connect(s, SAS2SA(&addrbuf), addrlen, &timeout); - Py_END_ALLOW_THREADS - - /* Signals are not errors (though they may raise exceptions). Adapted - from PyErr_SetFromErrnoWithFilenameObject(). */ -#ifdef EINTR - if (res == EINTR && PyErr_CheckSignals()) - return NULL; -#endif - - return PyInt_FromLong((long) res); -} - -PyDoc_STRVAR(connect_ex_doc, -"connect_ex(address) -> errno\n\ -\n\ -This is like connect(address), but returns an error code (the errno value)\n\ -instead of raising an exception when an error occurs."); - - -/* s.fileno() method */ - -static PyObject * -sock_fileno(PySocketSockObject *s) -{ -#if SIZEOF_SOCKET_T <= SIZEOF_LONG - return PyInt_FromLong((long) s->sock_fd); -#else - return PyLong_FromLongLong((PY_LONG_LONG)s->sock_fd); -#endif -} - -PyDoc_STRVAR(fileno_doc, -"fileno() -> integer\n\ -\n\ -Return the integer file descriptor of the socket."); - - -#ifndef NO_DUP -/* s.dup() method */ - -static PyObject * -sock_dup(PySocketSockObject *s) -{ - SOCKET_T newfd; - PyObject *sock; - - newfd = dup(s->sock_fd); - if (newfd < 0) - return s->errorhandler(); - sock = (PyObject *) new_sockobject(newfd, - s->sock_family, - s->sock_type, - s->sock_proto); - if (sock == NULL) - SOCKETCLOSE(newfd); - return sock; -} - -PyDoc_STRVAR(dup_doc, -"dup() -> socket object\n\ -\n\ -Return a new socket object connected to the same system resource."); - -#endif - - -/* s.getsockname() method */ - -static PyObject * -sock_getsockname(PySocketSockObject *s) -{ - sock_addr_t addrbuf; - int res; - socklen_t addrlen; - - if (!getsockaddrlen(s, &addrlen)) - return NULL; - memset(&addrbuf, 0, addrlen); - Py_BEGIN_ALLOW_THREADS - res = getsockname(s->sock_fd, SAS2SA(&addrbuf), &addrlen); - Py_END_ALLOW_THREADS - if (res < 0) - return s->errorhandler(); - return makesockaddr(s->sock_fd, SAS2SA(&addrbuf), addrlen, - s->sock_proto); -} - -PyDoc_STRVAR(getsockname_doc, -"getsockname() -> address info\n\ -\n\ -Return the address of the local endpoint. For IP sockets, the address\n\ -info is a pair (hostaddr, port)."); - - -#ifdef HAVE_GETPEERNAME /* Cray APP doesn't have this :-( */ -/* s.getpeername() method */ - -static PyObject * -sock_getpeername(PySocketSockObject *s) -{ - sock_addr_t addrbuf; - int res; - socklen_t addrlen; - - if (!getsockaddrlen(s, &addrlen)) - return NULL; - memset(&addrbuf, 0, addrlen); - Py_BEGIN_ALLOW_THREADS - res = getpeername(s->sock_fd, SAS2SA(&addrbuf), &addrlen); - Py_END_ALLOW_THREADS - if (res < 0) - return s->errorhandler(); - return makesockaddr(s->sock_fd, SAS2SA(&addrbuf), addrlen, - s->sock_proto); -} - -PyDoc_STRVAR(getpeername_doc, -"getpeername() -> address info\n\ -\n\ -Return the address of the remote endpoint. For IP sockets, the address\n\ -info is a pair (hostaddr, port)."); - -#endif /* HAVE_GETPEERNAME */ - - -/* s.listen(n) method */ - -static PyObject * -sock_listen(PySocketSockObject *s, PyObject *arg) -{ - int backlog; - int res; - - backlog = _PyInt_AsInt(arg); - if (backlog == -1 && PyErr_Occurred()) - return NULL; - Py_BEGIN_ALLOW_THREADS - /* To avoid problems on systems that don't allow a negative backlog - * (which doesn't make sense anyway) we force a minimum value of 0. */ - if (backlog < 0) - backlog = 0; - res = listen(s->sock_fd, backlog); - Py_END_ALLOW_THREADS - if (res < 0) - return s->errorhandler(); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(listen_doc, -"listen(backlog)\n\ -\n\ -Enable a server to accept connections. The backlog argument must be at\n\ -least 0 (if it is lower, it is set to 0); it specifies the number of\n\ -unaccepted connections that the system will allow before refusing new\n\ -connections."); - - -#ifndef NO_DUP -/* s.makefile(mode) method. - Create a new open file object referring to a dupped version of - the socket's file descriptor. (The dup() call is necessary so - that the open file and socket objects may be closed independent - of each other.) - The mode argument specifies 'r' or 'w' passed to fdopen(). */ - -static PyObject * -sock_makefile(PySocketSockObject *s, PyObject *args) -{ - extern int fclose(FILE *); - char *mode = "r"; - int bufsize = -1; -#ifdef MS_WIN32 - Py_intptr_t fd; -#else - int fd; -#endif - FILE *fp; - PyObject *f; -#ifdef __VMS - char *mode_r = "r"; - char *mode_w = "w"; -#endif - - if (!PyArg_ParseTuple(args, "|si:makefile", &mode, &bufsize)) - return NULL; -#ifdef __VMS - if (strcmp(mode,"rb") == 0) { - mode = mode_r; - } - else { - if (strcmp(mode,"wb") == 0) { - mode = mode_w; - } - } -#endif -#ifdef MS_WIN32 - if (((fd = _open_osfhandle(s->sock_fd, _O_BINARY)) < 0) || - ((fd = dup(fd)) < 0) || ((fp = fdopen(fd, mode)) == NULL)) -#else - if ((fd = dup(s->sock_fd)) < 0 || (fp = fdopen(fd, mode)) == NULL) -#endif - { - if (fd >= 0) - SOCKETCLOSE(fd); - return s->errorhandler(); - } - f = PyFile_FromFile(fp, "", mode, fclose); - if (f != NULL) - PyFile_SetBufSize(f, bufsize); - return f; -} - -PyDoc_STRVAR(makefile_doc, -"makefile([mode[, buffersize]]) -> file object\n\ -\n\ -Return a regular file object corresponding to the socket.\n\ -The mode and buffersize arguments are as for the built-in open() function."); - -#endif /* NO_DUP */ - -/* - * This is the guts of the recv() and recv_into() methods, which reads into a - * char buffer. If you have any inc/dec ref to do to the objects that contain - * the buffer, do it in the caller. This function returns the number of bytes - * successfully read. If there was an error, it returns -1. Note that it is - * also possible that we return a number of bytes smaller than the request - * bytes. - */ -static ssize_t -sock_recv_guts(PySocketSockObject *s, char* cbuf, int len, int flags) -{ - ssize_t outlen = -1; - int timeout; -#ifdef __VMS - int remaining; - char *read_buf; -#endif - - if (!IS_SELECTABLE(s)) { - select_error(); - return -1; - } - -#ifndef __VMS - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 0, interval); - if (!timeout) - outlen = recv(s->sock_fd, cbuf, len, flags); - Py_END_ALLOW_THREADS - - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - return -1; - } - END_SELECT_LOOP(s) - if (outlen < 0) { - /* Note: the call to errorhandler() ALWAYS indirectly returned - NULL, so ignore its return value */ - s->errorhandler(); - return -1; - } -#else - read_buf = cbuf; - remaining = len; - while (remaining != 0) { - unsigned int segment; - int nread = -1; - - segment = remaining /SEGMENT_SIZE; - if (segment != 0) { - segment = SEGMENT_SIZE; - } - else { - segment = remaining; - } - - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 0, interval); - if (!timeout) - nread = recv(s->sock_fd, read_buf, segment, flags); - Py_END_ALLOW_THREADS - - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - return -1; - } - END_SELECT_LOOP(s) - - if (nread < 0) { - s->errorhandler(); - return -1; - } - if (nread != remaining) { - read_buf += nread; - break; - } - - remaining -= segment; - read_buf += segment; - } - outlen = read_buf - cbuf; -#endif /* !__VMS */ - - return outlen; -} - - -/* s.recv(nbytes [,flags]) method */ - -static PyObject * -sock_recv(PySocketSockObject *s, PyObject *args) -{ - int recvlen, flags = 0; - ssize_t outlen; - PyObject *buf; - - if (!PyArg_ParseTuple(args, "i|i:recv", &recvlen, &flags)) - return NULL; - - if (recvlen < 0) { - PyErr_SetString(PyExc_ValueError, - "negative buffersize in recv"); - return NULL; - } - - /* Allocate a new string. */ - buf = PyString_FromStringAndSize((char *) 0, recvlen); - if (buf == NULL) - return NULL; - - /* Call the guts */ - outlen = sock_recv_guts(s, PyString_AS_STRING(buf), recvlen, flags); - if (outlen < 0) { - /* An error occurred, release the string and return an - error. */ - Py_DECREF(buf); - return NULL; - } - if (outlen != recvlen) { - /* We did not read as many bytes as we anticipated, resize the - string if possible and be successful. */ - if (_PyString_Resize(&buf, outlen) < 0) - /* Oopsy, not so successful after all. */ - return NULL; - } - - return buf; -} - -PyDoc_STRVAR(recv_doc, -"recv(buffersize[, flags]) -> data\n\ -\n\ -Receive up to buffersize bytes from the socket. For the optional flags\n\ -argument, see the Unix manual. When no data is available, block until\n\ -at least one byte is available or until the remote end is closed. When\n\ -the remote end is closed and all data is read, return the empty string."); - - -/* s.recv_into(buffer, [nbytes [,flags]]) method */ - -static PyObject* -sock_recv_into(PySocketSockObject *s, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"buffer", "nbytes", "flags", 0}; - - int recvlen = 0, flags = 0; - ssize_t readlen; - Py_buffer buf; - Py_ssize_t buflen; - - /* Get the buffer's memory */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "w*|ii:recv_into", kwlist, - &buf, &recvlen, &flags)) - return NULL; - buflen = buf.len; - assert(buf.buf != 0 && buflen > 0); - - if (recvlen < 0) { - PyErr_SetString(PyExc_ValueError, - "negative buffersize in recv_into"); - goto error; - } - if (recvlen == 0) { - /* If nbytes was not specified, use the buffer's length */ - recvlen = buflen; - } - - /* Check if the buffer is large enough */ - if (buflen < recvlen) { - PyErr_SetString(PyExc_ValueError, - "buffer too small for requested bytes"); - goto error; - } - - /* Call the guts */ - readlen = sock_recv_guts(s, buf.buf, recvlen, flags); - if (readlen < 0) { - /* Return an error. */ - goto error; - } - - PyBuffer_Release(&buf); - /* Return the number of bytes read. Note that we do not do anything - special here in the case that readlen < recvlen. */ - return PyInt_FromSsize_t(readlen); - -error: - PyBuffer_Release(&buf); - return NULL; -} - -PyDoc_STRVAR(recv_into_doc, -"recv_into(buffer, [nbytes[, flags]]) -> nbytes_read\n\ -\n\ -A version of recv() that stores its data into a buffer rather than creating \n\ -a new string. Receive up to buffersize bytes from the socket. If buffersize \n\ -is not specified (or 0), receive up to the size available in the given buffer.\n\ -\n\ -See recv() for documentation about the flags."); - - -/* - * This is the guts of the recvfrom() and recvfrom_into() methods, which reads - * into a char buffer. If you have any inc/def ref to do to the objects that - * contain the buffer, do it in the caller. This function returns the number - * of bytes successfully read. If there was an error, it returns -1. Note - * that it is also possible that we return a number of bytes smaller than the - * request bytes. - * - * 'addr' is a return value for the address object. Note that you must decref - * it yourself. - */ -static ssize_t -sock_recvfrom_guts(PySocketSockObject *s, char* cbuf, int len, int flags, - PyObject** addr) -{ - sock_addr_t addrbuf; - int timeout; - ssize_t n = -1; - socklen_t addrlen; - - *addr = NULL; - - if (!getsockaddrlen(s, &addrlen)) - return -1; - - if (!IS_SELECTABLE(s)) { - select_error(); - return -1; - } - - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - memset(&addrbuf, 0, addrlen); - timeout = internal_select_ex(s, 0, interval); - if (!timeout) { -#ifndef MS_WINDOWS -#if defined(PYOS_OS2) && !defined(PYCC_GCC) - n = recvfrom(s->sock_fd, cbuf, len, flags, - SAS2SA(&addrbuf), &addrlen); -#else - n = recvfrom(s->sock_fd, cbuf, len, flags, - (void *) &addrbuf, &addrlen); -#endif -#else - n = recvfrom(s->sock_fd, cbuf, len, flags, - SAS2SA(&addrbuf), &addrlen); -#endif - } - Py_END_ALLOW_THREADS - - if (timeout == 1) { - PyErr_SetString(socket_timeout, "timed out"); - return -1; - } - END_SELECT_LOOP(s) - if (n < 0) { - s->errorhandler(); - return -1; - } - - if (!(*addr = makesockaddr(s->sock_fd, SAS2SA(&addrbuf), - addrlen, s->sock_proto))) - return -1; - - return n; -} - -/* s.recvfrom(nbytes [,flags]) method */ - -static PyObject * -sock_recvfrom(PySocketSockObject *s, PyObject *args) -{ - PyObject *buf = NULL; - PyObject *addr = NULL; - PyObject *ret = NULL; - int recvlen, flags = 0; - ssize_t outlen; - - if (!PyArg_ParseTuple(args, "i|i:recvfrom", &recvlen, &flags)) - return NULL; - - if (recvlen < 0) { - PyErr_SetString(PyExc_ValueError, - "negative buffersize in recvfrom"); - return NULL; - } - - buf = PyString_FromStringAndSize((char *) 0, recvlen); - if (buf == NULL) - return NULL; - - outlen = sock_recvfrom_guts(s, PyString_AS_STRING(buf), - recvlen, flags, &addr); - if (outlen < 0) { - goto finally; - } - - if (outlen != recvlen) { - /* We did not read as many bytes as we anticipated, resize the - string if possible and be successful. */ - if (_PyString_Resize(&buf, outlen) < 0) - /* Oopsy, not so successful after all. */ - goto finally; - } - - ret = PyTuple_Pack(2, buf, addr); - -finally: - Py_XDECREF(buf); - Py_XDECREF(addr); - return ret; -} - -PyDoc_STRVAR(recvfrom_doc, -"recvfrom(buffersize[, flags]) -> (data, address info)\n\ -\n\ -Like recv(buffersize, flags) but also return the sender's address info."); - - -/* s.recvfrom_into(buffer[, nbytes [,flags]]) method */ - -static PyObject * -sock_recvfrom_into(PySocketSockObject *s, PyObject *args, PyObject* kwds) -{ - static char *kwlist[] = {"buffer", "nbytes", "flags", 0}; - - int recvlen = 0, flags = 0; - ssize_t readlen; - Py_buffer buf; - int buflen; - - PyObject *addr = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "w*|ii:recvfrom_into", - kwlist, &buf, - &recvlen, &flags)) - return NULL; - buflen = buf.len; - - if (recvlen < 0) { - PyErr_SetString(PyExc_ValueError, - "negative buffersize in recvfrom_into"); - goto error; - } - if (recvlen == 0) { - /* If nbytes was not specified, use the buffer's length */ - recvlen = buflen; - } else if (recvlen > buflen) { - PyErr_SetString(PyExc_ValueError, - "nbytes is greater than the length of the buffer"); - goto error; - } - - readlen = sock_recvfrom_guts(s, buf.buf, recvlen, flags, &addr); - if (readlen < 0) { - /* Return an error */ - goto error; - } - - PyBuffer_Release(&buf); - /* Return the number of bytes read and the address. Note that we do - not do anything special here in the case that readlen < recvlen. */ - return Py_BuildValue("lN", readlen, addr); - -error: - Py_XDECREF(addr); - PyBuffer_Release(&buf); - return NULL; -} - -PyDoc_STRVAR(recvfrom_into_doc, -"recvfrom_into(buffer[, nbytes[, flags]]) -> (nbytes, address info)\n\ -\n\ -Like recv_into(buffer[, nbytes[, flags]]) but also return the sender's address info."); - - -/* s.send(data [,flags]) method */ - -static PyObject * -sock_send(PySocketSockObject *s, PyObject *args) -{ - char *buf; - int len, n = -1, flags = 0, timeout; - Py_buffer pbuf; - - if (!PyArg_ParseTuple(args, "s*|i:send", &pbuf, &flags)) - return NULL; - - if (!IS_SELECTABLE(s)) { - PyBuffer_Release(&pbuf); - return select_error(); - } - buf = pbuf.buf; - len = pbuf.len; - - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 1, interval); - if (!timeout) -#ifdef __VMS - n = sendsegmented(s->sock_fd, buf, len, flags); -#else - n = send(s->sock_fd, buf, len, flags); -#endif - Py_END_ALLOW_THREADS - if (timeout == 1) { - PyBuffer_Release(&pbuf); - PyErr_SetString(socket_timeout, "timed out"); - return NULL; - } - END_SELECT_LOOP(s) - - PyBuffer_Release(&pbuf); - if (n < 0) - return s->errorhandler(); - return PyInt_FromLong((long)n); -} - -PyDoc_STRVAR(send_doc, -"send(data[, flags]) -> count\n\ -\n\ -Send a data string to the socket. For the optional flags\n\ -argument, see the Unix manual. Return the number of bytes\n\ -sent; this may be less than len(data) if the network is busy."); - - -/* s.sendall(data [,flags]) method */ - -static PyObject * -sock_sendall(PySocketSockObject *s, PyObject *args) -{ - char *buf; - int len, n = -1, flags = 0, timeout, saved_errno; - Py_buffer pbuf; - - if (!PyArg_ParseTuple(args, "s*|i:sendall", &pbuf, &flags)) - return NULL; - buf = pbuf.buf; - len = pbuf.len; - - if (!IS_SELECTABLE(s)) { - PyBuffer_Release(&pbuf); - return select_error(); - } - - do { - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 1, interval); - n = -1; - if (!timeout) { -#ifdef __VMS - n = sendsegmented(s->sock_fd, buf, len, flags); -#else - n = send(s->sock_fd, buf, len, flags); -#endif - } - Py_END_ALLOW_THREADS - if (timeout == 1) { - PyBuffer_Release(&pbuf); - PyErr_SetString(socket_timeout, "timed out"); - return NULL; - } - END_SELECT_LOOP(s) - /* PyErr_CheckSignals() might change errno */ - saved_errno = errno; - /* We must run our signal handlers before looping again. - send() can return a successful partial write when it is - interrupted, so we can't restrict ourselves to EINTR. */ - if (PyErr_CheckSignals()) { - PyBuffer_Release(&pbuf); - return NULL; - } - if (n < 0) { - /* If interrupted, try again */ - if (saved_errno == EINTR) - continue; - else - break; - } - buf += n; - len -= n; - } while (len > 0); - PyBuffer_Release(&pbuf); - - if (n < 0) - return s->errorhandler(); - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(sendall_doc, -"sendall(data[, flags])\n\ -\n\ -Send a data string to the socket. For the optional flags\n\ -argument, see the Unix manual. This calls send() repeatedly\n\ -until all data is sent. If an error occurs, it's impossible\n\ -to tell how much data has been sent."); - - -/* s.sendto(data, [flags,] sockaddr) method */ - -static PyObject * -sock_sendto(PySocketSockObject *s, PyObject *args) -{ - Py_buffer pbuf; - PyObject *addro; - char *buf; - Py_ssize_t len; - sock_addr_t addrbuf; - int addrlen, flags, timeout; - long n = -1; - int arglen; - - flags = 0; - arglen = PyTuple_Size(args); - switch(arglen) { - case 2: - PyArg_ParseTuple(args, "s*O:sendto", &pbuf, &addro); - break; - case 3: - PyArg_ParseTuple(args, "s*iO:sendto", &pbuf, &flags, &addro); - break; - default: - PyErr_Format(PyExc_TypeError, "sendto() takes 2 or 3" - " arguments (%d given)", arglen); - } - if (PyErr_Occurred()) - return NULL; - - buf = pbuf.buf; - len = pbuf.len; - - if (!IS_SELECTABLE(s)) { - PyBuffer_Release(&pbuf); - return select_error(); - } - - if (!getsockaddrarg(s, addro, SAS2SA(&addrbuf), &addrlen)) { - PyBuffer_Release(&pbuf); - return NULL; - } - - BEGIN_SELECT_LOOP(s) - Py_BEGIN_ALLOW_THREADS - timeout = internal_select_ex(s, 1, interval); - if (!timeout) - n = sendto(s->sock_fd, buf, len, flags, SAS2SA(&addrbuf), addrlen); - Py_END_ALLOW_THREADS - - if (timeout == 1) { - PyBuffer_Release(&pbuf); - PyErr_SetString(socket_timeout, "timed out"); - return NULL; - } - END_SELECT_LOOP(s) - PyBuffer_Release(&pbuf); - if (n < 0) - return s->errorhandler(); - return PyInt_FromLong((long)n); -} - -PyDoc_STRVAR(sendto_doc, -"sendto(data[, flags], address) -> count\n\ -\n\ -Like send(data, flags) but allows specifying the destination address.\n\ -For IP sockets, the address is a pair (hostaddr, port)."); - - -/* s.shutdown(how) method */ - -static PyObject * -sock_shutdown(PySocketSockObject *s, PyObject *arg) -{ - int how; - int res; - - how = _PyInt_AsInt(arg); - if (how == -1 && PyErr_Occurred()) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = shutdown(s->sock_fd, how); - Py_END_ALLOW_THREADS - if (res < 0) - return s->errorhandler(); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(shutdown_doc, -"shutdown(flag)\n\ -\n\ -Shut down the reading side of the socket (flag == SHUT_RD), the writing side\n\ -of the socket (flag == SHUT_WR), or both ends (flag == SHUT_RDWR)."); - -#if defined(MS_WINDOWS) && defined(SIO_RCVALL) -static PyObject* -sock_ioctl(PySocketSockObject *s, PyObject *arg) -{ - unsigned long cmd = SIO_RCVALL; - PyObject *argO; - DWORD recv; - - if (!PyArg_ParseTuple(arg, "kO:ioctl", &cmd, &argO)) - return NULL; - - switch (cmd) { - case SIO_RCVALL: { - unsigned int option = RCVALL_ON; - if (!PyArg_ParseTuple(arg, "kI:ioctl", &cmd, &option)) - return NULL; - if (WSAIoctl(s->sock_fd, cmd, &option, sizeof(option), - NULL, 0, &recv, NULL, NULL) == SOCKET_ERROR) { - return set_error(); - } - return PyLong_FromUnsignedLong(recv); } - case SIO_KEEPALIVE_VALS: { - struct tcp_keepalive ka; - if (!PyArg_ParseTuple(arg, "k(kkk):ioctl", &cmd, - &ka.onoff, &ka.keepalivetime, &ka.keepaliveinterval)) - return NULL; - if (WSAIoctl(s->sock_fd, cmd, &ka, sizeof(ka), - NULL, 0, &recv, NULL, NULL) == SOCKET_ERROR) { - return set_error(); - } - return PyLong_FromUnsignedLong(recv); } - default: - PyErr_Format(PyExc_ValueError, "invalid ioctl command %d", cmd); - return NULL; - } -} -PyDoc_STRVAR(sock_ioctl_doc, -"ioctl(cmd, option) -> long\n\ -\n\ -Control the socket with WSAIoctl syscall. Currently supported 'cmd' values are\n\ -SIO_RCVALL: 'option' must be one of the socket.RCVALL_* constants.\n\ -SIO_KEEPALIVE_VALS: 'option' is a tuple of (onoff, timeout, interval)."); - -#endif - -/* List of methods for socket objects */ - -static PyMethodDef sock_methods[] = { - {"accept", (PyCFunction)sock_accept, METH_NOARGS, - accept_doc}, - {"bind", (PyCFunction)sock_bind, METH_O, - bind_doc}, - {"close", (PyCFunction)sock_close, METH_NOARGS, - close_doc}, - {"connect", (PyCFunction)sock_connect, METH_O, - connect_doc}, - {"connect_ex", (PyCFunction)sock_connect_ex, METH_O, - connect_ex_doc}, -#ifndef NO_DUP - {"dup", (PyCFunction)sock_dup, METH_NOARGS, - dup_doc}, -#endif - {"fileno", (PyCFunction)sock_fileno, METH_NOARGS, - fileno_doc}, -#ifdef HAVE_GETPEERNAME - {"getpeername", (PyCFunction)sock_getpeername, - METH_NOARGS, getpeername_doc}, -#endif - {"getsockname", (PyCFunction)sock_getsockname, - METH_NOARGS, getsockname_doc}, - {"getsockopt", (PyCFunction)sock_getsockopt, METH_VARARGS, - getsockopt_doc}, -#if defined(MS_WINDOWS) && defined(SIO_RCVALL) - {"ioctl", (PyCFunction)sock_ioctl, METH_VARARGS, - sock_ioctl_doc}, -#endif - {"listen", (PyCFunction)sock_listen, METH_O, - listen_doc}, -#ifndef NO_DUP - {"makefile", (PyCFunction)sock_makefile, METH_VARARGS, - makefile_doc}, -#endif - {"recv", (PyCFunction)sock_recv, METH_VARARGS, - recv_doc}, - {"recv_into", (PyCFunction)sock_recv_into, METH_VARARGS | METH_KEYWORDS, - recv_into_doc}, - {"recvfrom", (PyCFunction)sock_recvfrom, METH_VARARGS, - recvfrom_doc}, - {"recvfrom_into", (PyCFunction)sock_recvfrom_into, METH_VARARGS | METH_KEYWORDS, - recvfrom_into_doc}, - {"send", (PyCFunction)sock_send, METH_VARARGS, - send_doc}, - {"sendall", (PyCFunction)sock_sendall, METH_VARARGS, - sendall_doc}, - {"sendto", (PyCFunction)sock_sendto, METH_VARARGS, - sendto_doc}, - {"setblocking", (PyCFunction)sock_setblocking, METH_O, - setblocking_doc}, - {"settimeout", (PyCFunction)sock_settimeout, METH_O, - settimeout_doc}, - {"gettimeout", (PyCFunction)sock_gettimeout, METH_NOARGS, - gettimeout_doc}, - {"setsockopt", (PyCFunction)sock_setsockopt, METH_VARARGS, - setsockopt_doc}, - {"shutdown", (PyCFunction)sock_shutdown, METH_O, - shutdown_doc}, -#ifdef RISCOS - {"sleeptaskw", (PyCFunction)sock_sleeptaskw, METH_O, - sleeptaskw_doc}, -#endif - {NULL, NULL} /* sentinel */ -}; - -/* SockObject members */ -static PyMemberDef sock_memberlist[] = { - {"family", T_INT, offsetof(PySocketSockObject, sock_family), READONLY, "the socket family"}, - {"type", T_INT, offsetof(PySocketSockObject, sock_type), READONLY, "the socket type"}, - {"proto", T_INT, offsetof(PySocketSockObject, sock_proto), READONLY, "the socket protocol"}, - {"timeout", T_DOUBLE, offsetof(PySocketSockObject, sock_timeout), READONLY, "the socket timeout"}, - {0}, -}; - -/* Deallocate a socket object in response to the last Py_DECREF(). - First close the file description. */ - -static void -sock_dealloc(PySocketSockObject *s) -{ - if (s->sock_fd != -1) - (void) SOCKETCLOSE(s->sock_fd); - if (s->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)s); - Py_TYPE(s)->tp_free((PyObject *)s); -} - - -static PyObject * -sock_repr(PySocketSockObject *s) -{ - char buf[512]; - long sock_fd; - /* On Windows, this test is needed because SOCKET_T is unsigned */ - if (s->sock_fd == INVALID_SOCKET) { - sock_fd = -1; - } -#if SIZEOF_SOCKET_T > SIZEOF_LONG - else if (s->sock_fd > LONG_MAX) { - /* this can occur on Win64, and actually there is a special - ugly printf formatter for decimal pointer length integer - printing, only bother if necessary*/ - PyErr_SetString(PyExc_OverflowError, - "no printf formatter to display " - "the socket descriptor in decimal"); - return NULL; - } -#endif - else - sock_fd = (long)s->sock_fd; - PyOS_snprintf( - buf, sizeof(buf), - "", - sock_fd, s->sock_family, - s->sock_type, - s->sock_proto); - return PyString_FromString(buf); -} - - -/* Create a new, uninitialized socket object. */ - -static PyObject * -sock_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *new; - - new = type->tp_alloc(type, 0); - if (new != NULL) { - ((PySocketSockObject *)new)->sock_fd = -1; - ((PySocketSockObject *)new)->sock_timeout = -1.0; - ((PySocketSockObject *)new)->errorhandler = &set_error; - ((PySocketSockObject *)new)->weakreflist = NULL; - } - return new; -} - - -/* Initialize a new socket object. */ - -/*ARGSUSED*/ -static int -sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) -{ - PySocketSockObject *s = (PySocketSockObject *)self; - SOCKET_T fd; - int family = AF_INET, type = SOCK_STREAM, proto = 0; - static char *keywords[] = {"family", "type", "proto", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, - "|iii:socket", keywords, - &family, &type, &proto)) - return -1; - - Py_BEGIN_ALLOW_THREADS - fd = socket(family, type, proto); - Py_END_ALLOW_THREADS - - if (fd == INVALID_SOCKET) { - set_error(); - return -1; - } - init_sockobject(s, fd, family, type, proto); - - return 0; - -} - - -/* Type object for socket objects. */ - -static PyTypeObject sock_type = { - PyVarObject_HEAD_INIT(0, 0) /* Must fill in type value later */ - "_socket.socket", /* tp_name */ - sizeof(PySocketSockObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)sock_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)sock_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - sock_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PySocketSockObject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - sock_methods, /* tp_methods */ - sock_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - sock_initobj, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - sock_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - - -/* Python interface to gethostname(). */ - -/*ARGSUSED*/ -static PyObject * -socket_gethostname(PyObject *self, PyObject *unused) -{ - char buf[1024]; - int res; - Py_BEGIN_ALLOW_THREADS - res = gethostname(buf, (int) sizeof buf - 1); - Py_END_ALLOW_THREADS - if (res < 0) - return set_error(); - buf[sizeof buf - 1] = '\0'; - return PyString_FromString(buf); -} - -PyDoc_STRVAR(gethostname_doc, -"gethostname() -> string\n\ -\n\ -Return the current host name."); - - -/* Python interface to gethostbyname(name). */ - -/*ARGSUSED*/ -static PyObject * -socket_gethostbyname(PyObject *self, PyObject *args) -{ - char *name; - sock_addr_t addrbuf; - - if (!PyArg_ParseTuple(args, "s:gethostbyname", &name)) - return NULL; - if (setipaddr(name, SAS2SA(&addrbuf), sizeof(addrbuf), AF_INET) < 0) - return NULL; - return makeipaddr(SAS2SA(&addrbuf), sizeof(struct sockaddr_in)); -} - -PyDoc_STRVAR(gethostbyname_doc, -"gethostbyname(host) -> address\n\ -\n\ -Return the IP address (a string of the form '255.255.255.255') for a host."); - - -/* Convenience function common to gethostbyname_ex and gethostbyaddr */ - -static PyObject * -gethost_common(struct hostent *h, struct sockaddr *addr, int alen, int af) -{ - char **pch; - PyObject *rtn_tuple = (PyObject *)NULL; - PyObject *name_list = (PyObject *)NULL; - PyObject *addr_list = (PyObject *)NULL; - PyObject *tmp; - - if (h == NULL) { - /* Let's get real error message to return */ -#ifndef RISCOS - set_herror(h_errno); -#else - PyErr_SetString(socket_error, "host not found"); -#endif - return NULL; - } - - if (h->h_addrtype != af) { - /* Let's get real error message to return */ - PyErr_SetString(socket_error, - (char *)strerror(EAFNOSUPPORT)); - - return NULL; - } - - switch (af) { - - case AF_INET: - if (alen < sizeof(struct sockaddr_in)) - return NULL; - break; - -#ifdef ENABLE_IPV6 - case AF_INET6: - if (alen < sizeof(struct sockaddr_in6)) - return NULL; - break; -#endif - - } - - if ((name_list = PyList_New(0)) == NULL) - goto err; - - if ((addr_list = PyList_New(0)) == NULL) - goto err; - - /* SF #1511317: h_aliases can be NULL */ - if (h->h_aliases) { - for (pch = h->h_aliases; *pch != NULL; pch++) { - int status; - tmp = PyString_FromString(*pch); - if (tmp == NULL) - goto err; - - status = PyList_Append(name_list, tmp); - Py_DECREF(tmp); - - if (status) - goto err; - } - } - - for (pch = h->h_addr_list; *pch != NULL; pch++) { - int status; - - switch (af) { - - case AF_INET: - { - struct sockaddr_in sin; - memset(&sin, 0, sizeof(sin)); - sin.sin_family = af; -#ifdef HAVE_SOCKADDR_SA_LEN - sin.sin_len = sizeof(sin); -#endif - memcpy(&sin.sin_addr, *pch, sizeof(sin.sin_addr)); - tmp = makeipaddr((struct sockaddr *)&sin, sizeof(sin)); - - if (pch == h->h_addr_list && alen >= sizeof(sin)) - memcpy((char *) addr, &sin, sizeof(sin)); - break; - } - -#ifdef ENABLE_IPV6 - case AF_INET6: - { - struct sockaddr_in6 sin6; - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_family = af; -#ifdef HAVE_SOCKADDR_SA_LEN - sin6.sin6_len = sizeof(sin6); -#endif - memcpy(&sin6.sin6_addr, *pch, sizeof(sin6.sin6_addr)); - tmp = makeipaddr((struct sockaddr *)&sin6, - sizeof(sin6)); - - if (pch == h->h_addr_list && alen >= sizeof(sin6)) - memcpy((char *) addr, &sin6, sizeof(sin6)); - break; - } -#endif - - default: /* can't happen */ - PyErr_SetString(socket_error, - "unsupported address family"); - return NULL; - } - - if (tmp == NULL) - goto err; - - status = PyList_Append(addr_list, tmp); - Py_DECREF(tmp); - - if (status) - goto err; - } - - rtn_tuple = Py_BuildValue("sOO", h->h_name, name_list, addr_list); - - err: - Py_XDECREF(name_list); - Py_XDECREF(addr_list); - return rtn_tuple; -} - - -/* Python interface to gethostbyname_ex(name). */ - -/*ARGSUSED*/ -static PyObject * -socket_gethostbyname_ex(PyObject *self, PyObject *args) -{ - char *name; - struct hostent *h; -#ifdef ENABLE_IPV6 - struct sockaddr_storage addr; -#else - struct sockaddr_in addr; -#endif - struct sockaddr *sa; - PyObject *ret; -#ifdef HAVE_GETHOSTBYNAME_R - struct hostent hp_allocated; -#ifdef HAVE_GETHOSTBYNAME_R_3_ARG - struct hostent_data data; -#else - char buf[16384]; - int buf_len = (sizeof buf) - 1; - int errnop; -#endif -#if defined(HAVE_GETHOSTBYNAME_R_3_ARG) || defined(HAVE_GETHOSTBYNAME_R_6_ARG) - int result; -#endif -#endif /* HAVE_GETHOSTBYNAME_R */ - - if (!PyArg_ParseTuple(args, "s:gethostbyname_ex", &name)) - return NULL; - if (setipaddr(name, (struct sockaddr *)&addr, sizeof(addr), AF_INET) < 0) - return NULL; - Py_BEGIN_ALLOW_THREADS -#ifdef HAVE_GETHOSTBYNAME_R -#if defined(HAVE_GETHOSTBYNAME_R_6_ARG) - result = gethostbyname_r(name, &hp_allocated, buf, buf_len, - &h, &errnop); -#elif defined(HAVE_GETHOSTBYNAME_R_5_ARG) - h = gethostbyname_r(name, &hp_allocated, buf, buf_len, &errnop); -#else /* HAVE_GETHOSTBYNAME_R_3_ARG */ - memset((void *) &data, '\0', sizeof(data)); - result = gethostbyname_r(name, &hp_allocated, &data); - h = (result != 0) ? NULL : &hp_allocated; -#endif -#else /* not HAVE_GETHOSTBYNAME_R */ -#ifdef USE_GETHOSTBYNAME_LOCK - PyThread_acquire_lock(netdb_lock, 1); -#endif - h = gethostbyname(name); -#endif /* HAVE_GETHOSTBYNAME_R */ - Py_END_ALLOW_THREADS - /* Some C libraries would require addr.__ss_family instead of - addr.ss_family. - Therefore, we cast the sockaddr_storage into sockaddr to - access sa_family. */ - sa = (struct sockaddr*)&addr; - ret = gethost_common(h, (struct sockaddr *)&addr, sizeof(addr), - sa->sa_family); -#ifdef USE_GETHOSTBYNAME_LOCK - PyThread_release_lock(netdb_lock); -#endif - return ret; -} - -PyDoc_STRVAR(ghbn_ex_doc, -"gethostbyname_ex(host) -> (name, aliaslist, addresslist)\n\ -\n\ -Return the true host name, a list of aliases, and a list of IP addresses,\n\ -for a host. The host argument is a string giving a host name or IP number."); - - -/* Python interface to gethostbyaddr(IP). */ - -/*ARGSUSED*/ -static PyObject * -socket_gethostbyaddr(PyObject *self, PyObject *args) -{ -#ifdef ENABLE_IPV6 - struct sockaddr_storage addr; -#else - struct sockaddr_in addr; -#endif - struct sockaddr *sa = (struct sockaddr *)&addr; - char *ip_num; - struct hostent *h; - PyObject *ret; -#ifdef HAVE_GETHOSTBYNAME_R - struct hostent hp_allocated; -#ifdef HAVE_GETHOSTBYNAME_R_3_ARG - struct hostent_data data; -#else - /* glibcs up to 2.10 assume that the buf argument to - gethostbyaddr_r is 8-byte aligned, which at least llvm-gcc - does not ensure. The attribute below instructs the compiler - to maintain this alignment. */ - char buf[16384] Py_ALIGNED(8); - int buf_len = (sizeof buf) - 1; - int errnop; -#endif -#if defined(HAVE_GETHOSTBYNAME_R_3_ARG) || defined(HAVE_GETHOSTBYNAME_R_6_ARG) - int result; -#endif -#endif /* HAVE_GETHOSTBYNAME_R */ - char *ap; - int al; - int af; - - if (!PyArg_ParseTuple(args, "s:gethostbyaddr", &ip_num)) - return NULL; - af = AF_UNSPEC; - if (setipaddr(ip_num, sa, sizeof(addr), af) < 0) - return NULL; - af = sa->sa_family; - ap = NULL; - switch (af) { - case AF_INET: - ap = (char *)&((struct sockaddr_in *)sa)->sin_addr; - al = sizeof(((struct sockaddr_in *)sa)->sin_addr); - break; -#ifdef ENABLE_IPV6 - case AF_INET6: - ap = (char *)&((struct sockaddr_in6 *)sa)->sin6_addr; - al = sizeof(((struct sockaddr_in6 *)sa)->sin6_addr); - break; -#endif - default: - PyErr_SetString(socket_error, "unsupported address family"); - return NULL; - } - Py_BEGIN_ALLOW_THREADS -#ifdef HAVE_GETHOSTBYNAME_R -#if defined(HAVE_GETHOSTBYNAME_R_6_ARG) - result = gethostbyaddr_r(ap, al, af, - &hp_allocated, buf, buf_len, - &h, &errnop); -#elif defined(HAVE_GETHOSTBYNAME_R_5_ARG) - h = gethostbyaddr_r(ap, al, af, - &hp_allocated, buf, buf_len, &errnop); -#else /* HAVE_GETHOSTBYNAME_R_3_ARG */ - memset((void *) &data, '\0', sizeof(data)); - result = gethostbyaddr_r(ap, al, af, &hp_allocated, &data); - h = (result != 0) ? NULL : &hp_allocated; -#endif -#else /* not HAVE_GETHOSTBYNAME_R */ -#ifdef USE_GETHOSTBYNAME_LOCK - PyThread_acquire_lock(netdb_lock, 1); -#endif - h = gethostbyaddr(ap, al, af); -#endif /* HAVE_GETHOSTBYNAME_R */ - Py_END_ALLOW_THREADS - ret = gethost_common(h, (struct sockaddr *)&addr, sizeof(addr), af); -#ifdef USE_GETHOSTBYNAME_LOCK - PyThread_release_lock(netdb_lock); -#endif - return ret; -} - -PyDoc_STRVAR(gethostbyaddr_doc, -"gethostbyaddr(host) -> (name, aliaslist, addresslist)\n\ -\n\ -Return the true host name, a list of aliases, and a list of IP addresses,\n\ -for a host. The host argument is a string giving a host name or IP number."); - - -/* Python interface to getservbyname(name). - This only returns the port number, since the other info is already - known or not useful (like the list of aliases). */ - -/*ARGSUSED*/ -static PyObject * -socket_getservbyname(PyObject *self, PyObject *args) -{ - char *name, *proto=NULL; - struct servent *sp; - if (!PyArg_ParseTuple(args, "s|s:getservbyname", &name, &proto)) - return NULL; - Py_BEGIN_ALLOW_THREADS - sp = getservbyname(name, proto); - Py_END_ALLOW_THREADS - if (sp == NULL) { - PyErr_SetString(socket_error, "service/proto not found"); - return NULL; - } - return PyInt_FromLong((long) ntohs(sp->s_port)); -} - -PyDoc_STRVAR(getservbyname_doc, -"getservbyname(servicename[, protocolname]) -> integer\n\ -\n\ -Return a port number from a service name and protocol name.\n\ -The optional protocol name, if given, should be 'tcp' or 'udp',\n\ -otherwise any protocol will match."); - - -/* Python interface to getservbyport(port). - This only returns the service name, since the other info is already - known or not useful (like the list of aliases). */ - -/*ARGSUSED*/ -static PyObject * -socket_getservbyport(PyObject *self, PyObject *args) -{ - int port; - char *proto=NULL; - struct servent *sp; - if (!PyArg_ParseTuple(args, "i|s:getservbyport", &port, &proto)) - return NULL; - if (port < 0 || port > 0xffff) { - PyErr_SetString( - PyExc_OverflowError, - "getservbyport: port must be 0-65535."); - return NULL; - } - Py_BEGIN_ALLOW_THREADS - sp = getservbyport(htons((short)port), proto); - Py_END_ALLOW_THREADS - if (sp == NULL) { - PyErr_SetString(socket_error, "port/proto not found"); - return NULL; - } - return PyString_FromString(sp->s_name); -} - -PyDoc_STRVAR(getservbyport_doc, -"getservbyport(port[, protocolname]) -> string\n\ -\n\ -Return the service name from a port number and protocol name.\n\ -The optional protocol name, if given, should be 'tcp' or 'udp',\n\ -otherwise any protocol will match."); - -/* Python interface to getprotobyname(name). - This only returns the protocol number, since the other info is - already known or not useful (like the list of aliases). */ - -/*ARGSUSED*/ -static PyObject * -socket_getprotobyname(PyObject *self, PyObject *args) -{ - char *name; - struct protoent *sp; -#ifdef __BEOS__ -/* Not available in BeOS yet. - [cjh] */ - PyErr_SetString(socket_error, "getprotobyname not supported"); - return NULL; -#else - if (!PyArg_ParseTuple(args, "s:getprotobyname", &name)) - return NULL; - Py_BEGIN_ALLOW_THREADS - sp = getprotobyname(name); - Py_END_ALLOW_THREADS - if (sp == NULL) { - PyErr_SetString(socket_error, "protocol not found"); - return NULL; - } - return PyInt_FromLong((long) sp->p_proto); -#endif -} - -PyDoc_STRVAR(getprotobyname_doc, -"getprotobyname(name) -> integer\n\ -\n\ -Return the protocol number for the named protocol. (Rarely used.)"); - - -#ifdef HAVE_SOCKETPAIR -/* Create a pair of sockets using the socketpair() function. - Arguments as for socket() except the default family is AF_UNIX if - defined on the platform; otherwise, the default is AF_INET. */ - -/*ARGSUSED*/ -static PyObject * -socket_socketpair(PyObject *self, PyObject *args) -{ - PySocketSockObject *s0 = NULL, *s1 = NULL; - SOCKET_T sv[2]; - int family, type = SOCK_STREAM, proto = 0; - PyObject *res = NULL; - -#if defined(AF_UNIX) - family = AF_UNIX; -#else - family = AF_INET; -#endif - if (!PyArg_ParseTuple(args, "|iii:socketpair", - &family, &type, &proto)) - return NULL; - /* Create a pair of socket fds */ - if (socketpair(family, type, proto, sv) < 0) - return set_error(); - s0 = new_sockobject(sv[0], family, type, proto); - if (s0 == NULL) - goto finally; - s1 = new_sockobject(sv[1], family, type, proto); - if (s1 == NULL) - goto finally; - res = PyTuple_Pack(2, s0, s1); - -finally: - if (res == NULL) { - if (s0 == NULL) - SOCKETCLOSE(sv[0]); - if (s1 == NULL) - SOCKETCLOSE(sv[1]); - } - Py_XDECREF(s0); - Py_XDECREF(s1); - return res; -} - -PyDoc_STRVAR(socketpair_doc, -"socketpair([family[, type[, proto]]]) -> (socket object, socket object)\n\ -\n\ -Create a pair of socket objects from the sockets returned by the platform\n\ -socketpair() function.\n\ -The arguments are the same as for socket() except the default family is\n\ -AF_UNIX if defined on the platform; otherwise, the default is AF_INET."); - -#endif /* HAVE_SOCKETPAIR */ - - -#ifndef NO_DUP -/* Create a socket object from a numeric file description. - Useful e.g. if stdin is a socket. - Additional arguments as for socket(). */ - -/*ARGSUSED*/ -static PyObject * -socket_fromfd(PyObject *self, PyObject *args) -{ - PySocketSockObject *s; - SOCKET_T fd; - int family, type, proto = 0; - if (!PyArg_ParseTuple(args, "iii|i:fromfd", - &fd, &family, &type, &proto)) - return NULL; - /* Dup the fd so it and the socket can be closed independently */ - fd = dup(fd); - if (fd < 0) - return set_error(); - s = new_sockobject(fd, family, type, proto); - return (PyObject *) s; -} - -PyDoc_STRVAR(fromfd_doc, -"fromfd(fd, family, type[, proto]) -> socket object\n\ -\n\ -Create a socket object from a duplicate of the given\n\ -file descriptor.\n\ -The remaining arguments are the same as for socket()."); - -#endif /* NO_DUP */ - - -static PyObject * -socket_ntohs(PyObject *self, PyObject *args) -{ - int x1, x2; - - if (!PyArg_ParseTuple(args, "i:ntohs", &x1)) { - return NULL; - } - if (x1 < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative number to unsigned long"); - return NULL; - } - x2 = (unsigned int)ntohs((unsigned short)x1); - return PyInt_FromLong(x2); -} - -PyDoc_STRVAR(ntohs_doc, -"ntohs(integer) -> integer\n\ -\n\ -Convert a 16-bit integer from network to host byte order."); - - -static PyObject * -socket_ntohl(PyObject *self, PyObject *arg) -{ - unsigned long x; - - if (PyInt_Check(arg)) { - x = PyInt_AS_LONG(arg); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; - if ((long)x < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative number to unsigned long"); - return NULL; - } - } - else if (PyLong_Check(arg)) { - x = PyLong_AsUnsignedLong(arg); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; -#if SIZEOF_LONG > 4 - { - unsigned long y; - /* only want the trailing 32 bits */ - y = x & 0xFFFFFFFFUL; - if (y ^ x) - return PyErr_Format(PyExc_OverflowError, - "long int larger than 32 bits"); - x = y; - } -#endif - } - else - return PyErr_Format(PyExc_TypeError, - "expected int/long, %s found", - Py_TYPE(arg)->tp_name); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; - return PyLong_FromUnsignedLong(ntohl(x)); -} - -PyDoc_STRVAR(ntohl_doc, -"ntohl(integer) -> integer\n\ -\n\ -Convert a 32-bit integer from network to host byte order."); - - -static PyObject * -socket_htons(PyObject *self, PyObject *args) -{ - int x1, x2; - - if (!PyArg_ParseTuple(args, "i:htons", &x1)) { - return NULL; - } - if (x1 < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative number to unsigned long"); - return NULL; - } - x2 = (unsigned int)htons((unsigned short)x1); - return PyInt_FromLong(x2); -} - -PyDoc_STRVAR(htons_doc, -"htons(integer) -> integer\n\ -\n\ -Convert a 16-bit integer from host to network byte order."); - - -static PyObject * -socket_htonl(PyObject *self, PyObject *arg) -{ - unsigned long x; - - if (PyInt_Check(arg)) { - x = PyInt_AS_LONG(arg); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; - if ((long)x < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative number to unsigned long"); - return NULL; - } - } - else if (PyLong_Check(arg)) { - x = PyLong_AsUnsignedLong(arg); - if (x == (unsigned long) -1 && PyErr_Occurred()) - return NULL; -#if SIZEOF_LONG > 4 - { - unsigned long y; - /* only want the trailing 32 bits */ - y = x & 0xFFFFFFFFUL; - if (y ^ x) - return PyErr_Format(PyExc_OverflowError, - "long int larger than 32 bits"); - x = y; - } -#endif - } - else - return PyErr_Format(PyExc_TypeError, - "expected int/long, %s found", - Py_TYPE(arg)->tp_name); - return PyLong_FromUnsignedLong(htonl((unsigned long)x)); -} - -PyDoc_STRVAR(htonl_doc, -"htonl(integer) -> integer\n\ -\n\ -Convert a 32-bit integer from host to network byte order."); - -/* socket.inet_aton() and socket.inet_ntoa() functions. */ - -PyDoc_STRVAR(inet_aton_doc, -"inet_aton(string) -> packed 32-bit IP representation\n\ -\n\ -Convert an IP address in string format (123.45.67.89) to the 32-bit packed\n\ -binary format used in low-level network functions."); - -static PyObject* -socket_inet_aton(PyObject *self, PyObject *args) -{ -#ifndef INADDR_NONE -#define INADDR_NONE (-1) -#endif -#ifdef HAVE_INET_ATON - struct in_addr buf; -#endif - -#if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK) -#if (SIZEOF_INT != 4) -#error "Not sure if in_addr_t exists and int is not 32-bits." -#endif - /* Have to use inet_addr() instead */ - unsigned int packed_addr; -#endif - char *ip_addr; - - if (!PyArg_ParseTuple(args, "s:inet_aton", &ip_addr)) - return NULL; - - -#ifdef HAVE_INET_ATON - -#ifdef USE_INET_ATON_WEAKLINK - if (inet_aton != NULL) { -#endif - if (inet_aton(ip_addr, &buf)) - return PyString_FromStringAndSize((char *)(&buf), - sizeof(buf)); - - PyErr_SetString(socket_error, - "illegal IP address string passed to inet_aton"); - return NULL; - -#ifdef USE_INET_ATON_WEAKLINK - } else { -#endif - -#endif - -#if !defined(HAVE_INET_ATON) || defined(USE_INET_ATON_WEAKLINK) - - /* special-case this address as inet_addr might return INADDR_NONE - * for this */ - if (strcmp(ip_addr, "255.255.255.255") == 0) { - packed_addr = 0xFFFFFFFF; - } else { - - packed_addr = inet_addr(ip_addr); - - if (packed_addr == INADDR_NONE) { /* invalid address */ - PyErr_SetString(socket_error, - "illegal IP address string passed to inet_aton"); - return NULL; - } - } - return PyString_FromStringAndSize((char *) &packed_addr, - sizeof(packed_addr)); - -#ifdef USE_INET_ATON_WEAKLINK - } -#endif - -#endif -} - -PyDoc_STRVAR(inet_ntoa_doc, -"inet_ntoa(packed_ip) -> ip_address_string\n\ -\n\ -Convert an IP address from 32-bit packed binary format to string format"); - -static PyObject* -socket_inet_ntoa(PyObject *self, PyObject *args) -{ - char *packed_str; - int addr_len; - struct in_addr packed_addr; - - if (!PyArg_ParseTuple(args, "s#:inet_ntoa", &packed_str, &addr_len)) { - return NULL; - } - - if (addr_len != sizeof(packed_addr)) { - PyErr_SetString(socket_error, - "packed IP wrong length for inet_ntoa"); - return NULL; - } - - memcpy(&packed_addr, packed_str, addr_len); - - return PyString_FromString(inet_ntoa(packed_addr)); -} - -#ifdef HAVE_INET_PTON - -PyDoc_STRVAR(inet_pton_doc, -"inet_pton(af, ip) -> packed IP address string\n\ -\n\ -Convert an IP address from string format to a packed string suitable\n\ -for use with low-level network functions."); - -static PyObject * -socket_inet_pton(PyObject *self, PyObject *args) -{ - int af; - char* ip; - int retval; -#ifdef ENABLE_IPV6 - char packed[MAX(sizeof(struct in_addr), sizeof(struct in6_addr))]; -#else - char packed[sizeof(struct in_addr)]; -#endif - if (!PyArg_ParseTuple(args, "is:inet_pton", &af, &ip)) { - return NULL; - } - -#if !defined(ENABLE_IPV6) && defined(AF_INET6) - if(af == AF_INET6) { - PyErr_SetString(socket_error, - "can't use AF_INET6, IPv6 is disabled"); - return NULL; - } -#endif - - retval = inet_pton(af, ip, packed); - if (retval < 0) { - PyErr_SetFromErrno(socket_error); - return NULL; - } else if (retval == 0) { - PyErr_SetString(socket_error, - "illegal IP address string passed to inet_pton"); - return NULL; - } else if (af == AF_INET) { - return PyString_FromStringAndSize(packed, - sizeof(struct in_addr)); -#ifdef ENABLE_IPV6 - } else if (af == AF_INET6) { - return PyString_FromStringAndSize(packed, - sizeof(struct in6_addr)); -#endif - } else { - PyErr_SetString(socket_error, "unknown address family"); - return NULL; - } -} - -PyDoc_STRVAR(inet_ntop_doc, -"inet_ntop(af, packed_ip) -> string formatted IP address\n\ -\n\ -Convert a packed IP address of the given family to string format."); - -static PyObject * -socket_inet_ntop(PyObject *self, PyObject *args) -{ - int af; - char* packed; - int len; - const char* retval; -#ifdef ENABLE_IPV6 - char ip[MAX(INET_ADDRSTRLEN, INET6_ADDRSTRLEN) + 1]; -#else - char ip[INET_ADDRSTRLEN + 1]; -#endif - - /* Guarantee NUL-termination for PyString_FromString() below */ - memset((void *) &ip[0], '\0', sizeof(ip)); - - if (!PyArg_ParseTuple(args, "is#:inet_ntop", &af, &packed, &len)) { - return NULL; - } - - if (af == AF_INET) { - if (len != sizeof(struct in_addr)) { - PyErr_SetString(PyExc_ValueError, - "invalid length of packed IP address string"); - return NULL; - } -#ifdef ENABLE_IPV6 - } else if (af == AF_INET6) { - if (len != sizeof(struct in6_addr)) { - PyErr_SetString(PyExc_ValueError, - "invalid length of packed IP address string"); - return NULL; - } -#endif - } else { - PyErr_Format(PyExc_ValueError, - "unknown address family %d", af); - return NULL; - } - - retval = inet_ntop(af, packed, ip, sizeof(ip)); - if (!retval) { - PyErr_SetFromErrno(socket_error); - return NULL; - } else { - return PyString_FromString(retval); - } - - /* NOTREACHED */ - PyErr_SetString(PyExc_RuntimeError, "invalid handling of inet_ntop"); - return NULL; -} - -#endif /* HAVE_INET_PTON */ - -/* Python interface to getaddrinfo(host, port). */ - -/*ARGSUSED*/ -static PyObject * -socket_getaddrinfo(PyObject *self, PyObject *args) -{ - struct addrinfo hints, *res; - struct addrinfo *res0 = NULL; - PyObject *hobj = NULL; - PyObject *pobj = (PyObject *)NULL; - char pbuf[30]; - char *hptr, *pptr; - int family, socktype, protocol, flags; - int error; - PyObject *all = (PyObject *)NULL; - PyObject *single = (PyObject *)NULL; - PyObject *idna = NULL; - - family = socktype = protocol = flags = 0; - family = AF_UNSPEC; - if (!PyArg_ParseTuple(args, "OO|iiii:getaddrinfo", - &hobj, &pobj, &family, &socktype, - &protocol, &flags)) { - return NULL; - } - if (hobj == Py_None) { - hptr = NULL; - } else if (PyUnicode_Check(hobj)) { - idna = PyObject_CallMethod(hobj, "encode", "s", "idna"); - if (!idna) - return NULL; - hptr = PyString_AsString(idna); - } else if (PyString_Check(hobj)) { - hptr = PyString_AsString(hobj); - } else { - PyErr_SetString(PyExc_TypeError, - "getaddrinfo() argument 1 must be string or None"); - return NULL; - } - if (PyInt_Check(pobj) || PyLong_Check(pobj)) { - long value = PyLong_AsLong(pobj); - if (value == -1 && PyErr_Occurred()) - return NULL; - PyOS_snprintf(pbuf, sizeof(pbuf), "%ld", value); - pptr = pbuf; - } else if (PyString_Check(pobj)) { - pptr = PyString_AsString(pobj); - } else if (pobj == Py_None) { - pptr = (char *)NULL; - } else { - PyErr_SetString(socket_error, - "getaddrinfo() argument 2 must be integer or string"); - goto err; - } -#if defined(__APPLE__) && defined(AI_NUMERICSERV) - if ((flags & AI_NUMERICSERV) && (pptr == NULL || (pptr[0] == '0' && pptr[1] == 0))) { - /* On OSX upto at least OSX 10.8 getaddrinfo crashes - * if AI_NUMERICSERV is set and the servname is NULL or "0". - * This workaround avoids a segfault in libsystem. - */ - pptr = "00"; - } -#endif - memset(&hints, 0, sizeof(hints)); - hints.ai_family = family; - hints.ai_socktype = socktype; - hints.ai_protocol = protocol; - hints.ai_flags = flags; - Py_BEGIN_ALLOW_THREADS - ACQUIRE_GETADDRINFO_LOCK - error = getaddrinfo(hptr, pptr, &hints, &res0); - Py_END_ALLOW_THREADS - RELEASE_GETADDRINFO_LOCK /* see comment in setipaddr() */ - if (error) { - set_gaierror(error); - goto err; - } - - all = PyList_New(0); - if (all == NULL) - goto err; - for (res = res0; res; res = res->ai_next) { - PyObject *addr = - makesockaddr(-1, res->ai_addr, res->ai_addrlen, protocol); - if (addr == NULL) - goto err; - single = Py_BuildValue("iiisO", res->ai_family, - res->ai_socktype, res->ai_protocol, - res->ai_canonname ? res->ai_canonname : "", - addr); - Py_DECREF(addr); - if (single == NULL) - goto err; - - if (PyList_Append(all, single)) - goto err; - Py_XDECREF(single); - } - Py_XDECREF(idna); - if (res0) - freeaddrinfo(res0); - return all; - err: - Py_XDECREF(single); - Py_XDECREF(all); - Py_XDECREF(idna); - if (res0) - freeaddrinfo(res0); - return (PyObject *)NULL; -} - -PyDoc_STRVAR(getaddrinfo_doc, -"getaddrinfo(host, port [, family, socktype, proto, flags])\n\ - -> list of (family, socktype, proto, canonname, sockaddr)\n\ -\n\ -Resolve host and port into addrinfo struct."); - -/* Python interface to getnameinfo(sa, flags). */ - -/*ARGSUSED*/ -static PyObject * -socket_getnameinfo(PyObject *self, PyObject *args) -{ - PyObject *sa = (PyObject *)NULL; - int flags; - char *hostp; - int port; - unsigned int flowinfo, scope_id; - char hbuf[NI_MAXHOST], pbuf[NI_MAXSERV]; - struct addrinfo hints, *res = NULL; - int error; - PyObject *ret = (PyObject *)NULL; - - flags = flowinfo = scope_id = 0; - if (!PyArg_ParseTuple(args, "Oi:getnameinfo", &sa, &flags)) - return NULL; - if (!PyTuple_Check(sa)) { - PyErr_SetString(PyExc_TypeError, - "getnameinfo() argument 1 must be a tuple"); - return NULL; - } - if (!PyArg_ParseTuple(sa, "si|II", - &hostp, &port, &flowinfo, &scope_id)) - return NULL; - if (flowinfo > 0xfffff) { - PyErr_SetString(PyExc_OverflowError, - "getsockaddrarg: flowinfo must be 0-1048575."); - return NULL; - } - PyOS_snprintf(pbuf, sizeof(pbuf), "%d", port); - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_DGRAM; /* make numeric port happy */ - Py_BEGIN_ALLOW_THREADS - ACQUIRE_GETADDRINFO_LOCK - error = getaddrinfo(hostp, pbuf, &hints, &res); - Py_END_ALLOW_THREADS - RELEASE_GETADDRINFO_LOCK /* see comment in setipaddr() */ - if (error) { - set_gaierror(error); - goto fail; - } - if (res->ai_next) { - PyErr_SetString(socket_error, - "sockaddr resolved to multiple addresses"); - goto fail; - } - switch (res->ai_family) { - case AF_INET: - { - if (PyTuple_GET_SIZE(sa) != 2) { - PyErr_SetString(socket_error, - "IPv4 sockaddr must be 2 tuple"); - goto fail; - } - break; - } -#ifdef ENABLE_IPV6 - case AF_INET6: - { - struct sockaddr_in6 *sin6; - sin6 = (struct sockaddr_in6 *)res->ai_addr; - sin6->sin6_flowinfo = htonl(flowinfo); - sin6->sin6_scope_id = scope_id; - break; - } -#endif - } - error = getnameinfo(res->ai_addr, res->ai_addrlen, - hbuf, sizeof(hbuf), pbuf, sizeof(pbuf), flags); - if (error) { - set_gaierror(error); - goto fail; - } - ret = Py_BuildValue("ss", hbuf, pbuf); - -fail: - if (res) - freeaddrinfo(res); - return ret; -} - -PyDoc_STRVAR(getnameinfo_doc, -"getnameinfo(sockaddr, flags) --> (host, port)\n\ -\n\ -Get host and port for a sockaddr."); - - -/* Python API to getting and setting the default timeout value. */ - -static PyObject * -socket_getdefaulttimeout(PyObject *self) -{ - if (defaulttimeout < 0.0) { - Py_INCREF(Py_None); - return Py_None; - } - else - return PyFloat_FromDouble(defaulttimeout); -} - -PyDoc_STRVAR(getdefaulttimeout_doc, -"getdefaulttimeout() -> timeout\n\ -\n\ -Returns the default timeout in seconds (float) for new socket objects.\n\ -A value of None indicates that new socket objects have no timeout.\n\ -When the socket module is first imported, the default is None."); - -static PyObject * -socket_setdefaulttimeout(PyObject *self, PyObject *arg) -{ - double timeout; - - if (arg == Py_None) - timeout = -1.0; - else { - timeout = PyFloat_AsDouble(arg); - if (timeout < 0.0) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_ValueError, - "Timeout value out of range"); - return NULL; - } - } - - defaulttimeout = timeout; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setdefaulttimeout_doc, -"setdefaulttimeout(timeout)\n\ -\n\ -Set the default timeout in seconds (float) for new socket objects.\n\ -A value of None indicates that new socket objects have no timeout.\n\ -When the socket module is first imported, the default is None."); - - -/* List of functions exported by this module. */ - -static PyMethodDef socket_methods[] = { - {"gethostbyname", socket_gethostbyname, - METH_VARARGS, gethostbyname_doc}, - {"gethostbyname_ex", socket_gethostbyname_ex, - METH_VARARGS, ghbn_ex_doc}, - {"gethostbyaddr", socket_gethostbyaddr, - METH_VARARGS, gethostbyaddr_doc}, - {"gethostname", socket_gethostname, - METH_NOARGS, gethostname_doc}, - {"getservbyname", socket_getservbyname, - METH_VARARGS, getservbyname_doc}, - {"getservbyport", socket_getservbyport, - METH_VARARGS, getservbyport_doc}, - {"getprotobyname", socket_getprotobyname, - METH_VARARGS, getprotobyname_doc}, -#ifndef NO_DUP - {"fromfd", socket_fromfd, - METH_VARARGS, fromfd_doc}, -#endif -#ifdef HAVE_SOCKETPAIR - {"socketpair", socket_socketpair, - METH_VARARGS, socketpair_doc}, -#endif - {"ntohs", socket_ntohs, - METH_VARARGS, ntohs_doc}, - {"ntohl", socket_ntohl, - METH_O, ntohl_doc}, - {"htons", socket_htons, - METH_VARARGS, htons_doc}, - {"htonl", socket_htonl, - METH_O, htonl_doc}, - {"inet_aton", socket_inet_aton, - METH_VARARGS, inet_aton_doc}, - {"inet_ntoa", socket_inet_ntoa, - METH_VARARGS, inet_ntoa_doc}, -#ifdef HAVE_INET_PTON - {"inet_pton", socket_inet_pton, - METH_VARARGS, inet_pton_doc}, - {"inet_ntop", socket_inet_ntop, - METH_VARARGS, inet_ntop_doc}, -#endif - {"getaddrinfo", socket_getaddrinfo, - METH_VARARGS, getaddrinfo_doc}, - {"getnameinfo", socket_getnameinfo, - METH_VARARGS, getnameinfo_doc}, - {"getdefaulttimeout", (PyCFunction)socket_getdefaulttimeout, - METH_NOARGS, getdefaulttimeout_doc}, - {"setdefaulttimeout", socket_setdefaulttimeout, - METH_O, setdefaulttimeout_doc}, - {NULL, NULL} /* Sentinel */ -}; - - -#ifdef RISCOS -#define OS_INIT_DEFINED - -static int -os_init(void) -{ - _kernel_swi_regs r; - - r.r[0] = 0; - _kernel_swi(0x43380, &r, &r); - taskwindow = r.r[0]; - - return 1; -} - -#endif /* RISCOS */ - - -#ifdef MS_WINDOWS -#define OS_INIT_DEFINED - -/* Additional initialization and cleanup for Windows */ - -static void -os_cleanup(void) -{ - WSACleanup(); -} - -static int -os_init(void) -{ - WSADATA WSAData; - int ret; - char buf[100]; - ret = WSAStartup(0x0101, &WSAData); - switch (ret) { - case 0: /* No error */ - Py_AtExit(os_cleanup); - return 1; /* Success */ - case WSASYSNOTREADY: - PyErr_SetString(PyExc_ImportError, - "WSAStartup failed: network not ready"); - break; - case WSAVERNOTSUPPORTED: - case WSAEINVAL: - PyErr_SetString( - PyExc_ImportError, - "WSAStartup failed: requested version not supported"); - break; - default: - PyOS_snprintf(buf, sizeof(buf), - "WSAStartup failed: error code %d", ret); - PyErr_SetString(PyExc_ImportError, buf); - break; - } - return 0; /* Failure */ -} - -#endif /* MS_WINDOWS */ - - -#ifdef PYOS_OS2 -#define OS_INIT_DEFINED - -/* Additional initialization for OS/2 */ - -static int -os_init(void) -{ -#ifndef PYCC_GCC - char reason[64]; - int rc = sock_init(); - - if (rc == 0) { - return 1; /* Success */ - } - - PyOS_snprintf(reason, sizeof(reason), - "OS/2 TCP/IP Error# %d", sock_errno()); - PyErr_SetString(PyExc_ImportError, reason); - - return 0; /* Failure */ -#else - /* No need to initialize sockets with GCC/EMX */ - return 1; /* Success */ -#endif -} - -#endif /* PYOS_OS2 */ - - -#ifndef OS_INIT_DEFINED -static int -os_init(void) -{ - return 1; /* Success */ -} -#endif - - -/* C API table - always add new things to the end for binary - compatibility. */ -static -PySocketModule_APIObject PySocketModuleAPI = -{ - &sock_type, - NULL -}; - - -/* Initialize the _socket module. - - This module is actually called "_socket", and there's a wrapper - "socket.py" which implements some additional functionality. On some - platforms (e.g. Windows and OS/2), socket.py also implements a - wrapper for the socket type that provides missing functionality such - as makefile(), dup() and fromfd(). The import of "_socket" may fail - with an ImportError exception if os-specific initialization fails. - On Windows, this does WINSOCK initialization. When WINSOCK is - initialized successfully, a call to WSACleanup() is scheduled to be - made at exit time. -*/ - -PyDoc_STRVAR(socket_doc, -"Implementation module for socket operations.\n\ -\n\ -See the socket module for documentation."); - -PyMODINIT_FUNC -init_socket(void) -{ - PyObject *m, *has_ipv6; - - if (!os_init()) - return; - - Py_TYPE(&sock_type) = &PyType_Type; - m = Py_InitModule3(PySocket_MODULE_NAME, - socket_methods, - socket_doc); - if (m == NULL) - return; - - socket_error = PyErr_NewException("socket.error", - PyExc_IOError, NULL); - if (socket_error == NULL) - return; - PySocketModuleAPI.error = socket_error; - Py_INCREF(socket_error); - PyModule_AddObject(m, "error", socket_error); - socket_herror = PyErr_NewException("socket.herror", - socket_error, NULL); - if (socket_herror == NULL) - return; - Py_INCREF(socket_herror); - PyModule_AddObject(m, "herror", socket_herror); - socket_gaierror = PyErr_NewException("socket.gaierror", socket_error, - NULL); - if (socket_gaierror == NULL) - return; - Py_INCREF(socket_gaierror); - PyModule_AddObject(m, "gaierror", socket_gaierror); - socket_timeout = PyErr_NewException("socket.timeout", - socket_error, NULL); - if (socket_timeout == NULL) - return; - Py_INCREF(socket_timeout); - PyModule_AddObject(m, "timeout", socket_timeout); - Py_INCREF((PyObject *)&sock_type); - if (PyModule_AddObject(m, "SocketType", - (PyObject *)&sock_type) != 0) - return; - Py_INCREF((PyObject *)&sock_type); - if (PyModule_AddObject(m, "socket", - (PyObject *)&sock_type) != 0) - return; - -#ifdef ENABLE_IPV6 - has_ipv6 = Py_True; -#else - has_ipv6 = Py_False; -#endif - Py_INCREF(has_ipv6); - PyModule_AddObject(m, "has_ipv6", has_ipv6); - - /* Export C API */ - if (PyModule_AddObject(m, PySocket_CAPI_NAME, - PyCapsule_New(&PySocketModuleAPI, PySocket_CAPSULE_NAME, NULL) - ) != 0) - return; - - /* Address families (we only support AF_INET and AF_UNIX) */ -#ifdef AF_UNSPEC - PyModule_AddIntConstant(m, "AF_UNSPEC", AF_UNSPEC); -#endif - PyModule_AddIntConstant(m, "AF_INET", AF_INET); -#ifdef AF_INET6 - PyModule_AddIntConstant(m, "AF_INET6", AF_INET6); -#endif /* AF_INET6 */ -#if defined(AF_UNIX) - PyModule_AddIntConstant(m, "AF_UNIX", AF_UNIX); -#endif /* AF_UNIX */ -#ifdef AF_AX25 - /* Amateur Radio AX.25 */ - PyModule_AddIntConstant(m, "AF_AX25", AF_AX25); -#endif -#ifdef AF_IPX - PyModule_AddIntConstant(m, "AF_IPX", AF_IPX); /* Novell IPX */ -#endif -#ifdef AF_APPLETALK - /* Appletalk DDP */ - PyModule_AddIntConstant(m, "AF_APPLETALK", AF_APPLETALK); -#endif -#ifdef AF_NETROM - /* Amateur radio NetROM */ - PyModule_AddIntConstant(m, "AF_NETROM", AF_NETROM); -#endif -#ifdef AF_BRIDGE - /* Multiprotocol bridge */ - PyModule_AddIntConstant(m, "AF_BRIDGE", AF_BRIDGE); -#endif -#ifdef AF_ATMPVC - /* ATM PVCs */ - PyModule_AddIntConstant(m, "AF_ATMPVC", AF_ATMPVC); -#endif -#ifdef AF_AAL5 - /* Reserved for Werner's ATM */ - PyModule_AddIntConstant(m, "AF_AAL5", AF_AAL5); -#endif -#ifdef AF_X25 - /* Reserved for X.25 project */ - PyModule_AddIntConstant(m, "AF_X25", AF_X25); -#endif -#ifdef AF_INET6 - PyModule_AddIntConstant(m, "AF_INET6", AF_INET6); /* IP version 6 */ -#endif -#ifdef AF_ROSE - /* Amateur Radio X.25 PLP */ - PyModule_AddIntConstant(m, "AF_ROSE", AF_ROSE); -#endif -#ifdef AF_DECnet - /* Reserved for DECnet project */ - PyModule_AddIntConstant(m, "AF_DECnet", AF_DECnet); -#endif -#ifdef AF_NETBEUI - /* Reserved for 802.2LLC project */ - PyModule_AddIntConstant(m, "AF_NETBEUI", AF_NETBEUI); -#endif -#ifdef AF_SECURITY - /* Security callback pseudo AF */ - PyModule_AddIntConstant(m, "AF_SECURITY", AF_SECURITY); -#endif -#ifdef AF_KEY - /* PF_KEY key management API */ - PyModule_AddIntConstant(m, "AF_KEY", AF_KEY); -#endif -#ifdef AF_NETLINK - /* */ - PyModule_AddIntConstant(m, "AF_NETLINK", AF_NETLINK); - PyModule_AddIntConstant(m, "NETLINK_ROUTE", NETLINK_ROUTE); -#ifdef NETLINK_SKIP - PyModule_AddIntConstant(m, "NETLINK_SKIP", NETLINK_SKIP); -#endif -#ifdef NETLINK_W1 - PyModule_AddIntConstant(m, "NETLINK_W1", NETLINK_W1); -#endif - PyModule_AddIntConstant(m, "NETLINK_USERSOCK", NETLINK_USERSOCK); - PyModule_AddIntConstant(m, "NETLINK_FIREWALL", NETLINK_FIREWALL); -#ifdef NETLINK_TCPDIAG - PyModule_AddIntConstant(m, "NETLINK_TCPDIAG", NETLINK_TCPDIAG); -#endif -#ifdef NETLINK_NFLOG - PyModule_AddIntConstant(m, "NETLINK_NFLOG", NETLINK_NFLOG); -#endif -#ifdef NETLINK_XFRM - PyModule_AddIntConstant(m, "NETLINK_XFRM", NETLINK_XFRM); -#endif -#ifdef NETLINK_ARPD - PyModule_AddIntConstant(m, "NETLINK_ARPD", NETLINK_ARPD); -#endif -#ifdef NETLINK_ROUTE6 - PyModule_AddIntConstant(m, "NETLINK_ROUTE6", NETLINK_ROUTE6); -#endif - PyModule_AddIntConstant(m, "NETLINK_IP6_FW", NETLINK_IP6_FW); -#ifdef NETLINK_DNRTMSG - PyModule_AddIntConstant(m, "NETLINK_DNRTMSG", NETLINK_DNRTMSG); -#endif -#ifdef NETLINK_TAPBASE - PyModule_AddIntConstant(m, "NETLINK_TAPBASE", NETLINK_TAPBASE); -#endif -#endif /* AF_NETLINK */ -#ifdef AF_ROUTE - /* Alias to emulate 4.4BSD */ - PyModule_AddIntConstant(m, "AF_ROUTE", AF_ROUTE); -#endif -#ifdef AF_ASH - /* Ash */ - PyModule_AddIntConstant(m, "AF_ASH", AF_ASH); -#endif -#ifdef AF_ECONET - /* Acorn Econet */ - PyModule_AddIntConstant(m, "AF_ECONET", AF_ECONET); -#endif -#ifdef AF_ATMSVC - /* ATM SVCs */ - PyModule_AddIntConstant(m, "AF_ATMSVC", AF_ATMSVC); -#endif -#ifdef AF_SNA - /* Linux SNA Project (nutters!) */ - PyModule_AddIntConstant(m, "AF_SNA", AF_SNA); -#endif -#ifdef AF_IRDA - /* IRDA sockets */ - PyModule_AddIntConstant(m, "AF_IRDA", AF_IRDA); -#endif -#ifdef AF_PPPOX - /* PPPoX sockets */ - PyModule_AddIntConstant(m, "AF_PPPOX", AF_PPPOX); -#endif -#ifdef AF_WANPIPE - /* Wanpipe API Sockets */ - PyModule_AddIntConstant(m, "AF_WANPIPE", AF_WANPIPE); -#endif -#ifdef AF_LLC - /* Linux LLC */ - PyModule_AddIntConstant(m, "AF_LLC", AF_LLC); -#endif - -#ifdef USE_BLUETOOTH - PyModule_AddIntConstant(m, "AF_BLUETOOTH", AF_BLUETOOTH); - PyModule_AddIntConstant(m, "BTPROTO_L2CAP", BTPROTO_L2CAP); - PyModule_AddIntConstant(m, "BTPROTO_HCI", BTPROTO_HCI); - PyModule_AddIntConstant(m, "SOL_HCI", SOL_HCI); -#if !defined(__NetBSD__) && !defined(__DragonFly__) - PyModule_AddIntConstant(m, "HCI_FILTER", HCI_FILTER); -#endif -#if !defined(__FreeBSD__) -#if !defined(__NetBSD__) && !defined(__DragonFly__) - PyModule_AddIntConstant(m, "HCI_TIME_STAMP", HCI_TIME_STAMP); -#endif - PyModule_AddIntConstant(m, "HCI_DATA_DIR", HCI_DATA_DIR); - PyModule_AddIntConstant(m, "BTPROTO_SCO", BTPROTO_SCO); -#endif - PyModule_AddIntConstant(m, "BTPROTO_RFCOMM", BTPROTO_RFCOMM); - PyModule_AddStringConstant(m, "BDADDR_ANY", "00:00:00:00:00:00"); - PyModule_AddStringConstant(m, "BDADDR_LOCAL", "00:00:00:FF:FF:FF"); -#endif - -#ifdef AF_PACKET - PyModule_AddIntMacro(m, AF_PACKET); -#endif -#ifdef PF_PACKET - PyModule_AddIntMacro(m, PF_PACKET); -#endif -#ifdef PACKET_HOST - PyModule_AddIntMacro(m, PACKET_HOST); -#endif -#ifdef PACKET_BROADCAST - PyModule_AddIntMacro(m, PACKET_BROADCAST); -#endif -#ifdef PACKET_MULTICAST - PyModule_AddIntMacro(m, PACKET_MULTICAST); -#endif -#ifdef PACKET_OTHERHOST - PyModule_AddIntMacro(m, PACKET_OTHERHOST); -#endif -#ifdef PACKET_OUTGOING - PyModule_AddIntMacro(m, PACKET_OUTGOING); -#endif -#ifdef PACKET_LOOPBACK - PyModule_AddIntMacro(m, PACKET_LOOPBACK); -#endif -#ifdef PACKET_FASTROUTE - PyModule_AddIntMacro(m, PACKET_FASTROUTE); -#endif - -#ifdef HAVE_LINUX_TIPC_H - PyModule_AddIntConstant(m, "AF_TIPC", AF_TIPC); - - /* for addresses */ - PyModule_AddIntConstant(m, "TIPC_ADDR_NAMESEQ", TIPC_ADDR_NAMESEQ); - PyModule_AddIntConstant(m, "TIPC_ADDR_NAME", TIPC_ADDR_NAME); - PyModule_AddIntConstant(m, "TIPC_ADDR_ID", TIPC_ADDR_ID); - - PyModule_AddIntConstant(m, "TIPC_ZONE_SCOPE", TIPC_ZONE_SCOPE); - PyModule_AddIntConstant(m, "TIPC_CLUSTER_SCOPE", TIPC_CLUSTER_SCOPE); - PyModule_AddIntConstant(m, "TIPC_NODE_SCOPE", TIPC_NODE_SCOPE); - - /* for setsockopt() */ - PyModule_AddIntConstant(m, "SOL_TIPC", SOL_TIPC); - PyModule_AddIntConstant(m, "TIPC_IMPORTANCE", TIPC_IMPORTANCE); - PyModule_AddIntConstant(m, "TIPC_SRC_DROPPABLE", TIPC_SRC_DROPPABLE); - PyModule_AddIntConstant(m, "TIPC_DEST_DROPPABLE", - TIPC_DEST_DROPPABLE); - PyModule_AddIntConstant(m, "TIPC_CONN_TIMEOUT", TIPC_CONN_TIMEOUT); - - PyModule_AddIntConstant(m, "TIPC_LOW_IMPORTANCE", - TIPC_LOW_IMPORTANCE); - PyModule_AddIntConstant(m, "TIPC_MEDIUM_IMPORTANCE", - TIPC_MEDIUM_IMPORTANCE); - PyModule_AddIntConstant(m, "TIPC_HIGH_IMPORTANCE", - TIPC_HIGH_IMPORTANCE); - PyModule_AddIntConstant(m, "TIPC_CRITICAL_IMPORTANCE", - TIPC_CRITICAL_IMPORTANCE); - - /* for subscriptions */ - PyModule_AddIntConstant(m, "TIPC_SUB_PORTS", TIPC_SUB_PORTS); - PyModule_AddIntConstant(m, "TIPC_SUB_SERVICE", TIPC_SUB_SERVICE); -#ifdef TIPC_SUB_CANCEL - /* doesn't seem to be available everywhere */ - PyModule_AddIntConstant(m, "TIPC_SUB_CANCEL", TIPC_SUB_CANCEL); -#endif - PyModule_AddIntConstant(m, "TIPC_WAIT_FOREVER", TIPC_WAIT_FOREVER); - PyModule_AddIntConstant(m, "TIPC_PUBLISHED", TIPC_PUBLISHED); - PyModule_AddIntConstant(m, "TIPC_WITHDRAWN", TIPC_WITHDRAWN); - PyModule_AddIntConstant(m, "TIPC_SUBSCR_TIMEOUT", TIPC_SUBSCR_TIMEOUT); - PyModule_AddIntConstant(m, "TIPC_CFG_SRV", TIPC_CFG_SRV); - PyModule_AddIntConstant(m, "TIPC_TOP_SRV", TIPC_TOP_SRV); -#endif - - /* Socket types */ - PyModule_AddIntConstant(m, "SOCK_STREAM", SOCK_STREAM); - PyModule_AddIntConstant(m, "SOCK_DGRAM", SOCK_DGRAM); -#ifndef __BEOS__ -/* We have incomplete socket support. */ - PyModule_AddIntConstant(m, "SOCK_RAW", SOCK_RAW); - PyModule_AddIntConstant(m, "SOCK_SEQPACKET", SOCK_SEQPACKET); -#if defined(SOCK_RDM) - PyModule_AddIntConstant(m, "SOCK_RDM", SOCK_RDM); -#endif -#endif - -#ifdef SO_DEBUG - PyModule_AddIntConstant(m, "SO_DEBUG", SO_DEBUG); -#endif -#ifdef SO_ACCEPTCONN - PyModule_AddIntConstant(m, "SO_ACCEPTCONN", SO_ACCEPTCONN); -#endif -#ifdef SO_REUSEADDR - PyModule_AddIntConstant(m, "SO_REUSEADDR", SO_REUSEADDR); -#endif -#ifdef SO_EXCLUSIVEADDRUSE - PyModule_AddIntConstant(m, "SO_EXCLUSIVEADDRUSE", SO_EXCLUSIVEADDRUSE); -#endif - -#ifdef SO_KEEPALIVE - PyModule_AddIntConstant(m, "SO_KEEPALIVE", SO_KEEPALIVE); -#endif -#ifdef SO_DONTROUTE - PyModule_AddIntConstant(m, "SO_DONTROUTE", SO_DONTROUTE); -#endif -#ifdef SO_BROADCAST - PyModule_AddIntConstant(m, "SO_BROADCAST", SO_BROADCAST); -#endif -#ifdef SO_USELOOPBACK - PyModule_AddIntConstant(m, "SO_USELOOPBACK", SO_USELOOPBACK); -#endif -#ifdef SO_LINGER - PyModule_AddIntConstant(m, "SO_LINGER", SO_LINGER); -#endif -#ifdef SO_OOBINLINE - PyModule_AddIntConstant(m, "SO_OOBINLINE", SO_OOBINLINE); -#endif -#ifdef SO_REUSEPORT - PyModule_AddIntConstant(m, "SO_REUSEPORT", SO_REUSEPORT); -#endif -#ifdef SO_SNDBUF - PyModule_AddIntConstant(m, "SO_SNDBUF", SO_SNDBUF); -#endif -#ifdef SO_RCVBUF - PyModule_AddIntConstant(m, "SO_RCVBUF", SO_RCVBUF); -#endif -#ifdef SO_SNDLOWAT - PyModule_AddIntConstant(m, "SO_SNDLOWAT", SO_SNDLOWAT); -#endif -#ifdef SO_RCVLOWAT - PyModule_AddIntConstant(m, "SO_RCVLOWAT", SO_RCVLOWAT); -#endif -#ifdef SO_SNDTIMEO - PyModule_AddIntConstant(m, "SO_SNDTIMEO", SO_SNDTIMEO); -#endif -#ifdef SO_RCVTIMEO - PyModule_AddIntConstant(m, "SO_RCVTIMEO", SO_RCVTIMEO); -#endif -#ifdef SO_ERROR - PyModule_AddIntConstant(m, "SO_ERROR", SO_ERROR); -#endif -#ifdef SO_TYPE - PyModule_AddIntConstant(m, "SO_TYPE", SO_TYPE); -#endif -#ifdef SO_SETFIB - PyModule_AddIntConstant(m, "SO_SETFIB", SO_SETFIB); -#endif - - /* Maximum number of connections for "listen" */ -#ifdef SOMAXCONN - PyModule_AddIntConstant(m, "SOMAXCONN", SOMAXCONN); -#else - PyModule_AddIntConstant(m, "SOMAXCONN", 5); /* Common value */ -#endif - - /* Flags for send, recv */ -#ifdef MSG_OOB - PyModule_AddIntConstant(m, "MSG_OOB", MSG_OOB); -#endif -#ifdef MSG_PEEK - PyModule_AddIntConstant(m, "MSG_PEEK", MSG_PEEK); -#endif -#ifdef MSG_DONTROUTE - PyModule_AddIntConstant(m, "MSG_DONTROUTE", MSG_DONTROUTE); -#endif -#ifdef MSG_DONTWAIT - PyModule_AddIntConstant(m, "MSG_DONTWAIT", MSG_DONTWAIT); -#endif -#ifdef MSG_EOR - PyModule_AddIntConstant(m, "MSG_EOR", MSG_EOR); -#endif -#ifdef MSG_TRUNC - PyModule_AddIntConstant(m, "MSG_TRUNC", MSG_TRUNC); -#endif -#ifdef MSG_CTRUNC - PyModule_AddIntConstant(m, "MSG_CTRUNC", MSG_CTRUNC); -#endif -#ifdef MSG_WAITALL - PyModule_AddIntConstant(m, "MSG_WAITALL", MSG_WAITALL); -#endif -#ifdef MSG_BTAG - PyModule_AddIntConstant(m, "MSG_BTAG", MSG_BTAG); -#endif -#ifdef MSG_ETAG - PyModule_AddIntConstant(m, "MSG_ETAG", MSG_ETAG); -#endif - - /* Protocol level and numbers, usable for [gs]etsockopt */ -#ifdef SOL_SOCKET - PyModule_AddIntConstant(m, "SOL_SOCKET", SOL_SOCKET); -#endif -#ifdef SOL_IP - PyModule_AddIntConstant(m, "SOL_IP", SOL_IP); -#else - PyModule_AddIntConstant(m, "SOL_IP", 0); -#endif -#ifdef SOL_IPX - PyModule_AddIntConstant(m, "SOL_IPX", SOL_IPX); -#endif -#ifdef SOL_AX25 - PyModule_AddIntConstant(m, "SOL_AX25", SOL_AX25); -#endif -#ifdef SOL_ATALK - PyModule_AddIntConstant(m, "SOL_ATALK", SOL_ATALK); -#endif -#ifdef SOL_NETROM - PyModule_AddIntConstant(m, "SOL_NETROM", SOL_NETROM); -#endif -#ifdef SOL_ROSE - PyModule_AddIntConstant(m, "SOL_ROSE", SOL_ROSE); -#endif -#ifdef SOL_TCP - PyModule_AddIntConstant(m, "SOL_TCP", SOL_TCP); -#else - PyModule_AddIntConstant(m, "SOL_TCP", 6); -#endif -#ifdef SOL_UDP - PyModule_AddIntConstant(m, "SOL_UDP", SOL_UDP); -#else - PyModule_AddIntConstant(m, "SOL_UDP", 17); -#endif -#ifdef IPPROTO_IP - PyModule_AddIntConstant(m, "IPPROTO_IP", IPPROTO_IP); -#else - PyModule_AddIntConstant(m, "IPPROTO_IP", 0); -#endif -#ifdef IPPROTO_HOPOPTS - PyModule_AddIntConstant(m, "IPPROTO_HOPOPTS", IPPROTO_HOPOPTS); -#endif -#ifdef IPPROTO_ICMP - PyModule_AddIntConstant(m, "IPPROTO_ICMP", IPPROTO_ICMP); -#else - PyModule_AddIntConstant(m, "IPPROTO_ICMP", 1); -#endif -#ifdef IPPROTO_IGMP - PyModule_AddIntConstant(m, "IPPROTO_IGMP", IPPROTO_IGMP); -#endif -#ifdef IPPROTO_GGP - PyModule_AddIntConstant(m, "IPPROTO_GGP", IPPROTO_GGP); -#endif -#ifdef IPPROTO_IPV4 - PyModule_AddIntConstant(m, "IPPROTO_IPV4", IPPROTO_IPV4); -#endif -#ifdef IPPROTO_IPV6 - PyModule_AddIntConstant(m, "IPPROTO_IPV6", IPPROTO_IPV6); -#endif -#ifdef IPPROTO_IPIP - PyModule_AddIntConstant(m, "IPPROTO_IPIP", IPPROTO_IPIP); -#endif -#ifdef IPPROTO_TCP - PyModule_AddIntConstant(m, "IPPROTO_TCP", IPPROTO_TCP); -#else - PyModule_AddIntConstant(m, "IPPROTO_TCP", 6); -#endif -#ifdef IPPROTO_EGP - PyModule_AddIntConstant(m, "IPPROTO_EGP", IPPROTO_EGP); -#endif -#ifdef IPPROTO_PUP - PyModule_AddIntConstant(m, "IPPROTO_PUP", IPPROTO_PUP); -#endif -#ifdef IPPROTO_UDP - PyModule_AddIntConstant(m, "IPPROTO_UDP", IPPROTO_UDP); -#else - PyModule_AddIntConstant(m, "IPPROTO_UDP", 17); -#endif -#ifdef IPPROTO_IDP - PyModule_AddIntConstant(m, "IPPROTO_IDP", IPPROTO_IDP); -#endif -#ifdef IPPROTO_HELLO - PyModule_AddIntConstant(m, "IPPROTO_HELLO", IPPROTO_HELLO); -#endif -#ifdef IPPROTO_ND - PyModule_AddIntConstant(m, "IPPROTO_ND", IPPROTO_ND); -#endif -#ifdef IPPROTO_TP - PyModule_AddIntConstant(m, "IPPROTO_TP", IPPROTO_TP); -#endif -#ifdef IPPROTO_IPV6 - PyModule_AddIntConstant(m, "IPPROTO_IPV6", IPPROTO_IPV6); -#endif -#ifdef IPPROTO_ROUTING - PyModule_AddIntConstant(m, "IPPROTO_ROUTING", IPPROTO_ROUTING); -#endif -#ifdef IPPROTO_FRAGMENT - PyModule_AddIntConstant(m, "IPPROTO_FRAGMENT", IPPROTO_FRAGMENT); -#endif -#ifdef IPPROTO_RSVP - PyModule_AddIntConstant(m, "IPPROTO_RSVP", IPPROTO_RSVP); -#endif -#ifdef IPPROTO_GRE - PyModule_AddIntConstant(m, "IPPROTO_GRE", IPPROTO_GRE); -#endif -#ifdef IPPROTO_ESP - PyModule_AddIntConstant(m, "IPPROTO_ESP", IPPROTO_ESP); -#endif -#ifdef IPPROTO_AH - PyModule_AddIntConstant(m, "IPPROTO_AH", IPPROTO_AH); -#endif -#ifdef IPPROTO_MOBILE - PyModule_AddIntConstant(m, "IPPROTO_MOBILE", IPPROTO_MOBILE); -#endif -#ifdef IPPROTO_ICMPV6 - PyModule_AddIntConstant(m, "IPPROTO_ICMPV6", IPPROTO_ICMPV6); -#endif -#ifdef IPPROTO_NONE - PyModule_AddIntConstant(m, "IPPROTO_NONE", IPPROTO_NONE); -#endif -#ifdef IPPROTO_DSTOPTS - PyModule_AddIntConstant(m, "IPPROTO_DSTOPTS", IPPROTO_DSTOPTS); -#endif -#ifdef IPPROTO_XTP - PyModule_AddIntConstant(m, "IPPROTO_XTP", IPPROTO_XTP); -#endif -#ifdef IPPROTO_EON - PyModule_AddIntConstant(m, "IPPROTO_EON", IPPROTO_EON); -#endif -#ifdef IPPROTO_PIM - PyModule_AddIntConstant(m, "IPPROTO_PIM", IPPROTO_PIM); -#endif -#ifdef IPPROTO_IPCOMP - PyModule_AddIntConstant(m, "IPPROTO_IPCOMP", IPPROTO_IPCOMP); -#endif -#ifdef IPPROTO_VRRP - PyModule_AddIntConstant(m, "IPPROTO_VRRP", IPPROTO_VRRP); -#endif -#ifdef IPPROTO_BIP - PyModule_AddIntConstant(m, "IPPROTO_BIP", IPPROTO_BIP); -#endif -/**/ -#ifdef IPPROTO_RAW - PyModule_AddIntConstant(m, "IPPROTO_RAW", IPPROTO_RAW); -#else - PyModule_AddIntConstant(m, "IPPROTO_RAW", 255); -#endif -#ifdef IPPROTO_MAX - PyModule_AddIntConstant(m, "IPPROTO_MAX", IPPROTO_MAX); -#endif - - /* Some port configuration */ -#ifdef IPPORT_RESERVED - PyModule_AddIntConstant(m, "IPPORT_RESERVED", IPPORT_RESERVED); -#else - PyModule_AddIntConstant(m, "IPPORT_RESERVED", 1024); -#endif -#ifdef IPPORT_USERRESERVED - PyModule_AddIntConstant(m, "IPPORT_USERRESERVED", IPPORT_USERRESERVED); -#else - PyModule_AddIntConstant(m, "IPPORT_USERRESERVED", 5000); -#endif - - /* Some reserved IP v.4 addresses */ -#ifdef INADDR_ANY - PyModule_AddIntConstant(m, "INADDR_ANY", INADDR_ANY); -#else - PyModule_AddIntConstant(m, "INADDR_ANY", 0x00000000); -#endif -#ifdef INADDR_BROADCAST - PyModule_AddIntConstant(m, "INADDR_BROADCAST", INADDR_BROADCAST); -#else - PyModule_AddIntConstant(m, "INADDR_BROADCAST", 0xffffffff); -#endif -#ifdef INADDR_LOOPBACK - PyModule_AddIntConstant(m, "INADDR_LOOPBACK", INADDR_LOOPBACK); -#else - PyModule_AddIntConstant(m, "INADDR_LOOPBACK", 0x7F000001); -#endif -#ifdef INADDR_UNSPEC_GROUP - PyModule_AddIntConstant(m, "INADDR_UNSPEC_GROUP", INADDR_UNSPEC_GROUP); -#else - PyModule_AddIntConstant(m, "INADDR_UNSPEC_GROUP", 0xe0000000); -#endif -#ifdef INADDR_ALLHOSTS_GROUP - PyModule_AddIntConstant(m, "INADDR_ALLHOSTS_GROUP", - INADDR_ALLHOSTS_GROUP); -#else - PyModule_AddIntConstant(m, "INADDR_ALLHOSTS_GROUP", 0xe0000001); -#endif -#ifdef INADDR_MAX_LOCAL_GROUP - PyModule_AddIntConstant(m, "INADDR_MAX_LOCAL_GROUP", - INADDR_MAX_LOCAL_GROUP); -#else - PyModule_AddIntConstant(m, "INADDR_MAX_LOCAL_GROUP", 0xe00000ff); -#endif -#ifdef INADDR_NONE - PyModule_AddIntConstant(m, "INADDR_NONE", INADDR_NONE); -#else - PyModule_AddIntConstant(m, "INADDR_NONE", 0xffffffff); -#endif - - /* IPv4 [gs]etsockopt options */ -#ifdef IP_OPTIONS - PyModule_AddIntConstant(m, "IP_OPTIONS", IP_OPTIONS); -#endif -#ifdef IP_HDRINCL - PyModule_AddIntConstant(m, "IP_HDRINCL", IP_HDRINCL); -#endif -#ifdef IP_TOS - PyModule_AddIntConstant(m, "IP_TOS", IP_TOS); -#endif -#ifdef IP_TTL - PyModule_AddIntConstant(m, "IP_TTL", IP_TTL); -#endif -#ifdef IP_RECVOPTS - PyModule_AddIntConstant(m, "IP_RECVOPTS", IP_RECVOPTS); -#endif -#ifdef IP_RECVRETOPTS - PyModule_AddIntConstant(m, "IP_RECVRETOPTS", IP_RECVRETOPTS); -#endif -#ifdef IP_RECVDSTADDR - PyModule_AddIntConstant(m, "IP_RECVDSTADDR", IP_RECVDSTADDR); -#endif -#ifdef IP_RETOPTS - PyModule_AddIntConstant(m, "IP_RETOPTS", IP_RETOPTS); -#endif -#ifdef IP_MULTICAST_IF - PyModule_AddIntConstant(m, "IP_MULTICAST_IF", IP_MULTICAST_IF); -#endif -#ifdef IP_MULTICAST_TTL - PyModule_AddIntConstant(m, "IP_MULTICAST_TTL", IP_MULTICAST_TTL); -#endif -#ifdef IP_MULTICAST_LOOP - PyModule_AddIntConstant(m, "IP_MULTICAST_LOOP", IP_MULTICAST_LOOP); -#endif -#ifdef IP_ADD_MEMBERSHIP - PyModule_AddIntConstant(m, "IP_ADD_MEMBERSHIP", IP_ADD_MEMBERSHIP); -#endif -#ifdef IP_DROP_MEMBERSHIP - PyModule_AddIntConstant(m, "IP_DROP_MEMBERSHIP", IP_DROP_MEMBERSHIP); -#endif -#ifdef IP_DEFAULT_MULTICAST_TTL - PyModule_AddIntConstant(m, "IP_DEFAULT_MULTICAST_TTL", - IP_DEFAULT_MULTICAST_TTL); -#endif -#ifdef IP_DEFAULT_MULTICAST_LOOP - PyModule_AddIntConstant(m, "IP_DEFAULT_MULTICAST_LOOP", - IP_DEFAULT_MULTICAST_LOOP); -#endif -#ifdef IP_MAX_MEMBERSHIPS - PyModule_AddIntConstant(m, "IP_MAX_MEMBERSHIPS", IP_MAX_MEMBERSHIPS); -#endif - - /* IPv6 [gs]etsockopt options, defined in RFC2553 */ -#ifdef IPV6_JOIN_GROUP - PyModule_AddIntConstant(m, "IPV6_JOIN_GROUP", IPV6_JOIN_GROUP); -#endif -#ifdef IPV6_LEAVE_GROUP - PyModule_AddIntConstant(m, "IPV6_LEAVE_GROUP", IPV6_LEAVE_GROUP); -#endif -#ifdef IPV6_MULTICAST_HOPS - PyModule_AddIntConstant(m, "IPV6_MULTICAST_HOPS", IPV6_MULTICAST_HOPS); -#endif -#ifdef IPV6_MULTICAST_IF - PyModule_AddIntConstant(m, "IPV6_MULTICAST_IF", IPV6_MULTICAST_IF); -#endif -#ifdef IPV6_MULTICAST_LOOP - PyModule_AddIntConstant(m, "IPV6_MULTICAST_LOOP", IPV6_MULTICAST_LOOP); -#endif -#ifdef IPV6_UNICAST_HOPS - PyModule_AddIntConstant(m, "IPV6_UNICAST_HOPS", IPV6_UNICAST_HOPS); -#endif - /* Additional IPV6 socket options, defined in RFC 3493 */ -#ifdef IPV6_V6ONLY - PyModule_AddIntConstant(m, "IPV6_V6ONLY", IPV6_V6ONLY); -#endif - /* Advanced IPV6 socket options, from RFC 3542 */ -#ifdef IPV6_CHECKSUM - PyModule_AddIntConstant(m, "IPV6_CHECKSUM", IPV6_CHECKSUM); -#endif -#ifdef IPV6_DONTFRAG - PyModule_AddIntConstant(m, "IPV6_DONTFRAG", IPV6_DONTFRAG); -#endif -#ifdef IPV6_DSTOPTS - PyModule_AddIntConstant(m, "IPV6_DSTOPTS", IPV6_DSTOPTS); -#endif -#ifdef IPV6_HOPLIMIT - PyModule_AddIntConstant(m, "IPV6_HOPLIMIT", IPV6_HOPLIMIT); -#endif -#ifdef IPV6_HOPOPTS - PyModule_AddIntConstant(m, "IPV6_HOPOPTS", IPV6_HOPOPTS); -#endif -#ifdef IPV6_NEXTHOP - PyModule_AddIntConstant(m, "IPV6_NEXTHOP", IPV6_NEXTHOP); -#endif -#ifdef IPV6_PATHMTU - PyModule_AddIntConstant(m, "IPV6_PATHMTU", IPV6_PATHMTU); -#endif -#ifdef IPV6_PKTINFO - PyModule_AddIntConstant(m, "IPV6_PKTINFO", IPV6_PKTINFO); -#endif -#ifdef IPV6_RECVDSTOPTS - PyModule_AddIntConstant(m, "IPV6_RECVDSTOPTS", IPV6_RECVDSTOPTS); -#endif -#ifdef IPV6_RECVHOPLIMIT - PyModule_AddIntConstant(m, "IPV6_RECVHOPLIMIT", IPV6_RECVHOPLIMIT); -#endif -#ifdef IPV6_RECVHOPOPTS - PyModule_AddIntConstant(m, "IPV6_RECVHOPOPTS", IPV6_RECVHOPOPTS); -#endif -#ifdef IPV6_RECVPKTINFO - PyModule_AddIntConstant(m, "IPV6_RECVPKTINFO", IPV6_RECVPKTINFO); -#endif -#ifdef IPV6_RECVRTHDR - PyModule_AddIntConstant(m, "IPV6_RECVRTHDR", IPV6_RECVRTHDR); -#endif -#ifdef IPV6_RECVTCLASS - PyModule_AddIntConstant(m, "IPV6_RECVTCLASS", IPV6_RECVTCLASS); -#endif -#ifdef IPV6_RTHDR - PyModule_AddIntConstant(m, "IPV6_RTHDR", IPV6_RTHDR); -#endif -#ifdef IPV6_RTHDRDSTOPTS - PyModule_AddIntConstant(m, "IPV6_RTHDRDSTOPTS", IPV6_RTHDRDSTOPTS); -#endif -#ifdef IPV6_RTHDR_TYPE_0 - PyModule_AddIntConstant(m, "IPV6_RTHDR_TYPE_0", IPV6_RTHDR_TYPE_0); -#endif -#ifdef IPV6_RECVPATHMTU - PyModule_AddIntConstant(m, "IPV6_RECVPATHMTU", IPV6_RECVPATHMTU); -#endif -#ifdef IPV6_TCLASS - PyModule_AddIntConstant(m, "IPV6_TCLASS", IPV6_TCLASS); -#endif -#ifdef IPV6_USE_MIN_MTU - PyModule_AddIntConstant(m, "IPV6_USE_MIN_MTU", IPV6_USE_MIN_MTU); -#endif - - /* TCP options */ -#ifdef TCP_NODELAY - PyModule_AddIntConstant(m, "TCP_NODELAY", TCP_NODELAY); -#endif -#ifdef TCP_MAXSEG - PyModule_AddIntConstant(m, "TCP_MAXSEG", TCP_MAXSEG); -#endif -#ifdef TCP_CORK - PyModule_AddIntConstant(m, "TCP_CORK", TCP_CORK); -#endif -#ifdef TCP_KEEPIDLE - PyModule_AddIntConstant(m, "TCP_KEEPIDLE", TCP_KEEPIDLE); -#endif -#ifdef TCP_KEEPINTVL - PyModule_AddIntConstant(m, "TCP_KEEPINTVL", TCP_KEEPINTVL); -#endif -#ifdef TCP_KEEPCNT - PyModule_AddIntConstant(m, "TCP_KEEPCNT", TCP_KEEPCNT); -#endif -#ifdef TCP_SYNCNT - PyModule_AddIntConstant(m, "TCP_SYNCNT", TCP_SYNCNT); -#endif -#ifdef TCP_LINGER2 - PyModule_AddIntConstant(m, "TCP_LINGER2", TCP_LINGER2); -#endif -#ifdef TCP_DEFER_ACCEPT - PyModule_AddIntConstant(m, "TCP_DEFER_ACCEPT", TCP_DEFER_ACCEPT); -#endif -#ifdef TCP_WINDOW_CLAMP - PyModule_AddIntConstant(m, "TCP_WINDOW_CLAMP", TCP_WINDOW_CLAMP); -#endif -#ifdef TCP_INFO - PyModule_AddIntConstant(m, "TCP_INFO", TCP_INFO); -#endif -#ifdef TCP_QUICKACK - PyModule_AddIntConstant(m, "TCP_QUICKACK", TCP_QUICKACK); -#endif - - - /* IPX options */ -#ifdef IPX_TYPE - PyModule_AddIntConstant(m, "IPX_TYPE", IPX_TYPE); -#endif - - /* get{addr,name}info parameters */ -#ifdef EAI_ADDRFAMILY - PyModule_AddIntConstant(m, "EAI_ADDRFAMILY", EAI_ADDRFAMILY); -#endif -#ifdef EAI_AGAIN - PyModule_AddIntConstant(m, "EAI_AGAIN", EAI_AGAIN); -#endif -#ifdef EAI_BADFLAGS - PyModule_AddIntConstant(m, "EAI_BADFLAGS", EAI_BADFLAGS); -#endif -#ifdef EAI_FAIL - PyModule_AddIntConstant(m, "EAI_FAIL", EAI_FAIL); -#endif -#ifdef EAI_FAMILY - PyModule_AddIntConstant(m, "EAI_FAMILY", EAI_FAMILY); -#endif -#ifdef EAI_MEMORY - PyModule_AddIntConstant(m, "EAI_MEMORY", EAI_MEMORY); -#endif -#ifdef EAI_NODATA - PyModule_AddIntConstant(m, "EAI_NODATA", EAI_NODATA); -#endif -#ifdef EAI_NONAME - PyModule_AddIntConstant(m, "EAI_NONAME", EAI_NONAME); -#endif -#ifdef EAI_OVERFLOW - PyModule_AddIntConstant(m, "EAI_OVERFLOW", EAI_OVERFLOW); -#endif -#ifdef EAI_SERVICE - PyModule_AddIntConstant(m, "EAI_SERVICE", EAI_SERVICE); -#endif -#ifdef EAI_SOCKTYPE - PyModule_AddIntConstant(m, "EAI_SOCKTYPE", EAI_SOCKTYPE); -#endif -#ifdef EAI_SYSTEM - PyModule_AddIntConstant(m, "EAI_SYSTEM", EAI_SYSTEM); -#endif -#ifdef EAI_BADHINTS - PyModule_AddIntConstant(m, "EAI_BADHINTS", EAI_BADHINTS); -#endif -#ifdef EAI_PROTOCOL - PyModule_AddIntConstant(m, "EAI_PROTOCOL", EAI_PROTOCOL); -#endif -#ifdef EAI_MAX - PyModule_AddIntConstant(m, "EAI_MAX", EAI_MAX); -#endif -#ifdef AI_PASSIVE - PyModule_AddIntConstant(m, "AI_PASSIVE", AI_PASSIVE); -#endif -#ifdef AI_CANONNAME - PyModule_AddIntConstant(m, "AI_CANONNAME", AI_CANONNAME); -#endif -#ifdef AI_NUMERICHOST - PyModule_AddIntConstant(m, "AI_NUMERICHOST", AI_NUMERICHOST); -#endif -#ifdef AI_NUMERICSERV - PyModule_AddIntConstant(m, "AI_NUMERICSERV", AI_NUMERICSERV); -#endif -#ifdef AI_MASK - PyModule_AddIntConstant(m, "AI_MASK", AI_MASK); -#endif -#ifdef AI_ALL - PyModule_AddIntConstant(m, "AI_ALL", AI_ALL); -#endif -#ifdef AI_V4MAPPED_CFG - PyModule_AddIntConstant(m, "AI_V4MAPPED_CFG", AI_V4MAPPED_CFG); -#endif -#ifdef AI_ADDRCONFIG - PyModule_AddIntConstant(m, "AI_ADDRCONFIG", AI_ADDRCONFIG); -#endif -#ifdef AI_V4MAPPED - PyModule_AddIntConstant(m, "AI_V4MAPPED", AI_V4MAPPED); -#endif -#ifdef AI_DEFAULT - PyModule_AddIntConstant(m, "AI_DEFAULT", AI_DEFAULT); -#endif -#ifdef NI_MAXHOST - PyModule_AddIntConstant(m, "NI_MAXHOST", NI_MAXHOST); -#endif -#ifdef NI_MAXSERV - PyModule_AddIntConstant(m, "NI_MAXSERV", NI_MAXSERV); -#endif -#ifdef NI_NOFQDN - PyModule_AddIntConstant(m, "NI_NOFQDN", NI_NOFQDN); -#endif -#ifdef NI_NUMERICHOST - PyModule_AddIntConstant(m, "NI_NUMERICHOST", NI_NUMERICHOST); -#endif -#ifdef NI_NAMEREQD - PyModule_AddIntConstant(m, "NI_NAMEREQD", NI_NAMEREQD); -#endif -#ifdef NI_NUMERICSERV - PyModule_AddIntConstant(m, "NI_NUMERICSERV", NI_NUMERICSERV); -#endif -#ifdef NI_DGRAM - PyModule_AddIntConstant(m, "NI_DGRAM", NI_DGRAM); -#endif - - /* shutdown() parameters */ -#ifdef SHUT_RD - PyModule_AddIntConstant(m, "SHUT_RD", SHUT_RD); -#elif defined(SD_RECEIVE) - PyModule_AddIntConstant(m, "SHUT_RD", SD_RECEIVE); -#else - PyModule_AddIntConstant(m, "SHUT_RD", 0); -#endif -#ifdef SHUT_WR - PyModule_AddIntConstant(m, "SHUT_WR", SHUT_WR); -#elif defined(SD_SEND) - PyModule_AddIntConstant(m, "SHUT_WR", SD_SEND); -#else - PyModule_AddIntConstant(m, "SHUT_WR", 1); -#endif -#ifdef SHUT_RDWR - PyModule_AddIntConstant(m, "SHUT_RDWR", SHUT_RDWR); -#elif defined(SD_BOTH) - PyModule_AddIntConstant(m, "SHUT_RDWR", SD_BOTH); -#else - PyModule_AddIntConstant(m, "SHUT_RDWR", 2); -#endif - -#ifdef SIO_RCVALL - { - DWORD codes[] = {SIO_RCVALL, SIO_KEEPALIVE_VALS}; - const char *names[] = {"SIO_RCVALL", "SIO_KEEPALIVE_VALS"}; - int i; - for(i = 0; i -# else -# include -# endif -# include -# if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP))) -# include -# endif - -#else /* MS_WINDOWS */ -# include -# include -/* VC6 is shipped with old platform headers, and does not have MSTcpIP.h - * Separate SDKs have all the functions we want, but older ones don't have - * any version information. - * I use SIO_GET_MULTICAST_FILTER to detect a decent SDK. - */ -# ifdef SIO_GET_MULTICAST_FILTER -# include /* for SIO_RCVALL */ -# define HAVE_ADDRINFO -# define HAVE_SOCKADDR_STORAGE -# define HAVE_GETADDRINFO -# define HAVE_GETNAMEINFO -# define ENABLE_IPV6 -# else -typedef int socklen_t; -# endif /* IPPROTO_IPV6 */ -#endif /* MS_WINDOWS */ - -#ifdef HAVE_SYS_UN_H -# include -#else -# undef AF_UNIX -#endif - -#ifdef HAVE_LINUX_NETLINK_H -# ifdef HAVE_ASM_TYPES_H -# include -# endif -# include -#else -# undef AF_NETLINK -#endif - -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H -#include -#include -#include -#include -#include -#endif - -#ifdef HAVE_BLUETOOTH_H -#include -#endif - -#ifdef HAVE_NETPACKET_PACKET_H -# include -# include -# include -#endif - -#ifdef HAVE_LINUX_TIPC_H -# include -#endif - -#ifndef Py__SOCKET_H -#define Py__SOCKET_H -#ifdef __cplusplus -extern "C" { -#endif - -/* Python module and C API name */ -#define PySocket_MODULE_NAME "_socket" -#define PySocket_CAPI_NAME "CAPI" -#define PySocket_CAPSULE_NAME (PySocket_MODULE_NAME "." PySocket_CAPI_NAME) - -/* Abstract the socket file descriptor type */ -#ifdef MS_WINDOWS -typedef SOCKET SOCKET_T; -# ifdef MS_WIN64 -# define SIZEOF_SOCKET_T 8 -# else -# define SIZEOF_SOCKET_T 4 -# endif -#else -typedef int SOCKET_T; -# define SIZEOF_SOCKET_T SIZEOF_INT -#endif - -/* Socket address */ -typedef union sock_addr { - struct sockaddr_in in; -#ifdef AF_UNIX - struct sockaddr_un un; -#endif -#ifdef AF_NETLINK - struct sockaddr_nl nl; -#endif -#ifdef ENABLE_IPV6 - struct sockaddr_in6 in6; - struct sockaddr_storage storage; -#endif -#ifdef HAVE_BLUETOOTH_BLUETOOTH_H - struct sockaddr_l2 bt_l2; - struct sockaddr_rc bt_rc; - struct sockaddr_sco bt_sco; - struct sockaddr_hci bt_hci; -#endif -#ifdef HAVE_NETPACKET_PACKET_H - struct sockaddr_ll ll; -#endif -} sock_addr_t; - -/* The object holding a socket. It holds some extra information, - like the address family, which is used to decode socket address - arguments properly. */ - -typedef struct { - PyObject_HEAD - SOCKET_T sock_fd; /* Socket file descriptor */ - int sock_family; /* Address family, e.g., AF_INET */ - int sock_type; /* Socket type, e.g., SOCK_STREAM */ - int sock_proto; /* Protocol type, usually 0 */ - PyObject *(*errorhandler)(void); /* Error handler; checks - errno, returns NULL and - sets a Python exception */ - double sock_timeout; /* Operation timeout in seconds; - 0.0 means non-blocking */ - PyObject *weakreflist; -} PySocketSockObject; - -/* --- C API ----------------------------------------------------*/ - -/* Short explanation of what this C API export mechanism does - and how it works: - - The _ssl module needs access to the type object defined in - the _socket module. Since cross-DLL linking introduces a lot of - problems on many platforms, the "trick" is to wrap the - C API of a module in a struct which then gets exported to - other modules via a PyCapsule. - - The code in socketmodule.c defines this struct (which currently - only contains the type object reference, but could very - well also include other C APIs needed by other modules) - and exports it as PyCapsule via the module dictionary - under the name "CAPI". - - Other modules can now include the socketmodule.h file - which defines the needed C APIs to import and set up - a static copy of this struct in the importing module. - - After initialization, the importing module can then - access the C APIs from the _socket module by simply - referring to the static struct, e.g. - - Load _socket module and its C API; this sets up the global - PySocketModule: - - if (PySocketModule_ImportModuleAndAPI()) - return; - - - Now use the C API as if it were defined in the using - module: - - if (!PyArg_ParseTuple(args, "O!|zz:ssl", - - PySocketModule.Sock_Type, - - (PyObject*)&Sock, - &key_file, &cert_file)) - return NULL; - - Support could easily be extended to export more C APIs/symbols - this way. Currently, only the type object is exported, - other candidates would be socket constructors and socket - access functions. - -*/ - -/* C API for usage by other Python modules */ -typedef struct { - PyTypeObject *Sock_Type; - PyObject *error; -} PySocketModule_APIObject; - -/* XXX The net effect of the following appears to be to define a function - XXX named PySocketModule_APIObject in _ssl.c. It's unclear why it isn't - XXX defined there directly. - - >>> It's defined here because other modules might also want to use - >>> the C API. - -*/ -#ifndef PySocket_BUILDING_SOCKET - -/* --- C API ----------------------------------------------------*/ - -/* Interfacestructure to C API for other modules. - Call PySocketModule_ImportModuleAndAPI() to initialize this - structure. After that usage is simple: - - if (!PyArg_ParseTuple(args, "O!|zz:ssl", - &PySocketModule.Sock_Type, (PyObject*)&Sock, - &key_file, &cert_file)) - return NULL; - ... -*/ - -static -PySocketModule_APIObject PySocketModule; - -/* You *must* call this before using any of the functions in - PySocketModule and check its outcome; otherwise all accesses will - result in a segfault. Returns 0 on success. */ - -#ifndef DPRINTF -# define DPRINTF if (0) printf -#endif - -static -int PySocketModule_ImportModuleAndAPI(void) -{ - void *api; - - DPRINTF(" Loading capsule %s\n", PySocket_CAPSULE_NAME); - api = PyCapsule_Import(PySocket_CAPSULE_NAME, 1); - if (api == NULL) - goto onError; - memcpy(&PySocketModule, api, sizeof(PySocketModule)); - DPRINTF(" API object loaded and initialized.\n"); - return 0; - - onError: - DPRINTF(" not found.\n"); - return -1; -} - -#endif /* !PySocket_BUILDING_SOCKET */ - -#ifdef __cplusplus -} -#endif -#endif /* !Py__SOCKET_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/sre.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/sre.h deleted file mode 100644 index fd66f47..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/sre.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Secret Labs' Regular Expression Engine - * - * regular expression matching engine - * - * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. - * - * See the _sre.c file for information on usage and redistribution. - */ - -#ifndef SRE_INCLUDED -#define SRE_INCLUDED - -#include "sre_constants.h" - -/* size of a code word (must be unsigned short or larger, and - large enough to hold a UCS4 character) */ -#ifdef Py_USING_UNICODE -# define SRE_CODE Py_UCS4 -# if SIZEOF_SIZE_T > 4 -# define SRE_MAXREPEAT (~(SRE_CODE)0) -# else -# define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX) -# endif -#else -# define SRE_CODE unsigned int -# if SIZEOF_SIZE_T > SIZEOF_INT -# define SRE_MAXREPEAT (~(SRE_CODE)0) -# else -# define SRE_MAXREPEAT ((SRE_CODE)PY_SSIZE_T_MAX) -# endif -#endif - -typedef struct { - PyObject_VAR_HEAD - Py_ssize_t groups; /* must be first! */ - PyObject* groupindex; - PyObject* indexgroup; - /* compatibility */ - PyObject* pattern; /* pattern source (or None) */ - int flags; /* flags used when compiling pattern source */ - PyObject *weakreflist; /* List of weak references */ - /* pattern code */ - Py_ssize_t codesize; - SRE_CODE code[1]; -} PatternObject; - -#define PatternObject_GetCode(o) (((PatternObject*)(o))->code) - -typedef struct { - PyObject_VAR_HEAD - PyObject* string; /* link to the target string (must be first) */ - PyObject* regs; /* cached list of matching spans */ - PatternObject* pattern; /* link to the regex (pattern) object */ - Py_ssize_t pos, endpos; /* current target slice */ - Py_ssize_t lastindex; /* last index marker seen by the engine (-1 if none) */ - Py_ssize_t groups; /* number of groups (start/end marks) */ - Py_ssize_t mark[1]; -} MatchObject; - -typedef unsigned int (*SRE_TOLOWER_HOOK)(unsigned int ch); - -/* FIXME: shouldn't be a constant, really... */ -#define SRE_MARK_SIZE 200 - -typedef struct SRE_REPEAT_T { - Py_ssize_t count; - SRE_CODE* pattern; /* points to REPEAT operator arguments */ - void* last_ptr; /* helper to check for infinite loops */ - struct SRE_REPEAT_T *prev; /* points to previous repeat context */ -} SRE_REPEAT; - -typedef struct { - /* string pointers */ - void* ptr; /* current position (also end of current slice) */ - void* beginning; /* start of original string */ - void* start; /* start of current slice */ - void* end; /* end of original string */ - /* attributes for the match object */ - PyObject* string; - Py_ssize_t pos, endpos; - /* character size */ - int charsize; - /* registers */ - Py_ssize_t lastindex; - Py_ssize_t lastmark; - void* mark[SRE_MARK_SIZE]; - /* dynamically allocated stuff */ - char* data_stack; - size_t data_stack_size; - size_t data_stack_base; - /* current repeat context */ - SRE_REPEAT *repeat; - /* hooks */ - SRE_TOLOWER_HOOK lower; -} SRE_STATE; - -typedef struct { - PyObject_HEAD - PyObject* pattern; - SRE_STATE state; -} ScannerObject; - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/sre_constants.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/sre_constants.h deleted file mode 100644 index c0e2f0d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/sre_constants.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Secret Labs' Regular Expression Engine - * - * regular expression matching engine - * - * NOTE: This file is generated by sre_constants.py. If you need - * to change anything in here, edit sre_constants.py and run it. - * - * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. - * - * See the _sre.c file for information on usage and redistribution. - */ - -#define SRE_MAGIC 20031017 -#define SRE_OP_FAILURE 0 -#define SRE_OP_SUCCESS 1 -#define SRE_OP_ANY 2 -#define SRE_OP_ANY_ALL 3 -#define SRE_OP_ASSERT 4 -#define SRE_OP_ASSERT_NOT 5 -#define SRE_OP_AT 6 -#define SRE_OP_BRANCH 7 -#define SRE_OP_CALL 8 -#define SRE_OP_CATEGORY 9 -#define SRE_OP_CHARSET 10 -#define SRE_OP_BIGCHARSET 11 -#define SRE_OP_GROUPREF 12 -#define SRE_OP_GROUPREF_EXISTS 13 -#define SRE_OP_GROUPREF_IGNORE 14 -#define SRE_OP_IN 15 -#define SRE_OP_IN_IGNORE 16 -#define SRE_OP_INFO 17 -#define SRE_OP_JUMP 18 -#define SRE_OP_LITERAL 19 -#define SRE_OP_LITERAL_IGNORE 20 -#define SRE_OP_MARK 21 -#define SRE_OP_MAX_UNTIL 22 -#define SRE_OP_MIN_UNTIL 23 -#define SRE_OP_NOT_LITERAL 24 -#define SRE_OP_NOT_LITERAL_IGNORE 25 -#define SRE_OP_NEGATE 26 -#define SRE_OP_RANGE 27 -#define SRE_OP_REPEAT 28 -#define SRE_OP_REPEAT_ONE 29 -#define SRE_OP_SUBPATTERN 30 -#define SRE_OP_MIN_REPEAT_ONE 31 -#define SRE_AT_BEGINNING 0 -#define SRE_AT_BEGINNING_LINE 1 -#define SRE_AT_BEGINNING_STRING 2 -#define SRE_AT_BOUNDARY 3 -#define SRE_AT_NON_BOUNDARY 4 -#define SRE_AT_END 5 -#define SRE_AT_END_LINE 6 -#define SRE_AT_END_STRING 7 -#define SRE_AT_LOC_BOUNDARY 8 -#define SRE_AT_LOC_NON_BOUNDARY 9 -#define SRE_AT_UNI_BOUNDARY 10 -#define SRE_AT_UNI_NON_BOUNDARY 11 -#define SRE_CATEGORY_DIGIT 0 -#define SRE_CATEGORY_NOT_DIGIT 1 -#define SRE_CATEGORY_SPACE 2 -#define SRE_CATEGORY_NOT_SPACE 3 -#define SRE_CATEGORY_WORD 4 -#define SRE_CATEGORY_NOT_WORD 5 -#define SRE_CATEGORY_LINEBREAK 6 -#define SRE_CATEGORY_NOT_LINEBREAK 7 -#define SRE_CATEGORY_LOC_WORD 8 -#define SRE_CATEGORY_LOC_NOT_WORD 9 -#define SRE_CATEGORY_UNI_DIGIT 10 -#define SRE_CATEGORY_UNI_NOT_DIGIT 11 -#define SRE_CATEGORY_UNI_SPACE 12 -#define SRE_CATEGORY_UNI_NOT_SPACE 13 -#define SRE_CATEGORY_UNI_WORD 14 -#define SRE_CATEGORY_UNI_NOT_WORD 15 -#define SRE_CATEGORY_UNI_LINEBREAK 16 -#define SRE_CATEGORY_UNI_NOT_LINEBREAK 17 -#define SRE_FLAG_TEMPLATE 1 -#define SRE_FLAG_IGNORECASE 2 -#define SRE_FLAG_LOCALE 4 -#define SRE_FLAG_MULTILINE 8 -#define SRE_FLAG_DOTALL 16 -#define SRE_FLAG_UNICODE 32 -#define SRE_FLAG_VERBOSE 64 -#define SRE_INFO_PREFIX 1 -#define SRE_INFO_LITERAL 2 -#define SRE_INFO_CHARSET 4 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/stropmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/stropmodule.c deleted file mode 100644 index cdc6cb8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/stropmodule.c +++ /dev/null @@ -1,1272 +0,0 @@ -/* strop module */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include - -PyDoc_STRVAR(strop_module__doc__, -"Common string manipulations, optimized for speed.\n" -"\n" -"Always use \"import string\" rather than referencing\n" -"this module directly."); - -/* XXX This file assumes that the is*() functions - XXX are defined for all 8-bit characters! */ - -#define WARN if (PyErr_Warn(PyExc_DeprecationWarning, \ - "strop functions are obsolete; use string methods")) \ - return NULL - -/* The lstrip(), rstrip() and strip() functions are implemented - in do_strip(), which uses an additional parameter to indicate what - type of strip should occur. */ - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - - -static PyObject * -split_whitespace(char *s, Py_ssize_t len, Py_ssize_t maxsplit) -{ - Py_ssize_t i = 0, j; - int err; - Py_ssize_t countsplit = 0; - PyObject* item; - PyObject *list = PyList_New(0); - - if (list == NULL) - return NULL; - - while (i < len) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i = i+1; - } - j = i; - while (i < len && !isspace(Py_CHARMASK(s[i]))) { - i = i+1; - } - if (j < i) { - item = PyString_FromStringAndSize(s+j, i-j); - if (item == NULL) - goto finally; - - err = PyList_Append(list, item); - Py_DECREF(item); - if (err < 0) - goto finally; - - countsplit++; - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i = i+1; - } - if (maxsplit && (countsplit >= maxsplit) && i < len) { - item = PyString_FromStringAndSize( - s+i, len - i); - if (item == NULL) - goto finally; - - err = PyList_Append(list, item); - Py_DECREF(item); - if (err < 0) - goto finally; - - i = len; - } - } - } - return list; - finally: - Py_DECREF(list); - return NULL; -} - - -PyDoc_STRVAR(splitfields__doc__, -"split(s [,sep [,maxsplit]]) -> list of strings\n" -"splitfields(s [,sep [,maxsplit]]) -> list of strings\n" -"\n" -"Return a list of the words in the string s, using sep as the\n" -"delimiter string. If maxsplit is nonzero, splits into at most\n" -"maxsplit words. If sep is not specified, any whitespace string\n" -"is a separator. Maxsplit defaults to 0.\n" -"\n" -"(split and splitfields are synonymous)"); - -static PyObject * -strop_splitfields(PyObject *self, PyObject *args) -{ - Py_ssize_t len, n, i, j, err; - Py_ssize_t splitcount, maxsplit; - char *s, *sub; - PyObject *list, *item; - - WARN; - sub = NULL; - n = 0; - splitcount = 0; - maxsplit = 0; - if (!PyArg_ParseTuple(args, "t#|z#n:split", &s, &len, &sub, &n, &maxsplit)) - return NULL; - if (sub == NULL) - return split_whitespace(s, len, maxsplit); - if (n == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - - list = PyList_New(0); - if (list == NULL) - return NULL; - - i = j = 0; - while (i+n <= len) { - if (s[i] == sub[0] && (n == 1 || memcmp(s+i, sub, n) == 0)) { - item = PyString_FromStringAndSize(s+j, i-j); - if (item == NULL) - goto fail; - err = PyList_Append(list, item); - Py_DECREF(item); - if (err < 0) - goto fail; - i = j = i + n; - splitcount++; - if (maxsplit && (splitcount >= maxsplit)) - break; - } - else - i++; - } - item = PyString_FromStringAndSize(s+j, len-j); - if (item == NULL) - goto fail; - err = PyList_Append(list, item); - Py_DECREF(item); - if (err < 0) - goto fail; - - return list; - - fail: - Py_DECREF(list); - return NULL; -} - - -PyDoc_STRVAR(joinfields__doc__, -"join(list [,sep]) -> string\n" -"joinfields(list [,sep]) -> string\n" -"\n" -"Return a string composed of the words in list, with\n" -"intervening occurrences of sep. Sep defaults to a single\n" -"space.\n" -"\n" -"(join and joinfields are synonymous)"); - -static PyObject * -strop_joinfields(PyObject *self, PyObject *args) -{ - PyObject *seq; - char *sep = NULL; - Py_ssize_t seqlen, seplen = 0; - Py_ssize_t i, reslen = 0, slen = 0, sz = 100; - PyObject *res = NULL; - char* p = NULL; - ssizeargfunc getitemfunc; - - WARN; - if (!PyArg_ParseTuple(args, "O|t#:join", &seq, &sep, &seplen)) - return NULL; - if (sep == NULL) { - sep = " "; - seplen = 1; - } - - seqlen = PySequence_Size(seq); - if (seqlen < 0 && PyErr_Occurred()) - return NULL; - - if (seqlen == 1) { - /* Optimization if there's only one item */ - PyObject *item = PySequence_GetItem(seq, 0); - if (item && !PyString_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "first argument must be sequence of strings"); - Py_DECREF(item); - return NULL; - } - return item; - } - - if (!(res = PyString_FromStringAndSize((char*)NULL, sz))) - return NULL; - p = PyString_AsString(res); - - /* optimize for lists, since it's the most common case. all others - * (tuples and arbitrary sequences) just use the sequence abstract - * interface. - */ - if (PyList_Check(seq)) { - for (i = 0; i < seqlen; i++) { - PyObject *item = PyList_GET_ITEM(seq, i); - if (!PyString_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "first argument must be sequence of strings"); - Py_DECREF(res); - return NULL; - } - slen = PyString_GET_SIZE(item); - if (slen > PY_SSIZE_T_MAX - reslen || - seplen > PY_SSIZE_T_MAX - reslen - seplen) { - PyErr_SetString(PyExc_OverflowError, - "input too long"); - Py_DECREF(res); - return NULL; - } - while (reslen + slen + seplen >= sz) { - if (_PyString_Resize(&res, sz * 2) < 0) - return NULL; - sz *= 2; - p = PyString_AsString(res) + reslen; - } - if (i > 0) { - memcpy(p, sep, seplen); - p += seplen; - reslen += seplen; - } - memcpy(p, PyString_AS_STRING(item), slen); - p += slen; - reslen += slen; - } - _PyString_Resize(&res, reslen); - return res; - } - - if (seq->ob_type->tp_as_sequence == NULL || - (getitemfunc = seq->ob_type->tp_as_sequence->sq_item) == NULL) - { - PyErr_SetString(PyExc_TypeError, - "first argument must be a sequence"); - return NULL; - } - /* This is now type safe */ - for (i = 0; i < seqlen; i++) { - PyObject *item = getitemfunc(seq, i); - if (!item || !PyString_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "first argument must be sequence of strings"); - Py_DECREF(res); - Py_XDECREF(item); - return NULL; - } - slen = PyString_GET_SIZE(item); - if (slen > PY_SSIZE_T_MAX - reslen || - seplen > PY_SSIZE_T_MAX - reslen - seplen) { - PyErr_SetString(PyExc_OverflowError, - "input too long"); - Py_DECREF(res); - Py_XDECREF(item); - return NULL; - } - while (reslen + slen + seplen >= sz) { - if (_PyString_Resize(&res, sz * 2) < 0) { - Py_DECREF(item); - return NULL; - } - sz *= 2; - p = PyString_AsString(res) + reslen; - } - if (i > 0) { - memcpy(p, sep, seplen); - p += seplen; - reslen += seplen; - } - memcpy(p, PyString_AS_STRING(item), slen); - p += slen; - reslen += slen; - Py_DECREF(item); - } - _PyString_Resize(&res, reslen); - return res; -} - - -PyDoc_STRVAR(find__doc__, -"find(s, sub [,start [,end]]) -> in\n" -"\n" -"Return the lowest index in s where substring sub is found,\n" -"such that sub is contained within s[start,end]. Optional\n" -"arguments start and end are interpreted as in slice notation.\n" -"\n" -"Return -1 on failure."); - -static PyObject * -strop_find(PyObject *self, PyObject *args) -{ - char *s, *sub; - Py_ssize_t len, n, i = 0, last = PY_SSIZE_T_MAX; - - WARN; - if (!PyArg_ParseTuple(args, "t#t#|nn:find", &s, &len, &sub, &n, &i, &last)) - return NULL; - - if (last > len) - last = len; - if (last < 0) - last += len; - if (last < 0) - last = 0; - if (i < 0) - i += len; - if (i < 0) - i = 0; - - if (n == 0 && i <= last) - return PyInt_FromLong((long)i); - - last -= n; - for (; i <= last; ++i) - if (s[i] == sub[0] && - (n == 1 || memcmp(&s[i+1], &sub[1], n-1) == 0)) - return PyInt_FromLong((long)i); - - return PyInt_FromLong(-1L); -} - - -PyDoc_STRVAR(rfind__doc__, -"rfind(s, sub [,start [,end]]) -> int\n" -"\n" -"Return the highest index in s where substring sub is found,\n" -"such that sub is contained within s[start,end]. Optional\n" -"arguments start and end are interpreted as in slice notation.\n" -"\n" -"Return -1 on failure."); - -static PyObject * -strop_rfind(PyObject *self, PyObject *args) -{ - char *s, *sub; - Py_ssize_t len, n, j; - Py_ssize_t i = 0, last = PY_SSIZE_T_MAX; - - WARN; - if (!PyArg_ParseTuple(args, "t#t#|nn:rfind", &s, &len, &sub, &n, &i, &last)) - return NULL; - - if (last > len) - last = len; - if (last < 0) - last += len; - if (last < 0) - last = 0; - if (i < 0) - i += len; - if (i < 0) - i = 0; - - if (n == 0 && i <= last) - return PyInt_FromLong((long)last); - - for (j = last-n; j >= i; --j) - if (s[j] == sub[0] && - (n == 1 || memcmp(&s[j+1], &sub[1], n-1) == 0)) - return PyInt_FromLong((long)j); - - return PyInt_FromLong(-1L); -} - - -static PyObject * -do_strip(PyObject *args, int striptype) -{ - char *s; - Py_ssize_t len, i, j; - - - if (PyString_AsStringAndSize(args, &s, &len)) - return NULL; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && isspace(Py_CHARMASK(s[j]))); - j++; - } - - if (i == 0 && j == len) { - Py_INCREF(args); - return args; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -PyDoc_STRVAR(strip__doc__, -"strip(s) -> string\n" -"\n" -"Return a copy of the string s with leading and trailing\n" -"whitespace removed."); - -static PyObject * -strop_strip(PyObject *self, PyObject *args) -{ - WARN; - return do_strip(args, BOTHSTRIP); -} - - -PyDoc_STRVAR(lstrip__doc__, -"lstrip(s) -> string\n" -"\n" -"Return a copy of the string s with leading whitespace removed."); - -static PyObject * -strop_lstrip(PyObject *self, PyObject *args) -{ - WARN; - return do_strip(args, LEFTSTRIP); -} - - -PyDoc_STRVAR(rstrip__doc__, -"rstrip(s) -> string\n" -"\n" -"Return a copy of the string s with trailing whitespace removed."); - -static PyObject * -strop_rstrip(PyObject *self, PyObject *args) -{ - WARN; - return do_strip(args, RIGHTSTRIP); -} - - -PyDoc_STRVAR(lower__doc__, -"lower(s) -> string\n" -"\n" -"Return a copy of the string s converted to lowercase."); - -static PyObject * -strop_lower(PyObject *self, PyObject *args) -{ - char *s, *s_new; - Py_ssize_t i, n; - PyObject *newstr; - int changed; - - WARN; - if (PyString_AsStringAndSize(args, &s, &n)) - return NULL; - newstr = PyString_FromStringAndSize(NULL, n); - if (newstr == NULL) - return NULL; - s_new = PyString_AsString(newstr); - changed = 0; - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) { - changed = 1; - *s_new = tolower(c); - } else - *s_new = c; - s_new++; - } - if (!changed) { - Py_DECREF(newstr); - Py_INCREF(args); - return args; - } - return newstr; -} - - -PyDoc_STRVAR(upper__doc__, -"upper(s) -> string\n" -"\n" -"Return a copy of the string s converted to uppercase."); - -static PyObject * -strop_upper(PyObject *self, PyObject *args) -{ - char *s, *s_new; - Py_ssize_t i, n; - PyObject *newstr; - int changed; - - WARN; - if (PyString_AsStringAndSize(args, &s, &n)) - return NULL; - newstr = PyString_FromStringAndSize(NULL, n); - if (newstr == NULL) - return NULL; - s_new = PyString_AsString(newstr); - changed = 0; - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - changed = 1; - *s_new = toupper(c); - } else - *s_new = c; - s_new++; - } - if (!changed) { - Py_DECREF(newstr); - Py_INCREF(args); - return args; - } - return newstr; -} - - -PyDoc_STRVAR(capitalize__doc__, -"capitalize(s) -> string\n" -"\n" -"Return a copy of the string s with only its first character\n" -"capitalized."); - -static PyObject * -strop_capitalize(PyObject *self, PyObject *args) -{ - char *s, *s_new; - Py_ssize_t i, n; - PyObject *newstr; - int changed; - - WARN; - if (PyString_AsStringAndSize(args, &s, &n)) - return NULL; - newstr = PyString_FromStringAndSize(NULL, n); - if (newstr == NULL) - return NULL; - s_new = PyString_AsString(newstr); - changed = 0; - if (0 < n) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - changed = 1; - *s_new = toupper(c); - } else - *s_new = c; - s_new++; - } - for (i = 1; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) { - changed = 1; - *s_new = tolower(c); - } else - *s_new = c; - s_new++; - } - if (!changed) { - Py_DECREF(newstr); - Py_INCREF(args); - return args; - } - return newstr; -} - - -PyDoc_STRVAR(expandtabs__doc__, -"expandtabs(string, [tabsize]) -> string\n" -"\n" -"Expand tabs in a string, i.e. replace them by one or more spaces,\n" -"depending on the current column and the given tab size (default 8).\n" -"The column number is reset to zero after each newline occurring in the\n" -"string. This doesn't understand other non-printing characters."); - -static PyObject * -strop_expandtabs(PyObject *self, PyObject *args) -{ - /* Original by Fredrik Lundh */ - char* e; - char* p; - char* q; - Py_ssize_t i, j; - PyObject* out; - char* string; - Py_ssize_t stringlen; - int tabsize = 8; - - WARN; - /* Get arguments */ - if (!PyArg_ParseTuple(args, "s#|i:expandtabs", &string, &stringlen, &tabsize)) - return NULL; - if (tabsize < 1) { - PyErr_SetString(PyExc_ValueError, - "tabsize must be at least 1"); - return NULL; - } - - /* First pass: determine size of output string */ - i = j = 0; /* j: current column; i: total of previous lines */ - e = string + stringlen; - for (p = string; p < e; p++) { - if (*p == '\t') { - Py_ssize_t incr = tabsize - (j%tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow; - j += incr; - } else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow; - j++; - if (*p == '\n') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow; - i += j; - j = 0; - } - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow; - - /* Second pass: create output string and fill it */ - out = PyString_FromStringAndSize(NULL, i+j); - if (out == NULL) - return NULL; - - i = 0; - q = PyString_AS_STRING(out); - - for (p = string; p < e; p++) { - if (*p == '\t') { - j = tabsize - (i%tabsize); - i += j; - while (j-- > 0) - *q++ = ' '; - } else { - *q++ = *p; - i++; - if (*p == '\n') - i = 0; - } - } - - return out; - overflow: - PyErr_SetString(PyExc_OverflowError, "result is too long"); - return NULL; -} - - -PyDoc_STRVAR(count__doc__, -"count(s, sub[, start[, end]]) -> int\n" -"\n" -"Return the number of occurrences of substring sub in string\n" -"s[start:end]. Optional arguments start and end are\n" -"interpreted as in slice notation."); - -static PyObject * -strop_count(PyObject *self, PyObject *args) -{ - char *s, *sub; - Py_ssize_t len, n; - Py_ssize_t i = 0, last = PY_SSIZE_T_MAX; - Py_ssize_t m, r; - - WARN; - if (!PyArg_ParseTuple(args, "t#t#|nn:count", &s, &len, &sub, &n, &i, &last)) - return NULL; - if (last > len) - last = len; - if (last < 0) - last += len; - if (last < 0) - last = 0; - if (i < 0) - i += len; - if (i < 0) - i = 0; - m = last + 1 - n; - if (n == 0) - return PyInt_FromLong((long) (m-i)); - - r = 0; - while (i < m) { - if (!memcmp(s+i, sub, n)) { - r++; - i += n; - } else { - i++; - } - } - return PyInt_FromLong((long) r); -} - - -PyDoc_STRVAR(swapcase__doc__, -"swapcase(s) -> string\n" -"\n" -"Return a copy of the string s with upper case characters\n" -"converted to lowercase and vice versa."); - -static PyObject * -strop_swapcase(PyObject *self, PyObject *args) -{ - char *s, *s_new; - Py_ssize_t i, n; - PyObject *newstr; - int changed; - - WARN; - if (PyString_AsStringAndSize(args, &s, &n)) - return NULL; - newstr = PyString_FromStringAndSize(NULL, n); - if (newstr == NULL) - return NULL; - s_new = PyString_AsString(newstr); - changed = 0; - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - changed = 1; - *s_new = toupper(c); - } - else if (isupper(c)) { - changed = 1; - *s_new = tolower(c); - } - else - *s_new = c; - s_new++; - } - if (!changed) { - Py_DECREF(newstr); - Py_INCREF(args); - return args; - } - return newstr; -} - - -PyDoc_STRVAR(atoi__doc__, -"atoi(s [,base]) -> int\n" -"\n" -"Return the integer represented by the string s in the given\n" -"base, which defaults to 10. The string s must consist of one\n" -"or more digits, possibly preceded by a sign. If base is 0, it\n" -"is chosen from the leading characters of s, 0 for octal, 0x or\n" -"0X for hexadecimal. If base is 16, a preceding 0x or 0X is\n" -"accepted."); - -static PyObject * -strop_atoi(PyObject *self, PyObject *args) -{ - char *s, *end; - int base = 10; - long x; - char buffer[256]; /* For errors */ - - WARN; - if (!PyArg_ParseTuple(args, "s|i:atoi", &s, &base)) - return NULL; - - if ((base != 0 && base < 2) || base > 36) { - PyErr_SetString(PyExc_ValueError, "invalid base for atoi()"); - return NULL; - } - - while (*s && isspace(Py_CHARMASK(*s))) - s++; - errno = 0; - if (base == 0 && s[0] == '0') - x = (long) PyOS_strtoul(s, &end, base); - else - x = PyOS_strtol(s, &end, base); - if (end == s || !isalnum(Py_CHARMASK(end[-1]))) - goto bad; - while (*end && isspace(Py_CHARMASK(*end))) - end++; - if (*end != '\0') { - bad: - PyOS_snprintf(buffer, sizeof(buffer), - "invalid literal for atoi(): %.200s", s); - PyErr_SetString(PyExc_ValueError, buffer); - return NULL; - } - else if (errno != 0) { - PyOS_snprintf(buffer, sizeof(buffer), - "atoi() literal too large: %.200s", s); - PyErr_SetString(PyExc_ValueError, buffer); - return NULL; - } - return PyInt_FromLong(x); -} - - -PyDoc_STRVAR(atol__doc__, -"atol(s [,base]) -> long\n" -"\n" -"Return the long integer represented by the string s in the\n" -"given base, which defaults to 10. The string s must consist\n" -"of one or more digits, possibly preceded by a sign. If base\n" -"is 0, it is chosen from the leading characters of s, 0 for\n" -"octal, 0x or 0X for hexadecimal. If base is 16, a preceding\n" -"0x or 0X is accepted. A trailing L or l is not accepted,\n" -"unless base is 0."); - -static PyObject * -strop_atol(PyObject *self, PyObject *args) -{ - char *s, *end; - int base = 10; - PyObject *x; - char buffer[256]; /* For errors */ - - WARN; - if (!PyArg_ParseTuple(args, "s|i:atol", &s, &base)) - return NULL; - - if ((base != 0 && base < 2) || base > 36) { - PyErr_SetString(PyExc_ValueError, "invalid base for atol()"); - return NULL; - } - - while (*s && isspace(Py_CHARMASK(*s))) - s++; - if (s[0] == '\0') { - PyErr_SetString(PyExc_ValueError, "empty string for atol()"); - return NULL; - } - x = PyLong_FromString(s, &end, base); - if (x == NULL) - return NULL; - if (base == 0 && (*end == 'l' || *end == 'L')) - end++; - while (*end && isspace(Py_CHARMASK(*end))) - end++; - if (*end != '\0') { - PyOS_snprintf(buffer, sizeof(buffer), - "invalid literal for atol(): %.200s", s); - PyErr_SetString(PyExc_ValueError, buffer); - Py_DECREF(x); - return NULL; - } - return x; -} - - -PyDoc_STRVAR(atof__doc__, -"atof(s) -> float\n" -"\n" -"Return the floating point number represented by the string s."); - -static PyObject * -strop_atof(PyObject *self, PyObject *args) -{ - char *s, *end; - double x; - char buffer[256]; /* For errors */ - - WARN; - if (!PyArg_ParseTuple(args, "s:atof", &s)) - return NULL; - while (*s && isspace(Py_CHARMASK(*s))) - s++; - if (s[0] == '\0') { - PyErr_SetString(PyExc_ValueError, "empty string for atof()"); - return NULL; - } - - PyFPE_START_PROTECT("strop_atof", return 0) - x = PyOS_string_to_double(s, &end, PyExc_OverflowError); - PyFPE_END_PROTECT(x) - if (x == -1 && PyErr_Occurred()) - return NULL; - while (*end && isspace(Py_CHARMASK(*end))) - end++; - if (*end != '\0') { - PyOS_snprintf(buffer, sizeof(buffer), - "invalid literal for atof(): %.200s", s); - PyErr_SetString(PyExc_ValueError, buffer); - return NULL; - } - return PyFloat_FromDouble(x); -} - - -PyDoc_STRVAR(maketrans__doc__, -"maketrans(frm, to) -> string\n" -"\n" -"Return a translation table (a string of 256 bytes long)\n" -"suitable for use in string.translate. The strings frm and to\n" -"must be of the same length."); - -static PyObject * -strop_maketrans(PyObject *self, PyObject *args) -{ - unsigned char *c, *from=NULL, *to=NULL; - Py_ssize_t i, fromlen=0, tolen=0; - PyObject *result; - - if (!PyArg_ParseTuple(args, "t#t#:maketrans", &from, &fromlen, &to, &tolen)) - return NULL; - - if (fromlen != tolen) { - PyErr_SetString(PyExc_ValueError, - "maketrans arguments must have same length"); - return NULL; - } - - result = PyString_FromStringAndSize((char *)NULL, 256); - if (result == NULL) - return NULL; - c = (unsigned char *) PyString_AS_STRING((PyStringObject *)result); - for (i = 0; i < 256; i++) - c[i]=(unsigned char)i; - for (i = 0; i < fromlen; i++) - c[from[i]]=to[i]; - - return result; -} - - -PyDoc_STRVAR(translate__doc__, -"translate(s,table [,deletechars]) -> string\n" -"\n" -"Return a copy of the string s, where all characters occurring\n" -"in the optional argument deletechars are removed, and the\n" -"remaining characters have been mapped through the given\n" -"translation table, which must be a string of length 256."); - -static PyObject * -strop_translate(PyObject *self, PyObject *args) -{ - register char *input, *table, *output; - Py_ssize_t i; - int c, changed = 0; - PyObject *input_obj; - char *table1, *output_start, *del_table=NULL; - Py_ssize_t inlen, tablen, dellen = 0; - PyObject *result; - int trans_table[256]; - - WARN; - if (!PyArg_ParseTuple(args, "St#|t#:translate", &input_obj, - &table1, &tablen, &del_table, &dellen)) - return NULL; - if (tablen != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - return NULL; - } - - table = table1; - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AsString(input_obj); - - if (dellen == 0) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (Py_CHARMASK((*output++ = table[c])) != c) - changed = 1; - } - if (changed) - return result; - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - - for (i = 0; i < dellen; i++) - trans_table[(int) Py_CHARMASK(del_table[i])] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - changed = 1; - } - if (!changed) { - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - /* Fix the size of the resulting string */ - if (inlen > 0) - _PyString_Resize(&result, output - output_start); - return result; -} - - -/* What follows is used for implementing replace(). Perry Stoll. */ - -/* - mymemfind - - strstr replacement for arbitrary blocks of memory. - - Locates the first occurrence in the memory pointed to by MEM of the - contents of memory pointed to by PAT. Returns the index into MEM if - found, or -1 if not found. If len of PAT is greater than length of - MEM, the function returns -1. -*/ -static Py_ssize_t -mymemfind(const char *mem, Py_ssize_t len, const char *pat, Py_ssize_t pat_len) -{ - register Py_ssize_t ii; - - /* pattern can not occur in the last pat_len-1 chars */ - len -= pat_len; - - for (ii = 0; ii <= len; ii++) { - if (mem[ii] == pat[0] && - (pat_len == 1 || - memcmp(&mem[ii+1], &pat[1], pat_len-1) == 0)) { - return ii; - } - } - return -1; -} - -/* - mymemcnt - - Return the number of distinct times PAT is found in MEM. - meaning mem=1111 and pat==11 returns 2. - mem=11111 and pat==11 also return 2. - */ -static Py_ssize_t -mymemcnt(const char *mem, Py_ssize_t len, const char *pat, Py_ssize_t pat_len) -{ - register Py_ssize_t offset = 0; - Py_ssize_t nfound = 0; - - while (len >= 0) { - offset = mymemfind(mem, len, pat, pat_len); - if (offset == -1) - break; - mem += offset + pat_len; - len -= offset + pat_len; - nfound++; - } - return nfound; -} - -/* - mymemreplace - - Return a string in which all occurrences of PAT in memory STR are - replaced with SUB. - - If length of PAT is less than length of STR or there are no occurrences - of PAT in STR, then the original string is returned. Otherwise, a new - string is allocated here and returned. - - on return, out_len is: - the length of output string, or - -1 if the input string is returned, or - unchanged if an error occurs (no memory). - - return value is: - the new string allocated locally, or - NULL if an error occurred. -*/ -static char * -mymemreplace(const char *str, Py_ssize_t len, /* input string */ - const char *pat, Py_ssize_t pat_len, /* pattern string to find */ - const char *sub, Py_ssize_t sub_len, /* substitution string */ - Py_ssize_t count, /* number of replacements */ - Py_ssize_t *out_len) -{ - char *out_s; - char *new_s; - Py_ssize_t nfound, offset, new_len; - - if (len == 0 || pat_len > len) - goto return_same; - - /* find length of output string */ - nfound = mymemcnt(str, len, pat, pat_len); - if (count < 0) - count = PY_SSIZE_T_MAX; - else if (nfound > count) - nfound = count; - if (nfound == 0) - goto return_same; - - new_len = len + nfound*(sub_len - pat_len); - if (new_len == 0) { - /* Have to allocate something for the caller to free(). */ - out_s = (char *)PyMem_MALLOC(1); - if (out_s == NULL) - return NULL; - out_s[0] = '\0'; - } - else { - assert(new_len > 0); - new_s = (char *)PyMem_MALLOC(new_len); - if (new_s == NULL) - return NULL; - out_s = new_s; - - for (; count > 0 && len > 0; --count) { - /* find index of next instance of pattern */ - offset = mymemfind(str, len, pat, pat_len); - if (offset == -1) - break; - - /* copy non matching part of input string */ - memcpy(new_s, str, offset); - str += offset + pat_len; - len -= offset + pat_len; - - /* copy substitute into the output string */ - new_s += offset; - memcpy(new_s, sub, sub_len); - new_s += sub_len; - } - /* copy any remaining values into output string */ - if (len > 0) - memcpy(new_s, str, len); - } - *out_len = new_len; - return out_s; - - return_same: - *out_len = -1; - return (char *)str; /* cast away const */ -} - - -PyDoc_STRVAR(replace__doc__, -"replace (str, old, new[, maxsplit]) -> string\n" -"\n" -"Return a copy of string str with all occurrences of substring\n" -"old replaced by new. If the optional argument maxsplit is\n" -"given, only the first maxsplit occurrences are replaced."); - -static PyObject * -strop_replace(PyObject *self, PyObject *args) -{ - char *str, *pat,*sub,*new_s; - Py_ssize_t len,pat_len,sub_len,out_len; - Py_ssize_t count = -1; - PyObject *newstr; - - WARN; - if (!PyArg_ParseTuple(args, "t#t#t#|n:replace", - &str, &len, &pat, &pat_len, &sub, &sub_len, - &count)) - return NULL; - if (pat_len <= 0) { - PyErr_SetString(PyExc_ValueError, "empty pattern string"); - return NULL; - } - /* CAUTION: strop treats a replace count of 0 as infinity, unlke - * current (2.1) string.py and string methods. Preserve this for - * ... well, hard to say for what . - */ - if (count == 0) - count = -1; - new_s = mymemreplace(str,len,pat,pat_len,sub,sub_len,count,&out_len); - if (new_s == NULL) { - PyErr_NoMemory(); - return NULL; - } - if (out_len == -1) { - /* we're returning another reference to the input string */ - newstr = PyTuple_GetItem(args, 0); - Py_XINCREF(newstr); - } - else { - newstr = PyString_FromStringAndSize(new_s, out_len); - PyMem_FREE(new_s); - } - return newstr; -} - - -/* List of functions defined in the module */ - -static PyMethodDef -strop_methods[] = { - {"atof", strop_atof, METH_VARARGS, atof__doc__}, - {"atoi", strop_atoi, METH_VARARGS, atoi__doc__}, - {"atol", strop_atol, METH_VARARGS, atol__doc__}, - {"capitalize", strop_capitalize, METH_O, capitalize__doc__}, - {"count", strop_count, METH_VARARGS, count__doc__}, - {"expandtabs", strop_expandtabs, METH_VARARGS, expandtabs__doc__}, - {"find", strop_find, METH_VARARGS, find__doc__}, - {"join", strop_joinfields, METH_VARARGS, joinfields__doc__}, - {"joinfields", strop_joinfields, METH_VARARGS, joinfields__doc__}, - {"lstrip", strop_lstrip, METH_O, lstrip__doc__}, - {"lower", strop_lower, METH_O, lower__doc__}, - {"maketrans", strop_maketrans, METH_VARARGS, maketrans__doc__}, - {"replace", strop_replace, METH_VARARGS, replace__doc__}, - {"rfind", strop_rfind, METH_VARARGS, rfind__doc__}, - {"rstrip", strop_rstrip, METH_O, rstrip__doc__}, - {"split", strop_splitfields, METH_VARARGS, splitfields__doc__}, - {"splitfields", strop_splitfields, METH_VARARGS, splitfields__doc__}, - {"strip", strop_strip, METH_O, strip__doc__}, - {"swapcase", strop_swapcase, METH_O, swapcase__doc__}, - {"translate", strop_translate, METH_VARARGS, translate__doc__}, - {"upper", strop_upper, METH_O, upper__doc__}, - {NULL, NULL} /* sentinel */ -}; - - -PyMODINIT_FUNC -initstrop(void) -{ - PyObject *m, *s; - char buf[256]; - int c, n; - m = Py_InitModule4("strop", strop_methods, strop_module__doc__, - (PyObject*)NULL, PYTHON_API_VERSION); - if (m == NULL) - return; - - /* Create 'whitespace' object */ - n = 0; - for (c = 0; c < 256; c++) { - if (isspace(c)) - buf[n++] = c; - } - s = PyString_FromStringAndSize(buf, n); - if (s) - PyModule_AddObject(m, "whitespace", s); - - /* Create 'lowercase' object */ - n = 0; - for (c = 0; c < 256; c++) { - if (islower(c)) - buf[n++] = c; - } - s = PyString_FromStringAndSize(buf, n); - if (s) - PyModule_AddObject(m, "lowercase", s); - - /* Create 'uppercase' object */ - n = 0; - for (c = 0; c < 256; c++) { - if (isupper(c)) - buf[n++] = c; - } - s = PyString_FromStringAndSize(buf, n); - if (s) - PyModule_AddObject(m, "uppercase", s); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/symtablemodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/symtablemodule.c deleted file mode 100644 index a4f60a1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/symtablemodule.c +++ /dev/null @@ -1,86 +0,0 @@ -#include "Python.h" - -#include "code.h" -#include "compile.h" -#include "Python-ast.h" -#include "symtable.h" - -static PyObject * -symtable_symtable(PyObject *self, PyObject *args) -{ - struct symtable *st; - PyObject *t; - - char *str; - char *filename; - char *startstr; - int start; - - if (!PyArg_ParseTuple(args, "sss:symtable", &str, &filename, - &startstr)) - return NULL; - if (strcmp(startstr, "exec") == 0) - start = Py_file_input; - else if (strcmp(startstr, "eval") == 0) - start = Py_eval_input; - else if (strcmp(startstr, "single") == 0) - start = Py_single_input; - else { - PyErr_SetString(PyExc_ValueError, - "symtable() arg 3 must be 'exec' or 'eval' or 'single'"); - return NULL; - } - st = Py_SymtableString(str, filename, start); - if (st == NULL) - return NULL; - t = (PyObject *)st->st_top; - Py_INCREF(t); - PyMem_Free((void *)st->st_future); - PySymtable_Free(st); - return t; -} - -static PyMethodDef symtable_methods[] = { - {"symtable", symtable_symtable, METH_VARARGS, - PyDoc_STR("Return symbol and scope dictionaries" - " used internally by compiler.")}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -init_symtable(void) -{ - PyObject *m; - - if (PyType_Ready(&PySTEntry_Type) < 0) - return; - - m = Py_InitModule("_symtable", symtable_methods); - if (m == NULL) - return; - PyModule_AddIntConstant(m, "USE", USE); - PyModule_AddIntConstant(m, "DEF_GLOBAL", DEF_GLOBAL); - PyModule_AddIntConstant(m, "DEF_LOCAL", DEF_LOCAL); - PyModule_AddIntConstant(m, "DEF_PARAM", DEF_PARAM); - PyModule_AddIntConstant(m, "DEF_FREE", DEF_FREE); - PyModule_AddIntConstant(m, "DEF_FREE_CLASS", DEF_FREE_CLASS); - PyModule_AddIntConstant(m, "DEF_IMPORT", DEF_IMPORT); - PyModule_AddIntConstant(m, "DEF_BOUND", DEF_BOUND); - - PyModule_AddIntConstant(m, "TYPE_FUNCTION", FunctionBlock); - PyModule_AddIntConstant(m, "TYPE_CLASS", ClassBlock); - PyModule_AddIntConstant(m, "TYPE_MODULE", ModuleBlock); - - PyModule_AddIntConstant(m, "OPT_IMPORT_STAR", OPT_IMPORT_STAR); - PyModule_AddIntConstant(m, "OPT_EXEC", OPT_EXEC); - PyModule_AddIntConstant(m, "OPT_BARE_EXEC", OPT_BARE_EXEC); - - PyModule_AddIntConstant(m, "LOCAL", LOCAL); - PyModule_AddIntConstant(m, "GLOBAL_EXPLICIT", GLOBAL_EXPLICIT); - PyModule_AddIntConstant(m, "GLOBAL_IMPLICIT", GLOBAL_IMPLICIT); - PyModule_AddIntConstant(m, "FREE", FREE); - PyModule_AddIntConstant(m, "CELL", CELL); - - PyModule_AddIntConstant(m, "SCOPE_OFF", SCOPE_OFF); - PyModule_AddIntConstant(m, "SCOPE_MASK", SCOPE_MASK); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/timemodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/timemodule.c deleted file mode 100644 index a4e64c2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/timemodule.c +++ /dev/null @@ -1,1064 +0,0 @@ - -/* Time module */ - -#include "Python.h" -#include "structseq.h" -#include "timefuncs.h" - -#ifdef __APPLE__ -#if defined(HAVE_GETTIMEOFDAY) && defined(HAVE_FTIME) - /* - * floattime falls back to ftime when getttimeofday fails because the latter - * might fail on some platforms. This fallback is unwanted on MacOSX because - * that makes it impossible to use a binary build on OSX 10.4 on earlier - * releases of the OS. Therefore claim we don't support ftime. - */ -# undef HAVE_FTIME -#endif -#endif - -#include - -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef QUICKWIN -#include -#endif - -#ifdef HAVE_FTIME -#include -#if !defined(MS_WINDOWS) && !defined(PYOS_OS2) -extern int ftime(struct timeb *); -#endif /* MS_WINDOWS */ -#endif /* HAVE_FTIME */ - -#if defined(__WATCOMC__) && !defined(__QNX__) -#include -#else -#ifdef MS_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include -#include "pythread.h" - -/* helper to allow us to interrupt sleep() on Windows*/ -static HANDLE hInterruptEvent = NULL; -static BOOL WINAPI PyCtrlHandler(DWORD dwCtrlType) -{ - SetEvent(hInterruptEvent); - /* allow other default handlers to be called. - Default Python handler will setup the - KeyboardInterrupt exception. - */ - return FALSE; -} -static long main_thread; - - -#if defined(__BORLANDC__) -/* These overrides not needed for Win32 */ -#define timezone _timezone -#define tzname _tzname -#define daylight _daylight -#endif /* __BORLANDC__ */ -#endif /* MS_WINDOWS */ -#endif /* !__WATCOMC__ || __QNX__ */ - -#if defined(MS_WINDOWS) && !defined(__BORLANDC__) -/* Win32 has better clock replacement; we have our own version below. */ -#undef HAVE_CLOCK -#endif /* MS_WINDOWS && !defined(__BORLANDC__) */ - -#if defined(PYOS_OS2) -#define INCL_DOS -#define INCL_ERRORS -#include -#endif - -#if defined(PYCC_VACPP) -#include -#endif - -#ifdef __BEOS__ -#include -/* For bigtime_t, snooze(). - [cjh] */ -#include -#include -#endif - -#ifdef RISCOS -extern int riscos_sleep(double); -#endif - -/* Forward declarations */ -static int floatsleep(double); -static double floattime(void); - -/* For Y2K check */ -static PyObject *moddict = NULL; - -/* Exposed in timefuncs.h. */ -time_t -_PyTime_DoubleToTimet(double x) -{ - time_t result; - double diff; - - result = (time_t)x; - /* How much info did we lose? time_t may be an integral or - * floating type, and we don't know which. If it's integral, - * we don't know whether C truncates, rounds, returns the floor, - * etc. If we lost a second or more, the C rounding is - * unreasonable, or the input just doesn't fit in a time_t; - * call it an error regardless. Note that the original cast to - * time_t can cause a C error too, but nothing we can do to - * worm around that. - */ - diff = x - (double)result; - if (diff <= -1.0 || diff >= 1.0) { - PyErr_SetString(PyExc_ValueError, - "timestamp out of range for platform time_t"); - result = (time_t)-1; - } - return result; -} - -static PyObject * -time_time(PyObject *self, PyObject *unused) -{ - double secs; - secs = floattime(); - if (secs == 0.0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - return PyFloat_FromDouble(secs); -} - -PyDoc_STRVAR(time_doc, -"time() -> floating point number\n\ -\n\ -Return the current time in seconds since the Epoch.\n\ -Fractions of a second may be present if the system clock provides them."); - -#ifdef HAVE_CLOCK - -#ifndef CLOCKS_PER_SEC -#ifdef CLK_TCK -#define CLOCKS_PER_SEC CLK_TCK -#else -#define CLOCKS_PER_SEC 1000000 -#endif -#endif - -static PyObject * -time_clock(PyObject *self, PyObject *unused) -{ - return PyFloat_FromDouble(((double)clock()) / CLOCKS_PER_SEC); -} -#endif /* HAVE_CLOCK */ - -#if defined(MS_WINDOWS) && !defined(__BORLANDC__) -/* Due to Mark Hammond and Tim Peters */ -static PyObject * -time_clock(PyObject *self, PyObject *unused) -{ - static LARGE_INTEGER ctrStart; - static double divisor = 0.0; - LARGE_INTEGER now; - double diff; - - if (divisor == 0.0) { - LARGE_INTEGER freq; - QueryPerformanceCounter(&ctrStart); - if (!QueryPerformanceFrequency(&freq) || freq.QuadPart == 0) { - /* Unlikely to happen - this works on all intel - machines at least! Revert to clock() */ - return PyFloat_FromDouble(((double)clock()) / - CLOCKS_PER_SEC); - } - divisor = (double)freq.QuadPart; - } - QueryPerformanceCounter(&now); - diff = (double)(now.QuadPart - ctrStart.QuadPart); - return PyFloat_FromDouble(diff / divisor); -} - -#define HAVE_CLOCK /* So it gets included in the methods */ -#endif /* MS_WINDOWS && !defined(__BORLANDC__) */ - -#ifdef HAVE_CLOCK -PyDoc_STRVAR(clock_doc, -"clock() -> floating point number\n\ -\n\ -Return the CPU time or real time since the start of the process or since\n\ -the first call to clock(). This has as much precision as the system\n\ -records."); -#endif - -static PyObject * -time_sleep(PyObject *self, PyObject *args) -{ - double secs; - if (!PyArg_ParseTuple(args, "d:sleep", &secs)) - return NULL; - if (floatsleep(secs) != 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(sleep_doc, -"sleep(seconds)\n\ -\n\ -Delay execution for a given number of seconds. The argument may be\n\ -a floating point number for subsecond precision."); - -static PyStructSequence_Field struct_time_type_fields[] = { - {"tm_year", "year, for example, 1993"}, - {"tm_mon", "month of year, range [1, 12]"}, - {"tm_mday", "day of month, range [1, 31]"}, - {"tm_hour", "hours, range [0, 23]"}, - {"tm_min", "minutes, range [0, 59]"}, - {"tm_sec", "seconds, range [0, 61])"}, - {"tm_wday", "day of week, range [0, 6], Monday is 0"}, - {"tm_yday", "day of year, range [1, 366]"}, - {"tm_isdst", "1 if summer time is in effect, 0 if not, and -1 if unknown"}, - {0} -}; - -static PyStructSequence_Desc struct_time_type_desc = { - "time.struct_time", - "The time value as returned by gmtime(), localtime(), and strptime(), and\n" - " accepted by asctime(), mktime() and strftime(). May be considered as a\n" - " sequence of 9 integers.\n\n" - " Note that several fields' values are not the same as those defined by\n" - " the C language standard for struct tm. For example, the value of the\n" - " field tm_year is the actual year, not year - 1900. See individual\n" - " fields' descriptions for details.", - struct_time_type_fields, - 9, -}; - -static int initialized; -static PyTypeObject StructTimeType; - -static PyObject * -tmtotuple(struct tm *p) -{ - PyObject *v = PyStructSequence_New(&StructTimeType); - if (v == NULL) - return NULL; - -#define SET(i,val) PyStructSequence_SET_ITEM(v, i, PyInt_FromLong((long) val)) - - SET(0, p->tm_year + 1900); - SET(1, p->tm_mon + 1); /* Want January == 1 */ - SET(2, p->tm_mday); - SET(3, p->tm_hour); - SET(4, p->tm_min); - SET(5, p->tm_sec); - SET(6, (p->tm_wday + 6) % 7); /* Want Monday == 0 */ - SET(7, p->tm_yday + 1); /* Want January, 1 == 1 */ - SET(8, p->tm_isdst); -#undef SET - if (PyErr_Occurred()) { - Py_XDECREF(v); - return NULL; - } - - return v; -} - -static PyObject * -time_convert(double when, struct tm * (*function)(const time_t *)) -{ - struct tm *p; - time_t whent = _PyTime_DoubleToTimet(when); - - if (whent == (time_t)-1 && PyErr_Occurred()) - return NULL; - errno = 0; - p = function(&whent); - if (p == NULL) { -#ifdef EINVAL - if (errno == 0) - errno = EINVAL; -#endif - return PyErr_SetFromErrno(PyExc_ValueError); - } - return tmtotuple(p); -} - -/* Parse arg tuple that can contain an optional float-or-None value; - format needs to be "|O:name". - Returns non-zero on success (parallels PyArg_ParseTuple). -*/ -static int -parse_time_double_args(PyObject *args, char *format, double *pwhen) -{ - PyObject *ot = NULL; - - if (!PyArg_ParseTuple(args, format, &ot)) - return 0; - if (ot == NULL || ot == Py_None) - *pwhen = floattime(); - else { - double when = PyFloat_AsDouble(ot); - if (PyErr_Occurred()) - return 0; - *pwhen = when; - } - return 1; -} - -static PyObject * -time_gmtime(PyObject *self, PyObject *args) -{ - double when; - if (!parse_time_double_args(args, "|O:gmtime", &when)) - return NULL; - return time_convert(when, gmtime); -} - -PyDoc_STRVAR(gmtime_doc, -"gmtime([seconds]) -> (tm_year, tm_mon, tm_mday, tm_hour, tm_min,\n\ - tm_sec, tm_wday, tm_yday, tm_isdst)\n\ -\n\ -Convert seconds since the Epoch to a time tuple expressing UTC (a.k.a.\n\ -GMT). When 'seconds' is not passed in, convert the current time instead."); - -static PyObject * -time_localtime(PyObject *self, PyObject *args) -{ - double when; - if (!parse_time_double_args(args, "|O:localtime", &when)) - return NULL; - return time_convert(when, localtime); -} - -PyDoc_STRVAR(localtime_doc, -"localtime([seconds]) -> (tm_year,tm_mon,tm_mday,tm_hour,tm_min,\n\ - tm_sec,tm_wday,tm_yday,tm_isdst)\n\ -\n\ -Convert seconds since the Epoch to a time tuple expressing local time.\n\ -When 'seconds' is not passed in, convert the current time instead."); - -static int -gettmarg(PyObject *args, struct tm *p) -{ - int y; - memset((void *) p, '\0', sizeof(struct tm)); - - if (!PyArg_Parse(args, "(iiiiiiiii)", - &y, - &p->tm_mon, - &p->tm_mday, - &p->tm_hour, - &p->tm_min, - &p->tm_sec, - &p->tm_wday, - &p->tm_yday, - &p->tm_isdst)) - return 0; - if (y < 1900) { - PyObject *accept = PyDict_GetItemString(moddict, - "accept2dyear"); - if (accept == NULL || !PyInt_Check(accept) || - PyInt_AsLong(accept) == 0) { - PyErr_SetString(PyExc_ValueError, - "year >= 1900 required"); - return 0; - } - if (69 <= y && y <= 99) - y += 1900; - else if (0 <= y && y <= 68) - y += 2000; - else { - PyErr_SetString(PyExc_ValueError, - "year out of range"); - return 0; - } - } - p->tm_year = y - 1900; - p->tm_mon--; - p->tm_wday = (p->tm_wday + 1) % 7; - p->tm_yday--; - return 1; -} - -#ifdef HAVE_STRFTIME -static PyObject * -time_strftime(PyObject *self, PyObject *args) -{ - PyObject *tup = NULL; - struct tm buf; - const char *fmt; - size_t fmtlen, buflen; - char *outbuf = 0; - size_t i; - - memset((void *) &buf, '\0', sizeof(buf)); - - if (!PyArg_ParseTuple(args, "s|O:strftime", &fmt, &tup)) - return NULL; - - if (tup == NULL) { - time_t tt = time(NULL); - buf = *localtime(&tt); - } else if (!gettmarg(tup, &buf)) - return NULL; - - /* Checks added to make sure strftime() does not crash Python by - indexing blindly into some array for a textual representation - by some bad index (fixes bug #897625). - - Also support values of zero from Python code for arguments in which - that is out of range by forcing that value to the lowest value that - is valid (fixed bug #1520914). - - Valid ranges based on what is allowed in struct tm: - - - tm_year: [0, max(int)] (1) - - tm_mon: [0, 11] (2) - - tm_mday: [1, 31] - - tm_hour: [0, 23] - - tm_min: [0, 59] - - tm_sec: [0, 60] - - tm_wday: [0, 6] (1) - - tm_yday: [0, 365] (2) - - tm_isdst: [-max(int), max(int)] - - (1) gettmarg() handles bounds-checking. - (2) Python's acceptable range is one greater than the range in C, - thus need to check against automatic decrement by gettmarg(). - */ - if (buf.tm_mon == -1) - buf.tm_mon = 0; - else if (buf.tm_mon < 0 || buf.tm_mon > 11) { - PyErr_SetString(PyExc_ValueError, "month out of range"); - return NULL; - } - if (buf.tm_mday == 0) - buf.tm_mday = 1; - else if (buf.tm_mday < 0 || buf.tm_mday > 31) { - PyErr_SetString(PyExc_ValueError, "day of month out of range"); - return NULL; - } - if (buf.tm_hour < 0 || buf.tm_hour > 23) { - PyErr_SetString(PyExc_ValueError, "hour out of range"); - return NULL; - } - if (buf.tm_min < 0 || buf.tm_min > 59) { - PyErr_SetString(PyExc_ValueError, "minute out of range"); - return NULL; - } - if (buf.tm_sec < 0 || buf.tm_sec > 61) { - PyErr_SetString(PyExc_ValueError, "seconds out of range"); - return NULL; - } - /* tm_wday does not need checking of its upper-bound since taking - ``% 7`` in gettmarg() automatically restricts the range. */ - if (buf.tm_wday < 0) { - PyErr_SetString(PyExc_ValueError, "day of week out of range"); - return NULL; - } - if (buf.tm_yday == -1) - buf.tm_yday = 0; - else if (buf.tm_yday < 0 || buf.tm_yday > 365) { - PyErr_SetString(PyExc_ValueError, "day of year out of range"); - return NULL; - } - /* Normalize tm_isdst just in case someone foolishly implements %Z - based on the assumption that tm_isdst falls within the range of - [-1, 1] */ - if (buf.tm_isdst < -1) - buf.tm_isdst = -1; - else if (buf.tm_isdst > 1) - buf.tm_isdst = 1; - -#ifdef MS_WINDOWS - /* check that the format string contains only valid directives */ - for(outbuf = strchr(fmt, '%'); - outbuf != NULL; - outbuf = strchr(outbuf+2, '%')) - { - if (outbuf[1]=='#') - ++outbuf; /* not documented by python, */ - if (outbuf[1]=='\0' || - !strchr("aAbBcdHIjmMpSUwWxXyYzZ%", outbuf[1])) - { - PyErr_SetString(PyExc_ValueError, "Invalid format string"); - return 0; - } - } -#endif - - fmtlen = strlen(fmt); - - /* I hate these functions that presume you know how big the output - * will be ahead of time... - */ - for (i = 1024; ; i += i) { - outbuf = (char *)malloc(i); - if (outbuf == NULL) { - return PyErr_NoMemory(); - } - buflen = strftime(outbuf, i, fmt, &buf); - if (buflen > 0 || i >= 256 * fmtlen) { - /* If the buffer is 256 times as long as the format, - it's probably not failing for lack of room! - More likely, the format yields an empty result, - e.g. an empty format, or %Z when the timezone - is unknown. */ - PyObject *ret; - ret = PyString_FromStringAndSize(outbuf, buflen); - free(outbuf); - return ret; - } - free(outbuf); -#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) - /* VisualStudio .NET 2005 does this properly */ - if (buflen == 0 && errno == EINVAL) { - PyErr_SetString(PyExc_ValueError, "Invalid format string"); - return 0; - } -#endif - - } -} - -PyDoc_STRVAR(strftime_doc, -"strftime(format[, tuple]) -> string\n\ -\n\ -Convert a time tuple to a string according to a format specification.\n\ -See the library reference manual for formatting codes. When the time tuple\n\ -is not present, current time as returned by localtime() is used."); -#endif /* HAVE_STRFTIME */ - -static PyObject * -time_strptime(PyObject *self, PyObject *args) -{ - PyObject *strptime_module = PyImport_ImportModuleNoBlock("_strptime"); - PyObject *strptime_result; - - if (!strptime_module) - return NULL; - strptime_result = PyObject_CallMethod(strptime_module, - "_strptime_time", "O", args); - Py_DECREF(strptime_module); - return strptime_result; -} - -PyDoc_STRVAR(strptime_doc, -"strptime(string, format) -> struct_time\n\ -\n\ -Parse a string to a time tuple according to a format specification.\n\ -See the library reference manual for formatting codes (same as strftime())."); - - -static PyObject * -time_asctime(PyObject *self, PyObject *args) -{ - PyObject *tup = NULL; - struct tm buf; - char *p; - if (!PyArg_UnpackTuple(args, "asctime", 0, 1, &tup)) - return NULL; - if (tup == NULL) { - time_t tt = time(NULL); - buf = *localtime(&tt); - } else if (!gettmarg(tup, &buf)) - return NULL; - p = asctime(&buf); - if (p == NULL) { - PyErr_SetString(PyExc_ValueError, "invalid time"); - return NULL; - } - if (p[24] == '\n') - p[24] = '\0'; - return PyString_FromString(p); -} - -PyDoc_STRVAR(asctime_doc, -"asctime([tuple]) -> string\n\ -\n\ -Convert a time tuple to a string, e.g. 'Sat Jun 06 16:26:11 1998'.\n\ -When the time tuple is not present, current time as returned by localtime()\n\ -is used."); - -static PyObject * -time_ctime(PyObject *self, PyObject *args) -{ - PyObject *ot = NULL; - time_t tt; - char *p; - - if (!PyArg_UnpackTuple(args, "ctime", 0, 1, &ot)) - return NULL; - if (ot == NULL || ot == Py_None) - tt = time(NULL); - else { - double dt = PyFloat_AsDouble(ot); - if (PyErr_Occurred()) - return NULL; - tt = _PyTime_DoubleToTimet(dt); - if (tt == (time_t)-1 && PyErr_Occurred()) - return NULL; - } - p = ctime(&tt); - if (p == NULL) { - PyErr_SetString(PyExc_ValueError, "unconvertible time"); - return NULL; - } - if (p[24] == '\n') - p[24] = '\0'; - return PyString_FromString(p); -} - -PyDoc_STRVAR(ctime_doc, -"ctime(seconds) -> string\n\ -\n\ -Convert a time in seconds since the Epoch to a string in local time.\n\ -This is equivalent to asctime(localtime(seconds)). When the time tuple is\n\ -not present, current time as returned by localtime() is used."); - -#ifdef HAVE_MKTIME -static PyObject * -time_mktime(PyObject *self, PyObject *tup) -{ - struct tm buf; - time_t tt; - if (!gettmarg(tup, &buf)) - return NULL; - buf.tm_wday = -1; /* sentinel; original value ignored */ - tt = mktime(&buf); - /* Return value of -1 does not necessarily mean an error, but tm_wday - * cannot remain set to -1 if mktime succeeded. */ - if (tt == (time_t)(-1) && buf.tm_wday == -1) { - PyErr_SetString(PyExc_OverflowError, - "mktime argument out of range"); - return NULL; - } - return PyFloat_FromDouble((double)tt); -} - -PyDoc_STRVAR(mktime_doc, -"mktime(tuple) -> floating point number\n\ -\n\ -Convert a time tuple in local time to seconds since the Epoch."); -#endif /* HAVE_MKTIME */ - -#ifdef HAVE_WORKING_TZSET -static void inittimezone(PyObject *module); - -static PyObject * -time_tzset(PyObject *self, PyObject *unused) -{ - PyObject* m; - - m = PyImport_ImportModuleNoBlock("time"); - if (m == NULL) { - return NULL; - } - - tzset(); - - /* Reset timezone, altzone, daylight and tzname */ - inittimezone(m); - Py_DECREF(m); - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(tzset_doc, -"tzset()\n\ -\n\ -Initialize, or reinitialize, the local timezone to the value stored in\n\ -os.environ['TZ']. The TZ environment variable should be specified in\n\ -standard Unix timezone format as documented in the tzset man page\n\ -(eg. 'US/Eastern', 'Europe/Amsterdam'). Unknown timezones will silently\n\ -fall back to UTC. If the TZ environment variable is not set, the local\n\ -timezone is set to the systems best guess of wallclock time.\n\ -Changing the TZ environment variable without calling tzset *may* change\n\ -the local timezone used by methods such as localtime, but this behaviour\n\ -should not be relied on."); -#endif /* HAVE_WORKING_TZSET */ - -static void -inittimezone(PyObject *m) { - /* This code moved from inittime wholesale to allow calling it from - time_tzset. In the future, some parts of it can be moved back - (for platforms that don't HAVE_WORKING_TZSET, when we know what they - are), and the extraneous calls to tzset(3) should be removed. - I haven't done this yet, as I don't want to change this code as - little as possible when introducing the time.tzset and time.tzsetwall - methods. This should simply be a method of doing the following once, - at the top of this function and removing the call to tzset() from - time_tzset(): - - #ifdef HAVE_TZSET - tzset() - #endif - - And I'm lazy and hate C so nyer. - */ -#if defined(HAVE_TZNAME) && !defined(__GLIBC__) && !defined(__CYGWIN__) - tzset(); -#ifdef PYOS_OS2 - PyModule_AddIntConstant(m, "timezone", _timezone); -#else /* !PYOS_OS2 */ - PyModule_AddIntConstant(m, "timezone", timezone); -#endif /* PYOS_OS2 */ -#ifdef HAVE_ALTZONE - PyModule_AddIntConstant(m, "altzone", altzone); -#else -#ifdef PYOS_OS2 - PyModule_AddIntConstant(m, "altzone", _timezone-3600); -#else /* !PYOS_OS2 */ - PyModule_AddIntConstant(m, "altzone", timezone-3600); -#endif /* PYOS_OS2 */ -#endif - PyModule_AddIntConstant(m, "daylight", daylight); - PyModule_AddObject(m, "tzname", - Py_BuildValue("(zz)", tzname[0], tzname[1])); -#else /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ -#ifdef HAVE_STRUCT_TM_TM_ZONE - { -#define YEAR ((time_t)((365 * 24 + 6) * 3600)) - time_t t; - struct tm *p; - long janzone, julyzone; - char janname[10], julyname[10]; - t = (time((time_t *)0) / YEAR) * YEAR; - p = localtime(&t); - janzone = -p->tm_gmtoff; - strncpy(janname, p->tm_zone ? p->tm_zone : " ", 9); - janname[9] = '\0'; - t += YEAR/2; - p = localtime(&t); - julyzone = -p->tm_gmtoff; - strncpy(julyname, p->tm_zone ? p->tm_zone : " ", 9); - julyname[9] = '\0'; - - if( janzone < julyzone ) { - /* DST is reversed in the southern hemisphere */ - PyModule_AddIntConstant(m, "timezone", julyzone); - PyModule_AddIntConstant(m, "altzone", janzone); - PyModule_AddIntConstant(m, "daylight", - janzone != julyzone); - PyModule_AddObject(m, "tzname", - Py_BuildValue("(zz)", - julyname, janname)); - } else { - PyModule_AddIntConstant(m, "timezone", janzone); - PyModule_AddIntConstant(m, "altzone", julyzone); - PyModule_AddIntConstant(m, "daylight", - janzone != julyzone); - PyModule_AddObject(m, "tzname", - Py_BuildValue("(zz)", - janname, julyname)); - } - } -#else -#endif /* HAVE_STRUCT_TM_TM_ZONE */ -#ifdef __CYGWIN__ - tzset(); - PyModule_AddIntConstant(m, "timezone", _timezone); - PyModule_AddIntConstant(m, "altzone", _timezone-3600); - PyModule_AddIntConstant(m, "daylight", _daylight); - PyModule_AddObject(m, "tzname", - Py_BuildValue("(zz)", _tzname[0], _tzname[1])); -#endif /* __CYGWIN__ */ -#endif /* !HAVE_TZNAME || __GLIBC__ || __CYGWIN__*/ -} - - -static PyMethodDef time_methods[] = { - {"time", time_time, METH_NOARGS, time_doc}, -#ifdef HAVE_CLOCK - {"clock", time_clock, METH_NOARGS, clock_doc}, -#endif - {"sleep", time_sleep, METH_VARARGS, sleep_doc}, - {"gmtime", time_gmtime, METH_VARARGS, gmtime_doc}, - {"localtime", time_localtime, METH_VARARGS, localtime_doc}, - {"asctime", time_asctime, METH_VARARGS, asctime_doc}, - {"ctime", time_ctime, METH_VARARGS, ctime_doc}, -#ifdef HAVE_MKTIME - {"mktime", time_mktime, METH_O, mktime_doc}, -#endif -#ifdef HAVE_STRFTIME - {"strftime", time_strftime, METH_VARARGS, strftime_doc}, -#endif - {"strptime", time_strptime, METH_VARARGS, strptime_doc}, -#ifdef HAVE_WORKING_TZSET - {"tzset", time_tzset, METH_NOARGS, tzset_doc}, -#endif - {NULL, NULL} /* sentinel */ -}; - - -PyDoc_STRVAR(module_doc, -"This module provides various functions to manipulate time values.\n\ -\n\ -There are two standard representations of time. One is the number\n\ -of seconds since the Epoch, in UTC (a.k.a. GMT). It may be an integer\n\ -or a floating point number (to represent fractions of seconds).\n\ -The Epoch is system-defined; on Unix, it is generally January 1st, 1970.\n\ -The actual value can be retrieved by calling gmtime(0).\n\ -\n\ -The other representation is a tuple of 9 integers giving local time.\n\ -The tuple items are:\n\ - year (four digits, e.g. 1998)\n\ - month (1-12)\n\ - day (1-31)\n\ - hours (0-23)\n\ - minutes (0-59)\n\ - seconds (0-59)\n\ - weekday (0-6, Monday is 0)\n\ - Julian day (day in the year, 1-366)\n\ - DST (Daylight Savings Time) flag (-1, 0 or 1)\n\ -If the DST flag is 0, the time is given in the regular time zone;\n\ -if it is 1, the time is given in the DST time zone;\n\ -if it is -1, mktime() should guess based on the date and time.\n\ -\n\ -Variables:\n\ -\n\ -timezone -- difference in seconds between UTC and local standard time\n\ -altzone -- difference in seconds between UTC and local DST time\n\ -daylight -- whether local time should reflect DST\n\ -tzname -- tuple of (standard time zone name, DST time zone name)\n\ -\n\ -Functions:\n\ -\n\ -time() -- return current time in seconds since the Epoch as a float\n\ -clock() -- return CPU time since process start as a float\n\ -sleep() -- delay for a number of seconds given as a float\n\ -gmtime() -- convert seconds since Epoch to UTC tuple\n\ -localtime() -- convert seconds since Epoch to local time tuple\n\ -asctime() -- convert time tuple to string\n\ -ctime() -- convert time in seconds to string\n\ -mktime() -- convert local time tuple to seconds since Epoch\n\ -strftime() -- convert time tuple to string according to format specification\n\ -strptime() -- parse string to time tuple according to format specification\n\ -tzset() -- change the local timezone"); - - -PyMODINIT_FUNC -inittime(void) -{ - PyObject *m; - char *p; - m = Py_InitModule3("time", time_methods, module_doc); - if (m == NULL) - return; - - /* Accept 2-digit dates unless PYTHONY2K is set and non-empty */ - p = Py_GETENV("PYTHONY2K"); - PyModule_AddIntConstant(m, "accept2dyear", (long) (!p || !*p)); - /* If an embedded interpreter is shutdown and reinitialized the old - moddict was not decrefed on shutdown and the next import of this - module leads to a leak. Conditionally decref here to prevent that. - */ - Py_XDECREF(moddict); - /* Squirrel away the module's dictionary for the y2k check */ - moddict = PyModule_GetDict(m); - Py_INCREF(moddict); - - /* Set, or reset, module variables like time.timezone */ - inittimezone(m); - -#ifdef MS_WINDOWS - /* Helper to allow interrupts for Windows. - If Ctrl+C event delivered while not sleeping - it will be ignored. - */ - main_thread = PyThread_get_thread_ident(); - hInterruptEvent = CreateEvent(NULL, TRUE, FALSE, NULL); - SetConsoleCtrlHandler( PyCtrlHandler, TRUE); -#endif /* MS_WINDOWS */ - if (!initialized) { - PyStructSequence_InitType(&StructTimeType, - &struct_time_type_desc); - } - Py_INCREF(&StructTimeType); - PyModule_AddObject(m, "struct_time", (PyObject*) &StructTimeType); - initialized = 1; -} - - -/* Implement floattime() for various platforms */ - -static double -floattime(void) -{ - /* There are three ways to get the time: - (1) gettimeofday() -- resolution in microseconds - (2) ftime() -- resolution in milliseconds - (3) time() -- resolution in seconds - In all cases the return value is a float in seconds. - Since on some systems (e.g. SCO ODT 3.0) gettimeofday() may - fail, so we fall back on ftime() or time(). - Note: clock resolution does not imply clock accuracy! */ -#ifdef HAVE_GETTIMEOFDAY - { - struct timeval t; -#ifdef GETTIMEOFDAY_NO_TZ - if (gettimeofday(&t) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; -#else /* !GETTIMEOFDAY_NO_TZ */ - if (gettimeofday(&t, (struct timezone *)NULL) == 0) - return (double)t.tv_sec + t.tv_usec*0.000001; -#endif /* !GETTIMEOFDAY_NO_TZ */ - } - -#endif /* !HAVE_GETTIMEOFDAY */ - { -#if defined(HAVE_FTIME) - struct timeb t; - ftime(&t); - return (double)t.time + (double)t.millitm * (double)0.001; -#else /* !HAVE_FTIME */ - time_t secs; - time(&secs); - return (double)secs; -#endif /* !HAVE_FTIME */ - } -} - - -/* Implement floatsleep() for various platforms. - When interrupted (or when another error occurs), return -1 and - set an exception; else return 0. */ - -static int -floatsleep(double secs) -{ -/* XXX Should test for MS_WINDOWS first! */ -#if defined(HAVE_SELECT) && !defined(__BEOS__) && !defined(__EMX__) - struct timeval t; - double frac; - frac = fmod(secs, 1.0); - secs = floor(secs); - t.tv_sec = (long)secs; - t.tv_usec = (long)(frac*1000000.0); - Py_BEGIN_ALLOW_THREADS - if (select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t) != 0) { -#ifdef EINTR - if (errno != EINTR) { -#else - if (1) { -#endif - Py_BLOCK_THREADS - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - } - Py_END_ALLOW_THREADS -#elif defined(__WATCOMC__) && !defined(__QNX__) - /* XXX Can't interrupt this sleep */ - Py_BEGIN_ALLOW_THREADS - delay((int)(secs * 1000 + 0.5)); /* delay() uses milliseconds */ - Py_END_ALLOW_THREADS -#elif defined(MS_WINDOWS) - { - double millisecs = secs * 1000.0; - unsigned long ul_millis; - - if (millisecs > (double)ULONG_MAX) { - PyErr_SetString(PyExc_OverflowError, - "sleep length is too large"); - return -1; - } - Py_BEGIN_ALLOW_THREADS - /* Allow sleep(0) to maintain win32 semantics, and as decreed - * by Guido, only the main thread can be interrupted. - */ - ul_millis = (unsigned long)millisecs; - if (ul_millis == 0 || - main_thread != PyThread_get_thread_ident()) - Sleep(ul_millis); - else { - DWORD rc; - ResetEvent(hInterruptEvent); - rc = WaitForSingleObject(hInterruptEvent, ul_millis); - if (rc == WAIT_OBJECT_0) { - /* Yield to make sure real Python signal - * handler called. - */ - Sleep(1); - Py_BLOCK_THREADS - errno = EINTR; - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - } - Py_END_ALLOW_THREADS - } -#elif defined(PYOS_OS2) - /* This Sleep *IS* Interruptable by Exceptions */ - Py_BEGIN_ALLOW_THREADS - if (DosSleep(secs * 1000) != NO_ERROR) { - Py_BLOCK_THREADS - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - Py_END_ALLOW_THREADS -#elif defined(__BEOS__) - /* This sleep *CAN BE* interrupted. */ - { - if( secs <= 0.0 ) { - return; - } - - Py_BEGIN_ALLOW_THREADS - /* BeOS snooze() is in microseconds... */ - if( snooze( (bigtime_t)( secs * 1000.0 * 1000.0 ) ) == B_INTERRUPTED ) { - Py_BLOCK_THREADS - PyErr_SetFromErrno( PyExc_IOError ); - return -1; - } - Py_END_ALLOW_THREADS - } -#elif defined(RISCOS) - if (secs <= 0.0) - return 0; - Py_BEGIN_ALLOW_THREADS - /* This sleep *CAN BE* interrupted. */ - if ( riscos_sleep(secs) ) - return -1; - Py_END_ALLOW_THREADS -#elif defined(PLAN9) - { - double millisecs = secs * 1000.0; - if (millisecs > (double)LONG_MAX) { - PyErr_SetString(PyExc_OverflowError, "sleep length is too large"); - return -1; - } - /* This sleep *CAN BE* interrupted. */ - Py_BEGIN_ALLOW_THREADS - if(sleep((long)millisecs) < 0){ - Py_BLOCK_THREADS - PyErr_SetFromErrno(PyExc_IOError); - return -1; - } - Py_END_ALLOW_THREADS - } -#else - /* XXX Can't interrupt this sleep */ - Py_BEGIN_ALLOW_THREADS - sleep((int)secs); - Py_END_ALLOW_THREADS -#endif - - return 0; -} - -/* export floattime to socketmodule.c */ -PyAPI_FUNC(double) -_PyTime_FloatTime(void) -{ - return floattime(); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata.c deleted file mode 100644 index 0880bd2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata.c +++ /dev/null @@ -1,1287 +0,0 @@ -/* ------------------------------------------------------------------------ - - unicodedata -- Provides access to the Unicode 5.2 data base. - - Data was extracted from the Unicode 5.2 UnicodeData.txt file. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) - Modified by Martin v. Löwis (martin@v.loewis.de) - - Copyright (c) Corporation for National Research Initiatives. - - ------------------------------------------------------------------------ */ - -#include "Python.h" -#include "ucnhash.h" -#include "structmember.h" - -/* character properties */ - -typedef struct { - const unsigned char category; /* index into - _PyUnicode_CategoryNames */ - const unsigned char combining; /* combining class value 0 - 255 */ - const unsigned char bidirectional; /* index into - _PyUnicode_BidirectionalNames */ - const unsigned char mirrored; /* true if mirrored in bidir mode */ - const unsigned char east_asian_width; /* index into - _PyUnicode_EastAsianWidth */ - const unsigned char normalization_quick_check; /* see is_normalized() */ -} _PyUnicode_DatabaseRecord; - -typedef struct change_record { - /* sequence of fields should be the same as in merge_old_version */ - const unsigned char bidir_changed; - const unsigned char category_changed; - const unsigned char decimal_changed; - const unsigned char mirrored_changed; - const double numeric_changed; -} change_record; - -/* data file generated by Tools/unicode/makeunicodedata.py */ -#include "unicodedata_db.h" - -static const _PyUnicode_DatabaseRecord* -_getrecord_ex(Py_UCS4 code) -{ - int index; - if (code >= 0x110000) - index = 0; - else { - index = index1[(code>>SHIFT)]; - index = index2[(index<getrecord)(v)) - -static PyMemberDef DB_members[] = { - {"unidata_version", T_STRING, offsetof(PreviousDBVersion, name), READONLY}, - {NULL} -}; - -/* forward declaration */ -static PyTypeObject UCD_Type; - -static PyObject* -new_previous_version(const char*name, const change_record* (*getrecord)(Py_UCS4), - Py_UCS4 (*normalization)(Py_UCS4)) -{ - PreviousDBVersion *self; - self = PyObject_New(PreviousDBVersion, &UCD_Type); - if (self == NULL) - return NULL; - self->name = name; - self->getrecord = getrecord; - self->normalization = normalization; - return (PyObject*)self; -} - - -static Py_UCS4 getuchar(PyUnicodeObject *obj) -{ - Py_UNICODE *v = PyUnicode_AS_UNICODE(obj); - - if (PyUnicode_GET_SIZE(obj) == 1) - return *v; -#ifndef Py_UNICODE_WIDE - else if ((PyUnicode_GET_SIZE(obj) == 2) && - (0xD800 <= v[0] && v[0] <= 0xDBFF) && - (0xDC00 <= v[1] && v[1] <= 0xDFFF)) - return (((v[0] & 0x3FF)<<10) | (v[1] & 0x3FF)) + 0x10000; -#endif - PyErr_SetString(PyExc_TypeError, - "need a single Unicode character as parameter"); - return (Py_UCS4)-1; -} - -/* --- Module API --------------------------------------------------------- */ - -PyDoc_STRVAR(unicodedata_decimal__doc__, -"decimal(unichr[, default])\n\ -\n\ -Returns the decimal value assigned to the Unicode character unichr\n\ -as integer. If no such value is defined, default is returned, or, if\n\ -not given, ValueError is raised."); - -static PyObject * -unicodedata_decimal(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - PyObject *defobj = NULL; - int have_old = 0; - long rc; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!|O:decimal", &PyUnicode_Type, &v, &defobj)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) { - /* unassigned */ - have_old = 1; - rc = -1; - } - else if (old->decimal_changed != 0xFF) { - have_old = 1; - rc = old->decimal_changed; - } - } - - if (!have_old) - rc = Py_UNICODE_TODECIMAL(c); - if (rc < 0) { - if (defobj == NULL) { - PyErr_SetString(PyExc_ValueError, - "not a decimal"); - return NULL; - } - else { - Py_INCREF(defobj); - return defobj; - } - } - return PyInt_FromLong(rc); -} - -PyDoc_STRVAR(unicodedata_digit__doc__, -"digit(unichr[, default])\n\ -\n\ -Returns the digit value assigned to the Unicode character unichr as\n\ -integer. If no such value is defined, default is returned, or, if\n\ -not given, ValueError is raised."); - -static PyObject * -unicodedata_digit(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - PyObject *defobj = NULL; - long rc; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!|O:digit", &PyUnicode_Type, &v, &defobj)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - rc = Py_UNICODE_TODIGIT(c); - if (rc < 0) { - if (defobj == NULL) { - PyErr_SetString(PyExc_ValueError, "not a digit"); - return NULL; - } - else { - Py_INCREF(defobj); - return defobj; - } - } - return PyInt_FromLong(rc); -} - -PyDoc_STRVAR(unicodedata_numeric__doc__, -"numeric(unichr[, default])\n\ -\n\ -Returns the numeric value assigned to the Unicode character unichr\n\ -as float. If no such value is defined, default is returned, or, if\n\ -not given, ValueError is raised."); - -static PyObject * -unicodedata_numeric(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - PyObject *defobj = NULL; - int have_old = 0; - double rc; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!|O:numeric", &PyUnicode_Type, &v, &defobj)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) { - /* unassigned */ - have_old = 1; - rc = -1.0; - } - else if (old->decimal_changed != 0xFF) { - have_old = 1; - rc = old->decimal_changed; - } - } - - if (!have_old) - rc = Py_UNICODE_TONUMERIC(c); - if (rc == -1.0) { - if (defobj == NULL) { - PyErr_SetString(PyExc_ValueError, "not a numeric character"); - return NULL; - } - else { - Py_INCREF(defobj); - return defobj; - } - } - return PyFloat_FromDouble(rc); -} - -PyDoc_STRVAR(unicodedata_category__doc__, -"category(unichr)\n\ -\n\ -Returns the general category assigned to the Unicode character\n\ -unichr as string."); - -static PyObject * -unicodedata_category(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - int index; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!:category", - &PyUnicode_Type, &v)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - index = (int) _getrecord_ex(c)->category; - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed != 0xFF) - index = old->category_changed; - } - return PyString_FromString(_PyUnicode_CategoryNames[index]); -} - -PyDoc_STRVAR(unicodedata_bidirectional__doc__, -"bidirectional(unichr)\n\ -\n\ -Returns the bidirectional class assigned to the Unicode character\n\ -unichr as string. If no such value is defined, an empty string is\n\ -returned."); - -static PyObject * -unicodedata_bidirectional(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - int index; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!:bidirectional", - &PyUnicode_Type, &v)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - index = (int) _getrecord_ex(c)->bidirectional; - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) - index = 0; /* unassigned */ - else if (old->bidir_changed != 0xFF) - index = old->bidir_changed; - } - return PyString_FromString(_PyUnicode_BidirectionalNames[index]); -} - -PyDoc_STRVAR(unicodedata_combining__doc__, -"combining(unichr)\n\ -\n\ -Returns the canonical combining class assigned to the Unicode\n\ -character unichr as integer. Returns 0 if no combining class is\n\ -defined."); - -static PyObject * -unicodedata_combining(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - int index; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!:combining", - &PyUnicode_Type, &v)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - index = (int) _getrecord_ex(c)->combining; - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) - index = 0; /* unassigned */ - } - return PyInt_FromLong(index); -} - -PyDoc_STRVAR(unicodedata_mirrored__doc__, -"mirrored(unichr)\n\ -\n\ -Returns the mirrored property assigned to the Unicode character\n\ -unichr as integer. Returns 1 if the character has been identified as\n\ -a \"mirrored\" character in bidirectional text, 0 otherwise."); - -static PyObject * -unicodedata_mirrored(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - int index; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!:mirrored", - &PyUnicode_Type, &v)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - index = (int) _getrecord_ex(c)->mirrored; - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) - index = 0; /* unassigned */ - else if (old->mirrored_changed != 0xFF) - index = old->mirrored_changed; - } - return PyInt_FromLong(index); -} - -PyDoc_STRVAR(unicodedata_east_asian_width__doc__, -"east_asian_width(unichr)\n\ -\n\ -Returns the east asian width assigned to the Unicode character\n\ -unichr as string."); - -static PyObject * -unicodedata_east_asian_width(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - int index; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!:east_asian_width", - &PyUnicode_Type, &v)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - index = (int) _getrecord_ex(c)->east_asian_width; - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) - index = 0; /* unassigned */ - } - return PyString_FromString(_PyUnicode_EastAsianWidthNames[index]); -} - -PyDoc_STRVAR(unicodedata_decomposition__doc__, -"decomposition(unichr)\n\ -\n\ -Returns the character decomposition mapping assigned to the Unicode\n\ -character unichr as string. An empty string is returned in case no\n\ -such mapping is defined."); - -static PyObject * -unicodedata_decomposition(PyObject *self, PyObject *args) -{ - PyUnicodeObject *v; - char decomp[256]; - int code, index, count, i; - unsigned int prefix_index; - Py_UCS4 c; - - if (!PyArg_ParseTuple(args, "O!:decomposition", - &PyUnicode_Type, &v)) - return NULL; - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - - code = (int)c; - - if (self) { - const change_record *old = get_old_record(self, c); - if (old->category_changed == 0) - return PyString_FromString(""); /* unassigned */ - } - - if (code < 0 || code >= 0x110000) - index = 0; - else { - index = decomp_index1[(code>>DECOMP_SHIFT)]; - index = decomp_index2[(index<> 8; - - /* XXX: could allocate the PyString up front instead - (strlen(prefix) + 5 * count + 1 bytes) */ - - /* Based on how index is calculated above and decomp_data is generated - from Tools/unicode/makeunicodedata.py, it should not be possible - to overflow decomp_prefix. */ - prefix_index = decomp_data[index] & 255; - assert(prefix_index < (sizeof(decomp_prefix)/sizeof(*decomp_prefix))); - - /* copy prefix */ - i = strlen(decomp_prefix[prefix_index]); - memcpy(decomp, decomp_prefix[prefix_index], i); - - while (count-- > 0) { - if (i) - decomp[i++] = ' '; - assert((size_t)i < sizeof(decomp)); - PyOS_snprintf(decomp + i, sizeof(decomp) - i, "%04X", - decomp_data[++index]); - i += strlen(decomp + i); - } - - decomp[i] = '\0'; - - return PyString_FromString(decomp); -} - -static void -get_decomp_record(PyObject *self, Py_UCS4 code, int *index, int *prefix, int *count) -{ - if (code >= 0x110000) { - *index = 0; - } else if (self && get_old_record(self, code)->category_changed==0) { - /* unassigned in old version */ - *index = 0; - } - else { - *index = decomp_index1[(code>>DECOMP_SHIFT)]; - *index = decomp_index2[(*index<> 8; - *prefix = decomp_data[*index] & 255; - - (*index)++; -} - -#define SBase 0xAC00 -#define LBase 0x1100 -#define VBase 0x1161 -#define TBase 0x11A7 -#define LCount 19 -#define VCount 21 -#define TCount 28 -#define NCount (VCount*TCount) -#define SCount (LCount*NCount) - -static PyObject* -nfd_nfkd(PyObject *self, PyObject *input, int k) -{ - PyObject *result; - Py_UNICODE *i, *end, *o; - /* Longest decomposition in Unicode 3.2: U+FDFA */ - Py_UNICODE stack[20]; - Py_ssize_t space, isize; - int index, prefix, count, stackptr; - unsigned char prev, cur; - - stackptr = 0; - isize = PyUnicode_GET_SIZE(input); - space = isize; - /* Overallocate at most 10 characters. */ - if (space > 10) { - if (space <= PY_SSIZE_T_MAX - 10) - space += 10; - } - else { - space *= 2; - } - result = PyUnicode_FromUnicode(NULL, space); - if (!result) - return NULL; - i = PyUnicode_AS_UNICODE(input); - end = i + isize; - o = PyUnicode_AS_UNICODE(result); - - while (i < end) { - stack[stackptr++] = *i++; - while(stackptr) { - Py_UNICODE code = stack[--stackptr]; - /* Hangul Decomposition adds three characters in - a single step, so we need at least that much room. */ - if (space < 3) { - Py_ssize_t newsize = PyString_GET_SIZE(result) + 10; - space += 10; - if (PyUnicode_Resize(&result, newsize) == -1) - return NULL; - o = PyUnicode_AS_UNICODE(result) + newsize - space; - } - /* Hangul Decomposition. */ - if (SBase <= code && code < (SBase+SCount)) { - int SIndex = code - SBase; - int L = LBase + SIndex / NCount; - int V = VBase + (SIndex % NCount) / TCount; - int T = TBase + SIndex % TCount; - *o++ = L; - *o++ = V; - space -= 2; - if (T != TBase) { - *o++ = T; - space --; - } - continue; - } - /* normalization changes */ - if (self) { - Py_UCS4 value = ((PreviousDBVersion*)self)->normalization(code); - if (value != 0) { - stack[stackptr++] = value; - continue; - } - } - - /* Other decompositions. */ - get_decomp_record(self, code, &index, &prefix, &count); - - /* Copy character if it is not decomposable, or has a - compatibility decomposition, but we do NFD. */ - if (!count || (prefix && !k)) { - *o++ = code; - space--; - continue; - } - /* Copy decomposition onto the stack, in reverse - order. */ - while(count) { - code = decomp_data[index + (--count)]; - stack[stackptr++] = code; - } - } - } - - /* Drop overallocation. Cannot fail. */ - PyUnicode_Resize(&result, PyUnicode_GET_SIZE(result) - space); - - /* Sort canonically. */ - i = PyUnicode_AS_UNICODE(result); - prev = _getrecord_ex(*i)->combining; - end = i + PyUnicode_GET_SIZE(result); - for (i++; i < end; i++) { - cur = _getrecord_ex(*i)->combining; - if (prev == 0 || cur == 0 || prev <= cur) { - prev = cur; - continue; - } - /* Non-canonical order. Need to switch *i with previous. */ - o = i - 1; - while (1) { - Py_UNICODE tmp = o[1]; - o[1] = o[0]; - o[0] = tmp; - o--; - if (o < PyUnicode_AS_UNICODE(result)) - break; - prev = _getrecord_ex(*o)->combining; - if (prev == 0 || prev <= cur) - break; - } - prev = _getrecord_ex(*i)->combining; - } - return result; -} - -static int -find_nfc_index(PyObject *self, struct reindex* nfc, Py_UNICODE code) -{ - int index; - for (index = 0; nfc[index].start; index++) { - int start = nfc[index].start; - if (code < start) - return -1; - if (code <= start + nfc[index].count) { - int delta = code - start; - return nfc[index].index + delta; - } - } - return -1; -} - -static PyObject* -nfc_nfkc(PyObject *self, PyObject *input, int k) -{ - PyObject *result; - Py_UNICODE *i, *i1, *o, *end; - int f,l,index,index1,comb; - Py_UNICODE code; - Py_UNICODE *skipped[20]; - int cskipped = 0; - - result = nfd_nfkd(self, input, k); - if (!result) - return NULL; - - /* We are going to modify result in-place. - If nfd_nfkd is changed to sometimes return the input, - this code needs to be reviewed. */ - assert(result != input); - - i = PyUnicode_AS_UNICODE(result); - end = i + PyUnicode_GET_SIZE(result); - o = PyUnicode_AS_UNICODE(result); - - again: - while (i < end) { - for (index = 0; index < cskipped; index++) { - if (skipped[index] == i) { - /* *i character is skipped. - Remove from list. */ - skipped[index] = skipped[cskipped-1]; - cskipped--; - i++; - goto again; /* continue while */ - } - } - /* Hangul Composition. We don't need to check for - pairs, since we always have decomposed data. */ - if (LBase <= *i && *i < (LBase+LCount) && - i + 1 < end && - VBase <= i[1] && i[1] <= (VBase+VCount)) { - int LIndex, VIndex; - LIndex = i[0] - LBase; - VIndex = i[1] - VBase; - code = SBase + (LIndex*VCount+VIndex)*TCount; - i+=2; - if (i < end && - TBase <= *i && *i <= (TBase+TCount)) { - code += *i-TBase; - i++; - } - *o++ = code; - continue; - } - - f = find_nfc_index(self, nfc_first, *i); - if (f == -1) { - *o++ = *i++; - continue; - } - /* Find next unblocked character. */ - i1 = i+1; - comb = 0; - while (i1 < end) { - int comb1 = _getrecord_ex(*i1)->combining; - if (comb) { - if (comb1 == 0) - break; - if (comb >= comb1) { - /* Character is blocked. */ - i1++; - continue; - } - } - l = find_nfc_index(self, nfc_last, *i1); - /* *i1 cannot be combined with *i. If *i1 - is a starter, we don't need to look further. - Otherwise, record the combining class. */ - if (l == -1) { - not_combinable: - if (comb1 == 0) - break; - comb = comb1; - i1++; - continue; - } - index = f*TOTAL_LAST + l; - index1 = comp_index[index >> COMP_SHIFT]; - code = comp_data[(index1<combining; - unsigned char quickcheck = record->normalization_quick_check; - - if (quickcheck & quickcheck_mask) - return 0; /* this string might need normalization */ - if (combining && prev_combining > combining) - return 0; /* non-canonical sort order, not normalized */ - prev_combining = combining; - } - return 1; /* certainly normalized */ -} - -PyDoc_STRVAR(unicodedata_normalize__doc__, -"normalize(form, unistr)\n\ -\n\ -Return the normal form 'form' for the Unicode string unistr. Valid\n\ -values for form are 'NFC', 'NFKC', 'NFD', and 'NFKD'."); - -static PyObject* -unicodedata_normalize(PyObject *self, PyObject *args) -{ - char *form; - PyObject *input; - - if(!PyArg_ParseTuple(args, "sO!:normalize", - &form, &PyUnicode_Type, &input)) - return NULL; - - if (PyUnicode_GetSize(input) == 0) { - /* Special case empty input strings, since resizing - them later would cause internal errors. */ - Py_INCREF(input); - return input; - } - - if (strcmp(form, "NFC") == 0) { - if (is_normalized(self, input, 1, 0)) { - Py_INCREF(input); - return input; - } - return nfc_nfkc(self, input, 0); - } - if (strcmp(form, "NFKC") == 0) { - if (is_normalized(self, input, 1, 1)) { - Py_INCREF(input); - return input; - } - return nfc_nfkc(self, input, 1); - } - if (strcmp(form, "NFD") == 0) { - if (is_normalized(self, input, 0, 0)) { - Py_INCREF(input); - return input; - } - return nfd_nfkd(self, input, 0); - } - if (strcmp(form, "NFKD") == 0) { - if (is_normalized(self, input, 0, 1)) { - Py_INCREF(input); - return input; - } - return nfd_nfkd(self, input, 1); - } - PyErr_SetString(PyExc_ValueError, "invalid normalization form"); - return NULL; -} - -/* -------------------------------------------------------------------- */ -/* unicode character name tables */ - -/* data file generated by Tools/unicode/makeunicodedata.py */ -#include "unicodename_db.h" - -/* -------------------------------------------------------------------- */ -/* database code (cut and pasted from the unidb package) */ - -static unsigned long -_gethash(const char *s, int len, int scale) -{ - int i; - unsigned long h = 0; - unsigned long ix; - for (i = 0; i < len; i++) { - h = (h * scale) + (unsigned char) Py_TOUPPER(Py_CHARMASK(s[i])); - ix = h & 0xff000000; - if (ix) - h = (h ^ ((ix>>24) & 0xff)) & 0x00ffffff; - } - return h; -} - -static char *hangul_syllables[][3] = { - { "G", "A", "" }, - { "GG", "AE", "G" }, - { "N", "YA", "GG" }, - { "D", "YAE", "GS" }, - { "DD", "EO", "N", }, - { "R", "E", "NJ" }, - { "M", "YEO", "NH" }, - { "B", "YE", "D" }, - { "BB", "O", "L" }, - { "S", "WA", "LG" }, - { "SS", "WAE", "LM" }, - { "", "OE", "LB" }, - { "J", "YO", "LS" }, - { "JJ", "U", "LT" }, - { "C", "WEO", "LP" }, - { "K", "WE", "LH" }, - { "T", "WI", "M" }, - { "P", "YU", "B" }, - { "H", "EU", "BS" }, - { 0, "YI", "S" }, - { 0, "I", "SS" }, - { 0, 0, "NG" }, - { 0, 0, "J" }, - { 0, 0, "C" }, - { 0, 0, "K" }, - { 0, 0, "T" }, - { 0, 0, "P" }, - { 0, 0, "H" } -}; - -static int -is_unified_ideograph(Py_UCS4 code) -{ - return ( - (0x3400 <= code && code <= 0x4DB5) || /* CJK Ideograph Extension A */ - (0x4E00 <= code && code <= 0x9FCB) || /* CJK Ideograph, Unicode 5.2 */ - (0x20000 <= code && code <= 0x2A6D6) || /* CJK Ideograph Extension B */ - (0x2A700 <= code && code <= 0x2B734)); /* CJK Ideograph Extension C */ -} - -static int -_getucname(PyObject *self, Py_UCS4 code, char* buffer, int buflen) -{ - int offset; - int i; - int word; - unsigned char* w; - - if (code >= 0x110000) - return 0; - - if (self) { - const change_record *old = get_old_record(self, code); - if (old->category_changed == 0) { - /* unassigned */ - return 0; - } - } - - if (SBase <= code && code < SBase+SCount) { - /* Hangul syllable. */ - int SIndex = code - SBase; - int L = SIndex / NCount; - int V = (SIndex % NCount) / TCount; - int T = SIndex % TCount; - - if (buflen < 27) - /* Worst case: HANGUL SYLLABLE <10chars>. */ - return 0; - strcpy(buffer, "HANGUL SYLLABLE "); - buffer += 16; - strcpy(buffer, hangul_syllables[L][0]); - buffer += strlen(hangul_syllables[L][0]); - strcpy(buffer, hangul_syllables[V][1]); - buffer += strlen(hangul_syllables[V][1]); - strcpy(buffer, hangul_syllables[T][2]); - buffer += strlen(hangul_syllables[T][2]); - *buffer = '\0'; - return 1; - } - - if (is_unified_ideograph(code)) { - if (buflen < 28) - /* Worst case: CJK UNIFIED IDEOGRAPH-20000 */ - return 0; - sprintf(buffer, "CJK UNIFIED IDEOGRAPH-%X", code); - return 1; - } - - /* get offset into phrasebook */ - offset = phrasebook_offset1[(code>>phrasebook_shift)]; - offset = phrasebook_offset2[(offset<= 0) { - word = (word << 8) + phrasebook[offset+1]; - offset += 2; - } else - word = phrasebook[offset++]; - if (i) { - if (i > buflen) - return 0; /* buffer overflow */ - buffer[i++] = ' '; - } - /* copy word string from lexicon. the last character in the - word has bit 7 set. the last word in a string ends with - 0x80 */ - w = lexicon + lexicon_offset[word]; - while (*w < 128) { - if (i >= buflen) - return 0; /* buffer overflow */ - buffer[i++] = *w++; - } - if (i >= buflen) - return 0; /* buffer overflow */ - buffer[i++] = *w & 127; - if (*w == 128) - break; /* end of word */ - } - - return 1; -} - -static int -_cmpname(PyObject *self, int code, const char* name, int namelen) -{ - /* check if code corresponds to the given name */ - int i; - char buffer[NAME_MAXLEN]; - if (!_getucname(self, code, buffer, sizeof(buffer))) - return 0; - for (i = 0; i < namelen; i++) { - if (Py_TOUPPER(Py_CHARMASK(name[i])) != buffer[i]) - return 0; - } - return buffer[namelen] == '\0'; -} - -static void -find_syllable(const char *str, int *len, int *pos, int count, int column) -{ - int i, len1; - *len = -1; - for (i = 0; i < count; i++) { - char *s = hangul_syllables[i][column]; - len1 = strlen(s); - if (len1 <= *len) - continue; - if (strncmp(str, s, len1) == 0) { - *len = len1; - *pos = i; - } - } - if (*len == -1) { - *len = 0; - } -} - -static int -_getcode(PyObject* self, const char* name, int namelen, Py_UCS4* code) -{ - unsigned int h, v; - unsigned int mask = code_size-1; - unsigned int i, incr; - - /* Check for hangul syllables. */ - if (strncmp(name, "HANGUL SYLLABLE ", 16) == 0) { - int len, L = -1, V = -1, T = -1; - const char *pos = name + 16; - find_syllable(pos, &len, &L, LCount, 0); - pos += len; - find_syllable(pos, &len, &V, VCount, 1); - pos += len; - find_syllable(pos, &len, &T, TCount, 2); - pos += len; - if (L != -1 && V != -1 && T != -1 && pos-name == namelen) { - *code = SBase + (L*VCount+V)*TCount + T; - return 1; - } - /* Otherwise, it's an illegal syllable name. */ - return 0; - } - - /* Check for unified ideographs. */ - if (strncmp(name, "CJK UNIFIED IDEOGRAPH-", 22) == 0) { - /* Four or five hexdigits must follow. */ - v = 0; - name += 22; - namelen -= 22; - if (namelen != 4 && namelen != 5) - return 0; - while (namelen--) { - v *= 16; - if (*name >= '0' && *name <= '9') - v += *name - '0'; - else if (*name >= 'A' && *name <= 'F') - v += *name - 'A' + 10; - else - return 0; - name++; - } - if (!is_unified_ideograph(v)) - return 0; - *code = v; - return 1; - } - - /* the following is the same as python's dictionary lookup, with - only minor changes. see the makeunicodedata script for more - details */ - - h = (unsigned int) _gethash(name, namelen, code_magic); - i = (~h) & mask; - v = code_hash[i]; - if (!v) - return 0; - if (_cmpname(self, v, name, namelen)) { - *code = v; - return 1; - } - incr = (h ^ (h >> 3)) & mask; - if (!incr) - incr = mask; - for (;;) { - i = (i + incr) & mask; - v = code_hash[i]; - if (!v) - return 0; - if (_cmpname(self, v, name, namelen)) { - *code = v; - return 1; - } - incr = incr << 1; - if (incr > mask) - incr = incr ^ code_poly; - } -} - -static const _PyUnicode_Name_CAPI hashAPI = -{ - sizeof(_PyUnicode_Name_CAPI), - _getucname, - _getcode -}; - -/* -------------------------------------------------------------------- */ -/* Python bindings */ - -PyDoc_STRVAR(unicodedata_name__doc__, -"name(unichr[, default])\n\ -Returns the name assigned to the Unicode character unichr as a\n\ -string. If no name is defined, default is returned, or, if not\n\ -given, ValueError is raised."); - -static PyObject * -unicodedata_name(PyObject* self, PyObject* args) -{ - char name[NAME_MAXLEN]; - Py_UCS4 c; - - PyUnicodeObject* v; - PyObject* defobj = NULL; - if (!PyArg_ParseTuple(args, "O!|O:name", &PyUnicode_Type, &v, &defobj)) - return NULL; - - c = getuchar(v); - if (c == (Py_UCS4)-1) - return NULL; - - if (!_getucname(self, c, name, sizeof(name))) { - if (defobj == NULL) { - PyErr_SetString(PyExc_ValueError, "no such name"); - return NULL; - } - else { - Py_INCREF(defobj); - return defobj; - } - } - - return Py_BuildValue("s", name); -} - -PyDoc_STRVAR(unicodedata_lookup__doc__, -"lookup(name)\n\ -\n\ -Look up character by name. If a character with the\n\ -given name is found, return the corresponding Unicode\n\ -character. If not found, KeyError is raised."); - -static PyObject * -unicodedata_lookup(PyObject* self, PyObject* args) -{ - Py_UCS4 code; - Py_UNICODE str[2]; - - char* name; - int namelen; - if (!PyArg_ParseTuple(args, "s#:lookup", &name, &namelen)) - return NULL; - - if (!_getcode(self, name, namelen, &code)) { - PyErr_Format(PyExc_KeyError, "undefined character name '%s'", - name); - return NULL; - } - -#ifndef Py_UNICODE_WIDE - if (code >= 0x10000) { - str[0] = 0xd800 + ((code - 0x10000) >> 10); - str[1] = 0xdc00 + ((code - 0x10000) & 0x3ff); - return PyUnicode_FromUnicode(str, 2); - } -#endif - str[0] = (Py_UNICODE) code; - return PyUnicode_FromUnicode(str, 1); -} - -/* XXX Add doc strings. */ - -static PyMethodDef unicodedata_functions[] = { - {"decimal", unicodedata_decimal, METH_VARARGS, unicodedata_decimal__doc__}, - {"digit", unicodedata_digit, METH_VARARGS, unicodedata_digit__doc__}, - {"numeric", unicodedata_numeric, METH_VARARGS, unicodedata_numeric__doc__}, - {"category", unicodedata_category, METH_VARARGS, - unicodedata_category__doc__}, - {"bidirectional", unicodedata_bidirectional, METH_VARARGS, - unicodedata_bidirectional__doc__}, - {"combining", unicodedata_combining, METH_VARARGS, - unicodedata_combining__doc__}, - {"mirrored", unicodedata_mirrored, METH_VARARGS, - unicodedata_mirrored__doc__}, - {"east_asian_width", unicodedata_east_asian_width, METH_VARARGS, - unicodedata_east_asian_width__doc__}, - {"decomposition", unicodedata_decomposition, METH_VARARGS, - unicodedata_decomposition__doc__}, - {"name", unicodedata_name, METH_VARARGS, unicodedata_name__doc__}, - {"lookup", unicodedata_lookup, METH_VARARGS, unicodedata_lookup__doc__}, - {"normalize", unicodedata_normalize, METH_VARARGS, - unicodedata_normalize__doc__}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject UCD_Type = { - /* The ob_type field must be initialized in the module init function - * to be portable to Windows without using C++. */ - PyVarObject_HEAD_INIT(NULL, 0) - "unicodedata.UCD", /*tp_name*/ - sizeof(PreviousDBVersion), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PyObject_Del, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - PyObject_GenericGetAttr,/*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - unicodedata_functions, /*tp_methods*/ - DB_members, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ -}; - -PyDoc_STRVAR(unicodedata_docstring, -"This module provides access to the Unicode Character Database which\n\ -defines character properties for all Unicode characters. The data in\n\ -this database is based on the UnicodeData.txt file version\n\ -5.2.0 which is publically available from ftp://ftp.unicode.org/.\n\ -\n\ -The module uses the same names and symbols as defined by the\n\ -UnicodeData File Format 5.2.0 (see\n\ -http://www.unicode.org/reports/tr44/tr44-4.html)."); - -PyMODINIT_FUNC -initunicodedata(void) -{ - PyObject *m, *v; - - Py_TYPE(&UCD_Type) = &PyType_Type; - - m = Py_InitModule3( - "unicodedata", unicodedata_functions, unicodedata_docstring); - if (!m) - return; - - PyModule_AddStringConstant(m, "unidata_version", UNIDATA_VERSION); - Py_INCREF(&UCD_Type); - PyModule_AddObject(m, "UCD", (PyObject*)&UCD_Type); - - /* Previous versions */ - v = new_previous_version("3.2.0", get_change_3_2_0, normalization_3_2_0); - if (v != NULL) - PyModule_AddObject(m, "ucd_3_2_0", v); - - /* Export C API */ - v = PyCapsule_New((void *)&hashAPI, PyUnicodeData_CAPSULE_NAME, NULL); - if (v != NULL) - PyModule_AddObject(m, "ucnhash_CAPI", v); -} - -/* -Local variables: -c-basic-offset: 4 -indent-tabs-mode: nil -End: -*/ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata_db.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata_db.h deleted file mode 100644 index 3558c24..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodedata_db.h +++ /dev/null @@ -1,6202 +0,0 @@ -/* this file was generated by Tools/unicode/makeunicodedata.py 2.6 */ - -#define UNIDATA_VERSION "5.2.0" -/* a list of unique database records */ -const _PyUnicode_DatabaseRecord _PyUnicode_Database_Records[] = { - {0, 0, 0, 0, 0, 0}, - {13, 0, 15, 0, 5, 0}, - {13, 0, 17, 0, 5, 0}, - {13, 0, 16, 0, 5, 0}, - {13, 0, 18, 0, 5, 0}, - {10, 0, 18, 0, 3, 0}, - {26, 0, 19, 0, 3, 0}, - {26, 0, 11, 0, 3, 0}, - {28, 0, 11, 0, 3, 0}, - {22, 0, 19, 1, 3, 0}, - {23, 0, 19, 1, 3, 0}, - {27, 0, 10, 0, 3, 0}, - {26, 0, 13, 0, 3, 0}, - {21, 0, 10, 0, 3, 0}, - {7, 0, 9, 0, 3, 0}, - {27, 0, 19, 1, 3, 0}, - {27, 0, 19, 0, 3, 0}, - {1, 0, 1, 0, 3, 0}, - {29, 0, 19, 0, 3, 0}, - {20, 0, 19, 0, 3, 0}, - {2, 0, 1, 0, 3, 0}, - {10, 0, 13, 0, 5, 136}, - {26, 0, 19, 0, 4, 0}, - {28, 0, 11, 0, 4, 0}, - {30, 0, 19, 0, 3, 0}, - {30, 0, 19, 0, 4, 0}, - {29, 0, 19, 0, 4, 136}, - {30, 0, 19, 0, 5, 0}, - {2, 0, 1, 0, 4, 136}, - {24, 0, 19, 1, 5, 0}, - {14, 0, 15, 0, 4, 0}, - {29, 0, 19, 0, 3, 136}, - {30, 0, 11, 0, 4, 0}, - {27, 0, 11, 0, 4, 0}, - {9, 0, 9, 0, 4, 136}, - {2, 0, 1, 0, 5, 136}, - {25, 0, 19, 1, 5, 0}, - {9, 0, 19, 0, 4, 136}, - {1, 0, 1, 0, 5, 10}, - {1, 0, 1, 0, 4, 0}, - {27, 0, 19, 0, 4, 0}, - {2, 0, 1, 0, 4, 0}, - {2, 0, 1, 0, 4, 10}, - {2, 0, 1, 0, 5, 10}, - {1, 0, 1, 0, 5, 0}, - {1, 0, 1, 0, 4, 136}, - {2, 0, 1, 0, 5, 0}, - {19, 0, 1, 0, 5, 0}, - {1, 0, 1, 0, 5, 136}, - {3, 0, 1, 0, 5, 136}, - {18, 0, 1, 0, 5, 136}, - {18, 0, 19, 0, 5, 0}, - {18, 0, 1, 0, 5, 0}, - {29, 0, 19, 0, 5, 0}, - {29, 0, 19, 0, 4, 0}, - {18, 0, 19, 0, 4, 0}, - {18, 0, 1, 0, 4, 0}, - {29, 0, 19, 0, 5, 136}, - {4, 230, 14, 0, 4, 80}, - {4, 230, 14, 0, 4, 0}, - {4, 232, 14, 0, 4, 0}, - {4, 220, 14, 0, 4, 0}, - {4, 216, 14, 0, 4, 80}, - {4, 202, 14, 0, 4, 0}, - {4, 220, 14, 0, 4, 80}, - {4, 202, 14, 0, 4, 80}, - {4, 1, 14, 0, 4, 0}, - {4, 1, 14, 0, 4, 80}, - {4, 230, 14, 0, 4, 170}, - {4, 240, 14, 0, 4, 80}, - {4, 0, 14, 0, 4, 0}, - {4, 233, 14, 0, 4, 0}, - {4, 234, 14, 0, 4, 0}, - {18, 0, 19, 0, 5, 170}, - {26, 0, 19, 0, 5, 170}, - {29, 0, 19, 0, 5, 138}, - {1, 0, 1, 0, 5, 138}, - {27, 0, 19, 0, 5, 0}, - {1, 0, 1, 0, 4, 10}, - {30, 0, 1, 0, 5, 0}, - {4, 230, 14, 0, 5, 0}, - {6, 0, 14, 0, 5, 0}, - {26, 0, 1, 0, 5, 0}, - {21, 0, 19, 0, 5, 0}, - {4, 220, 14, 0, 5, 0}, - {4, 222, 14, 0, 5, 0}, - {4, 228, 14, 0, 5, 0}, - {4, 10, 14, 0, 5, 0}, - {4, 11, 14, 0, 5, 0}, - {4, 12, 14, 0, 5, 0}, - {4, 13, 14, 0, 5, 0}, - {4, 14, 14, 0, 5, 0}, - {4, 15, 14, 0, 5, 0}, - {4, 16, 14, 0, 5, 0}, - {4, 17, 14, 0, 5, 0}, - {4, 18, 14, 0, 5, 0}, - {4, 19, 14, 0, 5, 0}, - {4, 20, 14, 0, 5, 0}, - {4, 21, 14, 0, 5, 0}, - {4, 22, 14, 0, 5, 0}, - {21, 0, 4, 0, 5, 0}, - {4, 23, 14, 0, 5, 0}, - {26, 0, 4, 0, 5, 0}, - {4, 24, 14, 0, 5, 0}, - {4, 25, 14, 0, 5, 0}, - {19, 0, 4, 0, 5, 0}, - {14, 0, 12, 0, 5, 0}, - {27, 0, 5, 0, 5, 0}, - {26, 0, 11, 0, 5, 0}, - {28, 0, 5, 0, 5, 0}, - {26, 0, 13, 0, 5, 0}, - {26, 0, 5, 0, 5, 0}, - {4, 30, 14, 0, 5, 0}, - {4, 31, 14, 0, 5, 0}, - {4, 32, 14, 0, 5, 0}, - {19, 0, 5, 0, 5, 0}, - {19, 0, 5, 0, 5, 10}, - {18, 0, 5, 0, 5, 0}, - {4, 27, 14, 0, 5, 0}, - {4, 28, 14, 0, 5, 0}, - {4, 29, 14, 0, 5, 0}, - {4, 33, 14, 0, 5, 0}, - {4, 34, 14, 0, 5, 0}, - {4, 230, 14, 0, 5, 80}, - {4, 220, 14, 0, 5, 80}, - {7, 0, 12, 0, 5, 0}, - {26, 0, 12, 0, 5, 0}, - {4, 35, 14, 0, 5, 0}, - {19, 0, 5, 0, 5, 136}, - {7, 0, 9, 0, 5, 0}, - {30, 0, 5, 0, 5, 0}, - {14, 0, 15, 0, 5, 0}, - {4, 36, 14, 0, 5, 0}, - {4, 0, 14, 0, 5, 0}, - {7, 0, 4, 0, 5, 0}, - {18, 0, 4, 0, 5, 0}, - {26, 0, 19, 0, 5, 0}, - {5, 0, 1, 0, 5, 0}, - {19, 0, 1, 0, 5, 10}, - {4, 7, 14, 0, 5, 80}, - {4, 9, 14, 0, 5, 0}, - {19, 0, 1, 0, 5, 170}, - {7, 0, 1, 0, 5, 0}, - {4, 7, 14, 0, 5, 0}, - {5, 0, 1, 0, 5, 80}, - {5, 0, 1, 0, 5, 10}, - {28, 0, 11, 0, 5, 0}, - {9, 0, 1, 0, 5, 0}, - {4, 0, 14, 0, 5, 80}, - {4, 0, 14, 0, 5, 10}, - {4, 84, 14, 0, 5, 0}, - {4, 91, 14, 0, 5, 80}, - {9, 0, 19, 0, 5, 0}, - {4, 0, 1, 0, 5, 0}, - {4, 9, 14, 0, 5, 80}, - {19, 0, 1, 0, 5, 136}, - {4, 103, 14, 0, 5, 0}, - {4, 107, 14, 0, 5, 0}, - {4, 118, 14, 0, 5, 0}, - {4, 122, 14, 0, 5, 0}, - {26, 0, 1, 0, 5, 136}, - {4, 216, 14, 0, 5, 0}, - {22, 0, 19, 1, 5, 0}, - {23, 0, 19, 1, 5, 0}, - {4, 129, 14, 0, 5, 0}, - {4, 130, 14, 0, 5, 0}, - {4, 0, 14, 0, 5, 170}, - {4, 132, 14, 0, 5, 0}, - {4, 0, 14, 0, 5, 136}, - {19, 0, 1, 0, 2, 0}, - {19, 0, 1, 0, 5, 80}, - {10, 0, 18, 0, 5, 0}, - {8, 0, 1, 0, 5, 0}, - {14, 0, 1, 0, 5, 0}, - {5, 9, 1, 0, 5, 0}, - {4, 1, 14, 0, 5, 0}, - {4, 234, 14, 0, 5, 0}, - {4, 214, 14, 0, 5, 0}, - {4, 202, 14, 0, 5, 0}, - {2, 0, 1, 0, 5, 138}, - {2, 0, 1, 0, 5, 170}, - {3, 0, 1, 0, 5, 10}, - {1, 0, 1, 0, 5, 170}, - {29, 0, 19, 0, 5, 170}, - {10, 0, 18, 0, 5, 170}, - {10, 0, 18, 0, 5, 136}, - {14, 0, 4, 0, 5, 0}, - {21, 0, 19, 0, 4, 0}, - {21, 0, 19, 0, 5, 136}, - {26, 0, 19, 0, 5, 136}, - {24, 0, 19, 0, 4, 0}, - {25, 0, 19, 0, 4, 0}, - {22, 0, 19, 0, 5, 0}, - {24, 0, 19, 0, 5, 0}, - {26, 0, 19, 0, 4, 136}, - {11, 0, 18, 0, 5, 0}, - {12, 0, 16, 0, 5, 0}, - {14, 0, 2, 0, 5, 0}, - {14, 0, 6, 0, 5, 0}, - {14, 0, 8, 0, 5, 0}, - {14, 0, 3, 0, 5, 0}, - {14, 0, 7, 0, 5, 0}, - {26, 0, 11, 0, 4, 0}, - {26, 0, 11, 0, 4, 136}, - {26, 0, 11, 0, 5, 136}, - {20, 0, 19, 0, 5, 0}, - {27, 0, 13, 0, 5, 0}, - {9, 0, 9, 0, 5, 136}, - {27, 0, 10, 0, 5, 136}, - {27, 0, 19, 0, 5, 136}, - {22, 0, 19, 1, 5, 136}, - {23, 0, 19, 1, 5, 136}, - {18, 0, 1, 0, 4, 136}, - {28, 0, 11, 0, 5, 136}, - {28, 0, 11, 0, 1, 0}, - {30, 0, 19, 0, 5, 136}, - {30, 0, 19, 0, 4, 136}, - {1, 0, 1, 0, 4, 170}, - {30, 0, 11, 0, 5, 0}, - {27, 0, 19, 1, 5, 136}, - {9, 0, 19, 0, 5, 136}, - {8, 0, 1, 0, 4, 136}, - {8, 0, 1, 0, 5, 136}, - {27, 0, 19, 0, 5, 10}, - {30, 0, 19, 0, 5, 10}, - {27, 0, 19, 1, 5, 0}, - {27, 0, 19, 1, 4, 0}, - {27, 0, 19, 1, 5, 10}, - {27, 0, 10, 0, 5, 0}, - {27, 0, 11, 0, 5, 0}, - {27, 0, 19, 1, 4, 136}, - {27, 0, 19, 1, 4, 10}, - {22, 0, 19, 1, 2, 170}, - {23, 0, 19, 1, 2, 170}, - {30, 0, 1, 0, 4, 136}, - {9, 0, 19, 0, 4, 0}, - {27, 0, 19, 1, 5, 170}, - {30, 0, 19, 0, 2, 0}, - {30, 0, 19, 0, 2, 136}, - {10, 0, 18, 0, 0, 136}, - {26, 0, 19, 0, 2, 0}, - {18, 0, 1, 0, 2, 0}, - {8, 0, 1, 0, 2, 0}, - {22, 0, 19, 1, 2, 0}, - {23, 0, 19, 1, 2, 0}, - {21, 0, 19, 0, 2, 0}, - {22, 0, 19, 0, 2, 0}, - {23, 0, 19, 0, 2, 0}, - {4, 218, 14, 0, 2, 0}, - {4, 228, 14, 0, 2, 0}, - {4, 232, 14, 0, 2, 0}, - {4, 222, 14, 0, 2, 0}, - {4, 224, 14, 0, 2, 0}, - {8, 0, 1, 0, 2, 136}, - {19, 0, 1, 0, 2, 10}, - {4, 8, 14, 0, 2, 80}, - {29, 0, 19, 0, 2, 136}, - {18, 0, 1, 0, 2, 10}, - {19, 0, 1, 0, 2, 136}, - {30, 0, 1, 0, 2, 0}, - {9, 0, 1, 0, 2, 136}, - {30, 0, 1, 0, 2, 136}, - {30, 0, 1, 0, 4, 0}, - {9, 0, 19, 0, 2, 136}, - {29, 0, 1, 0, 5, 0}, - {15, 0, 1, 0, 5, 0}, - {16, 0, 1, 0, 4, 0}, - {19, 0, 1, 0, 2, 170}, - {19, 0, 4, 0, 5, 170}, - {4, 26, 14, 0, 5, 0}, - {19, 0, 4, 0, 5, 136}, - {23, 0, 19, 0, 5, 0}, - {28, 0, 5, 0, 5, 136}, - {26, 0, 19, 0, 2, 136}, - {22, 0, 19, 0, 2, 136}, - {23, 0, 19, 0, 2, 136}, - {21, 0, 19, 0, 2, 136}, - {20, 0, 19, 0, 2, 136}, - {26, 0, 13, 0, 2, 136}, - {22, 0, 19, 1, 2, 136}, - {23, 0, 19, 1, 2, 136}, - {26, 0, 11, 0, 2, 136}, - {27, 0, 10, 0, 2, 136}, - {21, 0, 10, 0, 2, 136}, - {27, 0, 19, 1, 2, 136}, - {27, 0, 19, 0, 2, 136}, - {28, 0, 11, 0, 2, 136}, - {26, 0, 19, 0, 0, 136}, - {26, 0, 11, 0, 0, 136}, - {28, 0, 11, 0, 0, 136}, - {22, 0, 19, 1, 0, 136}, - {23, 0, 19, 1, 0, 136}, - {27, 0, 10, 0, 0, 136}, - {26, 0, 13, 0, 0, 136}, - {21, 0, 10, 0, 0, 136}, - {7, 0, 9, 0, 0, 136}, - {27, 0, 19, 1, 0, 136}, - {27, 0, 19, 0, 0, 136}, - {1, 0, 1, 0, 0, 136}, - {29, 0, 19, 0, 0, 136}, - {20, 0, 19, 0, 0, 136}, - {2, 0, 1, 0, 0, 136}, - {26, 0, 19, 0, 1, 136}, - {22, 0, 19, 1, 1, 136}, - {23, 0, 19, 1, 1, 136}, - {19, 0, 1, 0, 1, 136}, - {18, 0, 1, 0, 1, 136}, - {30, 0, 19, 0, 0, 136}, - {30, 0, 19, 0, 1, 136}, - {27, 0, 19, 0, 1, 136}, - {14, 0, 19, 0, 5, 0}, - {8, 0, 19, 0, 5, 0}, - {9, 0, 4, 0, 5, 0}, - {9, 0, 12, 0, 5, 0}, - {30, 0, 1, 0, 5, 170}, - {5, 216, 1, 0, 5, 0}, - {5, 226, 1, 0, 5, 0}, - {27, 0, 1, 0, 5, 136}, - {7, 0, 9, 0, 5, 136}, - {30, 0, 1, 0, 5, 136}, -}; - -/* Reindexing of NFC first characters. */ -#define TOTAL_FIRST 370 -#define TOTAL_LAST 55 -struct reindex{int start;short count,index;}; -static struct reindex nfc_first[] = { - { 60, 2, 0}, - { 65, 15, 3}, - { 82, 8, 19}, - { 97, 15, 28}, - { 114, 8, 44}, - { 168, 0, 53}, - { 194, 0, 54}, - { 196, 3, 55}, - { 202, 0, 59}, - { 207, 0, 60}, - { 212, 2, 61}, - { 216, 0, 64}, - { 220, 0, 65}, - { 226, 0, 66}, - { 228, 3, 67}, - { 234, 0, 71}, - { 239, 0, 72}, - { 244, 2, 73}, - { 248, 0, 76}, - { 252, 0, 77}, - { 258, 1, 78}, - { 274, 1, 80}, - { 332, 1, 82}, - { 346, 1, 84}, - { 352, 1, 86}, - { 360, 3, 88}, - { 383, 0, 92}, - { 416, 1, 93}, - { 431, 1, 95}, - { 439, 0, 97}, - { 490, 1, 98}, - { 550, 3, 100}, - { 558, 1, 104}, - { 658, 0, 106}, - { 913, 0, 107}, - { 917, 0, 108}, - { 919, 0, 109}, - { 921, 0, 110}, - { 927, 0, 111}, - { 929, 0, 112}, - { 933, 0, 113}, - { 937, 0, 114}, - { 940, 0, 115}, - { 942, 0, 116}, - { 945, 0, 117}, - { 949, 0, 118}, - { 951, 0, 119}, - { 953, 0, 120}, - { 959, 0, 121}, - { 961, 0, 122}, - { 965, 0, 123}, - { 969, 2, 124}, - { 974, 0, 127}, - { 978, 0, 128}, - { 1030, 0, 129}, - { 1040, 0, 130}, - { 1043, 0, 131}, - { 1045, 3, 132}, - { 1050, 0, 136}, - { 1054, 0, 137}, - { 1059, 0, 138}, - { 1063, 0, 139}, - { 1067, 0, 140}, - { 1069, 0, 141}, - { 1072, 0, 142}, - { 1075, 0, 143}, - { 1077, 3, 144}, - { 1082, 0, 148}, - { 1086, 0, 149}, - { 1091, 0, 150}, - { 1095, 0, 151}, - { 1099, 0, 152}, - { 1101, 0, 153}, - { 1110, 0, 154}, - { 1140, 1, 155}, - { 1240, 1, 157}, - { 1256, 1, 159}, - { 1575, 0, 161}, - { 1608, 0, 162}, - { 1610, 0, 163}, - { 1729, 0, 164}, - { 1746, 0, 165}, - { 1749, 0, 166}, - { 2344, 0, 167}, - { 2352, 0, 168}, - { 2355, 0, 169}, - { 2503, 0, 170}, - { 2887, 0, 171}, - { 2962, 0, 172}, - { 3014, 1, 173}, - { 3142, 0, 175}, - { 3263, 0, 176}, - { 3270, 0, 177}, - { 3274, 0, 178}, - { 3398, 1, 179}, - { 3545, 0, 181}, - { 3548, 0, 182}, - { 4133, 0, 183}, - { 6917, 0, 184}, - { 6919, 0, 185}, - { 6921, 0, 186}, - { 6923, 0, 187}, - { 6925, 0, 188}, - { 6929, 0, 189}, - { 6970, 0, 190}, - { 6972, 0, 191}, - { 6974, 1, 192}, - { 6978, 0, 194}, - { 7734, 1, 195}, - { 7770, 1, 197}, - { 7778, 1, 199}, - { 7840, 1, 201}, - { 7864, 1, 203}, - { 7884, 1, 205}, - { 7936, 17, 207}, - { 7960, 1, 225}, - { 7968, 17, 227}, - { 7992, 1, 245}, - { 8000, 1, 247}, - { 8008, 1, 249}, - { 8016, 1, 251}, - { 8025, 0, 253}, - { 8032, 16, 254}, - { 8052, 0, 271}, - { 8060, 0, 272}, - { 8118, 0, 273}, - { 8127, 0, 274}, - { 8134, 0, 275}, - { 8182, 0, 276}, - { 8190, 0, 277}, - { 8592, 0, 278}, - { 8594, 0, 279}, - { 8596, 0, 280}, - { 8656, 0, 281}, - { 8658, 0, 282}, - { 8660, 0, 283}, - { 8707, 0, 284}, - { 8712, 0, 285}, - { 8715, 0, 286}, - { 8739, 0, 287}, - { 8741, 0, 288}, - { 8764, 0, 289}, - { 8771, 0, 290}, - { 8773, 0, 291}, - { 8776, 0, 292}, - { 8781, 0, 293}, - { 8801, 0, 294}, - { 8804, 1, 295}, - { 8818, 1, 297}, - { 8822, 1, 299}, - { 8826, 3, 301}, - { 8834, 1, 305}, - { 8838, 1, 307}, - { 8849, 1, 309}, - { 8866, 0, 311}, - { 8872, 1, 312}, - { 8875, 0, 314}, - { 8882, 3, 315}, - { 12358, 0, 319}, - { 12363, 0, 320}, - { 12365, 0, 321}, - { 12367, 0, 322}, - { 12369, 0, 323}, - { 12371, 0, 324}, - { 12373, 0, 325}, - { 12375, 0, 326}, - { 12377, 0, 327}, - { 12379, 0, 328}, - { 12381, 0, 329}, - { 12383, 0, 330}, - { 12385, 0, 331}, - { 12388, 0, 332}, - { 12390, 0, 333}, - { 12392, 0, 334}, - { 12399, 0, 335}, - { 12402, 0, 336}, - { 12405, 0, 337}, - { 12408, 0, 338}, - { 12411, 0, 339}, - { 12445, 0, 340}, - { 12454, 0, 341}, - { 12459, 0, 342}, - { 12461, 0, 343}, - { 12463, 0, 344}, - { 12465, 0, 345}, - { 12467, 0, 346}, - { 12469, 0, 347}, - { 12471, 0, 348}, - { 12473, 0, 349}, - { 12475, 0, 350}, - { 12477, 0, 351}, - { 12479, 0, 352}, - { 12481, 0, 353}, - { 12484, 0, 354}, - { 12486, 0, 355}, - { 12488, 0, 356}, - { 12495, 0, 357}, - { 12498, 0, 358}, - { 12501, 0, 359}, - { 12504, 0, 360}, - { 12507, 0, 361}, - { 12527, 3, 362}, - { 12541, 0, 366}, - { 69785, 0, 367}, - { 69787, 0, 368}, - { 69797, 0, 369}, - {0,0,0} -}; - -static struct reindex nfc_last[] = { - { 768, 4, 0}, - { 774, 6, 5}, - { 783, 0, 12}, - { 785, 0, 13}, - { 787, 1, 14}, - { 795, 0, 16}, - { 803, 5, 17}, - { 813, 1, 23}, - { 816, 1, 25}, - { 824, 0, 27}, - { 834, 0, 28}, - { 837, 0, 29}, - { 1619, 2, 30}, - { 2364, 0, 33}, - { 2494, 0, 34}, - { 2519, 0, 35}, - { 2878, 0, 36}, - { 2902, 1, 37}, - { 3006, 0, 39}, - { 3031, 0, 40}, - { 3158, 0, 41}, - { 3266, 0, 42}, - { 3285, 1, 43}, - { 3390, 0, 45}, - { 3415, 0, 46}, - { 3530, 0, 47}, - { 3535, 0, 48}, - { 3551, 0, 49}, - { 4142, 0, 50}, - { 6965, 0, 51}, - { 12441, 1, 52}, - { 69818, 0, 54}, - {0,0,0} -}; - -/* string literals */ -const char *_PyUnicode_CategoryNames[] = { - "Cn", - "Lu", - "Ll", - "Lt", - "Mn", - "Mc", - "Me", - "Nd", - "Nl", - "No", - "Zs", - "Zl", - "Zp", - "Cc", - "Cf", - "Cs", - "Co", - "Cn", - "Lm", - "Lo", - "Pc", - "Pd", - "Ps", - "Pe", - "Pi", - "Pf", - "Po", - "Sm", - "Sc", - "Sk", - "So", - NULL -}; -const char *_PyUnicode_BidirectionalNames[] = { - "", - "L", - "LRE", - "LRO", - "R", - "AL", - "RLE", - "RLO", - "PDF", - "EN", - "ES", - "ET", - "AN", - "CS", - "NSM", - "BN", - "B", - "S", - "WS", - "ON", - NULL -}; -const char *_PyUnicode_EastAsianWidthNames[] = { - "F", - "H", - "W", - "Na", - "A", - "N", - NULL -}; -static const char *decomp_prefix[] = { - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - "", - NULL -}; -/* index tables for the database records */ -#define SHIFT 7 -static unsigned char index1[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 41, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, - 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, - 73, 74, 75, 76, 77, 78, 78, 79, 80, 81, 82, 83, 17, 84, 85, 86, 87, 88, - 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 101, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 102, - 103, 100, 100, 100, 100, 100, 100, 100, 100, 104, 41, 41, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 17, 115, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, - 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 118, 118, - 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, 118, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 120, 120, 121, 122, 123, 124, - 125, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 17, 136, 137, - 138, 139, 140, 17, 17, 17, 17, 17, 17, 141, 17, 142, 17, 143, 17, 144, - 17, 145, 17, 17, 17, 146, 17, 17, 17, 17, 147, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 41, 41, 41, 41, 41, 41, 148, 17, 149, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 41, 41, 41, 41, 41, 41, 41, 41, 150, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 78, 151, - 152, 153, 154, 17, 155, 17, 156, 157, 158, 159, 160, 161, 162, 163, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 164, 165, 166, 167, 168, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 169, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, - 100, 100, 100, 100, 100, 100, 100, 100, 170, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 120, 120, 120, - 120, 171, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 172, 17, 173, 174, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 175, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, 119, - 119, 119, 175, -}; - -static unsigned short index2[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 2, 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 3, 2, 5, 6, 6, 7, 8, 7, 6, 6, 9, 10, 6, 11, 12, 13, 12, - 12, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 12, 6, 15, 16, 15, 6, 6, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 9, 6, 10, 18, 19, 18, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, - 20, 20, 9, 16, 10, 16, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 22, 8, 8, 23, 8, 24, - 25, 26, 27, 28, 29, 16, 30, 25, 31, 32, 33, 34, 34, 26, 35, 25, 22, 26, - 34, 28, 36, 37, 37, 37, 22, 38, 38, 38, 38, 38, 38, 39, 38, 38, 38, 38, - 38, 38, 38, 38, 38, 39, 38, 38, 38, 38, 38, 38, 40, 39, 38, 38, 38, 38, - 38, 39, 41, 42, 42, 43, 43, 43, 43, 41, 43, 42, 42, 42, 43, 42, 42, 43, - 43, 41, 43, 42, 42, 43, 43, 43, 40, 41, 42, 42, 43, 42, 43, 41, 43, 38, - 42, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 44, 41, 38, - 42, 38, 43, 38, 43, 38, 43, 38, 42, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 39, 41, 38, 43, 38, 42, 38, 43, 38, 43, 38, 41, 45, 28, 38, 43, 38, - 43, 41, 38, 43, 38, 43, 38, 43, 45, 28, 39, 41, 38, 42, 38, 43, 38, 42, - 28, 39, 41, 38, 42, 38, 43, 38, 43, 39, 41, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 39, 41, 38, 43, 38, 42, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 38, 43, 38, 43, 38, 43, - 35, 46, 44, 44, 46, 44, 46, 44, 44, 46, 44, 44, 44, 46, 46, 44, 44, 44, - 44, 46, 44, 44, 46, 44, 44, 44, 46, 46, 46, 44, 44, 46, 44, 38, 43, 44, - 46, 44, 46, 44, 44, 46, 44, 46, 46, 44, 46, 44, 38, 43, 44, 44, 44, 46, - 44, 46, 44, 44, 46, 46, 47, 44, 46, 46, 46, 47, 47, 47, 47, 48, 49, 35, - 48, 49, 35, 48, 49, 35, 38, 42, 38, 42, 38, 42, 38, 42, 38, 42, 38, 42, - 38, 42, 38, 42, 46, 38, 43, 38, 43, 38, 43, 44, 46, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 43, 48, 49, 35, 38, 43, 44, 44, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 44, 46, 38, 43, 44, - 46, 44, 46, 44, 46, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 46, 46, 46, 46, 46, 46, 44, 44, 46, 44, 44, 46, 46, 44, 46, 44, 44, - 44, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 46, 41, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 41, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 47, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 51, 51, 52, 52, 52, 52, 52, 52, 52, 53, - 53, 54, 53, 51, 55, 51, 55, 55, 55, 51, 55, 51, 51, 56, 52, 53, 53, 53, - 53, 53, 53, 26, 26, 26, 26, 57, 26, 53, 54, 50, 50, 50, 50, 50, 53, 53, - 53, 53, 53, 53, 53, 51, 53, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 58, 58, 58, 58, 58, 59, 58, 58, 58, 58, 58, - 58, 58, 59, 59, 58, 59, 58, 59, 58, 58, 60, 61, 61, 61, 61, 60, 62, 61, - 61, 61, 61, 61, 63, 63, 64, 64, 64, 64, 65, 65, 61, 61, 61, 61, 64, 64, - 61, 64, 64, 61, 61, 66, 66, 66, 66, 67, 61, 61, 61, 61, 59, 59, 59, 68, - 68, 58, 68, 68, 69, 59, 61, 61, 61, 59, 59, 59, 61, 61, 70, 59, 59, 59, - 61, 61, 61, 61, 59, 60, 61, 61, 59, 71, 72, 72, 71, 72, 72, 71, 59, 59, - 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59, 44, 46, 44, 46, 73, 53, 44, - 46, 0, 0, 50, 46, 46, 46, 74, 0, 0, 0, 0, 0, 57, 75, 38, 74, 38, 38, 38, - 0, 38, 0, 38, 38, 43, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 39, 39, 0, 39, 39, 39, 39, 39, 39, 39, 38, 38, 43, 43, 43, 43, - 43, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, - 46, 41, 41, 41, 41, 41, 41, 41, 43, 43, 43, 43, 43, 44, 35, 35, 48, 76, - 76, 35, 35, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 35, 35, 35, 46, 48, 35, 77, 44, - 46, 48, 44, 46, 46, 44, 44, 44, 38, 78, 44, 38, 44, 44, 44, 38, 44, 44, - 44, 44, 38, 38, 38, 44, 39, 39, 39, 39, 39, 39, 39, 39, 39, 78, 39, 39, - 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39, - 39, 39, 41, 41, 41, 41, 41, 41, 41, 41, 41, 42, 41, 41, 41, 41, 41, 41, - 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 43, 42, - 46, 43, 46, 46, 46, 43, 46, 46, 46, 46, 43, 43, 43, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 38, 43, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 79, 80, 80, 80, 80, 80, - 81, 81, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 38, 43, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 46, - 38, 43, 38, 43, 44, 46, 38, 43, 44, 46, 38, 43, 38, 43, 38, 43, 44, 46, - 38, 43, 38, 43, 38, 43, 44, 46, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, - 38, 43, 44, 46, 38, 43, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 0, 0, 52, 82, 82, 82, 82, 82, 82, 0, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 35, - 0, 82, 83, 0, 0, 0, 0, 0, 0, 84, 80, 80, 80, 80, 84, 80, 80, 80, 85, 84, - 80, 80, 80, 80, 80, 80, 84, 84, 84, 84, 84, 84, 80, 80, 84, 80, 80, 85, - 86, 80, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 102, 80, 84, 102, 95, 0, 0, 0, 0, 0, 0, 0, 0, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 0, 0, 0, 0, 0, - 105, 105, 105, 102, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, 106, 106, - 106, 0, 0, 77, 77, 107, 108, 108, 109, 110, 111, 27, 27, 80, 80, 80, 80, - 80, 80, 80, 80, 112, 113, 114, 111, 0, 0, 111, 111, 0, 115, 116, 116, - 116, 116, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 117, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 118, 119, 120, - 112, 113, 114, 121, 122, 123, 123, 124, 84, 80, 80, 80, 80, 80, 84, 80, - 80, 0, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 108, 126, 126, - 111, 115, 115, 127, 115, 115, 115, 115, 128, 128, 128, 128, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 116, - 115, 116, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 116, 111, 115, 80, 80, 80, 80, 80, 80, 80, 106, 81, - 80, 80, 80, 80, 84, 80, 117, 117, 80, 80, 27, 84, 80, 80, 84, 115, 115, - 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 115, 115, 115, 130, - 130, 115, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 0, 131, 115, 132, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 80, 84, 80, 80, 84, 80, 80, 84, 84, - 84, 80, 84, 84, 80, 84, 80, 80, 80, 84, 80, 84, 80, 84, 80, 84, 80, 80, - 0, 0, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, 115, - 115, 115, 115, 115, 115, 115, 133, 133, 133, 133, 133, 133, 133, 133, - 133, 133, 133, 115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 134, 134, - 134, 134, 134, 134, 134, 134, 134, 134, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 80, 80, - 80, 80, 80, 80, 80, 84, 80, 135, 135, 27, 136, 136, 136, 135, 0, 0, 0, 0, - 0, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 80, 80, 80, 80, 135, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 135, 80, 80, 80, 135, 80, 80, 80, 80, 80, 0, 0, - 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 133, 133, 133, 137, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 138, 47, 47, 47, 47, 47, 47, 47, 138, 47, 47, - 138, 47, 47, 47, 47, 47, 0, 0, 139, 47, 137, 137, 137, 133, 133, 133, - 133, 133, 133, 133, 133, 137, 137, 137, 137, 140, 137, 0, 47, 80, 84, 80, - 80, 133, 0, 0, 141, 141, 141, 141, 141, 141, 141, 141, 47, 47, 133, 133, - 82, 82, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 82, 52, 47, 0, - 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 0, 133, 137, 137, 0, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, - 47, 47, 47, 47, 47, 0, 47, 0, 0, 0, 47, 47, 47, 47, 0, 0, 143, 47, 144, - 137, 137, 133, 133, 133, 133, 0, 0, 137, 137, 0, 0, 145, 145, 140, 47, 0, - 0, 0, 0, 0, 0, 0, 0, 144, 0, 0, 0, 0, 141, 141, 0, 141, 47, 47, 133, 133, - 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 47, 47, 146, 146, - 147, 147, 147, 147, 147, 147, 79, 146, 0, 0, 0, 0, 0, 133, 133, 137, 0, - 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 47, 47, 47, 47, 47, 47, 0, 47, 141, 0, 47, 141, 0, 47, 47, 0, 0, 143, 0, - 137, 137, 137, 133, 133, 0, 0, 0, 0, 133, 133, 0, 0, 133, 133, 140, 0, 0, - 0, 133, 0, 0, 0, 0, 0, 0, 0, 141, 141, 141, 47, 0, 141, 0, 0, 0, 0, 0, 0, - 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 133, 133, 47, 47, - 47, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 133, 137, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 47, 47, 47, 47, 0, 47, 47, 0, 47, 47, 47, 47, 47, 0, 0, 143, 47, 137, - 137, 137, 133, 133, 133, 133, 133, 0, 133, 133, 137, 0, 137, 137, 140, 0, - 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 133, 133, 0, - 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 146, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 137, 137, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, - 47, 47, 0, 47, 47, 0, 47, 47, 47, 47, 47, 0, 0, 143, 47, 144, 133, 137, - 133, 133, 133, 133, 0, 0, 137, 145, 0, 0, 145, 145, 140, 0, 0, 0, 0, 0, - 0, 0, 0, 148, 144, 0, 0, 0, 0, 141, 141, 0, 47, 47, 47, 133, 133, 0, 0, - 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 79, 47, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 47, 0, 47, 47, 47, 47, 47, 47, 0, - 0, 0, 47, 47, 47, 0, 47, 47, 138, 47, 0, 0, 0, 47, 47, 0, 47, 0, 47, 47, - 0, 0, 0, 47, 47, 0, 0, 0, 47, 47, 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 144, 137, 133, 137, 137, 0, 0, 0, - 137, 137, 137, 0, 145, 145, 145, 140, 0, 0, 47, 0, 0, 0, 0, 0, 0, 144, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 142, 147, 147, 147, 27, 27, 27, 27, 27, 27, 146, 27, 0, 0, 0, - 0, 0, 0, 137, 137, 137, 0, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 47, 47, 47, 47, 0, 0, 0, 47, 133, 133, 133, 137, 137, 137, 137, 0, 133, - 133, 149, 0, 133, 133, 133, 140, 0, 0, 0, 0, 0, 0, 0, 150, 151, 0, 47, - 47, 0, 0, 0, 0, 0, 0, 47, 47, 133, 133, 0, 0, 142, 142, 142, 142, 142, - 142, 142, 142, 142, 142, 0, 0, 0, 0, 0, 0, 0, 0, 152, 152, 152, 152, 152, - 152, 152, 79, 0, 0, 137, 137, 0, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 47, 47, 47, 47, 47, 0, 0, 143, 47, 137, 153, 145, 137, 144, 137, - 137, 0, 153, 145, 145, 0, 145, 145, 133, 140, 0, 0, 0, 0, 0, 0, 0, 144, - 144, 0, 0, 0, 0, 0, 0, 0, 47, 0, 47, 47, 133, 133, 0, 0, 142, 142, 142, - 142, 142, 142, 142, 142, 142, 142, 0, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 137, 137, 0, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, - 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 0, 47, 144, 137, 137, 133, 133, 133, 133, - 0, 137, 137, 137, 0, 145, 145, 145, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 144, - 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 133, 133, 0, 0, 142, 142, 142, 142, 142, - 142, 142, 142, 142, 142, 147, 147, 147, 147, 147, 147, 0, 0, 0, 79, 47, - 47, 47, 47, 47, 47, 0, 0, 137, 137, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 0, 0, 0, 154, 0, 0, 0, 0, 144, 137, 137, 133, 133, 133, 0, 133, - 0, 137, 137, 145, 137, 145, 145, 145, 144, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 137, 137, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 133, 47, 155, 133, 133, - 133, 133, 156, 156, 140, 0, 0, 0, 0, 146, 47, 47, 47, 47, 47, 47, 52, - 133, 157, 157, 157, 157, 133, 133, 133, 82, 142, 142, 142, 142, 142, 142, - 142, 142, 142, 142, 82, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, - 0, 47, 0, 0, 47, 47, 0, 47, 0, 0, 47, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, - 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 0, 47, 0, 47, 0, 0, 47, 47, - 0, 47, 47, 47, 47, 133, 47, 155, 133, 133, 133, 133, 158, 158, 0, 133, - 133, 47, 0, 0, 47, 47, 47, 47, 47, 0, 52, 0, 159, 159, 159, 159, 133, - 133, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 0, 155, - 155, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 79, 79, 79, 82, 82, 82, 82, 82, 82, - 82, 82, 160, 82, 82, 82, 82, 82, 82, 79, 79, 79, 79, 79, 84, 84, 79, 79, - 79, 79, 79, 79, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 79, 84, 79, 84, 79, 161, - 162, 163, 162, 163, 137, 137, 47, 47, 47, 141, 47, 47, 47, 47, 0, 47, 47, - 47, 47, 141, 47, 47, 47, 47, 141, 47, 47, 47, 47, 141, 47, 47, 47, 47, - 141, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 141, 47, 47, 47, 0, - 0, 0, 0, 164, 165, 166, 167, 166, 166, 168, 166, 168, 165, 165, 165, 165, - 133, 137, 165, 166, 80, 80, 140, 82, 80, 80, 47, 47, 47, 47, 0, 0, 0, 0, - 133, 133, 133, 166, 133, 133, 133, 133, 0, 133, 133, 133, 133, 166, 133, - 133, 133, 133, 166, 133, 133, 133, 133, 166, 133, 133, 133, 133, 166, - 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 166, 133, - 133, 133, 0, 79, 79, 79, 79, 79, 79, 79, 79, 84, 79, 79, 79, 79, 79, 79, - 0, 79, 79, 82, 82, 82, 82, 82, 79, 79, 79, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 138, 47, 47, 47, 47, 137, 137, 133, 148, 133, - 133, 137, 133, 133, 133, 133, 133, 143, 137, 140, 140, 137, 137, 133, - 133, 47, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 82, 82, 82, - 82, 82, 82, 47, 47, 47, 47, 47, 47, 137, 137, 133, 133, 47, 47, 47, 47, - 133, 133, 133, 47, 137, 137, 137, 47, 47, 137, 137, 137, 137, 137, 137, - 137, 47, 47, 47, 133, 133, 133, 133, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 133, 137, 137, 133, 133, 137, 137, 137, 137, 137, 137, - 84, 47, 137, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 137, 137, - 137, 133, 79, 79, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 82, 50, 0, 0, 0, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 47, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, 170, - 170, 170, 170, 170, 170, 170, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 169, 169, 169, 169, 169, 169, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 0, 47, 47, 47, 47, - 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 0, 47, 0, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 0, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 80, - 79, 82, 82, 82, 82, 82, 82, 82, 82, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 0, 0, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 82, 82, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 171, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 163, 0, 0, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 82, 82, 82, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 47, 133, 133, 140, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 133, 133, 140, 82, - 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 133, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 0, 133, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 173, 173, 137, 133, 133, 133, - 133, 133, 133, 133, 137, 137, 137, 137, 137, 137, 137, 137, 133, 137, - 137, 133, 133, 133, 133, 133, 133, 133, 133, 133, 140, 133, 82, 82, 82, - 52, 82, 82, 82, 146, 47, 80, 0, 0, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 142, 0, 0, 0, 0, 0, 0, 152, 152, 152, 152, 152, 152, 152, 152, - 152, 152, 0, 0, 0, 0, 0, 0, 136, 136, 136, 136, 136, 136, 83, 136, 136, - 136, 136, 133, 133, 133, 171, 0, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 52, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 86, 47, - 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 0, 0, 133, 133, 133, 137, 137, 137, 137, 133, 133, 137, 137, - 137, 0, 0, 0, 0, 137, 137, 133, 137, 137, 137, 137, 137, 137, 85, 80, 84, - 0, 0, 0, 0, 27, 0, 0, 0, 136, 136, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 142, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 47, - 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 0, 0, 0, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 47, 47, 47, 47, 47, 47, 47, 137, 137, - 0, 0, 0, 0, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, - 0, 0, 0, 136, 136, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 80, 84, 137, 137, 137, 0, 0, 82, 82, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 137, 133, 137, - 133, 133, 133, 133, 133, 133, 133, 0, 140, 137, 133, 137, 137, 133, 133, - 133, 133, 133, 133, 133, 133, 137, 137, 137, 137, 137, 137, 133, 133, 80, - 80, 80, 80, 80, 80, 80, 80, 0, 0, 84, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 142, 0, 0, 0, 0, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 0, 0, 0, 0, 0, 0, 82, 82, 82, 82, 82, 82, 82, 52, 82, 82, 82, - 82, 82, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 133, 133, 133, 133, 137, 47, - 138, 47, 138, 47, 138, 47, 138, 47, 138, 47, 47, 47, 138, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 143, 144, 133, 133, 133, 133, - 133, 145, 133, 145, 137, 137, 145, 145, 133, 145, 174, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, - 82, 82, 82, 82, 82, 82, 82, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, - 84, 80, 80, 80, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 0, 0, - 0, 133, 133, 137, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 137, 133, - 133, 133, 133, 137, 137, 133, 133, 174, 0, 0, 0, 47, 47, 142, 142, 142, - 142, 142, 142, 142, 142, 142, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 137, 137, 137, 137, 137, 137, 137, 137, 133, - 133, 133, 133, 133, 133, 133, 133, 137, 137, 133, 143, 0, 0, 0, 82, 82, - 82, 82, 82, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 0, 0, - 47, 47, 47, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 52, 52, 52, 52, 52, 52, 82, 82, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 80, 80, 80, 82, 175, 84, 84, 84, 84, 84, 80, 80, 84, - 84, 84, 84, 80, 137, 175, 175, 175, 175, 175, 175, 175, 47, 47, 47, 47, - 84, 47, 47, 47, 47, 137, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 50, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 52, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 35, 35, 35, 35, 35, 35, 35, 35, 35, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 50, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 80, 80, 84, 80, 80, 80, 80, 80, - 80, 80, 84, 80, 80, 176, 177, 84, 178, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 84, 80, 84, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 43, 43, 43, 43, 35, 179, 46, 46, 44, 46, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, - 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 38, 43, 44, 46, 44, 46, 44, - 46, 43, 43, 43, 43, 43, 43, 43, 43, 38, 38, 38, 38, 38, 38, 38, 38, 43, - 43, 43, 43, 43, 43, 0, 0, 38, 38, 38, 38, 38, 38, 0, 0, 43, 43, 43, 43, - 43, 43, 43, 43, 38, 38, 38, 38, 38, 38, 38, 38, 43, 43, 43, 43, 43, 43, - 43, 43, 38, 38, 38, 38, 38, 38, 38, 38, 43, 43, 43, 43, 43, 43, 0, 0, 38, - 38, 38, 38, 38, 38, 0, 0, 43, 43, 43, 43, 43, 43, 43, 43, 0, 38, 0, 38, - 0, 38, 0, 38, 43, 43, 43, 43, 43, 43, 43, 43, 38, 38, 38, 38, 38, 38, 38, - 38, 43, 180, 43, 180, 43, 180, 43, 180, 43, 180, 43, 180, 43, 180, 0, 0, - 43, 43, 43, 43, 43, 43, 43, 43, 181, 181, 181, 181, 181, 181, 181, 181, - 43, 43, 43, 43, 43, 43, 43, 43, 181, 181, 181, 181, 181, 181, 181, 181, - 43, 43, 43, 43, 43, 43, 43, 43, 181, 181, 181, 181, 181, 181, 181, 181, - 43, 43, 43, 43, 43, 0, 43, 43, 38, 38, 38, 182, 181, 57, 180, 57, 57, 75, - 43, 43, 43, 0, 43, 43, 38, 182, 38, 182, 181, 75, 75, 75, 43, 43, 43, - 180, 0, 0, 43, 43, 38, 38, 38, 182, 0, 75, 75, 75, 43, 43, 43, 180, 43, - 43, 43, 43, 38, 38, 38, 182, 38, 75, 183, 183, 0, 0, 43, 43, 43, 0, 43, - 43, 38, 182, 38, 182, 181, 183, 57, 0, 184, 184, 185, 185, 185, 185, 185, - 185, 185, 185, 185, 131, 131, 131, 173, 186, 187, 188, 83, 187, 187, 187, - 22, 189, 190, 191, 192, 193, 190, 191, 192, 193, 22, 22, 22, 136, 194, - 194, 194, 22, 195, 196, 197, 198, 199, 200, 201, 21, 202, 108, 202, 203, - 204, 22, 189, 189, 136, 29, 36, 22, 189, 136, 194, 205, 205, 136, 136, - 136, 206, 162, 163, 189, 189, 189, 136, 136, 136, 136, 136, 136, 136, - 136, 77, 136, 205, 136, 136, 189, 136, 136, 136, 136, 136, 136, 136, 185, - 131, 131, 131, 131, 131, 0, 0, 0, 0, 0, 131, 131, 131, 131, 131, 131, - 207, 50, 0, 0, 34, 207, 207, 207, 207, 207, 208, 208, 209, 210, 211, 212, - 207, 34, 34, 34, 34, 207, 207, 207, 207, 207, 208, 208, 209, 210, 211, 0, - 50, 50, 50, 50, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 146, 146, 146, 146, - 146, 146, 146, 146, 213, 214, 146, 146, 23, 146, 146, 146, 146, 146, 146, - 146, 146, 146, 146, 146, 146, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 80, 80, 175, 175, 80, 80, 80, 80, 175, 175, - 175, 80, 80, 81, 81, 81, 81, 80, 81, 81, 81, 175, 175, 80, 84, 80, 175, - 175, 84, 84, 84, 84, 80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 215, 215, 48, 216, 27, 216, 215, 48, 27, 216, 35, 48, 48, 48, 35, 35, 48, - 48, 48, 28, 27, 48, 216, 27, 27, 48, 48, 48, 48, 48, 27, 27, 215, 216, - 216, 27, 48, 27, 217, 27, 48, 27, 182, 217, 48, 48, 218, 35, 48, 48, 44, - 48, 35, 155, 155, 155, 155, 35, 27, 215, 35, 35, 48, 48, 219, 77, 77, 77, - 77, 48, 35, 35, 35, 35, 27, 77, 27, 27, 46, 79, 220, 220, 220, 37, 37, - 220, 220, 220, 220, 220, 220, 37, 37, 37, 37, 220, 221, 221, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 222, 222, 222, 222, 221, 221, - 221, 221, 221, 221, 221, 221, 221, 221, 222, 222, 222, 222, 222, 222, - 172, 172, 172, 44, 46, 172, 172, 172, 172, 37, 0, 0, 0, 0, 0, 0, 40, 40, - 40, 40, 40, 25, 25, 25, 25, 25, 223, 223, 27, 27, 27, 27, 77, 27, 27, 77, - 27, 27, 77, 27, 27, 27, 27, 27, 27, 27, 223, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 224, 223, 223, 27, 27, 40, 27, 40, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 40, 225, 226, 226, 227, 77, 77, 40, 226, 227, 225, 226, 227, - 225, 77, 40, 77, 226, 228, 229, 77, 226, 225, 77, 77, 77, 226, 225, 225, - 226, 40, 226, 226, 225, 225, 40, 227, 40, 227, 40, 40, 40, 40, 226, 230, - 219, 226, 219, 219, 225, 225, 225, 40, 40, 40, 40, 77, 225, 77, 225, 226, - 226, 225, 225, 225, 227, 225, 225, 227, 225, 225, 227, 226, 227, 225, - 225, 226, 77, 77, 77, 77, 77, 226, 225, 225, 225, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 225, 231, 40, 227, 77, 226, 226, 226, 226, 225, 225, 226, - 226, 77, 223, 231, 231, 227, 227, 225, 225, 227, 227, 225, 225, 227, 227, - 225, 225, 225, 225, 225, 225, 227, 227, 226, 226, 227, 227, 226, 226, - 227, 227, 225, 225, 225, 77, 77, 225, 225, 225, 225, 77, 77, 40, 77, 77, - 225, 40, 77, 77, 77, 77, 77, 77, 77, 77, 225, 225, 77, 40, 225, 225, 225, - 225, 225, 225, 227, 227, 227, 227, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 77, 77, 77, 77, 77, 225, 226, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 225, 225, 225, 225, 225, 77, 77, 225, 225, 77, 77, 77, 77, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 227, 227, 227, 227, 225, 225, - 225, 225, 225, 225, 227, 227, 227, 227, 77, 77, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 27, 27, 27, 27, - 27, 27, 27, 27, 225, 225, 225, 225, 27, 27, 27, 27, 27, 27, 25, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 225, 225, 27, 27, 27, 27, 27, - 27, 27, 232, 233, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 27, 77, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 79, 27, 27, 27, 27, 27, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 77, 77, 77, 77, 77, 77, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 220, 235, 235, 235, 235, 235, 235, 235, 235, 235, - 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 235, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 27, 27, 27, 27, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 27, 27, 25, - 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 27, 25, 25, - 25, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 27, 27, 25, - 40, 27, 27, 27, 27, 25, 25, 27, 27, 25, 40, 27, 27, 27, 27, 25, 25, 25, - 27, 27, 25, 27, 27, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 25, 25, 25, 25, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 25, 27, 27, 27, 27, 27, 27, 27, 27, 77, 77, 77, 77, 77, 77, 77, - 77, 27, 27, 27, 27, 27, 25, 25, 27, 27, 25, 27, 27, 27, 27, 25, 25, 27, - 27, 27, 27, 25, 25, 27, 27, 27, 27, 27, 27, 25, 27, 25, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 27, 25, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 25, 25, 27, 25, 25, 25, 27, 25, 25, 25, 25, - 27, 25, 25, 27, 40, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 79, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 25, 27, 27, 27, 27, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 0, 25, 0, 0, 0, 0, 25, 25, - 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, - 25, 25, 25, 25, 0, 27, 27, 27, 27, 0, 27, 27, 27, 27, 0, 0, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 0, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 25, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 0, 27, 0, 27, 27, 27, 27, 0, 0, 0, 27, 25, - 27, 27, 27, 27, 27, 27, 27, 0, 0, 27, 27, 27, 27, 27, 27, 27, 162, 163, - 162, 163, 162, 163, 162, 163, 162, 163, 162, 163, 162, 163, 235, 235, - 235, 235, 235, 235, 235, 235, 235, 235, 152, 152, 152, 152, 152, 152, - 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 152, 27, - 0, 0, 0, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 0, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 0, 225, 77, 77, 225, 225, 162, 163, 77, 225, 225, 77, - 0, 225, 0, 0, 0, 77, 77, 77, 225, 225, 225, 225, 77, 77, 77, 77, 77, 225, - 225, 225, 77, 77, 77, 225, 225, 225, 225, 9, 10, 9, 10, 9, 10, 9, 10, - 162, 163, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 162, 163, 9, 10, 162, 163, 162, 163, 162, - 163, 162, 163, 162, 163, 162, 163, 162, 163, 162, 163, 162, 163, 77, 77, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 77, 77, 77, 77, 77, 77, 77, 77, 225, - 77, 77, 77, 77, 77, 77, 77, 225, 225, 225, 225, 225, 225, 77, 77, 77, - 225, 77, 77, 77, 77, 225, 225, 225, 225, 225, 77, 225, 225, 77, 77, 162, - 163, 162, 163, 225, 77, 77, 77, 77, 225, 77, 225, 225, 225, 77, 77, 225, - 225, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 225, 225, 225, 225, 225, - 225, 77, 77, 162, 163, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 225, 225, 219, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 77, 225, 225, 225, 225, 77, 77, 225, 77, 225, - 77, 77, 225, 77, 225, 225, 225, 225, 77, 77, 77, 77, 77, 225, 225, 77, - 77, 77, 77, 77, 77, 225, 225, 225, 77, 77, 77, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 225, 225, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 225, 225, 77, 77, 77, 77, 225, - 225, 225, 225, 77, 225, 225, 77, 77, 225, 219, 209, 209, 77, 77, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 77, - 77, 225, 225, 225, 225, 225, 225, 225, 225, 77, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, - 225, 225, 225, 225, 225, 225, 225, 77, 77, 77, 77, 77, 236, 77, 225, 77, - 77, 77, 225, 225, 225, 225, 225, 77, 77, 77, 77, 77, 225, 225, 225, 77, - 77, 77, 77, 225, 77, 77, 77, 225, 225, 225, 225, 225, 77, 225, 77, 77, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 77, 77, 77, 77, 77, 77, - 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, 27, 27, 77, - 77, 77, 77, 77, 77, 0, 0, 0, 27, 27, 27, 27, 27, 25, 25, 25, 25, 25, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 0, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 0, 44, 46, - 44, 44, 44, 46, 46, 44, 46, 44, 46, 44, 46, 44, 44, 44, 44, 46, 44, 46, - 46, 44, 46, 46, 46, 46, 46, 46, 35, 50, 44, 44, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 46, 27, 27, 27, 27, 27, 27, 44, 46, 44, 46, 80, 80, 80, - 0, 0, 0, 0, 0, 0, 0, 136, 136, 136, 136, 152, 136, 136, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, - 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, - 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, - 47, 47, 47, 47, 47, 47, 47, 0, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 136, 136, 29, 36, 29, 36, 136, 136, 136, 29, 36, 136, 29, - 36, 136, 136, 136, 136, 136, 136, 136, 136, 136, 83, 136, 136, 83, 136, - 29, 36, 136, 136, 29, 36, 162, 163, 162, 163, 162, 163, 162, 163, 136, - 136, 136, 136, 136, 51, 136, 136, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 0, 237, 237, 237, 237, 238, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 238, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, - 238, 238, 238, 238, 238, 238, 238, 238, 238, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 0, 0, 0, 0, 239, 240, 240, 240, - 237, 241, 169, 242, 243, 244, 243, 244, 243, 244, 243, 244, 243, 244, - 237, 237, 243, 244, 243, 244, 243, 244, 243, 244, 245, 246, 247, 247, - 237, 242, 242, 242, 242, 242, 242, 242, 242, 242, 248, 249, 250, 251, - 252, 252, 245, 241, 241, 241, 241, 241, 238, 237, 253, 253, 253, 241, - 169, 240, 237, 27, 0, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 254, 169, 254, 169, 254, 169, 254, 169, 254, 169, 254, 169, 254, - 169, 254, 169, 254, 169, 254, 169, 254, 169, 254, 169, 169, 254, 169, - 254, 169, 254, 169, 169, 169, 169, 169, 169, 254, 254, 169, 254, 254, - 169, 254, 254, 169, 254, 254, 169, 254, 254, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 254, 169, 169, 0, 0, 255, 255, 256, 256, 241, 257, 258, - 245, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 254, 169, - 254, 169, 254, 169, 254, 169, 254, 169, 254, 169, 254, 169, 254, 169, - 254, 169, 254, 169, 254, 169, 254, 169, 169, 254, 169, 254, 169, 254, - 169, 169, 169, 169, 169, 169, 254, 254, 169, 254, 254, 169, 254, 254, - 169, 254, 254, 169, 254, 254, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 254, 169, 169, 254, 254, 254, 254, 240, 241, 241, 257, 258, 0, 0, 0, 0, - 0, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 0, 0, 0, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, - 258, 258, 258, 258, 258, 258, 258, 258, 258, 258, 0, 259, 259, 260, 260, - 260, 260, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 0, 0, 0, 0, 0, 0, 0, 0, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 238, 238, 0, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 262, 262, 262, 262, 262, 262, 262, 262, 238, 263, 263, 263, - 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 238, 238, - 238, 259, 260, 260, 260, 260, 260, 260, 260, 260, 260, 260, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 263, 263, 263, 263, 263, - 263, 263, 263, 263, 263, 263, 263, 263, 263, 263, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 238, 238, 238, 238, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 0, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 238, 238, 238, 238, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 238, 238, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 238, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 241, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 0, 0, 0, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, 237, - 237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 52, 52, 52, 52, 52, 52, - 82, 82, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 52, 136, 136, - 136, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 142, - 142, 142, 142, 142, 142, 142, 142, 142, 142, 47, 47, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 0, 0, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, - 46, 47, 80, 81, 81, 81, 136, 0, 0, 0, 0, 0, 0, 0, 0, 80, 80, 136, 51, 44, - 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, - 46, 44, 46, 44, 46, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 80, 80, 82, 82, 82, 82, 82, 82, 0, 0, 0, 0, 0, 0, 0, 0, - 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 51, 51, 51, 51, 51, 51, 51, 51, 51, 53, 53, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 46, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, - 44, 46, 44, 46, 50, 46, 46, 46, 46, 46, 46, 46, 46, 44, 46, 44, 46, 44, - 44, 46, 44, 46, 44, 46, 44, 46, 44, 46, 51, 264, 264, 44, 46, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 133, 47, 47, - 47, 140, 47, 47, 47, 47, 133, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 137, 137, 133, 133, 137, - 27, 27, 27, 27, 0, 0, 0, 0, 147, 147, 147, 147, 147, 147, 79, 79, 146, - 218, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 136, 136, 136, 136, 0, 0, 0, 0, 0, 0, 0, 0, 137, 137, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 137, 137, 137, 137, - 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 137, 140, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 82, 82, 142, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 0, 0, 0, 0, 0, 0, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, - 80, 80, 80, 80, 80, 80, 47, 47, 47, 47, 47, 47, 82, 82, 82, 47, 0, 0, 0, - 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 133, 133, 133, 133, 133, 84, 84, 84, 82, 82, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 133, 137, - 174, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 0, 0, 0, 133, 133, 133, 137, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 143, 137, 137, 133, 133, 133, - 133, 137, 137, 133, 137, 137, 137, 174, 82, 82, 82, 82, 82, 82, 82, 82, - 82, 82, 82, 82, 82, 0, 52, 142, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 0, 0, 0, 0, 82, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 133, - 133, 133, 133, 133, 133, 137, 137, 133, 133, 137, 137, 133, 133, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 47, 47, 133, 47, 47, 47, 47, 47, 47, 47, 47, 133, - 137, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, 142, 142, 0, 0, 82, - 82, 82, 82, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 52, 47, 47, 47, 47, 47, 47, 79, 79, 79, 47, 137, 0, 0, 0, 0, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 80, 47, 80, 80, 84, 47, 47, 80, - 80, 47, 47, 47, 47, 47, 80, 80, 47, 80, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 52, 82, 82, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 137, 137, 133, - 137, 137, 133, 137, 137, 82, 137, 140, 0, 0, 142, 142, 142, 142, 142, - 142, 142, 142, 142, 142, 0, 0, 0, 0, 0, 0, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, 254, - 254, 254, 254, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 0, 0, 0, 0, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 0, 0, 0, 0, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, 265, - 265, 265, 265, 265, 265, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 169, 169, 267, 169, 267, - 169, 169, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 169, 267, - 169, 267, 169, 169, 267, 267, 169, 169, 169, 267, 267, 267, 267, 0, 0, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 0, 0, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 35, 35, 35, 35, 35, 35, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 35, 35, 35, 35, 35, 0, 0, 0, 0, 0, - 268, 269, 268, 270, 270, 270, 270, 270, 270, 270, 270, 270, 208, 268, - 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, 268, 0, 268, 268, - 268, 268, 268, 0, 268, 0, 268, 268, 0, 268, 268, 0, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 270, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 192, 271, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 272, 27, 0, 0, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 273, 273, 273, 273, 273, 273, 273, 274, 275, - 273, 0, 0, 0, 0, 0, 0, 80, 80, 80, 80, 80, 80, 80, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 273, 276, 276, 277, 277, 274, 275, 274, 275, 274, 275, 274, 275, - 274, 275, 274, 275, 274, 275, 274, 275, 240, 240, 274, 275, 273, 273, - 273, 273, 277, 277, 277, 278, 273, 278, 0, 273, 278, 273, 273, 276, 279, - 280, 279, 280, 279, 280, 281, 273, 273, 282, 283, 284, 284, 285, 0, 273, - 286, 281, 273, 0, 0, 0, 0, 128, 128, 128, 115, 128, 0, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, - 128, 128, 128, 128, 128, 128, 0, 0, 131, 0, 287, 287, 288, 289, 288, 287, - 287, 290, 291, 287, 292, 293, 294, 293, 293, 295, 295, 295, 295, 295, - 295, 295, 295, 295, 295, 293, 287, 296, 297, 296, 287, 287, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, - 298, 298, 298, 298, 298, 298, 298, 298, 298, 298, 290, 287, 291, 299, - 300, 299, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, - 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, 301, - 290, 297, 291, 297, 290, 291, 302, 303, 304, 302, 302, 305, 305, 305, - 305, 305, 305, 305, 305, 305, 305, 306, 305, 305, 305, 305, 305, 305, - 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, - 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, - 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 306, 306, 305, - 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, - 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, - 305, 305, 0, 0, 0, 305, 305, 305, 305, 305, 305, 0, 0, 305, 305, 305, - 305, 305, 305, 0, 0, 305, 305, 305, 305, 305, 305, 0, 0, 305, 305, 305, - 0, 0, 0, 289, 289, 297, 299, 307, 289, 289, 0, 308, 309, 309, 309, 309, - 308, 308, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 310, 310, 310, 27, 25, 0, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 82, 136, 79, 0, 0, 0, 0, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 0, 0, 0, 79, 79, 79, 79, 79, 79, 79, 79, 79, 311, 311, 311, 311, - 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, 311, - 311, 311, 311, 311, 311, 311, 311, 152, 152, 152, 152, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 152, 0, 0, 0, 0, 0, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 84, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 147, 147, 147, 147, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 172, 47, 47, 47, 47, 47, 47, 47, 47, 172, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 82, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 82, 172, 172, 172, 172, 172, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 0, 142, 142, 142, 142, 142, 142, 142, 142, - 142, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, - 105, 105, 0, 0, 105, 0, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 0, 105, 105, 0, 0, 0, 105, 0, 0, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 0, 102, 312, 312, 312, 312, 312, 312, - 312, 312, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 312, 312, 312, 312, 312, 312, 0, 0, 0, 136, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 0, 0, 0, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 105, 133, 133, 133, 0, 133, 133, 0, 0, 0, 0, 0, - 133, 84, 133, 80, 105, 105, 105, 105, 0, 105, 105, 105, 0, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 0, 0, 0, 0, 80, 175, - 84, 0, 0, 0, 0, 140, 312, 312, 312, 312, 312, 312, 312, 312, 0, 0, 0, 0, - 0, 0, 0, 0, 102, 102, 102, 102, 102, 102, 102, 102, 102, 0, 0, 0, 0, 0, - 0, 0, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 312, 312, 102, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 0, 0, 0, 136, 136, 136, 136, 136, 136, 136, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 0, 0, 312, 312, 312, 312, 312, 312, 312, 312, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 0, 0, 0, 0, 0, 312, 312, 312, 312, 312, 312, - 312, 312, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, 105, - 105, 105, 105, 105, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, - 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 313, 0, 133, 133, - 137, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 138, 47, 138, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 138, 47, 47, 47, 47, 137, 137, 137, 133, 133, 133, - 133, 137, 137, 140, 139, 82, 82, 173, 82, 82, 82, 82, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, 172, - 172, 172, 172, 172, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 82, 82, 82, - 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 0, 0, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 314, 314, 314, 314, 314, - 314, 314, 315, 315, 175, 175, 175, 79, 79, 79, 316, 315, 315, 315, 315, - 315, 131, 131, 131, 131, 131, 131, 131, 131, 84, 84, 84, 84, 84, 84, 84, - 84, 79, 79, 80, 80, 80, 80, 80, 84, 84, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 80, 80, 80, 80, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 314, 314, 314, 314, 314, 314, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, - 79, 79, 79, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 80, 80, 80, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 35, 35, 35, 35, 35, 35, 35, 0, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 48, 0, 48, 48, 0, 0, 48, 0, 0, 48, - 48, 0, 0, 48, 48, 48, 48, 0, 48, 48, 48, 48, 48, 48, 48, 48, 35, 35, 35, - 35, 0, 35, 0, 35, 35, 35, 35, 35, 35, 35, 0, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 48, 48, 0, 48, 48, 48, 48, 0, 0, 48, 48, 48, 48, 48, 48, 48, 48, - 0, 48, 48, 48, 48, 48, 48, 48, 0, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 48, 48, - 0, 48, 48, 48, 48, 0, 48, 48, 48, 48, 48, 0, 48, 0, 0, 0, 48, 48, 48, 48, - 48, 48, 48, 0, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 0, 0, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 317, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 219, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 317, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 219, 35, 35, 35, 35, 35, 35, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 317, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 219, 35, 35, 35, 35, 35, 35, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 317, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 219, 35, 35, 35, 35, 35, - 35, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 317, 35, 35, 35, 35, 35, 35, 35, 35, 35, - 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 219, 35, - 35, 35, 35, 35, 35, 48, 35, 0, 0, 318, 318, 318, 318, 318, 318, 318, 318, - 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, - 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, - 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 318, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 0, 0, 0, 0, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, - 27, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 0, 0, 0, 0, 0, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, 234, - 234, 234, 234, 234, 234, 234, 234, 319, 0, 0, 234, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 234, 0, 234, 0, 0, 234, 0, 0, 0, 234, 0, 0, 0, 234, 234, 234, - 234, 234, 0, 0, 0, 0, 0, 0, 0, 0, 262, 0, 0, 0, 0, 0, 0, 0, 262, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, 0, - 262, 262, 0, 0, 262, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, 262, 262, 262, 0, - 0, 234, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 261, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, - 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 261, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 261, 261, 261, 261, 261, 261, 261, 261, 261, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, - 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, - 267, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 131, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, - 131, 131, 131, 131, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, 266, - 266, 266, 266, 0, 0, -}; - -/* decomposition data */ -static unsigned int decomp_data[] = { - 0, 257, 32, 514, 32, 776, 259, 97, 514, 32, 772, 259, 50, 259, 51, 514, - 32, 769, 258, 956, 514, 32, 807, 259, 49, 259, 111, 772, 49, 8260, 52, - 772, 49, 8260, 50, 772, 51, 8260, 52, 512, 65, 768, 512, 65, 769, 512, - 65, 770, 512, 65, 771, 512, 65, 776, 512, 65, 778, 512, 67, 807, 512, 69, - 768, 512, 69, 769, 512, 69, 770, 512, 69, 776, 512, 73, 768, 512, 73, - 769, 512, 73, 770, 512, 73, 776, 512, 78, 771, 512, 79, 768, 512, 79, - 769, 512, 79, 770, 512, 79, 771, 512, 79, 776, 512, 85, 768, 512, 85, - 769, 512, 85, 770, 512, 85, 776, 512, 89, 769, 512, 97, 768, 512, 97, - 769, 512, 97, 770, 512, 97, 771, 512, 97, 776, 512, 97, 778, 512, 99, - 807, 512, 101, 768, 512, 101, 769, 512, 101, 770, 512, 101, 776, 512, - 105, 768, 512, 105, 769, 512, 105, 770, 512, 105, 776, 512, 110, 771, - 512, 111, 768, 512, 111, 769, 512, 111, 770, 512, 111, 771, 512, 111, - 776, 512, 117, 768, 512, 117, 769, 512, 117, 770, 512, 117, 776, 512, - 121, 769, 512, 121, 776, 512, 65, 772, 512, 97, 772, 512, 65, 774, 512, - 97, 774, 512, 65, 808, 512, 97, 808, 512, 67, 769, 512, 99, 769, 512, 67, - 770, 512, 99, 770, 512, 67, 775, 512, 99, 775, 512, 67, 780, 512, 99, - 780, 512, 68, 780, 512, 100, 780, 512, 69, 772, 512, 101, 772, 512, 69, - 774, 512, 101, 774, 512, 69, 775, 512, 101, 775, 512, 69, 808, 512, 101, - 808, 512, 69, 780, 512, 101, 780, 512, 71, 770, 512, 103, 770, 512, 71, - 774, 512, 103, 774, 512, 71, 775, 512, 103, 775, 512, 71, 807, 512, 103, - 807, 512, 72, 770, 512, 104, 770, 512, 73, 771, 512, 105, 771, 512, 73, - 772, 512, 105, 772, 512, 73, 774, 512, 105, 774, 512, 73, 808, 512, 105, - 808, 512, 73, 775, 514, 73, 74, 514, 105, 106, 512, 74, 770, 512, 106, - 770, 512, 75, 807, 512, 107, 807, 512, 76, 769, 512, 108, 769, 512, 76, - 807, 512, 108, 807, 512, 76, 780, 512, 108, 780, 514, 76, 183, 514, 108, - 183, 512, 78, 769, 512, 110, 769, 512, 78, 807, 512, 110, 807, 512, 78, - 780, 512, 110, 780, 514, 700, 110, 512, 79, 772, 512, 111, 772, 512, 79, - 774, 512, 111, 774, 512, 79, 779, 512, 111, 779, 512, 82, 769, 512, 114, - 769, 512, 82, 807, 512, 114, 807, 512, 82, 780, 512, 114, 780, 512, 83, - 769, 512, 115, 769, 512, 83, 770, 512, 115, 770, 512, 83, 807, 512, 115, - 807, 512, 83, 780, 512, 115, 780, 512, 84, 807, 512, 116, 807, 512, 84, - 780, 512, 116, 780, 512, 85, 771, 512, 117, 771, 512, 85, 772, 512, 117, - 772, 512, 85, 774, 512, 117, 774, 512, 85, 778, 512, 117, 778, 512, 85, - 779, 512, 117, 779, 512, 85, 808, 512, 117, 808, 512, 87, 770, 512, 119, - 770, 512, 89, 770, 512, 121, 770, 512, 89, 776, 512, 90, 769, 512, 122, - 769, 512, 90, 775, 512, 122, 775, 512, 90, 780, 512, 122, 780, 258, 115, - 512, 79, 795, 512, 111, 795, 512, 85, 795, 512, 117, 795, 514, 68, 381, - 514, 68, 382, 514, 100, 382, 514, 76, 74, 514, 76, 106, 514, 108, 106, - 514, 78, 74, 514, 78, 106, 514, 110, 106, 512, 65, 780, 512, 97, 780, - 512, 73, 780, 512, 105, 780, 512, 79, 780, 512, 111, 780, 512, 85, 780, - 512, 117, 780, 512, 220, 772, 512, 252, 772, 512, 220, 769, 512, 252, - 769, 512, 220, 780, 512, 252, 780, 512, 220, 768, 512, 252, 768, 512, - 196, 772, 512, 228, 772, 512, 550, 772, 512, 551, 772, 512, 198, 772, - 512, 230, 772, 512, 71, 780, 512, 103, 780, 512, 75, 780, 512, 107, 780, - 512, 79, 808, 512, 111, 808, 512, 490, 772, 512, 491, 772, 512, 439, 780, - 512, 658, 780, 512, 106, 780, 514, 68, 90, 514, 68, 122, 514, 100, 122, - 512, 71, 769, 512, 103, 769, 512, 78, 768, 512, 110, 768, 512, 197, 769, - 512, 229, 769, 512, 198, 769, 512, 230, 769, 512, 216, 769, 512, 248, - 769, 512, 65, 783, 512, 97, 783, 512, 65, 785, 512, 97, 785, 512, 69, - 783, 512, 101, 783, 512, 69, 785, 512, 101, 785, 512, 73, 783, 512, 105, - 783, 512, 73, 785, 512, 105, 785, 512, 79, 783, 512, 111, 783, 512, 79, - 785, 512, 111, 785, 512, 82, 783, 512, 114, 783, 512, 82, 785, 512, 114, - 785, 512, 85, 783, 512, 117, 783, 512, 85, 785, 512, 117, 785, 512, 83, - 806, 512, 115, 806, 512, 84, 806, 512, 116, 806, 512, 72, 780, 512, 104, - 780, 512, 65, 775, 512, 97, 775, 512, 69, 807, 512, 101, 807, 512, 214, - 772, 512, 246, 772, 512, 213, 772, 512, 245, 772, 512, 79, 775, 512, 111, - 775, 512, 558, 772, 512, 559, 772, 512, 89, 772, 512, 121, 772, 259, 104, - 259, 614, 259, 106, 259, 114, 259, 633, 259, 635, 259, 641, 259, 119, - 259, 121, 514, 32, 774, 514, 32, 775, 514, 32, 778, 514, 32, 808, 514, - 32, 771, 514, 32, 779, 259, 611, 259, 108, 259, 115, 259, 120, 259, 661, - 256, 768, 256, 769, 256, 787, 512, 776, 769, 256, 697, 514, 32, 837, 256, - 59, 514, 32, 769, 512, 168, 769, 512, 913, 769, 256, 183, 512, 917, 769, - 512, 919, 769, 512, 921, 769, 512, 927, 769, 512, 933, 769, 512, 937, - 769, 512, 970, 769, 512, 921, 776, 512, 933, 776, 512, 945, 769, 512, - 949, 769, 512, 951, 769, 512, 953, 769, 512, 971, 769, 512, 953, 776, - 512, 965, 776, 512, 959, 769, 512, 965, 769, 512, 969, 769, 258, 946, - 258, 952, 258, 933, 512, 978, 769, 512, 978, 776, 258, 966, 258, 960, - 258, 954, 258, 961, 258, 962, 258, 920, 258, 949, 258, 931, 512, 1045, - 768, 512, 1045, 776, 512, 1043, 769, 512, 1030, 776, 512, 1050, 769, 512, - 1048, 768, 512, 1059, 774, 512, 1048, 774, 512, 1080, 774, 512, 1077, - 768, 512, 1077, 776, 512, 1075, 769, 512, 1110, 776, 512, 1082, 769, 512, - 1080, 768, 512, 1091, 774, 512, 1140, 783, 512, 1141, 783, 512, 1046, - 774, 512, 1078, 774, 512, 1040, 774, 512, 1072, 774, 512, 1040, 776, 512, - 1072, 776, 512, 1045, 774, 512, 1077, 774, 512, 1240, 776, 512, 1241, - 776, 512, 1046, 776, 512, 1078, 776, 512, 1047, 776, 512, 1079, 776, 512, - 1048, 772, 512, 1080, 772, 512, 1048, 776, 512, 1080, 776, 512, 1054, - 776, 512, 1086, 776, 512, 1256, 776, 512, 1257, 776, 512, 1069, 776, 512, - 1101, 776, 512, 1059, 772, 512, 1091, 772, 512, 1059, 776, 512, 1091, - 776, 512, 1059, 779, 512, 1091, 779, 512, 1063, 776, 512, 1095, 776, 512, - 1067, 776, 512, 1099, 776, 514, 1381, 1410, 512, 1575, 1619, 512, 1575, - 1620, 512, 1608, 1620, 512, 1575, 1621, 512, 1610, 1620, 514, 1575, 1652, - 514, 1608, 1652, 514, 1735, 1652, 514, 1610, 1652, 512, 1749, 1620, 512, - 1729, 1620, 512, 1746, 1620, 512, 2344, 2364, 512, 2352, 2364, 512, 2355, - 2364, 512, 2325, 2364, 512, 2326, 2364, 512, 2327, 2364, 512, 2332, 2364, - 512, 2337, 2364, 512, 2338, 2364, 512, 2347, 2364, 512, 2351, 2364, 512, - 2503, 2494, 512, 2503, 2519, 512, 2465, 2492, 512, 2466, 2492, 512, 2479, - 2492, 512, 2610, 2620, 512, 2616, 2620, 512, 2582, 2620, 512, 2583, 2620, - 512, 2588, 2620, 512, 2603, 2620, 512, 2887, 2902, 512, 2887, 2878, 512, - 2887, 2903, 512, 2849, 2876, 512, 2850, 2876, 512, 2962, 3031, 512, 3014, - 3006, 512, 3015, 3006, 512, 3014, 3031, 512, 3142, 3158, 512, 3263, 3285, - 512, 3270, 3285, 512, 3270, 3286, 512, 3270, 3266, 512, 3274, 3285, 512, - 3398, 3390, 512, 3399, 3390, 512, 3398, 3415, 512, 3545, 3530, 512, 3545, - 3535, 512, 3548, 3530, 512, 3545, 3551, 514, 3661, 3634, 514, 3789, 3762, - 514, 3755, 3737, 514, 3755, 3745, 257, 3851, 512, 3906, 4023, 512, 3916, - 4023, 512, 3921, 4023, 512, 3926, 4023, 512, 3931, 4023, 512, 3904, 4021, - 512, 3953, 3954, 512, 3953, 3956, 512, 4018, 3968, 514, 4018, 3969, 512, - 4019, 3968, 514, 4019, 3969, 512, 3953, 3968, 512, 3986, 4023, 512, 3996, - 4023, 512, 4001, 4023, 512, 4006, 4023, 512, 4011, 4023, 512, 3984, 4021, - 512, 4133, 4142, 259, 4316, 512, 6917, 6965, 512, 6919, 6965, 512, 6921, - 6965, 512, 6923, 6965, 512, 6925, 6965, 512, 6929, 6965, 512, 6970, 6965, - 512, 6972, 6965, 512, 6974, 6965, 512, 6975, 6965, 512, 6978, 6965, 259, - 65, 259, 198, 259, 66, 259, 68, 259, 69, 259, 398, 259, 71, 259, 72, 259, - 73, 259, 74, 259, 75, 259, 76, 259, 77, 259, 78, 259, 79, 259, 546, 259, - 80, 259, 82, 259, 84, 259, 85, 259, 87, 259, 97, 259, 592, 259, 593, 259, - 7426, 259, 98, 259, 100, 259, 101, 259, 601, 259, 603, 259, 604, 259, - 103, 259, 107, 259, 109, 259, 331, 259, 111, 259, 596, 259, 7446, 259, - 7447, 259, 112, 259, 116, 259, 117, 259, 7453, 259, 623, 259, 118, 259, - 7461, 259, 946, 259, 947, 259, 948, 259, 966, 259, 967, 261, 105, 261, - 114, 261, 117, 261, 118, 261, 946, 261, 947, 261, 961, 261, 966, 261, - 967, 259, 1085, 259, 594, 259, 99, 259, 597, 259, 240, 259, 604, 259, - 102, 259, 607, 259, 609, 259, 613, 259, 616, 259, 617, 259, 618, 259, - 7547, 259, 669, 259, 621, 259, 7557, 259, 671, 259, 625, 259, 624, 259, - 626, 259, 627, 259, 628, 259, 629, 259, 632, 259, 642, 259, 643, 259, - 427, 259, 649, 259, 650, 259, 7452, 259, 651, 259, 652, 259, 122, 259, - 656, 259, 657, 259, 658, 259, 952, 512, 65, 805, 512, 97, 805, 512, 66, - 775, 512, 98, 775, 512, 66, 803, 512, 98, 803, 512, 66, 817, 512, 98, - 817, 512, 199, 769, 512, 231, 769, 512, 68, 775, 512, 100, 775, 512, 68, - 803, 512, 100, 803, 512, 68, 817, 512, 100, 817, 512, 68, 807, 512, 100, - 807, 512, 68, 813, 512, 100, 813, 512, 274, 768, 512, 275, 768, 512, 274, - 769, 512, 275, 769, 512, 69, 813, 512, 101, 813, 512, 69, 816, 512, 101, - 816, 512, 552, 774, 512, 553, 774, 512, 70, 775, 512, 102, 775, 512, 71, - 772, 512, 103, 772, 512, 72, 775, 512, 104, 775, 512, 72, 803, 512, 104, - 803, 512, 72, 776, 512, 104, 776, 512, 72, 807, 512, 104, 807, 512, 72, - 814, 512, 104, 814, 512, 73, 816, 512, 105, 816, 512, 207, 769, 512, 239, - 769, 512, 75, 769, 512, 107, 769, 512, 75, 803, 512, 107, 803, 512, 75, - 817, 512, 107, 817, 512, 76, 803, 512, 108, 803, 512, 7734, 772, 512, - 7735, 772, 512, 76, 817, 512, 108, 817, 512, 76, 813, 512, 108, 813, 512, - 77, 769, 512, 109, 769, 512, 77, 775, 512, 109, 775, 512, 77, 803, 512, - 109, 803, 512, 78, 775, 512, 110, 775, 512, 78, 803, 512, 110, 803, 512, - 78, 817, 512, 110, 817, 512, 78, 813, 512, 110, 813, 512, 213, 769, 512, - 245, 769, 512, 213, 776, 512, 245, 776, 512, 332, 768, 512, 333, 768, - 512, 332, 769, 512, 333, 769, 512, 80, 769, 512, 112, 769, 512, 80, 775, - 512, 112, 775, 512, 82, 775, 512, 114, 775, 512, 82, 803, 512, 114, 803, - 512, 7770, 772, 512, 7771, 772, 512, 82, 817, 512, 114, 817, 512, 83, - 775, 512, 115, 775, 512, 83, 803, 512, 115, 803, 512, 346, 775, 512, 347, - 775, 512, 352, 775, 512, 353, 775, 512, 7778, 775, 512, 7779, 775, 512, - 84, 775, 512, 116, 775, 512, 84, 803, 512, 116, 803, 512, 84, 817, 512, - 116, 817, 512, 84, 813, 512, 116, 813, 512, 85, 804, 512, 117, 804, 512, - 85, 816, 512, 117, 816, 512, 85, 813, 512, 117, 813, 512, 360, 769, 512, - 361, 769, 512, 362, 776, 512, 363, 776, 512, 86, 771, 512, 118, 771, 512, - 86, 803, 512, 118, 803, 512, 87, 768, 512, 119, 768, 512, 87, 769, 512, - 119, 769, 512, 87, 776, 512, 119, 776, 512, 87, 775, 512, 119, 775, 512, - 87, 803, 512, 119, 803, 512, 88, 775, 512, 120, 775, 512, 88, 776, 512, - 120, 776, 512, 89, 775, 512, 121, 775, 512, 90, 770, 512, 122, 770, 512, - 90, 803, 512, 122, 803, 512, 90, 817, 512, 122, 817, 512, 104, 817, 512, - 116, 776, 512, 119, 778, 512, 121, 778, 514, 97, 702, 512, 383, 775, 512, - 65, 803, 512, 97, 803, 512, 65, 777, 512, 97, 777, 512, 194, 769, 512, - 226, 769, 512, 194, 768, 512, 226, 768, 512, 194, 777, 512, 226, 777, - 512, 194, 771, 512, 226, 771, 512, 7840, 770, 512, 7841, 770, 512, 258, - 769, 512, 259, 769, 512, 258, 768, 512, 259, 768, 512, 258, 777, 512, - 259, 777, 512, 258, 771, 512, 259, 771, 512, 7840, 774, 512, 7841, 774, - 512, 69, 803, 512, 101, 803, 512, 69, 777, 512, 101, 777, 512, 69, 771, - 512, 101, 771, 512, 202, 769, 512, 234, 769, 512, 202, 768, 512, 234, - 768, 512, 202, 777, 512, 234, 777, 512, 202, 771, 512, 234, 771, 512, - 7864, 770, 512, 7865, 770, 512, 73, 777, 512, 105, 777, 512, 73, 803, - 512, 105, 803, 512, 79, 803, 512, 111, 803, 512, 79, 777, 512, 111, 777, - 512, 212, 769, 512, 244, 769, 512, 212, 768, 512, 244, 768, 512, 212, - 777, 512, 244, 777, 512, 212, 771, 512, 244, 771, 512, 7884, 770, 512, - 7885, 770, 512, 416, 769, 512, 417, 769, 512, 416, 768, 512, 417, 768, - 512, 416, 777, 512, 417, 777, 512, 416, 771, 512, 417, 771, 512, 416, - 803, 512, 417, 803, 512, 85, 803, 512, 117, 803, 512, 85, 777, 512, 117, - 777, 512, 431, 769, 512, 432, 769, 512, 431, 768, 512, 432, 768, 512, - 431, 777, 512, 432, 777, 512, 431, 771, 512, 432, 771, 512, 431, 803, - 512, 432, 803, 512, 89, 768, 512, 121, 768, 512, 89, 803, 512, 121, 803, - 512, 89, 777, 512, 121, 777, 512, 89, 771, 512, 121, 771, 512, 945, 787, - 512, 945, 788, 512, 7936, 768, 512, 7937, 768, 512, 7936, 769, 512, 7937, - 769, 512, 7936, 834, 512, 7937, 834, 512, 913, 787, 512, 913, 788, 512, - 7944, 768, 512, 7945, 768, 512, 7944, 769, 512, 7945, 769, 512, 7944, - 834, 512, 7945, 834, 512, 949, 787, 512, 949, 788, 512, 7952, 768, 512, - 7953, 768, 512, 7952, 769, 512, 7953, 769, 512, 917, 787, 512, 917, 788, - 512, 7960, 768, 512, 7961, 768, 512, 7960, 769, 512, 7961, 769, 512, 951, - 787, 512, 951, 788, 512, 7968, 768, 512, 7969, 768, 512, 7968, 769, 512, - 7969, 769, 512, 7968, 834, 512, 7969, 834, 512, 919, 787, 512, 919, 788, - 512, 7976, 768, 512, 7977, 768, 512, 7976, 769, 512, 7977, 769, 512, - 7976, 834, 512, 7977, 834, 512, 953, 787, 512, 953, 788, 512, 7984, 768, - 512, 7985, 768, 512, 7984, 769, 512, 7985, 769, 512, 7984, 834, 512, - 7985, 834, 512, 921, 787, 512, 921, 788, 512, 7992, 768, 512, 7993, 768, - 512, 7992, 769, 512, 7993, 769, 512, 7992, 834, 512, 7993, 834, 512, 959, - 787, 512, 959, 788, 512, 8000, 768, 512, 8001, 768, 512, 8000, 769, 512, - 8001, 769, 512, 927, 787, 512, 927, 788, 512, 8008, 768, 512, 8009, 768, - 512, 8008, 769, 512, 8009, 769, 512, 965, 787, 512, 965, 788, 512, 8016, - 768, 512, 8017, 768, 512, 8016, 769, 512, 8017, 769, 512, 8016, 834, 512, - 8017, 834, 512, 933, 788, 512, 8025, 768, 512, 8025, 769, 512, 8025, 834, - 512, 969, 787, 512, 969, 788, 512, 8032, 768, 512, 8033, 768, 512, 8032, - 769, 512, 8033, 769, 512, 8032, 834, 512, 8033, 834, 512, 937, 787, 512, - 937, 788, 512, 8040, 768, 512, 8041, 768, 512, 8040, 769, 512, 8041, 769, - 512, 8040, 834, 512, 8041, 834, 512, 945, 768, 256, 940, 512, 949, 768, - 256, 941, 512, 951, 768, 256, 942, 512, 953, 768, 256, 943, 512, 959, - 768, 256, 972, 512, 965, 768, 256, 973, 512, 969, 768, 256, 974, 512, - 7936, 837, 512, 7937, 837, 512, 7938, 837, 512, 7939, 837, 512, 7940, - 837, 512, 7941, 837, 512, 7942, 837, 512, 7943, 837, 512, 7944, 837, 512, - 7945, 837, 512, 7946, 837, 512, 7947, 837, 512, 7948, 837, 512, 7949, - 837, 512, 7950, 837, 512, 7951, 837, 512, 7968, 837, 512, 7969, 837, 512, - 7970, 837, 512, 7971, 837, 512, 7972, 837, 512, 7973, 837, 512, 7974, - 837, 512, 7975, 837, 512, 7976, 837, 512, 7977, 837, 512, 7978, 837, 512, - 7979, 837, 512, 7980, 837, 512, 7981, 837, 512, 7982, 837, 512, 7983, - 837, 512, 8032, 837, 512, 8033, 837, 512, 8034, 837, 512, 8035, 837, 512, - 8036, 837, 512, 8037, 837, 512, 8038, 837, 512, 8039, 837, 512, 8040, - 837, 512, 8041, 837, 512, 8042, 837, 512, 8043, 837, 512, 8044, 837, 512, - 8045, 837, 512, 8046, 837, 512, 8047, 837, 512, 945, 774, 512, 945, 772, - 512, 8048, 837, 512, 945, 837, 512, 940, 837, 512, 945, 834, 512, 8118, - 837, 512, 913, 774, 512, 913, 772, 512, 913, 768, 256, 902, 512, 913, - 837, 514, 32, 787, 256, 953, 514, 32, 787, 514, 32, 834, 512, 168, 834, - 512, 8052, 837, 512, 951, 837, 512, 942, 837, 512, 951, 834, 512, 8134, - 837, 512, 917, 768, 256, 904, 512, 919, 768, 256, 905, 512, 919, 837, - 512, 8127, 768, 512, 8127, 769, 512, 8127, 834, 512, 953, 774, 512, 953, - 772, 512, 970, 768, 256, 912, 512, 953, 834, 512, 970, 834, 512, 921, - 774, 512, 921, 772, 512, 921, 768, 256, 906, 512, 8190, 768, 512, 8190, - 769, 512, 8190, 834, 512, 965, 774, 512, 965, 772, 512, 971, 768, 256, - 944, 512, 961, 787, 512, 961, 788, 512, 965, 834, 512, 971, 834, 512, - 933, 774, 512, 933, 772, 512, 933, 768, 256, 910, 512, 929, 788, 512, - 168, 768, 256, 901, 256, 96, 512, 8060, 837, 512, 969, 837, 512, 974, - 837, 512, 969, 834, 512, 8182, 837, 512, 927, 768, 256, 908, 512, 937, - 768, 256, 911, 512, 937, 837, 256, 180, 514, 32, 788, 256, 8194, 256, - 8195, 258, 32, 258, 32, 258, 32, 258, 32, 258, 32, 257, 32, 258, 32, 258, - 32, 258, 32, 257, 8208, 514, 32, 819, 258, 46, 514, 46, 46, 770, 46, 46, - 46, 257, 32, 514, 8242, 8242, 770, 8242, 8242, 8242, 514, 8245, 8245, - 770, 8245, 8245, 8245, 514, 33, 33, 514, 32, 773, 514, 63, 63, 514, 63, - 33, 514, 33, 63, 1026, 8242, 8242, 8242, 8242, 258, 32, 259, 48, 259, - 105, 259, 52, 259, 53, 259, 54, 259, 55, 259, 56, 259, 57, 259, 43, 259, - 8722, 259, 61, 259, 40, 259, 41, 259, 110, 261, 48, 261, 49, 261, 50, - 261, 51, 261, 52, 261, 53, 261, 54, 261, 55, 261, 56, 261, 57, 261, 43, - 261, 8722, 261, 61, 261, 40, 261, 41, 261, 97, 261, 101, 261, 111, 261, - 120, 261, 601, 514, 82, 115, 770, 97, 47, 99, 770, 97, 47, 115, 262, 67, - 514, 176, 67, 770, 99, 47, 111, 770, 99, 47, 117, 258, 400, 514, 176, 70, - 262, 103, 262, 72, 262, 72, 262, 72, 262, 104, 262, 295, 262, 73, 262, - 73, 262, 76, 262, 108, 262, 78, 514, 78, 111, 262, 80, 262, 81, 262, 82, - 262, 82, 262, 82, 515, 83, 77, 770, 84, 69, 76, 515, 84, 77, 262, 90, - 256, 937, 262, 90, 256, 75, 256, 197, 262, 66, 262, 67, 262, 101, 262, - 69, 262, 70, 262, 77, 262, 111, 258, 1488, 258, 1489, 258, 1490, 258, - 1491, 262, 105, 770, 70, 65, 88, 262, 960, 262, 947, 262, 915, 262, 928, - 262, 8721, 262, 68, 262, 100, 262, 101, 262, 105, 262, 106, 772, 49, - 8260, 55, 772, 49, 8260, 57, 1028, 49, 8260, 49, 48, 772, 49, 8260, 51, - 772, 50, 8260, 51, 772, 49, 8260, 53, 772, 50, 8260, 53, 772, 51, 8260, - 53, 772, 52, 8260, 53, 772, 49, 8260, 54, 772, 53, 8260, 54, 772, 49, - 8260, 56, 772, 51, 8260, 56, 772, 53, 8260, 56, 772, 55, 8260, 56, 516, - 49, 8260, 258, 73, 514, 73, 73, 770, 73, 73, 73, 514, 73, 86, 258, 86, - 514, 86, 73, 770, 86, 73, 73, 1026, 86, 73, 73, 73, 514, 73, 88, 258, 88, - 514, 88, 73, 770, 88, 73, 73, 258, 76, 258, 67, 258, 68, 258, 77, 258, - 105, 514, 105, 105, 770, 105, 105, 105, 514, 105, 118, 258, 118, 514, - 118, 105, 770, 118, 105, 105, 1026, 118, 105, 105, 105, 514, 105, 120, - 258, 120, 514, 120, 105, 770, 120, 105, 105, 258, 108, 258, 99, 258, 100, - 258, 109, 772, 48, 8260, 51, 512, 8592, 824, 512, 8594, 824, 512, 8596, - 824, 512, 8656, 824, 512, 8660, 824, 512, 8658, 824, 512, 8707, 824, 512, - 8712, 824, 512, 8715, 824, 512, 8739, 824, 512, 8741, 824, 514, 8747, - 8747, 770, 8747, 8747, 8747, 514, 8750, 8750, 770, 8750, 8750, 8750, 512, - 8764, 824, 512, 8771, 824, 512, 8773, 824, 512, 8776, 824, 512, 61, 824, - 512, 8801, 824, 512, 8781, 824, 512, 60, 824, 512, 62, 824, 512, 8804, - 824, 512, 8805, 824, 512, 8818, 824, 512, 8819, 824, 512, 8822, 824, 512, - 8823, 824, 512, 8826, 824, 512, 8827, 824, 512, 8834, 824, 512, 8835, - 824, 512, 8838, 824, 512, 8839, 824, 512, 8866, 824, 512, 8872, 824, 512, - 8873, 824, 512, 8875, 824, 512, 8828, 824, 512, 8829, 824, 512, 8849, - 824, 512, 8850, 824, 512, 8882, 824, 512, 8883, 824, 512, 8884, 824, 512, - 8885, 824, 256, 12296, 256, 12297, 263, 49, 263, 50, 263, 51, 263, 52, - 263, 53, 263, 54, 263, 55, 263, 56, 263, 57, 519, 49, 48, 519, 49, 49, - 519, 49, 50, 519, 49, 51, 519, 49, 52, 519, 49, 53, 519, 49, 54, 519, 49, - 55, 519, 49, 56, 519, 49, 57, 519, 50, 48, 770, 40, 49, 41, 770, 40, 50, - 41, 770, 40, 51, 41, 770, 40, 52, 41, 770, 40, 53, 41, 770, 40, 54, 41, - 770, 40, 55, 41, 770, 40, 56, 41, 770, 40, 57, 41, 1026, 40, 49, 48, 41, - 1026, 40, 49, 49, 41, 1026, 40, 49, 50, 41, 1026, 40, 49, 51, 41, 1026, - 40, 49, 52, 41, 1026, 40, 49, 53, 41, 1026, 40, 49, 54, 41, 1026, 40, 49, - 55, 41, 1026, 40, 49, 56, 41, 1026, 40, 49, 57, 41, 1026, 40, 50, 48, 41, - 514, 49, 46, 514, 50, 46, 514, 51, 46, 514, 52, 46, 514, 53, 46, 514, 54, - 46, 514, 55, 46, 514, 56, 46, 514, 57, 46, 770, 49, 48, 46, 770, 49, 49, - 46, 770, 49, 50, 46, 770, 49, 51, 46, 770, 49, 52, 46, 770, 49, 53, 46, - 770, 49, 54, 46, 770, 49, 55, 46, 770, 49, 56, 46, 770, 49, 57, 46, 770, - 50, 48, 46, 770, 40, 97, 41, 770, 40, 98, 41, 770, 40, 99, 41, 770, 40, - 100, 41, 770, 40, 101, 41, 770, 40, 102, 41, 770, 40, 103, 41, 770, 40, - 104, 41, 770, 40, 105, 41, 770, 40, 106, 41, 770, 40, 107, 41, 770, 40, - 108, 41, 770, 40, 109, 41, 770, 40, 110, 41, 770, 40, 111, 41, 770, 40, - 112, 41, 770, 40, 113, 41, 770, 40, 114, 41, 770, 40, 115, 41, 770, 40, - 116, 41, 770, 40, 117, 41, 770, 40, 118, 41, 770, 40, 119, 41, 770, 40, - 120, 41, 770, 40, 121, 41, 770, 40, 122, 41, 263, 65, 263, 66, 263, 67, - 263, 68, 263, 69, 263, 70, 263, 71, 263, 72, 263, 73, 263, 74, 263, 75, - 263, 76, 263, 77, 263, 78, 263, 79, 263, 80, 263, 81, 263, 82, 263, 83, - 263, 84, 263, 85, 263, 86, 263, 87, 263, 88, 263, 89, 263, 90, 263, 97, - 263, 98, 263, 99, 263, 100, 263, 101, 263, 102, 263, 103, 263, 104, 263, - 105, 263, 106, 263, 107, 263, 108, 263, 109, 263, 110, 263, 111, 263, - 112, 263, 113, 263, 114, 263, 115, 263, 116, 263, 117, 263, 118, 263, - 119, 263, 120, 263, 121, 263, 122, 263, 48, 1026, 8747, 8747, 8747, 8747, - 770, 58, 58, 61, 514, 61, 61, 770, 61, 61, 61, 512, 10973, 824, 261, 106, - 259, 86, 259, 11617, 258, 27597, 258, 40863, 258, 19968, 258, 20008, 258, - 20022, 258, 20031, 258, 20057, 258, 20101, 258, 20108, 258, 20128, 258, - 20154, 258, 20799, 258, 20837, 258, 20843, 258, 20866, 258, 20886, 258, - 20907, 258, 20960, 258, 20981, 258, 20992, 258, 21147, 258, 21241, 258, - 21269, 258, 21274, 258, 21304, 258, 21313, 258, 21340, 258, 21353, 258, - 21378, 258, 21430, 258, 21448, 258, 21475, 258, 22231, 258, 22303, 258, - 22763, 258, 22786, 258, 22794, 258, 22805, 258, 22823, 258, 22899, 258, - 23376, 258, 23424, 258, 23544, 258, 23567, 258, 23586, 258, 23608, 258, - 23662, 258, 23665, 258, 24027, 258, 24037, 258, 24049, 258, 24062, 258, - 24178, 258, 24186, 258, 24191, 258, 24308, 258, 24318, 258, 24331, 258, - 24339, 258, 24400, 258, 24417, 258, 24435, 258, 24515, 258, 25096, 258, - 25142, 258, 25163, 258, 25903, 258, 25908, 258, 25991, 258, 26007, 258, - 26020, 258, 26041, 258, 26080, 258, 26085, 258, 26352, 258, 26376, 258, - 26408, 258, 27424, 258, 27490, 258, 27513, 258, 27571, 258, 27595, 258, - 27604, 258, 27611, 258, 27663, 258, 27668, 258, 27700, 258, 28779, 258, - 29226, 258, 29238, 258, 29243, 258, 29247, 258, 29255, 258, 29273, 258, - 29275, 258, 29356, 258, 29572, 258, 29577, 258, 29916, 258, 29926, 258, - 29976, 258, 29983, 258, 29992, 258, 30000, 258, 30091, 258, 30098, 258, - 30326, 258, 30333, 258, 30382, 258, 30399, 258, 30446, 258, 30683, 258, - 30690, 258, 30707, 258, 31034, 258, 31160, 258, 31166, 258, 31348, 258, - 31435, 258, 31481, 258, 31859, 258, 31992, 258, 32566, 258, 32593, 258, - 32650, 258, 32701, 258, 32769, 258, 32780, 258, 32786, 258, 32819, 258, - 32895, 258, 32905, 258, 33251, 258, 33258, 258, 33267, 258, 33276, 258, - 33292, 258, 33307, 258, 33311, 258, 33390, 258, 33394, 258, 33400, 258, - 34381, 258, 34411, 258, 34880, 258, 34892, 258, 34915, 258, 35198, 258, - 35211, 258, 35282, 258, 35328, 258, 35895, 258, 35910, 258, 35925, 258, - 35960, 258, 35997, 258, 36196, 258, 36208, 258, 36275, 258, 36523, 258, - 36554, 258, 36763, 258, 36784, 258, 36789, 258, 37009, 258, 37193, 258, - 37318, 258, 37324, 258, 37329, 258, 38263, 258, 38272, 258, 38428, 258, - 38582, 258, 38585, 258, 38632, 258, 38737, 258, 38750, 258, 38754, 258, - 38761, 258, 38859, 258, 38893, 258, 38899, 258, 38913, 258, 39080, 258, - 39131, 258, 39135, 258, 39318, 258, 39321, 258, 39340, 258, 39592, 258, - 39640, 258, 39647, 258, 39717, 258, 39727, 258, 39730, 258, 39740, 258, - 39770, 258, 40165, 258, 40565, 258, 40575, 258, 40613, 258, 40635, 258, - 40643, 258, 40653, 258, 40657, 258, 40697, 258, 40701, 258, 40718, 258, - 40723, 258, 40736, 258, 40763, 258, 40778, 258, 40786, 258, 40845, 258, - 40860, 258, 40864, 264, 32, 258, 12306, 258, 21313, 258, 21316, 258, - 21317, 512, 12363, 12441, 512, 12365, 12441, 512, 12367, 12441, 512, - 12369, 12441, 512, 12371, 12441, 512, 12373, 12441, 512, 12375, 12441, - 512, 12377, 12441, 512, 12379, 12441, 512, 12381, 12441, 512, 12383, - 12441, 512, 12385, 12441, 512, 12388, 12441, 512, 12390, 12441, 512, - 12392, 12441, 512, 12399, 12441, 512, 12399, 12442, 512, 12402, 12441, - 512, 12402, 12442, 512, 12405, 12441, 512, 12405, 12442, 512, 12408, - 12441, 512, 12408, 12442, 512, 12411, 12441, 512, 12411, 12442, 512, - 12358, 12441, 514, 32, 12441, 514, 32, 12442, 512, 12445, 12441, 521, - 12424, 12426, 512, 12459, 12441, 512, 12461, 12441, 512, 12463, 12441, - 512, 12465, 12441, 512, 12467, 12441, 512, 12469, 12441, 512, 12471, - 12441, 512, 12473, 12441, 512, 12475, 12441, 512, 12477, 12441, 512, - 12479, 12441, 512, 12481, 12441, 512, 12484, 12441, 512, 12486, 12441, - 512, 12488, 12441, 512, 12495, 12441, 512, 12495, 12442, 512, 12498, - 12441, 512, 12498, 12442, 512, 12501, 12441, 512, 12501, 12442, 512, - 12504, 12441, 512, 12504, 12442, 512, 12507, 12441, 512, 12507, 12442, - 512, 12454, 12441, 512, 12527, 12441, 512, 12528, 12441, 512, 12529, - 12441, 512, 12530, 12441, 512, 12541, 12441, 521, 12467, 12488, 258, - 4352, 258, 4353, 258, 4522, 258, 4354, 258, 4524, 258, 4525, 258, 4355, - 258, 4356, 258, 4357, 258, 4528, 258, 4529, 258, 4530, 258, 4531, 258, - 4532, 258, 4533, 258, 4378, 258, 4358, 258, 4359, 258, 4360, 258, 4385, - 258, 4361, 258, 4362, 258, 4363, 258, 4364, 258, 4365, 258, 4366, 258, - 4367, 258, 4368, 258, 4369, 258, 4370, 258, 4449, 258, 4450, 258, 4451, - 258, 4452, 258, 4453, 258, 4454, 258, 4455, 258, 4456, 258, 4457, 258, - 4458, 258, 4459, 258, 4460, 258, 4461, 258, 4462, 258, 4463, 258, 4464, - 258, 4465, 258, 4466, 258, 4467, 258, 4468, 258, 4469, 258, 4448, 258, - 4372, 258, 4373, 258, 4551, 258, 4552, 258, 4556, 258, 4558, 258, 4563, - 258, 4567, 258, 4569, 258, 4380, 258, 4573, 258, 4575, 258, 4381, 258, - 4382, 258, 4384, 258, 4386, 258, 4387, 258, 4391, 258, 4393, 258, 4395, - 258, 4396, 258, 4397, 258, 4398, 258, 4399, 258, 4402, 258, 4406, 258, - 4416, 258, 4423, 258, 4428, 258, 4593, 258, 4594, 258, 4439, 258, 4440, - 258, 4441, 258, 4484, 258, 4485, 258, 4488, 258, 4497, 258, 4498, 258, - 4500, 258, 4510, 258, 4513, 259, 19968, 259, 20108, 259, 19977, 259, - 22235, 259, 19978, 259, 20013, 259, 19979, 259, 30002, 259, 20057, 259, - 19993, 259, 19969, 259, 22825, 259, 22320, 259, 20154, 770, 40, 4352, 41, - 770, 40, 4354, 41, 770, 40, 4355, 41, 770, 40, 4357, 41, 770, 40, 4358, - 41, 770, 40, 4359, 41, 770, 40, 4361, 41, 770, 40, 4363, 41, 770, 40, - 4364, 41, 770, 40, 4366, 41, 770, 40, 4367, 41, 770, 40, 4368, 41, 770, - 40, 4369, 41, 770, 40, 4370, 41, 1026, 40, 4352, 4449, 41, 1026, 40, - 4354, 4449, 41, 1026, 40, 4355, 4449, 41, 1026, 40, 4357, 4449, 41, 1026, - 40, 4358, 4449, 41, 1026, 40, 4359, 4449, 41, 1026, 40, 4361, 4449, 41, - 1026, 40, 4363, 4449, 41, 1026, 40, 4364, 4449, 41, 1026, 40, 4366, 4449, - 41, 1026, 40, 4367, 4449, 41, 1026, 40, 4368, 4449, 41, 1026, 40, 4369, - 4449, 41, 1026, 40, 4370, 4449, 41, 1026, 40, 4364, 4462, 41, 1794, 40, - 4363, 4457, 4364, 4453, 4523, 41, 1538, 40, 4363, 4457, 4370, 4462, 41, - 770, 40, 19968, 41, 770, 40, 20108, 41, 770, 40, 19977, 41, 770, 40, - 22235, 41, 770, 40, 20116, 41, 770, 40, 20845, 41, 770, 40, 19971, 41, - 770, 40, 20843, 41, 770, 40, 20061, 41, 770, 40, 21313, 41, 770, 40, - 26376, 41, 770, 40, 28779, 41, 770, 40, 27700, 41, 770, 40, 26408, 41, - 770, 40, 37329, 41, 770, 40, 22303, 41, 770, 40, 26085, 41, 770, 40, - 26666, 41, 770, 40, 26377, 41, 770, 40, 31038, 41, 770, 40, 21517, 41, - 770, 40, 29305, 41, 770, 40, 36001, 41, 770, 40, 31069, 41, 770, 40, - 21172, 41, 770, 40, 20195, 41, 770, 40, 21628, 41, 770, 40, 23398, 41, - 770, 40, 30435, 41, 770, 40, 20225, 41, 770, 40, 36039, 41, 770, 40, - 21332, 41, 770, 40, 31085, 41, 770, 40, 20241, 41, 770, 40, 33258, 41, - 770, 40, 33267, 41, 263, 21839, 263, 24188, 263, 25991, 263, 31631, 778, - 80, 84, 69, 519, 50, 49, 519, 50, 50, 519, 50, 51, 519, 50, 52, 519, 50, - 53, 519, 50, 54, 519, 50, 55, 519, 50, 56, 519, 50, 57, 519, 51, 48, 519, - 51, 49, 519, 51, 50, 519, 51, 51, 519, 51, 52, 519, 51, 53, 263, 4352, - 263, 4354, 263, 4355, 263, 4357, 263, 4358, 263, 4359, 263, 4361, 263, - 4363, 263, 4364, 263, 4366, 263, 4367, 263, 4368, 263, 4369, 263, 4370, - 519, 4352, 4449, 519, 4354, 4449, 519, 4355, 4449, 519, 4357, 4449, 519, - 4358, 4449, 519, 4359, 4449, 519, 4361, 4449, 519, 4363, 4449, 519, 4364, - 4449, 519, 4366, 4449, 519, 4367, 4449, 519, 4368, 4449, 519, 4369, 4449, - 519, 4370, 4449, 1287, 4366, 4449, 4535, 4352, 4457, 1031, 4364, 4462, - 4363, 4468, 519, 4363, 4462, 263, 19968, 263, 20108, 263, 19977, 263, - 22235, 263, 20116, 263, 20845, 263, 19971, 263, 20843, 263, 20061, 263, - 21313, 263, 26376, 263, 28779, 263, 27700, 263, 26408, 263, 37329, 263, - 22303, 263, 26085, 263, 26666, 263, 26377, 263, 31038, 263, 21517, 263, - 29305, 263, 36001, 263, 31069, 263, 21172, 263, 31192, 263, 30007, 263, - 22899, 263, 36969, 263, 20778, 263, 21360, 263, 27880, 263, 38917, 263, - 20241, 263, 20889, 263, 27491, 263, 19978, 263, 20013, 263, 19979, 263, - 24038, 263, 21491, 263, 21307, 263, 23447, 263, 23398, 263, 30435, 263, - 20225, 263, 36039, 263, 21332, 263, 22812, 519, 51, 54, 519, 51, 55, 519, - 51, 56, 519, 51, 57, 519, 52, 48, 519, 52, 49, 519, 52, 50, 519, 52, 51, - 519, 52, 52, 519, 52, 53, 519, 52, 54, 519, 52, 55, 519, 52, 56, 519, 52, - 57, 519, 53, 48, 514, 49, 26376, 514, 50, 26376, 514, 51, 26376, 514, 52, - 26376, 514, 53, 26376, 514, 54, 26376, 514, 55, 26376, 514, 56, 26376, - 514, 57, 26376, 770, 49, 48, 26376, 770, 49, 49, 26376, 770, 49, 50, - 26376, 522, 72, 103, 778, 101, 114, 103, 522, 101, 86, 778, 76, 84, 68, - 263, 12450, 263, 12452, 263, 12454, 263, 12456, 263, 12458, 263, 12459, - 263, 12461, 263, 12463, 263, 12465, 263, 12467, 263, 12469, 263, 12471, - 263, 12473, 263, 12475, 263, 12477, 263, 12479, 263, 12481, 263, 12484, - 263, 12486, 263, 12488, 263, 12490, 263, 12491, 263, 12492, 263, 12493, - 263, 12494, 263, 12495, 263, 12498, 263, 12501, 263, 12504, 263, 12507, - 263, 12510, 263, 12511, 263, 12512, 263, 12513, 263, 12514, 263, 12516, - 263, 12518, 263, 12520, 263, 12521, 263, 12522, 263, 12523, 263, 12524, - 263, 12525, 263, 12527, 263, 12528, 263, 12529, 263, 12530, 1034, 12450, - 12497, 12540, 12488, 1034, 12450, 12523, 12501, 12449, 1034, 12450, - 12531, 12506, 12450, 778, 12450, 12540, 12523, 1034, 12452, 12491, 12531, - 12464, 778, 12452, 12531, 12481, 778, 12454, 12457, 12531, 1290, 12456, - 12473, 12463, 12540, 12489, 1034, 12456, 12540, 12459, 12540, 778, 12458, - 12531, 12473, 778, 12458, 12540, 12512, 778, 12459, 12452, 12522, 1034, - 12459, 12521, 12483, 12488, 1034, 12459, 12525, 12522, 12540, 778, 12460, - 12525, 12531, 778, 12460, 12531, 12510, 522, 12462, 12460, 778, 12462, - 12491, 12540, 1034, 12461, 12517, 12522, 12540, 1034, 12462, 12523, - 12480, 12540, 522, 12461, 12525, 1290, 12461, 12525, 12464, 12521, 12512, - 1546, 12461, 12525, 12513, 12540, 12488, 12523, 1290, 12461, 12525, - 12527, 12483, 12488, 778, 12464, 12521, 12512, 1290, 12464, 12521, 12512, - 12488, 12531, 1290, 12463, 12523, 12476, 12452, 12525, 1034, 12463, - 12525, 12540, 12493, 778, 12465, 12540, 12473, 778, 12467, 12523, 12490, - 778, 12467, 12540, 12509, 1034, 12469, 12452, 12463, 12523, 1290, 12469, - 12531, 12481, 12540, 12512, 1034, 12471, 12522, 12531, 12464, 778, 12475, - 12531, 12481, 778, 12475, 12531, 12488, 778, 12480, 12540, 12473, 522, - 12487, 12471, 522, 12489, 12523, 522, 12488, 12531, 522, 12490, 12494, - 778, 12494, 12483, 12488, 778, 12495, 12452, 12484, 1290, 12497, 12540, - 12475, 12531, 12488, 778, 12497, 12540, 12484, 1034, 12496, 12540, 12524, - 12523, 1290, 12500, 12450, 12473, 12488, 12523, 778, 12500, 12463, 12523, - 522, 12500, 12467, 522, 12499, 12523, 1290, 12501, 12449, 12521, 12483, - 12489, 1034, 12501, 12451, 12540, 12488, 1290, 12502, 12483, 12471, - 12455, 12523, 778, 12501, 12521, 12531, 1290, 12504, 12463, 12479, 12540, - 12523, 522, 12506, 12477, 778, 12506, 12491, 12498, 778, 12504, 12523, - 12484, 778, 12506, 12531, 12473, 778, 12506, 12540, 12472, 778, 12505, - 12540, 12479, 1034, 12509, 12452, 12531, 12488, 778, 12508, 12523, 12488, - 522, 12507, 12531, 778, 12509, 12531, 12489, 778, 12507, 12540, 12523, - 778, 12507, 12540, 12531, 1034, 12510, 12452, 12463, 12525, 778, 12510, - 12452, 12523, 778, 12510, 12483, 12495, 778, 12510, 12523, 12463, 1290, - 12510, 12531, 12471, 12519, 12531, 1034, 12511, 12463, 12525, 12531, 522, - 12511, 12522, 1290, 12511, 12522, 12496, 12540, 12523, 522, 12513, 12460, - 1034, 12513, 12460, 12488, 12531, 1034, 12513, 12540, 12488, 12523, 778, - 12516, 12540, 12489, 778, 12516, 12540, 12523, 778, 12518, 12450, 12531, - 1034, 12522, 12483, 12488, 12523, 522, 12522, 12521, 778, 12523, 12500, - 12540, 1034, 12523, 12540, 12502, 12523, 522, 12524, 12512, 1290, 12524, - 12531, 12488, 12466, 12531, 778, 12527, 12483, 12488, 514, 48, 28857, - 514, 49, 28857, 514, 50, 28857, 514, 51, 28857, 514, 52, 28857, 514, 53, - 28857, 514, 54, 28857, 514, 55, 28857, 514, 56, 28857, 514, 57, 28857, - 770, 49, 48, 28857, 770, 49, 49, 28857, 770, 49, 50, 28857, 770, 49, 51, - 28857, 770, 49, 52, 28857, 770, 49, 53, 28857, 770, 49, 54, 28857, 770, - 49, 55, 28857, 770, 49, 56, 28857, 770, 49, 57, 28857, 770, 50, 48, - 28857, 770, 50, 49, 28857, 770, 50, 50, 28857, 770, 50, 51, 28857, 770, - 50, 52, 28857, 778, 104, 80, 97, 522, 100, 97, 522, 65, 85, 778, 98, 97, - 114, 522, 111, 86, 522, 112, 99, 522, 100, 109, 778, 100, 109, 178, 778, - 100, 109, 179, 522, 73, 85, 522, 24179, 25104, 522, 26157, 21644, 522, - 22823, 27491, 522, 26126, 27835, 1034, 26666, 24335, 20250, 31038, 522, - 112, 65, 522, 110, 65, 522, 956, 65, 522, 109, 65, 522, 107, 65, 522, 75, - 66, 522, 77, 66, 522, 71, 66, 778, 99, 97, 108, 1034, 107, 99, 97, 108, - 522, 112, 70, 522, 110, 70, 522, 956, 70, 522, 956, 103, 522, 109, 103, - 522, 107, 103, 522, 72, 122, 778, 107, 72, 122, 778, 77, 72, 122, 778, - 71, 72, 122, 778, 84, 72, 122, 522, 956, 8467, 522, 109, 8467, 522, 100, - 8467, 522, 107, 8467, 522, 102, 109, 522, 110, 109, 522, 956, 109, 522, - 109, 109, 522, 99, 109, 522, 107, 109, 778, 109, 109, 178, 778, 99, 109, - 178, 522, 109, 178, 778, 107, 109, 178, 778, 109, 109, 179, 778, 99, 109, - 179, 522, 109, 179, 778, 107, 109, 179, 778, 109, 8725, 115, 1034, 109, - 8725, 115, 178, 522, 80, 97, 778, 107, 80, 97, 778, 77, 80, 97, 778, 71, - 80, 97, 778, 114, 97, 100, 1290, 114, 97, 100, 8725, 115, 1546, 114, 97, - 100, 8725, 115, 178, 522, 112, 115, 522, 110, 115, 522, 956, 115, 522, - 109, 115, 522, 112, 86, 522, 110, 86, 522, 956, 86, 522, 109, 86, 522, - 107, 86, 522, 77, 86, 522, 112, 87, 522, 110, 87, 522, 956, 87, 522, 109, - 87, 522, 107, 87, 522, 77, 87, 522, 107, 937, 522, 77, 937, 1034, 97, 46, - 109, 46, 522, 66, 113, 522, 99, 99, 522, 99, 100, 1034, 67, 8725, 107, - 103, 778, 67, 111, 46, 522, 100, 66, 522, 71, 121, 522, 104, 97, 522, 72, - 80, 522, 105, 110, 522, 75, 75, 522, 75, 77, 522, 107, 116, 522, 108, - 109, 522, 108, 110, 778, 108, 111, 103, 522, 108, 120, 522, 109, 98, 778, - 109, 105, 108, 778, 109, 111, 108, 522, 80, 72, 1034, 112, 46, 109, 46, - 778, 80, 80, 77, 522, 80, 82, 522, 115, 114, 522, 83, 118, 522, 87, 98, - 778, 86, 8725, 109, 778, 65, 8725, 109, 514, 49, 26085, 514, 50, 26085, - 514, 51, 26085, 514, 52, 26085, 514, 53, 26085, 514, 54, 26085, 514, 55, - 26085, 514, 56, 26085, 514, 57, 26085, 770, 49, 48, 26085, 770, 49, 49, - 26085, 770, 49, 50, 26085, 770, 49, 51, 26085, 770, 49, 52, 26085, 770, - 49, 53, 26085, 770, 49, 54, 26085, 770, 49, 55, 26085, 770, 49, 56, - 26085, 770, 49, 57, 26085, 770, 50, 48, 26085, 770, 50, 49, 26085, 770, - 50, 50, 26085, 770, 50, 51, 26085, 770, 50, 52, 26085, 770, 50, 53, - 26085, 770, 50, 54, 26085, 770, 50, 55, 26085, 770, 50, 56, 26085, 770, - 50, 57, 26085, 770, 51, 48, 26085, 770, 51, 49, 26085, 778, 103, 97, 108, - 259, 42863, 256, 35912, 256, 26356, 256, 36554, 256, 36040, 256, 28369, - 256, 20018, 256, 21477, 256, 40860, 256, 40860, 256, 22865, 256, 37329, - 256, 21895, 256, 22856, 256, 25078, 256, 30313, 256, 32645, 256, 34367, - 256, 34746, 256, 35064, 256, 37007, 256, 27138, 256, 27931, 256, 28889, - 256, 29662, 256, 33853, 256, 37226, 256, 39409, 256, 20098, 256, 21365, - 256, 27396, 256, 29211, 256, 34349, 256, 40478, 256, 23888, 256, 28651, - 256, 34253, 256, 35172, 256, 25289, 256, 33240, 256, 34847, 256, 24266, - 256, 26391, 256, 28010, 256, 29436, 256, 37070, 256, 20358, 256, 20919, - 256, 21214, 256, 25796, 256, 27347, 256, 29200, 256, 30439, 256, 32769, - 256, 34310, 256, 34396, 256, 36335, 256, 38706, 256, 39791, 256, 40442, - 256, 30860, 256, 31103, 256, 32160, 256, 33737, 256, 37636, 256, 40575, - 256, 35542, 256, 22751, 256, 24324, 256, 31840, 256, 32894, 256, 29282, - 256, 30922, 256, 36034, 256, 38647, 256, 22744, 256, 23650, 256, 27155, - 256, 28122, 256, 28431, 256, 32047, 256, 32311, 256, 38475, 256, 21202, - 256, 32907, 256, 20956, 256, 20940, 256, 31260, 256, 32190, 256, 33777, - 256, 38517, 256, 35712, 256, 25295, 256, 27138, 256, 35582, 256, 20025, - 256, 23527, 256, 24594, 256, 29575, 256, 30064, 256, 21271, 256, 30971, - 256, 20415, 256, 24489, 256, 19981, 256, 27852, 256, 25976, 256, 32034, - 256, 21443, 256, 22622, 256, 30465, 256, 33865, 256, 35498, 256, 27578, - 256, 36784, 256, 27784, 256, 25342, 256, 33509, 256, 25504, 256, 30053, - 256, 20142, 256, 20841, 256, 20937, 256, 26753, 256, 31975, 256, 33391, - 256, 35538, 256, 37327, 256, 21237, 256, 21570, 256, 22899, 256, 24300, - 256, 26053, 256, 28670, 256, 31018, 256, 38317, 256, 39530, 256, 40599, - 256, 40654, 256, 21147, 256, 26310, 256, 27511, 256, 36706, 256, 24180, - 256, 24976, 256, 25088, 256, 25754, 256, 28451, 256, 29001, 256, 29833, - 256, 31178, 256, 32244, 256, 32879, 256, 36646, 256, 34030, 256, 36899, - 256, 37706, 256, 21015, 256, 21155, 256, 21693, 256, 28872, 256, 35010, - 256, 35498, 256, 24265, 256, 24565, 256, 25467, 256, 27566, 256, 31806, - 256, 29557, 256, 20196, 256, 22265, 256, 23527, 256, 23994, 256, 24604, - 256, 29618, 256, 29801, 256, 32666, 256, 32838, 256, 37428, 256, 38646, - 256, 38728, 256, 38936, 256, 20363, 256, 31150, 256, 37300, 256, 38584, - 256, 24801, 256, 20102, 256, 20698, 256, 23534, 256, 23615, 256, 26009, - 256, 27138, 256, 29134, 256, 30274, 256, 34044, 256, 36988, 256, 40845, - 256, 26248, 256, 38446, 256, 21129, 256, 26491, 256, 26611, 256, 27969, - 256, 28316, 256, 29705, 256, 30041, 256, 30827, 256, 32016, 256, 39006, - 256, 20845, 256, 25134, 256, 38520, 256, 20523, 256, 23833, 256, 28138, - 256, 36650, 256, 24459, 256, 24900, 256, 26647, 256, 29575, 256, 38534, - 256, 21033, 256, 21519, 256, 23653, 256, 26131, 256, 26446, 256, 26792, - 256, 27877, 256, 29702, 256, 30178, 256, 32633, 256, 35023, 256, 35041, - 256, 37324, 256, 38626, 256, 21311, 256, 28346, 256, 21533, 256, 29136, - 256, 29848, 256, 34298, 256, 38563, 256, 40023, 256, 40607, 256, 26519, - 256, 28107, 256, 33256, 256, 31435, 256, 31520, 256, 31890, 256, 29376, - 256, 28825, 256, 35672, 256, 20160, 256, 33590, 256, 21050, 256, 20999, - 256, 24230, 256, 25299, 256, 31958, 256, 23429, 256, 27934, 256, 26292, - 256, 36667, 256, 34892, 256, 38477, 256, 35211, 256, 24275, 256, 20800, - 256, 21952, 256, 22618, 256, 26228, 256, 20958, 256, 29482, 256, 30410, - 256, 31036, 256, 31070, 256, 31077, 256, 31119, 256, 38742, 256, 31934, - 256, 32701, 256, 34322, 256, 35576, 256, 36920, 256, 37117, 256, 39151, - 256, 39164, 256, 39208, 256, 40372, 256, 20398, 256, 20711, 256, 20813, - 256, 21193, 256, 21220, 256, 21329, 256, 21917, 256, 22022, 256, 22120, - 256, 22592, 256, 22696, 256, 23652, 256, 23662, 256, 24724, 256, 24936, - 256, 24974, 256, 25074, 256, 25935, 256, 26082, 256, 26257, 256, 26757, - 256, 28023, 256, 28186, 256, 28450, 256, 29038, 256, 29227, 256, 29730, - 256, 30865, 256, 31038, 256, 31049, 256, 31048, 256, 31056, 256, 31062, - 256, 31069, 256, 31117, 256, 31118, 256, 31296, 256, 31361, 256, 31680, - 256, 32244, 256, 32265, 256, 32321, 256, 32626, 256, 32773, 256, 33261, - 256, 33401, 256, 33401, 256, 33879, 256, 35088, 256, 35222, 256, 35585, - 256, 35641, 256, 36051, 256, 36104, 256, 36790, 256, 36920, 256, 38627, - 256, 38911, 256, 38971, 256, 24693, 256, 148206, 256, 33304, 256, 20006, - 256, 20917, 256, 20840, 256, 20352, 256, 20805, 256, 20864, 256, 21191, - 256, 21242, 256, 21917, 256, 21845, 256, 21913, 256, 21986, 256, 22618, - 256, 22707, 256, 22852, 256, 22868, 256, 23138, 256, 23336, 256, 24274, - 256, 24281, 256, 24425, 256, 24493, 256, 24792, 256, 24910, 256, 24840, - 256, 24974, 256, 24928, 256, 25074, 256, 25140, 256, 25540, 256, 25628, - 256, 25682, 256, 25942, 256, 26228, 256, 26391, 256, 26395, 256, 26454, - 256, 27513, 256, 27578, 256, 27969, 256, 28379, 256, 28363, 256, 28450, - 256, 28702, 256, 29038, 256, 30631, 256, 29237, 256, 29359, 256, 29482, - 256, 29809, 256, 29958, 256, 30011, 256, 30237, 256, 30239, 256, 30410, - 256, 30427, 256, 30452, 256, 30538, 256, 30528, 256, 30924, 256, 31409, - 256, 31680, 256, 31867, 256, 32091, 256, 32244, 256, 32574, 256, 32773, - 256, 33618, 256, 33775, 256, 34681, 256, 35137, 256, 35206, 256, 35222, - 256, 35519, 256, 35576, 256, 35531, 256, 35585, 256, 35582, 256, 35565, - 256, 35641, 256, 35722, 256, 36104, 256, 36664, 256, 36978, 256, 37273, - 256, 37494, 256, 38524, 256, 38627, 256, 38742, 256, 38875, 256, 38911, - 256, 38923, 256, 38971, 256, 39698, 256, 40860, 256, 141386, 256, 141380, - 256, 144341, 256, 15261, 256, 16408, 256, 16441, 256, 152137, 256, - 154832, 256, 163539, 256, 40771, 256, 40846, 514, 102, 102, 514, 102, - 105, 514, 102, 108, 770, 102, 102, 105, 770, 102, 102, 108, 514, 383, - 116, 514, 115, 116, 514, 1396, 1398, 514, 1396, 1381, 514, 1396, 1387, - 514, 1406, 1398, 514, 1396, 1389, 512, 1497, 1460, 512, 1522, 1463, 262, - 1506, 262, 1488, 262, 1491, 262, 1492, 262, 1499, 262, 1500, 262, 1501, - 262, 1512, 262, 1514, 262, 43, 512, 1513, 1473, 512, 1513, 1474, 512, - 64329, 1473, 512, 64329, 1474, 512, 1488, 1463, 512, 1488, 1464, 512, - 1488, 1468, 512, 1489, 1468, 512, 1490, 1468, 512, 1491, 1468, 512, 1492, - 1468, 512, 1493, 1468, 512, 1494, 1468, 512, 1496, 1468, 512, 1497, 1468, - 512, 1498, 1468, 512, 1499, 1468, 512, 1500, 1468, 512, 1502, 1468, 512, - 1504, 1468, 512, 1505, 1468, 512, 1507, 1468, 512, 1508, 1468, 512, 1510, - 1468, 512, 1511, 1468, 512, 1512, 1468, 512, 1513, 1468, 512, 1514, 1468, - 512, 1493, 1465, 512, 1489, 1471, 512, 1499, 1471, 512, 1508, 1471, 514, - 1488, 1500, 267, 1649, 268, 1649, 267, 1659, 268, 1659, 269, 1659, 270, - 1659, 267, 1662, 268, 1662, 269, 1662, 270, 1662, 267, 1664, 268, 1664, - 269, 1664, 270, 1664, 267, 1658, 268, 1658, 269, 1658, 270, 1658, 267, - 1663, 268, 1663, 269, 1663, 270, 1663, 267, 1657, 268, 1657, 269, 1657, - 270, 1657, 267, 1700, 268, 1700, 269, 1700, 270, 1700, 267, 1702, 268, - 1702, 269, 1702, 270, 1702, 267, 1668, 268, 1668, 269, 1668, 270, 1668, - 267, 1667, 268, 1667, 269, 1667, 270, 1667, 267, 1670, 268, 1670, 269, - 1670, 270, 1670, 267, 1671, 268, 1671, 269, 1671, 270, 1671, 267, 1677, - 268, 1677, 267, 1676, 268, 1676, 267, 1678, 268, 1678, 267, 1672, 268, - 1672, 267, 1688, 268, 1688, 267, 1681, 268, 1681, 267, 1705, 268, 1705, - 269, 1705, 270, 1705, 267, 1711, 268, 1711, 269, 1711, 270, 1711, 267, - 1715, 268, 1715, 269, 1715, 270, 1715, 267, 1713, 268, 1713, 269, 1713, - 270, 1713, 267, 1722, 268, 1722, 267, 1723, 268, 1723, 269, 1723, 270, - 1723, 267, 1728, 268, 1728, 267, 1729, 268, 1729, 269, 1729, 270, 1729, - 267, 1726, 268, 1726, 269, 1726, 270, 1726, 267, 1746, 268, 1746, 267, - 1747, 268, 1747, 267, 1709, 268, 1709, 269, 1709, 270, 1709, 267, 1735, - 268, 1735, 267, 1734, 268, 1734, 267, 1736, 268, 1736, 267, 1655, 267, - 1739, 268, 1739, 267, 1733, 268, 1733, 267, 1737, 268, 1737, 267, 1744, - 268, 1744, 269, 1744, 270, 1744, 269, 1609, 270, 1609, 523, 1574, 1575, - 524, 1574, 1575, 523, 1574, 1749, 524, 1574, 1749, 523, 1574, 1608, 524, - 1574, 1608, 523, 1574, 1735, 524, 1574, 1735, 523, 1574, 1734, 524, 1574, - 1734, 523, 1574, 1736, 524, 1574, 1736, 523, 1574, 1744, 524, 1574, 1744, - 525, 1574, 1744, 523, 1574, 1609, 524, 1574, 1609, 525, 1574, 1609, 267, - 1740, 268, 1740, 269, 1740, 270, 1740, 523, 1574, 1580, 523, 1574, 1581, - 523, 1574, 1605, 523, 1574, 1609, 523, 1574, 1610, 523, 1576, 1580, 523, - 1576, 1581, 523, 1576, 1582, 523, 1576, 1605, 523, 1576, 1609, 523, 1576, - 1610, 523, 1578, 1580, 523, 1578, 1581, 523, 1578, 1582, 523, 1578, 1605, - 523, 1578, 1609, 523, 1578, 1610, 523, 1579, 1580, 523, 1579, 1605, 523, - 1579, 1609, 523, 1579, 1610, 523, 1580, 1581, 523, 1580, 1605, 523, 1581, - 1580, 523, 1581, 1605, 523, 1582, 1580, 523, 1582, 1581, 523, 1582, 1605, - 523, 1587, 1580, 523, 1587, 1581, 523, 1587, 1582, 523, 1587, 1605, 523, - 1589, 1581, 523, 1589, 1605, 523, 1590, 1580, 523, 1590, 1581, 523, 1590, - 1582, 523, 1590, 1605, 523, 1591, 1581, 523, 1591, 1605, 523, 1592, 1605, - 523, 1593, 1580, 523, 1593, 1605, 523, 1594, 1580, 523, 1594, 1605, 523, - 1601, 1580, 523, 1601, 1581, 523, 1601, 1582, 523, 1601, 1605, 523, 1601, - 1609, 523, 1601, 1610, 523, 1602, 1581, 523, 1602, 1605, 523, 1602, 1609, - 523, 1602, 1610, 523, 1603, 1575, 523, 1603, 1580, 523, 1603, 1581, 523, - 1603, 1582, 523, 1603, 1604, 523, 1603, 1605, 523, 1603, 1609, 523, 1603, - 1610, 523, 1604, 1580, 523, 1604, 1581, 523, 1604, 1582, 523, 1604, 1605, - 523, 1604, 1609, 523, 1604, 1610, 523, 1605, 1580, 523, 1605, 1581, 523, - 1605, 1582, 523, 1605, 1605, 523, 1605, 1609, 523, 1605, 1610, 523, 1606, - 1580, 523, 1606, 1581, 523, 1606, 1582, 523, 1606, 1605, 523, 1606, 1609, - 523, 1606, 1610, 523, 1607, 1580, 523, 1607, 1605, 523, 1607, 1609, 523, - 1607, 1610, 523, 1610, 1580, 523, 1610, 1581, 523, 1610, 1582, 523, 1610, - 1605, 523, 1610, 1609, 523, 1610, 1610, 523, 1584, 1648, 523, 1585, 1648, - 523, 1609, 1648, 779, 32, 1612, 1617, 779, 32, 1613, 1617, 779, 32, 1614, - 1617, 779, 32, 1615, 1617, 779, 32, 1616, 1617, 779, 32, 1617, 1648, 524, - 1574, 1585, 524, 1574, 1586, 524, 1574, 1605, 524, 1574, 1606, 524, 1574, - 1609, 524, 1574, 1610, 524, 1576, 1585, 524, 1576, 1586, 524, 1576, 1605, - 524, 1576, 1606, 524, 1576, 1609, 524, 1576, 1610, 524, 1578, 1585, 524, - 1578, 1586, 524, 1578, 1605, 524, 1578, 1606, 524, 1578, 1609, 524, 1578, - 1610, 524, 1579, 1585, 524, 1579, 1586, 524, 1579, 1605, 524, 1579, 1606, - 524, 1579, 1609, 524, 1579, 1610, 524, 1601, 1609, 524, 1601, 1610, 524, - 1602, 1609, 524, 1602, 1610, 524, 1603, 1575, 524, 1603, 1604, 524, 1603, - 1605, 524, 1603, 1609, 524, 1603, 1610, 524, 1604, 1605, 524, 1604, 1609, - 524, 1604, 1610, 524, 1605, 1575, 524, 1605, 1605, 524, 1606, 1585, 524, - 1606, 1586, 524, 1606, 1605, 524, 1606, 1606, 524, 1606, 1609, 524, 1606, - 1610, 524, 1609, 1648, 524, 1610, 1585, 524, 1610, 1586, 524, 1610, 1605, - 524, 1610, 1606, 524, 1610, 1609, 524, 1610, 1610, 525, 1574, 1580, 525, - 1574, 1581, 525, 1574, 1582, 525, 1574, 1605, 525, 1574, 1607, 525, 1576, - 1580, 525, 1576, 1581, 525, 1576, 1582, 525, 1576, 1605, 525, 1576, 1607, - 525, 1578, 1580, 525, 1578, 1581, 525, 1578, 1582, 525, 1578, 1605, 525, - 1578, 1607, 525, 1579, 1605, 525, 1580, 1581, 525, 1580, 1605, 525, 1581, - 1580, 525, 1581, 1605, 525, 1582, 1580, 525, 1582, 1605, 525, 1587, 1580, - 525, 1587, 1581, 525, 1587, 1582, 525, 1587, 1605, 525, 1589, 1581, 525, - 1589, 1582, 525, 1589, 1605, 525, 1590, 1580, 525, 1590, 1581, 525, 1590, - 1582, 525, 1590, 1605, 525, 1591, 1581, 525, 1592, 1605, 525, 1593, 1580, - 525, 1593, 1605, 525, 1594, 1580, 525, 1594, 1605, 525, 1601, 1580, 525, - 1601, 1581, 525, 1601, 1582, 525, 1601, 1605, 525, 1602, 1581, 525, 1602, - 1605, 525, 1603, 1580, 525, 1603, 1581, 525, 1603, 1582, 525, 1603, 1604, - 525, 1603, 1605, 525, 1604, 1580, 525, 1604, 1581, 525, 1604, 1582, 525, - 1604, 1605, 525, 1604, 1607, 525, 1605, 1580, 525, 1605, 1581, 525, 1605, - 1582, 525, 1605, 1605, 525, 1606, 1580, 525, 1606, 1581, 525, 1606, 1582, - 525, 1606, 1605, 525, 1606, 1607, 525, 1607, 1580, 525, 1607, 1605, 525, - 1607, 1648, 525, 1610, 1580, 525, 1610, 1581, 525, 1610, 1582, 525, 1610, - 1605, 525, 1610, 1607, 526, 1574, 1605, 526, 1574, 1607, 526, 1576, 1605, - 526, 1576, 1607, 526, 1578, 1605, 526, 1578, 1607, 526, 1579, 1605, 526, - 1579, 1607, 526, 1587, 1605, 526, 1587, 1607, 526, 1588, 1605, 526, 1588, - 1607, 526, 1603, 1604, 526, 1603, 1605, 526, 1604, 1605, 526, 1606, 1605, - 526, 1606, 1607, 526, 1610, 1605, 526, 1610, 1607, 782, 1600, 1614, 1617, - 782, 1600, 1615, 1617, 782, 1600, 1616, 1617, 523, 1591, 1609, 523, 1591, - 1610, 523, 1593, 1609, 523, 1593, 1610, 523, 1594, 1609, 523, 1594, 1610, - 523, 1587, 1609, 523, 1587, 1610, 523, 1588, 1609, 523, 1588, 1610, 523, - 1581, 1609, 523, 1581, 1610, 523, 1580, 1609, 523, 1580, 1610, 523, 1582, - 1609, 523, 1582, 1610, 523, 1589, 1609, 523, 1589, 1610, 523, 1590, 1609, - 523, 1590, 1610, 523, 1588, 1580, 523, 1588, 1581, 523, 1588, 1582, 523, - 1588, 1605, 523, 1588, 1585, 523, 1587, 1585, 523, 1589, 1585, 523, 1590, - 1585, 524, 1591, 1609, 524, 1591, 1610, 524, 1593, 1609, 524, 1593, 1610, - 524, 1594, 1609, 524, 1594, 1610, 524, 1587, 1609, 524, 1587, 1610, 524, - 1588, 1609, 524, 1588, 1610, 524, 1581, 1609, 524, 1581, 1610, 524, 1580, - 1609, 524, 1580, 1610, 524, 1582, 1609, 524, 1582, 1610, 524, 1589, 1609, - 524, 1589, 1610, 524, 1590, 1609, 524, 1590, 1610, 524, 1588, 1580, 524, - 1588, 1581, 524, 1588, 1582, 524, 1588, 1605, 524, 1588, 1585, 524, 1587, - 1585, 524, 1589, 1585, 524, 1590, 1585, 525, 1588, 1580, 525, 1588, 1581, - 525, 1588, 1582, 525, 1588, 1605, 525, 1587, 1607, 525, 1588, 1607, 525, - 1591, 1605, 526, 1587, 1580, 526, 1587, 1581, 526, 1587, 1582, 526, 1588, - 1580, 526, 1588, 1581, 526, 1588, 1582, 526, 1591, 1605, 526, 1592, 1605, - 524, 1575, 1611, 523, 1575, 1611, 781, 1578, 1580, 1605, 780, 1578, 1581, - 1580, 781, 1578, 1581, 1580, 781, 1578, 1581, 1605, 781, 1578, 1582, - 1605, 781, 1578, 1605, 1580, 781, 1578, 1605, 1581, 781, 1578, 1605, - 1582, 780, 1580, 1605, 1581, 781, 1580, 1605, 1581, 780, 1581, 1605, - 1610, 780, 1581, 1605, 1609, 781, 1587, 1581, 1580, 781, 1587, 1580, - 1581, 780, 1587, 1580, 1609, 780, 1587, 1605, 1581, 781, 1587, 1605, - 1581, 781, 1587, 1605, 1580, 780, 1587, 1605, 1605, 781, 1587, 1605, - 1605, 780, 1589, 1581, 1581, 781, 1589, 1581, 1581, 780, 1589, 1605, - 1605, 780, 1588, 1581, 1605, 781, 1588, 1581, 1605, 780, 1588, 1580, - 1610, 780, 1588, 1605, 1582, 781, 1588, 1605, 1582, 780, 1588, 1605, - 1605, 781, 1588, 1605, 1605, 780, 1590, 1581, 1609, 780, 1590, 1582, - 1605, 781, 1590, 1582, 1605, 780, 1591, 1605, 1581, 781, 1591, 1605, - 1581, 781, 1591, 1605, 1605, 780, 1591, 1605, 1610, 780, 1593, 1580, - 1605, 780, 1593, 1605, 1605, 781, 1593, 1605, 1605, 780, 1593, 1605, - 1609, 780, 1594, 1605, 1605, 780, 1594, 1605, 1610, 780, 1594, 1605, - 1609, 780, 1601, 1582, 1605, 781, 1601, 1582, 1605, 780, 1602, 1605, - 1581, 780, 1602, 1605, 1605, 780, 1604, 1581, 1605, 780, 1604, 1581, - 1610, 780, 1604, 1581, 1609, 781, 1604, 1580, 1580, 780, 1604, 1580, - 1580, 780, 1604, 1582, 1605, 781, 1604, 1582, 1605, 780, 1604, 1605, - 1581, 781, 1604, 1605, 1581, 781, 1605, 1581, 1580, 781, 1605, 1581, - 1605, 780, 1605, 1581, 1610, 781, 1605, 1580, 1581, 781, 1605, 1580, - 1605, 781, 1605, 1582, 1580, 781, 1605, 1582, 1605, 781, 1605, 1580, - 1582, 781, 1607, 1605, 1580, 781, 1607, 1605, 1605, 781, 1606, 1581, - 1605, 780, 1606, 1581, 1609, 780, 1606, 1580, 1605, 781, 1606, 1580, - 1605, 780, 1606, 1580, 1609, 780, 1606, 1605, 1610, 780, 1606, 1605, - 1609, 780, 1610, 1605, 1605, 781, 1610, 1605, 1605, 780, 1576, 1582, - 1610, 780, 1578, 1580, 1610, 780, 1578, 1580, 1609, 780, 1578, 1582, - 1610, 780, 1578, 1582, 1609, 780, 1578, 1605, 1610, 780, 1578, 1605, - 1609, 780, 1580, 1605, 1610, 780, 1580, 1581, 1609, 780, 1580, 1605, - 1609, 780, 1587, 1582, 1609, 780, 1589, 1581, 1610, 780, 1588, 1581, - 1610, 780, 1590, 1581, 1610, 780, 1604, 1580, 1610, 780, 1604, 1605, - 1610, 780, 1610, 1581, 1610, 780, 1610, 1580, 1610, 780, 1610, 1605, - 1610, 780, 1605, 1605, 1610, 780, 1602, 1605, 1610, 780, 1606, 1581, - 1610, 781, 1602, 1605, 1581, 781, 1604, 1581, 1605, 780, 1593, 1605, - 1610, 780, 1603, 1605, 1610, 781, 1606, 1580, 1581, 780, 1605, 1582, - 1610, 781, 1604, 1580, 1605, 780, 1603, 1605, 1605, 780, 1604, 1580, - 1605, 780, 1606, 1580, 1581, 780, 1580, 1581, 1610, 780, 1581, 1580, - 1610, 780, 1605, 1580, 1610, 780, 1601, 1605, 1610, 780, 1576, 1581, - 1610, 781, 1603, 1605, 1605, 781, 1593, 1580, 1605, 781, 1589, 1605, - 1605, 780, 1587, 1582, 1610, 780, 1606, 1580, 1610, 779, 1589, 1604, - 1746, 779, 1602, 1604, 1746, 1035, 1575, 1604, 1604, 1607, 1035, 1575, - 1603, 1576, 1585, 1035, 1605, 1581, 1605, 1583, 1035, 1589, 1604, 1593, - 1605, 1035, 1585, 1587, 1608, 1604, 1035, 1593, 1604, 1610, 1607, 1035, - 1608, 1587, 1604, 1605, 779, 1589, 1604, 1609, 4619, 1589, 1604, 1609, - 32, 1575, 1604, 1604, 1607, 32, 1593, 1604, 1610, 1607, 32, 1608, 1587, - 1604, 1605, 2059, 1580, 1604, 32, 1580, 1604, 1575, 1604, 1607, 1035, - 1585, 1740, 1575, 1604, 265, 44, 265, 12289, 265, 12290, 265, 58, 265, - 59, 265, 33, 265, 63, 265, 12310, 265, 12311, 265, 8230, 265, 8229, 265, - 8212, 265, 8211, 265, 95, 265, 95, 265, 40, 265, 41, 265, 123, 265, 125, - 265, 12308, 265, 12309, 265, 12304, 265, 12305, 265, 12298, 265, 12299, - 265, 12296, 265, 12297, 265, 12300, 265, 12301, 265, 12302, 265, 12303, - 265, 91, 265, 93, 258, 8254, 258, 8254, 258, 8254, 258, 8254, 258, 95, - 258, 95, 258, 95, 271, 44, 271, 12289, 271, 46, 271, 59, 271, 58, 271, - 63, 271, 33, 271, 8212, 271, 40, 271, 41, 271, 123, 271, 125, 271, 12308, - 271, 12309, 271, 35, 271, 38, 271, 42, 271, 43, 271, 45, 271, 60, 271, - 62, 271, 61, 271, 92, 271, 36, 271, 37, 271, 64, 523, 32, 1611, 526, - 1600, 1611, 523, 32, 1612, 523, 32, 1613, 523, 32, 1614, 526, 1600, 1614, - 523, 32, 1615, 526, 1600, 1615, 523, 32, 1616, 526, 1600, 1616, 523, 32, - 1617, 526, 1600, 1617, 523, 32, 1618, 526, 1600, 1618, 267, 1569, 267, - 1570, 268, 1570, 267, 1571, 268, 1571, 267, 1572, 268, 1572, 267, 1573, - 268, 1573, 267, 1574, 268, 1574, 269, 1574, 270, 1574, 267, 1575, 268, - 1575, 267, 1576, 268, 1576, 269, 1576, 270, 1576, 267, 1577, 268, 1577, - 267, 1578, 268, 1578, 269, 1578, 270, 1578, 267, 1579, 268, 1579, 269, - 1579, 270, 1579, 267, 1580, 268, 1580, 269, 1580, 270, 1580, 267, 1581, - 268, 1581, 269, 1581, 270, 1581, 267, 1582, 268, 1582, 269, 1582, 270, - 1582, 267, 1583, 268, 1583, 267, 1584, 268, 1584, 267, 1585, 268, 1585, - 267, 1586, 268, 1586, 267, 1587, 268, 1587, 269, 1587, 270, 1587, 267, - 1588, 268, 1588, 269, 1588, 270, 1588, 267, 1589, 268, 1589, 269, 1589, - 270, 1589, 267, 1590, 268, 1590, 269, 1590, 270, 1590, 267, 1591, 268, - 1591, 269, 1591, 270, 1591, 267, 1592, 268, 1592, 269, 1592, 270, 1592, - 267, 1593, 268, 1593, 269, 1593, 270, 1593, 267, 1594, 268, 1594, 269, - 1594, 270, 1594, 267, 1601, 268, 1601, 269, 1601, 270, 1601, 267, 1602, - 268, 1602, 269, 1602, 270, 1602, 267, 1603, 268, 1603, 269, 1603, 270, - 1603, 267, 1604, 268, 1604, 269, 1604, 270, 1604, 267, 1605, 268, 1605, - 269, 1605, 270, 1605, 267, 1606, 268, 1606, 269, 1606, 270, 1606, 267, - 1607, 268, 1607, 269, 1607, 270, 1607, 267, 1608, 268, 1608, 267, 1609, - 268, 1609, 267, 1610, 268, 1610, 269, 1610, 270, 1610, 523, 1604, 1570, - 524, 1604, 1570, 523, 1604, 1571, 524, 1604, 1571, 523, 1604, 1573, 524, - 1604, 1573, 523, 1604, 1575, 524, 1604, 1575, 264, 33, 264, 34, 264, 35, - 264, 36, 264, 37, 264, 38, 264, 39, 264, 40, 264, 41, 264, 42, 264, 43, - 264, 44, 264, 45, 264, 46, 264, 47, 264, 48, 264, 49, 264, 50, 264, 51, - 264, 52, 264, 53, 264, 54, 264, 55, 264, 56, 264, 57, 264, 58, 264, 59, - 264, 60, 264, 61, 264, 62, 264, 63, 264, 64, 264, 65, 264, 66, 264, 67, - 264, 68, 264, 69, 264, 70, 264, 71, 264, 72, 264, 73, 264, 74, 264, 75, - 264, 76, 264, 77, 264, 78, 264, 79, 264, 80, 264, 81, 264, 82, 264, 83, - 264, 84, 264, 85, 264, 86, 264, 87, 264, 88, 264, 89, 264, 90, 264, 91, - 264, 92, 264, 93, 264, 94, 264, 95, 264, 96, 264, 97, 264, 98, 264, 99, - 264, 100, 264, 101, 264, 102, 264, 103, 264, 104, 264, 105, 264, 106, - 264, 107, 264, 108, 264, 109, 264, 110, 264, 111, 264, 112, 264, 113, - 264, 114, 264, 115, 264, 116, 264, 117, 264, 118, 264, 119, 264, 120, - 264, 121, 264, 122, 264, 123, 264, 124, 264, 125, 264, 126, 264, 10629, - 264, 10630, 272, 12290, 272, 12300, 272, 12301, 272, 12289, 272, 12539, - 272, 12530, 272, 12449, 272, 12451, 272, 12453, 272, 12455, 272, 12457, - 272, 12515, 272, 12517, 272, 12519, 272, 12483, 272, 12540, 272, 12450, - 272, 12452, 272, 12454, 272, 12456, 272, 12458, 272, 12459, 272, 12461, - 272, 12463, 272, 12465, 272, 12467, 272, 12469, 272, 12471, 272, 12473, - 272, 12475, 272, 12477, 272, 12479, 272, 12481, 272, 12484, 272, 12486, - 272, 12488, 272, 12490, 272, 12491, 272, 12492, 272, 12493, 272, 12494, - 272, 12495, 272, 12498, 272, 12501, 272, 12504, 272, 12507, 272, 12510, - 272, 12511, 272, 12512, 272, 12513, 272, 12514, 272, 12516, 272, 12518, - 272, 12520, 272, 12521, 272, 12522, 272, 12523, 272, 12524, 272, 12525, - 272, 12527, 272, 12531, 272, 12441, 272, 12442, 272, 12644, 272, 12593, - 272, 12594, 272, 12595, 272, 12596, 272, 12597, 272, 12598, 272, 12599, - 272, 12600, 272, 12601, 272, 12602, 272, 12603, 272, 12604, 272, 12605, - 272, 12606, 272, 12607, 272, 12608, 272, 12609, 272, 12610, 272, 12611, - 272, 12612, 272, 12613, 272, 12614, 272, 12615, 272, 12616, 272, 12617, - 272, 12618, 272, 12619, 272, 12620, 272, 12621, 272, 12622, 272, 12623, - 272, 12624, 272, 12625, 272, 12626, 272, 12627, 272, 12628, 272, 12629, - 272, 12630, 272, 12631, 272, 12632, 272, 12633, 272, 12634, 272, 12635, - 272, 12636, 272, 12637, 272, 12638, 272, 12639, 272, 12640, 272, 12641, - 272, 12642, 272, 12643, 264, 162, 264, 163, 264, 172, 264, 175, 264, 166, - 264, 165, 264, 8361, 272, 9474, 272, 8592, 272, 8593, 272, 8594, 272, - 8595, 272, 9632, 272, 9675, 512, 69785, 69818, 512, 69787, 69818, 512, - 69797, 69818, 512, 119127, 119141, 512, 119128, 119141, 512, 119135, - 119150, 512, 119135, 119151, 512, 119135, 119152, 512, 119135, 119153, - 512, 119135, 119154, 512, 119225, 119141, 512, 119226, 119141, 512, - 119227, 119150, 512, 119228, 119150, 512, 119227, 119151, 512, 119228, - 119151, 262, 65, 262, 66, 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, - 262, 72, 262, 73, 262, 74, 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, - 262, 80, 262, 81, 262, 82, 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, - 262, 88, 262, 89, 262, 90, 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, - 262, 102, 262, 103, 262, 104, 262, 105, 262, 106, 262, 107, 262, 108, - 262, 109, 262, 110, 262, 111, 262, 112, 262, 113, 262, 114, 262, 115, - 262, 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, 122, - 262, 65, 262, 66, 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, 262, 72, - 262, 73, 262, 74, 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, 262, 80, - 262, 81, 262, 82, 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, - 262, 89, 262, 90, 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, 262, - 102, 262, 103, 262, 105, 262, 106, 262, 107, 262, 108, 262, 109, 262, - 110, 262, 111, 262, 112, 262, 113, 262, 114, 262, 115, 262, 116, 262, - 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, 122, 262, 65, 262, 66, - 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, 262, 72, 262, 73, 262, 74, - 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, 262, 80, 262, 81, 262, 82, - 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, 262, 89, 262, 90, - 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, 262, 102, 262, 103, 262, - 104, 262, 105, 262, 106, 262, 107, 262, 108, 262, 109, 262, 110, 262, - 111, 262, 112, 262, 113, 262, 114, 262, 115, 262, 116, 262, 117, 262, - 118, 262, 119, 262, 120, 262, 121, 262, 122, 262, 65, 262, 67, 262, 68, - 262, 71, 262, 74, 262, 75, 262, 78, 262, 79, 262, 80, 262, 81, 262, 83, - 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, 262, 89, 262, 90, 262, 97, - 262, 98, 262, 99, 262, 100, 262, 102, 262, 104, 262, 105, 262, 106, 262, - 107, 262, 108, 262, 109, 262, 110, 262, 112, 262, 113, 262, 114, 262, - 115, 262, 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, - 122, 262, 65, 262, 66, 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, 262, - 72, 262, 73, 262, 74, 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, 262, - 80, 262, 81, 262, 82, 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, 262, - 88, 262, 89, 262, 90, 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, 262, - 102, 262, 103, 262, 104, 262, 105, 262, 106, 262, 107, 262, 108, 262, - 109, 262, 110, 262, 111, 262, 112, 262, 113, 262, 114, 262, 115, 262, - 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, 122, 262, 65, - 262, 66, 262, 68, 262, 69, 262, 70, 262, 71, 262, 74, 262, 75, 262, 76, - 262, 77, 262, 78, 262, 79, 262, 80, 262, 81, 262, 83, 262, 84, 262, 85, - 262, 86, 262, 87, 262, 88, 262, 89, 262, 97, 262, 98, 262, 99, 262, 100, - 262, 101, 262, 102, 262, 103, 262, 104, 262, 105, 262, 106, 262, 107, - 262, 108, 262, 109, 262, 110, 262, 111, 262, 112, 262, 113, 262, 114, - 262, 115, 262, 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, - 262, 122, 262, 65, 262, 66, 262, 68, 262, 69, 262, 70, 262, 71, 262, 73, - 262, 74, 262, 75, 262, 76, 262, 77, 262, 79, 262, 83, 262, 84, 262, 85, - 262, 86, 262, 87, 262, 88, 262, 89, 262, 97, 262, 98, 262, 99, 262, 100, - 262, 101, 262, 102, 262, 103, 262, 104, 262, 105, 262, 106, 262, 107, - 262, 108, 262, 109, 262, 110, 262, 111, 262, 112, 262, 113, 262, 114, - 262, 115, 262, 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, - 262, 122, 262, 65, 262, 66, 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, - 262, 72, 262, 73, 262, 74, 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, - 262, 80, 262, 81, 262, 82, 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, - 262, 88, 262, 89, 262, 90, 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, - 262, 102, 262, 103, 262, 104, 262, 105, 262, 106, 262, 107, 262, 108, - 262, 109, 262, 110, 262, 111, 262, 112, 262, 113, 262, 114, 262, 115, - 262, 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, 122, - 262, 65, 262, 66, 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, 262, 72, - 262, 73, 262, 74, 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, 262, 80, - 262, 81, 262, 82, 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, - 262, 89, 262, 90, 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, 262, - 102, 262, 103, 262, 104, 262, 105, 262, 106, 262, 107, 262, 108, 262, - 109, 262, 110, 262, 111, 262, 112, 262, 113, 262, 114, 262, 115, 262, - 116, 262, 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, 122, 262, 65, - 262, 66, 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, 262, 72, 262, 73, - 262, 74, 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, 262, 80, 262, 81, - 262, 82, 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, 262, 89, - 262, 90, 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, 262, 102, 262, - 103, 262, 104, 262, 105, 262, 106, 262, 107, 262, 108, 262, 109, 262, - 110, 262, 111, 262, 112, 262, 113, 262, 114, 262, 115, 262, 116, 262, - 117, 262, 118, 262, 119, 262, 120, 262, 121, 262, 122, 262, 65, 262, 66, - 262, 67, 262, 68, 262, 69, 262, 70, 262, 71, 262, 72, 262, 73, 262, 74, - 262, 75, 262, 76, 262, 77, 262, 78, 262, 79, 262, 80, 262, 81, 262, 82, - 262, 83, 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, 262, 89, 262, 90, - 262, 97, 262, 98, 262, 99, 262, 100, 262, 101, 262, 102, 262, 103, 262, - 104, 262, 105, 262, 106, 262, 107, 262, 108, 262, 109, 262, 110, 262, - 111, 262, 112, 262, 113, 262, 114, 262, 115, 262, 116, 262, 117, 262, - 118, 262, 119, 262, 120, 262, 121, 262, 122, 262, 65, 262, 66, 262, 67, - 262, 68, 262, 69, 262, 70, 262, 71, 262, 72, 262, 73, 262, 74, 262, 75, - 262, 76, 262, 77, 262, 78, 262, 79, 262, 80, 262, 81, 262, 82, 262, 83, - 262, 84, 262, 85, 262, 86, 262, 87, 262, 88, 262, 89, 262, 90, 262, 97, - 262, 98, 262, 99, 262, 100, 262, 101, 262, 102, 262, 103, 262, 104, 262, - 105, 262, 106, 262, 107, 262, 108, 262, 109, 262, 110, 262, 111, 262, - 112, 262, 113, 262, 114, 262, 115, 262, 116, 262, 117, 262, 118, 262, - 119, 262, 120, 262, 121, 262, 122, 262, 65, 262, 66, 262, 67, 262, 68, - 262, 69, 262, 70, 262, 71, 262, 72, 262, 73, 262, 74, 262, 75, 262, 76, - 262, 77, 262, 78, 262, 79, 262, 80, 262, 81, 262, 82, 262, 83, 262, 84, - 262, 85, 262, 86, 262, 87, 262, 88, 262, 89, 262, 90, 262, 97, 262, 98, - 262, 99, 262, 100, 262, 101, 262, 102, 262, 103, 262, 104, 262, 105, 262, - 106, 262, 107, 262, 108, 262, 109, 262, 110, 262, 111, 262, 112, 262, - 113, 262, 114, 262, 115, 262, 116, 262, 117, 262, 118, 262, 119, 262, - 120, 262, 121, 262, 122, 262, 305, 262, 567, 262, 913, 262, 914, 262, - 915, 262, 916, 262, 917, 262, 918, 262, 919, 262, 920, 262, 921, 262, - 922, 262, 923, 262, 924, 262, 925, 262, 926, 262, 927, 262, 928, 262, - 929, 262, 1012, 262, 931, 262, 932, 262, 933, 262, 934, 262, 935, 262, - 936, 262, 937, 262, 8711, 262, 945, 262, 946, 262, 947, 262, 948, 262, - 949, 262, 950, 262, 951, 262, 952, 262, 953, 262, 954, 262, 955, 262, - 956, 262, 957, 262, 958, 262, 959, 262, 960, 262, 961, 262, 962, 262, - 963, 262, 964, 262, 965, 262, 966, 262, 967, 262, 968, 262, 969, 262, - 8706, 262, 1013, 262, 977, 262, 1008, 262, 981, 262, 1009, 262, 982, 262, - 913, 262, 914, 262, 915, 262, 916, 262, 917, 262, 918, 262, 919, 262, - 920, 262, 921, 262, 922, 262, 923, 262, 924, 262, 925, 262, 926, 262, - 927, 262, 928, 262, 929, 262, 1012, 262, 931, 262, 932, 262, 933, 262, - 934, 262, 935, 262, 936, 262, 937, 262, 8711, 262, 945, 262, 946, 262, - 947, 262, 948, 262, 949, 262, 950, 262, 951, 262, 952, 262, 953, 262, - 954, 262, 955, 262, 956, 262, 957, 262, 958, 262, 959, 262, 960, 262, - 961, 262, 962, 262, 963, 262, 964, 262, 965, 262, 966, 262, 967, 262, - 968, 262, 969, 262, 8706, 262, 1013, 262, 977, 262, 1008, 262, 981, 262, - 1009, 262, 982, 262, 913, 262, 914, 262, 915, 262, 916, 262, 917, 262, - 918, 262, 919, 262, 920, 262, 921, 262, 922, 262, 923, 262, 924, 262, - 925, 262, 926, 262, 927, 262, 928, 262, 929, 262, 1012, 262, 931, 262, - 932, 262, 933, 262, 934, 262, 935, 262, 936, 262, 937, 262, 8711, 262, - 945, 262, 946, 262, 947, 262, 948, 262, 949, 262, 950, 262, 951, 262, - 952, 262, 953, 262, 954, 262, 955, 262, 956, 262, 957, 262, 958, 262, - 959, 262, 960, 262, 961, 262, 962, 262, 963, 262, 964, 262, 965, 262, - 966, 262, 967, 262, 968, 262, 969, 262, 8706, 262, 1013, 262, 977, 262, - 1008, 262, 981, 262, 1009, 262, 982, 262, 913, 262, 914, 262, 915, 262, - 916, 262, 917, 262, 918, 262, 919, 262, 920, 262, 921, 262, 922, 262, - 923, 262, 924, 262, 925, 262, 926, 262, 927, 262, 928, 262, 929, 262, - 1012, 262, 931, 262, 932, 262, 933, 262, 934, 262, 935, 262, 936, 262, - 937, 262, 8711, 262, 945, 262, 946, 262, 947, 262, 948, 262, 949, 262, - 950, 262, 951, 262, 952, 262, 953, 262, 954, 262, 955, 262, 956, 262, - 957, 262, 958, 262, 959, 262, 960, 262, 961, 262, 962, 262, 963, 262, - 964, 262, 965, 262, 966, 262, 967, 262, 968, 262, 969, 262, 8706, 262, - 1013, 262, 977, 262, 1008, 262, 981, 262, 1009, 262, 982, 262, 913, 262, - 914, 262, 915, 262, 916, 262, 917, 262, 918, 262, 919, 262, 920, 262, - 921, 262, 922, 262, 923, 262, 924, 262, 925, 262, 926, 262, 927, 262, - 928, 262, 929, 262, 1012, 262, 931, 262, 932, 262, 933, 262, 934, 262, - 935, 262, 936, 262, 937, 262, 8711, 262, 945, 262, 946, 262, 947, 262, - 948, 262, 949, 262, 950, 262, 951, 262, 952, 262, 953, 262, 954, 262, - 955, 262, 956, 262, 957, 262, 958, 262, 959, 262, 960, 262, 961, 262, - 962, 262, 963, 262, 964, 262, 965, 262, 966, 262, 967, 262, 968, 262, - 969, 262, 8706, 262, 1013, 262, 977, 262, 1008, 262, 981, 262, 1009, 262, - 982, 262, 988, 262, 989, 262, 48, 262, 49, 262, 50, 262, 51, 262, 52, - 262, 53, 262, 54, 262, 55, 262, 56, 262, 57, 262, 48, 262, 49, 262, 50, - 262, 51, 262, 52, 262, 53, 262, 54, 262, 55, 262, 56, 262, 57, 262, 48, - 262, 49, 262, 50, 262, 51, 262, 52, 262, 53, 262, 54, 262, 55, 262, 56, - 262, 57, 262, 48, 262, 49, 262, 50, 262, 51, 262, 52, 262, 53, 262, 54, - 262, 55, 262, 56, 262, 57, 262, 48, 262, 49, 262, 50, 262, 51, 262, 52, - 262, 53, 262, 54, 262, 55, 262, 56, 262, 57, 514, 48, 46, 514, 48, 44, - 514, 49, 44, 514, 50, 44, 514, 51, 44, 514, 52, 44, 514, 53, 44, 514, 54, - 44, 514, 55, 44, 514, 56, 44, 514, 57, 44, 770, 40, 65, 41, 770, 40, 66, - 41, 770, 40, 67, 41, 770, 40, 68, 41, 770, 40, 69, 41, 770, 40, 70, 41, - 770, 40, 71, 41, 770, 40, 72, 41, 770, 40, 73, 41, 770, 40, 74, 41, 770, - 40, 75, 41, 770, 40, 76, 41, 770, 40, 77, 41, 770, 40, 78, 41, 770, 40, - 79, 41, 770, 40, 80, 41, 770, 40, 81, 41, 770, 40, 82, 41, 770, 40, 83, - 41, 770, 40, 84, 41, 770, 40, 85, 41, 770, 40, 86, 41, 770, 40, 87, 41, - 770, 40, 88, 41, 770, 40, 89, 41, 770, 40, 90, 41, 770, 12308, 83, 12309, - 263, 67, 263, 82, 519, 67, 68, 519, 87, 90, 266, 66, 266, 78, 266, 80, - 266, 83, 266, 87, 522, 72, 86, 522, 77, 86, 522, 83, 68, 522, 83, 83, - 778, 80, 80, 86, 522, 68, 74, 522, 12411, 12363, 266, 25163, 266, 23383, - 266, 21452, 266, 12487, 266, 20108, 266, 22810, 266, 35299, 266, 22825, - 266, 20132, 266, 26144, 266, 28961, 266, 26009, 266, 21069, 266, 24460, - 266, 20877, 266, 26032, 266, 21021, 266, 32066, 266, 29983, 266, 36009, - 266, 22768, 266, 21561, 266, 28436, 266, 25237, 266, 25429, 266, 19968, - 266, 19977, 266, 36938, 266, 24038, 266, 20013, 266, 21491, 266, 25351, - 266, 36208, 266, 25171, 770, 12308, 26412, 12309, 770, 12308, 19977, - 12309, 770, 12308, 20108, 12309, 770, 12308, 23433, 12309, 770, 12308, - 28857, 12309, 770, 12308, 25171, 12309, 770, 12308, 30423, 12309, 770, - 12308, 21213, 12309, 770, 12308, 25943, 12309, 256, 20029, 256, 20024, - 256, 20033, 256, 131362, 256, 20320, 256, 20398, 256, 20411, 256, 20482, - 256, 20602, 256, 20633, 256, 20711, 256, 20687, 256, 13470, 256, 132666, - 256, 20813, 256, 20820, 256, 20836, 256, 20855, 256, 132380, 256, 13497, - 256, 20839, 256, 20877, 256, 132427, 256, 20887, 256, 20900, 256, 20172, - 256, 20908, 256, 20917, 256, 168415, 256, 20981, 256, 20995, 256, 13535, - 256, 21051, 256, 21062, 256, 21106, 256, 21111, 256, 13589, 256, 21191, - 256, 21193, 256, 21220, 256, 21242, 256, 21253, 256, 21254, 256, 21271, - 256, 21321, 256, 21329, 256, 21338, 256, 21363, 256, 21373, 256, 21375, - 256, 21375, 256, 21375, 256, 133676, 256, 28784, 256, 21450, 256, 21471, - 256, 133987, 256, 21483, 256, 21489, 256, 21510, 256, 21662, 256, 21560, - 256, 21576, 256, 21608, 256, 21666, 256, 21750, 256, 21776, 256, 21843, - 256, 21859, 256, 21892, 256, 21892, 256, 21913, 256, 21931, 256, 21939, - 256, 21954, 256, 22294, 256, 22022, 256, 22295, 256, 22097, 256, 22132, - 256, 20999, 256, 22766, 256, 22478, 256, 22516, 256, 22541, 256, 22411, - 256, 22578, 256, 22577, 256, 22700, 256, 136420, 256, 22770, 256, 22775, - 256, 22790, 256, 22810, 256, 22818, 256, 22882, 256, 136872, 256, 136938, - 256, 23020, 256, 23067, 256, 23079, 256, 23000, 256, 23142, 256, 14062, - 256, 14076, 256, 23304, 256, 23358, 256, 23358, 256, 137672, 256, 23491, - 256, 23512, 256, 23527, 256, 23539, 256, 138008, 256, 23551, 256, 23558, - 256, 24403, 256, 23586, 256, 14209, 256, 23648, 256, 23662, 256, 23744, - 256, 23693, 256, 138724, 256, 23875, 256, 138726, 256, 23918, 256, 23915, - 256, 23932, 256, 24033, 256, 24034, 256, 14383, 256, 24061, 256, 24104, - 256, 24125, 256, 24169, 256, 14434, 256, 139651, 256, 14460, 256, 24240, - 256, 24243, 256, 24246, 256, 24266, 256, 172946, 256, 24318, 256, 140081, - 256, 140081, 256, 33281, 256, 24354, 256, 24354, 256, 14535, 256, 144056, - 256, 156122, 256, 24418, 256, 24427, 256, 14563, 256, 24474, 256, 24525, - 256, 24535, 256, 24569, 256, 24705, 256, 14650, 256, 14620, 256, 24724, - 256, 141012, 256, 24775, 256, 24904, 256, 24908, 256, 24910, 256, 24908, - 256, 24954, 256, 24974, 256, 25010, 256, 24996, 256, 25007, 256, 25054, - 256, 25074, 256, 25078, 256, 25104, 256, 25115, 256, 25181, 256, 25265, - 256, 25300, 256, 25424, 256, 142092, 256, 25405, 256, 25340, 256, 25448, - 256, 25475, 256, 25572, 256, 142321, 256, 25634, 256, 25541, 256, 25513, - 256, 14894, 256, 25705, 256, 25726, 256, 25757, 256, 25719, 256, 14956, - 256, 25935, 256, 25964, 256, 143370, 256, 26083, 256, 26360, 256, 26185, - 256, 15129, 256, 26257, 256, 15112, 256, 15076, 256, 20882, 256, 20885, - 256, 26368, 256, 26268, 256, 32941, 256, 17369, 256, 26391, 256, 26395, - 256, 26401, 256, 26462, 256, 26451, 256, 144323, 256, 15177, 256, 26618, - 256, 26501, 256, 26706, 256, 26757, 256, 144493, 256, 26766, 256, 26655, - 256, 26900, 256, 15261, 256, 26946, 256, 27043, 256, 27114, 256, 27304, - 256, 145059, 256, 27355, 256, 15384, 256, 27425, 256, 145575, 256, 27476, - 256, 15438, 256, 27506, 256, 27551, 256, 27578, 256, 27579, 256, 146061, - 256, 138507, 256, 146170, 256, 27726, 256, 146620, 256, 27839, 256, - 27853, 256, 27751, 256, 27926, 256, 27966, 256, 28023, 256, 27969, 256, - 28009, 256, 28024, 256, 28037, 256, 146718, 256, 27956, 256, 28207, 256, - 28270, 256, 15667, 256, 28363, 256, 28359, 256, 147153, 256, 28153, 256, - 28526, 256, 147294, 256, 147342, 256, 28614, 256, 28729, 256, 28702, 256, - 28699, 256, 15766, 256, 28746, 256, 28797, 256, 28791, 256, 28845, 256, - 132389, 256, 28997, 256, 148067, 256, 29084, 256, 148395, 256, 29224, - 256, 29237, 256, 29264, 256, 149000, 256, 29312, 256, 29333, 256, 149301, - 256, 149524, 256, 29562, 256, 29579, 256, 16044, 256, 29605, 256, 16056, - 256, 16056, 256, 29767, 256, 29788, 256, 29809, 256, 29829, 256, 29898, - 256, 16155, 256, 29988, 256, 150582, 256, 30014, 256, 150674, 256, 30064, - 256, 139679, 256, 30224, 256, 151457, 256, 151480, 256, 151620, 256, - 16380, 256, 16392, 256, 30452, 256, 151795, 256, 151794, 256, 151833, - 256, 151859, 256, 30494, 256, 30495, 256, 30495, 256, 30538, 256, 16441, - 256, 30603, 256, 16454, 256, 16534, 256, 152605, 256, 30798, 256, 30860, - 256, 30924, 256, 16611, 256, 153126, 256, 31062, 256, 153242, 256, - 153285, 256, 31119, 256, 31211, 256, 16687, 256, 31296, 256, 31306, 256, - 31311, 256, 153980, 256, 154279, 256, 154279, 256, 31470, 256, 16898, - 256, 154539, 256, 31686, 256, 31689, 256, 16935, 256, 154752, 256, 31954, - 256, 17056, 256, 31976, 256, 31971, 256, 32000, 256, 155526, 256, 32099, - 256, 17153, 256, 32199, 256, 32258, 256, 32325, 256, 17204, 256, 156200, - 256, 156231, 256, 17241, 256, 156377, 256, 32634, 256, 156478, 256, - 32661, 256, 32762, 256, 32773, 256, 156890, 256, 156963, 256, 32864, 256, - 157096, 256, 32880, 256, 144223, 256, 17365, 256, 32946, 256, 33027, 256, - 17419, 256, 33086, 256, 23221, 256, 157607, 256, 157621, 256, 144275, - 256, 144284, 256, 33281, 256, 33284, 256, 36766, 256, 17515, 256, 33425, - 256, 33419, 256, 33437, 256, 21171, 256, 33457, 256, 33459, 256, 33469, - 256, 33510, 256, 158524, 256, 33509, 256, 33565, 256, 33635, 256, 33709, - 256, 33571, 256, 33725, 256, 33767, 256, 33879, 256, 33619, 256, 33738, - 256, 33740, 256, 33756, 256, 158774, 256, 159083, 256, 158933, 256, - 17707, 256, 34033, 256, 34035, 256, 34070, 256, 160714, 256, 34148, 256, - 159532, 256, 17757, 256, 17761, 256, 159665, 256, 159954, 256, 17771, - 256, 34384, 256, 34396, 256, 34407, 256, 34409, 256, 34473, 256, 34440, - 256, 34574, 256, 34530, 256, 34681, 256, 34600, 256, 34667, 256, 34694, - 256, 17879, 256, 34785, 256, 34817, 256, 17913, 256, 34912, 256, 34915, - 256, 161383, 256, 35031, 256, 35038, 256, 17973, 256, 35066, 256, 13499, - 256, 161966, 256, 162150, 256, 18110, 256, 18119, 256, 35488, 256, 35565, - 256, 35722, 256, 35925, 256, 162984, 256, 36011, 256, 36033, 256, 36123, - 256, 36215, 256, 163631, 256, 133124, 256, 36299, 256, 36284, 256, 36336, - 256, 133342, 256, 36564, 256, 36664, 256, 165330, 256, 165357, 256, - 37012, 256, 37105, 256, 37137, 256, 165678, 256, 37147, 256, 37432, 256, - 37591, 256, 37592, 256, 37500, 256, 37881, 256, 37909, 256, 166906, 256, - 38283, 256, 18837, 256, 38327, 256, 167287, 256, 18918, 256, 38595, 256, - 23986, 256, 38691, 256, 168261, 256, 168474, 256, 19054, 256, 19062, 256, - 38880, 256, 168970, 256, 19122, 256, 169110, 256, 38923, 256, 38923, 256, - 38953, 256, 169398, 256, 39138, 256, 19251, 256, 39209, 256, 39335, 256, - 39362, 256, 39422, 256, 19406, 256, 170800, 256, 39698, 256, 40000, 256, - 40189, 256, 19662, 256, 19693, 256, 40295, 256, 172238, 256, 19704, 256, - 172293, 256, 172558, 256, 172689, 256, 40635, 256, 19798, 256, 40697, - 256, 40702, 256, 40709, 256, 40719, 256, 40726, 256, 40763, 256, 173568, -}; - -/* index tables for the decomposition data */ -#define DECOMP_SHIFT 8 -static unsigned char decomp_index1[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 16, 7, 17, 18, 19, 20, 21, 22, 23, 24, 7, 7, 7, 7, 7, 25, - 7, 26, 27, 28, 29, 30, 31, 32, 33, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 34, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 35, 36, 37, 38, 39, 40, - 41, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 42, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 43, 7, 7, 44, 45, - 46, 47, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 48, 49, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 50, 51, 52, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, -}; - -static unsigned short decomp_index2[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 6, 0, 0, 0, 0, 8, 0, 0, 11, 13, 15, 18, 0, 0, 20, 23, 25, 0, 27, - 31, 35, 0, 39, 42, 45, 48, 51, 54, 0, 57, 60, 63, 66, 69, 72, 75, 78, 81, - 0, 84, 87, 90, 93, 96, 99, 0, 0, 102, 105, 108, 111, 114, 0, 0, 117, 120, - 123, 126, 129, 132, 0, 135, 138, 141, 144, 147, 150, 153, 156, 159, 0, - 162, 165, 168, 171, 174, 177, 0, 0, 180, 183, 186, 189, 192, 0, 195, 198, - 201, 204, 207, 210, 213, 216, 219, 222, 225, 228, 231, 234, 237, 240, - 243, 0, 0, 246, 249, 252, 255, 258, 261, 264, 267, 270, 273, 276, 279, - 282, 285, 288, 291, 294, 297, 300, 303, 0, 0, 306, 309, 312, 315, 318, - 321, 324, 327, 330, 0, 333, 336, 339, 342, 345, 348, 0, 351, 354, 357, - 360, 363, 366, 369, 372, 0, 0, 375, 378, 381, 384, 387, 390, 393, 0, 0, - 396, 399, 402, 405, 408, 411, 0, 0, 414, 417, 420, 423, 426, 429, 432, - 435, 438, 441, 444, 447, 450, 453, 456, 459, 462, 465, 0, 0, 468, 471, - 474, 477, 480, 483, 486, 489, 492, 495, 498, 501, 504, 507, 510, 513, - 516, 519, 522, 525, 528, 531, 534, 537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 539, 542, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 545, 548, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 551, 554, 557, 560, 563, 566, 569, 572, - 575, 578, 581, 584, 587, 590, 593, 596, 599, 602, 605, 608, 611, 614, - 617, 620, 623, 0, 626, 629, 632, 635, 638, 641, 0, 0, 644, 647, 650, 653, - 656, 659, 662, 665, 668, 671, 674, 677, 680, 683, 686, 689, 0, 0, 692, - 695, 698, 701, 704, 707, 710, 713, 716, 719, 722, 725, 728, 731, 734, - 737, 740, 743, 746, 749, 752, 755, 758, 761, 764, 767, 770, 773, 776, - 779, 782, 785, 788, 791, 794, 797, 0, 0, 800, 803, 0, 0, 0, 0, 0, 0, 806, - 809, 812, 815, 818, 821, 824, 827, 830, 833, 836, 839, 842, 845, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 848, 850, 852, 854, 856, 858, 860, 862, 864, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 866, - 869, 872, 875, 878, 881, 0, 0, 884, 886, 888, 890, 892, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 894, 896, 0, 898, 900, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 903, 0, 0, 0, 0, - 0, 905, 0, 0, 0, 908, 0, 0, 0, 0, 0, 910, 913, 916, 919, 921, 924, 927, - 0, 930, 0, 933, 936, 939, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 942, 945, 948, 951, 954, 957, 960, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 963, 966, - 969, 972, 975, 0, 978, 980, 982, 984, 987, 990, 992, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 994, 996, 998, 0, - 1000, 1002, 0, 0, 0, 1004, 0, 0, 0, 0, 0, 0, 1006, 1009, 0, 1012, 0, 0, - 0, 1015, 0, 0, 0, 0, 1018, 1021, 1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1027, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1030, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1033, 1036, 0, 1039, 0, 0, 0, 1042, 0, 0, 0, - 0, 1045, 1048, 1051, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1054, 1057, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1060, 1063, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1066, 1069, 1072, 1075, 0, 0, 1078, 1081, 0, 0, 1084, 1087, - 1090, 1093, 1096, 1099, 0, 0, 1102, 1105, 1108, 1111, 1114, 1117, 0, 0, - 1120, 1123, 1126, 1129, 1132, 1135, 1138, 1141, 1144, 1147, 1150, 1153, - 0, 0, 1156, 1159, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1165, 1168, 1171, 1174, - 1177, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1180, 1183, 1186, 1189, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1192, 0, 1195, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1198, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1201, 0, 0, 0, - 0, 0, 0, 0, 1204, 0, 0, 1207, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1210, - 1213, 1216, 1219, 1222, 1225, 1228, 1231, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1234, 1237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1240, 1243, - 0, 1246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1249, 0, 0, 1252, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1255, 1258, 1261, 0, 0, 1264, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1267, 0, 0, 1270, 1273, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1276, 1279, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1282, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1285, 1288, 1291, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1294, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1297, 0, 0, 0, 0, 0, 0, 1300, 1303, 0, - 1306, 1309, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1312, 1315, 1318, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1321, 0, 1324, 1327, 1330, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1336, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1339, 1342, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1345, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1347, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1350, 0, 0, 0, 0, 1353, 0, 0, 0, 0, - 1356, 0, 0, 0, 0, 1359, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1362, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1365, 0, 1368, 1371, 1374, 1377, 1380, 0, 0, 0, 0, - 0, 0, 0, 1383, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1386, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1389, 0, 0, 0, 0, 1392, 0, 0, 0, 0, 1395, 0, - 0, 0, 0, 1398, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1401, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1404, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1407, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1409, 0, 1412, 0, - 1415, 0, 1418, 0, 1421, 0, 0, 0, 1424, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1427, 0, 1430, 0, 0, 1433, 1436, 0, 1439, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1442, 1444, 1446, 0, 1448, 1450, 1452, - 1454, 1456, 1458, 1460, 1462, 1464, 1466, 1468, 0, 1470, 1472, 1474, - 1476, 1478, 1480, 1482, 1484, 1486, 1488, 1490, 1492, 1494, 1496, 1498, - 1500, 1502, 1504, 0, 1506, 1508, 1510, 1512, 1514, 1516, 1518, 1520, - 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1536, 1538, 1540, 1542, 1544, - 1546, 1548, 1550, 1552, 1554, 1556, 1558, 1560, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1562, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1564, 1566, 1568, - 1570, 1572, 1574, 1576, 1578, 1580, 1582, 1584, 1586, 1588, 1590, 1592, - 1594, 1596, 1598, 1600, 1602, 1604, 1606, 1608, 1610, 1612, 1614, 1616, - 1618, 1620, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1638, 1641, 1644, 1647, 1650, 1653, - 1656, 1659, 1662, 1665, 1668, 1671, 1674, 1677, 1680, 1683, 1686, 1689, - 1692, 1695, 1698, 1701, 1704, 1707, 1710, 1713, 1716, 1719, 1722, 1725, - 1728, 1731, 1734, 1737, 1740, 1743, 1746, 1749, 1752, 1755, 1758, 1761, - 1764, 1767, 1770, 1773, 1776, 1779, 1782, 1785, 1788, 1791, 1794, 1797, - 1800, 1803, 1806, 1809, 1812, 1815, 1818, 1821, 1824, 1827, 1830, 1833, - 1836, 1839, 1842, 1845, 1848, 1851, 1854, 1857, 1860, 1863, 1866, 1869, - 1872, 1875, 1878, 1881, 1884, 1887, 1890, 1893, 1896, 1899, 1902, 1905, - 1908, 1911, 1914, 1917, 1920, 1923, 1926, 1929, 1932, 1935, 1938, 1941, - 1944, 1947, 1950, 1953, 1956, 1959, 1962, 1965, 1968, 1971, 1974, 1977, - 1980, 1983, 1986, 1989, 1992, 1995, 1998, 2001, 2004, 2007, 2010, 2013, - 2016, 2019, 2022, 2025, 2028, 2031, 2034, 2037, 2040, 2043, 2046, 2049, - 2052, 2055, 2058, 2061, 2064, 2067, 2070, 2073, 2076, 2079, 2082, 2085, - 2088, 2091, 2094, 2097, 2100, 2103, 0, 0, 0, 0, 2106, 2109, 2112, 2115, - 2118, 2121, 2124, 2127, 2130, 2133, 2136, 2139, 2142, 2145, 2148, 2151, - 2154, 2157, 2160, 2163, 2166, 2169, 2172, 2175, 2178, 2181, 2184, 2187, - 2190, 2193, 2196, 2199, 2202, 2205, 2208, 2211, 2214, 2217, 2220, 2223, - 2226, 2229, 2232, 2235, 2238, 2241, 2244, 2247, 2250, 2253, 2256, 2259, - 2262, 2265, 2268, 2271, 2274, 2277, 2280, 2283, 2286, 2289, 2292, 2295, - 2298, 2301, 2304, 2307, 2310, 2313, 2316, 2319, 2322, 2325, 2328, 2331, - 2334, 2337, 2340, 2343, 2346, 2349, 2352, 2355, 2358, 2361, 2364, 2367, - 2370, 2373, 0, 0, 0, 0, 0, 0, 2376, 2379, 2382, 2385, 2388, 2391, 2394, - 2397, 2400, 2403, 2406, 2409, 2412, 2415, 2418, 2421, 2424, 2427, 2430, - 2433, 2436, 2439, 0, 0, 2442, 2445, 2448, 2451, 2454, 2457, 0, 0, 2460, - 2463, 2466, 2469, 2472, 2475, 2478, 2481, 2484, 2487, 2490, 2493, 2496, - 2499, 2502, 2505, 2508, 2511, 2514, 2517, 2520, 2523, 2526, 2529, 2532, - 2535, 2538, 2541, 2544, 2547, 2550, 2553, 2556, 2559, 2562, 2565, 2568, - 2571, 0, 0, 2574, 2577, 2580, 2583, 2586, 2589, 0, 0, 2592, 2595, 2598, - 2601, 2604, 2607, 2610, 2613, 0, 2616, 0, 2619, 0, 2622, 0, 2625, 2628, - 2631, 2634, 2637, 2640, 2643, 2646, 2649, 2652, 2655, 2658, 2661, 2664, - 2667, 2670, 2673, 2676, 2679, 2681, 2684, 2686, 2689, 2691, 2694, 2696, - 2699, 2701, 2704, 2706, 2709, 0, 0, 2711, 2714, 2717, 2720, 2723, 2726, - 2729, 2732, 2735, 2738, 2741, 2744, 2747, 2750, 2753, 2756, 2759, 2762, - 2765, 2768, 2771, 2774, 2777, 2780, 2783, 2786, 2789, 2792, 2795, 2798, - 2801, 2804, 2807, 2810, 2813, 2816, 2819, 2822, 2825, 2828, 2831, 2834, - 2837, 2840, 2843, 2846, 2849, 2852, 2855, 2858, 2861, 2864, 2867, 0, - 2870, 2873, 2876, 2879, 2882, 2885, 2887, 2890, 2893, 2895, 2898, 2901, - 2904, 2907, 2910, 0, 2913, 2916, 2919, 2922, 2924, 2927, 2929, 2932, - 2935, 2938, 2941, 2944, 2947, 2950, 0, 0, 2952, 2955, 2958, 2961, 2964, - 2967, 0, 2969, 2972, 2975, 2978, 2981, 2984, 2987, 2989, 2992, 2995, - 2998, 3001, 3004, 3007, 3010, 3012, 3015, 3018, 3020, 0, 0, 3022, 3025, - 3028, 0, 3031, 3034, 3037, 3040, 3042, 3045, 3047, 3050, 3052, 0, 3055, - 3057, 3059, 3061, 3063, 3065, 3067, 3069, 3071, 3073, 3075, 0, 0, 0, 0, - 0, 0, 3077, 0, 0, 0, 0, 0, 3079, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3082, 3084, 3087, 0, 0, 0, 0, 0, 0, 0, 0, 3091, 0, 0, 0, 3093, 3096, 0, - 3100, 3103, 0, 0, 0, 0, 3107, 0, 3110, 0, 0, 0, 0, 0, 0, 0, 0, 3113, - 3116, 3119, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3122, 0, 0, 0, 0, 0, - 0, 0, 3127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3129, 3131, - 0, 0, 3133, 3135, 3137, 3139, 3141, 3143, 3145, 3147, 3149, 3151, 3153, - 3155, 3157, 3159, 3161, 3163, 3165, 3167, 3169, 3171, 3173, 3175, 3177, - 3179, 3181, 3183, 3185, 0, 3187, 3189, 3191, 3193, 3195, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3197, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3200, 3204, 3208, 3210, 0, 3213, 3217, 3221, 0, - 3223, 3226, 3228, 3230, 3232, 3234, 3236, 3238, 3240, 3242, 3244, 0, - 3246, 3248, 0, 0, 3251, 3253, 3255, 3257, 3259, 0, 0, 3261, 3264, 3268, - 0, 3271, 0, 3273, 0, 3275, 0, 3277, 3279, 3281, 3283, 0, 3285, 3287, - 3289, 0, 3291, 3293, 3295, 3297, 3299, 3301, 3303, 0, 3305, 3309, 3311, - 3313, 3315, 3317, 0, 0, 0, 0, 3319, 3321, 3323, 3325, 3327, 0, 0, 0, 0, - 0, 0, 3329, 3333, 3337, 3342, 3346, 3350, 3354, 3358, 3362, 3366, 3370, - 3374, 3378, 3382, 3386, 3390, 3393, 3395, 3398, 3402, 3405, 3407, 3410, - 3414, 3419, 3422, 3424, 3427, 3431, 3433, 3435, 3437, 3439, 3441, 3444, - 3448, 3451, 3453, 3456, 3460, 3465, 3468, 3470, 3473, 3477, 3479, 3481, - 3483, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3485, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3489, 3492, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 3495, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3498, 3501, 3504, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3507, 0, - 0, 0, 0, 3510, 0, 0, 3513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 3516, 0, 3519, 0, 0, 0, 0, 0, 3522, 3525, 0, - 3529, 3532, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3536, 0, 0, - 3539, 0, 0, 3542, 0, 3545, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3548, 0, 3551, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3554, - 3557, 3560, 3563, 3566, 0, 0, 3569, 3572, 0, 0, 3575, 3578, 0, 0, 0, 0, - 0, 0, 3581, 3584, 0, 0, 3587, 3590, 0, 0, 3593, 3596, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 3599, 3602, 3605, 3608, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3611, 3614, 3617, 3620, 0, 0, 0, 0, - 0, 0, 3623, 3626, 3629, 3632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3635, - 3637, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 3639, 3641, 3643, 3645, 3647, 3649, 3651, 3653, 3655, 3657, 3660, 3663, - 3666, 3669, 3672, 3675, 3678, 3681, 3684, 3687, 3690, 3694, 3698, 3702, - 3706, 3710, 3714, 3718, 3722, 3726, 3731, 3736, 3741, 3746, 3751, 3756, - 3761, 3766, 3771, 3776, 3781, 3784, 3787, 3790, 3793, 3796, 3799, 3802, - 3805, 3808, 3812, 3816, 3820, 3824, 3828, 3832, 3836, 3840, 3844, 3848, - 3852, 3856, 3860, 3864, 3868, 3872, 3876, 3880, 3884, 3888, 3892, 3896, - 3900, 3904, 3908, 3912, 3916, 3920, 3924, 3928, 3932, 3936, 3940, 3944, - 3948, 3952, 3956, 3958, 3960, 3962, 3964, 3966, 3968, 3970, 3972, 3974, - 3976, 3978, 3980, 3982, 3984, 3986, 3988, 3990, 3992, 3994, 3996, 3998, - 4000, 4002, 4004, 4006, 4008, 4010, 4012, 4014, 4016, 4018, 4020, 4022, - 4024, 4026, 4028, 4030, 4032, 4034, 4036, 4038, 4040, 4042, 4044, 4046, - 4048, 4050, 4052, 4054, 4056, 4058, 4060, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4062, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 4067, 4071, 4074, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4078, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4081, 4083, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4085, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4087, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 4089, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4091, 4093, 4095, 4097, 4099, - 4101, 4103, 4105, 4107, 4109, 4111, 4113, 4115, 4117, 4119, 4121, 4123, - 4125, 4127, 4129, 4131, 4133, 4135, 4137, 4139, 4141, 4143, 4145, 4147, - 4149, 4151, 4153, 4155, 4157, 4159, 4161, 4163, 4165, 4167, 4169, 4171, - 4173, 4175, 4177, 4179, 4181, 4183, 4185, 4187, 4189, 4191, 4193, 4195, - 4197, 4199, 4201, 4203, 4205, 4207, 4209, 4211, 4213, 4215, 4217, 4219, - 4221, 4223, 4225, 4227, 4229, 4231, 4233, 4235, 4237, 4239, 4241, 4243, - 4245, 4247, 4249, 4251, 4253, 4255, 4257, 4259, 4261, 4263, 4265, 4267, - 4269, 4271, 4273, 4275, 4277, 4279, 4281, 4283, 4285, 4287, 4289, 4291, - 4293, 4295, 4297, 4299, 4301, 4303, 4305, 4307, 4309, 4311, 4313, 4315, - 4317, 4319, 4321, 4323, 4325, 4327, 4329, 4331, 4333, 4335, 4337, 4339, - 4341, 4343, 4345, 4347, 4349, 4351, 4353, 4355, 4357, 4359, 4361, 4363, - 4365, 4367, 4369, 4371, 4373, 4375, 4377, 4379, 4381, 4383, 4385, 4387, - 4389, 4391, 4393, 4395, 4397, 4399, 4401, 4403, 4405, 4407, 4409, 4411, - 4413, 4415, 4417, 4419, 4421, 4423, 4425, 4427, 4429, 4431, 4433, 4435, - 4437, 4439, 4441, 4443, 4445, 4447, 4449, 4451, 4453, 4455, 4457, 4459, - 4461, 4463, 4465, 4467, 4469, 4471, 4473, 4475, 4477, 4479, 4481, 4483, - 4485, 4487, 4489, 4491, 4493, 4495, 4497, 4499, 4501, 4503, 4505, 4507, - 4509, 4511, 4513, 4515, 4517, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 4519, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4521, 0, 4523, 4525, 4527, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4529, 0, 4532, 0, 4535, 0, 4538, - 0, 4541, 0, 4544, 0, 4547, 0, 4550, 0, 4553, 0, 4556, 0, 4559, 0, 4562, - 0, 0, 4565, 0, 4568, 0, 4571, 0, 0, 0, 0, 0, 0, 4574, 4577, 0, 4580, - 4583, 0, 4586, 4589, 0, 4592, 4595, 0, 4598, 4601, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4604, 0, 0, 0, 0, 0, 0, - 4607, 4610, 0, 4613, 4616, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4619, 0, - 4622, 0, 4625, 0, 4628, 0, 4631, 0, 4634, 0, 4637, 0, 4640, 0, 4643, 0, - 4646, 0, 4649, 0, 4652, 0, 0, 4655, 0, 4658, 0, 4661, 0, 0, 0, 0, 0, 0, - 4664, 4667, 0, 4670, 4673, 0, 4676, 4679, 0, 4682, 4685, 0, 4688, 4691, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4694, - 0, 0, 4697, 4700, 4703, 4706, 0, 0, 0, 4709, 4712, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4715, 4717, 4719, - 4721, 4723, 4725, 4727, 4729, 4731, 4733, 4735, 4737, 4739, 4741, 4743, - 4745, 4747, 4749, 4751, 4753, 4755, 4757, 4759, 4761, 4763, 4765, 4767, - 4769, 4771, 4773, 4775, 4777, 4779, 4781, 4783, 4785, 4787, 4789, 4791, - 4793, 4795, 4797, 4799, 4801, 4803, 4805, 4807, 4809, 4811, 4813, 4815, - 4817, 4819, 4821, 4823, 4825, 4827, 4829, 4831, 4833, 4835, 4837, 4839, - 4841, 4843, 4845, 4847, 4849, 4851, 4853, 4855, 4857, 4859, 4861, 4863, - 4865, 4867, 4869, 4871, 4873, 4875, 4877, 4879, 4881, 4883, 4885, 4887, - 4889, 4891, 4893, 4895, 4897, 4899, 4901, 0, 0, 0, 4903, 4905, 4907, - 4909, 4911, 4913, 4915, 4917, 4919, 4921, 4923, 4925, 4927, 4929, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4931, - 4935, 4939, 4943, 4947, 4951, 4955, 4959, 4963, 4967, 4971, 4975, 4979, - 4983, 4987, 4992, 4997, 5002, 5007, 5012, 5017, 5022, 5027, 5032, 5037, - 5042, 5047, 5052, 5057, 5062, 5070, 0, 5077, 5081, 5085, 5089, 5093, - 5097, 5101, 5105, 5109, 5113, 5117, 5121, 5125, 5129, 5133, 5137, 5141, - 5145, 5149, 5153, 5157, 5161, 5165, 5169, 5173, 5177, 5181, 5185, 5189, - 5193, 5197, 5201, 5205, 5209, 5213, 5217, 5221, 5223, 5225, 5227, 0, 0, - 0, 0, 0, 0, 0, 0, 5229, 5233, 5236, 5239, 5242, 5245, 5248, 5251, 5254, - 5257, 5260, 5263, 5266, 5269, 5272, 5275, 5278, 5280, 5282, 5284, 5286, - 5288, 5290, 5292, 5294, 5296, 5298, 5300, 5302, 5304, 5306, 5309, 5312, - 5315, 5318, 5321, 5324, 5327, 5330, 5333, 5336, 5339, 5342, 5345, 5348, - 5354, 5359, 0, 5362, 5364, 5366, 5368, 5370, 5372, 5374, 5376, 5378, - 5380, 5382, 5384, 5386, 5388, 5390, 5392, 5394, 5396, 5398, 5400, 5402, - 5404, 5406, 5408, 5410, 5412, 5414, 5416, 5418, 5420, 5422, 5424, 5426, - 5428, 5430, 5432, 5434, 5436, 5438, 5440, 5442, 5444, 5446, 5448, 5450, - 5452, 5454, 5456, 5458, 5460, 5463, 5466, 5469, 5472, 5475, 5478, 5481, - 5484, 5487, 5490, 5493, 5496, 5499, 5502, 5505, 5508, 5511, 5514, 5517, - 5520, 5523, 5526, 5529, 5532, 5536, 5540, 5544, 5547, 5551, 5554, 5558, - 5560, 5562, 5564, 5566, 5568, 5570, 5572, 5574, 5576, 5578, 5580, 5582, - 5584, 5586, 5588, 5590, 5592, 5594, 5596, 5598, 5600, 5602, 5604, 5606, - 5608, 5610, 5612, 5614, 5616, 5618, 5620, 5622, 5624, 5626, 5628, 5630, - 5632, 5634, 5636, 5638, 5640, 5642, 5644, 5646, 5648, 5650, 0, 5652, - 5657, 5662, 5667, 5671, 5676, 5680, 5684, 5690, 5695, 5699, 5703, 5707, - 5712, 5717, 5721, 5725, 5728, 5732, 5737, 5742, 5745, 5751, 5758, 5764, - 5768, 5774, 5780, 5785, 5789, 5793, 5797, 5802, 5808, 5813, 5817, 5821, - 5825, 5828, 5831, 5834, 5837, 5841, 5845, 5851, 5855, 5860, 5866, 5870, - 5873, 5876, 5882, 5887, 5893, 5897, 5903, 5906, 5910, 5914, 5918, 5922, - 5926, 5931, 5935, 5938, 5942, 5946, 5950, 5955, 5959, 5963, 5967, 5973, - 5978, 5981, 5987, 5990, 5995, 6000, 6004, 6008, 6012, 6017, 6020, 6024, - 6029, 6032, 6038, 6042, 6045, 6048, 6051, 6054, 6057, 6060, 6063, 6066, - 6069, 6072, 6076, 6080, 6084, 6088, 6092, 6096, 6100, 6104, 6108, 6112, - 6116, 6120, 6124, 6128, 6132, 6136, 6139, 6142, 6146, 6149, 6152, 6155, - 6159, 6163, 6166, 6169, 6172, 6175, 6178, 6183, 6186, 6189, 6192, 6195, - 6198, 6201, 6204, 6207, 6211, 6216, 6219, 6222, 6225, 6228, 6231, 6234, - 6237, 6241, 6245, 6249, 6253, 6256, 6259, 6262, 6265, 6268, 6271, 6274, - 6277, 6280, 6283, 6287, 6291, 6294, 6298, 6302, 6306, 6309, 6313, 6317, - 6322, 6325, 6329, 6333, 6337, 6341, 6347, 6354, 6357, 6360, 6363, 6366, - 6369, 6372, 6375, 6378, 6381, 6384, 6387, 6390, 6393, 6396, 6399, 6402, - 6405, 6408, 6413, 6416, 6419, 6422, 6427, 6431, 6434, 6437, 6440, 6443, - 6446, 6449, 6452, 6455, 6458, 6461, 6465, 6468, 6471, 6475, 6479, 6482, - 6487, 6491, 6494, 6497, 6500, 6503, 6507, 6511, 6514, 6517, 6520, 6523, - 6526, 6529, 6532, 6535, 6538, 6542, 6546, 6550, 6554, 6558, 6562, 6566, - 6570, 6574, 6578, 6582, 6586, 6590, 6594, 6598, 6602, 6606, 6610, 6614, - 6618, 6622, 6626, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6630, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 6632, 6634, 6636, 6638, 6640, 6642, 6644, 6646, 6648, 6650, 6652, 6654, - 6656, 6658, 6660, 6662, 6664, 6666, 6668, 6670, 6672, 6674, 6676, 6678, - 6680, 6682, 6684, 6686, 6688, 6690, 6692, 6694, 6696, 6698, 6700, 6702, - 6704, 6706, 6708, 6710, 6712, 6714, 6716, 6718, 6720, 6722, 6724, 6726, - 6728, 6730, 6732, 6734, 6736, 6738, 6740, 6742, 6744, 6746, 6748, 6750, - 6752, 6754, 6756, 6758, 6760, 6762, 6764, 6766, 6768, 6770, 6772, 6774, - 6776, 6778, 6780, 6782, 6784, 6786, 6788, 6790, 6792, 6794, 6796, 6798, - 6800, 6802, 6804, 6806, 6808, 6810, 6812, 6814, 6816, 6818, 6820, 6822, - 6824, 6826, 6828, 6830, 6832, 6834, 6836, 6838, 6840, 6842, 6844, 6846, - 6848, 6850, 6852, 6854, 6856, 6858, 6860, 6862, 6864, 6866, 6868, 6870, - 6872, 6874, 6876, 6878, 6880, 6882, 6884, 6886, 6888, 6890, 6892, 6894, - 6896, 6898, 6900, 6902, 6904, 6906, 6908, 6910, 6912, 6914, 6916, 6918, - 6920, 6922, 6924, 6926, 6928, 6930, 6932, 6934, 6936, 6938, 6940, 6942, - 6944, 6946, 6948, 6950, 6952, 6954, 6956, 6958, 6960, 6962, 6964, 6966, - 6968, 6970, 6972, 6974, 6976, 6978, 6980, 6982, 6984, 6986, 6988, 6990, - 6992, 6994, 6996, 6998, 7000, 7002, 7004, 7006, 7008, 7010, 7012, 7014, - 7016, 7018, 7020, 7022, 7024, 7026, 7028, 7030, 7032, 7034, 7036, 7038, - 7040, 7042, 7044, 7046, 7048, 7050, 7052, 7054, 7056, 7058, 7060, 7062, - 7064, 7066, 7068, 7070, 7072, 7074, 7076, 7078, 7080, 7082, 7084, 7086, - 7088, 7090, 7092, 7094, 7096, 7098, 7100, 7102, 7104, 7106, 7108, 7110, - 7112, 7114, 7116, 7118, 7120, 7122, 7124, 7126, 7128, 7130, 7132, 7134, - 7136, 7138, 7140, 7142, 7144, 7146, 7148, 7150, 7152, 7154, 7156, 7158, - 7160, 7162, 7164, 7166, 7168, 7170, 0, 0, 7172, 0, 7174, 0, 0, 7176, - 7178, 7180, 7182, 7184, 7186, 7188, 7190, 7192, 7194, 0, 7196, 0, 7198, - 0, 0, 7200, 7202, 0, 0, 0, 7204, 7206, 7208, 7210, 0, 0, 7212, 7214, - 7216, 7218, 7220, 7222, 7224, 7226, 7228, 7230, 7232, 7234, 7236, 7238, - 7240, 7242, 7244, 7246, 7248, 7250, 7252, 7254, 7256, 7258, 7260, 7262, - 7264, 7266, 7268, 7270, 7272, 7274, 7276, 7278, 7280, 7282, 7284, 7286, - 7288, 7290, 7292, 7294, 7296, 7298, 7300, 7302, 7304, 7306, 7308, 7310, - 7312, 7314, 7316, 7318, 7320, 7322, 7324, 7326, 7328, 7330, 7332, 7334, - 0, 0, 7336, 7338, 7340, 7342, 7344, 7346, 7348, 7350, 7352, 7354, 7356, - 7358, 7360, 7362, 7364, 7366, 7368, 7370, 7372, 7374, 7376, 7378, 7380, - 7382, 7384, 7386, 7388, 7390, 7392, 7394, 7396, 7398, 7400, 7402, 7404, - 7406, 7408, 7410, 7412, 7414, 7416, 7418, 7420, 7422, 7424, 7426, 7428, - 7430, 7432, 7434, 7436, 7438, 7440, 7442, 7444, 7446, 7448, 7450, 7452, - 7454, 7456, 7458, 7460, 7462, 7464, 7466, 7468, 7470, 7472, 7474, 7476, - 7478, 7480, 7482, 7484, 7486, 7488, 7490, 7492, 7494, 7496, 7498, 7500, - 7502, 7504, 7506, 7508, 7510, 7512, 7514, 7516, 7518, 7520, 7522, 7524, - 7526, 7528, 7530, 7532, 7534, 7536, 7538, 7540, 7542, 7544, 7546, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7548, 7551, 7554, 7557, 7561, 7565, - 7568, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7571, 7574, 7577, 7580, 7583, - 0, 0, 0, 0, 0, 7586, 0, 7589, 7592, 7594, 7596, 7598, 7600, 7602, 7604, - 7606, 7608, 7610, 7612, 7615, 7618, 7621, 7624, 7627, 7630, 7633, 7636, - 7639, 7642, 7645, 7648, 0, 7651, 7654, 7657, 7660, 7663, 0, 7666, 0, - 7669, 7672, 0, 7675, 7678, 0, 7681, 7684, 7687, 7690, 7693, 7696, 7699, - 7702, 7705, 7708, 7711, 7713, 7715, 7717, 7719, 7721, 7723, 7725, 7727, - 7729, 7731, 7733, 7735, 7737, 7739, 7741, 7743, 7745, 7747, 7749, 7751, - 7753, 7755, 7757, 7759, 7761, 7763, 7765, 7767, 7769, 7771, 7773, 7775, - 7777, 7779, 7781, 7783, 7785, 7787, 7789, 7791, 7793, 7795, 7797, 7799, - 7801, 7803, 7805, 7807, 7809, 7811, 7813, 7815, 7817, 7819, 7821, 7823, - 7825, 7827, 7829, 7831, 7833, 7835, 7837, 7839, 7841, 7843, 7845, 7847, - 7849, 7851, 7853, 7855, 7857, 7859, 7861, 7863, 7865, 7867, 7869, 7871, - 7873, 7875, 7877, 7879, 7881, 7883, 7885, 7887, 7889, 7891, 7893, 7895, - 7897, 7899, 7901, 7903, 7905, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7907, 7909, - 7911, 7913, 7915, 7917, 7919, 7921, 7923, 7925, 7927, 7929, 7931, 7933, - 7935, 7937, 7939, 7941, 7943, 7945, 7947, 7949, 7951, 7953, 7956, 7959, - 7962, 7965, 7968, 7971, 7974, 7977, 7980, 7983, 7986, 7989, 7992, 7995, - 7998, 8001, 8004, 8007, 8009, 8011, 8013, 8015, 8018, 8021, 8024, 8027, - 8030, 8033, 8036, 8039, 8042, 8045, 8048, 8051, 8054, 8057, 8060, 8063, - 8066, 8069, 8072, 8075, 8078, 8081, 8084, 8087, 8090, 8093, 8096, 8099, - 8102, 8105, 8108, 8111, 8114, 8117, 8120, 8123, 8126, 8129, 8132, 8135, - 8138, 8141, 8144, 8147, 8150, 8153, 8156, 8159, 8162, 8165, 8168, 8171, - 8174, 8177, 8180, 8183, 8186, 8189, 8192, 8195, 8198, 8201, 8204, 8207, - 8210, 8213, 8216, 8219, 8222, 8225, 8228, 8231, 8234, 8237, 8240, 8243, - 8246, 8249, 8252, 8255, 8258, 8261, 8264, 8267, 8270, 8273, 8276, 8279, - 8282, 8285, 8288, 8291, 8294, 8297, 8301, 8305, 8309, 8313, 8317, 8321, - 8324, 8327, 8330, 8333, 8336, 8339, 8342, 8345, 8348, 8351, 8354, 8357, - 8360, 8363, 8366, 8369, 8372, 8375, 8378, 8381, 8384, 8387, 8390, 8393, - 8396, 8399, 8402, 8405, 8408, 8411, 8414, 8417, 8420, 8423, 8426, 8429, - 8432, 8435, 8438, 8441, 8444, 8447, 8450, 8453, 8456, 8459, 8462, 8465, - 8468, 8471, 8474, 8477, 8480, 8483, 8486, 8489, 8492, 8495, 8498, 8501, - 8504, 8507, 8510, 8513, 8516, 8519, 8522, 8525, 8528, 8531, 8534, 8537, - 8540, 8543, 8546, 8549, 8552, 8555, 8558, 8561, 8564, 8567, 8570, 8573, - 8576, 8579, 8582, 8585, 8588, 8591, 8594, 8597, 8600, 8603, 8606, 8609, - 8612, 8615, 8618, 8621, 8624, 8627, 8630, 8633, 8636, 8639, 8642, 8645, - 8648, 8651, 8654, 8657, 8660, 8663, 8666, 8669, 8672, 8675, 8678, 8681, - 8684, 8687, 8690, 8693, 8696, 8699, 8702, 8705, 8708, 8711, 8714, 8717, - 8720, 8723, 8726, 8729, 8732, 8735, 8738, 8741, 8744, 8747, 8751, 8755, - 8759, 8762, 8765, 8768, 8771, 8774, 8777, 8780, 8783, 8786, 8789, 8792, - 8795, 8798, 8801, 8804, 8807, 8810, 8813, 8816, 8819, 8822, 8825, 8828, - 8831, 8834, 8837, 8840, 8843, 8846, 8849, 8852, 8855, 8858, 8861, 8864, - 8867, 8870, 8873, 8876, 8879, 8882, 8885, 8888, 8891, 8894, 8897, 8900, - 8903, 8906, 8909, 8912, 8915, 8918, 8921, 8924, 8927, 8930, 8933, 8936, - 8939, 8942, 8945, 8948, 8951, 8954, 8957, 8960, 8963, 8966, 8969, 8972, - 8975, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8978, 8982, - 8986, 8990, 8994, 8998, 9002, 9006, 9010, 9014, 9018, 9022, 9026, 9030, - 9034, 9038, 9042, 9046, 9050, 9054, 9058, 9062, 9066, 9070, 9074, 9078, - 9082, 9086, 9090, 9094, 9098, 9102, 9106, 9110, 9114, 9118, 9122, 9126, - 9130, 9134, 9138, 9142, 9146, 9150, 9154, 9158, 9162, 9166, 9170, 9174, - 9178, 9182, 9186, 9190, 9194, 9198, 9202, 9206, 9210, 9214, 9218, 9222, - 9226, 9230, 0, 0, 9234, 9238, 9242, 9246, 9250, 9254, 9258, 9262, 9266, - 9270, 9274, 9278, 9282, 9286, 9290, 9294, 9298, 9302, 9306, 9310, 9314, - 9318, 9322, 9326, 9330, 9334, 9338, 9342, 9346, 9350, 9354, 9358, 9362, - 9366, 9370, 9374, 9378, 9382, 9386, 9390, 9394, 9398, 9402, 9406, 9410, - 9414, 9418, 9422, 9426, 9430, 9434, 9438, 9442, 9446, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9450, 9454, 9458, 9463, 9468, 9473, 9478, - 9483, 9488, 9493, 9497, 9516, 9525, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 9530, 9532, 9534, 9536, 9538, 9540, 9542, 9544, - 9546, 9548, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 9550, 9552, 9554, 9556, 9558, 9560, 9562, 9564, 9566, 9568, 9570, - 9572, 9574, 9576, 9578, 9580, 9582, 9584, 9586, 9588, 9590, 0, 0, 9592, - 9594, 9596, 9598, 9600, 9602, 9604, 9606, 9608, 9610, 9612, 9614, 0, - 9616, 9618, 9620, 9622, 9624, 9626, 9628, 9630, 9632, 9634, 9636, 9638, - 9640, 9642, 9644, 9646, 9648, 9650, 9652, 0, 9654, 9656, 9658, 9660, 0, - 0, 0, 0, 9662, 9665, 9668, 0, 9671, 0, 9674, 9677, 9680, 9683, 9686, - 9689, 9692, 9695, 9698, 9701, 9704, 9706, 9708, 9710, 9712, 9714, 9716, - 9718, 9720, 9722, 9724, 9726, 9728, 9730, 9732, 9734, 9736, 9738, 9740, - 9742, 9744, 9746, 9748, 9750, 9752, 9754, 9756, 9758, 9760, 9762, 9764, - 9766, 9768, 9770, 9772, 9774, 9776, 9778, 9780, 9782, 9784, 9786, 9788, - 9790, 9792, 9794, 9796, 9798, 9800, 9802, 9804, 9806, 9808, 9810, 9812, - 9814, 9816, 9818, 9820, 9822, 9824, 9826, 9828, 9830, 9832, 9834, 9836, - 9838, 9840, 9842, 9844, 9846, 9848, 9850, 9852, 9854, 9856, 9858, 9860, - 9862, 9864, 9866, 9868, 9870, 9872, 9874, 9876, 9878, 9880, 9882, 9884, - 9886, 9888, 9890, 9892, 9894, 9896, 9898, 9900, 9902, 9904, 9906, 9908, - 9910, 9912, 9914, 9916, 9918, 9920, 9922, 9924, 9926, 9928, 9930, 9932, - 9934, 9936, 9938, 9941, 9944, 9947, 9950, 9953, 9956, 9959, 0, 0, 0, 0, - 9962, 9964, 9966, 9968, 9970, 9972, 9974, 9976, 9978, 9980, 9982, 9984, - 9986, 9988, 9990, 9992, 9994, 9996, 9998, 10000, 10002, 10004, 10006, - 10008, 10010, 10012, 10014, 10016, 10018, 10020, 10022, 10024, 10026, - 10028, 10030, 10032, 10034, 10036, 10038, 10040, 10042, 10044, 10046, - 10048, 10050, 10052, 10054, 10056, 10058, 10060, 10062, 10064, 10066, - 10068, 10070, 10072, 10074, 10076, 10078, 10080, 10082, 10084, 10086, - 10088, 10090, 10092, 10094, 10096, 10098, 10100, 10102, 10104, 10106, - 10108, 10110, 10112, 10114, 10116, 10118, 10120, 10122, 10124, 10126, - 10128, 10130, 10132, 10134, 10136, 10138, 10140, 10142, 10144, 10146, - 10148, 10150, 10152, 10154, 10156, 10158, 10160, 10162, 10164, 10166, - 10168, 10170, 10172, 10174, 10176, 10178, 10180, 10182, 10184, 10186, - 10188, 10190, 10192, 10194, 10196, 10198, 10200, 10202, 10204, 10206, - 10208, 10210, 10212, 10214, 10216, 10218, 10220, 10222, 10224, 10226, - 10228, 10230, 10232, 10234, 10236, 10238, 10240, 10242, 10244, 10246, - 10248, 10250, 10252, 10254, 10256, 10258, 10260, 10262, 10264, 10266, - 10268, 10270, 10272, 10274, 10276, 10278, 10280, 10282, 10284, 10286, - 10288, 10290, 10292, 10294, 10296, 10298, 10300, 10302, 10304, 10306, - 10308, 10310, 10312, 10314, 10316, 10318, 10320, 10322, 10324, 10326, - 10328, 10330, 10332, 10334, 10336, 10338, 10340, 0, 0, 0, 10342, 10344, - 10346, 10348, 10350, 10352, 0, 0, 10354, 10356, 10358, 10360, 10362, - 10364, 0, 0, 10366, 10368, 10370, 10372, 10374, 10376, 0, 0, 10378, - 10380, 10382, 0, 0, 0, 10384, 10386, 10388, 10390, 10392, 10394, 10396, - 0, 10398, 10400, 10402, 10404, 10406, 10408, 10410, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10412, 0, - 10415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10418, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 10421, 10424, 10427, 10430, 10433, 10436, 10439, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10442, 10445, 10448, 10451, 10454, 10457, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10460, 10462, 10464, 10466, - 10468, 10470, 10472, 10474, 10476, 10478, 10480, 10482, 10484, 10486, - 10488, 10490, 10492, 10494, 10496, 10498, 10500, 10502, 10504, 10506, - 10508, 10510, 10512, 10514, 10516, 10518, 10520, 10522, 10524, 10526, - 10528, 10530, 10532, 10534, 10536, 10538, 10540, 10542, 10544, 10546, - 10548, 10550, 10552, 10554, 10556, 10558, 10560, 10562, 10564, 10566, - 10568, 10570, 10572, 10574, 10576, 10578, 10580, 10582, 10584, 10586, - 10588, 10590, 10592, 10594, 10596, 10598, 10600, 10602, 10604, 10606, - 10608, 10610, 10612, 10614, 10616, 10618, 10620, 10622, 10624, 10626, - 10628, 0, 10630, 10632, 10634, 10636, 10638, 10640, 10642, 10644, 10646, - 10648, 10650, 10652, 10654, 10656, 10658, 10660, 10662, 10664, 10666, - 10668, 10670, 10672, 10674, 10676, 10678, 10680, 10682, 10684, 10686, - 10688, 10690, 10692, 10694, 10696, 10698, 10700, 10702, 10704, 10706, - 10708, 10710, 10712, 10714, 10716, 10718, 10720, 10722, 10724, 10726, - 10728, 10730, 10732, 10734, 10736, 10738, 10740, 10742, 10744, 10746, - 10748, 10750, 10752, 10754, 10756, 10758, 10760, 10762, 10764, 10766, - 10768, 10770, 0, 10772, 10774, 0, 0, 10776, 0, 0, 10778, 10780, 0, 0, - 10782, 10784, 10786, 10788, 0, 10790, 10792, 10794, 10796, 10798, 10800, - 10802, 10804, 10806, 10808, 10810, 10812, 0, 10814, 0, 10816, 10818, - 10820, 10822, 10824, 10826, 10828, 0, 10830, 10832, 10834, 10836, 10838, - 10840, 10842, 10844, 10846, 10848, 10850, 10852, 10854, 10856, 10858, - 10860, 10862, 10864, 10866, 10868, 10870, 10872, 10874, 10876, 10878, - 10880, 10882, 10884, 10886, 10888, 10890, 10892, 10894, 10896, 10898, - 10900, 10902, 10904, 10906, 10908, 10910, 10912, 10914, 10916, 10918, - 10920, 10922, 10924, 10926, 10928, 10930, 10932, 10934, 10936, 10938, - 10940, 10942, 10944, 10946, 10948, 10950, 10952, 10954, 10956, 10958, 0, - 10960, 10962, 10964, 10966, 0, 0, 10968, 10970, 10972, 10974, 10976, - 10978, 10980, 10982, 0, 10984, 10986, 10988, 10990, 10992, 10994, 10996, - 0, 10998, 11000, 11002, 11004, 11006, 11008, 11010, 11012, 11014, 11016, - 11018, 11020, 11022, 11024, 11026, 11028, 11030, 11032, 11034, 11036, - 11038, 11040, 11042, 11044, 11046, 11048, 11050, 11052, 0, 11054, 11056, - 11058, 11060, 0, 11062, 11064, 11066, 11068, 11070, 0, 11072, 0, 0, 0, - 11074, 11076, 11078, 11080, 11082, 11084, 11086, 0, 11088, 11090, 11092, - 11094, 11096, 11098, 11100, 11102, 11104, 11106, 11108, 11110, 11112, - 11114, 11116, 11118, 11120, 11122, 11124, 11126, 11128, 11130, 11132, - 11134, 11136, 11138, 11140, 11142, 11144, 11146, 11148, 11150, 11152, - 11154, 11156, 11158, 11160, 11162, 11164, 11166, 11168, 11170, 11172, - 11174, 11176, 11178, 11180, 11182, 11184, 11186, 11188, 11190, 11192, - 11194, 11196, 11198, 11200, 11202, 11204, 11206, 11208, 11210, 11212, - 11214, 11216, 11218, 11220, 11222, 11224, 11226, 11228, 11230, 11232, - 11234, 11236, 11238, 11240, 11242, 11244, 11246, 11248, 11250, 11252, - 11254, 11256, 11258, 11260, 11262, 11264, 11266, 11268, 11270, 11272, - 11274, 11276, 11278, 11280, 11282, 11284, 11286, 11288, 11290, 11292, - 11294, 11296, 11298, 11300, 11302, 11304, 11306, 11308, 11310, 11312, - 11314, 11316, 11318, 11320, 11322, 11324, 11326, 11328, 11330, 11332, - 11334, 11336, 11338, 11340, 11342, 11344, 11346, 11348, 11350, 11352, - 11354, 11356, 11358, 11360, 11362, 11364, 11366, 11368, 11370, 11372, - 11374, 11376, 11378, 11380, 11382, 11384, 11386, 11388, 11390, 11392, - 11394, 11396, 11398, 11400, 11402, 11404, 11406, 11408, 11410, 11412, - 11414, 11416, 11418, 11420, 11422, 11424, 11426, 11428, 11430, 11432, - 11434, 11436, 11438, 11440, 11442, 11444, 11446, 11448, 11450, 11452, - 11454, 11456, 11458, 11460, 11462, 11464, 11466, 11468, 11470, 11472, - 11474, 11476, 11478, 11480, 11482, 11484, 11486, 11488, 11490, 11492, - 11494, 11496, 11498, 11500, 11502, 11504, 11506, 11508, 11510, 11512, - 11514, 11516, 11518, 11520, 11522, 11524, 11526, 11528, 11530, 11532, - 11534, 11536, 11538, 11540, 11542, 11544, 11546, 11548, 11550, 11552, - 11554, 11556, 11558, 11560, 11562, 11564, 11566, 11568, 11570, 11572, - 11574, 11576, 11578, 11580, 11582, 11584, 11586, 11588, 11590, 11592, - 11594, 11596, 11598, 11600, 11602, 11604, 11606, 11608, 11610, 11612, - 11614, 11616, 11618, 11620, 11622, 11624, 11626, 11628, 11630, 11632, - 11634, 11636, 11638, 11640, 11642, 11644, 11646, 11648, 11650, 11652, - 11654, 11656, 11658, 11660, 11662, 11664, 11666, 11668, 11670, 11672, - 11674, 11676, 11678, 11680, 11682, 11684, 11686, 11688, 11690, 11692, - 11694, 11696, 11698, 11700, 11702, 11704, 11706, 11708, 11710, 11712, - 11714, 11716, 11718, 11720, 11722, 11724, 11726, 11728, 11730, 11732, - 11734, 11736, 11738, 11740, 11742, 11744, 11746, 11748, 11750, 11752, - 11754, 11756, 11758, 11760, 11762, 11764, 11766, 0, 0, 11768, 11770, - 11772, 11774, 11776, 11778, 11780, 11782, 11784, 11786, 11788, 11790, - 11792, 11794, 11796, 11798, 11800, 11802, 11804, 11806, 11808, 11810, - 11812, 11814, 11816, 11818, 11820, 11822, 11824, 11826, 11828, 11830, - 11832, 11834, 11836, 11838, 11840, 11842, 11844, 11846, 11848, 11850, - 11852, 11854, 11856, 11858, 11860, 11862, 11864, 11866, 11868, 11870, - 11872, 11874, 11876, 11878, 11880, 11882, 11884, 11886, 11888, 11890, - 11892, 11894, 11896, 11898, 11900, 11902, 11904, 11906, 11908, 11910, - 11912, 11914, 11916, 11918, 11920, 11922, 11924, 11926, 11928, 11930, - 11932, 11934, 11936, 11938, 11940, 11942, 11944, 11946, 11948, 11950, - 11952, 11954, 11956, 11958, 11960, 11962, 11964, 11966, 11968, 11970, - 11972, 11974, 11976, 11978, 11980, 11982, 11984, 11986, 11988, 11990, - 11992, 11994, 11996, 11998, 12000, 12002, 12004, 12006, 12008, 12010, - 12012, 12014, 12016, 12018, 12020, 12022, 12024, 12026, 12028, 12030, - 12032, 12034, 12036, 12038, 12040, 12042, 12044, 12046, 12048, 12050, - 12052, 12054, 12056, 12058, 12060, 12062, 12064, 12066, 12068, 12070, - 12072, 12074, 12076, 12078, 12080, 12082, 12084, 12086, 12088, 12090, - 12092, 12094, 12096, 12098, 12100, 12102, 12104, 12106, 12108, 12110, - 12112, 12114, 12116, 12118, 12120, 12122, 12124, 12126, 12128, 12130, - 12132, 12134, 12136, 12138, 12140, 12142, 12144, 12146, 12148, 12150, - 12152, 12154, 12156, 12158, 12160, 12162, 12164, 12166, 12168, 12170, - 12172, 12174, 12176, 12178, 12180, 12182, 12184, 12186, 12188, 12190, - 12192, 12194, 12196, 12198, 12200, 12202, 12204, 12206, 12208, 12210, - 12212, 12214, 12216, 12218, 12220, 12222, 12224, 12226, 12228, 12230, - 12232, 12234, 12236, 12238, 12240, 12242, 12244, 12246, 12248, 12250, - 12252, 12254, 12256, 12258, 12260, 12262, 12264, 12266, 12268, 12270, - 12272, 12274, 12276, 12278, 12280, 12282, 12284, 12286, 12288, 12290, - 12292, 12294, 12296, 12298, 12300, 12302, 12304, 12306, 12308, 12310, - 12312, 12314, 12316, 12318, 12320, 12322, 12324, 12326, 12328, 12330, - 12332, 12334, 12336, 12338, 12340, 12342, 12344, 12346, 12348, 12350, 0, - 0, 12352, 12354, 12356, 12358, 12360, 12362, 12364, 12366, 12368, 12370, - 12372, 12374, 12376, 12378, 12380, 12382, 12384, 12386, 12388, 12390, - 12392, 12394, 12396, 12398, 12400, 12402, 12404, 12406, 12408, 12410, - 12412, 12414, 12416, 12418, 12420, 12422, 12424, 12426, 12428, 12430, - 12432, 12434, 12436, 12438, 12440, 12442, 12444, 12446, 12448, 12450, - 12452, 12455, 12458, 12461, 12464, 12467, 12470, 12473, 12476, 12479, - 12482, 0, 0, 0, 0, 0, 12485, 12489, 12493, 12497, 12501, 12505, 12509, - 12513, 12517, 12521, 12525, 12529, 12533, 12537, 12541, 12545, 12549, - 12553, 12557, 12561, 12565, 12569, 12573, 12577, 12581, 12585, 12589, - 12593, 12595, 12597, 12600, 0, 0, 12603, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 12605, 0, 12607, 0, 0, 12609, 0, 0, 0, 12611, 0, 0, 0, 12613, 12616, - 12619, 12622, 12625, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 12629, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12632, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12635, 12637, 12639, 12641, 12643, 12645, - 12647, 12649, 12651, 12653, 12655, 12657, 12659, 12661, 12663, 12665, - 12667, 12669, 12671, 12673, 12675, 12677, 12679, 12681, 12683, 12685, - 12687, 12689, 12691, 12693, 12695, 12697, 12699, 12701, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 12703, 12707, 12711, 12715, 12719, 12723, 12727, - 12731, 12735, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 12739, 12741, - 12743, 12745, 12747, 12749, 12751, 12753, 12755, 12757, 12759, 12761, - 12763, 12765, 12767, 12769, 12771, 12773, 12775, 12777, 12779, 12781, - 12783, 12785, 12787, 12789, 12791, 12793, 12795, 12797, 12799, 12801, - 12803, 12805, 12807, 12809, 12811, 12813, 12815, 12817, 12819, 12821, - 12823, 12825, 12827, 12829, 12831, 12833, 12835, 12837, 12839, 12841, - 12843, 12845, 12847, 12849, 12851, 12853, 12855, 12857, 12859, 12861, - 12863, 12865, 12867, 12869, 12871, 12873, 12875, 12877, 12879, 12881, - 12883, 12885, 12887, 12889, 12891, 12893, 12895, 12897, 12899, 12901, - 12903, 12905, 12907, 12909, 12911, 12913, 12915, 12917, 12919, 12921, - 12923, 12925, 12927, 12929, 12931, 12933, 12935, 12937, 12939, 12941, - 12943, 12945, 12947, 12949, 12951, 12953, 12955, 12957, 12959, 12961, - 12963, 12965, 12967, 12969, 12971, 12973, 12975, 12977, 12979, 12981, - 12983, 12985, 12987, 12989, 12991, 12993, 12995, 12997, 12999, 13001, - 13003, 13005, 13007, 13009, 13011, 13013, 13015, 13017, 13019, 13021, - 13023, 13025, 13027, 13029, 13031, 13033, 13035, 13037, 13039, 13041, - 13043, 13045, 13047, 13049, 13051, 13053, 13055, 13057, 13059, 13061, - 13063, 13065, 13067, 13069, 13071, 13073, 13075, 13077, 13079, 13081, - 13083, 13085, 13087, 13089, 13091, 13093, 13095, 13097, 13099, 13101, - 13103, 13105, 13107, 13109, 13111, 13113, 13115, 13117, 13119, 13121, - 13123, 13125, 13127, 13129, 13131, 13133, 13135, 13137, 13139, 13141, - 13143, 13145, 13147, 13149, 13151, 13153, 13155, 13157, 13159, 13161, - 13163, 13165, 13167, 13169, 13171, 13173, 13175, 13177, 13179, 13181, - 13183, 13185, 13187, 13189, 13191, 13193, 13195, 13197, 13199, 13201, - 13203, 13205, 13207, 13209, 13211, 13213, 13215, 13217, 13219, 13221, - 13223, 13225, 13227, 13229, 13231, 13233, 13235, 13237, 13239, 13241, - 13243, 13245, 13247, 13249, 13251, 13253, 13255, 13257, 13259, 13261, - 13263, 13265, 13267, 13269, 13271, 13273, 13275, 13277, 13279, 13281, - 13283, 13285, 13287, 13289, 13291, 13293, 13295, 13297, 13299, 13301, - 13303, 13305, 13307, 13309, 13311, 13313, 13315, 13317, 13319, 13321, - 13323, 13325, 13327, 13329, 13331, 13333, 13335, 13337, 13339, 13341, - 13343, 13345, 13347, 13349, 13351, 13353, 13355, 13357, 13359, 13361, - 13363, 13365, 13367, 13369, 13371, 13373, 13375, 13377, 13379, 13381, - 13383, 13385, 13387, 13389, 13391, 13393, 13395, 13397, 13399, 13401, - 13403, 13405, 13407, 13409, 13411, 13413, 13415, 13417, 13419, 13421, - 13423, 13425, 13427, 13429, 13431, 13433, 13435, 13437, 13439, 13441, - 13443, 13445, 13447, 13449, 13451, 13453, 13455, 13457, 13459, 13461, - 13463, 13465, 13467, 13469, 13471, 13473, 13475, 13477, 13479, 13481, - 13483, 13485, 13487, 13489, 13491, 13493, 13495, 13497, 13499, 13501, - 13503, 13505, 13507, 13509, 13511, 13513, 13515, 13517, 13519, 13521, - 13523, 13525, 13527, 13529, 13531, 13533, 13535, 13537, 13539, 13541, - 13543, 13545, 13547, 13549, 13551, 13553, 13555, 13557, 13559, 13561, - 13563, 13565, 13567, 13569, 13571, 13573, 13575, 13577, 13579, 13581, - 13583, 13585, 13587, 13589, 13591, 13593, 13595, 13597, 13599, 13601, - 13603, 13605, 13607, 13609, 13611, 13613, 13615, 13617, 13619, 13621, - 13623, 13625, 13627, 13629, 13631, 13633, 13635, 13637, 13639, 13641, - 13643, 13645, 13647, 13649, 13651, 13653, 13655, 13657, 13659, 13661, - 13663, 13665, 13667, 13669, 13671, 13673, 13675, 13677, 13679, 13681, - 13683, 13685, 13687, 13689, 13691, 13693, 13695, 13697, 13699, 13701, - 13703, 13705, 13707, 13709, 13711, 13713, 13715, 13717, 13719, 13721, - 13723, 13725, 13727, 13729, 13731, 13733, 13735, 13737, 13739, 13741, - 13743, 13745, 13747, 13749, 13751, 13753, 13755, 13757, 13759, 13761, - 13763, 13765, 13767, 13769, 13771, 13773, 13775, 13777, 13779, 13781, - 13783, 13785, 13787, 13789, 13791, 13793, 13795, 13797, 13799, 13801, - 13803, 13805, 13807, 13809, 13811, 13813, 13815, 13817, 13819, 13821, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; - -/* NFC pairs */ -#define COMP_SHIFT 2 -static unsigned short comp_index[] = { - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 10, 0, 0, 11, 0, 12, 0, 0, 0, 0, 0, 0, 0, 13, 14, - 15, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 18, 19, 20, 21, 22, 0, 0, 0, - 0, 0, 0, 23, 24, 25, 26, 27, 28, 29, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 31, 32, 33, 0, 0, 34, 0, 0, 0, 0, 0, 0, 0, 0, - 35, 36, 37, 38, 39, 40, 0, 0, 0, 0, 0, 0, 0, 41, 42, 43, 44, 45, 46, 47, - 0, 0, 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0, - 50, 0, 51, 52, 53, 0, 0, 0, 0, 0, 0, 54, 0, 0, 55, 56, 57, 58, 59, 0, 0, - 0, 0, 0, 0, 60, 61, 0, 0, 62, 0, 0, 0, 0, 0, 0, 0, 0, 0, 63, 64, 65, 0, - 66, 67, 68, 0, 0, 0, 0, 0, 0, 69, 70, 71, 72, 73, 74, 75, 0, 0, 0, 0, 0, - 0, 0, 76, 0, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 79, 0, 80, 81, 82, - 83, 0, 0, 0, 0, 0, 0, 0, 84, 85, 86, 0, 87, 88, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 89, 90, 0, 91, 92, 93, 0, 0, 0, 0, 0, 0, 94, 95, 96, 97, 98, 99, 100, - 0, 0, 0, 0, 0, 0, 0, 0, 101, 0, 0, 102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103, - 104, 0, 0, 105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 107, 108, 109, 0, 110, 0, 0, 0, 0, 0, 0, 0, 0, 0, 111, 112, - 0, 113, 114, 0, 115, 0, 0, 0, 0, 0, 0, 0, 116, 117, 118, 119, 120, 121, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 0, 0, 123, 0, 124, 0, 0, 0, 0, 0, 0, 125, - 126, 127, 128, 0, 129, 0, 0, 0, 0, 0, 0, 0, 0, 0, 130, 0, 131, 132, 133, - 134, 0, 0, 0, 0, 0, 0, 0, 135, 136, 137, 138, 139, 140, 141, 0, 0, 0, 0, - 0, 0, 0, 0, 142, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 143, 144, 145, 146, 0, - 147, 0, 0, 0, 0, 0, 0, 0, 0, 148, 149, 150, 151, 152, 153, 154, 0, 0, 0, - 0, 0, 0, 0, 155, 156, 157, 158, 159, 160, 161, 0, 0, 0, 0, 0, 0, 0, 162, - 0, 163, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 164, 0, 0, 165, 166, 167, 0, 168, - 0, 0, 0, 0, 0, 0, 169, 0, 0, 170, 171, 172, 173, 0, 0, 0, 0, 0, 0, 0, - 174, 175, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 177, 178, 179, 180, 0, 181, - 182, 183, 0, 0, 0, 0, 0, 0, 184, 185, 186, 187, 188, 0, 189, 0, 0, 0, 0, - 0, 0, 0, 190, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 192, 193, 194, - 195, 196, 197, 198, 0, 0, 0, 0, 0, 0, 0, 199, 200, 201, 0, 202, 203, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 204, 205, 206, 207, 208, 209, 0, 0, 0, 0, 0, 0, - 210, 211, 212, 213, 214, 215, 216, 0, 0, 0, 0, 0, 0, 0, 217, 0, 0, 0, - 218, 0, 0, 0, 0, 0, 0, 0, 0, 219, 220, 221, 222, 0, 223, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 224, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 225, 226, 227, 0, - 228, 0, 0, 0, 0, 0, 0, 0, 0, 0, 229, 230, 231, 0, 232, 0, 233, 0, 0, 0, - 0, 0, 0, 234, 235, 0, 0, 0, 0, 0, 236, 0, 0, 0, 0, 0, 0, 237, 238, 239, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 241, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 242, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 243, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 244, 245, 246, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 248, 249, 250, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 252, 253, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 256, 257, 0, 258, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 259, 260, 261, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 263, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 264, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 265, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 266, 267, 268, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 269, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 270, 271, 272, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 273, 274, 275, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 276, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 277, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 278, 279, - 0, 280, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 281, 282, 283, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 284, 285, 286, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 287, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 288, 289, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 290, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 292, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 293, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 294, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 295, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 296, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 297, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 298, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 299, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 300, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 301, 302, 303, 0, 0, 304, 0, 0, 0, - 0, 0, 0, 0, 0, 305, 306, 307, 0, 308, 0, 0, 0, 0, 0, 0, 0, 0, 0, 309, - 310, 311, 0, 312, 0, 0, 0, 0, 0, 0, 0, 0, 0, 313, 0, 314, 0, 315, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 316, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 317, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 318, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 319, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 320, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 322, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 323, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 324, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 325, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 326, 327, 0, 328, 329, 0, 0, 330, 0, 0, 0, 0, 0, 0, 331, 0, - 0, 332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 333, 334, 0, 0, 335, 0, 0, 0, 336, 0, - 0, 0, 0, 0, 337, 338, 339, 0, 340, 0, 0, 0, 0, 0, 0, 0, 0, 0, 341, 0, 0, - 342, 343, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 344, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 345, 346, 347, 0, 348, 0, 0, 0, 0, 0, 0, 0, 0, 0, 349, 0, 0, 0, - 350, 0, 0, 351, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 352, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 353, 0, 0, 0, 0, 0, 354, 355, 356, 0, 357, 0, - 0, 358, 359, 0, 0, 0, 0, 0, 360, 0, 0, 0, 361, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 362, 0, 0, 363, 364, 0, 0, 365, 0, 0, 0, 0, 0, 0, 366, 367, 0, 368, 0, 0, - 0, 369, 0, 0, 0, 0, 0, 370, 371, 0, 0, 372, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 374, 375, 376, 377, 378, 0, 0, - 379, 0, 0, 0, 0, 0, 0, 380, 0, 0, 381, 0, 0, 0, 382, 0, 0, 0, 0, 0, 383, - 384, 0, 0, 0, 0, 0, 385, 0, 0, 0, 0, 0, 0, 386, 0, 0, 0, 0, 0, 0, 387, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 388, 0, 0, 0, 0, 0, 0, 389, 390, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 391, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 392, 393, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 394, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 395, 396, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 397, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 398, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 399, 400, 401, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 402, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 403, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 404, - 405, 406, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 407, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 408, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 409, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 410, 411, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 412, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 413, 414, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 415, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 416, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 417, 418, 419, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 420, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 421, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 422, 423, 424, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 425, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 426, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 427, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 428, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 429, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 430, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 431, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 433, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 434, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 435, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 436, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 437, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 438, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 439, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 440, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 441, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 442, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 443, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 444, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 446, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 447, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 448, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 449, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 450, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 451, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 452, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 453, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 454, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 455, 456, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 457, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 458, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 459, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 461, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 462, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 463, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 464, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 465, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 466, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 467, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 468, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 469, 0, - 470, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 471, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 472, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 473, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 474, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 475, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 476, 477, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 478, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 479, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 480, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 481, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 482, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 483, 0, 0, 0, 0, 0, 0, 484, 0, 0, 0, 0, 0, 0, 485, 0, 0, 0, - 0, 0, 0, 486, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 487, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 488, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 489, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 490, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 491, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 492, 0, 0, 0, 0, 0, 0, - 493, 0, 0, 0, 0, 0, 0, 494, 0, 0, 0, 0, 0, 0, 495, 0, 0, 0, 0, 0, 0, 496, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 497, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 498, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 499, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 501, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 0, 503, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 504, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 505, - 506, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 507, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 508, 0, 0, 0, 0, 0, 0, 509, 0, 0, 0, 0, 0, 0, 510, 0, 0, 0, - 0, 0, 0, 511, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 512, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 513, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 514, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 515, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 516, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 517, 0, 0, 0, 0, 0, 0, - 518, 0, 0, 0, 0, 0, 0, 519, 0, 0, 0, 0, 0, 0, 520, 0, 0, 0, 0, 0, 0, 521, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 522, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 523, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 524, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 525, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 526, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 527, 0, 0, 0, 0, 0, 0, 528, 0, 0, 0, 0, - 0, 0, 529, 0, 0, 0, 0, 0, 0, 530, 0, 0, 0, 0, 0, 0, 531, 0, 0, 0, 0, 0, - 532, 533, 0, 0, 0, 0, 0, 534, 0, 0, 0, 0, 0, 0, 535, 0, 0, 0, 0, 0, 0, - 536, 0, 0, 0, 0, 0, 0, 537, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 538, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 539, 540, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 541, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 542, 0, 0, 0, 0, 0, - 0, 543, 0, 0, 0, 0, 0, 0, 544, 0, 0, 0, 0, 0, 0, 545, 0, 0, 0, 0, 0, 546, - 547, 0, 0, 0, 0, 0, 548, 0, 0, 0, 0, 0, 0, 549, 0, 0, 0, 0, 0, 0, 550, 0, - 0, 0, 0, 0, 0, 551, 0, 0, 0, 0, 0, 0, 552, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 553, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 554, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 555, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 556, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 557, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 558, 0, 0, 0, 0, 0, 559, 0, 0, 0, 0, 0, 0, 560, 0, 0, 0, 0, 0, 0, - 561, 0, 0, 0, 0, 0, 0, 562, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 563, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 564, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 565, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 566, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 567, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 568, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 569, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 570, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 571, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 572, 0, 0, 0, 0, 0, 573, 0, 0, 0, 0, 0, 0, 574, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 575, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 576, 0, 0, 0, 0, 0, 577, 578, 0, 0, 0, 0, 0, 579, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 580, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 581, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 582, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 583, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 584, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 585, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 586, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 587, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 588, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 589, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 590, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 591, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 592, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 593, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 594, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 595, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 596, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 597, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 598, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 599, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 601, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 602, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 603, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 604, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 605, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 606, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 607, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 608, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 609, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 611, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 612, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 613, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 614, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 615, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 616, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 617, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 618, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 619, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 620, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 622, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 623, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 624, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 625, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 626, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 627, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 628, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 629, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 630, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 631, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 632, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 633, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 634, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 635, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 636, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 637, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 638, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 639, 640, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 641, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 642, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 643, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 645, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 646, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 647, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 648, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 649, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 650, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 651, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 652, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 653, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 654, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 655, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 656, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 657, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 658, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 659, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 660, 661, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 662, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 663, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 664, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 665, 666, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 667, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 668, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 669, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 670, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 671, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 672, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 673, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 674, -}; - -static unsigned int comp_data[] = { - 0, 0, 0, 0, 0, 0, 0, 8814, 0, 0, 8800, 0, 0, 8815, 0, 0, 0, 192, 193, - 194, 195, 256, 258, 550, 196, 7842, 197, 0, 461, 512, 514, 0, 0, 0, 7840, - 0, 7680, 0, 0, 260, 0, 0, 7682, 0, 0, 7684, 0, 0, 0, 0, 7686, 0, 262, - 264, 0, 0, 0, 266, 0, 0, 0, 0, 268, 0, 199, 0, 0, 0, 7690, 0, 0, 0, 0, - 270, 0, 0, 0, 0, 0, 7692, 0, 0, 0, 7696, 0, 7698, 0, 0, 7694, 0, 0, 0, 0, - 200, 201, 202, 7868, 274, 276, 278, 203, 7866, 0, 0, 282, 516, 518, 0, 0, - 0, 7864, 0, 0, 0, 552, 280, 7704, 0, 7706, 0, 0, 0, 7710, 0, 500, 284, 0, - 7712, 286, 288, 0, 0, 0, 0, 486, 0, 290, 0, 0, 0, 292, 0, 0, 0, 7714, - 7718, 0, 0, 0, 542, 0, 0, 0, 0, 0, 7716, 0, 0, 0, 7720, 0, 0, 7722, 0, 0, - 204, 205, 206, 296, 298, 300, 304, 207, 7880, 0, 0, 463, 520, 522, 0, 0, - 0, 7882, 0, 0, 0, 0, 302, 0, 0, 7724, 0, 0, 0, 308, 0, 7728, 0, 0, 0, 0, - 0, 488, 0, 7730, 0, 0, 0, 310, 0, 0, 0, 0, 7732, 0, 0, 0, 0, 0, 313, 0, - 317, 0, 0, 0, 0, 0, 7734, 0, 0, 0, 315, 0, 7740, 0, 0, 7738, 0, 0, 0, 0, - 0, 7742, 0, 0, 0, 0, 7744, 0, 0, 7746, 0, 504, 323, 0, 209, 0, 0, 7748, - 0, 0, 0, 0, 327, 0, 7750, 0, 0, 0, 325, 0, 7754, 0, 0, 7752, 0, 0, 0, 0, - 210, 211, 212, 213, 332, 334, 558, 214, 7886, 0, 336, 465, 524, 526, 0, - 0, 416, 7884, 0, 0, 0, 0, 490, 0, 0, 0, 0, 0, 7764, 7766, 0, 0, 0, 0, 0, - 340, 0, 0, 0, 0, 7768, 344, 528, 530, 0, 0, 0, 7770, 0, 0, 0, 342, 0, 0, - 0, 0, 7774, 0, 346, 348, 0, 0, 0, 7776, 0, 0, 0, 0, 352, 0, 7778, 0, 0, - 536, 350, 0, 0, 0, 7786, 0, 0, 0, 0, 356, 0, 7788, 0, 0, 538, 354, 0, - 7792, 0, 0, 7790, 0, 0, 0, 0, 217, 218, 219, 360, 362, 364, 0, 220, 7910, - 366, 368, 467, 532, 534, 0, 0, 431, 7908, 7794, 0, 0, 0, 370, 7798, 0, - 7796, 7804, 0, 0, 0, 0, 0, 7806, 0, 7808, 7810, 372, 0, 0, 0, 7814, 7812, - 0, 7816, 0, 0, 0, 7818, 7820, 0, 0, 0, 7922, 221, 374, 7928, 562, 0, - 7822, 376, 7926, 0, 0, 0, 0, 7924, 0, 0, 377, 7824, 0, 0, 0, 379, 381, 0, - 0, 0, 0, 0, 7826, 0, 0, 0, 0, 7828, 224, 225, 226, 227, 257, 259, 551, - 228, 7843, 229, 0, 462, 513, 515, 0, 0, 0, 7841, 0, 7681, 0, 0, 261, 0, - 0, 7683, 0, 0, 7685, 0, 0, 0, 0, 7687, 0, 0, 0, 0, 0, 263, 265, 0, 0, 0, - 267, 0, 0, 0, 0, 269, 0, 0, 0, 0, 0, 231, 0, 0, 0, 7691, 271, 0, 0, 0, 0, - 0, 7693, 0, 0, 0, 7697, 0, 7699, 0, 0, 7695, 232, 233, 234, 7869, 275, - 277, 279, 235, 7867, 0, 0, 283, 517, 519, 0, 0, 0, 7865, 0, 0, 0, 553, - 281, 7705, 0, 7707, 0, 0, 0, 7711, 0, 0, 0, 0, 0, 501, 285, 0, 7713, 287, - 289, 0, 0, 0, 0, 487, 0, 0, 0, 0, 0, 291, 0, 0, 0, 293, 0, 0, 0, 7715, - 7719, 0, 0, 0, 543, 0, 0, 0, 0, 0, 7717, 0, 0, 0, 7721, 0, 0, 7723, 0, - 7830, 236, 237, 238, 297, 299, 301, 0, 239, 7881, 0, 0, 464, 521, 523, 0, - 0, 0, 7883, 0, 0, 0, 0, 303, 0, 0, 7725, 0, 0, 0, 309, 0, 0, 0, 0, 496, - 0, 0, 0, 0, 7729, 0, 489, 0, 0, 0, 0, 0, 7731, 0, 0, 0, 311, 7733, 0, 0, - 0, 0, 0, 314, 0, 318, 0, 0, 0, 0, 0, 7735, 0, 0, 0, 316, 0, 7741, 0, 0, - 7739, 0, 7743, 0, 0, 0, 0, 7745, 0, 0, 7747, 0, 0, 0, 0, 0, 505, 324, 0, - 241, 0, 0, 7749, 0, 0, 0, 0, 328, 0, 7751, 0, 0, 0, 326, 0, 7755, 0, 0, - 7753, 0, 0, 0, 0, 242, 243, 244, 245, 333, 335, 559, 246, 7887, 0, 337, - 466, 525, 527, 0, 0, 417, 7885, 491, 0, 0, 0, 0, 0, 7765, 0, 0, 0, 0, - 7767, 0, 341, 0, 0, 0, 0, 7769, 0, 0, 0, 0, 345, 529, 531, 0, 0, 0, 7771, - 0, 0, 0, 343, 0, 0, 0, 0, 7775, 0, 347, 349, 0, 0, 0, 7777, 0, 0, 0, 0, - 353, 0, 7779, 0, 0, 537, 351, 0, 0, 0, 7787, 7831, 0, 0, 0, 357, 0, 0, 0, - 0, 0, 7789, 0, 0, 539, 355, 0, 7793, 0, 0, 7791, 0, 0, 0, 0, 249, 250, - 251, 361, 363, 365, 0, 252, 7911, 367, 369, 468, 533, 535, 0, 0, 432, - 7909, 7795, 0, 0, 0, 371, 7799, 0, 7797, 0, 0, 0, 0, 7805, 0, 7807, 0, 0, - 0, 0, 0, 7809, 7811, 373, 0, 0, 0, 7815, 7813, 0, 7832, 0, 0, 0, 7817, 0, - 0, 0, 7819, 7821, 0, 0, 0, 7923, 253, 375, 7929, 563, 0, 7823, 255, 7927, - 7833, 0, 0, 0, 7925, 0, 0, 378, 7825, 0, 0, 0, 380, 0, 0, 0, 0, 382, 0, - 7827, 0, 0, 0, 0, 7829, 0, 0, 0, 0, 8173, 901, 0, 0, 0, 0, 0, 0, 8129, 0, - 0, 7846, 7844, 0, 7850, 0, 0, 0, 0, 7848, 0, 0, 478, 0, 0, 0, 506, 0, 0, - 508, 0, 0, 482, 0, 0, 0, 7688, 0, 7872, 7870, 0, 7876, 0, 0, 0, 0, 7874, - 0, 0, 0, 7726, 0, 0, 0, 0, 0, 7890, 7888, 0, 7894, 0, 0, 0, 0, 7892, 0, - 0, 0, 7756, 0, 0, 556, 0, 0, 7758, 0, 0, 0, 554, 0, 0, 0, 510, 0, 0, 0, - 0, 0, 475, 471, 0, 0, 469, 0, 0, 473, 0, 0, 0, 7847, 7845, 0, 7851, 0, 0, - 0, 0, 7849, 0, 0, 479, 0, 0, 0, 507, 0, 0, 509, 0, 0, 483, 0, 0, 0, 7689, - 0, 7873, 7871, 0, 7877, 0, 0, 0, 0, 7875, 0, 0, 0, 7727, 0, 0, 0, 0, 0, - 7891, 7889, 0, 7895, 0, 0, 0, 0, 7893, 0, 0, 0, 7757, 0, 0, 557, 0, 0, - 7759, 0, 0, 0, 555, 0, 0, 0, 511, 0, 0, 0, 0, 0, 476, 472, 0, 0, 470, 0, - 0, 474, 0, 0, 0, 7856, 7854, 0, 7860, 0, 0, 0, 0, 7858, 0, 0, 7857, 7855, - 0, 7861, 0, 0, 0, 0, 7859, 0, 0, 7700, 7702, 0, 0, 0, 0, 0, 7701, 7703, - 0, 0, 0, 0, 0, 7760, 7762, 0, 7761, 7763, 0, 0, 0, 7780, 0, 0, 7781, 0, - 0, 7782, 0, 0, 0, 0, 0, 0, 7783, 0, 7800, 0, 0, 7801, 0, 0, 0, 0, 7802, - 0, 0, 7803, 0, 0, 0, 0, 0, 7835, 0, 0, 0, 0, 7900, 7898, 0, 7904, 0, 0, - 0, 0, 7902, 7906, 0, 0, 0, 0, 0, 7901, 7899, 0, 7905, 0, 0, 0, 0, 7903, - 0, 0, 0, 0, 7907, 0, 7914, 7912, 0, 7918, 0, 0, 0, 0, 7916, 0, 0, 0, 0, - 7920, 0, 7915, 7913, 0, 7919, 7917, 0, 0, 0, 0, 7921, 0, 0, 0, 0, 494, 0, - 0, 0, 492, 0, 0, 493, 0, 0, 480, 0, 0, 0, 0, 0, 0, 481, 0, 0, 0, 7708, 0, - 0, 7709, 0, 560, 0, 0, 0, 0, 0, 0, 561, 0, 495, 0, 0, 0, 8122, 902, 0, 0, - 8121, 8120, 0, 0, 0, 0, 7944, 7945, 0, 0, 0, 0, 0, 8124, 0, 8136, 904, 0, - 0, 0, 0, 7960, 7961, 0, 0, 0, 8138, 905, 0, 0, 0, 0, 7976, 7977, 0, 8140, - 0, 0, 0, 0, 0, 8154, 906, 0, 0, 8153, 8152, 0, 938, 0, 0, 7992, 7993, 0, - 0, 0, 8184, 908, 0, 0, 0, 0, 8008, 8009, 0, 0, 0, 0, 0, 0, 8172, 0, 0, 0, - 8170, 910, 0, 0, 8169, 8168, 0, 939, 0, 0, 0, 8025, 0, 0, 0, 8186, 911, - 8040, 8041, 0, 0, 0, 0, 0, 8188, 0, 0, 8116, 0, 0, 8132, 0, 0, 0, 0, 0, - 8048, 940, 0, 0, 8113, 8112, 0, 0, 0, 0, 7936, 7937, 0, 0, 0, 0, 8118, - 8115, 0, 0, 0, 0, 0, 8050, 941, 7952, 7953, 0, 0, 0, 8052, 942, 0, 0, 0, - 0, 7968, 7969, 0, 0, 0, 0, 8134, 8131, 0, 8054, 943, 0, 0, 8145, 8144, 0, - 970, 0, 0, 7984, 7985, 8150, 0, 0, 0, 0, 0, 0, 8056, 972, 0, 0, 0, 0, - 8000, 8001, 0, 8164, 8165, 0, 0, 0, 8058, 973, 0, 0, 8161, 8160, 0, 971, - 0, 0, 0, 0, 0, 0, 8016, 8017, 0, 0, 0, 0, 8166, 0, 0, 8060, 974, 0, 0, 0, - 0, 8032, 8033, 8182, 8179, 0, 0, 0, 0, 0, 8146, 912, 0, 0, 0, 0, 0, 0, - 8151, 0, 0, 8162, 944, 0, 0, 8167, 0, 0, 0, 8180, 0, 0, 979, 0, 0, 0, 0, - 0, 980, 0, 0, 1031, 0, 0, 0, 0, 1232, 0, 1234, 0, 0, 0, 0, 1027, 0, 1024, - 0, 0, 0, 0, 1238, 0, 1025, 1217, 0, 1244, 0, 0, 1246, 0, 0, 0, 1037, 0, - 0, 0, 1250, 1049, 0, 1252, 0, 0, 0, 0, 1036, 0, 0, 0, 0, 1254, 0, 0, 0, - 1262, 1038, 0, 1264, 0, 0, 1266, 0, 0, 0, 1268, 0, 0, 0, 0, 0, 0, 1272, - 0, 0, 1260, 0, 0, 0, 0, 1233, 0, 1235, 0, 0, 0, 0, 1107, 0, 1104, 0, 0, - 0, 0, 1239, 0, 1105, 1218, 0, 1245, 0, 0, 1247, 0, 0, 0, 1117, 0, 0, 0, - 1251, 1081, 0, 1253, 0, 0, 0, 0, 1116, 0, 0, 0, 0, 1255, 0, 0, 0, 1263, - 1118, 0, 1265, 0, 0, 1267, 0, 0, 0, 1269, 0, 0, 0, 0, 0, 0, 1273, 0, 0, - 1261, 0, 0, 1111, 0, 0, 0, 1142, 0, 0, 1143, 0, 0, 0, 0, 0, 1242, 0, 0, - 1243, 0, 0, 1258, 0, 0, 0, 0, 0, 0, 1259, 0, 1570, 1571, 1573, 0, 1572, - 0, 0, 1574, 0, 0, 0, 0, 0, 0, 1730, 0, 0, 1747, 0, 0, 1728, 0, 0, 0, 0, - 2345, 0, 0, 2353, 0, 0, 2356, 0, 0, 0, 2507, 2508, 0, 0, 0, 2891, 2888, - 2892, 2964, 0, 0, 0, 0, 0, 3018, 3020, 0, 3019, 0, 0, 0, 0, 3144, 0, 0, - 0, 0, 3264, 0, 3274, 3271, 3272, 0, 3275, 0, 0, 0, 0, 3402, 3404, 0, - 3403, 0, 0, 0, 0, 3546, 3548, 3550, 0, 0, 0, 0, 3549, 0, 0, 0, 0, 0, - 4134, 0, 0, 0, 6918, 0, 0, 6920, 0, 0, 6922, 0, 0, 6924, 0, 0, 0, 0, 0, - 0, 6926, 0, 0, 6930, 0, 0, 6971, 0, 0, 6973, 0, 0, 0, 0, 0, 0, 6976, 0, - 0, 6977, 0, 0, 6979, 0, 0, 0, 7736, 0, 0, 7737, 0, 0, 0, 0, 0, 0, 7772, - 0, 0, 7773, 0, 0, 0, 0, 7784, 0, 0, 7785, 0, 0, 7852, 0, 0, 7862, 0, 0, - 0, 7853, 0, 0, 7863, 0, 0, 0, 7878, 0, 0, 7879, 0, 0, 7896, 0, 0, 7897, - 0, 0, 0, 0, 7938, 7940, 0, 0, 7942, 8064, 0, 7939, 7941, 0, 0, 7943, - 8065, 0, 0, 8066, 0, 0, 0, 0, 0, 0, 8067, 0, 0, 8068, 0, 0, 8069, 0, 0, - 8070, 0, 0, 0, 0, 0, 0, 8071, 0, 7946, 7948, 0, 0, 7950, 8072, 0, 7947, - 7949, 0, 0, 7951, 8073, 0, 0, 8074, 0, 0, 0, 0, 0, 0, 8075, 0, 0, 8076, - 0, 0, 8077, 0, 0, 8078, 0, 0, 0, 0, 0, 0, 8079, 0, 7954, 7956, 0, 7955, - 7957, 0, 0, 0, 0, 0, 7962, 7964, 0, 0, 0, 0, 0, 7963, 7965, 0, 7970, - 7972, 0, 0, 7974, 8080, 0, 7971, 7973, 0, 0, 7975, 8081, 0, 0, 8082, 0, - 0, 0, 0, 0, 0, 8083, 0, 0, 8084, 0, 0, 8085, 0, 0, 8086, 0, 0, 0, 0, 0, - 0, 8087, 0, 7978, 7980, 0, 0, 7982, 8088, 0, 7979, 7981, 0, 0, 7983, - 8089, 0, 0, 8090, 0, 0, 0, 0, 0, 0, 8091, 0, 0, 8092, 0, 0, 8093, 0, 0, - 8094, 0, 0, 0, 0, 0, 0, 8095, 0, 7986, 7988, 0, 0, 7990, 0, 0, 7987, - 7989, 0, 0, 7991, 0, 0, 0, 0, 0, 0, 7994, 7996, 0, 0, 0, 0, 0, 0, 7998, - 0, 0, 7995, 7997, 0, 0, 7999, 0, 0, 8002, 8004, 0, 8003, 8005, 0, 0, 0, - 0, 0, 8010, 8012, 0, 0, 0, 0, 0, 8011, 8013, 0, 8018, 8020, 0, 0, 8022, - 0, 0, 8019, 8021, 0, 0, 8023, 0, 0, 0, 0, 0, 0, 8027, 8029, 0, 0, 0, 0, - 0, 0, 8031, 0, 0, 8034, 8036, 0, 0, 8038, 8096, 0, 8035, 8037, 0, 0, - 8039, 8097, 0, 0, 8098, 0, 0, 8099, 0, 0, 0, 0, 0, 0, 8100, 0, 0, 8101, - 0, 0, 8102, 0, 0, 8103, 0, 0, 0, 0, 0, 8042, 8044, 0, 0, 8046, 8104, 0, - 8043, 8045, 0, 0, 8047, 8105, 0, 0, 8106, 0, 0, 8107, 0, 0, 0, 0, 0, 0, - 8108, 0, 0, 8109, 0, 0, 8110, 0, 0, 8111, 0, 0, 0, 0, 0, 0, 8114, 0, 0, - 8130, 0, 0, 8178, 0, 0, 8119, 0, 0, 0, 0, 0, 8141, 8142, 0, 0, 8143, 0, - 0, 0, 8135, 0, 0, 8183, 0, 0, 0, 0, 0, 8157, 8158, 0, 0, 0, 0, 0, 0, - 8159, 0, 8602, 0, 0, 8603, 0, 0, 0, 0, 0, 0, 8622, 0, 0, 8653, 0, 0, - 8655, 0, 0, 8654, 0, 0, 0, 0, 0, 0, 8708, 0, 0, 8713, 0, 0, 8716, 0, 0, - 8740, 0, 0, 0, 0, 0, 0, 8742, 0, 0, 8769, 0, 0, 8772, 0, 0, 8775, 0, 0, - 0, 0, 0, 0, 8777, 0, 0, 8813, 0, 0, 8802, 0, 0, 8816, 0, 0, 0, 0, 0, 0, - 8817, 0, 0, 8820, 0, 0, 8821, 0, 0, 8824, 0, 0, 0, 0, 0, 0, 8825, 0, 0, - 8832, 0, 0, 8833, 0, 0, 8928, 0, 0, 0, 0, 0, 0, 8929, 0, 0, 8836, 0, 0, - 8837, 0, 0, 8840, 0, 0, 0, 0, 0, 0, 8841, 0, 0, 8930, 0, 0, 8931, 0, 0, - 8876, 0, 0, 0, 0, 0, 0, 8877, 0, 0, 8878, 0, 0, 8879, 0, 0, 8938, 0, 0, - 0, 0, 0, 0, 8939, 0, 0, 8940, 0, 0, 8941, 0, 0, 0, 12436, 0, 0, 12364, 0, - 0, 0, 0, 0, 0, 12366, 0, 0, 12368, 0, 0, 12370, 0, 0, 12372, 0, 0, 0, 0, - 0, 0, 12374, 0, 0, 12376, 0, 0, 12378, 0, 0, 12380, 0, 0, 0, 0, 0, 0, - 12382, 0, 0, 12384, 0, 0, 12386, 0, 0, 12389, 0, 0, 0, 0, 0, 0, 12391, 0, - 0, 12393, 0, 0, 12400, 12401, 0, 12403, 12404, 0, 0, 0, 0, 0, 12406, - 12407, 0, 0, 0, 0, 0, 12409, 12410, 0, 12412, 12413, 0, 12446, 0, 0, 0, - 0, 0, 0, 12532, 0, 0, 12460, 0, 0, 12462, 0, 0, 12464, 0, 0, 0, 0, 0, 0, - 12466, 0, 0, 12468, 0, 0, 12470, 0, 0, 12472, 0, 0, 0, 0, 0, 0, 12474, 0, - 0, 12476, 0, 0, 12478, 0, 0, 12480, 0, 0, 0, 0, 0, 0, 12482, 0, 0, 12485, - 0, 0, 12487, 0, 0, 12489, 0, 0, 0, 0, 0, 0, 12496, 12497, 0, 0, 0, 0, 0, - 12499, 12500, 0, 12502, 12503, 0, 12505, 12506, 0, 0, 0, 0, 0, 12508, - 12509, 0, 0, 0, 0, 0, 12535, 0, 0, 12536, 0, 0, 12537, 0, 0, 0, 0, 0, 0, - 12538, 0, 0, 12542, 0, 0, 0, 0, 69786, 0, 0, 69788, 0, 0, 69803, -}; - -static const change_record change_records_3_2_0[] = { - { 255, 255, 255, 255, 0 }, - { 11, 255, 255, 255, 0 }, - { 10, 255, 255, 255, 0 }, - { 19, 21, 255, 255, 0 }, - { 255, 255, 2, 255, 0 }, - { 255, 255, 3, 255, 0 }, - { 255, 255, 1, 255, 0 }, - { 255, 0, 255, 255, 0 }, - { 255, 2, 255, 255, 0 }, - { 255, 29, 255, 255, 0 }, - { 255, 26, 255, 255, 0 }, - { 5, 255, 255, 255, 0 }, - { 255, 255, 255, 255, 1.0 }, - { 255, 255, 255, 255, 2.0 }, - { 255, 255, 255, 255, 3.0 }, - { 255, 255, 255, 255, 4.0 }, - { 255, 255, 255, 255, -1 }, - { 14, 255, 255, 255, 0 }, - { 255, 255, 255, 0, 0 }, - { 255, 7, 1, 255, 0 }, - { 255, 7, 2, 255, 0 }, - { 255, 7, 3, 255, 0 }, - { 255, 7, 4, 255, 0 }, - { 255, 7, 5, 255, 0 }, - { 255, 7, 6, 255, 0 }, - { 255, 7, 7, 255, 0 }, - { 255, 7, 8, 255, 0 }, - { 255, 7, 9, 255, 0 }, - { 255, 5, 255, 255, 0 }, - { 15, 14, 255, 255, 0 }, - { 255, 10, 255, 255, 0 }, - { 18, 255, 255, 255, 0 }, - { 19, 255, 255, 255, 0 }, - { 255, 255, 0, 255, 0 }, - { 255, 255, 4, 255, 0 }, - { 255, 255, 5, 255, 0 }, - { 255, 255, 6, 255, 0 }, - { 255, 255, 7, 255, 0 }, - { 255, 255, 8, 255, 0 }, - { 255, 255, 9, 255, 0 }, - { 19, 30, 255, 255, 0 }, - { 255, 8, 255, 255, 0 }, - { 255, 22, 255, 255, 0 }, - { 255, 23, 255, 255, 0 }, - { 9, 255, 255, 255, 0 }, - { 255, 20, 255, 255, 0 }, - { 255, 255, 255, 255, 1e+16 }, - { 255, 255, 255, 255, 1e+20 }, - { 255, 19, 255, 255, 0 }, - { 15, 255, 255, 255, 0 }, - { 255, 19, 255, 255, -1 }, - { 1, 255, 255, 0, 0 }, -}; -static unsigned char changes_3_2_0_index[] = { - 0, 1, 2, 2, 3, 4, 5, 6, 2, 7, 8, 9, 10, 11, 12, 13, 14, 2, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 2, 2, 2, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, - 34, 2, 2, 2, 35, 36, 2, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, - 49, 2, 50, 2, 2, 51, 52, 53, 54, 55, 2, 2, 56, 57, 58, 2, 2, 59, 60, 61, - 62, 63, 63, 2, 2, 2, 2, 64, 2, 65, 66, 67, 68, 69, 2, 2, 2, 2, 70, 71, - 72, 73, 74, 75, 76, 77, 78, 2, 2, 2, 2, 2, 2, 79, 2, 2, 2, 2, 2, 80, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 81, 2, 82, 2, 2, 2, 2, 2, 2, 2, 2, 83, - 84, 2, 2, 2, 2, 2, 2, 2, 85, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 86, 87, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 88, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 89, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 90, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 91, 92, 2, 2, 2, 2, 2, 2, 2, 2, 93, 48, 48, - 94, 95, 48, 96, 97, 98, 99, 100, 101, 102, 2, 103, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 104, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 105, 106, 107, 108, 109, 2, 2, 2, 2, 110, 111, 2, 112, 113, 114, - 115, 116, 117, 2, 118, 119, 120, 121, 122, 2, 2, 2, 2, 2, 2, 123, 2, 124, - 2, 125, 2, 126, 2, 127, 2, 2, 2, 128, 2, 2, 2, 2, 129, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 48, 48, 48, 48, 48, 48, 130, 2, 131, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 48, 48, 48, 48, 48, 48, 48, 48, 132, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 133, 2, 134, 2, 135, 2, 2, 136, 2, 2, 2, 137, 138, 139, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 140, 141, 142, 143, - 144, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 145, 146, 90, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 79, 147, 2, 148, 149, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 150, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 151, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 152, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 153, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, - 48, 154, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 150, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 48, - 155, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -}; - -static unsigned char changes_3_2_0_data[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 2, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 4, 5, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 9, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 9, 0, 7, 7, 0, 0, 0, 7, 7, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 10, 0, 0, 0, 0, 0, 0, 7, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, - 0, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 12, 13, 14, 15, 16, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, - 17, 0, 0, 0, 0, 0, 0, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, - 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 7, 7, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 19, 20, 21, 22, 23, 24, 25, 26, 27, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 28, 28, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 0, 0, 0, 0, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 7, 7, 7, - 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 33, 8, 0, - 0, 34, 35, 36, 37, 38, 39, 1, 1, 0, 0, 0, 8, 33, 6, 4, 5, 34, 35, 36, 37, - 38, 39, 1, 1, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, - 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 41, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 42, 43, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 0, - 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 0, - 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 0, - 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, - 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 48, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 0, - 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 18, 18, 18, 18, 18, 0, 0, 0, 1, 1, 18, - 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 49, 49, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 0, 0, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 7, 7, 0, 0, 0, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 0, 7, 7, 0, 0, 0, 0, 0, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 0, - 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 51, - 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 7, 0, 0, 7, 0, - 0, 0, 7, 0, 0, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, - 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 7, 0, 7, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, - 7, 7, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, - 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; - -static const change_record* get_change_3_2_0(Py_UCS4 n) -{ - int index; - if (n >= 0x110000) index = 0; - else { - index = changes_3_2_0_index[n>>7]; - index = changes_3_2_0_data[(index<<7)+(n & 127)]; - } - return change_records_3_2_0+index; -} - -static Py_UCS4 normalization_3_2_0(Py_UCS4 n) -{ - switch(n) { - case 0x2f868: return 0x2136A; - case 0x2f874: return 0x5F33; - case 0x2f91f: return 0x43AB; - case 0x2f95f: return 0x7AAE; - case 0x2f9bf: return 0x4D57; - default: return 0; - } -} - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodename_db.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodename_db.h deleted file mode 100644 index 5f70051..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/unicodename_db.h +++ /dev/null @@ -1,17259 +0,0 @@ -/* this file was generated by Tools/unicode/makeunicodedata.py 2.6 */ - -#define NAME_MAXLEN 256 - -/* lexicon */ -static unsigned char lexicon[] = { - 76, 69, 84, 84, 69, 210, 87, 73, 84, 200, 83, 77, 65, 76, 204, 83, 89, - 76, 76, 65, 66, 76, 197, 83, 73, 71, 206, 67, 65, 80, 73, 84, 65, 204, - 76, 65, 84, 73, 206, 89, 201, 67, 74, 203, 69, 71, 89, 80, 84, 73, 65, - 206, 72, 73, 69, 82, 79, 71, 76, 89, 80, 200, 65, 82, 65, 66, 73, 195, - 67, 79, 77, 80, 65, 84, 73, 66, 73, 76, 73, 84, 217, 77, 65, 84, 72, 69, - 77, 65, 84, 73, 67, 65, 204, 67, 85, 78, 69, 73, 70, 79, 82, 205, 83, 89, - 77, 66, 79, 204, 70, 79, 82, 77, 128, 67, 65, 78, 65, 68, 73, 65, 206, - 83, 89, 76, 76, 65, 66, 73, 67, 211, 68, 73, 71, 73, 212, 66, 79, 76, - 196, 72, 65, 78, 71, 85, 204, 71, 82, 69, 69, 203, 76, 73, 71, 65, 84, - 85, 82, 197, 65, 78, 196, 77, 85, 83, 73, 67, 65, 204, 84, 73, 77, 69, - 211, 69, 84, 72, 73, 79, 80, 73, 195, 86, 79, 87, 69, 204, 73, 84, 65, - 76, 73, 195, 67, 89, 82, 73, 76, 76, 73, 195, 82, 65, 68, 73, 67, 65, - 204, 83, 65, 78, 83, 45, 83, 69, 82, 73, 198, 67, 73, 82, 67, 76, 69, - 196, 70, 79, 210, 67, 79, 77, 66, 73, 78, 73, 78, 199, 84, 65, 201, 86, - 65, 201, 70, 73, 78, 65, 204, 83, 81, 85, 65, 82, 197, 86, 65, 82, 73, - 65, 84, 73, 79, 206, 76, 69, 70, 212, 66, 82, 65, 73, 76, 76, 197, 80, - 65, 84, 84, 69, 82, 206, 82, 73, 71, 72, 212, 66, 89, 90, 65, 78, 84, 73, - 78, 197, 73, 83, 79, 76, 65, 84, 69, 196, 194, 65, 66, 79, 86, 69, 128, - 68, 79, 85, 66, 76, 197, 75, 65, 84, 65, 75, 65, 78, 193, 75, 65, 78, 71, - 88, 201, 78, 85, 77, 66, 69, 210, 83, 73, 71, 78, 128, 66, 69, 76, 79, - 87, 128, 76, 73, 78, 69, 65, 210, 77, 79, 68, 73, 70, 73, 69, 210, 84, - 73, 66, 69, 84, 65, 206, 65, 128, 68, 79, 212, 77, 69, 69, 205, 77, 89, - 65, 78, 77, 65, 210, 67, 65, 82, 82, 73, 69, 210, 65, 82, 82, 79, 87, - 128, 73, 78, 73, 84, 73, 65, 204, 87, 72, 73, 84, 197, 85, 128, 86, 69, - 82, 84, 73, 67, 65, 204, 89, 69, 200, 65, 66, 79, 86, 197, 73, 128, 79, - 128, 67, 79, 80, 84, 73, 195, 65, 82, 82, 79, 215, 77, 79, 78, 71, 79, - 76, 73, 65, 206, 77, 65, 82, 75, 128, 75, 72, 77, 69, 210, 68, 69, 86, - 65, 78, 65, 71, 65, 82, 201, 84, 73, 76, 197, 80, 65, 82, 69, 78, 84, 72, - 69, 83, 73, 90, 69, 196, 84, 72, 65, 205, 66, 76, 65, 67, 203, 74, 79, - 78, 71, 83, 69, 79, 78, 199, 66, 79, 216, 72, 69, 66, 82, 69, 215, 80, - 76, 85, 211, 68, 82, 65, 87, 73, 78, 71, 211, 82, 73, 71, 72, 84, 87, 65, - 82, 68, 211, 67, 72, 79, 83, 69, 79, 78, 199, 83, 84, 82, 79, 75, 69, - 128, 72, 65, 76, 70, 87, 73, 68, 84, 200, 66, 65, 76, 73, 78, 69, 83, - 197, 71, 69, 79, 82, 71, 73, 65, 206, 72, 79, 79, 75, 128, 73, 68, 69, - 79, 71, 82, 65, 205, 73, 68, 69, 79, 71, 82, 65, 80, 72, 73, 195, 65, 76, - 69, 198, 83, 89, 77, 66, 79, 76, 128, 84, 79, 128, 83, 67, 82, 73, 80, - 212, 84, 87, 79, 128, 79, 86, 69, 210, 213, 72, 69, 65, 86, 217, 79, 78, - 69, 128, 85, 208, 76, 79, 215, 70, 85, 76, 76, 87, 73, 68, 84, 200, 72, - 65, 200, 68, 79, 87, 206, 69, 81, 85, 65, 204, 66, 82, 65, 67, 75, 69, - 84, 128, 72, 73, 71, 200, 79, 198, 84, 65, 199, 68, 79, 77, 73, 78, 207, - 78, 85, 77, 69, 82, 73, 195, 70, 82, 65, 75, 84, 85, 210, 74, 85, 78, 71, - 83, 69, 79, 78, 199, 77, 65, 76, 65, 89, 65, 76, 65, 205, 84, 87, 207, - 71, 76, 65, 71, 79, 76, 73, 84, 73, 195, 67, 72, 65, 82, 65, 67, 84, 69, - 210, 76, 69, 70, 84, 87, 65, 82, 68, 211, 77, 69, 68, 73, 65, 204, 84, - 69, 76, 85, 71, 213, 66, 69, 78, 71, 65, 76, 201, 79, 78, 197, 65, 82, - 77, 69, 78, 73, 65, 206, 74, 65, 86, 65, 78, 69, 83, 197, 74, 69, 69, - 205, 66, 65, 82, 128, 72, 73, 82, 65, 71, 65, 78, 193, 87, 69, 83, 84, - 45, 67, 82, 69, 197, 73, 68, 69, 79, 71, 82, 65, 80, 200, 66, 65, 77, 85, - 205, 84, 72, 65, 201, 75, 65, 78, 78, 65, 68, 193, 67, 72, 69, 82, 79, - 75, 69, 197, 72, 65, 76, 198, 84, 79, 78, 197, 78, 69, 215, 79, 82, 73, - 89, 193, 84, 72, 82, 69, 197, 67, 72, 65, 205, 71, 85, 74, 65, 82, 65, - 84, 201, 76, 85, 197, 70, 79, 85, 82, 128, 72, 65, 128, 82, 85, 78, 73, - 195, 83, 65, 85, 82, 65, 83, 72, 84, 82, 193, 84, 69, 84, 82, 65, 71, 82, - 65, 205, 84, 72, 82, 69, 69, 128, 68, 69, 83, 69, 82, 69, 212, 83, 73, - 78, 72, 65, 76, 193, 71, 85, 82, 77, 85, 75, 72, 201, 77, 65, 82, 203, - 78, 79, 84, 65, 84, 73, 79, 206, 83, 89, 82, 73, 65, 195, 86, 79, 67, 65, - 76, 73, 195, 65, 67, 85, 84, 69, 128, 76, 69, 80, 67, 72, 193, 76, 73, - 71, 72, 212, 76, 79, 78, 199, 84, 85, 82, 75, 73, 195, 68, 79, 85, 66, - 76, 69, 45, 83, 84, 82, 85, 67, 203, 70, 73, 86, 69, 128, 75, 65, 128, - 84, 65, 77, 73, 204, 86, 73, 69, 212, 65, 80, 204, 70, 85, 78, 67, 84, - 73, 79, 78, 65, 204, 72, 65, 77, 90, 193, 83, 73, 88, 128, 84, 69, 76, - 69, 71, 82, 65, 80, 200, 89, 65, 128, 69, 73, 71, 72, 84, 128, 72, 79, - 82, 73, 90, 79, 78, 84, 65, 204, 80, 65, 128, 68, 79, 84, 211, 78, 73, - 78, 69, 128, 83, 69, 86, 69, 78, 128, 66, 65, 82, 194, 68, 65, 83, 73, - 193, 75, 65, 73, 84, 72, 201, 76, 73, 77, 66, 213, 77, 65, 128, 77, 65, - 75, 83, 85, 82, 193, 83, 128, 84, 207, 66, 79, 80, 79, 77, 79, 70, 207, - 75, 72, 65, 82, 79, 83, 72, 84, 72, 201, 76, 65, 207, 82, 65, 128, 83, - 81, 85, 65, 82, 69, 196, 72, 69, 88, 65, 71, 82, 65, 205, 75, 193, 78, - 65, 128, 80, 83, 73, 76, 201, 82, 69, 86, 69, 82, 83, 69, 196, 77, 79, - 78, 79, 83, 80, 65, 67, 197, 78, 79, 212, 83, 65, 77, 65, 82, 73, 84, 65, - 206, 83, 84, 82, 79, 75, 197, 84, 85, 82, 78, 69, 196, 86, 128, 90, 90, - 89, 88, 128, 90, 90, 89, 84, 128, 90, 90, 89, 82, 88, 128, 90, 90, 89, - 82, 128, 90, 90, 89, 80, 128, 90, 90, 89, 128, 90, 90, 85, 88, 128, 90, - 90, 85, 82, 88, 128, 90, 90, 85, 82, 128, 90, 90, 85, 80, 128, 90, 90, - 85, 128, 90, 90, 79, 88, 128, 90, 90, 79, 80, 128, 90, 90, 79, 128, 90, - 90, 73, 88, 128, 90, 90, 73, 84, 128, 90, 90, 73, 80, 128, 90, 90, 73, - 69, 88, 128, 90, 90, 73, 69, 84, 128, 90, 90, 73, 69, 80, 128, 90, 90, - 73, 69, 128, 90, 90, 73, 128, 90, 90, 69, 88, 128, 90, 90, 69, 80, 128, - 90, 90, 69, 69, 128, 90, 90, 69, 128, 90, 90, 65, 88, 128, 90, 90, 65, - 84, 128, 90, 90, 65, 80, 128, 90, 90, 65, 65, 128, 90, 90, 65, 128, 90, - 89, 71, 79, 83, 128, 90, 87, 65, 82, 65, 75, 65, 89, 128, 90, 87, 65, - 128, 90, 85, 84, 128, 90, 85, 79, 88, 128, 90, 85, 79, 80, 128, 90, 85, - 79, 128, 90, 85, 77, 128, 90, 85, 66, 85, 82, 128, 90, 85, 53, 128, 90, - 85, 181, 90, 82, 65, 128, 90, 81, 65, 80, 72, 193, 90, 79, 84, 128, 90, - 79, 79, 128, 90, 79, 65, 128, 90, 76, 65, 77, 193, 90, 76, 65, 128, 90, - 76, 193, 90, 74, 69, 128, 90, 73, 90, 50, 128, 90, 73, 81, 65, 65, 128, - 90, 73, 78, 79, 82, 128, 90, 73, 76, 68, 69, 128, 90, 73, 71, 90, 65, - 199, 90, 73, 71, 128, 90, 73, 68, 193, 90, 73, 66, 128, 90, 73, 194, 90, - 73, 51, 128, 90, 201, 90, 72, 89, 88, 128, 90, 72, 89, 84, 128, 90, 72, - 89, 82, 88, 128, 90, 72, 89, 82, 128, 90, 72, 89, 80, 128, 90, 72, 89, - 128, 90, 72, 87, 69, 128, 90, 72, 87, 65, 128, 90, 72, 85, 88, 128, 90, - 72, 85, 84, 128, 90, 72, 85, 82, 88, 128, 90, 72, 85, 82, 128, 90, 72, - 85, 80, 128, 90, 72, 85, 79, 88, 128, 90, 72, 85, 79, 80, 128, 90, 72, - 85, 79, 128, 90, 72, 85, 128, 90, 72, 79, 88, 128, 90, 72, 79, 84, 128, - 90, 72, 79, 80, 128, 90, 72, 79, 79, 128, 90, 72, 79, 128, 90, 72, 73, - 86, 69, 84, 69, 128, 90, 72, 73, 128, 90, 72, 69, 88, 128, 90, 72, 69, - 84, 128, 90, 72, 69, 80, 128, 90, 72, 69, 69, 128, 90, 72, 69, 128, 90, - 72, 197, 90, 72, 65, 88, 128, 90, 72, 65, 84, 128, 90, 72, 65, 82, 128, - 90, 72, 65, 80, 128, 90, 72, 65, 73, 78, 128, 90, 72, 65, 65, 128, 90, - 72, 65, 128, 90, 72, 128, 90, 69, 84, 65, 128, 90, 69, 82, 79, 128, 90, - 69, 82, 207, 90, 69, 78, 128, 90, 69, 77, 76, 89, 65, 128, 90, 69, 77, - 76, 74, 65, 128, 90, 69, 50, 128, 90, 197, 90, 65, 89, 78, 128, 90, 65, - 89, 73, 78, 128, 90, 65, 89, 73, 206, 90, 65, 86, 73, 89, 65, 78, 73, - 128, 90, 65, 84, 65, 128, 90, 65, 82, 81, 65, 128, 90, 65, 81, 69, 198, - 90, 65, 77, 88, 128, 90, 65, 204, 90, 65, 73, 78, 128, 90, 65, 73, 206, - 90, 65, 73, 128, 90, 65, 72, 128, 90, 65, 200, 90, 65, 71, 128, 90, 65, - 69, 70, 128, 90, 48, 49, 54, 72, 128, 90, 48, 49, 54, 71, 128, 90, 48, - 49, 54, 70, 128, 90, 48, 49, 54, 69, 128, 90, 48, 49, 54, 68, 128, 90, - 48, 49, 54, 67, 128, 90, 48, 49, 54, 66, 128, 90, 48, 49, 54, 65, 128, - 90, 48, 49, 54, 128, 90, 48, 49, 53, 73, 128, 90, 48, 49, 53, 72, 128, - 90, 48, 49, 53, 71, 128, 90, 48, 49, 53, 70, 128, 90, 48, 49, 53, 69, - 128, 90, 48, 49, 53, 68, 128, 90, 48, 49, 53, 67, 128, 90, 48, 49, 53, - 66, 128, 90, 48, 49, 53, 65, 128, 90, 48, 49, 53, 128, 90, 48, 49, 52, - 128, 90, 48, 49, 51, 128, 90, 48, 49, 50, 128, 90, 48, 49, 49, 128, 90, - 48, 49, 48, 128, 90, 48, 48, 57, 128, 90, 48, 48, 56, 128, 90, 48, 48, - 55, 128, 90, 48, 48, 54, 128, 90, 48, 48, 53, 65, 128, 90, 48, 48, 53, - 128, 90, 48, 48, 52, 65, 128, 90, 48, 48, 52, 128, 90, 48, 48, 51, 66, - 128, 90, 48, 48, 51, 65, 128, 90, 48, 48, 51, 128, 90, 48, 48, 50, 68, - 128, 90, 48, 48, 50, 67, 128, 90, 48, 48, 50, 66, 128, 90, 48, 48, 50, - 65, 128, 90, 48, 48, 50, 128, 90, 48, 48, 49, 128, 90, 128, 218, 89, 89, - 88, 128, 89, 89, 84, 128, 89, 89, 82, 88, 128, 89, 89, 82, 128, 89, 89, - 80, 128, 89, 89, 69, 128, 89, 89, 65, 128, 89, 89, 128, 89, 87, 79, 79, - 128, 89, 87, 79, 128, 89, 87, 73, 73, 128, 89, 87, 73, 128, 89, 87, 69, - 128, 89, 87, 65, 65, 128, 89, 87, 65, 128, 89, 86, 128, 89, 85, 88, 128, - 89, 85, 85, 75, 65, 76, 69, 65, 80, 73, 78, 84, 85, 128, 89, 85, 84, 128, - 89, 85, 83, 128, 89, 85, 211, 89, 85, 82, 88, 128, 89, 85, 82, 128, 89, - 85, 81, 128, 89, 85, 80, 128, 89, 85, 79, 88, 128, 89, 85, 79, 84, 128, - 89, 85, 79, 80, 128, 89, 85, 79, 128, 89, 85, 68, 72, 128, 89, 85, 68, - 200, 89, 85, 65, 78, 128, 89, 85, 45, 89, 69, 79, 128, 89, 85, 45, 89, - 69, 128, 89, 85, 45, 85, 128, 89, 85, 45, 79, 128, 89, 85, 45, 73, 128, - 89, 85, 45, 69, 79, 128, 89, 85, 45, 69, 128, 89, 85, 45, 65, 69, 128, - 89, 85, 45, 65, 128, 89, 85, 128, 89, 213, 89, 80, 83, 73, 76, 73, 128, - 89, 80, 79, 82, 82, 79, 73, 128, 89, 80, 79, 75, 82, 73, 83, 73, 83, 128, - 89, 80, 79, 75, 82, 73, 83, 73, 211, 89, 80, 79, 71, 69, 71, 82, 65, 77, - 77, 69, 78, 73, 128, 89, 79, 89, 128, 89, 79, 88, 128, 89, 79, 85, 84, - 72, 70, 85, 76, 78, 69, 83, 83, 128, 89, 79, 85, 84, 72, 70, 85, 204, 89, - 79, 84, 128, 89, 79, 82, 73, 128, 89, 79, 81, 128, 89, 79, 80, 128, 89, - 79, 79, 128, 89, 79, 77, 79, 128, 89, 79, 71, 72, 128, 89, 79, 68, 72, - 128, 89, 79, 68, 128, 89, 79, 196, 89, 79, 65, 128, 89, 79, 45, 89, 69, - 79, 128, 89, 79, 45, 89, 65, 69, 128, 89, 79, 45, 89, 65, 128, 89, 79, - 45, 79, 128, 89, 79, 45, 73, 128, 89, 79, 45, 69, 79, 128, 89, 79, 45, - 65, 69, 128, 89, 79, 45, 65, 128, 89, 79, 128, 89, 207, 89, 73, 90, 69, - 84, 128, 89, 73, 88, 128, 89, 73, 87, 78, 128, 89, 73, 84, 128, 89, 73, - 80, 128, 89, 73, 78, 71, 128, 89, 73, 73, 128, 89, 73, 199, 89, 73, 69, - 88, 128, 89, 73, 69, 84, 128, 89, 73, 69, 80, 128, 89, 73, 69, 128, 89, - 73, 68, 68, 73, 83, 200, 89, 73, 45, 85, 128, 89, 73, 128, 89, 70, 69, - 83, 73, 83, 128, 89, 70, 69, 83, 73, 211, 89, 70, 69, 206, 89, 69, 89, - 128, 89, 69, 87, 128, 89, 69, 84, 73, 86, 128, 89, 69, 83, 84, 85, 128, - 89, 69, 83, 73, 69, 85, 78, 71, 45, 83, 73, 79, 83, 128, 89, 69, 83, 73, - 69, 85, 78, 71, 45, 80, 65, 78, 83, 73, 79, 83, 128, 89, 69, 83, 73, 69, - 85, 78, 71, 45, 77, 73, 69, 85, 77, 128, 89, 69, 83, 73, 69, 85, 78, 71, - 45, 72, 73, 69, 85, 72, 128, 89, 69, 83, 73, 69, 85, 78, 71, 128, 89, 69, - 82, 85, 128, 89, 69, 82, 213, 89, 69, 82, 73, 128, 89, 69, 82, 65, 200, - 89, 69, 82, 128, 89, 69, 79, 82, 73, 78, 72, 73, 69, 85, 72, 128, 89, 69, - 79, 45, 89, 65, 128, 89, 69, 79, 45, 85, 128, 89, 69, 79, 45, 79, 128, - 89, 69, 78, 73, 83, 69, 201, 89, 69, 78, 65, 80, 128, 89, 69, 206, 89, - 69, 76, 76, 79, 87, 128, 89, 69, 72, 128, 89, 69, 69, 128, 89, 69, 65, - 210, 89, 69, 65, 128, 89, 65, 90, 90, 128, 89, 65, 90, 72, 128, 89, 65, - 90, 128, 89, 65, 89, 65, 78, 78, 65, 128, 89, 65, 89, 128, 89, 65, 87, - 128, 89, 65, 86, 128, 89, 65, 84, 84, 128, 89, 65, 84, 73, 128, 89, 65, - 84, 72, 128, 89, 65, 84, 128, 89, 65, 83, 83, 128, 89, 65, 83, 72, 128, - 89, 65, 83, 128, 89, 65, 82, 82, 128, 89, 65, 82, 128, 89, 65, 210, 89, - 65, 81, 128, 89, 65, 80, 128, 89, 65, 78, 71, 128, 89, 65, 78, 199, 89, - 65, 78, 128, 89, 65, 77, 79, 75, 128, 89, 65, 77, 65, 75, 75, 65, 78, - 128, 89, 65, 77, 128, 89, 65, 76, 128, 89, 65, 75, 72, 72, 128, 89, 65, - 75, 72, 128, 89, 65, 75, 65, 83, 72, 128, 89, 65, 75, 128, 89, 65, 74, - 85, 82, 86, 69, 68, 73, 195, 89, 65, 74, 128, 89, 65, 72, 72, 128, 89, - 65, 72, 128, 89, 65, 71, 78, 128, 89, 65, 71, 72, 72, 128, 89, 65, 71, - 72, 128, 89, 65, 71, 128, 89, 65, 70, 128, 89, 65, 68, 72, 128, 89, 65, - 68, 68, 72, 128, 89, 65, 68, 68, 128, 89, 65, 68, 128, 89, 65, 67, 72, - 128, 89, 65, 66, 72, 128, 89, 65, 66, 128, 89, 65, 65, 82, 85, 128, 89, - 65, 65, 73, 128, 89, 65, 65, 68, 79, 128, 89, 65, 65, 128, 89, 65, 45, - 89, 79, 128, 89, 65, 45, 85, 128, 89, 65, 45, 79, 128, 89, 48, 48, 56, - 128, 89, 48, 48, 55, 128, 89, 48, 48, 54, 128, 89, 48, 48, 53, 128, 89, - 48, 48, 52, 128, 89, 48, 48, 51, 128, 89, 48, 48, 50, 128, 89, 48, 48, - 49, 65, 128, 89, 48, 48, 49, 128, 89, 45, 67, 82, 69, 197, 88, 89, 88, - 128, 88, 89, 85, 128, 88, 89, 84, 128, 88, 89, 82, 88, 128, 88, 89, 82, - 128, 88, 89, 80, 128, 88, 89, 79, 128, 88, 89, 73, 128, 88, 89, 69, 69, - 128, 88, 89, 69, 128, 88, 89, 65, 65, 128, 88, 89, 65, 128, 88, 89, 128, - 88, 87, 73, 128, 88, 87, 69, 69, 128, 88, 87, 69, 128, 88, 87, 65, 65, - 128, 88, 87, 65, 128, 88, 86, 69, 128, 88, 86, 65, 128, 88, 85, 79, 88, - 128, 88, 85, 79, 128, 88, 85, 128, 88, 83, 72, 65, 65, 89, 65, 84, 72, - 73, 89, 65, 128, 88, 79, 88, 128, 88, 79, 84, 128, 88, 79, 82, 128, 88, - 79, 80, 128, 88, 79, 65, 128, 88, 79, 128, 88, 73, 88, 128, 88, 73, 84, - 128, 88, 73, 82, 79, 206, 88, 73, 80, 128, 88, 73, 69, 88, 128, 88, 73, - 69, 84, 128, 88, 73, 69, 80, 128, 88, 73, 69, 128, 88, 73, 128, 88, 71, - 128, 88, 69, 83, 84, 69, 211, 88, 69, 72, 128, 88, 69, 69, 128, 88, 69, - 128, 88, 65, 78, 128, 88, 65, 65, 128, 88, 65, 128, 88, 48, 48, 56, 65, - 128, 88, 48, 48, 56, 128, 88, 48, 48, 55, 128, 88, 48, 48, 54, 65, 128, - 88, 48, 48, 54, 128, 88, 48, 48, 53, 128, 88, 48, 48, 52, 66, 128, 88, - 48, 48, 52, 65, 128, 88, 48, 48, 52, 128, 88, 48, 48, 51, 128, 88, 48, - 48, 50, 128, 88, 48, 48, 49, 128, 87, 90, 128, 87, 89, 78, 78, 128, 87, - 89, 78, 206, 87, 86, 128, 87, 85, 79, 88, 128, 87, 85, 79, 80, 128, 87, - 85, 79, 128, 87, 85, 78, 74, 207, 87, 85, 78, 128, 87, 85, 76, 85, 128, - 87, 85, 76, 213, 87, 85, 69, 128, 87, 85, 128, 87, 82, 79, 78, 71, 128, - 87, 82, 73, 84, 73, 78, 199, 87, 82, 69, 65, 84, 200, 87, 82, 65, 80, - 128, 87, 79, 88, 128, 87, 79, 82, 75, 128, 87, 79, 82, 203, 87, 79, 82, - 68, 83, 80, 65, 67, 69, 128, 87, 79, 82, 196, 87, 79, 80, 128, 87, 79, - 79, 78, 128, 87, 79, 79, 76, 128, 87, 79, 79, 68, 83, 45, 67, 82, 69, - 197, 87, 79, 79, 68, 128, 87, 79, 78, 128, 87, 79, 206, 87, 79, 77, 65, - 78, 128, 87, 79, 76, 79, 83, 79, 128, 87, 79, 69, 128, 87, 79, 65, 128, - 87, 73, 84, 72, 79, 85, 212, 87, 73, 78, 84, 69, 82, 128, 87, 73, 78, 74, - 65, 128, 87, 73, 78, 69, 128, 87, 73, 78, 68, 85, 128, 87, 73, 78, 68, - 128, 87, 73, 78, 128, 87, 73, 71, 78, 89, 65, 78, 128, 87, 73, 71, 71, - 76, 217, 87, 73, 68, 69, 45, 72, 69, 65, 68, 69, 196, 87, 73, 68, 197, - 87, 73, 65, 78, 71, 87, 65, 65, 75, 128, 87, 73, 65, 78, 71, 128, 87, 72, - 79, 76, 197, 87, 72, 73, 84, 69, 45, 70, 69, 65, 84, 72, 69, 82, 69, 196, - 87, 72, 73, 84, 69, 128, 87, 72, 69, 69, 76, 69, 196, 87, 72, 69, 69, 76, - 67, 72, 65, 73, 210, 87, 72, 69, 69, 76, 128, 87, 72, 69, 69, 204, 87, - 72, 69, 65, 84, 128, 87, 71, 128, 87, 69, 88, 128, 87, 69, 83, 84, 69, - 82, 206, 87, 69, 83, 84, 128, 87, 69, 83, 212, 87, 69, 80, 128, 87, 69, - 79, 128, 87, 69, 78, 128, 87, 69, 76, 76, 128, 87, 69, 73, 71, 72, 212, - 87, 69, 69, 78, 128, 87, 69, 68, 71, 69, 45, 84, 65, 73, 76, 69, 196, 87, - 69, 65, 80, 79, 78, 128, 87, 66, 128, 87, 65, 89, 128, 87, 65, 217, 87, - 65, 88, 128, 87, 65, 87, 45, 65, 89, 73, 78, 45, 82, 69, 83, 72, 128, 87, - 65, 87, 128, 87, 65, 215, 87, 65, 86, 217, 87, 65, 86, 69, 128, 87, 65, - 86, 197, 87, 65, 85, 128, 87, 65, 84, 84, 79, 128, 87, 65, 84, 69, 82, - 128, 87, 65, 84, 69, 210, 87, 65, 84, 67, 72, 128, 87, 65, 84, 128, 87, - 65, 83, 84, 73, 78, 71, 128, 87, 65, 83, 83, 65, 76, 76, 65, 77, 128, 87, - 65, 83, 76, 65, 128, 87, 65, 83, 76, 193, 87, 65, 83, 65, 76, 76, 65, 77, - 128, 87, 65, 83, 65, 76, 76, 65, 205, 87, 65, 82, 78, 73, 78, 199, 87, - 65, 80, 128, 87, 65, 78, 68, 69, 82, 69, 82, 128, 87, 65, 78, 128, 87, - 65, 76, 76, 128, 87, 65, 76, 75, 128, 87, 65, 76, 203, 87, 65, 73, 84, - 73, 78, 71, 128, 87, 65, 73, 128, 87, 65, 69, 78, 128, 87, 65, 69, 128, - 87, 65, 65, 86, 85, 128, 87, 48, 50, 53, 128, 87, 48, 50, 52, 65, 128, - 87, 48, 50, 52, 128, 87, 48, 50, 51, 128, 87, 48, 50, 50, 128, 87, 48, - 50, 49, 128, 87, 48, 50, 48, 128, 87, 48, 49, 57, 128, 87, 48, 49, 56, - 65, 128, 87, 48, 49, 56, 128, 87, 48, 49, 55, 65, 128, 87, 48, 49, 55, - 128, 87, 48, 49, 54, 128, 87, 48, 49, 53, 128, 87, 48, 49, 52, 65, 128, - 87, 48, 49, 52, 128, 87, 48, 49, 51, 128, 87, 48, 49, 50, 128, 87, 48, - 49, 49, 128, 87, 48, 49, 48, 65, 128, 87, 48, 49, 48, 128, 87, 48, 48, - 57, 65, 128, 87, 48, 48, 57, 128, 87, 48, 48, 56, 128, 87, 48, 48, 55, - 128, 87, 48, 48, 54, 128, 87, 48, 48, 53, 128, 87, 48, 48, 52, 128, 87, - 48, 48, 51, 65, 128, 87, 48, 48, 51, 128, 87, 48, 48, 50, 128, 87, 48, - 48, 49, 128, 86, 90, 77, 69, 84, 128, 86, 89, 88, 128, 86, 89, 84, 128, - 86, 89, 82, 88, 128, 86, 89, 82, 128, 86, 89, 80, 128, 86, 89, 128, 86, - 87, 65, 128, 86, 85, 88, 128, 86, 85, 84, 128, 86, 85, 82, 88, 128, 86, - 85, 82, 128, 86, 85, 80, 128, 86, 85, 76, 71, 65, 210, 86, 82, 65, 67, - 72, 89, 128, 86, 79, 88, 128, 86, 79, 87, 69, 76, 45, 67, 65, 82, 82, 73, - 69, 210, 86, 79, 87, 128, 86, 79, 85, 128, 86, 79, 84, 128, 86, 79, 80, - 128, 86, 79, 79, 128, 86, 79, 76, 85, 77, 197, 86, 79, 76, 84, 65, 71, - 197, 86, 79, 73, 196, 86, 79, 73, 67, 73, 78, 71, 128, 86, 79, 73, 67, - 69, 76, 69, 83, 211, 86, 79, 73, 67, 69, 196, 86, 79, 67, 65, 204, 86, - 79, 128, 86, 73, 88, 128, 86, 73, 84, 128, 86, 73, 83, 73, 71, 79, 84, - 72, 73, 195, 86, 73, 83, 65, 82, 71, 65, 89, 65, 128, 86, 73, 83, 65, 82, - 71, 65, 128, 86, 73, 83, 65, 82, 71, 193, 86, 73, 82, 73, 65, 77, 128, - 86, 73, 82, 71, 79, 128, 86, 73, 82, 71, 65, 128, 86, 73, 82, 65, 77, 65, - 128, 86, 73, 80, 128, 86, 73, 78, 69, 128, 86, 73, 78, 128, 86, 73, 76, - 76, 65, 71, 69, 128, 86, 73, 69, 88, 128, 86, 73, 69, 87, 68, 65, 84, - 193, 86, 73, 69, 84, 128, 86, 73, 69, 80, 128, 86, 73, 69, 128, 86, 73, - 68, 65, 128, 86, 73, 67, 84, 79, 82, 217, 86, 73, 128, 86, 69, 88, 128, - 86, 69, 87, 128, 86, 69, 215, 86, 69, 83, 84, 65, 128, 86, 69, 83, 83, - 69, 204, 86, 69, 82, 217, 86, 69, 82, 84, 73, 67, 65, 76, 76, 89, 128, - 86, 69, 82, 84, 73, 67, 65, 76, 76, 217, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 54, 45, 48, 54, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 54, - 45, 48, 53, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 54, 45, 48, 52, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 54, 45, 48, 51, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 54, 45, 48, 50, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 54, 45, 48, 49, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 54, 45, 48, 48, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 53, - 45, 48, 54, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 53, 45, 48, 53, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 53, 45, 48, 52, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 53, 45, 48, 51, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 53, 45, 48, 50, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 53, 45, 48, 49, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 53, - 45, 48, 48, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 52, 45, 48, 54, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 52, 45, 48, 53, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 52, 45, 48, 52, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 52, 45, 48, 51, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 52, 45, 48, 50, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 52, - 45, 48, 49, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 52, 45, 48, 48, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 51, 45, 48, 54, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 51, 45, 48, 53, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 51, 45, 48, 52, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 51, 45, 48, 51, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 51, - 45, 48, 50, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 51, 45, 48, 49, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 51, 45, 48, 48, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 50, 45, 48, 54, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 50, 45, 48, 53, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 50, 45, 48, 52, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 50, - 45, 48, 51, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 50, 45, 48, 50, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 50, 45, 48, 49, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 50, 45, 48, 48, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 49, 45, 48, 54, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 49, 45, 48, 53, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 49, - 45, 48, 52, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 49, 45, 48, 51, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 49, 45, 48, 50, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 49, 45, 48, 49, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 49, 45, 48, 48, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 48, 45, 48, 54, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 48, - 45, 48, 53, 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 48, 45, 48, 52, - 128, 86, 69, 82, 84, 73, 67, 65, 76, 45, 48, 48, 45, 48, 51, 128, 86, 69, - 82, 84, 73, 67, 65, 76, 45, 48, 48, 45, 48, 50, 128, 86, 69, 82, 84, 73, - 67, 65, 76, 45, 48, 48, 45, 48, 49, 128, 86, 69, 82, 84, 73, 67, 65, 76, - 45, 48, 48, 45, 48, 48, 128, 86, 69, 82, 84, 73, 67, 65, 76, 128, 86, 69, - 82, 83, 73, 67, 76, 69, 128, 86, 69, 82, 83, 197, 86, 69, 82, 71, 69, - 128, 86, 69, 80, 128, 86, 69, 78, 68, 128, 86, 69, 72, 128, 86, 69, 200, - 86, 69, 69, 128, 86, 69, 197, 86, 69, 68, 69, 128, 86, 69, 67, 84, 79, - 210, 86, 65, 89, 65, 78, 78, 65, 128, 86, 65, 88, 128, 86, 65, 86, 128, - 86, 65, 214, 86, 65, 84, 72, 89, 128, 86, 65, 84, 128, 86, 65, 83, 84, - 78, 69, 83, 211, 86, 65, 83, 73, 83, 128, 86, 65, 82, 89, 211, 86, 65, - 82, 73, 75, 65, 128, 86, 65, 82, 73, 65, 78, 212, 86, 65, 82, 73, 65, - 128, 86, 65, 82, 73, 193, 86, 65, 82, 69, 73, 65, 201, 86, 65, 82, 69, - 73, 193, 86, 65, 80, 128, 86, 65, 78, 69, 128, 86, 65, 77, 65, 71, 79, - 77, 85, 75, 72, 65, 128, 86, 65, 77, 65, 71, 79, 77, 85, 75, 72, 193, 86, - 65, 76, 76, 69, 89, 128, 86, 65, 65, 86, 85, 128, 86, 65, 65, 128, 86, - 48, 52, 48, 65, 128, 86, 48, 52, 48, 128, 86, 48, 51, 57, 128, 86, 48, - 51, 56, 128, 86, 48, 51, 55, 65, 128, 86, 48, 51, 55, 128, 86, 48, 51, - 54, 128, 86, 48, 51, 53, 128, 86, 48, 51, 52, 128, 86, 48, 51, 51, 65, - 128, 86, 48, 51, 51, 128, 86, 48, 51, 50, 128, 86, 48, 51, 49, 65, 128, - 86, 48, 51, 49, 128, 86, 48, 51, 48, 65, 128, 86, 48, 51, 48, 128, 86, - 48, 50, 57, 65, 128, 86, 48, 50, 57, 128, 86, 48, 50, 56, 65, 128, 86, - 48, 50, 56, 128, 86, 48, 50, 55, 128, 86, 48, 50, 54, 128, 86, 48, 50, - 53, 128, 86, 48, 50, 52, 128, 86, 48, 50, 51, 65, 128, 86, 48, 50, 51, - 128, 86, 48, 50, 50, 128, 86, 48, 50, 49, 128, 86, 48, 50, 48, 76, 128, - 86, 48, 50, 48, 75, 128, 86, 48, 50, 48, 74, 128, 86, 48, 50, 48, 73, - 128, 86, 48, 50, 48, 72, 128, 86, 48, 50, 48, 71, 128, 86, 48, 50, 48, - 70, 128, 86, 48, 50, 48, 69, 128, 86, 48, 50, 48, 68, 128, 86, 48, 50, - 48, 67, 128, 86, 48, 50, 48, 66, 128, 86, 48, 50, 48, 65, 128, 86, 48, - 50, 48, 128, 86, 48, 49, 57, 128, 86, 48, 49, 56, 128, 86, 48, 49, 55, - 128, 86, 48, 49, 54, 128, 86, 48, 49, 53, 128, 86, 48, 49, 52, 128, 86, - 48, 49, 51, 128, 86, 48, 49, 50, 66, 128, 86, 48, 49, 50, 65, 128, 86, - 48, 49, 50, 128, 86, 48, 49, 49, 67, 128, 86, 48, 49, 49, 66, 128, 86, - 48, 49, 49, 65, 128, 86, 48, 49, 49, 128, 86, 48, 49, 48, 128, 86, 48, - 48, 57, 128, 86, 48, 48, 56, 128, 86, 48, 48, 55, 66, 128, 86, 48, 48, - 55, 65, 128, 86, 48, 48, 55, 128, 86, 48, 48, 54, 128, 86, 48, 48, 53, - 128, 86, 48, 48, 52, 128, 86, 48, 48, 51, 128, 86, 48, 48, 50, 65, 128, - 86, 48, 48, 50, 128, 86, 48, 48, 49, 73, 128, 86, 48, 48, 49, 72, 128, - 86, 48, 48, 49, 71, 128, 86, 48, 48, 49, 70, 128, 86, 48, 48, 49, 69, - 128, 86, 48, 48, 49, 68, 128, 86, 48, 48, 49, 67, 128, 86, 48, 48, 49, - 66, 128, 86, 48, 48, 49, 65, 128, 86, 48, 48, 49, 128, 85, 90, 85, 128, - 85, 90, 51, 128, 85, 90, 179, 85, 89, 65, 78, 78, 65, 128, 85, 89, 128, - 85, 85, 89, 65, 78, 78, 65, 128, 85, 85, 85, 85, 128, 85, 85, 85, 51, - 128, 85, 85, 85, 50, 128, 85, 85, 69, 128, 85, 84, 85, 75, 73, 128, 85, - 83, 83, 85, 51, 128, 85, 83, 83, 85, 128, 85, 83, 72, 88, 128, 85, 83, - 72, 85, 77, 88, 128, 85, 83, 72, 50, 128, 85, 83, 72, 128, 85, 83, 200, - 85, 83, 69, 196, 85, 83, 69, 128, 85, 82, 85, 218, 85, 82, 85, 83, 128, - 85, 82, 85, 68, 65, 128, 85, 82, 85, 68, 193, 85, 82, 85, 128, 85, 82, - 213, 85, 82, 78, 128, 85, 82, 73, 51, 128, 85, 82, 73, 128, 85, 82, 65, - 78, 85, 83, 128, 85, 82, 65, 128, 85, 82, 52, 128, 85, 82, 50, 128, 85, - 82, 178, 85, 80, 87, 65, 82, 68, 83, 128, 85, 80, 87, 65, 82, 68, 211, - 85, 80, 87, 65, 82, 68, 128, 85, 80, 87, 65, 82, 196, 85, 80, 84, 85, 82, - 78, 128, 85, 80, 83, 73, 76, 79, 78, 128, 85, 80, 83, 73, 76, 79, 206, - 85, 80, 82, 73, 71, 72, 212, 85, 80, 80, 69, 210, 85, 80, 65, 68, 72, 77, - 65, 78, 73, 89, 65, 128, 85, 80, 45, 80, 79, 73, 78, 84, 73, 78, 199, 85, - 79, 78, 128, 85, 78, 78, 128, 85, 78, 77, 65, 82, 82, 73, 69, 196, 85, - 78, 73, 86, 69, 82, 83, 65, 204, 85, 78, 73, 84, 89, 128, 85, 78, 73, 84, - 128, 85, 78, 73, 212, 85, 78, 73, 79, 78, 128, 85, 78, 73, 79, 206, 85, - 78, 73, 70, 73, 69, 196, 85, 78, 68, 207, 85, 78, 68, 69, 82, 84, 73, 69, - 128, 85, 78, 68, 69, 82, 76, 73, 78, 197, 85, 78, 68, 69, 82, 68, 79, 84, - 128, 85, 78, 68, 69, 82, 66, 65, 82, 128, 85, 78, 68, 69, 210, 85, 78, - 67, 73, 193, 85, 78, 65, 83, 80, 73, 82, 65, 84, 69, 68, 128, 85, 78, 65, - 80, 128, 85, 78, 65, 128, 85, 206, 85, 77, 85, 77, 128, 85, 77, 85, 205, - 85, 77, 66, 82, 69, 76, 76, 65, 128, 85, 77, 66, 82, 69, 76, 76, 193, 85, - 77, 66, 73, 78, 128, 85, 75, 85, 128, 85, 75, 82, 65, 73, 78, 73, 65, - 206, 85, 75, 65, 82, 65, 128, 85, 75, 65, 82, 193, 85, 75, 128, 85, 73, - 76, 76, 69, 65, 78, 78, 128, 85, 73, 71, 72, 85, 210, 85, 71, 65, 82, 73, - 84, 73, 195, 85, 69, 89, 128, 85, 69, 69, 128, 85, 69, 65, 128, 85, 68, - 85, 71, 128, 85, 68, 65, 84, 84, 65, 128, 85, 68, 65, 84, 84, 193, 85, - 68, 65, 65, 84, 128, 85, 68, 128, 85, 196, 85, 67, 128, 85, 66, 85, 70, - 73, 76, 73, 128, 85, 66, 72, 65, 89, 65, 84, 207, 85, 66, 65, 68, 65, 77, - 65, 128, 85, 66, 128, 85, 65, 84, 72, 128, 85, 65, 128, 85, 178, 85, 48, - 52, 50, 128, 85, 48, 52, 49, 128, 85, 48, 52, 48, 128, 85, 48, 51, 57, - 128, 85, 48, 51, 56, 128, 85, 48, 51, 55, 128, 85, 48, 51, 54, 128, 85, - 48, 51, 53, 128, 85, 48, 51, 52, 128, 85, 48, 51, 51, 128, 85, 48, 51, - 50, 65, 128, 85, 48, 51, 50, 128, 85, 48, 51, 49, 128, 85, 48, 51, 48, - 128, 85, 48, 50, 57, 65, 128, 85, 48, 50, 57, 128, 85, 48, 50, 56, 128, - 85, 48, 50, 55, 128, 85, 48, 50, 54, 128, 85, 48, 50, 53, 128, 85, 48, - 50, 52, 128, 85, 48, 50, 51, 65, 128, 85, 48, 50, 51, 128, 85, 48, 50, - 50, 128, 85, 48, 50, 49, 128, 85, 48, 50, 48, 128, 85, 48, 49, 57, 128, - 85, 48, 49, 56, 128, 85, 48, 49, 55, 128, 85, 48, 49, 54, 128, 85, 48, - 49, 53, 128, 85, 48, 49, 52, 128, 85, 48, 49, 51, 128, 85, 48, 49, 50, - 128, 85, 48, 49, 49, 128, 85, 48, 49, 48, 128, 85, 48, 48, 57, 128, 85, - 48, 48, 56, 128, 85, 48, 48, 55, 128, 85, 48, 48, 54, 66, 128, 85, 48, - 48, 54, 65, 128, 85, 48, 48, 54, 128, 85, 48, 48, 53, 128, 85, 48, 48, - 52, 128, 85, 48, 48, 51, 128, 85, 48, 48, 50, 128, 85, 48, 48, 49, 128, - 85, 45, 73, 45, 73, 128, 85, 45, 69, 79, 45, 69, 85, 128, 84, 90, 85, - 128, 84, 90, 79, 65, 128, 84, 90, 79, 128, 84, 90, 73, 210, 84, 90, 73, - 128, 84, 90, 69, 69, 128, 84, 90, 69, 128, 84, 90, 65, 65, 128, 84, 90, - 65, 128, 84, 90, 128, 84, 89, 210, 84, 89, 80, 69, 45, 183, 84, 89, 80, - 69, 45, 182, 84, 89, 80, 69, 45, 181, 84, 89, 80, 69, 45, 180, 84, 89, - 80, 69, 45, 179, 84, 89, 80, 69, 45, 178, 84, 89, 80, 69, 45, 177, 84, - 89, 80, 197, 84, 89, 79, 128, 84, 89, 73, 128, 84, 89, 69, 128, 84, 89, - 65, 128, 84, 87, 79, 79, 128, 84, 87, 79, 45, 87, 65, 217, 84, 87, 79, - 45, 76, 73, 78, 197, 84, 87, 79, 45, 72, 69, 65, 68, 69, 196, 84, 87, 73, - 73, 128, 84, 87, 73, 128, 84, 87, 69, 78, 84, 89, 45, 84, 87, 79, 128, - 84, 87, 69, 78, 84, 89, 45, 84, 72, 82, 69, 69, 128, 84, 87, 69, 78, 84, - 89, 45, 83, 73, 88, 128, 84, 87, 69, 78, 84, 89, 45, 83, 69, 86, 69, 78, - 128, 84, 87, 69, 78, 84, 89, 45, 79, 78, 69, 128, 84, 87, 69, 78, 84, 89, - 45, 78, 73, 78, 69, 128, 84, 87, 69, 78, 84, 89, 45, 70, 79, 85, 82, 128, - 84, 87, 69, 78, 84, 89, 45, 70, 73, 86, 69, 128, 84, 87, 69, 78, 84, 89, - 45, 69, 73, 71, 72, 84, 200, 84, 87, 69, 78, 84, 89, 45, 69, 73, 71, 72, - 84, 128, 84, 87, 69, 78, 84, 89, 128, 84, 87, 69, 78, 84, 217, 84, 87, - 69, 76, 86, 69, 128, 84, 87, 69, 76, 86, 197, 84, 87, 69, 128, 84, 87, - 65, 65, 128, 84, 87, 65, 128, 84, 86, 82, 73, 68, 79, 128, 84, 86, 73, - 77, 65, 68, 85, 210, 84, 85, 88, 128, 84, 85, 85, 77, 85, 128, 84, 85, - 84, 69, 89, 65, 83, 65, 84, 128, 84, 85, 84, 128, 84, 85, 82, 88, 128, - 84, 85, 82, 85, 128, 84, 85, 82, 84, 76, 69, 128, 84, 85, 82, 79, 50, - 128, 84, 85, 82, 78, 83, 84, 73, 76, 69, 128, 84, 85, 82, 206, 84, 85, - 82, 66, 65, 78, 128, 84, 85, 82, 128, 84, 85, 80, 128, 84, 85, 79, 88, - 128, 84, 85, 79, 84, 128, 84, 85, 79, 80, 128, 84, 85, 79, 128, 84, 85, - 78, 78, 89, 128, 84, 85, 77, 69, 84, 69, 83, 128, 84, 85, 77, 128, 84, - 85, 75, 87, 69, 78, 84, 73, 83, 128, 84, 85, 75, 128, 84, 85, 71, 82, 73, - 203, 84, 85, 71, 50, 128, 84, 85, 71, 178, 84, 85, 65, 82, 69, 199, 84, - 84, 85, 68, 68, 65, 71, 128, 84, 84, 85, 68, 68, 65, 65, 71, 128, 84, 84, - 85, 128, 84, 84, 84, 72, 65, 128, 84, 84, 83, 85, 128, 84, 84, 83, 79, - 128, 84, 84, 83, 73, 128, 84, 84, 83, 69, 69, 128, 84, 84, 83, 69, 128, - 84, 84, 83, 65, 128, 84, 84, 73, 128, 84, 84, 72, 87, 69, 128, 84, 84, - 72, 79, 79, 128, 84, 84, 72, 79, 128, 84, 84, 72, 73, 128, 84, 84, 72, - 69, 128, 84, 84, 72, 65, 65, 128, 84, 84, 72, 128, 84, 84, 69, 72, 69, - 72, 128, 84, 84, 69, 72, 69, 200, 84, 84, 69, 72, 128, 84, 84, 69, 200, - 84, 84, 69, 69, 128, 84, 84, 69, 128, 84, 84, 65, 89, 65, 78, 78, 65, - 128, 84, 84, 65, 65, 128, 84, 84, 50, 128, 84, 83, 87, 69, 128, 84, 83, - 87, 65, 128, 84, 83, 86, 128, 84, 83, 83, 69, 128, 84, 83, 72, 85, 71, - 83, 128, 84, 83, 72, 79, 79, 75, 128, 84, 83, 72, 79, 79, 203, 84, 83, - 72, 69, 83, 128, 84, 83, 72, 69, 71, 128, 84, 83, 72, 69, 199, 84, 83, - 72, 69, 128, 84, 83, 72, 65, 128, 84, 83, 69, 82, 69, 128, 84, 83, 65, - 68, 73, 128, 84, 83, 65, 68, 201, 84, 83, 65, 65, 68, 73, 89, 128, 84, - 83, 65, 65, 128, 84, 83, 193, 84, 82, 89, 66, 76, 73, 79, 206, 84, 82, - 85, 84, 72, 128, 84, 82, 85, 78, 75, 128, 84, 82, 85, 78, 67, 65, 84, 69, - 196, 84, 82, 85, 69, 128, 84, 82, 85, 67, 75, 128, 84, 82, 79, 77, 73, - 75, 79, 83, 89, 78, 65, 71, 77, 65, 128, 84, 82, 79, 77, 73, 75, 79, 80, - 83, 73, 70, 73, 83, 84, 79, 78, 128, 84, 82, 79, 77, 73, 75, 79, 80, 65, - 82, 65, 75, 65, 76, 69, 83, 77, 65, 128, 84, 82, 79, 77, 73, 75, 79, 78, - 128, 84, 82, 79, 77, 73, 75, 79, 206, 84, 82, 79, 77, 73, 75, 79, 76, 89, - 71, 73, 83, 77, 65, 128, 84, 82, 79, 75, 85, 84, 65, 83, 84, 201, 84, 82, - 79, 69, 90, 69, 78, 73, 65, 206, 84, 82, 73, 84, 79, 211, 84, 82, 73, 84, - 73, 77, 79, 82, 73, 79, 78, 128, 84, 82, 73, 83, 73, 77, 79, 85, 128, 84, - 82, 73, 83, 69, 77, 69, 128, 84, 82, 73, 80, 79, 68, 128, 84, 82, 73, 80, - 76, 73, 128, 84, 82, 73, 80, 76, 197, 84, 82, 73, 79, 206, 84, 82, 73, - 73, 83, 65, 80, 128, 84, 82, 73, 71, 82, 65, 77, 77, 79, 211, 84, 82, 73, - 71, 82, 65, 205, 84, 82, 73, 71, 79, 82, 71, 79, 78, 128, 84, 82, 73, 70, - 79, 78, 73, 65, 83, 128, 84, 82, 73, 70, 79, 76, 73, 65, 84, 197, 84, 82, - 73, 67, 79, 76, 79, 78, 128, 84, 82, 73, 65, 78, 71, 85, 76, 65, 210, 84, - 82, 73, 65, 78, 71, 76, 69, 45, 82, 79, 85, 78, 196, 84, 82, 73, 65, 78, - 71, 76, 69, 45, 72, 69, 65, 68, 69, 196, 84, 82, 73, 65, 78, 71, 76, 69, - 128, 84, 82, 73, 65, 78, 71, 76, 197, 84, 82, 73, 65, 128, 84, 82, 73, - 128, 84, 82, 69, 83, 73, 76, 76, 79, 128, 84, 82, 69, 77, 79, 76, 79, 45, - 51, 128, 84, 82, 69, 77, 79, 76, 79, 45, 50, 128, 84, 82, 69, 77, 79, 76, - 79, 45, 49, 128, 84, 82, 69, 69, 128, 84, 82, 69, 197, 84, 82, 69, 65, - 68, 73, 78, 71, 128, 84, 82, 65, 80, 69, 90, 73, 85, 77, 128, 84, 82, 65, - 78, 83, 86, 69, 82, 83, 65, 204, 84, 82, 65, 78, 83, 80, 79, 83, 73, 84, - 73, 79, 206, 84, 82, 65, 78, 83, 77, 73, 83, 83, 73, 79, 78, 128, 84, 82, - 65, 78, 83, 77, 73, 83, 83, 73, 79, 206, 84, 82, 65, 70, 70, 73, 67, 128, - 84, 82, 65, 68, 197, 84, 82, 65, 67, 75, 128, 84, 82, 128, 84, 79, 88, - 128, 84, 79, 85, 82, 78, 79, 73, 211, 84, 79, 84, 65, 204, 84, 79, 84, - 128, 84, 79, 82, 84, 79, 73, 83, 197, 84, 79, 82, 67, 85, 76, 85, 83, - 128, 84, 79, 82, 67, 85, 76, 85, 211, 84, 79, 80, 66, 65, 82, 128, 84, - 79, 80, 45, 76, 73, 71, 72, 84, 69, 196, 84, 79, 80, 128, 84, 79, 208, - 84, 79, 79, 84, 72, 128, 84, 79, 79, 128, 84, 79, 78, 79, 83, 128, 84, - 79, 78, 71, 85, 69, 128, 84, 79, 78, 71, 128, 84, 79, 78, 69, 45, 54, - 128, 84, 79, 78, 69, 45, 53, 128, 84, 79, 78, 69, 45, 52, 128, 84, 79, - 78, 69, 45, 51, 128, 84, 79, 78, 69, 45, 50, 128, 84, 79, 78, 69, 45, 49, - 128, 84, 79, 78, 69, 128, 84, 79, 78, 65, 204, 84, 79, 76, 79, 78, 71, - 128, 84, 79, 71, 69, 84, 72, 69, 82, 128, 84, 79, 68, 207, 84, 79, 65, - 78, 68, 65, 75, 72, 73, 65, 84, 128, 84, 79, 65, 128, 84, 78, 128, 84, - 76, 86, 128, 84, 76, 85, 128, 84, 76, 79, 128, 84, 76, 73, 128, 84, 76, - 72, 87, 69, 128, 84, 76, 72, 85, 128, 84, 76, 72, 79, 79, 128, 84, 76, - 72, 79, 128, 84, 76, 72, 73, 128, 84, 76, 72, 69, 69, 128, 84, 76, 72, - 69, 128, 84, 76, 72, 65, 128, 84, 76, 69, 69, 128, 84, 76, 65, 128, 84, - 74, 69, 128, 84, 73, 88, 128, 84, 73, 87, 78, 128, 84, 73, 87, 65, 218, - 84, 73, 84, 76, 79, 128, 84, 73, 84, 128, 84, 73, 82, 89, 65, 75, 128, - 84, 73, 82, 84, 193, 84, 73, 82, 79, 78, 73, 65, 206, 84, 73, 82, 128, - 84, 73, 210, 84, 73, 80, 80, 73, 128, 84, 73, 80, 69, 72, 65, 128, 84, - 73, 80, 128, 84, 73, 208, 84, 73, 78, 89, 128, 84, 73, 78, 217, 84, 73, - 78, 78, 69, 128, 84, 73, 78, 65, 71, 77, 65, 128, 84, 73, 77, 69, 83, - 128, 84, 73, 77, 69, 128, 84, 73, 76, 68, 69, 128, 84, 73, 76, 68, 197, - 84, 73, 76, 128, 84, 73, 204, 84, 73, 75, 69, 85, 84, 45, 84, 72, 73, 69, - 85, 84, 72, 128, 84, 73, 75, 69, 85, 84, 45, 83, 73, 79, 83, 45, 75, 73, - 89, 69, 79, 75, 128, 84, 73, 75, 69, 85, 84, 45, 83, 73, 79, 83, 128, 84, - 73, 75, 69, 85, 84, 45, 82, 73, 69, 85, 76, 128, 84, 73, 75, 69, 85, 84, - 45, 80, 73, 69, 85, 80, 128, 84, 73, 75, 69, 85, 84, 45, 77, 73, 69, 85, - 77, 128, 84, 73, 75, 69, 85, 84, 45, 75, 73, 89, 69, 79, 75, 128, 84, 73, - 75, 69, 85, 84, 45, 67, 73, 69, 85, 67, 128, 84, 73, 75, 69, 85, 84, 45, - 67, 72, 73, 69, 85, 67, 72, 128, 84, 73, 75, 69, 85, 84, 128, 84, 73, 75, - 69, 85, 212, 84, 73, 73, 128, 84, 73, 71, 72, 212, 84, 73, 71, 69, 82, - 128, 84, 73, 70, 73, 78, 65, 71, 200, 84, 73, 69, 88, 128, 84, 73, 69, - 80, 128, 84, 73, 197, 84, 73, 67, 75, 128, 84, 73, 67, 203, 84, 73, 65, - 82, 65, 128, 84, 72, 90, 128, 84, 72, 89, 79, 79, 205, 84, 72, 87, 79, - 79, 128, 84, 72, 87, 79, 128, 84, 72, 87, 73, 73, 128, 84, 72, 87, 73, - 128, 84, 72, 87, 69, 69, 128, 84, 72, 87, 65, 65, 128, 84, 72, 87, 65, - 128, 84, 72, 85, 82, 211, 84, 72, 85, 82, 73, 83, 65, 218, 84, 72, 85, - 78, 71, 128, 84, 72, 85, 78, 68, 69, 82, 83, 84, 79, 82, 77, 128, 84, 72, - 85, 78, 68, 69, 82, 128, 84, 72, 85, 78, 68, 69, 210, 84, 72, 85, 128, - 84, 72, 82, 79, 85, 71, 72, 128, 84, 72, 82, 79, 85, 71, 200, 84, 72, 82, - 69, 69, 45, 80, 69, 82, 45, 69, 205, 84, 72, 82, 69, 69, 45, 76, 73, 78, - 197, 84, 72, 82, 69, 69, 45, 196, 84, 72, 82, 69, 65, 68, 128, 84, 72, - 79, 85, 83, 65, 78, 68, 211, 84, 72, 79, 85, 83, 65, 78, 68, 128, 84, 72, - 79, 85, 83, 65, 78, 196, 84, 72, 79, 85, 128, 84, 72, 79, 82, 78, 128, - 84, 72, 79, 82, 206, 84, 72, 79, 78, 71, 128, 84, 72, 79, 65, 128, 84, - 72, 207, 84, 72, 73, 85, 84, 72, 128, 84, 72, 73, 84, 65, 128, 84, 72, - 73, 82, 84, 89, 45, 83, 69, 67, 79, 78, 196, 84, 72, 73, 82, 84, 89, 45, - 79, 78, 69, 128, 84, 72, 73, 82, 84, 89, 128, 84, 72, 73, 82, 84, 217, - 84, 72, 73, 82, 84, 69, 69, 78, 128, 84, 72, 73, 82, 84, 69, 69, 206, 84, - 72, 73, 82, 68, 83, 128, 84, 72, 73, 82, 68, 211, 84, 72, 73, 82, 68, - 128, 84, 72, 73, 82, 196, 84, 72, 73, 206, 84, 72, 73, 73, 128, 84, 72, - 73, 71, 72, 128, 84, 72, 73, 69, 85, 84, 200, 84, 72, 69, 89, 128, 84, - 72, 69, 84, 72, 69, 128, 84, 72, 69, 84, 72, 128, 84, 72, 69, 84, 65, - 128, 84, 72, 69, 84, 193, 84, 72, 69, 83, 80, 73, 65, 206, 84, 72, 69, - 83, 69, 79, 83, 128, 84, 72, 69, 83, 69, 79, 211, 84, 72, 69, 211, 84, - 72, 69, 82, 77, 79, 68, 89, 78, 65, 77, 73, 67, 128, 84, 72, 69, 82, 69, - 70, 79, 82, 69, 128, 84, 72, 69, 82, 197, 84, 72, 69, 206, 84, 72, 69, - 77, 65, 84, 73, 83, 77, 79, 211, 84, 72, 69, 77, 65, 128, 84, 72, 69, 77, - 193, 84, 72, 69, 72, 128, 84, 72, 69, 200, 84, 72, 69, 69, 128, 84, 72, - 197, 84, 72, 65, 87, 128, 84, 72, 65, 78, 84, 72, 65, 75, 72, 65, 84, - 128, 84, 72, 65, 78, 78, 65, 128, 84, 72, 65, 78, 128, 84, 72, 65, 206, - 84, 72, 65, 76, 128, 84, 72, 65, 204, 84, 72, 65, 72, 65, 78, 128, 84, - 72, 65, 65, 78, 193, 84, 72, 65, 65, 76, 85, 128, 84, 72, 45, 67, 82, 69, - 197, 84, 69, 88, 84, 128, 84, 69, 88, 128, 84, 69, 86, 73, 82, 128, 84, - 69, 84, 82, 65, 83, 73, 77, 79, 85, 128, 84, 69, 84, 82, 65, 83, 69, 77, - 69, 128, 84, 69, 84, 82, 65, 80, 76, 73, 128, 84, 69, 84, 82, 65, 70, 79, - 78, 73, 65, 83, 128, 84, 69, 84, 72, 128, 84, 69, 84, 200, 84, 69, 84, - 65, 82, 84, 79, 211, 84, 69, 84, 65, 82, 84, 73, 77, 79, 82, 73, 79, 78, - 128, 84, 69, 84, 128, 84, 69, 212, 84, 69, 83, 83, 69, 82, 65, 128, 84, - 69, 83, 83, 69, 82, 193, 84, 69, 83, 83, 65, 82, 79, 206, 84, 69, 83, - 200, 84, 69, 82, 77, 73, 78, 65, 84, 79, 82, 128, 84, 69, 80, 128, 84, - 69, 78, 85, 84, 79, 128, 84, 69, 78, 85, 128, 84, 69, 78, 213, 84, 69, - 78, 84, 72, 128, 84, 69, 78, 84, 128, 84, 69, 78, 211, 84, 69, 78, 71, - 197, 84, 69, 78, 128, 84, 69, 206, 84, 69, 77, 80, 85, 211, 84, 69, 76, - 85, 128, 84, 69, 76, 79, 85, 211, 84, 69, 76, 73, 83, 72, 193, 84, 69, - 76, 69, 80, 72, 79, 78, 69, 128, 84, 69, 76, 69, 80, 72, 79, 78, 197, 84, - 69, 76, 69, 73, 65, 128, 84, 69, 73, 87, 83, 128, 84, 69, 71, 69, 72, - 128, 84, 69, 197, 84, 69, 68, 85, 78, 71, 128, 84, 69, 65, 82, 68, 82, - 79, 80, 45, 83, 80, 79, 75, 69, 196, 84, 69, 65, 82, 68, 82, 79, 80, 45, - 83, 72, 65, 78, 75, 69, 196, 84, 69, 65, 82, 68, 82, 79, 80, 45, 66, 65, - 82, 66, 69, 196, 84, 69, 45, 85, 128, 84, 67, 72, 69, 72, 69, 72, 128, - 84, 67, 72, 69, 72, 69, 200, 84, 67, 72, 69, 72, 128, 84, 67, 72, 69, - 200, 84, 67, 72, 69, 128, 84, 195, 84, 65, 89, 128, 84, 65, 88, 128, 84, - 65, 87, 69, 76, 76, 69, 77, 69, 212, 84, 65, 87, 65, 128, 84, 65, 87, - 128, 84, 65, 86, 73, 89, 65, 78, 73, 128, 84, 65, 86, 128, 84, 65, 214, - 84, 65, 85, 82, 85, 83, 128, 84, 65, 85, 128, 84, 65, 213, 84, 65, 84, - 87, 69, 69, 76, 128, 84, 65, 84, 87, 69, 69, 204, 84, 65, 84, 84, 79, 79, - 69, 196, 84, 65, 84, 128, 84, 65, 82, 85, 78, 71, 128, 84, 65, 82, 128, - 84, 65, 80, 69, 82, 128, 84, 65, 80, 197, 84, 65, 80, 128, 84, 65, 79, - 128, 84, 65, 78, 78, 69, 196, 84, 65, 78, 199, 84, 65, 78, 128, 84, 65, - 77, 73, 78, 71, 128, 84, 65, 77, 128, 84, 65, 76, 76, 128, 84, 65, 76, - 204, 84, 65, 76, 73, 78, 71, 128, 84, 65, 76, 73, 78, 199, 84, 65, 76, - 69, 78, 84, 83, 128, 84, 65, 76, 69, 78, 212, 84, 65, 75, 72, 65, 76, 76, - 85, 83, 128, 84, 65, 75, 69, 128, 84, 65, 75, 52, 128, 84, 65, 75, 128, - 84, 65, 73, 83, 89, 79, 85, 128, 84, 65, 73, 76, 76, 69, 83, 211, 84, 65, - 73, 76, 128, 84, 65, 73, 204, 84, 65, 72, 128, 84, 65, 200, 84, 65, 71, - 66, 65, 78, 87, 193, 84, 65, 71, 65, 76, 79, 199, 84, 65, 71, 128, 84, - 65, 69, 128, 84, 65, 67, 75, 128, 84, 65, 67, 203, 84, 65, 66, 85, 76, - 65, 84, 73, 79, 78, 128, 84, 65, 66, 76, 69, 128, 84, 65, 66, 128, 84, - 65, 194, 84, 65, 65, 76, 85, 74, 193, 84, 65, 65, 73, 128, 84, 65, 65, - 70, 128, 84, 65, 50, 128, 84, 65, 45, 82, 79, 76, 128, 84, 48, 51, 54, - 128, 84, 48, 51, 53, 128, 84, 48, 51, 52, 128, 84, 48, 51, 51, 65, 128, - 84, 48, 51, 51, 128, 84, 48, 51, 50, 65, 128, 84, 48, 51, 50, 128, 84, - 48, 51, 49, 128, 84, 48, 51, 48, 128, 84, 48, 50, 57, 128, 84, 48, 50, - 56, 128, 84, 48, 50, 55, 128, 84, 48, 50, 54, 128, 84, 48, 50, 53, 128, - 84, 48, 50, 52, 128, 84, 48, 50, 51, 128, 84, 48, 50, 50, 128, 84, 48, - 50, 49, 128, 84, 48, 50, 48, 128, 84, 48, 49, 57, 128, 84, 48, 49, 56, - 128, 84, 48, 49, 55, 128, 84, 48, 49, 54, 65, 128, 84, 48, 49, 54, 128, - 84, 48, 49, 53, 128, 84, 48, 49, 52, 128, 84, 48, 49, 51, 128, 84, 48, - 49, 50, 128, 84, 48, 49, 49, 65, 128, 84, 48, 49, 49, 128, 84, 48, 49, - 48, 128, 84, 48, 48, 57, 65, 128, 84, 48, 48, 57, 128, 84, 48, 48, 56, - 65, 128, 84, 48, 48, 56, 128, 84, 48, 48, 55, 65, 128, 84, 48, 48, 55, - 128, 84, 48, 48, 54, 128, 84, 48, 48, 53, 128, 84, 48, 48, 52, 128, 84, - 48, 48, 51, 65, 128, 84, 48, 48, 51, 128, 84, 48, 48, 50, 128, 84, 48, - 48, 49, 128, 83, 90, 90, 128, 83, 90, 87, 71, 128, 83, 90, 87, 65, 128, - 83, 90, 85, 128, 83, 90, 79, 128, 83, 90, 73, 128, 83, 90, 69, 69, 128, - 83, 90, 69, 128, 83, 90, 65, 65, 128, 83, 90, 65, 128, 83, 90, 128, 83, - 89, 88, 128, 83, 89, 84, 128, 83, 89, 82, 88, 128, 83, 89, 82, 77, 65, - 84, 73, 75, 73, 128, 83, 89, 82, 77, 65, 128, 83, 89, 82, 128, 83, 89, - 80, 128, 83, 89, 79, 85, 87, 65, 128, 83, 89, 78, 69, 86, 77, 65, 128, - 83, 89, 78, 68, 69, 83, 77, 79, 211, 83, 89, 78, 67, 72, 82, 79, 78, 79, - 85, 211, 83, 89, 78, 65, 71, 77, 193, 83, 89, 78, 65, 70, 73, 128, 83, - 89, 77, 77, 69, 84, 82, 89, 128, 83, 89, 77, 77, 69, 84, 82, 73, 195, 83, - 89, 77, 66, 79, 76, 45, 57, 128, 83, 89, 77, 66, 79, 76, 45, 56, 128, 83, - 89, 77, 66, 79, 76, 45, 55, 128, 83, 89, 77, 66, 79, 76, 45, 54, 128, 83, - 89, 77, 66, 79, 76, 45, 53, 52, 128, 83, 89, 77, 66, 79, 76, 45, 53, 51, - 128, 83, 89, 77, 66, 79, 76, 45, 53, 50, 128, 83, 89, 77, 66, 79, 76, 45, - 53, 49, 128, 83, 89, 77, 66, 79, 76, 45, 53, 48, 128, 83, 89, 77, 66, 79, - 76, 45, 53, 128, 83, 89, 77, 66, 79, 76, 45, 52, 57, 128, 83, 89, 77, 66, - 79, 76, 45, 52, 56, 128, 83, 89, 77, 66, 79, 76, 45, 52, 55, 128, 83, 89, - 77, 66, 79, 76, 45, 52, 53, 128, 83, 89, 77, 66, 79, 76, 45, 52, 51, 128, - 83, 89, 77, 66, 79, 76, 45, 52, 50, 128, 83, 89, 77, 66, 79, 76, 45, 52, - 48, 128, 83, 89, 77, 66, 79, 76, 45, 52, 128, 83, 89, 77, 66, 79, 76, 45, - 51, 57, 128, 83, 89, 77, 66, 79, 76, 45, 51, 56, 128, 83, 89, 77, 66, 79, - 76, 45, 51, 55, 128, 83, 89, 77, 66, 79, 76, 45, 51, 54, 128, 83, 89, 77, - 66, 79, 76, 45, 51, 50, 128, 83, 89, 77, 66, 79, 76, 45, 51, 48, 128, 83, - 89, 77, 66, 79, 76, 45, 51, 128, 83, 89, 77, 66, 79, 76, 45, 50, 57, 128, - 83, 89, 77, 66, 79, 76, 45, 50, 55, 128, 83, 89, 77, 66, 79, 76, 45, 50, - 54, 128, 83, 89, 77, 66, 79, 76, 45, 50, 53, 128, 83, 89, 77, 66, 79, 76, - 45, 50, 52, 128, 83, 89, 77, 66, 79, 76, 45, 50, 51, 128, 83, 89, 77, 66, - 79, 76, 45, 50, 50, 128, 83, 89, 77, 66, 79, 76, 45, 50, 49, 128, 83, 89, - 77, 66, 79, 76, 45, 50, 48, 128, 83, 89, 77, 66, 79, 76, 45, 50, 128, 83, - 89, 77, 66, 79, 76, 45, 49, 57, 128, 83, 89, 77, 66, 79, 76, 45, 49, 56, - 128, 83, 89, 77, 66, 79, 76, 45, 49, 55, 128, 83, 89, 77, 66, 79, 76, 45, - 49, 54, 128, 83, 89, 77, 66, 79, 76, 45, 49, 53, 128, 83, 89, 77, 66, 79, - 76, 45, 49, 52, 128, 83, 89, 77, 66, 79, 76, 45, 49, 51, 128, 83, 89, 77, - 66, 79, 76, 45, 49, 50, 128, 83, 89, 77, 66, 79, 76, 45, 49, 49, 128, 83, - 89, 77, 66, 79, 76, 45, 49, 48, 128, 83, 89, 77, 66, 79, 76, 45, 49, 128, - 83, 89, 76, 79, 84, 201, 83, 89, 65, 128, 83, 89, 128, 83, 87, 90, 128, - 83, 87, 85, 78, 199, 83, 87, 79, 82, 68, 83, 128, 83, 87, 79, 82, 68, - 128, 83, 87, 79, 79, 128, 83, 87, 79, 128, 83, 87, 73, 73, 128, 83, 87, - 73, 128, 83, 87, 71, 128, 83, 87, 69, 69, 84, 128, 83, 87, 65, 83, 200, - 83, 87, 65, 80, 80, 73, 78, 71, 128, 83, 87, 65, 65, 128, 83, 87, 128, - 83, 86, 65, 83, 84, 201, 83, 86, 65, 82, 73, 84, 65, 128, 83, 86, 65, 82, - 73, 84, 193, 83, 85, 88, 128, 83, 85, 85, 128, 83, 85, 84, 128, 83, 85, - 83, 80, 69, 78, 83, 73, 79, 206, 83, 85, 82, 88, 128, 83, 85, 82, 82, 79, - 85, 78, 68, 128, 83, 85, 82, 82, 79, 85, 78, 196, 83, 85, 82, 70, 65, 67, - 197, 83, 85, 82, 69, 128, 83, 85, 82, 65, 78, 71, 128, 83, 85, 82, 57, - 128, 83, 85, 82, 128, 83, 85, 210, 83, 85, 80, 82, 65, 76, 73, 78, 69, - 65, 210, 83, 85, 80, 69, 82, 86, 73, 83, 69, 128, 83, 85, 80, 69, 82, 83, - 69, 84, 128, 83, 85, 80, 69, 82, 83, 69, 212, 83, 85, 80, 69, 82, 83, 67, - 82, 73, 80, 212, 83, 85, 80, 69, 82, 73, 77, 80, 79, 83, 69, 196, 83, 85, - 80, 69, 82, 70, 73, 88, 69, 196, 83, 85, 80, 128, 83, 85, 79, 88, 128, - 83, 85, 79, 80, 128, 83, 85, 79, 128, 83, 85, 78, 71, 128, 83, 85, 78, - 68, 65, 78, 69, 83, 197, 83, 85, 78, 128, 83, 85, 206, 83, 85, 77, 77, - 69, 82, 128, 83, 85, 77, 77, 65, 84, 73, 79, 78, 128, 83, 85, 77, 77, 65, - 84, 73, 79, 206, 83, 85, 77, 65, 83, 72, 128, 83, 85, 77, 128, 83, 85, - 75, 85, 78, 128, 83, 85, 75, 85, 206, 83, 85, 75, 85, 128, 83, 85, 75, - 213, 83, 85, 73, 84, 65, 66, 76, 69, 128, 83, 85, 73, 84, 128, 83, 85, - 72, 85, 82, 128, 83, 85, 68, 50, 128, 83, 85, 68, 128, 83, 85, 67, 67, - 69, 69, 68, 83, 128, 83, 85, 67, 67, 69, 69, 68, 211, 83, 85, 67, 67, 69, - 69, 68, 128, 83, 85, 67, 67, 69, 69, 196, 83, 85, 66, 85, 78, 73, 84, - 128, 83, 85, 66, 83, 84, 73, 84, 85, 84, 73, 79, 206, 83, 85, 66, 83, 84, - 73, 84, 85, 84, 69, 128, 83, 85, 66, 83, 84, 73, 84, 85, 84, 197, 83, 85, - 66, 83, 69, 84, 128, 83, 85, 66, 83, 69, 212, 83, 85, 66, 83, 67, 82, 73, - 80, 212, 83, 85, 66, 80, 85, 78, 67, 84, 73, 83, 128, 83, 85, 66, 76, 73, - 78, 69, 65, 210, 83, 85, 66, 74, 79, 73, 78, 69, 196, 83, 85, 66, 74, 69, - 67, 84, 128, 83, 85, 66, 73, 84, 79, 128, 83, 85, 66, 71, 82, 79, 85, 80, - 128, 83, 85, 66, 71, 82, 79, 85, 208, 83, 85, 65, 128, 83, 213, 83, 84, - 87, 65, 128, 83, 84, 85, 68, 89, 128, 83, 84, 82, 79, 75, 69, 83, 128, - 83, 84, 82, 79, 75, 69, 211, 83, 84, 82, 79, 75, 69, 45, 57, 128, 83, 84, - 82, 79, 75, 69, 45, 56, 128, 83, 84, 82, 79, 75, 69, 45, 55, 128, 83, 84, - 82, 79, 75, 69, 45, 54, 128, 83, 84, 82, 79, 75, 69, 45, 53, 128, 83, 84, - 82, 79, 75, 69, 45, 52, 128, 83, 84, 82, 79, 75, 69, 45, 51, 128, 83, 84, - 82, 79, 75, 69, 45, 50, 128, 83, 84, 82, 79, 75, 69, 45, 49, 49, 128, 83, - 84, 82, 79, 75, 69, 45, 49, 48, 128, 83, 84, 82, 79, 75, 69, 45, 49, 128, - 83, 84, 82, 73, 80, 69, 128, 83, 84, 82, 73, 75, 69, 84, 72, 82, 79, 85, - 71, 72, 128, 83, 84, 82, 73, 68, 69, 128, 83, 84, 82, 73, 67, 84, 76, - 217, 83, 84, 82, 69, 84, 67, 72, 69, 196, 83, 84, 82, 69, 83, 211, 83, - 84, 82, 69, 78, 71, 84, 72, 128, 83, 84, 82, 65, 84, 73, 65, 206, 83, 84, - 82, 65, 73, 78, 69, 82, 128, 83, 84, 82, 65, 73, 71, 72, 84, 78, 69, 83, - 83, 128, 83, 84, 82, 65, 73, 71, 72, 212, 83, 84, 82, 65, 73, 70, 128, - 83, 84, 82, 65, 71, 71, 73, 83, 77, 65, 84, 65, 128, 83, 84, 79, 86, 69, - 128, 83, 84, 79, 80, 80, 73, 78, 71, 128, 83, 84, 79, 80, 80, 65, 71, 69, - 128, 83, 84, 79, 80, 128, 83, 84, 79, 208, 83, 84, 79, 78, 69, 128, 83, - 84, 79, 67, 75, 128, 83, 84, 73, 77, 77, 69, 128, 83, 84, 73, 76, 204, - 83, 84, 73, 76, 197, 83, 84, 73, 71, 77, 65, 128, 83, 84, 69, 80, 128, - 83, 84, 69, 77, 128, 83, 84, 69, 205, 83, 84, 69, 65, 77, 128, 83, 84, - 65, 86, 82, 79, 85, 128, 83, 84, 65, 86, 82, 79, 83, 128, 83, 84, 65, 86, - 82, 79, 211, 83, 84, 65, 85, 82, 79, 83, 128, 83, 84, 65, 84, 69, 82, 83, - 128, 83, 84, 65, 82, 212, 83, 84, 65, 82, 75, 128, 83, 84, 65, 82, 128, - 83, 84, 65, 210, 83, 84, 65, 78, 68, 83, 84, 73, 76, 76, 128, 83, 84, 65, - 78, 68, 65, 82, 196, 83, 84, 65, 78, 68, 128, 83, 84, 65, 78, 128, 83, - 84, 65, 76, 76, 73, 79, 78, 128, 83, 84, 65, 70, 70, 128, 83, 84, 65, 70, - 198, 83, 84, 65, 67, 67, 65, 84, 79, 128, 83, 84, 65, 67, 67, 65, 84, 73, - 83, 83, 73, 77, 79, 128, 83, 84, 50, 128, 83, 83, 89, 88, 128, 83, 83, - 89, 84, 128, 83, 83, 89, 82, 88, 128, 83, 83, 89, 82, 128, 83, 83, 89, - 80, 128, 83, 83, 89, 128, 83, 83, 85, 88, 128, 83, 83, 85, 84, 128, 83, - 83, 85, 80, 128, 83, 83, 79, 88, 128, 83, 83, 79, 84, 128, 83, 83, 79, - 80, 128, 83, 83, 79, 128, 83, 83, 73, 88, 128, 83, 83, 73, 84, 128, 83, - 83, 73, 80, 128, 83, 83, 73, 69, 88, 128, 83, 83, 73, 69, 80, 128, 83, - 83, 73, 69, 128, 83, 83, 73, 128, 83, 83, 72, 69, 128, 83, 83, 69, 88, - 128, 83, 83, 69, 80, 128, 83, 83, 69, 69, 128, 83, 83, 65, 88, 128, 83, - 83, 65, 84, 128, 83, 83, 65, 80, 128, 83, 83, 65, 78, 71, 89, 69, 79, 82, - 73, 78, 72, 73, 69, 85, 72, 128, 83, 83, 65, 78, 71, 84, 73, 75, 69, 85, - 84, 45, 80, 73, 69, 85, 80, 128, 83, 83, 65, 78, 71, 84, 73, 75, 69, 85, - 84, 128, 83, 83, 65, 78, 71, 84, 72, 73, 69, 85, 84, 72, 128, 83, 83, 65, - 78, 71, 83, 73, 79, 83, 45, 84, 73, 75, 69, 85, 84, 128, 83, 83, 65, 78, - 71, 83, 73, 79, 83, 45, 80, 73, 69, 85, 80, 128, 83, 83, 65, 78, 71, 83, - 73, 79, 83, 45, 75, 73, 89, 69, 79, 75, 128, 83, 83, 65, 78, 71, 83, 73, - 79, 83, 128, 83, 83, 65, 78, 71, 82, 73, 69, 85, 76, 45, 75, 72, 73, 69, - 85, 75, 72, 128, 83, 83, 65, 78, 71, 82, 73, 69, 85, 76, 128, 83, 83, 65, - 78, 71, 80, 73, 69, 85, 80, 128, 83, 83, 65, 78, 71, 78, 73, 69, 85, 78, - 128, 83, 83, 65, 78, 71, 77, 73, 69, 85, 77, 128, 83, 83, 65, 78, 71, 75, - 73, 89, 69, 79, 75, 128, 83, 83, 65, 78, 71, 73, 69, 85, 78, 71, 128, 83, - 83, 65, 78, 71, 72, 73, 69, 85, 72, 128, 83, 83, 65, 78, 71, 67, 73, 69, - 85, 67, 45, 72, 73, 69, 85, 72, 128, 83, 83, 65, 78, 71, 67, 73, 69, 85, - 67, 128, 83, 83, 65, 78, 71, 65, 82, 65, 69, 65, 128, 83, 83, 65, 65, - 128, 83, 83, 65, 128, 83, 82, 128, 83, 81, 85, 73, 83, 200, 83, 81, 85, - 73, 82, 82, 69, 204, 83, 81, 85, 73, 71, 71, 76, 197, 83, 81, 85, 65, - 212, 83, 81, 85, 65, 82, 69, 83, 128, 83, 81, 85, 65, 82, 69, 68, 128, - 83, 81, 85, 65, 82, 69, 128, 83, 80, 87, 65, 128, 83, 80, 85, 78, 71, - 211, 83, 80, 82, 79, 85, 84, 128, 83, 80, 82, 73, 78, 71, 83, 128, 83, - 80, 82, 73, 78, 71, 128, 83, 80, 82, 69, 67, 72, 71, 69, 83, 65, 78, 199, - 83, 80, 79, 84, 128, 83, 80, 79, 79, 78, 128, 83, 80, 76, 73, 84, 84, 73, - 78, 199, 83, 80, 73, 82, 73, 84, 85, 211, 83, 80, 73, 82, 73, 84, 128, - 83, 80, 73, 82, 73, 212, 83, 80, 73, 82, 65, 78, 84, 128, 83, 80, 73, 82, - 65, 76, 128, 83, 80, 73, 68, 69, 82, 217, 83, 80, 73, 67, 69, 128, 83, - 80, 72, 69, 82, 73, 67, 65, 204, 83, 80, 69, 83, 77, 73, 76, 207, 83, 80, - 69, 69, 67, 72, 128, 83, 80, 69, 67, 73, 65, 76, 128, 83, 80, 69, 65, 82, - 128, 83, 80, 65, 84, 72, 73, 128, 83, 80, 65, 82, 75, 76, 69, 128, 83, - 80, 65, 68, 197, 83, 80, 65, 67, 73, 78, 199, 83, 80, 128, 83, 79, 89, - 128, 83, 79, 87, 73, 76, 207, 83, 79, 87, 128, 83, 79, 85, 84, 72, 45, - 83, 76, 65, 86, 69, 217, 83, 79, 85, 84, 200, 83, 79, 85, 82, 67, 69, - 128, 83, 79, 85, 78, 68, 128, 83, 79, 85, 78, 196, 83, 79, 85, 78, 65, - 80, 128, 83, 79, 85, 128, 83, 79, 79, 128, 83, 79, 78, 71, 128, 83, 79, - 78, 128, 83, 79, 76, 73, 68, 85, 83, 128, 83, 79, 76, 73, 68, 85, 211, - 83, 79, 71, 68, 73, 65, 206, 83, 79, 70, 84, 87, 65, 82, 69, 45, 70, 85, - 78, 67, 84, 73, 79, 206, 83, 79, 70, 212, 83, 79, 198, 83, 79, 67, 73, - 69, 84, 89, 128, 83, 79, 67, 67, 69, 210, 83, 79, 65, 128, 83, 207, 83, - 78, 79, 87, 77, 65, 78, 128, 83, 78, 79, 87, 77, 65, 206, 83, 78, 79, 87, - 70, 76, 65, 75, 69, 128, 83, 78, 79, 87, 128, 83, 78, 79, 85, 84, 128, - 83, 78, 79, 85, 212, 83, 78, 65, 208, 83, 78, 65, 75, 69, 128, 83, 78, - 65, 75, 197, 83, 78, 193, 83, 77, 73, 76, 73, 78, 199, 83, 77, 73, 76, - 69, 128, 83, 77, 69, 65, 82, 128, 83, 77, 65, 83, 200, 83, 77, 65, 76, - 76, 69, 210, 83, 77, 65, 76, 76, 128, 83, 76, 85, 82, 128, 83, 76, 79, - 87, 76, 89, 128, 83, 76, 79, 215, 83, 76, 79, 86, 79, 128, 83, 76, 79, - 80, 73, 78, 199, 83, 76, 79, 80, 69, 128, 83, 76, 73, 78, 71, 128, 83, - 76, 73, 68, 73, 78, 71, 128, 83, 76, 73, 67, 69, 128, 83, 76, 65, 86, 79, - 78, 73, 195, 83, 76, 65, 86, 69, 128, 83, 76, 65, 83, 72, 128, 83, 76, - 65, 83, 200, 83, 76, 65, 78, 84, 69, 196, 83, 75, 87, 65, 128, 83, 75, - 87, 128, 83, 75, 85, 76, 204, 83, 75, 76, 73, 82, 79, 206, 83, 75, 73, - 78, 128, 83, 75, 73, 69, 82, 128, 83, 75, 69, 87, 69, 196, 83, 75, 65, - 84, 69, 128, 83, 75, 128, 83, 74, 69, 128, 83, 73, 88, 84, 89, 45, 70, - 79, 85, 82, 84, 200, 83, 73, 88, 84, 89, 128, 83, 73, 88, 84, 217, 83, - 73, 88, 84, 72, 83, 128, 83, 73, 88, 84, 72, 211, 83, 73, 88, 84, 72, - 128, 83, 73, 88, 84, 69, 69, 78, 84, 72, 83, 128, 83, 73, 88, 84, 69, 69, - 78, 84, 72, 128, 83, 73, 88, 84, 69, 69, 78, 84, 200, 83, 73, 88, 84, 69, - 69, 78, 128, 83, 73, 88, 84, 69, 69, 206, 83, 73, 88, 45, 83, 84, 82, 73, - 78, 199, 83, 73, 88, 45, 80, 69, 82, 45, 69, 205, 83, 73, 88, 45, 76, 73, - 78, 197, 83, 73, 216, 83, 73, 84, 69, 128, 83, 73, 82, 73, 78, 71, 85, - 128, 83, 73, 79, 83, 45, 84, 72, 73, 69, 85, 84, 72, 128, 83, 73, 79, 83, - 45, 83, 83, 65, 78, 71, 83, 73, 79, 83, 128, 83, 73, 79, 83, 45, 82, 73, - 69, 85, 76, 128, 83, 73, 79, 83, 45, 80, 73, 69, 85, 80, 45, 75, 73, 89, - 69, 79, 75, 128, 83, 73, 79, 83, 45, 80, 72, 73, 69, 85, 80, 72, 128, 83, - 73, 79, 83, 45, 80, 65, 78, 83, 73, 79, 83, 128, 83, 73, 79, 83, 45, 78, - 73, 69, 85, 78, 128, 83, 73, 79, 83, 45, 77, 73, 69, 85, 77, 128, 83, 73, - 79, 83, 45, 75, 72, 73, 69, 85, 75, 72, 128, 83, 73, 79, 83, 45, 75, 65, - 80, 89, 69, 79, 85, 78, 80, 73, 69, 85, 80, 128, 83, 73, 79, 83, 45, 73, - 69, 85, 78, 71, 128, 83, 73, 79, 83, 45, 72, 73, 69, 85, 72, 128, 83, 73, - 79, 83, 45, 67, 73, 69, 85, 67, 128, 83, 73, 79, 83, 45, 67, 72, 73, 69, - 85, 67, 72, 128, 83, 73, 79, 211, 83, 73, 78, 75, 73, 78, 71, 128, 83, - 73, 78, 71, 76, 69, 45, 76, 73, 78, 197, 83, 73, 78, 71, 76, 69, 128, 83, - 73, 78, 71, 76, 197, 83, 73, 78, 71, 65, 65, 84, 128, 83, 73, 78, 197, - 83, 73, 78, 68, 72, 201, 83, 73, 206, 83, 73, 77, 80, 76, 73, 70, 73, 69, - 196, 83, 73, 77, 73, 76, 65, 82, 128, 83, 73, 77, 73, 76, 65, 210, 83, - 73, 77, 65, 78, 83, 73, 211, 83, 73, 77, 65, 128, 83, 73, 76, 75, 128, - 83, 73, 76, 73, 81, 85, 193, 83, 73, 76, 65, 51, 128, 83, 73, 75, 73, - 128, 83, 73, 75, 50, 128, 83, 73, 75, 178, 83, 73, 73, 128, 83, 73, 71, - 78, 83, 128, 83, 73, 71, 77, 65, 128, 83, 73, 71, 77, 193, 83, 73, 71, - 69, 204, 83, 73, 71, 52, 128, 83, 73, 71, 180, 83, 73, 71, 128, 83, 73, - 68, 69, 87, 65, 89, 211, 83, 73, 67, 75, 78, 69, 83, 83, 128, 83, 73, 67, - 75, 76, 69, 128, 83, 73, 66, 197, 83, 201, 83, 72, 89, 88, 128, 83, 72, - 89, 84, 128, 83, 72, 89, 82, 88, 128, 83, 72, 89, 82, 128, 83, 72, 89, - 80, 128, 83, 72, 89, 69, 128, 83, 72, 89, 65, 128, 83, 72, 89, 128, 83, - 72, 87, 79, 89, 128, 83, 72, 87, 79, 79, 128, 83, 72, 87, 79, 128, 83, - 72, 87, 73, 73, 128, 83, 72, 87, 73, 128, 83, 72, 87, 69, 128, 83, 72, - 87, 65, 65, 128, 83, 72, 87, 65, 128, 83, 72, 85, 88, 128, 83, 72, 85, - 84, 128, 83, 72, 85, 82, 88, 128, 83, 72, 85, 82, 128, 83, 72, 85, 80, - 128, 83, 72, 85, 79, 88, 128, 83, 72, 85, 79, 80, 128, 83, 72, 85, 79, - 128, 83, 72, 85, 70, 70, 76, 197, 83, 72, 85, 66, 85, 82, 128, 83, 72, - 85, 50, 128, 83, 72, 85, 178, 83, 72, 85, 128, 83, 72, 213, 83, 72, 84, - 65, 80, 73, 67, 128, 83, 72, 84, 65, 128, 83, 72, 82, 73, 78, 69, 128, - 83, 72, 79, 89, 128, 83, 72, 79, 88, 128, 83, 72, 79, 85, 76, 68, 69, 82, - 69, 196, 83, 72, 79, 84, 128, 83, 72, 79, 82, 84, 83, 128, 83, 72, 79, - 82, 84, 211, 83, 72, 79, 82, 84, 69, 78, 69, 82, 128, 83, 72, 79, 82, 84, - 45, 84, 87, 73, 71, 45, 89, 82, 128, 83, 72, 79, 82, 84, 45, 84, 87, 73, - 71, 45, 84, 89, 210, 83, 72, 79, 82, 84, 45, 84, 87, 73, 71, 45, 83, 79, - 204, 83, 72, 79, 82, 84, 45, 84, 87, 73, 71, 45, 79, 83, 211, 83, 72, 79, - 82, 84, 45, 84, 87, 73, 71, 45, 78, 65, 85, 196, 83, 72, 79, 82, 84, 45, - 84, 87, 73, 71, 45, 77, 65, 68, 210, 83, 72, 79, 82, 84, 45, 84, 87, 73, - 71, 45, 72, 65, 71, 65, 76, 204, 83, 72, 79, 82, 84, 45, 84, 87, 73, 71, - 45, 66, 74, 65, 82, 75, 65, 206, 83, 72, 79, 82, 84, 45, 84, 87, 73, 71, - 45, 65, 210, 83, 72, 79, 82, 84, 128, 83, 72, 79, 82, 212, 83, 72, 79, - 80, 128, 83, 72, 79, 79, 84, 128, 83, 72, 79, 79, 128, 83, 72, 79, 71, - 201, 83, 72, 79, 199, 83, 72, 79, 197, 83, 72, 79, 65, 128, 83, 72, 79, - 128, 83, 72, 73, 89, 89, 65, 65, 76, 65, 65, 128, 83, 72, 73, 84, 65, - 128, 83, 72, 73, 84, 193, 83, 72, 73, 82, 128, 83, 72, 73, 210, 83, 72, - 73, 80, 128, 83, 72, 73, 78, 84, 207, 83, 72, 73, 78, 73, 71, 128, 83, - 72, 73, 78, 128, 83, 72, 73, 206, 83, 72, 73, 77, 65, 128, 83, 72, 73, - 77, 193, 83, 72, 73, 77, 128, 83, 72, 73, 205, 83, 72, 73, 73, 78, 128, - 83, 72, 73, 73, 128, 83, 72, 73, 70, 212, 83, 72, 73, 69, 76, 68, 128, - 83, 72, 73, 68, 128, 83, 72, 73, 196, 83, 72, 73, 128, 83, 72, 72, 65, - 128, 83, 72, 69, 88, 128, 83, 72, 69, 86, 65, 128, 83, 72, 69, 85, 88, - 128, 83, 72, 69, 84, 128, 83, 72, 69, 83, 72, 76, 65, 77, 128, 83, 72, - 69, 83, 72, 73, 71, 128, 83, 72, 69, 83, 72, 73, 199, 83, 72, 69, 83, 72, - 50, 128, 83, 72, 69, 83, 72, 128, 83, 72, 69, 81, 69, 204, 83, 72, 69, - 80, 128, 83, 72, 69, 78, 128, 83, 72, 69, 76, 76, 128, 83, 72, 69, 76, - 204, 83, 72, 69, 76, 70, 128, 83, 72, 69, 73, 128, 83, 72, 69, 71, 57, - 128, 83, 72, 69, 69, 80, 128, 83, 72, 69, 69, 78, 85, 128, 83, 72, 69, - 69, 78, 128, 83, 72, 69, 69, 206, 83, 72, 69, 69, 128, 83, 72, 69, 45, - 71, 79, 65, 84, 128, 83, 72, 197, 83, 72, 67, 72, 65, 128, 83, 72, 65, - 89, 128, 83, 72, 65, 88, 128, 83, 72, 65, 86, 73, 89, 65, 78, 73, 128, - 83, 72, 65, 86, 73, 65, 206, 83, 72, 65, 84, 128, 83, 72, 65, 82, 85, - 128, 83, 72, 65, 82, 213, 83, 72, 65, 82, 80, 128, 83, 72, 65, 82, 208, - 83, 72, 65, 82, 65, 128, 83, 72, 65, 82, 50, 128, 83, 72, 65, 82, 178, - 83, 72, 65, 80, 73, 78, 71, 128, 83, 72, 65, 80, 69, 83, 128, 83, 72, 65, - 80, 128, 83, 72, 65, 78, 71, 128, 83, 72, 65, 78, 128, 83, 72, 65, 206, - 83, 72, 65, 77, 82, 79, 67, 75, 128, 83, 72, 65, 76, 83, 72, 69, 76, 69, - 84, 128, 83, 72, 65, 75, 84, 73, 128, 83, 72, 65, 68, 79, 87, 69, 196, - 83, 72, 65, 68, 69, 128, 83, 72, 65, 68, 68, 65, 128, 83, 72, 65, 68, 68, - 193, 83, 72, 65, 68, 128, 83, 72, 65, 196, 83, 72, 65, 66, 54, 128, 83, - 72, 65, 65, 128, 83, 72, 65, 54, 128, 83, 72, 65, 51, 128, 83, 72, 65, - 179, 83, 71, 82, 193, 83, 71, 79, 210, 83, 71, 65, 215, 83, 71, 65, 194, - 83, 71, 128, 83, 69, 88, 84, 85, 76, 193, 83, 69, 88, 84, 73, 76, 69, - 128, 83, 69, 88, 84, 65, 78, 211, 83, 69, 86, 69, 82, 65, 78, 67, 69, - 128, 83, 69, 86, 69, 78, 84, 89, 128, 83, 69, 86, 69, 78, 84, 217, 83, - 69, 86, 69, 78, 84, 72, 128, 83, 69, 86, 69, 78, 84, 69, 69, 78, 128, 83, - 69, 86, 69, 78, 84, 69, 69, 206, 83, 69, 86, 69, 206, 83, 69, 85, 88, - 128, 83, 69, 83, 84, 69, 82, 84, 73, 85, 211, 83, 69, 83, 81, 85, 73, 81, - 85, 65, 68, 82, 65, 84, 69, 128, 83, 69, 83, 65, 77, 197, 83, 69, 82, 86, - 73, 67, 197, 83, 69, 82, 73, 70, 83, 128, 83, 69, 82, 73, 70, 211, 83, - 69, 80, 84, 69, 77, 66, 69, 82, 128, 83, 69, 80, 65, 82, 65, 84, 79, 82, - 128, 83, 69, 80, 65, 82, 65, 84, 79, 210, 83, 69, 78, 84, 79, 128, 83, - 69, 78, 84, 73, 128, 83, 69, 77, 85, 78, 67, 73, 193, 83, 69, 77, 75, 65, - 84, 72, 128, 83, 69, 77, 75, 128, 83, 69, 77, 73, 86, 79, 87, 69, 204, - 83, 69, 77, 73, 83, 79, 70, 212, 83, 69, 77, 73, 83, 69, 88, 84, 73, 76, - 69, 128, 83, 69, 77, 73, 77, 73, 78, 73, 77, 193, 83, 69, 77, 73, 68, 73, - 82, 69, 67, 212, 83, 69, 77, 73, 67, 79, 76, 79, 78, 128, 83, 69, 77, 73, - 67, 79, 76, 79, 206, 83, 69, 77, 73, 67, 73, 82, 67, 85, 76, 65, 210, 83, - 69, 77, 73, 67, 73, 82, 67, 76, 197, 83, 69, 77, 73, 66, 82, 69, 86, 73, - 211, 83, 69, 77, 73, 45, 86, 79, 73, 67, 69, 196, 83, 69, 76, 70, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 57, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 57, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 55, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 54, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 57, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 52, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 51, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 57, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 49, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 57, 48, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 56, 57, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 56, 56, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 56, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 56, 54, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 56, 53, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 56, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 56, 51, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 56, 50, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 56, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 56, 48, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 55, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 55, 56, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 55, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 55, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 55, 53, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 55, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 55, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 55, 50, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 55, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 55, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 55, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 54, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 54, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 54, 55, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 54, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 54, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 54, 52, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 54, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 54, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 54, 49, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 54, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, 57, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 53, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, - 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, 54, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 53, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, - 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, 51, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 53, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, - 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 53, 48, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 57, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 56, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 52, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 54, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 53, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 52, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 51, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 50, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 52, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 48, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 52, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 51, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 56, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 55, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 51, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 53, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 52, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 51, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 50, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 49, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 51, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 51, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 50, 57, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 50, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 55, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 50, 54, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 50, 53, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 53, 53, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 53, 52, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 50, 53, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 50, 53, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 53, 49, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 50, 53, 48, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 50, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 52, 57, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 52, 56, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 50, 52, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 50, 52, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 52, 53, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 50, 52, 52, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 50, 52, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 52, - 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 52, 49, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 50, 52, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 50, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 51, 57, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 50, 51, 56, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 50, 51, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 51, - 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 51, 53, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 50, 51, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 50, 51, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 51, 50, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 51, 49, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 50, 51, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, - 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 50, 57, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 50, 50, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 50, 50, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 50, 54, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 50, 53, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 50, 50, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, - 50, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 50, 50, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 50, 50, 49, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 50, 50, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 50, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 49, 57, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 50, 49, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, - 49, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 49, 54, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 50, 49, 53, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 50, 49, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 49, 51, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 49, 50, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 50, 49, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 50, 49, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 49, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 50, 48, 57, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 50, 48, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 48, 55, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 48, 54, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 50, 48, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 50, 48, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 48, 51, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 50, 48, 50, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 50, 48, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 48, - 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 50, 48, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 57, - 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 57, 56, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 57, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 49, 57, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 57, 53, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 57, 52, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 57, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, - 57, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 57, 49, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 49, 57, 48, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 56, 57, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 56, 56, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 56, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, - 56, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 56, 53, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 49, 56, 52, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 56, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 56, 50, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 56, 49, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 49, 56, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 49, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 55, 57, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 49, 55, 56, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 55, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 55, 54, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 55, 53, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 49, 55, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 49, 55, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 55, 50, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 49, 55, 49, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 49, 55, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 55, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 54, 57, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 49, 54, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 49, 54, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 54, 54, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 49, 54, 53, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 49, 54, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 54, - 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 54, 50, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 54, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 49, 54, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 54, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 49, 53, 57, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 49, 53, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 53, - 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 53, 54, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 53, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 49, 53, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 53, 51, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 53, 50, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 53, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, - 53, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 53, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 52, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 49, 52, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 52, 55, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 52, 54, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 52, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, - 52, 52, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 52, 51, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 49, 52, 50, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 52, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 52, 48, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 52, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 51, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, - 51, 56, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 51, 55, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 49, 51, 54, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 51, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 51, 52, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 51, 51, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 49, 51, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 49, 51, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 51, 48, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 49, 51, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 50, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 50, 56, - 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 50, 55, 128, 83, 69, 76, 69, - 67, 84, 79, 82, 45, 49, 50, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 49, 50, 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 50, 52, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 49, 50, 51, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 49, 50, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 50, - 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 50, 48, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, - 49, 49, 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 49, 56, 128, 83, - 69, 76, 69, 67, 84, 79, 82, 45, 49, 49, 55, 128, 83, 69, 76, 69, 67, 84, - 79, 82, 45, 49, 49, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 49, - 53, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 49, 52, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 49, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 49, 49, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 49, 49, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 49, 48, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 49, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 48, - 57, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 48, 56, 128, 83, 69, 76, - 69, 67, 84, 79, 82, 45, 49, 48, 55, 128, 83, 69, 76, 69, 67, 84, 79, 82, - 45, 49, 48, 54, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 48, 53, 128, - 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 48, 52, 128, 83, 69, 76, 69, 67, - 84, 79, 82, 45, 49, 48, 51, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, - 48, 50, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 48, 49, 128, 83, 69, - 76, 69, 67, 84, 79, 82, 45, 49, 48, 48, 128, 83, 69, 76, 69, 67, 84, 79, - 82, 45, 49, 48, 128, 83, 69, 76, 69, 67, 84, 79, 82, 45, 49, 128, 83, 69, - 76, 69, 67, 84, 79, 210, 83, 69, 73, 83, 77, 65, 128, 83, 69, 73, 83, 77, - 193, 83, 69, 72, 128, 83, 69, 71, 79, 76, 128, 83, 69, 71, 78, 79, 128, - 83, 69, 71, 77, 69, 78, 84, 128, 83, 69, 69, 78, 85, 128, 83, 69, 69, 78, - 128, 83, 69, 69, 206, 83, 69, 67, 84, 79, 82, 128, 83, 69, 67, 84, 73, - 79, 78, 128, 83, 69, 67, 84, 73, 79, 206, 83, 69, 67, 82, 69, 84, 128, - 83, 69, 67, 79, 78, 68, 128, 83, 69, 66, 65, 84, 66, 69, 73, 212, 83, 69, - 65, 76, 128, 83, 69, 65, 71, 85, 76, 204, 83, 68, 79, 78, 199, 83, 68, - 128, 83, 67, 87, 65, 128, 83, 67, 82, 85, 80, 76, 69, 128, 83, 67, 82, - 73, 80, 84, 128, 83, 67, 82, 69, 69, 78, 128, 83, 67, 82, 69, 69, 206, - 83, 67, 79, 82, 80, 73, 85, 83, 128, 83, 67, 73, 83, 83, 79, 82, 83, 128, - 83, 67, 72, 87, 65, 128, 83, 67, 72, 87, 193, 83, 67, 72, 82, 79, 69, 68, - 69, 82, 128, 83, 67, 72, 79, 79, 76, 128, 83, 67, 72, 79, 76, 65, 82, - 128, 83, 67, 72, 69, 77, 193, 83, 67, 65, 78, 68, 73, 67, 85, 83, 128, - 83, 67, 65, 78, 68, 73, 67, 85, 211, 83, 67, 65, 206, 83, 67, 65, 76, 69, - 83, 128, 83, 66, 85, 194, 83, 66, 82, 85, 204, 83, 65, 89, 73, 83, 201, - 83, 65, 89, 65, 78, 78, 65, 128, 83, 65, 89, 128, 83, 65, 88, 73, 77, 65, - 84, 65, 128, 83, 65, 87, 65, 78, 128, 83, 65, 87, 128, 83, 65, 85, 73, - 76, 128, 83, 65, 84, 85, 82, 78, 128, 83, 65, 84, 75, 65, 65, 78, 75, 85, - 85, 128, 83, 65, 84, 75, 65, 65, 78, 128, 83, 65, 83, 65, 75, 128, 83, - 65, 82, 73, 128, 83, 65, 82, 193, 83, 65, 82, 128, 83, 65, 80, 65, 128, - 83, 65, 78, 89, 79, 79, 71, 193, 83, 65, 78, 89, 65, 75, 193, 83, 65, 78, - 84, 73, 73, 77, 85, 128, 83, 65, 78, 78, 89, 65, 128, 83, 65, 78, 71, 65, - 50, 128, 83, 65, 78, 65, 72, 128, 83, 65, 78, 128, 83, 65, 77, 89, 79, - 203, 83, 65, 77, 80, 73, 128, 83, 65, 77, 80, 72, 65, 79, 128, 83, 65, - 77, 75, 65, 128, 83, 65, 77, 69, 75, 72, 128, 83, 65, 77, 69, 75, 200, - 83, 65, 77, 66, 65, 128, 83, 65, 77, 128, 83, 65, 76, 84, 73, 82, 69, - 128, 83, 65, 76, 84, 73, 76, 76, 79, 128, 83, 65, 76, 84, 128, 83, 65, - 76, 76, 65, 76, 76, 65, 72, 79, 213, 83, 65, 76, 76, 193, 83, 65, 76, 65, - 205, 83, 65, 76, 65, 128, 83, 65, 76, 128, 83, 65, 75, 79, 84, 128, 83, - 65, 74, 68, 65, 72, 128, 83, 65, 73, 76, 66, 79, 65, 84, 128, 83, 65, 73, - 76, 128, 83, 65, 73, 75, 85, 82, 85, 128, 83, 65, 71, 73, 84, 84, 65, 82, - 73, 85, 83, 128, 83, 65, 71, 65, 128, 83, 65, 71, 128, 83, 65, 199, 83, - 65, 70, 72, 65, 128, 83, 65, 68, 72, 69, 128, 83, 65, 68, 69, 128, 83, - 65, 68, 128, 83, 65, 196, 83, 65, 67, 82, 73, 70, 73, 67, 73, 65, 204, - 83, 65, 65, 73, 128, 83, 65, 65, 68, 72, 85, 128, 83, 65, 45, 73, 128, - 83, 48, 52, 54, 128, 83, 48, 52, 53, 128, 83, 48, 52, 52, 128, 83, 48, - 52, 51, 128, 83, 48, 52, 50, 128, 83, 48, 52, 49, 128, 83, 48, 52, 48, - 128, 83, 48, 51, 57, 128, 83, 48, 51, 56, 128, 83, 48, 51, 55, 128, 83, - 48, 51, 54, 128, 83, 48, 51, 53, 65, 128, 83, 48, 51, 53, 128, 83, 48, - 51, 52, 128, 83, 48, 51, 51, 128, 83, 48, 51, 50, 128, 83, 48, 51, 49, - 128, 83, 48, 51, 48, 128, 83, 48, 50, 57, 128, 83, 48, 50, 56, 128, 83, - 48, 50, 55, 128, 83, 48, 50, 54, 66, 128, 83, 48, 50, 54, 65, 128, 83, - 48, 50, 54, 128, 83, 48, 50, 53, 128, 83, 48, 50, 52, 128, 83, 48, 50, - 51, 128, 83, 48, 50, 50, 128, 83, 48, 50, 49, 128, 83, 48, 50, 48, 128, - 83, 48, 49, 57, 128, 83, 48, 49, 56, 128, 83, 48, 49, 55, 65, 128, 83, - 48, 49, 55, 128, 83, 48, 49, 54, 128, 83, 48, 49, 53, 128, 83, 48, 49, - 52, 66, 128, 83, 48, 49, 52, 65, 128, 83, 48, 49, 52, 128, 83, 48, 49, - 51, 128, 83, 48, 49, 50, 128, 83, 48, 49, 49, 128, 83, 48, 49, 48, 128, - 83, 48, 48, 57, 128, 83, 48, 48, 56, 128, 83, 48, 48, 55, 128, 83, 48, - 48, 54, 65, 128, 83, 48, 48, 54, 128, 83, 48, 48, 53, 128, 83, 48, 48, - 52, 128, 83, 48, 48, 51, 128, 83, 48, 48, 50, 65, 128, 83, 48, 48, 50, - 128, 83, 48, 48, 49, 128, 83, 45, 87, 128, 83, 45, 83, 72, 65, 80, 69, - 196, 82, 89, 89, 128, 82, 89, 88, 128, 82, 89, 84, 128, 82, 89, 82, 88, - 128, 82, 89, 82, 128, 82, 89, 80, 128, 82, 89, 65, 128, 82, 87, 79, 79, - 128, 82, 87, 79, 128, 82, 87, 73, 73, 128, 82, 87, 73, 128, 82, 87, 69, - 69, 128, 82, 87, 69, 128, 82, 87, 65, 72, 65, 128, 82, 87, 65, 65, 128, - 82, 87, 65, 128, 82, 85, 88, 128, 82, 85, 85, 66, 85, 82, 85, 128, 82, - 85, 84, 128, 82, 85, 83, 73, 128, 82, 85, 82, 88, 128, 82, 85, 82, 128, - 82, 85, 80, 73, 73, 128, 82, 85, 80, 69, 197, 82, 85, 80, 128, 82, 85, - 79, 88, 128, 82, 85, 79, 80, 128, 82, 85, 79, 128, 82, 85, 78, 79, 85, - 84, 128, 82, 85, 78, 128, 82, 85, 77, 201, 82, 85, 77, 65, 201, 82, 85, - 77, 128, 82, 85, 205, 82, 85, 76, 69, 45, 68, 69, 76, 65, 89, 69, 68, - 128, 82, 85, 76, 69, 128, 82, 85, 75, 75, 65, 75, 72, 65, 128, 82, 85, - 73, 83, 128, 82, 85, 194, 82, 85, 65, 128, 82, 84, 72, 65, 78, 199, 82, - 84, 65, 71, 83, 128, 82, 84, 65, 71, 211, 82, 82, 89, 88, 128, 82, 82, - 89, 84, 128, 82, 82, 89, 82, 88, 128, 82, 82, 89, 82, 128, 82, 82, 89, - 80, 128, 82, 82, 89, 128, 82, 82, 85, 88, 128, 82, 82, 85, 84, 128, 82, - 82, 85, 82, 88, 128, 82, 82, 85, 82, 128, 82, 82, 85, 80, 128, 82, 82, - 85, 79, 88, 128, 82, 82, 85, 79, 128, 82, 82, 85, 128, 82, 82, 79, 88, - 128, 82, 82, 79, 84, 128, 82, 82, 79, 80, 128, 82, 82, 79, 128, 82, 82, - 69, 88, 128, 82, 82, 69, 84, 128, 82, 82, 69, 80, 128, 82, 82, 69, 72, - 128, 82, 82, 69, 200, 82, 82, 69, 128, 82, 82, 65, 88, 128, 82, 82, 65, - 128, 82, 79, 85, 78, 68, 69, 196, 82, 79, 85, 78, 68, 45, 84, 73, 80, 80, - 69, 196, 82, 79, 84, 85, 78, 68, 65, 128, 82, 79, 84, 65, 84, 69, 196, - 82, 79, 83, 72, 128, 82, 79, 83, 69, 84, 84, 69, 128, 82, 79, 79, 84, - 128, 82, 79, 79, 75, 128, 82, 79, 79, 70, 128, 82, 79, 79, 128, 82, 79, - 77, 65, 206, 82, 79, 196, 82, 79, 67, 128, 82, 79, 66, 65, 84, 128, 82, - 79, 65, 82, 128, 82, 79, 65, 128, 82, 78, 89, 73, 78, 199, 82, 78, 79, - 79, 78, 128, 82, 78, 79, 79, 206, 82, 78, 65, 205, 82, 74, 69, 211, 82, - 74, 69, 128, 82, 74, 197, 82, 73, 86, 69, 82, 128, 82, 73, 84, 85, 65, - 76, 128, 82, 73, 84, 84, 79, 82, 85, 128, 82, 73, 84, 83, 73, 128, 82, - 73, 83, 73, 78, 199, 82, 73, 83, 72, 128, 82, 73, 82, 65, 128, 82, 73, - 80, 128, 82, 73, 78, 71, 211, 82, 73, 78, 70, 79, 82, 90, 65, 78, 68, 79, - 128, 82, 73, 206, 82, 73, 75, 82, 73, 75, 128, 82, 73, 73, 128, 82, 73, - 71, 86, 69, 68, 73, 195, 82, 73, 71, 72, 84, 87, 65, 82, 68, 83, 128, 82, - 73, 71, 72, 84, 72, 65, 78, 196, 82, 73, 71, 72, 84, 45, 84, 79, 45, 76, - 69, 70, 212, 82, 73, 71, 72, 84, 45, 83, 73, 68, 197, 82, 73, 71, 72, 84, - 45, 83, 72, 65, 68, 79, 87, 69, 196, 82, 73, 71, 72, 84, 45, 83, 72, 65, - 68, 69, 196, 82, 73, 71, 72, 84, 45, 80, 79, 73, 78, 84, 73, 78, 199, 82, - 73, 71, 72, 84, 45, 72, 65, 78, 196, 82, 73, 71, 72, 84, 45, 70, 65, 67, - 73, 78, 199, 82, 73, 71, 72, 84, 128, 82, 73, 69, 85, 76, 45, 89, 69, 83, - 73, 69, 85, 78, 71, 128, 82, 73, 69, 85, 76, 45, 89, 69, 79, 82, 73, 78, - 72, 73, 69, 85, 72, 45, 72, 73, 69, 85, 72, 128, 82, 73, 69, 85, 76, 45, - 89, 69, 79, 82, 73, 78, 72, 73, 69, 85, 72, 128, 82, 73, 69, 85, 76, 45, - 84, 73, 75, 69, 85, 84, 45, 72, 73, 69, 85, 72, 128, 82, 73, 69, 85, 76, - 45, 84, 73, 75, 69, 85, 84, 128, 82, 73, 69, 85, 76, 45, 84, 72, 73, 69, - 85, 84, 72, 128, 82, 73, 69, 85, 76, 45, 83, 83, 65, 78, 71, 84, 73, 75, - 69, 85, 84, 128, 82, 73, 69, 85, 76, 45, 83, 83, 65, 78, 71, 83, 73, 79, - 83, 128, 82, 73, 69, 85, 76, 45, 83, 83, 65, 78, 71, 80, 73, 69, 85, 80, - 128, 82, 73, 69, 85, 76, 45, 83, 83, 65, 78, 71, 75, 73, 89, 69, 79, 75, - 128, 82, 73, 69, 85, 76, 45, 83, 73, 79, 83, 128, 82, 73, 69, 85, 76, 45, - 80, 73, 69, 85, 80, 45, 84, 73, 75, 69, 85, 84, 128, 82, 73, 69, 85, 76, - 45, 80, 73, 69, 85, 80, 45, 83, 73, 79, 83, 128, 82, 73, 69, 85, 76, 45, - 80, 73, 69, 85, 80, 45, 80, 72, 73, 69, 85, 80, 72, 128, 82, 73, 69, 85, - 76, 45, 80, 73, 69, 85, 80, 45, 72, 73, 69, 85, 72, 128, 82, 73, 69, 85, - 76, 45, 80, 73, 69, 85, 80, 128, 82, 73, 69, 85, 76, 45, 80, 72, 73, 69, - 85, 80, 72, 128, 82, 73, 69, 85, 76, 45, 80, 65, 78, 83, 73, 79, 83, 128, - 82, 73, 69, 85, 76, 45, 78, 73, 69, 85, 78, 128, 82, 73, 69, 85, 76, 45, - 77, 73, 69, 85, 77, 45, 83, 73, 79, 83, 128, 82, 73, 69, 85, 76, 45, 77, - 73, 69, 85, 77, 45, 75, 73, 89, 69, 79, 75, 128, 82, 73, 69, 85, 76, 45, - 77, 73, 69, 85, 77, 45, 72, 73, 69, 85, 72, 128, 82, 73, 69, 85, 76, 45, - 77, 73, 69, 85, 77, 128, 82, 73, 69, 85, 76, 45, 75, 73, 89, 69, 79, 75, - 45, 83, 73, 79, 83, 128, 82, 73, 69, 85, 76, 45, 75, 73, 89, 69, 79, 75, - 45, 72, 73, 69, 85, 72, 128, 82, 73, 69, 85, 76, 45, 75, 73, 89, 69, 79, - 75, 128, 82, 73, 69, 85, 76, 45, 75, 65, 80, 89, 69, 79, 85, 78, 80, 73, - 69, 85, 80, 128, 82, 73, 69, 85, 76, 45, 72, 73, 69, 85, 72, 128, 82, 73, - 69, 85, 76, 45, 67, 73, 69, 85, 67, 128, 82, 73, 69, 85, 204, 82, 73, 69, - 76, 128, 82, 73, 69, 69, 128, 82, 73, 67, 69, 77, 128, 82, 73, 67, 69, - 128, 82, 73, 65, 204, 82, 72, 79, 84, 73, 195, 82, 72, 79, 128, 82, 72, - 207, 82, 72, 65, 128, 82, 71, 89, 73, 78, 71, 83, 128, 82, 71, 89, 65, - 78, 128, 82, 71, 89, 193, 82, 69, 86, 79, 76, 85, 84, 73, 79, 78, 128, - 82, 69, 86, 77, 65, 128, 82, 69, 86, 73, 65, 128, 82, 69, 86, 69, 82, 83, - 69, 68, 128, 82, 69, 86, 69, 82, 83, 197, 82, 69, 85, 88, 128, 82, 69, - 84, 85, 82, 78, 128, 82, 69, 84, 85, 82, 206, 82, 69, 84, 82, 79, 70, 76, - 69, 216, 82, 69, 84, 82, 69, 65, 84, 128, 82, 69, 83, 85, 80, 73, 78, 85, - 83, 128, 82, 69, 83, 84, 82, 73, 67, 84, 69, 196, 82, 69, 83, 84, 128, - 82, 69, 83, 80, 79, 78, 83, 69, 128, 82, 69, 83, 79, 85, 82, 67, 69, 128, - 82, 69, 83, 79, 76, 85, 84, 73, 79, 78, 128, 82, 69, 83, 73, 83, 84, 65, - 78, 67, 69, 128, 82, 69, 83, 73, 68, 69, 78, 67, 69, 128, 82, 69, 83, - 200, 82, 69, 82, 69, 78, 71, 71, 65, 78, 128, 82, 69, 82, 69, 75, 65, 78, - 128, 82, 69, 80, 82, 69, 83, 69, 78, 84, 128, 82, 69, 80, 76, 65, 67, 69, - 77, 69, 78, 212, 82, 69, 80, 69, 65, 84, 69, 196, 82, 69, 80, 69, 65, 84, - 128, 82, 69, 80, 69, 65, 212, 82, 69, 80, 65, 128, 82, 69, 80, 193, 82, - 69, 78, 84, 79, 71, 69, 78, 128, 82, 69, 78, 128, 82, 69, 77, 85, 128, - 82, 69, 76, 73, 71, 73, 79, 78, 128, 82, 69, 76, 69, 65, 83, 69, 128, 82, - 69, 76, 65, 84, 73, 79, 78, 65, 204, 82, 69, 76, 65, 84, 73, 79, 78, 128, - 82, 69, 76, 65, 65, 128, 82, 69, 74, 65, 78, 199, 82, 69, 73, 196, 82, - 69, 71, 73, 83, 84, 69, 82, 69, 196, 82, 69, 70, 69, 82, 69, 78, 67, 197, - 82, 69, 68, 85, 80, 76, 73, 67, 65, 84, 73, 79, 78, 128, 82, 69, 67, 89, - 67, 76, 73, 78, 199, 82, 69, 67, 89, 67, 76, 69, 196, 82, 69, 67, 84, 73, - 76, 73, 78, 69, 65, 210, 82, 69, 67, 84, 65, 78, 71, 85, 76, 65, 210, 82, - 69, 67, 84, 65, 78, 71, 76, 69, 128, 82, 69, 67, 84, 65, 78, 71, 76, 197, - 82, 69, 67, 79, 82, 68, 73, 78, 199, 82, 69, 67, 79, 82, 68, 69, 82, 128, - 82, 69, 67, 79, 82, 196, 82, 69, 67, 69, 80, 84, 73, 86, 197, 82, 69, 65, - 72, 77, 85, 75, 128, 82, 69, 65, 67, 72, 128, 82, 68, 207, 82, 68, 69, - 204, 82, 66, 65, 83, 193, 82, 65, 89, 83, 128, 82, 65, 89, 65, 78, 78, - 65, 128, 82, 65, 89, 128, 82, 65, 84, 73, 79, 128, 82, 65, 84, 72, 65, - 128, 82, 65, 84, 72, 193, 82, 65, 84, 65, 128, 82, 65, 84, 128, 82, 65, - 83, 87, 65, 68, 73, 128, 82, 65, 83, 79, 85, 204, 82, 65, 83, 72, 65, - 128, 82, 65, 80, 73, 83, 77, 65, 128, 82, 65, 78, 71, 197, 82, 65, 78, - 65, 128, 82, 65, 78, 128, 82, 65, 77, 211, 82, 65, 77, 66, 65, 84, 128, - 82, 65, 77, 128, 82, 65, 75, 72, 65, 78, 71, 128, 82, 65, 73, 83, 69, - 196, 82, 65, 73, 78, 128, 82, 65, 73, 206, 82, 65, 73, 68, 207, 82, 65, - 73, 68, 65, 128, 82, 65, 73, 128, 82, 65, 72, 77, 65, 84, 85, 76, 76, 65, - 200, 82, 65, 70, 69, 128, 82, 65, 69, 128, 82, 65, 68, 73, 79, 65, 67, - 84, 73, 86, 197, 82, 65, 68, 201, 82, 65, 68, 128, 82, 65, 196, 82, 65, - 66, 128, 82, 65, 65, 73, 128, 82, 65, 65, 128, 82, 65, 51, 128, 82, 65, - 50, 128, 82, 48, 50, 57, 128, 82, 48, 50, 56, 128, 82, 48, 50, 55, 128, - 82, 48, 50, 54, 128, 82, 48, 50, 53, 128, 82, 48, 50, 52, 128, 82, 48, - 50, 51, 128, 82, 48, 50, 50, 128, 82, 48, 50, 49, 128, 82, 48, 50, 48, - 128, 82, 48, 49, 57, 128, 82, 48, 49, 56, 128, 82, 48, 49, 55, 128, 82, - 48, 49, 54, 65, 128, 82, 48, 49, 54, 128, 82, 48, 49, 53, 128, 82, 48, - 49, 52, 128, 82, 48, 49, 51, 128, 82, 48, 49, 50, 128, 82, 48, 49, 49, - 128, 82, 48, 49, 48, 65, 128, 82, 48, 49, 48, 128, 82, 48, 48, 57, 128, - 82, 48, 48, 56, 128, 82, 48, 48, 55, 128, 82, 48, 48, 54, 128, 82, 48, - 48, 53, 128, 82, 48, 48, 52, 128, 82, 48, 48, 51, 66, 128, 82, 48, 48, - 51, 65, 128, 82, 48, 48, 51, 128, 82, 48, 48, 50, 65, 128, 82, 48, 48, - 50, 128, 82, 48, 48, 49, 128, 82, 45, 67, 82, 69, 197, 81, 89, 88, 128, - 81, 89, 85, 128, 81, 89, 84, 128, 81, 89, 82, 88, 128, 81, 89, 82, 128, - 81, 89, 80, 128, 81, 89, 79, 128, 81, 89, 73, 128, 81, 89, 69, 69, 128, - 81, 89, 69, 128, 81, 89, 65, 65, 128, 81, 89, 65, 128, 81, 89, 128, 81, - 87, 73, 128, 81, 87, 69, 69, 128, 81, 87, 69, 128, 81, 87, 65, 65, 128, - 81, 87, 65, 128, 81, 85, 88, 128, 81, 85, 86, 128, 81, 85, 85, 86, 128, - 81, 85, 85, 128, 81, 85, 84, 128, 81, 85, 83, 72, 83, 72, 65, 89, 65, - 128, 81, 85, 82, 88, 128, 81, 85, 82, 128, 81, 85, 80, 128, 81, 85, 79, - 88, 128, 81, 85, 79, 84, 197, 81, 85, 79, 84, 65, 84, 73, 79, 206, 81, - 85, 79, 84, 128, 81, 85, 79, 80, 128, 81, 85, 79, 128, 81, 85, 75, 128, - 81, 85, 73, 78, 68, 73, 67, 69, 83, 73, 77, 193, 81, 85, 73, 78, 67, 85, - 78, 88, 128, 81, 85, 73, 78, 65, 82, 73, 85, 211, 81, 85, 73, 76, 76, - 128, 81, 85, 73, 128, 81, 85, 70, 128, 81, 85, 69, 83, 84, 73, 79, 78, - 69, 196, 81, 85, 69, 83, 84, 73, 79, 78, 128, 81, 85, 69, 83, 84, 73, 79, - 206, 81, 85, 69, 69, 78, 128, 81, 85, 69, 128, 81, 85, 66, 85, 84, 83, - 128, 81, 85, 65, 84, 69, 82, 78, 73, 79, 206, 81, 85, 65, 82, 84, 69, 82, - 83, 128, 81, 85, 65, 82, 84, 69, 82, 211, 81, 85, 65, 82, 84, 69, 82, - 128, 81, 85, 65, 82, 84, 69, 210, 81, 85, 65, 78, 84, 73, 84, 217, 81, - 85, 65, 68, 82, 85, 80, 76, 197, 81, 85, 65, 68, 82, 65, 78, 84, 128, 81, - 85, 65, 68, 82, 65, 78, 212, 81, 85, 65, 68, 128, 81, 85, 65, 196, 81, - 85, 65, 128, 81, 85, 128, 81, 208, 81, 79, 88, 128, 81, 79, 84, 128, 81, - 79, 80, 72, 128, 81, 79, 80, 65, 128, 81, 79, 80, 128, 81, 79, 79, 128, - 81, 79, 207, 81, 79, 70, 128, 81, 79, 198, 81, 79, 65, 128, 81, 79, 128, - 81, 78, 128, 81, 73, 88, 128, 81, 73, 84, 83, 65, 128, 81, 73, 84, 128, - 81, 73, 80, 128, 81, 73, 73, 128, 81, 73, 69, 88, 128, 81, 73, 69, 84, - 128, 81, 73, 69, 80, 128, 81, 73, 69, 128, 81, 73, 128, 81, 72, 87, 73, - 128, 81, 72, 87, 69, 69, 128, 81, 72, 87, 69, 128, 81, 72, 87, 65, 65, - 128, 81, 72, 87, 65, 128, 81, 72, 85, 128, 81, 72, 79, 128, 81, 72, 73, - 128, 81, 72, 69, 69, 128, 81, 72, 69, 128, 81, 72, 65, 65, 128, 81, 72, - 65, 128, 81, 69, 84, 65, 78, 65, 128, 81, 69, 69, 128, 81, 69, 128, 81, - 65, 85, 128, 81, 65, 84, 65, 78, 128, 81, 65, 82, 78, 69, 217, 81, 65, - 82, 128, 81, 65, 81, 128, 81, 65, 80, 72, 128, 81, 65, 77, 65, 84, 83, - 128, 81, 65, 77, 65, 84, 211, 81, 65, 76, 193, 81, 65, 73, 82, 84, 72, - 82, 65, 128, 81, 65, 73, 128, 81, 65, 70, 128, 81, 65, 198, 81, 65, 68, - 77, 65, 128, 81, 65, 65, 73, 128, 81, 65, 65, 70, 85, 128, 81, 65, 65, - 70, 128, 81, 48, 48, 55, 128, 81, 48, 48, 54, 128, 81, 48, 48, 53, 128, - 81, 48, 48, 52, 128, 81, 48, 48, 51, 128, 81, 48, 48, 50, 128, 81, 48, - 48, 49, 128, 209, 80, 90, 128, 80, 89, 88, 128, 80, 89, 84, 128, 80, 89, - 82, 88, 128, 80, 89, 82, 128, 80, 89, 80, 128, 80, 89, 128, 80, 87, 79, - 89, 128, 80, 87, 79, 79, 128, 80, 87, 79, 128, 80, 87, 207, 80, 87, 73, - 73, 128, 80, 87, 73, 128, 80, 87, 69, 69, 128, 80, 87, 69, 128, 80, 87, - 65, 65, 128, 80, 87, 128, 80, 86, 128, 80, 85, 88, 128, 80, 85, 84, 128, - 80, 85, 83, 72, 80, 73, 75, 65, 128, 80, 85, 83, 72, 73, 78, 199, 80, 85, - 82, 88, 128, 80, 85, 82, 73, 84, 89, 128, 80, 85, 82, 128, 80, 85, 80, - 128, 80, 85, 79, 88, 128, 80, 85, 79, 80, 128, 80, 85, 79, 128, 80, 85, - 78, 71, 128, 80, 85, 78, 67, 84, 85, 65, 84, 73, 79, 78, 128, 80, 85, 78, - 67, 84, 85, 65, 84, 73, 79, 206, 80, 85, 77, 80, 128, 80, 85, 69, 128, - 80, 85, 65, 69, 128, 80, 85, 50, 128, 80, 85, 128, 80, 84, 72, 65, 72, - 193, 80, 84, 69, 128, 80, 83, 73, 70, 73, 83, 84, 79, 83, 89, 78, 65, 71, - 77, 65, 128, 80, 83, 73, 70, 73, 83, 84, 79, 80, 65, 82, 65, 75, 65, 76, - 69, 83, 77, 65, 128, 80, 83, 73, 70, 73, 83, 84, 79, 206, 80, 83, 73, 70, - 73, 83, 84, 79, 76, 89, 71, 73, 83, 77, 65, 128, 80, 83, 73, 128, 80, 83, - 128, 80, 82, 79, 86, 69, 128, 80, 82, 79, 84, 79, 86, 65, 82, 89, 211, - 80, 82, 79, 84, 79, 211, 80, 82, 79, 83, 71, 69, 71, 82, 65, 77, 77, 69, - 78, 73, 128, 80, 82, 79, 80, 79, 82, 84, 73, 79, 78, 65, 204, 80, 82, 79, - 80, 79, 82, 84, 73, 79, 78, 128, 80, 82, 79, 80, 69, 82, 84, 217, 80, 82, - 79, 80, 69, 76, 76, 69, 210, 80, 82, 79, 79, 70, 128, 80, 82, 79, 76, 79, - 78, 71, 69, 196, 80, 82, 79, 76, 65, 84, 73, 79, 78, 197, 80, 82, 79, 74, - 69, 67, 84, 73, 86, 69, 128, 80, 82, 79, 74, 69, 67, 84, 73, 79, 78, 128, - 80, 82, 79, 71, 82, 69, 83, 83, 128, 80, 82, 79, 70, 79, 85, 78, 68, 128, - 80, 82, 79, 68, 85, 67, 84, 128, 80, 82, 79, 68, 85, 67, 212, 80, 82, 73, - 86, 65, 84, 69, 128, 80, 82, 73, 83, 72, 84, 72, 65, 77, 65, 84, 82, 193, - 80, 82, 73, 78, 84, 128, 80, 82, 73, 78, 212, 80, 82, 73, 77, 69, 128, - 80, 82, 73, 77, 197, 80, 82, 69, 86, 73, 79, 85, 211, 80, 82, 69, 83, 69, - 78, 84, 65, 84, 73, 79, 206, 80, 82, 69, 83, 67, 82, 73, 80, 84, 73, 79, - 206, 80, 82, 69, 80, 79, 78, 68, 69, 82, 65, 78, 67, 69, 128, 80, 82, 69, - 78, 75, 72, 65, 128, 80, 82, 69, 70, 65, 67, 197, 80, 82, 69, 67, 69, 68, - 73, 78, 199, 80, 82, 69, 67, 69, 68, 69, 83, 128, 80, 82, 69, 67, 69, 68, - 69, 211, 80, 82, 69, 67, 69, 68, 69, 196, 80, 82, 69, 67, 69, 68, 69, - 128, 80, 82, 69, 67, 69, 68, 197, 80, 82, 65, 77, 45, 80, 73, 73, 128, - 80, 82, 65, 77, 45, 80, 73, 201, 80, 82, 65, 77, 45, 77, 85, 79, 89, 128, - 80, 82, 65, 77, 45, 77, 85, 79, 217, 80, 82, 65, 77, 45, 66, 85, 79, 78, - 128, 80, 82, 65, 77, 45, 66, 85, 79, 206, 80, 82, 65, 77, 45, 66, 69, 73, - 128, 80, 82, 65, 77, 45, 66, 69, 201, 80, 82, 65, 77, 128, 80, 82, 65, - 205, 80, 82, 128, 80, 80, 86, 128, 80, 80, 77, 128, 80, 80, 65, 128, 80, - 79, 89, 128, 80, 79, 88, 128, 80, 79, 87, 69, 82, 211, 80, 79, 87, 69, - 82, 128, 80, 79, 85, 78, 196, 80, 79, 83, 84, 80, 79, 83, 73, 84, 73, 79, - 206, 80, 79, 83, 84, 65, 204, 80, 79, 83, 83, 69, 83, 83, 73, 79, 78, - 128, 80, 79, 82, 82, 69, 67, 84, 85, 83, 128, 80, 79, 82, 82, 69, 67, 84, - 85, 211, 80, 79, 80, 128, 80, 79, 208, 80, 79, 79, 128, 80, 79, 78, 68, - 79, 128, 80, 79, 76, 201, 80, 79, 76, 69, 128, 80, 79, 75, 82, 89, 84, - 73, 69, 128, 80, 79, 75, 79, 74, 73, 128, 80, 79, 73, 78, 84, 79, 128, - 80, 79, 73, 78, 84, 69, 82, 128, 80, 79, 73, 78, 84, 69, 196, 80, 79, 73, - 78, 84, 128, 80, 79, 73, 78, 212, 80, 79, 69, 84, 82, 217, 80, 79, 69, - 84, 73, 195, 80, 79, 68, 65, 84, 85, 83, 128, 80, 79, 65, 128, 80, 79, - 128, 80, 207, 80, 78, 69, 85, 77, 65, 84, 65, 128, 80, 76, 85, 84, 79, - 128, 80, 76, 85, 83, 45, 77, 73, 78, 85, 211, 80, 76, 85, 83, 128, 80, - 76, 85, 77, 69, 196, 80, 76, 85, 77, 128, 80, 76, 85, 75, 128, 80, 76, - 79, 87, 128, 80, 76, 79, 80, 72, 85, 128, 80, 76, 69, 84, 72, 82, 79, 78, - 128, 80, 76, 65, 83, 84, 73, 67, 83, 128, 80, 76, 65, 78, 69, 128, 80, - 76, 65, 78, 197, 80, 76, 65, 78, 67, 203, 80, 76, 65, 75, 128, 80, 76, - 65, 71, 73, 79, 211, 80, 76, 65, 67, 69, 72, 79, 76, 68, 69, 210, 80, 76, - 65, 67, 197, 80, 76, 65, 128, 80, 73, 90, 90, 73, 67, 65, 84, 79, 128, - 80, 73, 88, 128, 80, 73, 87, 82, 128, 80, 73, 84, 67, 72, 70, 79, 82, 75, - 128, 80, 73, 84, 67, 72, 70, 79, 82, 203, 80, 73, 84, 128, 80, 73, 83, - 69, 76, 69, 72, 128, 80, 73, 83, 67, 69, 83, 128, 80, 73, 82, 73, 71, - 128, 80, 73, 82, 73, 199, 80, 73, 80, 73, 78, 71, 128, 80, 73, 80, 128, - 80, 73, 78, 87, 72, 69, 69, 204, 80, 73, 76, 67, 82, 79, 215, 80, 73, 75, - 85, 82, 85, 128, 80, 73, 75, 79, 128, 80, 73, 71, 128, 80, 73, 69, 88, - 128, 80, 73, 69, 85, 80, 45, 84, 72, 73, 69, 85, 84, 72, 128, 80, 73, 69, - 85, 80, 45, 83, 83, 65, 78, 71, 83, 73, 79, 83, 128, 80, 73, 69, 85, 80, - 45, 83, 73, 79, 83, 45, 84, 73, 75, 69, 85, 84, 128, 80, 73, 69, 85, 80, - 45, 83, 73, 79, 83, 45, 84, 72, 73, 69, 85, 84, 72, 128, 80, 73, 69, 85, - 80, 45, 83, 73, 79, 83, 45, 80, 73, 69, 85, 80, 128, 80, 73, 69, 85, 80, - 45, 83, 73, 79, 83, 45, 75, 73, 89, 69, 79, 75, 128, 80, 73, 69, 85, 80, - 45, 83, 73, 79, 83, 45, 67, 73, 69, 85, 67, 128, 80, 73, 69, 85, 80, 45, - 82, 73, 69, 85, 76, 45, 80, 72, 73, 69, 85, 80, 72, 128, 80, 73, 69, 85, - 80, 45, 82, 73, 69, 85, 76, 128, 80, 73, 69, 85, 80, 45, 78, 73, 69, 85, - 78, 128, 80, 73, 69, 85, 80, 45, 77, 73, 69, 85, 77, 128, 80, 73, 69, 85, - 80, 45, 75, 72, 73, 69, 85, 75, 72, 128, 80, 73, 69, 85, 80, 45, 67, 73, - 69, 85, 67, 128, 80, 73, 69, 85, 80, 45, 67, 72, 73, 69, 85, 67, 72, 128, - 80, 73, 69, 85, 208, 80, 73, 69, 80, 128, 80, 73, 69, 67, 69, 128, 80, - 73, 69, 128, 80, 73, 67, 75, 128, 80, 73, 65, 83, 85, 84, 79, 82, 85, - 128, 80, 73, 65, 83, 77, 193, 80, 73, 65, 78, 79, 128, 80, 201, 80, 72, - 87, 65, 128, 80, 72, 85, 84, 72, 65, 79, 128, 80, 72, 85, 210, 80, 72, - 85, 78, 71, 128, 80, 72, 82, 65, 83, 69, 128, 80, 72, 79, 69, 78, 73, 67, - 73, 65, 206, 80, 72, 79, 65, 128, 80, 72, 79, 128, 80, 72, 207, 80, 72, - 78, 65, 69, 203, 80, 72, 73, 78, 84, 72, 85, 128, 80, 72, 73, 76, 73, 80, - 80, 73, 78, 197, 80, 72, 73, 69, 85, 80, 72, 45, 84, 72, 73, 69, 85, 84, - 72, 128, 80, 72, 73, 69, 85, 80, 72, 45, 83, 73, 79, 83, 128, 80, 72, 73, - 69, 85, 80, 72, 45, 80, 73, 69, 85, 80, 128, 80, 72, 73, 69, 85, 80, 72, - 45, 72, 73, 69, 85, 72, 128, 80, 72, 73, 69, 85, 80, 200, 80, 72, 73, - 128, 80, 72, 201, 80, 72, 69, 69, 128, 80, 72, 69, 128, 80, 72, 65, 82, - 89, 78, 71, 69, 65, 204, 80, 72, 65, 82, 128, 80, 72, 65, 78, 128, 80, - 72, 65, 77, 128, 80, 72, 65, 73, 83, 84, 79, 211, 80, 72, 65, 71, 83, 45, - 80, 193, 80, 72, 65, 65, 82, 75, 65, 65, 128, 80, 72, 65, 65, 128, 80, - 72, 65, 128, 80, 71, 128, 80, 70, 128, 80, 69, 85, 88, 128, 80, 69, 84, - 65, 83, 84, 79, 75, 79, 85, 70, 73, 83, 77, 65, 128, 80, 69, 84, 65, 83, - 84, 73, 128, 80, 69, 84, 65, 83, 77, 65, 128, 80, 69, 84, 65, 76, 76, 69, - 196, 80, 69, 83, 79, 128, 80, 69, 83, 207, 80, 69, 83, 72, 50, 128, 80, - 69, 83, 69, 84, 193, 80, 69, 211, 80, 69, 82, 84, 72, 207, 80, 69, 82, - 83, 80, 69, 67, 84, 73, 86, 69, 128, 80, 69, 82, 83, 79, 78, 128, 80, 69, - 82, 83, 79, 206, 80, 69, 82, 83, 73, 65, 206, 80, 69, 82, 80, 69, 78, 68, - 73, 67, 85, 76, 65, 82, 128, 80, 69, 82, 80, 69, 78, 68, 73, 67, 85, 76, - 65, 210, 80, 69, 82, 77, 65, 78, 69, 78, 212, 80, 69, 82, 73, 83, 80, 79, - 77, 69, 78, 73, 128, 80, 69, 82, 73, 83, 80, 79, 77, 69, 78, 201, 80, 69, - 82, 70, 69, 67, 84, 85, 205, 80, 69, 82, 70, 69, 67, 84, 65, 128, 80, 69, - 82, 70, 69, 67, 84, 193, 80, 69, 82, 67, 85, 83, 83, 73, 86, 69, 128, 80, - 69, 82, 67, 69, 78, 212, 80, 69, 80, 69, 84, 128, 80, 69, 80, 69, 212, - 80, 69, 79, 82, 84, 200, 80, 69, 78, 84, 65, 83, 69, 77, 69, 128, 80, 69, - 78, 84, 65, 71, 79, 78, 128, 80, 69, 78, 83, 85, 128, 80, 69, 78, 78, - 217, 80, 69, 78, 73, 72, 73, 128, 80, 69, 78, 71, 75, 65, 76, 128, 80, - 69, 78, 69, 84, 82, 65, 84, 73, 79, 78, 128, 80, 69, 78, 67, 73, 76, 128, - 80, 69, 76, 65, 83, 84, 79, 78, 128, 80, 69, 76, 65, 83, 84, 79, 206, 80, - 69, 73, 84, 72, 128, 80, 69, 72, 69, 72, 128, 80, 69, 72, 69, 200, 80, - 69, 72, 128, 80, 69, 200, 80, 69, 69, 90, 73, 128, 80, 69, 69, 80, 128, - 80, 69, 69, 128, 80, 69, 68, 69, 83, 84, 82, 73, 65, 78, 128, 80, 69, 68, - 69, 83, 84, 65, 76, 128, 80, 69, 68, 69, 83, 84, 65, 204, 80, 69, 68, 65, - 204, 80, 69, 65, 67, 69, 128, 80, 69, 65, 67, 197, 80, 68, 128, 80, 67, - 128, 80, 65, 90, 69, 82, 128, 80, 65, 89, 69, 82, 79, 75, 128, 80, 65, - 89, 65, 78, 78, 65, 128, 80, 65, 89, 128, 80, 65, 88, 128, 80, 65, 87, - 78, 128, 80, 65, 215, 80, 65, 86, 73, 89, 65, 78, 73, 128, 80, 65, 84, - 84, 69, 82, 78, 128, 80, 65, 84, 72, 65, 77, 65, 83, 65, 84, 128, 80, 65, - 84, 200, 80, 65, 84, 65, 75, 128, 80, 65, 84, 65, 72, 128, 80, 65, 84, - 128, 80, 65, 83, 85, 81, 128, 80, 65, 83, 83, 73, 86, 69, 45, 80, 85, 76, - 76, 45, 85, 80, 45, 79, 85, 84, 80, 85, 212, 80, 65, 83, 83, 73, 86, 69, - 45, 80, 85, 76, 76, 45, 68, 79, 87, 78, 45, 79, 85, 84, 80, 85, 212, 80, - 65, 83, 72, 84, 65, 128, 80, 65, 83, 69, 81, 128, 80, 65, 82, 84, 78, 69, - 82, 83, 72, 73, 208, 80, 65, 82, 84, 73, 65, 76, 76, 89, 45, 82, 69, 67, - 89, 67, 76, 69, 196, 80, 65, 82, 84, 73, 65, 204, 80, 65, 82, 84, 72, 73, - 65, 206, 80, 65, 82, 212, 80, 65, 82, 73, 67, 72, 79, 78, 128, 80, 65, - 82, 69, 83, 84, 73, 71, 77, 69, 78, 79, 206, 80, 65, 82, 69, 82, 69, 78, - 128, 80, 65, 82, 69, 78, 84, 72, 69, 83, 73, 83, 128, 80, 65, 82, 69, 78, - 84, 72, 69, 83, 73, 211, 80, 65, 82, 65, 80, 72, 82, 65, 83, 197, 80, 65, - 82, 65, 76, 76, 69, 76, 79, 71, 82, 65, 77, 128, 80, 65, 82, 65, 76, 76, - 69, 76, 128, 80, 65, 82, 65, 76, 76, 69, 204, 80, 65, 82, 65, 75, 76, 73, - 84, 73, 75, 73, 128, 80, 65, 82, 65, 75, 76, 73, 84, 73, 75, 201, 80, 65, - 82, 65, 75, 65, 76, 69, 83, 77, 193, 80, 65, 82, 65, 71, 82, 65, 80, 72, - 79, 83, 128, 80, 65, 82, 65, 71, 82, 65, 80, 72, 128, 80, 65, 82, 65, 71, - 82, 65, 80, 200, 80, 65, 82, 65, 128, 80, 65, 82, 128, 80, 65, 80, 89, - 82, 85, 83, 128, 80, 65, 80, 69, 210, 80, 65, 80, 128, 80, 65, 208, 80, - 65, 207, 80, 65, 78, 89, 85, 75, 85, 128, 80, 65, 78, 89, 73, 75, 85, - 128, 80, 65, 78, 89, 69, 67, 69, 75, 128, 80, 65, 78, 89, 65, 78, 71, 71, - 65, 128, 80, 65, 78, 89, 65, 75, 82, 65, 128, 80, 65, 78, 84, 73, 128, - 80, 65, 78, 83, 73, 79, 83, 45, 80, 73, 69, 85, 80, 128, 80, 65, 78, 83, - 73, 79, 83, 45, 75, 65, 80, 89, 69, 79, 85, 78, 80, 73, 69, 85, 80, 128, - 80, 65, 78, 79, 76, 79, 78, 71, 128, 80, 65, 78, 71, 87, 73, 83, 65, 68, - 128, 80, 65, 78, 71, 82, 65, 78, 71, 75, 69, 80, 128, 80, 65, 78, 71, 76, - 65, 89, 65, 82, 128, 80, 65, 78, 71, 75, 79, 78, 128, 80, 65, 78, 71, 75, - 65, 84, 128, 80, 65, 78, 71, 72, 85, 76, 85, 128, 80, 65, 78, 71, 128, - 80, 65, 78, 69, 85, 76, 69, 85, 78, 71, 128, 80, 65, 78, 65, 69, 76, 65, - 69, 78, 71, 128, 80, 65, 78, 128, 80, 65, 77, 85, 78, 71, 75, 65, 72, - 128, 80, 65, 77, 85, 68, 80, 79, 68, 128, 80, 65, 77, 80, 72, 89, 76, 73, - 65, 206, 80, 65, 77, 73, 78, 71, 75, 65, 76, 128, 80, 65, 77, 69, 80, 69, - 84, 128, 80, 65, 77, 69, 78, 69, 78, 71, 128, 80, 65, 77, 65, 68, 65, - 128, 80, 65, 77, 65, 65, 69, 72, 128, 80, 65, 76, 85, 84, 65, 128, 80, - 65, 76, 79, 67, 72, 75, 65, 128, 80, 65, 76, 205, 80, 65, 76, 76, 65, 87, - 65, 128, 80, 65, 76, 76, 65, 83, 128, 80, 65, 76, 65, 85, 78, 199, 80, - 65, 76, 65, 84, 65, 76, 73, 90, 69, 196, 80, 65, 76, 65, 84, 65, 76, 73, - 90, 65, 84, 73, 79, 78, 128, 80, 65, 76, 65, 84, 65, 204, 80, 65, 73, 89, - 65, 78, 78, 79, 73, 128, 80, 65, 73, 82, 84, 72, 82, 65, 128, 80, 65, 73, - 82, 69, 196, 80, 65, 72, 76, 65, 86, 201, 80, 65, 68, 77, 193, 80, 65, - 68, 193, 80, 65, 68, 128, 80, 65, 67, 75, 73, 78, 71, 128, 80, 65, 65, - 84, 85, 128, 80, 65, 65, 83, 69, 78, 84, 79, 128, 80, 65, 65, 73, 128, - 80, 65, 65, 45, 80, 73, 76, 76, 65, 128, 80, 65, 65, 128, 80, 50, 128, - 80, 48, 49, 49, 128, 80, 48, 49, 48, 128, 80, 48, 48, 57, 128, 80, 48, - 48, 56, 128, 80, 48, 48, 55, 128, 80, 48, 48, 54, 128, 80, 48, 48, 53, - 128, 80, 48, 48, 52, 128, 80, 48, 48, 51, 65, 128, 80, 48, 48, 51, 128, - 80, 48, 48, 50, 128, 80, 48, 48, 49, 65, 128, 80, 48, 48, 49, 128, 79, - 89, 82, 65, 78, 73, 83, 77, 193, 79, 89, 65, 78, 78, 65, 128, 79, 88, 73, - 65, 128, 79, 88, 73, 193, 79, 88, 69, 73, 65, 201, 79, 88, 69, 73, 193, - 79, 86, 69, 82, 82, 73, 68, 69, 128, 79, 86, 69, 82, 76, 79, 78, 199, 79, - 86, 69, 82, 76, 73, 78, 69, 128, 79, 86, 69, 82, 76, 65, 89, 128, 79, 86, - 69, 82, 76, 65, 80, 80, 73, 78, 199, 79, 86, 69, 82, 76, 65, 73, 68, 128, - 79, 86, 69, 82, 66, 65, 82, 128, 79, 86, 65, 204, 79, 86, 128, 79, 85, - 84, 76, 73, 78, 69, 196, 79, 85, 84, 76, 73, 78, 69, 128, 79, 85, 84, 69, - 210, 79, 85, 78, 75, 73, 193, 79, 85, 78, 67, 197, 79, 84, 85, 128, 79, - 84, 84, 65, 86, 193, 79, 84, 84, 128, 79, 84, 72, 65, 76, 65, 206, 79, - 84, 72, 65, 76, 128, 79, 83, 77, 65, 78, 89, 193, 79, 82, 84, 72, 79, 71, - 79, 78, 65, 204, 79, 82, 84, 72, 79, 68, 79, 216, 79, 82, 78, 65, 84, - 197, 79, 82, 78, 65, 77, 69, 78, 84, 128, 79, 82, 78, 65, 77, 69, 78, - 212, 79, 82, 75, 72, 79, 206, 79, 82, 73, 71, 73, 78, 65, 204, 79, 82, - 73, 71, 73, 78, 128, 79, 82, 68, 73, 78, 65, 204, 79, 82, 67, 72, 73, 68, - 128, 79, 80, 84, 73, 79, 206, 79, 80, 80, 82, 69, 83, 83, 73, 79, 78, - 128, 79, 80, 80, 79, 83, 73, 84, 73, 79, 78, 128, 79, 80, 80, 79, 83, 73, - 78, 199, 79, 80, 80, 79, 83, 69, 128, 79, 80, 69, 82, 65, 84, 79, 82, - 128, 79, 80, 69, 82, 65, 84, 79, 210, 79, 80, 69, 78, 73, 78, 199, 79, - 80, 69, 78, 45, 80, 128, 79, 80, 69, 78, 45, 79, 85, 84, 76, 73, 78, 69, - 196, 79, 80, 69, 78, 45, 72, 69, 65, 68, 69, 196, 79, 80, 69, 78, 45, 67, - 73, 82, 67, 85, 73, 84, 45, 79, 85, 84, 80, 85, 212, 79, 80, 69, 206, 79, - 79, 90, 69, 128, 79, 79, 89, 65, 78, 78, 65, 128, 79, 79, 85, 128, 79, - 79, 77, 85, 128, 79, 79, 66, 79, 79, 70, 73, 76, 73, 128, 79, 78, 85, - 128, 79, 78, 83, 85, 128, 79, 78, 78, 128, 79, 78, 75, 65, 82, 128, 79, - 78, 69, 83, 69, 76, 70, 128, 79, 78, 69, 45, 87, 65, 217, 79, 78, 69, 45, - 76, 73, 78, 197, 79, 78, 65, 80, 128, 79, 77, 73, 83, 83, 73, 79, 206, - 79, 77, 73, 67, 82, 79, 78, 128, 79, 77, 73, 67, 82, 79, 206, 79, 77, 69, - 71, 65, 128, 79, 77, 69, 71, 193, 79, 77, 65, 76, 79, 78, 128, 79, 77, - 128, 79, 76, 73, 86, 69, 128, 79, 76, 73, 71, 79, 206, 79, 76, 68, 128, - 79, 75, 84, 207, 79, 75, 65, 82, 65, 128, 79, 75, 65, 82, 193, 79, 74, - 73, 66, 87, 65, 217, 79, 74, 69, 79, 78, 128, 79, 73, 76, 128, 79, 72, - 77, 128, 79, 72, 205, 79, 72, 128, 79, 71, 79, 78, 69, 75, 128, 79, 71, - 79, 78, 69, 203, 79, 71, 72, 65, 205, 79, 69, 75, 128, 79, 68, 196, 79, - 67, 84, 79, 66, 69, 82, 128, 79, 67, 210, 79, 67, 67, 76, 85, 83, 73, 79, - 78, 128, 79, 66, 83, 84, 82, 85, 67, 84, 73, 79, 78, 128, 79, 66, 79, 76, - 211, 79, 66, 79, 204, 79, 66, 79, 70, 73, 76, 73, 128, 79, 66, 76, 73, - 81, 85, 197, 79, 66, 74, 69, 67, 212, 79, 66, 69, 76, 85, 83, 128, 79, - 66, 69, 76, 79, 83, 128, 79, 66, 128, 79, 65, 89, 128, 79, 65, 75, 128, - 79, 65, 66, 79, 65, 70, 73, 76, 73, 128, 79, 193, 79, 48, 53, 49, 128, - 79, 48, 53, 48, 66, 128, 79, 48, 53, 48, 65, 128, 79, 48, 53, 48, 128, - 79, 48, 52, 57, 128, 79, 48, 52, 56, 128, 79, 48, 52, 55, 128, 79, 48, - 52, 54, 128, 79, 48, 52, 53, 128, 79, 48, 52, 52, 128, 79, 48, 52, 51, - 128, 79, 48, 52, 50, 128, 79, 48, 52, 49, 128, 79, 48, 52, 48, 128, 79, - 48, 51, 57, 128, 79, 48, 51, 56, 128, 79, 48, 51, 55, 128, 79, 48, 51, - 54, 68, 128, 79, 48, 51, 54, 67, 128, 79, 48, 51, 54, 66, 128, 79, 48, - 51, 54, 65, 128, 79, 48, 51, 54, 128, 79, 48, 51, 53, 128, 79, 48, 51, - 52, 128, 79, 48, 51, 51, 65, 128, 79, 48, 51, 51, 128, 79, 48, 51, 50, - 128, 79, 48, 51, 49, 128, 79, 48, 51, 48, 65, 128, 79, 48, 51, 48, 128, - 79, 48, 50, 57, 65, 128, 79, 48, 50, 57, 128, 79, 48, 50, 56, 128, 79, - 48, 50, 55, 128, 79, 48, 50, 54, 128, 79, 48, 50, 53, 65, 128, 79, 48, - 50, 53, 128, 79, 48, 50, 52, 65, 128, 79, 48, 50, 52, 128, 79, 48, 50, - 51, 128, 79, 48, 50, 50, 128, 79, 48, 50, 49, 128, 79, 48, 50, 48, 65, - 128, 79, 48, 50, 48, 128, 79, 48, 49, 57, 65, 128, 79, 48, 49, 57, 128, - 79, 48, 49, 56, 128, 79, 48, 49, 55, 128, 79, 48, 49, 54, 128, 79, 48, - 49, 53, 128, 79, 48, 49, 52, 128, 79, 48, 49, 51, 128, 79, 48, 49, 50, - 128, 79, 48, 49, 49, 128, 79, 48, 49, 48, 67, 128, 79, 48, 49, 48, 66, - 128, 79, 48, 49, 48, 65, 128, 79, 48, 49, 48, 128, 79, 48, 48, 57, 128, - 79, 48, 48, 56, 128, 79, 48, 48, 55, 128, 79, 48, 48, 54, 70, 128, 79, - 48, 48, 54, 69, 128, 79, 48, 48, 54, 68, 128, 79, 48, 48, 54, 67, 128, - 79, 48, 48, 54, 66, 128, 79, 48, 48, 54, 65, 128, 79, 48, 48, 54, 128, - 79, 48, 48, 53, 65, 128, 79, 48, 48, 53, 128, 79, 48, 48, 52, 128, 79, - 48, 48, 51, 128, 79, 48, 48, 50, 128, 79, 48, 48, 49, 65, 128, 79, 48, - 48, 49, 128, 79, 45, 89, 69, 128, 79, 45, 79, 45, 73, 128, 79, 45, 69, - 128, 78, 90, 89, 88, 128, 78, 90, 89, 84, 128, 78, 90, 89, 82, 88, 128, - 78, 90, 89, 82, 128, 78, 90, 89, 80, 128, 78, 90, 89, 128, 78, 90, 85, - 88, 128, 78, 90, 85, 82, 88, 128, 78, 90, 85, 82, 128, 78, 90, 85, 80, - 128, 78, 90, 85, 79, 88, 128, 78, 90, 85, 79, 128, 78, 90, 85, 128, 78, - 90, 79, 88, 128, 78, 90, 79, 80, 128, 78, 90, 73, 88, 128, 78, 90, 73, - 84, 128, 78, 90, 73, 80, 128, 78, 90, 73, 69, 88, 128, 78, 90, 73, 69, - 80, 128, 78, 90, 73, 69, 128, 78, 90, 73, 128, 78, 90, 69, 88, 128, 78, - 90, 69, 128, 78, 90, 65, 88, 128, 78, 90, 65, 84, 128, 78, 90, 65, 80, - 128, 78, 90, 65, 128, 78, 89, 87, 65, 128, 78, 89, 85, 88, 128, 78, 89, - 85, 84, 128, 78, 89, 85, 80, 128, 78, 89, 85, 79, 88, 128, 78, 89, 85, - 79, 80, 128, 78, 89, 85, 79, 128, 78, 89, 85, 128, 78, 89, 79, 88, 128, - 78, 89, 79, 84, 128, 78, 89, 79, 80, 128, 78, 89, 79, 79, 128, 78, 89, - 79, 65, 128, 78, 89, 79, 128, 78, 89, 74, 65, 128, 78, 89, 73, 88, 128, - 78, 89, 73, 84, 128, 78, 89, 73, 211, 78, 89, 73, 80, 128, 78, 89, 73, - 78, 45, 68, 79, 128, 78, 89, 73, 69, 88, 128, 78, 89, 73, 69, 84, 128, - 78, 89, 73, 69, 80, 128, 78, 89, 73, 69, 128, 78, 89, 73, 128, 78, 89, - 201, 78, 89, 69, 212, 78, 89, 69, 72, 128, 78, 89, 69, 200, 78, 89, 69, - 69, 128, 78, 89, 69, 128, 78, 89, 196, 78, 89, 67, 65, 128, 78, 89, 65, - 65, 128, 78, 87, 79, 79, 128, 78, 87, 79, 128, 78, 87, 73, 73, 128, 78, - 87, 73, 128, 78, 87, 69, 128, 78, 87, 65, 65, 128, 78, 87, 65, 128, 78, - 87, 128, 78, 86, 128, 78, 85, 88, 128, 78, 85, 85, 78, 128, 78, 85, 84, - 73, 76, 76, 85, 128, 78, 85, 84, 128, 78, 85, 82, 88, 128, 78, 85, 82, - 128, 78, 85, 80, 128, 78, 85, 79, 88, 128, 78, 85, 79, 80, 128, 78, 85, - 79, 128, 78, 85, 78, 85, 90, 128, 78, 85, 78, 85, 218, 78, 85, 78, 71, - 128, 78, 85, 78, 65, 86, 85, 212, 78, 85, 78, 65, 86, 73, 203, 78, 85, - 78, 128, 78, 85, 206, 78, 85, 77, 69, 82, 207, 78, 85, 77, 69, 82, 65, - 84, 79, 210, 78, 85, 77, 69, 82, 65, 204, 78, 85, 77, 66, 69, 82, 128, - 78, 85, 77, 128, 78, 85, 76, 76, 128, 78, 85, 76, 204, 78, 85, 75, 84, - 65, 128, 78, 85, 69, 78, 71, 128, 78, 85, 69, 128, 78, 85, 66, 73, 65, - 206, 78, 85, 65, 69, 128, 78, 85, 49, 49, 128, 78, 85, 48, 50, 50, 65, - 128, 78, 85, 48, 50, 50, 128, 78, 85, 48, 50, 49, 128, 78, 85, 48, 50, - 48, 128, 78, 85, 48, 49, 57, 128, 78, 85, 48, 49, 56, 65, 128, 78, 85, - 48, 49, 56, 128, 78, 85, 48, 49, 55, 128, 78, 85, 48, 49, 54, 128, 78, - 85, 48, 49, 53, 128, 78, 85, 48, 49, 52, 128, 78, 85, 48, 49, 51, 128, - 78, 85, 48, 49, 50, 128, 78, 85, 48, 49, 49, 65, 128, 78, 85, 48, 49, 49, - 128, 78, 85, 48, 49, 48, 65, 128, 78, 85, 48, 49, 48, 128, 78, 85, 48, - 48, 57, 128, 78, 85, 48, 48, 56, 128, 78, 85, 48, 48, 55, 128, 78, 85, - 48, 48, 54, 128, 78, 85, 48, 48, 53, 128, 78, 85, 48, 48, 52, 128, 78, - 85, 48, 48, 51, 128, 78, 85, 48, 48, 50, 128, 78, 85, 48, 48, 49, 128, - 78, 84, 85, 85, 128, 78, 84, 69, 69, 128, 78, 83, 72, 65, 128, 78, 82, - 89, 88, 128, 78, 82, 89, 84, 128, 78, 82, 89, 82, 88, 128, 78, 82, 89, - 82, 128, 78, 82, 89, 80, 128, 78, 82, 89, 128, 78, 82, 85, 88, 128, 78, - 82, 85, 84, 128, 78, 82, 85, 82, 88, 128, 78, 82, 85, 82, 128, 78, 82, - 85, 80, 128, 78, 82, 85, 128, 78, 82, 79, 88, 128, 78, 82, 79, 80, 128, - 78, 82, 79, 128, 78, 82, 69, 88, 128, 78, 82, 69, 84, 128, 78, 82, 69, - 80, 128, 78, 82, 69, 128, 78, 82, 65, 88, 128, 78, 82, 65, 84, 128, 78, - 82, 65, 80, 128, 78, 82, 65, 128, 78, 79, 89, 128, 78, 79, 88, 128, 78, - 79, 86, 69, 77, 66, 69, 82, 128, 78, 79, 84, 84, 79, 128, 78, 79, 84, 69, - 83, 128, 78, 79, 84, 69, 72, 69, 65, 68, 128, 78, 79, 84, 69, 72, 69, 65, - 196, 78, 79, 84, 69, 128, 78, 79, 84, 197, 78, 79, 84, 67, 72, 69, 196, - 78, 79, 84, 67, 72, 128, 78, 79, 84, 128, 78, 79, 83, 69, 128, 78, 79, - 82, 84, 72, 87, 69, 83, 212, 78, 79, 82, 84, 200, 78, 79, 82, 77, 65, - 204, 78, 79, 210, 78, 79, 80, 128, 78, 79, 79, 78, 85, 128, 78, 79, 79, - 128, 78, 79, 78, 70, 79, 82, 75, 73, 78, 71, 128, 78, 79, 78, 45, 74, 79, - 73, 78, 69, 82, 128, 78, 79, 78, 45, 66, 82, 69, 65, 75, 73, 78, 199, 78, - 79, 77, 73, 78, 65, 204, 78, 79, 75, 72, 85, 75, 128, 78, 79, 68, 69, - 128, 78, 79, 65, 128, 78, 79, 45, 66, 82, 69, 65, 203, 78, 78, 79, 128, - 78, 78, 78, 65, 128, 78, 78, 71, 79, 79, 128, 78, 78, 71, 79, 128, 78, - 78, 71, 73, 73, 128, 78, 78, 71, 73, 128, 78, 78, 71, 65, 65, 128, 78, - 78, 71, 65, 128, 78, 78, 71, 128, 78, 77, 128, 78, 76, 48, 50, 48, 128, - 78, 76, 48, 49, 57, 128, 78, 76, 48, 49, 56, 128, 78, 76, 48, 49, 55, 65, - 128, 78, 76, 48, 49, 55, 128, 78, 76, 48, 49, 54, 128, 78, 76, 48, 49, - 53, 128, 78, 76, 48, 49, 52, 128, 78, 76, 48, 49, 51, 128, 78, 76, 48, - 49, 50, 128, 78, 76, 48, 49, 49, 128, 78, 76, 48, 49, 48, 128, 78, 76, - 48, 48, 57, 128, 78, 76, 48, 48, 56, 128, 78, 76, 48, 48, 55, 128, 78, - 76, 48, 48, 54, 128, 78, 76, 48, 48, 53, 65, 128, 78, 76, 48, 48, 53, - 128, 78, 76, 48, 48, 52, 128, 78, 76, 48, 48, 51, 128, 78, 76, 48, 48, - 50, 128, 78, 76, 48, 48, 49, 128, 78, 75, 207, 78, 74, 89, 88, 128, 78, - 74, 89, 84, 128, 78, 74, 89, 82, 88, 128, 78, 74, 89, 82, 128, 78, 74, - 89, 80, 128, 78, 74, 89, 128, 78, 74, 85, 88, 128, 78, 74, 85, 82, 88, - 128, 78, 74, 85, 82, 128, 78, 74, 85, 80, 128, 78, 74, 85, 79, 88, 128, - 78, 74, 85, 79, 128, 78, 74, 85, 65, 69, 128, 78, 74, 85, 128, 78, 74, - 79, 88, 128, 78, 74, 79, 84, 128, 78, 74, 79, 80, 128, 78, 74, 79, 79, - 128, 78, 74, 79, 128, 78, 74, 73, 88, 128, 78, 74, 73, 84, 128, 78, 74, - 73, 80, 128, 78, 74, 73, 69, 88, 128, 78, 74, 73, 69, 84, 128, 78, 74, - 73, 69, 80, 128, 78, 74, 73, 69, 128, 78, 74, 73, 128, 78, 74, 69, 69, - 128, 78, 74, 69, 128, 78, 74, 65, 69, 77, 76, 73, 128, 78, 74, 65, 69, - 77, 128, 78, 74, 128, 78, 73, 88, 128, 78, 73, 83, 65, 71, 128, 78, 73, - 82, 85, 71, 85, 128, 78, 73, 80, 128, 78, 73, 78, 84, 72, 128, 78, 73, - 78, 69, 84, 89, 128, 78, 73, 78, 69, 84, 217, 78, 73, 78, 69, 84, 69, 69, - 78, 128, 78, 73, 78, 69, 84, 69, 69, 206, 78, 73, 78, 197, 78, 73, 78, - 68, 65, 50, 128, 78, 73, 78, 68, 65, 178, 78, 73, 77, 128, 78, 73, 205, - 78, 73, 75, 72, 65, 72, 73, 84, 128, 78, 73, 75, 65, 72, 73, 84, 128, 78, - 73, 73, 128, 78, 73, 72, 83, 72, 86, 65, 83, 65, 128, 78, 73, 71, 73, 68, - 65, 77, 73, 78, 128, 78, 73, 71, 73, 68, 65, 69, 83, 72, 128, 78, 73, 71, - 72, 84, 128, 78, 73, 71, 71, 65, 72, 73, 84, 65, 128, 78, 73, 69, 88, - 128, 78, 73, 69, 85, 78, 45, 84, 73, 75, 69, 85, 84, 128, 78, 73, 69, 85, - 78, 45, 84, 72, 73, 69, 85, 84, 72, 128, 78, 73, 69, 85, 78, 45, 83, 73, - 79, 83, 128, 78, 73, 69, 85, 78, 45, 82, 73, 69, 85, 76, 128, 78, 73, 69, - 85, 78, 45, 80, 73, 69, 85, 80, 128, 78, 73, 69, 85, 78, 45, 80, 65, 78, - 83, 73, 79, 83, 128, 78, 73, 69, 85, 78, 45, 75, 73, 89, 69, 79, 75, 128, - 78, 73, 69, 85, 78, 45, 72, 73, 69, 85, 72, 128, 78, 73, 69, 85, 78, 45, - 67, 73, 69, 85, 67, 128, 78, 73, 69, 85, 78, 45, 67, 72, 73, 69, 85, 67, - 72, 128, 78, 73, 69, 85, 206, 78, 73, 69, 80, 128, 78, 73, 69, 128, 78, - 73, 66, 128, 78, 73, 65, 128, 78, 73, 50, 128, 78, 72, 85, 69, 128, 78, - 72, 74, 65, 128, 78, 72, 65, 128, 78, 72, 128, 78, 71, 89, 69, 128, 78, - 71, 86, 69, 128, 78, 71, 85, 79, 88, 128, 78, 71, 85, 79, 84, 128, 78, - 71, 85, 79, 128, 78, 71, 79, 88, 128, 78, 71, 79, 85, 128, 78, 71, 79, - 213, 78, 71, 79, 84, 128, 78, 71, 79, 80, 128, 78, 71, 79, 78, 128, 78, - 71, 79, 69, 72, 128, 78, 71, 79, 69, 200, 78, 71, 207, 78, 71, 75, 87, - 65, 69, 78, 128, 78, 71, 75, 65, 128, 78, 71, 73, 69, 88, 128, 78, 71, - 73, 69, 80, 128, 78, 71, 73, 69, 128, 78, 71, 71, 85, 128, 78, 71, 71, - 79, 79, 128, 78, 71, 71, 79, 128, 78, 71, 71, 73, 128, 78, 71, 71, 69, - 78, 128, 78, 71, 71, 69, 69, 128, 78, 71, 71, 69, 128, 78, 71, 71, 128, - 78, 71, 69, 88, 128, 78, 71, 69, 80, 128, 78, 71, 69, 78, 128, 78, 71, - 69, 65, 68, 65, 76, 128, 78, 71, 69, 128, 78, 71, 65, 88, 128, 78, 71, - 65, 84, 128, 78, 71, 65, 211, 78, 71, 65, 80, 128, 78, 71, 65, 78, 128, - 78, 71, 65, 73, 128, 78, 71, 65, 65, 73, 128, 78, 71, 193, 78, 70, 128, - 78, 69, 88, 212, 78, 69, 88, 128, 78, 69, 87, 76, 73, 78, 69, 128, 78, - 69, 85, 84, 82, 65, 204, 78, 69, 85, 84, 69, 82, 128, 78, 69, 84, 128, - 78, 69, 212, 78, 69, 83, 84, 69, 196, 78, 69, 81, 85, 68, 65, 65, 128, - 78, 69, 80, 84, 85, 78, 69, 128, 78, 69, 80, 128, 78, 69, 79, 128, 78, - 69, 207, 78, 69, 78, 65, 78, 79, 128, 78, 69, 78, 128, 78, 69, 73, 84, - 72, 69, 210, 78, 69, 71, 65, 84, 73, 86, 197, 78, 69, 71, 65, 84, 73, 79, - 206, 78, 69, 71, 65, 84, 69, 196, 78, 69, 69, 128, 78, 69, 66, 69, 78, - 83, 84, 73, 77, 77, 69, 128, 78, 68, 85, 88, 128, 78, 68, 85, 84, 128, - 78, 68, 85, 82, 88, 128, 78, 68, 85, 82, 128, 78, 68, 85, 80, 128, 78, - 68, 79, 88, 128, 78, 68, 79, 84, 128, 78, 68, 79, 80, 128, 78, 68, 79, - 79, 128, 78, 68, 79, 76, 197, 78, 68, 73, 88, 128, 78, 68, 73, 84, 128, - 78, 68, 73, 80, 128, 78, 68, 73, 69, 88, 128, 78, 68, 73, 69, 128, 78, - 68, 73, 128, 78, 68, 69, 88, 128, 78, 68, 69, 80, 128, 78, 68, 69, 69, - 128, 78, 68, 69, 128, 78, 68, 65, 88, 128, 78, 68, 65, 84, 128, 78, 68, - 65, 80, 128, 78, 68, 65, 65, 128, 78, 66, 89, 88, 128, 78, 66, 89, 84, - 128, 78, 66, 89, 82, 88, 128, 78, 66, 89, 82, 128, 78, 66, 89, 80, 128, - 78, 66, 89, 128, 78, 66, 85, 88, 128, 78, 66, 85, 84, 128, 78, 66, 85, - 82, 88, 128, 78, 66, 85, 82, 128, 78, 66, 85, 80, 128, 78, 66, 85, 128, - 78, 66, 79, 88, 128, 78, 66, 79, 84, 128, 78, 66, 79, 80, 128, 78, 66, - 79, 128, 78, 66, 73, 88, 128, 78, 66, 73, 84, 128, 78, 66, 73, 80, 128, - 78, 66, 73, 69, 88, 128, 78, 66, 73, 69, 80, 128, 78, 66, 73, 69, 128, - 78, 66, 73, 128, 78, 66, 65, 88, 128, 78, 66, 65, 84, 128, 78, 66, 65, - 80, 128, 78, 66, 65, 128, 78, 65, 89, 65, 78, 78, 65, 128, 78, 65, 89, - 128, 78, 65, 88, 73, 65, 206, 78, 65, 88, 128, 78, 65, 85, 84, 72, 83, - 128, 78, 65, 85, 68, 73, 218, 78, 65, 84, 85, 82, 65, 204, 78, 65, 84, - 73, 79, 78, 65, 204, 78, 65, 83, 75, 65, 80, 201, 78, 65, 83, 72, 73, - 128, 78, 65, 83, 65, 76, 73, 90, 65, 84, 73, 79, 206, 78, 65, 82, 82, 79, - 215, 78, 65, 82, 128, 78, 65, 79, 211, 78, 65, 78, 71, 77, 79, 78, 84, - 72, 79, 128, 78, 65, 78, 68, 128, 78, 65, 78, 65, 128, 78, 65, 77, 69, - 128, 78, 65, 77, 197, 78, 65, 77, 50, 128, 78, 65, 77, 128, 78, 65, 73, - 82, 193, 78, 65, 71, 82, 201, 78, 65, 71, 65, 82, 128, 78, 65, 71, 65, - 128, 78, 65, 71, 193, 78, 65, 71, 128, 78, 65, 199, 78, 65, 66, 76, 65, - 128, 78, 65, 65, 83, 73, 75, 89, 65, 89, 65, 128, 78, 65, 65, 75, 83, 73, - 75, 89, 65, 89, 65, 128, 78, 65, 65, 73, 128, 78, 65, 65, 128, 78, 65, - 193, 78, 65, 50, 128, 78, 48, 52, 50, 128, 78, 48, 52, 49, 128, 78, 48, - 52, 48, 128, 78, 48, 51, 57, 128, 78, 48, 51, 56, 128, 78, 48, 51, 55, - 65, 128, 78, 48, 51, 55, 128, 78, 48, 51, 54, 128, 78, 48, 51, 53, 65, - 128, 78, 48, 51, 53, 128, 78, 48, 51, 52, 65, 128, 78, 48, 51, 52, 128, - 78, 48, 51, 51, 65, 128, 78, 48, 51, 51, 128, 78, 48, 51, 50, 128, 78, - 48, 51, 49, 128, 78, 48, 51, 48, 128, 78, 48, 50, 57, 128, 78, 48, 50, - 56, 128, 78, 48, 50, 55, 128, 78, 48, 50, 54, 128, 78, 48, 50, 53, 65, - 128, 78, 48, 50, 53, 128, 78, 48, 50, 52, 128, 78, 48, 50, 51, 128, 78, - 48, 50, 50, 128, 78, 48, 50, 49, 128, 78, 48, 50, 48, 128, 78, 48, 49, - 57, 128, 78, 48, 49, 56, 66, 128, 78, 48, 49, 56, 65, 128, 78, 48, 49, - 56, 128, 78, 48, 49, 55, 128, 78, 48, 49, 54, 128, 78, 48, 49, 53, 128, - 78, 48, 49, 52, 128, 78, 48, 49, 51, 128, 78, 48, 49, 50, 128, 78, 48, - 49, 49, 128, 78, 48, 49, 48, 128, 78, 48, 48, 57, 128, 78, 48, 48, 56, - 128, 78, 48, 48, 55, 128, 78, 48, 48, 54, 128, 78, 48, 48, 53, 128, 78, - 48, 48, 52, 128, 78, 48, 48, 51, 128, 78, 48, 48, 50, 128, 78, 48, 48, - 49, 128, 78, 45, 67, 82, 69, 197, 78, 45, 65, 82, 217, 77, 89, 88, 128, - 77, 89, 84, 128, 77, 89, 83, 76, 73, 84, 69, 128, 77, 89, 80, 128, 77, - 89, 65, 128, 77, 89, 193, 77, 89, 128, 77, 87, 79, 79, 128, 77, 87, 79, - 128, 77, 87, 73, 73, 128, 77, 87, 73, 128, 77, 87, 69, 69, 128, 77, 87, - 69, 128, 77, 87, 65, 65, 128, 77, 87, 65, 128, 77, 87, 128, 77, 215, 77, - 86, 128, 77, 214, 77, 85, 88, 128, 77, 85, 85, 83, 73, 75, 65, 84, 79, - 65, 78, 128, 77, 85, 85, 82, 68, 72, 65, 74, 193, 77, 85, 84, 128, 77, - 85, 83, 73, 67, 128, 77, 85, 83, 73, 195, 77, 85, 83, 72, 51, 128, 77, - 85, 83, 72, 179, 77, 85, 83, 72, 128, 77, 85, 83, 200, 77, 85, 82, 88, - 128, 77, 85, 82, 71, 85, 50, 128, 77, 85, 82, 69, 128, 77, 85, 82, 68, - 65, 128, 77, 85, 82, 68, 193, 77, 85, 82, 128, 77, 85, 81, 68, 65, 77, - 128, 77, 85, 80, 128, 77, 85, 79, 88, 128, 77, 85, 79, 84, 128, 77, 85, - 79, 80, 128, 77, 85, 79, 128, 77, 85, 78, 83, 85, 66, 128, 77, 85, 78, - 65, 72, 128, 77, 85, 76, 84, 73, 83, 69, 84, 128, 77, 85, 76, 84, 73, 83, - 69, 212, 77, 85, 76, 84, 73, 80, 76, 73, 67, 65, 84, 73, 79, 78, 128, 77, - 85, 76, 84, 73, 80, 76, 73, 67, 65, 84, 73, 79, 206, 77, 85, 76, 84, 73, - 80, 76, 197, 77, 85, 76, 84, 73, 79, 67, 85, 76, 65, 210, 77, 85, 76, 84, - 73, 77, 65, 80, 128, 77, 85, 76, 84, 201, 77, 85, 75, 80, 72, 82, 69, 78, - 71, 128, 77, 85, 73, 78, 128, 77, 85, 71, 128, 77, 85, 199, 77, 85, 69, - 128, 77, 85, 67, 200, 77, 85, 67, 65, 65, 68, 128, 77, 85, 65, 78, 128, - 77, 85, 45, 71, 65, 65, 72, 76, 65, 193, 77, 213, 77, 83, 128, 77, 80, - 65, 128, 77, 79, 88, 128, 77, 79, 86, 69, 196, 77, 79, 85, 84, 72, 128, - 77, 79, 85, 84, 200, 77, 79, 85, 78, 84, 65, 73, 78, 128, 77, 79, 85, 78, - 68, 128, 77, 79, 85, 78, 196, 77, 79, 84, 72, 69, 82, 128, 77, 79, 84, - 128, 77, 79, 82, 84, 65, 82, 128, 77, 79, 82, 80, 72, 79, 76, 79, 71, 73, - 67, 65, 204, 77, 79, 82, 78, 73, 78, 71, 128, 77, 79, 80, 128, 77, 79, - 79, 83, 69, 45, 67, 82, 69, 197, 77, 79, 79, 78, 128, 77, 79, 79, 206, - 77, 79, 79, 128, 77, 79, 78, 84, 72, 128, 77, 79, 78, 84, 200, 77, 79, - 78, 79, 83, 84, 65, 66, 76, 197, 77, 79, 78, 79, 71, 82, 65, 80, 200, 77, - 79, 78, 79, 71, 82, 65, 77, 77, 79, 211, 77, 79, 78, 79, 71, 82, 65, 205, - 77, 79, 78, 79, 70, 79, 78, 73, 65, 83, 128, 77, 79, 78, 79, 67, 85, 76, - 65, 210, 77, 79, 206, 77, 79, 76, 128, 77, 79, 72, 65, 77, 77, 65, 196, - 77, 79, 68, 85, 76, 207, 77, 79, 68, 69, 83, 84, 89, 128, 77, 79, 68, 69, - 76, 83, 128, 77, 79, 68, 69, 76, 128, 77, 79, 65, 128, 77, 207, 77, 78, - 89, 65, 205, 77, 78, 65, 83, 128, 77, 77, 128, 77, 205, 77, 76, 65, 128, - 77, 76, 128, 77, 73, 88, 128, 77, 73, 84, 128, 77, 73, 212, 77, 73, 83, - 82, 65, 128, 77, 73, 82, 73, 66, 65, 65, 82, 85, 128, 77, 73, 82, 73, - 128, 77, 73, 82, 69, 68, 128, 77, 73, 80, 128, 77, 73, 78, 89, 128, 77, - 73, 78, 85, 83, 45, 79, 82, 45, 80, 76, 85, 211, 77, 73, 78, 85, 83, 128, - 77, 73, 78, 73, 83, 84, 69, 82, 128, 77, 73, 78, 73, 77, 65, 128, 77, 73, - 77, 69, 128, 77, 73, 77, 128, 77, 73, 76, 76, 73, 79, 78, 211, 77, 73, - 76, 76, 69, 84, 128, 77, 73, 76, 76, 197, 77, 73, 76, 204, 77, 73, 76, - 128, 77, 73, 75, 85, 82, 79, 78, 128, 77, 73, 75, 82, 79, 206, 77, 73, - 75, 82, 73, 128, 77, 73, 73, 78, 128, 77, 73, 73, 128, 77, 73, 199, 77, - 73, 69, 88, 128, 77, 73, 69, 85, 77, 45, 84, 73, 75, 69, 85, 84, 128, 77, - 73, 69, 85, 77, 45, 83, 83, 65, 78, 71, 83, 73, 79, 83, 128, 77, 73, 69, - 85, 77, 45, 83, 83, 65, 78, 71, 78, 73, 69, 85, 78, 128, 77, 73, 69, 85, - 77, 45, 82, 73, 69, 85, 76, 128, 77, 73, 69, 85, 77, 45, 80, 73, 69, 85, - 80, 45, 83, 73, 79, 83, 128, 77, 73, 69, 85, 77, 45, 80, 73, 69, 85, 80, - 128, 77, 73, 69, 85, 77, 45, 80, 65, 78, 83, 73, 79, 83, 128, 77, 73, 69, - 85, 77, 45, 78, 73, 69, 85, 78, 128, 77, 73, 69, 85, 77, 45, 67, 73, 69, - 85, 67, 128, 77, 73, 69, 85, 77, 45, 67, 72, 73, 69, 85, 67, 72, 128, 77, - 73, 69, 85, 205, 77, 73, 69, 80, 128, 77, 73, 69, 128, 77, 73, 68, 76, - 73, 78, 197, 77, 73, 68, 68, 76, 69, 45, 87, 69, 76, 83, 200, 77, 73, 68, - 68, 76, 197, 77, 73, 196, 77, 73, 67, 82, 207, 77, 73, 128, 77, 72, 90, - 128, 77, 72, 128, 77, 71, 85, 88, 128, 77, 71, 85, 84, 128, 77, 71, 85, - 82, 88, 128, 77, 71, 85, 82, 128, 77, 71, 85, 80, 128, 77, 71, 85, 79, - 88, 128, 77, 71, 85, 79, 80, 128, 77, 71, 85, 79, 128, 77, 71, 85, 128, - 77, 71, 79, 88, 128, 77, 71, 79, 84, 128, 77, 71, 79, 80, 128, 77, 71, - 79, 128, 77, 71, 207, 77, 71, 73, 69, 88, 128, 77, 71, 73, 69, 128, 77, - 71, 69, 88, 128, 77, 71, 69, 80, 128, 77, 71, 69, 128, 77, 71, 66, 85, - 128, 77, 71, 66, 79, 79, 128, 77, 71, 66, 79, 128, 77, 71, 66, 73, 128, - 77, 71, 66, 69, 69, 128, 77, 71, 66, 69, 128, 77, 71, 66, 65, 128, 77, - 71, 65, 88, 128, 77, 71, 65, 84, 128, 77, 71, 65, 80, 128, 77, 71, 65, - 128, 77, 71, 128, 77, 69, 90, 90, 79, 128, 77, 69, 88, 128, 77, 69, 84, - 82, 73, 67, 65, 204, 77, 69, 84, 82, 73, 65, 128, 77, 69, 84, 82, 69, 84, - 69, 211, 77, 69, 84, 79, 66, 69, 76, 85, 83, 128, 77, 69, 84, 69, 71, - 128, 77, 69, 84, 65, 76, 128, 77, 69, 84, 193, 77, 69, 83, 83, 69, 78, - 73, 65, 206, 77, 69, 83, 79, 128, 77, 69, 83, 73, 128, 77, 69, 83, 72, - 128, 77, 69, 82, 75, 72, 65, 128, 77, 69, 82, 75, 72, 193, 77, 69, 82, - 73, 128, 77, 69, 82, 71, 69, 128, 77, 69, 82, 67, 85, 82, 89, 128, 77, - 69, 78, 68, 85, 84, 128, 77, 69, 78, 128, 77, 69, 206, 77, 69, 77, 66, - 69, 82, 83, 72, 73, 80, 128, 77, 69, 77, 66, 69, 82, 128, 77, 69, 77, 66, - 69, 210, 77, 69, 77, 45, 81, 79, 80, 72, 128, 77, 69, 77, 128, 77, 69, - 205, 77, 69, 76, 79, 78, 128, 77, 69, 76, 79, 68, 73, 195, 77, 69, 76, - 73, 75, 128, 77, 69, 73, 90, 73, 128, 77, 69, 71, 65, 84, 79, 78, 128, - 77, 69, 71, 65, 76, 73, 128, 77, 69, 69, 84, 79, 82, 85, 128, 77, 69, 69, - 84, 69, 201, 77, 69, 69, 84, 128, 77, 69, 69, 77, 85, 128, 77, 69, 69, - 77, 128, 77, 69, 69, 69, 69, 128, 77, 69, 69, 128, 77, 69, 68, 73, 85, - 77, 128, 77, 69, 68, 73, 85, 205, 77, 69, 68, 73, 67, 73, 78, 69, 128, - 77, 69, 65, 84, 128, 77, 69, 65, 83, 85, 82, 69, 196, 77, 69, 65, 83, 85, - 82, 69, 128, 77, 69, 65, 83, 85, 82, 197, 77, 68, 85, 206, 77, 67, 72, - 213, 77, 66, 85, 128, 77, 66, 79, 79, 128, 77, 66, 79, 128, 77, 66, 73, - 128, 77, 66, 69, 78, 128, 77, 66, 69, 69, 128, 77, 66, 69, 128, 77, 66, - 65, 65, 128, 77, 66, 52, 128, 77, 66, 51, 128, 77, 66, 50, 128, 77, 66, - 128, 77, 194, 77, 65, 89, 69, 203, 77, 65, 89, 65, 78, 78, 65, 128, 77, - 65, 89, 128, 77, 65, 88, 73, 77, 65, 128, 77, 65, 88, 128, 77, 65, 84, - 84, 79, 67, 75, 128, 77, 65, 84, 82, 73, 88, 128, 77, 65, 84, 69, 82, 73, - 65, 76, 83, 128, 77, 65, 84, 128, 77, 65, 83, 213, 77, 65, 83, 83, 73, - 78, 71, 128, 77, 65, 83, 79, 82, 193, 77, 65, 83, 72, 70, 65, 65, 84, - 128, 77, 65, 83, 72, 50, 128, 77, 65, 83, 67, 85, 76, 73, 78, 197, 77, - 65, 82, 85, 75, 85, 128, 77, 65, 82, 84, 89, 82, 73, 193, 77, 65, 82, 82, - 89, 73, 78, 199, 77, 65, 82, 82, 73, 65, 71, 197, 77, 65, 82, 75, 69, 82, - 128, 77, 65, 82, 75, 45, 52, 128, 77, 65, 82, 75, 45, 51, 128, 77, 65, - 82, 75, 45, 50, 128, 77, 65, 82, 75, 45, 49, 128, 77, 65, 82, 69, 128, - 77, 65, 82, 67, 72, 128, 77, 65, 82, 67, 65, 84, 79, 45, 83, 84, 65, 67, - 67, 65, 84, 79, 128, 77, 65, 82, 67, 65, 84, 79, 128, 77, 65, 82, 66, 85, - 84, 65, 128, 77, 65, 82, 66, 85, 84, 193, 77, 65, 82, 128, 77, 65, 81, - 65, 70, 128, 77, 65, 80, 73, 81, 128, 77, 65, 208, 77, 65, 78, 83, 89, - 79, 78, 128, 77, 65, 78, 78, 65, 218, 77, 65, 78, 78, 65, 128, 77, 65, - 78, 71, 65, 76, 65, 77, 128, 77, 65, 78, 67, 72, 213, 77, 65, 78, 65, 67, - 76, 69, 83, 128, 77, 65, 76, 84, 69, 83, 197, 77, 65, 76, 69, 128, 77, - 65, 76, 197, 77, 65, 76, 65, 75, 79, 206, 77, 65, 75, 83, 85, 82, 65, - 128, 77, 65, 73, 89, 65, 77, 79, 75, 128, 77, 65, 73, 84, 65, 73, 75, 72, - 85, 128, 77, 65, 73, 82, 85, 128, 77, 65, 73, 77, 85, 65, 78, 128, 77, - 65, 73, 77, 65, 76, 65, 73, 128, 77, 65, 73, 75, 85, 82, 79, 128, 77, 65, - 73, 68, 69, 78, 128, 77, 65, 72, 74, 79, 78, 199, 77, 65, 72, 72, 65, - 128, 77, 65, 72, 65, 80, 82, 65, 78, 65, 128, 77, 65, 72, 65, 80, 65, 75, - 72, 128, 77, 65, 72, 65, 65, 80, 82, 65, 65, 78, 193, 77, 65, 72, 128, - 77, 65, 68, 89, 65, 128, 77, 65, 68, 85, 128, 77, 65, 68, 68, 65, 200, - 77, 65, 68, 68, 65, 128, 77, 65, 68, 68, 193, 77, 65, 67, 82, 79, 78, 45, - 71, 82, 65, 86, 69, 128, 77, 65, 67, 82, 79, 78, 45, 66, 82, 69, 86, 69, - 128, 77, 65, 67, 82, 79, 78, 45, 65, 67, 85, 84, 69, 128, 77, 65, 67, 82, - 79, 78, 128, 77, 65, 67, 82, 79, 206, 77, 65, 65, 73, 128, 77, 65, 65, - 128, 77, 65, 50, 128, 77, 48, 52, 52, 128, 77, 48, 52, 51, 128, 77, 48, - 52, 50, 128, 77, 48, 52, 49, 128, 77, 48, 52, 48, 65, 128, 77, 48, 52, - 48, 128, 77, 48, 51, 57, 128, 77, 48, 51, 56, 128, 77, 48, 51, 55, 128, - 77, 48, 51, 54, 128, 77, 48, 51, 53, 128, 77, 48, 51, 52, 128, 77, 48, - 51, 51, 66, 128, 77, 48, 51, 51, 65, 128, 77, 48, 51, 51, 128, 77, 48, - 51, 50, 128, 77, 48, 51, 49, 65, 128, 77, 48, 51, 49, 128, 77, 48, 51, - 48, 128, 77, 48, 50, 57, 128, 77, 48, 50, 56, 65, 128, 77, 48, 50, 56, - 128, 77, 48, 50, 55, 128, 77, 48, 50, 54, 128, 77, 48, 50, 53, 128, 77, - 48, 50, 52, 65, 128, 77, 48, 50, 52, 128, 77, 48, 50, 51, 128, 77, 48, - 50, 50, 65, 128, 77, 48, 50, 50, 128, 77, 48, 50, 49, 128, 77, 48, 50, - 48, 128, 77, 48, 49, 57, 128, 77, 48, 49, 56, 128, 77, 48, 49, 55, 65, - 128, 77, 48, 49, 55, 128, 77, 48, 49, 54, 65, 128, 77, 48, 49, 54, 128, - 77, 48, 49, 53, 65, 128, 77, 48, 49, 53, 128, 77, 48, 49, 52, 128, 77, - 48, 49, 51, 128, 77, 48, 49, 50, 72, 128, 77, 48, 49, 50, 71, 128, 77, - 48, 49, 50, 70, 128, 77, 48, 49, 50, 69, 128, 77, 48, 49, 50, 68, 128, - 77, 48, 49, 50, 67, 128, 77, 48, 49, 50, 66, 128, 77, 48, 49, 50, 65, - 128, 77, 48, 49, 50, 128, 77, 48, 49, 49, 128, 77, 48, 49, 48, 65, 128, - 77, 48, 49, 48, 128, 77, 48, 48, 57, 128, 77, 48, 48, 56, 128, 77, 48, - 48, 55, 128, 77, 48, 48, 54, 128, 77, 48, 48, 53, 128, 77, 48, 48, 52, - 128, 77, 48, 48, 51, 65, 128, 77, 48, 48, 51, 128, 77, 48, 48, 50, 128, - 77, 48, 48, 49, 66, 128, 77, 48, 48, 49, 65, 128, 77, 48, 48, 49, 128, - 76, 218, 76, 89, 89, 128, 76, 89, 88, 128, 76, 89, 84, 128, 76, 89, 82, - 88, 128, 76, 89, 82, 128, 76, 89, 80, 128, 76, 89, 68, 73, 65, 206, 76, - 89, 67, 73, 65, 206, 76, 88, 128, 76, 87, 79, 79, 128, 76, 87, 79, 128, - 76, 87, 73, 73, 128, 76, 87, 73, 128, 76, 87, 69, 128, 76, 87, 65, 65, - 128, 76, 87, 65, 128, 76, 85, 88, 128, 76, 85, 84, 128, 76, 85, 82, 88, - 128, 76, 85, 80, 128, 76, 85, 79, 88, 128, 76, 85, 79, 84, 128, 76, 85, - 79, 80, 128, 76, 85, 79, 128, 76, 85, 78, 71, 83, 73, 128, 76, 85, 78, - 65, 84, 197, 76, 85, 205, 76, 85, 76, 128, 76, 85, 73, 83, 128, 76, 85, - 72, 85, 82, 128, 76, 85, 72, 128, 76, 85, 71, 65, 76, 128, 76, 85, 71, - 65, 204, 76, 85, 69, 128, 76, 85, 51, 128, 76, 85, 50, 128, 76, 85, 178, - 76, 79, 90, 69, 78, 71, 69, 128, 76, 79, 90, 69, 78, 71, 197, 76, 79, 88, - 128, 76, 79, 87, 69, 210, 76, 79, 87, 45, 185, 76, 79, 85, 82, 69, 128, - 76, 79, 84, 85, 83, 128, 76, 79, 84, 128, 76, 79, 82, 82, 65, 73, 78, 69, - 128, 76, 79, 81, 128, 76, 79, 80, 128, 76, 79, 79, 84, 128, 76, 79, 79, - 80, 128, 76, 79, 79, 128, 76, 79, 78, 83, 85, 77, 128, 76, 79, 78, 71, - 65, 128, 76, 79, 78, 71, 193, 76, 79, 78, 71, 45, 66, 82, 65, 78, 67, 72, - 45, 89, 82, 128, 76, 79, 78, 71, 45, 66, 82, 65, 78, 67, 72, 45, 83, 79, - 204, 76, 79, 78, 71, 45, 66, 82, 65, 78, 67, 72, 45, 79, 83, 211, 76, 79, - 78, 71, 45, 66, 82, 65, 78, 67, 72, 45, 77, 65, 68, 210, 76, 79, 78, 71, - 45, 66, 82, 65, 78, 67, 72, 45, 72, 65, 71, 65, 76, 204, 76, 79, 78, 71, - 45, 66, 82, 65, 78, 67, 72, 45, 65, 210, 76, 79, 76, 76, 128, 76, 79, 71, - 210, 76, 79, 71, 79, 84, 89, 80, 197, 76, 79, 71, 79, 71, 82, 65, 205, - 76, 79, 71, 128, 76, 79, 67, 65, 84, 73, 86, 69, 128, 76, 79, 67, 65, 84, - 73, 79, 206, 76, 79, 65, 128, 76, 78, 128, 76, 77, 128, 76, 76, 76, 65, - 128, 76, 74, 85, 68, 73, 74, 69, 128, 76, 74, 69, 128, 76, 74, 128, 76, - 73, 88, 128, 76, 73, 87, 78, 128, 76, 73, 86, 82, 197, 76, 73, 84, 84, - 76, 197, 76, 73, 84, 82, 193, 76, 73, 84, 128, 76, 73, 83, 213, 76, 73, - 83, 72, 128, 76, 73, 82, 193, 76, 73, 81, 85, 73, 196, 76, 73, 80, 128, - 76, 73, 78, 75, 73, 78, 199, 76, 73, 78, 203, 76, 73, 78, 71, 83, 65, - 128, 76, 73, 78, 69, 83, 128, 76, 73, 78, 69, 211, 76, 73, 78, 69, 45, - 57, 128, 76, 73, 78, 69, 45, 55, 128, 76, 73, 78, 69, 45, 51, 128, 76, - 73, 78, 69, 45, 49, 128, 76, 73, 77, 77, 85, 52, 128, 76, 73, 77, 77, 85, - 50, 128, 76, 73, 77, 77, 85, 128, 76, 73, 77, 77, 213, 76, 73, 77, 73, - 84, 69, 196, 76, 73, 77, 73, 84, 65, 84, 73, 79, 78, 128, 76, 73, 77, 73, - 84, 128, 76, 73, 76, 89, 128, 76, 73, 76, 73, 84, 72, 128, 76, 73, 76, - 128, 76, 73, 73, 128, 76, 73, 71, 72, 84, 78, 73, 78, 71, 128, 76, 73, - 71, 72, 84, 72, 79, 85, 83, 69, 128, 76, 73, 71, 72, 84, 128, 76, 73, 70, - 69, 128, 76, 73, 69, 88, 128, 76, 73, 69, 84, 128, 76, 73, 69, 80, 128, - 76, 73, 69, 128, 76, 73, 68, 128, 76, 73, 66, 82, 65, 128, 76, 73, 65, - 66, 73, 76, 73, 84, 217, 76, 72, 73, 73, 128, 76, 72, 65, 86, 73, 89, 65, - 78, 73, 128, 76, 72, 65, 199, 76, 72, 65, 65, 128, 76, 72, 128, 76, 69, - 90, 72, 128, 76, 69, 88, 128, 76, 69, 86, 69, 204, 76, 69, 84, 84, 69, - 82, 128, 76, 69, 83, 83, 69, 210, 76, 69, 83, 83, 45, 84, 72, 65, 78, - 128, 76, 69, 83, 83, 45, 84, 72, 65, 206, 76, 69, 80, 128, 76, 69, 79, - 128, 76, 69, 78, 84, 73, 67, 85, 76, 65, 210, 76, 69, 78, 73, 83, 128, - 76, 69, 78, 71, 84, 72, 69, 78, 69, 82, 128, 76, 69, 78, 71, 84, 200, 76, - 69, 78, 71, 65, 128, 76, 69, 78, 71, 193, 76, 69, 77, 79, 73, 128, 76, - 69, 76, 69, 84, 128, 76, 69, 76, 69, 212, 76, 69, 203, 76, 69, 73, 77, - 77, 65, 128, 76, 69, 73, 77, 77, 193, 76, 69, 71, 83, 128, 76, 69, 71, - 73, 79, 78, 128, 76, 69, 71, 69, 84, 79, 211, 76, 69, 71, 128, 76, 69, - 70, 84, 87, 65, 82, 68, 83, 128, 76, 69, 70, 84, 45, 84, 79, 45, 82, 73, - 71, 72, 212, 76, 69, 70, 84, 45, 83, 84, 69, 205, 76, 69, 70, 84, 45, 83, - 73, 68, 197, 76, 69, 70, 84, 45, 83, 72, 65, 68, 69, 196, 76, 69, 70, 84, - 45, 80, 79, 73, 78, 84, 73, 78, 199, 76, 69, 70, 84, 45, 72, 65, 78, 196, - 76, 69, 70, 84, 45, 70, 65, 67, 73, 78, 199, 76, 69, 70, 84, 128, 76, 69, - 69, 75, 128, 76, 69, 69, 69, 69, 128, 76, 69, 65, 84, 72, 69, 82, 128, - 76, 69, 65, 70, 128, 76, 69, 65, 68, 69, 82, 128, 76, 68, 65, 78, 128, - 76, 68, 50, 128, 76, 67, 201, 76, 67, 197, 76, 65, 90, 217, 76, 65, 89, - 65, 78, 78, 65, 128, 76, 65, 88, 128, 76, 65, 215, 76, 65, 85, 76, 65, - 128, 76, 65, 85, 75, 65, 218, 76, 65, 84, 73, 78, 65, 84, 197, 76, 65, - 84, 73, 75, 128, 76, 65, 84, 69, 82, 65, 204, 76, 65, 84, 197, 76, 65, - 84, 128, 76, 65, 83, 212, 76, 65, 82, 89, 78, 71, 69, 65, 204, 76, 65, - 82, 71, 69, 210, 76, 65, 82, 71, 197, 76, 65, 80, 128, 76, 65, 78, 71, - 85, 65, 71, 197, 76, 65, 78, 69, 83, 128, 76, 65, 77, 69, 68, 72, 128, - 76, 65, 77, 69, 68, 128, 76, 65, 77, 69, 196, 76, 65, 77, 69, 128, 76, - 65, 77, 197, 76, 65, 77, 68, 65, 128, 76, 65, 77, 68, 128, 76, 65, 77, - 66, 68, 193, 76, 65, 77, 65, 68, 72, 128, 76, 65, 76, 128, 76, 65, 204, - 76, 65, 75, 75, 72, 65, 78, 71, 89, 65, 79, 128, 76, 65, 74, 65, 78, 89, - 65, 76, 65, 78, 128, 76, 65, 201, 76, 65, 72, 83, 72, 85, 128, 76, 65, - 71, 85, 83, 128, 76, 65, 71, 213, 76, 65, 71, 65, 82, 128, 76, 65, 71, - 65, 210, 76, 65, 71, 65, 66, 128, 76, 65, 71, 65, 194, 76, 65, 69, 86, - 128, 76, 65, 69, 128, 76, 65, 67, 75, 128, 76, 65, 67, 65, 128, 76, 65, - 66, 79, 85, 82, 73, 78, 71, 128, 76, 65, 66, 79, 82, 128, 76, 65, 66, 73, - 65, 76, 73, 90, 65, 84, 73, 79, 206, 76, 65, 66, 65, 84, 128, 76, 65, 65, - 78, 128, 76, 65, 65, 77, 85, 128, 76, 65, 65, 73, 128, 76, 48, 48, 54, - 65, 128, 76, 48, 48, 50, 65, 128, 76, 45, 84, 89, 80, 197, 76, 45, 83, - 72, 65, 80, 69, 196, 75, 89, 85, 82, 73, 73, 128, 75, 89, 85, 128, 75, - 89, 79, 128, 75, 89, 76, 73, 83, 77, 65, 128, 75, 89, 73, 128, 75, 89, - 69, 69, 128, 75, 89, 69, 128, 75, 89, 65, 84, 72, 79, 211, 75, 89, 65, - 65, 128, 75, 89, 65, 128, 75, 88, 87, 73, 128, 75, 88, 87, 69, 69, 128, - 75, 88, 87, 69, 128, 75, 88, 87, 65, 65, 128, 75, 88, 87, 65, 128, 75, - 88, 85, 128, 75, 88, 79, 128, 75, 88, 73, 128, 75, 88, 69, 69, 128, 75, - 88, 69, 128, 75, 88, 65, 65, 128, 75, 88, 65, 128, 75, 87, 85, 51, 49, - 56, 128, 75, 87, 79, 79, 128, 75, 87, 79, 128, 75, 87, 73, 73, 128, 75, - 87, 73, 128, 75, 87, 69, 69, 128, 75, 87, 69, 128, 75, 87, 65, 89, 128, - 75, 87, 65, 65, 128, 75, 86, 65, 128, 75, 86, 128, 75, 85, 88, 128, 75, - 85, 85, 72, 128, 75, 85, 84, 128, 75, 85, 83, 77, 65, 128, 75, 85, 83, - 72, 85, 50, 128, 75, 85, 82, 88, 128, 75, 85, 82, 85, 90, 69, 73, 82, 79, - 128, 75, 85, 82, 84, 128, 75, 85, 82, 79, 79, 78, 69, 128, 75, 85, 82, - 128, 75, 85, 210, 75, 85, 80, 128, 75, 85, 79, 88, 128, 75, 85, 79, 80, - 128, 75, 85, 79, 128, 75, 85, 78, 71, 128, 75, 85, 78, 68, 68, 65, 76, - 73, 89, 65, 128, 75, 85, 76, 128, 75, 85, 204, 75, 85, 55, 128, 75, 85, - 52, 128, 75, 85, 180, 75, 85, 51, 128, 75, 85, 179, 75, 84, 128, 75, 83, - 83, 65, 128, 75, 83, 73, 128, 75, 82, 69, 77, 65, 83, 84, 73, 128, 75, - 82, 65, 84, 73, 77, 79, 89, 80, 79, 82, 82, 79, 79, 78, 128, 75, 82, 65, - 84, 73, 77, 79, 75, 79, 85, 70, 73, 83, 77, 65, 128, 75, 82, 65, 84, 73, - 77, 65, 84, 65, 128, 75, 82, 65, 84, 73, 77, 193, 75, 80, 85, 128, 75, - 80, 79, 79, 128, 75, 80, 79, 128, 75, 80, 73, 128, 75, 80, 69, 78, 128, - 75, 80, 69, 69, 128, 75, 80, 69, 128, 75, 80, 65, 78, 128, 75, 80, 65, - 128, 75, 79, 88, 128, 75, 79, 86, 85, 85, 128, 75, 79, 84, 79, 128, 75, - 79, 82, 85, 78, 65, 128, 75, 79, 82, 79, 78, 73, 83, 128, 75, 79, 82, 69, - 65, 206, 75, 79, 82, 65, 78, 73, 195, 75, 79, 81, 78, 68, 79, 78, 128, - 75, 79, 80, 80, 65, 128, 75, 79, 80, 128, 75, 79, 79, 80, 79, 128, 75, - 79, 79, 77, 85, 85, 84, 128, 75, 79, 79, 128, 75, 79, 78, 84, 69, 86, 77, - 65, 128, 75, 79, 78, 84, 69, 86, 77, 193, 75, 79, 77, 201, 75, 79, 77, - 66, 85, 86, 65, 128, 75, 79, 77, 66, 85, 86, 193, 75, 79, 77, 66, 213, - 75, 79, 75, 128, 75, 79, 203, 75, 79, 73, 128, 75, 79, 201, 75, 79, 72, - 128, 75, 79, 71, 72, 79, 77, 128, 75, 79, 69, 84, 128, 75, 79, 65, 128, - 75, 78, 73, 71, 72, 84, 128, 75, 78, 73, 70, 69, 128, 75, 78, 73, 70, - 197, 75, 77, 128, 75, 205, 75, 76, 73, 84, 79, 78, 128, 75, 76, 65, 83, - 77, 65, 128, 75, 76, 65, 83, 77, 193, 75, 76, 65, 128, 75, 76, 128, 75, - 75, 85, 128, 75, 75, 79, 128, 75, 75, 73, 128, 75, 75, 69, 69, 128, 75, - 75, 69, 128, 75, 75, 65, 128, 75, 75, 128, 75, 74, 69, 128, 75, 73, 89, - 69, 79, 75, 45, 84, 73, 75, 69, 85, 84, 128, 75, 73, 89, 69, 79, 75, 45, - 83, 73, 79, 83, 45, 75, 73, 89, 69, 79, 75, 128, 75, 73, 89, 69, 79, 75, - 45, 82, 73, 69, 85, 76, 128, 75, 73, 89, 69, 79, 75, 45, 80, 73, 69, 85, - 80, 128, 75, 73, 89, 69, 79, 75, 45, 78, 73, 69, 85, 78, 128, 75, 73, 89, - 69, 79, 75, 45, 75, 72, 73, 69, 85, 75, 72, 128, 75, 73, 89, 69, 79, 75, - 45, 67, 72, 73, 69, 85, 67, 72, 128, 75, 73, 89, 69, 79, 203, 75, 73, 88, - 128, 75, 73, 84, 128, 75, 73, 83, 73, 77, 53, 128, 75, 73, 83, 73, 77, - 181, 75, 73, 83, 72, 128, 75, 73, 83, 65, 76, 128, 75, 73, 82, 79, 87, - 65, 84, 84, 79, 128, 75, 73, 82, 79, 77, 69, 69, 84, 79, 82, 85, 128, 75, - 73, 82, 79, 71, 85, 82, 65, 77, 85, 128, 75, 73, 82, 79, 128, 75, 73, 82, - 71, 72, 73, 218, 75, 73, 80, 128, 75, 73, 208, 75, 73, 78, 83, 72, 73, - 80, 128, 75, 73, 78, 68, 69, 82, 71, 65, 82, 84, 69, 78, 128, 75, 73, 73, - 128, 75, 73, 72, 128, 75, 73, 69, 88, 128, 75, 73, 69, 80, 128, 75, 73, - 69, 128, 75, 73, 68, 128, 75, 73, 196, 75, 73, 67, 75, 128, 75, 72, 90, - 128, 75, 72, 87, 65, 73, 128, 75, 72, 85, 69, 78, 45, 76, 85, 197, 75, - 72, 85, 69, 206, 75, 72, 85, 65, 84, 128, 75, 72, 79, 85, 128, 75, 72, - 79, 212, 75, 72, 79, 78, 128, 75, 72, 79, 77, 85, 84, 128, 75, 72, 79, - 128, 75, 72, 207, 75, 72, 73, 84, 128, 75, 72, 73, 69, 85, 75, 200, 75, - 72, 73, 128, 75, 72, 72, 79, 128, 75, 72, 72, 65, 128, 75, 72, 69, 84, - 72, 128, 75, 72, 69, 73, 128, 75, 72, 69, 69, 128, 75, 72, 69, 128, 75, - 72, 65, 82, 128, 75, 72, 65, 80, 72, 128, 75, 72, 65, 78, 199, 75, 72, - 65, 78, 68, 193, 75, 72, 65, 78, 128, 75, 72, 65, 77, 84, 201, 75, 72, - 65, 75, 65, 83, 83, 73, 65, 206, 75, 72, 65, 73, 128, 75, 72, 65, 72, - 128, 75, 72, 65, 200, 75, 72, 65, 65, 128, 75, 71, 128, 75, 69, 89, 67, - 65, 80, 128, 75, 69, 89, 66, 79, 65, 82, 68, 128, 75, 69, 89, 128, 75, - 69, 217, 75, 69, 88, 128, 75, 69, 85, 88, 128, 75, 69, 84, 84, 201, 75, - 69, 83, 72, 50, 128, 75, 69, 82, 69, 84, 128, 75, 69, 79, 87, 128, 75, - 69, 78, 84, 73, 77, 65, 84, 65, 128, 75, 69, 78, 84, 73, 77, 65, 84, 193, - 75, 69, 78, 84, 73, 77, 193, 75, 69, 78, 65, 84, 128, 75, 69, 78, 128, - 75, 69, 77, 80, 85, 76, 128, 75, 69, 77, 80, 85, 204, 75, 69, 77, 80, 76, - 73, 128, 75, 69, 77, 80, 76, 201, 75, 69, 77, 80, 72, 82, 69, 78, 71, - 128, 75, 69, 77, 66, 65, 78, 71, 128, 75, 69, 76, 86, 73, 206, 75, 69, - 72, 69, 72, 128, 75, 69, 72, 69, 200, 75, 69, 72, 128, 75, 69, 70, 85, - 76, 65, 128, 75, 69, 69, 83, 85, 128, 75, 69, 69, 80, 73, 78, 199, 75, - 69, 69, 78, 71, 128, 75, 67, 65, 76, 128, 75, 66, 128, 75, 65, 90, 65, - 75, 200, 75, 65, 89, 65, 78, 78, 65, 128, 75, 65, 89, 65, 200, 75, 65, - 88, 128, 75, 65, 87, 73, 128, 75, 65, 86, 89, 75, 65, 128, 75, 65, 85, - 78, 65, 128, 75, 65, 85, 206, 75, 65, 84, 79, 128, 75, 65, 84, 72, 73, - 83, 84, 73, 128, 75, 65, 84, 72, 65, 75, 193, 75, 65, 84, 65, 86, 65, 83, - 77, 65, 128, 75, 65, 84, 65, 86, 193, 75, 65, 84, 65, 75, 65, 78, 65, 45, - 72, 73, 82, 65, 71, 65, 78, 193, 75, 65, 83, 82, 65, 84, 65, 78, 128, 75, - 65, 83, 82, 65, 84, 65, 206, 75, 65, 83, 82, 65, 128, 75, 65, 83, 82, - 193, 75, 65, 83, 75, 65, 76, 128, 75, 65, 83, 75, 65, 204, 75, 65, 83, - 72, 77, 73, 82, 201, 75, 65, 82, 83, 72, 65, 78, 65, 128, 75, 65, 82, 79, - 82, 73, 73, 128, 75, 65, 82, 69, 206, 75, 65, 82, 65, 84, 84, 79, 128, - 75, 65, 82, 65, 78, 128, 75, 65, 80, 89, 69, 79, 85, 78, 83, 83, 65, 78, - 71, 80, 73, 69, 85, 80, 128, 75, 65, 80, 89, 69, 79, 85, 78, 82, 73, 69, - 85, 76, 128, 75, 65, 80, 89, 69, 79, 85, 78, 80, 72, 73, 69, 85, 80, 72, - 128, 75, 65, 80, 89, 69, 79, 85, 78, 77, 73, 69, 85, 77, 128, 75, 65, 80, - 80, 65, 128, 75, 65, 80, 80, 193, 75, 65, 80, 79, 128, 75, 65, 80, 72, - 128, 75, 65, 80, 65, 76, 128, 75, 65, 80, 65, 128, 75, 65, 80, 128, 75, - 65, 78, 84, 65, 74, 193, 75, 65, 78, 71, 128, 75, 65, 78, 199, 75, 65, - 78, 65, 75, 79, 128, 75, 65, 77, 52, 128, 75, 65, 77, 50, 128, 75, 65, - 75, 79, 128, 75, 65, 75, 65, 66, 65, 84, 128, 75, 65, 75, 128, 75, 65, - 203, 75, 65, 73, 82, 73, 128, 75, 65, 73, 128, 75, 65, 201, 75, 65, 70, - 128, 75, 65, 198, 75, 65, 68, 53, 128, 75, 65, 68, 181, 75, 65, 68, 52, - 128, 75, 65, 68, 51, 128, 75, 65, 68, 179, 75, 65, 68, 50, 128, 75, 65, - 66, 193, 75, 65, 66, 128, 75, 65, 65, 73, 128, 75, 65, 65, 70, 85, 128, - 75, 65, 65, 70, 128, 75, 65, 50, 128, 75, 65, 178, 75, 48, 48, 56, 128, - 75, 48, 48, 55, 128, 75, 48, 48, 54, 128, 75, 48, 48, 53, 128, 75, 48, - 48, 52, 128, 75, 48, 48, 51, 128, 75, 48, 48, 50, 128, 75, 48, 48, 49, - 128, 74, 87, 65, 128, 74, 85, 85, 128, 74, 85, 84, 128, 74, 85, 80, 73, - 84, 69, 82, 128, 74, 85, 79, 84, 128, 74, 85, 79, 80, 128, 74, 85, 78, - 79, 128, 74, 85, 78, 69, 128, 74, 85, 76, 89, 128, 74, 85, 69, 85, 73, - 128, 74, 85, 68, 71, 69, 128, 74, 85, 68, 69, 79, 45, 83, 80, 65, 78, 73, - 83, 200, 74, 79, 89, 79, 85, 211, 74, 79, 89, 128, 74, 79, 212, 74, 79, - 78, 71, 128, 74, 79, 78, 193, 74, 79, 75, 69, 82, 128, 74, 79, 73, 78, - 69, 68, 128, 74, 79, 73, 78, 128, 74, 79, 65, 128, 74, 74, 89, 88, 128, - 74, 74, 89, 84, 128, 74, 74, 89, 80, 128, 74, 74, 89, 128, 74, 74, 85, - 88, 128, 74, 74, 85, 84, 128, 74, 74, 85, 82, 88, 128, 74, 74, 85, 82, - 128, 74, 74, 85, 80, 128, 74, 74, 85, 79, 88, 128, 74, 74, 85, 79, 80, - 128, 74, 74, 85, 79, 128, 74, 74, 85, 128, 74, 74, 79, 88, 128, 74, 74, - 79, 84, 128, 74, 74, 79, 80, 128, 74, 74, 79, 128, 74, 74, 73, 88, 128, - 74, 74, 73, 84, 128, 74, 74, 73, 80, 128, 74, 74, 73, 69, 88, 128, 74, - 74, 73, 69, 84, 128, 74, 74, 73, 69, 80, 128, 74, 74, 73, 69, 128, 74, - 74, 73, 128, 74, 74, 69, 69, 128, 74, 74, 69, 128, 74, 74, 65, 128, 74, - 73, 76, 128, 74, 73, 72, 86, 65, 77, 85, 76, 73, 89, 65, 128, 74, 73, 65, - 128, 74, 72, 79, 128, 74, 72, 69, 72, 128, 74, 72, 65, 78, 128, 74, 72, - 65, 77, 128, 74, 72, 65, 128, 74, 69, 85, 128, 74, 69, 82, 85, 83, 65, - 76, 69, 77, 128, 74, 69, 82, 65, 206, 74, 69, 82, 65, 128, 74, 69, 82, - 128, 74, 69, 72, 128, 74, 69, 200, 74, 69, 71, 79, 71, 65, 78, 128, 74, - 69, 69, 77, 128, 74, 65, 89, 65, 78, 78, 65, 128, 74, 65, 86, 73, 89, 65, - 78, 73, 128, 74, 65, 82, 128, 74, 65, 80, 65, 78, 69, 83, 197, 74, 65, - 78, 85, 65, 82, 89, 128, 74, 65, 76, 76, 65, 74, 65, 76, 65, 76, 79, 85, - 72, 79, 85, 128, 74, 65, 68, 69, 128, 74, 65, 65, 128, 74, 45, 83, 73, - 77, 80, 76, 73, 70, 73, 69, 196, 202, 73, 90, 72, 73, 84, 83, 65, 128, - 73, 90, 72, 73, 84, 83, 193, 73, 90, 72, 69, 128, 73, 89, 69, 75, 128, - 73, 89, 65, 78, 78, 65, 128, 73, 85, 74, 65, 128, 73, 85, 128, 73, 84, - 69, 82, 65, 84, 73, 79, 206, 73, 84, 69, 77, 128, 73, 83, 83, 72, 65, 82, - 128, 73, 83, 211, 73, 83, 79, 78, 128, 73, 83, 79, 206, 73, 83, 69, 78, - 45, 73, 83, 69, 78, 128, 73, 83, 65, 75, 73, 193, 73, 83, 45, 80, 73, 76, - 76, 65, 128, 73, 82, 85, 89, 65, 78, 78, 65, 128, 73, 82, 85, 85, 89, 65, - 78, 78, 65, 128, 73, 79, 84, 73, 70, 73, 69, 196, 73, 79, 84, 65, 84, 69, - 196, 73, 79, 84, 65, 128, 73, 79, 84, 193, 73, 79, 82, 128, 73, 79, 68, - 72, 65, 68, 72, 128, 73, 78, 86, 73, 83, 73, 66, 76, 197, 73, 78, 86, 69, - 82, 84, 69, 68, 128, 73, 78, 86, 69, 82, 84, 69, 196, 73, 78, 86, 69, 82, - 83, 197, 73, 78, 84, 73, 128, 73, 78, 84, 69, 82, 83, 89, 76, 76, 65, 66, - 73, 195, 73, 78, 84, 69, 82, 83, 69, 67, 84, 73, 79, 78, 128, 73, 78, 84, - 69, 82, 83, 69, 67, 84, 73, 79, 206, 73, 78, 84, 69, 82, 83, 69, 67, 84, - 73, 78, 199, 73, 78, 84, 69, 82, 82, 79, 66, 65, 78, 71, 128, 73, 78, 84, - 69, 82, 80, 79, 76, 65, 84, 73, 79, 206, 73, 78, 84, 69, 82, 76, 79, 67, - 75, 69, 196, 73, 78, 84, 69, 82, 76, 73, 78, 69, 65, 210, 73, 78, 84, 69, - 82, 73, 79, 210, 73, 78, 84, 69, 82, 69, 83, 212, 73, 78, 84, 69, 82, 67, - 65, 76, 65, 84, 69, 128, 73, 78, 84, 69, 71, 82, 65, 84, 73, 79, 78, 128, - 73, 78, 84, 69, 71, 82, 65, 84, 73, 79, 206, 73, 78, 84, 69, 71, 82, 65, - 76, 128, 73, 78, 84, 69, 71, 82, 65, 204, 73, 78, 83, 85, 76, 65, 210, - 73, 78, 83, 84, 82, 85, 77, 69, 78, 84, 65, 204, 73, 78, 83, 73, 68, 69, - 128, 73, 78, 83, 69, 82, 84, 73, 79, 206, 73, 78, 83, 69, 67, 84, 128, - 73, 78, 83, 67, 82, 73, 80, 84, 73, 79, 78, 65, 204, 73, 78, 78, 79, 67, - 69, 78, 67, 69, 128, 73, 78, 78, 78, 128, 73, 78, 78, 69, 82, 128, 73, - 78, 78, 69, 210, 73, 78, 78, 128, 73, 78, 73, 78, 71, 85, 128, 73, 78, - 73, 128, 73, 78, 72, 73, 66, 73, 212, 73, 78, 72, 69, 82, 69, 78, 212, - 73, 78, 71, 87, 65, 90, 128, 73, 78, 70, 79, 82, 77, 65, 84, 73, 79, 206, - 73, 78, 70, 76, 85, 69, 78, 67, 69, 128, 73, 78, 70, 73, 78, 73, 84, 89, - 128, 73, 78, 70, 73, 78, 73, 84, 217, 73, 78, 68, 85, 83, 84, 82, 73, 65, - 204, 73, 78, 68, 73, 82, 69, 67, 212, 73, 78, 68, 73, 67, 65, 84, 79, 82, - 128, 73, 78, 68, 73, 195, 73, 78, 68, 69, 88, 128, 73, 78, 68, 69, 80, - 69, 78, 68, 69, 78, 212, 73, 78, 67, 82, 69, 77, 69, 78, 84, 128, 73, 78, - 67, 82, 69, 65, 83, 69, 211, 73, 78, 67, 82, 69, 65, 83, 69, 128, 73, 78, - 67, 79, 77, 80, 76, 69, 84, 197, 73, 78, 67, 76, 85, 68, 73, 78, 199, 73, - 78, 67, 72, 128, 73, 78, 65, 80, 128, 73, 78, 45, 65, 76, 65, 70, 128, - 73, 77, 80, 69, 82, 73, 65, 204, 73, 77, 80, 69, 82, 70, 69, 67, 84, 85, - 205, 73, 77, 80, 69, 82, 70, 69, 67, 84, 65, 128, 73, 77, 80, 69, 82, 70, - 69, 67, 84, 193, 73, 77, 73, 83, 69, 79, 211, 73, 77, 73, 78, 51, 128, - 73, 77, 73, 78, 128, 73, 77, 73, 206, 73, 77, 73, 70, 84, 72, 79, 82, 79, - 78, 128, 73, 77, 73, 70, 84, 72, 79, 82, 65, 128, 73, 77, 73, 70, 79, 78, - 79, 78, 128, 73, 77, 73, 68, 73, 65, 82, 71, 79, 78, 128, 73, 77, 65, 71, - 197, 73, 76, 85, 89, 65, 78, 78, 65, 128, 73, 76, 85, 89, 128, 73, 76, - 85, 85, 89, 65, 78, 78, 65, 128, 73, 76, 85, 84, 128, 73, 76, 73, 77, 77, - 85, 52, 128, 73, 76, 73, 77, 77, 85, 51, 128, 73, 76, 73, 77, 77, 85, - 128, 73, 76, 73, 77, 77, 213, 73, 76, 50, 128, 73, 75, 65, 82, 65, 128, - 73, 75, 65, 82, 193, 73, 74, 128, 73, 73, 89, 65, 78, 78, 65, 128, 73, - 71, 73, 128, 73, 71, 201, 73, 71, 71, 87, 83, 128, 73, 70, 73, 78, 128, - 73, 69, 85, 78, 71, 45, 84, 73, 75, 69, 85, 84, 128, 73, 69, 85, 78, 71, - 45, 84, 72, 73, 69, 85, 84, 72, 128, 73, 69, 85, 78, 71, 45, 83, 83, 65, - 78, 71, 75, 73, 89, 69, 79, 75, 128, 73, 69, 85, 78, 71, 45, 82, 73, 69, - 85, 76, 128, 73, 69, 85, 78, 71, 45, 80, 73, 69, 85, 80, 128, 73, 69, 85, - 78, 71, 45, 80, 72, 73, 69, 85, 80, 72, 128, 73, 69, 85, 78, 71, 45, 75, - 73, 89, 69, 79, 75, 128, 73, 69, 85, 78, 71, 45, 75, 72, 73, 69, 85, 75, - 72, 128, 73, 69, 85, 78, 71, 45, 67, 73, 69, 85, 67, 128, 73, 69, 85, 78, - 71, 45, 67, 72, 73, 69, 85, 67, 72, 128, 73, 69, 85, 78, 199, 73, 68, 76, - 69, 128, 73, 68, 73, 77, 128, 73, 68, 73, 205, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 68, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 68, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 68, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 68, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 68, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 68, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 68, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 68, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 68, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 68, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 67, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 67, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 67, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 67, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 67, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 67, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 67, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 67, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 67, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 66, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 66, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 66, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 66, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 66, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 66, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 66, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 66, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 65, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 65, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 65, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 65, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 65, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 65, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 65, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 65, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 65, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 65, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 57, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 57, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 57, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 57, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 57, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 57, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 57, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 57, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 57, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 56, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 56, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 56, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 56, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 56, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 56, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 56, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 56, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 55, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 55, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 55, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 55, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 55, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 55, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 55, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 55, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 55, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 55, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 54, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 54, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 54, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 54, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 54, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 54, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 54, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 53, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 53, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 53, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 53, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 53, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 53, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 53, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 53, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 53, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 53, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 52, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 52, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 52, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 52, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 52, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 52, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 52, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 52, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 52, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 51, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 51, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 51, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 51, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 51, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 51, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 51, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 51, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 50, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 50, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 50, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 50, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 50, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 50, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 50, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 50, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 50, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 50, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 50, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 50, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 50, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 50, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 49, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 49, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 49, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 49, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 49, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 49, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 49, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 49, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 48, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 48, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 48, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 48, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 48, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 48, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 65, 48, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 65, 48, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, - 48, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 65, 48, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 70, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 70, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 70, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 70, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 70, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 70, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 70, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 70, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 70, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 69, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 69, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 69, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 69, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 69, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 69, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 69, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 69, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 68, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 68, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 68, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 68, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 68, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 68, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 68, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 68, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 68, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 68, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 67, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 67, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 67, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 67, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 67, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 67, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 67, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 67, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 67, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 66, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 66, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 66, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 66, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 66, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 66, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 66, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 66, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 65, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 65, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 65, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 65, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 65, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 65, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 65, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 65, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 65, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 65, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 57, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 57, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 57, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 57, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 57, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 57, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 57, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 57, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 57, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 56, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 56, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 56, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 56, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 56, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 56, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 56, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 56, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 55, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 55, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 55, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 55, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 55, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 55, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 55, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 55, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 55, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 55, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 54, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 54, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 54, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 54, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 54, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 54, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 54, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 54, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 54, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 53, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 53, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 53, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 53, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 53, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 53, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 53, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 53, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 52, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 52, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 52, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 52, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 52, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 52, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 52, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 52, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 52, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 52, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 51, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 51, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 51, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 51, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 51, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 51, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 51, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 51, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 51, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 50, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 69, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 67, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 50, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 50, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 50, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 56, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 50, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 50, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 50, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 50, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 50, 48, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 49, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 49, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 49, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 67, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 65, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 49, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 49, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 49, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 54, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 49, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 49, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 49, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 49, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 69, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 48, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 48, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 48, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 56, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 48, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 48, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, - 48, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 52, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 70, 57, 48, 50, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 70, 57, 48, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 70, 57, 48, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 57, 48, - 52, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 56, 68, 55, 48, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 56, 67, 65, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 56, 57, 69, 51, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 55, 68, 52, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 55, 54, 68, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 55, 53, - 49, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 55, 49, 50, 49, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 55, 48, 66, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 54, 70, 49, 52, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 54, 55, 50, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 54, 54, 50, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 54, 53, - 66, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 54, 53, 57, 57, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 54, 53, 53, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 54, 51, 53, 53, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 54, 51, 48, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 54, 50, 57, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 54, 50, - 53, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 54, 50, 52, 66, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 70, 56, 67, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 53, 68, 69, 54, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 53, 66, 56, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 53, 66, 53, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 57, - 50, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 57, 49, 65, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 56, 70, 48, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 53, 52, 51, 57, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 53, 51, 70, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 53, 51, 67, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 50, - 68, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 50, 52, 68, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 53, 50, 49, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 53, 49, 56, 68, 128, 73, 68, 69, 79, 71, 82, - 65, 80, 72, 45, 52, 69, 65, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 52, 69, 56, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 52, 69, - 50, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 52, 69, 48, 57, 128, - 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 52, 69, 48, 48, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 49, 68, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 65, 49, 67, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 65, 49, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 65, 49, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 65, 49, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, - 49, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 49, 55, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 49, 54, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 49, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 49, 52, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 65, 49, 51, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 65, 49, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 65, 49, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 65, 49, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, - 48, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 69, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 68, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 67, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 66, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 65, 48, 65, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 65, 48, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 65, 48, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 65, 48, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, - 48, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 53, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 52, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 65, 48, 50, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 65, 48, 49, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 65, 48, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 70, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 70, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 70, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 67, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 66, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 65, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 57, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 70, 56, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 70, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 70, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 70, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 70, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 51, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 50, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 70, 48, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 69, 70, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 69, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 69, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 69, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 69, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 69, 65, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 69, 57, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 69, 56, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 69, 55, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 69, 54, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 69, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 69, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 69, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 69, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 69, 49, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 69, 48, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 68, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 68, 69, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 68, 68, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 68, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 68, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 68, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 68, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 68, 56, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 68, 55, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 68, 54, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 68, 53, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 68, 52, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 68, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 68, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 68, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 68, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 70, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 69, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 67, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 67, 66, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 67, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 67, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 67, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 67, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 54, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 53, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 52, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 67, 51, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 67, 50, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 67, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 67, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 66, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 66, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 68, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 67, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 65, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 66, 57, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 66, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 66, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 66, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 66, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 52, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 51, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 50, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 66, 49, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 66, 48, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 65, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 65, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 65, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 65, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 66, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 65, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 56, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 65, 55, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 65, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 65, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 65, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 65, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 50, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 49, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 65, 48, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 57, 70, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 57, 69, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 57, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 57, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 57, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 57, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 57, 57, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 57, 56, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 57, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 57, 54, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 57, 53, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 57, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 57, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 57, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 57, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 57, 48, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 70, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 69, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 68, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 56, 67, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 56, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 56, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 56, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 56, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 55, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 54, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 56, 52, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 56, 51, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 56, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 56, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 56, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 55, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 69, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 68, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 67, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 66, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 55, 65, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 55, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 55, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 55, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 55, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 53, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 52, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 55, 50, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 55, 49, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 55, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 54, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 54, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 54, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 67, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 66, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 65, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 57, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 54, 56, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 54, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 54, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 54, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 54, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 51, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 50, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 54, 48, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 53, 70, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 53, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 53, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 53, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 53, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 53, 65, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 53, 57, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 53, 56, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 53, 55, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 53, 54, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 53, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 53, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 53, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 53, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 53, 49, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 53, 48, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 52, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 52, 69, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 52, 68, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 52, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 52, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 52, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 52, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 52, 56, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 52, 55, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 52, 54, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 52, 53, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 52, 52, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 52, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 52, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 52, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 52, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 70, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 69, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 67, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 51, 66, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 51, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 51, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 51, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 51, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 54, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 53, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 52, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 51, 51, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 51, 50, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 51, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 51, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 50, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 50, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 68, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 67, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 65, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 50, 57, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 50, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 50, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 50, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 50, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 52, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 51, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 50, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 50, 49, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 50, 48, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 49, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 49, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 49, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 49, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 66, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 65, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 56, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 49, 55, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 49, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 49, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 49, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 49, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 50, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 49, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 49, 48, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 48, 70, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 48, 69, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 48, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 48, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 48, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 48, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 48, 57, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 48, 56, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 48, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 48, 54, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 57, 48, 53, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 57, 48, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 57, 48, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 57, 48, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, - 48, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 57, 48, 48, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 70, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 69, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 68, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 70, 67, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 70, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 70, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 70, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 70, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 55, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 54, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 70, 52, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 70, 51, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 70, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 70, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 70, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 69, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 69, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 68, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 67, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 66, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 69, 65, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 69, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 69, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 69, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 69, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 53, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 52, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 69, 50, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 69, 49, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 69, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 68, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 68, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 68, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 67, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 66, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 65, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 57, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 68, 56, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 68, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 68, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 68, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 68, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 51, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 50, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 68, 48, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 67, 70, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 67, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 67, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 67, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 67, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 67, 65, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 67, 57, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 67, 56, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 67, 55, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 67, 54, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 67, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 67, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 67, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 67, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 67, 49, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 67, 48, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 66, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 66, 69, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 66, 68, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 66, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 66, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 66, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 66, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 66, 56, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 66, 55, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 66, 54, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 66, 53, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 66, 52, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 66, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 66, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 66, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 66, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 70, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 69, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 67, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 65, 66, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 65, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 65, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 65, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 65, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 54, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 53, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 52, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 65, 51, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 65, 50, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 65, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 65, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 57, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 57, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 68, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 67, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 65, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 57, 57, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 57, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 57, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 57, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 57, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 52, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 51, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 50, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 57, 49, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 57, 48, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 56, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 56, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 56, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 56, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 66, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 65, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 57, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 56, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 56, 55, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 56, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 56, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 56, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 56, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 50, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 49, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 56, 48, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 55, 70, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 55, 69, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 55, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 55, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 55, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 55, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 55, 57, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 55, 56, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 55, 55, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 55, 54, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 55, 53, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 55, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 55, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 55, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 55, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 55, 48, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 70, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 69, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 68, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 54, 67, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 54, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 54, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 54, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 54, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 55, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 54, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 53, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 54, 52, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 54, 51, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 54, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 54, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 54, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 53, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 69, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 68, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 67, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 66, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 53, 65, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 53, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 53, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 53, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 53, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 53, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 52, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 51, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 53, 50, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 53, 49, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 53, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 52, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 52, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 52, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 67, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 66, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 65, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 57, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 52, 56, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 52, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 52, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 52, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 52, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 51, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 50, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 49, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 52, 48, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 51, 70, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 51, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 51, 68, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 51, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 51, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 51, 65, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 51, 57, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 51, 56, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 51, 55, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 51, 54, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 51, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 51, 52, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 51, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 51, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 51, 49, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 51, 48, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 50, 70, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 50, 69, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 50, 68, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 50, 67, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 50, 66, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 50, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 50, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 50, 56, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 50, 55, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 50, 54, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 50, 53, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 50, 52, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 50, 51, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 50, 50, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 50, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 50, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 70, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 69, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 68, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 67, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 49, 66, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 49, 65, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 49, 57, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 49, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 49, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 54, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 53, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 52, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 49, 51, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 49, 50, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 49, 49, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 49, 48, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 48, 70, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 48, 69, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 68, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 67, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 66, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 65, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 48, 57, 128, 73, 68, 69, 79, 71, 82, 65, - 80, 72, 45, 50, 70, 56, 48, 56, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, - 45, 50, 70, 56, 48, 55, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, - 70, 56, 48, 54, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, - 48, 53, 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 52, - 128, 73, 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 51, 128, 73, - 68, 69, 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 50, 128, 73, 68, 69, - 79, 71, 82, 65, 80, 72, 45, 50, 70, 56, 48, 49, 128, 73, 68, 69, 79, 71, - 82, 65, 80, 72, 45, 50, 70, 56, 48, 48, 128, 73, 68, 69, 78, 84, 73, 70, - 73, 67, 65, 84, 73, 79, 78, 128, 73, 68, 69, 78, 84, 73, 67, 65, 204, 73, - 67, 72, 79, 85, 128, 73, 67, 72, 79, 83, 128, 73, 67, 72, 73, 77, 65, 84, - 79, 83, 128, 73, 67, 72, 65, 68, 73, 78, 128, 73, 67, 69, 76, 65, 78, 68, - 73, 67, 45, 89, 82, 128, 73, 66, 73, 70, 73, 76, 73, 128, 73, 65, 85, 68, - 65, 128, 73, 48, 49, 53, 128, 73, 48, 49, 52, 128, 73, 48, 49, 51, 128, - 73, 48, 49, 50, 128, 73, 48, 49, 49, 65, 128, 73, 48, 49, 49, 128, 73, - 48, 49, 48, 65, 128, 73, 48, 49, 48, 128, 73, 48, 48, 57, 65, 128, 73, - 48, 48, 57, 128, 73, 48, 48, 56, 128, 73, 48, 48, 55, 128, 73, 48, 48, - 54, 128, 73, 48, 48, 53, 65, 128, 73, 48, 48, 53, 128, 73, 48, 48, 52, - 128, 73, 48, 48, 51, 128, 73, 48, 48, 50, 128, 73, 48, 48, 49, 128, 73, - 45, 89, 85, 128, 73, 45, 89, 79, 128, 73, 45, 89, 69, 79, 128, 73, 45, - 89, 69, 128, 73, 45, 89, 65, 69, 128, 73, 45, 89, 65, 45, 79, 128, 73, - 45, 89, 65, 128, 73, 45, 79, 45, 73, 128, 73, 45, 79, 128, 73, 45, 69, - 85, 128, 73, 45, 66, 69, 65, 77, 128, 73, 45, 65, 82, 65, 69, 65, 128, - 73, 45, 65, 128, 72, 90, 90, 90, 71, 128, 72, 90, 90, 90, 128, 72, 90, - 90, 80, 128, 72, 90, 90, 128, 72, 90, 87, 71, 128, 72, 90, 87, 128, 72, - 90, 84, 128, 72, 90, 71, 128, 72, 89, 83, 84, 69, 82, 69, 83, 73, 211, - 72, 89, 80, 79, 68, 73, 65, 83, 84, 79, 76, 69, 128, 72, 89, 80, 72, 69, - 78, 65, 84, 73, 79, 206, 72, 89, 80, 72, 69, 78, 45, 77, 73, 78, 85, 83, - 128, 72, 89, 80, 72, 69, 78, 128, 72, 89, 80, 72, 69, 206, 72, 88, 87, - 71, 128, 72, 88, 85, 79, 88, 128, 72, 88, 85, 79, 84, 128, 72, 88, 85, - 79, 80, 128, 72, 88, 85, 79, 128, 72, 88, 79, 88, 128, 72, 88, 79, 84, - 128, 72, 88, 79, 80, 128, 72, 88, 79, 128, 72, 88, 73, 88, 128, 72, 88, - 73, 84, 128, 72, 88, 73, 80, 128, 72, 88, 73, 69, 88, 128, 72, 88, 73, - 69, 84, 128, 72, 88, 73, 69, 80, 128, 72, 88, 73, 69, 128, 72, 88, 73, - 128, 72, 88, 69, 88, 128, 72, 88, 69, 80, 128, 72, 88, 69, 128, 72, 88, - 65, 88, 128, 72, 88, 65, 84, 128, 72, 88, 65, 80, 128, 72, 88, 65, 128, - 72, 87, 85, 128, 72, 87, 65, 73, 82, 128, 72, 86, 128, 72, 85, 82, 65, - 78, 128, 72, 85, 79, 84, 128, 72, 85, 78, 68, 82, 69, 68, 128, 72, 85, - 78, 68, 82, 69, 196, 72, 85, 78, 128, 72, 85, 77, 65, 78, 128, 72, 85, - 77, 65, 206, 72, 85, 76, 50, 128, 72, 85, 73, 73, 84, 79, 128, 72, 85, - 66, 50, 128, 72, 85, 66, 178, 72, 85, 66, 128, 72, 85, 65, 82, 65, 68, - 68, 79, 128, 72, 82, 89, 86, 78, 73, 193, 72, 80, 87, 71, 128, 72, 80, - 65, 128, 72, 80, 128, 72, 79, 85, 82, 71, 76, 65, 83, 83, 128, 72, 79, - 85, 210, 72, 79, 84, 65, 128, 72, 79, 82, 83, 69, 128, 72, 79, 82, 73, - 90, 79, 78, 84, 65, 76, 76, 217, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, - 45, 48, 54, 45, 48, 54, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, - 48, 54, 45, 48, 53, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, - 54, 45, 48, 52, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 54, - 45, 48, 51, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 54, 45, - 48, 50, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 54, 45, 48, - 49, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 54, 45, 48, 48, - 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 54, 128, - 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 53, 128, 72, - 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 52, 128, 72, 79, - 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 51, 128, 72, 79, 82, - 73, 90, 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 50, 128, 72, 79, 82, 73, - 90, 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 49, 128, 72, 79, 82, 73, 90, - 79, 78, 84, 65, 76, 45, 48, 53, 45, 48, 48, 128, 72, 79, 82, 73, 90, 79, - 78, 84, 65, 76, 45, 48, 52, 45, 48, 54, 128, 72, 79, 82, 73, 90, 79, 78, - 84, 65, 76, 45, 48, 52, 45, 48, 53, 128, 72, 79, 82, 73, 90, 79, 78, 84, - 65, 76, 45, 48, 52, 45, 48, 52, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, - 76, 45, 48, 52, 45, 48, 51, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, - 45, 48, 52, 45, 48, 50, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, - 48, 52, 45, 48, 49, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, - 52, 45, 48, 48, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, - 45, 48, 54, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, 45, - 48, 53, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, 45, 48, - 52, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, 45, 48, 51, - 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, 45, 48, 50, 128, - 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, 45, 48, 49, 128, 72, - 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 51, 45, 48, 48, 128, 72, 79, - 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 50, 45, 48, 54, 128, 72, 79, 82, - 73, 90, 79, 78, 84, 65, 76, 45, 48, 50, 45, 48, 53, 128, 72, 79, 82, 73, - 90, 79, 78, 84, 65, 76, 45, 48, 50, 45, 48, 52, 128, 72, 79, 82, 73, 90, - 79, 78, 84, 65, 76, 45, 48, 50, 45, 48, 51, 128, 72, 79, 82, 73, 90, 79, - 78, 84, 65, 76, 45, 48, 50, 45, 48, 50, 128, 72, 79, 82, 73, 90, 79, 78, - 84, 65, 76, 45, 48, 50, 45, 48, 49, 128, 72, 79, 82, 73, 90, 79, 78, 84, - 65, 76, 45, 48, 50, 45, 48, 48, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, - 76, 45, 48, 49, 45, 48, 54, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, - 45, 48, 49, 45, 48, 53, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, - 48, 49, 45, 48, 52, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, - 49, 45, 48, 51, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 49, - 45, 48, 50, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 49, 45, - 48, 49, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 49, 45, 48, - 48, 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 54, - 128, 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 53, 128, - 72, 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 52, 128, 72, - 79, 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 51, 128, 72, 79, - 82, 73, 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 50, 128, 72, 79, 82, - 73, 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 49, 128, 72, 79, 82, 73, - 90, 79, 78, 84, 65, 76, 45, 48, 48, 45, 48, 48, 128, 72, 79, 82, 73, 90, - 79, 78, 84, 65, 76, 128, 72, 79, 82, 73, 128, 72, 79, 82, 193, 72, 79, - 79, 82, 85, 128, 72, 79, 79, 78, 128, 72, 79, 77, 79, 84, 72, 69, 84, 73, - 67, 128, 72, 79, 77, 79, 84, 72, 69, 84, 73, 195, 72, 79, 76, 69, 128, - 72, 79, 76, 68, 73, 78, 199, 72, 79, 76, 65, 77, 128, 72, 79, 76, 65, - 205, 72, 79, 75, 65, 128, 72, 79, 73, 128, 72, 79, 69, 128, 72, 78, 85, - 84, 128, 72, 78, 85, 79, 88, 128, 72, 78, 85, 79, 128, 72, 78, 79, 88, - 128, 72, 78, 79, 84, 128, 72, 78, 79, 80, 128, 72, 78, 73, 88, 128, 72, - 78, 73, 84, 128, 72, 78, 73, 80, 128, 72, 78, 73, 69, 88, 128, 72, 78, - 73, 69, 84, 128, 72, 78, 73, 69, 80, 128, 72, 78, 73, 69, 128, 72, 78, - 73, 128, 72, 78, 69, 88, 128, 72, 78, 69, 80, 128, 72, 78, 69, 128, 72, - 78, 65, 88, 128, 72, 78, 65, 84, 128, 72, 78, 65, 80, 128, 72, 78, 65, - 128, 72, 77, 89, 88, 128, 72, 77, 89, 82, 88, 128, 72, 77, 89, 82, 128, - 72, 77, 89, 80, 128, 72, 77, 89, 128, 72, 77, 85, 88, 128, 72, 77, 85, - 84, 128, 72, 77, 85, 82, 88, 128, 72, 77, 85, 82, 128, 72, 77, 85, 80, - 128, 72, 77, 85, 79, 88, 128, 72, 77, 85, 79, 80, 128, 72, 77, 85, 79, - 128, 72, 77, 85, 128, 72, 77, 79, 88, 128, 72, 77, 79, 84, 128, 72, 77, - 79, 80, 128, 72, 77, 79, 128, 72, 77, 73, 88, 128, 72, 77, 73, 84, 128, - 72, 77, 73, 80, 128, 72, 77, 73, 69, 88, 128, 72, 77, 73, 69, 80, 128, - 72, 77, 73, 69, 128, 72, 77, 73, 128, 72, 77, 69, 128, 72, 77, 65, 88, - 128, 72, 77, 65, 84, 128, 72, 77, 65, 80, 128, 72, 77, 65, 128, 72, 76, - 89, 88, 128, 72, 76, 89, 84, 128, 72, 76, 89, 82, 88, 128, 72, 76, 89, - 82, 128, 72, 76, 89, 80, 128, 72, 76, 89, 128, 72, 76, 85, 88, 128, 72, - 76, 85, 84, 128, 72, 76, 85, 82, 88, 128, 72, 76, 85, 82, 128, 72, 76, - 85, 80, 128, 72, 76, 85, 79, 88, 128, 72, 76, 85, 79, 80, 128, 72, 76, - 85, 79, 128, 72, 76, 85, 128, 72, 76, 79, 88, 128, 72, 76, 79, 80, 128, - 72, 76, 79, 128, 72, 76, 73, 88, 128, 72, 76, 73, 84, 128, 72, 76, 73, - 80, 128, 72, 76, 73, 69, 88, 128, 72, 76, 73, 69, 80, 128, 72, 76, 73, - 69, 128, 72, 76, 73, 128, 72, 76, 69, 88, 128, 72, 76, 69, 80, 128, 72, - 76, 69, 128, 72, 76, 65, 88, 128, 72, 76, 65, 84, 128, 72, 76, 65, 80, - 128, 72, 76, 65, 128, 72, 75, 128, 72, 73, 90, 66, 128, 72, 73, 83, 84, - 79, 82, 73, 195, 72, 73, 82, 73, 81, 128, 72, 73, 71, 72, 45, 82, 69, 86, - 69, 82, 83, 69, 68, 45, 185, 72, 73, 69, 88, 128, 72, 73, 69, 85, 72, 45, - 83, 73, 79, 83, 128, 72, 73, 69, 85, 72, 45, 82, 73, 69, 85, 76, 128, 72, - 73, 69, 85, 72, 45, 80, 73, 69, 85, 80, 128, 72, 73, 69, 85, 72, 45, 78, - 73, 69, 85, 78, 128, 72, 73, 69, 85, 72, 45, 77, 73, 69, 85, 77, 128, 72, - 73, 69, 85, 200, 72, 73, 69, 128, 72, 73, 68, 73, 78, 199, 72, 73, 68, - 69, 84, 128, 72, 73, 68, 69, 128, 72, 72, 87, 65, 128, 72, 72, 85, 128, - 72, 72, 73, 128, 72, 72, 69, 69, 128, 72, 72, 69, 128, 72, 72, 65, 65, - 128, 72, 71, 128, 72, 69, 88, 73, 70, 79, 82, 205, 72, 69, 88, 65, 71, - 79, 78, 128, 72, 69, 82, 85, 84, 85, 128, 72, 69, 82, 85, 128, 72, 69, - 82, 77, 73, 84, 73, 65, 206, 72, 69, 82, 77, 73, 79, 78, 73, 65, 206, 72, - 69, 82, 77, 69, 83, 128, 72, 69, 82, 65, 69, 85, 205, 72, 69, 78, 71, - 128, 72, 69, 78, 199, 72, 69, 77, 80, 128, 72, 69, 76, 77, 69, 84, 128, - 72, 69, 76, 77, 69, 212, 72, 69, 76, 205, 72, 69, 75, 85, 84, 65, 65, 82, - 85, 128, 72, 69, 73, 83, 69, 73, 128, 72, 69, 65, 86, 89, 128, 72, 69, - 65, 86, 69, 78, 76, 217, 72, 69, 65, 86, 69, 78, 128, 72, 69, 65, 86, 69, - 206, 72, 69, 65, 82, 84, 128, 72, 69, 65, 82, 212, 72, 69, 65, 68, 83, - 84, 82, 79, 75, 69, 128, 72, 69, 65, 68, 83, 84, 79, 78, 197, 72, 69, 65, - 68, 73, 78, 71, 128, 72, 66, 65, 83, 65, 45, 69, 83, 65, 83, 193, 72, 66, - 65, 83, 193, 72, 65, 89, 65, 78, 78, 65, 128, 72, 65, 86, 69, 128, 72, - 65, 85, 80, 84, 83, 84, 73, 77, 77, 69, 128, 72, 65, 84, 72, 73, 128, 72, - 65, 84, 69, 128, 72, 65, 84, 65, 198, 72, 65, 83, 69, 210, 72, 65, 83, - 65, 78, 84, 65, 128, 72, 65, 82, 80, 79, 79, 78, 128, 72, 65, 82, 80, 79, - 79, 206, 72, 65, 82, 77, 79, 78, 73, 67, 128, 72, 65, 82, 75, 76, 69, 65, - 206, 72, 65, 82, 68, 78, 69, 83, 83, 128, 72, 65, 82, 196, 72, 65, 78, - 85, 78, 79, 207, 72, 65, 78, 71, 90, 72, 79, 213, 72, 65, 78, 68, 83, - 128, 72, 65, 78, 68, 76, 69, 83, 128, 72, 65, 78, 68, 128, 72, 65, 78, - 45, 65, 75, 65, 84, 128, 72, 65, 77, 90, 65, 128, 72, 65, 77, 77, 69, - 210, 72, 65, 76, 70, 128, 72, 65, 76, 66, 69, 82, 68, 128, 72, 65, 76, - 65, 78, 84, 65, 128, 72, 65, 73, 84, 85, 128, 72, 65, 73, 82, 128, 72, - 65, 71, 76, 65, 218, 72, 65, 71, 76, 128, 72, 65, 70, 85, 75, 72, 65, - 128, 72, 65, 70, 85, 75, 72, 128, 72, 65, 69, 71, 204, 72, 65, 69, 128, - 72, 65, 65, 82, 85, 128, 72, 65, 65, 77, 128, 72, 65, 193, 72, 65, 45, - 72, 65, 128, 72, 48, 48, 56, 128, 72, 48, 48, 55, 128, 72, 48, 48, 54, - 65, 128, 72, 48, 48, 54, 128, 72, 48, 48, 53, 128, 72, 48, 48, 52, 128, - 72, 48, 48, 51, 128, 72, 48, 48, 50, 128, 72, 48, 48, 49, 128, 72, 45, - 84, 89, 80, 197, 71, 89, 85, 128, 71, 89, 79, 78, 128, 71, 89, 79, 128, - 71, 89, 73, 128, 71, 89, 70, 213, 71, 89, 69, 69, 128, 71, 89, 65, 83, - 128, 71, 89, 65, 65, 128, 71, 89, 65, 128, 71, 89, 128, 71, 87, 85, 128, - 71, 87, 73, 128, 71, 87, 69, 69, 128, 71, 87, 69, 128, 71, 87, 65, 65, - 128, 71, 87, 65, 128, 71, 86, 128, 71, 85, 82, 85, 83, 72, 128, 71, 85, - 82, 85, 78, 128, 71, 85, 82, 65, 77, 85, 84, 79, 78, 128, 71, 85, 82, 55, - 128, 71, 85, 78, 85, 128, 71, 85, 78, 213, 71, 85, 77, 128, 71, 85, 205, - 71, 85, 76, 128, 71, 85, 199, 71, 85, 69, 72, 128, 71, 85, 69, 200, 71, - 85, 68, 128, 71, 85, 196, 71, 85, 65, 82, 68, 69, 68, 78, 69, 83, 83, - 128, 71, 85, 65, 82, 65, 78, 201, 71, 85, 178, 71, 84, 69, 210, 71, 83, - 85, 77, 128, 71, 83, 85, 205, 71, 82, 213, 71, 82, 79, 85, 78, 68, 128, - 71, 82, 79, 78, 84, 72, 73, 83, 77, 65, 84, 65, 128, 71, 82, 69, 71, 79, - 82, 73, 65, 206, 71, 82, 69, 69, 206, 71, 82, 69, 65, 84, 78, 69, 83, 83, - 128, 71, 82, 69, 65, 84, 69, 82, 45, 84, 72, 65, 78, 128, 71, 82, 69, 65, - 84, 69, 82, 45, 84, 72, 65, 206, 71, 82, 69, 65, 84, 69, 210, 71, 82, 69, - 65, 212, 71, 82, 65, 86, 69, 89, 65, 82, 196, 71, 82, 65, 86, 69, 45, 77, - 65, 67, 82, 79, 78, 128, 71, 82, 65, 86, 69, 45, 65, 67, 85, 84, 69, 45, - 71, 82, 65, 86, 69, 128, 71, 82, 65, 86, 197, 71, 82, 65, 84, 69, 82, - 128, 71, 82, 65, 83, 83, 128, 71, 82, 65, 83, 211, 71, 82, 65, 80, 72, - 69, 77, 197, 71, 82, 65, 77, 77, 193, 71, 82, 65, 73, 78, 128, 71, 82, - 65, 67, 69, 128, 71, 82, 65, 67, 197, 71, 80, 65, 128, 71, 79, 82, 84, - 72, 77, 73, 75, 79, 206, 71, 79, 82, 84, 128, 71, 79, 82, 71, 79, 84, 69, - 82, 73, 128, 71, 79, 82, 71, 79, 83, 89, 78, 84, 72, 69, 84, 79, 78, 128, - 71, 79, 82, 71, 79, 206, 71, 79, 82, 71, 73, 128, 71, 79, 82, 65, 128, - 71, 79, 78, 71, 128, 71, 79, 76, 68, 128, 71, 79, 75, 128, 71, 79, 73, - 78, 199, 71, 79, 65, 76, 128, 71, 79, 65, 204, 71, 79, 65, 128, 71, 78, - 89, 73, 83, 128, 71, 78, 65, 86, 73, 89, 65, 78, 73, 128, 71, 76, 79, 84, - 84, 65, 204, 71, 76, 73, 83, 83, 65, 78, 68, 207, 71, 76, 69, 73, 67, - 200, 71, 76, 65, 71, 79, 76, 73, 128, 71, 76, 65, 128, 71, 74, 69, 128, - 71, 73, 88, 128, 71, 73, 84, 128, 71, 73, 83, 72, 128, 71, 73, 83, 200, - 71, 73, 83, 65, 76, 128, 71, 73, 82, 85, 68, 65, 65, 128, 71, 73, 82, 51, - 128, 71, 73, 82, 179, 71, 73, 82, 50, 128, 71, 73, 82, 178, 71, 73, 80, - 128, 71, 73, 78, 73, 73, 128, 71, 73, 77, 69, 76, 128, 71, 73, 77, 69, - 204, 71, 73, 77, 128, 71, 73, 71, 65, 128, 71, 73, 69, 84, 128, 71, 73, - 68, 73, 77, 128, 71, 73, 66, 65, 128, 71, 73, 52, 128, 71, 73, 180, 71, - 72, 90, 128, 71, 72, 87, 65, 128, 71, 72, 85, 78, 78, 65, 128, 71, 72, - 85, 78, 78, 193, 71, 72, 85, 128, 71, 72, 79, 85, 128, 71, 72, 79, 83, - 84, 128, 71, 72, 79, 128, 71, 72, 73, 128, 71, 72, 72, 65, 128, 71, 72, - 69, 69, 128, 71, 72, 69, 128, 71, 72, 197, 71, 72, 65, 89, 78, 128, 71, - 72, 65, 78, 128, 71, 72, 65, 77, 65, 76, 128, 71, 72, 65, 73, 78, 85, - 128, 71, 72, 65, 73, 78, 128, 71, 72, 65, 73, 206, 71, 72, 65, 68, 128, - 71, 72, 65, 128, 71, 71, 87, 73, 128, 71, 71, 87, 69, 69, 128, 71, 71, - 87, 69, 128, 71, 71, 87, 65, 65, 128, 71, 71, 87, 65, 128, 71, 71, 85, - 88, 128, 71, 71, 85, 84, 128, 71, 71, 85, 82, 88, 128, 71, 71, 85, 82, - 128, 71, 71, 85, 80, 128, 71, 71, 85, 79, 88, 128, 71, 71, 85, 79, 84, - 128, 71, 71, 85, 79, 80, 128, 71, 71, 85, 79, 128, 71, 71, 79, 88, 128, - 71, 71, 79, 84, 128, 71, 71, 79, 80, 128, 71, 71, 73, 88, 128, 71, 71, - 73, 84, 128, 71, 71, 73, 69, 88, 128, 71, 71, 73, 69, 80, 128, 71, 71, - 73, 69, 128, 71, 71, 69, 88, 128, 71, 71, 69, 84, 128, 71, 71, 69, 80, - 128, 71, 71, 65, 88, 128, 71, 71, 65, 84, 128, 71, 71, 65, 80, 128, 71, - 71, 65, 65, 128, 71, 69, 84, 193, 71, 69, 83, 72, 85, 128, 71, 69, 83, - 72, 84, 73, 78, 128, 71, 69, 83, 72, 84, 73, 206, 71, 69, 83, 72, 50, - 128, 71, 69, 82, 83, 72, 65, 89, 73, 77, 128, 71, 69, 82, 77, 65, 206, - 71, 69, 82, 69, 83, 72, 128, 71, 69, 82, 69, 83, 200, 71, 69, 79, 77, 69, - 84, 82, 73, 67, 65, 76, 76, 217, 71, 69, 79, 77, 69, 84, 82, 73, 195, 71, - 69, 78, 84, 76, 197, 71, 69, 78, 73, 84, 73, 86, 69, 128, 71, 69, 78, 73, - 75, 201, 71, 69, 78, 69, 82, 73, 195, 71, 69, 77, 73, 78, 73, 128, 71, - 69, 77, 73, 78, 65, 84, 73, 79, 206, 71, 69, 68, 79, 76, 65, 128, 71, 69, - 68, 69, 128, 71, 69, 66, 207, 71, 69, 66, 193, 71, 69, 65, 82, 128, 71, - 69, 65, 210, 71, 68, 65, 78, 128, 71, 67, 73, 71, 128, 71, 67, 65, 206, - 71, 66, 79, 78, 128, 71, 66, 69, 78, 128, 71, 66, 65, 75, 85, 82, 85, 78, - 69, 78, 128, 71, 66, 128, 71, 65, 89, 65, 78, 85, 75, 73, 84, 84, 65, - 128, 71, 65, 89, 65, 78, 78, 65, 128, 71, 65, 89, 128, 71, 65, 85, 78, - 84, 76, 69, 84, 128, 71, 65, 84, 72, 69, 82, 73, 78, 71, 128, 71, 65, 84, - 72, 69, 82, 73, 78, 199, 71, 65, 84, 69, 128, 71, 65, 83, 72, 65, 78, - 128, 71, 65, 82, 83, 72, 85, 78, 73, 128, 71, 65, 82, 79, 78, 128, 71, - 65, 82, 77, 69, 78, 84, 128, 71, 65, 82, 51, 128, 71, 65, 80, 80, 69, - 196, 71, 65, 208, 71, 65, 78, 77, 65, 128, 71, 65, 78, 71, 73, 65, 128, - 71, 65, 78, 68, 193, 71, 65, 78, 50, 128, 71, 65, 78, 178, 71, 65, 77, - 77, 65, 128, 71, 65, 77, 76, 65, 128, 71, 65, 77, 76, 128, 71, 65, 77, - 65, 78, 128, 71, 65, 77, 65, 76, 128, 71, 65, 77, 65, 204, 71, 65, 77, - 128, 71, 65, 71, 128, 71, 65, 70, 128, 71, 65, 198, 71, 65, 69, 84, 84, - 65, 45, 80, 73, 76, 76, 65, 128, 71, 65, 68, 79, 76, 128, 71, 65, 68, - 128, 71, 65, 196, 71, 65, 66, 65, 128, 71, 65, 66, 193, 71, 65, 65, 70, - 85, 128, 71, 65, 178, 71, 48, 53, 52, 128, 71, 48, 53, 51, 128, 71, 48, - 53, 50, 128, 71, 48, 53, 49, 128, 71, 48, 53, 48, 128, 71, 48, 52, 57, - 128, 71, 48, 52, 56, 128, 71, 48, 52, 55, 128, 71, 48, 52, 54, 128, 71, - 48, 52, 53, 65, 128, 71, 48, 52, 53, 128, 71, 48, 52, 52, 128, 71, 48, - 52, 51, 65, 128, 71, 48, 52, 51, 128, 71, 48, 52, 50, 128, 71, 48, 52, - 49, 128, 71, 48, 52, 48, 128, 71, 48, 51, 57, 128, 71, 48, 51, 56, 128, - 71, 48, 51, 55, 65, 128, 71, 48, 51, 55, 128, 71, 48, 51, 54, 65, 128, - 71, 48, 51, 54, 128, 71, 48, 51, 53, 128, 71, 48, 51, 52, 128, 71, 48, - 51, 51, 128, 71, 48, 51, 50, 128, 71, 48, 51, 49, 128, 71, 48, 51, 48, - 128, 71, 48, 50, 57, 128, 71, 48, 50, 56, 128, 71, 48, 50, 55, 128, 71, - 48, 50, 54, 65, 128, 71, 48, 50, 54, 128, 71, 48, 50, 53, 128, 71, 48, - 50, 52, 128, 71, 48, 50, 51, 128, 71, 48, 50, 50, 128, 71, 48, 50, 49, - 128, 71, 48, 50, 48, 65, 128, 71, 48, 50, 48, 128, 71, 48, 49, 57, 128, - 71, 48, 49, 56, 128, 71, 48, 49, 55, 128, 71, 48, 49, 54, 128, 71, 48, - 49, 53, 128, 71, 48, 49, 52, 128, 71, 48, 49, 51, 128, 71, 48, 49, 50, - 128, 71, 48, 49, 49, 65, 128, 71, 48, 49, 49, 128, 71, 48, 49, 48, 128, - 71, 48, 48, 57, 128, 71, 48, 48, 56, 128, 71, 48, 48, 55, 66, 128, 71, - 48, 48, 55, 65, 128, 71, 48, 48, 55, 128, 71, 48, 48, 54, 65, 128, 71, - 48, 48, 54, 128, 71, 48, 48, 53, 128, 71, 48, 48, 52, 128, 71, 48, 48, - 51, 128, 71, 48, 48, 50, 128, 71, 48, 48, 49, 128, 70, 89, 88, 128, 70, - 89, 84, 128, 70, 89, 80, 128, 70, 89, 65, 128, 70, 89, 128, 70, 87, 73, - 128, 70, 87, 69, 69, 128, 70, 87, 69, 128, 70, 87, 65, 65, 128, 70, 87, - 65, 128, 70, 85, 88, 128, 70, 85, 84, 128, 70, 85, 83, 69, 128, 70, 85, - 83, 193, 70, 85, 82, 88, 128, 70, 85, 82, 128, 70, 85, 80, 128, 70, 85, - 78, 69, 82, 65, 204, 70, 85, 78, 67, 84, 73, 79, 78, 128, 70, 85, 76, 76, - 78, 69, 83, 83, 128, 70, 85, 76, 204, 70, 85, 69, 204, 70, 84, 72, 79, - 82, 193, 70, 82, 79, 87, 78, 73, 78, 199, 70, 82, 79, 87, 78, 128, 70, - 82, 79, 78, 84, 45, 84, 73, 76, 84, 69, 196, 70, 82, 79, 205, 70, 82, 79, - 71, 128, 70, 82, 73, 84, 85, 128, 70, 82, 73, 67, 65, 84, 73, 86, 69, - 128, 70, 82, 69, 84, 66, 79, 65, 82, 68, 128, 70, 82, 69, 78, 67, 200, - 70, 82, 69, 197, 70, 82, 65, 78, 195, 70, 82, 65, 77, 69, 128, 70, 82, - 65, 71, 82, 65, 78, 84, 128, 70, 82, 65, 71, 77, 69, 78, 84, 128, 70, 82, - 65, 67, 84, 73, 79, 206, 70, 79, 88, 128, 70, 79, 85, 82, 84, 69, 69, 78, - 128, 70, 79, 85, 82, 84, 69, 69, 206, 70, 79, 85, 82, 45, 83, 84, 82, 73, - 78, 199, 70, 79, 85, 82, 45, 80, 69, 82, 45, 69, 205, 70, 79, 85, 82, 45, - 76, 73, 78, 197, 70, 79, 85, 210, 70, 79, 85, 78, 84, 65, 73, 78, 128, - 70, 79, 83, 84, 69, 82, 73, 78, 71, 128, 70, 79, 82, 84, 89, 128, 70, 79, - 82, 84, 217, 70, 79, 82, 84, 69, 128, 70, 79, 82, 77, 211, 70, 79, 82, - 77, 65, 84, 84, 73, 78, 71, 128, 70, 79, 82, 75, 69, 196, 70, 79, 82, 67, - 69, 83, 128, 70, 79, 82, 67, 69, 128, 70, 79, 80, 128, 70, 79, 79, 84, - 83, 84, 79, 79, 76, 128, 70, 79, 79, 84, 78, 79, 84, 197, 70, 79, 79, 84, - 128, 70, 79, 79, 128, 70, 79, 78, 71, 77, 65, 78, 128, 70, 79, 77, 128, - 70, 79, 76, 76, 89, 128, 70, 79, 76, 76, 79, 87, 73, 78, 71, 128, 70, 79, - 128, 70, 77, 128, 70, 76, 89, 128, 70, 76, 85, 84, 69, 128, 70, 76, 79, - 87, 69, 82, 128, 70, 76, 79, 87, 69, 210, 70, 76, 79, 85, 82, 73, 83, 72, - 128, 70, 76, 79, 82, 69, 84, 84, 69, 128, 70, 76, 79, 82, 65, 204, 70, - 76, 79, 79, 82, 128, 70, 76, 73, 80, 128, 70, 76, 73, 71, 72, 84, 128, - 70, 76, 69, 88, 85, 83, 128, 70, 76, 69, 85, 82, 45, 68, 69, 45, 76, 73, - 83, 128, 70, 76, 65, 84, 84, 69, 78, 69, 196, 70, 76, 65, 84, 78, 69, 83, - 83, 128, 70, 76, 65, 84, 128, 70, 76, 65, 212, 70, 76, 65, 71, 45, 53, - 128, 70, 76, 65, 71, 45, 52, 128, 70, 76, 65, 71, 45, 51, 128, 70, 76, - 65, 71, 45, 50, 128, 70, 76, 65, 71, 45, 49, 128, 70, 76, 65, 71, 128, - 70, 76, 65, 199, 70, 76, 65, 128, 70, 76, 128, 70, 73, 88, 69, 68, 45, - 70, 79, 82, 205, 70, 73, 88, 128, 70, 73, 86, 69, 45, 76, 73, 78, 197, - 70, 73, 86, 197, 70, 73, 84, 65, 128, 70, 73, 84, 128, 70, 73, 83, 72, - 72, 79, 79, 75, 128, 70, 73, 83, 72, 72, 79, 79, 203, 70, 73, 83, 72, 69, - 89, 69, 128, 70, 73, 83, 72, 128, 70, 73, 83, 200, 70, 73, 82, 83, 212, - 70, 73, 82, 69, 128, 70, 73, 80, 128, 70, 73, 78, 73, 84, 197, 70, 73, - 78, 71, 69, 82, 78, 65, 73, 76, 83, 128, 70, 73, 78, 71, 69, 82, 69, 196, - 70, 73, 78, 65, 78, 67, 73, 65, 76, 128, 70, 73, 76, 76, 69, 82, 128, 70, - 73, 76, 76, 69, 196, 70, 73, 76, 76, 128, 70, 73, 76, 204, 70, 73, 76, - 197, 70, 73, 73, 128, 70, 73, 71, 85, 82, 69, 45, 51, 128, 70, 73, 71, - 85, 82, 69, 45, 50, 128, 70, 73, 71, 85, 82, 69, 45, 49, 128, 70, 73, 71, - 85, 82, 197, 70, 73, 71, 72, 84, 128, 70, 73, 70, 84, 89, 128, 70, 73, - 70, 84, 217, 70, 73, 70, 84, 72, 83, 128, 70, 73, 70, 84, 72, 128, 70, - 73, 70, 84, 69, 69, 78, 128, 70, 73, 70, 84, 69, 69, 206, 70, 73, 69, 76, - 68, 128, 70, 72, 84, 79, 82, 193, 70, 70, 76, 128, 70, 70, 73, 128, 70, - 69, 83, 84, 73, 86, 65, 76, 128, 70, 69, 82, 82, 89, 128, 70, 69, 82, 77, - 65, 84, 65, 128, 70, 69, 82, 77, 65, 84, 193, 70, 69, 79, 200, 70, 69, - 78, 199, 70, 69, 78, 67, 69, 128, 70, 69, 77, 73, 78, 73, 78, 197, 70, - 69, 77, 65, 76, 69, 128, 70, 69, 77, 65, 76, 197, 70, 69, 76, 76, 79, 87, - 83, 72, 73, 80, 128, 70, 69, 73, 128, 70, 69, 72, 213, 70, 69, 72, 128, - 70, 69, 200, 70, 69, 69, 78, 71, 128, 70, 69, 69, 68, 128, 70, 69, 69, - 196, 70, 69, 69, 128, 70, 69, 66, 82, 85, 65, 82, 89, 128, 70, 69, 65, - 84, 72, 69, 82, 128, 70, 69, 65, 84, 72, 69, 210, 70, 69, 65, 82, 78, - 128, 70, 65, 89, 65, 78, 78, 65, 128, 70, 65, 88, 128, 70, 65, 84, 72, - 69, 82, 128, 70, 65, 84, 72, 65, 84, 65, 78, 128, 70, 65, 84, 72, 65, 84, - 65, 206, 70, 65, 84, 72, 65, 128, 70, 65, 84, 72, 193, 70, 65, 84, 128, - 70, 65, 82, 83, 201, 70, 65, 80, 128, 70, 65, 78, 71, 128, 70, 65, 78, - 69, 82, 79, 83, 73, 211, 70, 65, 78, 128, 70, 65, 77, 73, 76, 89, 128, - 70, 65, 76, 76, 73, 78, 199, 70, 65, 73, 76, 85, 82, 69, 128, 70, 65, 73, - 72, 85, 128, 70, 65, 72, 82, 69, 78, 72, 69, 73, 84, 128, 70, 65, 67, 84, - 79, 210, 70, 65, 67, 83, 73, 77, 73, 76, 197, 70, 65, 67, 69, 45, 54, - 128, 70, 65, 67, 69, 45, 53, 128, 70, 65, 67, 69, 45, 52, 128, 70, 65, - 67, 69, 45, 51, 128, 70, 65, 67, 69, 45, 50, 128, 70, 65, 67, 69, 45, 49, - 128, 70, 65, 65, 77, 65, 69, 128, 70, 65, 65, 73, 128, 70, 65, 65, 70, - 85, 128, 70, 65, 65, 128, 70, 48, 53, 51, 128, 70, 48, 53, 50, 128, 70, - 48, 53, 49, 67, 128, 70, 48, 53, 49, 66, 128, 70, 48, 53, 49, 65, 128, - 70, 48, 53, 49, 128, 70, 48, 53, 48, 128, 70, 48, 52, 57, 128, 70, 48, - 52, 56, 128, 70, 48, 52, 55, 65, 128, 70, 48, 52, 55, 128, 70, 48, 52, - 54, 65, 128, 70, 48, 52, 54, 128, 70, 48, 52, 53, 65, 128, 70, 48, 52, - 53, 128, 70, 48, 52, 52, 128, 70, 48, 52, 51, 128, 70, 48, 52, 50, 128, - 70, 48, 52, 49, 128, 70, 48, 52, 48, 128, 70, 48, 51, 57, 128, 70, 48, - 51, 56, 65, 128, 70, 48, 51, 56, 128, 70, 48, 51, 55, 65, 128, 70, 48, - 51, 55, 128, 70, 48, 51, 54, 128, 70, 48, 51, 53, 128, 70, 48, 51, 52, - 128, 70, 48, 51, 51, 128, 70, 48, 51, 50, 128, 70, 48, 51, 49, 65, 128, - 70, 48, 51, 49, 128, 70, 48, 51, 48, 128, 70, 48, 50, 57, 128, 70, 48, - 50, 56, 128, 70, 48, 50, 55, 128, 70, 48, 50, 54, 128, 70, 48, 50, 53, - 128, 70, 48, 50, 52, 128, 70, 48, 50, 51, 128, 70, 48, 50, 50, 128, 70, - 48, 50, 49, 65, 128, 70, 48, 50, 49, 128, 70, 48, 50, 48, 128, 70, 48, - 49, 57, 128, 70, 48, 49, 56, 128, 70, 48, 49, 55, 128, 70, 48, 49, 54, - 128, 70, 48, 49, 53, 128, 70, 48, 49, 52, 128, 70, 48, 49, 51, 65, 128, - 70, 48, 49, 51, 128, 70, 48, 49, 50, 128, 70, 48, 49, 49, 128, 70, 48, - 49, 48, 128, 70, 48, 48, 57, 128, 70, 48, 48, 56, 128, 70, 48, 48, 55, - 128, 70, 48, 48, 54, 128, 70, 48, 48, 53, 128, 70, 48, 48, 52, 128, 70, - 48, 48, 51, 128, 70, 48, 48, 50, 128, 70, 48, 48, 49, 65, 128, 70, 48, - 48, 49, 128, 69, 90, 200, 69, 90, 69, 78, 128, 69, 90, 69, 206, 69, 90, - 128, 69, 89, 66, 69, 89, 70, 73, 76, 73, 128, 69, 89, 65, 78, 78, 65, - 128, 69, 88, 84, 82, 65, 45, 76, 79, 215, 69, 88, 84, 82, 65, 45, 72, 73, - 71, 200, 69, 88, 84, 69, 78, 83, 73, 79, 78, 128, 69, 88, 84, 69, 78, 68, - 69, 196, 69, 88, 80, 79, 78, 69, 78, 212, 69, 88, 79, 128, 69, 88, 207, - 69, 88, 73, 83, 84, 83, 128, 69, 88, 73, 83, 84, 128, 69, 88, 72, 65, 85, - 83, 84, 73, 79, 78, 128, 69, 88, 67, 76, 65, 77, 65, 84, 73, 79, 78, 128, - 69, 88, 67, 76, 65, 77, 65, 84, 73, 79, 206, 69, 88, 67, 69, 83, 83, 128, - 69, 88, 67, 69, 76, 76, 69, 78, 84, 128, 69, 87, 69, 128, 69, 86, 69, 78, - 73, 78, 71, 128, 69, 85, 82, 79, 45, 67, 85, 82, 82, 69, 78, 67, 217, 69, - 85, 82, 207, 69, 85, 76, 69, 210, 69, 85, 45, 85, 128, 69, 85, 45, 79, - 128, 69, 85, 45, 69, 85, 128, 69, 85, 45, 69, 79, 128, 69, 85, 45, 69, - 128, 69, 85, 45, 65, 128, 69, 84, 78, 65, 72, 84, 65, 128, 69, 84, 72, - 69, 204, 69, 84, 69, 82, 79, 206, 69, 84, 69, 82, 78, 73, 84, 89, 128, - 69, 83, 85, 75, 85, 85, 68, 79, 128, 69, 83, 84, 73, 77, 65, 84, 69, 83, - 128, 69, 83, 84, 73, 77, 65, 84, 69, 196, 69, 83, 72, 69, 51, 128, 69, - 83, 72, 50, 49, 128, 69, 83, 72, 178, 69, 83, 72, 49, 54, 128, 69, 83, - 67, 65, 80, 69, 128, 69, 83, 45, 84, 69, 128, 69, 82, 82, 79, 82, 45, 66, - 65, 82, 82, 69, 196, 69, 82, 82, 128, 69, 82, 73, 78, 50, 128, 69, 82, - 71, 128, 69, 82, 65, 83, 197, 69, 81, 85, 73, 86, 65, 76, 69, 78, 212, - 69, 81, 85, 73, 68, 128, 69, 81, 85, 73, 65, 78, 71, 85, 76, 65, 210, 69, - 81, 85, 65, 76, 83, 128, 69, 81, 85, 65, 76, 211, 69, 81, 85, 65, 76, - 128, 69, 80, 83, 73, 76, 79, 78, 128, 69, 80, 83, 73, 76, 79, 206, 69, - 80, 73, 71, 82, 65, 80, 72, 73, 195, 69, 80, 73, 68, 65, 85, 82, 69, 65, - 206, 69, 80, 69, 78, 84, 72, 69, 84, 73, 195, 69, 80, 69, 71, 69, 82, 77, - 65, 128, 69, 79, 76, 72, 88, 128, 69, 79, 72, 128, 69, 78, 89, 128, 69, - 78, 86, 69, 76, 79, 80, 69, 128, 69, 78, 85, 77, 69, 82, 65, 84, 73, 79, - 206, 69, 78, 84, 82, 89, 45, 50, 128, 69, 78, 84, 82, 89, 45, 49, 128, - 69, 78, 84, 82, 89, 128, 69, 78, 84, 72, 85, 83, 73, 65, 83, 77, 128, 69, - 78, 84, 69, 82, 80, 82, 73, 83, 69, 128, 69, 78, 84, 69, 82, 73, 78, 199, - 69, 78, 84, 69, 82, 128, 69, 78, 84, 69, 210, 69, 78, 81, 85, 73, 82, 89, - 128, 69, 78, 79, 211, 69, 78, 78, 128, 69, 78, 76, 65, 82, 71, 69, 77, - 69, 78, 84, 128, 69, 78, 68, 79, 70, 79, 78, 79, 78, 128, 69, 78, 68, 73, - 78, 199, 69, 78, 68, 69, 80, 128, 69, 78, 68, 69, 65, 86, 79, 85, 82, - 128, 69, 78, 196, 69, 78, 67, 79, 85, 78, 84, 69, 82, 83, 128, 69, 78, - 67, 76, 79, 83, 85, 82, 69, 128, 69, 78, 67, 76, 79, 83, 73, 78, 199, 69, - 78, 67, 128, 69, 78, 65, 82, 88, 73, 211, 69, 78, 65, 82, 77, 79, 78, 73, - 79, 211, 69, 77, 80, 84, 217, 69, 77, 80, 72, 65, 84, 73, 195, 69, 77, - 80, 72, 65, 83, 73, 211, 69, 77, 66, 82, 79, 73, 68, 69, 82, 89, 128, 69, - 77, 66, 69, 76, 76, 73, 83, 72, 77, 69, 78, 84, 128, 69, 77, 66, 69, 68, - 68, 73, 78, 71, 128, 69, 76, 84, 128, 69, 76, 76, 73, 80, 83, 73, 83, - 128, 69, 76, 76, 73, 80, 83, 69, 128, 69, 76, 73, 70, 73, 128, 69, 76, - 69, 86, 69, 78, 128, 69, 76, 69, 86, 69, 206, 69, 76, 69, 77, 69, 78, - 212, 69, 76, 69, 67, 84, 82, 73, 67, 65, 204, 69, 76, 69, 67, 84, 82, 73, - 195, 69, 76, 65, 70, 82, 79, 78, 128, 69, 75, 83, 84, 82, 69, 80, 84, 79, - 78, 128, 69, 75, 83, 128, 69, 75, 70, 79, 78, 73, 84, 73, 75, 79, 78, - 128, 69, 75, 65, 82, 65, 128, 69, 74, 69, 67, 212, 69, 73, 83, 128, 69, - 73, 71, 72, 84, 89, 128, 69, 73, 71, 72, 84, 217, 69, 73, 71, 72, 84, 72, - 83, 128, 69, 73, 71, 72, 84, 72, 211, 69, 73, 71, 72, 84, 72, 128, 69, - 73, 71, 72, 84, 69, 69, 78, 128, 69, 73, 71, 72, 84, 69, 69, 206, 69, 73, - 69, 128, 69, 72, 87, 65, 218, 69, 71, 89, 80, 84, 79, 76, 79, 71, 73, 67, - 65, 204, 69, 71, 73, 82, 128, 69, 71, 71, 128, 69, 69, 89, 65, 78, 78, - 65, 128, 69, 69, 75, 65, 65, 128, 69, 69, 66, 69, 69, 70, 73, 76, 73, - 128, 69, 68, 73, 84, 79, 82, 73, 65, 204, 69, 68, 73, 78, 128, 69, 68, - 68, 128, 69, 67, 200, 69, 66, 69, 70, 73, 76, 73, 128, 69, 65, 83, 84, - 69, 82, 206, 69, 65, 83, 212, 69, 65, 82, 84, 72, 76, 217, 69, 65, 82, - 84, 72, 128, 69, 65, 82, 84, 200, 69, 65, 82, 76, 217, 69, 65, 77, 72, - 65, 78, 67, 72, 79, 76, 76, 128, 69, 65, 71, 76, 69, 128, 69, 65, 68, 72, - 65, 68, 72, 128, 69, 65, 66, 72, 65, 68, 72, 128, 69, 178, 69, 48, 51, - 56, 128, 69, 48, 51, 55, 128, 69, 48, 51, 54, 128, 69, 48, 51, 52, 65, - 128, 69, 48, 51, 52, 128, 69, 48, 51, 51, 128, 69, 48, 51, 50, 128, 69, - 48, 51, 49, 128, 69, 48, 51, 48, 128, 69, 48, 50, 57, 128, 69, 48, 50, - 56, 65, 128, 69, 48, 50, 56, 128, 69, 48, 50, 55, 128, 69, 48, 50, 54, - 128, 69, 48, 50, 53, 128, 69, 48, 50, 52, 128, 69, 48, 50, 51, 128, 69, - 48, 50, 50, 128, 69, 48, 50, 49, 128, 69, 48, 50, 48, 65, 128, 69, 48, - 50, 48, 128, 69, 48, 49, 57, 128, 69, 48, 49, 56, 128, 69, 48, 49, 55, - 65, 128, 69, 48, 49, 55, 128, 69, 48, 49, 54, 65, 128, 69, 48, 49, 54, - 128, 69, 48, 49, 53, 128, 69, 48, 49, 52, 128, 69, 48, 49, 51, 128, 69, - 48, 49, 50, 128, 69, 48, 49, 49, 128, 69, 48, 49, 48, 128, 69, 48, 48, - 57, 65, 128, 69, 48, 48, 57, 128, 69, 48, 48, 56, 65, 128, 69, 48, 48, - 56, 128, 69, 48, 48, 55, 128, 69, 48, 48, 54, 128, 69, 48, 48, 53, 128, - 69, 48, 48, 52, 128, 69, 48, 48, 51, 128, 69, 48, 48, 50, 128, 69, 48, - 48, 49, 128, 68, 90, 90, 69, 128, 68, 90, 87, 69, 128, 68, 90, 85, 128, - 68, 90, 79, 128, 68, 90, 74, 69, 128, 68, 90, 73, 128, 68, 90, 72, 69, - 128, 68, 90, 72, 65, 128, 68, 90, 69, 76, 79, 128, 68, 90, 69, 69, 128, - 68, 90, 69, 128, 68, 90, 65, 128, 68, 90, 128, 68, 218, 68, 89, 79, 128, - 68, 89, 207, 68, 89, 69, 72, 128, 68, 89, 69, 200, 68, 87, 79, 128, 68, - 87, 69, 128, 68, 87, 65, 128, 68, 86, 73, 83, 86, 65, 82, 65, 128, 68, - 86, 128, 68, 85, 84, 73, 69, 83, 128, 68, 85, 82, 65, 84, 73, 79, 78, - 128, 68, 85, 82, 50, 128, 68, 85, 80, 79, 78, 68, 73, 85, 211, 68, 85, - 79, 88, 128, 68, 85, 79, 128, 68, 85, 78, 52, 128, 68, 85, 78, 51, 128, - 68, 85, 78, 179, 68, 85, 78, 128, 68, 85, 77, 128, 68, 85, 76, 128, 68, - 85, 204, 68, 85, 72, 128, 68, 85, 71, 85, 68, 128, 68, 85, 66, 50, 128, - 68, 85, 66, 128, 68, 85, 194, 68, 213, 68, 82, 89, 128, 68, 82, 217, 68, - 82, 85, 77, 128, 68, 82, 85, 205, 68, 82, 79, 80, 83, 128, 68, 82, 79, - 80, 45, 83, 72, 65, 68, 79, 87, 69, 196, 68, 82, 73, 86, 69, 128, 68, 82, - 73, 86, 197, 68, 82, 73, 204, 68, 82, 65, 85, 71, 72, 84, 211, 68, 82, - 65, 71, 79, 78, 128, 68, 82, 65, 70, 84, 73, 78, 199, 68, 82, 65, 67, 72, - 77, 65, 83, 128, 68, 82, 65, 67, 72, 77, 65, 128, 68, 82, 65, 67, 72, 77, - 193, 68, 79, 87, 78, 87, 65, 82, 68, 83, 128, 68, 79, 87, 78, 87, 65, 82, - 68, 211, 68, 79, 87, 78, 45, 80, 79, 73, 78, 84, 73, 78, 199, 68, 79, 87, - 78, 128, 68, 79, 86, 69, 128, 68, 79, 85, 66, 84, 128, 68, 79, 85, 66, - 76, 69, 196, 68, 79, 85, 66, 76, 69, 45, 76, 73, 78, 197, 68, 79, 85, 66, - 76, 69, 45, 69, 78, 68, 69, 196, 68, 79, 85, 66, 76, 69, 128, 68, 79, 84, - 84, 69, 68, 45, 80, 128, 68, 79, 84, 84, 69, 68, 45, 78, 128, 68, 79, 84, - 84, 69, 68, 45, 76, 128, 68, 79, 84, 84, 69, 68, 128, 68, 79, 84, 84, 69, - 196, 68, 79, 84, 83, 45, 56, 128, 68, 79, 84, 83, 45, 55, 56, 128, 68, - 79, 84, 83, 45, 55, 128, 68, 79, 84, 83, 45, 54, 56, 128, 68, 79, 84, 83, - 45, 54, 55, 56, 128, 68, 79, 84, 83, 45, 54, 55, 128, 68, 79, 84, 83, 45, - 54, 128, 68, 79, 84, 83, 45, 53, 56, 128, 68, 79, 84, 83, 45, 53, 55, 56, - 128, 68, 79, 84, 83, 45, 53, 55, 128, 68, 79, 84, 83, 45, 53, 54, 56, - 128, 68, 79, 84, 83, 45, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 53, 54, - 55, 128, 68, 79, 84, 83, 45, 53, 54, 128, 68, 79, 84, 83, 45, 53, 128, - 68, 79, 84, 83, 45, 52, 56, 128, 68, 79, 84, 83, 45, 52, 55, 56, 128, 68, - 79, 84, 83, 45, 52, 55, 128, 68, 79, 84, 83, 45, 52, 54, 56, 128, 68, 79, - 84, 83, 45, 52, 54, 55, 56, 128, 68, 79, 84, 83, 45, 52, 54, 55, 128, 68, - 79, 84, 83, 45, 52, 54, 128, 68, 79, 84, 83, 45, 52, 53, 56, 128, 68, 79, - 84, 83, 45, 52, 53, 55, 56, 128, 68, 79, 84, 83, 45, 52, 53, 55, 128, 68, - 79, 84, 83, 45, 52, 53, 54, 56, 128, 68, 79, 84, 83, 45, 52, 53, 54, 55, - 56, 128, 68, 79, 84, 83, 45, 52, 53, 54, 55, 128, 68, 79, 84, 83, 45, 52, - 53, 54, 128, 68, 79, 84, 83, 45, 52, 53, 128, 68, 79, 84, 83, 45, 52, - 128, 68, 79, 84, 83, 45, 51, 56, 128, 68, 79, 84, 83, 45, 51, 55, 56, - 128, 68, 79, 84, 83, 45, 51, 55, 128, 68, 79, 84, 83, 45, 51, 54, 56, - 128, 68, 79, 84, 83, 45, 51, 54, 55, 56, 128, 68, 79, 84, 83, 45, 51, 54, - 55, 128, 68, 79, 84, 83, 45, 51, 54, 128, 68, 79, 84, 83, 45, 51, 53, 56, - 128, 68, 79, 84, 83, 45, 51, 53, 55, 56, 128, 68, 79, 84, 83, 45, 51, 53, - 55, 128, 68, 79, 84, 83, 45, 51, 53, 54, 56, 128, 68, 79, 84, 83, 45, 51, - 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 51, 53, 54, 55, 128, 68, 79, 84, - 83, 45, 51, 53, 54, 128, 68, 79, 84, 83, 45, 51, 53, 128, 68, 79, 84, 83, - 45, 51, 52, 56, 128, 68, 79, 84, 83, 45, 51, 52, 55, 56, 128, 68, 79, 84, - 83, 45, 51, 52, 55, 128, 68, 79, 84, 83, 45, 51, 52, 54, 56, 128, 68, 79, - 84, 83, 45, 51, 52, 54, 55, 56, 128, 68, 79, 84, 83, 45, 51, 52, 54, 55, - 128, 68, 79, 84, 83, 45, 51, 52, 54, 128, 68, 79, 84, 83, 45, 51, 52, 53, - 56, 128, 68, 79, 84, 83, 45, 51, 52, 53, 55, 56, 128, 68, 79, 84, 83, 45, - 51, 52, 53, 55, 128, 68, 79, 84, 83, 45, 51, 52, 53, 54, 56, 128, 68, 79, - 84, 83, 45, 51, 52, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 51, 52, 53, - 54, 55, 128, 68, 79, 84, 83, 45, 51, 52, 53, 54, 128, 68, 79, 84, 83, 45, - 51, 52, 53, 128, 68, 79, 84, 83, 45, 51, 52, 128, 68, 79, 84, 83, 45, 51, - 128, 68, 79, 84, 83, 45, 50, 56, 128, 68, 79, 84, 83, 45, 50, 55, 56, - 128, 68, 79, 84, 83, 45, 50, 55, 128, 68, 79, 84, 83, 45, 50, 54, 56, - 128, 68, 79, 84, 83, 45, 50, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 54, - 55, 128, 68, 79, 84, 83, 45, 50, 54, 128, 68, 79, 84, 83, 45, 50, 53, 56, - 128, 68, 79, 84, 83, 45, 50, 53, 55, 56, 128, 68, 79, 84, 83, 45, 50, 53, - 55, 128, 68, 79, 84, 83, 45, 50, 53, 54, 56, 128, 68, 79, 84, 83, 45, 50, - 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 53, 54, 55, 128, 68, 79, 84, - 83, 45, 50, 53, 54, 128, 68, 79, 84, 83, 45, 50, 53, 128, 68, 79, 84, 83, - 45, 50, 52, 56, 128, 68, 79, 84, 83, 45, 50, 52, 55, 56, 128, 68, 79, 84, - 83, 45, 50, 52, 55, 128, 68, 79, 84, 83, 45, 50, 52, 54, 56, 128, 68, 79, - 84, 83, 45, 50, 52, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 52, 54, 55, - 128, 68, 79, 84, 83, 45, 50, 52, 54, 128, 68, 79, 84, 83, 45, 50, 52, 53, - 56, 128, 68, 79, 84, 83, 45, 50, 52, 53, 55, 56, 128, 68, 79, 84, 83, 45, - 50, 52, 53, 55, 128, 68, 79, 84, 83, 45, 50, 52, 53, 54, 56, 128, 68, 79, - 84, 83, 45, 50, 52, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 52, 53, - 54, 55, 128, 68, 79, 84, 83, 45, 50, 52, 53, 54, 128, 68, 79, 84, 83, 45, - 50, 52, 53, 128, 68, 79, 84, 83, 45, 50, 52, 128, 68, 79, 84, 83, 45, 50, - 51, 56, 128, 68, 79, 84, 83, 45, 50, 51, 55, 56, 128, 68, 79, 84, 83, 45, - 50, 51, 55, 128, 68, 79, 84, 83, 45, 50, 51, 54, 56, 128, 68, 79, 84, 83, - 45, 50, 51, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 51, 54, 55, 128, 68, - 79, 84, 83, 45, 50, 51, 54, 128, 68, 79, 84, 83, 45, 50, 51, 53, 56, 128, - 68, 79, 84, 83, 45, 50, 51, 53, 55, 56, 128, 68, 79, 84, 83, 45, 50, 51, - 53, 55, 128, 68, 79, 84, 83, 45, 50, 51, 53, 54, 56, 128, 68, 79, 84, 83, - 45, 50, 51, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 51, 53, 54, 55, - 128, 68, 79, 84, 83, 45, 50, 51, 53, 54, 128, 68, 79, 84, 83, 45, 50, 51, - 53, 128, 68, 79, 84, 83, 45, 50, 51, 52, 56, 128, 68, 79, 84, 83, 45, 50, - 51, 52, 55, 56, 128, 68, 79, 84, 83, 45, 50, 51, 52, 55, 128, 68, 79, 84, - 83, 45, 50, 51, 52, 54, 56, 128, 68, 79, 84, 83, 45, 50, 51, 52, 54, 55, - 56, 128, 68, 79, 84, 83, 45, 50, 51, 52, 54, 55, 128, 68, 79, 84, 83, 45, - 50, 51, 52, 54, 128, 68, 79, 84, 83, 45, 50, 51, 52, 53, 56, 128, 68, 79, - 84, 83, 45, 50, 51, 52, 53, 55, 56, 128, 68, 79, 84, 83, 45, 50, 51, 52, - 53, 55, 128, 68, 79, 84, 83, 45, 50, 51, 52, 53, 54, 56, 128, 68, 79, 84, - 83, 45, 50, 51, 52, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 50, 51, 52, - 53, 54, 55, 128, 68, 79, 84, 83, 45, 50, 51, 52, 53, 54, 128, 68, 79, 84, - 83, 45, 50, 51, 52, 53, 128, 68, 79, 84, 83, 45, 50, 51, 52, 128, 68, 79, - 84, 83, 45, 50, 51, 128, 68, 79, 84, 83, 45, 50, 128, 68, 79, 84, 83, 45, - 49, 56, 128, 68, 79, 84, 83, 45, 49, 55, 56, 128, 68, 79, 84, 83, 45, 49, - 55, 128, 68, 79, 84, 83, 45, 49, 54, 56, 128, 68, 79, 84, 83, 45, 49, 54, - 55, 56, 128, 68, 79, 84, 83, 45, 49, 54, 55, 128, 68, 79, 84, 83, 45, 49, - 54, 128, 68, 79, 84, 83, 45, 49, 53, 56, 128, 68, 79, 84, 83, 45, 49, 53, - 55, 56, 128, 68, 79, 84, 83, 45, 49, 53, 55, 128, 68, 79, 84, 83, 45, 49, - 53, 54, 56, 128, 68, 79, 84, 83, 45, 49, 53, 54, 55, 56, 128, 68, 79, 84, - 83, 45, 49, 53, 54, 55, 128, 68, 79, 84, 83, 45, 49, 53, 54, 128, 68, 79, - 84, 83, 45, 49, 53, 128, 68, 79, 84, 83, 45, 49, 52, 56, 128, 68, 79, 84, - 83, 45, 49, 52, 55, 56, 128, 68, 79, 84, 83, 45, 49, 52, 55, 128, 68, 79, - 84, 83, 45, 49, 52, 54, 56, 128, 68, 79, 84, 83, 45, 49, 52, 54, 55, 56, - 128, 68, 79, 84, 83, 45, 49, 52, 54, 55, 128, 68, 79, 84, 83, 45, 49, 52, - 54, 128, 68, 79, 84, 83, 45, 49, 52, 53, 56, 128, 68, 79, 84, 83, 45, 49, - 52, 53, 55, 56, 128, 68, 79, 84, 83, 45, 49, 52, 53, 55, 128, 68, 79, 84, - 83, 45, 49, 52, 53, 54, 56, 128, 68, 79, 84, 83, 45, 49, 52, 53, 54, 55, - 56, 128, 68, 79, 84, 83, 45, 49, 52, 53, 54, 55, 128, 68, 79, 84, 83, 45, - 49, 52, 53, 54, 128, 68, 79, 84, 83, 45, 49, 52, 53, 128, 68, 79, 84, 83, - 45, 49, 52, 128, 68, 79, 84, 83, 45, 49, 51, 56, 128, 68, 79, 84, 83, 45, - 49, 51, 55, 56, 128, 68, 79, 84, 83, 45, 49, 51, 55, 128, 68, 79, 84, 83, - 45, 49, 51, 54, 56, 128, 68, 79, 84, 83, 45, 49, 51, 54, 55, 56, 128, 68, - 79, 84, 83, 45, 49, 51, 54, 55, 128, 68, 79, 84, 83, 45, 49, 51, 54, 128, - 68, 79, 84, 83, 45, 49, 51, 53, 56, 128, 68, 79, 84, 83, 45, 49, 51, 53, - 55, 56, 128, 68, 79, 84, 83, 45, 49, 51, 53, 55, 128, 68, 79, 84, 83, 45, - 49, 51, 53, 54, 56, 128, 68, 79, 84, 83, 45, 49, 51, 53, 54, 55, 56, 128, - 68, 79, 84, 83, 45, 49, 51, 53, 54, 55, 128, 68, 79, 84, 83, 45, 49, 51, - 53, 54, 128, 68, 79, 84, 83, 45, 49, 51, 53, 128, 68, 79, 84, 83, 45, 49, - 51, 52, 56, 128, 68, 79, 84, 83, 45, 49, 51, 52, 55, 56, 128, 68, 79, 84, - 83, 45, 49, 51, 52, 55, 128, 68, 79, 84, 83, 45, 49, 51, 52, 54, 56, 128, - 68, 79, 84, 83, 45, 49, 51, 52, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, - 51, 52, 54, 55, 128, 68, 79, 84, 83, 45, 49, 51, 52, 54, 128, 68, 79, 84, - 83, 45, 49, 51, 52, 53, 56, 128, 68, 79, 84, 83, 45, 49, 51, 52, 53, 55, - 56, 128, 68, 79, 84, 83, 45, 49, 51, 52, 53, 55, 128, 68, 79, 84, 83, 45, - 49, 51, 52, 53, 54, 56, 128, 68, 79, 84, 83, 45, 49, 51, 52, 53, 54, 55, - 56, 128, 68, 79, 84, 83, 45, 49, 51, 52, 53, 54, 55, 128, 68, 79, 84, 83, - 45, 49, 51, 52, 53, 54, 128, 68, 79, 84, 83, 45, 49, 51, 52, 53, 128, 68, - 79, 84, 83, 45, 49, 51, 52, 128, 68, 79, 84, 83, 45, 49, 51, 128, 68, 79, - 84, 83, 45, 49, 50, 56, 128, 68, 79, 84, 83, 45, 49, 50, 55, 56, 128, 68, - 79, 84, 83, 45, 49, 50, 55, 128, 68, 79, 84, 83, 45, 49, 50, 54, 56, 128, - 68, 79, 84, 83, 45, 49, 50, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, - 54, 55, 128, 68, 79, 84, 83, 45, 49, 50, 54, 128, 68, 79, 84, 83, 45, 49, - 50, 53, 56, 128, 68, 79, 84, 83, 45, 49, 50, 53, 55, 56, 128, 68, 79, 84, - 83, 45, 49, 50, 53, 55, 128, 68, 79, 84, 83, 45, 49, 50, 53, 54, 56, 128, - 68, 79, 84, 83, 45, 49, 50, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, - 50, 53, 54, 55, 128, 68, 79, 84, 83, 45, 49, 50, 53, 54, 128, 68, 79, 84, - 83, 45, 49, 50, 53, 128, 68, 79, 84, 83, 45, 49, 50, 52, 56, 128, 68, 79, - 84, 83, 45, 49, 50, 52, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 52, 55, - 128, 68, 79, 84, 83, 45, 49, 50, 52, 54, 56, 128, 68, 79, 84, 83, 45, 49, - 50, 52, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 52, 54, 55, 128, 68, - 79, 84, 83, 45, 49, 50, 52, 54, 128, 68, 79, 84, 83, 45, 49, 50, 52, 53, - 56, 128, 68, 79, 84, 83, 45, 49, 50, 52, 53, 55, 56, 128, 68, 79, 84, 83, - 45, 49, 50, 52, 53, 55, 128, 68, 79, 84, 83, 45, 49, 50, 52, 53, 54, 56, - 128, 68, 79, 84, 83, 45, 49, 50, 52, 53, 54, 55, 56, 128, 68, 79, 84, 83, - 45, 49, 50, 52, 53, 54, 55, 128, 68, 79, 84, 83, 45, 49, 50, 52, 53, 54, - 128, 68, 79, 84, 83, 45, 49, 50, 52, 53, 128, 68, 79, 84, 83, 45, 49, 50, - 52, 128, 68, 79, 84, 83, 45, 49, 50, 51, 56, 128, 68, 79, 84, 83, 45, 49, - 50, 51, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, 55, 128, 68, 79, 84, - 83, 45, 49, 50, 51, 54, 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, 54, 55, - 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, 54, 55, 128, 68, 79, 84, 83, 45, - 49, 50, 51, 54, 128, 68, 79, 84, 83, 45, 49, 50, 51, 53, 56, 128, 68, 79, - 84, 83, 45, 49, 50, 51, 53, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, - 53, 55, 128, 68, 79, 84, 83, 45, 49, 50, 51, 53, 54, 56, 128, 68, 79, 84, - 83, 45, 49, 50, 51, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, - 53, 54, 55, 128, 68, 79, 84, 83, 45, 49, 50, 51, 53, 54, 128, 68, 79, 84, - 83, 45, 49, 50, 51, 53, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, 56, 128, - 68, 79, 84, 83, 45, 49, 50, 51, 52, 55, 56, 128, 68, 79, 84, 83, 45, 49, - 50, 51, 52, 55, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, 54, 56, 128, 68, - 79, 84, 83, 45, 49, 50, 51, 52, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, - 50, 51, 52, 54, 55, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, 54, 128, 68, - 79, 84, 83, 45, 49, 50, 51, 52, 53, 56, 128, 68, 79, 84, 83, 45, 49, 50, - 51, 52, 53, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, 53, 55, 128, - 68, 79, 84, 83, 45, 49, 50, 51, 52, 53, 54, 56, 128, 68, 79, 84, 83, 45, - 49, 50, 51, 52, 53, 54, 55, 56, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, - 53, 54, 55, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, 53, 54, 128, 68, 79, - 84, 83, 45, 49, 50, 51, 52, 53, 128, 68, 79, 84, 83, 45, 49, 50, 51, 52, - 128, 68, 79, 84, 83, 45, 49, 50, 51, 128, 68, 79, 84, 83, 45, 49, 50, - 128, 68, 79, 84, 83, 45, 49, 128, 68, 79, 84, 83, 128, 68, 79, 84, 76, - 69, 83, 211, 68, 79, 82, 85, 128, 68, 79, 79, 82, 128, 68, 79, 79, 78, - 71, 128, 68, 79, 78, 71, 128, 68, 79, 77, 65, 73, 206, 68, 79, 76, 76, - 65, 210, 68, 79, 76, 73, 85, 77, 128, 68, 79, 75, 77, 65, 73, 128, 68, - 79, 73, 84, 128, 68, 79, 71, 128, 68, 79, 69, 211, 68, 79, 68, 69, 75, - 65, 84, 65, 128, 68, 79, 66, 82, 79, 128, 68, 79, 65, 67, 72, 65, 83, 72, - 77, 69, 69, 128, 68, 79, 65, 67, 72, 65, 83, 72, 77, 69, 197, 68, 79, 65, - 128, 68, 79, 45, 79, 128, 68, 77, 128, 68, 205, 68, 76, 85, 128, 68, 76, - 79, 128, 68, 76, 73, 128, 68, 76, 69, 69, 128, 68, 76, 65, 128, 68, 76, - 128, 68, 75, 65, 82, 128, 68, 75, 65, 210, 68, 74, 69, 82, 86, 73, 128, - 68, 74, 69, 82, 86, 128, 68, 74, 69, 128, 68, 74, 65, 128, 68, 74, 128, - 68, 73, 86, 79, 82, 67, 197, 68, 73, 86, 73, 83, 73, 79, 78, 128, 68, 73, - 86, 73, 83, 73, 79, 206, 68, 73, 86, 73, 78, 65, 84, 73, 79, 78, 128, 68, - 73, 86, 73, 68, 69, 83, 128, 68, 73, 86, 73, 68, 69, 82, 128, 68, 73, 86, - 73, 68, 69, 196, 68, 73, 86, 73, 68, 69, 128, 68, 73, 86, 73, 68, 197, - 68, 73, 86, 69, 82, 71, 69, 78, 67, 69, 128, 68, 73, 84, 84, 207, 68, 73, - 83, 84, 79, 82, 84, 73, 79, 78, 128, 68, 73, 83, 84, 73, 78, 71, 85, 73, - 83, 72, 128, 68, 73, 83, 80, 69, 82, 83, 73, 79, 78, 128, 68, 73, 83, 73, - 77, 79, 85, 128, 68, 73, 83, 72, 128, 68, 73, 83, 67, 79, 78, 84, 73, 78, - 85, 79, 85, 211, 68, 73, 83, 195, 68, 73, 83, 65, 66, 76, 69, 196, 68, - 73, 82, 71, 193, 68, 73, 82, 69, 67, 84, 76, 217, 68, 73, 82, 69, 67, 84, - 73, 79, 78, 65, 204, 68, 73, 80, 84, 69, 128, 68, 73, 80, 80, 69, 82, - 128, 68, 73, 80, 76, 79, 85, 78, 128, 68, 73, 80, 76, 73, 128, 68, 73, - 80, 76, 201, 68, 73, 78, 71, 66, 65, 212, 68, 73, 206, 68, 73, 77, 77, - 73, 78, 71, 128, 68, 73, 77, 73, 78, 85, 84, 73, 79, 78, 45, 51, 128, 68, - 73, 77, 73, 78, 85, 84, 73, 79, 78, 45, 50, 128, 68, 73, 77, 73, 78, 85, - 84, 73, 79, 78, 45, 49, 128, 68, 73, 77, 73, 78, 73, 83, 72, 77, 69, 78, - 84, 128, 68, 73, 77, 73, 68, 73, 193, 68, 73, 77, 69, 78, 83, 73, 79, 78, - 65, 204, 68, 73, 77, 69, 78, 83, 73, 79, 206, 68, 73, 77, 50, 128, 68, - 73, 76, 128, 68, 73, 71, 82, 65, 80, 72, 128, 68, 73, 71, 82, 65, 80, - 200, 68, 73, 71, 82, 65, 77, 77, 79, 211, 68, 73, 71, 82, 65, 77, 77, - 193, 68, 73, 71, 82, 65, 205, 68, 73, 71, 79, 82, 71, 79, 78, 128, 68, - 73, 71, 79, 82, 71, 79, 206, 68, 73, 71, 65, 77, 77, 65, 128, 68, 73, 71, - 193, 68, 73, 70, 84, 79, 71, 71, 79, 211, 68, 73, 70, 79, 78, 73, 65, 83, - 128, 68, 73, 70, 70, 73, 67, 85, 76, 84, 217, 68, 73, 70, 70, 73, 67, 85, - 76, 84, 73, 69, 83, 128, 68, 73, 70, 70, 69, 82, 69, 78, 84, 73, 65, 76, - 128, 68, 73, 70, 70, 69, 82, 69, 78, 67, 197, 68, 73, 70, 65, 84, 128, - 68, 73, 69, 83, 73, 83, 128, 68, 73, 69, 83, 73, 211, 68, 73, 69, 80, - 128, 68, 73, 197, 68, 73, 66, 128, 68, 73, 65, 84, 79, 78, 79, 206, 68, - 73, 65, 84, 79, 78, 73, 75, 201, 68, 73, 65, 83, 84, 79, 76, 201, 68, 73, - 65, 77, 79, 78, 68, 128, 68, 73, 65, 77, 79, 78, 196, 68, 73, 65, 77, 69, - 84, 69, 210, 68, 73, 65, 76, 89, 84, 73, 75, 65, 128, 68, 73, 65, 76, 89, - 84, 73, 75, 193, 68, 73, 65, 76, 69, 67, 84, 45, 208, 68, 73, 65, 71, 79, - 78, 65, 76, 128, 68, 73, 65, 71, 79, 78, 65, 204, 68, 73, 65, 69, 82, 69, - 83, 73, 90, 69, 196, 68, 73, 65, 69, 82, 69, 83, 73, 83, 128, 68, 73, 65, - 69, 82, 69, 83, 73, 211, 68, 72, 79, 85, 128, 68, 72, 79, 79, 128, 68, - 72, 79, 128, 68, 72, 73, 128, 68, 72, 72, 85, 128, 68, 72, 72, 79, 79, - 128, 68, 72, 72, 79, 128, 68, 72, 72, 73, 128, 68, 72, 72, 69, 69, 128, - 68, 72, 72, 69, 128, 68, 72, 72, 65, 128, 68, 72, 69, 69, 128, 68, 72, - 65, 82, 77, 65, 128, 68, 72, 65, 76, 69, 84, 72, 128, 68, 72, 65, 76, 65, - 84, 72, 128, 68, 72, 65, 76, 128, 68, 72, 65, 68, 72, 69, 128, 68, 72, - 65, 65, 76, 85, 128, 68, 72, 65, 128, 68, 69, 90, 200, 68, 69, 89, 84, - 69, 82, 79, 213, 68, 69, 89, 84, 69, 82, 79, 211, 68, 69, 88, 73, 65, - 128, 68, 69, 86, 73, 67, 197, 68, 69, 86, 69, 76, 79, 80, 77, 69, 78, 84, - 128, 68, 69, 85, 78, 71, 128, 68, 69, 83, 73, 128, 68, 69, 83, 67, 82, - 73, 80, 84, 73, 79, 206, 68, 69, 83, 67, 69, 78, 68, 73, 78, 199, 68, 69, - 83, 67, 69, 78, 68, 69, 82, 128, 68, 69, 82, 69, 84, 45, 72, 73, 68, 69, - 84, 128, 68, 69, 82, 69, 84, 128, 68, 69, 80, 65, 82, 84, 85, 82, 69, - 128, 68, 69, 80, 65, 82, 84, 73, 78, 199, 68, 69, 78, 84, 73, 83, 84, 82, - 217, 68, 69, 78, 84, 65, 204, 68, 69, 78, 79, 77, 73, 78, 65, 84, 79, 82, - 128, 68, 69, 78, 79, 77, 73, 78, 65, 84, 79, 210, 68, 69, 78, 78, 69, 78, - 128, 68, 69, 78, 71, 128, 68, 69, 78, 197, 68, 69, 78, 65, 82, 73, 85, - 211, 68, 69, 76, 84, 65, 128, 68, 69, 76, 84, 193, 68, 69, 76, 84, 128, - 68, 69, 76, 80, 72, 73, 195, 68, 69, 76, 73, 86, 69, 82, 65, 78, 67, 69, - 128, 68, 69, 76, 73, 77, 73, 84, 69, 82, 128, 68, 69, 76, 73, 77, 73, 84, - 69, 210, 68, 69, 76, 69, 84, 69, 128, 68, 69, 76, 69, 84, 197, 68, 69, - 75, 65, 128, 68, 69, 75, 128, 68, 69, 73, 128, 68, 69, 72, 73, 128, 68, - 69, 71, 82, 69, 197, 68, 69, 70, 73, 78, 73, 84, 73, 79, 78, 128, 68, 69, - 70, 69, 67, 84, 73, 86, 69, 78, 69, 83, 211, 68, 69, 69, 82, 128, 68, 69, - 69, 76, 128, 68, 69, 67, 82, 69, 83, 67, 69, 78, 68, 79, 128, 68, 69, 67, - 82, 69, 65, 83, 69, 128, 68, 69, 67, 73, 83, 73, 86, 69, 78, 69, 83, 83, - 128, 68, 69, 67, 73, 77, 65, 204, 68, 69, 67, 69, 77, 66, 69, 82, 128, - 68, 69, 67, 65, 89, 69, 68, 128, 68, 69, 66, 73, 212, 68, 69, 65, 84, 72, - 128, 68, 69, 65, 68, 128, 68, 68, 87, 65, 128, 68, 68, 85, 88, 128, 68, - 68, 85, 84, 128, 68, 68, 85, 82, 88, 128, 68, 68, 85, 82, 128, 68, 68, - 85, 80, 128, 68, 68, 85, 79, 88, 128, 68, 68, 85, 79, 80, 128, 68, 68, - 85, 79, 128, 68, 68, 85, 128, 68, 68, 79, 88, 128, 68, 68, 79, 84, 128, - 68, 68, 79, 80, 128, 68, 68, 79, 65, 128, 68, 68, 73, 88, 128, 68, 68, - 73, 84, 128, 68, 68, 73, 80, 128, 68, 68, 73, 69, 88, 128, 68, 68, 73, - 69, 80, 128, 68, 68, 73, 69, 128, 68, 68, 73, 128, 68, 68, 72, 79, 128, - 68, 68, 72, 65, 128, 68, 68, 69, 88, 128, 68, 68, 69, 80, 128, 68, 68, - 69, 69, 128, 68, 68, 69, 128, 68, 68, 68, 72, 65, 128, 68, 68, 68, 65, - 128, 68, 68, 65, 89, 65, 78, 78, 65, 128, 68, 68, 65, 88, 128, 68, 68, - 65, 84, 128, 68, 68, 65, 80, 128, 68, 68, 65, 76, 128, 68, 68, 65, 204, - 68, 68, 65, 72, 65, 76, 128, 68, 68, 65, 72, 65, 204, 68, 68, 65, 65, - 128, 68, 194, 68, 65, 217, 68, 65, 86, 73, 89, 65, 78, 73, 128, 68, 65, - 86, 73, 68, 128, 68, 65, 84, 197, 68, 65, 83, 73, 65, 128, 68, 65, 83, - 72, 69, 196, 68, 65, 83, 72, 128, 68, 65, 83, 200, 68, 65, 83, 69, 73, - 65, 128, 68, 65, 82, 84, 128, 68, 65, 82, 75, 69, 78, 73, 78, 71, 128, - 68, 65, 82, 75, 69, 78, 73, 78, 199, 68, 65, 82, 203, 68, 65, 82, 71, 65, - 128, 68, 65, 82, 65, 52, 128, 68, 65, 82, 65, 51, 128, 68, 65, 82, 128, - 68, 65, 80, 45, 80, 82, 65, 205, 68, 65, 80, 45, 80, 73, 201, 68, 65, 80, - 45, 77, 85, 79, 217, 68, 65, 80, 45, 66, 85, 79, 206, 68, 65, 80, 45, 66, - 69, 201, 68, 65, 208, 68, 65, 78, 84, 65, 74, 193, 68, 65, 78, 71, 128, - 68, 65, 78, 199, 68, 65, 78, 68, 65, 128, 68, 65, 77, 80, 128, 68, 65, - 77, 208, 68, 65, 77, 77, 65, 84, 65, 78, 128, 68, 65, 77, 77, 65, 84, 65, - 206, 68, 65, 77, 77, 65, 128, 68, 65, 77, 77, 193, 68, 65, 77, 65, 82, - 85, 128, 68, 65, 76, 69, 84, 72, 128, 68, 65, 76, 69, 84, 128, 68, 65, - 76, 69, 212, 68, 65, 76, 68, 65, 128, 68, 65, 76, 65, 84, 72, 128, 68, - 65, 76, 65, 84, 200, 68, 65, 76, 65, 84, 128, 68, 65, 73, 82, 128, 68, - 65, 73, 78, 71, 128, 68, 65, 72, 89, 65, 65, 85, 83, 72, 45, 50, 128, 68, - 65, 72, 89, 65, 65, 85, 83, 72, 128, 68, 65, 71, 83, 128, 68, 65, 71, 71, - 69, 82, 128, 68, 65, 71, 69, 83, 72, 128, 68, 65, 71, 69, 83, 200, 68, - 65, 71, 66, 65, 83, 73, 78, 78, 65, 128, 68, 65, 71, 65, 218, 68, 65, 71, - 65, 76, 71, 65, 128, 68, 65, 199, 68, 65, 69, 78, 71, 128, 68, 65, 69, - 199, 68, 65, 68, 128, 68, 65, 196, 68, 65, 65, 83, 85, 128, 68, 65, 65, - 68, 72, 85, 128, 68, 48, 54, 55, 72, 128, 68, 48, 54, 55, 71, 128, 68, - 48, 54, 55, 70, 128, 68, 48, 54, 55, 69, 128, 68, 48, 54, 55, 68, 128, - 68, 48, 54, 55, 67, 128, 68, 48, 54, 55, 66, 128, 68, 48, 54, 55, 65, - 128, 68, 48, 54, 55, 128, 68, 48, 54, 54, 128, 68, 48, 54, 53, 128, 68, - 48, 54, 52, 128, 68, 48, 54, 51, 128, 68, 48, 54, 50, 128, 68, 48, 54, - 49, 128, 68, 48, 54, 48, 128, 68, 48, 53, 57, 128, 68, 48, 53, 56, 128, - 68, 48, 53, 55, 128, 68, 48, 53, 54, 128, 68, 48, 53, 53, 128, 68, 48, - 53, 52, 65, 128, 68, 48, 53, 52, 128, 68, 48, 53, 51, 128, 68, 48, 53, - 50, 65, 128, 68, 48, 53, 50, 128, 68, 48, 53, 49, 128, 68, 48, 53, 48, - 73, 128, 68, 48, 53, 48, 72, 128, 68, 48, 53, 48, 71, 128, 68, 48, 53, - 48, 70, 128, 68, 48, 53, 48, 69, 128, 68, 48, 53, 48, 68, 128, 68, 48, - 53, 48, 67, 128, 68, 48, 53, 48, 66, 128, 68, 48, 53, 48, 65, 128, 68, - 48, 53, 48, 128, 68, 48, 52, 57, 128, 68, 48, 52, 56, 65, 128, 68, 48, - 52, 56, 128, 68, 48, 52, 55, 128, 68, 48, 52, 54, 65, 128, 68, 48, 52, - 54, 128, 68, 48, 52, 53, 128, 68, 48, 52, 52, 128, 68, 48, 52, 51, 128, - 68, 48, 52, 50, 128, 68, 48, 52, 49, 128, 68, 48, 52, 48, 128, 68, 48, - 51, 57, 128, 68, 48, 51, 56, 128, 68, 48, 51, 55, 128, 68, 48, 51, 54, - 128, 68, 48, 51, 53, 128, 68, 48, 51, 52, 65, 128, 68, 48, 51, 52, 128, - 68, 48, 51, 51, 128, 68, 48, 51, 50, 128, 68, 48, 51, 49, 65, 128, 68, - 48, 51, 49, 128, 68, 48, 51, 48, 128, 68, 48, 50, 57, 128, 68, 48, 50, - 56, 128, 68, 48, 50, 55, 65, 128, 68, 48, 50, 55, 128, 68, 48, 50, 54, - 128, 68, 48, 50, 53, 128, 68, 48, 50, 52, 128, 68, 48, 50, 51, 128, 68, - 48, 50, 50, 128, 68, 48, 50, 49, 128, 68, 48, 50, 48, 128, 68, 48, 49, - 57, 128, 68, 48, 49, 56, 128, 68, 48, 49, 55, 128, 68, 48, 49, 54, 128, - 68, 48, 49, 53, 128, 68, 48, 49, 52, 128, 68, 48, 49, 51, 128, 68, 48, - 49, 50, 128, 68, 48, 49, 49, 128, 68, 48, 49, 48, 128, 68, 48, 48, 57, - 128, 68, 48, 48, 56, 65, 128, 68, 48, 48, 56, 128, 68, 48, 48, 55, 128, - 68, 48, 48, 54, 128, 68, 48, 48, 53, 128, 68, 48, 48, 52, 128, 68, 48, - 48, 51, 128, 68, 48, 48, 50, 128, 68, 48, 48, 49, 128, 67, 89, 88, 128, - 67, 89, 84, 128, 67, 89, 82, 88, 128, 67, 89, 82, 69, 78, 65, 73, 195, - 67, 89, 82, 128, 67, 89, 80, 82, 73, 79, 212, 67, 89, 80, 69, 82, 85, 83, - 128, 67, 89, 80, 128, 67, 89, 76, 73, 78, 68, 82, 73, 67, 73, 84, 89, - 128, 67, 89, 65, 128, 67, 89, 128, 67, 87, 79, 79, 128, 67, 87, 79, 128, - 67, 87, 73, 73, 128, 67, 87, 73, 128, 67, 87, 69, 79, 82, 84, 72, 128, - 67, 87, 69, 128, 67, 87, 65, 65, 128, 67, 85, 88, 128, 67, 85, 84, 128, - 67, 85, 212, 67, 85, 83, 84, 79, 77, 69, 210, 67, 85, 82, 88, 128, 67, - 85, 82, 86, 73, 78, 199, 67, 85, 82, 86, 69, 196, 67, 85, 82, 86, 69, - 128, 67, 85, 82, 86, 197, 67, 85, 82, 82, 69, 78, 84, 128, 67, 85, 82, - 82, 69, 78, 212, 67, 85, 82, 76, 217, 67, 85, 82, 76, 128, 67, 85, 82, - 128, 67, 85, 80, 128, 67, 85, 208, 67, 85, 79, 88, 128, 67, 85, 79, 80, - 128, 67, 85, 79, 128, 67, 85, 205, 67, 85, 66, 69, 68, 128, 67, 85, 66, - 197, 67, 85, 65, 84, 82, 73, 76, 76, 79, 128, 67, 85, 65, 84, 82, 73, 76, - 76, 207, 67, 85, 128, 67, 82, 89, 80, 84, 79, 71, 82, 65, 77, 77, 73, - 195, 67, 82, 85, 90, 69, 73, 82, 207, 67, 82, 79, 83, 83, 73, 78, 199, - 67, 82, 79, 83, 83, 72, 65, 84, 67, 200, 67, 82, 79, 83, 83, 69, 68, 45, - 84, 65, 73, 76, 128, 67, 82, 79, 83, 83, 69, 196, 67, 82, 79, 83, 83, 66, - 79, 78, 69, 83, 128, 67, 82, 79, 83, 83, 128, 67, 82, 79, 83, 211, 67, - 82, 79, 80, 128, 67, 82, 79, 73, 88, 128, 67, 82, 69, 83, 67, 69, 78, 84, - 128, 67, 82, 69, 83, 67, 69, 78, 212, 67, 82, 69, 68, 73, 212, 67, 82, - 69, 65, 84, 73, 86, 197, 67, 79, 88, 128, 67, 79, 87, 128, 67, 79, 86, - 69, 82, 128, 67, 79, 85, 78, 84, 73, 78, 199, 67, 79, 85, 78, 84, 69, 82, - 83, 73, 78, 75, 128, 67, 79, 85, 78, 84, 69, 82, 66, 79, 82, 69, 128, 67, - 79, 85, 78, 67, 73, 204, 67, 79, 84, 128, 67, 79, 82, 82, 69, 83, 80, 79, - 78, 68, 211, 67, 79, 82, 82, 69, 67, 84, 128, 67, 79, 82, 80, 83, 69, - 128, 67, 79, 82, 80, 79, 82, 65, 84, 73, 79, 78, 128, 67, 79, 82, 79, 78, - 73, 83, 128, 67, 79, 82, 78, 69, 82, 83, 128, 67, 79, 82, 78, 69, 82, - 128, 67, 79, 82, 78, 69, 210, 67, 79, 80, 89, 82, 73, 71, 72, 84, 128, - 67, 79, 80, 89, 82, 73, 71, 72, 212, 67, 79, 80, 89, 128, 67, 79, 80, 82, - 79, 68, 85, 67, 84, 128, 67, 79, 80, 128, 67, 79, 79, 128, 67, 79, 78, - 86, 69, 82, 71, 73, 78, 199, 67, 79, 78, 84, 82, 79, 204, 67, 79, 78, 84, - 82, 65, 82, 73, 69, 84, 89, 128, 67, 79, 78, 84, 82, 65, 67, 84, 73, 79, - 78, 128, 67, 79, 78, 84, 79, 85, 82, 69, 196, 67, 79, 78, 84, 79, 85, - 210, 67, 79, 78, 84, 69, 78, 84, 73, 79, 78, 128, 67, 79, 78, 84, 69, 77, - 80, 76, 65, 84, 73, 79, 78, 128, 67, 79, 78, 84, 65, 73, 78, 211, 67, 79, - 78, 84, 65, 73, 78, 73, 78, 199, 67, 79, 78, 84, 65, 73, 206, 67, 79, 78, - 84, 65, 67, 84, 128, 67, 79, 78, 83, 84, 65, 78, 84, 128, 67, 79, 78, 83, - 84, 65, 78, 212, 67, 79, 78, 83, 84, 65, 78, 67, 89, 128, 67, 79, 78, 83, - 79, 78, 65, 78, 212, 67, 79, 78, 83, 69, 67, 85, 84, 73, 86, 197, 67, 79, - 78, 74, 85, 78, 67, 84, 73, 79, 78, 128, 67, 79, 78, 74, 85, 71, 65, 84, - 197, 67, 79, 78, 74, 79, 73, 78, 73, 78, 199, 67, 79, 78, 73, 67, 65, - 204, 67, 79, 78, 71, 82, 85, 69, 78, 212, 67, 79, 78, 71, 82, 65, 84, 85, - 76, 65, 84, 73, 79, 78, 128, 67, 79, 78, 70, 76, 73, 67, 84, 128, 67, 79, - 78, 67, 65, 86, 69, 45, 83, 73, 68, 69, 196, 67, 79, 78, 67, 65, 86, 69, - 45, 80, 79, 73, 78, 84, 69, 196, 67, 79, 78, 128, 67, 79, 77, 80, 79, 83, - 73, 84, 73, 79, 78, 128, 67, 79, 77, 80, 79, 83, 73, 84, 73, 79, 206, 67, - 79, 77, 80, 76, 73, 65, 78, 67, 69, 128, 67, 79, 77, 80, 76, 69, 84, 73, - 79, 78, 128, 67, 79, 77, 80, 76, 69, 84, 69, 68, 128, 67, 79, 77, 80, 76, - 69, 77, 69, 78, 84, 128, 67, 79, 77, 80, 65, 82, 69, 128, 67, 79, 77, 77, - 79, 206, 67, 79, 77, 77, 69, 82, 67, 73, 65, 204, 67, 79, 77, 77, 65, - 128, 67, 79, 77, 77, 193, 67, 79, 77, 73, 78, 199, 67, 79, 77, 69, 84, - 128, 67, 79, 77, 66, 128, 67, 79, 76, 85, 77, 78, 128, 67, 79, 76, 79, - 82, 128, 67, 79, 76, 76, 128, 67, 79, 70, 70, 73, 78, 128, 67, 79, 69, - 78, 71, 128, 67, 79, 68, 65, 128, 67, 79, 65, 128, 67, 79, 128, 67, 77, - 128, 67, 205, 67, 76, 85, 83, 84, 69, 210, 67, 76, 85, 66, 45, 83, 80, - 79, 75, 69, 196, 67, 76, 85, 66, 128, 67, 76, 85, 194, 67, 76, 79, 85, - 68, 128, 67, 76, 79, 85, 196, 67, 76, 79, 84, 72, 69, 83, 128, 67, 76, - 79, 84, 72, 128, 67, 76, 79, 83, 69, 78, 69, 83, 83, 128, 67, 76, 79, 83, - 69, 68, 128, 67, 76, 79, 83, 69, 196, 67, 76, 79, 83, 197, 67, 76, 79, - 67, 75, 87, 73, 83, 197, 67, 76, 73, 86, 73, 83, 128, 67, 76, 73, 78, 71, - 73, 78, 199, 67, 76, 73, 77, 65, 67, 85, 83, 128, 67, 76, 73, 70, 70, - 128, 67, 76, 73, 67, 75, 128, 67, 76, 69, 70, 45, 50, 128, 67, 76, 69, - 70, 45, 49, 128, 67, 76, 69, 70, 128, 67, 76, 69, 198, 67, 76, 69, 65, - 210, 67, 76, 65, 87, 128, 67, 76, 65, 78, 128, 67, 73, 88, 128, 67, 73, - 86, 73, 76, 73, 65, 78, 128, 67, 73, 84, 128, 67, 73, 82, 67, 85, 77, 70, - 76, 69, 88, 128, 67, 73, 82, 67, 85, 77, 70, 76, 69, 216, 67, 73, 82, 67, - 85, 76, 65, 84, 73, 79, 206, 67, 73, 82, 67, 76, 69, 83, 128, 67, 73, 82, - 67, 76, 69, 128, 67, 73, 80, 128, 67, 73, 73, 128, 67, 73, 69, 88, 128, - 67, 73, 69, 85, 67, 45, 83, 83, 65, 78, 71, 80, 73, 69, 85, 80, 128, 67, - 73, 69, 85, 67, 45, 80, 73, 69, 85, 80, 128, 67, 73, 69, 85, 67, 45, 73, - 69, 85, 78, 71, 128, 67, 73, 69, 85, 195, 67, 73, 69, 84, 128, 67, 73, - 69, 80, 128, 67, 73, 69, 128, 67, 73, 128, 67, 72, 89, 88, 128, 67, 72, - 89, 84, 128, 67, 72, 89, 82, 88, 128, 67, 72, 89, 82, 128, 67, 72, 89, - 80, 128, 67, 72, 85, 88, 128, 67, 72, 85, 82, 88, 128, 67, 72, 85, 82, - 67, 72, 128, 67, 72, 85, 82, 128, 67, 72, 85, 80, 128, 67, 72, 85, 79, - 88, 128, 67, 72, 85, 79, 84, 128, 67, 72, 85, 79, 80, 128, 67, 72, 85, - 79, 128, 67, 72, 85, 76, 65, 128, 67, 72, 85, 128, 67, 72, 82, 89, 83, - 65, 78, 84, 72, 69, 77, 85, 77, 128, 67, 72, 82, 79, 78, 79, 85, 128, 67, - 72, 82, 79, 78, 79, 78, 128, 67, 72, 82, 79, 77, 193, 67, 72, 82, 79, - 193, 67, 72, 82, 73, 86, 73, 128, 67, 72, 79, 88, 128, 67, 72, 79, 84, - 128, 67, 72, 79, 82, 69, 86, 77, 193, 67, 72, 79, 80, 128, 67, 72, 79, - 75, 69, 128, 67, 72, 79, 69, 128, 67, 72, 79, 65, 128, 67, 72, 79, 128, - 67, 72, 207, 67, 72, 73, 84, 85, 69, 85, 77, 83, 83, 65, 78, 71, 83, 73, - 79, 83, 128, 67, 72, 73, 84, 85, 69, 85, 77, 83, 83, 65, 78, 71, 67, 73, - 69, 85, 67, 128, 67, 72, 73, 84, 85, 69, 85, 77, 83, 73, 79, 83, 128, 67, - 72, 73, 84, 85, 69, 85, 77, 67, 73, 69, 85, 67, 128, 67, 72, 73, 84, 85, - 69, 85, 77, 67, 72, 73, 69, 85, 67, 72, 128, 67, 72, 73, 82, 79, 78, 128, - 67, 72, 73, 82, 69, 84, 128, 67, 72, 73, 78, 71, 128, 67, 72, 73, 78, 69, - 83, 197, 67, 72, 73, 78, 128, 67, 72, 73, 76, 76, 213, 67, 72, 73, 76, - 68, 128, 67, 72, 73, 76, 128, 67, 72, 73, 75, 201, 67, 72, 73, 69, 85, - 67, 72, 45, 75, 72, 73, 69, 85, 75, 72, 128, 67, 72, 73, 69, 85, 67, 72, - 45, 72, 73, 69, 85, 72, 128, 67, 72, 73, 69, 85, 67, 200, 67, 72, 73, - 128, 67, 72, 201, 67, 72, 72, 65, 128, 67, 72, 69, 88, 128, 67, 72, 69, - 86, 82, 79, 206, 67, 72, 69, 84, 128, 67, 72, 69, 83, 211, 67, 72, 69, - 80, 128, 67, 72, 69, 206, 67, 72, 69, 73, 78, 65, 80, 128, 67, 72, 69, - 73, 75, 72, 69, 73, 128, 67, 72, 69, 69, 128, 67, 72, 69, 67, 75, 128, - 67, 72, 69, 67, 203, 67, 72, 197, 67, 72, 65, 88, 128, 67, 72, 65, 86, - 73, 89, 65, 78, 73, 128, 67, 72, 65, 84, 84, 65, 87, 65, 128, 67, 72, 65, - 84, 128, 67, 72, 65, 82, 73, 79, 84, 128, 67, 72, 65, 82, 73, 79, 212, - 67, 72, 65, 82, 65, 67, 84, 69, 82, 83, 128, 67, 72, 65, 82, 65, 67, 84, - 69, 82, 128, 67, 72, 65, 82, 128, 67, 72, 65, 80, 128, 67, 72, 65, 78, - 71, 69, 128, 67, 72, 65, 78, 71, 128, 67, 72, 65, 78, 128, 67, 72, 65, - 77, 75, 79, 128, 67, 72, 65, 77, 73, 76, 79, 78, 128, 67, 72, 65, 77, 73, - 76, 73, 128, 67, 72, 65, 73, 82, 128, 67, 72, 65, 73, 78, 83, 128, 67, - 72, 65, 68, 65, 128, 67, 72, 65, 196, 67, 72, 65, 65, 128, 67, 69, 88, - 128, 67, 69, 82, 69, 83, 128, 67, 69, 82, 69, 75, 128, 67, 69, 82, 45, - 87, 65, 128, 67, 69, 80, 128, 67, 69, 79, 78, 71, 67, 72, 73, 69, 85, 77, - 83, 83, 65, 78, 71, 83, 73, 79, 83, 128, 67, 69, 79, 78, 71, 67, 72, 73, - 69, 85, 77, 83, 83, 65, 78, 71, 67, 73, 69, 85, 67, 128, 67, 69, 79, 78, - 71, 67, 72, 73, 69, 85, 77, 83, 73, 79, 83, 128, 67, 69, 79, 78, 71, 67, - 72, 73, 69, 85, 77, 67, 73, 69, 85, 67, 128, 67, 69, 79, 78, 71, 67, 72, - 73, 69, 85, 77, 67, 72, 73, 69, 85, 67, 72, 128, 67, 69, 78, 84, 85, 82, - 73, 65, 204, 67, 69, 78, 84, 82, 69, 76, 73, 78, 197, 67, 69, 78, 84, 82, - 69, 196, 67, 69, 78, 84, 82, 69, 128, 67, 69, 78, 84, 82, 197, 67, 69, - 78, 128, 67, 69, 76, 83, 73, 85, 83, 128, 67, 69, 73, 82, 84, 128, 67, - 69, 73, 76, 73, 78, 71, 128, 67, 69, 69, 128, 67, 69, 68, 73, 76, 76, 65, - 128, 67, 69, 68, 73, 76, 76, 193, 67, 69, 68, 201, 67, 69, 67, 69, 75, - 128, 67, 69, 67, 65, 75, 128, 67, 69, 67, 65, 203, 67, 69, 65, 76, 67, - 128, 67, 67, 85, 128, 67, 67, 79, 128, 67, 67, 73, 128, 67, 67, 72, 85, - 128, 67, 67, 72, 79, 128, 67, 67, 72, 73, 128, 67, 67, 72, 69, 69, 128, - 67, 67, 72, 69, 128, 67, 67, 72, 65, 65, 128, 67, 67, 72, 65, 128, 67, - 67, 69, 69, 128, 67, 67, 69, 128, 67, 67, 65, 65, 128, 67, 67, 65, 128, - 67, 65, 89, 78, 128, 67, 65, 89, 65, 78, 78, 65, 128, 67, 65, 88, 128, - 67, 65, 86, 69, 128, 67, 65, 85, 84, 73, 79, 206, 67, 65, 85, 76, 68, 82, - 79, 78, 128, 67, 65, 85, 68, 65, 128, 67, 65, 84, 65, 87, 65, 128, 67, - 65, 84, 128, 67, 65, 83, 84, 76, 69, 128, 67, 65, 82, 89, 83, 84, 73, 65, - 206, 67, 65, 82, 84, 128, 67, 65, 82, 82, 73, 65, 71, 197, 67, 65, 82, - 80, 69, 78, 84, 82, 217, 67, 65, 82, 79, 78, 128, 67, 65, 82, 79, 206, - 67, 65, 82, 73, 203, 67, 65, 82, 73, 65, 206, 67, 65, 82, 69, 84, 128, - 67, 65, 82, 69, 212, 67, 65, 82, 197, 67, 65, 82, 128, 67, 65, 210, 67, - 65, 80, 84, 73, 86, 69, 128, 67, 65, 80, 82, 73, 67, 79, 82, 78, 128, 67, - 65, 80, 79, 128, 67, 65, 80, 73, 84, 65, 76, 128, 67, 65, 78, 84, 73, 76, - 76, 65, 84, 73, 79, 206, 67, 65, 78, 199, 67, 65, 78, 68, 82, 65, 66, 73, - 78, 68, 85, 128, 67, 65, 78, 68, 82, 65, 66, 73, 78, 68, 213, 67, 65, 78, - 68, 82, 65, 128, 67, 65, 78, 68, 82, 193, 67, 65, 78, 67, 69, 82, 128, - 67, 65, 78, 67, 69, 76, 76, 65, 84, 73, 79, 206, 67, 65, 78, 67, 69, 76, - 128, 67, 65, 78, 67, 69, 204, 67, 65, 78, 128, 67, 65, 77, 78, 85, 195, - 67, 65, 76, 89, 65, 128, 67, 65, 76, 89, 193, 67, 65, 76, 76, 128, 67, - 65, 76, 67, 128, 67, 65, 75, 82, 65, 128, 67, 65, 69, 83, 85, 82, 65, - 128, 67, 65, 68, 85, 67, 69, 85, 83, 128, 67, 65, 68, 193, 67, 65, 65, - 78, 71, 128, 67, 65, 65, 73, 128, 67, 193, 67, 48, 50, 52, 128, 67, 48, - 50, 51, 128, 67, 48, 50, 50, 128, 67, 48, 50, 49, 128, 67, 48, 50, 48, - 128, 67, 48, 49, 57, 128, 67, 48, 49, 56, 128, 67, 48, 49, 55, 128, 67, - 48, 49, 54, 128, 67, 48, 49, 53, 128, 67, 48, 49, 52, 128, 67, 48, 49, - 51, 128, 67, 48, 49, 50, 128, 67, 48, 49, 49, 128, 67, 48, 49, 48, 65, - 128, 67, 48, 49, 48, 128, 67, 48, 48, 57, 128, 67, 48, 48, 56, 128, 67, - 48, 48, 55, 128, 67, 48, 48, 54, 128, 67, 48, 48, 53, 128, 67, 48, 48, - 52, 128, 67, 48, 48, 51, 128, 67, 48, 48, 50, 67, 128, 67, 48, 48, 50, - 66, 128, 67, 48, 48, 50, 65, 128, 67, 48, 48, 50, 128, 67, 48, 48, 49, - 128, 67, 45, 83, 73, 77, 80, 76, 73, 70, 73, 69, 196, 67, 45, 51, 57, - 128, 67, 45, 49, 56, 128, 66, 90, 85, 78, 199, 66, 90, 72, 201, 66, 89, - 69, 76, 79, 82, 85, 83, 83, 73, 65, 78, 45, 85, 75, 82, 65, 73, 78, 73, - 65, 206, 66, 217, 66, 88, 71, 128, 66, 87, 73, 128, 66, 87, 69, 69, 128, - 66, 87, 69, 128, 66, 87, 65, 128, 66, 85, 85, 77, 73, 83, 72, 128, 66, - 85, 212, 66, 85, 83, 83, 89, 69, 82, 85, 128, 66, 85, 82, 213, 66, 85, - 82, 50, 128, 66, 85, 210, 66, 85, 79, 88, 128, 66, 85, 79, 80, 128, 66, - 85, 79, 128, 66, 85, 77, 80, 217, 66, 85, 76, 85, 71, 128, 66, 85, 76, - 85, 199, 66, 85, 76, 76, 83, 69, 89, 69, 128, 66, 85, 76, 76, 211, 66, - 85, 76, 76, 69, 84, 128, 66, 85, 76, 76, 69, 212, 66, 85, 76, 76, 128, - 66, 85, 75, 89, 128, 66, 85, 72, 73, 196, 66, 85, 71, 73, 78, 69, 83, - 197, 66, 85, 67, 75, 76, 69, 128, 66, 83, 84, 65, 82, 128, 66, 83, 75, - 85, 210, 66, 83, 75, 65, 173, 66, 83, 68, 85, 211, 66, 82, 85, 83, 72, - 128, 66, 82, 85, 83, 200, 66, 82, 79, 78, 90, 69, 128, 66, 82, 79, 75, - 69, 206, 66, 82, 79, 65, 196, 66, 82, 73, 83, 84, 76, 69, 128, 66, 82, - 73, 68, 71, 197, 66, 82, 69, 86, 73, 83, 128, 66, 82, 69, 86, 69, 45, 77, - 65, 67, 82, 79, 78, 128, 66, 82, 69, 86, 197, 66, 82, 69, 65, 84, 200, - 66, 82, 69, 65, 75, 84, 72, 82, 79, 85, 71, 72, 128, 66, 82, 68, 193, 66, - 82, 65, 78, 67, 72, 73, 78, 199, 66, 82, 65, 78, 67, 72, 128, 66, 82, 65, - 78, 67, 200, 66, 82, 65, 75, 67, 69, 84, 128, 66, 82, 65, 67, 75, 69, 84, - 69, 196, 66, 82, 65, 67, 75, 69, 212, 66, 82, 65, 67, 69, 128, 66, 81, - 128, 66, 79, 87, 84, 73, 69, 128, 66, 79, 87, 84, 73, 197, 66, 79, 87, - 128, 66, 79, 215, 66, 79, 85, 78, 68, 65, 82, 217, 66, 79, 84, 84, 79, - 77, 45, 76, 73, 71, 72, 84, 69, 196, 66, 79, 84, 84, 79, 77, 128, 66, 79, - 84, 84, 79, 205, 66, 79, 82, 85, 84, 79, 128, 66, 79, 79, 77, 69, 82, 65, - 78, 71, 128, 66, 79, 78, 69, 128, 66, 79, 76, 212, 66, 79, 68, 89, 128, - 66, 79, 65, 82, 128, 66, 79, 65, 128, 66, 76, 85, 69, 128, 66, 76, 79, - 79, 68, 128, 66, 76, 79, 67, 75, 128, 66, 76, 69, 78, 68, 69, 196, 66, - 76, 65, 78, 75, 128, 66, 76, 65, 78, 203, 66, 76, 65, 68, 197, 66, 76, - 65, 67, 75, 70, 79, 79, 212, 66, 76, 65, 67, 75, 45, 76, 69, 84, 84, 69, - 210, 66, 76, 65, 67, 75, 45, 70, 69, 65, 84, 72, 69, 82, 69, 196, 66, 76, - 65, 67, 75, 128, 66, 75, 65, 173, 66, 73, 84, 84, 69, 82, 128, 66, 73, - 84, 73, 78, 199, 66, 73, 83, 77, 73, 76, 76, 65, 200, 66, 73, 83, 72, 79, - 80, 128, 66, 73, 83, 69, 67, 84, 73, 78, 199, 66, 73, 83, 65, 72, 128, - 66, 73, 82, 85, 128, 66, 73, 82, 71, 65, 128, 66, 73, 82, 68, 128, 66, - 73, 79, 72, 65, 90, 65, 82, 196, 66, 73, 78, 79, 67, 85, 76, 65, 210, 66, - 73, 78, 68, 73, 78, 199, 66, 73, 78, 68, 73, 128, 66, 73, 78, 65, 82, - 217, 66, 73, 76, 65, 66, 73, 65, 204, 66, 73, 71, 128, 66, 73, 199, 66, - 73, 69, 84, 128, 66, 73, 68, 69, 78, 84, 65, 204, 66, 73, 66, 76, 69, 45, - 67, 82, 69, 197, 66, 73, 66, 128, 66, 201, 66, 72, 85, 128, 66, 72, 79, - 79, 128, 66, 72, 79, 128, 66, 72, 73, 128, 66, 72, 69, 84, 72, 128, 66, - 72, 69, 69, 128, 66, 72, 69, 128, 66, 72, 65, 77, 128, 66, 72, 65, 128, - 66, 69, 89, 89, 65, 76, 128, 66, 69, 88, 128, 66, 69, 86, 69, 82, 65, 71, - 69, 128, 66, 69, 84, 87, 69, 69, 78, 128, 66, 69, 84, 87, 69, 69, 206, - 66, 69, 84, 72, 128, 66, 69, 84, 65, 128, 66, 69, 84, 193, 66, 69, 84, - 128, 66, 69, 212, 66, 69, 83, 73, 68, 197, 66, 69, 82, 75, 65, 78, 65, - 206, 66, 69, 82, 66, 69, 210, 66, 69, 80, 128, 66, 69, 79, 82, 195, 66, - 69, 78, 90, 69, 78, 197, 66, 69, 78, 68, 69, 128, 66, 69, 78, 68, 128, - 66, 69, 206, 66, 69, 76, 84, 128, 66, 69, 76, 212, 66, 69, 76, 79, 215, - 66, 69, 76, 76, 128, 66, 69, 76, 204, 66, 69, 76, 71, 84, 72, 79, 210, - 66, 69, 73, 84, 72, 128, 66, 69, 72, 73, 78, 196, 66, 69, 72, 69, 72, - 128, 66, 69, 72, 69, 200, 66, 69, 72, 128, 66, 69, 200, 66, 69, 71, 73, - 78, 78, 73, 78, 71, 128, 66, 69, 71, 73, 206, 66, 69, 70, 79, 82, 197, - 66, 69, 69, 84, 65, 128, 66, 69, 69, 72, 73, 86, 69, 128, 66, 69, 69, 72, - 128, 66, 69, 69, 200, 66, 69, 67, 65, 85, 83, 69, 128, 66, 69, 65, 86, - 69, 210, 66, 69, 65, 84, 128, 66, 69, 65, 78, 128, 66, 69, 65, 77, 69, - 196, 66, 67, 65, 68, 128, 66, 67, 65, 196, 66, 66, 89, 88, 128, 66, 66, - 89, 84, 128, 66, 66, 89, 80, 128, 66, 66, 89, 128, 66, 66, 85, 88, 128, - 66, 66, 85, 84, 128, 66, 66, 85, 82, 88, 128, 66, 66, 85, 82, 128, 66, - 66, 85, 80, 128, 66, 66, 85, 79, 88, 128, 66, 66, 85, 79, 80, 128, 66, - 66, 85, 79, 128, 66, 66, 85, 128, 66, 66, 79, 88, 128, 66, 66, 79, 84, - 128, 66, 66, 79, 80, 128, 66, 66, 79, 128, 66, 66, 73, 88, 128, 66, 66, - 73, 84, 128, 66, 66, 73, 80, 128, 66, 66, 73, 69, 88, 128, 66, 66, 73, - 69, 84, 128, 66, 66, 73, 69, 80, 128, 66, 66, 73, 69, 128, 66, 66, 73, - 128, 66, 66, 69, 88, 128, 66, 66, 69, 80, 128, 66, 66, 69, 128, 66, 66, - 65, 88, 128, 66, 66, 65, 84, 128, 66, 66, 65, 80, 128, 66, 66, 65, 128, - 66, 65, 89, 65, 78, 78, 65, 128, 66, 65, 85, 128, 66, 65, 84, 72, 84, 85, - 66, 128, 66, 65, 84, 72, 65, 77, 65, 83, 65, 84, 128, 66, 65, 83, 83, 65, - 128, 66, 65, 83, 72, 75, 73, 210, 66, 65, 83, 72, 128, 66, 65, 83, 69, - 66, 65, 76, 76, 128, 66, 65, 83, 69, 128, 66, 65, 83, 197, 66, 65, 82, - 83, 128, 66, 65, 82, 82, 73, 69, 82, 128, 66, 65, 82, 82, 69, 75, 72, - 128, 66, 65, 82, 82, 69, 69, 128, 66, 65, 82, 82, 69, 197, 66, 65, 82, - 76, 73, 78, 69, 128, 66, 65, 82, 76, 69, 89, 128, 66, 65, 82, 73, 89, 79, - 79, 83, 65, 78, 128, 66, 65, 82, 65, 50, 128, 66, 65, 210, 66, 65, 78, - 84, 79, 67, 128, 66, 65, 78, 203, 66, 65, 78, 68, 128, 66, 65, 78, 50, - 128, 66, 65, 78, 178, 66, 65, 77, 66, 79, 79, 83, 128, 66, 65, 77, 66, - 79, 79, 128, 66, 65, 76, 85, 68, 65, 128, 66, 65, 76, 76, 79, 212, 66, - 65, 76, 76, 79, 79, 78, 45, 83, 80, 79, 75, 69, 196, 66, 65, 76, 65, 71, - 128, 66, 65, 76, 128, 66, 65, 204, 66, 65, 73, 82, 75, 65, 78, 128, 66, - 65, 73, 77, 65, 73, 128, 66, 65, 72, 84, 128, 66, 65, 72, 73, 82, 71, 79, - 77, 85, 75, 72, 65, 128, 66, 65, 72, 65, 82, 50, 128, 66, 65, 71, 65, - 128, 66, 65, 71, 51, 128, 66, 65, 199, 66, 65, 68, 71, 69, 82, 128, 66, - 65, 68, 128, 66, 65, 67, 75, 83, 80, 65, 67, 69, 128, 66, 65, 67, 75, 83, - 76, 65, 83, 72, 128, 66, 65, 67, 75, 83, 76, 65, 83, 200, 66, 65, 67, 75, - 45, 84, 73, 76, 84, 69, 196, 66, 65, 67, 75, 128, 66, 65, 67, 203, 66, - 65, 65, 82, 69, 82, 85, 128, 66, 51, 48, 53, 128, 66, 50, 53, 57, 128, - 66, 50, 53, 56, 128, 66, 50, 53, 55, 128, 66, 50, 53, 54, 128, 66, 50, - 53, 53, 128, 66, 50, 53, 180, 66, 50, 53, 51, 128, 66, 50, 53, 50, 128, - 66, 50, 53, 49, 128, 66, 50, 53, 48, 128, 66, 50, 52, 57, 128, 66, 50, - 52, 56, 128, 66, 50, 52, 183, 66, 50, 52, 54, 128, 66, 50, 52, 53, 128, - 66, 50, 52, 179, 66, 50, 52, 178, 66, 50, 52, 177, 66, 50, 52, 176, 66, - 50, 51, 54, 128, 66, 50, 51, 52, 128, 66, 50, 51, 179, 66, 50, 51, 50, - 128, 66, 50, 51, 177, 66, 50, 51, 176, 66, 50, 50, 57, 128, 66, 50, 50, - 56, 128, 66, 50, 50, 55, 128, 66, 50, 50, 54, 128, 66, 50, 50, 181, 66, - 50, 50, 50, 128, 66, 50, 50, 49, 128, 66, 50, 50, 176, 66, 50, 49, 57, - 128, 66, 50, 49, 56, 128, 66, 50, 49, 55, 128, 66, 50, 49, 54, 128, 66, - 50, 49, 53, 128, 66, 50, 49, 52, 128, 66, 50, 49, 51, 128, 66, 50, 49, - 50, 128, 66, 50, 49, 49, 128, 66, 50, 49, 48, 128, 66, 50, 48, 57, 128, - 66, 50, 48, 56, 128, 66, 50, 48, 55, 128, 66, 50, 48, 54, 128, 66, 50, - 48, 53, 128, 66, 50, 48, 52, 128, 66, 50, 48, 51, 128, 66, 50, 48, 50, - 128, 66, 50, 48, 49, 128, 66, 50, 48, 48, 128, 66, 49, 57, 177, 66, 49, - 57, 48, 128, 66, 49, 56, 57, 128, 66, 49, 56, 53, 128, 66, 49, 56, 52, - 128, 66, 49, 56, 51, 128, 66, 49, 56, 50, 128, 66, 49, 56, 49, 128, 66, - 49, 56, 48, 128, 66, 49, 55, 57, 128, 66, 49, 55, 56, 128, 66, 49, 55, - 55, 128, 66, 49, 55, 182, 66, 49, 55, 52, 128, 66, 49, 55, 179, 66, 49, - 55, 50, 128, 66, 49, 55, 49, 128, 66, 49, 55, 48, 128, 66, 49, 54, 57, - 128, 66, 49, 54, 56, 128, 66, 49, 54, 55, 128, 66, 49, 54, 54, 128, 66, - 49, 54, 53, 128, 66, 49, 54, 52, 128, 66, 49, 54, 179, 66, 49, 54, 178, - 66, 49, 54, 49, 128, 66, 49, 54, 48, 128, 66, 49, 53, 185, 66, 49, 53, - 56, 128, 66, 49, 53, 55, 128, 66, 49, 53, 182, 66, 49, 53, 53, 128, 66, - 49, 53, 52, 128, 66, 49, 53, 51, 128, 66, 49, 53, 50, 128, 66, 49, 53, - 177, 66, 49, 53, 48, 128, 66, 49, 52, 54, 128, 66, 49, 52, 181, 66, 49, - 52, 50, 128, 66, 49, 52, 177, 66, 49, 52, 176, 66, 49, 51, 181, 66, 49, - 51, 179, 66, 49, 51, 50, 128, 66, 49, 51, 177, 66, 49, 51, 176, 66, 49, - 50, 184, 66, 49, 50, 183, 66, 49, 50, 181, 66, 49, 50, 179, 66, 49, 50, - 178, 66, 49, 50, 177, 66, 49, 50, 176, 66, 49, 48, 57, 205, 66, 49, 48, - 57, 198, 66, 49, 48, 56, 205, 66, 49, 48, 56, 198, 66, 49, 48, 55, 205, - 66, 49, 48, 55, 198, 66, 49, 48, 54, 205, 66, 49, 48, 54, 198, 66, 49, - 48, 53, 205, 66, 49, 48, 53, 198, 66, 49, 48, 181, 66, 49, 48, 180, 66, - 49, 48, 178, 66, 49, 48, 176, 66, 48, 57, 177, 66, 48, 57, 176, 66, 48, - 56, 57, 128, 66, 48, 56, 183, 66, 48, 56, 54, 128, 66, 48, 56, 181, 66, - 48, 56, 51, 128, 66, 48, 56, 50, 128, 66, 48, 56, 177, 66, 48, 56, 176, - 66, 48, 55, 57, 128, 66, 48, 55, 184, 66, 48, 55, 183, 66, 48, 55, 182, - 66, 48, 55, 181, 66, 48, 55, 180, 66, 48, 55, 179, 66, 48, 55, 178, 66, - 48, 55, 177, 66, 48, 55, 176, 66, 48, 54, 185, 66, 48, 54, 184, 66, 48, - 54, 183, 66, 48, 54, 182, 66, 48, 54, 181, 66, 48, 54, 52, 128, 66, 48, - 54, 51, 128, 66, 48, 54, 178, 66, 48, 54, 177, 66, 48, 54, 176, 66, 48, - 53, 185, 66, 48, 53, 184, 66, 48, 53, 183, 66, 48, 53, 54, 128, 66, 48, - 53, 181, 66, 48, 53, 180, 66, 48, 53, 179, 66, 48, 53, 178, 66, 48, 53, - 177, 66, 48, 53, 176, 66, 48, 52, 57, 128, 66, 48, 52, 184, 66, 48, 52, - 55, 128, 66, 48, 52, 182, 66, 48, 52, 181, 66, 48, 52, 180, 66, 48, 52, - 179, 66, 48, 52, 178, 66, 48, 52, 177, 66, 48, 52, 176, 66, 48, 51, 185, - 66, 48, 51, 184, 66, 48, 51, 183, 66, 48, 51, 182, 66, 48, 51, 52, 128, - 66, 48, 51, 179, 66, 48, 51, 178, 66, 48, 51, 177, 66, 48, 51, 176, 66, - 48, 50, 185, 66, 48, 50, 184, 66, 48, 50, 183, 66, 48, 50, 182, 66, 48, - 50, 181, 66, 48, 50, 180, 66, 48, 50, 179, 66, 48, 50, 50, 128, 66, 48, - 50, 177, 66, 48, 50, 176, 66, 48, 49, 57, 128, 66, 48, 49, 56, 128, 66, - 48, 49, 183, 66, 48, 49, 182, 66, 48, 49, 181, 66, 48, 49, 180, 66, 48, - 49, 179, 66, 48, 49, 178, 66, 48, 49, 177, 66, 48, 49, 176, 66, 48, 48, - 57, 128, 66, 48, 48, 185, 66, 48, 48, 56, 128, 66, 48, 48, 184, 66, 48, - 48, 55, 128, 66, 48, 48, 183, 66, 48, 48, 54, 128, 66, 48, 48, 182, 66, - 48, 48, 53, 65, 128, 66, 48, 48, 53, 128, 66, 48, 48, 181, 66, 48, 48, - 52, 128, 66, 48, 48, 180, 66, 48, 48, 51, 128, 66, 48, 48, 179, 66, 48, - 48, 50, 128, 66, 48, 48, 178, 66, 48, 48, 49, 128, 66, 48, 48, 177, 65, - 90, 85, 128, 65, 89, 69, 210, 65, 89, 66, 128, 65, 89, 65, 72, 128, 65, - 88, 69, 128, 65, 87, 69, 128, 65, 86, 69, 83, 84, 65, 206, 65, 86, 69, - 82, 65, 71, 197, 65, 86, 65, 75, 82, 65, 72, 65, 83, 65, 78, 89, 65, 128, - 65, 86, 65, 71, 82, 65, 72, 65, 128, 65, 85, 89, 65, 78, 78, 65, 128, 65, - 85, 84, 85, 77, 78, 128, 65, 85, 83, 84, 82, 65, 204, 65, 85, 82, 65, 77, - 65, 90, 68, 65, 65, 72, 65, 128, 65, 85, 82, 65, 77, 65, 90, 68, 65, 65, - 45, 50, 128, 65, 85, 82, 65, 77, 65, 90, 68, 65, 65, 128, 65, 85, 78, 78, - 128, 65, 85, 71, 85, 83, 84, 128, 65, 85, 71, 77, 69, 78, 84, 65, 84, 73, - 79, 206, 65, 85, 69, 128, 65, 84, 84, 73, 195, 65, 84, 84, 72, 65, 67, - 65, 78, 128, 65, 84, 84, 69, 78, 84, 73, 79, 78, 128, 65, 84, 84, 65, - 203, 65, 84, 79, 205, 65, 84, 78, 65, 200, 65, 84, 77, 65, 65, 85, 128, - 65, 84, 73, 89, 65, 128, 65, 84, 72, 65, 82, 86, 65, 86, 69, 68, 73, 195, - 65, 84, 72, 65, 80, 65, 83, 67, 65, 206, 65, 83, 89, 85, 82, 193, 65, 83, - 89, 77, 80, 84, 79, 84, 73, 67, 65, 76, 76, 217, 65, 83, 84, 82, 79, 76, - 79, 71, 73, 67, 65, 204, 65, 83, 84, 69, 82, 73, 83, 77, 128, 65, 83, 84, - 69, 82, 73, 83, 75, 211, 65, 83, 84, 69, 82, 73, 83, 75, 128, 65, 83, 84, - 69, 82, 73, 83, 203, 65, 83, 84, 69, 82, 73, 83, 67, 85, 83, 128, 65, 83, - 83, 89, 82, 73, 65, 206, 65, 83, 83, 69, 82, 84, 73, 79, 78, 128, 65, 83, - 80, 73, 82, 65, 84, 69, 196, 65, 83, 80, 69, 82, 128, 65, 83, 72, 71, 65, - 66, 128, 65, 83, 72, 57, 128, 65, 83, 72, 178, 65, 83, 67, 69, 78, 84, - 128, 65, 83, 67, 69, 78, 68, 73, 78, 199, 65, 83, 65, 76, 50, 128, 65, - 82, 85, 72, 85, 65, 128, 65, 82, 84, 65, 66, 197, 65, 82, 83, 69, 79, 83, - 128, 65, 82, 83, 69, 79, 211, 65, 82, 82, 79, 87, 83, 128, 65, 82, 82, - 79, 87, 72, 69, 65, 68, 128, 65, 82, 82, 79, 87, 72, 69, 65, 196, 65, 82, - 82, 79, 87, 45, 84, 65, 73, 76, 128, 65, 82, 82, 73, 86, 69, 128, 65, 82, - 82, 65, 89, 128, 65, 82, 80, 69, 71, 71, 73, 65, 84, 207, 65, 82, 79, 85, - 83, 73, 78, 199, 65, 82, 79, 85, 82, 193, 65, 82, 79, 85, 78, 68, 45, 80, - 82, 79, 70, 73, 76, 69, 128, 65, 82, 79, 85, 78, 196, 65, 82, 77, 89, - 128, 65, 82, 77, 79, 85, 82, 128, 65, 82, 205, 65, 82, 76, 65, 85, 199, - 65, 82, 75, 84, 73, 75, 207, 65, 82, 75, 65, 66, 128, 65, 82, 75, 65, 65, - 78, 85, 128, 65, 82, 73, 83, 84, 69, 82, 65, 128, 65, 82, 73, 83, 84, 69, - 82, 193, 65, 82, 73, 69, 83, 128, 65, 82, 71, 79, 84, 69, 82, 73, 128, - 65, 82, 71, 79, 83, 89, 78, 84, 72, 69, 84, 79, 78, 128, 65, 82, 71, 73, - 128, 65, 82, 69, 80, 65, 128, 65, 82, 68, 72, 65, 86, 73, 83, 65, 82, 71, - 65, 128, 65, 82, 67, 72, 65, 73, 79, 78, 128, 65, 82, 67, 72, 65, 73, 79, - 206, 65, 82, 67, 72, 65, 73, 195, 65, 82, 67, 200, 65, 82, 67, 128, 65, - 82, 195, 65, 82, 65, 77, 65, 73, 195, 65, 82, 65, 69, 65, 69, 128, 65, - 82, 65, 69, 65, 45, 85, 128, 65, 82, 65, 69, 65, 45, 73, 128, 65, 82, 65, - 69, 65, 45, 69, 79, 128, 65, 82, 65, 69, 65, 45, 69, 128, 65, 82, 65, 69, - 65, 45, 65, 128, 65, 82, 65, 68, 128, 65, 82, 65, 196, 65, 82, 65, 66, - 73, 67, 45, 73, 78, 68, 73, 195, 65, 82, 65, 66, 73, 65, 206, 65, 82, 45, - 82, 65, 72, 77, 65, 206, 65, 82, 45, 82, 65, 72, 69, 69, 77, 128, 65, 81, - 85, 65, 82, 73, 85, 83, 128, 65, 80, 85, 206, 65, 80, 82, 73, 76, 128, - 65, 80, 80, 82, 79, 88, 73, 77, 65, 84, 69, 76, 217, 65, 80, 80, 82, 79, - 88, 73, 77, 65, 84, 69, 128, 65, 80, 80, 82, 79, 65, 67, 72, 69, 211, 65, - 80, 80, 82, 79, 65, 67, 72, 128, 65, 80, 80, 76, 73, 67, 65, 84, 73, 79, - 78, 128, 65, 80, 79, 84, 72, 69, 83, 128, 65, 80, 79, 84, 72, 69, 77, 65, - 128, 65, 80, 79, 83, 84, 82, 79, 80, 72, 69, 128, 65, 80, 79, 83, 84, 82, - 79, 70, 79, 83, 128, 65, 80, 79, 83, 84, 82, 79, 70, 79, 211, 65, 80, 79, - 83, 84, 82, 79, 70, 79, 201, 65, 80, 79, 68, 69, 88, 73, 65, 128, 65, 80, - 79, 68, 69, 82, 77, 193, 65, 80, 76, 79, 85, 78, 128, 65, 80, 76, 201, - 65, 80, 73, 78, 128, 65, 80, 69, 83, 207, 65, 80, 65, 82, 84, 128, 65, - 80, 65, 65, 84, 79, 128, 65, 78, 85, 83, 86, 65, 82, 65, 89, 65, 128, 65, - 78, 85, 83, 86, 65, 82, 65, 128, 65, 78, 85, 83, 86, 65, 82, 193, 65, 78, - 85, 68, 65, 84, 84, 65, 128, 65, 78, 85, 68, 65, 84, 84, 193, 65, 78, 84, - 73, 82, 69, 83, 84, 82, 73, 67, 84, 73, 79, 78, 128, 65, 78, 84, 73, 75, - 69, 78, 79, 77, 65, 128, 65, 78, 84, 73, 75, 69, 78, 79, 75, 89, 76, 73, - 83, 77, 65, 128, 65, 78, 84, 73, 70, 79, 78, 73, 65, 128, 65, 78, 84, 73, - 67, 76, 79, 67, 75, 87, 73, 83, 69, 45, 82, 79, 84, 65, 84, 69, 196, 65, - 78, 84, 73, 67, 76, 79, 67, 75, 87, 73, 83, 197, 65, 78, 84, 65, 82, 71, - 79, 77, 85, 75, 72, 65, 128, 65, 78, 83, 85, 218, 65, 78, 83, 72, 69, - 128, 65, 78, 80, 69, 65, 128, 65, 78, 207, 65, 78, 78, 85, 73, 84, 217, - 65, 78, 78, 79, 84, 65, 84, 73, 79, 206, 65, 78, 78, 65, 65, 85, 128, 65, - 78, 75, 72, 128, 65, 78, 72, 85, 128, 65, 78, 71, 85, 76, 65, 82, 128, - 65, 78, 71, 83, 84, 82, 79, 205, 65, 78, 71, 75, 72, 65, 78, 75, 72, 85, - 128, 65, 78, 71, 69, 68, 128, 65, 78, 68, 65, 80, 128, 65, 78, 67, 79, - 82, 65, 128, 65, 78, 67, 72, 79, 82, 128, 65, 78, 65, 84, 82, 73, 67, 72, - 73, 83, 77, 65, 128, 65, 78, 65, 80, 128, 65, 77, 80, 83, 128, 65, 77, - 80, 69, 82, 83, 65, 78, 68, 128, 65, 77, 79, 85, 78, 212, 65, 77, 66, - 193, 65, 77, 65, 82, 128, 65, 77, 65, 210, 65, 77, 65, 76, 71, 65, 77, - 65, 84, 73, 79, 206, 65, 76, 86, 69, 79, 76, 65, 210, 65, 76, 84, 69, 82, - 78, 65, 84, 73, 86, 197, 65, 76, 84, 69, 82, 78, 65, 84, 73, 79, 206, 65, - 76, 84, 69, 82, 78, 65, 84, 197, 65, 76, 84, 65, 128, 65, 76, 80, 72, 65, - 128, 65, 76, 80, 72, 193, 65, 76, 80, 65, 80, 82, 65, 78, 65, 128, 65, - 76, 80, 65, 80, 82, 65, 65, 78, 193, 65, 76, 80, 65, 128, 65, 76, 77, 79, - 83, 212, 65, 76, 76, 79, 128, 65, 76, 76, 73, 65, 78, 67, 69, 128, 65, - 76, 76, 201, 65, 76, 76, 65, 200, 65, 76, 73, 71, 78, 69, 196, 65, 76, - 73, 70, 85, 128, 65, 76, 71, 73, 218, 65, 76, 70, 65, 128, 65, 76, 69, - 85, 212, 65, 76, 69, 80, 72, 128, 65, 76, 69, 77, 66, 73, 67, 128, 65, - 76, 69, 70, 128, 65, 76, 65, 89, 72, 69, 128, 65, 76, 65, 89, 72, 197, - 65, 76, 65, 80, 72, 128, 65, 76, 45, 76, 65, 75, 85, 78, 65, 128, 65, 75, - 84, 73, 69, 83, 69, 76, 83, 75, 65, 66, 128, 65, 75, 72, 77, 73, 77, 73, - 195, 65, 75, 66, 65, 210, 65, 75, 65, 82, 65, 128, 65, 75, 65, 82, 193, - 65, 73, 89, 65, 78, 78, 65, 128, 65, 73, 86, 73, 76, 73, 203, 65, 73, 84, - 79, 206, 65, 73, 82, 80, 76, 65, 78, 69, 128, 65, 73, 78, 78, 128, 65, - 73, 76, 77, 128, 65, 73, 75, 65, 82, 65, 128, 65, 73, 72, 86, 85, 83, - 128, 65, 72, 83, 68, 65, 128, 65, 72, 83, 65, 128, 65, 72, 65, 71, 71, - 65, 210, 65, 72, 65, 68, 128, 65, 71, 85, 78, 71, 128, 65, 71, 79, 71, - 201, 65, 71, 71, 82, 65, 86, 65, 84, 73, 79, 78, 128, 65, 71, 71, 82, 65, - 86, 65, 84, 69, 196, 65, 71, 65, 73, 78, 128, 65, 70, 84, 69, 210, 65, - 70, 83, 65, 65, 81, 128, 65, 70, 82, 73, 67, 65, 206, 65, 70, 79, 82, 69, - 77, 69, 78, 84, 73, 79, 78, 69, 68, 128, 65, 70, 71, 72, 65, 78, 201, 65, - 69, 89, 65, 78, 78, 65, 128, 65, 69, 89, 128, 65, 69, 84, 128, 65, 69, - 83, 67, 85, 76, 65, 80, 73, 85, 83, 128, 65, 69, 83, 67, 128, 65, 69, 83, - 128, 65, 69, 82, 128, 65, 69, 76, 65, 45, 80, 73, 76, 76, 65, 128, 65, - 69, 76, 128, 65, 69, 75, 128, 65, 69, 71, 69, 65, 206, 65, 69, 71, 128, - 65, 69, 69, 89, 65, 78, 78, 65, 128, 65, 69, 69, 128, 65, 69, 68, 65, 45, - 80, 73, 76, 76, 65, 128, 65, 69, 68, 128, 65, 69, 66, 128, 65, 197, 65, - 68, 86, 65, 78, 67, 69, 128, 65, 68, 69, 71, 128, 65, 68, 69, 199, 65, - 68, 68, 82, 69, 83, 83, 69, 196, 65, 68, 68, 65, 75, 128, 65, 68, 65, - 203, 65, 67, 85, 84, 69, 45, 77, 65, 67, 82, 79, 78, 128, 65, 67, 85, 84, - 69, 45, 71, 82, 65, 86, 69, 45, 65, 67, 85, 84, 69, 128, 65, 67, 85, 84, - 197, 65, 67, 84, 85, 65, 76, 76, 217, 65, 67, 84, 73, 86, 65, 84, 197, - 65, 67, 82, 79, 80, 72, 79, 78, 73, 195, 65, 67, 75, 78, 79, 87, 76, 69, - 68, 71, 69, 128, 65, 67, 67, 85, 77, 85, 76, 65, 84, 73, 79, 78, 128, 65, - 67, 67, 79, 85, 78, 212, 65, 67, 67, 69, 78, 84, 45, 83, 84, 65, 67, 67, - 65, 84, 79, 128, 65, 67, 67, 69, 78, 84, 128, 65, 67, 67, 69, 78, 212, - 65, 67, 65, 68, 69, 77, 217, 65, 66, 89, 83, 77, 65, 204, 65, 66, 85, 78, - 68, 65, 78, 67, 69, 128, 65, 66, 75, 72, 65, 83, 73, 65, 206, 65, 66, 66, - 82, 69, 86, 73, 65, 84, 73, 79, 206, 65, 66, 65, 70, 73, 76, 73, 128, 65, - 66, 178, 65, 65, 89, 65, 78, 78, 65, 128, 65, 65, 89, 128, 65, 65, 87, - 128, 65, 65, 79, 128, 65, 65, 74, 128, 65, 65, 66, 65, 65, 70, 73, 76, - 73, 128, 65, 65, 48, 51, 50, 128, 65, 65, 48, 51, 49, 128, 65, 65, 48, - 51, 48, 128, 65, 65, 48, 50, 57, 128, 65, 65, 48, 50, 56, 128, 65, 65, - 48, 50, 55, 128, 65, 65, 48, 50, 54, 128, 65, 65, 48, 50, 53, 128, 65, - 65, 48, 50, 52, 128, 65, 65, 48, 50, 51, 128, 65, 65, 48, 50, 50, 128, - 65, 65, 48, 50, 49, 128, 65, 65, 48, 50, 48, 128, 65, 65, 48, 49, 57, - 128, 65, 65, 48, 49, 56, 128, 65, 65, 48, 49, 55, 128, 65, 65, 48, 49, - 54, 128, 65, 65, 48, 49, 53, 128, 65, 65, 48, 49, 52, 128, 65, 65, 48, - 49, 51, 128, 65, 65, 48, 49, 50, 128, 65, 65, 48, 49, 49, 128, 65, 65, - 48, 49, 48, 128, 65, 65, 48, 48, 57, 128, 65, 65, 48, 48, 56, 128, 65, - 65, 48, 48, 55, 66, 128, 65, 65, 48, 48, 55, 65, 128, 65, 65, 48, 48, 55, - 128, 65, 65, 48, 48, 54, 128, 65, 65, 48, 48, 53, 128, 65, 65, 48, 48, - 52, 128, 65, 65, 48, 48, 51, 128, 65, 65, 48, 48, 50, 128, 65, 65, 48, - 48, 49, 128, 65, 48, 55, 48, 128, 65, 48, 54, 57, 128, 65, 48, 54, 56, - 128, 65, 48, 54, 55, 128, 65, 48, 54, 54, 128, 65, 48, 54, 53, 128, 65, - 48, 54, 52, 128, 65, 48, 54, 51, 128, 65, 48, 54, 50, 128, 65, 48, 54, - 49, 128, 65, 48, 54, 48, 128, 65, 48, 53, 57, 128, 65, 48, 53, 56, 128, - 65, 48, 53, 55, 128, 65, 48, 53, 54, 128, 65, 48, 53, 53, 128, 65, 48, - 53, 52, 128, 65, 48, 53, 51, 128, 65, 48, 53, 50, 128, 65, 48, 53, 49, - 128, 65, 48, 53, 48, 128, 65, 48, 52, 57, 128, 65, 48, 52, 56, 128, 65, - 48, 52, 55, 128, 65, 48, 52, 54, 128, 65, 48, 52, 53, 65, 128, 65, 48, - 52, 53, 128, 65, 48, 52, 52, 128, 65, 48, 52, 51, 65, 128, 65, 48, 52, - 51, 128, 65, 48, 52, 50, 65, 128, 65, 48, 52, 50, 128, 65, 48, 52, 49, - 128, 65, 48, 52, 48, 65, 128, 65, 48, 52, 48, 128, 65, 48, 51, 57, 128, - 65, 48, 51, 56, 128, 65, 48, 51, 55, 128, 65, 48, 51, 54, 128, 65, 48, - 51, 53, 128, 65, 48, 51, 52, 128, 65, 48, 51, 51, 128, 65, 48, 51, 50, - 65, 128, 65, 48, 49, 55, 65, 128, 65, 48, 49, 52, 65, 128, 65, 48, 48, - 54, 66, 128, 65, 48, 48, 54, 65, 128, 65, 48, 48, 53, 65, 128, 65, 45, - 69, 85, 128, 45, 85, 205, 45, 80, 72, 82, 85, 128, 45, 75, 72, 89, 85, - 196, 45, 75, 72, 89, 73, 76, 128, 45, 68, 90, 85, 196, 45, 67, 72, 65, - 210, 45, 67, 72, 65, 76, 128, -}; - -static unsigned int lexicon_offset[] = { - 0, 0, 6, 10, 15, 23, 27, 34, 39, 41, 44, 52, 62, 68, 81, 93, 102, 108, - 113, 121, 130, 135, 139, 145, 150, 158, 161, 168, 173, 181, 186, 192, - 200, 207, 217, 224, 227, 236, 239, 242, 247, 253, 262, 266, 273, 280, - 285, 294, 136, 302, 303, 309, 315, 323, 329, 335, 340, 346, 352, 360, - 367, 369, 372, 376, 383, 390, 396, 403, 408, 410, 418, 421, 426, 307, - 428, 430, 436, 441, 450, 455, 460, 470, 474, 487, 491, 496, 505, 508, - 514, 518, 526, 536, 544, 551, 560, 568, 576, 581, 589, 600, 604, 611, - 614, 620, 624, 628, 629, 634, 638, 640, 643, 652, 322, 655, 659, 664, - 672, 676, 678, 681, 687, 694, 701, 710, 719, 722, 732, 741, 750, 756, - 762, 769, 772, 780, 788, 792, 796, 804, 813, 822, 827, 831, 686, 838, - 846, 850, 854, 857, 862, 867, 871, 879, 794, 609, 882, 887, 225, 890, - 895, 905, 914, 920, 927, 934, 942, 946, 954, 960, 967, 973, 979, 984, - 988, 994, 1007, 1012, 1015, 1020, 22, 1024, 1027, 1037, 1042, 1046, 1055, - 1058, 1064, 1074, 1077, 111, 1081, 1086, 1092, 1096, 1101, 1107, 1112, - 1115, 1122, 1124, 1126, 1134, 1144, 1147, 1150, 1157, 1165, 338, 1167, - 1170, 1175, 1183, 1192, 1195, 1204, 1210, 1216, 1218, 1223, 1228, 1234, - 1239, 1244, 1248, 1253, 1259, 1264, 1269, 1273, 1278, 1283, 1287, 1292, - 1297, 1302, 1308, 1314, 1320, 1325, 1329, 1334, 1339, 1344, 1348, 1353, - 1358, 1363, 1368, 1219, 1224, 1229, 1235, 1240, 1372, 1245, 1378, 1387, - 1249, 1391, 1254, 1260, 1265, 1395, 1400, 1405, 1409, 1413, 1419, 1423, - 1270, 1426, 1430, 1274, 1436, 1279, 1440, 1444, 1284, 1448, 1453, 1457, - 1460, 1464, 1288, 1293, 1469, 1298, 1475, 1481, 1487, 1493, 1303, 1315, - 1321, 1497, 1501, 1505, 1508, 1326, 1512, 1514, 1519, 1524, 1530, 1535, - 1540, 1544, 1549, 1554, 1559, 1564, 1570, 1575, 1580, 1586, 1592, 1597, - 1601, 1606, 1611, 1616, 1621, 1625, 1633, 1637, 1642, 1647, 1652, 1657, - 1661, 1664, 1669, 1674, 1679, 1684, 1690, 1695, 1699, 1330, 1702, 1707, - 1712, 1335, 1716, 1720, 1727, 1340, 1734, 1345, 1738, 1740, 1745, 1751, - 1349, 1756, 1765, 1354, 1770, 1776, 1359, 1781, 1786, 1789, 1794, 1798, - 1802, 1806, 1809, 1813, 1364, 1369, 1040, 1818, 1824, 1830, 1836, 1842, - 1848, 1854, 1860, 1866, 1871, 1877, 1883, 1889, 1895, 1901, 1907, 1913, - 1919, 1925, 1930, 1935, 1940, 1945, 1950, 1955, 1960, 1965, 1970, 1975, - 1981, 1986, 1992, 1997, 2003, 2009, 2014, 2020, 2026, 2032, 2038, 2043, - 2048, 2050, 2051, 2055, 2059, 2064, 2068, 2072, 2076, 2080, 2083, 2088, - 2092, 2097, 2101, 2105, 2110, 2114, 2117, 2121, 2135, 2139, 2143, 2146, - 2151, 2155, 2159, 2163, 2168, 2173, 2178, 2182, 2187, 2191, 2196, 2203, - 2209, 2214, 2219, 2224, 2230, 2235, 2241, 2246, 2249, 1236, 2251, 2258, - 2266, 2276, 2285, 2299, 2303, 2307, 2320, 2328, 2332, 2337, 2341, 2345, - 2349, 2354, 2359, 2364, 2368, 2371, 2375, 2382, 2389, 2395, 2400, 2405, - 2411, 2417, 2422, 2425, 1742, 2427, 2433, 2437, 2442, 2446, 2450, 1747, - 1753, 2455, 2459, 2462, 2467, 2472, 2477, 2481, 2488, 2493, 2496, 2503, - 2509, 2513, 2517, 2521, 2527, 2533, 2547, 2564, 2579, 2594, 2603, 2608, - 2612, 2617, 2622, 2626, 2638, 2645, 2651, 2199, 2657, 2664, 2670, 2673, - 2680, 2684, 2688, 2692, 2073, 2696, 2701, 2706, 2710, 2718, 2722, 2726, - 2730, 2735, 2740, 2745, 2749, 2754, 2759, 2763, 2768, 2772, 2775, 2779, - 2783, 2788, 2792, 2796, 2802, 2811, 2815, 2819, 2825, 2830, 2837, 2841, - 2851, 2855, 2860, 2864, 2869, 2875, 2880, 2884, 2385, 2888, 2893, 2899, - 2904, 2908, 2913, 2918, 2922, 2928, 2933, 2939, 2943, 2949, 2954, 2959, - 2964, 2969, 2974, 2979, 2984, 2989, 2994, 3000, 3005, 1246, 80, 3011, - 3015, 3019, 3023, 3028, 3032, 3036, 3040, 3044, 3049, 3053, 3058, 3062, - 3065, 3069, 3074, 3078, 3083, 3087, 3091, 3095, 3100, 3104, 3107, 3120, - 3124, 3128, 3132, 3136, 3140, 3143, 3147, 3151, 3156, 3160, 3165, 3170, - 3175, 3179, 3182, 3185, 3191, 3195, 3199, 3202, 3206, 3210, 3213, 3219, - 3224, 3229, 3235, 3240, 3245, 3251, 3257, 3262, 3267, 3272, 1044, 507, - 3277, 3280, 3285, 3289, 3292, 3297, 3302, 3306, 3311, 3315, 3320, 3324, - 3328, 3331, 3337, 3344, 3350, 3355, 3359, 3364, 3368, 3378, 3382, 3386, - 3391, 3396, 3406, 2084, 3411, 3415, 3418, 3424, 3431, 3435, 621, 720, - 3439, 3446, 3453, 3459, 3464, 3470, 3475, 2093, 3479, 3487, 555, 3493, - 3504, 3508, 3518, 2098, 3524, 3529, 3544, 3550, 3557, 3567, 3573, 3578, - 3584, 3587, 3591, 3598, 3603, 3607, 3611, 3615, 3619, 3624, 3630, 3070, - 3635, 3647, 1546, 3654, 3657, 3661, 3664, 3668, 3682, 3686, 3689, 3693, - 3698, 3702, 3706, 3712, 3718, 3723, 3729, 3733, 3741, 3751, 3757, 3762, - 3771, 3779, 3786, 3790, 3799, 3803, 3808, 3813, 3817, 3825, 3829, 3834, - 3838, 2106, 1388, 3844, 3849, 3855, 3860, 3865, 3870, 3875, 3880, 3885, - 3891, 3896, 3902, 3907, 3912, 3917, 3923, 3928, 3933, 3938, 3943, 3949, - 3954, 3960, 3965, 3970, 3975, 3980, 3985, 3990, 3996, 4001, 4006, 344, - 440, 4011, 4017, 4021, 4025, 4030, 4034, 4038, 4041, 4045, 4049, 4053, - 4058, 4062, 4066, 3841, 4072, 4079, 4083, 4096, 4100, 4104, 4108, 4112, - 4116, 4122, 4129, 4133, 4141, 4150, 4156, 4161, 4164, 4168, 4172, 4182, - 4192, 4200, 4207, 4214, 4220, 4226, 4233, 4237, 4242, 4246, 4254, 4259, - 4267, 4272, 4277, 4281, 4286, 4293, 4296, 4300, 4304, 4307, 4313, 4319, - 4323, 4334, 4344, 4359, 4374, 4389, 4404, 4419, 4434, 4449, 4464, 4479, - 4494, 4509, 4524, 4539, 4554, 4569, 4584, 4599, 4614, 4629, 4644, 4659, - 4674, 4689, 4704, 4719, 4734, 4749, 4764, 4779, 4794, 4809, 4824, 4839, - 4854, 4869, 4884, 4899, 4914, 4929, 4944, 4959, 4974, 4989, 5004, 5019, - 5034, 5049, 5064, 5079, 5088, 5097, 5102, 5108, 5112, 5117, 5121, 5124, - 5128, 2846, 5131, 5136, 306, 424, 5142, 5150, 5154, 5158, 5161, 5167, - 5171, 5179, 5185, 5190, 5197, 5204, 5210, 5215, 5222, 5228, 5232, 5237, - 5249, 5260, 5267, 5273, 3092, 5277, 5283, 5288, 5293, 5298, 5304, 5309, - 5314, 5319, 5324, 5330, 5335, 5340, 5346, 5351, 5357, 5362, 5368, 5373, - 5379, 5384, 5389, 5394, 5399, 5404, 5410, 5415, 5420, 5425, 5431, 5437, - 5443, 5449, 5455, 5461, 5467, 5473, 5479, 5485, 5491, 5497, 5502, 5507, - 5512, 5517, 5522, 5527, 5532, 5537, 5543, 5549, 5554, 5560, 5566, 5572, - 5577, 5582, 5587, 5592, 5598, 5604, 5609, 5614, 5619, 5624, 5629, 5635, - 5640, 5646, 5652, 5658, 5664, 5670, 5676, 5682, 5688, 5694, 5160, 5699, - 5703, 5707, 5710, 5717, 5720, 5728, 5733, 5738, 5729, 5743, 5730, 5747, - 5753, 5759, 5764, 5769, 5776, 5781, 5785, 5788, 5792, 2140, 516, 5796, - 5800, 5805, 5811, 5816, 5820, 5823, 5827, 5832, 5836, 5843, 5847, 5851, - 5855, 884, 699, 5858, 5866, 5873, 5880, 5886, 5893, 5901, 5908, 5915, - 5920, 5932, 1266, 1396, 1401, 5943, 1406, 5947, 5951, 5960, 5969, 5975, - 5980, 5984, 5990, 5995, 6002, 6006, 6015, 6024, 6033, 6042, 6047, 6052, - 6064, 6069, 3312, 6073, 6075, 6080, 6084, 6093, 6101, 1410, 825, 3316, - 3321, 6107, 6111, 6120, 6126, 6131, 6134, 6143, 2591, 6149, 6157, 6161, - 6165, 3325, 6169, 6174, 6181, 6187, 6193, 6196, 6198, 6201, 6209, 6217, - 6225, 6228, 6233, 5740, 6236, 6238, 6243, 6248, 6253, 6258, 6263, 6268, - 6273, 6278, 6283, 6288, 6294, 6299, 6304, 6309, 6315, 6320, 6325, 6330, - 6335, 6340, 6345, 6351, 6356, 6361, 6366, 6371, 6376, 6381, 6386, 6391, - 6396, 6401, 6406, 6411, 6416, 6421, 6426, 6431, 6436, 6442, 6448, 6453, - 6458, 6463, 6468, 6473, 2197, 2204, 2210, 6478, 6484, 2236, 2242, 6492, - 6496, 6501, 6505, 6509, 6513, 6518, 6522, 6527, 6531, 6534, 6537, 6543, - 6549, 6555, 6561, 6567, 6573, 6579, 6583, 6587, 6591, 6595, 6599, 6604, - 6611, 6619, 6629, 6634, 6638, 6649, 6662, 6673, 6686, 6697, 6709, 6721, - 6733, 6746, 6759, 6766, 6772, 6779, 6785, 6789, 6794, 6798, 6805, 6813, - 6817, 6823, 6833, 6837, 6842, 6847, 6854, 6860, 5888, 6870, 6874, 6881, - 698, 6885, 6889, 6894, 6899, 6904, 6908, 6914, 6922, 6926, 6936, 6940, - 6946, 6951, 6955, 2132, 6961, 6969, 6978, 6982, 6988, 6993, 6998, 7003, - 7009, 7014, 3708, 7019, 7023, 7029, 7035, 7040, 7045, 7050, 6983, 7056, - 7060, 7067, 7073, 7078, 7082, 7087, 7091, 7100, 6177, 6184, 7105, 2732, - 7109, 7114, 7119, 6989, 7123, 6994, 6999, 7128, 7135, 7142, 7148, 7154, - 7160, 7165, 7170, 7175, 7004, 7010, 7181, 7187, 7192, 7200, 7015, 7205, - 1079, 7208, 7216, 7222, 7228, 7237, 7242, 7248, 7263, 7280, 7299, 7308, - 7316, 7331, 7341, 7351, 7357, 7369, 7378, 7386, 7393, 7400, 7406, 7411, - 7419, 7429, 7436, 7446, 7456, 7466, 7475, 7485, 7499, 7514, 7523, 7531, - 7536, 7540, 7549, 7559, 7569, 7579, 7584, 7588, 7597, 7607, 7618, 7631, - 7644, 7656, 7664, 7669, 7675, 7678, 7682, 7690, 7695, 7699, 7707, 7716, - 7724, 7731, 7742, 7746, 7749, 7755, 7759, 7765, 7772, 7777, 7784, 7791, - 7798, 7805, 7812, 7819, 7824, 7276, 7829, 7836, 7845, 7849, 7861, 7865, - 7868, 7872, 7876, 7880, 7884, 7890, 7895, 7901, 7906, 7911, 7917, 7922, - 7927, 6850, 7932, 7936, 7940, 7944, 7949, 7954, 7960, 7964, 7971, 7976, - 7984, 7988, 7991, 7997, 8004, 8008, 8011, 8016, 8020, 3736, 8026, 8034, - 8040, 6865, 8045, 8051, 8056, 8060, 8063, 8078, 8097, 8109, 8122, 8135, - 8148, 8162, 8175, 8190, 8197, 8203, 8207, 8212, 8218, 8226, 8231, 6011, - 8236, 8239, 8244, 8248, 2737, 877, 8254, 8258, 8264, 8270, 8275, 8281, - 8286, 7024, 8292, 8298, 8303, 8308, 8316, 8322, 8335, 8343, 8350, 8354, - 8362, 8369, 8381, 8391, 8398, 8405, 8414, 8423, 8431, 8436, 8442, 7030, - 8447, 8453, 7036, 8458, 8461, 8468, 8474, 8487, 8498, 8505, 8511, 8520, - 8528, 8535, 8541, 8547, 8552, 8556, 8561, 8070, 8567, 7041, 8574, 8579, - 8586, 8592, 8598, 8603, 8611, 8619, 8626, 8630, 8644, 8654, 8659, 8663, - 8674, 8680, 8685, 8690, 8694, 7046, 8699, 8702, 8707, 8719, 8726, 8731, - 8735, 8740, 8744, 8751, 8757, 7051, 6984, 8764, 2742, 8, 8771, 8776, - 8780, 8786, 8797, 8807, 8816, 8828, 8833, 8837, 8845, 8859, 8863, 8866, - 8874, 8881, 8889, 8893, 8904, 8908, 8915, 8920, 8924, 8930, 8935, 8939, - 8944, 8948, 8951, 8957, 8962, 8968, 8975, 8985, 8994, 9001, 7061, 7068, - 7074, 7079, 9007, 7083, 9013, 9016, 9023, 9038, 9054, 9069, 970, 406, - 9074, 9082, 9089, 9095, 9100, 9105, 7092, 9107, 9111, 9115, 9125, 9130, - 9134, 9143, 9147, 9150, 9157, 9161, 9164, 9172, 9179, 9187, 9191, 9198, - 9202, 9208, 9212, 9216, 9220, 9226, 9230, 9234, 9241, 9245, 9250, 9254, - 9261, 9267, 9275, 9281, 9291, 9296, 9301, 9305, 9313, 3641, 9321, 9326, - 9330, 9334, 9337, 9345, 9352, 9356, 9360, 9365, 9369, 9380, 9386, 9390, - 9393, 9400, 9405, 7101, 9410, 9414, 1704, 4265, 9421, 9426, 9431, 9436, - 9442, 9447, 9453, 9458, 9463, 9468, 9473, 9478, 9483, 9488, 9493, 9498, - 9503, 9508, 9513, 9518, 9523, 9528, 9533, 9539, 9544, 9549, 9554, 9559, - 9564, 9570, 9575, 9580, 9586, 9591, 9597, 9602, 9608, 9613, 9618, 9623, - 9628, 9634, 9639, 9644, 670, 134, 9649, 9653, 9658, 9663, 9667, 9671, - 9675, 9680, 9684, 9689, 9693, 9696, 9700, 9704, 9709, 9719, 9725, 9729, - 9733, 9740, 9748, 9757, 9768, 9775, 9782, 9791, 9800, 9809, 9818, 9827, - 9836, 9846, 9856, 9866, 9876, 9886, 9895, 9905, 9915, 9925, 9935, 9945, - 9955, 9965, 9974, 9984, 9994, 10004, 10014, 10024, 10034, 10043, 10053, - 10063, 10073, 10083, 10093, 10103, 10113, 10123, 10133, 10142, 10152, - 10162, 10172, 10182, 10192, 10202, 10212, 10222, 10232, 10242, 10251, - 10257, 10261, 10264, 10268, 10273, 10280, 10286, 10291, 10295, 10300, - 10304, 10308, 7110, 10314, 10319, 10328, 7115, 10333, 10336, 10342, - 10350, 7120, 10357, 10361, 10365, 10369, 10379, 10384, 10393, 10401, - 10408, 10413, 10420, 10425, 10429, 10432, 10443, 10453, 10462, 10470, - 10481, 10493, 10503, 10507, 10512, 10517, 10521, 10526, 10535, 10539, - 10542, 10549, 10559, 10568, 10575, 10579, 10585, 10590, 10595, 10599, - 10608, 10613, 10619, 10624, 10628, 10637, 10645, 10653, 10660, 10668, - 10680, 10691, 10701, 10708, 10714, 10723, 10734, 10743, 10752, 10760, - 10767, 10776, 10784, 5761, 10788, 10790, 10795, 10801, 10809, 10816, - 10825, 10834, 10843, 10852, 10861, 10870, 10879, 10888, 10898, 10908, - 10917, 10924, 10938, 10945, 10953, 10962, 10968, 10977, 10985, 10994, - 11007, 11015, 11022, 11035, 11041, 11050, 11059, 11064, 11068, 11074, - 11080, 11087, 6864, 11092, 11097, 11104, 11109, 11114, 11118, 11124, - 11132, 11140, 11147, 11155, 11163, 11168, 11174, 11179, 11183, 11194, - 11202, 11208, 11213, 11222, 11228, 11233, 11242, 11256, 3600, 11260, - 11265, 11270, 11276, 11281, 11286, 11290, 11295, 11300, 5760, 11305, - 11310, 11315, 11320, 11324, 11329, 11334, 11339, 11345, 11351, 11356, - 11360, 11365, 11370, 11375, 7124, 11380, 11385, 11390, 11395, 11412, - 11430, 11442, 11455, 11472, 11488, 11505, 11515, 11534, 11545, 11556, - 11567, 11578, 11590, 11601, 11612, 11629, 11640, 11651, 11656, 2317, - 11660, 11663, 11669, 11677, 11685, 11690, 11698, 11706, 11713, 11718, - 11724, 11731, 11739, 11746, 11758, 11763, 9032, 11769, 11778, 11786, - 11793, 11799, 11807, 11814, 11821, 11827, 11836, 11844, 11851, 11859, - 11865, 11872, 11880, 11885, 3372, 1187, 11892, 11895, 11306, 11899, - 11905, 11909, 11921, 11926, 11933, 11939, 11944, 11951, 11311, 11316, - 11955, 11959, 11964, 11968, 11976, 11983, 11990, 12007, 12011, 12014, - 12022, 12028, 3428, 12032, 12034, 12042, 12049, 12059, 12064, 12070, - 12075, 12079, 12085, 12090, 12093, 12100, 12106, 12112, 12117, 12124, - 12130, 12135, 12142, 12146, 12152, 12159, 12165, 12171, 12179, 12185, - 12193, 12199, 12205, 12210, 12217, 12222, 12226, 12231, 12238, 12243, - 12249, 12255, 12261, 12264, 12268, 12280, 12286, 12291, 12298, 12304, - 12310, 12321, 12331, 12340, 12348, 12355, 12365, 12375, 12383, 12386, - 11330, 12391, 11335, 11460, 12399, 12412, 12427, 12438, 11477, 12456, - 12469, 12482, 12493, 8085, 12504, 12517, 12536, 12547, 12558, 12569, - 2542, 12582, 12586, 12594, 12605, 12612, 12618, 12626, 12630, 12636, - 12639, 12649, 12657, 12664, 12672, 12677, 12682, 12689, 12695, 12700, - 12705, 12709, 12713, 12719, 12725, 12730, 12735, 12740, 12744, 11340, - 11346, 11352, 12748, 12756, 12765, 12772, 7000, 12776, 12778, 12783, - 12788, 12794, 12799, 12804, 12809, 12814, 12818, 12824, 12830, 12835, - 12841, 12846, 12851, 12857, 12862, 12867, 12872, 12878, 12883, 12888, - 12894, 12900, 12905, 12912, 12919, 12924, 12928, 12932, 12935, 12943, - 12948, 12955, 12960, 12965, 12975, 12980, 12987, 12993, 13003, 13017, - 13031, 13045, 13059, 13074, 13089, 13106, 13124, 13137, 13143, 13148, - 13153, 13159, 13164, 13169, 13173, 13177, 13182, 13186, 13197, 13203, - 13208, 13213, 13217, 13222, 13228, 13235, 13240, 13244, 13250, 13255, - 13260, 13264, 13270, 13275, 13280, 13287, 13292, 13296, 13300, 13305, - 13310, 13316, 13322, 13327, 13336, 13344, 13351, 13358, 13364, 13370, - 13375, 13380, 13386, 13391, 13397, 13402, 13408, 13414, 13421, 13427, - 13432, 13437, 7166, 13446, 13449, 13455, 13460, 13465, 13475, 13482, - 13487, 13493, 13498, 13504, 13509, 13515, 13521, 13526, 13534, 13541, - 13546, 13552, 13557, 13561, 13570, 13581, 13588, 13596, 13602, 13609, - 13615, 13620, 13624, 13630, 13635, 13640, 13645, 7171, 5777, 2756, 13649, - 13653, 13657, 13661, 13665, 13668, 13675, 13683, 11366, 13690, 13700, - 13708, 13715, 13723, 13733, 13742, 13747, 10458, 10467, 13752, 13762, - 13777, 13783, 13790, 13797, 13803, 13813, 13823, 11371, 13832, 13838, - 13844, 13852, 13860, 13865, 13874, 13882, 13894, 13904, 13914, 13924, - 13933, 13945, 13955, 13965, 13976, 13981, 13993, 14005, 14017, 14029, - 14041, 14053, 14065, 14077, 14089, 14101, 14112, 14124, 14136, 14148, - 14160, 14172, 14184, 14196, 14208, 14220, 14232, 14243, 14255, 14267, - 14279, 14291, 14303, 14315, 14327, 14339, 14351, 14363, 14374, 14386, - 14398, 14410, 14422, 14434, 14446, 14458, 14470, 14482, 14494, 14505, - 14517, 14529, 14541, 14553, 14565, 14577, 14589, 14601, 14613, 14625, - 14636, 14648, 14660, 14672, 14684, 14696, 14708, 14720, 14732, 14744, - 14756, 14767, 14779, 14791, 14803, 14815, 14827, 14839, 14851, 14863, - 14875, 14887, 14898, 14910, 14922, 14934, 14946, 14959, 14972, 14985, - 14998, 15011, 15024, 15037, 15049, 15062, 15075, 15088, 15101, 15114, - 15127, 15140, 15153, 15166, 15179, 15191, 15204, 15217, 15230, 15243, - 15256, 15269, 15282, 15295, 15308, 15321, 15333, 15346, 15359, 15372, - 15385, 15398, 15411, 15424, 15437, 15450, 15463, 15475, 15488, 15501, - 15514, 15527, 15540, 15553, 15566, 15579, 15592, 15605, 15617, 15630, - 15643, 15656, 15669, 15682, 15695, 15708, 15721, 15734, 15747, 15759, - 15770, 15783, 15796, 15809, 15822, 15835, 15848, 15861, 15874, 15887, - 15900, 15912, 15925, 15938, 15951, 15964, 15977, 15990, 16003, 16016, - 16029, 16042, 16054, 16067, 16080, 16093, 16106, 16119, 16132, 16145, - 16158, 16171, 16184, 16196, 16209, 16222, 16235, 16248, 16261, 16274, - 16287, 16300, 16313, 16326, 16338, 16351, 16364, 16377, 16390, 16403, - 16416, 16429, 16442, 16455, 16468, 16480, 16493, 16506, 16519, 16532, - 16545, 16558, 16571, 16584, 16597, 16610, 16622, 16635, 16648, 16661, - 16674, 16687, 16700, 16713, 16726, 16739, 16752, 16764, 16777, 16790, - 16803, 16816, 16829, 16842, 16855, 16868, 16881, 16894, 16906, 16919, - 16932, 16945, 16958, 16971, 16984, 16997, 17010, 17023, 17036, 17048, - 17061, 17074, 17087, 17100, 17113, 17126, 17139, 17152, 17165, 17178, - 17190, 17201, 17209, 17216, 17222, 17226, 17232, 17238, 17246, 17252, - 17257, 7005, 17261, 17268, 17276, 17283, 17290, 8481, 17297, 17306, - 17311, 5793, 17318, 17323, 17326, 17331, 17339, 17346, 17353, 17359, - 17368, 17377, 17383, 17388, 17398, 17405, 17413, 17419, 17429, 17438, - 17442, 17449, 17453, 17458, 17464, 17472, 17476, 11381, 17485, 17491, - 17495, 17501, 17508, 17519, 6829, 17527, 17533, 17538, 17542, 17546, - 7415, 17551, 17559, 17566, 17575, 17582, 17589, 17595, 17599, 17605, - 17611, 17619, 17625, 17632, 17638, 17644, 17648, 17656, 17665, 17670, - 17681, 17686, 17691, 17696, 5966, 17700, 17706, 17713, 17722, 17727, - 17735, 17747, 17752, 17756, 17759, 17765, 17771, 17776, 17780, 17783, - 17794, 17799, 7201, 17806, 7016, 7206, 17811, 17816, 17821, 17826, 17831, - 17836, 17841, 17846, 17851, 17856, 17861, 17866, 17872, 17877, 17882, - 17887, 17892, 17897, 17902, 17907, 17912, 17917, 17923, 17929, 17934, - 17939, 17944, 17949, 17954, 17959, 17964, 17969, 17974, 17980, 17985, - 17990, 17995, 18001, 18007, 18012, 18017, 18022, 18027, 18032, 18037, - 18042, 18047, 18053, 18058, 18063, 18068, 18073, 18079, 18084, 18089, - 18093, 129, 18101, 18105, 18109, 18113, 18118, 18122, 18126, 9788, 18130, - 18135, 18139, 18144, 18148, 18153, 18157, 18163, 18168, 18172, 18176, - 18184, 18188, 18193, 18198, 18202, 18208, 18213, 18217, 18222, 18227, - 18231, 18238, 18242, 18246, 18251, 18255, 18258, 18271, 18276, 18285, - 7238, 18290, 18293, 2605, 2610, 18297, 18303, 18309, 18314, 18319, 18324, - 18330, 18335, 18340, 18344, 18349, 18354, 18360, 18365, 18370, 18376, - 18381, 18385, 18390, 18395, 18400, 18404, 18409, 18414, 18419, 18424, - 18428, 18432, 18437, 2765, 18386, 18441, 18448, 7494, 18460, 18468, - 18391, 18475, 18480, 18396, 18488, 18493, 18498, 18503, 18507, 18512, - 18515, 18519, 18525, 18530, 6856, 1709, 1714, 18534, 18540, 18546, 18551, - 18555, 18559, 18563, 18566, 18572, 18579, 18587, 18593, 18599, 18604, - 18609, 18613, 11741, 12361, 18618, 18630, 18633, 18640, 18644, 18652, - 18663, 18672, 18685, 18695, 18709, 18721, 18735, 18745, 18757, 18763, - 18778, 18802, 18820, 18839, 18852, 18866, 18884, 18900, 18917, 18935, - 18946, 18965, 18982, 19002, 19020, 19032, 19046, 19060, 19072, 19089, - 19108, 19126, 19138, 19156, 19175, 11520, 19188, 19208, 19220, 8116, - 19232, 19237, 19242, 19247, 19253, 19258, 2334, 19262, 19268, 19272, - 19275, 19279, 19287, 19293, 18405, 19297, 19308, 19314, 19320, 19329, - 19336, 19341, 19348, 19354, 19363, 19371, 19381, 19391, 19396, 19405, - 19414, 19425, 19436, 3677, 19446, 19450, 19460, 19468, 19478, 19489, - 19497, 19504, 19510, 19515, 18415, 19519, 19528, 19532, 19537, 19546, - 19554, 19564, 19573, 19579, 19585, 18420, 18425, 19589, 19599, 916, - 19608, 11702, 1154, 19622, 19631, 19639, 19650, 19661, 19671, 19680, - 19689, 19698, 19704, 19713, 19721, 7178, 19727, 19730, 19734, 19739, - 19744, 19752, 18433, 19756, 19762, 19768, 19773, 19778, 19782, 19790, - 19796, 19802, 3351, 19810, 19815, 19820, 19824, 19828, 19835, 19839, - 19847, 19853, 19858, 19862, 19867, 19873, 19877, 19888, 19893, 19897, - 19908, 19912, 19916, 19919, 19923, 19928, 19932, 19936, 903, 19940, - 19945, 19950, 19955, 19960, 19965, 19970, 19975, 19980, 19985, 19990, - 19995, 20000, 20005, 20011, 20016, 20021, 20026, 20031, 20036, 20041, - 20047, 20052, 20057, 20062, 20067, 20072, 20077, 20082, 20088, 20094, - 20099, 20105, 20110, 20115, 5, 20121, 20125, 20129, 20133, 20138, 20142, - 20146, 20150, 20154, 20159, 20163, 20168, 20172, 20175, 20179, 20184, - 20188, 20193, 20197, 20201, 20205, 20210, 20214, 20218, 20228, 20233, - 20237, 20241, 20246, 20251, 20260, 20265, 20270, 20274, 20278, 20290, - 20299, 20308, 20314, 20318, 20322, 20332, 20341, 20349, 20355, 20359, - 20366, 20376, 20385, 20393, 20401, 20408, 20416, 20425, 20434, 20442, - 20447, 20451, 20455, 20458, 20460, 20464, 20468, 20473, 20478, 20482, - 20486, 20489, 20493, 20496, 20500, 20503, 20506, 20510, 20516, 20520, - 20524, 20528, 20533, 20538, 20543, 20547, 20550, 20555, 20561, 20566, - 20572, 20577, 20581, 20585, 20589, 20594, 20598, 20603, 20607, 20614, - 20618, 20621, 20625, 20631, 20637, 20641, 20645, 20650, 20657, 20663, - 20667, 20676, 20680, 20684, 20687, 20693, 20698, 20704, 1471, 1773, - 20709, 20714, 20719, 20724, 20729, 20734, 20739, 2157, 20744, 20745, - 20748, 20752, 20756, 20761, 20765, 20769, 20772, 20777, 20782, 20786, - 20789, 20794, 20798, 20803, 20807, 11714, 20812, 20815, 20818, 20822, - 20826, 20835, 20842, 20847, 20854, 20858, 20862, 20867, 20872, 20876, - 20881, 20893, 20904, 20909, 20913, 20918, 20922, 20925, 20931, 5894, - 2252, 20935, 20951, 7270, 20971, 20980, 20996, 21000, 21003, 21009, - 21019, 21025, 21040, 21052, 21063, 21071, 21080, 21086, 21095, 21105, - 21116, 21127, 21136, 21145, 21153, 21160, 21168, 21181, 21187, 21192, - 21198, 21203, 21211, 21223, 21235, 21249, 21257, 21264, 21273, 21282, - 21290, 21298, 21306, 21313, 21322, 21330, 21340, 21349, 21359, 21368, - 21377, 21385, 21390, 21394, 21397, 21401, 21405, 21409, 21413, 21417, - 21423, 21429, 11759, 21434, 21446, 21452, 7623, 21463, 21473, 21482, - 21486, 21489, 21493, 21499, 21503, 21508, 21517, 21524, 5935, 21531, - 21539, 21546, 21552, 21557, 21563, 21569, 21577, 21581, 21584, 21586, - 21402, 21595, 21601, 21611, 21616, 21622, 21627, 21632, 21637, 21644, - 21653, 21662, 21668, 21673, 21679, 21684, 21691, 21702, 21707, 21711, - 21721, 21725, 21730, 21740, 21749, 21753, 21761, 21768, 21774, 21779, - 21786, 21790, 10323, 21798, 21805, 21812, 18204, 21327, 21817, 21821, - 18952, 21826, 21840, 21856, 21874, 21893, 21910, 21928, 18971, 21945, - 21965, 18988, 21977, 21989, 12443, 22001, 19008, 22015, 22027, 8129, - 22041, 22046, 22051, 22057, 22061, 22066, 22076, 22082, 7994, 22088, - 22090, 22095, 22103, 22107, 21640, 22113, 22120, 22130, 22135, 22139, - 22142, 22148, 22156, 22166, 22182, 22195, 22209, 12461, 22223, 22230, - 22234, 22237, 22242, 22246, 22256, 22261, 22266, 22271, 22279, 22287, - 22296, 22301, 12466, 22305, 22308, 22311, 22316, 22332, 22340, 22348, - 22356, 22361, 22365, 22371, 22377, 22380, 22386, 22398, 22405, 22411, - 22418, 22432, 22445, 22454, 22466, 22477, 22486, 22495, 22503, 22514, - 5917, 22521, 22527, 22532, 22538, 22548, 22557, 22563, 22568, 22575, - 22583, 22595, 22602, 22611, 22619, 22625, 22631, 22636, 22640, 22643, - 22649, 22654, 22658, 22669, 22678, 22686, 22691, 22697, 10921, 6581, - 22702, 22705, 22708, 22714, 22722, 22730, 22734, 22738, 22743, 22746, - 22755, 22763, 22774, 22778, 22784, 22790, 22794, 22800, 22822, 22846, - 22853, 22859, 22870, 22888, 22895, 22903, 22907, 22916, 22929, 22937, - 22949, 22960, 22970, 22984, 22993, 23001, 23013, 7287, 23024, 23035, - 23047, 23057, 23066, 23071, 23075, 23083, 23088, 23092, 23095, 23098, - 23106, 23114, 23123, 23133, 23142, 23148, 23162, 2556, 23184, 23193, - 23203, 23215, 23225, 23233, 23241, 23250, 23255, 23266, 23277, 23281, - 23291, 23300, 23310, 23320, 23328, 23337, 23344, 23352, 23359, 23368, - 23372, 23380, 23387, 23394, 23405, 23420, 23427, 23437, 23446, 23452, - 11054, 23459, 23464, 23468, 23472, 23480, 23486, 23495, 23500, 23510, - 19517, 23514, 23517, 23522, 23527, 23532, 23537, 23542, 23547, 23552, - 23557, 23563, 23568, 23573, 23579, 1242, 639, 23584, 23593, 2300, 23600, - 23605, 23609, 23615, 1275, 506, 343, 23620, 23629, 23637, 23646, 23654, - 23665, 23674, 23682, 23686, 23689, 23697, 23705, 11727, 23710, 23716, - 4101, 23721, 23725, 23731, 23735, 23742, 1437, 23748, 7355, 23755, 23765, - 23773, 23779, 23788, 23796, 23802, 23810, 23817, 23824, 1478, 2338, - 23831, 23837, 23848, 23859, 23867, 23874, 23883, 23891, 23898, 23905, - 23918, 23929, 23948, 1280, 23952, 23957, 23965, 3387, 23969, 23974, 1441, - 20487, 23984, 23988, 23993, 23997, 3333, 24003, 24011, 24018, 24026, - 3388, 260, 24031, 24039, 24047, 24054, 24060, 24065, 24072, 24075, 24081, - 21504, 24087, 106, 24091, 24095, 24101, 24106, 24113, 24119, 2263, 24123, - 24127, 24130, 24133, 24140, 24146, 18500, 24151, 3432, 13175, 24155, - 24158, 24166, 24169, 24179, 24191, 24196, 24200, 24208, 24215, 24221, - 24228, 24235, 24238, 24242, 24246, 1445, 24256, 24258, 24263, 24269, - 24275, 24280, 24285, 24290, 24295, 24300, 24305, 24310, 24315, 24320, - 24325, 24330, 24335, 24340, 24345, 24351, 24357, 24363, 24369, 24374, - 24379, 24384, 24390, 24395, 24400, 24405, 24411, 24416, 24422, 24427, - 24432, 24437, 24442, 24448, 24453, 24459, 24464, 24469, 24474, 24479, - 24485, 24490, 24496, 24501, 24506, 24511, 24516, 24521, 24526, 24531, - 24536, 24541, 24547, 24553, 24559, 24564, 24569, 24574, 24579, 24585, - 24591, 24597, 24603, 24609, 24615, 24620, 24626, 24631, 24636, 24641, - 24646, 24652, 2376, 24657, 2383, 2390, 2647, 24662, 2396, 2406, 24668, - 24672, 24677, 24682, 24688, 24693, 24698, 24702, 24707, 24713, 24718, - 24723, 24729, 24734, 24738, 24743, 24748, 24753, 24758, 24763, 24769, - 24775, 24780, 24784, 24789, 24793, 24798, 24803, 24808, 24812, 24817, - 24822, 24827, 24832, 24838, 24844, 24849, 24853, 24858, 24863, 24868, - 24873, 24878, 24882, 24887, 24892, 24897, 24901, 24906, 24914, 24920, - 24926, 24932, 24937, 24941, 24944, 24948, 24953, 24957, 24962, 24966, - 24969, 24974, 17578, 23752, 24979, 24984, 24988, 24993, 24997, 25001, - 25006, 25010, 25013, 25016, 25020, 25025, 25033, 25037, 25042, 25046, - 25050, 25055, 25060, 25064, 25070, 25075, 25080, 25087, 25094, 25098, - 25101, 25107, 25116, 25123, 25130, 25134, 25139, 25143, 25149, 25155, - 25159, 25165, 25170, 25175, 25182, 25188, 25194, 25200, 25206, 25213, - 25219, 25225, 25231, 25237, 25243, 25249, 25255, 25262, 25268, 25275, - 25281, 25287, 25293, 25299, 25305, 25311, 25317, 25323, 25329, 8917, - 25335, 25340, 25345, 12716, 25350, 25355, 25360, 25366, 25371, 25376, - 25380, 25385, 25390, 25396, 25401, 25406, 25410, 25415, 25420, 25424, - 25429, 25434, 25439, 25443, 25448, 25453, 25458, 25462, 25466, 12060, - 25470, 25479, 25485, 25491, 25500, 25508, 25513, 25517, 25524, 25530, - 25534, 25539, 25548, 25553, 1477, 25559, 25562, 25566, 18541, 18547, - 25572, 25576, 25587, 25598, 25610, 25617, 25624, 25629, 25633, 17235, - 685, 17577, 25641, 25645, 25650, 25656, 25661, 25667, 25672, 25678, - 25683, 8022, 2714, 3282, 25687, 25690, 25696, 25702, 25708, 25715, 25721, - 25727, 25733, 25739, 25745, 25751, 25757, 25763, 25769, 25775, 25781, - 25787, 25794, 25800, 25806, 25812, 25818, 25824, 25827, 25832, 25837, - 25843, 25848, 25853, 25857, 25862, 25868, 25873, 25878, 25884, 25889, - 25895, 25899, 25904, 25909, 25914, 25919, 25923, 25928, 25933, 25938, - 25944, 25950, 25956, 25961, 25965, 25970, 25974, 25982, 3455, 25988, - 25991, 5976, 25995, 26001, 26008, 5985, 26012, 26018, 26025, 26031, - 26040, 26048, 26052, 26059, 26065, 26069, 26072, 26081, 26089, 26093, - 26103, 26113, 26123, 26129, 26139, 26144, 26157, 26171, 26182, 26194, - 26206, 26220, 26233, 26245, 26257, 11561, 26271, 26276, 26281, 26285, - 26289, 26293, 1762, 22475, 26297, 26302, 26307, 26311, 26314, 26319, - 26324, 26330, 26336, 7767, 12395, 26341, 26346, 26351, 26355, 26360, - 25651, 26365, 26370, 26376, 25657, 26381, 26384, 26392, 25662, 26397, - 26403, 26409, 25668, 26414, 26419, 26425, 26430, 26435, 26441, 26447, - 23128, 26452, 26456, 26461, 26466, 26471, 26479, 26483, 26488, 26493, - 26497, 26502, 26507, 26512, 25673, 25679, 26518, 2452, 234, 26521, 26524, - 26528, 26532, 26540, 26547, 26554, 26558, 26561, 26567, 26575, 26583, - 26587, 26591, 26594, 26601, 26605, 26612, 26620, 26628, 26635, 26639, - 635, 292, 26651, 26656, 26661, 26667, 26672, 3466, 26677, 26682, 26687, - 26692, 26697, 18626, 26702, 26707, 26712, 26717, 26723, 26728, 26732, - 26737, 26742, 26747, 26751, 26756, 26761, 26766, 18464, 3472, 26771, - 26776, 26781, 26787, 26792, 26797, 26801, 26806, 26811, 26817, 26822, - 26827, 26831, 26836, 26841, 26846, 26850, 26855, 26860, 26865, 26871, - 26877, 26882, 26886, 26891, 26896, 26901, 26905, 26913, 26917, 26923, - 26927, 26934, 13070, 26940, 26947, 26955, 26962, 26968, 26980, 26986, - 2666, 26990, 26596, 26994, 27005, 27010, 27015, 27020, 27024, 27029, - 18552, 27033, 17591, 27038, 27043, 27049, 27054, 27058, 27062, 27065, - 27071, 27082, 27094, 27099, 27103, 27106, 321, 27110, 27115, 27120, - 27125, 27130, 27135, 27141, 27146, 27151, 27157, 27162, 27168, 27173, - 27179, 27184, 27189, 27194, 27199, 27204, 27209, 27214, 27219, 27225, - 27230, 27235, 27240, 27245, 27250, 27255, 27260, 27266, 27272, 27277, - 27282, 27287, 27292, 27297, 27302, 27307, 27312, 27317, 27322, 27327, - 27332, 27337, 27342, 27347, 27352, 27357, 27362, 27368, 26, 27373, 27377, - 27381, 27389, 27393, 27397, 27400, 27403, 27408, 27412, 27417, 27421, - 27426, 27430, 27435, 27439, 27442, 27444, 27447, 27449, 27453, 27465, - 27474, 27478, 27484, 27489, 27495, 27500, 27505, 27509, 27514, 27521, - 27526, 27532, 27537, 27541, 27548, 21335, 21345, 27552, 27557, 27562, - 27567, 27571, 27578, 6076, 27584, 27593, 27601, 27616, 27630, 27638, - 27649, 27658, 27663, 5243, 27673, 27678, 27682, 27685, 27689, 27693, - 27700, 27705, 6820, 27715, 27717, 27720, 27724, 27728, 27733, 27739, - 27744, 27753, 27759, 27764, 27771, 27775, 27782, 27795, 27803, 27807, - 27817, 27822, 27826, 27830, 27836, 27841, 27851, 27860, 27871, 27879, - 27890, 27899, 27902, 27906, 27914, 27920, 27928, 27935, 27941, 2351, - 27945, 27947, 27952, 27957, 27960, 27962, 27966, 27969, 27973, 27977, - 27980, 27986, 27996, 28001, 28007, 28011, 28016, 28029, 21606, 28035, - 28044, 13898, 26109, 28051, 28056, 28060, 28068, 28075, 28080, 28084, - 28088, 28096, 28102, 28108, 28113, 28117, 28120, 28125, 28138, 28154, - 19078, 28171, 28183, 28200, 28212, 28226, 19095, 19114, 28238, 28250, - 2573, 28264, 28269, 28274, 28278, 28285, 28297, 28303, 28306, 28311, - 18244, 28314, 28318, 28321, 28326, 28331, 28337, 28342, 28347, 28353, - 28359, 28364, 28368, 28373, 28378, 28383, 28387, 28390, 28396, 28401, - 28406, 28411, 28415, 28420, 28426, 28431, 28436, 28442, 28447, 28452, - 28457, 28462, 28467, 28471, 28474, 28480, 28484, 28492, 28499, 28507, - 28517, 28523, 28529, 28533, 28542, 28547, 28552, 8036, 28557, 28564, - 28570, 28575, 28581, 28589, 28596, 28600, 28603, 28614, 28621, 28627, - 28636, 28640, 28643, 28649, 28656, 28662, 28668, 28676, 24055, 28683, - 28691, 28697, 28702, 28708, 28713, 28719, 28723, 28730, 28736, 21619, - 28745, 28750, 28758, 28766, 7383, 4120, 28773, 28777, 28781, 28785, - 28790, 28794, 28798, 28803, 28808, 28812, 17640, 28817, 28821, 28825, - 28829, 28832, 28834, 28839, 28847, 28851, 28858, 28862, 28870, 28877, - 28887, 28891, 28895, 28903, 28909, 28918, 10570, 28924, 28933, 28940, - 28948, 28956, 28964, 28971, 28978, 28985, 28992, 28999, 29004, 29010, - 29027, 29035, 29043, 29050, 380, 29054, 29060, 27654, 29066, 29069, - 29077, 29083, 29089, 29098, 29104, 3420, 12046, 29113, 29120, 29125, - 29129, 29136, 29144, 29153, 29163, 29169, 29177, 29186, 29194, 18248, - 29201, 29208, 29214, 29224, 29233, 29244, 29248, 29254, 29259, 29265, - 29271, 29276, 29289, 29302, 29315, 29322, 29328, 29333, 29337, 1451, - 29341, 29346, 29351, 29356, 29361, 29367, 29372, 29377, 29382, 29387, - 29392, 29397, 29402, 29408, 29414, 29419, 29424, 29430, 29435, 29440, - 29445, 29451, 29456, 29461, 29466, 29471, 29477, 29482, 29487, 29493, - 29498, 29503, 29508, 29513, 29518, 29524, 29529, 29535, 29540, 29546, - 29551, 29556, 29561, 29567, 29573, 29579, 29585, 29591, 29597, 29603, - 29609, 29614, 29619, 29625, 29630, 29635, 29640, 29645, 29650, 29655, - 29660, 29666, 29671, 29676, 29682, 29688, 101, 29693, 29695, 29699, - 29703, 29707, 29712, 29716, 7323, 29720, 29726, 4331, 29732, 29735, - 29740, 29744, 29749, 29753, 29757, 29762, 7869, 29766, 29770, 29774, - 12131, 29779, 29783, 29788, 29793, 29798, 29802, 29809, 21623, 29815, - 29818, 29822, 29827, 29833, 29837, 29843, 29848, 29852, 29856, 29860, - 3317, 3322, 24194, 29863, 29871, 29878, 29882, 29887, 342, 29892, 29898, - 29904, 29908, 29917, 29921, 29925, 29930, 29935, 29939, 29946, 29952, - 29957, 29972, 29987, 30002, 30018, 30036, 7831, 30050, 30055, 30059, - 30067, 27788, 30075, 30079, 30088, 30096, 7546, 11842, 30100, 30103, - 30106, 6089, 3621, 30111, 30119, 30123, 30126, 30130, 30135, 30140, - 30146, 30151, 30155, 30159, 30164, 30168, 30174, 30178, 30185, 30189, - 9256, 30196, 30202, 30207, 30214, 30221, 30228, 23641, 6020, 30235, - 30242, 30249, 30255, 30260, 30267, 30278, 30284, 30289, 30296, 30300, - 30304, 30314, 30325, 30331, 30336, 30341, 30346, 30351, 30355, 30359, - 30365, 2255, 767, 7891, 7896, 7902, 30374, 7907, 7912, 7918, 30379, - 30389, 30393, 7923, 30398, 30401, 30406, 30410, 30415, 30422, 30428, - 30438, 4146, 30447, 30451, 30455, 30465, 30471, 30482, 30488, 30494, - 30499, 30505, 30511, 30516, 30519, 30526, 30532, 30537, 30544, 30551, - 30555, 30565, 30578, 30587, 30596, 30607, 30620, 30629, 30640, 30645, - 30650, 7928, 30656, 30664, 30669, 5094, 21, 30676, 30681, 13284, 30685, - 30688, 30691, 23219, 30695, 23650, 30703, 30707, 30710, 30716, 30722, - 30730, 30736, 30743, 30747, 30751, 23383, 30755, 30764, 30770, 30775, - 30779, 30787, 21669, 30793, 30800, 30806, 30811, 30816, 30820, 30826, - 30831, 30837, 3747, 716, 30844, 30848, 30851, 12054, 30863, 29182, 30874, - 30877, 30884, 30890, 30894, 30900, 30905, 30911, 30916, 30921, 30925, - 30930, 30935, 30945, 30951, 30964, 30970, 30975, 30981, 13193, 1454, 932, - 25770, 25776, 30986, 25782, 25795, 25801, 25807, 30992, 25813, 25819, - 30998, 31004, 14, 31012, 31019, 31023, 31027, 31035, 31039, 31044, 31048, - 31055, 31060, 31064, 31069, 31075, 31080, 31086, 31091, 31095, 31099, - 31103, 31108, 31112, 31117, 31121, 31128, 31133, 31137, 31142, 31146, - 31151, 31155, 31160, 12218, 12223, 31165, 31169, 31172, 31176, 31181, - 31185, 31191, 31198, 31203, 31213, 31218, 31226, 31230, 31233, 31237, - 31242, 31247, 31251, 31256, 10581, 31267, 31271, 31274, 31278, 31282, - 31285, 31289, 6108, 10597, 31292, 31295, 31300, 31304, 31313, 31329, - 31345, 31355, 23138, 31362, 31366, 31371, 31375, 31379, 31384, 31389, - 31393, 31398, 31402, 31406, 22323, 31412, 17702, 31417, 31424, 31432, - 31438, 31445, 31453, 31459, 31463, 31469, 31477, 31481, 31490, 7304, - 31498, 31502, 31510, 31517, 31522, 31526, 31529, 31533, 31536, 31540, - 31547, 31552, 21814, 25825, 31556, 31563, 31569, 31574, 31577, 31579, - 31586, 31593, 31599, 31603, 31606, 31610, 31614, 31618, 31623, 31627, - 31631, 31634, 31638, 31652, 19144, 31671, 31684, 31697, 31710, 19162, - 31725, 8090, 31740, 31746, 31750, 31754, 31761, 31767, 31772, 31778, - 31788, 31800, 31811, 31816, 31823, 31827, 31830, 12589, 31838, 12239, - 31851, 31855, 31859, 31864, 31869, 31873, 31877, 31880, 5750, 23022, - 31885, 31889, 31895, 31904, 31909, 29159, 31915, 31920, 31924, 31929, - 31936, 31940, 31943, 11526, 31948, 31955, 939, 31959, 31964, 31969, - 31975, 31980, 31985, 31989, 31994, 32000, 32005, 32011, 32016, 32022, - 32032, 32037, 32042, 32046, 5245, 5257, 32051, 32054, 32061, 32070, - 32074, 32077, 32081, 32086, 668, 32091, 32097, 23211, 32103, 32108, - 32118, 32127, 32134, 32140, 32144, 32151, 32157, 32164, 32170, 32180, - 32188, 32194, 32200, 32205, 32209, 32216, 32222, 32229, 31619, 548, 1208, - 32235, 32240, 32243, 32249, 32257, 1383, 32262, 32266, 32271, 32278, - 32284, 32288, 32293, 32302, 32309, 32319, 32325, 23237, 32342, 32351, - 32359, 32365, 32370, 32377, 32383, 32391, 32400, 32408, 32413, 32421, - 32427, 32446, 12522, 32460, 32476, 32490, 32496, 32501, 32506, 32511, - 32517, 32522, 32526, 32533, 32538, 32542, 319, 2807, 32549, 32554, 22579, - 32380, 32559, 32564, 32572, 32576, 32579, 32585, 32589, 23287, 32592, - 32596, 32599, 32604, 32608, 32613, 32618, 32622, 32627, 32631, 17511, - 17522, 32635, 32640, 32646, 22292, 32651, 32655, 12702, 32658, 32663, - 32668, 32673, 32678, 32683, 32688, 32693, 453, 43, 25828, 25833, 25838, - 25844, 25849, 25854, 32698, 25858, 32702, 32706, 25863, 25869, 32710, - 25874, 25879, 32718, 32723, 25885, 32728, 32733, 32738, 32743, 32749, - 32755, 25896, 32768, 32774, 25900, 25905, 32778, 25910, 25915, 32781, - 32786, 32790, 25591, 32796, 10746, 32803, 32808, 25920, 32812, 32817, - 32822, 32827, 32831, 32836, 32841, 32847, 32852, 32857, 32863, 32869, - 32874, 32878, 32883, 32888, 32893, 32897, 32902, 32907, 32912, 32918, - 32924, 32930, 32935, 32939, 32944, 32948, 25924, 25929, 25934, 32952, - 32956, 25939, 25945, 25951, 25957, 32968, 21521, 32972, 32976, 32981, - 32986, 32991, 32995, 32999, 33009, 33014, 33019, 33023, 33027, 33030, - 33038, 25966, 1461, 33043, 33051, 33060, 33064, 33072, 33080, 33096, - 33101, 1731, 9398, 33105, 2853, 33117, 33118, 33126, 33133, 33138, 33143, - 7197, 1043, 7950, 33150, 33155, 33158, 33167, 1294, 33172, 33179, 33182, - 33187, 18600, 2485, 33191, 8312, 33201, 33207, 2273, 2283, 33216, 33225, - 27997, 7985, 3565, 29063, 1299, 33235, 33243, 33250, 33255, 33259, 33263, - 19759, 8012, 33271, 33280, 33289, 33297, 33304, 33309, 33322, 33335, - 33347, 33359, 33371, 33384, 33395, 33406, 33414, 33422, 33434, 33446, - 33457, 33466, 33474, 33481, 33493, 33500, 33509, 33516, 33529, 33539, - 33544, 33550, 33555, 33559, 33566, 33570, 33577, 33585, 2451, 33592, - 33603, 33613, 33622, 33630, 33640, 33648, 33658, 33663, 33669, 33680, - 33690, 33699, 33708, 33718, 33727, 33732, 33737, 1687, 37, 33745, 33753, - 33764, 33775, 33785, 33792, 33798, 33803, 33807, 33818, 33828, 33837, - 33848, 13257, 13262, 33853, 33862, 33867, 33877, 33882, 33890, 33898, - 33905, 33911, 8057, 1018, 33915, 33921, 33926, 33929, 2094, 31856, 33937, - 33941, 33944, 1494, 33950, 11019, 1304, 33955, 33968, 33982, 2536, 34000, - 34012, 34024, 2550, 2567, 34038, 34051, 2582, 34065, 34077, 2597, 34091, - 1310, 1316, 1322, 8237, 34096, 34101, 34106, 34110, 34125, 34140, 34155, - 34170, 34185, 34200, 34215, 34230, 34245, 34260, 34275, 34290, 34305, - 34320, 34335, 34350, 34365, 34380, 34395, 34410, 34425, 34440, 34455, - 34470, 34485, 34500, 34515, 34530, 34545, 34560, 34575, 34590, 34605, - 34620, 34635, 34650, 34665, 34680, 34695, 34710, 34725, 34740, 34755, - 34770, 34785, 34800, 34815, 34830, 34845, 34860, 34875, 34890, 34905, - 34920, 34935, 34950, 34965, 34980, 34995, 35010, 35025, 35040, 35055, - 35070, 35085, 35100, 35115, 35130, 35145, 35160, 35175, 35190, 35205, - 35220, 35235, 35250, 35265, 35280, 35295, 35310, 35325, 35340, 35355, - 35370, 35385, 35400, 35415, 35430, 35445, 35460, 35475, 35490, 35505, - 35520, 35535, 35550, 35565, 35580, 35595, 35610, 35625, 35640, 35655, - 35670, 35685, 35700, 35715, 35730, 35745, 35760, 35775, 35790, 35805, - 35820, 35835, 35850, 35865, 35880, 35895, 35910, 35925, 35940, 35955, - 35970, 35985, 36000, 36015, 36030, 36045, 36060, 36075, 36090, 36105, - 36120, 36135, 36150, 36165, 36180, 36195, 36210, 36225, 36240, 36255, - 36270, 36285, 36300, 36315, 36330, 36345, 36360, 36375, 36390, 36405, - 36420, 36435, 36450, 36465, 36480, 36495, 36510, 36525, 36540, 36555, - 36570, 36585, 36600, 36615, 36630, 36645, 36660, 36675, 36690, 36705, - 36720, 36735, 36750, 36765, 36780, 36795, 36810, 36825, 36840, 36855, - 36870, 36885, 36900, 36915, 36930, 36945, 36960, 36975, 36990, 37005, - 37020, 37035, 37050, 37065, 37080, 37095, 37110, 37125, 37140, 37155, - 37170, 37185, 37200, 37215, 37230, 37245, 37260, 37275, 37290, 37305, - 37320, 37335, 37350, 37365, 37380, 37395, 37410, 37425, 37440, 37455, - 37470, 37485, 37500, 37515, 37530, 37545, 37560, 37575, 37590, 37605, - 37620, 37635, 37650, 37665, 37680, 37695, 37710, 37725, 37740, 37755, - 37770, 37785, 37800, 37815, 37830, 37845, 37860, 37875, 37890, 37905, - 37920, 37935, 37950, 37965, 37980, 37995, 38010, 38025, 38040, 38055, - 38070, 38085, 38100, 38115, 38130, 38145, 38160, 38175, 38190, 38205, - 38220, 38235, 38250, 38265, 38280, 38295, 38310, 38325, 38340, 38355, - 38370, 38385, 38400, 38415, 38430, 38445, 38460, 38475, 38490, 38505, - 38520, 38535, 38550, 38565, 38580, 38595, 38610, 38625, 38640, 38655, - 38670, 38685, 38700, 38715, 38730, 38745, 38760, 38775, 38790, 38805, - 38820, 38835, 38850, 38865, 38880, 38895, 38910, 38925, 38940, 38955, - 38970, 38985, 39000, 39015, 39030, 39045, 39060, 39075, 39090, 39105, - 39120, 39135, 39150, 39165, 39180, 39195, 39210, 39225, 39240, 39255, - 39270, 39285, 39300, 39315, 39330, 39345, 39360, 39375, 39390, 39405, - 39420, 39435, 39450, 39465, 39480, 39495, 39510, 39525, 39540, 39555, - 39570, 39585, 39600, 39615, 39630, 39645, 39660, 39675, 39690, 39705, - 39720, 39735, 39750, 39765, 39780, 39795, 39810, 39825, 39840, 39855, - 39870, 39885, 39900, 39915, 39930, 39945, 39960, 39975, 39990, 40005, - 40020, 40035, 40050, 40065, 40080, 40095, 40110, 40125, 40140, 40155, - 40170, 40185, 40200, 40215, 40230, 40245, 40260, 40275, 40290, 40305, - 40320, 40335, 40350, 40365, 40380, 40395, 40410, 40425, 40440, 40455, - 40470, 40485, 40500, 40515, 40530, 40545, 40560, 40575, 40590, 40605, - 40620, 40635, 40650, 40665, 40680, 40695, 40710, 40725, 40740, 40755, - 40770, 40785, 40800, 40815, 40830, 40845, 40860, 40875, 40890, 40905, - 40920, 40935, 40950, 40965, 40980, 40995, 41010, 41025, 41040, 41055, - 41070, 41085, 41100, 41115, 41130, 41145, 41160, 41175, 41190, 41205, - 41220, 41235, 41250, 41265, 41280, 41295, 41310, 41325, 41340, 41355, - 41370, 41385, 41400, 41415, 41430, 41445, 41460, 41475, 41490, 41505, - 41520, 41535, 41550, 41565, 41580, 41595, 41610, 41625, 41640, 41655, - 41670, 41685, 41700, 41715, 41730, 41745, 41761, 41777, 41793, 41809, - 41825, 41841, 41857, 41873, 41889, 41905, 41921, 41937, 41953, 41969, - 41985, 42001, 42017, 42033, 42049, 42065, 42081, 42097, 42113, 42129, - 42145, 42161, 42177, 42193, 42209, 42225, 42241, 42257, 42273, 42289, - 42305, 42321, 42337, 42353, 42369, 42385, 42401, 42417, 42433, 42449, - 42465, 42481, 42497, 42513, 42529, 42545, 42561, 42577, 42593, 42609, - 42625, 42641, 42657, 42673, 42689, 42705, 42721, 42737, 42753, 42769, - 42785, 42801, 42817, 42833, 42849, 42865, 42881, 42897, 42913, 42929, - 42945, 42961, 42977, 42993, 43009, 43025, 43041, 43057, 43073, 43089, - 43105, 43121, 43137, 43153, 43169, 43185, 43201, 43217, 43233, 43249, - 43265, 43281, 43297, 43313, 43329, 43345, 43361, 43377, 43393, 43409, - 43425, 43441, 43457, 43473, 43489, 43505, 43521, 43537, 43553, 43569, - 43585, 43601, 43617, 43633, 43649, 43665, 43681, 43697, 43713, 43729, - 43745, 43761, 43777, 43793, 43809, 43825, 43841, 43857, 43873, 43889, - 43905, 43921, 43937, 43953, 43969, 43985, 44001, 44017, 44033, 44049, - 44065, 44081, 44097, 44113, 44129, 44145, 44161, 44177, 44193, 44209, - 44225, 44241, 44257, 44273, 44289, 44305, 44321, 44337, 44353, 44369, - 44385, 44401, 44417, 44433, 44449, 44465, 44481, 44497, 44513, 44529, - 44545, 44561, 44577, 44593, 44609, 44625, 44641, 44657, 44673, 44689, - 44705, 44721, 44737, 44753, 44769, 44785, 44801, 44817, 44833, 44849, - 44865, 44881, 44897, 44913, 44929, 44945, 44961, 44977, 44993, 45009, - 45025, 45041, 45057, 45073, 45089, 45105, 45121, 45137, 45153, 45169, - 45185, 45201, 45217, 45233, 45249, 45265, 45281, 45297, 45313, 45329, - 45345, 45361, 45377, 45393, 45409, 45425, 45441, 45457, 45473, 45489, - 45505, 45521, 45537, 45553, 45569, 45585, 45601, 45617, 45633, 45649, - 45665, 45681, 45697, 45713, 45729, 45745, 45761, 45777, 45793, 45809, - 45825, 45841, 45857, 45873, 45889, 45905, 45921, 45937, 45953, 45969, - 45985, 46001, 46017, 46033, 46049, 46065, 46081, 46097, 46113, 46129, - 46145, 46161, 46177, 46193, 46209, 46225, 46241, 46257, 46273, 46289, - 46305, 46321, 46337, 46353, 46369, 46385, 46401, 46417, 46433, 46449, - 46465, 46481, 46497, 46513, 46529, 46545, 46561, 46577, 46593, 46609, - 46625, 46641, 46657, 46673, 46689, 46705, 46721, 46737, 46753, 46769, - 46785, 46801, 46817, 46833, 46849, 46865, 46881, 46897, 46913, 46929, - 46945, 46961, 46977, 46993, 47009, 47025, 47041, 47057, 47073, 47089, - 47105, 47121, 47137, 47153, 47169, 47185, 47201, 47217, 47233, 47249, - 47265, 47281, 47297, 47313, 47329, 47345, 47361, 47377, 47393, 47409, - 47425, 47441, 47457, 47473, 47489, 47505, 47521, 47537, 47553, 47569, - 47585, 47601, 47617, 47633, 47649, 47665, 47681, 47697, 47713, 47729, - 47745, 47761, 47777, 47793, 47809, 47825, 47841, 47857, 47873, 47889, - 47905, 47921, 47937, 47953, 47969, 47985, 48001, 48017, 48033, 48049, - 48065, 48081, 48097, 48113, 48129, 48145, 48161, 48177, 48193, 48209, - 48225, 48241, 48257, 48273, 48289, 48305, 48321, 48337, 48353, 48369, - 48385, 48401, 48417, 48433, 48449, 48465, 48481, 48497, 48513, 48529, - 48545, 48561, 48577, 48593, 48609, 48625, 48641, 48657, 48673, 48689, - 48705, 48721, 48737, 48753, 48769, 48785, 48801, 48817, 48833, 48849, - 48865, 48881, 48897, 48913, 48929, 48945, 48961, 48977, 48993, 49009, - 49025, 49041, 49057, 49073, 49089, 49105, 49121, 49137, 49153, 49169, - 49185, 49201, 49217, 49233, 49249, 49265, 49281, 49297, 49313, 49329, - 49345, 49361, 49377, 49393, 49409, 49425, 49441, 49457, 49473, 49489, - 49505, 49521, 49537, 49553, 49569, 49585, 49601, 49617, 49633, 49649, - 49665, 49681, 49697, 49713, 49729, 49745, 49761, 49777, 49793, 49809, - 49825, 49841, 49857, 49873, 49889, 49905, 49921, 49937, 49953, 49969, - 49985, 50001, 50017, 50033, 50049, 50065, 50081, 50097, 50113, 50129, - 50145, 50161, 50177, 50193, 50209, 50225, 50241, 50257, 50273, 50289, - 50305, 50321, 50337, 50353, 50369, 50385, 50401, 50417, 50432, 50441, - 50447, 50453, 50463, 50471, 11823, 13787, 7661, 50484, 1502, 50492, - 22665, 5207, 50498, 50503, 50508, 50513, 50518, 50524, 50529, 50535, - 50540, 50546, 50551, 50556, 50561, 50566, 50572, 50577, 50582, 50587, - 50592, 50597, 50602, 50607, 50613, 50618, 50624, 50631, 2489, 50636, - 50642, 6480, 50646, 50651, 50658, 50666, 40, 50670, 50676, 50681, 50686, - 50690, 50695, 50699, 50703, 8255, 50707, 50717, 50730, 50741, 50754, - 50761, 50767, 50772, 50778, 50784, 50790, 50795, 50800, 50805, 50810, - 50814, 50819, 50824, 50829, 50835, 50841, 50847, 50852, 50856, 50861, - 50866, 50870, 50875, 50880, 50885, 50889, 8271, 8282, 8287, 1545, 50893, - 1550, 50899, 50902, 1581, 50908, 1587, 1593, 8317, 50913, 50921, 50928, - 50932, 50938, 50943, 25620, 50948, 50955, 50960, 50964, 50968, 1598, - 12933, 12944, 50977, 50984, 50989, 50993, 12956, 1602, 30319, 50996, - 51006, 51010, 1607, 31921, 51015, 8437, 8443, 51021, 51033, 51050, 51067, - 51084, 51101, 51118, 51135, 51152, 51169, 51186, 51203, 51220, 51237, - 51254, 51271, 51288, 51305, 51322, 51339, 51356, 51373, 51390, 51407, - 51424, 51441, 51458, 51475, 51492, 51509, 51526, 51543, 51560, 51577, - 51594, 51611, 51628, 51645, 51662, 51679, 51696, 51713, 51730, 51747, - 51764, 51781, 51798, 51815, 51832, 51849, 51866, 51877, 51882, 1612, - 51886, 51892, 7144, 1617, 22912, 51897, 51908, 51918, 51923, 51930, - 51936, 51941, 51946, 51950, 8454, 1622, 8459, 51954, 51959, 51965, 51970, - 51975, 51980, 51985, 51990, 51995, 52000, 52006, 52012, 52018, 52023, - 52027, 52032, 52037, 52041, 52046, 52051, 52056, 52060, 52065, 52071, - 52076, 52081, 52085, 52090, 52095, 52101, 52106, 52111, 52117, 52123, - 52128, 52132, 52137, 52142, 52147, 52151, 52156, 52161, 52166, 52172, - 52178, 52183, 52187, 52191, 52196, 52201, 52206, 24124, 52210, 52215, - 52220, 52226, 52231, 52236, 52240, 52245, 52250, 52256, 52261, 52266, - 52272, 52278, 52283, 52287, 52292, 52297, 52301, 52306, 52311, 52316, - 52322, 52328, 52333, 52337, 52342, 52347, 52351, 52356, 52361, 52366, - 52370, 52373, 26077, 52378, 52386, 13218, 13236, 8557, 52392, 8562, - 52407, 52412, 52423, 52435, 52447, 52459, 2588, 52471, 52476, 52480, - 52486, 52492, 1634, 940, 52497, 52502, 31960, 52506, 52510, 52515, 52519, - 13301, 52524, 52527, 52535, 1638, 8587, 8593, 1643, 52543, 52550, 52555, - 52564, 52574, 52581, 1648, 52588, 52593, 13376, 52597, 52602, 52609, - 52615, 52619, 52629, 13398, 7063, 7070, 1653, 52636, 52642, 52650, 52657, - 52663, 52669, 52674, 52685, 52694, 3498, 25495, 25504, 13438, 1658, 1662, - 52702, 52713, 52718, 1665, 52726, 52731, 52743, 52749, 52754, 1670, - 52759, 52764, 52772, 52780, 52787, 52796, 52804, 52813, 1675, 1680, - 52817, 52824, 13547, 52832, 52838, 52846, 52851, 8727, 52860, 52866, - 52872, 52877, 52885, 8736, 8741, 52893, 52899, 3563, 32038, 52904, 52910, - 52915, 52923, 52930, 52935, 52939, 52945, 1691, 52950, 52953, 977, 52959, - 52964, 52969, 52975, 52980, 52985, 52990, 52995, 53000, 53005, 1700, 9, - 53011, 53015, 53020, 53024, 53028, 53032, 26315, 53037, 53042, 53047, - 53051, 53054, 53058, 53062, 53067, 53071, 53076, 53080, 28322, 28327, - 28332, 53083, 53090, 53096, 31804, 53106, 28338, 28343, 26325, 26331, - 28354, 26337, 53111, 53116, 53120, 53124, 53127, 53131, 53134, 53139, - 53143, 53147, 53150, 53162, 27517, 53169, 12396, 760, 53172, 53176, - 53181, 53185, 10779, 53188, 53195, 53208, 53217, 53222, 53232, 53245, - 53257, 53264, 53269, 53278, 53291, 29283, 53309, 53314, 53321, 53327, - 53332, 53340, 22979, 585, 53346, 53352, 53358, 53363, 26342, 4176, 26356, - 53367, 53377, 53382, 53392, 53407, 53413, 53419, 26361, 25652, 53424, - 53429, 53434, 53438, 53443, 53448, 53452, 4217, 26382, 53456, 53462, 337, - 53472, 53479, 53488, 53494, 53502, 53506, 53510, 53514, 53518, 53523, - 53527, 53533, 53541, 53546, 53550, 53555, 53559, 53563, 53569, 53575, - 53580, 53584, 26398, 53589, 26404, 26410, 53594, 53600, 53605, 53609, - 25669, 13167, 53612, 53616, 53621, 53628, 53634, 53638, 53643, 53649, - 53653, 53657, 53662, 53667, 53671, 53674, 53680, 53685, 53692, 53699, - 53705, 53710, 53715, 53719, 53724, 53730, 53735, 53741, 53746, 53751, - 53756, 53762, 53767, 53772, 53778, 53784, 53790, 26415, 53795, 53800, - 53805, 26426, 53810, 53815, 53820, 53826, 53832, 26431, 53837, 53842, - 53847, 26442, 26448, 53852, 53857, 53862, 53867, 23129, 26453, 26457, - 53872, 53843, 53876, 53882, 53890, 53897, 53903, 53913, 53919, 53926, - 8214, 26462, 53932, 53945, 53954, 53960, 53969, 53975, 19524, 53982, - 53989, 26443, 53999, 54006, 54011, 54015, 54019, 54024, 4251, 54028, - 54033, 54038, 28416, 28421, 54042, 28427, 28432, 54047, 28437, 28443, - 54052, 28448, 54063, 54066, 54078, 54086, 26484, 54090, 54099, 54109, - 54118, 26489, 54123, 54130, 54139, 54145, 54153, 27045, 4069, 54158, - 26498, 54164, 54167, 54173, 54180, 54185, 54190, 19456, 54194, 54200, - 54206, 54211, 54217, 54223, 54228, 765, 29092, 29839, 29845, 54232, - 54236, 54240, 54243, 54256, 54262, 54266, 54269, 54274, 27708, 54278, - 25674, 17585, 54284, 4197, 4205, 6948, 54287, 54292, 54297, 54302, 54307, - 54312, 54317, 54322, 54327, 54332, 54338, 54343, 54348, 54354, 54359, - 54364, 54369, 54374, 54379, 54384, 54390, 54395, 54401, 54406, 54411, - 54416, 54421, 54426, 54431, 54436, 54441, 54446, 54451, 54457, 54462, - 54467, 54472, 54477, 54482, 54487, 54493, 54498, 54503, 54508, 54513, - 54518, 54523, 54528, 54533, 54538, 54544, 54549, 54554, 54559, 54564, - 54570, 54576, 54581, 54587, 54592, 54597, 54602, 54607, 54612, 1495, 235, - 54617, 54621, 54625, 54629, 54633, 54636, 54640, 54645, 54649, 54654, - 54658, 54662, 54666, 54671, 54675, 54680, 54684, 54688, 54695, 11999, - 54704, 54713, 54717, 20701, 54721, 54727, 54735, 54741, 54753, 54757, - 54762, 54768, 54778, 54788, 54794, 54798, 54803, 54809, 54818, 54827, - 54835, 12274, 54839, 54848, 54856, 54867, 54878, 54887, 54891, 54900, - 54910, 54916, 54921, 54927, 54932, 98, 25579, 54943, 21735, 54949, 54956, - 54962, 54966, 54976, 54984, 54989, 54993, 55001, 55005, 55011, 55021, - 1132, 55024, 55027, 55031, 55037, 55044, 55050, 55059, 55068, 55074, - 55080, 55085, 55092, 55099, 55112, 55121, 55130, 55135, 55139, 55146, - 55153, 55160, 55167, 55174, 55179, 55183, 55187, 55190, 55200, 55204, - 55213, 55217, 55222, 55226, 55235, 55243, 55251, 55256, 55260, 55265, - 55270, 55274, 55280, 55292, 55300, 55310, 55317, 55323, 55328, 55332, - 55336, 55340, 55349, 55358, 55367, 55373, 55379, 55385, 55390, 55397, - 55403, 55411, 55418, 9779, 55424, 55430, 55434, 11225, 55438, 55447, - 55453, 55461, 55468, 55472, 55476, 55482, 55490, 55497, 55503, 55514, - 55518, 55522, 55526, 55529, 55535, 55540, 55544, 55548, 55557, 55565, - 55572, 19890, 31572, 55578, 55586, 55590, 55597, 55606, 55614, 55620, - 55625, 55629, 55634, 55638, 55643, 55652, 55656, 55663, 55670, 55678, - 55684, 55695, 55701, 55710, 55717, 55724, 55731, 55738, 55745, 34285, - 55752, 55759, 55764, 55770, 37407, 55774, 55779, 55784, 55790, 55796, - 55802, 55807, 55812, 55817, 55822, 55828, 55833, 55839, 55844, 55850, - 55855, 55860, 55865, 55870, 55875, 55880, 55885, 55891, 55896, 55902, - 55907, 55912, 55917, 55922, 55927, 55932, 55938, 55943, 55948, 55953, - 55958, 55963, 55968, 55973, 55978, 55983, 55988, 55994, 55999, 56004, - 56009, 56014, 56019, 56024, 56029, 56034, 56040, 56045, 56050, 56055, - 56060, 56065, 56070, 56075, 56080, 56085, 56090, 56095, 56100, 56106, - 1816, 216, 30402, 56111, 56114, 56119, 56123, 55247, 56126, 56136, 56143, - 56152, 56162, 56172, 56180, 56188, 56192, 56195, 56202, 56208, 56219, - 56231, 56242, 56249, 1305, 19361, 56259, 2518, 56263, 1087, 13743, 30918, - 56271, 56284, 56288, 56293, 56298, 56303, 56309, 56315, 56320, 6489, - 56325, 56333, 8588, 56338, 56344, 1703, 8600, 669, 56353, 56362, 56372, - 22357, 56381, 56387, 13353, 56393, 56397, 3678, 8890, 56403, 52708, - 56410, 6919, 171, 11159, 56416, 56428, 56432, 56438, 22932, 56442, 8878, - 2623, 4, 56447, 56457, 56463, 56474, 56481, 56487, 56493, 56501, 56508, - 56518, 56528, 56538, 1317, 56547, 56553, 2646, 2652, 6486, 2200, 56557, - 56561, 56570, 56581, 56589, 56597, 56603, 56614, 56625, 56633, 56639, - 8931, 56644, 56652, 56656, 56660, 23273, 56672, 56682, 56688, 56694, - 56704, 56707, 56718, 56728, 56737, 56741, 56748, 1089, 2511, 56758, - 56763, 56771, 56779, 56790, 56804, 11111, 374, 56814, 56818, 56827, - 56835, 56841, 56848, 56854, 56861, 56871, 56879, 3570, 184, 56887, 56898, - 56902, 56914, 23120, 148, 56920, 56925, 56929, 56936, 56942, 56950, - 56957, 6740, 56964, 56973, 3625, 56981, 13399, 56985, 2681, 419, 56990, - 57003, 57008, 1815, 602, 57012, 3631, 57020, 57026, 917, 57036, 57045, - 57050, 11847, 57054, 37617, 57057, 3580, 19507, 57065, 57072, 19549, - 57076, 57083, 57089, 57094, 11861, 57099, 57111, 57117, 57125, 2693, - 1735, 57133, 57135, 57140, 57145, 57150, 57156, 57161, 57166, 57171, - 57176, 57181, 57186, 57192, 57197, 57202, 57207, 57212, 57217, 57222, - 57227, 57232, 57238, 57243, 57248, 57253, 57259, 57264, 57270, 57275, - 57280, 57285, 57290, 57295, 57300, 57305, 57311, 57316, 57322, 57327, - 57332, 57337, 57342, 57347, 57352, 57357, 57362, 57367, 57372, 57376, - 57380, 57385, 57389, 57394, 57399, 57405, 57410, 57414, 57418, 57421, - 57423, 57427, 57430, 57435, 57439, 57443, 57447, 57451, 57460, 26652, - 57463, 26657, 26662, 57470, 57479, 26668, 57484, 26673, 57493, 57498, - 9018, 57502, 57507, 57512, 57516, 57520, 57524, 57528, 57531, 57535, - 6170, 57541, 57546, 57550, 3467, 57553, 57555, 57559, 57562, 57567, - 57571, 57577, 57590, 57596, 57601, 57605, 57613, 57620, 57628, 57637, - 57645, 26678, 57652, 57662, 57671, 57684, 57689, 57694, 57700, 57707, - 57718, 57730, 57737, 57746, 57755, 57764, 57771, 57777, 57784, 57792, - 57799, 57807, 57816, 57824, 57831, 57839, 57848, 57856, 57865, 57875, - 57884, 57892, 57899, 57907, 57916, 57924, 57933, 57943, 57952, 57960, - 57969, 57979, 57988, 57998, 58009, 58019, 58028, 58036, 58043, 58051, - 58060, 58068, 58077, 58087, 58096, 58104, 58113, 58123, 58132, 58142, - 58153, 58163, 58172, 58180, 58189, 58199, 58208, 58218, 58229, 58239, - 58248, 58258, 58269, 58279, 58290, 58302, 58313, 58323, 58332, 58340, - 58347, 58355, 58364, 58372, 58381, 58391, 58400, 58408, 58417, 58427, - 58436, 58446, 58457, 58467, 58476, 58484, 58493, 58503, 58512, 58522, - 58533, 58543, 58552, 58562, 58573, 58583, 58594, 58606, 58617, 58627, - 58636, 58644, 58653, 58663, 58672, 58682, 58693, 58703, 58712, 58722, - 58733, 58743, 58754, 58766, 58777, 58787, 58796, 58806, 58817, 58827, - 58838, 58850, 58861, 58871, 58882, 58894, 58905, 58917, 58930, 58942, - 58953, 58963, 58972, 58980, 58987, 58995, 59004, 59012, 59021, 59031, - 59040, 59048, 59057, 59067, 59076, 59086, 59097, 59107, 59116, 59124, - 59133, 59143, 59152, 59162, 59173, 59183, 59192, 59202, 59213, 59223, - 59234, 59246, 59257, 59267, 59276, 59284, 59293, 59303, 59312, 59322, - 59333, 59343, 59352, 59362, 59373, 59383, 59394, 59406, 59417, 59427, - 59436, 59446, 59457, 59467, 59478, 59490, 59501, 59511, 59522, 59534, - 59545, 59557, 59570, 59582, 59593, 59603, 59612, 59620, 59629, 59639, - 59648, 59658, 59669, 59679, 59688, 59698, 59709, 59719, 59730, 59742, - 59753, 59763, 59772, 59782, 59793, 59803, 59814, 59826, 59837, 59847, - 59858, 59870, 59881, 59893, 59906, 59918, 59929, 59939, 59948, 59958, - 59969, 59979, 59990, 60002, 60013, 60023, 60034, 60046, 60057, 60069, - 60082, 60094, 60105, 60115, 60126, 60138, 60149, 60161, 60174, 60186, - 60197, 60209, 60222, 60234, 60247, 60261, 60274, 60286, 60297, 60307, - 60316, 60324, 60331, 60336, 6029, 60343, 26688, 60348, 60353, 26693, - 60359, 17319, 31449, 60364, 60370, 60376, 60383, 60390, 60395, 60399, - 60403, 60412, 60418, 60430, 60441, 60445, 2936, 6004, 60450, 60453, - 60455, 60459, 60463, 60467, 34097, 60472, 60476, 60479, 60484, 60488, - 60495, 60501, 60505, 60509, 26703, 60512, 60519, 60528, 60536, 60547, - 60555, 60563, 60570, 60577, 60583, 60594, 26708, 60599, 60610, 60622, - 60633, 60641, 2484, 60646, 60659, 60663, 60671, 60676, 60684, 13908, - 60695, 60701, 60708, 60716, 60722, 26713, 60727, 7592, 50467, 60734, - 60737, 60745, 60758, 60771, 60784, 60797, 60804, 60815, 60824, 34102, - 34107, 60829, 60833, 60841, 60848, 60857, 60865, 60871, 60880, 60888, - 60896, 60900, 60909, 60918, 60928, 60941, 60954, 60964, 26718, 60970, - 60977, 60983, 26724, 60988, 60991, 60995, 61003, 61012, 33840, 61020, - 61028, 61035, 61043, 61053, 61062, 61071, 61080, 61088, 61099, 61109, - 7184, 17802, 61118, 61123, 61128, 61132, 61136, 61141, 61147, 61152, - 61157, 61163, 61168, 61173, 17767, 61178, 61185, 61193, 61201, 61206, - 61213, 61220, 61224, 61228, 61236, 61244, 26733, 61250, 61256, 61268, - 61274, 61279, 61290, 61300, 61310, 61322, 61328, 61338, 26738, 61347, - 61356, 61362, 61374, 61385, 61392, 61397, 61401, 61409, 61415, 61420, - 61425, 61432, 61444, 61454, 61463, 61470, 27937, 19731, 61476, 61481, - 61485, 61489, 61494, 61500, 61511, 61524, 61529, 26743, 61534, 61546, - 61555, 61568, 61575, 61584, 61592, 61597, 61603, 1484, 61608, 61613, - 61618, 61623, 61629, 61634, 61639, 61645, 61651, 61656, 61660, 61665, - 61670, 61675, 50973, 61680, 61685, 61690, 61695, 61701, 61707, 61712, - 61716, 61721, 61726, 61731, 61736, 61741, 61745, 61751, 61756, 61765, - 61770, 61775, 61780, 61785, 61789, 61796, 61802, 13605, 13612, 37872, - 61807, 61757, 61809, 26752, 61812, 61821, 61827, 4263, 26757, 61831, - 61837, 61843, 61848, 61852, 61859, 61864, 61874, 61883, 61887, 61893, - 61899, 61905, 61909, 61917, 61924, 61932, 61940, 26762, 61947, 61950, - 61957, 61962, 61966, 61972, 61977, 61981, 61990, 61998, 62004, 62009, - 27544, 62016, 62023, 62029, 62034, 62040, 62047, 62053, 26475, 22688, - 62059, 62064, 62070, 62082, 61790, 61797, 62092, 62097, 62104, 62111, - 62117, 62128, 62133, 6965, 62141, 62144, 62150, 62154, 62158, 62161, - 62167, 26571, 4283, 836, 10621, 62174, 62180, 62186, 62192, 62198, 62204, - 62210, 62216, 62222, 62227, 62232, 62237, 62242, 62247, 62252, 62257, - 62262, 62267, 62272, 62277, 62282, 62287, 62293, 62298, 62303, 62309, - 62314, 62319, 62325, 62331, 62337, 62343, 62349, 62355, 62361, 62367, - 62373, 62378, 62383, 62389, 62394, 62399, 62405, 62410, 62415, 62420, - 62425, 62430, 62435, 62440, 62445, 62450, 62455, 62460, 62465, 62471, - 62476, 62481, 62486, 62492, 62497, 62502, 62507, 62512, 62518, 62523, - 62528, 62533, 62538, 62543, 62548, 62553, 62558, 62563, 62568, 62573, - 62578, 62583, 62588, 62593, 62598, 62603, 62608, 62613, 62619, 62624, - 62629, 62634, 62639, 62644, 62649, 62654, 1846, 138, 62659, 62663, 62667, - 62672, 62680, 62684, 62691, 62699, 62703, 62716, 62720, 62723, 62728, - 62732, 62737, 62741, 62749, 62753, 17327, 62758, 62762, 62766, 62769, - 62777, 62782, 62789, 62795, 62801, 62806, 62814, 56276, 62821, 62826, - 62831, 62835, 62839, 62842, 62847, 62852, 62856, 62859, 62865, 62869, - 62879, 62888, 62891, 62904, 62912, 62920, 62930, 62943, 62950, 62961, - 62967, 62972, 62977, 62983, 62992, 61536, 63000, 63006, 63014, 63018, - 63022, 63028, 63036, 63048, 63060, 63067, 63071, 63082, 63090, 63097, - 63109, 63117, 63125, 63132, 63138, 63148, 63157, 63162, 63172, 63176, - 63180, 63190, 63197, 63209, 63221, 63230, 60649, 63237, 63248, 63262, - 63270, 63280, 63287, 63295, 63304, 63312, 63322, 63331, 63342, 63354, - 63363, 63373, 63380, 63389, 63404, 63413, 63426, 63441, 63445, 63457, - 63468, 63479, 63490, 63500, 63511, 63519, 63525, 63535, 63541, 63546, - 63552, 63558, 63563, 63570, 7469, 13928, 63576, 63581, 63588, 63594, - 63599, 63603, 63606, 63609, 63611, 63618, 63629, 63634, 63638, 63644, - 63649, 63657, 56720, 56730, 63663, 63673, 63680, 63686, 63691, 63700, - 63707, 63715, 63724, 63730, 63736, 63743, 63750, 63755, 63759, 63764, - 63769, 63774, 63778, 62711, 63787, 63791, 63802, 63812, 13937, 63823, - 63831, 13949, 63838, 22598, 63842, 63846, 63851, 63868, 63880, 8169, - 63892, 63897, 63902, 63907, 63911, 63914, 63919, 63924, 63930, 63935, - 4075, 17378, 63940, 63945, 63951, 63958, 63963, 63968, 63974, 63980, - 63986, 63991, 63997, 64001, 64015, 64023, 64031, 64037, 64042, 64049, - 64054, 64059, 64067, 64072, 64078, 64083, 64088, 64092, 64095, 64113, - 64132, 64145, 64159, 64175, 64182, 64189, 64195, 64202, 64207, 64213, - 64219, 64224, 64229, 64245, 8182, 64259, 64266, 64270, 64273, 64278, - 64283, 64290, 64295, 64300, 64305, 64309, 64317, 9090, 64326, 64331, - 64337, 9101, 64342, 64345, 64350, 64360, 64369, 64374, 64382, 64389, - 64400, 64410, 64415, 64420, 64427, 64433, 64438, 64445, 64454, 64462, - 64468, 64475, 64481, 64485, 13451, 2910, 64490, 64494, 64500, 64506, - 64513, 64517, 64538, 64560, 64576, 64593, 64612, 64621, 64631, 64638, - 64645, 22517, 64651, 64655, 64663, 64669, 64677, 64681, 64689, 64696, - 64700, 64706, 64712, 64717, 3375, 34302, 64723, 64727, 64731, 64735, - 64740, 64745, 64750, 64756, 64761, 64767, 64772, 64777, 64781, 64786, - 34317, 64790, 64795, 64803, 64807, 64812, 64819, 64828, 64834, 64841, - 64845, 64852, 64861, 64866, 64874, 64883, 64889, 64894, 64899, 64905, - 64911, 64916, 64920, 64924, 64927, 64935, 64945, 64950, 32057, 64958, - 64970, 64974, 64986, 64997, 65004, 65010, 65017, 65029, 65036, 65042, - 17439, 65046, 65052, 65058, 65063, 65068, 5084, 65073, 65079, 65087, - 65096, 65100, 65106, 64782, 24971, 65111, 65113, 65118, 65123, 65128, - 65133, 65138, 65143, 65148, 65153, 65158, 65163, 65168, 65173, 65178, - 65183, 65189, 65194, 65199, 65204, 65209, 65214, 65219, 65224, 65229, - 65235, 65241, 65247, 65252, 65257, 65269, 65274, 1852, 67, 65279, 65284, - 26772, 26777, 26782, 26788, 26793, 65288, 26798, 65310, 65312, 65316, - 65320, 65325, 65329, 26802, 65333, 26807, 65341, 65344, 26812, 18179, - 65353, 65357, 1415, 65362, 26823, 65365, 65370, 21354, 21364, 65375, - 65379, 65384, 65390, 65395, 65404, 65409, 65416, 65422, 65427, 65432, - 65437, 65445, 26828, 1110, 65452, 65458, 65463, 65468, 65473, 65479, - 65484, 65491, 65497, 65502, 65510, 65516, 13959, 65523, 29296, 65536, - 65541, 65547, 65560, 65564, 65573, 65580, 65586, 65594, 65603, 65610, - 65616, 26832, 65619, 65626, 65632, 65636, 65639, 65647, 65661, 65668, - 26837, 65674, 26842, 65681, 28422, 65691, 65696, 65700, 17717, 65705, - 65710, 26847, 54013, 65714, 65719, 65725, 65731, 65738, 65744, 65749, - 65754, 65763, 65775, 65790, 27067, 65796, 13117, 26851, 65800, 65807, - 26856, 65813, 65822, 65829, 65838, 65844, 65849, 65855, 26861, 65860, - 65869, 65878, 65885, 65891, 65897, 65905, 65909, 26866, 65912, 26872, - 26878, 65917, 65925, 65935, 26883, 65939, 65941, 65945, 65950, 65954, - 65958, 65964, 65969, 65973, 65978, 2915, 65982, 65989, 65993, 66002, - 66010, 66017, 66022, 66027, 66031, 66035, 66038, 66044, 66052, 66058, - 66062, 66067, 66074, 66080, 28799, 66085, 66088, 66093, 66097, 66102, - 66107, 66111, 66119, 21373, 21382, 66125, 66131, 66137, 66142, 66146, - 66149, 66159, 66164, 66170, 66176, 66184, 66189, 28438, 66193, 66201, - 66207, 66212, 66217, 50653, 28444, 66223, 66228, 66232, 66237, 66242, - 66247, 66251, 66256, 66261, 66267, 66272, 66277, 66283, 66289, 66294, - 66298, 66303, 66308, 66313, 66317, 66322, 66327, 66332, 66338, 66344, - 66350, 66355, 66359, 66364, 66369, 66373, 66378, 66383, 66388, 66392, - 26887, 66400, 66404, 66412, 18521, 66423, 66429, 66436, 66441, 66450, - 66455, 66459, 66464, 66472, 66480, 66487, 56422, 66493, 66501, 66508, - 66519, 66525, 26897, 66528, 66535, 32183, 66539, 66544, 66549, 6877, - 66553, 66561, 66568, 66575, 66581, 66445, 66595, 66601, 66605, 66608, - 66616, 66623, 66628, 66641, 66648, 66653, 66658, 66661, 66668, 66672, - 66682, 66692, 66701, 66712, 66717, 66721, 28813, 17641, 32629, 66729, - 66734, 66739, 66744, 66749, 66754, 66759, 66763, 66768, 66773, 66778, - 66783, 66788, 66793, 66797, 66802, 66807, 66811, 66815, 66819, 66823, - 66828, 66833, 66837, 66842, 66846, 66850, 66855, 66860, 66865, 66870, - 66874, 66879, 66884, 66888, 66893, 66898, 66903, 66908, 66913, 66918, - 66923, 66928, 66933, 66938, 66943, 66948, 66953, 66958, 66963, 66968, - 66973, 66978, 66983, 66988, 66992, 66997, 67002, 67007, 67012, 67017, - 67022, 67027, 67032, 67037, 67042, 67047, 67051, 67056, 67060, 67065, - 67070, 67075, 67080, 67085, 67090, 67095, 67100, 67105, 67109, 67113, - 67118, 67123, 67127, 67132, 67137, 67141, 67146, 67151, 67156, 67161, - 67165, 67170, 67175, 67179, 67184, 67188, 67192, 67196, 67200, 67205, - 67209, 67213, 67217, 67221, 67225, 67229, 67233, 67237, 67241, 67246, - 67251, 67256, 67261, 67266, 67271, 67276, 67281, 67286, 67291, 67295, - 67299, 67303, 67307, 67311, 67315, 67320, 67324, 67329, 67333, 67338, - 67343, 67347, 67351, 67356, 67360, 67364, 67368, 67372, 67376, 67380, - 67384, 67388, 67392, 67396, 67400, 67404, 67408, 67412, 67417, 67422, - 67426, 67430, 67434, 67438, 67442, 67446, 67451, 67455, 67459, 67463, - 67467, 67471, 67475, 67480, 67484, 67489, 67493, 67497, 67501, 67505, - 67509, 67513, 67517, 67521, 67525, 67529, 67533, 67538, 67542, 67546, - 67550, 67554, 67558, 67562, 67566, 67570, 67574, 67578, 67582, 67587, - 67591, 67595, 67600, 67605, 67609, 67613, 67617, 67621, 67625, 67629, - 67633, 67637, 67642, 67646, 67651, 67655, 67660, 67664, 67669, 67673, - 67679, 67684, 67688, 67693, 67697, 67702, 67706, 67711, 67715, 67720, - 1503, 67724, 1741, 1746, 67728, 67732, 2711, 67736, 1384, 67741, 1350, - 67745, 67749, 67756, 67763, 67777, 2727, 5159, 67786, 67794, 67801, - 67808, 67821, 67834, 67845, 67850, 67857, 67869, 3703, 9162, 67873, - 67878, 67887, 67897, 67902, 67906, 67911, 67918, 67924, 67936, 1355, - 11688, 67946, 67952, 67966, 67978, 67987, 67996, 68005, 68013, 68024, - 68032, 3742, 68042, 68051, 68057, 68064, 28919, 68069, 2755, 10316, - 68073, 68080, 6828, 68089, 2760, 26495, 68095, 68102, 68108, 68115, - 68121, 68128, 68138, 68147, 68158, 68165, 68171, 68181, 68189, 68195, - 68210, 68216, 68221, 68228, 68231, 68237, 68244, 68250, 68258, 68267, - 68275, 68281, 68290, 33842, 68304, 68309, 11709, 68315, 68328, 68337, - 68345, 68352, 68356, 68360, 68363, 68370, 68377, 68385, 68393, 68402, - 68410, 11645, 68418, 68423, 68427, 68439, 68446, 68455, 793, 68465, 2776, - 68474, 68478, 68484, 68497, 68509, 68519, 68528, 68540, 68548, 68557, - 68568, 68579, 68589, 68599, 68608, 68616, 8811, 68623, 68627, 68632, - 68637, 68643, 1360, 9217, 68650, 68661, 68670, 68678, 68687, 68695, - 68711, 68722, 68738, 68748, 68769, 68782, 68795, 68800, 68806, 22084, - 68812, 68815, 68822, 68832, 6139, 68839, 68844, 68849, 68857, 7517, 7526, - 68865, 68876, 2784, 2789, 68882, 8419, 68888, 68895, 68902, 68915, 2193, - 50, 68920, 68925, 68935, 68941, 68945, 68950, 68954, 2812, 68966, 68974, - 68985, 68996, 69005, 69010, 69016, 69021, 69031, 69041, 69046, 69052, - 69057, 69066, 17674, 69070, 3804, 12, 69075, 69082, 766, 69088, 69093, - 52873, 69098, 69103, 69109, 69117, 69122, 69129, 69135, 30869, 33740, - 69141, 2816, 32, 69151, 69164, 69172, 69177, 69183, 2838, 25639, 69188, - 69196, 69203, 69208, 50895, 53694, 69217, 1686, 1795, 69222, 69227, - 69234, 1799, 237, 69241, 69247, 69252, 69259, 1803, 69264, 69270, 69275, - 69287, 4250, 69297, 1810, 69303, 69308, 69315, 69322, 69337, 69344, - 69352, 69356, 69360, 69372, 69377, 69381, 23272, 3830, 69385, 69396, - 69400, 69404, 69410, 69414, 69423, 69427, 69438, 69442, 2238, 69446, - 69448, 2935, 7189, 69456, 69461, 69465, 69474, 69480, 2905, 13622, 69484, - 69497, 69515, 69520, 69528, 69536, 69546, 69558, 69571, 69578, 69594, - 69601, 69607, 958, 69614, 69621, 69631, 69640, 69652, 34706, 69660, 2919, - 9391, 69663, 69671, 69675, 2923, 69679, 17523, 52946, 3514, 69683, 2929, - 69687, 69697, 69703, 69709, 69715, 69721, 69727, 69733, 69739, 69745, - 69751, 69757, 69763, 69769, 69775, 69781, 69787, 69793, 69799, 69805, - 69811, 69817, 69823, 69829, 69835, 69841, 69847, 69854, 69861, 69867, - 69873, 69879, 69885, 69891, 69897, 1365, 12692, 9411, 69903, 69908, - 69913, 69918, 69923, 69928, 69933, 69938, 69943, 69948, 69953, 69958, - 69963, 69968, 69973, 69978, 69983, 69988, 69993, 69998, 70003, 70008, - 70013, 70018, 70023, 70028, 70034, 70039, 70044, 70050, 70055, 70061, - 70066, 70071, 70077, 70082, 70087, 70092, 70097, 70102, 70107, 70112, - 70117, 69698, 69704, 69710, 69716, 69722, 69728, 69734, 69740, 69746, - 69752, 69758, 69764, 69770, 69776, 69782, 70123, 69788, 69794, 69800, - 70129, 69806, 69812, 69818, 69824, 69830, 69836, 69842, 69862, 70135, - 70141, 69868, 70147, 69874, 69880, 69886, 69892, 69898, 2950, 2955, - 70153, 70158, 70161, 70167, 70173, 70180, 70185, 70190, 2243, -}; - -/* code->name phrasebook */ -#define phrasebook_shift 7 -#define phrasebook_short 216 -static unsigned char phrasebook[] = { - 0, 223, 254, 246, 95, 78, 228, 69, 78, 54, 55, 248, 155, 55, 229, 169, - 55, 254, 134, 254, 79, 42, 229, 229, 45, 229, 229, 253, 251, 88, 55, 250, - 168, 242, 120, 245, 90, 223, 136, 224, 17, 20, 217, 84, 20, 107, 20, 103, - 20, 160, 20, 154, 20, 174, 20, 182, 20, 191, 20, 185, 20, 190, 250, 175, - 225, 67, 235, 87, 55, 246, 154, 55, 244, 30, 55, 228, 82, 78, 250, 167, - 253, 244, 7, 6, 1, 60, 7, 6, 1, 253, 204, 7, 6, 1, 251, 202, 7, 6, 1, - 250, 46, 7, 6, 1, 73, 7, 6, 1, 246, 74, 7, 6, 1, 245, 67, 7, 6, 1, 243, - 225, 7, 6, 1, 72, 7, 6, 1, 237, 126, 7, 6, 1, 237, 17, 7, 6, 1, 153, 7, - 6, 1, 189, 7, 6, 1, 207, 7, 6, 1, 74, 7, 6, 1, 230, 59, 7, 6, 1, 228, - 163, 7, 6, 1, 152, 7, 6, 1, 198, 7, 6, 1, 222, 201, 7, 6, 1, 68, 7, 6, 1, - 216, 216, 7, 6, 1, 219, 40, 7, 6, 1, 218, 151, 7, 6, 1, 218, 90, 7, 6, 1, - 217, 157, 42, 40, 115, 227, 160, 224, 17, 45, 40, 115, 250, 217, 255, 0, - 109, 235, 43, 244, 37, 255, 0, 7, 3, 1, 60, 7, 3, 1, 253, 204, 7, 3, 1, - 251, 202, 7, 3, 1, 250, 46, 7, 3, 1, 73, 7, 3, 1, 246, 74, 7, 3, 1, 245, - 67, 7, 3, 1, 243, 225, 7, 3, 1, 72, 7, 3, 1, 237, 126, 7, 3, 1, 237, 17, - 7, 3, 1, 153, 7, 3, 1, 189, 7, 3, 1, 207, 7, 3, 1, 74, 7, 3, 1, 230, 59, - 7, 3, 1, 228, 163, 7, 3, 1, 152, 7, 3, 1, 198, 7, 3, 1, 222, 201, 7, 3, - 1, 68, 7, 3, 1, 216, 216, 7, 3, 1, 219, 40, 7, 3, 1, 218, 151, 7, 3, 1, - 218, 90, 7, 3, 1, 217, 157, 42, 250, 79, 115, 69, 235, 43, 45, 250, 79, - 115, 221, 179, 231, 203, 223, 254, 237, 170, 246, 95, 78, 251, 86, 55, - 229, 11, 55, 250, 78, 55, 218, 19, 55, 252, 1, 135, 226, 87, 55, 249, 13, - 250, 126, 55, 245, 215, 230, 103, 237, 211, 235, 112, 51, 254, 120, 228, - 69, 78, 212, 55, 224, 21, 242, 121, 227, 198, 55, 234, 115, 249, 77, 55, - 229, 42, 55, 223, 59, 103, 223, 59, 160, 254, 248, 255, 0, 233, 195, 55, - 229, 73, 55, 233, 193, 248, 145, 251, 92, 223, 59, 107, 234, 58, 230, - 103, 237, 211, 227, 106, 51, 254, 120, 228, 69, 78, 219, 55, 245, 108, - 131, 228, 89, 219, 55, 245, 108, 131, 243, 194, 219, 55, 245, 108, 148, - 228, 87, 237, 170, 228, 82, 78, 7, 6, 1, 112, 2, 244, 36, 7, 6, 1, 112, - 2, 168, 7, 6, 1, 112, 2, 250, 216, 7, 6, 1, 112, 2, 221, 179, 7, 6, 1, - 112, 2, 249, 13, 7, 6, 1, 112, 2, 227, 94, 50, 7, 6, 1, 254, 234, 7, 6, - 1, 251, 203, 2, 251, 92, 7, 6, 1, 178, 2, 244, 36, 7, 6, 1, 178, 2, 168, - 7, 6, 1, 178, 2, 250, 216, 7, 6, 1, 178, 2, 249, 13, 7, 6, 1, 242, 107, - 2, 244, 36, 7, 6, 1, 242, 107, 2, 168, 7, 6, 1, 242, 107, 2, 250, 216, 7, - 6, 1, 242, 107, 2, 249, 13, 7, 6, 1, 246, 118, 7, 6, 1, 233, 34, 2, 221, - 179, 7, 6, 1, 142, 2, 244, 36, 7, 6, 1, 142, 2, 168, 7, 6, 1, 142, 2, - 250, 216, 7, 6, 1, 142, 2, 221, 179, 7, 6, 1, 142, 2, 249, 13, 233, 84, - 55, 7, 6, 1, 142, 2, 92, 7, 6, 1, 105, 2, 244, 36, 7, 6, 1, 105, 2, 168, - 7, 6, 1, 105, 2, 250, 216, 7, 6, 1, 105, 2, 249, 13, 7, 6, 1, 218, 91, 2, - 168, 7, 6, 1, 221, 234, 7, 3, 1, 225, 1, 198, 7, 3, 1, 112, 2, 244, 36, - 7, 3, 1, 112, 2, 168, 7, 3, 1, 112, 2, 250, 216, 7, 3, 1, 112, 2, 221, - 179, 7, 3, 1, 112, 2, 249, 13, 7, 3, 1, 112, 2, 227, 94, 50, 7, 3, 1, - 254, 234, 7, 3, 1, 251, 203, 2, 251, 92, 7, 3, 1, 178, 2, 244, 36, 7, 3, - 1, 178, 2, 168, 7, 3, 1, 178, 2, 250, 216, 7, 3, 1, 178, 2, 249, 13, 7, - 3, 1, 242, 107, 2, 244, 36, 7, 3, 1, 242, 107, 2, 168, 7, 3, 1, 242, 107, - 2, 250, 216, 7, 3, 1, 242, 107, 2, 249, 13, 7, 3, 1, 246, 118, 7, 3, 1, - 233, 34, 2, 221, 179, 7, 3, 1, 142, 2, 244, 36, 7, 3, 1, 142, 2, 168, 7, - 3, 1, 142, 2, 250, 216, 7, 3, 1, 142, 2, 221, 179, 7, 3, 1, 142, 2, 249, - 13, 248, 188, 55, 7, 3, 1, 142, 2, 92, 7, 3, 1, 105, 2, 244, 36, 7, 3, 1, - 105, 2, 168, 7, 3, 1, 105, 2, 250, 216, 7, 3, 1, 105, 2, 249, 13, 7, 3, - 1, 218, 91, 2, 168, 7, 3, 1, 221, 234, 7, 3, 1, 218, 91, 2, 249, 13, 7, - 6, 1, 112, 2, 234, 115, 7, 3, 1, 112, 2, 234, 115, 7, 6, 1, 112, 2, 252, - 8, 7, 3, 1, 112, 2, 252, 8, 7, 6, 1, 112, 2, 230, 162, 7, 3, 1, 112, 2, - 230, 162, 7, 6, 1, 251, 203, 2, 168, 7, 3, 1, 251, 203, 2, 168, 7, 6, 1, - 251, 203, 2, 250, 216, 7, 3, 1, 251, 203, 2, 250, 216, 7, 6, 1, 251, 203, - 2, 61, 50, 7, 3, 1, 251, 203, 2, 61, 50, 7, 6, 1, 251, 203, 2, 251, 130, - 7, 3, 1, 251, 203, 2, 251, 130, 7, 6, 1, 250, 47, 2, 251, 130, 7, 3, 1, - 250, 47, 2, 251, 130, 7, 6, 1, 250, 47, 2, 92, 7, 3, 1, 250, 47, 2, 92, - 7, 6, 1, 178, 2, 234, 115, 7, 3, 1, 178, 2, 234, 115, 7, 6, 1, 178, 2, - 252, 8, 7, 3, 1, 178, 2, 252, 8, 7, 6, 1, 178, 2, 61, 50, 7, 3, 1, 178, - 2, 61, 50, 7, 6, 1, 178, 2, 230, 162, 7, 3, 1, 178, 2, 230, 162, 7, 6, 1, - 178, 2, 251, 130, 7, 3, 1, 178, 2, 251, 130, 7, 6, 1, 245, 68, 2, 250, - 216, 7, 3, 1, 245, 68, 2, 250, 216, 7, 6, 1, 245, 68, 2, 252, 8, 7, 3, 1, - 245, 68, 2, 252, 8, 7, 6, 1, 245, 68, 2, 61, 50, 7, 3, 1, 245, 68, 2, 61, - 50, 7, 6, 1, 245, 68, 2, 251, 92, 7, 3, 1, 245, 68, 2, 251, 92, 7, 6, 1, - 243, 226, 2, 250, 216, 7, 3, 1, 243, 226, 2, 250, 216, 7, 6, 1, 243, 226, - 2, 92, 7, 3, 1, 243, 226, 2, 92, 7, 6, 1, 242, 107, 2, 221, 179, 7, 3, 1, - 242, 107, 2, 221, 179, 7, 6, 1, 242, 107, 2, 234, 115, 7, 3, 1, 242, 107, - 2, 234, 115, 7, 6, 1, 242, 107, 2, 252, 8, 7, 3, 1, 242, 107, 2, 252, 8, - 7, 6, 1, 242, 107, 2, 230, 162, 7, 3, 1, 242, 107, 2, 230, 162, 7, 6, 1, - 242, 107, 2, 61, 50, 7, 3, 1, 248, 144, 72, 7, 6, 24, 237, 253, 7, 3, 24, - 237, 253, 7, 6, 1, 237, 127, 2, 250, 216, 7, 3, 1, 237, 127, 2, 250, 216, - 7, 6, 1, 237, 18, 2, 251, 92, 7, 3, 1, 237, 18, 2, 251, 92, 7, 3, 1, 236, - 17, 7, 6, 1, 235, 202, 2, 168, 7, 3, 1, 235, 202, 2, 168, 7, 6, 1, 235, - 202, 2, 251, 92, 7, 3, 1, 235, 202, 2, 251, 92, 7, 6, 1, 235, 202, 2, - 251, 130, 7, 3, 1, 235, 202, 2, 251, 130, 7, 6, 1, 235, 202, 2, 233, 193, - 248, 145, 7, 3, 1, 235, 202, 2, 233, 193, 248, 145, 7, 6, 1, 235, 202, 2, - 92, 7, 3, 1, 235, 202, 2, 92, 7, 6, 1, 233, 34, 2, 168, 7, 3, 1, 233, 34, - 2, 168, 7, 6, 1, 233, 34, 2, 251, 92, 7, 3, 1, 233, 34, 2, 251, 92, 7, 6, - 1, 233, 34, 2, 251, 130, 7, 3, 1, 233, 34, 2, 251, 130, 7, 3, 1, 233, 34, - 228, 246, 251, 213, 254, 79, 7, 6, 1, 246, 185, 7, 3, 1, 246, 185, 7, 6, - 1, 142, 2, 234, 115, 7, 3, 1, 142, 2, 234, 115, 7, 6, 1, 142, 2, 252, 8, - 7, 3, 1, 142, 2, 252, 8, 7, 6, 1, 142, 2, 51, 168, 7, 3, 1, 142, 2, 51, - 168, 7, 6, 24, 230, 167, 7, 3, 24, 230, 167, 7, 6, 1, 228, 39, 2, 168, 7, - 3, 1, 228, 39, 2, 168, 7, 6, 1, 228, 39, 2, 251, 92, 7, 3, 1, 228, 39, 2, - 251, 92, 7, 6, 1, 228, 39, 2, 251, 130, 7, 3, 1, 228, 39, 2, 251, 130, 7, - 6, 1, 226, 235, 2, 168, 7, 3, 1, 226, 235, 2, 168, 7, 6, 1, 226, 235, 2, - 250, 216, 7, 3, 1, 226, 235, 2, 250, 216, 7, 6, 1, 226, 235, 2, 251, 92, - 7, 3, 1, 226, 235, 2, 251, 92, 7, 6, 1, 226, 235, 2, 251, 130, 7, 3, 1, - 226, 235, 2, 251, 130, 7, 6, 1, 222, 202, 2, 251, 92, 7, 3, 1, 222, 202, - 2, 251, 92, 7, 6, 1, 222, 202, 2, 251, 130, 7, 3, 1, 222, 202, 2, 251, - 130, 7, 6, 1, 222, 202, 2, 92, 7, 3, 1, 222, 202, 2, 92, 7, 6, 1, 105, 2, - 221, 179, 7, 3, 1, 105, 2, 221, 179, 7, 6, 1, 105, 2, 234, 115, 7, 3, 1, - 105, 2, 234, 115, 7, 6, 1, 105, 2, 252, 8, 7, 3, 1, 105, 2, 252, 8, 7, 6, - 1, 105, 2, 227, 94, 50, 7, 3, 1, 105, 2, 227, 94, 50, 7, 6, 1, 105, 2, - 51, 168, 7, 3, 1, 105, 2, 51, 168, 7, 6, 1, 105, 2, 230, 162, 7, 3, 1, - 105, 2, 230, 162, 7, 6, 1, 219, 41, 2, 250, 216, 7, 3, 1, 219, 41, 2, - 250, 216, 7, 6, 1, 218, 91, 2, 250, 216, 7, 3, 1, 218, 91, 2, 250, 216, - 7, 6, 1, 218, 91, 2, 249, 13, 7, 6, 1, 217, 158, 2, 168, 7, 3, 1, 217, - 158, 2, 168, 7, 6, 1, 217, 158, 2, 61, 50, 7, 3, 1, 217, 158, 2, 61, 50, - 7, 6, 1, 217, 158, 2, 251, 130, 7, 3, 1, 217, 158, 2, 251, 130, 7, 3, 1, - 171, 198, 7, 3, 1, 49, 2, 92, 7, 6, 1, 49, 2, 96, 7, 6, 1, 49, 2, 221, - 117, 7, 3, 1, 49, 2, 221, 117, 7, 6, 1, 145, 182, 7, 3, 1, 145, 182, 7, - 6, 1, 230, 119, 74, 7, 6, 1, 251, 203, 2, 96, 7, 3, 1, 251, 203, 2, 96, - 7, 6, 1, 254, 212, 250, 46, 7, 6, 1, 250, 47, 2, 96, 7, 6, 1, 250, 47, 2, - 221, 117, 7, 3, 1, 250, 47, 2, 221, 117, 7, 3, 1, 215, 249, 62, 7, 6, 1, - 210, 73, 7, 6, 1, 226, 104, 7, 6, 1, 230, 119, 73, 7, 6, 1, 246, 75, 2, - 96, 7, 3, 1, 246, 75, 2, 96, 7, 6, 1, 245, 68, 2, 96, 7, 6, 1, 244, 231, - 7, 3, 1, 242, 154, 7, 6, 1, 237, 162, 7, 6, 1, 242, 107, 2, 92, 7, 6, 1, - 237, 18, 2, 96, 7, 3, 1, 237, 18, 2, 96, 7, 3, 1, 235, 202, 2, 135, 7, 3, - 1, 235, 158, 2, 92, 7, 6, 1, 215, 189, 7, 6, 1, 233, 34, 2, 42, 96, 7, 3, - 1, 233, 34, 2, 171, 45, 235, 106, 7, 6, 1, 142, 2, 233, 193, 221, 179, 7, - 6, 1, 142, 2, 242, 189, 7, 3, 1, 142, 2, 242, 189, 7, 6, 1, 230, 158, 7, - 3, 1, 230, 158, 7, 6, 1, 230, 60, 2, 96, 7, 3, 1, 230, 60, 2, 96, 7, 1, - 217, 202, 7, 6, 1, 145, 103, 7, 3, 1, 145, 103, 7, 6, 1, 246, 133, 7, 1, - 210, 246, 134, 234, 247, 7, 3, 1, 222, 202, 2, 230, 29, 96, 7, 6, 1, 222, - 202, 2, 96, 7, 3, 1, 222, 202, 2, 96, 7, 6, 1, 222, 202, 2, 227, 164, 96, - 7, 6, 1, 105, 2, 242, 189, 7, 3, 1, 105, 2, 242, 189, 7, 6, 1, 220, 57, - 7, 6, 1, 220, 11, 2, 96, 7, 6, 1, 218, 91, 2, 96, 7, 3, 1, 218, 91, 2, - 96, 7, 6, 1, 217, 158, 2, 92, 7, 3, 1, 217, 158, 2, 92, 7, 6, 1, 246, 76, - 7, 6, 1, 246, 77, 227, 159, 7, 3, 1, 246, 77, 227, 159, 7, 3, 1, 246, 77, - 2, 222, 135, 7, 1, 124, 2, 92, 7, 6, 1, 145, 174, 7, 3, 1, 145, 174, 7, - 1, 237, 170, 244, 73, 223, 137, 2, 92, 7, 1, 218, 154, 7, 1, 249, 55, - 250, 204, 7, 1, 235, 139, 250, 204, 7, 1, 254, 141, 250, 204, 7, 1, 227, - 164, 250, 204, 7, 6, 1, 247, 76, 2, 251, 130, 7, 6, 1, 250, 47, 2, 3, 1, - 217, 158, 2, 251, 130, 7, 3, 1, 247, 76, 2, 251, 130, 7, 6, 1, 235, 21, - 7, 6, 1, 235, 202, 2, 3, 1, 237, 126, 7, 3, 1, 235, 21, 7, 6, 1, 232, 19, - 7, 6, 1, 233, 34, 2, 3, 1, 237, 126, 7, 3, 1, 232, 19, 7, 6, 1, 112, 2, - 251, 130, 7, 3, 1, 112, 2, 251, 130, 7, 6, 1, 242, 107, 2, 251, 130, 7, - 3, 1, 242, 107, 2, 251, 130, 7, 6, 1, 142, 2, 251, 130, 7, 3, 1, 142, 2, - 251, 130, 7, 6, 1, 105, 2, 251, 130, 7, 3, 1, 105, 2, 251, 130, 7, 6, 1, - 105, 2, 249, 14, 25, 234, 115, 7, 3, 1, 105, 2, 249, 14, 25, 234, 115, 7, - 6, 1, 105, 2, 249, 14, 25, 168, 7, 3, 1, 105, 2, 249, 14, 25, 168, 7, 6, - 1, 105, 2, 249, 14, 25, 251, 130, 7, 3, 1, 105, 2, 249, 14, 25, 251, 130, - 7, 6, 1, 105, 2, 249, 14, 25, 244, 36, 7, 3, 1, 105, 2, 249, 14, 25, 244, - 36, 7, 3, 1, 215, 73, 7, 6, 1, 112, 2, 249, 14, 25, 234, 115, 7, 3, 1, - 112, 2, 249, 14, 25, 234, 115, 7, 6, 1, 112, 2, 61, 71, 25, 234, 115, 7, - 3, 1, 112, 2, 61, 71, 25, 234, 115, 7, 6, 1, 254, 235, 2, 234, 115, 7, 3, - 1, 254, 235, 2, 234, 115, 7, 6, 1, 245, 68, 2, 92, 7, 3, 1, 245, 68, 2, - 92, 7, 6, 1, 245, 68, 2, 251, 130, 7, 3, 1, 245, 68, 2, 251, 130, 7, 6, - 1, 237, 18, 2, 251, 130, 7, 3, 1, 237, 18, 2, 251, 130, 7, 6, 1, 142, 2, - 230, 162, 7, 3, 1, 142, 2, 230, 162, 7, 6, 1, 142, 2, 230, 163, 25, 234, - 115, 7, 3, 1, 142, 2, 230, 163, 25, 234, 115, 7, 6, 1, 246, 77, 2, 251, - 130, 7, 3, 1, 246, 77, 2, 251, 130, 7, 3, 1, 237, 127, 2, 251, 130, 7, 6, - 1, 247, 75, 7, 6, 1, 250, 47, 2, 3, 1, 217, 157, 7, 3, 1, 247, 75, 7, 6, - 1, 245, 68, 2, 168, 7, 3, 1, 245, 68, 2, 168, 7, 6, 1, 242, 152, 7, 6, 1, - 218, 154, 7, 6, 1, 233, 34, 2, 244, 36, 7, 3, 1, 233, 34, 2, 244, 36, 7, - 6, 1, 112, 2, 227, 94, 71, 25, 168, 7, 3, 1, 112, 2, 227, 94, 71, 25, - 168, 7, 6, 1, 254, 235, 2, 168, 7, 3, 1, 254, 235, 2, 168, 7, 6, 1, 142, - 2, 214, 25, 168, 7, 3, 1, 142, 2, 214, 25, 168, 7, 6, 1, 112, 2, 51, 244, - 36, 7, 3, 1, 112, 2, 51, 244, 36, 7, 6, 1, 112, 2, 237, 170, 252, 8, 7, - 3, 1, 112, 2, 237, 170, 252, 8, 7, 6, 1, 178, 2, 51, 244, 36, 7, 3, 1, - 178, 2, 51, 244, 36, 7, 6, 1, 178, 2, 237, 170, 252, 8, 7, 3, 1, 178, 2, - 237, 170, 252, 8, 7, 6, 1, 242, 107, 2, 51, 244, 36, 7, 3, 1, 242, 107, - 2, 51, 244, 36, 7, 6, 1, 242, 107, 2, 237, 170, 252, 8, 7, 3, 1, 242, - 107, 2, 237, 170, 252, 8, 7, 6, 1, 142, 2, 51, 244, 36, 7, 3, 1, 142, 2, - 51, 244, 36, 7, 6, 1, 142, 2, 237, 170, 252, 8, 7, 3, 1, 142, 2, 237, - 170, 252, 8, 7, 6, 1, 228, 39, 2, 51, 244, 36, 7, 3, 1, 228, 39, 2, 51, - 244, 36, 7, 6, 1, 228, 39, 2, 237, 170, 252, 8, 7, 3, 1, 228, 39, 2, 237, - 170, 252, 8, 7, 6, 1, 105, 2, 51, 244, 36, 7, 3, 1, 105, 2, 51, 244, 36, - 7, 6, 1, 105, 2, 237, 170, 252, 8, 7, 3, 1, 105, 2, 237, 170, 252, 8, 7, - 6, 1, 226, 235, 2, 250, 169, 56, 7, 3, 1, 226, 235, 2, 250, 169, 56, 7, - 6, 1, 222, 202, 2, 250, 169, 56, 7, 3, 1, 222, 202, 2, 250, 169, 56, 7, - 6, 1, 217, 218, 7, 3, 1, 217, 218, 7, 6, 1, 243, 226, 2, 251, 130, 7, 3, - 1, 243, 226, 2, 251, 130, 7, 6, 1, 233, 34, 2, 171, 45, 235, 106, 7, 3, - 1, 250, 47, 2, 250, 80, 7, 6, 1, 230, 86, 7, 3, 1, 230, 86, 7, 6, 1, 217, - 158, 2, 96, 7, 3, 1, 217, 158, 2, 96, 7, 6, 1, 112, 2, 61, 50, 7, 3, 1, - 112, 2, 61, 50, 7, 6, 1, 178, 2, 251, 92, 7, 3, 1, 178, 2, 251, 92, 7, 6, - 1, 142, 2, 249, 14, 25, 234, 115, 7, 3, 1, 142, 2, 249, 14, 25, 234, 115, - 7, 6, 1, 142, 2, 221, 180, 25, 234, 115, 7, 3, 1, 142, 2, 221, 180, 25, - 234, 115, 7, 6, 1, 142, 2, 61, 50, 7, 3, 1, 142, 2, 61, 50, 7, 6, 1, 142, - 2, 61, 71, 25, 234, 115, 7, 3, 1, 142, 2, 61, 71, 25, 234, 115, 7, 6, 1, - 218, 91, 2, 234, 115, 7, 3, 1, 218, 91, 2, 234, 115, 7, 3, 1, 235, 202, - 2, 250, 80, 7, 3, 1, 233, 34, 2, 250, 80, 7, 3, 1, 222, 202, 2, 250, 80, - 7, 3, 1, 248, 144, 237, 126, 7, 3, 1, 249, 135, 248, 233, 7, 3, 1, 228, - 99, 248, 233, 7, 6, 1, 112, 2, 92, 7, 6, 1, 251, 203, 2, 92, 7, 3, 1, - 251, 203, 2, 92, 7, 6, 1, 235, 202, 2, 135, 7, 6, 1, 222, 202, 2, 249, - 11, 92, 7, 3, 1, 226, 235, 2, 223, 33, 222, 135, 7, 3, 1, 217, 158, 2, - 223, 33, 222, 135, 7, 6, 1, 244, 73, 223, 136, 7, 3, 1, 244, 73, 223, - 136, 7, 6, 1, 49, 2, 92, 7, 6, 1, 105, 135, 7, 6, 1, 215, 216, 216, 7, 6, - 1, 178, 2, 92, 7, 3, 1, 178, 2, 92, 7, 6, 1, 237, 127, 2, 92, 7, 3, 1, - 237, 127, 2, 92, 7, 6, 1, 3, 228, 164, 2, 242, 247, 222, 135, 7, 3, 1, - 228, 164, 2, 242, 247, 222, 135, 7, 6, 1, 228, 39, 2, 92, 7, 3, 1, 228, - 39, 2, 92, 7, 6, 1, 218, 91, 2, 92, 7, 3, 1, 218, 91, 2, 92, 7, 3, 1, - 215, 60, 7, 3, 1, 254, 146, 7, 3, 1, 215, 254, 146, 7, 3, 1, 49, 2, 96, - 7, 3, 1, 230, 119, 74, 7, 3, 1, 251, 203, 2, 250, 80, 7, 3, 1, 250, 47, - 2, 222, 135, 7, 3, 1, 250, 47, 2, 96, 7, 3, 1, 210, 73, 7, 3, 1, 226, - 104, 7, 3, 1, 226, 105, 2, 96, 7, 3, 1, 230, 119, 73, 7, 3, 1, 210, 230, - 119, 73, 7, 3, 1, 210, 230, 119, 178, 2, 96, 7, 3, 1, 250, 197, 210, 230, - 119, 73, 7, 3, 1, 248, 144, 237, 127, 2, 92, 7, 3, 1, 245, 68, 2, 96, 7, - 3, 1, 102, 245, 67, 7, 1, 3, 6, 245, 67, 7, 3, 1, 244, 231, 7, 3, 1, 227, - 237, 242, 189, 7, 3, 1, 215, 243, 225, 7, 3, 1, 243, 226, 2, 96, 7, 3, 1, - 243, 137, 2, 96, 7, 3, 1, 242, 107, 2, 92, 7, 3, 1, 237, 162, 7, 1, 3, 6, - 72, 7, 3, 1, 235, 202, 2, 233, 193, 221, 179, 7, 3, 1, 235, 202, 2, 252, - 116, 7, 3, 1, 235, 202, 2, 227, 164, 96, 7, 3, 1, 235, 81, 7, 3, 1, 215, - 189, 7, 3, 1, 215, 234, 187, 2, 171, 235, 106, 7, 3, 1, 234, 187, 2, 96, - 7, 3, 1, 233, 34, 2, 42, 96, 7, 3, 1, 233, 34, 2, 227, 164, 96, 7, 1, 3, - 6, 207, 7, 3, 1, 252, 196, 74, 7, 1, 3, 6, 230, 167, 7, 3, 1, 250, 197, - 230, 143, 7, 3, 1, 229, 129, 7, 3, 1, 215, 152, 7, 3, 1, 215, 228, 39, 2, - 171, 235, 106, 7, 3, 1, 215, 228, 39, 2, 96, 7, 3, 1, 228, 39, 2, 171, - 235, 106, 7, 3, 1, 228, 39, 2, 222, 135, 7, 3, 1, 228, 39, 2, 245, 173, - 7, 3, 1, 210, 228, 39, 2, 245, 173, 7, 1, 3, 6, 152, 7, 1, 3, 6, 237, - 170, 152, 7, 3, 1, 226, 235, 2, 96, 7, 3, 1, 246, 133, 7, 3, 1, 248, 144, - 237, 127, 2, 214, 25, 96, 7, 3, 1, 223, 224, 210, 246, 133, 7, 3, 1, 246, - 134, 2, 250, 80, 7, 3, 1, 215, 222, 201, 7, 3, 1, 222, 202, 2, 227, 164, - 96, 7, 3, 1, 105, 135, 7, 3, 1, 220, 57, 7, 3, 1, 220, 11, 2, 96, 7, 3, - 1, 215, 216, 216, 7, 3, 1, 215, 219, 40, 7, 3, 1, 215, 218, 90, 7, 1, 3, - 6, 218, 90, 7, 3, 1, 217, 158, 2, 227, 164, 96, 7, 3, 1, 217, 158, 2, - 250, 80, 7, 3, 1, 246, 76, 7, 3, 1, 246, 77, 2, 250, 80, 7, 1, 244, 73, - 223, 136, 7, 1, 229, 133, 219, 70, 245, 100, 7, 1, 237, 170, 244, 73, - 223, 136, 7, 1, 223, 124, 251, 202, 7, 1, 252, 74, 250, 204, 7, 1, 3, 6, - 253, 204, 7, 3, 1, 250, 197, 230, 119, 73, 7, 1, 3, 6, 245, 68, 2, 96, 7, - 1, 3, 6, 243, 225, 7, 3, 1, 237, 127, 2, 250, 97, 7, 3, 1, 215, 237, 17, - 7, 1, 3, 6, 153, 7, 3, 1, 228, 164, 2, 96, 7, 1, 244, 73, 223, 137, 2, - 92, 7, 1, 210, 244, 73, 223, 137, 2, 92, 7, 3, 1, 247, 76, 248, 233, 7, - 3, 1, 249, 37, 248, 233, 7, 3, 1, 247, 76, 248, 234, 2, 250, 80, 7, 3, 1, - 221, 57, 248, 233, 7, 3, 1, 222, 55, 248, 233, 7, 3, 1, 222, 94, 248, - 234, 2, 250, 80, 7, 3, 1, 245, 213, 248, 233, 7, 3, 1, 234, 233, 248, - 233, 7, 3, 1, 234, 188, 248, 233, 7, 1, 252, 74, 229, 168, 7, 1, 252, 81, - 229, 168, 7, 3, 1, 215, 243, 226, 2, 245, 173, 7, 3, 1, 215, 243, 226, 2, - 245, 174, 25, 222, 135, 58, 1, 3, 243, 225, 58, 1, 3, 243, 226, 2, 96, - 58, 1, 3, 237, 126, 58, 1, 3, 152, 58, 1, 3, 215, 152, 58, 1, 3, 215, - 228, 39, 2, 96, 58, 1, 3, 6, 237, 170, 152, 58, 1, 3, 219, 40, 58, 1, 3, - 218, 90, 58, 1, 228, 235, 58, 1, 51, 228, 235, 58, 1, 215, 250, 168, 58, - 1, 254, 79, 58, 1, 210, 250, 168, 58, 1, 45, 144, 227, 93, 58, 1, 42, - 144, 227, 93, 58, 1, 244, 73, 223, 136, 58, 1, 210, 244, 73, 223, 136, - 58, 1, 42, 254, 20, 58, 1, 45, 254, 20, 58, 1, 108, 254, 20, 58, 1, 113, - 254, 20, 58, 1, 250, 217, 255, 0, 251, 130, 58, 1, 69, 235, 43, 58, 1, - 234, 115, 58, 1, 254, 248, 255, 0, 58, 1, 244, 37, 255, 0, 58, 1, 109, - 69, 235, 43, 58, 1, 109, 234, 115, 58, 1, 109, 244, 37, 255, 0, 58, 1, - 109, 254, 248, 255, 0, 58, 1, 221, 87, 250, 175, 58, 1, 144, 221, 87, - 250, 175, 58, 1, 251, 83, 45, 144, 227, 93, 58, 1, 251, 83, 42, 144, 227, - 93, 58, 1, 108, 222, 143, 58, 1, 113, 222, 143, 58, 1, 88, 55, 58, 1, - 233, 155, 55, 252, 8, 61, 50, 227, 94, 50, 230, 162, 3, 221, 179, 51, - 254, 248, 255, 0, 58, 1, 227, 148, 96, 58, 1, 250, 101, 255, 0, 58, 1, 3, - 244, 231, 58, 1, 3, 153, 58, 1, 3, 198, 58, 1, 3, 218, 151, 58, 1, 3, - 210, 244, 73, 223, 136, 58, 1, 246, 85, 145, 135, 58, 1, 116, 145, 135, - 58, 1, 233, 194, 145, 135, 58, 1, 109, 145, 135, 58, 1, 246, 84, 145, - 135, 58, 1, 217, 241, 249, 52, 145, 78, 58, 1, 218, 46, 249, 52, 145, 78, - 58, 1, 219, 68, 58, 1, 220, 84, 58, 1, 51, 254, 79, 58, 1, 109, 113, 254, - 20, 58, 1, 109, 108, 254, 20, 58, 1, 109, 42, 254, 20, 58, 1, 109, 45, - 254, 20, 58, 1, 109, 227, 93, 58, 1, 233, 193, 244, 37, 255, 0, 58, 1, - 233, 193, 51, 244, 37, 255, 0, 58, 1, 233, 193, 51, 254, 248, 255, 0, 58, - 1, 109, 221, 179, 58, 1, 227, 241, 250, 175, 58, 1, 252, 131, 116, 221, - 132, 58, 1, 246, 190, 116, 221, 132, 58, 1, 252, 131, 109, 221, 132, 58, - 1, 246, 190, 109, 221, 132, 58, 1, 224, 237, 58, 1, 230, 119, 224, 237, - 58, 1, 109, 42, 65, 36, 244, 37, 255, 0, 36, 254, 248, 255, 0, 36, 250, - 217, 255, 0, 36, 221, 179, 36, 234, 115, 36, 230, 73, 36, 252, 8, 36, 61, - 50, 36, 249, 13, 36, 242, 247, 50, 36, 227, 94, 50, 36, 51, 254, 248, - 255, 0, 36, 251, 130, 36, 69, 235, 44, 50, 36, 51, 69, 235, 44, 50, 36, - 51, 244, 37, 255, 0, 36, 251, 146, 36, 237, 170, 252, 8, 36, 215, 250, - 169, 50, 36, 250, 169, 50, 36, 210, 250, 169, 50, 36, 250, 169, 71, 227, - 109, 36, 244, 37, 255, 1, 56, 36, 254, 248, 255, 1, 56, 36, 42, 222, 144, - 56, 36, 45, 222, 144, 56, 36, 42, 254, 120, 50, 36, 242, 189, 36, 42, - 144, 227, 94, 56, 36, 108, 222, 144, 56, 36, 113, 222, 144, 56, 36, 88, - 5, 56, 36, 233, 155, 5, 56, 36, 230, 27, 242, 247, 56, 36, 227, 164, 242, - 247, 56, 36, 61, 56, 36, 249, 14, 56, 36, 227, 94, 56, 36, 250, 169, 56, - 36, 251, 92, 36, 230, 162, 36, 69, 235, 44, 56, 36, 252, 4, 56, 36, 237, - 170, 51, 254, 50, 56, 36, 251, 131, 56, 36, 250, 217, 255, 1, 56, 36, - 252, 9, 56, 36, 237, 170, 252, 9, 56, 36, 221, 180, 56, 36, 234, 116, 56, - 36, 109, 235, 43, 36, 51, 109, 235, 43, 36, 221, 180, 230, 74, 36, 224, - 192, 214, 230, 74, 36, 171, 214, 230, 74, 36, 224, 192, 224, 18, 230, 74, - 36, 171, 224, 18, 230, 74, 36, 45, 144, 227, 94, 56, 36, 237, 170, 252, - 4, 56, 36, 40, 56, 36, 226, 93, 56, 36, 218, 152, 50, 36, 69, 221, 179, - 36, 51, 230, 73, 36, 244, 37, 145, 78, 36, 254, 248, 145, 78, 36, 23, - 229, 163, 36, 23, 236, 33, 36, 23, 249, 8, 221, 123, 36, 23, 217, 207, - 36, 252, 4, 50, 36, 246, 154, 5, 56, 36, 51, 69, 235, 44, 56, 36, 42, - 254, 120, 56, 36, 212, 221, 180, 50, 36, 242, 251, 50, 36, 254, 151, 114, - 199, 50, 36, 42, 45, 76, 56, 36, 220, 53, 76, 56, 36, 244, 41, 237, 54, - 36, 45, 254, 21, 50, 36, 42, 144, 227, 94, 50, 36, 245, 210, 36, 218, - 152, 56, 36, 42, 254, 21, 56, 36, 45, 254, 21, 56, 36, 45, 254, 21, 25, - 108, 254, 21, 56, 36, 45, 144, 227, 94, 50, 36, 61, 71, 227, 109, 36, - 253, 252, 56, 36, 51, 227, 94, 56, 36, 217, 33, 50, 36, 51, 252, 9, 56, - 36, 51, 252, 8, 36, 51, 234, 115, 36, 51, 234, 116, 56, 36, 51, 221, 179, - 36, 51, 237, 170, 252, 8, 36, 51, 90, 76, 56, 36, 7, 3, 1, 60, 36, 7, 3, - 1, 73, 36, 7, 3, 1, 72, 36, 7, 3, 1, 74, 36, 7, 3, 1, 68, 36, 7, 3, 1, - 251, 202, 36, 7, 3, 1, 250, 46, 36, 7, 3, 1, 243, 225, 36, 7, 3, 1, 189, - 36, 7, 3, 1, 152, 36, 7, 3, 1, 222, 201, 36, 7, 3, 1, 216, 216, 36, 7, 3, - 1, 218, 151, 23, 6, 1, 243, 127, 23, 3, 1, 243, 127, 23, 6, 1, 254, 49, - 226, 142, 23, 3, 1, 254, 49, 226, 142, 23, 231, 107, 55, 23, 234, 237, - 231, 107, 55, 23, 6, 1, 230, 15, 248, 240, 23, 3, 1, 230, 15, 248, 240, - 23, 217, 207, 23, 3, 210, 234, 218, 224, 128, 100, 23, 3, 247, 143, 234, - 218, 224, 128, 100, 23, 3, 210, 247, 143, 234, 218, 224, 128, 100, 23, - 228, 82, 78, 23, 221, 123, 23, 249, 8, 221, 123, 23, 6, 1, 254, 147, 2, - 221, 123, 23, 254, 110, 222, 73, 23, 6, 1, 246, 157, 2, 221, 123, 23, 6, - 1, 246, 122, 2, 221, 123, 23, 6, 1, 237, 163, 2, 221, 123, 23, 6, 1, 230, - 142, 2, 221, 123, 23, 6, 1, 220, 58, 2, 221, 123, 23, 6, 1, 230, 144, 2, - 221, 123, 23, 3, 1, 237, 163, 2, 249, 8, 25, 221, 123, 23, 6, 1, 254, - 146, 23, 6, 1, 252, 102, 23, 6, 1, 244, 231, 23, 6, 1, 249, 62, 23, 6, 1, - 246, 156, 23, 6, 1, 217, 83, 23, 6, 1, 246, 121, 23, 6, 1, 222, 6, 23, 6, - 1, 237, 162, 23, 6, 1, 236, 221, 23, 6, 1, 235, 156, 23, 6, 1, 233, 99, - 23, 6, 1, 231, 144, 23, 6, 1, 218, 130, 23, 6, 1, 230, 141, 23, 6, 1, - 229, 108, 23, 6, 1, 227, 149, 23, 6, 1, 224, 127, 23, 6, 1, 222, 105, 23, - 6, 1, 220, 57, 23, 6, 1, 229, 129, 23, 6, 1, 251, 31, 23, 6, 1, 228, 212, - 23, 6, 1, 230, 143, 23, 6, 1, 237, 163, 2, 249, 7, 23, 6, 1, 220, 58, 2, - 249, 7, 23, 3, 1, 254, 147, 2, 221, 123, 23, 3, 1, 246, 157, 2, 221, 123, - 23, 3, 1, 246, 122, 2, 221, 123, 23, 3, 1, 237, 163, 2, 221, 123, 23, 3, - 1, 220, 58, 2, 249, 8, 25, 221, 123, 23, 3, 1, 254, 146, 23, 3, 1, 252, - 102, 23, 3, 1, 244, 231, 23, 3, 1, 249, 62, 23, 3, 1, 246, 156, 23, 3, 1, - 217, 83, 23, 3, 1, 246, 121, 23, 3, 1, 222, 6, 23, 3, 1, 237, 162, 23, 3, - 1, 236, 221, 23, 3, 1, 235, 156, 23, 3, 1, 233, 99, 23, 3, 1, 231, 144, - 23, 3, 1, 218, 130, 23, 3, 1, 230, 141, 23, 3, 1, 229, 108, 23, 3, 1, - 227, 149, 23, 3, 1, 39, 224, 127, 23, 3, 1, 224, 127, 23, 3, 1, 222, 105, - 23, 3, 1, 220, 57, 23, 3, 1, 229, 129, 23, 3, 1, 251, 31, 23, 3, 1, 228, - 212, 23, 3, 1, 230, 143, 23, 3, 1, 237, 163, 2, 249, 7, 23, 3, 1, 220, - 58, 2, 249, 7, 23, 3, 1, 230, 142, 2, 221, 123, 23, 3, 1, 220, 58, 2, - 221, 123, 23, 3, 1, 230, 144, 2, 221, 123, 23, 6, 236, 244, 100, 23, 252, - 103, 100, 23, 222, 7, 100, 23, 220, 58, 2, 242, 247, 100, 23, 220, 58, 2, - 254, 248, 25, 242, 247, 100, 23, 220, 58, 2, 249, 14, 25, 242, 247, 100, - 23, 229, 130, 100, 23, 229, 109, 100, 23, 236, 244, 100, 23, 1, 254, 49, - 236, 37, 23, 3, 1, 254, 49, 236, 37, 23, 1, 223, 144, 23, 3, 1, 223, 144, - 23, 1, 248, 240, 23, 3, 1, 248, 240, 23, 1, 236, 37, 23, 3, 1, 236, 37, - 23, 1, 226, 142, 23, 3, 1, 226, 142, 75, 6, 1, 224, 238, 75, 3, 1, 224, - 238, 75, 6, 1, 245, 219, 75, 3, 1, 245, 219, 75, 6, 1, 236, 135, 75, 3, - 1, 236, 135, 75, 6, 1, 242, 242, 75, 3, 1, 242, 242, 75, 6, 1, 244, 226, - 75, 3, 1, 244, 226, 75, 6, 1, 224, 211, 75, 3, 1, 224, 211, 75, 6, 1, - 249, 75, 75, 3, 1, 249, 75, 23, 236, 222, 100, 23, 227, 150, 100, 23, - 234, 218, 224, 128, 100, 23, 1, 217, 212, 23, 6, 222, 7, 100, 23, 234, - 218, 246, 157, 100, 23, 210, 234, 218, 246, 157, 100, 23, 6, 1, 224, 200, - 23, 3, 1, 224, 200, 23, 6, 234, 218, 224, 128, 100, 23, 6, 1, 226, 140, - 23, 3, 1, 226, 140, 23, 227, 150, 2, 214, 100, 23, 6, 210, 234, 218, 224, - 128, 100, 23, 6, 247, 143, 234, 218, 224, 128, 100, 23, 6, 210, 247, 143, - 234, 218, 224, 128, 100, 31, 6, 1, 238, 27, 2, 244, 36, 31, 6, 1, 237, - 166, 31, 6, 1, 248, 182, 31, 6, 1, 244, 78, 31, 6, 1, 220, 99, 238, 26, - 31, 6, 1, 247, 73, 31, 6, 1, 251, 211, 72, 31, 6, 1, 217, 250, 31, 6, 1, - 237, 114, 31, 6, 1, 235, 20, 31, 6, 1, 232, 15, 31, 6, 1, 221, 46, 31, 6, - 1, 236, 76, 31, 6, 1, 242, 107, 2, 244, 36, 31, 6, 1, 224, 192, 68, 31, - 6, 1, 247, 69, 31, 6, 1, 60, 31, 6, 1, 252, 144, 31, 6, 1, 219, 165, 31, - 6, 1, 244, 116, 31, 6, 1, 249, 92, 31, 6, 1, 238, 26, 31, 6, 1, 217, 72, - 31, 6, 1, 217, 92, 31, 6, 1, 72, 31, 6, 1, 224, 192, 72, 31, 6, 1, 175, - 31, 6, 1, 246, 217, 31, 6, 1, 246, 205, 31, 6, 1, 246, 197, 31, 6, 1, 74, - 31, 6, 1, 229, 198, 31, 6, 1, 246, 148, 31, 6, 1, 246, 138, 31, 6, 1, - 222, 87, 31, 6, 1, 68, 31, 6, 1, 246, 244, 31, 6, 1, 155, 31, 6, 1, 221, - 50, 31, 6, 1, 251, 46, 31, 6, 1, 225, 25, 31, 6, 1, 224, 248, 31, 6, 1, - 243, 181, 55, 31, 6, 1, 218, 7, 31, 6, 1, 224, 21, 55, 31, 6, 1, 73, 31, - 6, 1, 217, 200, 31, 6, 1, 184, 31, 3, 1, 60, 31, 3, 1, 252, 144, 31, 3, - 1, 219, 165, 31, 3, 1, 244, 116, 31, 3, 1, 249, 92, 31, 3, 1, 238, 26, - 31, 3, 1, 217, 72, 31, 3, 1, 217, 92, 31, 3, 1, 72, 31, 3, 1, 224, 192, - 72, 31, 3, 1, 175, 31, 3, 1, 246, 217, 31, 3, 1, 246, 205, 31, 3, 1, 246, - 197, 31, 3, 1, 74, 31, 3, 1, 229, 198, 31, 3, 1, 246, 148, 31, 3, 1, 246, - 138, 31, 3, 1, 222, 87, 31, 3, 1, 68, 31, 3, 1, 246, 244, 31, 3, 1, 155, - 31, 3, 1, 221, 50, 31, 3, 1, 251, 46, 31, 3, 1, 225, 25, 31, 3, 1, 224, - 248, 31, 3, 1, 243, 181, 55, 31, 3, 1, 218, 7, 31, 3, 1, 224, 21, 55, 31, - 3, 1, 73, 31, 3, 1, 217, 200, 31, 3, 1, 184, 31, 3, 1, 238, 27, 2, 244, - 36, 31, 3, 1, 237, 166, 31, 3, 1, 248, 182, 31, 3, 1, 244, 78, 31, 3, 1, - 220, 99, 238, 26, 31, 3, 1, 247, 73, 31, 3, 1, 251, 211, 72, 31, 3, 1, - 217, 250, 31, 3, 1, 237, 114, 31, 3, 1, 235, 20, 31, 3, 1, 232, 15, 31, - 3, 1, 221, 46, 31, 3, 1, 236, 76, 31, 3, 1, 242, 107, 2, 244, 36, 31, 3, - 1, 224, 192, 68, 31, 3, 1, 247, 69, 31, 6, 1, 230, 143, 31, 3, 1, 230, - 143, 31, 6, 1, 218, 36, 31, 3, 1, 218, 36, 31, 6, 1, 237, 160, 73, 31, 3, - 1, 237, 160, 73, 31, 6, 1, 235, 25, 217, 178, 31, 3, 1, 235, 25, 217, - 178, 31, 6, 1, 237, 160, 235, 25, 217, 178, 31, 3, 1, 237, 160, 235, 25, - 217, 178, 31, 6, 1, 252, 76, 217, 178, 31, 3, 1, 252, 76, 217, 178, 31, - 6, 1, 237, 160, 252, 76, 217, 178, 31, 3, 1, 237, 160, 252, 76, 217, 178, - 31, 6, 1, 236, 11, 31, 3, 1, 236, 11, 31, 6, 1, 228, 212, 31, 3, 1, 228, - 212, 31, 6, 1, 245, 171, 31, 3, 1, 245, 171, 31, 6, 1, 237, 128, 31, 3, - 1, 237, 128, 31, 6, 1, 237, 129, 2, 51, 244, 37, 255, 0, 31, 3, 1, 237, - 129, 2, 51, 244, 37, 255, 0, 31, 6, 1, 220, 102, 31, 3, 1, 220, 102, 31, - 6, 1, 227, 57, 230, 143, 31, 3, 1, 227, 57, 230, 143, 31, 6, 1, 230, 144, - 2, 221, 160, 31, 3, 1, 230, 144, 2, 221, 160, 31, 6, 1, 230, 92, 31, 3, - 1, 230, 92, 31, 6, 1, 236, 37, 31, 3, 1, 236, 37, 31, 221, 230, 55, 36, - 31, 221, 160, 36, 31, 230, 28, 36, 31, 193, 229, 39, 36, 31, 209, 229, - 39, 36, 31, 229, 25, 36, 31, 242, 162, 221, 230, 55, 36, 31, 233, 162, - 55, 31, 6, 1, 224, 192, 242, 107, 2, 222, 135, 31, 3, 1, 224, 192, 242, - 107, 2, 222, 135, 31, 6, 1, 225, 63, 55, 31, 3, 1, 225, 63, 55, 31, 6, 1, - 246, 149, 2, 221, 202, 31, 3, 1, 246, 149, 2, 221, 202, 31, 6, 1, 244, - 117, 2, 220, 56, 31, 3, 1, 244, 117, 2, 220, 56, 31, 6, 1, 244, 117, 2, - 92, 31, 3, 1, 244, 117, 2, 92, 31, 6, 1, 244, 117, 2, 233, 193, 96, 31, - 3, 1, 244, 117, 2, 233, 193, 96, 31, 6, 1, 217, 73, 2, 249, 48, 31, 3, 1, - 217, 73, 2, 249, 48, 31, 6, 1, 217, 93, 2, 249, 48, 31, 3, 1, 217, 93, 2, - 249, 48, 31, 6, 1, 206, 2, 249, 48, 31, 3, 1, 206, 2, 249, 48, 31, 6, 1, - 206, 2, 69, 92, 31, 3, 1, 206, 2, 69, 92, 31, 6, 1, 206, 2, 92, 31, 3, 1, - 206, 2, 92, 31, 6, 1, 252, 186, 175, 31, 3, 1, 252, 186, 175, 31, 6, 1, - 246, 198, 2, 249, 48, 31, 3, 1, 246, 198, 2, 249, 48, 31, 6, 24, 246, - 198, 244, 116, 31, 3, 24, 246, 198, 244, 116, 31, 6, 1, 229, 199, 2, 233, - 193, 96, 31, 3, 1, 229, 199, 2, 233, 193, 96, 31, 6, 1, 255, 6, 155, 31, - 3, 1, 255, 6, 155, 31, 6, 1, 246, 139, 2, 249, 48, 31, 3, 1, 246, 139, 2, - 249, 48, 31, 6, 1, 222, 88, 2, 249, 48, 31, 3, 1, 222, 88, 2, 249, 48, - 31, 6, 1, 223, 130, 68, 31, 3, 1, 223, 130, 68, 31, 6, 1, 223, 130, 105, - 2, 92, 31, 3, 1, 223, 130, 105, 2, 92, 31, 6, 1, 243, 214, 2, 249, 48, - 31, 3, 1, 243, 214, 2, 249, 48, 31, 6, 24, 222, 88, 221, 50, 31, 3, 24, - 222, 88, 221, 50, 31, 6, 1, 251, 47, 2, 249, 48, 31, 3, 1, 251, 47, 2, - 249, 48, 31, 6, 1, 251, 47, 2, 69, 92, 31, 3, 1, 251, 47, 2, 69, 92, 31, - 6, 1, 224, 222, 31, 3, 1, 224, 222, 31, 6, 1, 255, 6, 251, 46, 31, 3, 1, - 255, 6, 251, 46, 31, 6, 1, 255, 6, 251, 47, 2, 249, 48, 31, 3, 1, 255, 6, - 251, 47, 2, 249, 48, 31, 1, 230, 22, 31, 6, 1, 217, 73, 2, 252, 8, 31, 3, - 1, 217, 73, 2, 252, 8, 31, 6, 1, 206, 2, 96, 31, 3, 1, 206, 2, 96, 31, 6, - 1, 246, 218, 2, 222, 135, 31, 3, 1, 246, 218, 2, 222, 135, 31, 6, 1, 246, - 198, 2, 96, 31, 3, 1, 246, 198, 2, 96, 31, 6, 1, 246, 198, 2, 222, 135, - 31, 3, 1, 246, 198, 2, 222, 135, 31, 6, 1, 236, 144, 251, 46, 31, 3, 1, - 236, 144, 251, 46, 31, 6, 1, 246, 206, 2, 222, 135, 31, 3, 1, 246, 206, - 2, 222, 135, 31, 3, 1, 230, 22, 31, 6, 1, 112, 2, 252, 8, 31, 3, 1, 112, - 2, 252, 8, 31, 6, 1, 112, 2, 249, 13, 31, 3, 1, 112, 2, 249, 13, 31, 6, - 24, 112, 238, 26, 31, 3, 24, 112, 238, 26, 31, 6, 1, 238, 27, 2, 252, 8, - 31, 3, 1, 238, 27, 2, 252, 8, 31, 6, 1, 226, 104, 31, 3, 1, 226, 104, 31, - 6, 1, 226, 105, 2, 249, 13, 31, 3, 1, 226, 105, 2, 249, 13, 31, 6, 1, - 217, 73, 2, 249, 13, 31, 3, 1, 217, 73, 2, 249, 13, 31, 6, 1, 217, 93, 2, - 249, 13, 31, 3, 1, 217, 93, 2, 249, 13, 31, 6, 1, 255, 6, 247, 73, 31, 3, - 1, 255, 6, 247, 73, 31, 6, 1, 242, 107, 2, 234, 115, 31, 3, 1, 242, 107, - 2, 234, 115, 31, 6, 1, 242, 107, 2, 249, 13, 31, 3, 1, 242, 107, 2, 249, - 13, 31, 6, 1, 142, 2, 249, 13, 31, 3, 1, 142, 2, 249, 13, 31, 6, 1, 252, - 196, 74, 31, 3, 1, 252, 196, 74, 31, 6, 1, 252, 196, 142, 2, 249, 13, 31, - 3, 1, 252, 196, 142, 2, 249, 13, 31, 6, 1, 178, 2, 249, 13, 31, 3, 1, - 178, 2, 249, 13, 31, 6, 1, 105, 2, 234, 115, 31, 3, 1, 105, 2, 234, 115, - 31, 6, 1, 105, 2, 249, 13, 31, 3, 1, 105, 2, 249, 13, 31, 6, 1, 105, 2, - 51, 168, 31, 3, 1, 105, 2, 51, 168, 31, 6, 1, 251, 47, 2, 249, 13, 31, 3, - 1, 251, 47, 2, 249, 13, 31, 6, 1, 244, 117, 2, 249, 48, 31, 3, 1, 244, - 117, 2, 249, 48, 31, 6, 1, 218, 8, 2, 249, 13, 31, 3, 1, 218, 8, 2, 249, - 13, 31, 6, 1, 244, 117, 2, 214, 25, 96, 31, 3, 1, 244, 117, 2, 214, 25, - 96, 31, 6, 1, 243, 214, 2, 96, 31, 3, 1, 243, 214, 2, 96, 31, 6, 1, 243, - 214, 2, 92, 31, 3, 1, 243, 214, 2, 92, 31, 6, 1, 236, 45, 249, 92, 31, 3, - 1, 236, 45, 249, 92, 31, 6, 1, 236, 45, 248, 182, 31, 3, 1, 236, 45, 248, - 182, 31, 6, 1, 236, 45, 217, 25, 31, 3, 1, 236, 45, 217, 25, 31, 6, 1, - 236, 45, 247, 67, 31, 3, 1, 236, 45, 247, 67, 31, 6, 1, 236, 45, 235, 20, - 31, 3, 1, 236, 45, 235, 20, 31, 6, 1, 236, 45, 232, 15, 31, 3, 1, 236, - 45, 232, 15, 31, 6, 1, 236, 45, 224, 67, 31, 3, 1, 236, 45, 224, 67, 31, - 6, 1, 236, 45, 221, 156, 31, 3, 1, 236, 45, 221, 156, 31, 6, 1, 210, 217, - 92, 31, 3, 1, 210, 217, 92, 31, 6, 1, 246, 218, 2, 96, 31, 3, 1, 246, - 218, 2, 96, 31, 6, 1, 235, 79, 31, 3, 1, 235, 79, 31, 6, 1, 227, 151, 31, - 3, 1, 227, 151, 31, 6, 1, 218, 65, 31, 3, 1, 218, 65, 31, 6, 1, 228, 155, - 31, 3, 1, 228, 155, 31, 6, 1, 218, 227, 31, 3, 1, 218, 227, 31, 6, 1, - 254, 165, 175, 31, 3, 1, 254, 165, 175, 31, 6, 1, 246, 218, 2, 233, 193, - 96, 31, 3, 1, 246, 218, 2, 233, 193, 96, 31, 6, 1, 246, 198, 2, 233, 193, - 96, 31, 3, 1, 246, 198, 2, 233, 193, 96, 31, 6, 1, 229, 199, 2, 249, 48, - 31, 3, 1, 229, 199, 2, 249, 48, 132, 6, 1, 253, 209, 132, 6, 1, 252, 114, - 132, 6, 1, 244, 93, 132, 6, 1, 249, 207, 132, 6, 1, 246, 254, 132, 6, 1, - 217, 114, 132, 6, 1, 246, 239, 132, 6, 1, 246, 123, 132, 6, 1, 101, 132, - 6, 1, 217, 72, 132, 6, 1, 237, 200, 132, 6, 1, 235, 23, 132, 6, 1, 218, - 133, 132, 6, 1, 251, 169, 132, 6, 1, 236, 168, 132, 6, 1, 243, 4, 132, 6, - 1, 237, 123, 132, 6, 1, 244, 124, 132, 6, 1, 251, 42, 132, 6, 1, 233, - 251, 132, 6, 1, 217, 250, 132, 6, 1, 231, 174, 132, 6, 1, 225, 25, 132, - 6, 1, 219, 72, 132, 6, 1, 251, 69, 132, 6, 1, 229, 187, 132, 6, 1, 237, - 100, 132, 6, 1, 203, 132, 6, 1, 226, 77, 132, 6, 1, 219, 96, 132, 6, 1, - 221, 158, 132, 6, 1, 227, 196, 132, 6, 1, 250, 182, 132, 6, 1, 217, 236, - 132, 6, 1, 229, 61, 132, 6, 1, 236, 178, 132, 6, 1, 230, 161, 132, 6, 1, - 245, 221, 132, 58, 1, 42, 144, 227, 93, 132, 254, 79, 132, 246, 201, 78, - 132, 246, 95, 78, 132, 250, 168, 132, 228, 82, 78, 132, 255, 7, 78, 132, - 3, 1, 253, 209, 132, 3, 1, 252, 114, 132, 3, 1, 244, 93, 132, 3, 1, 249, - 207, 132, 3, 1, 246, 254, 132, 3, 1, 217, 114, 132, 3, 1, 246, 239, 132, - 3, 1, 246, 123, 132, 3, 1, 101, 132, 3, 1, 217, 72, 132, 3, 1, 237, 200, - 132, 3, 1, 235, 23, 132, 3, 1, 218, 133, 132, 3, 1, 251, 169, 132, 3, 1, - 236, 168, 132, 3, 1, 243, 4, 132, 3, 1, 237, 123, 132, 3, 1, 244, 124, - 132, 3, 1, 251, 42, 132, 3, 1, 233, 251, 132, 3, 1, 217, 250, 132, 3, 1, - 231, 174, 132, 3, 1, 225, 25, 132, 3, 1, 219, 72, 132, 3, 1, 251, 69, - 132, 3, 1, 229, 187, 132, 3, 1, 237, 100, 132, 3, 1, 203, 132, 3, 1, 226, - 77, 132, 3, 1, 219, 96, 132, 3, 1, 221, 158, 132, 3, 1, 227, 196, 132, 3, - 1, 250, 182, 132, 3, 1, 217, 236, 132, 3, 1, 229, 61, 132, 3, 1, 236, - 178, 132, 3, 1, 230, 161, 132, 3, 1, 245, 221, 132, 3, 24, 246, 255, 217, - 236, 132, 245, 90, 223, 136, 132, 242, 121, 87, 255, 1, 246, 116, 87, - 255, 1, 226, 78, 87, 255, 1, 225, 12, 87, 255, 1, 217, 102, 228, 138, 87, - 255, 1, 217, 102, 244, 246, 87, 255, 1, 221, 168, 87, 255, 1, 227, 158, - 87, 255, 1, 217, 101, 87, 255, 1, 229, 219, 87, 255, 1, 218, 0, 87, 255, - 1, 222, 41, 87, 255, 1, 244, 171, 87, 255, 1, 244, 172, 233, 70, 87, 255, - 1, 244, 169, 87, 255, 1, 228, 139, 229, 242, 87, 255, 1, 222, 70, 244, - 185, 87, 255, 1, 229, 202, 87, 255, 1, 253, 239, 243, 206, 87, 255, 1, - 233, 79, 87, 255, 1, 234, 104, 87, 255, 1, 233, 245, 87, 255, 1, 233, - 246, 236, 179, 87, 255, 1, 249, 153, 87, 255, 1, 228, 150, 87, 255, 1, - 222, 70, 228, 134, 87, 255, 1, 218, 10, 252, 115, 217, 217, 87, 255, 1, - 230, 149, 87, 255, 1, 237, 241, 87, 255, 1, 249, 76, 87, 255, 1, 217, 31, - 87, 164, 234, 54, 250, 221, 87, 229, 32, 224, 224, 87, 229, 32, 243, 172, - 226, 78, 87, 229, 32, 243, 172, 229, 214, 87, 229, 32, 243, 172, 228, - 143, 87, 229, 32, 243, 94, 87, 229, 32, 221, 48, 87, 229, 32, 226, 78, - 87, 229, 32, 229, 214, 87, 229, 32, 228, 143, 87, 229, 32, 242, 254, 87, - 229, 32, 242, 255, 243, 174, 35, 219, 169, 87, 229, 32, 228, 85, 87, 229, - 32, 249, 194, 156, 234, 77, 87, 229, 32, 233, 237, 87, 228, 197, 234, 76, - 87, 229, 32, 227, 248, 87, 228, 197, 229, 220, 87, 229, 32, 224, 210, - 248, 145, 87, 229, 32, 224, 113, 248, 145, 87, 228, 197, 224, 22, 229, - 216, 87, 164, 220, 60, 248, 145, 87, 164, 234, 237, 248, 145, 87, 228, - 197, 231, 104, 243, 205, 87, 229, 32, 228, 144, 228, 138, 87, 1, 254, - 168, 87, 1, 252, 104, 87, 1, 244, 91, 87, 1, 249, 177, 87, 1, 243, 162, - 87, 1, 219, 169, 87, 1, 217, 95, 87, 1, 243, 128, 87, 1, 222, 50, 87, 1, - 217, 220, 87, 1, 39, 236, 246, 87, 1, 236, 246, 87, 1, 235, 152, 87, 1, - 39, 234, 1, 87, 1, 234, 1, 87, 1, 39, 231, 103, 87, 1, 231, 103, 87, 1, - 226, 145, 87, 1, 253, 207, 87, 1, 39, 229, 198, 87, 1, 229, 198, 87, 1, - 39, 221, 51, 87, 1, 221, 51, 87, 1, 228, 107, 87, 1, 227, 174, 87, 1, - 224, 209, 87, 1, 222, 102, 87, 24, 217, 248, 51, 219, 169, 87, 24, 217, - 248, 219, 170, 217, 220, 87, 24, 217, 248, 51, 217, 220, 87, 228, 197, - 244, 171, 87, 228, 197, 244, 169, 12, 54, 55, 12, 5, 226, 139, 12, 245, - 132, 234, 63, 12, 5, 226, 167, 254, 63, 250, 89, 227, 64, 254, 63, 245, - 110, 227, 64, 12, 227, 222, 254, 63, 229, 170, 233, 164, 55, 254, 63, - 229, 170, 222, 66, 221, 232, 55, 254, 214, 55, 12, 250, 168, 12, 249, - 141, 225, 54, 12, 229, 34, 219, 154, 55, 12, 5, 233, 147, 12, 5, 226, - 152, 254, 170, 218, 245, 12, 5, 254, 170, 254, 0, 12, 5, 227, 247, 254, - 169, 12, 5, 227, 251, 254, 155, 254, 116, 12, 5, 222, 128, 12, 3, 116, - 222, 137, 12, 3, 116, 24, 99, 2, 235, 161, 2, 218, 21, 12, 3, 116, 217, - 106, 12, 3, 245, 238, 12, 3, 249, 172, 12, 3, 236, 206, 12, 225, 67, 12, - 221, 78, 61, 228, 197, 78, 12, 228, 82, 78, 12, 1, 243, 192, 12, 1, 99, - 2, 234, 111, 50, 12, 1, 99, 2, 181, 50, 12, 1, 218, 234, 2, 181, 50, 12, - 1, 99, 2, 181, 56, 12, 1, 70, 2, 181, 50, 12, 1, 254, 168, 12, 1, 252, - 128, 12, 1, 222, 78, 234, 72, 12, 1, 222, 77, 12, 1, 222, 19, 12, 1, 237, - 112, 12, 1, 243, 202, 12, 1, 236, 146, 12, 1, 249, 183, 12, 1, 222, 29, - 12, 1, 227, 196, 12, 1, 217, 106, 12, 1, 226, 82, 12, 1, 224, 242, 12, 1, - 226, 170, 12, 1, 249, 202, 12, 1, 222, 137, 12, 1, 217, 109, 12, 1, 254, - 191, 12, 1, 244, 122, 12, 1, 236, 177, 2, 124, 188, 50, 12, 1, 236, 177, - 2, 148, 188, 56, 12, 1, 245, 241, 70, 2, 237, 170, 216, 216, 12, 1, 245, - 241, 70, 2, 124, 188, 50, 12, 1, 245, 241, 70, 2, 148, 188, 50, 12, 222, - 107, 12, 1, 245, 221, 12, 1, 228, 148, 12, 1, 236, 246, 12, 1, 235, 160, - 12, 1, 234, 14, 12, 1, 231, 193, 12, 1, 243, 146, 12, 1, 218, 233, 12, 1, - 99, 234, 92, 12, 1, 218, 21, 12, 245, 236, 12, 249, 170, 12, 236, 204, - 12, 245, 238, 12, 249, 172, 12, 236, 206, 12, 225, 16, 12, 223, 75, 12, - 234, 109, 50, 12, 181, 50, 12, 181, 56, 12, 223, 94, 254, 168, 12, 237, - 170, 249, 172, 12, 164, 231, 194, 244, 107, 12, 216, 255, 12, 29, 5, 3, - 220, 11, 50, 12, 29, 5, 237, 170, 3, 220, 11, 50, 12, 29, 5, 61, 56, 12, - 210, 249, 172, 12, 245, 239, 2, 124, 248, 143, 254, 63, 20, 217, 84, 254, - 63, 20, 107, 254, 63, 20, 103, 254, 63, 20, 160, 254, 63, 20, 154, 254, - 63, 20, 174, 254, 63, 20, 182, 254, 63, 20, 191, 254, 63, 20, 185, 254, - 63, 20, 190, 12, 229, 169, 55, 12, 249, 86, 225, 54, 12, 221, 230, 225, - 54, 12, 245, 170, 229, 30, 223, 156, 12, 1, 248, 144, 252, 128, 12, 1, - 248, 144, 228, 148, 12, 1, 223, 59, 254, 168, 12, 1, 99, 218, 246, 12, 1, - 99, 2, 218, 235, 181, 50, 12, 1, 99, 2, 218, 235, 181, 56, 12, 1, 116, - 243, 192, 12, 1, 116, 181, 254, 168, 12, 1, 116, 181, 218, 233, 12, 1, - 105, 2, 181, 50, 12, 1, 116, 181, 218, 21, 12, 1, 221, 23, 12, 1, 221, - 21, 12, 1, 252, 135, 12, 1, 222, 78, 2, 227, 93, 12, 1, 222, 78, 2, 148, - 188, 71, 247, 129, 12, 1, 229, 187, 12, 1, 222, 75, 12, 1, 252, 126, 12, - 1, 111, 2, 181, 50, 12, 1, 111, 2, 124, 188, 69, 50, 12, 1, 231, 70, 12, - 1, 247, 79, 12, 1, 111, 2, 148, 188, 50, 12, 1, 222, 91, 12, 1, 222, 89, - 12, 1, 249, 127, 12, 1, 249, 184, 2, 227, 93, 12, 1, 249, 184, 2, 61, 56, - 12, 1, 249, 184, 2, 61, 252, 118, 25, 3, 222, 137, 12, 1, 249, 189, 12, - 1, 249, 129, 12, 1, 247, 103, 12, 1, 249, 184, 2, 148, 188, 71, 247, 129, - 12, 1, 249, 184, 2, 245, 116, 188, 50, 12, 1, 227, 48, 12, 1, 227, 197, - 2, 3, 216, 216, 12, 1, 227, 197, 2, 227, 93, 12, 1, 227, 197, 2, 61, 56, - 12, 1, 227, 197, 2, 3, 220, 11, 56, 12, 1, 227, 197, 2, 61, 252, 118, 25, - 61, 50, 12, 1, 227, 197, 2, 124, 188, 50, 12, 1, 237, 109, 12, 1, 227, - 197, 2, 245, 116, 188, 50, 12, 1, 226, 83, 2, 61, 252, 118, 25, 61, 50, - 12, 1, 226, 83, 2, 148, 188, 56, 12, 1, 226, 83, 2, 148, 188, 252, 118, - 25, 148, 188, 50, 12, 1, 226, 171, 2, 124, 188, 56, 12, 1, 226, 171, 2, - 148, 188, 50, 12, 1, 222, 138, 2, 148, 188, 50, 12, 1, 254, 192, 2, 148, - 188, 50, 12, 1, 248, 144, 245, 221, 12, 1, 245, 222, 2, 61, 233, 104, 56, - 12, 1, 245, 222, 2, 61, 56, 12, 1, 219, 158, 12, 1, 245, 222, 2, 148, - 188, 56, 12, 1, 229, 185, 12, 1, 228, 149, 2, 61, 50, 12, 1, 228, 149, 2, - 148, 188, 50, 12, 1, 236, 176, 12, 1, 223, 33, 236, 246, 12, 1, 236, 247, - 2, 227, 93, 12, 1, 236, 247, 2, 61, 50, 12, 1, 232, 117, 12, 1, 236, 247, - 2, 148, 188, 56, 12, 1, 244, 243, 12, 1, 244, 244, 2, 227, 93, 12, 1, - 232, 82, 12, 1, 244, 244, 2, 124, 188, 56, 12, 1, 244, 9, 12, 1, 244, - 244, 2, 148, 188, 50, 12, 1, 235, 161, 2, 3, 216, 216, 12, 1, 235, 161, - 2, 61, 50, 12, 1, 235, 161, 2, 148, 188, 50, 12, 1, 235, 161, 2, 148, - 188, 56, 12, 1, 231, 194, 2, 61, 56, 12, 1, 231, 194, 244, 107, 12, 1, - 227, 78, 12, 1, 231, 194, 2, 227, 93, 12, 1, 231, 194, 2, 148, 188, 50, - 12, 1, 243, 147, 248, 163, 12, 1, 222, 92, 2, 61, 50, 12, 1, 243, 147, 2, - 70, 50, 12, 1, 243, 147, 244, 65, 12, 1, 243, 147, 244, 66, 2, 181, 50, - 12, 1, 222, 78, 234, 73, 244, 65, 12, 1, 218, 234, 2, 227, 93, 12, 1, - 236, 98, 230, 167, 12, 1, 230, 167, 12, 1, 68, 12, 1, 217, 200, 12, 1, - 236, 98, 217, 200, 12, 1, 218, 234, 2, 124, 188, 50, 12, 1, 219, 165, 12, - 1, 245, 241, 218, 21, 12, 1, 70, 2, 222, 135, 12, 1, 70, 2, 3, 216, 216, - 12, 1, 218, 234, 2, 61, 50, 12, 1, 73, 12, 1, 70, 2, 148, 188, 56, 12, 1, - 70, 252, 194, 12, 1, 70, 252, 195, 2, 181, 50, 12, 245, 90, 223, 136, 12, - 1, 254, 234, 12, 3, 116, 24, 226, 171, 2, 235, 161, 2, 99, 234, 92, 12, - 3, 116, 24, 228, 149, 2, 235, 161, 2, 99, 234, 92, 12, 3, 116, 62, 66, - 17, 12, 3, 116, 235, 161, 254, 168, 12, 3, 116, 237, 112, 12, 3, 116, - 148, 248, 143, 12, 3, 116, 226, 82, 12, 246, 190, 117, 253, 211, 12, 223, - 154, 117, 227, 20, 246, 218, 243, 91, 12, 3, 116, 227, 55, 217, 84, 12, - 3, 116, 220, 59, 227, 207, 217, 84, 12, 3, 116, 248, 144, 243, 160, 117, - 236, 146, 12, 3, 116, 62, 47, 17, 12, 3, 109, 226, 82, 12, 3, 116, 234, - 110, 12, 3, 218, 233, 12, 3, 218, 21, 12, 3, 116, 218, 21, 12, 3, 116, - 231, 193, 12, 229, 57, 117, 226, 159, 12, 246, 199, 251, 85, 109, 223, - 136, 12, 246, 199, 251, 85, 116, 223, 136, 12, 227, 55, 116, 223, 137, 2, - 245, 186, 251, 84, 12, 3, 109, 234, 14, 12, 1, 249, 184, 2, 237, 170, - 216, 216, 12, 1, 227, 197, 2, 237, 170, 216, 216, 246, 87, 254, 63, 20, - 217, 84, 246, 87, 254, 63, 20, 107, 246, 87, 254, 63, 20, 103, 246, 87, - 254, 63, 20, 160, 246, 87, 254, 63, 20, 154, 246, 87, 254, 63, 20, 174, - 246, 87, 254, 63, 20, 182, 246, 87, 254, 63, 20, 191, 246, 87, 254, 63, - 20, 185, 246, 87, 254, 63, 20, 190, 12, 1, 224, 243, 2, 61, 56, 12, 1, - 249, 203, 2, 61, 56, 12, 1, 244, 123, 2, 61, 56, 12, 5, 224, 112, 254, - 134, 12, 5, 224, 112, 229, 13, 233, 251, 12, 1, 243, 147, 2, 237, 170, - 216, 216, 166, 246, 190, 117, 229, 240, 166, 223, 55, 245, 90, 223, 136, - 166, 223, 96, 245, 90, 223, 136, 166, 223, 55, 250, 175, 166, 223, 96, - 250, 175, 166, 186, 250, 175, 166, 250, 176, 224, 64, 235, 115, 166, 250, - 176, 224, 64, 227, 109, 166, 223, 55, 250, 176, 224, 64, 235, 115, 166, - 223, 96, 250, 176, 224, 64, 227, 109, 166, 250, 134, 166, 243, 179, 230, - 179, 166, 243, 179, 233, 236, 166, 243, 179, 253, 253, 166, 255, 7, 78, - 166, 1, 254, 171, 166, 1, 223, 59, 254, 171, 166, 1, 252, 101, 166, 1, - 244, 235, 166, 1, 244, 236, 244, 216, 166, 1, 249, 180, 166, 1, 248, 144, - 249, 181, 227, 89, 166, 1, 243, 162, 166, 1, 218, 233, 166, 1, 217, 106, - 166, 1, 243, 126, 166, 1, 222, 46, 166, 1, 222, 47, 244, 216, 166, 1, - 217, 188, 166, 1, 217, 189, 243, 162, 166, 1, 236, 224, 166, 1, 235, 159, - 166, 1, 233, 161, 166, 1, 231, 103, 166, 1, 225, 60, 166, 1, 39, 225, 60, - 166, 1, 73, 166, 1, 229, 198, 166, 1, 210, 229, 198, 166, 1, 226, 168, - 166, 1, 228, 142, 166, 1, 227, 89, 166, 1, 224, 209, 166, 1, 222, 100, - 166, 1, 229, 159, 252, 90, 166, 1, 229, 159, 244, 120, 166, 1, 229, 159, - 249, 32, 166, 228, 203, 50, 166, 228, 203, 56, 166, 228, 203, 247, 142, - 166, 217, 15, 50, 166, 217, 15, 56, 166, 217, 15, 247, 142, 166, 227, - 219, 50, 166, 227, 219, 56, 166, 247, 143, 217, 22, 242, 241, 166, 247, - 143, 217, 22, 254, 117, 166, 243, 165, 50, 166, 243, 165, 56, 166, 243, - 164, 247, 142, 166, 246, 136, 50, 166, 246, 136, 56, 166, 226, 250, 166, - 245, 215, 248, 145, 166, 228, 63, 166, 227, 17, 166, 124, 69, 188, 50, - 166, 124, 69, 188, 56, 166, 148, 188, 50, 166, 148, 188, 56, 166, 230, - 177, 235, 44, 50, 166, 230, 177, 235, 44, 56, 166, 233, 58, 166, 252, - 193, 166, 1, 224, 19, 217, 78, 166, 1, 224, 19, 236, 139, 166, 1, 224, - 19, 245, 231, 12, 1, 252, 129, 2, 148, 188, 242, 191, 56, 12, 1, 252, - 129, 2, 61, 252, 118, 25, 148, 188, 50, 12, 1, 252, 129, 2, 148, 188, - 229, 28, 220, 53, 56, 12, 1, 252, 129, 2, 148, 188, 229, 28, 220, 53, - 252, 118, 25, 124, 188, 50, 12, 1, 252, 129, 2, 124, 188, 252, 118, 25, - 61, 50, 12, 1, 252, 129, 2, 237, 170, 3, 220, 11, 56, 12, 1, 252, 129, 2, - 3, 216, 216, 12, 1, 111, 2, 124, 188, 50, 12, 1, 111, 2, 148, 188, 229, - 28, 220, 53, 56, 12, 1, 249, 184, 2, 124, 188, 219, 102, 252, 118, 25, 3, - 222, 137, 12, 1, 249, 184, 2, 237, 170, 3, 220, 11, 56, 12, 1, 227, 197, - 2, 92, 12, 1, 226, 83, 2, 245, 116, 188, 50, 12, 1, 254, 192, 2, 124, - 188, 50, 12, 1, 254, 192, 2, 148, 188, 229, 28, 247, 130, 50, 12, 1, 254, - 192, 2, 124, 188, 219, 102, 50, 12, 1, 245, 222, 2, 124, 188, 56, 12, 1, - 245, 222, 2, 148, 188, 229, 28, 220, 53, 56, 12, 1, 236, 177, 2, 61, 50, - 12, 1, 236, 177, 2, 148, 188, 50, 12, 1, 236, 177, 2, 148, 188, 229, 28, - 220, 53, 56, 12, 1, 62, 2, 61, 50, 12, 1, 62, 2, 61, 56, 12, 1, 231, 194, - 2, 124, 188, 56, 12, 1, 231, 194, 2, 3, 222, 137, 12, 1, 231, 194, 2, 3, - 216, 216, 12, 1, 235, 161, 2, 135, 12, 1, 227, 197, 2, 124, 188, 219, - 102, 50, 12, 1, 227, 197, 2, 181, 50, 12, 1, 226, 83, 2, 124, 188, 219, - 102, 50, 12, 1, 111, 2, 3, 12, 1, 222, 138, 56, 12, 1, 111, 2, 3, 12, 1, - 222, 138, 25, 124, 248, 143, 12, 1, 226, 83, 2, 3, 12, 1, 222, 138, 25, - 124, 248, 143, 12, 1, 227, 197, 2, 3, 12, 1, 222, 138, 25, 124, 248, 143, - 12, 1, 111, 2, 3, 12, 1, 222, 138, 50, 12, 1, 99, 2, 246, 87, 254, 63, - 20, 124, 50, 12, 1, 99, 2, 246, 87, 254, 63, 20, 148, 50, 12, 1, 245, - 241, 70, 2, 246, 87, 254, 63, 20, 124, 50, 12, 1, 245, 241, 70, 2, 246, - 87, 254, 63, 20, 148, 50, 12, 1, 245, 241, 70, 2, 246, 87, 254, 63, 20, - 245, 116, 56, 12, 1, 218, 234, 2, 246, 87, 254, 63, 20, 124, 50, 12, 1, - 218, 234, 2, 246, 87, 254, 63, 20, 148, 50, 12, 1, 70, 252, 195, 2, 246, - 87, 254, 63, 20, 124, 50, 12, 1, 70, 252, 195, 2, 246, 87, 254, 63, 20, - 148, 50, 12, 1, 111, 2, 246, 87, 254, 63, 20, 245, 116, 56, 12, 1, 226, - 83, 2, 246, 87, 254, 63, 20, 245, 116, 50, 12, 1, 226, 83, 2, 237, 170, - 216, 216, 12, 1, 236, 247, 2, 124, 188, 50, 222, 32, 1, 243, 211, 222, - 32, 1, 224, 251, 222, 32, 1, 231, 192, 222, 32, 1, 228, 0, 222, 32, 1, - 252, 236, 222, 32, 1, 235, 76, 222, 32, 1, 237, 3, 222, 32, 1, 254, 160, - 222, 32, 1, 219, 187, 222, 32, 1, 234, 13, 222, 32, 1, 246, 6, 222, 32, - 1, 249, 35, 222, 32, 1, 222, 34, 222, 32, 1, 235, 185, 222, 32, 1, 244, - 252, 222, 32, 1, 244, 71, 222, 32, 1, 226, 81, 222, 32, 1, 249, 139, 222, - 32, 1, 217, 98, 222, 32, 1, 222, 101, 222, 32, 1, 218, 76, 222, 32, 1, - 229, 209, 222, 32, 1, 237, 116, 222, 32, 1, 251, 49, 222, 32, 1, 221, 28, - 222, 32, 1, 243, 120, 222, 32, 1, 236, 148, 222, 32, 1, 222, 33, 222, 32, - 1, 217, 113, 222, 32, 1, 224, 241, 222, 32, 1, 226, 174, 222, 32, 1, 249, - 205, 222, 32, 1, 101, 222, 32, 1, 217, 21, 222, 32, 1, 254, 189, 222, 32, - 1, 244, 121, 222, 32, 1, 228, 152, 222, 32, 1, 219, 5, 222, 32, 255, 8, - 222, 32, 255, 23, 222, 32, 242, 68, 222, 32, 246, 249, 222, 32, 220, 118, - 222, 32, 230, 126, 222, 32, 247, 1, 222, 32, 246, 82, 222, 32, 230, 176, - 222, 32, 230, 184, 222, 32, 223, 75, 222, 32, 1, 232, 235, 231, 242, 20, - 217, 84, 231, 242, 20, 107, 231, 242, 20, 103, 231, 242, 20, 160, 231, - 242, 20, 154, 231, 242, 20, 174, 231, 242, 20, 182, 231, 242, 20, 191, - 231, 242, 20, 185, 231, 242, 20, 190, 231, 242, 1, 60, 231, 242, 1, 246, - 250, 231, 242, 1, 72, 231, 242, 1, 73, 231, 242, 1, 68, 231, 242, 1, 230, - 127, 231, 242, 1, 74, 231, 242, 1, 249, 195, 231, 242, 1, 207, 231, 242, - 1, 252, 237, 231, 242, 1, 187, 231, 242, 1, 222, 155, 231, 242, 1, 237, - 123, 231, 242, 1, 251, 69, 231, 242, 1, 249, 207, 231, 242, 1, 203, 231, - 242, 1, 227, 52, 231, 242, 1, 226, 177, 231, 242, 1, 244, 204, 231, 242, - 1, 246, 8, 231, 242, 1, 175, 231, 242, 1, 235, 188, 231, 242, 1, 232, - 238, 218, 184, 231, 242, 1, 196, 231, 242, 1, 231, 77, 231, 242, 1, 208, - 231, 242, 1, 155, 231, 242, 1, 219, 7, 231, 242, 1, 184, 231, 242, 1, - 231, 78, 218, 184, 231, 242, 1, 237, 52, 237, 123, 231, 242, 1, 237, 52, - 251, 69, 231, 242, 1, 237, 52, 203, 231, 242, 36, 224, 192, 116, 221, - 132, 231, 242, 36, 224, 192, 109, 221, 132, 231, 242, 36, 224, 192, 227, - 88, 221, 132, 231, 242, 36, 171, 249, 47, 221, 132, 231, 242, 36, 171, - 116, 221, 132, 231, 242, 36, 171, 109, 221, 132, 231, 242, 36, 171, 227, - 88, 221, 132, 231, 242, 36, 232, 209, 78, 231, 242, 36, 51, 61, 50, 231, - 242, 116, 145, 254, 79, 231, 242, 109, 145, 254, 79, 231, 242, 16, 230, - 128, 249, 58, 231, 242, 16, 244, 203, 231, 242, 250, 168, 231, 242, 246, - 95, 78, 231, 242, 235, 166, 213, 1, 254, 173, 213, 1, 252, 60, 213, 1, - 244, 234, 213, 1, 249, 182, 213, 1, 237, 133, 213, 1, 252, 236, 213, 1, - 217, 87, 213, 1, 237, 140, 213, 1, 221, 161, 213, 1, 217, 177, 213, 1, - 237, 4, 213, 1, 235, 183, 213, 1, 233, 161, 213, 1, 231, 103, 213, 1, - 224, 110, 213, 1, 237, 223, 213, 1, 245, 203, 213, 1, 221, 53, 213, 1, - 228, 79, 213, 1, 227, 89, 213, 1, 225, 9, 213, 1, 222, 151, 213, 164, - 237, 223, 213, 164, 237, 222, 213, 164, 230, 172, 213, 164, 249, 193, - 213, 58, 1, 246, 160, 217, 177, 213, 164, 246, 160, 217, 177, 213, 29, 5, - 171, 73, 213, 29, 5, 73, 213, 29, 5, 230, 72, 255, 58, 213, 29, 5, 171, - 255, 58, 213, 29, 5, 255, 58, 213, 29, 5, 230, 72, 60, 213, 29, 5, 171, - 60, 213, 29, 5, 60, 213, 58, 1, 224, 192, 60, 213, 29, 5, 224, 192, 60, - 213, 29, 5, 171, 68, 213, 29, 5, 68, 213, 58, 1, 72, 213, 29, 5, 171, 72, - 213, 29, 5, 72, 213, 29, 5, 74, 213, 29, 5, 223, 75, 213, 164, 232, 128, - 213, 228, 197, 232, 128, 213, 228, 197, 254, 211, 213, 228, 197, 254, - 122, 213, 228, 197, 252, 181, 213, 228, 197, 253, 240, 213, 228, 197, - 224, 201, 213, 255, 7, 78, 213, 228, 197, 234, 4, 228, 113, 213, 228, - 197, 217, 29, 213, 228, 197, 228, 113, 213, 228, 197, 217, 112, 213, 228, - 197, 220, 233, 213, 228, 197, 254, 36, 213, 228, 197, 224, 22, 234, 55, - 213, 228, 197, 254, 113, 80, 5, 237, 170, 251, 146, 80, 5, 251, 146, 80, - 5, 254, 95, 80, 5, 219, 77, 80, 1, 224, 192, 60, 80, 1, 60, 80, 1, 255, - 58, 80, 1, 72, 80, 1, 237, 255, 80, 1, 68, 80, 1, 220, 23, 80, 1, 167, - 152, 80, 1, 167, 153, 80, 1, 251, 149, 73, 80, 1, 224, 192, 73, 80, 1, - 73, 80, 1, 254, 196, 80, 1, 251, 149, 74, 80, 1, 224, 192, 74, 80, 1, 74, - 80, 1, 253, 232, 80, 1, 175, 80, 1, 236, 149, 80, 1, 245, 0, 80, 1, 244, - 125, 80, 1, 232, 115, 80, 1, 251, 169, 80, 1, 251, 69, 80, 1, 237, 123, - 80, 1, 237, 103, 80, 1, 231, 77, 80, 1, 221, 29, 80, 1, 221, 19, 80, 1, - 249, 132, 80, 1, 249, 116, 80, 1, 231, 217, 80, 1, 222, 155, 80, 1, 222, - 35, 80, 1, 249, 207, 80, 1, 249, 36, 80, 1, 208, 80, 1, 231, 208, 80, 1, - 187, 80, 1, 229, 141, 80, 1, 252, 237, 80, 1, 252, 94, 80, 1, 196, 80, 1, - 184, 80, 1, 203, 80, 1, 227, 52, 80, 1, 235, 188, 80, 1, 235, 17, 80, 1, - 235, 16, 80, 1, 219, 189, 80, 1, 225, 25, 80, 1, 223, 218, 80, 1, 226, - 177, 80, 1, 155, 80, 5, 231, 112, 80, 5, 253, 219, 80, 29, 5, 255, 58, - 80, 29, 5, 72, 80, 29, 5, 237, 255, 80, 29, 5, 68, 80, 29, 5, 220, 23, - 80, 29, 5, 167, 152, 80, 29, 5, 167, 227, 53, 80, 29, 5, 251, 149, 73, - 80, 29, 5, 224, 192, 73, 80, 29, 5, 73, 80, 29, 5, 254, 196, 80, 29, 5, - 251, 149, 74, 80, 29, 5, 224, 192, 74, 80, 29, 5, 74, 80, 29, 5, 253, - 232, 80, 5, 219, 82, 80, 29, 5, 228, 232, 73, 80, 230, 146, 80, 223, 125, - 5, 220, 112, 80, 223, 125, 5, 254, 97, 80, 244, 37, 255, 0, 80, 254, 248, - 255, 0, 80, 29, 5, 251, 149, 171, 73, 80, 1, 228, 155, 80, 1, 236, 133, - 80, 1, 244, 114, 80, 1, 217, 114, 80, 1, 249, 121, 80, 1, 227, 151, 80, - 1, 246, 8, 80, 1, 217, 165, 80, 1, 167, 227, 53, 80, 1, 167, 235, 18, 80, - 29, 5, 167, 153, 80, 29, 5, 167, 235, 18, 80, 249, 167, 80, 51, 249, 167, - 80, 20, 217, 84, 80, 20, 107, 80, 20, 103, 80, 20, 160, 80, 20, 154, 80, - 20, 174, 80, 20, 182, 80, 20, 191, 80, 20, 185, 80, 20, 190, 80, 255, 7, - 55, 80, 5, 116, 223, 253, 248, 145, 80, 1, 251, 149, 60, 80, 1, 217, 80, - 80, 1, 106, 184, 80, 1, 244, 160, 80, 1, 237, 87, 80, 1, 244, 73, 223, - 136, 80, 1, 249, 122, 80, 1, 252, 178, 130, 5, 251, 146, 130, 5, 254, 95, - 130, 5, 219, 77, 130, 1, 60, 130, 1, 255, 58, 130, 1, 72, 130, 1, 237, - 255, 130, 1, 68, 130, 1, 220, 23, 130, 1, 167, 152, 130, 1, 167, 153, - 130, 1, 73, 130, 1, 254, 196, 130, 1, 74, 130, 1, 253, 232, 130, 1, 175, - 130, 1, 236, 149, 130, 1, 245, 0, 130, 1, 244, 125, 130, 1, 232, 115, - 130, 1, 251, 169, 130, 1, 251, 69, 130, 1, 237, 123, 130, 1, 237, 103, - 130, 1, 231, 77, 130, 1, 221, 29, 130, 1, 221, 19, 130, 1, 249, 132, 130, - 1, 249, 116, 130, 1, 231, 217, 130, 1, 222, 155, 130, 1, 222, 35, 130, 1, - 249, 207, 130, 1, 249, 36, 130, 1, 208, 130, 1, 187, 130, 1, 229, 141, - 130, 1, 252, 237, 130, 1, 252, 94, 130, 1, 196, 130, 1, 184, 130, 1, 203, - 130, 1, 235, 188, 130, 1, 225, 25, 130, 1, 223, 218, 130, 1, 226, 177, - 130, 1, 155, 130, 5, 231, 112, 130, 5, 253, 219, 130, 29, 5, 255, 58, - 130, 29, 5, 72, 130, 29, 5, 237, 255, 130, 29, 5, 68, 130, 29, 5, 220, - 23, 130, 29, 5, 167, 152, 130, 29, 5, 167, 227, 53, 130, 29, 5, 73, 130, - 29, 5, 254, 196, 130, 29, 5, 74, 130, 29, 5, 253, 232, 130, 5, 219, 82, - 130, 1, 236, 141, 222, 155, 130, 253, 233, 235, 94, 78, 130, 1, 227, 52, - 130, 1, 227, 151, 130, 1, 217, 165, 130, 1, 167, 227, 53, 130, 1, 167, - 235, 18, 130, 29, 5, 167, 153, 130, 29, 5, 167, 235, 18, 130, 20, 217, - 84, 130, 20, 107, 130, 20, 103, 130, 20, 160, 130, 20, 154, 130, 20, 174, - 130, 20, 182, 130, 20, 191, 130, 20, 185, 130, 20, 190, 130, 1, 228, 3, - 2, 233, 193, 249, 10, 130, 1, 228, 3, 2, 234, 237, 249, 10, 130, 227, 4, - 78, 130, 227, 4, 55, 130, 250, 78, 231, 106, 107, 130, 250, 78, 231, 106, - 103, 130, 250, 78, 231, 106, 160, 130, 250, 78, 231, 106, 154, 130, 250, - 78, 231, 106, 131, 235, 88, 222, 28, 222, 23, 249, 56, 130, 250, 78, 249, - 57, 224, 77, 130, 237, 141, 130, 244, 227, 78, 163, 5, 254, 243, 252, 72, - 163, 5, 252, 72, 163, 5, 219, 77, 163, 1, 60, 163, 1, 255, 58, 163, 1, - 72, 163, 1, 237, 255, 163, 1, 68, 163, 1, 220, 23, 163, 1, 246, 250, 163, - 1, 254, 196, 163, 1, 230, 127, 163, 1, 253, 232, 163, 1, 175, 163, 1, - 236, 149, 163, 1, 245, 0, 163, 1, 244, 125, 163, 1, 232, 115, 163, 1, - 251, 169, 163, 1, 251, 69, 163, 1, 237, 123, 163, 1, 237, 103, 163, 1, - 231, 77, 163, 1, 221, 29, 163, 1, 221, 19, 163, 1, 249, 132, 163, 1, 249, - 116, 163, 1, 231, 217, 163, 1, 222, 155, 163, 1, 222, 35, 163, 1, 249, - 207, 163, 1, 249, 36, 163, 1, 208, 163, 1, 187, 163, 1, 229, 141, 163, 1, - 252, 237, 163, 1, 252, 94, 163, 1, 196, 163, 1, 184, 163, 1, 203, 163, 1, - 235, 188, 163, 1, 235, 17, 163, 1, 219, 189, 163, 1, 225, 25, 163, 1, - 226, 177, 163, 1, 155, 163, 5, 231, 112, 163, 29, 5, 255, 58, 163, 29, 5, - 72, 163, 29, 5, 237, 255, 163, 29, 5, 68, 163, 29, 5, 220, 23, 163, 29, - 5, 246, 250, 163, 29, 5, 254, 196, 163, 29, 5, 230, 127, 163, 29, 5, 253, - 232, 163, 5, 219, 82, 163, 5, 220, 114, 163, 1, 236, 133, 163, 1, 244, - 114, 163, 1, 217, 114, 163, 1, 227, 52, 163, 1, 246, 8, 163, 20, 217, 84, - 163, 20, 107, 163, 20, 103, 163, 20, 160, 163, 20, 154, 163, 20, 174, - 163, 20, 182, 163, 20, 191, 163, 20, 185, 163, 20, 190, 163, 221, 167, - 163, 254, 242, 163, 237, 155, 163, 220, 46, 163, 246, 224, 230, 132, 163, - 5, 218, 54, 150, 5, 251, 146, 150, 5, 254, 95, 150, 5, 219, 77, 150, 1, - 60, 150, 1, 255, 58, 150, 1, 72, 150, 1, 237, 255, 150, 1, 68, 150, 1, - 220, 23, 150, 1, 167, 152, 150, 1, 167, 153, 150, 29, 251, 149, 73, 150, - 1, 73, 150, 1, 254, 196, 150, 29, 251, 149, 74, 150, 1, 74, 150, 1, 253, - 232, 150, 1, 175, 150, 1, 236, 149, 150, 1, 245, 0, 150, 1, 244, 125, - 150, 1, 232, 115, 150, 1, 251, 169, 150, 1, 251, 69, 150, 1, 237, 123, - 150, 1, 237, 103, 150, 1, 231, 77, 150, 1, 221, 29, 150, 1, 221, 19, 150, - 1, 249, 132, 150, 1, 249, 116, 150, 1, 231, 217, 150, 1, 222, 155, 150, - 1, 222, 35, 150, 1, 249, 207, 150, 1, 249, 36, 150, 1, 208, 150, 1, 187, - 150, 1, 229, 141, 150, 1, 252, 237, 150, 1, 252, 94, 150, 1, 196, 150, 1, - 184, 150, 1, 203, 150, 1, 235, 188, 150, 1, 235, 17, 150, 1, 219, 189, - 150, 1, 225, 25, 150, 1, 223, 218, 150, 1, 226, 177, 150, 1, 155, 150, 5, - 231, 112, 150, 5, 253, 219, 150, 29, 5, 255, 58, 150, 29, 5, 72, 150, 29, - 5, 237, 255, 150, 29, 5, 68, 150, 29, 5, 220, 23, 150, 29, 5, 167, 152, - 150, 29, 5, 167, 227, 53, 150, 29, 5, 251, 149, 73, 150, 29, 5, 73, 150, - 29, 5, 254, 196, 150, 29, 5, 251, 149, 74, 150, 29, 5, 74, 150, 29, 5, - 253, 232, 150, 5, 219, 82, 150, 230, 146, 150, 1, 167, 227, 53, 150, 1, - 167, 235, 18, 150, 29, 5, 167, 153, 150, 29, 5, 167, 235, 18, 150, 20, - 217, 84, 150, 20, 107, 150, 20, 103, 150, 20, 160, 150, 20, 154, 150, 20, - 174, 150, 20, 182, 150, 20, 191, 150, 20, 185, 150, 20, 190, 150, 227, 4, - 55, 147, 5, 251, 146, 147, 5, 254, 95, 147, 5, 219, 77, 147, 1, 60, 147, - 1, 255, 58, 147, 1, 72, 147, 1, 237, 255, 147, 1, 68, 147, 1, 220, 23, - 147, 1, 167, 152, 147, 1, 167, 153, 147, 1, 73, 147, 1, 254, 196, 147, 1, - 74, 147, 1, 253, 232, 147, 1, 175, 147, 1, 236, 149, 147, 1, 245, 0, 147, - 1, 244, 125, 147, 1, 232, 115, 147, 1, 251, 169, 147, 1, 251, 69, 147, 1, - 237, 123, 147, 1, 237, 103, 147, 1, 231, 77, 147, 1, 221, 29, 147, 1, - 221, 19, 147, 1, 249, 132, 147, 1, 249, 116, 147, 1, 231, 217, 147, 1, - 222, 155, 147, 1, 222, 35, 147, 1, 249, 207, 147, 1, 249, 36, 147, 1, - 208, 147, 1, 187, 147, 1, 229, 141, 147, 1, 252, 237, 147, 1, 252, 94, - 147, 1, 196, 147, 1, 184, 147, 1, 203, 147, 1, 235, 188, 147, 1, 235, 17, - 147, 1, 219, 189, 147, 1, 225, 25, 147, 1, 223, 218, 147, 1, 226, 177, - 147, 1, 155, 147, 5, 231, 112, 147, 5, 253, 219, 147, 29, 5, 255, 58, - 147, 29, 5, 72, 147, 29, 5, 237, 255, 147, 29, 5, 68, 147, 29, 5, 220, - 23, 147, 29, 5, 167, 152, 147, 29, 5, 167, 227, 53, 147, 29, 5, 73, 147, - 29, 5, 254, 196, 147, 29, 5, 74, 147, 29, 5, 253, 232, 147, 5, 219, 82, - 147, 254, 197, 235, 94, 78, 147, 253, 233, 235, 94, 78, 147, 1, 227, 52, - 147, 1, 227, 151, 147, 1, 217, 165, 147, 1, 167, 227, 53, 147, 1, 167, - 235, 18, 147, 29, 5, 167, 153, 147, 29, 5, 167, 235, 18, 147, 20, 217, - 84, 147, 20, 107, 147, 20, 103, 147, 20, 160, 147, 20, 154, 147, 20, 174, - 147, 20, 182, 147, 20, 191, 147, 20, 185, 147, 20, 190, 147, 237, 141, - 147, 1, 219, 7, 176, 5, 254, 95, 176, 5, 219, 77, 176, 1, 60, 176, 1, - 255, 58, 176, 1, 72, 176, 1, 237, 255, 176, 1, 68, 176, 1, 220, 23, 176, - 1, 73, 176, 1, 246, 250, 176, 1, 254, 196, 176, 1, 74, 176, 1, 230, 127, - 176, 1, 253, 232, 176, 1, 175, 176, 1, 232, 115, 176, 1, 251, 169, 176, - 1, 237, 123, 176, 1, 231, 77, 176, 1, 221, 29, 176, 1, 231, 217, 176, 1, - 222, 155, 176, 1, 208, 176, 1, 231, 208, 176, 1, 187, 176, 1, 196, 176, - 1, 184, 176, 1, 203, 176, 1, 227, 52, 176, 1, 235, 188, 176, 1, 235, 17, - 176, 1, 235, 16, 176, 1, 219, 189, 176, 1, 225, 25, 176, 1, 223, 218, - 176, 1, 226, 177, 176, 1, 155, 176, 29, 5, 255, 58, 176, 29, 5, 72, 176, - 29, 5, 237, 255, 176, 29, 5, 68, 176, 29, 5, 220, 23, 176, 29, 5, 73, - 176, 29, 5, 246, 250, 176, 29, 5, 254, 196, 176, 29, 5, 74, 176, 29, 5, - 230, 127, 176, 29, 5, 253, 232, 176, 5, 219, 82, 176, 230, 146, 176, 253, - 233, 235, 94, 78, 176, 20, 217, 84, 176, 20, 107, 176, 20, 103, 176, 20, - 160, 176, 20, 154, 176, 20, 174, 176, 20, 182, 176, 20, 191, 176, 20, - 185, 176, 20, 190, 176, 54, 222, 65, 176, 54, 131, 242, 161, 176, 54, - 131, 221, 231, 176, 249, 137, 55, 176, 233, 121, 55, 176, 218, 23, 55, - 176, 249, 89, 55, 176, 250, 107, 55, 176, 254, 14, 71, 55, 176, 227, 4, - 55, 176, 54, 55, 129, 5, 251, 146, 129, 5, 254, 95, 129, 5, 219, 77, 129, - 1, 60, 129, 1, 255, 58, 129, 1, 72, 129, 1, 237, 255, 129, 1, 68, 129, 1, - 220, 23, 129, 1, 167, 152, 129, 1, 167, 153, 129, 1, 73, 129, 1, 246, - 250, 129, 1, 254, 196, 129, 1, 74, 129, 1, 230, 127, 129, 1, 253, 232, - 129, 1, 175, 129, 1, 236, 149, 129, 1, 245, 0, 129, 1, 244, 125, 129, 1, - 232, 115, 129, 1, 251, 169, 129, 1, 251, 69, 129, 1, 237, 123, 129, 1, - 237, 103, 129, 1, 231, 77, 129, 1, 221, 29, 129, 1, 221, 19, 129, 1, 249, - 132, 129, 1, 249, 116, 129, 1, 231, 217, 129, 1, 222, 155, 129, 1, 222, - 35, 129, 1, 249, 207, 129, 1, 249, 36, 129, 1, 208, 129, 1, 187, 129, 1, - 229, 141, 129, 1, 252, 237, 129, 1, 252, 94, 129, 1, 196, 129, 1, 184, - 129, 1, 203, 129, 1, 227, 52, 129, 1, 235, 188, 129, 1, 235, 17, 129, 1, - 219, 189, 129, 1, 225, 25, 129, 1, 223, 218, 129, 1, 226, 177, 129, 1, - 155, 129, 5, 253, 219, 129, 29, 5, 255, 58, 129, 29, 5, 72, 129, 29, 5, - 237, 255, 129, 29, 5, 68, 129, 29, 5, 220, 23, 129, 29, 5, 167, 152, 129, - 29, 5, 167, 227, 53, 129, 29, 5, 73, 129, 29, 5, 246, 250, 129, 29, 5, - 254, 196, 129, 29, 5, 74, 129, 29, 5, 230, 127, 129, 29, 5, 253, 232, - 129, 5, 219, 82, 129, 235, 94, 78, 129, 254, 197, 235, 94, 78, 129, 1, - 221, 55, 129, 1, 247, 74, 129, 1, 167, 227, 53, 129, 1, 167, 235, 18, - 129, 29, 5, 167, 153, 129, 29, 5, 167, 235, 18, 129, 20, 217, 84, 129, - 20, 107, 129, 20, 103, 129, 20, 160, 129, 20, 154, 129, 20, 174, 129, 20, - 182, 129, 20, 191, 129, 20, 185, 129, 20, 190, 129, 245, 108, 20, 217, - 85, 35, 230, 169, 229, 9, 117, 154, 129, 245, 108, 20, 131, 35, 230, 169, - 229, 9, 117, 154, 129, 245, 108, 20, 124, 35, 230, 169, 229, 9, 117, 154, - 129, 245, 108, 20, 148, 35, 230, 169, 229, 9, 117, 154, 129, 245, 108, - 20, 131, 35, 246, 104, 229, 9, 117, 154, 129, 245, 108, 20, 124, 35, 246, - 104, 229, 9, 117, 154, 129, 245, 108, 20, 148, 35, 246, 104, 229, 9, 117, - 154, 129, 5, 220, 229, 141, 5, 254, 95, 141, 5, 219, 77, 141, 1, 60, 141, - 1, 255, 58, 141, 1, 72, 141, 1, 237, 255, 141, 1, 68, 141, 1, 220, 23, - 141, 1, 167, 152, 141, 1, 167, 153, 141, 1, 73, 141, 1, 246, 250, 141, 1, - 254, 196, 141, 1, 74, 141, 1, 230, 127, 141, 1, 253, 232, 141, 1, 175, - 141, 1, 236, 149, 141, 1, 245, 0, 141, 1, 244, 125, 141, 1, 232, 115, - 141, 1, 251, 169, 141, 1, 251, 69, 141, 1, 237, 123, 141, 1, 237, 103, - 141, 1, 231, 77, 141, 1, 221, 29, 141, 1, 221, 19, 141, 1, 249, 132, 141, - 1, 249, 116, 141, 1, 231, 217, 141, 1, 222, 155, 141, 1, 222, 35, 141, 1, - 249, 207, 141, 1, 249, 36, 141, 1, 208, 141, 1, 187, 141, 1, 229, 141, - 141, 1, 252, 237, 141, 1, 252, 94, 141, 1, 196, 141, 1, 184, 141, 1, 203, - 141, 1, 227, 52, 141, 1, 235, 188, 141, 1, 235, 17, 141, 1, 219, 189, - 141, 1, 225, 25, 141, 1, 223, 218, 141, 1, 226, 177, 141, 1, 155, 141, 5, - 231, 112, 141, 5, 253, 219, 141, 29, 5, 255, 58, 141, 29, 5, 72, 141, 29, - 5, 237, 255, 141, 29, 5, 68, 141, 29, 5, 220, 23, 141, 29, 5, 167, 152, - 141, 29, 5, 167, 227, 53, 141, 29, 5, 73, 141, 29, 5, 246, 250, 141, 29, - 5, 254, 196, 141, 29, 5, 74, 141, 29, 5, 230, 127, 141, 29, 5, 253, 232, - 141, 5, 219, 82, 141, 235, 94, 78, 141, 254, 197, 235, 94, 78, 141, 1, - 246, 8, 141, 1, 167, 227, 53, 141, 1, 167, 235, 18, 141, 29, 5, 167, 153, - 141, 29, 5, 167, 235, 18, 141, 20, 217, 84, 141, 20, 107, 141, 20, 103, - 141, 20, 160, 141, 20, 154, 141, 20, 174, 141, 20, 182, 141, 20, 191, - 141, 20, 185, 141, 20, 190, 141, 5, 237, 92, 141, 5, 220, 61, 123, 5, - 254, 95, 123, 5, 219, 77, 123, 1, 60, 123, 1, 255, 58, 123, 1, 72, 123, - 1, 237, 255, 123, 1, 68, 123, 1, 220, 23, 123, 1, 167, 152, 123, 1, 167, - 153, 123, 1, 73, 123, 1, 246, 250, 123, 1, 254, 196, 123, 1, 74, 123, 1, - 230, 127, 123, 1, 253, 232, 123, 1, 175, 123, 1, 236, 149, 123, 1, 245, - 0, 123, 1, 244, 125, 123, 1, 232, 115, 123, 1, 251, 169, 123, 1, 251, 69, - 123, 1, 237, 123, 123, 1, 237, 103, 123, 1, 231, 77, 123, 1, 221, 29, - 123, 1, 221, 19, 123, 1, 249, 132, 123, 1, 249, 116, 123, 1, 231, 217, - 123, 1, 222, 155, 123, 1, 222, 35, 123, 1, 249, 207, 123, 1, 249, 36, - 123, 1, 208, 123, 1, 187, 123, 1, 229, 141, 123, 1, 252, 237, 123, 1, - 252, 94, 123, 1, 196, 123, 1, 184, 123, 1, 203, 123, 1, 227, 52, 123, 1, - 235, 188, 123, 1, 235, 17, 123, 1, 235, 16, 123, 1, 219, 189, 123, 1, - 225, 25, 123, 1, 223, 218, 123, 1, 226, 177, 123, 1, 155, 123, 5, 253, - 219, 123, 29, 5, 255, 58, 123, 29, 5, 72, 123, 29, 5, 237, 255, 123, 29, - 5, 68, 123, 29, 5, 220, 23, 123, 29, 5, 167, 152, 123, 29, 5, 167, 227, - 53, 123, 29, 5, 73, 123, 29, 5, 246, 250, 123, 29, 5, 254, 196, 123, 29, - 5, 74, 123, 29, 5, 230, 127, 123, 29, 5, 253, 232, 123, 5, 219, 82, 123, - 253, 233, 235, 94, 78, 123, 1, 167, 227, 53, 123, 1, 167, 235, 18, 123, - 29, 5, 167, 153, 123, 29, 5, 167, 235, 18, 123, 20, 217, 84, 123, 20, - 107, 123, 20, 103, 123, 20, 160, 123, 20, 154, 123, 20, 174, 123, 20, - 182, 123, 20, 191, 123, 20, 185, 123, 20, 190, 123, 54, 222, 65, 123, 54, - 131, 242, 161, 123, 54, 131, 221, 231, 123, 245, 108, 131, 228, 89, 123, - 245, 108, 131, 243, 194, 123, 245, 108, 148, 228, 87, 123, 249, 141, 78, - 123, 1, 251, 23, 231, 218, 123, 1, 251, 23, 207, 123, 1, 251, 23, 227, - 53, 123, 1, 251, 23, 153, 123, 1, 251, 23, 235, 18, 123, 1, 251, 23, 237, - 17, 162, 5, 254, 94, 162, 5, 219, 76, 162, 1, 253, 210, 162, 1, 255, 13, - 162, 1, 254, 215, 162, 1, 254, 229, 162, 1, 237, 132, 162, 1, 237, 254, - 162, 1, 220, 15, 162, 1, 220, 17, 162, 1, 237, 153, 162, 1, 237, 154, - 162, 1, 237, 240, 162, 1, 237, 242, 162, 1, 246, 83, 162, 1, 246, 246, - 162, 1, 254, 184, 162, 1, 230, 62, 162, 1, 230, 122, 162, 1, 253, 222, - 162, 1, 254, 149, 236, 189, 162, 1, 234, 105, 236, 189, 162, 1, 254, 149, - 244, 207, 162, 1, 234, 105, 244, 207, 162, 1, 236, 228, 232, 232, 162, 1, - 226, 135, 244, 207, 162, 1, 254, 149, 251, 117, 162, 1, 234, 105, 251, - 117, 162, 1, 254, 149, 237, 115, 162, 1, 234, 105, 237, 115, 162, 1, 222, - 149, 232, 232, 162, 1, 222, 149, 226, 134, 232, 233, 162, 1, 226, 135, - 237, 115, 162, 1, 254, 149, 221, 27, 162, 1, 234, 105, 221, 27, 162, 1, - 254, 149, 249, 123, 162, 1, 234, 105, 249, 123, 162, 1, 233, 56, 232, - 198, 162, 1, 226, 135, 249, 123, 162, 1, 254, 149, 222, 95, 162, 1, 234, - 105, 222, 95, 162, 1, 254, 149, 249, 136, 162, 1, 234, 105, 249, 136, - 162, 1, 249, 164, 232, 198, 162, 1, 226, 135, 249, 136, 162, 1, 254, 149, - 229, 204, 162, 1, 234, 105, 229, 204, 162, 1, 254, 149, 252, 179, 162, 1, - 234, 105, 252, 179, 162, 1, 234, 44, 162, 1, 254, 136, 252, 179, 162, 1, - 218, 29, 162, 1, 227, 221, 162, 1, 249, 164, 235, 131, 162, 1, 219, 167, - 162, 1, 222, 149, 226, 117, 162, 1, 233, 56, 226, 117, 162, 1, 249, 164, - 226, 117, 162, 1, 243, 166, 162, 1, 233, 56, 235, 131, 162, 1, 245, 233, - 162, 5, 254, 174, 162, 29, 5, 254, 224, 162, 29, 5, 236, 158, 254, 231, - 162, 29, 5, 248, 241, 254, 231, 162, 29, 5, 236, 158, 237, 150, 162, 29, - 5, 248, 241, 237, 150, 162, 29, 5, 236, 158, 230, 42, 162, 29, 5, 248, - 241, 230, 42, 162, 29, 5, 244, 245, 162, 29, 5, 236, 46, 162, 29, 5, 248, - 241, 236, 46, 162, 29, 5, 236, 48, 249, 73, 162, 29, 5, 236, 47, 243, - 212, 254, 224, 162, 29, 5, 236, 47, 243, 212, 248, 241, 254, 224, 162, - 29, 5, 236, 47, 243, 212, 244, 206, 162, 29, 5, 244, 206, 162, 29, 5, - 248, 241, 244, 245, 162, 29, 5, 248, 241, 244, 206, 162, 228, 197, 235, - 254, 140, 126, 236, 58, 236, 243, 140, 126, 236, 126, 236, 145, 140, 126, - 236, 126, 236, 119, 140, 126, 236, 126, 236, 116, 140, 126, 236, 126, - 236, 123, 140, 126, 236, 126, 227, 240, 140, 126, 232, 85, 232, 74, 140, - 126, 251, 12, 251, 60, 140, 126, 251, 12, 251, 20, 140, 126, 251, 12, - 251, 59, 140, 126, 224, 27, 224, 26, 140, 126, 251, 12, 251, 9, 140, 126, - 217, 232, 217, 239, 140, 126, 248, 168, 251, 66, 140, 126, 199, 229, 213, - 140, 126, 221, 240, 222, 27, 140, 126, 221, 240, 232, 215, 140, 126, 221, - 240, 229, 111, 140, 126, 231, 205, 232, 134, 140, 126, 248, 168, 249, 74, - 140, 126, 199, 222, 116, 140, 126, 221, 240, 221, 219, 140, 126, 221, - 240, 222, 31, 140, 126, 221, 240, 221, 237, 140, 126, 231, 205, 231, 144, - 140, 126, 252, 42, 252, 220, 140, 126, 229, 38, 229, 58, 140, 126, 229, - 119, 229, 113, 140, 126, 245, 140, 246, 8, 140, 126, 229, 119, 229, 135, - 140, 126, 245, 140, 245, 245, 140, 126, 229, 119, 226, 143, 140, 126, - 233, 137, 196, 140, 126, 217, 232, 218, 55, 140, 126, 227, 76, 227, 21, - 140, 126, 227, 22, 140, 126, 235, 13, 235, 36, 140, 126, 234, 231, 140, - 126, 218, 188, 219, 3, 140, 126, 224, 27, 226, 155, 140, 126, 224, 27, - 227, 0, 140, 126, 224, 27, 223, 102, 140, 126, 243, 5, 243, 95, 140, 126, - 235, 13, 250, 252, 140, 126, 142, 254, 123, 140, 126, 243, 5, 231, 200, - 140, 126, 230, 30, 140, 126, 226, 130, 60, 140, 126, 234, 100, 243, 190, - 140, 126, 226, 130, 255, 58, 140, 126, 226, 130, 254, 140, 140, 126, 226, - 130, 72, 140, 126, 226, 130, 237, 255, 140, 126, 226, 130, 220, 110, 140, - 126, 226, 130, 220, 108, 140, 126, 226, 130, 68, 140, 126, 226, 130, 220, - 23, 140, 126, 229, 121, 140, 250, 78, 16, 252, 221, 140, 126, 226, 130, - 73, 140, 126, 226, 130, 254, 234, 140, 126, 226, 130, 74, 140, 126, 226, - 130, 254, 197, 234, 96, 140, 126, 226, 130, 254, 197, 234, 97, 140, 126, - 235, 164, 140, 126, 234, 93, 140, 126, 234, 94, 140, 126, 234, 100, 246, - 223, 140, 126, 234, 100, 221, 239, 140, 126, 234, 100, 221, 93, 140, 126, - 234, 100, 251, 50, 140, 126, 222, 25, 140, 126, 232, 36, 140, 126, 218, - 49, 140, 126, 245, 135, 140, 20, 217, 84, 140, 20, 107, 140, 20, 103, - 140, 20, 160, 140, 20, 154, 140, 20, 174, 140, 20, 182, 140, 20, 191, - 140, 20, 185, 140, 20, 190, 140, 126, 254, 121, 140, 126, 236, 124, 202, - 1, 236, 57, 202, 1, 236, 126, 223, 66, 202, 1, 236, 126, 222, 121, 202, - 1, 232, 84, 202, 1, 250, 182, 202, 1, 224, 27, 222, 121, 202, 1, 231, 56, - 202, 1, 248, 167, 202, 1, 101, 202, 1, 221, 240, 223, 66, 202, 1, 221, - 240, 222, 121, 202, 1, 231, 204, 202, 1, 252, 41, 202, 1, 229, 37, 202, - 1, 229, 119, 223, 66, 202, 1, 245, 140, 222, 121, 202, 1, 229, 119, 222, - 121, 202, 1, 245, 140, 223, 66, 202, 1, 233, 136, 202, 1, 217, 231, 202, - 1, 235, 13, 235, 36, 202, 1, 235, 13, 234, 246, 202, 1, 218, 187, 202, 1, - 224, 27, 223, 66, 202, 1, 243, 5, 223, 66, 202, 1, 74, 202, 1, 243, 5, - 222, 121, 202, 246, 208, 202, 29, 5, 60, 202, 29, 5, 234, 100, 236, 233, - 202, 29, 5, 255, 58, 202, 29, 5, 254, 140, 202, 29, 5, 72, 202, 29, 5, - 237, 255, 202, 29, 5, 218, 90, 202, 29, 5, 217, 166, 202, 29, 5, 68, 202, - 29, 5, 220, 23, 202, 29, 5, 234, 100, 236, 44, 202, 225, 62, 5, 235, 12, - 202, 225, 62, 5, 231, 56, 202, 29, 5, 73, 202, 29, 5, 246, 237, 202, 29, - 5, 74, 202, 29, 5, 253, 212, 202, 29, 5, 254, 196, 202, 236, 58, 235, - 188, 202, 145, 234, 100, 246, 223, 202, 145, 234, 100, 221, 239, 202, - 145, 234, 100, 221, 205, 202, 145, 234, 100, 251, 123, 202, 251, 151, 78, - 202, 232, 43, 202, 20, 217, 84, 202, 20, 107, 202, 20, 103, 202, 20, 160, - 202, 20, 154, 202, 20, 174, 202, 20, 182, 202, 20, 191, 202, 20, 185, - 202, 20, 190, 202, 243, 5, 231, 204, 202, 243, 5, 233, 136, 59, 4, 230, - 146, 59, 164, 244, 19, 217, 243, 233, 213, 221, 61, 60, 59, 164, 244, 19, - 217, 243, 233, 213, 255, 144, 227, 80, 252, 146, 196, 59, 164, 244, 19, - 217, 243, 233, 213, 255, 144, 244, 19, 221, 45, 196, 59, 164, 66, 217, - 243, 233, 213, 234, 27, 196, 59, 164, 250, 194, 217, 243, 233, 213, 225, - 31, 196, 59, 164, 251, 135, 217, 243, 233, 213, 229, 112, 225, 19, 196, - 59, 164, 217, 243, 233, 213, 221, 45, 225, 19, 196, 59, 164, 226, 115, - 225, 18, 59, 164, 251, 251, 217, 243, 233, 212, 59, 164, 252, 55, 224, - 197, 217, 243, 233, 212, 59, 164, 237, 173, 221, 44, 59, 164, 249, 68, - 221, 45, 251, 250, 59, 164, 225, 18, 59, 164, 231, 60, 225, 18, 59, 164, - 221, 45, 225, 18, 59, 164, 231, 60, 221, 45, 225, 18, 59, 164, 227, 96, - 251, 39, 223, 229, 225, 18, 59, 164, 227, 154, 244, 44, 225, 18, 59, 164, - 251, 135, 255, 148, 227, 26, 234, 26, 171, 251, 154, 59, 164, 244, 19, - 221, 44, 59, 235, 5, 5, 251, 67, 227, 25, 59, 235, 5, 5, 235, 77, 227, - 25, 59, 253, 248, 5, 225, 28, 244, 194, 255, 149, 227, 25, 59, 253, 248, - 5, 255, 146, 187, 59, 253, 248, 5, 226, 95, 221, 40, 59, 5, 227, 218, - 248, 179, 244, 193, 59, 5, 227, 218, 248, 179, 244, 70, 59, 5, 227, 218, - 248, 179, 244, 20, 59, 5, 227, 218, 232, 230, 244, 193, 59, 5, 227, 218, - 232, 230, 244, 70, 59, 5, 227, 218, 248, 179, 227, 218, 232, 229, 59, 20, - 217, 84, 59, 20, 107, 59, 20, 103, 59, 20, 160, 59, 20, 154, 59, 20, 174, - 59, 20, 182, 59, 20, 191, 59, 20, 185, 59, 20, 190, 59, 20, 144, 107, 59, - 20, 144, 103, 59, 20, 144, 160, 59, 20, 144, 154, 59, 20, 144, 174, 59, - 20, 144, 182, 59, 20, 144, 191, 59, 20, 144, 185, 59, 20, 144, 190, 59, - 20, 144, 217, 84, 59, 164, 251, 253, 227, 25, 59, 164, 232, 109, 251, - 204, 231, 68, 217, 23, 59, 164, 251, 135, 255, 148, 227, 26, 251, 205, - 233, 172, 251, 154, 59, 164, 232, 109, 251, 204, 225, 29, 227, 25, 59, - 164, 251, 47, 233, 212, 59, 164, 221, 56, 255, 145, 59, 164, 244, 8, 227, - 26, 243, 228, 59, 164, 244, 8, 227, 26, 243, 234, 59, 164, 254, 124, 236, - 140, 243, 228, 59, 164, 254, 124, 236, 140, 243, 234, 59, 5, 218, 42, - 221, 43, 59, 5, 234, 75, 221, 43, 59, 1, 175, 59, 1, 236, 149, 59, 1, - 245, 0, 59, 1, 244, 125, 59, 1, 232, 115, 59, 1, 251, 169, 59, 1, 251, - 69, 59, 1, 237, 123, 59, 1, 231, 77, 59, 1, 221, 29, 59, 1, 221, 19, 59, - 1, 249, 132, 59, 1, 249, 116, 59, 1, 231, 217, 59, 1, 222, 155, 59, 1, - 222, 35, 59, 1, 249, 207, 59, 1, 249, 36, 59, 1, 208, 59, 1, 187, 59, 1, - 229, 141, 59, 1, 252, 237, 59, 1, 252, 94, 59, 1, 196, 59, 1, 221, 55, - 59, 1, 221, 47, 59, 1, 247, 74, 59, 1, 247, 70, 59, 1, 219, 7, 59, 1, - 217, 80, 59, 1, 217, 114, 59, 1, 255, 151, 59, 1, 184, 59, 1, 203, 59, 1, - 235, 188, 59, 1, 225, 25, 59, 1, 223, 218, 59, 1, 226, 177, 59, 1, 155, - 59, 1, 60, 59, 1, 236, 10, 59, 1, 245, 167, 203, 59, 1, 236, 74, 59, 1, - 227, 52, 59, 29, 5, 255, 58, 59, 29, 5, 72, 59, 29, 5, 237, 255, 59, 29, - 5, 68, 59, 29, 5, 220, 23, 59, 29, 5, 167, 152, 59, 29, 5, 167, 227, 53, - 59, 29, 5, 167, 153, 59, 29, 5, 167, 235, 18, 59, 29, 5, 73, 59, 29, 5, - 246, 250, 59, 29, 5, 74, 59, 29, 5, 230, 127, 59, 5, 227, 81, 223, 104, - 232, 116, 227, 75, 59, 5, 227, 80, 252, 145, 59, 29, 5, 210, 72, 59, 29, - 5, 210, 237, 255, 59, 5, 231, 68, 217, 24, 232, 236, 249, 207, 59, 5, - 224, 37, 235, 124, 59, 164, 243, 196, 59, 164, 230, 21, 59, 5, 235, 127, - 227, 25, 59, 5, 218, 46, 227, 25, 59, 5, 235, 128, 221, 56, 251, 154, 59, - 5, 234, 28, 251, 154, 59, 5, 244, 22, 251, 155, 227, 152, 59, 5, 244, 22, - 234, 20, 227, 152, 59, 223, 97, 1, 175, 59, 223, 97, 1, 236, 149, 59, - 223, 97, 1, 245, 0, 59, 223, 97, 1, 244, 125, 59, 223, 97, 1, 232, 115, - 59, 223, 97, 1, 251, 169, 59, 223, 97, 1, 251, 69, 59, 223, 97, 1, 237, - 123, 59, 223, 97, 1, 231, 77, 59, 223, 97, 1, 221, 29, 59, 223, 97, 1, - 221, 19, 59, 223, 97, 1, 249, 132, 59, 223, 97, 1, 249, 116, 59, 223, 97, - 1, 231, 217, 59, 223, 97, 1, 222, 155, 59, 223, 97, 1, 222, 35, 59, 223, - 97, 1, 249, 207, 59, 223, 97, 1, 249, 36, 59, 223, 97, 1, 208, 59, 223, - 97, 1, 187, 59, 223, 97, 1, 229, 141, 59, 223, 97, 1, 252, 237, 59, 223, - 97, 1, 252, 94, 59, 223, 97, 1, 196, 59, 223, 97, 1, 221, 55, 59, 223, - 97, 1, 221, 47, 59, 223, 97, 1, 247, 74, 59, 223, 97, 1, 247, 70, 59, - 223, 97, 1, 219, 7, 59, 223, 97, 1, 217, 80, 59, 223, 97, 1, 217, 114, - 59, 223, 97, 1, 255, 151, 59, 223, 97, 1, 184, 59, 223, 97, 1, 203, 59, - 223, 97, 1, 235, 188, 59, 223, 97, 1, 225, 25, 59, 223, 97, 1, 223, 218, - 59, 223, 97, 1, 226, 177, 59, 223, 97, 1, 155, 59, 223, 97, 1, 60, 59, - 223, 97, 1, 236, 10, 59, 223, 97, 1, 245, 167, 219, 7, 59, 223, 97, 1, - 245, 167, 184, 59, 223, 97, 1, 245, 167, 203, 59, 236, 8, 227, 23, 236, - 149, 59, 236, 8, 227, 23, 236, 150, 251, 205, 233, 172, 251, 154, 59, - 251, 144, 5, 106, 252, 140, 59, 251, 144, 5, 170, 252, 140, 59, 251, 144, - 5, 251, 145, 222, 86, 59, 251, 144, 5, 226, 114, 255, 150, 59, 16, 247, - 121, 251, 248, 59, 16, 227, 217, 227, 82, 59, 16, 230, 35, 244, 192, 59, - 16, 227, 217, 227, 83, 227, 154, 244, 43, 59, 16, 229, 112, 187, 59, 16, - 231, 190, 251, 248, 59, 16, 231, 190, 251, 249, 231, 60, 255, 147, 59, - 16, 231, 190, 251, 249, 244, 21, 255, 147, 59, 16, 231, 190, 251, 249, - 251, 205, 255, 147, 59, 5, 227, 218, 232, 230, 227, 218, 248, 178, 59, 5, - 227, 218, 232, 230, 244, 20, 59, 164, 251, 252, 224, 197, 244, 104, 233, - 213, 227, 153, 59, 164, 233, 138, 217, 243, 244, 104, 233, 213, 227, 153, - 59, 164, 231, 60, 221, 44, 59, 164, 66, 252, 12, 227, 77, 217, 243, 233, - 213, 234, 27, 196, 59, 164, 250, 194, 252, 12, 227, 77, 217, 243, 233, - 213, 225, 31, 196, 227, 108, 223, 38, 55, 235, 114, 223, 38, 55, 227, - 108, 223, 38, 5, 2, 248, 143, 235, 114, 223, 38, 5, 2, 248, 143, 63, 1, - 175, 63, 1, 236, 149, 63, 1, 245, 0, 63, 1, 244, 125, 63, 1, 232, 115, - 63, 1, 251, 169, 63, 1, 251, 69, 63, 1, 237, 123, 63, 1, 237, 103, 63, 1, - 231, 77, 63, 1, 231, 206, 63, 1, 221, 29, 63, 1, 221, 19, 63, 1, 249, - 132, 63, 1, 249, 116, 63, 1, 231, 217, 63, 1, 222, 155, 63, 1, 222, 35, - 63, 1, 249, 207, 63, 1, 249, 36, 63, 1, 208, 63, 1, 187, 63, 1, 229, 141, - 63, 1, 252, 237, 63, 1, 252, 94, 63, 1, 196, 63, 1, 184, 63, 1, 203, 63, - 1, 235, 188, 63, 1, 219, 7, 63, 1, 226, 177, 63, 1, 155, 63, 1, 235, 17, - 63, 1, 60, 63, 1, 225, 10, 60, 63, 1, 72, 63, 1, 237, 255, 63, 1, 68, 63, - 1, 220, 23, 63, 1, 73, 63, 1, 233, 128, 73, 63, 1, 74, 63, 1, 253, 232, - 63, 29, 5, 222, 123, 255, 58, 63, 29, 5, 255, 58, 63, 29, 5, 72, 63, 29, - 5, 237, 255, 63, 29, 5, 68, 63, 29, 5, 220, 23, 63, 29, 5, 73, 63, 29, 5, - 254, 196, 63, 29, 5, 233, 128, 237, 255, 63, 29, 5, 233, 128, 74, 63, 29, - 5, 178, 50, 63, 5, 254, 95, 63, 5, 61, 56, 63, 5, 219, 77, 63, 5, 219, - 82, 63, 5, 254, 11, 63, 250, 147, 5, 128, 184, 63, 250, 147, 5, 128, 203, - 63, 250, 147, 5, 128, 219, 7, 63, 250, 147, 5, 128, 155, 63, 1, 244, 32, - 226, 177, 63, 20, 217, 84, 63, 20, 107, 63, 20, 103, 63, 20, 160, 63, 20, - 154, 63, 20, 174, 63, 20, 182, 63, 20, 191, 63, 20, 185, 63, 20, 190, 63, - 5, 235, 25, 226, 86, 63, 5, 226, 86, 63, 16, 235, 9, 63, 16, 250, 163, - 63, 16, 254, 213, 63, 16, 244, 178, 63, 1, 225, 25, 63, 1, 223, 218, 63, - 1, 167, 152, 63, 1, 167, 227, 53, 63, 1, 167, 153, 63, 1, 167, 235, 18, - 63, 29, 5, 167, 152, 63, 29, 5, 167, 227, 53, 63, 29, 5, 167, 153, 63, - 29, 5, 167, 235, 18, 63, 1, 233, 128, 232, 115, 63, 1, 233, 128, 237, - 103, 63, 1, 233, 128, 252, 178, 63, 1, 233, 128, 252, 174, 63, 250, 147, - 5, 233, 128, 128, 208, 63, 250, 147, 5, 233, 128, 128, 196, 63, 250, 147, - 5, 233, 128, 128, 235, 188, 63, 1, 225, 30, 236, 213, 225, 25, 63, 29, 5, - 225, 30, 236, 213, 246, 115, 63, 145, 164, 225, 30, 236, 213, 243, 170, - 63, 145, 164, 225, 30, 236, 213, 236, 185, 229, 118, 63, 1, 218, 215, - 228, 175, 236, 213, 222, 35, 63, 1, 218, 215, 228, 175, 236, 213, 228, - 181, 63, 29, 5, 218, 215, 228, 175, 236, 213, 246, 115, 63, 29, 5, 218, - 215, 228, 175, 236, 213, 220, 110, 63, 5, 218, 215, 228, 175, 236, 213, - 221, 131, 63, 5, 218, 215, 228, 175, 236, 213, 221, 130, 63, 5, 218, 215, - 228, 175, 236, 213, 221, 129, 63, 5, 218, 215, 228, 175, 236, 213, 221, - 128, 63, 5, 218, 215, 228, 175, 236, 213, 221, 127, 63, 1, 247, 4, 228, - 175, 236, 213, 231, 217, 63, 1, 247, 4, 228, 175, 236, 213, 217, 173, 63, - 1, 247, 4, 228, 175, 236, 213, 244, 106, 63, 29, 5, 244, 188, 236, 213, - 72, 63, 29, 5, 236, 190, 230, 167, 63, 29, 5, 236, 190, 68, 63, 29, 5, - 236, 190, 246, 250, 63, 1, 225, 10, 175, 63, 1, 225, 10, 236, 149, 63, 1, - 225, 10, 245, 0, 63, 1, 225, 10, 251, 169, 63, 1, 225, 10, 217, 114, 63, - 1, 225, 10, 231, 77, 63, 1, 225, 10, 249, 207, 63, 1, 225, 10, 208, 63, - 1, 225, 10, 229, 141, 63, 1, 225, 10, 246, 8, 63, 1, 225, 10, 252, 237, - 63, 1, 225, 10, 222, 35, 63, 1, 225, 10, 155, 63, 250, 147, 5, 225, 10, - 128, 219, 7, 63, 29, 5, 225, 10, 255, 58, 63, 29, 5, 225, 10, 73, 63, 29, - 5, 225, 10, 178, 50, 63, 29, 5, 225, 10, 39, 218, 90, 63, 5, 225, 10, - 221, 130, 63, 5, 225, 10, 221, 129, 63, 5, 225, 10, 221, 127, 63, 5, 225, - 10, 221, 126, 63, 5, 225, 10, 250, 115, 221, 130, 63, 5, 225, 10, 250, - 115, 221, 129, 63, 5, 225, 10, 250, 115, 246, 200, 221, 132, 63, 1, 227, - 12, 230, 26, 246, 8, 63, 5, 227, 12, 230, 26, 221, 127, 63, 225, 10, 20, - 217, 84, 63, 225, 10, 20, 107, 63, 225, 10, 20, 103, 63, 225, 10, 20, - 160, 63, 225, 10, 20, 154, 63, 225, 10, 20, 174, 63, 225, 10, 20, 182, - 63, 225, 10, 20, 191, 63, 225, 10, 20, 185, 63, 225, 10, 20, 190, 63, 5, - 236, 143, 221, 131, 63, 5, 236, 143, 221, 129, 63, 29, 5, 254, 186, 60, - 63, 29, 5, 254, 186, 254, 196, 63, 16, 225, 10, 107, 63, 16, 225, 10, - 246, 94, 95, 6, 1, 254, 131, 95, 6, 1, 252, 209, 95, 6, 1, 244, 230, 95, - 6, 1, 248, 153, 95, 6, 1, 246, 197, 95, 6, 1, 219, 85, 95, 6, 1, 217, 87, - 95, 6, 1, 222, 119, 95, 6, 1, 237, 223, 95, 6, 1, 236, 233, 95, 6, 1, - 235, 143, 95, 6, 1, 234, 86, 95, 6, 1, 232, 211, 95, 6, 1, 230, 138, 95, - 6, 1, 229, 243, 95, 6, 1, 217, 76, 95, 6, 1, 227, 249, 95, 6, 1, 226, - 140, 95, 6, 1, 222, 112, 95, 6, 1, 220, 87, 95, 6, 1, 229, 134, 95, 6, 1, - 236, 138, 95, 6, 1, 244, 119, 95, 6, 1, 228, 140, 95, 6, 1, 224, 209, 95, - 6, 1, 251, 22, 95, 6, 1, 251, 154, 95, 6, 1, 237, 91, 95, 6, 1, 250, 224, - 95, 6, 1, 251, 56, 95, 6, 1, 218, 136, 95, 6, 1, 237, 101, 95, 6, 1, 243, - 208, 95, 6, 1, 243, 162, 95, 6, 1, 243, 108, 95, 6, 1, 218, 227, 95, 6, - 1, 243, 182, 95, 6, 1, 243, 2, 95, 1, 254, 131, 95, 1, 252, 209, 95, 1, - 244, 230, 95, 1, 248, 153, 95, 1, 246, 197, 95, 1, 219, 85, 95, 1, 217, - 87, 95, 1, 222, 119, 95, 1, 237, 223, 95, 1, 236, 233, 95, 1, 235, 143, - 95, 1, 234, 86, 95, 1, 232, 211, 95, 1, 230, 138, 95, 1, 229, 243, 95, 1, - 217, 76, 95, 1, 227, 249, 95, 1, 226, 140, 95, 1, 222, 112, 95, 1, 220, - 87, 95, 1, 229, 134, 95, 1, 236, 138, 95, 1, 244, 119, 95, 1, 228, 140, - 95, 1, 224, 209, 95, 1, 251, 22, 95, 1, 251, 154, 95, 1, 237, 91, 95, 1, - 250, 224, 95, 1, 251, 56, 95, 1, 218, 136, 95, 1, 237, 101, 95, 1, 243, - 208, 95, 1, 243, 162, 95, 1, 243, 108, 95, 1, 218, 227, 95, 1, 243, 182, - 95, 1, 243, 2, 95, 1, 245, 203, 95, 1, 217, 233, 95, 1, 246, 210, 95, 1, - 215, 244, 230, 95, 1, 254, 191, 95, 229, 241, 225, 54, 58, 1, 95, 232, - 211, 22, 91, 236, 86, 22, 91, 223, 211, 22, 91, 232, 55, 22, 91, 221, - 192, 22, 91, 223, 200, 22, 91, 227, 140, 22, 91, 233, 187, 22, 91, 229, - 99, 22, 91, 223, 208, 22, 91, 224, 104, 22, 91, 223, 205, 22, 91, 238, - 22, 22, 91, 250, 230, 22, 91, 223, 215, 22, 91, 251, 29, 22, 91, 236, - 128, 22, 91, 222, 0, 22, 91, 229, 127, 22, 91, 243, 106, 22, 91, 232, 51, - 22, 91, 223, 209, 22, 91, 232, 45, 22, 91, 232, 49, 22, 91, 221, 189, 22, - 91, 227, 128, 22, 91, 223, 207, 22, 91, 227, 138, 22, 91, 236, 217, 22, - 91, 233, 180, 22, 91, 236, 220, 22, 91, 229, 94, 22, 91, 229, 92, 22, 91, - 229, 80, 22, 91, 229, 88, 22, 91, 229, 86, 22, 91, 229, 83, 22, 91, 229, - 85, 22, 91, 229, 82, 22, 91, 229, 87, 22, 91, 229, 97, 22, 91, 229, 98, - 22, 91, 229, 81, 22, 91, 229, 91, 22, 91, 236, 218, 22, 91, 236, 216, 22, - 91, 224, 97, 22, 91, 224, 95, 22, 91, 224, 87, 22, 91, 224, 90, 22, 91, - 224, 96, 22, 91, 224, 92, 22, 91, 224, 91, 22, 91, 224, 89, 22, 91, 224, - 100, 22, 91, 224, 102, 22, 91, 224, 103, 22, 91, 224, 98, 22, 91, 224, - 88, 22, 91, 224, 93, 22, 91, 224, 101, 22, 91, 251, 15, 22, 91, 251, 13, - 22, 91, 251, 78, 22, 91, 251, 76, 22, 91, 230, 1, 22, 91, 238, 17, 22, - 91, 238, 8, 22, 91, 238, 16, 22, 91, 238, 13, 22, 91, 238, 11, 22, 91, - 238, 15, 22, 91, 223, 212, 22, 91, 238, 20, 22, 91, 238, 21, 22, 91, 238, - 9, 22, 91, 238, 14, 22, 91, 218, 6, 22, 91, 250, 229, 22, 91, 251, 16, - 22, 91, 251, 14, 22, 91, 251, 79, 22, 91, 251, 77, 22, 91, 251, 27, 22, - 91, 251, 28, 22, 91, 251, 17, 22, 91, 251, 80, 22, 91, 229, 125, 22, 91, - 236, 219, 22, 91, 223, 213, 22, 91, 218, 12, 22, 91, 236, 77, 22, 91, - 232, 47, 22, 91, 232, 53, 22, 91, 232, 52, 22, 91, 221, 186, 22, 91, 245, - 185, 22, 122, 245, 185, 22, 122, 60, 22, 122, 254, 234, 22, 122, 184, 22, - 122, 218, 65, 22, 122, 246, 168, 22, 122, 73, 22, 122, 218, 16, 22, 122, - 218, 25, 22, 122, 74, 22, 122, 219, 7, 22, 122, 219, 4, 22, 122, 230, - 167, 22, 122, 217, 231, 22, 122, 68, 22, 122, 218, 219, 22, 122, 218, - 227, 22, 122, 218, 204, 22, 122, 217, 200, 22, 122, 246, 115, 22, 122, - 217, 250, 22, 122, 72, 22, 122, 255, 142, 22, 122, 255, 141, 22, 122, - 218, 79, 22, 122, 218, 77, 22, 122, 246, 166, 22, 122, 246, 165, 22, 122, - 246, 167, 22, 122, 218, 15, 22, 122, 218, 14, 22, 122, 231, 13, 22, 122, - 231, 14, 22, 122, 231, 7, 22, 122, 231, 12, 22, 122, 231, 10, 22, 122, - 217, 225, 22, 122, 217, 224, 22, 122, 217, 223, 22, 122, 217, 226, 22, - 122, 217, 227, 22, 122, 220, 179, 22, 122, 220, 178, 22, 122, 220, 177, - 22, 122, 220, 174, 22, 122, 220, 175, 22, 122, 217, 199, 22, 122, 217, - 196, 22, 122, 217, 197, 22, 122, 217, 191, 22, 122, 217, 192, 22, 122, - 217, 193, 22, 122, 217, 195, 22, 122, 246, 109, 22, 122, 246, 111, 22, - 122, 217, 249, 22, 122, 242, 106, 22, 122, 242, 98, 22, 122, 242, 101, - 22, 122, 242, 99, 22, 122, 242, 103, 22, 122, 242, 105, 22, 122, 254, 60, - 22, 122, 254, 57, 22, 122, 254, 55, 22, 122, 254, 56, 22, 122, 223, 216, - 22, 122, 255, 143, 22, 122, 218, 78, 22, 122, 218, 13, 22, 122, 231, 9, - 22, 122, 231, 8, 22, 85, 236, 86, 22, 85, 223, 211, 22, 85, 236, 79, 22, - 85, 232, 55, 22, 85, 232, 53, 22, 85, 232, 52, 22, 85, 221, 192, 22, 85, - 227, 140, 22, 85, 227, 135, 22, 85, 227, 132, 22, 85, 227, 125, 22, 85, - 227, 120, 22, 85, 227, 115, 22, 85, 227, 126, 22, 85, 227, 138, 22, 85, - 233, 187, 22, 85, 229, 99, 22, 85, 229, 88, 22, 85, 224, 104, 22, 85, - 223, 205, 22, 85, 238, 22, 22, 85, 250, 230, 22, 85, 251, 29, 22, 85, - 236, 128, 22, 85, 222, 0, 22, 85, 229, 127, 22, 85, 243, 106, 22, 85, - 236, 80, 22, 85, 236, 78, 22, 85, 232, 51, 22, 85, 232, 45, 22, 85, 232, - 47, 22, 85, 232, 50, 22, 85, 232, 46, 22, 85, 221, 189, 22, 85, 221, 186, - 22, 85, 227, 133, 22, 85, 227, 128, 22, 85, 227, 114, 22, 85, 227, 113, - 22, 85, 223, 207, 22, 85, 227, 130, 22, 85, 227, 129, 22, 85, 227, 122, - 22, 85, 227, 124, 22, 85, 227, 137, 22, 85, 227, 117, 22, 85, 227, 127, - 22, 85, 227, 136, 22, 85, 227, 112, 22, 85, 233, 183, 22, 85, 233, 178, - 22, 85, 233, 180, 22, 85, 233, 177, 22, 85, 233, 175, 22, 85, 233, 181, - 22, 85, 233, 186, 22, 85, 233, 184, 22, 85, 236, 220, 22, 85, 229, 90, - 22, 85, 229, 91, 22, 85, 229, 96, 22, 85, 236, 218, 22, 85, 224, 97, 22, - 85, 224, 87, 22, 85, 224, 90, 22, 85, 224, 92, 22, 85, 230, 1, 22, 85, - 238, 17, 22, 85, 238, 10, 22, 85, 223, 212, 22, 85, 238, 18, 22, 85, 218, - 6, 22, 85, 218, 2, 22, 85, 218, 3, 22, 85, 229, 125, 22, 85, 236, 219, - 22, 85, 243, 104, 22, 85, 243, 102, 22, 85, 243, 105, 22, 85, 243, 103, - 22, 85, 218, 12, 22, 85, 236, 82, 22, 85, 236, 81, 22, 85, 236, 85, 22, - 85, 236, 83, 22, 85, 236, 84, 22, 85, 223, 209, 28, 4, 155, 28, 4, 242, - 173, 28, 4, 243, 112, 28, 4, 243, 211, 28, 4, 243, 148, 28, 4, 243, 162, - 28, 4, 243, 4, 28, 4, 243, 3, 28, 4, 235, 188, 28, 4, 234, 231, 28, 4, - 235, 67, 28, 4, 235, 187, 28, 4, 235, 118, 28, 4, 235, 122, 28, 4, 235, - 12, 28, 4, 234, 206, 28, 4, 243, 121, 28, 4, 243, 115, 28, 4, 243, 117, - 28, 4, 243, 120, 28, 4, 243, 118, 28, 4, 243, 119, 28, 4, 243, 116, 28, - 4, 243, 114, 28, 4, 196, 28, 4, 233, 99, 28, 4, 233, 196, 28, 4, 234, - 118, 28, 4, 234, 16, 28, 4, 234, 25, 28, 4, 233, 136, 28, 4, 233, 49, 28, - 4, 222, 212, 28, 4, 222, 206, 28, 4, 222, 208, 28, 4, 222, 211, 28, 4, - 222, 209, 28, 4, 222, 210, 28, 4, 222, 207, 28, 4, 222, 205, 28, 4, 203, - 28, 4, 227, 22, 28, 4, 227, 147, 28, 4, 228, 0, 28, 4, 227, 200, 28, 4, - 227, 216, 28, 4, 227, 75, 28, 4, 226, 252, 28, 4, 226, 177, 28, 4, 223, - 103, 28, 4, 224, 140, 28, 4, 226, 175, 28, 4, 226, 84, 28, 4, 226, 94, - 28, 4, 224, 26, 28, 4, 223, 36, 28, 4, 225, 25, 28, 4, 224, 170, 28, 4, - 224, 221, 28, 4, 225, 21, 28, 4, 224, 244, 28, 4, 224, 246, 28, 4, 224, - 200, 28, 4, 224, 157, 28, 4, 228, 155, 28, 4, 228, 98, 28, 4, 228, 121, - 28, 4, 228, 154, 28, 4, 228, 135, 28, 4, 228, 136, 28, 4, 228, 110, 28, - 4, 228, 109, 28, 4, 228, 57, 28, 4, 228, 53, 28, 4, 228, 56, 28, 4, 228, - 54, 28, 4, 228, 55, 28, 4, 228, 133, 28, 4, 228, 127, 28, 4, 228, 129, - 28, 4, 228, 132, 28, 4, 228, 130, 28, 4, 228, 131, 28, 4, 228, 128, 28, - 4, 228, 126, 28, 4, 228, 122, 28, 4, 228, 125, 28, 4, 228, 123, 28, 4, - 228, 124, 28, 4, 252, 237, 28, 4, 251, 248, 28, 4, 252, 84, 28, 4, 252, - 236, 28, 4, 252, 137, 28, 4, 252, 144, 28, 4, 252, 41, 28, 4, 251, 218, - 28, 4, 219, 189, 28, 4, 219, 56, 28, 4, 219, 94, 28, 4, 219, 188, 28, 4, - 219, 160, 28, 4, 219, 165, 28, 4, 219, 72, 28, 4, 219, 49, 28, 4, 222, - 155, 28, 4, 221, 0, 28, 4, 221, 205, 28, 4, 222, 152, 28, 4, 222, 80, 28, - 4, 222, 87, 28, 4, 101, 28, 4, 220, 225, 28, 4, 251, 169, 28, 4, 250, 92, - 28, 4, 250, 235, 28, 4, 251, 168, 28, 4, 251, 91, 28, 4, 251, 99, 28, 4, - 250, 182, 28, 4, 250, 66, 28, 4, 218, 138, 28, 4, 218, 114, 28, 4, 218, - 130, 28, 4, 218, 137, 28, 4, 218, 134, 28, 4, 218, 135, 28, 4, 218, 121, - 28, 4, 218, 120, 28, 4, 218, 109, 28, 4, 218, 105, 28, 4, 218, 108, 28, - 4, 218, 106, 28, 4, 218, 107, 28, 4, 208, 28, 4, 231, 144, 28, 4, 232, - 62, 28, 4, 232, 235, 28, 4, 232, 139, 28, 4, 232, 141, 28, 4, 231, 204, - 28, 4, 231, 85, 28, 4, 231, 77, 28, 4, 231, 50, 28, 4, 231, 67, 28, 4, - 231, 76, 28, 4, 231, 72, 28, 4, 231, 73, 28, 4, 231, 56, 28, 4, 231, 43, - 28, 4, 244, 73, 60, 28, 4, 244, 73, 68, 28, 4, 244, 73, 72, 28, 4, 244, - 73, 255, 58, 28, 4, 244, 73, 246, 250, 28, 4, 244, 73, 73, 28, 4, 244, - 73, 74, 28, 4, 244, 73, 219, 7, 28, 4, 175, 28, 4, 236, 7, 28, 4, 236, - 113, 28, 4, 237, 5, 28, 4, 236, 183, 28, 4, 236, 184, 28, 4, 236, 57, 28, - 4, 236, 56, 28, 4, 235, 234, 28, 4, 235, 229, 28, 4, 235, 233, 28, 4, - 235, 230, 28, 4, 235, 231, 28, 4, 235, 224, 28, 4, 235, 218, 28, 4, 235, - 220, 28, 4, 235, 223, 28, 4, 235, 221, 28, 4, 235, 222, 28, 4, 235, 219, - 28, 4, 235, 217, 28, 4, 235, 213, 28, 4, 235, 216, 28, 4, 235, 214, 28, - 4, 235, 215, 28, 4, 219, 7, 28, 4, 218, 165, 28, 4, 218, 204, 28, 4, 219, - 6, 28, 4, 218, 224, 28, 4, 218, 227, 28, 4, 218, 187, 28, 4, 218, 186, - 28, 4, 229, 133, 60, 28, 4, 229, 133, 68, 28, 4, 229, 133, 72, 28, 4, - 229, 133, 255, 58, 28, 4, 229, 133, 246, 250, 28, 4, 229, 133, 73, 28, 4, - 229, 133, 74, 28, 4, 217, 114, 28, 4, 217, 13, 28, 4, 217, 42, 28, 4, - 217, 113, 28, 4, 217, 90, 28, 4, 217, 92, 28, 4, 217, 21, 28, 4, 217, 0, - 28, 4, 217, 80, 28, 4, 217, 60, 28, 4, 217, 67, 28, 4, 217, 79, 28, 4, - 217, 71, 28, 4, 217, 72, 28, 4, 217, 65, 28, 4, 217, 51, 28, 4, 184, 28, - 4, 217, 200, 28, 4, 217, 250, 28, 4, 218, 76, 28, 4, 218, 22, 28, 4, 218, - 25, 28, 4, 217, 231, 28, 4, 217, 222, 28, 4, 249, 207, 28, 4, 247, 111, - 28, 4, 249, 15, 28, 4, 249, 206, 28, 4, 249, 82, 28, 4, 249, 92, 28, 4, - 248, 167, 28, 4, 247, 83, 28, 4, 249, 132, 28, 4, 249, 102, 28, 4, 249, - 114, 28, 4, 249, 131, 28, 4, 249, 119, 28, 4, 249, 120, 28, 4, 249, 107, - 28, 4, 249, 93, 28, 4, 237, 123, 28, 4, 237, 43, 28, 4, 237, 98, 28, 4, - 237, 122, 28, 4, 237, 113, 28, 4, 237, 114, 28, 4, 237, 59, 28, 4, 237, - 25, 28, 4, 245, 0, 28, 4, 244, 17, 28, 4, 244, 103, 28, 4, 244, 253, 28, - 4, 244, 184, 28, 4, 244, 191, 28, 4, 244, 68, 28, 4, 244, 67, 28, 4, 243, - 243, 28, 4, 243, 239, 28, 4, 243, 242, 28, 4, 243, 240, 28, 4, 243, 241, - 28, 4, 244, 160, 28, 4, 244, 140, 28, 4, 244, 150, 28, 4, 244, 159, 28, - 4, 244, 154, 28, 4, 244, 155, 28, 4, 244, 144, 28, 4, 244, 129, 28, 4, - 222, 35, 28, 4, 221, 223, 28, 4, 222, 2, 28, 4, 222, 34, 28, 4, 222, 21, - 28, 4, 222, 22, 28, 4, 221, 239, 28, 4, 221, 216, 28, 4, 251, 69, 28, 4, - 250, 253, 28, 4, 251, 31, 28, 4, 251, 68, 28, 4, 251, 43, 28, 4, 251, 46, - 28, 4, 251, 11, 28, 4, 250, 242, 28, 4, 229, 141, 28, 4, 229, 114, 28, 4, - 229, 129, 28, 4, 229, 140, 28, 4, 229, 131, 28, 4, 229, 132, 28, 4, 229, - 118, 28, 4, 229, 110, 28, 4, 221, 55, 28, 4, 221, 36, 28, 4, 221, 39, 28, - 4, 221, 54, 28, 4, 221, 49, 28, 4, 221, 50, 28, 4, 221, 38, 28, 4, 221, - 34, 28, 4, 220, 188, 28, 4, 220, 180, 28, 4, 220, 184, 28, 4, 220, 187, - 28, 4, 220, 185, 28, 4, 220, 186, 28, 4, 220, 182, 28, 4, 220, 181, 28, - 4, 246, 8, 28, 4, 245, 92, 28, 4, 245, 203, 28, 4, 246, 7, 28, 4, 245, - 226, 28, 4, 245, 231, 28, 4, 245, 139, 28, 4, 245, 78, 28, 4, 187, 28, 4, - 228, 202, 28, 4, 229, 108, 28, 4, 230, 43, 28, 4, 229, 191, 28, 4, 229, - 198, 28, 4, 229, 37, 28, 4, 228, 181, 28, 4, 226, 242, 28, 4, 233, 39, - 28, 4, 245, 72, 28, 36, 244, 183, 78, 28, 226, 87, 78, 28, 218, 173, 28, - 245, 90, 223, 136, 28, 250, 168, 28, 225, 67, 28, 250, 175, 28, 228, 242, - 250, 175, 28, 228, 82, 78, 28, 229, 241, 225, 54, 28, 20, 107, 28, 20, - 103, 28, 20, 160, 28, 20, 154, 28, 20, 174, 28, 20, 182, 28, 20, 191, 28, - 20, 185, 28, 20, 190, 28, 54, 222, 65, 28, 54, 220, 219, 28, 54, 221, - 245, 28, 54, 245, 119, 28, 54, 245, 196, 28, 54, 224, 69, 28, 54, 225, - 38, 28, 54, 246, 227, 28, 54, 232, 27, 28, 54, 242, 161, 28, 54, 222, 66, - 221, 231, 28, 4, 226, 91, 233, 49, 28, 4, 233, 45, 28, 4, 233, 46, 28, 4, - 233, 47, 28, 4, 226, 91, 251, 218, 28, 4, 251, 215, 28, 4, 251, 216, 28, - 4, 251, 217, 28, 4, 226, 91, 245, 78, 28, 4, 245, 74, 28, 4, 245, 75, 28, - 4, 245, 76, 28, 4, 226, 91, 228, 181, 28, 4, 228, 177, 28, 4, 228, 178, - 28, 4, 228, 179, 28, 221, 133, 164, 217, 234, 28, 221, 133, 164, 249, 50, - 28, 221, 133, 164, 227, 97, 28, 221, 133, 164, 224, 192, 227, 97, 28, - 221, 133, 164, 248, 248, 28, 221, 133, 164, 236, 167, 28, 221, 133, 164, - 251, 19, 28, 221, 133, 164, 243, 110, 28, 221, 133, 164, 249, 49, 28, - 221, 133, 164, 235, 245, 143, 1, 60, 143, 1, 73, 143, 1, 72, 143, 1, 74, - 143, 1, 68, 143, 1, 216, 216, 143, 1, 245, 0, 143, 1, 175, 143, 1, 244, - 191, 143, 1, 244, 103, 143, 1, 244, 68, 143, 1, 244, 17, 143, 1, 243, - 244, 143, 1, 155, 143, 1, 243, 162, 143, 1, 243, 112, 143, 1, 243, 4, - 143, 1, 242, 173, 143, 1, 242, 154, 143, 1, 235, 188, 143, 1, 235, 122, - 143, 1, 235, 67, 143, 1, 235, 12, 143, 1, 234, 231, 143, 1, 234, 207, - 143, 1, 196, 143, 1, 234, 25, 143, 1, 233, 196, 143, 1, 233, 136, 143, 1, - 233, 99, 143, 1, 208, 143, 1, 243, 26, 143, 1, 232, 224, 143, 1, 232, - 141, 143, 1, 232, 62, 143, 1, 231, 204, 143, 1, 231, 144, 143, 1, 231, - 87, 143, 1, 228, 97, 143, 1, 228, 84, 143, 1, 228, 78, 143, 1, 228, 72, - 143, 1, 228, 61, 143, 1, 228, 59, 143, 1, 226, 177, 143, 1, 198, 143, 1, - 226, 94, 143, 1, 224, 140, 143, 1, 224, 26, 143, 1, 223, 103, 143, 1, - 223, 41, 143, 1, 249, 207, 143, 1, 222, 155, 143, 1, 249, 92, 143, 1, - 222, 87, 143, 1, 249, 15, 143, 1, 221, 205, 143, 1, 248, 167, 143, 1, - 247, 111, 143, 1, 247, 85, 143, 1, 248, 176, 143, 1, 221, 155, 143, 1, - 221, 154, 143, 1, 221, 144, 143, 1, 221, 143, 143, 1, 221, 142, 143, 1, - 221, 141, 143, 1, 221, 55, 143, 1, 221, 50, 143, 1, 221, 39, 143, 1, 221, - 38, 143, 1, 221, 36, 143, 1, 221, 35, 143, 1, 219, 7, 143, 1, 218, 227, - 143, 1, 218, 204, 143, 1, 218, 187, 143, 1, 218, 165, 143, 1, 218, 156, - 143, 1, 184, 143, 1, 218, 25, 143, 1, 217, 250, 143, 1, 217, 231, 143, 1, - 217, 200, 143, 1, 217, 174, 18, 19, 242, 121, 18, 19, 73, 18, 19, 255, - 22, 18, 19, 72, 18, 19, 237, 255, 18, 19, 74, 18, 19, 230, 127, 18, 19, - 218, 89, 230, 127, 18, 19, 64, 246, 250, 18, 19, 64, 72, 18, 19, 60, 18, - 19, 255, 58, 18, 19, 218, 227, 18, 19, 137, 218, 227, 18, 19, 218, 204, - 18, 19, 137, 218, 204, 18, 19, 218, 196, 18, 19, 137, 218, 196, 18, 19, - 218, 187, 18, 19, 137, 218, 187, 18, 19, 218, 180, 18, 19, 137, 218, 180, - 18, 19, 232, 207, 218, 180, 18, 19, 219, 7, 18, 19, 137, 219, 7, 18, 19, - 219, 6, 18, 19, 137, 219, 6, 18, 19, 232, 207, 219, 6, 18, 19, 254, 196, - 18, 19, 218, 89, 219, 40, 18, 19, 244, 73, 223, 136, 18, 19, 39, 168, 18, - 19, 39, 244, 36, 18, 19, 39, 252, 29, 144, 227, 93, 18, 19, 39, 221, 120, - 144, 227, 93, 18, 19, 39, 45, 144, 227, 93, 18, 19, 39, 227, 93, 18, 19, - 39, 51, 168, 18, 19, 39, 51, 224, 192, 69, 223, 107, 18, 19, 39, 233, - 193, 248, 145, 18, 19, 39, 224, 192, 186, 92, 18, 19, 39, 229, 43, 18, - 19, 39, 113, 222, 143, 18, 19, 246, 197, 18, 19, 237, 223, 18, 19, 230, - 138, 18, 19, 254, 131, 18, 19, 229, 198, 18, 19, 230, 41, 18, 19, 229, - 108, 18, 19, 229, 76, 18, 19, 229, 37, 18, 19, 229, 21, 18, 19, 218, 89, - 229, 21, 18, 19, 64, 243, 148, 18, 19, 64, 243, 112, 18, 19, 187, 18, 19, - 230, 43, 18, 19, 228, 179, 18, 19, 137, 228, 179, 18, 19, 228, 177, 18, - 19, 137, 228, 177, 18, 19, 228, 176, 18, 19, 137, 228, 176, 18, 19, 228, - 174, 18, 19, 137, 228, 174, 18, 19, 228, 173, 18, 19, 137, 228, 173, 18, - 19, 228, 181, 18, 19, 137, 228, 181, 18, 19, 228, 180, 18, 19, 137, 228, - 180, 18, 19, 218, 89, 228, 180, 18, 19, 230, 59, 18, 19, 137, 230, 59, - 18, 19, 64, 243, 225, 18, 19, 222, 87, 18, 19, 222, 150, 18, 19, 221, - 205, 18, 19, 221, 194, 18, 19, 101, 18, 19, 221, 122, 18, 19, 218, 89, - 221, 122, 18, 19, 64, 249, 82, 18, 19, 64, 249, 15, 18, 19, 222, 155, 18, - 19, 222, 152, 18, 19, 220, 223, 18, 19, 137, 220, 223, 18, 19, 220, 208, - 18, 19, 137, 220, 208, 18, 19, 220, 207, 18, 19, 137, 220, 207, 18, 19, - 103, 18, 19, 137, 103, 18, 19, 220, 203, 18, 19, 137, 220, 203, 18, 19, - 220, 225, 18, 19, 137, 220, 225, 18, 19, 220, 224, 18, 19, 137, 220, 224, - 18, 19, 232, 207, 220, 224, 18, 19, 222, 201, 18, 19, 221, 26, 18, 19, - 221, 12, 18, 19, 221, 11, 18, 19, 221, 29, 18, 19, 236, 184, 18, 19, 237, - 2, 18, 19, 236, 113, 18, 19, 236, 105, 18, 19, 236, 57, 18, 19, 236, 41, - 18, 19, 218, 89, 236, 41, 18, 19, 175, 18, 19, 237, 5, 18, 19, 235, 231, - 18, 19, 137, 235, 231, 18, 19, 235, 229, 18, 19, 137, 235, 229, 18, 19, - 235, 228, 18, 19, 137, 235, 228, 18, 19, 235, 227, 18, 19, 137, 235, 227, - 18, 19, 235, 226, 18, 19, 137, 235, 226, 18, 19, 235, 234, 18, 19, 137, - 235, 234, 18, 19, 235, 233, 18, 19, 137, 235, 233, 18, 19, 232, 207, 235, - 233, 18, 19, 237, 17, 18, 19, 235, 235, 18, 19, 224, 5, 236, 178, 18, 19, - 224, 5, 236, 106, 18, 19, 224, 5, 236, 53, 18, 19, 224, 5, 236, 245, 18, - 19, 251, 99, 18, 19, 251, 167, 18, 19, 250, 235, 18, 19, 250, 225, 18, - 19, 250, 182, 18, 19, 250, 130, 18, 19, 218, 89, 250, 130, 18, 19, 251, - 169, 18, 19, 251, 168, 18, 19, 250, 64, 18, 19, 137, 250, 64, 18, 19, - 250, 62, 18, 19, 137, 250, 62, 18, 19, 250, 61, 18, 19, 137, 250, 61, 18, - 19, 250, 60, 18, 19, 137, 250, 60, 18, 19, 250, 59, 18, 19, 137, 250, 59, - 18, 19, 250, 66, 18, 19, 137, 250, 66, 18, 19, 250, 65, 18, 19, 137, 250, - 65, 18, 19, 232, 207, 250, 65, 18, 19, 251, 202, 18, 19, 226, 116, 222, - 37, 18, 19, 234, 25, 18, 19, 234, 117, 18, 19, 233, 196, 18, 19, 233, - 171, 18, 19, 233, 136, 18, 19, 233, 119, 18, 19, 218, 89, 233, 119, 18, - 19, 196, 18, 19, 234, 118, 18, 19, 233, 47, 18, 19, 137, 233, 47, 18, 19, - 233, 45, 18, 19, 137, 233, 45, 18, 19, 233, 44, 18, 19, 137, 233, 44, 18, - 19, 233, 43, 18, 19, 137, 233, 43, 18, 19, 233, 42, 18, 19, 137, 233, 42, - 18, 19, 233, 49, 18, 19, 137, 233, 49, 18, 19, 233, 48, 18, 19, 137, 233, - 48, 18, 19, 232, 207, 233, 48, 18, 19, 189, 18, 19, 137, 189, 18, 19, - 233, 199, 18, 19, 253, 243, 189, 18, 19, 226, 116, 189, 18, 19, 232, 141, - 18, 19, 232, 234, 18, 19, 232, 62, 18, 19, 232, 38, 18, 19, 231, 204, 18, - 19, 231, 195, 18, 19, 218, 89, 231, 195, 18, 19, 208, 18, 19, 232, 235, - 18, 19, 231, 83, 18, 19, 137, 231, 83, 18, 19, 231, 85, 18, 19, 137, 231, - 85, 18, 19, 231, 84, 18, 19, 137, 231, 84, 18, 19, 232, 207, 231, 84, 18, - 19, 207, 18, 19, 64, 232, 117, 18, 19, 232, 67, 18, 19, 235, 122, 18, 19, - 235, 186, 18, 19, 235, 67, 18, 19, 235, 55, 18, 19, 235, 12, 18, 19, 234, - 248, 18, 19, 218, 89, 234, 248, 18, 19, 235, 188, 18, 19, 235, 187, 18, - 19, 234, 204, 18, 19, 137, 234, 204, 18, 19, 234, 203, 18, 19, 137, 234, - 203, 18, 19, 234, 202, 18, 19, 137, 234, 202, 18, 19, 234, 201, 18, 19, - 137, 234, 201, 18, 19, 234, 200, 18, 19, 137, 234, 200, 18, 19, 234, 206, - 18, 19, 137, 234, 206, 18, 19, 234, 205, 18, 19, 137, 234, 205, 18, 19, - 153, 18, 19, 137, 153, 18, 19, 128, 153, 18, 19, 226, 94, 18, 19, 226, - 173, 18, 19, 224, 140, 18, 19, 224, 125, 18, 19, 224, 26, 18, 19, 224, - 14, 18, 19, 218, 89, 224, 14, 18, 19, 226, 177, 18, 19, 226, 175, 18, 19, - 223, 32, 18, 19, 137, 223, 32, 18, 19, 223, 29, 18, 19, 137, 223, 29, 18, - 19, 223, 28, 18, 19, 137, 223, 28, 18, 19, 223, 27, 18, 19, 137, 223, 27, - 18, 19, 223, 26, 18, 19, 137, 223, 26, 18, 19, 223, 36, 18, 19, 137, 223, - 36, 18, 19, 223, 35, 18, 19, 137, 223, 35, 18, 19, 232, 207, 223, 35, 18, - 19, 198, 18, 19, 253, 243, 198, 18, 19, 223, 37, 18, 19, 252, 50, 198, - 18, 19, 233, 116, 224, 66, 18, 19, 232, 207, 224, 59, 18, 19, 232, 207, - 226, 233, 18, 19, 232, 207, 223, 228, 18, 19, 232, 207, 223, 105, 18, 19, - 232, 207, 224, 58, 18, 19, 232, 207, 226, 97, 18, 19, 224, 246, 18, 19, - 224, 221, 18, 19, 224, 216, 18, 19, 224, 200, 18, 19, 224, 195, 18, 19, - 225, 25, 18, 19, 225, 21, 18, 19, 224, 155, 18, 19, 137, 224, 155, 18, - 19, 224, 154, 18, 19, 137, 224, 154, 18, 19, 224, 153, 18, 19, 137, 224, - 153, 18, 19, 224, 152, 18, 19, 137, 224, 152, 18, 19, 224, 151, 18, 19, - 137, 224, 151, 18, 19, 224, 157, 18, 19, 137, 224, 157, 18, 19, 224, 156, - 18, 19, 137, 224, 156, 18, 19, 225, 27, 18, 19, 218, 25, 18, 19, 218, 74, - 18, 19, 217, 250, 18, 19, 217, 242, 18, 19, 217, 231, 18, 19, 217, 216, - 18, 19, 218, 89, 217, 216, 18, 19, 184, 18, 19, 218, 76, 18, 19, 217, - 171, 18, 19, 137, 217, 171, 18, 19, 217, 170, 18, 19, 137, 217, 170, 18, - 19, 217, 169, 18, 19, 137, 217, 169, 18, 19, 217, 168, 18, 19, 137, 217, - 168, 18, 19, 217, 167, 18, 19, 137, 217, 167, 18, 19, 217, 173, 18, 19, - 137, 217, 173, 18, 19, 217, 172, 18, 19, 137, 217, 172, 18, 19, 232, 207, - 217, 172, 18, 19, 218, 90, 18, 19, 252, 82, 218, 90, 18, 19, 137, 218, - 90, 18, 19, 226, 116, 217, 250, 18, 19, 227, 216, 18, 19, 228, 38, 227, - 216, 18, 19, 137, 235, 122, 18, 19, 227, 255, 18, 19, 227, 147, 18, 19, - 227, 98, 18, 19, 227, 75, 18, 19, 227, 67, 18, 19, 137, 235, 12, 18, 19, - 203, 18, 19, 228, 0, 18, 19, 137, 235, 188, 18, 19, 226, 251, 18, 19, - 137, 226, 251, 18, 19, 152, 18, 19, 137, 152, 18, 19, 128, 152, 18, 19, - 245, 231, 18, 19, 246, 5, 18, 19, 245, 203, 18, 19, 245, 190, 18, 19, - 245, 139, 18, 19, 245, 134, 18, 19, 246, 8, 18, 19, 246, 7, 18, 19, 245, - 77, 18, 19, 137, 245, 77, 18, 19, 246, 74, 18, 19, 222, 22, 18, 19, 233, - 32, 222, 22, 18, 19, 222, 2, 18, 19, 233, 32, 222, 2, 18, 19, 221, 254, - 18, 19, 233, 32, 221, 254, 18, 19, 221, 239, 18, 19, 221, 236, 18, 19, - 222, 35, 18, 19, 222, 34, 18, 19, 221, 215, 18, 19, 137, 221, 215, 18, - 19, 222, 37, 18, 19, 221, 17, 18, 19, 221, 16, 18, 19, 221, 15, 18, 19, - 221, 19, 18, 19, 221, 20, 18, 19, 220, 201, 18, 19, 220, 200, 18, 19, - 220, 199, 18, 19, 220, 202, 18, 19, 231, 102, 243, 162, 18, 19, 231, 102, - 243, 112, 18, 19, 231, 102, 243, 97, 18, 19, 231, 102, 243, 4, 18, 19, - 231, 102, 242, 248, 18, 19, 231, 102, 155, 18, 19, 231, 102, 243, 211, - 18, 19, 231, 102, 243, 225, 18, 19, 231, 101, 243, 225, 18, 19, 243, 90, - 18, 19, 228, 151, 18, 19, 228, 121, 18, 19, 228, 116, 18, 19, 228, 110, - 18, 19, 228, 105, 18, 19, 228, 155, 18, 19, 228, 154, 18, 19, 228, 163, - 18, 19, 221, 151, 18, 19, 221, 149, 18, 19, 221, 148, 18, 19, 221, 152, - 18, 19, 137, 227, 216, 18, 19, 137, 227, 147, 18, 19, 137, 227, 75, 18, - 19, 137, 203, 18, 19, 232, 113, 18, 19, 232, 92, 18, 19, 232, 88, 18, 19, - 232, 84, 18, 19, 232, 80, 18, 19, 232, 115, 18, 19, 232, 114, 18, 19, - 232, 117, 18, 19, 231, 215, 18, 19, 226, 116, 224, 246, 18, 19, 226, 116, - 224, 221, 18, 19, 226, 116, 224, 200, 18, 19, 226, 116, 225, 25, 18, 19, - 218, 178, 222, 22, 18, 19, 218, 178, 222, 2, 18, 19, 218, 178, 221, 239, - 18, 19, 218, 178, 222, 35, 18, 19, 218, 178, 222, 37, 18, 19, 235, 73, - 18, 19, 235, 72, 18, 19, 235, 71, 18, 19, 235, 70, 18, 19, 235, 79, 18, - 19, 235, 78, 18, 19, 235, 80, 18, 19, 222, 36, 222, 22, 18, 19, 222, 36, - 222, 2, 18, 19, 222, 36, 221, 254, 18, 19, 222, 36, 221, 239, 18, 19, - 222, 36, 221, 236, 18, 19, 222, 36, 222, 35, 18, 19, 222, 36, 222, 34, - 18, 19, 222, 36, 222, 37, 18, 19, 254, 185, 253, 204, 18, 19, 252, 50, - 73, 18, 19, 252, 50, 72, 18, 19, 252, 50, 74, 18, 19, 252, 50, 60, 18, - 19, 252, 50, 218, 227, 18, 19, 252, 50, 218, 204, 18, 19, 252, 50, 218, - 187, 18, 19, 252, 50, 219, 7, 18, 19, 252, 50, 232, 141, 18, 19, 252, 50, - 232, 62, 18, 19, 252, 50, 231, 204, 18, 19, 252, 50, 208, 18, 19, 252, - 50, 236, 184, 18, 19, 252, 50, 236, 113, 18, 19, 252, 50, 236, 57, 18, - 19, 252, 50, 175, 18, 19, 226, 116, 243, 162, 18, 19, 226, 116, 243, 112, - 18, 19, 226, 116, 243, 4, 18, 19, 226, 116, 155, 18, 19, 64, 244, 109, - 18, 19, 64, 244, 112, 18, 19, 64, 244, 116, 18, 19, 64, 244, 115, 18, 19, - 64, 244, 113, 18, 19, 64, 244, 125, 18, 19, 64, 227, 22, 18, 19, 64, 227, - 75, 18, 19, 64, 227, 216, 18, 19, 64, 227, 200, 18, 19, 64, 227, 147, 18, - 19, 64, 203, 18, 19, 64, 218, 165, 18, 19, 64, 218, 187, 18, 19, 64, 218, - 227, 18, 19, 64, 218, 224, 18, 19, 64, 218, 204, 18, 19, 64, 219, 7, 18, - 19, 64, 242, 147, 18, 19, 64, 242, 148, 18, 19, 64, 242, 151, 18, 19, 64, - 242, 150, 18, 19, 64, 242, 149, 18, 19, 64, 242, 153, 18, 19, 64, 221, - 223, 18, 19, 64, 221, 239, 18, 19, 64, 222, 22, 18, 19, 64, 222, 21, 18, - 19, 64, 222, 2, 18, 19, 64, 222, 35, 18, 19, 64, 221, 3, 18, 19, 64, 221, - 11, 18, 19, 64, 221, 26, 18, 19, 64, 221, 25, 18, 19, 64, 221, 12, 18, - 19, 64, 221, 29, 18, 19, 64, 228, 202, 18, 19, 64, 229, 37, 18, 19, 64, - 229, 198, 18, 19, 64, 229, 191, 18, 19, 64, 229, 108, 18, 19, 64, 187, - 18, 19, 64, 230, 59, 18, 19, 64, 244, 17, 18, 19, 64, 244, 68, 18, 19, - 64, 244, 191, 18, 19, 64, 244, 184, 18, 19, 64, 244, 103, 18, 19, 64, - 245, 0, 18, 19, 64, 236, 120, 18, 19, 64, 236, 125, 18, 19, 64, 236, 137, - 18, 19, 64, 236, 136, 18, 19, 64, 236, 130, 18, 19, 64, 236, 149, 18, 19, - 64, 236, 69, 18, 19, 64, 236, 70, 18, 19, 64, 236, 73, 18, 19, 64, 236, - 72, 18, 19, 64, 236, 71, 18, 19, 64, 236, 74, 18, 19, 64, 236, 75, 18, - 19, 64, 231, 144, 18, 19, 64, 231, 204, 18, 19, 64, 232, 141, 18, 19, 64, - 232, 139, 18, 19, 64, 232, 62, 18, 19, 64, 208, 18, 19, 64, 233, 99, 18, - 19, 64, 233, 136, 18, 19, 64, 234, 25, 18, 19, 64, 234, 16, 18, 19, 64, - 233, 196, 18, 19, 64, 196, 18, 19, 64, 217, 200, 18, 19, 64, 217, 231, - 18, 19, 64, 218, 25, 18, 19, 64, 218, 22, 18, 19, 64, 217, 250, 18, 19, - 64, 184, 18, 19, 64, 237, 43, 18, 19, 226, 116, 237, 43, 18, 19, 64, 237, - 59, 18, 19, 64, 237, 114, 18, 19, 64, 237, 113, 18, 19, 64, 237, 98, 18, - 19, 226, 116, 237, 98, 18, 19, 64, 237, 123, 18, 19, 64, 237, 72, 18, 19, - 64, 237, 76, 18, 19, 64, 237, 86, 18, 19, 64, 237, 85, 18, 19, 64, 237, - 84, 18, 19, 64, 237, 87, 18, 19, 64, 234, 231, 18, 19, 64, 235, 12, 18, - 19, 64, 235, 122, 18, 19, 64, 235, 118, 18, 19, 64, 235, 67, 18, 19, 64, - 235, 188, 18, 19, 64, 248, 171, 18, 19, 64, 248, 172, 18, 19, 64, 248, - 175, 18, 19, 64, 248, 174, 18, 19, 64, 248, 173, 18, 19, 64, 248, 176, - 18, 19, 64, 235, 69, 18, 19, 64, 235, 71, 18, 19, 64, 235, 75, 18, 19, - 64, 235, 74, 18, 19, 64, 235, 73, 18, 19, 64, 235, 79, 18, 19, 64, 221, - 146, 18, 19, 64, 221, 148, 18, 19, 64, 221, 151, 18, 19, 64, 221, 150, - 18, 19, 64, 221, 149, 18, 19, 64, 221, 152, 18, 19, 64, 221, 142, 18, 19, - 64, 221, 143, 18, 19, 64, 221, 154, 18, 19, 64, 221, 153, 18, 19, 64, - 221, 144, 18, 19, 64, 221, 155, 18, 19, 64, 217, 13, 18, 19, 64, 217, 21, - 18, 19, 64, 217, 92, 18, 19, 64, 217, 90, 18, 19, 64, 217, 42, 18, 19, - 64, 217, 114, 18, 19, 64, 217, 157, 18, 19, 64, 66, 217, 157, 18, 19, 64, - 247, 65, 18, 19, 64, 247, 66, 18, 19, 64, 247, 73, 18, 19, 64, 247, 72, - 18, 19, 64, 247, 68, 18, 19, 64, 247, 74, 18, 19, 64, 223, 103, 18, 19, - 64, 224, 26, 18, 19, 64, 226, 94, 18, 19, 64, 226, 84, 18, 19, 64, 224, - 140, 18, 19, 64, 226, 177, 18, 19, 64, 224, 170, 18, 19, 64, 224, 200, - 18, 19, 64, 224, 246, 18, 19, 64, 224, 244, 18, 19, 64, 224, 221, 18, 19, - 64, 225, 25, 18, 19, 64, 225, 27, 18, 19, 64, 221, 36, 18, 19, 64, 221, - 38, 18, 19, 64, 221, 50, 18, 19, 64, 221, 49, 18, 19, 64, 221, 39, 18, - 19, 64, 221, 55, 18, 19, 64, 250, 253, 18, 19, 64, 251, 11, 18, 19, 64, - 251, 46, 18, 19, 64, 251, 43, 18, 19, 64, 251, 31, 18, 19, 64, 251, 69, - 18, 19, 64, 221, 5, 18, 19, 64, 221, 6, 18, 19, 64, 221, 9, 18, 19, 64, - 221, 8, 18, 19, 64, 221, 7, 18, 19, 64, 221, 10, 18, 19, 251, 32, 55, 18, - 19, 245, 90, 223, 136, 18, 19, 228, 147, 18, 19, 232, 112, 18, 19, 231, - 212, 18, 19, 231, 211, 18, 19, 231, 210, 18, 19, 231, 209, 18, 19, 231, - 214, 18, 19, 231, 213, 18, 19, 218, 178, 221, 213, 18, 19, 218, 178, 221, - 212, 18, 19, 218, 178, 221, 211, 18, 19, 218, 178, 221, 210, 18, 19, 218, - 178, 221, 209, 18, 19, 218, 178, 221, 216, 18, 19, 218, 178, 221, 215, - 18, 19, 218, 178, 39, 222, 37, 18, 19, 252, 50, 219, 40, 230, 164, 223, - 255, 78, 230, 164, 1, 252, 122, 230, 164, 1, 234, 222, 230, 164, 1, 245, - 230, 230, 164, 1, 226, 161, 230, 164, 1, 232, 25, 230, 164, 1, 220, 122, - 230, 164, 1, 249, 185, 230, 164, 1, 221, 173, 230, 164, 1, 250, 177, 230, - 164, 1, 251, 89, 230, 164, 1, 233, 91, 230, 164, 1, 244, 53, 230, 164, 1, - 232, 105, 230, 164, 1, 223, 131, 230, 164, 1, 227, 18, 230, 164, 1, 254, - 193, 230, 164, 1, 230, 131, 230, 164, 1, 220, 50, 230, 164, 1, 247, 14, - 230, 164, 1, 237, 165, 230, 164, 1, 247, 15, 230, 164, 1, 230, 105, 230, - 164, 1, 220, 103, 230, 164, 1, 238, 5, 230, 164, 1, 247, 12, 230, 164, 1, - 229, 184, 230, 164, 245, 229, 78, 230, 164, 210, 245, 229, 78, 157, 1, - 245, 220, 245, 212, 245, 232, 246, 74, 157, 1, 216, 216, 157, 1, 220, 36, - 220, 51, 68, 157, 1, 217, 202, 157, 1, 218, 90, 157, 1, 219, 40, 157, 1, - 221, 218, 221, 217, 221, 234, 157, 1, 246, 118, 157, 1, 254, 106, 60, - 157, 1, 230, 94, 74, 157, 1, 255, 3, 60, 157, 1, 254, 219, 157, 1, 234, - 254, 74, 157, 1, 224, 185, 74, 157, 1, 74, 157, 1, 230, 167, 157, 1, 230, - 138, 157, 1, 227, 244, 227, 253, 227, 195, 152, 157, 1, 236, 195, 157, 1, - 251, 87, 157, 1, 236, 196, 237, 17, 157, 1, 245, 67, 157, 1, 246, 185, - 157, 1, 244, 187, 243, 231, 245, 67, 157, 1, 244, 220, 157, 1, 218, 160, - 218, 155, 219, 40, 157, 1, 243, 203, 243, 225, 157, 1, 243, 207, 243, - 225, 157, 1, 235, 0, 243, 225, 157, 1, 224, 188, 243, 225, 157, 1, 232, - 203, 231, 74, 232, 204, 207, 157, 1, 224, 186, 207, 157, 1, 247, 140, - 157, 1, 237, 148, 237, 152, 237, 142, 72, 157, 1, 73, 157, 1, 237, 106, - 237, 126, 157, 1, 244, 173, 157, 1, 235, 1, 254, 234, 157, 1, 224, 190, - 60, 157, 1, 237, 135, 246, 164, 157, 1, 229, 155, 229, 173, 230, 59, 157, - 1, 254, 162, 246, 163, 157, 1, 224, 3, 198, 157, 1, 224, 129, 234, 253, - 198, 157, 1, 224, 184, 198, 157, 1, 251, 202, 157, 1, 217, 157, 157, 1, - 221, 159, 221, 166, 220, 190, 222, 201, 157, 1, 224, 183, 222, 201, 157, - 1, 250, 46, 157, 1, 252, 107, 252, 110, 252, 56, 253, 204, 157, 1, 224, - 189, 253, 204, 157, 1, 247, 139, 157, 1, 230, 115, 157, 1, 246, 238, 246, - 240, 73, 157, 1, 234, 81, 234, 87, 189, 157, 1, 234, 255, 189, 157, 1, - 224, 187, 189, 157, 1, 235, 136, 235, 171, 235, 4, 153, 157, 1, 247, 141, - 157, 1, 237, 203, 157, 1, 237, 204, 157, 1, 249, 196, 249, 201, 250, 46, - 157, 1, 230, 90, 246, 117, 74, 157, 1, 247, 11, 157, 1, 237, 164, 157, 1, - 250, 63, 157, 1, 251, 160, 157, 1, 251, 98, 157, 1, 223, 161, 157, 1, - 234, 252, 157, 1, 224, 182, 157, 1, 242, 64, 157, 1, 228, 163, 157, 1, - 218, 151, 157, 224, 109, 228, 196, 157, 233, 85, 228, 196, 157, 250, 101, - 228, 196, 157, 254, 33, 100, 157, 220, 227, 100, 157, 252, 121, 100, 222, - 140, 1, 60, 222, 140, 1, 72, 222, 140, 1, 68, 222, 140, 1, 175, 222, 140, - 1, 245, 0, 222, 140, 1, 232, 115, 222, 140, 1, 222, 155, 222, 140, 1, - 249, 207, 222, 140, 1, 208, 222, 140, 1, 187, 222, 140, 1, 252, 237, 222, - 140, 1, 196, 222, 140, 1, 184, 222, 140, 1, 235, 188, 222, 140, 1, 219, - 7, 222, 140, 1, 226, 177, 222, 140, 1, 155, 222, 140, 29, 5, 72, 222, - 140, 29, 5, 68, 222, 140, 5, 219, 82, 243, 184, 1, 60, 243, 184, 1, 72, - 243, 184, 1, 68, 243, 184, 1, 175, 243, 184, 1, 245, 0, 243, 184, 1, 232, - 115, 243, 184, 1, 222, 155, 243, 184, 1, 249, 207, 243, 184, 1, 208, 243, - 184, 1, 187, 243, 184, 1, 252, 237, 243, 184, 1, 196, 243, 184, 1, 184, - 243, 184, 1, 203, 243, 184, 1, 235, 188, 243, 184, 1, 219, 7, 243, 184, - 1, 226, 177, 243, 184, 1, 155, 243, 184, 29, 5, 72, 243, 184, 29, 5, 68, - 243, 184, 5, 230, 14, 229, 122, 224, 109, 228, 196, 229, 122, 51, 228, - 196, 251, 245, 1, 60, 251, 245, 1, 72, 251, 245, 1, 68, 251, 245, 1, 175, - 251, 245, 1, 245, 0, 251, 245, 1, 232, 115, 251, 245, 1, 222, 155, 251, - 245, 1, 249, 207, 251, 245, 1, 208, 251, 245, 1, 187, 251, 245, 1, 252, - 237, 251, 245, 1, 196, 251, 245, 1, 184, 251, 245, 1, 203, 251, 245, 1, - 235, 188, 251, 245, 1, 219, 7, 251, 245, 1, 226, 177, 251, 245, 1, 155, - 251, 245, 29, 5, 72, 251, 245, 29, 5, 68, 222, 139, 1, 60, 222, 139, 1, - 72, 222, 139, 1, 68, 222, 139, 1, 175, 222, 139, 1, 245, 0, 222, 139, 1, - 232, 115, 222, 139, 1, 222, 155, 222, 139, 1, 249, 207, 222, 139, 1, 208, - 222, 139, 1, 187, 222, 139, 1, 252, 237, 222, 139, 1, 196, 222, 139, 1, - 184, 222, 139, 1, 235, 188, 222, 139, 1, 219, 7, 222, 139, 1, 226, 177, - 222, 139, 29, 5, 72, 222, 139, 29, 5, 68, 79, 1, 175, 79, 1, 236, 149, - 79, 1, 236, 57, 79, 1, 236, 125, 79, 1, 232, 84, 79, 1, 251, 169, 79, 1, - 251, 69, 79, 1, 250, 182, 79, 1, 251, 11, 79, 1, 231, 56, 79, 1, 249, - 207, 79, 1, 221, 19, 79, 1, 248, 167, 79, 1, 221, 15, 79, 1, 231, 207, - 79, 1, 222, 155, 79, 1, 222, 35, 79, 1, 101, 79, 1, 221, 239, 79, 1, 231, - 204, 79, 1, 252, 237, 79, 1, 229, 141, 79, 1, 229, 37, 79, 1, 229, 118, - 79, 1, 233, 136, 79, 1, 217, 231, 79, 1, 227, 75, 79, 1, 235, 12, 79, 1, - 219, 72, 79, 1, 225, 25, 79, 1, 223, 182, 79, 1, 226, 177, 79, 1, 155, - 79, 1, 235, 188, 79, 1, 228, 155, 79, 237, 214, 29, 228, 141, 79, 237, - 214, 29, 228, 154, 79, 237, 214, 29, 228, 121, 79, 237, 214, 29, 228, - 116, 79, 237, 214, 29, 228, 98, 79, 237, 214, 29, 228, 73, 79, 237, 214, - 29, 228, 61, 79, 237, 214, 29, 228, 60, 79, 237, 214, 29, 226, 243, 79, - 237, 214, 29, 226, 236, 79, 237, 214, 29, 234, 198, 79, 237, 214, 29, - 234, 189, 79, 237, 214, 29, 228, 136, 79, 237, 214, 29, 228, 147, 79, - 237, 214, 29, 228, 106, 220, 198, 107, 79, 237, 214, 29, 228, 106, 220, - 198, 103, 79, 237, 214, 29, 228, 137, 79, 29, 237, 202, 254, 69, 79, 29, - 237, 202, 255, 58, 79, 29, 5, 255, 58, 79, 29, 5, 72, 79, 29, 5, 237, - 255, 79, 29, 5, 218, 90, 79, 29, 5, 217, 166, 79, 29, 5, 68, 79, 29, 5, - 220, 23, 79, 29, 5, 220, 123, 79, 29, 5, 230, 167, 79, 29, 5, 184, 79, - 29, 5, 238, 26, 79, 29, 5, 73, 79, 29, 5, 254, 234, 79, 29, 5, 254, 196, - 79, 29, 5, 230, 127, 79, 29, 5, 253, 232, 79, 5, 232, 37, 79, 5, 227, - 214, 79, 5, 217, 176, 79, 5, 233, 55, 79, 5, 221, 80, 79, 5, 252, 203, - 79, 5, 227, 71, 79, 5, 221, 138, 79, 5, 236, 239, 79, 5, 254, 198, 79, 5, - 226, 141, 226, 137, 79, 5, 219, 79, 79, 5, 250, 179, 79, 5, 252, 183, 79, - 5, 236, 142, 79, 5, 252, 199, 79, 5, 251, 156, 229, 77, 235, 239, 79, 5, - 235, 100, 221, 122, 79, 5, 252, 96, 79, 5, 229, 120, 233, 97, 79, 5, 236, - 40, 79, 250, 78, 16, 227, 142, 79, 5, 253, 218, 79, 5, 253, 235, 79, 20, - 217, 84, 79, 20, 107, 79, 20, 103, 79, 20, 160, 79, 20, 154, 79, 20, 174, - 79, 20, 182, 79, 20, 191, 79, 20, 185, 79, 20, 190, 79, 16, 235, 100, - 253, 237, 224, 16, 79, 16, 235, 100, 253, 237, 233, 72, 79, 16, 235, 100, - 253, 237, 229, 76, 79, 16, 235, 100, 253, 237, 252, 123, 79, 16, 235, - 100, 253, 237, 251, 233, 79, 16, 235, 100, 253, 237, 229, 1, 79, 16, 235, - 100, 253, 237, 228, 251, 79, 16, 235, 100, 253, 237, 228, 249, 79, 16, - 235, 100, 253, 237, 228, 255, 79, 16, 235, 100, 253, 237, 228, 253, 77, - 252, 66, 77, 246, 208, 77, 250, 168, 77, 245, 90, 223, 136, 77, 250, 175, - 77, 245, 116, 248, 143, 77, 221, 137, 224, 21, 242, 121, 77, 224, 139, 4, - 252, 26, 234, 63, 77, 234, 84, 250, 168, 77, 234, 84, 245, 90, 223, 136, - 77, 232, 23, 77, 245, 103, 41, 226, 74, 107, 77, 245, 103, 41, 226, 74, - 103, 77, 245, 103, 41, 226, 74, 160, 77, 29, 225, 54, 77, 20, 217, 84, - 77, 20, 107, 77, 20, 103, 77, 20, 160, 77, 20, 154, 77, 20, 174, 77, 20, - 182, 77, 20, 191, 77, 20, 185, 77, 20, 190, 77, 1, 60, 77, 1, 73, 77, 1, - 72, 77, 1, 74, 77, 1, 68, 77, 1, 230, 167, 77, 1, 220, 110, 77, 1, 246, - 250, 77, 1, 208, 77, 1, 254, 123, 77, 1, 252, 237, 77, 1, 187, 77, 1, - 228, 155, 77, 1, 245, 0, 77, 1, 196, 77, 1, 235, 188, 77, 1, 226, 177, - 77, 1, 225, 25, 77, 1, 222, 155, 77, 1, 249, 207, 77, 1, 251, 69, 77, 1, - 237, 123, 77, 1, 184, 77, 1, 203, 77, 1, 219, 7, 77, 1, 246, 8, 77, 1, - 175, 77, 1, 236, 149, 77, 1, 221, 55, 77, 1, 217, 114, 77, 1, 243, 211, - 77, 1, 217, 14, 77, 1, 235, 79, 77, 1, 217, 67, 77, 1, 251, 31, 77, 1, - 221, 137, 171, 29, 55, 77, 1, 221, 137, 73, 77, 1, 221, 137, 72, 77, 1, - 221, 137, 74, 77, 1, 221, 137, 68, 77, 1, 221, 137, 230, 167, 77, 1, 221, - 137, 220, 110, 77, 1, 221, 137, 254, 123, 77, 1, 221, 137, 252, 237, 77, - 1, 221, 137, 187, 77, 1, 221, 137, 228, 155, 77, 1, 221, 137, 245, 0, 77, - 1, 221, 137, 196, 77, 1, 221, 137, 222, 155, 77, 1, 221, 137, 249, 207, - 77, 1, 221, 137, 251, 69, 77, 1, 221, 137, 237, 123, 77, 1, 221, 137, - 221, 55, 77, 1, 221, 137, 184, 77, 1, 221, 137, 219, 7, 77, 1, 221, 137, - 175, 77, 1, 221, 137, 244, 253, 77, 1, 221, 137, 243, 211, 77, 1, 221, - 137, 237, 97, 77, 1, 221, 137, 232, 60, 77, 1, 221, 137, 247, 74, 77, 1, - 224, 139, 73, 77, 1, 224, 139, 72, 77, 1, 224, 139, 237, 133, 77, 1, 224, - 139, 220, 110, 77, 1, 224, 139, 68, 77, 1, 224, 139, 254, 123, 77, 1, - 224, 139, 175, 77, 1, 224, 139, 245, 0, 77, 1, 224, 139, 155, 77, 1, 224, - 139, 187, 77, 1, 224, 139, 225, 25, 77, 1, 224, 139, 222, 155, 77, 1, - 224, 139, 249, 207, 77, 1, 224, 139, 237, 123, 77, 1, 224, 139, 246, 8, - 77, 1, 224, 139, 244, 253, 77, 1, 224, 139, 243, 211, 77, 1, 224, 139, - 221, 55, 77, 1, 224, 139, 217, 114, 77, 1, 224, 139, 228, 0, 77, 1, 224, - 139, 251, 69, 77, 1, 224, 139, 217, 80, 77, 1, 234, 84, 72, 77, 1, 234, - 84, 175, 77, 1, 234, 84, 203, 77, 1, 234, 84, 246, 8, 77, 1, 234, 84, - 217, 80, 77, 1, 254, 161, 244, 238, 254, 96, 107, 77, 1, 254, 161, 244, - 238, 219, 78, 107, 77, 1, 254, 161, 244, 238, 249, 174, 77, 1, 254, 161, - 244, 238, 220, 120, 77, 1, 254, 161, 244, 238, 237, 170, 220, 120, 77, 1, - 254, 161, 244, 238, 252, 212, 77, 1, 254, 161, 244, 238, 148, 252, 212, - 77, 1, 254, 161, 244, 238, 60, 77, 1, 254, 161, 244, 238, 72, 77, 1, 254, - 161, 244, 238, 175, 77, 1, 254, 161, 244, 238, 232, 115, 77, 1, 254, 161, - 244, 238, 251, 169, 77, 1, 254, 161, 244, 238, 221, 29, 77, 1, 254, 161, - 244, 238, 221, 19, 77, 1, 254, 161, 244, 238, 249, 132, 77, 1, 254, 161, - 244, 238, 231, 217, 77, 1, 254, 161, 244, 238, 222, 155, 77, 1, 254, 161, - 244, 238, 249, 207, 77, 1, 254, 161, 244, 238, 187, 77, 1, 254, 161, 244, - 238, 229, 141, 77, 1, 254, 161, 244, 238, 223, 218, 77, 1, 254, 161, 244, - 238, 217, 80, 77, 1, 254, 161, 244, 238, 217, 114, 77, 1, 254, 161, 244, - 238, 254, 202, 77, 1, 221, 137, 254, 161, 244, 238, 222, 155, 77, 1, 221, - 137, 254, 161, 244, 238, 217, 80, 77, 1, 234, 84, 254, 161, 244, 238, - 244, 125, 77, 1, 234, 84, 254, 161, 244, 238, 232, 115, 77, 1, 234, 84, - 254, 161, 244, 238, 251, 169, 77, 1, 234, 84, 254, 161, 244, 238, 237, - 103, 77, 1, 234, 84, 254, 161, 244, 238, 221, 29, 77, 1, 234, 84, 254, - 161, 244, 238, 249, 116, 77, 1, 234, 84, 254, 161, 244, 238, 222, 155, - 77, 1, 234, 84, 254, 161, 244, 238, 249, 36, 77, 1, 234, 84, 254, 161, - 244, 238, 223, 218, 77, 1, 234, 84, 254, 161, 244, 238, 250, 57, 77, 1, - 234, 84, 254, 161, 244, 238, 217, 80, 77, 1, 234, 84, 254, 161, 244, 238, - 217, 114, 77, 1, 254, 161, 244, 238, 144, 68, 77, 1, 254, 161, 244, 238, - 144, 184, 77, 1, 234, 84, 254, 161, 244, 238, 252, 94, 77, 1, 254, 161, - 244, 238, 249, 197, 77, 1, 234, 84, 254, 161, 244, 238, 235, 79, 18, 19, - 230, 63, 18, 19, 253, 212, 18, 19, 255, 14, 18, 19, 218, 229, 18, 19, - 229, 7, 18, 19, 229, 205, 18, 19, 228, 172, 18, 19, 222, 96, 18, 19, 236, - 191, 18, 19, 235, 232, 18, 19, 234, 45, 18, 19, 231, 172, 18, 19, 232, - 199, 18, 19, 235, 132, 18, 19, 224, 1, 18, 19, 226, 118, 18, 19, 224, - 175, 18, 19, 224, 249, 18, 19, 224, 150, 18, 19, 217, 208, 18, 19, 218, - 30, 18, 19, 227, 222, 18, 19, 231, 82, 18, 19, 230, 155, 231, 82, 18, 19, - 231, 81, 18, 19, 230, 155, 231, 81, 18, 19, 231, 80, 18, 19, 230, 155, - 231, 80, 18, 19, 231, 79, 18, 19, 230, 155, 231, 79, 18, 19, 226, 248, - 18, 19, 226, 247, 18, 19, 226, 246, 18, 19, 226, 245, 18, 19, 226, 244, - 18, 19, 226, 252, 18, 19, 230, 155, 230, 59, 18, 19, 230, 155, 222, 201, - 18, 19, 230, 155, 237, 17, 18, 19, 230, 155, 251, 202, 18, 19, 230, 155, - 189, 18, 19, 230, 155, 207, 18, 19, 230, 155, 198, 18, 19, 230, 155, 225, - 27, 18, 19, 247, 4, 219, 40, 18, 19, 218, 215, 219, 40, 18, 19, 39, 3, - 227, 93, 18, 19, 39, 227, 241, 248, 145, 18, 19, 228, 38, 226, 249, 18, - 19, 137, 234, 248, 18, 19, 137, 235, 187, 18, 19, 221, 214, 18, 19, 221, - 216, 18, 19, 221, 13, 18, 19, 221, 14, 18, 19, 221, 18, 18, 19, 221, 145, - 18, 19, 221, 147, 18, 19, 226, 116, 224, 155, 18, 19, 226, 116, 224, 195, - 18, 19, 226, 116, 242, 248, 18, 19, 64, 243, 238, 18, 19, 64, 249, 60, - 244, 184, 18, 19, 64, 244, 253, 18, 19, 64, 243, 243, 18, 19, 226, 116, - 237, 27, 18, 19, 64, 237, 25, 18, 19, 252, 139, 249, 60, 153, 18, 19, - 252, 139, 249, 60, 152, 18, 19, 64, 249, 55, 198, 195, 219, 59, 235, 84, - 195, 1, 175, 195, 1, 236, 149, 195, 1, 245, 0, 195, 1, 244, 125, 195, 1, - 232, 115, 195, 1, 251, 169, 195, 1, 251, 69, 195, 1, 237, 123, 195, 1, - 237, 103, 195, 1, 218, 47, 195, 1, 222, 155, 195, 1, 222, 35, 195, 1, - 249, 207, 195, 1, 249, 36, 195, 1, 208, 195, 1, 187, 195, 1, 229, 141, - 195, 1, 252, 237, 195, 1, 252, 94, 195, 1, 196, 195, 1, 184, 195, 1, 203, - 195, 1, 235, 188, 195, 1, 219, 7, 195, 1, 225, 25, 195, 1, 223, 218, 195, - 1, 226, 177, 195, 1, 155, 195, 29, 5, 60, 195, 29, 5, 72, 195, 29, 5, 68, - 195, 29, 5, 246, 250, 195, 29, 5, 254, 196, 195, 29, 5, 230, 127, 195, - 29, 5, 253, 232, 195, 29, 5, 73, 195, 29, 5, 74, 195, 223, 97, 1, 184, - 195, 223, 97, 1, 203, 195, 223, 97, 1, 219, 7, 195, 3, 1, 175, 195, 3, 1, - 232, 115, 195, 3, 1, 254, 95, 195, 3, 1, 222, 155, 195, 3, 1, 208, 195, - 3, 1, 187, 195, 3, 1, 196, 195, 3, 1, 203, 195, 3, 1, 235, 188, 195, 5, - 233, 89, 195, 5, 236, 173, 195, 5, 226, 176, 195, 5, 234, 248, 195, 246, - 95, 78, 195, 228, 82, 78, 195, 20, 217, 84, 195, 20, 107, 195, 20, 103, - 195, 20, 160, 195, 20, 154, 195, 20, 174, 195, 20, 182, 195, 20, 191, - 195, 20, 185, 195, 20, 190, 37, 235, 123, 1, 175, 37, 235, 123, 1, 218, - 138, 37, 235, 123, 1, 232, 115, 37, 235, 123, 1, 221, 55, 37, 235, 123, - 1, 226, 177, 37, 235, 123, 1, 184, 37, 235, 123, 1, 222, 155, 37, 235, - 123, 1, 222, 35, 37, 235, 123, 1, 235, 188, 37, 235, 123, 1, 187, 37, - 235, 123, 1, 229, 141, 37, 235, 123, 1, 196, 37, 235, 123, 1, 246, 8, 37, - 235, 123, 1, 219, 189, 37, 235, 123, 1, 155, 37, 235, 123, 1, 228, 155, - 37, 235, 123, 1, 236, 149, 37, 235, 123, 1, 221, 47, 37, 235, 123, 1, - 208, 37, 235, 123, 1, 60, 37, 235, 123, 1, 72, 37, 235, 123, 1, 246, 250, - 37, 235, 123, 1, 246, 239, 37, 235, 123, 1, 68, 37, 235, 123, 1, 230, - 127, 37, 235, 123, 1, 74, 37, 235, 123, 1, 220, 110, 37, 235, 123, 1, 73, - 37, 235, 123, 1, 253, 231, 37, 235, 123, 1, 254, 196, 37, 235, 123, 1, - 221, 130, 37, 235, 123, 1, 221, 129, 37, 235, 123, 1, 221, 128, 37, 235, - 123, 1, 221, 127, 37, 235, 123, 1, 221, 126, 146, 37, 151, 1, 116, 228, - 155, 146, 37, 151, 1, 109, 228, 155, 146, 37, 151, 1, 116, 175, 146, 37, - 151, 1, 116, 218, 138, 146, 37, 151, 1, 116, 232, 115, 146, 37, 151, 1, - 109, 175, 146, 37, 151, 1, 109, 218, 138, 146, 37, 151, 1, 109, 232, 115, - 146, 37, 151, 1, 116, 221, 55, 146, 37, 151, 1, 116, 226, 177, 146, 37, - 151, 1, 116, 184, 146, 37, 151, 1, 109, 221, 55, 146, 37, 151, 1, 109, - 226, 177, 146, 37, 151, 1, 109, 184, 146, 37, 151, 1, 116, 222, 155, 146, - 37, 151, 1, 116, 222, 35, 146, 37, 151, 1, 116, 208, 146, 37, 151, 1, - 109, 222, 155, 146, 37, 151, 1, 109, 222, 35, 146, 37, 151, 1, 109, 208, - 146, 37, 151, 1, 116, 187, 146, 37, 151, 1, 116, 229, 141, 146, 37, 151, - 1, 116, 196, 146, 37, 151, 1, 109, 187, 146, 37, 151, 1, 109, 229, 141, - 146, 37, 151, 1, 109, 196, 146, 37, 151, 1, 116, 246, 8, 146, 37, 151, 1, - 116, 219, 189, 146, 37, 151, 1, 116, 235, 188, 146, 37, 151, 1, 109, 246, - 8, 146, 37, 151, 1, 109, 219, 189, 146, 37, 151, 1, 109, 235, 188, 146, - 37, 151, 1, 116, 155, 146, 37, 151, 1, 116, 249, 207, 146, 37, 151, 1, - 116, 252, 237, 146, 37, 151, 1, 109, 155, 146, 37, 151, 1, 109, 249, 207, - 146, 37, 151, 1, 109, 252, 237, 146, 37, 151, 1, 116, 235, 236, 146, 37, - 151, 1, 116, 218, 111, 146, 37, 151, 1, 109, 235, 236, 146, 37, 151, 1, - 109, 218, 111, 146, 37, 151, 1, 116, 223, 102, 146, 37, 151, 1, 109, 223, - 102, 146, 37, 151, 29, 5, 29, 224, 181, 146, 37, 151, 29, 5, 255, 58, - 146, 37, 151, 29, 5, 237, 255, 146, 37, 151, 29, 5, 68, 146, 37, 151, 29, - 5, 220, 23, 146, 37, 151, 29, 5, 73, 146, 37, 151, 29, 5, 254, 234, 146, - 37, 151, 29, 5, 74, 146, 37, 151, 29, 5, 230, 185, 146, 37, 151, 29, 5, - 220, 110, 146, 37, 151, 29, 5, 253, 212, 146, 37, 151, 29, 5, 255, 14, - 146, 37, 151, 29, 5, 220, 16, 146, 37, 151, 29, 5, 230, 63, 146, 37, 151, - 29, 5, 230, 182, 146, 37, 151, 29, 5, 220, 107, 146, 37, 151, 29, 5, 237, - 133, 146, 37, 151, 1, 39, 216, 216, 146, 37, 151, 1, 39, 232, 117, 146, - 37, 151, 1, 39, 207, 146, 37, 151, 1, 39, 189, 146, 37, 151, 1, 39, 237, - 17, 146, 37, 151, 1, 39, 250, 46, 146, 37, 151, 1, 39, 253, 204, 146, 37, - 151, 145, 234, 67, 146, 37, 151, 145, 234, 66, 146, 37, 151, 20, 217, 84, - 146, 37, 151, 20, 107, 146, 37, 151, 20, 103, 146, 37, 151, 20, 160, 146, - 37, 151, 20, 154, 146, 37, 151, 20, 174, 146, 37, 151, 20, 182, 146, 37, - 151, 20, 191, 146, 37, 151, 20, 185, 146, 37, 151, 20, 190, 146, 37, 151, - 83, 20, 107, 146, 37, 151, 5, 235, 177, 146, 37, 151, 5, 235, 176, 79, - 16, 229, 211, 79, 16, 233, 73, 236, 55, 79, 16, 229, 77, 236, 55, 79, 16, - 252, 124, 236, 55, 79, 16, 251, 234, 236, 55, 79, 16, 229, 2, 236, 55, - 79, 16, 228, 252, 236, 55, 79, 16, 228, 250, 236, 55, 79, 16, 229, 0, - 236, 55, 79, 16, 228, 254, 236, 55, 79, 16, 249, 163, 236, 55, 79, 16, - 249, 159, 236, 55, 79, 16, 249, 158, 236, 55, 79, 16, 249, 161, 236, 55, - 79, 16, 249, 160, 236, 55, 79, 16, 249, 157, 236, 55, 79, 16, 220, 230, - 79, 16, 233, 73, 227, 70, 79, 16, 229, 77, 227, 70, 79, 16, 252, 124, - 227, 70, 79, 16, 251, 234, 227, 70, 79, 16, 229, 2, 227, 70, 79, 16, 228, - 252, 227, 70, 79, 16, 228, 250, 227, 70, 79, 16, 229, 0, 227, 70, 79, 16, - 228, 254, 227, 70, 79, 16, 249, 163, 227, 70, 79, 16, 249, 159, 227, 70, - 79, 16, 249, 158, 227, 70, 79, 16, 249, 161, 227, 70, 79, 16, 249, 160, - 227, 70, 79, 16, 249, 157, 227, 70, 251, 246, 1, 175, 251, 246, 1, 245, - 0, 251, 246, 1, 232, 115, 251, 246, 1, 232, 87, 251, 246, 1, 187, 251, - 246, 1, 252, 237, 251, 246, 1, 196, 251, 246, 1, 233, 102, 251, 246, 1, - 222, 155, 251, 246, 1, 249, 207, 251, 246, 1, 208, 251, 246, 1, 231, 171, - 251, 246, 1, 251, 169, 251, 246, 1, 237, 123, 251, 246, 1, 231, 77, 251, - 246, 1, 231, 75, 251, 246, 1, 184, 251, 246, 1, 203, 251, 246, 1, 235, - 188, 251, 246, 1, 219, 189, 251, 246, 1, 226, 177, 251, 246, 1, 60, 251, - 246, 1, 155, 251, 246, 29, 5, 72, 251, 246, 29, 5, 68, 251, 246, 29, 5, - 73, 251, 246, 29, 5, 74, 251, 246, 29, 5, 254, 234, 251, 246, 230, 24, - 251, 246, 246, 190, 117, 226, 86, 37, 83, 1, 116, 175, 37, 83, 1, 116, - 236, 149, 37, 83, 1, 116, 235, 224, 37, 83, 1, 109, 175, 37, 83, 1, 109, - 235, 224, 37, 83, 1, 109, 236, 149, 37, 83, 1, 232, 115, 37, 83, 1, 116, - 251, 169, 37, 83, 1, 116, 251, 69, 37, 83, 1, 109, 251, 169, 37, 83, 1, - 109, 226, 177, 37, 83, 1, 109, 251, 69, 37, 83, 1, 231, 77, 37, 83, 1, - 227, 227, 37, 83, 1, 116, 227, 225, 37, 83, 1, 249, 207, 37, 83, 1, 109, - 227, 225, 37, 83, 1, 227, 235, 37, 83, 1, 116, 222, 155, 37, 83, 1, 116, - 222, 35, 37, 83, 1, 109, 222, 155, 37, 83, 1, 109, 222, 35, 37, 83, 1, - 208, 37, 83, 1, 252, 237, 37, 83, 1, 116, 187, 37, 83, 1, 116, 229, 141, - 37, 83, 1, 116, 246, 8, 37, 83, 1, 109, 187, 37, 83, 1, 109, 246, 8, 37, - 83, 1, 109, 229, 141, 37, 83, 1, 196, 37, 83, 1, 109, 184, 37, 83, 1, - 116, 184, 37, 83, 1, 203, 37, 83, 1, 227, 19, 37, 83, 1, 235, 188, 37, - 83, 1, 234, 227, 37, 83, 1, 219, 7, 37, 83, 1, 116, 225, 25, 37, 83, 1, - 116, 223, 218, 37, 83, 1, 116, 226, 177, 37, 83, 1, 116, 155, 37, 83, 1, - 235, 17, 37, 83, 1, 60, 37, 83, 1, 109, 155, 37, 83, 1, 72, 37, 83, 1, - 237, 255, 37, 83, 1, 68, 37, 83, 1, 220, 23, 37, 83, 1, 246, 250, 37, 83, - 1, 230, 127, 37, 83, 1, 235, 177, 37, 83, 1, 244, 32, 226, 177, 37, 83, - 250, 147, 5, 128, 203, 37, 83, 250, 147, 5, 128, 235, 188, 37, 83, 250, - 147, 5, 235, 189, 222, 118, 235, 167, 37, 83, 5, 234, 100, 236, 230, 235, - 167, 37, 83, 250, 147, 5, 39, 232, 115, 37, 83, 250, 147, 5, 109, 187, - 37, 83, 250, 147, 5, 116, 227, 226, 156, 109, 187, 37, 83, 250, 147, 5, - 196, 37, 83, 250, 147, 5, 252, 237, 37, 83, 250, 147, 5, 226, 177, 37, - 83, 5, 226, 158, 37, 83, 29, 5, 60, 37, 83, 29, 5, 234, 100, 226, 127, - 37, 83, 29, 5, 255, 58, 37, 83, 29, 5, 222, 123, 255, 58, 37, 83, 29, 5, - 72, 37, 83, 29, 5, 237, 255, 37, 83, 29, 5, 220, 110, 37, 83, 29, 5, 220, - 22, 37, 83, 29, 5, 68, 37, 83, 29, 5, 220, 23, 37, 83, 29, 5, 74, 37, 83, - 29, 5, 230, 186, 56, 37, 83, 29, 5, 230, 63, 37, 83, 29, 5, 73, 37, 83, - 29, 5, 254, 234, 37, 83, 29, 5, 230, 127, 37, 83, 29, 5, 254, 196, 37, - 83, 29, 5, 83, 254, 196, 37, 83, 29, 5, 230, 186, 50, 37, 83, 5, 234, - 100, 236, 229, 37, 83, 5, 221, 131, 37, 83, 5, 221, 130, 37, 83, 5, 236, - 118, 221, 129, 37, 83, 5, 236, 118, 221, 128, 37, 83, 5, 236, 118, 221, - 127, 37, 83, 5, 228, 3, 243, 210, 37, 83, 5, 234, 100, 226, 148, 37, 83, - 5, 236, 117, 236, 215, 37, 83, 36, 250, 93, 248, 145, 37, 83, 242, 243, - 20, 217, 84, 37, 83, 242, 243, 20, 107, 37, 83, 242, 243, 20, 103, 37, - 83, 242, 243, 20, 160, 37, 83, 242, 243, 20, 154, 37, 83, 242, 243, 20, - 174, 37, 83, 242, 243, 20, 182, 37, 83, 242, 243, 20, 191, 37, 83, 242, - 243, 20, 185, 37, 83, 242, 243, 20, 190, 37, 83, 83, 20, 217, 84, 37, 83, - 83, 20, 107, 37, 83, 83, 20, 103, 37, 83, 83, 20, 160, 37, 83, 83, 20, - 154, 37, 83, 83, 20, 174, 37, 83, 83, 20, 182, 37, 83, 83, 20, 191, 37, - 83, 83, 20, 185, 37, 83, 83, 20, 190, 37, 83, 5, 218, 203, 37, 83, 5, - 218, 202, 37, 83, 5, 226, 121, 37, 83, 5, 236, 163, 37, 83, 5, 242, 180, - 37, 83, 5, 248, 157, 37, 83, 5, 210, 227, 59, 227, 235, 37, 83, 5, 234, - 100, 218, 48, 37, 83, 5, 237, 1, 37, 83, 5, 237, 0, 37, 83, 5, 226, 126, - 37, 83, 5, 226, 125, 37, 83, 5, 243, 186, 37, 83, 5, 251, 166, 94, 5, - 220, 97, 227, 144, 94, 5, 220, 97, 251, 148, 94, 5, 251, 95, 94, 5, 223, - 51, 94, 5, 252, 64, 94, 1, 254, 180, 94, 1, 254, 181, 222, 82, 94, 1, - 237, 251, 94, 1, 237, 252, 222, 82, 94, 1, 220, 100, 94, 1, 220, 101, - 222, 82, 94, 1, 228, 3, 227, 183, 94, 1, 228, 3, 227, 184, 222, 82, 94, - 1, 235, 189, 235, 95, 94, 1, 235, 189, 235, 96, 222, 82, 94, 1, 246, 222, - 94, 1, 254, 194, 94, 1, 230, 153, 94, 1, 230, 154, 222, 82, 94, 1, 175, - 94, 1, 206, 234, 103, 94, 1, 245, 0, 94, 1, 245, 1, 244, 58, 94, 1, 232, - 115, 94, 1, 251, 169, 94, 1, 251, 170, 235, 179, 94, 1, 237, 123, 94, 1, - 237, 124, 237, 107, 94, 1, 231, 77, 94, 1, 222, 156, 235, 138, 94, 1, - 222, 156, 233, 68, 234, 103, 94, 1, 249, 208, 233, 68, 254, 148, 94, 1, - 249, 208, 233, 68, 234, 103, 94, 1, 232, 238, 227, 238, 94, 1, 222, 155, - 94, 1, 222, 156, 222, 99, 94, 1, 249, 207, 94, 1, 249, 208, 234, 108, 94, - 1, 208, 94, 1, 187, 94, 1, 230, 44, 236, 225, 94, 1, 252, 237, 94, 1, - 252, 238, 236, 174, 94, 1, 196, 94, 1, 184, 94, 1, 203, 94, 1, 235, 188, - 94, 1, 219, 7, 94, 1, 226, 178, 226, 164, 94, 1, 226, 178, 226, 132, 94, - 1, 226, 177, 94, 1, 155, 94, 5, 227, 177, 94, 29, 5, 222, 82, 94, 29, 5, - 220, 96, 94, 29, 5, 220, 97, 226, 129, 94, 29, 5, 223, 77, 94, 29, 5, - 223, 78, 237, 243, 94, 29, 5, 228, 3, 227, 183, 94, 29, 5, 228, 3, 227, - 184, 222, 82, 94, 29, 5, 235, 189, 235, 95, 94, 29, 5, 235, 189, 235, 96, - 222, 82, 94, 29, 5, 222, 124, 94, 29, 5, 222, 125, 227, 183, 94, 29, 5, - 222, 125, 222, 82, 94, 29, 5, 222, 125, 227, 184, 222, 82, 94, 29, 5, - 229, 171, 94, 29, 5, 229, 172, 222, 82, 94, 254, 240, 254, 239, 94, 1, - 236, 247, 226, 128, 94, 1, 236, 122, 226, 128, 94, 1, 220, 183, 226, 128, - 94, 1, 246, 245, 226, 128, 94, 1, 219, 166, 226, 128, 94, 1, 217, 105, - 226, 128, 94, 1, 253, 246, 226, 128, 94, 20, 217, 84, 94, 20, 107, 94, - 20, 103, 94, 20, 160, 94, 20, 154, 94, 20, 174, 94, 20, 182, 94, 20, 191, - 94, 20, 185, 94, 20, 190, 94, 229, 254, 94, 230, 19, 94, 218, 193, 94, - 251, 132, 230, 13, 94, 251, 132, 224, 122, 94, 251, 132, 229, 228, 94, - 230, 18, 94, 26, 16, 248, 151, 94, 26, 16, 249, 59, 94, 26, 16, 247, 97, - 94, 26, 16, 249, 165, 94, 26, 16, 249, 166, 223, 51, 94, 26, 16, 248, - 218, 94, 26, 16, 249, 200, 94, 26, 16, 249, 44, 94, 26, 16, 249, 186, 94, - 26, 16, 249, 166, 244, 186, 94, 26, 16, 36, 222, 79, 94, 26, 16, 36, 246, - 188, 94, 26, 16, 36, 236, 169, 94, 26, 16, 36, 236, 171, 94, 26, 16, 36, - 237, 111, 94, 26, 16, 36, 236, 170, 2, 237, 111, 94, 26, 16, 36, 236, - 172, 2, 237, 111, 94, 26, 16, 36, 252, 112, 94, 26, 16, 36, 244, 61, 94, - 26, 16, 227, 107, 230, 119, 247, 107, 94, 26, 16, 227, 107, 230, 119, - 249, 198, 94, 26, 16, 227, 107, 250, 197, 220, 251, 94, 26, 16, 227, 107, - 250, 197, 222, 131, 94, 26, 16, 235, 113, 230, 119, 230, 9, 94, 26, 16, - 235, 113, 230, 119, 228, 195, 94, 26, 16, 235, 113, 250, 197, 229, 54, - 94, 26, 16, 235, 113, 250, 197, 229, 46, 94, 26, 16, 235, 113, 230, 119, - 229, 72, 223, 67, 5, 229, 251, 223, 67, 5, 230, 5, 223, 67, 5, 230, 3, - 223, 67, 1, 60, 223, 67, 1, 72, 223, 67, 1, 68, 223, 67, 1, 254, 234, - 223, 67, 1, 74, 223, 67, 1, 73, 223, 67, 1, 246, 115, 223, 67, 1, 175, - 223, 67, 1, 228, 155, 223, 67, 1, 245, 0, 223, 67, 1, 232, 115, 223, 67, - 1, 251, 169, 223, 67, 1, 237, 123, 223, 67, 1, 217, 114, 223, 67, 1, 231, - 77, 223, 67, 1, 222, 155, 223, 67, 1, 249, 207, 223, 67, 1, 208, 223, 67, - 1, 187, 223, 67, 1, 246, 8, 223, 67, 1, 219, 189, 223, 67, 1, 252, 237, - 223, 67, 1, 196, 223, 67, 1, 184, 223, 67, 1, 203, 223, 67, 1, 235, 188, - 223, 67, 1, 219, 7, 223, 67, 1, 226, 177, 223, 67, 1, 218, 138, 223, 67, - 1, 155, 223, 67, 250, 147, 5, 230, 16, 223, 67, 250, 147, 5, 229, 253, - 223, 67, 250, 147, 5, 229, 250, 223, 67, 29, 5, 230, 8, 223, 67, 29, 5, - 229, 249, 223, 67, 29, 5, 230, 11, 223, 67, 29, 5, 230, 2, 223, 67, 29, - 5, 230, 17, 223, 67, 29, 5, 230, 10, 223, 67, 5, 230, 20, 223, 67, 1, - 236, 149, 223, 67, 1, 223, 20, 223, 67, 20, 217, 84, 223, 67, 20, 107, - 223, 67, 20, 103, 223, 67, 20, 160, 223, 67, 20, 154, 223, 67, 20, 174, - 223, 67, 20, 182, 223, 67, 20, 191, 223, 67, 20, 185, 223, 67, 20, 190, - 169, 1, 175, 169, 1, 236, 67, 169, 1, 236, 149, 169, 1, 245, 0, 169, 1, - 244, 77, 169, 1, 232, 115, 169, 1, 251, 169, 169, 1, 251, 69, 169, 1, - 237, 123, 169, 1, 231, 77, 169, 1, 222, 155, 169, 1, 222, 35, 169, 1, - 249, 207, 169, 1, 208, 169, 1, 187, 169, 1, 229, 58, 169, 1, 229, 141, - 169, 1, 246, 8, 169, 1, 245, 165, 169, 1, 252, 237, 169, 1, 252, 54, 169, - 1, 196, 169, 1, 233, 142, 169, 1, 221, 55, 169, 1, 221, 47, 169, 1, 247, - 74, 169, 1, 184, 169, 1, 203, 169, 1, 235, 188, 169, 1, 155, 169, 1, 243, - 89, 169, 1, 219, 189, 169, 1, 226, 177, 169, 1, 225, 25, 169, 1, 219, 7, - 169, 1, 60, 169, 223, 97, 1, 184, 169, 223, 97, 1, 203, 169, 29, 5, 255, - 58, 169, 29, 5, 72, 169, 29, 5, 74, 169, 29, 5, 230, 127, 169, 29, 5, 68, - 169, 29, 5, 220, 23, 169, 29, 5, 73, 169, 250, 147, 5, 237, 17, 169, 250, - 147, 5, 189, 169, 250, 147, 5, 153, 169, 250, 147, 5, 207, 169, 250, 147, - 5, 230, 59, 169, 250, 147, 5, 152, 169, 250, 147, 5, 222, 201, 169, 250, - 147, 5, 231, 62, 169, 250, 147, 5, 236, 229, 169, 5, 227, 236, 169, 5, - 231, 112, 169, 228, 197, 222, 154, 169, 228, 197, 231, 69, 221, 208, 222, - 154, 169, 228, 197, 251, 74, 169, 228, 197, 221, 42, 251, 74, 169, 228, - 197, 221, 41, 169, 20, 217, 84, 169, 20, 107, 169, 20, 103, 169, 20, 160, - 169, 20, 154, 169, 20, 174, 169, 20, 182, 169, 20, 191, 169, 20, 185, - 169, 20, 190, 169, 1, 221, 29, 169, 1, 221, 19, 169, 1, 249, 132, 230, - 151, 251, 26, 20, 217, 84, 230, 151, 251, 26, 20, 107, 230, 151, 251, 26, - 20, 103, 230, 151, 251, 26, 20, 160, 230, 151, 251, 26, 20, 154, 230, - 151, 251, 26, 20, 174, 230, 151, 251, 26, 20, 182, 230, 151, 251, 26, 20, - 191, 230, 151, 251, 26, 20, 185, 230, 151, 251, 26, 20, 190, 230, 151, - 251, 26, 1, 235, 188, 230, 151, 251, 26, 1, 253, 244, 230, 151, 251, 26, - 1, 254, 209, 230, 151, 251, 26, 1, 254, 123, 230, 151, 251, 26, 1, 254, - 175, 230, 151, 251, 26, 1, 235, 187, 230, 151, 251, 26, 1, 255, 20, 230, - 151, 251, 26, 1, 255, 21, 230, 151, 251, 26, 1, 255, 19, 230, 151, 251, - 26, 1, 255, 15, 230, 151, 251, 26, 1, 235, 67, 230, 151, 251, 26, 1, 237, - 151, 230, 151, 251, 26, 1, 238, 0, 230, 151, 251, 26, 1, 237, 167, 230, - 151, 251, 26, 1, 237, 156, 230, 151, 251, 26, 1, 234, 231, 230, 151, 251, - 26, 1, 220, 117, 230, 151, 251, 26, 1, 220, 115, 230, 151, 251, 26, 1, - 220, 68, 230, 151, 251, 26, 1, 220, 16, 230, 151, 251, 26, 1, 235, 122, - 230, 151, 251, 26, 1, 246, 162, 230, 151, 251, 26, 1, 246, 253, 230, 151, - 251, 26, 1, 246, 197, 230, 151, 251, 26, 1, 246, 142, 230, 151, 251, 26, - 1, 235, 12, 230, 151, 251, 26, 1, 230, 89, 230, 151, 251, 26, 1, 230, - 181, 230, 151, 251, 26, 1, 230, 79, 230, 151, 251, 26, 1, 230, 161, 230, - 151, 251, 26, 233, 100, 221, 1, 230, 151, 251, 26, 244, 251, 221, 2, 230, - 151, 251, 26, 233, 98, 221, 2, 230, 151, 251, 26, 227, 193, 230, 151, - 251, 26, 229, 139, 230, 151, 251, 26, 254, 201, 230, 151, 251, 26, 228, - 197, 233, 96, 230, 151, 251, 26, 228, 197, 51, 233, 96, 219, 162, 145, - 236, 211, 219, 162, 145, 225, 2, 219, 162, 145, 228, 241, 219, 162, 5, - 232, 39, 219, 162, 5, 218, 56, 233, 191, 223, 39, 219, 162, 145, 218, 56, - 254, 206, 237, 214, 223, 39, 219, 162, 145, 218, 56, 237, 214, 223, 39, - 219, 162, 145, 218, 56, 236, 199, 237, 214, 223, 39, 219, 162, 145, 251, - 149, 56, 219, 162, 145, 218, 56, 236, 199, 237, 214, 223, 40, 226, 106, - 219, 162, 145, 51, 223, 39, 219, 162, 145, 221, 78, 223, 39, 219, 162, - 145, 236, 199, 254, 97, 219, 162, 145, 61, 56, 219, 162, 145, 124, 188, - 56, 219, 162, 145, 148, 188, 56, 219, 162, 145, 227, 99, 236, 210, 237, - 214, 223, 39, 219, 162, 145, 253, 242, 237, 214, 223, 39, 219, 162, 5, - 219, 78, 223, 39, 219, 162, 5, 219, 78, 220, 112, 219, 162, 5, 210, 219, - 78, 220, 112, 219, 162, 5, 219, 78, 254, 97, 219, 162, 5, 210, 219, 78, - 254, 97, 219, 162, 5, 219, 78, 220, 113, 2, 222, 135, 219, 162, 5, 219, - 78, 254, 98, 2, 222, 135, 219, 162, 5, 254, 96, 254, 105, 219, 162, 5, - 254, 96, 252, 222, 219, 162, 5, 254, 96, 219, 184, 219, 162, 5, 254, 96, - 219, 185, 2, 222, 135, 219, 162, 5, 221, 162, 219, 162, 5, 243, 123, 171, - 254, 95, 219, 162, 5, 171, 254, 95, 219, 162, 5, 227, 24, 171, 254, 95, - 219, 162, 5, 254, 96, 220, 119, 233, 90, 219, 162, 5, 254, 46, 7, 1, 3, - 6, 60, 7, 1, 3, 6, 254, 234, 7, 3, 1, 215, 254, 234, 7, 1, 3, 6, 252, - 196, 253, 204, 7, 1, 3, 6, 251, 202, 7, 1, 3, 6, 250, 46, 7, 1, 3, 6, - 246, 118, 7, 1, 3, 6, 73, 7, 3, 1, 215, 230, 119, 73, 7, 3, 1, 215, 72, - 7, 1, 3, 6, 237, 126, 7, 1, 3, 6, 237, 17, 7, 1, 3, 6, 235, 202, 2, 92, - 7, 1, 3, 6, 189, 7, 1, 3, 6, 210, 207, 7, 1, 3, 6, 74, 7, 1, 3, 6, 230, - 119, 74, 7, 3, 1, 224, 136, 74, 7, 3, 1, 224, 136, 230, 119, 74, 7, 3, 1, - 224, 136, 142, 2, 92, 7, 3, 1, 215, 230, 167, 7, 1, 3, 6, 230, 86, 7, 3, - 1, 221, 120, 144, 74, 7, 3, 1, 252, 29, 144, 74, 7, 1, 3, 6, 230, 59, 7, - 1, 3, 6, 210, 152, 7, 1, 3, 6, 215, 152, 7, 1, 3, 6, 222, 201, 7, 1, 3, - 6, 68, 7, 3, 1, 224, 136, 68, 7, 3, 1, 224, 136, 249, 12, 68, 7, 3, 1, - 224, 136, 215, 189, 7, 1, 3, 6, 216, 216, 7, 1, 3, 6, 219, 40, 7, 1, 3, - 6, 217, 157, 7, 1, 3, 6, 246, 76, 7, 1, 219, 70, 235, 144, 223, 241, 7, - 1, 254, 191, 23, 1, 3, 6, 244, 231, 23, 1, 3, 6, 235, 156, 23, 1, 3, 6, - 229, 108, 23, 1, 3, 6, 227, 149, 23, 1, 3, 6, 228, 212, 31, 1, 3, 6, 246, - 217, 58, 1, 6, 60, 58, 1, 6, 254, 234, 58, 1, 6, 253, 204, 58, 1, 6, 252, - 196, 253, 204, 58, 1, 6, 250, 46, 58, 1, 6, 73, 58, 1, 6, 210, 73, 58, 1, - 6, 245, 67, 58, 1, 6, 243, 225, 58, 1, 6, 72, 58, 1, 6, 237, 126, 58, 1, - 6, 237, 17, 58, 1, 6, 153, 58, 1, 6, 189, 58, 1, 6, 207, 58, 1, 6, 210, - 207, 58, 1, 6, 74, 58, 1, 6, 230, 86, 58, 1, 6, 230, 59, 58, 1, 6, 152, - 58, 1, 6, 222, 201, 58, 1, 6, 68, 58, 1, 6, 219, 40, 58, 1, 3, 60, 58, 1, - 3, 215, 60, 58, 1, 3, 254, 146, 58, 1, 3, 215, 254, 234, 58, 1, 3, 253, - 204, 58, 1, 3, 250, 46, 58, 1, 3, 73, 58, 1, 3, 226, 104, 58, 1, 3, 230, - 119, 73, 58, 1, 3, 215, 230, 119, 73, 58, 1, 3, 245, 67, 58, 1, 3, 215, - 72, 58, 1, 3, 237, 17, 58, 1, 3, 189, 58, 1, 3, 246, 185, 58, 1, 3, 74, - 58, 1, 3, 230, 119, 74, 58, 1, 3, 221, 120, 144, 74, 58, 1, 3, 252, 29, - 144, 74, 58, 1, 3, 230, 59, 58, 1, 3, 222, 201, 58, 1, 3, 68, 58, 1, 3, - 224, 136, 68, 58, 1, 3, 215, 189, 58, 1, 3, 216, 216, 58, 1, 3, 254, 191, - 58, 1, 3, 252, 102, 58, 1, 3, 23, 244, 231, 58, 1, 3, 249, 62, 58, 1, 3, - 23, 229, 129, 58, 1, 3, 251, 31, 7, 223, 94, 3, 1, 72, 7, 223, 94, 3, 1, - 152, 7, 223, 94, 3, 1, 68, 7, 223, 94, 3, 1, 216, 216, 23, 223, 94, 3, 1, - 252, 102, 23, 223, 94, 3, 1, 244, 231, 23, 223, 94, 3, 1, 227, 149, 23, - 223, 94, 3, 1, 229, 129, 23, 223, 94, 3, 1, 251, 31, 7, 3, 1, 220, 110, - 7, 3, 1, 49, 2, 233, 193, 221, 179, 7, 3, 1, 250, 47, 2, 233, 193, 221, - 179, 7, 3, 1, 246, 75, 2, 233, 193, 221, 179, 7, 3, 1, 234, 187, 2, 233, - 193, 221, 179, 7, 3, 1, 233, 34, 2, 233, 193, 221, 179, 7, 3, 1, 230, 60, - 2, 233, 193, 221, 179, 7, 3, 1, 228, 39, 2, 233, 193, 221, 179, 7, 3, 1, - 228, 39, 2, 245, 174, 25, 233, 193, 221, 179, 7, 3, 1, 226, 235, 2, 233, - 193, 221, 179, 7, 3, 1, 222, 202, 2, 233, 193, 221, 179, 7, 3, 1, 217, - 158, 2, 233, 193, 221, 179, 7, 3, 1, 215, 245, 67, 58, 1, 31, 246, 197, - 7, 3, 1, 237, 188, 245, 67, 7, 3, 1, 222, 38, 2, 223, 121, 7, 3, 6, 1, - 242, 107, 2, 92, 7, 3, 1, 237, 163, 2, 92, 7, 3, 1, 230, 60, 2, 92, 7, 3, - 6, 1, 105, 2, 92, 7, 3, 1, 220, 58, 2, 92, 7, 3, 1, 49, 2, 230, 29, 96, - 7, 3, 1, 250, 47, 2, 230, 29, 96, 7, 3, 1, 246, 75, 2, 230, 29, 96, 7, 3, - 1, 245, 68, 2, 230, 29, 96, 7, 3, 1, 237, 18, 2, 230, 29, 96, 7, 3, 1, - 235, 202, 2, 230, 29, 96, 7, 3, 1, 234, 187, 2, 230, 29, 96, 7, 3, 1, - 233, 34, 2, 230, 29, 96, 7, 3, 1, 230, 60, 2, 230, 29, 96, 7, 3, 1, 228, - 39, 2, 230, 29, 96, 7, 3, 1, 226, 235, 2, 230, 29, 96, 7, 3, 1, 246, 134, - 2, 230, 29, 96, 7, 3, 1, 220, 11, 2, 230, 29, 96, 7, 3, 1, 218, 152, 2, - 230, 29, 96, 7, 3, 1, 217, 158, 2, 230, 29, 96, 7, 3, 1, 112, 2, 227, - 164, 96, 7, 3, 1, 254, 147, 2, 227, 164, 96, 7, 3, 1, 250, 47, 2, 242, - 247, 25, 222, 135, 7, 3, 1, 178, 2, 227, 164, 96, 7, 3, 1, 230, 119, 178, - 2, 227, 164, 96, 7, 3, 1, 210, 230, 119, 178, 2, 227, 164, 96, 7, 3, 1, - 226, 105, 2, 227, 164, 96, 7, 3, 1, 242, 107, 2, 227, 164, 96, 7, 3, 1, - 230, 119, 142, 2, 227, 164, 96, 7, 3, 1, 246, 134, 2, 227, 164, 96, 7, 3, - 1, 105, 2, 227, 164, 96, 7, 3, 1, 246, 77, 2, 227, 164, 96, 58, 1, 3, - 215, 254, 146, 58, 1, 3, 251, 202, 58, 1, 3, 251, 203, 2, 250, 80, 58, 1, - 3, 246, 118, 58, 1, 3, 210, 230, 119, 73, 58, 1, 3, 246, 74, 58, 1, 3, - 248, 144, 237, 127, 2, 92, 58, 1, 3, 102, 245, 67, 58, 1, 3, 215, 243, - 225, 58, 1, 3, 242, 107, 2, 92, 58, 1, 3, 237, 162, 58, 1, 3, 6, 72, 58, - 1, 3, 6, 242, 107, 2, 92, 58, 1, 3, 237, 127, 2, 250, 97, 58, 1, 3, 235, - 202, 2, 227, 164, 96, 58, 1, 3, 235, 202, 2, 230, 29, 96, 58, 1, 3, 6, - 153, 58, 1, 3, 234, 187, 2, 96, 58, 1, 3, 215, 234, 187, 2, 171, 235, - 106, 58, 1, 3, 233, 34, 2, 42, 96, 58, 1, 3, 233, 34, 2, 227, 164, 96, - 58, 1, 3, 6, 207, 58, 1, 3, 252, 196, 74, 58, 1, 3, 229, 129, 58, 1, 3, - 226, 235, 2, 96, 58, 1, 3, 246, 133, 58, 1, 3, 222, 202, 2, 230, 29, 96, - 58, 1, 3, 105, 135, 58, 1, 3, 220, 57, 58, 1, 3, 6, 68, 58, 1, 3, 220, - 11, 2, 96, 58, 1, 3, 215, 216, 216, 58, 1, 3, 217, 157, 58, 1, 3, 217, - 158, 2, 227, 164, 96, 58, 1, 3, 217, 158, 2, 250, 80, 58, 1, 3, 246, 76, - 58, 1, 3, 222, 6, 36, 247, 143, 244, 37, 255, 0, 36, 247, 143, 254, 248, - 255, 0, 36, 224, 36, 56, 36, 223, 45, 78, 36, 234, 114, 36, 244, 34, 36, - 234, 112, 36, 254, 246, 36, 244, 35, 36, 254, 247, 36, 7, 3, 1, 228, 39, - 56, 36, 252, 7, 36, 234, 113, 36, 51, 250, 217, 50, 36, 230, 163, 50, 36, - 217, 33, 56, 36, 237, 152, 56, 36, 220, 51, 50, 36, 220, 35, 50, 36, 7, - 3, 1, 245, 154, 230, 119, 112, 50, 36, 7, 3, 1, 254, 234, 36, 7, 3, 1, - 254, 93, 36, 7, 3, 1, 253, 220, 36, 7, 3, 1, 251, 203, 251, 92, 36, 7, 3, - 1, 237, 188, 250, 46, 36, 7, 3, 1, 246, 118, 36, 7, 3, 1, 245, 67, 36, 7, - 1, 3, 6, 245, 67, 36, 7, 3, 1, 237, 17, 36, 7, 3, 1, 153, 36, 7, 1, 3, 6, - 153, 36, 7, 1, 3, 6, 189, 36, 7, 3, 1, 207, 36, 7, 1, 3, 6, 207, 36, 7, - 1, 3, 6, 152, 36, 7, 3, 1, 228, 39, 227, 58, 36, 7, 3, 1, 198, 36, 7, 3, - 1, 171, 198, 36, 7, 3, 1, 217, 157, 36, 254, 151, 114, 199, 56, 36, 42, - 254, 21, 50, 36, 45, 254, 21, 25, 113, 254, 21, 56, 7, 6, 1, 112, 2, 227, - 94, 56, 7, 3, 1, 112, 2, 227, 94, 56, 7, 6, 1, 49, 2, 61, 50, 7, 3, 1, - 49, 2, 61, 50, 7, 6, 1, 49, 2, 61, 56, 7, 3, 1, 49, 2, 61, 56, 7, 6, 1, - 49, 2, 235, 44, 56, 7, 3, 1, 49, 2, 235, 44, 56, 7, 6, 1, 251, 203, 2, - 251, 93, 25, 168, 7, 3, 1, 251, 203, 2, 251, 93, 25, 168, 7, 6, 1, 250, - 47, 2, 61, 50, 7, 3, 1, 250, 47, 2, 61, 50, 7, 6, 1, 250, 47, 2, 61, 56, - 7, 3, 1, 250, 47, 2, 61, 56, 7, 6, 1, 250, 47, 2, 235, 44, 56, 7, 3, 1, - 250, 47, 2, 235, 44, 56, 7, 6, 1, 250, 47, 2, 251, 92, 7, 3, 1, 250, 47, - 2, 251, 92, 7, 6, 1, 250, 47, 2, 250, 217, 56, 7, 3, 1, 250, 47, 2, 250, - 217, 56, 7, 6, 1, 178, 2, 234, 116, 25, 244, 36, 7, 3, 1, 178, 2, 234, - 116, 25, 244, 36, 7, 6, 1, 178, 2, 234, 116, 25, 168, 7, 3, 1, 178, 2, - 234, 116, 25, 168, 7, 6, 1, 178, 2, 250, 217, 56, 7, 3, 1, 178, 2, 250, - 217, 56, 7, 6, 1, 178, 2, 221, 180, 56, 7, 3, 1, 178, 2, 221, 180, 56, 7, - 6, 1, 178, 2, 251, 93, 25, 252, 8, 7, 3, 1, 178, 2, 251, 93, 25, 252, 8, - 7, 6, 1, 246, 75, 2, 61, 50, 7, 3, 1, 246, 75, 2, 61, 50, 7, 6, 1, 245, - 68, 2, 234, 115, 7, 3, 1, 245, 68, 2, 234, 115, 7, 6, 1, 243, 226, 2, 61, - 50, 7, 3, 1, 243, 226, 2, 61, 50, 7, 6, 1, 243, 226, 2, 61, 56, 7, 3, 1, - 243, 226, 2, 61, 56, 7, 6, 1, 243, 226, 2, 249, 13, 7, 3, 1, 243, 226, 2, - 249, 13, 7, 6, 1, 243, 226, 2, 251, 92, 7, 3, 1, 243, 226, 2, 251, 92, 7, - 6, 1, 243, 226, 2, 252, 9, 56, 7, 3, 1, 243, 226, 2, 252, 9, 56, 7, 6, 1, - 242, 107, 2, 221, 180, 56, 7, 3, 1, 242, 107, 2, 221, 180, 56, 7, 6, 1, - 242, 107, 2, 249, 14, 25, 168, 7, 3, 1, 242, 107, 2, 249, 14, 25, 168, 7, - 6, 1, 237, 18, 2, 168, 7, 3, 1, 237, 18, 2, 168, 7, 6, 1, 237, 18, 2, 61, - 56, 7, 3, 1, 237, 18, 2, 61, 56, 7, 6, 1, 237, 18, 2, 235, 44, 56, 7, 3, - 1, 237, 18, 2, 235, 44, 56, 7, 6, 1, 235, 202, 2, 61, 56, 7, 3, 1, 235, - 202, 2, 61, 56, 7, 6, 1, 235, 202, 2, 61, 252, 118, 25, 234, 115, 7, 3, - 1, 235, 202, 2, 61, 252, 118, 25, 234, 115, 7, 6, 1, 235, 202, 2, 235, - 44, 56, 7, 3, 1, 235, 202, 2, 235, 44, 56, 7, 6, 1, 235, 202, 2, 250, - 217, 56, 7, 3, 1, 235, 202, 2, 250, 217, 56, 7, 6, 1, 234, 187, 2, 168, - 7, 3, 1, 234, 187, 2, 168, 7, 6, 1, 234, 187, 2, 61, 50, 7, 3, 1, 234, - 187, 2, 61, 50, 7, 6, 1, 234, 187, 2, 61, 56, 7, 3, 1, 234, 187, 2, 61, - 56, 7, 6, 1, 233, 34, 2, 61, 50, 7, 3, 1, 233, 34, 2, 61, 50, 7, 6, 1, - 233, 34, 2, 61, 56, 7, 3, 1, 233, 34, 2, 61, 56, 7, 6, 1, 233, 34, 2, - 235, 44, 56, 7, 3, 1, 233, 34, 2, 235, 44, 56, 7, 6, 1, 233, 34, 2, 250, - 217, 56, 7, 3, 1, 233, 34, 2, 250, 217, 56, 7, 6, 1, 142, 2, 221, 180, - 25, 168, 7, 3, 1, 142, 2, 221, 180, 25, 168, 7, 6, 1, 142, 2, 221, 180, - 25, 249, 13, 7, 3, 1, 142, 2, 221, 180, 25, 249, 13, 7, 6, 1, 142, 2, - 234, 116, 25, 244, 36, 7, 3, 1, 142, 2, 234, 116, 25, 244, 36, 7, 6, 1, - 142, 2, 234, 116, 25, 168, 7, 3, 1, 142, 2, 234, 116, 25, 168, 7, 6, 1, - 230, 60, 2, 168, 7, 3, 1, 230, 60, 2, 168, 7, 6, 1, 230, 60, 2, 61, 50, - 7, 3, 1, 230, 60, 2, 61, 50, 7, 6, 1, 228, 39, 2, 61, 50, 7, 3, 1, 228, - 39, 2, 61, 50, 7, 6, 1, 228, 39, 2, 61, 56, 7, 3, 1, 228, 39, 2, 61, 56, - 7, 6, 1, 228, 39, 2, 61, 252, 118, 25, 234, 115, 7, 3, 1, 228, 39, 2, 61, - 252, 118, 25, 234, 115, 7, 6, 1, 228, 39, 2, 235, 44, 56, 7, 3, 1, 228, - 39, 2, 235, 44, 56, 7, 6, 1, 226, 235, 2, 61, 50, 7, 3, 1, 226, 235, 2, - 61, 50, 7, 6, 1, 226, 235, 2, 61, 56, 7, 3, 1, 226, 235, 2, 61, 56, 7, 6, - 1, 226, 235, 2, 254, 248, 25, 61, 50, 7, 3, 1, 226, 235, 2, 254, 248, 25, - 61, 50, 7, 6, 1, 226, 235, 2, 251, 131, 25, 61, 50, 7, 3, 1, 226, 235, 2, - 251, 131, 25, 61, 50, 7, 6, 1, 226, 235, 2, 61, 252, 118, 25, 61, 50, 7, - 3, 1, 226, 235, 2, 61, 252, 118, 25, 61, 50, 7, 6, 1, 222, 202, 2, 61, - 50, 7, 3, 1, 222, 202, 2, 61, 50, 7, 6, 1, 222, 202, 2, 61, 56, 7, 3, 1, - 222, 202, 2, 61, 56, 7, 6, 1, 222, 202, 2, 235, 44, 56, 7, 3, 1, 222, - 202, 2, 235, 44, 56, 7, 6, 1, 222, 202, 2, 250, 217, 56, 7, 3, 1, 222, - 202, 2, 250, 217, 56, 7, 6, 1, 105, 2, 249, 14, 56, 7, 3, 1, 105, 2, 249, - 14, 56, 7, 6, 1, 105, 2, 221, 180, 56, 7, 3, 1, 105, 2, 221, 180, 56, 7, - 6, 1, 105, 2, 250, 217, 56, 7, 3, 1, 105, 2, 250, 217, 56, 7, 6, 1, 105, - 2, 221, 180, 25, 168, 7, 3, 1, 105, 2, 221, 180, 25, 168, 7, 6, 1, 105, - 2, 234, 116, 25, 249, 13, 7, 3, 1, 105, 2, 234, 116, 25, 249, 13, 7, 6, - 1, 220, 11, 2, 221, 179, 7, 3, 1, 220, 11, 2, 221, 179, 7, 6, 1, 220, 11, - 2, 61, 56, 7, 3, 1, 220, 11, 2, 61, 56, 7, 6, 1, 219, 41, 2, 244, 36, 7, - 3, 1, 219, 41, 2, 244, 36, 7, 6, 1, 219, 41, 2, 168, 7, 3, 1, 219, 41, 2, - 168, 7, 6, 1, 219, 41, 2, 249, 13, 7, 3, 1, 219, 41, 2, 249, 13, 7, 6, 1, - 219, 41, 2, 61, 50, 7, 3, 1, 219, 41, 2, 61, 50, 7, 6, 1, 219, 41, 2, 61, - 56, 7, 3, 1, 219, 41, 2, 61, 56, 7, 6, 1, 218, 152, 2, 61, 50, 7, 3, 1, - 218, 152, 2, 61, 50, 7, 6, 1, 218, 152, 2, 249, 13, 7, 3, 1, 218, 152, 2, - 249, 13, 7, 6, 1, 218, 91, 2, 61, 50, 7, 3, 1, 218, 91, 2, 61, 50, 7, 6, - 1, 217, 158, 2, 250, 216, 7, 3, 1, 217, 158, 2, 250, 216, 7, 6, 1, 217, - 158, 2, 61, 56, 7, 3, 1, 217, 158, 2, 61, 56, 7, 6, 1, 217, 158, 2, 235, - 44, 56, 7, 3, 1, 217, 158, 2, 235, 44, 56, 7, 3, 1, 243, 226, 2, 235, 44, - 56, 7, 3, 1, 222, 202, 2, 249, 13, 7, 3, 1, 219, 41, 2, 227, 94, 50, 7, - 3, 1, 218, 91, 2, 227, 94, 50, 7, 3, 1, 112, 2, 45, 144, 227, 93, 7, 3, - 1, 171, 226, 235, 2, 61, 50, 7, 3, 1, 171, 226, 235, 2, 249, 11, 92, 7, - 3, 1, 171, 226, 235, 2, 116, 92, 7, 6, 1, 225, 1, 198, 7, 3, 1, 249, 62, - 7, 6, 1, 112, 2, 61, 56, 7, 3, 1, 112, 2, 61, 56, 7, 6, 1, 112, 2, 242, - 247, 50, 7, 3, 1, 112, 2, 242, 247, 50, 7, 6, 1, 112, 2, 250, 217, 25, - 168, 7, 3, 1, 112, 2, 250, 217, 25, 168, 7, 6, 1, 112, 2, 250, 217, 25, - 244, 36, 7, 3, 1, 112, 2, 250, 217, 25, 244, 36, 7, 6, 1, 112, 2, 250, - 217, 25, 242, 247, 50, 7, 3, 1, 112, 2, 250, 217, 25, 242, 247, 50, 7, 6, - 1, 112, 2, 250, 217, 25, 221, 179, 7, 3, 1, 112, 2, 250, 217, 25, 221, - 179, 7, 6, 1, 112, 2, 250, 217, 25, 61, 56, 7, 3, 1, 112, 2, 250, 217, - 25, 61, 56, 7, 6, 1, 112, 2, 252, 9, 25, 168, 7, 3, 1, 112, 2, 252, 9, - 25, 168, 7, 6, 1, 112, 2, 252, 9, 25, 244, 36, 7, 3, 1, 112, 2, 252, 9, - 25, 244, 36, 7, 6, 1, 112, 2, 252, 9, 25, 242, 247, 50, 7, 3, 1, 112, 2, - 252, 9, 25, 242, 247, 50, 7, 6, 1, 112, 2, 252, 9, 25, 221, 179, 7, 3, 1, - 112, 2, 252, 9, 25, 221, 179, 7, 6, 1, 112, 2, 252, 9, 25, 61, 56, 7, 3, - 1, 112, 2, 252, 9, 25, 61, 56, 7, 6, 1, 178, 2, 61, 56, 7, 3, 1, 178, 2, - 61, 56, 7, 6, 1, 178, 2, 242, 247, 50, 7, 3, 1, 178, 2, 242, 247, 50, 7, - 6, 1, 178, 2, 221, 179, 7, 3, 1, 178, 2, 221, 179, 7, 6, 1, 178, 2, 250, - 217, 25, 168, 7, 3, 1, 178, 2, 250, 217, 25, 168, 7, 6, 1, 178, 2, 250, - 217, 25, 244, 36, 7, 3, 1, 178, 2, 250, 217, 25, 244, 36, 7, 6, 1, 178, - 2, 250, 217, 25, 242, 247, 50, 7, 3, 1, 178, 2, 250, 217, 25, 242, 247, - 50, 7, 6, 1, 178, 2, 250, 217, 25, 221, 179, 7, 3, 1, 178, 2, 250, 217, - 25, 221, 179, 7, 6, 1, 178, 2, 250, 217, 25, 61, 56, 7, 3, 1, 178, 2, - 250, 217, 25, 61, 56, 7, 6, 1, 242, 107, 2, 242, 247, 50, 7, 3, 1, 242, - 107, 2, 242, 247, 50, 7, 6, 1, 242, 107, 2, 61, 56, 7, 3, 1, 242, 107, 2, - 61, 56, 7, 6, 1, 142, 2, 61, 56, 7, 3, 1, 142, 2, 61, 56, 7, 6, 1, 142, - 2, 242, 247, 50, 7, 3, 1, 142, 2, 242, 247, 50, 7, 6, 1, 142, 2, 250, - 217, 25, 168, 7, 3, 1, 142, 2, 250, 217, 25, 168, 7, 6, 1, 142, 2, 250, - 217, 25, 244, 36, 7, 3, 1, 142, 2, 250, 217, 25, 244, 36, 7, 6, 1, 142, - 2, 250, 217, 25, 242, 247, 50, 7, 3, 1, 142, 2, 250, 217, 25, 242, 247, - 50, 7, 6, 1, 142, 2, 250, 217, 25, 221, 179, 7, 3, 1, 142, 2, 250, 217, - 25, 221, 179, 7, 6, 1, 142, 2, 250, 217, 25, 61, 56, 7, 3, 1, 142, 2, - 250, 217, 25, 61, 56, 7, 6, 1, 142, 2, 242, 190, 25, 168, 7, 3, 1, 142, - 2, 242, 190, 25, 168, 7, 6, 1, 142, 2, 242, 190, 25, 244, 36, 7, 3, 1, - 142, 2, 242, 190, 25, 244, 36, 7, 6, 1, 142, 2, 242, 190, 25, 242, 247, - 50, 7, 3, 1, 142, 2, 242, 190, 25, 242, 247, 50, 7, 6, 1, 142, 2, 242, - 190, 25, 221, 179, 7, 3, 1, 142, 2, 242, 190, 25, 221, 179, 7, 6, 1, 142, - 2, 242, 190, 25, 61, 56, 7, 3, 1, 142, 2, 242, 190, 25, 61, 56, 7, 6, 1, - 105, 2, 61, 56, 7, 3, 1, 105, 2, 61, 56, 7, 6, 1, 105, 2, 242, 247, 50, - 7, 3, 1, 105, 2, 242, 247, 50, 7, 6, 1, 105, 2, 242, 190, 25, 168, 7, 3, - 1, 105, 2, 242, 190, 25, 168, 7, 6, 1, 105, 2, 242, 190, 25, 244, 36, 7, - 3, 1, 105, 2, 242, 190, 25, 244, 36, 7, 6, 1, 105, 2, 242, 190, 25, 242, - 247, 50, 7, 3, 1, 105, 2, 242, 190, 25, 242, 247, 50, 7, 6, 1, 105, 2, - 242, 190, 25, 221, 179, 7, 3, 1, 105, 2, 242, 190, 25, 221, 179, 7, 6, 1, - 105, 2, 242, 190, 25, 61, 56, 7, 3, 1, 105, 2, 242, 190, 25, 61, 56, 7, - 6, 1, 218, 91, 2, 244, 36, 7, 3, 1, 218, 91, 2, 244, 36, 7, 6, 1, 218, - 91, 2, 61, 56, 7, 3, 1, 218, 91, 2, 61, 56, 7, 6, 1, 218, 91, 2, 242, - 247, 50, 7, 3, 1, 218, 91, 2, 242, 247, 50, 7, 6, 1, 218, 91, 2, 221, - 179, 7, 3, 1, 218, 91, 2, 221, 179, 7, 6, 1, 233, 192, 235, 18, 7, 3, 1, - 233, 192, 235, 18, 7, 6, 1, 233, 192, 216, 216, 7, 3, 1, 233, 192, 216, - 216, 7, 6, 1, 218, 91, 2, 234, 247, 7, 3, 1, 218, 91, 2, 234, 247, 23, 3, - 1, 254, 147, 2, 228, 206, 23, 3, 1, 254, 147, 2, 249, 144, 23, 3, 1, 254, - 147, 2, 209, 25, 219, 178, 23, 3, 1, 254, 147, 2, 193, 25, 219, 178, 23, - 3, 1, 254, 147, 2, 209, 25, 230, 64, 23, 3, 1, 254, 147, 2, 193, 25, 230, - 64, 23, 3, 1, 254, 147, 2, 209, 25, 229, 163, 23, 3, 1, 254, 147, 2, 193, - 25, 229, 163, 23, 6, 1, 254, 147, 2, 228, 206, 23, 6, 1, 254, 147, 2, - 249, 144, 23, 6, 1, 254, 147, 2, 209, 25, 219, 178, 23, 6, 1, 254, 147, - 2, 193, 25, 219, 178, 23, 6, 1, 254, 147, 2, 209, 25, 230, 64, 23, 6, 1, - 254, 147, 2, 193, 25, 230, 64, 23, 6, 1, 254, 147, 2, 209, 25, 229, 163, - 23, 6, 1, 254, 147, 2, 193, 25, 229, 163, 23, 3, 1, 246, 157, 2, 228, - 206, 23, 3, 1, 246, 157, 2, 249, 144, 23, 3, 1, 246, 157, 2, 209, 25, - 219, 178, 23, 3, 1, 246, 157, 2, 193, 25, 219, 178, 23, 3, 1, 246, 157, - 2, 209, 25, 230, 64, 23, 3, 1, 246, 157, 2, 193, 25, 230, 64, 23, 6, 1, - 246, 157, 2, 228, 206, 23, 6, 1, 246, 157, 2, 249, 144, 23, 6, 1, 246, - 157, 2, 209, 25, 219, 178, 23, 6, 1, 246, 157, 2, 193, 25, 219, 178, 23, - 6, 1, 246, 157, 2, 209, 25, 230, 64, 23, 6, 1, 246, 157, 2, 193, 25, 230, - 64, 23, 3, 1, 246, 122, 2, 228, 206, 23, 3, 1, 246, 122, 2, 249, 144, 23, - 3, 1, 246, 122, 2, 209, 25, 219, 178, 23, 3, 1, 246, 122, 2, 193, 25, - 219, 178, 23, 3, 1, 246, 122, 2, 209, 25, 230, 64, 23, 3, 1, 246, 122, 2, - 193, 25, 230, 64, 23, 3, 1, 246, 122, 2, 209, 25, 229, 163, 23, 3, 1, - 246, 122, 2, 193, 25, 229, 163, 23, 6, 1, 246, 122, 2, 228, 206, 23, 6, - 1, 246, 122, 2, 249, 144, 23, 6, 1, 246, 122, 2, 209, 25, 219, 178, 23, - 6, 1, 246, 122, 2, 193, 25, 219, 178, 23, 6, 1, 246, 122, 2, 209, 25, - 230, 64, 23, 6, 1, 246, 122, 2, 193, 25, 230, 64, 23, 6, 1, 246, 122, 2, - 209, 25, 229, 163, 23, 6, 1, 246, 122, 2, 193, 25, 229, 163, 23, 3, 1, - 237, 163, 2, 228, 206, 23, 3, 1, 237, 163, 2, 249, 144, 23, 3, 1, 237, - 163, 2, 209, 25, 219, 178, 23, 3, 1, 237, 163, 2, 193, 25, 219, 178, 23, - 3, 1, 237, 163, 2, 209, 25, 230, 64, 23, 3, 1, 237, 163, 2, 193, 25, 230, - 64, 23, 3, 1, 237, 163, 2, 209, 25, 229, 163, 23, 3, 1, 237, 163, 2, 193, - 25, 229, 163, 23, 6, 1, 237, 163, 2, 228, 206, 23, 6, 1, 237, 163, 2, - 249, 144, 23, 6, 1, 237, 163, 2, 209, 25, 219, 178, 23, 6, 1, 237, 163, - 2, 193, 25, 219, 178, 23, 6, 1, 237, 163, 2, 209, 25, 230, 64, 23, 6, 1, - 237, 163, 2, 193, 25, 230, 64, 23, 6, 1, 237, 163, 2, 209, 25, 229, 163, - 23, 6, 1, 237, 163, 2, 193, 25, 229, 163, 23, 3, 1, 230, 142, 2, 228, - 206, 23, 3, 1, 230, 142, 2, 249, 144, 23, 3, 1, 230, 142, 2, 209, 25, - 219, 178, 23, 3, 1, 230, 142, 2, 193, 25, 219, 178, 23, 3, 1, 230, 142, - 2, 209, 25, 230, 64, 23, 3, 1, 230, 142, 2, 193, 25, 230, 64, 23, 6, 1, - 230, 142, 2, 228, 206, 23, 6, 1, 230, 142, 2, 249, 144, 23, 6, 1, 230, - 142, 2, 209, 25, 219, 178, 23, 6, 1, 230, 142, 2, 193, 25, 219, 178, 23, - 6, 1, 230, 142, 2, 209, 25, 230, 64, 23, 6, 1, 230, 142, 2, 193, 25, 230, - 64, 23, 3, 1, 220, 58, 2, 228, 206, 23, 3, 1, 220, 58, 2, 249, 144, 23, - 3, 1, 220, 58, 2, 209, 25, 219, 178, 23, 3, 1, 220, 58, 2, 193, 25, 219, - 178, 23, 3, 1, 220, 58, 2, 209, 25, 230, 64, 23, 3, 1, 220, 58, 2, 193, - 25, 230, 64, 23, 3, 1, 220, 58, 2, 209, 25, 229, 163, 23, 3, 1, 220, 58, - 2, 193, 25, 229, 163, 23, 6, 1, 220, 58, 2, 249, 144, 23, 6, 1, 220, 58, - 2, 193, 25, 219, 178, 23, 6, 1, 220, 58, 2, 193, 25, 230, 64, 23, 6, 1, - 220, 58, 2, 193, 25, 229, 163, 23, 3, 1, 230, 144, 2, 228, 206, 23, 3, 1, - 230, 144, 2, 249, 144, 23, 3, 1, 230, 144, 2, 209, 25, 219, 178, 23, 3, - 1, 230, 144, 2, 193, 25, 219, 178, 23, 3, 1, 230, 144, 2, 209, 25, 230, - 64, 23, 3, 1, 230, 144, 2, 193, 25, 230, 64, 23, 3, 1, 230, 144, 2, 209, - 25, 229, 163, 23, 3, 1, 230, 144, 2, 193, 25, 229, 163, 23, 6, 1, 230, - 144, 2, 228, 206, 23, 6, 1, 230, 144, 2, 249, 144, 23, 6, 1, 230, 144, 2, - 209, 25, 219, 178, 23, 6, 1, 230, 144, 2, 193, 25, 219, 178, 23, 6, 1, - 230, 144, 2, 209, 25, 230, 64, 23, 6, 1, 230, 144, 2, 193, 25, 230, 64, - 23, 6, 1, 230, 144, 2, 209, 25, 229, 163, 23, 6, 1, 230, 144, 2, 193, 25, - 229, 163, 23, 3, 1, 254, 147, 2, 219, 178, 23, 3, 1, 254, 147, 2, 230, - 64, 23, 3, 1, 246, 157, 2, 219, 178, 23, 3, 1, 246, 157, 2, 230, 64, 23, - 3, 1, 246, 122, 2, 219, 178, 23, 3, 1, 246, 122, 2, 230, 64, 23, 3, 1, - 237, 163, 2, 219, 178, 23, 3, 1, 237, 163, 2, 230, 64, 23, 3, 1, 230, - 142, 2, 219, 178, 23, 3, 1, 230, 142, 2, 230, 64, 23, 3, 1, 220, 58, 2, - 219, 178, 23, 3, 1, 220, 58, 2, 230, 64, 23, 3, 1, 230, 144, 2, 219, 178, - 23, 3, 1, 230, 144, 2, 230, 64, 23, 3, 1, 254, 147, 2, 209, 25, 217, 207, - 23, 3, 1, 254, 147, 2, 193, 25, 217, 207, 23, 3, 1, 254, 147, 2, 209, 25, - 219, 179, 25, 217, 207, 23, 3, 1, 254, 147, 2, 193, 25, 219, 179, 25, - 217, 207, 23, 3, 1, 254, 147, 2, 209, 25, 230, 65, 25, 217, 207, 23, 3, - 1, 254, 147, 2, 193, 25, 230, 65, 25, 217, 207, 23, 3, 1, 254, 147, 2, - 209, 25, 229, 164, 25, 217, 207, 23, 3, 1, 254, 147, 2, 193, 25, 229, - 164, 25, 217, 207, 23, 6, 1, 254, 147, 2, 209, 25, 228, 217, 23, 6, 1, - 254, 147, 2, 193, 25, 228, 217, 23, 6, 1, 254, 147, 2, 209, 25, 219, 179, - 25, 228, 217, 23, 6, 1, 254, 147, 2, 193, 25, 219, 179, 25, 228, 217, 23, - 6, 1, 254, 147, 2, 209, 25, 230, 65, 25, 228, 217, 23, 6, 1, 254, 147, 2, - 193, 25, 230, 65, 25, 228, 217, 23, 6, 1, 254, 147, 2, 209, 25, 229, 164, - 25, 228, 217, 23, 6, 1, 254, 147, 2, 193, 25, 229, 164, 25, 228, 217, 23, - 3, 1, 246, 122, 2, 209, 25, 217, 207, 23, 3, 1, 246, 122, 2, 193, 25, - 217, 207, 23, 3, 1, 246, 122, 2, 209, 25, 219, 179, 25, 217, 207, 23, 3, - 1, 246, 122, 2, 193, 25, 219, 179, 25, 217, 207, 23, 3, 1, 246, 122, 2, - 209, 25, 230, 65, 25, 217, 207, 23, 3, 1, 246, 122, 2, 193, 25, 230, 65, - 25, 217, 207, 23, 3, 1, 246, 122, 2, 209, 25, 229, 164, 25, 217, 207, 23, - 3, 1, 246, 122, 2, 193, 25, 229, 164, 25, 217, 207, 23, 6, 1, 246, 122, - 2, 209, 25, 228, 217, 23, 6, 1, 246, 122, 2, 193, 25, 228, 217, 23, 6, 1, - 246, 122, 2, 209, 25, 219, 179, 25, 228, 217, 23, 6, 1, 246, 122, 2, 193, - 25, 219, 179, 25, 228, 217, 23, 6, 1, 246, 122, 2, 209, 25, 230, 65, 25, - 228, 217, 23, 6, 1, 246, 122, 2, 193, 25, 230, 65, 25, 228, 217, 23, 6, - 1, 246, 122, 2, 209, 25, 229, 164, 25, 228, 217, 23, 6, 1, 246, 122, 2, - 193, 25, 229, 164, 25, 228, 217, 23, 3, 1, 230, 144, 2, 209, 25, 217, - 207, 23, 3, 1, 230, 144, 2, 193, 25, 217, 207, 23, 3, 1, 230, 144, 2, - 209, 25, 219, 179, 25, 217, 207, 23, 3, 1, 230, 144, 2, 193, 25, 219, - 179, 25, 217, 207, 23, 3, 1, 230, 144, 2, 209, 25, 230, 65, 25, 217, 207, - 23, 3, 1, 230, 144, 2, 193, 25, 230, 65, 25, 217, 207, 23, 3, 1, 230, - 144, 2, 209, 25, 229, 164, 25, 217, 207, 23, 3, 1, 230, 144, 2, 193, 25, - 229, 164, 25, 217, 207, 23, 6, 1, 230, 144, 2, 209, 25, 228, 217, 23, 6, - 1, 230, 144, 2, 193, 25, 228, 217, 23, 6, 1, 230, 144, 2, 209, 25, 219, - 179, 25, 228, 217, 23, 6, 1, 230, 144, 2, 193, 25, 219, 179, 25, 228, - 217, 23, 6, 1, 230, 144, 2, 209, 25, 230, 65, 25, 228, 217, 23, 6, 1, - 230, 144, 2, 193, 25, 230, 65, 25, 228, 217, 23, 6, 1, 230, 144, 2, 209, - 25, 229, 164, 25, 228, 217, 23, 6, 1, 230, 144, 2, 193, 25, 229, 164, 25, - 228, 217, 23, 3, 1, 254, 147, 2, 219, 57, 23, 3, 1, 254, 147, 2, 234, - 115, 23, 3, 1, 254, 147, 2, 219, 179, 25, 217, 207, 23, 3, 1, 254, 147, - 2, 217, 207, 23, 3, 1, 254, 147, 2, 230, 65, 25, 217, 207, 23, 3, 1, 254, - 147, 2, 229, 163, 23, 3, 1, 254, 147, 2, 229, 164, 25, 217, 207, 23, 6, - 1, 254, 147, 2, 219, 57, 23, 6, 1, 254, 147, 2, 234, 115, 23, 6, 1, 254, - 147, 2, 219, 178, 23, 6, 1, 254, 147, 2, 230, 64, 23, 6, 1, 254, 147, 2, - 228, 217, 23, 236, 33, 23, 228, 217, 23, 228, 206, 23, 229, 163, 23, 249, - 8, 25, 229, 163, 23, 3, 1, 246, 122, 2, 219, 179, 25, 217, 207, 23, 3, 1, - 246, 122, 2, 217, 207, 23, 3, 1, 246, 122, 2, 230, 65, 25, 217, 207, 23, - 3, 1, 246, 122, 2, 229, 163, 23, 3, 1, 246, 122, 2, 229, 164, 25, 217, - 207, 23, 6, 1, 246, 157, 2, 219, 178, 23, 6, 1, 246, 157, 2, 230, 64, 23, - 6, 1, 246, 122, 2, 219, 178, 23, 6, 1, 246, 122, 2, 230, 64, 23, 6, 1, - 246, 122, 2, 228, 217, 23, 209, 25, 219, 178, 23, 209, 25, 230, 64, 23, - 209, 25, 229, 163, 23, 3, 1, 237, 163, 2, 219, 57, 23, 3, 1, 237, 163, 2, - 234, 115, 23, 3, 1, 237, 163, 2, 249, 8, 25, 219, 178, 23, 3, 1, 237, - 163, 2, 249, 8, 25, 230, 64, 23, 3, 1, 237, 163, 2, 229, 163, 23, 3, 1, - 237, 163, 2, 249, 8, 25, 229, 163, 23, 6, 1, 237, 163, 2, 219, 57, 23, 6, - 1, 237, 163, 2, 234, 115, 23, 6, 1, 237, 163, 2, 219, 178, 23, 6, 1, 237, - 163, 2, 230, 64, 23, 193, 25, 219, 178, 23, 193, 25, 230, 64, 23, 193, - 25, 229, 163, 23, 3, 1, 220, 58, 2, 219, 57, 23, 3, 1, 220, 58, 2, 234, - 115, 23, 3, 1, 220, 58, 2, 249, 8, 25, 219, 178, 23, 3, 1, 220, 58, 2, - 249, 8, 25, 230, 64, 23, 3, 1, 227, 150, 2, 228, 206, 23, 3, 1, 227, 150, - 2, 249, 144, 23, 3, 1, 220, 58, 2, 229, 163, 23, 3, 1, 220, 58, 2, 249, - 8, 25, 229, 163, 23, 6, 1, 220, 58, 2, 219, 57, 23, 6, 1, 220, 58, 2, - 234, 115, 23, 6, 1, 220, 58, 2, 219, 178, 23, 6, 1, 220, 58, 2, 230, 64, - 23, 6, 1, 227, 150, 2, 249, 144, 23, 249, 8, 25, 219, 178, 23, 249, 8, - 25, 230, 64, 23, 219, 178, 23, 3, 1, 230, 144, 2, 219, 179, 25, 217, 207, - 23, 3, 1, 230, 144, 2, 217, 207, 23, 3, 1, 230, 144, 2, 230, 65, 25, 217, - 207, 23, 3, 1, 230, 144, 2, 229, 163, 23, 3, 1, 230, 144, 2, 229, 164, - 25, 217, 207, 23, 6, 1, 230, 142, 2, 219, 178, 23, 6, 1, 230, 142, 2, - 230, 64, 23, 6, 1, 230, 144, 2, 219, 178, 23, 6, 1, 230, 144, 2, 230, 64, - 23, 6, 1, 230, 144, 2, 228, 217, 23, 230, 64, 23, 249, 144, 246, 198, - 228, 95, 246, 206, 228, 95, 246, 198, 223, 254, 246, 206, 223, 254, 221, - 226, 223, 254, 245, 114, 223, 254, 224, 80, 223, 254, 245, 194, 223, 254, - 228, 197, 223, 254, 221, 253, 223, 254, 243, 201, 223, 254, 217, 85, 218, - 199, 223, 254, 217, 85, 218, 199, 231, 197, 217, 85, 218, 199, 237, 54, - 235, 108, 78, 227, 102, 78, 242, 121, 231, 198, 242, 121, 245, 194, 249, - 146, 246, 198, 249, 146, 246, 206, 249, 146, 186, 135, 51, 69, 235, 43, - 51, 109, 235, 43, 42, 224, 109, 228, 69, 78, 45, 224, 109, 228, 69, 78, - 224, 109, 234, 238, 228, 69, 78, 224, 109, 243, 98, 228, 69, 78, 42, 51, - 228, 69, 78, 45, 51, 228, 69, 78, 51, 234, 238, 228, 69, 78, 51, 243, 98, - 228, 69, 78, 249, 192, 51, 249, 192, 251, 241, 221, 87, 251, 241, 131, - 61, 235, 121, 124, 61, 235, 121, 186, 246, 208, 242, 119, 229, 31, 235, - 44, 225, 54, 229, 241, 225, 54, 235, 108, 246, 204, 227, 102, 246, 204, - 229, 20, 248, 209, 245, 123, 235, 108, 230, 71, 227, 102, 230, 71, 232, - 210, 231, 203, 223, 254, 229, 170, 233, 164, 55, 229, 170, 222, 66, 221, - 232, 55, 228, 235, 51, 228, 235, 221, 78, 228, 235, 210, 228, 235, 210, - 51, 228, 235, 210, 221, 78, 228, 235, 251, 134, 224, 109, 235, 112, 254, - 120, 228, 69, 78, 224, 109, 227, 106, 254, 120, 228, 69, 78, 227, 199, - 78, 51, 246, 95, 78, 237, 177, 230, 73, 220, 78, 126, 221, 200, 251, 135, - 237, 191, 229, 31, 253, 249, 242, 122, 251, 241, 245, 108, 224, 55, 42, - 40, 252, 18, 2, 228, 77, 45, 40, 252, 18, 2, 228, 77, 51, 228, 82, 78, - 228, 82, 246, 95, 78, 246, 95, 228, 82, 78, 221, 164, 5, 246, 123, 210, - 229, 73, 55, 84, 127, 251, 241, 84, 90, 251, 241, 109, 253, 251, 210, - 225, 67, 250, 198, 220, 63, 124, 253, 250, 254, 159, 219, 101, 250, 167, - 233, 155, 55, 223, 23, 249, 146, 237, 170, 220, 78, 245, 145, 228, 197, - 78, 148, 61, 228, 196, 228, 92, 228, 235, 245, 116, 61, 228, 196, 245, - 170, 61, 228, 196, 124, 61, 228, 196, 245, 116, 61, 78, 247, 143, 250, - 100, 221, 86, 69, 245, 116, 248, 143, 234, 18, 14, 223, 254, 218, 174, - 237, 54, 245, 88, 254, 76, 237, 168, 221, 176, 237, 168, 225, 54, 237, - 168, 229, 43, 237, 201, 222, 228, 223, 34, 254, 250, 222, 228, 223, 34, - 237, 201, 12, 245, 124, 225, 5, 254, 250, 12, 245, 124, 225, 5, 232, 206, - 20, 225, 6, 231, 199, 20, 225, 6, 223, 59, 217, 84, 223, 59, 7, 3, 1, 72, - 223, 59, 154, 223, 59, 174, 223, 59, 182, 223, 59, 191, 223, 59, 185, - 223, 59, 190, 223, 59, 88, 55, 223, 59, 233, 154, 223, 59, 246, 154, 55, - 223, 59, 42, 229, 229, 223, 59, 45, 229, 229, 223, 59, 7, 3, 1, 207, 223, - 94, 217, 84, 223, 94, 107, 223, 94, 103, 223, 94, 160, 223, 94, 154, 223, - 94, 174, 223, 94, 182, 223, 94, 191, 223, 94, 185, 223, 94, 190, 223, 94, - 88, 55, 223, 94, 233, 154, 223, 94, 246, 154, 55, 223, 94, 42, 229, 229, - 223, 94, 45, 229, 229, 7, 223, 94, 3, 1, 60, 7, 223, 94, 3, 1, 73, 7, - 223, 94, 3, 1, 74, 7, 223, 94, 3, 1, 218, 151, 7, 223, 94, 3, 1, 226, - 104, 246, 106, 55, 250, 176, 55, 250, 94, 55, 245, 102, 245, 104, 55, - 235, 30, 55, 233, 165, 55, 232, 223, 55, 229, 153, 55, 227, 4, 55, 218, - 182, 55, 146, 224, 232, 55, 248, 152, 55, 246, 107, 55, 236, 100, 55, - 220, 252, 55, 247, 127, 55, 244, 170, 229, 177, 55, 229, 151, 55, 244, - 14, 55, 253, 224, 55, 242, 176, 55, 251, 94, 55, 235, 24, 221, 111, 55, - 223, 246, 55, 222, 64, 55, 36, 42, 243, 177, 50, 36, 45, 243, 177, 50, - 36, 171, 69, 235, 44, 230, 74, 36, 224, 192, 69, 235, 44, 230, 74, 36, - 254, 104, 76, 50, 36, 250, 199, 76, 50, 36, 42, 76, 50, 36, 45, 76, 50, - 36, 227, 94, 230, 74, 36, 250, 199, 227, 94, 230, 74, 36, 254, 104, 227, - 94, 230, 74, 36, 148, 188, 50, 36, 245, 116, 188, 50, 36, 246, 193, 250, - 221, 36, 246, 193, 223, 227, 36, 246, 193, 249, 4, 36, 246, 193, 250, - 222, 252, 230, 36, 42, 45, 76, 50, 36, 246, 193, 226, 100, 36, 246, 193, - 236, 152, 36, 246, 193, 220, 55, 229, 28, 221, 90, 36, 227, 160, 224, 18, - 230, 74, 36, 51, 69, 214, 230, 74, 36, 254, 111, 100, 36, 221, 78, 220, - 80, 36, 218, 201, 252, 4, 50, 36, 127, 76, 230, 74, 36, 171, 51, 224, 18, - 230, 74, 36, 90, 243, 177, 2, 192, 247, 129, 36, 127, 243, 177, 2, 192, - 247, 129, 36, 42, 76, 56, 36, 45, 76, 56, 36, 253, 252, 50, 254, 254, - 230, 165, 254, 241, 199, 222, 23, 223, 98, 173, 6, 251, 202, 249, 77, - 251, 88, 251, 85, 235, 44, 100, 251, 136, 230, 165, 251, 165, 220, 86, - 246, 108, 250, 144, 226, 98, 249, 77, 245, 250, 102, 3, 245, 67, 102, 6, - 243, 225, 252, 51, 6, 243, 225, 173, 6, 243, 225, 229, 53, 250, 144, 229, - 53, 250, 145, 104, 124, 229, 108, 102, 6, 72, 252, 51, 6, 72, 102, 6, - 153, 102, 3, 153, 235, 202, 49, 252, 201, 100, 173, 6, 207, 231, 105, 55, - 224, 9, 227, 210, 250, 125, 102, 6, 230, 59, 173, 6, 230, 59, 173, 6, - 228, 163, 102, 6, 152, 252, 51, 6, 152, 173, 6, 152, 228, 239, 222, 129, - 227, 169, 225, 50, 78, 222, 72, 55, 221, 107, 164, 55, 219, 153, 173, 6, - 217, 157, 230, 85, 55, 230, 160, 55, 237, 170, 230, 160, 55, 252, 51, 6, - 217, 157, 215, 23, 3, 1, 237, 162, 236, 175, 55, 254, 118, 55, 102, 6, - 253, 204, 252, 51, 6, 251, 202, 246, 126, 100, 102, 3, 73, 102, 6, 73, - 102, 6, 246, 74, 215, 6, 246, 74, 102, 6, 189, 102, 3, 74, 99, 100, 252, - 105, 100, 244, 92, 100, 249, 178, 100, 237, 205, 224, 7, 227, 59, 6, 228, - 163, 245, 252, 55, 173, 3, 229, 108, 173, 3, 244, 231, 173, 6, 244, 231, - 173, 6, 229, 108, 173, 233, 33, 223, 71, 215, 33, 6, 245, 67, 215, 33, 6, - 153, 210, 33, 6, 153, 215, 33, 6, 218, 90, 173, 30, 6, 250, 46, 173, 30, - 3, 250, 46, 173, 30, 3, 73, 173, 30, 3, 72, 173, 30, 3, 237, 126, 228, - 220, 235, 43, 215, 254, 134, 229, 170, 55, 254, 177, 215, 3, 246, 74, 16, - 35, 213, 224, 7, 219, 55, 245, 108, 131, 225, 40, 219, 55, 245, 108, 131, - 232, 26, 219, 55, 245, 108, 131, 222, 61, 219, 55, 245, 108, 131, 221, - 251, 219, 55, 245, 108, 124, 221, 249, 219, 55, 245, 108, 131, 245, 199, - 219, 55, 245, 108, 124, 245, 198, 219, 55, 245, 108, 148, 245, 198, 219, - 55, 245, 108, 245, 116, 245, 198, 219, 55, 245, 108, 131, 224, 73, 219, - 55, 245, 108, 245, 170, 224, 71, 219, 55, 245, 108, 131, 246, 231, 219, - 55, 245, 108, 148, 246, 229, 219, 55, 245, 108, 245, 170, 246, 229, 219, - 55, 245, 108, 225, 43, 246, 229, 245, 108, 231, 106, 107, 227, 68, 231, - 107, 107, 227, 68, 231, 107, 103, 227, 68, 231, 107, 160, 227, 68, 231, - 107, 154, 227, 68, 231, 107, 174, 227, 68, 231, 107, 182, 227, 68, 231, - 107, 191, 227, 68, 231, 107, 185, 227, 68, 231, 107, 190, 227, 68, 231, - 107, 222, 65, 227, 68, 231, 107, 246, 211, 227, 68, 231, 107, 220, 221, - 227, 68, 231, 107, 245, 196, 227, 68, 231, 107, 131, 242, 161, 227, 68, - 231, 107, 245, 170, 242, 161, 227, 68, 231, 107, 131, 221, 231, 3, 227, - 68, 231, 107, 107, 3, 227, 68, 231, 107, 103, 3, 227, 68, 231, 107, 160, - 3, 227, 68, 231, 107, 154, 3, 227, 68, 231, 107, 174, 3, 227, 68, 231, - 107, 182, 3, 227, 68, 231, 107, 191, 3, 227, 68, 231, 107, 185, 3, 227, - 68, 231, 107, 190, 3, 227, 68, 231, 107, 222, 65, 3, 227, 68, 231, 107, - 246, 211, 3, 227, 68, 231, 107, 220, 221, 3, 227, 68, 231, 107, 245, 196, - 3, 227, 68, 231, 107, 131, 242, 161, 3, 227, 68, 231, 107, 245, 170, 242, - 161, 3, 227, 68, 231, 107, 131, 221, 231, 227, 68, 231, 107, 131, 221, - 232, 251, 203, 250, 46, 227, 68, 231, 107, 245, 170, 221, 231, 227, 68, - 231, 107, 222, 66, 221, 231, 227, 68, 231, 107, 210, 131, 242, 161, 7, 3, - 1, 210, 251, 202, 227, 68, 231, 107, 224, 82, 235, 140, 17, 227, 68, 231, - 107, 245, 197, 247, 10, 17, 227, 68, 231, 107, 245, 197, 221, 231, 227, - 68, 231, 107, 131, 242, 162, 221, 231, 219, 55, 245, 108, 217, 85, 221, - 249, 127, 65, 220, 53, 65, 90, 65, 247, 130, 65, 42, 45, 65, 108, 113, - 65, 231, 187, 218, 217, 65, 231, 187, 247, 5, 65, 224, 6, 247, 5, 65, - 224, 6, 218, 217, 65, 127, 76, 2, 92, 90, 76, 2, 92, 127, 218, 237, 65, - 90, 218, 237, 65, 127, 124, 243, 158, 65, 220, 53, 124, 243, 158, 65, 90, - 124, 243, 158, 65, 247, 130, 124, 243, 158, 65, 127, 76, 2, 222, 135, 90, - 76, 2, 222, 135, 127, 76, 245, 97, 135, 220, 53, 76, 245, 97, 135, 90, - 76, 245, 97, 135, 247, 130, 76, 245, 97, 135, 108, 113, 76, 2, 252, 189, - 127, 76, 2, 96, 90, 76, 2, 96, 127, 76, 2, 234, 247, 90, 76, 2, 234, 247, - 42, 45, 218, 237, 65, 42, 45, 76, 2, 92, 247, 130, 217, 33, 65, 220, 53, - 76, 2, 221, 170, 235, 107, 220, 53, 76, 2, 221, 170, 227, 100, 247, 130, - 76, 2, 221, 170, 235, 107, 247, 130, 76, 2, 221, 170, 227, 100, 90, 76, - 2, 250, 124, 247, 129, 247, 130, 76, 2, 250, 124, 235, 107, 254, 104, - 221, 120, 225, 70, 65, 250, 199, 221, 120, 225, 70, 65, 231, 187, 218, - 217, 76, 199, 171, 135, 127, 76, 199, 252, 201, 104, 90, 76, 199, 135, - 254, 104, 230, 119, 250, 222, 65, 250, 199, 230, 119, 250, 222, 65, 127, - 243, 177, 2, 192, 220, 52, 127, 243, 177, 2, 192, 247, 129, 220, 53, 243, - 177, 2, 192, 227, 100, 220, 53, 243, 177, 2, 192, 235, 107, 90, 243, 177, - 2, 192, 220, 52, 90, 243, 177, 2, 192, 247, 129, 247, 130, 243, 177, 2, - 192, 227, 100, 247, 130, 243, 177, 2, 192, 235, 107, 90, 76, 104, 127, - 65, 220, 53, 76, 127, 117, 247, 130, 65, 127, 76, 104, 90, 65, 127, 230, - 32, 254, 19, 220, 53, 230, 32, 254, 19, 90, 230, 32, 254, 19, 247, 130, - 230, 32, 254, 19, 127, 243, 177, 104, 90, 243, 176, 90, 243, 177, 104, - 127, 243, 176, 127, 51, 76, 2, 92, 42, 45, 51, 76, 2, 92, 90, 51, 76, 2, - 92, 127, 51, 65, 220, 53, 51, 65, 90, 51, 65, 247, 130, 51, 65, 42, 45, - 51, 65, 108, 113, 51, 65, 231, 187, 218, 217, 51, 65, 231, 187, 247, 5, - 51, 65, 224, 6, 247, 5, 51, 65, 224, 6, 218, 217, 51, 65, 127, 221, 78, - 65, 90, 221, 78, 65, 127, 223, 223, 65, 90, 223, 223, 65, 220, 53, 76, 2, - 51, 92, 247, 130, 76, 2, 51, 92, 127, 249, 145, 65, 220, 53, 249, 145, - 65, 90, 249, 145, 65, 247, 130, 249, 145, 65, 127, 76, 199, 135, 90, 76, - 199, 135, 127, 67, 65, 220, 53, 67, 65, 90, 67, 65, 247, 130, 67, 65, - 220, 53, 67, 76, 245, 97, 135, 220, 53, 67, 76, 230, 139, 229, 193, 220, - 53, 67, 76, 230, 139, 229, 194, 2, 186, 135, 220, 53, 67, 76, 230, 139, - 229, 194, 2, 69, 135, 220, 53, 67, 51, 65, 220, 53, 67, 51, 76, 230, 139, - 229, 193, 90, 67, 76, 245, 97, 218, 254, 231, 187, 218, 217, 76, 199, - 250, 123, 224, 6, 247, 5, 76, 199, 250, 123, 108, 113, 67, 65, 45, 76, 2, - 3, 250, 221, 247, 130, 76, 127, 117, 220, 53, 65, 148, 90, 254, 19, 127, - 76, 2, 69, 92, 90, 76, 2, 69, 92, 42, 45, 76, 2, 69, 92, 127, 76, 2, 51, - 69, 92, 90, 76, 2, 51, 69, 92, 42, 45, 76, 2, 51, 69, 92, 127, 230, 117, - 65, 90, 230, 117, 65, 42, 45, 230, 117, 65, 35, 254, 157, 250, 164, 229, - 223, 248, 246, 222, 14, 246, 91, 222, 14, 248, 160, 212, 246, 92, 246, - 199, 225, 45, 237, 215, 232, 231, 246, 213, 230, 165, 212, 254, 132, 246, - 213, 230, 165, 3, 246, 213, 230, 165, 250, 140, 254, 14, 233, 254, 248, - 160, 212, 250, 142, 254, 14, 233, 254, 3, 250, 140, 254, 14, 233, 254, - 246, 190, 117, 228, 222, 233, 33, 228, 229, 233, 33, 250, 128, 233, 33, - 223, 71, 233, 155, 55, 233, 153, 55, 61, 229, 43, 248, 188, 224, 55, 225, - 46, 233, 154, 253, 252, 230, 112, 227, 94, 230, 112, 251, 242, 230, 112, - 40, 227, 64, 250, 89, 227, 64, 245, 110, 227, 64, 228, 218, 101, 237, - 207, 45, 254, 119, 254, 119, 234, 22, 254, 119, 223, 245, 254, 119, 248, - 190, 248, 160, 212, 248, 193, 229, 234, 101, 212, 229, 234, 101, 235, 7, - 254, 126, 235, 7, 230, 105, 237, 174, 220, 74, 237, 186, 51, 237, 186, - 221, 78, 237, 186, 250, 136, 237, 186, 223, 49, 237, 186, 219, 65, 237, - 186, 250, 199, 237, 186, 250, 199, 250, 136, 237, 186, 254, 104, 250, - 136, 237, 186, 222, 13, 252, 138, 227, 224, 228, 219, 61, 233, 154, 246, - 96, 244, 176, 228, 219, 242, 250, 221, 180, 230, 112, 210, 221, 179, 237, - 170, 235, 129, 198, 224, 111, 218, 236, 218, 168, 228, 229, 212, 221, - 179, 233, 155, 221, 179, 253, 247, 114, 101, 212, 253, 247, 114, 101, - 254, 72, 114, 101, 254, 72, 251, 222, 212, 254, 249, 114, 101, 232, 135, - 254, 72, 231, 190, 254, 249, 114, 101, 254, 151, 114, 101, 212, 254, 151, - 114, 101, 254, 151, 114, 156, 114, 101, 221, 78, 221, 179, 254, 158, 114, - 101, 246, 150, 101, 244, 175, 246, 150, 101, 248, 247, 252, 99, 254, 74, - 222, 23, 235, 51, 244, 175, 114, 101, 254, 72, 114, 199, 156, 222, 23, - 237, 237, 230, 165, 237, 237, 117, 156, 254, 72, 114, 101, 250, 176, 246, - 153, 246, 154, 250, 175, 227, 94, 237, 224, 114, 101, 227, 94, 114, 101, - 250, 117, 101, 246, 125, 246, 152, 101, 223, 157, 246, 153, 249, 63, 114, - 101, 114, 199, 251, 213, 249, 78, 234, 22, 251, 212, 228, 80, 114, 101, - 212, 114, 101, 242, 59, 101, 212, 242, 59, 101, 223, 123, 246, 150, 101, - 235, 87, 156, 114, 101, 244, 30, 156, 114, 101, 235, 87, 104, 114, 101, - 244, 30, 104, 114, 101, 235, 87, 251, 222, 212, 114, 101, 244, 30, 251, - 222, 212, 114, 101, 233, 95, 235, 86, 233, 95, 244, 29, 252, 99, 212, - 246, 150, 101, 212, 235, 86, 212, 244, 29, 232, 135, 235, 87, 231, 190, - 114, 101, 232, 135, 244, 30, 231, 190, 114, 101, 235, 87, 156, 246, 150, - 101, 244, 30, 156, 246, 150, 101, 232, 135, 235, 87, 231, 190, 246, 150, - 101, 232, 135, 244, 30, 231, 190, 246, 150, 101, 235, 87, 156, 244, 29, - 244, 30, 156, 235, 86, 232, 135, 235, 87, 231, 190, 244, 29, 232, 135, - 244, 30, 231, 190, 235, 86, 228, 244, 223, 84, 228, 245, 156, 114, 101, - 223, 85, 156, 114, 101, 228, 245, 156, 246, 150, 101, 223, 85, 156, 246, - 150, 101, 248, 160, 212, 228, 247, 248, 160, 212, 223, 86, 223, 93, 230, - 165, 223, 58, 230, 165, 212, 112, 223, 93, 230, 165, 212, 112, 223, 58, - 230, 165, 223, 93, 117, 156, 114, 101, 223, 58, 117, 156, 114, 101, 232, - 135, 112, 223, 93, 117, 231, 190, 114, 101, 232, 135, 112, 223, 58, 117, - 231, 190, 114, 101, 223, 93, 117, 2, 212, 114, 101, 223, 58, 117, 2, 212, - 114, 101, 233, 81, 233, 82, 233, 83, 233, 82, 220, 74, 40, 237, 237, 230, - 165, 40, 230, 101, 230, 165, 40, 237, 237, 117, 156, 114, 101, 40, 230, - 101, 117, 156, 114, 101, 40, 251, 143, 40, 250, 82, 34, 229, 43, 34, 233, - 154, 34, 221, 176, 34, 248, 188, 224, 55, 34, 61, 230, 112, 34, 227, 94, - 230, 112, 34, 253, 252, 230, 112, 34, 246, 153, 34, 249, 146, 204, 229, - 43, 204, 233, 154, 204, 221, 176, 204, 61, 230, 112, 45, 222, 143, 42, - 222, 143, 113, 222, 143, 108, 222, 143, 253, 255, 233, 133, 221, 62, 245, - 128, 221, 78, 69, 252, 201, 45, 220, 236, 51, 69, 252, 201, 51, 45, 220, - 236, 248, 160, 212, 228, 214, 212, 221, 62, 248, 160, 212, 245, 129, 232, - 138, 51, 69, 252, 201, 51, 45, 220, 236, 228, 245, 220, 82, 227, 192, - 223, 85, 220, 82, 227, 192, 231, 188, 223, 101, 230, 165, 250, 140, 254, - 14, 231, 188, 223, 100, 231, 188, 223, 101, 117, 156, 114, 101, 250, 140, - 254, 14, 231, 188, 223, 101, 156, 114, 101, 230, 101, 230, 165, 237, 237, - 230, 165, 233, 87, 243, 131, 250, 150, 234, 49, 237, 183, 218, 118, 232, - 216, 231, 189, 45, 254, 120, 2, 254, 51, 45, 221, 90, 233, 33, 235, 7, - 254, 126, 233, 33, 235, 7, 230, 105, 233, 33, 237, 174, 233, 33, 220, 74, - 249, 5, 230, 112, 61, 230, 112, 223, 157, 230, 112, 248, 188, 221, 176, - 252, 22, 42, 231, 188, 245, 251, 225, 66, 228, 229, 45, 231, 188, 245, - 251, 225, 66, 228, 229, 42, 225, 66, 228, 229, 45, 225, 66, 228, 229, - 210, 221, 180, 246, 153, 250, 79, 235, 7, 230, 105, 250, 79, 235, 7, 254, - 126, 51, 223, 92, 51, 223, 57, 51, 237, 174, 51, 220, 74, 229, 62, 114, - 25, 229, 234, 101, 235, 87, 2, 248, 145, 244, 30, 2, 248, 145, 219, 100, - 233, 95, 235, 86, 219, 100, 233, 95, 244, 29, 235, 87, 114, 199, 156, - 244, 29, 244, 30, 114, 199, 156, 235, 86, 114, 199, 156, 235, 86, 114, - 199, 156, 244, 29, 114, 199, 156, 228, 244, 114, 199, 156, 223, 84, 248, - 160, 212, 228, 248, 156, 246, 155, 248, 160, 212, 223, 87, 156, 246, 155, - 212, 40, 237, 237, 117, 156, 114, 101, 212, 40, 230, 101, 117, 156, 114, - 101, 40, 237, 237, 117, 156, 212, 114, 101, 40, 230, 101, 117, 156, 212, - 114, 101, 235, 87, 251, 222, 212, 246, 150, 101, 244, 30, 251, 222, 212, - 246, 150, 101, 228, 245, 251, 222, 212, 246, 150, 101, 223, 85, 251, 222, - 212, 246, 150, 101, 212, 231, 188, 223, 101, 230, 165, 248, 160, 212, - 250, 142, 254, 14, 231, 188, 223, 100, 212, 231, 188, 223, 101, 117, 156, - 114, 101, 248, 160, 212, 250, 142, 254, 14, 231, 188, 223, 101, 156, 246, - 155, 69, 246, 208, 233, 191, 186, 246, 208, 108, 45, 249, 11, 246, 208, - 113, 45, 249, 11, 246, 208, 246, 213, 117, 2, 171, 186, 92, 246, 213, - 117, 2, 69, 252, 201, 253, 245, 246, 190, 117, 186, 92, 3, 246, 213, 117, - 2, 69, 252, 201, 253, 245, 246, 190, 117, 186, 92, 246, 213, 117, 2, 61, - 50, 246, 213, 117, 2, 230, 77, 3, 246, 213, 117, 2, 230, 77, 246, 213, - 117, 2, 220, 81, 246, 213, 117, 2, 124, 186, 223, 107, 250, 140, 2, 171, - 186, 92, 250, 140, 2, 69, 252, 201, 253, 245, 246, 190, 117, 186, 92, 3, - 250, 140, 2, 69, 252, 201, 253, 245, 246, 190, 117, 186, 92, 250, 140, 2, - 230, 77, 3, 250, 140, 2, 230, 77, 217, 158, 165, 252, 226, 233, 253, 249, - 6, 55, 246, 215, 65, 242, 182, 108, 254, 20, 113, 254, 20, 228, 225, 229, - 156, 218, 235, 235, 43, 42, 251, 90, 45, 251, 90, 42, 245, 149, 45, 245, - 149, 252, 29, 45, 250, 102, 252, 29, 42, 250, 102, 221, 120, 45, 250, - 102, 221, 120, 42, 250, 102, 210, 212, 55, 40, 234, 234, 254, 51, 226, - 80, 226, 85, 222, 72, 227, 211, 229, 16, 237, 211, 219, 88, 223, 227, - 229, 57, 117, 237, 182, 55, 215, 212, 55, 218, 242, 242, 183, 221, 120, - 42, 250, 123, 221, 120, 45, 250, 123, 252, 29, 42, 250, 123, 252, 29, 45, - 250, 123, 221, 120, 144, 237, 186, 252, 29, 144, 237, 186, 245, 95, 224, - 39, 108, 254, 21, 252, 100, 124, 186, 252, 191, 230, 107, 236, 154, 246, - 146, 199, 222, 23, 227, 109, 218, 152, 237, 224, 112, 227, 209, 252, 21, - 236, 153, 235, 112, 254, 120, 115, 227, 106, 254, 120, 115, 246, 146, - 199, 222, 23, 235, 115, 252, 111, 227, 93, 250, 56, 254, 158, 254, 28, - 222, 227, 221, 112, 227, 9, 248, 228, 230, 102, 250, 152, 222, 113, 224, - 49, 250, 114, 250, 113, 179, 180, 16, 242, 104, 179, 180, 16, 223, 221, - 228, 95, 179, 180, 16, 228, 96, 246, 155, 179, 180, 16, 228, 96, 248, - 193, 179, 180, 16, 228, 96, 249, 4, 179, 180, 16, 228, 96, 237, 47, 179, - 180, 16, 228, 96, 250, 221, 179, 180, 16, 250, 222, 223, 142, 179, 180, - 16, 250, 222, 237, 47, 179, 180, 16, 224, 56, 135, 179, 180, 16, 252, - 231, 135, 179, 180, 16, 228, 96, 224, 55, 179, 180, 16, 228, 96, 252, - 230, 179, 180, 16, 228, 96, 235, 86, 179, 180, 16, 228, 96, 244, 29, 179, - 180, 16, 127, 219, 183, 179, 180, 16, 90, 219, 183, 179, 180, 16, 228, - 96, 127, 65, 179, 180, 16, 228, 96, 90, 65, 179, 180, 16, 250, 222, 252, - 230, 179, 180, 16, 113, 222, 144, 220, 81, 179, 180, 16, 249, 63, 223, - 142, 179, 180, 16, 228, 96, 113, 251, 134, 179, 180, 16, 228, 96, 249, - 62, 179, 180, 16, 113, 222, 144, 237, 47, 179, 180, 16, 220, 53, 219, - 183, 179, 180, 16, 228, 96, 220, 53, 65, 179, 180, 16, 108, 222, 144, - 230, 77, 179, 180, 16, 249, 72, 223, 142, 179, 180, 16, 228, 96, 108, - 251, 134, 179, 180, 16, 228, 96, 249, 71, 179, 180, 16, 108, 222, 144, - 237, 47, 179, 180, 16, 247, 130, 219, 183, 179, 180, 16, 228, 96, 247, - 130, 65, 179, 180, 16, 228, 68, 220, 81, 179, 180, 16, 249, 63, 220, 81, - 179, 180, 16, 249, 5, 220, 81, 179, 180, 16, 237, 48, 220, 81, 179, 180, - 16, 250, 222, 220, 81, 179, 180, 16, 108, 224, 198, 237, 47, 179, 180, - 16, 228, 68, 228, 95, 179, 180, 16, 250, 222, 223, 156, 179, 180, 16, - 228, 96, 250, 175, 179, 180, 16, 108, 222, 144, 249, 13, 179, 180, 16, - 249, 72, 249, 13, 179, 180, 16, 223, 157, 249, 13, 179, 180, 16, 237, 48, - 249, 13, 179, 180, 16, 250, 222, 249, 13, 179, 180, 16, 113, 224, 198, - 223, 142, 179, 180, 16, 42, 224, 198, 223, 142, 179, 180, 16, 221, 180, - 249, 13, 179, 180, 16, 244, 30, 249, 13, 179, 180, 16, 250, 169, 135, - 179, 180, 16, 249, 72, 221, 179, 179, 180, 16, 217, 32, 179, 180, 16, - 223, 143, 221, 179, 179, 180, 16, 225, 68, 220, 81, 179, 180, 16, 228, - 96, 212, 246, 155, 179, 180, 16, 228, 96, 228, 81, 179, 180, 16, 113, - 251, 135, 221, 179, 179, 180, 16, 108, 251, 135, 221, 179, 179, 180, 16, - 237, 162, 179, 180, 16, 227, 149, 179, 180, 16, 230, 143, 179, 180, 16, - 254, 147, 220, 81, 179, 180, 16, 246, 157, 220, 81, 179, 180, 16, 237, - 163, 220, 81, 179, 180, 16, 230, 144, 220, 81, 179, 180, 16, 254, 146, - 212, 251, 45, 78, 45, 254, 120, 2, 247, 130, 217, 33, 65, 224, 177, 230, - 119, 252, 21, 252, 120, 100, 69, 235, 44, 2, 233, 193, 248, 145, 237, - 191, 100, 250, 137, 220, 79, 100, 248, 204, 220, 79, 100, 246, 201, 100, - 250, 160, 100, 67, 40, 2, 251, 85, 69, 235, 43, 246, 179, 100, 254, 142, - 236, 155, 100, 243, 142, 100, 34, 186, 252, 201, 2, 231, 183, 34, 221, - 91, 247, 132, 252, 1, 250, 222, 2, 231, 186, 65, 220, 77, 100, 233, 122, - 100, 242, 117, 100, 230, 118, 243, 224, 100, 230, 118, 235, 200, 100, - 229, 218, 100, 229, 217, 100, 248, 210, 250, 77, 16, 245, 124, 103, 224, - 20, 100, 179, 180, 16, 228, 95, 249, 86, 225, 55, 236, 155, 100, 228, - 237, 230, 34, 232, 120, 230, 34, 228, 234, 226, 101, 100, 250, 209, 226, - 101, 100, 42, 229, 230, 220, 60, 96, 42, 229, 230, 246, 86, 42, 229, 230, - 234, 237, 96, 45, 229, 230, 220, 60, 96, 45, 229, 230, 246, 86, 45, 229, - 230, 234, 237, 96, 42, 40, 252, 18, 220, 60, 250, 123, 42, 40, 252, 18, - 246, 86, 42, 40, 252, 18, 234, 237, 250, 123, 45, 40, 252, 18, 220, 60, - 250, 123, 45, 40, 252, 18, 246, 86, 45, 40, 252, 18, 234, 237, 250, 123, - 42, 250, 79, 252, 18, 220, 60, 96, 42, 250, 79, 252, 18, 233, 193, 229, - 102, 42, 250, 79, 252, 18, 234, 237, 96, 250, 79, 252, 18, 246, 86, 45, - 250, 79, 252, 18, 220, 60, 96, 45, 250, 79, 252, 18, 233, 193, 229, 102, - 45, 250, 79, 252, 18, 234, 237, 96, 237, 187, 246, 86, 186, 235, 44, 246, - 86, 220, 60, 42, 156, 234, 237, 45, 250, 79, 252, 18, 226, 86, 220, 60, - 45, 156, 234, 237, 42, 250, 79, 252, 18, 226, 86, 223, 72, 221, 119, 223, - 72, 252, 28, 221, 120, 40, 115, 252, 29, 40, 115, 252, 29, 40, 252, 18, - 104, 221, 120, 40, 115, 32, 16, 252, 28, 42, 69, 86, 235, 43, 45, 69, 86, - 235, 43, 186, 226, 112, 235, 42, 186, 226, 112, 235, 41, 186, 226, 112, - 235, 40, 186, 226, 112, 235, 39, 249, 54, 16, 170, 69, 25, 221, 120, 227, - 109, 249, 54, 16, 170, 69, 25, 252, 29, 227, 109, 249, 54, 16, 170, 69, - 2, 250, 221, 249, 54, 16, 170, 113, 25, 186, 2, 250, 221, 249, 54, 16, - 170, 108, 25, 186, 2, 250, 221, 249, 54, 16, 170, 69, 2, 221, 90, 249, - 54, 16, 170, 113, 25, 186, 2, 221, 90, 249, 54, 16, 170, 108, 25, 186, 2, - 221, 90, 249, 54, 16, 170, 69, 25, 218, 236, 249, 54, 16, 170, 113, 25, - 186, 2, 218, 236, 249, 54, 16, 170, 108, 25, 186, 2, 218, 236, 249, 54, - 16, 170, 113, 25, 242, 241, 249, 54, 16, 170, 108, 25, 242, 241, 249, 54, - 16, 170, 69, 25, 221, 120, 235, 115, 249, 54, 16, 170, 69, 25, 252, 29, - 235, 115, 40, 245, 133, 227, 163, 100, 246, 225, 100, 69, 235, 44, 246, - 86, 233, 233, 252, 8, 233, 233, 171, 104, 224, 191, 233, 233, 224, 192, - 104, 235, 2, 233, 233, 171, 104, 124, 224, 179, 233, 233, 124, 224, 180, - 104, 235, 2, 233, 233, 124, 224, 180, 237, 55, 233, 233, 221, 75, 233, - 233, 222, 43, 233, 233, 229, 174, 247, 9, 244, 24, 245, 81, 221, 120, - 229, 229, 252, 29, 229, 229, 221, 120, 250, 79, 115, 252, 29, 250, 79, - 115, 221, 120, 221, 114, 224, 236, 115, 252, 29, 221, 114, 224, 236, 115, - 67, 221, 101, 252, 111, 227, 94, 2, 250, 221, 223, 129, 245, 155, 255, 3, - 250, 76, 246, 214, 237, 174, 249, 86, 246, 88, 100, 16, 35, 231, 110, 16, - 35, 223, 154, 117, 243, 157, 16, 35, 223, 154, 117, 222, 39, 16, 35, 246, - 190, 117, 222, 39, 16, 35, 246, 190, 117, 221, 104, 16, 35, 246, 181, 16, - 35, 254, 252, 16, 35, 252, 119, 16, 35, 252, 229, 16, 35, 186, 222, 145, - 16, 35, 235, 44, 245, 224, 16, 35, 69, 222, 145, 16, 35, 245, 124, 245, - 224, 16, 35, 251, 128, 227, 162, 16, 35, 224, 217, 230, 83, 16, 35, 224, - 217, 237, 223, 16, 35, 249, 142, 235, 34, 246, 135, 16, 35, 249, 42, 250, - 132, 107, 16, 35, 249, 42, 250, 132, 103, 16, 35, 249, 42, 250, 132, 160, - 16, 35, 249, 42, 250, 132, 154, 16, 35, 232, 136, 254, 252, 16, 35, 222, - 224, 238, 28, 16, 35, 246, 190, 117, 221, 105, 252, 45, 16, 35, 251, 152, - 16, 35, 246, 190, 117, 234, 17, 16, 35, 223, 90, 16, 35, 246, 135, 16, - 35, 245, 189, 225, 54, 16, 35, 244, 23, 225, 54, 16, 35, 227, 212, 225, - 54, 16, 35, 220, 73, 225, 54, 16, 35, 223, 254, 16, 35, 249, 69, 252, 48, - 100, 230, 119, 252, 21, 16, 35, 232, 122, 16, 35, 249, 70, 245, 124, 103, - 16, 35, 223, 91, 245, 124, 103, 230, 171, 96, 230, 171, 251, 64, 230, - 171, 245, 127, 230, 171, 237, 170, 245, 127, 230, 171, 252, 117, 251, - 247, 230, 171, 252, 25, 221, 200, 230, 171, 252, 15, 252, 204, 242, 58, - 230, 171, 254, 135, 117, 251, 44, 230, 171, 249, 146, 230, 171, 250, 70, - 254, 254, 231, 108, 230, 171, 51, 252, 230, 34, 20, 107, 34, 20, 103, 34, - 20, 160, 34, 20, 154, 34, 20, 174, 34, 20, 182, 34, 20, 191, 34, 20, 185, - 34, 20, 190, 34, 54, 222, 65, 34, 54, 246, 211, 34, 54, 220, 221, 34, 54, - 221, 247, 34, 54, 245, 111, 34, 54, 245, 200, 34, 54, 224, 77, 34, 54, - 225, 41, 34, 54, 246, 233, 34, 54, 232, 29, 34, 54, 220, 219, 82, 20, - 107, 82, 20, 103, 82, 20, 160, 82, 20, 154, 82, 20, 174, 82, 20, 182, 82, - 20, 191, 82, 20, 185, 82, 20, 190, 82, 54, 222, 65, 82, 54, 246, 211, 82, - 54, 220, 221, 82, 54, 221, 247, 82, 54, 245, 111, 82, 54, 245, 200, 82, - 54, 224, 77, 82, 54, 225, 41, 82, 54, 246, 233, 82, 54, 232, 29, 82, 54, - 220, 219, 20, 131, 245, 90, 223, 136, 20, 124, 245, 90, 223, 136, 20, - 148, 245, 90, 223, 136, 20, 245, 116, 245, 90, 223, 136, 20, 245, 170, - 245, 90, 223, 136, 20, 224, 82, 245, 90, 223, 136, 20, 225, 43, 245, 90, - 223, 136, 20, 246, 235, 245, 90, 223, 136, 20, 232, 31, 245, 90, 223, - 136, 54, 222, 66, 245, 90, 223, 136, 54, 246, 212, 245, 90, 223, 136, 54, - 220, 222, 245, 90, 223, 136, 54, 221, 248, 245, 90, 223, 136, 54, 245, - 112, 245, 90, 223, 136, 54, 245, 201, 245, 90, 223, 136, 54, 224, 78, - 245, 90, 223, 136, 54, 225, 42, 245, 90, 223, 136, 54, 246, 234, 245, 90, - 223, 136, 54, 232, 30, 245, 90, 223, 136, 54, 220, 220, 245, 90, 223, - 136, 82, 7, 3, 1, 60, 82, 7, 3, 1, 253, 204, 82, 7, 3, 1, 251, 202, 82, - 7, 3, 1, 250, 46, 82, 7, 3, 1, 73, 82, 7, 3, 1, 246, 74, 82, 7, 3, 1, - 245, 67, 82, 7, 3, 1, 243, 225, 82, 7, 3, 1, 72, 82, 7, 3, 1, 237, 126, - 82, 7, 3, 1, 237, 17, 82, 7, 3, 1, 153, 82, 7, 3, 1, 189, 82, 7, 3, 1, - 207, 82, 7, 3, 1, 74, 82, 7, 3, 1, 230, 59, 82, 7, 3, 1, 228, 163, 82, 7, - 3, 1, 152, 82, 7, 3, 1, 198, 82, 7, 3, 1, 222, 201, 82, 7, 3, 1, 68, 82, - 7, 3, 1, 216, 216, 82, 7, 3, 1, 219, 40, 82, 7, 3, 1, 218, 151, 82, 7, 3, - 1, 218, 90, 82, 7, 3, 1, 217, 157, 34, 7, 6, 1, 60, 34, 7, 6, 1, 253, - 204, 34, 7, 6, 1, 251, 202, 34, 7, 6, 1, 250, 46, 34, 7, 6, 1, 73, 34, 7, - 6, 1, 246, 74, 34, 7, 6, 1, 245, 67, 34, 7, 6, 1, 243, 225, 34, 7, 6, 1, - 72, 34, 7, 6, 1, 237, 126, 34, 7, 6, 1, 237, 17, 34, 7, 6, 1, 153, 34, 7, - 6, 1, 189, 34, 7, 6, 1, 207, 34, 7, 6, 1, 74, 34, 7, 6, 1, 230, 59, 34, - 7, 6, 1, 228, 163, 34, 7, 6, 1, 152, 34, 7, 6, 1, 198, 34, 7, 6, 1, 222, - 201, 34, 7, 6, 1, 68, 34, 7, 6, 1, 216, 216, 34, 7, 6, 1, 219, 40, 34, 7, - 6, 1, 218, 151, 34, 7, 6, 1, 218, 90, 34, 7, 6, 1, 217, 157, 34, 7, 3, 1, - 60, 34, 7, 3, 1, 253, 204, 34, 7, 3, 1, 251, 202, 34, 7, 3, 1, 250, 46, - 34, 7, 3, 1, 73, 34, 7, 3, 1, 246, 74, 34, 7, 3, 1, 245, 67, 34, 7, 3, 1, - 243, 225, 34, 7, 3, 1, 72, 34, 7, 3, 1, 237, 126, 34, 7, 3, 1, 237, 17, - 34, 7, 3, 1, 153, 34, 7, 3, 1, 189, 34, 7, 3, 1, 207, 34, 7, 3, 1, 74, - 34, 7, 3, 1, 230, 59, 34, 7, 3, 1, 228, 163, 34, 7, 3, 1, 152, 34, 7, 3, - 1, 198, 34, 7, 3, 1, 222, 201, 34, 7, 3, 1, 68, 34, 7, 3, 1, 216, 216, - 34, 7, 3, 1, 219, 40, 34, 7, 3, 1, 218, 151, 34, 7, 3, 1, 218, 90, 34, 7, - 3, 1, 217, 157, 34, 20, 217, 84, 232, 136, 34, 54, 246, 211, 232, 136, - 34, 54, 220, 221, 232, 136, 34, 54, 221, 247, 232, 136, 34, 54, 245, 111, - 232, 136, 34, 54, 245, 200, 232, 136, 34, 54, 224, 77, 232, 136, 34, 54, - 225, 41, 232, 136, 34, 54, 246, 233, 232, 136, 34, 54, 232, 29, 232, 136, - 34, 54, 220, 219, 51, 34, 20, 107, 51, 34, 20, 103, 51, 34, 20, 160, 51, - 34, 20, 154, 51, 34, 20, 174, 51, 34, 20, 182, 51, 34, 20, 191, 51, 34, - 20, 185, 51, 34, 20, 190, 51, 34, 54, 222, 65, 232, 136, 34, 20, 217, 84, - 86, 89, 170, 242, 241, 86, 89, 106, 242, 241, 86, 89, 170, 219, 152, 86, - 89, 106, 219, 152, 86, 89, 170, 221, 78, 249, 147, 242, 241, 86, 89, 106, - 221, 78, 249, 147, 242, 241, 86, 89, 170, 221, 78, 249, 147, 219, 152, - 86, 89, 106, 221, 78, 249, 147, 219, 152, 86, 89, 170, 228, 92, 249, 147, - 242, 241, 86, 89, 106, 228, 92, 249, 147, 242, 241, 86, 89, 170, 228, 92, - 249, 147, 219, 152, 86, 89, 106, 228, 92, 249, 147, 219, 152, 86, 89, - 170, 113, 25, 227, 109, 86, 89, 113, 170, 25, 45, 243, 149, 86, 89, 113, - 106, 25, 45, 235, 58, 86, 89, 106, 113, 25, 227, 109, 86, 89, 170, 113, - 25, 235, 115, 86, 89, 113, 170, 25, 42, 243, 149, 86, 89, 113, 106, 25, - 42, 235, 58, 86, 89, 106, 113, 25, 235, 115, 86, 89, 170, 108, 25, 227, - 109, 86, 89, 108, 170, 25, 45, 243, 149, 86, 89, 108, 106, 25, 45, 235, - 58, 86, 89, 106, 108, 25, 227, 109, 86, 89, 170, 108, 25, 235, 115, 86, - 89, 108, 170, 25, 42, 243, 149, 86, 89, 108, 106, 25, 42, 235, 58, 86, - 89, 106, 108, 25, 235, 115, 86, 89, 170, 69, 25, 227, 109, 86, 89, 69, - 170, 25, 45, 243, 149, 86, 89, 108, 106, 25, 45, 113, 235, 58, 86, 89, - 113, 106, 25, 45, 108, 235, 58, 86, 89, 69, 106, 25, 45, 235, 58, 86, 89, - 113, 170, 25, 45, 108, 243, 149, 86, 89, 108, 170, 25, 45, 113, 243, 149, - 86, 89, 106, 69, 25, 227, 109, 86, 89, 170, 69, 25, 235, 115, 86, 89, 69, - 170, 25, 42, 243, 149, 86, 89, 108, 106, 25, 42, 113, 235, 58, 86, 89, - 113, 106, 25, 42, 108, 235, 58, 86, 89, 69, 106, 25, 42, 235, 58, 86, 89, - 113, 170, 25, 42, 108, 243, 149, 86, 89, 108, 170, 25, 42, 113, 243, 149, - 86, 89, 106, 69, 25, 235, 115, 86, 89, 170, 113, 25, 242, 241, 86, 89, - 42, 106, 25, 45, 113, 235, 58, 86, 89, 45, 106, 25, 42, 113, 235, 58, 86, - 89, 113, 170, 25, 186, 243, 149, 86, 89, 113, 106, 25, 186, 235, 58, 86, - 89, 45, 170, 25, 42, 113, 243, 149, 86, 89, 42, 170, 25, 45, 113, 243, - 149, 86, 89, 106, 113, 25, 242, 241, 86, 89, 170, 108, 25, 242, 241, 86, - 89, 42, 106, 25, 45, 108, 235, 58, 86, 89, 45, 106, 25, 42, 108, 235, 58, - 86, 89, 108, 170, 25, 186, 243, 149, 86, 89, 108, 106, 25, 186, 235, 58, - 86, 89, 45, 170, 25, 42, 108, 243, 149, 86, 89, 42, 170, 25, 45, 108, - 243, 149, 86, 89, 106, 108, 25, 242, 241, 86, 89, 170, 69, 25, 242, 241, - 86, 89, 42, 106, 25, 45, 69, 235, 58, 86, 89, 45, 106, 25, 42, 69, 235, - 58, 86, 89, 69, 170, 25, 186, 243, 149, 86, 89, 108, 106, 25, 113, 186, - 235, 58, 86, 89, 113, 106, 25, 108, 186, 235, 58, 86, 89, 69, 106, 25, - 186, 235, 58, 86, 89, 42, 108, 106, 25, 45, 113, 235, 58, 86, 89, 45, - 108, 106, 25, 42, 113, 235, 58, 86, 89, 42, 113, 106, 25, 45, 108, 235, - 58, 86, 89, 45, 113, 106, 25, 42, 108, 235, 58, 86, 89, 113, 170, 25, - 108, 186, 243, 149, 86, 89, 108, 170, 25, 113, 186, 243, 149, 86, 89, 45, - 170, 25, 42, 69, 243, 149, 86, 89, 42, 170, 25, 45, 69, 243, 149, 86, 89, - 106, 69, 25, 242, 241, 86, 89, 170, 51, 249, 147, 242, 241, 86, 89, 106, - 51, 249, 147, 242, 241, 86, 89, 170, 51, 249, 147, 219, 152, 86, 89, 106, - 51, 249, 147, 219, 152, 86, 89, 51, 242, 241, 86, 89, 51, 219, 152, 86, - 89, 113, 224, 109, 25, 45, 247, 138, 86, 89, 113, 51, 25, 45, 224, 108, - 86, 89, 51, 113, 25, 227, 109, 86, 89, 113, 224, 109, 25, 42, 247, 138, - 86, 89, 113, 51, 25, 42, 224, 108, 86, 89, 51, 113, 25, 235, 115, 86, 89, - 108, 224, 109, 25, 45, 247, 138, 86, 89, 108, 51, 25, 45, 224, 108, 86, - 89, 51, 108, 25, 227, 109, 86, 89, 108, 224, 109, 25, 42, 247, 138, 86, - 89, 108, 51, 25, 42, 224, 108, 86, 89, 51, 108, 25, 235, 115, 86, 89, 69, - 224, 109, 25, 45, 247, 138, 86, 89, 69, 51, 25, 45, 224, 108, 86, 89, 51, - 69, 25, 227, 109, 86, 89, 69, 224, 109, 25, 42, 247, 138, 86, 89, 69, 51, - 25, 42, 224, 108, 86, 89, 51, 69, 25, 235, 115, 86, 89, 113, 224, 109, - 25, 186, 247, 138, 86, 89, 113, 51, 25, 186, 224, 108, 86, 89, 51, 113, - 25, 242, 241, 86, 89, 108, 224, 109, 25, 186, 247, 138, 86, 89, 108, 51, - 25, 186, 224, 108, 86, 89, 51, 108, 25, 242, 241, 86, 89, 69, 224, 109, - 25, 186, 247, 138, 86, 89, 69, 51, 25, 186, 224, 108, 86, 89, 51, 69, 25, - 242, 241, 86, 89, 170, 254, 52, 113, 25, 227, 109, 86, 89, 170, 254, 52, - 113, 25, 235, 115, 86, 89, 170, 254, 52, 108, 25, 235, 115, 86, 89, 170, - 254, 52, 108, 25, 227, 109, 86, 89, 170, 249, 11, 220, 60, 45, 199, 234, - 237, 235, 115, 86, 89, 170, 249, 11, 220, 60, 42, 199, 234, 237, 227, - 109, 86, 89, 170, 249, 11, 250, 100, 86, 89, 170, 235, 115, 86, 89, 170, - 220, 63, 86, 89, 170, 227, 109, 86, 89, 170, 247, 132, 86, 89, 106, 235, - 115, 86, 89, 106, 220, 63, 86, 89, 106, 227, 109, 86, 89, 106, 247, 132, - 86, 89, 170, 42, 25, 106, 227, 109, 86, 89, 170, 108, 25, 106, 247, 132, - 86, 89, 106, 42, 25, 170, 227, 109, 86, 89, 106, 108, 25, 170, 247, 132, - 220, 60, 144, 252, 45, 234, 237, 131, 246, 232, 252, 45, 234, 237, 131, - 228, 90, 252, 45, 234, 237, 148, 246, 230, 252, 45, 234, 237, 144, 252, - 45, 234, 237, 245, 170, 246, 230, 252, 45, 234, 237, 148, 228, 88, 252, - 45, 234, 237, 225, 43, 246, 230, 252, 45, 245, 90, 252, 45, 42, 225, 43, - 246, 230, 252, 45, 42, 148, 228, 88, 252, 45, 42, 245, 170, 246, 230, - 252, 45, 42, 144, 252, 45, 42, 148, 246, 230, 252, 45, 42, 131, 228, 90, - 252, 45, 42, 131, 246, 232, 252, 45, 45, 144, 252, 45, 170, 225, 15, 234, - 18, 225, 15, 249, 152, 225, 15, 220, 60, 131, 246, 232, 252, 45, 45, 131, - 246, 232, 252, 45, 228, 94, 234, 237, 235, 115, 228, 94, 234, 237, 227, - 109, 228, 94, 220, 60, 235, 115, 228, 94, 220, 60, 42, 25, 234, 237, 42, - 25, 234, 237, 227, 109, 228, 94, 220, 60, 42, 25, 234, 237, 227, 109, - 228, 94, 220, 60, 42, 25, 220, 60, 45, 25, 234, 237, 235, 115, 228, 94, - 220, 60, 42, 25, 220, 60, 45, 25, 234, 237, 227, 109, 228, 94, 220, 60, - 227, 109, 228, 94, 220, 60, 45, 25, 234, 237, 235, 115, 228, 94, 220, 60, - 45, 25, 234, 237, 42, 25, 234, 237, 227, 109, 84, 223, 227, 67, 223, 227, - 67, 40, 2, 227, 55, 250, 122, 67, 40, 250, 141, 84, 3, 223, 227, 40, 2, - 186, 245, 187, 40, 2, 69, 245, 187, 40, 2, 230, 95, 250, 96, 245, 187, - 40, 2, 220, 60, 42, 199, 234, 237, 45, 245, 187, 40, 2, 220, 60, 45, 199, - 234, 237, 42, 245, 187, 40, 2, 249, 11, 250, 96, 245, 187, 84, 3, 223, - 227, 67, 3, 223, 227, 84, 227, 208, 67, 227, 208, 84, 69, 227, 208, 67, - 69, 227, 208, 84, 229, 232, 67, 229, 232, 84, 220, 62, 221, 90, 67, 220, - 62, 221, 90, 84, 220, 62, 3, 221, 90, 67, 220, 62, 3, 221, 90, 84, 227, - 106, 221, 90, 67, 227, 106, 221, 90, 84, 227, 106, 3, 221, 90, 67, 227, - 106, 3, 221, 90, 84, 227, 106, 229, 29, 67, 227, 106, 229, 29, 84, 247, - 131, 221, 90, 67, 247, 131, 221, 90, 84, 247, 131, 3, 221, 90, 67, 247, - 131, 3, 221, 90, 84, 235, 112, 221, 90, 67, 235, 112, 221, 90, 84, 235, - 112, 3, 221, 90, 67, 235, 112, 3, 221, 90, 84, 235, 112, 229, 29, 67, - 235, 112, 229, 29, 84, 249, 4, 67, 249, 4, 67, 249, 5, 250, 141, 84, 3, - 249, 4, 245, 175, 234, 234, 67, 250, 221, 247, 143, 250, 221, 250, 222, - 2, 69, 245, 187, 251, 239, 84, 250, 221, 250, 222, 2, 42, 144, 252, 53, - 250, 222, 2, 45, 144, 252, 53, 250, 222, 2, 234, 237, 144, 252, 53, 250, - 222, 2, 220, 60, 144, 252, 53, 250, 222, 2, 220, 60, 45, 228, 94, 252, - 53, 250, 222, 2, 254, 158, 251, 222, 220, 60, 42, 228, 94, 252, 53, 42, - 144, 84, 250, 221, 45, 144, 84, 250, 221, 237, 171, 251, 241, 237, 171, - 67, 250, 221, 220, 60, 144, 237, 171, 67, 250, 221, 234, 237, 144, 237, - 171, 67, 250, 221, 220, 60, 42, 228, 94, 250, 219, 254, 51, 220, 60, 45, - 228, 94, 250, 219, 254, 51, 234, 237, 45, 228, 94, 250, 219, 254, 51, - 234, 237, 42, 228, 94, 250, 219, 254, 51, 220, 60, 144, 250, 221, 234, - 237, 144, 250, 221, 84, 234, 237, 45, 221, 90, 84, 234, 237, 42, 221, 90, - 84, 220, 60, 42, 221, 90, 84, 220, 60, 45, 221, 90, 67, 251, 241, 40, 2, - 42, 144, 252, 53, 40, 2, 45, 144, 252, 53, 40, 2, 220, 60, 42, 249, 11, - 144, 252, 53, 40, 2, 234, 237, 45, 249, 11, 144, 252, 53, 67, 40, 2, 69, - 252, 63, 235, 43, 67, 220, 62, 221, 91, 2, 248, 145, 220, 62, 221, 91, 2, - 42, 144, 252, 53, 220, 62, 221, 91, 2, 45, 144, 252, 53, 235, 146, 250, - 221, 67, 40, 2, 220, 60, 42, 228, 93, 67, 40, 2, 234, 237, 42, 228, 93, - 67, 40, 2, 234, 237, 45, 228, 93, 67, 40, 2, 220, 60, 45, 228, 93, 67, - 250, 222, 2, 220, 60, 42, 228, 93, 67, 250, 222, 2, 234, 237, 42, 228, - 93, 67, 250, 222, 2, 234, 237, 45, 228, 93, 67, 250, 222, 2, 220, 60, 45, - 228, 93, 220, 60, 42, 221, 90, 220, 60, 45, 221, 90, 234, 237, 42, 221, - 90, 67, 234, 18, 223, 227, 84, 234, 18, 223, 227, 67, 234, 18, 3, 223, - 227, 84, 234, 18, 3, 223, 227, 234, 237, 45, 221, 90, 84, 223, 69, 2, - 227, 220, 250, 189, 220, 91, 224, 28, 250, 171, 84, 223, 156, 67, 223, - 156, 235, 56, 221, 220, 223, 68, 254, 10, 231, 201, 249, 47, 231, 201, - 250, 149, 230, 109, 84, 222, 71, 67, 222, 71, 252, 213, 252, 21, 252, - 213, 86, 2, 251, 44, 252, 213, 86, 2, 218, 151, 226, 149, 220, 92, 2, - 227, 243, 247, 117, 242, 187, 252, 98, 67, 224, 196, 229, 102, 84, 224, - 196, 229, 102, 225, 11, 210, 227, 59, 245, 148, 243, 154, 251, 241, 84, - 42, 229, 28, 237, 213, 84, 45, 229, 28, 237, 213, 67, 42, 229, 28, 237, - 213, 67, 108, 229, 28, 237, 213, 67, 45, 229, 28, 237, 213, 67, 113, 229, - 28, 237, 213, 224, 60, 25, 250, 99, 251, 120, 55, 227, 250, 55, 252, 69, - 55, 251, 164, 254, 115, 230, 96, 250, 100, 251, 32, 227, 149, 250, 101, - 117, 234, 243, 250, 101, 117, 237, 105, 223, 157, 25, 250, 104, 245, 241, - 100, 254, 238, 225, 13, 243, 193, 25, 224, 138, 229, 197, 100, 217, 241, - 218, 45, 221, 82, 35, 243, 151, 221, 82, 35, 235, 165, 221, 82, 35, 245, - 179, 221, 82, 35, 221, 221, 221, 82, 35, 218, 194, 221, 82, 35, 218, 240, - 221, 82, 35, 233, 107, 221, 82, 35, 247, 8, 218, 211, 117, 249, 30, 67, - 245, 94, 246, 3, 67, 224, 38, 246, 3, 84, 224, 38, 246, 3, 67, 223, 69, - 2, 227, 220, 245, 178, 228, 90, 233, 117, 235, 142, 228, 90, 233, 117, - 233, 249, 245, 217, 55, 247, 8, 234, 90, 55, 237, 31, 226, 124, 220, 45, - 232, 129, 229, 41, 254, 39, 222, 104, 244, 182, 251, 150, 235, 90, 219, - 80, 235, 65, 226, 102, 226, 163, 251, 140, 254, 68, 229, 66, 67, 251, 37, - 236, 102, 67, 251, 37, 228, 83, 67, 251, 37, 227, 65, 67, 251, 37, 252, - 62, 67, 251, 37, 236, 59, 67, 251, 37, 229, 207, 84, 251, 37, 236, 102, - 84, 251, 37, 228, 83, 84, 251, 37, 227, 65, 84, 251, 37, 252, 62, 84, - 251, 37, 236, 59, 84, 251, 37, 229, 207, 84, 223, 252, 223, 80, 67, 243, - 154, 223, 80, 67, 249, 5, 223, 80, 84, 250, 188, 223, 80, 67, 223, 252, - 223, 80, 84, 243, 154, 223, 80, 84, 249, 5, 223, 80, 67, 250, 188, 223, - 80, 242, 187, 223, 231, 228, 90, 231, 180, 246, 232, 231, 180, 252, 142, - 246, 232, 231, 177, 252, 142, 224, 76, 231, 177, 233, 59, 245, 157, 55, - 233, 59, 232, 205, 55, 233, 59, 225, 1, 55, 218, 217, 166, 250, 100, 247, - 5, 166, 250, 100, 220, 70, 227, 204, 100, 227, 204, 16, 35, 220, 197, - 229, 50, 227, 204, 16, 35, 220, 196, 229, 50, 227, 204, 16, 35, 220, 195, - 229, 50, 227, 204, 16, 35, 220, 194, 229, 50, 227, 204, 16, 35, 220, 193, - 229, 50, 227, 204, 16, 35, 220, 192, 229, 50, 227, 204, 16, 35, 220, 191, - 229, 50, 227, 204, 16, 35, 244, 180, 234, 50, 84, 220, 70, 227, 204, 100, - 227, 205, 229, 245, 100, 229, 222, 229, 245, 100, 229, 162, 229, 245, 55, - 218, 209, 100, 248, 254, 246, 2, 248, 254, 246, 1, 248, 254, 246, 0, 248, - 254, 245, 255, 248, 254, 245, 254, 248, 254, 245, 253, 67, 250, 222, 2, - 61, 227, 109, 67, 250, 222, 2, 124, 248, 143, 84, 250, 222, 2, 67, 61, - 227, 109, 84, 250, 222, 2, 124, 67, 248, 143, 233, 125, 35, 218, 45, 233, - 125, 35, 217, 240, 248, 237, 35, 244, 31, 218, 45, 248, 237, 35, 235, 85, - 217, 240, 248, 237, 35, 235, 85, 218, 45, 248, 237, 35, 244, 31, 217, - 240, 67, 245, 163, 84, 245, 163, 243, 193, 25, 229, 104, 254, 128, 250, - 98, 223, 24, 223, 164, 117, 254, 218, 226, 113, 254, 167, 245, 144, 244, - 189, 223, 164, 117, 243, 133, 253, 238, 100, 245, 153, 230, 80, 67, 223, - 156, 148, 235, 38, 250, 131, 227, 109, 148, 235, 38, 250, 131, 235, 115, - 218, 250, 55, 116, 219, 66, 55, 247, 135, 245, 217, 55, 247, 135, 234, - 90, 55, 237, 179, 245, 217, 25, 234, 90, 55, 234, 90, 25, 245, 217, 55, - 234, 90, 2, 214, 55, 234, 90, 2, 214, 25, 234, 90, 25, 245, 217, 55, 69, - 234, 90, 2, 214, 55, 186, 234, 90, 2, 214, 55, 234, 18, 67, 250, 221, - 234, 18, 84, 250, 221, 234, 18, 3, 67, 250, 221, 234, 62, 100, 248, 186, - 100, 220, 69, 229, 221, 100, 250, 178, 245, 86, 220, 42, 232, 124, 251, - 72, 230, 25, 237, 37, 219, 98, 251, 18, 84, 233, 118, 235, 53, 225, 34, - 225, 64, 228, 75, 225, 48, 224, 24, 252, 215, 252, 188, 204, 236, 154, - 67, 247, 122, 234, 86, 67, 247, 122, 236, 102, 84, 247, 122, 234, 86, 84, - 247, 122, 236, 102, 224, 29, 218, 189, 224, 31, 223, 69, 252, 125, 250, - 189, 227, 242, 84, 224, 28, 221, 222, 250, 190, 25, 227, 242, 215, 67, - 224, 196, 229, 102, 215, 84, 224, 196, 229, 102, 67, 249, 5, 237, 224, - 223, 227, 250, 95, 235, 149, 248, 206, 251, 137, 229, 104, 251, 138, 224, - 51, 243, 141, 2, 67, 250, 100, 34, 250, 95, 235, 149, 251, 65, 231, 205, - 246, 174, 254, 144, 230, 135, 42, 218, 230, 221, 106, 84, 220, 204, 42, - 218, 230, 221, 106, 67, 220, 204, 42, 218, 230, 221, 106, 84, 42, 235, - 150, 233, 248, 67, 42, 235, 150, 233, 248, 247, 120, 224, 46, 55, 106, - 67, 247, 131, 221, 90, 42, 250, 197, 246, 174, 204, 226, 149, 245, 247, - 249, 11, 237, 224, 67, 250, 222, 237, 224, 84, 223, 227, 84, 221, 63, - 227, 167, 42, 246, 173, 227, 167, 42, 246, 172, 106, 250, 222, 2, 214, - 25, 124, 188, 50, 84, 250, 101, 230, 139, 224, 218, 224, 207, 224, 174, - 250, 245, 251, 125, 243, 93, 224, 83, 244, 190, 218, 189, 242, 171, 244, - 190, 2, 243, 188, 234, 79, 16, 35, 235, 57, 233, 107, 220, 92, 230, 139, - 244, 24, 245, 117, 245, 164, 237, 224, 242, 252, 245, 209, 226, 160, 40, - 245, 116, 250, 122, 224, 63, 242, 66, 224, 65, 229, 158, 2, 252, 215, - 222, 62, 237, 118, 252, 204, 100, 243, 156, 244, 33, 100, 245, 91, 228, - 198, 250, 83, 230, 139, 84, 223, 227, 67, 245, 164, 2, 186, 233, 193, 84, - 223, 120, 220, 60, 252, 49, 226, 103, 84, 226, 103, 234, 237, 252, 49, - 226, 103, 67, 226, 103, 222, 72, 235, 10, 55, 222, 114, 247, 119, 254, - 187, 246, 170, 219, 93, 243, 189, 218, 167, 243, 189, 234, 237, 45, 229, - 181, 229, 181, 220, 60, 45, 229, 181, 67, 232, 59, 84, 232, 59, 251, 45, - 78, 106, 251, 45, 78, 233, 84, 218, 151, 106, 233, 84, 218, 151, 252, - 213, 218, 151, 106, 252, 213, 218, 151, 230, 80, 23, 250, 100, 106, 23, - 250, 100, 230, 119, 251, 85, 250, 100, 106, 230, 119, 251, 85, 250, 100, - 7, 250, 100, 225, 14, 67, 7, 250, 100, 230, 80, 7, 250, 100, 234, 88, - 250, 100, 223, 157, 117, 249, 140, 245, 116, 222, 83, 253, 251, 245, 116, - 252, 214, 253, 251, 106, 245, 116, 252, 214, 253, 251, 245, 116, 250, - 186, 253, 251, 84, 245, 116, 229, 30, 223, 156, 67, 245, 116, 229, 30, - 223, 156, 223, 125, 230, 80, 67, 223, 156, 34, 67, 223, 156, 230, 119, - 251, 85, 84, 223, 156, 84, 251, 85, 67, 223, 156, 230, 80, 84, 223, 156, - 106, 230, 80, 84, 223, 156, 229, 71, 223, 156, 225, 14, 67, 223, 156, - 106, 253, 251, 230, 119, 251, 85, 253, 251, 246, 235, 223, 236, 253, 251, - 246, 235, 229, 30, 84, 223, 156, 246, 235, 229, 30, 229, 71, 223, 156, - 224, 82, 229, 30, 84, 223, 156, 246, 235, 229, 30, 227, 206, 84, 223, - 156, 106, 246, 235, 229, 30, 227, 206, 84, 223, 156, 220, 222, 229, 30, - 84, 223, 156, 224, 78, 229, 30, 253, 251, 222, 83, 253, 251, 230, 119, - 251, 85, 222, 83, 253, 251, 106, 222, 83, 253, 251, 224, 82, 229, 149, - 84, 25, 67, 245, 147, 84, 245, 147, 67, 245, 147, 246, 235, 229, 149, - 230, 80, 84, 245, 147, 34, 230, 119, 251, 85, 246, 235, 229, 30, 223, - 156, 106, 222, 83, 229, 71, 253, 251, 224, 30, 221, 195, 221, 85, 224, - 30, 106, 251, 35, 224, 30, 223, 251, 106, 223, 251, 252, 214, 253, 251, - 246, 235, 222, 83, 228, 221, 253, 251, 106, 246, 235, 222, 83, 228, 221, - 253, 251, 225, 14, 67, 250, 221, 234, 237, 45, 247, 118, 67, 223, 227, - 220, 60, 45, 247, 118, 67, 223, 227, 234, 237, 45, 225, 14, 67, 223, 227, - 220, 60, 45, 225, 14, 67, 223, 227, 84, 249, 5, 233, 155, 67, 218, 151, - 106, 246, 95, 164, 100, 170, 69, 135, 234, 18, 69, 135, 106, 69, 135, - 106, 224, 109, 215, 250, 169, 228, 69, 164, 230, 98, 106, 224, 109, 250, - 169, 228, 69, 164, 230, 98, 106, 51, 215, 250, 169, 228, 69, 164, 230, - 98, 106, 51, 250, 169, 228, 69, 164, 230, 98, 250, 73, 223, 147, 229, - 241, 5, 230, 98, 106, 246, 95, 164, 230, 98, 106, 243, 154, 246, 95, 164, - 230, 98, 106, 84, 243, 153, 227, 59, 106, 84, 243, 154, 251, 241, 245, - 148, 243, 153, 227, 59, 245, 148, 243, 154, 251, 241, 234, 18, 42, 229, - 230, 230, 98, 234, 18, 45, 229, 230, 230, 98, 234, 18, 245, 154, 42, 229, - 230, 230, 98, 234, 18, 245, 154, 45, 229, 230, 230, 98, 234, 18, 235, - 112, 254, 120, 252, 18, 230, 98, 234, 18, 227, 106, 254, 120, 252, 18, - 230, 98, 106, 235, 112, 254, 120, 228, 69, 164, 230, 98, 106, 227, 106, - 254, 120, 228, 69, 164, 230, 98, 106, 235, 112, 254, 120, 252, 18, 230, - 98, 106, 227, 106, 254, 120, 252, 18, 230, 98, 170, 42, 221, 114, 224, - 236, 252, 18, 230, 98, 170, 45, 221, 114, 224, 236, 252, 18, 230, 98, - 234, 18, 42, 250, 79, 252, 18, 230, 98, 234, 18, 45, 250, 79, 252, 18, - 230, 98, 248, 217, 232, 136, 34, 20, 107, 248, 217, 232, 136, 34, 20, - 103, 248, 217, 232, 136, 34, 20, 160, 248, 217, 232, 136, 34, 20, 154, - 248, 217, 232, 136, 34, 20, 174, 248, 217, 232, 136, 34, 20, 182, 248, - 217, 232, 136, 34, 20, 191, 248, 217, 232, 136, 34, 20, 185, 248, 217, - 232, 136, 34, 20, 190, 248, 217, 232, 136, 34, 54, 222, 65, 248, 217, 34, - 33, 20, 107, 248, 217, 34, 33, 20, 103, 248, 217, 34, 33, 20, 160, 248, - 217, 34, 33, 20, 154, 248, 217, 34, 33, 20, 174, 248, 217, 34, 33, 20, - 182, 248, 217, 34, 33, 20, 191, 248, 217, 34, 33, 20, 185, 248, 217, 34, - 33, 20, 190, 248, 217, 34, 33, 54, 222, 65, 248, 217, 232, 136, 34, 33, - 20, 107, 248, 217, 232, 136, 34, 33, 20, 103, 248, 217, 232, 136, 34, 33, - 20, 160, 248, 217, 232, 136, 34, 33, 20, 154, 248, 217, 232, 136, 34, 33, - 20, 174, 248, 217, 232, 136, 34, 33, 20, 182, 248, 217, 232, 136, 34, 33, - 20, 191, 248, 217, 232, 136, 34, 33, 20, 185, 248, 217, 232, 136, 34, 33, - 20, 190, 248, 217, 232, 136, 34, 33, 54, 222, 65, 106, 218, 200, 90, 65, - 106, 224, 6, 247, 5, 65, 106, 90, 65, 106, 231, 187, 247, 5, 65, 247, - 124, 229, 32, 90, 65, 106, 227, 56, 90, 65, 221, 89, 90, 65, 106, 221, - 89, 90, 65, 249, 145, 221, 89, 90, 65, 106, 249, 145, 221, 89, 90, 65, - 84, 90, 65, 221, 228, 221, 118, 90, 254, 20, 221, 228, 252, 27, 90, 254, - 20, 84, 90, 254, 20, 106, 84, 250, 73, 247, 130, 25, 90, 65, 106, 84, - 250, 73, 220, 53, 25, 90, 65, 223, 224, 84, 90, 65, 106, 250, 157, 84, - 90, 65, 227, 105, 67, 90, 65, 235, 111, 67, 90, 65, 252, 232, 225, 14, - 67, 90, 65, 245, 96, 225, 14, 67, 90, 65, 106, 234, 237, 227, 104, 67, - 90, 65, 106, 220, 60, 227, 104, 67, 90, 65, 231, 182, 234, 237, 227, 104, - 67, 90, 65, 231, 182, 220, 60, 227, 104, 67, 90, 65, 34, 106, 67, 90, 65, - 218, 206, 90, 65, 252, 52, 224, 6, 247, 5, 65, 252, 52, 90, 65, 252, 52, - 231, 187, 247, 5, 65, 106, 252, 52, 224, 6, 247, 5, 65, 106, 252, 52, 90, - 65, 106, 252, 52, 231, 187, 247, 5, 65, 222, 85, 90, 65, 106, 222, 84, - 90, 65, 218, 225, 90, 65, 106, 218, 225, 90, 65, 230, 116, 90, 65, 148, - 248, 227, 254, 119, 67, 221, 91, 250, 141, 3, 67, 221, 90, 229, 160, 230, - 119, 223, 92, 230, 119, 223, 57, 42, 226, 234, 252, 226, 249, 67, 45, - 226, 234, 252, 226, 249, 67, 156, 2, 61, 237, 190, 227, 160, 224, 18, - 228, 243, 223, 92, 223, 58, 228, 243, 224, 17, 69, 252, 201, 2, 186, 92, - 171, 248, 187, 67, 249, 5, 2, 251, 83, 248, 145, 25, 2, 248, 145, 246, - 213, 117, 230, 114, 220, 52, 234, 237, 45, 250, 124, 2, 248, 145, 220, - 60, 42, 250, 124, 2, 248, 145, 42, 230, 82, 237, 57, 45, 230, 82, 237, - 57, 245, 90, 230, 82, 237, 57, 235, 146, 108, 222, 143, 235, 146, 113, - 222, 143, 42, 25, 45, 51, 220, 236, 42, 25, 45, 222, 143, 42, 233, 87, - 171, 45, 222, 143, 171, 42, 222, 143, 108, 222, 144, 2, 250, 222, 50, - 234, 235, 248, 192, 251, 213, 186, 227, 16, 67, 250, 156, 249, 4, 67, - 250, 156, 249, 5, 2, 127, 221, 202, 67, 250, 156, 249, 5, 2, 90, 221, - 202, 67, 40, 2, 127, 221, 202, 67, 40, 2, 90, 221, 202, 14, 42, 67, 40, - 115, 14, 45, 67, 40, 115, 14, 42, 254, 120, 115, 14, 45, 254, 120, 115, - 14, 42, 51, 254, 120, 115, 14, 45, 51, 254, 120, 115, 14, 42, 67, 221, - 114, 224, 236, 115, 14, 45, 67, 221, 114, 224, 236, 115, 14, 42, 245, - 154, 229, 229, 14, 45, 245, 154, 229, 229, 220, 53, 228, 92, 65, 247, - 130, 228, 92, 65, 254, 104, 244, 222, 250, 222, 65, 250, 199, 244, 222, - 250, 222, 65, 45, 76, 2, 34, 229, 43, 171, 127, 65, 171, 90, 65, 171, 42, - 45, 65, 171, 127, 51, 65, 171, 90, 51, 65, 171, 42, 45, 51, 65, 171, 127, - 76, 245, 97, 135, 171, 90, 76, 245, 97, 135, 171, 127, 51, 76, 245, 97, - 135, 171, 90, 51, 76, 245, 97, 135, 171, 90, 223, 223, 65, 43, 44, 252, - 47, 43, 44, 248, 142, 43, 44, 248, 14, 43, 44, 248, 141, 43, 44, 247, - 206, 43, 44, 248, 77, 43, 44, 248, 13, 43, 44, 248, 140, 43, 44, 247, - 174, 43, 44, 248, 45, 43, 44, 247, 237, 43, 44, 248, 108, 43, 44, 247, - 205, 43, 44, 248, 76, 43, 44, 248, 12, 43, 44, 248, 139, 43, 44, 247, - 158, 43, 44, 248, 29, 43, 44, 247, 221, 43, 44, 248, 92, 43, 44, 247, - 189, 43, 44, 248, 60, 43, 44, 247, 252, 43, 44, 248, 123, 43, 44, 247, - 173, 43, 44, 248, 44, 43, 44, 247, 236, 43, 44, 248, 107, 43, 44, 247, - 204, 43, 44, 248, 75, 43, 44, 248, 11, 43, 44, 248, 138, 43, 44, 247, - 150, 43, 44, 248, 21, 43, 44, 247, 213, 43, 44, 248, 84, 43, 44, 247, - 181, 43, 44, 248, 52, 43, 44, 247, 244, 43, 44, 248, 115, 43, 44, 247, - 165, 43, 44, 248, 36, 43, 44, 247, 228, 43, 44, 248, 99, 43, 44, 247, - 196, 43, 44, 248, 67, 43, 44, 248, 3, 43, 44, 248, 130, 43, 44, 247, 157, - 43, 44, 248, 28, 43, 44, 247, 220, 43, 44, 248, 91, 43, 44, 247, 188, 43, - 44, 248, 59, 43, 44, 247, 251, 43, 44, 248, 122, 43, 44, 247, 172, 43, - 44, 248, 43, 43, 44, 247, 235, 43, 44, 248, 106, 43, 44, 247, 203, 43, - 44, 248, 74, 43, 44, 248, 10, 43, 44, 248, 137, 43, 44, 247, 146, 43, 44, - 248, 17, 43, 44, 247, 209, 43, 44, 248, 80, 43, 44, 247, 177, 43, 44, - 248, 48, 43, 44, 247, 240, 43, 44, 248, 111, 43, 44, 247, 161, 43, 44, - 248, 32, 43, 44, 247, 224, 43, 44, 248, 95, 43, 44, 247, 192, 43, 44, - 248, 63, 43, 44, 247, 255, 43, 44, 248, 126, 43, 44, 247, 153, 43, 44, - 248, 24, 43, 44, 247, 216, 43, 44, 248, 87, 43, 44, 247, 184, 43, 44, - 248, 55, 43, 44, 247, 247, 43, 44, 248, 118, 43, 44, 247, 168, 43, 44, - 248, 39, 43, 44, 247, 231, 43, 44, 248, 102, 43, 44, 247, 199, 43, 44, - 248, 70, 43, 44, 248, 6, 43, 44, 248, 133, 43, 44, 247, 149, 43, 44, 248, - 20, 43, 44, 247, 212, 43, 44, 248, 83, 43, 44, 247, 180, 43, 44, 248, 51, - 43, 44, 247, 243, 43, 44, 248, 114, 43, 44, 247, 164, 43, 44, 248, 35, - 43, 44, 247, 227, 43, 44, 248, 98, 43, 44, 247, 195, 43, 44, 248, 66, 43, - 44, 248, 2, 43, 44, 248, 129, 43, 44, 247, 156, 43, 44, 248, 27, 43, 44, - 247, 219, 43, 44, 248, 90, 43, 44, 247, 187, 43, 44, 248, 58, 43, 44, - 247, 250, 43, 44, 248, 121, 43, 44, 247, 171, 43, 44, 248, 42, 43, 44, - 247, 234, 43, 44, 248, 105, 43, 44, 247, 202, 43, 44, 248, 73, 43, 44, - 248, 9, 43, 44, 248, 136, 43, 44, 247, 144, 43, 44, 248, 15, 43, 44, 247, - 207, 43, 44, 248, 78, 43, 44, 247, 175, 43, 44, 248, 46, 43, 44, 247, - 238, 43, 44, 248, 109, 43, 44, 247, 159, 43, 44, 248, 30, 43, 44, 247, - 222, 43, 44, 248, 93, 43, 44, 247, 190, 43, 44, 248, 61, 43, 44, 247, - 253, 43, 44, 248, 124, 43, 44, 247, 151, 43, 44, 248, 22, 43, 44, 247, - 214, 43, 44, 248, 85, 43, 44, 247, 182, 43, 44, 248, 53, 43, 44, 247, - 245, 43, 44, 248, 116, 43, 44, 247, 166, 43, 44, 248, 37, 43, 44, 247, - 229, 43, 44, 248, 100, 43, 44, 247, 197, 43, 44, 248, 68, 43, 44, 248, 4, - 43, 44, 248, 131, 43, 44, 247, 147, 43, 44, 248, 18, 43, 44, 247, 210, - 43, 44, 248, 81, 43, 44, 247, 178, 43, 44, 248, 49, 43, 44, 247, 241, 43, - 44, 248, 112, 43, 44, 247, 162, 43, 44, 248, 33, 43, 44, 247, 225, 43, - 44, 248, 96, 43, 44, 247, 193, 43, 44, 248, 64, 43, 44, 248, 0, 43, 44, - 248, 127, 43, 44, 247, 154, 43, 44, 248, 25, 43, 44, 247, 217, 43, 44, - 248, 88, 43, 44, 247, 185, 43, 44, 248, 56, 43, 44, 247, 248, 43, 44, - 248, 119, 43, 44, 247, 169, 43, 44, 248, 40, 43, 44, 247, 232, 43, 44, - 248, 103, 43, 44, 247, 200, 43, 44, 248, 71, 43, 44, 248, 7, 43, 44, 248, - 134, 43, 44, 247, 145, 43, 44, 248, 16, 43, 44, 247, 208, 43, 44, 248, - 79, 43, 44, 247, 176, 43, 44, 248, 47, 43, 44, 247, 239, 43, 44, 248, - 110, 43, 44, 247, 160, 43, 44, 248, 31, 43, 44, 247, 223, 43, 44, 248, - 94, 43, 44, 247, 191, 43, 44, 248, 62, 43, 44, 247, 254, 43, 44, 248, - 125, 43, 44, 247, 152, 43, 44, 248, 23, 43, 44, 247, 215, 43, 44, 248, - 86, 43, 44, 247, 183, 43, 44, 248, 54, 43, 44, 247, 246, 43, 44, 248, - 117, 43, 44, 247, 167, 43, 44, 248, 38, 43, 44, 247, 230, 43, 44, 248, - 101, 43, 44, 247, 198, 43, 44, 248, 69, 43, 44, 248, 5, 43, 44, 248, 132, - 43, 44, 247, 148, 43, 44, 248, 19, 43, 44, 247, 211, 43, 44, 248, 82, 43, - 44, 247, 179, 43, 44, 248, 50, 43, 44, 247, 242, 43, 44, 248, 113, 43, - 44, 247, 163, 43, 44, 248, 34, 43, 44, 247, 226, 43, 44, 248, 97, 43, 44, - 247, 194, 43, 44, 248, 65, 43, 44, 248, 1, 43, 44, 248, 128, 43, 44, 247, - 155, 43, 44, 248, 26, 43, 44, 247, 218, 43, 44, 248, 89, 43, 44, 247, - 186, 43, 44, 248, 57, 43, 44, 247, 249, 43, 44, 248, 120, 43, 44, 247, - 170, 43, 44, 248, 41, 43, 44, 247, 233, 43, 44, 248, 104, 43, 44, 247, - 201, 43, 44, 248, 72, 43, 44, 248, 8, 43, 44, 248, 135, 90, 220, 206, 76, - 2, 69, 92, 90, 220, 206, 76, 2, 51, 69, 92, 127, 51, 76, 2, 69, 92, 90, - 51, 76, 2, 69, 92, 42, 45, 51, 76, 2, 69, 92, 90, 220, 206, 76, 245, 97, - 135, 127, 51, 76, 245, 97, 135, 90, 51, 76, 245, 97, 135, 247, 130, 76, - 2, 186, 92, 220, 53, 76, 2, 186, 92, 220, 53, 221, 78, 65, 247, 130, 221, - 78, 65, 127, 51, 249, 147, 65, 90, 51, 249, 147, 65, 127, 221, 78, 249, - 147, 65, 90, 221, 78, 249, 147, 65, 90, 220, 206, 221, 78, 249, 147, 65, - 90, 76, 2, 247, 143, 223, 146, 220, 53, 76, 199, 135, 247, 130, 76, 199, - 135, 90, 76, 2, 222, 136, 2, 69, 92, 90, 76, 2, 222, 136, 2, 51, 69, 92, - 90, 220, 206, 76, 2, 222, 135, 90, 220, 206, 76, 2, 222, 136, 2, 69, 92, - 90, 220, 206, 76, 2, 222, 136, 2, 51, 69, 92, 127, 254, 22, 90, 254, 22, - 127, 51, 254, 22, 90, 51, 254, 22, 127, 76, 199, 84, 249, 4, 90, 76, 199, - 84, 249, 4, 127, 76, 245, 97, 252, 201, 199, 84, 249, 4, 90, 76, 245, 97, - 252, 201, 199, 84, 249, 4, 231, 187, 218, 217, 25, 224, 6, 247, 5, 65, - 231, 187, 247, 5, 25, 224, 6, 218, 217, 65, 231, 187, 218, 217, 76, 2, - 96, 231, 187, 247, 5, 76, 2, 96, 224, 6, 247, 5, 76, 2, 96, 224, 6, 218, - 217, 76, 2, 96, 231, 187, 218, 217, 76, 25, 231, 187, 247, 5, 65, 231, - 187, 247, 5, 76, 25, 224, 6, 247, 5, 65, 224, 6, 247, 5, 76, 25, 224, 6, - 218, 217, 65, 224, 6, 218, 217, 76, 25, 231, 187, 218, 217, 65, 227, 88, - 249, 11, 250, 95, 245, 247, 249, 10, 245, 247, 249, 11, 250, 95, 227, 88, - 249, 10, 224, 6, 247, 5, 76, 250, 95, 231, 187, 247, 5, 65, 231, 187, - 247, 5, 76, 250, 95, 224, 6, 247, 5, 65, 245, 247, 249, 11, 250, 95, 231, - 187, 247, 5, 65, 227, 88, 249, 11, 250, 95, 224, 6, 247, 5, 65, 231, 187, - 247, 5, 76, 250, 95, 231, 187, 218, 217, 65, 231, 187, 218, 217, 76, 250, - 95, 231, 187, 247, 5, 65, 218, 237, 76, 229, 28, 248, 208, 227, 109, 76, - 229, 28, 90, 222, 15, 250, 72, 220, 52, 76, 229, 28, 90, 222, 15, 250, - 72, 247, 129, 76, 229, 28, 247, 130, 222, 15, 250, 72, 235, 107, 76, 229, - 28, 247, 130, 222, 15, 250, 72, 227, 100, 227, 103, 254, 52, 250, 199, - 65, 235, 110, 254, 52, 254, 104, 65, 221, 120, 254, 52, 254, 104, 65, - 252, 29, 254, 52, 254, 104, 65, 221, 120, 254, 52, 250, 199, 76, 2, 233, - 154, 221, 120, 254, 52, 254, 104, 76, 2, 229, 43, 234, 237, 45, 225, 69, - 250, 199, 65, 234, 237, 42, 225, 69, 254, 104, 65, 254, 104, 250, 197, - 250, 222, 65, 250, 199, 250, 197, 250, 222, 65, 90, 76, 71, 224, 192, - 127, 65, 127, 76, 71, 224, 192, 90, 65, 224, 192, 90, 76, 71, 127, 65, - 90, 76, 2, 88, 56, 127, 76, 2, 88, 56, 90, 76, 221, 225, 218, 151, 42, - 45, 76, 221, 225, 3, 250, 221, 220, 53, 220, 206, 76, 245, 97, 3, 250, - 221, 42, 192, 108, 45, 192, 113, 243, 176, 42, 192, 113, 45, 192, 108, - 243, 176, 108, 192, 45, 113, 192, 42, 243, 176, 108, 192, 42, 113, 192, - 45, 243, 176, 42, 192, 108, 45, 192, 108, 243, 176, 108, 192, 45, 113, - 192, 45, 243, 176, 42, 192, 113, 45, 192, 113, 243, 176, 108, 192, 42, - 113, 192, 42, 243, 176, 127, 243, 177, 2, 192, 108, 199, 135, 90, 243, - 177, 2, 192, 108, 199, 135, 220, 53, 243, 177, 2, 192, 45, 199, 135, 247, - 130, 243, 177, 2, 192, 45, 199, 135, 127, 243, 177, 2, 192, 113, 199, - 135, 90, 243, 177, 2, 192, 113, 199, 135, 220, 53, 243, 177, 2, 192, 42, - 199, 135, 247, 130, 243, 177, 2, 192, 42, 199, 135, 127, 243, 177, 2, - 192, 108, 245, 97, 135, 90, 243, 177, 2, 192, 108, 245, 97, 135, 220, 53, - 243, 177, 2, 192, 45, 245, 97, 135, 247, 130, 243, 177, 2, 192, 45, 245, - 97, 135, 127, 243, 177, 2, 192, 113, 245, 97, 135, 90, 243, 177, 2, 192, - 113, 245, 97, 135, 220, 53, 243, 177, 2, 192, 42, 245, 97, 135, 247, 130, - 243, 177, 2, 192, 42, 245, 97, 135, 127, 243, 177, 2, 192, 108, 71, 127, - 243, 177, 2, 192, 247, 132, 220, 53, 243, 177, 2, 192, 42, 252, 106, 220, - 53, 243, 177, 2, 192, 227, 109, 90, 243, 177, 2, 192, 108, 71, 90, 243, - 177, 2, 192, 247, 132, 247, 130, 243, 177, 2, 192, 42, 252, 106, 247, - 130, 243, 177, 2, 192, 227, 109, 127, 243, 177, 2, 192, 108, 71, 90, 243, - 177, 2, 192, 220, 63, 127, 243, 177, 2, 192, 113, 71, 90, 243, 177, 2, - 192, 247, 132, 90, 243, 177, 2, 192, 108, 71, 127, 243, 177, 2, 192, 220, - 63, 90, 243, 177, 2, 192, 113, 71, 127, 243, 177, 2, 192, 247, 132, 127, - 243, 177, 2, 192, 108, 71, 171, 249, 146, 127, 243, 177, 2, 192, 113, - 252, 118, 171, 249, 146, 90, 243, 177, 2, 192, 108, 71, 171, 249, 146, - 90, 243, 177, 2, 192, 113, 252, 118, 171, 249, 146, 220, 53, 243, 177, 2, - 192, 42, 252, 106, 247, 130, 243, 177, 2, 192, 227, 109, 247, 130, 243, - 177, 2, 192, 42, 252, 106, 220, 53, 243, 177, 2, 192, 227, 109, 45, 51, - 76, 2, 227, 55, 243, 159, 246, 154, 5, 71, 90, 65, 221, 180, 230, 113, - 71, 90, 65, 127, 76, 71, 221, 180, 230, 112, 90, 76, 71, 221, 180, 230, - 112, 90, 76, 71, 254, 151, 114, 101, 235, 87, 71, 127, 65, 127, 76, 221, - 225, 235, 86, 244, 30, 71, 90, 65, 223, 93, 71, 90, 65, 127, 76, 221, - 225, 223, 92, 223, 58, 71, 127, 65, 42, 245, 177, 222, 135, 45, 245, 177, - 222, 135, 108, 245, 177, 222, 135, 113, 245, 177, 222, 135, 221, 78, 69, - 252, 201, 249, 67, 217, 158, 165, 223, 234, 217, 158, 165, 220, 198, 250, - 175, 42, 67, 250, 79, 115, 45, 67, 250, 79, 115, 42, 67, 229, 229, 45, - 67, 229, 229, 217, 158, 165, 42, 237, 237, 115, 217, 158, 165, 45, 237, - 237, 115, 217, 158, 165, 42, 252, 71, 115, 217, 158, 165, 45, 252, 71, - 115, 42, 40, 252, 18, 2, 220, 81, 45, 40, 252, 18, 2, 220, 81, 42, 40, - 252, 18, 2, 221, 203, 237, 224, 221, 120, 250, 123, 45, 40, 252, 18, 2, - 221, 203, 237, 224, 252, 29, 250, 123, 42, 40, 252, 18, 2, 221, 203, 237, - 224, 252, 29, 250, 123, 45, 40, 252, 18, 2, 221, 203, 237, 224, 221, 120, - 250, 123, 42, 254, 120, 252, 18, 2, 248, 145, 45, 254, 120, 252, 18, 2, - 248, 145, 42, 254, 52, 235, 87, 115, 45, 254, 52, 244, 30, 115, 51, 42, - 254, 52, 244, 30, 115, 51, 45, 254, 52, 235, 87, 115, 42, 84, 221, 114, - 224, 236, 115, 45, 84, 221, 114, 224, 236, 115, 247, 143, 245, 214, 69, - 217, 33, 235, 43, 234, 22, 254, 120, 230, 114, 235, 115, 45, 254, 120, - 219, 177, 2, 223, 227, 234, 22, 45, 254, 120, 2, 248, 145, 254, 120, 2, - 226, 235, 237, 190, 254, 248, 254, 119, 223, 245, 254, 120, 230, 114, - 235, 115, 223, 245, 254, 120, 230, 114, 220, 63, 215, 254, 119, 210, 254, - 119, 254, 120, 2, 220, 81, 210, 254, 120, 2, 220, 81, 230, 177, 254, 120, - 230, 114, 220, 63, 230, 177, 254, 120, 230, 114, 247, 132, 234, 22, 254, - 120, 2, 230, 119, 254, 32, 246, 187, 237, 224, 76, 229, 28, 108, 25, 227, - 109, 234, 22, 254, 120, 2, 230, 119, 254, 32, 246, 187, 237, 224, 76, - 229, 28, 108, 25, 235, 115, 234, 22, 254, 120, 2, 230, 119, 254, 32, 246, - 187, 237, 224, 76, 229, 28, 113, 25, 227, 109, 234, 22, 254, 120, 2, 230, - 119, 254, 32, 246, 187, 237, 224, 76, 229, 28, 113, 25, 235, 115, 234, - 22, 254, 120, 2, 230, 119, 254, 32, 246, 187, 237, 224, 76, 229, 28, 45, - 25, 220, 63, 234, 22, 254, 120, 2, 230, 119, 254, 32, 246, 187, 237, 224, - 76, 229, 28, 42, 25, 220, 63, 234, 22, 254, 120, 2, 230, 119, 254, 32, - 246, 187, 237, 224, 76, 229, 28, 45, 25, 247, 132, 234, 22, 254, 120, 2, - 230, 119, 254, 32, 246, 187, 237, 224, 76, 229, 28, 42, 25, 247, 132, - 210, 246, 199, 225, 45, 246, 199, 225, 46, 2, 230, 77, 246, 199, 225, 46, - 2, 3, 250, 222, 50, 246, 199, 225, 46, 2, 45, 76, 50, 246, 199, 225, 46, - 2, 42, 76, 50, 250, 222, 2, 186, 135, 34, 69, 135, 34, 229, 233, 34, 227, - 160, 224, 17, 34, 229, 160, 250, 222, 248, 192, 251, 213, 186, 252, 201, - 25, 221, 120, 144, 248, 192, 251, 213, 69, 135, 250, 222, 2, 223, 60, - 218, 151, 34, 254, 103, 248, 188, 55, 108, 76, 221, 225, 250, 221, 34, - 67, 251, 241, 34, 251, 241, 34, 235, 86, 34, 244, 29, 250, 222, 2, 3, - 250, 222, 199, 222, 23, 227, 109, 250, 222, 2, 124, 186, 223, 108, 199, - 222, 23, 227, 109, 204, 227, 88, 249, 11, 224, 55, 204, 245, 247, 249, - 11, 224, 55, 204, 253, 251, 204, 3, 250, 221, 204, 223, 227, 124, 237, - 56, 223, 225, 221, 91, 2, 61, 50, 221, 91, 2, 220, 81, 226, 235, 237, - 224, 221, 90, 221, 91, 2, 225, 52, 253, 245, 252, 28, 45, 221, 91, 71, - 42, 221, 90, 42, 221, 91, 252, 106, 69, 135, 69, 252, 201, 252, 106, 45, - 221, 90, 252, 23, 2, 42, 144, 252, 53, 252, 23, 2, 45, 144, 252, 53, 84, - 252, 22, 27, 2, 42, 144, 252, 53, 27, 2, 45, 144, 252, 53, 67, 242, 183, - 84, 242, 183, 42, 218, 198, 245, 214, 45, 218, 198, 245, 214, 42, 51, - 218, 198, 245, 214, 45, 51, 218, 198, 245, 214, 237, 218, 237, 207, 221, - 201, 104, 237, 207, 237, 208, 232, 138, 2, 69, 135, 247, 137, 233, 87, - 40, 2, 250, 135, 230, 81, 237, 216, 254, 13, 224, 166, 228, 229, 246, - 154, 5, 25, 224, 57, 229, 233, 246, 154, 5, 25, 224, 57, 229, 234, 2, - 221, 180, 50, 242, 59, 199, 25, 224, 57, 229, 233, 244, 75, 223, 155, - 222, 12, 247, 131, 221, 91, 2, 42, 144, 252, 53, 247, 131, 221, 91, 2, - 45, 144, 252, 53, 84, 249, 5, 2, 113, 65, 84, 234, 234, 67, 250, 222, 2, - 113, 65, 84, 250, 222, 2, 113, 65, 246, 141, 67, 223, 227, 246, 141, 84, - 223, 227, 246, 141, 67, 249, 4, 246, 141, 84, 249, 4, 246, 141, 67, 250, - 221, 246, 141, 84, 250, 221, 227, 15, 227, 160, 224, 18, 230, 112, 224, - 18, 2, 230, 77, 227, 160, 224, 18, 2, 186, 92, 252, 76, 224, 17, 252, 76, - 227, 160, 224, 17, 51, 229, 43, 221, 78, 229, 43, 235, 112, 250, 73, 254, - 120, 115, 227, 106, 250, 73, 254, 120, 115, 221, 171, 233, 152, 233, 33, - 34, 61, 230, 112, 233, 33, 34, 88, 230, 112, 233, 33, 34, 27, 230, 112, - 233, 33, 220, 75, 230, 113, 2, 248, 145, 233, 33, 220, 75, 230, 113, 2, - 229, 43, 233, 33, 40, 237, 175, 230, 112, 233, 33, 40, 220, 75, 230, 112, - 124, 235, 7, 25, 230, 112, 124, 235, 7, 156, 230, 112, 233, 33, 27, 230, - 112, 233, 131, 124, 223, 74, 223, 72, 2, 237, 186, 228, 92, 237, 187, - 230, 112, 245, 181, 229, 225, 237, 186, 237, 187, 2, 51, 92, 237, 187, - 253, 217, 2, 224, 55, 250, 218, 245, 87, 254, 104, 237, 184, 235, 44, - 237, 185, 2, 227, 207, 229, 212, 254, 29, 229, 24, 235, 44, 237, 185, 2, - 225, 69, 229, 212, 254, 29, 229, 24, 235, 44, 237, 185, 212, 237, 219, - 222, 23, 229, 24, 237, 187, 254, 29, 112, 229, 32, 230, 112, 228, 86, - 237, 187, 230, 112, 237, 187, 2, 127, 76, 2, 96, 237, 187, 2, 27, 55, - 237, 187, 2, 237, 174, 237, 187, 2, 220, 74, 237, 187, 2, 230, 77, 237, - 187, 2, 220, 81, 237, 57, 235, 146, 42, 221, 91, 230, 112, 217, 158, 165, - 226, 109, 250, 159, 217, 158, 165, 226, 109, 229, 69, 217, 158, 165, 226, - 109, 228, 226, 88, 5, 2, 3, 250, 222, 50, 88, 5, 2, 250, 217, 255, 1, 50, - 88, 5, 2, 221, 180, 50, 88, 5, 2, 61, 56, 88, 5, 2, 221, 180, 56, 88, 5, - 2, 223, 94, 103, 88, 5, 2, 84, 221, 90, 233, 155, 5, 2, 250, 169, 50, - 233, 155, 5, 2, 61, 56, 233, 155, 5, 2, 245, 247, 248, 143, 233, 155, 5, - 2, 227, 88, 248, 143, 88, 5, 237, 224, 42, 144, 250, 221, 88, 5, 237, - 224, 45, 144, 250, 221, 219, 164, 156, 250, 101, 228, 229, 233, 84, 5, 2, - 61, 50, 233, 84, 5, 2, 220, 81, 225, 66, 228, 230, 2, 252, 29, 250, 196, - 224, 41, 228, 229, 233, 84, 5, 237, 224, 42, 144, 250, 221, 233, 84, 5, - 237, 224, 45, 144, 250, 221, 34, 233, 84, 5, 2, 250, 217, 255, 0, 233, - 84, 5, 237, 224, 51, 250, 221, 34, 248, 188, 55, 88, 5, 237, 224, 221, - 90, 233, 155, 5, 237, 224, 221, 90, 233, 84, 5, 237, 224, 221, 90, 237, - 181, 228, 229, 227, 101, 237, 181, 228, 229, 217, 158, 165, 227, 191, - 250, 159, 254, 139, 156, 250, 128, 237, 175, 2, 248, 145, 220, 75, 2, - 233, 155, 55, 220, 75, 2, 230, 77, 237, 175, 2, 230, 77, 237, 175, 2, - 235, 7, 254, 126, 220, 75, 2, 235, 7, 230, 105, 220, 75, 71, 237, 174, - 237, 175, 71, 220, 74, 220, 75, 71, 252, 201, 71, 237, 174, 237, 175, 71, - 252, 201, 71, 220, 74, 220, 75, 252, 106, 25, 237, 56, 2, 220, 74, 237, - 175, 252, 106, 25, 237, 56, 2, 237, 174, 250, 197, 220, 75, 2, 225, 51, - 250, 197, 237, 175, 2, 225, 51, 51, 40, 237, 174, 51, 40, 220, 74, 250, - 197, 220, 75, 2, 225, 52, 25, 224, 41, 228, 229, 235, 7, 25, 2, 61, 50, - 235, 7, 156, 2, 61, 50, 51, 235, 7, 254, 126, 51, 235, 7, 230, 105, 124, - 237, 176, 235, 7, 254, 126, 124, 237, 176, 235, 7, 230, 105, 224, 48, - 235, 146, 230, 105, 224, 48, 235, 146, 254, 126, 235, 7, 156, 230, 75, - 235, 7, 254, 126, 235, 7, 25, 2, 233, 193, 223, 146, 235, 7, 156, 2, 233, - 193, 223, 146, 235, 7, 25, 2, 186, 249, 146, 235, 7, 156, 2, 186, 249, - 146, 235, 7, 25, 2, 51, 230, 77, 235, 7, 25, 2, 220, 81, 235, 7, 25, 2, - 51, 220, 81, 3, 219, 161, 2, 220, 81, 235, 7, 156, 2, 51, 230, 77, 235, - 7, 156, 2, 51, 220, 81, 217, 158, 165, 248, 154, 254, 99, 217, 158, 165, - 227, 234, 254, 99, 246, 154, 5, 2, 61, 56, 242, 59, 2, 61, 50, 221, 78, - 186, 252, 201, 2, 51, 69, 92, 221, 78, 186, 252, 201, 2, 221, 78, 69, 92, - 221, 180, 230, 113, 2, 61, 50, 221, 180, 230, 113, 2, 227, 88, 248, 143, - 224, 116, 233, 155, 224, 115, 250, 153, 2, 61, 50, 246, 154, 2, 253, 251, - 254, 151, 114, 199, 2, 250, 217, 255, 0, 254, 72, 114, 156, 114, 101, - 246, 154, 5, 71, 88, 55, 88, 5, 71, 246, 154, 55, 246, 154, 5, 71, 221, - 180, 230, 112, 51, 250, 176, 246, 155, 124, 250, 148, 246, 154, 224, 126, - 148, 250, 148, 246, 154, 224, 126, 246, 154, 5, 2, 124, 188, 71, 25, 124, - 188, 56, 246, 150, 2, 245, 116, 188, 50, 235, 87, 2, 250, 222, 237, 190, - 244, 30, 2, 250, 222, 237, 190, 235, 87, 2, 228, 82, 164, 50, 244, 30, 2, - 228, 82, 164, 50, 235, 87, 156, 224, 57, 114, 101, 244, 30, 156, 224, 57, - 114, 101, 235, 87, 156, 224, 57, 114, 199, 2, 61, 237, 190, 244, 30, 156, - 224, 57, 114, 199, 2, 61, 237, 190, 235, 87, 156, 224, 57, 114, 199, 2, - 61, 50, 244, 30, 156, 224, 57, 114, 199, 2, 61, 50, 235, 87, 156, 224, - 57, 114, 199, 2, 61, 71, 227, 109, 244, 30, 156, 224, 57, 114, 199, 2, - 61, 71, 235, 115, 235, 87, 156, 254, 73, 244, 30, 156, 254, 73, 235, 87, - 25, 224, 107, 212, 114, 101, 244, 30, 25, 224, 107, 212, 114, 101, 235, - 87, 25, 212, 254, 73, 244, 30, 25, 212, 254, 73, 235, 87, 71, 247, 136, - 114, 71, 244, 29, 244, 30, 71, 247, 136, 114, 71, 235, 86, 235, 87, 71, - 224, 116, 156, 246, 155, 244, 30, 71, 224, 116, 156, 246, 155, 235, 87, - 71, 224, 116, 71, 244, 29, 244, 30, 71, 224, 116, 71, 235, 86, 235, 87, - 71, 244, 30, 71, 247, 136, 246, 155, 244, 30, 71, 235, 87, 71, 247, 136, - 246, 155, 235, 87, 71, 224, 57, 114, 71, 244, 30, 71, 224, 57, 246, 155, - 244, 30, 71, 224, 57, 114, 71, 235, 87, 71, 224, 57, 246, 155, 224, 57, - 114, 199, 156, 235, 86, 224, 57, 114, 199, 156, 244, 29, 224, 57, 114, - 199, 156, 235, 87, 2, 61, 237, 190, 224, 57, 114, 199, 156, 244, 30, 2, - 61, 237, 190, 247, 136, 114, 199, 156, 235, 86, 247, 136, 114, 199, 156, - 244, 29, 247, 136, 224, 57, 114, 199, 156, 235, 86, 247, 136, 224, 57, - 114, 199, 156, 244, 29, 224, 116, 156, 235, 86, 224, 116, 156, 244, 29, - 224, 116, 71, 235, 87, 71, 246, 154, 55, 224, 116, 71, 244, 30, 71, 246, - 154, 55, 51, 232, 127, 235, 86, 51, 232, 127, 244, 29, 51, 232, 127, 235, - 87, 2, 220, 81, 244, 30, 230, 75, 235, 86, 244, 30, 252, 106, 235, 86, - 235, 87, 250, 197, 251, 213, 250, 74, 244, 30, 250, 197, 251, 213, 250, - 74, 235, 87, 250, 197, 251, 213, 250, 75, 71, 224, 57, 246, 155, 244, 30, - 250, 197, 251, 213, 250, 75, 71, 224, 57, 246, 155, 224, 42, 222, 27, - 235, 145, 222, 27, 224, 42, 222, 28, 156, 114, 101, 235, 145, 222, 28, - 156, 114, 101, 246, 154, 5, 2, 251, 236, 50, 228, 245, 71, 224, 107, 246, - 154, 55, 223, 85, 71, 224, 107, 246, 154, 55, 228, 245, 71, 224, 107, - 212, 114, 101, 223, 85, 71, 224, 107, 212, 114, 101, 228, 245, 71, 246, - 154, 55, 223, 85, 71, 246, 154, 55, 228, 245, 71, 212, 114, 101, 223, 85, - 71, 212, 114, 101, 228, 245, 71, 254, 151, 114, 101, 223, 85, 71, 254, - 151, 114, 101, 228, 245, 71, 212, 254, 151, 114, 101, 223, 85, 71, 212, - 254, 151, 114, 101, 51, 228, 244, 51, 223, 84, 223, 93, 2, 248, 145, 223, - 58, 2, 248, 145, 223, 93, 2, 88, 5, 56, 223, 58, 2, 88, 5, 56, 223, 93, - 2, 233, 84, 5, 56, 223, 58, 2, 233, 84, 5, 56, 223, 93, 117, 156, 114, - 199, 2, 61, 50, 223, 58, 117, 156, 114, 199, 2, 61, 50, 223, 93, 117, 71, - 246, 154, 55, 223, 58, 117, 71, 246, 154, 55, 223, 93, 117, 71, 221, 180, - 230, 112, 223, 58, 117, 71, 221, 180, 230, 112, 223, 93, 117, 71, 254, - 151, 114, 101, 223, 58, 117, 71, 254, 151, 114, 101, 223, 93, 117, 71, - 212, 114, 101, 223, 58, 117, 71, 212, 114, 101, 40, 42, 230, 119, 86, - 230, 112, 40, 45, 230, 119, 86, 230, 112, 250, 197, 223, 92, 250, 197, - 223, 57, 250, 197, 223, 93, 156, 114, 101, 250, 197, 223, 58, 156, 114, - 101, 223, 93, 71, 223, 57, 223, 58, 71, 223, 92, 223, 93, 71, 223, 92, - 223, 58, 71, 223, 57, 223, 58, 252, 106, 223, 92, 223, 58, 252, 106, 25, - 237, 56, 251, 213, 249, 147, 2, 223, 92, 246, 213, 117, 230, 114, 247, - 129, 229, 63, 2, 222, 81, 221, 119, 221, 102, 237, 174, 245, 125, 231, - 196, 224, 192, 42, 222, 143, 224, 192, 113, 222, 143, 224, 192, 108, 222, - 143, 229, 161, 2, 198, 69, 252, 201, 221, 78, 45, 220, 236, 51, 69, 252, - 201, 42, 220, 236, 69, 252, 201, 51, 42, 220, 236, 51, 69, 252, 201, 51, - 42, 220, 236, 171, 249, 147, 245, 97, 42, 233, 255, 117, 51, 219, 152, - 224, 192, 113, 222, 144, 2, 230, 77, 224, 192, 108, 222, 144, 2, 220, 81, - 224, 192, 108, 222, 144, 71, 224, 192, 113, 222, 143, 51, 113, 222, 143, - 51, 108, 222, 143, 51, 214, 212, 55, 210, 51, 214, 212, 55, 248, 160, - 212, 248, 194, 2, 210, 232, 137, 224, 55, 69, 235, 44, 2, 250, 222, 50, - 69, 235, 44, 2, 250, 222, 56, 113, 222, 144, 2, 250, 222, 56, 229, 234, - 2, 186, 92, 229, 234, 2, 221, 180, 230, 112, 221, 78, 69, 252, 201, 252, - 73, 227, 192, 221, 78, 69, 252, 201, 2, 186, 92, 221, 78, 250, 176, 230, - 112, 221, 78, 232, 127, 235, 86, 221, 78, 232, 127, 244, 29, 247, 136, - 224, 57, 235, 87, 156, 114, 101, 247, 136, 224, 57, 244, 30, 156, 114, - 101, 221, 78, 224, 18, 252, 73, 227, 192, 235, 146, 221, 78, 69, 252, - 201, 230, 112, 51, 224, 18, 230, 112, 67, 69, 135, 233, 33, 67, 69, 135, - 231, 187, 247, 5, 67, 65, 231, 187, 218, 217, 67, 65, 224, 6, 247, 5, 67, - 65, 224, 6, 218, 217, 67, 65, 42, 45, 67, 65, 127, 84, 65, 220, 53, 84, - 65, 247, 130, 84, 65, 231, 187, 247, 5, 84, 65, 231, 187, 218, 217, 84, - 65, 224, 6, 247, 5, 84, 65, 224, 6, 218, 217, 84, 65, 42, 45, 84, 65, - 108, 113, 84, 65, 90, 76, 2, 221, 170, 247, 129, 90, 76, 2, 221, 170, - 220, 52, 127, 76, 2, 221, 170, 247, 129, 127, 76, 2, 221, 170, 220, 52, - 40, 2, 221, 120, 144, 252, 53, 40, 2, 252, 29, 144, 252, 53, 40, 2, 220, - 60, 45, 249, 11, 144, 252, 53, 40, 2, 234, 237, 42, 249, 11, 144, 252, - 53, 249, 5, 2, 42, 144, 252, 53, 249, 5, 2, 45, 144, 252, 53, 249, 5, 2, - 221, 120, 144, 252, 53, 249, 5, 2, 252, 29, 144, 252, 53, 247, 143, 223, - 227, 84, 235, 146, 223, 227, 67, 235, 146, 223, 227, 84, 219, 100, 3, - 223, 227, 67, 219, 100, 3, 223, 227, 84, 229, 175, 67, 229, 175, 67, 243, - 124, 84, 243, 124, 186, 84, 243, 124, 84, 235, 146, 250, 221, 84, 234, - 18, 249, 4, 67, 234, 18, 249, 4, 84, 234, 18, 234, 234, 67, 234, 18, 234, - 234, 84, 3, 249, 4, 84, 3, 234, 234, 67, 3, 234, 234, 84, 186, 246, 209, - 67, 186, 246, 209, 84, 69, 246, 209, 67, 69, 246, 209, 42, 76, 2, 3, 250, - 221, 148, 127, 254, 19, 42, 76, 2, 34, 229, 43, 171, 127, 223, 223, 65, - 127, 220, 206, 76, 2, 69, 92, 127, 220, 206, 76, 2, 51, 69, 92, 127, 220, - 206, 76, 245, 97, 135, 127, 220, 206, 221, 78, 249, 147, 65, 127, 76, 2, - 247, 143, 223, 146, 127, 76, 2, 222, 136, 2, 69, 92, 127, 76, 2, 222, - 136, 2, 51, 69, 92, 127, 220, 206, 76, 2, 222, 135, 127, 220, 206, 76, 2, - 222, 136, 2, 69, 92, 127, 220, 206, 76, 2, 222, 136, 2, 51, 69, 92, 127, - 76, 221, 225, 218, 151, 218, 237, 76, 229, 28, 248, 208, 235, 115, 246, - 154, 5, 71, 127, 65, 227, 160, 221, 180, 230, 113, 71, 127, 65, 127, 76, - 71, 227, 160, 254, 151, 114, 101, 90, 76, 221, 225, 244, 29, 90, 76, 221, - 225, 223, 57, 127, 228, 92, 65, 90, 228, 92, 65, 227, 160, 221, 180, 230, - 113, 71, 90, 65, 90, 76, 71, 227, 160, 254, 151, 114, 101, 221, 180, 230, - 113, 71, 127, 65, 127, 76, 71, 254, 151, 114, 101, 127, 76, 71, 227, 160, - 221, 180, 230, 112, 90, 76, 71, 227, 160, 221, 180, 230, 112, 67, 234, - 18, 223, 156, 84, 3, 223, 156, 67, 3, 223, 156, 84, 227, 106, 229, 175, - 67, 227, 106, 229, 175, 106, 235, 146, 250, 221, 106, 230, 78, 2, 230, - 78, 237, 190, 106, 250, 222, 2, 250, 222, 237, 190, 106, 250, 221, 106, - 34, 226, 149, 125, 6, 1, 253, 205, 125, 6, 1, 251, 244, 125, 6, 1, 219, - 163, 125, 6, 1, 244, 76, 125, 6, 1, 248, 162, 125, 6, 1, 218, 1, 125, 6, - 1, 217, 66, 125, 6, 1, 247, 71, 125, 6, 1, 217, 89, 125, 6, 1, 237, 130, - 125, 6, 1, 66, 237, 130, 125, 6, 1, 72, 125, 6, 1, 248, 180, 125, 6, 1, - 236, 238, 125, 6, 1, 235, 19, 125, 6, 1, 233, 37, 125, 6, 1, 232, 208, - 125, 6, 1, 230, 129, 125, 6, 1, 229, 26, 125, 6, 1, 227, 87, 125, 6, 1, - 224, 47, 125, 6, 1, 220, 226, 125, 6, 1, 220, 98, 125, 6, 1, 245, 99, - 125, 6, 1, 243, 130, 125, 6, 1, 230, 87, 125, 6, 1, 229, 198, 125, 6, 1, - 224, 173, 125, 6, 1, 221, 39, 125, 6, 1, 251, 3, 125, 6, 1, 225, 25, 125, - 6, 1, 218, 7, 125, 6, 1, 218, 9, 125, 6, 1, 218, 34, 125, 6, 1, 223, 243, - 155, 125, 6, 1, 217, 200, 125, 6, 1, 3, 217, 178, 125, 6, 1, 3, 217, 179, - 2, 222, 135, 125, 6, 1, 217, 231, 125, 6, 1, 237, 161, 3, 217, 178, 125, - 6, 1, 252, 76, 217, 178, 125, 6, 1, 237, 161, 252, 76, 217, 178, 125, 6, - 1, 245, 171, 125, 6, 1, 237, 128, 125, 6, 1, 224, 172, 125, 6, 1, 221, - 70, 60, 125, 6, 1, 235, 137, 233, 37, 125, 3, 1, 253, 205, 125, 3, 1, - 251, 244, 125, 3, 1, 219, 163, 125, 3, 1, 244, 76, 125, 3, 1, 248, 162, - 125, 3, 1, 218, 1, 125, 3, 1, 217, 66, 125, 3, 1, 247, 71, 125, 3, 1, - 217, 89, 125, 3, 1, 237, 130, 125, 3, 1, 66, 237, 130, 125, 3, 1, 72, - 125, 3, 1, 248, 180, 125, 3, 1, 236, 238, 125, 3, 1, 235, 19, 125, 3, 1, - 233, 37, 125, 3, 1, 232, 208, 125, 3, 1, 230, 129, 125, 3, 1, 229, 26, - 125, 3, 1, 227, 87, 125, 3, 1, 224, 47, 125, 3, 1, 220, 226, 125, 3, 1, - 220, 98, 125, 3, 1, 245, 99, 125, 3, 1, 243, 130, 125, 3, 1, 230, 87, - 125, 3, 1, 229, 198, 125, 3, 1, 224, 173, 125, 3, 1, 221, 39, 125, 3, 1, - 251, 3, 125, 3, 1, 225, 25, 125, 3, 1, 218, 7, 125, 3, 1, 218, 9, 125, 3, - 1, 218, 34, 125, 3, 1, 223, 243, 155, 125, 3, 1, 217, 200, 125, 3, 1, 3, - 217, 178, 125, 3, 1, 3, 217, 179, 2, 222, 135, 125, 3, 1, 217, 231, 125, - 3, 1, 237, 161, 3, 217, 178, 125, 3, 1, 252, 76, 217, 178, 125, 3, 1, - 237, 161, 252, 76, 217, 178, 125, 3, 1, 245, 171, 125, 3, 1, 237, 128, - 125, 3, 1, 224, 172, 125, 3, 1, 221, 70, 60, 125, 3, 1, 235, 137, 233, - 37, 7, 6, 1, 235, 202, 2, 51, 135, 7, 3, 1, 235, 202, 2, 51, 135, 7, 6, - 1, 235, 202, 2, 233, 193, 221, 179, 7, 6, 1, 230, 60, 2, 92, 7, 6, 1, - 228, 39, 2, 222, 135, 7, 3, 1, 112, 2, 92, 7, 3, 1, 222, 202, 2, 249, 11, - 92, 7, 6, 1, 243, 226, 2, 249, 48, 7, 3, 1, 243, 226, 2, 249, 48, 7, 6, - 1, 237, 18, 2, 249, 48, 7, 3, 1, 237, 18, 2, 249, 48, 7, 6, 1, 217, 158, - 2, 249, 48, 7, 3, 1, 217, 158, 2, 249, 48, 7, 6, 1, 254, 146, 7, 6, 1, - 234, 187, 2, 96, 7, 6, 1, 215, 60, 7, 6, 1, 215, 254, 146, 7, 3, 1, 220, - 11, 2, 45, 96, 7, 6, 1, 219, 41, 2, 96, 7, 3, 1, 219, 41, 2, 96, 7, 3, 1, - 220, 11, 2, 250, 80, 7, 6, 1, 144, 243, 225, 7, 3, 1, 144, 243, 225, 7, - 3, 1, 222, 133, 229, 129, 7, 3, 1, 178, 2, 231, 183, 7, 3, 1, 215, 228, - 39, 2, 222, 135, 7, 3, 1, 142, 2, 109, 227, 94, 237, 190, 7, 1, 3, 6, - 215, 73, 7, 223, 94, 3, 1, 237, 126, 58, 1, 6, 216, 216, 7, 6, 1, 226, - 235, 2, 223, 33, 222, 135, 7, 6, 1, 217, 158, 2, 223, 33, 222, 135, 75, - 6, 1, 254, 163, 75, 3, 1, 254, 163, 75, 6, 1, 219, 92, 75, 3, 1, 219, 92, - 75, 6, 1, 244, 231, 75, 3, 1, 244, 231, 75, 6, 1, 249, 179, 75, 3, 1, - 249, 179, 75, 6, 1, 246, 236, 75, 3, 1, 246, 236, 75, 6, 1, 224, 11, 75, - 3, 1, 224, 11, 75, 6, 1, 217, 99, 75, 3, 1, 217, 99, 75, 6, 1, 243, 171, - 75, 3, 1, 243, 171, 75, 6, 1, 222, 4, 75, 3, 1, 222, 4, 75, 6, 1, 242, - 70, 75, 3, 1, 242, 70, 75, 6, 1, 236, 226, 75, 3, 1, 236, 226, 75, 6, 1, - 235, 135, 75, 3, 1, 235, 135, 75, 6, 1, 233, 196, 75, 3, 1, 233, 196, 75, - 6, 1, 232, 62, 75, 3, 1, 232, 62, 75, 6, 1, 236, 11, 75, 3, 1, 236, 11, - 75, 6, 1, 74, 75, 3, 1, 74, 75, 6, 1, 229, 108, 75, 3, 1, 229, 108, 75, - 6, 1, 227, 75, 75, 3, 1, 227, 75, 75, 6, 1, 224, 118, 75, 3, 1, 224, 118, - 75, 6, 1, 222, 105, 75, 3, 1, 222, 105, 75, 6, 1, 220, 123, 75, 3, 1, - 220, 123, 75, 6, 1, 245, 203, 75, 3, 1, 245, 203, 75, 6, 1, 236, 130, 75, - 3, 1, 236, 130, 75, 6, 1, 228, 212, 75, 3, 1, 228, 212, 75, 6, 1, 230, - 123, 75, 3, 1, 230, 123, 75, 6, 1, 249, 9, 254, 168, 75, 3, 1, 249, 9, - 254, 168, 75, 6, 1, 48, 75, 254, 191, 75, 3, 1, 48, 75, 254, 191, 75, 6, - 1, 250, 93, 246, 236, 75, 3, 1, 250, 93, 246, 236, 75, 6, 1, 249, 9, 236, - 226, 75, 3, 1, 249, 9, 236, 226, 75, 6, 1, 249, 9, 232, 62, 75, 3, 1, - 249, 9, 232, 62, 75, 6, 1, 250, 93, 232, 62, 75, 3, 1, 250, 93, 232, 62, - 75, 6, 1, 48, 75, 230, 123, 75, 3, 1, 48, 75, 230, 123, 75, 6, 1, 226, - 142, 75, 3, 1, 226, 142, 75, 6, 1, 250, 98, 224, 238, 75, 3, 1, 250, 98, - 224, 238, 75, 6, 1, 48, 75, 224, 238, 75, 3, 1, 48, 75, 224, 238, 75, 6, - 1, 48, 75, 246, 133, 75, 3, 1, 48, 75, 246, 133, 75, 6, 1, 254, 178, 236, - 135, 75, 3, 1, 254, 178, 236, 135, 75, 6, 1, 249, 9, 242, 242, 75, 3, 1, - 249, 9, 242, 242, 75, 6, 1, 48, 75, 242, 242, 75, 3, 1, 48, 75, 242, 242, - 75, 6, 1, 48, 75, 155, 75, 3, 1, 48, 75, 155, 75, 6, 1, 235, 201, 155, - 75, 3, 1, 235, 201, 155, 75, 6, 1, 48, 75, 243, 145, 75, 3, 1, 48, 75, - 243, 145, 75, 6, 1, 48, 75, 243, 173, 75, 3, 1, 48, 75, 243, 173, 75, 6, - 1, 48, 75, 244, 226, 75, 3, 1, 48, 75, 244, 226, 75, 6, 1, 48, 75, 248, - 183, 75, 3, 1, 48, 75, 248, 183, 75, 6, 1, 48, 75, 224, 211, 75, 3, 1, - 48, 75, 224, 211, 75, 6, 1, 48, 231, 115, 224, 211, 75, 3, 1, 48, 231, - 115, 224, 211, 75, 6, 1, 48, 231, 115, 232, 92, 75, 3, 1, 48, 231, 115, - 232, 92, 75, 6, 1, 48, 231, 115, 231, 67, 75, 3, 1, 48, 231, 115, 231, - 67, 75, 6, 1, 48, 231, 115, 218, 238, 75, 3, 1, 48, 231, 115, 218, 238, - 75, 16, 236, 243, 75, 16, 233, 197, 227, 75, 75, 16, 229, 109, 227, 75, - 75, 16, 223, 152, 75, 16, 222, 106, 227, 75, 75, 16, 236, 131, 227, 75, - 75, 16, 224, 212, 224, 118, 75, 6, 1, 250, 93, 224, 238, 75, 3, 1, 250, - 93, 224, 238, 75, 6, 1, 250, 93, 244, 226, 75, 3, 1, 250, 93, 244, 226, - 75, 36, 232, 63, 50, 75, 36, 223, 238, 254, 2, 75, 36, 223, 238, 235, 92, - 75, 48, 231, 115, 245, 90, 223, 136, 75, 48, 231, 115, 248, 210, 228, 82, - 78, 75, 48, 231, 115, 237, 210, 228, 82, 78, 75, 48, 231, 115, 219, 154, - 248, 191, 75, 245, 108, 131, 243, 194, 75, 245, 90, 223, 136, 75, 233, - 113, 248, 191, 95, 3, 1, 254, 131, 95, 3, 1, 252, 209, 95, 3, 1, 244, - 230, 95, 3, 1, 248, 153, 95, 3, 1, 246, 197, 95, 3, 1, 219, 85, 95, 3, 1, - 217, 87, 95, 3, 1, 222, 119, 95, 3, 1, 237, 223, 95, 3, 1, 236, 233, 95, - 3, 1, 235, 143, 95, 3, 1, 234, 86, 95, 3, 1, 232, 211, 95, 3, 1, 230, - 138, 95, 3, 1, 229, 243, 95, 3, 1, 217, 76, 95, 3, 1, 227, 249, 95, 3, 1, - 226, 140, 95, 3, 1, 222, 112, 95, 3, 1, 220, 87, 95, 3, 1, 229, 134, 95, - 3, 1, 236, 138, 95, 3, 1, 244, 119, 95, 3, 1, 228, 140, 95, 3, 1, 224, - 209, 95, 3, 1, 251, 22, 95, 3, 1, 251, 154, 95, 3, 1, 237, 91, 95, 3, 1, - 250, 224, 95, 3, 1, 251, 56, 95, 3, 1, 218, 136, 95, 3, 1, 237, 101, 95, - 3, 1, 243, 208, 95, 3, 1, 243, 162, 95, 3, 1, 243, 108, 95, 3, 1, 218, - 227, 95, 3, 1, 243, 182, 95, 3, 1, 243, 2, 221, 197, 1, 184, 221, 197, 1, - 218, 72, 221, 197, 1, 218, 71, 221, 197, 1, 218, 63, 221, 197, 1, 218, - 61, 221, 197, 1, 252, 108, 255, 2, 218, 57, 221, 197, 1, 218, 57, 221, - 197, 1, 218, 69, 221, 197, 1, 218, 66, 221, 197, 1, 218, 68, 221, 197, 1, - 218, 67, 221, 197, 1, 217, 254, 221, 197, 1, 218, 64, 221, 197, 1, 218, - 55, 221, 197, 1, 220, 255, 218, 55, 221, 197, 1, 218, 52, 221, 197, 1, - 218, 59, 221, 197, 1, 252, 108, 255, 2, 218, 59, 221, 197, 1, 220, 255, - 218, 59, 221, 197, 1, 218, 58, 221, 197, 1, 218, 76, 221, 197, 1, 218, - 53, 221, 197, 1, 220, 255, 218, 53, 221, 197, 1, 218, 43, 221, 197, 1, - 220, 255, 218, 43, 221, 197, 1, 217, 250, 221, 197, 1, 218, 27, 221, 197, - 1, 254, 200, 218, 27, 221, 197, 1, 220, 255, 218, 27, 221, 197, 1, 218, - 51, 221, 197, 1, 218, 50, 221, 197, 1, 218, 47, 221, 197, 1, 220, 255, - 218, 60, 221, 197, 1, 220, 255, 218, 45, 221, 197, 1, 218, 44, 221, 197, - 1, 217, 200, 221, 197, 1, 218, 41, 221, 197, 1, 218, 40, 221, 197, 1, - 218, 62, 221, 197, 1, 220, 255, 218, 62, 221, 197, 1, 253, 208, 218, 62, - 221, 197, 1, 218, 39, 221, 197, 1, 218, 37, 221, 197, 1, 218, 38, 221, - 197, 1, 218, 36, 221, 197, 1, 218, 35, 221, 197, 1, 218, 70, 221, 197, 1, - 218, 33, 221, 197, 1, 218, 32, 221, 197, 1, 218, 31, 221, 197, 1, 218, - 30, 221, 197, 1, 218, 28, 221, 197, 1, 222, 98, 218, 28, 221, 197, 1, - 218, 26, 221, 197, 58, 1, 235, 182, 78, 28, 4, 235, 11, 28, 4, 233, 135, - 28, 4, 227, 73, 28, 4, 224, 25, 28, 4, 224, 199, 28, 4, 252, 40, 28, 4, - 221, 139, 28, 4, 250, 181, 28, 4, 231, 202, 28, 4, 231, 55, 28, 4, 244, - 73, 230, 185, 28, 4, 217, 20, 28, 4, 248, 165, 28, 4, 249, 106, 28, 4, - 237, 58, 28, 4, 221, 238, 28, 4, 251, 10, 28, 4, 229, 117, 28, 4, 229, - 36, 28, 4, 244, 130, 28, 4, 244, 126, 28, 4, 244, 127, 28, 4, 244, 128, - 28, 4, 223, 218, 28, 4, 223, 178, 28, 4, 223, 189, 28, 4, 223, 217, 28, - 4, 223, 193, 28, 4, 223, 194, 28, 4, 223, 182, 28, 4, 251, 114, 28, 4, - 251, 101, 28, 4, 251, 103, 28, 4, 251, 113, 28, 4, 251, 111, 28, 4, 251, - 112, 28, 4, 251, 102, 28, 4, 216, 247, 28, 4, 216, 227, 28, 4, 216, 238, - 28, 4, 216, 246, 28, 4, 216, 241, 28, 4, 216, 242, 28, 4, 216, 230, 28, - 4, 251, 110, 28, 4, 251, 104, 28, 4, 251, 106, 28, 4, 251, 109, 28, 4, - 251, 107, 28, 4, 251, 108, 28, 4, 251, 105, 28, 4, 228, 51, 28, 4, 228, - 41, 28, 4, 228, 47, 28, 4, 228, 50, 28, 4, 228, 48, 28, 4, 228, 49, 28, - 4, 228, 46, 28, 4, 235, 212, 28, 4, 235, 204, 28, 4, 235, 207, 28, 4, - 235, 211, 28, 4, 235, 208, 28, 4, 235, 209, 28, 4, 235, 205, 28, 4, 218, - 103, 28, 4, 218, 93, 28, 4, 218, 99, 28, 4, 218, 102, 28, 4, 218, 100, - 28, 4, 218, 101, 28, 4, 218, 98, 28, 4, 243, 236, 28, 4, 243, 227, 28, 4, - 243, 230, 28, 4, 243, 235, 28, 4, 243, 232, 28, 4, 243, 233, 28, 4, 243, - 229, 36, 31, 1, 252, 144, 36, 31, 1, 219, 165, 36, 31, 1, 244, 116, 36, - 31, 1, 249, 92, 36, 31, 1, 217, 72, 36, 31, 1, 217, 92, 36, 31, 1, 175, - 36, 31, 1, 246, 217, 36, 31, 1, 246, 205, 36, 31, 1, 246, 197, 36, 31, 1, - 74, 36, 31, 1, 229, 198, 36, 31, 1, 246, 148, 36, 31, 1, 246, 138, 36, - 31, 1, 222, 87, 36, 31, 1, 155, 36, 31, 1, 221, 50, 36, 31, 1, 251, 46, - 36, 31, 1, 225, 25, 36, 31, 1, 224, 248, 36, 31, 1, 245, 171, 36, 31, 1, - 246, 137, 36, 31, 1, 60, 36, 31, 1, 238, 26, 36, 31, 1, 248, 181, 36, 31, - 1, 233, 123, 220, 102, 36, 31, 1, 218, 36, 36, 31, 1, 217, 200, 36, 31, - 1, 237, 160, 60, 36, 31, 1, 235, 25, 217, 178, 36, 31, 1, 252, 76, 217, - 178, 36, 31, 1, 237, 160, 252, 76, 217, 178, 45, 254, 120, 223, 89, 234, - 63, 45, 254, 120, 247, 143, 223, 89, 234, 63, 42, 223, 89, 115, 45, 223, - 89, 115, 42, 247, 143, 223, 89, 115, 45, 247, 143, 223, 89, 115, 227, - 241, 237, 178, 234, 63, 227, 241, 247, 143, 237, 178, 234, 63, 247, 143, - 221, 103, 234, 63, 42, 221, 103, 115, 45, 221, 103, 115, 227, 241, 223, - 227, 42, 227, 241, 230, 140, 115, 45, 227, 241, 230, 140, 115, 246, 251, - 250, 121, 229, 239, 245, 126, 229, 239, 210, 245, 126, 229, 239, 242, - 118, 247, 143, 230, 180, 247, 130, 254, 127, 220, 53, 254, 127, 247, 143, - 227, 106, 254, 119, 51, 230, 177, 242, 121, 237, 170, 237, 177, 230, 23, - 252, 14, 242, 122, 2, 249, 13, 221, 180, 2, 227, 94, 50, 42, 109, 229, - 231, 115, 45, 109, 229, 231, 115, 221, 180, 2, 61, 50, 221, 180, 2, 61, - 56, 42, 69, 252, 201, 2, 228, 77, 45, 69, 252, 201, 2, 228, 77, 221, 120, - 42, 144, 115, 221, 120, 45, 144, 115, 252, 29, 42, 144, 115, 252, 29, 45, - 144, 115, 42, 224, 136, 105, 115, 45, 224, 136, 105, 115, 42, 51, 229, - 229, 45, 51, 229, 229, 124, 188, 104, 131, 61, 228, 196, 131, 61, 104, - 124, 188, 228, 196, 204, 245, 116, 61, 228, 196, 245, 170, 61, 78, 210, - 228, 82, 78, 69, 221, 179, 227, 94, 229, 31, 218, 174, 225, 55, 233, 193, - 248, 145, 9, 32, 227, 181, 9, 32, 250, 203, 9, 32, 226, 90, 107, 9, 32, - 226, 90, 103, 9, 32, 226, 90, 160, 9, 32, 229, 157, 9, 32, 252, 21, 9, - 32, 222, 146, 9, 32, 236, 61, 107, 9, 32, 236, 61, 103, 9, 32, 248, 189, - 9, 32, 226, 92, 9, 32, 3, 107, 9, 32, 3, 103, 9, 32, 235, 155, 107, 9, - 32, 235, 155, 103, 9, 32, 235, 155, 160, 9, 32, 235, 155, 154, 9, 32, - 224, 35, 9, 32, 221, 229, 9, 32, 224, 33, 107, 9, 32, 224, 33, 103, 9, - 32, 243, 154, 107, 9, 32, 243, 154, 103, 9, 32, 243, 189, 9, 32, 227, - 233, 9, 32, 251, 8, 9, 32, 223, 68, 9, 32, 233, 117, 9, 32, 249, 90, 9, - 32, 233, 110, 9, 32, 250, 213, 9, 32, 218, 241, 107, 9, 32, 218, 241, - 103, 9, 32, 245, 179, 9, 32, 229, 208, 107, 9, 32, 229, 208, 103, 9, 32, - 224, 114, 144, 221, 99, 221, 60, 9, 32, 250, 110, 9, 32, 248, 159, 9, 32, - 237, 121, 9, 32, 252, 36, 117, 250, 192, 9, 32, 246, 81, 9, 32, 223, 240, - 107, 9, 32, 223, 240, 103, 9, 32, 252, 211, 9, 32, 224, 119, 9, 32, 251, - 199, 224, 119, 9, 32, 232, 126, 107, 9, 32, 232, 126, 103, 9, 32, 232, - 126, 160, 9, 32, 232, 126, 154, 9, 32, 233, 243, 9, 32, 224, 240, 9, 32, - 227, 239, 9, 32, 246, 100, 9, 32, 230, 150, 9, 32, 251, 255, 107, 9, 32, - 251, 255, 103, 9, 32, 234, 21, 9, 32, 233, 112, 9, 32, 244, 40, 107, 9, - 32, 244, 40, 103, 9, 32, 244, 40, 160, 9, 32, 221, 196, 9, 32, 250, 191, - 9, 32, 218, 217, 107, 9, 32, 218, 217, 103, 9, 32, 251, 199, 226, 84, 9, - 32, 224, 114, 242, 189, 9, 32, 242, 189, 9, 32, 251, 199, 223, 247, 9, - 32, 251, 199, 224, 235, 9, 32, 245, 133, 9, 32, 251, 199, 251, 127, 9, - 32, 224, 114, 218, 255, 9, 32, 219, 0, 107, 9, 32, 219, 0, 103, 9, 32, - 250, 214, 9, 32, 251, 199, 244, 62, 9, 32, 171, 107, 9, 32, 171, 103, 9, - 32, 251, 199, 235, 2, 9, 32, 251, 199, 244, 213, 9, 32, 233, 109, 107, 9, - 32, 233, 109, 103, 9, 32, 227, 242, 9, 32, 252, 43, 9, 32, 251, 199, 222, - 117, 235, 119, 9, 32, 251, 199, 235, 120, 9, 32, 251, 199, 218, 194, 9, - 32, 251, 199, 245, 142, 9, 32, 247, 3, 107, 9, 32, 247, 3, 103, 9, 32, - 247, 3, 160, 9, 32, 251, 199, 247, 2, 9, 32, 243, 159, 9, 32, 251, 199, - 242, 188, 9, 32, 252, 35, 9, 32, 244, 111, 9, 32, 251, 199, 245, 176, 9, - 32, 251, 199, 252, 67, 9, 32, 251, 199, 226, 151, 9, 32, 224, 114, 218, - 212, 9, 32, 224, 114, 218, 20, 9, 32, 251, 199, 245, 98, 9, 32, 237, 125, - 246, 103, 9, 32, 251, 199, 246, 103, 9, 32, 237, 125, 221, 121, 9, 32, - 251, 199, 221, 121, 9, 32, 237, 125, 247, 123, 9, 32, 251, 199, 247, 123, - 9, 32, 220, 234, 9, 32, 237, 125, 220, 234, 9, 32, 251, 199, 220, 234, - 53, 32, 107, 53, 32, 235, 43, 53, 32, 248, 145, 53, 32, 224, 55, 53, 32, - 226, 89, 53, 32, 96, 53, 32, 103, 53, 32, 235, 64, 53, 32, 234, 86, 53, - 32, 235, 103, 53, 32, 246, 178, 53, 32, 185, 53, 32, 113, 252, 21, 53, - 32, 250, 111, 53, 32, 242, 65, 53, 32, 222, 146, 53, 32, 230, 119, 252, - 21, 53, 32, 236, 60, 53, 32, 229, 10, 53, 32, 218, 169, 53, 32, 223, 235, - 53, 32, 45, 230, 119, 252, 21, 53, 32, 243, 109, 246, 192, 53, 32, 222, - 65, 53, 32, 248, 189, 53, 32, 226, 92, 53, 32, 250, 203, 53, 32, 228, - 231, 53, 32, 254, 208, 53, 32, 233, 105, 53, 32, 246, 192, 53, 32, 247, - 8, 53, 32, 226, 108, 53, 32, 244, 68, 53, 32, 244, 69, 224, 45, 53, 32, - 246, 102, 53, 32, 252, 75, 53, 32, 218, 183, 53, 32, 251, 24, 53, 32, - 227, 66, 53, 32, 237, 220, 53, 32, 224, 43, 53, 32, 235, 154, 53, 32, - 250, 119, 53, 32, 223, 230, 53, 32, 233, 107, 53, 32, 227, 84, 53, 32, - 218, 171, 53, 32, 230, 134, 53, 32, 220, 239, 53, 32, 247, 113, 53, 32, - 224, 192, 221, 229, 53, 32, 247, 143, 250, 203, 53, 32, 171, 223, 122, - 53, 32, 124, 243, 187, 53, 32, 224, 194, 53, 32, 252, 24, 53, 32, 224, - 32, 53, 32, 252, 3, 53, 32, 223, 145, 53, 32, 243, 153, 53, 32, 243, 195, - 53, 32, 248, 148, 53, 32, 243, 189, 53, 32, 252, 14, 53, 32, 227, 233, - 53, 32, 226, 99, 53, 32, 248, 212, 53, 32, 253, 213, 53, 32, 223, 227, - 53, 32, 231, 184, 53, 32, 223, 68, 53, 32, 226, 118, 53, 32, 233, 117, - 53, 32, 221, 98, 53, 32, 235, 178, 53, 32, 223, 136, 53, 32, 249, 90, 53, - 32, 218, 226, 53, 32, 248, 168, 231, 184, 53, 32, 250, 165, 53, 32, 245, - 84, 53, 32, 250, 211, 53, 32, 223, 148, 53, 32, 218, 240, 53, 32, 245, - 179, 53, 32, 250, 210, 53, 32, 245, 235, 53, 32, 51, 218, 151, 53, 32, - 144, 221, 99, 221, 60, 53, 32, 224, 52, 53, 32, 245, 243, 53, 32, 250, - 110, 53, 32, 248, 159, 53, 32, 228, 228, 53, 32, 237, 121, 53, 32, 234, - 3, 53, 32, 221, 178, 53, 32, 223, 31, 53, 32, 235, 59, 53, 32, 220, 33, - 53, 32, 245, 202, 53, 32, 252, 36, 117, 250, 192, 53, 32, 224, 137, 53, - 32, 247, 143, 222, 62, 53, 32, 218, 207, 53, 32, 224, 62, 53, 32, 248, - 202, 53, 32, 246, 81, 53, 32, 223, 249, 53, 32, 65, 53, 32, 223, 138, 53, - 32, 223, 239, 53, 32, 221, 108, 53, 32, 244, 45, 53, 32, 251, 119, 53, - 32, 223, 160, 53, 32, 252, 211, 53, 32, 227, 145, 53, 32, 224, 119, 53, - 32, 237, 117, 53, 32, 232, 125, 53, 32, 224, 240, 53, 32, 245, 228, 53, - 32, 230, 150, 53, 32, 254, 126, 53, 32, 229, 47, 53, 32, 247, 11, 53, 32, - 251, 254, 53, 32, 234, 21, 53, 32, 233, 156, 53, 32, 225, 73, 53, 32, - 254, 23, 53, 32, 233, 112, 53, 32, 221, 124, 53, 32, 230, 111, 53, 32, - 252, 38, 53, 32, 223, 134, 53, 32, 250, 174, 53, 32, 244, 39, 53, 32, - 221, 196, 53, 32, 237, 192, 53, 32, 252, 44, 53, 32, 219, 0, 246, 192, - 53, 32, 250, 191, 53, 32, 218, 216, 53, 32, 226, 84, 53, 32, 242, 189, - 53, 32, 223, 247, 53, 32, 219, 186, 53, 32, 252, 141, 53, 32, 229, 78, - 53, 32, 252, 227, 53, 32, 224, 235, 53, 32, 227, 202, 53, 32, 227, 10, - 53, 32, 245, 133, 53, 32, 252, 37, 53, 32, 251, 127, 53, 32, 252, 58, 53, - 32, 233, 114, 53, 32, 218, 255, 53, 32, 250, 214, 53, 32, 218, 192, 53, - 32, 248, 199, 53, 32, 219, 86, 53, 32, 244, 62, 53, 32, 235, 2, 53, 32, - 244, 213, 53, 32, 233, 108, 53, 32, 224, 54, 53, 32, 224, 192, 222, 134, - 252, 67, 53, 32, 227, 242, 53, 32, 252, 43, 53, 32, 218, 166, 53, 32, - 246, 3, 53, 32, 235, 119, 53, 32, 222, 117, 235, 119, 53, 32, 235, 116, - 53, 32, 224, 8, 53, 32, 235, 120, 53, 32, 218, 194, 53, 32, 245, 142, 53, - 32, 247, 2, 53, 32, 243, 159, 53, 32, 245, 106, 53, 32, 242, 188, 53, 32, - 252, 35, 53, 32, 222, 122, 53, 32, 243, 200, 53, 32, 245, 195, 53, 32, - 226, 172, 218, 192, 53, 32, 251, 121, 53, 32, 244, 111, 53, 32, 245, 176, - 53, 32, 252, 67, 53, 32, 226, 151, 53, 32, 249, 80, 53, 32, 218, 212, 53, - 32, 243, 139, 53, 32, 218, 20, 53, 32, 233, 163, 53, 32, 252, 53, 53, 32, - 246, 202, 53, 32, 245, 98, 53, 32, 221, 76, 53, 32, 247, 115, 53, 32, - 227, 228, 53, 32, 231, 185, 53, 32, 246, 103, 53, 32, 221, 121, 53, 32, - 247, 123, 53, 32, 220, 234, 53, 32, 245, 143, 98, 249, 46, 126, 42, 199, - 227, 109, 98, 249, 46, 126, 71, 199, 56, 98, 249, 46, 126, 42, 199, 233, - 193, 25, 227, 109, 98, 249, 46, 126, 71, 199, 233, 193, 25, 56, 98, 249, - 46, 126, 245, 90, 223, 47, 98, 249, 46, 126, 223, 48, 245, 97, 50, 98, - 249, 46, 126, 223, 48, 245, 97, 56, 98, 249, 46, 126, 223, 48, 245, 97, - 235, 115, 98, 249, 46, 126, 223, 48, 245, 97, 220, 60, 235, 115, 98, 249, - 46, 126, 223, 48, 245, 97, 220, 60, 227, 109, 98, 249, 46, 126, 223, 48, - 245, 97, 234, 237, 235, 115, 98, 249, 46, 126, 230, 76, 98, 223, 254, 98, - 250, 168, 98, 245, 90, 223, 136, 248, 196, 78, 237, 118, 237, 209, 223, - 159, 100, 98, 237, 138, 78, 98, 250, 194, 78, 98, 54, 217, 84, 42, 254, - 120, 115, 45, 254, 120, 115, 42, 51, 254, 120, 115, 45, 51, 254, 120, - 115, 42, 250, 124, 115, 45, 250, 124, 115, 42, 67, 250, 124, 115, 45, 67, - 250, 124, 115, 42, 84, 235, 91, 115, 45, 84, 235, 91, 115, 229, 14, 78, - 244, 163, 78, 42, 221, 114, 224, 236, 115, 45, 221, 114, 224, 236, 115, - 42, 67, 235, 91, 115, 45, 67, 235, 91, 115, 42, 67, 221, 114, 224, 236, - 115, 45, 67, 221, 114, 224, 236, 115, 42, 67, 40, 115, 45, 67, 40, 115, - 218, 237, 249, 146, 210, 51, 228, 236, 228, 69, 78, 51, 228, 236, 228, - 69, 78, 109, 51, 228, 236, 228, 69, 78, 229, 14, 164, 246, 3, 243, 185, - 231, 107, 107, 243, 185, 231, 107, 103, 243, 185, 231, 107, 160, 243, - 185, 231, 107, 154, 243, 185, 231, 107, 174, 243, 185, 231, 107, 182, - 243, 185, 231, 107, 191, 243, 185, 231, 107, 185, 243, 185, 231, 107, - 190, 98, 235, 83, 145, 78, 98, 227, 88, 145, 78, 98, 249, 52, 145, 78, - 98, 246, 177, 145, 78, 22, 224, 109, 61, 145, 78, 22, 51, 61, 145, 78, - 218, 235, 249, 146, 69, 236, 232, 227, 182, 78, 69, 236, 232, 227, 182, - 2, 219, 70, 224, 9, 78, 69, 236, 232, 227, 182, 164, 220, 60, 243, 194, - 69, 236, 232, 227, 182, 2, 219, 70, 224, 9, 164, 220, 60, 243, 194, 69, - 236, 232, 227, 182, 164, 234, 237, 243, 194, 34, 229, 14, 78, 98, 183, - 235, 44, 245, 225, 225, 55, 100, 243, 185, 231, 107, 222, 65, 243, 185, - 231, 107, 220, 219, 243, 185, 231, 107, 221, 245, 69, 98, 237, 138, 78, - 234, 52, 78, 229, 225, 254, 143, 78, 98, 41, 237, 211, 98, 144, 245, 188, - 223, 254, 136, 1, 3, 60, 136, 1, 60, 136, 1, 3, 72, 136, 1, 72, 136, 1, - 3, 68, 136, 1, 68, 136, 1, 3, 73, 136, 1, 73, 136, 1, 3, 74, 136, 1, 74, - 136, 1, 175, 136, 1, 245, 0, 136, 1, 236, 113, 136, 1, 244, 103, 136, 1, - 236, 7, 136, 1, 244, 17, 136, 1, 236, 184, 136, 1, 244, 191, 136, 1, 236, - 57, 136, 1, 244, 68, 136, 1, 226, 177, 136, 1, 217, 114, 136, 1, 224, - 140, 136, 1, 217, 42, 136, 1, 223, 103, 136, 1, 217, 13, 136, 1, 226, 94, - 136, 1, 217, 92, 136, 1, 224, 26, 136, 1, 217, 21, 136, 1, 222, 155, 136, - 1, 249, 207, 136, 1, 221, 205, 136, 1, 249, 15, 136, 1, 3, 221, 0, 136, - 1, 221, 0, 136, 1, 247, 111, 136, 1, 222, 87, 136, 1, 249, 92, 136, 1, - 101, 136, 1, 248, 167, 136, 1, 208, 136, 1, 232, 62, 136, 1, 231, 144, - 136, 1, 232, 141, 136, 1, 231, 204, 136, 1, 155, 136, 1, 252, 237, 136, - 1, 187, 136, 1, 243, 112, 136, 1, 252, 84, 136, 1, 229, 108, 136, 1, 242, - 173, 136, 1, 251, 248, 136, 1, 228, 202, 136, 1, 243, 162, 136, 1, 252, - 144, 136, 1, 229, 198, 136, 1, 243, 4, 136, 1, 252, 41, 136, 1, 229, 37, - 136, 1, 196, 136, 1, 233, 196, 136, 1, 233, 99, 136, 1, 234, 25, 136, 1, - 233, 136, 136, 1, 3, 184, 136, 1, 184, 136, 1, 3, 217, 200, 136, 1, 217, - 200, 136, 1, 3, 217, 231, 136, 1, 217, 231, 136, 1, 203, 136, 1, 227, - 147, 136, 1, 227, 22, 136, 1, 227, 216, 136, 1, 227, 75, 136, 1, 3, 219, - 7, 136, 1, 219, 7, 136, 1, 218, 204, 136, 1, 218, 227, 136, 1, 218, 187, - 136, 1, 207, 136, 1, 219, 56, 136, 1, 3, 175, 136, 1, 3, 236, 184, 36, - 236, 202, 219, 70, 224, 9, 78, 36, 236, 202, 225, 72, 224, 9, 78, 236, - 202, 219, 70, 224, 9, 78, 236, 202, 225, 72, 224, 9, 78, 136, 237, 138, - 78, 136, 219, 70, 237, 138, 78, 136, 248, 234, 217, 213, 236, 202, 51, - 242, 121, 52, 1, 3, 60, 52, 1, 60, 52, 1, 3, 72, 52, 1, 72, 52, 1, 3, 68, - 52, 1, 68, 52, 1, 3, 73, 52, 1, 73, 52, 1, 3, 74, 52, 1, 74, 52, 1, 175, - 52, 1, 245, 0, 52, 1, 236, 113, 52, 1, 244, 103, 52, 1, 236, 7, 52, 1, - 244, 17, 52, 1, 236, 184, 52, 1, 244, 191, 52, 1, 236, 57, 52, 1, 244, - 68, 52, 1, 226, 177, 52, 1, 217, 114, 52, 1, 224, 140, 52, 1, 217, 42, - 52, 1, 223, 103, 52, 1, 217, 13, 52, 1, 226, 94, 52, 1, 217, 92, 52, 1, - 224, 26, 52, 1, 217, 21, 52, 1, 222, 155, 52, 1, 249, 207, 52, 1, 221, - 205, 52, 1, 249, 15, 52, 1, 3, 221, 0, 52, 1, 221, 0, 52, 1, 247, 111, - 52, 1, 222, 87, 52, 1, 249, 92, 52, 1, 101, 52, 1, 248, 167, 52, 1, 208, - 52, 1, 232, 62, 52, 1, 231, 144, 52, 1, 232, 141, 52, 1, 231, 204, 52, 1, - 155, 52, 1, 252, 237, 52, 1, 187, 52, 1, 243, 112, 52, 1, 252, 84, 52, 1, - 229, 108, 52, 1, 242, 173, 52, 1, 251, 248, 52, 1, 228, 202, 52, 1, 243, - 162, 52, 1, 252, 144, 52, 1, 229, 198, 52, 1, 243, 4, 52, 1, 252, 41, 52, - 1, 229, 37, 52, 1, 196, 52, 1, 233, 196, 52, 1, 233, 99, 52, 1, 234, 25, - 52, 1, 233, 136, 52, 1, 3, 184, 52, 1, 184, 52, 1, 3, 217, 200, 52, 1, - 217, 200, 52, 1, 3, 217, 231, 52, 1, 217, 231, 52, 1, 203, 52, 1, 227, - 147, 52, 1, 227, 22, 52, 1, 227, 216, 52, 1, 227, 75, 52, 1, 3, 219, 7, - 52, 1, 219, 7, 52, 1, 218, 204, 52, 1, 218, 227, 52, 1, 218, 187, 52, 1, - 207, 52, 1, 219, 56, 52, 1, 3, 175, 52, 1, 3, 236, 184, 52, 1, 219, 189, - 52, 1, 219, 94, 52, 1, 219, 165, 52, 1, 219, 72, 52, 233, 193, 248, 145, - 236, 202, 228, 223, 224, 9, 78, 52, 237, 138, 78, 52, 219, 70, 237, 138, - 78, 52, 248, 234, 236, 30, 200, 1, 253, 204, 200, 1, 230, 59, 200, 1, - 189, 200, 1, 246, 74, 200, 1, 250, 46, 200, 1, 222, 201, 200, 1, 207, - 200, 1, 153, 200, 1, 245, 67, 200, 1, 237, 17, 200, 1, 243, 225, 200, 1, - 237, 126, 200, 1, 228, 163, 200, 1, 218, 151, 200, 1, 217, 81, 200, 1, - 251, 70, 200, 1, 225, 27, 200, 1, 152, 200, 1, 217, 157, 200, 1, 251, - 202, 200, 1, 198, 200, 1, 60, 200, 1, 74, 200, 1, 73, 200, 1, 246, 239, - 200, 1, 254, 196, 200, 1, 246, 237, 200, 1, 253, 232, 200, 1, 230, 86, - 200, 1, 254, 131, 200, 1, 246, 197, 200, 1, 254, 123, 200, 1, 246, 185, - 200, 1, 246, 148, 200, 1, 72, 200, 1, 68, 200, 1, 237, 137, 200, 1, 216, - 216, 200, 1, 232, 117, 200, 1, 244, 72, 200, 1, 238, 0, 22, 1, 236, 86, - 22, 1, 223, 211, 22, 1, 236, 79, 22, 1, 232, 55, 22, 1, 232, 53, 22, 1, - 232, 52, 22, 1, 221, 192, 22, 1, 223, 200, 22, 1, 227, 140, 22, 1, 227, - 135, 22, 1, 227, 132, 22, 1, 227, 125, 22, 1, 227, 120, 22, 1, 227, 115, - 22, 1, 227, 126, 22, 1, 227, 138, 22, 1, 233, 187, 22, 1, 229, 99, 22, 1, - 223, 208, 22, 1, 229, 88, 22, 1, 224, 104, 22, 1, 223, 205, 22, 1, 238, - 22, 22, 1, 250, 230, 22, 1, 223, 215, 22, 1, 251, 29, 22, 1, 236, 128, - 22, 1, 222, 0, 22, 1, 229, 127, 22, 1, 243, 106, 22, 1, 60, 22, 1, 254, - 234, 22, 1, 184, 22, 1, 218, 65, 22, 1, 246, 168, 22, 1, 73, 22, 1, 218, - 16, 22, 1, 218, 25, 22, 1, 74, 22, 1, 219, 7, 22, 1, 219, 4, 22, 1, 230, - 167, 22, 1, 217, 231, 22, 1, 68, 22, 1, 218, 219, 22, 1, 218, 227, 22, 1, - 218, 204, 22, 1, 217, 200, 22, 1, 246, 115, 22, 1, 217, 250, 22, 1, 72, - 22, 245, 185, 22, 1, 223, 209, 22, 1, 232, 45, 22, 1, 232, 47, 22, 1, - 232, 50, 22, 1, 227, 133, 22, 1, 227, 114, 22, 1, 227, 122, 22, 1, 227, - 127, 22, 1, 227, 112, 22, 1, 233, 180, 22, 1, 233, 177, 22, 1, 233, 181, - 22, 1, 236, 220, 22, 1, 229, 94, 22, 1, 229, 80, 22, 1, 229, 86, 22, 1, - 229, 83, 22, 1, 229, 97, 22, 1, 229, 81, 22, 1, 236, 218, 22, 1, 236, - 216, 22, 1, 224, 97, 22, 1, 224, 95, 22, 1, 224, 87, 22, 1, 224, 92, 22, - 1, 224, 102, 22, 1, 230, 1, 22, 1, 223, 212, 22, 1, 218, 6, 22, 1, 218, - 2, 22, 1, 218, 3, 22, 1, 236, 219, 22, 1, 223, 213, 22, 1, 218, 12, 22, - 1, 217, 225, 22, 1, 217, 224, 22, 1, 217, 227, 22, 1, 217, 191, 22, 1, - 217, 192, 22, 1, 217, 195, 22, 1, 254, 60, 22, 1, 254, 54, 98, 254, 112, - 235, 33, 78, 98, 254, 112, 227, 160, 78, 98, 254, 112, 131, 78, 98, 254, - 112, 124, 78, 98, 254, 112, 148, 78, 98, 254, 112, 245, 116, 78, 98, 254, - 112, 221, 120, 78, 98, 254, 112, 233, 193, 78, 98, 254, 112, 252, 29, 78, - 98, 254, 112, 245, 178, 78, 98, 254, 112, 226, 90, 78, 98, 254, 112, 221, - 252, 78, 98, 254, 112, 245, 110, 78, 98, 254, 112, 243, 152, 78, 98, 254, - 112, 247, 9, 78, 98, 254, 112, 234, 87, 78, 200, 1, 251, 248, 200, 1, - 217, 42, 200, 1, 237, 98, 200, 1, 244, 17, 200, 1, 246, 250, 200, 1, 246, - 183, 200, 1, 230, 127, 200, 1, 230, 131, 200, 1, 237, 156, 200, 1, 254, - 114, 200, 1, 237, 198, 200, 1, 220, 68, 200, 1, 237, 238, 200, 1, 232, - 101, 200, 1, 254, 190, 200, 1, 253, 228, 200, 1, 254, 140, 200, 1, 230, - 146, 200, 1, 230, 133, 200, 1, 237, 195, 200, 39, 1, 230, 59, 200, 39, 1, - 222, 201, 200, 39, 1, 237, 17, 200, 39, 1, 243, 225, 9, 214, 222, 201, 9, - 214, 218, 213, 9, 214, 218, 131, 9, 214, 251, 214, 9, 214, 223, 37, 9, - 214, 242, 111, 9, 214, 242, 115, 9, 214, 242, 179, 9, 214, 242, 112, 9, - 214, 222, 204, 9, 214, 242, 114, 9, 214, 242, 110, 9, 214, 242, 177, 9, - 214, 242, 113, 9, 214, 242, 109, 9, 214, 207, 9, 214, 243, 225, 9, 214, - 198, 9, 214, 230, 59, 9, 214, 224, 0, 9, 214, 250, 46, 9, 214, 242, 116, - 9, 214, 243, 122, 9, 214, 222, 213, 9, 214, 223, 22, 9, 214, 223, 168, 9, - 214, 225, 32, 9, 214, 229, 200, 9, 214, 228, 165, 9, 214, 221, 140, 9, - 214, 222, 203, 9, 214, 223, 30, 9, 214, 242, 123, 9, 214, 242, 108, 9, - 214, 229, 143, 9, 214, 228, 163, 52, 1, 3, 236, 7, 52, 1, 3, 224, 140, - 52, 1, 3, 223, 103, 52, 1, 3, 101, 52, 1, 3, 231, 144, 52, 1, 3, 155, 52, - 1, 3, 243, 112, 52, 1, 3, 242, 173, 52, 1, 3, 243, 162, 52, 1, 3, 243, 4, - 52, 1, 3, 233, 99, 52, 1, 3, 203, 52, 1, 3, 227, 147, 52, 1, 3, 227, 22, - 52, 1, 3, 227, 216, 52, 1, 3, 227, 75, 82, 22, 236, 86, 82, 22, 232, 55, - 82, 22, 221, 192, 82, 22, 227, 140, 82, 22, 233, 187, 82, 22, 229, 99, - 82, 22, 224, 104, 82, 22, 238, 22, 82, 22, 250, 230, 82, 22, 251, 29, 82, - 22, 236, 128, 82, 22, 222, 0, 82, 22, 229, 127, 82, 22, 243, 106, 82, 22, - 236, 87, 60, 82, 22, 232, 56, 60, 82, 22, 221, 193, 60, 82, 22, 227, 141, - 60, 82, 22, 233, 188, 60, 82, 22, 229, 100, 60, 82, 22, 224, 105, 60, 82, - 22, 238, 23, 60, 82, 22, 250, 231, 60, 82, 22, 251, 30, 60, 82, 22, 236, - 129, 60, 82, 22, 222, 1, 60, 82, 22, 229, 128, 60, 82, 22, 243, 107, 60, - 82, 22, 250, 231, 68, 82, 236, 34, 126, 230, 156, 82, 236, 34, 126, 142, - 242, 173, 82, 138, 107, 82, 138, 103, 82, 138, 160, 82, 138, 154, 82, - 138, 174, 82, 138, 182, 82, 138, 191, 82, 138, 185, 82, 138, 190, 82, - 138, 222, 65, 82, 138, 233, 117, 82, 138, 245, 179, 82, 138, 218, 240, - 82, 138, 218, 179, 82, 138, 233, 238, 82, 138, 247, 8, 82, 138, 223, 68, - 82, 138, 223, 139, 82, 138, 243, 168, 82, 138, 224, 23, 82, 138, 232, - 218, 82, 138, 223, 248, 82, 138, 245, 184, 82, 138, 250, 154, 82, 138, - 235, 181, 82, 138, 227, 178, 82, 138, 251, 159, 82, 138, 223, 106, 82, - 138, 223, 56, 82, 138, 246, 176, 82, 138, 227, 170, 82, 138, 254, 153, - 82, 138, 245, 208, 82, 138, 227, 168, 82, 138, 225, 73, 82, 138, 227, - 215, 34, 138, 228, 81, 34, 138, 236, 103, 34, 138, 226, 107, 34, 138, - 236, 30, 34, 54, 222, 66, 230, 139, 84, 223, 227, 34, 54, 220, 220, 230, - 139, 84, 223, 227, 34, 54, 221, 246, 230, 139, 84, 223, 227, 34, 54, 245, - 120, 230, 139, 84, 223, 227, 34, 54, 245, 197, 230, 139, 84, 223, 227, - 34, 54, 224, 70, 230, 139, 84, 223, 227, 34, 54, 225, 39, 230, 139, 84, - 223, 227, 34, 54, 246, 228, 230, 139, 84, 223, 227, 229, 221, 55, 34, 54, - 220, 220, 107, 34, 54, 220, 220, 103, 34, 54, 220, 220, 160, 34, 54, 220, - 220, 154, 34, 54, 220, 220, 174, 34, 54, 220, 220, 182, 34, 54, 220, 220, - 191, 34, 54, 220, 220, 185, 34, 54, 220, 220, 190, 34, 54, 221, 245, 34, - 54, 221, 246, 107, 34, 54, 221, 246, 103, 34, 54, 221, 246, 160, 34, 54, - 221, 246, 154, 34, 54, 221, 246, 174, 34, 22, 236, 86, 34, 22, 232, 55, - 34, 22, 221, 192, 34, 22, 227, 140, 34, 22, 233, 187, 34, 22, 229, 99, - 34, 22, 224, 104, 34, 22, 238, 22, 34, 22, 250, 230, 34, 22, 251, 29, 34, - 22, 236, 128, 34, 22, 222, 0, 34, 22, 229, 127, 34, 22, 243, 106, 34, 22, - 236, 87, 60, 34, 22, 232, 56, 60, 34, 22, 221, 193, 60, 34, 22, 227, 141, - 60, 34, 22, 233, 188, 60, 34, 22, 229, 100, 60, 34, 22, 224, 105, 60, 34, - 22, 238, 23, 60, 34, 22, 250, 231, 60, 34, 22, 251, 30, 60, 34, 22, 236, - 129, 60, 34, 22, 222, 1, 60, 34, 22, 229, 128, 60, 34, 22, 243, 107, 60, - 34, 236, 34, 126, 251, 61, 34, 236, 34, 126, 237, 40, 34, 22, 238, 23, - 68, 236, 34, 223, 159, 100, 34, 138, 107, 34, 138, 103, 34, 138, 160, 34, - 138, 154, 34, 138, 174, 34, 138, 182, 34, 138, 191, 34, 138, 185, 34, - 138, 190, 34, 138, 222, 65, 34, 138, 233, 117, 34, 138, 245, 179, 34, - 138, 218, 240, 34, 138, 218, 179, 34, 138, 233, 238, 34, 138, 247, 8, 34, - 138, 223, 68, 34, 138, 223, 139, 34, 138, 243, 168, 34, 138, 224, 23, 34, - 138, 232, 218, 34, 138, 223, 248, 34, 138, 245, 184, 34, 138, 250, 154, - 34, 138, 235, 181, 34, 138, 226, 88, 34, 138, 234, 89, 34, 138, 245, 216, - 34, 138, 223, 79, 34, 138, 246, 97, 34, 138, 228, 233, 34, 138, 253, 236, - 34, 138, 237, 139, 34, 138, 227, 168, 34, 138, 250, 127, 34, 138, 250, - 118, 34, 138, 243, 99, 34, 138, 251, 84, 34, 138, 234, 239, 34, 138, 235, - 115, 34, 138, 227, 109, 34, 138, 234, 19, 34, 138, 227, 189, 34, 138, - 223, 106, 34, 138, 223, 56, 34, 138, 246, 176, 34, 138, 227, 170, 34, - 138, 254, 153, 34, 138, 232, 42, 34, 54, 221, 246, 182, 34, 54, 221, 246, - 191, 34, 54, 221, 246, 185, 34, 54, 221, 246, 190, 34, 54, 245, 119, 34, - 54, 245, 120, 107, 34, 54, 245, 120, 103, 34, 54, 245, 120, 160, 34, 54, - 245, 120, 154, 34, 54, 245, 120, 174, 34, 54, 245, 120, 182, 34, 54, 245, - 120, 191, 34, 54, 245, 120, 185, 34, 54, 245, 120, 190, 34, 54, 245, 196, - 98, 183, 16, 35, 237, 119, 98, 183, 16, 35, 245, 227, 98, 183, 16, 35, - 234, 69, 98, 183, 16, 35, 254, 71, 98, 183, 16, 35, 234, 45, 98, 183, 16, - 35, 237, 38, 98, 183, 16, 35, 237, 39, 98, 183, 16, 35, 253, 229, 98, - 183, 16, 35, 225, 53, 98, 183, 16, 35, 230, 170, 98, 183, 16, 35, 231, - 175, 98, 183, 16, 35, 249, 87, 40, 243, 122, 40, 246, 144, 40, 246, 105, - 235, 49, 235, 66, 55, 34, 52, 60, 34, 52, 72, 34, 52, 68, 34, 52, 73, 34, - 52, 74, 34, 52, 175, 34, 52, 236, 113, 34, 52, 236, 7, 34, 52, 236, 184, - 34, 52, 236, 57, 34, 52, 226, 177, 34, 52, 224, 140, 34, 52, 223, 103, - 34, 52, 226, 94, 34, 52, 224, 26, 34, 52, 222, 155, 34, 52, 221, 205, 34, - 52, 221, 0, 34, 52, 222, 87, 34, 52, 101, 34, 52, 208, 34, 52, 232, 62, - 34, 52, 231, 144, 34, 52, 232, 141, 34, 52, 231, 204, 34, 52, 155, 34, - 52, 243, 112, 34, 52, 242, 173, 34, 52, 243, 162, 34, 52, 243, 4, 34, 52, - 196, 34, 52, 233, 196, 34, 52, 233, 99, 34, 52, 234, 25, 34, 52, 233, - 136, 34, 52, 184, 34, 52, 217, 200, 34, 52, 217, 231, 34, 52, 203, 34, - 52, 227, 147, 34, 52, 227, 22, 34, 52, 227, 216, 34, 52, 227, 75, 34, 52, - 219, 7, 34, 52, 218, 204, 34, 52, 218, 227, 34, 52, 218, 187, 40, 254, - 91, 40, 254, 15, 40, 254, 108, 40, 255, 16, 40, 237, 199, 40, 237, 172, - 40, 220, 66, 40, 246, 124, 40, 246, 248, 40, 230, 130, 40, 230, 125, 40, - 236, 242, 40, 236, 214, 40, 236, 212, 40, 244, 217, 40, 244, 225, 40, - 244, 94, 40, 244, 90, 40, 235, 203, 40, 244, 84, 40, 236, 97, 40, 236, - 96, 40, 236, 95, 40, 236, 94, 40, 243, 251, 40, 243, 250, 40, 235, 244, - 40, 235, 246, 40, 236, 180, 40, 236, 32, 40, 236, 39, 40, 226, 162, 40, - 226, 136, 40, 224, 85, 40, 225, 58, 40, 225, 57, 40, 249, 204, 40, 249, - 45, 40, 248, 146, 40, 221, 134, 40, 232, 214, 40, 231, 176, 40, 243, 199, - 40, 230, 40, 40, 230, 39, 40, 252, 235, 40, 229, 105, 40, 229, 74, 40, - 229, 75, 40, 252, 65, 40, 242, 172, 40, 242, 168, 40, 251, 223, 40, 242, - 155, 40, 243, 143, 40, 229, 150, 40, 229, 178, 40, 243, 129, 40, 229, - 176, 40, 229, 189, 40, 252, 133, 40, 229, 27, 40, 252, 31, 40, 242, 249, - 40, 229, 22, 40, 242, 245, 40, 242, 246, 40, 234, 98, 40, 234, 95, 40, - 234, 102, 40, 234, 59, 40, 234, 80, 40, 233, 167, 40, 233, 149, 40, 233, - 148, 40, 234, 9, 40, 234, 7, 40, 234, 10, 40, 218, 75, 40, 218, 73, 40, - 217, 190, 40, 227, 86, 40, 227, 90, 40, 227, 3, 40, 226, 254, 40, 227, - 188, 40, 227, 186, 40, 218, 239, 98, 183, 16, 35, 242, 184, 217, 84, 98, - 183, 16, 35, 242, 184, 107, 98, 183, 16, 35, 242, 184, 103, 98, 183, 16, - 35, 242, 184, 160, 98, 183, 16, 35, 242, 184, 154, 98, 183, 16, 35, 242, - 184, 174, 98, 183, 16, 35, 242, 184, 182, 98, 183, 16, 35, 242, 184, 191, - 98, 183, 16, 35, 242, 184, 185, 98, 183, 16, 35, 242, 184, 190, 98, 183, - 16, 35, 242, 184, 222, 65, 98, 183, 16, 35, 242, 184, 246, 211, 98, 183, - 16, 35, 242, 184, 220, 221, 98, 183, 16, 35, 242, 184, 221, 247, 98, 183, - 16, 35, 242, 184, 245, 111, 98, 183, 16, 35, 242, 184, 245, 200, 98, 183, - 16, 35, 242, 184, 224, 77, 98, 183, 16, 35, 242, 184, 225, 41, 98, 183, - 16, 35, 242, 184, 246, 233, 98, 183, 16, 35, 242, 184, 232, 29, 98, 183, - 16, 35, 242, 184, 220, 219, 98, 183, 16, 35, 242, 184, 220, 213, 98, 183, - 16, 35, 242, 184, 220, 209, 98, 183, 16, 35, 242, 184, 220, 210, 98, 183, - 16, 35, 242, 184, 220, 215, 40, 242, 178, 40, 249, 207, 40, 253, 232, 40, - 135, 40, 230, 79, 40, 229, 201, 40, 248, 169, 40, 248, 170, 223, 226, 40, - 248, 170, 250, 88, 40, 237, 137, 40, 246, 147, 232, 219, 243, 144, 40, - 246, 147, 232, 219, 222, 221, 40, 246, 147, 232, 219, 222, 132, 40, 246, - 147, 232, 219, 234, 6, 40, 250, 120, 40, 230, 44, 254, 133, 40, 208, 40, - 233, 100, 60, 40, 196, 40, 175, 40, 236, 187, 40, 234, 41, 40, 244, 205, - 40, 251, 161, 40, 236, 186, 40, 229, 144, 40, 232, 119, 40, 233, 100, - 246, 74, 40, 233, 100, 245, 67, 40, 233, 230, 40, 236, 151, 40, 242, 116, - 40, 236, 115, 40, 233, 198, 40, 244, 105, 40, 221, 207, 40, 233, 100, - 153, 40, 233, 143, 40, 248, 177, 40, 236, 68, 40, 245, 141, 40, 231, 219, - 40, 233, 100, 189, 40, 233, 140, 40, 250, 183, 40, 236, 62, 40, 233, 141, - 223, 226, 40, 250, 184, 223, 226, 40, 234, 187, 223, 226, 40, 236, 63, - 223, 226, 40, 233, 141, 250, 88, 40, 250, 184, 250, 88, 40, 234, 187, - 250, 88, 40, 236, 63, 250, 88, 40, 234, 187, 104, 198, 40, 234, 187, 104, - 226, 235, 223, 226, 40, 187, 40, 236, 26, 40, 233, 102, 40, 244, 48, 40, - 227, 252, 40, 227, 253, 104, 198, 40, 227, 253, 104, 226, 235, 223, 226, - 40, 228, 213, 40, 231, 148, 40, 233, 100, 198, 40, 233, 101, 40, 228, - 183, 40, 231, 87, 40, 233, 100, 216, 216, 40, 233, 52, 40, 235, 237, 40, - 233, 53, 234, 9, 40, 228, 182, 40, 231, 86, 40, 233, 100, 219, 40, 40, - 233, 50, 40, 235, 235, 40, 233, 51, 234, 9, 40, 237, 18, 230, 159, 40, - 234, 187, 230, 159, 40, 254, 140, 40, 252, 20, 40, 251, 115, 40, 251, - 100, 40, 251, 203, 104, 236, 151, 40, 250, 182, 40, 249, 134, 40, 243, - 237, 40, 155, 40, 242, 179, 40, 237, 223, 40, 236, 75, 40, 236, 63, 251, - 142, 40, 236, 9, 40, 235, 15, 40, 235, 14, 40, 235, 8, 40, 234, 199, 40, - 234, 42, 224, 43, 40, 233, 166, 40, 233, 129, 40, 229, 142, 40, 229, 40, - 40, 229, 5, 40, 229, 3, 40, 223, 220, 40, 223, 41, 40, 218, 228, 40, 220, - 11, 104, 189, 40, 112, 104, 189, 98, 183, 16, 35, 249, 137, 107, 98, 183, - 16, 35, 249, 137, 103, 98, 183, 16, 35, 249, 137, 160, 98, 183, 16, 35, - 249, 137, 154, 98, 183, 16, 35, 249, 137, 174, 98, 183, 16, 35, 249, 137, - 182, 98, 183, 16, 35, 249, 137, 191, 98, 183, 16, 35, 249, 137, 185, 98, - 183, 16, 35, 249, 137, 190, 98, 183, 16, 35, 249, 137, 222, 65, 98, 183, - 16, 35, 249, 137, 246, 211, 98, 183, 16, 35, 249, 137, 220, 221, 98, 183, - 16, 35, 249, 137, 221, 247, 98, 183, 16, 35, 249, 137, 245, 111, 98, 183, - 16, 35, 249, 137, 245, 200, 98, 183, 16, 35, 249, 137, 224, 77, 98, 183, - 16, 35, 249, 137, 225, 41, 98, 183, 16, 35, 249, 137, 246, 233, 98, 183, - 16, 35, 249, 137, 232, 29, 98, 183, 16, 35, 249, 137, 220, 219, 98, 183, - 16, 35, 249, 137, 220, 213, 98, 183, 16, 35, 249, 137, 220, 209, 98, 183, - 16, 35, 249, 137, 220, 210, 98, 183, 16, 35, 249, 137, 220, 215, 98, 183, - 16, 35, 249, 137, 220, 216, 98, 183, 16, 35, 249, 137, 220, 211, 98, 183, - 16, 35, 249, 137, 220, 212, 98, 183, 16, 35, 249, 137, 220, 218, 98, 183, - 16, 35, 249, 137, 220, 214, 98, 183, 16, 35, 249, 137, 221, 245, 98, 183, - 16, 35, 249, 137, 221, 244, 40, 244, 240, 205, 35, 222, 23, 250, 108, - 243, 151, 205, 35, 222, 23, 227, 213, 247, 8, 205, 35, 248, 244, 253, - 245, 222, 23, 252, 130, 205, 35, 217, 211, 245, 137, 205, 35, 219, 1, - 205, 35, 250, 155, 205, 35, 222, 23, 254, 30, 205, 35, 242, 253, 221, - 136, 205, 35, 3, 222, 120, 205, 35, 221, 100, 205, 35, 229, 196, 205, 35, - 223, 158, 205, 35, 245, 218, 205, 35, 244, 32, 229, 15, 205, 35, 233, - 132, 205, 35, 246, 175, 205, 35, 245, 138, 205, 35, 218, 172, 230, 139, - 222, 23, 249, 88, 205, 35, 254, 75, 205, 35, 250, 139, 205, 35, 252, 59, - 221, 224, 205, 35, 244, 46, 205, 35, 223, 237, 254, 90, 205, 35, 227, - 162, 205, 35, 237, 194, 205, 35, 244, 32, 222, 120, 205, 35, 233, 106, - 250, 122, 205, 35, 244, 32, 228, 240, 205, 35, 222, 23, 255, 4, 218, 240, - 205, 35, 222, 23, 250, 201, 245, 179, 205, 35, 237, 206, 205, 35, 247, - 90, 205, 35, 227, 165, 205, 35, 244, 32, 229, 10, 205, 35, 228, 227, 205, - 35, 249, 151, 117, 222, 23, 235, 58, 205, 35, 222, 23, 245, 246, 205, 35, - 230, 109, 205, 35, 230, 173, 205, 35, 249, 66, 205, 35, 249, 84, 205, 35, - 237, 217, 205, 35, 252, 11, 205, 35, 250, 170, 199, 234, 12, 205, 35, - 244, 212, 221, 136, 205, 35, 228, 187, 220, 54, 205, 35, 230, 108, 205, - 35, 222, 23, 218, 221, 205, 35, 227, 156, 205, 35, 222, 23, 251, 121, - 205, 35, 222, 23, 254, 26, 221, 221, 205, 35, 222, 23, 236, 181, 223, - 141, 233, 107, 205, 35, 249, 43, 205, 35, 222, 23, 234, 61, 234, 99, 205, - 35, 255, 5, 205, 35, 222, 23, 218, 252, 205, 35, 222, 23, 244, 177, 218, - 194, 205, 35, 222, 23, 237, 44, 235, 165, 205, 35, 248, 200, 205, 35, - 235, 50, 205, 35, 237, 197, 221, 59, 205, 35, 3, 228, 240, 205, 35, 254, - 210, 250, 162, 205, 35, 252, 132, 250, 162, 8, 4, 237, 140, 8, 4, 237, - 134, 8, 4, 72, 8, 4, 237, 159, 8, 4, 238, 24, 8, 4, 238, 7, 8, 4, 238, - 26, 8, 4, 238, 25, 8, 4, 253, 244, 8, 4, 253, 214, 8, 4, 60, 8, 4, 254, - 92, 8, 4, 220, 64, 8, 4, 220, 67, 8, 4, 220, 65, 8, 4, 230, 92, 8, 4, - 230, 68, 8, 4, 74, 8, 4, 230, 120, 8, 4, 246, 98, 8, 4, 73, 8, 4, 218, - 165, 8, 4, 252, 60, 8, 4, 252, 57, 8, 4, 252, 84, 8, 4, 252, 68, 8, 4, - 252, 78, 8, 4, 252, 77, 8, 4, 252, 80, 8, 4, 252, 79, 8, 4, 252, 184, 8, - 4, 252, 180, 8, 4, 252, 237, 8, 4, 252, 202, 8, 4, 251, 231, 8, 4, 251, - 235, 8, 4, 251, 232, 8, 4, 252, 30, 8, 4, 252, 21, 8, 4, 252, 41, 8, 4, - 252, 32, 8, 4, 252, 97, 8, 4, 252, 144, 8, 4, 252, 109, 8, 4, 251, 221, - 8, 4, 251, 219, 8, 4, 251, 248, 8, 4, 251, 230, 8, 4, 251, 224, 8, 4, - 251, 228, 8, 4, 251, 207, 8, 4, 251, 206, 8, 4, 251, 212, 8, 4, 251, 210, - 8, 4, 251, 208, 8, 4, 251, 209, 8, 4, 229, 64, 8, 4, 229, 60, 8, 4, 229, - 108, 8, 4, 229, 70, 8, 4, 229, 79, 8, 4, 229, 103, 8, 4, 229, 101, 8, 4, - 229, 215, 8, 4, 229, 206, 8, 4, 187, 8, 4, 229, 246, 8, 4, 228, 192, 8, - 4, 228, 194, 8, 4, 228, 193, 8, 4, 229, 12, 8, 4, 229, 8, 8, 4, 229, 37, - 8, 4, 229, 19, 8, 4, 228, 185, 8, 4, 228, 184, 8, 4, 228, 202, 8, 4, 228, - 191, 8, 4, 228, 188, 8, 4, 228, 190, 8, 4, 228, 167, 8, 4, 228, 166, 8, - 4, 228, 171, 8, 4, 228, 170, 8, 4, 228, 168, 8, 4, 228, 169, 8, 4, 252, - 165, 8, 4, 252, 164, 8, 4, 252, 171, 8, 4, 252, 166, 8, 4, 252, 168, 8, - 4, 252, 167, 8, 4, 252, 170, 8, 4, 252, 169, 8, 4, 252, 176, 8, 4, 252, - 175, 8, 4, 252, 178, 8, 4, 252, 177, 8, 4, 252, 156, 8, 4, 252, 158, 8, - 4, 252, 157, 8, 4, 252, 161, 8, 4, 252, 160, 8, 4, 252, 163, 8, 4, 252, - 162, 8, 4, 252, 172, 8, 4, 252, 174, 8, 4, 252, 173, 8, 4, 252, 152, 8, - 4, 252, 151, 8, 4, 252, 159, 8, 4, 252, 155, 8, 4, 252, 153, 8, 4, 252, - 154, 8, 4, 252, 148, 8, 4, 252, 147, 8, 4, 252, 150, 8, 4, 252, 149, 8, - 4, 232, 188, 8, 4, 232, 187, 8, 4, 232, 193, 8, 4, 232, 189, 8, 4, 232, - 190, 8, 4, 232, 192, 8, 4, 232, 191, 8, 4, 232, 195, 8, 4, 232, 194, 8, - 4, 232, 197, 8, 4, 232, 196, 8, 4, 232, 184, 8, 4, 232, 183, 8, 4, 232, - 186, 8, 4, 232, 185, 8, 4, 232, 178, 8, 4, 232, 177, 8, 4, 232, 182, 8, - 4, 232, 181, 8, 4, 232, 179, 8, 4, 232, 180, 8, 4, 232, 172, 8, 4, 232, - 171, 8, 4, 232, 176, 8, 4, 232, 175, 8, 4, 232, 173, 8, 4, 232, 174, 8, - 4, 243, 46, 8, 4, 243, 45, 8, 4, 243, 51, 8, 4, 243, 47, 8, 4, 243, 48, - 8, 4, 243, 50, 8, 4, 243, 49, 8, 4, 243, 54, 8, 4, 243, 53, 8, 4, 243, - 56, 8, 4, 243, 55, 8, 4, 243, 37, 8, 4, 243, 39, 8, 4, 243, 38, 8, 4, - 243, 42, 8, 4, 243, 41, 8, 4, 243, 44, 8, 4, 243, 43, 8, 4, 243, 33, 8, - 4, 243, 32, 8, 4, 243, 40, 8, 4, 243, 36, 8, 4, 243, 34, 8, 4, 243, 35, - 8, 4, 243, 27, 8, 4, 243, 31, 8, 4, 243, 30, 8, 4, 243, 28, 8, 4, 243, - 29, 8, 4, 233, 145, 8, 4, 233, 144, 8, 4, 233, 196, 8, 4, 233, 151, 8, 4, - 233, 173, 8, 4, 233, 190, 8, 4, 233, 189, 8, 4, 234, 51, 8, 4, 234, 47, - 8, 4, 196, 8, 4, 234, 78, 8, 4, 233, 75, 8, 4, 233, 74, 8, 4, 233, 77, 8, - 4, 233, 76, 8, 4, 233, 111, 8, 4, 233, 103, 8, 4, 233, 136, 8, 4, 233, - 115, 8, 4, 233, 232, 8, 4, 234, 25, 8, 4, 233, 57, 8, 4, 233, 54, 8, 4, - 233, 99, 8, 4, 233, 71, 8, 4, 233, 64, 8, 4, 233, 69, 8, 4, 233, 36, 8, - 4, 233, 35, 8, 4, 233, 41, 8, 4, 233, 38, 8, 4, 245, 172, 8, 4, 245, 168, - 8, 4, 245, 203, 8, 4, 245, 180, 8, 4, 245, 240, 8, 4, 245, 234, 8, 4, - 246, 8, 8, 4, 245, 242, 8, 4, 245, 109, 8, 4, 245, 139, 8, 4, 245, 130, - 8, 4, 245, 80, 8, 4, 245, 79, 8, 4, 245, 92, 8, 4, 245, 85, 8, 4, 245, - 83, 8, 4, 245, 84, 8, 4, 245, 70, 8, 4, 245, 69, 8, 4, 245, 73, 8, 4, - 245, 71, 8, 4, 219, 74, 8, 4, 219, 73, 8, 4, 219, 94, 8, 4, 219, 83, 8, - 4, 219, 89, 8, 4, 219, 87, 8, 4, 219, 91, 8, 4, 219, 90, 8, 4, 219, 172, - 8, 4, 219, 168, 8, 4, 219, 189, 8, 4, 219, 182, 8, 4, 219, 62, 8, 4, 219, - 58, 8, 4, 219, 72, 8, 4, 219, 63, 8, 4, 219, 95, 8, 4, 219, 156, 8, 4, - 219, 51, 8, 4, 219, 50, 8, 4, 219, 56, 8, 4, 219, 54, 8, 4, 219, 52, 8, - 4, 219, 53, 8, 4, 219, 44, 8, 4, 219, 43, 8, 4, 219, 48, 8, 4, 219, 47, - 8, 4, 219, 45, 8, 4, 219, 46, 8, 4, 248, 197, 8, 4, 248, 185, 8, 4, 249, - 15, 8, 4, 248, 216, 8, 4, 248, 249, 8, 4, 248, 253, 8, 4, 248, 252, 8, 4, - 249, 143, 8, 4, 249, 138, 8, 4, 249, 207, 8, 4, 249, 162, 8, 4, 247, 95, - 8, 4, 247, 96, 8, 4, 248, 145, 8, 4, 247, 128, 8, 4, 248, 167, 8, 4, 248, - 147, 8, 4, 249, 41, 8, 4, 249, 92, 8, 4, 249, 53, 8, 4, 247, 88, 8, 4, - 247, 86, 8, 4, 247, 111, 8, 4, 247, 94, 8, 4, 247, 89, 8, 4, 247, 92, 8, - 4, 221, 161, 8, 4, 221, 157, 8, 4, 221, 205, 8, 4, 221, 169, 8, 4, 221, - 198, 8, 4, 221, 200, 8, 4, 221, 199, 8, 4, 222, 110, 8, 4, 222, 97, 8, 4, - 222, 155, 8, 4, 222, 115, 8, 4, 220, 244, 8, 4, 220, 243, 8, 4, 220, 246, - 8, 4, 220, 245, 8, 4, 221, 113, 8, 4, 221, 110, 8, 4, 101, 8, 4, 221, - 119, 8, 4, 222, 40, 8, 4, 222, 87, 8, 4, 222, 57, 8, 4, 220, 231, 8, 4, - 220, 228, 8, 4, 221, 0, 8, 4, 220, 242, 8, 4, 220, 232, 8, 4, 220, 240, - 8, 4, 249, 109, 8, 4, 249, 108, 8, 4, 249, 114, 8, 4, 249, 110, 8, 4, - 249, 111, 8, 4, 249, 113, 8, 4, 249, 112, 8, 4, 249, 125, 8, 4, 249, 124, - 8, 4, 249, 132, 8, 4, 249, 126, 8, 4, 249, 99, 8, 4, 249, 101, 8, 4, 249, - 100, 8, 4, 249, 104, 8, 4, 249, 103, 8, 4, 249, 107, 8, 4, 249, 105, 8, - 4, 249, 117, 8, 4, 249, 120, 8, 4, 249, 118, 8, 4, 249, 95, 8, 4, 249, - 94, 8, 4, 249, 102, 8, 4, 249, 98, 8, 4, 249, 96, 8, 4, 249, 97, 8, 4, - 232, 156, 8, 4, 232, 155, 8, 4, 232, 160, 8, 4, 232, 157, 8, 4, 232, 158, - 8, 4, 232, 159, 8, 4, 232, 166, 8, 4, 232, 165, 8, 4, 232, 169, 8, 4, - 232, 167, 8, 4, 232, 150, 8, 4, 232, 149, 8, 4, 232, 154, 8, 4, 232, 151, - 8, 4, 232, 161, 8, 4, 232, 164, 8, 4, 232, 162, 8, 4, 232, 144, 8, 4, - 232, 143, 8, 4, 232, 148, 8, 4, 232, 147, 8, 4, 232, 145, 8, 4, 232, 146, - 8, 4, 243, 13, 8, 4, 243, 12, 8, 4, 243, 19, 8, 4, 243, 14, 8, 4, 243, - 16, 8, 4, 243, 15, 8, 4, 243, 18, 8, 4, 243, 17, 8, 4, 243, 24, 8, 4, - 243, 23, 8, 4, 243, 26, 8, 4, 243, 25, 8, 4, 243, 7, 8, 4, 243, 8, 8, 4, - 243, 10, 8, 4, 243, 9, 8, 4, 243, 11, 8, 4, 243, 20, 8, 4, 243, 22, 8, 4, - 243, 21, 8, 4, 243, 6, 8, 4, 232, 21, 8, 4, 232, 20, 8, 4, 232, 62, 8, 4, - 232, 24, 8, 4, 232, 44, 8, 4, 232, 58, 8, 4, 232, 57, 8, 4, 232, 201, 8, - 4, 208, 8, 4, 232, 212, 8, 4, 231, 95, 8, 4, 231, 97, 8, 4, 231, 96, 8, - 4, 231, 184, 8, 4, 231, 173, 8, 4, 231, 204, 8, 4, 231, 191, 8, 4, 232, - 121, 8, 4, 232, 141, 8, 4, 232, 130, 8, 4, 231, 91, 8, 4, 231, 88, 8, 4, - 231, 144, 8, 4, 231, 94, 8, 4, 231, 92, 8, 4, 231, 93, 8, 4, 243, 77, 8, - 4, 243, 76, 8, 4, 243, 82, 8, 4, 243, 78, 8, 4, 243, 79, 8, 4, 243, 81, - 8, 4, 243, 80, 8, 4, 243, 87, 8, 4, 243, 86, 8, 4, 243, 89, 8, 4, 243, - 88, 8, 4, 243, 69, 8, 4, 243, 71, 8, 4, 243, 70, 8, 4, 243, 73, 8, 4, - 243, 75, 8, 4, 243, 74, 8, 4, 243, 83, 8, 4, 243, 85, 8, 4, 243, 84, 8, - 4, 243, 65, 8, 4, 243, 64, 8, 4, 243, 72, 8, 4, 243, 68, 8, 4, 243, 66, - 8, 4, 243, 67, 8, 4, 243, 59, 8, 4, 243, 58, 8, 4, 243, 63, 8, 4, 243, - 62, 8, 4, 243, 60, 8, 4, 243, 61, 8, 4, 235, 27, 8, 4, 235, 22, 8, 4, - 235, 67, 8, 4, 235, 32, 8, 4, 235, 61, 8, 4, 235, 60, 8, 4, 235, 63, 8, - 4, 235, 62, 8, 4, 235, 141, 8, 4, 235, 133, 8, 4, 235, 188, 8, 4, 235, - 147, 8, 4, 234, 214, 8, 4, 234, 213, 8, 4, 234, 216, 8, 4, 234, 215, 8, - 4, 234, 242, 8, 4, 234, 236, 8, 4, 235, 12, 8, 4, 234, 245, 8, 4, 235, - 82, 8, 4, 235, 122, 8, 4, 235, 89, 8, 4, 234, 209, 8, 4, 234, 208, 8, 4, - 234, 231, 8, 4, 234, 212, 8, 4, 234, 210, 8, 4, 234, 211, 8, 4, 234, 191, - 8, 4, 234, 190, 8, 4, 234, 198, 8, 4, 234, 194, 8, 4, 234, 192, 8, 4, - 234, 193, 8, 4, 244, 80, 8, 4, 244, 79, 8, 4, 244, 103, 8, 4, 244, 89, 8, - 4, 244, 96, 8, 4, 244, 95, 8, 4, 244, 98, 8, 4, 244, 97, 8, 4, 244, 214, - 8, 4, 244, 209, 8, 4, 245, 0, 8, 4, 244, 223, 8, 4, 244, 0, 8, 4, 243, - 255, 8, 4, 244, 2, 8, 4, 244, 1, 8, 4, 244, 51, 8, 4, 244, 49, 8, 4, 244, - 68, 8, 4, 244, 59, 8, 4, 244, 164, 8, 4, 244, 162, 8, 4, 244, 191, 8, 4, - 244, 174, 8, 4, 243, 246, 8, 4, 243, 245, 8, 4, 244, 17, 8, 4, 243, 254, - 8, 4, 243, 247, 8, 4, 243, 253, 8, 4, 236, 89, 8, 4, 236, 88, 8, 4, 236, - 113, 8, 4, 236, 99, 8, 4, 236, 107, 8, 4, 236, 109, 8, 4, 236, 108, 8, 4, - 236, 203, 8, 4, 236, 192, 8, 4, 175, 8, 4, 236, 227, 8, 4, 235, 250, 8, - 4, 235, 252, 8, 4, 235, 251, 8, 4, 236, 31, 8, 4, 236, 27, 8, 4, 236, 57, - 8, 4, 236, 38, 8, 4, 236, 159, 8, 4, 236, 156, 8, 4, 236, 184, 8, 4, 236, - 162, 8, 4, 235, 240, 8, 4, 235, 238, 8, 4, 236, 7, 8, 4, 235, 249, 8, 4, - 235, 243, 8, 4, 235, 247, 8, 4, 244, 146, 8, 4, 244, 145, 8, 4, 244, 150, - 8, 4, 244, 147, 8, 4, 244, 149, 8, 4, 244, 148, 8, 4, 244, 157, 8, 4, - 244, 156, 8, 4, 244, 160, 8, 4, 244, 158, 8, 4, 244, 137, 8, 4, 244, 136, - 8, 4, 244, 139, 8, 4, 244, 138, 8, 4, 244, 142, 8, 4, 244, 141, 8, 4, - 244, 144, 8, 4, 244, 143, 8, 4, 244, 152, 8, 4, 244, 151, 8, 4, 244, 155, - 8, 4, 244, 153, 8, 4, 244, 132, 8, 4, 244, 131, 8, 4, 244, 140, 8, 4, - 244, 135, 8, 4, 244, 133, 8, 4, 244, 134, 8, 4, 233, 214, 8, 4, 233, 215, - 8, 4, 233, 227, 8, 4, 233, 226, 8, 4, 233, 229, 8, 4, 233, 228, 8, 4, - 233, 205, 8, 4, 233, 207, 8, 4, 233, 206, 8, 4, 233, 210, 8, 4, 233, 209, - 8, 4, 233, 212, 8, 4, 233, 211, 8, 4, 233, 216, 8, 4, 233, 218, 8, 4, - 233, 217, 8, 4, 233, 201, 8, 4, 233, 200, 8, 4, 233, 208, 8, 4, 233, 204, - 8, 4, 233, 202, 8, 4, 233, 203, 8, 4, 242, 133, 8, 4, 242, 132, 8, 4, - 242, 139, 8, 4, 242, 134, 8, 4, 242, 136, 8, 4, 242, 135, 8, 4, 242, 138, - 8, 4, 242, 137, 8, 4, 242, 144, 8, 4, 242, 143, 8, 4, 242, 146, 8, 4, - 242, 145, 8, 4, 242, 125, 8, 4, 242, 124, 8, 4, 242, 127, 8, 4, 242, 126, - 8, 4, 242, 129, 8, 4, 242, 128, 8, 4, 242, 131, 8, 4, 242, 130, 8, 4, - 242, 140, 8, 4, 242, 142, 8, 4, 242, 141, 8, 4, 232, 89, 8, 4, 232, 91, - 8, 4, 232, 90, 8, 4, 232, 108, 8, 4, 232, 107, 8, 4, 232, 115, 8, 4, 232, - 110, 8, 4, 232, 71, 8, 4, 232, 70, 8, 4, 232, 72, 8, 4, 232, 78, 8, 4, - 232, 75, 8, 4, 232, 84, 8, 4, 232, 79, 8, 4, 232, 102, 8, 4, 232, 106, 8, - 4, 232, 103, 8, 4, 243, 92, 8, 4, 243, 100, 8, 4, 243, 108, 8, 4, 243, - 173, 8, 4, 243, 167, 8, 4, 155, 8, 4, 243, 183, 8, 4, 242, 157, 8, 4, - 242, 156, 8, 4, 242, 159, 8, 4, 242, 158, 8, 4, 242, 186, 8, 4, 242, 181, - 8, 4, 243, 4, 8, 4, 242, 244, 8, 4, 243, 125, 8, 4, 243, 162, 8, 4, 243, - 135, 8, 4, 218, 243, 8, 4, 218, 231, 8, 4, 219, 7, 8, 4, 218, 251, 8, 4, - 218, 157, 8, 4, 218, 159, 8, 4, 218, 158, 8, 4, 218, 170, 8, 4, 218, 187, - 8, 4, 218, 175, 8, 4, 218, 214, 8, 4, 218, 227, 8, 4, 218, 218, 8, 4, - 217, 28, 8, 4, 217, 27, 8, 4, 217, 42, 8, 4, 217, 30, 8, 4, 217, 35, 8, - 4, 217, 37, 8, 4, 217, 36, 8, 4, 217, 100, 8, 4, 217, 97, 8, 4, 217, 114, - 8, 4, 217, 103, 8, 4, 217, 6, 8, 4, 217, 8, 8, 4, 217, 7, 8, 4, 217, 17, - 8, 4, 217, 16, 8, 4, 217, 21, 8, 4, 217, 18, 8, 4, 217, 82, 8, 4, 217, - 92, 8, 4, 217, 86, 8, 4, 217, 2, 8, 4, 217, 1, 8, 4, 217, 13, 8, 4, 217, - 5, 8, 4, 217, 3, 8, 4, 217, 4, 8, 4, 216, 249, 8, 4, 216, 248, 8, 4, 216, - 254, 8, 4, 216, 252, 8, 4, 216, 250, 8, 4, 216, 251, 8, 4, 250, 215, 8, - 4, 250, 212, 8, 4, 250, 235, 8, 4, 250, 223, 8, 4, 250, 232, 8, 4, 250, - 226, 8, 4, 250, 234, 8, 4, 250, 233, 8, 4, 251, 124, 8, 4, 251, 118, 8, - 4, 251, 169, 8, 4, 251, 143, 8, 4, 250, 84, 8, 4, 250, 86, 8, 4, 250, 85, - 8, 4, 250, 116, 8, 4, 250, 109, 8, 4, 250, 182, 8, 4, 250, 129, 8, 4, - 251, 71, 8, 4, 251, 99, 8, 4, 251, 75, 8, 4, 250, 68, 8, 4, 250, 67, 8, - 4, 250, 92, 8, 4, 250, 82, 8, 4, 250, 71, 8, 4, 250, 81, 8, 4, 250, 49, - 8, 4, 250, 48, 8, 4, 250, 58, 8, 4, 250, 55, 8, 4, 250, 50, 8, 4, 250, - 52, 8, 4, 216, 232, 8, 4, 216, 231, 8, 4, 216, 238, 8, 4, 216, 233, 8, 4, - 216, 235, 8, 4, 216, 234, 8, 4, 216, 237, 8, 4, 216, 236, 8, 4, 216, 244, - 8, 4, 216, 243, 8, 4, 216, 247, 8, 4, 216, 245, 8, 4, 216, 228, 8, 4, - 216, 230, 8, 4, 216, 229, 8, 4, 216, 239, 8, 4, 216, 242, 8, 4, 216, 240, - 8, 4, 216, 223, 8, 4, 216, 227, 8, 4, 216, 226, 8, 4, 216, 224, 8, 4, - 216, 225, 8, 4, 216, 218, 8, 4, 216, 217, 8, 4, 216, 222, 8, 4, 216, 221, - 8, 4, 216, 219, 8, 4, 216, 220, 8, 4, 231, 31, 8, 4, 231, 30, 8, 4, 231, - 36, 8, 4, 231, 32, 8, 4, 231, 33, 8, 4, 231, 35, 8, 4, 231, 34, 8, 4, - 231, 40, 8, 4, 231, 39, 8, 4, 231, 42, 8, 4, 231, 41, 8, 4, 231, 25, 8, - 4, 231, 26, 8, 4, 231, 28, 8, 4, 231, 29, 8, 4, 231, 37, 8, 4, 231, 38, - 8, 4, 231, 21, 8, 4, 231, 27, 8, 4, 231, 24, 8, 4, 231, 22, 8, 4, 231, - 23, 8, 4, 231, 16, 8, 4, 231, 15, 8, 4, 231, 20, 8, 4, 231, 19, 8, 4, - 231, 17, 8, 4, 231, 18, 8, 4, 224, 84, 8, 4, 182, 8, 4, 224, 140, 8, 4, - 224, 86, 8, 4, 224, 133, 8, 4, 224, 135, 8, 4, 224, 134, 8, 4, 226, 127, - 8, 4, 226, 120, 8, 4, 226, 177, 8, 4, 226, 133, 8, 4, 223, 63, 8, 4, 223, - 65, 8, 4, 223, 64, 8, 4, 224, 12, 8, 4, 224, 2, 8, 4, 224, 26, 8, 4, 224, - 13, 8, 4, 225, 36, 8, 4, 226, 94, 8, 4, 225, 56, 8, 4, 223, 44, 8, 4, - 223, 42, 8, 4, 223, 103, 8, 4, 223, 62, 8, 4, 223, 46, 8, 4, 223, 53, 8, - 4, 222, 215, 8, 4, 222, 214, 8, 4, 223, 21, 8, 4, 222, 220, 8, 4, 222, - 216, 8, 4, 222, 219, 8, 4, 223, 184, 8, 4, 223, 183, 8, 4, 223, 189, 8, - 4, 223, 185, 8, 4, 223, 186, 8, 4, 223, 188, 8, 4, 223, 187, 8, 4, 223, - 196, 8, 4, 223, 195, 8, 4, 223, 218, 8, 4, 223, 197, 8, 4, 223, 180, 8, - 4, 223, 179, 8, 4, 223, 182, 8, 4, 223, 181, 8, 4, 223, 191, 8, 4, 223, - 194, 8, 4, 223, 192, 8, 4, 223, 176, 8, 4, 223, 175, 8, 4, 223, 178, 8, - 4, 223, 177, 8, 4, 223, 170, 8, 4, 223, 169, 8, 4, 223, 174, 8, 4, 223, - 173, 8, 4, 223, 171, 8, 4, 223, 172, 8, 4, 217, 75, 8, 4, 217, 74, 8, 4, - 217, 80, 8, 4, 217, 77, 8, 4, 217, 57, 8, 4, 217, 59, 8, 4, 217, 58, 8, - 4, 217, 62, 8, 4, 217, 61, 8, 4, 217, 65, 8, 4, 217, 63, 8, 4, 217, 69, - 8, 4, 217, 68, 8, 4, 217, 72, 8, 4, 217, 70, 8, 4, 217, 53, 8, 4, 217, - 52, 8, 4, 217, 60, 8, 4, 217, 56, 8, 4, 217, 54, 8, 4, 217, 55, 8, 4, - 217, 45, 8, 4, 217, 44, 8, 4, 217, 49, 8, 4, 217, 48, 8, 4, 217, 46, 8, - 4, 217, 47, 8, 4, 251, 51, 8, 4, 251, 48, 8, 4, 251, 69, 8, 4, 251, 57, - 8, 4, 250, 249, 8, 4, 250, 248, 8, 4, 250, 251, 8, 4, 250, 250, 8, 4, - 251, 5, 8, 4, 251, 4, 8, 4, 251, 11, 8, 4, 251, 7, 8, 4, 251, 36, 8, 4, - 251, 34, 8, 4, 251, 46, 8, 4, 251, 38, 8, 4, 250, 243, 8, 4, 250, 253, 8, - 4, 250, 247, 8, 4, 250, 244, 8, 4, 250, 246, 8, 4, 250, 237, 8, 4, 250, - 236, 8, 4, 250, 241, 8, 4, 250, 240, 8, 4, 250, 238, 8, 4, 250, 239, 8, - 4, 227, 51, 8, 4, 227, 52, 8, 4, 227, 38, 8, 4, 227, 39, 8, 4, 227, 42, - 8, 4, 227, 41, 8, 4, 227, 44, 8, 4, 227, 43, 8, 4, 227, 46, 8, 4, 227, - 45, 8, 4, 227, 50, 8, 4, 227, 47, 8, 4, 227, 34, 8, 4, 227, 33, 8, 4, - 227, 40, 8, 4, 227, 37, 8, 4, 227, 35, 8, 4, 227, 36, 8, 4, 227, 28, 8, - 4, 227, 27, 8, 4, 227, 32, 8, 4, 227, 31, 8, 4, 227, 29, 8, 4, 227, 30, - 8, 4, 231, 169, 8, 4, 231, 168, 8, 4, 231, 171, 8, 4, 231, 170, 8, 4, - 231, 161, 8, 4, 231, 163, 8, 4, 231, 162, 8, 4, 231, 165, 8, 4, 231, 164, - 8, 4, 231, 167, 8, 4, 231, 166, 8, 4, 231, 156, 8, 4, 231, 155, 8, 4, - 231, 160, 8, 4, 231, 159, 8, 4, 231, 157, 8, 4, 231, 158, 8, 4, 231, 150, - 8, 4, 231, 149, 8, 4, 231, 154, 8, 4, 231, 153, 8, 4, 231, 151, 8, 4, - 231, 152, 8, 4, 224, 253, 8, 4, 224, 250, 8, 4, 225, 25, 8, 4, 225, 7, 8, - 4, 224, 163, 8, 4, 224, 165, 8, 4, 224, 164, 8, 4, 224, 178, 8, 4, 224, - 176, 8, 4, 224, 200, 8, 4, 224, 193, 8, 4, 224, 226, 8, 4, 224, 223, 8, - 4, 224, 246, 8, 4, 224, 233, 8, 4, 224, 159, 8, 4, 224, 158, 8, 4, 224, - 170, 8, 4, 224, 162, 8, 4, 224, 160, 8, 4, 224, 161, 8, 4, 224, 143, 8, - 4, 224, 142, 8, 4, 224, 149, 8, 4, 224, 146, 8, 4, 224, 144, 8, 4, 224, - 145, 8, 4, 227, 228, 8, 4, 227, 223, 8, 4, 203, 8, 4, 227, 233, 8, 4, - 227, 6, 8, 4, 227, 8, 8, 4, 227, 7, 8, 4, 227, 60, 8, 4, 227, 54, 8, 4, - 227, 75, 8, 4, 227, 63, 8, 4, 227, 155, 8, 4, 227, 216, 8, 4, 227, 185, - 8, 4, 226, 255, 8, 4, 226, 253, 8, 4, 227, 22, 8, 4, 227, 5, 8, 4, 227, - 1, 8, 4, 227, 2, 8, 4, 226, 238, 8, 4, 226, 237, 8, 4, 226, 243, 8, 4, - 226, 241, 8, 4, 226, 239, 8, 4, 226, 240, 8, 4, 237, 89, 8, 4, 237, 88, - 8, 4, 237, 98, 8, 4, 237, 90, 8, 4, 237, 94, 8, 4, 237, 93, 8, 4, 237, - 96, 8, 4, 237, 95, 8, 4, 237, 34, 8, 4, 237, 33, 8, 4, 237, 36, 8, 4, - 237, 35, 8, 4, 237, 47, 8, 4, 237, 46, 8, 4, 237, 59, 8, 4, 237, 49, 8, - 4, 237, 28, 8, 4, 237, 26, 8, 4, 237, 43, 8, 4, 237, 32, 8, 4, 237, 29, - 8, 4, 237, 30, 8, 4, 237, 20, 8, 4, 237, 19, 8, 4, 237, 24, 8, 4, 237, - 23, 8, 4, 237, 21, 8, 4, 237, 22, 8, 4, 228, 114, 8, 4, 228, 112, 8, 4, - 228, 121, 8, 4, 228, 115, 8, 4, 228, 118, 8, 4, 228, 117, 8, 4, 228, 120, - 8, 4, 228, 119, 8, 4, 228, 70, 8, 4, 228, 67, 8, 4, 228, 72, 8, 4, 228, - 71, 8, 4, 228, 101, 8, 4, 228, 100, 8, 4, 228, 110, 8, 4, 228, 104, 8, 4, - 228, 62, 8, 4, 228, 58, 8, 4, 228, 98, 8, 4, 228, 66, 8, 4, 228, 64, 8, - 4, 228, 65, 8, 4, 228, 42, 8, 4, 228, 40, 8, 4, 228, 52, 8, 4, 228, 45, - 8, 4, 228, 43, 8, 4, 228, 44, 8, 4, 237, 78, 8, 4, 237, 77, 8, 4, 237, - 84, 8, 4, 237, 79, 8, 4, 237, 81, 8, 4, 237, 80, 8, 4, 237, 83, 8, 4, - 237, 82, 8, 4, 237, 69, 8, 4, 237, 71, 8, 4, 237, 70, 8, 4, 237, 74, 8, - 4, 237, 73, 8, 4, 237, 76, 8, 4, 237, 75, 8, 4, 237, 65, 8, 4, 237, 64, - 8, 4, 237, 72, 8, 4, 237, 68, 8, 4, 237, 66, 8, 4, 237, 67, 8, 4, 237, - 61, 8, 4, 237, 60, 8, 4, 237, 63, 8, 4, 237, 62, 8, 4, 232, 7, 8, 4, 232, - 6, 8, 4, 232, 13, 8, 4, 232, 8, 8, 4, 232, 10, 8, 4, 232, 9, 8, 4, 232, - 12, 8, 4, 232, 11, 8, 4, 231, 253, 8, 4, 231, 254, 8, 4, 232, 2, 8, 4, - 232, 1, 8, 4, 232, 5, 8, 4, 232, 3, 8, 4, 231, 249, 8, 4, 232, 0, 8, 4, - 231, 252, 8, 4, 231, 250, 8, 4, 231, 251, 8, 4, 231, 244, 8, 4, 231, 243, - 8, 4, 231, 248, 8, 4, 231, 247, 8, 4, 231, 245, 8, 4, 231, 246, 8, 4, - 231, 59, 8, 4, 231, 58, 8, 4, 231, 67, 8, 4, 231, 61, 8, 4, 231, 64, 8, - 4, 231, 63, 8, 4, 231, 66, 8, 4, 231, 65, 8, 4, 231, 47, 8, 4, 231, 49, - 8, 4, 231, 48, 8, 4, 231, 52, 8, 4, 231, 51, 8, 4, 231, 56, 8, 4, 231, - 53, 8, 4, 231, 45, 8, 4, 231, 44, 8, 4, 231, 50, 8, 4, 231, 46, 8, 4, - 218, 123, 8, 4, 218, 122, 8, 4, 218, 130, 8, 4, 218, 125, 8, 4, 218, 127, - 8, 4, 218, 126, 8, 4, 218, 129, 8, 4, 218, 128, 8, 4, 218, 112, 8, 4, - 218, 113, 8, 4, 218, 117, 8, 4, 218, 116, 8, 4, 218, 121, 8, 4, 218, 119, - 8, 4, 218, 94, 8, 4, 218, 92, 8, 4, 218, 104, 8, 4, 218, 97, 8, 4, 218, - 95, 8, 4, 218, 96, 8, 4, 217, 237, 8, 4, 217, 235, 8, 4, 217, 250, 8, 4, - 217, 238, 8, 4, 217, 245, 8, 4, 217, 244, 8, 4, 217, 247, 8, 4, 217, 246, - 8, 4, 217, 185, 8, 4, 217, 184, 8, 4, 217, 187, 8, 4, 217, 186, 8, 4, - 217, 212, 8, 4, 217, 209, 8, 4, 217, 231, 8, 4, 217, 215, 8, 4, 217, 177, - 8, 4, 217, 175, 8, 4, 217, 200, 8, 4, 217, 183, 8, 4, 217, 180, 8, 4, - 217, 181, 8, 4, 217, 160, 8, 4, 217, 159, 8, 4, 217, 166, 8, 4, 217, 163, - 8, 4, 217, 161, 8, 4, 217, 162, 8, 32, 228, 101, 8, 32, 235, 67, 8, 32, - 236, 89, 8, 32, 231, 61, 8, 32, 250, 55, 8, 32, 223, 189, 8, 32, 244, - 143, 8, 32, 244, 174, 8, 32, 233, 196, 8, 32, 242, 133, 8, 32, 234, 193, - 8, 32, 252, 152, 8, 32, 233, 115, 8, 32, 217, 231, 8, 32, 228, 185, 8, - 32, 242, 127, 8, 32, 222, 110, 8, 32, 245, 0, 8, 32, 217, 5, 8, 32, 250, - 49, 8, 32, 249, 97, 8, 32, 251, 228, 8, 32, 244, 139, 8, 32, 231, 53, 8, - 32, 221, 0, 8, 32, 230, 120, 8, 32, 237, 65, 8, 32, 217, 17, 8, 32, 228, - 167, 8, 32, 243, 44, 8, 32, 217, 237, 8, 32, 219, 53, 8, 32, 224, 149, 8, - 32, 219, 156, 8, 32, 217, 114, 8, 32, 237, 59, 8, 32, 231, 24, 8, 32, - 237, 63, 8, 32, 244, 51, 8, 32, 237, 83, 8, 32, 218, 187, 8, 32, 247, - 111, 8, 32, 224, 161, 8, 32, 235, 63, 8, 32, 250, 58, 8, 32, 250, 85, 8, - 32, 250, 223, 8, 32, 242, 130, 8, 32, 224, 253, 8, 32, 217, 4, 8, 32, - 224, 193, 8, 32, 251, 46, 8, 32, 216, 235, 8, 32, 232, 192, 8, 32, 236, - 184, 235, 28, 1, 252, 237, 235, 28, 1, 187, 235, 28, 1, 229, 141, 235, - 28, 1, 249, 207, 235, 28, 1, 222, 155, 235, 28, 1, 222, 35, 235, 28, 1, - 245, 0, 235, 28, 1, 175, 235, 28, 1, 236, 149, 235, 28, 1, 237, 123, 235, - 28, 1, 251, 169, 235, 28, 1, 251, 69, 235, 28, 1, 247, 74, 235, 28, 1, - 221, 55, 235, 28, 1, 221, 47, 235, 28, 1, 196, 235, 28, 1, 208, 235, 28, - 1, 235, 188, 235, 28, 1, 226, 177, 235, 28, 1, 217, 80, 235, 28, 1, 217, - 114, 235, 28, 1, 232, 115, 235, 28, 1, 155, 235, 28, 1, 218, 138, 235, - 28, 1, 243, 121, 235, 28, 1, 246, 8, 235, 28, 1, 219, 7, 235, 28, 1, 225, - 25, 235, 28, 1, 184, 235, 28, 1, 244, 125, 235, 28, 1, 60, 235, 28, 1, - 254, 234, 235, 28, 1, 73, 235, 28, 1, 246, 115, 235, 28, 1, 72, 235, 28, - 1, 74, 235, 28, 1, 68, 235, 28, 1, 220, 110, 235, 28, 1, 220, 105, 235, - 28, 1, 230, 167, 235, 28, 1, 145, 233, 40, 221, 205, 235, 28, 1, 145, - 232, 238, 229, 37, 235, 28, 1, 145, 233, 40, 250, 57, 235, 28, 1, 145, - 233, 40, 252, 41, 235, 28, 1, 145, 233, 40, 208, 235, 28, 1, 145, 233, - 40, 237, 104, 235, 28, 228, 197, 250, 168, 235, 28, 228, 197, 245, 90, - 223, 136, 38, 4, 246, 250, 38, 4, 246, 247, 38, 4, 243, 148, 38, 4, 218, - 224, 38, 4, 218, 223, 38, 4, 229, 191, 38, 4, 252, 91, 38, 4, 252, 137, - 38, 4, 234, 34, 38, 4, 236, 23, 38, 4, 233, 223, 38, 4, 244, 201, 38, 4, - 245, 226, 38, 4, 219, 160, 38, 4, 222, 80, 38, 4, 222, 21, 38, 4, 249, - 28, 38, 4, 249, 25, 38, 4, 235, 118, 38, 4, 227, 200, 38, 4, 249, 82, 38, - 4, 232, 163, 38, 4, 226, 84, 38, 4, 224, 244, 38, 4, 217, 90, 38, 4, 217, - 71, 38, 4, 251, 91, 38, 4, 237, 113, 38, 4, 232, 14, 38, 4, 218, 22, 38, - 4, 236, 183, 38, 4, 232, 98, 38, 4, 244, 184, 38, 4, 234, 16, 38, 4, 232, - 139, 38, 4, 231, 72, 38, 4, 72, 38, 4, 237, 223, 38, 4, 243, 112, 38, 4, - 243, 96, 38, 4, 218, 204, 38, 4, 218, 195, 38, 4, 229, 108, 38, 4, 252, - 89, 38, 4, 252, 84, 38, 4, 234, 32, 38, 4, 236, 21, 38, 4, 233, 222, 38, - 4, 244, 199, 38, 4, 245, 203, 38, 4, 219, 94, 38, 4, 221, 205, 38, 4, - 222, 2, 38, 4, 249, 20, 38, 4, 249, 24, 38, 4, 235, 67, 38, 4, 227, 147, - 38, 4, 249, 15, 38, 4, 232, 160, 38, 4, 224, 140, 38, 4, 224, 221, 38, 4, - 217, 42, 38, 4, 217, 67, 38, 4, 250, 235, 38, 4, 237, 98, 38, 4, 232, 13, - 38, 4, 217, 250, 38, 4, 236, 113, 38, 4, 232, 96, 38, 4, 244, 103, 38, 4, - 233, 196, 38, 4, 232, 62, 38, 4, 231, 67, 38, 4, 60, 38, 4, 254, 131, 38, - 4, 232, 111, 38, 4, 155, 38, 4, 243, 191, 38, 4, 219, 7, 38, 4, 218, 253, - 38, 4, 187, 38, 4, 252, 94, 38, 4, 252, 237, 38, 4, 234, 37, 38, 4, 236, - 26, 38, 4, 236, 25, 38, 4, 233, 225, 38, 4, 244, 204, 38, 4, 246, 8, 38, - 4, 219, 189, 38, 4, 222, 155, 38, 4, 222, 35, 38, 4, 249, 36, 38, 4, 249, - 27, 38, 4, 235, 188, 38, 4, 203, 38, 4, 249, 207, 38, 4, 232, 169, 38, 4, - 226, 177, 38, 4, 225, 25, 38, 4, 217, 114, 38, 4, 217, 80, 38, 4, 251, - 169, 38, 4, 237, 123, 38, 4, 232, 18, 38, 4, 184, 38, 4, 175, 38, 4, 236, - 233, 38, 4, 232, 100, 38, 4, 245, 0, 38, 4, 196, 38, 4, 208, 38, 4, 231, - 77, 38, 4, 230, 127, 38, 4, 230, 124, 38, 4, 242, 248, 38, 4, 218, 180, - 38, 4, 218, 176, 38, 4, 229, 21, 38, 4, 252, 87, 38, 4, 252, 34, 38, 4, - 234, 30, 38, 4, 236, 19, 38, 4, 233, 220, 38, 4, 244, 196, 38, 4, 245, - 134, 38, 4, 219, 64, 38, 4, 221, 122, 38, 4, 221, 236, 38, 4, 249, 18, - 38, 4, 249, 22, 38, 4, 234, 248, 38, 4, 227, 67, 38, 4, 248, 150, 38, 4, - 232, 152, 38, 4, 224, 14, 38, 4, 224, 195, 38, 4, 217, 19, 38, 4, 217, - 64, 38, 4, 250, 130, 38, 4, 237, 50, 38, 4, 232, 4, 38, 4, 217, 216, 38, - 4, 236, 41, 38, 4, 232, 94, 38, 4, 244, 60, 38, 4, 233, 119, 38, 4, 231, - 195, 38, 4, 231, 54, 38, 4, 68, 38, 4, 220, 87, 38, 4, 242, 173, 38, 4, - 242, 163, 38, 4, 218, 165, 38, 4, 218, 161, 38, 4, 228, 202, 38, 4, 252, - 86, 38, 4, 251, 248, 38, 4, 234, 29, 38, 4, 236, 18, 38, 4, 233, 219, 38, - 4, 244, 195, 38, 4, 245, 92, 38, 4, 219, 56, 38, 4, 221, 0, 38, 4, 221, - 223, 38, 4, 249, 16, 38, 4, 249, 21, 38, 4, 234, 231, 38, 4, 227, 22, 38, - 4, 247, 111, 38, 4, 232, 148, 38, 4, 223, 103, 38, 4, 224, 170, 38, 4, - 217, 13, 38, 4, 217, 60, 38, 4, 250, 92, 38, 4, 237, 43, 38, 4, 232, 0, - 38, 4, 217, 200, 38, 4, 236, 7, 38, 4, 232, 93, 38, 4, 244, 17, 38, 4, - 233, 99, 38, 4, 231, 144, 38, 4, 231, 50, 38, 4, 74, 38, 4, 230, 138, 38, - 4, 232, 81, 38, 4, 243, 4, 38, 4, 242, 249, 38, 4, 218, 187, 38, 4, 218, - 181, 38, 4, 229, 37, 38, 4, 252, 88, 38, 4, 252, 41, 38, 4, 234, 31, 38, - 4, 236, 20, 38, 4, 233, 221, 38, 4, 244, 198, 38, 4, 244, 197, 38, 4, - 245, 139, 38, 4, 219, 72, 38, 4, 101, 38, 4, 221, 239, 38, 4, 249, 19, - 38, 4, 249, 23, 38, 4, 235, 12, 38, 4, 227, 75, 38, 4, 248, 167, 38, 4, - 232, 154, 38, 4, 224, 26, 38, 4, 224, 200, 38, 4, 217, 21, 38, 4, 217, - 65, 38, 4, 250, 182, 38, 4, 237, 59, 38, 4, 232, 5, 38, 4, 217, 231, 38, - 4, 236, 57, 38, 4, 232, 95, 38, 4, 244, 68, 38, 4, 233, 136, 38, 4, 231, - 204, 38, 4, 231, 56, 38, 4, 73, 38, 4, 246, 197, 38, 4, 232, 104, 38, 4, - 243, 162, 38, 4, 243, 138, 38, 4, 218, 227, 38, 4, 218, 220, 38, 4, 229, - 198, 38, 4, 252, 92, 38, 4, 252, 144, 38, 4, 234, 35, 38, 4, 236, 24, 38, - 4, 236, 22, 38, 4, 233, 224, 38, 4, 244, 202, 38, 4, 244, 200, 38, 4, - 245, 231, 38, 4, 219, 165, 38, 4, 222, 87, 38, 4, 222, 22, 38, 4, 249, - 29, 38, 4, 249, 26, 38, 4, 235, 122, 38, 4, 227, 216, 38, 4, 249, 92, 38, - 4, 232, 164, 38, 4, 226, 94, 38, 4, 224, 246, 38, 4, 217, 92, 38, 4, 217, - 72, 38, 4, 251, 99, 38, 4, 237, 114, 38, 4, 232, 15, 38, 4, 218, 25, 38, - 4, 236, 184, 38, 4, 232, 99, 38, 4, 232, 97, 38, 4, 244, 191, 38, 4, 244, - 181, 38, 4, 234, 25, 38, 4, 232, 141, 38, 4, 231, 73, 38, 4, 232, 117, - 38, 4, 235, 93, 38, 250, 168, 38, 245, 90, 223, 136, 38, 228, 82, 78, 38, - 4, 232, 153, 246, 8, 38, 4, 232, 153, 175, 38, 4, 232, 153, 224, 14, 38, - 16, 245, 223, 38, 16, 236, 182, 38, 16, 221, 174, 38, 16, 232, 38, 38, - 16, 252, 205, 38, 16, 246, 7, 38, 16, 222, 152, 38, 16, 249, 165, 38, 16, - 248, 149, 38, 16, 235, 253, 38, 16, 221, 125, 38, 16, 248, 166, 38, 16, - 237, 51, 38, 20, 217, 84, 38, 20, 107, 38, 20, 103, 38, 20, 160, 38, 20, - 154, 38, 20, 174, 38, 20, 182, 38, 20, 191, 38, 20, 185, 38, 20, 190, 38, - 4, 232, 153, 196, 38, 4, 232, 153, 248, 167, 31, 6, 1, 217, 88, 31, 3, 1, - 217, 88, 31, 6, 1, 247, 71, 31, 3, 1, 247, 71, 31, 6, 1, 210, 247, 73, - 31, 3, 1, 210, 247, 73, 31, 6, 1, 237, 162, 31, 3, 1, 237, 162, 31, 6, 1, - 248, 181, 31, 3, 1, 248, 181, 31, 6, 1, 233, 123, 220, 102, 31, 3, 1, - 233, 123, 220, 102, 31, 6, 1, 252, 2, 230, 143, 31, 3, 1, 252, 2, 230, - 143, 31, 6, 1, 232, 123, 218, 11, 31, 3, 1, 232, 123, 218, 11, 31, 6, 1, - 218, 8, 2, 252, 234, 218, 11, 31, 3, 1, 218, 8, 2, 252, 234, 218, 11, 31, - 6, 1, 237, 160, 218, 36, 31, 3, 1, 237, 160, 218, 36, 31, 6, 1, 210, 217, - 200, 31, 3, 1, 210, 217, 200, 31, 6, 1, 237, 160, 60, 31, 3, 1, 237, 160, - 60, 31, 6, 1, 250, 197, 235, 25, 217, 178, 31, 3, 1, 250, 197, 235, 25, - 217, 178, 31, 6, 1, 252, 46, 217, 178, 31, 3, 1, 252, 46, 217, 178, 31, - 6, 1, 237, 160, 250, 197, 235, 25, 217, 178, 31, 3, 1, 237, 160, 250, - 197, 235, 25, 217, 178, 31, 6, 1, 217, 233, 31, 3, 1, 217, 233, 31, 6, 1, - 224, 21, 249, 92, 31, 3, 1, 224, 21, 249, 92, 31, 6, 1, 224, 21, 246, - 217, 31, 3, 1, 224, 21, 246, 217, 31, 6, 1, 224, 21, 246, 205, 31, 3, 1, - 224, 21, 246, 205, 31, 6, 1, 233, 127, 74, 31, 3, 1, 233, 127, 74, 31, 6, - 1, 252, 70, 74, 31, 3, 1, 252, 70, 74, 31, 6, 1, 51, 233, 127, 74, 31, 3, - 1, 51, 233, 127, 74, 31, 1, 233, 86, 74, 36, 31, 219, 42, 36, 31, 222, - 66, 233, 162, 55, 36, 31, 242, 162, 233, 162, 55, 36, 31, 221, 232, 233, - 162, 55, 224, 53, 253, 251, 36, 31, 236, 194, 36, 31, 229, 203, 31, 236, - 194, 31, 229, 203, 31, 6, 1, 247, 82, 31, 3, 1, 247, 82, 31, 6, 1, 247, - 64, 31, 3, 1, 247, 64, 31, 6, 1, 217, 50, 31, 3, 1, 217, 50, 31, 6, 1, - 251, 108, 31, 3, 1, 251, 108, 31, 6, 1, 247, 63, 31, 3, 1, 247, 63, 31, - 6, 1, 222, 88, 2, 233, 193, 96, 31, 3, 1, 222, 88, 2, 233, 193, 96, 31, - 6, 1, 220, 223, 31, 3, 1, 220, 223, 31, 6, 1, 221, 33, 31, 3, 1, 221, 33, - 31, 6, 1, 221, 37, 31, 3, 1, 221, 37, 31, 6, 1, 222, 93, 31, 3, 1, 222, - 93, 31, 6, 1, 242, 151, 31, 3, 1, 242, 151, 31, 6, 1, 224, 155, 31, 3, 1, - 224, 155, 139, 1, 60, 139, 1, 175, 139, 1, 68, 139, 1, 236, 7, 139, 1, - 246, 250, 139, 1, 227, 200, 139, 1, 222, 142, 139, 1, 74, 139, 1, 231, - 67, 139, 1, 72, 139, 1, 235, 188, 139, 1, 187, 139, 1, 227, 98, 139, 1, - 227, 143, 139, 1, 235, 117, 139, 1, 234, 15, 139, 1, 222, 152, 139, 1, - 232, 168, 139, 1, 232, 17, 139, 1, 189, 139, 1, 223, 43, 139, 1, 233, 99, - 139, 1, 224, 216, 139, 1, 224, 140, 139, 1, 224, 225, 139, 1, 225, 44, - 139, 1, 235, 208, 139, 1, 236, 159, 139, 1, 231, 116, 139, 1, 231, 144, - 139, 1, 231, 255, 139, 1, 217, 214, 139, 1, 224, 170, 139, 1, 217, 182, - 139, 1, 184, 139, 1, 231, 147, 139, 1, 236, 157, 139, 1, 229, 145, 139, - 1, 232, 14, 139, 1, 231, 146, 139, 1, 228, 199, 139, 1, 218, 164, 139, 1, - 229, 191, 139, 1, 245, 226, 139, 1, 227, 22, 139, 1, 234, 231, 139, 1, - 233, 196, 139, 1, 232, 62, 139, 1, 227, 161, 139, 1, 227, 249, 139, 1, - 236, 168, 139, 1, 232, 86, 139, 1, 232, 100, 139, 1, 232, 115, 139, 1, - 224, 200, 139, 1, 228, 200, 139, 1, 245, 92, 139, 1, 245, 136, 139, 1, - 219, 7, 139, 1, 208, 139, 1, 235, 67, 139, 1, 229, 108, 139, 1, 234, 244, - 139, 1, 236, 57, 139, 1, 234, 33, 139, 1, 227, 187, 139, 1, 233, 251, - 139, 1, 196, 139, 1, 221, 205, 139, 1, 236, 113, 139, 1, 233, 136, 139, - 1, 234, 36, 139, 1, 222, 50, 139, 1, 236, 26, 139, 1, 222, 65, 139, 1, - 231, 145, 139, 1, 226, 147, 139, 1, 246, 4, 139, 1, 236, 28, 139, 1, 236, - 54, 139, 36, 164, 236, 36, 139, 36, 164, 220, 250, 139, 232, 16, 139, - 245, 90, 223, 136, 139, 250, 175, 139, 250, 168, 139, 225, 67, 139, 228, - 82, 78, 58, 1, 251, 21, 145, 217, 241, 229, 72, 58, 1, 251, 21, 145, 218, - 46, 229, 72, 58, 1, 251, 21, 145, 217, 241, 225, 8, 58, 1, 251, 21, 145, - 218, 46, 225, 8, 58, 1, 251, 21, 145, 217, 241, 228, 98, 58, 1, 251, 21, - 145, 218, 46, 228, 98, 58, 1, 251, 21, 145, 217, 241, 227, 22, 58, 1, - 251, 21, 145, 218, 46, 227, 22, 58, 1, 246, 85, 247, 143, 145, 135, 58, - 1, 116, 247, 143, 145, 135, 58, 1, 233, 194, 247, 143, 145, 135, 58, 1, - 109, 247, 143, 145, 135, 58, 1, 246, 84, 247, 143, 145, 135, 58, 1, 246, - 85, 247, 143, 235, 109, 145, 135, 58, 1, 116, 247, 143, 235, 109, 145, - 135, 58, 1, 233, 194, 247, 143, 235, 109, 145, 135, 58, 1, 109, 247, 143, - 235, 109, 145, 135, 58, 1, 246, 84, 247, 143, 235, 109, 145, 135, 58, 1, - 246, 85, 235, 109, 145, 135, 58, 1, 116, 235, 109, 145, 135, 58, 1, 233, - 194, 235, 109, 145, 135, 58, 1, 109, 235, 109, 145, 135, 58, 1, 246, 84, - 235, 109, 145, 135, 58, 1, 61, 69, 135, 58, 1, 61, 224, 55, 58, 1, 61, - 186, 135, 58, 1, 234, 237, 45, 250, 124, 254, 119, 58, 1, 227, 241, 108, - 65, 58, 1, 227, 241, 113, 65, 58, 1, 227, 241, 246, 95, 78, 58, 1, 227, - 241, 237, 170, 246, 95, 78, 58, 1, 109, 237, 170, 246, 95, 78, 58, 1, - 223, 125, 25, 116, 221, 132, 58, 1, 223, 125, 25, 109, 221, 132, 7, 6, 1, - 246, 241, 254, 168, 7, 3, 1, 246, 241, 254, 168, 7, 6, 1, 246, 241, 254, - 191, 7, 3, 1, 246, 241, 254, 191, 7, 6, 1, 243, 136, 7, 3, 1, 243, 136, - 7, 6, 1, 220, 189, 7, 3, 1, 220, 189, 7, 6, 1, 221, 94, 7, 3, 1, 221, 94, - 7, 6, 1, 250, 90, 7, 3, 1, 250, 90, 7, 6, 1, 250, 91, 2, 250, 168, 7, 3, - 1, 250, 91, 2, 250, 168, 7, 1, 3, 6, 246, 74, 7, 1, 3, 6, 198, 7, 6, 1, - 255, 58, 7, 3, 1, 255, 58, 7, 6, 1, 254, 93, 7, 3, 1, 254, 93, 7, 6, 1, - 253, 232, 7, 3, 1, 253, 232, 7, 6, 1, 253, 220, 7, 3, 1, 253, 220, 7, 6, - 1, 253, 221, 2, 186, 135, 7, 3, 1, 253, 221, 2, 186, 135, 7, 6, 1, 253, - 212, 7, 3, 1, 253, 212, 7, 6, 1, 210, 251, 203, 2, 248, 145, 7, 3, 1, - 210, 251, 203, 2, 248, 145, 7, 6, 1, 237, 18, 2, 92, 7, 3, 1, 237, 18, 2, - 92, 7, 6, 1, 237, 18, 2, 249, 11, 92, 7, 3, 1, 237, 18, 2, 249, 11, 92, - 7, 6, 1, 237, 18, 2, 214, 25, 249, 11, 92, 7, 3, 1, 237, 18, 2, 214, 25, - 249, 11, 92, 7, 6, 1, 252, 1, 153, 7, 3, 1, 252, 1, 153, 7, 6, 1, 235, - 202, 2, 116, 92, 7, 3, 1, 235, 202, 2, 116, 92, 7, 6, 1, 142, 2, 171, - 214, 230, 74, 7, 3, 1, 142, 2, 171, 214, 230, 74, 7, 6, 1, 142, 2, 234, - 247, 7, 3, 1, 142, 2, 234, 247, 7, 6, 1, 230, 127, 7, 3, 1, 230, 127, 7, - 6, 1, 230, 60, 2, 214, 221, 225, 249, 48, 7, 3, 1, 230, 60, 2, 214, 221, - 225, 249, 48, 7, 6, 1, 230, 60, 2, 245, 146, 7, 3, 1, 230, 60, 2, 245, - 146, 7, 6, 1, 230, 60, 2, 223, 222, 222, 135, 7, 3, 1, 230, 60, 2, 223, - 222, 222, 135, 7, 6, 1, 228, 164, 2, 214, 221, 225, 249, 48, 7, 3, 1, - 228, 164, 2, 214, 221, 225, 249, 48, 7, 6, 1, 228, 164, 2, 249, 11, 92, - 7, 3, 1, 228, 164, 2, 249, 11, 92, 7, 6, 1, 228, 39, 227, 58, 7, 3, 1, - 228, 39, 227, 58, 7, 6, 1, 227, 14, 227, 58, 7, 3, 1, 227, 14, 227, 58, - 7, 6, 1, 220, 11, 2, 249, 11, 92, 7, 3, 1, 220, 11, 2, 249, 11, 92, 7, 6, - 1, 219, 48, 7, 3, 1, 219, 48, 7, 6, 1, 219, 75, 217, 157, 7, 3, 1, 219, - 75, 217, 157, 7, 6, 1, 221, 235, 2, 92, 7, 3, 1, 221, 235, 2, 92, 7, 6, - 1, 221, 235, 2, 214, 221, 225, 249, 48, 7, 3, 1, 221, 235, 2, 214, 221, - 225, 249, 48, 7, 6, 1, 219, 157, 7, 3, 1, 219, 157, 7, 6, 1, 246, 123, 7, - 3, 1, 246, 123, 7, 6, 1, 237, 151, 7, 3, 1, 237, 151, 7, 6, 1, 250, 158, - 7, 3, 1, 250, 158, 58, 1, 220, 34, 7, 3, 1, 247, 102, 7, 3, 1, 234, 219, - 7, 3, 1, 233, 80, 7, 3, 1, 231, 109, 7, 3, 1, 227, 13, 7, 1, 3, 6, 227, - 13, 7, 3, 1, 220, 249, 7, 3, 1, 220, 94, 7, 6, 1, 237, 188, 250, 46, 7, - 3, 1, 237, 188, 250, 46, 7, 6, 1, 237, 188, 246, 74, 7, 3, 1, 237, 188, - 246, 74, 7, 6, 1, 237, 188, 245, 67, 7, 6, 1, 215, 237, 188, 245, 67, 7, - 3, 1, 215, 237, 188, 245, 67, 7, 6, 1, 215, 153, 7, 3, 1, 215, 153, 7, 6, - 1, 237, 188, 152, 7, 3, 1, 237, 188, 152, 7, 6, 1, 237, 188, 198, 7, 3, - 1, 237, 188, 198, 7, 6, 1, 237, 188, 222, 201, 7, 3, 1, 237, 188, 222, - 201, 58, 1, 109, 250, 217, 255, 0, 58, 1, 250, 175, 58, 1, 224, 192, 246, - 154, 55, 7, 6, 1, 226, 150, 7, 3, 1, 226, 150, 7, 246, 158, 1, 210, 246, - 74, 7, 246, 158, 1, 210, 230, 59, 7, 246, 158, 1, 237, 170, 189, 7, 246, - 158, 1, 242, 107, 234, 250, 7, 246, 158, 1, 254, 49, 189, 223, 19, 232, - 225, 1, 60, 223, 19, 232, 225, 1, 72, 223, 19, 232, 225, 5, 247, 84, 223, - 19, 232, 225, 1, 68, 223, 19, 232, 225, 1, 73, 223, 19, 232, 225, 1, 74, - 223, 19, 232, 225, 5, 243, 175, 223, 19, 232, 225, 1, 236, 57, 223, 19, - 232, 225, 1, 236, 125, 223, 19, 232, 225, 1, 244, 68, 223, 19, 232, 225, - 1, 244, 112, 223, 19, 232, 225, 5, 254, 95, 223, 19, 232, 225, 1, 250, - 182, 223, 19, 232, 225, 1, 251, 11, 223, 19, 232, 225, 1, 237, 59, 223, - 19, 232, 225, 1, 237, 99, 223, 19, 232, 225, 1, 221, 11, 223, 19, 232, - 225, 1, 221, 15, 223, 19, 232, 225, 1, 249, 107, 223, 19, 232, 225, 1, - 249, 115, 223, 19, 232, 225, 1, 101, 223, 19, 232, 225, 1, 221, 239, 223, - 19, 232, 225, 1, 248, 167, 223, 19, 232, 225, 1, 249, 19, 223, 19, 232, - 225, 1, 231, 204, 223, 19, 232, 225, 1, 229, 37, 223, 19, 232, 225, 1, - 229, 118, 223, 19, 232, 225, 1, 252, 41, 223, 19, 232, 225, 1, 252, 88, - 223, 19, 232, 225, 1, 233, 136, 223, 19, 232, 225, 1, 227, 75, 223, 19, - 232, 225, 1, 235, 12, 223, 19, 232, 225, 1, 227, 44, 223, 19, 232, 225, - 1, 224, 26, 223, 19, 232, 225, 1, 243, 4, 223, 19, 232, 225, 29, 5, 60, - 223, 19, 232, 225, 29, 5, 72, 223, 19, 232, 225, 29, 5, 68, 223, 19, 232, - 225, 29, 5, 73, 223, 19, 232, 225, 29, 5, 230, 127, 223, 19, 232, 225, - 229, 33, 234, 67, 223, 19, 232, 225, 229, 33, 234, 66, 223, 19, 232, 225, - 229, 33, 234, 65, 223, 19, 232, 225, 229, 33, 234, 64, 231, 187, 237, - 212, 245, 108, 131, 228, 89, 231, 187, 237, 212, 245, 108, 131, 243, 194, - 231, 187, 237, 212, 245, 108, 148, 228, 87, 231, 187, 237, 212, 245, 108, - 131, 224, 75, 231, 187, 237, 212, 245, 108, 131, 246, 231, 231, 187, 237, - 212, 245, 108, 148, 224, 74, 231, 187, 237, 212, 228, 90, 78, 231, 187, - 237, 212, 229, 56, 78, 231, 187, 237, 212, 227, 4, 78, 231, 187, 237, - 212, 228, 91, 78, 229, 138, 1, 175, 229, 138, 1, 236, 149, 229, 138, 1, - 245, 0, 229, 138, 1, 232, 115, 229, 138, 1, 251, 169, 229, 138, 1, 251, - 69, 229, 138, 1, 237, 123, 229, 138, 1, 231, 77, 229, 138, 1, 222, 155, - 229, 138, 1, 222, 35, 229, 138, 1, 249, 207, 229, 138, 1, 208, 229, 138, - 1, 187, 229, 138, 1, 229, 141, 229, 138, 1, 252, 237, 229, 138, 1, 196, - 229, 138, 1, 221, 55, 229, 138, 1, 221, 47, 229, 138, 1, 247, 74, 229, - 138, 1, 219, 7, 229, 138, 1, 217, 80, 229, 138, 1, 217, 114, 229, 138, 1, - 3, 60, 229, 138, 1, 184, 229, 138, 1, 203, 229, 138, 1, 235, 188, 229, - 138, 1, 225, 25, 229, 138, 1, 226, 177, 229, 138, 1, 155, 229, 138, 1, - 60, 229, 138, 1, 72, 229, 138, 1, 68, 229, 138, 1, 73, 229, 138, 1, 74, - 229, 138, 1, 228, 155, 229, 138, 1, 218, 138, 229, 138, 1, 246, 8, 229, - 138, 1, 244, 160, 229, 138, 1, 246, 250, 229, 138, 223, 97, 1, 219, 7, - 229, 138, 223, 97, 1, 184, 229, 138, 1, 221, 29, 229, 138, 1, 221, 19, - 229, 138, 1, 249, 132, 229, 138, 1, 231, 217, 229, 138, 1, 254, 144, 184, - 229, 138, 1, 219, 69, 225, 25, 229, 138, 1, 219, 70, 155, 229, 138, 1, - 254, 1, 246, 8, 229, 138, 223, 97, 1, 203, 229, 138, 223, 61, 1, 203, - 229, 138, 1, 251, 146, 229, 138, 224, 109, 243, 160, 78, 229, 138, 51, - 243, 160, 78, 229, 138, 164, 225, 18, 229, 138, 164, 51, 225, 18, 158, 5, - 254, 95, 158, 5, 219, 77, 158, 1, 60, 158, 1, 255, 58, 158, 1, 72, 158, - 1, 237, 255, 158, 1, 68, 158, 1, 220, 23, 158, 1, 167, 152, 158, 1, 167, - 227, 53, 158, 1, 167, 153, 158, 1, 167, 235, 18, 158, 1, 73, 158, 1, 246, - 250, 158, 1, 254, 196, 158, 1, 74, 158, 1, 230, 127, 158, 1, 253, 232, - 158, 1, 175, 158, 1, 236, 149, 158, 1, 245, 0, 158, 1, 244, 125, 158, 1, - 232, 115, 158, 1, 251, 169, 158, 1, 251, 69, 158, 1, 237, 123, 158, 1, - 237, 103, 158, 1, 231, 77, 158, 1, 221, 29, 158, 1, 221, 19, 158, 1, 249, - 132, 158, 1, 249, 116, 158, 1, 231, 217, 158, 1, 222, 155, 158, 1, 222, - 35, 158, 1, 249, 207, 158, 1, 249, 36, 158, 1, 208, 158, 1, 187, 158, 1, - 229, 141, 158, 1, 252, 237, 158, 1, 252, 94, 158, 1, 196, 158, 1, 184, - 158, 1, 203, 158, 1, 235, 188, 158, 1, 219, 189, 158, 1, 225, 25, 158, 1, - 223, 218, 158, 1, 226, 177, 158, 1, 155, 158, 1, 235, 17, 158, 250, 147, - 5, 243, 209, 158, 29, 5, 255, 58, 158, 29, 5, 72, 158, 29, 5, 237, 255, - 158, 29, 5, 68, 158, 29, 5, 220, 23, 158, 29, 5, 167, 152, 158, 29, 5, - 167, 227, 53, 158, 29, 5, 167, 153, 158, 29, 5, 167, 235, 18, 158, 29, 5, - 73, 158, 29, 5, 246, 250, 158, 29, 5, 254, 196, 158, 29, 5, 74, 158, 29, - 5, 230, 127, 158, 29, 5, 253, 232, 158, 5, 219, 82, 158, 249, 167, 158, - 51, 249, 167, 158, 20, 217, 84, 158, 20, 107, 158, 20, 103, 158, 20, 160, - 158, 20, 154, 158, 20, 174, 158, 20, 182, 158, 20, 191, 158, 20, 185, - 158, 20, 190, 36, 80, 20, 217, 84, 36, 80, 20, 107, 36, 80, 20, 103, 36, - 80, 20, 160, 36, 80, 20, 154, 36, 80, 20, 174, 36, 80, 20, 182, 36, 80, - 20, 191, 36, 80, 20, 185, 36, 80, 20, 190, 36, 80, 1, 60, 36, 80, 1, 68, - 36, 80, 1, 175, 36, 80, 1, 208, 36, 80, 1, 187, 36, 80, 1, 203, 36, 80, - 1, 219, 94, 36, 80, 5, 253, 219, 80, 5, 223, 253, 251, 146, 80, 5, 251, - 147, 219, 82, 80, 5, 51, 251, 147, 219, 82, 80, 5, 251, 147, 103, 80, 5, - 251, 147, 160, 80, 5, 251, 147, 253, 219, 80, 5, 228, 186, 80, 244, 224, - 245, 185, 80, 251, 134, 80, 243, 155, 236, 190, 235, 68, 20, 217, 84, - 236, 190, 235, 68, 20, 107, 236, 190, 235, 68, 20, 103, 236, 190, 235, - 68, 20, 160, 236, 190, 235, 68, 20, 154, 236, 190, 235, 68, 20, 174, 236, - 190, 235, 68, 20, 182, 236, 190, 235, 68, 20, 191, 236, 190, 235, 68, 20, - 185, 236, 190, 235, 68, 20, 190, 236, 190, 235, 68, 1, 175, 236, 190, - 235, 68, 1, 236, 149, 236, 190, 235, 68, 1, 245, 0, 236, 190, 235, 68, 1, - 232, 115, 236, 190, 235, 68, 1, 226, 177, 236, 190, 235, 68, 1, 225, 25, - 236, 190, 235, 68, 1, 217, 114, 236, 190, 235, 68, 1, 231, 77, 236, 190, - 235, 68, 1, 222, 155, 236, 190, 235, 68, 1, 242, 175, 236, 190, 235, 68, - 1, 208, 236, 190, 235, 68, 1, 187, 236, 190, 235, 68, 1, 229, 141, 236, - 190, 235, 68, 1, 196, 236, 190, 235, 68, 1, 249, 207, 236, 190, 235, 68, - 1, 252, 237, 236, 190, 235, 68, 1, 203, 236, 190, 235, 68, 1, 184, 236, - 190, 235, 68, 1, 235, 188, 236, 190, 235, 68, 1, 219, 7, 236, 190, 235, - 68, 1, 222, 35, 236, 190, 235, 68, 1, 155, 236, 190, 235, 68, 1, 219, - 189, 236, 190, 235, 68, 1, 251, 169, 236, 190, 235, 68, 1, 60, 236, 190, - 235, 68, 1, 230, 167, 236, 190, 235, 68, 1, 72, 236, 190, 235, 68, 1, - 230, 127, 236, 190, 235, 68, 29, 220, 110, 236, 190, 235, 68, 29, 73, - 236, 190, 235, 68, 29, 68, 236, 190, 235, 68, 29, 246, 250, 236, 190, - 235, 68, 29, 74, 236, 190, 235, 68, 145, 229, 48, 236, 190, 235, 68, 145, - 251, 157, 236, 190, 235, 68, 145, 251, 158, 229, 48, 236, 190, 235, 68, - 5, 250, 62, 236, 190, 235, 68, 5, 224, 148, 227, 194, 1, 175, 227, 194, - 1, 245, 0, 227, 194, 1, 232, 115, 227, 194, 1, 222, 155, 227, 194, 1, - 249, 207, 227, 194, 1, 208, 227, 194, 1, 187, 227, 194, 1, 252, 237, 227, - 194, 1, 196, 227, 194, 1, 251, 169, 227, 194, 1, 237, 123, 227, 194, 1, - 231, 77, 227, 194, 1, 226, 177, 227, 194, 1, 203, 227, 194, 1, 235, 188, - 227, 194, 1, 184, 227, 194, 1, 219, 7, 227, 194, 1, 155, 227, 194, 1, - 234, 37, 227, 194, 1, 232, 100, 227, 194, 1, 232, 169, 227, 194, 1, 231, - 57, 227, 194, 1, 60, 227, 194, 29, 5, 72, 227, 194, 29, 5, 68, 227, 194, - 29, 5, 73, 227, 194, 29, 5, 254, 196, 227, 194, 29, 5, 74, 227, 194, 29, - 5, 253, 232, 227, 194, 29, 5, 246, 115, 227, 194, 29, 5, 247, 16, 227, - 194, 250, 147, 5, 232, 117, 227, 194, 250, 147, 5, 207, 227, 194, 250, - 147, 5, 152, 227, 194, 250, 147, 5, 243, 225, 227, 194, 219, 82, 227, - 194, 226, 87, 78, 22, 91, 221, 188, 22, 91, 221, 187, 22, 91, 221, 185, - 22, 91, 221, 190, 22, 91, 227, 135, 22, 91, 227, 119, 22, 91, 227, 114, - 22, 91, 227, 116, 22, 91, 227, 132, 22, 91, 227, 125, 22, 91, 227, 118, - 22, 91, 227, 137, 22, 91, 227, 120, 22, 91, 227, 139, 22, 91, 227, 136, - 22, 91, 233, 183, 22, 91, 233, 174, 22, 91, 233, 177, 22, 91, 229, 84, - 22, 91, 229, 95, 22, 91, 229, 96, 22, 91, 223, 203, 22, 91, 238, 12, 22, - 91, 238, 19, 22, 91, 223, 214, 22, 91, 223, 201, 22, 91, 229, 126, 22, - 91, 243, 101, 22, 91, 223, 198, 133, 5, 229, 252, 133, 5, 251, 96, 133, - 5, 235, 130, 133, 5, 218, 197, 133, 1, 60, 133, 1, 242, 107, 236, 193, - 133, 1, 72, 133, 1, 237, 255, 133, 1, 68, 133, 1, 230, 44, 251, 73, 133, - 1, 232, 116, 235, 98, 133, 1, 232, 116, 235, 99, 227, 229, 133, 1, 73, - 133, 1, 254, 196, 133, 1, 74, 133, 1, 175, 133, 1, 206, 226, 128, 133, 1, - 206, 233, 67, 133, 1, 245, 0, 133, 1, 245, 1, 233, 67, 133, 1, 232, 115, - 133, 1, 251, 169, 133, 1, 251, 170, 233, 67, 133, 1, 237, 123, 133, 1, - 231, 78, 233, 67, 133, 1, 237, 124, 234, 103, 133, 1, 231, 77, 133, 1, - 221, 29, 133, 1, 221, 30, 234, 103, 133, 1, 249, 132, 133, 1, 249, 133, - 234, 103, 133, 1, 232, 238, 233, 67, 133, 1, 222, 155, 133, 1, 222, 156, - 233, 67, 133, 1, 249, 207, 133, 1, 249, 208, 234, 103, 133, 1, 208, 133, - 1, 187, 133, 1, 230, 44, 233, 67, 133, 1, 252, 237, 133, 1, 252, 238, - 233, 67, 133, 1, 196, 133, 1, 184, 133, 1, 203, 133, 1, 228, 3, 254, 203, - 133, 1, 235, 188, 133, 1, 219, 7, 133, 1, 226, 178, 233, 67, 133, 1, 226, - 178, 234, 103, 133, 1, 226, 177, 133, 1, 155, 133, 5, 251, 97, 222, 68, - 133, 29, 5, 222, 111, 133, 29, 5, 221, 135, 133, 29, 5, 218, 162, 133, - 29, 5, 218, 163, 234, 5, 133, 29, 5, 223, 77, 133, 29, 5, 223, 78, 233, - 250, 133, 29, 5, 222, 124, 133, 29, 5, 248, 207, 233, 66, 133, 29, 5, - 229, 171, 133, 250, 147, 5, 236, 161, 133, 250, 147, 5, 229, 179, 133, - 250, 147, 5, 251, 162, 133, 230, 6, 133, 42, 227, 176, 133, 45, 227, 176, - 133, 230, 36, 254, 125, 133, 230, 36, 234, 107, 133, 230, 36, 234, 223, - 133, 230, 36, 218, 193, 133, 230, 36, 230, 7, 133, 230, 36, 235, 35, 133, - 230, 36, 234, 217, 133, 230, 36, 254, 239, 133, 230, 36, 254, 240, 254, - 239, 133, 230, 36, 229, 65, 133, 215, 230, 36, 229, 65, 133, 230, 4, 133, - 20, 217, 84, 133, 20, 107, 133, 20, 103, 133, 20, 160, 133, 20, 154, 133, - 20, 174, 133, 20, 182, 133, 20, 191, 133, 20, 185, 133, 20, 190, 133, - 230, 36, 221, 163, 220, 248, 133, 230, 36, 237, 147, 149, 1, 60, 149, 1, - 72, 149, 1, 68, 149, 1, 73, 149, 1, 254, 196, 149, 1, 74, 149, 1, 175, - 149, 1, 236, 149, 149, 1, 245, 0, 149, 1, 244, 125, 149, 1, 232, 73, 149, - 1, 232, 115, 149, 1, 251, 69, 149, 1, 251, 33, 149, 1, 237, 123, 149, 1, - 237, 103, 149, 1, 232, 64, 149, 1, 232, 66, 149, 1, 232, 65, 149, 1, 222, - 155, 149, 1, 222, 35, 149, 1, 249, 207, 149, 1, 249, 36, 149, 1, 231, - 114, 149, 1, 208, 149, 1, 249, 132, 149, 1, 187, 149, 1, 229, 6, 149, 1, - 229, 141, 149, 1, 252, 237, 149, 1, 252, 94, 149, 1, 233, 94, 149, 1, - 196, 149, 1, 252, 178, 149, 1, 184, 149, 1, 203, 149, 1, 235, 188, 149, - 1, 219, 189, 149, 1, 223, 218, 149, 1, 226, 177, 149, 1, 155, 149, 29, 5, - 255, 58, 149, 29, 5, 72, 149, 29, 5, 237, 255, 149, 29, 5, 246, 237, 149, - 29, 5, 68, 149, 29, 5, 230, 167, 149, 29, 5, 74, 149, 29, 5, 254, 196, - 149, 29, 5, 253, 232, 149, 29, 5, 220, 110, 149, 250, 147, 5, 184, 149, - 250, 147, 5, 203, 149, 250, 147, 5, 235, 188, 149, 250, 147, 5, 219, 7, - 149, 1, 39, 237, 17, 149, 1, 39, 245, 67, 149, 1, 39, 232, 117, 149, 250, - 147, 5, 39, 232, 117, 149, 1, 39, 251, 70, 149, 1, 39, 222, 201, 149, 1, - 39, 207, 149, 1, 39, 230, 59, 149, 1, 39, 218, 90, 149, 1, 39, 152, 149, - 1, 39, 153, 149, 1, 39, 223, 219, 149, 250, 147, 5, 39, 189, 149, 250, - 147, 5, 39, 243, 225, 149, 20, 217, 84, 149, 20, 107, 149, 20, 103, 149, - 20, 160, 149, 20, 154, 149, 20, 174, 149, 20, 182, 149, 20, 191, 149, 20, - 185, 149, 20, 190, 149, 228, 197, 223, 242, 149, 228, 197, 249, 167, 149, - 228, 197, 51, 249, 167, 149, 228, 197, 221, 78, 249, 167, 63, 1, 236, - 143, 245, 0, 63, 1, 236, 143, 251, 169, 63, 1, 236, 143, 251, 69, 63, 1, - 236, 143, 237, 123, 63, 1, 236, 143, 237, 103, 63, 1, 236, 143, 231, 77, - 63, 1, 236, 143, 221, 29, 63, 1, 236, 143, 221, 19, 63, 1, 236, 143, 249, - 132, 63, 1, 236, 143, 249, 116, 63, 1, 236, 143, 249, 36, 63, 1, 236, - 143, 208, 63, 1, 236, 143, 226, 177, 63, 1, 236, 143, 155, 63, 1, 236, - 143, 243, 121, 63, 1, 236, 143, 246, 8, 63, 58, 1, 236, 143, 227, 201, - 63, 1, 236, 143, 218, 138, 63, 1, 236, 143, 217, 114, 63, 1, 236, 143, - 203, 63, 235, 6, 236, 143, 230, 182, 63, 235, 6, 236, 143, 228, 111, 63, - 235, 6, 236, 143, 243, 57, 63, 16, 254, 186, 246, 94, 63, 16, 254, 186, - 107, 63, 16, 254, 186, 103, 63, 1, 254, 186, 203, 63, 5, 229, 248, 236, - 213, 221, 132, 37, 177, 1, 109, 236, 57, 37, 177, 1, 116, 236, 57, 37, - 177, 1, 109, 236, 125, 37, 177, 1, 116, 236, 125, 37, 177, 1, 109, 236, - 132, 37, 177, 1, 116, 236, 132, 37, 177, 1, 109, 244, 68, 37, 177, 1, - 116, 244, 68, 37, 177, 1, 109, 232, 84, 37, 177, 1, 116, 232, 84, 37, - 177, 1, 109, 250, 182, 37, 177, 1, 116, 250, 182, 37, 177, 1, 109, 251, - 11, 37, 177, 1, 116, 251, 11, 37, 177, 1, 109, 224, 26, 37, 177, 1, 116, - 224, 26, 37, 177, 1, 109, 231, 56, 37, 177, 1, 116, 231, 56, 37, 177, 1, - 109, 248, 167, 37, 177, 1, 116, 248, 167, 37, 177, 1, 109, 101, 37, 177, - 1, 116, 101, 37, 177, 1, 109, 221, 239, 37, 177, 1, 116, 221, 239, 37, - 177, 1, 109, 231, 204, 37, 177, 1, 116, 231, 204, 37, 177, 1, 109, 252, - 41, 37, 177, 1, 116, 252, 41, 37, 177, 1, 109, 229, 37, 37, 177, 1, 116, - 229, 37, 37, 177, 1, 109, 229, 118, 37, 177, 1, 116, 229, 118, 37, 177, - 1, 109, 245, 139, 37, 177, 1, 116, 245, 139, 37, 177, 1, 109, 233, 136, - 37, 177, 1, 116, 233, 136, 37, 177, 1, 109, 217, 231, 37, 177, 1, 116, - 217, 231, 37, 177, 1, 109, 227, 75, 37, 177, 1, 116, 227, 75, 37, 177, 1, - 109, 235, 12, 37, 177, 1, 116, 235, 12, 37, 177, 1, 109, 219, 72, 37, - 177, 1, 116, 219, 72, 37, 177, 1, 109, 243, 4, 37, 177, 1, 116, 243, 4, - 37, 177, 1, 109, 74, 37, 177, 1, 116, 74, 37, 177, 234, 100, 236, 229, - 37, 177, 29, 255, 58, 37, 177, 29, 72, 37, 177, 29, 220, 110, 37, 177, - 29, 68, 37, 177, 29, 73, 37, 177, 29, 74, 37, 177, 234, 100, 236, 127, - 37, 177, 29, 242, 72, 37, 177, 29, 220, 109, 37, 177, 29, 220, 123, 37, - 177, 29, 253, 231, 37, 177, 29, 253, 212, 37, 177, 29, 254, 131, 37, 177, - 29, 254, 140, 37, 177, 145, 234, 100, 246, 223, 37, 177, 145, 234, 100, - 231, 113, 37, 177, 145, 234, 100, 221, 239, 37, 177, 145, 234, 100, 224, - 15, 37, 177, 16, 236, 44, 37, 177, 16, 231, 113, 37, 177, 16, 226, 148, - 37, 177, 16, 243, 5, 243, 1, 37, 177, 16, 236, 52, 236, 51, 234, 11, 234, - 43, 1, 236, 49, 234, 11, 234, 43, 1, 226, 148, 234, 11, 234, 43, 1, 235, - 167, 234, 11, 234, 43, 1, 233, 145, 234, 11, 234, 43, 1, 187, 234, 11, - 234, 43, 1, 208, 234, 11, 234, 43, 1, 251, 25, 234, 11, 234, 43, 1, 221, - 181, 234, 11, 234, 43, 1, 236, 121, 234, 11, 234, 43, 1, 232, 76, 234, - 11, 234, 43, 1, 221, 233, 234, 11, 234, 43, 1, 219, 2, 234, 11, 234, 43, - 1, 218, 45, 234, 11, 234, 43, 1, 242, 167, 234, 11, 234, 43, 1, 220, 87, - 234, 11, 234, 43, 1, 72, 234, 11, 234, 43, 1, 229, 136, 234, 11, 234, 43, - 1, 253, 241, 234, 11, 234, 43, 1, 244, 63, 234, 11, 234, 43, 1, 237, 102, - 234, 11, 234, 43, 1, 227, 246, 234, 11, 234, 43, 1, 252, 237, 234, 11, - 234, 43, 1, 237, 91, 234, 11, 234, 43, 1, 248, 232, 234, 11, 234, 43, 1, - 244, 110, 234, 11, 234, 43, 1, 249, 17, 234, 11, 234, 43, 1, 252, 93, - 234, 11, 234, 43, 1, 236, 50, 234, 249, 234, 11, 234, 43, 1, 235, 168, - 234, 249, 234, 11, 234, 43, 1, 233, 146, 234, 249, 234, 11, 234, 43, 1, - 230, 44, 234, 249, 234, 11, 234, 43, 1, 232, 238, 234, 249, 234, 11, 234, - 43, 1, 221, 182, 234, 249, 234, 11, 234, 43, 1, 232, 77, 234, 249, 234, - 11, 234, 43, 1, 242, 107, 234, 249, 234, 11, 234, 43, 29, 5, 230, 137, - 234, 11, 234, 43, 29, 5, 237, 221, 234, 11, 234, 43, 29, 5, 254, 130, - 234, 11, 234, 43, 29, 5, 218, 18, 234, 11, 234, 43, 29, 5, 224, 10, 234, - 11, 234, 43, 29, 5, 220, 85, 234, 11, 234, 43, 29, 5, 251, 40, 234, 11, - 234, 43, 29, 5, 231, 100, 234, 11, 234, 43, 251, 41, 234, 11, 234, 43, - 234, 220, 237, 131, 234, 11, 234, 43, 254, 70, 237, 131, 234, 11, 234, - 43, 20, 217, 84, 234, 11, 234, 43, 20, 107, 234, 11, 234, 43, 20, 103, - 234, 11, 234, 43, 20, 160, 234, 11, 234, 43, 20, 154, 234, 11, 234, 43, - 20, 174, 234, 11, 234, 43, 20, 182, 234, 11, 234, 43, 20, 191, 234, 11, - 234, 43, 20, 185, 234, 11, 234, 43, 20, 190, 22, 122, 231, 6, 22, 122, - 231, 11, 22, 122, 217, 230, 22, 122, 217, 229, 22, 122, 217, 228, 22, - 122, 220, 173, 22, 122, 220, 176, 22, 122, 217, 198, 22, 122, 217, 194, - 22, 122, 246, 114, 22, 122, 246, 112, 22, 122, 246, 113, 22, 122, 246, - 110, 22, 122, 242, 97, 22, 122, 242, 96, 22, 122, 242, 94, 22, 122, 242, - 95, 22, 122, 242, 100, 22, 122, 242, 93, 22, 122, 242, 92, 22, 122, 242, - 102, 22, 122, 254, 59, 22, 122, 254, 58, 22, 85, 232, 48, 22, 85, 232, - 54, 22, 85, 223, 200, 22, 85, 223, 199, 22, 85, 221, 187, 22, 85, 221, - 185, 22, 85, 221, 184, 22, 85, 221, 190, 22, 85, 221, 191, 22, 85, 221, - 183, 22, 85, 227, 119, 22, 85, 227, 134, 22, 85, 223, 206, 22, 85, 227, - 131, 22, 85, 227, 121, 22, 85, 227, 123, 22, 85, 227, 110, 22, 85, 227, - 111, 22, 85, 236, 217, 22, 85, 233, 182, 22, 85, 233, 176, 22, 85, 223, - 210, 22, 85, 233, 179, 22, 85, 233, 185, 22, 85, 229, 80, 22, 85, 229, - 89, 22, 85, 229, 93, 22, 85, 223, 208, 22, 85, 229, 83, 22, 85, 229, 97, - 22, 85, 229, 98, 22, 85, 224, 96, 22, 85, 224, 99, 22, 85, 223, 204, 22, - 85, 223, 202, 22, 85, 224, 94, 22, 85, 224, 102, 22, 85, 224, 103, 22, - 85, 224, 88, 22, 85, 224, 101, 22, 85, 229, 255, 22, 85, 230, 0, 22, 85, - 218, 4, 22, 85, 218, 5, 22, 85, 250, 228, 22, 85, 250, 227, 22, 85, 223, - 215, 22, 85, 229, 124, 22, 85, 229, 123, 9, 13, 239, 244, 9, 13, 239, - 243, 9, 13, 239, 242, 9, 13, 239, 241, 9, 13, 239, 240, 9, 13, 239, 239, - 9, 13, 239, 238, 9, 13, 239, 237, 9, 13, 239, 236, 9, 13, 239, 235, 9, - 13, 239, 234, 9, 13, 239, 233, 9, 13, 239, 232, 9, 13, 239, 231, 9, 13, - 239, 230, 9, 13, 239, 229, 9, 13, 239, 228, 9, 13, 239, 227, 9, 13, 239, - 226, 9, 13, 239, 225, 9, 13, 239, 224, 9, 13, 239, 223, 9, 13, 239, 222, - 9, 13, 239, 221, 9, 13, 239, 220, 9, 13, 239, 219, 9, 13, 239, 218, 9, - 13, 239, 217, 9, 13, 239, 216, 9, 13, 239, 215, 9, 13, 239, 214, 9, 13, - 239, 213, 9, 13, 239, 212, 9, 13, 239, 211, 9, 13, 239, 210, 9, 13, 239, - 209, 9, 13, 239, 208, 9, 13, 239, 207, 9, 13, 239, 206, 9, 13, 239, 205, - 9, 13, 239, 204, 9, 13, 239, 203, 9, 13, 239, 202, 9, 13, 239, 201, 9, - 13, 239, 200, 9, 13, 239, 199, 9, 13, 239, 198, 9, 13, 239, 197, 9, 13, - 239, 196, 9, 13, 239, 195, 9, 13, 239, 194, 9, 13, 239, 193, 9, 13, 239, - 192, 9, 13, 239, 191, 9, 13, 239, 190, 9, 13, 239, 189, 9, 13, 239, 188, - 9, 13, 239, 187, 9, 13, 239, 186, 9, 13, 239, 185, 9, 13, 239, 184, 9, - 13, 239, 183, 9, 13, 239, 182, 9, 13, 239, 181, 9, 13, 239, 180, 9, 13, - 239, 179, 9, 13, 239, 178, 9, 13, 239, 177, 9, 13, 239, 176, 9, 13, 239, - 175, 9, 13, 239, 174, 9, 13, 239, 173, 9, 13, 239, 172, 9, 13, 239, 171, - 9, 13, 239, 170, 9, 13, 239, 169, 9, 13, 239, 168, 9, 13, 239, 167, 9, - 13, 239, 166, 9, 13, 239, 165, 9, 13, 239, 164, 9, 13, 239, 163, 9, 13, - 239, 162, 9, 13, 239, 161, 9, 13, 239, 160, 9, 13, 239, 159, 9, 13, 239, - 158, 9, 13, 239, 157, 9, 13, 239, 156, 9, 13, 239, 155, 9, 13, 239, 154, - 9, 13, 239, 153, 9, 13, 239, 152, 9, 13, 239, 151, 9, 13, 239, 150, 9, - 13, 239, 149, 9, 13, 239, 148, 9, 13, 239, 147, 9, 13, 239, 146, 9, 13, - 239, 145, 9, 13, 239, 144, 9, 13, 239, 143, 9, 13, 239, 142, 9, 13, 239, - 141, 9, 13, 239, 140, 9, 13, 239, 139, 9, 13, 239, 138, 9, 13, 239, 137, - 9, 13, 239, 136, 9, 13, 239, 135, 9, 13, 239, 134, 9, 13, 239, 133, 9, - 13, 239, 132, 9, 13, 239, 131, 9, 13, 239, 130, 9, 13, 239, 129, 9, 13, - 239, 128, 9, 13, 239, 127, 9, 13, 239, 126, 9, 13, 239, 125, 9, 13, 239, - 124, 9, 13, 239, 123, 9, 13, 239, 122, 9, 13, 239, 121, 9, 13, 239, 120, - 9, 13, 239, 119, 9, 13, 239, 118, 9, 13, 239, 117, 9, 13, 239, 116, 9, - 13, 239, 115, 9, 13, 239, 114, 9, 13, 239, 113, 9, 13, 239, 112, 9, 13, - 239, 111, 9, 13, 239, 110, 9, 13, 239, 109, 9, 13, 239, 108, 9, 13, 239, - 107, 9, 13, 239, 106, 9, 13, 239, 105, 9, 13, 239, 104, 9, 13, 239, 103, - 9, 13, 239, 102, 9, 13, 239, 101, 9, 13, 239, 100, 9, 13, 239, 99, 9, 13, - 239, 98, 9, 13, 239, 97, 9, 13, 239, 96, 9, 13, 239, 95, 9, 13, 239, 94, - 9, 13, 239, 93, 9, 13, 239, 92, 9, 13, 239, 91, 9, 13, 239, 90, 9, 13, - 239, 89, 9, 13, 239, 88, 9, 13, 239, 87, 9, 13, 239, 86, 9, 13, 239, 85, - 9, 13, 239, 84, 9, 13, 239, 83, 9, 13, 239, 82, 9, 13, 239, 81, 9, 13, - 239, 80, 9, 13, 239, 79, 9, 13, 239, 78, 9, 13, 239, 77, 9, 13, 239, 76, - 9, 13, 239, 75, 9, 13, 239, 74, 9, 13, 239, 73, 9, 13, 239, 72, 9, 13, - 239, 71, 9, 13, 239, 70, 9, 13, 239, 69, 9, 13, 239, 68, 9, 13, 239, 67, - 9, 13, 239, 66, 9, 13, 239, 65, 9, 13, 239, 64, 9, 13, 239, 63, 9, 13, - 239, 62, 9, 13, 239, 61, 9, 13, 239, 60, 9, 13, 239, 59, 9, 13, 239, 58, - 9, 13, 239, 57, 9, 13, 239, 56, 9, 13, 239, 55, 9, 13, 239, 54, 9, 13, - 239, 53, 9, 13, 239, 52, 9, 13, 239, 51, 9, 13, 239, 50, 9, 13, 239, 49, - 9, 13, 239, 48, 9, 13, 239, 47, 9, 13, 239, 46, 9, 13, 239, 45, 9, 13, - 239, 44, 9, 13, 239, 43, 9, 13, 239, 42, 9, 13, 239, 41, 9, 13, 239, 40, - 9, 13, 239, 39, 9, 13, 239, 38, 9, 13, 239, 37, 9, 13, 239, 36, 9, 13, - 239, 35, 9, 13, 239, 34, 9, 13, 239, 33, 9, 13, 239, 32, 9, 13, 239, 31, - 9, 13, 239, 30, 9, 13, 239, 29, 9, 13, 239, 28, 9, 13, 239, 27, 9, 13, - 239, 26, 9, 13, 239, 25, 9, 13, 239, 24, 9, 13, 239, 23, 9, 13, 239, 22, - 9, 13, 239, 21, 9, 13, 239, 20, 9, 13, 239, 19, 9, 13, 239, 18, 9, 13, - 239, 17, 9, 13, 239, 16, 9, 13, 239, 15, 9, 13, 239, 14, 9, 13, 239, 13, - 9, 13, 239, 12, 9, 13, 239, 11, 9, 13, 239, 10, 9, 13, 239, 9, 9, 13, - 239, 8, 9, 13, 239, 7, 9, 13, 239, 6, 9, 13, 239, 5, 9, 13, 239, 4, 9, - 13, 239, 3, 9, 13, 239, 2, 9, 13, 239, 1, 9, 13, 239, 0, 9, 13, 238, 255, - 9, 13, 238, 254, 9, 13, 238, 253, 9, 13, 238, 252, 9, 13, 238, 251, 9, - 13, 238, 250, 9, 13, 238, 249, 9, 13, 238, 248, 9, 13, 238, 247, 9, 13, - 238, 246, 9, 13, 238, 245, 9, 13, 238, 244, 9, 13, 238, 243, 9, 13, 238, - 242, 9, 13, 238, 241, 9, 13, 238, 240, 9, 13, 238, 239, 9, 13, 238, 238, - 9, 13, 238, 237, 9, 13, 238, 236, 9, 13, 238, 235, 9, 13, 238, 234, 9, - 13, 238, 233, 9, 13, 238, 232, 9, 13, 238, 231, 9, 13, 238, 230, 9, 13, - 238, 229, 9, 13, 238, 228, 9, 13, 238, 227, 9, 13, 238, 226, 9, 13, 238, - 225, 9, 13, 238, 224, 9, 13, 238, 223, 9, 13, 238, 222, 9, 13, 238, 221, - 9, 13, 238, 220, 9, 13, 238, 219, 9, 13, 238, 218, 9, 13, 238, 217, 9, - 13, 238, 216, 9, 13, 238, 215, 9, 13, 238, 214, 9, 13, 238, 213, 9, 13, - 238, 212, 9, 13, 238, 211, 9, 13, 238, 210, 9, 13, 238, 209, 9, 13, 238, - 208, 9, 13, 238, 207, 9, 13, 238, 206, 9, 13, 238, 205, 9, 13, 238, 204, - 9, 13, 238, 203, 9, 13, 238, 202, 9, 13, 238, 201, 9, 13, 238, 200, 9, - 13, 238, 199, 9, 13, 238, 198, 9, 13, 238, 197, 9, 13, 238, 196, 9, 13, - 238, 195, 9, 13, 238, 194, 9, 13, 238, 193, 9, 13, 238, 192, 9, 13, 238, - 191, 9, 13, 238, 190, 9, 13, 238, 189, 9, 13, 238, 188, 9, 13, 238, 187, - 9, 13, 238, 186, 9, 13, 238, 185, 9, 13, 238, 184, 9, 13, 238, 183, 9, - 13, 238, 182, 9, 13, 238, 181, 9, 13, 238, 180, 9, 13, 238, 179, 9, 13, - 238, 178, 9, 13, 238, 177, 9, 13, 238, 176, 9, 13, 238, 175, 9, 13, 238, - 174, 9, 13, 238, 173, 9, 13, 238, 172, 9, 13, 238, 171, 9, 13, 238, 170, - 9, 13, 238, 169, 9, 13, 238, 168, 9, 13, 238, 167, 9, 13, 238, 166, 9, - 13, 238, 165, 9, 13, 238, 164, 9, 13, 238, 163, 9, 13, 238, 162, 9, 13, - 238, 161, 9, 13, 238, 160, 9, 13, 238, 159, 9, 13, 238, 158, 9, 13, 238, - 157, 9, 13, 238, 156, 9, 13, 238, 155, 9, 13, 238, 154, 9, 13, 238, 153, - 9, 13, 238, 152, 9, 13, 238, 151, 9, 13, 238, 150, 9, 13, 238, 149, 9, - 13, 238, 148, 9, 13, 238, 147, 9, 13, 238, 146, 9, 13, 238, 145, 9, 13, - 238, 144, 9, 13, 238, 143, 9, 13, 238, 142, 9, 13, 238, 141, 9, 13, 238, - 140, 9, 13, 238, 139, 9, 13, 238, 138, 9, 13, 238, 137, 9, 13, 238, 136, - 9, 13, 238, 135, 9, 13, 238, 134, 9, 13, 238, 133, 9, 13, 238, 132, 9, - 13, 238, 131, 9, 13, 238, 130, 9, 13, 238, 129, 9, 13, 238, 128, 9, 13, - 238, 127, 9, 13, 238, 126, 9, 13, 238, 125, 9, 13, 238, 124, 9, 13, 238, - 123, 9, 13, 238, 122, 9, 13, 238, 121, 9, 13, 238, 120, 9, 13, 238, 119, - 9, 13, 238, 118, 9, 13, 238, 117, 9, 13, 238, 116, 9, 13, 238, 115, 9, - 13, 238, 114, 9, 13, 238, 113, 9, 13, 238, 112, 9, 13, 238, 111, 9, 13, - 238, 110, 9, 13, 238, 109, 9, 13, 238, 108, 9, 13, 238, 107, 9, 13, 238, - 106, 9, 13, 238, 105, 9, 13, 238, 104, 9, 13, 238, 103, 9, 13, 238, 102, - 9, 13, 238, 101, 9, 13, 238, 100, 9, 13, 238, 99, 9, 13, 238, 98, 9, 13, - 238, 97, 9, 13, 238, 96, 9, 13, 238, 95, 9, 13, 238, 94, 9, 13, 238, 93, - 9, 13, 238, 92, 9, 13, 238, 91, 9, 13, 238, 90, 9, 13, 238, 89, 9, 13, - 238, 88, 9, 13, 238, 87, 9, 13, 238, 86, 9, 13, 238, 85, 9, 13, 238, 84, - 9, 13, 238, 83, 9, 13, 238, 82, 9, 13, 238, 81, 9, 13, 238, 80, 9, 13, - 238, 79, 9, 13, 238, 78, 9, 13, 238, 77, 9, 13, 238, 76, 9, 13, 238, 75, - 9, 13, 238, 74, 9, 13, 238, 73, 9, 13, 238, 72, 9, 13, 238, 71, 9, 13, - 238, 70, 9, 13, 238, 69, 9, 13, 238, 68, 9, 13, 238, 67, 9, 13, 238, 66, - 9, 13, 238, 65, 9, 13, 238, 64, 9, 13, 238, 63, 9, 13, 238, 62, 9, 13, - 238, 61, 9, 13, 238, 60, 9, 13, 238, 59, 9, 13, 238, 58, 9, 13, 238, 57, - 9, 13, 238, 56, 9, 13, 238, 55, 9, 13, 238, 54, 9, 13, 238, 53, 9, 13, - 238, 52, 9, 13, 238, 51, 9, 13, 238, 50, 9, 13, 238, 49, 9, 13, 238, 48, - 9, 13, 238, 47, 9, 13, 238, 46, 9, 13, 238, 45, 9, 13, 238, 44, 9, 13, - 238, 43, 9, 13, 238, 42, 9, 13, 238, 41, 9, 13, 238, 40, 9, 13, 238, 39, - 9, 13, 238, 38, 9, 13, 238, 37, 9, 13, 238, 36, 9, 13, 238, 35, 9, 13, - 238, 34, 9, 13, 238, 33, 9, 13, 238, 32, 9, 13, 238, 31, 7, 3, 24, 245, - 207, 7, 3, 24, 245, 203, 7, 3, 24, 245, 166, 7, 3, 24, 245, 206, 7, 3, - 24, 245, 205, 7, 3, 24, 171, 226, 235, 222, 201, 7, 3, 24, 223, 168, 132, - 3, 24, 233, 252, 231, 174, 132, 3, 24, 233, 252, 246, 254, 132, 3, 24, - 233, 252, 237, 200, 132, 3, 24, 219, 97, 231, 174, 132, 3, 24, 233, 252, - 218, 133, 87, 1, 217, 221, 2, 243, 94, 87, 229, 32, 237, 42, 219, 176, - 87, 24, 217, 248, 217, 221, 217, 221, 229, 214, 87, 1, 254, 142, 253, - 207, 87, 1, 218, 201, 254, 168, 87, 1, 218, 201, 249, 177, 87, 1, 218, - 201, 243, 162, 87, 1, 218, 201, 236, 246, 87, 1, 218, 201, 235, 152, 87, - 1, 218, 201, 39, 234, 1, 87, 1, 218, 201, 227, 174, 87, 1, 218, 201, 222, - 102, 87, 1, 254, 142, 88, 55, 87, 1, 224, 210, 2, 224, 210, 248, 145, 87, - 1, 224, 210, 2, 224, 113, 248, 145, 87, 1, 224, 210, 2, 249, 194, 25, - 224, 210, 248, 145, 87, 1, 224, 210, 2, 249, 194, 25, 224, 113, 248, 145, - 87, 1, 99, 2, 229, 214, 87, 1, 99, 2, 228, 143, 87, 1, 99, 2, 234, 77, - 87, 1, 252, 105, 2, 249, 193, 87, 1, 244, 92, 2, 249, 193, 87, 1, 249, - 178, 2, 249, 193, 87, 1, 243, 163, 2, 234, 77, 87, 1, 219, 170, 2, 249, - 193, 87, 1, 217, 96, 2, 249, 193, 87, 1, 222, 51, 2, 249, 193, 87, 1, - 217, 221, 2, 249, 193, 87, 1, 39, 236, 247, 2, 249, 193, 87, 1, 236, 247, - 2, 249, 193, 87, 1, 235, 153, 2, 249, 193, 87, 1, 234, 2, 2, 249, 193, - 87, 1, 231, 104, 2, 249, 193, 87, 1, 226, 146, 2, 249, 193, 87, 1, 39, - 229, 199, 2, 249, 193, 87, 1, 229, 199, 2, 249, 193, 87, 1, 221, 52, 2, - 249, 193, 87, 1, 228, 108, 2, 249, 193, 87, 1, 227, 175, 2, 249, 193, 87, - 1, 224, 210, 2, 249, 193, 87, 1, 222, 103, 2, 249, 193, 87, 1, 219, 170, - 2, 242, 254, 87, 1, 252, 105, 2, 227, 248, 87, 1, 236, 247, 2, 227, 248, - 87, 1, 229, 199, 2, 227, 248, 87, 24, 99, 235, 152, 12, 1, 99, 218, 247, - 47, 17, 12, 1, 99, 218, 247, 39, 17, 12, 1, 252, 136, 47, 17, 12, 1, 252, - 136, 39, 17, 12, 1, 252, 136, 66, 17, 12, 1, 252, 136, 128, 17, 12, 1, - 229, 188, 47, 17, 12, 1, 229, 188, 39, 17, 12, 1, 229, 188, 66, 17, 12, - 1, 229, 188, 128, 17, 12, 1, 252, 127, 47, 17, 12, 1, 252, 127, 39, 17, - 12, 1, 252, 127, 66, 17, 12, 1, 252, 127, 128, 17, 12, 1, 221, 22, 47, - 17, 12, 1, 221, 22, 39, 17, 12, 1, 221, 22, 66, 17, 12, 1, 221, 22, 128, - 17, 12, 1, 222, 76, 47, 17, 12, 1, 222, 76, 39, 17, 12, 1, 222, 76, 66, - 17, 12, 1, 222, 76, 128, 17, 12, 1, 221, 24, 47, 17, 12, 1, 221, 24, 39, - 17, 12, 1, 221, 24, 66, 17, 12, 1, 221, 24, 128, 17, 12, 1, 219, 159, 47, - 17, 12, 1, 219, 159, 39, 17, 12, 1, 219, 159, 66, 17, 12, 1, 219, 159, - 128, 17, 12, 1, 229, 186, 47, 17, 12, 1, 229, 186, 39, 17, 12, 1, 229, - 186, 66, 17, 12, 1, 229, 186, 128, 17, 12, 1, 247, 80, 47, 17, 12, 1, - 247, 80, 39, 17, 12, 1, 247, 80, 66, 17, 12, 1, 247, 80, 128, 17, 12, 1, - 231, 71, 47, 17, 12, 1, 231, 71, 39, 17, 12, 1, 231, 71, 66, 17, 12, 1, - 231, 71, 128, 17, 12, 1, 222, 92, 47, 17, 12, 1, 222, 92, 39, 17, 12, 1, - 222, 92, 66, 17, 12, 1, 222, 92, 128, 17, 12, 1, 222, 90, 47, 17, 12, 1, - 222, 90, 39, 17, 12, 1, 222, 90, 66, 17, 12, 1, 222, 90, 128, 17, 12, 1, - 249, 130, 47, 17, 12, 1, 249, 130, 39, 17, 12, 1, 249, 190, 47, 17, 12, - 1, 249, 190, 39, 17, 12, 1, 247, 104, 47, 17, 12, 1, 247, 104, 39, 17, - 12, 1, 249, 128, 47, 17, 12, 1, 249, 128, 39, 17, 12, 1, 237, 110, 47, - 17, 12, 1, 237, 110, 39, 17, 12, 1, 227, 49, 47, 17, 12, 1, 227, 49, 39, - 17, 12, 1, 236, 177, 47, 17, 12, 1, 236, 177, 39, 17, 12, 1, 236, 177, - 66, 17, 12, 1, 236, 177, 128, 17, 12, 1, 244, 244, 47, 17, 12, 1, 244, - 244, 39, 17, 12, 1, 244, 244, 66, 17, 12, 1, 244, 244, 128, 17, 12, 1, - 244, 10, 47, 17, 12, 1, 244, 10, 39, 17, 12, 1, 244, 10, 66, 17, 12, 1, - 244, 10, 128, 17, 12, 1, 232, 83, 47, 17, 12, 1, 232, 83, 39, 17, 12, 1, - 232, 83, 66, 17, 12, 1, 232, 83, 128, 17, 12, 1, 231, 194, 244, 108, 47, - 17, 12, 1, 231, 194, 244, 108, 39, 17, 12, 1, 227, 79, 47, 17, 12, 1, - 227, 79, 39, 17, 12, 1, 227, 79, 66, 17, 12, 1, 227, 79, 128, 17, 12, 1, - 243, 147, 2, 70, 71, 47, 17, 12, 1, 243, 147, 2, 70, 71, 39, 17, 12, 1, - 243, 147, 244, 66, 47, 17, 12, 1, 243, 147, 244, 66, 39, 17, 12, 1, 243, - 147, 244, 66, 66, 17, 12, 1, 243, 147, 244, 66, 128, 17, 12, 1, 243, 147, - 248, 164, 47, 17, 12, 1, 243, 147, 248, 164, 39, 17, 12, 1, 243, 147, - 248, 164, 66, 17, 12, 1, 243, 147, 248, 164, 128, 17, 12, 1, 70, 252, - 195, 47, 17, 12, 1, 70, 252, 195, 39, 17, 12, 1, 70, 252, 195, 2, 181, - 71, 47, 17, 12, 1, 70, 252, 195, 2, 181, 71, 39, 17, 12, 1, 232, 118, 47, - 17, 12, 1, 232, 118, 39, 17, 12, 1, 232, 118, 66, 17, 12, 1, 232, 118, - 128, 17, 12, 1, 105, 47, 17, 12, 1, 105, 39, 17, 12, 1, 230, 168, 47, 17, - 12, 1, 230, 168, 39, 17, 12, 1, 217, 201, 47, 17, 12, 1, 217, 201, 39, - 17, 12, 1, 105, 2, 181, 71, 47, 17, 12, 1, 219, 166, 47, 17, 12, 1, 219, - 166, 39, 17, 12, 1, 236, 98, 230, 168, 47, 17, 12, 1, 236, 98, 230, 168, - 39, 17, 12, 1, 236, 98, 217, 201, 47, 17, 12, 1, 236, 98, 217, 201, 39, - 17, 12, 1, 178, 47, 17, 12, 1, 178, 39, 17, 12, 1, 178, 66, 17, 12, 1, - 178, 128, 17, 12, 1, 220, 104, 236, 188, 236, 98, 99, 197, 66, 17, 12, 1, - 220, 104, 236, 188, 236, 98, 99, 197, 128, 17, 12, 24, 70, 2, 181, 71, 2, - 99, 47, 17, 12, 24, 70, 2, 181, 71, 2, 99, 39, 17, 12, 24, 70, 2, 181, - 71, 2, 254, 235, 47, 17, 12, 24, 70, 2, 181, 71, 2, 254, 235, 39, 17, 12, - 24, 70, 2, 181, 71, 2, 218, 234, 47, 17, 12, 24, 70, 2, 181, 71, 2, 218, - 234, 39, 17, 12, 24, 70, 2, 181, 71, 2, 105, 47, 17, 12, 24, 70, 2, 181, - 71, 2, 105, 39, 17, 12, 24, 70, 2, 181, 71, 2, 230, 168, 47, 17, 12, 24, - 70, 2, 181, 71, 2, 230, 168, 39, 17, 12, 24, 70, 2, 181, 71, 2, 217, 201, - 47, 17, 12, 24, 70, 2, 181, 71, 2, 217, 201, 39, 17, 12, 24, 70, 2, 181, - 71, 2, 178, 47, 17, 12, 24, 70, 2, 181, 71, 2, 178, 39, 17, 12, 24, 70, - 2, 181, 71, 2, 178, 66, 17, 12, 24, 220, 104, 236, 98, 70, 2, 181, 71, 2, - 99, 197, 47, 17, 12, 24, 220, 104, 236, 98, 70, 2, 181, 71, 2, 99, 197, - 39, 17, 12, 24, 220, 104, 236, 98, 70, 2, 181, 71, 2, 99, 197, 66, 17, - 12, 1, 245, 241, 70, 47, 17, 12, 1, 245, 241, 70, 39, 17, 12, 1, 245, - 241, 70, 66, 17, 12, 1, 245, 241, 70, 128, 17, 12, 24, 70, 2, 181, 71, 2, - 134, 47, 17, 12, 24, 70, 2, 181, 71, 2, 111, 47, 17, 12, 24, 70, 2, 181, - 71, 2, 62, 47, 17, 12, 24, 70, 2, 181, 71, 2, 99, 197, 47, 17, 12, 24, - 70, 2, 181, 71, 2, 70, 47, 17, 12, 24, 252, 129, 2, 134, 47, 17, 12, 24, - 252, 129, 2, 111, 47, 17, 12, 24, 252, 129, 2, 236, 147, 47, 17, 12, 24, - 252, 129, 2, 62, 47, 17, 12, 24, 252, 129, 2, 99, 197, 47, 17, 12, 24, - 252, 129, 2, 70, 47, 17, 12, 24, 222, 78, 2, 134, 47, 17, 12, 24, 222, - 78, 2, 111, 47, 17, 12, 24, 222, 78, 2, 236, 147, 47, 17, 12, 24, 222, - 78, 2, 62, 47, 17, 12, 24, 222, 78, 2, 99, 197, 47, 17, 12, 24, 222, 78, - 2, 70, 47, 17, 12, 24, 222, 20, 2, 134, 47, 17, 12, 24, 222, 20, 2, 62, - 47, 17, 12, 24, 222, 20, 2, 99, 197, 47, 17, 12, 24, 222, 20, 2, 70, 47, - 17, 12, 24, 134, 2, 111, 47, 17, 12, 24, 134, 2, 62, 47, 17, 12, 24, 111, - 2, 134, 47, 17, 12, 24, 111, 2, 62, 47, 17, 12, 24, 236, 147, 2, 134, 47, - 17, 12, 24, 236, 147, 2, 111, 47, 17, 12, 24, 236, 147, 2, 62, 47, 17, - 12, 24, 226, 83, 2, 134, 47, 17, 12, 24, 226, 83, 2, 111, 47, 17, 12, 24, - 226, 83, 2, 236, 147, 47, 17, 12, 24, 226, 83, 2, 62, 47, 17, 12, 24, - 226, 171, 2, 111, 47, 17, 12, 24, 226, 171, 2, 62, 47, 17, 12, 24, 249, - 203, 2, 134, 47, 17, 12, 24, 249, 203, 2, 111, 47, 17, 12, 24, 249, 203, - 2, 236, 147, 47, 17, 12, 24, 249, 203, 2, 62, 47, 17, 12, 24, 222, 138, - 2, 111, 47, 17, 12, 24, 222, 138, 2, 62, 47, 17, 12, 24, 217, 110, 2, 62, - 47, 17, 12, 24, 254, 192, 2, 134, 47, 17, 12, 24, 254, 192, 2, 62, 47, - 17, 12, 24, 244, 123, 2, 134, 47, 17, 12, 24, 244, 123, 2, 62, 47, 17, - 12, 24, 245, 222, 2, 134, 47, 17, 12, 24, 245, 222, 2, 111, 47, 17, 12, - 24, 245, 222, 2, 236, 147, 47, 17, 12, 24, 245, 222, 2, 62, 47, 17, 12, - 24, 245, 222, 2, 99, 197, 47, 17, 12, 24, 245, 222, 2, 70, 47, 17, 12, - 24, 228, 149, 2, 111, 47, 17, 12, 24, 228, 149, 2, 62, 47, 17, 12, 24, - 228, 149, 2, 99, 197, 47, 17, 12, 24, 228, 149, 2, 70, 47, 17, 12, 24, - 236, 247, 2, 99, 47, 17, 12, 24, 236, 247, 2, 134, 47, 17, 12, 24, 236, - 247, 2, 111, 47, 17, 12, 24, 236, 247, 2, 236, 147, 47, 17, 12, 24, 236, - 247, 2, 235, 161, 47, 17, 12, 24, 236, 247, 2, 62, 47, 17, 12, 24, 236, - 247, 2, 99, 197, 47, 17, 12, 24, 236, 247, 2, 70, 47, 17, 12, 24, 235, - 161, 2, 134, 47, 17, 12, 24, 235, 161, 2, 111, 47, 17, 12, 24, 235, 161, - 2, 236, 147, 47, 17, 12, 24, 235, 161, 2, 62, 47, 17, 12, 24, 235, 161, - 2, 99, 197, 47, 17, 12, 24, 235, 161, 2, 70, 47, 17, 12, 24, 62, 2, 134, - 47, 17, 12, 24, 62, 2, 111, 47, 17, 12, 24, 62, 2, 236, 147, 47, 17, 12, - 24, 62, 2, 62, 47, 17, 12, 24, 62, 2, 99, 197, 47, 17, 12, 24, 62, 2, 70, - 47, 17, 12, 24, 231, 194, 2, 134, 47, 17, 12, 24, 231, 194, 2, 111, 47, - 17, 12, 24, 231, 194, 2, 236, 147, 47, 17, 12, 24, 231, 194, 2, 62, 47, - 17, 12, 24, 231, 194, 2, 99, 197, 47, 17, 12, 24, 231, 194, 2, 70, 47, - 17, 12, 24, 243, 147, 2, 134, 47, 17, 12, 24, 243, 147, 2, 62, 47, 17, - 12, 24, 243, 147, 2, 99, 197, 47, 17, 12, 24, 243, 147, 2, 70, 47, 17, - 12, 24, 70, 2, 134, 47, 17, 12, 24, 70, 2, 111, 47, 17, 12, 24, 70, 2, - 236, 147, 47, 17, 12, 24, 70, 2, 62, 47, 17, 12, 24, 70, 2, 99, 197, 47, - 17, 12, 24, 70, 2, 70, 47, 17, 12, 24, 222, 30, 2, 223, 59, 99, 47, 17, - 12, 24, 227, 197, 2, 223, 59, 99, 47, 17, 12, 24, 99, 197, 2, 223, 59, - 99, 47, 17, 12, 24, 225, 17, 2, 249, 171, 47, 17, 12, 24, 225, 17, 2, - 236, 205, 47, 17, 12, 24, 225, 17, 2, 245, 239, 47, 17, 12, 24, 225, 17, - 2, 249, 173, 47, 17, 12, 24, 225, 17, 2, 236, 207, 47, 17, 12, 24, 225, - 17, 2, 223, 59, 99, 47, 17, 12, 24, 70, 2, 181, 71, 2, 227, 197, 39, 17, - 12, 24, 70, 2, 181, 71, 2, 217, 107, 39, 17, 12, 24, 70, 2, 181, 71, 2, - 62, 39, 17, 12, 24, 70, 2, 181, 71, 2, 231, 194, 39, 17, 12, 24, 70, 2, - 181, 71, 2, 99, 197, 39, 17, 12, 24, 70, 2, 181, 71, 2, 70, 39, 17, 12, - 24, 252, 129, 2, 227, 197, 39, 17, 12, 24, 252, 129, 2, 217, 107, 39, 17, - 12, 24, 252, 129, 2, 62, 39, 17, 12, 24, 252, 129, 2, 231, 194, 39, 17, - 12, 24, 252, 129, 2, 99, 197, 39, 17, 12, 24, 252, 129, 2, 70, 39, 17, - 12, 24, 222, 78, 2, 227, 197, 39, 17, 12, 24, 222, 78, 2, 217, 107, 39, - 17, 12, 24, 222, 78, 2, 62, 39, 17, 12, 24, 222, 78, 2, 231, 194, 39, 17, - 12, 24, 222, 78, 2, 99, 197, 39, 17, 12, 24, 222, 78, 2, 70, 39, 17, 12, - 24, 222, 20, 2, 227, 197, 39, 17, 12, 24, 222, 20, 2, 217, 107, 39, 17, - 12, 24, 222, 20, 2, 62, 39, 17, 12, 24, 222, 20, 2, 231, 194, 39, 17, 12, - 24, 222, 20, 2, 99, 197, 39, 17, 12, 24, 222, 20, 2, 70, 39, 17, 12, 24, - 245, 222, 2, 99, 197, 39, 17, 12, 24, 245, 222, 2, 70, 39, 17, 12, 24, - 228, 149, 2, 99, 197, 39, 17, 12, 24, 228, 149, 2, 70, 39, 17, 12, 24, - 236, 247, 2, 99, 39, 17, 12, 24, 236, 247, 2, 235, 161, 39, 17, 12, 24, - 236, 247, 2, 62, 39, 17, 12, 24, 236, 247, 2, 99, 197, 39, 17, 12, 24, - 236, 247, 2, 70, 39, 17, 12, 24, 235, 161, 2, 62, 39, 17, 12, 24, 235, - 161, 2, 99, 197, 39, 17, 12, 24, 235, 161, 2, 70, 39, 17, 12, 24, 62, 2, - 99, 39, 17, 12, 24, 62, 2, 62, 39, 17, 12, 24, 231, 194, 2, 227, 197, 39, - 17, 12, 24, 231, 194, 2, 217, 107, 39, 17, 12, 24, 231, 194, 2, 62, 39, - 17, 12, 24, 231, 194, 2, 231, 194, 39, 17, 12, 24, 231, 194, 2, 99, 197, - 39, 17, 12, 24, 231, 194, 2, 70, 39, 17, 12, 24, 99, 197, 2, 223, 59, 99, - 39, 17, 12, 24, 70, 2, 227, 197, 39, 17, 12, 24, 70, 2, 217, 107, 39, 17, - 12, 24, 70, 2, 62, 39, 17, 12, 24, 70, 2, 231, 194, 39, 17, 12, 24, 70, - 2, 99, 197, 39, 17, 12, 24, 70, 2, 70, 39, 17, 12, 24, 70, 2, 181, 71, 2, - 134, 66, 17, 12, 24, 70, 2, 181, 71, 2, 111, 66, 17, 12, 24, 70, 2, 181, - 71, 2, 236, 147, 66, 17, 12, 24, 70, 2, 181, 71, 2, 62, 66, 17, 12, 24, - 70, 2, 181, 71, 2, 243, 147, 66, 17, 12, 24, 252, 129, 2, 134, 66, 17, - 12, 24, 252, 129, 2, 111, 66, 17, 12, 24, 252, 129, 2, 236, 147, 66, 17, - 12, 24, 252, 129, 2, 62, 66, 17, 12, 24, 252, 129, 2, 243, 147, 66, 17, - 12, 24, 222, 78, 2, 134, 66, 17, 12, 24, 222, 78, 2, 111, 66, 17, 12, 24, - 222, 78, 2, 236, 147, 66, 17, 12, 24, 222, 78, 2, 62, 66, 17, 12, 24, - 222, 78, 2, 243, 147, 66, 17, 12, 24, 222, 20, 2, 62, 66, 17, 12, 24, - 134, 2, 111, 66, 17, 12, 24, 134, 2, 62, 66, 17, 12, 24, 111, 2, 134, 66, - 17, 12, 24, 111, 2, 62, 66, 17, 12, 24, 236, 147, 2, 134, 66, 17, 12, 24, - 236, 147, 2, 62, 66, 17, 12, 24, 226, 83, 2, 134, 66, 17, 12, 24, 226, - 83, 2, 111, 66, 17, 12, 24, 226, 83, 2, 236, 147, 66, 17, 12, 24, 226, - 83, 2, 62, 66, 17, 12, 24, 226, 171, 2, 111, 66, 17, 12, 24, 226, 171, 2, - 236, 147, 66, 17, 12, 24, 226, 171, 2, 62, 66, 17, 12, 24, 249, 203, 2, - 134, 66, 17, 12, 24, 249, 203, 2, 111, 66, 17, 12, 24, 249, 203, 2, 236, - 147, 66, 17, 12, 24, 249, 203, 2, 62, 66, 17, 12, 24, 222, 138, 2, 111, - 66, 17, 12, 24, 217, 110, 2, 62, 66, 17, 12, 24, 254, 192, 2, 134, 66, - 17, 12, 24, 254, 192, 2, 62, 66, 17, 12, 24, 244, 123, 2, 134, 66, 17, - 12, 24, 244, 123, 2, 62, 66, 17, 12, 24, 245, 222, 2, 134, 66, 17, 12, - 24, 245, 222, 2, 111, 66, 17, 12, 24, 245, 222, 2, 236, 147, 66, 17, 12, - 24, 245, 222, 2, 62, 66, 17, 12, 24, 228, 149, 2, 111, 66, 17, 12, 24, - 228, 149, 2, 62, 66, 17, 12, 24, 236, 247, 2, 134, 66, 17, 12, 24, 236, - 247, 2, 111, 66, 17, 12, 24, 236, 247, 2, 236, 147, 66, 17, 12, 24, 236, - 247, 2, 235, 161, 66, 17, 12, 24, 236, 247, 2, 62, 66, 17, 12, 24, 235, - 161, 2, 134, 66, 17, 12, 24, 235, 161, 2, 111, 66, 17, 12, 24, 235, 161, - 2, 236, 147, 66, 17, 12, 24, 235, 161, 2, 62, 66, 17, 12, 24, 235, 161, - 2, 243, 147, 66, 17, 12, 24, 62, 2, 134, 66, 17, 12, 24, 62, 2, 111, 66, - 17, 12, 24, 62, 2, 236, 147, 66, 17, 12, 24, 62, 2, 62, 66, 17, 12, 24, - 231, 194, 2, 134, 66, 17, 12, 24, 231, 194, 2, 111, 66, 17, 12, 24, 231, - 194, 2, 236, 147, 66, 17, 12, 24, 231, 194, 2, 62, 66, 17, 12, 24, 231, - 194, 2, 243, 147, 66, 17, 12, 24, 243, 147, 2, 134, 66, 17, 12, 24, 243, - 147, 2, 62, 66, 17, 12, 24, 243, 147, 2, 223, 59, 99, 66, 17, 12, 24, 70, - 2, 134, 66, 17, 12, 24, 70, 2, 111, 66, 17, 12, 24, 70, 2, 236, 147, 66, - 17, 12, 24, 70, 2, 62, 66, 17, 12, 24, 70, 2, 243, 147, 66, 17, 12, 24, - 70, 2, 181, 71, 2, 62, 128, 17, 12, 24, 70, 2, 181, 71, 2, 243, 147, 128, - 17, 12, 24, 252, 129, 2, 62, 128, 17, 12, 24, 252, 129, 2, 243, 147, 128, - 17, 12, 24, 222, 78, 2, 62, 128, 17, 12, 24, 222, 78, 2, 243, 147, 128, - 17, 12, 24, 222, 20, 2, 62, 128, 17, 12, 24, 222, 20, 2, 243, 147, 128, - 17, 12, 24, 226, 83, 2, 62, 128, 17, 12, 24, 226, 83, 2, 243, 147, 128, - 17, 12, 24, 224, 243, 2, 62, 128, 17, 12, 24, 224, 243, 2, 243, 147, 128, - 17, 12, 24, 236, 247, 2, 235, 161, 128, 17, 12, 24, 236, 247, 2, 62, 128, - 17, 12, 24, 235, 161, 2, 62, 128, 17, 12, 24, 231, 194, 2, 62, 128, 17, - 12, 24, 231, 194, 2, 243, 147, 128, 17, 12, 24, 70, 2, 62, 128, 17, 12, - 24, 70, 2, 243, 147, 128, 17, 12, 24, 225, 17, 2, 245, 239, 128, 17, 12, - 24, 225, 17, 2, 249, 173, 128, 17, 12, 24, 225, 17, 2, 236, 207, 128, 17, - 12, 24, 222, 138, 2, 99, 197, 47, 17, 12, 24, 222, 138, 2, 70, 47, 17, - 12, 24, 254, 192, 2, 99, 197, 47, 17, 12, 24, 254, 192, 2, 70, 47, 17, - 12, 24, 244, 123, 2, 99, 197, 47, 17, 12, 24, 244, 123, 2, 70, 47, 17, - 12, 24, 226, 83, 2, 99, 197, 47, 17, 12, 24, 226, 83, 2, 70, 47, 17, 12, - 24, 224, 243, 2, 99, 197, 47, 17, 12, 24, 224, 243, 2, 70, 47, 17, 12, - 24, 111, 2, 99, 197, 47, 17, 12, 24, 111, 2, 70, 47, 17, 12, 24, 134, 2, - 99, 197, 47, 17, 12, 24, 134, 2, 70, 47, 17, 12, 24, 236, 147, 2, 99, - 197, 47, 17, 12, 24, 236, 147, 2, 70, 47, 17, 12, 24, 226, 171, 2, 99, - 197, 47, 17, 12, 24, 226, 171, 2, 70, 47, 17, 12, 24, 249, 203, 2, 99, - 197, 47, 17, 12, 24, 249, 203, 2, 70, 47, 17, 12, 24, 224, 243, 2, 134, - 47, 17, 12, 24, 224, 243, 2, 111, 47, 17, 12, 24, 224, 243, 2, 236, 147, - 47, 17, 12, 24, 224, 243, 2, 62, 47, 17, 12, 24, 224, 243, 2, 227, 197, - 47, 17, 12, 24, 226, 83, 2, 227, 197, 47, 17, 12, 24, 226, 171, 2, 227, - 197, 47, 17, 12, 24, 249, 203, 2, 227, 197, 47, 17, 12, 24, 222, 138, 2, - 99, 197, 39, 17, 12, 24, 222, 138, 2, 70, 39, 17, 12, 24, 254, 192, 2, - 99, 197, 39, 17, 12, 24, 254, 192, 2, 70, 39, 17, 12, 24, 244, 123, 2, - 99, 197, 39, 17, 12, 24, 244, 123, 2, 70, 39, 17, 12, 24, 226, 83, 2, 99, - 197, 39, 17, 12, 24, 226, 83, 2, 70, 39, 17, 12, 24, 224, 243, 2, 99, - 197, 39, 17, 12, 24, 224, 243, 2, 70, 39, 17, 12, 24, 111, 2, 99, 197, - 39, 17, 12, 24, 111, 2, 70, 39, 17, 12, 24, 134, 2, 99, 197, 39, 17, 12, - 24, 134, 2, 70, 39, 17, 12, 24, 236, 147, 2, 99, 197, 39, 17, 12, 24, - 236, 147, 2, 70, 39, 17, 12, 24, 226, 171, 2, 99, 197, 39, 17, 12, 24, - 226, 171, 2, 70, 39, 17, 12, 24, 249, 203, 2, 99, 197, 39, 17, 12, 24, - 249, 203, 2, 70, 39, 17, 12, 24, 224, 243, 2, 134, 39, 17, 12, 24, 224, - 243, 2, 111, 39, 17, 12, 24, 224, 243, 2, 236, 147, 39, 17, 12, 24, 224, - 243, 2, 62, 39, 17, 12, 24, 224, 243, 2, 227, 197, 39, 17, 12, 24, 226, - 83, 2, 227, 197, 39, 17, 12, 24, 226, 171, 2, 227, 197, 39, 17, 12, 24, - 249, 203, 2, 227, 197, 39, 17, 12, 24, 224, 243, 2, 134, 66, 17, 12, 24, - 224, 243, 2, 111, 66, 17, 12, 24, 224, 243, 2, 236, 147, 66, 17, 12, 24, - 224, 243, 2, 62, 66, 17, 12, 24, 226, 83, 2, 243, 147, 66, 17, 12, 24, - 224, 243, 2, 243, 147, 66, 17, 12, 24, 222, 138, 2, 62, 66, 17, 12, 24, - 226, 83, 2, 134, 128, 17, 12, 24, 226, 83, 2, 111, 128, 17, 12, 24, 226, - 83, 2, 236, 147, 128, 17, 12, 24, 224, 243, 2, 134, 128, 17, 12, 24, 224, - 243, 2, 111, 128, 17, 12, 24, 224, 243, 2, 236, 147, 128, 17, 12, 24, - 222, 138, 2, 62, 128, 17, 12, 24, 217, 110, 2, 62, 128, 17, 12, 24, 99, - 2, 245, 237, 39, 17, 12, 24, 99, 2, 245, 237, 47, 17, 230, 97, 42, 229, - 229, 230, 97, 45, 229, 229, 12, 24, 222, 78, 2, 134, 2, 62, 66, 17, 12, - 24, 222, 78, 2, 111, 2, 134, 39, 17, 12, 24, 222, 78, 2, 111, 2, 134, 66, - 17, 12, 24, 222, 78, 2, 111, 2, 62, 66, 17, 12, 24, 222, 78, 2, 236, 147, - 2, 62, 66, 17, 12, 24, 222, 78, 2, 62, 2, 134, 66, 17, 12, 24, 222, 78, - 2, 62, 2, 111, 66, 17, 12, 24, 222, 78, 2, 62, 2, 236, 147, 66, 17, 12, - 24, 134, 2, 62, 2, 111, 39, 17, 12, 24, 134, 2, 62, 2, 111, 66, 17, 12, - 24, 111, 2, 62, 2, 70, 39, 17, 12, 24, 111, 2, 62, 2, 99, 197, 39, 17, - 12, 24, 226, 83, 2, 111, 2, 134, 66, 17, 12, 24, 226, 83, 2, 134, 2, 111, - 66, 17, 12, 24, 226, 83, 2, 134, 2, 99, 197, 39, 17, 12, 24, 226, 83, 2, - 62, 2, 111, 39, 17, 12, 24, 226, 83, 2, 62, 2, 111, 66, 17, 12, 24, 226, - 83, 2, 62, 2, 134, 66, 17, 12, 24, 226, 83, 2, 62, 2, 62, 39, 17, 12, 24, - 226, 83, 2, 62, 2, 62, 66, 17, 12, 24, 226, 171, 2, 111, 2, 111, 39, 17, - 12, 24, 226, 171, 2, 111, 2, 111, 66, 17, 12, 24, 226, 171, 2, 62, 2, 62, - 39, 17, 12, 24, 224, 243, 2, 111, 2, 62, 39, 17, 12, 24, 224, 243, 2, - 111, 2, 62, 66, 17, 12, 24, 224, 243, 2, 134, 2, 70, 39, 17, 12, 24, 224, - 243, 2, 62, 2, 236, 147, 39, 17, 12, 24, 224, 243, 2, 62, 2, 236, 147, - 66, 17, 12, 24, 224, 243, 2, 62, 2, 62, 39, 17, 12, 24, 224, 243, 2, 62, - 2, 62, 66, 17, 12, 24, 249, 203, 2, 111, 2, 99, 197, 39, 17, 12, 24, 249, - 203, 2, 236, 147, 2, 62, 39, 17, 12, 24, 249, 203, 2, 236, 147, 2, 62, - 66, 17, 12, 24, 222, 138, 2, 62, 2, 111, 39, 17, 12, 24, 222, 138, 2, 62, - 2, 111, 66, 17, 12, 24, 222, 138, 2, 62, 2, 62, 66, 17, 12, 24, 222, 138, - 2, 62, 2, 70, 39, 17, 12, 24, 254, 192, 2, 134, 2, 62, 39, 17, 12, 24, - 254, 192, 2, 62, 2, 62, 39, 17, 12, 24, 254, 192, 2, 62, 2, 62, 66, 17, - 12, 24, 254, 192, 2, 62, 2, 99, 197, 39, 17, 12, 24, 244, 123, 2, 62, 2, - 62, 39, 17, 12, 24, 244, 123, 2, 62, 2, 70, 39, 17, 12, 24, 244, 123, 2, - 62, 2, 99, 197, 39, 17, 12, 24, 245, 222, 2, 236, 147, 2, 62, 39, 17, 12, - 24, 245, 222, 2, 236, 147, 2, 62, 66, 17, 12, 24, 228, 149, 2, 62, 2, - 111, 39, 17, 12, 24, 228, 149, 2, 62, 2, 62, 39, 17, 12, 24, 235, 161, 2, - 111, 2, 62, 39, 17, 12, 24, 235, 161, 2, 111, 2, 70, 39, 17, 12, 24, 235, - 161, 2, 111, 2, 99, 197, 39, 17, 12, 24, 235, 161, 2, 134, 2, 134, 66, - 17, 12, 24, 235, 161, 2, 134, 2, 134, 39, 17, 12, 24, 235, 161, 2, 236, - 147, 2, 62, 39, 17, 12, 24, 235, 161, 2, 236, 147, 2, 62, 66, 17, 12, 24, - 235, 161, 2, 62, 2, 111, 39, 17, 12, 24, 235, 161, 2, 62, 2, 111, 66, 17, - 12, 24, 62, 2, 111, 2, 134, 66, 17, 12, 24, 62, 2, 111, 2, 62, 66, 17, - 12, 24, 62, 2, 111, 2, 70, 39, 17, 12, 24, 62, 2, 134, 2, 111, 66, 17, - 12, 24, 62, 2, 134, 2, 62, 66, 17, 12, 24, 62, 2, 236, 147, 2, 134, 66, - 17, 12, 24, 62, 2, 236, 147, 2, 62, 66, 17, 12, 24, 62, 2, 134, 2, 236, - 147, 66, 17, 12, 24, 243, 147, 2, 62, 2, 134, 66, 17, 12, 24, 243, 147, - 2, 62, 2, 62, 66, 17, 12, 24, 231, 194, 2, 111, 2, 62, 66, 17, 12, 24, - 231, 194, 2, 111, 2, 99, 197, 39, 17, 12, 24, 231, 194, 2, 134, 2, 62, - 39, 17, 12, 24, 231, 194, 2, 134, 2, 62, 66, 17, 12, 24, 231, 194, 2, - 134, 2, 99, 197, 39, 17, 12, 24, 231, 194, 2, 62, 2, 70, 39, 17, 12, 24, - 231, 194, 2, 62, 2, 99, 197, 39, 17, 12, 24, 70, 2, 62, 2, 62, 39, 17, - 12, 24, 70, 2, 62, 2, 62, 66, 17, 12, 24, 252, 129, 2, 236, 147, 2, 70, - 39, 17, 12, 24, 222, 78, 2, 134, 2, 70, 39, 17, 12, 24, 222, 78, 2, 134, - 2, 99, 197, 39, 17, 12, 24, 222, 78, 2, 236, 147, 2, 70, 39, 17, 12, 24, - 222, 78, 2, 236, 147, 2, 99, 197, 39, 17, 12, 24, 222, 78, 2, 62, 2, 70, - 39, 17, 12, 24, 222, 78, 2, 62, 2, 99, 197, 39, 17, 12, 24, 134, 2, 62, - 2, 70, 39, 17, 12, 24, 134, 2, 111, 2, 99, 197, 39, 17, 12, 24, 134, 2, - 62, 2, 99, 197, 39, 17, 12, 24, 226, 83, 2, 236, 147, 2, 99, 197, 39, 17, - 12, 24, 226, 171, 2, 111, 2, 70, 39, 17, 12, 24, 224, 243, 2, 111, 2, 70, - 39, 17, 12, 24, 249, 203, 2, 111, 2, 70, 39, 17, 12, 24, 235, 161, 2, - 134, 2, 70, 39, 17, 12, 24, 235, 161, 2, 62, 2, 70, 39, 17, 12, 24, 70, - 2, 111, 2, 70, 39, 17, 12, 24, 70, 2, 134, 2, 70, 39, 17, 12, 24, 70, 2, - 62, 2, 70, 39, 17, 12, 24, 62, 2, 62, 2, 70, 39, 17, 12, 24, 228, 149, 2, - 62, 2, 70, 39, 17, 12, 24, 231, 194, 2, 111, 2, 70, 39, 17, 12, 24, 228, - 149, 2, 62, 2, 111, 66, 17, 12, 24, 235, 161, 2, 111, 2, 62, 66, 17, 12, - 24, 254, 192, 2, 62, 2, 70, 39, 17, 12, 24, 236, 247, 2, 62, 2, 70, 39, - 17, 12, 24, 231, 194, 2, 134, 2, 111, 66, 17, 12, 24, 62, 2, 236, 147, 2, - 70, 39, 17, 12, 24, 235, 161, 2, 134, 2, 62, 66, 17, 12, 24, 236, 247, 2, - 62, 2, 62, 39, 17, 12, 24, 235, 161, 2, 134, 2, 62, 39, 17, 12, 24, 231, - 194, 2, 134, 2, 111, 39, 17, 12, 24, 134, 2, 111, 2, 70, 39, 17, 12, 24, - 111, 2, 134, 2, 70, 39, 17, 12, 24, 62, 2, 134, 2, 70, 39, 17, 12, 24, - 245, 222, 2, 62, 2, 70, 39, 17, 12, 24, 252, 129, 2, 111, 2, 70, 39, 17, - 12, 24, 236, 247, 2, 62, 2, 62, 66, 17, 12, 24, 254, 192, 2, 134, 2, 62, - 66, 17, 12, 24, 226, 171, 2, 62, 2, 62, 66, 17, 12, 24, 226, 83, 2, 236, - 147, 2, 70, 39, 17, 12, 24, 231, 194, 2, 134, 2, 70, 39, 17, 12, 24, 226, - 153, 220, 32, 254, 14, 236, 35, 223, 137, 5, 47, 17, 12, 24, 228, 145, - 220, 32, 254, 14, 236, 35, 223, 137, 5, 47, 17, 12, 24, 254, 156, 47, 17, - 12, 24, 254, 179, 47, 17, 12, 24, 233, 130, 47, 17, 12, 24, 226, 154, 47, - 17, 12, 24, 227, 230, 47, 17, 12, 24, 254, 170, 47, 17, 12, 24, 218, 249, - 47, 17, 12, 24, 226, 153, 47, 17, 12, 24, 226, 152, 254, 170, 218, 248, - 12, 24, 237, 120, 227, 146, 55, 12, 24, 252, 61, 254, 65, 254, 66, 41, - 226, 73, 41, 225, 218, 41, 225, 150, 41, 225, 139, 41, 225, 128, 41, 225, - 117, 41, 225, 106, 41, 225, 95, 41, 225, 84, 41, 226, 72, 41, 226, 61, - 41, 226, 50, 41, 226, 39, 41, 226, 28, 41, 226, 17, 41, 226, 6, 228, 238, - 245, 124, 35, 69, 250, 168, 228, 238, 245, 124, 35, 69, 98, 250, 168, - 228, 238, 245, 124, 35, 69, 98, 245, 90, 223, 136, 228, 238, 245, 124, - 35, 69, 250, 175, 228, 238, 245, 124, 35, 69, 225, 67, 228, 238, 245, - 124, 35, 69, 246, 95, 78, 228, 238, 245, 124, 35, 69, 228, 82, 78, 228, - 238, 245, 124, 35, 69, 42, 67, 235, 91, 115, 228, 238, 245, 124, 35, 69, - 45, 67, 235, 91, 252, 16, 228, 238, 245, 124, 35, 69, 186, 246, 208, 36, - 24, 42, 243, 194, 36, 24, 45, 243, 194, 36, 51, 221, 180, 42, 243, 194, - 36, 51, 221, 180, 45, 243, 194, 36, 234, 116, 42, 243, 194, 36, 234, 116, - 45, 243, 194, 36, 250, 151, 234, 115, 228, 238, 245, 124, 35, 69, 124, - 61, 235, 121, 228, 238, 245, 124, 35, 69, 246, 206, 249, 146, 228, 238, - 245, 124, 35, 69, 246, 198, 249, 146, 228, 238, 245, 124, 35, 69, 109, - 235, 43, 228, 238, 245, 124, 35, 69, 218, 235, 109, 235, 43, 228, 238, - 245, 124, 35, 69, 42, 229, 229, 228, 238, 245, 124, 35, 69, 45, 229, 229, - 228, 238, 245, 124, 35, 69, 42, 250, 79, 115, 228, 238, 245, 124, 35, 69, - 45, 250, 79, 115, 228, 238, 245, 124, 35, 69, 42, 221, 114, 224, 236, - 115, 228, 238, 245, 124, 35, 69, 45, 221, 114, 224, 236, 115, 228, 238, - 245, 124, 35, 69, 42, 84, 235, 91, 115, 228, 238, 245, 124, 35, 69, 45, - 84, 235, 91, 115, 228, 238, 245, 124, 35, 69, 42, 51, 254, 120, 115, 228, - 238, 245, 124, 35, 69, 45, 51, 254, 120, 115, 228, 238, 245, 124, 35, 69, - 42, 254, 120, 115, 228, 238, 245, 124, 35, 69, 45, 254, 120, 115, 228, - 238, 245, 124, 35, 69, 42, 250, 124, 115, 228, 238, 245, 124, 35, 69, 45, - 250, 124, 115, 228, 238, 245, 124, 35, 69, 42, 67, 250, 124, 115, 228, - 238, 245, 124, 35, 69, 45, 67, 250, 124, 115, 225, 49, 248, 145, 67, 225, - 49, 248, 145, 228, 238, 245, 124, 35, 69, 42, 40, 115, 228, 238, 245, - 124, 35, 69, 45, 40, 115, 249, 145, 230, 73, 251, 82, 230, 73, 218, 235, - 230, 73, 51, 218, 235, 230, 73, 249, 145, 109, 235, 43, 251, 82, 109, - 235, 43, 218, 235, 109, 235, 43, 3, 250, 168, 3, 98, 250, 168, 3, 245, - 90, 223, 136, 3, 225, 67, 3, 250, 175, 3, 228, 82, 78, 3, 246, 95, 78, 3, - 246, 206, 249, 146, 3, 42, 229, 229, 3, 45, 229, 229, 3, 42, 250, 79, - 115, 3, 45, 250, 79, 115, 3, 42, 221, 114, 224, 236, 115, 3, 45, 221, - 114, 224, 236, 115, 3, 54, 55, 3, 254, 134, 3, 253, 251, 3, 88, 55, 3, - 242, 120, 3, 235, 87, 55, 3, 244, 30, 55, 3, 246, 154, 55, 3, 227, 160, - 224, 17, 3, 248, 155, 55, 3, 229, 169, 55, 3, 250, 167, 253, 244, 12, - 245, 237, 47, 17, 12, 222, 108, 2, 245, 237, 50, 12, 249, 171, 47, 17, - 12, 222, 136, 245, 107, 12, 236, 205, 47, 17, 12, 245, 239, 47, 17, 12, - 245, 239, 128, 17, 12, 249, 173, 47, 17, 12, 249, 173, 128, 17, 12, 236, - 207, 47, 17, 12, 236, 207, 128, 17, 12, 225, 17, 47, 17, 12, 225, 17, - 128, 17, 12, 223, 76, 47, 17, 12, 223, 76, 128, 17, 12, 1, 181, 47, 17, - 12, 1, 99, 2, 234, 111, 71, 47, 17, 12, 1, 99, 2, 234, 111, 71, 39, 17, - 12, 1, 99, 2, 181, 71, 47, 17, 12, 1, 99, 2, 181, 71, 39, 17, 12, 1, 218, - 234, 2, 181, 71, 47, 17, 12, 1, 218, 234, 2, 181, 71, 39, 17, 12, 1, 99, - 2, 181, 252, 118, 47, 17, 12, 1, 99, 2, 181, 252, 118, 39, 17, 12, 1, 70, - 2, 181, 71, 47, 17, 12, 1, 70, 2, 181, 71, 39, 17, 12, 1, 70, 2, 181, 71, - 66, 17, 12, 1, 70, 2, 181, 71, 128, 17, 12, 1, 99, 47, 17, 12, 1, 99, 39, - 17, 12, 1, 252, 129, 47, 17, 12, 1, 252, 129, 39, 17, 12, 1, 252, 129, - 66, 17, 12, 1, 252, 129, 128, 17, 12, 1, 222, 78, 234, 73, 47, 17, 12, 1, - 222, 78, 234, 73, 39, 17, 12, 1, 222, 78, 47, 17, 12, 1, 222, 78, 39, 17, - 12, 1, 222, 78, 66, 17, 12, 1, 222, 78, 128, 17, 12, 1, 222, 20, 47, 17, - 12, 1, 222, 20, 39, 17, 12, 1, 222, 20, 66, 17, 12, 1, 222, 20, 128, 17, - 12, 1, 134, 47, 17, 12, 1, 134, 39, 17, 12, 1, 134, 66, 17, 12, 1, 134, - 128, 17, 12, 1, 111, 47, 17, 12, 1, 111, 39, 17, 12, 1, 111, 66, 17, 12, - 1, 111, 128, 17, 12, 1, 236, 147, 47, 17, 12, 1, 236, 147, 39, 17, 12, 1, - 236, 147, 66, 17, 12, 1, 236, 147, 128, 17, 12, 1, 249, 184, 47, 17, 12, - 1, 249, 184, 39, 17, 12, 1, 222, 30, 47, 17, 12, 1, 222, 30, 39, 17, 12, - 1, 227, 197, 47, 17, 12, 1, 227, 197, 39, 17, 12, 1, 217, 107, 47, 17, - 12, 1, 217, 107, 39, 17, 12, 1, 226, 83, 47, 17, 12, 1, 226, 83, 39, 17, - 12, 1, 226, 83, 66, 17, 12, 1, 226, 83, 128, 17, 12, 1, 224, 243, 47, 17, - 12, 1, 224, 243, 39, 17, 12, 1, 224, 243, 66, 17, 12, 1, 224, 243, 128, - 17, 12, 1, 226, 171, 47, 17, 12, 1, 226, 171, 39, 17, 12, 1, 226, 171, - 66, 17, 12, 1, 226, 171, 128, 17, 12, 1, 249, 203, 47, 17, 12, 1, 249, - 203, 39, 17, 12, 1, 249, 203, 66, 17, 12, 1, 249, 203, 128, 17, 12, 1, - 222, 138, 47, 17, 12, 1, 222, 138, 39, 17, 12, 1, 222, 138, 66, 17, 12, - 1, 222, 138, 128, 17, 12, 1, 217, 110, 47, 17, 12, 1, 217, 110, 39, 17, - 12, 1, 217, 110, 66, 17, 12, 1, 217, 110, 128, 17, 12, 1, 254, 192, 47, - 17, 12, 1, 254, 192, 39, 17, 12, 1, 254, 192, 66, 17, 12, 1, 254, 192, - 128, 17, 12, 1, 244, 123, 47, 17, 12, 1, 244, 123, 39, 17, 12, 1, 244, - 123, 66, 17, 12, 1, 244, 123, 128, 17, 12, 1, 245, 222, 47, 17, 12, 1, - 245, 222, 39, 17, 12, 1, 245, 222, 66, 17, 12, 1, 245, 222, 128, 17, 12, - 1, 228, 149, 47, 17, 12, 1, 228, 149, 39, 17, 12, 1, 228, 149, 66, 17, - 12, 1, 228, 149, 128, 17, 12, 1, 236, 247, 47, 17, 12, 1, 236, 247, 39, - 17, 12, 1, 236, 247, 66, 17, 12, 1, 236, 247, 128, 17, 12, 1, 235, 161, - 47, 17, 12, 1, 235, 161, 39, 17, 12, 1, 235, 161, 66, 17, 12, 1, 235, - 161, 128, 17, 12, 1, 62, 47, 17, 12, 1, 62, 39, 17, 12, 1, 62, 66, 17, - 12, 1, 62, 128, 17, 12, 1, 231, 194, 47, 17, 12, 1, 231, 194, 39, 17, 12, - 1, 231, 194, 66, 17, 12, 1, 231, 194, 128, 17, 12, 1, 243, 147, 47, 17, - 12, 1, 243, 147, 39, 17, 12, 1, 243, 147, 66, 17, 12, 1, 243, 147, 128, - 17, 12, 1, 218, 234, 47, 17, 12, 1, 218, 234, 39, 17, 12, 1, 99, 197, 47, - 17, 12, 1, 99, 197, 39, 17, 12, 1, 70, 47, 17, 12, 1, 70, 39, 17, 12, 1, - 70, 66, 17, 12, 1, 70, 128, 17, 12, 24, 235, 161, 2, 99, 2, 234, 111, 71, - 47, 17, 12, 24, 235, 161, 2, 99, 2, 234, 111, 71, 39, 17, 12, 24, 235, - 161, 2, 99, 2, 181, 71, 47, 17, 12, 24, 235, 161, 2, 99, 2, 181, 71, 39, - 17, 12, 24, 235, 161, 2, 99, 2, 181, 252, 118, 47, 17, 12, 24, 235, 161, - 2, 99, 2, 181, 252, 118, 39, 17, 12, 24, 235, 161, 2, 99, 47, 17, 12, 24, - 235, 161, 2, 99, 39, 17, 217, 85, 218, 199, 231, 203, 223, 254, 110, 246, - 95, 78, 110, 228, 69, 78, 110, 54, 55, 110, 248, 155, 55, 110, 229, 169, - 55, 110, 254, 134, 110, 254, 79, 110, 42, 229, 229, 110, 45, 229, 229, - 110, 253, 251, 110, 88, 55, 110, 250, 168, 110, 242, 120, 110, 245, 90, - 223, 136, 110, 224, 17, 110, 20, 217, 84, 110, 20, 107, 110, 20, 103, - 110, 20, 160, 110, 20, 154, 110, 20, 174, 110, 20, 182, 110, 20, 191, - 110, 20, 185, 110, 20, 190, 110, 250, 175, 110, 225, 67, 110, 235, 87, - 55, 110, 246, 154, 55, 110, 244, 30, 55, 110, 228, 82, 78, 110, 250, 167, - 253, 244, 110, 7, 6, 1, 60, 110, 7, 6, 1, 253, 204, 110, 7, 6, 1, 251, - 202, 110, 7, 6, 1, 250, 46, 110, 7, 6, 1, 73, 110, 7, 6, 1, 246, 74, 110, - 7, 6, 1, 245, 67, 110, 7, 6, 1, 243, 225, 110, 7, 6, 1, 72, 110, 7, 6, 1, - 237, 126, 110, 7, 6, 1, 237, 17, 110, 7, 6, 1, 153, 110, 7, 6, 1, 189, - 110, 7, 6, 1, 207, 110, 7, 6, 1, 74, 110, 7, 6, 1, 230, 59, 110, 7, 6, 1, - 228, 163, 110, 7, 6, 1, 152, 110, 7, 6, 1, 198, 110, 7, 6, 1, 222, 201, - 110, 7, 6, 1, 68, 110, 7, 6, 1, 216, 216, 110, 7, 6, 1, 219, 40, 110, 7, - 6, 1, 218, 151, 110, 7, 6, 1, 218, 90, 110, 7, 6, 1, 217, 157, 110, 42, - 40, 115, 110, 227, 160, 224, 17, 110, 45, 40, 115, 110, 250, 217, 255, 0, - 110, 109, 235, 43, 110, 244, 37, 255, 0, 110, 7, 3, 1, 60, 110, 7, 3, 1, - 253, 204, 110, 7, 3, 1, 251, 202, 110, 7, 3, 1, 250, 46, 110, 7, 3, 1, - 73, 110, 7, 3, 1, 246, 74, 110, 7, 3, 1, 245, 67, 110, 7, 3, 1, 243, 225, - 110, 7, 3, 1, 72, 110, 7, 3, 1, 237, 126, 110, 7, 3, 1, 237, 17, 110, 7, - 3, 1, 153, 110, 7, 3, 1, 189, 110, 7, 3, 1, 207, 110, 7, 3, 1, 74, 110, - 7, 3, 1, 230, 59, 110, 7, 3, 1, 228, 163, 110, 7, 3, 1, 152, 110, 7, 3, - 1, 198, 110, 7, 3, 1, 222, 201, 110, 7, 3, 1, 68, 110, 7, 3, 1, 216, 216, - 110, 7, 3, 1, 219, 40, 110, 7, 3, 1, 218, 151, 110, 7, 3, 1, 218, 90, - 110, 7, 3, 1, 217, 157, 110, 42, 250, 79, 115, 110, 69, 235, 43, 110, 45, - 250, 79, 115, 110, 221, 179, 110, 42, 67, 229, 229, 110, 45, 67, 229, - 229, 93, 98, 245, 90, 223, 136, 93, 42, 250, 124, 115, 93, 45, 250, 124, - 115, 93, 98, 250, 168, 93, 52, 233, 193, 248, 145, 93, 52, 1, 218, 187, - 93, 52, 1, 3, 60, 93, 52, 1, 3, 72, 93, 52, 1, 3, 68, 93, 52, 1, 3, 73, - 93, 52, 1, 3, 74, 93, 52, 1, 3, 184, 93, 52, 1, 3, 217, 200, 93, 52, 1, - 3, 217, 231, 93, 52, 1, 3, 221, 0, 93, 236, 202, 228, 223, 224, 9, 78, - 93, 52, 1, 60, 93, 52, 1, 72, 93, 52, 1, 68, 93, 52, 1, 73, 93, 52, 1, - 74, 93, 52, 1, 175, 93, 52, 1, 236, 113, 93, 52, 1, 236, 7, 93, 52, 1, - 236, 184, 93, 52, 1, 236, 57, 93, 52, 1, 226, 177, 93, 52, 1, 224, 140, - 93, 52, 1, 223, 103, 93, 52, 1, 226, 94, 93, 52, 1, 224, 26, 93, 52, 1, - 222, 155, 93, 52, 1, 221, 205, 93, 52, 1, 221, 0, 93, 52, 1, 222, 87, 93, - 52, 1, 101, 93, 52, 1, 208, 93, 52, 1, 232, 62, 93, 52, 1, 231, 144, 93, - 52, 1, 232, 141, 93, 52, 1, 231, 204, 93, 52, 1, 155, 93, 52, 1, 243, - 112, 93, 52, 1, 242, 173, 93, 52, 1, 243, 162, 93, 52, 1, 243, 4, 93, 52, - 1, 196, 93, 52, 1, 233, 196, 93, 52, 1, 233, 99, 93, 52, 1, 234, 25, 93, - 52, 1, 233, 136, 93, 52, 1, 184, 93, 52, 1, 217, 200, 93, 52, 1, 217, - 231, 93, 52, 1, 203, 93, 52, 1, 227, 147, 93, 52, 1, 227, 22, 93, 52, 1, - 227, 216, 93, 52, 1, 227, 75, 93, 52, 1, 219, 7, 93, 52, 1, 207, 93, 52, - 219, 70, 224, 9, 78, 93, 52, 225, 72, 224, 9, 78, 93, 22, 245, 185, 93, - 22, 1, 236, 86, 93, 22, 1, 223, 211, 93, 22, 1, 236, 79, 93, 22, 1, 232, - 55, 93, 22, 1, 232, 53, 93, 22, 1, 232, 52, 93, 22, 1, 221, 192, 93, 22, - 1, 223, 200, 93, 22, 1, 227, 140, 93, 22, 1, 227, 135, 93, 22, 1, 227, - 132, 93, 22, 1, 227, 125, 93, 22, 1, 227, 120, 93, 22, 1, 227, 115, 93, - 22, 1, 227, 126, 93, 22, 1, 227, 138, 93, 22, 1, 233, 187, 93, 22, 1, - 229, 99, 93, 22, 1, 223, 208, 93, 22, 1, 229, 88, 93, 22, 1, 224, 104, - 93, 22, 1, 223, 205, 93, 22, 1, 238, 22, 93, 22, 1, 250, 230, 93, 22, 1, - 223, 215, 93, 22, 1, 251, 29, 93, 22, 1, 236, 128, 93, 22, 1, 222, 0, 93, - 22, 1, 229, 127, 93, 22, 1, 243, 106, 93, 22, 1, 60, 93, 22, 1, 254, 234, - 93, 22, 1, 184, 93, 22, 1, 218, 65, 93, 22, 1, 246, 168, 93, 22, 1, 73, - 93, 22, 1, 218, 16, 93, 22, 1, 218, 25, 93, 22, 1, 74, 93, 22, 1, 219, 7, - 93, 22, 1, 219, 4, 93, 22, 1, 230, 167, 93, 22, 1, 217, 231, 93, 22, 1, - 68, 93, 22, 1, 218, 219, 93, 22, 1, 218, 227, 93, 22, 1, 218, 204, 93, - 22, 1, 217, 200, 93, 22, 1, 246, 115, 93, 22, 1, 217, 250, 93, 22, 1, 72, - 110, 251, 86, 55, 110, 229, 11, 55, 110, 212, 55, 110, 234, 115, 110, - 252, 1, 135, 110, 218, 19, 55, 110, 218, 182, 55, 93, 245, 122, 170, 219, - 152, 93, 127, 65, 93, 220, 53, 65, 93, 90, 65, 93, 247, 130, 65, 93, 84, - 223, 227, 93, 67, 250, 221, 237, 180, 254, 112, 254, 128, 237, 180, 254, - 112, 225, 54, 237, 180, 254, 112, 222, 56, 230, 178, 227, 179, 251, 55, - 227, 179, 251, 55, 57, 49, 4, 253, 188, 60, 57, 49, 4, 253, 157, 73, 57, - 49, 4, 253, 166, 72, 57, 49, 4, 253, 134, 74, 57, 49, 4, 253, 184, 68, - 57, 49, 4, 253, 203, 249, 207, 57, 49, 4, 253, 150, 249, 92, 57, 49, 4, - 253, 190, 249, 15, 57, 49, 4, 253, 180, 248, 167, 57, 49, 4, 253, 144, - 247, 111, 57, 49, 4, 253, 138, 237, 123, 57, 49, 4, 253, 149, 237, 114, - 57, 49, 4, 253, 159, 237, 59, 57, 49, 4, 253, 130, 237, 43, 57, 49, 4, - 253, 118, 175, 57, 49, 4, 253, 151, 236, 184, 57, 49, 4, 253, 128, 236, - 113, 57, 49, 4, 253, 125, 236, 57, 57, 49, 4, 253, 114, 236, 7, 57, 49, - 4, 253, 115, 196, 57, 49, 4, 253, 181, 234, 25, 57, 49, 4, 253, 122, 233, - 196, 57, 49, 4, 253, 179, 233, 136, 57, 49, 4, 253, 171, 233, 99, 57, 49, - 4, 253, 192, 208, 57, 49, 4, 253, 170, 232, 141, 57, 49, 4, 253, 164, - 232, 62, 57, 49, 4, 253, 143, 231, 204, 57, 49, 4, 253, 140, 231, 144, - 57, 49, 4, 253, 199, 187, 57, 49, 4, 253, 123, 229, 198, 57, 49, 4, 253, - 156, 229, 108, 57, 49, 4, 253, 183, 229, 37, 57, 49, 4, 253, 145, 228, - 202, 57, 49, 4, 253, 178, 228, 155, 57, 49, 4, 253, 117, 228, 136, 57, - 49, 4, 253, 173, 228, 121, 57, 49, 4, 253, 162, 228, 110, 57, 49, 4, 253, - 135, 203, 57, 49, 4, 253, 167, 227, 216, 57, 49, 4, 253, 142, 227, 147, - 57, 49, 4, 253, 201, 227, 75, 57, 49, 4, 253, 168, 227, 22, 57, 49, 4, - 253, 163, 226, 177, 57, 49, 4, 253, 186, 226, 94, 57, 49, 4, 253, 154, - 224, 140, 57, 49, 4, 253, 182, 224, 26, 57, 49, 4, 253, 137, 223, 103, - 57, 49, 4, 253, 136, 222, 155, 57, 49, 4, 253, 197, 222, 87, 57, 49, 4, - 253, 158, 221, 205, 57, 49, 4, 253, 195, 101, 57, 49, 4, 253, 126, 221, - 0, 57, 49, 4, 253, 141, 219, 7, 57, 49, 4, 253, 120, 218, 227, 57, 49, 4, - 253, 155, 218, 204, 57, 49, 4, 253, 153, 218, 187, 57, 49, 4, 253, 177, - 217, 114, 57, 49, 4, 253, 121, 217, 92, 57, 49, 4, 253, 174, 217, 21, 57, - 49, 4, 253, 169, 255, 60, 57, 49, 4, 253, 152, 255, 59, 57, 49, 4, 253, - 111, 253, 232, 57, 49, 4, 253, 124, 247, 82, 57, 49, 4, 253, 107, 247, - 81, 57, 49, 4, 253, 147, 231, 85, 57, 49, 4, 253, 165, 228, 201, 57, 49, - 4, 253, 133, 228, 204, 57, 49, 4, 253, 119, 228, 2, 57, 49, 4, 253, 161, - 228, 1, 57, 49, 4, 253, 127, 227, 74, 57, 49, 4, 253, 129, 222, 153, 57, - 49, 4, 253, 109, 220, 223, 57, 49, 4, 253, 106, 103, 57, 49, 16, 253, - 176, 57, 49, 16, 253, 175, 57, 49, 16, 253, 172, 57, 49, 16, 253, 160, - 57, 49, 16, 253, 148, 57, 49, 16, 253, 146, 57, 49, 16, 253, 139, 57, 49, - 16, 253, 132, 57, 49, 16, 253, 131, 57, 49, 16, 253, 116, 57, 49, 16, - 253, 113, 57, 49, 16, 253, 112, 57, 49, 16, 253, 110, 57, 49, 16, 253, - 108, 57, 49, 97, 253, 105, 234, 86, 57, 49, 97, 253, 104, 218, 183, 57, - 49, 97, 253, 103, 249, 80, 57, 49, 97, 253, 102, 246, 151, 57, 49, 97, - 253, 101, 234, 68, 57, 49, 97, 253, 100, 223, 162, 57, 49, 97, 253, 99, - 246, 100, 57, 49, 97, 253, 98, 227, 239, 57, 49, 97, 253, 97, 224, 245, - 57, 49, 97, 253, 96, 243, 161, 57, 49, 97, 253, 95, 224, 4, 57, 49, 97, - 253, 94, 252, 39, 57, 49, 97, 253, 93, 250, 110, 57, 49, 97, 253, 92, - 251, 243, 57, 49, 97, 253, 91, 218, 212, 57, 49, 97, 253, 90, 252, 198, - 57, 49, 97, 253, 89, 230, 147, 57, 49, 97, 253, 88, 223, 244, 57, 49, 97, - 253, 87, 250, 54, 57, 49, 233, 125, 253, 86, 236, 223, 57, 49, 233, 125, - 253, 85, 236, 231, 57, 49, 97, 253, 84, 230, 157, 57, 49, 97, 253, 83, - 218, 192, 57, 49, 97, 253, 82, 57, 49, 233, 125, 253, 81, 254, 44, 57, - 49, 233, 125, 253, 80, 233, 247, 57, 49, 97, 253, 79, 252, 0, 57, 49, 97, - 253, 78, 244, 62, 57, 49, 97, 253, 77, 57, 49, 97, 253, 76, 218, 177, 57, - 49, 97, 253, 75, 57, 49, 97, 253, 74, 57, 49, 97, 253, 73, 242, 189, 57, - 49, 97, 253, 72, 57, 49, 97, 253, 71, 57, 49, 97, 253, 70, 57, 49, 233, - 125, 253, 68, 220, 235, 57, 49, 97, 253, 67, 57, 49, 97, 253, 66, 57, 49, - 97, 253, 65, 250, 192, 57, 49, 97, 253, 64, 57, 49, 97, 253, 63, 57, 49, - 97, 253, 62, 244, 218, 57, 49, 97, 253, 61, 254, 31, 57, 49, 97, 253, 60, - 57, 49, 97, 253, 59, 57, 49, 97, 253, 58, 57, 49, 97, 253, 57, 57, 49, - 97, 253, 56, 57, 49, 97, 253, 55, 57, 49, 97, 253, 54, 57, 49, 97, 253, - 53, 57, 49, 97, 253, 52, 57, 49, 97, 253, 51, 233, 120, 57, 49, 97, 253, - 50, 57, 49, 97, 253, 49, 221, 98, 57, 49, 97, 253, 48, 57, 49, 97, 253, - 47, 57, 49, 97, 253, 46, 57, 49, 97, 253, 45, 57, 49, 97, 253, 44, 57, - 49, 97, 253, 43, 57, 49, 97, 253, 42, 57, 49, 97, 253, 41, 57, 49, 97, - 253, 40, 57, 49, 97, 253, 39, 57, 49, 97, 253, 38, 57, 49, 97, 253, 37, - 243, 140, 57, 49, 97, 253, 16, 245, 131, 57, 49, 97, 253, 13, 252, 182, - 57, 49, 97, 253, 8, 223, 249, 57, 49, 97, 253, 7, 65, 57, 49, 97, 253, 6, - 57, 49, 97, 253, 5, 223, 25, 57, 49, 97, 253, 4, 57, 49, 97, 253, 3, 57, - 49, 97, 253, 2, 218, 208, 251, 52, 57, 49, 97, 253, 1, 251, 52, 57, 49, - 97, 253, 0, 251, 53, 245, 105, 57, 49, 97, 252, 255, 218, 210, 57, 49, - 97, 252, 254, 57, 49, 97, 252, 253, 57, 49, 233, 125, 252, 252, 248, 211, - 57, 49, 97, 252, 251, 57, 49, 97, 252, 250, 57, 49, 97, 252, 248, 57, 49, - 97, 252, 247, 57, 49, 97, 252, 246, 57, 49, 97, 252, 245, 249, 149, 57, - 49, 97, 252, 244, 57, 49, 97, 252, 243, 57, 49, 97, 252, 242, 57, 49, 97, - 252, 241, 57, 49, 97, 252, 240, 57, 49, 97, 219, 99, 253, 69, 57, 49, 97, - 219, 99, 253, 36, 57, 49, 97, 219, 99, 253, 35, 57, 49, 97, 219, 99, 253, - 34, 57, 49, 97, 219, 99, 253, 33, 57, 49, 97, 219, 99, 253, 32, 57, 49, - 97, 219, 99, 253, 31, 57, 49, 97, 219, 99, 253, 30, 57, 49, 97, 219, 99, - 253, 29, 57, 49, 97, 219, 99, 253, 28, 57, 49, 97, 219, 99, 253, 27, 57, - 49, 97, 219, 99, 253, 26, 57, 49, 97, 219, 99, 253, 25, 57, 49, 97, 219, - 99, 253, 24, 57, 49, 97, 219, 99, 253, 23, 57, 49, 97, 219, 99, 253, 22, - 57, 49, 97, 219, 99, 253, 21, 57, 49, 97, 219, 99, 253, 20, 57, 49, 97, - 219, 99, 253, 19, 57, 49, 97, 219, 99, 253, 18, 57, 49, 97, 219, 99, 253, - 17, 57, 49, 97, 219, 99, 253, 15, 57, 49, 97, 219, 99, 253, 14, 57, 49, - 97, 219, 99, 253, 12, 57, 49, 97, 219, 99, 253, 11, 57, 49, 97, 219, 99, - 253, 10, 57, 49, 97, 219, 99, 253, 9, 57, 49, 97, 219, 99, 252, 249, 57, - 49, 97, 219, 99, 252, 239, 254, 227, 218, 174, 225, 55, 235, 43, 254, - 227, 218, 174, 225, 55, 248, 145, 254, 227, 251, 45, 78, 254, 227, 54, - 107, 254, 227, 54, 103, 254, 227, 54, 160, 254, 227, 54, 154, 254, 227, - 54, 174, 254, 227, 54, 182, 254, 227, 54, 191, 254, 227, 54, 185, 254, - 227, 54, 190, 254, 227, 54, 222, 65, 254, 227, 54, 220, 219, 254, 227, - 54, 221, 245, 254, 227, 54, 245, 119, 254, 227, 54, 245, 196, 254, 227, - 54, 224, 69, 254, 227, 54, 225, 38, 254, 227, 54, 246, 227, 254, 227, 54, - 232, 27, 254, 227, 54, 131, 242, 161, 254, 227, 54, 124, 242, 161, 254, - 227, 54, 148, 242, 161, 254, 227, 54, 245, 116, 242, 161, 254, 227, 54, - 245, 170, 242, 161, 254, 227, 54, 224, 82, 242, 161, 254, 227, 54, 225, - 43, 242, 161, 254, 227, 54, 246, 235, 242, 161, 254, 227, 54, 232, 31, - 242, 161, 254, 227, 54, 131, 221, 231, 254, 227, 54, 124, 221, 231, 254, - 227, 54, 148, 221, 231, 254, 227, 54, 245, 116, 221, 231, 254, 227, 54, - 245, 170, 221, 231, 254, 227, 54, 224, 82, 221, 231, 254, 227, 54, 225, - 43, 221, 231, 254, 227, 54, 246, 235, 221, 231, 254, 227, 54, 232, 31, - 221, 231, 254, 227, 54, 222, 66, 221, 231, 254, 227, 54, 220, 220, 221, - 231, 254, 227, 54, 221, 246, 221, 231, 254, 227, 54, 245, 120, 221, 231, - 254, 227, 54, 245, 197, 221, 231, 254, 227, 54, 224, 70, 221, 231, 254, - 227, 54, 225, 39, 221, 231, 254, 227, 54, 246, 228, 221, 231, 254, 227, - 54, 232, 28, 221, 231, 254, 227, 218, 222, 252, 190, 220, 72, 254, 227, - 218, 222, 245, 178, 223, 88, 254, 227, 218, 222, 226, 90, 223, 88, 254, - 227, 218, 222, 221, 252, 223, 88, 254, 227, 218, 222, 245, 110, 223, 88, - 254, 227, 247, 114, 234, 24, 245, 178, 223, 88, 254, 227, 235, 31, 234, - 24, 245, 178, 223, 88, 254, 227, 234, 24, 226, 90, 223, 88, 254, 227, - 234, 24, 221, 252, 223, 88, 23, 254, 251, 253, 234, 131, 228, 89, 23, - 254, 251, 253, 234, 131, 243, 194, 23, 254, 251, 253, 234, 131, 247, 126, - 23, 254, 251, 253, 234, 174, 23, 254, 251, 253, 234, 245, 196, 23, 254, - 251, 253, 234, 245, 170, 242, 161, 23, 254, 251, 253, 234, 245, 170, 221, - 231, 23, 254, 251, 253, 234, 245, 197, 221, 231, 23, 254, 251, 253, 234, - 245, 170, 222, 126, 23, 254, 251, 253, 234, 222, 66, 222, 126, 23, 254, - 251, 253, 234, 245, 197, 222, 126, 23, 254, 251, 253, 234, 131, 242, 162, - 222, 126, 23, 254, 251, 253, 234, 245, 170, 242, 162, 222, 126, 23, 254, - 251, 253, 234, 131, 221, 232, 222, 126, 23, 254, 251, 253, 234, 245, 170, - 221, 232, 222, 126, 23, 254, 251, 253, 234, 245, 170, 223, 153, 23, 254, - 251, 253, 234, 222, 66, 223, 153, 23, 254, 251, 253, 234, 245, 197, 223, - 153, 23, 254, 251, 253, 234, 131, 242, 162, 223, 153, 23, 254, 251, 253, - 234, 245, 170, 242, 162, 223, 153, 23, 254, 251, 253, 234, 131, 221, 232, - 223, 153, 23, 254, 251, 253, 234, 222, 66, 221, 232, 223, 153, 23, 254, - 251, 253, 234, 245, 197, 221, 232, 223, 153, 23, 254, 251, 253, 234, 222, - 66, 233, 139, 23, 254, 251, 243, 134, 131, 229, 49, 23, 254, 251, 222, 8, - 107, 23, 254, 251, 243, 132, 107, 23, 254, 251, 246, 159, 103, 23, 254, - 251, 222, 8, 103, 23, 254, 251, 250, 51, 124, 247, 125, 23, 254, 251, - 246, 159, 124, 247, 125, 23, 254, 251, 221, 71, 174, 23, 254, 251, 221, - 71, 222, 65, 23, 254, 251, 221, 71, 222, 66, 254, 144, 17, 23, 254, 251, - 243, 132, 222, 65, 23, 254, 251, 233, 240, 222, 65, 23, 254, 251, 222, 8, - 222, 65, 23, 254, 251, 222, 8, 221, 245, 23, 254, 251, 221, 71, 245, 196, - 23, 254, 251, 221, 71, 245, 197, 254, 144, 17, 23, 254, 251, 243, 132, - 245, 196, 23, 254, 251, 222, 8, 245, 196, 23, 254, 251, 222, 8, 131, 242, - 161, 23, 254, 251, 222, 8, 148, 242, 161, 23, 254, 251, 246, 159, 245, - 170, 242, 161, 23, 254, 251, 221, 71, 245, 170, 242, 161, 23, 254, 251, - 222, 8, 245, 170, 242, 161, 23, 254, 251, 251, 126, 245, 170, 242, 161, - 23, 254, 251, 232, 200, 245, 170, 242, 161, 23, 254, 251, 222, 8, 131, - 221, 231, 23, 254, 251, 222, 8, 245, 170, 221, 231, 23, 254, 251, 249, - 65, 245, 170, 233, 139, 23, 254, 251, 223, 127, 245, 197, 233, 139, 23, - 131, 144, 55, 23, 131, 144, 5, 254, 144, 17, 23, 124, 221, 250, 55, 23, - 148, 228, 88, 55, 23, 218, 23, 55, 23, 222, 127, 55, 23, 247, 127, 55, - 23, 230, 175, 55, 23, 124, 230, 174, 55, 23, 148, 230, 174, 55, 23, 245, - 116, 230, 174, 55, 23, 245, 170, 230, 174, 55, 23, 233, 235, 55, 23, 235, - 210, 252, 190, 55, 23, 235, 26, 55, 23, 230, 84, 55, 23, 218, 132, 55, - 23, 254, 16, 55, 23, 254, 27, 55, 23, 244, 42, 55, 23, 221, 58, 252, 190, - 55, 23, 217, 85, 55, 227, 68, 225, 35, 55, 227, 68, 220, 83, 55, 227, 68, - 225, 59, 55, 227, 68, 225, 33, 55, 227, 68, 248, 226, 225, 33, 55, 227, - 68, 224, 120, 55, 227, 68, 249, 61, 55, 227, 68, 228, 76, 55, 227, 68, - 225, 47, 55, 227, 68, 247, 93, 55, 227, 68, 254, 14, 55, 227, 68, 251, - 81, 55, 229, 137, 248, 205, 5, 229, 192, 229, 137, 248, 205, 5, 229, 44, - 243, 159, 229, 137, 248, 205, 5, 222, 109, 243, 159, 229, 137, 248, 205, - 5, 251, 139, 229, 137, 248, 205, 5, 251, 24, 229, 137, 248, 205, 5, 218, - 183, 229, 137, 248, 205, 5, 243, 140, 229, 137, 248, 205, 5, 244, 210, - 229, 137, 248, 205, 5, 221, 204, 229, 137, 248, 205, 5, 65, 229, 137, - 248, 205, 5, 252, 24, 229, 137, 248, 205, 5, 224, 218, 229, 137, 248, - 205, 5, 250, 187, 229, 137, 248, 205, 5, 234, 85, 229, 137, 248, 205, 5, - 234, 48, 229, 137, 248, 205, 5, 226, 122, 229, 137, 248, 205, 5, 235, 64, - 229, 137, 248, 205, 5, 252, 33, 229, 137, 248, 205, 5, 251, 129, 229, 51, - 229, 137, 248, 205, 5, 248, 156, 229, 137, 248, 205, 5, 250, 172, 229, - 137, 248, 205, 5, 224, 50, 229, 137, 248, 205, 5, 250, 173, 229, 137, - 248, 205, 5, 252, 134, 229, 137, 248, 205, 5, 224, 206, 229, 137, 248, - 205, 5, 242, 189, 229, 137, 248, 205, 5, 243, 111, 229, 137, 248, 205, 5, - 251, 240, 235, 106, 229, 137, 248, 205, 5, 251, 124, 229, 137, 248, 205, - 5, 227, 239, 229, 137, 248, 205, 5, 247, 13, 229, 137, 248, 205, 5, 247, - 133, 229, 137, 248, 205, 5, 220, 247, 229, 137, 248, 205, 5, 252, 137, - 229, 137, 248, 205, 5, 229, 52, 221, 98, 229, 137, 248, 205, 5, 219, 84, - 229, 137, 248, 205, 5, 229, 244, 229, 137, 248, 205, 5, 227, 62, 229, - 137, 248, 205, 5, 235, 52, 229, 137, 248, 205, 5, 230, 69, 252, 233, 229, - 137, 248, 205, 5, 245, 143, 229, 137, 248, 205, 5, 244, 38, 229, 137, - 248, 205, 5, 223, 128, 229, 137, 248, 205, 5, 3, 253, 213, 229, 137, 248, - 205, 5, 218, 235, 252, 206, 229, 137, 248, 205, 5, 36, 230, 177, 92, 234, - 197, 1, 60, 234, 197, 1, 73, 234, 197, 1, 253, 204, 234, 197, 1, 252, 95, - 234, 197, 1, 245, 67, 234, 197, 1, 250, 46, 234, 197, 1, 72, 234, 197, 1, - 219, 40, 234, 197, 1, 217, 157, 234, 197, 1, 222, 37, 234, 197, 1, 237, - 126, 234, 197, 1, 237, 17, 234, 197, 1, 228, 163, 234, 197, 1, 153, 234, - 197, 1, 189, 234, 197, 1, 207, 234, 197, 1, 233, 140, 234, 197, 1, 231, - 218, 234, 197, 1, 68, 234, 197, 1, 230, 59, 234, 197, 1, 236, 75, 234, - 197, 1, 152, 234, 197, 1, 198, 234, 197, 1, 222, 201, 234, 197, 1, 221, - 32, 234, 197, 1, 254, 131, 234, 197, 1, 246, 197, 234, 197, 1, 243, 225, - 234, 197, 1, 218, 151, 251, 133, 1, 60, 251, 133, 1, 230, 45, 251, 133, - 1, 250, 46, 251, 133, 1, 153, 251, 133, 1, 220, 21, 251, 133, 1, 152, - 251, 133, 1, 235, 126, 251, 133, 1, 255, 60, 251, 133, 1, 228, 163, 251, - 133, 1, 253, 204, 251, 133, 1, 189, 251, 133, 1, 74, 251, 133, 1, 249, - 209, 251, 133, 1, 222, 201, 251, 133, 1, 225, 27, 251, 133, 1, 225, 26, - 251, 133, 1, 198, 251, 133, 1, 251, 201, 251, 133, 1, 68, 251, 133, 1, - 231, 218, 251, 133, 1, 218, 151, 251, 133, 1, 207, 251, 133, 1, 221, 31, - 251, 133, 1, 230, 59, 251, 133, 1, 223, 219, 251, 133, 1, 72, 251, 133, - 1, 73, 251, 133, 1, 220, 18, 251, 133, 1, 237, 17, 251, 133, 1, 237, 8, - 251, 133, 1, 232, 170, 251, 133, 1, 220, 23, 251, 133, 1, 245, 67, 251, - 133, 1, 245, 2, 251, 133, 1, 223, 168, 251, 133, 1, 223, 167, 251, 133, - 1, 232, 117, 251, 133, 1, 237, 255, 251, 133, 1, 251, 200, 251, 133, 1, - 221, 32, 251, 133, 1, 220, 20, 251, 133, 1, 227, 53, 251, 133, 1, 234, - 41, 251, 133, 1, 234, 40, 251, 133, 1, 234, 39, 251, 133, 1, 234, 38, - 251, 133, 1, 235, 125, 251, 133, 1, 247, 17, 251, 133, 1, 220, 19, 48, - 30, 1, 60, 48, 30, 1, 252, 144, 48, 30, 1, 236, 184, 48, 30, 1, 249, 92, - 48, 30, 1, 73, 48, 30, 1, 219, 165, 48, 30, 1, 217, 92, 48, 30, 1, 243, - 162, 48, 30, 1, 222, 22, 48, 30, 1, 72, 48, 30, 1, 175, 48, 30, 1, 246, - 217, 48, 30, 1, 246, 205, 48, 30, 1, 246, 197, 48, 30, 1, 246, 133, 48, - 30, 1, 74, 48, 30, 1, 229, 198, 48, 30, 1, 224, 246, 48, 30, 1, 236, 7, - 48, 30, 1, 246, 148, 48, 30, 1, 246, 138, 48, 30, 1, 222, 87, 48, 30, 1, - 68, 48, 30, 1, 246, 220, 48, 30, 1, 229, 132, 48, 30, 1, 236, 137, 48, - 30, 1, 246, 244, 48, 30, 1, 246, 140, 48, 30, 1, 251, 46, 48, 30, 1, 237, - 255, 48, 30, 1, 220, 23, 48, 30, 231, 107, 107, 48, 30, 231, 107, 174, - 48, 30, 231, 107, 222, 65, 48, 30, 231, 107, 245, 196, 244, 50, 1, 254, - 199, 244, 50, 1, 252, 219, 244, 50, 1, 244, 100, 244, 50, 1, 249, 191, - 244, 50, 1, 254, 195, 244, 50, 1, 228, 146, 244, 50, 1, 237, 136, 244, - 50, 1, 243, 204, 244, 50, 1, 221, 241, 244, 50, 1, 246, 226, 244, 50, 1, - 235, 241, 244, 50, 1, 235, 170, 244, 50, 1, 234, 82, 244, 50, 1, 232, - 202, 244, 50, 1, 237, 108, 244, 50, 1, 220, 37, 244, 50, 1, 230, 31, 244, - 50, 1, 232, 27, 244, 50, 1, 227, 245, 244, 50, 1, 226, 123, 244, 50, 1, - 222, 74, 244, 50, 1, 218, 191, 244, 50, 1, 245, 249, 244, 50, 1, 238, 3, - 244, 50, 1, 242, 152, 244, 50, 1, 230, 91, 244, 50, 1, 232, 31, 242, 161, - 220, 106, 1, 254, 150, 220, 106, 1, 252, 102, 220, 106, 1, 244, 232, 220, - 106, 1, 236, 149, 220, 106, 1, 249, 62, 220, 106, 1, 243, 4, 220, 106, 1, - 218, 187, 220, 106, 1, 217, 83, 220, 106, 1, 242, 185, 220, 106, 1, 222, - 50, 220, 106, 1, 217, 220, 220, 106, 1, 236, 246, 220, 106, 1, 224, 209, - 220, 106, 1, 235, 156, 220, 106, 1, 234, 1, 220, 106, 1, 249, 33, 220, - 106, 1, 231, 103, 220, 106, 1, 217, 13, 220, 106, 1, 226, 144, 220, 106, - 1, 254, 191, 220, 106, 1, 228, 202, 220, 106, 1, 226, 169, 220, 106, 1, - 228, 103, 220, 106, 1, 227, 231, 220, 106, 1, 222, 26, 220, 106, 1, 244, - 122, 220, 106, 1, 101, 220, 106, 1, 72, 220, 106, 1, 68, 220, 106, 1, - 223, 178, 220, 106, 218, 174, 248, 191, 48, 229, 159, 5, 60, 48, 229, - 159, 5, 72, 48, 229, 159, 5, 68, 48, 229, 159, 5, 175, 48, 229, 159, 5, - 236, 7, 48, 229, 159, 5, 245, 0, 48, 229, 159, 5, 244, 17, 48, 229, 159, - 5, 218, 138, 48, 229, 159, 5, 251, 169, 48, 229, 159, 5, 237, 123, 48, - 229, 159, 5, 237, 98, 48, 229, 159, 5, 222, 155, 48, 229, 159, 5, 221, 0, - 48, 229, 159, 5, 249, 207, 48, 229, 159, 5, 249, 15, 48, 229, 159, 5, - 247, 111, 48, 229, 159, 5, 222, 35, 48, 229, 159, 5, 187, 48, 229, 159, - 5, 252, 237, 48, 229, 159, 5, 246, 8, 48, 229, 159, 5, 208, 48, 229, 159, - 5, 231, 144, 48, 229, 159, 5, 196, 48, 229, 159, 5, 233, 196, 48, 229, - 159, 5, 233, 99, 48, 229, 159, 5, 184, 48, 229, 159, 5, 219, 189, 48, - 229, 159, 5, 219, 94, 48, 229, 159, 5, 203, 48, 229, 159, 5, 227, 22, 48, - 229, 159, 5, 235, 188, 48, 229, 159, 5, 226, 177, 48, 229, 159, 5, 217, - 114, 48, 229, 159, 5, 225, 25, 48, 229, 159, 5, 223, 218, 48, 229, 159, - 5, 155, 48, 229, 159, 5, 253, 227, 48, 229, 159, 5, 253, 226, 48, 229, - 159, 5, 253, 225, 48, 229, 159, 5, 218, 115, 48, 229, 159, 5, 249, 188, - 48, 229, 159, 5, 249, 187, 48, 229, 159, 5, 252, 224, 48, 229, 159, 5, - 251, 220, 48, 229, 159, 218, 174, 248, 191, 48, 229, 159, 54, 107, 48, - 229, 159, 54, 103, 48, 229, 159, 54, 222, 65, 48, 229, 159, 54, 220, 219, - 48, 229, 159, 54, 242, 161, 161, 6, 1, 171, 72, 161, 6, 1, 171, 73, 161, - 6, 1, 171, 60, 161, 6, 1, 171, 254, 202, 161, 6, 1, 171, 74, 161, 6, 1, - 171, 230, 127, 161, 6, 1, 224, 192, 72, 161, 6, 1, 224, 192, 73, 161, 6, - 1, 224, 192, 60, 161, 6, 1, 224, 192, 254, 202, 161, 6, 1, 224, 192, 74, - 161, 6, 1, 224, 192, 230, 127, 161, 6, 1, 253, 212, 161, 6, 1, 230, 70, - 161, 6, 1, 218, 165, 161, 6, 1, 218, 22, 161, 6, 1, 243, 225, 161, 6, 1, - 229, 191, 161, 6, 1, 252, 137, 161, 6, 1, 222, 80, 161, 6, 1, 249, 82, - 161, 6, 1, 251, 43, 161, 6, 1, 237, 113, 161, 6, 1, 236, 191, 161, 6, 1, - 244, 208, 161, 6, 1, 246, 244, 161, 6, 1, 219, 160, 161, 6, 1, 246, 118, - 161, 6, 1, 222, 21, 161, 6, 1, 246, 138, 161, 6, 1, 217, 90, 161, 6, 1, - 246, 133, 161, 6, 1, 217, 71, 161, 6, 1, 246, 148, 161, 6, 1, 246, 217, - 161, 6, 1, 246, 205, 161, 6, 1, 246, 197, 161, 6, 1, 246, 185, 161, 6, 1, - 230, 158, 161, 6, 1, 246, 101, 161, 3, 1, 171, 72, 161, 3, 1, 171, 73, - 161, 3, 1, 171, 60, 161, 3, 1, 171, 254, 202, 161, 3, 1, 171, 74, 161, 3, - 1, 171, 230, 127, 161, 3, 1, 224, 192, 72, 161, 3, 1, 224, 192, 73, 161, - 3, 1, 224, 192, 60, 161, 3, 1, 224, 192, 254, 202, 161, 3, 1, 224, 192, - 74, 161, 3, 1, 224, 192, 230, 127, 161, 3, 1, 253, 212, 161, 3, 1, 230, - 70, 161, 3, 1, 218, 165, 161, 3, 1, 218, 22, 161, 3, 1, 243, 225, 161, 3, - 1, 229, 191, 161, 3, 1, 252, 137, 161, 3, 1, 222, 80, 161, 3, 1, 249, 82, - 161, 3, 1, 251, 43, 161, 3, 1, 237, 113, 161, 3, 1, 236, 191, 161, 3, 1, - 244, 208, 161, 3, 1, 246, 244, 161, 3, 1, 219, 160, 161, 3, 1, 246, 118, - 161, 3, 1, 222, 21, 161, 3, 1, 246, 138, 161, 3, 1, 217, 90, 161, 3, 1, - 246, 133, 161, 3, 1, 217, 71, 161, 3, 1, 246, 148, 161, 3, 1, 246, 217, - 161, 3, 1, 246, 205, 161, 3, 1, 246, 197, 161, 3, 1, 246, 185, 161, 3, 1, - 230, 158, 161, 3, 1, 246, 101, 224, 252, 1, 229, 190, 224, 252, 1, 221, - 113, 224, 252, 1, 236, 112, 224, 252, 1, 245, 226, 224, 252, 1, 221, 255, - 224, 252, 1, 224, 26, 224, 252, 1, 223, 50, 224, 252, 1, 250, 245, 224, - 252, 1, 218, 24, 224, 252, 1, 242, 160, 224, 252, 1, 252, 83, 224, 252, - 1, 249, 91, 224, 252, 1, 244, 242, 224, 252, 1, 219, 60, 224, 252, 1, - 222, 3, 224, 252, 1, 217, 19, 224, 252, 1, 234, 23, 224, 252, 1, 237, 41, - 224, 252, 1, 218, 185, 224, 252, 1, 243, 213, 224, 252, 1, 235, 3, 224, - 252, 1, 233, 160, 224, 252, 1, 238, 6, 224, 252, 1, 246, 243, 224, 252, - 1, 254, 7, 224, 252, 1, 254, 237, 224, 252, 1, 230, 138, 224, 252, 1, - 218, 177, 224, 252, 1, 230, 83, 224, 252, 1, 254, 202, 224, 252, 1, 227, - 72, 224, 252, 1, 231, 103, 224, 252, 1, 247, 2, 224, 252, 1, 254, 207, - 224, 252, 1, 242, 65, 224, 252, 1, 220, 63, 224, 252, 1, 230, 183, 224, - 252, 1, 230, 121, 224, 252, 1, 230, 157, 224, 252, 1, 253, 215, 224, 252, - 1, 254, 45, 224, 252, 1, 230, 105, 224, 252, 1, 254, 188, 224, 252, 1, - 246, 142, 224, 252, 1, 254, 24, 224, 252, 1, 247, 11, 224, 252, 1, 242, - 71, 224, 252, 1, 217, 255, 230, 93, 1, 254, 168, 230, 93, 1, 252, 237, - 230, 93, 1, 222, 155, 230, 93, 1, 237, 123, 230, 93, 1, 218, 138, 230, - 93, 1, 236, 149, 230, 93, 1, 249, 81, 230, 93, 1, 203, 230, 93, 1, 226, - 177, 230, 93, 1, 224, 215, 230, 93, 1, 249, 36, 230, 93, 1, 251, 116, - 230, 93, 1, 245, 0, 230, 93, 1, 246, 8, 230, 93, 1, 228, 153, 230, 93, 1, - 237, 4, 230, 93, 1, 235, 184, 230, 93, 1, 233, 170, 230, 93, 1, 231, 89, - 230, 93, 1, 218, 233, 230, 93, 1, 155, 230, 93, 1, 184, 230, 93, 1, 60, - 230, 93, 1, 73, 230, 93, 1, 72, 230, 93, 1, 74, 230, 93, 1, 68, 230, 93, - 1, 255, 58, 230, 93, 1, 246, 250, 230, 93, 1, 230, 127, 230, 93, 20, 217, - 84, 230, 93, 20, 107, 230, 93, 20, 103, 230, 93, 20, 160, 230, 93, 20, - 154, 230, 93, 20, 174, 230, 93, 20, 182, 230, 93, 20, 191, 230, 93, 20, - 185, 230, 93, 20, 190, 250, 53, 4, 60, 250, 53, 4, 73, 250, 53, 4, 72, - 250, 53, 4, 74, 250, 53, 4, 68, 250, 53, 4, 237, 123, 250, 53, 4, 237, - 59, 250, 53, 4, 175, 250, 53, 4, 236, 184, 250, 53, 4, 236, 113, 250, 53, - 4, 236, 57, 250, 53, 4, 236, 7, 250, 53, 4, 235, 188, 250, 53, 4, 235, - 122, 250, 53, 4, 235, 67, 250, 53, 4, 235, 12, 250, 53, 4, 234, 231, 250, - 53, 4, 196, 250, 53, 4, 234, 25, 250, 53, 4, 233, 196, 250, 53, 4, 233, - 136, 250, 53, 4, 233, 99, 250, 53, 4, 208, 250, 53, 4, 232, 141, 250, 53, - 4, 232, 62, 250, 53, 4, 231, 204, 250, 53, 4, 231, 144, 250, 53, 4, 187, - 250, 53, 4, 229, 198, 250, 53, 4, 229, 108, 250, 53, 4, 229, 37, 250, 53, - 4, 228, 202, 250, 53, 4, 203, 250, 53, 4, 227, 216, 250, 53, 4, 227, 147, - 250, 53, 4, 227, 75, 250, 53, 4, 227, 22, 250, 53, 4, 226, 177, 250, 53, - 4, 226, 94, 250, 53, 4, 224, 140, 250, 53, 4, 224, 26, 250, 53, 4, 223, - 103, 250, 53, 4, 222, 155, 250, 53, 4, 222, 87, 250, 53, 4, 221, 205, - 250, 53, 4, 101, 250, 53, 4, 221, 0, 250, 53, 4, 219, 7, 250, 53, 4, 218, - 227, 250, 53, 4, 218, 204, 250, 53, 4, 218, 187, 250, 53, 4, 218, 138, - 250, 53, 4, 218, 135, 250, 53, 4, 217, 114, 250, 53, 4, 217, 21, 237, - 225, 254, 53, 1, 254, 166, 237, 225, 254, 53, 1, 252, 101, 237, 225, 254, - 53, 1, 244, 91, 237, 225, 254, 53, 1, 249, 176, 237, 225, 254, 53, 1, - 243, 162, 237, 225, 254, 53, 1, 218, 233, 237, 225, 254, 53, 1, 217, 95, - 237, 225, 254, 53, 1, 243, 126, 237, 225, 254, 53, 1, 222, 46, 237, 225, - 254, 53, 1, 217, 219, 237, 225, 254, 53, 1, 236, 224, 237, 225, 254, 53, - 1, 235, 151, 237, 225, 254, 53, 1, 234, 1, 237, 225, 254, 53, 1, 231, - 103, 237, 225, 254, 53, 1, 226, 145, 237, 225, 254, 53, 1, 253, 207, 237, - 225, 254, 53, 1, 229, 198, 237, 225, 254, 53, 1, 226, 168, 237, 225, 254, - 53, 1, 228, 102, 237, 225, 254, 53, 1, 227, 174, 237, 225, 254, 53, 1, - 224, 209, 237, 225, 254, 53, 1, 222, 100, 237, 225, 254, 53, 226, 87, 55, - 237, 225, 254, 53, 54, 107, 237, 225, 254, 53, 54, 103, 237, 225, 254, - 53, 54, 160, 237, 225, 254, 53, 54, 222, 65, 237, 225, 254, 53, 54, 220, - 219, 237, 225, 254, 53, 54, 131, 242, 161, 237, 225, 254, 53, 54, 131, - 221, 231, 237, 225, 254, 53, 54, 222, 66, 221, 231, 229, 116, 1, 254, - 164, 229, 116, 1, 252, 104, 229, 116, 1, 244, 233, 229, 116, 1, 249, 64, - 229, 116, 1, 243, 162, 229, 116, 1, 218, 238, 229, 116, 1, 217, 108, 229, - 116, 1, 243, 128, 229, 116, 1, 222, 50, 229, 116, 1, 217, 220, 229, 116, - 1, 236, 246, 229, 116, 1, 235, 157, 229, 116, 1, 234, 1, 229, 116, 1, - 231, 103, 229, 116, 1, 225, 61, 229, 116, 1, 254, 191, 229, 116, 1, 229, - 198, 229, 116, 1, 226, 169, 229, 116, 1, 228, 107, 229, 116, 1, 227, 61, - 229, 116, 1, 224, 209, 229, 116, 1, 222, 105, 229, 116, 54, 107, 229, - 116, 54, 222, 65, 229, 116, 54, 220, 219, 229, 116, 54, 131, 242, 161, - 229, 116, 54, 103, 229, 116, 54, 160, 229, 116, 218, 174, 225, 54, 234, - 196, 1, 60, 234, 196, 1, 253, 204, 234, 196, 1, 245, 67, 234, 196, 1, - 250, 46, 234, 196, 1, 73, 234, 196, 1, 216, 216, 234, 196, 1, 72, 234, - 196, 1, 218, 90, 234, 196, 1, 237, 17, 234, 196, 1, 153, 234, 196, 1, - 189, 234, 196, 1, 207, 234, 196, 1, 74, 234, 196, 1, 152, 234, 196, 1, - 223, 219, 234, 196, 1, 222, 201, 234, 196, 1, 68, 234, 196, 1, 246, 74, - 234, 196, 1, 228, 163, 234, 196, 1, 198, 234, 196, 1, 221, 32, 234, 196, - 1, 254, 131, 234, 196, 1, 246, 197, 234, 196, 1, 234, 198, 234, 196, 1, - 231, 218, 234, 196, 1, 251, 202, 234, 196, 221, 87, 78, 201, 1, 60, 201, - 29, 5, 72, 201, 29, 5, 68, 201, 29, 5, 167, 152, 201, 29, 5, 73, 201, 29, - 5, 74, 201, 29, 235, 94, 78, 201, 5, 51, 227, 94, 56, 201, 5, 254, 95, - 201, 5, 219, 77, 201, 1, 175, 201, 1, 236, 149, 201, 1, 245, 0, 201, 1, - 244, 125, 201, 1, 251, 169, 201, 1, 251, 69, 201, 1, 237, 123, 201, 1, - 231, 77, 201, 1, 221, 29, 201, 1, 221, 19, 201, 1, 249, 132, 201, 1, 249, - 116, 201, 1, 231, 217, 201, 1, 222, 155, 201, 1, 222, 35, 201, 1, 249, - 207, 201, 1, 249, 36, 201, 1, 208, 201, 1, 187, 201, 1, 229, 141, 201, 1, - 252, 237, 201, 1, 252, 94, 201, 1, 196, 201, 1, 184, 201, 1, 203, 201, 1, - 235, 188, 201, 1, 219, 189, 201, 1, 225, 25, 201, 1, 223, 218, 201, 1, - 226, 177, 201, 1, 217, 114, 201, 1, 155, 201, 1, 236, 74, 201, 1, 221, 4, - 201, 5, 252, 201, 50, 201, 5, 251, 122, 201, 5, 61, 56, 201, 219, 82, - 201, 20, 107, 201, 20, 103, 201, 20, 160, 201, 20, 154, 201, 54, 222, 65, - 201, 54, 220, 219, 201, 54, 131, 242, 161, 201, 54, 131, 221, 231, 201, - 228, 197, 248, 145, 201, 228, 197, 3, 250, 221, 201, 228, 197, 250, 221, - 201, 228, 197, 250, 105, 135, 201, 228, 197, 234, 83, 201, 228, 197, 234, - 241, 201, 228, 197, 249, 167, 201, 228, 197, 51, 249, 167, 201, 228, 197, - 235, 37, 48, 224, 6, 254, 64, 1, 243, 162, 48, 224, 6, 254, 64, 1, 235, - 151, 48, 224, 6, 254, 64, 1, 243, 126, 48, 224, 6, 254, 64, 1, 234, 1, - 48, 224, 6, 254, 64, 1, 228, 102, 48, 224, 6, 254, 64, 1, 218, 233, 48, - 224, 6, 254, 64, 1, 224, 209, 48, 224, 6, 254, 64, 1, 227, 174, 48, 224, - 6, 254, 64, 1, 252, 101, 48, 224, 6, 254, 64, 1, 222, 100, 48, 224, 6, - 254, 64, 1, 226, 127, 48, 224, 6, 254, 64, 1, 236, 224, 48, 224, 6, 254, - 64, 1, 231, 103, 48, 224, 6, 254, 64, 1, 236, 134, 48, 224, 6, 254, 64, - 1, 226, 168, 48, 224, 6, 254, 64, 1, 226, 145, 48, 224, 6, 254, 64, 1, - 245, 231, 48, 224, 6, 254, 64, 1, 254, 168, 48, 224, 6, 254, 64, 1, 253, - 206, 48, 224, 6, 254, 64, 1, 249, 34, 48, 224, 6, 254, 64, 1, 244, 91, - 48, 224, 6, 254, 64, 1, 249, 176, 48, 224, 6, 254, 64, 1, 244, 118, 48, - 224, 6, 254, 64, 1, 222, 46, 48, 224, 6, 254, 64, 1, 217, 94, 48, 224, 6, - 254, 64, 1, 249, 31, 48, 224, 6, 254, 64, 1, 217, 219, 48, 224, 6, 254, - 64, 1, 222, 24, 48, 224, 6, 254, 64, 1, 222, 5, 48, 224, 6, 254, 64, 54, - 107, 48, 224, 6, 254, 64, 54, 245, 196, 48, 224, 6, 254, 64, 120, 237, - 211, 253, 216, 1, 60, 253, 216, 1, 255, 58, 253, 216, 1, 254, 93, 253, - 216, 1, 255, 17, 253, 216, 1, 254, 131, 253, 216, 1, 255, 18, 253, 216, - 1, 254, 234, 253, 216, 1, 254, 230, 253, 216, 1, 73, 253, 216, 1, 246, - 250, 253, 216, 1, 74, 253, 216, 1, 230, 127, 253, 216, 1, 72, 253, 216, - 1, 237, 255, 253, 216, 1, 68, 253, 216, 1, 220, 23, 253, 216, 1, 236, - 184, 253, 216, 1, 218, 135, 253, 216, 1, 218, 101, 253, 216, 1, 218, 110, - 253, 216, 1, 244, 191, 253, 216, 1, 244, 155, 253, 216, 1, 244, 116, 253, - 216, 1, 251, 99, 253, 216, 1, 237, 114, 253, 216, 1, 222, 87, 253, 216, - 1, 222, 22, 253, 216, 1, 249, 92, 253, 216, 1, 249, 29, 253, 216, 1, 221, - 26, 253, 216, 1, 229, 198, 253, 216, 1, 245, 231, 253, 216, 1, 252, 144, - 253, 216, 1, 252, 92, 253, 216, 1, 232, 106, 253, 216, 1, 232, 68, 253, - 216, 1, 232, 69, 253, 216, 1, 232, 141, 253, 216, 1, 231, 73, 253, 216, - 1, 231, 216, 253, 216, 1, 234, 25, 253, 216, 1, 243, 52, 253, 216, 1, - 217, 164, 253, 216, 1, 218, 25, 253, 216, 1, 219, 165, 253, 216, 1, 227, - 216, 253, 216, 1, 235, 122, 253, 216, 1, 226, 94, 253, 216, 1, 217, 92, - 253, 216, 1, 224, 246, 253, 216, 1, 217, 72, 253, 216, 1, 224, 147, 253, - 216, 1, 223, 190, 253, 216, 1, 243, 162, 253, 216, 255, 7, 78, 221, 172, - 124, 188, 104, 131, 61, 228, 196, 3, 124, 188, 104, 131, 61, 228, 196, - 235, 146, 124, 188, 104, 131, 61, 228, 196, 235, 146, 131, 61, 104, 124, - 188, 228, 196, 235, 146, 124, 227, 92, 104, 131, 227, 94, 228, 196, 235, - 146, 131, 227, 94, 104, 124, 227, 92, 228, 196, 237, 193, 229, 224, 1, - 254, 166, 237, 193, 229, 224, 1, 252, 101, 237, 193, 229, 224, 1, 244, - 91, 237, 193, 229, 224, 1, 249, 176, 237, 193, 229, 224, 1, 243, 162, - 237, 193, 229, 224, 1, 218, 233, 237, 193, 229, 224, 1, 217, 95, 237, - 193, 229, 224, 1, 243, 126, 237, 193, 229, 224, 1, 222, 46, 237, 193, - 229, 224, 1, 217, 219, 237, 193, 229, 224, 1, 236, 224, 237, 193, 229, - 224, 1, 235, 151, 237, 193, 229, 224, 1, 234, 1, 237, 193, 229, 224, 1, - 231, 103, 237, 193, 229, 224, 1, 226, 145, 237, 193, 229, 224, 1, 253, - 207, 237, 193, 229, 224, 1, 229, 198, 237, 193, 229, 224, 1, 226, 168, - 237, 193, 229, 224, 1, 228, 102, 237, 193, 229, 224, 1, 227, 174, 237, - 193, 229, 224, 1, 224, 209, 237, 193, 229, 224, 1, 222, 100, 237, 193, - 229, 224, 54, 107, 237, 193, 229, 224, 54, 103, 237, 193, 229, 224, 54, - 160, 237, 193, 229, 224, 54, 154, 237, 193, 229, 224, 54, 222, 65, 237, - 193, 229, 224, 54, 220, 219, 237, 193, 229, 224, 54, 131, 242, 161, 237, - 193, 229, 224, 54, 131, 221, 231, 237, 193, 230, 33, 1, 254, 166, 237, - 193, 230, 33, 1, 252, 101, 237, 193, 230, 33, 1, 244, 91, 237, 193, 230, - 33, 1, 249, 176, 237, 193, 230, 33, 1, 243, 162, 237, 193, 230, 33, 1, - 218, 232, 237, 193, 230, 33, 1, 217, 95, 237, 193, 230, 33, 1, 243, 126, - 237, 193, 230, 33, 1, 222, 46, 237, 193, 230, 33, 1, 217, 219, 237, 193, - 230, 33, 1, 236, 224, 237, 193, 230, 33, 1, 235, 151, 237, 193, 230, 33, - 1, 234, 0, 237, 193, 230, 33, 1, 231, 103, 237, 193, 230, 33, 1, 226, - 145, 237, 193, 230, 33, 1, 229, 198, 237, 193, 230, 33, 1, 226, 168, 237, - 193, 230, 33, 1, 224, 209, 237, 193, 230, 33, 1, 222, 100, 237, 193, 230, - 33, 54, 107, 237, 193, 230, 33, 54, 103, 237, 193, 230, 33, 54, 160, 237, - 193, 230, 33, 54, 154, 237, 193, 230, 33, 54, 222, 65, 237, 193, 230, 33, - 54, 220, 219, 237, 193, 230, 33, 54, 131, 242, 161, 237, 193, 230, 33, - 54, 131, 221, 231, 48, 172, 1, 230, 100, 60, 48, 172, 1, 218, 17, 60, 48, - 172, 1, 218, 17, 254, 234, 48, 172, 1, 230, 100, 72, 48, 172, 1, 218, 17, - 72, 48, 172, 1, 218, 17, 73, 48, 172, 1, 230, 100, 74, 48, 172, 1, 230, - 100, 230, 167, 48, 172, 1, 218, 17, 230, 167, 48, 172, 1, 230, 100, 255, - 11, 48, 172, 1, 218, 17, 255, 11, 48, 172, 1, 230, 100, 254, 233, 48, - 172, 1, 218, 17, 254, 233, 48, 172, 1, 230, 100, 254, 209, 48, 172, 1, - 218, 17, 254, 209, 48, 172, 1, 230, 100, 254, 228, 48, 172, 1, 218, 17, - 254, 228, 48, 172, 1, 230, 100, 254, 244, 48, 172, 1, 218, 17, 254, 244, - 48, 172, 1, 230, 100, 254, 232, 48, 172, 1, 230, 100, 246, 80, 48, 172, - 1, 218, 17, 246, 80, 48, 172, 1, 230, 100, 253, 212, 48, 172, 1, 218, 17, - 253, 212, 48, 172, 1, 230, 100, 254, 216, 48, 172, 1, 218, 17, 254, 216, - 48, 172, 1, 230, 100, 254, 226, 48, 172, 1, 218, 17, 254, 226, 48, 172, - 1, 230, 100, 230, 166, 48, 172, 1, 218, 17, 230, 166, 48, 172, 1, 230, - 100, 254, 175, 48, 172, 1, 218, 17, 254, 175, 48, 172, 1, 230, 100, 254, - 225, 48, 172, 1, 230, 100, 246, 207, 48, 172, 1, 230, 100, 246, 205, 48, - 172, 1, 230, 100, 254, 131, 48, 172, 1, 230, 100, 254, 223, 48, 172, 1, - 218, 17, 254, 223, 48, 172, 1, 230, 100, 246, 180, 48, 172, 1, 218, 17, - 246, 180, 48, 172, 1, 230, 100, 246, 194, 48, 172, 1, 218, 17, 246, 194, - 48, 172, 1, 230, 100, 246, 169, 48, 172, 1, 218, 17, 246, 169, 48, 172, - 1, 218, 17, 254, 123, 48, 172, 1, 230, 100, 246, 185, 48, 172, 1, 218, - 17, 254, 222, 48, 172, 1, 230, 100, 246, 162, 48, 172, 1, 230, 100, 230, - 120, 48, 172, 1, 230, 100, 242, 67, 48, 172, 1, 230, 100, 247, 0, 48, - 172, 1, 218, 17, 247, 0, 48, 172, 1, 230, 100, 254, 69, 48, 172, 1, 218, - 17, 254, 69, 48, 172, 1, 230, 100, 237, 158, 48, 172, 1, 218, 17, 237, - 158, 48, 172, 1, 230, 100, 230, 106, 48, 172, 1, 218, 17, 230, 106, 48, - 172, 1, 230, 100, 254, 67, 48, 172, 1, 218, 17, 254, 67, 48, 172, 1, 230, - 100, 254, 221, 48, 172, 1, 230, 100, 254, 13, 48, 172, 1, 230, 100, 254, - 220, 48, 172, 1, 230, 100, 254, 7, 48, 172, 1, 218, 17, 254, 7, 48, 172, - 1, 230, 100, 246, 133, 48, 172, 1, 218, 17, 246, 133, 48, 172, 1, 230, - 100, 253, 244, 48, 172, 1, 218, 17, 253, 244, 48, 172, 1, 230, 100, 254, - 217, 48, 172, 1, 218, 17, 254, 217, 48, 172, 1, 230, 100, 230, 92, 48, - 172, 1, 230, 100, 252, 187, 227, 11, 20, 107, 227, 11, 20, 103, 227, 11, - 20, 160, 227, 11, 20, 154, 227, 11, 20, 174, 227, 11, 20, 182, 227, 11, - 20, 191, 227, 11, 20, 185, 227, 11, 20, 190, 227, 11, 54, 222, 65, 227, - 11, 54, 220, 219, 227, 11, 54, 221, 245, 227, 11, 54, 245, 119, 227, 11, - 54, 245, 196, 227, 11, 54, 224, 69, 227, 11, 54, 225, 38, 227, 11, 54, - 246, 227, 227, 11, 54, 232, 27, 227, 11, 54, 131, 242, 161, 227, 11, 54, - 124, 242, 161, 227, 11, 54, 148, 242, 161, 227, 11, 54, 245, 116, 242, - 161, 227, 11, 54, 245, 170, 242, 161, 227, 11, 54, 224, 82, 242, 161, - 227, 11, 54, 225, 43, 242, 161, 227, 11, 54, 246, 235, 242, 161, 227, 11, - 54, 232, 31, 242, 161, 227, 11, 245, 108, 131, 243, 194, 227, 11, 245, - 108, 131, 228, 89, 227, 11, 245, 108, 131, 221, 251, 227, 11, 245, 108, - 124, 221, 249, 194, 5, 251, 146, 194, 5, 254, 95, 194, 5, 219, 77, 194, - 1, 60, 194, 1, 255, 58, 194, 1, 72, 194, 1, 237, 255, 194, 1, 68, 194, 1, - 220, 23, 194, 1, 73, 194, 1, 254, 196, 194, 1, 74, 194, 1, 253, 232, 194, - 1, 175, 194, 1, 236, 149, 194, 1, 245, 0, 194, 1, 244, 125, 194, 1, 232, - 115, 194, 1, 251, 169, 194, 1, 251, 69, 194, 1, 237, 123, 194, 1, 237, - 103, 194, 1, 231, 77, 194, 1, 221, 29, 194, 1, 221, 19, 194, 1, 249, 132, - 194, 1, 249, 121, 194, 1, 249, 116, 194, 1, 227, 151, 194, 1, 231, 217, - 194, 1, 222, 155, 194, 1, 222, 35, 194, 1, 249, 207, 194, 1, 249, 36, - 194, 1, 208, 194, 1, 187, 194, 1, 229, 141, 194, 1, 252, 237, 194, 1, - 252, 94, 194, 1, 196, 194, 1, 184, 194, 1, 203, 194, 1, 235, 188, 194, 1, - 219, 189, 194, 1, 225, 25, 194, 1, 223, 218, 194, 1, 226, 177, 194, 1, - 155, 194, 29, 5, 255, 58, 194, 29, 5, 72, 194, 29, 5, 237, 255, 194, 29, - 5, 68, 194, 29, 5, 220, 23, 194, 29, 5, 73, 194, 29, 5, 254, 196, 194, - 29, 5, 74, 194, 29, 5, 253, 232, 194, 5, 219, 82, 194, 5, 231, 112, 194, - 255, 7, 55, 194, 246, 171, 55, 194, 54, 55, 194, 226, 87, 78, 194, 51, - 226, 87, 78, 194, 249, 167, 194, 51, 249, 167, 15, 5, 60, 15, 5, 112, 27, - 60, 15, 5, 112, 27, 252, 228, 15, 5, 112, 27, 244, 229, 222, 59, 15, 5, - 112, 27, 155, 15, 5, 112, 27, 238, 1, 15, 5, 112, 27, 235, 173, 244, 3, - 15, 5, 112, 27, 233, 62, 15, 5, 112, 27, 226, 165, 15, 5, 255, 60, 15, 5, - 255, 11, 15, 5, 255, 12, 27, 254, 5, 15, 5, 255, 12, 27, 247, 100, 244, - 3, 15, 5, 255, 12, 27, 244, 240, 15, 5, 255, 12, 27, 244, 229, 222, 59, - 15, 5, 255, 12, 27, 155, 15, 5, 255, 12, 27, 238, 2, 244, 3, 15, 5, 255, - 12, 27, 237, 231, 15, 5, 255, 12, 27, 235, 174, 15, 5, 255, 12, 27, 224, - 231, 15, 5, 255, 12, 27, 105, 88, 105, 88, 68, 15, 5, 255, 12, 244, 3, - 15, 5, 255, 9, 15, 5, 255, 10, 27, 252, 216, 15, 5, 255, 10, 27, 244, - 229, 222, 59, 15, 5, 255, 10, 27, 234, 26, 88, 246, 197, 15, 5, 255, 10, - 27, 225, 23, 15, 5, 255, 10, 27, 222, 130, 15, 5, 254, 244, 15, 5, 254, - 182, 15, 5, 254, 183, 27, 246, 143, 15, 5, 254, 183, 27, 224, 203, 88, - 244, 81, 15, 5, 254, 175, 15, 5, 254, 176, 27, 254, 175, 15, 5, 254, 176, - 27, 248, 229, 15, 5, 254, 176, 27, 244, 81, 15, 5, 254, 176, 27, 155, 15, - 5, 254, 176, 27, 236, 251, 15, 5, 254, 176, 27, 236, 113, 15, 5, 254, - 176, 27, 224, 246, 15, 5, 254, 176, 27, 220, 30, 15, 5, 254, 172, 15, 5, - 254, 166, 15, 5, 254, 137, 15, 5, 254, 138, 27, 224, 246, 15, 5, 254, - 131, 15, 5, 254, 132, 104, 254, 131, 15, 5, 254, 132, 148, 221, 176, 15, - 5, 254, 132, 88, 232, 228, 230, 110, 254, 132, 88, 232, 227, 15, 5, 254, - 132, 88, 232, 228, 223, 226, 15, 5, 254, 107, 15, 5, 254, 88, 15, 5, 254, - 61, 15, 5, 254, 62, 27, 235, 247, 15, 5, 254, 35, 15, 5, 254, 12, 15, 5, - 254, 7, 15, 5, 254, 8, 217, 38, 222, 59, 15, 5, 254, 8, 236, 254, 222, - 59, 15, 5, 254, 8, 104, 254, 8, 220, 254, 104, 220, 254, 220, 254, 104, - 220, 254, 229, 246, 15, 5, 254, 8, 104, 254, 8, 104, 254, 7, 15, 5, 254, - 8, 104, 254, 8, 104, 254, 8, 250, 95, 254, 8, 104, 254, 8, 104, 254, 7, - 15, 5, 254, 5, 15, 5, 254, 3, 15, 5, 252, 237, 15, 5, 252, 228, 15, 5, - 252, 225, 15, 5, 252, 223, 15, 5, 252, 217, 15, 5, 252, 218, 104, 252, - 217, 15, 5, 252, 216, 15, 5, 135, 15, 5, 252, 200, 15, 5, 252, 84, 15, 5, - 252, 85, 27, 60, 15, 5, 252, 85, 27, 244, 220, 15, 5, 252, 85, 27, 238, - 2, 244, 3, 15, 5, 251, 248, 15, 5, 251, 249, 104, 251, 249, 255, 11, 15, - 5, 251, 249, 104, 251, 249, 220, 87, 15, 5, 251, 249, 250, 95, 251, 248, - 15, 5, 251, 237, 15, 5, 251, 238, 104, 251, 237, 15, 5, 251, 228, 15, 5, - 251, 227, 15, 5, 249, 207, 15, 5, 249, 198, 15, 5, 249, 199, 236, 91, 27, - 112, 88, 234, 57, 15, 5, 249, 199, 236, 91, 27, 254, 137, 15, 5, 249, - 199, 236, 91, 27, 252, 216, 15, 5, 249, 199, 236, 91, 27, 252, 84, 15, 5, - 249, 199, 236, 91, 27, 245, 0, 15, 5, 249, 199, 236, 91, 27, 245, 1, 88, - 234, 57, 15, 5, 249, 199, 236, 91, 27, 244, 103, 15, 5, 249, 199, 236, - 91, 27, 244, 87, 15, 5, 249, 199, 236, 91, 27, 244, 11, 15, 5, 249, 199, - 236, 91, 27, 155, 15, 5, 249, 199, 236, 91, 27, 237, 156, 15, 5, 249, - 199, 236, 91, 27, 237, 157, 88, 234, 231, 15, 5, 249, 199, 236, 91, 27, - 236, 240, 15, 5, 249, 199, 236, 91, 27, 235, 188, 15, 5, 249, 199, 236, - 91, 27, 234, 231, 15, 5, 249, 199, 236, 91, 27, 234, 232, 88, 234, 56, - 15, 5, 249, 199, 236, 91, 27, 234, 219, 15, 5, 249, 199, 236, 91, 27, - 232, 141, 15, 5, 249, 199, 236, 91, 27, 229, 247, 88, 229, 246, 15, 5, - 249, 199, 236, 91, 27, 224, 140, 15, 5, 249, 199, 236, 91, 27, 222, 130, - 15, 5, 249, 199, 236, 91, 27, 220, 125, 88, 244, 87, 15, 5, 249, 199, - 236, 91, 27, 220, 30, 15, 5, 249, 175, 15, 5, 249, 156, 15, 5, 249, 155, - 15, 5, 249, 154, 15, 5, 249, 15, 15, 5, 248, 255, 15, 5, 248, 230, 15, 5, - 248, 231, 27, 224, 246, 15, 5, 248, 229, 15, 5, 248, 219, 15, 5, 248, - 220, 236, 209, 105, 244, 4, 248, 202, 15, 5, 248, 202, 15, 5, 247, 111, - 15, 5, 247, 112, 104, 247, 111, 15, 5, 247, 112, 244, 3, 15, 5, 247, 112, - 224, 228, 15, 5, 247, 109, 15, 5, 247, 110, 27, 246, 130, 15, 5, 247, - 108, 15, 5, 247, 107, 15, 5, 247, 106, 15, 5, 247, 105, 15, 5, 247, 101, - 15, 5, 247, 99, 15, 5, 247, 100, 244, 3, 15, 5, 247, 100, 244, 4, 244, 3, - 15, 5, 247, 98, 15, 5, 247, 91, 15, 5, 73, 15, 5, 178, 27, 229, 246, 15, - 5, 178, 104, 178, 231, 104, 104, 231, 103, 15, 5, 247, 17, 15, 5, 247, - 18, 27, 112, 88, 243, 214, 88, 249, 207, 15, 5, 247, 18, 27, 244, 220, - 15, 5, 247, 18, 27, 233, 196, 15, 5, 247, 18, 27, 226, 156, 15, 5, 247, - 18, 27, 224, 246, 15, 5, 247, 18, 27, 68, 15, 5, 246, 252, 15, 5, 246, - 242, 15, 5, 246, 217, 15, 5, 246, 197, 15, 5, 246, 198, 27, 244, 228, 15, - 5, 246, 198, 27, 244, 229, 222, 59, 15, 5, 246, 198, 27, 234, 25, 15, 5, - 246, 198, 250, 95, 246, 197, 15, 5, 246, 198, 230, 110, 246, 197, 15, 5, - 246, 198, 223, 226, 15, 5, 246, 145, 15, 5, 246, 143, 15, 5, 246, 130, - 15, 5, 246, 78, 15, 5, 246, 79, 27, 60, 15, 5, 246, 79, 27, 112, 88, 235, - 162, 15, 5, 246, 79, 27, 112, 88, 235, 163, 27, 235, 162, 15, 5, 246, 79, - 27, 254, 131, 15, 5, 246, 79, 27, 252, 228, 15, 5, 246, 79, 27, 247, 100, - 244, 3, 15, 5, 246, 79, 27, 247, 100, 244, 4, 244, 3, 15, 5, 246, 79, 27, - 155, 15, 5, 246, 79, 27, 243, 214, 244, 3, 15, 5, 246, 79, 27, 238, 2, - 244, 3, 15, 5, 246, 79, 27, 236, 208, 15, 5, 246, 79, 27, 236, 209, 223, - 226, 15, 5, 246, 79, 27, 236, 5, 15, 5, 246, 79, 27, 235, 188, 15, 5, - 246, 79, 27, 235, 163, 27, 235, 162, 15, 5, 246, 79, 27, 235, 67, 15, 5, - 246, 79, 27, 234, 231, 15, 5, 246, 79, 27, 220, 124, 15, 5, 246, 79, 27, - 220, 115, 15, 5, 245, 0, 15, 5, 245, 1, 244, 3, 15, 5, 244, 254, 15, 5, - 244, 255, 27, 112, 88, 249, 208, 88, 155, 15, 5, 244, 255, 27, 112, 88, - 155, 15, 5, 244, 255, 27, 112, 88, 238, 1, 15, 5, 244, 255, 27, 255, 10, - 222, 60, 88, 222, 147, 15, 5, 244, 255, 27, 254, 131, 15, 5, 244, 255, - 27, 254, 7, 15, 5, 244, 255, 27, 254, 6, 88, 244, 240, 15, 5, 244, 255, - 27, 252, 228, 15, 5, 244, 255, 27, 252, 201, 88, 203, 15, 5, 244, 255, - 27, 251, 228, 15, 5, 244, 255, 27, 251, 229, 88, 203, 15, 5, 244, 255, - 27, 249, 207, 15, 5, 244, 255, 27, 249, 15, 15, 5, 244, 255, 27, 248, - 231, 27, 224, 246, 15, 5, 244, 255, 27, 247, 109, 15, 5, 244, 255, 27, - 246, 217, 15, 5, 244, 255, 27, 246, 218, 88, 235, 188, 15, 5, 244, 255, - 27, 246, 197, 15, 5, 244, 255, 27, 246, 198, 27, 244, 229, 222, 59, 15, - 5, 244, 255, 27, 244, 229, 222, 59, 15, 5, 244, 255, 27, 244, 220, 15, 5, - 244, 255, 27, 244, 103, 15, 5, 244, 255, 27, 244, 101, 15, 5, 244, 255, - 27, 244, 102, 88, 60, 15, 5, 244, 255, 27, 244, 88, 88, 223, 103, 15, 5, - 244, 255, 27, 243, 214, 88, 234, 232, 88, 246, 130, 15, 5, 244, 255, 27, - 243, 197, 15, 5, 244, 255, 27, 243, 198, 88, 235, 188, 15, 5, 244, 255, - 27, 243, 113, 88, 235, 67, 15, 5, 244, 255, 27, 242, 169, 15, 5, 244, - 255, 27, 238, 2, 244, 3, 15, 5, 244, 255, 27, 237, 146, 88, 242, 174, 88, - 254, 7, 15, 5, 244, 255, 27, 236, 240, 15, 5, 244, 255, 27, 236, 208, 15, - 5, 244, 255, 27, 236, 110, 15, 5, 244, 255, 27, 236, 111, 88, 235, 162, - 15, 5, 244, 255, 27, 236, 6, 88, 254, 131, 15, 5, 244, 255, 27, 235, 188, - 15, 5, 244, 255, 27, 234, 26, 88, 246, 197, 15, 5, 244, 255, 27, 233, - 196, 15, 5, 244, 255, 27, 231, 103, 15, 5, 244, 255, 27, 231, 104, 104, - 231, 103, 15, 5, 244, 255, 27, 187, 15, 5, 244, 255, 27, 226, 156, 15, 5, - 244, 255, 27, 226, 131, 15, 5, 244, 255, 27, 224, 246, 15, 5, 244, 255, - 27, 224, 247, 88, 220, 240, 15, 5, 244, 255, 27, 224, 219, 15, 5, 244, - 255, 27, 223, 74, 15, 5, 244, 255, 27, 222, 130, 15, 5, 244, 255, 27, 68, - 15, 5, 244, 255, 27, 220, 115, 15, 5, 244, 255, 27, 220, 116, 88, 247, - 111, 15, 5, 244, 255, 104, 244, 254, 15, 5, 244, 249, 15, 5, 244, 250, - 250, 95, 244, 249, 15, 5, 244, 247, 15, 5, 244, 248, 104, 244, 248, 244, - 221, 104, 244, 220, 15, 5, 244, 240, 15, 5, 244, 241, 244, 248, 104, 244, - 248, 244, 221, 104, 244, 220, 15, 5, 244, 239, 15, 5, 244, 237, 15, 5, - 244, 230, 15, 5, 244, 228, 15, 5, 244, 229, 222, 59, 15, 5, 244, 229, - 104, 244, 228, 15, 5, 244, 229, 250, 95, 244, 228, 15, 5, 244, 220, 15, - 5, 244, 219, 15, 5, 244, 215, 15, 5, 244, 166, 15, 5, 244, 167, 27, 235, - 247, 15, 5, 244, 103, 15, 5, 244, 104, 27, 73, 15, 5, 244, 104, 27, 68, - 15, 5, 244, 104, 250, 95, 244, 103, 15, 5, 244, 101, 15, 5, 244, 102, - 104, 244, 101, 15, 5, 244, 102, 250, 95, 244, 101, 15, 5, 244, 99, 15, 5, - 244, 87, 15, 5, 244, 88, 244, 3, 15, 5, 244, 85, 15, 5, 244, 86, 27, 112, - 88, 238, 1, 15, 5, 244, 86, 27, 244, 229, 222, 59, 15, 5, 244, 86, 27, - 238, 1, 15, 5, 244, 86, 27, 234, 232, 88, 238, 1, 15, 5, 244, 86, 27, - 187, 15, 5, 244, 83, 15, 5, 244, 81, 15, 5, 244, 82, 250, 95, 244, 81, - 15, 5, 244, 82, 27, 252, 228, 15, 5, 244, 82, 27, 222, 130, 15, 5, 244, - 82, 222, 59, 15, 5, 244, 17, 15, 5, 244, 18, 250, 95, 244, 17, 15, 5, - 244, 15, 15, 5, 244, 16, 27, 236, 240, 15, 5, 244, 16, 27, 236, 241, 27, - 238, 2, 244, 3, 15, 5, 244, 16, 27, 231, 103, 15, 5, 244, 16, 27, 226, - 157, 88, 220, 253, 15, 5, 244, 16, 244, 3, 15, 5, 244, 11, 15, 5, 244, - 12, 27, 112, 88, 235, 247, 15, 5, 244, 12, 27, 235, 247, 15, 5, 244, 12, - 104, 244, 12, 234, 225, 15, 5, 244, 7, 15, 5, 244, 5, 15, 5, 244, 6, 27, - 224, 246, 15, 5, 243, 253, 15, 5, 243, 252, 15, 5, 243, 249, 15, 5, 243, - 248, 15, 5, 155, 15, 5, 243, 214, 222, 59, 15, 5, 243, 214, 244, 3, 15, - 5, 243, 197, 15, 5, 243, 112, 15, 5, 243, 113, 27, 254, 7, 15, 5, 243, - 113, 27, 254, 5, 15, 5, 243, 113, 27, 252, 228, 15, 5, 243, 113, 27, 248, - 202, 15, 5, 243, 113, 27, 244, 247, 15, 5, 243, 113, 27, 236, 104, 15, 5, - 243, 113, 27, 231, 103, 15, 5, 243, 113, 27, 224, 246, 15, 5, 243, 113, - 27, 68, 15, 5, 242, 173, 15, 5, 242, 169, 15, 5, 242, 170, 27, 254, 131, - 15, 5, 242, 170, 27, 243, 197, 15, 5, 242, 170, 27, 236, 208, 15, 5, 242, - 170, 27, 235, 29, 15, 5, 242, 170, 27, 220, 115, 15, 5, 242, 166, 15, 5, - 72, 15, 5, 242, 107, 60, 15, 5, 242, 69, 15, 5, 238, 29, 15, 5, 238, 30, - 104, 238, 30, 251, 228, 15, 5, 238, 30, 104, 238, 30, 223, 226, 15, 5, - 238, 4, 15, 5, 238, 1, 15, 5, 238, 2, 248, 255, 15, 5, 238, 2, 227, 147, - 15, 5, 238, 2, 104, 238, 2, 224, 205, 104, 224, 205, 220, 116, 104, 220, - 115, 15, 5, 238, 2, 244, 3, 15, 5, 237, 249, 15, 5, 237, 250, 27, 244, - 229, 222, 59, 15, 5, 237, 248, 15, 5, 237, 238, 15, 5, 237, 239, 27, 222, - 130, 15, 5, 237, 239, 250, 95, 237, 238, 15, 5, 237, 239, 230, 110, 237, - 238, 15, 5, 237, 239, 223, 226, 15, 5, 237, 231, 15, 5, 237, 223, 15, 5, - 237, 156, 15, 5, 237, 145, 15, 5, 175, 15, 5, 206, 27, 60, 15, 5, 206, - 27, 254, 244, 15, 5, 206, 27, 254, 245, 88, 236, 5, 15, 5, 206, 27, 254, - 5, 15, 5, 206, 27, 252, 228, 15, 5, 206, 27, 252, 216, 15, 5, 206, 27, - 135, 15, 5, 206, 27, 252, 84, 15, 5, 206, 27, 246, 143, 15, 5, 206, 27, - 246, 130, 15, 5, 206, 27, 245, 0, 15, 5, 206, 27, 244, 240, 15, 5, 206, - 27, 244, 229, 222, 59, 15, 5, 206, 27, 244, 220, 15, 5, 206, 27, 244, - 221, 88, 225, 24, 88, 60, 15, 5, 206, 27, 244, 103, 15, 5, 206, 27, 244, - 87, 15, 5, 206, 27, 244, 82, 88, 226, 131, 15, 5, 206, 27, 244, 82, 250, - 95, 244, 81, 15, 5, 206, 27, 244, 17, 15, 5, 206, 27, 243, 252, 15, 5, - 206, 27, 238, 1, 15, 5, 206, 27, 237, 238, 15, 5, 206, 27, 236, 240, 15, - 5, 206, 27, 236, 113, 15, 5, 206, 27, 236, 110, 15, 5, 206, 27, 235, 67, - 15, 5, 206, 27, 234, 231, 15, 5, 206, 27, 234, 25, 15, 5, 206, 27, 234, - 26, 88, 247, 111, 15, 5, 206, 27, 234, 26, 88, 244, 103, 15, 5, 206, 27, - 234, 26, 88, 222, 87, 15, 5, 206, 27, 233, 196, 15, 5, 206, 27, 233, 197, - 88, 231, 98, 15, 5, 206, 27, 232, 141, 15, 5, 206, 27, 231, 103, 15, 5, - 206, 27, 229, 108, 15, 5, 206, 27, 227, 22, 15, 5, 206, 27, 226, 177, 15, - 5, 206, 27, 226, 131, 15, 5, 206, 27, 225, 25, 15, 5, 206, 27, 224, 246, - 15, 5, 206, 27, 224, 219, 15, 5, 206, 27, 224, 170, 15, 5, 206, 27, 224, - 132, 15, 5, 206, 27, 223, 81, 15, 5, 206, 27, 222, 112, 15, 5, 206, 27, - 68, 15, 5, 206, 27, 220, 124, 15, 5, 206, 27, 220, 115, 15, 5, 206, 27, - 220, 90, 27, 187, 15, 5, 206, 27, 220, 30, 15, 5, 206, 27, 217, 42, 15, - 5, 237, 6, 15, 5, 237, 7, 250, 95, 237, 6, 15, 5, 236, 255, 15, 5, 236, - 253, 15, 5, 236, 251, 15, 5, 236, 250, 15, 5, 236, 248, 15, 5, 236, 249, - 104, 236, 248, 15, 5, 236, 240, 15, 5, 236, 241, 27, 238, 2, 244, 3, 15, - 5, 236, 236, 15, 5, 236, 237, 27, 252, 228, 15, 5, 236, 237, 250, 95, - 236, 236, 15, 5, 236, 235, 15, 5, 236, 234, 15, 5, 236, 208, 15, 5, 236, - 209, 235, 175, 27, 105, 104, 235, 175, 27, 68, 15, 5, 236, 209, 104, 236, - 209, 235, 175, 27, 105, 104, 235, 175, 27, 68, 15, 5, 236, 160, 15, 5, - 236, 113, 15, 5, 236, 114, 27, 252, 228, 15, 5, 236, 114, 27, 68, 15, 5, - 236, 114, 27, 220, 115, 15, 5, 236, 110, 15, 5, 236, 104, 15, 5, 236, 93, - 15, 5, 236, 92, 15, 5, 236, 90, 15, 5, 236, 91, 104, 236, 90, 15, 5, 236, - 7, 15, 5, 236, 8, 104, 243, 113, 27, 254, 6, 236, 8, 104, 243, 113, 27, - 254, 5, 15, 5, 236, 5, 15, 5, 236, 3, 15, 5, 236, 4, 219, 177, 17, 15, 5, - 236, 2, 15, 5, 236, 0, 15, 5, 236, 1, 244, 3, 15, 5, 235, 255, 15, 5, - 235, 247, 15, 5, 235, 248, 230, 110, 235, 247, 15, 5, 235, 242, 15, 5, - 235, 225, 15, 5, 235, 188, 15, 5, 235, 174, 15, 5, 235, 175, 27, 60, 15, - 5, 235, 175, 27, 112, 88, 249, 208, 88, 155, 15, 5, 235, 175, 27, 112, - 88, 244, 220, 15, 5, 235, 175, 27, 112, 88, 235, 162, 15, 5, 235, 175, - 27, 254, 175, 15, 5, 235, 175, 27, 254, 131, 15, 5, 235, 175, 27, 254, 8, - 217, 38, 222, 59, 15, 5, 235, 175, 27, 252, 228, 15, 5, 235, 175, 27, - 252, 84, 15, 5, 235, 175, 27, 249, 156, 15, 5, 235, 175, 27, 246, 197, - 15, 5, 235, 175, 27, 245, 0, 15, 5, 235, 175, 27, 244, 220, 15, 5, 235, - 175, 27, 244, 11, 15, 5, 235, 175, 27, 244, 12, 88, 244, 11, 15, 5, 235, - 175, 27, 155, 15, 5, 235, 175, 27, 243, 197, 15, 5, 235, 175, 27, 243, - 113, 27, 231, 103, 15, 5, 235, 175, 27, 238, 2, 244, 3, 15, 5, 235, 175, - 27, 237, 238, 15, 5, 235, 175, 27, 237, 239, 88, 155, 15, 5, 235, 175, - 27, 237, 239, 88, 234, 231, 15, 5, 235, 175, 27, 236, 113, 15, 5, 235, - 175, 27, 236, 104, 15, 5, 235, 175, 27, 236, 5, 15, 5, 235, 175, 27, 236, - 0, 15, 5, 235, 175, 27, 236, 1, 88, 243, 113, 88, 60, 15, 5, 235, 175, - 27, 235, 174, 15, 5, 235, 175, 27, 235, 29, 15, 5, 235, 175, 27, 234, - 231, 15, 5, 235, 175, 27, 234, 221, 15, 5, 235, 175, 27, 234, 25, 15, 5, - 235, 175, 27, 234, 26, 88, 246, 197, 15, 5, 235, 175, 27, 233, 62, 15, 5, - 235, 175, 27, 232, 141, 15, 5, 235, 175, 27, 224, 247, 88, 223, 74, 15, - 5, 235, 175, 27, 224, 203, 88, 244, 82, 88, 246, 143, 15, 5, 235, 175, - 27, 224, 203, 88, 244, 82, 222, 59, 15, 5, 235, 175, 27, 224, 168, 15, 5, - 235, 175, 27, 224, 169, 88, 224, 168, 15, 5, 235, 175, 27, 223, 74, 15, - 5, 235, 175, 27, 222, 141, 15, 5, 235, 175, 27, 222, 130, 15, 5, 235, - 175, 27, 222, 88, 88, 112, 88, 223, 104, 88, 208, 15, 5, 235, 175, 27, - 68, 15, 5, 235, 175, 27, 105, 88, 60, 15, 5, 235, 175, 27, 105, 88, 105, - 88, 68, 15, 5, 235, 175, 27, 220, 125, 88, 254, 7, 15, 5, 235, 175, 27, - 220, 115, 15, 5, 235, 175, 27, 220, 30, 15, 5, 235, 175, 223, 226, 15, 5, - 235, 172, 15, 5, 235, 173, 27, 224, 246, 15, 5, 235, 173, 27, 224, 247, - 88, 223, 74, 15, 5, 235, 173, 244, 3, 15, 5, 235, 173, 244, 4, 104, 235, - 173, 244, 4, 224, 246, 15, 5, 235, 169, 15, 5, 235, 162, 15, 5, 235, 163, - 27, 235, 162, 15, 5, 235, 160, 15, 5, 235, 161, 27, 235, 247, 15, 5, 235, - 161, 27, 235, 248, 88, 227, 22, 15, 5, 235, 67, 15, 5, 235, 54, 15, 5, - 235, 46, 15, 5, 235, 29, 15, 5, 234, 231, 15, 5, 234, 232, 27, 252, 228, - 15, 5, 234, 229, 15, 5, 234, 230, 27, 254, 175, 15, 5, 234, 230, 27, 252, - 228, 15, 5, 234, 230, 27, 246, 130, 15, 5, 234, 230, 27, 246, 131, 222, - 59, 15, 5, 234, 230, 27, 244, 229, 222, 59, 15, 5, 234, 230, 27, 243, - 113, 27, 252, 228, 15, 5, 234, 230, 27, 237, 238, 15, 5, 234, 230, 27, - 236, 253, 15, 5, 234, 230, 27, 236, 251, 15, 5, 234, 230, 27, 236, 252, - 88, 254, 7, 15, 5, 234, 230, 27, 236, 113, 15, 5, 234, 230, 27, 235, 189, - 88, 254, 7, 15, 5, 234, 230, 27, 235, 174, 15, 5, 234, 230, 27, 234, 26, - 88, 246, 197, 15, 5, 234, 230, 27, 232, 141, 15, 5, 234, 230, 27, 231, - 144, 15, 5, 234, 230, 27, 224, 141, 88, 254, 7, 15, 5, 234, 230, 27, 224, - 124, 88, 251, 248, 15, 5, 234, 230, 27, 220, 253, 15, 5, 234, 230, 222, - 59, 15, 5, 234, 230, 250, 95, 234, 229, 15, 5, 234, 230, 230, 110, 234, - 229, 15, 5, 234, 230, 223, 226, 15, 5, 234, 230, 224, 228, 15, 5, 234, - 228, 15, 5, 234, 225, 15, 5, 234, 226, 104, 234, 225, 15, 5, 234, 226, - 230, 110, 234, 225, 15, 5, 234, 226, 224, 228, 15, 5, 234, 224, 15, 5, - 234, 221, 15, 5, 234, 219, 15, 5, 234, 220, 104, 234, 219, 15, 5, 234, - 220, 104, 234, 220, 244, 221, 104, 244, 220, 15, 5, 196, 15, 5, 234, 120, - 27, 222, 130, 15, 5, 234, 120, 244, 3, 15, 5, 234, 119, 15, 5, 234, 106, - 15, 5, 234, 74, 15, 5, 234, 57, 15, 5, 234, 56, 15, 5, 234, 25, 15, 5, - 233, 244, 15, 5, 233, 196, 15, 5, 233, 159, 15, 5, 233, 99, 15, 5, 233, - 100, 104, 233, 99, 15, 5, 233, 92, 15, 5, 233, 93, 244, 3, 15, 5, 233, - 78, 15, 5, 233, 65, 15, 5, 233, 62, 15, 5, 233, 63, 27, 60, 15, 5, 233, - 63, 27, 235, 247, 15, 5, 233, 63, 27, 217, 114, 15, 5, 233, 63, 104, 233, - 62, 15, 5, 233, 63, 104, 233, 63, 27, 112, 88, 208, 15, 5, 233, 63, 250, - 95, 233, 62, 15, 5, 233, 60, 15, 5, 233, 61, 27, 60, 15, 5, 233, 61, 27, - 112, 88, 249, 15, 15, 5, 233, 61, 27, 249, 15, 15, 5, 233, 61, 244, 3, - 15, 5, 208, 15, 5, 232, 237, 15, 5, 232, 227, 15, 5, 232, 228, 237, 169, - 15, 5, 232, 228, 27, 224, 171, 222, 59, 15, 5, 232, 228, 230, 110, 232, - 227, 15, 5, 232, 226, 15, 5, 232, 222, 231, 90, 15, 5, 232, 221, 15, 5, - 232, 220, 15, 5, 232, 141, 15, 5, 232, 142, 27, 60, 15, 5, 232, 142, 27, - 220, 115, 15, 5, 232, 142, 224, 228, 15, 5, 232, 62, 15, 5, 232, 63, 27, - 73, 15, 5, 232, 61, 15, 5, 232, 34, 15, 5, 232, 35, 27, 244, 229, 222, - 59, 15, 5, 232, 35, 27, 244, 221, 88, 244, 229, 222, 59, 15, 5, 232, 32, - 15, 5, 232, 33, 27, 254, 131, 15, 5, 232, 33, 27, 254, 7, 15, 5, 232, 33, - 27, 254, 8, 88, 254, 7, 15, 5, 232, 33, 27, 244, 11, 15, 5, 232, 33, 27, - 234, 26, 88, 244, 229, 222, 59, 15, 5, 232, 33, 27, 232, 141, 15, 5, 232, - 33, 27, 231, 103, 15, 5, 232, 33, 27, 224, 246, 15, 5, 232, 33, 27, 224, - 247, 88, 112, 254, 131, 15, 5, 232, 33, 27, 224, 247, 88, 254, 7, 15, 5, - 232, 33, 27, 224, 247, 88, 254, 8, 88, 254, 7, 15, 5, 232, 33, 27, 220, - 125, 88, 254, 7, 15, 5, 232, 33, 27, 220, 30, 15, 5, 232, 22, 15, 5, 231, - 144, 15, 5, 231, 117, 15, 5, 231, 103, 15, 5, 231, 104, 235, 173, 27, - 244, 220, 15, 5, 231, 104, 235, 173, 27, 234, 57, 15, 5, 231, 104, 235, - 173, 27, 226, 156, 15, 5, 231, 104, 235, 173, 27, 226, 157, 104, 231, - 104, 235, 173, 27, 226, 156, 15, 5, 231, 104, 235, 173, 27, 220, 30, 15, - 5, 231, 104, 222, 59, 15, 5, 231, 104, 104, 231, 103, 15, 5, 231, 104, - 250, 95, 231, 103, 15, 5, 231, 104, 250, 95, 231, 104, 235, 173, 104, - 235, 172, 15, 5, 231, 98, 15, 5, 231, 99, 255, 10, 27, 254, 3, 15, 5, - 231, 99, 255, 10, 27, 252, 84, 15, 5, 231, 99, 255, 10, 27, 247, 107, 15, - 5, 231, 99, 255, 10, 27, 244, 11, 15, 5, 231, 99, 255, 10, 27, 238, 2, - 244, 3, 15, 5, 231, 99, 255, 10, 27, 236, 251, 15, 5, 231, 99, 255, 10, - 27, 235, 188, 15, 5, 231, 99, 255, 10, 27, 232, 141, 15, 5, 231, 99, 255, - 10, 27, 224, 121, 15, 5, 231, 99, 255, 10, 27, 220, 124, 15, 5, 231, 99, - 236, 91, 27, 252, 84, 15, 5, 231, 99, 236, 91, 27, 252, 85, 68, 15, 5, - 187, 15, 5, 230, 37, 15, 5, 230, 12, 15, 5, 229, 246, 15, 5, 229, 152, - 15, 5, 229, 108, 15, 5, 229, 109, 27, 60, 15, 5, 229, 109, 27, 255, 11, - 15, 5, 229, 109, 27, 252, 84, 15, 5, 229, 109, 27, 251, 248, 15, 5, 229, - 109, 27, 73, 15, 5, 229, 109, 27, 72, 15, 5, 229, 109, 27, 242, 69, 15, - 5, 229, 109, 27, 68, 15, 5, 229, 109, 27, 220, 124, 15, 5, 229, 109, 250, - 95, 229, 108, 15, 5, 229, 67, 15, 5, 229, 68, 27, 236, 236, 15, 5, 229, - 68, 27, 220, 115, 15, 5, 229, 68, 27, 217, 114, 15, 5, 229, 68, 230, 110, - 229, 67, 15, 5, 203, 15, 5, 227, 254, 15, 5, 227, 147, 15, 5, 227, 22, - 15, 5, 226, 177, 15, 5, 226, 166, 231, 90, 15, 5, 226, 165, 15, 5, 226, - 166, 27, 60, 15, 5, 226, 166, 27, 247, 111, 15, 5, 226, 166, 27, 247, - 109, 15, 5, 226, 166, 27, 155, 15, 5, 226, 166, 27, 236, 240, 15, 5, 226, - 166, 27, 235, 247, 15, 5, 226, 166, 27, 234, 219, 15, 5, 226, 166, 27, - 233, 196, 15, 5, 226, 166, 27, 231, 103, 15, 5, 226, 166, 27, 226, 156, - 15, 5, 226, 166, 27, 224, 219, 15, 5, 226, 166, 27, 222, 147, 15, 5, 226, - 166, 27, 220, 124, 15, 5, 226, 166, 27, 220, 121, 15, 5, 226, 166, 27, - 220, 94, 15, 5, 226, 166, 27, 220, 50, 15, 5, 226, 166, 27, 220, 30, 15, - 5, 226, 166, 104, 226, 165, 15, 5, 226, 166, 244, 3, 15, 5, 226, 156, 15, - 5, 226, 157, 235, 175, 27, 254, 5, 15, 5, 226, 138, 15, 5, 226, 131, 15, - 5, 225, 25, 15, 5, 225, 23, 15, 5, 225, 24, 27, 60, 15, 5, 225, 24, 27, - 252, 228, 15, 5, 225, 24, 27, 244, 81, 15, 5, 225, 24, 27, 232, 141, 15, - 5, 225, 24, 27, 224, 168, 15, 5, 225, 24, 27, 220, 240, 15, 5, 225, 24, - 27, 68, 15, 5, 225, 24, 27, 105, 88, 60, 15, 5, 225, 22, 15, 5, 225, 20, - 15, 5, 225, 3, 15, 5, 224, 246, 15, 5, 224, 247, 242, 173, 15, 5, 224, - 247, 104, 224, 247, 244, 248, 104, 244, 248, 244, 221, 104, 244, 220, 15, - 5, 224, 247, 104, 224, 247, 222, 148, 104, 222, 148, 244, 221, 104, 244, - 220, 15, 5, 224, 239, 15, 5, 224, 234, 15, 5, 224, 231, 15, 5, 224, 230, - 15, 5, 224, 227, 15, 5, 224, 219, 15, 5, 224, 220, 27, 60, 15, 5, 224, - 220, 27, 237, 238, 15, 5, 224, 213, 15, 5, 224, 214, 27, 60, 15, 5, 224, - 214, 27, 252, 217, 15, 5, 224, 214, 27, 251, 237, 15, 5, 224, 214, 27, - 248, 219, 15, 5, 224, 214, 27, 244, 220, 15, 5, 224, 214, 27, 238, 1, 15, - 5, 224, 214, 27, 238, 2, 244, 3, 15, 5, 224, 214, 27, 235, 242, 15, 5, - 224, 214, 27, 234, 221, 15, 5, 224, 214, 27, 233, 92, 15, 5, 224, 214, - 27, 226, 156, 15, 5, 224, 208, 15, 5, 224, 204, 15, 5, 224, 205, 222, 59, - 15, 5, 224, 205, 104, 224, 205, 251, 229, 104, 251, 228, 15, 5, 224, 202, - 15, 5, 224, 170, 15, 5, 224, 171, 104, 237, 170, 224, 170, 15, 5, 224, - 168, 15, 5, 224, 167, 15, 5, 224, 140, 15, 5, 224, 141, 244, 3, 15, 5, - 224, 132, 15, 5, 224, 130, 15, 5, 224, 131, 104, 224, 131, 224, 168, 15, - 5, 224, 123, 15, 5, 224, 121, 15, 5, 223, 103, 15, 5, 223, 104, 104, 223, - 103, 15, 5, 223, 83, 15, 5, 223, 82, 15, 5, 223, 81, 15, 5, 223, 74, 15, - 5, 223, 73, 15, 5, 223, 53, 15, 5, 223, 52, 15, 5, 222, 155, 15, 5, 222, - 156, 253, 251, 15, 5, 222, 156, 27, 243, 112, 15, 5, 222, 156, 27, 233, - 196, 15, 5, 222, 156, 244, 3, 15, 5, 222, 147, 15, 5, 222, 148, 104, 222, - 148, 232, 63, 104, 232, 63, 248, 203, 104, 248, 202, 15, 5, 222, 148, - 223, 226, 15, 5, 222, 141, 15, 5, 118, 27, 252, 84, 15, 5, 118, 27, 244, - 11, 15, 5, 118, 27, 224, 246, 15, 5, 118, 27, 224, 170, 15, 5, 118, 27, - 220, 253, 15, 5, 118, 27, 220, 115, 15, 5, 222, 130, 15, 5, 222, 112, 15, - 5, 222, 87, 15, 5, 222, 88, 244, 3, 15, 5, 221, 205, 15, 5, 221, 206, - 222, 59, 15, 5, 221, 181, 15, 5, 221, 165, 15, 5, 221, 166, 27, 222, 130, - 15, 5, 221, 166, 104, 221, 165, 15, 5, 221, 166, 104, 221, 166, 244, 248, - 104, 244, 248, 244, 221, 104, 244, 220, 15, 5, 221, 0, 15, 5, 220, 253, - 15, 5, 220, 251, 15, 5, 220, 249, 15, 5, 220, 240, 15, 5, 220, 241, 104, - 220, 241, 217, 115, 104, 217, 114, 15, 5, 68, 15, 5, 105, 244, 11, 15, 5, - 105, 105, 68, 15, 5, 105, 104, 105, 230, 44, 104, 230, 44, 244, 221, 104, - 244, 220, 15, 5, 105, 104, 105, 223, 54, 104, 223, 53, 15, 5, 105, 104, - 105, 105, 210, 104, 105, 227, 159, 15, 5, 220, 124, 15, 5, 220, 121, 15, - 5, 220, 115, 15, 5, 220, 116, 235, 242, 15, 5, 220, 116, 27, 252, 228, - 15, 5, 220, 116, 27, 233, 196, 15, 5, 220, 116, 27, 105, 88, 105, 88, 68, - 15, 5, 220, 116, 27, 105, 88, 105, 88, 105, 244, 3, 15, 5, 220, 116, 244, - 3, 15, 5, 220, 116, 224, 228, 15, 5, 220, 116, 224, 229, 27, 252, 228, - 15, 5, 220, 111, 15, 5, 220, 94, 15, 5, 220, 95, 27, 235, 174, 15, 5, - 220, 95, 27, 234, 26, 88, 249, 207, 15, 5, 220, 95, 27, 225, 23, 15, 5, - 220, 95, 27, 68, 15, 5, 220, 93, 15, 5, 220, 89, 15, 5, 220, 90, 27, 236, - 208, 15, 5, 220, 90, 27, 187, 15, 5, 220, 87, 15, 5, 220, 88, 244, 3, 15, - 5, 220, 50, 15, 5, 220, 51, 250, 95, 220, 50, 15, 5, 220, 51, 224, 228, - 15, 5, 220, 48, 15, 5, 220, 49, 27, 112, 88, 155, 15, 5, 220, 49, 27, - 112, 88, 208, 15, 5, 220, 49, 27, 254, 175, 15, 5, 220, 49, 27, 155, 15, - 5, 220, 49, 27, 231, 103, 15, 5, 220, 49, 27, 220, 124, 15, 5, 220, 49, - 27, 220, 125, 88, 254, 7, 15, 5, 220, 49, 27, 220, 125, 88, 252, 84, 15, - 5, 220, 47, 15, 5, 220, 44, 15, 5, 220, 43, 15, 5, 220, 40, 15, 5, 220, - 41, 27, 60, 15, 5, 220, 41, 27, 254, 3, 15, 5, 220, 41, 27, 135, 15, 5, - 220, 41, 27, 247, 101, 15, 5, 220, 41, 27, 245, 0, 15, 5, 220, 41, 27, - 244, 240, 15, 5, 220, 41, 27, 244, 229, 222, 59, 15, 5, 220, 41, 27, 244, - 220, 15, 5, 220, 41, 27, 244, 17, 15, 5, 220, 41, 27, 155, 15, 5, 220, - 41, 27, 238, 1, 15, 5, 220, 41, 27, 237, 238, 15, 5, 220, 41, 27, 237, - 145, 15, 5, 220, 41, 27, 236, 113, 15, 5, 220, 41, 27, 234, 219, 15, 5, - 220, 41, 27, 233, 159, 15, 5, 220, 41, 27, 187, 15, 5, 220, 41, 27, 224, - 246, 15, 5, 220, 41, 27, 224, 130, 15, 5, 220, 41, 27, 221, 0, 15, 5, - 220, 41, 27, 105, 88, 244, 11, 15, 5, 220, 41, 27, 220, 115, 15, 5, 220, - 41, 27, 220, 38, 15, 5, 220, 38, 15, 5, 220, 39, 27, 68, 15, 5, 220, 30, - 15, 5, 220, 31, 27, 60, 15, 5, 220, 31, 27, 236, 7, 15, 5, 220, 31, 27, - 235, 247, 15, 5, 220, 31, 27, 222, 130, 15, 5, 220, 27, 15, 5, 220, 29, - 15, 5, 220, 28, 15, 5, 220, 24, 15, 5, 220, 13, 15, 5, 220, 14, 27, 236, - 208, 15, 5, 220, 12, 15, 5, 217, 114, 15, 5, 217, 115, 222, 59, 15, 5, - 217, 115, 204, 27, 235, 247, 15, 5, 217, 111, 15, 5, 217, 104, 15, 5, - 217, 91, 15, 5, 217, 42, 15, 5, 217, 43, 104, 217, 42, 15, 5, 217, 41, - 15, 5, 217, 39, 15, 5, 217, 40, 236, 254, 222, 59, 15, 5, 217, 34, 15, 5, - 217, 26, 15, 5, 217, 13, 15, 5, 217, 11, 15, 5, 217, 12, 27, 60, 15, 5, - 217, 10, 15, 5, 217, 9, 15, 120, 5, 124, 254, 7, 15, 120, 5, 148, 254, 7, - 15, 120, 5, 245, 116, 254, 7, 15, 120, 5, 245, 170, 254, 7, 15, 120, 5, - 224, 82, 254, 7, 15, 120, 5, 225, 43, 254, 7, 15, 120, 5, 246, 235, 254, - 7, 15, 120, 5, 232, 31, 254, 7, 15, 120, 5, 148, 248, 202, 15, 120, 5, - 245, 116, 248, 202, 15, 120, 5, 245, 170, 248, 202, 15, 120, 5, 224, 82, - 248, 202, 15, 120, 5, 225, 43, 248, 202, 15, 120, 5, 246, 235, 248, 202, - 15, 120, 5, 232, 31, 248, 202, 15, 120, 5, 245, 116, 68, 15, 120, 5, 245, - 170, 68, 15, 120, 5, 224, 82, 68, 15, 120, 5, 225, 43, 68, 15, 120, 5, - 246, 235, 68, 15, 120, 5, 232, 31, 68, 15, 120, 5, 131, 244, 168, 15, - 120, 5, 124, 244, 168, 15, 120, 5, 148, 244, 168, 15, 120, 5, 245, 116, - 244, 168, 15, 120, 5, 245, 170, 244, 168, 15, 120, 5, 224, 82, 244, 168, - 15, 120, 5, 225, 43, 244, 168, 15, 120, 5, 246, 235, 244, 168, 15, 120, - 5, 232, 31, 244, 168, 15, 120, 5, 131, 244, 165, 15, 120, 5, 124, 244, - 165, 15, 120, 5, 148, 244, 165, 15, 120, 5, 245, 116, 244, 165, 15, 120, - 5, 245, 170, 244, 165, 15, 120, 5, 124, 225, 3, 15, 120, 5, 148, 225, 3, - 15, 120, 5, 148, 225, 4, 219, 177, 17, 15, 120, 5, 245, 116, 225, 3, 15, - 120, 5, 245, 170, 225, 3, 15, 120, 5, 224, 82, 225, 3, 15, 120, 5, 225, - 43, 225, 3, 15, 120, 5, 246, 235, 225, 3, 15, 120, 5, 232, 31, 225, 3, - 15, 120, 5, 131, 224, 254, 15, 120, 5, 124, 224, 254, 15, 120, 5, 148, - 224, 254, 15, 120, 5, 148, 224, 255, 219, 177, 17, 15, 120, 5, 245, 116, - 224, 254, 15, 120, 5, 245, 170, 224, 254, 15, 120, 5, 225, 4, 27, 244, - 241, 88, 248, 202, 15, 120, 5, 225, 4, 27, 244, 241, 88, 233, 159, 15, - 120, 5, 131, 251, 225, 15, 120, 5, 124, 251, 225, 15, 120, 5, 148, 251, - 225, 15, 120, 5, 148, 251, 226, 219, 177, 17, 15, 120, 5, 245, 116, 251, - 225, 15, 120, 5, 245, 170, 251, 225, 15, 120, 5, 148, 219, 177, 245, 124, - 246, 132, 15, 120, 5, 148, 219, 177, 245, 124, 246, 129, 15, 120, 5, 245, - 116, 219, 177, 245, 124, 235, 47, 15, 120, 5, 245, 116, 219, 177, 245, - 124, 235, 45, 15, 120, 5, 245, 116, 219, 177, 245, 124, 235, 48, 60, 15, - 120, 5, 245, 116, 219, 177, 245, 124, 235, 48, 253, 204, 15, 120, 5, 224, - 82, 219, 177, 245, 124, 254, 4, 15, 120, 5, 225, 43, 219, 177, 245, 124, - 237, 230, 15, 120, 5, 225, 43, 219, 177, 245, 124, 237, 232, 60, 15, 120, - 5, 225, 43, 219, 177, 245, 124, 237, 232, 253, 204, 15, 120, 5, 246, 235, - 219, 177, 245, 124, 220, 26, 15, 120, 5, 246, 235, 219, 177, 245, 124, - 220, 25, 15, 120, 5, 232, 31, 219, 177, 245, 124, 237, 246, 15, 120, 5, - 232, 31, 219, 177, 245, 124, 237, 245, 15, 120, 5, 232, 31, 219, 177, - 245, 124, 237, 244, 15, 120, 5, 232, 31, 219, 177, 245, 124, 237, 247, - 60, 15, 120, 5, 124, 254, 8, 222, 59, 15, 120, 5, 148, 254, 8, 222, 59, - 15, 120, 5, 245, 116, 254, 8, 222, 59, 15, 120, 5, 245, 170, 254, 8, 222, - 59, 15, 120, 5, 224, 82, 254, 8, 222, 59, 15, 120, 5, 131, 252, 207, 15, - 120, 5, 124, 252, 207, 15, 120, 5, 148, 252, 207, 15, 120, 5, 245, 116, - 252, 207, 15, 120, 5, 245, 116, 252, 208, 219, 177, 17, 15, 120, 5, 245, - 170, 252, 207, 15, 120, 5, 245, 170, 252, 208, 219, 177, 17, 15, 120, 5, - 232, 40, 15, 120, 5, 232, 41, 15, 120, 5, 131, 246, 128, 15, 120, 5, 124, - 246, 128, 15, 120, 5, 131, 221, 252, 248, 202, 15, 120, 5, 124, 221, 250, - 248, 202, 15, 120, 5, 245, 170, 224, 72, 248, 202, 15, 120, 5, 131, 221, - 252, 219, 177, 245, 124, 60, 15, 120, 5, 124, 221, 250, 219, 177, 245, - 124, 60, 15, 120, 5, 131, 246, 232, 254, 7, 15, 120, 5, 131, 228, 90, - 254, 7, 15, 120, 5, 48, 253, 254, 131, 224, 73, 15, 120, 5, 48, 253, 254, - 131, 228, 89, 15, 228, 197, 5, 48, 253, 254, 218, 174, 248, 191, 15, 228, - 197, 5, 69, 250, 175, 15, 228, 197, 5, 249, 11, 250, 175, 15, 228, 197, - 5, 249, 11, 221, 86, 10, 11, 255, 140, 10, 11, 255, 139, 10, 11, 255, - 138, 10, 11, 255, 137, 10, 11, 255, 136, 10, 11, 255, 135, 10, 11, 255, - 134, 10, 11, 255, 133, 10, 11, 255, 132, 10, 11, 255, 131, 10, 11, 255, - 130, 10, 11, 255, 129, 10, 11, 255, 128, 10, 11, 255, 127, 10, 11, 255, - 126, 10, 11, 255, 125, 10, 11, 255, 124, 10, 11, 255, 123, 10, 11, 255, - 122, 10, 11, 255, 121, 10, 11, 255, 120, 10, 11, 255, 119, 10, 11, 255, - 118, 10, 11, 255, 117, 10, 11, 255, 116, 10, 11, 255, 115, 10, 11, 255, - 114, 10, 11, 255, 113, 10, 11, 255, 112, 10, 11, 255, 111, 10, 11, 255, - 110, 10, 11, 255, 109, 10, 11, 255, 108, 10, 11, 255, 107, 10, 11, 255, - 106, 10, 11, 255, 105, 10, 11, 255, 104, 10, 11, 255, 103, 10, 11, 255, - 102, 10, 11, 255, 101, 10, 11, 255, 100, 10, 11, 255, 99, 10, 11, 255, - 98, 10, 11, 255, 97, 10, 11, 255, 96, 10, 11, 255, 95, 10, 11, 255, 94, - 10, 11, 255, 93, 10, 11, 255, 92, 10, 11, 255, 91, 10, 11, 255, 90, 10, - 11, 255, 89, 10, 11, 255, 88, 10, 11, 255, 87, 10, 11, 255, 86, 10, 11, - 255, 85, 10, 11, 255, 84, 10, 11, 255, 83, 10, 11, 255, 82, 10, 11, 255, - 81, 10, 11, 255, 80, 10, 11, 255, 79, 10, 11, 255, 78, 10, 11, 255, 77, - 10, 11, 255, 76, 10, 11, 255, 75, 10, 11, 255, 74, 10, 11, 255, 73, 10, - 11, 255, 72, 10, 11, 255, 71, 10, 11, 255, 70, 10, 11, 255, 69, 10, 11, - 255, 68, 10, 11, 255, 67, 10, 11, 255, 66, 10, 11, 255, 65, 10, 11, 255, - 64, 10, 11, 255, 63, 10, 11, 255, 62, 10, 11, 255, 61, 10, 11, 253, 202, - 10, 11, 253, 200, 10, 11, 253, 198, 10, 11, 253, 196, 10, 11, 253, 194, - 10, 11, 253, 193, 10, 11, 253, 191, 10, 11, 253, 189, 10, 11, 253, 187, - 10, 11, 253, 185, 10, 11, 251, 198, 10, 11, 251, 197, 10, 11, 251, 196, - 10, 11, 251, 195, 10, 11, 251, 194, 10, 11, 251, 193, 10, 11, 251, 192, - 10, 11, 251, 191, 10, 11, 251, 190, 10, 11, 251, 189, 10, 11, 251, 188, - 10, 11, 251, 187, 10, 11, 251, 186, 10, 11, 251, 185, 10, 11, 251, 184, - 10, 11, 251, 183, 10, 11, 251, 182, 10, 11, 251, 181, 10, 11, 251, 180, - 10, 11, 251, 179, 10, 11, 251, 178, 10, 11, 251, 177, 10, 11, 251, 176, - 10, 11, 251, 175, 10, 11, 251, 174, 10, 11, 251, 173, 10, 11, 251, 172, - 10, 11, 251, 171, 10, 11, 250, 45, 10, 11, 250, 44, 10, 11, 250, 43, 10, - 11, 250, 42, 10, 11, 250, 41, 10, 11, 250, 40, 10, 11, 250, 39, 10, 11, - 250, 38, 10, 11, 250, 37, 10, 11, 250, 36, 10, 11, 250, 35, 10, 11, 250, - 34, 10, 11, 250, 33, 10, 11, 250, 32, 10, 11, 250, 31, 10, 11, 250, 30, - 10, 11, 250, 29, 10, 11, 250, 28, 10, 11, 250, 27, 10, 11, 250, 26, 10, - 11, 250, 25, 10, 11, 250, 24, 10, 11, 250, 23, 10, 11, 250, 22, 10, 11, - 250, 21, 10, 11, 250, 20, 10, 11, 250, 19, 10, 11, 250, 18, 10, 11, 250, - 17, 10, 11, 250, 16, 10, 11, 250, 15, 10, 11, 250, 14, 10, 11, 250, 13, - 10, 11, 250, 12, 10, 11, 250, 11, 10, 11, 250, 10, 10, 11, 250, 9, 10, - 11, 250, 8, 10, 11, 250, 7, 10, 11, 250, 6, 10, 11, 250, 5, 10, 11, 250, - 4, 10, 11, 250, 3, 10, 11, 250, 2, 10, 11, 250, 1, 10, 11, 250, 0, 10, - 11, 249, 255, 10, 11, 249, 254, 10, 11, 249, 253, 10, 11, 249, 252, 10, - 11, 249, 251, 10, 11, 249, 250, 10, 11, 249, 249, 10, 11, 249, 248, 10, - 11, 249, 247, 10, 11, 249, 246, 10, 11, 249, 245, 10, 11, 249, 244, 10, - 11, 249, 243, 10, 11, 249, 242, 10, 11, 249, 241, 10, 11, 249, 240, 10, - 11, 249, 239, 10, 11, 249, 238, 10, 11, 249, 237, 10, 11, 249, 236, 10, - 11, 249, 235, 10, 11, 249, 234, 10, 11, 249, 233, 10, 11, 249, 232, 10, - 11, 249, 231, 10, 11, 249, 230, 10, 11, 249, 229, 10, 11, 249, 228, 10, - 11, 249, 227, 10, 11, 249, 226, 10, 11, 249, 225, 10, 11, 249, 224, 10, - 11, 249, 223, 10, 11, 249, 222, 10, 11, 249, 221, 10, 11, 249, 220, 10, - 11, 249, 219, 10, 11, 249, 218, 10, 11, 249, 217, 10, 11, 249, 216, 10, - 11, 249, 215, 10, 11, 249, 214, 10, 11, 249, 213, 10, 11, 249, 212, 10, - 11, 249, 211, 10, 11, 249, 210, 10, 11, 247, 62, 10, 11, 247, 61, 10, 11, - 247, 60, 10, 11, 247, 59, 10, 11, 247, 58, 10, 11, 247, 57, 10, 11, 247, - 56, 10, 11, 247, 55, 10, 11, 247, 54, 10, 11, 247, 53, 10, 11, 247, 52, - 10, 11, 247, 51, 10, 11, 247, 50, 10, 11, 247, 49, 10, 11, 247, 48, 10, - 11, 247, 47, 10, 11, 247, 46, 10, 11, 247, 45, 10, 11, 247, 44, 10, 11, - 247, 43, 10, 11, 247, 42, 10, 11, 247, 41, 10, 11, 247, 40, 10, 11, 247, - 39, 10, 11, 247, 38, 10, 11, 247, 37, 10, 11, 247, 36, 10, 11, 247, 35, - 10, 11, 247, 34, 10, 11, 247, 33, 10, 11, 247, 32, 10, 11, 247, 31, 10, - 11, 247, 30, 10, 11, 247, 29, 10, 11, 247, 28, 10, 11, 247, 27, 10, 11, - 247, 26, 10, 11, 247, 25, 10, 11, 247, 24, 10, 11, 247, 23, 10, 11, 247, - 22, 10, 11, 247, 21, 10, 11, 247, 20, 10, 11, 247, 19, 10, 11, 246, 73, - 10, 11, 246, 72, 10, 11, 246, 71, 10, 11, 246, 70, 10, 11, 246, 69, 10, - 11, 246, 68, 10, 11, 246, 67, 10, 11, 246, 66, 10, 11, 246, 65, 10, 11, - 246, 64, 10, 11, 246, 63, 10, 11, 246, 62, 10, 11, 246, 61, 10, 11, 246, - 60, 10, 11, 246, 59, 10, 11, 246, 58, 10, 11, 246, 57, 10, 11, 246, 56, - 10, 11, 246, 55, 10, 11, 246, 54, 10, 11, 246, 53, 10, 11, 246, 52, 10, - 11, 246, 51, 10, 11, 246, 50, 10, 11, 246, 49, 10, 11, 246, 48, 10, 11, - 246, 47, 10, 11, 246, 46, 10, 11, 246, 45, 10, 11, 246, 44, 10, 11, 246, - 43, 10, 11, 246, 42, 10, 11, 246, 41, 10, 11, 246, 40, 10, 11, 246, 39, - 10, 11, 246, 38, 10, 11, 246, 37, 10, 11, 246, 36, 10, 11, 246, 35, 10, - 11, 246, 34, 10, 11, 246, 33, 10, 11, 246, 32, 10, 11, 246, 31, 10, 11, - 246, 30, 10, 11, 246, 29, 10, 11, 246, 28, 10, 11, 246, 27, 10, 11, 246, - 26, 10, 11, 246, 25, 10, 11, 246, 24, 10, 11, 246, 23, 10, 11, 246, 22, - 10, 11, 246, 21, 10, 11, 246, 20, 10, 11, 246, 19, 10, 11, 246, 18, 10, - 11, 246, 17, 10, 11, 246, 16, 10, 11, 246, 15, 10, 11, 246, 14, 10, 11, - 246, 13, 10, 11, 246, 12, 10, 11, 246, 11, 10, 11, 246, 10, 10, 11, 246, - 9, 10, 11, 245, 66, 10, 11, 245, 65, 10, 11, 245, 64, 10, 11, 245, 63, - 10, 11, 245, 62, 10, 11, 245, 61, 10, 11, 245, 60, 10, 11, 245, 59, 10, - 11, 245, 58, 10, 11, 245, 57, 10, 11, 245, 56, 10, 11, 245, 55, 10, 11, - 245, 54, 10, 11, 245, 53, 10, 11, 245, 52, 10, 11, 245, 51, 10, 11, 245, - 50, 10, 11, 245, 49, 10, 11, 245, 48, 10, 11, 245, 47, 10, 11, 245, 46, - 10, 11, 245, 45, 10, 11, 245, 44, 10, 11, 245, 43, 10, 11, 245, 42, 10, - 11, 245, 41, 10, 11, 245, 40, 10, 11, 245, 39, 10, 11, 245, 38, 10, 11, - 245, 37, 10, 11, 245, 36, 10, 11, 245, 35, 10, 11, 245, 34, 10, 11, 245, - 33, 10, 11, 245, 32, 10, 11, 245, 31, 10, 11, 245, 30, 10, 11, 245, 29, - 10, 11, 245, 28, 10, 11, 245, 27, 10, 11, 245, 26, 10, 11, 245, 25, 10, - 11, 245, 24, 10, 11, 245, 23, 10, 11, 245, 22, 10, 11, 245, 21, 10, 11, - 245, 20, 10, 11, 245, 19, 10, 11, 245, 18, 10, 11, 245, 17, 10, 11, 245, - 16, 10, 11, 245, 15, 10, 11, 245, 14, 10, 11, 245, 13, 10, 11, 245, 12, - 10, 11, 245, 11, 10, 11, 245, 10, 10, 11, 245, 9, 10, 11, 245, 8, 10, 11, - 245, 7, 10, 11, 245, 6, 10, 11, 245, 5, 10, 11, 245, 4, 10, 11, 245, 3, - 10, 11, 243, 223, 10, 11, 243, 222, 10, 11, 243, 221, 10, 11, 243, 220, - 10, 11, 243, 219, 10, 11, 243, 218, 10, 11, 243, 217, 10, 11, 243, 216, - 10, 11, 243, 215, 10, 11, 242, 91, 10, 11, 242, 90, 10, 11, 242, 89, 10, - 11, 242, 88, 10, 11, 242, 87, 10, 11, 242, 86, 10, 11, 242, 85, 10, 11, - 242, 84, 10, 11, 242, 83, 10, 11, 242, 82, 10, 11, 242, 81, 10, 11, 242, - 80, 10, 11, 242, 79, 10, 11, 242, 78, 10, 11, 242, 77, 10, 11, 242, 76, - 10, 11, 242, 75, 10, 11, 242, 74, 10, 11, 242, 73, 10, 11, 237, 16, 10, - 11, 237, 15, 10, 11, 237, 14, 10, 11, 237, 13, 10, 11, 237, 12, 10, 11, - 237, 11, 10, 11, 237, 10, 10, 11, 237, 9, 10, 11, 235, 199, 10, 11, 235, - 198, 10, 11, 235, 197, 10, 11, 235, 196, 10, 11, 235, 195, 10, 11, 235, - 194, 10, 11, 235, 193, 10, 11, 235, 192, 10, 11, 235, 191, 10, 11, 235, - 190, 10, 11, 234, 186, 10, 11, 234, 185, 10, 11, 234, 184, 10, 11, 234, - 183, 10, 11, 234, 182, 10, 11, 234, 181, 10, 11, 234, 180, 10, 11, 234, - 179, 10, 11, 234, 178, 10, 11, 234, 177, 10, 11, 234, 176, 10, 11, 234, - 175, 10, 11, 234, 174, 10, 11, 234, 173, 10, 11, 234, 172, 10, 11, 234, - 171, 10, 11, 234, 170, 10, 11, 234, 169, 10, 11, 234, 168, 10, 11, 234, - 167, 10, 11, 234, 166, 10, 11, 234, 165, 10, 11, 234, 164, 10, 11, 234, - 163, 10, 11, 234, 162, 10, 11, 234, 161, 10, 11, 234, 160, 10, 11, 234, - 159, 10, 11, 234, 158, 10, 11, 234, 157, 10, 11, 234, 156, 10, 11, 234, - 155, 10, 11, 234, 154, 10, 11, 234, 153, 10, 11, 234, 152, 10, 11, 234, - 151, 10, 11, 234, 150, 10, 11, 234, 149, 10, 11, 234, 148, 10, 11, 234, - 147, 10, 11, 234, 146, 10, 11, 234, 145, 10, 11, 234, 144, 10, 11, 234, - 143, 10, 11, 234, 142, 10, 11, 234, 141, 10, 11, 234, 140, 10, 11, 234, - 139, 10, 11, 234, 138, 10, 11, 234, 137, 10, 11, 234, 136, 10, 11, 234, - 135, 10, 11, 234, 134, 10, 11, 234, 133, 10, 11, 234, 132, 10, 11, 234, - 131, 10, 11, 234, 130, 10, 11, 234, 129, 10, 11, 234, 128, 10, 11, 234, - 127, 10, 11, 234, 126, 10, 11, 234, 125, 10, 11, 234, 124, 10, 11, 234, - 123, 10, 11, 234, 122, 10, 11, 234, 121, 10, 11, 233, 31, 10, 11, 233, - 30, 10, 11, 233, 29, 10, 11, 233, 28, 10, 11, 233, 27, 10, 11, 233, 26, - 10, 11, 233, 25, 10, 11, 233, 24, 10, 11, 233, 23, 10, 11, 233, 22, 10, - 11, 233, 21, 10, 11, 233, 20, 10, 11, 233, 19, 10, 11, 233, 18, 10, 11, - 233, 17, 10, 11, 233, 16, 10, 11, 233, 15, 10, 11, 233, 14, 10, 11, 233, - 13, 10, 11, 233, 12, 10, 11, 233, 11, 10, 11, 233, 10, 10, 11, 233, 9, - 10, 11, 233, 8, 10, 11, 233, 7, 10, 11, 233, 6, 10, 11, 233, 5, 10, 11, - 233, 4, 10, 11, 233, 3, 10, 11, 233, 2, 10, 11, 233, 1, 10, 11, 233, 0, - 10, 11, 232, 255, 10, 11, 232, 254, 10, 11, 232, 253, 10, 11, 232, 252, - 10, 11, 232, 251, 10, 11, 232, 250, 10, 11, 232, 249, 10, 11, 232, 248, - 10, 11, 232, 247, 10, 11, 232, 246, 10, 11, 232, 245, 10, 11, 232, 244, - 10, 11, 232, 243, 10, 11, 232, 242, 10, 11, 232, 241, 10, 11, 232, 240, - 10, 11, 232, 239, 10, 11, 231, 241, 10, 11, 231, 240, 10, 11, 231, 239, - 10, 11, 231, 238, 10, 11, 231, 237, 10, 11, 231, 236, 10, 11, 231, 235, - 10, 11, 231, 234, 10, 11, 231, 233, 10, 11, 231, 232, 10, 11, 231, 231, - 10, 11, 231, 230, 10, 11, 231, 229, 10, 11, 231, 228, 10, 11, 231, 227, - 10, 11, 231, 226, 10, 11, 231, 225, 10, 11, 231, 224, 10, 11, 231, 223, - 10, 11, 231, 222, 10, 11, 231, 221, 10, 11, 231, 220, 10, 11, 231, 143, - 10, 11, 231, 142, 10, 11, 231, 141, 10, 11, 231, 140, 10, 11, 231, 139, - 10, 11, 231, 138, 10, 11, 231, 137, 10, 11, 231, 136, 10, 11, 231, 135, - 10, 11, 231, 134, 10, 11, 231, 133, 10, 11, 231, 132, 10, 11, 231, 131, - 10, 11, 231, 130, 10, 11, 231, 129, 10, 11, 231, 128, 10, 11, 231, 127, - 10, 11, 231, 126, 10, 11, 231, 125, 10, 11, 231, 124, 10, 11, 231, 123, - 10, 11, 231, 122, 10, 11, 231, 121, 10, 11, 231, 120, 10, 11, 231, 119, - 10, 11, 231, 118, 10, 11, 231, 5, 10, 11, 231, 4, 10, 11, 231, 3, 10, 11, - 231, 2, 10, 11, 231, 1, 10, 11, 231, 0, 10, 11, 230, 255, 10, 11, 230, - 254, 10, 11, 230, 253, 10, 11, 230, 252, 10, 11, 230, 251, 10, 11, 230, - 250, 10, 11, 230, 249, 10, 11, 230, 248, 10, 11, 230, 247, 10, 11, 230, - 246, 10, 11, 230, 245, 10, 11, 230, 244, 10, 11, 230, 243, 10, 11, 230, - 242, 10, 11, 230, 241, 10, 11, 230, 240, 10, 11, 230, 239, 10, 11, 230, - 238, 10, 11, 230, 237, 10, 11, 230, 236, 10, 11, 230, 235, 10, 11, 230, - 234, 10, 11, 230, 233, 10, 11, 230, 232, 10, 11, 230, 231, 10, 11, 230, - 230, 10, 11, 230, 229, 10, 11, 230, 228, 10, 11, 230, 227, 10, 11, 230, - 226, 10, 11, 230, 225, 10, 11, 230, 224, 10, 11, 230, 223, 10, 11, 230, - 222, 10, 11, 230, 221, 10, 11, 230, 220, 10, 11, 230, 219, 10, 11, 230, - 218, 10, 11, 230, 217, 10, 11, 230, 216, 10, 11, 230, 215, 10, 11, 230, - 214, 10, 11, 230, 213, 10, 11, 230, 212, 10, 11, 230, 211, 10, 11, 230, - 210, 10, 11, 230, 209, 10, 11, 230, 208, 10, 11, 230, 207, 10, 11, 230, - 206, 10, 11, 230, 205, 10, 11, 230, 204, 10, 11, 230, 203, 10, 11, 230, - 202, 10, 11, 230, 201, 10, 11, 230, 200, 10, 11, 230, 199, 10, 11, 230, - 198, 10, 11, 230, 197, 10, 11, 230, 196, 10, 11, 230, 195, 10, 11, 230, - 194, 10, 11, 230, 193, 10, 11, 230, 192, 10, 11, 230, 191, 10, 11, 230, - 190, 10, 11, 230, 189, 10, 11, 230, 188, 10, 11, 230, 187, 10, 11, 230, - 58, 10, 11, 230, 57, 10, 11, 230, 56, 10, 11, 230, 55, 10, 11, 230, 54, - 10, 11, 230, 53, 10, 11, 230, 52, 10, 11, 230, 51, 10, 11, 230, 50, 10, - 11, 230, 49, 10, 11, 230, 48, 10, 11, 230, 47, 10, 11, 230, 46, 10, 11, - 228, 162, 10, 11, 228, 161, 10, 11, 228, 160, 10, 11, 228, 159, 10, 11, - 228, 158, 10, 11, 228, 157, 10, 11, 228, 156, 10, 11, 228, 37, 10, 11, - 228, 36, 10, 11, 228, 35, 10, 11, 228, 34, 10, 11, 228, 33, 10, 11, 228, - 32, 10, 11, 228, 31, 10, 11, 228, 30, 10, 11, 228, 29, 10, 11, 228, 28, - 10, 11, 228, 27, 10, 11, 228, 26, 10, 11, 228, 25, 10, 11, 228, 24, 10, - 11, 228, 23, 10, 11, 228, 22, 10, 11, 228, 21, 10, 11, 228, 20, 10, 11, - 228, 19, 10, 11, 228, 18, 10, 11, 228, 17, 10, 11, 228, 16, 10, 11, 228, - 15, 10, 11, 228, 14, 10, 11, 228, 13, 10, 11, 228, 12, 10, 11, 228, 11, - 10, 11, 228, 10, 10, 11, 228, 9, 10, 11, 228, 8, 10, 11, 228, 7, 10, 11, - 228, 6, 10, 11, 228, 5, 10, 11, 228, 4, 10, 11, 226, 232, 10, 11, 226, - 231, 10, 11, 226, 230, 10, 11, 226, 229, 10, 11, 226, 228, 10, 11, 226, - 227, 10, 11, 226, 226, 10, 11, 226, 225, 10, 11, 226, 224, 10, 11, 226, - 223, 10, 11, 226, 222, 10, 11, 226, 221, 10, 11, 226, 220, 10, 11, 226, - 219, 10, 11, 226, 218, 10, 11, 226, 217, 10, 11, 226, 216, 10, 11, 226, - 215, 10, 11, 226, 214, 10, 11, 226, 213, 10, 11, 226, 212, 10, 11, 226, - 211, 10, 11, 226, 210, 10, 11, 226, 209, 10, 11, 226, 208, 10, 11, 226, - 207, 10, 11, 226, 206, 10, 11, 226, 205, 10, 11, 226, 204, 10, 11, 226, - 203, 10, 11, 226, 202, 10, 11, 226, 201, 10, 11, 226, 200, 10, 11, 226, - 199, 10, 11, 226, 198, 10, 11, 226, 197, 10, 11, 226, 196, 10, 11, 226, - 195, 10, 11, 226, 194, 10, 11, 226, 193, 10, 11, 226, 192, 10, 11, 226, - 191, 10, 11, 226, 190, 10, 11, 226, 189, 10, 11, 226, 188, 10, 11, 226, - 187, 10, 11, 226, 186, 10, 11, 226, 185, 10, 11, 226, 184, 10, 11, 226, - 183, 10, 11, 226, 182, 10, 11, 226, 181, 10, 11, 226, 180, 10, 11, 226, - 179, 10, 11, 222, 200, 10, 11, 222, 199, 10, 11, 222, 198, 10, 11, 222, - 197, 10, 11, 222, 196, 10, 11, 222, 195, 10, 11, 222, 194, 10, 11, 222, - 193, 10, 11, 222, 192, 10, 11, 222, 191, 10, 11, 222, 190, 10, 11, 222, - 189, 10, 11, 222, 188, 10, 11, 222, 187, 10, 11, 222, 186, 10, 11, 222, - 185, 10, 11, 222, 184, 10, 11, 222, 183, 10, 11, 222, 182, 10, 11, 222, - 181, 10, 11, 222, 180, 10, 11, 222, 179, 10, 11, 222, 178, 10, 11, 222, - 177, 10, 11, 222, 176, 10, 11, 222, 175, 10, 11, 222, 174, 10, 11, 222, - 173, 10, 11, 222, 172, 10, 11, 222, 171, 10, 11, 222, 170, 10, 11, 222, - 169, 10, 11, 222, 168, 10, 11, 222, 167, 10, 11, 222, 166, 10, 11, 222, - 165, 10, 11, 222, 164, 10, 11, 222, 163, 10, 11, 222, 162, 10, 11, 222, - 161, 10, 11, 222, 160, 10, 11, 222, 159, 10, 11, 222, 158, 10, 11, 222, - 157, 10, 11, 220, 172, 10, 11, 220, 171, 10, 11, 220, 170, 10, 11, 220, - 169, 10, 11, 220, 168, 10, 11, 220, 167, 10, 11, 220, 166, 10, 11, 220, - 165, 10, 11, 220, 164, 10, 11, 220, 163, 10, 11, 220, 162, 10, 11, 220, - 161, 10, 11, 220, 160, 10, 11, 220, 159, 10, 11, 220, 158, 10, 11, 220, - 157, 10, 11, 220, 156, 10, 11, 220, 155, 10, 11, 220, 154, 10, 11, 220, - 153, 10, 11, 220, 152, 10, 11, 220, 151, 10, 11, 220, 150, 10, 11, 220, - 149, 10, 11, 220, 148, 10, 11, 220, 147, 10, 11, 220, 146, 10, 11, 220, - 145, 10, 11, 220, 144, 10, 11, 220, 143, 10, 11, 220, 142, 10, 11, 220, - 141, 10, 11, 220, 140, 10, 11, 220, 139, 10, 11, 220, 138, 10, 11, 220, - 137, 10, 11, 220, 136, 10, 11, 220, 135, 10, 11, 220, 134, 10, 11, 220, - 133, 10, 11, 220, 132, 10, 11, 220, 131, 10, 11, 220, 130, 10, 11, 220, - 129, 10, 11, 220, 128, 10, 11, 220, 127, 10, 11, 220, 126, 10, 11, 220, - 10, 10, 11, 220, 9, 10, 11, 220, 8, 10, 11, 220, 7, 10, 11, 220, 6, 10, - 11, 220, 5, 10, 11, 220, 4, 10, 11, 220, 3, 10, 11, 220, 2, 10, 11, 220, - 1, 10, 11, 220, 0, 10, 11, 219, 255, 10, 11, 219, 254, 10, 11, 219, 253, - 10, 11, 219, 252, 10, 11, 219, 251, 10, 11, 219, 250, 10, 11, 219, 249, - 10, 11, 219, 248, 10, 11, 219, 247, 10, 11, 219, 246, 10, 11, 219, 245, - 10, 11, 219, 244, 10, 11, 219, 243, 10, 11, 219, 242, 10, 11, 219, 241, - 10, 11, 219, 240, 10, 11, 219, 239, 10, 11, 219, 238, 10, 11, 219, 237, - 10, 11, 219, 236, 10, 11, 219, 235, 10, 11, 219, 234, 10, 11, 219, 233, - 10, 11, 219, 232, 10, 11, 219, 231, 10, 11, 219, 230, 10, 11, 219, 229, - 10, 11, 219, 228, 10, 11, 219, 227, 10, 11, 219, 226, 10, 11, 219, 225, - 10, 11, 219, 224, 10, 11, 219, 223, 10, 11, 219, 222, 10, 11, 219, 221, - 10, 11, 219, 220, 10, 11, 219, 219, 10, 11, 219, 218, 10, 11, 219, 217, - 10, 11, 219, 216, 10, 11, 219, 215, 10, 11, 219, 214, 10, 11, 219, 213, - 10, 11, 219, 212, 10, 11, 219, 211, 10, 11, 219, 210, 10, 11, 219, 209, - 10, 11, 219, 208, 10, 11, 219, 207, 10, 11, 219, 206, 10, 11, 219, 205, - 10, 11, 219, 204, 10, 11, 219, 203, 10, 11, 219, 202, 10, 11, 219, 201, - 10, 11, 219, 200, 10, 11, 219, 199, 10, 11, 219, 198, 10, 11, 219, 197, - 10, 11, 219, 196, 10, 11, 219, 195, 10, 11, 219, 194, 10, 11, 219, 193, - 10, 11, 219, 192, 10, 11, 219, 191, 10, 11, 219, 190, 10, 11, 219, 39, - 10, 11, 219, 38, 10, 11, 219, 37, 10, 11, 219, 36, 10, 11, 219, 35, 10, - 11, 219, 34, 10, 11, 219, 33, 10, 11, 219, 32, 10, 11, 219, 31, 10, 11, - 219, 30, 10, 11, 219, 29, 10, 11, 219, 28, 10, 11, 219, 27, 10, 11, 219, - 26, 10, 11, 219, 25, 10, 11, 219, 24, 10, 11, 219, 23, 10, 11, 219, 22, - 10, 11, 219, 21, 10, 11, 219, 20, 10, 11, 219, 19, 10, 11, 219, 18, 10, - 11, 219, 17, 10, 11, 219, 16, 10, 11, 219, 15, 10, 11, 219, 14, 10, 11, - 219, 13, 10, 11, 219, 12, 10, 11, 219, 11, 10, 11, 219, 10, 10, 11, 219, - 9, 10, 11, 219, 8, 10, 11, 218, 150, 10, 11, 218, 149, 10, 11, 218, 148, - 10, 11, 218, 147, 10, 11, 218, 146, 10, 11, 218, 145, 10, 11, 218, 144, - 10, 11, 218, 143, 10, 11, 218, 142, 10, 11, 218, 141, 10, 11, 218, 140, - 10, 11, 218, 139, 10, 11, 218, 88, 10, 11, 218, 87, 10, 11, 218, 86, 10, - 11, 218, 85, 10, 11, 218, 84, 10, 11, 218, 83, 10, 11, 218, 82, 10, 11, - 218, 81, 10, 11, 218, 80, 10, 11, 217, 156, 10, 11, 217, 155, 10, 11, - 217, 154, 10, 11, 217, 153, 10, 11, 217, 152, 10, 11, 217, 151, 10, 11, - 217, 150, 10, 11, 217, 149, 10, 11, 217, 148, 10, 11, 217, 147, 10, 11, - 217, 146, 10, 11, 217, 145, 10, 11, 217, 144, 10, 11, 217, 143, 10, 11, - 217, 142, 10, 11, 217, 141, 10, 11, 217, 140, 10, 11, 217, 139, 10, 11, - 217, 138, 10, 11, 217, 137, 10, 11, 217, 136, 10, 11, 217, 135, 10, 11, - 217, 134, 10, 11, 217, 133, 10, 11, 217, 132, 10, 11, 217, 131, 10, 11, - 217, 130, 10, 11, 217, 129, 10, 11, 217, 128, 10, 11, 217, 127, 10, 11, - 217, 126, 10, 11, 217, 125, 10, 11, 217, 124, 10, 11, 217, 123, 10, 11, - 217, 122, 10, 11, 217, 121, 10, 11, 217, 120, 10, 11, 217, 119, 10, 11, - 217, 118, 10, 11, 217, 117, 10, 11, 217, 116, 10, 11, 255, 57, 10, 11, - 255, 56, 10, 11, 255, 55, 10, 11, 255, 54, 10, 11, 255, 53, 10, 11, 255, - 52, 10, 11, 255, 51, 10, 11, 255, 50, 10, 11, 255, 49, 10, 11, 255, 48, - 10, 11, 255, 47, 10, 11, 255, 46, 10, 11, 255, 45, 10, 11, 255, 44, 10, - 11, 255, 43, 10, 11, 255, 42, 10, 11, 255, 41, 10, 11, 255, 40, 10, 11, - 255, 39, 10, 11, 255, 38, 10, 11, 255, 37, 10, 11, 255, 36, 10, 11, 255, - 35, 10, 11, 255, 34, 10, 11, 255, 33, 10, 11, 255, 32, 10, 11, 255, 31, - 10, 11, 255, 30, 10, 11, 255, 29, 10, 11, 255, 28, 10, 11, 255, 27, 10, - 11, 255, 26, 10, 11, 255, 25, 10, 11, 255, 24, 46, 26, 16, 228, 206, 46, - 26, 16, 249, 148, 46, 26, 16, 229, 163, 46, 26, 16, 230, 67, 246, 221, - 46, 26, 16, 230, 67, 248, 214, 46, 26, 16, 219, 181, 246, 221, 46, 26, - 16, 219, 181, 248, 214, 46, 26, 16, 236, 198, 46, 26, 16, 222, 217, 46, - 26, 16, 229, 235, 46, 26, 16, 217, 205, 46, 26, 16, 217, 206, 248, 214, - 46, 26, 16, 236, 12, 46, 26, 16, 254, 89, 246, 221, 46, 26, 16, 246, 90, - 246, 221, 46, 26, 16, 222, 73, 46, 26, 16, 236, 164, 46, 26, 16, 254, 80, - 46, 26, 16, 254, 81, 248, 214, 46, 26, 16, 222, 222, 46, 26, 16, 221, - 242, 46, 26, 16, 230, 148, 254, 47, 46, 26, 16, 244, 56, 254, 47, 46, 26, - 16, 228, 205, 46, 26, 16, 251, 62, 46, 26, 16, 219, 171, 46, 26, 16, 237, - 144, 254, 47, 46, 26, 16, 236, 166, 254, 47, 46, 26, 16, 236, 165, 254, - 47, 46, 26, 16, 226, 119, 46, 26, 16, 229, 226, 46, 26, 16, 223, 151, - 254, 83, 46, 26, 16, 230, 66, 254, 47, 46, 26, 16, 219, 180, 254, 47, 46, - 26, 16, 254, 84, 254, 47, 46, 26, 16, 254, 78, 46, 26, 16, 236, 65, 46, - 26, 16, 227, 157, 46, 26, 16, 229, 106, 254, 47, 46, 26, 16, 221, 175, - 46, 26, 16, 254, 129, 46, 26, 16, 226, 75, 46, 26, 16, 222, 225, 254, 47, - 46, 26, 16, 222, 225, 233, 239, 223, 149, 46, 26, 16, 230, 61, 254, 47, - 46, 26, 16, 222, 17, 46, 26, 16, 235, 97, 46, 26, 16, 247, 77, 46, 26, - 16, 221, 92, 46, 26, 16, 222, 52, 46, 26, 16, 236, 15, 46, 26, 16, 254, - 89, 246, 90, 232, 131, 46, 26, 16, 245, 93, 254, 47, 46, 26, 16, 237, - 234, 46, 26, 16, 221, 68, 254, 47, 46, 26, 16, 236, 201, 221, 67, 46, 26, - 16, 229, 182, 46, 26, 16, 228, 209, 46, 26, 16, 236, 42, 46, 26, 16, 251, - 6, 254, 47, 46, 26, 16, 227, 232, 46, 26, 16, 229, 238, 254, 47, 46, 26, - 16, 229, 236, 254, 47, 46, 26, 16, 242, 63, 46, 26, 16, 232, 217, 46, 26, - 16, 229, 148, 46, 26, 16, 236, 43, 254, 152, 46, 26, 16, 221, 68, 254, - 152, 46, 26, 16, 223, 132, 46, 26, 16, 244, 25, 46, 26, 16, 237, 144, - 232, 131, 46, 26, 16, 230, 148, 232, 131, 46, 26, 16, 230, 67, 232, 131, - 46, 26, 16, 229, 147, 46, 26, 16, 236, 29, 46, 26, 16, 229, 146, 46, 26, - 16, 236, 14, 46, 26, 16, 229, 183, 232, 131, 46, 26, 16, 236, 165, 232, - 132, 254, 109, 46, 26, 16, 236, 166, 232, 132, 254, 109, 46, 26, 16, 217, - 203, 46, 26, 16, 254, 81, 232, 131, 46, 26, 16, 254, 82, 222, 223, 232, - 131, 46, 26, 16, 217, 204, 46, 26, 16, 236, 13, 46, 26, 16, 246, 216, 46, - 26, 16, 251, 63, 46, 26, 16, 233, 168, 237, 143, 46, 26, 16, 219, 181, - 232, 131, 46, 26, 16, 229, 106, 232, 131, 46, 26, 16, 228, 210, 232, 131, - 46, 26, 16, 230, 145, 46, 26, 16, 254, 100, 46, 26, 16, 234, 195, 46, 26, - 16, 229, 236, 232, 131, 46, 26, 16, 229, 238, 232, 131, 46, 26, 16, 246, - 119, 229, 237, 46, 26, 16, 235, 206, 46, 26, 16, 254, 101, 46, 26, 16, - 221, 68, 232, 131, 46, 26, 16, 246, 219, 46, 26, 16, 222, 225, 232, 131, - 46, 26, 16, 222, 218, 46, 26, 16, 251, 6, 232, 131, 46, 26, 16, 246, 161, - 46, 26, 16, 226, 76, 232, 131, 46, 26, 16, 218, 124, 236, 65, 46, 26, 16, - 221, 65, 46, 26, 16, 228, 211, 46, 26, 16, 221, 69, 46, 26, 16, 221, 66, - 46, 26, 16, 228, 208, 46, 26, 16, 221, 64, 46, 26, 16, 228, 207, 46, 26, - 16, 244, 55, 46, 26, 16, 254, 41, 46, 26, 16, 246, 119, 254, 41, 46, 26, - 16, 230, 61, 232, 131, 46, 26, 16, 222, 16, 246, 127, 46, 26, 16, 222, - 16, 246, 89, 46, 26, 16, 222, 18, 254, 85, 46, 26, 16, 222, 11, 236, 244, - 254, 77, 46, 26, 16, 236, 200, 46, 26, 16, 246, 186, 46, 26, 16, 217, - 253, 236, 197, 46, 26, 16, 217, 253, 254, 109, 46, 26, 16, 223, 150, 46, - 26, 16, 236, 66, 254, 109, 46, 26, 16, 248, 215, 254, 47, 46, 26, 16, - 236, 16, 254, 47, 46, 26, 16, 236, 16, 254, 152, 46, 26, 16, 236, 16, - 232, 131, 46, 26, 16, 254, 84, 232, 131, 46, 26, 16, 254, 86, 46, 26, 16, - 248, 214, 46, 26, 16, 221, 77, 46, 26, 16, 222, 44, 46, 26, 16, 236, 33, - 46, 26, 16, 235, 102, 246, 182, 250, 255, 46, 26, 16, 235, 102, 247, 78, - 251, 0, 46, 26, 16, 235, 102, 221, 79, 251, 0, 46, 26, 16, 235, 102, 222, - 54, 251, 0, 46, 26, 16, 235, 102, 237, 229, 250, 255, 46, 26, 16, 244, - 56, 232, 132, 254, 109, 46, 26, 16, 244, 56, 229, 227, 254, 37, 46, 26, - 16, 244, 56, 229, 227, 249, 40, 46, 26, 16, 248, 238, 46, 26, 16, 248, - 239, 229, 227, 254, 38, 236, 197, 46, 26, 16, 248, 239, 229, 227, 254, - 38, 254, 109, 46, 26, 16, 248, 239, 229, 227, 249, 40, 46, 26, 16, 221, - 83, 46, 26, 16, 254, 42, 46, 26, 16, 237, 236, 46, 26, 16, 249, 3, 46, - 26, 16, 254, 204, 229, 23, 254, 43, 46, 26, 16, 254, 204, 254, 40, 46, - 26, 16, 254, 204, 254, 43, 46, 26, 16, 254, 204, 233, 234, 46, 26, 16, - 254, 204, 233, 242, 46, 26, 16, 254, 204, 244, 57, 46, 26, 16, 254, 204, - 244, 54, 46, 26, 16, 254, 204, 229, 23, 244, 57, 46, 26, 16, 234, 60, - 228, 216, 242, 61, 46, 26, 16, 234, 60, 254, 154, 228, 216, 242, 61, 46, - 26, 16, 234, 60, 249, 39, 242, 61, 46, 26, 16, 234, 60, 254, 154, 249, - 39, 242, 61, 46, 26, 16, 234, 60, 221, 72, 242, 61, 46, 26, 16, 234, 60, - 221, 84, 46, 26, 16, 234, 60, 222, 48, 242, 61, 46, 26, 16, 234, 60, 222, - 48, 235, 105, 242, 61, 46, 26, 16, 234, 60, 235, 105, 242, 61, 46, 26, - 16, 234, 60, 229, 55, 242, 61, 46, 26, 16, 237, 149, 222, 69, 242, 62, - 46, 26, 16, 254, 82, 222, 69, 242, 62, 46, 26, 16, 245, 244, 222, 45, 46, - 26, 16, 245, 244, 233, 126, 46, 26, 16, 245, 244, 248, 243, 46, 26, 16, - 234, 60, 219, 175, 242, 61, 46, 26, 16, 234, 60, 228, 215, 242, 61, 46, - 26, 16, 234, 60, 229, 55, 222, 48, 242, 61, 46, 26, 16, 244, 52, 233, 34, - 254, 85, 46, 26, 16, 244, 52, 233, 34, 248, 213, 46, 26, 16, 246, 195, - 236, 244, 245, 93, 219, 61, 46, 26, 16, 237, 235, 46, 26, 16, 237, 233, - 46, 26, 16, 245, 93, 254, 48, 249, 38, 242, 60, 46, 26, 16, 245, 93, 249, - 1, 187, 46, 26, 16, 245, 93, 249, 1, 232, 217, 46, 26, 16, 245, 93, 232, - 213, 242, 61, 46, 26, 16, 245, 93, 249, 1, 249, 15, 46, 26, 16, 245, 93, - 224, 61, 249, 0, 249, 15, 46, 26, 16, 245, 93, 249, 1, 236, 184, 46, 26, - 16, 245, 93, 249, 1, 217, 21, 46, 26, 16, 245, 93, 249, 1, 232, 63, 236, - 197, 46, 26, 16, 245, 93, 249, 1, 232, 63, 254, 109, 46, 26, 16, 245, 93, - 234, 91, 251, 1, 248, 243, 46, 26, 16, 245, 93, 234, 91, 251, 1, 233, - 126, 46, 26, 16, 245, 204, 224, 61, 251, 1, 219, 174, 46, 26, 16, 245, - 93, 224, 61, 251, 1, 222, 226, 46, 26, 16, 245, 93, 232, 133, 46, 26, 16, - 251, 2, 216, 253, 46, 26, 16, 251, 2, 236, 64, 46, 26, 16, 251, 2, 223, - 250, 46, 26, 16, 245, 93, 242, 107, 217, 252, 222, 49, 46, 26, 16, 245, - 93, 246, 196, 254, 102, 46, 26, 16, 217, 252, 221, 73, 46, 26, 16, 248, - 251, 221, 73, 46, 26, 16, 248, 251, 222, 49, 46, 26, 16, 248, 251, 254, - 87, 247, 78, 248, 161, 46, 26, 16, 248, 251, 233, 124, 222, 53, 248, 161, - 46, 26, 16, 248, 251, 248, 235, 246, 99, 248, 161, 46, 26, 16, 248, 251, - 221, 81, 230, 152, 248, 161, 46, 26, 16, 217, 252, 254, 87, 247, 78, 248, - 161, 46, 26, 16, 217, 252, 233, 124, 222, 53, 248, 161, 46, 26, 16, 217, - 252, 248, 235, 246, 99, 248, 161, 46, 26, 16, 217, 252, 221, 81, 230, - 152, 248, 161, 46, 26, 16, 244, 179, 248, 250, 46, 26, 16, 244, 179, 217, - 251, 46, 26, 16, 249, 2, 254, 87, 233, 169, 46, 26, 16, 249, 2, 254, 87, - 234, 8, 46, 26, 16, 249, 2, 248, 214, 46, 26, 16, 249, 2, 222, 9, 46, 26, - 16, 224, 117, 222, 9, 46, 26, 16, 224, 117, 222, 10, 248, 201, 46, 26, - 16, 224, 117, 222, 10, 221, 74, 46, 26, 16, 224, 117, 222, 10, 222, 42, - 46, 26, 16, 224, 117, 254, 17, 46, 26, 16, 224, 117, 254, 18, 248, 201, - 46, 26, 16, 224, 117, 254, 18, 221, 74, 46, 26, 16, 224, 117, 254, 18, - 222, 42, 46, 26, 16, 248, 236, 244, 161, 46, 26, 16, 248, 242, 230, 86, - 46, 26, 16, 223, 144, 46, 26, 16, 254, 34, 187, 46, 26, 16, 254, 34, 219, - 61, 46, 26, 16, 254, 34, 245, 0, 46, 26, 16, 254, 34, 249, 15, 46, 26, - 16, 254, 34, 236, 184, 46, 26, 16, 254, 34, 217, 21, 46, 26, 16, 254, 34, - 232, 62, 46, 26, 16, 236, 165, 232, 132, 233, 241, 46, 26, 16, 236, 166, - 232, 132, 233, 241, 46, 26, 16, 236, 165, 232, 132, 236, 197, 46, 26, 16, - 236, 166, 232, 132, 236, 197, 46, 26, 16, 236, 66, 236, 197, 46, 26, 16, - 244, 56, 232, 132, 236, 197, 26, 16, 224, 109, 252, 197, 26, 16, 51, 252, - 197, 26, 16, 39, 252, 197, 26, 16, 227, 160, 39, 252, 197, 26, 16, 249, - 145, 252, 197, 26, 16, 224, 192, 252, 197, 26, 16, 42, 227, 182, 55, 26, - 16, 45, 227, 182, 55, 26, 16, 227, 182, 248, 143, 26, 16, 249, 184, 226, - 79, 26, 16, 249, 208, 251, 141, 26, 16, 226, 79, 26, 16, 250, 180, 26, - 16, 227, 180, 245, 193, 26, 16, 227, 180, 245, 192, 26, 16, 227, 180, - 245, 191, 26, 16, 245, 210, 26, 16, 245, 211, 56, 26, 16, 252, 10, 78, - 26, 16, 251, 163, 26, 16, 252, 19, 26, 16, 115, 26, 16, 230, 136, 223, - 163, 26, 16, 220, 205, 223, 163, 26, 16, 221, 227, 223, 163, 26, 16, 245, - 115, 223, 163, 26, 16, 245, 169, 223, 163, 26, 16, 224, 81, 223, 163, 26, - 16, 224, 79, 245, 101, 26, 16, 245, 113, 245, 101, 26, 16, 245, 68, 250, - 207, 26, 16, 245, 68, 250, 208, 230, 88, 254, 145, 26, 16, 245, 68, 250, - 208, 230, 88, 252, 185, 26, 16, 251, 203, 250, 207, 26, 16, 246, 75, 250, - 207, 26, 16, 246, 75, 250, 208, 230, 88, 254, 145, 26, 16, 246, 75, 250, - 208, 230, 88, 252, 185, 26, 16, 247, 116, 250, 206, 26, 16, 247, 116, - 250, 205, 26, 16, 233, 85, 234, 24, 227, 168, 26, 16, 51, 225, 0, 26, 16, - 51, 245, 156, 26, 16, 245, 157, 220, 63, 26, 16, 245, 157, 247, 132, 26, - 16, 232, 205, 220, 63, 26, 16, 232, 205, 247, 132, 26, 16, 225, 1, 220, - 63, 26, 16, 225, 1, 247, 132, 26, 16, 228, 90, 145, 225, 0, 26, 16, 228, - 90, 145, 245, 156, 26, 16, 250, 166, 221, 177, 26, 16, 250, 69, 221, 177, - 26, 16, 230, 88, 254, 145, 26, 16, 230, 88, 252, 185, 26, 16, 228, 74, - 254, 145, 26, 16, 228, 74, 252, 185, 26, 16, 233, 88, 227, 168, 26, 16, - 218, 205, 227, 168, 26, 16, 144, 227, 168, 26, 16, 228, 90, 227, 168, 26, - 16, 246, 232, 227, 168, 26, 16, 224, 76, 227, 168, 26, 16, 221, 243, 227, - 168, 26, 16, 224, 68, 227, 168, 26, 16, 131, 242, 162, 220, 217, 227, - 168, 26, 16, 218, 152, 231, 178, 26, 16, 88, 231, 178, 26, 16, 250, 222, - 218, 152, 231, 178, 26, 16, 40, 231, 179, 218, 207, 26, 16, 40, 231, 179, - 252, 53, 26, 16, 221, 91, 231, 179, 108, 218, 207, 26, 16, 221, 91, 231, - 179, 108, 252, 53, 26, 16, 221, 91, 231, 179, 42, 218, 207, 26, 16, 221, - 91, 231, 179, 42, 252, 53, 26, 16, 221, 91, 231, 179, 45, 218, 207, 26, - 16, 221, 91, 231, 179, 45, 252, 53, 26, 16, 221, 91, 231, 179, 113, 218, - 207, 26, 16, 221, 91, 231, 179, 113, 252, 53, 26, 16, 221, 91, 231, 179, - 108, 45, 218, 207, 26, 16, 221, 91, 231, 179, 108, 45, 252, 53, 26, 16, - 233, 118, 231, 179, 218, 207, 26, 16, 233, 118, 231, 179, 252, 53, 26, - 16, 221, 88, 231, 179, 113, 218, 207, 26, 16, 221, 88, 231, 179, 113, - 252, 53, 26, 16, 229, 230, 231, 178, 26, 16, 219, 67, 231, 178, 26, 16, - 231, 179, 252, 53, 26, 16, 231, 111, 231, 178, 26, 16, 250, 185, 231, - 179, 218, 207, 26, 16, 250, 185, 231, 179, 252, 53, 26, 16, 252, 8, 26, - 16, 218, 205, 231, 180, 26, 16, 144, 231, 180, 26, 16, 228, 90, 231, 180, - 26, 16, 246, 232, 231, 180, 26, 16, 224, 76, 231, 180, 26, 16, 221, 243, - 231, 180, 26, 16, 224, 68, 231, 180, 26, 16, 131, 242, 162, 220, 217, - 231, 180, 26, 16, 36, 223, 146, 26, 16, 36, 223, 233, 223, 146, 26, 16, - 36, 221, 97, 26, 16, 36, 221, 96, 26, 16, 36, 221, 95, 26, 16, 245, 183, - 221, 97, 26, 16, 245, 183, 221, 96, 26, 16, 245, 183, 221, 95, 26, 16, - 36, 253, 230, 248, 145, 26, 16, 36, 245, 162, 26, 16, 36, 245, 161, 26, - 16, 36, 245, 160, 26, 16, 36, 245, 159, 26, 16, 36, 245, 158, 26, 16, - 252, 131, 252, 143, 26, 16, 246, 190, 252, 143, 26, 16, 252, 131, 221, - 200, 26, 16, 246, 190, 221, 200, 26, 16, 252, 131, 224, 44, 26, 16, 246, - 190, 224, 44, 26, 16, 252, 131, 229, 115, 26, 16, 246, 190, 229, 115, 26, - 16, 36, 255, 0, 26, 16, 36, 223, 165, 26, 16, 36, 222, 58, 26, 16, 36, - 223, 166, 26, 16, 36, 234, 71, 26, 16, 36, 234, 70, 26, 16, 36, 254, 255, - 26, 16, 36, 234, 240, 26, 16, 254, 25, 220, 63, 26, 16, 254, 25, 247, - 132, 26, 16, 36, 248, 158, 26, 16, 36, 227, 91, 26, 16, 36, 245, 150, 26, - 16, 36, 224, 40, 26, 16, 36, 252, 113, 26, 16, 36, 51, 221, 124, 26, 16, - 36, 221, 78, 221, 124, 26, 16, 227, 95, 26, 16, 223, 99, 26, 16, 217, - 157, 26, 16, 229, 107, 26, 16, 233, 231, 26, 16, 245, 121, 26, 16, 250, - 106, 26, 16, 249, 83, 26, 16, 244, 47, 231, 181, 224, 55, 26, 16, 244, - 47, 231, 181, 231, 205, 224, 55, 26, 16, 221, 109, 26, 16, 220, 237, 26, - 16, 237, 170, 220, 237, 26, 16, 220, 238, 224, 55, 26, 16, 220, 238, 220, - 63, 26, 16, 230, 99, 223, 119, 26, 16, 230, 99, 223, 116, 26, 16, 230, - 99, 223, 115, 26, 16, 230, 99, 223, 114, 26, 16, 230, 99, 223, 113, 26, - 16, 230, 99, 223, 112, 26, 16, 230, 99, 223, 111, 26, 16, 230, 99, 223, - 110, 26, 16, 230, 99, 223, 109, 26, 16, 230, 99, 223, 118, 26, 16, 230, - 99, 223, 117, 26, 16, 243, 169, 26, 16, 232, 140, 26, 16, 246, 190, 117, - 223, 140, 26, 16, 249, 77, 224, 55, 26, 16, 36, 113, 252, 24, 26, 16, 36, - 108, 252, 24, 26, 16, 36, 243, 178, 26, 16, 36, 224, 34, 229, 59, 26, 16, - 229, 195, 78, 26, 16, 229, 195, 108, 78, 26, 16, 144, 229, 195, 78, 26, - 16, 244, 74, 220, 63, 26, 16, 244, 74, 247, 132, 26, 16, 2, 245, 182, 26, - 16, 249, 168, 26, 16, 249, 169, 254, 157, 26, 16, 234, 46, 26, 16, 234, - 250, 26, 16, 252, 5, 26, 16, 225, 71, 218, 207, 26, 16, 225, 71, 252, 53, - 26, 16, 233, 157, 26, 16, 233, 158, 252, 53, 26, 16, 225, 65, 218, 207, - 26, 16, 225, 65, 252, 53, 26, 16, 245, 82, 218, 207, 26, 16, 245, 82, - 252, 53, 26, 16, 234, 251, 229, 167, 227, 168, 26, 16, 234, 251, 237, - 228, 227, 168, 26, 16, 252, 6, 227, 168, 26, 16, 225, 71, 227, 168, 26, - 16, 233, 158, 227, 168, 26, 16, 225, 65, 227, 168, 26, 16, 222, 67, 229, - 165, 250, 87, 228, 224, 229, 166, 26, 16, 222, 67, 229, 165, 250, 87, - 228, 224, 237, 227, 26, 16, 222, 67, 229, 165, 250, 87, 228, 224, 229, - 167, 248, 224, 26, 16, 222, 67, 237, 226, 250, 87, 228, 224, 229, 166, - 26, 16, 222, 67, 237, 226, 250, 87, 228, 224, 237, 227, 26, 16, 222, 67, - 237, 226, 250, 87, 228, 224, 237, 228, 248, 224, 26, 16, 222, 67, 237, - 226, 250, 87, 228, 224, 237, 228, 248, 223, 26, 16, 222, 67, 237, 226, - 250, 87, 228, 224, 237, 228, 248, 222, 26, 16, 250, 103, 26, 16, 244, 26, - 251, 203, 250, 207, 26, 16, 244, 26, 246, 75, 250, 207, 26, 16, 40, 253, - 204, 26, 16, 219, 81, 26, 16, 229, 35, 26, 16, 250, 200, 26, 16, 226, - 110, 26, 16, 250, 202, 26, 16, 221, 115, 26, 16, 229, 17, 26, 16, 229, - 18, 245, 152, 26, 16, 226, 111, 245, 152, 26, 16, 221, 116, 227, 166, 26, - 16, 229, 154, 223, 95, 23, 219, 71, 165, 223, 18, 23, 219, 71, 165, 223, - 7, 23, 219, 71, 165, 222, 253, 23, 219, 71, 165, 222, 246, 23, 219, 71, - 165, 222, 238, 23, 219, 71, 165, 222, 232, 23, 219, 71, 165, 222, 231, - 23, 219, 71, 165, 222, 230, 23, 219, 71, 165, 222, 229, 23, 219, 71, 165, - 223, 17, 23, 219, 71, 165, 223, 16, 23, 219, 71, 165, 223, 15, 23, 219, - 71, 165, 223, 14, 23, 219, 71, 165, 223, 13, 23, 219, 71, 165, 223, 12, - 23, 219, 71, 165, 223, 11, 23, 219, 71, 165, 223, 10, 23, 219, 71, 165, - 223, 9, 23, 219, 71, 165, 223, 8, 23, 219, 71, 165, 223, 6, 23, 219, 71, - 165, 223, 5, 23, 219, 71, 165, 223, 4, 23, 219, 71, 165, 223, 3, 23, 219, - 71, 165, 223, 2, 23, 219, 71, 165, 222, 237, 23, 219, 71, 165, 222, 236, - 23, 219, 71, 165, 222, 235, 23, 219, 71, 165, 222, 234, 23, 219, 71, 165, - 222, 233, 23, 237, 189, 165, 223, 18, 23, 237, 189, 165, 223, 7, 23, 237, - 189, 165, 222, 246, 23, 237, 189, 165, 222, 238, 23, 237, 189, 165, 222, - 231, 23, 237, 189, 165, 222, 230, 23, 237, 189, 165, 223, 16, 23, 237, - 189, 165, 223, 15, 23, 237, 189, 165, 223, 14, 23, 237, 189, 165, 223, - 13, 23, 237, 189, 165, 223, 10, 23, 237, 189, 165, 223, 9, 23, 237, 189, - 165, 223, 8, 23, 237, 189, 165, 223, 3, 23, 237, 189, 165, 223, 2, 23, - 237, 189, 165, 223, 1, 23, 237, 189, 165, 223, 0, 23, 237, 189, 165, 222, - 255, 23, 237, 189, 165, 222, 254, 23, 237, 189, 165, 222, 252, 23, 237, - 189, 165, 222, 251, 23, 237, 189, 165, 222, 250, 23, 237, 189, 165, 222, - 249, 23, 237, 189, 165, 222, 248, 23, 237, 189, 165, 222, 247, 23, 237, - 189, 165, 222, 245, 23, 237, 189, 165, 222, 244, 23, 237, 189, 165, 222, - 243, 23, 237, 189, 165, 222, 242, 23, 237, 189, 165, 222, 241, 23, 237, - 189, 165, 222, 240, 23, 237, 189, 165, 222, 239, 23, 237, 189, 165, 222, - 237, 23, 237, 189, 165, 222, 236, 23, 237, 189, 165, 222, 235, 23, 237, - 189, 165, 222, 234, 23, 237, 189, 165, 222, 233, 36, 23, 26, 221, 75, 36, - 23, 26, 222, 43, 36, 23, 26, 229, 174, 23, 26, 235, 101, 233, 125, 35, - 247, 8, 248, 237, 35, 243, 150, 247, 8, 248, 237, 35, 242, 165, 247, 8, - 248, 237, 35, 247, 7, 243, 151, 248, 237, 35, 247, 7, 242, 164, 248, 237, - 35, 247, 8, 159, 35, 251, 84, 159, 35, 245, 90, 250, 221, 159, 35, 233, - 150, 159, 35, 252, 192, 159, 35, 236, 181, 224, 43, 159, 35, 250, 133, - 159, 35, 254, 9, 159, 35, 230, 109, 159, 35, 252, 13, 230, 83, 159, 35, - 249, 79, 156, 248, 198, 159, 35, 248, 195, 159, 35, 217, 210, 159, 35, - 237, 217, 159, 35, 229, 180, 159, 35, 227, 215, 159, 35, 250, 143, 159, - 35, 242, 253, 252, 233, 159, 35, 219, 1, 159, 35, 245, 138, 159, 35, 254, - 236, 159, 35, 227, 190, 159, 35, 227, 172, 159, 35, 247, 6, 159, 35, 237, - 45, 159, 35, 250, 138, 159, 35, 246, 189, 159, 35, 247, 87, 159, 35, 251, - 58, 159, 35, 249, 85, 159, 35, 21, 227, 171, 159, 35, 230, 38, 159, 35, - 235, 104, 159, 35, 250, 195, 159, 35, 236, 101, 159, 35, 244, 211, 159, - 35, 223, 126, 159, 35, 228, 189, 159, 35, 245, 89, 159, 35, 227, 173, - 159, 35, 235, 134, 156, 233, 134, 159, 35, 227, 169, 159, 35, 244, 64, - 199, 234, 12, 159, 35, 246, 191, 159, 35, 223, 133, 159, 35, 244, 28, - 159, 35, 246, 184, 159, 35, 229, 210, 159, 35, 227, 85, 159, 35, 245, - 151, 159, 35, 219, 173, 156, 218, 244, 159, 35, 250, 146, 159, 35, 234, - 23, 159, 35, 246, 120, 159, 35, 220, 71, 159, 35, 248, 225, 159, 35, 250, - 197, 233, 105, 159, 35, 244, 13, 159, 35, 244, 212, 237, 223, 159, 35, - 234, 53, 159, 35, 254, 253, 159, 35, 246, 203, 159, 35, 247, 134, 159, - 35, 218, 242, 159, 35, 224, 106, 159, 35, 237, 196, 159, 35, 249, 51, - 159, 35, 249, 150, 159, 35, 248, 221, 159, 35, 246, 93, 159, 35, 225, 37, - 159, 35, 223, 135, 159, 35, 243, 180, 159, 35, 250, 162, 159, 35, 250, - 193, 159, 35, 245, 248, 159, 35, 254, 205, 159, 35, 250, 161, 159, 35, - 230, 139, 222, 23, 219, 155, 159, 35, 248, 245, 159, 35, 235, 180, 159, - 35, 245, 118, 250, 112, 227, 69, 220, 73, 20, 107, 250, 112, 227, 69, - 220, 73, 20, 103, 250, 112, 227, 69, 220, 73, 20, 160, 250, 112, 227, 69, - 220, 73, 20, 154, 250, 112, 227, 69, 220, 73, 20, 174, 250, 112, 227, 69, - 220, 73, 20, 182, 250, 112, 227, 69, 220, 73, 20, 191, 250, 112, 227, 69, - 220, 73, 20, 185, 250, 112, 227, 69, 220, 73, 20, 190, 250, 112, 227, 69, - 222, 63, 20, 107, 250, 112, 227, 69, 222, 63, 20, 103, 250, 112, 227, 69, - 222, 63, 20, 160, 250, 112, 227, 69, 222, 63, 20, 154, 250, 112, 227, 69, - 222, 63, 20, 174, 250, 112, 227, 69, 222, 63, 20, 182, 250, 112, 227, 69, - 222, 63, 20, 191, 250, 112, 227, 69, 222, 63, 20, 185, 250, 112, 227, 69, - 222, 63, 20, 190, 14, 21, 6, 60, 14, 21, 6, 253, 204, 14, 21, 6, 251, - 202, 14, 21, 6, 250, 46, 14, 21, 6, 73, 14, 21, 6, 246, 74, 14, 21, 6, - 245, 67, 14, 21, 6, 243, 225, 14, 21, 6, 72, 14, 21, 6, 237, 126, 14, 21, - 6, 237, 17, 14, 21, 6, 153, 14, 21, 6, 189, 14, 21, 6, 207, 14, 21, 6, - 74, 14, 21, 6, 230, 59, 14, 21, 6, 228, 163, 14, 21, 6, 152, 14, 21, 6, - 198, 14, 21, 6, 222, 201, 14, 21, 6, 68, 14, 21, 6, 216, 216, 14, 21, 6, - 219, 40, 14, 21, 6, 218, 151, 14, 21, 6, 218, 90, 14, 21, 6, 217, 157, - 14, 21, 3, 60, 14, 21, 3, 253, 204, 14, 21, 3, 251, 202, 14, 21, 3, 250, - 46, 14, 21, 3, 73, 14, 21, 3, 246, 74, 14, 21, 3, 245, 67, 14, 21, 3, - 243, 225, 14, 21, 3, 72, 14, 21, 3, 237, 126, 14, 21, 3, 237, 17, 14, 21, - 3, 153, 14, 21, 3, 189, 14, 21, 3, 207, 14, 21, 3, 74, 14, 21, 3, 230, - 59, 14, 21, 3, 228, 163, 14, 21, 3, 152, 14, 21, 3, 198, 14, 21, 3, 222, - 201, 14, 21, 3, 68, 14, 21, 3, 216, 216, 14, 21, 3, 219, 40, 14, 21, 3, - 218, 151, 14, 21, 3, 218, 90, 14, 21, 3, 217, 157, 14, 30, 6, 60, 14, 30, - 6, 253, 204, 14, 30, 6, 251, 202, 14, 30, 6, 250, 46, 14, 30, 6, 73, 14, - 30, 6, 246, 74, 14, 30, 6, 245, 67, 14, 30, 6, 243, 225, 14, 30, 6, 72, - 14, 30, 6, 237, 126, 14, 30, 6, 237, 17, 14, 30, 6, 153, 14, 30, 6, 189, - 14, 30, 6, 207, 14, 30, 6, 74, 14, 30, 6, 230, 59, 14, 30, 6, 228, 163, - 14, 30, 6, 152, 14, 30, 6, 198, 14, 30, 6, 222, 201, 14, 30, 6, 68, 14, - 30, 6, 216, 216, 14, 30, 6, 219, 40, 14, 30, 6, 218, 151, 14, 30, 6, 218, - 90, 14, 30, 6, 217, 157, 14, 30, 3, 60, 14, 30, 3, 253, 204, 14, 30, 3, - 251, 202, 14, 30, 3, 250, 46, 14, 30, 3, 73, 14, 30, 3, 246, 74, 14, 30, - 3, 245, 67, 14, 30, 3, 72, 14, 30, 3, 237, 126, 14, 30, 3, 237, 17, 14, - 30, 3, 153, 14, 30, 3, 189, 14, 30, 3, 207, 14, 30, 3, 74, 14, 30, 3, - 230, 59, 14, 30, 3, 228, 163, 14, 30, 3, 152, 14, 30, 3, 198, 14, 30, 3, - 222, 201, 14, 30, 3, 68, 14, 30, 3, 216, 216, 14, 30, 3, 219, 40, 14, 30, - 3, 218, 151, 14, 30, 3, 218, 90, 14, 30, 3, 217, 157, 14, 21, 30, 6, 60, - 14, 21, 30, 6, 253, 204, 14, 21, 30, 6, 251, 202, 14, 21, 30, 6, 250, 46, - 14, 21, 30, 6, 73, 14, 21, 30, 6, 246, 74, 14, 21, 30, 6, 245, 67, 14, - 21, 30, 6, 243, 225, 14, 21, 30, 6, 72, 14, 21, 30, 6, 237, 126, 14, 21, - 30, 6, 237, 17, 14, 21, 30, 6, 153, 14, 21, 30, 6, 189, 14, 21, 30, 6, - 207, 14, 21, 30, 6, 74, 14, 21, 30, 6, 230, 59, 14, 21, 30, 6, 228, 163, - 14, 21, 30, 6, 152, 14, 21, 30, 6, 198, 14, 21, 30, 6, 222, 201, 14, 21, - 30, 6, 68, 14, 21, 30, 6, 216, 216, 14, 21, 30, 6, 219, 40, 14, 21, 30, - 6, 218, 151, 14, 21, 30, 6, 218, 90, 14, 21, 30, 6, 217, 157, 14, 21, 30, - 3, 60, 14, 21, 30, 3, 253, 204, 14, 21, 30, 3, 251, 202, 14, 21, 30, 3, - 250, 46, 14, 21, 30, 3, 73, 14, 21, 30, 3, 246, 74, 14, 21, 30, 3, 245, - 67, 14, 21, 30, 3, 243, 225, 14, 21, 30, 3, 72, 14, 21, 30, 3, 237, 126, - 14, 21, 30, 3, 237, 17, 14, 21, 30, 3, 153, 14, 21, 30, 3, 189, 14, 21, - 30, 3, 207, 14, 21, 30, 3, 74, 14, 21, 30, 3, 230, 59, 14, 21, 30, 3, - 228, 163, 14, 21, 30, 3, 152, 14, 21, 30, 3, 198, 14, 21, 30, 3, 222, - 201, 14, 21, 30, 3, 68, 14, 21, 30, 3, 216, 216, 14, 21, 30, 3, 219, 40, - 14, 21, 30, 3, 218, 151, 14, 21, 30, 3, 218, 90, 14, 21, 30, 3, 217, 157, - 14, 102, 6, 60, 14, 102, 6, 251, 202, 14, 102, 6, 250, 46, 14, 102, 6, - 245, 67, 14, 102, 6, 237, 126, 14, 102, 6, 237, 17, 14, 102, 6, 207, 14, - 102, 6, 74, 14, 102, 6, 230, 59, 14, 102, 6, 228, 163, 14, 102, 6, 198, - 14, 102, 6, 222, 201, 14, 102, 6, 68, 14, 102, 6, 216, 216, 14, 102, 6, - 219, 40, 14, 102, 6, 218, 151, 14, 102, 6, 218, 90, 14, 102, 6, 217, 157, - 14, 102, 3, 60, 14, 102, 3, 253, 204, 14, 102, 3, 251, 202, 14, 102, 3, - 250, 46, 14, 102, 3, 246, 74, 14, 102, 3, 243, 225, 14, 102, 3, 72, 14, - 102, 3, 237, 126, 14, 102, 3, 237, 17, 14, 102, 3, 153, 14, 102, 3, 189, - 14, 102, 3, 207, 14, 102, 3, 230, 59, 14, 102, 3, 228, 163, 14, 102, 3, - 152, 14, 102, 3, 198, 14, 102, 3, 222, 201, 14, 102, 3, 68, 14, 102, 3, - 216, 216, 14, 102, 3, 219, 40, 14, 102, 3, 218, 151, 14, 102, 3, 218, 90, - 14, 102, 3, 217, 157, 14, 21, 102, 6, 60, 14, 21, 102, 6, 253, 204, 14, - 21, 102, 6, 251, 202, 14, 21, 102, 6, 250, 46, 14, 21, 102, 6, 73, 14, - 21, 102, 6, 246, 74, 14, 21, 102, 6, 245, 67, 14, 21, 102, 6, 243, 225, - 14, 21, 102, 6, 72, 14, 21, 102, 6, 237, 126, 14, 21, 102, 6, 237, 17, - 14, 21, 102, 6, 153, 14, 21, 102, 6, 189, 14, 21, 102, 6, 207, 14, 21, - 102, 6, 74, 14, 21, 102, 6, 230, 59, 14, 21, 102, 6, 228, 163, 14, 21, - 102, 6, 152, 14, 21, 102, 6, 198, 14, 21, 102, 6, 222, 201, 14, 21, 102, - 6, 68, 14, 21, 102, 6, 216, 216, 14, 21, 102, 6, 219, 40, 14, 21, 102, 6, - 218, 151, 14, 21, 102, 6, 218, 90, 14, 21, 102, 6, 217, 157, 14, 21, 102, - 3, 60, 14, 21, 102, 3, 253, 204, 14, 21, 102, 3, 251, 202, 14, 21, 102, - 3, 250, 46, 14, 21, 102, 3, 73, 14, 21, 102, 3, 246, 74, 14, 21, 102, 3, - 245, 67, 14, 21, 102, 3, 243, 225, 14, 21, 102, 3, 72, 14, 21, 102, 3, - 237, 126, 14, 21, 102, 3, 237, 17, 14, 21, 102, 3, 153, 14, 21, 102, 3, - 189, 14, 21, 102, 3, 207, 14, 21, 102, 3, 74, 14, 21, 102, 3, 230, 59, - 14, 21, 102, 3, 228, 163, 14, 21, 102, 3, 152, 14, 21, 102, 3, 198, 14, - 21, 102, 3, 222, 201, 14, 21, 102, 3, 68, 14, 21, 102, 3, 216, 216, 14, - 21, 102, 3, 219, 40, 14, 21, 102, 3, 218, 151, 14, 21, 102, 3, 218, 90, - 14, 21, 102, 3, 217, 157, 14, 121, 6, 60, 14, 121, 6, 253, 204, 14, 121, - 6, 250, 46, 14, 121, 6, 73, 14, 121, 6, 246, 74, 14, 121, 6, 245, 67, 14, - 121, 6, 237, 126, 14, 121, 6, 237, 17, 14, 121, 6, 153, 14, 121, 6, 189, - 14, 121, 6, 207, 14, 121, 6, 74, 14, 121, 6, 230, 59, 14, 121, 6, 228, - 163, 14, 121, 6, 198, 14, 121, 6, 222, 201, 14, 121, 6, 68, 14, 121, 6, - 216, 216, 14, 121, 6, 219, 40, 14, 121, 6, 218, 151, 14, 121, 6, 218, 90, - 14, 121, 3, 60, 14, 121, 3, 253, 204, 14, 121, 3, 251, 202, 14, 121, 3, - 250, 46, 14, 121, 3, 73, 14, 121, 3, 246, 74, 14, 121, 3, 245, 67, 14, - 121, 3, 243, 225, 14, 121, 3, 72, 14, 121, 3, 237, 126, 14, 121, 3, 237, - 17, 14, 121, 3, 153, 14, 121, 3, 189, 14, 121, 3, 207, 14, 121, 3, 74, - 14, 121, 3, 230, 59, 14, 121, 3, 228, 163, 14, 121, 3, 152, 14, 121, 3, - 198, 14, 121, 3, 222, 201, 14, 121, 3, 68, 14, 121, 3, 216, 216, 14, 121, - 3, 219, 40, 14, 121, 3, 218, 151, 14, 121, 3, 218, 90, 14, 121, 3, 217, - 157, 14, 173, 6, 60, 14, 173, 6, 253, 204, 14, 173, 6, 250, 46, 14, 173, - 6, 73, 14, 173, 6, 246, 74, 14, 173, 6, 245, 67, 14, 173, 6, 72, 14, 173, - 6, 237, 126, 14, 173, 6, 237, 17, 14, 173, 6, 153, 14, 173, 6, 189, 14, - 173, 6, 74, 14, 173, 6, 198, 14, 173, 6, 222, 201, 14, 173, 6, 68, 14, - 173, 6, 216, 216, 14, 173, 6, 219, 40, 14, 173, 6, 218, 151, 14, 173, 6, - 218, 90, 14, 173, 3, 60, 14, 173, 3, 253, 204, 14, 173, 3, 251, 202, 14, - 173, 3, 250, 46, 14, 173, 3, 73, 14, 173, 3, 246, 74, 14, 173, 3, 245, - 67, 14, 173, 3, 243, 225, 14, 173, 3, 72, 14, 173, 3, 237, 126, 14, 173, - 3, 237, 17, 14, 173, 3, 153, 14, 173, 3, 189, 14, 173, 3, 207, 14, 173, - 3, 74, 14, 173, 3, 230, 59, 14, 173, 3, 228, 163, 14, 173, 3, 152, 14, - 173, 3, 198, 14, 173, 3, 222, 201, 14, 173, 3, 68, 14, 173, 3, 216, 216, - 14, 173, 3, 219, 40, 14, 173, 3, 218, 151, 14, 173, 3, 218, 90, 14, 173, - 3, 217, 157, 14, 21, 121, 6, 60, 14, 21, 121, 6, 253, 204, 14, 21, 121, - 6, 251, 202, 14, 21, 121, 6, 250, 46, 14, 21, 121, 6, 73, 14, 21, 121, 6, - 246, 74, 14, 21, 121, 6, 245, 67, 14, 21, 121, 6, 243, 225, 14, 21, 121, - 6, 72, 14, 21, 121, 6, 237, 126, 14, 21, 121, 6, 237, 17, 14, 21, 121, 6, - 153, 14, 21, 121, 6, 189, 14, 21, 121, 6, 207, 14, 21, 121, 6, 74, 14, - 21, 121, 6, 230, 59, 14, 21, 121, 6, 228, 163, 14, 21, 121, 6, 152, 14, - 21, 121, 6, 198, 14, 21, 121, 6, 222, 201, 14, 21, 121, 6, 68, 14, 21, - 121, 6, 216, 216, 14, 21, 121, 6, 219, 40, 14, 21, 121, 6, 218, 151, 14, - 21, 121, 6, 218, 90, 14, 21, 121, 6, 217, 157, 14, 21, 121, 3, 60, 14, - 21, 121, 3, 253, 204, 14, 21, 121, 3, 251, 202, 14, 21, 121, 3, 250, 46, - 14, 21, 121, 3, 73, 14, 21, 121, 3, 246, 74, 14, 21, 121, 3, 245, 67, 14, - 21, 121, 3, 243, 225, 14, 21, 121, 3, 72, 14, 21, 121, 3, 237, 126, 14, - 21, 121, 3, 237, 17, 14, 21, 121, 3, 153, 14, 21, 121, 3, 189, 14, 21, - 121, 3, 207, 14, 21, 121, 3, 74, 14, 21, 121, 3, 230, 59, 14, 21, 121, 3, - 228, 163, 14, 21, 121, 3, 152, 14, 21, 121, 3, 198, 14, 21, 121, 3, 222, - 201, 14, 21, 121, 3, 68, 14, 21, 121, 3, 216, 216, 14, 21, 121, 3, 219, - 40, 14, 21, 121, 3, 218, 151, 14, 21, 121, 3, 218, 90, 14, 21, 121, 3, - 217, 157, 14, 33, 6, 60, 14, 33, 6, 253, 204, 14, 33, 6, 251, 202, 14, - 33, 6, 250, 46, 14, 33, 6, 73, 14, 33, 6, 246, 74, 14, 33, 6, 245, 67, - 14, 33, 6, 243, 225, 14, 33, 6, 72, 14, 33, 6, 237, 126, 14, 33, 6, 237, - 17, 14, 33, 6, 153, 14, 33, 6, 189, 14, 33, 6, 207, 14, 33, 6, 74, 14, - 33, 6, 230, 59, 14, 33, 6, 228, 163, 14, 33, 6, 152, 14, 33, 6, 198, 14, - 33, 6, 222, 201, 14, 33, 6, 68, 14, 33, 6, 216, 216, 14, 33, 6, 219, 40, - 14, 33, 6, 218, 151, 14, 33, 6, 218, 90, 14, 33, 6, 217, 157, 14, 33, 3, - 60, 14, 33, 3, 253, 204, 14, 33, 3, 251, 202, 14, 33, 3, 250, 46, 14, 33, - 3, 73, 14, 33, 3, 246, 74, 14, 33, 3, 245, 67, 14, 33, 3, 243, 225, 14, - 33, 3, 72, 14, 33, 3, 237, 126, 14, 33, 3, 237, 17, 14, 33, 3, 153, 14, - 33, 3, 189, 14, 33, 3, 207, 14, 33, 3, 74, 14, 33, 3, 230, 59, 14, 33, 3, - 228, 163, 14, 33, 3, 152, 14, 33, 3, 198, 14, 33, 3, 222, 201, 14, 33, 3, - 68, 14, 33, 3, 216, 216, 14, 33, 3, 219, 40, 14, 33, 3, 218, 151, 14, 33, - 3, 218, 90, 14, 33, 3, 217, 157, 14, 33, 21, 6, 60, 14, 33, 21, 6, 253, - 204, 14, 33, 21, 6, 251, 202, 14, 33, 21, 6, 250, 46, 14, 33, 21, 6, 73, - 14, 33, 21, 6, 246, 74, 14, 33, 21, 6, 245, 67, 14, 33, 21, 6, 243, 225, - 14, 33, 21, 6, 72, 14, 33, 21, 6, 237, 126, 14, 33, 21, 6, 237, 17, 14, - 33, 21, 6, 153, 14, 33, 21, 6, 189, 14, 33, 21, 6, 207, 14, 33, 21, 6, - 74, 14, 33, 21, 6, 230, 59, 14, 33, 21, 6, 228, 163, 14, 33, 21, 6, 152, - 14, 33, 21, 6, 198, 14, 33, 21, 6, 222, 201, 14, 33, 21, 6, 68, 14, 33, - 21, 6, 216, 216, 14, 33, 21, 6, 219, 40, 14, 33, 21, 6, 218, 151, 14, 33, - 21, 6, 218, 90, 14, 33, 21, 6, 217, 157, 14, 33, 21, 3, 60, 14, 33, 21, - 3, 253, 204, 14, 33, 21, 3, 251, 202, 14, 33, 21, 3, 250, 46, 14, 33, 21, - 3, 73, 14, 33, 21, 3, 246, 74, 14, 33, 21, 3, 245, 67, 14, 33, 21, 3, - 243, 225, 14, 33, 21, 3, 72, 14, 33, 21, 3, 237, 126, 14, 33, 21, 3, 237, - 17, 14, 33, 21, 3, 153, 14, 33, 21, 3, 189, 14, 33, 21, 3, 207, 14, 33, - 21, 3, 74, 14, 33, 21, 3, 230, 59, 14, 33, 21, 3, 228, 163, 14, 33, 21, - 3, 152, 14, 33, 21, 3, 198, 14, 33, 21, 3, 222, 201, 14, 33, 21, 3, 68, - 14, 33, 21, 3, 216, 216, 14, 33, 21, 3, 219, 40, 14, 33, 21, 3, 218, 151, - 14, 33, 21, 3, 218, 90, 14, 33, 21, 3, 217, 157, 14, 33, 30, 6, 60, 14, - 33, 30, 6, 253, 204, 14, 33, 30, 6, 251, 202, 14, 33, 30, 6, 250, 46, 14, - 33, 30, 6, 73, 14, 33, 30, 6, 246, 74, 14, 33, 30, 6, 245, 67, 14, 33, - 30, 6, 243, 225, 14, 33, 30, 6, 72, 14, 33, 30, 6, 237, 126, 14, 33, 30, - 6, 237, 17, 14, 33, 30, 6, 153, 14, 33, 30, 6, 189, 14, 33, 30, 6, 207, - 14, 33, 30, 6, 74, 14, 33, 30, 6, 230, 59, 14, 33, 30, 6, 228, 163, 14, - 33, 30, 6, 152, 14, 33, 30, 6, 198, 14, 33, 30, 6, 222, 201, 14, 33, 30, - 6, 68, 14, 33, 30, 6, 216, 216, 14, 33, 30, 6, 219, 40, 14, 33, 30, 6, - 218, 151, 14, 33, 30, 6, 218, 90, 14, 33, 30, 6, 217, 157, 14, 33, 30, 3, - 60, 14, 33, 30, 3, 253, 204, 14, 33, 30, 3, 251, 202, 14, 33, 30, 3, 250, - 46, 14, 33, 30, 3, 73, 14, 33, 30, 3, 246, 74, 14, 33, 30, 3, 245, 67, - 14, 33, 30, 3, 243, 225, 14, 33, 30, 3, 72, 14, 33, 30, 3, 237, 126, 14, - 33, 30, 3, 237, 17, 14, 33, 30, 3, 153, 14, 33, 30, 3, 189, 14, 33, 30, - 3, 207, 14, 33, 30, 3, 74, 14, 33, 30, 3, 230, 59, 14, 33, 30, 3, 228, - 163, 14, 33, 30, 3, 152, 14, 33, 30, 3, 198, 14, 33, 30, 3, 222, 201, 14, - 33, 30, 3, 68, 14, 33, 30, 3, 216, 216, 14, 33, 30, 3, 219, 40, 14, 33, - 30, 3, 218, 151, 14, 33, 30, 3, 218, 90, 14, 33, 30, 3, 217, 157, 14, 33, - 21, 30, 6, 60, 14, 33, 21, 30, 6, 253, 204, 14, 33, 21, 30, 6, 251, 202, - 14, 33, 21, 30, 6, 250, 46, 14, 33, 21, 30, 6, 73, 14, 33, 21, 30, 6, - 246, 74, 14, 33, 21, 30, 6, 245, 67, 14, 33, 21, 30, 6, 243, 225, 14, 33, - 21, 30, 6, 72, 14, 33, 21, 30, 6, 237, 126, 14, 33, 21, 30, 6, 237, 17, - 14, 33, 21, 30, 6, 153, 14, 33, 21, 30, 6, 189, 14, 33, 21, 30, 6, 207, - 14, 33, 21, 30, 6, 74, 14, 33, 21, 30, 6, 230, 59, 14, 33, 21, 30, 6, - 228, 163, 14, 33, 21, 30, 6, 152, 14, 33, 21, 30, 6, 198, 14, 33, 21, 30, - 6, 222, 201, 14, 33, 21, 30, 6, 68, 14, 33, 21, 30, 6, 216, 216, 14, 33, - 21, 30, 6, 219, 40, 14, 33, 21, 30, 6, 218, 151, 14, 33, 21, 30, 6, 218, - 90, 14, 33, 21, 30, 6, 217, 157, 14, 33, 21, 30, 3, 60, 14, 33, 21, 30, - 3, 253, 204, 14, 33, 21, 30, 3, 251, 202, 14, 33, 21, 30, 3, 250, 46, 14, - 33, 21, 30, 3, 73, 14, 33, 21, 30, 3, 246, 74, 14, 33, 21, 30, 3, 245, - 67, 14, 33, 21, 30, 3, 243, 225, 14, 33, 21, 30, 3, 72, 14, 33, 21, 30, - 3, 237, 126, 14, 33, 21, 30, 3, 237, 17, 14, 33, 21, 30, 3, 153, 14, 33, - 21, 30, 3, 189, 14, 33, 21, 30, 3, 207, 14, 33, 21, 30, 3, 74, 14, 33, - 21, 30, 3, 230, 59, 14, 33, 21, 30, 3, 228, 163, 14, 33, 21, 30, 3, 152, - 14, 33, 21, 30, 3, 198, 14, 33, 21, 30, 3, 222, 201, 14, 33, 21, 30, 3, - 68, 14, 33, 21, 30, 3, 216, 216, 14, 33, 21, 30, 3, 219, 40, 14, 33, 21, - 30, 3, 218, 151, 14, 33, 21, 30, 3, 218, 90, 14, 33, 21, 30, 3, 217, 157, - 14, 211, 6, 60, 14, 211, 6, 253, 204, 14, 211, 6, 251, 202, 14, 211, 6, - 250, 46, 14, 211, 6, 73, 14, 211, 6, 246, 74, 14, 211, 6, 245, 67, 14, - 211, 6, 243, 225, 14, 211, 6, 72, 14, 211, 6, 237, 126, 14, 211, 6, 237, - 17, 14, 211, 6, 153, 14, 211, 6, 189, 14, 211, 6, 207, 14, 211, 6, 74, - 14, 211, 6, 230, 59, 14, 211, 6, 228, 163, 14, 211, 6, 152, 14, 211, 6, - 198, 14, 211, 6, 222, 201, 14, 211, 6, 68, 14, 211, 6, 216, 216, 14, 211, - 6, 219, 40, 14, 211, 6, 218, 151, 14, 211, 6, 218, 90, 14, 211, 6, 217, - 157, 14, 211, 3, 60, 14, 211, 3, 253, 204, 14, 211, 3, 251, 202, 14, 211, - 3, 250, 46, 14, 211, 3, 73, 14, 211, 3, 246, 74, 14, 211, 3, 245, 67, 14, - 211, 3, 243, 225, 14, 211, 3, 72, 14, 211, 3, 237, 126, 14, 211, 3, 237, - 17, 14, 211, 3, 153, 14, 211, 3, 189, 14, 211, 3, 207, 14, 211, 3, 74, - 14, 211, 3, 230, 59, 14, 211, 3, 228, 163, 14, 211, 3, 152, 14, 211, 3, - 198, 14, 211, 3, 222, 201, 14, 211, 3, 68, 14, 211, 3, 216, 216, 14, 211, - 3, 219, 40, 14, 211, 3, 218, 151, 14, 211, 3, 218, 90, 14, 211, 3, 217, - 157, 14, 30, 3, 248, 144, 72, 14, 30, 3, 248, 144, 237, 126, 14, 21, 6, - 254, 146, 14, 21, 6, 252, 102, 14, 21, 6, 244, 231, 14, 21, 6, 249, 62, - 14, 21, 6, 246, 156, 14, 21, 6, 217, 83, 14, 21, 6, 246, 121, 14, 21, 6, - 222, 6, 14, 21, 6, 237, 162, 14, 21, 6, 236, 221, 14, 21, 6, 235, 156, - 14, 21, 6, 233, 99, 14, 21, 6, 231, 144, 14, 21, 6, 218, 130, 14, 21, 6, - 230, 141, 14, 21, 6, 229, 108, 14, 21, 6, 227, 149, 14, 21, 6, 222, 7, - 100, 14, 21, 6, 224, 127, 14, 21, 6, 222, 105, 14, 21, 6, 220, 57, 14, - 21, 6, 229, 129, 14, 21, 6, 251, 31, 14, 21, 6, 228, 212, 14, 21, 6, 230, - 143, 14, 21, 232, 231, 14, 21, 3, 254, 146, 14, 21, 3, 252, 102, 14, 21, - 3, 244, 231, 14, 21, 3, 249, 62, 14, 21, 3, 246, 156, 14, 21, 3, 217, 83, - 14, 21, 3, 246, 121, 14, 21, 3, 222, 6, 14, 21, 3, 237, 162, 14, 21, 3, - 236, 221, 14, 21, 3, 235, 156, 14, 21, 3, 233, 99, 14, 21, 3, 231, 144, - 14, 21, 3, 218, 130, 14, 21, 3, 230, 141, 14, 21, 3, 229, 108, 14, 21, 3, - 227, 149, 14, 21, 3, 39, 224, 127, 14, 21, 3, 224, 127, 14, 21, 3, 222, - 105, 14, 21, 3, 220, 57, 14, 21, 3, 229, 129, 14, 21, 3, 251, 31, 14, 21, - 3, 228, 212, 14, 21, 3, 230, 143, 14, 21, 229, 223, 248, 246, 14, 21, - 246, 157, 100, 14, 21, 222, 7, 100, 14, 21, 236, 222, 100, 14, 21, 229, - 130, 100, 14, 21, 227, 150, 100, 14, 21, 229, 109, 100, 14, 30, 6, 254, - 146, 14, 30, 6, 252, 102, 14, 30, 6, 244, 231, 14, 30, 6, 249, 62, 14, - 30, 6, 246, 156, 14, 30, 6, 217, 83, 14, 30, 6, 246, 121, 14, 30, 6, 222, - 6, 14, 30, 6, 237, 162, 14, 30, 6, 236, 221, 14, 30, 6, 235, 156, 14, 30, - 6, 233, 99, 14, 30, 6, 231, 144, 14, 30, 6, 218, 130, 14, 30, 6, 230, - 141, 14, 30, 6, 229, 108, 14, 30, 6, 227, 149, 14, 30, 6, 222, 7, 100, - 14, 30, 6, 224, 127, 14, 30, 6, 222, 105, 14, 30, 6, 220, 57, 14, 30, 6, - 229, 129, 14, 30, 6, 251, 31, 14, 30, 6, 228, 212, 14, 30, 6, 230, 143, - 14, 30, 232, 231, 14, 30, 3, 254, 146, 14, 30, 3, 252, 102, 14, 30, 3, - 244, 231, 14, 30, 3, 249, 62, 14, 30, 3, 246, 156, 14, 30, 3, 217, 83, - 14, 30, 3, 246, 121, 14, 30, 3, 222, 6, 14, 30, 3, 237, 162, 14, 30, 3, - 236, 221, 14, 30, 3, 235, 156, 14, 30, 3, 233, 99, 14, 30, 3, 231, 144, - 14, 30, 3, 218, 130, 14, 30, 3, 230, 141, 14, 30, 3, 229, 108, 14, 30, 3, - 227, 149, 14, 30, 3, 39, 224, 127, 14, 30, 3, 224, 127, 14, 30, 3, 222, - 105, 14, 30, 3, 220, 57, 14, 30, 3, 229, 129, 14, 30, 3, 251, 31, 14, 30, - 3, 228, 212, 14, 30, 3, 230, 143, 14, 30, 229, 223, 248, 246, 14, 30, - 246, 157, 100, 14, 30, 222, 7, 100, 14, 30, 236, 222, 100, 14, 30, 229, - 130, 100, 14, 30, 227, 150, 100, 14, 30, 229, 109, 100, 14, 21, 30, 6, - 254, 146, 14, 21, 30, 6, 252, 102, 14, 21, 30, 6, 244, 231, 14, 21, 30, - 6, 249, 62, 14, 21, 30, 6, 246, 156, 14, 21, 30, 6, 217, 83, 14, 21, 30, - 6, 246, 121, 14, 21, 30, 6, 222, 6, 14, 21, 30, 6, 237, 162, 14, 21, 30, - 6, 236, 221, 14, 21, 30, 6, 235, 156, 14, 21, 30, 6, 233, 99, 14, 21, 30, - 6, 231, 144, 14, 21, 30, 6, 218, 130, 14, 21, 30, 6, 230, 141, 14, 21, - 30, 6, 229, 108, 14, 21, 30, 6, 227, 149, 14, 21, 30, 6, 222, 7, 100, 14, - 21, 30, 6, 224, 127, 14, 21, 30, 6, 222, 105, 14, 21, 30, 6, 220, 57, 14, - 21, 30, 6, 229, 129, 14, 21, 30, 6, 251, 31, 14, 21, 30, 6, 228, 212, 14, - 21, 30, 6, 230, 143, 14, 21, 30, 232, 231, 14, 21, 30, 3, 254, 146, 14, - 21, 30, 3, 252, 102, 14, 21, 30, 3, 244, 231, 14, 21, 30, 3, 249, 62, 14, - 21, 30, 3, 246, 156, 14, 21, 30, 3, 217, 83, 14, 21, 30, 3, 246, 121, 14, - 21, 30, 3, 222, 6, 14, 21, 30, 3, 237, 162, 14, 21, 30, 3, 236, 221, 14, - 21, 30, 3, 235, 156, 14, 21, 30, 3, 233, 99, 14, 21, 30, 3, 231, 144, 14, - 21, 30, 3, 218, 130, 14, 21, 30, 3, 230, 141, 14, 21, 30, 3, 229, 108, - 14, 21, 30, 3, 227, 149, 14, 21, 30, 3, 39, 224, 127, 14, 21, 30, 3, 224, - 127, 14, 21, 30, 3, 222, 105, 14, 21, 30, 3, 220, 57, 14, 21, 30, 3, 229, - 129, 14, 21, 30, 3, 251, 31, 14, 21, 30, 3, 228, 212, 14, 21, 30, 3, 230, - 143, 14, 21, 30, 229, 223, 248, 246, 14, 21, 30, 246, 157, 100, 14, 21, - 30, 222, 7, 100, 14, 21, 30, 236, 222, 100, 14, 21, 30, 229, 130, 100, - 14, 21, 30, 227, 150, 100, 14, 21, 30, 229, 109, 100, 14, 33, 21, 6, 254, - 146, 14, 33, 21, 6, 252, 102, 14, 33, 21, 6, 244, 231, 14, 33, 21, 6, - 249, 62, 14, 33, 21, 6, 246, 156, 14, 33, 21, 6, 217, 83, 14, 33, 21, 6, - 246, 121, 14, 33, 21, 6, 222, 6, 14, 33, 21, 6, 237, 162, 14, 33, 21, 6, - 236, 221, 14, 33, 21, 6, 235, 156, 14, 33, 21, 6, 233, 99, 14, 33, 21, 6, - 231, 144, 14, 33, 21, 6, 218, 130, 14, 33, 21, 6, 230, 141, 14, 33, 21, - 6, 229, 108, 14, 33, 21, 6, 227, 149, 14, 33, 21, 6, 222, 7, 100, 14, 33, - 21, 6, 224, 127, 14, 33, 21, 6, 222, 105, 14, 33, 21, 6, 220, 57, 14, 33, - 21, 6, 229, 129, 14, 33, 21, 6, 251, 31, 14, 33, 21, 6, 228, 212, 14, 33, - 21, 6, 230, 143, 14, 33, 21, 232, 231, 14, 33, 21, 3, 254, 146, 14, 33, - 21, 3, 252, 102, 14, 33, 21, 3, 244, 231, 14, 33, 21, 3, 249, 62, 14, 33, - 21, 3, 246, 156, 14, 33, 21, 3, 217, 83, 14, 33, 21, 3, 246, 121, 14, 33, - 21, 3, 222, 6, 14, 33, 21, 3, 237, 162, 14, 33, 21, 3, 236, 221, 14, 33, - 21, 3, 235, 156, 14, 33, 21, 3, 233, 99, 14, 33, 21, 3, 231, 144, 14, 33, - 21, 3, 218, 130, 14, 33, 21, 3, 230, 141, 14, 33, 21, 3, 229, 108, 14, - 33, 21, 3, 227, 149, 14, 33, 21, 3, 39, 224, 127, 14, 33, 21, 3, 224, - 127, 14, 33, 21, 3, 222, 105, 14, 33, 21, 3, 220, 57, 14, 33, 21, 3, 229, - 129, 14, 33, 21, 3, 251, 31, 14, 33, 21, 3, 228, 212, 14, 33, 21, 3, 230, - 143, 14, 33, 21, 229, 223, 248, 246, 14, 33, 21, 246, 157, 100, 14, 33, - 21, 222, 7, 100, 14, 33, 21, 236, 222, 100, 14, 33, 21, 229, 130, 100, - 14, 33, 21, 227, 150, 100, 14, 33, 21, 229, 109, 100, 14, 33, 21, 30, 6, - 254, 146, 14, 33, 21, 30, 6, 252, 102, 14, 33, 21, 30, 6, 244, 231, 14, - 33, 21, 30, 6, 249, 62, 14, 33, 21, 30, 6, 246, 156, 14, 33, 21, 30, 6, - 217, 83, 14, 33, 21, 30, 6, 246, 121, 14, 33, 21, 30, 6, 222, 6, 14, 33, - 21, 30, 6, 237, 162, 14, 33, 21, 30, 6, 236, 221, 14, 33, 21, 30, 6, 235, - 156, 14, 33, 21, 30, 6, 233, 99, 14, 33, 21, 30, 6, 231, 144, 14, 33, 21, - 30, 6, 218, 130, 14, 33, 21, 30, 6, 230, 141, 14, 33, 21, 30, 6, 229, - 108, 14, 33, 21, 30, 6, 227, 149, 14, 33, 21, 30, 6, 222, 7, 100, 14, 33, - 21, 30, 6, 224, 127, 14, 33, 21, 30, 6, 222, 105, 14, 33, 21, 30, 6, 220, - 57, 14, 33, 21, 30, 6, 229, 129, 14, 33, 21, 30, 6, 251, 31, 14, 33, 21, - 30, 6, 228, 212, 14, 33, 21, 30, 6, 230, 143, 14, 33, 21, 30, 232, 231, - 14, 33, 21, 30, 3, 254, 146, 14, 33, 21, 30, 3, 252, 102, 14, 33, 21, 30, - 3, 244, 231, 14, 33, 21, 30, 3, 249, 62, 14, 33, 21, 30, 3, 246, 156, 14, - 33, 21, 30, 3, 217, 83, 14, 33, 21, 30, 3, 246, 121, 14, 33, 21, 30, 3, - 222, 6, 14, 33, 21, 30, 3, 237, 162, 14, 33, 21, 30, 3, 236, 221, 14, 33, - 21, 30, 3, 235, 156, 14, 33, 21, 30, 3, 233, 99, 14, 33, 21, 30, 3, 231, - 144, 14, 33, 21, 30, 3, 218, 130, 14, 33, 21, 30, 3, 230, 141, 14, 33, - 21, 30, 3, 229, 108, 14, 33, 21, 30, 3, 227, 149, 14, 33, 21, 30, 3, 39, - 224, 127, 14, 33, 21, 30, 3, 224, 127, 14, 33, 21, 30, 3, 222, 105, 14, - 33, 21, 30, 3, 220, 57, 14, 33, 21, 30, 3, 229, 129, 14, 33, 21, 30, 3, - 251, 31, 14, 33, 21, 30, 3, 228, 212, 14, 33, 21, 30, 3, 230, 143, 14, - 33, 21, 30, 229, 223, 248, 246, 14, 33, 21, 30, 246, 157, 100, 14, 33, - 21, 30, 222, 7, 100, 14, 33, 21, 30, 236, 222, 100, 14, 33, 21, 30, 229, - 130, 100, 14, 33, 21, 30, 227, 150, 100, 14, 33, 21, 30, 229, 109, 100, - 14, 21, 6, 248, 240, 14, 21, 3, 248, 240, 14, 21, 20, 217, 84, 14, 21, - 20, 107, 14, 21, 20, 103, 14, 21, 20, 160, 14, 21, 20, 154, 14, 21, 20, - 174, 14, 21, 20, 182, 14, 21, 20, 191, 14, 21, 20, 185, 14, 21, 20, 190, - 14, 173, 20, 217, 84, 14, 173, 20, 107, 14, 173, 20, 103, 14, 173, 20, - 160, 14, 173, 20, 154, 14, 173, 20, 174, 14, 173, 20, 182, 14, 173, 20, - 191, 14, 173, 20, 185, 14, 173, 20, 190, 14, 33, 20, 217, 84, 14, 33, 20, - 107, 14, 33, 20, 103, 14, 33, 20, 160, 14, 33, 20, 154, 14, 33, 20, 174, - 14, 33, 20, 182, 14, 33, 20, 191, 14, 33, 20, 185, 14, 33, 20, 190, 14, - 33, 21, 20, 217, 84, 14, 33, 21, 20, 107, 14, 33, 21, 20, 103, 14, 33, - 21, 20, 160, 14, 33, 21, 20, 154, 14, 33, 21, 20, 174, 14, 33, 21, 20, - 182, 14, 33, 21, 20, 191, 14, 33, 21, 20, 185, 14, 33, 21, 20, 190, 14, - 211, 20, 217, 84, 14, 211, 20, 107, 14, 211, 20, 103, 14, 211, 20, 160, - 14, 211, 20, 154, 14, 211, 20, 174, 14, 211, 20, 182, 14, 211, 20, 191, - 14, 211, 20, 185, 14, 211, 20, 190, 234, 101, 81, 247, 5, 218, 194, 234, - 101, 81, 224, 6, 218, 194, 234, 101, 81, 218, 217, 218, 194, 234, 101, - 81, 231, 187, 218, 194, 234, 101, 81, 227, 203, 247, 123, 234, 101, 81, - 244, 27, 247, 123, 234, 101, 81, 67, 247, 123, 234, 101, 81, 131, 117, - 251, 54, 234, 101, 81, 124, 117, 251, 54, 234, 101, 81, 148, 117, 251, - 54, 234, 101, 81, 245, 116, 117, 251, 54, 234, 101, 81, 245, 170, 117, - 251, 54, 234, 101, 81, 224, 82, 117, 251, 54, 234, 101, 81, 225, 43, 117, - 251, 54, 234, 101, 81, 246, 235, 117, 251, 54, 234, 101, 81, 232, 31, - 117, 251, 54, 234, 101, 81, 131, 117, 252, 210, 234, 101, 81, 124, 117, - 252, 210, 234, 101, 81, 148, 117, 252, 210, 234, 101, 81, 245, 116, 117, - 252, 210, 234, 101, 81, 245, 170, 117, 252, 210, 234, 101, 81, 224, 82, - 117, 252, 210, 234, 101, 81, 225, 43, 117, 252, 210, 234, 101, 81, 246, - 235, 117, 252, 210, 234, 101, 81, 232, 31, 117, 252, 210, 234, 101, 81, - 131, 117, 250, 220, 234, 101, 81, 124, 117, 250, 220, 234, 101, 81, 148, - 117, 250, 220, 234, 101, 81, 245, 116, 117, 250, 220, 234, 101, 81, 245, - 170, 117, 250, 220, 234, 101, 81, 224, 82, 117, 250, 220, 234, 101, 81, - 225, 43, 117, 250, 220, 234, 101, 81, 246, 235, 117, 250, 220, 234, 101, - 81, 232, 31, 117, 250, 220, 234, 101, 81, 229, 45, 234, 101, 81, 230, - 104, 234, 101, 81, 252, 211, 234, 101, 81, 250, 254, 234, 101, 81, 223, - 232, 234, 101, 81, 223, 70, 234, 101, 81, 253, 223, 234, 101, 81, 218, - 190, 234, 101, 81, 237, 53, 234, 101, 81, 252, 233, 119, 81, 186, 252, - 233, 119, 81, 242, 240, 119, 81, 242, 239, 119, 81, 242, 238, 119, 81, - 242, 237, 119, 81, 242, 236, 119, 81, 242, 235, 119, 81, 242, 234, 119, - 81, 242, 233, 119, 81, 242, 232, 119, 81, 242, 231, 119, 81, 242, 230, - 119, 81, 242, 229, 119, 81, 242, 228, 119, 81, 242, 227, 119, 81, 242, - 226, 119, 81, 242, 225, 119, 81, 242, 224, 119, 81, 242, 223, 119, 81, - 242, 222, 119, 81, 242, 221, 119, 81, 242, 220, 119, 81, 242, 219, 119, - 81, 242, 218, 119, 81, 242, 217, 119, 81, 242, 216, 119, 81, 242, 215, - 119, 81, 242, 214, 119, 81, 242, 213, 119, 81, 242, 212, 119, 81, 242, - 211, 119, 81, 242, 210, 119, 81, 242, 209, 119, 81, 242, 208, 119, 81, - 242, 207, 119, 81, 242, 206, 119, 81, 242, 205, 119, 81, 242, 204, 119, - 81, 242, 203, 119, 81, 242, 202, 119, 81, 242, 201, 119, 81, 242, 200, - 119, 81, 242, 199, 119, 81, 242, 198, 119, 81, 242, 197, 119, 81, 242, - 196, 119, 81, 242, 195, 119, 81, 242, 194, 119, 81, 242, 193, 119, 81, - 242, 192, 119, 81, 69, 252, 233, 119, 81, 219, 151, 119, 81, 219, 150, - 119, 81, 219, 149, 119, 81, 219, 148, 119, 81, 219, 147, 119, 81, 219, - 146, 119, 81, 219, 145, 119, 81, 219, 144, 119, 81, 219, 143, 119, 81, - 219, 142, 119, 81, 219, 141, 119, 81, 219, 140, 119, 81, 219, 139, 119, - 81, 219, 138, 119, 81, 219, 137, 119, 81, 219, 136, 119, 81, 219, 135, - 119, 81, 219, 134, 119, 81, 219, 133, 119, 81, 219, 132, 119, 81, 219, - 131, 119, 81, 219, 130, 119, 81, 219, 129, 119, 81, 219, 128, 119, 81, - 219, 127, 119, 81, 219, 126, 119, 81, 219, 125, 119, 81, 219, 124, 119, - 81, 219, 123, 119, 81, 219, 122, 119, 81, 219, 121, 119, 81, 219, 120, - 119, 81, 219, 119, 119, 81, 219, 118, 119, 81, 219, 117, 119, 81, 219, - 116, 119, 81, 219, 115, 119, 81, 219, 114, 119, 81, 219, 113, 119, 81, - 219, 112, 119, 81, 219, 111, 119, 81, 219, 110, 119, 81, 219, 109, 119, - 81, 219, 108, 119, 81, 219, 107, 119, 81, 219, 106, 119, 81, 219, 105, - 119, 81, 219, 104, 119, 81, 219, 103, 20, 217, 85, 245, 90, 223, 136, 20, - 217, 85, 250, 168, 20, 131, 250, 168, 20, 124, 250, 168, 20, 148, 250, - 168, 20, 245, 116, 250, 168, 20, 245, 170, 250, 168, 20, 224, 82, 250, - 168, 20, 225, 43, 250, 168, 20, 246, 235, 250, 168, 20, 232, 31, 250, - 168, 82, 7, 6, 1, 60, 82, 7, 6, 1, 253, 204, 82, 7, 6, 1, 251, 202, 82, - 7, 6, 1, 250, 46, 82, 7, 6, 1, 73, 82, 7, 6, 1, 246, 74, 82, 7, 6, 1, - 245, 67, 82, 7, 6, 1, 243, 225, 82, 7, 6, 1, 72, 82, 7, 6, 1, 237, 126, - 82, 7, 6, 1, 237, 17, 82, 7, 6, 1, 153, 82, 7, 6, 1, 189, 82, 7, 6, 1, - 207, 82, 7, 6, 1, 74, 82, 7, 6, 1, 230, 59, 82, 7, 6, 1, 228, 163, 82, 7, - 6, 1, 152, 82, 7, 6, 1, 198, 82, 7, 6, 1, 222, 201, 82, 7, 6, 1, 68, 82, - 7, 6, 1, 216, 216, 82, 7, 6, 1, 219, 40, 82, 7, 6, 1, 218, 151, 82, 7, 6, - 1, 218, 90, 82, 7, 6, 1, 217, 157, 221, 114, 224, 236, 252, 17, 7, 6, 1, - 198, 34, 30, 7, 6, 1, 251, 202, 34, 30, 7, 6, 1, 152, 34, 251, 100, 34, - 218, 153, 204, 7, 6, 1, 253, 204, 204, 7, 6, 1, 207, 204, 7, 6, 1, 230, - 59, 204, 7, 6, 1, 198, 204, 7, 6, 1, 219, 40, 204, 242, 154, 204, 233, - 52, 204, 226, 96, 204, 223, 219, 204, 229, 4, 232, 136, 34, 7, 6, 1, 243, - 225, 232, 136, 34, 7, 6, 1, 230, 59, 232, 136, 204, 7, 6, 1, 237, 126, - 232, 136, 204, 7, 6, 1, 153, 232, 136, 204, 7, 6, 1, 189, 232, 136, 204, - 7, 6, 1, 230, 59, 250, 98, 232, 136, 204, 7, 6, 1, 230, 59, 232, 136, - 204, 242, 67, 232, 136, 204, 187, 232, 136, 204, 226, 177, 40, 248, 184, - 40, 136, 243, 0, 204, 9, 220, 76, 240, 8, 204, 9, 220, 76, 240, 12, 204, - 9, 220, 76, 240, 18, 204, 52, 249, 92, 204, 9, 220, 76, 240, 24, 204, 9, - 220, 76, 240, 14, 204, 9, 220, 76, 239, 248, 204, 9, 220, 76, 240, 13, - 204, 9, 220, 76, 240, 23, 204, 9, 220, 76, 240, 0, 204, 9, 220, 76, 239, - 252, 204, 9, 220, 76, 240, 2, 204, 9, 220, 76, 240, 20, 204, 9, 220, 76, - 240, 9, 204, 9, 220, 76, 240, 22, 204, 9, 220, 76, 240, 1, 204, 9, 220, - 76, 240, 21, 204, 9, 220, 76, 239, 249, 204, 9, 220, 76, 239, 251, 204, - 9, 220, 76, 239, 247, 204, 9, 220, 76, 240, 15, 204, 9, 220, 76, 240, 16, - 204, 9, 220, 76, 239, 254, 204, 9, 220, 76, 240, 6, 204, 9, 220, 76, 240, - 4, 204, 9, 220, 76, 240, 27, 204, 9, 220, 76, 240, 26, 204, 9, 220, 76, - 239, 245, 204, 9, 220, 76, 240, 10, 204, 9, 220, 76, 240, 25, 204, 9, - 220, 76, 240, 17, 204, 9, 220, 76, 240, 5, 204, 9, 220, 76, 239, 246, - 204, 9, 220, 76, 240, 7, 221, 114, 224, 236, 252, 17, 9, 220, 76, 239, - 255, 221, 114, 224, 236, 252, 17, 9, 220, 76, 240, 26, 221, 114, 224, - 236, 252, 17, 9, 220, 76, 240, 24, 221, 114, 224, 236, 252, 17, 9, 220, - 76, 240, 11, 221, 114, 224, 236, 252, 17, 9, 220, 76, 239, 253, 221, 114, - 224, 236, 252, 17, 9, 220, 76, 240, 7, 221, 114, 224, 236, 252, 17, 9, - 220, 76, 239, 250, 221, 114, 224, 236, 252, 17, 9, 220, 76, 240, 19, 221, - 114, 224, 236, 252, 17, 9, 220, 76, 240, 3, 9, 13, 242, 57, 9, 13, 242, - 56, 9, 13, 242, 55, 9, 13, 242, 54, 9, 13, 242, 53, 9, 13, 242, 52, 9, - 13, 242, 51, 9, 13, 242, 50, 9, 13, 242, 49, 9, 13, 242, 48, 9, 13, 242, - 47, 9, 13, 242, 46, 9, 13, 242, 45, 9, 13, 242, 44, 9, 13, 242, 43, 9, - 13, 242, 42, 9, 13, 242, 41, 9, 13, 242, 40, 9, 13, 242, 39, 9, 13, 242, - 38, 9, 13, 242, 37, 9, 13, 242, 36, 9, 13, 242, 35, 9, 13, 242, 34, 9, - 13, 242, 33, 9, 13, 242, 32, 9, 13, 242, 31, 9, 13, 242, 30, 9, 13, 242, - 29, 9, 13, 242, 28, 9, 13, 242, 27, 9, 13, 242, 26, 9, 13, 242, 25, 9, - 13, 242, 24, 9, 13, 242, 23, 9, 13, 242, 22, 9, 13, 242, 21, 9, 13, 242, - 20, 9, 13, 242, 19, 9, 13, 242, 18, 9, 13, 242, 17, 9, 13, 242, 16, 9, - 13, 242, 15, 9, 13, 242, 14, 9, 13, 242, 13, 9, 13, 242, 12, 9, 13, 242, - 11, 9, 13, 242, 10, 9, 13, 242, 9, 9, 13, 242, 8, 9, 13, 242, 7, 9, 13, - 242, 6, 9, 13, 242, 5, 9, 13, 242, 4, 9, 13, 242, 3, 9, 13, 242, 2, 9, - 13, 242, 1, 9, 13, 242, 0, 9, 13, 241, 255, 9, 13, 241, 254, 9, 13, 241, - 253, 9, 13, 241, 252, 9, 13, 241, 251, 9, 13, 241, 250, 9, 13, 241, 249, - 9, 13, 241, 248, 9, 13, 241, 247, 9, 13, 241, 246, 9, 13, 241, 245, 9, - 13, 241, 244, 9, 13, 241, 243, 9, 13, 241, 242, 9, 13, 241, 241, 9, 13, - 241, 240, 9, 13, 241, 239, 9, 13, 241, 238, 9, 13, 241, 237, 9, 13, 241, - 236, 9, 13, 241, 235, 9, 13, 241, 234, 9, 13, 241, 233, 9, 13, 241, 232, - 9, 13, 241, 231, 9, 13, 241, 230, 9, 13, 241, 229, 9, 13, 241, 228, 9, - 13, 241, 227, 9, 13, 241, 226, 9, 13, 241, 225, 9, 13, 241, 224, 9, 13, - 241, 223, 9, 13, 241, 222, 9, 13, 241, 221, 9, 13, 241, 220, 9, 13, 241, - 219, 9, 13, 241, 218, 9, 13, 241, 217, 9, 13, 241, 216, 9, 13, 241, 215, - 9, 13, 241, 214, 9, 13, 241, 213, 9, 13, 241, 212, 9, 13, 241, 211, 9, - 13, 241, 210, 9, 13, 241, 209, 9, 13, 241, 208, 9, 13, 241, 207, 9, 13, - 241, 206, 9, 13, 241, 205, 9, 13, 241, 204, 9, 13, 241, 203, 9, 13, 241, - 202, 9, 13, 241, 201, 9, 13, 241, 200, 9, 13, 241, 199, 9, 13, 241, 198, - 9, 13, 241, 197, 9, 13, 241, 196, 9, 13, 241, 195, 9, 13, 241, 194, 9, - 13, 241, 193, 9, 13, 241, 192, 9, 13, 241, 191, 9, 13, 241, 190, 9, 13, - 241, 189, 9, 13, 241, 188, 9, 13, 241, 187, 9, 13, 241, 186, 9, 13, 241, - 185, 9, 13, 241, 184, 9, 13, 241, 183, 9, 13, 241, 182, 9, 13, 241, 181, - 9, 13, 241, 180, 9, 13, 241, 179, 9, 13, 241, 178, 9, 13, 241, 177, 9, - 13, 241, 176, 9, 13, 241, 175, 9, 13, 241, 174, 9, 13, 241, 173, 9, 13, - 241, 172, 9, 13, 241, 171, 9, 13, 241, 170, 9, 13, 241, 169, 9, 13, 241, - 168, 9, 13, 241, 167, 9, 13, 241, 166, 9, 13, 241, 165, 9, 13, 241, 164, - 9, 13, 241, 163, 9, 13, 241, 162, 9, 13, 241, 161, 9, 13, 241, 160, 9, - 13, 241, 159, 9, 13, 241, 158, 9, 13, 241, 157, 9, 13, 241, 156, 9, 13, - 241, 155, 9, 13, 241, 154, 9, 13, 241, 153, 9, 13, 241, 152, 9, 13, 241, - 151, 9, 13, 241, 150, 9, 13, 241, 149, 9, 13, 241, 148, 9, 13, 241, 147, - 9, 13, 241, 146, 9, 13, 241, 145, 9, 13, 241, 144, 9, 13, 241, 143, 9, - 13, 241, 142, 9, 13, 241, 141, 9, 13, 241, 140, 9, 13, 241, 139, 9, 13, - 241, 138, 9, 13, 241, 137, 9, 13, 241, 136, 9, 13, 241, 135, 9, 13, 241, - 134, 9, 13, 241, 133, 9, 13, 241, 132, 9, 13, 241, 131, 9, 13, 241, 130, - 9, 13, 241, 129, 9, 13, 241, 128, 9, 13, 241, 127, 9, 13, 241, 126, 9, - 13, 241, 125, 9, 13, 241, 124, 9, 13, 241, 123, 9, 13, 241, 122, 9, 13, - 241, 121, 9, 13, 241, 120, 9, 13, 241, 119, 9, 13, 241, 118, 9, 13, 241, - 117, 9, 13, 241, 116, 9, 13, 241, 115, 9, 13, 241, 114, 9, 13, 241, 113, - 9, 13, 241, 112, 9, 13, 241, 111, 9, 13, 241, 110, 9, 13, 241, 109, 9, - 13, 241, 108, 9, 13, 241, 107, 9, 13, 241, 106, 9, 13, 241, 105, 9, 13, - 241, 104, 9, 13, 241, 103, 9, 13, 241, 102, 9, 13, 241, 101, 9, 13, 241, - 100, 9, 13, 241, 99, 9, 13, 241, 98, 9, 13, 241, 97, 9, 13, 241, 96, 9, - 13, 241, 95, 9, 13, 241, 94, 9, 13, 241, 93, 9, 13, 241, 92, 9, 13, 241, - 91, 9, 13, 241, 90, 9, 13, 241, 89, 9, 13, 241, 88, 9, 13, 241, 87, 9, - 13, 241, 86, 9, 13, 241, 85, 9, 13, 241, 84, 9, 13, 241, 83, 9, 13, 241, - 82, 9, 13, 241, 81, 9, 13, 241, 80, 9, 13, 241, 79, 9, 13, 241, 78, 9, - 13, 241, 77, 9, 13, 241, 76, 9, 13, 241, 75, 9, 13, 241, 74, 9, 13, 241, - 73, 9, 13, 241, 72, 9, 13, 241, 71, 9, 13, 241, 70, 9, 13, 241, 69, 9, - 13, 241, 68, 9, 13, 241, 67, 9, 13, 241, 66, 9, 13, 241, 65, 9, 13, 241, - 64, 9, 13, 241, 63, 9, 13, 241, 62, 9, 13, 241, 61, 9, 13, 241, 60, 9, - 13, 241, 59, 9, 13, 241, 58, 9, 13, 241, 57, 9, 13, 241, 56, 9, 13, 241, - 55, 9, 13, 241, 54, 9, 13, 241, 53, 9, 13, 241, 52, 9, 13, 241, 51, 9, - 13, 241, 50, 9, 13, 241, 49, 9, 13, 241, 48, 9, 13, 241, 47, 9, 13, 241, - 46, 9, 13, 241, 45, 9, 13, 241, 44, 9, 13, 241, 43, 9, 13, 241, 42, 9, - 13, 241, 41, 9, 13, 241, 40, 9, 13, 241, 39, 9, 13, 241, 38, 9, 13, 241, - 37, 9, 13, 241, 36, 9, 13, 241, 35, 9, 13, 241, 34, 9, 13, 241, 33, 9, - 13, 241, 32, 9, 13, 241, 31, 9, 13, 241, 30, 9, 13, 241, 29, 9, 13, 241, - 28, 9, 13, 241, 27, 9, 13, 241, 26, 9, 13, 241, 25, 9, 13, 241, 24, 9, - 13, 241, 23, 9, 13, 241, 22, 9, 13, 241, 21, 9, 13, 241, 20, 9, 13, 241, - 19, 9, 13, 241, 18, 9, 13, 241, 17, 9, 13, 241, 16, 9, 13, 241, 15, 9, - 13, 241, 14, 9, 13, 241, 13, 9, 13, 241, 12, 9, 13, 241, 11, 9, 13, 241, - 10, 9, 13, 241, 9, 9, 13, 241, 8, 9, 13, 241, 7, 9, 13, 241, 6, 9, 13, - 241, 5, 9, 13, 241, 4, 9, 13, 241, 3, 9, 13, 241, 2, 9, 13, 241, 1, 9, - 13, 241, 0, 9, 13, 240, 255, 9, 13, 240, 254, 9, 13, 240, 253, 9, 13, - 240, 252, 9, 13, 240, 251, 9, 13, 240, 250, 9, 13, 240, 249, 9, 13, 240, - 248, 9, 13, 240, 247, 9, 13, 240, 246, 9, 13, 240, 245, 9, 13, 240, 244, - 9, 13, 240, 243, 9, 13, 240, 242, 9, 13, 240, 241, 9, 13, 240, 240, 9, - 13, 240, 239, 9, 13, 240, 238, 9, 13, 240, 237, 9, 13, 240, 236, 9, 13, - 240, 235, 9, 13, 240, 234, 9, 13, 240, 233, 9, 13, 240, 232, 9, 13, 240, - 231, 9, 13, 240, 230, 9, 13, 240, 229, 9, 13, 240, 228, 9, 13, 240, 227, - 9, 13, 240, 226, 9, 13, 240, 225, 9, 13, 240, 224, 9, 13, 240, 223, 9, - 13, 240, 222, 9, 13, 240, 221, 9, 13, 240, 220, 9, 13, 240, 219, 9, 13, - 240, 218, 9, 13, 240, 217, 9, 13, 240, 216, 9, 13, 240, 215, 9, 13, 240, - 214, 9, 13, 240, 213, 9, 13, 240, 212, 9, 13, 240, 211, 9, 13, 240, 210, - 9, 13, 240, 209, 9, 13, 240, 208, 9, 13, 240, 207, 9, 13, 240, 206, 9, - 13, 240, 205, 9, 13, 240, 204, 9, 13, 240, 203, 9, 13, 240, 202, 9, 13, - 240, 201, 9, 13, 240, 200, 9, 13, 240, 199, 9, 13, 240, 198, 9, 13, 240, - 197, 9, 13, 240, 196, 9, 13, 240, 195, 9, 13, 240, 194, 9, 13, 240, 193, - 9, 13, 240, 192, 9, 13, 240, 191, 9, 13, 240, 190, 9, 13, 240, 189, 9, - 13, 240, 188, 9, 13, 240, 187, 9, 13, 240, 186, 9, 13, 240, 185, 9, 13, - 240, 184, 9, 13, 240, 183, 9, 13, 240, 182, 9, 13, 240, 181, 9, 13, 240, - 180, 9, 13, 240, 179, 9, 13, 240, 178, 9, 13, 240, 177, 9, 13, 240, 176, - 9, 13, 240, 175, 9, 13, 240, 174, 9, 13, 240, 173, 9, 13, 240, 172, 9, - 13, 240, 171, 9, 13, 240, 170, 9, 13, 240, 169, 9, 13, 240, 168, 9, 13, - 240, 167, 9, 13, 240, 166, 9, 13, 240, 165, 9, 13, 240, 164, 9, 13, 240, - 163, 9, 13, 240, 162, 9, 13, 240, 161, 9, 13, 240, 160, 9, 13, 240, 159, - 9, 13, 240, 158, 9, 13, 240, 157, 9, 13, 240, 156, 9, 13, 240, 155, 9, - 13, 240, 154, 9, 13, 240, 153, 9, 13, 240, 152, 9, 13, 240, 151, 9, 13, - 240, 150, 9, 13, 240, 149, 9, 13, 240, 148, 9, 13, 240, 147, 9, 13, 240, - 146, 9, 13, 240, 145, 9, 13, 240, 144, 9, 13, 240, 143, 9, 13, 240, 142, - 9, 13, 240, 141, 9, 13, 240, 140, 9, 13, 240, 139, 9, 13, 240, 138, 9, - 13, 240, 137, 9, 13, 240, 136, 9, 13, 240, 135, 9, 13, 240, 134, 9, 13, - 240, 133, 9, 13, 240, 132, 9, 13, 240, 131, 9, 13, 240, 130, 9, 13, 240, - 129, 9, 13, 240, 128, 9, 13, 240, 127, 9, 13, 240, 126, 9, 13, 240, 125, - 9, 13, 240, 124, 9, 13, 240, 123, 9, 13, 240, 122, 9, 13, 240, 121, 9, - 13, 240, 120, 9, 13, 240, 119, 9, 13, 240, 118, 9, 13, 240, 117, 9, 13, - 240, 116, 9, 13, 240, 115, 9, 13, 240, 114, 9, 13, 240, 113, 9, 13, 240, - 112, 9, 13, 240, 111, 9, 13, 240, 110, 9, 13, 240, 109, 9, 13, 240, 108, - 9, 13, 240, 107, 9, 13, 240, 106, 9, 13, 240, 105, 9, 13, 240, 104, 9, - 13, 240, 103, 9, 13, 240, 102, 9, 13, 240, 101, 9, 13, 240, 100, 9, 13, - 240, 99, 9, 13, 240, 98, 9, 13, 240, 97, 9, 13, 240, 96, 9, 13, 240, 95, - 9, 13, 240, 94, 9, 13, 240, 93, 9, 13, 240, 92, 9, 13, 240, 91, 9, 13, - 240, 90, 9, 13, 240, 89, 9, 13, 240, 88, 9, 13, 240, 87, 9, 13, 240, 86, - 9, 13, 240, 85, 9, 13, 240, 84, 9, 13, 240, 83, 9, 13, 240, 82, 9, 13, - 240, 81, 9, 13, 240, 80, 9, 13, 240, 79, 9, 13, 240, 78, 9, 13, 240, 77, - 9, 13, 240, 76, 9, 13, 240, 75, 9, 13, 240, 74, 9, 13, 240, 73, 9, 13, - 240, 72, 9, 13, 240, 71, 9, 13, 240, 70, 9, 13, 240, 69, 9, 13, 240, 68, - 9, 13, 240, 67, 9, 13, 240, 66, 9, 13, 240, 65, 9, 13, 240, 64, 9, 13, - 240, 63, 9, 13, 240, 62, 9, 13, 240, 61, 9, 13, 240, 60, 9, 13, 240, 59, - 9, 13, 240, 58, 9, 13, 240, 57, 9, 13, 240, 56, 9, 13, 240, 55, 9, 13, - 240, 54, 9, 13, 240, 53, 9, 13, 240, 52, 9, 13, 240, 51, 9, 13, 240, 50, - 9, 13, 240, 49, 9, 13, 240, 48, 9, 13, 240, 47, 9, 13, 240, 46, 9, 13, - 240, 45, 9, 13, 240, 44, 9, 13, 240, 43, 9, 13, 240, 42, 9, 13, 240, 41, - 9, 13, 240, 40, 9, 13, 240, 39, 9, 13, 240, 38, 9, 13, 240, 37, 9, 13, - 240, 36, 9, 13, 240, 35, 9, 13, 240, 34, 9, 13, 240, 33, 9, 13, 240, 32, - 9, 13, 240, 31, 9, 13, 240, 30, 9, 13, 240, 29, 9, 13, 240, 28, 235, 148, - 222, 141, 118, 223, 254, 118, 246, 95, 78, 118, 228, 69, 78, 118, 54, 55, - 118, 248, 155, 55, 118, 229, 169, 55, 118, 254, 134, 118, 254, 79, 118, - 42, 229, 229, 118, 45, 229, 229, 118, 253, 251, 118, 88, 55, 118, 250, - 168, 118, 242, 120, 118, 245, 90, 223, 136, 118, 224, 17, 118, 20, 217, - 84, 118, 20, 107, 118, 20, 103, 118, 20, 160, 118, 20, 154, 118, 20, 174, - 118, 20, 182, 118, 20, 191, 118, 20, 185, 118, 20, 190, 118, 250, 175, - 118, 225, 67, 118, 235, 87, 55, 118, 246, 154, 55, 118, 244, 30, 55, 118, - 228, 82, 78, 118, 250, 167, 253, 244, 118, 7, 6, 1, 60, 118, 7, 6, 1, - 253, 204, 118, 7, 6, 1, 251, 202, 118, 7, 6, 1, 250, 46, 118, 7, 6, 1, - 73, 118, 7, 6, 1, 246, 74, 118, 7, 6, 1, 245, 67, 118, 7, 6, 1, 243, 225, - 118, 7, 6, 1, 72, 118, 7, 6, 1, 237, 126, 118, 7, 6, 1, 237, 17, 118, 7, - 6, 1, 153, 118, 7, 6, 1, 189, 118, 7, 6, 1, 207, 118, 7, 6, 1, 74, 118, - 7, 6, 1, 230, 59, 118, 7, 6, 1, 228, 163, 118, 7, 6, 1, 152, 118, 7, 6, - 1, 198, 118, 7, 6, 1, 222, 201, 118, 7, 6, 1, 68, 118, 7, 6, 1, 216, 216, - 118, 7, 6, 1, 219, 40, 118, 7, 6, 1, 218, 151, 118, 7, 6, 1, 218, 90, - 118, 7, 6, 1, 217, 157, 118, 42, 40, 115, 118, 227, 160, 224, 17, 118, - 45, 40, 115, 118, 250, 217, 255, 0, 118, 109, 235, 43, 118, 244, 37, 255, - 0, 118, 7, 3, 1, 60, 118, 7, 3, 1, 253, 204, 118, 7, 3, 1, 251, 202, 118, - 7, 3, 1, 250, 46, 118, 7, 3, 1, 73, 118, 7, 3, 1, 246, 74, 118, 7, 3, 1, - 245, 67, 118, 7, 3, 1, 243, 225, 118, 7, 3, 1, 72, 118, 7, 3, 1, 237, - 126, 118, 7, 3, 1, 237, 17, 118, 7, 3, 1, 153, 118, 7, 3, 1, 189, 118, 7, - 3, 1, 207, 118, 7, 3, 1, 74, 118, 7, 3, 1, 230, 59, 118, 7, 3, 1, 228, - 163, 118, 7, 3, 1, 152, 118, 7, 3, 1, 198, 118, 7, 3, 1, 222, 201, 118, - 7, 3, 1, 68, 118, 7, 3, 1, 216, 216, 118, 7, 3, 1, 219, 40, 118, 7, 3, 1, - 218, 151, 118, 7, 3, 1, 218, 90, 118, 7, 3, 1, 217, 157, 118, 42, 250, - 79, 115, 118, 69, 235, 43, 118, 45, 250, 79, 115, 118, 221, 179, 251, - 153, 222, 141, 41, 225, 251, 41, 225, 240, 41, 225, 229, 41, 225, 217, - 41, 225, 206, 41, 225, 195, 41, 225, 184, 41, 225, 173, 41, 225, 162, 41, - 225, 154, 41, 225, 153, 41, 225, 152, 41, 225, 151, 41, 225, 149, 41, - 225, 148, 41, 225, 147, 41, 225, 146, 41, 225, 145, 41, 225, 144, 41, - 225, 143, 41, 225, 142, 41, 225, 141, 41, 225, 140, 41, 225, 138, 41, - 225, 137, 41, 225, 136, 41, 225, 135, 41, 225, 134, 41, 225, 133, 41, - 225, 132, 41, 225, 131, 41, 225, 130, 41, 225, 129, 41, 225, 127, 41, - 225, 126, 41, 225, 125, 41, 225, 124, 41, 225, 123, 41, 225, 122, 41, - 225, 121, 41, 225, 120, 41, 225, 119, 41, 225, 118, 41, 225, 116, 41, - 225, 115, 41, 225, 114, 41, 225, 113, 41, 225, 112, 41, 225, 111, 41, - 225, 110, 41, 225, 109, 41, 225, 108, 41, 225, 107, 41, 225, 105, 41, - 225, 104, 41, 225, 103, 41, 225, 102, 41, 225, 101, 41, 225, 100, 41, - 225, 99, 41, 225, 98, 41, 225, 97, 41, 225, 96, 41, 225, 94, 41, 225, 93, - 41, 225, 92, 41, 225, 91, 41, 225, 90, 41, 225, 89, 41, 225, 88, 41, 225, - 87, 41, 225, 86, 41, 225, 85, 41, 225, 83, 41, 225, 82, 41, 225, 81, 41, - 225, 80, 41, 225, 79, 41, 225, 78, 41, 225, 77, 41, 225, 76, 41, 225, 75, - 41, 225, 74, 41, 226, 71, 41, 226, 70, 41, 226, 69, 41, 226, 68, 41, 226, - 67, 41, 226, 66, 41, 226, 65, 41, 226, 64, 41, 226, 63, 41, 226, 62, 41, - 226, 60, 41, 226, 59, 41, 226, 58, 41, 226, 57, 41, 226, 56, 41, 226, 55, - 41, 226, 54, 41, 226, 53, 41, 226, 52, 41, 226, 51, 41, 226, 49, 41, 226, - 48, 41, 226, 47, 41, 226, 46, 41, 226, 45, 41, 226, 44, 41, 226, 43, 41, - 226, 42, 41, 226, 41, 41, 226, 40, 41, 226, 38, 41, 226, 37, 41, 226, 36, - 41, 226, 35, 41, 226, 34, 41, 226, 33, 41, 226, 32, 41, 226, 31, 41, 226, - 30, 41, 226, 29, 41, 226, 27, 41, 226, 26, 41, 226, 25, 41, 226, 24, 41, - 226, 23, 41, 226, 22, 41, 226, 21, 41, 226, 20, 41, 226, 19, 41, 226, 18, - 41, 226, 16, 41, 226, 15, 41, 226, 14, 41, 226, 13, 41, 226, 12, 41, 226, - 11, 41, 226, 10, 41, 226, 9, 41, 226, 8, 41, 226, 7, 41, 226, 5, 41, 226, - 4, 41, 226, 3, 41, 226, 2, 41, 226, 1, 41, 226, 0, 41, 225, 255, 41, 225, - 254, 41, 225, 253, 41, 225, 252, 41, 225, 250, 41, 225, 249, 41, 225, - 248, 41, 225, 247, 41, 225, 246, 41, 225, 245, 41, 225, 244, 41, 225, - 243, 41, 225, 242, 41, 225, 241, 41, 225, 239, 41, 225, 238, 41, 225, - 237, 41, 225, 236, 41, 225, 235, 41, 225, 234, 41, 225, 233, 41, 225, - 232, 41, 225, 231, 41, 225, 230, 41, 225, 228, 41, 225, 227, 41, 225, - 226, 41, 225, 225, 41, 225, 224, 41, 225, 223, 41, 225, 222, 41, 225, - 221, 41, 225, 220, 41, 225, 219, 41, 225, 216, 41, 225, 215, 41, 225, - 214, 41, 225, 213, 41, 225, 212, 41, 225, 211, 41, 225, 210, 41, 225, - 209, 41, 225, 208, 41, 225, 207, 41, 225, 205, 41, 225, 204, 41, 225, - 203, 41, 225, 202, 41, 225, 201, 41, 225, 200, 41, 225, 199, 41, 225, - 198, 41, 225, 197, 41, 225, 196, 41, 225, 194, 41, 225, 193, 41, 225, - 192, 41, 225, 191, 41, 225, 190, 41, 225, 189, 41, 225, 188, 41, 225, - 187, 41, 225, 186, 41, 225, 185, 41, 225, 183, 41, 225, 182, 41, 225, - 181, 41, 225, 180, 41, 225, 179, 41, 225, 178, 41, 225, 177, 41, 225, - 176, 41, 225, 175, 41, 225, 174, 41, 225, 172, 41, 225, 171, 41, 225, - 170, 41, 225, 169, 41, 225, 168, 41, 225, 167, 41, 225, 166, 41, 225, - 165, 41, 225, 164, 41, 225, 163, 41, 225, 161, 41, 225, 160, 41, 225, - 159, 41, 225, 158, 41, 225, 157, 41, 225, 156, 41, 225, 155, -}; - -static unsigned char phrasebook_offset1[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, - 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, - 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 17, 87, 88, 89, 90, 91, - 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 103, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 104, 105, 106, 107, 108, - 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, - 123, 124, 125, 17, 126, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 127, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 128, 129, - 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 17, 146, 147, 148, 149, 150, 17, 17, 17, 17, 17, 17, 151, 17, - 152, 17, 153, 17, 154, 17, 155, 17, 17, 17, 156, 17, 17, 17, 17, 157, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 158, 159, 160, 161, 162, 163, - 164, 17, 165, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 166, 167, 168, 169, 170, 171, 172, 173, - 174, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 175, 176, 177, 178, 179, 17, 180, 17, 181, 182, - 183, 184, 185, 186, 187, 188, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 189, 190, 191, 192, 193, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 194, 195, 196, 197, 198, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 199, 17, 200, 201, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, -}; - -static unsigned int phrasebook_offset2[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 6, 9, 11, 14, 17, 19, 21, 24, 27, 29, 31, - 33, 35, 39, 41, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 69, 72, - 75, 78, 82, 86, 91, 96, 101, 105, 110, 115, 120, 124, 129, 134, 138, 142, - 146, 150, 155, 160, 164, 168, 173, 177, 182, 187, 192, 197, 202, 205, - 209, 212, 216, 219, 223, 227, 232, 237, 242, 246, 251, 256, 261, 265, - 270, 275, 279, 283, 287, 291, 296, 301, 305, 309, 314, 318, 323, 328, - 333, 338, 343, 347, 350, 354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 356, 360, 365, - 368, 371, 374, 377, 380, 383, 385, 388, 394, 402, 404, 408, 411, 413, - 416, 419, 422, 425, 429, 432, 435, 439, 441, 444, 450, 458, 465, 472, - 479, 484, 491, 497, 504, 511, 518, 526, 531, 539, 546, 552, 559, 566, - 574, 581, 589, 597, 602, 610, 617, 623, 630, 637, 644, 647, 653, 660, - 666, 673, 680, 687, 692, 698, 705, 711, 718, 725, 732, 740, 745, 753, - 760, 766, 773, 780, 788, 795, 803, 811, 816, 824, 831, 837, 844, 851, - 858, 861, 867, 874, 880, 887, 894, 901, 906, 914, 921, 928, 935, 942, - 949, 956, 963, 970, 978, 986, 994, 1002, 1010, 1018, 1026, 1034, 1041, - 1048, 1055, 1062, 1069, 1076, 1083, 1090, 1097, 1104, 1111, 1118, 1126, - 1134, 1142, 1150, 1158, 1166, 1174, 1182, 1190, 1198, 1205, 1212, 1220, - 1228, 1236, 1244, 1252, 1260, 1268, 1276, 1284, 1290, 1295, 1300, 1308, - 1316, 1324, 1332, 1337, 1344, 1351, 1359, 1367, 1375, 1383, 1393, 1403, - 1410, 1417, 1424, 1431, 1439, 1447, 1455, 1463, 1474, 1479, 1484, 1491, - 1498, 1505, 1512, 1519, 1526, 1531, 1536, 1543, 1550, 1558, 1566, 1574, - 1582, 1589, 1596, 1604, 1612, 1620, 1628, 1636, 1644, 1652, 1660, 1668, - 1676, 1683, 1690, 1697, 1704, 1711, 1718, 1725, 1732, 1740, 1748, 1755, - 1762, 1769, 1776, 1784, 1792, 1800, 1808, 1816, 1823, 1830, 1838, 1846, - 1854, 1862, 1867, 1873, 1879, 1886, 1893, 1898, 1903, 1909, 1916, 1923, - 1930, 1937, 1945, 1953, 1959, 1964, 1969, 1975, 1982, 1989, 1996, 2001, - 2006, 2011, 2018, 2025, 2032, 2039, 2046, 2051, 2059, 2069, 2078, 2085, - 2092, 2097, 2102, 2109, 2116, 2120, 2125, 2130, 2135, 2142, 2151, 2158, - 2165, 2174, 2181, 2188, 2193, 2200, 2207, 2214, 2221, 2228, 2233, 2240, - 2247, 2255, 2260, 2265, 2270, 2280, 2284, 2290, 2296, 2302, 2308, 2316, - 2329, 2337, 2342, 2352, 2357, 2362, 2372, 2377, 2384, 2391, 2399, 2407, - 2414, 2421, 2428, 2435, 2445, 2455, 2464, 2473, 2483, 2493, 2503, 2513, - 2518, 2528, 2538, 2548, 2558, 2566, 2574, 2581, 2588, 2596, 2604, 2612, - 2620, 2627, 2634, 2644, 2654, 2662, 2670, 2678, 2683, 2693, 2698, 2705, - 2712, 2717, 2722, 2730, 2738, 2748, 2758, 2765, 2772, 2780, 2788, 2796, - 2804, 2813, 2822, 2830, 2838, 2847, 2856, 2865, 2874, 2884, 2894, 2902, - 2910, 2919, 2928, 2937, 2946, 2956, 2966, 2974, 2982, 2991, 3000, 3009, - 3018, 3027, 3036, 3041, 3046, 3054, 3062, 3072, 3080, 3085, 3090, 3097, - 3104, 3111, 3118, 3125, 3132, 3142, 3152, 3162, 3172, 3179, 3186, 3196, - 3206, 3214, 3222, 3230, 3238, 3246, 3253, 3260, 3267, 3273, 3280, 3287, - 3294, 3303, 3313, 3323, 3330, 3337, 3343, 3348, 3354, 3360, 3366, 3373, - 3380, 3391, 3401, 3408, 3415, 3422, 3429, 3434, 3439, 3445, 3451, 3457, - 3465, 3473, 3480, 3485, 3490, 3497, 3503, 3510, 3519, 3528, 3537, 3544, - 3550, 3556, 3561, 3568, 3574, 3581, 3588, 3595, 3600, 3605, 3615, 3623, - 3632, 3637, 3642, 3652, 3659, 3667, 3676, 3681, 3687, 3693, 3700, 3705, - 3710, 3720, 3728, 3737, 3745, 3753, 3762, 3767, 3774, 3781, 3786, 3797, - 3805, 3813, 3819, 3828, 3833, 3838, 3845, 3851, 3857, 3863, 3869, 3878, - 3886, 3891, 3899, 3905, 3913, 3921, 3927, 3933, 3939, 3947, 3955, 3961, - 3969, 3975, 3980, 3987, 3995, 4004, 4011, 4018, 4028, 4035, 4042, 4052, - 4059, 4066, 4073, 4079, 4085, 4094, 4106, 4111, 4118, 4123, 4127, 4132, - 4140, 4147, 4152, 4157, 4161, 4166, 4171, 4175, 4180, 4186, 4192, 4198, - 4205, 4210, 4215, 4220, 4225, 4231, 4233, 4238, 4242, 4248, 4254, 4260, - 4265, 4272, 4279, 4285, 4292, 4300, 4308, 4313, 4318, 4322, 4327, 4329, - 4331, 4334, 4336, 4339, 4344, 4349, 4355, 4360, 4364, 4368, 4373, 4381, - 4387, 4392, 4398, 4403, 4409, 4417, 4425, 4429, 4433, 4438, 4444, 4450, - 4456, 4462, 4467, 4475, 4484, 4493, 4498, 4504, 4511, 4518, 4525, 4532, - 4536, 4542, 4547, 4552, 4557, 4562, 4565, 4568, 4571, 4574, 4577, 4580, - 4584, 4588, 4594, 4597, 4602, 4608, 4614, 4617, 4622, 4627, 4631, 4636, - 4642, 4648, 4654, 4659, 4664, 4669, 4672, 4678, 4683, 4688, 4692, 4697, - 4703, 4709, 4712, 4716, 4720, 4724, 4727, 4730, 4735, 4739, 4746, 4750, - 4756, 4760, 4766, 4770, 4774, 4778, 4783, 4788, 4794, 4799, 4806, 4812, - 4818, 4824, 4827, 4831, 4835, 4839, 4843, 4848, 4853, 4857, 4861, 4867, - 4871, 4875, 4880, 4886, 4891, 4896, 4900, 4906, 4911, 4916, 4921, 4926, - 4932, 4935, 4939, 4944, 4949, 4958, 4964, 4969, 4973, 4978, 4982, 4987, - 4991, 4995, 5000, 5004, 5010, 5015, 5020, 5025, 5030, 5035, 5040, 5046, - 5052, 5058, 5063, 5068, 5074, 5080, 5086, 5091, 5096, 5103, 5110, 5114, - 5120, 5127, 0, 0, 5134, 5137, 5145, 5154, 5164, 0, 0, 0, 0, 0, 5168, - 5171, 5176, 5184, 5189, 5197, 5205, 0, 5213, 0, 5221, 5229, 5237, 5248, - 5253, 5258, 5263, 5268, 5273, 5278, 5283, 5288, 5293, 5298, 5303, 5308, - 5313, 5318, 5323, 5328, 0, 5333, 5338, 5343, 5348, 5353, 5358, 5363, - 5368, 5376, 5384, 5392, 5400, 5408, 5416, 5427, 5432, 5437, 5442, 5447, - 5452, 5457, 5462, 5467, 5472, 5477, 5482, 5487, 5492, 5497, 5502, 5507, - 5512, 5518, 5523, 5528, 5533, 5538, 5543, 5548, 5553, 5561, 5569, 5577, - 5585, 5593, 5598, 5602, 5606, 5613, 5623, 5633, 5637, 5641, 5645, 5651, - 5658, 5662, 5667, 5671, 5676, 5680, 5685, 5689, 5694, 5699, 5704, 5709, - 5714, 5719, 5724, 5729, 5734, 5739, 5744, 5749, 5754, 5759, 5764, 5768, - 5772, 5778, 5782, 5787, 5793, 5800, 5805, 5810, 5817, 5822, 5827, 5833, - 5841, 5850, 5860, 5868, 5873, 5878, 5883, 5890, 5895, 5901, 5906, 5911, - 5916, 5921, 5926, 5931, 5939, 5945, 5950, 5954, 5959, 5964, 5969, 5974, - 5979, 5984, 5989, 5993, 5999, 6003, 6008, 6013, 6018, 6022, 6027, 6032, - 6037, 6042, 6046, 6051, 6055, 6060, 6065, 6070, 6075, 6081, 6086, 6092, - 6096, 6101, 6105, 6109, 6114, 6119, 6124, 6129, 6134, 6139, 6144, 6148, - 6154, 6158, 6163, 6168, 6173, 6177, 6182, 6187, 6192, 6197, 6201, 6206, - 6210, 6215, 6220, 6225, 6230, 6236, 6241, 6247, 6251, 6256, 6260, 6268, - 6273, 6278, 6283, 6290, 6295, 6301, 6306, 6311, 6316, 6321, 6326, 6331, - 6339, 6345, 6350, 6355, 6360, 6365, 6370, 6376, 6382, 6389, 6396, 6405, - 6414, 6421, 6428, 6437, 6446, 6451, 6456, 6461, 6466, 6471, 6476, 6481, - 6486, 6497, 6508, 6513, 6518, 6525, 6532, 6540, 6548, 6553, 6558, 6563, - 6568, 6572, 6576, 6580, 6585, 6590, 6594, 6601, 6606, 6616, 6626, 6632, - 6638, 6646, 6654, 6662, 6670, 6677, 6684, 6693, 6702, 6710, 6718, 6726, - 6734, 6741, 6748, 6755, 6762, 6768, 6774, 6780, 6786, 6794, 6802, 6809, - 6816, 6825, 6834, 6840, 6846, 6854, 6862, 6870, 6878, 6884, 6890, 6898, - 6906, 6914, 6922, 6929, 6936, 6944, 6952, 6960, 6968, 6973, 6978, 6985, - 6992, 7002, 7012, 7016, 7024, 7032, 7038, 7044, 7052, 7060, 7067, 7074, - 7082, 7090, 7097, 7104, 7112, 7120, 7125, 7132, 7139, 7146, 7153, 7159, - 7165, 7173, 7181, 7186, 7191, 7199, 7207, 7215, 7223, 7231, 7239, 7246, - 7253, 7261, 7269, 7277, 7285, 7292, 7299, 7305, 7311, 7320, 7329, 7336, - 7343, 7350, 7357, 7364, 7371, 7378, 7385, 7393, 7401, 7409, 7417, 7425, - 7433, 7442, 7451, 7458, 7465, 7472, 7479, 7486, 7493, 7500, 7507, 7514, - 7521, 7528, 7535, 7542, 7549, 7556, 7563, 7570, 7577, 7584, 7591, 7597, - 7603, 7610, 7617, 7622, 7627, 7632, 7637, 7642, 7647, 7652, 7657, 7662, - 7667, 7673, 7679, 7688, 7697, 7706, 7715, 7723, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 7731, 7736, 7741, 7746, 7751, 7756, 7761, 7766, 7771, 7775, - 7780, 7785, 7790, 7795, 7800, 7805, 7810, 7815, 7820, 7825, 7830, 7835, - 7840, 7845, 7850, 7855, 7860, 7865, 7869, 7874, 7879, 7884, 7889, 7894, - 7899, 7904, 7909, 7914, 0, 0, 7919, 7926, 7929, 7933, 7937, 7940, 7944, - 0, 7948, 7953, 7958, 7963, 7968, 7973, 7978, 7983, 7988, 7992, 7997, - 8002, 8007, 8012, 8017, 8022, 8027, 8032, 8037, 8042, 8047, 8052, 8057, - 8062, 8067, 8072, 8077, 8082, 8086, 8091, 8096, 8101, 8106, 8111, 8116, - 8121, 8126, 8131, 8136, 0, 8143, 8148, 0, 0, 0, 0, 0, 0, 8151, 8156, - 8161, 8166, 8173, 8180, 8185, 8190, 8195, 8200, 8205, 8210, 8215, 8222, - 8227, 8234, 8241, 8246, 8253, 8258, 8263, 8268, 8275, 8280, 8285, 8292, - 8301, 8306, 8311, 8316, 8321, 8327, 8332, 8339, 8346, 8353, 8358, 8363, - 8368, 8373, 8378, 8383, 8393, 8398, 8406, 8411, 8416, 8421, 8426, 8433, - 8440, 8447, 8453, 8459, 8466, 0, 0, 0, 0, 0, 0, 0, 0, 8473, 8477, 8481, - 8485, 8489, 8493, 8497, 8501, 8505, 8509, 8513, 8518, 8522, 8526, 8531, - 8535, 8540, 8544, 8548, 8552, 8557, 8561, 8566, 8570, 8574, 8578, 8582, - 0, 0, 0, 0, 0, 8586, 8593, 8601, 8608, 8613, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 8618, 8621, 8625, 8630, 0, 0, 8634, 8640, 8646, 8649, 8656, 8665, - 8668, 8671, 8676, 8682, 8686, 8694, 8700, 8706, 8714, 8718, 8723, 8734, - 8739, 8743, 8747, 8751, 0, 0, 8754, 8761, 0, 8765, 8769, 8776, 8782, - 8789, 8795, 8801, 8805, 8809, 8815, 8819, 8823, 8827, 8831, 8835, 8839, - 8843, 8847, 8851, 8855, 8859, 8863, 8867, 8871, 8875, 8879, 8883, 8891, - 8899, 8909, 8918, 8927, 8930, 8934, 8938, 8942, 8946, 8950, 8954, 8958, - 8962, 8967, 8971, 8974, 8977, 8980, 8983, 8986, 8989, 8992, 8995, 8999, - 9002, 9005, 9010, 9015, 9021, 9024, 9031, 9040, 9045, 9049, 0, 9056, - 9061, 9065, 9069, 9073, 9077, 9081, 9085, 9089, 9093, 9097, 9101, 9106, - 9111, 9118, 9124, 9130, 9136, 9141, 9149, 9157, 9162, 9168, 9174, 9180, - 9186, 9190, 9194, 9198, 9205, 9215, 9219, 9223, 9227, 9233, 9241, 9245, - 9249, 9256, 9260, 9264, 9268, 9275, 9282, 9294, 9298, 9302, 9306, 9316, - 9325, 9329, 9337, 9344, 9351, 9360, 9371, 9379, 9383, 9392, 9403, 9411, - 9424, 9432, 9440, 9448, 9456, 9462, 9471, 9478, 9482, 9490, 9494, 9501, - 9509, 9513, 9519, 9526, 9533, 9537, 9545, 9549, 9556, 9560, 9568, 9572, - 9580, 9588, 9595, 9603, 9611, 9618, 9624, 9628, 9635, 9643, 9649, 9656, - 9663, 9669, 9678, 9686, 9693, 9699, 9703, 9706, 9710, 9716, 9724, 9728, - 9734, 9740, 9747, 9754, 9757, 9764, 9769, 9777, 9782, 9786, 9799, 9812, - 9818, 9825, 9830, 9836, 9841, 9847, 9857, 9864, 9873, 9883, 9889, 9894, - 9899, 9903, 9907, 9912, 9917, 9923, 9931, 9939, 9950, 9955, 9964, 9973, - 9980, 9986, 9992, 9998, 10004, 10010, 10016, 10022, 10028, 10034, 10041, - 10048, 10055, 10061, 10069, 10078, 10084, 10091, 10098, 10103, 10108, - 10112, 10119, 10126, 10135, 10144, 10147, 10152, 10157, 0, 10162, 10166, - 10170, 10176, 10180, 10184, 10190, 10194, 10202, 10206, 10210, 10214, - 10218, 10222, 10228, 10232, 10238, 10242, 10246, 10250, 10254, 10258, - 10263, 10266, 10270, 10275, 10279, 10283, 10287, 10291, 10295, 10301, - 10307, 10313, 10317, 10321, 10326, 10330, 10334, 10339, 10343, 10347, - 10354, 10361, 10365, 10369, 10374, 10378, 10382, 10385, 10390, 10393, - 10396, 10401, 10406, 10410, 10414, 10420, 10426, 10429, 0, 0, 10432, - 10438, 10444, 10450, 10460, 10472, 10484, 10501, 10513, 10524, 10532, - 10539, 10550, 10565, 10576, 10582, 10591, 10599, 10611, 10621, 10629, - 10641, 10648, 10656, 10668, 10674, 10680, 10688, 10696, 10704, 10710, - 10720, 10727, 10737, 10747, 10760, 10774, 10788, 10798, 10809, 10820, - 10833, 10846, 10860, 10872, 10884, 10897, 10910, 10922, 10935, 10944, - 10952, 10957, 10962, 10967, 10972, 10977, 10982, 10987, 10992, 10997, - 11002, 11007, 11012, 11017, 11022, 11027, 11032, 11037, 11042, 11047, - 11052, 11057, 11062, 11067, 11072, 11077, 11082, 11087, 11092, 11097, - 11102, 11107, 11112, 11116, 11121, 11126, 11131, 11136, 11141, 11145, - 11149, 11153, 11157, 11161, 11165, 11169, 11173, 11177, 11181, 11185, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11190, 11195, 11199, 11203, 11207, - 11211, 11215, 11219, 11223, 11227, 11231, 11235, 11240, 11244, 11248, - 11252, 11257, 11261, 11266, 11270, 11275, 11279, 11284, 11289, 11294, - 11299, 11303, 11308, 11313, 11318, 11323, 11327, 11332, 11339, 11343, - 11348, 11352, 11356, 11361, 11365, 11372, 11379, 11386, 11392, 11400, - 11408, 11417, 11425, 11432, 11439, 11447, 11453, 11459, 11465, 11471, - 11478, 11483, 11487, 11492, 0, 0, 0, 0, 0, 11496, 11500, 11504, 11508, - 11512, 11516, 11520, 11524, 11528, 11532, 11536, 11540, 11544, 11548, - 11552, 11556, 11560, 11564, 11568, 11572, 11576, 11580, 11584, 11588, - 11592, 11596, 11600, 11607, 11613, 11618, 11622, 11629, 11635, 11640, - 11646, 11651, 11655, 11661, 11667, 11672, 11676, 11680, 11685, 11689, - 11693, 11698, 0, 0, 11702, 11707, 11712, 11717, 11722, 11727, 11732, - 11736, 11743, 11748, 11753, 11758, 11763, 11768, 11775, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11780, 11786, - 11790, 11794, 11798, 11803, 11806, 11810, 11813, 11817, 11820, 11824, - 11828, 11832, 11837, 11842, 11845, 11849, 11854, 11859, 11862, 11866, - 11869, 11873, 11877, 11881, 11885, 11889, 11893, 11897, 11901, 11905, - 11909, 11913, 11917, 11921, 11925, 11929, 11933, 11937, 11941, 11944, - 11948, 11951, 11955, 11959, 11963, 11966, 11969, 11972, 11976, 11980, - 11984, 11988, 11992, 11996, 12000, 12004, 0, 0, 12007, 12011, 12015, - 12020, 12024, 12029, 12033, 12038, 12043, 12049, 12055, 12061, 12065, - 12070, 12076, 12082, 12086, 12091, 12095, 0, 12101, 12104, 12110, 12116, - 12121, 12126, 0, 0, 12133, 12137, 12141, 12145, 12149, 12153, 12157, - 12161, 12165, 12170, 12175, 12180, 12186, 12189, 12193, 12197, 12200, - 12203, 12206, 12209, 12212, 12215, 12218, 12221, 12224, 12228, 12235, 0, - 0, 0, 0, 0, 0, 12240, 12244, 12248, 12252, 12256, 12262, 12266, 0, 12270, - 12274, 12278, 0, 12282, 12285, 12289, 12292, 12296, 12299, 12303, 12307, - 0, 0, 12311, 12314, 0, 0, 12318, 12321, 12325, 12328, 12332, 12336, - 12340, 12344, 12348, 12352, 12356, 12360, 12364, 12368, 12372, 12376, - 12380, 12384, 12388, 12392, 12396, 12400, 0, 12403, 12406, 12410, 12414, - 12418, 12421, 12424, 0, 12427, 0, 0, 0, 12431, 12435, 12439, 12443, 0, 0, - 12446, 12450, 12454, 12459, 12463, 12468, 12472, 12477, 12482, 0, 0, - 12488, 12492, 0, 0, 12497, 12501, 12506, 12510, 0, 0, 0, 0, 0, 0, 0, 0, - 12516, 0, 0, 0, 0, 12522, 12526, 0, 12530, 12534, 12539, 12544, 12549, 0, - 0, 12555, 12559, 12562, 12565, 12568, 12571, 12574, 12577, 12580, 12583, - 12586, 12595, 12604, 12608, 12612, 12618, 12624, 12630, 12636, 12650, - 12657, 12660, 0, 0, 0, 0, 0, 12664, 12670, 12674, 0, 12678, 12681, 12685, - 12688, 12692, 12695, 0, 0, 0, 0, 12699, 12703, 0, 0, 12707, 12711, 12715, - 12718, 12722, 12726, 12730, 12734, 12738, 12742, 12746, 12750, 12754, - 12758, 12762, 12766, 12770, 12774, 12778, 12782, 12786, 12790, 0, 12793, - 12796, 12800, 12804, 12808, 12811, 12814, 0, 12817, 12821, 0, 12825, - 12829, 0, 12833, 12837, 0, 0, 12840, 0, 12844, 12849, 12853, 12858, - 12862, 0, 0, 0, 0, 12867, 12872, 0, 0, 12877, 12882, 12887, 0, 0, 0, - 12891, 0, 0, 0, 0, 0, 0, 0, 12895, 12899, 12903, 12907, 0, 12911, 0, 0, - 0, 0, 0, 0, 0, 12915, 12919, 12922, 12925, 12928, 12931, 12934, 12937, - 12940, 12943, 12946, 12949, 12952, 12955, 12958, 12963, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 12967, 12971, 12975, 0, 12979, 12982, 12986, 12989, 12993, - 12996, 13000, 13004, 13008, 0, 13013, 13016, 13020, 0, 13025, 13028, - 13032, 13035, 13039, 13043, 13047, 13051, 13055, 13059, 13063, 13067, - 13071, 13075, 13079, 13083, 13087, 13091, 13095, 13099, 13103, 13107, 0, - 13110, 13113, 13117, 13121, 13125, 13128, 13131, 0, 13134, 13138, 0, - 13142, 13146, 13150, 13154, 13158, 0, 0, 13161, 13165, 13169, 13174, - 13178, 13183, 13187, 13192, 13197, 13203, 0, 13209, 13213, 13218, 0, - 13224, 13228, 13233, 0, 0, 13237, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 13240, 13245, 13250, 13255, 0, 0, 13261, 13265, 13268, 13271, - 13274, 13277, 13280, 13283, 13286, 13289, 0, 13292, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 13296, 13300, 13304, 0, 13308, 13311, 13315, - 13318, 13322, 13325, 13329, 13333, 0, 0, 13337, 13340, 0, 0, 13344, - 13347, 13351, 13354, 13358, 13362, 13366, 13370, 13374, 13378, 13382, - 13386, 13390, 13394, 13398, 13402, 13406, 13410, 13414, 13418, 13422, - 13426, 0, 13429, 13432, 13436, 13440, 13444, 13447, 13450, 0, 13453, - 13457, 0, 13461, 13465, 13469, 13473, 13477, 0, 0, 13480, 13484, 13488, - 13493, 13497, 13502, 13506, 13511, 13516, 0, 0, 13522, 13526, 0, 0, - 13531, 13535, 13540, 0, 0, 0, 0, 0, 0, 0, 0, 13544, 13550, 0, 0, 0, 0, - 13556, 13560, 0, 13564, 13568, 13573, 13578, 13583, 0, 0, 13589, 13593, - 13596, 13599, 13602, 13605, 13608, 13611, 13614, 13617, 13620, 13623, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13627, 13631, 0, 13635, - 13638, 13642, 13645, 13649, 13652, 0, 0, 0, 13656, 13659, 13663, 0, - 13667, 13670, 13674, 13678, 0, 0, 0, 13681, 13685, 0, 13689, 0, 13693, - 13697, 0, 0, 0, 13701, 13705, 0, 0, 0, 13709, 13712, 13716, 0, 0, 0, - 13719, 13722, 13725, 13728, 13732, 13736, 13740, 13744, 13748, 13752, - 13756, 13760, 0, 0, 0, 0, 13763, 13768, 13772, 13777, 13781, 0, 0, 0, - 13786, 13790, 13795, 0, 13800, 13804, 13809, 13814, 0, 0, 13818, 0, 0, 0, - 0, 0, 0, 13821, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13827, 13831, - 13834, 13837, 13840, 13843, 13846, 13849, 13852, 13855, 13858, 13862, - 13867, 13872, 13876, 13880, 13884, 13888, 13892, 13897, 13901, 0, 0, 0, - 0, 0, 0, 13904, 13908, 13912, 0, 13916, 13919, 13923, 13926, 13930, - 13933, 13937, 13941, 0, 13945, 13948, 13952, 0, 13956, 13959, 13963, - 13967, 13970, 13974, 13978, 13982, 13986, 13990, 13994, 13998, 14002, - 14006, 14010, 14014, 14018, 14022, 14026, 14030, 14034, 14038, 14042, 0, - 14045, 14048, 14052, 14056, 14060, 14063, 14066, 14069, 14073, 14077, 0, - 14081, 14085, 14089, 14093, 14097, 0, 0, 0, 14100, 14104, 14109, 14113, - 14118, 14122, 14127, 14132, 0, 14138, 14142, 14147, 0, 14152, 14156, - 14161, 14166, 0, 0, 0, 0, 0, 0, 0, 14170, 14174, 0, 14180, 14184, 0, 0, - 0, 0, 0, 0, 14188, 14193, 14198, 14203, 0, 0, 14209, 14213, 14216, 14219, - 14222, 14225, 14228, 14231, 14234, 14237, 0, 0, 0, 0, 0, 0, 0, 0, 14240, - 14253, 14265, 14277, 14289, 14301, 14313, 14325, 0, 0, 14329, 14333, 0, - 14337, 14340, 14344, 14347, 14351, 14354, 14358, 14362, 0, 14366, 14369, - 14373, 0, 14377, 14380, 14384, 14388, 14391, 14395, 14399, 14403, 14407, - 14411, 14415, 14419, 14423, 14427, 14431, 14435, 14439, 14443, 14447, - 14451, 14455, 14459, 14463, 0, 14466, 14469, 14473, 14477, 14481, 14484, - 14487, 14490, 14494, 14498, 0, 14502, 14506, 14510, 14514, 14518, 0, 0, - 14521, 14525, 14529, 14534, 14538, 14543, 14547, 14552, 14557, 0, 14563, - 14567, 14572, 0, 14577, 14581, 14586, 14591, 0, 0, 0, 0, 0, 0, 0, 14595, - 14599, 0, 0, 0, 0, 0, 0, 0, 14605, 0, 14609, 14614, 14619, 14624, 0, 0, - 14630, 14634, 14637, 14640, 14643, 14646, 14649, 14652, 14655, 14658, 0, - 14661, 14665, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14669, 14673, - 0, 14677, 14680, 14684, 14687, 14691, 14694, 14698, 14702, 0, 14706, - 14709, 14713, 0, 14717, 14720, 14724, 14728, 14731, 14735, 14739, 14743, - 14747, 14751, 14755, 14759, 14763, 14767, 14771, 14775, 14779, 14783, - 14787, 14791, 14795, 14799, 14803, 0, 14806, 14809, 14813, 14817, 14821, - 14824, 14827, 14830, 14834, 14838, 14842, 14846, 14850, 14854, 14858, - 14862, 0, 0, 0, 14865, 14869, 14874, 14878, 14883, 14887, 14892, 14897, - 0, 14903, 14907, 14912, 0, 14917, 14921, 14926, 14931, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 14935, 0, 0, 0, 0, 0, 0, 0, 0, 14941, 14946, 14951, 14956, 0, 0, - 14962, 14966, 14969, 14972, 14975, 14978, 14981, 14984, 14987, 14990, - 14993, 14997, 15002, 15007, 15013, 15019, 0, 0, 0, 15025, 15029, 15035, - 15040, 15046, 15051, 15057, 0, 0, 15063, 15067, 0, 15071, 15075, 15079, - 15083, 15087, 15091, 15095, 15099, 15103, 15107, 15111, 15115, 15119, - 15123, 15127, 15131, 15135, 15139, 0, 0, 0, 15143, 15149, 15155, 15161, - 15167, 15173, 15179, 15185, 15191, 15197, 15203, 15209, 15217, 15223, - 15229, 15235, 15241, 15247, 15253, 15259, 15265, 15271, 15277, 15283, 0, - 15289, 15295, 15301, 15307, 15313, 15319, 15323, 15329, 15333, 0, 15337, - 0, 0, 15343, 15347, 15353, 15359, 15365, 15369, 15375, 0, 0, 0, 15379, 0, - 0, 0, 0, 15383, 15388, 15395, 15402, 15409, 15416, 0, 15423, 0, 15430, - 15435, 15440, 15447, 15454, 15463, 15474, 15483, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15488, 15495, 15502, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 15507, 15513, 15519, 15525, 15531, 15537, 15543, 15549, - 15555, 15561, 15567, 15573, 15579, 15585, 15591, 15596, 15602, 15608, - 15614, 15620, 15626, 15631, 15637, 15643, 15649, 15655, 15661, 15667, - 15673, 15679, 15685, 15691, 15697, 15702, 15708, 15714, 15718, 15724, - 15728, 15734, 15740, 15746, 15752, 15758, 15764, 15769, 15775, 15779, - 15784, 15790, 15796, 15802, 15807, 15813, 15819, 15825, 15830, 15836, 0, - 0, 0, 0, 15840, 15846, 15851, 15857, 15862, 15870, 15878, 15882, 15886, - 15890, 15896, 15902, 15908, 15914, 15918, 15922, 15926, 15930, 15934, - 15937, 15940, 15943, 15946, 15949, 15952, 15955, 15958, 15961, 15965, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 15969, 15973, 0, 15979, 0, 0, 15985, - 15989, 0, 15993, 0, 0, 15999, 0, 0, 0, 0, 0, 0, 16003, 16007, 16010, - 16016, 0, 16022, 16026, 16030, 16034, 16040, 16046, 16052, 0, 16058, - 16062, 16066, 0, 16072, 0, 16078, 0, 0, 16082, 16088, 0, 16094, 16097, - 16103, 16106, 16110, 16117, 16122, 16127, 16131, 16136, 16141, 16146, - 16150, 0, 16155, 16162, 16168, 0, 0, 16174, 16178, 16183, 16187, 16192, - 0, 16197, 0, 16202, 16208, 16214, 16220, 16226, 16230, 0, 0, 16233, - 16237, 16240, 16243, 16246, 16249, 16252, 16255, 16258, 16261, 0, 0, - 16264, 16269, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16274, 16278, 16289, 16304, - 16319, 16329, 16340, 16353, 16364, 16370, 16378, 16388, 16394, 16402, - 16406, 16412, 16418, 16426, 16436, 16444, 16457, 16463, 16471, 16479, - 16491, 16498, 16506, 16514, 16522, 16530, 16538, 16546, 16556, 16560, - 16563, 16566, 16569, 16572, 16575, 16578, 16581, 16584, 16587, 16591, - 16595, 16599, 16603, 16607, 16611, 16615, 16619, 16623, 16628, 16634, - 16644, 16658, 16668, 16674, 16680, 16688, 16696, 16704, 16712, 16718, - 16724, 16727, 16731, 16735, 16739, 16743, 16747, 16751, 0, 16755, 16759, - 16763, 16767, 16771, 16775, 16779, 16783, 16787, 16791, 16795, 16798, - 16801, 16805, 16809, 16813, 16816, 16820, 16824, 16828, 16832, 16836, - 16840, 16844, 16848, 16851, 16854, 16858, 16862, 16866, 16870, 16873, - 16876, 16880, 16885, 16889, 0, 0, 0, 0, 16893, 16898, 16902, 16907, - 16911, 16916, 16921, 16927, 16932, 16938, 16942, 16947, 16951, 16956, - 16966, 16972, 16977, 16983, 16993, 16999, 17003, 17007, 17013, 17019, - 17027, 17033, 17041, 0, 0, 0, 0, 17049, 17054, 17060, 17066, 17072, - 17078, 17084, 17090, 0, 17096, 17102, 17108, 17114, 17120, 17126, 17132, - 17138, 17144, 17150, 17156, 17161, 17166, 17172, 17178, 17184, 17189, - 17195, 17201, 17207, 17213, 17219, 17225, 17231, 17237, 17242, 17247, - 17253, 17259, 17265, 17271, 17276, 17281, 17287, 17295, 17302, 0, 17309, - 17316, 17329, 17336, 17343, 17351, 17359, 17365, 17371, 17377, 17387, - 17392, 17398, 17408, 17418, 0, 17428, 17438, 17446, 17458, 17470, 17476, - 17490, 17505, 17510, 17515, 17523, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 17531, 17534, 17538, 17542, 17546, 17550, 17554, 17558, 17562, - 17566, 17570, 17574, 17578, 17582, 17586, 17590, 17594, 17598, 17602, - 17606, 17610, 17613, 17616, 17620, 17624, 17628, 17631, 17634, 17637, - 17641, 17645, 17649, 17652, 17656, 17659, 17664, 17667, 17671, 17674, - 17678, 17681, 17686, 17689, 17693, 17700, 17705, 17709, 17714, 17718, - 17723, 17727, 17732, 17739, 17745, 17750, 17754, 17758, 17762, 17766, - 17770, 17776, 17782, 17789, 17795, 17801, 17805, 17808, 17811, 17814, - 17817, 17820, 17823, 17826, 17829, 17832, 17838, 17842, 17846, 17850, - 17854, 17858, 17862, 17866, 17870, 17875, 17879, 17884, 17889, 17895, - 17900, 17906, 17912, 17918, 17924, 17930, 17938, 17946, 17955, 17963, - 17972, 17981, 17992, 18002, 18012, 18023, 18034, 18044, 18054, 18064, - 18074, 18084, 18094, 18104, 18114, 18122, 18129, 18135, 18142, 18147, - 18153, 18159, 18165, 18171, 18177, 18183, 18188, 18194, 18200, 18206, - 18212, 18217, 18226, 18233, 18239, 18246, 18254, 18260, 18266, 18272, - 18278, 18286, 18294, 18304, 18312, 18320, 18326, 18331, 18336, 18341, - 18346, 18351, 18356, 18361, 18366, 18371, 18377, 18383, 18389, 18396, - 18401, 18407, 18412, 18417, 18422, 18427, 18432, 18437, 18442, 18447, - 18452, 18457, 18462, 18467, 18472, 18477, 18482, 18487, 18492, 18497, - 18502, 18507, 18512, 18517, 18522, 18527, 18532, 18537, 18542, 18547, - 18552, 18557, 18562, 18567, 18572, 18577, 18582, 18587, 18592, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 18597, 18601, 18605, 18609, 18613, 18617, 18621, - 18625, 18629, 18633, 18637, 18641, 18645, 18649, 18653, 18657, 18661, - 18665, 18669, 18673, 18677, 18681, 18685, 18689, 18693, 18697, 18701, - 18705, 18709, 18713, 18717, 18721, 18725, 18729, 18733, 18737, 18741, - 18745, 18749, 18753, 18757, 18761, 18766, 18770, 18775, 0, 0, 0, 18780, - 18784, 18788, 18792, 18796, 18800, 18804, 18808, 18812, 18816, 18820, - 18824, 18828, 18832, 18836, 18840, 18844, 18848, 18852, 18856, 18860, - 18864, 18868, 18872, 18876, 18880, 18884, 18888, 18892, 18896, 18900, - 18904, 18908, 18912, 18916, 18920, 18924, 18928, 18932, 18936, 18940, - 18944, 18948, 18952, 18956, 18960, 18964, 18968, 18972, 18976, 18980, - 18984, 18988, 18992, 18996, 19000, 19004, 19008, 19012, 19016, 19020, - 19024, 19028, 19032, 19036, 19040, 19044, 19048, 19052, 19056, 19060, - 19064, 19068, 19072, 19076, 19080, 19084, 19088, 19092, 19096, 19100, - 19104, 19108, 19112, 19116, 19120, 19124, 19128, 19132, 19136, 19140, - 19144, 19148, 19152, 19156, 19160, 19164, 19168, 19171, 19175, 19178, - 19182, 19186, 19189, 19193, 19197, 19200, 19204, 19208, 19212, 19216, - 19219, 19223, 19227, 19231, 19235, 19239, 19243, 19246, 19250, 19254, - 19258, 19262, 19266, 19270, 19274, 19278, 19282, 19286, 19290, 19294, - 19298, 19302, 19306, 19310, 19314, 19318, 19322, 19326, 19330, 19334, - 19338, 19342, 19346, 19350, 19354, 19358, 19362, 19366, 19370, 19374, - 19378, 19382, 19386, 19390, 19394, 19398, 19402, 19406, 19410, 19414, - 19418, 19422, 19426, 19430, 19434, 19438, 19442, 19446, 19450, 19454, - 19458, 19462, 19466, 19470, 19474, 19478, 19482, 19486, 19490, 19494, - 19498, 19502, 19506, 19510, 19514, 19518, 19522, 19526, 19530, 19534, - 19538, 19542, 19546, 19550, 19554, 19558, 19562, 19566, 19570, 19574, - 19578, 19582, 19586, 19590, 19594, 19598, 19602, 19606, 19610, 19614, - 19618, 19622, 19626, 19630, 19634, 19638, 19642, 19646, 19650, 19654, - 19658, 19662, 19666, 19670, 19674, 19678, 19682, 19686, 19690, 19694, - 19698, 19702, 19706, 19710, 19714, 19718, 19722, 19726, 19730, 19734, - 19738, 19742, 19746, 19750, 19754, 19758, 19762, 19766, 19770, 19774, - 19778, 19782, 19786, 19790, 19794, 19798, 19801, 19805, 19809, 19813, - 19817, 19821, 19825, 19829, 19833, 19837, 19841, 19845, 19849, 19853, - 19857, 19861, 19865, 19869, 19873, 19877, 19881, 19885, 19889, 19893, - 19896, 19900, 19904, 19908, 19912, 19916, 19920, 19924, 19928, 19932, - 19936, 19940, 19944, 19948, 19952, 19956, 19959, 19963, 19967, 19971, - 19975, 19979, 19983, 19987, 19991, 19995, 19999, 20003, 20007, 20011, - 20015, 20019, 20023, 20027, 20031, 20035, 20039, 20043, 20047, 20051, - 20055, 20059, 20063, 20067, 20071, 20075, 20079, 20083, 0, 20087, 20091, - 20095, 20099, 0, 0, 20103, 20107, 20111, 20115, 20119, 20123, 20127, 0, - 20131, 0, 20135, 20139, 20143, 20147, 0, 0, 20151, 20155, 20159, 20163, - 20167, 20171, 20175, 20179, 20183, 20187, 20191, 20195, 20199, 20203, - 20207, 20211, 20215, 20219, 20223, 20227, 20231, 20235, 20239, 20242, - 20246, 20250, 20254, 20258, 20262, 20266, 20270, 20274, 20278, 20282, - 20286, 20290, 20294, 20298, 20302, 20306, 20310, 0, 20314, 20318, 20322, - 20326, 0, 0, 20330, 20333, 20337, 20341, 20345, 20349, 20353, 20357, - 20361, 20365, 20369, 20373, 20377, 20381, 20385, 20389, 20393, 20398, - 20403, 20408, 20414, 20420, 20425, 20430, 20436, 20439, 20443, 20447, - 20451, 20455, 20459, 20463, 20467, 0, 20471, 20475, 20479, 20483, 0, 0, - 20487, 20491, 20495, 20499, 20503, 20507, 20511, 0, 20515, 0, 20519, - 20523, 20527, 20531, 0, 0, 20535, 20539, 20543, 20547, 20551, 20555, - 20559, 20563, 20567, 20572, 20577, 20582, 20588, 20594, 20599, 0, 20604, - 20608, 20612, 20616, 20620, 20624, 20628, 20632, 20636, 20640, 20644, - 20648, 20652, 20656, 20660, 20664, 20668, 20671, 20675, 20679, 20683, - 20687, 20691, 20695, 20699, 20703, 20707, 20711, 20715, 20719, 20723, - 20727, 20731, 20735, 20739, 20743, 20747, 20751, 20755, 20759, 20763, - 20767, 20771, 20775, 20779, 20783, 20787, 20791, 20795, 20799, 20803, - 20807, 20811, 20815, 20819, 20823, 20827, 0, 20831, 20835, 20839, 20843, - 0, 0, 20847, 20851, 20855, 20859, 20863, 20867, 20871, 20875, 20879, - 20883, 20887, 20891, 20895, 20899, 20903, 20907, 20911, 20915, 20919, - 20923, 20927, 20931, 20935, 20939, 20943, 20947, 20951, 20955, 20959, - 20963, 20967, 20971, 20975, 20979, 20983, 20987, 20991, 20995, 20999, - 21003, 21007, 21011, 21015, 21019, 21023, 21027, 21031, 21035, 21039, - 21043, 21047, 21051, 21055, 21059, 21063, 21067, 21071, 21074, 21078, - 21082, 21086, 21090, 21094, 21098, 21102, 21106, 21110, 0, 0, 0, 0, - 21114, 21119, 21123, 21126, 21131, 21134, 21137, 21140, 21145, 21149, - 21154, 21157, 21160, 21163, 21166, 21169, 21172, 21175, 21178, 21181, - 21185, 21189, 21193, 21197, 21201, 21205, 21209, 21213, 21217, 21221, 0, - 0, 0, 21227, 21233, 21237, 21241, 21245, 21251, 21255, 21259, 21263, - 21269, 21273, 21277, 21281, 21287, 21291, 21295, 21299, 21305, 21311, - 21317, 21325, 21331, 21337, 21343, 21349, 21355, 0, 0, 0, 0, 0, 0, 21361, - 21364, 21367, 21370, 21373, 21376, 21380, 21384, 21387, 21391, 21395, - 21399, 21403, 21407, 21410, 21414, 21418, 21422, 21426, 21430, 21434, - 21438, 21442, 21446, 21450, 21454, 21457, 21461, 21465, 21469, 21473, - 21476, 21480, 21484, 21488, 21492, 21496, 21500, 21504, 21508, 21512, - 21516, 21520, 21524, 21528, 21532, 21535, 21539, 21543, 21547, 21551, - 21555, 21559, 21563, 21567, 21571, 21575, 21579, 21583, 21587, 21591, - 21595, 21599, 21603, 21607, 21611, 21615, 21619, 21623, 21627, 21631, - 21635, 21639, 21643, 21647, 21651, 21655, 21659, 21663, 21667, 21670, - 21674, 21678, 21682, 21686, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21690, - 21694, 21697, 21701, 21704, 21708, 21711, 21715, 21721, 21726, 21730, - 21733, 21737, 21741, 21746, 21750, 21755, 21759, 21764, 21768, 21773, - 21777, 21782, 21788, 21792, 21797, 21801, 21806, 21812, 21816, 21822, - 21828, 21832, 21837, 21845, 21853, 21860, 21865, 21870, 21879, 21886, - 21893, 21898, 21904, 21908, 21912, 21916, 21920, 21924, 21928, 21932, - 21936, 21940, 21944, 21950, 21955, 21960, 21963, 21967, 21971, 21976, - 21980, 21985, 21989, 21994, 21998, 22003, 22007, 22012, 22016, 22021, - 22025, 22030, 22036, 22040, 22045, 22050, 22054, 22058, 22062, 22066, - 22069, 22073, 22079, 22084, 22089, 22093, 22097, 22101, 22106, 22110, - 22115, 22119, 22124, 22127, 22131, 22135, 22140, 22144, 22149, 22153, - 22158, 22164, 22168, 22172, 22176, 22180, 22184, 22188, 22192, 22196, - 22200, 22204, 22208, 22214, 22217, 22221, 22225, 22230, 22234, 22239, - 22243, 22248, 22252, 22257, 22261, 22266, 22270, 22275, 22279, 22284, - 22290, 22294, 22298, 22304, 22310, 22316, 22322, 22326, 22330, 22334, - 22338, 22342, 22346, 22352, 22356, 22360, 22364, 22369, 22373, 22378, - 22382, 22387, 22391, 22396, 22400, 22405, 22409, 22414, 22418, 22423, - 22429, 22433, 22439, 22443, 22447, 22451, 22455, 22459, 22463, 22469, - 22472, 22476, 22480, 22485, 22489, 22494, 22498, 22503, 22507, 22512, - 22516, 22521, 22525, 22530, 22534, 22539, 22545, 22548, 22552, 22556, - 22561, 22566, 22570, 22574, 22578, 22582, 22586, 22590, 22596, 22599, - 22603, 22607, 22612, 22616, 22621, 22625, 22630, 22636, 22639, 22644, - 22648, 22652, 22656, 22660, 22664, 22668, 22672, 22678, 22682, 22686, - 22690, 22695, 22699, 22704, 22708, 22713, 22717, 22722, 22726, 22731, - 22735, 22740, 22744, 22749, 22752, 22756, 22760, 22764, 22768, 22772, - 22776, 22780, 22784, 22790, 22794, 22798, 22802, 22807, 22811, 22816, - 22820, 22825, 22829, 22834, 22838, 22843, 22847, 22852, 22856, 22861, - 22867, 22870, 22875, 22879, 22884, 22890, 22896, 22902, 22908, 22914, - 22920, 22926, 22930, 22934, 22938, 22942, 22946, 22950, 22954, 22958, - 22963, 22967, 22972, 22976, 22981, 22985, 22990, 22994, 22999, 23003, - 23008, 23012, 23017, 23021, 23025, 23029, 23033, 23037, 23041, 23045, - 23051, 23054, 23058, 23062, 23067, 23071, 23076, 23080, 23085, 23089, - 23094, 23098, 23103, 23107, 23112, 23116, 23121, 23127, 23131, 23137, - 23142, 23148, 23152, 23158, 23163, 23167, 23171, 23175, 23179, 23183, - 23188, 23191, 23195, 23200, 23204, 23209, 23212, 23216, 23220, 23224, - 23228, 23232, 23236, 23240, 23244, 23248, 23252, 23256, 23261, 23265, - 23269, 23275, 23279, 23285, 23289, 23295, 23299, 23303, 23307, 23311, - 23315, 23320, 23324, 23328, 23332, 23336, 23340, 23344, 23348, 23352, - 23356, 23360, 23366, 23372, 23378, 23384, 23390, 23395, 23401, 23407, - 23413, 23417, 23421, 23425, 23429, 23433, 23437, 23441, 23445, 23449, - 23453, 23457, 23461, 23465, 23470, 23475, 23480, 23484, 23488, 23492, - 23496, 23500, 23504, 23508, 23512, 23516, 23520, 23526, 23532, 23538, - 23544, 23550, 23556, 23562, 23568, 23574, 23578, 23582, 23586, 23590, - 23594, 23598, 23602, 23608, 23614, 23620, 23626, 23632, 23638, 23644, - 23650, 23656, 23661, 23666, 23671, 23676, 23682, 23688, 23694, 23700, - 23706, 23712, 23718, 23723, 23729, 23735, 23741, 23746, 23752, 23758, - 23764, 23769, 23774, 23779, 23784, 23789, 23794, 23799, 23804, 23809, - 23814, 23819, 23824, 23828, 23833, 23838, 23843, 23848, 23853, 23858, - 23863, 23868, 23873, 23878, 23883, 23888, 23893, 23898, 23903, 23908, - 23913, 23918, 23923, 23928, 23933, 23938, 23943, 23948, 23953, 23958, - 23963, 23968, 23973, 23977, 23982, 23987, 23992, 23997, 24002, 24007, - 24012, 24017, 24022, 24027, 24032, 24037, 24042, 24047, 24052, 24057, - 24062, 24067, 24072, 24077, 24082, 24087, 24092, 24097, 24102, 24106, - 24111, 24116, 24121, 24126, 24131, 24135, 24140, 24145, 24150, 24155, - 24160, 24164, 24169, 24175, 24180, 24185, 24190, 24195, 24201, 24206, - 24211, 24216, 24221, 24226, 24231, 24236, 24241, 24246, 24251, 24256, - 24261, 24266, 24271, 24276, 24281, 24286, 24291, 24296, 24301, 24306, - 24311, 24316, 24321, 24326, 24331, 24336, 24341, 24346, 24351, 24356, - 24361, 24366, 24371, 24376, 24381, 24386, 24391, 24396, 24401, 24406, - 24411, 24416, 24421, 24427, 24432, 24437, 24442, 24447, 24452, 24457, - 24462, 24467, 24472, 24477, 24482, 24487, 24492, 24497, 24502, 24507, - 24512, 24517, 24522, 24527, 24532, 24537, 24542, 24547, 24552, 24557, - 24562, 24567, 24572, 24577, 24582, 24587, 24592, 24597, 24602, 24607, - 24612, 24617, 24623, 24627, 24631, 24635, 24639, 24643, 24647, 24651, - 24655, 24661, 24667, 24673, 24679, 24685, 24691, 24697, 24704, 24710, - 24715, 24720, 24725, 24730, 24735, 24740, 24745, 24750, 24755, 24760, - 24765, 24770, 24775, 24780, 24785, 24790, 24795, 24800, 24805, 24810, - 24815, 24820, 24825, 24830, 24835, 24840, 24845, 24850, 0, 0, 0, 24856, - 24866, 24870, 24877, 24881, 24885, 24889, 24897, 24901, 24906, 24911, - 24916, 24920, 24925, 24930, 24933, 24937, 24941, 24950, 24954, 24958, - 24964, 24968, 24972, 24980, 24984, 24992, 24998, 25004, 25010, 25016, - 25025, 25030, 25034, 25043, 25046, 25052, 25056, 25062, 25067, 25073, - 25081, 25087, 25092, 25099, 25104, 25108, 25112, 25122, 25128, 25132, - 25142, 25148, 25152, 25156, 25163, 25170, 25175, 25180, 25189, 25193, - 25197, 25201, 25209, 25216, 25220, 25224, 25228, 25232, 25236, 25240, - 25244, 25248, 25252, 25256, 25260, 25265, 25270, 25275, 25279, 25283, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25287, 25291, 25295, 25299, - 25303, 25308, 25313, 25318, 25323, 25327, 25331, 25336, 25340, 0, 25344, - 25349, 25354, 25359, 25363, 25368, 25373, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 25378, 25382, 25386, 25390, 25394, 25399, 25404, 25409, 25414, 25418, - 25422, 25427, 25431, 25435, 25439, 25444, 25449, 25454, 25458, 25463, - 25468, 25473, 25479, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25484, 25488, 25492, - 25496, 25500, 25505, 25510, 25515, 25520, 25524, 25528, 25533, 25537, - 25541, 25545, 25550, 25555, 25560, 25564, 25569, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 25574, 25578, 25582, 25586, 25590, 25595, 25600, 25605, - 25610, 25614, 25618, 25623, 25627, 0, 25631, 25636, 25641, 0, 25646, - 25651, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25656, 25659, 25663, 25667, - 25671, 25675, 25679, 25683, 25687, 25691, 25695, 25699, 25703, 25707, - 25711, 25715, 25719, 25723, 25726, 25730, 25734, 25738, 25742, 25746, - 25750, 25754, 25758, 25762, 25766, 25770, 25774, 25778, 25782, 25785, - 25789, 25793, 25799, 25805, 25811, 25817, 25823, 25829, 25835, 25841, - 25847, 25853, 25859, 25865, 25871, 25877, 25886, 25895, 25901, 25907, - 25913, 25918, 25922, 25927, 25932, 25937, 25941, 25946, 25951, 25956, - 25960, 25965, 25969, 25974, 25979, 25984, 25989, 25993, 25997, 26001, - 26005, 26009, 26013, 26017, 26021, 26025, 26029, 26035, 26039, 26043, - 26047, 26051, 26055, 26063, 26069, 26073, 26079, 26083, 26089, 26093, 0, - 0, 26097, 26101, 26104, 26107, 26110, 26113, 26116, 26119, 26122, 26125, - 0, 0, 0, 0, 0, 0, 26128, 26136, 26144, 26152, 26160, 26168, 26176, 26184, - 26192, 26200, 0, 0, 0, 0, 0, 0, 26208, 26211, 26214, 26217, 26222, 26225, - 26230, 26237, 26245, 26250, 26257, 26260, 26267, 26274, 26281, 0, 26285, - 26289, 26292, 26295, 26298, 26301, 26304, 26307, 26310, 26313, 0, 0, 0, - 0, 0, 0, 26316, 26319, 26322, 26325, 26328, 26331, 26335, 26339, 26343, - 26346, 26350, 26354, 26357, 26361, 26365, 26368, 26372, 26376, 26380, - 26384, 26388, 26392, 26396, 26399, 26402, 26406, 26410, 26413, 26417, - 26421, 26425, 26429, 26433, 26437, 26441, 26445, 26452, 26457, 26462, - 26467, 26472, 26478, 26484, 26490, 26496, 26501, 26507, 26513, 26518, - 26524, 26530, 26536, 26542, 26548, 26553, 26559, 26564, 26570, 26576, - 26582, 26588, 26594, 26599, 26604, 26610, 26616, 26621, 26627, 26632, - 26638, 26643, 26648, 26654, 26660, 26666, 26672, 26678, 26684, 26690, - 26696, 26702, 26708, 26714, 26720, 26725, 26730, 26735, 26741, 0, 0, 0, - 0, 0, 0, 0, 0, 26747, 26756, 26765, 26773, 26781, 26791, 26799, 26808, - 26815, 26822, 26829, 26837, 26845, 26853, 26861, 26869, 26877, 26885, - 26893, 26900, 26908, 26916, 26924, 26932, 26940, 26950, 26960, 26970, - 26980, 26990, 27000, 27010, 27020, 27030, 27040, 27050, 27060, 27070, - 27080, 27088, 27096, 27106, 27114, 0, 0, 0, 0, 0, 27124, 27128, 27132, - 27136, 27140, 27144, 27148, 27152, 27156, 27160, 27164, 27168, 27172, - 27176, 27180, 27184, 27188, 27192, 27196, 27200, 27204, 27208, 27212, - 27216, 27222, 27226, 27232, 27236, 27242, 27246, 27252, 27256, 27260, - 27264, 27268, 27272, 27276, 27282, 27288, 27294, 27300, 27305, 27310, - 27315, 27321, 27327, 27333, 27339, 27346, 27352, 27357, 27362, 27366, - 27370, 27374, 27378, 27382, 27386, 27390, 27396, 27402, 27408, 27413, - 27420, 27425, 27430, 27436, 27441, 27448, 27455, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 27461, 27466, 27469, 27473, 27477, 27481, 27485, 27489, 27493, - 27497, 27501, 27505, 27509, 27513, 27517, 27521, 27524, 27527, 27531, - 27535, 27539, 27542, 27545, 27548, 27552, 27556, 27560, 27564, 27568, 0, - 0, 0, 27571, 27575, 27579, 27583, 27588, 27593, 27598, 27603, 27607, - 27611, 27616, 27621, 0, 0, 0, 0, 27627, 27631, 27636, 27641, 27646, - 27650, 27654, 27658, 27662, 27667, 27671, 27675, 0, 0, 0, 0, 27679, 0, 0, - 0, 27683, 27687, 27691, 27695, 27698, 27701, 27704, 27707, 27710, 27713, - 27716, 27719, 27722, 27727, 27733, 27739, 27745, 27751, 27756, 27762, - 27768, 27774, 27779, 27785, 27790, 27796, 27802, 27807, 27813, 27819, - 27825, 27830, 27835, 27840, 27846, 27852, 27857, 27863, 27868, 27874, - 27879, 27885, 0, 0, 27891, 27897, 27903, 27909, 27915, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 27921, 27928, 27935, 27941, 27948, 27955, 27961, 27968, - 27975, 27982, 27989, 27995, 28002, 28009, 28015, 28022, 28029, 28035, - 28042, 28049, 28055, 28061, 28068, 28074, 28080, 28087, 28093, 28100, - 28107, 28114, 28121, 28128, 28135, 28141, 28148, 28155, 28161, 28168, - 28175, 28182, 28189, 28196, 28203, 28210, 0, 0, 0, 0, 28217, 28225, - 28232, 28239, 28245, 28252, 28258, 28265, 28271, 28278, 28285, 28292, - 28299, 28306, 28313, 28320, 28327, 28334, 28341, 28348, 28354, 28360, - 28367, 28374, 28381, 28387, 0, 0, 0, 0, 0, 0, 28393, 28399, 28404, 28409, - 28414, 28419, 28424, 28429, 28434, 28439, 28444, 0, 0, 0, 28450, 28456, - 28462, 28466, 28472, 28478, 28484, 28490, 28496, 28502, 28508, 28514, - 28520, 28526, 28532, 28538, 28544, 28550, 28556, 28560, 28566, 28572, - 28578, 28584, 28590, 28596, 28602, 28608, 28614, 28620, 28626, 28632, - 28638, 28644, 28650, 28654, 28659, 28664, 28669, 28673, 28678, 28682, - 28687, 28692, 28697, 28701, 28706, 28711, 28716, 28721, 28726, 28730, - 28734, 28739, 28744, 28749, 28753, 28757, 28762, 28767, 28772, 28777, 0, - 0, 28783, 28787, 28794, 28799, 28805, 28811, 28816, 28822, 28828, 28833, - 28839, 28845, 28851, 28857, 28863, 28868, 28873, 28879, 28884, 28890, - 28895, 28901, 28907, 28913, 28919, 28923, 28928, 28933, 28939, 28945, - 28950, 28956, 28962, 28966, 28971, 28976, 28980, 28985, 28990, 28995, - 29000, 29006, 29012, 29018, 29023, 29028, 29032, 29037, 29041, 29046, - 29050, 29055, 29060, 29065, 29070, 29077, 29084, 29092, 29103, 29112, - 29120, 29127, 29138, 29144, 29151, 0, 29158, 29163, 29168, 29176, 29182, - 29190, 29195, 29201, 29207, 29213, 29218, 29224, 29229, 29236, 29242, - 29247, 29253, 29259, 29265, 29272, 29279, 29286, 29291, 29296, 29303, - 29310, 29317, 29324, 29331, 0, 0, 29338, 29345, 29352, 29358, 29364, - 29370, 29376, 29382, 29388, 29394, 29400, 0, 0, 0, 0, 0, 0, 29406, 29412, - 29417, 29422, 29427, 29432, 29437, 29442, 29447, 29452, 0, 0, 0, 0, 0, 0, - 29457, 29462, 29467, 29472, 29477, 29482, 29487, 29495, 29502, 29507, - 29512, 29517, 29522, 29527, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29532, 29538, - 29544, 29548, 29552, 29556, 29560, 29566, 29570, 29576, 29580, 29586, - 29592, 29600, 29606, 29614, 29618, 29622, 29626, 29632, 29635, 29640, - 29644, 29650, 29654, 29658, 29664, 29668, 29674, 29678, 29684, 29692, - 29700, 29708, 29714, 29718, 29724, 29728, 29734, 29737, 29740, 29746, - 29750, 29756, 29759, 29762, 29765, 29769, 29773, 29779, 29785, 29789, - 29792, 29796, 29801, 29806, 29813, 29818, 29825, 29832, 29841, 29848, - 29857, 29862, 29869, 29876, 29885, 29890, 29897, 29902, 29908, 29914, - 29920, 29926, 29932, 29938, 0, 0, 0, 0, 29944, 29948, 29951, 29954, - 29957, 29960, 29963, 29966, 29969, 29972, 29975, 29978, 29981, 29984, - 29989, 29994, 29999, 30002, 30007, 30012, 30017, 30022, 30029, 30034, - 30039, 30044, 30049, 30056, 30062, 30068, 30074, 30080, 30086, 30095, - 30104, 30110, 30116, 30125, 30134, 30143, 30152, 30161, 30170, 30179, - 30188, 0, 0, 0, 30197, 30202, 30207, 30212, 30216, 30220, 30224, 30229, - 30233, 30237, 30242, 30246, 30251, 30256, 30261, 30266, 30271, 30276, - 30281, 30286, 30291, 30295, 30299, 30304, 30309, 30314, 30318, 30322, - 30326, 30331, 30336, 30341, 30346, 30350, 30357, 30364, 30371, 30377, - 30383, 30389, 30395, 30401, 30407, 0, 0, 0, 30412, 30417, 30422, 30427, - 30431, 30435, 30439, 30443, 30447, 30451, 30455, 30459, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 30463, 30466, 30470, - 30474, 30478, 30482, 30486, 30490, 30494, 30498, 30502, 30506, 30510, - 30514, 30517, 30520, 30524, 30528, 30532, 30536, 30540, 30544, 30547, - 30551, 30555, 30559, 30563, 30566, 30569, 30573, 30576, 30580, 30584, - 30588, 30592, 30596, 30599, 30604, 30609, 30614, 30618, 30622, 30627, - 30631, 30636, 30640, 30646, 30651, 30656, 30661, 30667, 30672, 30678, - 30684, 30690, 30694, 0, 0, 0, 30698, 30703, 30712, 30717, 30724, 30729, - 30733, 30736, 30739, 30742, 30745, 30748, 30751, 30754, 30757, 0, 0, 0, - 30760, 30764, 30768, 30772, 30779, 30785, 30791, 30797, 30803, 30809, - 30815, 30821, 30827, 30833, 30840, 30847, 30854, 30861, 30868, 30875, - 30882, 30889, 30896, 30903, 30910, 30917, 30924, 30931, 30938, 30945, - 30952, 30959, 30966, 30973, 30980, 30987, 30994, 31001, 31008, 31015, - 31022, 31029, 31036, 31043, 31051, 31059, 31067, 31073, 31079, 31085, - 31093, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31102, 31107, 31112, 31117, 31122, 31131, - 31142, 31151, 31162, 31168, 31181, 31187, 31194, 31201, 31206, 31212, - 31218, 31229, 31238, 31245, 31252, 31260, 31267, 31275, 31285, 31295, - 31302, 31309, 31316, 31326, 31331, 31339, 31345, 31353, 31362, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 31367, 31372, 31378, 31384, 31392, 31398, - 31404, 31410, 31415, 31422, 31427, 31433, 31439, 31447, 31452, 31458, - 31463, 31470, 31476, 31484, 31492, 31498, 31504, 31511, 31518, 31524, - 31530, 31536, 31542, 31547, 31553, 31561, 31568, 31574, 31580, 31586, - 31592, 31600, 31604, 31610, 31616, 31622, 31628, 31634, 31640, 31644, - 31649, 31654, 31661, 31666, 31670, 31675, 31680, 31685, 31689, 31694, - 31699, 31703, 31707, 31711, 31716, 31720, 31725, 31730, 31734, 31739, - 31743, 31748, 31752, 31757, 31762, 31768, 31773, 31778, 31782, 31787, - 31793, 31800, 31805, 31810, 31815, 31819, 31824, 31828, 31834, 31841, - 31848, 31853, 31858, 31862, 31868, 31873, 31878, 31883, 31888, 31894, - 31899, 31905, 31910, 31916, 31922, 31928, 31935, 31942, 31949, 31956, - 31963, 31970, 31975, 31984, 31994, 32004, 32014, 32024, 32034, 32044, - 32057, 32067, 32077, 32087, 32093, 32098, 32105, 32113, 32121, 32128, - 32135, 32142, 32149, 32157, 32166, 32175, 32184, 32193, 32202, 32211, - 32220, 32229, 32238, 32247, 32256, 32265, 32274, 32283, 32291, 32300, - 32311, 32319, 32329, 32340, 32349, 32358, 32368, 32377, 32385, 32394, - 32400, 32405, 32413, 32418, 32425, 32430, 32439, 32445, 32451, 32458, - 32463, 32468, 32476, 32484, 32493, 32502, 32507, 32514, 32524, 32532, - 32541, 32546, 32552, 32557, 32564, 32569, 32578, 32583, 32588, 32593, - 32600, 32606, 32611, 32620, 32628, 32633, 32638, 32645, 32652, 32656, - 32660, 32663, 32666, 32669, 32672, 32675, 32678, 32685, 32688, 32691, - 32696, 32700, 32704, 32708, 32712, 32716, 32726, 32732, 32738, 32744, - 32752, 32760, 32766, 32772, 32779, 32785, 32790, 32796, 32802, 32807, - 32813, 32819, 32827, 32832, 32838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 32844, 32850, 32855, 32864, 32872, 32880, - 32887, 32894, 32901, 32908, 32916, 32924, 32934, 32944, 32952, 32960, - 32968, 32976, 32985, 32994, 33002, 33010, 33019, 33028, 33038, 33048, - 33057, 33066, 33074, 33082, 33090, 33098, 33108, 33118, 33126, 33134, - 33142, 33150, 33158, 33166, 33174, 33182, 33190, 33198, 33206, 33214, - 33223, 33232, 33241, 33250, 33260, 33270, 33277, 33284, 33292, 33300, - 33309, 33318, 33326, 33334, 33346, 33358, 33367, 33376, 33385, 33394, - 33401, 33408, 33416, 33424, 33432, 33440, 33448, 33456, 33464, 33472, - 33481, 33490, 33499, 33508, 33517, 33526, 33536, 33546, 33556, 33566, - 33575, 33584, 33591, 33598, 33606, 33614, 33622, 33630, 33638, 33646, - 33658, 33670, 33679, 33688, 33696, 33704, 33712, 33720, 33731, 33742, - 33753, 33764, 33776, 33788, 33796, 33804, 33812, 33820, 33829, 33838, - 33847, 33856, 33864, 33872, 33880, 33888, 33896, 33904, 33913, 33922, - 33932, 33942, 33950, 33958, 33966, 33974, 33982, 33990, 33997, 34004, - 34012, 34020, 34028, 34036, 34044, 34052, 34060, 34068, 34076, 34084, - 34092, 34100, 34108, 34116, 34124, 34132, 34141, 34150, 34159, 34167, - 34176, 34185, 34194, 34203, 34213, 34222, 34228, 34233, 34240, 34247, - 34255, 34263, 34272, 34281, 34291, 34301, 34312, 34323, 34333, 34343, - 34353, 34363, 34372, 34381, 34391, 34401, 34412, 34423, 34433, 34443, - 34453, 34463, 34470, 34477, 34485, 34493, 34500, 34507, 34516, 34525, - 34535, 34545, 34556, 34567, 34577, 34587, 34597, 34607, 34616, 34625, - 34633, 34641, 34648, 34655, 34663, 34671, 34680, 34689, 34699, 34709, - 34720, 34731, 34741, 34751, 34761, 34771, 34780, 34789, 34799, 34809, - 34820, 34831, 34841, 34851, 34861, 34871, 34878, 34885, 34893, 34901, - 34910, 34919, 34929, 34939, 34950, 34961, 34971, 34981, 34991, 35001, - 35009, 35017, 35025, 35033, 35042, 35051, 35059, 35067, 35074, 35081, - 35088, 35095, 35103, 35111, 35119, 35127, 35137, 35147, 35157, 35167, - 35177, 35187, 35195, 35203, 35213, 35223, 35233, 35243, 35253, 35263, - 35271, 35279, 35289, 35299, 35309, 0, 0, 35319, 35327, 35335, 35345, - 35355, 35365, 0, 0, 35375, 35383, 35391, 35401, 35411, 35421, 35431, - 35441, 35451, 35459, 35467, 35477, 35487, 35497, 35507, 35517, 35527, - 35535, 35543, 35553, 35563, 35573, 35583, 35593, 35603, 35611, 35619, - 35629, 35639, 35649, 35659, 35669, 35679, 35687, 35695, 35705, 35715, - 35725, 0, 0, 35735, 35743, 35751, 35761, 35771, 35781, 0, 0, 35791, - 35799, 35807, 35817, 35827, 35837, 35847, 35857, 0, 35867, 0, 35875, 0, - 35885, 0, 35895, 35905, 35913, 35921, 35931, 35941, 35951, 35961, 35971, - 35981, 35989, 35997, 36007, 36017, 36027, 36037, 36047, 36057, 36065, - 36073, 36081, 36089, 36097, 36105, 36113, 36121, 36129, 36137, 36145, - 36153, 36161, 0, 0, 36169, 36179, 36189, 36202, 36215, 36228, 36241, - 36254, 36267, 36277, 36287, 36300, 36313, 36326, 36339, 36352, 36365, - 36375, 36385, 36398, 36411, 36424, 36437, 36450, 36463, 36473, 36483, - 36496, 36509, 36522, 36535, 36548, 36561, 36571, 36581, 36594, 36607, - 36620, 36633, 36646, 36659, 36669, 36679, 36692, 36705, 36718, 36731, - 36744, 36757, 36765, 36773, 36784, 36792, 0, 36803, 36811, 36822, 36830, - 36838, 36846, 36854, 36862, 36865, 36868, 36871, 36874, 36880, 36891, - 36899, 0, 36910, 36918, 36929, 36937, 36945, 36953, 36961, 36969, 36974, - 36979, 36984, 36992, 37000, 37011, 0, 0, 37022, 37030, 37041, 37049, - 37057, 37065, 0, 37073, 37078, 37083, 37088, 37096, 37104, 37115, 37126, - 37134, 37142, 37150, 37161, 37169, 37177, 37185, 37193, 37201, 37207, - 37213, 0, 0, 37216, 37227, 37235, 0, 37246, 37254, 37265, 37273, 37281, - 37289, 37297, 37305, 37308, 0, 37311, 37315, 37319, 37323, 37327, 37331, - 37335, 37339, 37343, 37347, 37351, 37355, 37361, 37367, 37373, 37376, - 37379, 37381, 37385, 37389, 37393, 37397, 37399, 37403, 37407, 37413, - 37419, 37426, 37433, 37438, 37443, 37449, 37455, 37457, 37460, 37462, - 37466, 37470, 37474, 37477, 37481, 37485, 37489, 37493, 37497, 37503, - 37507, 37511, 37517, 37522, 37529, 37531, 37534, 37538, 37541, 37545, - 37550, 37552, 37561, 37570, 37573, 37577, 37579, 37581, 37583, 37586, - 37592, 37594, 37598, 37602, 37609, 37616, 37620, 37625, 37630, 37635, - 37639, 37643, 37647, 37650, 37653, 37657, 37664, 37669, 37673, 37677, - 37682, 37686, 37690, 37695, 37700, 37704, 37708, 37712, 37714, 37719, - 37724, 37728, 37732, 37736, 37740, 0, 0, 0, 0, 0, 37744, 37750, 37756, - 37763, 37770, 37775, 37780, 37784, 0, 0, 37790, 37793, 37796, 37799, - 37802, 37805, 37808, 37812, 37816, 37821, 37826, 37831, 37837, 37841, - 37844, 37847, 37850, 37853, 37856, 37859, 37862, 37865, 37868, 37872, - 37876, 37881, 37886, 0, 37891, 37897, 37903, 37909, 37916, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 37923, 37926, 37929, 37932, 37937, 37940, 37943, 37946, - 37949, 37952, 37955, 37959, 37962, 37965, 37968, 37971, 37974, 37979, - 37982, 37985, 37988, 37991, 37994, 37999, 38002, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38005, 38010, 38015, 38022, - 38030, 38035, 38040, 38044, 38048, 38053, 38060, 38067, 38071, 38076, - 38081, 38086, 38091, 38098, 38103, 38108, 38113, 38122, 38129, 38135, - 38139, 38144, 38150, 38155, 38162, 38170, 38178, 38182, 38186, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 38190, 38194, 38201, 38205, 38209, - 38214, 38218, 38222, 38226, 38228, 38232, 38236, 38240, 38245, 38249, - 38253, 38261, 38264, 38268, 38271, 38274, 38280, 38283, 38286, 38292, - 38296, 38300, 38304, 38307, 38311, 38314, 38318, 38320, 38323, 38326, - 38330, 38332, 38336, 38339, 38342, 38347, 38352, 38358, 38361, 38364, - 38368, 38373, 38376, 38379, 38382, 38386, 38390, 38393, 38396, 38398, - 38401, 38404, 38407, 38411, 38416, 38419, 38423, 38427, 38431, 38435, - 38440, 38445, 38449, 38453, 38458, 38463, 38468, 38472, 38476, 38481, - 38485, 38488, 38491, 38493, 38497, 38502, 38509, 38516, 38523, 38530, - 38537, 38544, 38551, 38558, 38566, 38573, 38581, 38588, 38595, 38603, - 38611, 38616, 38621, 38626, 38631, 38636, 38641, 38646, 38651, 38656, - 38661, 38667, 38673, 38679, 38685, 38692, 38700, 38707, 38713, 38719, - 38725, 38731, 38737, 38743, 38749, 38755, 38761, 38768, 38775, 38782, - 38789, 38797, 38806, 38814, 38825, 38833, 38841, 38849, 38855, 38864, - 38873, 38881, 38890, 0, 0, 0, 0, 0, 0, 38898, 38900, 38903, 38905, 38908, - 38911, 38914, 38919, 38924, 38929, 38934, 38938, 38942, 38946, 38950, - 38955, 38961, 38966, 38972, 38977, 38982, 38987, 38993, 38998, 39004, - 39010, 39014, 39018, 39023, 39028, 39033, 39038, 39043, 39051, 39059, - 39067, 39075, 39082, 39090, 39097, 39104, 39112, 39122, 39129, 39136, - 39143, 39150, 39158, 39166, 39173, 39180, 39188, 39196, 39201, 39209, - 39214, 39219, 39225, 39230, 39236, 39243, 39250, 39255, 39261, 39266, - 39269, 39273, 39276, 39280, 39284, 39288, 39294, 39300, 39306, 39312, - 39316, 39320, 39324, 39328, 39334, 39340, 39344, 39349, 39353, 39358, - 39362, 39366, 39369, 39373, 39376, 39380, 39387, 39395, 39406, 39417, - 39422, 39431, 39438, 39446, 39454, 39458, 39464, 39472, 39476, 39481, - 39486, 39492, 39498, 39504, 39511, 39515, 39519, 39524, 39527, 39529, - 39533, 39537, 39544, 39548, 39550, 39552, 39556, 39563, 39568, 39574, - 39583, 39590, 39595, 39599, 39603, 39607, 39610, 39613, 39616, 39620, - 39624, 39628, 39632, 39636, 39639, 39643, 39647, 39650, 39652, 39655, - 39657, 39661, 39665, 39667, 39672, 39675, 39679, 39683, 39687, 39689, - 39691, 39693, 39696, 39700, 39704, 39708, 39712, 39716, 39722, 39728, - 39730, 39732, 39734, 39736, 39739, 39741, 39745, 39747, 39751, 39754, - 39759, 39763, 39767, 39770, 39774, 39778, 39783, 39787, 39796, 39806, - 39810, 39815, 39821, 39825, 39829, 39832, 39837, 39841, 39847, 39851, - 39862, 39870, 39874, 39878, 39884, 39888, 39891, 39893, 39896, 39900, - 39904, 39910, 39914, 39918, 39921, 39924, 39928, 39933, 39938, 39943, - 39948, 39953, 39960, 39967, 39971, 39975, 39977, 39981, 39984, 39987, - 39995, 40003, 40009, 40015, 40024, 40033, 40038, 40043, 40051, 40059, - 40061, 40063, 40068, 40073, 40079, 40085, 40090, 40095, 40099, 40103, - 40109, 40115, 40121, 40127, 40137, 40147, 40154, 40161, 40163, 40167, - 40171, 40176, 40181, 40188, 40195, 40198, 40201, 40204, 40207, 40210, - 40215, 40219, 40224, 40229, 40232, 40235, 40238, 40241, 40244, 40248, - 40251, 40254, 40257, 40260, 40262, 40264, 40266, 40268, 40276, 40284, - 40289, 40292, 40297, 40307, 40313, 40319, 40325, 40333, 40341, 40352, - 40356, 40360, 40362, 40368, 40370, 40372, 40374, 40376, 40382, 40385, - 40391, 40397, 40401, 40405, 40409, 40412, 40416, 40420, 40422, 40431, - 40440, 40445, 40450, 40455, 40461, 40467, 40470, 40473, 40476, 40479, - 40481, 40486, 40491, 40496, 40502, 40508, 40515, 40522, 40527, 40532, - 40537, 40542, 40550, 40558, 40566, 40574, 40582, 40590, 40598, 40606, - 40614, 40622, 40629, 40640, 40649, 40663, 40666, 40671, 40677, 40683, - 40690, 40704, 40719, 40725, 40731, 40738, 40744, 40752, 40758, 40771, - 40785, 40790, 40796, 40803, 40806, 40809, 40811, 40814, 40817, 40819, - 40821, 40825, 40828, 40831, 40834, 40837, 40842, 40847, 40852, 40857, - 40860, 40863, 40865, 40867, 40869, 40873, 40877, 40881, 40887, 40890, - 40892, 40894, 40899, 40904, 40909, 40914, 40919, 40924, 40926, 40928, - 40937, 40941, 40948, 40957, 40959, 40964, 40969, 40976, 40980, 40982, - 40986, 40988, 40992, 40996, 41000, 41002, 41004, 41006, 41011, 41018, - 41025, 41032, 41039, 41046, 41053, 41060, 41067, 41073, 41079, 41086, - 41093, 41100, 41107, 41113, 41119, 41126, 41133, 41140, 41148, 41155, - 41163, 41170, 41178, 41185, 41193, 41201, 41208, 41216, 41223, 41231, - 41238, 41246, 41253, 41260, 41267, 41274, 41281, 41289, 41296, 41303, - 41310, 41318, 41325, 41332, 41339, 41346, 41354, 41362, 41369, 41376, - 41382, 41389, 41394, 41401, 41408, 41416, 41423, 41431, 41439, 41444, - 41449, 41454, 41461, 41468, 41475, 41482, 41487, 41491, 41500, 41506, - 41509, 41517, 41520, 41525, 41530, 41533, 41536, 41544, 41547, 41552, - 41555, 41562, 41567, 41575, 41578, 41581, 41584, 41589, 41594, 41597, - 41600, 41608, 41611, 41616, 41623, 41627, 41631, 41636, 41641, 41647, - 41652, 41658, 41664, 41669, 41675, 41683, 41689, 41697, 41705, 41711, - 41719, 41727, 41736, 41744, 41750, 41758, 41767, 41775, 41779, 41784, - 41797, 41810, 41814, 41818, 41822, 41826, 41836, 41840, 41845, 41850, - 41855, 41860, 41865, 41870, 41880, 41890, 41898, 41908, 41918, 41926, - 41936, 41946, 41954, 41964, 41974, 41982, 41990, 42000, 42010, 42013, - 42016, 42019, 42024, 42028, 42034, 42041, 42048, 42056, 42063, 42067, - 42071, 42075, 42079, 42081, 42085, 42089, 42094, 42099, 42106, 42113, - 42116, 42123, 42125, 42127, 42131, 42135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42140, 42144, 42151, 42158, 42165, - 42172, 42176, 42180, 42184, 42188, 42193, 42199, 42204, 42210, 42216, - 42222, 42228, 42236, 42243, 42250, 42257, 42264, 42270, 42276, 42285, - 42289, 42296, 42300, 42304, 42310, 42316, 42322, 42328, 42332, 42336, - 42339, 42343, 42347, 42354, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 42361, 42364, 42368, 42372, 42378, 42384, - 42390, 42398, 42405, 42409, 42417, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 42422, 42425, 42428, 42431, 42434, 42437, 42440, - 42443, 42446, 42449, 42453, 42457, 42461, 42465, 42469, 42473, 42477, - 42481, 42485, 42489, 42493, 42496, 42499, 42502, 42505, 42508, 42511, - 42514, 42517, 42520, 42524, 42528, 42532, 42536, 42540, 42544, 42548, - 42552, 42556, 42560, 42564, 42570, 42576, 42582, 42589, 42596, 42603, - 42610, 42617, 42624, 42631, 42638, 42645, 42652, 42659, 42666, 42673, - 42680, 42687, 42694, 42701, 42706, 42712, 42718, 42724, 42729, 42735, - 42741, 42747, 42752, 42758, 42764, 42769, 42774, 42779, 42784, 42790, - 42796, 42801, 42806, 42812, 42817, 42823, 42829, 42835, 42841, 42847, - 42852, 42858, 42864, 42870, 42875, 42881, 42887, 42893, 42898, 42904, - 42910, 42915, 42920, 42925, 42930, 42936, 42942, 42947, 42952, 42958, - 42963, 42969, 42975, 42981, 42987, 42993, 42998, 43004, 43010, 43016, - 43021, 43027, 43033, 43039, 43044, 43050, 43056, 43061, 43066, 43071, - 43076, 43082, 43088, 43093, 43098, 43104, 43109, 43115, 43121, 43127, - 43133, 43139, 43143, 43149, 43155, 43161, 43167, 43173, 43179, 43185, - 43191, 43197, 43203, 43207, 43211, 43215, 43219, 43223, 43227, 43231, - 43235, 43239, 43244, 43250, 43255, 43260, 43265, 43270, 43279, 43288, - 43297, 43306, 43315, 43324, 43333, 43342, 43349, 43357, 43365, 43372, - 43379, 43387, 43395, 43402, 43409, 43417, 43425, 43432, 43439, 43447, - 43455, 43462, 43469, 43477, 43486, 43495, 43503, 43512, 43521, 43528, - 43535, 43543, 43552, 43561, 43569, 43578, 43587, 43594, 43601, 43610, - 43619, 43627, 43635, 43644, 43653, 43660, 43667, 43676, 43685, 43693, - 43701, 43710, 43719, 43726, 43733, 43742, 43751, 43759, 43768, 43777, - 43785, 43795, 43805, 43815, 43825, 43834, 43843, 43852, 43861, 43868, - 43876, 43884, 43892, 43900, 43905, 43910, 43919, 43927, 43934, 43943, - 43951, 43958, 43967, 43975, 43982, 43991, 43999, 44006, 44015, 44023, - 44030, 44039, 44047, 44054, 44063, 44071, 44078, 44087, 44095, 44102, - 44111, 44119, 44126, 44135, 44144, 44153, 44162, 44175, 44188, 44195, - 44200, 44205, 44210, 44215, 44220, 44225, 44230, 44235, 44243, 44251, - 44259, 44267, 44272, 44279, 44286, 44293, 44298, 44306, 44313, 44321, - 44325, 44332, 44338, 44345, 44349, 44355, 44361, 44367, 44371, 44374, - 44378, 44382, 44389, 44395, 44401, 44407, 44413, 44427, 44437, 44451, - 44465, 44471, 44481, 44495, 44498, 44501, 44508, 44516, 44521, 44526, - 44534, 44545, 44556, 44564, 44568, 44572, 44575, 44578, 44582, 44586, - 44589, 44592, 44597, 44602, 44608, 44614, 44619, 44624, 44630, 44636, - 44641, 44646, 44651, 44656, 44662, 44668, 44673, 44678, 44684, 44690, - 44695, 44700, 44703, 44706, 44715, 44717, 44719, 44722, 44726, 44732, - 44734, 44737, 44744, 44751, 44759, 44767, 44777, 44791, 44796, 44801, - 44805, 44810, 44818, 44826, 44835, 44844, 44853, 44862, 44867, 44872, - 44878, 44884, 44890, 44896, 44899, 44905, 44911, 44921, 44931, 44939, - 44947, 44956, 44965, 44969, 44977, 44985, 44993, 45001, 45010, 45019, - 45028, 45037, 45042, 45047, 45052, 45057, 45062, 45068, 45074, 45079, - 45085, 45087, 45089, 45091, 45093, 45096, 45099, 45101, 45103, 45105, - 45109, 45113, 45115, 45117, 45120, 45123, 45127, 45133, 45139, 45141, - 45148, 45152, 45157, 45162, 45164, 45173, 45179, 45185, 45191, 45197, - 45203, 45209, 45214, 45217, 45220, 45223, 45225, 45227, 45231, 45235, - 45240, 45245, 45250, 45253, 45257, 45262, 45265, 45269, 45274, 45279, - 45284, 45289, 45294, 45299, 45304, 45309, 45314, 45319, 45324, 45329, - 45335, 45341, 45347, 45349, 45352, 45354, 45357, 45359, 45361, 45363, - 45365, 45367, 45369, 45371, 45373, 45375, 45377, 45379, 45381, 45383, - 45385, 45387, 45389, 45391, 45396, 45401, 45406, 45411, 45416, 45421, - 45426, 45431, 45436, 45441, 45446, 45451, 45456, 45461, 45466, 45471, - 45476, 45481, 45486, 45491, 45495, 45499, 45503, 45509, 45515, 45520, - 45525, 45530, 45535, 45540, 45545, 45553, 45561, 45569, 45577, 45585, - 45593, 45601, 45609, 45615, 45620, 45625, 45630, 45633, 45637, 45641, - 45645, 45649, 45653, 45657, 45664, 45671, 45679, 45687, 45692, 45697, - 45704, 45711, 45718, 45725, 45728, 45731, 45736, 45738, 45742, 45747, - 45749, 45751, 45753, 45755, 45760, 45763, 45765, 45770, 45777, 45784, - 45787, 45791, 45796, 45801, 45809, 45815, 45820, 45831, 45837, 45843, - 45848, 45853, 45859, 45862, 45865, 45870, 45872, 45876, 45878, 45880, - 45882, 45884, 45886, 45888, 45893, 45895, 45897, 45899, 45901, 45905, - 45907, 45910, 45915, 45920, 45925, 45930, 45936, 45942, 45944, 45947, - 45954, 45960, 45966, 45973, 45977, 0, 45981, 45983, 45987, 45993, 45998, - 46000, 46004, 46013, 46021, 46029, 46035, 46041, 46046, 46052, 46057, - 46060, 46074, 46077, 46082, 0, 46087, 0, 0, 0, 0, 46096, 46103, 46107, - 46109, 46111, 46115, 46121, 46126, 46132, 46134, 46140, 46142, 46148, - 46150, 46152, 46157, 46159, 46163, 46168, 46170, 46175, 46180, 46184, - 46191, 0, 46201, 46207, 46210, 46216, 0, 46219, 46224, 46228, 46230, 0, - 0, 46232, 46236, 46240, 46245, 46247, 46252, 46255, 46258, 46261, 46265, - 46269, 46274, 46278, 46283, 46288, 46292, 46298, 46305, 46308, 46314, - 46319, 46323, 46328, 46334, 46340, 46347, 46353, 46360, 0, 46367, 46374, - 46378, 46385, 46391, 46396, 46402, 46406, 46411, 46414, 46420, 46426, - 46433, 46441, 46448, 46457, 46467, 46474, 46480, 46484, 46492, 46497, - 46506, 46509, 46512, 46521, 46532, 46539, 46541, 46547, 46552, 46554, - 46557, 46561, 46569, 0, 46578, 0, 46583, 46591, 46599, 46607, 0, 0, 0, - 46615, 46623, 46628, 46631, 46635, 46638, 46649, 46659, 46669, 0, 0, - 46678, 46687, 46693, 46701, 46705, 46713, 46717, 46725, 46732, 46739, - 46748, 46757, 46767, 46777, 46787, 46797, 46806, 46815, 46825, 46835, - 46844, 46853, 46860, 46867, 46874, 46881, 46888, 46895, 46902, 46909, - 46916, 46924, 46930, 46936, 46942, 46948, 46954, 46960, 46966, 46972, - 46978, 46985, 46993, 47001, 47009, 47017, 47025, 47033, 47041, 47049, - 47057, 47066, 0, 0, 0, 47071, 47077, 47080, 47086, 47092, 47097, 47101, - 47106, 47112, 47119, 47122, 47129, 47136, 47140, 47149, 47158, 47163, - 47169, 47174, 47179, 47186, 47193, 47201, 47209, 0, 47218, 47227, 47232, - 47236, 47243, 47247, 47254, 47262, 47267, 47275, 47279, 47284, 47288, - 47293, 0, 47297, 47302, 47311, 47313, 47317, 47321, 47328, 47335, 47340, - 47348, 47354, 0, 47360, 0, 0, 0, 47363, 47371, 47375, 47382, 47390, - 47398, 47403, 47408, 47414, 47419, 47424, 47430, 47435, 47438, 47442, - 47446, 47453, 47462, 47467, 47476, 47485, 47491, 47497, 47502, 47507, - 47512, 47517, 47523, 47529, 47537, 47545, 47551, 47557, 47562, 47567, - 47574, 47581, 47587, 47590, 47593, 47597, 47601, 47605, 47610, 47616, - 47622, 47629, 47636, 47641, 47645, 47649, 47653, 47657, 47661, 47665, - 47669, 47673, 47677, 47681, 47685, 47689, 47693, 47697, 47701, 47705, - 47709, 47713, 47717, 47721, 47725, 47729, 47733, 47737, 47741, 47745, - 47749, 47753, 47757, 47761, 47765, 47769, 47773, 47777, 47781, 47785, - 47789, 47793, 47797, 47801, 47805, 47809, 47813, 47817, 47821, 47825, - 47829, 47833, 47837, 47841, 47845, 47849, 47853, 47857, 47861, 47865, - 47869, 47873, 47877, 47881, 47885, 47889, 47893, 47897, 47901, 47905, - 47909, 47913, 47917, 47921, 47925, 47929, 47933, 47937, 47941, 47945, - 47949, 47953, 47957, 47961, 47965, 47969, 47973, 47977, 47981, 47985, - 47989, 47993, 47997, 48001, 48005, 48009, 48013, 48017, 48021, 48025, - 48029, 48033, 48037, 48041, 48045, 48049, 48053, 48057, 48061, 48065, - 48069, 48073, 48077, 48081, 48085, 48089, 48093, 48097, 48101, 48105, - 48109, 48113, 48117, 48121, 48125, 48129, 48133, 48137, 48141, 48145, - 48149, 48153, 48157, 48161, 48165, 48169, 48173, 48177, 48181, 48185, - 48189, 48193, 48197, 48201, 48205, 48209, 48213, 48217, 48221, 48225, - 48229, 48233, 48237, 48241, 48245, 48249, 48253, 48257, 48261, 48265, - 48269, 48273, 48277, 48281, 48285, 48289, 48293, 48297, 48301, 48305, - 48309, 48313, 48317, 48321, 48325, 48329, 48333, 48337, 48341, 48345, - 48349, 48353, 48357, 48361, 48365, 48369, 48373, 48377, 48381, 48385, - 48389, 48393, 48397, 48401, 48405, 48409, 48413, 48417, 48421, 48425, - 48429, 48433, 48437, 48441, 48445, 48449, 48453, 48457, 48461, 48465, - 48469, 48473, 48477, 48481, 48485, 48489, 48493, 48497, 48501, 48505, - 48509, 48513, 48517, 48521, 48525, 48529, 48533, 48537, 48541, 48545, - 48549, 48553, 48557, 48561, 48565, 48569, 48573, 48577, 48581, 48585, - 48589, 48593, 48597, 48601, 48605, 48609, 48613, 48617, 48621, 48625, - 48629, 48633, 48637, 48641, 48645, 48649, 48653, 48657, 48661, 48665, - 48672, 48680, 48686, 48692, 48699, 48706, 48712, 48718, 48724, 48730, - 48735, 48740, 48745, 48750, 48756, 48762, 48770, 48777, 48782, 48787, - 48795, 48804, 48811, 48821, 48832, 48835, 48838, 48842, 48846, 48852, - 48858, 48868, 48878, 48888, 48898, 48905, 48912, 48919, 48926, 48937, - 48948, 48959, 48970, 48980, 48990, 49002, 49014, 49025, 49036, 49048, - 49060, 49069, 49079, 49089, 49100, 49111, 49118, 49125, 49132, 49139, - 49149, 49159, 49167, 49175, 49182, 49189, 49196, 49203, 49210, 49215, - 49220, 49226, 49234, 49244, 49252, 49260, 49268, 49276, 49284, 49292, - 49300, 49308, 49316, 49324, 49333, 49342, 49350, 49358, 49367, 49376, - 49385, 49394, 49404, 49414, 49423, 49432, 49442, 49452, 49466, 49483, - 49497, 49514, 49528, 49542, 49556, 49570, 49580, 49591, 49601, 49612, - 49629, 49646, 49654, 49660, 49667, 49674, 49681, 49688, 49693, 49699, - 49704, 49709, 49715, 49720, 49725, 49730, 49735, 49740, 49747, 49752, - 49759, 49764, 49769, 49773, 49777, 49784, 49791, 49798, 49805, 49812, - 49819, 49832, 49845, 49858, 49871, 49879, 49887, 49893, 49899, 49906, - 49913, 49920, 49927, 49931, 49936, 49944, 49952, 49960, 49967, 49971, - 49979, 49987, 49990, 49993, 49998, 50004, 50012, 50020, 50040, 50060, - 50080, 50100, 50120, 50140, 50160, 50180, 50185, 50192, 50201, 50209, - 50217, 50222, 50225, 50228, 50233, 50236, 50255, 50262, 50268, 50274, - 50278, 50281, 50284, 50287, 50298, 50310, 50317, 50324, 50327, 50331, - 50334, 50339, 50344, 50349, 50355, 50364, 50371, 50378, 50386, 50393, - 50400, 50403, 50409, 50415, 50418, 50421, 50426, 50431, 50437, 50443, - 50447, 50452, 50459, 50463, 50469, 50473, 50477, 50485, 50497, 50505, - 50509, 50511, 50520, 50529, 50535, 50538, 50544, 50550, 50555, 50560, - 50565, 50570, 50575, 50580, 50582, 50588, 50593, 50600, 50604, 50610, - 50613, 50617, 50624, 50631, 50633, 50635, 50641, 50647, 50653, 50662, - 50671, 50678, 50685, 50691, 50697, 50702, 50707, 50712, 50718, 50724, - 50729, 50736, 50740, 50744, 50757, 50770, 50781, 50790, 50796, 50803, - 50808, 50813, 50818, 50823, 50828, 50830, 50837, 50844, 50851, 50858, - 50865, 50873, 50879, 50884, 50890, 50896, 50902, 50909, 50915, 50923, - 50931, 50939, 50947, 50954, 50960, 50966, 50975, 50979, 50988, 50997, - 51006, 51014, 51018, 51024, 51031, 51038, 51042, 51048, 51055, 51060, - 51065, 51071, 51076, 51081, 51088, 51095, 51100, 51105, 51113, 51121, - 51131, 51141, 51148, 51155, 51159, 51163, 51175, 51181, 51187, 51192, - 51197, 51204, 51211, 51217, 51223, 51232, 51240, 51248, 51255, 51262, - 51269, 51275, 51282, 51288, 51295, 51302, 51309, 51316, 51322, 51327, - 51336, 51346, 51353, 51362, 51368, 51373, 51378, 51387, 51393, 51399, - 51405, 51413, 51418, 51425, 51432, 51443, 51450, 51457, 51464, 51471, - 51478, 51485, 51492, 51503, 51514, 51524, 51534, 51546, 51558, 51563, - 51568, 51576, 51584, 51590, 51596, 51605, 51614, 51622, 51630, 51638, - 51646, 51656, 51666, 51680, 51694, 51701, 51708, 51719, 51730, 51737, - 51744, 51753, 51762, 51767, 51772, 51781, 51790, 51795, 51800, 51808, - 51814, 51820, 51828, 51836, 51849, 51862, 51866, 51870, 51877, 51884, - 51891, 51899, 51907, 51915, 51923, 51929, 51935, 51941, 51947, 51954, - 51961, 51969, 51977, 51980, 51983, 51988, 51993, 51999, 52005, 52012, - 52019, 52028, 52037, 52044, 52051, 52059, 52067, 52075, 52083, 52090, - 52097, 52104, 52111, 52115, 52119, 52126, 52133, 52138, 52143, 52148, - 52153, 52159, 52173, 52180, 52187, 52191, 52193, 52195, 52200, 52205, - 52210, 52214, 52222, 52229, 52236, 52244, 52256, 52264, 52272, 52283, - 52287, 52291, 52295, 52300, 52311, 52318, 52325, 52332, 52337, 52344, - 52353, 52361, 52367, 52373, 52379, 52388, 52397, 52405, 52414, 52419, - 52422, 52427, 52433, 52439, 52445, 52451, 52455, 52458, 52462, 52466, - 52472, 52478, 52484, 52490, 52494, 52498, 52505, 52512, 52519, 52526, - 52533, 52540, 52550, 52560, 52567, 52574, 52582, 52590, 52594, 52599, - 52604, 52610, 52616, 52619, 52622, 52625, 52628, 52632, 52637, 52642, - 52647, 52652, 52657, 52661, 52665, 52669, 52673, 52677, 52681, 52685, - 52691, 52695, 52701, 52706, 52713, 52721, 52728, 52736, 52743, 52751, - 52760, 52767, 52777, 52788, 52794, 52803, 52809, 52818, 52827, 52833, - 52839, 52843, 52847, 52856, 52865, 52872, 52879, 52888, 0, 0, 0, 52897, - 52902, 52906, 52910, 52915, 52920, 52925, 52933, 52941, 52944, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 52948, 52953, 52958, 52963, 52968, - 52973, 52978, 52983, 52988, 52993, 52998, 53004, 53008, 53013, 53018, - 53023, 53028, 53033, 53038, 53043, 53048, 53053, 53058, 53063, 53068, - 53073, 53078, 53083, 53088, 53093, 53098, 53103, 53108, 53113, 53118, - 53124, 53129, 53135, 53144, 53149, 53157, 53164, 53173, 53178, 53183, - 53188, 53194, 0, 53201, 53206, 53211, 53216, 53221, 53226, 53231, 53236, - 53241, 53246, 53251, 53257, 53261, 53266, 53271, 53276, 53281, 53286, - 53291, 53296, 53301, 53306, 53311, 53316, 53321, 53326, 53331, 53336, - 53341, 53346, 53351, 53356, 53361, 53366, 53371, 53377, 53382, 53388, - 53397, 53402, 53410, 53417, 53426, 53431, 53436, 53441, 53447, 0, 53454, - 53462, 53470, 53480, 53487, 53495, 53501, 53510, 53518, 53526, 53534, - 53542, 53550, 53558, 53563, 53570, 53575, 53581, 53589, 53596, 53603, - 53611, 53617, 53623, 53630, 53637, 53646, 53656, 53662, 53669, 53674, - 53684, 53694, 53699, 53704, 53709, 53714, 53719, 53724, 53729, 53734, - 53739, 53744, 53749, 53754, 53759, 53764, 53769, 53774, 53779, 53784, - 53789, 53794, 53799, 53804, 53809, 53814, 53819, 53824, 53829, 53834, - 53839, 53844, 53848, 53852, 53857, 53862, 53867, 53872, 53877, 53882, - 53887, 53892, 53897, 53902, 53907, 53912, 53917, 53922, 53927, 53932, - 53937, 53942, 53949, 53956, 53963, 53970, 53977, 53984, 53991, 53998, - 54005, 54012, 54019, 54026, 54033, 54040, 54045, 54050, 54057, 54064, - 54071, 54078, 54085, 54092, 54099, 54106, 54113, 54120, 54127, 54134, - 54140, 54146, 54152, 54158, 54165, 54172, 54179, 54186, 54193, 54200, - 54207, 54214, 54221, 54228, 54236, 54244, 54252, 54260, 54268, 54276, - 54284, 54292, 54296, 54302, 54308, 54312, 54318, 54324, 54330, 54337, - 54344, 54351, 54358, 54363, 54369, 0, 0, 0, 0, 0, 0, 0, 54375, 54383, - 54392, 54401, 54409, 54415, 54420, 54425, 54430, 54435, 54440, 54445, - 54450, 54455, 54460, 54465, 54470, 54475, 54480, 54485, 54490, 54495, - 54500, 54505, 54510, 54515, 54520, 54525, 54530, 54535, 54540, 54545, - 54550, 54555, 54560, 54565, 54570, 54575, 54580, 54585, 54590, 54595, - 54600, 54605, 54610, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54615, 54619, 54624, - 54629, 54634, 54639, 54648, 54653, 54658, 54663, 54668, 54673, 54678, - 54683, 54688, 54695, 54700, 54705, 54714, 54721, 54726, 54731, 54736, - 54743, 54748, 54755, 54760, 54765, 54772, 54779, 54784, 54789, 54794, - 54801, 54808, 54813, 54818, 54823, 54828, 54833, 54840, 54847, 54852, - 54857, 54862, 54867, 54872, 54877, 54882, 54887, 54892, 54897, 54902, - 54909, 0, 0, 0, 0, 0, 0, 0, 0, 0, 54914, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 54921, 54925, 54929, 54933, 54937, 54941, 54945, 54949, - 54953, 54957, 54961, 54967, 54971, 54975, 54979, 54983, 54987, 54991, - 54995, 54999, 55003, 55007, 55011, 0, 0, 0, 0, 0, 0, 0, 0, 0, 55015, - 55019, 55023, 55027, 55031, 55035, 55039, 0, 55043, 55047, 55051, 55055, - 55059, 55063, 55067, 0, 55071, 55075, 55079, 55083, 55087, 55091, 55095, - 0, 55099, 55103, 55107, 55111, 55115, 55119, 55123, 0, 55127, 55131, - 55135, 55139, 55143, 55147, 55151, 0, 55155, 55159, 55163, 55167, 55171, - 55175, 55179, 0, 55183, 55187, 55191, 55195, 55199, 55203, 55207, 0, - 55211, 55215, 55219, 55223, 55227, 55231, 55235, 0, 55239, 55244, 55249, - 55254, 55259, 55264, 55269, 55273, 55278, 55283, 55288, 55292, 55297, - 55302, 55307, 55312, 55316, 55321, 55326, 55331, 55336, 55341, 55346, - 55350, 55355, 55360, 55367, 55372, 55377, 55383, 55390, 55397, 55406, - 55413, 55422, 55426, 55430, 55436, 55442, 55448, 55456, 55462, 55466, - 55470, 55474, 55480, 55486, 55490, 55492, 55496, 55501, 55503, 55507, - 55511, 55515, 55521, 55526, 55530, 55534, 55539, 55545, 55550, 55555, - 55560, 55565, 55572, 55579, 55584, 55589, 55594, 55599, 55604, 55609, - 55613, 55617, 55624, 55631, 55637, 55641, 55645, 55648, 55652, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 55660, 55664, 55668, 55673, 55678, 55683, 55687, 55691, 55695, - 55700, 55705, 55709, 55713, 55717, 55721, 55726, 55731, 55736, 55741, - 55745, 55749, 55754, 55759, 55764, 55769, 55773, 0, 55777, 55781, 55785, - 55789, 55793, 55797, 55801, 55806, 55811, 55815, 55820, 55825, 55834, - 55838, 55842, 55846, 55853, 55857, 55862, 55867, 55871, 55875, 55881, - 55886, 55891, 55896, 55901, 55905, 55909, 55913, 55917, 55921, 55926, - 55931, 55935, 55939, 55944, 55949, 55954, 55958, 55962, 55967, 55972, - 55978, 55984, 55988, 55994, 56000, 56004, 56010, 56016, 56021, 56026, - 56030, 56036, 56040, 56044, 56050, 56056, 56061, 56066, 56070, 56074, - 56082, 56088, 56094, 56100, 56105, 56110, 56115, 56121, 56125, 56131, - 56135, 56139, 56145, 56151, 56157, 56163, 56169, 56175, 56181, 56187, - 56193, 56199, 56205, 56211, 56215, 56221, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 56227, 56230, 56234, 56238, 56242, 56246, 56249, 56252, 56256, - 56260, 56264, 56268, 56271, 56276, 56280, 56284, 56288, 56294, 56298, - 56302, 56306, 56310, 56317, 56323, 56327, 56331, 56335, 56339, 56343, - 56347, 56351, 56355, 56359, 56363, 56367, 56373, 56377, 56381, 56385, - 56389, 56393, 56397, 56401, 56405, 56409, 56413, 56417, 56421, 56425, - 56429, 56433, 56437, 56443, 56449, 56454, 56459, 56463, 56467, 56471, - 56475, 56479, 56483, 56487, 56491, 56495, 56499, 56503, 56507, 56511, - 56515, 56519, 56523, 56527, 56531, 56535, 56539, 56543, 56547, 56551, - 56555, 56561, 56565, 56569, 56573, 56577, 56581, 56585, 56589, 56593, - 56598, 56605, 56609, 56613, 56617, 56621, 56625, 56629, 56633, 56637, - 56641, 56645, 56649, 56653, 56660, 56664, 56670, 56674, 56678, 56682, - 56686, 56690, 56693, 56697, 56701, 56705, 56709, 56713, 56717, 56721, - 56725, 56729, 56733, 56737, 56741, 56745, 56749, 56753, 56757, 56761, - 56765, 56769, 56773, 56777, 56781, 56785, 56789, 56793, 56797, 56801, - 56805, 56809, 56813, 56817, 56821, 56827, 56831, 56835, 56839, 56843, - 56847, 56851, 56855, 56859, 56863, 56867, 56871, 56875, 56879, 56883, - 56887, 56891, 56895, 56899, 56903, 56907, 56911, 56915, 56919, 56923, - 56927, 56931, 56935, 56943, 56947, 56951, 56955, 56959, 56963, 56969, - 56973, 56977, 56981, 56985, 56989, 56993, 56997, 57001, 57005, 57009, - 57013, 57017, 57021, 57027, 57031, 57035, 57039, 57043, 57047, 57051, - 57055, 57059, 57063, 57067, 57071, 57075, 57079, 57083, 57087, 57091, - 57095, 57099, 57103, 57107, 57111, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 57115, 57123, 57130, 57141, 57151, - 57159, 57168, 57177, 57187, 57199, 57211, 57223, 0, 0, 0, 0, 57229, - 57232, 57235, 57240, 57243, 57250, 57254, 57258, 57262, 57266, 57270, - 57275, 57280, 57284, 57288, 57293, 57298, 57303, 57308, 57311, 57314, - 57320, 57326, 57331, 57336, 57343, 57350, 57354, 57358, 57362, 57369, - 57375, 57382, 57387, 57392, 57397, 57402, 57407, 57412, 57417, 57422, - 57427, 57432, 57437, 57442, 57447, 57452, 57458, 57463, 57467, 57473, - 57484, 57494, 57509, 57519, 57523, 57532, 57538, 57544, 57550, 57555, - 57558, 57563, 57567, 0, 57573, 57577, 57580, 57584, 57587, 57591, 57594, - 57598, 57601, 57605, 57608, 57611, 57615, 57619, 57623, 57627, 57631, - 57635, 57639, 57643, 57647, 57651, 57655, 57659, 57663, 57667, 57671, - 57675, 57679, 57683, 57687, 57691, 57695, 57699, 57703, 57708, 57712, - 57716, 57720, 57724, 57727, 57731, 57734, 57738, 57742, 57746, 57750, - 57753, 57757, 57760, 57764, 57768, 57772, 57776, 57780, 57784, 57788, - 57792, 57796, 57800, 57804, 57808, 57811, 57815, 57819, 57823, 57827, - 57831, 57834, 57839, 57843, 57848, 57852, 57855, 57859, 57863, 57867, - 57871, 57876, 57880, 57884, 57888, 57892, 57895, 57899, 57903, 0, 0, - 57908, 57916, 57924, 57931, 57938, 57942, 57948, 57953, 57958, 57962, - 57965, 57969, 57972, 57976, 57979, 57983, 57986, 57990, 57993, 57996, - 58000, 58004, 58008, 58012, 58016, 58020, 58024, 58028, 58032, 58036, - 58040, 58044, 58048, 58052, 58056, 58060, 58064, 58068, 58072, 58076, - 58080, 58084, 58088, 58093, 58097, 58101, 58105, 58109, 58112, 58116, - 58119, 58123, 58127, 58131, 58135, 58138, 58142, 58145, 58149, 58153, - 58157, 58161, 58165, 58169, 58173, 58177, 58181, 58185, 58189, 58193, - 58196, 58200, 58204, 58208, 58212, 58216, 58219, 58224, 58228, 58233, - 58237, 58240, 58244, 58248, 58252, 58256, 58261, 58265, 58269, 58273, - 58277, 58280, 58284, 58288, 58293, 58297, 58301, 58305, 58309, 58314, - 58321, 58325, 58331, 0, 0, 0, 0, 0, 58336, 58340, 58344, 58347, 58351, - 58355, 58359, 58362, 58365, 58369, 58373, 58377, 58381, 58385, 58389, - 58393, 58397, 58401, 58404, 58408, 58412, 58415, 58418, 58421, 58424, - 58428, 58432, 58436, 58440, 58444, 58448, 58452, 58456, 58460, 58464, - 58467, 58470, 58474, 58478, 58482, 58486, 0, 0, 0, 58490, 58494, 58498, - 58502, 58506, 58510, 58514, 58518, 58522, 58526, 58530, 58534, 58538, - 58542, 58546, 58550, 58554, 58558, 58562, 58566, 58570, 58574, 58578, - 58582, 58586, 58590, 58594, 58598, 58602, 58606, 58610, 58613, 58617, - 58620, 58624, 58628, 58631, 58635, 58639, 58642, 58646, 58650, 58654, - 58658, 58661, 58665, 58669, 58673, 58677, 58681, 58685, 58688, 58691, - 58695, 58699, 58703, 58707, 58711, 58715, 58719, 58723, 58727, 58731, - 58735, 58739, 58743, 58747, 58751, 58755, 58759, 58763, 58767, 58771, - 58775, 58779, 58783, 58787, 58791, 58795, 58799, 58803, 58807, 58811, - 58815, 58819, 58823, 58827, 58831, 58835, 58839, 58843, 58847, 58851, - 58855, 0, 58859, 58865, 58871, 58876, 58881, 58886, 58892, 58898, 58904, - 58910, 58916, 58922, 58928, 58934, 58940, 58946, 58952, 58956, 58960, - 58964, 58968, 58972, 58976, 58980, 58984, 58988, 58992, 58996, 59000, - 59004, 59008, 59012, 59016, 59020, 59024, 59028, 59032, 59037, 59042, - 59047, 0, 0, 0, 0, 0, 0, 0, 0, 59052, 59056, 59060, 59064, 59068, 59072, - 59076, 59080, 59084, 59088, 59092, 59096, 59100, 59104, 59108, 59112, - 59115, 59119, 59122, 59126, 59130, 59134, 59138, 59142, 59146, 59150, - 59154, 59158, 59162, 59166, 59170, 59174, 59178, 59182, 59186, 59190, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59194, 59199, 59204, 59209, 59213, - 59218, 59222, 59227, 59232, 59237, 59242, 59247, 59251, 59256, 59261, - 59266, 59271, 59275, 59279, 59283, 59287, 59291, 59295, 59299, 59303, - 59307, 59311, 59315, 59319, 59323, 59327, 59332, 59337, 59342, 59347, - 59352, 59357, 59362, 59367, 59372, 59377, 59382, 59387, 59392, 59397, - 59402, 59408, 0, 59415, 59418, 59421, 59424, 59427, 59430, 59433, 59436, - 59439, 59442, 59446, 59450, 59454, 59458, 59462, 59466, 59470, 59474, - 59478, 59482, 59486, 59490, 59494, 59498, 59502, 59506, 59510, 59514, - 59518, 59522, 59526, 59530, 59534, 59538, 59542, 59546, 59550, 59554, - 59558, 59562, 59566, 59575, 59584, 59593, 59602, 59611, 59620, 59629, - 59638, 59641, 59646, 59651, 59656, 59661, 59666, 59671, 59676, 59681, - 59686, 59690, 59695, 59700, 59705, 59710, 59715, 59719, 59723, 59727, - 59731, 59735, 59739, 59743, 59747, 59751, 59755, 59759, 59763, 59767, - 59771, 59776, 59781, 59786, 59791, 59796, 59801, 59806, 59811, 59816, - 59821, 59826, 59831, 59836, 59841, 59847, 59853, 59858, 59863, 59866, - 59869, 59872, 59875, 59878, 59881, 59884, 59887, 59890, 59894, 59898, - 59902, 59906, 59910, 59914, 59918, 59922, 59926, 59930, 59934, 59938, - 59942, 59946, 59950, 59954, 59958, 59962, 59966, 59970, 59974, 59978, - 59982, 59986, 59990, 59994, 59998, 60002, 60006, 60010, 60014, 60018, - 60022, 60026, 60030, 60034, 60038, 60042, 60046, 60050, 60055, 60060, - 60065, 60070, 60074, 60079, 60084, 60089, 60094, 60099, 60104, 60109, - 60114, 60119, 60123, 60129, 60135, 60141, 60147, 60153, 60159, 60165, - 60171, 60177, 60183, 60189, 60195, 60198, 60201, 60204, 60209, 60212, - 60215, 60218, 60221, 60224, 60227, 60231, 60235, 60239, 60243, 60247, - 60251, 60255, 60259, 60263, 60267, 60271, 60275, 60279, 60282, 60285, - 60289, 60293, 60297, 60301, 60304, 60308, 60312, 60316, 60320, 60323, - 60327, 60331, 60335, 60339, 60342, 60346, 60350, 60353, 60357, 60361, - 60365, 60369, 60373, 60377, 60381, 0, 60385, 60388, 60391, 60394, 60397, - 60400, 60403, 60406, 60409, 60412, 60415, 60418, 60421, 60424, 60427, - 60430, 60433, 60436, 60439, 60442, 60445, 60448, 60451, 60454, 60457, - 60460, 60463, 60466, 60469, 60472, 60475, 60478, 60481, 60484, 60487, - 60490, 60493, 60496, 60499, 60502, 60505, 60508, 60511, 60514, 60517, - 60520, 60523, 60526, 60529, 60532, 60535, 60538, 60541, 60544, 60547, - 60550, 60553, 60556, 60559, 60562, 60565, 60568, 60571, 60574, 60577, - 60580, 60583, 60586, 60589, 60592, 60595, 60598, 60601, 60604, 60607, - 60610, 60613, 60616, 60619, 60622, 60625, 60628, 60631, 60634, 60637, - 60640, 60643, 60646, 60649, 60657, 60664, 60671, 60678, 60685, 60692, - 60699, 60706, 60713, 60720, 60728, 60736, 60744, 60752, 60760, 60768, - 60776, 60784, 60792, 60800, 60808, 60816, 60824, 60832, 60840, 60843, - 60846, 60849, 60851, 60854, 60857, 60860, 60865, 60870, 60873, 60880, - 60887, 60894, 60901, 60904, 60909, 60911, 60915, 60917, 60919, 60922, - 60925, 60928, 60931, 60934, 60937, 60940, 60945, 60950, 60953, 60956, - 60959, 60962, 60965, 60968, 60971, 60975, 60978, 60981, 60984, 60987, - 60990, 60994, 60997, 61000, 61003, 61008, 61013, 61018, 61023, 61028, - 61033, 61038, 61043, 61048, 61056, 61058, 61061, 61064, 61067, 61070, - 61075, 61083, 61086, 61089, 61093, 61096, 61099, 61102, 61107, 61110, - 61113, 61118, 61121, 61124, 61129, 61132, 61135, 61140, 61145, 61150, - 61153, 61156, 61159, 61162, 61168, 61171, 61174, 61177, 61179, 61182, - 61185, 61188, 61193, 61196, 61199, 61202, 61205, 61208, 61213, 61216, - 61219, 61222, 61225, 61228, 61231, 61234, 61237, 61240, 61245, 61249, - 61256, 61263, 61270, 61277, 61284, 61291, 61298, 61305, 61312, 61320, - 61328, 61336, 61344, 61352, 61360, 61368, 61376, 61384, 61392, 61400, - 61408, 61416, 61424, 61432, 61440, 61448, 61456, 61464, 61472, 61480, - 61488, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 61491, 61499, - 61507, 61517, 61523, 61527, 61531, 61537, 61543, 61548, 61552, 61556, - 61560, 61564, 61570, 61574, 61578, 61582, 61592, 61596, 61600, 61606, - 61610, 61616, 61620, 61624, 61630, 61636, 61642, 61650, 61658, 61662, - 61666, 61670, 61676, 61680, 61689, 61695, 61699, 61703, 61707, 61711, - 61715, 61719, 61726, 61732, 61738, 61742, 61748, 61752, 61758, 61766, - 61776, 61780, 61788, 61792, 61798, 61806, 61814, 61818, 61822, 61828, - 61833, 61839, 61845, 61849, 61853, 61856, 61860, 61864, 61868, 61872, - 61876, 61880, 61884, 61887, 61891, 61895, 61899, 61903, 61907, 61911, - 61914, 61918, 61922, 61925, 61929, 61933, 61937, 61941, 61945, 61949, - 61953, 61957, 61961, 61965, 61969, 61973, 61977, 61981, 61985, 61989, - 61993, 61997, 62001, 62005, 62009, 62013, 62017, 62021, 62025, 62029, - 62033, 62037, 62041, 62045, 62049, 62053, 62057, 62061, 62065, 62069, - 62073, 62077, 62081, 62085, 62089, 62093, 62097, 62101, 62104, 62108, - 62112, 62116, 62120, 62124, 62128, 62132, 62136, 62140, 62144, 62148, - 62152, 62156, 62160, 62164, 62168, 62172, 62176, 62180, 62184, 62188, - 62192, 62196, 62200, 62204, 62208, 62212, 62216, 62220, 62224, 62228, - 62232, 62236, 62240, 62244, 62248, 62252, 62256, 62260, 62264, 62268, - 62272, 62276, 62280, 62284, 62288, 62292, 62296, 62300, 62304, 62308, - 62312, 62316, 62320, 62324, 62328, 62332, 62336, 62340, 62344, 62348, - 62352, 62356, 62360, 62364, 62368, 62372, 62376, 62380, 62384, 62388, - 62392, 62396, 62400, 62404, 62408, 62412, 62416, 62420, 62424, 62428, - 62432, 62436, 62440, 62444, 62448, 62452, 62456, 62460, 62464, 62468, - 62472, 62476, 62480, 62484, 62488, 62492, 62496, 62500, 62504, 62508, - 62512, 62516, 62520, 62524, 62528, 62532, 62536, 62540, 62544, 62548, - 62552, 62556, 62560, 62564, 62568, 62572, 62575, 62579, 62583, 62587, - 62591, 62595, 62599, 62603, 62607, 62611, 62615, 62619, 62623, 62627, - 62631, 62635, 62639, 62643, 62647, 62651, 62655, 62659, 62663, 62667, - 62671, 62675, 62679, 62683, 62687, 62691, 62695, 62699, 62703, 62707, - 62711, 62715, 62719, 62723, 62727, 62731, 62735, 62739, 62743, 62747, - 62751, 62755, 62759, 62763, 62767, 62771, 62775, 62779, 62783, 62787, - 62791, 62795, 62799, 62803, 62807, 62811, 62815, 62819, 62823, 62827, - 62831, 62835, 62839, 62843, 62847, 62851, 62855, 62859, 62863, 62867, - 62871, 62875, 62879, 62883, 62887, 62891, 62895, 62899, 62903, 62907, - 62911, 62915, 62919, 62923, 62927, 62931, 62935, 62939, 62943, 62947, - 62951, 62955, 62959, 62963, 62967, 62971, 62975, 62979, 62983, 62987, - 62991, 62995, 62999, 63003, 63007, 63011, 63015, 63019, 63023, 63027, - 63031, 63035, 63038, 63042, 63046, 63050, 63054, 63058, 63062, 63066, - 63070, 63074, 63078, 63082, 63086, 63090, 63094, 63098, 63102, 63106, - 63110, 63114, 63118, 63122, 63126, 63130, 63134, 63138, 63142, 63146, - 63150, 63154, 63158, 63162, 63166, 63170, 63174, 63178, 63182, 63186, - 63190, 63194, 63198, 63202, 63206, 63210, 63214, 63218, 63222, 63226, - 63230, 63234, 63238, 63242, 63246, 63250, 63254, 63258, 63262, 63266, - 63270, 63274, 63278, 63282, 63286, 63290, 63294, 63298, 63302, 63306, - 63310, 63314, 63318, 63322, 63326, 63330, 63334, 63338, 63342, 63346, - 63350, 63354, 63358, 63362, 63366, 63370, 63374, 63378, 63382, 63386, - 63390, 63394, 63397, 63401, 63405, 63409, 63413, 63417, 63421, 63425, - 63429, 63433, 63437, 63441, 63445, 63449, 63453, 63457, 63461, 63465, - 63469, 63473, 63477, 63481, 63485, 63489, 63493, 63497, 63501, 63505, - 63509, 63513, 63517, 63521, 63525, 63529, 63533, 63537, 63541, 63545, - 63549, 63553, 63557, 63561, 63565, 63569, 63573, 63577, 63581, 63585, - 63589, 63593, 63597, 63601, 63605, 63609, 63613, 63617, 63621, 63625, - 63629, 63633, 63637, 63641, 63645, 63649, 63653, 63657, 63661, 63665, - 63669, 63673, 63677, 63681, 63685, 63689, 63693, 63697, 63701, 63705, - 63709, 63713, 63717, 63721, 63725, 63729, 63733, 63737, 63741, 63745, - 63749, 63753, 63757, 63761, 63765, 63769, 63773, 63777, 63781, 63785, - 63789, 63793, 63797, 63801, 63805, 63809, 63813, 63817, 63821, 63825, - 63829, 63833, 63837, 63841, 63845, 63849, 63853, 63857, 63861, 63865, - 63869, 63873, 63877, 63881, 63885, 63889, 63892, 63896, 63900, 63904, - 63908, 63912, 63916, 63920, 63924, 63928, 63932, 63936, 63940, 63944, - 63948, 63952, 63956, 63960, 63964, 63968, 63972, 63976, 63980, 63984, - 63988, 63992, 63996, 64000, 64004, 64008, 64012, 64016, 64020, 64024, - 64028, 64032, 64036, 64040, 64044, 64048, 64052, 64056, 64060, 64064, - 64068, 64072, 64076, 64080, 64084, 64088, 64092, 64096, 64100, 64104, - 64108, 64112, 64116, 64120, 64124, 64128, 64132, 64136, 64140, 64144, - 64148, 64152, 64156, 64160, 64164, 64168, 64172, 64176, 64180, 64184, - 64188, 64192, 64196, 64200, 64204, 64208, 64212, 64216, 64220, 64224, - 64228, 64232, 64236, 64240, 64244, 64248, 64252, 64256, 64260, 64264, - 64268, 64272, 64276, 64280, 64284, 64288, 64292, 64296, 64300, 64304, - 64308, 64312, 64316, 64320, 64324, 64328, 64332, 64336, 64340, 64344, - 64347, 64351, 64355, 64359, 64363, 64367, 64371, 64375, 64379, 64383, - 64387, 64391, 64395, 64399, 64403, 64407, 64411, 64415, 64419, 64423, - 64427, 64431, 64435, 64439, 64443, 64447, 64451, 64455, 64459, 64463, - 64467, 64471, 64475, 64479, 64483, 64487, 64491, 64495, 64499, 64503, - 64507, 64511, 64515, 64519, 64523, 64527, 64531, 64535, 64539, 64543, - 64547, 64551, 64555, 64559, 64563, 64567, 64571, 64575, 64579, 64583, - 64587, 64591, 64595, 64599, 64603, 64607, 64611, 64615, 64619, 64623, - 64627, 64631, 64635, 64639, 64643, 64647, 64651, 64655, 64659, 64663, - 64667, 64671, 64675, 64679, 64683, 64687, 64691, 64695, 64699, 64703, - 64707, 64711, 64715, 64719, 64723, 64727, 64731, 64735, 64739, 64743, - 64747, 64751, 64755, 64759, 64763, 64767, 64771, 64775, 64779, 64783, - 64787, 64791, 64795, 64799, 64803, 64807, 64811, 64815, 64819, 64823, - 64827, 64831, 64835, 64839, 64843, 64847, 64851, 64855, 64859, 64863, - 64867, 64871, 64875, 64879, 64883, 64887, 64891, 64895, 64899, 64903, - 64907, 64911, 64915, 64919, 64923, 64927, 64931, 64935, 64939, 64943, - 64947, 64950, 64954, 64958, 64962, 64966, 64970, 64974, 64978, 64982, - 64986, 64990, 64994, 64998, 65002, 65006, 65010, 65014, 65018, 65022, - 65026, 65030, 65034, 65038, 65042, 65046, 65050, 65054, 65058, 65062, - 65066, 65070, 65074, 65078, 65082, 65086, 65090, 65094, 65098, 65102, - 65106, 65110, 65114, 65118, 65122, 65126, 65130, 65134, 65138, 65142, - 65146, 65150, 65154, 65158, 65162, 65166, 65170, 65174, 65178, 65182, - 65186, 65190, 65194, 65198, 65202, 65206, 65210, 65214, 65218, 65222, - 65226, 65230, 65234, 65238, 65242, 65246, 65250, 65254, 65258, 65262, - 65266, 65270, 65274, 65278, 65282, 65286, 65290, 65294, 65298, 65302, - 65306, 65310, 65314, 65318, 65322, 65326, 65330, 65334, 65338, 65342, - 65346, 65350, 65354, 65358, 65362, 65366, 65370, 65374, 65378, 65382, - 65386, 65390, 65394, 65398, 65402, 65406, 65410, 65414, 65418, 65422, - 65426, 65430, 65434, 65438, 65442, 65446, 65450, 65454, 65458, 65462, - 65466, 65470, 65474, 65478, 65482, 65486, 65490, 65494, 65498, 65502, - 65506, 65510, 65514, 65518, 65522, 65526, 65530, 65534, 65538, 65542, - 65546, 65550, 65554, 65558, 65562, 65566, 65570, 65574, 65578, 65582, - 65586, 65590, 65594, 65598, 65602, 65606, 65610, 65614, 65618, 65622, - 65626, 65630, 65634, 65638, 65642, 65646, 65650, 65654, 65658, 65662, - 65666, 65670, 65674, 65678, 65682, 65686, 65690, 65694, 65698, 65702, - 65706, 65709, 65713, 65717, 65721, 65725, 65729, 65733, 65737, 65741, - 65745, 65749, 65753, 65757, 65761, 65765, 65769, 65773, 65777, 65781, - 65785, 65789, 65793, 65797, 65801, 65805, 65809, 65813, 65817, 65821, - 65825, 65829, 65833, 65837, 65841, 65845, 65849, 65853, 65857, 65861, - 65865, 65869, 65873, 65877, 65881, 65885, 65889, 65893, 65897, 65901, - 65905, 65909, 65913, 65917, 65921, 65925, 65929, 65933, 65937, 65941, - 65945, 65949, 65953, 65957, 65961, 65965, 65969, 65973, 65977, 65981, - 65985, 65989, 65993, 65997, 66001, 66005, 66009, 66013, 66017, 66021, - 66025, 66029, 66033, 66037, 66041, 66045, 66049, 66053, 66057, 66061, - 66065, 66069, 66073, 66077, 66081, 66085, 66089, 66093, 66097, 66101, - 66105, 66109, 66113, 66117, 66121, 66125, 66129, 66133, 66137, 66141, - 66145, 66149, 66153, 66157, 66161, 66165, 66169, 66173, 66177, 66181, - 66185, 66189, 66193, 66197, 66201, 66205, 66209, 66213, 66217, 66221, - 66225, 66229, 66233, 66237, 66241, 66245, 66249, 66253, 66257, 66261, - 66265, 66269, 66273, 66277, 66281, 66285, 66289, 66293, 66297, 66301, - 66305, 66309, 66313, 66317, 66321, 66325, 66329, 66333, 66337, 66341, - 66345, 66349, 66353, 66357, 66361, 66365, 66369, 66373, 66377, 66381, - 66385, 66389, 66393, 66397, 66401, 66405, 66409, 66413, 66417, 66421, - 66425, 66429, 66433, 66437, 66441, 66445, 66449, 66453, 66457, 66461, - 66465, 66469, 66473, 66477, 66481, 66485, 66489, 0, 0, 0, 66493, 66497, - 66501, 66505, 66509, 66513, 66517, 66521, 66525, 66529, 66533, 66537, - 66541, 66545, 66549, 66553, 66557, 66561, 66565, 66569, 66573, 66577, - 66581, 66585, 66589, 66593, 66597, 66601, 66605, 66609, 66613, 66617, - 66621, 66625, 66629, 66633, 66637, 66641, 66645, 66649, 66653, 66657, - 66661, 66665, 66669, 66673, 66677, 66681, 66685, 66689, 66693, 66697, - 66701, 66705, 66709, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66713, 66718, 66722, - 66727, 66732, 66737, 66742, 66747, 66751, 66756, 66761, 66766, 66771, - 66776, 66781, 66786, 66790, 66794, 66799, 66804, 66809, 66814, 66819, - 66823, 66828, 66833, 66838, 66843, 66848, 66852, 66857, 66861, 66866, - 66870, 66875, 66879, 66883, 66887, 66892, 66897, 66902, 66910, 66918, - 66926, 66934, 66941, 66949, 66955, 66963, 66967, 66971, 66975, 66979, - 66983, 66987, 66991, 66995, 66999, 67003, 67007, 67011, 67015, 67019, - 67023, 67027, 67031, 67035, 67039, 67043, 67047, 67051, 67055, 67059, - 67063, 67067, 67071, 67075, 67079, 67083, 67087, 67091, 67095, 67099, - 67103, 67107, 67110, 67114, 67118, 67122, 67126, 67130, 67134, 67138, - 67142, 67146, 67150, 67154, 67158, 67162, 67166, 67170, 67174, 67178, - 67182, 67186, 67190, 67194, 67198, 67202, 67206, 67210, 67214, 67218, - 67222, 67226, 67230, 67234, 67238, 67242, 67246, 67250, 67254, 67257, - 67261, 67265, 67268, 67272, 67276, 67280, 67283, 67287, 67291, 67295, - 67299, 67303, 67307, 67311, 67315, 67319, 67323, 67327, 67331, 67335, - 67339, 67342, 67346, 67350, 67354, 67358, 67362, 67366, 67370, 67374, - 67378, 67381, 67384, 67388, 67392, 67396, 67399, 67402, 67406, 67410, - 67414, 67418, 67422, 67426, 67430, 67434, 67438, 67442, 67446, 67450, - 67454, 67458, 67462, 67466, 67470, 67474, 67478, 67482, 67486, 67490, - 67494, 67498, 67502, 67506, 67510, 67514, 67518, 67522, 67526, 67530, - 67534, 67538, 67542, 67546, 67550, 67553, 67557, 67561, 67565, 67569, - 67573, 67577, 67581, 67585, 67589, 67593, 67597, 67601, 67605, 67609, - 67613, 67617, 67621, 67625, 67629, 67633, 67637, 67641, 67645, 67649, - 67653, 67657, 67661, 67665, 67669, 67673, 67677, 67681, 67685, 67689, - 67693, 67697, 67700, 67704, 67708, 67712, 67716, 67720, 67724, 67728, - 67732, 67736, 67740, 67744, 67748, 67752, 67756, 67760, 67764, 67767, - 67771, 67775, 67779, 67783, 67787, 67791, 67795, 67799, 67803, 67807, - 67811, 67815, 67819, 67823, 67827, 67831, 67835, 67839, 67843, 67847, - 67851, 67854, 67858, 67862, 67866, 67870, 67874, 67878, 67882, 67886, - 67890, 67894, 67898, 67902, 67906, 67910, 67914, 67918, 67922, 67926, - 67930, 67934, 67938, 67942, 67946, 67950, 67954, 67958, 67962, 67966, - 67970, 67974, 67978, 67982, 67986, 67990, 67994, 67998, 68002, 68006, - 68010, 68014, 68018, 68022, 68026, 68029, 68034, 68038, 68044, 68049, - 68055, 68059, 68063, 68067, 68071, 68075, 68079, 68083, 68087, 68091, - 68095, 68099, 68103, 68107, 68111, 68114, 68117, 68120, 68123, 68126, - 68129, 68132, 68135, 68138, 68143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 68149, 68154, 68159, 68164, 68169, 68175, 68181, - 68186, 68191, 68196, 68201, 68208, 68215, 68222, 68229, 68236, 68243, - 68253, 68263, 68270, 68277, 68283, 68289, 68295, 68301, 68310, 68319, - 68326, 68333, 68344, 68355, 68360, 0, 0, 68365, 68372, 68379, 68386, - 68393, 68400, 68407, 68413, 68419, 68425, 68431, 68438, 68445, 68450, - 68454, 68461, 68468, 68475, 0, 0, 0, 0, 0, 0, 0, 0, 68479, 68483, 68487, - 68490, 68493, 68498, 68503, 68508, 68513, 68518, 68523, 68528, 68533, - 68538, 68543, 68552, 68561, 68566, 68571, 68576, 68581, 68586, 68591, - 68596, 68601, 68606, 68611, 68616, 0, 0, 0, 0, 0, 0, 0, 0, 68621, 68624, - 68627, 68630, 68634, 68638, 68642, 68646, 68649, 68653, 68656, 68660, - 68663, 68667, 68671, 68675, 68679, 68683, 68687, 68691, 68694, 68698, - 68702, 68706, 68710, 68714, 68718, 68722, 68726, 68730, 68734, 68738, - 68742, 68746, 68750, 68753, 68757, 68761, 68765, 68769, 68773, 68777, - 68781, 68785, 68789, 68793, 68797, 68801, 68805, 68809, 68813, 68817, - 68821, 68825, 68829, 68833, 68837, 68841, 68845, 68849, 68852, 68856, - 68860, 68864, 68868, 68872, 68876, 68880, 68883, 68887, 68891, 68895, - 68899, 68903, 68907, 68911, 68915, 68919, 68923, 68927, 68931, 68936, - 68941, 68944, 68949, 68952, 68955, 68958, 0, 0, 0, 0, 0, 0, 0, 0, 68962, - 68971, 68980, 68989, 68998, 69007, 69016, 69025, 69034, 69042, 69049, - 69057, 69064, 69072, 69082, 69091, 69101, 69110, 69120, 69128, 69135, - 69143, 69150, 69158, 69163, 69168, 69173, 69182, 69188, 69194, 69201, - 69210, 69218, 69226, 69234, 69241, 69248, 69255, 69262, 69267, 69272, - 69277, 69282, 69287, 69292, 69297, 69302, 69310, 69318, 69324, 69329, - 69334, 69339, 69344, 69349, 69354, 69359, 69364, 69369, 69377, 69385, - 69390, 69395, 69404, 69413, 69420, 69427, 69436, 69445, 69456, 69467, - 69473, 69479, 69487, 69495, 69504, 69513, 69520, 69527, 69532, 69537, - 69548, 69559, 69567, 69575, 69585, 69595, 69606, 69617, 69626, 69635, - 69642, 69649, 69656, 69663, 69672, 69681, 69686, 69691, 69698, 69705, - 69712, 69719, 69730, 69741, 69746, 69751, 69756, 69761, 69766, 69771, - 69776, 69781, 69785, 69790, 69795, 69800, 69805, 69810, 69816, 69821, - 69826, 69833, 69840, 69847, 69854, 69861, 69869, 69877, 69882, 69887, - 69893, 69899, 69905, 69911, 69918, 69925, 69932, 69936, 69943, 69948, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 69953, 69960, 69967, 69974, 69982, - 69989, 69995, 70001, 70008, 70014, 70020, 70026, 70033, 70040, 70047, - 70054, 70061, 70068, 70075, 70082, 70089, 70096, 70103, 70110, 70117, - 70124, 70130, 70137, 70144, 70151, 70158, 70165, 70172, 70179, 70186, - 70193, 70200, 70207, 70214, 70221, 70228, 70235, 70242, 70249, 70256, - 70264, 70272, 70280, 70288, 0, 0, 0, 0, 70296, 70305, 70314, 70323, - 70332, 70341, 70350, 70357, 70364, 70371, 0, 0, 0, 0, 0, 0, 70378, 70382, - 70387, 70392, 70397, 70402, 70407, 70412, 70417, 70422, 70427, 70432, - 70436, 70440, 70445, 70450, 70454, 70459, 70464, 70469, 70474, 70479, - 70484, 70489, 70493, 70497, 70502, 70507, 70512, 70516, 70520, 70524, - 70528, 70532, 70536, 70541, 70546, 70551, 70556, 70561, 70568, 70574, - 70579, 70584, 70589, 70594, 70600, 70607, 70613, 70620, 70626, 70632, - 70637, 70644, 70650, 70655, 0, 0, 0, 0, 0, 0, 0, 0, 70661, 70665, 70669, - 70672, 70676, 70679, 70683, 70686, 70690, 70694, 70699, 70703, 70708, - 70711, 70715, 70719, 70722, 70726, 70730, 70733, 70737, 70741, 70745, - 70749, 70753, 70757, 70761, 70765, 70769, 70773, 70777, 70781, 70785, - 70789, 70793, 70797, 70801, 70805, 70808, 70811, 70815, 70819, 70823, - 70826, 70829, 70832, 70836, 70840, 70844, 70848, 70852, 70855, 70859, - 70865, 70870, 70874, 70879, 70883, 70888, 70893, 70899, 70904, 70910, - 70914, 70919, 70924, 70928, 70933, 70938, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 70942, 70945, 70949, 70953, 70956, 70959, 70962, 70965, 70968, 70971, - 70974, 70977, 0, 0, 0, 0, 0, 0, 70980, 70985, 70989, 70993, 70997, 71001, - 71005, 71009, 71013, 71017, 71021, 71025, 71029, 71033, 71037, 71041, - 71045, 71050, 71055, 71061, 71067, 71074, 71079, 71084, 71090, 71094, - 71099, 71102, 0, 0, 0, 0, 71105, 71112, 71118, 71124, 71130, 71136, - 71142, 71148, 71154, 71160, 71166, 71172, 71179, 71186, 71193, 71200, - 71207, 71214, 71221, 71228, 71235, 71241, 71247, 71254, 71260, 71267, - 71274, 71280, 71286, 71293, 71300, 71307, 71313, 71320, 71327, 71333, - 71340, 71346, 71353, 71360, 71366, 71372, 71379, 71385, 71392, 71399, - 71408, 71415, 71422, 71426, 71431, 71436, 71441, 71446, 71450, 71454, - 71459, 71463, 71468, 71473, 71478, 71483, 71487, 71492, 71496, 71501, - 71505, 71510, 71515, 71520, 71525, 71529, 71534, 71539, 71544, 71550, - 71555, 71561, 71567, 71573, 71580, 71586, 71592, 71599, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 71603, 71608, 71612, 71616, 71620, 71624, 71628, 71632, - 71636, 71640, 71644, 71648, 71652, 71656, 71660, 71664, 71668, 71672, - 71676, 71680, 71684, 71688, 71692, 71696, 71700, 71704, 71708, 71712, - 71716, 71720, 0, 0, 0, 71724, 71728, 71732, 71736, 71740, 71743, 71749, - 71752, 71756, 71759, 71765, 71771, 71779, 71782, 71786, 71789, 71792, - 71797, 71802, 71806, 71812, 71816, 71820, 71826, 71830, 71836, 71842, - 71846, 71850, 71856, 71860, 71866, 71872, 71876, 71882, 71886, 71892, - 71895, 71898, 71904, 71908, 71914, 71917, 71920, 71923, 71929, 71933, - 71937, 71943, 71949, 71953, 71956, 71962, 71967, 71972, 71977, 71984, - 71989, 71996, 72001, 72008, 72013, 72019, 72025, 72031, 72034, 72038, - 72042, 72047, 72052, 72057, 72062, 72067, 72072, 72077, 72082, 72089, - 72094, 0, 72100, 72103, 72107, 72110, 72113, 72116, 72119, 72122, 72125, - 72128, 72131, 0, 0, 0, 0, 72134, 72141, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72146, - 72149, 72152, 72155, 72158, 72162, 72165, 72168, 72172, 72176, 72180, - 72184, 72188, 72192, 72196, 72200, 72204, 72208, 72212, 72216, 72220, - 72224, 72228, 72232, 72236, 72239, 72243, 72246, 72250, 72254, 72258, - 72262, 72266, 72269, 72273, 72276, 72279, 72283, 72287, 72291, 72295, - 72298, 72303, 72307, 72312, 72317, 72321, 72326, 72330, 72335, 72340, - 72345, 72350, 72355, 72361, 0, 0, 0, 0, 0, 0, 0, 0, 0, 72367, 72372, - 72377, 72382, 72389, 72394, 72399, 72403, 72408, 72413, 72417, 72421, - 72426, 72432, 0, 0, 72439, 72443, 72446, 72449, 72452, 72455, 72458, - 72461, 72464, 72467, 0, 0, 72470, 72475, 72480, 72486, 72493, 72499, - 72505, 72511, 72517, 72523, 72529, 72535, 72541, 72547, 72553, 72559, - 72564, 72570, 72575, 72581, 72587, 72594, 72600, 72606, 72611, 72618, - 72625, 72632, 72638, 72643, 72648, 72653, 0, 0, 0, 0, 72661, 72667, - 72673, 72679, 72685, 72691, 72697, 72703, 72709, 72715, 72721, 72727, - 72733, 72739, 72745, 72751, 72757, 72763, 72769, 72775, 72781, 72786, - 72791, 72797, 72803, 72809, 72815, 72821, 72827, 72833, 72839, 72845, - 72851, 72857, 72863, 72869, 72875, 72881, 72887, 72893, 72899, 72905, - 72911, 72917, 72923, 72929, 72935, 72940, 72945, 72951, 72956, 72960, - 72965, 72969, 72973, 72977, 72983, 72988, 72993, 72998, 73003, 73008, - 73013, 73018, 73025, 73032, 73039, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73046, 73051, 73056, 73061, 73068, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73075, - 73082, 73089, 73096, 73103, 73109, 73115, 73122, 73129, 73136, 73143, - 73150, 73157, 73164, 73171, 73178, 73184, 73191, 73198, 73205, 73212, - 73219, 73226, 73233, 73240, 73247, 73254, 73261, 73270, 73279, 73288, - 73297, 73306, 73315, 73324, 73333, 73341, 73349, 73357, 73365, 73373, - 73381, 73389, 73397, 73403, 73411, 0, 0, 73419, 73426, 73432, 73438, - 73444, 73450, 73456, 73462, 73468, 73474, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 73480, 73484, - 73488, 73492, 73496, 73500, 73504, 73508, 73512, 73516, 73520, 73524, - 73528, 73532, 73536, 73540, 73544, 73548, 73552, 73556, 73560, 73564, - 73568, 0, 0, 0, 0, 73572, 73576, 73580, 73584, 73588, 73592, 73596, - 73600, 73604, 73608, 73612, 73616, 73620, 73624, 73628, 73632, 73636, - 73640, 73644, 73648, 73652, 73656, 73660, 73664, 73668, 73672, 73676, - 73680, 73684, 73688, 73692, 73696, 73700, 73704, 73708, 73712, 73716, - 73720, 73724, 73728, 73732, 73736, 73740, 73744, 73748, 73752, 73756, - 73760, 73764, 0, 0, 0, 0, 73768, 73772, 73776, 73780, 73784, 73788, - 73792, 73796, 73800, 73804, 73808, 73812, 73816, 73820, 73824, 73828, - 73832, 73836, 73840, 73844, 73848, 73852, 73856, 73860, 73864, 73868, - 73872, 73876, 73880, 73884, 73888, 73892, 73896, 73900, 73904, 73908, - 73912, 73916, 73920, 73924, 73928, 73932, 73936, 73940, 73944, 73948, - 73952, 73956, 73960, 73964, 73968, 73972, 73976, 73980, 73984, 73988, - 73992, 73996, 74000, 74004, 74008, 74012, 74016, 74020, 74024, 74028, - 74032, 74036, 74040, 74044, 74048, 74052, 74056, 74060, 74064, 74068, - 74072, 74076, 74080, 74084, 74088, 74092, 74096, 74100, 74104, 74108, - 74112, 74116, 74120, 74124, 74128, 74132, 74136, 74140, 74144, 74148, - 74152, 74156, 74160, 74164, 74168, 74172, 74176, 74180, 74184, 74188, - 74192, 74196, 74200, 74204, 74208, 74212, 74216, 74220, 74224, 74228, - 74232, 74236, 74240, 74244, 74248, 74252, 74256, 74260, 74264, 74268, - 74272, 74276, 74280, 74284, 74288, 74292, 74296, 74300, 74304, 74308, - 74312, 74316, 74320, 74324, 74328, 74332, 74336, 74340, 74344, 74348, - 74352, 74356, 74360, 74364, 74368, 74372, 74376, 74380, 74384, 74388, - 74392, 74396, 74400, 74404, 74408, 74412, 74416, 74420, 74424, 74428, - 74432, 74436, 74440, 74444, 74448, 74452, 74456, 74460, 74464, 74468, - 74472, 74476, 74480, 74484, 74488, 74492, 74496, 74500, 74504, 74508, - 74512, 74516, 74520, 74524, 74528, 74532, 74536, 74540, 74544, 74548, - 74552, 74556, 74560, 74564, 74568, 74572, 74576, 74580, 74584, 74588, - 74592, 74596, 74600, 74604, 74608, 74612, 74616, 74620, 74624, 74628, - 74632, 74636, 74640, 74644, 74648, 74652, 74656, 74660, 74664, 74668, - 74672, 74676, 74680, 74684, 74688, 74692, 74696, 74700, 74704, 74708, - 74712, 74716, 74720, 74724, 74728, 74732, 74736, 74740, 74744, 74748, - 74752, 74756, 74760, 74764, 74768, 74772, 74776, 74780, 74784, 74788, - 74792, 74796, 74800, 74804, 74808, 74812, 74816, 74820, 74824, 74828, - 74832, 74836, 74840, 74844, 74848, 74852, 74856, 74860, 74864, 74868, - 74872, 74876, 74880, 74884, 74888, 74892, 74896, 74900, 74904, 74908, - 74912, 74916, 74920, 74924, 74928, 74932, 74936, 74940, 74944, 74948, - 74952, 74956, 74960, 74964, 74968, 74972, 0, 0, 74976, 74980, 74984, - 74988, 74992, 74996, 75000, 75004, 75008, 75012, 75016, 75020, 75024, - 75028, 75032, 75036, 75040, 75044, 75048, 75052, 75056, 75060, 75064, - 75068, 75072, 75076, 75080, 75084, 75088, 75092, 75096, 75100, 75104, - 75108, 75112, 75116, 75120, 75124, 75128, 75132, 75136, 75140, 75144, - 75148, 75152, 75156, 75160, 75164, 75168, 75172, 75176, 75180, 75184, - 75188, 75192, 75196, 75200, 75204, 75208, 75212, 75216, 75220, 0, 0, - 75224, 75228, 75232, 75236, 75240, 75244, 75248, 75252, 75256, 75260, - 75264, 75268, 75272, 75276, 75280, 75284, 75288, 75292, 75296, 75300, - 75304, 75308, 75312, 75316, 75320, 75324, 75328, 75332, 75336, 75340, - 75344, 75348, 75352, 75356, 75360, 75364, 75368, 75372, 75376, 75380, - 75384, 75388, 75392, 75396, 75400, 75404, 75408, 75412, 75416, 75420, - 75424, 75428, 75432, 75436, 75440, 75444, 75448, 75452, 75456, 75460, - 75464, 75468, 75472, 75476, 75480, 75484, 75488, 75492, 75496, 75500, - 75504, 75508, 75512, 75516, 75520, 75524, 75528, 75532, 75536, 75540, - 75544, 75548, 75552, 75556, 75560, 75564, 75568, 75572, 75576, 75580, - 75584, 75588, 75592, 75596, 75600, 75604, 75608, 75612, 75616, 75620, - 75624, 75628, 75632, 75636, 75640, 75644, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 75648, 75653, 75658, 75663, 75668, 75673, 75681, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 75686, 75693, 75700, 75707, 75714, 0, 0, 0, 0, 0, - 75721, 75728, 75735, 75745, 75751, 75757, 75763, 75769, 75775, 75781, - 75788, 75794, 75800, 75806, 75815, 75824, 75836, 75848, 75854, 75860, - 75866, 75873, 75880, 75887, 75894, 75901, 0, 75908, 75915, 75922, 75930, - 75937, 0, 75944, 0, 75951, 75958, 0, 75965, 75973, 0, 75980, 75987, - 75994, 76001, 76008, 76015, 76022, 76029, 76036, 76043, 76048, 76055, - 76062, 76068, 76074, 76080, 76086, 76092, 76098, 76104, 76110, 76116, - 76122, 76128, 76134, 76140, 76146, 76152, 76158, 76164, 76170, 76176, - 76182, 76188, 76194, 76200, 76206, 76212, 76218, 76224, 76230, 76236, - 76242, 76248, 76254, 76260, 76266, 76272, 76278, 76284, 76290, 76296, - 76302, 76308, 76314, 76320, 76326, 76332, 76338, 76344, 76350, 76356, - 76362, 76368, 76374, 76380, 76386, 76392, 76398, 76404, 76410, 76416, - 76422, 76428, 76434, 76440, 76446, 76452, 76458, 76464, 76470, 76476, - 76482, 76488, 76494, 76500, 76506, 76512, 76518, 76526, 76534, 76540, - 76546, 76552, 76558, 76567, 76576, 76584, 76592, 76600, 76608, 76616, - 76624, 76632, 76640, 76647, 76654, 76664, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 76674, 76680, 76686, 76692, 76698, 76703, 76708, 76714, 76720, 76726, - 76732, 76740, 76746, 76752, 76760, 76768, 76776, 76784, 76789, 76794, - 76799, 76804, 76816, 76828, 76838, 76848, 76859, 76870, 76881, 76892, - 76902, 76912, 76923, 76934, 76945, 76956, 76966, 76976, 76986, 77001, - 77016, 77031, 77038, 77045, 77052, 77059, 77069, 77079, 77089, 77100, - 77110, 77118, 77126, 77135, 77143, 77152, 77160, 77168, 77176, 77185, - 77193, 77202, 77210, 77218, 77226, 77235, 77243, 77250, 77257, 77264, - 77271, 77279, 77287, 77295, 77303, 77311, 77320, 77328, 77336, 77344, - 77352, 77360, 77369, 77377, 77385, 77393, 77401, 77409, 77417, 77425, - 77433, 77441, 77449, 77458, 77466, 77475, 77483, 77491, 77499, 77508, - 77516, 77524, 77532, 77540, 77549, 77558, 77566, 77575, 77583, 77591, - 77599, 77608, 77616, 77625, 77633, 77640, 77647, 77655, 77662, 77670, - 77677, 77685, 77693, 77702, 77710, 77719, 77727, 77735, 77743, 77752, - 77760, 77767, 77774, 77782, 77789, 77797, 77804, 77814, 77824, 77834, - 77843, 77852, 77861, 77870, 77879, 77889, 77900, 77911, 77921, 77932, - 77943, 77953, 77962, 77971, 77979, 77988, 77997, 78005, 78014, 78023, - 78031, 78040, 78049, 78057, 78066, 78075, 78083, 78092, 78101, 78109, - 78118, 78126, 78135, 78143, 78151, 78160, 78168, 78177, 78185, 78193, - 78202, 78210, 78217, 78224, 78233, 78242, 78250, 78259, 78268, 78276, - 78286, 78294, 78302, 78309, 78317, 78325, 78332, 78342, 78352, 78363, - 78373, 78384, 78392, 78400, 78409, 78417, 78426, 78434, 78442, 78451, - 78459, 78468, 78476, 78483, 78490, 78497, 78504, 78512, 78520, 78528, - 78536, 78545, 78553, 78561, 78570, 78578, 78586, 78594, 78603, 78611, - 78619, 78627, 78635, 78643, 78651, 78659, 78667, 78675, 78684, 78692, - 78700, 78708, 78716, 78724, 78733, 78742, 78750, 78758, 78766, 78775, - 78783, 78792, 78799, 78806, 78814, 78821, 78829, 78837, 78846, 78854, - 78863, 78871, 78879, 78889, 78896, 78903, 78911, 78918, 78926, 78936, - 78947, 78955, 78964, 78972, 78981, 78989, 78998, 79006, 79015, 79023, - 79032, 79041, 79049, 79057, 79065, 79074, 79081, 79089, 79098, 79107, - 79116, 79125, 79133, 79142, 79150, 79159, 79167, 79176, 79184, 79193, - 79201, 79209, 79216, 79224, 79231, 79240, 79248, 79257, 79265, 79274, - 79282, 79290, 79298, 79307, 79315, 79324, 79333, 79342, 79351, 79360, - 79368, 79377, 79385, 79394, 79402, 79411, 79419, 79428, 79436, 79444, - 79451, 79459, 79466, 79475, 79483, 79492, 79500, 79509, 79517, 79525, - 79533, 79542, 79550, 79559, 79568, 79577, 79586, 79594, 79602, 79611, - 79619, 79628, 79637, 79645, 79653, 79661, 79670, 79678, 79686, 79695, - 79703, 79711, 79719, 79727, 79732, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 79737, 79747, 79757, 79767, 79777, 79788, 79798, 79808, 79819, - 79828, 79837, 79846, 79856, 79866, 79876, 79887, 79897, 79907, 79917, - 79927, 79937, 79947, 79957, 79967, 79977, 79987, 79997, 80008, 80019, - 80029, 80039, 80050, 80061, 80072, 80082, 80092, 80102, 80112, 80122, - 80132, 80142, 80153, 80163, 80173, 80184, 80195, 80206, 80216, 80226, - 80236, 80246, 80257, 80267, 80277, 80288, 80299, 80309, 80319, 80328, - 80337, 80346, 80355, 80364, 80374, 0, 0, 80384, 80394, 80404, 80414, - 80424, 80435, 80445, 80455, 80466, 80476, 80487, 80496, 80505, 80516, - 80526, 80537, 80548, 80560, 80570, 80581, 80590, 80600, 80610, 80622, - 80632, 80642, 80652, 80662, 80672, 80681, 80690, 80699, 80708, 80718, - 80728, 80738, 80748, 80758, 80768, 80778, 80788, 80798, 80808, 80818, - 80828, 80837, 80846, 80855, 80865, 80875, 80885, 80895, 80905, 80916, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 80926, 80941, 80956, 80962, - 80968, 80974, 80980, 80986, 80992, 80998, 81004, 81012, 81016, 81019, 0, - 0, 81027, 81030, 81033, 81036, 81039, 81042, 81045, 81048, 81051, 81054, - 81057, 81060, 81063, 81066, 81069, 81072, 81075, 81083, 81092, 81103, - 81111, 81119, 81128, 81137, 81148, 81160, 0, 0, 0, 0, 0, 0, 81169, 81174, - 81179, 81186, 81193, 81199, 81205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81210, - 81220, 81230, 81240, 81249, 81260, 81269, 81278, 81288, 81298, 81310, - 81322, 81333, 81344, 81355, 81366, 81376, 81386, 81396, 81406, 81417, - 81428, 81432, 81437, 81446, 81455, 81459, 81463, 81467, 81472, 81477, - 81482, 81487, 81490, 81494, 0, 81499, 81502, 81505, 81509, 81513, 81518, - 81522, 81526, 81531, 81536, 81543, 81550, 81553, 81556, 81559, 81562, - 81565, 81569, 81573, 0, 81577, 81582, 81586, 81590, 0, 0, 0, 0, 81595, - 81600, 81607, 81612, 81617, 0, 81622, 81627, 81632, 81637, 81642, 81647, - 81652, 81657, 81662, 81667, 81672, 81677, 81686, 81695, 81703, 81711, - 81720, 81729, 81738, 81747, 81755, 81763, 81771, 81779, 81784, 81789, - 81795, 81801, 81807, 81813, 81821, 81829, 81835, 81841, 81847, 81853, - 81859, 81865, 81871, 81877, 81882, 81887, 81892, 81897, 81902, 81907, - 81912, 81917, 81923, 81929, 81935, 81941, 81947, 81953, 81959, 81965, - 81971, 81977, 81983, 81989, 81995, 82001, 82007, 82013, 82019, 82025, - 82031, 82037, 82043, 82049, 82055, 82061, 82067, 82073, 82079, 82085, - 82091, 82097, 82103, 82109, 82115, 82121, 82127, 82133, 82139, 82145, - 82151, 82157, 82163, 82169, 82175, 82181, 82187, 82193, 82199, 82205, - 82211, 82217, 82223, 82229, 82235, 82241, 82247, 82253, 82259, 82265, - 82271, 82277, 82282, 82287, 82292, 82297, 82303, 82309, 82315, 82321, - 82327, 82333, 82339, 82345, 82351, 82357, 82363, 82369, 82374, 82379, - 82384, 82389, 82401, 82413, 82424, 82435, 82447, 82459, 82467, 0, 0, - 82475, 0, 82483, 82487, 82491, 82494, 82498, 82502, 82505, 82508, 82512, - 82516, 82519, 82522, 82525, 82528, 82533, 82536, 82540, 82543, 82546, - 82549, 82552, 82555, 82558, 82561, 82564, 82567, 82570, 82573, 82577, - 82581, 82585, 82589, 82594, 82599, 82605, 82611, 82617, 82622, 82628, - 82634, 82640, 82645, 82651, 82657, 82662, 82667, 82672, 82677, 82683, - 82689, 82694, 82699, 82705, 82710, 82716, 82722, 82728, 82734, 82740, - 82744, 82749, 82753, 82758, 82762, 82767, 82772, 82778, 82784, 82790, - 82795, 82801, 82807, 82813, 82818, 82824, 82830, 82835, 82840, 82845, - 82850, 82856, 82862, 82867, 82872, 82878, 82883, 82889, 82895, 82901, - 82907, 82913, 82918, 82922, 82927, 82930, 82935, 82940, 82946, 82951, - 82956, 82960, 82966, 82971, 82976, 82981, 82986, 82991, 82996, 83001, - 83007, 83013, 83019, 83027, 83031, 83035, 83039, 83043, 83047, 83051, - 83056, 83061, 83066, 83071, 83076, 83081, 83086, 83091, 83096, 83101, - 83106, 83111, 83116, 83120, 83124, 83129, 83134, 83139, 83144, 83148, - 83153, 83158, 83163, 83168, 83172, 83177, 83182, 83187, 83192, 83196, - 83201, 83206, 83210, 83215, 83220, 83225, 83230, 83235, 83239, 83246, - 83253, 83257, 83262, 83267, 83272, 83277, 83282, 83287, 83292, 83297, - 83302, 83307, 83312, 83317, 83322, 83327, 83332, 83337, 83342, 83347, - 83352, 83357, 83362, 83367, 83372, 83377, 83382, 83387, 83392, 83397, - 83402, 0, 0, 0, 83407, 83411, 83416, 83420, 83425, 83430, 0, 0, 83434, - 83439, 83444, 83448, 83453, 83458, 0, 0, 83463, 83468, 83472, 83477, - 83482, 83487, 0, 0, 83492, 83497, 83502, 0, 0, 0, 83506, 83510, 83514, - 83517, 83520, 83524, 83528, 0, 83532, 83538, 83541, 83545, 83548, 83552, - 83556, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 83560, 83566, 83572, 83578, 83584, - 0, 0, 83588, 83594, 83600, 83606, 83612, 83618, 83625, 83632, 83639, - 83646, 83653, 83660, 0, 83667, 83674, 83681, 83687, 83694, 83701, 83708, - 83715, 83721, 83728, 83735, 83742, 83749, 83755, 83762, 83769, 83776, - 83783, 83789, 83796, 83803, 83810, 83817, 83824, 83831, 83838, 0, 83845, - 83851, 83858, 83865, 83872, 83879, 83886, 83893, 83900, 83907, 83914, - 83921, 83928, 83935, 83941, 83948, 83955, 83962, 83969, 0, 83976, 83983, - 0, 83990, 83997, 84004, 84011, 84018, 84025, 84032, 84039, 84046, 84053, - 84060, 84067, 84074, 84081, 84088, 0, 0, 84094, 84099, 84104, 84109, - 84114, 84119, 84124, 84129, 84134, 84139, 84144, 84149, 84154, 84159, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 84164, 84171, 84178, 84185, 84192, 84199, - 84206, 84213, 84220, 84227, 84234, 84241, 84248, 84255, 84262, 84269, - 84276, 84283, 84290, 84297, 84305, 84313, 84320, 84327, 84332, 84340, - 84348, 84355, 84362, 84367, 84374, 84379, 84384, 84391, 84396, 84401, - 84406, 84414, 84419, 84424, 84431, 84436, 84441, 84448, 84455, 84460, - 84465, 84470, 84475, 84480, 84485, 84490, 84495, 84500, 84507, 84512, - 84519, 84524, 84529, 84534, 84539, 84544, 84549, 84554, 84559, 84564, - 84569, 84574, 84581, 84588, 84595, 84602, 84608, 84613, 84620, 84625, - 84630, 84639, 84646, 84655, 84662, 84667, 84672, 84680, 84685, 84690, - 84695, 84700, 84705, 84712, 84717, 84722, 84727, 84732, 84737, 84744, - 84751, 84758, 84765, 84772, 84779, 84786, 84793, 84800, 84807, 84814, - 84821, 84828, 84835, 84842, 84849, 84856, 84863, 84870, 84877, 84884, - 84891, 84898, 84905, 84912, 84919, 84926, 84933, 0, 0, 0, 0, 0, 84940, - 84948, 84956, 0, 0, 0, 0, 84961, 84965, 84969, 84973, 84977, 84981, - 84985, 84989, 84993, 84997, 85002, 85007, 85012, 85017, 85022, 85027, - 85032, 85037, 85042, 85048, 85054, 85060, 85067, 85074, 85081, 85088, - 85095, 85102, 85108, 85114, 85120, 85127, 85134, 85141, 85148, 85155, - 85162, 85169, 85176, 85183, 85190, 85197, 85204, 85211, 85218, 0, 0, 0, - 85225, 85233, 85241, 85249, 85257, 85265, 85275, 85285, 85293, 85301, - 85309, 85317, 85325, 85331, 85338, 85347, 85356, 85365, 85374, 85383, - 85392, 85402, 85413, 85423, 85434, 85443, 85452, 85461, 85471, 85482, - 85492, 85503, 85514, 85523, 85531, 85537, 85543, 85549, 85555, 85563, - 85571, 85577, 85584, 85594, 85601, 85608, 85615, 85622, 85629, 85639, - 85646, 85653, 85661, 85669, 85678, 85687, 85696, 85705, 85714, 85722, - 85731, 85740, 85749, 85753, 85760, 85765, 85770, 85774, 85778, 85782, - 85786, 85791, 85796, 85802, 85808, 85812, 85818, 85822, 85826, 85830, - 85834, 85838, 85842, 85848, 0, 0, 0, 0, 0, 85852, 85857, 85862, 85867, - 85872, 85879, 85884, 85889, 85894, 85899, 85904, 85909, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 85914, - 85921, 85930, 85939, 85946, 85953, 85960, 85967, 85974, 85981, 85987, - 85994, 86001, 86008, 86015, 86022, 86029, 86036, 86043, 86052, 86059, - 86066, 86073, 86080, 86087, 86094, 86101, 86108, 86117, 86124, 86131, - 86138, 86145, 86152, 86159, 86168, 86175, 86182, 86189, 86196, 86205, - 86212, 86219, 86226, 86234, 86243, 0, 0, 86252, 86256, 86260, 86265, - 86270, 86275, 86280, 86284, 86289, 86294, 86299, 86304, 86309, 86314, - 86318, 86322, 86326, 86331, 86336, 86340, 86345, 86350, 86354, 86358, - 86363, 86368, 86373, 86378, 86383, 0, 0, 0, 86388, 86392, 86397, 86402, - 86406, 86411, 86415, 86420, 86425, 86430, 86435, 86439, 86443, 86448, - 86453, 86458, 86463, 86467, 86472, 86476, 86481, 86486, 86490, 86495, - 86500, 86505, 86509, 86513, 86518, 86523, 86528, 86533, 86538, 86543, - 86548, 86553, 86558, 86563, 86568, 86573, 86578, 86583, 86588, 86593, - 86598, 86603, 86608, 86613, 86618, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86623, 86627, 86632, 86637, 86642, 86646, - 86651, 86656, 86661, 86666, 86670, 86674, 86679, 86684, 86689, 86694, - 86698, 86703, 86708, 86713, 86718, 86723, 86728, 86732, 86737, 86742, - 86747, 86752, 86757, 86762, 86767, 0, 86772, 86777, 86782, 86788, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 86794, 86799, 86804, 86809, 86814, 86819, - 86824, 86829, 86834, 86839, 86844, 86849, 86854, 86859, 86864, 86869, - 86874, 86879, 86884, 86889, 86894, 86899, 86904, 86909, 86914, 86919, - 86924, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 86931, 86936, 86941, 86946, 86951, 86956, 86961, - 86966, 86971, 86976, 86981, 86986, 86991, 86996, 87001, 87006, 87011, - 87016, 87021, 87026, 87031, 87036, 87041, 87046, 87051, 87056, 87061, - 87065, 87069, 87073, 0, 87078, 87084, 87089, 87094, 87099, 87104, 87110, - 87116, 87122, 87128, 87134, 87140, 87146, 87152, 87158, 87164, 87170, - 87176, 87182, 87187, 87193, 87199, 87204, 87210, 87215, 87221, 87227, - 87232, 87238, 87244, 87249, 87255, 87261, 87267, 87273, 87279, 87285, 0, - 0, 0, 0, 87290, 87296, 87302, 87308, 87314, 87320, 87326, 87332, 87338, - 87345, 87350, 87355, 87361, 87367, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 87373, 87378, 87383, 87388, 87394, 87399, 87405, 87411, - 87417, 87423, 87430, 87436, 87443, 87448, 87453, 87458, 87463, 87468, - 87473, 87478, 87483, 87488, 87493, 87498, 87503, 87508, 87513, 87518, - 87523, 87528, 87533, 87538, 87543, 87548, 87553, 87558, 87563, 87568, - 87573, 87578, 87583, 87588, 87593, 87598, 87604, 87609, 87615, 87621, - 87627, 87633, 87640, 87646, 87653, 87658, 87663, 87668, 87673, 87678, - 87683, 87688, 87693, 87698, 87703, 87708, 87713, 87718, 87723, 87728, - 87733, 87738, 87743, 87748, 87753, 87758, 87763, 87768, 87773, 87778, - 87783, 87788, 87793, 87798, 87803, 87808, 87813, 87818, 87823, 87828, - 87833, 87838, 87843, 87848, 87853, 87858, 87863, 87868, 87873, 87878, - 87883, 87888, 87893, 87898, 87903, 87908, 87913, 87918, 87923, 87928, - 87933, 87938, 87943, 87948, 87953, 87958, 87963, 87968, 87973, 87978, - 87983, 87988, 87993, 87998, 88003, 88008, 88013, 88018, 88023, 88028, - 88033, 88038, 88043, 88048, 88053, 88058, 88063, 88068, 88072, 88077, - 88082, 88087, 88092, 88097, 88102, 88107, 88112, 88117, 88122, 88127, - 88132, 88136, 88140, 88144, 88148, 88152, 88156, 88160, 88165, 88170, 0, - 0, 88175, 88180, 88184, 88188, 88192, 88196, 88200, 88204, 88208, 88212, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88216, 88220, 88224, 88228, - 88232, 88236, 0, 0, 88241, 0, 88246, 88250, 88255, 88260, 88265, 88270, - 88275, 88280, 88285, 88290, 88295, 88299, 88304, 88309, 88314, 88319, - 88323, 88328, 88333, 88338, 88343, 88347, 88352, 88357, 88362, 88367, - 88371, 88376, 88381, 88386, 88391, 88396, 88401, 88406, 88411, 88416, - 88421, 88426, 88431, 88435, 88440, 88445, 88450, 88455, 0, 88460, 88465, - 0, 0, 0, 88470, 0, 0, 88475, 88480, 88487, 88494, 88501, 88508, 88515, - 88522, 88529, 88536, 88543, 88550, 88557, 88564, 88571, 88578, 88585, - 88592, 88599, 88606, 88613, 88620, 88627, 0, 88634, 88641, 88647, 88653, - 88659, 88666, 88673, 88681, 88689, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88698, 88703, - 88708, 88713, 88718, 88723, 88728, 88733, 88738, 88743, 88748, 88753, - 88758, 88763, 88768, 88773, 88778, 88783, 88788, 88793, 88798, 88803, - 88808, 88812, 88817, 88822, 88828, 88832, 0, 0, 0, 88836, 88842, 88846, - 88851, 88856, 88861, 88865, 88870, 88874, 88879, 88884, 88888, 88892, - 88896, 88900, 88904, 88909, 88914, 88918, 88923, 88928, 88932, 88937, - 88942, 88947, 88952, 88957, 0, 0, 0, 0, 0, 88962, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 88967, 88970, 88974, 88978, 0, 88983, 88987, 0, - 0, 0, 0, 0, 88991, 88996, 89002, 89006, 89010, 89013, 89017, 89021, 0, - 89025, 89029, 89033, 0, 89037, 89041, 89045, 89049, 89053, 89057, 89061, - 89065, 89069, 89073, 89077, 89080, 89083, 89087, 89091, 89095, 89098, - 89101, 89104, 89108, 89112, 89116, 89120, 89124, 89128, 89131, 89135, 0, - 0, 0, 0, 89139, 89144, 89148, 0, 0, 0, 0, 89152, 89155, 89158, 89161, - 89164, 89167, 89171, 89175, 89180, 0, 0, 0, 0, 0, 0, 0, 0, 89185, 89190, - 89196, 89201, 89207, 89212, 89217, 89222, 89228, 0, 0, 0, 0, 0, 0, 0, - 89233, 89241, 89249, 89257, 89265, 89273, 89281, 89289, 89297, 89305, - 89313, 89321, 89329, 89337, 89345, 89353, 89361, 89369, 89377, 89385, - 89393, 89401, 89409, 89417, 89425, 89433, 89441, 89449, 89457, 89465, - 89472, 89480, 89488, 89492, 89497, 89502, 89507, 89512, 89517, 89522, - 89527, 89531, 89536, 89540, 89545, 89549, 89554, 89558, 89563, 89568, - 89573, 89578, 89583, 89588, 89593, 89598, 89603, 89608, 89613, 89618, - 89623, 89628, 89633, 89638, 89643, 89648, 89653, 89658, 89663, 89668, - 89673, 89678, 89683, 89688, 89693, 89698, 89703, 89708, 89713, 89718, - 89723, 89728, 89733, 89738, 89743, 89748, 0, 0, 0, 89753, 89758, 89767, - 89775, 89784, 89793, 89804, 89815, 89822, 89829, 89836, 89843, 89850, - 89857, 89864, 89871, 89878, 89885, 89892, 89899, 89906, 89913, 89920, - 89927, 89934, 89941, 89948, 89955, 89962, 0, 0, 89969, 89975, 89981, - 89987, 89993, 90000, 90007, 90015, 90023, 90030, 90037, 90044, 90051, - 90058, 90065, 90072, 90079, 90086, 90093, 90100, 90107, 90114, 90121, - 90128, 90135, 90142, 90149, 0, 0, 0, 0, 0, 90156, 90162, 90168, 90174, - 90180, 90187, 90194, 90202, 90210, 90216, 90222, 90229, 90235, 90241, - 90247, 90253, 90260, 90267, 90274, 90281, 90288, 90295, 90302, 90309, - 90316, 90323, 90330, 90337, 90344, 90351, 90358, 90365, 90372, 90379, - 90386, 90393, 90400, 90407, 90414, 90421, 90428, 90435, 90442, 90449, - 90456, 90463, 90470, 90477, 90484, 90491, 90498, 90505, 90512, 90519, - 90526, 90533, 90540, 90547, 90554, 90561, 90568, 90575, 90582, 90589, - 90596, 90603, 90610, 90617, 90624, 90631, 90638, 90645, 90652, 90659, - 90666, 90673, 90680, 90687, 90694, 90701, 90708, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 90715, 90719, 90723, 90727, 90731, 90735, 90739, 90743, 90747, 90751, - 90756, 90761, 90766, 90771, 90776, 90781, 90786, 90791, 90796, 90802, - 90808, 90814, 90821, 90828, 90835, 90842, 90849, 90856, 90863, 90870, - 90877, 0, 90884, 90888, 90892, 90896, 90899, 90903, 90906, 90910, 90913, - 90917, 90920, 90924, 90927, 90931, 90934, 90938, 90942, 90946, 90950, - 90954, 90958, 90962, 90966, 90970, 90974, 90978, 90982, 90986, 90990, - 90994, 90998, 91002, 91006, 91010, 91014, 91017, 91020, 91024, 91028, - 91032, 91035, 91038, 91041, 91045, 91049, 91053, 91057, 91061, 91064, - 91069, 91073, 91078, 91082, 91087, 91091, 91096, 91100, 91105, 91109, - 91113, 91117, 91121, 91124, 91128, 91133, 91136, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 91140, 91143, 91148, 91154, 91162, 91167, 91173, 91181, - 91187, 91193, 91197, 91201, 91208, 91217, 91224, 91233, 91239, 91248, - 91255, 91262, 91269, 91279, 91285, 91289, 91296, 91305, 91315, 91322, - 91329, 91333, 91337, 91344, 91354, 91358, 91365, 91372, 91379, 91385, - 91392, 91399, 91406, 91413, 91417, 91421, 91425, 91432, 91436, 91443, - 91450, 91464, 91473, 91477, 91481, 91485, 91492, 91496, 91500, 91504, - 91512, 91520, 91539, 91549, 91569, 91573, 91577, 91581, 91585, 91589, - 91593, 91597, 91604, 91608, 91611, 91615, 91619, 91625, 91632, 91641, - 91645, 91654, 91663, 91671, 91675, 91682, 91686, 91690, 91694, 91698, - 91709, 91718, 91727, 91736, 91745, 91757, 91766, 91775, 91784, 91792, - 91801, 91813, 91822, 91831, 91840, 91852, 91861, 91870, 91882, 91891, - 91900, 91912, 91921, 91925, 91929, 91933, 91937, 91941, 91945, 91949, - 91956, 91960, 91964, 91975, 91979, 91983, 91990, 91996, 92002, 92006, - 92013, 92017, 92021, 92025, 92029, 92033, 92037, 92043, 92051, 92055, - 92059, 92062, 92068, 92078, 92082, 92094, 92101, 92108, 92115, 92122, - 92128, 92132, 92136, 92140, 92144, 92151, 92160, 92167, 92175, 92183, - 92189, 92193, 92197, 92201, 92205, 92211, 92220, 92232, 92239, 92246, - 92255, 92266, 92272, 92281, 92290, 92297, 92306, 92313, 92320, 92330, - 92337, 92344, 92351, 92358, 92362, 92368, 92372, 92383, 92391, 92400, - 92412, 92419, 92426, 92436, 92443, 92452, 92459, 92468, 92475, 92482, - 92492, 92499, 92506, 92516, 92523, 92535, 92544, 92551, 92558, 92565, - 92574, 92584, 92597, 92604, 92614, 92624, 92631, 92640, 92653, 92660, - 92667, 92674, 92684, 92694, 92701, 92711, 92718, 92725, 92735, 92741, - 92748, 92755, 92762, 92772, 92779, 92786, 92793, 92799, 92806, 92816, - 92823, 92827, 92835, 92839, 92851, 92855, 92869, 92873, 92877, 92881, - 92885, 92891, 92898, 92906, 92910, 92914, 92918, 92922, 92929, 92933, - 92939, 92945, 92953, 92957, 92964, 92972, 92976, 92980, 92986, 92990, - 92999, 93008, 93015, 93025, 93031, 93035, 93039, 93047, 93054, 93061, - 93067, 93071, 93079, 93083, 93090, 93102, 93109, 93119, 93125, 93129, - 93138, 93145, 93154, 93158, 93162, 93169, 93173, 93177, 93181, 93185, - 93188, 93194, 93200, 93204, 93208, 93215, 93222, 93229, 93236, 93243, - 93250, 93257, 93264, 93270, 93274, 93278, 93285, 93292, 93299, 93306, - 93313, 93317, 93320, 93325, 93329, 93333, 93342, 93351, 93355, 93359, - 93365, 93371, 93388, 93394, 93398, 93407, 93411, 93415, 93422, 93430, - 93438, 93444, 93448, 93452, 93456, 93460, 93463, 93468, 93474, 93483, - 93489, 93495, 93501, 93506, 93512, 93518, 93524, 93530, 93536, 93544, - 93550, 93561, 93567, 93573, 93582, 93592, 93598, 93604, 93610, 93616, - 93622, 93628, 93634, 93640, 93646, 93652, 93661, 93670, 93679, 93685, - 93694, 93700, 93706, 93712, 93718, 93724, 93730, 93736, 93742, 93748, - 93754, 93760, 93766, 93772, 93777, 93783, 93789, 93797, 93803, 93809, - 93813, 93821, 93825, 93829, 93833, 93837, 93841, 93848, 93852, 93861, - 93865, 93872, 93880, 93884, 93888, 93892, 93905, 93921, 93925, 93929, - 93936, 93942, 93949, 93953, 93957, 93961, 93965, 93969, 93976, 93980, - 93998, 94002, 94006, 94013, 94017, 94021, 94027, 94031, 94035, 94043, - 94047, 94051, 94055, 94059, 94065, 94076, 94085, 94094, 94101, 94108, - 94119, 94126, 94133, 94140, 94147, 94154, 94161, 94168, 94178, 94184, - 94191, 94201, 94210, 94217, 94226, 94236, 94243, 94250, 94257, 94264, - 94276, 94283, 94290, 94297, 94304, 94311, 94321, 94328, 94335, 94345, - 94358, 94370, 94377, 94387, 94394, 94401, 94408, 94422, 94428, 94436, - 94446, 94456, 94463, 94470, 94476, 94480, 94487, 94497, 94503, 94516, - 94520, 94524, 94531, 94535, 94542, 94552, 94556, 94560, 94564, 94568, - 94572, 94579, 94583, 94590, 94597, 94604, 94613, 94622, 94632, 94639, - 94646, 94653, 94663, 94670, 94680, 94687, 94697, 94704, 94711, 94721, - 94731, 94738, 94744, 94752, 94760, 94766, 94772, 94776, 94780, 94787, - 94795, 94801, 94805, 94809, 94813, 94820, 94832, 94835, 94842, 94848, - 94852, 94856, 94860, 94864, 94868, 94872, 94876, 94880, 94884, 94888, - 94895, 94899, 94905, 94909, 94913, 94917, 94923, 94930, 94937, 94944, - 94955, 94963, 94967, 94973, 94982, 94989, 94995, 94998, 95002, 95006, - 95012, 95021, 95029, 95033, 95039, 95043, 95047, 95051, 95057, 95064, - 95070, 95074, 95080, 95084, 95088, 95097, 95109, 95113, 95120, 95127, - 95137, 95144, 95156, 95163, 95170, 95177, 95188, 95198, 95211, 95221, - 95228, 95232, 95236, 95240, 95244, 95253, 95262, 95271, 95288, 95297, - 95303, 95310, 95318, 95331, 95335, 95344, 95353, 95362, 95371, 95382, - 95391, 95400, 95409, 95418, 95427, 95436, 95446, 95449, 95453, 95457, - 95461, 95465, 95469, 95475, 95482, 95489, 95496, 95502, 95508, 95515, - 95521, 95528, 95536, 95540, 95547, 95554, 95561, 95569, 95572, 95576, - 95580, 95584, 95588, 95594, 95598, 95604, 95611, 95618, 95624, 95631, - 95638, 95645, 95652, 95659, 95666, 95673, 95680, 95687, 95694, 95701, - 95708, 95715, 95722, 95728, 95732, 95741, 95745, 95749, 95753, 95757, - 95763, 95770, 95777, 95784, 95791, 95798, 95804, 95812, 95816, 95820, - 95824, 95828, 95834, 95851, 95868, 95872, 95876, 95880, 95884, 95888, - 95892, 95898, 95905, 95909, 95915, 95922, 95929, 95936, 95943, 95950, - 95959, 95966, 95973, 95980, 95987, 95991, 95995, 96001, 96013, 96017, - 96021, 96030, 96034, 96038, 96042, 96048, 96052, 96056, 96065, 96069, - 96073, 96077, 96084, 96088, 96092, 96096, 96100, 96104, 96108, 96112, - 96116, 96122, 96129, 96136, 96142, 96146, 96163, 96169, 96173, 96179, - 96185, 96191, 96197, 96203, 96209, 96213, 96217, 96221, 96227, 96231, - 96237, 96241, 96245, 96252, 96259, 96276, 96280, 96284, 96288, 96292, - 96296, 96308, 96311, 96316, 96321, 96336, 96346, 96357, 96361, 96365, - 96369, 96375, 96382, 96389, 96399, 96411, 96417, 96423, 96432, 96436, - 96440, 96447, 96457, 96464, 96470, 96474, 96478, 96485, 96491, 96495, - 96501, 96505, 96513, 96519, 96523, 96531, 96539, 96546, 96552, 96559, - 96566, 96576, 96586, 96590, 96594, 96598, 96602, 96608, 96615, 96621, - 96628, 96635, 96642, 96651, 96658, 96665, 96671, 96678, 96685, 96692, - 96699, 96706, 96713, 96719, 96726, 96733, 96740, 96749, 96756, 96763, - 96767, 96773, 96777, 96783, 96790, 96797, 96804, 96808, 96812, 96816, - 96820, 96824, 96831, 96835, 96839, 96845, 96853, 96857, 96861, 96865, - 96869, 96876, 96880, 96884, 96892, 96896, 96900, 96904, 96908, 96914, - 96918, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96922, 96928, - 96934, 96941, 96948, 96955, 96962, 96969, 96976, 96982, 96989, 96996, - 97003, 97010, 97017, 97024, 97030, 97036, 97042, 97048, 97054, 97060, - 97066, 97072, 97078, 97085, 97092, 97099, 97106, 97113, 97120, 97126, - 97132, 97138, 97145, 97152, 97158, 97164, 97173, 97180, 97187, 97194, - 97201, 97208, 97215, 97221, 97227, 97233, 97242, 97249, 97256, 97267, - 97278, 97284, 97290, 97296, 97305, 97312, 97319, 97329, 97339, 97350, - 97361, 97373, 97386, 97397, 97408, 97420, 97433, 97444, 97455, 97466, - 97477, 97488, 97500, 97508, 97516, 97525, 97534, 97543, 97549, 97555, - 97561, 97568, 97578, 97585, 97595, 97600, 97605, 97611, 97617, 97625, - 97633, 97642, 97653, 97664, 97672, 97680, 97689, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 97698, 97709, 97716, 97724, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 97732, 97736, 97740, 97744, 97748, 97752, 97756, 97760, 97764, - 97768, 97772, 97776, 97780, 97784, 97788, 97792, 97796, 97800, 97804, - 97808, 97812, 97816, 97820, 97824, 97828, 97832, 97836, 97840, 97844, - 97848, 97852, 97856, 97860, 97864, 97868, 97872, 97876, 97880, 97884, - 97888, 97892, 97896, 97900, 97904, 97908, 97912, 97916, 97920, 97924, - 97928, 97932, 97936, 97940, 97944, 97948, 97952, 97956, 97960, 97964, - 97968, 97972, 97976, 97980, 97984, 97988, 97992, 97996, 98000, 98004, - 98008, 98012, 98016, 98020, 98024, 98028, 98032, 98036, 98040, 98044, - 98048, 98052, 98056, 98060, 98064, 98068, 98072, 98076, 98080, 98084, - 98088, 98092, 98096, 98100, 98104, 98108, 98112, 98116, 98120, 98124, - 98128, 98132, 98136, 98140, 98144, 98148, 98152, 98156, 98160, 98164, - 98168, 98172, 98176, 98180, 98184, 98188, 98192, 98196, 98200, 98204, - 98208, 98212, 98216, 98220, 98224, 98228, 98232, 98236, 98240, 98244, - 98248, 98252, 98256, 98260, 98264, 98268, 98272, 98276, 98280, 98284, - 98288, 98292, 98296, 98300, 98304, 98308, 98312, 98316, 98320, 98324, - 98328, 98332, 98336, 98340, 98344, 98348, 98352, 98356, 98360, 98364, - 98368, 98372, 98376, 98380, 98384, 98388, 98392, 98396, 98400, 98404, - 98408, 98412, 98416, 98420, 98424, 98428, 98432, 98436, 98440, 98444, - 98448, 98452, 98456, 98460, 98464, 98468, 98472, 98476, 98480, 98484, - 98488, 98492, 98496, 98500, 98504, 98508, 98512, 98516, 98520, 98524, - 98528, 98532, 98536, 98540, 98544, 98548, 98552, 98556, 98560, 98564, - 98568, 98572, 98576, 98580, 98584, 98588, 98592, 98596, 98600, 98604, - 98608, 98612, 98616, 98620, 98624, 98628, 98632, 98636, 98640, 98644, - 98648, 98652, 98656, 98660, 98664, 98668, 98672, 98676, 98680, 98684, - 98688, 98692, 98696, 98700, 98704, 98708, 98712, 98716, 98720, 98724, - 98728, 98732, 98736, 98740, 98744, 98748, 98752, 98756, 98760, 98764, - 98768, 98772, 98776, 98780, 98784, 98788, 98792, 98796, 98800, 98804, - 98808, 98812, 98816, 98820, 98824, 98828, 98832, 98836, 98840, 98844, - 98848, 98852, 98856, 98860, 98864, 98868, 98872, 98876, 98880, 98884, - 98888, 98892, 98896, 98900, 98904, 98908, 98912, 98916, 98920, 98924, - 98928, 98932, 98936, 98940, 98944, 98948, 98952, 98956, 98960, 98964, - 98968, 98972, 98976, 98980, 98984, 98988, 98992, 98996, 99000, 99004, - 99008, 99012, 99016, 99020, 99024, 99028, 99032, 99036, 99040, 99044, - 99048, 99052, 99056, 99060, 99064, 99068, 99072, 99076, 99080, 99084, - 99088, 99092, 99096, 99100, 99104, 99108, 99112, 99116, 99120, 99124, - 99128, 99132, 99136, 99140, 99144, 99148, 99152, 99156, 99160, 99164, - 99168, 99172, 99176, 99180, 99184, 99188, 99192, 99196, 99200, 99204, - 99208, 99212, 99216, 99220, 99224, 99228, 99232, 99236, 99240, 99244, - 99248, 99252, 99256, 99260, 99264, 99268, 99272, 99276, 99280, 99284, - 99288, 99292, 99296, 99300, 99304, 99308, 99312, 99316, 99320, 99324, - 99328, 99332, 99336, 99340, 99344, 99348, 99352, 99356, 99360, 99364, - 99368, 99372, 99376, 99380, 99384, 99388, 99392, 99396, 99400, 99404, - 99408, 99412, 99416, 99420, 99424, 99428, 99432, 99436, 99440, 99444, - 99448, 99452, 99456, 99460, 99464, 99468, 99472, 99476, 99480, 99484, - 99488, 99492, 99496, 99500, 99504, 99508, 99512, 99516, 99520, 99524, - 99528, 99532, 99536, 99540, 99544, 99548, 99552, 99556, 99560, 99564, - 99568, 99572, 99576, 99580, 99584, 99588, 99592, 99596, 99600, 99604, - 99608, 99612, 99616, 99620, 99624, 99628, 99632, 99636, 99640, 99644, - 99648, 99652, 99656, 99660, 99664, 99668, 99672, 99676, 99680, 99684, - 99688, 99692, 99696, 99700, 99704, 99708, 99712, 99716, 99720, 99724, - 99728, 99732, 99736, 99740, 99744, 99748, 99752, 99756, 99760, 99764, - 99768, 99772, 99776, 99780, 99784, 99788, 99792, 99796, 99800, 99804, - 99808, 99812, 99816, 99820, 99824, 99828, 99832, 99836, 99840, 99844, - 99848, 99852, 99856, 99860, 99864, 99868, 99872, 99876, 99880, 99884, - 99888, 99892, 99896, 99900, 99904, 99908, 99912, 99916, 99920, 99924, - 99928, 99932, 99936, 99940, 99944, 99948, 99952, 99956, 99960, 99964, - 99968, 99972, 99976, 99980, 99984, 99988, 99992, 99996, 100000, 100004, - 100008, 100012, 100016, 100020, 100024, 100028, 100032, 100036, 100040, - 100044, 100048, 100052, 100056, 100060, 100064, 100068, 100072, 100076, - 100080, 100084, 100088, 100092, 100096, 100100, 100104, 100108, 100112, - 100116, 100120, 100124, 100128, 100132, 100136, 100140, 100144, 100148, - 100152, 100156, 100160, 100164, 100168, 100172, 100176, 100180, 100184, - 100188, 100192, 100196, 100200, 100204, 100208, 100212, 100216, 100220, - 100224, 100228, 100232, 100236, 100240, 100244, 100248, 100252, 100256, - 100260, 100264, 100268, 100272, 100276, 100280, 100284, 100288, 100292, - 100296, 100300, 100304, 100308, 100312, 100316, 100320, 100324, 100328, - 100332, 100336, 100340, 100344, 100348, 100352, 100356, 100360, 100364, - 100368, 100372, 100376, 100380, 100384, 100388, 100392, 100396, 100400, - 100404, 100408, 100412, 100416, 100420, 100424, 100428, 100432, 100436, - 100440, 100444, 100448, 100452, 100456, 100460, 100464, 100468, 100472, - 100476, 100480, 100484, 100488, 100492, 100496, 100500, 100504, 100508, - 100512, 100516, 100520, 100524, 100528, 100532, 100536, 100540, 100544, - 100548, 100552, 100556, 100560, 100564, 100568, 100572, 100576, 100580, - 100584, 100588, 100592, 100596, 100600, 100604, 100608, 100612, 100616, - 100620, 100624, 100628, 100632, 100636, 100640, 100644, 100648, 100652, - 100656, 100660, 100664, 100668, 100672, 100676, 100680, 100684, 100688, - 100692, 100696, 100700, 100704, 100708, 100712, 100716, 100720, 100724, - 100728, 100732, 100736, 100740, 100744, 100748, 100752, 100756, 100760, - 100764, 100768, 100772, 100776, 100780, 100784, 100788, 100792, 100796, - 100800, 100804, 100808, 100812, 100816, 100820, 100824, 100828, 100832, - 100836, 100840, 100844, 100848, 100852, 100856, 100860, 100864, 100868, - 100872, 100876, 100880, 100884, 100888, 100892, 100896, 100900, 100904, - 100908, 100912, 100916, 100920, 100924, 100928, 100932, 100936, 100940, - 100944, 100948, 100952, 100956, 100960, 100964, 100968, 100972, 100976, - 100980, 100984, 100988, 100992, 100996, 101000, 101004, 101008, 101012, - 101016, 101020, 101024, 101028, 101032, 101036, 101040, 101044, 101048, - 101052, 101056, 101060, 101064, 101068, 101072, 101076, 101080, 101084, - 101088, 101092, 101096, 101100, 101104, 101108, 101112, 101116, 101120, - 101124, 101128, 101132, 101136, 101140, 101144, 101148, 101152, 101156, - 101160, 101164, 101168, 101172, 101176, 101180, 101184, 101188, 101192, - 101196, 101200, 101204, 101208, 101212, 101216, 101220, 101224, 101228, - 101232, 101236, 101240, 101244, 101248, 101252, 101256, 101260, 101264, - 101268, 101272, 101276, 101280, 101284, 101288, 101292, 101296, 101300, - 101304, 101308, 101312, 101316, 101320, 101324, 101328, 101332, 101336, - 101340, 101344, 101348, 101352, 101356, 101360, 101364, 101368, 101372, - 101376, 101380, 101384, 101388, 101392, 101396, 101400, 101404, 101408, - 101412, 101416, 101420, 101424, 101428, 101432, 101436, 101440, 101444, - 101448, 101452, 101456, 101460, 101464, 101468, 101472, 101476, 101480, - 101484, 101488, 101492, 101496, 101500, 101504, 101508, 101512, 101516, - 101520, 101524, 101528, 101532, 101536, 101540, 101544, 101548, 101552, - 101556, 101560, 101564, 101568, 101572, 101576, 101580, 101584, 101588, - 101592, 101596, 101600, 101604, 101608, 101612, 101616, 101620, 101624, - 101628, 101632, 101636, 101640, 101644, 101648, 101652, 101656, 101660, - 101664, 101668, 101672, 101676, 101680, 101684, 101688, 101692, 101696, - 101700, 101704, 101708, 101712, 101716, 101720, 101724, 101728, 101732, - 101736, 101740, 101744, 101748, 101752, 101756, 101760, 101764, 101768, - 101772, 101776, 101780, 101784, 101788, 101792, 101796, 101800, 101804, - 101808, 101812, 101816, 101820, 101824, 101828, 101832, 101836, 101840, - 101844, 101848, 101852, 101856, 101860, 101864, 101868, 101872, 101876, - 101880, 101884, 101888, 101892, 101896, 101900, 101904, 101908, 101912, - 101916, 101920, 101924, 101928, 101932, 101936, 101940, 101944, 101948, - 101952, 101956, 101960, 101964, 101968, 101972, 101976, 101980, 101984, - 101988, 101992, 101996, 102000, 102004, 102008, 102012, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 102016, 102021, 102026, 102031, 102038, 102045, 102052, 102059, - 102064, 102069, 102074, 102079, 102086, 102091, 102098, 102105, 102110, - 102115, 102120, 102127, 102132, 102137, 102144, 102151, 102156, 102161, - 102166, 102173, 102180, 102187, 102192, 102197, 102204, 102211, 102218, - 102225, 102230, 102235, 102240, 102247, 102252, 102257, 102262, 102269, - 102278, 102285, 102290, 102295, 102300, 102305, 102310, 102315, 102324, - 102331, 102336, 102343, 102350, 102355, 102360, 102365, 102372, 102377, - 102384, 102391, 102396, 102401, 102406, 102413, 102420, 102425, 102430, - 102437, 102444, 102451, 102456, 102461, 102466, 102471, 102478, 102487, - 102496, 102501, 102508, 102517, 102522, 102527, 102532, 102537, 102544, - 102551, 102558, 102565, 102570, 102575, 102580, 102587, 102594, 102601, - 102606, 102611, 102618, 102623, 102630, 102635, 102642, 102647, 102654, - 102661, 102666, 102671, 102676, 102681, 102686, 102691, 102696, 102701, - 102706, 102713, 102720, 102727, 102734, 102741, 102750, 102755, 102760, - 102767, 102774, 102779, 102786, 102793, 102800, 102807, 102814, 102821, - 102826, 102831, 102836, 102841, 102846, 102855, 102864, 102873, 102882, - 102891, 102900, 102909, 102918, 102923, 102934, 102945, 102954, 102959, - 102964, 102969, 102974, 102983, 102990, 102997, 103004, 103011, 103018, - 103025, 103034, 103043, 103054, 103063, 103074, 103083, 103090, 103099, - 103110, 103119, 103128, 103137, 103146, 103153, 103160, 103167, 103176, - 103185, 103196, 103205, 103214, 103225, 103230, 103235, 103246, 103254, - 103263, 103272, 103281, 103292, 103301, 103310, 103321, 103332, 103343, - 103354, 103365, 103376, 103383, 103390, 103397, 103404, 103415, 103424, - 103431, 103438, 103445, 103456, 103467, 103478, 103489, 103500, 103511, - 103522, 103533, 103540, 103547, 103556, 103565, 103572, 103579, 103586, - 103595, 103604, 103613, 103620, 103629, 103638, 103647, 103654, 103661, - 103666, 103672, 103679, 103686, 103693, 103700, 103707, 103714, 103723, - 103732, 103741, 103750, 103757, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 103766, - 103772, 103777, 103782, 103789, 103795, 103801, 103807, 103813, 103819, - 103825, 103831, 103835, 103839, 103845, 103851, 103857, 103861, 103866, - 103871, 103875, 103879, 103882, 103888, 103894, 103900, 103906, 103912, - 103918, 103924, 103930, 103936, 103946, 103956, 103962, 103968, 103978, - 103988, 103994, 0, 0, 104000, 104008, 104013, 104018, 104024, 104030, - 104036, 104042, 104048, 104054, 104061, 104068, 104074, 104080, 104086, - 104092, 104098, 104104, 104110, 104116, 104121, 104127, 104133, 104139, - 104145, 104151, 104160, 104166, 104171, 104179, 104186, 104193, 104202, - 104211, 104220, 104229, 104238, 104247, 104256, 104265, 104275, 104285, - 104293, 104301, 104310, 104319, 104325, 104331, 104337, 104343, 104351, - 104359, 104363, 104369, 104374, 104380, 104386, 104392, 104398, 104404, - 104413, 104418, 104425, 104430, 104435, 104440, 104446, 104452, 104458, - 104465, 104470, 104475, 104480, 104485, 104490, 104496, 104502, 104508, - 104514, 104520, 104526, 104532, 104538, 104543, 104548, 104553, 104558, - 104563, 104568, 104573, 104578, 104584, 104590, 104595, 104600, 104605, - 104610, 104615, 104621, 104628, 104632, 104636, 104640, 104644, 104648, - 104652, 104656, 104660, 104668, 104678, 104682, 104686, 104692, 104698, - 104704, 104710, 104716, 104722, 104728, 104734, 104740, 104746, 104752, - 104758, 104764, 104770, 104774, 104778, 104785, 104791, 104797, 104803, - 104808, 104815, 104820, 104826, 104832, 104838, 104844, 104849, 104853, - 104859, 104863, 104867, 104871, 104877, 104883, 104887, 104893, 104899, - 104905, 104911, 104917, 104925, 104933, 104939, 104945, 104951, 104957, - 104969, 104981, 104995, 105007, 105019, 105033, 105047, 105061, 105065, - 105073, 105081, 105086, 105090, 105094, 105098, 105102, 105106, 105110, - 105114, 105120, 105126, 105132, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 105138, - 105144, 105150, 105156, 105162, 105168, 105174, 105180, 105186, 105192, - 105198, 105204, 105210, 105216, 105222, 105228, 105234, 105240, 105246, - 105252, 105258, 105264, 105270, 105276, 105282, 105288, 105294, 105300, - 105306, 105312, 105318, 105324, 105330, 105336, 105342, 105348, 105354, - 105360, 105366, 105372, 105378, 105384, 105390, 105396, 105402, 105408, - 105414, 105420, 105426, 105432, 105438, 105444, 105450, 105456, 105462, - 105468, 105474, 105480, 105486, 105492, 105498, 105504, 105510, 105516, - 105522, 105528, 105534, 105539, 105544, 105549, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 105553, 105558, 105565, 105572, 105579, 105586, 105591, 105595, - 105601, 105605, 105609, 105615, 105619, 105623, 105627, 105633, 105640, - 105644, 105648, 105652, 105656, 105660, 105664, 105670, 105674, 105678, - 105682, 105686, 105690, 105694, 105698, 105702, 105706, 105710, 105714, - 105718, 105723, 105727, 105731, 105735, 105739, 105743, 105747, 105751, - 105755, 105759, 105766, 105770, 105777, 105781, 105785, 105789, 105793, - 105797, 105801, 105805, 105812, 105816, 105820, 105824, 105828, 105832, - 105838, 105842, 105848, 105852, 105856, 105860, 105864, 105868, 105872, - 105876, 105880, 105884, 105888, 105892, 105896, 105900, 105904, 105908, - 105912, 105916, 105920, 105924, 105932, 105936, 105940, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 105944, 105952, 105960, 105968, 105976, 105984, 105992, 106000, - 106008, 106016, 106024, 106032, 106040, 106048, 106056, 106064, 106072, - 106080, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 106088, 106092, 106097, - 106102, 106107, 106111, 106116, 106121, 106126, 106130, 106135, 106140, - 106144, 106148, 106152, 106156, 106161, 106166, 106170, 106174, 106179, - 106183, 106188, 106193, 106198, 106203, 106208, 106212, 106217, 106222, - 106227, 106231, 106236, 106241, 106246, 106250, 106255, 106260, 106264, - 106268, 106272, 106276, 106281, 106286, 106290, 106294, 106299, 106303, - 106308, 106313, 106318, 106323, 106328, 106332, 106337, 106342, 106347, - 106351, 106356, 106361, 106366, 106370, 106375, 106380, 106384, 106388, - 106392, 106396, 106401, 106406, 106410, 106414, 106419, 106423, 106428, - 106433, 106438, 106443, 106448, 106452, 106457, 106462, 106467, 106471, - 106476, 0, 106481, 106485, 106490, 106495, 106499, 106503, 106507, - 106511, 106516, 106521, 106525, 106529, 106534, 106538, 106543, 106548, - 106553, 106558, 106563, 106568, 106574, 106580, 106586, 106591, 106597, - 106603, 106609, 106614, 106620, 106626, 106631, 106636, 106641, 106646, - 106652, 106658, 106663, 106668, 106674, 106679, 106685, 106691, 106697, - 106703, 106709, 106714, 106720, 106726, 106732, 106737, 106743, 106749, - 106755, 106760, 106766, 106772, 106777, 106782, 106787, 106792, 106798, - 106804, 106809, 106814, 106820, 106825, 106831, 106837, 106843, 106849, - 106855, 0, 106859, 106864, 0, 0, 106869, 0, 0, 106874, 106879, 0, 0, - 106884, 106888, 106892, 106897, 0, 106902, 106906, 106911, 106915, - 106920, 106925, 106930, 106935, 106940, 106944, 106949, 106954, 0, - 106959, 0, 106964, 106969, 106973, 106978, 106983, 106987, 106991, 0, - 106995, 107000, 107005, 107009, 107013, 107018, 107022, 107027, 107032, - 107037, 107042, 107047, 107052, 107058, 107064, 107070, 107075, 107081, - 107087, 107093, 107098, 107104, 107110, 107115, 107120, 107125, 107130, - 107136, 107142, 107147, 107152, 107158, 107163, 107169, 107175, 107181, - 107187, 107193, 107198, 107204, 107210, 107216, 107221, 107227, 107233, - 107239, 107244, 107250, 107256, 107261, 107266, 107271, 107276, 107282, - 107288, 107293, 107298, 107304, 107309, 107315, 107321, 107327, 107333, - 107339, 107343, 0, 107348, 107353, 107357, 107362, 0, 0, 107367, 107372, - 107377, 107381, 107385, 107389, 107393, 107398, 0, 107403, 107407, - 107412, 107416, 107421, 107426, 107431, 0, 107436, 107440, 107445, - 107450, 107455, 107459, 107464, 107469, 107474, 107478, 107483, 107488, - 107492, 107496, 107500, 107504, 107509, 107514, 107518, 107522, 107527, - 107531, 107536, 107541, 107546, 107551, 107556, 107560, 0, 107565, - 107570, 107574, 107579, 0, 107584, 107588, 107593, 107598, 107602, 0, - 107606, 0, 0, 0, 107610, 107614, 107619, 107623, 107628, 107633, 107638, - 0, 107643, 107647, 107652, 107657, 107662, 107666, 107671, 107676, - 107681, 107685, 107690, 107695, 107699, 107703, 107707, 107711, 107716, - 107721, 107725, 107729, 107734, 107738, 107743, 107748, 107753, 107758, - 107763, 107768, 107774, 107780, 107786, 107791, 107797, 107803, 107809, - 107814, 107820, 107826, 107831, 107836, 107841, 107846, 107852, 107858, - 107863, 107868, 107874, 107879, 107885, 107891, 107897, 107903, 107909, - 107914, 107920, 107926, 107932, 107937, 107943, 107949, 107955, 107960, - 107966, 107972, 107977, 107982, 107987, 107992, 107998, 108004, 108009, - 108014, 108020, 108025, 108031, 108037, 108043, 108049, 108055, 108059, - 108064, 108069, 108074, 108078, 108083, 108088, 108093, 108097, 108102, - 108107, 108111, 108115, 108119, 108123, 108128, 108133, 108137, 108141, - 108146, 108150, 108155, 108160, 108165, 108170, 108175, 108179, 108184, - 108189, 108194, 108198, 108203, 108208, 108213, 108217, 108222, 108227, - 108231, 108235, 108239, 108243, 108248, 108253, 108257, 108261, 108266, - 108270, 108275, 108280, 108285, 108290, 108295, 108300, 108306, 108312, - 108318, 108323, 108329, 108335, 108341, 108346, 108352, 108358, 108363, - 108368, 108373, 108378, 108384, 108390, 108395, 108400, 108406, 108411, - 108417, 108423, 108429, 108435, 108441, 108446, 108452, 108458, 108464, - 108469, 108475, 108481, 108487, 108492, 108498, 108504, 108509, 108514, - 108519, 108524, 108530, 108536, 108541, 108546, 108552, 108557, 108563, - 108569, 108575, 108581, 108587, 108592, 108598, 108604, 108610, 108615, - 108621, 108627, 108633, 108638, 108644, 108650, 108655, 108660, 108665, - 108670, 108676, 108682, 108687, 108692, 108698, 108703, 108709, 108715, - 108721, 108727, 108733, 108738, 108744, 108750, 108756, 108761, 108767, - 108773, 108779, 108784, 108790, 108796, 108801, 108806, 108811, 108816, - 108822, 108828, 108833, 108838, 108844, 108849, 108855, 108861, 108867, - 108873, 108879, 108885, 108892, 108899, 108906, 108912, 108919, 108926, - 108933, 108939, 108946, 108953, 108959, 108965, 108971, 108977, 108984, - 108991, 108997, 109003, 109010, 109016, 109023, 109030, 109037, 109044, - 109051, 109057, 109064, 109071, 109078, 109084, 109091, 109098, 109105, - 109111, 109118, 109125, 109131, 109137, 109143, 109149, 109156, 109163, - 109169, 109175, 109182, 109188, 109195, 109202, 109209, 109216, 109223, - 109227, 109232, 109237, 109242, 109246, 109251, 109256, 109261, 109265, - 109270, 109275, 109279, 109283, 109287, 109291, 109296, 109301, 109305, - 109309, 109314, 109318, 109323, 109328, 109333, 109338, 109343, 109347, - 109352, 109357, 109362, 109366, 109371, 109376, 109381, 109385, 109390, - 109395, 109399, 109403, 109407, 109411, 109416, 109421, 109425, 109429, - 109434, 109438, 109443, 109448, 109453, 109458, 109463, 109469, 0, 0, - 109476, 109481, 109486, 109491, 109496, 109501, 109506, 109511, 109516, - 109521, 109526, 109531, 109536, 109541, 109546, 109551, 109556, 109561, - 109567, 109572, 109577, 109582, 109587, 109592, 109597, 109602, 109606, - 109611, 109616, 109621, 109626, 109631, 109636, 109641, 109646, 109651, - 109656, 109661, 109666, 109671, 109676, 109681, 109686, 109691, 109697, - 109702, 109707, 109712, 109717, 109722, 109727, 109732, 109738, 109743, - 109748, 109753, 109758, 109763, 109768, 109773, 109778, 109783, 109788, - 109793, 109798, 109803, 109808, 109813, 109818, 109823, 109828, 109833, - 109838, 109843, 109848, 109853, 109859, 109864, 109869, 109874, 109879, - 109884, 109889, 109894, 109898, 109903, 109908, 109913, 109918, 109923, - 109928, 109933, 109938, 109943, 109948, 109953, 109958, 109963, 109968, - 109973, 109978, 109983, 109989, 109994, 109999, 110004, 110009, 110014, - 110019, 110024, 110030, 110035, 110040, 110045, 110050, 110055, 110060, - 110066, 110072, 110078, 110084, 110090, 110096, 110102, 110108, 110114, - 110120, 110126, 110132, 110138, 110144, 110150, 110156, 110162, 110169, - 110175, 110181, 110187, 110193, 110199, 110205, 110211, 110216, 110222, - 110228, 110234, 110240, 110246, 110252, 110258, 110264, 110270, 110276, - 110282, 110288, 110294, 110300, 110306, 110312, 110318, 110325, 110331, - 110337, 110343, 110349, 110355, 110361, 110367, 110374, 110380, 110386, - 110392, 110398, 110404, 110410, 110416, 110422, 110428, 110434, 110440, - 110446, 110452, 110458, 110464, 110470, 110476, 110482, 110488, 110494, - 110500, 110506, 110512, 110519, 110525, 110531, 110537, 110543, 110549, - 110555, 110561, 110566, 110572, 110578, 110584, 110590, 110596, 110602, - 110608, 110614, 110620, 110626, 110632, 110638, 110644, 110650, 110656, - 110662, 110668, 110675, 110681, 110687, 110693, 110699, 110705, 110711, - 110717, 110724, 110730, 110736, 110742, 110748, 110754, 110760, 110767, - 110774, 110781, 110788, 110795, 110802, 110809, 110816, 110823, 110830, - 110837, 110844, 110851, 110858, 110865, 110872, 110879, 110887, 110894, - 110901, 110908, 110915, 110922, 110929, 110936, 110942, 110949, 110956, - 110963, 110970, 110977, 110984, 110991, 110998, 111005, 111012, 111019, - 111026, 111033, 111040, 111047, 111054, 111061, 111069, 111076, 111083, - 111090, 111097, 111104, 111111, 111118, 111126, 111133, 111140, 111147, - 111154, 111161, 111168, 111173, 0, 0, 111178, 111183, 111187, 111191, - 111195, 111199, 111203, 111207, 111211, 111215, 111219, 111224, 111228, - 111232, 111236, 111240, 111244, 111248, 111252, 111256, 111260, 111265, - 111269, 111273, 111277, 111281, 111285, 111289, 111293, 111297, 111301, - 111307, 111312, 111317, 111322, 111327, 111332, 111337, 111342, 111347, - 111352, 111357, 111361, 111365, 111369, 111373, 111377, 111381, 111385, - 111389, 111393, 111400, 111407, 111414, 111421, 111428, 111435, 111441, - 111448, 111455, 111462, 111470, 111478, 111486, 111494, 111502, 111510, - 111517, 111524, 111531, 111539, 111547, 111555, 111563, 111571, 111579, - 111586, 111593, 111600, 111608, 111616, 111624, 111632, 111640, 111648, - 111653, 111658, 111663, 111668, 111673, 111678, 111683, 111688, 111693, - 0, 0, 0, 0, 111698, 111703, 111707, 111711, 111715, 111719, 111723, - 111727, 111731, 111735, 111739, 111743, 111747, 111751, 111755, 111759, - 111763, 111767, 111771, 111775, 111779, 111783, 111787, 111791, 111795, - 111799, 111803, 111807, 111811, 111815, 111819, 111823, 111827, 111831, - 111835, 111839, 111843, 111847, 111851, 111855, 111859, 111863, 111867, - 111871, 111875, 111879, 111883, 111887, 111891, 111895, 111899, 111904, - 111908, 111912, 111916, 111920, 111924, 111928, 111932, 111936, 111940, - 111944, 111948, 111952, 111956, 111960, 111964, 111968, 111972, 111976, - 111980, 111984, 111988, 111992, 111996, 112000, 112004, 112008, 112012, - 112016, 112020, 112024, 112028, 112032, 112036, 112040, 112044, 112048, - 112052, 112056, 112060, 112064, 112068, 112072, 112076, 112080, 112084, - 112088, 112092, 112096, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112100, - 112107, 112112, 112116, 112120, 112124, 112129, 112134, 112139, 112144, - 112149, 0, 0, 0, 0, 0, 112154, 112159, 112165, 112171, 112177, 112182, - 112188, 112194, 112200, 112205, 112211, 112217, 112222, 112227, 112232, - 112237, 112243, 112249, 112254, 112259, 112265, 112270, 112276, 112282, - 112288, 112294, 112300, 112310, 112317, 112323, 112326, 0, 0, 112329, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112335, 0, 112340, 0, 0, 112346, 0, 0, 0, - 112351, 0, 0, 0, 112357, 112360, 112363, 112366, 112369, 0, 0, 0, 0, 0, - 0, 0, 0, 112372, 0, 0, 0, 0, 0, 0, 0, 112380, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112388, 0, 112396, - 112403, 0, 0, 112410, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112418, 112428, - 112433, 112437, 0, 0, 112442, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 112445, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112449, 112455, - 112461, 112467, 112471, 112477, 112483, 112489, 112495, 112501, 112507, - 112513, 112519, 112525, 112531, 112537, 112543, 112549, 112555, 112561, - 112567, 112573, 112579, 112585, 112591, 112597, 112603, 112609, 112615, - 112621, 112627, 112633, 112639, 112645, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 112651, 112662, 112673, 112684, 112695, 112706, 112717, 112728, - 112739, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 112750, 112754, 112758, 112762, 112766, - 112770, 112774, 112778, 112782, 112786, 112790, 112794, 112798, 112802, - 112806, 112810, 112814, 112818, 112822, 112826, 112830, 112834, 112838, - 112842, 112846, 112850, 112854, 112858, 112862, 112866, 112870, 112874, - 112878, 112882, 112886, 112890, 112894, 112898, 112902, 112906, 112910, - 112914, 112918, 112922, 112926, 112930, 112934, 112938, 112942, 112946, - 112950, 112954, 112958, 112962, 112966, 112970, 112974, 112978, 112982, - 112986, 112990, 112994, 112998, 113002, 113006, 113010, 113014, 113018, - 113022, 113026, 113030, 113034, 113038, 113042, 113046, 113050, 113054, - 113058, 113062, 113066, 113070, 113074, 113078, 113082, 113086, 113090, - 113094, 113098, 113102, 113106, 113110, 113114, 113118, 113122, 113126, - 113130, 113134, 113138, 113142, 113146, 113150, 113154, 113158, 113162, - 113166, 113170, 113174, 113178, 113182, 113186, 113190, 113194, 113198, - 113202, 113206, 113210, 113214, 113218, 113222, 113226, 113230, 113234, - 113238, 113242, 113246, 113250, 113254, 113258, 113262, 113266, 113270, - 113274, 113278, 113282, 113286, 113290, 113294, 113298, 113302, 113306, - 113310, 113314, 113318, 113322, 113326, 113330, 113334, 113338, 113342, - 113346, 113350, 113354, 113358, 113362, 113366, 113370, 113374, 113378, - 113382, 113386, 113390, 113394, 113398, 113402, 113406, 113410, 113414, - 113418, 113422, 113426, 113430, 113434, 113438, 113442, 113446, 113450, - 113454, 113458, 113462, 113466, 113470, 113474, 113478, 113482, 113486, - 113490, 113494, 113498, 113502, 113506, 113510, 113514, 113518, 113522, - 113526, 113530, 113534, 113538, 113542, 113546, 113550, 113554, 113558, - 113562, 113566, 113570, 113574, 113578, 113582, 113586, 113590, 113594, - 113598, 113602, 113606, 113610, 113614, 113618, 113622, 113626, 113630, - 113634, 113638, 113642, 113646, 113650, 113654, 113658, 113662, 113666, - 113670, 113674, 113678, 113682, 113686, 113690, 113694, 113698, 113702, - 113706, 113710, 113714, 113718, 113722, 113726, 113730, 113734, 113738, - 113742, 113746, 113750, 113754, 113758, 113762, 113766, 113770, 113774, - 113778, 113782, 113786, 113790, 113794, 113798, 113802, 113806, 113810, - 113814, 113818, 113822, 113826, 113830, 113834, 113838, 113842, 113846, - 113850, 113854, 113858, 113862, 113866, 113870, 113874, 113878, 113882, - 113886, 113890, 113894, 113898, 113902, 113906, 113910, 113914, 113918, - 113922, 113926, 113930, 113934, 113938, 113942, 113946, 113950, 113954, - 113958, 113962, 113966, 113970, 113974, 113978, 113982, 113986, 113990, - 113994, 113998, 114002, 114006, 114010, 114014, 114018, 114022, 114026, - 114030, 114034, 114038, 114042, 114046, 114050, 114054, 114058, 114062, - 114066, 114070, 114074, 114078, 114082, 114086, 114090, 114094, 114098, - 114102, 114106, 114110, 114114, 114118, 114122, 114126, 114130, 114134, - 114138, 114142, 114146, 114150, 114154, 114158, 114162, 114166, 114170, - 114174, 114178, 114182, 114186, 114190, 114194, 114198, 114202, 114206, - 114210, 114214, 114218, 114222, 114226, 114230, 114234, 114238, 114242, - 114246, 114250, 114254, 114258, 114262, 114266, 114270, 114274, 114278, - 114282, 114286, 114290, 114294, 114298, 114302, 114306, 114310, 114314, - 114318, 114322, 114326, 114330, 114334, 114338, 114342, 114346, 114350, - 114354, 114358, 114362, 114366, 114370, 114374, 114378, 114382, 114386, - 114390, 114394, 114398, 114402, 114406, 114410, 114414, 114418, 114422, - 114426, 114430, 114434, 114438, 114442, 114446, 114450, 114454, 114458, - 114462, 114466, 114470, 114474, 114478, 114482, 114486, 114490, 114494, - 114498, 114502, 114506, 114510, 114514, 114518, 114522, 114526, 114530, - 114534, 114538, 114542, 114546, 114550, 114554, 114558, 114562, 114566, - 114570, 114574, 114578, 114582, 114586, 114590, 114594, 114598, 114602, - 114606, 114610, 114614, 114618, 114622, 114626, 114630, 114634, 114638, - 114642, 114646, 114650, 114654, 114658, 114662, 114666, 114670, 114674, - 114678, 114682, 114686, 114690, 114694, 114698, 114702, 114706, 114710, - 114714, 114718, 114722, 114726, 114730, 114734, 114738, 114742, 114746, - 114750, 114754, 114758, 114762, 114766, 114770, 114774, 114778, 114782, - 114786, 114790, 114794, 114798, 114802, 114806, 114810, 114814, 114818, - 114822, 114826, 114830, 114834, 114838, 114842, 114846, 114850, 114854, - 114858, 114862, 114866, 114870, 114874, 114878, 114882, 114886, 114890, - 114894, 114898, 114902, 114906, 114910, 114914, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 114918, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 114922, 114925, 114929, 114933, 114936, 114940, 114944, 114947, - 114950, 114954, 114958, 114961, 114964, 114967, 114970, 114975, 114978, - 114982, 114985, 114988, 114991, 114994, 114997, 115000, 115003, 115006, - 115009, 115012, 115015, 115019, 115023, 115027, 115031, 115036, 115041, - 115047, 115053, 115059, 115064, 115070, 115076, 115082, 115087, 115093, - 115099, 115104, 115109, 115114, 115119, 115125, 115131, 115136, 115141, - 115147, 115152, 115158, 115164, 115170, 115176, 115182, 115186, 115191, - 115195, 115200, 115204, 115209, 115214, 115220, 115226, 115232, 115237, - 115243, 115249, 115255, 115260, 115266, 115272, 115277, 115282, 115287, - 115292, 115298, 115304, 115309, 115314, 115320, 115325, 115331, 115337, - 115343, 115349, 115355, 115360, 115364, 115369, 115372, 115376, 115379, - 115382, 115385, 115388, 115391, 115394, 115397, 115400, 115403, 115406, - 115409, 115412, 115415, 115418, 115421, 115424, 115427, 115430, 115433, - 115436, 115439, 115442, 115445, 115448, 115451, 115454, 115457, 115460, - 115463, 115466, 115469, 115472, 115475, 115478, 115481, 115484, 115487, - 115490, 115493, 115496, 115499, 115502, 115505, 115508, 115511, 115514, - 115517, 115520, 115523, 115526, 115529, 115532, 115535, 115538, 115541, - 115544, 115547, 115550, 115553, 115556, 115559, 115562, 115565, 115568, - 115571, 115574, 115577, 115580, 115583, 115586, 115589, 115592, 115595, - 115598, 115601, 115604, 115607, 115610, 115613, 115616, 115619, 115622, - 115625, 115628, 115631, 115634, 115637, 115640, 115643, 115646, 115649, - 115652, 115655, 115658, 115661, 115664, 115667, 115670, 115673, 115676, - 115679, 115682, 115685, 115688, 115691, 115694, 115697, 115700, 115703, - 115706, 115709, 115712, 115715, 115718, 115721, 115724, 115727, 115730, - 115733, 115736, 115739, 115742, 115745, 115748, 115751, 115754, 115757, - 115760, 115763, 115766, 115769, 115772, 115775, 115778, 115781, 115784, - 115787, 115790, 115793, 115796, 115799, 115802, 115805, 115808, 115811, - 115814, 115817, 115820, 115823, 115826, 115829, 115832, 115835, 115838, - 115841, 115844, 115847, 115850, 115853, 115856, 115859, 115862, 115865, - 115868, 115871, 115874, 115877, 115880, 115883, 115886, 115889, 115892, - 115895, 115898, 115901, 115904, 115907, 115910, 115913, 115916, 115919, - 115922, 115925, 115928, 115931, 115934, 115937, 115940, 115943, 115946, - 115949, 115952, 115955, 115958, 115961, 115964, 115967, 115970, 115973, - 115976, 115979, 115982, 115985, 115988, 115991, 115994, 115997, 116000, - 116003, 116006, 116009, 116012, 116015, 116018, 116021, 116024, 116027, - 116030, 116033, 116036, 116039, 116042, 116045, 116048, 116051, 116054, - 116057, 116060, 116063, 116066, 116069, 116072, 116075, 116078, 116081, - 116084, 116087, 116090, 116093, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, -}; - -/* name->code dictionary */ -static unsigned int code_hash[] = { - 74224, 4851, 0, 78156, 78499, 0, 7929, 0, 194682, 0, 78500, 66480, 0, - 42833, 74529, 12064, 0, 596, 0, 0, 13192, 8651, 0, 0, 120218, 12995, - 64865, 1373, 0, 0, 5816, 119067, 64810, 4231, 6825, 0, 4233, 4234, 4232, - 917836, 74415, 120210, 6384, 917840, 78108, 8851, 0, 0, 0, 41601, 8874, - 0, 7748, 0, 0, 0, 0, 41603, 9784, 0, 9188, 41600, 0, 120618, 0, 1457, - 3535, 0, 0, 0, 0, 65240, 11951, 0, 3404, 0, 0, 0, 1759, 0, 41076, 68383, - 120572, 119205, 66577, 0, 0, 65859, 0, 7404, 0, 0, 0, 0, 65908, 9834, - 3055, 9852, 0, 65288, 0, 11398, 0, 0, 119255, 0, 0, 603, 74398, 43548, 0, - 0, 917824, 3350, 120817, 64318, 917828, 127089, 3390, 74483, 43265, - 120599, 917830, 78573, 0, 1919, 3400, 0, 917813, 0, 917540, 66446, 64141, - 8562, 64139, 64138, 4043, 8712, 64134, 64133, 11297, 0, 0, 11966, 64128, - 0, 0, 0, 64132, 10867, 64130, 64129, 0, 43374, 9779, 2764, 66002, 10167, - 9471, 0, 66021, 0, 0, 5457, 5440, 8857, 0, 65282, 2843, 5355, 0, 0, 0, - 5194, 11657, 43984, 0, 0, 0, 0, 0, 127027, 10717, 64570, 5630, 74350, - 64143, 10682, 0, 10602, 800, 42499, 66186, 0, 0, 64930, 11631, 64146, - 64145, 64144, 762, 13172, 118859, 194661, 64468, 10906, 1353, 6960, 0, 0, - 5828, 8724, 917806, 8933, 1601, 42244, 858, 7080, 64109, 64108, 8090, 0, - 74401, 917811, 587, 0, 0, 0, 0, 0, 78214, 2750, 0, 556, 64158, 64157, 0, - 12213, 194678, 2760, 0, 0, 0, 0, 64156, 64155, 42496, 0, 64151, 64150, - 12679, 10053, 10421, 11093, 64153, 64152, 0, 0, 4839, 0, 0, 1874, 119016, - 0, 6577, 64125, 64124, 64123, 0, 0, 0, 7007, 7590, 65443, 9036, 0, 64122, - 74422, 66609, 0, 64117, 64116, 6287, 64114, 2725, 64120, 64119, 43981, - 42128, 0, 1177, 65601, 12322, 64106, 0, 127306, 64102, 7859, 1945, 64099, - 0, 10453, 64104, 7188, 7997, 0, 7389, 0, 8705, 64097, 64096, 9571, 528, - 917989, 44017, 11429, 0, 0, 0, 917990, 73841, 0, 0, 9056, 0, 6188, - 120019, 6155, 64068, 1823, 64066, 64065, 64072, 64071, 63, 7233, 120698, - 0, 41904, 6639, 64064, 0, 0, 0, 1176, 118959, 0, 8162, 0, 0, 0, 120519, - 66376, 66242, 11415, 4333, 9855, 64112, 64642, 0, 5388, 0, 0, 0, 7714, - 66222, 0, 7768, 0, 4199, 64708, 0, 0, 0, 8708, 9560, 64077, 64076, 8996, - 4992, 4471, 42622, 64079, 64078, 0, 0, 0, 0, 64615, 0, 0, 12075, 0, 0, - 5174, 0, 0, 127557, 3123, 0, 12685, 0, 8408, 64704, 0, 0, 9223, 0, 41616, - 0, 73797, 0, 1116, 0, 43049, 0, 43050, 8548, 120485, 0, 119061, 917999, - 0, 13115, 43675, 64091, 9322, 0, 120595, 64095, 64094, 8111, 66247, - 42332, 64089, 64088, 6199, 0, 0, 11434, 64083, 64082, 11329, 7737, 64087, - 64086, 64085, 64084, 0, 9927, 41335, 4118, 1797, 0, 41334, 0, 46, 43448, - 0, 298, 0, 0, 0, 42627, 0, 32, 6187, 119052, 11495, 11459, 3665, 0, - 42871, 0, 19923, 74335, 0, 0, 66239, 0, 64403, 4412, 7240, 0, 0, 0, - 65758, 12750, 4181, 8544, 0, 120199, 917897, 120198, 120203, 6181, 65014, - 0, 0, 0, 3639, 119588, 0, 0, 0, 10073, 120206, 0, 0, 68409, 42844, 7498, - 1098, 0, 0, 0, 0, 10207, 8789, 0, 0, 0, 0, 9234, 0, 6182, 0, 65058, 0, 0, - 0, 0, 5471, 9461, 5573, 118936, 5473, 44, 0, 66244, 118907, 0, 66238, - 12844, 0, 1622, 7767, 1900, 41339, 11458, 0, 0, 6581, 5576, 0, 64405, - 41337, 0, 41631, 8947, 68390, 0, 41694, 0, 0, 7908, 0, 10408, 6579, 0, - 64618, 0, 120147, 0, 6583, 7761, 127010, 120504, 194828, 0, 5058, 41010, - 9992, 0, 5057, 0, 0, 74538, 5054, 118951, 194971, 78606, 0, 1437, 41617, - 658, 3497, 0, 7486, 5061, 5060, 4235, 0, 0, 0, 12113, 4236, 4727, 0, 0, - 7693, 10749, 0, 7488, 5773, 978, 0, 0, 41619, 10239, 68611, 0, 66209, 0, - 0, 9748, 0, 127524, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9341, 119596, - 2379, 11325, 0, 64668, 67854, 8125, 120545, 6743, 119175, 917940, 2369, - 0, 0, 0, 119235, 74092, 73936, 7008, 43660, 0, 0, 0, 2367, 0, 0, 264, - 2375, 8060, 6194, 119858, 1844, 119084, 0, 12858, 0, 0, 6961, 0, 118839, - 0, 8800, 0, 42862, 4463, 65581, 6192, 194676, 42771, 0, 0, 725, 65042, - 118797, 120800, 0, 12892, 0, 0, 0, 0, 0, 0, 0, 120707, 0, 0, 5074, 5073, - 0, 8983, 0, 74493, 0, 5072, 0, 6198, 11614, 0, 196, 0, 0, 0, 4929, - 120342, 0, 0, 0, 0, 42847, 0, 0, 0, 4934, 0, 41323, 9758, 0, 120341, 0, - 42584, 0, 4329, 41321, 4979, 3048, 7752, 41320, 0, 74418, 12819, 0, 5071, - 0, 3642, 0, 5070, 10042, 118835, 3987, 5068, 0, 8909, 78650, 78649, 0, - 10636, 73981, 11806, 43167, 4531, 1245, 9105, 66463, 4921, 120219, 4926, - 65544, 73884, 194619, 0, 0, 64709, 0, 194620, 78880, 4922, 325, 992, - 119568, 4925, 0, 0, 9526, 4920, 0, 948, 0, 120208, 4930, 0, 0, 120275, - 4933, 0, 0, 118985, 4928, 0, 0, 74770, 120194, 0, 722, 0, 19908, 12637, - 0, 119855, 8753, 1509, 0, 5468, 9511, 0, 0, 1672, 6205, 10864, 74586, 0, - 0, 0, 0, 0, 73863, 0, 0, 41607, 120115, 1679, 120116, 120180, 120113, 0, - 7005, 41609, 9580, 0, 401, 0, 120109, 6968, 5761, 342, 8553, 0, 8143, - 127115, 11983, 127113, 624, 74508, 0, 119630, 5078, 74258, 12478, 0, - 5076, 0, 194609, 0, 120097, 685, 9025, 1524, 12618, 0, 5539, 0, 120095, - 120102, 120094, 120552, 0, 194611, 78752, 0, 12520, 8058, 9732, 0, 5080, - 64775, 5036, 5035, 120590, 42604, 0, 0, 8074, 275, 13291, 1907, 78838, - 4432, 127271, 5033, 127273, 127272, 4836, 3888, 73792, 10729, 64546, - 127262, 43704, 127264, 127251, 67588, 119000, 127252, 127255, 8858, 6409, - 127256, 120252, 0, 0, 0, 66321, 0, 12814, 127248, 3432, 10218, 0, 6094, - 7641, 42445, 0, 0, 42406, 1676, 74320, 194607, 0, 5030, 0, 0, 0, 0, 9622, - 0, 0, 6787, 0, 0, 0, 0, 10544, 12919, 0, 0, 0, 0, 0, 120789, 0, 947, - 119835, 194586, 194585, 10969, 119935, 7613, 119937, 119936, 4795, - 119930, 7018, 7376, 120181, 120192, 120268, 0, 43567, 74056, 917910, - 118963, 119919, 7216, 65232, 7217, 251, 7218, 7895, 4395, 43538, 119926, - 119929, 119928, 7213, 119922, 7214, 7215, 0, 74141, 8880, 7685, 66459, - 120173, 65540, 119618, 625, 8187, 42861, 1113, 7236, 7915, 3630, 120176, - 8179, 74264, 67886, 9316, 10980, 2489, 65624, 8150, 1359, 67652, 0, 0, - 73756, 5042, 5041, 42769, 12084, 0, 0, 0, 127319, 0, 917906, 0, 0, 12283, - 1616, 3795, 0, 8795, 66245, 0, 0, 0, 1138, 73905, 12677, 0, 0, 3239, 0, - 0, 0, 8431, 0, 42164, 0, 11778, 12620, 6826, 73773, 119073, 5040, 0, 0, - 0, 78420, 0, 5039, 0, 78418, 0, 5038, 0, 0, 13184, 74293, 0, 64648, 0, - 9359, 78416, 0, 0, 65157, 6662, 0, 0, 3863, 73909, 4835, 55266, 43432, 0, - 4309, 0, 194569, 0, 194568, 1301, 0, 42589, 569, 0, 73813, 711, 119085, - 0, 0, 73880, 11610, 11368, 0, 194571, 41331, 1006, 74240, 0, 1550, 8201, - 73737, 7627, 5499, 5031, 77908, 42738, 65784, 77907, 65267, 3758, 0, - 65781, 64734, 0, 2440, 65780, 77913, 8449, 0, 5008, 0, 8822, 0, 12121, - 8255, 5512, 73875, 119560, 0, 64313, 2641, 5906, 1119, 127068, 13038, 0, - 2455, 0, 118809, 0, 0, 0, 0, 8714, 0, 4211, 0, 0, 0, 0, 43713, 5052, - 66220, 5821, 6186, 65778, 65775, 5051, 65773, 1429, 42647, 5050, 302, - 388, 41115, 735, 6637, 5907, 120670, 0, 12726, 74594, 9117, 0, 195010, - 5513, 6666, 5053, 74230, 5510, 78451, 0, 78447, 2470, 78437, 0, 1925, 0, - 0, 74807, 0, 5048, 5047, 0, 0, 0, 194863, 0, 74497, 0, 8089, 6929, 639, - 0, 68179, 0, 0, 0, 4599, 41402, 6674, 43397, 43294, 1476, 648, 0, 65819, - 3233, 0, 41782, 6951, 0, 0, 3530, 9750, 0, 0, 6656, 194858, 0, 5046, - 8512, 65856, 74261, 8967, 0, 5045, 0, 1916, 7986, 5044, 120556, 9006, - 13128, 5043, 0, 7853, 74068, 74004, 9669, 12341, 12703, 8402, 0, 119070, - 0, 41750, 3586, 64508, 43148, 0, 0, 119606, 0, 13296, 517, 0, 0, 0, - 41528, 123, 65454, 0, 0, 74478, 10531, 7784, 41526, 10829, 73991, 8057, - 1126, 73895, 0, 194591, 0, 3925, 4251, 8069, 10517, 120439, 489, 0, 4250, - 120441, 120452, 43151, 0, 0, 66200, 0, 0, 0, 78423, 0, 0, 8711, 6183, 0, - 0, 0, 120448, 7623, 118925, 194853, 9235, 12760, 74176, 0, 66445, 43540, - 120437, 3743, 11514, 11078, 0, 12136, 0, 0, 120435, 0, 7726, 0, 19922, - 267, 3393, 42198, 1371, 194849, 69233, 2458, 0, 6201, 0, 41074, 4266, - 10652, 41612, 41077, 3402, 9050, 3398, 0, 0, 0, 3391, 41075, 2476, 0, - 917550, 0, 10625, 0, 12767, 13017, 78743, 64261, 64934, 127537, 13014, - 13013, 0, 6673, 0, 0, 0, 12438, 0, 0, 0, 0, 0, 9053, 13015, 74523, 0, - 704, 66215, 6195, 0, 6660, 78758, 917760, 917793, 42212, 12629, 11435, 0, - 55256, 65538, 0, 0, 0, 74547, 0, 65448, 78100, 12948, 119001, 195002, - 119238, 195004, 78099, 127085, 0, 0, 4287, 8276, 4902, 1131, 0, 78458, - 66728, 1816, 0, 42533, 168, 42845, 4898, 64298, 0, 0, 4901, 1821, 0, 578, - 3653, 0, 791, 9162, 6977, 0, 119298, 74561, 0, 73731, 8354, 43590, 0, 0, - 7557, 0, 119301, 8234, 7241, 0, 194994, 119167, 194996, 12811, 65925, - 3946, 78078, 10998, 78080, 673, 194867, 64397, 0, 74599, 78449, 8890, - 194977, 194976, 2448, 78085, 10267, 8424, 2452, 78083, 194864, 8729, - 78456, 0, 7845, 0, 78692, 4408, 4122, 6772, 11039, 8723, 194990, 194989, - 119302, 731, 119304, 119303, 2438, 64855, 119300, 119299, 1175, 0, 42135, - 373, 119172, 5396, 11457, 11521, 7723, 0, 0, 0, 41952, 0, 5273, 8248, - 5269, 6337, 5202, 2404, 5267, 42823, 11291, 19915, 5277, 12963, 0, 6189, - 4125, 1314, 12133, 0, 118873, 1271, 0, 0, 66024, 41482, 3864, 74539, 0, - 3879, 0, 12978, 4166, 4574, 0, 7567, 7459, 0, 41390, 5384, 41882, 67647, - 0, 5759, 0, 0, 41388, 0, 41392, 64288, 41387, 0, 8706, 5552, 0, 700, 0, - 5553, 0, 7088, 5356, 7499, 78110, 66596, 0, 0, 10263, 5554, 0, 12344, - 10311, 78113, 6665, 0, 0, 7618, 8517, 11455, 78440, 64632, 66017, 5555, - 78088, 78093, 78091, 0, 42803, 65033, 9143, 6668, 195067, 195066, 195069, - 656, 195071, 65037, 4577, 64624, 0, 0, 0, 0, 4269, 73885, 917775, 42846, - 917774, 950, 0, 0, 66580, 118895, 66683, 10554, 917778, 119121, 0, 5098, - 917770, 0, 119099, 5097, 4935, 9848, 10381, 0, 917560, 0, 3651, 0, 0, - 127556, 5102, 5101, 10269, 12983, 8138, 4517, 1932, 5100, 1439, 12093, - 1247, 10034, 195064, 5099, 78373, 1441, 42087, 3063, 650, 0, 7838, 0, - 195041, 195040, 119142, 9031, 120790, 195044, 9078, 8545, 66356, 195048, - 0, 9154, 9118, 0, 0, 2676, 7750, 0, 73812, 6190, 8599, 195053, 0, 10795, - 9857, 7014, 9856, 195033, 0, 12129, 0, 8481, 0, 6202, 195035, 10920, - 195037, 5203, 195039, 195038, 5108, 5107, 65818, 66019, 9762, 0, 5541, - 74772, 0, 12613, 5284, 6657, 207, 0, 4275, 74819, 854, 68147, 74381, 0, - 0, 5103, 0, 64348, 41368, 43974, 488, 69811, 0, 0, 10157, 0, 43034, - 11438, 0, 0, 0, 68431, 41771, 5106, 6669, 8504, 65154, 69813, 41367, - 5105, 195030, 69809, 6476, 5104, 0, 304, 3176, 0, 0, 932, 0, 6567, 238, - 74522, 195011, 194595, 19905, 120577, 195015, 120187, 41044, 67640, - 194902, 42055, 9912, 65939, 10670, 74093, 13273, 0, 12552, 195019, 8803, - 309, 6622, 8151, 10858, 194596, 67636, 0, 12568, 0, 12553, 0, 43275, - 6950, 9712, 68680, 43970, 0, 65165, 0, 0, 66466, 0, 0, 0, 66725, 6191, - 11351, 10437, 11316, 67634, 0, 0, 41754, 67635, 9370, 2720, 194975, - 68462, 8232, 118817, 0, 3222, 0, 0, 0, 66663, 0, 0, 10834, 0, 0, 65732, - 0, 917547, 119579, 67679, 195020, 0, 7781, 41383, 64568, 0, 120738, - 12077, 0, 64586, 917620, 42396, 55255, 3475, 0, 2479, 0, 3632, 120728, - 10698, 8376, 3648, 194960, 74844, 67639, 3636, 67894, 3650, 8837, 65229, - 1843, 42283, 43250, 41562, 9100, 74548, 0, 3640, 0, 42321, 7284, 194974, - 194973, 194950, 194949, 194952, 194951, 0, 194953, 42080, 2529, 0, 0, 0, - 42083, 120678, 68398, 194957, 67619, 66367, 194958, 9634, 0, 9988, 0, - 41068, 0, 0, 65264, 0, 0, 917923, 0, 785, 8236, 194942, 9027, 68160, - 67623, 64383, 0, 925, 0, 0, 41985, 41071, 9586, 0, 41984, 9217, 0, 0, 0, - 9186, 2067, 4016, 0, 0, 381, 0, 0, 42077, 0, 194946, 5184, 42078, 194947, - 10810, 0, 4585, 19943, 5860, 67633, 0, 0, 812, 3615, 0, 5178, 44000, - 120548, 78807, 5188, 74287, 67629, 3605, 10692, 1166, 64429, 42639, 924, - 0, 67631, 0, 0, 2442, 10703, 78789, 67632, 917924, 12771, 12736, 12753, - 0, 73933, 67626, 42401, 0, 0, 127373, 42288, 12751, 0, 8542, 13145, 0, - 2468, 66706, 41294, 3626, 3883, 64388, 42479, 0, 41117, 0, 0, 0, 0, - 67624, 0, 1290, 0, 65585, 2715, 806, 65208, 41884, 917883, 7027, 64731, - 0, 0, 0, 66325, 3465, 2405, 9240, 0, 12756, 65259, 0, 0, 12752, 5833, - 1432, 0, 41883, 73912, 9799, 0, 41886, 2480, 0, 2062, 127293, 6494, 5537, - 78656, 0, 194587, 0, 1211, 0, 0, 0, 118832, 12318, 0, 0, 0, 10622, 0, 0, - 0, 6566, 78659, 0, 73780, 0, 64864, 0, 78660, 0, 8284, 0, 0, 3589, 0, - 4035, 6492, 118981, 4265, 6642, 3977, 74186, 41778, 836, 119216, 2488, 0, - 4582, 0, 0, 41777, 12926, 0, 7528, 10550, 0, 0, 0, 0, 0, 1374, 64878, - 119014, 0, 42389, 41374, 0, 0, 78492, 41377, 0, 0, 400, 12597, 120586, 0, - 0, 6661, 0, 64827, 0, 73817, 390, 0, 74755, 0, 3473, 7718, 0, 0, 0, - 55285, 0, 0, 0, 11969, 0, 0, 6365, 1887, 6763, 0, 8080, 7006, 0, 0, 6757, - 0, 1544, 0, 6766, 64677, 120716, 0, 6146, 0, 771, 0, 0, 12812, 13168, - 42272, 12200, 917927, 7904, 0, 953, 12917, 0, 12300, 0, 11491, 9724, - 10341, 0, 9524, 7490, 11389, 7489, 3379, 0, 7487, 0, 471, 7484, 7482, - 6753, 7480, 7479, 7478, 7477, 6501, 7475, 6918, 7473, 7472, 2474, 7470, - 7468, 10232, 10615, 10213, 0, 120222, 10049, 78884, 3544, 0, 6017, 65311, - 0, 120216, 13306, 10533, 7870, 73949, 7625, 0, 120544, 0, 0, 0, 0, 0, 0, - 19961, 2472, 42665, 120699, 0, 6019, 4256, 120776, 74380, 0, 42675, - 42658, 12845, 0, 0, 65138, 119355, 67862, 0, 65671, 120000, 120008, 8066, - 7678, 74865, 0, 0, 0, 0, 7186, 0, 120555, 0, 445, 120566, 0, 0, 0, 8330, - 0, 0, 42797, 0, 120215, 0, 3902, 0, 1770, 0, 0, 1560, 120209, 194972, - 4584, 73843, 0, 11712, 10866, 118928, 1118, 0, 0, 0, 1081, 7436, 68420, - 7252, 0, 5996, 0, 4903, 0, 41386, 5162, 119189, 1330, 0, 42848, 0, 12047, - 41384, 0, 0, 1848, 4334, 6324, 41975, 64777, 10674, 12308, 12186, 0, 0, - 0, 12715, 0, 0, 0, 2018, 66672, 41979, 66685, 119157, 0, 0, 0, 126984, 0, - 9334, 0, 127310, 0, 7975, 0, 77957, 0, 66621, 4884, 66597, 0, 0, 0, 6313, - 65513, 0, 0, 0, 0, 2345, 43697, 463, 0, 0, 119607, 3117, 5460, 0, 0, 0, - 0, 42279, 194577, 0, 78415, 0, 0, 0, 13248, 0, 0, 0, 0, 0, 0, 5663, 0, 0, - 0, 0, 2482, 1471, 0, 0, 42247, 12378, 73925, 127233, 0, 12374, 0, 0, 0, - 0, 2460, 0, 11944, 12376, 0, 64679, 0, 12380, 10557, 64473, 5870, 0, - 2024, 0, 0, 0, 539, 0, 0, 0, 3853, 65180, 0, 120796, 120245, 0, 0, 8659, - 0, 12474, 0, 9503, 194969, 2478, 0, 4162, 0, 4260, 12953, 0, 120089, - 12470, 0, 74189, 2742, 12476, 11798, 10946, 0, 5000, 0, 0, 0, 0, 8213, - 74017, 7771, 6161, 0, 6709, 0, 78885, 0, 194892, 120582, 78547, 0, 10301, - 10333, 10397, 0, 0, 73791, 0, 0, 0, 0, 0, 4014, 12842, 73952, 12015, 0, - 8275, 3893, 0, 0, 127555, 7221, 42147, 0, 74550, 74465, 64747, 118841, 0, - 12516, 4444, 0, 119017, 74537, 10892, 8231, 0, 6473, 41968, 78388, 41973, - 3591, 41969, 0, 2453, 0, 0, 64705, 0, 0, 10349, 10413, 43591, 41962, - 3202, 74353, 0, 8316, 0, 0, 0, 687, 0, 0, 0, 1840, 0, 68671, 119809, - 4883, 285, 4723, 77927, 0, 4459, 74577, 0, 41720, 11089, 240, 19906, 0, - 42323, 0, 9743, 120232, 13134, 0, 0, 0, 0, 0, 42634, 0, 43437, 3081, - 11463, 120230, 0, 0, 10445, 0, 0, 66717, 2614, 9125, 119023, 1729, 0, - 120236, 65221, 63883, 43334, 64852, 0, 120235, 66201, 0, 66578, 5001, - 41879, 74427, 4121, 5003, 884, 66700, 63879, 4943, 5150, 73889, 74182, 0, - 643, 3086, 0, 42448, 42299, 58, 0, 0, 120083, 63873, 8491, 0, 0, 0, 4530, - 42409, 0, 194575, 2721, 120074, 119096, 19929, 0, 194574, 0, 4242, 4264, - 120077, 0, 66179, 42412, 65941, 13114, 64522, 10740, 3094, 0, 9754, - 119102, 4437, 73948, 0, 0, 55280, 42174, 194925, 42430, 0, 0, 42355, - 66026, 4306, 41380, 68432, 0, 0, 66667, 127309, 0, 0, 42200, 42566, 0, 0, - 5088, 6948, 0, 8524, 0, 0, 12385, 0, 0, 0, 1386, 64580, 11480, 6116, - 65039, 65038, 12392, 65036, 8064, 0, 12101, 5822, 119004, 2080, 710, - 77999, 11663, 1666, 42091, 119657, 12383, 43671, 42092, 68418, 4289, 0, - 63896, 12061, 42096, 43621, 3362, 12377, 0, 0, 68449, 7461, 73901, 1244, - 331, 73786, 12683, 10662, 0, 8112, 0, 65852, 0, 12379, 194877, 120818, - 41964, 42208, 63843, 2084, 41965, 0, 65866, 4327, 0, 63840, 78549, 41220, - 13032, 0, 584, 12933, 43177, 12373, 0, 13000, 1351, 0, 8698, 12665, 0, - 1930, 0, 78229, 12427, 66514, 0, 13031, 0, 63901, 0, 3657, 0, 65202, - 6000, 119206, 12426, 0, 0, 41740, 12428, 41283, 41916, 119210, 0, 0, - 12429, 6727, 0, 7562, 0, 5170, 0, 41755, 676, 0, 66704, 66664, 9978, - 66491, 3536, 0, 9752, 0, 6162, 0, 69228, 10113, 41829, 65886, 5159, - 12422, 41832, 439, 43077, 0, 42207, 74549, 11796, 40970, 41830, 0, - 917799, 8308, 917797, 917796, 0, 67864, 917801, 917800, 12336, 4135, - 69805, 341, 2727, 4129, 3539, 0, 63861, 0, 7913, 0, 63859, 4131, 63868, - 0, 63867, 4133, 11371, 210, 4600, 0, 74560, 4137, 8082, 78506, 119062, - 78504, 6704, 4591, 0, 0, 0, 9680, 0, 120623, 561, 12159, 195, 78508, - 41501, 0, 42031, 5719, 7172, 42687, 8368, 0, 41499, 0, 0, 42242, 41498, - 917794, 42025, 78567, 65805, 42463, 0, 2924, 0, 120510, 0, 0, 119213, - 73941, 0, 42330, 917784, 3969, 0, 0, 7169, 1992, 9652, 73977, 7246, - 42086, 917790, 917789, 0, 0, 0, 0, 0, 327, 0, 9042, 917777, 917776, - 65148, 12433, 917781, 127276, 917779, 12431, 8668, 12434, 0, 917782, - 5999, 0, 7712, 12432, 0, 43653, 1726, 1015, 0, 8212, 0, 0, 42423, 119066, - 0, 0, 66709, 0, 8811, 927, 0, 0, 12436, 0, 42021, 0, 0, 1299, 12240, - 42350, 65143, 0, 195016, 0, 78197, 11348, 0, 78037, 0, 0, 0, 19914, - 12179, 0, 9648, 194923, 63836, 63832, 917773, 10967, 63816, 2594, 3444, - 63817, 64651, 0, 41503, 0, 11265, 0, 0, 194922, 0, 5664, 3972, 0, 0, 0, - 917766, 12416, 917764, 119608, 10816, 917769, 917768, 12418, 74111, 3882, - 8532, 917771, 1573, 0, 119847, 4596, 66339, 12417, 66001, 65343, 194782, - 12414, 8287, 68219, 195017, 68108, 1143, 119169, 0, 12415, 6626, 42763, - 0, 118884, 9021, 120783, 0, 11724, 0, 0, 127104, 194794, 0, 0, 8027, - 10997, 9171, 12741, 11400, 74197, 194799, 0, 194798, 0, 0, 0, 127523, - 120190, 194773, 67608, 194772, 42368, 0, 7715, 3881, 41487, 12118, 42514, - 68651, 0, 0, 3009, 41476, 41489, 69825, 3007, 1448, 3018, 194809, 3889, - 8521, 5083, 5082, 119859, 120184, 8519, 0, 3014, 5081, 65853, 0, 0, - 120183, 78219, 5079, 64802, 42210, 4597, 65532, 78444, 120185, 12371, 0, - 8407, 0, 10805, 8518, 10779, 120188, 0, 0, 12367, 42170, 0, 0, 629, 1924, - 0, 12037, 74366, 5987, 8462, 8005, 12365, 63933, 127370, 120815, 12369, - 10649, 0, 5077, 127108, 10880, 63927, 5075, 0, 0, 65075, 0, 11007, 0, - 66659, 0, 0, 66684, 0, 3434, 4954, 1904, 0, 5266, 126980, 5272, 10499, - 4507, 9578, 63923, 120177, 7979, 0, 9831, 0, 194926, 461, 9803, 0, 4504, - 1505, 0, 6325, 5276, 43021, 0, 0, 55236, 0, 66461, 5177, 41324, 12055, - 8722, 0, 41327, 0, 66695, 4114, 409, 4383, 8900, 8948, 41325, 0, 721, - 10182, 9108, 0, 0, 119185, 42229, 194912, 0, 5998, 0, 42353, 74825, 0, - 12587, 0, 78571, 0, 0, 0, 41576, 42215, 78570, 119207, 0, 8578, 5995, - 7573, 41575, 74789, 74752, 63944, 63949, 64767, 2670, 4167, 0, 11723, 0, - 74120, 0, 65076, 938, 43414, 73854, 11737, 9721, 0, 0, 0, 11742, 0, 0, - 11493, 12334, 0, 4153, 12302, 10793, 5250, 12407, 11978, 4404, 9189, - 12401, 42007, 5775, 6759, 65806, 43997, 0, 42002, 12404, 0, 0, 4940, - 12410, 7683, 1167, 73729, 4983, 0, 861, 0, 0, 0, 0, 65577, 43370, 0, 0, - 11956, 0, 0, 0, 9616, 6631, 0, 12816, 74583, 42218, 12710, 68674, 12721, - 4101, 66185, 0, 5992, 7616, 0, 0, 12577, 0, 0, 853, 42693, 0, 0, 0, 5016, - 43535, 63893, 42835, 9491, 917913, 0, 917914, 0, 12712, 917919, 0, 65060, - 120797, 9900, 0, 0, 194919, 0, 0, 0, 64778, 12585, 10565, 0, 12177, 0, 0, - 0, 77824, 0, 4900, 0, 12878, 0, 8984, 4119, 74768, 8971, 78593, 43113, - 9702, 78594, 11025, 9245, 13048, 4927, 4138, 74185, 194921, 0, 12397, - 77827, 0, 13054, 12394, 0, 0, 0, 13053, 0, 3948, 10781, 1546, 0, 5010, - 1680, 10507, 78590, 78583, 0, 0, 0, 194915, 7267, 0, 74833, 0, 5993, - 2819, 0, 12706, 77840, 1893, 7266, 63915, 7264, 7265, 0, 1363, 0, 63997, - 63910, 63996, 3077, 0, 0, 1512, 0, 12589, 41479, 0, 0, 43339, 0, 9836, - 120727, 0, 41481, 43335, 7832, 42343, 3090, 43337, 817, 1664, 1850, 0, - 3079, 11340, 42408, 42447, 194704, 120020, 42307, 12386, 42304, 0, 0, - 12389, 0, 194694, 41996, 11526, 63985, 5864, 1147, 63992, 42887, 1987, 0, - 5480, 7858, 11653, 4116, 12391, 66193, 0, 4939, 12384, 0, 0, 41686, - 63905, 119601, 194688, 0, 0, 12649, 0, 0, 8247, 507, 91, 2042, 120775, - 43643, 194689, 66028, 10036, 41844, 119813, 774, 119831, 0, 119815, 5994, - 12539, 0, 78375, 120597, 119833, 0, 119600, 0, 0, 7719, 6026, 2486, 0, - 119808, 162, 0, 65219, 41073, 9687, 41681, 6304, 119812, 66196, 0, 5262, - 0, 55233, 12681, 42379, 0, 7534, 12219, 0, 127528, 42810, 10492, 0, 0, 0, - 43119, 0, 120753, 12403, 2500, 195013, 0, 4899, 0, 0, 0, 74113, 2343, - 4103, 19946, 74112, 77851, 13112, 0, 0, 12859, 0, 120148, 66369, 5861, 0, - 11999, 12400, 0, 0, 12645, 5146, 11320, 68410, 6748, 65040, 0, 64184, - 12974, 64183, 67613, 120645, 5147, 0, 0, 74524, 0, 1928, 0, 67649, 5991, - 3445, 67609, 4976, 64176, 0, 67610, 8241, 0, 77868, 4206, 0, 0, 0, 0, 0, - 10138, 0, 0, 8897, 0, 0, 8357, 4124, 77862, 65836, 120641, 0, 77859, 0, - 0, 1123, 963, 41553, 10120, 12405, 120150, 0, 398, 13278, 9723, 6366, - 120311, 7945, 0, 4402, 9970, 12402, 0, 42392, 1305, 12408, 0, 44007, 0, - 0, 41464, 12411, 12969, 120824, 41465, 0, 8528, 1575, 0, 63955, 165, - 3024, 41467, 119163, 0, 9093, 0, 9147, 0, 63958, 0, 9148, 9692, 4096, 53, - 73776, 6750, 195018, 0, 9594, 0, 0, 43527, 0, 727, 0, 0, 5805, 0, 6726, - 0, 42176, 12370, 11655, 119095, 10591, 12364, 0, 12372, 120642, 120307, - 0, 0, 0, 12366, 10963, 6066, 1329, 0, 3052, 9220, 0, 64478, 0, 10803, - 4132, 120306, 68474, 0, 0, 0, 74837, 0, 1499, 0, 8055, 42740, 63965, 0, - 63962, 74042, 8924, 43123, 5988, 3660, 63969, 11781, 42718, 8788, 1357, - 64851, 65743, 0, 8774, 0, 127086, 9941, 120172, 0, 1933, 120154, 9564, 0, - 0, 73866, 0, 0, 2487, 67614, 3121, 1804, 3311, 67615, 0, 78302, 12220, - 67616, 120598, 0, 0, 68200, 6675, 0, 0, 67592, 120685, 0, 64771, 1198, - 9132, 0, 64619, 510, 64663, 0, 0, 4561, 2101, 1398, 0, 0, 74034, 41569, - 0, 11406, 8167, 12127, 0, 840, 0, 0, 0, 6967, 0, 0, 9796, 0, 333, 0, 0, - 8144, 0, 0, 0, 12406, 0, 19931, 119089, 6678, 7769, 0, 12621, 0, 0, - 10227, 4764, 43101, 9981, 0, 40986, 4127, 66487, 0, 42202, 12754, 195022, - 0, 0, 0, 67594, 2048, 12944, 4050, 67595, 917967, 43102, 10581, 12985, - 4533, 195021, 74003, 6490, 0, 12038, 0, 0, 120704, 65461, 9798, 0, 0, - 1948, 119007, 0, 952, 0, 0, 0, 120802, 6449, 9494, 120313, 0, 43098, - 4843, 8142, 64160, 4098, 64170, 0, 0, 3436, 0, 0, 12817, 67597, 6676, - 3930, 66708, 0, 0, 67598, 0, 0, 0, 65591, 41581, 65916, 1453, 0, 0, 0, - 8500, 42222, 120142, 73743, 120400, 4317, 11543, 67676, 64676, 0, 0, - 67606, 119083, 0, 42217, 13102, 0, 66003, 6672, 0, 0, 0, 0, 63841, 9613, - 9001, 4526, 11274, 67601, 64520, 64210, 6664, 78704, 42056, 10228, 64957, - 11281, 0, 64213, 1469, 66640, 65381, 42197, 4988, 42372, 0, 9598, 904, - 352, 42225, 1451, 8061, 8453, 4134, 0, 74847, 66576, 0, 0, 10520, 8575, - 9960, 1201, 0, 12846, 0, 0, 11919, 64962, 0, 43739, 127281, 8511, 9460, - 823, 11587, 12305, 0, 64695, 0, 12387, 1253, 13183, 65766, 500, 42783, - 65765, 64208, 64369, 65760, 65761, 119585, 11606, 64784, 11702, 66498, - 9821, 0, 0, 5152, 11048, 7533, 68366, 64410, 0, 0, 4323, 120062, 0, 0, - 127052, 42587, 42214, 41394, 0, 4763, 4112, 118935, 0, 5260, 43143, 0, - 326, 120131, 68423, 0, 10771, 2876, 74074, 194835, 194924, 41398, 7382, - 9802, 127077, 127076, 453, 41396, 120524, 42720, 12140, 9572, 0, 7003, - 194883, 42334, 7704, 0, 0, 43144, 4123, 8494, 43146, 9977, 0, 0, 65759, - 10765, 64061, 4465, 9808, 64056, 65582, 4126, 0, 9521, 9589, 64755, 0, - 64020, 0, 10464, 0, 0, 194869, 64514, 11528, 64024, 0, 679, 64013, 0, - 5850, 758, 7536, 0, 0, 41441, 10693, 64006, 0, 64005, 10541, 119019, 0, - 64660, 0, 119050, 0, 0, 1139, 43298, 64027, 64029, 8970, 0, 64000, 0, - 10774, 0, 42201, 12421, 194876, 0, 1852, 3057, 0, 73744, 64034, 64039, 0, - 0, 0, 0, 0, 7645, 12854, 74338, 3496, 0, 0, 0, 9102, 627, 0, 6158, 8327, - 74553, 66632, 12419, 13309, 11570, 0, 19960, 11696, 0, 1018, 118970, - 194909, 0, 1682, 194896, 194911, 42756, 6765, 194906, 0, 0, 73814, 11412, - 6768, 10728, 194830, 119010, 118863, 43311, 64966, 11577, 0, 43040, 1833, - 11576, 0, 74779, 0, 185, 65085, 74533, 64754, 194848, 7535, 8085, 42525, - 120387, 9749, 41701, 6131, 1949, 4117, 7847, 120489, 194711, 64483, - 65693, 0, 0, 0, 0, 42240, 0, 0, 42864, 0, 64667, 41868, 1184, 0, 815, - 11484, 127535, 67840, 0, 0, 0, 0, 10986, 64683, 0, 0, 0, 0, 0, 9879, 0, - 0, 4158, 0, 68166, 0, 0, 0, 0, 0, 332, 118808, 0, 5142, 2407, 0, 42199, - 0, 0, 74373, 0, 55217, 0, 63870, 43163, 0, 0, 119081, 42867, 1834, 0, 0, - 69817, 10940, 65249, 119040, 8662, 0, 0, 2652, 120527, 11539, 10784, - 195093, 67674, 0, 0, 0, 0, 74562, 917505, 1828, 74474, 120327, 78620, - 8531, 12499, 6280, 12324, 118854, 65238, 68374, 4832, 65573, 0, 6279, - 12508, 12904, 12502, 9161, 0, 1620, 0, 3601, 195094, 0, 0, 609, 11555, 0, - 12496, 0, 74181, 4343, 12505, 0, 0, 0, 11377, 239, 0, 637, 0, 0, 42671, - 0, 0, 0, 43565, 127082, 0, 12696, 0, 0, 0, 12929, 0, 712, 0, 4197, 0, - 42818, 0, 0, 120490, 0, 0, 1506, 43562, 0, 0, 0, 12651, 0, 64628, 74517, - 12058, 74084, 917838, 7494, 0, 4924, 65592, 118844, 0, 127088, 355, 9719, - 127087, 13066, 64796, 0, 0, 12033, 42178, 0, 69760, 42571, 917837, 0, 0, - 0, 0, 0, 0, 3178, 0, 0, 0, 0, 9080, 127000, 120352, 0, 68209, 0, 11082, - 0, 5699, 195100, 66000, 9488, 65166, 119112, 0, 0, 0, 0, 0, 0, 5265, - 69235, 0, 11487, 67858, 12464, 0, 43045, 0, 0, 43345, 0, 10770, 118994, - 6807, 465, 9829, 0, 74348, 0, 43346, 8116, 795, 0, 0, 12462, 10930, - 10831, 0, 118952, 64362, 74334, 0, 120811, 0, 12468, 8607, 1008, 0, - 10092, 0, 917842, 67855, 55257, 73771, 1766, 11282, 11996, 1820, 4547, 0, - 0, 0, 0, 13223, 0, 64595, 0, 0, 0, 4345, 12616, 0, 0, 0, 74467, 0, 0, 0, - 5382, 0, 0, 0, 119060, 64953, 5406, 19920, 0, 66510, 3590, 0, 1130, 0, 0, - 42016, 11823, 43023, 0, 118896, 7742, 0, 13280, 0, 9326, 73826, 5310, - 74812, 0, 119962, 8959, 43589, 6747, 66723, 0, 8568, 0, 120496, 73816, - 120803, 0, 42670, 0, 11621, 12460, 0, 120631, 0, 43063, 74519, 0, 0, 0, - 0, 0, 11689, 5410, 5783, 10468, 8403, 5400, 11594, 0, 0, 118990, 10491, - 0, 64412, 0, 0, 5587, 42865, 64404, 8268, 4923, 65086, 8981, 12382, - 42133, 120755, 9706, 0, 0, 66610, 10461, 12103, 0, 8642, 0, 42766, 0, - 66566, 9983, 0, 119105, 0, 0, 0, 7398, 41515, 0, 11802, 8041, 1461, 910, - 119133, 0, 6749, 3658, 0, 120525, 0, 7617, 0, 12888, 0, 67668, 13143, 0, - 41514, 11097, 5703, 0, 41517, 41504, 41519, 10016, 64305, 0, 65864, 623, - 781, 670, 10660, 5769, 613, 7543, 120279, 477, 41083, 0, 0, 592, 1578, - 12459, 43449, 0, 0, 8225, 0, 654, 11345, 653, 652, 0, 647, 0, 633, - 120744, 0, 0, 12480, 43243, 0, 39, 12487, 0, 120529, 74199, 12482, 0, - 12489, 0, 3195, 5550, 0, 7897, 0, 1203, 74396, 1813, 64544, 41311, 12090, - 0, 2877, 0, 0, 1675, 0, 0, 0, 0, 10070, 10595, 0, 119077, 0, 0, 0, 0, 0, - 43244, 0, 0, 0, 119561, 0, 0, 0, 0, 0, 0, 0, 77860, 0, 0, 270, 0, 10714, - 0, 0, 0, 0, 0, 65372, 0, 74038, 119558, 6273, 66679, 364, 9595, 194908, - 0, 0, 707, 0, 0, 9282, 66489, 224, 0, 68670, 9332, 4966, 68677, 0, 68644, - 0, 3841, 68634, 0, 10732, 68640, 850, 4972, 0, 64699, 2909, 68619, 44008, - 68627, 0, 11544, 10203, 9608, 0, 0, 11962, 0, 12507, 1196, 0, 0, 777, 0, - 4375, 65271, 67678, 0, 12198, 0, 64824, 0, 0, 9454, 63778, 8658, 42528, - 0, 2705, 917975, 41520, 0, 0, 11986, 7765, 42502, 8280, 0, 2701, 0, 0, - 5767, 0, 0, 9809, 8353, 63747, 66701, 63772, 0, 63745, 1748, 63770, 0, 0, - 0, 65542, 63766, 55244, 3061, 0, 63764, 63787, 9067, 6096, 0, 7694, 0, - 7257, 63768, 3485, 12987, 0, 127522, 120628, 63807, 1591, 0, 6386, 63783, - 0, 0, 0, 0, 0, 0, 74575, 0, 65719, 13083, 64574, 65012, 0, 1640, 12495, - 66691, 7624, 3138, 10996, 0, 1922, 0, 12498, 10987, 0, 0, 3894, 65543, 0, - 194842, 0, 493, 0, 43197, 1717, 4228, 479, 10303, 74020, 0, 917935, - 10335, 3520, 917932, 12490, 64315, 0, 127039, 12493, 6233, 42681, 1002, - 12491, 0, 64911, 127040, 2096, 65120, 0, 0, 0, 11611, 66228, 127041, - 66213, 63864, 66221, 66226, 66229, 13218, 66231, 66216, 8507, 66236, - 66211, 66218, 0, 66240, 78041, 66233, 8928, 0, 7909, 66234, 11605, 63759, - 0, 66208, 73999, 63799, 63803, 244, 11542, 12898, 12494, 73761, 12492, - 12669, 0, 0, 74153, 0, 0, 120680, 4882, 13040, 0, 8612, 4885, 74053, 0, - 13042, 4880, 64662, 2429, 1360, 248, 0, 63797, 0, 42358, 0, 7292, 0, - 63756, 42786, 66693, 0, 1870, 78040, 470, 78038, 78035, 78036, 0, 78034, - 4579, 0, 0, 12511, 74453, 12514, 0, 74579, 7239, 7001, 8623, 0, 0, 0, - 7378, 12512, 11615, 6104, 0, 0, 659, 6098, 0, 12234, 127307, 127067, - 8311, 12510, 41803, 13039, 127072, 12513, 10202, 12471, 0, 8747, 0, 0, 0, - 2323, 0, 2319, 77917, 12477, 77916, 2311, 0, 4415, 237, 6281, 0, 0, 0, - 2309, 1312, 8173, 0, 12469, 0, 78505, 64335, 10609, 0, 0, 9397, 11524, - 9395, 9396, 9393, 9394, 9391, 9392, 9389, 6209, 9387, 9388, 4932, 9386, - 9383, 9384, 6740, 0, 65451, 8185, 0, 917832, 43024, 43336, 67659, 2313, - 0, 7948, 9236, 0, 0, 0, 10570, 43473, 6289, 10484, 0, 0, 11998, 12082, - 10924, 3147, 0, 120684, 12524, 0, 2310, 11818, 9381, 9382, 9379, 9380, - 9377, 9378, 9375, 9376, 1683, 9374, 0, 9372, 12444, 0, 0, 13016, 8210, 0, - 42029, 11079, 12331, 43451, 42032, 8744, 726, 0, 0, 4155, 0, 0, 42030, - 5007, 12522, 43088, 0, 4951, 0, 127240, 0, 9922, 43309, 0, 12525, 0, - 12016, 65770, 9548, 67665, 403, 78230, 12503, 0, 0, 11030, 0, 0, 65691, - 63998, 1819, 10496, 0, 0, 119920, 0, 0, 0, 12506, 0, 12231, 0, 12500, - 44023, 12509, 64393, 78830, 3389, 10589, 6608, 41047, 120321, 78395, - 78394, 74069, 77995, 78391, 3608, 8281, 120320, 1107, 0, 9076, 8862, 0, - 41052, 13084, 64766, 43217, 7803, 13222, 74165, 74782, 0, 8546, 11553, - 63995, 13177, 9043, 6303, 0, 498, 64471, 120324, 0, 12529, 8042, 0, 2344, - 12528, 8031, 2414, 0, 0, 3231, 0, 6422, 66512, 0, 12530, 2537, 78405, - 41429, 12658, 13036, 65772, 0, 78738, 41433, 4719, 469, 0, 4363, 3313, - 41428, 78407, 2023, 1772, 78224, 78225, 65706, 10051, 64812, 78220, 0, - 9920, 12215, 0, 4931, 1951, 12497, 119363, 9607, 0, 9663, 0, 119634, - 6503, 41110, 0, 1491, 0, 0, 0, 41061, 0, 0, 0, 65026, 41993, 41509, - 11045, 65028, 78602, 66476, 41108, 9738, 41995, 1075, 1958, 12535, 41992, - 41506, 0, 41687, 0, 120717, 0, 9940, 0, 7692, 0, 8008, 41131, 330, 8566, - 65083, 41133, 9816, 0, 12532, 78550, 78546, 3508, 127058, 43235, 0, - 127298, 69783, 78231, 6411, 12910, 78554, 66644, 13028, 6737, 12537, 0, - 0, 64136, 12536, 2350, 13029, 78233, 0, 0, 13030, 6702, 4527, 0, 12538, - 0, 0, 65599, 65717, 9966, 0, 4948, 12484, 4032, 0, 12623, 0, 6207, 0, - 6117, 65930, 8412, 0, 7438, 1296, 2325, 41511, 0, 10149, 74118, 0, 0, - 12481, 0, 12488, 0, 0, 41556, 64414, 118802, 2354, 0, 73766, 0, 6295, - 901, 41510, 7953, 0, 65032, 41513, 0, 11927, 66584, 78559, 78560, 78557, - 78558, 0, 78556, 848, 9868, 0, 6424, 78568, 119338, 78565, 74031, 78563, - 78564, 2352, 78572, 893, 64576, 11289, 1407, 0, 0, 13026, 6762, 78579, - 78580, 13023, 8903, 9777, 66715, 1871, 8099, 0, 0, 1343, 0, 0, 9325, - 6818, 6283, 11738, 0, 0, 0, 11741, 0, 0, 9216, 8263, 11279, 194752, 0, - 194754, 13021, 64494, 3136, 194758, 194757, 194760, 13022, 42737, 64588, - 0, 0, 74552, 10014, 0, 41260, 119340, 13020, 118993, 194764, 194767, - 74340, 0, 0, 64945, 8029, 0, 0, 0, 3335, 0, 0, 9776, 120526, 194748, - 5215, 42644, 3333, 1632, 194751, 64849, 3342, 78582, 5363, 12957, 78581, - 4156, 0, 0, 6421, 78591, 1611, 78589, 13018, 74257, 78588, 78584, 3337, - 4537, 67895, 11736, 0, 68608, 6482, 4214, 73790, 11945, 0, 13046, 8838, - 425, 4025, 10709, 78595, 2108, 2392, 13047, 0, 0, 6819, 13049, 6499, - 194739, 12424, 68614, 73944, 13050, 9924, 194745, 6507, 0, 0, 0, 3277, - 8929, 4947, 41055, 0, 194722, 194721, 194724, 13045, 64626, 66034, 7751, - 194727, 8371, 194729, 3997, 12806, 8768, 13044, 0, 12420, 4024, 194730, - 41054, 1078, 9757, 194734, 41057, 0, 0, 0, 0, 0, 0, 127109, 0, 41496, 0, - 9165, 1572, 11911, 0, 118842, 2346, 13270, 8958, 0, 9646, 3773, 43183, - 6401, 5831, 0, 0, 13043, 8056, 0, 65681, 208, 0, 0, 0, 0, 0, 10699, 6408, - 0, 7825, 5661, 0, 120630, 3603, 41109, 2398, 3548, 0, 0, 119933, 0, 3115, - 9918, 0, 11321, 0, 0, 0, 194726, 4876, 74286, 0, 0, 43468, 0, 41558, - 41471, 73950, 8158, 9944, 41472, 0, 13051, 78689, 3143, 194674, 6701, - 41559, 1896, 66256, 13052, 194680, 5665, 0, 119071, 7025, 63974, 0, - 74352, 74161, 4154, 9863, 43550, 12310, 5662, 42382, 194686, 73924, 1121, - 194665, 63959, 0, 9942, 13231, 0, 64752, 4732, 194666, 11596, 119931, - 65187, 1626, 63983, 10110, 64772, 42024, 6420, 42028, 0, 10509, 2795, - 4910, 194728, 69231, 64753, 6275, 917808, 118830, 63978, 11044, 3229, - 6423, 42774, 0, 0, 0, 12823, 2331, 917810, 42026, 6137, 0, 7524, 0, - 917809, 119343, 0, 8338, 0, 65043, 0, 822, 0, 9903, 64721, 42722, 194656, - 194659, 78655, 78661, 194660, 78662, 41265, 5311, 1795, 965, 118791, - 10587, 78055, 11278, 78632, 194640, 0, 12946, 194641, 120705, 194643, - 6294, 3144, 194648, 194647, 65019, 194649, 73990, 0, 0, 748, 41067, 2330, - 535, 3148, 12375, 194652, 194629, 10556, 2475, 12388, 4889, 8968, 67863, - 3593, 0, 0, 2342, 0, 194634, 65206, 4894, 194635, 4890, 194637, 917804, - 581, 4893, 0, 6571, 65545, 4888, 4157, 78048, 78049, 78046, 78047, 0, - 10119, 6415, 0, 0, 0, 0, 0, 11375, 64746, 2332, 78063, 412, 78061, 64932, - 42880, 43587, 0, 0, 0, 0, 65197, 78066, 12203, 78064, 78065, 8913, 65854, - 4875, 65811, 120381, 120389, 118888, 9344, 8826, 120386, 120395, 13104, - 74781, 11997, 120393, 78075, 0, 3134, 0, 65696, 0, 0, 66217, 0, 8334, - 119344, 0, 3449, 0, 0, 78414, 78413, 118950, 74011, 0, 0, 0, 0, 1908, - 120167, 4328, 10734, 127014, 0, 0, 7804, 78272, 10811, 6250, 11339, 4914, - 11367, 0, 78054, 4917, 74516, 74208, 64285, 4912, 5464, 0, 118893, 2361, - 7971, 78072, 78073, 55243, 78071, 0, 8086, 74317, 6707, 8319, 2312, - 40977, 10960, 40962, 8305, 12573, 0, 40980, 0, 13202, 0, 12582, 78282, 0, - 0, 42438, 55221, 6288, 78280, 0, 5653, 42400, 10891, 7698, 5658, 74045, - 0, 0, 0, 4913, 0, 0, 0, 42326, 0, 0, 0, 42478, 2327, 0, 12563, 42287, - 12705, 0, 0, 12588, 8821, 6153, 2867, 194708, 66312, 698, 194709, 194606, - 10356, 74075, 194713, 651, 12641, 0, 0, 0, 0, 41552, 65115, 78465, 78467, - 78463, 78464, 194695, 78461, 194697, 74356, 0, 4716, 43277, 0, 78474, - 12340, 120568, 0, 194700, 55264, 41211, 120676, 8703, 5462, 917629, 0, - 10101, 0, 0, 8479, 4151, 41933, 0, 0, 66254, 120821, 0, 0, 0, 0, 119194, - 74050, 0, 0, 0, 0, 0, 0, 12278, 0, 0, 0, 2700, 12576, 7842, 12899, 0, 0, - 2699, 0, 73845, 2985, 119222, 0, 917845, 12192, 119314, 0, 119312, 9827, - 119310, 119311, 119308, 119309, 119306, 11481, 41210, 119305, 0, 35, - 78481, 78482, 66694, 68479, 78477, 78478, 43596, 6090, 64257, 7812, - 10534, 0, 78485, 73848, 78483, 4272, 0, 40967, 40964, 917825, 12704, - 78487, 43306, 0, 64497, 12138, 7930, 0, 43303, 68216, 0, 917826, 5244, - 4189, 127098, 67596, 0, 4188, 1879, 0, 968, 0, 43743, 0, 8873, 0, 0, - 917827, 65555, 12574, 0, 0, 0, 74490, 127099, 43657, 0, 0, 0, 42682, - 12578, 12720, 0, 41227, 0, 12346, 127101, 64848, 0, 0, 7251, 0, 0, - 118850, 119141, 0, 66015, 0, 959, 8885, 12564, 66457, 78808, 9469, 9632, - 0, 74761, 64323, 0, 0, 0, 0, 310, 0, 41281, 10976, 0, 194768, 0, 74266, - 10054, 6497, 8574, 0, 9012, 19958, 74420, 65089, 13215, 65047, 65163, - 74044, 374, 43195, 816, 0, 0, 0, 41934, 7465, 0, 0, 0, 4715, 6101, 0, - 41936, 0, 4879, 0, 65446, 0, 307, 0, 9585, 5374, 0, 0, 0, 0, 0, 0, 0, - 65567, 120614, 1929, 0, 12142, 0, 12236, 41419, 194618, 194621, 12982, - 194623, 5378, 78791, 0, 41421, 0, 4462, 0, 0, 0, 821, 0, 2498, 5800, - 120157, 0, 1760, 0, 4469, 2324, 828, 3611, 78400, 757, 1185, 0, 78770, - 43597, 10628, 74808, 194572, 7999, 43971, 0, 0, 10634, 10942, 7713, 2348, - 0, 64374, 4380, 194608, 119044, 9982, 64324, 41240, 862, 65626, 78462, - 1810, 3673, 5137, 194617, 0, 7277, 65622, 0, 7566, 64688, 194593, 194592, - 78092, 74357, 194597, 4748, 194599, 194598, 194601, 42260, 5871, 119075, - 0, 74576, 44019, 0, 194602, 3967, 194604, 13137, 8775, 194605, 0, 2963, - 0, 8410, 4454, 723, 917600, 966, 4449, 0, 127060, 0, 7819, 2320, 194589, - 339, 4968, 194590, 120399, 8075, 55276, 0, 8047, 0, 78827, 12634, 41542, - 78780, 7466, 6705, 12174, 42610, 0, 74452, 0, 1584, 66645, 6045, 6729, - 120640, 65218, 78777, 0, 78062, 7537, 0, 11370, 0, 10330, 0, 10394, 0, - 194783, 0, 0, 9780, 0, 13092, 194576, 119605, 194578, 7074, 120396, - 194579, 194582, 11414, 194584, 2531, 13034, 0, 0, 0, 1259, 7517, 0, 0, - 194561, 40996, 13037, 7092, 641, 5219, 194567, 194566, 11064, 41129, 0, - 42850, 13035, 9075, 0, 5466, 194570, 0, 64098, 65793, 4535, 194573, 4271, - 78417, 0, 6769, 41410, 0, 64262, 6767, 41407, 0, 0, 6755, 118864, 9046, - 0, 0, 0, 0, 0, 0, 67675, 0, 0, 0, 64338, 2563, 13033, 247, 118915, 0, - 12338, 4651, 0, 11270, 0, 0, 11933, 0, 0, 41903, 43447, 11001, 0, 42255, - 0, 0, 0, 41905, 0, 0, 10775, 9793, 5009, 0, 42269, 64587, 0, 42535, - 69812, 64529, 41408, 42853, 3877, 120795, 42674, 8147, 43566, 119021, 0, - 10236, 65918, 0, 0, 0, 64506, 0, 118921, 4747, 0, 0, 43200, 5832, 0, 0, - 5141, 42600, 0, 43203, 0, 0, 43286, 0, 0, 0, 0, 41305, 78776, 74137, - 11303, 65547, 0, 7031, 859, 0, 0, 0, 6059, 126985, 55235, 0, 8535, 0, - 65196, 194787, 66032, 11488, 0, 120786, 42233, 127488, 9946, 63885, 0, - 11822, 0, 43189, 0, 0, 1788, 1579, 120482, 917817, 0, 0, 0, 9028, 119571, - 69234, 0, 0, 1285, 64882, 41242, 0, 0, 12640, 0, 7401, 0, 12625, 68198, - 0, 0, 3940, 41597, 55260, 3396, 12642, 8665, 0, 0, 12630, 1653, 917815, - 10153, 0, 6166, 120516, 120523, 0, 8815, 66673, 65046, 9285, 913, 42259, - 119317, 119318, 119315, 68454, 42485, 118837, 7878, 8211, 42293, 64377, - 0, 0, 0, 194673, 12032, 0, 9725, 0, 78431, 5263, 12818, 78430, 41939, - 10022, 65387, 78419, 42777, 10139, 980, 43698, 65386, 0, 0, 43701, 43198, - 7184, 120673, 194797, 917819, 10085, 119992, 0, 119993, 6634, 0, 0, - 119323, 8072, 119321, 43700, 0, 8872, 7783, 917992, 12398, 8237, 0, 0, - 12395, 0, 126977, 120565, 9914, 127011, 917854, 73975, 6367, 6351, 66688, - 0, 78107, 0, 64735, 41243, 0, 7808, 1829, 0, 41937, 4358, 43272, 6353, 0, - 0, 120422, 0, 1710, 0, 0, 65607, 0, 49, 6627, 0, 6258, 10683, 78672, - 9741, 78443, 5649, 78441, 43443, 64418, 1643, 65213, 8405, 3470, 0, - 13213, 42452, 78331, 0, 78445, 0, 1072, 78457, 78452, 78454, 6576, 41988, - 41132, 65675, 1080, 120002, 9886, 55225, 1101, 68404, 12309, 55227, 0, - 12632, 1086, 1869, 78685, 7680, 0, 65458, 120714, 12639, 3380, 8123, - 1091, 12638, 7977, 4501, 0, 0, 66309, 0, 0, 1494, 0, 0, 0, 11693, 0, - 10494, 119230, 65872, 12363, 11386, 0, 0, 0, 0, 64582, 0, 73794, 0, 8022, - 0, 0, 74106, 12413, 194829, 917994, 0, 917995, 5570, 1881, 7210, 0, 1012, - 66630, 0, 120709, 7208, 66442, 5569, 0, 42339, 0, 6063, 0, 0, 119594, - 6053, 65602, 0, 0, 64727, 9160, 194827, 0, 0, 0, 10503, 118810, 6055, - 3870, 4279, 8490, 120114, 4319, 64786, 8602, 120110, 11326, 0, 0, 0, - 120119, 78333, 120117, 120118, 120099, 120100, 65087, 5571, 3674, 9740, - 9121, 5568, 120107, 120108, 42085, 10107, 42159, 42870, 120101, 589, - 7050, 0, 43281, 10233, 41263, 66251, 65729, 66253, 0, 74099, 42645, 0, - 194815, 8583, 0, 5847, 6928, 0, 0, 0, 0, 0, 66592, 12204, 0, 19966, - 77856, 42561, 120626, 0, 0, 8120, 120701, 0, 0, 0, 41063, 0, 10664, 0, - 8369, 0, 4551, 0, 74759, 0, 0, 9673, 66334, 65580, 10478, 118960, 12517, - 557, 9457, 12034, 0, 6355, 12519, 41004, 0, 0, 74094, 0, 0, 77970, 0, 0, - 0, 12111, 3927, 0, 12515, 1474, 67893, 5492, 6923, 0, 10441, 73836, 0, - 43990, 5493, 0, 74319, 0, 66635, 12019, 0, 1618, 0, 120474, 9645, 10430, - 917959, 5853, 13063, 10363, 0, 12956, 0, 120729, 11314, 0, 12060, 0, - 78392, 12826, 6329, 0, 10514, 65517, 74395, 2707, 8309, 0, 127054, 78398, - 43570, 2697, 43420, 78396, 127057, 2695, 42171, 0, 0, 0, 67617, 118971, - 0, 2693, 12125, 12766, 0, 1164, 0, 0, 41918, 0, 0, 8687, 66009, 12178, - 7053, 0, 7469, 0, 5248, 12218, 120538, 6427, 42884, 41123, 0, 0, 42873, - 41126, 9991, 41128, 74371, 127031, 0, 9873, 0, 42877, 7994, 64762, 2053, - 42843, 6591, 9340, 0, 1589, 0, 296, 74438, 78852, 0, 67841, 74370, 0, - 8922, 0, 74600, 12700, 74836, 0, 12579, 0, 12575, 6416, 5656, 2891, - 13262, 65590, 5299, 0, 11473, 5449, 1252, 0, 78404, 41431, 74369, 65373, - 5295, 0, 74114, 1223, 1642, 174, 78399, 883, 4161, 12691, 42603, 41413, - 3212, 41459, 3211, 74810, 41425, 127029, 78412, 74450, 9728, 3846, 8070, - 6150, 6636, 4370, 0, 0, 74178, 74587, 74117, 0, 0, 0, 4986, 12189, 0, - 67648, 120499, 917553, 4257, 12104, 77942, 6220, 9004, 65561, 0, 77949, - 0, 68135, 917576, 77946, 0, 0, 0, 9890, 78561, 12971, 78453, 0, 73898, - 11979, 0, 118900, 917894, 0, 9635, 12600, 8871, 0, 0, 0, 6469, 74227, 0, - 65304, 4679, 10230, 64300, 64867, 3427, 4240, 0, 0, 0, 0, 917952, 0, 0, - 0, 7282, 78728, 65733, 4445, 0, 0, 3494, 74606, 6555, 0, 77976, 0, 0, - 78566, 0, 0, 65898, 0, 65312, 5447, 0, 12895, 65593, 4010, 0, 41106, 0, - 65804, 0, 41105, 0, 65820, 6232, 0, 0, 0, 43608, 119091, 0, 6538, 4335, - 78364, 3941, 41122, 11061, 78363, 64892, 9113, 1954, 12155, 0, 42878, - 11500, 0, 0, 74578, 0, 65832, 0, 0, 0, 77975, 0, 4586, 0, 350, 10951, 0, - 509, 0, 0, 0, 0, 0, 5133, 0, 0, 9500, 0, 12162, 64741, 0, 9354, 0, 0, 0, - 2496, 11516, 944, 118851, 3890, 12168, 1438, 0, 0, 0, 41947, 1220, - 120828, 0, 0, 0, 1571, 42630, 41949, 42805, 8270, 943, 564, 0, 312, - 41980, 0, 0, 78120, 8877, 269, 4429, 6272, 9617, 1460, 6954, 78657, - 41120, 65121, 10862, 6060, 41119, 41416, 74355, 4173, 0, 0, 0, 1906, - 917986, 11532, 74073, 0, 0, 1985, 6296, 9582, 917895, 64287, 0, 78115, - 11428, 1730, 2457, 0, 19918, 10469, 0, 0, 7703, 8840, 8035, 0, 0, 0, 0, - 6129, 0, 0, 0, 0, 7874, 8681, 0, 0, 13136, 0, 0, 74278, 63886, 118881, - 9605, 73892, 13220, 0, 120274, 5514, 0, 9228, 0, 0, 0, 5240, 9811, 10012, - 3096, 0, 0, 0, 66676, 65873, 0, 0, 0, 9501, 0, 1272, 64536, 65465, 64654, - 7467, 0, 1467, 10158, 10040, 0, 9519, 0, 917812, 0, 118899, 12193, 0, 0, - 0, 0, 0, 19935, 0, 0, 0, 0, 0, 0, 5275, 0, 0, 8637, 0, 0, 3789, 63880, - 11471, 43554, 65862, 11474, 66332, 66603, 0, 2426, 12042, 0, 0, 9537, - 3961, 12115, 0, 2605, 4500, 64561, 55224, 4981, 0, 0, 63876, 11667, - 42686, 77973, 42362, 64686, 4499, 41649, 7589, 0, 0, 3237, 0, 68215, 0, - 8541, 78298, 0, 41866, 0, 0, 0, 0, 0, 43555, 2823, 9559, 0, 41940, 8299, - 41945, 0, 41941, 3308, 7190, 64880, 8614, 65220, 41493, 0, 41699, 10762, - 0, 12999, 0, 0, 8106, 4128, 0, 0, 4494, 0, 4012, 10395, 0, 119567, 65447, - 0, 0, 11004, 695, 739, 696, 7611, 0, 42755, 74802, 9227, 7506, 7510, 0, - 691, 738, 7511, 7512, 7515, 3868, 688, 41847, 690, 2548, 737, 974, 8003, - 7406, 0, 0, 0, 3985, 0, 65860, 63921, 7051, 69777, 4682, 917805, 12809, - 6406, 4685, 0, 10879, 10347, 4680, 6341, 0, 3851, 8132, 74325, 0, 917907, - 0, 41958, 119176, 917908, 0, 0, 42657, 0, 7643, 42373, 11714, 67587, - 43568, 0, 11717, 7650, 10594, 64951, 7647, 7649, 0, 7646, 0, 78082, 9651, - 0, 3891, 0, 0, 2337, 1735, 74324, 67860, 5452, 0, 0, 43561, 0, 0, 74146, - 1860, 7495, 7580, 5812, 7497, 7584, 0, 0, 0, 120347, 7727, 0, 8498, - 69818, 8949, 3065, 42719, 0, 1569, 0, 12534, 12124, 7690, 0, 12533, 0, - 6418, 4543, 78086, 6969, 0, 74800, 0, 0, 11980, 0, 0, 63894, 120760, - 12282, 66192, 0, 74592, 8850, 74275, 9238, 10617, 917545, 0, 0, 0, 12791, - 0, 0, 0, 4447, 73732, 12793, 12900, 0, 10950, 0, 78087, 12790, 41400, - 119128, 0, 12792, 42232, 0, 1744, 12789, 10366, 12317, 41310, 0, 41399, - 0, 0, 55258, 0, 12690, 0, 0, 43672, 0, 41652, 2974, 9010, 11315, 0, 278, - 0, 41405, 119254, 0, 10077, 63853, 74557, 42586, 0, 0, 6002, 0, 43553, 0, - 67903, 0, 12787, 41308, 7934, 65306, 0, 0, 0, 8646, 0, 77829, 0, 0, 6413, - 6550, 0, 1940, 0, 43637, 220, 65193, 43551, 10678, 10044, 0, 0, 0, 68659, - 6403, 5707, 10393, 127532, 0, 66614, 0, 0, 0, 10297, 0, 3742, 0, 3959, 0, - 0, 0, 2467, 0, 6003, 63844, 6663, 8040, 0, 63845, 4182, 78171, 4676, - 120501, 0, 0, 2510, 0, 10208, 78168, 0, 11540, 43546, 6692, 0, 41060, 0, - 0, 9083, 0, 0, 78144, 1559, 63831, 9677, 120260, 0, 65256, 0, 74070, 0, - 0, 365, 12056, 43027, 120423, 41716, 0, 0, 120472, 5516, 2845, 7717, - 8036, 41717, 73827, 544, 12045, 6278, 0, 5515, 0, 0, 0, 65339, 43221, - 65194, 0, 5517, 0, 0, 74841, 67884, 0, 67890, 67885, 67880, 67881, 67882, - 67883, 0, 0, 67879, 0, 1902, 67887, 9638, 12976, 0, 12483, 12368, 41769, - 42726, 41765, 0, 6667, 67874, 7556, 67878, 74351, 11264, 989, 42677, - 67889, 0, 1311, 0, 4326, 11000, 63824, 13068, 10932, 0, 6917, 78155, 0, - 949, 78162, 0, 6148, 8605, 42253, 78177, 0, 0, 42715, 0, 0, 0, 63871, 0, - 41796, 1269, 6530, 0, 65057, 0, 5144, 12221, 42716, 0, 4431, 4331, 0, 0, - 41834, 5279, 0, 10336, 8312, 0, 42701, 0, 0, 78165, 66036, 0, 0, 6428, - 42270, 0, 0, 43059, 42666, 5256, 1067, 255, 12131, 0, 9493, 0, 41014, - 11793, 0, 0, 74394, 43460, 10653, 42723, 0, 119632, 0, 6560, 7016, 74274, - 0, 43556, 3929, 0, 6614, 2768, 0, 9746, 5135, 11811, 12796, 11953, 0, - 69761, 5139, 346, 74303, 6305, 12795, 4675, 5168, 78552, 0, 74315, 74361, - 8253, 8817, 1136, 0, 43563, 0, 0, 194750, 7392, 8230, 9365, 0, 0, 0, 0, - 0, 4041, 0, 2357, 43240, 12786, 229, 119885, 119884, 44004, 43552, - 119881, 12350, 65554, 119882, 119877, 119876, 12785, 63863, 119873, 7770, - 10712, 64853, 12686, 118916, 42375, 0, 127238, 66352, 10470, 0, 11059, - 10791, 917944, 450, 0, 0, 10432, 12097, 5450, 64691, 1233, 0, 44009, - 78284, 66338, 0, 0, 1839, 118799, 0, 10927, 1701, 0, 2388, 41749, 41761, - 5453, 8361, 119865, 41758, 5444, 41763, 64889, 119860, 119863, 78677, 0, - 0, 78174, 66432, 8801, 3053, 4340, 0, 0, 65812, 917831, 0, 41824, 0, - 194801, 194800, 194803, 42700, 194805, 194804, 194807, 78676, 120413, - 194808, 0, 0, 4493, 4336, 0, 2314, 43602, 78826, 119325, 194811, 42439, - 64638, 42327, 43528, 4489, 194791, 0, 194793, 1912, 42385, 10306, 10370, - 0, 0, 8867, 10250, 10258, 2712, 1635, 78821, 1410, 0, 0, 118878, 0, 0, - 9919, 0, 559, 0, 41825, 0, 78188, 4892, 74016, 194781, 6542, 41957, 0, - 5777, 0, 759, 65749, 2079, 65248, 12788, 64487, 64552, 0, 10223, 42062, - 0, 0, 0, 3668, 65754, 43560, 12226, 0, 65149, 2340, 41959, 194786, - 194785, 194788, 43618, 65747, 10937, 2962, 0, 2321, 3587, 65745, 0, 8921, - 9952, 0, 0, 42714, 9951, 43409, 194770, 2949, 66012, 194775, 194774, - 2958, 68359, 41820, 43038, 2395, 0, 9976, 120043, 194778, 120058, 68220, - 194779, 42809, 42807, 0, 120046, 10198, 4150, 64371, 8318, 41790, 0, - 41898, 2360, 41794, 917942, 0, 0, 0, 0, 2418, 0, 2411, 11336, 799, 63823, - 10276, 10308, 10372, 917541, 41772, 42813, 2317, 10260, 118980, 55284, 0, - 0, 10384, 0, 0, 0, 7753, 2351, 6655, 64489, 0, 0, 77872, 4443, 42779, - 230, 0, 0, 43549, 4855, 42150, 65739, 5441, 41896, 10288, 10320, 0, 855, - 7046, 6109, 65045, 63839, 78198, 2049, 10098, 0, 74145, 0, 10264, 10280, - 9184, 10376, 7013, 4467, 0, 0, 0, 41887, 0, 4862, 9735, 6537, 120591, 0, - 3914, 119604, 0, 9065, 12961, 0, 0, 0, 0, 289, 0, 4694, 11420, 4690, 0, - 120514, 917978, 4693, 0, 42724, 0, 4688, 120454, 0, 0, 119629, 8238, - 3110, 120162, 0, 120163, 6528, 127553, 43035, 120161, 218, 0, 1520, 0, - 4786, 0, 43225, 4602, 0, 78167, 10088, 6548, 0, 120156, 43978, 8988, - 8888, 0, 0, 0, 0, 10666, 0, 73902, 0, 0, 0, 9975, 0, 119902, 4689, 8932, - 0, 65560, 119209, 74441, 78810, 0, 0, 0, 0, 0, 0, 0, 0, 10065, 8207, 0, - 120539, 0, 0, 662, 0, 9244, 0, 0, 119261, 0, 0, 0, 0, 41929, 0, 0, 66674, - 41926, 120408, 120443, 10513, 64637, 194862, 0, 52, 13118, 6475, 0, 0, - 12095, 10225, 4812, 0, 0, 0, 74085, 0, 3978, 0, 917945, 0, 11582, 120761, - 12281, 0, 6544, 13241, 0, 69782, 0, 194860, 11765, 65258, 10369, 0, 1585, - 7192, 10249, 422, 1500, 2036, 986, 194859, 64394, 5781, 5599, 64294, - 2494, 120450, 4861, 74021, 64334, 78203, 0, 0, 0, 65102, 8961, 65842, - 10243, 10245, 0, 120410, 0, 120453, 64821, 9478, 2508, 0, 0, 202, 0, - 74131, 1242, 65514, 0, 63940, 0, 64533, 120129, 0, 67842, 11990, 0, - 63939, 43375, 65440, 2504, 0, 78671, 64829, 0, 6943, 917934, 5859, 0, - 2858, 0, 74294, 0, 69239, 0, 119027, 12992, 2753, 1936, 74491, 0, 2751, - 12662, 2763, 8953, 64701, 10731, 12922, 7052, 917839, 0, 0, 0, 63920, - 74128, 2856, 119910, 47, 119911, 126986, 65858, 0, 0, 0, 7899, 0, 8417, - 65903, 7072, 0, 0, 4033, 0, 43992, 0, 0, 212, 64600, 1903, 12320, 0, 0, - 0, 0, 8915, 2759, 945, 6689, 0, 0, 0, 0, 1291, 74828, 0, 0, 9531, 13155, - 8505, 68379, 12062, 0, 0, 65487, 0, 41837, 120611, 120432, 0, 0, 0, - 120433, 0, 63935, 73962, 120806, 64787, 43524, 0, 64426, 0, 0, 0, 0, - 65664, 6693, 9843, 0, 8674, 0, 0, 0, 0, 12624, 0, 1673, 4811, 0, 5986, - 9338, 3046, 74480, 5985, 917928, 119598, 9820, 0, 12187, 0, 0, 5984, 0, - 43308, 4393, 0, 0, 0, 0, 0, 74826, 64733, 0, 0, 3491, 0, 0, 0, 3514, - 65485, 0, 7492, 0, 74605, 119134, 7514, 0, 0, 194731, 7502, 7587, 68353, - 0, 0, 63925, 0, 7610, 219, 0, 0, 692, 43588, 74433, 41635, 43241, 9688, - 0, 9535, 0, 0, 0, 64530, 0, 64610, 11804, 0, 0, 7453, 0, 8013, 0, 0, 0, - 8895, 5253, 0, 5458, 0, 2866, 0, 0, 65111, 68433, 6700, 120484, 0, 0, 0, - 8962, 77960, 9641, 43694, 7059, 0, 0, 9604, 78700, 7441, 63826, 0, - 118941, 64392, 0, 0, 2844, 0, 41974, 0, 12139, 0, 0, 0, 3358, 65295, 0, - 3104, 0, 0, 194765, 0, 5308, 0, 290, 0, 0, 2862, 2792, 195088, 0, 0, - 3268, 66591, 0, 6552, 42367, 7035, 120558, 0, 0, 1814, 0, 10240, 0, - 74305, 0, 74528, 0, 0, 42646, 7606, 2591, 2837, 4341, 77956, 64482, 0, - 8163, 65270, 0, 0, 0, 9112, 74431, 863, 9490, 119898, 0, 43323, 120513, - 119897, 9071, 0, 0, 3654, 7789, 9637, 0, 2535, 65504, 7653, 40993, - 119899, 66587, 195098, 0, 0, 0, 11006, 12927, 7807, 8073, 0, 10629, 0, - 74088, 3056, 10823, 0, 127327, 8762, 10508, 74506, 73770, 43969, 43193, - 10737, 3463, 0, 0, 66633, 8695, 4815, 11322, 5811, 12345, 7049, 0, 5195, - 0, 0, 66639, 0, 0, 0, 0, 0, 120561, 1262, 0, 6561, 19939, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 119907, 64612, 11991, 0, 0, 0, 1502, 0, 0, 9107, 0, 5702, - 3655, 67661, 8430, 0, 74132, 120758, 0, 74057, 9603, 0, 5254, 120742, - 7724, 74388, 68375, 10796, 5129, 0, 0, 590, 7579, 5614, 5893, 194744, - 11720, 0, 11721, 0, 4798, 0, 119316, 66038, 4793, 67851, 11726, 0, 74204, - 68610, 0, 68626, 894, 300, 0, 12306, 66235, 8004, 0, 0, 2562, 0, 0, - 42503, 0, 11652, 0, 0, 119241, 0, 0, 5096, 5095, 2863, 3424, 0, 10454, - 42530, 5094, 119638, 0, 13156, 0, 10832, 5093, 0, 0, 0, 5092, 10708, - 11327, 0, 5091, 176, 0, 9153, 4104, 78599, 78601, 1215, 42712, 5744, - 12272, 9832, 11777, 0, 127371, 42881, 0, 8980, 118988, 67861, 8844, 7209, - 0, 0, 4278, 0, 0, 0, 0, 9074, 4348, 0, 65558, 65946, 8113, 7087, 5255, - 1786, 661, 0, 0, 0, 74423, 0, 586, 74414, 64359, 1267, 0, 65468, 0, - 65731, 0, 0, 3621, 120473, 66666, 64211, 0, 6562, 12928, 0, 1228, 65490, - 11383, 0, 0, 0, 1714, 74406, 0, 0, 0, 0, 66225, 0, 0, 42660, 11436, 2070, - 64, 120694, 0, 10291, 10323, 2826, 0, 0, 0, 42008, 9708, 42710, 0, 42011, - 41999, 0, 12206, 5839, 1702, 1240, 74065, 6286, 0, 0, 65833, 77848, 0, - 1765, 0, 0, 65588, 0, 0, 0, 8401, 0, 42014, 0, 7030, 0, 10479, 64959, - 2852, 0, 0, 0, 0, 195061, 917951, 6963, 0, 12667, 64540, 74786, 10147, - 12935, 0, 0, 0, 0, 0, 78757, 0, 0, 0, 0, 64947, 12467, 2864, 64719, 1148, - 10435, 11462, 41675, 0, 2765, 0, 0, 0, 120719, 0, 0, 66662, 0, 78133, - 9364, 194685, 74416, 0, 0, 77988, 263, 10449, 41288, 0, 41839, 78387, 0, - 77986, 0, 6931, 0, 64355, 7177, 120530, 0, 0, 0, 4262, 10285, 10722, - 42020, 0, 6806, 6992, 42019, 0, 41290, 0, 750, 0, 0, 10163, 63913, 74066, - 7032, 5954, 64931, 4314, 0, 198, 68453, 730, 0, 63907, 77993, 78891, - 13165, 10814, 74171, 42804, 678, 8240, 78015, 0, 41378, 11008, 6938, 0, - 0, 2097, 66246, 120560, 0, 0, 0, 3892, 68632, 0, 6712, 66045, 41470, - 64805, 0, 0, 0, 64801, 0, 497, 12100, 5953, 0, 7796, 0, 43254, 73831, 0, - 10293, 5952, 1281, 0, 0, 0, 10677, 604, 41097, 9182, 1859, 0, 0, 3425, 0, - 0, 2836, 0, 0, 9707, 0, 43202, 0, 0, 65199, 1738, 917818, 0, 2832, 0, - 9670, 12937, 0, 66374, 0, 0, 2822, 0, 4436, 0, 0, 73752, 0, 64872, 0, - 1331, 0, 0, 0, 12708, 0, 5090, 5089, 0, 0, 119109, 0, 0, 319, 118931, - 43479, 9477, 0, 0, 5087, 0, 7640, 96, 5086, 0, 0, 0, 5085, 64286, 0, 0, - 41422, 0, 119901, 42356, 3772, 0, 0, 5011, 0, 0, 0, 0, 0, 127241, 6677, - 7601, 0, 591, 64419, 118953, 0, 0, 118923, 73734, 0, 10939, 6106, 6933, - 41271, 6760, 119903, 4534, 41270, 917962, 0, 65574, 0, 9224, 0, 3671, - 8976, 0, 0, 41275, 6372, 0, 55261, 7963, 6371, 0, 568, 0, 41273, 0, 0, - 6728, 0, 9715, 0, 8258, 11753, 74820, 0, 9602, 118919, 42, 0, 43688, 0, - 0, 7458, 0, 0, 65385, 119900, 0, 11958, 0, 917822, 0, 6254, 42721, 66336, - 8045, 11550, 0, 0, 0, 42858, 11789, 65868, 5557, 917946, 9737, 13109, 0, - 9467, 5558, 8878, 0, 195036, 7451, 6706, 10146, 0, 9086, 64566, 0, 64584, - 7437, 7454, 12594, 0, 68362, 4546, 7731, 0, 119909, 74243, 0, 3805, 0, - 194565, 44001, 41008, 0, 6307, 19949, 0, 7544, 0, 43469, 0, 0, 10152, - 64422, 65091, 119113, 7602, 64729, 0, 43521, 0, 42302, 43711, 43523, - 41447, 5559, 0, 8704, 2397, 5556, 0, 0, 0, 9011, 9630, 0, 0, 0, 5506, 0, - 1911, 66652, 0, 9961, 8845, 66698, 0, 10792, 8889, 0, 2098, 0, 64751, 0, - 66622, 0, 0, 74364, 0, 0, 0, 74365, 7552, 0, 0, 65384, 7223, 4559, 0, - 1956, 43138, 7024, 65728, 64501, 1210, 195077, 65175, 10184, 43140, - 43654, 0, 0, 0, 38, 8533, 66669, 119124, 0, 0, 0, 4357, 0, 0, 0, 74233, - 9967, 119852, 42860, 119838, 10941, 65721, 6962, 0, 0, 119324, 0, 11014, - 0, 8942, 12000, 69224, 0, 0, 11974, 0, 42772, 127518, 11650, 5013, 0, 0, - 66210, 118914, 6613, 0, 0, 0, 0, 0, 64714, 0, 0, 0, 12120, 43476, 0, - 11024, 74811, 0, 10563, 0, 0, 43522, 2462, 0, 1837, 0, 63972, 6957, 0, - 120559, 4952, 65718, 65827, 5504, 65720, 65714, 65715, 65716, 0, 127005, - 127119, 3109, 63975, 74028, 0, 8107, 119234, 1127, 455, 0, 63968, 0, - 3483, 119593, 1989, 0, 0, 9104, 3503, 65375, 0, 6694, 42633, 1864, 0, - 74306, 41446, 2540, 7736, 0, 74064, 0, 10521, 0, 42173, 9705, 74124, - 8604, 6955, 10916, 43684, 6149, 3887, 19956, 1411, 2824, 0, 10106, 0, - 1403, 0, 1347, 9631, 74444, 0, 0, 0, 0, 8640, 0, 258, 1654, 0, 0, 0, - 43314, 0, 0, 4042, 11478, 2873, 63977, 11522, 41668, 8549, 10861, 0, - 63976, 0, 68623, 0, 74585, 41391, 0, 917903, 376, 6987, 9221, 0, 0, 8823, - 0, 12943, 65185, 41869, 12619, 0, 10154, 0, 74439, 2039, 0, 7446, 1684, - 63979, 10974, 458, 120620, 0, 69791, 0, 11916, 65016, 0, 78067, 42115, 0, - 12288, 78057, 0, 1493, 42111, 7553, 4097, 0, 13080, 0, 65808, 6610, 6030, - 8059, 7508, 13131, 0, 0, 0, 8794, 41278, 41629, 12154, 0, 41277, 64658, - 0, 64380, 6625, 74354, 19904, 0, 0, 0, 65371, 7078, 0, 833, 0, 6369, 0, - 10979, 41953, 0, 41434, 6062, 0, 0, 19916, 6913, 933, 1341, 9842, 6720, - 65744, 0, 0, 195076, 0, 7405, 10105, 65810, 0, 41632, 7493, 0, 0, 41622, - 0, 0, 119556, 74584, 7632, 9716, 19954, 9805, 5990, 900, 0, 63957, 0, 0, - 3612, 0, 64376, 0, 5389, 0, 0, 65938, 2839, 9621, 582, 0, 74368, 3749, - 6949, 7569, 74061, 0, 0, 6956, 4403, 19962, 65559, 3299, 0, 0, 119127, - 9002, 0, 74372, 74236, 8478, 7598, 546, 42469, 65569, 1918, 9542, 472, - 7716, 10319, 10383, 6996, 0, 63952, 8425, 3602, 8328, 11764, 118894, 0, - 69796, 41183, 12907, 10271, 10287, 684, 43525, 0, 2854, 119586, 4592, - 65755, 0, 0, 11963, 43620, 0, 78889, 0, 0, 0, 9881, 43115, 65757, 3415, - 0, 0, 8648, 0, 6741, 43047, 0, 13180, 0, 418, 0, 0, 10295, 10327, 10391, - 41752, 74339, 8641, 41449, 0, 74100, 0, 10911, 6942, 0, 1024, 42849, - 41751, 69776, 8941, 0, 4554, 0, 9023, 11685, 0, 9928, 78617, 0, 11437, - 43741, 0, 120700, 63967, 0, 41206, 120724, 9049, 41185, 43166, 0, 11680, - 0, 11686, 0, 65224, 4565, 4655, 119553, 0, 0, 64523, 10343, 10407, 0, - 66671, 11466, 0, 0, 42890, 0, 12050, 68201, 2860, 0, 0, 0, 42792, 5743, - 10424, 12065, 42872, 0, 0, 0, 8875, 0, 0, 917991, 7531, 12847, 2413, 0, - 78635, 962, 0, 12855, 41196, 42564, 0, 1582, 0, 5508, 0, 0, 0, 10801, 0, - 118798, 0, 7173, 496, 10439, 4313, 64607, 119557, 7860, 0, 906, 42793, - 2842, 6405, 64722, 13132, 798, 64694, 12801, 8406, 1153, 0, 64788, 0, - 8054, 9174, 194749, 917976, 9964, 0, 41611, 4642, 66574, 11556, 0, 0, - 78857, 42089, 78855, 9008, 0, 0, 195096, 42079, 917981, 77924, 42513, 0, - 42842, 73985, 65285, 118974, 127003, 0, 0, 0, 0, 11335, 64069, 42093, - 3920, 0, 0, 0, 0, 4580, 41967, 0, 64384, 0, 119158, 3021, 42004, 0, 0, - 42317, 41998, 0, 6946, 0, 0, 0, 0, 65204, 0, 68113, 42690, 9880, 42010, - 74824, 64589, 10111, 64875, 0, 68399, 43998, 11360, 0, 0, 0, 0, 42149, 0, - 0, 0, 64941, 77919, 0, 0, 0, 55247, 4110, 66005, 6959, 10929, 119110, 0, - 66703, 77921, 8617, 41982, 6025, 69242, 0, 0, 0, 0, 9597, 42099, 43172, - 0, 10117, 0, 0, 41636, 0, 0, 120681, 8301, 0, 0, 187, 0, 65669, 0, 4963, - 0, 127517, 0, 8964, 65676, 65785, 0, 41948, 0, 0, 0, 41942, 65449, 3160, - 10081, 13226, 42121, 42475, 42663, 0, 41766, 0, 65882, 78849, 41760, - 1189, 905, 480, 10985, 41733, 67859, 9629, 6742, 1745, 43625, 73835, - 7888, 0, 0, 0, 42656, 41507, 8806, 7023, 0, 74279, 9447, 78651, 7867, - 69218, 6236, 0, 0, 10505, 0, 12851, 118948, 348, 5474, 0, 3103, 0, 41753, - 0, 0, 0, 78844, 78845, 41739, 78843, 42515, 10931, 41756, 43347, 42560, - 5391, 41746, 119147, 0, 41259, 5561, 74360, 2691, 0, 65553, 7933, 5562, - 69800, 917851, 41262, 0, 64421, 74846, 41251, 0, 0, 3979, 0, 0, 74813, 0, - 0, 0, 0, 118847, 41266, 0, 0, 917630, 10585, 65741, 41737, 9574, 2666, 0, - 41738, 831, 419, 13126, 10716, 0, 42822, 0, 6434, 0, 6939, 7766, 6432, 0, - 0, 916, 769, 41742, 11968, 74805, 6433, 5563, 547, 1943, 6439, 5560, - 4994, 487, 0, 4497, 3754, 127056, 120424, 9039, 0, 41776, 0, 8716, 1595, - 41615, 0, 0, 74260, 0, 43267, 43219, 0, 0, 12185, 0, 0, 68355, 68357, 0, - 42856, 8634, 0, 0, 4209, 120702, 0, 65879, 41538, 65612, 0, 669, 5679, 0, - 69786, 118961, 0, 0, 5678, 11821, 0, 6711, 460, 0, 0, 0, 0, 120747, 0, 0, - 78050, 119022, 0, 0, 0, 7782, 9044, 4974, 11760, 78494, 7577, 65711, - 41912, 1216, 0, 0, 5792, 0, 0, 78501, 0, 42264, 12244, 0, 5683, 0, 0, - 78119, 1549, 0, 0, 120398, 5682, 6206, 8670, 10256, 5680, 917568, 10001, - 0, 69768, 1449, 10241, 78290, 0, 0, 10552, 64342, 41922, 0, 8584, 0, - 5567, 2717, 0, 0, 5564, 42886, 41908, 42882, 5565, 0, 0, 0, 65708, 65709, - 5566, 69803, 65704, 65705, 11904, 42875, 43373, 42539, 5942, 8468, 0, - 10361, 10425, 65697, 65698, 65699, 0, 66598, 0, 64664, 10647, 78702, - 78703, 78690, 457, 78502, 65701, 1934, 43006, 0, 8802, 78710, 65130, - 78706, 78709, 6087, 78705, 78716, 41757, 78711, 8043, 8950, 65694, 64485, - 43534, 10457, 0, 11961, 78725, 78722, 78723, 78720, 78721, 0, 65515, - 9499, 10035, 13069, 0, 0, 9889, 68184, 42806, 0, 7256, 0, 0, 1667, 42161, - 0, 42428, 0, 6934, 0, 10802, 64861, 6556, 78390, 0, 8101, 3610, 0, 41748, - 4995, 955, 65907, 119208, 5350, 64339, 78306, 64549, 10875, 917956, 5477, - 65692, 0, 0, 120397, 12896, 10456, 917954, 0, 3874, 0, 0, 0, 0, 0, 0, - 65603, 0, 65687, 0, 41038, 74009, 119570, 42239, 8536, 78740, 0, 78726, - 74432, 724, 0, 1455, 78749, 7183, 64583, 78747, 68443, 4175, 78741, - 43614, 69801, 939, 0, 43520, 68613, 74569, 917958, 0, 78763, 78764, - 78760, 10788, 6088, 78759, 78755, 190, 0, 12593, 0, 8188, 64408, 0, 4417, - 0, 0, 6370, 0, 7827, 68441, 6965, 0, 0, 13201, 0, 0, 0, 74382, 73781, - 7918, 73988, 0, 0, 917884, 1728, 0, 120710, 178, 12972, 0, 0, 0, 120671, - 0, 0, 78327, 120405, 65690, 0, 0, 119054, 0, 9252, 917889, 4652, 68371, - 0, 0, 0, 13065, 9923, 10806, 0, 11763, 0, 120688, 6723, 78187, 0, 6993, - 0, 0, 8333, 0, 0, 11390, 0, 74464, 0, 0, 74080, 0, 0, 11910, 0, 8278, - 8963, 4034, 0, 0, 65344, 120517, 41747, 0, 0, 8677, 0, 12707, 9350, - 66037, 0, 8836, 12315, 12747, 8300, 0, 0, 7491, 8856, 0, 0, 43150, 0, - 120404, 65389, 120402, 120403, 10813, 2592, 12853, 43269, 7263, 120244, - 6536, 120238, 120239, 65516, 12321, 120391, 120388, 55287, 10007, 120246, - 9588, 120248, 1596, 120383, 41994, 65801, 0, 0, 66572, 0, 0, 10613, 6697, - 12805, 41928, 40981, 78403, 78409, 5006, 64328, 0, 9931, 0, 8825, 74555, - 65940, 43259, 0, 6107, 0, 119177, 0, 78401, 0, 11783, 335, 120227, 64689, - 438, 4510, 5765, 8721, 120233, 119227, 6092, 12840, 43112, 8876, 120231, - 8096, 10284, 0, 0, 0, 10380, 8733, 0, 0, 41602, 0, 0, 74831, 917901, 0, - 73747, 65399, 0, 64591, 42405, 0, 120820, 843, 11541, 0, 917898, 2065, - 41935, 74496, 41902, 0, 0, 215, 41258, 77875, 43159, 1953, 9579, 41938, - 1256, 3910, 9407, 6242, 0, 0, 41257, 41900, 8675, 10700, 8805, 1742, 0, - 9333, 8202, 0, 0, 0, 0, 0, 73882, 499, 0, 43467, 0, 55290, 0, 1712, 5932, - 77845, 41762, 0, 0, 11967, 1775, 0, 0, 0, 0, 0, 9458, 0, 6470, 9180, - 120380, 43176, 0, 0, 42782, 0, 0, 0, 917912, 74777, 120669, 9414, 120382, - 73782, 73969, 565, 42484, 5794, 201, 2662, 42292, 0, 8254, 0, 10975, 0, - 120625, 74763, 1022, 4108, 3880, 74247, 0, 0, 194964, 917980, 7507, 0, - 43149, 0, 65031, 7961, 1636, 0, 65029, 65024, 0, 12473, 6534, 0, 99, 98, - 97, 120571, 67584, 4049, 74163, 127065, 7090, 0, 7892, 917969, 10777, 0, - 65310, 65562, 66599, 66722, 0, 8039, 3363, 66594, 43434, 0, 0, 12596, - 66595, 42258, 42570, 5593, 119148, 120711, 0, 10100, 6061, 64854, 119, - 118, 117, 116, 12998, 122, 121, 120, 111, 110, 109, 108, 115, 114, 113, - 112, 103, 102, 101, 100, 107, 106, 105, 104, 6436, 73974, 534, 41212, - 77931, 1536, 64093, 73970, 77930, 0, 0, 6020, 12716, 127112, 12744, 475, - 120394, 13266, 0, 127111, 0, 73926, 0, 10645, 1212, 6543, 0, 8134, 0, - 2913, 73870, 0, 1866, 0, 195095, 0, 8923, 1645, 12059, 66585, 78786, - 3196, 0, 0, 5935, 1250, 127066, 8174, 9787, 6733, 9859, 7916, 9861, 9860, - 5258, 1882, 1892, 6731, 10882, 405, 11454, 73911, 0, 0, 41169, 8939, - 41245, 0, 41170, 1454, 11369, 6477, 12157, 0, 0, 0, 41172, 7855, 0, 0, - 10480, 0, 0, 77936, 8264, 12610, 0, 645, 0, 7609, 40973, 0, 73833, 78249, - 5824, 984, 77918, 10688, 5851, 0, 7729, 73982, 120518, 0, 195086, 43369, - 0, 0, 68415, 0, 4538, 120406, 43141, 0, 0, 74214, 73886, 0, 0, 118902, - 43005, 78448, 9552, 0, 0, 0, 12997, 0, 0, 0, 0, 2381, 12883, 10994, - 10529, 41906, 0, 0, 0, 12425, 10661, 10856, 9614, 2428, 41478, 8582, - 10064, 73930, 0, 0, 0, 64896, 119162, 1952, 0, 8455, 10082, 11575, 0, - 119566, 0, 12808, 12183, 6145, 0, 64929, 0, 0, 0, 43186, 42509, 0, 3922, - 9187, 0, 0, 0, 119057, 11752, 3353, 9358, 0, 917957, 66680, 120090, - 11747, 7931, 8558, 9795, 68380, 0, 0, 120082, 120081, 120084, 41027, - 120086, 0, 120088, 120087, 7019, 120073, 0, 11751, 120078, 78294, 64657, - 8657, 120048, 8594, 120068, 0, 0, 120069, 120072, 120071, 0, 0, 43154, - 41029, 0, 11332, 65380, 7728, 0, 11294, 0, 66665, 7851, 0, 8375, 8699, 0, - 42524, 0, 9085, 0, 7504, 9327, 6160, 0, 0, 0, 8088, 0, 74012, 0, 0, 4439, - 6926, 0, 12924, 0, 42369, 0, 65491, 65145, 9041, 43559, 64577, 10826, 0, - 11296, 0, 0, 0, 65825, 9577, 68199, 0, 64670, 0, 78056, 6793, 11295, 0, - 78053, 73872, 0, 0, 10902, 0, 0, 78070, 78068, 10472, 2995, 0, 0, 64682, - 2371, 78069, 120808, 259, 1009, 0, 2402, 2333, 6440, 0, 0, 65125, 41244, - 0, 13271, 9103, 41180, 0, 0, 0, 0, 10219, 0, 0, 0, 0, 43178, 127070, - 41261, 119362, 43640, 8613, 0, 118989, 6736, 195092, 41492, 12005, - 917982, 0, 1890, 120056, 0, 0, 0, 7293, 7991, 0, 10578, 0, 78076, 0, - 78077, 0, 0, 78800, 0, 120054, 42668, 6635, 0, 6164, 65170, 0, 0, 0, - 11664, 0, 0, 0, 0, 118812, 0, 0, 0, 9175, 11925, 78045, 9088, 0, 64545, - 1396, 0, 7546, 3847, 0, 0, 4985, 13288, 672, 8098, 43196, 194746, 0, 0, - 0, 74043, 65072, 1577, 11772, 13041, 5928, 4525, 10658, 65911, 1266, - 10180, 0, 0, 12622, 0, 0, 0, 194714, 0, 13310, 773, 19933, 1539, 0, - 126983, 42731, 0, 0, 0, 0, 3051, 5862, 7823, 0, 0, 120411, 3250, 43991, - 0, 66649, 9510, 66237, 0, 0, 41066, 64673, 917963, 917964, 0, 3505, 8707, - 917968, 6725, 917966, 917971, 917972, 3471, 917970, 5479, 882, 6686, - 119584, 11613, 120772, 42754, 0, 0, 0, 0, 0, 0, 0, 3225, 917996, 4433, - 41156, 43973, 43173, 1443, 4381, 0, 0, 10926, 11756, 11757, 64879, - 917949, 917950, 917947, 13227, 0, 10021, 5160, 1387, 0, 917953, 41418, 0, - 65914, 6721, 217, 917955, 917960, 917961, 10443, 10789, 41158, 119257, - 4274, 0, 41483, 0, 41250, 0, 42179, 0, 5931, 11744, 69232, 0, 41252, - 66682, 0, 119637, 41249, 1366, 64635, 0, 12466, 0, 0, 4397, 0, 0, 41296, - 9545, 41291, 0, 0, 41485, 3511, 41282, 5923, 10400, 0, 0, 760, 0, 12088, - 5786, 0, 42256, 119869, 119861, 417, 41474, 119562, 41565, 0, 5934, - 119867, 66583, 119231, 64877, 0, 64481, 78614, 66013, 41956, 43455, - 126995, 0, 0, 0, 42273, 5819, 0, 917556, 0, 0, 0, 65910, 0, 10246, - 120816, 0, 1237, 10274, 4552, 0, 0, 0, 1375, 66705, 43573, 65260, 42063, - 0, 42811, 10312, 74192, 120794, 7840, 0, 43630, 10252, 0, 0, 43185, 0, - 4396, 0, 119880, 10769, 9676, 119041, 0, 9753, 0, 8944, 0, 0, 10473, 0, - 0, 6072, 43025, 10299, 0, 0, 120608, 66326, 0, 0, 0, 0, 9330, 0, 7222, - 10283, 10315, 10379, 4996, 0, 13281, 66517, 7865, 10087, 78343, 0, 78347, - 0, 0, 7565, 66363, 12952, 64806, 43180, 77928, 68096, 77929, 43982, - 74288, 622, 74023, 885, 43405, 1602, 0, 0, 852, 0, 12160, 0, 10212, - 65435, 0, 12071, 9609, 12156, 917983, 917984, 43586, 11035, 10411, - 917988, 10255, 6710, 10279, 4194, 10375, 917993, 0, 4315, 12644, 127516, - 77937, 43639, 43343, 0, 917998, 11501, 41177, 0, 0, 917792, 0, 0, 8715, - 0, 41179, 0, 43313, 0, 41176, 0, 994, 0, 8452, 127103, 73966, 0, 0, 5921, - 0, 2597, 0, 5922, 118903, 77943, 4186, 127107, 127106, 127105, 6718, 0, - 4406, 74601, 8480, 9192, 9747, 0, 4413, 0, 42268, 3198, 5924, 5920, 0, - 6921, 78081, 74007, 42869, 8418, 11681, 43169, 10176, 0, 742, 0, 2893, - 10772, 65276, 5937, 1914, 2553, 11682, 6756, 0, 0, 8363, 0, 2993, 7772, - 3916, 0, 120494, 1141, 42407, 8159, 718, 7572, 973, 0, 120718, 3235, - 2415, 43164, 0, 8018, 42333, 74756, 10675, 6937, 42486, 43381, 65390, 0, - 0, 1202, 0, 0, 127037, 0, 0, 0, 78182, 64542, 3260, 73829, 65388, 9945, - 8419, 78042, 6738, 0, 43681, 74193, 2059, 0, 0, 55237, 1431, 0, 66565, - 10821, 0, 12804, 0, 8229, 1235, 3307, 11472, 78089, 78184, 4544, 0, 0, 0, - 1740, 78097, 8758, 985, 12872, 64511, 78094, 12068, 78102, 0, 10141, 0, - 63761, 8785, 4476, 78109, 63763, 12655, 8907, 78105, 78106, 78103, 78104, - 0, 119572, 10665, 64616, 41572, 0, 0, 0, 41573, 0, 3931, 120295, 74143, - 0, 0, 0, 0, 11982, 0, 0, 0, 0, 64484, 0, 41167, 0, 41735, 0, 717, 10754, - 0, 0, 0, 0, 63767, 0, 1780, 6936, 0, 0, 819, 10611, 9694, 126978, 0, 0, - 0, 0, 0, 0, 12820, 0, 6578, 7009, 7523, 6922, 74218, 67848, 7525, 3346, - 8339, 0, 0, 575, 268, 78111, 8563, 5754, 120343, 41541, 65565, 8336, - 5936, 7290, 78117, 8337, 13081, 308, 11388, 7522, 120721, 78123, 65466, - 11090, 6953, 0, 120346, 0, 78132, 5926, 78128, 78130, 78126, 78127, - 78124, 78125, 9038, 7887, 43456, 7830, 11651, 13093, 64002, 0, 65742, - 12874, 119597, 11590, 0, 74048, 0, 8595, 0, 0, 43703, 13097, 0, 64643, - 13283, 12697, 0, 12381, 3488, 5933, 10033, 73738, 66241, 65570, 0, 12297, - 119153, 1955, 0, 5349, 42538, 0, 0, 65308, 9462, 0, 0, 0, 0, 42736, 0, - 5756, 0, 7638, 41642, 42764, 0, 43109, 7637, 5752, 120600, 0, 73832, 0, - 120635, 0, 78334, 0, 7636, 65171, 9124, 0, 78892, 0, 291, 0, 0, 2027, - 66230, 78142, 78136, 10403, 0, 4640, 64713, 10224, 120429, 42512, 120431, - 120430, 0, 0, 0, 0, 0, 0, 0, 119094, 74213, 7824, 0, 0, 41274, 5778, - 6302, 0, 0, 12680, 119130, 1417, 77889, 194914, 9452, 0, 74393, 11552, 0, - 0, 0, 65391, 0, 10172, 65453, 63789, 41264, 78658, 6426, 4641, 9179, - 64819, 55278, 41255, 42036, 41469, 41269, 120412, 41267, 4646, 120425, - 865, 42034, 78274, 78273, 4645, 42033, 78270, 0, 0, 64728, 0, 78673, - 78674, 1659, 919, 42784, 1671, 195089, 6069, 9219, 195090, 1661, 13120, - 63784, 69819, 10140, 9713, 119143, 0, 0, 0, 2306, 10485, 118943, 6068, - 10612, 195099, 0, 195101, 195078, 41462, 195080, 195079, 5422, 195081, 0, - 0, 0, 10229, 10635, 826, 195083, 195082, 195085, 195084, 195087, 6483, 0, - 1808, 7848, 0, 8100, 78227, 78669, 78670, 13301, 78667, 9667, 78665, - 78872, 0, 11003, 9904, 0, 0, 120690, 9144, 10921, 0, 78680, 9840, 65131, - 78678, 77841, 10313, 0, 0, 64320, 10265, 78686, 10962, 78684, 43008, - 8945, 78683, 0, 41, 195072, 1792, 120515, 195073, 8655, 195075, 0, 77951, - 12066, 0, 385, 4152, 2585, 0, 119068, 3126, 0, 74136, 10957, 0, 43258, 0, - 0, 13157, 0, 0, 3570, 0, 7443, 0, 44006, 6997, 0, 0, 7879, 8739, 11075, - 0, 65216, 0, 69795, 2593, 8463, 7810, 917862, 7839, 119913, 78806, - 119912, 9691, 4411, 78802, 0, 0, 43442, 78799, 65254, 10066, 0, 0, 0, 0, - 13061, 8016, 78687, 19932, 64831, 0, 0, 12390, 119171, 1634, 68115, 0, - 11056, 0, 119925, 0, 41165, 11328, 12450, 0, 41166, 0, 12456, 119914, - 171, 5941, 12452, 917544, 12458, 12531, 78779, 43013, 63800, 74162, 0, - 120483, 9969, 0, 12454, 63806, 42132, 12063, 78425, 78424, 3230, 0, 0, 0, - 5209, 297, 5810, 8522, 8415, 0, 78429, 78428, 7077, 2497, 0, 960, 74156, - 6981, 0, 12938, 4292, 0, 74815, 10512, 0, 74814, 78875, 127505, 78876, - 2503, 73778, 1762, 69794, 2495, 78873, 5844, 78874, 118838, 0, 12654, - 4663, 1899, 78877, 2507, 64121, 8726, 65594, 0, 0, 0, 8892, 0, 0, 0, 0, - 5782, 420, 0, 0, 120462, 10797, 63794, 0, 0, 64814, 63796, 77965, 0, - 66581, 119204, 41608, 0, 0, 63792, 4659, 120788, 0, 43676, 0, 0, 0, 0, 0, - 329, 77968, 0, 917548, 7399, 0, 41188, 13244, 120466, 42167, 7435, 78193, - 5380, 119086, 69225, 1155, 11365, 43126, 77972, 0, 65684, 0, 5601, 65192, - 42765, 63752, 0, 7987, 0, 1172, 69799, 6786, 43601, 120476, 74126, 5603, - 0, 4473, 0, 194823, 0, 65347, 65346, 65345, 0, 0, 5347, 69802, 0, 73868, - 118944, 10588, 0, 0, 63755, 0, 5343, 78422, 0, 4555, 5341, 0, 0, 0, 5351, - 0, 43104, 65244, 917892, 64541, 42519, 74472, 0, 0, 74765, 917888, 0, - 6638, 0, 65113, 271, 74180, 65370, 8835, 65368, 12653, 65366, 42172, - 41086, 65363, 65362, 65361, 11912, 43410, 11323, 65357, 11800, 65355, - 5345, 65353, 65352, 65351, 761, 65349, 19959, 0, 63856, 0, 0, 77958, - 64647, 77959, 11957, 4699, 0, 0, 0, 0, 64605, 0, 0, 0, 4916, 0, 380, - 10958, 66563, 77955, 69773, 9773, 13167, 12918, 41096, 73980, 69245, - 78254, 917893, 10684, 0, 917896, 0, 7946, 12541, 8182, 0, 69780, 0, 0, 0, - 0, 9005, 1225, 6630, 0, 0, 0, 0, 8847, 0, 65876, 5535, 8329, 74590, 0, 0, - 0, 0, 3127, 2595, 65713, 42013, 0, 5607, 41089, 0, 0, 74256, 2665, 11304, - 0, 74200, 4970, 8764, 120459, 8934, 0, 41566, 4492, 0, 65011, 41090, 0, - 0, 1188, 7254, 1100, 0, 0, 41081, 2912, 11749, 69792, 0, 0, 3572, 10023, - 4959, 13079, 0, 0, 9729, 0, 0, 0, 43361, 0, 0, 11803, 7996, 9907, 41450, - 13304, 0, 127260, 41451, 0, 11095, 8273, 127533, 3451, 0, 972, 41453, 0, - 0, 73883, 0, 73945, 0, 3455, 19955, 9538, 0, 69807, 0, 0, 0, 0, 11396, 0, - 11019, 0, 0, 0, 120507, 41078, 0, 261, 5927, 7791, 0, 0, 0, 10696, 0, - 6073, 9838, 118920, 0, 6075, 0, 282, 0, 6437, 74078, 0, 65861, 0, 0, 0, - 0, 3474, 118787, 0, 120655, 6081, 0, 0, 74076, 78879, 0, 0, 0, 0, 0, - 8751, 11499, 120273, 7816, 12636, 4665, 12628, 4670, 120271, 120272, 0, - 9642, 10912, 958, 0, 11387, 78878, 4666, 0, 4915, 0, 4669, 0, 68099, - 13287, 4664, 10836, 120550, 0, 69775, 0, 43595, 7450, 0, 917875, 8664, - 9697, 3606, 917873, 0, 0, 64815, 1063, 120250, 120251, 9772, 7255, 8886, - 1389, 0, 120257, 120258, 120259, 12941, 42661, 120254, 120255, 120256, - 12301, 120266, 69820, 41102, 66604, 120262, 120263, 120264, 1017, 66600, - 523, 505, 1447, 74436, 0, 0, 0, 8608, 42789, 0, 0, 0, 119196, 11307, - 66707, 917871, 0, 11745, 7919, 0, 1641, 0, 0, 8966, 0, 0, 5908, 0, 0, - 6744, 0, 1699, 74191, 74843, 0, 0, 6306, 10169, 0, 119251, 118939, 3766, - 2389, 120456, 120455, 6611, 257, 43170, 13153, 0, 42386, 0, 9436, 2599, - 0, 6496, 9449, 5930, 11476, 11033, 11447, 0, 5622, 120436, 8477, 3760, - 1718, 9442, 66433, 3776, 0, 41435, 4352, 0, 2435, 120809, 5621, 0, 4201, - 3778, 4203, 4202, 4205, 4204, 120447, 3768, 68142, 765, 41440, 3764, - 8473, 6373, 8469, 120438, 12947, 4564, 0, 0, 74271, 73753, 8374, 0, 0, - 6829, 5225, 0, 0, 0, 0, 119615, 0, 74793, 5626, 73807, 11771, 0, 0, 0, 0, - 5353, 5625, 74179, 0, 0, 1010, 64572, 41780, 42623, 64277, 0, 6952, 0, - 120752, 78762, 2590, 5629, 65552, 7551, 10325, 5632, 10471, 120038, - 120027, 120028, 120025, 5628, 120031, 970, 120029, 4772, 2400, 5627, - 120017, 120018, 120023, 64275, 120021, 10961, 0, 203, 0, 0, 0, 0, 78350, - 0, 64378, 42054, 0, 0, 554, 119649, 11358, 0, 12182, 42048, 11065, 0, - 73891, 0, 0, 5694, 7689, 69798, 9323, 4325, 3047, 10317, 175, 0, 0, - 69764, 0, 0, 1243, 42154, 5431, 6652, 0, 69770, 43651, 0, 68118, 0, 1129, - 0, 0, 65900, 1986, 7846, 78804, 8661, 0, 65255, 0, 3845, 4490, 118969, - 6649, 74400, 1456, 7530, 11977, 7249, 8366, 0, 7756, 12342, 0, 51, 41516, - 0, 8570, 9568, 917863, 456, 7026, 8145, 1168, 9251, 9082, 0, 64055, - 42781, 3866, 12323, 41512, 73805, 68121, 0, 41494, 0, 4660, 0, 10405, 0, - 78803, 0, 0, 42040, 73918, 119627, 7944, 41454, 12605, 0, 42205, 41455, - 236, 64051, 78867, 8214, 0, 0, 0, 41457, 0, 119589, 1969, 2384, 8097, - 917864, 0, 0, 78029, 8766, 0, 78079, 5854, 0, 10583, 0, 119989, 0, 10416, - 917869, 3872, 917868, 0, 8429, 0, 0, 2838, 917867, 0, 0, 0, 0, 0, 0, 0, - 11096, 120813, 10553, 1662, 8483, 0, 43605, 5892, 43418, 0, 73742, 66, - 65, 68, 67, 70, 69, 72, 71, 74, 73, 76, 75, 78, 77, 80, 79, 82, 81, 84, - 83, 86, 85, 88, 87, 90, 89, 119862, 10357, 7385, 8170, 1704, 8556, 0, - 9659, 0, 0, 0, 9556, 0, 4503, 11353, 9647, 0, 78185, 0, 0, 0, 78886, 0, - 0, 74229, 66593, 6438, 0, 9109, 78882, 1289, 64599, 0, 0, 0, 65507, 2447, - 0, 0, 0, 0, 0, 0, 6334, 0, 0, 19937, 0, 0, 0, 5675, 254, 0, 0, 0, 42425, - 8918, 64003, 5716, 42312, 0, 0, 6972, 42826, 0, 42464, 120567, 0, 0, - 74796, 64400, 64693, 0, 77861, 65429, 9515, 4435, 0, 42522, 0, 0, 11785, - 0, 64671, 41978, 1412, 4594, 1391, 10536, 8067, 9901, 7775, 0, 0, 74588, - 120748, 3140, 0, 7960, 43271, 0, 12518, 10909, 127508, 1428, 12472, 0, 0, - 7699, 12393, 0, 0, 0, 74518, 8223, 0, 4261, 0, 0, 0, 0, 0, 0, 0, 0, - 43419, 0, 64554, 10574, 3878, 0, 42352, 1752, 73785, 0, 42506, 0, 10199, - 0, 0, 0, 65919, 0, 6695, 720, 324, 0, 0, 43406, 0, 1464, 40985, 0, 7974, - 0, 43474, 0, 64488, 0, 0, 64041, 74787, 0, 78865, 0, 65597, 0, 78863, 0, - 1302, 0, 78861, 0, 0, 0, 5204, 74774, 43404, 43396, 0, 3995, 68360, - 65608, 3714, 0, 0, 0, 10999, 11750, 0, 43251, 68660, 43301, 0, 120557, - 8130, 8672, 10845, 11964, 0, 0, 0, 0, 68455, 42863, 73839, 0, 0, 0, 0, 0, - 0, 468, 612, 0, 64401, 66448, 68376, 0, 1674, 0, 5823, 0, 12280, 0, 540, - 74564, 0, 0, 8432, 0, 11073, 0, 64316, 0, 0, 820, 41741, 0, 120667, 0, - 64684, 126992, 3359, 7800, 0, 65177, 6226, 353, 12396, 0, 119612, 64742, - 0, 120282, 0, 0, 12412, 19941, 0, 120277, 78847, 1884, 9481, 42418, 0, - 41157, 0, 1195, 64898, 7924, 0, 41151, 2010, 0, 41328, 42344, 0, 12409, - 0, 4360, 127009, 9739, 0, 74392, 73921, 0, 42521, 8539, 0, 0, 0, 0, 4788, - 0, 0, 65734, 0, 64353, 0, 13075, 74429, 0, 64569, 43532, 10837, 2492, 0, - 118901, 68637, 41136, 64351, 11813, 9649, 41154, 119617, 5128, 4038, - 41143, 65604, 64859, 41592, 6771, 1648, 5435, 0, 6734, 41343, 119848, - 65439, 12709, 6986, 119846, 0, 0, 41349, 0, 12581, 10374, 5175, 0, 73806, - 10254, 0, 10278, 10262, 77950, 41346, 0, 607, 0, 0, 0, 12923, 10314, - 10282, 65477, 10378, 120297, 40976, 8265, 0, 119834, 40975, 5840, 42838, - 0, 40978, 0, 119840, 0, 0, 0, 66444, 10538, 0, 2550, 119836, 6779, 0, 0, - 3525, 6824, 118886, 0, 0, 5619, 65822, 0, 194882, 7455, 0, 5616, 11486, - 9656, 0, 0, 10727, 5615, 0, 120551, 42380, 64895, 43693, 66451, 808, - 5455, 11347, 0, 1026, 5620, 194887, 0, 11350, 5617, 0, 9225, 64639, - 127073, 9145, 0, 1338, 120581, 0, 12739, 4603, 3084, 0, 0, 9858, 6037, 0, - 3974, 78213, 10290, 0, 3083, 10322, 0, 0, 0, 41036, 0, 0, 43321, 65606, - 0, 41032, 42388, 0, 64700, 10011, 1445, 40961, 0, 194893, 0, 40960, 0, - 194891, 0, 40963, 64952, 10402, 0, 0, 0, 10603, 0, 0, 0, 0, 6714, 10083, - 127069, 194895, 78367, 0, 0, 0, 9073, 42585, 64302, 10704, 65030, 4787, - 0, 74829, 0, 65423, 0, 0, 9570, 0, 9525, 2689, 917626, 65426, 0, 917624, - 43740, 0, 40966, 917623, 13286, 3998, 42598, 42596, 503, 0, 8735, 2690, - 66488, 42836, 194913, 41954, 917617, 1652, 772, 6688, 8310, 65428, 3487, - 43416, 3585, 10194, 43320, 119159, 0, 194874, 6468, 41976, 9720, 917606, - 11767, 41970, 0, 5836, 12358, 0, 4355, 9048, 12180, 65027, 64680, 65025, - 43699, 0, 41488, 0, 8527, 194917, 12362, 12435, 12360, 41053, 3266, 0, - 12356, 8616, 41466, 0, 0, 11450, 0, 3638, 12354, 0, 3216, 0, 2358, - 119069, 8633, 0, 0, 119182, 69244, 0, 0, 11759, 0, 6368, 74823, 0, 41423, - 8078, 10504, 0, 41698, 42237, 0, 7002, 0, 41430, 42267, 41051, 41484, 0, - 0, 41050, 41473, 10466, 13099, 0, 0, 0, 6435, 0, 11362, 0, 0, 65382, 0, - 41420, 0, 3625, 78157, 41409, 0, 0, 2041, 9178, 9672, 41427, 43541, - 43317, 0, 0, 0, 41424, 917598, 120546, 0, 0, 0, 41417, 1261, 0, 0, 12102, - 119662, 41401, 0, 0, 0, 0, 0, 42290, 3275, 0, 42329, 0, 0, 0, 0, 0, - 120725, 10989, 74234, 0, 10598, 7410, 2669, 903, 0, 2920, 0, 127232, - 74603, 64504, 19928, 0, 0, 3917, 0, 11732, 0, 0, 41448, 41461, 0, 0, - 917558, 0, 8819, 12663, 0, 41184, 74014, 232, 74835, 120646, 9168, 65786, - 0, 0, 0, 9094, 0, 11758, 68425, 0, 1064, 42467, 0, 10115, 19924, 0, 0, - 7862, 64551, 13224, 8516, 41862, 66650, 7561, 78618, 69793, 1878, 0, 0, - 2911, 0, 41178, 5427, 64823, 0, 0, 12617, 41174, 0, 41458, 0, 41463, - 42413, 11292, 2406, 775, 0, 65584, 0, 6074, 9618, 194903, 0, 43440, 0, - 194901, 41436, 3656, 0, 194899, 41456, 0, 1599, 11333, 0, 6703, 8513, 0, - 1613, 0, 68456, 12598, 0, 0, 78745, 74500, 41460, 10145, 10542, 9937, - 78746, 0, 9905, 0, 65730, 0, 120374, 8427, 120375, 55246, 120376, 0, - 11497, 64687, 74008, 120371, 3871, 0, 0, 9111, 5741, 0, 194846, 120366, - 119111, 120745, 0, 120368, 0, 11648, 0, 0, 120364, 41587, 120365, 0, - 74322, 42113, 0, 0, 12172, 0, 74530, 65298, 65723, 194840, 73871, 65724, - 7928, 120354, 0, 41595, 73730, 0, 42118, 73830, 66042, 10355, 0, 7875, 0, - 41598, 3993, 0, 1545, 40971, 536, 0, 43029, 0, 0, 65173, 65286, 0, 0, 0, - 0, 0, 0, 41375, 5402, 0, 0, 1687, 120503, 0, 0, 78194, 64326, 40969, - 10526, 78753, 8323, 40968, 1339, 11731, 78756, 0, 65460, 12242, 0, 8020, - 10843, 11554, 0, 0, 8266, 41006, 65722, 0, 10710, 0, 118942, 67667, - 64567, 119155, 195091, 0, 119636, 67857, 120687, 0, 0, 11755, 66305, 0, - 0, 10917, 120767, 0, 11272, 2040, 41247, 41326, 195060, 1741, 42370, - 1227, 0, 0, 11413, 0, 0, 5283, 1586, 4978, 0, 1984, 0, 0, 120651, 40984, - 0, 9373, 0, 12916, 6284, 0, 41663, 0, 0, 0, 9237, 9385, 41648, 0, 0, 0, - 41666, 1830, 73783, 2056, 41287, 0, 0, 0, 42219, 0, 0, 41987, 41676, 0, - 120823, 0, 41670, 0, 0, 2796, 55291, 11683, 9902, 74521, 0, 11451, 0, 0, - 42631, 2359, 0, 67844, 74164, 41238, 548, 11405, 13133, 64368, 0, 0, 0, - 397, 43622, 42139, 9547, 9590, 0, 1614, 43661, 64356, 66307, 6651, 1358, - 0, 428, 9620, 1466, 78112, 10982, 118831, 1333, 0, 407, 6425, 0, 74253, - 0, 0, 0, 5804, 11976, 8554, 0, 0, 0, 9057, 42294, 41218, 0, 0, 78137, - 1883, 10952, 8048, 0, 41225, 0, 118955, 0, 0, 0, 4407, 0, 65809, 119074, - 194821, 8448, 68122, 74183, 0, 12675, 12659, 0, 42363, 120624, 194824, - 55273, 10766, 12012, 2386, 64732, 9170, 917821, 9123, 64585, 120500, 0, - 43367, 42051, 0, 4164, 9081, 0, 120569, 42049, 42042, 8709, 0, 0, 120637, - 42419, 0, 42047, 0, 0, 8470, 11807, 65897, 577, 0, 0, 74300, 0, 127308, - 74840, 0, 0, 0, 0, 8736, 1414, 42643, 9683, 43486, 74344, 0, 2536, 0, - 66330, 0, 0, 0, 0, 0, 0, 0, 66317, 917612, 66315, 2106, 0, 11273, 0, - 43004, 7541, 0, 0, 961, 64307, 66324, 64906, 0, 3106, 65917, 41284, 1696, - 0, 891, 12105, 0, 42624, 12802, 3264, 8824, 13268, 43003, 10936, 0, 0, 0, - 0, 0, 0, 2322, 0, 0, 11449, 0, 42868, 41285, 3547, 0, 0, 0, 0, 43216, - 6089, 78682, 0, 120578, 4170, 1029, 0, 127036, 119224, 42374, 0, 744, 0, - 0, 0, 65823, 0, 0, 3551, 0, 0, 4623, 55268, 0, 4598, 0, 65136, 0, 0, 0, - 10851, 0, 6179, 0, 6180, 0, 11952, 120778, 78648, 11972, 78646, 78647, - 78644, 78645, 177, 78643, 6176, 120580, 0, 0, 6177, 9020, 78652, 78653, - 6178, 120249, 120242, 0, 67673, 7518, 8754, 0, 120237, 74551, 43081, 0, - 0, 9136, 120240, 4401, 41280, 0, 8974, 2308, 0, 74149, 0, 2318, 0, 66361, - 8198, 0, 64360, 12601, 42536, 65266, 120827, 74307, 0, 6970, 5404, 43332, - 3667, 7936, 12925, 126989, 6385, 0, 0, 118949, 10874, 65505, 0, 0, 42053, - 2075, 42057, 11083, 42052, 0, 0, 67651, 0, 9665, 0, 0, 13181, 0, 0, 0, 0, - 74148, 0, 0, 120225, 120229, 120224, 74172, 41145, 0, 0, 0, 41148, 8683, - 7594, 127519, 0, 119090, 10869, 43458, 41146, 0, 11441, 0, 3512, 119633, - 0, 8103, 0, 0, 65184, 11780, 41563, 42796, 0, 119106, 41544, 65146, 0, 0, - 0, 0, 19942, 0, 118908, 7988, 10436, 74273, 3271, 73804, 64711, 0, 0, 0, - 0, 3804, 13070, 11557, 42044, 0, 1095, 0, 3599, 0, 0, 0, 8514, 0, 0, 0, - 74346, 66697, 0, 11684, 0, 0, 0, 0, 42043, 43232, 66677, 0, 42046, 78241, - 4036, 0, 0, 0, 194861, 0, 11954, 0, 1450, 12986, 1340, 0, 65441, 0, 0, 0, - 0, 0, 917542, 0, 0, 6539, 0, 0, 0, 194856, 0, 120492, 41190, 3973, - 119365, 4575, 41193, 7982, 429, 0, 0, 0, 194854, 65792, 0, 118968, 6417, - 118918, 78178, 0, 194850, 0, 0, 4919, 10590, 0, 7755, 0, 0, 64548, - 120506, 1621, 10214, 65126, 0, 127004, 0, 12188, 0, 1617, 8050, 0, 5015, - 0, 119174, 42590, 194871, 1756, 78181, 0, 65768, 6352, 41892, 0, 7555, - 13103, 5408, 2817, 1214, 0, 0, 0, 0, 0, 0, 0, 7957, 8689, 64723, 1056, 0, - 74147, 0, 0, 55286, 7073, 65850, 12327, 0, 119028, 0, 0, 0, 2341, 8450, - 8484, 8474, 0, 0, 0, 8461, 0, 12153, 12799, 0, 43709, 43708, 9451, 7571, - 13073, 0, 0, 681, 0, 703, 0, 3272, 8781, 12894, 0, 11709, 0, 74446, 0, 0, - 0, 11338, 120768, 3276, 0, 0, 65928, 0, 0, 65021, 64795, 74574, 0, 10047, - 78814, 3262, 78811, 42711, 0, 0, 68478, 163, 576, 9895, 1655, 78817, - 74591, 78815, 78816, 0, 0, 0, 0, 10039, 0, 0, 5623, 5717, 5776, 0, 0, 0, - 41591, 11036, 65252, 120488, 0, 0, 0, 0, 0, 0, 0, 8887, 0, 7295, 11031, - 0, 43157, 0, 8946, 10348, 10412, 8755, 0, 0, 5718, 13221, 0, 0, 78135, 0, - 0, 8810, 74499, 686, 0, 0, 4619, 118954, 6654, 73769, 74426, 0, 12040, - 65689, 10128, 65118, 0, 119151, 118891, 0, 0, 2401, 68144, 8792, 0, 0, - 65455, 0, 0, 0, 119129, 0, 12886, 0, 66624, 0, 43557, 10300, 10161, - 10396, 74135, 0, 118945, 78118, 73851, 3010, 6441, 78122, 1458, 41475, 0, - 0, 0, 11479, 0, 0, 6350, 12864, 0, 78114, 1061, 64780, 2001, 43111, - 55230, 0, 4052, 0, 7626, 0, 0, 1045, 0, 5631, 41113, 0, 0, 43707, 74127, - 0, 0, 8486, 0, 73758, 2335, 4362, 0, 0, 69221, 1025, 0, 42625, 0, 78084, - 41443, 0, 0, 0, 1774, 1523, 0, 0, 41445, 78236, 0, 8567, 41442, 3988, 0, - 78237, 118910, 0, 65274, 8564, 0, 78238, 127515, 0, 0, 43446, 0, 66513, - 6256, 0, 579, 55218, 10206, 0, 6375, 2673, 0, 11814, 0, 4488, 0, 0, - 68451, 10444, 118846, 0, 11799, 74407, 68466, 4487, 0, 42832, 1032, - 120267, 43450, 78257, 7203, 0, 614, 78191, 0, 120615, 0, 78262, 0, 0, 0, - 43121, 0, 0, 0, 1050, 7549, 0, 0, 9314, 0, 0, 120616, 0, 10057, 0, 0, 0, - 66504, 0, 0, 2307, 0, 64333, 0, 0, 73873, 0, 0, 0, 0, 0, 0, 10360, 6746, - 0, 0, 440, 0, 13085, 9233, 74216, 0, 0, 68612, 0, 66447, 8046, 64963, - 65777, 10125, 74212, 42819, 10910, 0, 1521, 9896, 0, 10487, 0, 12527, 0, - 7970, 0, 0, 0, 65769, 5243, 9849, 5239, 65771, 0, 0, 5237, 0, 0, 10103, - 5247, 4769, 0, 118977, 12873, 5764, 0, 0, 3008, 4896, 0, 12087, 0, 55231, - 41103, 0, 64565, 4773, 0, 0, 0, 4770, 0, 917567, 8731, 65378, 0, 120619, - 9122, 0, 0, 4774, 3019, 9997, 12834, 0, 9456, 10215, 120547, 0, 0, 0, 0, - 74776, 4281, 4768, 0, 41535, 4099, 9017, 0, 0, 78095, 0, 78096, 0, 0, 0, - 78098, 0, 42814, 880, 0, 0, 0, 0, 0, 10116, 9877, 0, 0, 0, 7095, 0, 0, - 6778, 0, 78090, 8243, 2427, 0, 7093, 0, 11585, 195003, 9962, 0, 12223, 0, - 0, 1434, 0, 5637, 11573, 0, 0, 0, 19951, 0, 78121, 0, 0, 55283, 0, 0, - 74437, 1156, 8740, 0, 3782, 64331, 0, 41370, 1014, 8261, 0, 0, 10835, 0, - 65536, 0, 120463, 0, 7702, 118824, 0, 43010, 65779, 65783, 1150, 10547, - 5700, 0, 120603, 65383, 2339, 42594, 5697, 118788, 0, 0, 0, 42257, 5696, - 120470, 120465, 3862, 9643, 0, 0, 7634, 65167, 9845, 0, 0, 5701, 9722, - 41490, 0, 1426, 68217, 0, 68447, 42204, 55270, 8571, 194991, 0, 0, 78818, - 0, 43182, 12184, 0, 42022, 0, 10281, 0, 5650, 43194, 64712, 10744, 0, - 990, 5647, 0, 7387, 78734, 41114, 11477, 5646, 12879, 11018, 0, 3945, 0, - 0, 0, 0, 0, 78212, 0, 1020, 73763, 0, 78731, 5648, 64748, 194910, 0, - 10205, 3545, 0, 6984, 0, 74051, 0, 43242, 120458, 2667, 0, 0, 0, 9911, 0, - 65020, 10097, 119166, 0, 0, 118836, 0, 78427, 1140, 78426, 0, 10159, 0, - 0, 8128, 0, 0, 917965, 1815, 19910, 890, 0, 3267, 0, 0, 10123, 0, 4410, - 1041, 10576, 6354, 0, 580, 74232, 0, 0, 0, 0, 0, 19938, 65906, 0, 0, 0, - 3298, 5375, 10142, 0, 8215, 0, 6134, 41246, 64402, 0, 0, 0, 0, 0, 41382, - 0, 0, 5173, 65348, 527, 0, 0, 0, 0, 78797, 11915, 0, 0, 10072, 0, 42695, - 2329, 42250, 0, 0, 0, 12245, 9939, 0, 0, 0, 0, 0, 74328, 119576, 74769, - 0, 119087, 9069, 6144, 0, 0, 73822, 0, 0, 64917, 41521, 118934, 494, - 13250, 0, 65098, 6364, 956, 0, 12830, 10462, 73740, 0, 0, 0, 0, 66449, - 13263, 74281, 69217, 13171, 0, 0, 0, 0, 0, 1044, 41276, 0, 0, 0, 42068, - 11795, 0, 0, 0, 0, 42450, 3907, 0, 64526, 0, 68197, 12295, 0, 11475, 0, - 3020, 11537, 0, 66441, 0, 0, 0, 0, 1057, 566, 42696, 0, 3016, 42274, - 43464, 66490, 12921, 66571, 78472, 0, 3006, 4620, 127237, 0, 0, 0, 64659, - 0, 0, 55253, 6357, 6362, 8626, 0, 0, 9090, 65377, 41596, 0, 0, 1698, 0, - 64477, 0, 0, 1053, 0, 78269, 0, 0, 1052, 1051, 459, 1060, 74349, 66479, - 0, 0, 0, 0, 42490, 689, 6508, 4163, 42298, 8639, 66641, 4246, 0, 0, - 12130, 0, 42337, 64596, 64375, 66481, 0, 0, 0, 6359, 0, 43471, 0, 0, 0, - 127274, 0, 6358, 6361, 1926, 6356, 0, 7898, 8110, 10935, 0, 43633, 5830, - 0, 43685, 0, 0, 0, 0, 8693, 78611, 119565, 0, 0, 0, 127257, 0, 0, 0, 0, - 0, 0, 0, 119187, 11439, 78868, 0, 0, 78869, 42313, 5579, 0, 0, 0, 0, 0, - 5578, 41774, 0, 42023, 6234, 5669, 0, 0, 0, 0, 127506, 68202, 5583, 0, 0, - 42426, 5580, 42276, 2923, 892, 5582, 42465, 41330, 194987, 5795, 65512, - 119006, 65702, 0, 120801, 65251, 0, 65710, 0, 0, 67672, 0, 5370, 0, - 194986, 1638, 10966, 10188, 65878, 118848, 0, 0, 0, 0, 8172, 42017, 0, - 10844, 0, 0, 0, 6374, 0, 0, 286, 78023, 1062, 0, 119999, 0, 7395, 0, - 1070, 64900, 0, 6095, 41865, 0, 3015, 0, 917763, 5211, 0, 6400, 0, - 194983, 0, 8189, 11276, 0, 0, 372, 0, 0, 118874, 42102, 41585, 0, 0, - 42101, 276, 78402, 0, 33, 74226, 0, 9007, 118796, 41588, 66033, 427, - 10763, 118819, 0, 0, 0, 1031, 6257, 0, 42104, 0, 0, 2328, 0, 1071, 0, 0, - 74848, 0, 0, 0, 1047, 0, 0, 64790, 0, 0, 10651, 0, 0, 0, 0, 0, 119181, - 5711, 41633, 12098, 65571, 9166, 0, 5710, 0, 6790, 65168, 13216, 0, 0, 0, - 0, 64611, 41623, 195001, 5715, 0, 0, 0, 5712, 2761, 41620, 68124, 3074, - 5722, 0, 8643, 73768, 0, 118906, 2757, 11067, 9718, 74498, 8910, 10689, - 6479, 0, 0, 0, 78607, 0, 0, 0, 0, 0, 0, 118911, 0, 0, 0, 0, 0, 120010, 0, - 8701, 68130, 119616, 120522, 0, 42477, 0, 12123, 4495, 43569, 0, 0, 0, - 64946, 10992, 0, 120009, 0, 0, 9318, 120661, 13249, 65679, 73808, 0, - 65457, 42249, 7639, 43995, 67845, 42641, 5454, 0, 0, 194997, 120005, 0, - 0, 5084, 0, 0, 118861, 0, 733, 917876, 78014, 78436, 78435, 41677, 0, - 9218, 1731, 0, 0, 0, 0, 0, 0, 0, 120001, 127018, 0, 5155, 0, 5358, 0, 0, - 917767, 64424, 0, 3840, 64314, 41432, 0, 0, 68430, 119116, 43253, 65943, - 0, 3371, 10988, 0, 8771, 1479, 0, 0, 1109, 11580, 0, 64601, 12205, 0, 0, - 64507, 8868, 399, 0, 74842, 0, 0, 12149, 13088, 551, 0, 10156, 12119, 0, - 0, 2544, 65074, 0, 0, 0, 78011, 351, 119149, 0, 0, 55229, 0, 74268, 0, 0, - 0, 42377, 0, 0, 0, 0, 0, 9013, 4054, 0, 0, 0, 0, 73960, 5585, 65881, - 2549, 74469, 0, 0, 5584, 8358, 0, 74411, 0, 10919, 0, 7980, 0, 0, 0, - 41800, 5589, 0, 2664, 41613, 5586, 118890, 0, 11356, 0, 0, 43452, 78609, - 0, 42573, 67856, 0, 78129, 0, 0, 0, 8135, 6450, 10055, 77996, 0, 0, 0, - 5657, 0, 9626, 0, 77994, 10179, 5654, 12939, 0, 120799, 0, 0, 5652, - 10945, 0, 66486, 0, 3661, 7863, 0, 0, 0, 74509, 0, 5659, 0, 0, 66729, - 5655, 0, 42168, 0, 1055, 917628, 0, 66310, 74030, 0, 12146, 73955, 73956, - 11618, 0, 126990, 0, 10272, 10304, 10368, 42518, 594, 10244, 10248, 7407, - 0, 64870, 0, 3467, 0, 0, 3331, 946, 10231, 1495, 8131, 74330, 0, 9562, - 69222, 65927, 0, 0, 120155, 69769, 64656, 0, 0, 194837, 0, 5666, 65227, - 5318, 63994, 0, 9091, 10798, 0, 917979, 10186, 0, 7732, 0, 64556, 0, 0, - 5668, 74445, 0, 0, 5670, 0, 0, 11820, 2992, 7826, 5667, 19952, 120807, 0, - 12749, 0, 0, 0, 66496, 4361, 119260, 1306, 9286, 1497, 0, 0, 0, 0, 3571, - 13247, 0, 7973, 66353, 68435, 78278, 67896, 43192, 0, 78265, 553, 120653, - 0, 0, 5829, 0, 4587, 78285, 65912, 0, 12746, 0, 0, 119924, 5633, 119927, - 0, 0, 0, 64905, 0, 9512, 0, 12742, 6443, 0, 0, 9135, 0, 41564, 0, 55219, - 0, 0, 0, 12148, 0, 78297, 0, 64256, 0, 11669, 0, 5634, 4524, 0, 127270, - 0, 118880, 2425, 65182, 0, 43636, 5221, 78410, 328, 0, 0, 69815, 5636, 0, - 5329, 0, 5638, 119918, 7940, 64938, 43223, 0, 5635, 3373, 2986, 78292, - 74223, 3437, 78291, 6203, 4247, 0, 11920, 8274, 0, 0, 1657, 41561, 78299, - 78295, 5639, 2954, 5660, 5640, 78303, 0, 78300, 42227, 0, 0, 41637, - 67872, 0, 78310, 41625, 43362, 78309, 120713, 11705, 5642, 0, 5486, 0, - 4356, 11710, 0, 12051, 0, 0, 5641, 8259, 0, 1058, 0, 67630, 0, 0, 1144, - 78750, 0, 42228, 0, 73890, 118972, 0, 65322, 0, 5645, 64964, 8652, 2547, - 66484, 43634, 0, 5608, 65890, 0, 0, 67621, 119934, 9000, 0, 0, 0, 1865, - 0, 5613, 74267, 0, 0, 5610, 0, 0, 65826, 2069, 0, 10787, 43999, 2997, 0, - 5609, 78316, 65319, 78313, 12316, 65376, 2412, 0, 8186, 9807, 74269, 0, - 13130, 65874, 0, 5807, 0, 10030, 5306, 12936, 0, 0, 11704, 0, 0, 10211, - 0, 0, 0, 0, 11706, 9710, 0, 0, 0, 413, 65623, 74237, 0, 9133, 74262, 0, - 1042, 0, 64779, 12171, 119240, 6185, 64776, 4984, 0, 708, 11391, 0, - 12241, 0, 0, 1308, 0, 2534, 810, 0, 0, 0, 0, 0, 1917, 3000, 0, 0, 120739, - 2364, 0, 74470, 66618, 65680, 0, 10027, 0, 0, 12337, 120722, 0, 0, 2980, - 755, 69774, 931, 13124, 68182, 6363, 2748, 0, 0, 65041, 0, 44011, 8730, - 0, 0, 78312, 7274, 119250, 0, 7275, 78304, 935, 0, 65840, 377, 42325, - 11649, 0, 65253, 64301, 0, 78308, 42341, 65284, 2417, 0, 12884, 19912, - 7907, 10768, 0, 194998, 0, 10673, 119217, 7248, 0, 0, 1781, 5496, 3627, - 62, 1649, 0, 964, 0, 0, 78226, 0, 127512, 0, 0, 0, 0, 43689, 0, 13142, - 78812, 42415, 66575, 4542, 74037, 43547, 0, 0, 7677, 2991, 4946, 42454, - 0, 7949, 0, 0, 11341, 42494, 3073, 65625, 9714, 11692, 4657, 0, 0, 6478, - 9898, 43673, 65237, 6241, 0, 4877, 0, 6238, 0, 10548, 127049, 4409, 0, 0, - 64798, 0, 5346, 0, 120528, 6237, 4874, 0, 9176, 0, 0, 65231, 65884, - 12678, 78748, 118912, 11378, 44018, 42785, 2408, 3251, 0, 0, 5685, 0, - 2461, 11052, 7091, 5342, 8317, 0, 68163, 5340, 0, 0, 43635, 73928, - 127529, 0, 0, 0, 0, 65482, 0, 9142, 0, 0, 0, 10938, 0, 118790, 1182, - 2542, 4826, 0, 0, 0, 529, 8580, 0, 0, 10586, 10790, 10839, 66023, 41593, - 41207, 0, 0, 41594, 225, 42828, 0, 0, 0, 11376, 74379, 10721, 67664, - 3438, 42097, 127267, 11084, 3194, 41870, 266, 78305, 0, 41873, 120575, - 11324, 0, 0, 8420, 64918, 0, 41871, 41338, 3734, 7734, 43683, 8750, - 66605, 66011, 0, 40965, 0, 0, 5161, 10572, 0, 0, 0, 64349, 7287, 42162, - 127552, 0, 0, 11948, 69220, 12359, 43429, 41369, 1697, 12191, 0, 68633, - 7286, 0, 68635, 10031, 0, 9870, 68645, 8620, 65824, 0, 11938, 0, 7285, 0, - 119577, 42678, 0, 43677, 41583, 0, 65799, 0, 0, 0, 0, 78169, 66199, 0, - 3609, 68624, 0, 832, 120693, 120770, 78473, 66007, 78471, 65703, 0, 0, - 42732, 5180, 0, 41395, 41530, 11691, 64773, 0, 74002, 0, 0, 0, 6348, 243, - 13200, 0, 6024, 0, 9979, 10037, 41529, 10648, 8538, 43687, 0, 0, 4285, - 66195, 0, 4230, 0, 13307, 43256, 0, 7563, 42376, 0, 68442, 120512, 0, 0, - 214, 0, 0, 78466, 65893, 12208, 9973, 0, 66311, 65589, 0, 2603, 0, 0, 0, - 0, 0, 6022, 0, 2884, 0, 11620, 0, 43, 0, 66453, 1016, 41107, 0, 41121, - 3885, 92, 65456, 64608, 0, 74801, 0, 2074, 0, 78283, 0, 12453, 0, 0, - 74241, 0, 6791, 12457, 78268, 0, 0, 0, 78279, 0, 0, 0, 66637, 7995, 8759, - 43421, 78277, 12449, 0, 0, 0, 8752, 3197, 4720, 10165, 0, 119249, 0, - 11595, 64893, 0, 43435, 0, 0, 4993, 0, 6168, 10934, 1946, 741, 0, 5494, - 4639, 0, 1990, 66589, 4498, 78664, 119183, 0, 0, 0, 2960, 73779, 0, 8969, - 0, 43424, 127059, 0, 2950, 0, 6210, 65753, 370, 0, 0, 0, 4953, 0, 0, 0, - 0, 69230, 0, 0, 65688, 0, 5063, 3517, 2964, 43663, 917762, 6344, 74791, - 10566, 10144, 66333, 8252, 729, 66016, 78253, 0, 0, 64923, 0, 43669, - 9032, 78263, 78264, 0, 41215, 0, 65883, 0, 0, 120602, 3761, 0, 0, 0, 0, - 12912, 119012, 3850, 0, 0, 0, 0, 0, 908, 0, 8611, 0, 0, 0, 43691, 41197, - 0, 8978, 120540, 119135, 41586, 10527, 0, 917848, 3848, 78739, 194937, - 127536, 65241, 5336, 0, 0, 663, 0, 10780, 0, 0, 78767, 0, 0, 68193, 347, - 0, 0, 78775, 64675, 41582, 78774, 78744, 65579, 12980, 78769, 12143, - 73733, 78512, 0, 43441, 41804, 78523, 0, 78525, 0, 0, 41584, 10681, 0, 0, - 73938, 0, 0, 4800, 66661, 0, 66306, 64715, 78534, 9518, 6609, 10434, 0, - 11319, 1097, 0, 917850, 41730, 0, 0, 73847, 78761, 65172, 41728, 41721, - 0, 0, 0, 41203, 0, 13110, 41726, 0, 0, 1000, 0, 0, 41140, 1209, 73978, 0, - 73750, 1073, 6321, 77878, 41138, 0, 68213, 0, 12167, 1115, 41605, 9794, - 127062, 67671, 55248, 12237, 78787, 66314, 6587, 9290, 78782, 78783, - 9231, 78781, 2959, 7926, 0, 0, 0, 64398, 0, 119970, 12311, 0, 78796, - 78798, 78794, 78795, 68434, 78793, 66670, 0, 0, 12290, 0, 0, 0, 42142, - 9968, 8205, 0, 5131, 0, 9627, 78536, 78542, 78535, 0, 1944, 1248, 10148, - 0, 119990, 119991, 12701, 78376, 11308, 119995, 0, 119997, 119998, 65305, - 74263, 4031, 42794, 120003, 7075, 8154, 120006, 120007, 41817, 73934, - 42275, 120011, 120012, 78526, 120014, 120015, 6041, 0, 41899, 0, 8002, 0, - 4364, 0, 0, 64332, 0, 7813, 9064, 119986, 10124, 7526, 8601, 7281, 78455, - 7279, 12041, 1418, 10885, 12673, 0, 0, 9660, 0, 13012, 4571, 0, 0, 0, - 12078, 2970, 0, 10933, 0, 77870, 0, 0, 0, 41599, 0, 0, 0, 12950, 0, 3486, - 0, 0, 4239, 0, 0, 66511, 0, 2637, 64629, 8460, 127053, 8476, 0, 0, 0, 0, - 65673, 1019, 78495, 4148, 0, 12289, 0, 4316, 0, 13119, 0, 5412, 66243, - 9935, 0, 73864, 0, 41734, 8206, 74081, 9163, 3286, 9072, 5867, 13302, - 7622, 0, 41736, 0, 41731, 0, 7400, 5416, 68663, 118924, 10817, 0, 41539, - 0, 0, 73963, 41855, 41867, 65564, 11277, 65892, 11536, 10620, 0, 12210, - 66030, 73932, 5498, 73942, 41536, 0, 68204, 0, 3459, 8997, 0, 0, 0, 0, 0, - 0, 66377, 69781, 0, 0, 78511, 3161, 295, 120207, 0, 0, 0, 78742, 9016, - 43454, 63903, 63902, 43641, 0, 3971, 0, 73972, 2952, 78765, 11038, 10901, - 63900, 63899, 63898, 0, 667, 12332, 63887, 6086, 41722, 0, 5172, 0, 0, - 4159, 0, 0, 9815, 63884, 19934, 63882, 41198, 8555, 63878, 63877, 42460, - 6050, 42708, 63881, 63872, 0, 42421, 0, 41723, 63875, 63874, 11460, 7432, - 1913, 41913, 63852, 0, 0, 42348, 0, 6752, 446, 41911, 0, 63851, 63850, - 41910, 0, 63846, 2972, 12932, 7262, 0, 63849, 63848, 63847, 0, 6570, - 8302, 7259, 63842, 4178, 10746, 7250, 13214, 10041, 8105, 63892, 0, - 118983, 1105, 4180, 0, 12094, 9497, 0, 63891, 63890, 63889, 63888, 5538, - 9987, 0, 118932, 1678, 13274, 552, 120654, 44010, 10785, 0, 119170, 4557, - 74459, 9159, 10171, 13125, 63860, 5540, 63858, 63865, 281, 13242, 63862, - 74154, 0, 5536, 65568, 63857, 1388, 74169, 0, 1077, 0, 65099, 11531, - 5834, 0, 0, 0, 0, 42773, 0, 0, 0, 119220, 0, 3663, 0, 1112, 119122, 8686, - 0, 5334, 65081, 43249, 74778, 0, 11077, 0, 6509, 0, 5327, 0, 19907, - 63869, 3478, 7583, 7679, 2903, 0, 3001, 1158, 8745, 0, 73748, 63866, 0, - 1915, 4846, 0, 66371, 118984, 42105, 2990, 120128, 805, 69238, 120125, - 12070, 8760, 1117, 118987, 12212, 120123, 65174, 42357, 63835, 63834, 0, - 78240, 12225, 63838, 63837, 0, 0, 63833, 6042, 66360, 8083, 0, 0, 63821, - 63820, 63819, 63818, 0, 5227, 9047, 63822, 0, 6091, 0, 10691, 560, 5643, - 8226, 119578, 63812, 63811, 63810, 63809, 5542, 63815, 63814, 63813, - 6047, 1597, 120143, 780, 206, 77925, 4936, 65147, 8168, 63930, 2076, - 1093, 9882, 63934, 2082, 63932, 917554, 63929, 3546, 1605, 77934, 9806, - 43472, 77933, 8400, 11343, 2086, 0, 63926, 2984, 5968, 9287, 0, 4618, - 42209, 43431, 13169, 5290, 2089, 1695, 10743, 1088, 63825, 7268, 1084, - 1085, 63829, 1083, 10131, 7283, 0, 63970, 0, 1092, 4754, 7273, 5252, - 44016, 43627, 0, 0, 7408, 11809, 0, 0, 0, 2965, 7258, 8808, 0, 1089, - 4187, 63937, 42119, 42120, 0, 940, 5787, 10099, 63938, 0, 74494, 12463, - 2994, 0, 118827, 0, 9664, 77939, 77940, 67892, 77938, 74343, 0, 0, 660, - 10127, 666, 9022, 5532, 43667, 5533, 77941, 78507, 6118, 222, 979, 3884, - 0, 74151, 120445, 6502, 0, 127118, 0, 63951, 12465, 0, 0, 0, 63946, 1707, - 63924, 12461, 63950, 63897, 63948, 63947, 63945, 6038, 63943, 63942, - 64685, 63895, 65838, 0, 7776, 0, 0, 0, 120444, 78172, 801, 43165, 1690, - 63919, 63918, 63917, 13277, 43659, 12951, 120638, 9906, 2054, 2334, - 78515, 63916, 5483, 63914, 120610, 63911, 5484, 63909, 63908, 2539, 0, - 43980, 5485, 0, 42697, 9061, 5534, 10672, 4502, 0, 253, 0, 68208, 0, - 42854, 78393, 0, 11530, 0, 68668, 0, 0, 0, 10474, 43426, 13257, 42354, 0, - 0, 0, 195065, 0, 8413, 0, 0, 5693, 7272, 0, 13209, 64470, 65831, 78460, - 195063, 0, 0, 0, 0, 0, 0, 0, 0, 0, 66608, 3111, 41863, 8804, 66607, 0, - 7270, 0, 66606, 6628, 1076, 7433, 1436, 73844, 55226, 0, 63982, 7393, - 12807, 43413, 63906, 1598, 63904, 0, 0, 41729, 4423, 1307, 0, 10515, - 41589, 0, 0, 6218, 0, 1430, 0, 0, 120606, 78754, 5413, 7619, 3255, 3493, - 74032, 11549, 10735, 41743, 73937, 6801, 0, 4518, 10990, 65073, 5167, - 4481, 3771, 0, 2710, 0, 69243, 41724, 0, 43073, 41690, 12479, 0, 0, 0, 0, - 119659, 1628, 0, 0, 0, 65262, 6333, 10783, 42315, 0, 63855, 120683, 0, 0, - 5339, 74323, 0, 13004, 0, 4457, 0, 0, 0, 0, 5684, 8678, 10914, 0, 5689, - 65807, 0, 68464, 12633, 12870, 78521, 65183, 5688, 11926, 6033, 6310, - 5686, 0, 74251, 0, 120647, 0, 50, 10558, 9871, 0, 43655, 0, 0, 0, 66468, - 0, 13259, 4448, 0, 0, 0, 0, 67853, 0, 10640, 0, 1151, 0, 917607, 0, - 127079, 195050, 0, 0, 0, 0, 12501, 64604, 0, 11527, 118870, 8812, 0, - 11538, 8673, 12650, 11020, 0, 66467, 2105, 8087, 78163, 0, 9894, 0, 0, 0, - 4636, 55262, 78513, 4515, 2382, 0, 127055, 0, 120495, 0, 0, 12277, - 194627, 11995, 194626, 0, 12158, 0, 8741, 10197, 0, 0, 0, 6531, 0, 0, - 473, 43415, 0, 0, 1873, 1087, 0, 0, 0, 78527, 66439, 43218, 0, 194716, - 7237, 12504, 74282, 0, 0, 0, 9489, 0, 0, 4384, 74220, 195055, 2058, - 917561, 13295, 43191, 0, 0, 1154, 3857, 1205, 0, 0, 13100, 12958, 120706, - 74168, 0, 0, 4421, 10592, 0, 495, 0, 41712, 7983, 0, 120779, 0, 6347, 0, - 7654, 41710, 4196, 0, 437, 41709, 73772, 0, 0, 9465, 13290, 119180, 4997, - 64306, 0, 0, 4999, 194642, 0, 0, 4711, 120769, 0, 2739, 0, 8044, 74834, - 0, 41789, 0, 10809, 0, 0, 0, 1779, 6600, 6601, 41543, 5325, 642, 64187, - 13058, 120449, 12875, 0, 0, 13229, 0, 10575, 43399, 0, 0, 41791, 1104, 0, - 0, 10655, 0, 0, 0, 0, 1082, 195049, 8428, 6569, 0, 0, 0, 0, 6783, 0, - 12993, 8049, 41548, 44021, 6458, 0, 0, 4761, 63828, 4766, 64623, 1273, - 43407, 0, 118876, 195045, 6912, 1313, 6322, 10483, 0, 41545, 0, 0, 0, 0, - 0, 0, 78624, 3484, 74337, 0, 0, 8503, 5122, 41527, 0, 66320, 0, 0, 0, 0, - 41537, 0, 8303, 8282, 11817, 73857, 10003, 73859, 65904, 194663, 1686, 0, - 78406, 11467, 3664, 65921, 64299, 194664, 0, 0, 4324, 126, 42246, 119152, - 0, 74378, 65926, 7744, 194636, 74277, 74302, 78052, 0, 6966, 0, 8136, 0, - 65600, 1633, 0, 0, 4762, 1103, 0, 0, 4765, 0, 13078, 0, 4760, 63827, - 2050, 10871, 43199, 1102, 0, 42236, 0, 194667, 11546, 74794, 337, 0, - 42591, 8627, 12279, 1111, 0, 0, 4707, 68206, 10143, 7883, 127081, 7880, - 4522, 8645, 5704, 13010, 0, 8304, 0, 0, 119575, 0, 0, 66654, 0, 0, 0, - 13008, 0, 4385, 0, 13011, 0, 0, 119161, 13009, 160, 2677, 0, 0, 41793, - 65763, 74221, 120141, 41792, 42770, 0, 65762, 118829, 64573, 5709, 0, - 194638, 0, 0, 0, 1079, 3867, 5708, 0, 0, 0, 5706, 64768, 5705, 8791, - 4005, 0, 10237, 10991, 0, 43459, 9173, 917581, 917580, 13170, 65942, - 917577, 42605, 120765, 917570, 68647, 917572, 10058, 0, 74867, 194654, - 127078, 3339, 11448, 1106, 917591, 917590, 917593, 3340, 917587, 917586, - 917589, 917588, 120541, 10605, 1309, 63966, 120743, 1754, 127075, 13246, - 864, 0, 118926, 8972, 0, 7849, 120092, 0, 13240, 195068, 5192, 4338, 0, - 10948, 917601, 13199, 120169, 1236, 13208, 13261, 13189, 13188, 120164, - 0, 7440, 0, 120153, 9553, 1590, 63777, 63776, 13178, 63782, 63781, 63780, - 63779, 1583, 0, 13260, 4550, 0, 64205, 0, 0, 41522, 0, 0, 0, 0, 11354, 0, - 0, 42795, 0, 119195, 11394, 194646, 13236, 13272, 13194, 1334, 0, 4479, - 1178, 65586, 120663, 66681, 119193, 4601, 0, 0, 0, 0, 0, 194658, 0, 6809, - 63786, 6031, 0, 63791, 63790, 1145, 63788, 7910, 63785, 43153, 754, - 10192, 13105, 8183, 120741, 2037, 0, 0, 10747, 125, 0, 64890, 0, 0, 0, - 41719, 63758, 3523, 1074, 13258, 9536, 74077, 0, 4427, 74242, 63757, - 43145, 12217, 63754, 41532, 1349, 63750, 63749, 0, 0, 0, 63753, 63802, - 41084, 120622, 68133, 41930, 63805, 63804, 43632, 63801, 41082, 8140, - 63798, 6260, 0, 0, 119225, 63793, 11988, 3898, 0, 10201, 12238, 63795, - 42194, 10367, 12521, 10431, 42114, 41932, 1068, 0, 12523, 12945, 0, - 42203, 7950, 10804, 63771, 42787, 4386, 12224, 6973, 2793, 12475, 0, 0, - 63769, 9530, 0, 12232, 13135, 8596, 5681, 63762, 4595, 63760, 792, 0, - 64803, 0, 8742, 0, 11053, 0, 63744, 0, 0, 7588, 63748, 1693, 63746, - 43204, 5055, 68426, 917853, 1090, 120679, 0, 11665, 74133, 4558, 65685, - 9523, 0, 0, 78681, 11513, 0, 6157, 63775, 63774, 63773, 13191, 12170, - 3500, 3139, 0, 3170, 12485, 0, 10872, 78271, 13006, 64433, 0, 0, 941, 0, - 0, 0, 65541, 11063, 0, 8228, 0, 42065, 0, 0, 0, 0, 0, 7386, 0, 68358, 0, - 0, 43603, 0, 65397, 288, 0, 0, 0, 10025, 917916, 2918, 0, 65300, 119871, - 9883, 64726, 2790, 65395, 3793, 0, 0, 65393, 0, 74138, 0, 0, 0, 74139, - 120613, 65394, 11548, 5270, 0, 65396, 0, 65813, 13256, 1282, 120771, 0, - 0, 10888, 0, 65242, 0, 3330, 0, 0, 0, 0, 0, 74259, 3304, 42753, 0, 0, 0, - 1627, 0, 0, 0, 5371, 13116, 0, 1826, 118794, 0, 43094, 0, 43650, 0, 0, - 9035, 0, 0, 0, 0, 0, 68125, 0, 164, 0, 0, 0, 6958, 0, 43116, 0, 0, 13245, - 0, 0, 127376, 0, 73893, 0, 12666, 13175, 13207, 120414, 66014, 120428, - 7447, 5929, 0, 65509, 0, 7449, 11306, 0, 73920, 3180, 0, 63808, 9054, - 971, 13062, 0, 0, 65195, 10164, 0, 74428, 0, 78146, 0, 0, 0, 0, 10045, - 12882, 13275, 0, 11057, 0, 13276, 0, 41525, 78150, 7271, 11444, 0, 0, 0, - 12229, 41523, 0, 43411, 73751, 0, 64813, 0, 0, 10476, 3858, 0, 3932, - 64958, 0, 0, 73989, 68192, 0, 0, 369, 0, 41784, 0, 64163, 0, 0, 0, 65474, - 4796, 12292, 0, 65479, 0, 41781, 10486, 41480, 120511, 9899, 0, 0, 404, - 12821, 3741, 0, 5788, 8092, 68212, 41222, 1831, 66020, 0, 0, 4388, 0, - 746, 120784, 0, 0, 12018, 65294, 0, 0, 0, 0, 4422, 4708, 3799, 74292, - 119357, 0, 74430, 0, 11700, 4374, 0, 0, 1364, 0, 8038, 0, 917597, 12868, - 69814, 0, 6735, 73979, 13174, 73968, 13225, 0, 69808, 65835, 0, 2365, - 7841, 0, 42855, 118856, 42866, 0, 0, 0, 66438, 41785, 41171, 64172, - 13173, 4372, 119354, 0, 0, 0, 0, 0, 0, 12965, 384, 64512, 10404, 10340, - 119352, 1556, 5274, 13210, 0, 10017, 9733, 41787, 0, 126994, 41373, - 78039, 12303, 0, 13232, 13233, 349, 4863, 41371, 11656, 0, 120703, - 119883, 12861, 4398, 8543, 65618, 0, 1096, 0, 0, 42688, 12441, 12355, - 119348, 119347, 4318, 10452, 0, 8032, 13243, 13237, 12719, 0, 119101, 0, - 64884, 119872, 119345, 8597, 0, 0, 9864, 0, 120785, 119874, 0, 13195, - 41452, 64961, 7722, 0, 10459, 119878, 0, 119879, 66590, 0, 41533, 66337, - 0, 0, 0, 4965, 0, 917536, 73849, 0, 43638, 78537, 0, 6261, 119342, 43147, - 66570, 1957, 10420, 982, 2756, 13292, 13206, 0, 0, 2925, 73809, 13056, - 127559, 13212, 43238, 0, 13190, 13187, 0, 13198, 118793, 0, 5242, 119179, - 64476, 1694, 8216, 0, 6770, 43331, 0, 65620, 0, 43544, 0, 0, 41444, - 65621, 120325, 64799, 5246, 120326, 13185, 9709, 120323, 120322, 12314, - 65616, 5238, 119333, 0, 119337, 5236, 40979, 0, 74201, 8286, 0, 3936, - 119331, 11699, 41347, 127249, 13235, 8842, 41248, 0, 4379, 13239, 12692, - 7969, 127266, 7219, 127250, 0, 120509, 0, 66224, 734, 2979, 120303, - 65619, 9872, 957, 64921, 1846, 66631, 41477, 119256, 120310, 74511, - 41770, 1670, 6442, 120317, 42446, 5379, 120318, 41163, 74832, 120315, - 120314, 0, 0, 42841, 13267, 0, 0, 41775, 0, 0, 41773, 0, 10663, 0, 0, 0, - 6151, 12110, 42673, 65572, 119602, 65250, 13265, 13264, 64518, 0, 6100, - 0, 0, 5808, 65922, 0, 12967, 66041, 5612, 4583, 0, 0, 68097, 64575, 0, - 11965, 0, 119211, 0, 69789, 0, 0, 68102, 9698, 7814, 74476, 119651, 0, 0, - 41921, 118858, 9756, 6985, 119258, 0, 74219, 0, 0, 118997, 8012, 5674, - 12353, 0, 12361, 5677, 5588, 0, 41925, 0, 41920, 5673, 120534, 5676, - 41923, 12694, 118978, 5672, 1294, 0, 78059, 0, 42511, 1727, 0, 42436, 0, - 0, 0, 74222, 8718, 3550, 736, 10268, 4505, 10316, 74090, 5826, 55232, - 5813, 0, 120712, 5841, 5837, 55234, 0, 3105, 12829, 5838, 5796, 0, - 119592, 5793, 0, 5866, 5797, 41011, 5865, 120091, 7956, 598, 0, 64649, - 5806, 42398, 0, 9037, 5671, 120041, 0, 0, 0, 0, 0, 847, 0, 9529, 0, - 66657, 6980, 0, 120035, 78484, 0, 0, 120033, 78486, 0, 0, 120039, 42683, - 0, 0, 9624, 0, 0, 43190, 65463, 1554, 0, 42611, 42563, 0, 5651, 2929, - 6792, 43201, 0, 19963, 5698, 0, 0, 0, 0, 5644, 10292, 65546, 69821, - 68141, 8372, 0, 65116, 0, 120022, 0, 10388, 42799, 0, 41013, 10568, 0, 0, - 2869, 0, 41015, 194692, 2785, 4366, 0, 10954, 41802, 0, 42608, 78469, - 9884, 4759, 0, 0, 10266, 41359, 1170, 43365, 69810, 73908, 1609, 902, 0, - 63936, 0, 11661, 8122, 5818, 0, 0, 3861, 9540, 11028, 2554, 5158, 5714, - 127015, 0, 0, 807, 43079, 0, 78475, 976, 5511, 64553, 0, 42155, 0, 41356, - 74110, 118801, 0, 0, 8676, 0, 0, 11066, 451, 63941, 5798, 9349, 42018, 0, - 0, 0, 43609, 194703, 120553, 1440, 0, 194701, 120016, 74283, 11005, 0, - 66656, 66044, 0, 194698, 0, 0, 43393, 10094, 0, 11529, 10857, 120643, - 66436, 6546, 93, 8102, 0, 68405, 0, 0, 8171, 0, 119097, 127064, 917543, - 383, 10377, 41656, 0, 0, 0, 5187, 0, 127277, 11286, 68620, 64217, 0, - 5232, 0, 41009, 0, 41005, 0, 0, 0, 8292, 195074, 4980, 8860, 73947, - 10028, 66478, 7076, 13182, 194705, 0, 0, 10631, 66031, 7972, 0, 78785, 0, - 7900, 0, 11309, 78319, 4198, 42725, 0, 67656, 78819, 0, 0, 0, 12931, 0, - 42684, 74285, 2088, 0, 64366, 65156, 8814, 42238, 74771, 0, 0, 12836, 0, - 0, 74342, 8593, 0, 0, 68445, 13255, 0, 0, 7464, 0, 65865, 0, 194650, 0, - 0, 9342, 120464, 0, 64516, 0, 78792, 10129, 41007, 74375, 0, 40995, - 12209, 41012, 119136, 0, 0, 120633, 40992, 0, 0, 68653, 43558, 5522, 0, - 61, 0, 74105, 3633, 0, 65162, 41234, 12089, 78281, 9771, 0, 13251, 0, 0, - 6262, 2784, 42743, 0, 8126, 66483, 0, 0, 441, 42621, 0, 0, 41002, 40999, - 119623, 43266, 0, 0, 10890, 74481, 65834, 8324, 119103, 64417, 74817, 0, - 64737, 0, 0, 8930, 66678, 74249, 1193, 10056, 1800, 13253, 13252, 7829, - 0, 0, 7743, 0, 0, 77904, 0, 77905, 9034, 6039, 0, 10075, 0, 41018, 65683, - 10338, 66469, 0, 0, 0, 42815, 0, 41966, 0, 0, 0, 11792, 43064, 41025, - 911, 7539, 0, 0, 120339, 65159, 64390, 0, 0, 5520, 11662, 0, 65330, - 42812, 0, 0, 12326, 0, 0, 42808, 0, 9348, 64901, 0, 0, 0, 0, 0, 0, - 917584, 43702, 0, 5857, 65342, 0, 119120, 120079, 8644, 0, 0, 0, 74296, - 41909, 0, 120332, 2791, 0, 1891, 69824, 0, 41907, 66647, 0, 8761, 12942, - 5748, 0, 10773, 0, 0, 8796, 78149, 6412, 2061, 8520, 13146, 0, 63931, 0, - 65902, 2882, 0, 0, 12843, 4520, 120345, 0, 0, 0, 0, 73860, 0, 0, 64345, - 0, 0, 0, 194940, 0, 0, 43679, 917585, 65117, 194939, 0, 10427, 0, 3844, - 0, 9755, 1110, 6612, 12222, 0, 194934, 0, 0, 783, 194935, 0, 0, 0, - 194720, 65056, 3620, 0, 68378, 4556, 0, 0, 194933, 74250, 0, 67657, - 10510, 4382, 66482, 0, 0, 0, 9177, 8902, 0, 9839, 0, 12891, 0, 0, 63999, - 2016, 41917, 9788, 63928, 0, 1862, 65800, 9155, 66623, 9786, 65082, - 41919, 8579, 41914, 7981, 0, 0, 4508, 64883, 0, 0, 0, 0, 64592, 74276, - 120080, 6784, 78788, 68181, 0, 0, 0, 127534, 12147, 9024, 66378, 66472, - 0, 64289, 65289, 78151, 66658, 194929, 64509, 78152, 0, 0, 11051, 0, 0, - 11355, 65885, 0, 0, 41214, 0, 12299, 0, 7500, 4506, 7773, 0, 0, 9963, - 68649, 0, 4040, 0, 6167, 0, 63922, 6594, 0, 0, 0, 3624, 43036, 0, 6387, - 63990, 19947, 63988, 41955, 0, 63993, 10440, 9611, 0, 6803, 0, 7738, - 63986, 11446, 63984, 120331, 3435, 78164, 0, 119108, 7029, 64258, 41292, - 118898, 12748, 42742, 9517, 11518, 0, 78790, 0, 194777, 63956, 42458, - 63954, 63953, 63960, 9591, 4516, 10217, 68370, 11469, 0, 42306, 2723, - 118947, 0, 0, 0, 0, 0, 11397, 2880, 0, 0, 2872, 0, 0, 3498, 4378, 917539, - 4270, 0, 65551, 68205, 6633, 43387, 0, 5230, 0, 0, 0, 0, 0, 8161, 393, - 12013, 0, 0, 0, 415, 63964, 63963, 42345, 0, 5183, 1877, 42498, 0, 2927, - 0, 63961, 4472, 0, 0, 78159, 0, 917936, 42340, 4756, 0, 7081, 10730, - 7691, 10331, 63830, 119625, 194945, 42103, 8628, 9813, 0, 42453, 1604, - 9565, 10539, 0, 65764, 41415, 65767, 0, 8457, 42301, 11372, 64873, 11992, - 0, 0, 63980, 11801, 3622, 0, 64336, 12017, 10463, 63981, 4967, 64189, - 1966, 43628, 0, 0, 0, 0, 63971, 4347, 4416, 42098, 11009, 10694, 63973, - 402, 0, 13147, 0, 42100, 64646, 13228, 0, 41875, 3515, 74252, 11805, 0, - 11302, 6259, 43395, 0, 0, 194670, 0, 0, 0, 74425, 11299, 1561, 0, 0, - 64942, 0, 194733, 0, 194732, 0, 74301, 0, 11280, 0, 69784, 74060, 0, 0, - 119664, 5145, 12486, 65018, 66516, 5409, 0, 194669, 7402, 5399, 9685, - 74089, 7952, 5401, 0, 66616, 68421, 0, 0, 5405, 917555, 64866, 0, 0, 0, - 78784, 74248, 11330, 194723, 64690, 3254, 0, 0, 0, 42390, 43678, 194725, - 0, 65077, 0, 6388, 3355, 9508, 9867, 5723, 11520, 5611, 0, 3377, 0, 0, 0, - 0, 78228, 0, 0, 42691, 917886, 0, 74767, 0, 0, 1379, 246, 0, 0, 3788, 0, - 11041, 0, 66304, 0, 0, 8917, 42403, 301, 0, 0, 0, 0, 0, 0, 10656, 0, - 65214, 119242, 42567, 0, 13163, 0, 120831, 74597, 3182, 0, 0, 0, 65034, - 65889, 42169, 4755, 74244, 0, 11443, 0, 66319, 74598, 608, 600, 0, 1219, - 3934, 64206, 11483, 74510, 0, 74485, 42442, 65470, 0, 64202, 13160, 7759, - 42482, 485, 0, 0, 9828, 0, 0, 42280, 0, 9351, 7778, 64379, 7496, 42431, - 6916, 1208, 0, 119631, 11002, 42470, 0, 118946, 0, 0, 74041, 0, 0, 43539, - 5411, 42196, 0, 0, 0, 9150, 0, 42393, 13086, 1310, 194687, 9337, 12052, - 10643, 55271, 0, 194684, 2546, 194683, 213, 118852, 65611, 0, 0, 194756, - 74310, 6554, 0, 11914, 0, 0, 0, 0, 0, 0, 194681, 118826, 2713, 0, 9650, - 43330, 0, 194675, 1406, 0, 0, 0, 0, 68223, 4143, 194677, 0, 65748, 4141, - 9682, 65287, 1508, 194963, 8779, 10569, 8725, 13299, 66638, 65750, 42263, - 4145, 6380, 65751, 66613, 43994, 65738, 55250, 9185, 9550, 0, 43403, 0, - 0, 0, 65736, 41951, 64816, 65756, 0, 12955, 10596, 2888, 0, 0, 0, 9657, - 9019, 194766, 0, 2878, 5390, 0, 194961, 0, 68679, 0, 7501, 6328, 0, - 10429, 10365, 0, 0, 41946, 7503, 5235, 803, 68381, 0, 0, 8986, 0, 10632, - 11934, 11452, 1332, 0, 0, 0, 0, 118887, 1791, 5191, 9288, 64822, 2892, 0, - 43394, 555, 0, 0, 66646, 0, 119002, 13151, 74512, 7289, 74055, 0, 8854, - 64162, 5858, 41927, 10582, 0, 1784, 1361, 195047, 0, 7905, 0, 64868, 0, - 13158, 0, 7211, 0, 9371, 73973, 0, 6828, 1625, 0, 0, 1342, 68440, 64171, - 0, 10903, 0, 0, 0, 0, 0, 4482, 41606, 0, 0, 0, 0, 64381, 0, 0, 0, 42245, - 0, 41972, 0, 444, 0, 9127, 66687, 66619, 0, 78025, 0, 11349, 40991, 0, 0, - 119599, 120830, 0, 1197, 0, 1149, 194970, 0, 0, 40990, 0, 0, 3492, 0, 0, - 0, 0, 0, 12838, 0, 19948, 0, 3099, 0, 0, 41087, 0, 0, 0, 119059, 12036, - 0, 0, 0, 8152, 0, 64428, 12227, 0, 0, 12828, 127511, 0, 0, 120708, 0, 0, - 10386, 119574, 0, 0, 0, 0, 68154, 0, 1743, 0, 0, 0, 65186, 0, 0, 9606, 0, - 0, 0, 0, 0, 0, 0, 0, 194967, 0, 0, 3395, 9362, 10878, 0, 0, 78362, 64830, - 0, 0, 41091, 3426, 1344, 8870, 0, 0, 4735, 0, 6119, 12822, 42699, 0, 0, - 74818, 0, 0, 42637, 41080, 0, 12039, 10559, 0, 118892, 0, 9472, 0, 11929, - 0, 7170, 9596, 6130, 0, 43629, 11579, 194741, 0, 194740, 0, 0, 66699, 0, - 1004, 0, 194737, 43234, 66008, 12627, 0, 68414, 0, 43619, 43382, 11300, - 43304, 9686, 5890, 11776, 7558, 0, 65627, 0, 10718, 13154, 3461, 9139, 0, - 0, 0, 0, 65365, 73877, 65628, 78019, 0, 0, 41708, 12860, 41703, 12069, - 10838, 5403, 10352, 73917, 10061, 43237, 0, 5140, 209, 0, 41704, 41056, - 43078, 0, 0, 0, 10899, 65469, 0, 0, 0, 2410, 993, 0, 120589, 120689, - 78693, 0, 0, 7232, 0, 119253, 0, 0, 74462, 2066, 10489, 42166, 43463, - 10659, 3600, 0, 4224, 1336, 41518, 0, 0, 0, 0, 41139, 64820, 0, 12966, - 41134, 0, 0, 0, 0, 272, 4263, 8793, 0, 0, 41502, 0, 983, 12549, 0, 0, - 1190, 4109, 1335, 841, 5888, 41358, 64863, 9544, 43481, 0, 0, 0, 2099, - 5120, 2409, 7799, 0, 74424, 0, 0, 4731, 0, 66629, 0, 0, 1255, 4149, 9247, - 0, 9913, 0, 0, 64914, 917787, 65101, 0, 11694, 0, 11690, 5835, 0, 66625, - 10842, 41354, 42123, 43097, 11688, 66634, 1094, 194, 64692, 0, 8180, 0, - 0, 9972, 73865, 4519, 6114, 10898, 43072, 0, 0, 0, 0, 0, 10695, 0, 7540, - 0, 881, 7857, 6067, 65164, 0, 0, 0, 13311, 68403, 41857, 64321, 8359, 0, - 12689, 0, 194594, 0, 0, 0, 68183, 0, 0, 1287, 5436, 0, 0, 74142, 127013, - 74152, 119078, 6051, 10497, 0, 8985, 12109, 0, 0, 0, 0, 0, 3652, 10537, - 0, 1276, 120440, 6549, 279, 73745, 0, 0, 0, 1489, 0, 0, 0, 3899, 1007, - 42124, 0, 42122, 0, 0, 0, 11985, 1345, 78600, 0, 0, 8956, 43083, 119830, - 42138, 78610, 0, 12151, 78608, 78604, 78605, 6285, 78603, 78612, 78613, - 74194, 492, 8685, 0, 0, 0, 78622, 43712, 2582, 11470, 64538, 7444, 78615, - 78616, 41550, 0, 73837, 119823, 2527, 119824, 197, 2799, 0, 41944, - 120276, 9933, 0, 66515, 767, 5524, 7028, 0, 0, 119827, 119817, 119828, - 78633, 10896, 0, 1799, 120497, 6971, 74336, 0, 0, 65340, 118979, 41551, - 2434, 0, 0, 120579, 0, 4631, 0, 0, 6407, 0, 6338, 43214, 0, 7570, 0, - 3192, 0, 8414, 0, 0, 0, 0, 0, 9164, 66612, 0, 3171, 6623, 4961, 68396, - 886, 55216, 8654, 78832, 9993, 74390, 64603, 0, 69241, 9599, 78629, - 43084, 78627, 78628, 78625, 2399, 0, 8994, 10944, 41208, 0, 41168, 8178, - 0, 3367, 195008, 42510, 78641, 78636, 6804, 78634, 1947, 0, 0, 0, 42759, - 11068, 1705, 9331, 0, 74798, 9181, 65359, 0, 8017, 0, 65096, 66720, 0, - 43475, 0, 4909, 12126, 0, 120696, 4904, 0, 195012, 1365, 9253, 42757, - 43436, 7462, 0, 0, 0, 0, 119587, 64415, 0, 0, 5398, 0, 195014, 0, 0, 0, - 119015, 0, 0, 9476, 0, 0, 12763, 0, 3629, 0, 13005, 0, 3628, 0, 0, 0, - 3469, 42107, 42116, 917578, 64809, 2928, 4905, 9853, 851, 9040, 0, 64665, - 43086, 9114, 0, 42583, 9315, 4822, 4906, 3852, 2847, 119821, 3236, 11317, - 1251, 7777, 41852, 11410, 10964, 0, 43222, 12646, 120269, 10259, 9865, - 65821, 0, 6018, 119814, 0, 12276, 0, 68372, 0, 0, 119244, 0, 0, 10467, 0, - 2443, 10918, 78217, 119825, 1001, 9241, 1927, 0, 0, 73987, 0, 0, 0, - 118828, 127504, 65678, 12867, 0, 8260, 77945, 7519, 11505, 12274, 8904, - 518, 65857, 0, 0, 13204, 4387, 857, 0, 65369, 0, 119583, 43125, 120592, - 0, 0, 0, 0, 5136, 1968, 0, 195023, 1337, 64967, 1629, 0, 796, 66506, 0, - 74123, 12877, 0, 42314, 43388, 0, 74403, 6120, 478, 65151, 68128, 0, - 43082, 6016, 0, 42284, 0, 4276, 1206, 3619, 41638, 0, 3843, 12011, 8853, - 3361, 0, 490, 10715, 7578, 68384, 0, 65350, 10530, 12348, 8653, 74314, - 42435, 6154, 9551, 65354, 78522, 784, 42397, 334, 0, 42416, 65356, 65273, - 77987, 127265, 4442, 10364, 0, 778, 41626, 42455, 7989, 74063, 3227, 0, - 127275, 73983, 2915, 11502, 41022, 41702, 10309, 127035, 78320, 0, 6975, - 0, 5415, 12176, 0, 0, 3462, 65215, 42629, 78691, 73784, 0, 0, 9759, 0, - 78324, 127254, 8114, 78698, 78697, 78696, 78695, 8710, 42495, 118956, 0, - 4051, 10460, 43364, 118917, 1356, 12161, 42713, 0, 127268, 1619, 9703, - 43152, 42489, 42112, 0, 1875, 10808, 42109, 120284, 41860, 64862, 13305, - 64907, 5289, 13144, 0, 0, 5575, 9675, 0, 5940, 226, 2649, 6336, 0, 0, - 43236, 3382, 42449, 6498, 1658, 11936, 78232, 0, 11269, 10151, 73759, - 43100, 74449, 65508, 0, 0, 0, 8935, 917985, 0, 0, 0, 616, 74753, 65178, - 4684, 78701, 119653, 0, 0, 0, 6048, 74460, 42110, 73965, 10870, 8557, - 11054, 68664, 119049, 9681, 4475, 0, 41142, 2100, 0, 120731, 6035, 0, - 7651, 10296, 0, 0, 0, 917987, 0, 118966, 74144, 40997, 0, 10392, 10328, - 40998, 43462, 74488, 0, 9800, 8979, 0, 119131, 41000, 0, 119239, 6487, - 10977, 0, 10344, 0, 65299, 5394, 43246, 78243, 10220, 66505, 41200, 0, - 4425, 0, 0, 0, 43074, 73799, 0, 78147, 0, 12173, 78545, 0, 0, 65338, 0, - 0, 119582, 4474, 0, 43093, 0, 1587, 0, 127372, 64475, 0, 1369, 0, 78251, - 7927, 0, 4560, 0, 0, 0, 0, 64948, 4430, 74347, 42601, 4514, 66434, 0, - 8194, 65462, 10626, 10965, 0, 8893, 0, 12542, 0, 65341, 0, 65829, 7925, - 119822, 10475, 0, 0, 1352, 11069, 7707, 127560, 0, 65279, 127102, 68207, - 127100, 65605, 6040, 127097, 10071, 0, 9336, 0, 0, 8899, 7798, 64474, - 64259, 0, 65188, 7820, 43018, 0, 0, 7746, 1492, 78551, 10884, 77982, 0, - 5127, 11285, 42501, 5495, 4273, 43095, 41426, 10849, 5730, 2999, 6342, - 68636, 74304, 371, 64373, 6023, 169, 5497, 11708, 0, 0, 6323, 0, 8224, 0, - 8938, 6043, 12738, 0, 0, 5321, 0, 0, 0, 2589, 74332, 1689, 7802, 4683, - 74318, 42704, 120296, 11905, 0, 0, 0, 0, 74513, 6049, 0, 4027, 834, - 118962, 1803, 0, 1503, 0, 0, 0, 5731, 1381, 2387, 0, 0, 8289, 64525, - 65817, 2881, 43142, 0, 9601, 2879, 9668, 9766, 0, 5729, 917833, 74410, - 6036, 64881, 4026, 9361, 127091, 2887, 0, 3526, 6298, 0, 77897, 0, 78519, - 0, 8572, 6021, 77896, 0, 77895, 43155, 0, 0, 3146, 10959, 9483, 0, 77893, - 10981, 166, 917841, 8635, 0, 10623, 408, 119058, 127507, 13298, 0, 7426, - 41641, 12717, 0, 7607, 10639, 66713, 0, 0, 41643, 74134, 0, 8713, 41640, - 10221, 41645, 66712, 6645, 646, 66726, 66711, 42129, 0, 77901, 3472, - 8697, 0, 0, 0, 0, 0, 0, 5809, 1950, 119356, 0, 74572, 0, 42136, 0, 0, 0, - 0, 3247, 119854, 65017, 0, 68428, 66668, 0, 0, 10983, 0, 0, 0, 41567, 0, - 0, 0, 194624, 0, 0, 0, 8285, 0, 4509, 0, 66471, 12216, 0, 40988, 0, 0, - 41727, 0, 0, 2396, 0, 0, 74018, 917538, 64940, 0, 3886, 0, 42457, 119008, - 0, 996, 68123, 917571, 4249, 0, 917594, 11707, 8222, 0, 7939, 0, 917574, - 917582, 917592, 917569, 8534, 0, 40983, 0, 0, 0, 7201, 12561, 0, 42371, - 12558, 0, 0, 10052, 40982, 0, 0, 1488, 0, 0, 0, 917559, 0, 0, 1563, 0, - 9619, 0, 0, 0, 0, 0, 5803, 7797, 6070, 10006, 0, 2922, 6082, 0, 65009, 0, - 12567, 0, 0, 41412, 0, 0, 3607, 65863, 10046, 9612, 42153, 8218, 9485, 0, - 2032, 78354, 0, 0, 0, 0, 0, 43085, 6057, 508, 0, 0, 120265, 0, 0, 0, 0, - 638, 6083, 119072, 0, 0, 2305, 78348, 0, 0, 6056, 6659, 0, 0, 6085, 0, 0, - 3915, 41634, 0, 41639, 63912, 11941, 0, 4028, 1787, 42180, 43096, 0, - 3249, 1768, 0, 12328, 501, 127074, 10601, 0, 583, 0, 41977, 0, 66004, - 119350, 6505, 74010, 0, 13064, 55267, 120810, 6500, 5526, 65049, 0, - 73764, 0, 0, 12745, 9678, 0, 120587, 9869, 0, 1771, 0, 8936, 0, 0, 4208, - 78341, 119115, 78342, 0, 0, 74101, 0, 11762, 0, 0, 77997, 0, 66475, 0, - 5027, 0, 0, 0, 5069, 73862, 5028, 9897, 0, 73739, 5026, 0, 68639, 6331, - 0, 8931, 0, 1415, 8866, 41901, 74790, 78138, 119361, 0, 43106, 5029, - 65309, 1580, 3598, 68424, 41070, 77903, 0, 3440, 78215, 1562, 0, 127236, - 119358, 1716, 0, 10600, 0, 620, 41001, 6028, 0, 42892, 0, 74822, 5024, - 120829, 41003, 0, 5025, 0, 0, 0, 119328, 0, 65557, 0, 74541, 0, 11599, 0, - 11602, 6243, 11574, 11581, 11597, 11598, 6253, 6105, 11584, 74195, 11569, - 65275, 8906, 127096, 5755, 2636, 0, 10815, 11619, 78717, 41540, 7815, - 11616, 6979, 12080, 7721, 11604, 7869, 1592, 0, 42152, 78498, 41048, 0, - 829, 0, 0, 19950, 0, 0, 6616, 0, 118875, 10953, 391, 0, 69785, 482, - 42296, 11588, 0, 43606, 0, 68397, 66370, 0, 42335, 0, 0, 0, 7538, 5315, - 0, 42491, 0, 42061, 0, 4576, 0, 68417, 120241, 4277, 0, 4039, 64472, - 42338, 368, 42058, 3960, 11043, 11337, 78209, 917820, 63989, 3958, 12132, - 1849, 0, 9921, 42451, 4253, 41147, 42064, 11959, 42404, 41160, 0, 3618, - 78338, 0, 43300, 5156, 0, 0, 929, 6827, 42035, 42437, 1555, 0, 8691, - 66435, 0, 41662, 0, 0, 0, 0, 0, 4578, 64513, 41664, 0, 42578, 0, 41661, - 78715, 43305, 9356, 0, 0, 0, 1286, 10166, 0, 0, 64707, 0, 42476, 7730, 0, - 0, 42483, 0, 0, 42324, 42291, 10020, 43359, 0, 6641, 525, 41627, 0, 8763, - 0, 41628, 533, 11931, 65225, 8321, 42504, 42581, 0, 6915, 42310, 4377, - 8559, 0, 120234, 0, 13193, 64350, 11666, 8679, 41924, 1576, 7735, 0, 0, - 73840, 0, 11374, 78043, 10889, 43461, 7757, 42462, 120226, 10029, 66493, - 2718, 4168, 73842, 13308, 120112, 0, 1179, 4440, 0, 77948, 363, 11015, - 77947, 77944, 64296, 127090, 66692, 120826, 0, 66492, 6593, 64625, 41963, - 0, 119329, 0, 10013, 0, 0, 127095, 9492, 11782, 64382, 12833, 118986, 0, - 1297, 41630, 630, 127094, 0, 120774, 120570, 1043, 43652, 66223, 10090, - 0, 0, 313, 917563, 41881, 0, 42311, 7445, 0, 5750, 10759, 9419, 55222, - 9405, 11268, 0, 9398, 8526, 9399, 9422, 0, 66495, 0, 0, 127239, 41718, - 10707, 1603, 0, 119003, 0, 631, 77952, 77953, 13161, 65272, 0, 10546, - 74210, 78101, 11600, 77961, 2797, 73821, 42427, 306, 714, 3058, 42381, - 77962, 127080, 12351, 42395, 0, 11607, 0, 42282, 77971, 77967, 9157, - 73765, 66364, 42433, 77964, 7603, 12803, 180, 42141, 0, 120612, 66494, - 12674, 8244, 362, 0, 0, 8037, 917803, 11535, 0, 74845, 5185, 66696, 5521, - 10334, 2093, 77983, 10302, 0, 10104, 1027, 5181, 0, 0, 10523, 1446, - 42320, 41646, 991, 5189, 42472, 41647, 120105, 1722, 5581, 77979, 3405, - 0, 194644, 5523, 0, 42620, 0, 0, 9549, 0, 10549, 55282, 9661, 43682, 0, - 77910, 120026, 78708, 0, 77911, 0, 41991, 0, 0, 7630, 9846, 7684, 10350, - 0, 1174, 77981, 42733, 77978, 77980, 66485, 77977, 42277, 77974, 42456, - 65667, 0, 12330, 0, 0, 42417, 42383, 0, 41344, 6293, 0, 66252, 77984, - 74443, 0, 10209, 8313, 4195, 74435, 1316, 66690, 120032, 6332, 64894, 0, - 65871, 78060, 1736, 0, 3901, 12228, 120151, 65200, 3383, 10446, 78841, - 693, 9130, 314, 64149, 42420, 11949, 0, 120152, 11026, 0, 5332, 6940, - 64154, 12635, 127007, 42706, 1751, 273, 8165, 13166, 120763, 78840, 0, - 12824, 0, 4528, 5320, 6301, 43662, 6133, 9339, 9463, 42346, 10922, 64560, - 3757, 0, 0, 0, 65869, 73760, 2569, 0, 2326, 65740, 2565, 42459, 7596, - 7921, 0, 74095, 0, 41848, 2567, 66006, 0, 4044, 0, 0, 12233, 0, 1023, - 474, 0, 119818, 0, 0, 42487, 65556, 0, 0, 42295, 0, 0, 0, 0, 9835, 66499, - 0, 5417, 12275, 10895, 0, 274, 0, 1858, 0, 0, 55251, 10118, 3133, 0, - 73795, 0, 9610, 8068, 8197, 0, 699, 0, 41665, 5868, 0, 0, 42182, 7581, - 19940, 43668, 41667, 0, 0, 1923, 65583, 65802, 0, 64597, 43444, 119184, - 0, 0, 6464, 7036, 2996, 1937, 0, 0, 41835, 4047, 41842, 0, 64107, 0, 0, - 11017, 0, 0, 293, 77966, 0, 64791, 41827, 42466, 43422, 10579, 8560, 0, - 65413, 77963, 4803, 12964, 1739, 1941, 3900, 0, 1713, 77969, 0, 73957, - 11407, 42441, 41971, 6297, 120098, 64105, 0, 42481, 11716, 66473, 7179, - 42289, 0, 64103, 969, 0, 9352, 0, 6165, 64100, 0, 6632, 73861, 42402, - 74327, 7806, 0, 8914, 0, 0, 3183, 1435, 64876, 2969, 6046, 0, 6208, - 67849, 5746, 73749, 0, 64416, 42422, 0, 0, 7082, 73775, 338, 5059, - 194719, 0, 42328, 10767, 0, 8115, 0, 0, 0, 8227, 2073, 1218, 0, 0, 65848, - 0, 0, 0, 0, 126987, 4486, 0, 0, 0, 10925, 0, 0, 0, 0, 42309, 10257, 0, - 10273, 0, 10305, 42461, 0, 42349, 8832, 78051, 64127, 10644, 42662, - 78828, 42278, 74451, 126988, 917857, 7794, 0, 42429, 6377, 42316, 119026, - 3669, 3968, 42468, 0, 78544, 0, 65402, 119581, 0, 0, 64933, 0, 41960, - 6699, 0, 0, 0, 6823, 42391, 1588, 65400, 8409, 78223, 19967, 65398, 787, - 0, 917939, 0, 6115, 2078, 41654, 42480, 0, 0, 41655, 65401, 43975, 0, 0, - 0, 644, 65500, 41657, 10778, 3659, 9533, 184, 1553, 13107, 65484, 0, - 10502, 74457, 0, 0, 41554, 0, 8220, 917943, 41557, 0, 0, 11070, 119221, - 5157, 4020, 73858, 41555, 9514, 64818, 65103, 64641, 64303, 78131, 7520, - 0, 74377, 11029, 66651, 0, 0, 118930, 64527, 0, 7877, 73803, 0, 0, - 120096, 74602, 9955, 0, 4055, 42817, 0, 65212, 11715, 12190, 12319, - 78630, 0, 78631, 9502, 65427, 0, 65424, 12607, 0, 9734, 65425, 0, 0, 0, - 78835, 0, 10112, 10827, 0, 9866, 74527, 66675, 0, 8625, 64346, 11290, - 10477, 0, 8636, 0, 8315, 65444, 0, 0, 74595, 6152, 0, 0, 6629, 0, 120171, - 0, 74589, 43993, 0, 69790, 0, 0, 43690, 11046, 11490, 42730, 4485, 0, 0, - 64926, 0, 0, 0, 5869, 12437, 42728, 0, 7040, 3588, 0, 12825, 0, 0, 12725, - 0, 0, 78642, 223, 0, 69806, 120166, 42444, 0, 64499, 65245, 0, 1171, 0, - 120165, 0, 1805, 8772, 0, 0, 9930, 65247, 78619, 120111, 2338, 0, 118853, - 0, 42676, 0, 64800, 65236, 67644, 68126, 1213, 0, 64075, 797, 64074, - 8734, 4212, 0, 64387, 4115, 0, 5005, 64070, 64073, 10679, 0, 77954, 0, - 64276, 426, 0, 0, 8251, 10136, 65436, 0, 65088, 43302, 1224, 0, 65576, - 120158, 10701, 1764, 3101, 0, 65291, 120159, 0, 11373, 6378, 0, 120103, - 8663, 9312, 41644, 4539, 3787, 0, 9222, 0, 0, 4259, 9092, 74567, 41961, - 0, 12724, 66357, 42331, 64935, 0, 0, 1293, 7947, 12003, 0, 74593, 120308, - 2454, 42717, 3613, 0, 0, 0, 65888, 8816, 10978, 10840, 0, 10668, 0, - 43087, 12595, 120304, 0, 118806, 0, 1157, 64903, 8638, 0, 0, 0, 0, - 120319, 8235, 120316, 4405, 10086, 120247, 0, 69216, 0, 65430, 74013, - 6079, 6817, 10764, 0, 64291, 0, 998, 120312, 11062, 1317, 64327, 1558, 0, - 1991, 7882, 42254, 0, 41700, 530, 0, 10428, 119335, 12002, 119336, 5742, - 43076, 4692, 64630, 41823, 4007, 5004, 119334, 7896, 751, 6595, 6596, 0, - 66373, 0, 0, 64908, 0, 6311, 0, 12004, 119192, 12049, 43108, 0, 0, 41705, - 0, 6598, 0, 6599, 0, 0, 42148, 118825, 66027, 0, 6597, 9412, 8340, 11824, - 64745, 0, 0, 0, 1988, 5407, 67865, 2430, 41678, 0, 120243, 2336, 0, 0, - 78871, 120442, 0, 1921, 10947, 19927, 0, 65406, 0, 19913, 4284, 13217, 0, - 0, 12841, 9229, 10956, 42285, 41674, 19964, 41679, 65084, 3521, 0, 5774, - 8325, 0, 65403, 0, 1854, 10794, 0, 67660, 0, 0, 78359, 5280, 0, 4344, - 12905, 65433, 6076, 64793, 41610, 768, 12074, 442, 0, 68162, 64081, - 12934, 41682, 65432, 41693, 0, 6071, 65434, 0, 4804, 4053, 0, 0, 194653, - 41696, 467, 69823, 0, 69797, 0, 0, 8421, 0, 0, 43705, 502, 0, 65431, - 119056, 0, 12043, 1303, 316, 0, 2029, 65191, 119246, 11533, 64365, 43480, - 0, 4860, 194645, 0, 42488, 0, 9583, 0, 5546, 8019, 73856, 0, 0, 0, 5544, - 2355, 12150, 65725, 5543, 77989, 63751, 12137, 5548, 77985, 0, 65727, - 68388, 65726, 6077, 0, 65452, 0, 11301, 78013, 78008, 78010, 9874, 78007, - 0, 0, 3050, 65410, 0, 0, 78016, 78017, 42830, 43996, 66716, 0, 4691, 0, - 9345, 621, 0, 0, 0, 65411, 0, 41182, 73881, 65408, 73899, 78024, 9474, - 10545, 119118, 10887, 3786, 65409, 8894, 43179, 119611, 7923, 3716, - 119341, 9996, 8508, 0, 7012, 8195, 0, 9566, 0, 3722, 0, 41707, 8493, 545, - 9575, 41379, 10050, 12718, 0, 8859, 6820, 74345, 65110, 120740, 0, 0, - 9119, 2787, 7920, 118823, 4021, 2012, 7985, 0, 119663, 0, 0, 78021, - 78022, 410, 78020, 1802, 78018, 74107, 0, 41659, 41671, 1827, 0, 64396, - 10126, 12116, 41673, 120370, 11422, 78141, 120373, 3860, 120367, 68412, - 41345, 120362, 120363, 11748, 42158, 7941, 11076, 8749, 120361, 2104, - 64858, 361, 120357, 845, 0, 41560, 11970, 4562, 917920, 2926, 0, 4569, - 74130, 0, 43487, 194630, 611, 74129, 64871, 120379, 65629, 0, 0, 0, 0, 0, - 120543, 0, 0, 6291, 0, 78639, 41669, 7094, 917921, 0, 0, 74054, 0, - 195029, 0, 839, 0, 7695, 8769, 65246, 4829, 0, 4859, 64467, 0, 0, 118998, - 7206, 0, 6647, 43986, 0, 69766, 0, 64764, 4210, 0, 0, 804, 0, 0, 12298, - 0, 66653, 0, 64924, 10091, 73931, 9468, 74245, 0, 0, 74246, 0, 12839, - 64669, 0, 0, 1279, 1425, 6224, 119229, 11049, 0, 917549, 43239, 8482, 0, - 0, 5032, 77830, 11940, 67888, 664, 0, 5034, 0, 0, 127525, 42702, 73888, - 0, 13294, 67873, 64869, 6032, 0, 9115, 7430, 120377, 0, 120819, 68387, - 120168, 73913, 120170, 41161, 5518, 4174, 10993, 41162, 120160, 64528, - 1169, 434, 41437, 1905, 6034, 41164, 64744, 9528, 118867, 194668, 524, 0, - 74029, 788, 74027, 0, 0, 0, 1663, 10419, 74025, 42636, 0, 0, 0, 120656, - 0, 67876, 0, 0, 0, 67897, 74039, 0, 0, 11395, 0, 119107, 43612, 64344, 0, - 0, 10855, 5445, 9355, 0, 65198, 7391, 8989, 221, 65686, 0, 0, 8010, 7191, - 4962, 69772, 8855, 0, 0, 64469, 120426, 10555, 0, 43333, 0, 0, 120427, - 10451, 0, 67653, 7245, 12443, 74405, 9947, 120149, 78317, 3873, 8367, 0, - 120146, 43433, 43649, 11987, 0, 0, 11010, 12723, 74059, 74062, 6217, - 5896, 0, 7682, 74049, 1462, 10235, 0, 0, 0, 0, 0, 0, 42595, 0, 74402, - 118860, 0, 120419, 0, 74052, 0, 0, 120549, 119082, 64295, 120418, 0, - 64765, 73923, 120417, 120662, 120730, 0, 6216, 0, 10755, 9455, 0, 8124, - 127042, 9470, 6944, 0, 0, 0, 2828, 0, 531, 42638, 0, 0, 0, 43428, 8204, - 3614, 2827, 9696, 0, 0, 8728, 4354, 10904, 78562, 19936, 7833, 120691, 0, - 42599, 42597, 42709, 120409, 127044, 0, 8537, 0, 0, 0, 0, 0, 41199, - 10121, 2028, 0, 0, 0, 0, 3062, 0, 74447, 12608, 0, 66440, 7545, 9700, - 12580, 0, 120777, 120502, 41155, 0, 74071, 0, 0, 12713, 0, 0, 0, 78772, - 0, 1734, 0, 0, 0, 64594, 2456, 231, 0, 74167, 542, 0, 118786, 0, 0, 1230, - 0, 0, 3597, 4446, 10584, 74235, 0, 4037, 0, 8352, 0, 5687, 0, 64515, 0, - 0, 55265, 67846, 78434, 9704, 0, 0, 74284, 0, 0, 8660, 0, 0, 0, 78773, - 74482, 4483, 1709, 120617, 9909, 6080, 0, 0, 1746, 1315, 8667, 0, 0, - 13140, 65899, 10604, 0, 4480, 11266, 0, 1226, 6930, 0, 0, 6360, 10897, - 41230, 605, 0, 74785, 120356, 0, 0, 41500, 0, 311, 11453, 6221, 10608, - 64943, 74280, 10877, 118868, 64885, 74272, 0, 0, 0, 120736, 74312, 345, - 0, 74456, 64606, 9917, 0, 0, 5037, 0, 1776, 8422, 0, 118814, 41508, - 41201, 323, 43328, 0, 42698, 1295, 0, 4625, 0, 4630, 13117, 0, 0, 65123, - 11293, 2668, 11288, 0, 42640, 65666, 2519, 0, 65420, 0, 0, 4252, 5049, - 42659, 119011, 706, 7754, 10854, 8738, 0, 65419, 0, 0, 649, 65421, 0, - 66702, 0, 12670, 1013, 0, 64919, 705, 0, 65422, 0, 1183, 0, 7017, 42852, - 0, 8157, 9736, 64503, 65418, 0, 0, 74035, 0, 11913, 73874, 6696, 0, 8920, - 0, 0, 7962, 12211, 9837, 2051, 66227, 0, 4184, 0, 0, 10177, 73777, 1857, - 0, 4626, 8464, 8472, 0, 4629, 8499, 78321, 78322, 4624, 7818, 119173, 0, - 0, 7805, 0, 0, 6935, 0, 78325, 78326, 78323, 43327, 43989, 119046, 8492, - 8250, 8459, 0, 8497, 8496, 0, 0, 78336, 78339, 9543, 78335, 78332, 77832, - 65849, 77831, 0, 0, 12451, 0, 8684, 0, 6102, 0, 5298, 0, 5294, 0, 0, 0, - 195062, 9949, 119826, 43617, 119215, 0, 12073, 0, 0, 77863, 13108, 0, - 74397, 41468, 0, 0, 5292, 55272, 0, 1939, 5302, 3970, 0, 12455, 1793, 0, - 0, 0, 6643, 0, 65263, 0, 78330, 41293, 78328, 78329, 0, 13219, 9569, 0, - 74383, 0, 0, 0, 5500, 8813, 0, 0, 74566, 5322, 0, 78340, 43631, 5324, - 66443, 3784, 41614, 65269, 6230, 78349, 78345, 43324, 3360, 78344, 11523, - 0, 0, 9926, 7197, 0, 68429, 0, 41821, 1249, 78360, 78361, 78356, 78358, - 78353, 64899, 64763, 41149, 41807, 43162, 41815, 41150, 0, 10571, 10096, - 0, 0, 78074, 6947, 41152, 887, 9249, 6565, 78510, 41990, 78509, 41811, - 74466, 0, 6670, 77882, 0, 0, 43092, 43325, 0, 10168, 0, 9781, 194610, - 9190, 0, 9666, 8269, 65944, 74005, 13019, 11670, 0, 315, 12813, 0, 78432, - 78256, 78351, 78352, 0, 0, 0, 0, 1378, 9509, 0, 0, 74475, 3066, 0, 67847, - 0, 0, 0, 78365, 8787, 0, 194616, 41618, 194615, 78261, 194614, 0, 64652, - 0, 194612, 0, 78366, 42088, 0, 0, 7176, 0, 10137, 6121, 10995, 78259, - 74534, 8119, 64874, 917816, 0, 0, 0, 74525, 0, 0, 12930, 1394, 74514, 0, - 74515, 0, 118804, 2998, 9527, 120659, 65190, 12977, 42090, 119165, 0, - 119100, 41236, 0, 42005, 42003, 41237, 5848, 0, 0, 3670, 0, 194600, 0, 0, - 7890, 0, 11298, 43315, 0, 6229, 1593, 0, 0, 619, 4635, 65080, 0, 0, 4120, - 65337, 65336, 0, 11808, 119214, 74115, 9366, 42790, 42006, 0, 65327, - 65326, 65325, 10757, 1507, 42216, 65321, 65320, 65335, 65334, 65333, - 65332, 65331, 42059, 65329, 42689, 0, 9128, 118885, 42073, 6785, 64590, - 0, 4371, 7196, 65318, 2035, 65316, 4106, 65314, 65313, 42074, 0, 41228, - 0, 65609, 41241, 7903, 41239, 43533, 78459, 7189, 0, 0, 0, 12357, 42802, - 78450, 8487, 9131, 0, 4615, 12695, 0, 0, 12175, 0, 64535, 0, 7809, 0, 0, - 562, 12169, 6590, 69762, 66455, 64738, 3219, 68654, 0, 0, 1037, 0, 2025, - 0, 13098, 78442, 10637, 4568, 549, 1570, 0, 2835, 0, 10624, 43623, 11072, - 0, 0, 0, 12606, 78433, 2825, 0, 10825, 8079, 2821, 41046, 0, 0, 0, - 120593, 13071, 0, 452, 41049, 42840, 6346, 2831, 5461, 74596, 11465, - 5212, 0, 64703, 119191, 42308, 7181, 0, 41332, 0, 12333, 0, 1668, 0, 0, - 0, 1187, 0, 42628, 78575, 0, 0, 0, 3240, 0, 12194, 0, 11591, 41065, 5323, - 8166, 0, 0, 0, 74535, 1623, 65297, 0, 571, 0, 4918, 0, 5288, 127295, - 8916, 65048, 1909, 8864, 0, 0, 10736, 0, 11571, 7615, 0, 0, 4237, 0, - 1035, 65815, 0, 7881, 701, 65936, 3489, 0, 0, 120751, 11403, 0, 0, 0, - 3796, 6800, 0, 3994, 11421, 0, 0, 0, 0, 0, 0, 64857, 0, 2855, 0, 66308, - 41621, 68214, 0, 0, 10654, 0, 119226, 12164, 3246, 7906, 43972, 65847, - 7182, 0, 13024, 194822, 74270, 0, 0, 0, 0, 1496, 747, 0, 942, 2378, - 43136, 0, 8466, 0, 9320, 8001, 1232, 8139, 11617, 0, 0, 11409, 68373, - 6382, 0, 64634, 0, 0, 11612, 0, 67600, 2374, 0, 8475, 11609, 66313, 0, 0, - 5286, 119297, 0, 0, 64925, 0, 0, 118982, 194583, 7705, 11942, 11305, - 194581, 3309, 0, 0, 0, 0, 6802, 0, 41653, 1280, 1241, 7168, 12096, 0, - 66615, 42565, 41651, 0, 0, 0, 41650, 66507, 66470, 0, 12914, 41491, - 66010, 119552, 6078, 65100, 0, 1475, 0, 9938, 6084, 917546, 41064, 41062, - 0, 0, 3256, 0, 42076, 43252, 78823, 0, 8727, 0, 65875, 0, 0, 0, 10562, - 74215, 43065, 0, 0, 3248, 74297, 3261, 9015, 0, 0, 3635, 64337, 0, 0, 0, - 7195, 0, 2007, 64431, 0, 0, 0, 0, 635, 0, 0, 65613, 77909, 0, 73997, 0, - 0, 119218, 7984, 8600, 74434, 0, 4176, 0, 2034, 0, 120805, 65891, 127038, - 0, 318, 2038, 0, 78596, 0, 3649, 13149, 42145, 42798, 3634, 120291, - 118927, 67677, 120124, 7866, 0, 11402, 42146, 120134, 74238, 42664, 2849, - 127034, 0, 7938, 12960, 1761, 11812, 65379, 68386, 0, 1159, 0, 0, 0, 0, - 7178, 194632, 0, 41680, 0, 0, 11534, 1514, 11668, 67891, 9313, 7015, 0, - 67877, 0, 12989, 66474, 9368, 12848, 1624, 43270, 0, 194563, 10818, - 194562, 9953, 0, 78421, 1194, 3242, 9761, 9555, 8598, 120299, 6169, - 12871, 1551, 2798, 65176, 120298, 42752, 119025, 0, 67875, 120301, 3495, - 66648, 0, 0, 68364, 0, 4891, 0, 10641, 0, 73746, 0, 68352, 0, 73787, 0, - 194633, 7199, 64955, 0, 0, 0, 0, 0, 42685, 42679, 193, 0, 0, 0, 42667, 0, - 5271, 0, 119661, 118882, 1362, 13297, 0, 0, 0, 0, 73789, 0, 6658, 4426, - 0, 0, 0, 119123, 7276, 42163, 5220, 0, 0, 0, 2416, 3310, 42703, 0, 379, - 0, 0, 0, 0, 3223, 65492, 1284, 194771, 4549, 0, 0, 0, 0, 10807, 9558, - 194613, 0, 8515, 8688, 12866, 0, 3294, 0, 8529, 0, 43385, 7564, 0, 43329, - 0, 0, 73757, 66456, 42359, 0, 2031, 0, 7202, 0, 12676, 42729, 0, 3215, 0, - 7710, 1610, 73801, 0, 0, 65682, 0, 120537, 65924, 9974, 228, 66354, 1501, - 0, 64395, 5179, 7200, 6225, 0, 65794, 1725, 65533, 8196, 7476, 74399, 0, - 0, 0, 8502, 5762, 1967, 7483, 0, 0, 8104, 0, 7474, 0, 0, 0, 10414, 13001, - 8141, 0, 42537, 1557, 43594, 0, 6330, 6805, 8631, 2545, 120672, 0, 0, - 74190, 0, 0, 0, 42762, 0, 127017, 1650, 262, 1637, 0, 7901, 3238, 0, - 41861, 0, 0, 65158, 10860, 0, 43658, 7527, 0, 43319, 6419, 0, 45, 0, 0, - 0, 0, 119810, 7194, 5291, 0, 43666, 13129, 0, 9084, 0, 8737, 0, 12881, 0, - 12906, 9639, 7912, 2620, 0, 0, 0, 0, 179, 65896, 0, 64756, 2853, 0, - 118813, 0, 118996, 119009, 2850, 8084, 0, 73850, 2801, 119837, 42069, - 119839, 74754, 119841, 42072, 119843, 119842, 10398, 0, 0, 0, 0, 8245, - 68401, 3158, 119853, 4389, 43656, 923, 119857, 119856, 292, 13002, - 119845, 119844, 3221, 1763, 119849, 4612, 119851, 119850, 7253, 127110, - 68391, 0, 10782, 3637, 12996, 43542, 0, 64578, 0, 3228, 73869, 8783, 0, - 119614, 2731, 0, 0, 78585, 4102, 7696, 73878, 0, 0, 78586, 43316, 4177, - 11283, 9089, 0, 73996, 0, 64500, 43674, 0, 0, 1856, 0, 0, 6379, 0, 0, 0, - 3208, 12975, 0, 0, 0, 0, 74072, 55269, 0, 0, 0, 2033, 78577, 78576, - 195026, 55254, 7740, 0, 0, 0, 73964, 0, 0, 67612, 65674, 0, 0, 41689, 0, - 74006, 64909, 6646, 11790, 74019, 0, 0, 0, 8561, 4573, 0, 5326, 0, - 120605, 7230, 8257, 0, 8778, 41688, 0, 65776, 2071, 8314, 6459, 0, 7628, - 65092, 73903, 66721, 11342, 0, 0, 0, 0, 127001, 0, 11810, 13164, 10723, - 967, 0, 0, 11946, 0, 3257, 0, 12307, 1845, 0, 43526, 0, 0, 1886, 42342, - 10089, 870, 7648, 3499, 8609, 7652, 876, 871, 877, 0, 878, 42015, 879, - 43692, 4563, 0, 0, 7591, 65887, 867, 9520, 872, 0, 868, 873, 7642, 0, - 869, 874, 7644, 0, 875, 790, 0, 0, 0, 0, 66182, 0, 5429, 0, 66180, 0, - 66181, 68452, 0, 0, 42067, 0, 5433, 10657, 7911, 194622, 1547, 66176, - 42012, 120576, 5425, 4977, 9999, 5317, 5423, 4611, 0, 67637, 0, 9679, - 74122, 0, 0, 0, 0, 4418, 66184, 4628, 4245, 119648, 0, 0, 1851, 0, 0, - 11908, 0, 9360, 118897, 0, 42776, 66187, 12837, 8829, 7711, 0, 0, 119973, - 43318, 0, 8809, 119974, 0, 0, 120604, 0, 0, 0, 0, 0, 0, 7427, 0, 4588, - 43680, 0, 74484, 0, 2433, 0, 119622, 3352, 74363, 0, 0, 793, 74404, 0, - 305, 567, 67662, 842, 0, 8208, 0, 41695, 1647, 118877, 0, 7837, 917625, - 818, 5337, 917622, 917621, 41376, 119978, 917618, 120594, 74086, 917615, - 917614, 917613, 10973, 66359, 1372, 917609, 917608, 4969, 1254, 917605, - 917604, 917603, 917602, 65228, 78221, 0, 0, 2840, 0, 119982, 0, 0, 3245, - 9068, 68194, 64725, 0, 0, 12991, 0, 2651, 0, 0, 917611, 127026, 0, 0, 0, - 43648, 120812, 0, 43322, 0, 0, 0, 64372, 0, 3226, 655, 752, 7457, 7456, - 7452, 3285, 0, 0, 119988, 65610, 0, 0, 0, 671, 250, 7434, 618, 668, 610, - 42800, 7431, 1152, 42801, 640, 120666, 7448, 7439, 628, 3905, 73810, 0, - 0, 64749, 67850, 2107, 0, 0, 4605, 194873, 0, 43372, 65945, 0, 0, 119590, - 0, 0, 0, 987, 6927, 11572, 42261, 11464, 3365, 9971, 0, 0, 0, 0, 0, 0, 0, - 11334, 43326, 12609, 11519, 11503, 5530, 5210, 0, 4627, 0, 5208, 0, 0, - 10332, 5218, 7976, 9156, 0, 3244, 5529, 0, 73894, 0, 5432, 64965, 5527, - 74033, 10516, 7790, 5528, 0, 42140, 120281, 0, 0, 43545, 9887, 0, 4000, - 7429, 7428, 665, 7424, 3206, 120278, 7884, 0, 0, 0, 0, 211, 2509, 0, - 120573, 68672, 3220, 42235, 0, 10690, 8951, 5214, 42474, 8118, 0, 7048, - 4590, 127258, 5852, 0, 0, 127259, 1708, 0, 0, 2623, 11943, 0, 69226, 0, - 4698, 66509, 1066, 119921, 4701, 0, 120285, 74225, 119114, 8267, 0, 0, 0, - 7516, 0, 2625, 0, 8034, 74309, 0, 3631, 10955, 7850, 120293, 8416, 0, 0, - 0, 43384, 12660, 0, 0, 0, 74850, 41069, 0, 0, 12099, 4310, 10032, 6252, - 713, 7990, 0, 3990, 0, 0, 66368, 5017, 64956, 7071, 0, 119144, 1030, - 118800, 0, 9513, 41059, 9357, 0, 1773, 0, 120350, 0, 6339, 7745, 9844, 0, - 64650, 94, 1880, 74766, 0, 8908, 0, 0, 65913, 78470, 10752, 13003, 0, 0, - 41307, 8732, 120338, 0, 1757, 6964, 4696, 0, 0, 64785, 7394, 3641, 5419, - 0, 0, 0, 0, 120344, 43988, 0, 8610, 43062, 7592, 856, 74299, 936, 13289, - 127521, 43171, 1459, 0, 65243, 78638, 19953, 0, 1504, 0, 0, 12913, 74206, - 7529, 0, 0, 0, 120782, 4113, 0, 2372, 336, 0, 7509, 12152, 0, 682, 66458, - 41505, 0, 64743, 10593, 1703, 0, 0, 8033, 0, 0, 9810, 127269, 0, 12970, - 0, 42351, 10109, 0, 0, 194693, 0, 119247, 0, 0, 74291, 1965, 7069, 43312, - 0, 73887, 0, 2087, 64370, 6314, 41714, 8501, 0, 0, 74239, 41317, 0, 2091, - 0, 2090, 0, 9353, 77887, 2077, 77886, 0, 10498, 2083, 77888, 0, 0, - 119236, 634, 0, 0, 0, 69779, 4165, 8746, 0, 9654, 12856, 6924, 0, 7066, - 0, 0, 0, 41037, 42692, 7786, 12959, 41039, 0, 0, 680, 6274, 0, 1181, - 7056, 3174, 0, 0, 0, 65665, 0, 0, 6920, 0, 0, 0, 118965, 0, 64644, - 126981, 0, 0, 41028, 0, 6231, 2613, 65302, 40989, 0, 194696, 0, 42760, 0, - 0, 0, 40987, 4667, 0, 0, 8828, 0, 0, 1246, 4746, 0, 0, 11021, 4749, 0, 0, - 921, 4744, 0, 12702, 242, 0, 1566, 8217, 0, 64653, 78386, 0, 74036, - 74505, 43274, 5313, 951, 0, 0, 0, 7604, 0, 4009, 0, 0, 120562, 0, 0, - 64860, 119138, 119887, 0, 194702, 4048, 0, 0, 120596, 1646, 77890, 64534, - 73995, 0, 0, 119890, 2579, 119905, 3177, 11357, 9099, 4107, 3441, 119894, - 2975, 74442, 9822, 0, 55220, 10084, 73943, 118840, 0, 917562, 0, 3399, - 9851, 0, 11909, 9059, 0, 7687, 0, 6789, 0, 0, 0, 0, 0, 0, 1777, 9151, - 1137, 69767, 749, 42366, 0, 5385, 0, 0, 0, 0, 5989, 0, 0, 0, 0, 41685, - 69223, 0, 9769, 41684, 0, 519, 0, 11740, 5766, 0, 0, 2600, 8848, 120138, - 41297, 0, 3666, 74473, 41300, 74468, 65160, 0, 74542, 69771, 74479, 0, - 6558, 0, 0, 69765, 120750, 252, 0, 41302, 0, 0, 0, 69763, 0, 11729, 8719, - 9060, 0, 120139, 10761, 0, 0, 0, 118792, 11734, 0, 11730, 0, 9593, 5757, - 2403, 64808, 55275, 0, 11728, 65894, 0, 0, 7764, 0, 11094, 120825, 0, 0, - 4282, 8298, 0, 0, 0, 0, 0, 0, 0, 127509, 63854, 8456, 0, 74783, 65670, 0, - 78250, 0, 7774, 10607, 9792, 0, 0, 0, 0, 120764, 0, 10019, 74762, 0, - 3458, 4365, 0, 0, 3647, 0, 2602, 0, 0, 194707, 41135, 0, 0, 0, 64631, - 172, 4971, 41219, 41137, 1889, 7238, 6545, 0, 0, 7597, 10528, 0, 0, 3732, - 73910, 194588, 5344, 0, 43366, 43363, 9062, 119252, 0, 0, 0, 64479, 9232, - 0, 0, 0, 194712, 10900, 41531, 1263, 3720, 12048, 0, 64292, 41524, 7227, - 119635, 6099, 41534, 0, 0, 0, 299, 0, 8525, 0, 3524, 917565, 8831, 0, 0, - 3075, 67867, 0, 0, 66362, 0, 74758, 0, 0, 5845, 0, 0, 0, 2581, 8200, - 65114, 68460, 0, 43283, 5551, 0, 120735, 0, 6340, 118855, 0, 78134, 8680, - 7204, 0, 2588, 2914, 7011, 55281, 0, 2471, 0, 2883, 2749, 119563, 73774, - 10913, 0, 0, 8666, 675, 42493, 0, 43571, 0, 6219, 0, 9980, 41232, 10928, - 0, 41153, 41229, 118967, 0, 3738, 0, 0, 12711, 3181, 66212, 74289, 68472, - 42857, 8262, 0, 0, 0, 0, 42347, 12092, 9615, 7234, 74047, 0, 0, 64674, 0, - 0, 73846, 0, 12722, 0, 922, 43983, 74507, 0, 74461, 3218, 120471, 74290, - 120469, 64562, 120475, 8569, 11404, 11932, 73728, 3214, 120461, 120468, - 12128, 3207, 65486, 78729, 1901, 78727, 0, 120460, 7425, 3205, 0, 78737, - 78736, 78735, 43383, 78733, 65459, 2606, 78730, 73897, 0, 11496, 1173, 0, - 41272, 0, 0, 0, 0, 120737, 0, 0, 0, 378, 2610, 0, 65079, 0, 65695, 0, 37, - 7068, 0, 120480, 120479, 3209, 120477, 0, 10638, 9768, 120481, 0, 0, 0, - 0, 0, 0, 65510, 0, 0, 5233, 0, 64792, 0, 0, 0, 0, 7060, 9847, 120144, - 1685, 595, 0, 73971, 1292, 8940, 7380, 11088, 0, 10004, 126997, 0, 6541, - 0, 0, 0, 3243, 9014, 5606, 0, 538, 64620, 5602, 8467, 74391, 6547, 0, - 8203, 78488, 0, 8458, 65211, 8495, 119904, 0, 917552, 779, 78314, 64367, - 2465, 0, 8193, 55279, 9730, 9280, 0, 7065, 74155, 4346, 0, 73798, 504, 0, - 120715, 8982, 0, 0, 0, 782, 0, 10883, 0, 194852, 732, 3737, 127253, 1548, - 68650, 0, 1832, 5604, 5735, 41141, 119020, 4376, 0, 11787, 3745, 0, 0, - 42888, 65712, 0, 3869, 11937, 5725, 0, 1783, 68648, 5728, 0, 0, 0, 11918, - 66567, 5724, 0, 5727, 0, 0, 0, 764, 0, 0, 43531, 0, 9033, 0, 42532, 6223, - 11042, 120749, 11423, 0, 0, 0, 43465, 0, 0, 6559, 64557, 0, 0, 120648, - 43019, 43477, 10238, 0, 0, 43377, 120675, 0, 1478, 9783, 11825, 2607, - 64740, 0, 7739, 74543, 0, 0, 0, 6132, 0, 63765, 0, 0, 41144, 0, 0, 43537, - 6761, 10093, 4369, 917791, 0, 0, 8820, 3947, 0, 0, 11515, 526, 0, 41295, - 194603, 917785, 194932, 0, 7688, 917786, 7686, 8288, 11815, 0, 0, 0, - 1543, 3713, 41221, 12423, 42281, 917788, 74024, 12293, 0, 64357, 11794, - 42082, 0, 1737, 8987, 42081, 0, 7205, 0, 9335, 12850, 119870, 6553, 7055, - 0, 8277, 0, 0, 5475, 74795, 6780, 0, 0, 12990, 1160, 42084, 119650, - 41217, 119660, 10018, 360, 0, 0, 68176, 5863, 3137, 0, 4147, 0, 41216, - 7844, 2616, 119190, 68461, 65234, 0, 13076, 3135, 0, 78143, 119139, 3142, - 194948, 0, 10819, 119580, 10183, 0, 2608, 1470, 73967, 0, 6227, 0, 0, - 74775, 0, 6163, 0, 0, 0, 0, 0, 8603, 0, 119866, 3306, 10876, 43392, - 119573, 0, 5751, 0, 6222, 0, 0, 12086, 7403, 1600, 64309, 64939, 0, - 64783, 0, 11310, 0, 8882, 0, 0, 2570, 7021, 0, 0, 43110, 0, 1234, 6540, - 6974, 0, 0, 0, 5002, 0, 41286, 0, 127019, 0, 43585, 0, 6551, 0, 0, 0, - 41289, 0, 0, 0, 8977, 602, 120814, 0, 0, 0, 0, 0, 41279, 0, 0, 0, 11081, - 43615, 0, 0, 0, 0, 12727, 0, 0, 78397, 9475, 0, 65105, 0, 9633, 10886, - 43592, 7831, 0, 0, 0, 73915, 8076, 43048, 8290, 8291, 43051, 0, 0, 2596, - 43584, 0, 13113, 0, 0, 2393, 7058, 9087, 74067, 68673, 41574, 78337, 0, - 74058, 6376, 0, 0, 0, 0, 9854, 0, 64696, 0, 0, 0, 6994, 0, 1720, 0, 0, 0, - 6529, 7063, 0, 3751, 9120, 0, 0, 1798, 709, 0, 1354, 1876, 13152, 6557, - 12430, 8137, 0, 0, 0, 0, 245, 0, 11456, 41233, 7070, 0, 0, 6136, 0, - 65677, 8682, 41235, 0, 42045, 9804, 0, 432, 3595, 0, 65437, 0, 74455, - 42399, 0, 0, 0, 0, 119658, 0, 0, 0, 77894, 8797, 0, 9052, 64888, 0, 2356, - 95, 74784, 10580, 0, 42286, 0, 64640, 0, 119104, 0, 0, 0, 10063, 12652, - 12199, 127030, 0, 2566, 11971, 0, 0, 1065, 0, 0, 43400, 2576, 0, 0, 0, - 43604, 0, 0, 74082, 514, 74502, 0, 2921, 43215, 64493, 5772, 12968, 0, - 194944, 74580, 43398, 2580, 0, 41341, 41223, 6564, 1463, 41342, 0, 5293, - 0, 0, 3733, 11346, 0, 12054, 0, 74098, 42827, 0, 13091, 0, 0, 0, 917915, - 0, 127025, 0, 74821, 0, 0, 119042, 0, 0, 13090, 66643, 0, 1270, 1132, - 42360, 0, 74096, 66655, 42569, 0, 0, 64761, 0, 41021, 8510, 42432, 0, 0, - 0, 0, 64496, 74109, 0, 9915, 0, 0, 7061, 41336, 3854, 0, 13141, 68413, - 43401, 42319, 13082, 0, 7067, 68221, 0, 0, 0, 0, 0, 0, 9029, 43543, 0, - 2353, 6308, 0, 74792, 2611, 119186, 0, 0, 0, 43664, 0, 66627, 0, 4484, - 8509, 118976, 78116, 65233, 0, 41224, 41017, 0, 3747, 10522, 0, 0, 1691, - 41226, 0, 12107, 44002, 10905, 65010, 0, 697, 66018, 9284, 4244, 0, 0, 0, - 13121, 120036, 0, 12010, 0, 0, 0, 0, 0, 0, 65816, 68111, 0, 0, 65668, 0, - 6618, 118784, 66365, 0, 42234, 12648, 0, 0, 0, 5785, 41309, 9764, 41316, - 65877, 7383, 13230, 41299, 0, 0, 68365, 0, 0, 0, 0, 13122, 0, 191, 74119, - 8585, 8000, 64411, 120652, 42889, 64850, 41072, 41578, 0, 41577, 0, - 10002, 0, 6533, 73802, 41570, 0, 683, 396, 41580, 68146, 0, 12901, 43058, - 0, 343, 0, 42680, 41360, 78154, 0, 4743, 0, 0, 74040, 74108, 8743, 1724, - 1433, 119322, 0, 3739, 6263, 0, 0, 3964, 6592, 0, 0, 66040, 0, 42568, 0, - 0, 1778, 3956, 0, 42070, 6563, 43075, 9018, 0, 0, 12067, 41312, 0, 5547, - 74531, 0, 0, 8175, 0, 284, 8108, 934, 0, 74001, 173, 66460, 7174, 917917, - 118822, 1750, 0, 4394, 68368, 1807, 0, 0, 0, 5889, 0, 7180, 0, 119145, 0, - 0, 42471, 6982, 1721, 44022, 7891, 42243, 42160, 2583, 4512, 119360, - 65230, 0, 0, 0, 3855, 0, 0, 0, 0, 74295, 0, 0, 119140, 3975, 0, 74087, 0, - 12672, 3798, 2703, 0, 0, 2109, 9774, 1275, 0, 0, 41095, 3962, 0, 7873, - 41101, 3954, 6457, 4513, 0, 0, 73994, 73992, 1468, 0, 0, 41851, 0, 41846, - 0, 55238, 7633, 41849, 68385, 4320, 3224, 0, 0, 0, 42531, 0, 1510, 0, - 8256, 0, 11393, 0, 8879, 0, 0, 8770, 0, 0, 78377, 1910, 8671, 78374, - 4283, 0, 127117, 68361, 78318, 2654, 7893, 195007, 0, 0, 0, 65106, 42761, - 12857, 4581, 8411, 78372, 78371, 78370, 78369, 78368, 0, 0, 0, 1733, - 4392, 2568, 10786, 0, 0, 8184, 41486, 0, 7396, 0, 0, 69788, 0, 7185, - 7965, 0, 0, 0, 0, 41350, 9129, 0, 0, 0, 0, 0, 0, 10481, 0, 0, 7171, 0, - 340, 0, 0, 0, 0, 0, 0, 0, 6764, 0, 0, 0, 0, 0, 65203, 11392, 119098, - 119359, 0, 3210, 0, 0, 0, 0, 0, 0, 917619, 0, 0, 10043, 0, 1186, 41571, - 6999, 617, 9464, 0, 3675, 5207, 65062, 5213, 194769, 2617, 41348, 41568, - 0, 3253, 120535, 0, 8630, 0, 0, 5596, 5545, 7288, 2586, 64887, 0, 5217, - 0, 0, 0, 0, 64293, 68098, 2635, 0, 0, 0, 0, 0, 7835, 0, 0, 194988, 0, - 64558, 127122, 0, 127121, 0, 0, 0, 5784, 0, 0, 0, 0, 4011, 917616, 68101, - 0, 7864, 4254, 65095, 0, 5600, 3903, 127083, 10447, 5598, 1207, 120521, - 66689, 3501, 42582, 43600, 194780, 0, 1124, 5597, 0, 0, 9321, 0, 0, 0, 0, - 1719, 68356, 68354, 9671, 1125, 4399, 0, 917610, 0, 7631, 5488, 65223, - 120532, 0, 5491, 0, 8937, 43044, 2604, 74187, 5490, 43046, 5489, 7212, - 11768, 43043, 6300, 0, 194789, 0, 4390, 454, 41397, 0, 9875, 7593, - 194792, 0, 118913, 7207, 0, 65901, 2394, 2575, 0, 3746, 11016, 65752, - 120037, 0, 43423, 0, 11989, 0, 0, 0, 0, 0, 8249, 0, 0, 78531, 6640, - 74806, 2598, 513, 0, 6586, 8656, 0, 127002, 65008, 0, 194784, 0, 194795, - 0, 0, 68475, 0, 0, 0, 78637, 12647, 0, 194796, 0, 1036, 0, 0, 1723, 0, 0, - 0, 41579, 2444, 0, 10705, 73876, 0, 74486, 0, 740, 194985, 194978, - 194984, 0, 4238, 11071, 9459, 68437, 78140, 78139, 0, 8121, 10438, 74487, - 42574, 13285, 55263, 11907, 195000, 5690, 194999, 0, 0, 43181, 13095, 0, - 0, 64498, 0, 9506, 6978, 194993, 77992, 0, 0, 194992, 0, 0, 1122, 317, 0, - 0, 0, 0, 1920, 0, 10173, 827, 0, 0, 78378, 120126, 5223, 1304, 0, 119564, - 5226, 12602, 0, 0, 9329, 7758, 9239, 41173, 5224, 5487, 1222, 5692, - 41725, 69229, 9674, 5695, 41711, 64627, 19909, 0, 74604, 5691, 287, 866, - 233, 0, 0, 42816, 0, 65140, 74797, 0, 8830, 6568, 42300, 10524, 41175, 0, - 0, 0, 5296, 0, 42492, 43402, 0, 3302, 0, 0, 6516, 6515, 6514, 6513, 6512, - 0, 7856, 8690, 0, 0, 12122, 119628, 43976, 0, 1785, 0, 68622, 65153, - 194810, 5138, 0, 0, 0, 0, 4540, 41181, 0, 6200, 0, 5134, 0, 322, 4643, - 5132, 0, 6389, 0, 5143, 0, 8790, 0, 0, 194802, 0, 8869, 120601, 0, 42060, - 0, 0, 0, 0, 10270, 10286, 10318, 10382, 43529, 66477, 0, 0, 74170, 0, - 3234, 0, 0, 74376, 43139, 118815, 127084, 120627, 8767, 0, 74489, 9695, - 120746, 5201, 0, 6215, 12714, 6214, 13101, 0, 0, 65268, 0, 0, 0, 11027, - 0, 10059, 10511, 42075, 9767, 789, 1749, 78890, 127071, 0, 320, 0, 8647, - 0, 3049, 0, 6471, 42071, 43156, 9925, 127356, 127355, 0, 4960, 5549, - 127359, 0, 8485, 4671, 5418, 0, 3351, 127006, 0, 10610, 5414, 3064, 6212, - 4286, 5421, 0, 9554, 0, 0, 0, 6653, 0, 0, 64510, 6213, 12885, 0, 119045, - 64720, 0, 120759, 73741, 12603, 78654, 11430, 4566, 7843, 9317, 3801, - 10342, 10406, 0, 119259, 42576, 0, 5200, 0, 917948, 0, 9183, 0, 74458, - 73825, 395, 5482, 5198, 8786, 10390, 74202, 5196, 43224, 6113, 42009, - 5205, 0, 43307, 0, 118973, 0, 12134, 0, 0, 118843, 9126, 435, 0, 12014, - 12893, 8093, 9079, 3203, 192, 65109, 3385, 0, 64430, 5383, 10294, 10326, - 0, 5738, 0, 3336, 78355, 5361, 3623, 41159, 0, 68112, 7872, 8581, 0, - 1260, 3149, 5359, 0, 0, 7914, 5357, 0, 0, 2624, 5364, 0, 11431, 120030, - 9101, 11058, 78288, 0, 78293, 42271, 78289, 65737, 120793, 0, 65566, - 6717, 10619, 43360, 78385, 78384, 78383, 78382, 78381, 78380, 78379, - 9319, 7097, 119055, 77906, 3232, 73824, 74581, 120632, 0, 0, 41889, 0, 0, - 1161, 41895, 74103, 9701, 8622, 0, 0, 73819, 120588, 5012, 77912, 41362, - 0, 78296, 11921, 0, 11769, 0, 68609, 41364, 0, 74228, 41352, 41361, 0, - 41366, 0, 3356, 0, 917, 68422, 119915, 119923, 8199, 78389, 119917, 677, - 119916, 0, 119932, 0, 0, 0, 0, 3349, 74125, 7022, 8927, 4739, 0, 5802, 0, - 8615, 0, 0, 491, 0, 0, 0, 65837, 0, 8426, 11092, 9891, 0, 42497, 0, 7586, - 42305, 10852, 0, 0, 4606, 68448, 9095, 7741, 12684, 41885, 1046, 0, 0, 0, - 5815, 5171, 65539, 0, 6932, 78315, 42394, 41878, 74849, 120621, 0, 5169, - 11935, 0, 0, 3175, 120822, 1537, 120804, 5176, 8905, 4136, 4871, 78287, - 0, 9833, 0, 0, 1128, 65920, 0, 9711, 7057, 9408, 9409, 9410, 9411, 3662, - 9413, 3378, 9415, 9416, 9417, 9418, 6320, 9420, 9421, 5897, 9423, 5165, - 5126, 41385, 0, 41389, 917938, 8955, 3374, 9400, 9401, 9402, 9403, 9404, - 3507, 9406, 7629, 0, 19925, 42669, 68463, 183, 43985, 2631, 0, 10627, - 41130, 78260, 3996, 0, 78771, 0, 119313, 119307, 78768, 6580, 4332, - 64825, 66329, 10726, 66686, 41125, 5899, 41365, 917918, 12085, 0, 574, - 917922, 77825, 73828, 5448, 41058, 5446, 73900, 41322, 42211, 5442, 4190, - 77834, 77835, 5451, 77833, 3616, 77828, 77837, 77838, 7708, 77836, 10859, - 65867, 10345, 10409, 4191, 0, 77844, 73800, 42181, 77843, 77839, 2060, 0, - 78311, 11788, 65587, 68129, 10415, 74102, 0, 205, 0, 10351, 119076, 0, - 9862, 6588, 43257, 64697, 73998, 41355, 5505, 119154, 5503, 8021, 0, - 119150, 9819, 41357, 8011, 42885, 5507, 12044, 0, 0, 10026, 5472, 65108, - 1191, 13106, 5470, 10329, 5476, 8991, 66322, 69778, 78267, 42874, 8550, - 42876, 5592, 2919, 0, 2675, 5595, 78411, 0, 4367, 0, 0, 5478, 5904, 5594, - 0, 74150, 7291, 5590, 77849, 13067, 118909, 120372, 0, 9731, 0, 64633, - 77857, 77854, 77855, 77852, 77853, 77850, 10750, 43714, 77858, 74545, 0, - 0, 12887, 10551, 194564, 77866, 77867, 77864, 77865, 9929, 5199, 9936, - 1120, 42387, 0, 1444, 9486, 7554, 65839, 55252, 0, 1442, 0, 5894, 0, 0, - 0, 0, 74313, 0, 13162, 0, 3334, 0, 118803, 77881, 66022, 0, 0, 1651, 0, - 8861, 0, 0, 1142, 0, 8271, 0, 0, 0, 12903, 0, 4002, 43626, 10442, 10676, - 3344, 0, 0, 12920, 194560, 0, 0, 66642, 1277, 0, 7871, 0, 0, 78853, 0, - 78854, 120360, 0, 11784, 0, 78012, 4700, 66366, 78858, 120359, 11012, 0, - 78856, 120358, 77879, 4973, 8784, 77877, 74804, 77874, 77869, 77871, - 42440, 0, 43118, 0, 42364, 6774, 6773, 0, 120369, 10346, 10410, 78859, - 9243, 2464, 0, 6108, 3372, 0, 6247, 43117, 74526, 0, 74166, 0, 120355, 0, - 0, 0, 0, 0, 0, 0, 74217, 3354, 0, 4192, 9289, 118999, 41191, 3876, 0, 0, - 120660, 43696, 43380, 0, 0, 0, 0, 11603, 0, 0, 6589, 0, 194679, 0, 0, 0, - 0, 0, 42572, 0, 10630, 74827, 1963, 118889, 0, 11654, 0, 7550, 10686, - 5903, 0, 78009, 41329, 9662, 917937, 64698, 3366, 10399, 0, 0, 11013, 0, - 917933, 0, 78621, 194672, 6925, 0, 0, 917929, 0, 11568, 0, 917931, 64579, - 917930, 7852, 0, 0, 6754, 6312, 0, 64672, 65296, 0, 118957, 0, 416, - 12296, 68457, 73834, 68177, 11050, 10984, 0, 0, 0, 0, 0, 0, 9532, 66355, - 0, 0, 917925, 64343, 195032, 0, 195031, 0, 0, 195057, 11445, 0, 195028, - 195056, 195027, 10185, 1021, 0, 9507, 10210, 74544, 8023, 1200, 12243, - 78001, 5282, 78003, 12540, 11545, 0, 120493, 3343, 4424, 11047, 1885, - 43268, 3896, 78626, 66497, 2947, 392, 7894, 4391, 68139, 0, 13059, 74816, - 77998, 3381, 7942, 0, 69219, 0, 64757, 0, 3913, 0, 0, 78235, 7044, 1265, - 0, 6309, 7045, 7175, 7047, 78239, 11791, 0, 0, 8221, 78307, 41864, 0, 0, - 0, 0, 167, 0, 78301, 0, 74211, 41897, 68477, 0, 917583, 0, 0, 2493, 0, - 118811, 0, 0, 64354, 0, 8777, 0, 406, 8884, 2385, 0, 0, 0, 917573, 43030, - 42027, 12114, 0, 917579, 64936, 0, 0, 120629, 10561, 0, 8365, 0, 0, - 65841, 120787, 11601, 0, 74121, 0, 917575, 7834, 74159, 0, 0, 10298, - 6624, 4908, 917596, 1639, 0, 0, 74157, 6327, 6724, 0, 0, 0, 0, 4817, - 78446, 194759, 0, 7043, 9600, 11022, 0, 0, 0, 0, 0, 0, 7548, 64794, - 42050, 12291, 55289, 194761, 12343, 657, 195054, 42705, 4461, 1134, 1838, - 78438, 2057, 0, 4468, 0, 0, 0, 4456, 5206, 10720, 0, 42523, 127520, 0, 0, - 917595, 65550, 260, 4816, 67658, 10687, 0, 4821, 4466, 0, 195043, 4818, - 0, 41403, 119977, 0, 0, 41406, 43273, 74160, 119983, 73939, 119985, - 119984, 119979, 41404, 1165, 119980, 4451, 13087, 0, 11284, 119987, - 73855, 65155, 43014, 5439, 9363, 127558, 3375, 0, 5900, 0, 7889, 2722, - 42262, 0, 0, 0, 0, 0, 0, 0, 11401, 0, 0, 68459, 0, 0, 0, 0, 65438, 0, - 7280, 0, 0, 0, 4868, 119967, 119966, 0, 0, 0, 43161, 0, 119964, 0, 5182, - 0, 120542, 0, 0, 4226, 120798, 12135, 5732, 4464, 0, 0, 977, 4458, 0, 0, - 64770, 74838, 0, 344, 0, 194790, 1395, 64279, 0, 0, 0, 786, 0, 43174, - 64340, 0, 0, 0, 43026, 7612, 10132, 64413, 0, 0, 0, 0, 0, 0, 68444, 0, - 120734, 0, 119160, 10204, 0, 0, 0, 0, 1399, 0, 65217, 0, 8852, 0, 241, 0, - 4907, 0, 0, 7932, 9727, 0, 74255, 8748, 0, 0, 0, 0, 42780, 0, 0, 0, 4217, - 0, 8650, 0, 0, 0, 0, 118872, 43099, 3965, 119119, 6719, 0, 13300, 78439, - 0, 43057, 66588, 118991, 0, 0, 73815, 4420, 0, 6410, 7760, 0, 0, 0, 0, 0, - 7294, 0, 0, 0, 9066, 0, 11993, 43188, 2626, 7762, 0, 0, 0, 0, 42825, - 41854, 5304, 0, 78516, 6919, 8619, 119655, 10038, 66454, 9592, 42851, - 126993, 1542, 0, 0, 0, 0, 0, 74311, 78497, 0, 10181, 0, 43624, 0, 7779, - 0, 10195, 9479, 6029, 0, 0, 9689, 0, 0, 8993, 66358, 0, 42378, 3368, 606, - 0, 7697, 69237, 69787, 2030, 0, 6027, 8370, 4322, 0, 65207, 0, 0, 0, 0, - 0, 2735, 42831, 77935, 127120, 74866, 8881, 119047, 0, 0, 73946, 0, 0, 0, - 68140, 0, 9576, 0, 3347, 4160, 5154, 55288, 3794, 66564, 8530, 127063, - 7709, 41112, 0, 66560, 42041, 4572, 12876, 66561, 0, 6758, 0, 1615, 5855, - 809, 0, 0, 0, 0, 5799, 0, 0, 0, 7260, 0, 43031, 64425, 65128, 127061, - 64386, 65257, 0, 68616, 120607, 9347, 0, 6532, 0, 0, 0, 0, 65828, 0, 283, - 68665, 78813, 532, 78663, 0, 0, 120609, 0, 3370, 0, 11361, 5443, 78778, - 8153, 73767, 0, 10741, 0, 0, 0, 0, 65495, 64706, 0, 43344, 0, 78870, - 9466, 78866, 9824, 0, 0, 0, 0, 915, 43425, 0, 0, 0, 0, 0, 43264, 0, 0, 0, - 0, 78864, 6730, 78862, 68161, 64550, 5186, 12890, 0, 0, 12108, 0, 65124, - 43127, 66043, 0, 6326, 43107, 77826, 0, 42562, 0, 0, 0, 0, 11485, 6103, - 127123, 0, 11718, 0, 12889, 0, 0, 0, 0, 0, 55245, 0, 1630, 0, 65483, 0, - 12565, 0, 65476, 120013, 0, 119554, 9283, 7700, 917537, 9690, 65499, 0, - 64593, 512, 3376, 68210, 0, 0, 77892, 632, 12940, 77891, 42529, 78587, 0, - 5957, 0, 8926, 0, 0, 0, 10745, 10174, 7379, 64581, 5386, 120686, 11713, - 10633, 120531, 5056, 0, 0, 0, 120773, 0, 9812, 0, 4460, 0, 0, 0, 0, 0, 0, - 0, 64278, 0, 43466, 0, 0, 64389, 2953, 73879, 1801, 12835, 119029, 0, - 73823, 0, 66375, 2085, 702, 42579, 77884, 77885, 13074, 77883, 0, 0, 0, - 12106, 0, 74207, 1755, 10482, 12863, 77898, 1163, 2951, 9522, 74079, - 78266, 120674, 0, 3384, 69227, 10702, 830, 77902, 77899, 77900, 8451, 0, - 0, 0, 120762, 0, 0, 0, 0, 2908, 0, 43386, 64902, 4243, 0, 12239, 0, 0, - 4441, 0, 0, 73940, 64352, 127513, 0, 411, 0, 0, 0, 4056, 118992, 41890, - 0, 2730, 41604, 0, 5428, 194743, 3364, 42265, 0, 0, 118816, 194742, 9684, - 216, 0, 1401, 0, 44012, 0, 0, 0, 9158, 77842, 120664, 5768, 0, 0, 0, 484, - 0, 0, 0, 65895, 0, 0, 3338, 73935, 572, 7041, 2736, 67605, 0, 0, 2794, - 8807, 64491, 77847, 5438, 5222, 5381, 43114, 0, 5193, 5125, 5456, 5509, - 77846, 194747, 9534, 0, 0, 0, 3430, 0, 0, 0, 0, 981, 0, 4330, 73929, - 120536, 1824, 10908, 0, 7034, 41683, 64617, 0, 73754, 3957, 64358, 64547, - 0, 674, 63991, 0, 2946, 5354, 5251, 5328, 5307, 3759, 11411, 8364, 5123, - 0, 5281, 5469, 5121, 119245, 0, 0, 5130, 0, 0, 77990, 0, 120726, 1221, - 2733, 11746, 77991, 5216, 0, 0, 0, 0, 3468, 7033, 9230, 5939, 0, 0, 0, - 120677, 68400, 7278, 10321, 10289, 64613, 10385, 41706, 0, 0, 0, 0, - 11739, 0, 41981, 0, 5938, 0, 0, 12448, 7576, 10401, 10337, 73852, 0, - 13057, 0, 126976, 0, 10009, 0, 64304, 0, 12165, 0, 0, 9885, 0, 8077, 0, - 0, 0, 0, 0, 0, 0, 4220, 10725, 10433, 0, 68395, 4987, 64519, 0, 0, 0, 0, - 0, 10970, 11733, 0, 120792, 0, 19944, 0, 9009, 8551, 0, 11468, 64636, - 7575, 0, 2724, 0, 0, 12313, 119949, 515, 119947, 42791, 63987, 78286, - 119943, 119940, 119941, 119938, 9775, 4046, 4589, 4521, 68629, 9141, 0, - 78850, 2741, 64399, 6197, 1370, 0, 0, 0, 0, 0, 0, 6184, 8606, 3303, - 41372, 11786, 9473, 66203, 66177, 0, 11593, 43007, 4478, 66178, 0, 0, - 2744, 0, 4477, 118964, 814, 42066, 66183, 66204, 66194, 119961, 66198, - 41880, 66188, 66197, 78148, 11955, 66190, 66191, 41111, 66189, 73788, - 7788, 4847, 0, 0, 0, 0, 0, 1581, 6535, 78161, 12954, 430, 78160, 55259, - 78158, 194938, 5278, 4945, 42883, 4950, 0, 68625, 0, 7269, 0, 5964, - 12908, 0, 0, 74764, 74477, 119146, 194936, 4949, 0, 443, 0, 4944, 5467, - 119603, 0, 65137, 6044, 65392, 0, 4213, 0, 41303, 0, 194931, 0, 41306, - 73984, 2698, 127531, 0, 12072, 3193, 0, 41304, 824, 0, 12091, 78893, - 78894, 119816, 4673, 64804, 4678, 119820, 119819, 65059, 0, 6739, 0, - 5481, 3490, 1199, 119811, 8356, 119829, 119832, 4677, 12688, 3102, 0, - 4672, 78173, 78175, 5531, 68367, 42575, 78170, 78166, 4674, 4548, 44005, - 0, 68658, 119946, 8025, 68630, 127024, 1855, 0, 68669, 0, 119942, 127554, - 0, 0, 119652, 2745, 11797, 0, 0, 68643, 4654, 0, 0, 68638, 73993, 10525, - 4649, 65209, 0, 0, 4648, 43080, 0, 0, 0, 6246, 64950, 7828, 4650, 6777, - 6776, 6775, 4653, 7822, 78005, 0, 43187, 8669, 0, 6821, 65093, 0, 78881, - 2716, 0, 0, 0, 0, 68369, 0, 11060, 8547, 2711, 42165, 78027, 78026, 7992, - 0, 0, 4662, 78033, 78032, 9149, 9146, 599, 2081, 78031, 78030, 194962, - 4656, 10130, 68450, 7811, 40994, 194965, 6414, 5967, 4658, 3725, 5713, - 5814, 4661, 42434, 0, 0, 0, 64904, 9026, 10833, 74864, 7547, 4867, 0, - 10008, 10222, 3054, 194956, 9744, 78860, 7605, 4622, 119656, 0, 0, 0, 0, - 0, 9045, 78888, 4225, 19926, 78887, 12880, 65307, 4617, 78883, 0, 41732, - 4616, 10518, 10423, 10359, 0, 5958, 0, 0, 4215, 9789, 917941, 4321, 4621, - 0, 41313, 522, 5368, 0, 65803, 0, 5366, 12201, 5372, 0, 0, 0, 7720, 7390, - 2696, 0, 0, 4638, 0, 1790, 78242, 5965, 64363, 66569, 68646, 194968, - 5376, 1835, 5335, 194966, 0, 4633, 0, 68119, 1180, 4632, 0, 5387, 5333, - 0, 0, 42094, 5331, 4634, 11928, 0, 5338, 4637, 0, 5971, 42414, 0, 1268, - 65097, 42361, 0, 0, 73853, 1427, 0, 0, 5970, 3431, 0, 10358, 10422, 4758, - 0, 1608, 2738, 0, 10455, 4753, 74026, 11344, 4222, 6240, 5231, 74384, 0, - 68377, 6248, 0, 0, 0, 42318, 0, 5229, 4757, 0, 0, 2728, 4752, 64563, - 65235, 5234, 0, 0, 0, 10713, 0, 0, 2622, 7460, 0, 0, 0, 8954, 74760, - 65189, 2632, 0, 10108, 1011, 5574, 1853, 2709, 65139, 5577, 0, 0, 118871, - 68641, 8965, 7635, 42177, 5316, 0, 5314, 6451, 5572, 0, 5312, 0, 5525, - 5330, 5319, 0, 0, 194907, 44003, 0, 0, 0, 120498, 0, 195009, 0, 74022, 0, - 64609, 0, 120634, 0, 5721, 0, 5519, 8632, 66465, 11267, 73961, 0, 5720, - 0, 1692, 4219, 4610, 8696, 4305, 0, 4609, 43478, 4614, 541, 0, 5287, - 5309, 5285, 68389, 5961, 4647, 56, 4216, 10577, 41381, 601, 4613, 0, 0, - 0, 4608, 64260, 41124, 5190, 67628, 0, 68145, 7086, 0, 119243, 67620, 0, - 2734, 11074, 0, 67627, 43593, 0, 67625, 5960, 0, 8992, 65293, 0, 1782, - 67622, 68114, 119939, 0, 68180, 5501, 119952, 42508, 7442, 43665, 359, - 41253, 68392, 6239, 119956, 41256, 0, 68134, 0, 74209, 0, 9346, 118904, - 41254, 0, 43291, 3767, 5737, 0, 4865, 0, 5740, 917997, 5736, 4368, 0, - 7193, 68137, 0, 5739, 41024, 4866, 0, 73904, 0, 4869, 120563, 0, 4223, 0, - 6650, 0, 0, 0, 0, 4870, 0, 68661, 6716, 78176, 68667, 68382, 68676, 0, - 10122, 4864, 66568, 4144, 7937, 0, 6245, 68652, 2732, 42734, 745, 0, - 195097, 0, 4777, 7821, 0, 68631, 42775, 0, 194954, 0, 3097, 0, 5966, 0, - 4778, 0, 10863, 0, 4781, 0, 64407, 0, 0, 8577, 0, 68196, 43285, 10216, - 4782, 0, 0, 120757, 68618, 12325, 43056, 8717, 0, 0, 4776, 0, 11492, - 8700, 0, 13176, 68363, 10426, 0, 917599, 10362, 0, 1715, 4849, 8242, - 9561, 73922, 43278, 42635, 0, 0, 5963, 917926, 0, 0, 4850, 0, 1607, 466, - 4853, 118995, 4854, 0, 5164, 0, 1350, 5124, 64420, 1993, 5362, 8471, - 2708, 0, 12445, 3785, 234, 3199, 0, 41268, 4848, 2530, 917909, 2068, - 1964, 0, 73762, 10458, 0, 8576, 78543, 0, 2704, 4794, 0, 68211, 8322, - 4797, 5753, 0, 2694, 4792, 0, 2439, 65104, 69804, 0, 303, 0, 0, 0, 2437, - 0, 4221, 4844, 118869, 0, 0, 0, 0, 0, 43292, 0, 2441, 10739, 65090, 0, - 119327, 0, 2451, 2714, 119326, 0, 43379, 4937, 43376, 753, 5849, 10597, - 43089, 11722, 9248, 0, 42879, 11725, 0, 0, 2726, 3107, 73958, 4941, - 64937, 119233, 9140, 1408, 5261, 4607, 0, 181, 0, 4942, 9539, 4938, 0, - 65201, 5259, 9369, 64185, 4142, 5257, 0, 0, 4964, 5264, 64178, 64177, - 12979, 41411, 64182, 64181, 64180, 64179, 9482, 4873, 41231, 1822, 42526, - 0, 12758, 3865, 0, 0, 10500, 0, 0, 78028, 0, 9830, 43642, 389, 10893, - 7521, 0, 4872, 5463, 0, 3125, 9567, 0, 4878, 5459, 4604, 0, 9557, 5465, - 68617, 0, 11494, 0, 9563, 10865, 74570, 43279, 64186, 0, 78714, 64191, - 64190, 8898, 64188, 0, 41030, 78836, 0, 917835, 78820, 917834, 0, 78805, - 41031, 78801, 11960, 6745, 3082, 0, 78539, 73919, 10573, 41744, 7079, - 5856, 127043, 5163, 78809, 0, 1817, 66724, 78538, 0, 10564, 7763, 13077, - 41813, 4400, 41745, 64207, 10275, 8925, 10371, 10307, 41814, 4248, 0, 0, - 4541, 6299, 64204, 64203, 64201, 64200, 64199, 64198, 0, 42156, 78688, 0, - 64193, 64192, 78000, 9943, 64197, 64196, 64195, 64194, 13282, 64175, - 64174, 64173, 78189, 846, 78186, 9965, 0, 0, 0, 0, 2543, 12163, 3108, - 9745, 64167, 64166, 64165, 64164, 2110, 0, 64169, 64168, 64949, 10972, - 10251, 10247, 42768, 715, 64161, 43299, 9453, 5348, 10943, 120378, 0, - 11352, 550, 9910, 0, 0, 66579, 11551, 0, 0, 9504, 7187, 0, 10373, 0, - 120791, 10261, 10253, 6404, 10277, 78183, 11984, 1552, 65222, 6998, - 78180, 0, 3128, 4789, 5067, 5066, 118849, 4784, 0, 8827, 1146, 5065, - 78196, 78192, 68136, 78190, 43412, 5064, 2431, 0, 9450, 1809, 0, 78200, - 78201, 5062, 1264, 64817, 13254, 11697, 0, 9785, 64716, 0, 3933, 74559, - 4740, 7954, 0, 0, 42609, 0, 74175, 0, 127016, 0, 0, 42130, 0, 5151, - 917829, 917823, 0, 0, 0, 7620, 3800, 65122, 0, 0, 8355, 7854, 0, 954, - 64927, 4185, 41045, 0, 41438, 41439, 68666, 10711, 4593, 0, 120584, 0, - 64774, 8053, 10532, 66727, 0, 0, 0, 64759, 6381, 5166, 9888, 0, 5148, - 42834, 0, 78205, 78206, 64140, 78204, 64131, 3119, 917814, 0, 3060, - 64135, 9986, 0, 77876, 636, 11698, 0, 0, 9916, 11701, 7836, 42741, 64137, - 8320, 78640, 8863, 0, 119960, 1477, 43289, 0, 74358, 8618, 0, 9908, 0, 0, - 0, 3937, 12312, 0, 0, 0, 64781, 912, 6349, 4536, 119963, 74532, 0, 6244, - 0, 194580, 3935, 120665, 0, 0, 11950, 5392, 42248, 65129, 68656, 5397, 0, - 12046, 12599, 0, 0, 5395, 0, 5393, 354, 68615, 119948, 78503, 0, 0, - 42039, 0, 0, 64142, 626, 0, 5895, 0, 0, 5780, 0, 0, 0, 0, 0, 43297, 0, - 4311, 4644, 8818, 0, 0, 0, 73818, 3918, 66452, 3797, 1644, 119944, 9658, - 4140, 11385, 65947, 6455, 9030, 813, 119945, 68131, 4146, 119957, 5360, - 2466, 0, 67669, 0, 6249, 42117, 0, 0, 0, 0, 74046, 120583, 4911, 988, - 917807, 0, 0, 43061, 7054, 64147, 0, 64920, 68195, 6698, 118933, 120349, - 0, 0, 11981, 12202, 0, 11032, 67654, 6093, 11608, 975, 68662, 65843, 170, - 0, 0, 4169, 0, 41859, 6058, 120401, 13203, 120657, 0, 0, 68657, 9818, - 10178, 10324, 42106, 5898, 74540, 4738, 41856, 7062, 917865, 4737, 11779, - 4742, 120564, 917866, 73736, 0, 9825, 6448, 6715, 127008, 4831, 0, 0, 0, - 5300, 4741, 42108, 0, 64159, 4736, 64148, 0, 849, 0, 78491, 43288, 0, - 66620, 0, 194920, 65549, 9496, 64598, 118866, 0, 7876, 68132, 917872, - 3928, 917870, 43378, 10706, 7198, 0, 4842, 12053, 0, 0, 4841, 0, 4171, - 12008, 6251, 3923, 1490, 0, 119591, 0, 40972, 5245, 0, 10114, 42001, - 41888, 4845, 8332, 40974, 64347, 4840, 9077, 78346, 1747, 917849, 4825, - 69240, 917852, 68655, 0, 0, 0, 0, 68628, 0, 9850, 118937, 367, 1472, - 917859, 6687, 1274, 0, 5905, 12339, 8919, 73953, 10907, 65261, 11023, - 119559, 4830, 9134, 78666, 64126, 43011, 0, 0, 64101, 0, 0, 4824, 10614, - 120390, 0, 1888, 1960, 7861, 917856, 78524, 41836, 43012, 6052, 6064, 54, - 43009, 12214, 0, 6211, 0, 358, 41997, 41833, 11442, 10758, 65774, 0, - 120384, 64115, 120385, 0, 0, 0, 119053, 0, 12765, 64118, 126998, 12962, - 0, 0, 4017, 12827, 5241, 120392, 0, 41118, 3924, 0, 11366, 917843, 0, 0, - 917846, 41116, 917844, 917564, 0, 11363, 12057, 11917, 1567, 74000, 4721, - 0, 66202, 8957, 4139, 0, 0, 0, 0, 0, 12740, 0, 4722, 6816, 0, 12759, - 4725, 0, 4726, 0, 0, 0, 917904, 917905, 0, 12755, 12762, 4015, 0, 8052, - 476, 0, 0, 0, 64212, 41020, 1382, 64209, 64216, 64215, 64214, 1656, - 41831, 0, 0, 41843, 8720, 3908, 1452, 13111, 0, 64067, 0, 8552, 64113, - 41845, 3849, 78732, 66232, 9778, 120066, 5891, 7064, 55, 9948, 917911, 0, - 0, 7935, 67586, 0, 1114, 0, 67585, 78675, 120053, 120050, 120051, 3938, - 120057, 65417, 64717, 120060, 120061, 65415, 120059, 6292, 65303, 7955, - 6452, 4713, 917887, 66249, 917885, 917890, 917891, 65152, 719, 120044, - 78623, 120042, 6713, 4532, 65412, 69822, 10868, 4717, 2349, 5902, 66450, - 4712, 917902, 917899, 917900, 65416, 8155, 4718, 3942, 4714, 9625, 0, - 6383, 0, 12006, 0, 0, 0, 0, 0, 65414, 6454, 1229, 0, 66437, 66025, 78699, - 0, 42500, 120508, 4809, 9623, 917874, 78694, 917880, 917877, 917878, - 65405, 68159, 917881, 917882, 5365, 4545, 8901, 917566, 119555, 4813, 0, - 0, 5925, 4808, 64330, 0, 65475, 118940, 0, 4814, 0, 4810, 0, 0, 64928, - 10543, 0, 3522, 0, 414, 65404, 0, 0, 6456, 73820, 0, 6691, 42193, 0, 0, - 0, 74495, 0, 0, 0, 118820, 9751, 65407, 0, 11770, 3919, 0, 0, 65061, 0, - 0, 0, 12235, 0, 0, 195025, 64092, 0, 64080, 0, 64090, 0, 0, 10162, 10310, - 0, 8454, 0, 42038, 387, 41363, 12737, 0, 4780, 43368, 0, 64310, 64621, - 6732, 0, 0, 0, 0, 0, 8896, 0, 375, 6976, 66582, 119005, 0, 0, 0, 119202, - 119203, 12526, 43120, 2315, 0, 1938, 119197, 0, 4529, 119200, 119201, - 119198, 119199, 0, 0, 0, 13150, 64492, 0, 0, 0, 12902, 0, 42891, 66327, - 74298, 0, 10799, 0, 2587, 66372, 0, 4193, 120334, 4241, 0, 7998, 0, 0, 0, - 0, 2316, 118821, 0, 0, 0, 64297, 74799, 0, 74140, 0, 5373, 0, 0, 3762, - 10015, 0, 119232, 0, 41590, 0, 0, 3780, 7485, 5779, 0, 42037, 0, 3906, - 12349, 0, 8326, 0, 65498, 3763, 6983, 5618, 0, 3779, 0, 43613, 0, 0, 0, - 0, 0, 0, 280, 74558, 0, 68138, 13072, 1894, 0, 0, 65478, 43310, 7231, 0, - 11773, 0, 0, 0, 0, 2551, 0, 6453, 10200, 6235, 0, 119237, 0, 0, 4470, - 119613, 0, 7780, 5369, 118958, 5249, 0, 5367, 8756, 0, 0, 5377, 120585, - 68143, 1688, 78245, 0, 0, 0, 0, 0, 44020, 6808, 41319, 1300, 10650, - 41692, 64505, 4668, 0, 119624, 1465, 10850, 3943, 0, 41205, 41315, 0, 0, - 0, 5352, 0, 0, 8839, 41314, 7384, 7785, 41204, 0, 41209, 0, 0, 43607, 0, - 0, 5420, 3897, 0, 0, 74417, 4018, 0, 68127, 0, 0, 0, 0, 127526, 2561, - 68621, 3542, 41915, 12076, 7951, 68152, 118857, 5303, 6276, 1706, 0, - 78751, 74116, 0, 65150, 41819, 0, 73951, 10847, 41822, 9985, 860, 0, - 10506, 0, 0, 10753, 10830, 0, 615, 64490, 7574, 0, 77922, 0, 12909, - 43016, 64559, 127028, 0, 0, 0, 2020, 0, 4022, 0, 0, 77923, 0, 41691, 0, - 0, 74329, 0, 64622, 9070, 0, 68411, 3911, 42829, 43122, 1033, 74440, 0, - 7000, 3904, 0, 0, 0, 0, 127012, 13123, 10846, 3450, 0, 7397, 118807, 0, - 42778, 10000, 41088, 449, 0, 3777, 68458, 0, 9636, 0, 10738, 0, 9367, - 593, 41085, 3999, 65226, 41713, 12764, 0, 64409, 3596, 0, 0, 9763, - 120280, 120283, 12347, 124, 12981, 41127, 2092, 0, 0, 0, 0, 10820, 43987, - 0, 0, 1769, 41715, 2463, 78489, 0, 12770, 0, 1538, 0, 43124, 0, 195058, - 7795, 120300, 0, 4828, 1258, 0, 2006, 0, 0, 9498, 127032, 127033, 120289, - 120288, 3939, 120290, 8846, 8943, 120287, 120286, 2650, 4491, 1961, - 42602, 11525, 120292, 1959, 120294, 55228, 11774, 41016, 0, 68675, 0, - 1511, 9324, 78211, 10519, 66331, 3454, 19930, 0, 41019, 0, 0, 65292, - 6822, 12862, 0, 0, 42143, 41828, 78207, 65531, 78208, 118879, 55223, 0, - 0, 41826, 8865, 6402, 0, 13279, 7917, 120340, 0, 7733, 0, 4998, 0, 0, - 41950, 0, 4268, 0, 0, 0, 4013, 0, 10881, 0, 0, 0, 74788, 2014, 0, 0, - 9765, 0, 0, 0, 195059, 78357, 65281, 0, 10949, 0, 0, 0, 2015, 0, 0, 0, - 66318, 43233, 0, 42517, 0, 0, 0, 12698, 8094, 43445, 65909, 6474, 794, 0, - 12656, 0, 119353, 0, 1665, 0, 4833, 0, 119351, 0, 0, 189, 12611, 0, 0, - 2859, 4838, 0, 4834, 65078, 0, 0, 4837, 0, 770, 0, 811, 0, 41042, 917551, - 41318, 64427, 0, 0, 78848, 3895, 0, 74341, 3976, 0, 42859, 10193, 3116, - 7747, 0, 0, 0, 0, 0, 43686, 78846, 41877, 0, 2871, 64614, 0, 999, 0, - 6345, 41876, 2663, 2017, 0, 0, 11040, 10150, 0, 64308, 1522, 597, 4775, - 12555, 12571, 12550, 12583, 12560, 2019, 12556, 12584, 3092, 0, 12562, - 4783, 12566, 12569, 12554, 0, 10812, 78851, 0, 0, 3078, 1402, 0, 0, 0, 0, - 119248, 394, 3088, 0, 0, 0, 3991, 64391, 0, 0, 424, 66328, 1999, 0, - 73914, 0, 0, 0, 0, 42231, 8246, 0, 0, 0, 41840, 0, 2377, 1298, 64011, - 12572, 11318, 12557, 12559, 12570, 8488, 1003, 2373, 9446, 7481, 9448, - 48, 0, 9480, 481, 0, 9438, 9439, 9440, 9441, 8465, 9443, 9444, 9445, - 9430, 9431, 9432, 9433, 9434, 9435, 3984, 9437, 0, 0, 9424, 9425, 9426, - 9427, 9428, 9429, 64758, 0, 9655, 0, 2004, 9096, 9782, 0, 9172, 0, 19965, - 0, 5955, 67666, 1108, 0, 74773, 0, 0, 64782, 3926, 0, 65210, 8798, 0, 0, - 1392, 0, 0, 917557, 10606, 8065, 118805, 10353, 10417, 0, 0, 64524, 0, - 4019, 0, 0, 43280, 8219, 68402, 1812, 0, 0, 0, 0, 42410, 74448, 119132, - 6054, 10697, 3169, 42297, 42322, 10642, 3909, 9950, 0, 0, 0, 68678, 0, 0, - 1049, 0, 65707, 2304, 41806, 0, 42336, 3921, 0, 11775, 64760, 11766, - 1038, 42303, 9823, 127278, 69236, 4008, 64004, 8773, 10733, 36, 0, 5153, - 41805, 0, 73735, 763, 41808, 64910, 0, 2009, 0, 0, 0, 9640, 119951, 0, - 120695, 8621, 0, 12852, 3031, 0, 64361, 0, 182, 194718, 0, 0, 119950, 0, - 9058, 366, 0, 9892, 5969, 11754, 10848, 4570, 65301, 44013, 4255, 0, - 10102, 41189, 4003, 41026, 68109, 13293, 41192, 0, 0, 42251, 0, 42534, - 65179, 11287, 6128, 0, 11034, 10923, 64423, 0, 65506, 0, 0, 74083, 0, - 9932, 0, 0, 119955, 0, 9817, 0, 120140, 0, 12117, 66586, 4183, 10540, - 66250, 9063, 127045, 0, 119954, 0, 12897, 3792, 2011, 0, 6065, 43160, 0, - 194715, 8692, 41186, 41816, 41023, 41818, 41187, 11659, 7922, 12614, - 2005, 8523, 78002, 0, 7513, 1863, 4710, 0, 5956, 7621, 78006, 127116, - 4705, 716, 78004, 0, 4704, 120040, 120270, 42241, 161, 43977, 74546, - 66214, 4706, 0, 0, 42672, 4709, 10680, 0, 43293, 0, 0, 119164, 120328, 0, - 0, 1700, 119223, 0, 0, 0, 4004, 0, 10968, 43296, 0, 8506, 0, 0, 126996, - 1005, 937, 78216, 4734, 2870, 0, 78218, 0, 7463, 4729, 0, 235, 1384, - 4728, 0, 120420, 120644, 120421, 8109, 43105, 0, 4730, 447, 13186, 1513, - 4733, 120415, 0, 0, 42527, 12911, 43427, 1383, 8565, 2469, 120024, 6690, - 6156, 68117, 43439, 7993, 4288, 120416, 2674, 13238, 11922, 0, 120330, - 3510, 13234, 0, 120407, 5605, 42095, 11364, 0, 1380, 65617, 120253, - 120261, 13196, 13197, 120309, 120682, 9495, 119346, 0, 5959, 0, 73976, - 120305, 43371, 6941, 119349, 13205, 13211, 5801, 12769, 65905, 41697, - 1283, 120302, 4779, 0, 3719, 4006, 0, 19957, 0, 2021, 119332, 0, 0, - 43028, 65493, 41838, 3875, 5962, 64341, 119339, 9814, 43457, 5827, 3314, - 7787, 78234, 65494, 68153, 0, 0, 120636, 64531, 120692, 0, 0, 0, 66316, - 65467, 5771, 41298, 0, 9742, 521, 0, 10800, 0, 8404, 194625, 483, 7096, - 7089, 66323, 928, 0, 0, 119018, 10599, 11586, 3989, 10971, 0, 65782, - 9841, 8843, 12145, 0, 10074, 78548, 0, 3769, 0, 0, 0, 0, 9573, 0, 65290, - 8849, 0, 65855, 65112, 1796, 120505, 0, 78555, 8164, 41301, 3502, 0, - 7388, 10621, 73838, 78553, 5825, 13007, 68165, 0, 120457, 12661, 7608, - 10354, 10418, 42411, 2022, 0, 1409, 12195, 4001, 3112, 10824, 120639, - 1390, 0, 0, 421, 43536, 5846, 120120, 4130, 0, 7595, 42588, 7600, 120121, - 66035, 0, 0, 65851, 42607, 0, 0, 3168, 0, 42134, 0, 2370, 2846, 0, 0, 0, - 120132, 0, 1836, 0, 0, 119137, 3740, 0, 6290, 65374, 120451, 65923, 3944, - 66628, 120434, 0, 6135, 3118, 74265, 119093, 120446, 0, 0, 8127, 8975, - 64739, 7943, 0, 0, 10618, 2584, 0, 0, 0, 9998, 0, 0, 0, 0, 0, 6204, 0, 0, - 8279, 8776, 64954, 4975, 74809, 120130, 4267, 0, 42206, 0, 0, 195046, - 65700, 66562, 0, 64645, 0, 0, 0, 12586, 0, 9242, 0, 0, 4523, 5842, 10495, - 3122, 0, 7793, 78275, 9328, 0, 0, 12604, 0, 6615, 67650, 0, 3986, 44025, - 0, 8912, 64555, 7409, 0, 0, 9541, 78276, 0, 11275, 8540, 11498, 0, 0, - 41040, 2459, 0, 13060, 41041, 74413, 0, 0, 0, 68427, 10450, 12551, 41043, - 7020, 120353, 3765, 0, 0, 1606, 120348, 120351, 3093, 68436, 0, 0, - 120649, 0, 0, 4312, 74091, 120337, 120336, 11923, 4023, 120333, 5763, - 120335, 4827, 10894, 12810, 64406, 118785, 4455, 74321, 433, 119620, - 66660, 2499, 0, 0, 0, 11973, 13089, 4293, 120329, 42224, 42758, 12196, - 42837, 42226, 119319, 0, 119126, 5817, 0, 55277, 3120, 9797, 0, 0, 0, - 10389, 0, 0, 4895, 65358, 0, 4359, 585, 0, 3509, 0, 486, 4290, 5758, 0, - 0, 0, 7004, 0, 65880, 0, 119048, 2380, 11380, 0, 0, 2376, 0, 917847, 0, - 5197, 127046, 127047, 127048, 2366, 127050, 127051, 120554, 120045, 0, 0, - 0, 0, 0, 0, 0, 74188, 0, 0, 0, 120047, 0, 0, 0, 120049, 0, 1847, 0, - 10339, 0, 42384, 0, 4227, 74158, 0, 0, 43032, 0, 42365, 0, 12671, 11384, - 0, 0, 0, 64797, 0, 5820, 0, 120052, 120065, 0, 120064, 120650, 42137, - 9893, 2754, 12664, 120063, 0, 7377, 0, 41799, 65530, 1711, 12984, 43039, - 3114, 6255, 0, 118938, 0, 10853, 926, 0, 74184, 0, 120055, 0, 43175, 0, - 43037, 41798, 41035, 11583, 0, 41801, 119088, 0, 520, 4200, 12699, 8331, - 0, 3091, 41034, 127353, 0, 8360, 0, 78044, 321, 4229, 64543, 0, 65563, 0, - 917974, 2861, 0, 10095, 0, 0, 0, 1861, 0, 0, 0, 0, 43041, 0, 0, 0, 3859, - 12181, 41660, 8209, 0, 73867, 12973, 0, 74757, 127514, 41658, 0, 0, 5760, - 0, 743, 4414, 120766, 0, 42632, 917973, 65161, 73896, 0, 0, 1405, 119063, - 43220, 43341, 0, 19919, 0, 64532, 65367, 43710, 0, 0, 3513, 0, 118883, - 43342, 119064, 65529, 65364, 0, 0, 6485, 1397, 0, 41986, 0, 0, 0, 74097, - 0, 7471, 12079, 0, 12682, 43287, 0, 0, 0, 0, 0, 0, 1099, 10490, 0, 10501, - 65181, 74463, 0, 464, 41624, 65283, 67663, 78222, 1346, 0, 917631, 64724, - 64897, 423, 1818, 65144, 0, 8272, 0, 19911, 4218, 3087, 64960, 127234, - 43564, 0, 0, 9584, 10465, 0, 74359, 12626, 9106, 0, 42642, 0, 64750, - 9390, 0, 41797, 0, 0, 265, 41795, 64666, 0, 43530, 2752, 0, 0, 0, 59, 0, - 0, 0, 0, 77873, 41810, 0, 7010, 0, 41809, 41495, 119364, 0, 42252, 42213, - 8009, 3305, 43033, 511, 119320, 66255, 13127, 120067, 0, 0, 0, 917977, - 65915, 1400, 41812, 10685, 194870, 2103, 10387, 4453, 43276, 917783, - 13159, 0, 6481, 41213, 0, 0, 0, 0, 41983, 74198, 6617, 9116, 119654, 0, - 462, 68110, 10493, 0, 8129, 0, 0, 74471, 6644, 11658, 0, 0, 3452, 11906, - 9581, 1385, 3098, 0, 119013, 43340, 0, 41033, 6493, 42626, 0, 0, 11426, - 0, 1681, 118789, 1204, 3755, 64661, 7235, 10170, 3966, 8911, 0, 41841, - 43338, 0, 0, 5726, 64915, 42175, 0, 0, 41497, 65044, 0, 2851, 43017, 0, - 0, 4373, 78058, 0, 9587, 1789, 6671, 0, 3100, 0, 65360, 0, 127510, 0, - 64922, 0, 8190, 12083, 0, 0, 6506, 64312, 74374, 2368, 0, 4419, 0, - 119125, 3439, 1825, 1192, 120106, 8891, 3080, 120228, 2347, 5430, 0, - 8990, 2848, 0, 0, 0, 249, 0, 0, 0, 120658, 0, 0, 8883, 917802, 728, - 68178, 995, 0, 0, 64826, 0, 917798, 0, 0, 19945, 8091, 558, 0, 12273, - 194814, 0, 12112, 0, 0, 0, 74419, 12335, 120104, 917795, 3443, 3129, 0, - 2102, 65445, 78258, 64891, 0, 7725, 0, 78255, 0, 8624, 69246, 12446, - 43295, 0, 41894, 0, 6277, 41672, 41893, 10010, 0, 3540, 0, 835, 0, 69816, - 119868, 74408, 0, 73959, 5426, 4258, 0, 0, 5424, 0, 8283, 0, 5434, 0, 0, - 19917, 11408, 0, 11947, 0, 1404, 3095, 11432, 194813, 3464, 6486, 4819, - 0, 0, 570, 8095, 3672, 119864, 1498, 67866, 0, 0, 431, 0, 0, 0, 0, 68167, - 0, 13096, 0, 0, 43408, 9516, 0, 5268, 42230, 42220, 0, 4450, 120723, - 11547, 43417, 0, 356, 3477, 227, 10488, 68203, 382, 11418, 0, 0, 0, 0, 0, - 0, 6484, 2541, 66039, 0, 78718, 0, 3549, 0, 9110, 119665, 2743, 0, 43290, - 194812, 9097, 0, 43015, 8782, 0, 776, 2524, 42707, 8573, 0, 0, 0, 0, - 42694, 64944, 8952, 3856, 118818, 0, 5872, 6495, 0, 0, 0, 0, 0, 120733, - 12849, 3953, 1897, 0, 65094, 11994, 4339, 74556, 0, 67843, 0, 0, 0, - 68473, 74104, 5228, 0, 7868, 43184, 0, 0, 73986, 43438, 0, 43022, 0, - 1162, 0, 2671, 0, 0, 0, 0, 118865, 4553, 73811, 0, 195005, 0, 0, 19921, - 74331, 11424, 195006, 4567, 41891, 0, 0, 55249, 4820, 65239, 194662, 0, - 0, 43042, 119212, 1377, 12869, 4897, 42821, 9250, 0, 4438, 64385, 0, - 1753, 11331, 6147, 194941, 43282, 8833, 0, 0, 6504, 78408, 126979, 10719, - 0, 1898, 1413, 42443, 0, 802, 12141, 0, 194671, 6648, 10671, 2528, 0, - 64789, 9169, 838, 127092, 120697, 844, 5014, 0, 256, 0, 9990, 0, 42739, - 0, 7542, 65464, 9726, 0, 6489, 10048, 74326, 78719, 66573, 0, 78724, - 78712, 11761, 194655, 0, 41094, 0, 0, 0, 0, 0, 6196, 6945, 194628, - 194890, 194631, 120491, 11816, 194943, 5733, 0, 0, 0, 41098, 0, 41093, 0, - 66626, 588, 9760, 0, 194717, 1238, 200, 0, 1660, 73916, 0, 118905, 74362, - 0, 0, 194651, 0, 0, 3394, 194894, 120668, 0, 0, 0, 66219, 0, 43284, - 194657, 7817, 1841, 11055, 120533, 194979, 194982, 1669, 10776, 194981, - 7701, 194980, 0, 194995, 1732, 4030, 0, 3963, 66611, 127530, 41768, 6491, - 0, 65324, 914, 65323, 8071, 3538, 0, 78713, 65328, 0, 74367, 7614, 0, - 11819, 0, 12009, 12399, 0, 67852, 65537, 0, 10841, 43430, 5301, 0, 0, - 5734, 8960, 0, 127527, 65317, 77880, 0, 0, 0, 12304, 0, 0, 65315, 0, 0, - 0, 0, 0, 119621, 0, 74536, 12447, 64486, 0, 0, 0, 0, 0, 0, 42767, 10915, - 0, 12007, 43695, 120520, 11975, 194878, 0, 0, 2555, 8629, 0, 43168, - 41872, 43706, 4496, 194879, 0, 0, 0, 0, 0, 0, 64730, 0, 66714, 68222, 0, - 0, 65596, 0, 11416, 4280, 67655, 8765, 12784, 7792, 1393, 127242, 67871, - 74386, 0, 8233, 43572, 0, 6683, 0, 3442, 12144, 2841, 12543, 0, 1473, - 42820, 64329, 917772, 0, 68642, 6488, 357, 1048, 41100, 0, 41104, 0, - 41099, 1054, 119065, 1040, 65450, 0, 4434, 1069, 0, 118862, 74231, - 917765, 0, 0, 0, 9693, 41943, 0, 41931, 41759, 12757, 4353, 0, 1059, - 9790, 8995, 0, 0, 65937, 0, 41764, 10646, 0, 118833, 0, 0, 74830, 78569, - 12743, 0, 6480, 917761, 41779, 42580, 66601, 12207, 119619, 6335, 66602, - 11312, 64807, 0, 0, 41767, 0, 0, 43020, 0, 3955, 74254, 0, 0, 917861, 0, - 77926, 9770, 9246, 12230, 0, 0, 0, 10448, 41783, 41786, 127093, 12797, - 2755, 64571, 78578, 194927, 4857, 0, 4428, 12794, 73755, 0, 78574, 0, 0, - 0, 5747, 78825, 0, 7978, 41092, 74571, 0, 11924, 74205, 42144, 65015, 0, - 563, 0, 0, 12798, 11271, 57, 0, 0, 917860, 119043, 0, 0, 43137, 694, 0, - 9876, 0, 119168, 0, 78822, 64537, 0, 277, 74385, 7229, 12761, 0, 0, - 13025, 64811, 8757, 78824, 0, 1574, 7381, 0, 2525, 4852, 5749, 68465, - 13027, 42824, 120574, 1039, 9801, 10155, 5745, 188, 41858, 11592, 0, - 74015, 9055, 41853, 4858, 917780, 0, 436, 4771, 0, 2786, 0, 4856, 8051, - 0, 119609, 0, 9644, 0, 0, 0, 194916, 120732, 66710, 118834, 0, 73906, 0, - 127114, 0, 10234, 5843, 11939, 0, 42157, 0, 3157, 194918, 68393, 0, 3504, - 119178, 0, 10822, 5149, 66029, 10226, 65142, 0, 3594, 42424, 194959, 40, - 12657, 0, 0, 386, 0, 8834, 0, 12815, 43574, 0, 73907, 0, 74196, 7220, - 74504, 0, 74316, 0, 77932, 4304, 74503, 8160, 78707, 194753, 0, 0, 0, - 1348, 0, 78597, 0, 13303, 0, 0, 194755, 7599, 1278, 43616, 13269, 0, 0, - 74387, 78179, 78598, 74492, 6097, 7568, 8780, 4982, 0, 74501, 194763, - 78592, 194762, 2672, 3735, 194735, 13138, 42266, 9484, 10724, 41202, - 119024, 0, 43742, 0, 9487, 119959, 119117, 3842, 195034, 78668, 12442, - 6193, 9791, 0, 0, 42516, 7228, 7559, 74803, 78468, 194851, 11399, 119219, - 194691, 194855, 194690, 194857, 3604, 0, 119188, 0, 78540, 78541, 42507, - 1962, 78490, 78476, 42505, 11660, 0, 2072, 0, 6995, 74173, 5437, 74174, - 10669, 8702, 7964, 194706, 0, 199, 194843, 4105, 194845, 194699, 194847, - 194710, 119875, 13148, 7560, 78479, 9226, 78480, 195070, 6472, 65814, - 73954, 0, 4724, 0, 0, 9191, 0, 64432, 0, 0, 195024, 10196, 7886, 0, 6585, - 0, 6680, 195042, 0, 195051, 6679, 74412, 0, 194866, 74421, 11382, 0, 0, - 0, 0, 194833, 194832, 6681, 194834, 12693, 194836, 42727, 194838, 194841, - 78195, 65442, 119610, 78199, 12166, 43248, 66248, 194816, 0, 194818, - 194817, 194820, 194819, 5297, 7042, 13284, 6112, 7968, 194825, 73927, - 194738, 194736, 65746, 0, 74409, 74389, 194826, 4342, 42839, 194831, - 1677, 0, 0, 194806, 917855, 11091, 11011, 2719, 0, 0, 119595, 64495, 0, - 0, 7585, 65169, 2052, 4308, 917858, 74177, 7505, 543, 64916, 64736, 0, 0, - 64655, 0, 118922, 2064, 0, 43158, 7902, 0, 65265, 194639, 0, 0, 0, 0, 0, - 0, 12994, 0, 10828, 0, 6228, 4307, 3482, 0, 0, 0, 0, 506, 74573, 41194, - 65735, 2055, 43255, 41195, 0, 8169, 0, 8841, 0, 516, 0, 2063, 119051, 34, - 0, 120186, 11504, 1612, 74333, 120182, 74520, 74308, 12001, 120178, - 10242, 64564, 120179, 120174, 6584, 7749, 11037, 0, 1758, 0, 10667, - 10560, 120197, 120756, 1935, 11517, 120193, 120196, 120195, 1931, 120189, - 74839, 120191, 1217, 64702, 12643, 825, 0, 194905, 12294, 127261, 78834, - 9138, 78831, 78833, 12631, 78829, 11080, 74554, 0, 5591, 1239, 0, 11313, - 0, 3403, 0, 0, 64364, 0, 0, 74582, 8998, 12988, 0, 9152, 0, 0, 194898, - 67589, 41850, 64290, 3433, 0, 12615, 1594, 42192, 6914, 67603, 0, 119569, - 74565, 41353, 67602, 67611, 4337, 0, 194897, 918, 65035, 41351, 7681, - 194900, 42577, 41393, 12668, 194904, 2477, 0, 0, 127302, 0, 67604, - 194880, 127235, 573, 194881, 194884, 11417, 194886, 194885, 194888, - 67599, 0, 194889, 67607, 11482, 0, 0, 3357, 0, 42223, 4207, 1288, 78842, - 78839, 68419, 78837, 11589, 42195, 194872, 917627, 127263, 64602, 67618, - 0, 0, 42788, 68416, 64480, 194875, 8423, 3348, 448, 68476, 9717, 0, 0, - 997, 0, 0, 0, 0, 11440, 11379, 42000, 13139, 42221, 65013, 126999, 0, - 73796, 0, 119228, 12035, 0, 2818, 0, 0, 73793, 0, 4172, 0, 0, 8373, - 10873, 12197, 0, 0, 0, 0, 0, 78210, 0, 0, 194865, 126982, 74563, 64828, - 11419, 194868, 766, 1257, 0, 118845, 11381, 3265, 66617, 3274, 0, 0, 0, - 0, 119092, 41989, 0, 0, 0, 3263, 0, 65672, 0, 3270, 64539, 11489, 0, 0, - 0, 0, 9505, 65518, 194776, 756, 195052, 0, 0, 0, 7261, 0, 186, 0, 119156, - 5770, 13179, 65830, 12612, 12949, 64856, 12800, 0, 74203, 64718, 0, 0, 0, - 118929, 0, 11578, 0, 119296, 0, 0, 0, 0, 74568, 9254, 0, 1794, 120217, - 64521, 5624, 120220, 120221, 119958, 120223, 3617, 66636, 64886, 120211, - 120212, 120213, 120214, 1872, 66508, 120467, 41079, 10748, 5502, 119330, - 4452, 0, 0, 917879, 4511, 0, 0, 64678, 11425, 0, 43245, 1231, 0, 0, 0, - 9003, 8192, 0, 5305, 9653, 10616, 8694, 9546, 0, 0, 120478, 120200, - 65205, 120202, 64063, 9878, 74780, 119626, 78202, 64058, 8799, 42131, 0, - 64062, 1028, 64060, 64059, 837, 10567, 0, 43103, 0, 120754, 11427, 2902, - 64043, 64042, 66464, 10756, 0, 42606, 64045, 64044, 43979, 10076, 64040, - 43060, 0, 1034, 3392, 0, 43091, 64033, 64032, 42735, 64038, 64037, 64036, - 64035, 4291, 194928, 64015, 64014, 64681, 194930, 0, 78145, 0, 43090, 0, - 3476, 8973, 64012, 42473, 64010, 64008, 64007, 2003, 7706, 64517, 78153, - 2538, 64009, 204, 0, 4802, 4111, 8239, 9098, 4805, 64001, 64057, 7885, - 7247, 64054, 0, 0, 4767, 9343, 64049, 64048, 120034, 1133, 64053, 64052, - 43453, 64050, 41340, 118975, 0, 10005, 12329, 41333, 0, 8489, 1942, 0, 0, - 42520, 0, 0, 0, 10760, 64023, 64022, 64021, 6582, 43670, 0, 64025, 9167, - 42151, 78244, 0, 2026, 64019, 64018, 64017, 64016, 12768, 0, 7582, 78252, - 78248, 77914, 78246, 78247, 0, 77915, 78766, 6788, 13094, 77920, 7532, - 41414, 78520, 3179, 78518, 64769, 78514, 78517, 11461, 74454, 10751, - 9051, 120720, 6708, 10535, 0, 68218, 55274, 2008, 64031, 64030, 294, - 41874, 0, 126991, 65929, 0, 0, 0, 0, 64028, 8146, 64026, 41788, 194844, - 0, 118795, 6343, 43247, 119888, 0, 119886, 119891, 119892, 119889, 11433, - 119895, 119896, 0, 7801, 65578, 194839, 12915, 43968, 3297, 9699, 194955, - 1135, 0, 0, 0, 1995, 6722, 0, 0, 2552, 41546, 60, 68394, 8649, 41549, - 78496, 0, 0, 6682, 0, 78679, 64710, 41547, 0, 2013, 0, 78530, 78532, - 78528, 78529, 12832, 78493, 8081, 8362, 3537, 119908, 9137, 119906, 8999, - 0, 78533, 3466, 0, 0, 1996, 0, 3453, 6282, 0, 2002, 2000, 120175, 537, 0, - 4179, 65119, 1998, 0, 1842, 0, 0, 9628, 68446, 12081, 9826, 64502, 1767, - 0, 0, 0, 120201, 0, 0, 0, 3059, 44024, 120204, 119953, 120205, 0, 0, 0, - 4100, 920, 1811, 1355, 0, 0, 3592, 10078, 0, 0, 0, 8592, 65870, 68164, 0, - 10742, 0, 0, 1994, 9281, 3296, 12865, 1997, 1895, -}; - -#define code_magic 47 -#define code_size 32768 -#define code_poly 32771 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/xxsubtype.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/xxsubtype.c deleted file mode 100644 index a227bd2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/xxsubtype.c +++ /dev/null @@ -1,297 +0,0 @@ -#include "Python.h" -#include "structmember.h" - -PyDoc_STRVAR(xxsubtype__doc__, -"xxsubtype is an example module showing how to subtype builtin types from C.\n" -"test_descr.py in the standard test suite requires it in order to complete.\n" -"If you don't care about the examples, and don't intend to run the Python\n" -"test suite, you can recompile Python without Modules/xxsubtype.c."); - -/* We link this module statically for convenience. If compiled as a shared - library instead, some compilers don't allow addresses of Python objects - defined in other libraries to be used in static initializers here. The - DEFERRED_ADDRESS macro is used to tag the slots where such addresses - appear; the module init function must fill in the tagged slots at runtime. - The argument is for documentation -- the macro ignores it. -*/ -#define DEFERRED_ADDRESS(ADDR) 0 - -/* spamlist -- a list subtype */ - -typedef struct { - PyListObject list; - int state; -} spamlistobject; - -static PyObject * -spamlist_getstate(spamlistobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":getstate")) - return NULL; - return PyInt_FromLong(self->state); -} - -static PyObject * -spamlist_setstate(spamlistobject *self, PyObject *args) -{ - int state; - - if (!PyArg_ParseTuple(args, "i:setstate", &state)) - return NULL; - self->state = state; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -spamlist_specialmeth(PyObject *self, PyObject *args, PyObject *kw) -{ - PyObject *result = PyTuple_New(3); - - if (result != NULL) { - if (self == NULL) - self = Py_None; - if (kw == NULL) - kw = Py_None; - Py_INCREF(self); - PyTuple_SET_ITEM(result, 0, self); - Py_INCREF(args); - PyTuple_SET_ITEM(result, 1, args); - Py_INCREF(kw); - PyTuple_SET_ITEM(result, 2, kw); - } - return result; -} - -static PyMethodDef spamlist_methods[] = { - {"getstate", (PyCFunction)spamlist_getstate, METH_VARARGS, - PyDoc_STR("getstate() -> state")}, - {"setstate", (PyCFunction)spamlist_setstate, METH_VARARGS, - PyDoc_STR("setstate(state)")}, - /* These entries differ only in the flags; they are used by the tests - in test.test_descr. */ - {"classmeth", (PyCFunction)spamlist_specialmeth, - METH_VARARGS | METH_KEYWORDS | METH_CLASS, - PyDoc_STR("classmeth(*args, **kw)")}, - {"staticmeth", (PyCFunction)spamlist_specialmeth, - METH_VARARGS | METH_KEYWORDS | METH_STATIC, - PyDoc_STR("staticmeth(*args, **kw)")}, - {NULL, NULL}, -}; - -static int -spamlist_init(spamlistobject *self, PyObject *args, PyObject *kwds) -{ - if (PyList_Type.tp_init((PyObject *)self, args, kwds) < 0) - return -1; - self->state = 0; - return 0; -} - -static PyObject * -spamlist_state_get(spamlistobject *self) -{ - return PyInt_FromLong(self->state); -} - -static PyGetSetDef spamlist_getsets[] = { - {"state", (getter)spamlist_state_get, NULL, - PyDoc_STR("an int variable for demonstration purposes")}, - {0} -}; - -static PyTypeObject spamlist_type = { - PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0) - "xxsubtype.spamlist", - sizeof(spamlistobject), - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - spamlist_methods, /* tp_methods */ - 0, /* tp_members */ - spamlist_getsets, /* tp_getset */ - DEFERRED_ADDRESS(&PyList_Type), /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)spamlist_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/* spamdict -- a dict subtype */ - -typedef struct { - PyDictObject dict; - int state; -} spamdictobject; - -static PyObject * -spamdict_getstate(spamdictobject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, ":getstate")) - return NULL; - return PyInt_FromLong(self->state); -} - -static PyObject * -spamdict_setstate(spamdictobject *self, PyObject *args) -{ - int state; - - if (!PyArg_ParseTuple(args, "i:setstate", &state)) - return NULL; - self->state = state; - Py_INCREF(Py_None); - return Py_None; -} - -static PyMethodDef spamdict_methods[] = { - {"getstate", (PyCFunction)spamdict_getstate, METH_VARARGS, - PyDoc_STR("getstate() -> state")}, - {"setstate", (PyCFunction)spamdict_setstate, METH_VARARGS, - PyDoc_STR("setstate(state)")}, - {NULL, NULL}, -}; - -static int -spamdict_init(spamdictobject *self, PyObject *args, PyObject *kwds) -{ - if (PyDict_Type.tp_init((PyObject *)self, args, kwds) < 0) - return -1; - self->state = 0; - return 0; -} - -static PyMemberDef spamdict_members[] = { - {"state", T_INT, offsetof(spamdictobject, state), READONLY, - PyDoc_STR("an int variable for demonstration purposes")}, - {0} -}; - -static PyTypeObject spamdict_type = { - PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0) - "xxsubtype.spamdict", - sizeof(spamdictobject), - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - spamdict_methods, /* tp_methods */ - spamdict_members, /* tp_members */ - 0, /* tp_getset */ - DEFERRED_ADDRESS(&PyDict_Type), /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)spamdict_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -static PyObject * -spam_bench(PyObject *self, PyObject *args) -{ - PyObject *obj, *name, *res; - int n = 1000; - time_t t0, t1; - - if (!PyArg_ParseTuple(args, "OS|i", &obj, &name, &n)) - return NULL; - t0 = clock(); - while (--n >= 0) { - res = PyObject_GetAttr(obj, name); - if (res == NULL) - return NULL; - Py_DECREF(res); - } - t1 = clock(); - return PyFloat_FromDouble((double)(t1-t0) / CLOCKS_PER_SEC); -} - -static PyMethodDef xxsubtype_functions[] = { - {"bench", spam_bench, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -PyMODINIT_FUNC -initxxsubtype(void) -{ - PyObject *m; - - /* Fill in deferred data addresses. This must be done before - PyType_Ready() is called. Note that PyType_Ready() automatically - initializes the ob.ob_type field to &PyType_Type if it's NULL, - so it's not necessary to fill in ob_type first. */ - spamdict_type.tp_base = &PyDict_Type; - if (PyType_Ready(&spamdict_type) < 0) - return; - - spamlist_type.tp_base = &PyList_Type; - if (PyType_Ready(&spamlist_type) < 0) - return; - - m = Py_InitModule3("xxsubtype", - xxsubtype_functions, - xxsubtype__doc__); - if (m == NULL) - return; - - if (PyType_Ready(&spamlist_type) < 0) - return; - if (PyType_Ready(&spamdict_type) < 0) - return; - - Py_INCREF(&spamlist_type); - if (PyModule_AddObject(m, "spamlist", - (PyObject *) &spamlist_type) < 0) - return; - - Py_INCREF(&spamdict_type); - if (PyModule_AddObject(m, "spamdict", - (PyObject *) &spamdict_type) < 0) - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zipimport.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zipimport.c deleted file mode 100644 index 6f65c17..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zipimport.c +++ /dev/null @@ -1,1257 +0,0 @@ -#include "Python.h" -#include "structmember.h" -#include "osdefs.h" -#include "marshal.h" -#include - - -#define IS_SOURCE 0x0 -#define IS_BYTECODE 0x1 -#define IS_PACKAGE 0x2 - -struct st_zip_searchorder { - char suffix[14]; - int type; -}; - -/* zip_searchorder defines how we search for a module in the Zip - archive: we first search for a package __init__, then for - non-package .pyc, .pyo and .py entries. The .pyc and .pyo entries - are swapped by initzipimport() if we run in optimized mode. Also, - '/' is replaced by SEP there. */ -static struct st_zip_searchorder zip_searchorder[] = { - {"/__init__.pyc", IS_PACKAGE | IS_BYTECODE}, - {"/__init__.pyo", IS_PACKAGE | IS_BYTECODE}, - {"/__init__.py", IS_PACKAGE | IS_SOURCE}, - {".pyc", IS_BYTECODE}, - {".pyo", IS_BYTECODE}, - {".py", IS_SOURCE}, - {"", 0} -}; - -/* zipimporter object definition and support */ - -typedef struct _zipimporter ZipImporter; - -struct _zipimporter { - PyObject_HEAD - PyObject *archive; /* pathname of the Zip archive */ - PyObject *prefix; /* file prefix: "a/sub/directory/" */ - PyObject *files; /* dict with file info {path: toc_entry} */ -}; - -static PyObject *ZipImportError; -static PyObject *zip_directory_cache = NULL; - -/* forward decls */ -static PyObject *read_directory(char *archive); -static PyObject *get_data(char *archive, PyObject *toc_entry); -static PyObject *get_module_code(ZipImporter *self, char *fullname, - int *p_ispackage, char **p_modpath); - - -#define ZipImporter_Check(op) PyObject_TypeCheck(op, &ZipImporter_Type) - - -/* zipimporter.__init__ - Split the "subdirectory" from the Zip archive path, lookup a matching - entry in sys.path_importer_cache, fetch the file directory from there - if found, or else read it from the archive. */ -static int -zipimporter_init(ZipImporter *self, PyObject *args, PyObject *kwds) -{ - char *path, *p, *prefix, buf[MAXPATHLEN+2]; - size_t len; - - if (!_PyArg_NoKeywords("zipimporter()", kwds)) - return -1; - - if (!PyArg_ParseTuple(args, "s:zipimporter", - &path)) - return -1; - - len = strlen(path); - if (len == 0) { - PyErr_SetString(ZipImportError, "archive path is empty"); - return -1; - } - if (len >= MAXPATHLEN) { - PyErr_SetString(ZipImportError, - "archive path too long"); - return -1; - } - strcpy(buf, path); - -#ifdef ALTSEP - for (p = buf; *p; p++) { - if (*p == ALTSEP) - *p = SEP; - } -#endif - - path = NULL; - prefix = NULL; - for (;;) { -#ifndef RISCOS - struct stat statbuf; - int rv; - - rv = stat(buf, &statbuf); - if (rv == 0) { - /* it exists */ - if (S_ISREG(statbuf.st_mode)) - /* it's a file */ - path = buf; - break; - } -#else - if (object_exists(buf)) { - /* it exists */ - if (isfile(buf)) - /* it's a file */ - path = buf; - break; - } -#endif - /* back up one path element */ - p = strrchr(buf, SEP); - if (prefix != NULL) - *prefix = SEP; - if (p == NULL) - break; - *p = '\0'; - prefix = p; - } - if (path != NULL) { - PyObject *files; - files = PyDict_GetItemString(zip_directory_cache, path); - if (files == NULL) { - files = read_directory(buf); - if (files == NULL) - return -1; - if (PyDict_SetItemString(zip_directory_cache, path, - files) != 0) - return -1; - } - else - Py_INCREF(files); - self->files = files; - } - else { - PyErr_SetString(ZipImportError, "not a Zip file"); - return -1; - } - - if (prefix == NULL) - prefix = ""; - else { - prefix++; - len = strlen(prefix); - if (prefix[len-1] != SEP) { - /* add trailing SEP */ - prefix[len] = SEP; - prefix[len + 1] = '\0'; - } - } - - self->archive = PyString_FromString(buf); - if (self->archive == NULL) - return -1; - - self->prefix = PyString_FromString(prefix); - if (self->prefix == NULL) - return -1; - - return 0; -} - -/* GC support. */ -static int -zipimporter_traverse(PyObject *obj, visitproc visit, void *arg) -{ - ZipImporter *self = (ZipImporter *)obj; - Py_VISIT(self->files); - return 0; -} - -static void -zipimporter_dealloc(ZipImporter *self) -{ - PyObject_GC_UnTrack(self); - Py_XDECREF(self->archive); - Py_XDECREF(self->prefix); - Py_XDECREF(self->files); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static PyObject * -zipimporter_repr(ZipImporter *self) -{ - char buf[500]; - char *archive = "???"; - char *prefix = ""; - - if (self->archive != NULL && PyString_Check(self->archive)) - archive = PyString_AsString(self->archive); - if (self->prefix != NULL && PyString_Check(self->prefix)) - prefix = PyString_AsString(self->prefix); - if (prefix != NULL && *prefix) - PyOS_snprintf(buf, sizeof(buf), - "", - archive, SEP, prefix); - else - PyOS_snprintf(buf, sizeof(buf), - "", - archive); - return PyString_FromString(buf); -} - -/* return fullname.split(".")[-1] */ -static char * -get_subname(char *fullname) -{ - char *subname = strrchr(fullname, '.'); - if (subname == NULL) - subname = fullname; - else - subname++; - return subname; -} - -/* Given a (sub)modulename, write the potential file path in the - archive (without extension) to the path buffer. Return the - length of the resulting string. */ -static int -make_filename(char *prefix, char *name, char *path) -{ - size_t len; - char *p; - - len = strlen(prefix); - - /* self.prefix + name [+ SEP + "__init__"] + ".py[co]" */ - if (len + strlen(name) + 13 >= MAXPATHLEN) { - PyErr_SetString(ZipImportError, "path too long"); - return -1; - } - - strcpy(path, prefix); - strcpy(path + len, name); - for (p = path + len; *p; p++) { - if (*p == '.') - *p = SEP; - } - len += strlen(name); - assert(len < INT_MAX); - return (int)len; -} - -enum zi_module_info { - MI_ERROR, - MI_NOT_FOUND, - MI_MODULE, - MI_PACKAGE -}; - -/* Return some information about a module. */ -static enum zi_module_info -get_module_info(ZipImporter *self, char *fullname) -{ - char *subname, path[MAXPATHLEN + 1]; - int len; - struct st_zip_searchorder *zso; - - subname = get_subname(fullname); - - len = make_filename(PyString_AsString(self->prefix), subname, path); - if (len < 0) - return MI_ERROR; - - for (zso = zip_searchorder; *zso->suffix; zso++) { - strcpy(path + len, zso->suffix); - if (PyDict_GetItemString(self->files, path) != NULL) { - if (zso->type & IS_PACKAGE) - return MI_PACKAGE; - else - return MI_MODULE; - } - } - return MI_NOT_FOUND; -} - -/* Check whether we can satisfy the import of the module named by - 'fullname'. Return self if we can, None if we can't. */ -static PyObject * -zipimporter_find_module(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - PyObject *path = NULL; - char *fullname; - enum zi_module_info mi; - - if (!PyArg_ParseTuple(args, "s|O:zipimporter.find_module", - &fullname, &path)) - return NULL; - - mi = get_module_info(self, fullname); - if (mi == MI_ERROR) - return NULL; - if (mi == MI_NOT_FOUND) { - Py_INCREF(Py_None); - return Py_None; - } - Py_INCREF(self); - return (PyObject *)self; -} - -/* Load and return the module named by 'fullname'. */ -static PyObject * -zipimporter_load_module(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - PyObject *code, *mod, *dict; - char *fullname, *modpath; - int ispackage; - - if (!PyArg_ParseTuple(args, "s:zipimporter.load_module", - &fullname)) - return NULL; - - code = get_module_code(self, fullname, &ispackage, &modpath); - if (code == NULL) - return NULL; - - mod = PyImport_AddModule(fullname); - if (mod == NULL) { - Py_DECREF(code); - return NULL; - } - dict = PyModule_GetDict(mod); - - /* mod.__loader__ = self */ - if (PyDict_SetItemString(dict, "__loader__", (PyObject *)self) != 0) - goto error; - - if (ispackage) { - /* add __path__ to the module *before* the code gets - executed */ - PyObject *pkgpath, *fullpath; - char *prefix = PyString_AsString(self->prefix); - char *subname = get_subname(fullname); - int err; - - fullpath = PyString_FromFormat("%s%c%s%s", - PyString_AsString(self->archive), - SEP, - *prefix ? prefix : "", - subname); - if (fullpath == NULL) - goto error; - - pkgpath = Py_BuildValue("[O]", fullpath); - Py_DECREF(fullpath); - if (pkgpath == NULL) - goto error; - err = PyDict_SetItemString(dict, "__path__", pkgpath); - Py_DECREF(pkgpath); - if (err != 0) - goto error; - } - mod = PyImport_ExecCodeModuleEx(fullname, code, modpath); - Py_DECREF(code); - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # loaded from Zip %s\n", - fullname, modpath); - return mod; -error: - Py_DECREF(code); - Py_DECREF(mod); - return NULL; -} - -/* Return a string matching __file__ for the named module */ -static PyObject * -zipimporter_get_filename(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - PyObject *code; - char *fullname, *modpath; - int ispackage; - - if (!PyArg_ParseTuple(args, "s:zipimporter.get_filename", - &fullname)) - return NULL; - - /* Deciding the filename requires working out where the code - would come from if the module was actually loaded */ - code = get_module_code(self, fullname, &ispackage, &modpath); - if (code == NULL) - return NULL; - Py_DECREF(code); /* Only need the path info */ - - return PyString_FromString(modpath); -} - -/* Return a bool signifying whether the module is a package or not. */ -static PyObject * -zipimporter_is_package(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - char *fullname; - enum zi_module_info mi; - - if (!PyArg_ParseTuple(args, "s:zipimporter.is_package", - &fullname)) - return NULL; - - mi = get_module_info(self, fullname); - if (mi == MI_ERROR) - return NULL; - if (mi == MI_NOT_FOUND) { - PyErr_Format(ZipImportError, "can't find module '%.200s'", - fullname); - return NULL; - } - return PyBool_FromLong(mi == MI_PACKAGE); -} - -static PyObject * -zipimporter_get_data(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - char *path; -#ifdef ALTSEP - char *p, buf[MAXPATHLEN + 1]; -#endif - PyObject *toc_entry; - Py_ssize_t len; - - if (!PyArg_ParseTuple(args, "s:zipimporter.get_data", &path)) - return NULL; - -#ifdef ALTSEP - if (strlen(path) >= MAXPATHLEN) { - PyErr_SetString(ZipImportError, "path too long"); - return NULL; - } - strcpy(buf, path); - for (p = buf; *p; p++) { - if (*p == ALTSEP) - *p = SEP; - } - path = buf; -#endif - len = PyString_Size(self->archive); - if ((size_t)len < strlen(path) && - strncmp(path, PyString_AsString(self->archive), len) == 0 && - path[len] == SEP) { - path = path + len + 1; - } - - toc_entry = PyDict_GetItemString(self->files, path); - if (toc_entry == NULL) { - PyErr_SetFromErrnoWithFilename(PyExc_IOError, path); - return NULL; - } - return get_data(PyString_AsString(self->archive), toc_entry); -} - -static PyObject * -zipimporter_get_code(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - char *fullname; - - if (!PyArg_ParseTuple(args, "s:zipimporter.get_code", &fullname)) - return NULL; - - return get_module_code(self, fullname, NULL, NULL); -} - -static PyObject * -zipimporter_get_source(PyObject *obj, PyObject *args) -{ - ZipImporter *self = (ZipImporter *)obj; - PyObject *toc_entry; - char *fullname, *subname, path[MAXPATHLEN+1]; - int len; - enum zi_module_info mi; - - if (!PyArg_ParseTuple(args, "s:zipimporter.get_source", &fullname)) - return NULL; - - mi = get_module_info(self, fullname); - if (mi == MI_ERROR) - return NULL; - if (mi == MI_NOT_FOUND) { - PyErr_Format(ZipImportError, "can't find module '%.200s'", - fullname); - return NULL; - } - subname = get_subname(fullname); - - len = make_filename(PyString_AsString(self->prefix), subname, path); - if (len < 0) - return NULL; - - if (mi == MI_PACKAGE) { - path[len] = SEP; - strcpy(path + len + 1, "__init__.py"); - } - else - strcpy(path + len, ".py"); - - toc_entry = PyDict_GetItemString(self->files, path); - if (toc_entry != NULL) - return get_data(PyString_AsString(self->archive), toc_entry); - - /* we have the module, but no source */ - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(doc_find_module, -"find_module(fullname, path=None) -> self or None.\n\ -\n\ -Search for a module specified by 'fullname'. 'fullname' must be the\n\ -fully qualified (dotted) module name. It returns the zipimporter\n\ -instance itself if the module was found, or None if it wasn't.\n\ -The optional 'path' argument is ignored -- it's there for compatibility\n\ -with the importer protocol."); - -PyDoc_STRVAR(doc_load_module, -"load_module(fullname) -> module.\n\ -\n\ -Load the module specified by 'fullname'. 'fullname' must be the\n\ -fully qualified (dotted) module name. It returns the imported\n\ -module, or raises ZipImportError if it wasn't found."); - -PyDoc_STRVAR(doc_get_data, -"get_data(pathname) -> string with file data.\n\ -\n\ -Return the data associated with 'pathname'. Raise IOError if\n\ -the file wasn't found."); - -PyDoc_STRVAR(doc_is_package, -"is_package(fullname) -> bool.\n\ -\n\ -Return True if the module specified by fullname is a package.\n\ -Raise ZipImportError if the module couldn't be found."); - -PyDoc_STRVAR(doc_get_code, -"get_code(fullname) -> code object.\n\ -\n\ -Return the code object for the specified module. Raise ZipImportError\n\ -if the module couldn't be found."); - -PyDoc_STRVAR(doc_get_source, -"get_source(fullname) -> source string.\n\ -\n\ -Return the source code for the specified module. Raise ZipImportError\n\ -if the module couldn't be found, return None if the archive does\n\ -contain the module, but has no source for it."); - - -PyDoc_STRVAR(doc_get_filename, -"get_filename(fullname) -> filename string.\n\ -\n\ -Return the filename for the specified module."); - -static PyMethodDef zipimporter_methods[] = { - {"find_module", zipimporter_find_module, METH_VARARGS, - doc_find_module}, - {"load_module", zipimporter_load_module, METH_VARARGS, - doc_load_module}, - {"get_data", zipimporter_get_data, METH_VARARGS, - doc_get_data}, - {"get_code", zipimporter_get_code, METH_VARARGS, - doc_get_code}, - {"get_source", zipimporter_get_source, METH_VARARGS, - doc_get_source}, - {"get_filename", zipimporter_get_filename, METH_VARARGS, - doc_get_filename}, - {"is_package", zipimporter_is_package, METH_VARARGS, - doc_is_package}, - {NULL, NULL} /* sentinel */ -}; - -static PyMemberDef zipimporter_members[] = { - {"archive", T_OBJECT, offsetof(ZipImporter, archive), READONLY}, - {"prefix", T_OBJECT, offsetof(ZipImporter, prefix), READONLY}, - {"_files", T_OBJECT, offsetof(ZipImporter, files), READONLY}, - {NULL} -}; - -PyDoc_STRVAR(zipimporter_doc, -"zipimporter(archivepath) -> zipimporter object\n\ -\n\ -Create a new zipimporter instance. 'archivepath' must be a path to\n\ -a zipfile, or to a specific path inside a zipfile. For example, it can be\n\ -'/tmp/myimport.zip', or '/tmp/myimport.zip/mydirectory', if mydirectory is a\n\ -valid directory inside the archive.\n\ -\n\ -'ZipImportError is raised if 'archivepath' doesn't point to a valid Zip\n\ -archive.\n\ -\n\ -The 'archive' attribute of zipimporter objects contains the name of the\n\ -zipfile targeted."); - -#define DEFERRED_ADDRESS(ADDR) 0 - -static PyTypeObject ZipImporter_Type = { - PyVarObject_HEAD_INIT(DEFERRED_ADDRESS(&PyType_Type), 0) - "zipimport.zipimporter", - sizeof(ZipImporter), - 0, /* tp_itemsize */ - (destructor)zipimporter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)zipimporter_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_HAVE_GC, /* tp_flags */ - zipimporter_doc, /* tp_doc */ - zipimporter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - zipimporter_methods, /* tp_methods */ - zipimporter_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)zipimporter_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/* implementation */ - -/* Given a buffer, return the long that is represented by the first - 4 bytes, encoded as little endian. This partially reimplements - marshal.c:r_long() */ -static long -get_long(unsigned char *buf) { - long x; - x = buf[0]; - x |= (long)buf[1] << 8; - x |= (long)buf[2] << 16; - x |= (long)buf[3] << 24; -#if SIZEOF_LONG > 4 - /* Sign extension for 64-bit machines */ - x |= -(x & 0x80000000L); -#endif - return x; -} - -/* - read_directory(archive) -> files dict (new reference) - - Given a path to a Zip archive, build a dict, mapping file names - (local to the archive, using SEP as a separator) to toc entries. - - A toc_entry is a tuple: - - (__file__, # value to use for __file__, available for all files - compress, # compression kind; 0 for uncompressed - data_size, # size of compressed data on disk - file_size, # size of decompressed data - file_offset, # offset of file header from start of archive - time, # mod time of file (in dos format) - date, # mod data of file (in dos format) - crc, # crc checksum of the data - ) - - Directories can be recognized by the trailing SEP in the name, - data_size and file_offset are 0. -*/ -static PyObject * -read_directory(char *archive) -{ - PyObject *files = NULL; - FILE *fp; - long compress, crc, data_size, file_size, file_offset, date, time; - long header_offset, name_size, header_size, header_position; - long i, l, count; - size_t length; - char path[MAXPATHLEN + 5]; - char name[MAXPATHLEN + 5]; - char *p, endof_central_dir[22]; - long arc_offset; /* offset from beginning of file to start of zip-archive */ - - if (strlen(archive) > MAXPATHLEN) { - PyErr_SetString(PyExc_OverflowError, - "Zip path name is too long"); - return NULL; - } - strcpy(path, archive); - - fp = fopen(archive, "rb"); - if (fp == NULL) { - PyErr_Format(ZipImportError, "can't open Zip file: " - "'%.200s'", archive); - return NULL; - } - - if (fseek(fp, -22, SEEK_END) == -1) { - fclose(fp); - PyErr_Format(ZipImportError, "can't read Zip file: %s", archive); - return NULL; - } - header_position = ftell(fp); - if (fread(endof_central_dir, 1, 22, fp) != 22) { - fclose(fp); - PyErr_Format(ZipImportError, "can't read Zip file: " - "'%.200s'", archive); - return NULL; - } - if (get_long((unsigned char *)endof_central_dir) != 0x06054B50) { - /* Bad: End of Central Dir signature */ - fclose(fp); - PyErr_Format(ZipImportError, "not a Zip file: " - "'%.200s'", archive); - return NULL; - } - - header_size = get_long((unsigned char *)endof_central_dir + 12); - header_offset = get_long((unsigned char *)endof_central_dir + 16); - arc_offset = header_position - header_offset - header_size; - header_offset += arc_offset; - - files = PyDict_New(); - if (files == NULL) - goto error; - - length = (long)strlen(path); - path[length] = SEP; - - /* Start of Central Directory */ - count = 0; - for (;;) { - PyObject *t; - int err; - - if (fseek(fp, header_offset, 0) == -1) /* Start of file header */ - goto fseek_error; - l = PyMarshal_ReadLongFromFile(fp); - if (l != 0x02014B50) - break; /* Bad: Central Dir File Header */ - if (fseek(fp, header_offset + 10, 0) == -1) - goto fseek_error; - compress = PyMarshal_ReadShortFromFile(fp); - time = PyMarshal_ReadShortFromFile(fp); - date = PyMarshal_ReadShortFromFile(fp); - crc = PyMarshal_ReadLongFromFile(fp); - data_size = PyMarshal_ReadLongFromFile(fp); - file_size = PyMarshal_ReadLongFromFile(fp); - name_size = PyMarshal_ReadShortFromFile(fp); - header_size = 46 + name_size + - PyMarshal_ReadShortFromFile(fp) + - PyMarshal_ReadShortFromFile(fp); - if (fseek(fp, header_offset + 42, 0) == -1) - goto fseek_error; - file_offset = PyMarshal_ReadLongFromFile(fp) + arc_offset; - if (name_size > MAXPATHLEN) - name_size = MAXPATHLEN; - - p = name; - for (i = 0; i < name_size; i++) { - *p = (char)getc(fp); - if (*p == '/') - *p = SEP; - p++; - } - *p = 0; /* Add terminating null byte */ - header_offset += header_size; - - strncpy(path + length + 1, name, MAXPATHLEN - length - 1); - - t = Py_BuildValue("siiiiiii", path, compress, data_size, - file_size, file_offset, time, date, crc); - if (t == NULL) - goto error; - err = PyDict_SetItemString(files, name, t); - Py_DECREF(t); - if (err != 0) - goto error; - count++; - } - fclose(fp); - if (Py_VerboseFlag) - PySys_WriteStderr("# zipimport: found %ld names in %s\n", - count, archive); - return files; -fseek_error: - fclose(fp); - Py_XDECREF(files); - PyErr_Format(ZipImportError, "can't read Zip file: %s", archive); - return NULL; -error: - fclose(fp); - Py_XDECREF(files); - return NULL; -} - -/* Return the zlib.decompress function object, or NULL if zlib couldn't - be imported. The function is cached when found, so subsequent calls - don't import zlib again. */ -static PyObject * -get_decompress_func(void) -{ - static int importing_zlib = 0; - PyObject *zlib; - PyObject *decompress; - - if (importing_zlib != 0) - /* Someone has a zlib.py[co] in their Zip file; - let's avoid a stack overflow. */ - return NULL; - importing_zlib = 1; - zlib = PyImport_ImportModuleNoBlock("zlib"); - importing_zlib = 0; - if (zlib != NULL) { - decompress = PyObject_GetAttrString(zlib, - "decompress"); - Py_DECREF(zlib); - } - else { - PyErr_Clear(); - decompress = NULL; - } - if (Py_VerboseFlag) - PySys_WriteStderr("# zipimport: zlib %s\n", - zlib != NULL ? "available": "UNAVAILABLE"); - return decompress; -} - -/* Given a path to a Zip file and a toc_entry, return the (uncompressed) - data as a new reference. */ -static PyObject * -get_data(char *archive, PyObject *toc_entry) -{ - PyObject *raw_data, *data = NULL, *decompress; - char *buf; - FILE *fp; - int err; - Py_ssize_t bytes_read = 0; - long l; - char *datapath; - long compress, data_size, file_size, file_offset; - long time, date, crc; - - if (!PyArg_ParseTuple(toc_entry, "slllllll", &datapath, &compress, - &data_size, &file_size, &file_offset, &time, - &date, &crc)) { - return NULL; - } - - fp = fopen(archive, "rb"); - if (!fp) { - PyErr_Format(PyExc_IOError, - "zipimport: can not open file %s", archive); - return NULL; - } - - /* Check to make sure the local file header is correct */ - if (fseek(fp, file_offset, 0) == -1) { - fclose(fp); - PyErr_Format(ZipImportError, "can't read Zip file: %s", archive); - return NULL; - } - - l = PyMarshal_ReadLongFromFile(fp); - if (l != 0x04034B50) { - /* Bad: Local File Header */ - PyErr_Format(ZipImportError, - "bad local file header in %s", - archive); - fclose(fp); - return NULL; - } - if (fseek(fp, file_offset + 26, 0) == -1) { - fclose(fp); - PyErr_Format(ZipImportError, "can't read Zip file: %s", archive); - return NULL; - } - - l = 30 + PyMarshal_ReadShortFromFile(fp) + - PyMarshal_ReadShortFromFile(fp); /* local header size */ - file_offset += l; /* Start of file data */ - - raw_data = PyString_FromStringAndSize((char *)NULL, compress == 0 ? - data_size : data_size + 1); - if (raw_data == NULL) { - fclose(fp); - return NULL; - } - buf = PyString_AsString(raw_data); - - err = fseek(fp, file_offset, 0); - if (err == 0) { - bytes_read = fread(buf, 1, data_size, fp); - } else { - fclose(fp); - PyErr_Format(ZipImportError, "can't read Zip file: %s", archive); - return NULL; - } - fclose(fp); - if (err || bytes_read != data_size) { - PyErr_SetString(PyExc_IOError, - "zipimport: can't read data"); - Py_DECREF(raw_data); - return NULL; - } - - if (compress != 0) { - buf[data_size] = 'Z'; /* saw this in zipfile.py */ - data_size++; - } - buf[data_size] = '\0'; - - if (compress == 0) /* data is not compressed */ - return raw_data; - - /* Decompress with zlib */ - decompress = get_decompress_func(); - if (decompress == NULL) { - PyErr_SetString(ZipImportError, - "can't decompress data; " - "zlib not available"); - goto error; - } - data = PyObject_CallFunction(decompress, "Oi", raw_data, -15); - Py_DECREF(decompress); -error: - Py_DECREF(raw_data); - return data; -} - -/* Lenient date/time comparison function. The precision of the mtime - in the archive is lower than the mtime stored in a .pyc: we - must allow a difference of at most one second. */ -static int -eq_mtime(time_t t1, time_t t2) -{ - time_t d = t1 - t2; - if (d < 0) - d = -d; - /* dostime only stores even seconds, so be lenient */ - return d <= 1; -} - -/* Given the contents of a .py[co] file in a buffer, unmarshal the data - and return the code object. Return None if it the magic word doesn't - match (we do this instead of raising an exception as we fall back - to .py if available and we don't want to mask other errors). - Returns a new reference. */ -static PyObject * -unmarshal_code(char *pathname, PyObject *data, time_t mtime) -{ - PyObject *code; - char *buf = PyString_AsString(data); - Py_ssize_t size = PyString_Size(data); - - if (size <= 9) { - PyErr_SetString(ZipImportError, - "bad pyc data"); - return NULL; - } - - if (get_long((unsigned char *)buf) != PyImport_GetMagicNumber()) { - if (Py_VerboseFlag) - PySys_WriteStderr("# %s has bad magic\n", - pathname); - Py_INCREF(Py_None); - return Py_None; /* signal caller to try alternative */ - } - - if (mtime != 0 && !eq_mtime(get_long((unsigned char *)buf + 4), - mtime)) { - if (Py_VerboseFlag) - PySys_WriteStderr("# %s has bad mtime\n", - pathname); - Py_INCREF(Py_None); - return Py_None; /* signal caller to try alternative */ - } - - code = PyMarshal_ReadObjectFromString(buf + 8, size - 8); - if (code == NULL) - return NULL; - if (!PyCode_Check(code)) { - Py_DECREF(code); - PyErr_Format(PyExc_TypeError, - "compiled module %.200s is not a code object", - pathname); - return NULL; - } - return code; -} - -/* Replace any occurances of "\r\n?" in the input string with "\n". - This converts DOS and Mac line endings to Unix line endings. - Also append a trailing "\n" to be compatible with - PyParser_SimpleParseFile(). Returns a new reference. */ -static PyObject * -normalize_line_endings(PyObject *source) -{ - char *buf, *q, *p = PyString_AsString(source); - PyObject *fixed_source; - - if (!p) - return NULL; - - /* one char extra for trailing \n and one for terminating \0 */ - buf = (char *)PyMem_Malloc(PyString_Size(source) + 2); - if (buf == NULL) { - PyErr_SetString(PyExc_MemoryError, - "zipimport: no memory to allocate " - "source buffer"); - return NULL; - } - /* replace "\r\n?" by "\n" */ - for (q = buf; *p != '\0'; p++) { - if (*p == '\r') { - *q++ = '\n'; - if (*(p + 1) == '\n') - p++; - } - else - *q++ = *p; - } - *q++ = '\n'; /* add trailing \n */ - *q = '\0'; - fixed_source = PyString_FromString(buf); - PyMem_Free(buf); - return fixed_source; -} - -/* Given a string buffer containing Python source code, compile it - return and return a code object as a new reference. */ -static PyObject * -compile_source(char *pathname, PyObject *source) -{ - PyObject *code, *fixed_source; - - fixed_source = normalize_line_endings(source); - if (fixed_source == NULL) - return NULL; - - code = Py_CompileString(PyString_AsString(fixed_source), pathname, - Py_file_input); - Py_DECREF(fixed_source); - return code; -} - -/* Convert the date/time values found in the Zip archive to a value - that's compatible with the time stamp stored in .pyc files. */ -static time_t -parse_dostime(int dostime, int dosdate) -{ - struct tm stm; - - memset((void *) &stm, '\0', sizeof(stm)); - - stm.tm_sec = (dostime & 0x1f) * 2; - stm.tm_min = (dostime >> 5) & 0x3f; - stm.tm_hour = (dostime >> 11) & 0x1f; - stm.tm_mday = dosdate & 0x1f; - stm.tm_mon = ((dosdate >> 5) & 0x0f) - 1; - stm.tm_year = ((dosdate >> 9) & 0x7f) + 80; - stm.tm_isdst = -1; /* wday/yday is ignored */ - - return mktime(&stm); -} - -/* Given a path to a .pyc or .pyo file in the archive, return the - modification time of the matching .py file, or 0 if no source - is available. */ -static time_t -get_mtime_of_source(ZipImporter *self, char *path) -{ - PyObject *toc_entry; - time_t mtime = 0; - Py_ssize_t lastchar = strlen(path) - 1; - char savechar = path[lastchar]; - path[lastchar] = '\0'; /* strip 'c' or 'o' from *.py[co] */ - toc_entry = PyDict_GetItemString(self->files, path); - if (toc_entry != NULL && PyTuple_Check(toc_entry) && - PyTuple_Size(toc_entry) == 8) { - /* fetch the time stamp of the .py file for comparison - with an embedded pyc time stamp */ - int time, date; - time = PyInt_AsLong(PyTuple_GetItem(toc_entry, 5)); - date = PyInt_AsLong(PyTuple_GetItem(toc_entry, 6)); - mtime = parse_dostime(time, date); - } - path[lastchar] = savechar; - return mtime; -} - -/* Return the code object for the module named by 'fullname' from the - Zip archive as a new reference. */ -static PyObject * -get_code_from_data(ZipImporter *self, int ispackage, int isbytecode, - time_t mtime, PyObject *toc_entry) -{ - PyObject *data, *code; - char *modpath; - char *archive = PyString_AsString(self->archive); - - if (archive == NULL) - return NULL; - - data = get_data(archive, toc_entry); - if (data == NULL) - return NULL; - - modpath = PyString_AsString(PyTuple_GetItem(toc_entry, 0)); - - if (isbytecode) { - code = unmarshal_code(modpath, data, mtime); - } - else { - code = compile_source(modpath, data); - } - Py_DECREF(data); - return code; -} - -/* Get the code object associated with the module specified by - 'fullname'. */ -static PyObject * -get_module_code(ZipImporter *self, char *fullname, - int *p_ispackage, char **p_modpath) -{ - PyObject *toc_entry; - char *subname, path[MAXPATHLEN + 1]; - int len; - struct st_zip_searchorder *zso; - - subname = get_subname(fullname); - - len = make_filename(PyString_AsString(self->prefix), subname, path); - if (len < 0) - return NULL; - - for (zso = zip_searchorder; *zso->suffix; zso++) { - PyObject *code = NULL; - - strcpy(path + len, zso->suffix); - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# trying %s%c%s\n", - PyString_AsString(self->archive), - SEP, path); - toc_entry = PyDict_GetItemString(self->files, path); - if (toc_entry != NULL) { - time_t mtime = 0; - int ispackage = zso->type & IS_PACKAGE; - int isbytecode = zso->type & IS_BYTECODE; - - if (isbytecode) - mtime = get_mtime_of_source(self, path); - if (p_ispackage != NULL) - *p_ispackage = ispackage; - code = get_code_from_data(self, ispackage, - isbytecode, mtime, - toc_entry); - if (code == Py_None) { - /* bad magic number or non-matching mtime - in byte code, try next */ - Py_DECREF(code); - continue; - } - if (code != NULL && p_modpath != NULL) - *p_modpath = PyString_AsString( - PyTuple_GetItem(toc_entry, 0)); - return code; - } - } - PyErr_Format(ZipImportError, "can't find module '%.200s'", fullname); - return NULL; -} - - -/* Module init */ - -PyDoc_STRVAR(zipimport_doc, -"zipimport provides support for importing Python modules from Zip archives.\n\ -\n\ -This module exports three objects:\n\ -- zipimporter: a class; its constructor takes a path to a Zip archive.\n\ -- ZipImportError: exception raised by zipimporter objects. It's a\n\ - subclass of ImportError, so it can be caught as ImportError, too.\n\ -- _zip_directory_cache: a dict, mapping archive paths to zip directory\n\ - info dicts, as used in zipimporter._files.\n\ -\n\ -It is usually not needed to use the zipimport module explicitly; it is\n\ -used by the builtin import mechanism for sys.path items that are paths\n\ -to Zip archives."); - -PyMODINIT_FUNC -initzipimport(void) -{ - PyObject *mod; - - if (PyType_Ready(&ZipImporter_Type) < 0) - return; - - /* Correct directory separator */ - zip_searchorder[0].suffix[0] = SEP; - zip_searchorder[1].suffix[0] = SEP; - zip_searchorder[2].suffix[0] = SEP; - if (Py_OptimizeFlag) { - /* Reverse *.pyc and *.pyo */ - struct st_zip_searchorder tmp; - tmp = zip_searchorder[0]; - zip_searchorder[0] = zip_searchorder[1]; - zip_searchorder[1] = tmp; - tmp = zip_searchorder[3]; - zip_searchorder[3] = zip_searchorder[4]; - zip_searchorder[4] = tmp; - } - - mod = Py_InitModule4("zipimport", NULL, zipimport_doc, - NULL, PYTHON_API_VERSION); - if (mod == NULL) - return; - - ZipImportError = PyErr_NewException("zipimport.ZipImportError", - PyExc_ImportError, NULL); - if (ZipImportError == NULL) - return; - - Py_INCREF(ZipImportError); - if (PyModule_AddObject(mod, "ZipImportError", - ZipImportError) < 0) - return; - - Py_INCREF(&ZipImporter_Type); - if (PyModule_AddObject(mod, "zipimporter", - (PyObject *)&ZipImporter_Type) < 0) - return; - - zip_directory_cache = PyDict_New(); - if (zip_directory_cache == NULL) - return; - Py_INCREF(zip_directory_cache); - if (PyModule_AddObject(mod, "_zip_directory_cache", - zip_directory_cache) < 0) - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/ChangeLog b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/ChangeLog deleted file mode 100644 index ec8ecc9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/ChangeLog +++ /dev/null @@ -1,1472 +0,0 @@ - - ChangeLog file for zlib - -Changes in 1.2.8 (28 Apr 2013) -- Update contrib/minizip/iowin32.c for Windows RT [Vollant] -- Do not force Z_CONST for C++ -- Clean up contrib/vstudio [Ro§] -- Correct spelling error in zlib.h -- Fix mixed line endings in contrib/vstudio - -Changes in 1.2.7.3 (13 Apr 2013) -- Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc - -Changes in 1.2.7.2 (13 Apr 2013) -- Change check for a four-byte type back to hexadecimal -- Fix typo in win32/Makefile.msc -- Add casts in gzwrite.c for pointer differences - -Changes in 1.2.7.1 (24 Mar 2013) -- Replace use of unsafe string functions with snprintf if available -- Avoid including stddef.h on Windows for Z_SOLO compile [Niessink] -- Fix gzgetc undefine when Z_PREFIX set [Turk] -- Eliminate use of mktemp in Makefile (not always available) -- Fix bug in 'F' mode for gzopen() -- Add inflateGetDictionary() function -- Correct comment in deflate.h -- Use _snprintf for snprintf in Microsoft C -- On Darwin, only use /usr/bin/libtool if libtool is not Apple -- Delete "--version" file if created by "ar --version" [Richard G.] -- Fix configure check for veracity of compiler error return codes -- Fix CMake compilation of static lib for MSVC2010 x64 -- Remove unused variable in infback9.c -- Fix argument checks in gzlog_compress() and gzlog_write() -- Clean up the usage of z_const and respect const usage within zlib -- Clean up examples/gzlog.[ch] comparisons of different types -- Avoid shift equal to bits in type (caused endless loop) -- Fix unintialized value bug in gzputc() introduced by const patches -- Fix memory allocation error in examples/zran.c [Nor] -- Fix bug where gzopen(), gzclose() would write an empty file -- Fix bug in gzclose() when gzwrite() runs out of memory -- Check for input buffer malloc failure in examples/gzappend.c -- Add note to contrib/blast to use binary mode in stdio -- Fix comparisons of differently signed integers in contrib/blast -- Check for invalid code length codes in contrib/puff -- Fix serious but very rare decompression bug in inftrees.c -- Update inflateBack() comments, since inflate() can be faster -- Use underscored I/O function names for WINAPI_FAMILY -- Add _tr_flush_bits to the external symbols prefixed by --zprefix -- Add contrib/vstudio/vc10 pre-build step for static only -- Quote --version-script argument in CMakeLists.txt -- Don't specify --version-script on Apple platforms in CMakeLists.txt -- Fix casting error in contrib/testzlib/testzlib.c -- Fix types in contrib/minizip to match result of get_crc_table() -- Simplify contrib/vstudio/vc10 with 'd' suffix -- Add TOP support to win32/Makefile.msc -- Suport i686 and amd64 assembler builds in CMakeLists.txt -- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h -- Add vc11 and vc12 build files to contrib/vstudio -- Add gzvprintf() as an undocumented function in zlib -- Fix configure for Sun shell -- Remove runtime check in configure for four-byte integer type -- Add casts and consts to ease user conversion to C++ -- Add man pages for minizip and miniunzip -- In Makefile uninstall, don't rm if preceding cd fails -- Do not return Z_BUF_ERROR if deflateParam() has nothing to write - -Changes in 1.2.7 (2 May 2012) -- Replace use of memmove() with a simple copy for portability -- Test for existence of strerror -- Restore gzgetc_ for backward compatibility with 1.2.6 -- Fix build with non-GNU make on Solaris -- Require gcc 4.0 or later on Mac OS X to use the hidden attribute -- Include unistd.h for Watcom C -- Use __WATCOMC__ instead of __WATCOM__ -- Do not use the visibility attribute if NO_VIZ defined -- Improve the detection of no hidden visibility attribute -- Avoid using __int64 for gcc or solo compilation -- Cast to char * in gzprintf to avoid warnings [Zinser] -- Fix make_vms.com for VAX [Zinser] -- Don't use library or built-in byte swaps -- Simplify test and use of gcc hidden attribute -- Fix bug in gzclose_w() when gzwrite() fails to allocate memory -- Add "x" (O_EXCL) and "e" (O_CLOEXEC) modes support to gzopen() -- Fix bug in test/minigzip.c for configure --solo -- Fix contrib/vstudio project link errors [Mohanathas] -- Add ability to choose the builder in make_vms.com [Schweda] -- Add DESTDIR support to mingw32 win32/Makefile.gcc -- Fix comments in win32/Makefile.gcc for proper usage -- Allow overriding the default install locations for cmake -- Generate and install the pkg-config file with cmake -- Build both a static and a shared version of zlib with cmake -- Include version symbols for cmake builds -- If using cmake with MSVC, add the source directory to the includes -- Remove unneeded EXTRA_CFLAGS from win32/Makefile.gcc [Truta] -- Move obsolete emx makefile to old [Truta] -- Allow the use of -Wundef when compiling or using zlib -- Avoid the use of the -u option with mktemp -- Improve inflate() documentation on the use of Z_FINISH -- Recognize clang as gcc -- Add gzopen_w() in Windows for wide character path names -- Rename zconf.h in CMakeLists.txt to move it out of the way -- Add source directory in CMakeLists.txt for building examples -- Look in build directory for zlib.pc in CMakeLists.txt -- Remove gzflags from zlibvc.def in vc9 and vc10 -- Fix contrib/minizip compilation in the MinGW environment -- Update ./configure for Solaris, support --64 [Mooney] -- Remove -R. from Solaris shared build (possible security issue) -- Avoid race condition for parallel make (-j) running example -- Fix type mismatch between get_crc_table() and crc_table -- Fix parsing of version with "-" in CMakeLists.txt [Snider, Ziegler] -- Fix the path to zlib.map in CMakeLists.txt -- Force the native libtool in Mac OS X to avoid GNU libtool [Beebe] -- Add instructions to win32/Makefile.gcc for shared install [Torri] - -Changes in 1.2.6.1 (12 Feb 2012) -- Avoid the use of the Objective-C reserved name "id" -- Include io.h in gzguts.h for Microsoft compilers -- Fix problem with ./configure --prefix and gzgetc macro -- Include gz_header definition when compiling zlib solo -- Put gzflags() functionality back in zutil.c -- Avoid library header include in crc32.c for Z_SOLO -- Use name in GCC_CLASSIC as C compiler for coverage testing, if set -- Minor cleanup in contrib/minizip/zip.c [Vollant] -- Update make_vms.com [Zinser] -- Remove unnecessary gzgetc_ function -- Use optimized byte swap operations for Microsoft and GNU [Snyder] -- Fix minor typo in zlib.h comments [Rzesniowiecki] - -Changes in 1.2.6 (29 Jan 2012) -- Update the Pascal interface in contrib/pascal -- Fix function numbers for gzgetc_ in zlibvc.def files -- Fix configure.ac for contrib/minizip [Schiffer] -- Fix large-entry detection in minizip on 64-bit systems [Schiffer] -- Have ./configure use the compiler return code for error indication -- Fix CMakeLists.txt for cross compilation [McClure] -- Fix contrib/minizip/zip.c for 64-bit architectures [Dalsnes] -- Fix compilation of contrib/minizip on FreeBSD [Marquez] -- Correct suggested usages in win32/Makefile.msc [Shachar, Horvath] -- Include io.h for Turbo C / Borland C on all platforms [Truta] -- Make version explicit in contrib/minizip/configure.ac [Bosmans] -- Avoid warning for no encryption in contrib/minizip/zip.c [Vollant] -- Minor cleanup up contrib/minizip/unzip.c [Vollant] -- Fix bug when compiling minizip with C++ [Vollant] -- Protect for long name and extra fields in contrib/minizip [Vollant] -- Avoid some warnings in contrib/minizip [Vollant] -- Add -I../.. -L../.. to CFLAGS for minizip and miniunzip -- Add missing libs to minizip linker command -- Add support for VPATH builds in contrib/minizip -- Add an --enable-demos option to contrib/minizip/configure -- Add the generation of configure.log by ./configure -- Exit when required parameters not provided to win32/Makefile.gcc -- Have gzputc return the character written instead of the argument -- Use the -m option on ldconfig for BSD systems [Tobias] -- Correct in zlib.map when deflateResetKeep was added - -Changes in 1.2.5.3 (15 Jan 2012) -- Restore gzgetc function for binary compatibility -- Do not use _lseeki64 under Borland C++ [Truta] -- Update win32/Makefile.msc to build test/*.c [Truta] -- Remove old/visualc6 given CMakefile and other alternatives -- Update AS400 build files and documentation [Monnerat] -- Update win32/Makefile.gcc to build test/*.c [Truta] -- Permit stronger flushes after Z_BLOCK flushes -- Avoid extraneous empty blocks when doing empty flushes -- Permit Z_NULL arguments to deflatePending -- Allow deflatePrime() to insert bits in the middle of a stream -- Remove second empty static block for Z_PARTIAL_FLUSH -- Write out all of the available bits when using Z_BLOCK -- Insert the first two strings in the hash table after a flush - -Changes in 1.2.5.2 (17 Dec 2011) -- fix ld error: unable to find version dependency 'ZLIB_1.2.5' -- use relative symlinks for shared libs -- Avoid searching past window for Z_RLE strategy -- Assure that high-water mark initialization is always applied in deflate -- Add assertions to fill_window() in deflate.c to match comments -- Update python link in README -- Correct spelling error in gzread.c -- Fix bug in gzgets() for a concatenated empty gzip stream -- Correct error in comment for gz_make() -- Change gzread() and related to ignore junk after gzip streams -- Allow gzread() and related to continue after gzclearerr() -- Allow gzrewind() and gzseek() after a premature end-of-file -- Simplify gzseek() now that raw after gzip is ignored -- Change gzgetc() to a macro for speed (~40% speedup in testing) -- Fix gzclose() to return the actual error last encountered -- Always add large file support for windows -- Include zconf.h for windows large file support -- Include zconf.h.cmakein for windows large file support -- Update zconf.h.cmakein on make distclean -- Merge vestigial vsnprintf determination from zutil.h to gzguts.h -- Clarify how gzopen() appends in zlib.h comments -- Correct documentation of gzdirect() since junk at end now ignored -- Add a transparent write mode to gzopen() when 'T' is in the mode -- Update python link in zlib man page -- Get inffixed.h and MAKEFIXED result to match -- Add a ./config --solo option to make zlib subset with no libary use -- Add undocumented inflateResetKeep() function for CAB file decoding -- Add --cover option to ./configure for gcc coverage testing -- Add #define ZLIB_CONST option to use const in the z_stream interface -- Add comment to gzdopen() in zlib.h to use dup() when using fileno() -- Note behavior of uncompress() to provide as much data as it can -- Add files in contrib/minizip to aid in building libminizip -- Split off AR options in Makefile.in and configure -- Change ON macro to Z_ARG to avoid application conflicts -- Facilitate compilation with Borland C++ for pragmas and vsnprintf -- Include io.h for Turbo C / Borland C++ -- Move example.c and minigzip.c to test/ -- Simplify incomplete code table filling in inflate_table() -- Remove code from inflate.c and infback.c that is impossible to execute -- Test the inflate code with full coverage -- Allow deflateSetDictionary, inflateSetDictionary at any time (in raw) -- Add deflateResetKeep and fix inflateResetKeep to retain dictionary -- Fix gzwrite.c to accommodate reduced memory zlib compilation -- Have inflate() with Z_FINISH avoid the allocation of a window -- Do not set strm->adler when doing raw inflate -- Fix gzeof() to behave just like feof() when read is not past end of file -- Fix bug in gzread.c when end-of-file is reached -- Avoid use of Z_BUF_ERROR in gz* functions except for premature EOF -- Document gzread() capability to read concurrently written files -- Remove hard-coding of resource compiler in CMakeLists.txt [Blammo] - -Changes in 1.2.5.1 (10 Sep 2011) -- Update FAQ entry on shared builds (#13) -- Avoid symbolic argument to chmod in Makefile.in -- Fix bug and add consts in contrib/puff [Oberhumer] -- Update contrib/puff/zeros.raw test file to have all block types -- Add full coverage test for puff in contrib/puff/Makefile -- Fix static-only-build install in Makefile.in -- Fix bug in unzGetCurrentFileInfo() in contrib/minizip [Kuno] -- Add libz.a dependency to shared in Makefile.in for parallel builds -- Spell out "number" (instead of "nb") in zlib.h for total_in, total_out -- Replace $(...) with `...` in configure for non-bash sh [Bowler] -- Add darwin* to Darwin* and solaris* to SunOS\ 5* in configure [Groffen] -- Add solaris* to Linux* in configure to allow gcc use [Groffen] -- Add *bsd* to Linux* case in configure [Bar-Lev] -- Add inffast.obj to dependencies in win32/Makefile.msc -- Correct spelling error in deflate.h [Kohler] -- Change libzdll.a again to libz.dll.a (!) in win32/Makefile.gcc -- Add test to configure for GNU C looking for gcc in output of $cc -v -- Add zlib.pc generation to win32/Makefile.gcc [Weigelt] -- Fix bug in zlib.h for _FILE_OFFSET_BITS set and _LARGEFILE64_SOURCE not -- Add comment in zlib.h that adler32_combine with len2 < 0 makes no sense -- Make NO_DIVIDE option in adler32.c much faster (thanks to John Reiser) -- Make stronger test in zconf.h to include unistd.h for LFS -- Apply Darwin patches for 64-bit file offsets to contrib/minizip [Slack] -- Fix zlib.h LFS support when Z_PREFIX used -- Add updated as400 support (removed from old) [Monnerat] -- Avoid deflate sensitivity to volatile input data -- Avoid division in adler32_combine for NO_DIVIDE -- Clarify the use of Z_FINISH with deflateBound() amount of space -- Set binary for output file in puff.c -- Use u4 type for crc_table to avoid conversion warnings -- Apply casts in zlib.h to avoid conversion warnings -- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller] -- Improve inflateSync() documentation to note indeterminancy -- Add deflatePending() function to return the amount of pending output -- Correct the spelling of "specification" in FAQ [Randers-Pehrson] -- Add a check in configure for stdarg.h, use for gzprintf() -- Check that pointers fit in ints when gzprint() compiled old style -- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler] -- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt] -- Add debug records in assmebler code [Londer] -- Update RFC references to use http://tools.ietf.org/html/... [Li] -- Add --archs option, use of libtool to configure for Mac OS X [Borstel] - -Changes in 1.2.5 (19 Apr 2010) -- Disable visibility attribute in win32/Makefile.gcc [Bar-Lev] -- Default to libdir as sharedlibdir in configure [Nieder] -- Update copyright dates on modified source files -- Update trees.c to be able to generate modified trees.h -- Exit configure for MinGW, suggesting win32/Makefile.gcc -- Check for NULL path in gz_open [Homurlu] - -Changes in 1.2.4.5 (18 Apr 2010) -- Set sharedlibdir in configure [Torok] -- Set LDFLAGS in Makefile.in [Bar-Lev] -- Avoid mkdir objs race condition in Makefile.in [Bowler] -- Add ZLIB_INTERNAL in front of internal inter-module functions and arrays -- Define ZLIB_INTERNAL to hide internal functions and arrays for GNU C -- Don't use hidden attribute when it is a warning generator (e.g. Solaris) - -Changes in 1.2.4.4 (18 Apr 2010) -- Fix CROSS_PREFIX executable testing, CHOST extract, mingw* [Torok] -- Undefine _LARGEFILE64_SOURCE in zconf.h if it is zero, but not if empty -- Try to use bash or ksh regardless of functionality of /bin/sh -- Fix configure incompatibility with NetBSD sh -- Remove attempt to run under bash or ksh since have better NetBSD fix -- Fix win32/Makefile.gcc for MinGW [Bar-Lev] -- Add diagnostic messages when using CROSS_PREFIX in configure -- Added --sharedlibdir option to configure [Weigelt] -- Use hidden visibility attribute when available [Frysinger] - -Changes in 1.2.4.3 (10 Apr 2010) -- Only use CROSS_PREFIX in configure for ar and ranlib if they exist -- Use CROSS_PREFIX for nm [Bar-Lev] -- Assume _LARGEFILE64_SOURCE defined is equivalent to true -- Avoid use of undefined symbols in #if with && and || -- Make *64 prototypes in gzguts.h consistent with functions -- Add -shared load option for MinGW in configure [Bowler] -- Move z_off64_t to public interface, use instead of off64_t -- Remove ! from shell test in configure (not portable to Solaris) -- Change +0 macro tests to -0 for possibly increased portability - -Changes in 1.2.4.2 (9 Apr 2010) -- Add consistent carriage returns to readme.txt's in masmx86 and masmx64 -- Really provide prototypes for *64 functions when building without LFS -- Only define unlink() in minigzip.c if unistd.h not included -- Update README to point to contrib/vstudio project files -- Move projects/vc6 to old/ and remove projects/ -- Include stdlib.h in minigzip.c for setmode() definition under WinCE -- Clean up assembler builds in win32/Makefile.msc [Rowe] -- Include sys/types.h for Microsoft for off_t definition -- Fix memory leak on error in gz_open() -- Symbolize nm as $NM in configure [Weigelt] -- Use TEST_LDSHARED instead of LDSHARED to link test programs [Weigelt] -- Add +0 to _FILE_OFFSET_BITS and _LFS64_LARGEFILE in case not defined -- Fix bug in gzeof() to take into account unused input data -- Avoid initialization of structures with variables in puff.c -- Updated win32/README-WIN32.txt [Rowe] - -Changes in 1.2.4.1 (28 Mar 2010) -- Remove the use of [a-z] constructs for sed in configure [gentoo 310225] -- Remove $(SHAREDLIB) from LIBS in Makefile.in [Creech] -- Restore "for debugging" comment on sprintf() in gzlib.c -- Remove fdopen for MVS from gzguts.h -- Put new README-WIN32.txt in win32 [Rowe] -- Add check for shell to configure and invoke another shell if needed -- Fix big fat stinking bug in gzseek() on uncompressed files -- Remove vestigial F_OPEN64 define in zutil.h -- Set and check the value of _LARGEFILE_SOURCE and _LARGEFILE64_SOURCE -- Avoid errors on non-LFS systems when applications define LFS macros -- Set EXE to ".exe" in configure for MINGW [Kahle] -- Match crc32() in crc32.c exactly to the prototype in zlib.h [Sherrill] -- Add prefix for cross-compilation in win32/makefile.gcc [Bar-Lev] -- Add DLL install in win32/makefile.gcc [Bar-Lev] -- Allow Linux* or linux* from uname in configure [Bar-Lev] -- Allow ldconfig to be redefined in configure and Makefile.in [Bar-Lev] -- Add cross-compilation prefixes to configure [Bar-Lev] -- Match type exactly in gz_load() invocation in gzread.c -- Match type exactly of zcalloc() in zutil.c to zlib.h alloc_func -- Provide prototypes for *64 functions when building zlib without LFS -- Don't use -lc when linking shared library on MinGW -- Remove errno.h check in configure and vestigial errno code in zutil.h - -Changes in 1.2.4 (14 Mar 2010) -- Fix VER3 extraction in configure for no fourth subversion -- Update zlib.3, add docs to Makefile.in to make .pdf out of it -- Add zlib.3.pdf to distribution -- Don't set error code in gzerror() if passed pointer is NULL -- Apply destination directory fixes to CMakeLists.txt [Lowman] -- Move #cmakedefine's to a new zconf.in.cmakein -- Restore zconf.h for builds that don't use configure or cmake -- Add distclean to dummy Makefile for convenience -- Update and improve INDEX, README, and FAQ -- Update CMakeLists.txt for the return of zconf.h [Lowman] -- Update contrib/vstudio/vc9 and vc10 [Vollant] -- Change libz.dll.a back to libzdll.a in win32/Makefile.gcc -- Apply license and readme changes to contrib/asm686 [Raiter] -- Check file name lengths and add -c option in minigzip.c [Li] -- Update contrib/amd64 and contrib/masmx86/ [Vollant] -- Avoid use of "eof" parameter in trees.c to not shadow library variable -- Update make_vms.com for removal of zlibdefs.h [Zinser] -- Update assembler code and vstudio projects in contrib [Vollant] -- Remove outdated assembler code contrib/masm686 and contrib/asm586 -- Remove old vc7 and vc8 from contrib/vstudio -- Update win32/Makefile.msc, add ZLIB_VER_SUBREVISION [Rowe] -- Fix memory leaks in gzclose_r() and gzclose_w(), file leak in gz_open() -- Add contrib/gcc_gvmat64 for longest_match and inflate_fast [Vollant] -- Remove *64 functions from win32/zlib.def (they're not 64-bit yet) -- Fix bug in void-returning vsprintf() case in gzwrite.c -- Fix name change from inflate.h in contrib/inflate86/inffas86.c -- Check if temporary file exists before removing in make_vms.com [Zinser] -- Fix make install and uninstall for --static option -- Fix usage of _MSC_VER in gzguts.h and zutil.h [Truta] -- Update readme.txt in contrib/masmx64 and masmx86 to assemble - -Changes in 1.2.3.9 (21 Feb 2010) -- Expunge gzio.c -- Move as400 build information to old -- Fix updates in contrib/minizip and contrib/vstudio -- Add const to vsnprintf test in configure to avoid warnings [Weigelt] -- Delete zconf.h (made by configure) [Weigelt] -- Change zconf.in.h to zconf.h.in per convention [Weigelt] -- Check for NULL buf in gzgets() -- Return empty string for gzgets() with len == 1 (like fgets()) -- Fix description of gzgets() in zlib.h for end-of-file, NULL return -- Update minizip to 1.1 [Vollant] -- Avoid MSVC loss of data warnings in gzread.c, gzwrite.c -- Note in zlib.h that gzerror() should be used to distinguish from EOF -- Remove use of snprintf() from gzlib.c -- Fix bug in gzseek() -- Update contrib/vstudio, adding vc9 and vc10 [Kuno, Vollant] -- Fix zconf.h generation in CMakeLists.txt [Lowman] -- Improve comments in zconf.h where modified by configure - -Changes in 1.2.3.8 (13 Feb 2010) -- Clean up text files (tabs, trailing whitespace, etc.) [Oberhumer] -- Use z_off64_t in gz_zero() and gz_skip() to match state->skip -- Avoid comparison problem when sizeof(int) == sizeof(z_off64_t) -- Revert to Makefile.in from 1.2.3.6 (live with the clutter) -- Fix missing error return in gzflush(), add zlib.h note -- Add *64 functions to zlib.map [Levin] -- Fix signed/unsigned comparison in gz_comp() -- Use SFLAGS when testing shared linking in configure -- Add --64 option to ./configure to use -m64 with gcc -- Fix ./configure --help to correctly name options -- Have make fail if a test fails [Levin] -- Avoid buffer overrun in contrib/masmx64/gvmat64.asm [Simpson] -- Remove assembler object files from contrib - -Changes in 1.2.3.7 (24 Jan 2010) -- Always gzopen() with O_LARGEFILE if available -- Fix gzdirect() to work immediately after gzopen() or gzdopen() -- Make gzdirect() more precise when the state changes while reading -- Improve zlib.h documentation in many places -- Catch memory allocation failure in gz_open() -- Complete close operation if seek forward in gzclose_w() fails -- Return Z_ERRNO from gzclose_r() if close() fails -- Return Z_STREAM_ERROR instead of EOF for gzclose() being passed NULL -- Return zero for gzwrite() errors to match zlib.h description -- Return -1 on gzputs() error to match zlib.h description -- Add zconf.in.h to allow recovery from configure modification [Weigelt] -- Fix static library permissions in Makefile.in [Weigelt] -- Avoid warnings in configure tests that hide functionality [Weigelt] -- Add *BSD and DragonFly to Linux case in configure [gentoo 123571] -- Change libzdll.a to libz.dll.a in win32/Makefile.gcc [gentoo 288212] -- Avoid access of uninitialized data for first inflateReset2 call [Gomes] -- Keep object files in subdirectories to reduce the clutter somewhat -- Remove default Makefile and zlibdefs.h, add dummy Makefile -- Add new external functions to Z_PREFIX, remove duplicates, z_z_ -> z_ -- Remove zlibdefs.h completely -- modify zconf.h instead - -Changes in 1.2.3.6 (17 Jan 2010) -- Avoid void * arithmetic in gzread.c and gzwrite.c -- Make compilers happier with const char * for gz_error message -- Avoid unused parameter warning in inflate.c -- Avoid signed-unsigned comparison warning in inflate.c -- Indent #pragma's for traditional C -- Fix usage of strwinerror() in glib.c, change to gz_strwinerror() -- Correct email address in configure for system options -- Update make_vms.com and add make_vms.com to contrib/minizip [Zinser] -- Update zlib.map [Brown] -- Fix Makefile.in for Solaris 10 make of example64 and minizip64 [Torok] -- Apply various fixes to CMakeLists.txt [Lowman] -- Add checks on len in gzread() and gzwrite() -- Add error message for no more room for gzungetc() -- Remove zlib version check in gzwrite() -- Defer compression of gzprintf() result until need to -- Use snprintf() in gzdopen() if available -- Remove USE_MMAP configuration determination (only used by minigzip) -- Remove examples/pigz.c (available separately) -- Update examples/gun.c to 1.6 - -Changes in 1.2.3.5 (8 Jan 2010) -- Add space after #if in zutil.h for some compilers -- Fix relatively harmless bug in deflate_fast() [Exarevsky] -- Fix same problem in deflate_slow() -- Add $(SHAREDLIBV) to LIBS in Makefile.in [Brown] -- Add deflate_rle() for faster Z_RLE strategy run-length encoding -- Add deflate_huff() for faster Z_HUFFMAN_ONLY encoding -- Change name of "write" variable in inffast.c to avoid library collisions -- Fix premature EOF from gzread() in gzio.c [Brown] -- Use zlib header window size if windowBits is 0 in inflateInit2() -- Remove compressBound() call in deflate.c to avoid linking compress.o -- Replace use of errno in gz* with functions, support WinCE [Alves] -- Provide alternative to perror() in minigzip.c for WinCE [Alves] -- Don't use _vsnprintf on later versions of MSVC [Lowman] -- Add CMake build script and input file [Lowman] -- Update contrib/minizip to 1.1 [Svensson, Vollant] -- Moved nintendods directory from contrib to . -- Replace gzio.c with a new set of routines with the same functionality -- Add gzbuffer(), gzoffset(), gzclose_r(), gzclose_w() as part of above -- Update contrib/minizip to 1.1b -- Change gzeof() to return 0 on error instead of -1 to agree with zlib.h - -Changes in 1.2.3.4 (21 Dec 2009) -- Use old school .SUFFIXES in Makefile.in for FreeBSD compatibility -- Update comments in configure and Makefile.in for default --shared -- Fix test -z's in configure [Marquess] -- Build examplesh and minigzipsh when not testing -- Change NULL's to Z_NULL's in deflate.c and in comments in zlib.h -- Import LDFLAGS from the environment in configure -- Fix configure to populate SFLAGS with discovered CFLAGS options -- Adapt make_vms.com to the new Makefile.in [Zinser] -- Add zlib2ansi script for C++ compilation [Marquess] -- Add _FILE_OFFSET_BITS=64 test to make test (when applicable) -- Add AMD64 assembler code for longest match to contrib [Teterin] -- Include options from $SFLAGS when doing $LDSHARED -- Simplify 64-bit file support by introducing z_off64_t type -- Make shared object files in objs directory to work around old Sun cc -- Use only three-part version number for Darwin shared compiles -- Add rc option to ar in Makefile.in for when ./configure not run -- Add -WI,-rpath,. to LDFLAGS for OSF 1 V4* -- Set LD_LIBRARYN32_PATH for SGI IRIX shared compile -- Protect against _FILE_OFFSET_BITS being defined when compiling zlib -- Rename Makefile.in targets allstatic to static and allshared to shared -- Fix static and shared Makefile.in targets to be independent -- Correct error return bug in gz_open() by setting state [Brown] -- Put spaces before ;;'s in configure for better sh compatibility -- Add pigz.c (parallel implementation of gzip) to examples/ -- Correct constant in crc32.c to UL [Leventhal] -- Reject negative lengths in crc32_combine() -- Add inflateReset2() function to work like inflateEnd()/inflateInit2() -- Include sys/types.h for _LARGEFILE64_SOURCE [Brown] -- Correct typo in doc/algorithm.txt [Janik] -- Fix bug in adler32_combine() [Zhu] -- Catch missing-end-of-block-code error in all inflates and in puff - Assures that random input to inflate eventually results in an error -- Added enough.c (calculation of ENOUGH for inftrees.h) to examples/ -- Update ENOUGH and its usage to reflect discovered bounds -- Fix gzerror() error report on empty input file [Brown] -- Add ush casts in trees.c to avoid pedantic runtime errors -- Fix typo in zlib.h uncompress() description [Reiss] -- Correct inflate() comments with regard to automatic header detection -- Remove deprecation comment on Z_PARTIAL_FLUSH (it stays) -- Put new version of gzlog (2.0) in examples with interruption recovery -- Add puff compile option to permit invalid distance-too-far streams -- Add puff TEST command options, ability to read piped input -- Prototype the *64 functions in zlib.h when _FILE_OFFSET_BITS == 64, but - _LARGEFILE64_SOURCE not defined -- Fix Z_FULL_FLUSH to truly erase the past by resetting s->strstart -- Fix deflateSetDictionary() to use all 32K for output consistency -- Remove extraneous #define MIN_LOOKAHEAD in deflate.c (in deflate.h) -- Clear bytes after deflate lookahead to avoid use of uninitialized data -- Change a limit in inftrees.c to be more transparent to Coverity Prevent -- Update win32/zlib.def with exported symbols from zlib.h -- Correct spelling errors in zlib.h [Willem, Sobrado] -- Allow Z_BLOCK for deflate() to force a new block -- Allow negative bits in inflatePrime() to delete existing bit buffer -- Add Z_TREES flush option to inflate() to return at end of trees -- Add inflateMark() to return current state information for random access -- Add Makefile for NintendoDS to contrib [Costa] -- Add -w in configure compile tests to avoid spurious warnings [Beucler] -- Fix typos in zlib.h comments for deflateSetDictionary() -- Fix EOF detection in transparent gzread() [Maier] - -Changes in 1.2.3.3 (2 October 2006) -- Make --shared the default for configure, add a --static option -- Add compile option to permit invalid distance-too-far streams -- Add inflateUndermine() function which is required to enable above -- Remove use of "this" variable name for C++ compatibility [Marquess] -- Add testing of shared library in make test, if shared library built -- Use ftello() and fseeko() if available instead of ftell() and fseek() -- Provide two versions of all functions that use the z_off_t type for - binary compatibility -- a normal version and a 64-bit offset version, - per the Large File Support Extension when _LARGEFILE64_SOURCE is - defined; use the 64-bit versions by default when _FILE_OFFSET_BITS - is defined to be 64 -- Add a --uname= option to configure to perhaps help with cross-compiling - -Changes in 1.2.3.2 (3 September 2006) -- Turn off silly Borland warnings [Hay] -- Use off64_t and define _LARGEFILE64_SOURCE when present -- Fix missing dependency on inffixed.h in Makefile.in -- Rig configure --shared to build both shared and static [Teredesai, Truta] -- Remove zconf.in.h and instead create a new zlibdefs.h file -- Fix contrib/minizip/unzip.c non-encrypted after encrypted [Vollant] -- Add treebuild.xml (see http://treebuild.metux.de/) [Weigelt] - -Changes in 1.2.3.1 (16 August 2006) -- Add watcom directory with OpenWatcom make files [Daniel] -- Remove #undef of FAR in zconf.in.h for MVS [Fedtke] -- Update make_vms.com [Zinser] -- Use -fPIC for shared build in configure [Teredesai, Nicholson] -- Use only major version number for libz.so on IRIX and OSF1 [Reinholdtsen] -- Use fdopen() (not _fdopen()) for Interix in zutil.h [BŠck] -- Add some FAQ entries about the contrib directory -- Update the MVS question in the FAQ -- Avoid extraneous reads after EOF in gzio.c [Brown] -- Correct spelling of "successfully" in gzio.c [Randers-Pehrson] -- Add comments to zlib.h about gzerror() usage [Brown] -- Set extra flags in gzip header in gzopen() like deflate() does -- Make configure options more compatible with double-dash conventions - [Weigelt] -- Clean up compilation under Solaris SunStudio cc [Rowe, Reinholdtsen] -- Fix uninstall target in Makefile.in [Truta] -- Add pkgconfig support [Weigelt] -- Use $(DESTDIR) macro in Makefile.in [Reinholdtsen, Weigelt] -- Replace set_data_type() with a more accurate detect_data_type() in - trees.c, according to the txtvsbin.txt document [Truta] -- Swap the order of #include and #include "zlib.h" in - gzio.c, example.c and minigzip.c [Truta] -- Shut up annoying VS2005 warnings about standard C deprecation [Rowe, - Truta] (where?) -- Fix target "clean" from win32/Makefile.bor [Truta] -- Create .pdb and .manifest files in win32/makefile.msc [Ziegler, Rowe] -- Update zlib www home address in win32/DLL_FAQ.txt [Truta] -- Update contrib/masmx86/inffas32.asm for VS2005 [Vollant, Van Wassenhove] -- Enable browse info in the "Debug" and "ASM Debug" configurations in - the Visual C++ 6 project, and set (non-ASM) "Debug" as default [Truta] -- Add pkgconfig support [Weigelt] -- Add ZLIB_VER_MAJOR, ZLIB_VER_MINOR and ZLIB_VER_REVISION in zlib.h, - for use in win32/zlib1.rc [Polushin, Rowe, Truta] -- Add a document that explains the new text detection scheme to - doc/txtvsbin.txt [Truta] -- Add rfc1950.txt, rfc1951.txt and rfc1952.txt to doc/ [Truta] -- Move algorithm.txt into doc/ [Truta] -- Synchronize FAQ with website -- Fix compressBound(), was low for some pathological cases [Fearnley] -- Take into account wrapper variations in deflateBound() -- Set examples/zpipe.c input and output to binary mode for Windows -- Update examples/zlib_how.html with new zpipe.c (also web site) -- Fix some warnings in examples/gzlog.c and examples/zran.c (it seems - that gcc became pickier in 4.0) -- Add zlib.map for Linux: "All symbols from zlib-1.1.4 remain - un-versioned, the patch adds versioning only for symbols introduced in - zlib-1.2.0 or later. It also declares as local those symbols which are - not designed to be exported." [Levin] -- Update Z_PREFIX list in zconf.in.h, add --zprefix option to configure -- Do not initialize global static by default in trees.c, add a response - NO_INIT_GLOBAL_POINTERS to initialize them if needed [Marquess] -- Don't use strerror() in gzio.c under WinCE [Yakimov] -- Don't use errno.h in zutil.h under WinCE [Yakimov] -- Move arguments for AR to its usage to allow replacing ar [Marot] -- Add HAVE_VISIBILITY_PRAGMA in zconf.in.h for Mozilla [Randers-Pehrson] -- Improve inflateInit() and inflateInit2() documentation -- Fix structure size comment in inflate.h -- Change configure help option from --h* to --help [Santos] - -Changes in 1.2.3 (18 July 2005) -- Apply security vulnerability fixes to contrib/infback9 as well -- Clean up some text files (carriage returns, trailing space) -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] - -Changes in 1.2.2.4 (11 July 2005) -- Add inflatePrime() function for starting inflation at bit boundary -- Avoid some Visual C warnings in deflate.c -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit - compile -- Fix some spelling errors in comments [Betts] -- Correct inflateInit2() error return documentation in zlib.h -- Add zran.c example of compressed data random access to examples - directory, shows use of inflatePrime() -- Fix cast for assignments to strm->state in inflate.c and infback.c -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] -- Add cast in trees.c t avoid a warning [Oberhumer] -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] -- Update make_vms.com [Zinser] -- Initialize state->write in inflateReset() since copied in inflate_fast() -- Be more strict on incomplete code sets in inflate_table() and increase - ENOUGH and MAXD -- this repairs a possible security vulnerability for - invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. -- Add ia64 support to configure for HP-UX [Smith] -- Add error return to gzread() for format or i/o error [Levin] -- Use malloc.h for OS/2 [Necasek] - -Changes in 1.2.2.3 (27 May 2005) -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile -- Typecast fread() return values in gzio.c [Vollant] -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) -- Fix crc check bug in gzread() after gzungetc() [Heiner] -- Add the deflateTune() function to adjust internal compression parameters -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) -- Remove an incorrect assertion in examples/zpipe.c -- Add C++ wrapper in infback9.h [Donais] -- Fix bug in inflateCopy() when decoding fixed codes -- Note in zlib.h how much deflateSetDictionary() actually uses -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] -- Add gzdirect() function to indicate transparent reads -- Update contrib/minizip [Vollant] -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] -- Add casts in crc32.c to avoid warnings [Oberhumer] -- Add contrib/masmx64 [Vollant] -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] - -Changes in 1.2.2.2 (30 December 2004) -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to - avoid implicit memcpy calls (portability for no-library compilation) -- Increase sprintf() buffer size in gzdopen() to allow for large numbers -- Add INFLATE_STRICT to check distances against zlib header -- Improve WinCE errno handling and comments [Chang] -- Remove comment about no gzip header processing in FAQ -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees -- Add updated make_vms.com [Coghlan], update README -- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. -- Add FAQ entry and comments in deflate.c on uninitialized memory access -- Add Solaris 9 make options in configure [Gilbert] -- Allow strerror() usage in gzio.c for STDC -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] -- Use z_off_t for adler32_combine() and crc32_combine() lengths -- Make adler32() much faster for small len -- Use OS_CODE in deflate() default gzip header - -Changes in 1.2.2.1 (31 October 2004) -- Allow inflateSetDictionary() call for raw inflate -- Fix inflate header crc check bug for file names and comments -- Add deflateSetHeader() and gz_header structure for custom gzip headers -- Add inflateGetheader() to retrieve gzip headers -- Add crc32_combine() and adler32_combine() functions -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list -- Use zstreamp consistently in zlib.h (inflate_back functions) -- Remove GUNZIP condition from definition of inflate_mode in inflate.h - and in contrib/inflate86/inffast.S [Truta, Anderson] -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] -- Update projects/README.projects and projects/visualc6 [Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] -- Deprecate Z_ASCII; use Z_TEXT instead [Truta] -- Use a new algorithm for setting strm->data_type in trees.c [Truta] -- Do not define an exit() prototype in zutil.c unless DEBUG defined -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() -- Fix Darwin build version identification [Peterson] - -Changes in 1.2.2 (3 October 2004) -- Update zlib.h comments on gzip in-memory processing -- Set adler to 1 in inflateReset() to support Java test suite [Walles] -- Add contrib/dotzlib [Ravn] -- Update win32/DLL_FAQ.txt [Truta] -- Update contrib/minizip [Vollant] -- Move contrib/visual-basic.txt to old/ [Truta] -- Fix assembler builds in projects/visualc6/ [Truta] - -Changes in 1.2.1.2 (9 September 2004) -- Update INDEX file -- Fix trees.c to update strm->data_type (no one ever noticed!) -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) -- Add limited multitasking protection to DYNAMIC_CRC_TABLE -- Add NO_vsnprintf for VMS in zutil.h [Mozilla] -- Don't declare strerror() under VMS [Mozilla] -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize -- Update contrib/ada [Anisimkov] -- Update contrib/minizip [Vollant] -- Fix configure to not hardcode directories for Darwin [Peterson] -- Fix gzio.c to not return error on empty files [Brown] -- Fix indentation; update version in contrib/delphi/ZLib.pas and - contrib/pascal/zlibpas.pas [Truta] -- Update mkasm.bat in contrib/masmx86 [Truta] -- Update contrib/untgz [Truta] -- Add projects/README.projects [Truta] -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] -- Remove an unnecessary assignment to curr in inftrees.c [Truta] -- Add OS/2 to exe builds in configure [Poltorak] -- Remove err dummy parameter in zlib.h [Kientzle] - -Changes in 1.2.1.1 (9 January 2004) -- Update email address in README -- Several FAQ updates -- Fix a big fat bug in inftrees.c that prevented decoding valid - dynamic blocks with only literals and no distance codes -- - Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. - -Changes in 1.2.1 (17 November 2003) -- Remove a tab in contrib/gzappend/gzappend.c -- Update some interfaces in contrib for new zlib functions -- Update zlib version number in some contrib entries -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] -- Support shared libraries on Hurd and KFreeBSD [Brown] -- Fix error in NO_DIVIDE option of adler32.c - -Changes in 1.2.0.8 (4 November 2003) -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas -- Add experimental NO_DIVIDE #define in adler32.c - - Possibly faster on some processors (let me know if it is) -- Correct Z_BLOCK to not return on first inflate call if no wrap -- Fix strm->data_type on inflate() return to correctly indicate EOB -- Add deflatePrime() function for appending in the middle of a byte -- Add contrib/gzappend for an example of appending to a stream -- Update win32/DLL_FAQ.txt [Truta] -- Delete Turbo C comment in README [Truta] -- Improve some indentation in zconf.h [Truta] -- Fix infinite loop on bad input in configure script [Church] -- Fix gzeof() for concatenated gzip files [Johnson] -- Add example to contrib/visual-basic.txt [Michael B.] -- Add -p to mkdir's in Makefile.in [vda] -- Fix configure to properly detect presence or lack of printf functions -- Add AS400 support [Monnerat] -- Add a little Cygwin support [Wilson] - -Changes in 1.2.0.7 (21 September 2003) -- Correct some debug formats in contrib/infback9 -- Cast a type in a debug statement in trees.c -- Change search and replace delimiter in configure from % to # [Beebe] -- Update contrib/untgz to 0.2 with various fixes [Truta] -- Add build support for Amiga [Nikl] -- Remove some directories in old that have been updated to 1.2 -- Add dylib building for Mac OS X in configure and Makefile.in -- Remove old distribution stuff from Makefile -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X -- Update links in README - -Changes in 1.2.0.6 (13 September 2003) -- Minor FAQ updates -- Update contrib/minizip to 1.00 [Vollant] -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] -- Update POSTINC comment for 68060 [Nikl] -- Add contrib/infback9 with deflate64 decoding (unsupported) -- For MVS define NO_vsnprintf and undefine FAR [van Burik] -- Add pragma for fdopen on MVS [van Burik] - -Changes in 1.2.0.5 (8 September 2003) -- Add OF to inflateBackEnd() declaration in zlib.h -- Remember start when using gzdopen in the middle of a file -- Use internal off_t counters in gz* functions to properly handle seeks -- Perform more rigorous check for distance-too-far in inffast.c -- Add Z_BLOCK flush option to return from inflate at block boundary -- Set strm->data_type on return from inflate - - Indicate bits unused, if at block boundary, and if in last block -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size -- Add condition so old NO_DEFLATE define still works for compatibility -- FAQ update regarding the Windows DLL [Truta] -- INDEX update: add qnx entry, remove aix entry [Truta] -- Install zlib.3 into mandir [Wilson] -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] -- Adapt the zlib interface to the new DLL convention guidelines [Truta] -- Introduce ZLIB_WINAPI macro to allow the export of functions using - the WINAPI calling convention, for Visual Basic [Vollant, Truta] -- Update msdos and win32 scripts and makefiles [Truta] -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] -- Add contrib/ada [Anisimkov] -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] -- Add contrib/masm686 [Truta] -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm - [Truta, Vollant] -- Update contrib/delphi; rename to contrib/pascal; add example [Truta] -- Remove contrib/delphi2; add a new contrib/delphi [Truta] -- Avoid inclusion of the nonstandard in contrib/iostream, - and fix some method prototypes [Truta] -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip - [Truta] -- Avoid the use of backslash (\) in contrib/minizip [Vollant] -- Fix file time handling in contrib/untgz; update makefiles [Truta] -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines - [Vollant] -- Remove contrib/vstudio/vc15_16 [Vollant] -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] -- Update README.contrib [Truta] -- Invert the assignment order of match_head and s->prev[...] in - INSERT_STRING [Truta] -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings - [Truta] -- Compare function pointers with 0, not with NULL or Z_NULL [Truta] -- Fix prototype of syncsearch in inflate.c [Truta] -- Introduce ASMINF macro to be enabled when using an ASM implementation - of inflate_fast [Truta] -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] -- Modify test_gzio in example.c to take a single file name as a - parameter [Truta] -- Exit the example.c program if gzopen fails [Truta] -- Add type casts around strlen in example.c [Truta] -- Remove casting to sizeof in minigzip.c; give a proper type - to the variable compared with SUFFIX_LEN [Truta] -- Update definitions of STDC and STDC99 in zconf.h [Truta] -- Synchronize zconf.h with the new Windows DLL interface [Truta] -- Use SYS16BIT instead of __32BIT__ to distinguish between - 16- and 32-bit platforms [Truta] -- Use far memory allocators in small 16-bit memory models for - Turbo C [Truta] -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in - zlibCompileFlags [Truta] -- Cygwin has vsnprintf [Wilson] -- In Windows16, OS_CODE is 0, as in MSDOS [Truta] -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] - -Changes in 1.2.0.4 (10 August 2003) -- Minor FAQ updates -- Be more strict when checking inflateInit2's windowBits parameter -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well -- Add gzip wrapper option to deflateInit2 using windowBits -- Add updated QNX rule in configure and qnx directory [Bonnefoy] -- Make inflate distance-too-far checks more rigorous -- Clean up FAR usage in inflate -- Add casting to sizeof() in gzio.c and minigzip.c - -Changes in 1.2.0.3 (19 July 2003) -- Fix silly error in gzungetc() implementation [Vollant] -- Update contrib/minizip and contrib/vstudio [Vollant] -- Fix printf format in example.c -- Correct cdecl support in zconf.in.h [Anisimkov] -- Minor FAQ updates - -Changes in 1.2.0.2 (13 July 2003) -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons -- Attempt to avoid warnings in crc32.c for pointer-int conversion -- Add AIX to configure, remove aix directory [Bakker] -- Add some casts to minigzip.c -- Improve checking after insecure sprintf() or vsprintf() calls -- Remove #elif's from crc32.c -- Change leave label to inf_leave in inflate.c and infback.c to avoid - library conflicts -- Remove inflate gzip decoding by default--only enable gzip decoding by - special request for stricter backward compatibility -- Add zlibCompileFlags() function to return compilation information -- More typecasting in deflate.c to avoid warnings -- Remove leading underscore from _Capital #defines [Truta] -- Fix configure to link shared library when testing -- Add some Windows CE target adjustments [Mai] -- Remove #define ZLIB_DLL in zconf.h [Vollant] -- Add zlib.3 [Rodgers] -- Update RFC URL in deflate.c and algorithm.txt [Mai] -- Add zlib_dll_FAQ.txt to contrib [Truta] -- Add UL to some constants [Truta] -- Update minizip and vstudio [Vollant] -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h -- Expand use of NO_DUMMY_DECL to avoid all dummy structures -- Added iostream3 to contrib [Schwardt] -- Replace rewind() with fseek() for WinCE [Truta] -- Improve setting of zlib format compression level flags - - Report 0 for huffman and rle strategies and for level == 0 or 1 - - Report 2 only for level == 6 -- Only deal with 64K limit when necessary at compile time [Truta] -- Allow TOO_FAR check to be turned off at compile time [Truta] -- Add gzclearerr() function [Souza] -- Add gzungetc() function - -Changes in 1.2.0.1 (17 March 2003) -- Add Z_RLE strategy for run-length encoding [Truta] - - When Z_RLE requested, restrict matches to distance one - - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE -- Correct FASTEST compilation to allow level == 0 -- Clean up what gets compiled for FASTEST -- Incorporate changes to zconf.in.h [Vollant] - - Refine detection of Turbo C need for dummy returns - - Refine ZLIB_DLL compilation - - Include additional header file on VMS for off_t typedef -- Try to use _vsnprintf where it supplants vsprintf [Vollant] -- Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to - write more than 4095 bytes before compression -- Remove unused state from inflateBackEnd() -- Remove exit(0) from minigzip.c, example.c -- Get rid of all those darn tabs -- Add "check" target to Makefile.in that does the same thing as "test" -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in -- Update contrib/inflate86 [Anderson] -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] -- Add msdos and win32 directories with makefiles [Truta] -- More additions and improvements to the FAQ - -Changes in 1.2.0 (9 March 2003) -- New and improved inflate code - - About 20% faster - - Does not allocate 32K window unless and until needed - - Automatically detects and decompresses gzip streams - - Raw inflate no longer needs an extra dummy byte at end - - Added inflateBack functions using a callback interface--even faster - than inflate, useful for file utilities (gzip, zip) - - Added inflateCopy() function to record state for random access on - externally generated deflate streams (e.g. in gzip files) - - More readable code (I hope) -- New and improved crc32() - - About 50% faster, thanks to suggestions from Rodney Brown -- Add deflateBound() and compressBound() functions -- Fix memory leak in deflateInit2() -- Permit setting dictionary for raw deflate (for parallel deflate) -- Fix const declaration for gzwrite() -- Check for some malloc() failures in gzio.c -- Fix bug in gzopen() on single-byte file 0x1f -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer - and next buffer doesn't start with 0x8b -- Fix uncompress() to return Z_DATA_ERROR on truncated input -- Free memory at end of example.c -- Remove MAX #define in trees.c (conflicted with some libraries) -- Fix static const's in deflate.c, gzio.c, and zutil.[ch] -- Declare malloc() and free() in gzio.c if STDC not defined -- Use malloc() instead of calloc() in zutil.c if int big enough -- Define STDC for AIX -- Add aix/ with approach for compiling shared library on AIX -- Add HP-UX support for shared libraries in configure -- Add OpenUNIX support for shared libraries in configure -- Use $cc instead of gcc to build shared library -- Make prefix directory if needed when installing -- Correct Macintosh avoidance of typedef Byte in zconf.h -- Correct Turbo C memory allocation when under Linux -- Use libz.a instead of -lz in Makefile (assure use of compiled library) -- Update configure to check for snprintf or vsnprintf functions and their - return value, warn during make if using an insecure function -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that - is lost when library is used--resolution is to build new zconf.h -- Documentation improvements (in zlib.h): - - Document raw deflate and inflate - - Update RFCs URL - - Point out that zlib and gzip formats are different - - Note that Z_BUF_ERROR is not fatal - - Document string limit for gzprintf() and possible buffer overflow - - Note requirement on avail_out when flushing - - Note permitted values of flush parameter of inflate() -- Add some FAQs (and even answers) to the FAQ -- Add contrib/inflate86/ for x86 faster inflate -- Add contrib/blast/ for PKWare Data Compression Library decompression -- Add contrib/puff/ simple inflate for deflate format description - -Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. - This creates a security problem described in - http://www.zlib.org/advisory-2002-03-11.txt -- Returned incorrect error (Z_MEM_ERROR) on some invalid data -- Avoid accesses before window for invalid distances with inflate window - less than 32K. -- force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). - -Changes in 1.1.3 (9 July 1998) -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -- Support gzdopen on Mac with Metrowerks (Jason Linhart) -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) -- avoid some warnings with Borland C (Tom Tanner) -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) -- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) -- allow several arguments to configure (Tim Mooney, Frodo Looijaard) -- use libdir and includedir in Makefile.in (Tim Mooney) -- support shared libraries on OSF1 V4 (Tim Mooney) -- remove so_locations in "make clean" (Tim Mooney) -- fix maketree.c compilation error (Glenn, Mark) -- Python interface to zlib now in Python 1.5 (Jeremy Hylton) -- new Makefile.riscos (Rich Walker) -- initialize static descriptors in trees.c for embedded targets (Nick Smith) -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) -- add the OS/2 files in Makefile.in too (Andrew Zabolotny) -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) -- fix maketree.c to allow clean compilation of inffixed.h (Mark) -- fix parameter check in deflateCopy (Gunther Nikl) -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) -- Many portability patches by Christian Spieler: - . zutil.c, zutil.h: added "const" for zmem* - . Make_vms.com: fixed some typos - . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists - . msdos/Makefile.msc: remove "default rtl link library" info from obj files - . msdos/Makefile.*: use model-dependent name for the built zlib library - . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: - new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) -- replace __far with _far for better portability (Christian Spieler, Tom Lane) -- fix test for errno.h in configure (Tim Newsham) - -Changes in 1.1.2 (19 March 98) -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) - See http://www.winimage.com/zLibDll/unzip.html -- preinitialize the inflate tables for fixed codes, to make the code - completely thread safe (Mark) -- some simplifications and slight speed-up to the inflate code (Mark) -- fix gzeof on non-compressed files (Allan Schrum) -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) -- do not wrap extern "C" around system includes (Tom Lane) -- mention zlib binding for TCL in README (Andreas Kupries) -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) -- allow "configure --prefix $HOME" (Tim Mooney) -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) -- move Makefile.sas to amiga/Makefile.sas - -Changes in 1.1.1 (27 Feb 98) -- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) -- remove block truncation heuristic which had very marginal effect for zlib - (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the - compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - -Changes in 1.1.0 (24 Feb 98) -- do not return STREAM_END prematurely in inflate (John Bowler) -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) -- compile with -DFASTEST to get compression code optimized for speed only -- in minigzip, try mmap'ing the input file first (Miguel Albrecht) -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain - on Sun but significant on HP) - -- add a pointer to experimental unzip library in README (Gilles Vollant) -- initialize variable gcc in configure (Chris Herborth) - -Changes in 1.0.9 (17 Feb 1998) -- added gzputs and gzgets functions -- do not clear eof flag in gzseek (Mark Diekhans) -- fix gzseek for files in transparent mode (Mark Diekhans) -- do not assume that vsprintf returns the number of bytes written (Jens Krinke) -- replace EXPORT with ZEXPORT to avoid conflict with other programs -- added compress2 in zconf.h, zlib.def, zlib.dnt -- new asm code from Gilles Vollant in contrib/asm386 -- simplify the inflate code (Mark): - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() - . ZALLOC the length list in inflate_trees_fixed() instead of using stack - . ZALLOC the value area for huft_build() instead of using stack - . Simplify Z_FINISH check in inflate() - -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) -- read_buf buf parameter of type Bytef* instead of charf* -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) -- fix check for presence of directories in "make install" (Ian Willis) - -Changes in 1.0.8 (27 Jan 1998) -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) -- added compress2() to allow setting the compression level -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) -- use constant arrays for the static trees in trees.c instead of computing - them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". -- check return code of example in "make test" and display result -- pass minigzip command line options to file_compress -- simplifying code of inflateSync to avoid gcc 2.8 bug - -- support CC="gcc -Wall" in configure -s (QingLong) -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) -- fix test for shared library support to avoid compiler warnings -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) -- do not use fdopen for Metrowerks on Mac (Brad Pettit)) -- add checks for gzputc and gzputc in example.c -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) -- use const for the CRC table (Ken Raeburn) -- fixed "make uninstall" for shared libraries -- use Tracev instead of Trace in infblock.c -- in example.c use correct compressed length for test_sync -- suppress +vnocompatwarnings in configure for HPUX (not always supported) - -Changes in 1.0.7 (20 Jan 1998) -- fix gzseek which was broken in write mode -- return error for gzseek to negative absolute position -- fix configure for Linux (Chun-Chung Chen) -- increase stack space for MSC (Tim Wegner) -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) -- define EXPORTVA for gzprintf (Gilles Vollant) -- added man page zlib.3 (Rick Rodgers) -- for contrib/untgz, fix makedir() and improve Makefile - -- check gzseek in write mode in example.c -- allocate extra buffer for seeks only if gzseek is actually called -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) -- add inflateSyncPoint in zconf.h -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def - -Changes in 1.0.6 (19 Jan 1998) -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() -- check Z_FINISH in inflate (thanks to Marc Schluper) -- Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. -- move MSDOS or Windows specific files to directory msdos -- suppress the notion of partial flush to simplify the interface - (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) -- suppress history buffer provided by application to simplify the interface - (this feature was not implemented anyway in 1.0.4) -- next_in and avail_in must be initialized before calling inflateInit or - inflateInit2 -- add EXPORT in all exported functions (for Windows DLL) -- added Makefile.nt (thanks to Stephen Williams) -- added the unsupported "contrib" directory: - contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). - contrib/iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface - contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib - contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - level) in minigzip (thanks to Tom Lane) - -- use const for rommable constants in deflate -- added test for gzseek and gztell in example.c -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) -- add undocumented function zError to convert error code to string - (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. -- Add EXPORT keyword for check_func (needed for Windows DLL) -- add current directory to LD_LIBRARY_PATH for "make test" -- create also a link for libz.so.1 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) -- added -soname for Linux in configure (Chun-Chung Chen, -- assign numbers to the exported functions in zlib.def (for Windows DLL) -- add advice in zlib.h for best usage of deflateSetDictionary -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) -- allow compilation with ANSI keywords only enabled for TurboC in large model -- avoid "versionString"[0] (Borland bug) -- add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). -- allow compilation with CC -- defined STDC for OS/2 (David Charlap) -- limit external names to 8 chars for MVS (Thomas Lund) -- in minigzip.c, use static buffers only for 16-bit systems -- fix suffix check for "minigzip -d foo.gz" -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) -- added makelcc.bat for lcc-win32 (Tom St Denis) -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded $Id$. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. -- check for unistd.h in configure (for off_t) -- remove useless check parameter in inflate_blocks_free -- avoid useless assignment of s->check to itself in inflate_blocks_new -- do not flush twice in gzclose (thanks to Ken Raeburn) -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h -- work around buggy fclose on pipes for HP/UX -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) -- fix configure if CC is already equal to gcc - -Changes in 1.0.5 (3 Jan 98) -- Fix inflate to terminate gracefully when fed corrupted or invalid data -- Use const for rommable constants in inflate -- Eliminate memory leaks on error conditions in inflate -- Removed some vestigial code in inflate -- Update web address in README - -Changes in 1.0.4 (24 Jul 96) -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. -- zlibVersion and gzerror return const char* (needed for DLL) -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) -- use z_error only for DEBUG (avoid problem with DLLs) - -Changes in 1.0.3 (2 Jul 96) -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS - small and medium models; this makes the library incompatible with previous - versions for these models. (No effect in large model or on other systems.) -- return OK instead of BUF_ERROR if previous deflate call returned with - avail_out as zero but there is nothing to do -- added memcmp for non STDC compilers -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) -- better check for 16-bit mode MSC (avoids problem with Symantec) - -Changes in 1.0.2 (23 May 96) -- added Windows DLL support -- added a function zlibVersion (for the DLL support) -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) -- Bytef is define's instead of typedef'd only for Borland C -- avoid reading uninitialized memory in example.c -- mention in README that the zlib format is now RFC1950 -- updated Makefile.dj2 -- added algorithm.doc - -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] -- fix array overlay in deflate.c which sometimes caused bad compressed data -- fix inflate bug with empty stored block -- fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. -- Bytef is define'd instead of typedef'ed (work around Borland bug) -- added an INDEX file -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) -- speed up adler32 for modern machines without auto-increment -- added -ansi for IRIX in configure -- static_init_done in trees.c is an int -- define unlink as delete for VMS -- fix configure for QNX -- add configure branch for SCO and HPUX -- avoid many warnings (unused variables, dead assignments, etc...) -- no fdopen for BeOS -- fix the Watcom fix for 32 bit mode (define FAR as empty) -- removed redefinition of Byte for MKWERKS -- work around an MWKERKS bug (incorrect merge of all .h files) - -Changes in 0.99 (27 Jan 96) -- allow preset dictionary shared between compressor and decompressor -- allow compression level 0 (no compression) -- add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. -- test large buffers and deflateParams in example.c -- add optional "configure" to build zlib as a shared library -- suppress Makefile.qnx, use configure instead -- fixed deflate for 64-bit systems (detected on Cray) -- fixed inflate_blocks for 64-bit systems (detected on Alpha) -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) -- always return Z_BUF_ERROR when deflate() has nothing to do -- deflateInit and inflateInit are now macros to allow version checking -- prefix all global functions and types with z_ with -DZ_PREFIX -- make falloc completely reentrant (inftrees.c) -- fixed very unlikely race condition in ct_static_init -- free in reverse order of allocation to help memory manager -- use zlib-1.0/* instead of zlib/* inside the tar.gz -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith - -Wconversion -Wstrict-prototypes -Wmissing-prototypes" -- allow gzread on concatenated .gz files -- deflateEnd now returns Z_DATA_ERROR if it was premature -- deflate is finally (?) fully deterministic (no matches beyond end of input) -- Document Z_SYNC_FLUSH -- add uninstall in Makefile -- Check for __cpluplus in zlib.h -- Better test in ct_align for partial flush -- avoid harmless warnings for Borland C++ -- initialize hash_head in deflate.c -- avoid warning on fdopen (gzio.c) for HP cc -Aa -- include stdlib.h for STDC compilers -- include errno.h for Cray -- ignore error if ranlib doesn't exist -- call ranlib twice for NeXTSTEP -- use exec_prefix instead of prefix for libz.a -- renamed ct_* as _tr_* to avoid conflict with applications -- clear z->msg in inflateInit2 before any error return -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c -- fixed typo in zconf.h (_GNUC__ => __GNUC__) -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) -- in fcalloc, normalize pointer if size > 65520 bytes -- don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... -- use Z_BINARY instead of BINARY -- document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. -- fix error checking in gzread -- allow skipping .gz extra-field on pipes -- added reference to Perl interface in README -- put the crc table in FAR data (I dislike more and more the medium model :) -- added get_crc_table -- added a dimension to all arrays (Borland C can't count). -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast -- guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. -- don't use unsized arrays to avoid silly warnings by Visual C++: - warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). -- define enum out of inflate_blocks_state to allow compilation with C++ - -Changes in 0.95 (16 Aug 95) -- fix MSDOS small and medium model (now easier to adapt to any compiler) -- inlined send_bits -- fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). -- default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). -- voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). - -Changes in 0.94 (13 Aug 95) -- support MSDOS medium model -- fix deflate with flush (could sometimes generate bad output) -- fix deflateReset (zlib header was incorrectly suppressed) -- added support for VMS -- allow a compression level in gzopen() -- gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. -- rename libgz.a as libz.a -- avoid complex expression in infcodes.c triggering Turbo C bug -- work around a problem with gcc on Alpha (in INSERT_STRING) -- don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. -- avoid warning about (unused) pointer before start of array in deflate.c -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c -- avoid reserved word 'new' in trees.c - -Changes in 0.93 (25 June 95) -- temporarily disable inline functions -- make deflate deterministic -- give enough lookahead for PARTIAL_FLUSH -- Set binary mode for stdin/stdout in minigzip.c for OS/2 -- don't even use signed char in inflate (not portable enough) -- fix inflate memory leak for segmented architectures - -Changes in 0.92 (3 May 95) -- don't assume that char is signed (problem on SGI) -- Clear bit buffer when starting a stored block -- no memcpy on Pyramid -- suppressed inftest.c -- optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. -- untabify all sources to simplify patches - -Changes in 0.91 (2 May 95) -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h -- Document the memory requirements in zconf.h -- added "make install" -- fix sync search logic in inflateSync -- deflate(Z_FULL_FLUSH) now works even if output buffer too short -- after inflateSync, don't scare people with just "lo world" -- added support for DJGPP - -Changes in 0.9 (1 May 95) -- don't assume that zalloc clears the allocated memory (the TurboC bug - was Mark's bug after all :) -- let again gzread copy uncompressed data unchanged (was working in 0.71) -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented -- added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. -- document explicitly that zalloc(64K) on MSDOS must return a normalized - pointer (zero offset) -- added Makefiles for Microsoft C, Turbo C, Borland C++ -- faster crc32() - -Changes in 0.8 (29 April 95) -- added fast inflate (inffast.c) -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - (actually that was not a compiler bug, see 0.81 above) -- gzread no longer reads one extra byte in certain cases -- In gzio destroy(), don't reference a freed structure -- avoid many warnings for MSDOS -- avoid the ERROR symbol which is used by MS Windows - -Changes in 0.71 (14 April 95) -- Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. - -Changes in 0.7 (14 April 95) -- Added full inflate support. -- Simplified the crc32() interface. The pre- and post-conditioning - (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. - -Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - -Changes in 0.6 (11 April 95) -- added minigzip.c -- added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. -- fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). -- don't allocate big arrays in the stack (for MSDOS) -- fix some MSDOS compilation problems - -Changes in 0.5: -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. -- support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. -- added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. - -Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. -- added adler32 and crc32 -- renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. -- added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting - user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. - -Changes in 0.3: -- prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. -- added Z_HUFFMAN_ONLY -- added gzerror() diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/FAQ b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/FAQ deleted file mode 100644 index 32f9e95..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/FAQ +++ /dev/null @@ -1,368 +0,0 @@ - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://zlib.net/ which may have more recent information. -The lastest zlib FAQ is at http://zlib.net/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. See the - file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the - precompiled DLL are found in the zlib web site at http://zlib.net/ . - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://marknelson.us/1997/01/01/zlib-engine/ - * win32/DLL_FAQ.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR. - - Make sure that before the call of compress(), the length of the compressed - buffer is equal to the available size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR. - - Before making the call, make sure that avail_in and avail_out are not zero. - When setting the parameter flush equal to Z_FINISH, also make sure that - avail_out is big enough to allow processing all pending input. Note that a - Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be - made with more input or output space. A Z_BUF_ERROR may in fact be - unavoidable depending on how the functions are used, since it is not - possible to tell whether or not there is more output pending when - strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a - heavily annotated example. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h . Examples of zlib usage are in the files test/example.c - and test/minigzip.c, with more in examples/ . - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple package. - zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of zlib. - Please try to reproduce the problem with a small program and send the - corresponding source to us at zlib@gzip.org . Do not send multi-megabyte - data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - Not by itself, no. See the directory contrib/minizip in the zlib - distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - By default a shared (and a static) library is built for Unix. So: - - make distclean - ./configure - make - -14. How do I install a shared zlib library on Unix? - - After the above, then: - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to - it. You can check the version at the top of zlib.h or with the - ZLIB_VERSION symbol defined in zlib.h . - -15. I have a question about OttoPDF. - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site: Joel Hainley, jhainley@myndkryme.com. - -16. Can zlib decode Flate data in an Adobe PDF file? - - Yes. See http://www.pdflib.com/ . To modify PDF forms, see - http://sourceforge.net/projects/acroformtool/ . - -17. Why am I getting this "register_frame_info not found" error on Solaris? - - After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib - generates an error such as: - - ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: - symbol __register_frame_info: referenced symbol not found - - The symbol __register_frame_info is not part of zlib, it is generated by - the C compiler (cc or gcc). You must recompile applications using zlib - which have this problem. This problem is specific to Solaris. See - http://www.sunfreeware.com for Solaris versions of zlib and applications - using zlib. - -18. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip formats - use the same compressed data format internally, but have different headers - and trailers around the compressed data. - -19. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about a - single file, such as the name and last modification date. The zlib format - on the other hand was designed for in-memory and communication channel - applications, and has a much more compact header and trailer and uses a - faster integrity check than gzip. - -20. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode the - gzip format using inflateInit2(). Read zlib.h for more details. - -21. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's *Init* functions - allow for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -22. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -23. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -24. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -25. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -26. Will zlib work on a 64-bit machine? - - Yes. It has been tested on 64-bit machines, and has no dependence on any - data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -27. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format than - does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -28. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically use - Z_FULL_FLUSH, carefully write all the pending data at those points, and - keep an index of those locations, then you can start decompression at those - points. You have to be careful to not use Z_FULL_FLUSH too often, since it - can significantly degrade compression. Alternatively, you can scan a - deflate stream once to generate an index, and then use that index for - random access. See examples/zran.c . - -29. Does zlib work on MVS, OS/390, CICS, etc.? - - It has in the past, but we have not heard of any recent evidence. There - were working ports of zlib 1.1.4 to MVS, but those links no longer work. - If you know of recent, successful applications of zlib on these operating - systems, please let us know. Thanks. - -30. Is there some simpler, easier to read version of inflate I can look at to - understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -31. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -32. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit only - if the compiler's "long" type is 32 bits. If the compiler's "long" type is - 64 bits, then the limit is 16 exabytes. - -33. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib is - compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of an 8K string space (or other value as set by - gzbuffer()), other than the caller of gzprintf() assuring that the output - will not exceed 8K. On the other hand, if zlib is compiled to use - snprintf() or vsnprintf(), which should normally be the case, then there is - no vulnerability. The ./configure script will display warnings if an - insecure variation of sprintf() will be used by gzprintf(). Also the - zlibCompileFlags() function will return information on what variant of - sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability, and versions - 1.2.1 and 1.2.2 were subject to an access exception when decompressing - invalid compressed data. - -34. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://zlib.net/ . - -35. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pedantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly as well as contradicted each other. So now, we simply - make sure that the code always works. - -36. Valgrind (or some similar memory access checker) says that deflate is - performing a conditional jump that depends on an uninitialized value. - Isn't that a bug? - - No. That is intentional for performance reasons, and the output of deflate - is not affected. This only started showing up recently since zlib 1.2.x - uses malloc() by default for allocations, whereas earlier versions used - calloc(), which zeros out the allocated memory. Even though the code was - correct, versions 1.2.4 and later was changed to not stimulate these - checkers. - -37. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -38. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very - weak and can be broken with freely available programs. To get strong - encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib - compression. For PKZIP compatible "encryption", look at - http://www.info-zip.org/ - -39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion with - the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specification in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -40. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. In - any case, the compression improvements are so modest compared to other more - modern approaches, that it's not worth the effort to implement. - -41. I'm having a problem with the zip functions in zlib, can you help? - - There are no zip functions in zlib. You are probably using minizip by - Giles Vollant, which is found in the contrib directory of zlib. It is not - part of zlib. In fact none of the stuff in contrib is part of zlib. The - files in there are not supported by the zlib authors. You need to contact - the authors of the respective contribution for help. - -42. The match.asm code in contrib is under the GNU General Public License. - Since it's part of zlib, doesn't that mean that all of zlib falls under the - GNU GPL? - - No. The files in contrib are not part of zlib. They were contributed by - other authors and are provided as a convenience to the user within the zlib - distribution. Each item in contrib has its own license. - -43. Is zlib subject to export controls? What is its ECCN? - - zlib is not subject to export controls, and so is classified as EAR99. - -44. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/INDEX b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/INDEX deleted file mode 100644 index f64a14f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/INDEX +++ /dev/null @@ -1,68 +0,0 @@ -CMakeLists.txt cmake build file -ChangeLog history of changes -FAQ Frequently Asked Questions about zlib -INDEX this file -Makefile dummy Makefile that tells you to ./configure -Makefile.in template for Unix Makefile -README guess what -configure configure script for Unix -make_vms.com makefile for VMS -test/example.c zlib usages examples for build testing -test/minigzip.c minimal gzip-like functionality for build testing -test/infcover.c inf*.c code coverage for build coverage testing -treebuild.xml XML description of source file dependencies -zconf.h.cmakein zconf.h template for cmake -zconf.h.in zconf.h template for configure -zlib.3 Man page for zlib -zlib.3.pdf Man page in PDF format -zlib.map Linux symbol information -zlib.pc.in Template for pkg-config descriptor -zlib.pc.cmakein zlib.pc template for cmake -zlib2ansi perl script to convert source files for C++ compilation - -amiga/ makefiles for Amiga SAS C -as400/ makefiles for AS/400 -doc/ documentation for formats and algorithms -msdos/ makefiles for MSDOS -nintendods/ makefile for Nintendo DS -old/ makefiles for various architectures and zlib documentation - files that have not yet been updated for zlib 1.2.x -qnx/ makefiles for QNX -watcom/ makefiles for OpenWatcom -win32/ makefiles for Windows - - zlib public header files (required for library use): -zconf.h -zlib.h - - private source files used to build the zlib library: -adler32.c -compress.c -crc32.c -crc32.h -deflate.c -deflate.h -gzclose.c -gzguts.h -gzlib.c -gzread.c -gzwrite.c -infback.c -inffast.c -inffast.h -inffixed.h -inflate.c -inflate.h -inftrees.c -inftrees.h -trees.c -trees.h -uncompr.c -zutil.c -zutil.h - - source files for sample programs -See examples/README.examples - - unsupported contributions by third parties -See contrib/README.contrib diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/README b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/README deleted file mode 100644 index 35231cb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/README +++ /dev/null @@ -1,115 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.8 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and -rfc1952 (gzip format). - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file test/example.c which also tests that -the library is working correctly. Another example is given in the file -test/minigzip.c. The compression library itself is composed of all source -files in the root directory. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile.in. In short "./configure; make test", and if that goes -well, "make install" should work for most flavors of Unix. For Windows, use -one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use -make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://zlib.net/ . Before reporting a problem, please check this site to -verify that you have the latest version of zlib; otherwise get the latest -version and check whether the problem still exists or not. - -PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available at -http://marknelson.us/1997/01/01/zlib-engine/ . - -The changes made in version 1.2.8 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory contrib/ . - -zlib is available in Java using the java.util.zip package, documented at -http://java.sun.com/developer/technicalArticles/Programming/compression/ . - -A Perl interface to zlib written by Paul Marquess is available -at CPAN (Comprehensive Perl Archive Network) sites, including -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ . - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://docs.python.org/library/zlib.html . - -zlib is built into tcl: http://wiki.tcl.tk/4610 . - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS or BEOS. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate and - zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; they - are too numerous to cite here. - -Copyright notice: - - (C) 1995-2013 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* receiving -lengthy legal documents to sign. The sources are provided for free but without -warranty of any kind. The library has been entirely written by Jean-loup -Gailly and Mark Adler; it does not include third-party code. - -If you redistribute modified sources, we would appreciate that you include in -the file ChangeLog history information documenting your changes. Please read -the FAQ for more information on the distribution of modified source versions. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/adler32.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/adler32.c deleted file mode 100644 index 003d373..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/adler32.c +++ /dev/null @@ -1,179 +0,0 @@ -/* adler32.c -- compute the Adler-32 checksum of a data stream - * Copyright (C) 1995-2011 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" - -#define local static - -local uLong adler32_combine_ OF((uLong adler1, uLong adler2, z_off64_t len2)); - -#define BASE 65521 /* largest prime smaller than 65536 */ -#define NMAX 5552 -/* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ - -#define DO1(buf,i) {adler += (buf)[i]; sum2 += adler;} -#define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); -#define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); -#define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); -#define DO16(buf) DO8(buf,0); DO8(buf,8); - -/* use NO_DIVIDE if your processor does not do division in hardware -- - try it both ways to see which is faster */ -#ifdef NO_DIVIDE -/* note that this assumes BASE is 65521, where 65536 % 65521 == 15 - (thank you to John Reiser for pointing this out) */ -# define CHOP(a) \ - do { \ - unsigned long tmp = a >> 16; \ - a &= 0xffffUL; \ - a += (tmp << 4) - tmp; \ - } while (0) -# define MOD28(a) \ - do { \ - CHOP(a); \ - if (a >= BASE) a -= BASE; \ - } while (0) -# define MOD(a) \ - do { \ - CHOP(a); \ - MOD28(a); \ - } while (0) -# define MOD63(a) \ - do { /* this assumes a is not negative */ \ - z_off64_t tmp = a >> 32; \ - a &= 0xffffffffL; \ - a += (tmp << 8) - (tmp << 5) + tmp; \ - tmp = a >> 16; \ - a &= 0xffffL; \ - a += (tmp << 4) - tmp; \ - tmp = a >> 16; \ - a &= 0xffffL; \ - a += (tmp << 4) - tmp; \ - if (a >= BASE) a -= BASE; \ - } while (0) -#else -# define MOD(a) a %= BASE -# define MOD28(a) a %= BASE -# define MOD63(a) a %= BASE -#endif - -/* ========================================================================= */ -uLong ZEXPORT adler32(adler, buf, len) - uLong adler; - const Bytef *buf; - uInt len; -{ - unsigned long sum2; - unsigned n; - - /* split Adler-32 into component sums */ - sum2 = (adler >> 16) & 0xffff; - adler &= 0xffff; - - /* in case user likes doing a byte at a time, keep it fast */ - if (len == 1) { - adler += buf[0]; - if (adler >= BASE) - adler -= BASE; - sum2 += adler; - if (sum2 >= BASE) - sum2 -= BASE; - return adler | (sum2 << 16); - } - - /* initial Adler-32 value (deferred check for len == 1 speed) */ - if (buf == Z_NULL) - return 1L; - - /* in case short lengths are provided, keep it somewhat fast */ - if (len < 16) { - while (len--) { - adler += *buf++; - sum2 += adler; - } - if (adler >= BASE) - adler -= BASE; - MOD28(sum2); /* only added so many BASE's */ - return adler | (sum2 << 16); - } - - /* do length NMAX blocks -- requires just one modulo operation */ - while (len >= NMAX) { - len -= NMAX; - n = NMAX / 16; /* NMAX is divisible by 16 */ - do { - DO16(buf); /* 16 sums unrolled */ - buf += 16; - } while (--n); - MOD(adler); - MOD(sum2); - } - - /* do remaining bytes (less than NMAX, still just one modulo) */ - if (len) { /* avoid modulos if none remaining */ - while (len >= 16) { - len -= 16; - DO16(buf); - buf += 16; - } - while (len--) { - adler += *buf++; - sum2 += adler; - } - MOD(adler); - MOD(sum2); - } - - /* return recombined sums */ - return adler | (sum2 << 16); -} - -/* ========================================================================= */ -local uLong adler32_combine_(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ - unsigned long sum1; - unsigned long sum2; - unsigned rem; - - /* for negative len, return invalid adler32 as a clue for debugging */ - if (len2 < 0) - return 0xffffffffUL; - - /* the derivation of this formula is left as an exercise for the reader */ - MOD63(len2); /* assumes len2 >= 0 */ - rem = (unsigned)len2; - sum1 = adler1 & 0xffff; - sum2 = rem * sum1; - MOD(sum2); - sum1 += (adler2 & 0xffff) + BASE - 1; - sum2 += ((adler1 >> 16) & 0xffff) + ((adler2 >> 16) & 0xffff) + BASE - rem; - if (sum1 >= BASE) sum1 -= BASE; - if (sum1 >= BASE) sum1 -= BASE; - if (sum2 >= (BASE << 1)) sum2 -= (BASE << 1); - if (sum2 >= BASE) sum2 -= BASE; - return sum1 | (sum2 << 16); -} - -/* ========================================================================= */ -uLong ZEXPORT adler32_combine(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off_t len2; -{ - return adler32_combine_(adler1, adler2, len2); -} - -uLong ZEXPORT adler32_combine64(adler1, adler2, len2) - uLong adler1; - uLong adler2; - z_off64_t len2; -{ - return adler32_combine_(adler1, adler2, len2); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/algorithm.txt b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/algorithm.txt deleted file mode 100644 index 2ee706a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/algorithm.txt +++ /dev/null @@ -1,209 +0,0 @@ -1. Compression algorithm (deflate) - -The deflation algorithm used by gzip (also zip and zlib) is a variation of -LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in -the input data. The second occurrence of a string is replaced by a -pointer to the previous string, in the form of a pair (distance, -length). Distances are limited to 32K bytes, and lengths are limited -to 258 bytes. When a string does not occur anywhere in the previous -32K bytes, it is emitted as a sequence of literal bytes. (In this -description, `string' must be taken as an arbitrary sequence of bytes, -and is not restricted to printable characters.) - -Literals or match lengths are compressed with one Huffman tree, and -match distances are compressed with another tree. The trees are stored -in a compact form at the start of each block. The blocks can have any -size (except that the compressed data for one block must fit in -available memory). A block is terminated when deflate() determines that -it would be useful to start another block with fresh trees. (This is -somewhat similar to the behavior of LZW-based _compress_.) - -Duplicated strings are found using a hash table. All input strings of -length 3 are inserted in the hash table. A hash index is computed for -the next 3 bytes. If the hash chain for this index is not empty, all -strings in the chain are compared with the current input string, and -the longest match is selected. - -The hash chains are searched starting with the most recent strings, to -favor small distances and thus take advantage of the Huffman encoding. -The hash chains are singly linked. There are no deletions from the -hash chains, the algorithm simply discards matches that are too old. - -To avoid a worst-case situation, very long hash chains are arbitrarily -truncated at a certain length, determined by a runtime option (level -parameter of deflateInit). So deflate() does not always find the longest -possible match but generally finds a match which is long enough. - -deflate() also defers the selection of matches with a lazy evaluation -mechanism. After a match of length N has been found, deflate() searches for -a longer match at the next input byte. If a longer match is found, the -previous match is truncated to a length of one (thus producing a single -literal byte) and the process of lazy evaluation begins again. Otherwise, -the original match is kept, and the next match search is attempted only N -steps later. - -The lazy match evaluation is also subject to a runtime parameter. If -the current match is long enough, deflate() reduces the search for a longer -match, thus speeding up the whole process. If compression ratio is more -important than speed, deflate() attempts a complete second search even if -the first match is already long enough. - -The lazy match evaluation is not performed for the fastest compression -modes (level parameter 1 to 3). For these fast modes, new strings -are inserted in the hash table only when no match was found, or -when the match is not too long. This degrades the compression ratio -but saves time since there are both fewer insertions and fewer searches. - - -2. Decompression algorithm (inflate) - -2.1 Introduction - -The key question is how to represent a Huffman code (or any prefix code) so -that you can decode fast. The most important characteristic is that shorter -codes are much more common than longer codes, so pay attention to decoding the -short codes fast, and let the long codes take longer to decode. - -inflate() sets up a first level table that covers some number of bits of -input less than the length of longest code. It gets that many bits from the -stream, and looks it up in the table. The table will tell if the next -code is that many bits or less and how many, and if it is, it will tell -the value, else it will point to the next level table for which inflate() -grabs more bits and tries to decode a longer code. - -How many bits to make the first lookup is a tradeoff between the time it -takes to decode and the time it takes to build the table. If building the -table took no time (and if you had infinite memory), then there would only -be a first level table to cover all the way to the longest code. However, -building the table ends up taking a lot longer for more bits since short -codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then -to set that variable for the maximum speed. - -For inflate, which has 286 possible codes for the literal/length tree, the size -of the first table is nine bits. Also the distance trees have 30 possible -values, and the size of the first table is six bits. Note that for each of -those cases, the table ended up one bit longer than the ``average'' code -length, i.e. the code length of an approximately flat code which would be a -little more than eight bits for 286 symbols and a little less than five bits -for 30 symbols. - - -2.2 More details on the inflate table lookup - -Ok, you want to know what this cleverly obfuscated inflate tree actually -looks like. You are correct that it's not a Huffman tree. It is simply a -lookup table for the first, let's say, nine bits of a Huffman symbol. The -symbol could be as short as one bit or as long as 15 bits. If a particular -symbol is shorter than nine bits, then that symbol's translation is duplicated -in all those entries that start with that symbol's bits. For example, if the -symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a -symbol is nine bits long, it appears in the table once. - -If the symbol is longer than nine bits, then that entry in the table points -to another similar table for the remaining bits. Again, there are duplicated -entries as needed. The idea is that most of the time the symbol will be short -and there will only be one table look up. (That's whole idea behind data -compression in the first place.) For the less frequent long symbols, there -will be two lookups. If you had a compression method with really long -symbols, you could have as many levels of lookups as is efficient. For -inflate, two is enough. - -So a table entry either points to another table (in which case nine bits in -the above example are gobbled), or it contains the translation for the symbol -and the number of bits to gobble. Then you start again with the next -ungobbled bit. - -You may wonder: why not just have one lookup table for how ever many bits the -longest symbol is? The reason is that if you do that, you end up spending -more time filling in duplicate symbol entries than you do actually decoding. -At least for deflate's output that generates new trees every several 10's of -kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code -would take too long if you're only decoding several thousand symbols. At the -other extreme, you could make a new table for every bit in the code. In fact, -that's essentially a Huffman tree. But then you spend too much time -traversing the tree while decoding, even for short symbols. - -So the number of bits for the first lookup table is a trade of the time to -fill out the table vs. the time spent looking at the second level and above of -the table. - -Here is an example, scaled down: - -The code being decoded, with 10 symbols, from 1 to 6 bits long: - -A: 0 -B: 10 -C: 1100 -D: 11010 -E: 11011 -F: 11100 -G: 11101 -H: 11110 -I: 111110 -J: 111111 - -Let's make the first table three bits long (eight entries): - -000: A,1 -001: A,1 -010: A,1 -011: A,1 -100: B,2 -101: B,2 -110: -> table X (gobble 3 bits) -111: -> table Y (gobble 3 bits) - -Each entry is what the bits decode as and how many bits that is, i.e. how -many bits to gobble. Or the entry points to another table, with the number of -bits to gobble implicit in the size of the table. - -Table X is two bits long since the longest code starting with 110 is five bits -long: - -00: C,1 -01: C,1 -10: D,2 -11: E,2 - -Table Y is three bits long since the longest code starting with 111 is six -bits long: - -000: F,2 -001: F,2 -010: G,2 -011: G,2 -100: H,2 -101: H,2 -110: I,3 -111: J,3 - -So what we have here are three tables with a total of 20 entries that had to -be constructed. That's compared to 64 entries for a single table. Or -compared to 16 entries for a Huffman tree (six two entry tables and one four -entry table). Assuming that the code ideally represents the probability of -the symbols, it takes on the average 1.25 lookups per symbol. That's compared -to one lookup for the single table, or 1.66 lookups per symbol for the -Huffman tree. - -There, I think that gives you a picture of what's going on. For inflate, the -meaning of a particular symbol is often more than just a letter. It can be a -byte (a "literal"), or it can be either a length or a distance which -indicates a base value and a number of bits to fetch after the code that is -added to the base value. Or it might be the special end-of-block code. The -data structures created in inftrees.c try to encode all that information -compactly in the tables. - - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -References: - -[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data -Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, -pp. 337-343. - -``DEFLATE Compressed Data Format Specification'' available in -http://tools.ietf.org/html/rfc1951 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/compress.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/compress.c deleted file mode 100644 index 832a548..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/compress.c +++ /dev/null @@ -1,80 +0,0 @@ -/* compress.c -- compress a memory buffer - * Copyright (C) 1995-2005 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ -int ZEXPORT compress2 (dest, destLen, source, sourceLen, level) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; - int level; -{ - z_stream stream; - int err; - - stream.next_in = (z_const Bytef *)source; - stream.avail_in = (uInt)sourceLen; -#ifdef MAXSEG_64K - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; -#endif - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - stream.opaque = (voidpf)0; - - err = deflateInit(&stream, level); - if (err != Z_OK) return err; - - err = deflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - deflateEnd(&stream); - return err == Z_OK ? Z_BUF_ERROR : err; - } - *destLen = stream.total_out; - - err = deflateEnd(&stream); - return err; -} - -/* =========================================================================== - */ -int ZEXPORT compress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION); -} - -/* =========================================================================== - If the default memLevel or windowBits for deflateInit() is changed, then - this function needs to be updated. - */ -uLong ZEXPORT compressBound (sourceLen) - uLong sourceLen; -{ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + - (sourceLen >> 25) + 13; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/configure b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/configure deleted file mode 100644 index f5436b9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/configure +++ /dev/null @@ -1,831 +0,0 @@ -#!/bin/sh -# configure script for zlib. -# -# Normally configure builds both a static and a shared library. -# If you want to build just a static library, use: ./configure --static -# -# To impose specific compiler or flags or install directory, use for example: -# prefix=$HOME CC=cc CFLAGS="-O4" ./configure -# or for csh/tcsh users: -# (setenv prefix $HOME; setenv CC cc; setenv CFLAGS "-O4"; ./configure) - -# Incorrect settings of CC or CFLAGS may prevent creating a shared library. -# If you have problems, try without defining CC and CFLAGS before reporting -# an error. - -# start off configure.log -echo -------------------- >> configure.log -echo $0 $* >> configure.log -date >> configure.log - -# set command prefix for cross-compilation -if [ -n "${CHOST}" ]; then - uname="`echo "${CHOST}" | sed -e 's/^[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)$/\1/' -e 's/^[^-]*-[^-]*-\([^-]*\)-.*$/\1/'`" - CROSS_PREFIX="${CHOST}-" -fi - -# destination name for static library -STATICLIB=libz.a - -# extract zlib version numbers from zlib.h -VER=`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h` -VER3=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\\.[0-9]*\).*/\1/p' < zlib.h` -VER2=`sed -n -e '/VERSION "/s/.*"\([0-9]*\\.[0-9]*\)\\..*/\1/p' < zlib.h` -VER1=`sed -n -e '/VERSION "/s/.*"\([0-9]*\)\\..*/\1/p' < zlib.h` - -# establish commands for library building -if "${CROSS_PREFIX}ar" --version >/dev/null 2>/dev/null || test $? -lt 126; then - AR=${AR-"${CROSS_PREFIX}ar"} - test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log -else - AR=${AR-"ar"} - test -n "${CROSS_PREFIX}" && echo Using ${AR} | tee -a configure.log -fi -ARFLAGS=${ARFLAGS-"rc"} -if "${CROSS_PREFIX}ranlib" --version >/dev/null 2>/dev/null || test $? -lt 126; then - RANLIB=${RANLIB-"${CROSS_PREFIX}ranlib"} - test -n "${CROSS_PREFIX}" && echo Using ${RANLIB} | tee -a configure.log -else - RANLIB=${RANLIB-"ranlib"} -fi -if "${CROSS_PREFIX}nm" --version >/dev/null 2>/dev/null || test $? -lt 126; then - NM=${NM-"${CROSS_PREFIX}nm"} - test -n "${CROSS_PREFIX}" && echo Using ${NM} | tee -a configure.log -else - NM=${NM-"nm"} -fi - -# set defaults before processing command line options -LDCONFIG=${LDCONFIG-"ldconfig"} -LDSHAREDLIBC="${LDSHAREDLIBC--lc}" -ARCHS= -prefix=${prefix-/usr/local} -exec_prefix=${exec_prefix-'${prefix}'} -libdir=${libdir-'${exec_prefix}/lib'} -sharedlibdir=${sharedlibdir-'${libdir}'} -includedir=${includedir-'${prefix}/include'} -mandir=${mandir-'${prefix}/share/man'} -shared_ext='.so' -shared=1 -solo=0 -cover=0 -zprefix=0 -zconst=0 -build64=0 -gcc=0 -old_cc="$CC" -old_cflags="$CFLAGS" -OBJC='$(OBJZ) $(OBJG)' -PIC_OBJC='$(PIC_OBJZ) $(PIC_OBJG)' - -# leave this script, optionally in a bad way -leave() -{ - if test "$*" != "0"; then - echo "** $0 aborting." | tee -a configure.log - fi - rm -f $test.[co] $test $test$shared_ext $test.gcno ./--version - echo -------------------- >> configure.log - echo >> configure.log - echo >> configure.log - exit $1 -} - -# process command line options -while test $# -ge 1 -do -case "$1" in - -h* | --help) - echo 'usage:' | tee -a configure.log - echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log - echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log - echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log - exit 0 ;; - -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; - -l*=* | --libdir=*) libdir=`echo $1 | sed 's/.*=//'`; shift ;; - --sharedlibdir=*) sharedlibdir=`echo $1 | sed 's/.*=//'`; shift ;; - -i*=* | --includedir=*) includedir=`echo $1 | sed 's/.*=//'`;shift ;; - -u*=* | --uname=*) uname=`echo $1 | sed 's/.*=//'`;shift ;; - -p* | --prefix) prefix="$2"; shift; shift ;; - -e* | --eprefix) exec_prefix="$2"; shift; shift ;; - -l* | --libdir) libdir="$2"; shift; shift ;; - -i* | --includedir) includedir="$2"; shift; shift ;; - -s* | --shared | --enable-shared) shared=1; shift ;; - -t | --static) shared=0; shift ;; - --solo) solo=1; shift ;; - --cover) cover=1; shift ;; - -z* | --zprefix) zprefix=1; shift ;; - -6* | --64) build64=1; shift ;; - -a*=* | --archs=*) ARCHS=`echo $1 | sed 's/.*=//'`; shift ;; - --sysconfdir=*) echo "ignored option: --sysconfdir" | tee -a configure.log; shift ;; - --localstatedir=*) echo "ignored option: --localstatedir" | tee -a configure.log; shift ;; - -c* | --const) zconst=1; shift ;; - *) - echo "unknown option: $1" | tee -a configure.log - echo "$0 --help for help" | tee -a configure.log - leave 1;; - esac -done - -# temporary file name -test=ztest$$ - -# put arguments in log, also put test file in log if used in arguments -show() -{ - case "$*" in - *$test.c*) - echo === $test.c === >> configure.log - cat $test.c >> configure.log - echo === >> configure.log;; - esac - echo $* >> configure.log -} - -# check for gcc vs. cc and set compile and link flags based on the system identified by uname -cat > $test.c <&1` in - *gcc*) gcc=1 ;; -esac - -show $cc -c $test.c -if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then - echo ... using gcc >> configure.log - CC="$cc" - CFLAGS="${CFLAGS--O3} ${ARCHS}" - SFLAGS="${CFLAGS--O3} -fPIC" - LDFLAGS="${LDFLAGS} ${ARCHS}" - if test $build64 -eq 1; then - CFLAGS="${CFLAGS} -m64" - SFLAGS="${SFLAGS} -m64" - fi - if test "${ZLIBGCCWARN}" = "YES"; then - if test "$zconst" -eq 1; then - CFLAGS="${CFLAGS} -Wall -Wextra -Wcast-qual -pedantic -DZLIB_CONST" - else - CFLAGS="${CFLAGS} -Wall -Wextra -pedantic" - fi - fi - if test -z "$uname"; then - uname=`(uname -s || echo unknown) 2>/dev/null` - fi - case "$uname" in - Linux* | linux* | GNU | GNU/* | solaris*) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} ;; - *BSD | *bsd* | DragonFly) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1,--version-script,zlib.map"} - LDCONFIG="ldconfig -m" ;; - CYGWIN* | Cygwin* | cygwin* | OS/2*) - EXE='.exe' ;; - MINGW* | mingw*) -# temporary bypass - rm -f $test.[co] $test $test$shared_ext - echo "Please use win32/Makefile.gcc instead." | tee -a configure.log - leave 1 - LDSHARED=${LDSHARED-"$cc -shared"} - LDSHAREDLIBC="" - EXE='.exe' ;; - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 - # (alain.bonnefoy@icbt.com) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"} ;; - HP-UX*) - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl' ;; - esac ;; - Darwin* | darwin*) - shared_ext='.dylib' - SHAREDLIB=libz$shared_ext - SHAREDLIBV=libz.$VER$shared_ext - SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER3"} - if libtool -V 2>&1 | grep Apple > /dev/null; then - AR="libtool" - else - AR="/usr/bin/libtool" - fi - ARFLAGS="-o" ;; - *) LDSHARED=${LDSHARED-"$cc -shared"} ;; - esac -else - # find system name and corresponding cc options - CC=${CC-cc} - gcc=0 - echo ... using $CC >> configure.log - if test -z "$uname"; then - uname=`(uname -sr || echo unknown) 2>/dev/null` - fi - case "$uname" in - HP-UX*) SFLAGS=${CFLAGS-"-O +z"} - CFLAGS=${CFLAGS-"-O"} -# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} - LDSHARED=${LDSHARED-"ld -b"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so' ;; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl' ;; - esac ;; - IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} - CFLAGS=${CFLAGS-"-ansi -O2"} - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; - OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDFLAGS="${LDFLAGS} -Wl,-rpath,." - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"} ;; - OSF1*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so.1"} ;; - QNX*) SFLAGS=${CFLAGS-"-4 -O"} - CFLAGS=${CFLAGS-"-4 -O"} - LDSHARED=${LDSHARED-"cc"} - RANLIB=${RANLIB-"true"} - AR="cc" - ARFLAGS="-A" ;; - SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} - CFLAGS=${CFLAGS-"-O3"} - LDSHARED=${LDSHARED-"cc -dy -KPIC -G"} ;; - SunOS\ 5* | solaris*) - LDSHARED=${LDSHARED-"cc -G -h libz$shared_ext.$VER1"} - SFLAGS=${CFLAGS-"-fast -KPIC"} - CFLAGS=${CFLAGS-"-fast"} - if test $build64 -eq 1; then - # old versions of SunPRO/Workshop/Studio don't support -m64, - # but newer ones do. Check for it. - flag64=`$CC -flags | egrep -- '^-m64'` - if test x"$flag64" != x"" ; then - CFLAGS="${CFLAGS} -m64" - SFLAGS="${SFLAGS} -m64" - else - case `(uname -m || echo unknown) 2>/dev/null` in - i86*) - SFLAGS="$SFLAGS -xarch=amd64" - CFLAGS="$CFLAGS -xarch=amd64" ;; - *) - SFLAGS="$SFLAGS -xarch=v9" - CFLAGS="$CFLAGS -xarch=v9" ;; - esac - fi - fi - ;; - SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} - CFLAGS=${CFLAGS-"-O2"} - LDSHARED=${LDSHARED-"ld"} ;; - SunStudio\ 9*) SFLAGS=${CFLAGS-"-fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} - CFLAGS=${CFLAGS-"-fast -xtarget=ultra3 -xarch=v9b"} - LDSHARED=${LDSHARED-"cc -xarch=v9b"} ;; - UNIX_System_V\ 4.2.0) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"} ;; - UNIX_SV\ 4.2MP) - SFLAGS=${CFLAGS-"-Kconform_pic -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"} ;; - OpenUNIX\ 5) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"} ;; - AIX*) # Courtesy of dbakker@arrayasolutions.com - SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - LDSHARED=${LDSHARED-"xlc -G"} ;; - # send working options for other systems to zlib@gzip.org - *) SFLAGS=${CFLAGS-"-O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -shared"} ;; - esac -fi - -# destination names for shared library if not defined above -SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} -SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} -SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} - -echo >> configure.log - -# define functions for testing compiler and library characteristics and logging the results - -cat > $test.c </dev/null; then - try() - { - show $* - test "`( $* ) 2>&1 | tee -a configure.log`" = "" - } - echo - using any output from compiler to indicate an error >> configure.log -else -try() -{ - show $* - ( $* ) >> configure.log 2>&1 - ret=$? - if test $ret -ne 0; then - echo "(exit code "$ret")" >> configure.log - fi - return $ret -} -fi - -tryboth() -{ - show $* - got=`( $* ) 2>&1` - ret=$? - printf %s "$got" >> configure.log - if test $ret -ne 0; then - return $ret - fi - test "$got" = "" -} - -cat > $test.c << EOF -int foo() { return 0; } -EOF -echo "Checking for obsessive-compulsive compiler options..." >> configure.log -if try $CC -c $CFLAGS $test.c; then - : -else - echo "Compiler error reporting is too harsh for $0 (perhaps remove -Werror)." | tee -a configure.log - leave 1 -fi - -echo >> configure.log - -# see if shared library build supported -cat > $test.c <> configure.log - show "$NM $test.o | grep _hello" - if test "`$NM $test.o | grep _hello | tee -a configure.log`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. | tee -a configure.log - else - echo Checking for underline in external names... Yes. | tee -a configure.log - fi ;; -esac - -echo >> configure.log - -# check for large file support, and if none, check for fseeko() -cat > $test.c < -off64_t dummy = 0; -EOF -if try $CC -c $CFLAGS -D_LARGEFILE64_SOURCE=1 $test.c; then - CFLAGS="${CFLAGS} -D_LARGEFILE64_SOURCE=1" - SFLAGS="${SFLAGS} -D_LARGEFILE64_SOURCE=1" - ALL="${ALL} all64" - TEST="${TEST} test64" - echo "Checking for off64_t... Yes." | tee -a configure.log - echo "Checking for fseeko... Yes." | tee -a configure.log -else - echo "Checking for off64_t... No." | tee -a configure.log - echo >> configure.log - cat > $test.c < -int main(void) { - fseeko(NULL, 0, 0); - return 0; -} -EOF - if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for fseeko... Yes." | tee -a configure.log - else - CFLAGS="${CFLAGS} -DNO_FSEEKO" - SFLAGS="${SFLAGS} -DNO_FSEEKO" - echo "Checking for fseeko... No." | tee -a configure.log - fi -fi - -echo >> configure.log - -# check for strerror() for use by gz* functions -cat > $test.c < -#include -int main() { return strlen(strerror(errno)); } -EOF -if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for strerror... Yes." | tee -a configure.log -else - CFLAGS="${CFLAGS} -DNO_STRERROR" - SFLAGS="${SFLAGS} -DNO_STRERROR" - echo "Checking for strerror... No." | tee -a configure.log -fi - -# copy clean zconf.h for subsequent edits -cp -p zconf.h.in zconf.h - -echo >> configure.log - -# check for unistd.h and save result in zconf.h -cat > $test.c < -int main() { return 0; } -EOF -if try $CC -c $CFLAGS $test.c; then - sed < zconf.h "/^#ifdef HAVE_UNISTD_H.* may be/s/def HAVE_UNISTD_H\(.*\) may be/ 1\1 was/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo "Checking for unistd.h... Yes." | tee -a configure.log -else - echo "Checking for unistd.h... No." | tee -a configure.log -fi - -echo >> configure.log - -# check for stdarg.h and save result in zconf.h -cat > $test.c < -int main() { return 0; } -EOF -if try $CC -c $CFLAGS $test.c; then - sed < zconf.h "/^#ifdef HAVE_STDARG_H.* may be/s/def HAVE_STDARG_H\(.*\) may be/ 1\1 was/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo "Checking for stdarg.h... Yes." | tee -a configure.log -else - echo "Checking for stdarg.h... No." | tee -a configure.log -fi - -# if the z_ prefix was requested, save that in zconf.h -if test $zprefix -eq 1; then - sed < zconf.h "/#ifdef Z_PREFIX.* may be/s/def Z_PREFIX\(.*\) may be/ 1\1 was/" > zconf.temp.h - mv zconf.temp.h zconf.h - echo >> configure.log - echo "Using z_ prefix on all symbols." | tee -a configure.log -fi - -# if --solo compilation was requested, save that in zconf.h and remove gz stuff from object lists -if test $solo -eq 1; then - sed '/#define ZCONF_H/a\ -#define Z_SOLO - -' < zconf.h > zconf.temp.h - mv zconf.temp.h zconf.h -OBJC='$(OBJZ)' -PIC_OBJC='$(PIC_OBJZ)' -fi - -# if code coverage testing was requested, use older gcc if defined, e.g. "gcc-4.2" on Mac OS X -if test $cover -eq 1; then - CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage" - if test -n "$GCC_CLASSIC"; then - CC=$GCC_CLASSIC - fi -fi - -echo >> configure.log - -# conduct a series of tests to resolve eight possible cases of using "vs" or "s" printf functions -# (using stdarg or not), with or without "n" (proving size of buffer), and with or without a -# return value. The most secure result is vsnprintf() with a return value. snprintf() with a -# return value is secure as well, but then gzprintf() will be limited to 20 arguments. -cat > $test.c < -#include -#include "zconf.h" -int main() -{ -#ifndef STDC - choke me -#endif - return 0; -} -EOF -if try $CC -c $CFLAGS $test.c; then - echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()." | tee -a configure.log - - echo >> configure.log - cat > $test.c < -#include -int mytest(const char *fmt, ...) -{ - char buf[20]; - va_list ap; - va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return 0; -} -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for vsnprintf() in stdio.h... Yes." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -#include -int mytest(const char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - va_start(ap, fmt); - n = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return n; -} -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of vsnprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_vsnprintf_void" - SFLAGS="$SFLAGS -DHAS_vsnprintf_void" - echo "Checking for return value of vsnprintf()... No." | tee -a configure.log - echo " WARNING: apparently vsnprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - else - CFLAGS="$CFLAGS -DNO_vsnprintf" - SFLAGS="$SFLAGS -DNO_vsnprintf" - echo "Checking for vsnprintf() in stdio.h... No." | tee -a configure.log - echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" | tee -a configure.log - echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -#include -int mytest(const char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - va_start(ap, fmt); - n = vsprintf(buf, fmt, ap); - va_end(ap); - return n; -} -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of vsprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_vsprintf_void" - SFLAGS="$SFLAGS -DHAS_vsprintf_void" - echo "Checking for return value of vsprintf()... No." | tee -a configure.log - echo " WARNING: apparently vsprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - fi -else - echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -int mytest() -{ - char buf[20]; - snprintf(buf, sizeof(buf), "%s", "foo"); - return 0; -} -int main() -{ - return (mytest()); -} -EOF - - if try $CC $CFLAGS -o $test $test.c; then - echo "Checking for snprintf() in stdio.h... Yes." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -int mytest() -{ - char buf[20]; - return snprintf(buf, sizeof(buf), "%s", "foo"); -} -int main() -{ - return (mytest()); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of snprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_snprintf_void" - SFLAGS="$SFLAGS -DHAS_snprintf_void" - echo "Checking for return value of snprintf()... No." | tee -a configure.log - echo " WARNING: apparently snprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - else - CFLAGS="$CFLAGS -DNO_snprintf" - SFLAGS="$SFLAGS -DNO_snprintf" - echo "Checking for snprintf() in stdio.h... No." | tee -a configure.log - echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" | tee -a configure.log - echo " can build but will be open to possible buffer-overflow security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - - echo >> configure.log - cat >$test.c < -int mytest() -{ - char buf[20]; - return sprintf(buf, "%s", "foo"); -} -int main() -{ - return (mytest()); -} -EOF - - if try $CC -c $CFLAGS $test.c; then - echo "Checking for return value of sprintf()... Yes." | tee -a configure.log - else - CFLAGS="$CFLAGS -DHAS_sprintf_void" - SFLAGS="$SFLAGS -DHAS_sprintf_void" - echo "Checking for return value of sprintf()... No." | tee -a configure.log - echo " WARNING: apparently sprintf() does not return a value. zlib" | tee -a configure.log - echo " can build but will be open to possible string-format security" | tee -a configure.log - echo " vulnerabilities." | tee -a configure.log - fi - fi -fi - -# see if we can hide zlib internal symbols that are linked between separate source files -if test "$gcc" -eq 1; then - echo >> configure.log - cat > $test.c <> configure.log -echo ALL = $ALL >> configure.log -echo AR = $AR >> configure.log -echo ARFLAGS = $ARFLAGS >> configure.log -echo CC = $CC >> configure.log -echo CFLAGS = $CFLAGS >> configure.log -echo CPP = $CPP >> configure.log -echo EXE = $EXE >> configure.log -echo LDCONFIG = $LDCONFIG >> configure.log -echo LDFLAGS = $LDFLAGS >> configure.log -echo LDSHARED = $LDSHARED >> configure.log -echo LDSHAREDLIBC = $LDSHAREDLIBC >> configure.log -echo OBJC = $OBJC >> configure.log -echo PIC_OBJC = $PIC_OBJC >> configure.log -echo RANLIB = $RANLIB >> configure.log -echo SFLAGS = $SFLAGS >> configure.log -echo SHAREDLIB = $SHAREDLIB >> configure.log -echo SHAREDLIBM = $SHAREDLIBM >> configure.log -echo SHAREDLIBV = $SHAREDLIBV >> configure.log -echo STATICLIB = $STATICLIB >> configure.log -echo TEST = $TEST >> configure.log -echo VER = $VER >> configure.log -echo Z_U4 = $Z_U4 >> configure.log -echo exec_prefix = $exec_prefix >> configure.log -echo includedir = $includedir >> configure.log -echo libdir = $libdir >> configure.log -echo mandir = $mandir >> configure.log -echo prefix = $prefix >> configure.log -echo sharedlibdir = $sharedlibdir >> configure.log -echo uname = $uname >> configure.log - -# udpate Makefile with the configure results -sed < Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^SFLAGS *=/s#=.*#=$SFLAGS# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^CPP *=/s#=.*#=$CPP# -/^STATICLIB *=/s#=.*#=$STATICLIB# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^AR *=/s#=.*#=$AR# -/^ARFLAGS *=/s#=.*#=$ARFLAGS# -/^RANLIB *=/s#=.*#=$RANLIB# -/^LDCONFIG *=/s#=.*#=$LDCONFIG# -/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^libdir *=/s#=.*#=$libdir# -/^sharedlibdir *=/s#=.*#=$sharedlibdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^OBJC *=/s#=.*#= $OBJC# -/^PIC_OBJC *=/s#=.*#= $PIC_OBJC# -/^all: */s#:.*#: $ALL# -/^test: */s#:.*#: $TEST# -" > Makefile - -# create zlib.pc with the configure results -sed < zlib.pc.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^CPP *=/s#=.*#=$CPP# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^STATICLIB *=/s#=.*#=$STATICLIB# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^AR *=/s#=.*#=$AR# -/^ARFLAGS *=/s#=.*#=$ARFLAGS# -/^RANLIB *=/s#=.*#=$RANLIB# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^libdir *=/s#=.*#=$libdir# -/^sharedlibdir *=/s#=.*#=$sharedlibdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -" | sed -e " -s/\@VERSION\@/$VER/g; -" > zlib.pc - -# done -leave 0 diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.c deleted file mode 100644 index 95a30f1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.c +++ /dev/null @@ -1,425 +0,0 @@ -/* crc32.c -- compute the CRC-32 of a data stream - * Copyright (C) 1995-2006, 2010, 2011, 2012 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Thanks to Rodney Brown for his contribution of faster - * CRC methods: exclusive-oring 32 bits of data at a time, and pre-computing - * tables for updating the shift register in one step with three exclusive-ors - * instead of four steps with four exclusive-ors. This results in about a - * factor of two increase in speed on a Power PC G4 (PPC7455) using gcc -O3. - */ - -/* @(#) $Id$ */ - -/* - Note on the use of DYNAMIC_CRC_TABLE: there is no mutex or semaphore - protection on the static variables used to control the first-use generation - of the crc tables. Therefore, if you #define DYNAMIC_CRC_TABLE, you should - first call get_crc_table() to initialize the tables before allowing more than - one thread to use crc32(). - - DYNAMIC_CRC_TABLE and MAKECRCH can be #defined to write out crc32.h. - */ - -#ifdef MAKECRCH -# include -# ifndef DYNAMIC_CRC_TABLE -# define DYNAMIC_CRC_TABLE -# endif /* !DYNAMIC_CRC_TABLE */ -#endif /* MAKECRCH */ - -#include "zutil.h" /* for STDC and FAR definitions */ - -#define local static - -/* Definitions for doing the crc four data bytes at a time. */ -#if !defined(NOBYFOUR) && defined(Z_U4) -# define BYFOUR -#endif -#ifdef BYFOUR - local unsigned long crc32_little OF((unsigned long, - const unsigned char FAR *, unsigned)); - local unsigned long crc32_big OF((unsigned long, - const unsigned char FAR *, unsigned)); -# define TBLS 8 -#else -# define TBLS 1 -#endif /* BYFOUR */ - -/* Local functions for crc concatenation */ -local unsigned long gf2_matrix_times OF((unsigned long *mat, - unsigned long vec)); -local void gf2_matrix_square OF((unsigned long *square, unsigned long *mat)); -local uLong crc32_combine_ OF((uLong crc1, uLong crc2, z_off64_t len2)); - - -#ifdef DYNAMIC_CRC_TABLE - -local volatile int crc_table_empty = 1; -local z_crc_t FAR crc_table[TBLS][256]; -local void make_crc_table OF((void)); -#ifdef MAKECRCH - local void write_table OF((FILE *, const z_crc_t FAR *)); -#endif /* MAKECRCH */ -/* - Generate tables for a byte-wise 32-bit CRC calculation on the polynomial: - x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. - - Polynomials over GF(2) are represented in binary, one bit per coefficient, - with the lowest powers in the most significant bit. Then adding polynomials - is just exclusive-or, and multiplying a polynomial by x is a right shift by - one. If we call the above polynomial p, and represent a byte as the - polynomial q, also with the lowest power in the most significant bit (so the - byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, - where a mod b means the remainder after dividing a by b. - - This calculation is done using the shift-register method of multiplying and - taking the remainder. The register is initialized to zero, and for each - incoming bit, x^32 is added mod p to the register if the bit is a one (where - x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by - x (which is shifting right by one and adding x^32 mod p if the bit shifted - out is a one). We start with the highest power (least significant bit) of - q and repeat for all eight bits of q. - - The first table is simply the CRC of all possible eight bit values. This is - all the information needed to generate CRCs on data a byte at a time for all - combinations of CRC register values and incoming bytes. The remaining tables - allow for word-at-a-time CRC calculation for both big-endian and little- - endian machines, where a word is four bytes. -*/ -local void make_crc_table() -{ - z_crc_t c; - int n, k; - z_crc_t poly; /* polynomial exclusive-or pattern */ - /* terms of polynomial defining this crc (except x^32): */ - static volatile int first = 1; /* flag to limit concurrent making */ - static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; - - /* See if another task is already doing this (not thread-safe, but better - than nothing -- significantly reduces duration of vulnerability in - case the advice about DYNAMIC_CRC_TABLE is ignored) */ - if (first) { - first = 0; - - /* make exclusive-or pattern from polynomial (0xedb88320UL) */ - poly = 0; - for (n = 0; n < (int)(sizeof(p)/sizeof(unsigned char)); n++) - poly |= (z_crc_t)1 << (31 - p[n]); - - /* generate a crc for every 8-bit value */ - for (n = 0; n < 256; n++) { - c = (z_crc_t)n; - for (k = 0; k < 8; k++) - c = c & 1 ? poly ^ (c >> 1) : c >> 1; - crc_table[0][n] = c; - } - -#ifdef BYFOUR - /* generate crc for each value followed by one, two, and three zeros, - and then the byte reversal of those as well as the first table */ - for (n = 0; n < 256; n++) { - c = crc_table[0][n]; - crc_table[4][n] = ZSWAP32(c); - for (k = 1; k < 4; k++) { - c = crc_table[0][c & 0xff] ^ (c >> 8); - crc_table[k][n] = c; - crc_table[k + 4][n] = ZSWAP32(c); - } - } -#endif /* BYFOUR */ - - crc_table_empty = 0; - } - else { /* not first */ - /* wait for the other guy to finish (not efficient, but rare) */ - while (crc_table_empty) - ; - } - -#ifdef MAKECRCH - /* write out CRC tables to crc32.h */ - { - FILE *out; - - out = fopen("crc32.h", "w"); - if (out == NULL) return; - fprintf(out, "/* crc32.h -- tables for rapid CRC calculation\n"); - fprintf(out, " * Generated automatically by crc32.c\n */\n\n"); - fprintf(out, "local const z_crc_t FAR "); - fprintf(out, "crc_table[TBLS][256] =\n{\n {\n"); - write_table(out, crc_table[0]); -# ifdef BYFOUR - fprintf(out, "#ifdef BYFOUR\n"); - for (k = 1; k < 8; k++) { - fprintf(out, " },\n {\n"); - write_table(out, crc_table[k]); - } - fprintf(out, "#endif\n"); -# endif /* BYFOUR */ - fprintf(out, " }\n};\n"); - fclose(out); - } -#endif /* MAKECRCH */ -} - -#ifdef MAKECRCH -local void write_table(out, table) - FILE *out; - const z_crc_t FAR *table; -{ - int n; - - for (n = 0; n < 256; n++) - fprintf(out, "%s0x%08lxUL%s", n % 5 ? "" : " ", - (unsigned long)(table[n]), - n == 255 ? "\n" : (n % 5 == 4 ? ",\n" : ", ")); -} -#endif /* MAKECRCH */ - -#else /* !DYNAMIC_CRC_TABLE */ -/* ======================================================================== - * Tables of CRC-32s of all single-byte values, made by make_crc_table(). - */ -#include "crc32.h" -#endif /* DYNAMIC_CRC_TABLE */ - -/* ========================================================================= - * This function can be used by asm versions of crc32() - */ -const z_crc_t FAR * ZEXPORT get_crc_table() -{ -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - return (const z_crc_t FAR *)crc_table; -} - -/* ========================================================================= */ -#define DO1 crc = crc_table[0][((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8) -#define DO8 DO1; DO1; DO1; DO1; DO1; DO1; DO1; DO1 - -/* ========================================================================= */ -unsigned long ZEXPORT crc32(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - uInt len; -{ - if (buf == Z_NULL) return 0UL; - -#ifdef DYNAMIC_CRC_TABLE - if (crc_table_empty) - make_crc_table(); -#endif /* DYNAMIC_CRC_TABLE */ - -#ifdef BYFOUR - if (sizeof(void *) == sizeof(ptrdiff_t)) { - z_crc_t endian; - - endian = 1; - if (*((unsigned char *)(&endian))) - return crc32_little(crc, buf, len); - else - return crc32_big(crc, buf, len); - } -#endif /* BYFOUR */ - crc = crc ^ 0xffffffffUL; - while (len >= 8) { - DO8; - len -= 8; - } - if (len) do { - DO1; - } while (--len); - return crc ^ 0xffffffffUL; -} - -#ifdef BYFOUR - -/* ========================================================================= */ -#define DOLIT4 c ^= *buf4++; \ - c = crc_table[3][c & 0xff] ^ crc_table[2][(c >> 8) & 0xff] ^ \ - crc_table[1][(c >> 16) & 0xff] ^ crc_table[0][c >> 24] -#define DOLIT32 DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4; DOLIT4 - -/* ========================================================================= */ -local unsigned long crc32_little(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = (z_crc_t)crc; - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - len--; - } - - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - while (len >= 32) { - DOLIT32; - len -= 32; - } - while (len >= 4) { - DOLIT4; - len -= 4; - } - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[0][(c ^ *buf++) & 0xff] ^ (c >> 8); - } while (--len); - c = ~c; - return (unsigned long)c; -} - -/* ========================================================================= */ -#define DOBIG4 c ^= *++buf4; \ - c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \ - crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24] -#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4 - -/* ========================================================================= */ -local unsigned long crc32_big(crc, buf, len) - unsigned long crc; - const unsigned char FAR *buf; - unsigned len; -{ - register z_crc_t c; - register const z_crc_t FAR *buf4; - - c = ZSWAP32((z_crc_t)crc); - c = ~c; - while (len && ((ptrdiff_t)buf & 3)) { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - len--; - } - - buf4 = (const z_crc_t FAR *)(const void FAR *)buf; - buf4--; - while (len >= 32) { - DOBIG32; - len -= 32; - } - while (len >= 4) { - DOBIG4; - len -= 4; - } - buf4++; - buf = (const unsigned char FAR *)buf4; - - if (len) do { - c = crc_table[4][(c >> 24) ^ *buf++] ^ (c << 8); - } while (--len); - c = ~c; - return (unsigned long)(ZSWAP32(c)); -} - -#endif /* BYFOUR */ - -#define GF2_DIM 32 /* dimension of GF(2) vectors (length of CRC) */ - -/* ========================================================================= */ -local unsigned long gf2_matrix_times(mat, vec) - unsigned long *mat; - unsigned long vec; -{ - unsigned long sum; - - sum = 0; - while (vec) { - if (vec & 1) - sum ^= *mat; - vec >>= 1; - mat++; - } - return sum; -} - -/* ========================================================================= */ -local void gf2_matrix_square(square, mat) - unsigned long *square; - unsigned long *mat; -{ - int n; - - for (n = 0; n < GF2_DIM; n++) - square[n] = gf2_matrix_times(mat, mat[n]); -} - -/* ========================================================================= */ -local uLong crc32_combine_(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - int n; - unsigned long row; - unsigned long even[GF2_DIM]; /* even-power-of-two zeros operator */ - unsigned long odd[GF2_DIM]; /* odd-power-of-two zeros operator */ - - /* degenerate case (also disallow negative lengths) */ - if (len2 <= 0) - return crc1; - - /* put operator for one zero bit in odd */ - odd[0] = 0xedb88320UL; /* CRC-32 polynomial */ - row = 1; - for (n = 1; n < GF2_DIM; n++) { - odd[n] = row; - row <<= 1; - } - - /* put operator for two zero bits in even */ - gf2_matrix_square(even, odd); - - /* put operator for four zero bits in odd */ - gf2_matrix_square(odd, even); - - /* apply len2 zeros to crc1 (first square will put the operator for one - zero byte, eight zero bits, in even) */ - do { - /* apply zeros operator for this bit of len2 */ - gf2_matrix_square(even, odd); - if (len2 & 1) - crc1 = gf2_matrix_times(even, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - if (len2 == 0) - break; - - /* another iteration of the loop with odd and even swapped */ - gf2_matrix_square(odd, even); - if (len2 & 1) - crc1 = gf2_matrix_times(odd, crc1); - len2 >>= 1; - - /* if no more bits set, then done */ - } while (len2 != 0); - - /* return combined crc */ - crc1 ^= crc2; - return crc1; -} - -/* ========================================================================= */ -uLong ZEXPORT crc32_combine(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} - -uLong ZEXPORT crc32_combine64(crc1, crc2, len2) - uLong crc1; - uLong crc2; - z_off64_t len2; -{ - return crc32_combine_(crc1, crc2, len2); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.h deleted file mode 100644 index b7e25cf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/crc32.h +++ /dev/null @@ -1,441 +0,0 @@ -/* crc32.h -- tables for rapid CRC calculation - * Generated automatically by crc32.c - */ - -local const z_crc_t FAR crc_table[TBLS][256] = -{ - { - 0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL, - 0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL, - 0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL, - 0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL, - 0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL, - 0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL, - 0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL, - 0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL, - 0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL, - 0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL, - 0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL, - 0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL, - 0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL, - 0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL, - 0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL, - 0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL, - 0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL, - 0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL, - 0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL, - 0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL, - 0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL, - 0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL, - 0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL, - 0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL, - 0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL, - 0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL, - 0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL, - 0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL, - 0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL, - 0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL, - 0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL, - 0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL, - 0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL, - 0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL, - 0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL, - 0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL, - 0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL, - 0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL, - 0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL, - 0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL, - 0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL, - 0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL, - 0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL, - 0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL, - 0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL, - 0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL, - 0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL, - 0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL, - 0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL, - 0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL, - 0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL, - 0x2d02ef8dUL -#ifdef BYFOUR - }, - { - 0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL, - 0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL, - 0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL, - 0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL, - 0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL, - 0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL, - 0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL, - 0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL, - 0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL, - 0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL, - 0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL, - 0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL, - 0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL, - 0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL, - 0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL, - 0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL, - 0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL, - 0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL, - 0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL, - 0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL, - 0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL, - 0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL, - 0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL, - 0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL, - 0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL, - 0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL, - 0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL, - 0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL, - 0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL, - 0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL, - 0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL, - 0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL, - 0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL, - 0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL, - 0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL, - 0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL, - 0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL, - 0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL, - 0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL, - 0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL, - 0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL, - 0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL, - 0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL, - 0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL, - 0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL, - 0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL, - 0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL, - 0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL, - 0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL, - 0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL, - 0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL, - 0x9324fd72UL - }, - { - 0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL, - 0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL, - 0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL, - 0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL, - 0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL, - 0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL, - 0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL, - 0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL, - 0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL, - 0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL, - 0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL, - 0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL, - 0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL, - 0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL, - 0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL, - 0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL, - 0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL, - 0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL, - 0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL, - 0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL, - 0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL, - 0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL, - 0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL, - 0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL, - 0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL, - 0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL, - 0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL, - 0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL, - 0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL, - 0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL, - 0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL, - 0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL, - 0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL, - 0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL, - 0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL, - 0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL, - 0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL, - 0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL, - 0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL, - 0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL, - 0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL, - 0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL, - 0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL, - 0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL, - 0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL, - 0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL, - 0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL, - 0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL, - 0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL, - 0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL, - 0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL, - 0xbe9834edUL - }, - { - 0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL, - 0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL, - 0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL, - 0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL, - 0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL, - 0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL, - 0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL, - 0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL, - 0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL, - 0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL, - 0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL, - 0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL, - 0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL, - 0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL, - 0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL, - 0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL, - 0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL, - 0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL, - 0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL, - 0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL, - 0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL, - 0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL, - 0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL, - 0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL, - 0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL, - 0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL, - 0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL, - 0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL, - 0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL, - 0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL, - 0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL, - 0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL, - 0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL, - 0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL, - 0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL, - 0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL, - 0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL, - 0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL, - 0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL, - 0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL, - 0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL, - 0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL, - 0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL, - 0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL, - 0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL, - 0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL, - 0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL, - 0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL, - 0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL, - 0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL, - 0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL, - 0xde0506f1UL - }, - { - 0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL, - 0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL, - 0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL, - 0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL, - 0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL, - 0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL, - 0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL, - 0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL, - 0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL, - 0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL, - 0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL, - 0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL, - 0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL, - 0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL, - 0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL, - 0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL, - 0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL, - 0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL, - 0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL, - 0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL, - 0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL, - 0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL, - 0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL, - 0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL, - 0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL, - 0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL, - 0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL, - 0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL, - 0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL, - 0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL, - 0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL, - 0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL, - 0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL, - 0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL, - 0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL, - 0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL, - 0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL, - 0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL, - 0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL, - 0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL, - 0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL, - 0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL, - 0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL, - 0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL, - 0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL, - 0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL, - 0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL, - 0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL, - 0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL, - 0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL, - 0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL, - 0x8def022dUL - }, - { - 0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL, - 0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL, - 0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL, - 0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL, - 0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL, - 0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL, - 0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL, - 0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL, - 0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL, - 0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL, - 0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL, - 0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL, - 0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL, - 0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL, - 0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL, - 0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL, - 0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL, - 0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL, - 0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL, - 0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL, - 0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL, - 0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL, - 0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL, - 0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL, - 0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL, - 0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL, - 0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL, - 0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL, - 0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL, - 0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL, - 0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL, - 0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL, - 0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL, - 0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL, - 0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL, - 0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL, - 0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL, - 0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL, - 0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL, - 0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL, - 0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL, - 0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL, - 0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL, - 0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL, - 0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL, - 0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL, - 0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL, - 0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL, - 0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL, - 0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL, - 0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL, - 0x72fd2493UL - }, - { - 0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL, - 0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL, - 0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL, - 0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL, - 0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL, - 0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL, - 0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL, - 0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL, - 0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL, - 0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL, - 0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL, - 0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL, - 0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL, - 0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL, - 0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL, - 0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL, - 0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL, - 0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL, - 0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL, - 0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL, - 0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL, - 0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL, - 0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL, - 0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL, - 0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL, - 0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL, - 0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL, - 0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL, - 0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL, - 0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL, - 0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL, - 0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL, - 0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL, - 0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL, - 0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL, - 0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL, - 0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL, - 0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL, - 0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL, - 0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL, - 0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL, - 0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL, - 0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL, - 0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL, - 0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL, - 0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL, - 0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL, - 0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL, - 0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL, - 0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL, - 0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL, - 0xed3498beUL - }, - { - 0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL, - 0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL, - 0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL, - 0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL, - 0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL, - 0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL, - 0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL, - 0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL, - 0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL, - 0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL, - 0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL, - 0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL, - 0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL, - 0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL, - 0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL, - 0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL, - 0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL, - 0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL, - 0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL, - 0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL, - 0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL, - 0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL, - 0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL, - 0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL, - 0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL, - 0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL, - 0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL, - 0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL, - 0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL, - 0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL, - 0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL, - 0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL, - 0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL, - 0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL, - 0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL, - 0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL, - 0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL, - 0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL, - 0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL, - 0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL, - 0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL, - 0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL, - 0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL, - 0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL, - 0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL, - 0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL, - 0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL, - 0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL, - 0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL, - 0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL, - 0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL, - 0xf10605deUL -#endif - } -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.c deleted file mode 100644 index 89b47f1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.c +++ /dev/null @@ -1,1967 +0,0 @@ -/* deflate.c -- compress data using the deflation algorithm - * Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process depends on being able to identify portions - * of the input text which are identical to earlier input (within a - * sliding window trailing behind the input currently being processed). - * - * The most straightforward technique turns out to be the fastest for - * most input files: try all possible matches and select the longest. - * The key feature of this algorithm is that insertions into the string - * dictionary are very simple and thus fast, and deletions are avoided - * completely. Insertions are performed at each input character, whereas - * string matches are performed only when the previous match ends. So it - * is preferable to spend more time in matches to allow very fast string - * insertions and avoid deletions. The matching algorithm for small - * strings is inspired from that of Rabin & Karp. A brute force approach - * is used to find longer strings when a small match has been found. - * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze - * (by Leonid Broukhis). - * A previous version of this file used a more sophisticated algorithm - * (by Fiala and Greene) which is guaranteed to run in linear amortized - * time, but has a larger average cost, uses more memory and is patented. - * However the F&G algorithm may be faster for some highly redundant - * files if the parameter max_chain_length (described below) is too large. - * - * ACKNOWLEDGEMENTS - * - * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and - * I found it in 'freeze' written by Leonid Broukhis. - * Thanks to many people for bug reports and testing. - * - * REFERENCES - * - * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". - * Available in http://tools.ietf.org/html/rfc1951 - * - * A description of the Rabin and Karp algorithm is given in the book - * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. - * - * Fiala,E.R., and Greene,D.H. - * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 - * - */ - -/* @(#) $Id$ */ - -#include "deflate.h" - -const char deflate_copyright[] = - " deflate 1.2.8 Copyright 1995-2013 Jean-loup Gailly and Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* =========================================================================== - * Function prototypes. - */ -typedef enum { - need_more, /* block not completed, need more input or more output */ - block_done, /* block flush performed */ - finish_started, /* finish started, need only more output at next deflate */ - finish_done /* finish done, accept no more input or output */ -} block_state; - -typedef block_state (*compress_func) OF((deflate_state *s, int flush)); -/* Compression function. Returns the block state after the call. */ - -local void fill_window OF((deflate_state *s)); -local block_state deflate_stored OF((deflate_state *s, int flush)); -local block_state deflate_fast OF((deflate_state *s, int flush)); -#ifndef FASTEST -local block_state deflate_slow OF((deflate_state *s, int flush)); -#endif -local block_state deflate_rle OF((deflate_state *s, int flush)); -local block_state deflate_huff OF((deflate_state *s, int flush)); -local void lm_init OF((deflate_state *s)); -local void putShortMSB OF((deflate_state *s, uInt b)); -local void flush_pending OF((z_streamp strm)); -local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); -#ifdef ASMV - void match_init OF((void)); /* asm code initialization */ - uInt longest_match OF((deflate_state *s, IPos cur_match)); -#else -local uInt longest_match OF((deflate_state *s, IPos cur_match)); -#endif - -#ifdef DEBUG -local void check_match OF((deflate_state *s, IPos start, IPos match, - int length)); -#endif - -/* =========================================================================== - * Local data - */ - -#define NIL 0 -/* Tail of hash chains */ - -#ifndef TOO_FAR -# define TOO_FAR 4096 -#endif -/* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ - -/* Values for max_lazy_match, good_match and max_chain_length, depending on - * the desired pack level (0..9). The values given below have been tuned to - * exclude worst case performance for pathological files. Better values may be - * found for specific files. - */ -typedef struct config_s { - ush good_length; /* reduce lazy search above this match length */ - ush max_lazy; /* do not perform lazy search above this match length */ - ush nice_length; /* quit search above this match length */ - ush max_chain; - compress_func func; -} config; - -#ifdef FASTEST -local const config configuration_table[2] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}}; /* max speed, no lazy matches */ -#else -local const config configuration_table[10] = { -/* good lazy nice chain */ -/* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ -/* 1 */ {4, 4, 8, 4, deflate_fast}, /* max speed, no lazy matches */ -/* 2 */ {4, 5, 16, 8, deflate_fast}, -/* 3 */ {4, 6, 32, 32, deflate_fast}, - -/* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ -/* 5 */ {8, 16, 32, 32, deflate_slow}, -/* 6 */ {8, 16, 128, 128, deflate_slow}, -/* 7 */ {8, 32, 128, 256, deflate_slow}, -/* 8 */ {32, 128, 258, 1024, deflate_slow}, -/* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* max compression */ -#endif - -/* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 - * For deflate_fast() (levels <= 3) good is ignored and lazy has a different - * meaning. - */ - -#define EQUAL 0 -/* result of memcmp for equal strings */ - -#ifndef NO_DUMMY_DECL -struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ -#endif - -/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */ -#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0)) - -/* =========================================================================== - * Update a hash value with the given input byte - * IN assertion: all calls to to UPDATE_HASH are made with consecutive - * input characters, so that a running hash key can be computed from the - * previous key instead of complete recalculation each time. - */ -#define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) - - -/* =========================================================================== - * Insert string str in the dictionary and set match_head to the previous head - * of the hash chain (the most recent string with same hash key). Return - * the previous length of the hash chain. - * If this file is compiled with -DFASTEST, the compression level is forced - * to 1, and no hash chains are maintained. - * IN assertion: all calls to to INSERT_STRING are made with consecutive - * input characters and the first MIN_MATCH bytes of str are valid - * (except for the last MIN_MATCH-1 bytes of the input file). - */ -#ifdef FASTEST -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#else -#define INSERT_STRING(s, str, match_head) \ - (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ - match_head = s->prev[(str) & s->w_mask] = s->head[s->ins_h], \ - s->head[s->ins_h] = (Pos)(str)) -#endif - -/* =========================================================================== - * Initialize the hash table (avoiding 64K overflow for 16 bit systems). - * prev[] will be initialized on the fly. - */ -#define CLEAR_HASH(s) \ - s->head[s->hash_size-1] = NIL; \ - zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); - -/* ========================================================================= */ -int ZEXPORT deflateInit_(strm, level, version, stream_size) - z_streamp strm; - int level; - const char *version; - int stream_size; -{ - return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, - Z_DEFAULT_STRATEGY, version, stream_size); - /* To do: ignore strm->next_in if we use it as window */ -} - -/* ========================================================================= */ -int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - version, stream_size) - z_streamp strm; - int level; - int method; - int windowBits; - int memLevel; - int strategy; - const char *version; - int stream_size; -{ - deflate_state *s; - int wrap = 1; - static const char my_version[] = ZLIB_VERSION; - - ushf *overlay; - /* We overlay pending_buf and d_buf+l_buf. This works since the average - * output size for (length,distance) codes is <= 24 bits. - */ - - if (version == Z_NULL || version[0] != my_version[0] || - stream_size != sizeof(z_stream)) { - return Z_VERSION_ERROR; - } - if (strm == Z_NULL) return Z_STREAM_ERROR; - - strm->msg = Z_NULL; - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - - if (windowBits < 0) { /* suppress zlib wrapper */ - wrap = 0; - windowBits = -windowBits; - } -#ifdef GZIP - else if (windowBits > 15) { - wrap = 2; /* write gzip wrapper instead */ - windowBits -= 16; - } -#endif - if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || - windowBits < 8 || windowBits > 15 || level < 0 || level > 9 || - strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ - s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); - if (s == Z_NULL) return Z_MEM_ERROR; - strm->state = (struct internal_state FAR *)s; - s->strm = strm; - - s->wrap = wrap; - s->gzhead = Z_NULL; - s->w_bits = windowBits; - s->w_size = 1 << s->w_bits; - s->w_mask = s->w_size - 1; - - s->hash_bits = memLevel + 7; - s->hash_size = 1 << s->hash_bits; - s->hash_mask = s->hash_size - 1; - s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); - - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); - s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); - - s->high_water = 0; /* nothing written to s->window yet */ - - s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ - - overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); - s->pending_buf = (uchf *) overlay; - s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); - - if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || - s->pending_buf == Z_NULL) { - s->status = FINISH_STATE; - strm->msg = ERR_MSG(Z_MEM_ERROR); - deflateEnd (strm); - return Z_MEM_ERROR; - } - s->d_buf = overlay + s->lit_bufsize/sizeof(ush); - s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; - - s->level = level; - s->strategy = strategy; - s->method = (Byte)method; - - return deflateReset(strm); -} - -/* ========================================================================= */ -int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) - z_streamp strm; - const Bytef *dictionary; - uInt dictLength; -{ - deflate_state *s; - uInt str, n; - int wrap; - unsigned avail; - z_const unsigned char *next; - - if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL) - return Z_STREAM_ERROR; - s = strm->state; - wrap = s->wrap; - if (wrap == 2 || (wrap == 1 && s->status != INIT_STATE) || s->lookahead) - return Z_STREAM_ERROR; - - /* when using zlib wrappers, compute Adler-32 for provided dictionary */ - if (wrap == 1) - strm->adler = adler32(strm->adler, dictionary, dictLength); - s->wrap = 0; /* avoid computing Adler-32 in read_buf */ - - /* if dictionary would fill window, just replace the history */ - if (dictLength >= s->w_size) { - if (wrap == 0) { /* already empty otherwise */ - CLEAR_HASH(s); - s->strstart = 0; - s->block_start = 0L; - s->insert = 0; - } - dictionary += dictLength - s->w_size; /* use the tail */ - dictLength = s->w_size; - } - - /* insert dictionary into window and hash */ - avail = strm->avail_in; - next = strm->next_in; - strm->avail_in = dictLength; - strm->next_in = (z_const Bytef *)dictionary; - fill_window(s); - while (s->lookahead >= MIN_MATCH) { - str = s->strstart; - n = s->lookahead - (MIN_MATCH-1); - do { - UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); -#ifndef FASTEST - s->prev[str & s->w_mask] = s->head[s->ins_h]; -#endif - s->head[s->ins_h] = (Pos)str; - str++; - } while (--n); - s->strstart = str; - s->lookahead = MIN_MATCH-1; - fill_window(s); - } - s->strstart += s->lookahead; - s->block_start = (long)s->strstart; - s->insert = s->lookahead; - s->lookahead = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - strm->next_in = next; - strm->avail_in = avail; - s->wrap = wrap; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateResetKeep (strm) - z_streamp strm; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) { - return Z_STREAM_ERROR; - } - - strm->total_in = strm->total_out = 0; - strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ - strm->data_type = Z_UNKNOWN; - - s = (deflate_state *)strm->state; - s->pending = 0; - s->pending_out = s->pending_buf; - - if (s->wrap < 0) { - s->wrap = -s->wrap; /* was made negative by deflate(..., Z_FINISH); */ - } - s->status = s->wrap ? INIT_STATE : BUSY_STATE; - strm->adler = -#ifdef GZIP - s->wrap == 2 ? crc32(0L, Z_NULL, 0) : -#endif - adler32(0L, Z_NULL, 0); - s->last_flush = Z_NO_FLUSH; - - _tr_init(s); - - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateReset (strm) - z_streamp strm; -{ - int ret; - - ret = deflateResetKeep(strm); - if (ret == Z_OK) - lm_init(strm->state); - return ret; -} - -/* ========================================================================= */ -int ZEXPORT deflateSetHeader (strm, head) - z_streamp strm; - gz_headerp head; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (strm->state->wrap != 2) return Z_STREAM_ERROR; - strm->state->gzhead = head; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePending (strm, pending, bits) - unsigned *pending; - int *bits; - z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - if (pending != Z_NULL) - *pending = strm->state->pending; - if (bits != Z_NULL) - *bits = strm->state->bi_valid; - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflatePrime (strm, bits, value) - z_streamp strm; - int bits; - int value; -{ - deflate_state *s; - int put; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - if ((Bytef *)(s->d_buf) < s->pending_out + ((Buf_size + 7) >> 3)) - return Z_BUF_ERROR; - do { - put = Buf_size - s->bi_valid; - if (put > bits) - put = bits; - s->bi_buf |= (ush)((value & ((1 << put) - 1)) << s->bi_valid); - s->bi_valid += put; - _tr_flush_bits(s); - value >>= put; - bits -= put; - } while (bits); - return Z_OK; -} - -/* ========================================================================= */ -int ZEXPORT deflateParams(strm, level, strategy) - z_streamp strm; - int level; - int strategy; -{ - deflate_state *s; - compress_func func; - int err = Z_OK; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - -#ifdef FASTEST - if (level != 0) level = 1; -#else - if (level == Z_DEFAULT_COMPRESSION) level = 6; -#endif - if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { - return Z_STREAM_ERROR; - } - func = configuration_table[s->level].func; - - if ((strategy != s->strategy || func != configuration_table[level].func) && - strm->total_in != 0) { - /* Flush the last buffer: */ - err = deflate(strm, Z_BLOCK); - if (err == Z_BUF_ERROR && s->pending == 0) - err = Z_OK; - } - if (s->level != level) { - s->level = level; - s->max_lazy_match = configuration_table[level].max_lazy; - s->good_match = configuration_table[level].good_length; - s->nice_match = configuration_table[level].nice_length; - s->max_chain_length = configuration_table[level].max_chain; - } - s->strategy = strategy; - return err; -} - -/* ========================================================================= */ -int ZEXPORT deflateTune(strm, good_length, max_lazy, nice_length, max_chain) - z_streamp strm; - int good_length; - int max_lazy; - int nice_length; - int max_chain; -{ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - s = strm->state; - s->good_match = good_length; - s->max_lazy_match = max_lazy; - s->nice_match = nice_length; - s->max_chain_length = max_chain; - return Z_OK; -} - -/* ========================================================================= - * For the default windowBits of 15 and memLevel of 8, this function returns - * a close to exact, as well as small, upper bound on the compressed size. - * They are coded as constants here for a reason--if the #define's are - * changed, then this function needs to be changed as well. The return - * value for 15 and 8 only works for those exact settings. - * - * For any setting other than those defaults for windowBits and memLevel, - * the value returned is a conservative worst case for the maximum expansion - * resulting from using fixed blocks instead of stored blocks, which deflate - * can emit on compressed data for some combinations of the parameters. - * - * This function could be more sophisticated to provide closer upper bounds for - * every combination of windowBits and memLevel. But even the conservative - * upper bound of about 14% expansion does not seem onerous for output buffer - * allocation. - */ -uLong ZEXPORT deflateBound(strm, sourceLen) - z_streamp strm; - uLong sourceLen; -{ - deflate_state *s; - uLong complen, wraplen; - Bytef *str; - - /* conservative upper bound for compressed data */ - complen = sourceLen + - ((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; - - /* if can't get parameters, return conservative bound plus zlib wrapper */ - if (strm == Z_NULL || strm->state == Z_NULL) - return complen + 6; - - /* compute wrapper length */ - s = strm->state; - switch (s->wrap) { - case 0: /* raw deflate */ - wraplen = 0; - break; - case 1: /* zlib wrapper */ - wraplen = 6 + (s->strstart ? 4 : 0); - break; - case 2: /* gzip wrapper */ - wraplen = 18; - if (s->gzhead != Z_NULL) { /* user-supplied gzip header */ - if (s->gzhead->extra != Z_NULL) - wraplen += 2 + s->gzhead->extra_len; - str = s->gzhead->name; - if (str != Z_NULL) - do { - wraplen++; - } while (*str++); - str = s->gzhead->comment; - if (str != Z_NULL) - do { - wraplen++; - } while (*str++); - if (s->gzhead->hcrc) - wraplen += 2; - } - break; - default: /* for compiler happiness */ - wraplen = 6; - } - - /* if not default parameters, return conservative bound */ - if (s->w_bits != 15 || s->hash_bits != 8 + 7) - return complen + wraplen; - - /* default settings: return tight bound for that case */ - return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) + - (sourceLen >> 25) + 13 - 6 + wraplen; -} - -/* ========================================================================= - * Put a short in the pending buffer. The 16-bit value is put in MSB order. - * IN assertion: the stream state is correct and there is enough room in - * pending_buf. - */ -local void putShortMSB (s, b) - deflate_state *s; - uInt b; -{ - put_byte(s, (Byte)(b >> 8)); - put_byte(s, (Byte)(b & 0xff)); -} - -/* ========================================================================= - * Flush as much pending output as possible. All deflate() output goes - * through this function so some applications may wish to modify it - * to avoid allocating a large strm->next_out buffer and copying into it. - * (See also read_buf()). - */ -local void flush_pending(strm) - z_streamp strm; -{ - unsigned len; - deflate_state *s = strm->state; - - _tr_flush_bits(s); - len = s->pending; - if (len > strm->avail_out) len = strm->avail_out; - if (len == 0) return; - - zmemcpy(strm->next_out, s->pending_out, len); - strm->next_out += len; - s->pending_out += len; - strm->total_out += len; - strm->avail_out -= len; - s->pending -= len; - if (s->pending == 0) { - s->pending_out = s->pending_buf; - } -} - -/* ========================================================================= */ -int ZEXPORT deflate (strm, flush) - z_streamp strm; - int flush; -{ - int old_flush; /* value of flush param for previous deflate call */ - deflate_state *s; - - if (strm == Z_NULL || strm->state == Z_NULL || - flush > Z_BLOCK || flush < 0) { - return Z_STREAM_ERROR; - } - s = strm->state; - - if (strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0) || - (s->status == FINISH_STATE && flush != Z_FINISH)) { - ERR_RETURN(strm, Z_STREAM_ERROR); - } - if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); - - s->strm = strm; /* just in case */ - old_flush = s->last_flush; - s->last_flush = flush; - - /* Write the header */ - if (s->status == INIT_STATE) { -#ifdef GZIP - if (s->wrap == 2) { - strm->adler = crc32(0L, Z_NULL, 0); - put_byte(s, 31); - put_byte(s, 139); - put_byte(s, 8); - if (s->gzhead == Z_NULL) { - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, 0); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, OS_CODE); - s->status = BUSY_STATE; - } - else { - put_byte(s, (s->gzhead->text ? 1 : 0) + - (s->gzhead->hcrc ? 2 : 0) + - (s->gzhead->extra == Z_NULL ? 0 : 4) + - (s->gzhead->name == Z_NULL ? 0 : 8) + - (s->gzhead->comment == Z_NULL ? 0 : 16) - ); - put_byte(s, (Byte)(s->gzhead->time & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 8) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 16) & 0xff)); - put_byte(s, (Byte)((s->gzhead->time >> 24) & 0xff)); - put_byte(s, s->level == 9 ? 2 : - (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2 ? - 4 : 0)); - put_byte(s, s->gzhead->os & 0xff); - if (s->gzhead->extra != Z_NULL) { - put_byte(s, s->gzhead->extra_len & 0xff); - put_byte(s, (s->gzhead->extra_len >> 8) & 0xff); - } - if (s->gzhead->hcrc) - strm->adler = crc32(strm->adler, s->pending_buf, - s->pending); - s->gzindex = 0; - s->status = EXTRA_STATE; - } - } - else -#endif - { - uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; - uInt level_flags; - - if (s->strategy >= Z_HUFFMAN_ONLY || s->level < 2) - level_flags = 0; - else if (s->level < 6) - level_flags = 1; - else if (s->level == 6) - level_flags = 2; - else - level_flags = 3; - header |= (level_flags << 6); - if (s->strstart != 0) header |= PRESET_DICT; - header += 31 - (header % 31); - - s->status = BUSY_STATE; - putShortMSB(s, header); - - /* Save the adler32 of the preset dictionary: */ - if (s->strstart != 0) { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - strm->adler = adler32(0L, Z_NULL, 0); - } - } -#ifdef GZIP - if (s->status == EXTRA_STATE) { - if (s->gzhead->extra != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - - while (s->gzindex < (s->gzhead->extra_len & 0xffff)) { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) - break; - } - put_byte(s, s->gzhead->extra[s->gzindex]); - s->gzindex++; - } - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (s->gzindex == s->gzhead->extra_len) { - s->gzindex = 0; - s->status = NAME_STATE; - } - } - else - s->status = NAME_STATE; - } - if (s->status == NAME_STATE) { - if (s->gzhead->name != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->name[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) { - s->gzindex = 0; - s->status = COMMENT_STATE; - } - } - else - s->status = COMMENT_STATE; - } - if (s->status == COMMENT_STATE) { - if (s->gzhead->comment != Z_NULL) { - uInt beg = s->pending; /* start of bytes to update crc */ - int val; - - do { - if (s->pending == s->pending_buf_size) { - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - flush_pending(strm); - beg = s->pending; - if (s->pending == s->pending_buf_size) { - val = 1; - break; - } - } - val = s->gzhead->comment[s->gzindex++]; - put_byte(s, val); - } while (val != 0); - if (s->gzhead->hcrc && s->pending > beg) - strm->adler = crc32(strm->adler, s->pending_buf + beg, - s->pending - beg); - if (val == 0) - s->status = HCRC_STATE; - } - else - s->status = HCRC_STATE; - } - if (s->status == HCRC_STATE) { - if (s->gzhead->hcrc) { - if (s->pending + 2 > s->pending_buf_size) - flush_pending(strm); - if (s->pending + 2 <= s->pending_buf_size) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - strm->adler = crc32(0L, Z_NULL, 0); - s->status = BUSY_STATE; - } - } - else - s->status = BUSY_STATE; - } -#endif - - /* Flush as much pending output as possible */ - if (s->pending != 0) { - flush_pending(strm); - if (strm->avail_out == 0) { - /* Since avail_out is 0, deflate will be called again with - * more output space, but possibly with both pending and - * avail_in equal to zero. There won't be anything to do, - * but this is not an error situation so make sure we - * return OK instead of BUF_ERROR at next call of deflate: - */ - s->last_flush = -1; - return Z_OK; - } - - /* Make sure there is something to do and avoid duplicate consecutive - * flushes. For repeated and useless calls with Z_FINISH, we keep - * returning Z_STREAM_END instead of Z_BUF_ERROR. - */ - } else if (strm->avail_in == 0 && RANK(flush) <= RANK(old_flush) && - flush != Z_FINISH) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* User must not provide more input after the first FINISH: */ - if (s->status == FINISH_STATE && strm->avail_in != 0) { - ERR_RETURN(strm, Z_BUF_ERROR); - } - - /* Start a new block or continue the current one. - */ - if (strm->avail_in != 0 || s->lookahead != 0 || - (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { - block_state bstate; - - bstate = s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : - (s->strategy == Z_RLE ? deflate_rle(s, flush) : - (*(configuration_table[s->level].func))(s, flush)); - - if (bstate == finish_started || bstate == finish_done) { - s->status = FINISH_STATE; - } - if (bstate == need_more || bstate == finish_started) { - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ - } - return Z_OK; - /* If flush != Z_NO_FLUSH && avail_out == 0, the next call - * of deflate should use the same flush parameter to make sure - * that the flush is complete. So we don't have to output an - * empty block here, this will be done at next call. This also - * ensures that for a very small output buffer, we emit at most - * one empty block. - */ - } - if (bstate == block_done) { - if (flush == Z_PARTIAL_FLUSH) { - _tr_align(s); - } else if (flush != Z_BLOCK) { /* FULL_FLUSH or SYNC_FLUSH */ - _tr_stored_block(s, (char*)0, 0L, 0); - /* For a full flush, this empty block will be recognized - * as a special marker by inflate_sync(). - */ - if (flush == Z_FULL_FLUSH) { - CLEAR_HASH(s); /* forget history */ - if (s->lookahead == 0) { - s->strstart = 0; - s->block_start = 0L; - s->insert = 0; - } - } - } - flush_pending(strm); - if (strm->avail_out == 0) { - s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ - return Z_OK; - } - } - } - Assert(strm->avail_out > 0, "bug2"); - - if (flush != Z_FINISH) return Z_OK; - if (s->wrap <= 0) return Z_STREAM_END; - - /* Write the trailer */ -#ifdef GZIP - if (s->wrap == 2) { - put_byte(s, (Byte)(strm->adler & 0xff)); - put_byte(s, (Byte)((strm->adler >> 8) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 16) & 0xff)); - put_byte(s, (Byte)((strm->adler >> 24) & 0xff)); - put_byte(s, (Byte)(strm->total_in & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 8) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 16) & 0xff)); - put_byte(s, (Byte)((strm->total_in >> 24) & 0xff)); - } - else -#endif - { - putShortMSB(s, (uInt)(strm->adler >> 16)); - putShortMSB(s, (uInt)(strm->adler & 0xffff)); - } - flush_pending(strm); - /* If avail_out is zero, the application will call deflate again - * to flush the rest. - */ - if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ - return s->pending != 0 ? Z_OK : Z_STREAM_END; -} - -/* ========================================================================= */ -int ZEXPORT deflateEnd (strm) - z_streamp strm; -{ - int status; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - - status = strm->state->status; - if (status != INIT_STATE && - status != EXTRA_STATE && - status != NAME_STATE && - status != COMMENT_STATE && - status != HCRC_STATE && - status != BUSY_STATE && - status != FINISH_STATE) { - return Z_STREAM_ERROR; - } - - /* Deallocate in reverse order of allocations: */ - TRY_FREE(strm, strm->state->pending_buf); - TRY_FREE(strm, strm->state->head); - TRY_FREE(strm, strm->state->prev); - TRY_FREE(strm, strm->state->window); - - ZFREE(strm, strm->state); - strm->state = Z_NULL; - - return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; -} - -/* ========================================================================= - * Copy the source state to the destination state. - * To simplify the source, this is not supported for 16-bit MSDOS (which - * doesn't have enough memory anyway to duplicate compression states). - */ -int ZEXPORT deflateCopy (dest, source) - z_streamp dest; - z_streamp source; -{ -#ifdef MAXSEG_64K - return Z_STREAM_ERROR; -#else - deflate_state *ds; - deflate_state *ss; - ushf *overlay; - - - if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { - return Z_STREAM_ERROR; - } - - ss = source->state; - - zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); - - ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); - if (ds == Z_NULL) return Z_MEM_ERROR; - dest->state = (struct internal_state FAR *) ds; - zmemcpy((voidpf)ds, (voidpf)ss, sizeof(deflate_state)); - ds->strm = dest; - - ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); - ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); - ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); - overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); - ds->pending_buf = (uchf *) overlay; - - if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || - ds->pending_buf == Z_NULL) { - deflateEnd (dest); - return Z_MEM_ERROR; - } - /* following zmemcpy do not work for 16-bit MSDOS */ - zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); - zmemcpy((voidpf)ds->prev, (voidpf)ss->prev, ds->w_size * sizeof(Pos)); - zmemcpy((voidpf)ds->head, (voidpf)ss->head, ds->hash_size * sizeof(Pos)); - zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); - - ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); - ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); - ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; - - ds->l_desc.dyn_tree = ds->dyn_ltree; - ds->d_desc.dyn_tree = ds->dyn_dtree; - ds->bl_desc.dyn_tree = ds->bl_tree; - - return Z_OK; -#endif /* MAXSEG_64K */ -} - -/* =========================================================================== - * Read a new buffer from the current input stream, update the adler32 - * and total number of bytes read. All deflate() input goes through - * this function so some applications may wish to modify it to avoid - * allocating a large strm->next_in buffer and copying from it. - * (See also flush_pending()). - */ -local int read_buf(strm, buf, size) - z_streamp strm; - Bytef *buf; - unsigned size; -{ - unsigned len = strm->avail_in; - - if (len > size) len = size; - if (len == 0) return 0; - - strm->avail_in -= len; - - zmemcpy(buf, strm->next_in, len); - if (strm->state->wrap == 1) { - strm->adler = adler32(strm->adler, buf, len); - } -#ifdef GZIP - else if (strm->state->wrap == 2) { - strm->adler = crc32(strm->adler, buf, len); - } -#endif - strm->next_in += len; - strm->total_in += len; - - return (int)len; -} - -/* =========================================================================== - * Initialize the "longest match" routines for a new zlib stream - */ -local void lm_init (s) - deflate_state *s; -{ - s->window_size = (ulg)2L*s->w_size; - - CLEAR_HASH(s); - - /* Set the default configuration parameters: - */ - s->max_lazy_match = configuration_table[s->level].max_lazy; - s->good_match = configuration_table[s->level].good_length; - s->nice_match = configuration_table[s->level].nice_length; - s->max_chain_length = configuration_table[s->level].max_chain; - - s->strstart = 0; - s->block_start = 0L; - s->lookahead = 0; - s->insert = 0; - s->match_length = s->prev_length = MIN_MATCH-1; - s->match_available = 0; - s->ins_h = 0; -#ifndef FASTEST -#ifdef ASMV - match_init(); /* initialize the asm code */ -#endif -#endif -} - -#ifndef FASTEST -/* =========================================================================== - * Set match_start to the longest match starting at the given string and - * return its length. Matches shorter or equal to prev_length are discarded, - * in which case the result is equal to prev_length and match_start is - * garbage. - * IN assertions: cur_match is the head of the hash chain for the current - * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 - * OUT assertion: the match length is not greater than s->lookahead. - */ -#ifndef ASMV -/* For 80x86 and 680x0, an optimized version will be provided in match.asm or - * match.S. The code will be functionally equivalent. - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - unsigned chain_length = s->max_chain_length;/* max hash chain length */ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - int best_len = s->prev_length; /* best match length so far */ - int nice_match = s->nice_match; /* stop if match long enough */ - IPos limit = s->strstart > (IPos)MAX_DIST(s) ? - s->strstart - (IPos)MAX_DIST(s) : NIL; - /* Stop when cur_match becomes <= limit. To simplify the code, - * we prevent matches with the string of window index 0. - */ - Posf *prev = s->prev; - uInt wmask = s->w_mask; - -#ifdef UNALIGNED_OK - /* Compare two bytes at a time. Note: this is not always beneficial. - * Try with and without -DUNALIGNED_OK to check. - */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; - register ush scan_start = *(ushf*)scan; - register ush scan_end = *(ushf*)(scan+best_len-1); -#else - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end = scan[best_len]; -#endif - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - /* Do not waste too much time if we already have a good match: */ - if (s->prev_length >= s->good_match) { - chain_length >>= 2; - } - /* Do not look for matches beyond the end of the input. This is necessary - * to make deflate deterministic. - */ - if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - do { - Assert(cur_match < s->strstart, "no future"); - match = s->window + cur_match; - - /* Skip to next match if the match length cannot increase - * or if the match length is less than 2. Note that the checks below - * for insufficient lookahead only occur occasionally for performance - * reasons. Therefore uninitialized memory will be accessed, and - * conditional jumps will be made that depend on those values. - * However the length of the match is limited to the lookahead, so - * the output of deflate is not affected by the uninitialized values. - */ -#if (defined(UNALIGNED_OK) && MAX_MATCH == 258) - /* This code assumes sizeof(unsigned short) == 2. Do not use - * UNALIGNED_OK if your compiler uses a different size. - */ - if (*(ushf*)(match+best_len-1) != scan_end || - *(ushf*)match != scan_start) continue; - - /* It is not necessary to compare scan[2] and match[2] since they are - * always equal when the other bytes match, given that the hash keys - * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at - * strstart+3, +5, ... up to strstart+257. We check for insufficient - * lookahead only every 4th comparison; the 128th check will be made - * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is - * necessary to put more guard bytes at the end of the window, or - * to check more often for insufficient lookahead. - */ - Assert(scan[2] == match[2], "scan[2]?"); - scan++, match++; - do { - } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - *(ushf*)(scan+=2) == *(ushf*)(match+=2) && - scan < strend); - /* The funny "do {}" generates better code on most compilers */ - - /* Here, scan <= window+strstart+257 */ - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - if (*scan == *match) scan++; - - len = (MAX_MATCH - 1) - (int)(strend-scan); - scan = strend - (MAX_MATCH-1); - -#else /* UNALIGNED_OK */ - - if (match[best_len] != scan_end || - match[best_len-1] != scan_end1 || - *match != *scan || - *++match != scan[1]) continue; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match++; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - scan = strend - MAX_MATCH; - -#endif /* UNALIGNED_OK */ - - if (len > best_len) { - s->match_start = cur_match; - best_len = len; - if (len >= nice_match) break; -#ifdef UNALIGNED_OK - scan_end = *(ushf*)(scan+best_len-1); -#else - scan_end1 = scan[best_len-1]; - scan_end = scan[best_len]; -#endif - } - } while ((cur_match = prev[cur_match & wmask]) > limit - && --chain_length != 0); - - if ((uInt)best_len <= s->lookahead) return (uInt)best_len; - return s->lookahead; -} -#endif /* ASMV */ - -#else /* FASTEST */ - -/* --------------------------------------------------------------------------- - * Optimized version for FASTEST only - */ -local uInt longest_match(s, cur_match) - deflate_state *s; - IPos cur_match; /* current match */ -{ - register Bytef *scan = s->window + s->strstart; /* current string */ - register Bytef *match; /* matched string */ - register int len; /* length of current match */ - register Bytef *strend = s->window + s->strstart + MAX_MATCH; - - /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. - * It is easy to get rid of this optimization if necessary. - */ - Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); - - Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); - - Assert(cur_match < s->strstart, "no future"); - - match = s->window + cur_match; - - /* Return failure if the match length is less than 2: - */ - if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; - - /* The check at best_len-1 can be removed because it will be made - * again later. (This heuristic is not always a win.) - * It is not necessary to compare scan[2] and match[2] since they - * are always equal when the other bytes match, given that - * the hash keys are equal and that HASH_BITS >= 8. - */ - scan += 2, match += 2; - Assert(*scan == *match, "match[2]?"); - - /* We check for insufficient lookahead only every 8th comparison; - * the 256th check will be made at strstart+258. - */ - do { - } while (*++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - *++scan == *++match && *++scan == *++match && - scan < strend); - - Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); - - len = MAX_MATCH - (int)(strend - scan); - - if (len < MIN_MATCH) return MIN_MATCH - 1; - - s->match_start = cur_match; - return (uInt)len <= s->lookahead ? (uInt)len : s->lookahead; -} - -#endif /* FASTEST */ - -#ifdef DEBUG -/* =========================================================================== - * Check that the match at match_start is indeed a match. - */ -local void check_match(s, start, match, length) - deflate_state *s; - IPos start, match; - int length; -{ - /* check that the match is indeed a match */ - if (zmemcmp(s->window + match, - s->window + start, length) != EQUAL) { - fprintf(stderr, " start %u, match %u, length %d\n", - start, match, length); - do { - fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); - } while (--length != 0); - z_error("invalid match"); - } - if (z_verbose > 1) { - fprintf(stderr,"\\[%d,%d]", start-match, length); - do { putc(s->window[start++], stderr); } while (--length != 0); - } -} -#else -# define check_match(s, start, match, length) -#endif /* DEBUG */ - -/* =========================================================================== - * Fill the window when the lookahead becomes insufficient. - * Updates strstart and lookahead. - * - * IN assertion: lookahead < MIN_LOOKAHEAD - * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD - * At least one byte has been read, or avail_in == 0; reads are - * performed for at least two bytes (required for the zip translate_eol - * option -- not supported here). - */ -local void fill_window(s) - deflate_state *s; -{ - register unsigned n, m; - register Posf *p; - unsigned more; /* Amount of free space at the end of the window. */ - uInt wsize = s->w_size; - - Assert(s->lookahead < MIN_LOOKAHEAD, "already enough lookahead"); - - do { - more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); - - /* Deal with !@#$% 64K limit: */ - if (sizeof(int) <= 2) { - if (more == 0 && s->strstart == 0 && s->lookahead == 0) { - more = wsize; - - } else if (more == (unsigned)(-1)) { - /* Very unlikely, but possible on 16 bit machine if - * strstart == 0 && lookahead == 1 (input done a byte at time) - */ - more--; - } - } - - /* If the window is almost full and there is insufficient lookahead, - * move the upper half to the lower one to make room in the upper half. - */ - if (s->strstart >= wsize+MAX_DIST(s)) { - - zmemcpy(s->window, s->window+wsize, (unsigned)wsize); - s->match_start -= wsize; - s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ - s->block_start -= (long) wsize; - - /* Slide the hash table (could be avoided with 32 bit values - at the expense of memory usage). We slide even when level == 0 - to keep the hash table consistent if we switch back to level > 0 - later. (Using level 0 permanently is not an optimal usage of - zlib, so we don't care about this pathological case.) - */ - n = s->hash_size; - p = &s->head[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - } while (--n); - - n = wsize; -#ifndef FASTEST - p = &s->prev[n]; - do { - m = *--p; - *p = (Pos)(m >= wsize ? m-wsize : NIL); - /* If n is not on any hash chain, prev[n] is garbage but - * its value will never be used. - */ - } while (--n); -#endif - more += wsize; - } - if (s->strm->avail_in == 0) break; - - /* If there was no sliding: - * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && - * more == window_size - lookahead - strstart - * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) - * => more >= window_size - 2*WSIZE + 2 - * In the BIG_MEM or MMAP case (not yet supported), - * window_size == input_size + MIN_LOOKAHEAD && - * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. - * Otherwise, window_size == 2*WSIZE so more >= 2. - * If there was sliding, more >= WSIZE. So in all cases, more >= 2. - */ - Assert(more >= 2, "more < 2"); - - n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); - s->lookahead += n; - - /* Initialize the hash value now that we have some input: */ - if (s->lookahead + s->insert >= MIN_MATCH) { - uInt str = s->strstart - s->insert; - s->ins_h = s->window[str]; - UPDATE_HASH(s, s->ins_h, s->window[str + 1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - while (s->insert) { - UPDATE_HASH(s, s->ins_h, s->window[str + MIN_MATCH-1]); -#ifndef FASTEST - s->prev[str & s->w_mask] = s->head[s->ins_h]; -#endif - s->head[s->ins_h] = (Pos)str; - str++; - s->insert--; - if (s->lookahead + s->insert < MIN_MATCH) - break; - } - } - /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, - * but this is not important since only literal bytes will be emitted. - */ - - } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); - - /* If the WIN_INIT bytes after the end of the current data have never been - * written, then zero those bytes in order to avoid memory check reports of - * the use of uninitialized (or uninitialised as Julian writes) bytes by - * the longest match routines. Update the high water mark for the next - * time through here. WIN_INIT is set to MAX_MATCH since the longest match - * routines allow scanning to strstart + MAX_MATCH, ignoring lookahead. - */ - if (s->high_water < s->window_size) { - ulg curr = s->strstart + (ulg)(s->lookahead); - ulg init; - - if (s->high_water < curr) { - /* Previous high water mark below current data -- zero WIN_INIT - * bytes or up to end of window, whichever is less. - */ - init = s->window_size - curr; - if (init > WIN_INIT) - init = WIN_INIT; - zmemzero(s->window + curr, (unsigned)init); - s->high_water = curr + init; - } - else if (s->high_water < (ulg)curr + WIN_INIT) { - /* High water mark at or above current data, but below current data - * plus WIN_INIT -- zero out to current data plus WIN_INIT, or up - * to end of window, whichever is less. - */ - init = (ulg)curr + WIN_INIT - s->high_water; - if (init > s->window_size - s->high_water) - init = s->window_size - s->high_water; - zmemzero(s->window + s->high_water, (unsigned)init); - s->high_water += init; - } - } - - Assert((ulg)s->strstart <= s->window_size - MIN_LOOKAHEAD, - "not enough room for search"); -} - -/* =========================================================================== - * Flush the current block, with given end-of-file flag. - * IN assertion: strstart is set to the end of the current match. - */ -#define FLUSH_BLOCK_ONLY(s, last) { \ - _tr_flush_block(s, (s->block_start >= 0L ? \ - (charf *)&s->window[(unsigned)s->block_start] : \ - (charf *)Z_NULL), \ - (ulg)((long)s->strstart - s->block_start), \ - (last)); \ - s->block_start = s->strstart; \ - flush_pending(s->strm); \ - Tracev((stderr,"[FLUSH]")); \ -} - -/* Same but force premature exit if necessary. */ -#define FLUSH_BLOCK(s, last) { \ - FLUSH_BLOCK_ONLY(s, last); \ - if (s->strm->avail_out == 0) return (last) ? finish_started : need_more; \ -} - -/* =========================================================================== - * Copy without compression as much as possible from the input stream, return - * the current block state. - * This function does not insert new strings in the dictionary since - * uncompressible data is probably not useful. This function is used - * only for the level=0 compression option. - * NOTE: this function should be optimized to avoid extra copying from - * window to pending_buf. - */ -local block_state deflate_stored(s, flush) - deflate_state *s; - int flush; -{ - /* Stored blocks are limited to 0xffff bytes, pending_buf is limited - * to pending_buf_size, and each stored block has a 5 byte header: - */ - ulg max_block_size = 0xffff; - ulg max_start; - - if (max_block_size > s->pending_buf_size - 5) { - max_block_size = s->pending_buf_size - 5; - } - - /* Copy as much as possible from input to output: */ - for (;;) { - /* Fill the window as much as possible: */ - if (s->lookahead <= 1) { - - Assert(s->strstart < s->w_size+MAX_DIST(s) || - s->block_start >= (long)s->w_size, "slide too late"); - - fill_window(s); - if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; - - if (s->lookahead == 0) break; /* flush the current block */ - } - Assert(s->block_start >= 0L, "block gone"); - - s->strstart += s->lookahead; - s->lookahead = 0; - - /* Emit a stored block if pending_buf will be full: */ - max_start = s->block_start + max_block_size; - if (s->strstart == 0 || (ulg)s->strstart >= max_start) { - /* strstart == 0 is possible when wraparound on 16-bit machine */ - s->lookahead = (uInt)(s->strstart - max_start); - s->strstart = (uInt)max_start; - FLUSH_BLOCK(s, 0); - } - /* Flush if we may have to slide, otherwise block_start may become - * negative and the data will be gone: - */ - if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { - FLUSH_BLOCK(s, 0); - } - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if ((long)s->strstart > s->block_start) - FLUSH_BLOCK(s, 0); - return block_done; -} - -/* =========================================================================== - * Compress as much as possible from the input stream, return the current - * block state. - * This function does not perform lazy evaluation of matches and inserts - * new strings in the dictionary only for unmatched strings or for short - * matches. It is used only for the fast compression options. - */ -local block_state deflate_fast(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head; /* head of the hash chain */ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = NIL; - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - * At this point we have always match_length < MIN_MATCH - */ - if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s->match_length = longest_match (s, hash_head); - /* longest_match() sets match_start */ - } - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->match_start, s->match_length); - - _tr_tally_dist(s, s->strstart - s->match_start, - s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - - /* Insert new strings in the hash table only if the match length - * is not too large. This saves time but degrades compression. - */ -#ifndef FASTEST - if (s->match_length <= s->max_insert_length && - s->lookahead >= MIN_MATCH) { - s->match_length--; /* string at strstart already in table */ - do { - s->strstart++; - INSERT_STRING(s, s->strstart, hash_head); - /* strstart never exceeds WSIZE-MAX_MATCH, so there are - * always MIN_MATCH bytes ahead. - */ - } while (--s->match_length != 0); - s->strstart++; - } else -#endif - { - s->strstart += s->match_length; - s->match_length = 0; - s->ins_h = s->window[s->strstart]; - UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); -#if MIN_MATCH != 3 - Call UPDATE_HASH() MIN_MATCH-3 more times -#endif - /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not - * matter since it will be recomputed at next deflate call. - */ - } - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} - -#ifndef FASTEST -/* =========================================================================== - * Same as above, but achieves better compression. We use a lazy - * evaluation for matches: a match is finally adopted only if there is - * no better match at the next window position. - */ -local block_state deflate_slow(s, flush) - deflate_state *s; - int flush; -{ - IPos hash_head; /* head of hash chain */ - int bflush; /* set if current block must be flushed */ - - /* Process the input block. */ - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the next match, plus MIN_MATCH bytes to insert the - * string following the next match. - */ - if (s->lookahead < MIN_LOOKAHEAD) { - fill_window(s); - if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* Insert the string window[strstart .. strstart+2] in the - * dictionary, and set hash_head to the head of the hash chain: - */ - hash_head = NIL; - if (s->lookahead >= MIN_MATCH) { - INSERT_STRING(s, s->strstart, hash_head); - } - - /* Find the longest match, discarding those <= prev_length. - */ - s->prev_length = s->match_length, s->prev_match = s->match_start; - s->match_length = MIN_MATCH-1; - - if (hash_head != NIL && s->prev_length < s->max_lazy_match && - s->strstart - hash_head <= MAX_DIST(s)) { - /* To simplify the code, we prevent matches with the string - * of window index 0 (in particular we have to avoid a match - * of the string with itself at the start of the input file). - */ - s->match_length = longest_match (s, hash_head); - /* longest_match() sets match_start */ - - if (s->match_length <= 5 && (s->strategy == Z_FILTERED -#if TOO_FAR <= 32767 - || (s->match_length == MIN_MATCH && - s->strstart - s->match_start > TOO_FAR) -#endif - )) { - - /* If prev_match is also MIN_MATCH, match_start is garbage - * but we will ignore the current match anyway. - */ - s->match_length = MIN_MATCH-1; - } - } - /* If there was a match at the previous step and the current - * match is not better, output the previous match: - */ - if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { - uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; - /* Do not insert strings in hash table beyond this. */ - - check_match(s, s->strstart-1, s->prev_match, s->prev_length); - - _tr_tally_dist(s, s->strstart -1 - s->prev_match, - s->prev_length - MIN_MATCH, bflush); - - /* Insert in hash table all strings up to the end of the match. - * strstart-1 and strstart are already inserted. If there is not - * enough lookahead, the last two strings are not inserted in - * the hash table. - */ - s->lookahead -= s->prev_length-1; - s->prev_length -= 2; - do { - if (++s->strstart <= max_insert) { - INSERT_STRING(s, s->strstart, hash_head); - } - } while (--s->prev_length != 0); - s->match_available = 0; - s->match_length = MIN_MATCH-1; - s->strstart++; - - if (bflush) FLUSH_BLOCK(s, 0); - - } else if (s->match_available) { - /* If there was no match at the previous position, output a - * single literal. If there was a match but the current match - * is longer, truncate the previous match to a single literal. - */ - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - if (bflush) { - FLUSH_BLOCK_ONLY(s, 0); - } - s->strstart++; - s->lookahead--; - if (s->strm->avail_out == 0) return need_more; - } else { - /* There is no previous match to compare with, wait for - * the next step to decide. - */ - s->match_available = 1; - s->strstart++; - s->lookahead--; - } - } - Assert (flush != Z_NO_FLUSH, "no flush?"); - if (s->match_available) { - Tracevv((stderr,"%c", s->window[s->strstart-1])); - _tr_tally_lit(s, s->window[s->strstart-1], bflush); - s->match_available = 0; - } - s->insert = s->strstart < MIN_MATCH-1 ? s->strstart : MIN_MATCH-1; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} -#endif /* FASTEST */ - -/* =========================================================================== - * For Z_RLE, simply look for runs of bytes, generate matches only of distance - * one. Do not maintain a hash table. (It will be regenerated if this run of - * deflate switches away from Z_RLE.) - */ -local block_state deflate_rle(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - uInt prev; /* byte at distance one to match */ - Bytef *scan, *strend; /* scan goes up to strend for length of run */ - - for (;;) { - /* Make sure that we always have enough lookahead, except - * at the end of the input file. We need MAX_MATCH bytes - * for the longest run, plus one for the unrolled loop. - */ - if (s->lookahead <= MAX_MATCH) { - fill_window(s); - if (s->lookahead <= MAX_MATCH && flush == Z_NO_FLUSH) { - return need_more; - } - if (s->lookahead == 0) break; /* flush the current block */ - } - - /* See how many times the previous byte repeats */ - s->match_length = 0; - if (s->lookahead >= MIN_MATCH && s->strstart > 0) { - scan = s->window + s->strstart - 1; - prev = *scan; - if (prev == *++scan && prev == *++scan && prev == *++scan) { - strend = s->window + s->strstart + MAX_MATCH; - do { - } while (prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - prev == *++scan && prev == *++scan && - scan < strend); - s->match_length = MAX_MATCH - (int)(strend - scan); - if (s->match_length > s->lookahead) - s->match_length = s->lookahead; - } - Assert(scan <= s->window+(uInt)(s->window_size-1), "wild scan"); - } - - /* Emit match if have run of MIN_MATCH or longer, else emit literal */ - if (s->match_length >= MIN_MATCH) { - check_match(s, s->strstart, s->strstart - 1, s->match_length); - - _tr_tally_dist(s, 1, s->match_length - MIN_MATCH, bflush); - - s->lookahead -= s->match_length; - s->strstart += s->match_length; - s->match_length = 0; - } else { - /* No match, output a literal byte */ - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - } - if (bflush) FLUSH_BLOCK(s, 0); - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} - -/* =========================================================================== - * For Z_HUFFMAN_ONLY, do not look for matches. Do not maintain a hash table. - * (It will be regenerated if this run of deflate switches away from Huffman.) - */ -local block_state deflate_huff(s, flush) - deflate_state *s; - int flush; -{ - int bflush; /* set if current block must be flushed */ - - for (;;) { - /* Make sure that we have a literal to write. */ - if (s->lookahead == 0) { - fill_window(s); - if (s->lookahead == 0) { - if (flush == Z_NO_FLUSH) - return need_more; - break; /* flush the current block */ - } - } - - /* Output a literal byte */ - s->match_length = 0; - Tracevv((stderr,"%c", s->window[s->strstart])); - _tr_tally_lit (s, s->window[s->strstart], bflush); - s->lookahead--; - s->strstart++; - if (bflush) FLUSH_BLOCK(s, 0); - } - s->insert = 0; - if (flush == Z_FINISH) { - FLUSH_BLOCK(s, 1); - return finish_done; - } - if (s->last_lit) - FLUSH_BLOCK(s, 0); - return block_done; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.h deleted file mode 100644 index bb64c57..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/deflate.h +++ /dev/null @@ -1,346 +0,0 @@ -/* deflate.h -- internal compression state - * Copyright (C) 1995-2012 Jean-loup Gailly - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef DEFLATE_H -#define DEFLATE_H - -#include "zutil.h" - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer creation by deflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip encoding - should be left enabled. */ -#ifndef NO_GZIP -# define GZIP -#endif - -/* =========================================================================== - * Internal compression state. - */ - -#define LENGTH_CODES 29 -/* number of length codes, not counting the special END_BLOCK code */ - -#define LITERALS 256 -/* number of literal bytes 0..255 */ - -#define L_CODES (LITERALS+1+LENGTH_CODES) -/* number of Literal or Length codes, including the END_BLOCK code */ - -#define D_CODES 30 -/* number of distance codes */ - -#define BL_CODES 19 -/* number of codes used to transfer the bit lengths */ - -#define HEAP_SIZE (2*L_CODES+1) -/* maximum heap size */ - -#define MAX_BITS 15 -/* All codes must not exceed MAX_BITS bits */ - -#define Buf_size 16 -/* size of bit buffer in bi_buf */ - -#define INIT_STATE 42 -#define EXTRA_STATE 69 -#define NAME_STATE 73 -#define COMMENT_STATE 91 -#define HCRC_STATE 103 -#define BUSY_STATE 113 -#define FINISH_STATE 666 -/* Stream status */ - - -/* Data structure describing a single value and its code string. */ -typedef struct ct_data_s { - union { - ush freq; /* frequency count */ - ush code; /* bit string */ - } fc; - union { - ush dad; /* father node in Huffman tree */ - ush len; /* length of bit string */ - } dl; -} FAR ct_data; - -#define Freq fc.freq -#define Code fc.code -#define Dad dl.dad -#define Len dl.len - -typedef struct static_tree_desc_s static_tree_desc; - -typedef struct tree_desc_s { - ct_data *dyn_tree; /* the dynamic tree */ - int max_code; /* largest code with non zero frequency */ - static_tree_desc *stat_desc; /* the corresponding static tree */ -} FAR tree_desc; - -typedef ush Pos; -typedef Pos FAR Posf; -typedef unsigned IPos; - -/* A Pos is an index in the character window. We use short instead of int to - * save space in the various tables. IPos is used only for parameter passing. - */ - -typedef struct internal_state { - z_streamp strm; /* pointer back to this zlib stream */ - int status; /* as the name implies */ - Bytef *pending_buf; /* output still pending */ - ulg pending_buf_size; /* size of pending_buf */ - Bytef *pending_out; /* next pending byte to output to the stream */ - uInt pending; /* nb of bytes in the pending buffer */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - gz_headerp gzhead; /* gzip header information to write */ - uInt gzindex; /* where in extra, name, or comment */ - Byte method; /* can only be DEFLATED */ - int last_flush; /* value of flush param for previous deflate call */ - - /* used by deflate.c: */ - - uInt w_size; /* LZ77 window size (32K by default) */ - uInt w_bits; /* log2(w_size) (8..16) */ - uInt w_mask; /* w_size - 1 */ - - Bytef *window; - /* Sliding window. Input bytes are read into the second half of the window, - * and move to the first half later to keep a dictionary of at least wSize - * bytes. With this organization, matches are limited to a distance of - * wSize-MAX_MATCH bytes, but this ensures that IO is always - * performed with a length multiple of the block size. Also, it limits - * the window size to 64K, which is quite useful on MSDOS. - * To do: use the user input buffer as sliding window. - */ - - ulg window_size; - /* Actual size of window: 2*wSize, except when the user input buffer - * is directly used as sliding window. - */ - - Posf *prev; - /* Link to older string with same hash index. To limit the size of this - * array to 64K, this link is maintained only for the last 32K strings. - * An index in this array is thus a window index modulo 32K. - */ - - Posf *head; /* Heads of the hash chains or NIL. */ - - uInt ins_h; /* hash index of string to be inserted */ - uInt hash_size; /* number of elements in hash table */ - uInt hash_bits; /* log2(hash_size) */ - uInt hash_mask; /* hash_size-1 */ - - uInt hash_shift; - /* Number of bits by which ins_h must be shifted at each input - * step. It must be such that after MIN_MATCH steps, the oldest - * byte no longer takes part in the hash key, that is: - * hash_shift * MIN_MATCH >= hash_bits - */ - - long block_start; - /* Window position at the beginning of the current output block. Gets - * negative when the window is moved backwards. - */ - - uInt match_length; /* length of best match */ - IPos prev_match; /* previous match */ - int match_available; /* set if previous match exists */ - uInt strstart; /* start of string to insert */ - uInt match_start; /* start of matching string */ - uInt lookahead; /* number of valid bytes ahead in window */ - - uInt prev_length; - /* Length of the best match at previous step. Matches not greater than this - * are discarded. This is used in the lazy match evaluation. - */ - - uInt max_chain_length; - /* To speed up deflation, hash chains are never searched beyond this - * length. A higher limit improves compression ratio but degrades the - * speed. - */ - - uInt max_lazy_match; - /* Attempt to find a better match only when the current match is strictly - * smaller than this value. This mechanism is used only for compression - * levels >= 4. - */ -# define max_insert_length max_lazy_match - /* Insert new strings in the hash table only if the match length is not - * greater than this length. This saves time but degrades compression. - * max_insert_length is used only for compression levels <= 3. - */ - - int level; /* compression level (1..9) */ - int strategy; /* favor or force Huffman coding*/ - - uInt good_match; - /* Use a faster search when the previous match is longer than this */ - - int nice_match; /* Stop searching when current match exceeds this */ - - /* used by trees.c: */ - /* Didn't use ct_data typedef below to suppress compiler warning */ - struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ - struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ - struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ - - struct tree_desc_s l_desc; /* desc. for literal tree */ - struct tree_desc_s d_desc; /* desc. for distance tree */ - struct tree_desc_s bl_desc; /* desc. for bit length tree */ - - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ - int heap_len; /* number of elements in the heap */ - int heap_max; /* element of largest frequency */ - /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. - * The same heap array is used to build all trees. - */ - - uch depth[2*L_CODES+1]; - /* Depth of each subtree used as tie breaker for trees of equal frequency - */ - - uchf *l_buf; /* buffer for literals or lengths */ - - uInt lit_bufsize; - /* Size of match buffer for literals/lengths. There are 4 reasons for - * limiting lit_bufsize to 64K: - * - frequencies can be kept in 16 bit counters - * - if compression is not successful for the first block, all input - * data is still in the window so we can still emit a stored block even - * when input comes from standard input. (This can also be done for - * all blocks if lit_bufsize is not greater than 32K.) - * - if compression is not successful for a file smaller than 64K, we can - * even emit a stored file instead of a stored block (saving 5 bytes). - * This is applicable only for zip (not gzip or zlib). - * - creating new Huffman trees less frequently may not provide fast - * adaptation to changes in the input data statistics. (Take for - * example a binary file with poorly compressible code followed by - * a highly compressible string table.) Smaller buffer sizes give - * fast adaptation but have of course the overhead of transmitting - * trees more frequently. - * - I can't count above 4 - */ - - uInt last_lit; /* running index in l_buf */ - - ushf *d_buf; - /* Buffer for distances. To simplify the code, d_buf and l_buf have - * the same number of elements. To use different lengths, an extra flag - * array would be necessary. - */ - - ulg opt_len; /* bit length of current block with optimal trees */ - ulg static_len; /* bit length of current block with static trees */ - uInt matches; /* number of string matches in current block */ - uInt insert; /* bytes at end of window left to insert */ - -#ifdef DEBUG - ulg compressed_len; /* total bit length of compressed file mod 2^32 */ - ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ -#endif - - ush bi_buf; - /* Output buffer. bits are inserted starting at the bottom (least - * significant bits). - */ - int bi_valid; - /* Number of valid bits in bi_buf. All bits above the last valid bit - * are always zero. - */ - - ulg high_water; - /* High water mark offset in window for initialized bytes -- bytes above - * this are set to zero in order to avoid memory check warnings when - * longest match routines access bytes past the input. This is then - * updated to the new high water mark. - */ - -} FAR deflate_state; - -/* Output a byte on the stream. - * IN assertion: there is enough room in pending_buf. - */ -#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} - - -#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) -/* Minimum amount of lookahead, except at the end of the input file. - * See deflate.c for comments about the MIN_MATCH+1. - */ - -#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) -/* In order to simplify the code, particularly on 16 bit machines, match - * distances are limited to MAX_DIST instead of WSIZE. - */ - -#define WIN_INIT MAX_MATCH -/* Number of bytes after end of data in window to initialize in order to avoid - memory checker errors from longest match routines */ - - /* in trees.c */ -void ZLIB_INTERNAL _tr_init OF((deflate_state *s)); -int ZLIB_INTERNAL _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); -void ZLIB_INTERNAL _tr_flush_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); -void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_align OF((deflate_state *s)); -void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf, - ulg stored_len, int last)); - -#define d_code(dist) \ - ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) -/* Mapping from a distance to a distance code. dist is the distance - 1 and - * must not have side effects. _dist_code[256] and _dist_code[257] are never - * used. - */ - -#ifndef DEBUG -/* Inline versions of _tr_tally for speed: */ - -#if defined(GEN_TREES_H) || !defined(STDC) - extern uch ZLIB_INTERNAL _length_code[]; - extern uch ZLIB_INTERNAL _dist_code[]; -#else - extern const uch ZLIB_INTERNAL _length_code[]; - extern const uch ZLIB_INTERNAL _dist_code[]; -#endif - -# define _tr_tally_lit(s, c, flush) \ - { uch cc = (c); \ - s->d_buf[s->last_lit] = 0; \ - s->l_buf[s->last_lit++] = cc; \ - s->dyn_ltree[cc].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -# define _tr_tally_dist(s, distance, length, flush) \ - { uch len = (length); \ - ush dist = (distance); \ - s->d_buf[s->last_lit] = dist; \ - s->l_buf[s->last_lit++] = len; \ - dist--; \ - s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ - s->dyn_dtree[d_code(dist)].Freq++; \ - flush = (s->last_lit == s->lit_bufsize-1); \ - } -#else -# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) -# define _tr_tally_dist(s, distance, length, flush) \ - flush = _tr_tally(s, distance, length) -#endif - -#endif /* DEFLATE_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/example.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/example.c deleted file mode 100644 index 68e3cf1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/example.c +++ /dev/null @@ -1,601 +0,0 @@ -/* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2006, 2011 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zlib.h" -#include - -#ifdef STDC -# include -# include -#endif - -#if defined(VMS) || defined(RISCOS) -# define TESTFILE "foo-gz" -#else -# define TESTFILE "foo.gz" -#endif - -#define CHECK_ERR(err, msg) { \ - if (err != Z_OK) { \ - fprintf(stderr, "%s error: %d\n", msg, err); \ - exit(1); \ - } \ -} - -z_const char hello[] = "hello, hello!"; -/* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - */ - -const char dictionary[] = "hello"; -uLong dictId; /* Adler32 value of the dictionary */ - -void test_deflate OF((Byte *compr, uLong comprLen)); -void test_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_deflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_large_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_flush OF((Byte *compr, uLong *comprLen)); -void test_sync OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_dict_deflate OF((Byte *compr, uLong comprLen)); -void test_dict_inflate OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -int main OF((int argc, char *argv[])); - - -#ifdef Z_SOLO - -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); - -void *myalloc(q, n, m) - void *q; - unsigned n, m; -{ - q = Z_NULL; - return calloc(n, m); -} - -void myfree(void *q, void *p) -{ - q = Z_NULL; - free(p); -} - -static alloc_func zalloc = myalloc; -static free_func zfree = myfree; - -#else /* !Z_SOLO */ - -static alloc_func zalloc = (alloc_func)0; -static free_func zfree = (free_func)0; - -void test_compress OF((Byte *compr, uLong comprLen, - Byte *uncompr, uLong uncomprLen)); -void test_gzio OF((const char *fname, - Byte *uncompr, uLong uncomprLen)); - -/* =========================================================================== - * Test compress() and uncompress() - */ -void test_compress(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - uLong len = (uLong)strlen(hello)+1; - - err = compress(compr, &comprLen, (const Bytef*)hello, len); - CHECK_ERR(err, "compress"); - - strcpy((char*)uncompr, "garbage"); - - err = uncompress(uncompr, &uncomprLen, compr, comprLen); - CHECK_ERR(err, "uncompress"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad uncompress\n"); - exit(1); - } else { - printf("uncompress(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test read/write of .gz files - */ -void test_gzio(fname, uncompr, uncomprLen) - const char *fname; /* compressed file name */ - Byte *uncompr; - uLong uncomprLen; -{ -#ifdef NO_GZCOMPRESS - fprintf(stderr, "NO_GZCOMPRESS -- gz* functions cannot compress\n"); -#else - int err; - int len = (int)strlen(hello)+1; - gzFile file; - z_off_t pos; - - file = gzopen(fname, "wb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - gzputc(file, 'h'); - if (gzputs(file, "ello") != 4) { - fprintf(stderr, "gzputs err: %s\n", gzerror(file, &err)); - exit(1); - } - if (gzprintf(file, ", %s!", "hello") != 8) { - fprintf(stderr, "gzprintf err: %s\n", gzerror(file, &err)); - exit(1); - } - gzseek(file, 1L, SEEK_CUR); /* add one zero byte */ - gzclose(file); - - file = gzopen(fname, "rb"); - if (file == NULL) { - fprintf(stderr, "gzopen error\n"); - exit(1); - } - strcpy((char*)uncompr, "garbage"); - - if (gzread(file, uncompr, (unsigned)uncomprLen) != len) { - fprintf(stderr, "gzread err: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad gzread: %s\n", (char*)uncompr); - exit(1); - } else { - printf("gzread(): %s\n", (char*)uncompr); - } - - pos = gzseek(file, -8L, SEEK_CUR); - if (pos != 6 || gztell(file) != pos) { - fprintf(stderr, "gzseek error, pos=%ld, gztell=%ld\n", - (long)pos, (long)gztell(file)); - exit(1); - } - - if (gzgetc(file) != ' ') { - fprintf(stderr, "gzgetc error\n"); - exit(1); - } - - if (gzungetc(' ', file) != ' ') { - fprintf(stderr, "gzungetc error\n"); - exit(1); - } - - gzgets(file, (char*)uncompr, (int)uncomprLen); - if (strlen((char*)uncompr) != 7) { /* " hello!" */ - fprintf(stderr, "gzgets err after gzseek: %s\n", gzerror(file, &err)); - exit(1); - } - if (strcmp((char*)uncompr, hello + 6)) { - fprintf(stderr, "bad gzgets after gzseek\n"); - exit(1); - } else { - printf("gzgets() after gzseek: %s\n", (char*)uncompr); - } - - gzclose(file); -#endif -} - -#endif /* Z_SOLO */ - -/* =========================================================================== - * Test deflate() with small buffers - */ -void test_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uLong len = (uLong)strlen(hello)+1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - - while (c_stream.total_in != len && c_stream.total_out < comprLen) { - c_stream.avail_in = c_stream.avail_out = 1; /* force small buffers */ - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - } - /* Finish the stream, still forcing small buffers: */ - for (;;) { - c_stream.avail_out = 1; - err = deflate(&c_stream, Z_FINISH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "deflate"); - } - - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with small buffers - */ -void test_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 0; - d_stream.next_out = uncompr; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { - d_stream.avail_in = d_stream.avail_out = 1; /* force small buffers */ - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate\n"); - exit(1); - } else { - printf("inflate(): %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Test deflate() with large buffers and dynamic change of compression level - */ -void test_large_deflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_SPEED); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - /* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - */ - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - if (c_stream.avail_in != 0) { - fprintf(stderr, "deflate not greedy\n"); - exit(1); - } - - /* Feed in already compressed data and switch to no compression: */ - deflateParams(&c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in = compr; - c_stream.avail_in = (uInt)comprLen/2; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - /* Switch back to compressing mode: */ - deflateParams(&c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in = uncompr; - c_stream.avail_in = (uInt)uncomprLen; - err = deflate(&c_stream, Z_NO_FLUSH); - CHECK_ERR(err, "deflate"); - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with large buffers - */ -void test_large_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - for (;;) { - d_stream.next_out = uncompr; /* discard the output */ - d_stream.avail_out = (uInt)uncomprLen; - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - CHECK_ERR(err, "large inflate"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (d_stream.total_out != 2*uncomprLen + comprLen/2) { - fprintf(stderr, "bad large inflate: %ld\n", d_stream.total_out); - exit(1); - } else { - printf("large_inflate(): OK\n"); - } -} - -/* =========================================================================== - * Test deflate() with full flush - */ -void test_flush(compr, comprLen) - Byte *compr; - uLong *comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - uInt len = (uInt)strlen(hello)+1; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.next_out = compr; - c_stream.avail_in = 3; - c_stream.avail_out = (uInt)*comprLen; - err = deflate(&c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, "deflate"); - - compr[3]++; /* force an error in first compressed block */ - c_stream.avail_in = len - 3; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - CHECK_ERR(err, "deflate"); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); - - *comprLen = c_stream.total_out; -} - -/* =========================================================================== - * Test inflateSync() - */ -void test_sync(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = 2; /* just read the zlib header */ - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - inflate(&d_stream, Z_NO_FLUSH); - CHECK_ERR(err, "inflate"); - - d_stream.avail_in = (uInt)comprLen-2; /* read all compressed data */ - err = inflateSync(&d_stream); /* but skip the damaged part */ - CHECK_ERR(err, "inflateSync"); - - err = inflate(&d_stream, Z_FINISH); - if (err != Z_DATA_ERROR) { - fprintf(stderr, "inflate should report DATA_ERROR\n"); - /* Because of incorrect adler32 */ - exit(1); - } - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - printf("after inflateSync(): hel%s\n", (char *)uncompr); -} - -/* =========================================================================== - * Test deflate() with preset dictionary - */ -void test_dict_deflate(compr, comprLen) - Byte *compr; - uLong comprLen; -{ - z_stream c_stream; /* compression stream */ - int err; - - c_stream.zalloc = zalloc; - c_stream.zfree = zfree; - c_stream.opaque = (voidpf)0; - - err = deflateInit(&c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, "deflateInit"); - - err = deflateSetDictionary(&c_stream, - (const Bytef*)dictionary, (int)sizeof(dictionary)); - CHECK_ERR(err, "deflateSetDictionary"); - - dictId = c_stream.adler; - c_stream.next_out = compr; - c_stream.avail_out = (uInt)comprLen; - - c_stream.next_in = (z_const unsigned char *)hello; - c_stream.avail_in = (uInt)strlen(hello)+1; - - err = deflate(&c_stream, Z_FINISH); - if (err != Z_STREAM_END) { - fprintf(stderr, "deflate should report Z_STREAM_END\n"); - exit(1); - } - err = deflateEnd(&c_stream); - CHECK_ERR(err, "deflateEnd"); -} - -/* =========================================================================== - * Test inflate() with a preset dictionary - */ -void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) - Byte *compr, *uncompr; - uLong comprLen, uncomprLen; -{ - int err; - z_stream d_stream; /* decompression stream */ - - strcpy((char*)uncompr, "garbage"); - - d_stream.zalloc = zalloc; - d_stream.zfree = zfree; - d_stream.opaque = (voidpf)0; - - d_stream.next_in = compr; - d_stream.avail_in = (uInt)comprLen; - - err = inflateInit(&d_stream); - CHECK_ERR(err, "inflateInit"); - - d_stream.next_out = uncompr; - d_stream.avail_out = (uInt)uncomprLen; - - for (;;) { - err = inflate(&d_stream, Z_NO_FLUSH); - if (err == Z_STREAM_END) break; - if (err == Z_NEED_DICT) { - if (d_stream.adler != dictId) { - fprintf(stderr, "unexpected dictionary"); - exit(1); - } - err = inflateSetDictionary(&d_stream, (const Bytef*)dictionary, - (int)sizeof(dictionary)); - } - CHECK_ERR(err, "inflate with dict"); - } - - err = inflateEnd(&d_stream); - CHECK_ERR(err, "inflateEnd"); - - if (strcmp((char*)uncompr, hello)) { - fprintf(stderr, "bad inflate with dict\n"); - exit(1); - } else { - printf("inflate with dictionary: %s\n", (char *)uncompr); - } -} - -/* =========================================================================== - * Usage: example [output.gz [input.gz]] - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - Byte *compr, *uncompr; - uLong comprLen = 10000*sizeof(int); /* don't overflow on MSDOS */ - uLong uncomprLen = comprLen; - static const char* myVersion = ZLIB_VERSION; - - if (zlibVersion()[0] != myVersion[0]) { - fprintf(stderr, "incompatible zlib version\n"); - exit(1); - - } else if (strcmp(zlibVersion(), ZLIB_VERSION) != 0) { - fprintf(stderr, "warning: different zlib version\n"); - } - - printf("zlib version %s = 0x%04x, compile flags = 0x%lx\n", - ZLIB_VERSION, ZLIB_VERNUM, zlibCompileFlags()); - - compr = (Byte*)calloc((uInt)comprLen, 1); - uncompr = (Byte*)calloc((uInt)uncomprLen, 1); - /* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - */ - if (compr == Z_NULL || uncompr == Z_NULL) { - printf("out of memory\n"); - exit(1); - } - -#ifdef Z_SOLO - argc = strlen(argv[0]); -#else - test_compress(compr, comprLen, uncompr, uncomprLen); - - test_gzio((argc > 1 ? argv[1] : TESTFILE), - uncompr, uncomprLen); -#endif - - test_deflate(compr, comprLen); - test_inflate(compr, comprLen, uncompr, uncomprLen); - - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - - test_flush(compr, &comprLen); - test_sync(compr, comprLen, uncompr, uncomprLen); - comprLen = uncomprLen; - - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - - free(compr); - free(uncompr); - - return 0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzclose.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzclose.c deleted file mode 100644 index cbf0db6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzclose.c +++ /dev/null @@ -1,25 +0,0 @@ -/* gzclose.c -- zlib gzclose() function - * Copyright (C) 2004, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* gzclose() is in a separate file so that it is linked in only if it is used. - That way the other gzclose functions can be used instead to avoid linking in - unneeded compression or decompression routines. */ -int ZEXPORT gzclose(file) - gzFile file; -{ -#ifndef NO_GZCOMPRESS - gz_statep state; - - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - return state->mode == GZ_READ ? gzclose_r(file) : gzclose_w(file); -#else - return gzclose_r(file); -#endif -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzguts.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzguts.h deleted file mode 100644 index bef9749..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzguts.h +++ /dev/null @@ -1,209 +0,0 @@ -/* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef _LARGEFILE64_SOURCE -# ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE 1 -# endif -# ifdef _FILE_OFFSET_BITS -# undef _FILE_OFFSET_BITS -# endif -#endif - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include -#include "zlib.h" -#ifdef STDC -# include -# include -# include -#endif -#include - -#ifdef _WIN32 -# include -#endif - -#if defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32) -# include -#endif - -#ifdef WINAPI_FAMILY -# define open _open -# define read _read -# define write _write -# define close _close -#endif - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS -/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 -/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# define vsnprintf _vsnprintf -# endif -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -# ifdef VMS -# define NO_vsnprintf -# endif -# ifdef __OS400__ -# define NO_vsnprintf -# endif -# ifdef __MVS__ -# define NO_vsnprintf -# endif -#endif - -/* unlike snprintf (which is required in C99, yet still not supported by - Microsoft more than a decade later!), _snprintf does not guarantee null - termination of the result -- however this is only used in gzlib.c where - the result is assured to fit in the space provided */ -#ifdef _MSC_VER -# define snprintf _snprintf -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -/* gz* functions always use library allocation functions */ -#ifndef STDC - extern voidp malloc OF((uInt size)); - extern void free OF((voidpf ptr)); -#endif - -/* get errno and strerror definition */ -#if defined UNDER_CE -# include -# define zstrerror() gz_strwinerror((DWORD)GetLastError()) -#else -# ifndef NO_STRERROR -# include -# define zstrerror() strerror(errno) -# else -# define zstrerror() "stdio error (consult errno)" -# endif -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); -#endif - -/* default memLevel */ -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif - -/* default i/o buffer size -- double this for output when reading (this and - twice this must be able to fit in an unsigned type) */ -#define GZBUFSIZE 8192 - -/* gzip modes, also provide a little integrity check on the passed structure */ -#define GZ_NONE 0 -#define GZ_READ 7247 -#define GZ_WRITE 31153 -#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ - -/* values for gz_state how */ -#define LOOK 0 /* look for a gzip header */ -#define COPY 1 /* copy input directly */ -#define GZIP 2 /* decompress a gzip stream */ - -/* internal gzip file state data structure */ -typedef struct { - /* exposed contents for gzgetc() macro */ - struct gzFile_s x; /* "x" for exposed */ - /* x.have: number of bytes available at x.next */ - /* x.next: next output data to deliver or write */ - /* x.pos: current position in uncompressed data */ - /* used for both reading and writing */ - int mode; /* see gzip modes above */ - int fd; /* file descriptor */ - char *path; /* path or fd for error messages */ - unsigned size; /* buffer size, zero if not allocated yet */ - unsigned want; /* requested buffer size, default is GZBUFSIZE */ - unsigned char *in; /* input buffer */ - unsigned char *out; /* output buffer (double-sized when reading) */ - int direct; /* 0 if processing gzip, 1 if transparent */ - /* just for reading */ - int how; /* 0: get header, 1: copy, 2: decompress */ - z_off64_t start; /* where the gzip data started, for rewinding */ - int eof; /* true if end of input file reached */ - int past; /* true if read requested past end */ - /* just for writing */ - int level; /* compression level */ - int strategy; /* compression strategy */ - /* seek request */ - z_off64_t skip; /* amount to skip (already rewound if backwards) */ - int seek; /* true if seek request pending */ - /* error information */ - int err; /* error code */ - char *msg; /* error message */ - /* zlib inflate or deflate stream */ - z_stream strm; /* stream structure in-place (not a pointer) */ -} gz_state; -typedef gz_state FAR *gz_statep; - -/* shared functions */ -void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); -#if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); -#endif - -/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t - value -- needed when comparing unsigned to z_off64_t, which is signed - (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned ZLIB_INTERNAL gz_intmax OF((void)); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzlib.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzlib.c deleted file mode 100644 index de0ff4f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzlib.c +++ /dev/null @@ -1,634 +0,0 @@ -/* gzlib.c -- zlib functions common to reading and writing gzip files - * Copyright (C) 2004, 2010, 2011, 2012, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -#if defined(_WIN32) && !defined(__BORLANDC__) -# define LSEEK _lseeki64 -#else -#if defined(_LARGEFILE64_SOURCE) && _LFS64_LARGEFILE-0 -# define LSEEK lseek64 -#else -# define LSEEK lseek -#endif -#endif - -/* Local functions */ -local void gz_reset OF((gz_statep)); -local gzFile gz_open OF((const void *, int, const char *)); - -#if defined UNDER_CE - -/* Map the Windows error number in ERROR to a locale-dependent error message - string and return a pointer to it. Typically, the values for ERROR come - from GetLastError. - - The string pointed to shall not be modified by the application, but may be - overwritten by a subsequent call to gz_strwinerror - - The gz_strwinerror function does not change the current setting of - GetLastError. */ -char ZLIB_INTERNAL *gz_strwinerror (error) - DWORD error; -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -#endif /* UNDER_CE */ - -/* Reset gzip file state */ -local void gz_reset(state) - gz_statep state; -{ - state->x.have = 0; /* no output data available */ - if (state->mode == GZ_READ) { /* for reading ... */ - state->eof = 0; /* not at end of file */ - state->past = 0; /* have not read past end yet */ - state->how = LOOK; /* look for gzip header */ - } - state->seek = 0; /* no seek request pending */ - gz_error(state, Z_OK, NULL); /* clear error */ - state->x.pos = 0; /* no uncompressed data yet */ - state->strm.avail_in = 0; /* no input data yet */ -} - -/* Open a gzip file either by name or file descriptor. */ -local gzFile gz_open(path, fd, mode) - const void *path; - int fd; - const char *mode; -{ - gz_statep state; - size_t len; - int oflag; -#ifdef O_CLOEXEC - int cloexec = 0; -#endif -#ifdef O_EXCL - int exclusive = 0; -#endif - - /* check input */ - if (path == NULL) - return NULL; - - /* allocate gzFile structure to return */ - state = (gz_statep)malloc(sizeof(gz_state)); - if (state == NULL) - return NULL; - state->size = 0; /* no buffers allocated yet */ - state->want = GZBUFSIZE; /* requested buffer size */ - state->msg = NULL; /* no error message yet */ - - /* interpret mode */ - state->mode = GZ_NONE; - state->level = Z_DEFAULT_COMPRESSION; - state->strategy = Z_DEFAULT_STRATEGY; - state->direct = 0; - while (*mode) { - if (*mode >= '0' && *mode <= '9') - state->level = *mode - '0'; - else - switch (*mode) { - case 'r': - state->mode = GZ_READ; - break; -#ifndef NO_GZCOMPRESS - case 'w': - state->mode = GZ_WRITE; - break; - case 'a': - state->mode = GZ_APPEND; - break; -#endif - case '+': /* can't read and write at the same time */ - free(state); - return NULL; - case 'b': /* ignore -- will request binary anyway */ - break; -#ifdef O_CLOEXEC - case 'e': - cloexec = 1; - break; -#endif -#ifdef O_EXCL - case 'x': - exclusive = 1; - break; -#endif - case 'f': - state->strategy = Z_FILTERED; - break; - case 'h': - state->strategy = Z_HUFFMAN_ONLY; - break; - case 'R': - state->strategy = Z_RLE; - break; - case 'F': - state->strategy = Z_FIXED; - break; - case 'T': - state->direct = 1; - break; - default: /* could consider as an error, but just ignore */ - ; - } - mode++; - } - - /* must provide an "r", "w", or "a" */ - if (state->mode == GZ_NONE) { - free(state); - return NULL; - } - - /* can't force transparent read */ - if (state->mode == GZ_READ) { - if (state->direct) { - free(state); - return NULL; - } - state->direct = 1; /* for empty file */ - } - - /* save the path name for error messages */ -#ifdef _WIN32 - if (fd == -2) { - len = wcstombs(NULL, path, 0); - if (len == (size_t)-1) - len = 0; - } - else -#endif - len = strlen((const char *)path); - state->path = (char *)malloc(len + 1); - if (state->path == NULL) { - free(state); - return NULL; - } -#ifdef _WIN32 - if (fd == -2) - if (len) - wcstombs(state->path, path, len + 1); - else - *(state->path) = 0; - else -#endif -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(state->path, len + 1, "%s", (const char *)path); -#else - strcpy(state->path, path); -#endif - - /* compute the flags for open() */ - oflag = -#ifdef O_LARGEFILE - O_LARGEFILE | -#endif -#ifdef O_BINARY - O_BINARY | -#endif -#ifdef O_CLOEXEC - (cloexec ? O_CLOEXEC : 0) | -#endif - (state->mode == GZ_READ ? - O_RDONLY : - (O_WRONLY | O_CREAT | -#ifdef O_EXCL - (exclusive ? O_EXCL : 0) | -#endif - (state->mode == GZ_WRITE ? - O_TRUNC : - O_APPEND))); - - /* open the file with the appropriate flags (or just use fd) */ - state->fd = fd > -1 ? fd : ( -#ifdef _WIN32 - fd == -2 ? _wopen(path, oflag, 0666) : -#endif - open((const char *)path, oflag, 0666)); - if (state->fd == -1) { - free(state->path); - free(state); - return NULL; - } - if (state->mode == GZ_APPEND) - state->mode = GZ_WRITE; /* simplify later checks */ - - /* save the current position for rewinding (only if reading) */ - if (state->mode == GZ_READ) { - state->start = LSEEK(state->fd, 0, SEEK_CUR); - if (state->start == -1) state->start = 0; - } - - /* initialize stream */ - gz_reset(state); - - /* return stream */ - return (gzFile)state; -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzopen(path, mode) - const char *path; - const char *mode; -{ - return gz_open(path, -1, mode); -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzopen64(path, mode) - const char *path; - const char *mode; -{ - return gz_open(path, -1, mode); -} - -/* -- see zlib.h -- */ -gzFile ZEXPORT gzdopen(fd, mode) - int fd; - const char *mode; -{ - char *path; /* identifier for error messages */ - gzFile gz; - - if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL) - return NULL; -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(path, 7 + 3 * sizeof(int), "", fd); /* for debugging */ -#else - sprintf(path, "", fd); /* for debugging */ -#endif - gz = gz_open(path, fd, mode); - free(path); - return gz; -} - -/* -- see zlib.h -- */ -#ifdef _WIN32 -gzFile ZEXPORT gzopen_w(path, mode) - const wchar_t *path; - const char *mode; -{ - return gz_open(path, -2, mode); -} -#endif - -/* -- see zlib.h -- */ -int ZEXPORT gzbuffer(file, size) - gzFile file; - unsigned size; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* make sure we haven't already allocated memory */ - if (state->size != 0) - return -1; - - /* check and set requested size */ - if (size < 2) - size = 2; /* need two bytes to check magic header */ - state->want = size; - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzrewind(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* back up and start over */ - if (LSEEK(state->fd, state->start, SEEK_SET) == -1) - return -1; - gz_reset(state); - return 0; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gzseek64(file, offset, whence) - gzFile file; - z_off64_t offset; - int whence; -{ - unsigned n; - z_off64_t ret; - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* check that there's no error */ - if (state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - - /* can only seek from start or relative to current position */ - if (whence != SEEK_SET && whence != SEEK_CUR) - return -1; - - /* normalize offset to a SEEK_CUR specification */ - if (whence == SEEK_SET) - offset -= state->x.pos; - else if (state->seek) - offset += state->skip; - state->seek = 0; - - /* if within raw area while reading, just go there */ - if (state->mode == GZ_READ && state->how == COPY && - state->x.pos + offset >= 0) { - ret = LSEEK(state->fd, offset - state->x.have, SEEK_CUR); - if (ret == -1) - return -1; - state->x.have = 0; - state->eof = 0; - state->past = 0; - state->seek = 0; - gz_error(state, Z_OK, NULL); - state->strm.avail_in = 0; - state->x.pos += offset; - return state->x.pos; - } - - /* calculate skip amount, rewinding if needed for back seek when reading */ - if (offset < 0) { - if (state->mode != GZ_READ) /* writing -- can't go backwards */ - return -1; - offset += state->x.pos; - if (offset < 0) /* before start of file! */ - return -1; - if (gzrewind(file) == -1) /* rewind, then skip to offset */ - return -1; - } - - /* if reading, skip what's in output buffer (one less gzgetc() check) */ - if (state->mode == GZ_READ) { - n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > offset ? - (unsigned)offset : state->x.have; - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - offset -= n; - } - - /* request skip (if not zero) */ - if (offset) { - state->seek = 1; - state->skip = offset; - } - return state->x.pos + offset; -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gzseek(file, offset, whence) - gzFile file; - z_off_t offset; - int whence; -{ - z_off64_t ret; - - ret = gzseek64(file, (z_off64_t)offset, whence); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gztell64(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* return position */ - return state->x.pos + (state->seek ? state->skip : 0); -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gztell(file) - gzFile file; -{ - z_off64_t ret; - - ret = gztell64(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -z_off64_t ZEXPORT gzoffset64(file) - gzFile file; -{ - z_off64_t offset; - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return -1; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return -1; - - /* compute and return effective offset in file */ - offset = LSEEK(state->fd, 0, SEEK_CUR); - if (offset == -1) - return -1; - if (state->mode == GZ_READ) /* reading */ - offset -= state->strm.avail_in; /* don't count buffered input */ - return offset; -} - -/* -- see zlib.h -- */ -z_off_t ZEXPORT gzoffset(file) - gzFile file; -{ - z_off64_t ret; - - ret = gzoffset64(file); - return ret == (z_off_t)ret ? (z_off_t)ret : -1; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzeof(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return 0; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return 0; - - /* return end-of-file state */ - return state->mode == GZ_READ ? state->past : 0; -} - -/* -- see zlib.h -- */ -const char * ZEXPORT gzerror(file, errnum) - gzFile file; - int *errnum; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return NULL; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return NULL; - - /* return error information */ - if (errnum != NULL) - *errnum = state->err; - return state->err == Z_MEM_ERROR ? "out of memory" : - (state->msg == NULL ? "" : state->msg); -} - -/* -- see zlib.h -- */ -void ZEXPORT gzclearerr(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure and check integrity */ - if (file == NULL) - return; - state = (gz_statep)file; - if (state->mode != GZ_READ && state->mode != GZ_WRITE) - return; - - /* clear error and end-of-file */ - if (state->mode == GZ_READ) { - state->eof = 0; - state->past = 0; - } - gz_error(state, Z_OK, NULL); -} - -/* Create an error message in allocated memory and set state->err and - state->msg accordingly. Free any previous error message already there. Do - not try to free or allocate space if the error is Z_MEM_ERROR (out of - memory). Simply save the error message as a static string. If there is an - allocation failure constructing the error message, then convert the error to - out of memory. */ -void ZLIB_INTERNAL gz_error(state, err, msg) - gz_statep state; - int err; - const char *msg; -{ - /* free previously allocated message and clear */ - if (state->msg != NULL) { - if (state->err != Z_MEM_ERROR) - free(state->msg); - state->msg = NULL; - } - - /* if fatal, set state->x.have to 0 so that the gzgetc() macro fails */ - if (err != Z_OK && err != Z_BUF_ERROR) - state->x.have = 0; - - /* set error code, and if no message, then done */ - state->err = err; - if (msg == NULL) - return; - - /* for an out of memory error, return literal string when requested */ - if (err == Z_MEM_ERROR) - return; - - /* construct error message with path */ - if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) == - NULL) { - state->err = Z_MEM_ERROR; - return; - } -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, - "%s%s%s", state->path, ": ", msg); -#else - strcpy(state->msg, state->path); - strcat(state->msg, ": "); - strcat(state->msg, msg); -#endif - return; -} - -#ifndef INT_MAX -/* portably return maximum value for an int (when limits.h presumed not - available) -- we need to do this to cover cases where 2's complement not - used, since C standard permits 1's complement and sign-bit representations, - otherwise we could just use ((unsigned)-1) >> 1 */ -unsigned ZLIB_INTERNAL gz_intmax() -{ - unsigned p, q; - - p = 1; - do { - q = p; - p <<= 1; - p++; - } while (p > q); - return q >> 1; -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzread.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzread.c deleted file mode 100644 index d867e23..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzread.c +++ /dev/null @@ -1,594 +0,0 @@ -/* gzread.c -- zlib functions for reading gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* Local functions */ -local int gz_load OF((gz_statep, unsigned char *, unsigned, unsigned *)); -local int gz_avail OF((gz_statep)); -local int gz_look OF((gz_statep)); -local int gz_decomp OF((gz_statep)); -local int gz_fetch OF((gz_statep)); -local int gz_skip OF((gz_statep, z_off64_t)); - -/* Use read() to load a buffer -- return -1 on error, otherwise 0. Read from - state->fd, and update state->eof, state->err, and state->msg as appropriate. - This function needs to loop on read(), since read() is not guaranteed to - read the number of bytes requested, depending on the type of descriptor. */ -local int gz_load(state, buf, len, have) - gz_statep state; - unsigned char *buf; - unsigned len; - unsigned *have; -{ - int ret; - - *have = 0; - do { - ret = read(state->fd, buf + *have, len - *have); - if (ret <= 0) - break; - *have += ret; - } while (*have < len); - if (ret < 0) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (ret == 0) - state->eof = 1; - return 0; -} - -/* Load up input buffer and set eof flag if last data loaded -- return -1 on - error, 0 otherwise. Note that the eof flag is set when the end of the input - file is reached, even though there may be unused data in the buffer. Once - that data has been used, no more attempts will be made to read the file. - If strm->avail_in != 0, then the current data is moved to the beginning of - the input buffer, and then the remainder of the buffer is loaded with the - available data from the input file. */ -local int gz_avail(state) - gz_statep state; -{ - unsigned got; - z_streamp strm = &(state->strm); - - if (state->err != Z_OK && state->err != Z_BUF_ERROR) - return -1; - if (state->eof == 0) { - if (strm->avail_in) { /* copy what's there to the start */ - unsigned char *p = state->in; - unsigned const char *q = strm->next_in; - unsigned n = strm->avail_in; - do { - *p++ = *q++; - } while (--n); - } - if (gz_load(state, state->in + strm->avail_in, - state->size - strm->avail_in, &got) == -1) - return -1; - strm->avail_in += got; - strm->next_in = state->in; - } - return 0; -} - -/* Look for gzip header, set up for inflate or copy. state->x.have must be 0. - If this is the first time in, allocate required memory. state->how will be - left unchanged if there is no more input data available, will be set to COPY - if there is no gzip header and direct copying will be performed, or it will - be set to GZIP for decompression. If direct copying, then leftover input - data from the input buffer will be copied to the output buffer. In that - case, all further file reads will be directly to either the output buffer or - a user buffer. If decompressing, the inflate state will be initialized. - gz_look() will return 0 on success or -1 on failure. */ -local int gz_look(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - - /* allocate read buffers and inflate memory */ - if (state->size == 0) { - /* allocate buffers */ - state->in = (unsigned char *)malloc(state->want); - state->out = (unsigned char *)malloc(state->want << 1); - if (state->in == NULL || state->out == NULL) { - if (state->out != NULL) - free(state->out); - if (state->in != NULL) - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - state->size = state->want; - - /* allocate inflate memory */ - state->strm.zalloc = Z_NULL; - state->strm.zfree = Z_NULL; - state->strm.opaque = Z_NULL; - state->strm.avail_in = 0; - state->strm.next_in = Z_NULL; - if (inflateInit2(&(state->strm), 15 + 16) != Z_OK) { /* gunzip */ - free(state->out); - free(state->in); - state->size = 0; - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - } - - /* get at least the magic bytes in the input buffer */ - if (strm->avail_in < 2) { - if (gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) - return 0; - } - - /* look for gzip magic bytes -- if there, do gzip decoding (note: there is - a logical dilemma here when considering the case of a partially written - gzip file, to wit, if a single 31 byte is written, then we cannot tell - whether this is a single-byte file, or just a partially written gzip - file -- for here we assume that if a gzip file is being written, then - the header will be written in a single operation, so that reading a - single byte is sufficient indication that it is not a gzip file) */ - if (strm->avail_in > 1 && - strm->next_in[0] == 31 && strm->next_in[1] == 139) { - inflateReset(strm); - state->how = GZIP; - state->direct = 0; - return 0; - } - - /* no gzip header -- if we were decoding gzip before, then this is trailing - garbage. Ignore the trailing garbage and finish. */ - if (state->direct == 0) { - strm->avail_in = 0; - state->eof = 1; - state->x.have = 0; - return 0; - } - - /* doing raw i/o, copy any leftover input to output -- this assumes that - the output buffer is larger than the input buffer, which also assures - space for gzungetc() */ - state->x.next = state->out; - if (strm->avail_in) { - memcpy(state->x.next, strm->next_in, strm->avail_in); - state->x.have = strm->avail_in; - strm->avail_in = 0; - } - state->how = COPY; - state->direct = 1; - return 0; -} - -/* Decompress from input to the provided next_out and avail_out in the state. - On return, state->x.have and state->x.next point to the just decompressed - data. If the gzip stream completes, state->how is reset to LOOK to look for - the next gzip stream or raw data, once state->x.have is depleted. Returns 0 - on success, -1 on failure. */ -local int gz_decomp(state) - gz_statep state; -{ - int ret = Z_OK; - unsigned had; - z_streamp strm = &(state->strm); - - /* fill output buffer up to end of deflate stream */ - had = strm->avail_out; - do { - /* get more input for inflate() */ - if (strm->avail_in == 0 && gz_avail(state) == -1) - return -1; - if (strm->avail_in == 0) { - gz_error(state, Z_BUF_ERROR, "unexpected end of file"); - break; - } - - /* decompress and handle errors */ - ret = inflate(strm, Z_NO_FLUSH); - if (ret == Z_STREAM_ERROR || ret == Z_NEED_DICT) { - gz_error(state, Z_STREAM_ERROR, - "internal error: inflate stream corrupt"); - return -1; - } - if (ret == Z_MEM_ERROR) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - if (ret == Z_DATA_ERROR) { /* deflate stream invalid */ - gz_error(state, Z_DATA_ERROR, - strm->msg == NULL ? "compressed data error" : strm->msg); - return -1; - } - } while (strm->avail_out && ret != Z_STREAM_END); - - /* update available output */ - state->x.have = had - strm->avail_out; - state->x.next = strm->next_out - state->x.have; - - /* if the gzip stream completed successfully, look for another */ - if (ret == Z_STREAM_END) - state->how = LOOK; - - /* good decompression */ - return 0; -} - -/* Fetch data and put it in the output buffer. Assumes state->x.have is 0. - Data is either copied from the input file or decompressed from the input - file depending on state->how. If state->how is LOOK, then a gzip header is - looked for to determine whether to copy or decompress. Returns -1 on error, - otherwise 0. gz_fetch() will leave state->how as COPY or GZIP unless the - end of the input file has been reached and all data has been processed. */ -local int gz_fetch(state) - gz_statep state; -{ - z_streamp strm = &(state->strm); - - do { - switch(state->how) { - case LOOK: /* -> LOOK, COPY (only if never GZIP), or GZIP */ - if (gz_look(state) == -1) - return -1; - if (state->how == LOOK) - return 0; - break; - case COPY: /* -> COPY */ - if (gz_load(state, state->out, state->size << 1, &(state->x.have)) - == -1) - return -1; - state->x.next = state->out; - return 0; - case GZIP: /* -> GZIP or LOOK (if end of gzip stream) */ - strm->avail_out = state->size << 1; - strm->next_out = state->out; - if (gz_decomp(state) == -1) - return -1; - } - } while (state->x.have == 0 && (!state->eof || strm->avail_in)); - return 0; -} - -/* Skip len uncompressed bytes of output. Return -1 on error, 0 on success. */ -local int gz_skip(state, len) - gz_statep state; - z_off64_t len; -{ - unsigned n; - - /* skip over len bytes or reach end-of-file, whichever comes first */ - while (len) - /* skip over whatever is in output buffer */ - if (state->x.have) { - n = GT_OFF(state->x.have) || (z_off64_t)state->x.have > len ? - (unsigned)len : state->x.have; - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - len -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && state->strm.avail_in == 0) - break; - - /* need more data to skip -- load up output buffer */ - else { - /* get more output, looking for header if required */ - if (gz_fetch(state) == -1) - return -1; - } - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzread(file, buf, len) - gzFile file; - voidp buf; - unsigned len; -{ - unsigned got, n; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids the flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); - return -1; - } - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return -1; - } - - /* get len bytes to buf, or less than len if at the end */ - got = 0; - do { - /* first just try copying data from the output buffer */ - if (state->x.have) { - n = state->x.have > len ? len : state->x.have; - memcpy(buf, state->x.next, n); - state->x.next += n; - state->x.have -= n; - } - - /* output buffer empty -- return if we're at the end of the input */ - else if (state->eof && strm->avail_in == 0) { - state->past = 1; /* tried to read past end */ - break; - } - - /* need output data -- for small len or new stream load up our output - buffer */ - else if (state->how == LOOK || len < (state->size << 1)) { - /* get more output, looking for header if required */ - if (gz_fetch(state) == -1) - return -1; - continue; /* no progress yet -- go back to copy above */ - /* the copy above assures that we will leave with space in the - output buffer, allowing at least one gzungetc() to succeed */ - } - - /* large len -- read directly into user buffer */ - else if (state->how == COPY) { /* read directly */ - if (gz_load(state, (unsigned char *)buf, len, &n) == -1) - return -1; - } - - /* large len -- decompress directly into user buffer */ - else { /* state->how == GZIP */ - strm->avail_out = len; - strm->next_out = (unsigned char *)buf; - if (gz_decomp(state) == -1) - return -1; - n = state->x.have; - state->x.have = 0; - } - - /* update progress */ - len -= n; - buf = (char *)buf + n; - got += n; - state->x.pos += n; - } while (len); - - /* return number of bytes read into user buffer (will fit in int) */ - return (int)got; -} - -/* -- see zlib.h -- */ -#ifdef Z_PREFIX_SET -# undef z_gzgetc -#else -# undef gzgetc -#endif -int ZEXPORT gzgetc(file) - gzFile file; -{ - int ret; - unsigned char buf[1]; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* try output buffer (no need to check for skip request) */ - if (state->x.have) { - state->x.have--; - state->x.pos++; - return *(state->x.next)++; - } - - /* nothing there -- try gzread() */ - ret = gzread(file, buf, 1); - return ret < 1 ? -1 : buf[0]; -} - -int ZEXPORT gzgetc_(file) -gzFile file; -{ - return gzgetc(file); -} - -/* -- see zlib.h -- */ -int ZEXPORT gzungetc(c, file) - int c; - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return -1; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return -1; - } - - /* can't push EOF */ - if (c < 0) - return -1; - - /* if output buffer empty, put byte at end (allows more pushing) */ - if (state->x.have == 0) { - state->x.have = 1; - state->x.next = state->out + (state->size << 1) - 1; - state->x.next[0] = c; - state->x.pos--; - state->past = 0; - return c; - } - - /* if no room, give up (must have already done a gzungetc()) */ - if (state->x.have == (state->size << 1)) { - gz_error(state, Z_DATA_ERROR, "out of room to push characters"); - return -1; - } - - /* slide output data if needed and insert byte before existing data */ - if (state->x.next == state->out) { - unsigned char *src = state->out + state->x.have; - unsigned char *dest = state->out + (state->size << 1); - while (src > state->out) - *--dest = *--src; - state->x.next = dest; - } - state->x.have++; - state->x.next--; - state->x.next[0] = c; - state->x.pos--; - state->past = 0; - return c; -} - -/* -- see zlib.h -- */ -char * ZEXPORT gzgets(file, buf, len) - gzFile file; - char *buf; - int len; -{ - unsigned left, n; - char *str; - unsigned char *eol; - gz_statep state; - - /* check parameters and get internal structure */ - if (file == NULL || buf == NULL || len < 1) - return NULL; - state = (gz_statep)file; - - /* check that we're reading and that there's no (serious) error */ - if (state->mode != GZ_READ || - (state->err != Z_OK && state->err != Z_BUF_ERROR)) - return NULL; - - /* process a skip request */ - if (state->seek) { - state->seek = 0; - if (gz_skip(state, state->skip) == -1) - return NULL; - } - - /* copy output bytes up to new line or len - 1, whichever comes first -- - append a terminating zero to the string (we don't check for a zero in - the contents, let the user worry about that) */ - str = buf; - left = (unsigned)len - 1; - if (left) do { - /* assure that something is in the output buffer */ - if (state->x.have == 0 && gz_fetch(state) == -1) - return NULL; /* error */ - if (state->x.have == 0) { /* end of file */ - state->past = 1; /* read past end */ - break; /* return what we have */ - } - - /* look for end-of-line in current output buffer */ - n = state->x.have > left ? left : state->x.have; - eol = (unsigned char *)memchr(state->x.next, '\n', n); - if (eol != NULL) - n = (unsigned)(eol - state->x.next) + 1; - - /* copy through end-of-line, or remainder if not found */ - memcpy(buf, state->x.next, n); - state->x.have -= n; - state->x.next += n; - state->x.pos += n; - left -= n; - buf += n; - } while (left && eol == NULL); - - /* return terminated string, or if nothing, end of file */ - if (buf == str) - return NULL; - buf[0] = 0; - return str; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzdirect(file) - gzFile file; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - - /* if the state is not known, but we can find out, then do so (this is - mainly for right after a gzopen() or gzdopen()) */ - if (state->mode == GZ_READ && state->how == LOOK && state->x.have == 0) - (void)gz_look(state); - - /* return 1 if transparent, 0 if processing a gzip stream */ - return state->direct; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzclose_r(file) - gzFile file; -{ - int ret, err; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're reading */ - if (state->mode != GZ_READ) - return Z_STREAM_ERROR; - - /* free memory and close file */ - if (state->size) { - inflateEnd(&(state->strm)); - free(state->out); - free(state->in); - } - err = state->err == Z_BUF_ERROR ? Z_BUF_ERROR : Z_OK; - gz_error(state, Z_OK, NULL); - free(state->path); - ret = close(state->fd); - free(state); - return ret ? Z_ERRNO : err; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzwrite.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzwrite.c deleted file mode 100644 index d87a83a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/gzwrite.c +++ /dev/null @@ -1,577 +0,0 @@ -/* gzwrite.c -- zlib functions for writing gzip files - * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "gzguts.h" - -/* Local functions */ -local int gz_init OF((gz_statep)); -local int gz_comp OF((gz_statep, int)); -local int gz_zero OF((gz_statep, z_off64_t)); - -/* Initialize state for writing a gzip file. Mark initialization by setting - state->size to non-zero. Return -1 on failure or 0 on success. */ -local int gz_init(state) - gz_statep state; -{ - int ret; - z_streamp strm = &(state->strm); - - /* allocate input buffer */ - state->in = (unsigned char *)malloc(state->want); - if (state->in == NULL) { - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* only need output buffer and deflate state if compressing */ - if (!state->direct) { - /* allocate output buffer */ - state->out = (unsigned char *)malloc(state->want); - if (state->out == NULL) { - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - - /* allocate deflate memory, set up for gzip compression */ - strm->zalloc = Z_NULL; - strm->zfree = Z_NULL; - strm->opaque = Z_NULL; - ret = deflateInit2(strm, state->level, Z_DEFLATED, - MAX_WBITS + 16, DEF_MEM_LEVEL, state->strategy); - if (ret != Z_OK) { - free(state->out); - free(state->in); - gz_error(state, Z_MEM_ERROR, "out of memory"); - return -1; - } - } - - /* mark state as initialized */ - state->size = state->want; - - /* initialize write buffer if compressing */ - if (!state->direct) { - strm->avail_out = state->size; - strm->next_out = state->out; - state->x.next = strm->next_out; - } - return 0; -} - -/* Compress whatever is at avail_in and next_in and write to the output file. - Return -1 if there is an error writing to the output file, otherwise 0. - flush is assumed to be a valid deflate() flush value. If flush is Z_FINISH, - then the deflate() state is reset to start a new gzip stream. If gz->direct - is true, then simply write to the output file without compressing, and - ignore flush. */ -local int gz_comp(state, flush) - gz_statep state; - int flush; -{ - int ret, got; - unsigned have; - z_streamp strm = &(state->strm); - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return -1; - - /* write directly if requested */ - if (state->direct) { - got = write(state->fd, strm->next_in, strm->avail_in); - if (got < 0 || (unsigned)got != strm->avail_in) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - strm->avail_in = 0; - return 0; - } - - /* run deflate() on provided input until it produces no more output */ - ret = Z_OK; - do { - /* write out current buffer contents if full, or if flushing, but if - doing Z_FINISH then don't write until we get to Z_STREAM_END */ - if (strm->avail_out == 0 || (flush != Z_NO_FLUSH && - (flush != Z_FINISH || ret == Z_STREAM_END))) { - have = (unsigned)(strm->next_out - state->x.next); - if (have && ((got = write(state->fd, state->x.next, have)) < 0 || - (unsigned)got != have)) { - gz_error(state, Z_ERRNO, zstrerror()); - return -1; - } - if (strm->avail_out == 0) { - strm->avail_out = state->size; - strm->next_out = state->out; - } - state->x.next = strm->next_out; - } - - /* compress */ - have = strm->avail_out; - ret = deflate(strm, flush); - if (ret == Z_STREAM_ERROR) { - gz_error(state, Z_STREAM_ERROR, - "internal error: deflate stream corrupt"); - return -1; - } - have -= strm->avail_out; - } while (have); - - /* if that completed a deflate stream, allow another to start */ - if (flush == Z_FINISH) - deflateReset(strm); - - /* all done, no errors */ - return 0; -} - -/* Compress len zeros to output. Return -1 on error, 0 on success. */ -local int gz_zero(state, len) - gz_statep state; - z_off64_t len; -{ - int first; - unsigned n; - z_streamp strm = &(state->strm); - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - - /* compress len zeros (len guaranteed > 0) */ - first = 1; - while (len) { - n = GT_OFF(state->size) || (z_off64_t)state->size > len ? - (unsigned)len : state->size; - if (first) { - memset(state->in, 0, n); - first = 0; - } - strm->avail_in = n; - strm->next_in = state->in; - state->x.pos += n; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return -1; - len -= n; - } - return 0; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzwrite(file, buf, len) - gzFile file; - voidpc buf; - unsigned len; -{ - unsigned put = len; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return 0; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* since an int is returned, make sure len fits in one, otherwise return - with an error (this avoids the flaw in the interface) */ - if ((int)len < 0) { - gz_error(state, Z_DATA_ERROR, "requested length does not fit in int"); - return 0; - } - - /* if len is zero, avoid unnecessary operations */ - if (len == 0) - return 0; - - /* allocate memory if this is the first time through */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* for small len, copy to input buffer, otherwise compress directly */ - if (len < state->size) { - /* copy to input buffer, compress when full */ - do { - unsigned have, copy; - - if (strm->avail_in == 0) - strm->next_in = state->in; - have = (unsigned)((strm->next_in + strm->avail_in) - state->in); - copy = state->size - have; - if (copy > len) - copy = len; - memcpy(state->in + have, buf, copy); - strm->avail_in += copy; - state->x.pos += copy; - buf = (const char *)buf + copy; - len -= copy; - if (len && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - } while (len); - } - else { - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* directly compress user buffer to file */ - strm->avail_in = len; - strm->next_in = (z_const Bytef *)buf; - state->x.pos += len; - if (gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - } - - /* input was all buffered or compressed (put will fit in int) */ - return (int)put; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzputc(file, c) - gzFile file; - int c; -{ - unsigned have; - unsigned char buf[1]; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return -1; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* try writing to input buffer for speed (state->size == 0 if buffer not - initialized) */ - if (state->size) { - if (strm->avail_in == 0) - strm->next_in = state->in; - have = (unsigned)((strm->next_in + strm->avail_in) - state->in); - if (have < state->size) { - state->in[have] = c; - strm->avail_in++; - state->x.pos++; - return c & 0xff; - } - } - - /* no room in buffer or not initialized, use gz_write() */ - buf[0] = c; - if (gzwrite(file, buf, 1) != 1) - return -1; - return c & 0xff; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzputs(file, str) - gzFile file; - const char *str; -{ - int ret; - unsigned len; - - /* write string */ - len = (unsigned)strlen(str); - ret = gzwrite(file, str, len); - return ret == 0 && len != 0 ? -1 : ret; -} - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -#include - -/* -- see zlib.h -- */ -int ZEXPORTVA gzvprintf(gzFile file, const char *format, va_list va) -{ - int size, len; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* do the printf() into the input buffer, put length in len */ - size = (int)(state->size); - state->in[size - 1] = 0; -#ifdef NO_vsnprintf -# ifdef HAS_vsprintf_void - (void)vsprintf((char *)(state->in), format, va); - for (len = 0; len < size; len++) - if (state->in[len] == 0) break; -# else - len = vsprintf((char *)(state->in), format, va); -# endif -#else -# ifdef HAS_vsnprintf_void - (void)vsnprintf((char *)(state->in), size, format, va); - len = strlen((char *)(state->in)); -# else - len = vsnprintf((char *)(state->in), size, format, va); -# endif -#endif - - /* check that printf() results fit in buffer */ - if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) - return 0; - - /* update buffer and position, defer compression until needed */ - strm->avail_in = (unsigned)len; - strm->next_in = state->in; - state->x.pos += len; - return len; -} - -int ZEXPORTVA gzprintf(gzFile file, const char *format, ...) -{ - va_list va; - int ret; - - va_start(va, format); - ret = gzvprintf(file, format, va); - va_end(va); - return ret; -} - -#else /* !STDC && !Z_HAVE_STDARG_H */ - -/* -- see zlib.h -- */ -int ZEXPORTVA gzprintf (file, format, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20) - gzFile file; - const char *format; - int a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, - a11, a12, a13, a14, a15, a16, a17, a18, a19, a20; -{ - int size, len; - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that can really pass pointer in ints */ - if (sizeof(int) != sizeof(void *)) - return 0; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return 0; - - /* make sure we have some buffer space */ - if (state->size == 0 && gz_init(state) == -1) - return 0; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return 0; - } - - /* consume whatever's left in the input buffer */ - if (strm->avail_in && gz_comp(state, Z_NO_FLUSH) == -1) - return 0; - - /* do the printf() into the input buffer, put length in len */ - size = (int)(state->size); - state->in[size - 1] = 0; -#ifdef NO_snprintf -# ifdef HAS_sprintf_void - sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - for (len = 0; len < size; len++) - if (state->in[len] == 0) break; -# else - len = sprintf((char *)(state->in), format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); -# endif -#else -# ifdef HAS_snprintf_void - snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, a7, a8, - a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, a19, a20); - len = strlen((char *)(state->in)); -# else - len = snprintf((char *)(state->in), size, format, a1, a2, a3, a4, a5, a6, - a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18, - a19, a20); -# endif -#endif - - /* check that printf() results fit in buffer */ - if (len <= 0 || len >= (int)size || state->in[size - 1] != 0) - return 0; - - /* update buffer and position, defer compression until needed */ - strm->avail_in = (unsigned)len; - strm->next_in = state->in; - state->x.pos += len; - return len; -} - -#endif - -/* -- see zlib.h -- */ -int ZEXPORT gzflush(file, flush) - gzFile file; - int flush; -{ - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return -1; - state = (gz_statep)file; - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* check flush parameter */ - if (flush < 0 || flush > Z_FINISH) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* compress remaining data with requested flush */ - gz_comp(state, flush); - return state->err; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzsetparams(file, level, strategy) - gzFile file; - int level; - int strategy; -{ - gz_statep state; - z_streamp strm; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - strm = &(state->strm); - - /* check that we're writing and that there's no error */ - if (state->mode != GZ_WRITE || state->err != Z_OK) - return Z_STREAM_ERROR; - - /* if no change is requested, then do nothing */ - if (level == state->level && strategy == state->strategy) - return Z_OK; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - return -1; - } - - /* change compression parameters for subsequent input */ - if (state->size) { - /* flush previous input with previous parameters before changing */ - if (strm->avail_in && gz_comp(state, Z_PARTIAL_FLUSH) == -1) - return state->err; - deflateParams(strm, level, strategy); - } - state->level = level; - state->strategy = strategy; - return Z_OK; -} - -/* -- see zlib.h -- */ -int ZEXPORT gzclose_w(file) - gzFile file; -{ - int ret = Z_OK; - gz_statep state; - - /* get internal structure */ - if (file == NULL) - return Z_STREAM_ERROR; - state = (gz_statep)file; - - /* check that we're writing */ - if (state->mode != GZ_WRITE) - return Z_STREAM_ERROR; - - /* check for seek request */ - if (state->seek) { - state->seek = 0; - if (gz_zero(state, state->skip) == -1) - ret = state->err; - } - - /* flush, free memory, and close file */ - if (gz_comp(state, Z_FINISH) == -1) - ret = state->err; - if (state->size) { - if (!state->direct) { - (void)deflateEnd(&(state->strm)); - free(state->out); - } - free(state->in); - } - gz_error(state, Z_OK, NULL); - free(state->path); - if (close(state->fd) == -1) - ret = Z_ERRNO; - free(state); - return ret; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/infback.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/infback.c deleted file mode 100644 index aa42a00..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/infback.c +++ /dev/null @@ -1,640 +0,0 @@ -/* infback.c -- inflate using a call-back interface - * Copyright (C) 1995-2011 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - This code is largely copied from inflate.c. Normally either infback.o or - inflate.o would be linked into an application--not both. The interface - with inffast.c is retained so that optimized assembler-coded versions of - inflate_fast() can be used with either inflate.c or infback.c. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); - -/* - strm provides memory allocation functions in zalloc and zfree, or - Z_NULL to use the library memory allocation functions. - - windowBits is in the range 8..15, and window is a user-supplied - window and output buffer that is 2**windowBits bytes. - */ -int ZEXPORT inflateBackInit_(strm, windowBits, window, version, stream_size) -z_streamp strm; -int windowBits; -unsigned char FAR *window; -const char *version; -int stream_size; -{ - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL || window == Z_NULL || - windowBits < 8 || windowBits > 15) - return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - state = (struct inflate_state FAR *)ZALLOC(strm, 1, - sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->dmax = 32768U; - state->wbits = windowBits; - state->wsize = 1U << windowBits; - state->window = window; - state->wnext = 0; - state->whave = 0; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -/* Macros for inflateBack(): */ - -/* Load returned state from inflate_fast() */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Set state from registers for inflate_fast() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Assure that some input is available. If input is requested, but denied, - then return a Z_BUF_ERROR from inflateBack(). */ -#define PULL() \ - do { \ - if (have == 0) { \ - have = in(in_desc, &next); \ - if (have == 0) { \ - next = Z_NULL; \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflateBack() - with an error if there is no input available. */ -#define PULLBYTE() \ - do { \ - PULL(); \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflateBack() with - an error. */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* Assure that some output space is available, by writing out the window - if it's full. If the write fails, return from inflateBack() with a - Z_BUF_ERROR. */ -#define ROOM() \ - do { \ - if (left == 0) { \ - put = state->window; \ - left = state->wsize; \ - state->whave = left; \ - if (out(out_desc, put, left)) { \ - ret = Z_BUF_ERROR; \ - goto inf_leave; \ - } \ - } \ - } while (0) - -/* - strm provides the memory allocation functions and window buffer on input, - and provides information on the unused input on return. For Z_DATA_ERROR - returns, strm will also provide an error message. - - in() and out() are the call-back input and output functions. When - inflateBack() needs more input, it calls in(). When inflateBack() has - filled the window with output, or when it completes with data in the - window, it calls out() to write out the data. The application must not - change the provided input until in() is called again or inflateBack() - returns. The application must not change the window/output buffer until - inflateBack() returns. - - in() and out() are called with a descriptor parameter provided in the - inflateBack() call. This parameter can be a structure that provides the - information required to do the read or write, as well as accumulated - information on the input and output such as totals and check values. - - in() should return zero on failure. out() should return non-zero on - failure. If either in() or out() fails, than inflateBack() returns a - Z_BUF_ERROR. strm->next_in can be checked for Z_NULL to see whether it - was in() or out() that caused in the error. Otherwise, inflateBack() - returns Z_STREAM_END on success, Z_DATA_ERROR for an deflate format - error, or Z_MEM_ERROR if it could not allocate memory for the state. - inflateBack() can also return Z_STREAM_ERROR if the input parameters - are not correct, i.e. strm is Z_NULL or the state was not initialized. - */ -int ZEXPORT inflateBack(strm, in, in_desc, out, out_desc) -z_streamp strm; -in_func in; -void FAR *in_desc; -out_func out; -void FAR *out_desc; -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - /* Check that the strm exists and that the state was initialized */ - if (strm == Z_NULL || strm->state == Z_NULL) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* Reset the state */ - strm->msg = Z_NULL; - state->mode = TYPE; - state->last = 0; - state->whave = 0; - next = strm->next_in; - have = next != Z_NULL ? strm->avail_in : 0; - hold = 0; - bits = 0; - put = state->window; - left = state->wsize; - - /* Inflate until end of block marked as last */ - for (;;) - switch (state->mode) { - case TYPE: - /* determine and dispatch block type */ - if (state->last) { - BYTEBITS(); - state->mode = DONE; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN; /* decode codes */ - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - - case STORED: - /* get and verify stored block length */ - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - - /* copy stored block from input to output */ - while (state->length != 0) { - copy = state->length; - PULL(); - ROOM(); - if (copy > have) copy = have; - if (copy > left) copy = left; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - - case TABLE: - /* get dynamic table entries descriptor */ - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - - /* get code length code lengths (not a typo) */ - state->have = 0; - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - - /* get length and distance code code lengths */ - state->have = 0; - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = (unsigned)(state->lens[state->have - 1]); - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (code const FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (code const FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN; - - case LEN: - /* use inflate_fast() if we have enough input and output */ - if (have >= 6 && left >= 258) { - RESTORE(); - if (state->whave < state->wsize) - state->whave = state->wsize - left; - inflate_fast(strm, state->wsize); - LOAD(); - break; - } - - /* get a literal, length, or end-of-block code */ - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - state->length = (unsigned)here.val; - - /* process literal */ - if (here.op == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - ROOM(); - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - } - - /* process end of block */ - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - - /* invalid code */ - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - - /* length code -- get extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - - /* get distance code */ - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - } - DROPBITS(here.bits); - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - - /* get distance extra bits, if any */ - state->extra = (unsigned)(here.op) & 15; - if (state->extra != 0) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - } - if (state->offset > state->wsize - (state->whave < state->wsize ? - left : 0)) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - - /* copy match from window to output */ - do { - ROOM(); - copy = state->wsize - state->offset; - if (copy < left) { - from = put + copy; - copy = left - copy; - } - else { - from = put - state->offset; - copy = left; - } - if (copy > state->length) copy = state->length; - state->length -= copy; - left -= copy; - do { - *put++ = *from++; - } while (--copy); - } while (state->length != 0); - break; - - case DONE: - /* inflate stream terminated properly -- write leftover output */ - ret = Z_STREAM_END; - if (left < state->wsize) { - if (out(out_desc, state->window, state->wsize - left)) - ret = Z_BUF_ERROR; - } - goto inf_leave; - - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - - default: /* can't happen, but makes compilers happy */ - ret = Z_STREAM_ERROR; - goto inf_leave; - } - - /* Return unused input */ - inf_leave: - strm->next_in = next; - strm->avail_in = have; - return ret; -} - -int ZEXPORT inflateBackEnd(strm) -z_streamp strm; -{ - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.c deleted file mode 100644 index 38446d8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.c +++ /dev/null @@ -1,340 +0,0 @@ -/* inffast.c -- fast decoding - * Copyright (C) 1995-2008, 2010, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifndef ASMINF - -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ -#ifdef POSTINC -# define OFF 0 -# define PUP(a) *(a)++ -#else -# define OFF 1 -# define PUP(a) *++(a) -#endif - -/* - Decode literal, length, and distance codes and write out the resulting - literal and match bytes until either not enough input or output is - available, an end-of-block is encountered, or a data error is encountered. - When large enough input and output buffers are supplied to inflate(), for - example, a 16K input buffer and a 64K output buffer, more than 95% of the - inflate execution time is spent in this routine. - - Entry assumptions: - - state->mode == LEN - strm->avail_in >= 6 - strm->avail_out >= 258 - start >= strm->avail_out - state->bits < 8 - - On return, state->mode is one of: - - LEN -- ran out of enough output space or enough available input - TYPE -- reached end of block code, inflate() to interpret next block - BAD -- error in block data - - Notes: - - - The maximum input bits used by a length/distance pair is 15 bits for the - length code, 5 bits for the length extra, 15 bits for the distance code, - and 13 bits for the distance extra. This totals 48 bits, or six bytes. - Therefore if strm->avail_in >= 6, then there is enough input to avoid - checking for available input while decoding. - - - The maximum bytes that a single length/distance pair can output is 258 - bytes, which is the maximum length that can be coded. inflate_fast() - requires strm->avail_out >= 258 for each loop to avoid checking for - output space. - */ -void ZLIB_INTERNAL inflate_fast(strm, start) -z_streamp strm; -unsigned start; /* inflate()'s starting value for strm->avail_out */ -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *in; /* local strm->next_in */ - z_const unsigned char FAR *last; /* have enough input while in < last */ - unsigned char FAR *out; /* local strm->next_out */ - unsigned char FAR *beg; /* inflate()'s initial strm->next_out */ - unsigned char FAR *end; /* while out < end, enough space available */ -#ifdef INFLATE_STRICT - unsigned dmax; /* maximum distance from zlib header */ -#endif - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if wsize != 0 */ - unsigned long hold; /* local strm->hold */ - unsigned bits; /* local strm->bits */ - code const FAR *lcode; /* local strm->lencode */ - code const FAR *dcode; /* local strm->distcode */ - unsigned lmask; /* mask for first level of length codes */ - unsigned dmask; /* mask for first level of distance codes */ - code here; /* retrieved table entry */ - unsigned op; /* code bits, operation, extra bits, or */ - /* window position, window bytes to copy */ - unsigned len; /* match length, unused bytes */ - unsigned dist; /* match distance */ - unsigned char FAR *from; /* where to copy match from */ - - /* copy state to local variables */ - state = (struct inflate_state FAR *)strm->state; - in = strm->next_in - OFF; - last = in + (strm->avail_in - 5); - out = strm->next_out - OFF; - beg = out - (start - strm->avail_out); - end = out + (strm->avail_out - 257); -#ifdef INFLATE_STRICT - dmax = state->dmax; -#endif - wsize = state->wsize; - whave = state->whave; - wnext = state->wnext; - window = state->window; - hold = state->hold; - bits = state->bits; - lcode = state->lencode; - dcode = state->distcode; - lmask = (1U << state->lenbits) - 1; - dmask = (1U << state->distbits) - 1; - - /* decode literals and length/distances until end-of-block or not enough - input data or output space */ - do { - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - here = lcode[hold & lmask]; - dolen: - op = (unsigned)(here.bits); - hold >>= op; - bits -= op; - op = (unsigned)(here.op); - if (op == 0) { /* literal */ - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - PUP(out) = (unsigned char)(here.val); - } - else if (op & 16) { /* length base */ - len = (unsigned)(here.val); - op &= 15; /* number of extra bits */ - if (op) { - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - len += (unsigned)hold & ((1U << op) - 1); - hold >>= op; - bits -= op; - } - Tracevv((stderr, "inflate: length %u\n", len)); - if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - here = dcode[hold & dmask]; - dodist: - op = (unsigned)(here.bits); - hold >>= op; - bits -= op; - op = (unsigned)(here.op); - if (op & 16) { /* distance base */ - dist = (unsigned)(here.val); - op &= 15; /* number of extra bits */ - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - if (bits < op) { - hold += (unsigned long)(PUP(in)) << bits; - bits += 8; - } - } - dist += (unsigned)hold & ((1U << op) - 1); -#ifdef INFLATE_STRICT - if (dist > dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - hold >>= op; - bits -= op; - Tracevv((stderr, "inflate: distance %u\n", dist)); - op = (unsigned)(out - beg); /* max distance in output */ - if (dist > op) { /* see if copy from window */ - op = dist - op; /* distance back in window */ - if (op > whave) { - if (state->sane) { - strm->msg = - (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - if (len <= op - whave) { - do { - PUP(out) = 0; - } while (--len); - continue; - } - len -= op - whave; - do { - PUP(out) = 0; - } while (--op > whave); - if (op == 0) { - from = out - dist; - do { - PUP(out) = PUP(from); - } while (--len); - continue; - } -#endif - } - from = window - OFF; - if (wnext == 0) { /* very common case */ - from += wsize - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - else if (wnext < op) { /* wrap around window */ - from += wsize + wnext - op; - op -= wnext; - if (op < len) { /* some from end of window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = window - OFF; - if (wnext < len) { /* some from start of window */ - op = wnext; - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - } - else { /* contiguous in window */ - from += wnext - op; - if (op < len) { /* some from window */ - len -= op; - do { - PUP(out) = PUP(from); - } while (--op); - from = out - dist; /* rest from output */ - } - } - while (len > 2) { - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - else { - from = out - dist; /* copy direct from output */ - do { /* minimum length is three */ - PUP(out) = PUP(from); - PUP(out) = PUP(from); - PUP(out) = PUP(from); - len -= 3; - } while (len > 2); - if (len) { - PUP(out) = PUP(from); - if (len > 1) - PUP(out) = PUP(from); - } - } - } - else if ((op & 64) == 0) { /* 2nd level distance code */ - here = dcode[here.val + (hold & ((1U << op) - 1))]; - goto dodist; - } - else { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - } - else if ((op & 64) == 0) { /* 2nd level length code */ - here = lcode[here.val + (hold & ((1U << op) - 1))]; - goto dolen; - } - else if (op & 32) { /* end-of-block */ - Tracevv((stderr, "inflate: end of block\n")); - state->mode = TYPE; - break; - } - else { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - } while (in < last && out < end); - - /* return unused bytes (on entry, bits < 8, so in won't go too far back) */ - len = bits >> 3; - in -= len; - bits -= len << 3; - hold &= (1U << bits) - 1; - - /* update state and return */ - strm->next_in = in + OFF; - strm->next_out = out + OFF; - strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last)); - strm->avail_out = (unsigned)(out < end ? - 257 + (end - out) : 257 - (out - end)); - state->hold = hold; - state->bits = bits; - return; -} - -/* - inflate_fast() speedups that turned out slower (on a PowerPC G3 750CXe): - - Using bit fields for code structure - - Different op definition to avoid & for extra bits (do & for table bits) - - Three separate decoding do-loops for direct, window, and wnext == 0 - - Special case for distance > 1 copies to do overlapped load and store copy - - Explicit branch predictions (based on measured branch probabilities) - - Deferring match copy and interspersed it with decoding subsequent codes - - Swapping literal/length else - - Swapping window/direct else - - Larger unrolled copy loops (three is about right) - - Moving len -= 3 statement into middle of loop - */ - -#endif /* !ASMINF */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.h deleted file mode 100644 index e1e6db4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffast.h +++ /dev/null @@ -1,11 +0,0 @@ -/* inffast.h -- header to use inffast.c - * Copyright (C) 1995-2003, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -void ZLIB_INTERNAL inflate_fast OF((z_streamp strm, unsigned start)); diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffixed.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffixed.h deleted file mode 100644 index 0b29a5a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inffixed.h +++ /dev/null @@ -1,94 +0,0 @@ - /* inffixed.h -- table for decoding fixed codes - * Generated automatically by makefixed(). - */ - - /* WARNING: this file should *not* be used by applications. - It is part of the implementation of this library and is - subject to change. Applications should only use zlib.h. - */ - - static const code lenfix[512] = { - {96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48}, - {0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128}, - {0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59}, - {0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176}, - {0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20}, - {21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100}, - {0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8}, - {0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216}, - {18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76}, - {0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114}, - {0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2}, - {0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148}, - {20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42}, - {0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86}, - {0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15}, - {0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236}, - {16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62}, - {0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142}, - {0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31}, - {0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162}, - {0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25}, - {0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105}, - {0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4}, - {0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202}, - {17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69}, - {0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125}, - {0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13}, - {0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195}, - {19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35}, - {0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91}, - {0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19}, - {0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246}, - {16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55}, - {0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135}, - {0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99}, - {0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190}, - {0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16}, - {20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96}, - {0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6}, - {0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209}, - {17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72}, - {0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116}, - {0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4}, - {0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153}, - {20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44}, - {0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82}, - {0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11}, - {0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229}, - {16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58}, - {0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138}, - {0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51}, - {0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173}, - {0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30}, - {0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110}, - {0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0}, - {0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195}, - {16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65}, - {0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121}, - {0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9}, - {0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258}, - {19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37}, - {0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93}, - {0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23}, - {0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251}, - {16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51}, - {0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131}, - {0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67}, - {0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183}, - {0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23}, - {64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103}, - {0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9}, - {0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223}, - {18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79}, - {0,9,255} - }; - - static const code distfix[32] = { - {16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025}, - {21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193}, - {18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385}, - {19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577}, - {16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073}, - {22,5,193},{64,5,0} - }; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.c deleted file mode 100644 index e43d999..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.c +++ /dev/null @@ -1,1512 +0,0 @@ -/* inflate.c -- zlib decompression - * Copyright (C) 1995-2012 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * Change history: - * - * 1.2.beta0 24 Nov 2002 - * - First version -- complete rewrite of inflate to simplify code, avoid - * creation of window when not needed, minimize use of window when it is - * needed, make inffast.c even faster, implement gzip decoding, and to - * improve code readability and style over the previous zlib inflate code - * - * 1.2.beta1 25 Nov 2002 - * - Use pointers for available input and output checking in inffast.c - * - Remove input and output counters in inffast.c - * - Change inffast.c entry and loop from avail_in >= 7 to >= 6 - * - Remove unnecessary second byte pull from length extra in inffast.c - * - Unroll direct copy to three copies per loop in inffast.c - * - * 1.2.beta2 4 Dec 2002 - * - Change external routine names to reduce potential conflicts - * - Correct filename to inffixed.h for fixed tables in inflate.c - * - Make hbuf[] unsigned char to match parameter type in inflate.c - * - Change strm->next_out[-state->offset] to *(strm->next_out - state->offset) - * to avoid negation problem on Alphas (64 bit) in inflate.c - * - * 1.2.beta3 22 Dec 2002 - * - Add comments on state->bits assertion in inffast.c - * - Add comments on op field in inftrees.h - * - Fix bug in reuse of allocated window after inflateReset() - * - Remove bit fields--back to byte structure for speed - * - Remove distance extra == 0 check in inflate_fast()--only helps for lengths - * - Change post-increments to pre-increments in inflate_fast(), PPC biased? - * - Add compile time option, POSTINC, to use post-increments instead (Intel?) - * - Make MATCH copy in inflate() much faster for when inflate_fast() not used - * - Use local copies of stream next and avail values, as well as local bit - * buffer and bit count in inflate()--for speed when inflate_fast() not used - * - * 1.2.beta4 1 Jan 2003 - * - Split ptr - 257 statements in inflate_table() to avoid compiler warnings - * - Move a comment on output buffer sizes from inffast.c to inflate.c - * - Add comments in inffast.c to introduce the inflate_fast() routine - * - Rearrange window copies in inflate_fast() for speed and simplification - * - Unroll last copy for window match in inflate_fast() - * - Use local copies of window variables in inflate_fast() for speed - * - Pull out common wnext == 0 case for speed in inflate_fast() - * - Make op and len in inflate_fast() unsigned for consistency - * - Add FAR to lcode and dcode declarations in inflate_fast() - * - Simplified bad distance check in inflate_fast() - * - Added inflateBackInit(), inflateBack(), and inflateBackEnd() in new - * source file infback.c to provide a call-back interface to inflate for - * programs like gzip and unzip -- uses window as output buffer to avoid - * window copying - * - * 1.2.beta5 1 Jan 2003 - * - Improved inflateBack() interface to allow the caller to provide initial - * input in strm. - * - Fixed stored blocks bug in inflateBack() - * - * 1.2.beta6 4 Jan 2003 - * - Added comments in inffast.c on effectiveness of POSTINC - * - Typecasting all around to reduce compiler warnings - * - Changed loops from while (1) or do {} while (1) to for (;;), again to - * make compilers happy - * - Changed type of window in inflateBackInit() to unsigned char * - * - * 1.2.beta7 27 Jan 2003 - * - Changed many types to unsigned or unsigned short to avoid warnings - * - Added inflateCopy() function - * - * 1.2.0 9 Mar 2003 - * - Changed inflateBack() interface to provide separate opaque descriptors - * for the in() and out() functions - * - Changed inflateBack() argument and in_func typedef to swap the length - * and buffer address return values for the input function - * - Check next_in and next_out for Z_NULL on entry to inflate() - * - * The history for versions after 1.2.0 are in ChangeLog in zlib distribution. - */ - -#include "zutil.h" -#include "inftrees.h" -#include "inflate.h" -#include "inffast.h" - -#ifdef MAKEFIXED -# ifndef BUILDFIXED -# define BUILDFIXED -# endif -#endif - -/* function prototypes */ -local void fixedtables OF((struct inflate_state FAR *state)); -local int updatewindow OF((z_streamp strm, const unsigned char FAR *end, - unsigned copy)); -#ifdef BUILDFIXED - void makefixed OF((void)); -#endif -local unsigned syncsearch OF((unsigned FAR *have, const unsigned char FAR *buf, - unsigned len)); - -int ZEXPORT inflateResetKeep(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - strm->total_in = strm->total_out = state->total = 0; - strm->msg = Z_NULL; - if (state->wrap) /* to support ill-conceived Java test suite */ - strm->adler = state->wrap & 1; - state->mode = HEAD; - state->last = 0; - state->havedict = 0; - state->dmax = 32768U; - state->head = Z_NULL; - state->hold = 0; - state->bits = 0; - state->lencode = state->distcode = state->next = state->codes; - state->sane = 1; - state->back = -1; - Tracev((stderr, "inflate: reset\n")); - return Z_OK; -} - -int ZEXPORT inflateReset(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - state->wsize = 0; - state->whave = 0; - state->wnext = 0; - return inflateResetKeep(strm); -} - -int ZEXPORT inflateReset2(strm, windowBits) -z_streamp strm; -int windowBits; -{ - int wrap; - struct inflate_state FAR *state; - - /* get the state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* extract wrap request from windowBits parameter */ - if (windowBits < 0) { - wrap = 0; - windowBits = -windowBits; - } - else { - wrap = (windowBits >> 4) + 1; -#ifdef GUNZIP - if (windowBits < 48) - windowBits &= 15; -#endif - } - - /* set number of window bits, free window if different */ - if (windowBits && (windowBits < 8 || windowBits > 15)) - return Z_STREAM_ERROR; - if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { - ZFREE(strm, state->window); - state->window = Z_NULL; - } - - /* update state and reset the rest of it */ - state->wrap = wrap; - state->wbits = (unsigned)windowBits; - return inflateReset(strm); -} - -int ZEXPORT inflateInit2_(strm, windowBits, version, stream_size) -z_streamp strm; -int windowBits; -const char *version; -int stream_size; -{ - int ret; - struct inflate_state FAR *state; - - if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || - stream_size != (int)(sizeof(z_stream))) - return Z_VERSION_ERROR; - if (strm == Z_NULL) return Z_STREAM_ERROR; - strm->msg = Z_NULL; /* in case we return an error */ - if (strm->zalloc == (alloc_func)0) { -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zalloc = zcalloc; - strm->opaque = (voidpf)0; -#endif - } - if (strm->zfree == (free_func)0) -#ifdef Z_SOLO - return Z_STREAM_ERROR; -#else - strm->zfree = zcfree; -#endif - state = (struct inflate_state FAR *) - ZALLOC(strm, 1, sizeof(struct inflate_state)); - if (state == Z_NULL) return Z_MEM_ERROR; - Tracev((stderr, "inflate: allocated\n")); - strm->state = (struct internal_state FAR *)state; - state->window = Z_NULL; - ret = inflateReset2(strm, windowBits); - if (ret != Z_OK) { - ZFREE(strm, state); - strm->state = Z_NULL; - } - return ret; -} - -int ZEXPORT inflateInit_(strm, version, stream_size) -z_streamp strm; -const char *version; -int stream_size; -{ - return inflateInit2_(strm, DEF_WBITS, version, stream_size); -} - -int ZEXPORT inflatePrime(strm, bits, value) -z_streamp strm; -int bits; -int value; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (bits < 0) { - state->hold = 0; - state->bits = 0; - return Z_OK; - } - if (bits > 16 || state->bits + bits > 32) return Z_STREAM_ERROR; - value &= (1L << bits) - 1; - state->hold += value << state->bits; - state->bits += bits; - return Z_OK; -} - -/* - Return state with length and distance decoding tables and index sizes set to - fixed code decoding. Normally this returns fixed tables from inffixed.h. - If BUILDFIXED is defined, then instead this routine builds the tables the - first time it's called, and returns those tables the first time and - thereafter. This reduces the size of the code by about 2K bytes, in - exchange for a little execution time. However, BUILDFIXED should not be - used for threaded applications, since the rewriting of the tables and virgin - may not be thread-safe. - */ -local void fixedtables(state) -struct inflate_state FAR *state; -{ -#ifdef BUILDFIXED - static int virgin = 1; - static code *lenfix, *distfix; - static code fixed[544]; - - /* build fixed huffman tables if first call (may not be thread safe) */ - if (virgin) { - unsigned sym, bits; - static code *next; - - /* literal/length table */ - sym = 0; - while (sym < 144) state->lens[sym++] = 8; - while (sym < 256) state->lens[sym++] = 9; - while (sym < 280) state->lens[sym++] = 7; - while (sym < 288) state->lens[sym++] = 8; - next = fixed; - lenfix = next; - bits = 9; - inflate_table(LENS, state->lens, 288, &(next), &(bits), state->work); - - /* distance table */ - sym = 0; - while (sym < 32) state->lens[sym++] = 5; - distfix = next; - bits = 5; - inflate_table(DISTS, state->lens, 32, &(next), &(bits), state->work); - - /* do this just once */ - virgin = 0; - } -#else /* !BUILDFIXED */ -# include "inffixed.h" -#endif /* BUILDFIXED */ - state->lencode = lenfix; - state->lenbits = 9; - state->distcode = distfix; - state->distbits = 5; -} - -#ifdef MAKEFIXED -#include - -/* - Write out the inffixed.h that is #include'd above. Defining MAKEFIXED also - defines BUILDFIXED, so the tables are built on the fly. makefixed() writes - those tables to stdout, which would be piped to inffixed.h. A small program - can simply call makefixed to do this: - - void makefixed(void); - - int main(void) - { - makefixed(); - return 0; - } - - Then that can be linked with zlib built with MAKEFIXED defined and run: - - a.out > inffixed.h - */ -void makefixed() -{ - unsigned low, size; - struct inflate_state state; - - fixedtables(&state); - puts(" /* inffixed.h -- table for decoding fixed codes"); - puts(" * Generated automatically by makefixed()."); - puts(" */"); - puts(""); - puts(" /* WARNING: this file should *not* be used by applications."); - puts(" It is part of the implementation of this library and is"); - puts(" subject to change. Applications should only use zlib.h."); - puts(" */"); - puts(""); - size = 1U << 9; - printf(" static const code lenfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 7) == 0) printf("\n "); - printf("{%u,%u,%d}", (low & 127) == 99 ? 64 : state.lencode[low].op, - state.lencode[low].bits, state.lencode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); - size = 1U << 5; - printf("\n static const code distfix[%u] = {", size); - low = 0; - for (;;) { - if ((low % 6) == 0) printf("\n "); - printf("{%u,%u,%d}", state.distcode[low].op, state.distcode[low].bits, - state.distcode[low].val); - if (++low == size) break; - putchar(','); - } - puts("\n };"); -} -#endif /* MAKEFIXED */ - -/* - Update the window with the last wsize (normally 32K) bytes written before - returning. If window does not exist yet, create it. This is only called - when a window is already in use, or when output has been written during this - inflate call, but the end of the deflate stream has not been reached yet. - It is also called to create a window for dictionary data when a dictionary - is loaded. - - Providing output buffers larger than 32K to inflate() should provide a speed - advantage, since only the last 32K of output is copied to the sliding window - upon return from inflate(), and since all distances after the first 32K of - output will fall in the output data, making match copies simpler and faster. - The advantage may be dependent on the size of the processor's data caches. - */ -local int updatewindow(strm, end, copy) -z_streamp strm; -const Bytef *end; -unsigned copy; -{ - struct inflate_state FAR *state; - unsigned dist; - - state = (struct inflate_state FAR *)strm->state; - - /* if it hasn't been done already, allocate space for the window */ - if (state->window == Z_NULL) { - state->window = (unsigned char FAR *) - ZALLOC(strm, 1U << state->wbits, - sizeof(unsigned char)); - if (state->window == Z_NULL) return 1; - } - - /* if window not in use yet, initialize */ - if (state->wsize == 0) { - state->wsize = 1U << state->wbits; - state->wnext = 0; - state->whave = 0; - } - - /* copy state->wsize or less output bytes into the circular window */ - if (copy >= state->wsize) { - zmemcpy(state->window, end - state->wsize, state->wsize); - state->wnext = 0; - state->whave = state->wsize; - } - else { - dist = state->wsize - state->wnext; - if (dist > copy) dist = copy; - zmemcpy(state->window + state->wnext, end - copy, dist); - copy -= dist; - if (copy) { - zmemcpy(state->window, end - copy, copy); - state->wnext = copy; - state->whave = state->wsize; - } - else { - state->wnext += dist; - if (state->wnext == state->wsize) state->wnext = 0; - if (state->whave < state->wsize) state->whave += dist; - } - } - return 0; -} - -/* Macros for inflate(): */ - -/* check function to use adler32() for zlib or crc32() for gzip */ -#ifdef GUNZIP -# define UPDATE(check, buf, len) \ - (state->flags ? crc32(check, buf, len) : adler32(check, buf, len)) -#else -# define UPDATE(check, buf, len) adler32(check, buf, len) -#endif - -/* check macros for header crc */ -#ifdef GUNZIP -# define CRC2(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - check = crc32(check, hbuf, 2); \ - } while (0) - -# define CRC4(check, word) \ - do { \ - hbuf[0] = (unsigned char)(word); \ - hbuf[1] = (unsigned char)((word) >> 8); \ - hbuf[2] = (unsigned char)((word) >> 16); \ - hbuf[3] = (unsigned char)((word) >> 24); \ - check = crc32(check, hbuf, 4); \ - } while (0) -#endif - -/* Load registers with state in inflate() for speed */ -#define LOAD() \ - do { \ - put = strm->next_out; \ - left = strm->avail_out; \ - next = strm->next_in; \ - have = strm->avail_in; \ - hold = state->hold; \ - bits = state->bits; \ - } while (0) - -/* Restore state from registers in inflate() */ -#define RESTORE() \ - do { \ - strm->next_out = put; \ - strm->avail_out = left; \ - strm->next_in = next; \ - strm->avail_in = have; \ - state->hold = hold; \ - state->bits = bits; \ - } while (0) - -/* Clear the input bit accumulator */ -#define INITBITS() \ - do { \ - hold = 0; \ - bits = 0; \ - } while (0) - -/* Get a byte of input into the bit accumulator, or return from inflate() - if there is no input available. */ -#define PULLBYTE() \ - do { \ - if (have == 0) goto inf_leave; \ - have--; \ - hold += (unsigned long)(*next++) << bits; \ - bits += 8; \ - } while (0) - -/* Assure that there are at least n bits in the bit accumulator. If there is - not enough available input to do that, then return from inflate(). */ -#define NEEDBITS(n) \ - do { \ - while (bits < (unsigned)(n)) \ - PULLBYTE(); \ - } while (0) - -/* Return the low n bits of the bit accumulator (n < 16) */ -#define BITS(n) \ - ((unsigned)hold & ((1U << (n)) - 1)) - -/* Remove n bits from the bit accumulator */ -#define DROPBITS(n) \ - do { \ - hold >>= (n); \ - bits -= (unsigned)(n); \ - } while (0) - -/* Remove zero to seven bits as needed to go to a byte boundary */ -#define BYTEBITS() \ - do { \ - hold >>= bits & 7; \ - bits -= bits & 7; \ - } while (0) - -/* - inflate() uses a state machine to process as much input data and generate as - much output data as possible before returning. The state machine is - structured roughly as follows: - - for (;;) switch (state) { - ... - case STATEn: - if (not enough input data or output space to make progress) - return; - ... make progress ... - state = STATEm; - break; - ... - } - - so when inflate() is called again, the same case is attempted again, and - if the appropriate resources are provided, the machine proceeds to the - next state. The NEEDBITS() macro is usually the way the state evaluates - whether it can proceed or should return. NEEDBITS() does the return if - the requested bits are not available. The typical use of the BITS macros - is: - - NEEDBITS(n); - ... do something with BITS(n) ... - DROPBITS(n); - - where NEEDBITS(n) either returns from inflate() if there isn't enough - input left to load n bits into the accumulator, or it continues. BITS(n) - gives the low n bits in the accumulator. When done, DROPBITS(n) drops - the low n bits off the accumulator. INITBITS() clears the accumulator - and sets the number of available bits to zero. BYTEBITS() discards just - enough bits to put the accumulator on a byte boundary. After BYTEBITS() - and a NEEDBITS(8), then BITS(8) would return the next byte in the stream. - - NEEDBITS(n) uses PULLBYTE() to get an available byte of input, or to return - if there is no input available. The decoding of variable length codes uses - PULLBYTE() directly in order to pull just enough bytes to decode the next - code, and no more. - - Some states loop until they get enough input, making sure that enough - state information is maintained to continue the loop where it left off - if NEEDBITS() returns in the loop. For example, want, need, and keep - would all have to actually be part of the saved state in case NEEDBITS() - returns: - - case STATEw: - while (want < need) { - NEEDBITS(n); - keep[want++] = BITS(n); - DROPBITS(n); - } - state = STATEx; - case STATEx: - - As shown above, if the next state is also the next case, then the break - is omitted. - - A state may also return if there is not enough output space available to - complete that state. Those states are copying stored data, writing a - literal byte, and copying a matching string. - - When returning, a "goto inf_leave" is used to update the total counters, - update the check value, and determine whether any progress has been made - during that inflate() call in order to return the proper return code. - Progress is defined as a change in either strm->avail_in or strm->avail_out. - When there is a window, goto inf_leave will update the window with the last - output written. If a goto inf_leave occurs in the middle of decompression - and there is no window currently, goto inf_leave will create one and copy - output to the window for the next call of inflate(). - - In this implementation, the flush parameter of inflate() only affects the - return code (per zlib.h). inflate() always writes as much as possible to - strm->next_out, given the space available and the provided input--the effect - documented in zlib.h of Z_SYNC_FLUSH. Furthermore, inflate() always defers - the allocation of and copying into a sliding window until necessary, which - provides the effect documented in zlib.h for Z_FINISH when the entire input - stream available. So the only thing the flush parameter actually does is: - when flush is set to Z_FINISH, inflate() cannot return Z_OK. Instead it - will return Z_BUF_ERROR if it has not reached the end of the stream. - */ - -int ZEXPORT inflate(strm, flush) -z_streamp strm; -int flush; -{ - struct inflate_state FAR *state; - z_const unsigned char FAR *next; /* next input */ - unsigned char FAR *put; /* next output */ - unsigned have, left; /* available input and output */ - unsigned long hold; /* bit buffer */ - unsigned bits; /* bits in bit buffer */ - unsigned in, out; /* save starting available input and output */ - unsigned copy; /* number of stored or match bytes to copy */ - unsigned char FAR *from; /* where to copy match bytes from */ - code here; /* current decoding table entry */ - code last; /* parent table entry */ - unsigned len; /* length to copy for repeats, bits to drop */ - int ret; /* return code */ -#ifdef GUNZIP - unsigned char hbuf[4]; /* buffer for gzip header crc calculation */ -#endif - static const unsigned short order[19] = /* permutation of code lengths */ - {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; - - if (strm == Z_NULL || strm->state == Z_NULL || strm->next_out == Z_NULL || - (strm->next_in == Z_NULL && strm->avail_in != 0)) - return Z_STREAM_ERROR; - - state = (struct inflate_state FAR *)strm->state; - if (state->mode == TYPE) state->mode = TYPEDO; /* skip check */ - LOAD(); - in = have; - out = left; - ret = Z_OK; - for (;;) - switch (state->mode) { - case HEAD: - if (state->wrap == 0) { - state->mode = TYPEDO; - break; - } - NEEDBITS(16); -#ifdef GUNZIP - if ((state->wrap & 2) && hold == 0x8b1f) { /* gzip header */ - state->check = crc32(0L, Z_NULL, 0); - CRC2(state->check, hold); - INITBITS(); - state->mode = FLAGS; - break; - } - state->flags = 0; /* expect zlib header */ - if (state->head != Z_NULL) - state->head->done = -1; - if (!(state->wrap & 1) || /* check if zlib header allowed */ -#else - if ( -#endif - ((BITS(8) << 8) + (hold >> 8)) % 31) { - strm->msg = (char *)"incorrect header check"; - state->mode = BAD; - break; - } - if (BITS(4) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - DROPBITS(4); - len = BITS(4) + 8; - if (state->wbits == 0) - state->wbits = len; - else if (len > state->wbits) { - strm->msg = (char *)"invalid window size"; - state->mode = BAD; - break; - } - state->dmax = 1U << len; - Tracev((stderr, "inflate: zlib header ok\n")); - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = hold & 0x200 ? DICTID : TYPE; - INITBITS(); - break; -#ifdef GUNZIP - case FLAGS: - NEEDBITS(16); - state->flags = (int)(hold); - if ((state->flags & 0xff) != Z_DEFLATED) { - strm->msg = (char *)"unknown compression method"; - state->mode = BAD; - break; - } - if (state->flags & 0xe000) { - strm->msg = (char *)"unknown header flags set"; - state->mode = BAD; - break; - } - if (state->head != Z_NULL) - state->head->text = (int)((hold >> 8) & 1); - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = TIME; - case TIME: - NEEDBITS(32); - if (state->head != Z_NULL) - state->head->time = hold; - if (state->flags & 0x0200) CRC4(state->check, hold); - INITBITS(); - state->mode = OS; - case OS: - NEEDBITS(16); - if (state->head != Z_NULL) { - state->head->xflags = (int)(hold & 0xff); - state->head->os = (int)(hold >> 8); - } - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - state->mode = EXLEN; - case EXLEN: - if (state->flags & 0x0400) { - NEEDBITS(16); - state->length = (unsigned)(hold); - if (state->head != Z_NULL) - state->head->extra_len = (unsigned)hold; - if (state->flags & 0x0200) CRC2(state->check, hold); - INITBITS(); - } - else if (state->head != Z_NULL) - state->head->extra = Z_NULL; - state->mode = EXTRA; - case EXTRA: - if (state->flags & 0x0400) { - copy = state->length; - if (copy > have) copy = have; - if (copy) { - if (state->head != Z_NULL && - state->head->extra != Z_NULL) { - len = state->head->extra_len - state->length; - zmemcpy(state->head->extra + len, next, - len + copy > state->head->extra_max ? - state->head->extra_max - len : copy); - } - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - state->length -= copy; - } - if (state->length) goto inf_leave; - } - state->length = 0; - state->mode = NAME; - case NAME: - if (state->flags & 0x0800) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->name != Z_NULL && - state->length < state->head->name_max) - state->head->name[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->name = Z_NULL; - state->length = 0; - state->mode = COMMENT; - case COMMENT: - if (state->flags & 0x1000) { - if (have == 0) goto inf_leave; - copy = 0; - do { - len = (unsigned)(next[copy++]); - if (state->head != Z_NULL && - state->head->comment != Z_NULL && - state->length < state->head->comm_max) - state->head->comment[state->length++] = len; - } while (len && copy < have); - if (state->flags & 0x0200) - state->check = crc32(state->check, next, copy); - have -= copy; - next += copy; - if (len) goto inf_leave; - } - else if (state->head != Z_NULL) - state->head->comment = Z_NULL; - state->mode = HCRC; - case HCRC: - if (state->flags & 0x0200) { - NEEDBITS(16); - if (hold != (state->check & 0xffff)) { - strm->msg = (char *)"header crc mismatch"; - state->mode = BAD; - break; - } - INITBITS(); - } - if (state->head != Z_NULL) { - state->head->hcrc = (int)((state->flags >> 9) & 1); - state->head->done = 1; - } - strm->adler = state->check = crc32(0L, Z_NULL, 0); - state->mode = TYPE; - break; -#endif - case DICTID: - NEEDBITS(32); - strm->adler = state->check = ZSWAP32(hold); - INITBITS(); - state->mode = DICT; - case DICT: - if (state->havedict == 0) { - RESTORE(); - return Z_NEED_DICT; - } - strm->adler = state->check = adler32(0L, Z_NULL, 0); - state->mode = TYPE; - case TYPE: - if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; - case TYPEDO: - if (state->last) { - BYTEBITS(); - state->mode = CHECK; - break; - } - NEEDBITS(3); - state->last = BITS(1); - DROPBITS(1); - switch (BITS(2)) { - case 0: /* stored block */ - Tracev((stderr, "inflate: stored block%s\n", - state->last ? " (last)" : "")); - state->mode = STORED; - break; - case 1: /* fixed block */ - fixedtables(state); - Tracev((stderr, "inflate: fixed codes block%s\n", - state->last ? " (last)" : "")); - state->mode = LEN_; /* decode codes */ - if (flush == Z_TREES) { - DROPBITS(2); - goto inf_leave; - } - break; - case 2: /* dynamic block */ - Tracev((stderr, "inflate: dynamic codes block%s\n", - state->last ? " (last)" : "")); - state->mode = TABLE; - break; - case 3: - strm->msg = (char *)"invalid block type"; - state->mode = BAD; - } - DROPBITS(2); - break; - case STORED: - BYTEBITS(); /* go to byte boundary */ - NEEDBITS(32); - if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { - strm->msg = (char *)"invalid stored block lengths"; - state->mode = BAD; - break; - } - state->length = (unsigned)hold & 0xffff; - Tracev((stderr, "inflate: stored length %u\n", - state->length)); - INITBITS(); - state->mode = COPY_; - if (flush == Z_TREES) goto inf_leave; - case COPY_: - state->mode = COPY; - case COPY: - copy = state->length; - if (copy) { - if (copy > have) copy = have; - if (copy > left) copy = left; - if (copy == 0) goto inf_leave; - zmemcpy(put, next, copy); - have -= copy; - next += copy; - left -= copy; - put += copy; - state->length -= copy; - break; - } - Tracev((stderr, "inflate: stored end\n")); - state->mode = TYPE; - break; - case TABLE: - NEEDBITS(14); - state->nlen = BITS(5) + 257; - DROPBITS(5); - state->ndist = BITS(5) + 1; - DROPBITS(5); - state->ncode = BITS(4) + 4; - DROPBITS(4); -#ifndef PKZIP_BUG_WORKAROUND - if (state->nlen > 286 || state->ndist > 30) { - strm->msg = (char *)"too many length or distance symbols"; - state->mode = BAD; - break; - } -#endif - Tracev((stderr, "inflate: table sizes ok\n")); - state->have = 0; - state->mode = LENLENS; - case LENLENS: - while (state->have < state->ncode) { - NEEDBITS(3); - state->lens[order[state->have++]] = (unsigned short)BITS(3); - DROPBITS(3); - } - while (state->have < 19) - state->lens[order[state->have++]] = 0; - state->next = state->codes; - state->lencode = (const code FAR *)(state->next); - state->lenbits = 7; - ret = inflate_table(CODES, state->lens, 19, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid code lengths set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: code lengths ok\n")); - state->have = 0; - state->mode = CODELENS; - case CODELENS: - while (state->have < state->nlen + state->ndist) { - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.val < 16) { - DROPBITS(here.bits); - state->lens[state->have++] = here.val; - } - else { - if (here.val == 16) { - NEEDBITS(here.bits + 2); - DROPBITS(here.bits); - if (state->have == 0) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - len = state->lens[state->have - 1]; - copy = 3 + BITS(2); - DROPBITS(2); - } - else if (here.val == 17) { - NEEDBITS(here.bits + 3); - DROPBITS(here.bits); - len = 0; - copy = 3 + BITS(3); - DROPBITS(3); - } - else { - NEEDBITS(here.bits + 7); - DROPBITS(here.bits); - len = 0; - copy = 11 + BITS(7); - DROPBITS(7); - } - if (state->have + copy > state->nlen + state->ndist) { - strm->msg = (char *)"invalid bit length repeat"; - state->mode = BAD; - break; - } - while (copy--) - state->lens[state->have++] = (unsigned short)len; - } - } - - /* handle error breaks in while */ - if (state->mode == BAD) break; - - /* check for end-of-block code (better have one) */ - if (state->lens[256] == 0) { - strm->msg = (char *)"invalid code -- missing end-of-block"; - state->mode = BAD; - break; - } - - /* build code tables -- note: do not change the lenbits or distbits - values here (9 and 6) without reading the comments in inftrees.h - concerning the ENOUGH constants, which depend on those values */ - state->next = state->codes; - state->lencode = (const code FAR *)(state->next); - state->lenbits = 9; - ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), - &(state->lenbits), state->work); - if (ret) { - strm->msg = (char *)"invalid literal/lengths set"; - state->mode = BAD; - break; - } - state->distcode = (const code FAR *)(state->next); - state->distbits = 6; - ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, - &(state->next), &(state->distbits), state->work); - if (ret) { - strm->msg = (char *)"invalid distances set"; - state->mode = BAD; - break; - } - Tracev((stderr, "inflate: codes ok\n")); - state->mode = LEN_; - if (flush == Z_TREES) goto inf_leave; - case LEN_: - state->mode = LEN; - case LEN: - if (have >= 6 && left >= 258) { - RESTORE(); - inflate_fast(strm, out); - LOAD(); - if (state->mode == TYPE) - state->back = -1; - break; - } - state->back = 0; - for (;;) { - here = state->lencode[BITS(state->lenbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if (here.op && (here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->lencode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - state->length = (unsigned)here.val; - if ((int)(here.op) == 0) { - Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ? - "inflate: literal '%c'\n" : - "inflate: literal 0x%02x\n", here.val)); - state->mode = LIT; - break; - } - if (here.op & 32) { - Tracevv((stderr, "inflate: end of block\n")); - state->back = -1; - state->mode = TYPE; - break; - } - if (here.op & 64) { - strm->msg = (char *)"invalid literal/length code"; - state->mode = BAD; - break; - } - state->extra = (unsigned)(here.op) & 15; - state->mode = LENEXT; - case LENEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->length += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } - Tracevv((stderr, "inflate: length %u\n", state->length)); - state->was = state->length; - state->mode = DIST; - case DIST: - for (;;) { - here = state->distcode[BITS(state->distbits)]; - if ((unsigned)(here.bits) <= bits) break; - PULLBYTE(); - } - if ((here.op & 0xf0) == 0) { - last = here; - for (;;) { - here = state->distcode[last.val + - (BITS(last.bits + last.op) >> last.bits)]; - if ((unsigned)(last.bits + here.bits) <= bits) break; - PULLBYTE(); - } - DROPBITS(last.bits); - state->back += last.bits; - } - DROPBITS(here.bits); - state->back += here.bits; - if (here.op & 64) { - strm->msg = (char *)"invalid distance code"; - state->mode = BAD; - break; - } - state->offset = (unsigned)here.val; - state->extra = (unsigned)(here.op) & 15; - state->mode = DISTEXT; - case DISTEXT: - if (state->extra) { - NEEDBITS(state->extra); - state->offset += BITS(state->extra); - DROPBITS(state->extra); - state->back += state->extra; - } -#ifdef INFLATE_STRICT - if (state->offset > state->dmax) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#endif - Tracevv((stderr, "inflate: distance %u\n", state->offset)); - state->mode = MATCH; - case MATCH: - if (left == 0) goto inf_leave; - copy = out - left; - if (state->offset > copy) { /* copy from window */ - copy = state->offset - copy; - if (copy > state->whave) { - if (state->sane) { - strm->msg = (char *)"invalid distance too far back"; - state->mode = BAD; - break; - } -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - Trace((stderr, "inflate.c too far\n")); - copy -= state->whave; - if (copy > state->length) copy = state->length; - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = 0; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; -#endif - } - if (copy > state->wnext) { - copy -= state->wnext; - from = state->window + (state->wsize - copy); - } - else - from = state->window + (state->wnext - copy); - if (copy > state->length) copy = state->length; - } - else { /* copy from output */ - from = put - state->offset; - copy = state->length; - } - if (copy > left) copy = left; - left -= copy; - state->length -= copy; - do { - *put++ = *from++; - } while (--copy); - if (state->length == 0) state->mode = LEN; - break; - case LIT: - if (left == 0) goto inf_leave; - *put++ = (unsigned char)(state->length); - left--; - state->mode = LEN; - break; - case CHECK: - if (state->wrap) { - NEEDBITS(32); - out -= left; - strm->total_out += out; - state->total += out; - if (out) - strm->adler = state->check = - UPDATE(state->check, put - out, out); - out = left; - if (( -#ifdef GUNZIP - state->flags ? hold : -#endif - ZSWAP32(hold)) != state->check) { - strm->msg = (char *)"incorrect data check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: check matches trailer\n")); - } -#ifdef GUNZIP - state->mode = LENGTH; - case LENGTH: - if (state->wrap && state->flags) { - NEEDBITS(32); - if (hold != (state->total & 0xffffffffUL)) { - strm->msg = (char *)"incorrect length check"; - state->mode = BAD; - break; - } - INITBITS(); - Tracev((stderr, "inflate: length matches trailer\n")); - } -#endif - state->mode = DONE; - case DONE: - ret = Z_STREAM_END; - goto inf_leave; - case BAD: - ret = Z_DATA_ERROR; - goto inf_leave; - case MEM: - return Z_MEM_ERROR; - case SYNC: - default: - return Z_STREAM_ERROR; - } - - /* - Return from inflate(), updating the total counts and the check value. - If there was no progress during the inflate() call, return a buffer - error. Call updatewindow() to create and/or update the window state. - Note: a memory error from inflate() is non-recoverable. - */ - inf_leave: - RESTORE(); - if (state->wsize || (out != strm->avail_out && state->mode < BAD && - (state->mode < CHECK || flush != Z_FINISH))) - if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { - state->mode = MEM; - return Z_MEM_ERROR; - } - in -= strm->avail_in; - out -= strm->avail_out; - strm->total_in += in; - strm->total_out += out; - state->total += out; - if (state->wrap && out) - strm->adler = state->check = - UPDATE(state->check, strm->next_out - out, out); - strm->data_type = state->bits + (state->last ? 64 : 0) + - (state->mode == TYPE ? 128 : 0) + - (state->mode == LEN_ || state->mode == COPY_ ? 256 : 0); - if (((in == 0 && out == 0) || flush == Z_FINISH) && ret == Z_OK) - ret = Z_BUF_ERROR; - return ret; -} - -int ZEXPORT inflateEnd(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - if (strm == Z_NULL || strm->state == Z_NULL || strm->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->window != Z_NULL) ZFREE(strm, state->window); - ZFREE(strm, strm->state); - strm->state = Z_NULL; - Tracev((stderr, "inflate: end\n")); - return Z_OK; -} - -int ZEXPORT inflateGetDictionary(strm, dictionary, dictLength) -z_streamp strm; -Bytef *dictionary; -uInt *dictLength; -{ - struct inflate_state FAR *state; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - - /* copy dictionary */ - if (state->whave && dictionary != Z_NULL) { - zmemcpy(dictionary, state->window + state->wnext, - state->whave - state->wnext); - zmemcpy(dictionary + state->whave - state->wnext, - state->window, state->wnext); - } - if (dictLength != Z_NULL) - *dictLength = state->whave; - return Z_OK; -} - -int ZEXPORT inflateSetDictionary(strm, dictionary, dictLength) -z_streamp strm; -const Bytef *dictionary; -uInt dictLength; -{ - struct inflate_state FAR *state; - unsigned long dictid; - int ret; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (state->wrap != 0 && state->mode != DICT) - return Z_STREAM_ERROR; - - /* check for correct dictionary identifier */ - if (state->mode == DICT) { - dictid = adler32(0L, Z_NULL, 0); - dictid = adler32(dictid, dictionary, dictLength); - if (dictid != state->check) - return Z_DATA_ERROR; - } - - /* copy dictionary to window using updatewindow(), which will amend the - existing dictionary if appropriate */ - ret = updatewindow(strm, dictionary + dictLength, dictLength); - if (ret) { - state->mode = MEM; - return Z_MEM_ERROR; - } - state->havedict = 1; - Tracev((stderr, "inflate: dictionary set\n")); - return Z_OK; -} - -int ZEXPORT inflateGetHeader(strm, head) -z_streamp strm; -gz_headerp head; -{ - struct inflate_state FAR *state; - - /* check state */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if ((state->wrap & 2) == 0) return Z_STREAM_ERROR; - - /* save header structure */ - state->head = head; - head->done = 0; - return Z_OK; -} - -/* - Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found - or when out of input. When called, *have is the number of pattern bytes - found in order so far, in 0..3. On return *have is updated to the new - state. If on return *have equals four, then the pattern was found and the - return value is how many bytes were read including the last byte of the - pattern. If *have is less than four, then the pattern has not been found - yet and the return value is len. In the latter case, syncsearch() can be - called again with more data and the *have state. *have is initialized to - zero for the first call. - */ -local unsigned syncsearch(have, buf, len) -unsigned FAR *have; -const unsigned char FAR *buf; -unsigned len; -{ - unsigned got; - unsigned next; - - got = *have; - next = 0; - while (next < len && got < 4) { - if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) - got++; - else if (buf[next]) - got = 0; - else - got = 4 - got; - next++; - } - *have = got; - return next; -} - -int ZEXPORT inflateSync(strm) -z_streamp strm; -{ - unsigned len; /* number of bytes to look at or looked at */ - unsigned long in, out; /* temporary to save total_in and total_out */ - unsigned char buf[4]; /* to restore bit buffer to byte string */ - struct inflate_state FAR *state; - - /* check parameters */ - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - if (strm->avail_in == 0 && state->bits < 8) return Z_BUF_ERROR; - - /* if first time, start search in bit buffer */ - if (state->mode != SYNC) { - state->mode = SYNC; - state->hold <<= state->bits & 7; - state->bits -= state->bits & 7; - len = 0; - while (state->bits >= 8) { - buf[len++] = (unsigned char)(state->hold); - state->hold >>= 8; - state->bits -= 8; - } - state->have = 0; - syncsearch(&(state->have), buf, len); - } - - /* search available input */ - len = syncsearch(&(state->have), strm->next_in, strm->avail_in); - strm->avail_in -= len; - strm->next_in += len; - strm->total_in += len; - - /* return no joy or set up to restart inflate() on a new block */ - if (state->have != 4) return Z_DATA_ERROR; - in = strm->total_in; out = strm->total_out; - inflateReset(strm); - strm->total_in = in; strm->total_out = out; - state->mode = TYPE; - return Z_OK; -} - -/* - Returns true if inflate is currently at the end of a block generated by - Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP - implementation to provide an additional safety check. PPP uses - Z_SYNC_FLUSH but removes the length bytes of the resulting empty stored - block. When decompressing, PPP checks that at the end of input packet, - inflate is waiting for these length bytes. - */ -int ZEXPORT inflateSyncPoint(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - return state->mode == STORED && state->bits == 0; -} - -int ZEXPORT inflateCopy(dest, source) -z_streamp dest; -z_streamp source; -{ - struct inflate_state FAR *state; - struct inflate_state FAR *copy; - unsigned char FAR *window; - unsigned wsize; - - /* check input */ - if (dest == Z_NULL || source == Z_NULL || source->state == Z_NULL || - source->zalloc == (alloc_func)0 || source->zfree == (free_func)0) - return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)source->state; - - /* allocate space */ - copy = (struct inflate_state FAR *) - ZALLOC(source, 1, sizeof(struct inflate_state)); - if (copy == Z_NULL) return Z_MEM_ERROR; - window = Z_NULL; - if (state->window != Z_NULL) { - window = (unsigned char FAR *) - ZALLOC(source, 1U << state->wbits, sizeof(unsigned char)); - if (window == Z_NULL) { - ZFREE(source, copy); - return Z_MEM_ERROR; - } - } - - /* copy state */ - zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); - zmemcpy((voidpf)copy, (voidpf)state, sizeof(struct inflate_state)); - if (state->lencode >= state->codes && - state->lencode <= state->codes + ENOUGH - 1) { - copy->lencode = copy->codes + (state->lencode - state->codes); - copy->distcode = copy->codes + (state->distcode - state->codes); - } - copy->next = copy->codes + (state->next - state->codes); - if (window != Z_NULL) { - wsize = 1U << state->wbits; - zmemcpy(window, state->window, wsize); - } - copy->window = window; - dest->state = (struct internal_state FAR *)copy; - return Z_OK; -} - -int ZEXPORT inflateUndermine(strm, subvert) -z_streamp strm; -int subvert; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; - state = (struct inflate_state FAR *)strm->state; - state->sane = !subvert; -#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR - return Z_OK; -#else - state->sane = 1; - return Z_DATA_ERROR; -#endif -} - -long ZEXPORT inflateMark(strm) -z_streamp strm; -{ - struct inflate_state FAR *state; - - if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16; - state = (struct inflate_state FAR *)strm->state; - return ((long)(state->back) << 16) + - (state->mode == COPY ? state->length : - (state->mode == MATCH ? state->was - state->length : 0)); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.h deleted file mode 100644 index a8ef428..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inflate.h +++ /dev/null @@ -1,122 +0,0 @@ -/* inflate.h -- internal inflate state definition - * Copyright (C) 1995-2009 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* define NO_GZIP when compiling if you want to disable gzip header and - trailer decoding by inflate(). NO_GZIP would be used to avoid linking in - the crc code when it is not needed. For shared libraries, gzip decoding - should be left enabled. */ -#ifndef NO_GZIP -# define GUNZIP -#endif - -/* Possible inflate modes between inflate() calls */ -typedef enum { - HEAD, /* i: waiting for magic header */ - FLAGS, /* i: waiting for method and flags (gzip) */ - TIME, /* i: waiting for modification time (gzip) */ - OS, /* i: waiting for extra flags and operating system (gzip) */ - EXLEN, /* i: waiting for extra length (gzip) */ - EXTRA, /* i: waiting for extra bytes (gzip) */ - NAME, /* i: waiting for end of file name (gzip) */ - COMMENT, /* i: waiting for end of comment (gzip) */ - HCRC, /* i: waiting for header crc (gzip) */ - DICTID, /* i: waiting for dictionary check value */ - DICT, /* waiting for inflateSetDictionary() call */ - TYPE, /* i: waiting for type bits, including last-flag bit */ - TYPEDO, /* i: same, but skip check to exit inflate on new block */ - STORED, /* i: waiting for stored size (length and complement) */ - COPY_, /* i/o: same as COPY below, but only first time in */ - COPY, /* i/o: waiting for input or output to copy stored block */ - TABLE, /* i: waiting for dynamic block table lengths */ - LENLENS, /* i: waiting for code length code lengths */ - CODELENS, /* i: waiting for length/lit and distance code lengths */ - LEN_, /* i: same as LEN below, but only first time in */ - LEN, /* i: waiting for length/lit/eob code */ - LENEXT, /* i: waiting for length extra bits */ - DIST, /* i: waiting for distance code */ - DISTEXT, /* i: waiting for distance extra bits */ - MATCH, /* o: waiting for output space to copy string */ - LIT, /* o: waiting for output space to write literal */ - CHECK, /* i: waiting for 32-bit check value */ - LENGTH, /* i: waiting for 32-bit length (gzip) */ - DONE, /* finished check, done -- remain here until reset */ - BAD, /* got a data error -- remain here until reset */ - MEM, /* got an inflate() memory error -- remain here until reset */ - SYNC /* looking for synchronization bytes to restart inflate() */ -} inflate_mode; - -/* - State transitions between above modes - - - (most modes can go to BAD or MEM on error -- not shown for clarity) - - Process header: - HEAD -> (gzip) or (zlib) or (raw) - (gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME -> COMMENT -> - HCRC -> TYPE - (zlib) -> DICTID or TYPE - DICTID -> DICT -> TYPE - (raw) -> TYPEDO - Read deflate blocks: - TYPE -> TYPEDO -> STORED or TABLE or LEN_ or CHECK - STORED -> COPY_ -> COPY -> TYPE - TABLE -> LENLENS -> CODELENS -> LEN_ - LEN_ -> LEN - Read deflate codes in fixed or dynamic block: - LEN -> LENEXT or LIT or TYPE - LENEXT -> DIST -> DISTEXT -> MATCH -> LEN - LIT -> LEN - Process trailer: - CHECK -> LENGTH -> DONE - */ - -/* state maintained between inflate() calls. Approximately 10K bytes. */ -struct inflate_state { - inflate_mode mode; /* current inflate mode */ - int last; /* true if processing last block */ - int wrap; /* bit 0 true for zlib, bit 1 true for gzip */ - int havedict; /* true if dictionary provided */ - int flags; /* gzip header method and flags (0 if zlib) */ - unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */ - unsigned long check; /* protected copy of check value */ - unsigned long total; /* protected copy of output count */ - gz_headerp head; /* where to save gzip header information */ - /* sliding window */ - unsigned wbits; /* log base 2 of requested window size */ - unsigned wsize; /* window size or zero if not using window */ - unsigned whave; /* valid bytes in the window */ - unsigned wnext; /* window write index */ - unsigned char FAR *window; /* allocated sliding window, if needed */ - /* bit accumulator */ - unsigned long hold; /* input bit accumulator */ - unsigned bits; /* number of bits in "in" */ - /* for string and stored block copying */ - unsigned length; /* literal or length of data to copy */ - unsigned offset; /* distance back to copy string from */ - /* for table and code decoding */ - unsigned extra; /* extra bits needed */ - /* fixed and dynamic code tables */ - code const FAR *lencode; /* starting table for length/literal codes */ - code const FAR *distcode; /* starting table for distance codes */ - unsigned lenbits; /* index bits for lencode */ - unsigned distbits; /* index bits for distcode */ - /* dynamic table building */ - unsigned ncode; /* number of code length code lengths */ - unsigned nlen; /* number of length code lengths */ - unsigned ndist; /* number of distance code lengths */ - unsigned have; /* number of code lengths in lens[] */ - code FAR *next; /* next available space in codes[] */ - unsigned short lens[320]; /* temporary storage for code lengths */ - unsigned short work[288]; /* work area for code table building */ - code codes[ENOUGH]; /* space for code tables */ - int sane; /* if false, allow invalid distance too far */ - int back; /* bits back of last unprocessed length/lit */ - unsigned was; /* initial length of match */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.c deleted file mode 100644 index 9bd1218..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.c +++ /dev/null @@ -1,306 +0,0 @@ -/* inftrees.c -- generate Huffman trees for efficient decoding - * Copyright (C) 1995-2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#include "zutil.h" -#include "inftrees.h" - -#define MAXBITS 15 - -const char inflate_copyright[] = - " inflate 1.2.8 Copyright 1995-2013 Mark Adler "; -/* - If you use the zlib library in a product, an acknowledgment is welcome - in the documentation of your product. If for some reason you cannot - include such an acknowledgment, I would appreciate that you keep this - copyright string in the executable of your product. - */ - -/* - Build a set of tables to decode the provided canonical Huffman code. - The code lengths are lens[0..codes-1]. The result starts at *table, - whose indices are 0..2^bits-1. work is a writable array of at least - lens shorts, which is used as a work area. type is the type of code - to be generated, CODES, LENS, or DISTS. On return, zero is success, - -1 is an invalid code, and +1 means that ENOUGH isn't enough. table - on return points to the next available entry's address. bits is the - requested root table index bits, and on return it is the actual root - table index bits. It will differ if the request is greater than the - longest code or if it is less than the shortest code. - */ -int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) -codetype type; -unsigned short FAR *lens; -unsigned codes; -code FAR * FAR *table; -unsigned FAR *bits; -unsigned short FAR *work; -{ - unsigned len; /* a code's length in bits */ - unsigned sym; /* index of code symbols */ - unsigned min, max; /* minimum and maximum code lengths */ - unsigned root; /* number of index bits for root table */ - unsigned curr; /* number of index bits for current table */ - unsigned drop; /* code bits to drop for sub-table */ - int left; /* number of prefix codes available */ - unsigned used; /* code entries in table used */ - unsigned huff; /* Huffman code */ - unsigned incr; /* for incrementing code, index */ - unsigned fill; /* index for replicating entries */ - unsigned low; /* low bits for current root entry */ - unsigned mask; /* mask for low root bits */ - code here; /* table entry for duplication */ - code FAR *next; /* next available space in table */ - const unsigned short FAR *base; /* base value table to use */ - const unsigned short FAR *extra; /* extra bits table to use */ - int end; /* use base and extra for symbol > end */ - unsigned short count[MAXBITS+1]; /* number of codes of each length */ - unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ - static const unsigned short lbase[31] = { /* Length codes 257..285 base */ - 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, - 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; - static const unsigned short lext[31] = { /* Length codes 257..285 extra */ - 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, - 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 72, 78}; - static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ - 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, - 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, - 8193, 12289, 16385, 24577, 0, 0}; - static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ - 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, - 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, - 28, 28, 29, 29, 64, 64}; - - /* - Process a set of code lengths to create a canonical Huffman code. The - code lengths are lens[0..codes-1]. Each length corresponds to the - symbols 0..codes-1. The Huffman code is generated by first sorting the - symbols by length from short to long, and retaining the symbol order - for codes with equal lengths. Then the code starts with all zero bits - for the first code of the shortest length, and the codes are integer - increments for the same length, and zeros are appended as the length - increases. For the deflate format, these bits are stored backwards - from their more natural integer increment ordering, and so when the - decoding tables are built in the large loop below, the integer codes - are incremented backwards. - - This routine assumes, but does not check, that all of the entries in - lens[] are in the range 0..MAXBITS. The caller must assure this. - 1..MAXBITS is interpreted as that code length. zero means that that - symbol does not occur in this code. - - The codes are sorted by computing a count of codes for each length, - creating from that a table of starting indices for each length in the - sorted table, and then entering the symbols in order in the sorted - table. The sorted table is work[], with that space being provided by - the caller. - - The length counts are used for other purposes as well, i.e. finding - the minimum and maximum length codes, determining if there are any - codes at all, checking for a valid set of lengths, and looking ahead - at length counts to determine sub-table sizes when building the - decoding tables. - */ - - /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ - for (len = 0; len <= MAXBITS; len++) - count[len] = 0; - for (sym = 0; sym < codes; sym++) - count[lens[sym]]++; - - /* bound code lengths, force root to be within code lengths */ - root = *bits; - for (max = MAXBITS; max >= 1; max--) - if (count[max] != 0) break; - if (root > max) root = max; - if (max == 0) { /* no symbols to code at all */ - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)1; - here.val = (unsigned short)0; - *(*table)++ = here; /* make a table to force an error */ - *(*table)++ = here; - *bits = 1; - return 0; /* no symbols, but wait for decoding to report error */ - } - for (min = 1; min < max; min++) - if (count[min] != 0) break; - if (root < min) root = min; - - /* check for an over-subscribed or incomplete set of lengths */ - left = 1; - for (len = 1; len <= MAXBITS; len++) { - left <<= 1; - left -= count[len]; - if (left < 0) return -1; /* over-subscribed */ - } - if (left > 0 && (type == CODES || max != 1)) - return -1; /* incomplete set */ - - /* generate offsets into symbol table for each length for sorting */ - offs[1] = 0; - for (len = 1; len < MAXBITS; len++) - offs[len + 1] = offs[len] + count[len]; - - /* sort symbols by length, by symbol order within each length */ - for (sym = 0; sym < codes; sym++) - if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; - - /* - Create and fill in decoding tables. In this loop, the table being - filled is at next and has curr index bits. The code being used is huff - with length len. That code is converted to an index by dropping drop - bits off of the bottom. For codes where len is less than drop + curr, - those top drop + curr - len bits are incremented through all values to - fill the table with replicated entries. - - root is the number of index bits for the root table. When len exceeds - root, sub-tables are created pointed to by the root entry with an index - of the low root bits of huff. This is saved in low to check for when a - new sub-table should be started. drop is zero when the root table is - being filled, and drop is root when sub-tables are being filled. - - When a new sub-table is needed, it is necessary to look ahead in the - code lengths to determine what size sub-table is needed. The length - counts are used for this, and so count[] is decremented as codes are - entered in the tables. - - used keeps track of how many table entries have been allocated from the - provided *table space. It is checked for LENS and DIST tables against - the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in - the initial root table size constants. See the comments in inftrees.h - for more information. - - sym increments through all symbols, and the loop terminates when - all codes of length max, i.e. all codes, have been processed. This - routine permits incomplete codes, so another loop after this one fills - in the rest of the decoding tables with invalid code markers. - */ - - /* set up for code type */ - switch (type) { - case CODES: - base = extra = work; /* dummy value--not used */ - end = 19; - break; - case LENS: - base = lbase; - base -= 257; - extra = lext; - extra -= 257; - end = 256; - break; - default: /* DISTS */ - base = dbase; - extra = dext; - end = -1; - } - - /* initialize state for loop */ - huff = 0; /* starting code */ - sym = 0; /* starting code symbol */ - len = min; /* starting code length */ - next = *table; /* current table to fill in */ - curr = root; /* current table index bits */ - drop = 0; /* current bits to drop from code for index */ - low = (unsigned)(-1); /* trigger new sub-table when len > root */ - used = 1U << root; /* use root table entries */ - mask = used - 1; /* mask for comparing low */ - - /* check available table space */ - if ((type == LENS && used > ENOUGH_LENS) || - (type == DISTS && used > ENOUGH_DISTS)) - return 1; - - /* process all codes and make table entries */ - for (;;) { - /* create table entry */ - here.bits = (unsigned char)(len - drop); - if ((int)(work[sym]) < end) { - here.op = (unsigned char)0; - here.val = work[sym]; - } - else if ((int)(work[sym]) > end) { - here.op = (unsigned char)(extra[work[sym]]); - here.val = base[work[sym]]; - } - else { - here.op = (unsigned char)(32 + 64); /* end of block */ - here.val = 0; - } - - /* replicate for those indices with low len bits equal to huff */ - incr = 1U << (len - drop); - fill = 1U << curr; - min = fill; /* save offset to next table */ - do { - fill -= incr; - next[(huff >> drop) + fill] = here; - } while (fill != 0); - - /* backwards increment the len-bit code huff */ - incr = 1U << (len - 1); - while (huff & incr) - incr >>= 1; - if (incr != 0) { - huff &= incr - 1; - huff += incr; - } - else - huff = 0; - - /* go to next symbol, update count, len */ - sym++; - if (--(count[len]) == 0) { - if (len == max) break; - len = lens[work[sym]]; - } - - /* create new sub-table if needed */ - if (len > root && (huff & mask) != low) { - /* if first time, transition to sub-tables */ - if (drop == 0) - drop = root; - - /* increment past last table */ - next += min; /* here min is 1 << curr */ - - /* determine length of next table */ - curr = len - drop; - left = (int)(1 << curr); - while (curr + drop < max) { - left -= count[curr + drop]; - if (left <= 0) break; - curr++; - left <<= 1; - } - - /* check for enough space */ - used += 1U << curr; - if ((type == LENS && used > ENOUGH_LENS) || - (type == DISTS && used > ENOUGH_DISTS)) - return 1; - - /* point entry in root table to sub-table */ - low = huff & mask; - (*table)[low].op = (unsigned char)curr; - (*table)[low].bits = (unsigned char)root; - (*table)[low].val = (unsigned short)(next - *table); - } - } - - /* fill in remaining table entry if code is incomplete (guaranteed to have - at most one remaining entry, since if the code is incomplete, the - maximum code length that was allowed to get this far is one bit) */ - if (huff != 0) { - here.op = (unsigned char)64; /* invalid code marker */ - here.bits = (unsigned char)(len - drop); - here.val = (unsigned short)0; - next[huff] = here; - } - - /* set return parameters */ - *table += used; - *bits = root; - return 0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.h deleted file mode 100644 index a685d8c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/inftrees.h +++ /dev/null @@ -1,62 +0,0 @@ -/* inftrees.h -- header to use inftrees.c - * Copyright (C) 1995-2005, 2010 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* Structure for decoding tables. Each entry provides either the - information needed to do the operation requested by the code that - indexed that table entry, or it provides a pointer to another - table that indexes more bits of the code. op indicates whether - the entry is a pointer to another table, a literal, a length or - distance, an end-of-block, or an invalid code. For a table - pointer, the low four bits of op is the number of index bits of - that table. For a length or distance, the low four bits of op - is the number of extra bits to get after the code. bits is - the number of bits in this code or part of the code to drop off - of the bit buffer. val is the actual byte to output in the case - of a literal, the base length or distance, or the offset from - the current table to the next table. Each entry is four bytes. */ -typedef struct { - unsigned char op; /* operation, extra bits, table bits */ - unsigned char bits; /* bits in this part of the code */ - unsigned short val; /* offset in table or code value */ -} code; - -/* op values as set by inflate_table(): - 00000000 - literal - 0000tttt - table link, tttt != 0 is the number of table index bits - 0001eeee - length or distance, eeee is the number of extra bits - 01100000 - end of block - 01000000 - invalid code - */ - -/* Maximum size of the dynamic table. The maximum number of code structures is - 1444, which is the sum of 852 for literal/length codes and 592 for distance - codes. These values were found by exhaustive searches using the program - examples/enough.c found in the zlib distribtution. The arguments to that - program are the number of symbols, the initial root table size, and the - maximum bit length of a code. "enough 286 9 15" for literal/length codes - returns returns 852, and "enough 30 6 15" for distance codes returns 592. - The initial root table size (9 or 6) is found in the fifth argument of the - inflate_table() calls in inflate.c and infback.c. If the root table size is - changed, then these maximum sizes would be need to be recalculated and - updated. */ -#define ENOUGH_LENS 852 -#define ENOUGH_DISTS 592 -#define ENOUGH (ENOUGH_LENS+ENOUGH_DISTS) - -/* Type of code to build for inflate_table() */ -typedef enum { - CODES, - LENS, - DISTS -} codetype; - -int ZLIB_INTERNAL inflate_table OF((codetype type, unsigned short FAR *lens, - unsigned codes, code FAR * FAR *table, - unsigned FAR *bits, unsigned short FAR *work)); diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/minigzip.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/minigzip.c deleted file mode 100644 index 8e9c09f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/minigzip.c +++ /dev/null @@ -1,651 +0,0 @@ -/* minigzip.c -- simulate gzip using the zlib compression library - * Copyright (C) 1995-2006, 2010, 2011 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * minigzip is a minimal implementation of the gzip utility. This is - * only an example of using zlib and isn't meant to replace the - * full-featured gzip. No attempt is made to deal with file systems - * limiting names to 14 or 8+3 characters, etc... Error checking is - * very limited. So use minigzip only for testing; use gzip for the - * real thing. On MSDOS, use only on file names without extension - * or in pipe mode. - */ - -/* @(#) $Id$ */ - -#include "zlib.h" -#include - -#ifdef STDC -# include -# include -#endif - -#ifdef USE_MMAP -# include -# include -# include -#endif - -#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__) -# include -# include -# ifdef UNDER_CE -# include -# endif -# define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY) -#else -# define SET_BINARY_MODE(file) -#endif - -#ifdef _MSC_VER -# define snprintf _snprintf -#endif - -#ifdef VMS -# define unlink delete -# define GZ_SUFFIX "-gz" -#endif -#ifdef RISCOS -# define unlink remove -# define GZ_SUFFIX "-gz" -# define fileno(file) file->__file -#endif -#if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fileno */ -#endif - -#if !defined(Z_HAVE_UNISTD_H) && !defined(_LARGEFILE64_SOURCE) -#ifndef WIN32 /* unlink already in stdio.h for WIN32 */ - extern int unlink OF((const char *)); -#endif -#endif - -#if defined(UNDER_CE) -# include -# define perror(s) pwinerror(s) - -/* Map the Windows error number in ERROR to a locale-dependent error - message string and return a pointer to it. Typically, the values - for ERROR come from GetLastError. - - The string pointed to shall not be modified by the application, - but may be overwritten by a subsequent call to strwinerror - - The strwinerror function does not change the current setting - of GetLastError. */ - -static char *strwinerror (error) - DWORD error; -{ - static char buf[1024]; - - wchar_t *msgbuf; - DWORD lasterr = GetLastError(); - DWORD chars = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM - | FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - error, - 0, /* Default language */ - (LPVOID)&msgbuf, - 0, - NULL); - if (chars != 0) { - /* If there is an \r\n appended, zap it. */ - if (chars >= 2 - && msgbuf[chars - 2] == '\r' && msgbuf[chars - 1] == '\n') { - chars -= 2; - msgbuf[chars] = 0; - } - - if (chars > sizeof (buf) - 1) { - chars = sizeof (buf) - 1; - msgbuf[chars] = 0; - } - - wcstombs(buf, msgbuf, chars + 1); - LocalFree(msgbuf); - } - else { - sprintf(buf, "unknown win32 error (%ld)", error); - } - - SetLastError(lasterr); - return buf; -} - -static void pwinerror (s) - const char *s; -{ - if (s && *s) - fprintf(stderr, "%s: %s\n", s, strwinerror(GetLastError ())); - else - fprintf(stderr, "%s\n", strwinerror(GetLastError ())); -} - -#endif /* UNDER_CE */ - -#ifndef GZ_SUFFIX -# define GZ_SUFFIX ".gz" -#endif -#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1) - -#define BUFLEN 16384 -#define MAX_NAME_LEN 1024 - -#ifdef MAXSEG_64K -# define local static - /* Needed for systems with limitation on stack size. */ -#else -# define local -#endif - -#ifdef Z_SOLO -/* for Z_SOLO, create simplified gz* functions using deflate and inflate */ - -#if defined(Z_HAVE_UNISTD_H) || defined(Z_LARGE) -# include /* for unlink() */ -#endif - -void *myalloc OF((void *, unsigned, unsigned)); -void myfree OF((void *, void *)); - -void *myalloc(q, n, m) - void *q; - unsigned n, m; -{ - q = Z_NULL; - return calloc(n, m); -} - -void myfree(q, p) - void *q, *p; -{ - q = Z_NULL; - free(p); -} - -typedef struct gzFile_s { - FILE *file; - int write; - int err; - char *msg; - z_stream strm; -} *gzFile; - -gzFile gzopen OF((const char *, const char *)); -gzFile gzdopen OF((int, const char *)); -gzFile gz_open OF((const char *, int, const char *)); - -gzFile gzopen(path, mode) -const char *path; -const char *mode; -{ - return gz_open(path, -1, mode); -} - -gzFile gzdopen(fd, mode) -int fd; -const char *mode; -{ - return gz_open(NULL, fd, mode); -} - -gzFile gz_open(path, fd, mode) - const char *path; - int fd; - const char *mode; -{ - gzFile gz; - int ret; - - gz = malloc(sizeof(struct gzFile_s)); - if (gz == NULL) - return NULL; - gz->write = strchr(mode, 'w') != NULL; - gz->strm.zalloc = myalloc; - gz->strm.zfree = myfree; - gz->strm.opaque = Z_NULL; - if (gz->write) - ret = deflateInit2(&(gz->strm), -1, 8, 15 + 16, 8, 0); - else { - gz->strm.next_in = 0; - gz->strm.avail_in = Z_NULL; - ret = inflateInit2(&(gz->strm), 15 + 16); - } - if (ret != Z_OK) { - free(gz); - return NULL; - } - gz->file = path == NULL ? fdopen(fd, gz->write ? "wb" : "rb") : - fopen(path, gz->write ? "wb" : "rb"); - if (gz->file == NULL) { - gz->write ? deflateEnd(&(gz->strm)) : inflateEnd(&(gz->strm)); - free(gz); - return NULL; - } - gz->err = 0; - gz->msg = ""; - return gz; -} - -int gzwrite OF((gzFile, const void *, unsigned)); - -int gzwrite(gz, buf, len) - gzFile gz; - const void *buf; - unsigned len; -{ - z_stream *strm; - unsigned char out[BUFLEN]; - - if (gz == NULL || !gz->write) - return 0; - strm = &(gz->strm); - strm->next_in = (void *)buf; - strm->avail_in = len; - do { - strm->next_out = out; - strm->avail_out = BUFLEN; - (void)deflate(strm, Z_NO_FLUSH); - fwrite(out, 1, BUFLEN - strm->avail_out, gz->file); - } while (strm->avail_out == 0); - return len; -} - -int gzread OF((gzFile, void *, unsigned)); - -int gzread(gz, buf, len) - gzFile gz; - void *buf; - unsigned len; -{ - int ret; - unsigned got; - unsigned char in[1]; - z_stream *strm; - - if (gz == NULL || gz->write) - return 0; - if (gz->err) - return 0; - strm = &(gz->strm); - strm->next_out = (void *)buf; - strm->avail_out = len; - do { - got = fread(in, 1, 1, gz->file); - if (got == 0) - break; - strm->next_in = in; - strm->avail_in = 1; - ret = inflate(strm, Z_NO_FLUSH); - if (ret == Z_DATA_ERROR) { - gz->err = Z_DATA_ERROR; - gz->msg = strm->msg; - return 0; - } - if (ret == Z_STREAM_END) - inflateReset(strm); - } while (strm->avail_out); - return len - strm->avail_out; -} - -int gzclose OF((gzFile)); - -int gzclose(gz) - gzFile gz; -{ - z_stream *strm; - unsigned char out[BUFLEN]; - - if (gz == NULL) - return Z_STREAM_ERROR; - strm = &(gz->strm); - if (gz->write) { - strm->next_in = Z_NULL; - strm->avail_in = 0; - do { - strm->next_out = out; - strm->avail_out = BUFLEN; - (void)deflate(strm, Z_FINISH); - fwrite(out, 1, BUFLEN - strm->avail_out, gz->file); - } while (strm->avail_out == 0); - deflateEnd(strm); - } - else - inflateEnd(strm); - fclose(gz->file); - free(gz); - return Z_OK; -} - -const char *gzerror OF((gzFile, int *)); - -const char *gzerror(gz, err) - gzFile gz; - int *err; -{ - *err = gz->err; - return gz->msg; -} - -#endif - -char *prog; - -void error OF((const char *msg)); -void gz_compress OF((FILE *in, gzFile out)); -#ifdef USE_MMAP -int gz_compress_mmap OF((FILE *in, gzFile out)); -#endif -void gz_uncompress OF((gzFile in, FILE *out)); -void file_compress OF((char *file, char *mode)); -void file_uncompress OF((char *file)); -int main OF((int argc, char *argv[])); - -/* =========================================================================== - * Display error message and exit - */ -void error(msg) - const char *msg; -{ - fprintf(stderr, "%s: %s\n", prog, msg); - exit(1); -} - -/* =========================================================================== - * Compress input to output then close both files. - */ - -void gz_compress(in, out) - FILE *in; - gzFile out; -{ - local char buf[BUFLEN]; - int len; - int err; - -#ifdef USE_MMAP - /* Try first compressing with mmap. If mmap fails (minigzip used in a - * pipe), use the normal fread loop. - */ - if (gz_compress_mmap(in, out) == Z_OK) return; -#endif - for (;;) { - len = (int)fread(buf, 1, sizeof(buf), in); - if (ferror(in)) { - perror("fread"); - exit(1); - } - if (len == 0) break; - - if (gzwrite(out, buf, (unsigned)len) != len) error(gzerror(out, &err)); - } - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); -} - -#ifdef USE_MMAP /* MMAP version, Miguel Albrecht */ - -/* Try compressing the input file at once using mmap. Return Z_OK if - * if success, Z_ERRNO otherwise. - */ -int gz_compress_mmap(in, out) - FILE *in; - gzFile out; -{ - int len; - int err; - int ifd = fileno(in); - caddr_t buf; /* mmap'ed buffer for the entire input file */ - off_t buf_len; /* length of the input file */ - struct stat sb; - - /* Determine the size of the file, needed for mmap: */ - if (fstat(ifd, &sb) < 0) return Z_ERRNO; - buf_len = sb.st_size; - if (buf_len <= 0) return Z_ERRNO; - - /* Now do the actual mmap: */ - buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0); - if (buf == (caddr_t)(-1)) return Z_ERRNO; - - /* Compress the whole file at once: */ - len = gzwrite(out, (char *)buf, (unsigned)buf_len); - - if (len != (int)buf_len) error(gzerror(out, &err)); - - munmap(buf, buf_len); - fclose(in); - if (gzclose(out) != Z_OK) error("failed gzclose"); - return Z_OK; -} -#endif /* USE_MMAP */ - -/* =========================================================================== - * Uncompress input to output then close both files. - */ -void gz_uncompress(in, out) - gzFile in; - FILE *out; -{ - local char buf[BUFLEN]; - int len; - int err; - - for (;;) { - len = gzread(in, buf, sizeof(buf)); - if (len < 0) error (gzerror(in, &err)); - if (len == 0) break; - - if ((int)fwrite(buf, 1, (unsigned)len, out) != len) { - error("failed fwrite"); - } - } - if (fclose(out)) error("failed fclose"); - - if (gzclose(in) != Z_OK) error("failed gzclose"); -} - - -/* =========================================================================== - * Compress the given file: create a corresponding .gz file and remove the - * original. - */ -void file_compress(file, mode) - char *file; - char *mode; -{ - local char outfile[MAX_NAME_LEN]; - FILE *in; - gzFile out; - - if (strlen(file) + strlen(GZ_SUFFIX) >= sizeof(outfile)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(outfile, sizeof(outfile), "%s%s", file, GZ_SUFFIX); -#else - strcpy(outfile, file); - strcat(outfile, GZ_SUFFIX); -#endif - - in = fopen(file, "rb"); - if (in == NULL) { - perror(file); - exit(1); - } - out = gzopen(outfile, mode); - if (out == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); - exit(1); - } - gz_compress(in, out); - - unlink(file); -} - - -/* =========================================================================== - * Uncompress the given file and remove the original. - */ -void file_uncompress(file) - char *file; -{ - local char buf[MAX_NAME_LEN]; - char *infile, *outfile; - FILE *out; - gzFile in; - size_t len = strlen(file); - - if (len + strlen(GZ_SUFFIX) >= sizeof(buf)) { - fprintf(stderr, "%s: filename too long\n", prog); - exit(1); - } - -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(buf, sizeof(buf), "%s", file); -#else - strcpy(buf, file); -#endif - - if (len > SUFFIX_LEN && strcmp(file+len-SUFFIX_LEN, GZ_SUFFIX) == 0) { - infile = file; - outfile = buf; - outfile[len-3] = '\0'; - } else { - outfile = file; - infile = buf; -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(buf + len, sizeof(buf) - len, "%s", GZ_SUFFIX); -#else - strcat(infile, GZ_SUFFIX); -#endif - } - in = gzopen(infile, "rb"); - if (in == NULL) { - fprintf(stderr, "%s: can't gzopen %s\n", prog, infile); - exit(1); - } - out = fopen(outfile, "wb"); - if (out == NULL) { - perror(file); - exit(1); - } - - gz_uncompress(in, out); - - unlink(infile); -} - - -/* =========================================================================== - * Usage: minigzip [-c] [-d] [-f] [-h] [-r] [-1 to -9] [files...] - * -c : write to standard output - * -d : decompress - * -f : compress with Z_FILTERED - * -h : compress with Z_HUFFMAN_ONLY - * -r : compress with Z_RLE - * -1 to -9 : compression level - */ - -int main(argc, argv) - int argc; - char *argv[]; -{ - int copyout = 0; - int uncompr = 0; - gzFile file; - char *bname, outmode[20]; - -#if !defined(NO_snprintf) && !defined(NO_vsnprintf) - snprintf(outmode, sizeof(outmode), "%s", "wb6 "); -#else - strcpy(outmode, "wb6 "); -#endif - - prog = argv[0]; - bname = strrchr(argv[0], '/'); - if (bname) - bname++; - else - bname = argv[0]; - argc--, argv++; - - if (!strcmp(bname, "gunzip")) - uncompr = 1; - else if (!strcmp(bname, "zcat")) - copyout = uncompr = 1; - - while (argc > 0) { - if (strcmp(*argv, "-c") == 0) - copyout = 1; - else if (strcmp(*argv, "-d") == 0) - uncompr = 1; - else if (strcmp(*argv, "-f") == 0) - outmode[3] = 'f'; - else if (strcmp(*argv, "-h") == 0) - outmode[3] = 'h'; - else if (strcmp(*argv, "-r") == 0) - outmode[3] = 'R'; - else if ((*argv)[0] == '-' && (*argv)[1] >= '1' && (*argv)[1] <= '9' && - (*argv)[2] == 0) - outmode[2] = (*argv)[1]; - else - break; - argc--, argv++; - } - if (outmode[3] == ' ') - outmode[3] = 0; - if (argc == 0) { - SET_BINARY_MODE(stdin); - SET_BINARY_MODE(stdout); - if (uncompr) { - file = gzdopen(fileno(stdin), "rb"); - if (file == NULL) error("can't gzdopen stdin"); - gz_uncompress(file, stdout); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - gz_compress(stdin, file); - } - } else { - if (copyout) { - SET_BINARY_MODE(stdout); - } - do { - if (uncompr) { - if (copyout) { - file = gzopen(*argv, "rb"); - if (file == NULL) - fprintf(stderr, "%s: can't gzopen %s\n", prog, *argv); - else - gz_uncompress(file, stdout); - } else { - file_uncompress(*argv); - } - } else { - if (copyout) { - FILE * in = fopen(*argv, "rb"); - - if (in == NULL) { - perror(*argv); - } else { - file = gzdopen(fileno(stdout), outmode); - if (file == NULL) error("can't gzdopen stdout"); - - gz_compress(in, file); - } - - } else { - file_compress(*argv, outmode); - } - } - } while (argv++, --argc); - } - return 0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.c deleted file mode 100644 index d5b32d1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.c +++ /dev/null @@ -1,1226 +0,0 @@ -/* trees.c -- output deflated data using Huffman coding - * Copyright (C) 1995-2012 Jean-loup Gailly - * detect_data_type() function provided freely by Cosmin Truta, 2006 - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* - * ALGORITHM - * - * The "deflation" process uses several Huffman trees. The more - * common source values are represented by shorter bit sequences. - * - * Each code tree is stored in a compressed form which is itself - * a Huffman encoding of the lengths of all the code strings (in - * ascending order by source values). The actual code strings are - * reconstructed from the lengths in the inflate process, as described - * in the deflate specification. - * - * REFERENCES - * - * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". - * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc - * - * Storer, James A. - * Data Compression: Methods and Theory, pp. 49-50. - * Computer Science Press, 1988. ISBN 0-7167-8156-5. - * - * Sedgewick, R. - * Algorithms, p290. - * Addison-Wesley, 1983. ISBN 0-201-06672-6. - */ - -/* @(#) $Id$ */ - -/* #define GEN_TREES_H */ - -#include "deflate.h" - -#ifdef DEBUG -# include -#endif - -/* =========================================================================== - * Constants - */ - -#define MAX_BL_BITS 7 -/* Bit length codes must not exceed MAX_BL_BITS bits */ - -#define END_BLOCK 256 -/* end of block literal code */ - -#define REP_3_6 16 -/* repeat previous bit length 3-6 times (2 bits of repeat count) */ - -#define REPZ_3_10 17 -/* repeat a zero length 3-10 times (3 bits of repeat count) */ - -#define REPZ_11_138 18 -/* repeat a zero length 11-138 times (7 bits of repeat count) */ - -local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ - = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; - -local const int extra_dbits[D_CODES] /* extra bits for each distance code */ - = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; - -local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ - = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; - -local const uch bl_order[BL_CODES] - = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; -/* The lengths of the bit length codes are sent in order of decreasing - * probability, to avoid transmitting the lengths for unused bit length codes. - */ - -/* =========================================================================== - * Local data. These are initialized only once. - */ - -#define DIST_CODE_LEN 512 /* see definition of array dist_code below */ - -#if defined(GEN_TREES_H) || !defined(STDC) -/* non ANSI compilers may not accept trees.h */ - -local ct_data static_ltree[L_CODES+2]; -/* The static literal tree. Since the bit lengths are imposed, there is no - * need for the L_CODES extra codes used during heap construction. However - * The codes 286 and 287 are needed to build a canonical tree (see _tr_init - * below). - */ - -local ct_data static_dtree[D_CODES]; -/* The static distance tree. (Actually a trivial tree since all codes use - * 5 bits.) - */ - -uch _dist_code[DIST_CODE_LEN]; -/* Distance codes. The first 256 values correspond to the distances - * 3 .. 258, the last 256 values correspond to the top 8 bits of - * the 15 bit distances. - */ - -uch _length_code[MAX_MATCH-MIN_MATCH+1]; -/* length code for each normalized match length (0 == MIN_MATCH) */ - -local int base_length[LENGTH_CODES]; -/* First normalized length for each code (0 = MIN_MATCH) */ - -local int base_dist[D_CODES]; -/* First normalized distance for each code (0 = distance of 1) */ - -#else -# include "trees.h" -#endif /* GEN_TREES_H */ - -struct static_tree_desc_s { - const ct_data *static_tree; /* static tree or NULL */ - const intf *extra_bits; /* extra bits for each code or NULL */ - int extra_base; /* base index for extra_bits */ - int elems; /* max number of elements in the tree */ - int max_length; /* max bit length for the codes */ -}; - -local static_tree_desc static_l_desc = -{static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; - -local static_tree_desc static_d_desc = -{static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; - -local static_tree_desc static_bl_desc = -{(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; - -/* =========================================================================== - * Local (static) routines in this file. - */ - -local void tr_static_init OF((void)); -local void init_block OF((deflate_state *s)); -local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); -local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); -local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); -local void build_tree OF((deflate_state *s, tree_desc *desc)); -local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); -local int build_bl_tree OF((deflate_state *s)); -local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, - int blcodes)); -local void compress_block OF((deflate_state *s, const ct_data *ltree, - const ct_data *dtree)); -local int detect_data_type OF((deflate_state *s)); -local unsigned bi_reverse OF((unsigned value, int length)); -local void bi_windup OF((deflate_state *s)); -local void bi_flush OF((deflate_state *s)); -local void copy_block OF((deflate_state *s, charf *buf, unsigned len, - int header)); - -#ifdef GEN_TREES_H -local void gen_trees_header OF((void)); -#endif - -#ifndef DEBUG -# define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) - /* Send a code of the given tree. c and tree must not have side effects */ - -#else /* DEBUG */ -# define send_code(s, c, tree) \ - { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ - send_bits(s, tree[c].Code, tree[c].Len); } -#endif - -/* =========================================================================== - * Output a short LSB first on the stream. - * IN assertion: there is enough room in pendingBuf. - */ -#define put_short(s, w) { \ - put_byte(s, (uch)((w) & 0xff)); \ - put_byte(s, (uch)((ush)(w) >> 8)); \ -} - -/* =========================================================================== - * Send a value on a given number of bits. - * IN assertion: length <= 16 and value fits in length bits. - */ -#ifdef DEBUG -local void send_bits OF((deflate_state *s, int value, int length)); - -local void send_bits(s, value, length) - deflate_state *s; - int value; /* value to send */ - int length; /* number of bits */ -{ - Tracevv((stderr," l %2d v %4x ", length, value)); - Assert(length > 0 && length <= 15, "invalid length"); - s->bits_sent += (ulg)length; - - /* If not enough room in bi_buf, use (valid) bits from bi_buf and - * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) - * unused bits in value. - */ - if (s->bi_valid > (int)Buf_size - length) { - s->bi_buf |= (ush)value << s->bi_valid; - put_short(s, s->bi_buf); - s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); - s->bi_valid += length - Buf_size; - } else { - s->bi_buf |= (ush)value << s->bi_valid; - s->bi_valid += length; - } -} -#else /* !DEBUG */ - -#define send_bits(s, value, length) \ -{ int len = length;\ - if (s->bi_valid > (int)Buf_size - len) {\ - int val = value;\ - s->bi_buf |= (ush)val << s->bi_valid;\ - put_short(s, s->bi_buf);\ - s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ - s->bi_valid += len - Buf_size;\ - } else {\ - s->bi_buf |= (ush)(value) << s->bi_valid;\ - s->bi_valid += len;\ - }\ -} -#endif /* DEBUG */ - - -/* the arguments must not have side effects */ - -/* =========================================================================== - * Initialize the various 'constant' tables. - */ -local void tr_static_init() -{ -#if defined(GEN_TREES_H) || !defined(STDC) - static int static_init_done = 0; - int n; /* iterates over tree elements */ - int bits; /* bit counter */ - int length; /* length value */ - int code; /* code value */ - int dist; /* distance index */ - ush bl_count[MAX_BITS+1]; - /* number of codes at each bit length for an optimal tree */ - - if (static_init_done) return; - - /* For some embedded targets, global variables are not initialized: */ -#ifdef NO_INIT_GLOBAL_POINTERS - static_l_desc.static_tree = static_ltree; - static_l_desc.extra_bits = extra_lbits; - static_d_desc.static_tree = static_dtree; - static_d_desc.extra_bits = extra_dbits; - static_bl_desc.extra_bits = extra_blbits; -#endif - - /* Initialize the mapping length (0..255) -> length code (0..28) */ - length = 0; - for (code = 0; code < LENGTH_CODES-1; code++) { - base_length[code] = length; - for (n = 0; n < (1< dist code (0..29) */ - dist = 0; - for (code = 0 ; code < 16; code++) { - base_dist[code] = dist; - for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ - for ( ; code < D_CODES; code++) { - base_dist[code] = dist << 7; - for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { - _dist_code[256 + dist++] = (uch)code; - } - } - Assert (dist == 256, "tr_static_init: 256+dist != 512"); - - /* Construct the codes of the static literal tree */ - for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; - n = 0; - while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; - while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; - while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; - while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; - /* Codes 286 and 287 do not exist, but we must include them in the - * tree construction to get a canonical Huffman tree (longest code - * all ones) - */ - gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); - - /* The static distance tree is trivial: */ - for (n = 0; n < D_CODES; n++) { - static_dtree[n].Len = 5; - static_dtree[n].Code = bi_reverse((unsigned)n, 5); - } - static_init_done = 1; - -# ifdef GEN_TREES_H - gen_trees_header(); -# endif -#endif /* defined(GEN_TREES_H) || !defined(STDC) */ -} - -/* =========================================================================== - * Genererate the file trees.h describing the static trees. - */ -#ifdef GEN_TREES_H -# ifndef DEBUG -# include -# endif - -# define SEPARATOR(i, last, width) \ - ((i) == (last)? "\n};\n\n" : \ - ((i) % (width) == (width)-1 ? ",\n" : ", ")) - -void gen_trees_header() -{ - FILE *header = fopen("trees.h", "w"); - int i; - - Assert (header != NULL, "Can't open trees.h"); - fprintf(header, - "/* header created automatically with -DGEN_TREES_H */\n\n"); - - fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); - for (i = 0; i < L_CODES+2; i++) { - fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, - static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); - } - - fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, - static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); - } - - fprintf(header, "const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = {\n"); - for (i = 0; i < DIST_CODE_LEN; i++) { - fprintf(header, "%2u%s", _dist_code[i], - SEPARATOR(i, DIST_CODE_LEN-1, 20)); - } - - fprintf(header, - "const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); - for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { - fprintf(header, "%2u%s", _length_code[i], - SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); - } - - fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); - for (i = 0; i < LENGTH_CODES; i++) { - fprintf(header, "%1u%s", base_length[i], - SEPARATOR(i, LENGTH_CODES-1, 20)); - } - - fprintf(header, "local const int base_dist[D_CODES] = {\n"); - for (i = 0; i < D_CODES; i++) { - fprintf(header, "%5u%s", base_dist[i], - SEPARATOR(i, D_CODES-1, 10)); - } - - fclose(header); -} -#endif /* GEN_TREES_H */ - -/* =========================================================================== - * Initialize the tree data structures for a new zlib stream. - */ -void ZLIB_INTERNAL _tr_init(s) - deflate_state *s; -{ - tr_static_init(); - - s->l_desc.dyn_tree = s->dyn_ltree; - s->l_desc.stat_desc = &static_l_desc; - - s->d_desc.dyn_tree = s->dyn_dtree; - s->d_desc.stat_desc = &static_d_desc; - - s->bl_desc.dyn_tree = s->bl_tree; - s->bl_desc.stat_desc = &static_bl_desc; - - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->compressed_len = 0L; - s->bits_sent = 0L; -#endif - - /* Initialize the first block of the first file: */ - init_block(s); -} - -/* =========================================================================== - * Initialize a new block. - */ -local void init_block(s) - deflate_state *s; -{ - int n; /* iterates over tree elements */ - - /* Initialize the trees. */ - for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; - for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; - for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; - - s->dyn_ltree[END_BLOCK].Freq = 1; - s->opt_len = s->static_len = 0L; - s->last_lit = s->matches = 0; -} - -#define SMALLEST 1 -/* Index within the heap array of least frequent node in the Huffman tree */ - - -/* =========================================================================== - * Remove the smallest element from the heap and recreate the heap with - * one less element. Updates heap and heap_len. - */ -#define pqremove(s, tree, top) \ -{\ - top = s->heap[SMALLEST]; \ - s->heap[SMALLEST] = s->heap[s->heap_len--]; \ - pqdownheap(s, tree, SMALLEST); \ -} - -/* =========================================================================== - * Compares to subtrees, using the tree depth as tie breaker when - * the subtrees have equal frequency. This minimizes the worst case length. - */ -#define smaller(tree, n, m, depth) \ - (tree[n].Freq < tree[m].Freq || \ - (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) - -/* =========================================================================== - * Restore the heap property by moving down the tree starting at node k, - * exchanging a node with the smallest of its two sons if necessary, stopping - * when the heap property is re-established (each father smaller than its - * two sons). - */ -local void pqdownheap(s, tree, k) - deflate_state *s; - ct_data *tree; /* the tree to restore */ - int k; /* node to move down */ -{ - int v = s->heap[k]; - int j = k << 1; /* left son of k */ - while (j <= s->heap_len) { - /* Set j to the smallest of the two sons: */ - if (j < s->heap_len && - smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { - j++; - } - /* Exit if v is smaller than both sons */ - if (smaller(tree, v, s->heap[j], s->depth)) break; - - /* Exchange v with the smallest son */ - s->heap[k] = s->heap[j]; k = j; - - /* And continue down the tree, setting j to the left son of k */ - j <<= 1; - } - s->heap[k] = v; -} - -/* =========================================================================== - * Compute the optimal bit lengths for a tree and update the total bit length - * for the current block. - * IN assertion: the fields freq and dad are set, heap[heap_max] and - * above are the tree nodes sorted by increasing frequency. - * OUT assertions: the field len is set to the optimal bit length, the - * array bl_count contains the frequencies for each bit length. - * The length opt_len is updated; static_len is also updated if stree is - * not null. - */ -local void gen_bitlen(s, desc) - deflate_state *s; - tree_desc *desc; /* the tree descriptor */ -{ - ct_data *tree = desc->dyn_tree; - int max_code = desc->max_code; - const ct_data *stree = desc->stat_desc->static_tree; - const intf *extra = desc->stat_desc->extra_bits; - int base = desc->stat_desc->extra_base; - int max_length = desc->stat_desc->max_length; - int h; /* heap index */ - int n, m; /* iterate over the tree elements */ - int bits; /* bit length */ - int xbits; /* extra bits */ - ush f; /* frequency */ - int overflow = 0; /* number of elements with bit length too large */ - - for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; - - /* In a first pass, compute the optimal bit lengths (which may - * overflow in the case of the bit length tree). - */ - tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ - - for (h = s->heap_max+1; h < HEAP_SIZE; h++) { - n = s->heap[h]; - bits = tree[tree[n].Dad].Len + 1; - if (bits > max_length) bits = max_length, overflow++; - tree[n].Len = (ush)bits; - /* We overwrite tree[n].Dad which is no longer needed */ - - if (n > max_code) continue; /* not a leaf node */ - - s->bl_count[bits]++; - xbits = 0; - if (n >= base) xbits = extra[n-base]; - f = tree[n].Freq; - s->opt_len += (ulg)f * (bits + xbits); - if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); - } - if (overflow == 0) return; - - Trace((stderr,"\nbit length overflow\n")); - /* This happens for example on obj2 and pic of the Calgary corpus */ - - /* Find the first bit length which could increase: */ - do { - bits = max_length-1; - while (s->bl_count[bits] == 0) bits--; - s->bl_count[bits]--; /* move one leaf down the tree */ - s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ - s->bl_count[max_length]--; - /* The brother of the overflow item also moves one step up, - * but this does not affect bl_count[max_length] - */ - overflow -= 2; - } while (overflow > 0); - - /* Now recompute all bit lengths, scanning in increasing frequency. - * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all - * lengths instead of fixing only the wrong ones. This idea is taken - * from 'ar' written by Haruhiko Okumura.) - */ - for (bits = max_length; bits != 0; bits--) { - n = s->bl_count[bits]; - while (n != 0) { - m = s->heap[--h]; - if (m > max_code) continue; - if ((unsigned) tree[m].Len != (unsigned) bits) { - Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); - s->opt_len += ((long)bits - (long)tree[m].Len) - *(long)tree[m].Freq; - tree[m].Len = (ush)bits; - } - n--; - } - } -} - -/* =========================================================================== - * Generate the codes for a given tree and bit counts (which need not be - * optimal). - * IN assertion: the array bl_count contains the bit length statistics for - * the given tree and the field len is set for all tree elements. - * OUT assertion: the field code is set for all tree elements of non - * zero code length. - */ -local void gen_codes (tree, max_code, bl_count) - ct_data *tree; /* the tree to decorate */ - int max_code; /* largest code with non zero frequency */ - ushf *bl_count; /* number of codes at each bit length */ -{ - ush next_code[MAX_BITS+1]; /* next code value for each bit length */ - ush code = 0; /* running code value */ - int bits; /* bit index */ - int n; /* code index */ - - /* The distribution counts are first used to generate the code values - * without bit reversal. - */ - for (bits = 1; bits <= MAX_BITS; bits++) { - next_code[bits] = code = (code + bl_count[bits-1]) << 1; - } - /* Check that the bit counts in bl_count are consistent. The last code - * must be all ones. - */ - Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; - const ct_data *stree = desc->stat_desc->static_tree; - int elems = desc->stat_desc->elems; - int n, m; /* iterate over heap elements */ - int max_code = -1; /* largest code with non zero frequency */ - int node; /* new node being created */ - - /* Construct the initial heap, with least frequent element in - * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. - * heap[0] is not used. - */ - s->heap_len = 0, s->heap_max = HEAP_SIZE; - - for (n = 0; n < elems; n++) { - if (tree[n].Freq != 0) { - s->heap[++(s->heap_len)] = max_code = n; - s->depth[n] = 0; - } else { - tree[n].Len = 0; - } - } - - /* The pkzip format requires that at least one distance code exists, - * and that at least one bit should be sent even if there is only one - * possible code. So to avoid special checks later on we force at least - * two codes of non zero frequency. - */ - while (s->heap_len < 2) { - node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); - tree[node].Freq = 1; - s->depth[node] = 0; - s->opt_len--; if (stree) s->static_len -= stree[node].Len; - /* node is 0 or 1 so it does not have extra bits */ - } - desc->max_code = max_code; - - /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, - * establish sub-heaps of increasing lengths: - */ - for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); - - /* Construct the Huffman tree by repeatedly combining the least two - * frequent nodes. - */ - node = elems; /* next internal node of the tree */ - do { - pqremove(s, tree, n); /* n = node of least frequency */ - m = s->heap[SMALLEST]; /* m = node of next least frequency */ - - s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ - s->heap[--(s->heap_max)] = m; - - /* Create a new node father of n and m */ - tree[node].Freq = tree[n].Freq + tree[m].Freq; - s->depth[node] = (uch)((s->depth[n] >= s->depth[m] ? - s->depth[n] : s->depth[m]) + 1); - tree[n].Dad = tree[m].Dad = (ush)node; -#ifdef DUMP_BL_TREE - if (tree == s->bl_tree) { - fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", - node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); - } -#endif - /* and insert the new node in the heap */ - s->heap[SMALLEST] = node++; - pqdownheap(s, tree, SMALLEST); - - } while (s->heap_len >= 2); - - s->heap[--(s->heap_max)] = s->heap[SMALLEST]; - - /* At this point, the fields freq and dad are set. We can now - * generate the bit lengths. - */ - gen_bitlen(s, (tree_desc *)desc); - - /* The field len is now set, we can generate the bit codes */ - gen_codes ((ct_data *)tree, max_code, s->bl_count); -} - -/* =========================================================================== - * Scan a literal or distance tree to determine the frequencies of the codes - * in the bit length tree. - */ -local void scan_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - if (nextlen == 0) max_count = 138, min_count = 3; - tree[max_code+1].Len = (ush)0xffff; /* guard */ - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - s->bl_tree[curlen].Freq += count; - } else if (curlen != 0) { - if (curlen != prevlen) s->bl_tree[curlen].Freq++; - s->bl_tree[REP_3_6].Freq++; - } else if (count <= 10) { - s->bl_tree[REPZ_3_10].Freq++; - } else { - s->bl_tree[REPZ_11_138].Freq++; - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Send a literal or distance tree in compressed form, using the codes in - * bl_tree. - */ -local void send_tree (s, tree, max_code) - deflate_state *s; - ct_data *tree; /* the tree to be scanned */ - int max_code; /* and its largest code of non zero frequency */ -{ - int n; /* iterates over all tree elements */ - int prevlen = -1; /* last emitted length */ - int curlen; /* length of current code */ - int nextlen = tree[0].Len; /* length of next code */ - int count = 0; /* repeat count of the current code */ - int max_count = 7; /* max repeat count */ - int min_count = 4; /* min repeat count */ - - /* tree[max_code+1].Len = -1; */ /* guard already set */ - if (nextlen == 0) max_count = 138, min_count = 3; - - for (n = 0; n <= max_code; n++) { - curlen = nextlen; nextlen = tree[n+1].Len; - if (++count < max_count && curlen == nextlen) { - continue; - } else if (count < min_count) { - do { send_code(s, curlen, s->bl_tree); } while (--count != 0); - - } else if (curlen != 0) { - if (curlen != prevlen) { - send_code(s, curlen, s->bl_tree); count--; - } - Assert(count >= 3 && count <= 6, " 3_6?"); - send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); - - } else if (count <= 10) { - send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); - - } else { - send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); - } - count = 0; prevlen = curlen; - if (nextlen == 0) { - max_count = 138, min_count = 3; - } else if (curlen == nextlen) { - max_count = 6, min_count = 3; - } else { - max_count = 7, min_count = 4; - } - } -} - -/* =========================================================================== - * Construct the Huffman tree for the bit lengths and return the index in - * bl_order of the last bit length code to send. - */ -local int build_bl_tree(s) - deflate_state *s; -{ - int max_blindex; /* index of last bit length code of non zero freq */ - - /* Determine the bit length frequencies for literal and distance trees */ - scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); - scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); - - /* Build the bit length tree: */ - build_tree(s, (tree_desc *)(&(s->bl_desc))); - /* opt_len now includes the length of the tree representations, except - * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. - */ - - /* Determine the number of bit length codes to send. The pkzip format - * requires that at least 4 bit length codes be sent. (appnote.txt says - * 3 but the actual value used is 4.) - */ - for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { - if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; - } - /* Update opt_len to include the bit length tree and counts */ - s->opt_len += 3*(max_blindex+1) + 5+5+4; - Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", - s->opt_len, s->static_len)); - - return max_blindex; -} - -/* =========================================================================== - * Send the header for a block using dynamic Huffman trees: the counts, the - * lengths of the bit length codes, the literal tree and the distance tree. - * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. - */ -local void send_all_trees(s, lcodes, dcodes, blcodes) - deflate_state *s; - int lcodes, dcodes, blcodes; /* number of codes for each tree */ -{ - int rank; /* index in bl_order */ - - Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); - Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, - "too many codes"); - Tracev((stderr, "\nbl counts: ")); - send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ - send_bits(s, dcodes-1, 5); - send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ - for (rank = 0; rank < blcodes; rank++) { - Tracev((stderr, "\nbl code %2d ", bl_order[rank])); - send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); - } - Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ - Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); - - send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ - Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); -} - -/* =========================================================================== - * Send a stored block - */ -void ZLIB_INTERNAL _tr_stored_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - send_bits(s, (STORED_BLOCK<<1)+last, 3); /* send block type */ -#ifdef DEBUG - s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; - s->compressed_len += (stored_len + 4) << 3; -#endif - copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ -} - -/* =========================================================================== - * Flush the bits in the bit buffer to pending output (leaves at most 7 bits) - */ -void ZLIB_INTERNAL _tr_flush_bits(s) - deflate_state *s; -{ - bi_flush(s); -} - -/* =========================================================================== - * Send one empty static block to give enough lookahead for inflate. - * This takes 10 bits, of which 7 may remain in the bit buffer. - */ -void ZLIB_INTERNAL _tr_align(s) - deflate_state *s; -{ - send_bits(s, STATIC_TREES<<1, 3); - send_code(s, END_BLOCK, static_ltree); -#ifdef DEBUG - s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ -#endif - bi_flush(s); -} - -/* =========================================================================== - * Determine the best encoding for the current block: dynamic trees, static - * trees or store, and output the encoded block to the zip file. - */ -void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last) - deflate_state *s; - charf *buf; /* input block, or NULL if too old */ - ulg stored_len; /* length of input block */ - int last; /* one if this is the last block for a file */ -{ - ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ - int max_blindex = 0; /* index of last bit length code of non zero freq */ - - /* Build the Huffman trees unless a stored block is forced */ - if (s->level > 0) { - - /* Check if the file is binary or text */ - if (s->strm->data_type == Z_UNKNOWN) - s->strm->data_type = detect_data_type(s); - - /* Construct the literal and distance trees */ - build_tree(s, (tree_desc *)(&(s->l_desc))); - Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - - build_tree(s, (tree_desc *)(&(s->d_desc))); - Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, - s->static_len)); - /* At this point, opt_len and static_len are the total bit lengths of - * the compressed block data, excluding the tree representations. - */ - - /* Build the bit length tree for the above two trees, and get the index - * in bl_order of the last bit length code to send. - */ - max_blindex = build_bl_tree(s); - - /* Determine the best encoding. Compute the block lengths in bytes. */ - opt_lenb = (s->opt_len+3+7)>>3; - static_lenb = (s->static_len+3+7)>>3; - - Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", - opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, - s->last_lit)); - - if (static_lenb <= opt_lenb) opt_lenb = static_lenb; - - } else { - Assert(buf != (char*)0, "lost buf"); - opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ - } - -#ifdef FORCE_STORED - if (buf != (char*)0) { /* force stored block */ -#else - if (stored_len+4 <= opt_lenb && buf != (char*)0) { - /* 4: two words for the lengths */ -#endif - /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. - * Otherwise we can't have processed more than WSIZE input bytes since - * the last block flush, because compression would have been - * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to - * transform a block into a stored block. - */ - _tr_stored_block(s, buf, stored_len, last); - -#ifdef FORCE_STATIC - } else if (static_lenb >= 0) { /* force static trees */ -#else - } else if (s->strategy == Z_FIXED || static_lenb == opt_lenb) { -#endif - send_bits(s, (STATIC_TREES<<1)+last, 3); - compress_block(s, (const ct_data *)static_ltree, - (const ct_data *)static_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->static_len; -#endif - } else { - send_bits(s, (DYN_TREES<<1)+last, 3); - send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, - max_blindex+1); - compress_block(s, (const ct_data *)s->dyn_ltree, - (const ct_data *)s->dyn_dtree); -#ifdef DEBUG - s->compressed_len += 3 + s->opt_len; -#endif - } - Assert (s->compressed_len == s->bits_sent, "bad compressed size"); - /* The above check is made mod 2^32, for files larger than 512 MB - * and uLong implemented on 32 bits. - */ - init_block(s); - - if (last) { - bi_windup(s); -#ifdef DEBUG - s->compressed_len += 7; /* align on byte boundary */ -#endif - } - Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, - s->compressed_len-7*last)); -} - -/* =========================================================================== - * Save the match info and tally the frequency counts. Return true if - * the current block must be flushed. - */ -int ZLIB_INTERNAL _tr_tally (s, dist, lc) - deflate_state *s; - unsigned dist; /* distance of matched string */ - unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ -{ - s->d_buf[s->last_lit] = (ush)dist; - s->l_buf[s->last_lit++] = (uch)lc; - if (dist == 0) { - /* lc is the unmatched char */ - s->dyn_ltree[lc].Freq++; - } else { - s->matches++; - /* Here, lc is the match length - MIN_MATCH */ - dist--; /* dist = match distance - 1 */ - Assert((ush)dist < (ush)MAX_DIST(s) && - (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && - (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); - - s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; - s->dyn_dtree[d_code(dist)].Freq++; - } - -#ifdef TRUNCATE_BLOCK - /* Try to guess if it is profitable to stop the current block here */ - if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { - /* Compute an upper bound for the compressed length */ - ulg out_length = (ulg)s->last_lit*8L; - ulg in_length = (ulg)((long)s->strstart - s->block_start); - int dcode; - for (dcode = 0; dcode < D_CODES; dcode++) { - out_length += (ulg)s->dyn_dtree[dcode].Freq * - (5L+extra_dbits[dcode]); - } - out_length >>= 3; - Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", - s->last_lit, in_length, out_length, - 100L - out_length*100L/in_length)); - if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; - } -#endif - return (s->last_lit == s->lit_bufsize-1); - /* We avoid equality with lit_bufsize because of wraparound at 64K - * on 16 bit machines and because stored blocks are restricted to - * 64K-1 bytes. - */ -} - -/* =========================================================================== - * Send the block data compressed using the given Huffman trees - */ -local void compress_block(s, ltree, dtree) - deflate_state *s; - const ct_data *ltree; /* literal tree */ - const ct_data *dtree; /* distance tree */ -{ - unsigned dist; /* distance of matched string */ - int lc; /* match length or unmatched char (if dist == 0) */ - unsigned lx = 0; /* running index in l_buf */ - unsigned code; /* the code to send */ - int extra; /* number of extra bits to send */ - - if (s->last_lit != 0) do { - dist = s->d_buf[lx]; - lc = s->l_buf[lx++]; - if (dist == 0) { - send_code(s, lc, ltree); /* send a literal byte */ - Tracecv(isgraph(lc), (stderr," '%c' ", lc)); - } else { - /* Here, lc is the match length - MIN_MATCH */ - code = _length_code[lc]; - send_code(s, code+LITERALS+1, ltree); /* send the length code */ - extra = extra_lbits[code]; - if (extra != 0) { - lc -= base_length[code]; - send_bits(s, lc, extra); /* send the extra length bits */ - } - dist--; /* dist is now the match distance - 1 */ - code = d_code(dist); - Assert (code < D_CODES, "bad d_code"); - - send_code(s, code, dtree); /* send the distance code */ - extra = extra_dbits[code]; - if (extra != 0) { - dist -= base_dist[code]; - send_bits(s, dist, extra); /* send the extra distance bits */ - } - } /* literal or match pair ? */ - - /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ - Assert((uInt)(s->pending) < s->lit_bufsize + 2*lx, - "pendingBuf overflow"); - - } while (lx < s->last_lit); - - send_code(s, END_BLOCK, ltree); -} - -/* =========================================================================== - * Check if the data type is TEXT or BINARY, using the following algorithm: - * - TEXT if the two conditions below are satisfied: - * a) There are no non-portable control characters belonging to the - * "black list" (0..6, 14..25, 28..31). - * b) There is at least one printable character belonging to the - * "white list" (9 {TAB}, 10 {LF}, 13 {CR}, 32..255). - * - BINARY otherwise. - * - The following partially-portable control characters form a - * "gray list" that is ignored in this detection algorithm: - * (7 {BEL}, 8 {BS}, 11 {VT}, 12 {FF}, 26 {SUB}, 27 {ESC}). - * IN assertion: the fields Freq of dyn_ltree are set. - */ -local int detect_data_type(s) - deflate_state *s; -{ - /* black_mask is the bit mask of black-listed bytes - * set bits 0..6, 14..25, and 28..31 - * 0xf3ffc07f = binary 11110011111111111100000001111111 - */ - unsigned long black_mask = 0xf3ffc07fUL; - int n; - - /* Check for non-textual ("black-listed") bytes. */ - for (n = 0; n <= 31; n++, black_mask >>= 1) - if ((black_mask & 1) && (s->dyn_ltree[n].Freq != 0)) - return Z_BINARY; - - /* Check for textual ("white-listed") bytes. */ - if (s->dyn_ltree[9].Freq != 0 || s->dyn_ltree[10].Freq != 0 - || s->dyn_ltree[13].Freq != 0) - return Z_TEXT; - for (n = 32; n < LITERALS; n++) - if (s->dyn_ltree[n].Freq != 0) - return Z_TEXT; - - /* There are no "black-listed" or "white-listed" bytes: - * this stream either is empty or has tolerated ("gray-listed") bytes only. - */ - return Z_BINARY; -} - -/* =========================================================================== - * Reverse the first len bits of a code, using straightforward code (a faster - * method would use a table) - * IN assertion: 1 <= len <= 15 - */ -local unsigned bi_reverse(code, len) - unsigned code; /* the value to invert */ - int len; /* its bit length */ -{ - register unsigned res = 0; - do { - res |= code & 1; - code >>= 1, res <<= 1; - } while (--len > 0); - return res >> 1; -} - -/* =========================================================================== - * Flush the bit buffer, keeping at most 7 bits in it. - */ -local void bi_flush(s) - deflate_state *s; -{ - if (s->bi_valid == 16) { - put_short(s, s->bi_buf); - s->bi_buf = 0; - s->bi_valid = 0; - } else if (s->bi_valid >= 8) { - put_byte(s, (Byte)s->bi_buf); - s->bi_buf >>= 8; - s->bi_valid -= 8; - } -} - -/* =========================================================================== - * Flush the bit buffer and align the output on a byte boundary - */ -local void bi_windup(s) - deflate_state *s; -{ - if (s->bi_valid > 8) { - put_short(s, s->bi_buf); - } else if (s->bi_valid > 0) { - put_byte(s, (Byte)s->bi_buf); - } - s->bi_buf = 0; - s->bi_valid = 0; -#ifdef DEBUG - s->bits_sent = (s->bits_sent+7) & ~7; -#endif -} - -/* =========================================================================== - * Copy a stored block, storing first the length and its - * one's complement if requested. - */ -local void copy_block(s, buf, len, header) - deflate_state *s; - charf *buf; /* the input data */ - unsigned len; /* its length */ - int header; /* true if block header must be written */ -{ - bi_windup(s); /* align on byte boundary */ - - if (header) { - put_short(s, (ush)len); - put_short(s, (ush)~len); -#ifdef DEBUG - s->bits_sent += 2*16; -#endif - } -#ifdef DEBUG - s->bits_sent += (ulg)len<<3; -#endif - while (len--) { - put_byte(s, *buf++); - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.h deleted file mode 100644 index ce8f620..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/trees.h +++ /dev/null @@ -1,128 +0,0 @@ -/* header created automatically with -DGEN_TREES_H */ - -local const ct_data static_ltree[L_CODES+2] = { -{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, -{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, -{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, -{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, -{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, -{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, -{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, -{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, -{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, -{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, -{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, -{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, -{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, -{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, -{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, -{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, -{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, -{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, -{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, -{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, -{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, -{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, -{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, -{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, -{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, -{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, -{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, -{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, -{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, -{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, -{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, -{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, -{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, -{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, -{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, -{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, -{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, -{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, -{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, -{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, -{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, -{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, -{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, -{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, -{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, -{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, -{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, -{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, -{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, -{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, -{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, -{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, -{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, -{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, -{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, -{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, -{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, -{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} -}; - -local const ct_data static_dtree[D_CODES] = { -{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, -{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, -{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, -{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, -{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, -{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} -}; - -const uch ZLIB_INTERNAL _dist_code[DIST_CODE_LEN] = { - 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, - 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, -10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, -11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, -12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, -13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, -14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, -15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, -18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, -28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, -29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 -}; - -const uch ZLIB_INTERNAL _length_code[MAX_MATCH-MIN_MATCH+1]= { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, -13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, -17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, -19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, -21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, -22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, -23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, -26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, -27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 -}; - -local const int base_length[LENGTH_CODES] = { -0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, -64, 80, 96, 112, 128, 160, 192, 224, 0 -}; - -local const int base_dist[D_CODES] = { - 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, - 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, - 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 -}; - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/uncompr.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/uncompr.c deleted file mode 100644 index 6cfc6dd..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/uncompr.c +++ /dev/null @@ -1,59 +0,0 @@ -/* uncompr.c -- decompress a memory buffer - * Copyright (C) 1995-2003, 2010 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#define ZLIB_INTERNAL -#include "zlib.h" - -/* =========================================================================== - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -*/ -int ZEXPORT uncompress (dest, destLen, source, sourceLen) - Bytef *dest; - uLongf *destLen; - const Bytef *source; - uLong sourceLen; -{ - z_stream stream; - int err; - - stream.next_in = (z_const Bytef *)source; - stream.avail_in = (uInt)sourceLen; - /* Check for source > 64K on 16-bit machine: */ - if ((uLong)stream.avail_in != sourceLen) return Z_BUF_ERROR; - - stream.next_out = dest; - stream.avail_out = (uInt)*destLen; - if ((uLong)stream.avail_out != *destLen) return Z_BUF_ERROR; - - stream.zalloc = (alloc_func)0; - stream.zfree = (free_func)0; - - err = inflateInit(&stream); - if (err != Z_OK) return err; - - err = inflate(&stream, Z_FINISH); - if (err != Z_STREAM_END) { - inflateEnd(&stream); - if (err == Z_NEED_DICT || (err == Z_BUF_ERROR && stream.avail_in == 0)) - return Z_DATA_ERROR; - return err; - } - *destLen = stream.total_out; - - err = inflateEnd(&stream); - return err; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zconf.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zconf.h deleted file mode 100644 index add1675..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zconf.h +++ /dev/null @@ -1,511 +0,0 @@ -/* zconf.h -- configuration of the zlib compression library - * Copyright (C) 1995-2013 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#ifndef ZCONF_H -#define ZCONF_H - -/* - * If you *really* need a unique prefix for all types and library functions, - * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. - * Even better than compiling with -DZ_PREFIX would be to use configure to set - * this permanently in zconf.h using "./configure --zprefix". - */ -#ifdef Z_PREFIX /* may be set to #if 1 by ./configure */ -# define Z_PREFIX_SET - -/* all linked symbols */ -# define _dist_code z__dist_code -# define _length_code z__length_code -# define _tr_align z__tr_align -# define _tr_flush_bits z__tr_flush_bits -# define _tr_flush_block z__tr_flush_block -# define _tr_init z__tr_init -# define _tr_stored_block z__tr_stored_block -# define _tr_tally z__tr_tally -# define adler32 z_adler32 -# define adler32_combine z_adler32_combine -# define adler32_combine64 z_adler32_combine64 -# ifndef Z_SOLO -# define compress z_compress -# define compress2 z_compress2 -# define compressBound z_compressBound -# endif -# define crc32 z_crc32 -# define crc32_combine z_crc32_combine -# define crc32_combine64 z_crc32_combine64 -# define deflate z_deflate -# define deflateBound z_deflateBound -# define deflateCopy z_deflateCopy -# define deflateEnd z_deflateEnd -# define deflateInit2_ z_deflateInit2_ -# define deflateInit_ z_deflateInit_ -# define deflateParams z_deflateParams -# define deflatePending z_deflatePending -# define deflatePrime z_deflatePrime -# define deflateReset z_deflateReset -# define deflateResetKeep z_deflateResetKeep -# define deflateSetDictionary z_deflateSetDictionary -# define deflateSetHeader z_deflateSetHeader -# define deflateTune z_deflateTune -# define deflate_copyright z_deflate_copyright -# define get_crc_table z_get_crc_table -# ifndef Z_SOLO -# define gz_error z_gz_error -# define gz_intmax z_gz_intmax -# define gz_strwinerror z_gz_strwinerror -# define gzbuffer z_gzbuffer -# define gzclearerr z_gzclearerr -# define gzclose z_gzclose -# define gzclose_r z_gzclose_r -# define gzclose_w z_gzclose_w -# define gzdirect z_gzdirect -# define gzdopen z_gzdopen -# define gzeof z_gzeof -# define gzerror z_gzerror -# define gzflush z_gzflush -# define gzgetc z_gzgetc -# define gzgetc_ z_gzgetc_ -# define gzgets z_gzgets -# define gzoffset z_gzoffset -# define gzoffset64 z_gzoffset64 -# define gzopen z_gzopen -# define gzopen64 z_gzopen64 -# ifdef _WIN32 -# define gzopen_w z_gzopen_w -# endif -# define gzprintf z_gzprintf -# define gzvprintf z_gzvprintf -# define gzputc z_gzputc -# define gzputs z_gzputs -# define gzread z_gzread -# define gzrewind z_gzrewind -# define gzseek z_gzseek -# define gzseek64 z_gzseek64 -# define gzsetparams z_gzsetparams -# define gztell z_gztell -# define gztell64 z_gztell64 -# define gzungetc z_gzungetc -# define gzwrite z_gzwrite -# endif -# define inflate z_inflate -# define inflateBack z_inflateBack -# define inflateBackEnd z_inflateBackEnd -# define inflateBackInit_ z_inflateBackInit_ -# define inflateCopy z_inflateCopy -# define inflateEnd z_inflateEnd -# define inflateGetHeader z_inflateGetHeader -# define inflateInit2_ z_inflateInit2_ -# define inflateInit_ z_inflateInit_ -# define inflateMark z_inflateMark -# define inflatePrime z_inflatePrime -# define inflateReset z_inflateReset -# define inflateReset2 z_inflateReset2 -# define inflateSetDictionary z_inflateSetDictionary -# define inflateGetDictionary z_inflateGetDictionary -# define inflateSync z_inflateSync -# define inflateSyncPoint z_inflateSyncPoint -# define inflateUndermine z_inflateUndermine -# define inflateResetKeep z_inflateResetKeep -# define inflate_copyright z_inflate_copyright -# define inflate_fast z_inflate_fast -# define inflate_table z_inflate_table -# ifndef Z_SOLO -# define uncompress z_uncompress -# endif -# define zError z_zError -# ifndef Z_SOLO -# define zcalloc z_zcalloc -# define zcfree z_zcfree -# endif -# define zlibCompileFlags z_zlibCompileFlags -# define zlibVersion z_zlibVersion - -/* all zlib typedefs in zlib.h and zconf.h */ -# define Byte z_Byte -# define Bytef z_Bytef -# define alloc_func z_alloc_func -# define charf z_charf -# define free_func z_free_func -# ifndef Z_SOLO -# define gzFile z_gzFile -# endif -# define gz_header z_gz_header -# define gz_headerp z_gz_headerp -# define in_func z_in_func -# define intf z_intf -# define out_func z_out_func -# define uInt z_uInt -# define uIntf z_uIntf -# define uLong z_uLong -# define uLongf z_uLongf -# define voidp z_voidp -# define voidpc z_voidpc -# define voidpf z_voidpf - -/* all zlib structs in zlib.h and zconf.h */ -# define gz_header_s z_gz_header_s -# define internal_state z_internal_state - -#endif - -#if defined(__MSDOS__) && !defined(MSDOS) -# define MSDOS -#endif -#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2) -# define OS2 -#endif -#if defined(_WINDOWS) && !defined(WINDOWS) -# define WINDOWS -#endif -#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__) -# ifndef WIN32 -# define WIN32 -# endif -#endif -#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32) -# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__) -# ifndef SYS16BIT -# define SYS16BIT -# endif -# endif -#endif - -/* - * Compile with -DMAXSEG_64K if the alloc function cannot allocate more - * than 64k bytes at a time (needed on systems with 16-bit int). - */ -#ifdef SYS16BIT -# define MAXSEG_64K -#endif -#ifdef MSDOS -# define UNALIGNED_OK -#endif - -#ifdef __STDC_VERSION__ -# ifndef STDC -# define STDC -# endif -# if __STDC_VERSION__ >= 199901L -# ifndef STDC99 -# define STDC99 -# endif -# endif -#endif -#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus)) -# define STDC -#endif -#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__)) -# define STDC -#endif -#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) -# define STDC -#endif -#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) -# define STDC -#endif - -#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */ -# define STDC -#endif - -#ifndef STDC -# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ -# define const /* note: need a more gentle solution here */ -# endif -#endif - -#if defined(ZLIB_CONST) && !defined(z_const) -# define z_const const -#else -# define z_const -#endif - -/* Some Mac compilers merge all .h files incorrectly: */ -#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__) -# define NO_DUMMY_DECL -#endif - -/* Maximum value for memLevel in deflateInit2 */ -#ifndef MAX_MEM_LEVEL -# ifdef MAXSEG_64K -# define MAX_MEM_LEVEL 8 -# else -# define MAX_MEM_LEVEL 9 -# endif -#endif - -/* Maximum value for windowBits in deflateInit2 and inflateInit2. - * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files - * created by gzip. (Files created by minigzip can still be extracted by - * gzip.) - */ -#ifndef MAX_WBITS -# define MAX_WBITS 15 /* 32K LZ77 window */ -#endif - -/* The memory requirements for deflate are (in bytes): - (1 << (windowBits+2)) + (1 << (memLevel+9)) - that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) - plus a few kilobytes for small objects. For example, if you want to reduce - the default memory requirements from 256K to 128K, compile with - make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" - Of course this will generally degrade compression (there's no free lunch). - - The memory requirements for inflate are (in bytes) 1 << windowBits - that is, 32K for windowBits=15 (default value) plus a few kilobytes - for small objects. -*/ - - /* Type declarations */ - -#ifndef OF /* function prototypes */ -# ifdef STDC -# define OF(args) args -# else -# define OF(args) () -# endif -#endif - -#ifndef Z_ARG /* function prototypes for stdarg */ -# if defined(STDC) || defined(Z_HAVE_STDARG_H) -# define Z_ARG(args) args -# else -# define Z_ARG(args) () -# endif -#endif - -/* The following definitions for FAR are needed only for MSDOS mixed - * model programming (small or medium model with some far allocations). - * This was tested only with MSC; for other MSDOS compilers you may have - * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, - * just define FAR to be empty. - */ -#ifdef SYS16BIT -# if defined(M_I86SM) || defined(M_I86MM) - /* MSC small or medium model */ -# define SMALL_MEDIUM -# ifdef _MSC_VER -# define FAR _far -# else -# define FAR far -# endif -# endif -# if (defined(__SMALL__) || defined(__MEDIUM__)) - /* Turbo C small or medium model */ -# define SMALL_MEDIUM -# ifdef __BORLANDC__ -# define FAR _far -# else -# define FAR far -# endif -# endif -#endif - -#if defined(WINDOWS) || defined(WIN32) - /* If building or using zlib as a DLL, define ZLIB_DLL. - * This is not mandatory, but it offers a little performance increase. - */ -# ifdef ZLIB_DLL -# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500)) -# ifdef ZLIB_INTERNAL -# define ZEXTERN extern __declspec(dllexport) -# else -# define ZEXTERN extern __declspec(dllimport) -# endif -# endif -# endif /* ZLIB_DLL */ - /* If building or using zlib with the WINAPI/WINAPIV calling convention, - * define ZLIB_WINAPI. - * Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI. - */ -# ifdef ZLIB_WINAPI -# ifdef FAR -# undef FAR -# endif -# include - /* No need for _export, use ZLIB.DEF instead. */ - /* For complete Windows compatibility, use WINAPI, not __stdcall. */ -# define ZEXPORT WINAPI -# ifdef WIN32 -# define ZEXPORTVA WINAPIV -# else -# define ZEXPORTVA FAR CDECL -# endif -# endif -#endif - -#if defined (__BEOS__) -# ifdef ZLIB_DLL -# ifdef ZLIB_INTERNAL -# define ZEXPORT __declspec(dllexport) -# define ZEXPORTVA __declspec(dllexport) -# else -# define ZEXPORT __declspec(dllimport) -# define ZEXPORTVA __declspec(dllimport) -# endif -# endif -#endif - -#ifndef ZEXTERN -# define ZEXTERN extern -#endif -#ifndef ZEXPORT -# define ZEXPORT -#endif -#ifndef ZEXPORTVA -# define ZEXPORTVA -#endif - -#ifndef FAR -# define FAR -#endif - -#if !defined(__MACTYPES__) -typedef unsigned char Byte; /* 8 bits */ -#endif -typedef unsigned int uInt; /* 16 bits or more */ -typedef unsigned long uLong; /* 32 bits or more */ - -#ifdef SMALL_MEDIUM - /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ -# define Bytef Byte FAR -#else - typedef Byte FAR Bytef; -#endif -typedef char FAR charf; -typedef int FAR intf; -typedef uInt FAR uIntf; -typedef uLong FAR uLongf; - -#ifdef STDC - typedef void const *voidpc; - typedef void FAR *voidpf; - typedef void *voidp; -#else - typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; -#endif - -#if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC) -# include -# if (UINT_MAX == 0xffffffffUL) -# define Z_U4 unsigned -# elif (ULONG_MAX == 0xffffffffUL) -# define Z_U4 unsigned long -# elif (USHRT_MAX == 0xffffffffUL) -# define Z_U4 unsigned short -# endif -#endif - -#ifdef Z_U4 - typedef Z_U4 z_crc_t; -#else - typedef unsigned long z_crc_t; -#endif - -#ifdef HAVE_UNISTD_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_UNISTD_H -#endif - -#ifdef HAVE_STDARG_H /* may be set to #if 1 by ./configure */ -# define Z_HAVE_STDARG_H -#endif - -#ifdef STDC -# ifndef Z_SOLO -# include /* for off_t */ -# endif -#endif - -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -# include /* for va_list */ -# endif -#endif - -#ifdef _WIN32 -# ifndef Z_SOLO -# include /* for wchar_t */ -# endif -#endif - -/* a little trick to accommodate both "#define _LARGEFILE64_SOURCE" and - * "#define _LARGEFILE64_SOURCE 1" as requesting 64-bit operations, (even - * though the former does not conform to the LFS document), but considering - * both "#undef _LARGEFILE64_SOURCE" and "#define _LARGEFILE64_SOURCE 0" as - * equivalently requesting no 64-bit operations - */ -#if defined(_LARGEFILE64_SOURCE) && -_LARGEFILE64_SOURCE - -1 == 1 -# undef _LARGEFILE64_SOURCE -#endif - -#if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) -# define Z_HAVE_UNISTD_H -#endif -#ifndef Z_SOLO -# if defined(Z_HAVE_UNISTD_H) || defined(_LARGEFILE64_SOURCE) -# include /* for SEEK_*, off_t, and _LFS64_LARGEFILE */ -# ifdef VMS -# include /* for off_t */ -# endif -# ifndef z_off_t -# define z_off_t off_t -# endif -# endif -#endif - -#if defined(_LFS64_LARGEFILE) && _LFS64_LARGEFILE-0 -# define Z_LFS64 -#endif - -#if defined(_LARGEFILE64_SOURCE) && defined(Z_LFS64) -# define Z_LARGE64 -#endif - -#if defined(_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS-0 == 64 && defined(Z_LFS64) -# define Z_WANT64 -#endif - -#if !defined(SEEK_SET) && !defined(Z_SOLO) -# define SEEK_SET 0 /* Seek from beginning of file. */ -# define SEEK_CUR 1 /* Seek from current position. */ -# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ -#endif - -#ifndef z_off_t -# define z_off_t long -#endif - -#if !defined(_WIN32) && defined(Z_LARGE64) -# define z_off64_t off64_t -#else -# if defined(_WIN32) && !defined(__GNUC__) && !defined(Z_SOLO) -# define z_off64_t __int64 -# else -# define z_off64_t z_off_t -# endif -#endif - -/* MVS linker does not support external names larger than 8 bytes */ -#if defined(__MVS__) - #pragma map(deflateInit_,"DEIN") - #pragma map(deflateInit2_,"DEIN2") - #pragma map(deflateEnd,"DEEND") - #pragma map(deflateBound,"DEBND") - #pragma map(inflateInit_,"ININ") - #pragma map(inflateInit2_,"ININ2") - #pragma map(inflateEnd,"INEND") - #pragma map(inflateSync,"INSY") - #pragma map(inflateSetDictionary,"INSEDI") - #pragma map(compressBound,"CMBND") - #pragma map(inflate_table,"INTABL") - #pragma map(inflate_fast,"INFA") - #pragma map(inflate_copyright,"INCOPY") -#endif - -#endif /* ZCONF_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.3 b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.3 deleted file mode 100644 index 86dfbe2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.3 +++ /dev/null @@ -1,151 +0,0 @@ -.TH ZLIB 3 "28 Apr 2013" -.SH NAME -zlib \- compression/decompression library -.SH SYNOPSIS -[see -.I zlib.h -for full description] -.SH DESCRIPTION -The -.I zlib -library is a general purpose data compression library. -The code is thread safe, assuming that the standard library functions -used are thread safe, such as memory allocation routines. -It provides in-memory compression and decompression functions, -including integrity checks of the uncompressed data. -This version of the library supports only one compression method (deflation) -but other algorithms may be added later -with the same stream interface. -.LP -Compression can be done in a single step if the buffers are large enough -or can be done by repeated calls of the compression function. -In the latter case, -the application must provide more input and/or consume the output -(providing more output space) before each call. -.LP -The library also supports reading and writing files in -.IR gzip (1) -(.gz) format -with an interface similar to that of stdio. -.LP -The library does not install any signal handler. -The decoder checks the consistency of the compressed data, -so the library should never crash even in the case of corrupted input. -.LP -All functions of the compression library are documented in the file -.IR zlib.h . -The distribution source includes examples of use of the library -in the files -.I test/example.c -and -.IR test/minigzip.c, -as well as other examples in the -.IR examples/ -directory. -.LP -Changes to this version are documented in the file -.I ChangeLog -that accompanies the source. -.LP -.I zlib -is available in Java using the java.util.zip package: -.IP -http://java.sun.com/developer/technicalArticles/Programming/compression/ -.LP -A Perl interface to -.IR zlib , -written by Paul Marquess (pmqs@cpan.org), -is available at CPAN (Comprehensive Perl Archive Network) sites, -including: -.IP -http://search.cpan.org/~pmqs/IO-Compress-Zlib/ -.LP -A Python interface to -.IR zlib , -written by A.M. Kuchling (amk@magnet.com), -is available in Python 1.5 and later versions: -.IP -http://docs.python.org/library/zlib.html -.LP -.I zlib -is built into -.IR tcl: -.IP -http://wiki.tcl.tk/4610 -.LP -An experimental package to read and write files in .zip format, -written on top of -.I zlib -by Gilles Vollant (info@winimage.com), -is available at: -.IP -http://www.winimage.com/zLibDll/minizip.html -and also in the -.I contrib/minizip -directory of the main -.I zlib -source distribution. -.SH "SEE ALSO" -The -.I zlib -web site can be found at: -.IP -http://zlib.net/ -.LP -The data format used by the zlib library is described by RFC -(Request for Comments) 1950 to 1952 in the files: -.IP -http://tools.ietf.org/html/rfc1950 (for the zlib header and trailer format) -.br -http://tools.ietf.org/html/rfc1951 (for the deflate compressed data format) -.br -http://tools.ietf.org/html/rfc1952 (for the gzip header and trailer format) -.LP -Mark Nelson wrote an article about -.I zlib -for the Jan. 1997 issue of Dr. Dobb's Journal; -a copy of the article is available at: -.IP -http://marknelson.us/1997/01/01/zlib-engine/ -.SH "REPORTING PROBLEMS" -Before reporting a problem, -please check the -.I zlib -web site to verify that you have the latest version of -.IR zlib ; -otherwise, -obtain the latest version and see if the problem still exists. -Please read the -.I zlib -FAQ at: -.IP -http://zlib.net/zlib_faq.html -.LP -before asking for help. -Send questions and/or comments to zlib@gzip.org, -or (for the Windows DLL version) to Gilles Vollant (info@winimage.com). -.SH AUTHORS -Version 1.2.8 -Copyright (C) 1995-2013 Jean-loup Gailly (jloup@gzip.org) -and Mark Adler (madler@alumni.caltech.edu). -.LP -This software is provided "as-is," -without any express or implied warranty. -In no event will the authors be held liable for any damages -arising from the use of this software. -See the distribution directory with respect to requirements -governing redistribution. -The deflate format used by -.I zlib -was defined by Phil Katz. -The deflate and -.I zlib -specifications were written by L. Peter Deutsch. -Thanks to all the people who reported problems and suggested various -improvements in -.IR zlib ; -who are too numerous to cite here. -.LP -UNIX manual page by R. P. C. Rodgers, -U.S. National Library of Medicine (rodgers@nlm.nih.gov). -.\" end of man page diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.h deleted file mode 100644 index 1d98298..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zlib.h +++ /dev/null @@ -1,1768 +0,0 @@ -/* zlib.h -- interface of the 'zlib' general purpose compression library - version 1.2.8, April 28th, 2013 - - Copyright (C) 1995-2013 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - - - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files http://tools.ietf.org/html/rfc1950 - (zlib format), rfc1951 (deflate format) and rfc1952 (gzip format). -*/ - -#ifndef ZLIB_H -#define ZLIB_H - -#include "zconf.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZLIB_VERSION "1.2.8" -#define ZLIB_VERNUM 0x1280 -#define ZLIB_VER_MAJOR 1 -#define ZLIB_VER_MINOR 2 -#define ZLIB_VER_REVISION 8 -#define ZLIB_VER_SUBREVISION 0 - -/* - The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed data. - This version of the library supports only one compression method (deflation) - but other algorithms will be added later and will have the same stream - interface. - - Compression can be done in a single step if the buffers are large enough, - or can be done by repeated calls of the compression function. In the latter - case, the application must provide more input and/or consume the output - (providing more output space) before each call. - - The compressed data format used by default by the in-memory functions is - the zlib format, which is a zlib wrapper documented in RFC 1950, wrapped - around a deflate stream, which is itself documented in RFC 1951. - - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio using the functions that start - with "gz". The gzip format is different from the zlib format. gzip is a - gzip wrapper, documented in RFC 1952, wrapped around a deflate stream. - - This library can optionally read and write gzip streams in memory as well. - - The zlib format was designed to be compact and fast for use in memory - and on communications channels. The gzip format was designed for single- - file compression on file systems, has a larger header than zlib to maintain - directory information, and uses a different, slower check method than zlib. - - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never crash - even in case of corrupted input. -*/ - -typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); -typedef void (*free_func) OF((voidpf opaque, voidpf address)); - -struct internal_state; - -typedef struct z_stream_s { - z_const Bytef *next_in; /* next input byte */ - uInt avail_in; /* number of bytes available at next_in */ - uLong total_in; /* total number of input bytes read so far */ - - Bytef *next_out; /* next output byte should be put there */ - uInt avail_out; /* remaining free space at next_out */ - uLong total_out; /* total number of bytes output so far */ - - z_const char *msg; /* last error message, NULL if no error */ - struct internal_state FAR *state; /* not visible by applications */ - - alloc_func zalloc; /* used to allocate the internal state */ - free_func zfree; /* used to free the internal state */ - voidpf opaque; /* private data object passed to zalloc and zfree */ - - int data_type; /* best guess about the data type: binary or text */ - uLong adler; /* adler32 value of the uncompressed data */ - uLong reserved; /* reserved for future use */ -} z_stream; - -typedef z_stream FAR *z_streamp; - -/* - gzip header information passed to and from zlib routines. See RFC 1952 - for more details on the meanings of these fields. -*/ -typedef struct gz_header_s { - int text; /* true if compressed data believed to be text */ - uLong time; /* modification time */ - int xflags; /* extra flags (not used when writing a gzip file) */ - int os; /* operating system */ - Bytef *extra; /* pointer to extra field or Z_NULL if none */ - uInt extra_len; /* extra field length (valid if extra != Z_NULL) */ - uInt extra_max; /* space at extra (only when reading header) */ - Bytef *name; /* pointer to zero-terminated file name or Z_NULL */ - uInt name_max; /* space at name (only when reading header) */ - Bytef *comment; /* pointer to zero-terminated comment or Z_NULL */ - uInt comm_max; /* space at comment (only when reading header) */ - int hcrc; /* true if there was or will be a header crc */ - int done; /* true when done reading gzip header (not used - when writing a gzip file) */ -} gz_header; - -typedef gz_header FAR *gz_headerp; - -/* - The application must update next_in and avail_in when avail_in has dropped - to zero. It must update next_out and avail_out when avail_out has dropped - to zero. The application must initialize zalloc, zfree and opaque before - calling the init function. All other fields are set by the compression - library and must not be updated by the application. - - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value. - - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe. - - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this if - the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers - returned by zalloc for objects of exactly 65536 bytes *must* have their - offset normalized to zero. The default allocation function provided by this - library ensures this (see zutil.c). To reduce memory requirements and avoid - any allocation of 64K objects, at the expense of compression ratio, compile - the library with -DMAX_WBITS=14 (see zconf.h). - - The fields total_in and total_out can be used for statistics or progress - reports. After compression, total_in holds the total size of the - uncompressed data and may be saved for use in the decompressor (particularly - if the decompressor wants to decompress everything in a single step). -*/ - - /* constants */ - -#define Z_NO_FLUSH 0 -#define Z_PARTIAL_FLUSH 1 -#define Z_SYNC_FLUSH 2 -#define Z_FULL_FLUSH 3 -#define Z_FINISH 4 -#define Z_BLOCK 5 -#define Z_TREES 6 -/* Allowed flush values; see deflate() and inflate() below for details */ - -#define Z_OK 0 -#define Z_STREAM_END 1 -#define Z_NEED_DICT 2 -#define Z_ERRNO (-1) -#define Z_STREAM_ERROR (-2) -#define Z_DATA_ERROR (-3) -#define Z_MEM_ERROR (-4) -#define Z_BUF_ERROR (-5) -#define Z_VERSION_ERROR (-6) -/* Return codes for the compression/decompression functions. Negative values - * are errors, positive values are used for special but normal events. - */ - -#define Z_NO_COMPRESSION 0 -#define Z_BEST_SPEED 1 -#define Z_BEST_COMPRESSION 9 -#define Z_DEFAULT_COMPRESSION (-1) -/* compression levels */ - -#define Z_FILTERED 1 -#define Z_HUFFMAN_ONLY 2 -#define Z_RLE 3 -#define Z_FIXED 4 -#define Z_DEFAULT_STRATEGY 0 -/* compression strategy; see deflateInit2() below for details */ - -#define Z_BINARY 0 -#define Z_TEXT 1 -#define Z_ASCII Z_TEXT /* for compatibility with 1.2.2 and earlier */ -#define Z_UNKNOWN 2 -/* Possible values of the data_type field (though see inflate()) */ - -#define Z_DEFLATED 8 -/* The deflate compression method (the only one supported in this version) */ - -#define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ - -#define zlib_version zlibVersion() -/* for compatibility with versions < 1.0.2 */ - - - /* basic functions */ - -ZEXTERN const char * ZEXPORT zlibVersion OF((void)); -/* The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is not - compatible with the zlib.h header file used by the application. This check - is automatically made by deflateInit and inflateInit. - */ - -/* -ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); - - Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. If - zalloc and zfree are set to Z_NULL, deflateInit updates them to use default - allocation functions. - - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at all - (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION - requests a default compromise between speed and compression (currently - equivalent to level 6). - - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if level is not a valid compression level, or - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). msg is set to null - if there is no error message. deflateInit does not perform any compression: - this will be done by deflate(). -*/ - - -ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); -/* - deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. deflate performs one or both of the - following actions: - - - Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). Some - output may be provided even if flush is not set. - - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating avail_in or avail_out accordingly; avail_out should - never be zero before the call. The application can consume the compressed - output when it wants, for example when the output buffer is full (avail_out - == 0), or after each call of deflate(). If deflate returns Z_OK and with - zero avail_out, it must be called again after making room in the output - buffer because there might be more output pending. - - Normally the parameter flush is set to Z_NO_FLUSH, which allows deflate to - decide how much data to accumulate before producing output, in order to - maximize compression. - - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In - particular avail_in is zero after the call if enough output space has been - provided before the call.) Flushing may degrade compression for some - compression algorithms and so it should be used only when necessary. This - completes the current deflate block and follows it with an empty stored block - that is three bits plus filler bits to the next byte, followed by four bytes - (00 00 ff ff). - - If flush is set to Z_PARTIAL_FLUSH, all pending output is flushed to the - output buffer, but the output is not aligned to a byte boundary. All of the - input data so far will be available to the decompressor, as for Z_SYNC_FLUSH. - This completes the current deflate block and follows it with an empty fixed - codes block that is 10 bits long. This assures that enough bytes are output - in order for the decompressor to finish the block before the empty fixed code - block. - - If flush is set to Z_BLOCK, a deflate block is completed and emitted, as - for Z_SYNC_FLUSH, but the output is not aligned on a byte boundary, and up to - seven bits of the current block are held to be written as the next byte after - the next deflate block is completed. In this case, the decompressor may not - be provided enough bits at this point in order to complete decompression of - the data provided so far to the compressor. It may need to wait for the next - block to be emitted. This is for advanced applications that need to control - the emission of deflate blocks. - - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - compression. - - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). In the case of a Z_FULL_FLUSH or Z_SYNC_FLUSH, make sure that - avail_out is greater than six to avoid repeated flush markers due to - avail_out == 0 on return. - - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there was - enough output space; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the stream - are deflateReset or deflateEnd. - - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least the - value returned by deflateBound (see below). Then deflate is guaranteed to - return Z_STREAM_END. If not enough output space is provided, deflate will - not return Z_STREAM_END, and it must be called again as described above. - - deflate() sets strm->adler to the adler32 checksum of all input read - so far (that is, total_in bytes). - - deflate() may update strm->data_type if it can make a good guess about - the input data type (Z_BINARY or Z_TEXT). In doubt, the data is considered - binary. This field is only for information purposes and does not affect the - compression algorithm in any manner. - - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was Z_NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). Note that Z_BUF_ERROR is not - fatal, and deflate() can be called again with more input and more output - space to continue compressing. -*/ - - -ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, msg - may be set but then points to a static string (which must not be - deallocated). -*/ - - -/* -ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); - - Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the - exact value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. - - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit() does not process any header information -- that is deferred - until inflate() is called. -*/ - - -ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); -/* - inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce - some output latency (reading input without producing any output) except when - forced to flush. - - The detailed semantics are as follows. inflate performs one or both of the - following actions: - - - Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing will - resume at this point for the next call of inflate(). - - - Provide more output starting at next_out and update next_out and avail_out - accordingly. inflate() provides as much output as possible, until there is - no more input data or no more space in the output buffer (see below about - the flush parameter). - - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming more - output, and updating the next_* and avail_* values accordingly. The - application can consume the uncompressed output when it wants, for example - when the output buffer is full (avail_out == 0), or after each call of - inflate(). If inflate returns Z_OK and with zero avail_out, it must be - called again after making room in the output buffer because there might be - more output pending. - - The flush parameter of inflate() can be Z_NO_FLUSH, Z_SYNC_FLUSH, Z_FINISH, - Z_BLOCK, or Z_TREES. Z_SYNC_FLUSH requests that inflate() flush as much - output as possible to the output buffer. Z_BLOCK requests that inflate() - stop if and when it gets to the next deflate block boundary. When decoding - the zlib or gzip format, this will cause inflate() to return immediately - after the header and before the first block. When doing a raw inflate, - inflate() will go ahead and process the first block, and will return when it - gets to the end of that block, or when it runs out of data. - - The Z_BLOCK option assists in appending to or combining deflate streams. - Also to assist in this, on return inflate() will set strm->data_type to the - number of unused bits in the last byte taken from strm->next_in, plus 64 if - inflate() is currently decoding the last block in the deflate stream, plus - 128 if inflate() returned immediately after decoding an end-of-block code or - decoding the complete header up to just before the first byte of the deflate - stream. The end-of-block will not be indicated until all of the uncompressed - data from that block has been written to strm->next_out. The number of - unused bits may in general be greater than seven, except when bit 7 of - data_type is set, in which case the number of unused bits will be less than - eight. data_type is set as noted here every time inflate() returns for all - flush options, and so can be used to determine the amount of currently - consumed input in bits. - - The Z_TREES option behaves as Z_BLOCK does, but it also returns when the - end of each deflate block header is reached, before any actual data in that - block is decoded. This allows the caller to determine the length of the - deflate block header for later use in random access within a deflate block. - 256 is added to the value of strm->data_type when inflate() returns - immediately after reaching the end of the deflate block header. - - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step (a - single call of inflate), the parameter flush should be set to Z_FINISH. In - this case all pending input is processed and all pending output is flushed; - avail_out must be large enough to hold all of the uncompressed data for the - operation to complete. (The size of the uncompressed data may have been - saved by the compressor for this purpose.) The use of Z_FINISH is not - required to perform an inflation in one step. However it may be used to - inform inflate that a faster approach can be used for the single inflate() - call. Z_FINISH also informs inflate to not maintain a sliding window if the - stream completes, which reduces inflate's memory footprint. If the stream - does not complete, either because not all of the stream is provided or not - enough output space is provided, then a sliding window will be allocated and - inflate() can be called again to continue the operation as if Z_NO_FLUSH had - been used. - - In this implementation, inflate() always flushes as much output as - possible to the output buffer, and always uses the faster approach on the - first call. So the effects of the flush parameter in this implementation are - on the return value of inflate() as noted below, when inflate() returns early - when Z_BLOCK or Z_TREES is used, and when inflate() avoids the allocation of - memory for a sliding window when Z_FINISH is used. - - If a preset dictionary is needed after this call (see inflateSetDictionary - below), inflate sets strm->adler to the Adler-32 checksum of the dictionary - chosen by the compressor and returns Z_NEED_DICT; otherwise it sets - strm->adler to the Adler-32 checksum of all output produced so far (that is, - total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described - below. At the end of the stream, inflate() checks that its computed adler32 - checksum is equal to that saved by the compressor and returns Z_STREAM_END - only if the checksum is correct. - - inflate() can decompress and check either zlib-wrapped or gzip-wrapped - deflate data. The header type is detected automatically, if requested when - initializing with inflateInit2(). Any information contained in the gzip - header is not retained, so applications that need that information should - instead use raw inflate, see inflateInit2() below, or inflateBack() and - perform their own processing of the gzip header and trailer. When processing - gzip-wrapped deflate data, strm->adler32 is set to the CRC-32 of the output - producted so far. The CRC-32 is checked against the gzip trailer. - - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect check - value), Z_STREAM_ERROR if the stream structure was inconsistent (for example - next_in or next_out was Z_NULL), Z_MEM_ERROR if there was not enough memory, - Z_BUF_ERROR if no progress is possible or if there was not enough room in the - output buffer when Z_FINISH is used. Note that Z_BUF_ERROR is not fatal, and - inflate() can be called again with more input and more output space to - continue decompressing. If Z_DATA_ERROR is returned, the application may - then call inflateSync() to look for a good compression block if a partial - recovery of the data is desired. -*/ - - -ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); -/* - All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any pending - output. - - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -*/ - - - /* Advanced functions */ - -/* - The following functions are needed only in some special applications. -*/ - -/* -ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, - int level, - int method, - int windowBits, - int memLevel, - int strategy)); - - This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by the - caller. - - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library. - - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead. - - windowBits can also be -8..-15 for raw deflate. In this case, -windowBits - determines the window size. deflate() will then generate raw deflate data - with no zlib header or trailer, and will not compute an adler32 check value. - - windowBits can also be greater than 15 for optional gzip encoding. Add - 16 to windowBits to write a simple gzip header and trailer around the - compressed data instead of a zlib wrapper. The gzip header will have no - file name, no extra data, no comment, no modification time (set to zero), no - header crc, and the operating system will be set to 255 (unknown). If a - gzip stream is being written, strm->adler is a crc32 instead of an adler32. - - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but is - slow and reduces compression ratio; memLevel=9 uses maximum memory for - optimal speed. The default value is 8. See zconf.h for total memory usage - as a function of windowBits and memLevel. - - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match), or Z_RLE to limit match distances to one (run-length - encoding). Filtered data consists mostly of small values with a somewhat - random distribution. In this case, the compression algorithm is tuned to - compress them better. The effect of Z_FILTERED is to force more Huffman - coding and less string matching; it is somewhat intermediate between - Z_DEFAULT_STRATEGY and Z_HUFFMAN_ONLY. Z_RLE is designed to be almost as - fast as Z_HUFFMAN_ONLY, but give better compression for PNG image data. The - strategy parameter only affects the compression ratio but not the - correctness of the compressed output even if it is not set appropriately. - Z_FIXED prevents the use of dynamic Huffman codes, allowing for a simpler - decoder for special applications. - - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if any parameter is invalid (such as an invalid - method), or Z_VERSION_ERROR if the zlib library version (zlib_version) is - incompatible with the version assumed by the caller (ZLIB_VERSION). msg is - set to null if there is no error message. deflateInit2 does not perform any - compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the compression dictionary from the given byte sequence - without producing any compressed output. When using the zlib format, this - function must be called immediately after deflateInit, deflateInit2 or - deflateReset, and before any call of deflate. When doing raw deflate, this - function must be called either before any call of deflate, or immediately - after the completion of a deflate block, i.e. after all input has been - consumed and all output has been delivered when using any of the flush - options Z_BLOCK, Z_PARTIAL_FLUSH, Z_SYNC_FLUSH, or Z_FULL_FLUSH. The - compressor and decompressor must use exactly the same dictionary (see - inflateSetDictionary). - - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy; the data can then be compressed better than - with the default empty dictionary. - - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size - provided in deflateInit or deflateInit2. Thus the strings most likely to be - useful should be put at the end of the dictionary, not at the front. In - addition, the current implementation of deflate will use at most the window - size minus 262 bytes of the provided dictionary. - - Upon return of this function, strm->adler is set to the adler32 value - of the dictionary; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.) If a raw deflate was requested, then the - adler32 value is not computed and strm->adler is not set. - - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if not at a block boundary for raw deflate). deflateSetDictionary does - not perform any compression: this will be done by deflate(). -*/ - -ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and can - consume lots of memory. - - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); -/* - This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. The - stream will keep the same compression level and any other attributes that - may have been set by deflateInit2. - - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, - int level, - int strategy)); -/* - Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different strategy. - If the compression level is changed, the input available so far is - compressed with the old level (and may be flushed); the new level will take - effect only at the next call of deflate(). - - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to be - compressed and flushed. In particular, strm->avail_out must be non-zero. - - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if - strm->avail_out was zero. -*/ - -ZEXTERN int ZEXPORT deflateTune OF((z_streamp strm, - int good_length, - int max_lazy, - int nice_length, - int max_chain)); -/* - Fine tune deflate's internal compression parameters. This should only be - used by someone who understands the algorithm used by zlib's deflate for - searching for the best matching string, and even then only by the most - fanatic optimizer trying to squeeze out the last compressed bit for their - specific input data. Read the deflate.c source code for the meaning of the - max_lazy, good_length, nice_length, and max_chain parameters. - - deflateTune() can be called after deflateInit() or deflateInit2(), and - returns Z_OK on success, or Z_STREAM_ERROR for an invalid deflate stream. - */ - -ZEXTERN uLong ZEXPORT deflateBound OF((z_streamp strm, - uLong sourceLen)); -/* - deflateBound() returns an upper bound on the compressed size after - deflation of sourceLen bytes. It must be called after deflateInit() or - deflateInit2(), and after deflateSetHeader(), if used. This would be used - to allocate an output buffer for deflation in a single pass, and so would be - called before deflate(). If that first deflate() call is provided the - sourceLen input bytes, an output buffer allocated to the size returned by - deflateBound(), and the flush value Z_FINISH, then deflate() is guaranteed - to return Z_STREAM_END. Note that it is possible for the compressed size to - be larger than the value returned by deflateBound() if flush options other - than Z_FINISH or Z_NO_FLUSH are used. -*/ - -ZEXTERN int ZEXPORT deflatePending OF((z_streamp strm, - unsigned *pending, - int *bits)); -/* - deflatePending() returns the number of bytes and bits of output that have - been generated, but not yet provided in the available output. The bytes not - provided would be due to the available output space having being consumed. - The number of bits of output not provided are between 0 and 7, where they - await more bits to join them in order to fill out a full byte. If pending - or bits are Z_NULL, then those values are not set. - - deflatePending returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. - */ - -ZEXTERN int ZEXPORT deflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - deflatePrime() inserts bits in the deflate output stream. The intent - is that this function is used to start off the deflate output with the bits - leftover from a previous deflate stream when appending to it. As such, this - function can only be used for raw deflate, and must be used before the first - deflate() call after a deflateInit2() or deflateReset(). bits must be less - than or equal to 16, and that many of the least significant bits of value - will be inserted in the output. - - deflatePrime returns Z_OK if success, Z_BUF_ERROR if there was not enough - room in the internal buffer to insert the bits, or Z_STREAM_ERROR if the - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT deflateSetHeader OF((z_streamp strm, - gz_headerp head)); -/* - deflateSetHeader() provides gzip header information for when a gzip - stream is requested by deflateInit2(). deflateSetHeader() may be called - after deflateInit2() or deflateReset() and before the first call of - deflate(). The text, time, os, extra field, name, and comment information - in the provided gz_header structure are written to the gzip header (xflag is - ignored -- the extra flags are set according to the compression level). The - caller must assure that, if not Z_NULL, name and comment are terminated with - a zero byte, and that if extra is not Z_NULL, that extra_len bytes are - available there. If hcrc is true, a gzip header crc is included. Note that - the current versions of the command-line version of gzip (up through version - 1.3.x) do not support header crc's, and will report that it is a "multi-part - gzip file" and give up. - - If deflateSetHeader is not used, the default gzip header has text false, - the time set to zero, and os set to 255, with no extra, name, or comment - fields. The gzip header is returned to the default state by deflateReset(). - - deflateSetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, - int windowBits)); - - This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller. - - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. windowBits must be greater than or equal to the windowBits value - provided to deflateInit2() while compressing, or it must be equal to 15 if - deflateInit2() was not used. If a compressed stream with a larger window - size is given as input, inflate() will return with the error code - Z_DATA_ERROR instead of trying to allocate a larger window. - - windowBits can also be zero to request that inflate use the window size in - the zlib header of the compressed stream. - - windowBits can also be -8..-15 for raw inflate. In this case, -windowBits - determines the window size. inflate() will then process raw deflate data, - not looking for a zlib or gzip header, not generating a check value, and not - looking for any check values for comparison at the end of the stream. This - is for use with other formats that use the deflate compressed data format - such as zip. Those formats provide their own check values. If a custom - format is developed using the raw deflate format for compressed data, it is - recommended that a check value such as an adler32 or a crc32 be applied to - the uncompressed data as is done in the zlib, gzip, and zip formats. For - most applications, the zlib format should be used as is. Note that comments - above on the use in deflateInit2() applies to the magnitude of windowBits. - - windowBits can also be greater than 15 for optional gzip decoding. Add - 32 to windowBits to enable zlib and gzip decoding with automatic header - detection, or add 16 to decode only the gzip format (the zlib format will - return a Z_DATA_ERROR). If a gzip stream is being decoded, strm->adler is a - crc32 instead of an adler32. - - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller, or Z_STREAM_ERROR if the parameters are - invalid, such as a null pointer to the structure. msg is set to null if - there is no error message. inflateInit2 does not perform any decompression - apart from possibly reading the zlib header if present: actual decompression - will be done by inflate(). (So next_in and avail_in may be modified, but - next_out and avail_out are unused and unchanged.) The current implementation - of inflateInit2() does not process any header information -- that is - deferred until inflate() is called. -*/ - -ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, - const Bytef *dictionary, - uInt dictLength)); -/* - Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate, - if that call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the adler32 value returned by that call of inflate. - The compressor and decompressor must use exactly the same dictionary (see - deflateSetDictionary). For raw inflate, this function can be called at any - time to set the dictionary. If the provided dictionary is smaller than the - window and there is already data in the window, then the provided dictionary - will amend what's there. The application must insure that the dictionary - that was used for compression is provided. - - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (e.g. dictionary being Z_NULL) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate(). -*/ - -ZEXTERN int ZEXPORT inflateGetDictionary OF((z_streamp strm, - Bytef *dictionary, - uInt *dictLength)); -/* - Returns the sliding dictionary being maintained by inflate. dictLength is - set to the number of bytes in the dictionary, and that many bytes are copied - to dictionary. dictionary must have enough space, where 32768 bytes is - always enough. If inflateGetDictionary() is called with dictionary equal to - Z_NULL, then only the dictionary length is returned, and nothing is copied. - Similary, if dictLength is Z_NULL, then it is not set. - - inflateGetDictionary returns Z_OK on success, or Z_STREAM_ERROR if the - stream state is inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); -/* - Skips invalid compressed data until a possible full flush point (see above - for the description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided. - - inflateSync searches for a 00 00 FF FF pattern in the compressed data. - All full flush points have this pattern, but not all occurrences of this - pattern are full flush points. - - inflateSync returns Z_OK if a possible full flush point has been found, - Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point - has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. - In the success case, the application may save the current current value of - total_in which indicates where valid compressed data was found. In the - error case, the application may repeatedly call inflateSync, providing more - input each time, until success or end of the input data. -*/ - -ZEXTERN int ZEXPORT inflateCopy OF((z_streamp dest, - z_streamp source)); -/* - Sets the destination stream as a complete copy of the source stream. - - This function can be useful when randomly accessing a large stream. The - first pass through the stream can periodically record the inflate state, - allowing restarting inflate at those points when randomly accessing the - stream. - - inflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being Z_NULL). msg is left unchanged in both source and - destination. -*/ - -ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); -/* - This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. The - stream will keep attributes that may have been set by inflateInit2. - - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL). -*/ - -ZEXTERN int ZEXPORT inflateReset2 OF((z_streamp strm, - int windowBits)); -/* - This function is the same as inflateReset, but it also permits changing - the wrap and window size requests. The windowBits parameter is interpreted - the same as it is for inflateInit2. - - inflateReset2 returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being Z_NULL), or if - the windowBits parameter is invalid. -*/ - -ZEXTERN int ZEXPORT inflatePrime OF((z_streamp strm, - int bits, - int value)); -/* - This function inserts bits in the inflate input stream. The intent is - that this function is used to start inflating at a bit position in the - middle of a byte. The provided bits will be used before any bytes are used - from next_in. This function should only be used with raw inflate, and - should be used before the first inflate() call after inflateInit2() or - inflateReset(). bits must be less than or equal to 16, and that many of the - least significant bits of value will be inserted in the input. - - If bits is negative, then the input stream bit buffer is emptied. Then - inflatePrime() can be called again to put bits in the buffer. This is used - to clear out bits leftover after feeding inflate a block description prior - to feeding inflate codes. - - inflatePrime returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -ZEXTERN long ZEXPORT inflateMark OF((z_streamp strm)); -/* - This function returns two values, one in the lower 16 bits of the return - value, and the other in the remaining upper bits, obtained by shifting the - return value down 16 bits. If the upper value is -1 and the lower value is - zero, then inflate() is currently decoding information outside of a block. - If the upper value is -1 and the lower value is non-zero, then inflate is in - the middle of a stored block, with the lower value equaling the number of - bytes from the input remaining to copy. If the upper value is not -1, then - it is the number of bits back from the current bit position in the input of - the code (literal or length/distance pair) currently being processed. In - that case the lower value is the number of bytes already emitted for that - code. - - A code is being processed if inflate is waiting for more input to complete - decoding of the code, or if it has completed decoding but is waiting for - more output space to write the literal or match data. - - inflateMark() is used to mark locations in the input data for random - access, which may be at bit positions, and to note those cases where the - output of a code may span boundaries of random access blocks. The current - location in the input stream can be determined from avail_in and data_type - as noted in the description for the Z_BLOCK flush parameter for inflate. - - inflateMark returns the value noted above or -1 << 16 if the provided - source stream state was inconsistent. -*/ - -ZEXTERN int ZEXPORT inflateGetHeader OF((z_streamp strm, - gz_headerp head)); -/* - inflateGetHeader() requests that gzip header information be stored in the - provided gz_header structure. inflateGetHeader() may be called after - inflateInit2() or inflateReset(), and before the first call of inflate(). - As inflate() processes the gzip stream, head->done is zero until the header - is completed, at which time head->done is set to one. If a zlib stream is - being decoded, then head->done is set to -1 to indicate that there will be - no gzip header information forthcoming. Note that Z_BLOCK or Z_TREES can be - used to force inflate() to return immediately after header processing is - complete and before any actual data is decompressed. - - The text, time, xflags, and os fields are filled in with the gzip header - contents. hcrc is set to true if there is a header CRC. (The header CRC - was valid if done is set to one.) If extra is not Z_NULL, then extra_max - contains the maximum number of bytes to write to extra. Once done is true, - extra_len contains the actual extra field length, and extra contains the - extra field, or that field truncated if extra_max is less than extra_len. - If name is not Z_NULL, then up to name_max characters are written there, - terminated with a zero unless the length is greater than name_max. If - comment is not Z_NULL, then up to comm_max characters are written there, - terminated with a zero unless the length is greater than comm_max. When any - of extra, name, or comment are not Z_NULL and the respective field is not - present in the header, then that field is set to Z_NULL to signal its - absence. This allows the use of deflateSetHeader() with the returned - structure to duplicate the header. However if those fields are set to - allocated memory, then the application will need to save those pointers - elsewhere so that they can be eventually freed. - - If inflateGetHeader is not used, then the header information is simply - discarded. The header is always checked for validity, including the header - CRC if present. inflateReset() will reset the process to discard the header - information. The application would need to call inflateGetHeader() again to - retrieve the header from the next gzip stream. - - inflateGetHeader returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent. -*/ - -/* -ZEXTERN int ZEXPORT inflateBackInit OF((z_streamp strm, int windowBits, - unsigned char FAR *window)); - - Initialize the internal stream state for decompression using inflateBack() - calls. The fields zalloc, zfree and opaque in strm must be initialized - before the call. If zalloc and zfree are Z_NULL, then the default library- - derived memory allocation routines are used. windowBits is the base two - logarithm of the window size, in the range 8..15. window is a caller - supplied buffer of that size. Except for special applications where it is - assured that deflate was used with small window sizes, windowBits must be 15 - and a 32K byte window must be supplied to be able to decompress general - deflate streams. - - See inflateBack() for the usage of these routines. - - inflateBackInit will return Z_OK on success, Z_STREAM_ERROR if any of - the parameters are invalid, Z_MEM_ERROR if the internal state could not be - allocated, or Z_VERSION_ERROR if the version of the library does not match - the version of the header file. -*/ - -typedef unsigned (*in_func) OF((void FAR *, - z_const unsigned char FAR * FAR *)); -typedef int (*out_func) OF((void FAR *, unsigned char FAR *, unsigned)); - -ZEXTERN int ZEXPORT inflateBack OF((z_streamp strm, - in_func in, void FAR *in_desc, - out_func out, void FAR *out_desc)); -/* - inflateBack() does a raw inflate with a single call using a call-back - interface for input and output. This is potentially more efficient than - inflate() for file i/o applications, in that it avoids copying between the - output and the sliding window by simply making the window itself the output - buffer. inflate() can be faster on modern CPUs when used with large - buffers. inflateBack() trusts the application to not change the output - buffer passed by the output function, at least until inflateBack() returns. - - inflateBackInit() must be called first to allocate the internal state - and to initialize the state with the user-provided window buffer. - inflateBack() may then be used multiple times to inflate a complete, raw - deflate stream with each call. inflateBackEnd() is then called to free the - allocated state. - - A raw deflate stream is one with no zlib or gzip header or trailer. - This routine would normally be used in a utility that reads zip or gzip - files and writes out uncompressed files. The utility would decode the - header and process the trailer on its own, hence this routine expects only - the raw deflate stream to decompress. This is different from the normal - behavior of inflate(), which expects either a zlib or gzip header and - trailer around the deflate stream. - - inflateBack() uses two subroutines supplied by the caller that are then - called by inflateBack() for input and output. inflateBack() calls those - routines until it reads a complete deflate stream and writes out all of the - uncompressed data, or until it encounters an error. The function's - parameters and return types are defined above in the in_func and out_func - typedefs. inflateBack() will call in(in_desc, &buf) which should return the - number of bytes of provided input, and a pointer to that input in buf. If - there is no input available, in() must return zero--buf is ignored in that - case--and inflateBack() will return a buffer error. inflateBack() will call - out(out_desc, buf, len) to write the uncompressed data buf[0..len-1]. out() - should return zero on success, or non-zero on failure. If out() returns - non-zero, inflateBack() will return with an error. Neither in() nor out() - are permitted to change the contents of the window provided to - inflateBackInit(), which is also the buffer that out() uses to write from. - The length written by out() will be at most the window size. Any non-zero - amount of input may be provided by in(). - - For convenience, inflateBack() can be provided input on the first call by - setting strm->next_in and strm->avail_in. If that input is exhausted, then - in() will be called. Therefore strm->next_in must be initialized before - calling inflateBack(). If strm->next_in is Z_NULL, then in() will be called - immediately for input. If strm->next_in is not Z_NULL, then strm->avail_in - must also be initialized, and then if strm->avail_in is not zero, input will - initially be taken from strm->next_in[0 .. strm->avail_in - 1]. - - The in_desc and out_desc parameters of inflateBack() is passed as the - first parameter of in() and out() respectively when they are called. These - descriptors can be optionally used to pass any information that the caller- - supplied in() and out() functions need to do their job. - - On return, inflateBack() will set strm->next_in and strm->avail_in to - pass back any unused input that was provided by the last in() call. The - return values of inflateBack() can be Z_STREAM_END on success, Z_BUF_ERROR - if in() or out() returned an error, Z_DATA_ERROR if there was a format error - in the deflate stream (in which case strm->msg is set to indicate the nature - of the error), or Z_STREAM_ERROR if the stream was not properly initialized. - In the case of Z_BUF_ERROR, an input or output error can be distinguished - using strm->next_in which will be Z_NULL only if in() returned an error. If - strm->next_in is not Z_NULL, then the Z_BUF_ERROR was due to out() returning - non-zero. (in() will always be called before out(), so strm->next_in is - assured to be defined if out() returns non-zero.) Note that inflateBack() - cannot return Z_OK. -*/ - -ZEXTERN int ZEXPORT inflateBackEnd OF((z_streamp strm)); -/* - All memory allocated by inflateBackInit() is freed. - - inflateBackEnd() returns Z_OK on success, or Z_STREAM_ERROR if the stream - state was inconsistent. -*/ - -ZEXTERN uLong ZEXPORT zlibCompileFlags OF((void)); -/* Return flags indicating compile-time options. - - Type sizes, two bits each, 00 = 16 bits, 01 = 32, 10 = 64, 11 = other: - 1.0: size of uInt - 3.2: size of uLong - 5.4: size of voidpf (pointer) - 7.6: size of z_off_t - - Compiler, assembler, and debug options: - 8: DEBUG - 9: ASMV or ASMINF -- use ASM code - 10: ZLIB_WINAPI -- exported functions use the WINAPI calling convention - 11: 0 (reserved) - - One-time table building (smaller code, but not thread-safe if true): - 12: BUILDFIXED -- build static block decoding tables when needed - 13: DYNAMIC_CRC_TABLE -- build CRC calculation tables when needed - 14,15: 0 (reserved) - - Library content (indicates missing functionality): - 16: NO_GZCOMPRESS -- gz* functions cannot compress (to avoid linking - deflate code when not needed) - 17: NO_GZIP -- deflate can't write gzip streams, and inflate can't detect - and decode gzip streams (to avoid linking crc code) - 18-19: 0 (reserved) - - Operation variations (changes in library functionality): - 20: PKZIP_BUG_WORKAROUND -- slightly more permissive inflate - 21: FASTEST -- deflate algorithm with only one, lowest compression level - 22,23: 0 (reserved) - - The sprintf variant used by gzprintf (zero is best): - 24: 0 = vs*, 1 = s* -- 1 means limited to 20 arguments after the format - 25: 0 = *nprintf, 1 = *printf -- 1 means gzprintf() not secure! - 26: 0 = returns value, 1 = void -- 1 means inferred string length returned - - Remainder: - 27-31: 0 (reserved) - */ - -#ifndef Z_SOLO - - /* utility functions */ - -/* - The following utility functions are implemented on top of the basic - stream-oriented functions. To simplify the interface, some default options - are assumed (compression level and memory usage, standard memory allocation - functions). The source code of these utility functions can be modified if - you need special options. -*/ - -ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer. -*/ - -ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen, - int level)); -/* - Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least the value returned by - compressBound(sourceLen). Upon exit, destLen is the actual size of the - compressed buffer. - - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -*/ - -ZEXTERN uLong ZEXPORT compressBound OF((uLong sourceLen)); -/* - compressBound() returns an upper bound on the compressed size after - compress() or compress2() on sourceLen bytes. It would be used before a - compress() or compress2() call to allocate the destination buffer. -*/ - -ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, - const Bytef *source, uLong sourceLen)); -/* - Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total size - of the destination buffer, which must be large enough to hold the entire - uncompressed data. (The size of the uncompressed data must have been saved - previously by the compressor and transmitted to the decompressor by some - mechanism outside the scope of this compression library.) Upon exit, destLen - is the actual size of the uncompressed buffer. - - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted or incomplete. In - the case where there is not enough room, uncompress() will fill the output - buffer with the uncompressed data up to that point. -*/ - - /* gzip file access functions */ - -/* - This library supports reading and writing files in gzip (.gz) format with - an interface similar to that of stdio, using the functions that start with - "gz". The gzip format is different from the zlib format. gzip is a gzip - wrapper, documented in RFC 1952, wrapped around a deflate stream. -*/ - -typedef struct gzFile_s *gzFile; /* semi-opaque gzip file descriptor */ - -/* -ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); - - Opens a gzip (.gz) file for reading or writing. The mode parameter is as - in fopen ("rb" or "wb") but can also include a compression level ("wb9") or - a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman-only - compression as in "wb1h", 'R' for run-length encoding as in "wb1R", or 'F' - for fixed code compression as in "wb9F". (See the description of - deflateInit2 for more information about the strategy parameter.) 'T' will - request transparent writing or appending with no compression and not using - the gzip format. - - "a" can be used instead of "w" to request that the gzip stream that will - be written be appended to the file. "+" will result in an error, since - reading and writing to the same gzip file is not supported. The addition of - "x" when writing will create the file exclusively, which fails if the file - already exists. On systems that support it, the addition of "e" when - reading or writing will set the flag to close the file on an execve() call. - - These functions, as well as gzip, will read and decode a sequence of gzip - streams in a file. The append function of gzopen() can be used to create - such a file. (Also see gzflush() for another way to do this.) When - appending, gzopen does not test whether the file begins with a gzip stream, - nor does it look for the end of the gzip streams to begin appending. gzopen - will simply append a gzip stream to the existing file. - - gzopen can be used to read a file which is not in gzip format; in this - case gzread will directly read from the file without decompression. When - reading, this will be detected automatically by looking for the magic two- - byte gzip header. - - gzopen returns NULL if the file could not be opened, if there was - insufficient memory to allocate the gzFile state, or if an invalid mode was - specified (an 'r', 'w', or 'a' was not provided, or '+' was provided). - errno can be checked to determine if the reason gzopen failed was that the - file could not be opened. -*/ - -ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); -/* - gzdopen associates a gzFile with the file descriptor fd. File descriptors - are obtained from calls like open, dup, creat, pipe or fileno (if the file - has been previously opened with fopen). The mode parameter is as in gzopen. - - The next call of gzclose on the returned gzFile will also close the file - descriptor fd, just like fclose(fdopen(fd, mode)) closes the file descriptor - fd. If you want to keep fd open, use fd = dup(fd_keep); gz = gzdopen(fd, - mode);. The duplicated descriptor should be saved to avoid a leak, since - gzdopen does not close fd if it fails. If you are using fileno() to get the - file descriptor from a FILE *, then you will have to use dup() to avoid - double-close()ing the file descriptor. Both gzclose() and fclose() will - close the associated file descriptor, so they need to have different file - descriptors. - - gzdopen returns NULL if there was insufficient memory to allocate the - gzFile state, if an invalid mode was specified (an 'r', 'w', or 'a' was not - provided, or '+' was provided), or if fd is -1. The file descriptor is not - used until the next gz* read, write, seek, or close operation, so gzdopen - will not detect if fd is invalid (unless fd is -1). -*/ - -ZEXTERN int ZEXPORT gzbuffer OF((gzFile file, unsigned size)); -/* - Set the internal buffer size used by this library's functions. The - default buffer size is 8192 bytes. This function must be called after - gzopen() or gzdopen(), and before any other calls that read or write the - file. The buffer memory allocation is always deferred to the first read or - write. Two buffers are allocated, either both of the specified size when - writing, or one of the specified size and the other twice that size when - reading. A larger buffer size of, for example, 64K or 128K bytes will - noticeably increase the speed of decompression (reading). - - The new buffer size also affects the maximum length for gzprintf(). - - gzbuffer() returns 0 on success, or -1 on failure, such as being called - too late. -*/ - -ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); -/* - Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. - - gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -*/ - -ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); -/* - Reads the given number of uncompressed bytes from the compressed file. If - the input file is not in gzip format, gzread copies the given number of - bytes into the buffer directly from the file. - - After reaching the end of a gzip stream in the input, gzread will continue - to read, looking for another gzip stream. Any number of gzip streams may be - concatenated in the input file, and will all be decompressed by gzread(). - If something other than a gzip stream is encountered after a gzip stream, - that remaining trailing garbage is ignored (and no error is returned). - - gzread can be used to read a gzip file that is being concurrently written. - Upon reaching the end of the input, gzread will return with the available - data. If the error code returned by gzerror is Z_OK or Z_BUF_ERROR, then - gzclearerr can be used to clear the end of file indicator in order to permit - gzread to be tried again. Z_OK indicates that a gzip stream was completed - on the last gzread. Z_BUF_ERROR indicates that the input file ended in the - middle of a gzip stream. Note that gzread does not return -1 in the event - of an incomplete gzip stream. This error is deferred until gzclose(), which - will return Z_BUF_ERROR if the last gzread ended in the middle of a gzip - stream. Alternatively, gzerror can be used before gzclose to detect this - case. - - gzread returns the number of uncompressed bytes actually read, less than - len for end of file, or -1 for error. -*/ - -ZEXTERN int ZEXPORT gzwrite OF((gzFile file, - voidpc buf, unsigned len)); -/* - Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes written or 0 in case of - error. -*/ - -ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...)); -/* - Converts, formats, and writes the arguments to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written, or 0 in case of error. The number of - uncompressed bytes written is limited to 8191, or one less than the buffer - size given to gzbuffer(). The caller should assure that this limit is not - exceeded. If it is exceeded, then gzprintf() will return an error (0) with - nothing written. In this case, there may also be a buffer overflow with - unpredictable consequences, which is possible only if zlib was compiled with - the insecure functions sprintf() or vsprintf() because the secure snprintf() - or vsnprintf() functions were not available. This can be determined using - zlibCompileFlags(). -*/ - -ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); -/* - Writes the given null-terminated string to the compressed file, excluding - the terminating null character. - - gzputs returns the number of characters written, or -1 in case of error. -*/ - -ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); -/* - Reads bytes from the compressed file until len-1 characters are read, or a - newline character is read and transferred to buf, or an end-of-file - condition is encountered. If any characters are read or if len == 1, the - string is terminated with a null character. If no characters are read due - to an end-of-file or len < 1, then the buffer is left untouched. - - gzgets returns buf which is a null-terminated string, or it returns NULL - for end-of-file or in case of error. If there was an error, the contents at - buf are indeterminate. -*/ - -ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); -/* - Writes c, converted to an unsigned char, into the compressed file. gzputc - returns the value that was written, or -1 in case of error. -*/ - -ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); -/* - Reads one byte from the compressed file. gzgetc returns this byte or -1 - in case of end of file or error. This is implemented as a macro for speed. - As such, it does not do all of the checking the other functions do. I.e. - it does not check to see if file is NULL, nor whether the structure file - points to has been clobbered or not. -*/ - -ZEXTERN int ZEXPORT gzungetc OF((int c, gzFile file)); -/* - Push one character back onto the stream to be read as the first character - on the next read. At least one character of push-back is allowed. - gzungetc() returns the character pushed, or -1 on failure. gzungetc() will - fail if c is -1, and may fail if a character has been pushed but not read - yet. If gzungetc is used immediately after gzopen or gzdopen, at least the - output buffer size of pushed characters is allowed. (See gzbuffer above.) - The pushed character will be discarded if the stream is repositioned with - gzseek() or gzrewind(). -*/ - -ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); -/* - Flushes all pending output into the compressed file. The parameter flush - is as in the deflate() function. The return value is the zlib error number - (see function gzerror below). gzflush is only permitted when writing. - - If the flush parameter is Z_FINISH, the remaining data is written and the - gzip stream is completed in the output. If gzwrite() is called again, a new - gzip stream will be started in the output. gzread() is able to read such - concatented gzip streams. - - gzflush should be called only when strictly necessary because it will - degrade compression if called too often. -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, - z_off_t offset, int whence)); - - Sets the starting position for the next gzread or gzwrite on the given - compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. - - If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported; gzseek then compresses a sequence of zeroes up to the new - starting position. - - gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -*/ - -ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); -/* - Rewinds the given file. This function is supported only for reading. - - gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); - - Returns the starting position for the next gzread or gzwrite on the given - compressed file. This position represents a number of bytes in the - uncompressed data stream, and is zero when starting, even if appending or - reading a gzip stream from the middle of a file using gzdopen(). - - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -*/ - -/* -ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile file)); - - Returns the current offset in the file being read or written. This offset - includes the count of bytes that precede the gzip stream, for example when - appending or when using gzdopen() for reading. When reading, the offset - does not include as yet unused buffered input. This information can be used - for a progress indicator. On error, gzoffset() returns -1. -*/ - -ZEXTERN int ZEXPORT gzeof OF((gzFile file)); -/* - Returns true (1) if the end-of-file indicator has been set while reading, - false (0) otherwise. Note that the end-of-file indicator is set only if the - read tried to go past the end of the input, but came up short. Therefore, - just like feof(), gzeof() may return false even if there is no more data to - read, in the event that the last read request was for the exact number of - bytes remaining in the input file. This will happen if the input file size - is an exact multiple of the buffer size. - - If gzeof() returns true, then the read functions will return no more data, - unless the end-of-file indicator is reset by gzclearerr() and the input file - has grown since the previous end of file was detected. -*/ - -ZEXTERN int ZEXPORT gzdirect OF((gzFile file)); -/* - Returns true (1) if file is being copied directly while reading, or false - (0) if file is a gzip stream being decompressed. - - If the input file is empty, gzdirect() will return true, since the input - does not contain a gzip stream. - - If gzdirect() is used immediately after gzopen() or gzdopen() it will - cause buffers to be allocated to allow reading the file to determine if it - is a gzip file. Therefore if gzbuffer() is used, it should be called before - gzdirect(). - - When writing, gzdirect() returns true (1) if transparent writing was - requested ("wT" for the gzopen() mode), or false (0) otherwise. (Note: - gzdirect() is not needed when writing. Transparent writing must be - explicitly requested, so the application already knows the answer. When - linking statically, using gzdirect() will include all of the zlib code for - gzip file reading and decompression, which may not be desired.) -*/ - -ZEXTERN int ZEXPORT gzclose OF((gzFile file)); -/* - Flushes all pending output if necessary, closes the compressed file and - deallocates the (de)compression state. Note that once file is closed, you - cannot call gzerror with file, since its structures have been deallocated. - gzclose must not be called more than once on the same file, just as free - must not be called more than once on the same allocation. - - gzclose will return Z_STREAM_ERROR if file is not valid, Z_ERRNO on a - file operation error, Z_MEM_ERROR if out of memory, Z_BUF_ERROR if the - last read ended in the middle of a gzip stream, or Z_OK on success. -*/ - -ZEXTERN int ZEXPORT gzclose_r OF((gzFile file)); -ZEXTERN int ZEXPORT gzclose_w OF((gzFile file)); -/* - Same as gzclose(), but gzclose_r() is only for use when reading, and - gzclose_w() is only for use when writing or appending. The advantage to - using these instead of gzclose() is that they avoid linking in zlib - compression or decompression code that is not used when only reading or only - writing respectively. If gzclose() is used, then both compression and - decompression code will be included the application when linking to a static - zlib library. -*/ - -ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); -/* - Returns the error message for the last error which occurred on the given - compressed file. errnum is set to zlib error number. If an error occurred - in the file system and not in the compression library, errnum is set to - Z_ERRNO and the application may consult errno to get the exact error code. - - The application must not modify the returned string. Future calls to - this function may invalidate the previously returned string. If file is - closed, then the string previously returned by gzerror will no longer be - available. - - gzerror() should be used to distinguish errors from end-of-file for those - functions above that do not distinguish those cases in their return values. -*/ - -ZEXTERN void ZEXPORT gzclearerr OF((gzFile file)); -/* - Clears the error and end-of-file flags for file. This is analogous to the - clearerr() function in stdio. This is useful for continuing to read a gzip - file that is being written concurrently. -*/ - -#endif /* !Z_SOLO */ - - /* checksum functions */ - -/* - These functions are not related to compression but are exported - anyway because they might be useful in applications using the compression - library. -*/ - -ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); -/* - Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is Z_NULL, this function returns the - required initial value for the checksum. - - An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. - - Usage example: - - uLong adler = adler32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - adler = adler32(adler, buffer, length); - } - if (adler != original_adler) error(); -*/ - -/* -ZEXTERN uLong ZEXPORT adler32_combine OF((uLong adler1, uLong adler2, - z_off_t len2)); - - Combine two Adler-32 checksums into one. For two sequences of bytes, seq1 - and seq2 with lengths len1 and len2, Adler-32 checksums were calculated for - each, adler1 and adler2. adler32_combine() returns the Adler-32 checksum of - seq1 and seq2 concatenated, requiring only adler1, adler2, and len2. Note - that the z_off_t type (like off_t) is a signed integer. If len2 is - negative, the result has no meaning or utility. -*/ - -ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); -/* - Update a running CRC-32 with the bytes buf[0..len-1] and return the - updated CRC-32. If buf is Z_NULL, this function returns the required - initial value for the crc. Pre- and post-conditioning (one's complement) is - performed within this function so it shouldn't be done by the application. - - Usage example: - - uLong crc = crc32(0L, Z_NULL, 0); - - while (read_buffer(buffer, length) != EOF) { - crc = crc32(crc, buffer, length); - } - if (crc != original_crc) error(); -*/ - -/* -ZEXTERN uLong ZEXPORT crc32_combine OF((uLong crc1, uLong crc2, z_off_t len2)); - - Combine two CRC-32 check values into one. For two sequences of bytes, - seq1 and seq2 with lengths len1 and len2, CRC-32 check values were - calculated for each, crc1 and crc2. crc32_combine() returns the CRC-32 - check value of seq1 and seq2 concatenated, requiring only crc1, crc2, and - len2. -*/ - - - /* various hacks, don't look :) */ - -/* deflateInit and inflateInit are macros to allow checking the zlib version - * and the compiler's view of z_stream: - */ -ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, - int windowBits, int memLevel, - int strategy, const char *version, - int stream_size)); -ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, - const char *version, int stream_size)); -ZEXTERN int ZEXPORT inflateBackInit_ OF((z_streamp strm, int windowBits, - unsigned char FAR *window, - const char *version, - int stream_size)); -#define deflateInit(strm, level) \ - deflateInit_((strm), (level), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateInit(strm) \ - inflateInit_((strm), ZLIB_VERSION, (int)sizeof(z_stream)) -#define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ - deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ - (strategy), ZLIB_VERSION, (int)sizeof(z_stream)) -#define inflateInit2(strm, windowBits) \ - inflateInit2_((strm), (windowBits), ZLIB_VERSION, \ - (int)sizeof(z_stream)) -#define inflateBackInit(strm, windowBits, window) \ - inflateBackInit_((strm), (windowBits), (window), \ - ZLIB_VERSION, (int)sizeof(z_stream)) - -#ifndef Z_SOLO - -/* gzgetc() macro and its supporting function and exposed data structure. Note - * that the real internal state is much larger than the exposed structure. - * This abbreviated structure exposes just enough for the gzgetc() macro. The - * user should not mess with these exposed elements, since their names or - * behavior could change in the future, perhaps even capriciously. They can - * only be used by the gzgetc() macro. You have been warned. - */ -struct gzFile_s { - unsigned have; - unsigned char *next; - z_off64_t pos; -}; -ZEXTERN int ZEXPORT gzgetc_ OF((gzFile file)); /* backward compatibility */ -#ifdef Z_PREFIX_SET -# undef z_gzgetc -# define z_gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) -#else -# define gzgetc(g) \ - ((g)->have ? ((g)->have--, (g)->pos++, *((g)->next)++) : gzgetc(g)) -#endif - -/* provide 64-bit offset functions if _LARGEFILE64_SOURCE defined, and/or - * change the regular functions to 64 bits if _FILE_OFFSET_BITS is 64 (if - * both are true, the application gets the *64 functions, and the regular - * functions are changed to 64 bits) -- in case these are set on systems - * without large file support, _LFS64_LARGEFILE must also be true - */ -#ifdef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off64_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off64_t)); -#endif - -#if !defined(ZLIB_INTERNAL) && defined(Z_WANT64) -# ifdef Z_PREFIX_SET -# define z_gzopen z_gzopen64 -# define z_gzseek z_gzseek64 -# define z_gztell z_gztell64 -# define z_gzoffset z_gzoffset64 -# define z_adler32_combine z_adler32_combine64 -# define z_crc32_combine z_crc32_combine64 -# else -# define gzopen gzopen64 -# define gzseek gzseek64 -# define gztell gztell64 -# define gzoffset gzoffset64 -# define adler32_combine adler32_combine64 -# define crc32_combine crc32_combine64 -# endif -# ifndef Z_LARGE64 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek64 OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset64 OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -# endif -#else - ZEXTERN gzFile ZEXPORT gzopen OF((const char *, const char *)); - ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile, z_off_t, int)); - ZEXTERN z_off_t ZEXPORT gztell OF((gzFile)); - ZEXTERN z_off_t ZEXPORT gzoffset OF((gzFile)); - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); -#endif - -#else /* Z_SOLO */ - - ZEXTERN uLong ZEXPORT adler32_combine OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine OF((uLong, uLong, z_off_t)); - -#endif /* !Z_SOLO */ - -/* hack for buggy compilers */ -#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL) - struct internal_state {int dummy;}; -#endif - -/* undocumented functions */ -ZEXTERN const char * ZEXPORT zError OF((int)); -ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp)); -ZEXTERN const z_crc_t FAR * ZEXPORT get_crc_table OF((void)); -ZEXTERN int ZEXPORT inflateUndermine OF((z_streamp, int)); -ZEXTERN int ZEXPORT inflateResetKeep OF((z_streamp)); -ZEXTERN int ZEXPORT deflateResetKeep OF((z_streamp)); -#if defined(_WIN32) && !defined(Z_SOLO) -ZEXTERN gzFile ZEXPORT gzopen_w OF((const wchar_t *path, - const char *mode)); -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifndef Z_SOLO -ZEXTERN int ZEXPORTVA gzvprintf Z_ARG((gzFile file, - const char *format, - va_list va)); -# endif -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* ZLIB_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.c deleted file mode 100644 index 0bf0426..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.c +++ /dev/null @@ -1,324 +0,0 @@ -/* zutil.c -- target dependent utility functions for the compression library - * Copyright (C) 1995-2005, 2010, 2011, 2012 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* @(#) $Id$ */ - -#include "zutil.h" -#ifndef Z_SOLO -# include "gzguts.h" -#endif - -#ifndef NO_DUMMY_DECL -struct internal_state {int dummy;}; /* for buggy compilers */ -#endif - -z_const char * const z_errmsg[10] = { -"need dictionary", /* Z_NEED_DICT 2 */ -"stream end", /* Z_STREAM_END 1 */ -"", /* Z_OK 0 */ -"file error", /* Z_ERRNO (-1) */ -"stream error", /* Z_STREAM_ERROR (-2) */ -"data error", /* Z_DATA_ERROR (-3) */ -"insufficient memory", /* Z_MEM_ERROR (-4) */ -"buffer error", /* Z_BUF_ERROR (-5) */ -"incompatible version",/* Z_VERSION_ERROR (-6) */ -""}; - - -const char * ZEXPORT zlibVersion() -{ - return ZLIB_VERSION; -} - -uLong ZEXPORT zlibCompileFlags() -{ - uLong flags; - - flags = 0; - switch ((int)(sizeof(uInt))) { - case 2: break; - case 4: flags += 1; break; - case 8: flags += 2; break; - default: flags += 3; - } - switch ((int)(sizeof(uLong))) { - case 2: break; - case 4: flags += 1 << 2; break; - case 8: flags += 2 << 2; break; - default: flags += 3 << 2; - } - switch ((int)(sizeof(voidpf))) { - case 2: break; - case 4: flags += 1 << 4; break; - case 8: flags += 2 << 4; break; - default: flags += 3 << 4; - } - switch ((int)(sizeof(z_off_t))) { - case 2: break; - case 4: flags += 1 << 6; break; - case 8: flags += 2 << 6; break; - default: flags += 3 << 6; - } -#ifdef DEBUG - flags += 1 << 8; -#endif -#if defined(ASMV) || defined(ASMINF) - flags += 1 << 9; -#endif -#ifdef ZLIB_WINAPI - flags += 1 << 10; -#endif -#ifdef BUILDFIXED - flags += 1 << 12; -#endif -#ifdef DYNAMIC_CRC_TABLE - flags += 1 << 13; -#endif -#ifdef NO_GZCOMPRESS - flags += 1L << 16; -#endif -#ifdef NO_GZIP - flags += 1L << 17; -#endif -#ifdef PKZIP_BUG_WORKAROUND - flags += 1L << 20; -#endif -#ifdef FASTEST - flags += 1L << 21; -#endif -#if defined(STDC) || defined(Z_HAVE_STDARG_H) -# ifdef NO_vsnprintf - flags += 1L << 25; -# ifdef HAS_vsprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_vsnprintf_void - flags += 1L << 26; -# endif -# endif -#else - flags += 1L << 24; -# ifdef NO_snprintf - flags += 1L << 25; -# ifdef HAS_sprintf_void - flags += 1L << 26; -# endif -# else -# ifdef HAS_snprintf_void - flags += 1L << 26; -# endif -# endif -#endif - return flags; -} - -#ifdef DEBUG - -# ifndef verbose -# define verbose 0 -# endif -int ZLIB_INTERNAL z_verbose = verbose; - -void ZLIB_INTERNAL z_error (m) - char *m; -{ - fprintf(stderr, "%s\n", m); - exit(1); -} -#endif - -/* exported to allow conversion of error code to string for compress() and - * uncompress() - */ -const char * ZEXPORT zError(err) - int err; -{ - return ERR_MSG(err); -} - -#if defined(_WIN32_WCE) - /* The Microsoft C Run-Time Library for Windows CE doesn't have - * errno. We define it as a global variable to simplify porting. - * Its value is always 0 and should not be used. - */ - int errno = 0; -#endif - -#ifndef HAVE_MEMCPY - -void ZLIB_INTERNAL zmemcpy(dest, source, len) - Bytef* dest; - const Bytef* source; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = *source++; /* ??? to be unrolled */ - } while (--len != 0); -} - -int ZLIB_INTERNAL zmemcmp(s1, s2, len) - const Bytef* s1; - const Bytef* s2; - uInt len; -{ - uInt j; - - for (j = 0; j < len; j++) { - if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; - } - return 0; -} - -void ZLIB_INTERNAL zmemzero(dest, len) - Bytef* dest; - uInt len; -{ - if (len == 0) return; - do { - *dest++ = 0; /* ??? to be unrolled */ - } while (--len != 0); -} -#endif - -#ifndef Z_SOLO - -#ifdef SYS16BIT - -#ifdef __TURBOC__ -/* Turbo C in 16-bit mode */ - -# define MY_ZCALLOC - -/* Turbo C malloc() does not allow dynamic allocation of 64K bytes - * and farmalloc(64K) returns a pointer with an offset of 8, so we - * must fix the pointer. Warning: the pointer must be put back to its - * original form in order to free it, use zcfree(). - */ - -#define MAX_PTR 10 -/* 10*64K = 640K */ - -local int next_ptr = 0; - -typedef struct ptr_table_s { - voidpf org_ptr; - voidpf new_ptr; -} ptr_table; - -local ptr_table table[MAX_PTR]; -/* This table is used to remember the original form of pointers - * to large buffers (64K). Such pointers are normalized with a zero offset. - * Since MSDOS is not a preemptive multitasking OS, this table is not - * protected from concurrent access. This hack doesn't work anyway on - * a protected system like OS/2. Use Microsoft C instead. - */ - -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, unsigned items, unsigned size) -{ - voidpf buf = opaque; /* just to make some compilers happy */ - ulg bsize = (ulg)items*size; - - /* If we allocate less than 65520 bytes, we assume that farmalloc - * will return a usable pointer which doesn't have to be normalized. - */ - if (bsize < 65520L) { - buf = farmalloc(bsize); - if (*(ush*)&buf != 0) return buf; - } else { - buf = farmalloc(bsize + 16L); - } - if (buf == NULL || next_ptr >= MAX_PTR) return NULL; - table[next_ptr].org_ptr = buf; - - /* Normalize the pointer to seg:0 */ - *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; - *(ush*)&buf = 0; - table[next_ptr++].new_ptr = buf; - return buf; -} - -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ - int n; - if (*(ush*)&ptr != 0) { /* object < 64K */ - farfree(ptr); - return; - } - /* Find the original pointer */ - for (n = 0; n < next_ptr; n++) { - if (ptr != table[n].new_ptr) continue; - - farfree(table[n].org_ptr); - while (++n < next_ptr) { - table[n-1] = table[n]; - } - next_ptr--; - return; - } - ptr = opaque; /* just to make some compilers happy */ - Assert(0, "zcfree: ptr not found"); -} - -#endif /* __TURBOC__ */ - - -#ifdef M_I86 -/* Microsoft C in 16-bit mode */ - -# define MY_ZCALLOC - -#if (!defined(_MSC_VER) || (_MSC_VER <= 600)) -# define _halloc halloc -# define _hfree hfree -#endif - -voidpf ZLIB_INTERNAL zcalloc (voidpf opaque, uInt items, uInt size) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - return _halloc((long)items, size); -} - -void ZLIB_INTERNAL zcfree (voidpf opaque, voidpf ptr) -{ - if (opaque) opaque = 0; /* to make compiler happy */ - _hfree(ptr); -} - -#endif /* M_I86 */ - -#endif /* SYS16BIT */ - - -#ifndef MY_ZCALLOC /* Any system without a special alloc function */ - -#ifndef STDC -extern voidp malloc OF((uInt size)); -extern voidp calloc OF((uInt items, uInt size)); -extern void free OF((voidpf ptr)); -#endif - -voidpf ZLIB_INTERNAL zcalloc (opaque, items, size) - voidpf opaque; - unsigned items; - unsigned size; -{ - if (opaque) items += size - size; /* make compiler happy */ - return sizeof(uInt) > 2 ? (voidpf)malloc(items * size) : - (voidpf)calloc(items, size); -} - -void ZLIB_INTERNAL zcfree (opaque, ptr) - voidpf opaque; - voidpf ptr; -{ - free(ptr); - if (opaque) return; /* make compiler happy */ -} - -#endif /* MY_ZCALLOC */ - -#endif /* !Z_SOLO */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.h b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.h deleted file mode 100644 index f4e4d05..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlib/zutil.h +++ /dev/null @@ -1,253 +0,0 @@ -/* zutil.h -- internal interface and configuration of the compression library - * Copyright (C) 1995-2013 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include "zlib.h" - -#if defined(STDC) && !defined(Z_SOLO) -# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) -# include -# endif -# include -# include -#endif - -#ifdef Z_SOLO - typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# ifndef Z_SOLO -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# if defined(M_I86) && !defined(Z_SOLO) -# include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined __INTERIX -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - -#if defined(__BORLANDC__) && !defined(MSDOS) - #pragma warn -8004 - #pragma warn -8008 - #pragma warn -8066 -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_WIN32) && \ - (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(pyr) || defined(Z_SOLO) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - -#ifndef Z_SOLO - voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, - unsigned size)); - void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); -#endif - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -/* Reverse the bytes in a 32-bit value */ -#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -#endif /* ZUTIL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlibmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Modules/zlibmodule.c deleted file mode 100644 index e9639ce..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Modules/zlibmodule.c +++ /dev/null @@ -1,1093 +0,0 @@ -/* zlibmodule.c -- gzip-compatible data compression */ -/* See http://www.gzip.org/zlib/ */ - -/* Windows users: read Python's PCbuild\readme.txt */ - - -#include "Python.h" -#include "zlib.h" - -#ifdef WITH_THREAD -#include "pythread.h" - -/* #defs ripped off from _tkinter.c, even though the situation here is much - simpler, because we don't have to worry about waiting for Tcl - events! And, since zlib itself is threadsafe, we don't need to worry - about re-entering zlib functions. - - N.B. - - Since ENTER_ZLIB and LEAVE_ZLIB only need to be called on functions - that modify the components of preexisting de/compress objects, it - could prove to be a performance gain on multiprocessor machines if - there was an de/compress object-specific lock. However, for the - moment the ENTER_ZLIB and LEAVE_ZLIB calls are global for ALL - de/compress objects. - */ - -static PyThread_type_lock zlib_lock = NULL; /* initialized on module load */ - -#define ENTER_ZLIB \ - Py_BEGIN_ALLOW_THREADS \ - PyThread_acquire_lock(zlib_lock, 1); \ - Py_END_ALLOW_THREADS - -#define LEAVE_ZLIB \ - PyThread_release_lock(zlib_lock); - -#else - -#define ENTER_ZLIB -#define LEAVE_ZLIB - -#endif - -/* The following parameters are copied from zutil.h, version 0.95 */ -#define DEFLATED 8 -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -#define DEF_WBITS MAX_WBITS - -/* The output buffer will be increased in chunks of DEFAULTALLOC bytes. */ -#define DEFAULTALLOC (16*1024) -#define PyInit_zlib initzlib - -static PyTypeObject Comptype; -static PyTypeObject Decomptype; - -static PyObject *ZlibError; - -typedef struct -{ - PyObject_HEAD - z_stream zst; - PyObject *unused_data; - PyObject *unconsumed_tail; - int is_initialised; -} compobject; - -static void -zlib_error(z_stream zst, int err, char *msg) -{ - const char *zmsg = Z_NULL; - /* In case of a version mismatch, zst.msg won't be initialized. - Check for this case first, before looking at zst.msg. */ - if (err == Z_VERSION_ERROR) - zmsg = "library version mismatch"; - if (zmsg == Z_NULL) - zmsg = zst.msg; - if (zmsg == Z_NULL) { - switch (err) { - case Z_BUF_ERROR: - zmsg = "incomplete or truncated stream"; - break; - case Z_STREAM_ERROR: - zmsg = "inconsistent stream state"; - break; - case Z_DATA_ERROR: - zmsg = "invalid input data"; - break; - } - } - if (zmsg == Z_NULL) - PyErr_Format(ZlibError, "Error %d %s", err, msg); - else - PyErr_Format(ZlibError, "Error %d %s: %.200s", err, msg, zmsg); -} - -PyDoc_STRVAR(compressobj__doc__, -"compressobj([level]) -- Return a compressor object.\n" -"\n" -"Optional arg level is the compression level, in 0-9."); - -PyDoc_STRVAR(decompressobj__doc__, -"decompressobj([wbits]) -- Return a decompressor object.\n" -"\n" -"Optional arg wbits is the window buffer size."); - -static compobject * -newcompobject(PyTypeObject *type) -{ - compobject *self; - self = PyObject_New(compobject, type); - if (self == NULL) - return NULL; - self->is_initialised = 0; - self->unused_data = PyString_FromString(""); - if (self->unused_data == NULL) { - Py_DECREF(self); - return NULL; - } - self->unconsumed_tail = PyString_FromString(""); - if (self->unconsumed_tail == NULL) { - Py_DECREF(self); - return NULL; - } - return self; -} - -PyDoc_STRVAR(compress__doc__, -"compress(string[, level]) -- Returned compressed string.\n" -"\n" -"Optional arg level is the compression level, in 0-9."); - -static PyObject * -PyZlib_compress(PyObject *self, PyObject *args) -{ - PyObject *ReturnVal = NULL; - Byte *input, *output; - int length, level=Z_DEFAULT_COMPRESSION, err; - z_stream zst; - - /* require Python string object, optional 'level' arg */ - if (!PyArg_ParseTuple(args, "s#|i:compress", &input, &length, &level)) - return NULL; - - zst.avail_out = length + length/1000 + 12 + 1; - - output = (Byte*)malloc(zst.avail_out); - if (output == NULL) { - PyErr_SetString(PyExc_MemoryError, - "Can't allocate memory to compress data"); - return NULL; - } - - /* Past the point of no return. From here on out, we need to make sure - we clean up mallocs & INCREFs. */ - - zst.zalloc = (alloc_func)NULL; - zst.zfree = (free_func)Z_NULL; - zst.next_out = (Byte *)output; - zst.next_in = (Byte *)input; - zst.avail_in = length; - err = deflateInit(&zst, level); - - switch(err) { - case(Z_OK): - break; - case(Z_MEM_ERROR): - PyErr_SetString(PyExc_MemoryError, - "Out of memory while compressing data"); - goto error; - case(Z_STREAM_ERROR): - PyErr_SetString(ZlibError, - "Bad compression level"); - goto error; - default: - deflateEnd(&zst); - zlib_error(zst, err, "while compressing data"); - goto error; - } - - Py_BEGIN_ALLOW_THREADS; - err = deflate(&zst, Z_FINISH); - Py_END_ALLOW_THREADS; - - if (err != Z_STREAM_END) { - zlib_error(zst, err, "while compressing data"); - deflateEnd(&zst); - goto error; - } - - err=deflateEnd(&zst); - if (err == Z_OK) - ReturnVal = PyString_FromStringAndSize((char *)output, - zst.total_out); - else - zlib_error(zst, err, "while finishing compression"); - - error: - free(output); - - return ReturnVal; -} - -PyDoc_STRVAR(decompress__doc__, -"decompress(string[, wbits[, bufsize]]) -- Return decompressed string.\n" -"\n" -"Optional arg wbits is the window buffer size. Optional arg bufsize is\n" -"the initial output buffer size."); - -static PyObject * -PyZlib_decompress(PyObject *self, PyObject *args) -{ - PyObject *result_str; - Byte *input; - int length, err; - int wsize=DEF_WBITS; - Py_ssize_t r_strlen=DEFAULTALLOC; - z_stream zst; - - if (!PyArg_ParseTuple(args, "s#|in:decompress", - &input, &length, &wsize, &r_strlen)) - return NULL; - - if (r_strlen <= 0) - r_strlen = 1; - - zst.avail_in = length; - zst.avail_out = r_strlen; - - if (!(result_str = PyString_FromStringAndSize(NULL, r_strlen))) - return NULL; - - zst.zalloc = (alloc_func)NULL; - zst.zfree = (free_func)Z_NULL; - zst.next_out = (Byte *)PyString_AS_STRING(result_str); - zst.next_in = (Byte *)input; - err = inflateInit2(&zst, wsize); - - switch(err) { - case(Z_OK): - break; - case(Z_MEM_ERROR): - PyErr_SetString(PyExc_MemoryError, - "Out of memory while decompressing data"); - goto error; - default: - inflateEnd(&zst); - zlib_error(zst, err, "while preparing to decompress data"); - goto error; - } - - do { - Py_BEGIN_ALLOW_THREADS - err=inflate(&zst, Z_FINISH); - Py_END_ALLOW_THREADS - - switch(err) { - case(Z_STREAM_END): - break; - case(Z_BUF_ERROR): - /* - * If there is at least 1 byte of room according to zst.avail_out - * and we get this error, assume that it means zlib cannot - * process the inflate call() due to an error in the data. - */ - if (zst.avail_out > 0) { - zlib_error(zst, err, "while decompressing data"); - inflateEnd(&zst); - goto error; - } - /* fall through */ - case(Z_OK): - /* need more memory */ - if (_PyString_Resize(&result_str, r_strlen << 1) < 0) { - inflateEnd(&zst); - goto error; - } - zst.next_out = (unsigned char *)PyString_AS_STRING(result_str) \ - + r_strlen; - zst.avail_out = r_strlen; - r_strlen = r_strlen << 1; - break; - default: - inflateEnd(&zst); - zlib_error(zst, err, "while decompressing data"); - goto error; - } - } while (err != Z_STREAM_END); - - err = inflateEnd(&zst); - if (err != Z_OK) { - zlib_error(zst, err, "while finishing data decompression"); - goto error; - } - - _PyString_Resize(&result_str, zst.total_out); - return result_str; - - error: - Py_XDECREF(result_str); - return NULL; -} - -static PyObject * -PyZlib_compressobj(PyObject *selfptr, PyObject *args) -{ - compobject *self; - int level=Z_DEFAULT_COMPRESSION, method=DEFLATED; - int wbits=MAX_WBITS, memLevel=DEF_MEM_LEVEL, strategy=0, err; - - if (!PyArg_ParseTuple(args, "|iiiii:compressobj", &level, &method, &wbits, - &memLevel, &strategy)) - return NULL; - - self = newcompobject(&Comptype); - if (self==NULL) - return(NULL); - self->zst.zalloc = (alloc_func)NULL; - self->zst.zfree = (free_func)Z_NULL; - self->zst.next_in = NULL; - self->zst.avail_in = 0; - err = deflateInit2(&self->zst, level, method, wbits, memLevel, strategy); - switch(err) { - case (Z_OK): - self->is_initialised = 1; - return (PyObject*)self; - case (Z_MEM_ERROR): - Py_DECREF(self); - PyErr_SetString(PyExc_MemoryError, - "Can't allocate memory for compression object"); - return NULL; - case(Z_STREAM_ERROR): - Py_DECREF(self); - PyErr_SetString(PyExc_ValueError, "Invalid initialization option"); - return NULL; - default: - zlib_error(self->zst, err, "while creating compression object"); - Py_DECREF(self); - return NULL; - } -} - -static PyObject * -PyZlib_decompressobj(PyObject *selfptr, PyObject *args) -{ - int wbits=DEF_WBITS, err; - compobject *self; - if (!PyArg_ParseTuple(args, "|i:decompressobj", &wbits)) - return NULL; - - self = newcompobject(&Decomptype); - if (self == NULL) - return(NULL); - self->zst.zalloc = (alloc_func)NULL; - self->zst.zfree = (free_func)Z_NULL; - self->zst.next_in = NULL; - self->zst.avail_in = 0; - err = inflateInit2(&self->zst, wbits); - switch(err) { - case (Z_OK): - self->is_initialised = 1; - return (PyObject*)self; - case(Z_STREAM_ERROR): - Py_DECREF(self); - PyErr_SetString(PyExc_ValueError, "Invalid initialization option"); - return NULL; - case (Z_MEM_ERROR): - Py_DECREF(self); - PyErr_SetString(PyExc_MemoryError, - "Can't allocate memory for decompression object"); - return NULL; - default: - zlib_error(self->zst, err, "while creating decompression object"); - Py_DECREF(self); - return NULL; - } -} - -static void -Comp_dealloc(compobject *self) -{ - if (self->is_initialised) - deflateEnd(&self->zst); - Py_XDECREF(self->unused_data); - Py_XDECREF(self->unconsumed_tail); - PyObject_Del(self); -} - -static void -Decomp_dealloc(compobject *self) -{ - if (self->is_initialised) - inflateEnd(&self->zst); - Py_XDECREF(self->unused_data); - Py_XDECREF(self->unconsumed_tail); - PyObject_Del(self); -} - -PyDoc_STRVAR(comp_compress__doc__, -"compress(data) -- Return a string containing data compressed.\n" -"\n" -"After calling this function, some of the input data may still\n" -"be stored in internal buffers for later processing.\n" -"Call the flush() method to clear these buffers."); - - -static PyObject * -PyZlib_objcompress(compobject *self, PyObject *args) -{ - int err, inplen; - Py_ssize_t length = DEFAULTALLOC; - PyObject *RetVal; - Byte *input; - unsigned long start_total_out; - - if (!PyArg_ParseTuple(args, "s#:compress", &input, &inplen)) - return NULL; - - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) - return NULL; - - ENTER_ZLIB - - start_total_out = self->zst.total_out; - self->zst.avail_in = inplen; - self->zst.next_in = input; - self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); - - Py_BEGIN_ALLOW_THREADS - err = deflate(&(self->zst), Z_NO_FLUSH); - Py_END_ALLOW_THREADS - - /* while Z_OK and the output buffer is full, there might be more output, - so extend the output buffer and try again */ - while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyString_Resize(&RetVal, length << 1) < 0) - goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ - + length; - self->zst.avail_out = length; - length = length << 1; - - Py_BEGIN_ALLOW_THREADS - err = deflate(&(self->zst), Z_NO_FLUSH); - Py_END_ALLOW_THREADS - } - /* We will only get Z_BUF_ERROR if the output buffer was full but - there wasn't more output when we tried again, so it is not an error - condition. - */ - - if (err != Z_OK && err != Z_BUF_ERROR) { - zlib_error(self->zst, err, "while compressing"); - Py_DECREF(RetVal); - RetVal = NULL; - goto error; - } - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); - - error: - LEAVE_ZLIB - return RetVal; -} - -/* Helper for objdecompress() and unflush(). Saves any unconsumed input data in - self->unused_data or self->unconsumed_tail, as appropriate. */ -static int -save_unconsumed_input(compobject *self, int err) -{ - if (err == Z_STREAM_END) { - /* The end of the compressed data has been reached. Store the leftover - input data in self->unused_data. */ - if (self->zst.avail_in > 0) { - Py_ssize_t old_size = PyString_GET_SIZE(self->unused_data); - Py_ssize_t new_size; - PyObject *new_data; - if (self->zst.avail_in > PY_SSIZE_T_MAX - old_size) { - PyErr_NoMemory(); - return -1; - } - new_size = old_size + self->zst.avail_in; - new_data = PyString_FromStringAndSize(NULL, new_size); - if (new_data == NULL) - return -1; - Py_MEMCPY(PyString_AS_STRING(new_data), - PyString_AS_STRING(self->unused_data), old_size); - Py_MEMCPY(PyString_AS_STRING(new_data) + old_size, - self->zst.next_in, self->zst.avail_in); - Py_DECREF(self->unused_data); - self->unused_data = new_data; - self->zst.avail_in = 0; - } - } - if (self->zst.avail_in > 0 || PyString_GET_SIZE(self->unconsumed_tail)) { - /* This code handles two distinct cases: - 1. Output limit was reached. Save leftover input in unconsumed_tail. - 2. All input data was consumed. Clear unconsumed_tail. */ - PyObject *new_data = PyString_FromStringAndSize( - (char *)self->zst.next_in, self->zst.avail_in); - if (new_data == NULL) - return -1; - Py_DECREF(self->unconsumed_tail); - self->unconsumed_tail = new_data; - } - return 0; -} - -PyDoc_STRVAR(decomp_decompress__doc__, -"decompress(data, max_length) -- Return a string containing the decompressed\n" -"version of the data.\n" -"\n" -"After calling this function, some of the input data may still be stored in\n" -"internal buffers for later processing.\n" -"Call the flush() method to clear these buffers.\n" -"If the max_length parameter is specified then the return value will be\n" -"no longer than max_length. Unconsumed input data will be stored in\n" -"the unconsumed_tail attribute."); - -static PyObject * -PyZlib_objdecompress(compobject *self, PyObject *args) -{ - int err, inplen, max_length = 0; - Py_ssize_t old_length, length = DEFAULTALLOC; - PyObject *RetVal; - Byte *input; - unsigned long start_total_out; - - if (!PyArg_ParseTuple(args, "s#|i:decompress", &input, - &inplen, &max_length)) - return NULL; - if (max_length < 0) { - PyErr_SetString(PyExc_ValueError, - "max_length must be greater than zero"); - return NULL; - } - - /* limit amount of data allocated to max_length */ - if (max_length && length > max_length) - length = max_length; - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) - return NULL; - - ENTER_ZLIB - - start_total_out = self->zst.total_out; - self->zst.avail_in = inplen; - self->zst.next_in = input; - self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); - - Py_BEGIN_ALLOW_THREADS - err = inflate(&(self->zst), Z_SYNC_FLUSH); - Py_END_ALLOW_THREADS - - /* While Z_OK and the output buffer is full, there might be more output. - So extend the output buffer and try again. - */ - while (err == Z_OK && self->zst.avail_out == 0) { - /* If max_length set, don't continue decompressing if we've already - reached the limit. - */ - if (max_length && length >= max_length) - break; - - /* otherwise, ... */ - old_length = length; - length = length << 1; - if (max_length && length > max_length) - length = max_length; - - if (_PyString_Resize(&RetVal, length) < 0) - goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ - + old_length; - self->zst.avail_out = length - old_length; - - Py_BEGIN_ALLOW_THREADS - err = inflate(&(self->zst), Z_SYNC_FLUSH); - Py_END_ALLOW_THREADS - } - - if (save_unconsumed_input(self, err) < 0) { - Py_DECREF(RetVal); - RetVal = NULL; - goto error; - } - - /* This is the logical place to call inflateEnd, but the old behaviour of - only calling it on flush() is preserved. */ - - if (err != Z_STREAM_END && err != Z_OK && err != Z_BUF_ERROR) { - /* We will only get Z_BUF_ERROR if the output buffer was full - but there wasn't more output when we tried again, so it is - not an error condition. - */ - zlib_error(self->zst, err, "while decompressing"); - Py_DECREF(RetVal); - RetVal = NULL; - goto error; - } - - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); - - error: - LEAVE_ZLIB - - return RetVal; -} - -PyDoc_STRVAR(comp_flush__doc__, -"flush( [mode] ) -- Return a string containing any remaining compressed data.\n" -"\n" -"mode can be one of the constants Z_SYNC_FLUSH, Z_FULL_FLUSH, Z_FINISH; the\n" -"default value used when mode is not specified is Z_FINISH.\n" -"If mode == Z_FINISH, the compressor object can no longer be used after\n" -"calling the flush() method. Otherwise, more data can still be compressed."); - -static PyObject * -PyZlib_flush(compobject *self, PyObject *args) -{ - int err, length = DEFAULTALLOC; - PyObject *RetVal; - int flushmode = Z_FINISH; - unsigned long start_total_out; - - if (!PyArg_ParseTuple(args, "|i:flush", &flushmode)) - return NULL; - - /* Flushing with Z_NO_FLUSH is a no-op, so there's no point in - doing any work at all; just return an empty string. */ - if (flushmode == Z_NO_FLUSH) { - return PyString_FromStringAndSize(NULL, 0); - } - - if (!(RetVal = PyString_FromStringAndSize(NULL, length))) - return NULL; - - ENTER_ZLIB - - start_total_out = self->zst.total_out; - self->zst.avail_in = 0; - self->zst.avail_out = length; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal); - - Py_BEGIN_ALLOW_THREADS - err = deflate(&(self->zst), flushmode); - Py_END_ALLOW_THREADS - - /* while Z_OK and the output buffer is full, there might be more output, - so extend the output buffer and try again */ - while (err == Z_OK && self->zst.avail_out == 0) { - if (_PyString_Resize(&RetVal, length << 1) < 0) - goto error; - self->zst.next_out = (unsigned char *)PyString_AS_STRING(RetVal) \ - + length; - self->zst.avail_out = length; - length = length << 1; - - Py_BEGIN_ALLOW_THREADS - err = deflate(&(self->zst), flushmode); - Py_END_ALLOW_THREADS - } - - /* If flushmode is Z_FINISH, we also have to call deflateEnd() to free - various data structures. Note we should only get Z_STREAM_END when - flushmode is Z_FINISH, but checking both for safety*/ - if (err == Z_STREAM_END && flushmode == Z_FINISH) { - err = deflateEnd(&(self->zst)); - if (err != Z_OK) { - zlib_error(self->zst, err, "from deflateEnd()"); - Py_DECREF(RetVal); - RetVal = NULL; - goto error; - } - else - self->is_initialised = 0; - - /* We will only get Z_BUF_ERROR if the output buffer was full - but there wasn't more output when we tried again, so it is - not an error condition. - */ - } else if (err!=Z_OK && err!=Z_BUF_ERROR) { - zlib_error(self->zst, err, "while flushing"); - Py_DECREF(RetVal); - RetVal = NULL; - goto error; - } - - _PyString_Resize(&RetVal, self->zst.total_out - start_total_out); - - error: - LEAVE_ZLIB - - return RetVal; -} - -#ifdef HAVE_ZLIB_COPY -PyDoc_STRVAR(comp_copy__doc__, -"copy() -- Return a copy of the compression object."); - -static PyObject * -PyZlib_copy(compobject *self) -{ - compobject *retval = NULL; - int err; - - retval = newcompobject(&Comptype); - if (!retval) return NULL; - - /* Copy the zstream state - * We use ENTER_ZLIB / LEAVE_ZLIB to make this thread-safe - */ - ENTER_ZLIB - err = deflateCopy(&retval->zst, &self->zst); - switch(err) { - case(Z_OK): - break; - case(Z_STREAM_ERROR): - PyErr_SetString(PyExc_ValueError, "Inconsistent stream state"); - goto error; - case(Z_MEM_ERROR): - PyErr_SetString(PyExc_MemoryError, - "Can't allocate memory for compression object"); - goto error; - default: - zlib_error(self->zst, err, "while copying compression object"); - goto error; - } - - Py_INCREF(self->unused_data); - Py_INCREF(self->unconsumed_tail); - Py_XDECREF(retval->unused_data); - Py_XDECREF(retval->unconsumed_tail); - retval->unused_data = self->unused_data; - retval->unconsumed_tail = self->unconsumed_tail; - - /* Mark it as being initialized */ - retval->is_initialised = 1; - - LEAVE_ZLIB - return (PyObject *)retval; - -error: - LEAVE_ZLIB - Py_XDECREF(retval); - return NULL; -} - -PyDoc_STRVAR(decomp_copy__doc__, -"copy() -- Return a copy of the decompression object."); - -static PyObject * -PyZlib_uncopy(compobject *self) -{ - compobject *retval = NULL; - int err; - - retval = newcompobject(&Decomptype); - if (!retval) return NULL; - - /* Copy the zstream state - * We use ENTER_ZLIB / LEAVE_ZLIB to make this thread-safe - */ - ENTER_ZLIB - err = inflateCopy(&retval->zst, &self->zst); - switch(err) { - case(Z_OK): - break; - case(Z_STREAM_ERROR): - PyErr_SetString(PyExc_ValueError, "Inconsistent stream state"); - goto error; - case(Z_MEM_ERROR): - PyErr_SetString(PyExc_MemoryError, - "Can't allocate memory for decompression object"); - goto error; - default: - zlib_error(self->zst, err, "while copying decompression object"); - goto error; - } - - Py_INCREF(self->unused_data); - Py_INCREF(self->unconsumed_tail); - Py_XDECREF(retval->unused_data); - Py_XDECREF(retval->unconsumed_tail); - retval->unused_data = self->unused_data; - retval->unconsumed_tail = self->unconsumed_tail; - - /* Mark it as being initialized */ - retval->is_initialised = 1; - - LEAVE_ZLIB - return (PyObject *)retval; - -error: - LEAVE_ZLIB - Py_XDECREF(retval); - return NULL; -} -#endif - -PyDoc_STRVAR(decomp_flush__doc__, -"flush( [length] ) -- Return a string containing any remaining\n" -"decompressed data. length, if given, is the initial size of the\n" -"output buffer.\n" -"\n" -"The decompressor object can no longer be used after this call."); - -static PyObject * -PyZlib_unflush(compobject *self, PyObject *args) -{ - int err, length = DEFAULTALLOC; - PyObject * retval = NULL; - unsigned long start_total_out; - - if (!PyArg_ParseTuple(args, "|i:flush", &length)) - return NULL; - if (length <= 0) { - PyErr_SetString(PyExc_ValueError, "length must be greater than zero"); - return NULL; - } - if (!(retval = PyString_FromStringAndSize(NULL, length))) - return NULL; - - - ENTER_ZLIB - - start_total_out = self->zst.total_out; - self->zst.avail_in = PyString_GET_SIZE(self->unconsumed_tail); - self->zst.next_in = (Byte *)PyString_AS_STRING(self->unconsumed_tail); - self->zst.avail_out = length; - self->zst.next_out = (Byte *)PyString_AS_STRING(retval); - - Py_BEGIN_ALLOW_THREADS - err = inflate(&(self->zst), Z_FINISH); - Py_END_ALLOW_THREADS - - /* while Z_OK and the output buffer is full, there might be more output, - so extend the output buffer and try again */ - while ((err == Z_OK || err == Z_BUF_ERROR) && self->zst.avail_out == 0) { - if (_PyString_Resize(&retval, length << 1) < 0) - goto error; - self->zst.next_out = (Byte *)PyString_AS_STRING(retval) + length; - self->zst.avail_out = length; - length = length << 1; - - Py_BEGIN_ALLOW_THREADS - err = inflate(&(self->zst), Z_FINISH); - Py_END_ALLOW_THREADS - } - - if (save_unconsumed_input(self, err) < 0) { - Py_DECREF(retval); - retval = NULL; - goto error; - } - - /* If flushmode is Z_FINISH, we also have to call deflateEnd() to free - various data structures. Note we should only get Z_STREAM_END when - flushmode is Z_FINISH */ - if (err == Z_STREAM_END) { - err = inflateEnd(&(self->zst)); - self->is_initialised = 0; - if (err != Z_OK) { - zlib_error(self->zst, err, "from inflateEnd()"); - Py_DECREF(retval); - retval = NULL; - goto error; - } - } - - _PyString_Resize(&retval, self->zst.total_out - start_total_out); - -error: - - LEAVE_ZLIB - - return retval; -} - -static PyMethodDef comp_methods[] = -{ - {"compress", (binaryfunc)PyZlib_objcompress, METH_VARARGS, - comp_compress__doc__}, - {"flush", (binaryfunc)PyZlib_flush, METH_VARARGS, - comp_flush__doc__}, -#ifdef HAVE_ZLIB_COPY - {"copy", (PyCFunction)PyZlib_copy, METH_NOARGS, - comp_copy__doc__}, -#endif - {NULL, NULL} -}; - -static PyMethodDef Decomp_methods[] = -{ - {"decompress", (binaryfunc)PyZlib_objdecompress, METH_VARARGS, - decomp_decompress__doc__}, - {"flush", (binaryfunc)PyZlib_unflush, METH_VARARGS, - decomp_flush__doc__}, -#ifdef HAVE_ZLIB_COPY - {"copy", (PyCFunction)PyZlib_uncopy, METH_NOARGS, - decomp_copy__doc__}, -#endif - {NULL, NULL} -}; - -static PyObject * -Comp_getattr(compobject *self, char *name) -{ - /* No ENTER/LEAVE_ZLIB is necessary because this fn doesn't touch - internal data. */ - - return Py_FindMethod(comp_methods, (PyObject *)self, name); -} - -static PyObject * -Decomp_getattr(compobject *self, char *name) -{ - PyObject * retval; - - ENTER_ZLIB - - if (strcmp(name, "unused_data") == 0) { - Py_INCREF(self->unused_data); - retval = self->unused_data; - } else if (strcmp(name, "unconsumed_tail") == 0) { - Py_INCREF(self->unconsumed_tail); - retval = self->unconsumed_tail; - } else - retval = Py_FindMethod(Decomp_methods, (PyObject *)self, name); - - LEAVE_ZLIB - - return retval; -} - -PyDoc_STRVAR(adler32__doc__, -"adler32(string[, start]) -- Compute an Adler-32 checksum of string.\n" -"\n" -"An optional starting value can be specified. The returned checksum is\n" -"a signed integer."); - -static PyObject * -PyZlib_adler32(PyObject *self, PyObject *args) -{ - unsigned int adler32val = 1; /* adler32(0L, Z_NULL, 0) */ - Byte *buf; - int len, signed_val; - - if (!PyArg_ParseTuple(args, "s#|I:adler32", &buf, &len, &adler32val)) - return NULL; - /* In Python 2.x we return a signed integer regardless of native platform - * long size (the 32bit unsigned long is treated as 32-bit signed and sign - * extended into a 64-bit long inside the integer object). 3.0 does the - * right thing and returns unsigned. http://bugs.python.org/issue1202 */ - signed_val = adler32(adler32val, buf, len); - return PyInt_FromLong(signed_val); -} - -PyDoc_STRVAR(crc32__doc__, -"crc32(string[, start]) -- Compute a CRC-32 checksum of string.\n" -"\n" -"An optional starting value can be specified. The returned checksum is\n" -"a signed integer."); - -static PyObject * -PyZlib_crc32(PyObject *self, PyObject *args) -{ - unsigned int crc32val = 0; /* crc32(0L, Z_NULL, 0) */ - Byte *buf; - int len, signed_val; - - if (!PyArg_ParseTuple(args, "s#|I:crc32", &buf, &len, &crc32val)) - return NULL; - /* In Python 2.x we return a signed integer regardless of native platform - * long size (the 32bit unsigned long is treated as 32-bit signed and sign - * extended into a 64-bit long inside the integer object). 3.0 does the - * right thing and returns unsigned. http://bugs.python.org/issue1202 */ - signed_val = crc32(crc32val, buf, len); - return PyInt_FromLong(signed_val); -} - - -static PyMethodDef zlib_methods[] = -{ - {"adler32", (PyCFunction)PyZlib_adler32, METH_VARARGS, - adler32__doc__}, - {"compress", (PyCFunction)PyZlib_compress, METH_VARARGS, - compress__doc__}, - {"compressobj", (PyCFunction)PyZlib_compressobj, METH_VARARGS, - compressobj__doc__}, - {"crc32", (PyCFunction)PyZlib_crc32, METH_VARARGS, - crc32__doc__}, - {"decompress", (PyCFunction)PyZlib_decompress, METH_VARARGS, - decompress__doc__}, - {"decompressobj", (PyCFunction)PyZlib_decompressobj, METH_VARARGS, - decompressobj__doc__}, - {NULL, NULL} -}; - -static PyTypeObject Comptype = { - PyVarObject_HEAD_INIT(0, 0) - "zlib.Compress", - sizeof(compobject), - 0, - (destructor)Comp_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)Comp_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ -}; - -static PyTypeObject Decomptype = { - PyVarObject_HEAD_INIT(0, 0) - "zlib.Decompress", - sizeof(compobject), - 0, - (destructor)Decomp_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)Decomp_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ -}; - -PyDoc_STRVAR(zlib_module_documentation, -"The functions in this module allow compression and decompression using the\n" -"zlib library, which is based on GNU zip.\n" -"\n" -"adler32(string[, start]) -- Compute an Adler-32 checksum.\n" -"compress(string[, level]) -- Compress string, with compression level in 0-9.\n" -"compressobj([level]) -- Return a compressor object.\n" -"crc32(string[, start]) -- Compute a CRC-32 checksum.\n" -"decompress(string,[wbits],[bufsize]) -- Decompresses a compressed string.\n" -"decompressobj([wbits]) -- Return a decompressor object.\n" -"\n" -"'wbits' is window buffer size.\n" -"Compressor objects support compress() and flush() methods; decompressor\n" -"objects support decompress() and flush()."); - -PyMODINIT_FUNC -PyInit_zlib(void) -{ - PyObject *m, *ver; - Py_TYPE(&Comptype) = &PyType_Type; - Py_TYPE(&Decomptype) = &PyType_Type; - m = Py_InitModule4("zlib", zlib_methods, - zlib_module_documentation, - (PyObject*)NULL,PYTHON_API_VERSION); - if (m == NULL) - return; - - ZlibError = PyErr_NewException("zlib.error", NULL, NULL); - if (ZlibError != NULL) { - Py_INCREF(ZlibError); - PyModule_AddObject(m, "error", ZlibError); - } - PyModule_AddIntConstant(m, "MAX_WBITS", MAX_WBITS); - PyModule_AddIntConstant(m, "DEFLATED", DEFLATED); - PyModule_AddIntConstant(m, "DEF_MEM_LEVEL", DEF_MEM_LEVEL); - PyModule_AddIntConstant(m, "Z_BEST_SPEED", Z_BEST_SPEED); - PyModule_AddIntConstant(m, "Z_BEST_COMPRESSION", Z_BEST_COMPRESSION); - PyModule_AddIntConstant(m, "Z_DEFAULT_COMPRESSION", Z_DEFAULT_COMPRESSION); - PyModule_AddIntConstant(m, "Z_FILTERED", Z_FILTERED); - PyModule_AddIntConstant(m, "Z_HUFFMAN_ONLY", Z_HUFFMAN_ONLY); - PyModule_AddIntConstant(m, "Z_DEFAULT_STRATEGY", Z_DEFAULT_STRATEGY); - - PyModule_AddIntConstant(m, "Z_FINISH", Z_FINISH); - PyModule_AddIntConstant(m, "Z_NO_FLUSH", Z_NO_FLUSH); - PyModule_AddIntConstant(m, "Z_SYNC_FLUSH", Z_SYNC_FLUSH); - PyModule_AddIntConstant(m, "Z_FULL_FLUSH", Z_FULL_FLUSH); - - ver = PyString_FromString(ZLIB_VERSION); - if (ver != NULL) - PyModule_AddObject(m, "ZLIB_VERSION", ver); - - PyModule_AddStringConstant(m, "__version__", "1.0"); - -#ifdef WITH_THREAD - zlib_lock = PyThread_allocate_lock(); -#endif /* WITH_THREAD */ -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/abstract.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/abstract.c deleted file mode 100644 index 2a82325..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/abstract.c +++ /dev/null @@ -1,3109 +0,0 @@ -/* Abstract Object Interface (many thanks to Jim Fulton) */ - -#include "Python.h" -#include -#include "structmember.h" /* we need the offsetof() macro from there */ -#include "longintrepr.h" - -#define NEW_STYLE_NUMBER(o) PyType_HasFeature((o)->ob_type, \ - Py_TPFLAGS_CHECKTYPES) - - -/* Shorthands to return certain errors */ - -static PyObject * -type_error(const char *msg, PyObject *obj) -{ - PyErr_Format(PyExc_TypeError, msg, obj->ob_type->tp_name); - return NULL; -} - -static PyObject * -null_error(void) -{ - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, - "null argument to internal routine"); - return NULL; -} - -/* Operations on any object */ - -int -PyObject_Cmp(PyObject *o1, PyObject *o2, int *result) -{ - int r; - - if (o1 == NULL || o2 == NULL) { - null_error(); - return -1; - } - r = PyObject_Compare(o1, o2); - if (PyErr_Occurred()) - return -1; - *result = r; - return 0; -} - -PyObject * -PyObject_Type(PyObject *o) -{ - PyObject *v; - - if (o == NULL) - return null_error(); - v = (PyObject *)o->ob_type; - Py_INCREF(v); - return v; -} - -Py_ssize_t -PyObject_Size(PyObject *o) -{ - PySequenceMethods *m; - - if (o == NULL) { - null_error(); - return -1; - } - - m = o->ob_type->tp_as_sequence; - if (m && m->sq_length) - return m->sq_length(o); - - return PyMapping_Size(o); -} - -#undef PyObject_Length -Py_ssize_t -PyObject_Length(PyObject *o) -{ - return PyObject_Size(o); -} -#define PyObject_Length PyObject_Size - - -/* The length hint function returns a non-negative value from o.__len__() - or o.__length_hint__(). If those methods aren't found or return a negative - value, then the defaultvalue is returned. If one of the calls fails, - this function returns -1. -*/ - -Py_ssize_t -_PyObject_LengthHint(PyObject *o, Py_ssize_t defaultvalue) -{ - static PyObject *hintstrobj = NULL; - PyObject *ro, *hintmeth; - Py_ssize_t rv; - - /* try o.__len__() */ - rv = PyObject_Size(o); - if (rv >= 0) - return rv; - if (PyErr_Occurred()) { - if (!PyErr_ExceptionMatches(PyExc_TypeError) && - !PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - } - - if (PyInstance_Check(o)) - return defaultvalue; - /* try o.__length_hint__() */ - hintmeth = _PyObject_LookupSpecial(o, "__length_hint__", &hintstrobj); - if (hintmeth == NULL) { - if (PyErr_Occurred()) - return -1; - else - return defaultvalue; - } - ro = PyObject_CallFunctionObjArgs(hintmeth, NULL); - Py_DECREF(hintmeth); - if (ro == NULL) { - if (!PyErr_ExceptionMatches(PyExc_TypeError) && - !PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - return defaultvalue; - } - rv = PyNumber_Check(ro) ? PyInt_AsSsize_t(ro) : defaultvalue; - Py_DECREF(ro); - return rv; -} - -PyObject * -PyObject_GetItem(PyObject *o, PyObject *key) -{ - PyMappingMethods *m; - - if (o == NULL || key == NULL) - return null_error(); - - m = o->ob_type->tp_as_mapping; - if (m && m->mp_subscript) - return m->mp_subscript(o, key); - - if (o->ob_type->tp_as_sequence) { - if (PyIndex_Check(key)) { - Py_ssize_t key_value; - key_value = PyNumber_AsSsize_t(key, PyExc_IndexError); - if (key_value == -1 && PyErr_Occurred()) - return NULL; - return PySequence_GetItem(o, key_value); - } - else if (o->ob_type->tp_as_sequence->sq_item) - return type_error("sequence index must " - "be integer, not '%.200s'", key); - } - - return type_error("'%.200s' object has no attribute '__getitem__'", o); -} - -int -PyObject_SetItem(PyObject *o, PyObject *key, PyObject *value) -{ - PyMappingMethods *m; - - if (o == NULL || key == NULL || value == NULL) { - null_error(); - return -1; - } - m = o->ob_type->tp_as_mapping; - if (m && m->mp_ass_subscript) - return m->mp_ass_subscript(o, key, value); - - if (o->ob_type->tp_as_sequence) { - if (PyIndex_Check(key)) { - Py_ssize_t key_value; - key_value = PyNumber_AsSsize_t(key, PyExc_IndexError); - if (key_value == -1 && PyErr_Occurred()) - return -1; - return PySequence_SetItem(o, key_value, value); - } - else if (o->ob_type->tp_as_sequence->sq_ass_item) { - type_error("sequence index must be " - "integer, not '%.200s'", key); - return -1; - } - } - - type_error("'%.200s' object does not support item assignment", o); - return -1; -} - -int -PyObject_DelItem(PyObject *o, PyObject *key) -{ - PyMappingMethods *m; - - if (o == NULL || key == NULL) { - null_error(); - return -1; - } - m = o->ob_type->tp_as_mapping; - if (m && m->mp_ass_subscript) - return m->mp_ass_subscript(o, key, (PyObject*)NULL); - - if (o->ob_type->tp_as_sequence) { - if (PyIndex_Check(key)) { - Py_ssize_t key_value; - key_value = PyNumber_AsSsize_t(key, PyExc_IndexError); - if (key_value == -1 && PyErr_Occurred()) - return -1; - return PySequence_DelItem(o, key_value); - } - else if (o->ob_type->tp_as_sequence->sq_ass_item) { - type_error("sequence index must be " - "integer, not '%.200s'", key); - return -1; - } - } - - type_error("'%.200s' object does not support item deletion", o); - return -1; -} - -int -PyObject_DelItemString(PyObject *o, char *key) -{ - PyObject *okey; - int ret; - - if (o == NULL || key == NULL) { - null_error(); - return -1; - } - okey = PyString_FromString(key); - if (okey == NULL) - return -1; - ret = PyObject_DelItem(o, okey); - Py_DECREF(okey); - return ret; -} - -int -PyObject_AsCharBuffer(PyObject *obj, - const char **buffer, - Py_ssize_t *buffer_len) -{ - PyBufferProcs *pb; - char *pp; - Py_ssize_t len; - - if (obj == NULL || buffer == NULL || buffer_len == NULL) { - null_error(); - return -1; - } - pb = obj->ob_type->tp_as_buffer; - if (pb == NULL || - pb->bf_getcharbuffer == NULL || - pb->bf_getsegcount == NULL) { - PyErr_SetString(PyExc_TypeError, - "expected a character buffer object"); - return -1; - } - if ((*pb->bf_getsegcount)(obj,NULL) != 1) { - PyErr_SetString(PyExc_TypeError, - "expected a single-segment buffer object"); - return -1; - } - len = (*pb->bf_getcharbuffer)(obj, 0, &pp); - if (len < 0) - return -1; - *buffer = pp; - *buffer_len = len; - return 0; -} - -int -PyObject_CheckReadBuffer(PyObject *obj) -{ - PyBufferProcs *pb = obj->ob_type->tp_as_buffer; - - if (pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL || - (*pb->bf_getsegcount)(obj, NULL) != 1) - return 0; - return 1; -} - -int PyObject_AsReadBuffer(PyObject *obj, - const void **buffer, - Py_ssize_t *buffer_len) -{ - PyBufferProcs *pb; - void *pp; - Py_ssize_t len; - - if (obj == NULL || buffer == NULL || buffer_len == NULL) { - null_error(); - return -1; - } - pb = obj->ob_type->tp_as_buffer; - if (pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL) { - PyErr_SetString(PyExc_TypeError, - "expected a readable buffer object"); - return -1; - } - if ((*pb->bf_getsegcount)(obj, NULL) != 1) { - PyErr_SetString(PyExc_TypeError, - "expected a single-segment buffer object"); - return -1; - } - len = (*pb->bf_getreadbuffer)(obj, 0, &pp); - if (len < 0) - return -1; - *buffer = pp; - *buffer_len = len; - return 0; -} - -int PyObject_AsWriteBuffer(PyObject *obj, - void **buffer, - Py_ssize_t *buffer_len) -{ - PyBufferProcs *pb; - void*pp; - Py_ssize_t len; - - if (obj == NULL || buffer == NULL || buffer_len == NULL) { - null_error(); - return -1; - } - pb = obj->ob_type->tp_as_buffer; - if (pb == NULL || - pb->bf_getwritebuffer == NULL || - pb->bf_getsegcount == NULL) { - PyErr_SetString(PyExc_TypeError, - "expected a writeable buffer object"); - return -1; - } - if ((*pb->bf_getsegcount)(obj, NULL) != 1) { - PyErr_SetString(PyExc_TypeError, - "expected a single-segment buffer object"); - return -1; - } - len = (*pb->bf_getwritebuffer)(obj,0,&pp); - if (len < 0) - return -1; - *buffer = pp; - *buffer_len = len; - return 0; -} - -/* Buffer C-API for Python 3.0 */ - -int -PyObject_GetBuffer(PyObject *obj, Py_buffer *view, int flags) -{ - if (!PyObject_CheckBuffer(obj)) { - PyErr_Format(PyExc_TypeError, - "'%100s' does not have the buffer interface", - Py_TYPE(obj)->tp_name); - return -1; - } - return (*(obj->ob_type->tp_as_buffer->bf_getbuffer))(obj, view, flags); -} - -static int -_IsFortranContiguous(Py_buffer *view) -{ - Py_ssize_t sd, dim; - int i; - - if (view->ndim == 0) return 1; - if (view->strides == NULL) return (view->ndim == 1); - - sd = view->itemsize; - if (view->ndim == 1) return (view->shape[0] == 1 || - sd == view->strides[0]); - for (i=0; indim; i++) { - dim = view->shape[i]; - if (dim == 0) return 1; - if (view->strides[i] != sd) return 0; - sd *= dim; - } - return 1; -} - -static int -_IsCContiguous(Py_buffer *view) -{ - Py_ssize_t sd, dim; - int i; - - if (view->ndim == 0) return 1; - if (view->strides == NULL) return 1; - - sd = view->itemsize; - if (view->ndim == 1) return (view->shape[0] == 1 || - sd == view->strides[0]); - for (i=view->ndim-1; i>=0; i--) { - dim = view->shape[i]; - if (dim == 0) return 1; - if (view->strides[i] != sd) return 0; - sd *= dim; - } - return 1; -} - -int -PyBuffer_IsContiguous(Py_buffer *view, char fort) -{ - - if (view->suboffsets != NULL) return 0; - - if (fort == 'C') - return _IsCContiguous(view); - else if (fort == 'F') - return _IsFortranContiguous(view); - else if (fort == 'A') - return (_IsCContiguous(view) || _IsFortranContiguous(view)); - return 0; -} - - -void* -PyBuffer_GetPointer(Py_buffer *view, Py_ssize_t *indices) -{ - char* pointer; - int i; - pointer = (char *)view->buf; - for (i = 0; i < view->ndim; i++) { - pointer += view->strides[i]*indices[i]; - if ((view->suboffsets != NULL) && (view->suboffsets[i] >= 0)) { - pointer = *((char**)pointer) + view->suboffsets[i]; - } - } - return (void*)pointer; -} - - -void -_Py_add_one_to_index_F(int nd, Py_ssize_t *index, const Py_ssize_t *shape) -{ - int k; - - for (k=0; k=0; k--) { - if (index[k] < shape[k]-1) { - index[k]++; - break; - } - else { - index[k] = 0; - } - } -} - - /* view is not checked for consistency in either of these. It is - assumed that the size of the buffer is view->len in - view->len / view->itemsize elements. - */ - -int -PyBuffer_ToContiguous(void *buf, Py_buffer *view, Py_ssize_t len, char fort) -{ - int k; - void (*addone)(int, Py_ssize_t *, const Py_ssize_t *); - Py_ssize_t *indices, elements; - char *dest, *ptr; - - if (len > view->len) { - len = view->len; - } - - if (PyBuffer_IsContiguous(view, fort)) { - /* simplest copy is all that is needed */ - memcpy(buf, view->buf, len); - return 0; - } - - /* Otherwise a more elaborate scheme is needed */ - - /* view->ndim <= 64 */ - indices = (Py_ssize_t *)PyMem_Malloc(sizeof(Py_ssize_t)*(view->ndim)); - if (indices == NULL) { - PyErr_NoMemory(); - return -1; - } - for (k=0; kndim;k++) { - indices[k] = 0; - } - - if (fort == 'F') { - addone = _Py_add_one_to_index_F; - } - else { - addone = _Py_add_one_to_index_C; - } - dest = buf; - /* XXX : This is not going to be the fastest code in the world - several optimizations are possible. - */ - elements = len / view->itemsize; - while (elements--) { - ptr = PyBuffer_GetPointer(view, indices); - memcpy(dest, ptr, view->itemsize); - dest += view->itemsize; - addone(view->ndim, indices, view->shape); - } - PyMem_Free(indices); - return 0; -} - -int -PyBuffer_FromContiguous(Py_buffer *view, void *buf, Py_ssize_t len, char fort) -{ - int k; - void (*addone)(int, Py_ssize_t *, const Py_ssize_t *); - Py_ssize_t *indices, elements; - char *src, *ptr; - - if (len > view->len) { - len = view->len; - } - - if (PyBuffer_IsContiguous(view, fort)) { - /* simplest copy is all that is needed */ - memcpy(view->buf, buf, len); - return 0; - } - - /* Otherwise a more elaborate scheme is needed */ - - /* view->ndim <= 64 */ - indices = (Py_ssize_t *)PyMem_Malloc(sizeof(Py_ssize_t)*(view->ndim)); - if (indices == NULL) { - PyErr_NoMemory(); - return -1; - } - for (k=0; kndim;k++) { - indices[k] = 0; - } - - if (fort == 'F') { - addone = _Py_add_one_to_index_F; - } - else { - addone = _Py_add_one_to_index_C; - } - src = buf; - /* XXX : This is not going to be the fastest code in the world - several optimizations are possible. - */ - elements = len / view->itemsize; - while (elements--) { - ptr = PyBuffer_GetPointer(view, indices); - memcpy(ptr, src, view->itemsize); - src += view->itemsize; - addone(view->ndim, indices, view->shape); - } - - PyMem_Free(indices); - return 0; -} - -int PyObject_CopyData(PyObject *dest, PyObject *src) -{ - Py_buffer view_dest, view_src; - int k; - Py_ssize_t *indices, elements; - char *dptr, *sptr; - - if (!PyObject_CheckBuffer(dest) || - !PyObject_CheckBuffer(src)) { - PyErr_SetString(PyExc_TypeError, - "both destination and source must have the "\ - "buffer interface"); - return -1; - } - - if (PyObject_GetBuffer(dest, &view_dest, PyBUF_FULL) != 0) return -1; - if (PyObject_GetBuffer(src, &view_src, PyBUF_FULL_RO) != 0) { - PyBuffer_Release(&view_dest); - return -1; - } - - if (view_dest.len < view_src.len) { - PyErr_SetString(PyExc_BufferError, - "destination is too small to receive data from source"); - PyBuffer_Release(&view_dest); - PyBuffer_Release(&view_src); - return -1; - } - - if ((PyBuffer_IsContiguous(&view_dest, 'C') && - PyBuffer_IsContiguous(&view_src, 'C')) || - (PyBuffer_IsContiguous(&view_dest, 'F') && - PyBuffer_IsContiguous(&view_src, 'F'))) { - /* simplest copy is all that is needed */ - memcpy(view_dest.buf, view_src.buf, view_src.len); - PyBuffer_Release(&view_dest); - PyBuffer_Release(&view_src); - return 0; - } - - /* Otherwise a more elaborate copy scheme is needed */ - - /* XXX(nnorwitz): need to check for overflow! */ - indices = (Py_ssize_t *)PyMem_Malloc(sizeof(Py_ssize_t)*view_src.ndim); - if (indices == NULL) { - PyErr_NoMemory(); - PyBuffer_Release(&view_dest); - PyBuffer_Release(&view_src); - return -1; - } - for (k=0; k=0; k--) { - strides[k] = sd; - sd *= shape[k]; - } - } - return; -} - -int -PyBuffer_FillInfo(Py_buffer *view, PyObject *obj, void *buf, Py_ssize_t len, - int readonly, int flags) -{ - if (view == NULL) return 0; - if (((flags & PyBUF_WRITABLE) == PyBUF_WRITABLE) && - (readonly == 1)) { - PyErr_SetString(PyExc_BufferError, - "Object is not writable."); - return -1; - } - - view->obj = obj; - if (obj) - Py_INCREF(obj); - view->buf = buf; - view->len = len; - view->readonly = readonly; - view->itemsize = 1; - view->format = NULL; - if ((flags & PyBUF_FORMAT) == PyBUF_FORMAT) - view->format = "B"; - view->ndim = 1; - view->shape = NULL; - if ((flags & PyBUF_ND) == PyBUF_ND) - view->shape = &(view->len); - view->strides = NULL; - if ((flags & PyBUF_STRIDES) == PyBUF_STRIDES) - view->strides = &(view->itemsize); - view->suboffsets = NULL; - view->internal = NULL; - return 0; -} - -void -PyBuffer_Release(Py_buffer *view) -{ - PyObject *obj = view->obj; - if (obj && Py_TYPE(obj)->tp_as_buffer && Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer) - Py_TYPE(obj)->tp_as_buffer->bf_releasebuffer(obj, view); - Py_XDECREF(obj); - view->obj = NULL; -} - -PyObject * -PyObject_Format(PyObject* obj, PyObject *format_spec) -{ - PyObject *empty = NULL; - PyObject *result = NULL; -#ifdef Py_USING_UNICODE - int spec_is_unicode; - int result_is_unicode; -#endif - - /* If no format_spec is provided, use an empty string */ - if (format_spec == NULL) { - empty = PyString_FromStringAndSize(NULL, 0); - format_spec = empty; - } - - /* Check the format_spec type, and make sure it's str or unicode */ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(format_spec)) - spec_is_unicode = 1; - else if (PyString_Check(format_spec)) - spec_is_unicode = 0; - else { -#else - if (!PyString_Check(format_spec)) { -#endif - PyErr_Format(PyExc_TypeError, - "format expects arg 2 to be string " - "or unicode, not %.100s", Py_TYPE(format_spec)->tp_name); - goto done; - } - - /* Check for a __format__ method and call it. */ - if (PyInstance_Check(obj)) { - /* We're an instance of a classic class */ - PyObject *bound_method = PyObject_GetAttrString(obj, "__format__"); - if (bound_method != NULL) { - result = PyObject_CallFunctionObjArgs(bound_method, - format_spec, - NULL); - Py_DECREF(bound_method); - } else { - PyObject *self_as_str = NULL; - PyObject *format_method = NULL; - Py_ssize_t format_len; - - PyErr_Clear(); - /* Per the PEP, convert to str (or unicode, - depending on the type of the format - specifier). For new-style classes, this - logic is done by object.__format__(). */ -#ifdef Py_USING_UNICODE - if (spec_is_unicode) { - format_len = PyUnicode_GET_SIZE(format_spec); - self_as_str = PyObject_Unicode(obj); - } else -#endif - { - format_len = PyString_GET_SIZE(format_spec); - self_as_str = PyObject_Str(obj); - } - if (self_as_str == NULL) - goto done1; - - if (format_len > 0) { - /* See the almost identical code in - typeobject.c for new-style - classes. */ - if (PyErr_WarnEx( - PyExc_PendingDeprecationWarning, - "object.__format__ with a non-empty " - "format string is deprecated", 1) - < 0) { - goto done1; - } - /* Eventually this will become an - error: - PyErr_Format(PyExc_TypeError, - "non-empty format string passed to " - "object.__format__"); - goto done1; - */ - } - - /* Then call str.__format__ on that result */ - format_method = PyObject_GetAttrString(self_as_str, "__format__"); - if (format_method == NULL) { - goto done1; - } - result = PyObject_CallFunctionObjArgs(format_method, - format_spec, - NULL); -done1: - Py_XDECREF(self_as_str); - Py_XDECREF(format_method); - if (result == NULL) - goto done; - } - } else { - /* Not an instance of a classic class, use the code - from py3k */ - static PyObject *format_cache = NULL; - - /* Find the (unbound!) __format__ method (a borrowed - reference) */ - PyObject *method = _PyObject_LookupSpecial(obj, "__format__", - &format_cache); - if (method == NULL) { - if (!PyErr_Occurred()) - PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't define __format__", - Py_TYPE(obj)->tp_name); - goto done; - } - /* And call it. */ - result = PyObject_CallFunctionObjArgs(method, format_spec, NULL); - Py_DECREF(method); - } - - if (result == NULL) - goto done; - - /* Check the result type, and make sure it's str or unicode */ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(result)) - result_is_unicode = 1; - else if (PyString_Check(result)) - result_is_unicode = 0; - else { -#else - if (!PyString_Check(result)) { -#endif - PyErr_Format(PyExc_TypeError, - "%.100s.__format__ must return string or " - "unicode, not %.100s", Py_TYPE(obj)->tp_name, - Py_TYPE(result)->tp_name); - Py_DECREF(result); - result = NULL; - goto done; - } - - /* Convert to unicode, if needed. Required if spec is unicode - and result is str */ -#ifdef Py_USING_UNICODE - if (spec_is_unicode && !result_is_unicode) { - PyObject *tmp = PyObject_Unicode(result); - /* This logic works whether or not tmp is NULL */ - Py_DECREF(result); - result = tmp; - } -#endif - -done: - Py_XDECREF(empty); - return result; -} - -/* Operations on numbers */ - -int -PyNumber_Check(PyObject *o) -{ - return o && o->ob_type->tp_as_number && - (o->ob_type->tp_as_number->nb_int || - o->ob_type->tp_as_number->nb_float); -} - -/* Binary operators */ - -/* New style number protocol support */ - -#define NB_SLOT(x) offsetof(PyNumberMethods, x) -#define NB_BINOP(nb_methods, slot) \ - (*(binaryfunc*)(& ((char*)nb_methods)[slot])) -#define NB_TERNOP(nb_methods, slot) \ - (*(ternaryfunc*)(& ((char*)nb_methods)[slot])) - -/* - Calling scheme used for binary operations: - - v w Action - ------------------------------------------------------------------- - new new w.op(v,w)[*], v.op(v,w), w.op(v,w) - new old v.op(v,w), coerce(v,w), v.op(v,w) - old new w.op(v,w), coerce(v,w), v.op(v,w) - old old coerce(v,w), v.op(v,w) - - [*] only when v->ob_type != w->ob_type && w->ob_type is a subclass of - v->ob_type - - Legend: - ------- - * new == new style number - * old == old style number - * Action indicates the order in which operations are tried until either - a valid result is produced or an error occurs. - - */ - -static PyObject * -binary_op1(PyObject *v, PyObject *w, const int op_slot) -{ - PyObject *x; - binaryfunc slotv = NULL; - binaryfunc slotw = NULL; - - if (v->ob_type->tp_as_number != NULL && NEW_STYLE_NUMBER(v)) - slotv = NB_BINOP(v->ob_type->tp_as_number, op_slot); - if (w->ob_type != v->ob_type && - w->ob_type->tp_as_number != NULL && NEW_STYLE_NUMBER(w)) { - slotw = NB_BINOP(w->ob_type->tp_as_number, op_slot); - if (slotw == slotv) - slotw = NULL; - } - if (slotv) { - if (slotw && PyType_IsSubtype(w->ob_type, v->ob_type)) { - x = slotw(v, w); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - slotw = NULL; - } - x = slotv(v, w); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - } - if (slotw) { - x = slotw(v, w); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - } - if (!NEW_STYLE_NUMBER(v) || !NEW_STYLE_NUMBER(w)) { - int err = PyNumber_CoerceEx(&v, &w); - if (err < 0) { - return NULL; - } - if (err == 0) { - PyNumberMethods *mv = v->ob_type->tp_as_number; - if (mv) { - binaryfunc slot; - slot = NB_BINOP(mv, op_slot); - if (slot) { - x = slot(v, w); - Py_DECREF(v); - Py_DECREF(w); - return x; - } - } - /* CoerceEx incremented the reference counts */ - Py_DECREF(v); - Py_DECREF(w); - } - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static PyObject * -binop_type_error(PyObject *v, PyObject *w, const char *op_name) -{ - PyErr_Format(PyExc_TypeError, - "unsupported operand type(s) for %.100s: " - "'%.100s' and '%.100s'", - op_name, - v->ob_type->tp_name, - w->ob_type->tp_name); - return NULL; -} - -static PyObject * -binary_op(PyObject *v, PyObject *w, const int op_slot, const char *op_name) -{ - PyObject *result = binary_op1(v, w, op_slot); - if (result == Py_NotImplemented) { - Py_DECREF(result); - return binop_type_error(v, w, op_name); - } - return result; -} - - -/* - Calling scheme used for ternary operations: - - *** In some cases, w.op is called before v.op; see binary_op1. *** - - v w z Action - ------------------------------------------------------------------- - new new new v.op(v,w,z), w.op(v,w,z), z.op(v,w,z) - new old new v.op(v,w,z), z.op(v,w,z), coerce(v,w,z), v.op(v,w,z) - old new new w.op(v,w,z), z.op(v,w,z), coerce(v,w,z), v.op(v,w,z) - old old new z.op(v,w,z), coerce(v,w,z), v.op(v,w,z) - new new old v.op(v,w,z), w.op(v,w,z), coerce(v,w,z), v.op(v,w,z) - new old old v.op(v,w,z), coerce(v,w,z), v.op(v,w,z) - old new old w.op(v,w,z), coerce(v,w,z), v.op(v,w,z) - old old old coerce(v,w,z), v.op(v,w,z) - - Legend: - ------- - * new == new style number - * old == old style number - * Action indicates the order in which operations are tried until either - a valid result is produced or an error occurs. - * coerce(v,w,z) actually does: coerce(v,w), coerce(v,z), coerce(w,z) and - only if z != Py_None; if z == Py_None, then it is treated as absent - variable and only coerce(v,w) is tried. - - */ - -static PyObject * -ternary_op(PyObject *v, - PyObject *w, - PyObject *z, - const int op_slot, - const char *op_name) -{ - PyNumberMethods *mv, *mw, *mz; - PyObject *x = NULL; - ternaryfunc slotv = NULL; - ternaryfunc slotw = NULL; - ternaryfunc slotz = NULL; - - mv = v->ob_type->tp_as_number; - mw = w->ob_type->tp_as_number; - if (mv != NULL && NEW_STYLE_NUMBER(v)) - slotv = NB_TERNOP(mv, op_slot); - if (w->ob_type != v->ob_type && - mw != NULL && NEW_STYLE_NUMBER(w)) { - slotw = NB_TERNOP(mw, op_slot); - if (slotw == slotv) - slotw = NULL; - } - if (slotv) { - if (slotw && PyType_IsSubtype(w->ob_type, v->ob_type)) { - x = slotw(v, w, z); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - slotw = NULL; - } - x = slotv(v, w, z); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - } - if (slotw) { - x = slotw(v, w, z); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - } - mz = z->ob_type->tp_as_number; - if (mz != NULL && NEW_STYLE_NUMBER(z)) { - slotz = NB_TERNOP(mz, op_slot); - if (slotz == slotv || slotz == slotw) - slotz = NULL; - if (slotz) { - x = slotz(v, w, z); - if (x != Py_NotImplemented) - return x; - Py_DECREF(x); /* can't do it */ - } - } - - if (!NEW_STYLE_NUMBER(v) || !NEW_STYLE_NUMBER(w) || - (z != Py_None && !NEW_STYLE_NUMBER(z))) { - /* we have an old style operand, coerce */ - PyObject *v1, *z1, *w2, *z2; - int c; - - c = PyNumber_Coerce(&v, &w); - if (c != 0) - goto error3; - - /* Special case: if the third argument is None, it is - treated as absent argument and not coerced. */ - if (z == Py_None) { - if (v->ob_type->tp_as_number) { - slotz = NB_TERNOP(v->ob_type->tp_as_number, - op_slot); - if (slotz) - x = slotz(v, w, z); - else - c = -1; - } - else - c = -1; - goto error2; - } - v1 = v; - z1 = z; - c = PyNumber_Coerce(&v1, &z1); - if (c != 0) - goto error2; - w2 = w; - z2 = z1; - c = PyNumber_Coerce(&w2, &z2); - if (c != 0) - goto error1; - - if (v1->ob_type->tp_as_number != NULL) { - slotv = NB_TERNOP(v1->ob_type->tp_as_number, - op_slot); - if (slotv) - x = slotv(v1, w2, z2); - else - c = -1; - } - else - c = -1; - - Py_DECREF(w2); - Py_DECREF(z2); - error1: - Py_DECREF(v1); - Py_DECREF(z1); - error2: - Py_DECREF(v); - Py_DECREF(w); - error3: - if (c >= 0) - return x; - } - - if (z == Py_None) - PyErr_Format( - PyExc_TypeError, - "unsupported operand type(s) for ** or pow(): " - "'%.100s' and '%.100s'", - v->ob_type->tp_name, - w->ob_type->tp_name); - else - PyErr_Format( - PyExc_TypeError, - "unsupported operand type(s) for pow(): " - "'%.100s', '%.100s', '%.100s'", - v->ob_type->tp_name, - w->ob_type->tp_name, - z->ob_type->tp_name); - return NULL; -} - -#define BINARY_FUNC(func, op, op_name) \ - PyObject * \ - func(PyObject *v, PyObject *w) { \ - return binary_op(v, w, NB_SLOT(op), op_name); \ - } - -BINARY_FUNC(PyNumber_Or, nb_or, "|") -BINARY_FUNC(PyNumber_Xor, nb_xor, "^") -BINARY_FUNC(PyNumber_And, nb_and, "&") -BINARY_FUNC(PyNumber_Lshift, nb_lshift, "<<") -BINARY_FUNC(PyNumber_Rshift, nb_rshift, ">>") -BINARY_FUNC(PyNumber_Subtract, nb_subtract, "-") -BINARY_FUNC(PyNumber_Divide, nb_divide, "/") -BINARY_FUNC(PyNumber_Divmod, nb_divmod, "divmod()") - -PyObject * -PyNumber_Add(PyObject *v, PyObject *w) -{ - PyObject *result = binary_op1(v, w, NB_SLOT(nb_add)); - if (result == Py_NotImplemented) { - PySequenceMethods *m = v->ob_type->tp_as_sequence; - Py_DECREF(result); - if (m && m->sq_concat) { - return (*m->sq_concat)(v, w); - } - result = binop_type_error(v, w, "+"); - } - return result; -} - -static PyObject * -sequence_repeat(ssizeargfunc repeatfunc, PyObject *seq, PyObject *n) -{ - Py_ssize_t count; - if (PyIndex_Check(n)) { - count = PyNumber_AsSsize_t(n, PyExc_OverflowError); - if (count == -1 && PyErr_Occurred()) - return NULL; - } - else { - return type_error("can't multiply sequence by " - "non-int of type '%.200s'", n); - } - return (*repeatfunc)(seq, count); -} - -PyObject * -PyNumber_Multiply(PyObject *v, PyObject *w) -{ - PyObject *result = binary_op1(v, w, NB_SLOT(nb_multiply)); - if (result == Py_NotImplemented) { - PySequenceMethods *mv = v->ob_type->tp_as_sequence; - PySequenceMethods *mw = w->ob_type->tp_as_sequence; - Py_DECREF(result); - if (mv && mv->sq_repeat) { - return sequence_repeat(mv->sq_repeat, v, w); - } - else if (mw && mw->sq_repeat) { - return sequence_repeat(mw->sq_repeat, w, v); - } - result = binop_type_error(v, w, "*"); - } - return result; -} - -PyObject * -PyNumber_FloorDivide(PyObject *v, PyObject *w) -{ - /* XXX tp_flags test */ - return binary_op(v, w, NB_SLOT(nb_floor_divide), "//"); -} - -PyObject * -PyNumber_TrueDivide(PyObject *v, PyObject *w) -{ - /* XXX tp_flags test */ - return binary_op(v, w, NB_SLOT(nb_true_divide), "/"); -} - -PyObject * -PyNumber_Remainder(PyObject *v, PyObject *w) -{ - return binary_op(v, w, NB_SLOT(nb_remainder), "%"); -} - -PyObject * -PyNumber_Power(PyObject *v, PyObject *w, PyObject *z) -{ - return ternary_op(v, w, z, NB_SLOT(nb_power), "** or pow()"); -} - -/* Binary in-place operators */ - -/* The in-place operators are defined to fall back to the 'normal', - non in-place operations, if the in-place methods are not in place. - - - If the left hand object has the appropriate struct members, and - they are filled, call the appropriate function and return the - result. No coercion is done on the arguments; the left-hand object - is the one the operation is performed on, and it's up to the - function to deal with the right-hand object. - - - Otherwise, in-place modification is not supported. Handle it exactly as - a non in-place operation of the same kind. - - */ - -#define HASINPLACE(t) \ - PyType_HasFeature((t)->ob_type, Py_TPFLAGS_HAVE_INPLACEOPS) - -static PyObject * -binary_iop1(PyObject *v, PyObject *w, const int iop_slot, const int op_slot) -{ - PyNumberMethods *mv = v->ob_type->tp_as_number; - if (mv != NULL && HASINPLACE(v)) { - binaryfunc slot = NB_BINOP(mv, iop_slot); - if (slot) { - PyObject *x = (slot)(v, w); - if (x != Py_NotImplemented) { - return x; - } - Py_DECREF(x); - } - } - return binary_op1(v, w, op_slot); -} - -static PyObject * -binary_iop(PyObject *v, PyObject *w, const int iop_slot, const int op_slot, - const char *op_name) -{ - PyObject *result = binary_iop1(v, w, iop_slot, op_slot); - if (result == Py_NotImplemented) { - Py_DECREF(result); - return binop_type_error(v, w, op_name); - } - return result; -} - -#define INPLACE_BINOP(func, iop, op, op_name) \ - PyObject * \ - func(PyObject *v, PyObject *w) { \ - return binary_iop(v, w, NB_SLOT(iop), NB_SLOT(op), op_name); \ - } - -INPLACE_BINOP(PyNumber_InPlaceOr, nb_inplace_or, nb_or, "|=") -INPLACE_BINOP(PyNumber_InPlaceXor, nb_inplace_xor, nb_xor, "^=") -INPLACE_BINOP(PyNumber_InPlaceAnd, nb_inplace_and, nb_and, "&=") -INPLACE_BINOP(PyNumber_InPlaceLshift, nb_inplace_lshift, nb_lshift, "<<=") -INPLACE_BINOP(PyNumber_InPlaceRshift, nb_inplace_rshift, nb_rshift, ">>=") -INPLACE_BINOP(PyNumber_InPlaceSubtract, nb_inplace_subtract, nb_subtract, "-=") -INPLACE_BINOP(PyNumber_InPlaceDivide, nb_inplace_divide, nb_divide, "/=") - -PyObject * -PyNumber_InPlaceFloorDivide(PyObject *v, PyObject *w) -{ - /* XXX tp_flags test */ - return binary_iop(v, w, NB_SLOT(nb_inplace_floor_divide), - NB_SLOT(nb_floor_divide), "//="); -} - -PyObject * -PyNumber_InPlaceTrueDivide(PyObject *v, PyObject *w) -{ - /* XXX tp_flags test */ - return binary_iop(v, w, NB_SLOT(nb_inplace_true_divide), - NB_SLOT(nb_true_divide), "/="); -} - -PyObject * -PyNumber_InPlaceAdd(PyObject *v, PyObject *w) -{ - PyObject *result = binary_iop1(v, w, NB_SLOT(nb_inplace_add), - NB_SLOT(nb_add)); - if (result == Py_NotImplemented) { - PySequenceMethods *m = v->ob_type->tp_as_sequence; - Py_DECREF(result); - if (m != NULL) { - binaryfunc f = NULL; - if (HASINPLACE(v)) - f = m->sq_inplace_concat; - if (f == NULL) - f = m->sq_concat; - if (f != NULL) - return (*f)(v, w); - } - result = binop_type_error(v, w, "+="); - } - return result; -} - -PyObject * -PyNumber_InPlaceMultiply(PyObject *v, PyObject *w) -{ - PyObject *result = binary_iop1(v, w, NB_SLOT(nb_inplace_multiply), - NB_SLOT(nb_multiply)); - if (result == Py_NotImplemented) { - ssizeargfunc f = NULL; - PySequenceMethods *mv = v->ob_type->tp_as_sequence; - PySequenceMethods *mw = w->ob_type->tp_as_sequence; - Py_DECREF(result); - if (mv != NULL) { - if (HASINPLACE(v)) - f = mv->sq_inplace_repeat; - if (f == NULL) - f = mv->sq_repeat; - if (f != NULL) - return sequence_repeat(f, v, w); - } - else if (mw != NULL) { - /* Note that the right hand operand should not be - * mutated in this case so sq_inplace_repeat is not - * used. */ - if (mw->sq_repeat) - return sequence_repeat(mw->sq_repeat, w, v); - } - result = binop_type_error(v, w, "*="); - } - return result; -} - -PyObject * -PyNumber_InPlaceRemainder(PyObject *v, PyObject *w) -{ - return binary_iop(v, w, NB_SLOT(nb_inplace_remainder), - NB_SLOT(nb_remainder), "%="); -} - -PyObject * -PyNumber_InPlacePower(PyObject *v, PyObject *w, PyObject *z) -{ - if (HASINPLACE(v) && v->ob_type->tp_as_number && - v->ob_type->tp_as_number->nb_inplace_power != NULL) { - return ternary_op(v, w, z, NB_SLOT(nb_inplace_power), "**="); - } - else { - return ternary_op(v, w, z, NB_SLOT(nb_power), "**="); - } -} - - -/* Unary operators and functions */ - -PyObject * -PyNumber_Negative(PyObject *o) -{ - PyNumberMethods *m; - - if (o == NULL) - return null_error(); - m = o->ob_type->tp_as_number; - if (m && m->nb_negative) - return (*m->nb_negative)(o); - - return type_error("bad operand type for unary -: '%.200s'", o); -} - -PyObject * -PyNumber_Positive(PyObject *o) -{ - PyNumberMethods *m; - - if (o == NULL) - return null_error(); - m = o->ob_type->tp_as_number; - if (m && m->nb_positive) - return (*m->nb_positive)(o); - - return type_error("bad operand type for unary +: '%.200s'", o); -} - -PyObject * -PyNumber_Invert(PyObject *o) -{ - PyNumberMethods *m; - - if (o == NULL) - return null_error(); - m = o->ob_type->tp_as_number; - if (m && m->nb_invert) - return (*m->nb_invert)(o); - - return type_error("bad operand type for unary ~: '%.200s'", o); -} - -PyObject * -PyNumber_Absolute(PyObject *o) -{ - PyNumberMethods *m; - - if (o == NULL) - return null_error(); - m = o->ob_type->tp_as_number; - if (m && m->nb_absolute) - return m->nb_absolute(o); - - return type_error("bad operand type for abs(): '%.200s'", o); -} - -/* Add a check for embedded NULL-bytes in the argument. */ -static PyObject * -int_from_string(const char *s, Py_ssize_t len) -{ - char *end; - PyObject *x; - - x = PyInt_FromString((char*)s, &end, 10); - if (x == NULL) - return NULL; - if (end != s + len) { - PyErr_SetString(PyExc_ValueError, - "null byte in argument for int()"); - Py_DECREF(x); - return NULL; - } - return x; -} - -/* Return a Python Int or Long from the object item - Raise TypeError if the result is not an int-or-long - or if the object cannot be interpreted as an index. -*/ -PyObject * -PyNumber_Index(PyObject *item) -{ - PyObject *result = NULL; - if (item == NULL) - return null_error(); - if (PyInt_Check(item) || PyLong_Check(item)) { - Py_INCREF(item); - return item; - } - if (PyIndex_Check(item)) { - result = item->ob_type->tp_as_number->nb_index(item); - if (result && - !PyInt_Check(result) && !PyLong_Check(result)) { - PyErr_Format(PyExc_TypeError, - "__index__ returned non-(int,long) " \ - "(type %.200s)", - result->ob_type->tp_name); - Py_DECREF(result); - return NULL; - } - } - else { - PyErr_Format(PyExc_TypeError, - "'%.200s' object cannot be interpreted " - "as an index", item->ob_type->tp_name); - } - return result; -} - -/* Return an error on Overflow only if err is not NULL*/ - -Py_ssize_t -PyNumber_AsSsize_t(PyObject *item, PyObject *err) -{ - Py_ssize_t result; - PyObject *runerr; - PyObject *value = PyNumber_Index(item); - if (value == NULL) - return -1; - - /* We're done if PyInt_AsSsize_t() returns without error. */ - result = PyInt_AsSsize_t(value); - if (result != -1 || !(runerr = PyErr_Occurred())) - goto finish; - - /* Error handling code -- only manage OverflowError differently */ - if (!PyErr_GivenExceptionMatches(runerr, PyExc_OverflowError)) - goto finish; - - PyErr_Clear(); - /* If no error-handling desired then the default clipping - is sufficient. - */ - if (!err) { - assert(PyLong_Check(value)); - /* Whether or not it is less than or equal to - zero is determined by the sign of ob_size - */ - if (_PyLong_Sign(value) < 0) - result = PY_SSIZE_T_MIN; - else - result = PY_SSIZE_T_MAX; - } - else { - /* Otherwise replace the error with caller's error object. */ - PyErr_Format(err, - "cannot fit '%.200s' into an index-sized integer", - item->ob_type->tp_name); - } - - finish: - Py_DECREF(value); - return result; -} - - -PyObject * -_PyNumber_ConvertIntegralToInt(PyObject *integral, const char* error_format) -{ - const char *type_name; - static PyObject *int_name = NULL; - if (int_name == NULL) { - int_name = PyString_InternFromString("__int__"); - if (int_name == NULL) - return NULL; - } - - if (integral && (!PyInt_Check(integral) && - !PyLong_Check(integral))) { - /* Don't go through tp_as_number->nb_int to avoid - hitting the classic class fallback to __trunc__. */ - PyObject *int_func = PyObject_GetAttr(integral, int_name); - if (int_func == NULL) { - PyErr_Clear(); /* Raise a different error. */ - goto non_integral_error; - } - Py_DECREF(integral); - integral = PyEval_CallObject(int_func, NULL); - Py_DECREF(int_func); - if (integral && (!PyInt_Check(integral) && - !PyLong_Check(integral))) { - goto non_integral_error; - } - } - return integral; - -non_integral_error: - if (PyInstance_Check(integral)) { - type_name = PyString_AS_STRING(((PyInstanceObject *)integral) - ->in_class->cl_name); - } - else { - type_name = integral->ob_type->tp_name; - } - PyErr_Format(PyExc_TypeError, error_format, type_name); - Py_DECREF(integral); - return NULL; -} - - -PyObject * -PyNumber_Int(PyObject *o) -{ - PyNumberMethods *m; - static PyObject *trunc_name = NULL; - PyObject *trunc_func; - const char *buffer; - Py_ssize_t buffer_len; - - if (trunc_name == NULL) { - trunc_name = PyString_InternFromString("__trunc__"); - if (trunc_name == NULL) - return NULL; - } - - if (o == NULL) - return null_error(); - if (PyInt_CheckExact(o)) { - Py_INCREF(o); - return o; - } - m = o->ob_type->tp_as_number; - if (m && m->nb_int) { /* This should include subclasses of int */ - /* Classic classes always take this branch. */ - PyObject *res = m->nb_int(o); - if (res && (!PyInt_Check(res) && !PyLong_Check(res))) { - PyErr_Format(PyExc_TypeError, - "__int__ returned non-int (type %.200s)", - res->ob_type->tp_name); - Py_DECREF(res); - return NULL; - } - return res; - } - if (PyInt_Check(o)) { /* A int subclass without nb_int */ - PyIntObject *io = (PyIntObject*)o; - return PyInt_FromLong(io->ob_ival); - } - trunc_func = PyObject_GetAttr(o, trunc_name); - if (trunc_func) { - PyObject *truncated = PyEval_CallObject(trunc_func, NULL); - Py_DECREF(trunc_func); - /* __trunc__ is specified to return an Integral type, but - int() needs to return an int. */ - return _PyNumber_ConvertIntegralToInt( - truncated, - "__trunc__ returned non-Integral (type %.200s)"); - } - PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - - if (PyString_Check(o)) - return int_from_string(PyString_AS_STRING(o), - PyString_GET_SIZE(o)); -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(o)) - return PyInt_FromUnicode(PyUnicode_AS_UNICODE(o), - PyUnicode_GET_SIZE(o), - 10); -#endif - if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len)) - return int_from_string((char*)buffer, buffer_len); - - return type_error("int() argument must be a string or a " - "number, not '%.200s'", o); -} - -/* Add a check for embedded NULL-bytes in the argument. */ -static PyObject * -long_from_string(const char *s, Py_ssize_t len) -{ - char *end; - PyObject *x; - - x = PyLong_FromString((char*)s, &end, 10); - if (x == NULL) - return NULL; - if (end != s + len) { - PyErr_SetString(PyExc_ValueError, - "null byte in argument for long()"); - Py_DECREF(x); - return NULL; - } - return x; -} - -PyObject * -PyNumber_Long(PyObject *o) -{ - PyNumberMethods *m; - static PyObject *trunc_name = NULL; - PyObject *trunc_func; - const char *buffer; - Py_ssize_t buffer_len; - - if (trunc_name == NULL) { - trunc_name = PyString_InternFromString("__trunc__"); - if (trunc_name == NULL) - return NULL; - } - - if (o == NULL) - return null_error(); - m = o->ob_type->tp_as_number; - if (m && m->nb_long) { /* This should include subclasses of long */ - /* Classic classes always take this branch. */ - PyObject *res = m->nb_long(o); - if (res == NULL) - return NULL; - if (PyInt_Check(res)) { - long value = PyInt_AS_LONG(res); - Py_DECREF(res); - return PyLong_FromLong(value); - } - else if (!PyLong_Check(res)) { - PyErr_Format(PyExc_TypeError, - "__long__ returned non-long (type %.200s)", - res->ob_type->tp_name); - Py_DECREF(res); - return NULL; - } - return res; - } - if (PyLong_Check(o)) /* A long subclass without nb_long */ - return _PyLong_Copy((PyLongObject *)o); - trunc_func = PyObject_GetAttr(o, trunc_name); - if (trunc_func) { - PyObject *truncated = PyEval_CallObject(trunc_func, NULL); - PyObject *int_instance; - Py_DECREF(trunc_func); - /* __trunc__ is specified to return an Integral type, - but long() needs to return a long. */ - int_instance = _PyNumber_ConvertIntegralToInt( - truncated, - "__trunc__ returned non-Integral (type %.200s)"); - if (int_instance && PyInt_Check(int_instance)) { - /* Make sure that long() returns a long instance. */ - long value = PyInt_AS_LONG(int_instance); - Py_DECREF(int_instance); - return PyLong_FromLong(value); - } - return int_instance; - } - PyErr_Clear(); /* It's not an error if o.__trunc__ doesn't exist. */ - - if (PyString_Check(o)) - /* need to do extra error checking that PyLong_FromString() - * doesn't do. In particular long('9.5') must raise an - * exception, not truncate the float. - */ - return long_from_string(PyString_AS_STRING(o), - PyString_GET_SIZE(o)); -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(o)) - /* The above check is done in PyLong_FromUnicode(). */ - return PyLong_FromUnicode(PyUnicode_AS_UNICODE(o), - PyUnicode_GET_SIZE(o), - 10); -#endif - if (!PyObject_AsCharBuffer(o, &buffer, &buffer_len)) - return long_from_string(buffer, buffer_len); - - return type_error("long() argument must be a string or a " - "number, not '%.200s'", o); -} - -PyObject * -PyNumber_Float(PyObject *o) -{ - PyNumberMethods *m; - - if (o == NULL) - return null_error(); - m = o->ob_type->tp_as_number; - if (m && m->nb_float) { /* This should include subclasses of float */ - PyObject *res = m->nb_float(o); - if (res && !PyFloat_Check(res)) { - PyErr_Format(PyExc_TypeError, - "__float__ returned non-float (type %.200s)", - res->ob_type->tp_name); - Py_DECREF(res); - return NULL; - } - return res; - } - if (PyFloat_Check(o)) { /* A float subclass with nb_float == NULL */ - PyFloatObject *po = (PyFloatObject *)o; - return PyFloat_FromDouble(po->ob_fval); - } - return PyFloat_FromString(o, NULL); -} - -PyObject * -PyNumber_ToBase(PyObject *n, int base) -{ - PyObject *res = NULL; - PyObject *index = PyNumber_Index(n); - - if (!index) - return NULL; - if (PyLong_Check(index)) - res = _PyLong_Format(index, base, 0, 1); - else if (PyInt_Check(index)) - res = _PyInt_Format((PyIntObject*)index, base, 1); - else - /* It should not be possible to get here, as - PyNumber_Index already has a check for the same - condition */ - PyErr_SetString(PyExc_ValueError, "PyNumber_ToBase: index not " - "int or long"); - Py_DECREF(index); - return res; -} - - -/* Operations on sequences */ - -int -PySequence_Check(PyObject *s) -{ - if (s == NULL) - return 0; - if (PyInstance_Check(s)) - return PyObject_HasAttrString(s, "__getitem__"); - if (PyDict_Check(s)) - return 0; - return s->ob_type->tp_as_sequence && - s->ob_type->tp_as_sequence->sq_item != NULL; -} - -Py_ssize_t -PySequence_Size(PyObject *s) -{ - PySequenceMethods *m; - - if (s == NULL) { - null_error(); - return -1; - } - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_length) - return m->sq_length(s); - - type_error("object of type '%.200s' has no len()", s); - return -1; -} - -#undef PySequence_Length -Py_ssize_t -PySequence_Length(PyObject *s) -{ - return PySequence_Size(s); -} -#define PySequence_Length PySequence_Size - -PyObject * -PySequence_Concat(PyObject *s, PyObject *o) -{ - PySequenceMethods *m; - - if (s == NULL || o == NULL) - return null_error(); - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_concat) - return m->sq_concat(s, o); - - /* Instances of user classes defining an __add__() method only - have an nb_add slot, not an sq_concat slot. So we fall back - to nb_add if both arguments appear to be sequences. */ - if (PySequence_Check(s) && PySequence_Check(o)) { - PyObject *result = binary_op1(s, o, NB_SLOT(nb_add)); - if (result != Py_NotImplemented) - return result; - Py_DECREF(result); - } - return type_error("'%.200s' object can't be concatenated", s); -} - -PyObject * -PySequence_Repeat(PyObject *o, Py_ssize_t count) -{ - PySequenceMethods *m; - - if (o == NULL) - return null_error(); - - m = o->ob_type->tp_as_sequence; - if (m && m->sq_repeat) - return m->sq_repeat(o, count); - - /* Instances of user classes defining a __mul__() method only - have an nb_multiply slot, not an sq_repeat slot. so we fall back - to nb_multiply if o appears to be a sequence. */ - if (PySequence_Check(o)) { - PyObject *n, *result; - n = PyInt_FromSsize_t(count); - if (n == NULL) - return NULL; - result = binary_op1(o, n, NB_SLOT(nb_multiply)); - Py_DECREF(n); - if (result != Py_NotImplemented) - return result; - Py_DECREF(result); - } - return type_error("'%.200s' object can't be repeated", o); -} - -PyObject * -PySequence_InPlaceConcat(PyObject *s, PyObject *o) -{ - PySequenceMethods *m; - - if (s == NULL || o == NULL) - return null_error(); - - m = s->ob_type->tp_as_sequence; - if (m && HASINPLACE(s) && m->sq_inplace_concat) - return m->sq_inplace_concat(s, o); - if (m && m->sq_concat) - return m->sq_concat(s, o); - - if (PySequence_Check(s) && PySequence_Check(o)) { - PyObject *result = binary_iop1(s, o, NB_SLOT(nb_inplace_add), - NB_SLOT(nb_add)); - if (result != Py_NotImplemented) - return result; - Py_DECREF(result); - } - return type_error("'%.200s' object can't be concatenated", s); -} - -PyObject * -PySequence_InPlaceRepeat(PyObject *o, Py_ssize_t count) -{ - PySequenceMethods *m; - - if (o == NULL) - return null_error(); - - m = o->ob_type->tp_as_sequence; - if (m && HASINPLACE(o) && m->sq_inplace_repeat) - return m->sq_inplace_repeat(o, count); - if (m && m->sq_repeat) - return m->sq_repeat(o, count); - - if (PySequence_Check(o)) { - PyObject *n, *result; - n = PyInt_FromSsize_t(count); - if (n == NULL) - return NULL; - result = binary_iop1(o, n, NB_SLOT(nb_inplace_multiply), - NB_SLOT(nb_multiply)); - Py_DECREF(n); - if (result != Py_NotImplemented) - return result; - Py_DECREF(result); - } - return type_error("'%.200s' object can't be repeated", o); -} - -PyObject * -PySequence_GetItem(PyObject *s, Py_ssize_t i) -{ - PySequenceMethods *m; - - if (s == NULL) - return null_error(); - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_item) { - if (i < 0) { - if (m->sq_length) { - Py_ssize_t l = (*m->sq_length)(s); - if (l < 0) - return NULL; - i += l; - } - } - return m->sq_item(s, i); - } - - return type_error("'%.200s' object does not support indexing", s); -} - -PyObject * -PySequence_GetSlice(PyObject *s, Py_ssize_t i1, Py_ssize_t i2) -{ - PySequenceMethods *m; - PyMappingMethods *mp; - - if (!s) return null_error(); - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_slice) { - if (i1 < 0 || i2 < 0) { - if (m->sq_length) { - Py_ssize_t l = (*m->sq_length)(s); - if (l < 0) - return NULL; - if (i1 < 0) - i1 += l; - if (i2 < 0) - i2 += l; - } - } - return m->sq_slice(s, i1, i2); - } else if ((mp = s->ob_type->tp_as_mapping) && mp->mp_subscript) { - PyObject *res; - PyObject *slice = _PySlice_FromIndices(i1, i2); - if (!slice) - return NULL; - res = mp->mp_subscript(s, slice); - Py_DECREF(slice); - return res; - } - - return type_error("'%.200s' object is unsliceable", s); -} - -int -PySequence_SetItem(PyObject *s, Py_ssize_t i, PyObject *o) -{ - PySequenceMethods *m; - - if (s == NULL) { - null_error(); - return -1; - } - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_ass_item) { - if (i < 0) { - if (m->sq_length) { - Py_ssize_t l = (*m->sq_length)(s); - if (l < 0) - return -1; - i += l; - } - } - return m->sq_ass_item(s, i, o); - } - - type_error("'%.200s' object does not support item assignment", s); - return -1; -} - -int -PySequence_DelItem(PyObject *s, Py_ssize_t i) -{ - PySequenceMethods *m; - - if (s == NULL) { - null_error(); - return -1; - } - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_ass_item) { - if (i < 0) { - if (m->sq_length) { - Py_ssize_t l = (*m->sq_length)(s); - if (l < 0) - return -1; - i += l; - } - } - return m->sq_ass_item(s, i, (PyObject *)NULL); - } - - type_error("'%.200s' object doesn't support item deletion", s); - return -1; -} - -int -PySequence_SetSlice(PyObject *s, Py_ssize_t i1, Py_ssize_t i2, PyObject *o) -{ - PySequenceMethods *m; - PyMappingMethods *mp; - - if (s == NULL) { - null_error(); - return -1; - } - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_ass_slice) { - if (i1 < 0 || i2 < 0) { - if (m->sq_length) { - Py_ssize_t l = (*m->sq_length)(s); - if (l < 0) - return -1; - if (i1 < 0) - i1 += l; - if (i2 < 0) - i2 += l; - } - } - return m->sq_ass_slice(s, i1, i2, o); - } else if ((mp = s->ob_type->tp_as_mapping) && mp->mp_ass_subscript) { - int res; - PyObject *slice = _PySlice_FromIndices(i1, i2); - if (!slice) - return -1; - res = mp->mp_ass_subscript(s, slice, o); - Py_DECREF(slice); - return res; - } - - type_error("'%.200s' object doesn't support slice assignment", s); - return -1; -} - -int -PySequence_DelSlice(PyObject *s, Py_ssize_t i1, Py_ssize_t i2) -{ - PySequenceMethods *m; - - if (s == NULL) { - null_error(); - return -1; - } - - m = s->ob_type->tp_as_sequence; - if (m && m->sq_ass_slice) { - if (i1 < 0 || i2 < 0) { - if (m->sq_length) { - Py_ssize_t l = (*m->sq_length)(s); - if (l < 0) - return -1; - if (i1 < 0) - i1 += l; - if (i2 < 0) - i2 += l; - } - } - return m->sq_ass_slice(s, i1, i2, (PyObject *)NULL); - } - type_error("'%.200s' object doesn't support slice deletion", s); - return -1; -} - -PyObject * -PySequence_Tuple(PyObject *v) -{ - PyObject *it; /* iter(v) */ - Py_ssize_t n; /* guess for result tuple size */ - PyObject *result = NULL; - Py_ssize_t j; - - if (v == NULL) - return null_error(); - - /* Special-case the common tuple and list cases, for efficiency. */ - if (PyTuple_CheckExact(v)) { - /* Note that we can't know whether it's safe to return - a tuple *subclass* instance as-is, hence the restriction - to exact tuples here. In contrast, lists always make - a copy, so there's no need for exactness below. */ - Py_INCREF(v); - return v; - } - if (PyList_Check(v)) - return PyList_AsTuple(v); - - /* Get iterator. */ - it = PyObject_GetIter(v); - if (it == NULL) - return NULL; - - /* Guess result size and allocate space. */ - n = _PyObject_LengthHint(v, 10); - if (n == -1) - goto Fail; - result = PyTuple_New(n); - if (result == NULL) - goto Fail; - - /* Fill the tuple. */ - for (j = 0; ; ++j) { - PyObject *item = PyIter_Next(it); - if (item == NULL) { - if (PyErr_Occurred()) - goto Fail; - break; - } - if (j >= n) { - Py_ssize_t oldn = n; - /* The over-allocation strategy can grow a bit faster - than for lists because unlike lists the - over-allocation isn't permanent -- we reclaim - the excess before the end of this routine. - So, grow by ten and then add 25%. - */ - n += 10; - n += n >> 2; - if (n < oldn) { - /* Check for overflow */ - PyErr_NoMemory(); - Py_DECREF(item); - goto Fail; - } - if (_PyTuple_Resize(&result, n) != 0) { - Py_DECREF(item); - goto Fail; - } - } - PyTuple_SET_ITEM(result, j, item); - } - - /* Cut tuple back if guess was too large. */ - if (j < n && - _PyTuple_Resize(&result, j) != 0) - goto Fail; - - Py_DECREF(it); - return result; - -Fail: - Py_XDECREF(result); - Py_DECREF(it); - return NULL; -} - -PyObject * -PySequence_List(PyObject *v) -{ - PyObject *result; /* result list */ - PyObject *rv; /* return value from PyList_Extend */ - - if (v == NULL) - return null_error(); - - result = PyList_New(0); - if (result == NULL) - return NULL; - - rv = _PyList_Extend((PyListObject *)result, v); - if (rv == NULL) { - Py_DECREF(result); - return NULL; - } - Py_DECREF(rv); - return result; -} - -PyObject * -PySequence_Fast(PyObject *v, const char *m) -{ - PyObject *it; - - if (v == NULL) - return null_error(); - - if (PyList_CheckExact(v) || PyTuple_CheckExact(v)) { - Py_INCREF(v); - return v; - } - - it = PyObject_GetIter(v); - if (it == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_SetString(PyExc_TypeError, m); - return NULL; - } - - v = PySequence_List(it); - Py_DECREF(it); - - return v; -} - -/* Iterate over seq. Result depends on the operation: - PY_ITERSEARCH_COUNT: -1 if error, else # of times obj appears in seq. - PY_ITERSEARCH_INDEX: 0-based index of first occurrence of obj in seq; - set ValueError and return -1 if none found; also return -1 on error. - Py_ITERSEARCH_CONTAINS: return 1 if obj in seq, else 0; -1 on error. -*/ -Py_ssize_t -_PySequence_IterSearch(PyObject *seq, PyObject *obj, int operation) -{ - Py_ssize_t n; - int wrapped; /* for PY_ITERSEARCH_INDEX, true iff n wrapped around */ - PyObject *it; /* iter(seq) */ - - if (seq == NULL || obj == NULL) { - null_error(); - return -1; - } - - it = PyObject_GetIter(seq); - if (it == NULL) { - type_error("argument of type '%.200s' is not iterable", seq); - return -1; - } - - n = wrapped = 0; - for (;;) { - int cmp; - PyObject *item = PyIter_Next(it); - if (item == NULL) { - if (PyErr_Occurred()) - goto Fail; - break; - } - - cmp = PyObject_RichCompareBool(obj, item, Py_EQ); - Py_DECREF(item); - if (cmp < 0) - goto Fail; - if (cmp > 0) { - switch (operation) { - case PY_ITERSEARCH_COUNT: - if (n == PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "count exceeds C integer size"); - goto Fail; - } - ++n; - break; - - case PY_ITERSEARCH_INDEX: - if (wrapped) { - PyErr_SetString(PyExc_OverflowError, - "index exceeds C integer size"); - goto Fail; - } - goto Done; - - case PY_ITERSEARCH_CONTAINS: - n = 1; - goto Done; - - default: - assert(!"unknown operation"); - } - } - - if (operation == PY_ITERSEARCH_INDEX) { - if (n == PY_SSIZE_T_MAX) - wrapped = 1; - ++n; - } - } - - if (operation != PY_ITERSEARCH_INDEX) - goto Done; - - PyErr_SetString(PyExc_ValueError, - "sequence.index(x): x not in sequence"); - /* fall into failure code */ -Fail: - n = -1; - /* fall through */ -Done: - Py_DECREF(it); - return n; - -} - -/* Return # of times o appears in s. */ -Py_ssize_t -PySequence_Count(PyObject *s, PyObject *o) -{ - return _PySequence_IterSearch(s, o, PY_ITERSEARCH_COUNT); -} - -/* Return -1 if error; 1 if ob in seq; 0 if ob not in seq. - * Use sq_contains if possible, else defer to _PySequence_IterSearch(). - */ -int -PySequence_Contains(PyObject *seq, PyObject *ob) -{ - Py_ssize_t result; - if (PyType_HasFeature(seq->ob_type, Py_TPFLAGS_HAVE_SEQUENCE_IN)) { - PySequenceMethods *sqm = seq->ob_type->tp_as_sequence; - if (sqm != NULL && sqm->sq_contains != NULL) - return (*sqm->sq_contains)(seq, ob); - } - result = _PySequence_IterSearch(seq, ob, PY_ITERSEARCH_CONTAINS); - return Py_SAFE_DOWNCAST(result, Py_ssize_t, int); -} - -/* Backwards compatibility */ -#undef PySequence_In -int -PySequence_In(PyObject *w, PyObject *v) -{ - return PySequence_Contains(w, v); -} - -Py_ssize_t -PySequence_Index(PyObject *s, PyObject *o) -{ - return _PySequence_IterSearch(s, o, PY_ITERSEARCH_INDEX); -} - -/* Operations on mappings */ - -int -PyMapping_Check(PyObject *o) -{ - if (o && PyInstance_Check(o)) - return PyObject_HasAttrString(o, "__getitem__"); - - return o && o->ob_type->tp_as_mapping && - o->ob_type->tp_as_mapping->mp_subscript && - !(o->ob_type->tp_as_sequence && - o->ob_type->tp_as_sequence->sq_slice); -} - -Py_ssize_t -PyMapping_Size(PyObject *o) -{ - PyMappingMethods *m; - - if (o == NULL) { - null_error(); - return -1; - } - - m = o->ob_type->tp_as_mapping; - if (m && m->mp_length) - return m->mp_length(o); - - type_error("object of type '%.200s' has no len()", o); - return -1; -} - -#undef PyMapping_Length -Py_ssize_t -PyMapping_Length(PyObject *o) -{ - return PyMapping_Size(o); -} -#define PyMapping_Length PyMapping_Size - -PyObject * -PyMapping_GetItemString(PyObject *o, char *key) -{ - PyObject *okey, *r; - - if (key == NULL) - return null_error(); - - okey = PyString_FromString(key); - if (okey == NULL) - return NULL; - r = PyObject_GetItem(o, okey); - Py_DECREF(okey); - return r; -} - -int -PyMapping_SetItemString(PyObject *o, char *key, PyObject *value) -{ - PyObject *okey; - int r; - - if (key == NULL) { - null_error(); - return -1; - } - - okey = PyString_FromString(key); - if (okey == NULL) - return -1; - r = PyObject_SetItem(o, okey, value); - Py_DECREF(okey); - return r; -} - -int -PyMapping_HasKeyString(PyObject *o, char *key) -{ - PyObject *v; - - v = PyMapping_GetItemString(o, key); - if (v) { - Py_DECREF(v); - return 1; - } - PyErr_Clear(); - return 0; -} - -int -PyMapping_HasKey(PyObject *o, PyObject *key) -{ - PyObject *v; - - v = PyObject_GetItem(o, key); - if (v) { - Py_DECREF(v); - return 1; - } - PyErr_Clear(); - return 0; -} - -/* Operations on callable objects */ - -/* XXX PyCallable_Check() is in object.c */ - -PyObject * -PyObject_CallObject(PyObject *o, PyObject *a) -{ - return PyEval_CallObjectWithKeywords(o, a, NULL); -} - -PyObject * -PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) -{ - ternaryfunc call; - - if ((call = func->ob_type->tp_call) != NULL) { - PyObject *result; - if (Py_EnterRecursiveCall(" while calling a Python object")) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (result == NULL && !PyErr_Occurred()) - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - return result; - } - PyErr_Format(PyExc_TypeError, "'%.200s' object is not callable", - func->ob_type->tp_name); - return NULL; -} - -static PyObject* -call_function_tail(PyObject *callable, PyObject *args) -{ - PyObject *retval; - - if (args == NULL) - return NULL; - - if (!PyTuple_Check(args)) { - PyObject *a; - - a = PyTuple_New(1); - if (a == NULL) { - Py_DECREF(args); - return NULL; - } - PyTuple_SET_ITEM(a, 0, args); - args = a; - } - retval = PyObject_Call(callable, args, NULL); - - Py_DECREF(args); - - return retval; -} - -PyObject * -PyObject_CallFunction(PyObject *callable, char *format, ...) -{ - va_list va; - PyObject *args; - - if (callable == NULL) - return null_error(); - - if (format && *format) { - va_start(va, format); - args = Py_VaBuildValue(format, va); - va_end(va); - } - else - args = PyTuple_New(0); - - return call_function_tail(callable, args); -} - -PyObject * -_PyObject_CallFunction_SizeT(PyObject *callable, char *format, ...) -{ - va_list va; - PyObject *args; - - if (callable == NULL) - return null_error(); - - if (format && *format) { - va_start(va, format); - args = _Py_VaBuildValue_SizeT(format, va); - va_end(va); - } - else - args = PyTuple_New(0); - - return call_function_tail(callable, args); -} - -PyObject * -PyObject_CallMethod(PyObject *o, char *name, char *format, ...) -{ - va_list va; - PyObject *args; - PyObject *func = NULL; - PyObject *retval = NULL; - - if (o == NULL || name == NULL) - return null_error(); - - func = PyObject_GetAttrString(o, name); - if (func == NULL) - return NULL; - - if (!PyCallable_Check(func)) { - type_error("attribute of type '%.200s' is not callable", func); - goto exit; - } - - if (format && *format) { - va_start(va, format); - args = Py_VaBuildValue(format, va); - va_end(va); - } - else - args = PyTuple_New(0); - - retval = call_function_tail(func, args); - - exit: - /* args gets consumed in call_function_tail */ - Py_XDECREF(func); - - return retval; -} - -PyObject * -_PyObject_CallMethod_SizeT(PyObject *o, char *name, char *format, ...) -{ - va_list va; - PyObject *args; - PyObject *func = NULL; - PyObject *retval = NULL; - - if (o == NULL || name == NULL) - return null_error(); - - func = PyObject_GetAttrString(o, name); - if (func == NULL) - return NULL; - - if (!PyCallable_Check(func)) { - type_error("attribute of type '%.200s' is not callable", func); - goto exit; - } - - if (format && *format) { - va_start(va, format); - args = _Py_VaBuildValue_SizeT(format, va); - va_end(va); - } - else - args = PyTuple_New(0); - - retval = call_function_tail(func, args); - - exit: - /* args gets consumed in call_function_tail */ - Py_XDECREF(func); - - return retval; -} - - -static PyObject * -objargs_mktuple(va_list va) -{ - int i, n = 0; - va_list countva; - PyObject *result, *tmp; - -#ifdef VA_LIST_IS_ARRAY - memcpy(countva, va, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(countva, va); -#else - countva = va; -#endif -#endif - - while (((PyObject *)va_arg(countva, PyObject *)) != NULL) - ++n; - result = PyTuple_New(n); - if (result != NULL && n > 0) { - for (i = 0; i < n; ++i) { - tmp = (PyObject *)va_arg(va, PyObject *); - PyTuple_SET_ITEM(result, i, tmp); - Py_INCREF(tmp); - } - } - return result; -} - -PyObject * -PyObject_CallMethodObjArgs(PyObject *callable, PyObject *name, ...) -{ - PyObject *args, *tmp; - va_list vargs; - - if (callable == NULL || name == NULL) - return null_error(); - - callable = PyObject_GetAttr(callable, name); - if (callable == NULL) - return NULL; - - /* count the args */ - va_start(vargs, name); - args = objargs_mktuple(vargs); - va_end(vargs); - if (args == NULL) { - Py_DECREF(callable); - return NULL; - } - tmp = PyObject_Call(callable, args, NULL); - Py_DECREF(args); - Py_DECREF(callable); - - return tmp; -} - -PyObject * -PyObject_CallFunctionObjArgs(PyObject *callable, ...) -{ - PyObject *args, *tmp; - va_list vargs; - - if (callable == NULL) - return null_error(); - - /* count the args */ - va_start(vargs, callable); - args = objargs_mktuple(vargs); - va_end(vargs); - if (args == NULL) - return NULL; - tmp = PyObject_Call(callable, args, NULL); - Py_DECREF(args); - - return tmp; -} - - -/* isinstance(), issubclass() */ - -/* abstract_get_bases() has logically 4 return states, with a sort of 0th - * state that will almost never happen. - * - * 0. creating the __bases__ static string could get a MemoryError - * 1. getattr(cls, '__bases__') could raise an AttributeError - * 2. getattr(cls, '__bases__') could raise some other exception - * 3. getattr(cls, '__bases__') could return a tuple - * 4. getattr(cls, '__bases__') could return something other than a tuple - * - * Only state #3 is a non-error state and only it returns a non-NULL object - * (it returns the retrieved tuple). - * - * Any raised AttributeErrors are masked by clearing the exception and - * returning NULL. If an object other than a tuple comes out of __bases__, - * then again, the return value is NULL. So yes, these two situations - * produce exactly the same results: NULL is returned and no error is set. - * - * If some exception other than AttributeError is raised, then NULL is also - * returned, but the exception is not cleared. That's because we want the - * exception to be propagated along. - * - * Callers are expected to test for PyErr_Occurred() when the return value - * is NULL to decide whether a valid exception should be propagated or not. - * When there's no exception to propagate, it's customary for the caller to - * set a TypeError. - */ -static PyObject * -abstract_get_bases(PyObject *cls) -{ - static PyObject *__bases__ = NULL; - PyObject *bases; - - if (__bases__ == NULL) { - __bases__ = PyString_InternFromString("__bases__"); - if (__bases__ == NULL) - return NULL; - } - bases = PyObject_GetAttr(cls, __bases__); - if (bases == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - return NULL; - } - if (!PyTuple_Check(bases)) { - Py_DECREF(bases); - return NULL; - } - return bases; -} - - -static int -abstract_issubclass(PyObject *derived, PyObject *cls) -{ - PyObject *bases = NULL; - Py_ssize_t i, n; - int r = 0; - - while (1) { - if (derived == cls) - return 1; - bases = abstract_get_bases(derived); - if (bases == NULL) { - if (PyErr_Occurred()) - return -1; - return 0; - } - n = PyTuple_GET_SIZE(bases); - if (n == 0) { - Py_DECREF(bases); - return 0; - } - /* Avoid recursivity in the single inheritance case */ - if (n == 1) { - derived = PyTuple_GET_ITEM(bases, 0); - Py_DECREF(bases); - continue; - } - for (i = 0; i < n; i++) { - r = abstract_issubclass(PyTuple_GET_ITEM(bases, i), cls); - if (r != 0) - break; - } - Py_DECREF(bases); - return r; - } -} - -static int -check_class(PyObject *cls, const char *error) -{ - PyObject *bases = abstract_get_bases(cls); - if (bases == NULL) { - /* Do not mask errors. */ - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, error); - return 0; - } - Py_DECREF(bases); - return -1; -} - -static int -recursive_isinstance(PyObject *inst, PyObject *cls) -{ - PyObject *icls; - static PyObject *__class__ = NULL; - int retval = 0; - - if (__class__ == NULL) { - __class__ = PyString_InternFromString("__class__"); - if (__class__ == NULL) - return -1; - } - - if (PyClass_Check(cls) && PyInstance_Check(inst)) { - PyObject *inclass = - (PyObject*)((PyInstanceObject*)inst)->in_class; - retval = PyClass_IsSubclass(inclass, cls); - } - else if (PyType_Check(cls)) { - retval = PyObject_TypeCheck(inst, (PyTypeObject *)cls); - if (retval == 0) { - PyObject *c = PyObject_GetAttr(inst, __class__); - if (c == NULL) { - PyErr_Clear(); - } - else { - if (c != (PyObject *)(inst->ob_type) && - PyType_Check(c)) - retval = PyType_IsSubtype( - (PyTypeObject *)c, - (PyTypeObject *)cls); - Py_DECREF(c); - } - } - } - else { - if (!check_class(cls, - "isinstance() arg 2 must be a class, type," - " or tuple of classes and types")) - return -1; - icls = PyObject_GetAttr(inst, __class__); - if (icls == NULL) { - PyErr_Clear(); - retval = 0; - } - else { - retval = abstract_issubclass(icls, cls); - Py_DECREF(icls); - } - } - - return retval; -} - -int -PyObject_IsInstance(PyObject *inst, PyObject *cls) -{ - static PyObject *name = NULL; - - /* Quick test for an exact match */ - if (Py_TYPE(inst) == (PyTypeObject *)cls) - return 1; - - if (PyTuple_Check(cls)) { - Py_ssize_t i; - Py_ssize_t n; - int r = 0; - - if (Py_EnterRecursiveCall(" in __instancecheck__")) - return -1; - n = PyTuple_GET_SIZE(cls); - for (i = 0; i < n; ++i) { - PyObject *item = PyTuple_GET_ITEM(cls, i); - r = PyObject_IsInstance(inst, item); - if (r != 0) - /* either found it, or got an error */ - break; - } - Py_LeaveRecursiveCall(); - return r; - } - - if (!(PyClass_Check(cls) || PyInstance_Check(cls))) { - PyObject *checker; - checker = _PyObject_LookupSpecial(cls, "__instancecheck__", &name); - if (checker != NULL) { - PyObject *res; - int ok = -1; - if (Py_EnterRecursiveCall(" in __instancecheck__")) { - Py_DECREF(checker); - return ok; - } - res = PyObject_CallFunctionObjArgs(checker, inst, NULL); - Py_LeaveRecursiveCall(); - Py_DECREF(checker); - if (res != NULL) { - ok = PyObject_IsTrue(res); - Py_DECREF(res); - } - return ok; - } - else if (PyErr_Occurred()) - return -1; - } - return recursive_isinstance(inst, cls); -} - -static int -recursive_issubclass(PyObject *derived, PyObject *cls) -{ - int retval; - - if (PyType_Check(cls) && PyType_Check(derived)) { - /* Fast path (non-recursive) */ - return PyType_IsSubtype( - (PyTypeObject *)derived, (PyTypeObject *)cls); - } - if (!PyClass_Check(derived) || !PyClass_Check(cls)) { - if (!check_class(derived, - "issubclass() arg 1 must be a class")) - return -1; - - if (!check_class(cls, - "issubclass() arg 2 must be a class" - " or tuple of classes")) - return -1; - retval = abstract_issubclass(derived, cls); - } - else { - /* shortcut */ - if (!(retval = (derived == cls))) - retval = PyClass_IsSubclass(derived, cls); - } - - return retval; -} - -int -PyObject_IsSubclass(PyObject *derived, PyObject *cls) -{ - static PyObject *name = NULL; - - if (PyTuple_Check(cls)) { - Py_ssize_t i; - Py_ssize_t n; - int r = 0; - - if (Py_EnterRecursiveCall(" in __subclasscheck__")) - return -1; - n = PyTuple_GET_SIZE(cls); - for (i = 0; i < n; ++i) { - PyObject *item = PyTuple_GET_ITEM(cls, i); - r = PyObject_IsSubclass(derived, item); - if (r != 0) - /* either found it, or got an error */ - break; - } - Py_LeaveRecursiveCall(); - return r; - } - if (!(PyClass_Check(cls) || PyInstance_Check(cls))) { - PyObject *checker; - checker = _PyObject_LookupSpecial(cls, "__subclasscheck__", &name); - if (checker != NULL) { - PyObject *res; - int ok = -1; - if (Py_EnterRecursiveCall(" in __subclasscheck__")) { - Py_DECREF(checker); - return ok; - } - res = PyObject_CallFunctionObjArgs(checker, derived, NULL); - Py_LeaveRecursiveCall(); - Py_DECREF(checker); - if (res != NULL) { - ok = PyObject_IsTrue(res); - Py_DECREF(res); - } - return ok; - } - else if (PyErr_Occurred()) { - return -1; - } - } - return recursive_issubclass(derived, cls); -} - -int -_PyObject_RealIsInstance(PyObject *inst, PyObject *cls) -{ - return recursive_isinstance(inst, cls); -} - -int -_PyObject_RealIsSubclass(PyObject *derived, PyObject *cls) -{ - return recursive_issubclass(derived, cls); -} - - -PyObject * -PyObject_GetIter(PyObject *o) -{ - PyTypeObject *t = o->ob_type; - getiterfunc f = NULL; - if (PyType_HasFeature(t, Py_TPFLAGS_HAVE_ITER)) - f = t->tp_iter; - if (f == NULL) { - if (PySequence_Check(o)) - return PySeqIter_New(o); - return type_error("'%.200s' object is not iterable", o); - } - else { - PyObject *res = (*f)(o); - if (res != NULL && !PyIter_Check(res)) { - PyErr_Format(PyExc_TypeError, - "iter() returned non-iterator " - "of type '%.100s'", - res->ob_type->tp_name); - Py_DECREF(res); - res = NULL; - } - return res; - } -} - -/* Return next item. - * If an error occurs, return NULL. PyErr_Occurred() will be true. - * If the iteration terminates normally, return NULL and clear the - * PyExc_StopIteration exception (if it was set). PyErr_Occurred() - * will be false. - * Else return the next object. PyErr_Occurred() will be false. - */ -PyObject * -PyIter_Next(PyObject *iter) -{ - PyObject *result; - result = (*iter->ob_type->tp_iternext)(iter); - if (result == NULL && - PyErr_Occurred() && - PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - return result; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/boolobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/boolobject.c deleted file mode 100644 index 6791ee7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/boolobject.c +++ /dev/null @@ -1,202 +0,0 @@ -/* Boolean type, a subtype of int */ - -#include "Python.h" - -/* We need to define bool_print to override int_print */ - -static int -bool_print(PyBoolObject *self, FILE *fp, int flags) -{ - Py_BEGIN_ALLOW_THREADS - fputs(self->ob_ival == 0 ? "False" : "True", fp); - Py_END_ALLOW_THREADS - return 0; -} - -/* We define bool_repr to return "False" or "True" */ - -static PyObject *false_str = NULL; -static PyObject *true_str = NULL; - -static PyObject * -bool_repr(PyBoolObject *self) -{ - PyObject *s; - - if (self->ob_ival) - s = true_str ? true_str : - (true_str = PyString_InternFromString("True")); - else - s = false_str ? false_str : - (false_str = PyString_InternFromString("False")); - Py_XINCREF(s); - return s; -} - -/* Function to return a bool from a C long */ - -PyObject *PyBool_FromLong(long ok) -{ - PyObject *result; - - if (ok) - result = Py_True; - else - result = Py_False; - Py_INCREF(result); - return result; -} - -/* We define bool_new to always return either Py_True or Py_False */ - -static PyObject * -bool_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"x", 0}; - PyObject *x = Py_False; - long ok; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:bool", kwlist, &x)) - return NULL; - ok = PyObject_IsTrue(x); - if (ok < 0) - return NULL; - return PyBool_FromLong(ok); -} - -/* Arithmetic operations redefined to return bool if both args are bool. */ - -static PyObject * -bool_and(PyObject *a, PyObject *b) -{ - if (!PyBool_Check(a) || !PyBool_Check(b)) - return PyInt_Type.tp_as_number->nb_and(a, b); - return PyBool_FromLong( - ((PyBoolObject *)a)->ob_ival & ((PyBoolObject *)b)->ob_ival); -} - -static PyObject * -bool_or(PyObject *a, PyObject *b) -{ - if (!PyBool_Check(a) || !PyBool_Check(b)) - return PyInt_Type.tp_as_number->nb_or(a, b); - return PyBool_FromLong( - ((PyBoolObject *)a)->ob_ival | ((PyBoolObject *)b)->ob_ival); -} - -static PyObject * -bool_xor(PyObject *a, PyObject *b) -{ - if (!PyBool_Check(a) || !PyBool_Check(b)) - return PyInt_Type.tp_as_number->nb_xor(a, b); - return PyBool_FromLong( - ((PyBoolObject *)a)->ob_ival ^ ((PyBoolObject *)b)->ob_ival); -} - -/* Doc string */ - -PyDoc_STRVAR(bool_doc, -"bool(x) -> bool\n\ -\n\ -Returns True when the argument x is true, False otherwise.\n\ -The builtins True and False are the only two instances of the class bool.\n\ -The class bool is a subclass of the class int, and cannot be subclassed."); - -/* Arithmetic methods -- only so we can override &, |, ^. */ - -static PyNumberMethods bool_as_number = { - 0, /* nb_add */ - 0, /* nb_subtract */ - 0, /* nb_multiply */ - 0, /* nb_divide */ - 0, /* nb_remainder */ - 0, /* nb_divmod */ - 0, /* nb_power */ - 0, /* nb_negative */ - 0, /* nb_positive */ - 0, /* nb_absolute */ - 0, /* nb_nonzero */ - 0, /* nb_invert */ - 0, /* nb_lshift */ - 0, /* nb_rshift */ - bool_and, /* nb_and */ - bool_xor, /* nb_xor */ - bool_or, /* nb_or */ - 0, /* nb_coerce */ - 0, /* nb_int */ - 0, /* nb_long */ - 0, /* nb_float */ - 0, /* nb_oct */ - 0, /* nb_hex */ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply */ - 0, /* nb_inplace_divide */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - 0, /* nb_floor_divide */ - 0, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ -}; - -/* The type object for bool. Note that this cannot be subclassed! */ - -PyTypeObject PyBool_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "bool", - sizeof(PyIntObject), - 0, - 0, /* tp_dealloc */ - (printfunc)bool_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)bool_repr, /* tp_repr */ - &bool_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)bool_repr, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ - bool_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyInt_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - bool_new, /* tp_new */ -}; - -/* The objects representing bool values False and True */ - -/* Named Zero for link-level compatibility */ -PyIntObject _Py_ZeroStruct = { - PyObject_HEAD_INIT(&PyBool_Type) - 0 -}; - -PyIntObject _Py_TrueStruct = { - PyObject_HEAD_INIT(&PyBool_Type) - 1 -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/bufferobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/bufferobject.c deleted file mode 100644 index 2438574..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/bufferobject.c +++ /dev/null @@ -1,878 +0,0 @@ - -/* Buffer object implementation */ - -#include "Python.h" - - -typedef struct { - PyObject_HEAD - PyObject *b_base; - void *b_ptr; - Py_ssize_t b_size; - Py_ssize_t b_offset; - int b_readonly; - long b_hash; -} PyBufferObject; - - -enum buffer_t { - READ_BUFFER, - WRITE_BUFFER, - CHAR_BUFFER, - ANY_BUFFER -}; - -static int -get_buf(PyBufferObject *self, void **ptr, Py_ssize_t *size, - enum buffer_t buffer_type) -{ - if (self->b_base == NULL) { - assert (ptr != NULL); - *ptr = self->b_ptr; - *size = self->b_size; - } - else { - Py_ssize_t count, offset; - readbufferproc proc = 0; - PyBufferProcs *bp = self->b_base->ob_type->tp_as_buffer; - if ((*bp->bf_getsegcount)(self->b_base, NULL) != 1) { - PyErr_SetString(PyExc_TypeError, - "single-segment buffer object expected"); - return 0; - } - if ((buffer_type == READ_BUFFER) || - ((buffer_type == ANY_BUFFER) && self->b_readonly)) - proc = bp->bf_getreadbuffer; - else if ((buffer_type == WRITE_BUFFER) || - (buffer_type == ANY_BUFFER)) - proc = (readbufferproc)bp->bf_getwritebuffer; - else if (buffer_type == CHAR_BUFFER) { - if (!PyType_HasFeature(self->ob_type, - Py_TPFLAGS_HAVE_GETCHARBUFFER)) { - PyErr_SetString(PyExc_TypeError, - "Py_TPFLAGS_HAVE_GETCHARBUFFER needed"); - return 0; - } - proc = (readbufferproc)bp->bf_getcharbuffer; - } - if (!proc) { - char *buffer_type_name; - switch (buffer_type) { - case READ_BUFFER: - buffer_type_name = "read"; - break; - case WRITE_BUFFER: - buffer_type_name = "write"; - break; - case CHAR_BUFFER: - buffer_type_name = "char"; - break; - default: - buffer_type_name = "no"; - break; - } - PyErr_Format(PyExc_TypeError, - "%s buffer type not available", - buffer_type_name); - return 0; - } - if ((count = (*proc)(self->b_base, 0, ptr)) < 0) - return 0; - /* apply constraints to the start/end */ - if (self->b_offset > count) - offset = count; - else - offset = self->b_offset; - *(char **)ptr = *(char **)ptr + offset; - if (self->b_size == Py_END_OF_BUFFER) - *size = count; - else - *size = self->b_size; - if (*size > count - offset) - *size = count - offset; - } - return 1; -} - - -static PyObject * -buffer_from_memory(PyObject *base, Py_ssize_t size, Py_ssize_t offset, void *ptr, - int readonly) -{ - PyBufferObject * b; - - if (size < 0 && size != Py_END_OF_BUFFER) { - PyErr_SetString(PyExc_ValueError, - "size must be zero or positive"); - return NULL; - } - if (offset < 0) { - PyErr_SetString(PyExc_ValueError, - "offset must be zero or positive"); - return NULL; - } - - b = PyObject_NEW(PyBufferObject, &PyBuffer_Type); - if ( b == NULL ) - return NULL; - - Py_XINCREF(base); - b->b_base = base; - b->b_ptr = ptr; - b->b_size = size; - b->b_offset = offset; - b->b_readonly = readonly; - b->b_hash = -1; - - return (PyObject *) b; -} - -static PyObject * -buffer_from_object(PyObject *base, Py_ssize_t size, Py_ssize_t offset, int readonly) -{ - if (offset < 0) { - PyErr_SetString(PyExc_ValueError, - "offset must be zero or positive"); - return NULL; - } - if ( PyBuffer_Check(base) && (((PyBufferObject *)base)->b_base) ) { - /* another buffer, refer to the base object */ - PyBufferObject *b = (PyBufferObject *)base; - if (b->b_size != Py_END_OF_BUFFER) { - Py_ssize_t base_size = b->b_size - offset; - if (base_size < 0) - base_size = 0; - if (size == Py_END_OF_BUFFER || size > base_size) - size = base_size; - } - offset += b->b_offset; - base = b->b_base; - } - return buffer_from_memory(base, size, offset, NULL, readonly); -} - - -PyObject * -PyBuffer_FromObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size) -{ - PyBufferProcs *pb = base->ob_type->tp_as_buffer; - - if ( pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL ) - { - PyErr_SetString(PyExc_TypeError, "buffer object expected"); - return NULL; - } - - return buffer_from_object(base, size, offset, 1); -} - -PyObject * -PyBuffer_FromReadWriteObject(PyObject *base, Py_ssize_t offset, Py_ssize_t size) -{ - PyBufferProcs *pb = base->ob_type->tp_as_buffer; - - if ( pb == NULL || - pb->bf_getwritebuffer == NULL || - pb->bf_getsegcount == NULL ) - { - PyErr_SetString(PyExc_TypeError, "buffer object expected"); - return NULL; - } - - return buffer_from_object(base, size, offset, 0); -} - -PyObject * -PyBuffer_FromMemory(void *ptr, Py_ssize_t size) -{ - return buffer_from_memory(NULL, size, 0, ptr, 1); -} - -PyObject * -PyBuffer_FromReadWriteMemory(void *ptr, Py_ssize_t size) -{ - return buffer_from_memory(NULL, size, 0, ptr, 0); -} - -PyObject * -PyBuffer_New(Py_ssize_t size) -{ - PyObject *o; - PyBufferObject * b; - - if (size < 0) { - PyErr_SetString(PyExc_ValueError, - "size must be zero or positive"); - return NULL; - } - if (sizeof(*b) > PY_SSIZE_T_MAX - size) { - /* unlikely */ - return PyErr_NoMemory(); - } - /* Inline PyObject_New */ - o = (PyObject *)PyObject_MALLOC(sizeof(*b) + size); - if ( o == NULL ) - return PyErr_NoMemory(); - b = (PyBufferObject *) PyObject_INIT(o, &PyBuffer_Type); - - b->b_base = NULL; - b->b_ptr = (void *)(b + 1); - b->b_size = size; - b->b_offset = 0; - b->b_readonly = 0; - b->b_hash = -1; - - return o; -} - -/* Methods */ - -static PyObject * -buffer_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *ob; - Py_ssize_t offset = 0; - Py_ssize_t size = Py_END_OF_BUFFER; - - if (PyErr_WarnPy3k("buffer() not supported in 3.x", 1) < 0) - return NULL; - - if (!_PyArg_NoKeywords("buffer()", kw)) - return NULL; - - if (!PyArg_ParseTuple(args, "O|nn:buffer", &ob, &offset, &size)) - return NULL; - return PyBuffer_FromObject(ob, offset, size); -} - -PyDoc_STRVAR(buffer_doc, -"buffer(object [, offset[, size]])\n\ -\n\ -Create a new buffer object which references the given object.\n\ -The buffer will reference a slice of the target object from the\n\ -start of the object (or at the specified offset). The slice will\n\ -extend to the end of the target object (or with the specified size)."); - - -static void -buffer_dealloc(PyBufferObject *self) -{ - Py_XDECREF(self->b_base); - PyObject_DEL(self); -} - -static int -buffer_compare(PyBufferObject *self, PyBufferObject *other) -{ - void *p1, *p2; - Py_ssize_t len_self, len_other, min_len; - int cmp; - - if (!get_buf(self, &p1, &len_self, ANY_BUFFER)) - return -1; - if (!get_buf(other, &p2, &len_other, ANY_BUFFER)) - return -1; - min_len = (len_self < len_other) ? len_self : len_other; - if (min_len > 0) { - cmp = memcmp(p1, p2, min_len); - if (cmp != 0) - return cmp < 0 ? -1 : 1; - } - return (len_self < len_other) ? -1 : (len_self > len_other) ? 1 : 0; -} - -static PyObject * -buffer_repr(PyBufferObject *self) -{ - const char *status = self->b_readonly ? "read-only" : "read-write"; - - if ( self->b_base == NULL ) - return PyString_FromFormat("<%s buffer ptr %p, size %zd at %p>", - status, - self->b_ptr, - self->b_size, - self); - else - return PyString_FromFormat( - "<%s buffer for %p, size %zd, offset %zd at %p>", - status, - self->b_base, - self->b_size, - self->b_offset, - self); -} - -static long -buffer_hash(PyBufferObject *self) -{ - void *ptr; - Py_ssize_t size; - register Py_ssize_t len; - register unsigned char *p; - register long x; - - if ( self->b_hash != -1 ) - return self->b_hash; - - /* XXX potential bugs here, a readonly buffer does not imply that the - * underlying memory is immutable. b_readonly is a necessary but not - * sufficient condition for a buffer to be hashable. Perhaps it would - * be better to only allow hashing if the underlying object is known to - * be immutable (e.g. PyString_Check() is true). Another idea would - * be to call tp_hash on the underlying object and see if it raises - * an error. */ - if ( !self->b_readonly ) - { - PyErr_SetString(PyExc_TypeError, - "writable buffers are not hashable"); - return -1; - } - - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return -1; - p = (unsigned char *) ptr; - len = size; - /* - We make the hash of the empty buffer be 0, rather than using - (prefix ^ suffix), since this slightly obfuscates the hash secret - */ - if (len == 0) { - self->b_hash = 0; - return 0; - } - x = _Py_HashSecret.prefix; - x ^= *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= size; - x ^= _Py_HashSecret.suffix; - if (x == -1) - x = -2; - self->b_hash = x; - return x; -} - -static PyObject * -buffer_str(PyBufferObject *self) -{ - void *ptr; - Py_ssize_t size; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return NULL; - return PyString_FromStringAndSize((const char *)ptr, size); -} - -/* Sequence methods */ - -static Py_ssize_t -buffer_length(PyBufferObject *self) -{ - void *ptr; - Py_ssize_t size; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return -1; - return size; -} - -static PyObject * -buffer_concat(PyBufferObject *self, PyObject *other) -{ - PyBufferProcs *pb = other->ob_type->tp_as_buffer; - void *ptr1, *ptr2; - char *p; - PyObject *ob; - Py_ssize_t size, count; - - if ( pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL ) - { - PyErr_BadArgument(); - return NULL; - } - if ( (*pb->bf_getsegcount)(other, NULL) != 1 ) - { - /* ### use a different exception type/message? */ - PyErr_SetString(PyExc_TypeError, - "single-segment buffer object expected"); - return NULL; - } - - if (!get_buf(self, &ptr1, &size, ANY_BUFFER)) - return NULL; - - /* optimize special case */ - if ( size == 0 ) - { - Py_INCREF(other); - return other; - } - - if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) - return NULL; - - assert(count <= PY_SIZE_MAX - size); - - ob = PyString_FromStringAndSize(NULL, size + count); - if ( ob == NULL ) - return NULL; - p = PyString_AS_STRING(ob); - memcpy(p, ptr1, size); - memcpy(p + size, ptr2, count); - - /* there is an extra byte in the string object, so this is safe */ - p[size + count] = '\0'; - - return ob; -} - -static PyObject * -buffer_repeat(PyBufferObject *self, Py_ssize_t count) -{ - PyObject *ob; - register char *p; - void *ptr; - Py_ssize_t size; - - if ( count < 0 ) - count = 0; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return NULL; - if (count > PY_SSIZE_T_MAX / size) { - PyErr_SetString(PyExc_MemoryError, "result too large"); - return NULL; - } - ob = PyString_FromStringAndSize(NULL, size * count); - if ( ob == NULL ) - return NULL; - - p = PyString_AS_STRING(ob); - while ( count-- ) - { - memcpy(p, ptr, size); - p += size; - } - - /* there is an extra byte in the string object, so this is safe */ - *p = '\0'; - - return ob; -} - -static PyObject * -buffer_item(PyBufferObject *self, Py_ssize_t idx) -{ - void *ptr; - Py_ssize_t size; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return NULL; - if ( idx < 0 || idx >= size ) { - PyErr_SetString(PyExc_IndexError, "buffer index out of range"); - return NULL; - } - return PyString_FromStringAndSize((char *)ptr + idx, 1); -} - -static PyObject * -buffer_slice(PyBufferObject *self, Py_ssize_t left, Py_ssize_t right) -{ - void *ptr; - Py_ssize_t size; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return NULL; - if ( left < 0 ) - left = 0; - if ( right < 0 ) - right = 0; - if ( right > size ) - right = size; - if ( right < left ) - right = left; - return PyString_FromStringAndSize((char *)ptr + left, - right - left); -} - -static PyObject * -buffer_subscript(PyBufferObject *self, PyObject *item) -{ - void *p; - Py_ssize_t size; - - if (!get_buf(self, &p, &size, ANY_BUFFER)) - return NULL; - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += size; - return buffer_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - - if (PySlice_GetIndicesEx((PySliceObject*)item, size, - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) - return PyString_FromStringAndSize("", 0); - else if (step == 1) - return PyString_FromStringAndSize((char *)p + start, - stop - start); - else { - PyObject *result; - char *source_buf = (char *)p; - char *result_buf = (char *)PyMem_Malloc(slicelength); - - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyString_FromStringAndSize(result_buf, - slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_SetString(PyExc_TypeError, - "sequence index must be integer"); - return NULL; - } -} - -static int -buffer_ass_item(PyBufferObject *self, Py_ssize_t idx, PyObject *other) -{ - PyBufferProcs *pb; - void *ptr1, *ptr2; - Py_ssize_t size; - Py_ssize_t count; - - if ( self->b_readonly ) { - PyErr_SetString(PyExc_TypeError, - "buffer is read-only"); - return -1; - } - - if (!get_buf(self, &ptr1, &size, ANY_BUFFER)) - return -1; - - if (idx < 0 || idx >= size) { - PyErr_SetString(PyExc_IndexError, - "buffer assignment index out of range"); - return -1; - } - - pb = other ? other->ob_type->tp_as_buffer : NULL; - if ( pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL ) - { - PyErr_BadArgument(); - return -1; - } - if ( (*pb->bf_getsegcount)(other, NULL) != 1 ) - { - /* ### use a different exception type/message? */ - PyErr_SetString(PyExc_TypeError, - "single-segment buffer object expected"); - return -1; - } - - if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) - return -1; - if ( count != 1 ) { - PyErr_SetString(PyExc_TypeError, - "right operand must be a single byte"); - return -1; - } - - ((char *)ptr1)[idx] = *(char *)ptr2; - return 0; -} - -static int -buffer_ass_slice(PyBufferObject *self, Py_ssize_t left, Py_ssize_t right, PyObject *other) -{ - PyBufferProcs *pb; - void *ptr1, *ptr2; - Py_ssize_t size; - Py_ssize_t slice_len; - Py_ssize_t count; - - if ( self->b_readonly ) { - PyErr_SetString(PyExc_TypeError, - "buffer is read-only"); - return -1; - } - - pb = other ? other->ob_type->tp_as_buffer : NULL; - if ( pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL ) - { - PyErr_BadArgument(); - return -1; - } - if ( (*pb->bf_getsegcount)(other, NULL) != 1 ) - { - /* ### use a different exception type/message? */ - PyErr_SetString(PyExc_TypeError, - "single-segment buffer object expected"); - return -1; - } - if (!get_buf(self, &ptr1, &size, ANY_BUFFER)) - return -1; - if ( (count = (*pb->bf_getreadbuffer)(other, 0, &ptr2)) < 0 ) - return -1; - - if ( left < 0 ) - left = 0; - else if ( left > size ) - left = size; - if ( right < left ) - right = left; - else if ( right > size ) - right = size; - slice_len = right - left; - - if ( count != slice_len ) { - PyErr_SetString( - PyExc_TypeError, - "right operand length must match slice length"); - return -1; - } - - if ( slice_len ) - memcpy((char *)ptr1 + left, ptr2, slice_len); - - return 0; -} - -static int -buffer_ass_subscript(PyBufferObject *self, PyObject *item, PyObject *value) -{ - PyBufferProcs *pb; - void *ptr1, *ptr2; - Py_ssize_t selfsize; - Py_ssize_t othersize; - - if ( self->b_readonly ) { - PyErr_SetString(PyExc_TypeError, - "buffer is read-only"); - return -1; - } - - pb = value ? value->ob_type->tp_as_buffer : NULL; - if ( pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL ) - { - PyErr_BadArgument(); - return -1; - } - if ( (*pb->bf_getsegcount)(value, NULL) != 1 ) - { - /* ### use a different exception type/message? */ - PyErr_SetString(PyExc_TypeError, - "single-segment buffer object expected"); - return -1; - } - if (!get_buf(self, &ptr1, &selfsize, ANY_BUFFER)) - return -1; - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return -1; - if (i < 0) - i += selfsize; - return buffer_ass_item(self, i, value); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength; - - if (PySlice_GetIndicesEx((PySliceObject *)item, selfsize, - &start, &stop, &step, &slicelength) < 0) - return -1; - - if ((othersize = (*pb->bf_getreadbuffer)(value, 0, &ptr2)) < 0) - return -1; - - if (othersize != slicelength) { - PyErr_SetString( - PyExc_TypeError, - "right operand length must match slice length"); - return -1; - } - - if (slicelength == 0) - return 0; - else if (step == 1) { - memcpy((char *)ptr1 + start, ptr2, slicelength); - return 0; - } - else { - Py_ssize_t cur, i; - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - ((char *)ptr1)[cur] = ((char *)ptr2)[i]; - } - - return 0; - } - } else { - PyErr_SetString(PyExc_TypeError, - "buffer indices must be integers"); - return -1; - } -} - -/* Buffer methods */ - -static Py_ssize_t -buffer_getreadbuf(PyBufferObject *self, Py_ssize_t idx, void **pp) -{ - Py_ssize_t size; - if ( idx != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent buffer segment"); - return -1; - } - if (!get_buf(self, pp, &size, READ_BUFFER)) - return -1; - return size; -} - -static Py_ssize_t -buffer_getwritebuf(PyBufferObject *self, Py_ssize_t idx, void **pp) -{ - Py_ssize_t size; - - if ( self->b_readonly ) - { - PyErr_SetString(PyExc_TypeError, "buffer is read-only"); - return -1; - } - - if ( idx != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent buffer segment"); - return -1; - } - if (!get_buf(self, pp, &size, WRITE_BUFFER)) - return -1; - return size; -} - -static Py_ssize_t -buffer_getsegcount(PyBufferObject *self, Py_ssize_t *lenp) -{ - void *ptr; - Py_ssize_t size; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return -1; - if (lenp) - *lenp = size; - return 1; -} - -static Py_ssize_t -buffer_getcharbuf(PyBufferObject *self, Py_ssize_t idx, const char **pp) -{ - void *ptr; - Py_ssize_t size; - if ( idx != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent buffer segment"); - return -1; - } - if (!get_buf(self, &ptr, &size, CHAR_BUFFER)) - return -1; - *pp = (const char *)ptr; - return size; -} - -static int buffer_getbuffer(PyBufferObject *self, Py_buffer *buf, int flags) -{ - void *ptr; - Py_ssize_t size; - if (!get_buf(self, &ptr, &size, ANY_BUFFER)) - return -1; - return PyBuffer_FillInfo(buf, (PyObject*)self, ptr, size, - self->b_readonly, flags); -} - -static PySequenceMethods buffer_as_sequence = { - (lenfunc)buffer_length, /*sq_length*/ - (binaryfunc)buffer_concat, /*sq_concat*/ - (ssizeargfunc)buffer_repeat, /*sq_repeat*/ - (ssizeargfunc)buffer_item, /*sq_item*/ - (ssizessizeargfunc)buffer_slice, /*sq_slice*/ - (ssizeobjargproc)buffer_ass_item, /*sq_ass_item*/ - (ssizessizeobjargproc)buffer_ass_slice, /*sq_ass_slice*/ -}; - -static PyMappingMethods buffer_as_mapping = { - (lenfunc)buffer_length, - (binaryfunc)buffer_subscript, - (objobjargproc)buffer_ass_subscript, -}; - -static PyBufferProcs buffer_as_buffer = { - (readbufferproc)buffer_getreadbuf, - (writebufferproc)buffer_getwritebuf, - (segcountproc)buffer_getsegcount, - (charbufferproc)buffer_getcharbuf, - (getbufferproc)buffer_getbuffer, -}; - -PyTypeObject PyBuffer_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "buffer", - sizeof(PyBufferObject), - 0, - (destructor)buffer_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)buffer_compare, /* tp_compare */ - (reprfunc)buffer_repr, /* tp_repr */ - 0, /* tp_as_number */ - &buffer_as_sequence, /* tp_as_sequence */ - &buffer_as_mapping, /* tp_as_mapping */ - (hashfunc)buffer_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)buffer_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &buffer_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GETCHARBUFFER | Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - buffer_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - buffer_new, /* tp_new */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/bytearrayobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/bytearrayobject.c deleted file mode 100644 index b24ca78..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/bytearrayobject.c +++ /dev/null @@ -1,3052 +0,0 @@ -/* PyBytes (bytearray) implementation */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" -#include "bytes_methods.h" - -char _PyByteArray_empty_string[] = ""; - -void -PyByteArray_Fini(void) -{ -} - -int -PyByteArray_Init(void) -{ - return 1; -} - -/* end nullbytes support */ - -/* Helpers */ - -static int -_getbytevalue(PyObject* arg, int *value) -{ - long face_value; - - if (PyBytes_CheckExact(arg)) { - if (Py_SIZE(arg) != 1) { - PyErr_SetString(PyExc_ValueError, "string must be of size 1"); - return 0; - } - *value = Py_CHARMASK(((PyBytesObject*)arg)->ob_sval[0]); - return 1; - } - else if (PyInt_Check(arg) || PyLong_Check(arg)) { - face_value = PyLong_AsLong(arg); - } - else { - PyObject *index = PyNumber_Index(arg); - if (index == NULL) { - PyErr_Format(PyExc_TypeError, - "an integer or string of size 1 is required"); - return 0; - } - face_value = PyLong_AsLong(index); - Py_DECREF(index); - } - - if (face_value < 0 || face_value >= 256) { - /* this includes the OverflowError in case the long is too large */ - PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); - return 0; - } - - *value = face_value; - return 1; -} - -static Py_ssize_t -bytearray_buffer_getreadbuf(PyByteArrayObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent bytes segment"); - return -1; - } - *ptr = (void *)PyByteArray_AS_STRING(self); - return Py_SIZE(self); -} - -static Py_ssize_t -bytearray_buffer_getwritebuf(PyByteArrayObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent bytes segment"); - return -1; - } - *ptr = (void *)PyByteArray_AS_STRING(self); - return Py_SIZE(self); -} - -static Py_ssize_t -bytearray_buffer_getsegcount(PyByteArrayObject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self); - return 1; -} - -static Py_ssize_t -bytearray_buffer_getcharbuf(PyByteArrayObject *self, Py_ssize_t index, const char **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent bytes segment"); - return -1; - } - *ptr = PyByteArray_AS_STRING(self); - return Py_SIZE(self); -} - -static int -bytearray_getbuffer(PyByteArrayObject *obj, Py_buffer *view, int flags) -{ - int ret; - void *ptr; - if (view == NULL) { - obj->ob_exports++; - return 0; - } - ptr = (void *) PyByteArray_AS_STRING(obj); - ret = PyBuffer_FillInfo(view, (PyObject*)obj, ptr, Py_SIZE(obj), 0, flags); - if (ret >= 0) { - obj->ob_exports++; - } - return ret; -} - -static void -bytearray_releasebuffer(PyByteArrayObject *obj, Py_buffer *view) -{ - obj->ob_exports--; -} - -static Py_ssize_t -_getbuffer(PyObject *obj, Py_buffer *view) -{ - PyBufferProcs *buffer = Py_TYPE(obj)->tp_as_buffer; - - if (buffer == NULL || buffer->bf_getbuffer == NULL) - { - PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't support the buffer API", - Py_TYPE(obj)->tp_name); - return -1; - } - - if (buffer->bf_getbuffer(obj, view, PyBUF_SIMPLE) < 0) - return -1; - return view->len; -} - -static int -_canresize(PyByteArrayObject *self) -{ - if (self->ob_exports > 0) { - PyErr_SetString(PyExc_BufferError, - "Existing exports of data: object cannot be re-sized"); - return 0; - } - return 1; -} - -/* Direct API functions */ - -PyObject * -PyByteArray_FromObject(PyObject *input) -{ - return PyObject_CallFunctionObjArgs((PyObject *)&PyByteArray_Type, - input, NULL); -} - -PyObject * -PyByteArray_FromStringAndSize(const char *bytes, Py_ssize_t size) -{ - PyByteArrayObject *new; - Py_ssize_t alloc; - - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyByteArray_FromStringAndSize"); - return NULL; - } - - new = PyObject_New(PyByteArrayObject, &PyByteArray_Type); - if (new == NULL) - return NULL; - - if (size == 0) { - new->ob_bytes = NULL; - alloc = 0; - } - else { - alloc = size + 1; - new->ob_bytes = PyMem_Malloc(alloc); - if (new->ob_bytes == NULL) { - Py_DECREF(new); - return PyErr_NoMemory(); - } - if (bytes != NULL && size > 0) - memcpy(new->ob_bytes, bytes, size); - new->ob_bytes[size] = '\0'; /* Trailing null byte */ - } - Py_SIZE(new) = size; - new->ob_alloc = alloc; - new->ob_exports = 0; - - return (PyObject *)new; -} - -Py_ssize_t -PyByteArray_Size(PyObject *self) -{ - assert(self != NULL); - assert(PyByteArray_Check(self)); - - return PyByteArray_GET_SIZE(self); -} - -char * -PyByteArray_AsString(PyObject *self) -{ - assert(self != NULL); - assert(PyByteArray_Check(self)); - - return PyByteArray_AS_STRING(self); -} - -int -PyByteArray_Resize(PyObject *self, Py_ssize_t size) -{ - void *sval; - Py_ssize_t alloc = ((PyByteArrayObject *)self)->ob_alloc; - - assert(self != NULL); - assert(PyByteArray_Check(self)); - assert(size >= 0); - - if (size == Py_SIZE(self)) { - return 0; - } - if (!_canresize((PyByteArrayObject *)self)) { - return -1; - } - - if (size < alloc / 2) { - /* Major downsize; resize down to exact size */ - alloc = size + 1; - } - else if (size < alloc) { - /* Within allocated size; quick exit */ - Py_SIZE(self) = size; - ((PyByteArrayObject *)self)->ob_bytes[size] = '\0'; /* Trailing null */ - return 0; - } - else if (size <= alloc * 1.125) { - /* Moderate upsize; overallocate similar to list_resize() */ - alloc = size + (size >> 3) + (size < 9 ? 3 : 6); - } - else { - /* Major upsize; resize up to exact size */ - alloc = size + 1; - } - - sval = PyMem_Realloc(((PyByteArrayObject *)self)->ob_bytes, alloc); - if (sval == NULL) { - PyErr_NoMemory(); - return -1; - } - - ((PyByteArrayObject *)self)->ob_bytes = sval; - Py_SIZE(self) = size; - ((PyByteArrayObject *)self)->ob_alloc = alloc; - ((PyByteArrayObject *)self)->ob_bytes[size] = '\0'; /* Trailing null byte */ - - return 0; -} - -PyObject * -PyByteArray_Concat(PyObject *a, PyObject *b) -{ - Py_ssize_t size; - Py_buffer va, vb; - PyByteArrayObject *result = NULL; - - va.len = -1; - vb.len = -1; - if (_getbuffer(a, &va) < 0 || - _getbuffer(b, &vb) < 0) { - PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s", - Py_TYPE(a)->tp_name, Py_TYPE(b)->tp_name); - goto done; - } - - size = va.len + vb.len; - if (size < 0) { - PyErr_NoMemory(); - goto done; - } - - result = (PyByteArrayObject *) PyByteArray_FromStringAndSize(NULL, size); - if (result != NULL) { - memcpy(result->ob_bytes, va.buf, va.len); - memcpy(result->ob_bytes + va.len, vb.buf, vb.len); - } - - done: - if (va.len != -1) - PyBuffer_Release(&va); - if (vb.len != -1) - PyBuffer_Release(&vb); - return (PyObject *)result; -} - -/* Functions stuffed into the type object */ - -static Py_ssize_t -bytearray_length(PyByteArrayObject *self) -{ - return Py_SIZE(self); -} - -static PyObject * -bytearray_iconcat(PyByteArrayObject *self, PyObject *other) -{ - Py_ssize_t mysize; - Py_ssize_t size; - Py_buffer vo; - - if (_getbuffer(other, &vo) < 0) { - PyErr_Format(PyExc_TypeError, "can't concat %.100s to %.100s", - Py_TYPE(other)->tp_name, Py_TYPE(self)->tp_name); - return NULL; - } - - mysize = Py_SIZE(self); - size = mysize + vo.len; - if (size < 0) { - PyBuffer_Release(&vo); - return PyErr_NoMemory(); - } - if (size < self->ob_alloc) { - Py_SIZE(self) = size; - self->ob_bytes[Py_SIZE(self)] = '\0'; /* Trailing null byte */ - } - else if (PyByteArray_Resize((PyObject *)self, size) < 0) { - PyBuffer_Release(&vo); - return NULL; - } - memcpy(self->ob_bytes + mysize, vo.buf, vo.len); - PyBuffer_Release(&vo); - Py_INCREF(self); - return (PyObject *)self; -} - -static PyObject * -bytearray_repeat(PyByteArrayObject *self, Py_ssize_t count) -{ - PyByteArrayObject *result; - Py_ssize_t mysize; - Py_ssize_t size; - - if (count < 0) - count = 0; - mysize = Py_SIZE(self); - size = mysize * count; - if (count != 0 && size / count != mysize) - return PyErr_NoMemory(); - result = (PyByteArrayObject *)PyByteArray_FromStringAndSize(NULL, size); - if (result != NULL && size != 0) { - if (mysize == 1) - memset(result->ob_bytes, self->ob_bytes[0], size); - else { - Py_ssize_t i; - for (i = 0; i < count; i++) - memcpy(result->ob_bytes + i*mysize, self->ob_bytes, mysize); - } - } - return (PyObject *)result; -} - -static PyObject * -bytearray_irepeat(PyByteArrayObject *self, Py_ssize_t count) -{ - Py_ssize_t mysize; - Py_ssize_t size; - - if (count < 0) - count = 0; - mysize = Py_SIZE(self); - size = mysize * count; - if (count != 0 && size / count != mysize) - return PyErr_NoMemory(); - if (size < self->ob_alloc) { - Py_SIZE(self) = size; - self->ob_bytes[Py_SIZE(self)] = '\0'; /* Trailing null byte */ - } - else if (PyByteArray_Resize((PyObject *)self, size) < 0) - return NULL; - - if (mysize == 1) - memset(self->ob_bytes, self->ob_bytes[0], size); - else { - Py_ssize_t i; - for (i = 1; i < count; i++) - memcpy(self->ob_bytes + i*mysize, self->ob_bytes, mysize); - } - - Py_INCREF(self); - return (PyObject *)self; -} - -static PyObject * -bytearray_getitem(PyByteArrayObject *self, Py_ssize_t i) -{ - if (i < 0) - i += Py_SIZE(self); - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); - return NULL; - } - return PyInt_FromLong((unsigned char)(self->ob_bytes[i])); -} - -static PyObject * -bytearray_subscript(PyByteArrayObject *self, PyObject *index) -{ - if (PyIndex_Check(index)) { - Py_ssize_t i = PyNumber_AsSsize_t(index, PyExc_IndexError); - - if (i == -1 && PyErr_Occurred()) - return NULL; - - if (i < 0) - i += PyByteArray_GET_SIZE(self); - - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); - return NULL; - } - return PyInt_FromLong((unsigned char)(self->ob_bytes[i])); - } - else if (PySlice_Check(index)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - if (PySlice_GetIndicesEx((PySliceObject *)index, - PyByteArray_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) - return PyByteArray_FromStringAndSize("", 0); - else if (step == 1) { - return PyByteArray_FromStringAndSize(self->ob_bytes + start, - slicelength); - } - else { - char *source_buf = PyByteArray_AS_STRING(self); - char *result_buf = (char *)PyMem_Malloc(slicelength); - PyObject *result; - - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - result = PyByteArray_FromStringAndSize(result_buf, slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_SetString(PyExc_TypeError, "bytearray indices must be integers"); - return NULL; - } -} - -static int -bytearray_setslice(PyByteArrayObject *self, Py_ssize_t lo, Py_ssize_t hi, - PyObject *values) -{ - Py_ssize_t avail, needed; - void *bytes; - Py_buffer vbytes; - int res = 0; - - vbytes.len = -1; - if (values == (PyObject *)self) { - /* Make a copy and call this function recursively */ - int err; - values = PyByteArray_FromObject(values); - if (values == NULL) - return -1; - err = bytearray_setslice(self, lo, hi, values); - Py_DECREF(values); - return err; - } - if (values == NULL) { - /* del b[lo:hi] */ - bytes = NULL; - needed = 0; - } - else { - if (_getbuffer(values, &vbytes) < 0) { - PyErr_Format(PyExc_TypeError, - "can't set bytearray slice from %.100s", - Py_TYPE(values)->tp_name); - return -1; - } - needed = vbytes.len; - bytes = vbytes.buf; - } - - if (lo < 0) - lo = 0; - if (hi < lo) - hi = lo; - if (hi > Py_SIZE(self)) - hi = Py_SIZE(self); - - avail = hi - lo; - if (avail < 0) - lo = hi = avail = 0; - - if (avail != needed) { - if (avail > needed) { - if (!_canresize(self)) { - res = -1; - goto finish; - } - /* - 0 lo hi old_size - | |<----avail----->|<-----tomove------>| - | |<-needed->|<-----tomove------>| - 0 lo new_hi new_size - */ - memmove(self->ob_bytes + lo + needed, self->ob_bytes + hi, - Py_SIZE(self) - hi); - } - /* XXX(nnorwitz): need to verify this can't overflow! */ - if (PyByteArray_Resize((PyObject *)self, - Py_SIZE(self) + needed - avail) < 0) { - res = -1; - goto finish; - } - if (avail < needed) { - /* - 0 lo hi old_size - | |<-avail->|<-----tomove------>| - | |<----needed---->|<-----tomove------>| - 0 lo new_hi new_size - */ - memmove(self->ob_bytes + lo + needed, self->ob_bytes + hi, - Py_SIZE(self) - lo - needed); - } - } - - if (needed > 0) - memcpy(self->ob_bytes + lo, bytes, needed); - - - finish: - if (vbytes.len != -1) - PyBuffer_Release(&vbytes); - return res; -} - -static int -bytearray_setitem(PyByteArrayObject *self, Py_ssize_t i, PyObject *value) -{ - int ival; - - if (i < 0) - i += Py_SIZE(self); - - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); - return -1; - } - - if (value == NULL) - return bytearray_setslice(self, i, i+1, NULL); - - if (!_getbytevalue(value, &ival)) - return -1; - - self->ob_bytes[i] = ival; - return 0; -} - -static int -bytearray_ass_subscript(PyByteArrayObject *self, PyObject *index, PyObject *values) -{ - Py_ssize_t start, stop, step, slicelen, needed; - char *bytes; - - if (PyIndex_Check(index)) { - Py_ssize_t i = PyNumber_AsSsize_t(index, PyExc_IndexError); - - if (i == -1 && PyErr_Occurred()) - return -1; - - if (i < 0) - i += PyByteArray_GET_SIZE(self); - - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "bytearray index out of range"); - return -1; - } - - if (values == NULL) { - /* Fall through to slice assignment */ - start = i; - stop = i + 1; - step = 1; - slicelen = 1; - } - else { - int ival; - if (!_getbytevalue(values, &ival)) - return -1; - self->ob_bytes[i] = (char)ival; - return 0; - } - } - else if (PySlice_Check(index)) { - if (PySlice_GetIndicesEx((PySliceObject *)index, - PyByteArray_GET_SIZE(self), - &start, &stop, &step, &slicelen) < 0) { - return -1; - } - } - else { - PyErr_SetString(PyExc_TypeError, "bytearray indices must be integer"); - return -1; - } - - if (values == NULL) { - bytes = NULL; - needed = 0; - } - else if (values == (PyObject *)self || !PyByteArray_Check(values)) { - int err; - if (PyNumber_Check(values) || PyUnicode_Check(values)) { - PyErr_SetString(PyExc_TypeError, - "can assign only bytes, buffers, or iterables " - "of ints in range(0, 256)"); - return -1; - } - /* Make a copy and call this function recursively */ - values = PyByteArray_FromObject(values); - if (values == NULL) - return -1; - err = bytearray_ass_subscript(self, index, values); - Py_DECREF(values); - return err; - } - else { - assert(PyByteArray_Check(values)); - bytes = ((PyByteArrayObject *)values)->ob_bytes; - needed = Py_SIZE(values); - } - /* Make sure b[5:2] = ... inserts before 5, not before 2. */ - if ((step < 0 && start < stop) || - (step > 0 && start > stop)) - stop = start; - if (step == 1) { - if (slicelen != needed) { - if (!_canresize(self)) - return -1; - if (slicelen > needed) { - /* - 0 start stop old_size - | |<---slicelen--->|<-----tomove------>| - | |<-needed->|<-----tomove------>| - 0 lo new_hi new_size - */ - memmove(self->ob_bytes + start + needed, self->ob_bytes + stop, - Py_SIZE(self) - stop); - } - if (PyByteArray_Resize((PyObject *)self, - Py_SIZE(self) + needed - slicelen) < 0) - return -1; - if (slicelen < needed) { - /* - 0 lo hi old_size - | |<-avail->|<-----tomove------>| - | |<----needed---->|<-----tomove------>| - 0 lo new_hi new_size - */ - memmove(self->ob_bytes + start + needed, self->ob_bytes + stop, - Py_SIZE(self) - start - needed); - } - } - - if (needed > 0) - memcpy(self->ob_bytes + start, bytes, needed); - - return 0; - } - else { - if (needed == 0) { - /* Delete slice */ - size_t cur; - Py_ssize_t i; - - if (!_canresize(self)) - return -1; - if (step < 0) { - stop = start + 1; - start = stop + step * (slicelen - 1) - 1; - step = -step; - } - for (cur = start, i = 0; - i < slicelen; cur += step, i++) { - Py_ssize_t lim = step - 1; - - if (cur + step >= (size_t)PyByteArray_GET_SIZE(self)) - lim = PyByteArray_GET_SIZE(self) - cur - 1; - - memmove(self->ob_bytes + cur - i, - self->ob_bytes + cur + 1, lim); - } - /* Move the tail of the bytes, in one chunk */ - cur = start + slicelen*step; - if (cur < (size_t)PyByteArray_GET_SIZE(self)) { - memmove(self->ob_bytes + cur - slicelen, - self->ob_bytes + cur, - PyByteArray_GET_SIZE(self) - cur); - } - if (PyByteArray_Resize((PyObject *)self, - PyByteArray_GET_SIZE(self) - slicelen) < 0) - return -1; - - return 0; - } - else { - /* Assign slice */ - Py_ssize_t cur, i; - - if (needed != slicelen) { - PyErr_Format(PyExc_ValueError, - "attempt to assign bytes of size %zd " - "to extended slice of size %zd", - needed, slicelen); - return -1; - } - for (cur = start, i = 0; i < slicelen; cur += step, i++) - self->ob_bytes[cur] = bytes[i]; - return 0; - } - } -} - -static int -bytearray_init(PyByteArrayObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"source", "encoding", "errors", 0}; - PyObject *arg = NULL; - const char *encoding = NULL; - const char *errors = NULL; - Py_ssize_t count; - PyObject *it; - PyObject *(*iternext)(PyObject *); - - if (Py_SIZE(self) != 0) { - /* Empty previous contents (yes, do this first of all!) */ - if (PyByteArray_Resize((PyObject *)self, 0) < 0) - return -1; - } - - /* Parse arguments */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:bytearray", kwlist, - &arg, &encoding, &errors)) - return -1; - - /* Make a quick exit if no first argument */ - if (arg == NULL) { - if (encoding != NULL || errors != NULL) { - PyErr_SetString(PyExc_TypeError, - "encoding or errors without sequence argument"); - return -1; - } - return 0; - } - - if (PyBytes_Check(arg)) { - PyObject *new, *encoded; - if (encoding != NULL) { - encoded = PyCodec_Encode(arg, encoding, errors); - if (encoded == NULL) - return -1; - assert(PyBytes_Check(encoded)); - } - else { - encoded = arg; - Py_INCREF(arg); - } - new = bytearray_iconcat(self, arg); - Py_DECREF(encoded); - if (new == NULL) - return -1; - Py_DECREF(new); - return 0; - } - -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(arg)) { - /* Encode via the codec registry */ - PyObject *encoded, *new; - if (encoding == NULL) { - PyErr_SetString(PyExc_TypeError, - "unicode argument without an encoding"); - return -1; - } - encoded = PyCodec_Encode(arg, encoding, errors); - if (encoded == NULL) - return -1; - assert(PyBytes_Check(encoded)); - new = bytearray_iconcat(self, encoded); - Py_DECREF(encoded); - if (new == NULL) - return -1; - Py_DECREF(new); - return 0; - } -#endif - - /* If it's not unicode, there can't be encoding or errors */ - if (encoding != NULL || errors != NULL) { - PyErr_SetString(PyExc_TypeError, - "encoding or errors without a string argument"); - return -1; - } - - /* Is it an int? */ - count = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (count == -1 && PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - return -1; - PyErr_Clear(); - } - else if (count < 0) { - PyErr_SetString(PyExc_ValueError, "negative count"); - return -1; - } - else { - if (count > 0) { - if (PyByteArray_Resize((PyObject *)self, count)) - return -1; - memset(self->ob_bytes, 0, count); - } - return 0; - } - - /* Use the buffer API */ - if (PyObject_CheckBuffer(arg)) { - Py_ssize_t size; - Py_buffer view; - if (PyObject_GetBuffer(arg, &view, PyBUF_FULL_RO) < 0) - return -1; - size = view.len; - if (PyByteArray_Resize((PyObject *)self, size) < 0) goto fail; - if (PyBuffer_ToContiguous(self->ob_bytes, &view, size, 'C') < 0) - goto fail; - PyBuffer_Release(&view); - return 0; - fail: - PyBuffer_Release(&view); - return -1; - } - - /* XXX Optimize this if the arguments is a list, tuple */ - - /* Get the iterator */ - it = PyObject_GetIter(arg); - if (it == NULL) - return -1; - iternext = *Py_TYPE(it)->tp_iternext; - - /* Run the iterator to exhaustion */ - for (;;) { - PyObject *item; - int rc, value; - - /* Get the next item */ - item = iternext(it); - if (item == NULL) { - if (PyErr_Occurred()) { - if (!PyErr_ExceptionMatches(PyExc_StopIteration)) - goto error; - PyErr_Clear(); - } - break; - } - - /* Interpret it as an int (__index__) */ - rc = _getbytevalue(item, &value); - Py_DECREF(item); - if (!rc) - goto error; - - /* Append the byte */ - if (Py_SIZE(self) < self->ob_alloc) - Py_SIZE(self)++; - else if (PyByteArray_Resize((PyObject *)self, Py_SIZE(self)+1) < 0) - goto error; - self->ob_bytes[Py_SIZE(self)-1] = value; - } - - /* Clean up and return success */ - Py_DECREF(it); - return 0; - - error: - /* Error handling when it != NULL */ - Py_DECREF(it); - return -1; -} - -/* Mostly copied from string_repr, but without the - "smart quote" functionality. */ -static PyObject * -bytearray_repr(PyByteArrayObject *self) -{ - static const char *hexdigits = "0123456789abcdef"; - const char *quote_prefix = "bytearray(b"; - const char *quote_postfix = ")"; - Py_ssize_t length = Py_SIZE(self); - /* 14 == strlen(quote_prefix) + 2 + strlen(quote_postfix) */ - size_t newsize; - PyObject *v; - if (length > (PY_SSIZE_T_MAX - 14) / 4) { - PyErr_SetString(PyExc_OverflowError, - "bytearray object is too large to make repr"); - return NULL; - } - newsize = 14 + 4 * length; - v = PyString_FromStringAndSize(NULL, newsize); - if (v == NULL) { - return NULL; - } - else { - register Py_ssize_t i; - register char c; - register char *p; - int quote; - - /* Figure out which quote to use; single is preferred */ - quote = '\''; - { - char *test, *start; - start = PyByteArray_AS_STRING(self); - for (test = start; test < start+length; ++test) { - if (*test == '"') { - quote = '\''; /* back to single */ - goto decided; - } - else if (*test == '\'') - quote = '"'; - } - decided: - ; - } - - p = PyString_AS_STRING(v); - while (*quote_prefix) - *p++ = *quote_prefix++; - *p++ = quote; - - for (i = 0; i < length; i++) { - /* There's at least enough room for a hex escape - and a closing quote. */ - assert(newsize - (p - PyString_AS_STRING(v)) >= 5); - c = self->ob_bytes[i]; - if (c == '\'' || c == '\\') - *p++ = '\\', *p++ = c; - else if (c == '\t') - *p++ = '\\', *p++ = 't'; - else if (c == '\n') - *p++ = '\\', *p++ = 'n'; - else if (c == '\r') - *p++ = '\\', *p++ = 'r'; - else if (c == 0) - *p++ = '\\', *p++ = 'x', *p++ = '0', *p++ = '0'; - else if (c < ' ' || c >= 0x7f) { - *p++ = '\\'; - *p++ = 'x'; - *p++ = hexdigits[(c & 0xf0) >> 4]; - *p++ = hexdigits[c & 0xf]; - } - else - *p++ = c; - } - assert(newsize - (p - PyString_AS_STRING(v)) >= 1); - *p++ = quote; - while (*quote_postfix) { - *p++ = *quote_postfix++; - } - *p = '\0'; - /* v is cleared on error */ - (void)_PyString_Resize(&v, (p - PyString_AS_STRING(v))); - return v; - } -} - -static PyObject * -bytearray_str(PyObject *op) -{ -#if 0 - if (Py_BytesWarningFlag) { - if (PyErr_WarnEx(PyExc_BytesWarning, - "str() on a bytearray instance", 1)) - return NULL; - } - return bytearray_repr((PyByteArrayObject*)op); -#endif - return PyBytes_FromStringAndSize(((PyByteArrayObject*)op)->ob_bytes, Py_SIZE(op)); -} - -static PyObject * -bytearray_richcompare(PyObject *self, PyObject *other, int op) -{ - Py_ssize_t self_size, other_size; - Py_buffer self_bytes, other_bytes; - PyObject *res; - Py_ssize_t minsize; - int cmp; - - /* Bytes can be compared to anything that supports the (binary) - buffer API. Except that a comparison with Unicode is always an - error, even if the comparison is for equality. */ -#ifdef Py_USING_UNICODE - if (PyObject_IsInstance(self, (PyObject*)&PyUnicode_Type) || - PyObject_IsInstance(other, (PyObject*)&PyUnicode_Type)) { - if (Py_BytesWarningFlag && op == Py_EQ) { - if (PyErr_WarnEx(PyExc_BytesWarning, - "Comparison between bytearray and string", 1)) - return NULL; - } - - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } -#endif - - self_size = _getbuffer(self, &self_bytes); - if (self_size < 0) { - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - other_size = _getbuffer(other, &other_bytes); - if (other_size < 0) { - PyErr_Clear(); - PyBuffer_Release(&self_bytes); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - if (self_size != other_size && (op == Py_EQ || op == Py_NE)) { - /* Shortcut: if the lengths differ, the objects differ */ - cmp = (op == Py_NE); - } - else { - minsize = self_size; - if (other_size < minsize) - minsize = other_size; - - cmp = memcmp(self_bytes.buf, other_bytes.buf, minsize); - /* In ISO C, memcmp() guarantees to use unsigned bytes! */ - - if (cmp == 0) { - if (self_size < other_size) - cmp = -1; - else if (self_size > other_size) - cmp = 1; - } - - switch (op) { - case Py_LT: cmp = cmp < 0; break; - case Py_LE: cmp = cmp <= 0; break; - case Py_EQ: cmp = cmp == 0; break; - case Py_NE: cmp = cmp != 0; break; - case Py_GT: cmp = cmp > 0; break; - case Py_GE: cmp = cmp >= 0; break; - } - } - - res = cmp ? Py_True : Py_False; - PyBuffer_Release(&self_bytes); - PyBuffer_Release(&other_bytes); - Py_INCREF(res); - return res; -} - -static void -bytearray_dealloc(PyByteArrayObject *self) -{ - if (self->ob_exports > 0) { - PyErr_SetString(PyExc_SystemError, - "deallocated bytearray object has exported buffers"); - PyErr_Print(); - } - if (self->ob_bytes != 0) { - PyMem_Free(self->ob_bytes); - } - Py_TYPE(self)->tp_free((PyObject *)self); -} - - -/* -------------------------------------------------------------------- */ -/* Methods */ - -#define STRINGLIB_CHAR char -#define STRINGLIB_LEN PyByteArray_GET_SIZE -#define STRINGLIB_STR PyByteArray_AS_STRING -#define STRINGLIB_NEW PyByteArray_FromStringAndSize -#define STRINGLIB_ISSPACE Py_ISSPACE -#define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r')) -#define STRINGLIB_CHECK_EXACT PyByteArray_CheckExact -#define STRINGLIB_MUTABLE 1 - -#include "stringlib/fastsearch.h" -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" -#include "stringlib/split.h" -#include "stringlib/ctype.h" -#include "stringlib/transmogrify.h" - - -/* The following Py_LOCAL_INLINE and Py_LOCAL functions -were copied from the old char* style string object. */ - -/* helper macro to fixup start/end slice values */ -#define ADJUST_INDICES(start, end, len) \ - if (end > len) \ - end = len; \ - else if (end < 0) { \ - end += len; \ - if (end < 0) \ - end = 0; \ - } \ - if (start < 0) { \ - start += len; \ - if (start < 0) \ - start = 0; \ - } - -Py_LOCAL_INLINE(Py_ssize_t) -bytearray_find_internal(PyByteArrayObject *self, PyObject *args, int dir) -{ - PyObject *subobj; - Py_buffer subbuf; - Py_ssize_t start=0, end=PY_SSIZE_T_MAX; - Py_ssize_t res; - - if (!stringlib_parse_args_finds("find/rfind/index/rindex", - args, &subobj, &start, &end)) - return -2; - if (_getbuffer(subobj, &subbuf) < 0) - return -2; - if (dir > 0) - res = stringlib_find_slice( - PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self), - subbuf.buf, subbuf.len, start, end); - else - res = stringlib_rfind_slice( - PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self), - subbuf.buf, subbuf.len, start, end); - PyBuffer_Release(&subbuf); - return res; -} - -PyDoc_STRVAR(find__doc__, -"B.find(sub [,start [,end]]) -> int\n\ -\n\ -Return the lowest index in B where subsection sub is found,\n\ -such that sub is contained within B[start,end]. Optional\n\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -bytearray_find(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t result = bytearray_find_internal(self, args, +1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - -PyDoc_STRVAR(count__doc__, -"B.count(sub [,start [,end]]) -> int\n\ -\n\ -Return the number of non-overlapping occurrences of subsection sub in\n\ -bytes B[start:end]. Optional arguments start and end are interpreted\n\ -as in slice notation."); - -static PyObject * -bytearray_count(PyByteArrayObject *self, PyObject *args) -{ - PyObject *sub_obj; - const char *str = PyByteArray_AS_STRING(self); - Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; - Py_buffer vsub; - PyObject *count_obj; - - if (!stringlib_parse_args_finds("count", args, &sub_obj, &start, &end)) - return NULL; - - if (_getbuffer(sub_obj, &vsub) < 0) - return NULL; - - ADJUST_INDICES(start, end, PyByteArray_GET_SIZE(self)); - - count_obj = PyInt_FromSsize_t( - stringlib_count(str + start, end - start, vsub.buf, vsub.len, PY_SSIZE_T_MAX) - ); - PyBuffer_Release(&vsub); - return count_obj; -} - - -PyDoc_STRVAR(index__doc__, -"B.index(sub [,start [,end]]) -> int\n\ -\n\ -Like B.find() but raise ValueError when the subsection is not found."); - -static PyObject * -bytearray_index(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t result = bytearray_find_internal(self, args, +1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "subsection not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rfind__doc__, -"B.rfind(sub [,start [,end]]) -> int\n\ -\n\ -Return the highest index in B where subsection sub is found,\n\ -such that sub is contained within B[start,end]. Optional\n\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -bytearray_rfind(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t result = bytearray_find_internal(self, args, -1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rindex__doc__, -"B.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like B.rfind() but raise ValueError when the subsection is not found."); - -static PyObject * -bytearray_rindex(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t result = bytearray_find_internal(self, args, -1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "subsection not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -static int -bytearray_contains(PyObject *self, PyObject *arg) -{ - Py_ssize_t ival = PyNumber_AsSsize_t(arg, PyExc_ValueError); - if (ival == -1 && PyErr_Occurred()) { - Py_buffer varg; - int pos; - PyErr_Clear(); - if (_getbuffer(arg, &varg) < 0) - return -1; - pos = stringlib_find(PyByteArray_AS_STRING(self), Py_SIZE(self), - varg.buf, varg.len, 0); - PyBuffer_Release(&varg); - return pos >= 0; - } - if (ival < 0 || ival >= 256) { - PyErr_SetString(PyExc_ValueError, "byte must be in range(0, 256)"); - return -1; - } - - return memchr(PyByteArray_AS_STRING(self), ival, Py_SIZE(self)) != NULL; -} - - -/* Matches the end (direction >= 0) or start (direction < 0) of self - * against substr, using the start and end arguments. Returns - * -1 on error, 0 if not found and 1 if found. - */ -Py_LOCAL(int) -_bytearray_tailmatch(PyByteArrayObject *self, PyObject *substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - Py_ssize_t len = PyByteArray_GET_SIZE(self); - const char* str; - Py_buffer vsubstr; - int rv = 0; - - str = PyByteArray_AS_STRING(self); - - if (_getbuffer(substr, &vsubstr) < 0) - return -1; - - ADJUST_INDICES(start, end, len); - - if (direction < 0) { - /* startswith */ - if (start+vsubstr.len > len) { - goto done; - } - } else { - /* endswith */ - if (end-start < vsubstr.len || start > len) { - goto done; - } - - if (end-vsubstr.len > start) - start = end - vsubstr.len; - } - if (end-start >= vsubstr.len) - rv = ! memcmp(str+start, vsubstr.buf, vsubstr.len); - -done: - PyBuffer_Release(&vsubstr); - return rv; -} - - -PyDoc_STRVAR(startswith__doc__, -"B.startswith(prefix [,start [,end]]) -> bool\n\ -\n\ -Return True if B starts with the specified prefix, False otherwise.\n\ -With optional start, test B beginning at that position.\n\ -With optional end, stop comparing B at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -bytearray_startswith(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end)) - return NULL; - if (PyTuple_Check(subobj)) { - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { - result = _bytearray_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, -1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _bytearray_tailmatch(self, subobj, start, end, -1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - -PyDoc_STRVAR(endswith__doc__, -"B.endswith(suffix [,start [,end]]) -> bool\n\ -\n\ -Return True if B ends with the specified suffix, False otherwise.\n\ -With optional start, test B beginning at that position.\n\ -With optional end, stop comparing B at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -bytearray_endswith(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end)) - return NULL; - if (PyTuple_Check(subobj)) { - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { - result = _bytearray_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, +1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _bytearray_tailmatch(self, subobj, start, end, +1); - if (result == -1) - return NULL; - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(translate__doc__, -"B.translate(table[, deletechars]) -> bytearray\n\ -\n\ -Return a copy of B, where all characters occurring in the\n\ -optional argument deletechars are removed, and the remaining\n\ -characters have been mapped through the given translation\n\ -table, which must be a bytes object of length 256."); - -static PyObject * -bytearray_translate(PyByteArrayObject *self, PyObject *args) -{ - register char *input, *output; - register const char *table; - register Py_ssize_t i, c; - PyObject *input_obj = (PyObject*)self; - const char *output_start; - Py_ssize_t inlen; - PyObject *result = NULL; - int trans_table[256]; - PyObject *tableobj = NULL, *delobj = NULL; - Py_buffer vtable, vdel; - - if (!PyArg_UnpackTuple(args, "translate", 1, 2, - &tableobj, &delobj)) - return NULL; - - if (tableobj == Py_None) { - table = NULL; - tableobj = NULL; - } else if (_getbuffer(tableobj, &vtable) < 0) { - return NULL; - } else { - if (vtable.len != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - PyBuffer_Release(&vtable); - return NULL; - } - table = (const char*)vtable.buf; - } - - if (delobj != NULL) { - if (_getbuffer(delobj, &vdel) < 0) { - if (tableobj != NULL) - PyBuffer_Release(&vtable); - return NULL; - } - } - else { - vdel.buf = NULL; - vdel.len = 0; - } - - inlen = PyByteArray_GET_SIZE(input_obj); - result = PyByteArray_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - goto done; - output_start = output = PyByteArray_AsString(result); - input = PyByteArray_AS_STRING(input_obj); - - if (vdel.len == 0 && table != NULL) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - *output++ = table[c]; - } - goto done; - } - - if (table == NULL) { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(i); - } else { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - } - - for (i = 0; i < vdel.len; i++) - trans_table[(int) Py_CHARMASK( ((unsigned char*)vdel.buf)[i] )] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - } - /* Fix the size of the resulting string */ - if (inlen > 0) - PyByteArray_Resize(result, output - output_start); - -done: - if (tableobj != NULL) - PyBuffer_Release(&vtable); - if (delobj != NULL) - PyBuffer_Release(&vdel); - return result; -} - - -/* find and count characters and substrings */ - -#define findchar(target, target_len, c) \ - ((char *)memchr((const void *)(target), c, target_len)) - - -/* Bytes ops must return a string, create a copy */ -Py_LOCAL(PyByteArrayObject *) -return_self(PyByteArrayObject *self) -{ - return (PyByteArrayObject *)PyByteArray_FromStringAndSize( - PyByteArray_AS_STRING(self), - PyByteArray_GET_SIZE(self)); -} - -Py_LOCAL_INLINE(Py_ssize_t) -countchar(const char *target, Py_ssize_t target_len, char c, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - const char *start=target; - const char *end=target+target_len; - - while ( (start=findchar(start, end-start, c)) != NULL ) { - count++; - if (count >= maxcount) - break; - start += 1; - } - return count; -} - - -/* Algorithms for different cases of string replacement */ - -/* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyByteArrayObject *) -replace_interleave(PyByteArrayObject *self, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - Py_ssize_t self_len, result_len; - Py_ssize_t count, i, product; - PyByteArrayObject *result; - - self_len = PyByteArray_GET_SIZE(self); - - /* 1 at the end plus 1 after every character */ - count = self_len+1; - if (maxcount < count) - count = maxcount; - - /* Check for overflow */ - /* result_len = count * to_len + self_len; */ - product = count * to_len; - if (product / to_len != count) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - result_len = product + self_len; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - - if (! (result = (PyByteArrayObject *) - PyByteArray_FromStringAndSize(NULL, result_len)) ) - return NULL; - - self_s = PyByteArray_AS_STRING(self); - result_s = PyByteArray_AS_STRING(result); - - /* TODO: special case single character, which doesn't need memcpy */ - - /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - count -= 1; - - for (i=0; i=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyByteArrayObject *) -replace_delete_single_character(PyByteArrayObject *self, - char from_c, Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count; - PyByteArrayObject *result; - - self_len = PyByteArray_GET_SIZE(self); - self_s = PyByteArray_AS_STRING(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - return return_self(self); - } - - result_len = self_len - count; /* from_len == 1 */ - assert(result_len>=0); - - if ( (result = (PyByteArrayObject *) - PyByteArray_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyByteArray_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - start = next+1; - } - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ - -Py_LOCAL(PyByteArrayObject *) -replace_delete_substring(PyByteArrayObject *self, - const char *from_s, Py_ssize_t from_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset; - PyByteArrayObject *result; - - self_len = PyByteArray_GET_SIZE(self); - self_s = PyByteArray_AS_STRING(self); - - count = stringlib_count(self_s, self_len, - from_s, from_len, - maxcount); - - if (count == 0) { - /* no matches */ - return return_self(self); - } - - result_len = self_len - (count * from_len); - assert (result_len>=0); - - if ( (result = (PyByteArrayObject *) - PyByteArray_FromStringAndSize(NULL, result_len)) == NULL ) - return NULL; - - result_s = PyByteArray_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = stringlib_find(start, end-start, - from_s, from_len, - 0); - if (offset == -1) - break; - next = start + offset; - - Py_MEMCPY(result_s, start, next-start); - - result_s += (next-start); - start = next+from_len; - } - Py_MEMCPY(result_s, start, end-start); - return result; -} - -/* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyByteArrayObject *) -replace_single_character_in_place(PyByteArrayObject *self, - char from_c, char to_c, - Py_ssize_t maxcount) -{ - char *self_s, *result_s, *start, *end, *next; - Py_ssize_t self_len; - PyByteArrayObject *result; - - /* The result string will be the same size */ - self_s = PyByteArray_AS_STRING(self); - self_len = PyByteArray_GET_SIZE(self); - - next = findchar(self_s, self_len, from_c); - - if (next == NULL) { - /* No matches; return the original bytes */ - return return_self(self); - } - - /* Need to make a new bytes */ - result = (PyByteArrayObject *) PyByteArray_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyByteArray_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + (next-self_s); - *start = to_c; - start++; - end = result_s + self_len; - - while (--maxcount > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - *next = to_c; - start = next+1; - } - - return result; -} - -/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyByteArrayObject *) -replace_substring_in_place(PyByteArrayObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *result_s, *start, *end; - char *self_s; - Py_ssize_t self_len, offset; - PyByteArrayObject *result; - - /* The result bytes will be the same size */ - - self_s = PyByteArray_AS_STRING(self); - self_len = PyByteArray_GET_SIZE(self); - - offset = stringlib_find(self_s, self_len, - from_s, from_len, - 0); - if (offset == -1) { - /* No matches; return the original bytes */ - return return_self(self); - } - - /* Need to make a new bytes */ - result = (PyByteArrayObject *) PyByteArray_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyByteArray_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); - start += from_len; - end = result_s + self_len; - - while ( --maxcount > 0) { - offset = stringlib_find(start, end-start, - from_s, from_len, - 0); - if (offset==-1) - break; - Py_MEMCPY(start+offset, to_s, from_len); - start += offset+from_len; - } - - return result; -} - -/* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyByteArrayObject *) -replace_single_character(PyByteArrayObject *self, - char from_c, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, product; - PyByteArrayObject *result; - - self_s = PyByteArray_AS_STRING(self); - self_len = PyByteArray_GET_SIZE(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* use the difference between current and new, hence the "-1" */ - /* result_len = self_len + count * (to_len-1) */ - product = count * (to_len-1); - if (product / (to_len-1) != count) { - PyErr_SetString(PyExc_OverflowError, "replace bytes is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace bytes is too long"); - return NULL; - } - - if ( (result = (PyByteArrayObject *) - PyByteArray_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyByteArray_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += 1; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+1; - } - } - /* Copy the remainder of the remaining bytes */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyByteArrayObject *) -replace_substring(PyByteArrayObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset, product; - PyByteArrayObject *result; - - self_s = PyByteArray_AS_STRING(self); - self_len = PyByteArray_GET_SIZE(self); - - count = stringlib_count(self_s, self_len, - from_s, from_len, - maxcount); - - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* Check for overflow */ - /* result_len = self_len + count * (to_len-from_len) */ - product = count * (to_len-from_len); - if (product / (to_len-from_len) != count) { - PyErr_SetString(PyExc_OverflowError, "replace bytes is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace bytes is too long"); - return NULL; - } - - if ( (result = (PyByteArrayObject *) - PyByteArray_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyByteArray_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = stringlib_find(start, end-start, - from_s, from_len, - 0); - if (offset == -1) - break; - next = start+offset; - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += from_len; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+from_len; - } - } - /* Copy the remainder of the remaining bytes */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - - -Py_LOCAL(PyByteArrayObject *) -replace(PyByteArrayObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - if (maxcount < 0) { - maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyByteArray_GET_SIZE(self) == 0) { - /* nothing to do; return the original bytes */ - return return_self(self); - } - - if (maxcount == 0 || - (from_len == 0 && to_len == 0)) { - /* nothing to do; return the original bytes */ - return return_self(self); - } - - /* Handle zero-length special cases */ - - if (from_len == 0) { - /* insert the 'to' bytes everywhere. */ - /* >>> "Python".replace("", ".") */ - /* '.P.y.t.h.o.n.' */ - return replace_interleave(self, to_s, to_len, maxcount); - } - - /* Except for "".replace("", "A") == "A" there is no way beyond this */ - /* point for an empty self bytes to generate a non-empty bytes */ - /* Special case so the remaining code always gets a non-empty bytes */ - if (PyByteArray_GET_SIZE(self) == 0) { - return return_self(self); - } - - if (to_len == 0) { - /* delete all occurances of 'from' bytes */ - if (from_len == 1) { - return replace_delete_single_character( - self, from_s[0], maxcount); - } else { - return replace_delete_substring(self, from_s, from_len, maxcount); - } - } - - /* Handle special case where both bytes have the same length */ - - if (from_len == to_len) { - if (from_len == 1) { - return replace_single_character_in_place( - self, - from_s[0], - to_s[0], - maxcount); - } else { - return replace_substring_in_place( - self, from_s, from_len, to_s, to_len, maxcount); - } - } - - /* Otherwise use the more generic algorithms */ - if (from_len == 1) { - return replace_single_character(self, from_s[0], - to_s, to_len, maxcount); - } else { - /* len('from')>=2, len('to')>=1 */ - return replace_substring(self, from_s, from_len, to_s, to_len, maxcount); - } -} - - -PyDoc_STRVAR(replace__doc__, -"B.replace(old, new[, count]) -> bytes\n\ -\n\ -Return a copy of B with all occurrences of subsection\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject * -bytearray_replace(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t count = -1; - PyObject *from, *to, *res; - Py_buffer vfrom, vto; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) - return NULL; - - if (_getbuffer(from, &vfrom) < 0) - return NULL; - if (_getbuffer(to, &vto) < 0) { - PyBuffer_Release(&vfrom); - return NULL; - } - - res = (PyObject *)replace((PyByteArrayObject *) self, - vfrom.buf, vfrom.len, - vto.buf, vto.len, count); - - PyBuffer_Release(&vfrom); - PyBuffer_Release(&vto); - return res; -} - -PyDoc_STRVAR(split__doc__, -"B.split([sep[, maxsplit]]) -> list of bytearray\n\ -\n\ -Return a list of the sections in B, using sep as the delimiter.\n\ -If sep is not given, B is split on ASCII whitespace characters\n\ -(space, tab, return, newline, formfeed, vertical tab).\n\ -If maxsplit is given, at most maxsplit splits are done."); - -static PyObject * -bytearray_split(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t len = PyByteArray_GET_SIZE(self), n; - Py_ssize_t maxsplit = -1; - const char *s = PyByteArray_AS_STRING(self), *sub; - PyObject *list, *subobj = Py_None; - Py_buffer vsub; - - if (!PyArg_ParseTuple(args, "|On:split", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - - if (subobj == Py_None) - return stringlib_split_whitespace((PyObject*) self, s, len, maxsplit); - - if (_getbuffer(subobj, &vsub) < 0) - return NULL; - sub = vsub.buf; - n = vsub.len; - - list = stringlib_split( - (PyObject*) self, s, len, sub, n, maxsplit - ); - PyBuffer_Release(&vsub); - return list; -} - -PyDoc_STRVAR(partition__doc__, -"B.partition(sep) -> (head, sep, tail)\n\ -\n\ -Searches for the separator sep in B, and returns the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, returns B and two empty bytearray objects."); - -static PyObject * -bytearray_partition(PyByteArrayObject *self, PyObject *sep_obj) -{ - PyObject *bytesep, *result; - - bytesep = PyByteArray_FromObject(sep_obj); - if (! bytesep) - return NULL; - - result = stringlib_partition( - (PyObject*) self, - PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self), - bytesep, - PyByteArray_AS_STRING(bytesep), PyByteArray_GET_SIZE(bytesep) - ); - - Py_DECREF(bytesep); - return result; -} - -PyDoc_STRVAR(rpartition__doc__, -"B.rpartition(sep) -> (head, sep, tail)\n\ -\n\ -Searches for the separator sep in B, starting at the end of B,\n\ -and returns the part before it, the separator itself, and the\n\ -part after it. If the separator is not found, returns two empty\n\ -bytearray objects and B."); - -static PyObject * -bytearray_rpartition(PyByteArrayObject *self, PyObject *sep_obj) -{ - PyObject *bytesep, *result; - - bytesep = PyByteArray_FromObject(sep_obj); - if (! bytesep) - return NULL; - - result = stringlib_rpartition( - (PyObject*) self, - PyByteArray_AS_STRING(self), PyByteArray_GET_SIZE(self), - bytesep, - PyByteArray_AS_STRING(bytesep), PyByteArray_GET_SIZE(bytesep) - ); - - Py_DECREF(bytesep); - return result; -} - -PyDoc_STRVAR(rsplit__doc__, -"B.rsplit(sep[, maxsplit]) -> list of bytearray\n\ -\n\ -Return a list of the sections in B, using sep as the delimiter,\n\ -starting at the end of B and working to the front.\n\ -If sep is not given, B is split on ASCII whitespace characters\n\ -(space, tab, return, newline, formfeed, vertical tab).\n\ -If maxsplit is given, at most maxsplit splits are done."); - -static PyObject * -bytearray_rsplit(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t len = PyByteArray_GET_SIZE(self), n; - Py_ssize_t maxsplit = -1; - const char *s = PyByteArray_AS_STRING(self), *sub; - PyObject *list, *subobj = Py_None; - Py_buffer vsub; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - - if (subobj == Py_None) - return stringlib_rsplit_whitespace((PyObject*) self, s, len, maxsplit); - - if (_getbuffer(subobj, &vsub) < 0) - return NULL; - sub = vsub.buf; - n = vsub.len; - - list = stringlib_rsplit( - (PyObject*) self, s, len, sub, n, maxsplit - ); - PyBuffer_Release(&vsub); - return list; -} - -PyDoc_STRVAR(reverse__doc__, -"B.reverse() -> None\n\ -\n\ -Reverse the order of the values in B in place."); -static PyObject * -bytearray_reverse(PyByteArrayObject *self, PyObject *unused) -{ - char swap, *head, *tail; - Py_ssize_t i, j, n = Py_SIZE(self); - - j = n / 2; - head = self->ob_bytes; - tail = head + n - 1; - for (i = 0; i < j; i++) { - swap = *head; - *head++ = *tail; - *tail-- = swap; - } - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(insert__doc__, -"B.insert(index, int) -> None\n\ -\n\ -Insert a single item into the bytearray before the given index."); -static PyObject * -bytearray_insert(PyByteArrayObject *self, PyObject *args) -{ - PyObject *value; - int ival; - Py_ssize_t where, n = Py_SIZE(self); - - if (!PyArg_ParseTuple(args, "nO:insert", &where, &value)) - return NULL; - - if (n == PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "cannot add more objects to bytearray"); - return NULL; - } - if (!_getbytevalue(value, &ival)) - return NULL; - if (PyByteArray_Resize((PyObject *)self, n + 1) < 0) - return NULL; - - if (where < 0) { - where += n; - if (where < 0) - where = 0; - } - if (where > n) - where = n; - memmove(self->ob_bytes + where + 1, self->ob_bytes + where, n - where); - self->ob_bytes[where] = ival; - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(append__doc__, -"B.append(int) -> None\n\ -\n\ -Append a single item to the end of B."); -static PyObject * -bytearray_append(PyByteArrayObject *self, PyObject *arg) -{ - int value; - Py_ssize_t n = Py_SIZE(self); - - if (! _getbytevalue(arg, &value)) - return NULL; - if (n == PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "cannot add more objects to bytearray"); - return NULL; - } - if (PyByteArray_Resize((PyObject *)self, n + 1) < 0) - return NULL; - - self->ob_bytes[n] = value; - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(extend__doc__, -"B.extend(iterable int) -> None\n\ -\n\ -Append all the elements from the iterator or sequence to the\n\ -end of B."); -static PyObject * -bytearray_extend(PyByteArrayObject *self, PyObject *arg) -{ - PyObject *it, *item, *bytearray_obj; - Py_ssize_t buf_size = 0, len = 0; - int value; - char *buf; - - /* bytearray_setslice code only accepts something supporting PEP 3118. */ - if (PyObject_CheckBuffer(arg)) { - if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), arg) == -1) - return NULL; - - Py_RETURN_NONE; - } - - it = PyObject_GetIter(arg); - if (it == NULL) - return NULL; - - /* Try to determine the length of the argument. 32 is arbitrary. */ - buf_size = _PyObject_LengthHint(arg, 32); - if (buf_size == -1) { - Py_DECREF(it); - return NULL; - } - - bytearray_obj = PyByteArray_FromStringAndSize(NULL, buf_size); - if (bytearray_obj == NULL) { - Py_DECREF(it); - return NULL; - } - buf = PyByteArray_AS_STRING(bytearray_obj); - - while ((item = PyIter_Next(it)) != NULL) { - if (! _getbytevalue(item, &value)) { - Py_DECREF(item); - Py_DECREF(it); - Py_DECREF(bytearray_obj); - return NULL; - } - buf[len++] = value; - Py_DECREF(item); - - if (len >= buf_size) { - buf_size = len + (len >> 1) + 1; - if (PyByteArray_Resize((PyObject *)bytearray_obj, buf_size) < 0) { - Py_DECREF(it); - Py_DECREF(bytearray_obj); - return NULL; - } - /* Recompute the `buf' pointer, since the resizing operation may - have invalidated it. */ - buf = PyByteArray_AS_STRING(bytearray_obj); - } - } - Py_DECREF(it); - - /* Resize down to exact size. */ - if (PyByteArray_Resize((PyObject *)bytearray_obj, len) < 0) { - Py_DECREF(bytearray_obj); - return NULL; - } - - if (bytearray_setslice(self, Py_SIZE(self), Py_SIZE(self), bytearray_obj) == -1) { - Py_DECREF(bytearray_obj); - return NULL; - } - Py_DECREF(bytearray_obj); - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(pop__doc__, -"B.pop([index]) -> int\n\ -\n\ -Remove and return a single item from B. If no index\n\ -argument is given, will pop the last value."); -static PyObject * -bytearray_pop(PyByteArrayObject *self, PyObject *args) -{ - int value; - Py_ssize_t where = -1, n = Py_SIZE(self); - - if (!PyArg_ParseTuple(args, "|n:pop", &where)) - return NULL; - - if (n == 0) { - PyErr_SetString(PyExc_IndexError, - "pop from empty bytearray"); - return NULL; - } - if (where < 0) - where += Py_SIZE(self); - if (where < 0 || where >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "pop index out of range"); - return NULL; - } - if (!_canresize(self)) - return NULL; - - value = self->ob_bytes[where]; - memmove(self->ob_bytes + where, self->ob_bytes + where + 1, n - where); - if (PyByteArray_Resize((PyObject *)self, n - 1) < 0) - return NULL; - - return PyInt_FromLong((unsigned char)value); -} - -PyDoc_STRVAR(remove__doc__, -"B.remove(int) -> None\n\ -\n\ -Remove the first occurance of a value in B."); -static PyObject * -bytearray_remove(PyByteArrayObject *self, PyObject *arg) -{ - int value; - Py_ssize_t where, n = Py_SIZE(self); - - if (! _getbytevalue(arg, &value)) - return NULL; - - for (where = 0; where < n; where++) { - if (self->ob_bytes[where] == value) - break; - } - if (where == n) { - PyErr_SetString(PyExc_ValueError, "value not found in bytearray"); - return NULL; - } - if (!_canresize(self)) - return NULL; - - memmove(self->ob_bytes + where, self->ob_bytes + where + 1, n - where); - if (PyByteArray_Resize((PyObject *)self, n - 1) < 0) - return NULL; - - Py_RETURN_NONE; -} - -/* XXX These two helpers could be optimized if argsize == 1 */ - -static Py_ssize_t -lstrip_helper(unsigned char *myptr, Py_ssize_t mysize, - void *argptr, Py_ssize_t argsize) -{ - Py_ssize_t i = 0; - while (i < mysize && memchr(argptr, myptr[i], argsize)) - i++; - return i; -} - -static Py_ssize_t -rstrip_helper(unsigned char *myptr, Py_ssize_t mysize, - void *argptr, Py_ssize_t argsize) -{ - Py_ssize_t i = mysize - 1; - while (i >= 0 && memchr(argptr, myptr[i], argsize)) - i--; - return i + 1; -} - -PyDoc_STRVAR(strip__doc__, -"B.strip([bytes]) -> bytearray\n\ -\n\ -Strip leading and trailing bytes contained in the argument.\n\ -If the argument is omitted, strip ASCII whitespace."); -static PyObject * -bytearray_strip(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t left, right, mysize, argsize; - void *myptr, *argptr; - PyObject *arg = Py_None; - Py_buffer varg; - if (!PyArg_ParseTuple(args, "|O:strip", &arg)) - return NULL; - if (arg == Py_None) { - argptr = "\t\n\r\f\v "; - argsize = 6; - } - else { - if (_getbuffer(arg, &varg) < 0) - return NULL; - argptr = varg.buf; - argsize = varg.len; - } - myptr = self->ob_bytes; - mysize = Py_SIZE(self); - left = lstrip_helper(myptr, mysize, argptr, argsize); - if (left == mysize) - right = left; - else - right = rstrip_helper(myptr, mysize, argptr, argsize); - if (arg != Py_None) - PyBuffer_Release(&varg); - return PyByteArray_FromStringAndSize(self->ob_bytes + left, right - left); -} - -PyDoc_STRVAR(lstrip__doc__, -"B.lstrip([bytes]) -> bytearray\n\ -\n\ -Strip leading bytes contained in the argument.\n\ -If the argument is omitted, strip leading ASCII whitespace."); -static PyObject * -bytearray_lstrip(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t left, right, mysize, argsize; - void *myptr, *argptr; - PyObject *arg = Py_None; - Py_buffer varg; - if (!PyArg_ParseTuple(args, "|O:lstrip", &arg)) - return NULL; - if (arg == Py_None) { - argptr = "\t\n\r\f\v "; - argsize = 6; - } - else { - if (_getbuffer(arg, &varg) < 0) - return NULL; - argptr = varg.buf; - argsize = varg.len; - } - myptr = self->ob_bytes; - mysize = Py_SIZE(self); - left = lstrip_helper(myptr, mysize, argptr, argsize); - right = mysize; - if (arg != Py_None) - PyBuffer_Release(&varg); - return PyByteArray_FromStringAndSize(self->ob_bytes + left, right - left); -} - -PyDoc_STRVAR(rstrip__doc__, -"B.rstrip([bytes]) -> bytearray\n\ -\n\ -Strip trailing bytes contained in the argument.\n\ -If the argument is omitted, strip trailing ASCII whitespace."); -static PyObject * -bytearray_rstrip(PyByteArrayObject *self, PyObject *args) -{ - Py_ssize_t left, right, mysize, argsize; - void *myptr, *argptr; - PyObject *arg = Py_None; - Py_buffer varg; - if (!PyArg_ParseTuple(args, "|O:rstrip", &arg)) - return NULL; - if (arg == Py_None) { - argptr = "\t\n\r\f\v "; - argsize = 6; - } - else { - if (_getbuffer(arg, &varg) < 0) - return NULL; - argptr = varg.buf; - argsize = varg.len; - } - myptr = self->ob_bytes; - mysize = Py_SIZE(self); - left = 0; - right = rstrip_helper(myptr, mysize, argptr, argsize); - if (arg != Py_None) - PyBuffer_Release(&varg); - return PyByteArray_FromStringAndSize(self->ob_bytes + left, right - left); -} - -PyDoc_STRVAR(decode_doc, -"B.decode([encoding[, errors]]) -> unicode object.\n\ -\n\ -Decodes B using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registered with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -bytearray_decode(PyObject *self, PyObject *args, PyObject *kwargs) -{ - const char *encoding = NULL; - const char *errors = NULL; - static char *kwlist[] = {"encoding", "errors", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", kwlist, &encoding, &errors)) - return NULL; - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - return NULL; -#endif - } - return PyCodec_Decode(self, encoding, errors); -} - -PyDoc_STRVAR(alloc_doc, -"B.__alloc__() -> int\n\ -\n\ -Returns the number of bytes actually allocated."); - -static PyObject * -bytearray_alloc(PyByteArrayObject *self) -{ - return PyInt_FromSsize_t(self->ob_alloc); -} - -PyDoc_STRVAR(join_doc, -"B.join(iterable_of_bytes) -> bytes\n\ -\n\ -Concatenates any number of bytearray objects, with B in between each pair."); - -static PyObject * -bytearray_join(PyByteArrayObject *self, PyObject *it) -{ - PyObject *seq; - Py_ssize_t mysize = Py_SIZE(self); - Py_ssize_t i; - Py_ssize_t n; - PyObject **items; - Py_ssize_t totalsize = 0; - PyObject *result; - char *dest; - - seq = PySequence_Fast(it, "can only join an iterable"); - if (seq == NULL) - return NULL; - n = PySequence_Fast_GET_SIZE(seq); - items = PySequence_Fast_ITEMS(seq); - - /* Compute the total size, and check that they are all bytes */ - /* XXX Shouldn't we use _getbuffer() on these items instead? */ - for (i = 0; i < n; i++) { - PyObject *obj = items[i]; - if (!PyByteArray_Check(obj) && !PyBytes_Check(obj)) { - PyErr_Format(PyExc_TypeError, - "can only join an iterable of bytes " - "(item %ld has type '%.100s')", - /* XXX %ld isn't right on Win64 */ - (long)i, Py_TYPE(obj)->tp_name); - goto error; - } - if (i > 0) - totalsize += mysize; - totalsize += Py_SIZE(obj); - if (totalsize < 0) { - PyErr_NoMemory(); - goto error; - } - } - - /* Allocate the result, and copy the bytes */ - result = PyByteArray_FromStringAndSize(NULL, totalsize); - if (result == NULL) - goto error; - dest = PyByteArray_AS_STRING(result); - for (i = 0; i < n; i++) { - PyObject *obj = items[i]; - Py_ssize_t size = Py_SIZE(obj); - char *buf; - if (PyByteArray_Check(obj)) - buf = PyByteArray_AS_STRING(obj); - else - buf = PyBytes_AS_STRING(obj); - if (i) { - memcpy(dest, self->ob_bytes, mysize); - dest += mysize; - } - memcpy(dest, buf, size); - dest += size; - } - - /* Done */ - Py_DECREF(seq); - return result; - - /* Error handling */ - error: - Py_DECREF(seq); - return NULL; -} - -PyDoc_STRVAR(splitlines__doc__, -"B.splitlines(keepends=False) -> list of lines\n\ -\n\ -Return a list of the lines in B, breaking at line boundaries.\n\ -Line breaks are not included in the resulting list unless keepends\n\ -is given and true."); - -static PyObject* -bytearray_splitlines(PyObject *self, PyObject *args) -{ - int keepends = 0; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - return stringlib_splitlines( - (PyObject*) self, PyByteArray_AS_STRING(self), - PyByteArray_GET_SIZE(self), keepends - ); -} - -PyDoc_STRVAR(fromhex_doc, -"bytearray.fromhex(string) -> bytearray\n\ -\n\ -Create a bytearray object from a string of hexadecimal numbers.\n\ -Spaces between two numbers are accepted.\n\ -Example: bytearray.fromhex('B9 01EF') -> bytearray(b'\\xb9\\x01\\xef')."); - -static int -hex_digit_to_int(char c) -{ - if (Py_ISDIGIT(c)) - return c - '0'; - else { - if (Py_ISUPPER(c)) - c = Py_TOLOWER(c); - if (c >= 'a' && c <= 'f') - return c - 'a' + 10; - } - return -1; -} - -static PyObject * -bytearray_fromhex(PyObject *cls, PyObject *args) -{ - PyObject *newbytes; - char *buf; - char *hex; - Py_ssize_t hexlen, byteslen, i, j; - int top, bot; - - if (!PyArg_ParseTuple(args, "s#:fromhex", &hex, &hexlen)) - return NULL; - byteslen = hexlen/2; /* This overestimates if there are spaces */ - newbytes = PyByteArray_FromStringAndSize(NULL, byteslen); - if (!newbytes) - return NULL; - buf = PyByteArray_AS_STRING(newbytes); - for (i = j = 0; i < hexlen; i += 2) { - /* skip over spaces in the input */ - while (hex[i] == ' ') - i++; - if (i >= hexlen) - break; - top = hex_digit_to_int(hex[i]); - bot = hex_digit_to_int(hex[i+1]); - if (top == -1 || bot == -1) { - PyErr_Format(PyExc_ValueError, - "non-hexadecimal number found in " - "fromhex() arg at position %zd", i); - goto error; - } - buf[j++] = (top << 4) + bot; - } - if (PyByteArray_Resize(newbytes, j) < 0) - goto error; - return newbytes; - - error: - Py_DECREF(newbytes); - return NULL; -} - -PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); - -static PyObject * -bytearray_reduce(PyByteArrayObject *self) -{ - PyObject *latin1, *dict; - if (self->ob_bytes) -#ifdef Py_USING_UNICODE - latin1 = PyUnicode_DecodeLatin1(self->ob_bytes, - Py_SIZE(self), NULL); -#else - latin1 = PyString_FromStringAndSize(self->ob_bytes, Py_SIZE(self)); -#endif - else -#ifdef Py_USING_UNICODE - latin1 = PyUnicode_FromString(""); -#else - latin1 = PyString_FromString(""); -#endif - - dict = PyObject_GetAttrString((PyObject *)self, "__dict__"); - if (dict == NULL) { - PyErr_Clear(); - dict = Py_None; - Py_INCREF(dict); - } - - return Py_BuildValue("(O(Ns)N)", Py_TYPE(self), latin1, "latin-1", dict); -} - -PyDoc_STRVAR(sizeof_doc, -"B.__sizeof__() -> int\n\ - \n\ -Returns the size of B in memory, in bytes"); -static PyObject * -bytearray_sizeof(PyByteArrayObject *self) -{ - Py_ssize_t res; - - res = sizeof(PyByteArrayObject) + self->ob_alloc * sizeof(char); - return PyInt_FromSsize_t(res); -} - -static PySequenceMethods bytearray_as_sequence = { - (lenfunc)bytearray_length, /* sq_length */ - (binaryfunc)PyByteArray_Concat, /* sq_concat */ - (ssizeargfunc)bytearray_repeat, /* sq_repeat */ - (ssizeargfunc)bytearray_getitem, /* sq_item */ - 0, /* sq_slice */ - (ssizeobjargproc)bytearray_setitem, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)bytearray_contains, /* sq_contains */ - (binaryfunc)bytearray_iconcat, /* sq_inplace_concat */ - (ssizeargfunc)bytearray_irepeat, /* sq_inplace_repeat */ -}; - -static PyMappingMethods bytearray_as_mapping = { - (lenfunc)bytearray_length, - (binaryfunc)bytearray_subscript, - (objobjargproc)bytearray_ass_subscript, -}; - -static PyBufferProcs bytearray_as_buffer = { - (readbufferproc)bytearray_buffer_getreadbuf, - (writebufferproc)bytearray_buffer_getwritebuf, - (segcountproc)bytearray_buffer_getsegcount, - (charbufferproc)bytearray_buffer_getcharbuf, - (getbufferproc)bytearray_getbuffer, - (releasebufferproc)bytearray_releasebuffer, -}; - -static PyMethodDef -bytearray_methods[] = { - {"__alloc__", (PyCFunction)bytearray_alloc, METH_NOARGS, alloc_doc}, - {"__reduce__", (PyCFunction)bytearray_reduce, METH_NOARGS, reduce_doc}, - {"__sizeof__", (PyCFunction)bytearray_sizeof, METH_NOARGS, sizeof_doc}, - {"append", (PyCFunction)bytearray_append, METH_O, append__doc__}, - {"capitalize", (PyCFunction)stringlib_capitalize, METH_NOARGS, - _Py_capitalize__doc__}, - {"center", (PyCFunction)stringlib_center, METH_VARARGS, center__doc__}, - {"count", (PyCFunction)bytearray_count, METH_VARARGS, count__doc__}, - {"decode", (PyCFunction)bytearray_decode, METH_VARARGS | METH_KEYWORDS, decode_doc}, - {"endswith", (PyCFunction)bytearray_endswith, METH_VARARGS, endswith__doc__}, - {"expandtabs", (PyCFunction)stringlib_expandtabs, METH_VARARGS, - expandtabs__doc__}, - {"extend", (PyCFunction)bytearray_extend, METH_O, extend__doc__}, - {"find", (PyCFunction)bytearray_find, METH_VARARGS, find__doc__}, - {"fromhex", (PyCFunction)bytearray_fromhex, METH_VARARGS|METH_CLASS, - fromhex_doc}, - {"index", (PyCFunction)bytearray_index, METH_VARARGS, index__doc__}, - {"insert", (PyCFunction)bytearray_insert, METH_VARARGS, insert__doc__}, - {"isalnum", (PyCFunction)stringlib_isalnum, METH_NOARGS, - _Py_isalnum__doc__}, - {"isalpha", (PyCFunction)stringlib_isalpha, METH_NOARGS, - _Py_isalpha__doc__}, - {"isdigit", (PyCFunction)stringlib_isdigit, METH_NOARGS, - _Py_isdigit__doc__}, - {"islower", (PyCFunction)stringlib_islower, METH_NOARGS, - _Py_islower__doc__}, - {"isspace", (PyCFunction)stringlib_isspace, METH_NOARGS, - _Py_isspace__doc__}, - {"istitle", (PyCFunction)stringlib_istitle, METH_NOARGS, - _Py_istitle__doc__}, - {"isupper", (PyCFunction)stringlib_isupper, METH_NOARGS, - _Py_isupper__doc__}, - {"join", (PyCFunction)bytearray_join, METH_O, join_doc}, - {"ljust", (PyCFunction)stringlib_ljust, METH_VARARGS, ljust__doc__}, - {"lower", (PyCFunction)stringlib_lower, METH_NOARGS, _Py_lower__doc__}, - {"lstrip", (PyCFunction)bytearray_lstrip, METH_VARARGS, lstrip__doc__}, - {"partition", (PyCFunction)bytearray_partition, METH_O, partition__doc__}, - {"pop", (PyCFunction)bytearray_pop, METH_VARARGS, pop__doc__}, - {"remove", (PyCFunction)bytearray_remove, METH_O, remove__doc__}, - {"replace", (PyCFunction)bytearray_replace, METH_VARARGS, replace__doc__}, - {"reverse", (PyCFunction)bytearray_reverse, METH_NOARGS, reverse__doc__}, - {"rfind", (PyCFunction)bytearray_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction)bytearray_rindex, METH_VARARGS, rindex__doc__}, - {"rjust", (PyCFunction)stringlib_rjust, METH_VARARGS, rjust__doc__}, - {"rpartition", (PyCFunction)bytearray_rpartition, METH_O, rpartition__doc__}, - {"rsplit", (PyCFunction)bytearray_rsplit, METH_VARARGS, rsplit__doc__}, - {"rstrip", (PyCFunction)bytearray_rstrip, METH_VARARGS, rstrip__doc__}, - {"split", (PyCFunction)bytearray_split, METH_VARARGS, split__doc__}, - {"splitlines", (PyCFunction)bytearray_splitlines, METH_VARARGS, - splitlines__doc__}, - {"startswith", (PyCFunction)bytearray_startswith, METH_VARARGS , - startswith__doc__}, - {"strip", (PyCFunction)bytearray_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction)stringlib_swapcase, METH_NOARGS, - _Py_swapcase__doc__}, - {"title", (PyCFunction)stringlib_title, METH_NOARGS, _Py_title__doc__}, - {"translate", (PyCFunction)bytearray_translate, METH_VARARGS, - translate__doc__}, - {"upper", (PyCFunction)stringlib_upper, METH_NOARGS, _Py_upper__doc__}, - {"zfill", (PyCFunction)stringlib_zfill, METH_VARARGS, zfill__doc__}, - {NULL} -}; - -PyDoc_STRVAR(bytearray_doc, -"bytearray(iterable_of_ints) -> bytearray.\n\ -bytearray(string, encoding[, errors]) -> bytearray.\n\ -bytearray(bytes_or_bytearray) -> mutable copy of bytes_or_bytearray.\n\ -bytearray(memory_view) -> bytearray.\n\ -\n\ -Construct an mutable bytearray object from:\n\ - - an iterable yielding integers in range(256)\n\ - - a text string encoded using the specified encoding\n\ - - a bytes or a bytearray object\n\ - - any object implementing the buffer API.\n\ -\n\ -bytearray(int) -> bytearray.\n\ -\n\ -Construct a zero-initialized bytearray of the given length."); - - -static PyObject *bytearray_iter(PyObject *seq); - -PyTypeObject PyByteArray_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "bytearray", - sizeof(PyByteArrayObject), - 0, - (destructor)bytearray_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)bytearray_repr, /* tp_repr */ - 0, /* tp_as_number */ - &bytearray_as_sequence, /* tp_as_sequence */ - &bytearray_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - bytearray_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &bytearray_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - bytearray_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)bytearray_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - bytearray_iter, /* tp_iter */ - 0, /* tp_iternext */ - bytearray_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)bytearray_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -/*********************** Bytes Iterator ****************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t it_index; - PyByteArrayObject *it_seq; /* Set to NULL when iterator is exhausted */ -} bytesiterobject; - -static void -bytearrayiter_dealloc(bytesiterobject *it) -{ - _PyObject_GC_UNTRACK(it); - Py_XDECREF(it->it_seq); - PyObject_GC_Del(it); -} - -static int -bytearrayiter_traverse(bytesiterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->it_seq); - return 0; -} - -static PyObject * -bytearrayiter_next(bytesiterobject *it) -{ - PyByteArrayObject *seq; - PyObject *item; - - assert(it != NULL); - seq = it->it_seq; - if (seq == NULL) - return NULL; - assert(PyByteArray_Check(seq)); - - if (it->it_index < PyByteArray_GET_SIZE(seq)) { - item = PyInt_FromLong( - (unsigned char)seq->ob_bytes[it->it_index]); - if (item != NULL) - ++it->it_index; - return item; - } - - Py_DECREF(seq); - it->it_seq = NULL; - return NULL; -} - -static PyObject * -bytesarrayiter_length_hint(bytesiterobject *it) -{ - Py_ssize_t len = 0; - if (it->it_seq) - len = PyByteArray_GET_SIZE(it->it_seq) - it->it_index; - return PyInt_FromSsize_t(len); -} - -PyDoc_STRVAR(length_hint_doc, - "Private method returning an estimate of len(list(it))."); - -static PyMethodDef bytearrayiter_methods[] = { - {"__length_hint__", (PyCFunction)bytesarrayiter_length_hint, METH_NOARGS, - length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyByteArrayIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "bytearray_iterator", /* tp_name */ - sizeof(bytesiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)bytearrayiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)bytearrayiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)bytearrayiter_next, /* tp_iternext */ - bytearrayiter_methods, /* tp_methods */ - 0, -}; - -static PyObject * -bytearray_iter(PyObject *seq) -{ - bytesiterobject *it; - - if (!PyByteArray_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_GC_New(bytesiterobject, &PyByteArrayIter_Type); - if (it == NULL) - return NULL; - it->it_index = 0; - Py_INCREF(seq); - it->it_seq = (PyByteArrayObject *)seq; - _PyObject_GC_TRACK(it); - return (PyObject *)it; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/bytes_methods.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/bytes_methods.c deleted file mode 100644 index 28f78cb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/bytes_methods.c +++ /dev/null @@ -1,398 +0,0 @@ -#include "Python.h" -#include "bytes_methods.h" - -PyDoc_STRVAR_shared(_Py_isspace__doc__, -"B.isspace() -> bool\n\ -\n\ -Return True if all characters in B are whitespace\n\ -and there is at least one character in B, False otherwise."); - -PyObject* -_Py_bytes_isspace(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (len == 1 && Py_ISSPACE(*p)) - Py_RETURN_TRUE; - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - for (; p < e; p++) { - if (!Py_ISSPACE(*p)) - Py_RETURN_FALSE; - } - Py_RETURN_TRUE; -} - - -PyDoc_STRVAR_shared(_Py_isalpha__doc__, -"B.isalpha() -> bool\n\ -\n\ -Return True if all characters in B are alphabetic\n\ -and there is at least one character in B, False otherwise."); - -PyObject* -_Py_bytes_isalpha(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (len == 1 && Py_ISALPHA(*p)) - Py_RETURN_TRUE; - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - for (; p < e; p++) { - if (!Py_ISALPHA(*p)) - Py_RETURN_FALSE; - } - Py_RETURN_TRUE; -} - - -PyDoc_STRVAR_shared(_Py_isalnum__doc__, -"B.isalnum() -> bool\n\ -\n\ -Return True if all characters in B are alphanumeric\n\ -and there is at least one character in B, False otherwise."); - -PyObject* -_Py_bytes_isalnum(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (len == 1 && Py_ISALNUM(*p)) - Py_RETURN_TRUE; - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - for (; p < e; p++) { - if (!Py_ISALNUM(*p)) - Py_RETURN_FALSE; - } - Py_RETURN_TRUE; -} - - -PyDoc_STRVAR_shared(_Py_isdigit__doc__, -"B.isdigit() -> bool\n\ -\n\ -Return True if all characters in B are digits\n\ -and there is at least one character in B, False otherwise."); - -PyObject* -_Py_bytes_isdigit(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (len == 1 && Py_ISDIGIT(*p)) - Py_RETURN_TRUE; - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - for (; p < e; p++) { - if (!Py_ISDIGIT(*p)) - Py_RETURN_FALSE; - } - Py_RETURN_TRUE; -} - - -PyDoc_STRVAR_shared(_Py_islower__doc__, -"B.islower() -> bool\n\ -\n\ -Return True if all cased characters in B are lowercase and there is\n\ -at least one cased character in B, False otherwise."); - -PyObject* -_Py_bytes_islower(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (len == 1) - return PyBool_FromLong(Py_ISLOWER(*p)); - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - cased = 0; - for (; p < e; p++) { - if (Py_ISUPPER(*p)) - Py_RETURN_FALSE; - else if (!cased && Py_ISLOWER(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR_shared(_Py_isupper__doc__, -"B.isupper() -> bool\n\ -\n\ -Return True if all cased characters in B are uppercase and there is\n\ -at least one cased character in B, False otherwise."); - -PyObject* -_Py_bytes_isupper(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (len == 1) - return PyBool_FromLong(Py_ISUPPER(*p)); - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - cased = 0; - for (; p < e; p++) { - if (Py_ISLOWER(*p)) - Py_RETURN_FALSE; - else if (!cased && Py_ISUPPER(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR_shared(_Py_istitle__doc__, -"B.istitle() -> bool\n\ -\n\ -Return True if B is a titlecased string and there is at least one\n\ -character in B, i.e. uppercase characters may only follow uncased\n\ -characters and lowercase characters only cased ones. Return False\n\ -otherwise."); - -PyObject* -_Py_bytes_istitle(const char *cptr, Py_ssize_t len) -{ - register const unsigned char *p - = (unsigned char *) cptr; - register const unsigned char *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (len == 1) - return PyBool_FromLong(Py_ISUPPER(*p)); - - /* Special case for empty strings */ - if (len == 0) - Py_RETURN_FALSE; - - e = p + len; - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const unsigned char ch = *p; - - if (Py_ISUPPER(ch)) { - if (previous_is_cased) - Py_RETURN_FALSE; - previous_is_cased = 1; - cased = 1; - } - else if (Py_ISLOWER(ch)) { - if (!previous_is_cased) - Py_RETURN_FALSE; - previous_is_cased = 1; - cased = 1; - } - else - previous_is_cased = 0; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR_shared(_Py_lower__doc__, -"B.lower() -> copy of B\n\ -\n\ -Return a copy of B with all ASCII characters converted to lowercase."); - -void -_Py_bytes_lower(char *result, const char *cptr, Py_ssize_t len) -{ - Py_ssize_t i; - - /* - newobj = PyString_FromStringAndSize(NULL, len); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - */ - - Py_MEMCPY(result, cptr, len); - - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISUPPER(c)) - result[i] = Py_TOLOWER(c); - } -} - - -PyDoc_STRVAR_shared(_Py_upper__doc__, -"B.upper() -> copy of B\n\ -\n\ -Return a copy of B with all ASCII characters converted to uppercase."); - -void -_Py_bytes_upper(char *result, const char *cptr, Py_ssize_t len) -{ - Py_ssize_t i; - - /* - newobj = PyString_FromStringAndSize(NULL, len); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - */ - - Py_MEMCPY(result, cptr, len); - - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(result[i]); - if (Py_ISLOWER(c)) - result[i] = Py_TOUPPER(c); - } -} - - -PyDoc_STRVAR_shared(_Py_title__doc__, -"B.title() -> copy of B\n\ -\n\ -Return a titlecased version of B, i.e. ASCII words start with uppercase\n\ -characters, all remaining cased characters have lowercase."); - -void -_Py_bytes_title(char *result, char *s, Py_ssize_t len) -{ - Py_ssize_t i; - int previous_is_cased = 0; - - /* - newobj = PyString_FromStringAndSize(NULL, len); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - */ - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(*s++); - if (Py_ISLOWER(c)) { - if (!previous_is_cased) - c = Py_TOUPPER(c); - previous_is_cased = 1; - } else if (Py_ISUPPER(c)) { - if (previous_is_cased) - c = Py_TOLOWER(c); - previous_is_cased = 1; - } else - previous_is_cased = 0; - *result++ = c; - } -} - - -PyDoc_STRVAR_shared(_Py_capitalize__doc__, -"B.capitalize() -> copy of B\n\ -\n\ -Return a copy of B with only its first character capitalized (ASCII)\n\ -and the rest lower-cased."); - -void -_Py_bytes_capitalize(char *result, char *s, Py_ssize_t len) -{ - Py_ssize_t i; - - /* - newobj = PyString_FromStringAndSize(NULL, len); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - */ - if (0 < len) { - int c = Py_CHARMASK(*s++); - if (Py_ISLOWER(c)) - *result = Py_TOUPPER(c); - else - *result = c; - result++; - } - for (i = 1; i < len; i++) { - int c = Py_CHARMASK(*s++); - if (Py_ISUPPER(c)) - *result = Py_TOLOWER(c); - else - *result = c; - result++; - } -} - - -PyDoc_STRVAR_shared(_Py_swapcase__doc__, -"B.swapcase() -> copy of B\n\ -\n\ -Return a copy of B with uppercase ASCII characters converted\n\ -to lowercase ASCII and vice versa."); - -void -_Py_bytes_swapcase(char *result, char *s, Py_ssize_t len) -{ - Py_ssize_t i; - - /* - newobj = PyString_FromStringAndSize(NULL, len); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - */ - for (i = 0; i < len; i++) { - int c = Py_CHARMASK(*s++); - if (Py_ISLOWER(c)) { - *result = Py_TOUPPER(c); - } - else if (Py_ISUPPER(c)) { - *result = Py_TOLOWER(c); - } - else - *result = c; - result++; - } -} - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/capsule.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/capsule.c deleted file mode 100644 index f7f2e04..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/capsule.c +++ /dev/null @@ -1,324 +0,0 @@ -/* Wrap void * pointers to be passed between C modules */ - -#include "Python.h" - -/* Internal structure of PyCapsule */ -typedef struct { - PyObject_HEAD - void *pointer; - const char *name; - void *context; - PyCapsule_Destructor destructor; -} PyCapsule; - - - -static int -_is_legal_capsule(PyCapsule *capsule, const char *invalid_capsule) -{ - if (!capsule || !PyCapsule_CheckExact(capsule) || capsule->pointer == NULL) { - PyErr_SetString(PyExc_ValueError, invalid_capsule); - return 0; - } - return 1; -} - -#define is_legal_capsule(capsule, name) \ - (_is_legal_capsule(capsule, \ - name " called with invalid PyCapsule object")) - - -static int -name_matches(const char *name1, const char *name2) { - /* if either is NULL, */ - if (!name1 || !name2) { - /* they're only the same if they're both NULL. */ - return name1 == name2; - } - return !strcmp(name1, name2); -} - - - -PyObject * -PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor) -{ - PyCapsule *capsule; - - if (!pointer) { - PyErr_SetString(PyExc_ValueError, "PyCapsule_New called with null pointer"); - return NULL; - } - - capsule = PyObject_NEW(PyCapsule, &PyCapsule_Type); - if (capsule == NULL) { - return NULL; - } - - capsule->pointer = pointer; - capsule->name = name; - capsule->context = NULL; - capsule->destructor = destructor; - - return (PyObject *)capsule; -} - - -int -PyCapsule_IsValid(PyObject *o, const char *name) -{ - PyCapsule *capsule = (PyCapsule *)o; - - return (capsule != NULL && - PyCapsule_CheckExact(capsule) && - capsule->pointer != NULL && - name_matches(capsule->name, name)); -} - - -void * -PyCapsule_GetPointer(PyObject *o, const char *name) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_GetPointer")) { - return NULL; - } - - if (!name_matches(name, capsule->name)) { - PyErr_SetString(PyExc_ValueError, "PyCapsule_GetPointer called with incorrect name"); - return NULL; - } - - return capsule->pointer; -} - - -const char * -PyCapsule_GetName(PyObject *o) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_GetName")) { - return NULL; - } - return capsule->name; -} - - -PyCapsule_Destructor -PyCapsule_GetDestructor(PyObject *o) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_GetDestructor")) { - return NULL; - } - return capsule->destructor; -} - - -void * -PyCapsule_GetContext(PyObject *o) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_GetContext")) { - return NULL; - } - return capsule->context; -} - - -int -PyCapsule_SetPointer(PyObject *o, void *pointer) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!pointer) { - PyErr_SetString(PyExc_ValueError, "PyCapsule_SetPointer called with null pointer"); - return -1; - } - - if (!is_legal_capsule(capsule, "PyCapsule_SetPointer")) { - return -1; - } - - capsule->pointer = pointer; - return 0; -} - - -int -PyCapsule_SetName(PyObject *o, const char *name) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_SetName")) { - return -1; - } - - capsule->name = name; - return 0; -} - - -int -PyCapsule_SetDestructor(PyObject *o, PyCapsule_Destructor destructor) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_SetDestructor")) { - return -1; - } - - capsule->destructor = destructor; - return 0; -} - - -int -PyCapsule_SetContext(PyObject *o, void *context) -{ - PyCapsule *capsule = (PyCapsule *)o; - - if (!is_legal_capsule(capsule, "PyCapsule_SetContext")) { - return -1; - } - - capsule->context = context; - return 0; -} - - -void * -PyCapsule_Import(const char *name, int no_block) -{ - PyObject *object = NULL; - void *return_value = NULL; - char *trace; - size_t name_length = (strlen(name) + 1) * sizeof(char); - char *name_dup = (char *)PyMem_MALLOC(name_length); - - if (!name_dup) { - return NULL; - } - - memcpy(name_dup, name, name_length); - - trace = name_dup; - while (trace) { - char *dot = strchr(trace, '.'); - if (dot) { - *dot++ = '\0'; - } - - if (object == NULL) { - if (no_block) { - object = PyImport_ImportModuleNoBlock(trace); - } else { - object = PyImport_ImportModule(trace); - if (!object) { - PyErr_Format(PyExc_ImportError, "PyCapsule_Import could not import module \"%s\"", trace); - } - } - } else { - PyObject *object2 = PyObject_GetAttrString(object, trace); - Py_DECREF(object); - object = object2; - } - if (!object) { - goto EXIT; - } - - trace = dot; - } - - /* compare attribute name to module.name by hand */ - if (PyCapsule_IsValid(object, name)) { - PyCapsule *capsule = (PyCapsule *)object; - return_value = capsule->pointer; - } else { - PyErr_Format(PyExc_AttributeError, - "PyCapsule_Import \"%s\" is not valid", - name); - } - -EXIT: - Py_XDECREF(object); - if (name_dup) { - PyMem_FREE(name_dup); - } - return return_value; -} - - -static void -capsule_dealloc(PyObject *o) -{ - PyCapsule *capsule = (PyCapsule *)o; - if (capsule->destructor) { - capsule->destructor(o); - } - PyObject_DEL(o); -} - - -static PyObject * -capsule_repr(PyObject *o) -{ - PyCapsule *capsule = (PyCapsule *)o; - const char *name; - const char *quote; - - if (capsule->name) { - quote = "\""; - name = capsule->name; - } else { - quote = ""; - name = "NULL"; - } - - return PyString_FromFormat("", - quote, name, quote, capsule); -} - - - -PyDoc_STRVAR(PyCapsule_Type__doc__, -"Capsule objects let you wrap a C \"void *\" pointer in a Python\n\ -object. They're a way of passing data through the Python interpreter\n\ -without creating your own custom type.\n\ -\n\ -Capsules are used for communication between extension modules.\n\ -They provide a way for an extension module to export a C interface\n\ -to other extension modules, so that extension modules can use the\n\ -Python import mechanism to link to one another.\n\ -"); - -PyTypeObject PyCapsule_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "PyCapsule", /*tp_name*/ - sizeof(PyCapsule), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - capsule_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_reserved*/ - capsule_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - 0, /*tp_flags*/ - PyCapsule_Type__doc__ /*tp_doc*/ -}; - - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/cellobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/cellobject.c deleted file mode 100644 index 463f7b1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/cellobject.c +++ /dev/null @@ -1,145 +0,0 @@ -/* Cell object implementation */ - -#include "Python.h" - -PyObject * -PyCell_New(PyObject *obj) -{ - PyCellObject *op; - - op = (PyCellObject *)PyObject_GC_New(PyCellObject, &PyCell_Type); - if (op == NULL) - return NULL; - op->ob_ref = obj; - Py_XINCREF(obj); - - _PyObject_GC_TRACK(op); - return (PyObject *)op; -} - -PyObject * -PyCell_Get(PyObject *op) -{ - if (!PyCell_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - Py_XINCREF(((PyCellObject*)op)->ob_ref); - return PyCell_GET(op); -} - -int -PyCell_Set(PyObject *op, PyObject *obj) -{ - PyObject* oldobj; - if (!PyCell_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - oldobj = PyCell_GET(op); - Py_XINCREF(obj); - PyCell_SET(op, obj); - Py_XDECREF(oldobj); - return 0; -} - -static void -cell_dealloc(PyCellObject *op) -{ - _PyObject_GC_UNTRACK(op); - Py_XDECREF(op->ob_ref); - PyObject_GC_Del(op); -} - -static int -cell_compare(PyCellObject *a, PyCellObject *b) -{ - /* Py3K warning for comparisons */ - if (PyErr_WarnPy3k("cell comparisons not supported in 3.x", - 1) < 0) { - return -2; - } - - if (a->ob_ref == NULL) { - if (b->ob_ref == NULL) - return 0; - return -1; - } else if (b->ob_ref == NULL) - return 1; - return PyObject_Compare(a->ob_ref, b->ob_ref); -} - -static PyObject * -cell_repr(PyCellObject *op) -{ - if (op->ob_ref == NULL) - return PyString_FromFormat("", op); - - return PyString_FromFormat("", - op, op->ob_ref->ob_type->tp_name, - op->ob_ref); -} - -static int -cell_traverse(PyCellObject *op, visitproc visit, void *arg) -{ - Py_VISIT(op->ob_ref); - return 0; -} - -static int -cell_clear(PyCellObject *op) -{ - Py_CLEAR(op->ob_ref); - return 0; -} - -static PyObject * -cell_get_contents(PyCellObject *op, void *closure) -{ - if (op->ob_ref == NULL) - { - PyErr_SetString(PyExc_ValueError, "Cell is empty"); - return NULL; - } - Py_INCREF(op->ob_ref); - return op->ob_ref; -} - -static PyGetSetDef cell_getsetlist[] = { - {"cell_contents", (getter)cell_get_contents, NULL}, - {NULL} /* sentinel */ -}; - -PyTypeObject PyCell_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "cell", - sizeof(PyCellObject), - 0, - (destructor)cell_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)cell_compare, /* tp_compare */ - (reprfunc)cell_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)cell_traverse, /* tp_traverse */ - (inquiry)cell_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - cell_getsetlist, /* tp_getset */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/classobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/classobject.c deleted file mode 100644 index aa68db4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/classobject.c +++ /dev/null @@ -1,2696 +0,0 @@ - -/* Class object implementation */ - -#include "Python.h" -#include "structmember.h" - -/* Free list for method objects to save malloc/free overhead - * The im_self element is used to chain the elements. - */ -static PyMethodObject *free_list; -static int numfree = 0; -#ifndef PyMethod_MAXFREELIST -#define PyMethod_MAXFREELIST 256 -#endif - -#define TP_DESCR_GET(t) \ - (PyType_HasFeature(t, Py_TPFLAGS_HAVE_CLASS) ? (t)->tp_descr_get : NULL) - -/* Forward */ -static PyObject *class_lookup(PyClassObject *, PyObject *, - PyClassObject **); -static PyObject *instance_getattr1(PyInstanceObject *, PyObject *); -static PyObject *instance_getattr2(PyInstanceObject *, PyObject *); - -static PyObject *getattrstr, *setattrstr, *delattrstr; - - -PyObject * -PyClass_New(PyObject *bases, PyObject *dict, PyObject *name) - /* bases is NULL or tuple of classobjects! */ -{ - PyClassObject *op, *dummy; - static PyObject *docstr, *modstr, *namestr; - if (docstr == NULL) { - docstr= PyString_InternFromString("__doc__"); - if (docstr == NULL) - return NULL; - } - if (modstr == NULL) { - modstr= PyString_InternFromString("__module__"); - if (modstr == NULL) - return NULL; - } - if (namestr == NULL) { - namestr= PyString_InternFromString("__name__"); - if (namestr == NULL) - return NULL; - } - if (name == NULL || !PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, - "PyClass_New: name must be a string"); - return NULL; - } - if (dict == NULL || !PyDict_Check(dict)) { - PyErr_SetString(PyExc_TypeError, - "PyClass_New: dict must be a dictionary"); - return NULL; - } - if (PyDict_GetItem(dict, docstr) == NULL) { - if (PyDict_SetItem(dict, docstr, Py_None) < 0) - return NULL; - } - if (PyDict_GetItem(dict, modstr) == NULL) { - PyObject *globals = PyEval_GetGlobals(); - if (globals != NULL) { - PyObject *modname = PyDict_GetItem(globals, namestr); - if (modname != NULL) { - if (PyDict_SetItem(dict, modstr, modname) < 0) - return NULL; - } - } - } - if (bases == NULL) { - bases = PyTuple_New(0); - if (bases == NULL) - return NULL; - } - else { - Py_ssize_t i, n; - PyObject *base; - if (!PyTuple_Check(bases)) { - PyErr_SetString(PyExc_TypeError, - "PyClass_New: bases must be a tuple"); - return NULL; - } - n = PyTuple_Size(bases); - for (i = 0; i < n; i++) { - base = PyTuple_GET_ITEM(bases, i); - if (!PyClass_Check(base)) { - if (PyCallable_Check( - (PyObject *) base->ob_type)) - return PyObject_CallFunctionObjArgs( - (PyObject *) base->ob_type, - name, bases, dict, NULL); - PyErr_SetString(PyExc_TypeError, - "PyClass_New: base must be a class"); - return NULL; - } - } - Py_INCREF(bases); - } - - if (getattrstr == NULL) { - getattrstr = PyString_InternFromString("__getattr__"); - if (getattrstr == NULL) - goto alloc_error; - setattrstr = PyString_InternFromString("__setattr__"); - if (setattrstr == NULL) - goto alloc_error; - delattrstr = PyString_InternFromString("__delattr__"); - if (delattrstr == NULL) - goto alloc_error; - } - - op = PyObject_GC_New(PyClassObject, &PyClass_Type); - if (op == NULL) { -alloc_error: - Py_DECREF(bases); - return NULL; - } - op->cl_bases = bases; - Py_INCREF(dict); - op->cl_dict = dict; - Py_XINCREF(name); - op->cl_name = name; - op->cl_weakreflist = NULL; - - op->cl_getattr = class_lookup(op, getattrstr, &dummy); - op->cl_setattr = class_lookup(op, setattrstr, &dummy); - op->cl_delattr = class_lookup(op, delattrstr, &dummy); - Py_XINCREF(op->cl_getattr); - Py_XINCREF(op->cl_setattr); - Py_XINCREF(op->cl_delattr); - _PyObject_GC_TRACK(op); - return (PyObject *) op; -} - -PyObject * -PyMethod_Function(PyObject *im) -{ - if (!PyMethod_Check(im)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyMethodObject *)im)->im_func; -} - -PyObject * -PyMethod_Self(PyObject *im) -{ - if (!PyMethod_Check(im)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyMethodObject *)im)->im_self; -} - -PyObject * -PyMethod_Class(PyObject *im) -{ - if (!PyMethod_Check(im)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyMethodObject *)im)->im_class; -} - -PyDoc_STRVAR(class_doc, -"classobj(name, bases, dict)\n\ -\n\ -Create a class object. The name must be a string; the second argument\n\ -a tuple of classes, and the third a dictionary."); - -static PyObject * -class_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *name, *bases, *dict; - static char *kwlist[] = {"name", "bases", "dict", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "SOO", kwlist, - &name, &bases, &dict)) - return NULL; - return PyClass_New(bases, dict, name); -} - -/* Class methods */ - -static void -class_dealloc(PyClassObject *op) -{ - _PyObject_GC_UNTRACK(op); - if (op->cl_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) op); - Py_DECREF(op->cl_bases); - Py_DECREF(op->cl_dict); - Py_XDECREF(op->cl_name); - Py_XDECREF(op->cl_getattr); - Py_XDECREF(op->cl_setattr); - Py_XDECREF(op->cl_delattr); - PyObject_GC_Del(op); -} - -static PyObject * -class_lookup(PyClassObject *cp, PyObject *name, PyClassObject **pclass) -{ - Py_ssize_t i, n; - PyObject *value = PyDict_GetItem(cp->cl_dict, name); - if (value != NULL) { - *pclass = cp; - return value; - } - n = PyTuple_Size(cp->cl_bases); - for (i = 0; i < n; i++) { - /* XXX What if one of the bases is not a class? */ - PyObject *v = class_lookup( - (PyClassObject *) - PyTuple_GetItem(cp->cl_bases, i), name, pclass); - if (v != NULL) - return v; - } - return NULL; -} - -static PyObject * -class_getattr(register PyClassObject *op, PyObject *name) -{ - register PyObject *v; - register char *sname; - PyClassObject *klass; - descrgetfunc f; - - if (!PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); - return NULL; - } - - sname = PyString_AsString(name); - if (sname[0] == '_' && sname[1] == '_') { - if (strcmp(sname, "__dict__") == 0) { - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "class.__dict__ not accessible in restricted mode"); - return NULL; - } - Py_INCREF(op->cl_dict); - return op->cl_dict; - } - if (strcmp(sname, "__bases__") == 0) { - Py_INCREF(op->cl_bases); - return op->cl_bases; - } - if (strcmp(sname, "__name__") == 0) { - if (op->cl_name == NULL) - v = Py_None; - else - v = op->cl_name; - Py_INCREF(v); - return v; - } - } - v = class_lookup(op, name, &klass); - if (v == NULL) { - PyErr_Format(PyExc_AttributeError, - "class %.50s has no attribute '%.400s'", - PyString_AS_STRING(op->cl_name), sname); - return NULL; - } - f = TP_DESCR_GET(v->ob_type); - if (f == NULL) - Py_INCREF(v); - else - v = f(v, (PyObject *)NULL, (PyObject *)op); - return v; -} - -static void -set_slot(PyObject **slot, PyObject *v) -{ - PyObject *temp = *slot; - Py_XINCREF(v); - *slot = v; - Py_XDECREF(temp); -} - -static void -set_attr_slots(PyClassObject *c) -{ - PyClassObject *dummy; - - set_slot(&c->cl_getattr, class_lookup(c, getattrstr, &dummy)); - set_slot(&c->cl_setattr, class_lookup(c, setattrstr, &dummy)); - set_slot(&c->cl_delattr, class_lookup(c, delattrstr, &dummy)); -} - -static char * -set_dict(PyClassObject *c, PyObject *v) -{ - if (v == NULL || !PyDict_Check(v)) - return "__dict__ must be a dictionary object"; - set_slot(&c->cl_dict, v); - set_attr_slots(c); - return ""; -} - -static char * -set_bases(PyClassObject *c, PyObject *v) -{ - Py_ssize_t i, n; - - if (v == NULL || !PyTuple_Check(v)) - return "__bases__ must be a tuple object"; - n = PyTuple_Size(v); - for (i = 0; i < n; i++) { - PyObject *x = PyTuple_GET_ITEM(v, i); - if (!PyClass_Check(x)) - return "__bases__ items must be classes"; - if (PyClass_IsSubclass(x, (PyObject *)c)) - return "a __bases__ item causes an inheritance cycle"; - } - set_slot(&c->cl_bases, v); - set_attr_slots(c); - return ""; -} - -static char * -set_name(PyClassObject *c, PyObject *v) -{ - if (v == NULL || !PyString_Check(v)) - return "__name__ must be a string object"; - if (strlen(PyString_AS_STRING(v)) != (size_t)PyString_GET_SIZE(v)) - return "__name__ must not contain null bytes"; - set_slot(&c->cl_name, v); - return ""; -} - -static int -class_setattr(PyClassObject *op, PyObject *name, PyObject *v) -{ - char *sname; - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "classes are read-only in restricted mode"); - return -1; - } - if (!PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); - return -1; - } - sname = PyString_AsString(name); - if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyString_Size(name); - if (sname[n-1] == '_' && sname[n-2] == '_') { - char *err = NULL; - if (strcmp(sname, "__dict__") == 0) - err = set_dict(op, v); - else if (strcmp(sname, "__bases__") == 0) - err = set_bases(op, v); - else if (strcmp(sname, "__name__") == 0) - err = set_name(op, v); - else if (strcmp(sname, "__getattr__") == 0) - set_slot(&op->cl_getattr, v); - else if (strcmp(sname, "__setattr__") == 0) - set_slot(&op->cl_setattr, v); - else if (strcmp(sname, "__delattr__") == 0) - set_slot(&op->cl_delattr, v); - /* For the last three, we fall through to update the - dictionary as well. */ - if (err != NULL) { - if (*err == '\0') - return 0; - PyErr_SetString(PyExc_TypeError, err); - return -1; - } - } - } - if (v == NULL) { - int rv = PyDict_DelItem(op->cl_dict, name); - if (rv < 0) - PyErr_Format(PyExc_AttributeError, - "class %.50s has no attribute '%.400s'", - PyString_AS_STRING(op->cl_name), sname); - return rv; - } - else - return PyDict_SetItem(op->cl_dict, name, v); -} - -static PyObject * -class_repr(PyClassObject *op) -{ - PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__"); - char *name; - if (op->cl_name == NULL || !PyString_Check(op->cl_name)) - name = "?"; - else - name = PyString_AsString(op->cl_name); - if (mod == NULL || !PyString_Check(mod)) - return PyString_FromFormat("", name, op); - else - return PyString_FromFormat("", - PyString_AsString(mod), - name, op); -} - -static PyObject * -class_str(PyClassObject *op) -{ - PyObject *mod = PyDict_GetItemString(op->cl_dict, "__module__"); - PyObject *name = op->cl_name; - PyObject *res; - Py_ssize_t m, n; - - if (name == NULL || !PyString_Check(name)) - return class_repr(op); - if (mod == NULL || !PyString_Check(mod)) { - Py_INCREF(name); - return name; - } - m = PyString_GET_SIZE(mod); - n = PyString_GET_SIZE(name); - res = PyString_FromStringAndSize((char *)NULL, m+1+n); - if (res != NULL) { - char *s = PyString_AS_STRING(res); - memcpy(s, PyString_AS_STRING(mod), m); - s += m; - *s++ = '.'; - memcpy(s, PyString_AS_STRING(name), n); - } - return res; -} - -static int -class_traverse(PyClassObject *o, visitproc visit, void *arg) -{ - Py_VISIT(o->cl_bases); - Py_VISIT(o->cl_dict); - Py_VISIT(o->cl_name); - Py_VISIT(o->cl_getattr); - Py_VISIT(o->cl_setattr); - Py_VISIT(o->cl_delattr); - return 0; -} - -PyTypeObject PyClass_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, - "classobj", - sizeof(PyClassObject), - 0, - (destructor)class_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)class_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - PyInstance_New, /* tp_call */ - (reprfunc)class_str, /* tp_str */ - (getattrofunc)class_getattr, /* tp_getattro */ - (setattrofunc)class_setattr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - class_doc, /* tp_doc */ - (traverseproc)class_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyClassObject, cl_weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - class_new, /* tp_new */ -}; - -int -PyClass_IsSubclass(PyObject *klass, PyObject *base) -{ - Py_ssize_t i, n; - PyClassObject *cp; - if (klass == base) - return 1; - if (PyTuple_Check(base)) { - n = PyTuple_GET_SIZE(base); - for (i = 0; i < n; i++) { - if (PyClass_IsSubclass(klass, PyTuple_GET_ITEM(base, i))) - return 1; - } - return 0; - } - if (klass == NULL || !PyClass_Check(klass)) - return 0; - cp = (PyClassObject *)klass; - n = PyTuple_Size(cp->cl_bases); - for (i = 0; i < n; i++) { - if (PyClass_IsSubclass(PyTuple_GetItem(cp->cl_bases, i), base)) - return 1; - } - return 0; -} - - -/* Instance objects */ - -PyObject * -PyInstance_NewRaw(PyObject *klass, PyObject *dict) -{ - PyInstanceObject *inst; - - if (!PyClass_Check(klass)) { - PyErr_BadInternalCall(); - return NULL; - } - if (dict == NULL) { - dict = PyDict_New(); - if (dict == NULL) - return NULL; - } - else { - if (!PyDict_Check(dict)) { - PyErr_BadInternalCall(); - return NULL; - } - Py_INCREF(dict); - } - inst = PyObject_GC_New(PyInstanceObject, &PyInstance_Type); - if (inst == NULL) { - Py_DECREF(dict); - return NULL; - } - inst->in_weakreflist = NULL; - Py_INCREF(klass); - inst->in_class = (PyClassObject *)klass; - inst->in_dict = dict; - _PyObject_GC_TRACK(inst); - return (PyObject *)inst; -} - -PyObject * -PyInstance_New(PyObject *klass, PyObject *arg, PyObject *kw) -{ - register PyInstanceObject *inst; - PyObject *init; - static PyObject *initstr; - - if (initstr == NULL) { - initstr = PyString_InternFromString("__init__"); - if (initstr == NULL) - return NULL; - } - inst = (PyInstanceObject *) PyInstance_NewRaw(klass, NULL); - if (inst == NULL) - return NULL; - init = instance_getattr2(inst, initstr); - if (init == NULL) { - if (PyErr_Occurred()) { - Py_DECREF(inst); - return NULL; - } - if ((arg != NULL && (!PyTuple_Check(arg) || - PyTuple_Size(arg) != 0)) - || (kw != NULL && (!PyDict_Check(kw) || - PyDict_Size(kw) != 0))) { - PyErr_SetString(PyExc_TypeError, - "this constructor takes no arguments"); - Py_DECREF(inst); - inst = NULL; - } - } - else { - PyObject *res = PyEval_CallObjectWithKeywords(init, arg, kw); - Py_DECREF(init); - if (res == NULL) { - Py_DECREF(inst); - inst = NULL; - } - else { - if (res != Py_None) { - PyErr_SetString(PyExc_TypeError, - "__init__() should return None"); - Py_DECREF(inst); - inst = NULL; - } - Py_DECREF(res); - } - } - return (PyObject *)inst; -} - -/* Instance methods */ - -PyDoc_STRVAR(instance_doc, -"instance(class[, dict])\n\ -\n\ -Create an instance without calling its __init__() method.\n\ -The class must be a classic class.\n\ -If present, dict must be a dictionary or None."); - -static PyObject * -instance_new(PyTypeObject* type, PyObject* args, PyObject *kw) -{ - PyObject *klass; - PyObject *dict = Py_None; - - if (!PyArg_ParseTuple(args, "O!|O:instance", - &PyClass_Type, &klass, &dict)) - return NULL; - - if (dict == Py_None) - dict = NULL; - else if (!PyDict_Check(dict)) { - PyErr_SetString(PyExc_TypeError, - "instance() second arg must be dictionary or None"); - return NULL; - } - return PyInstance_NewRaw(klass, dict); -} - - -static void -instance_dealloc(register PyInstanceObject *inst) -{ - PyObject *error_type, *error_value, *error_traceback; - PyObject *del; - static PyObject *delstr; - - _PyObject_GC_UNTRACK(inst); - if (inst->in_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) inst); - - /* Temporarily resurrect the object. */ - assert(inst->ob_type == &PyInstance_Type); - assert(inst->ob_refcnt == 0); - inst->ob_refcnt = 1; - - /* Save the current exception, if any. */ - PyErr_Fetch(&error_type, &error_value, &error_traceback); - /* Execute __del__ method, if any. */ - if (delstr == NULL) { - delstr = PyString_InternFromString("__del__"); - if (delstr == NULL) - PyErr_WriteUnraisable((PyObject*)inst); - } - if (delstr && (del = instance_getattr2(inst, delstr)) != NULL) { - PyObject *res = PyEval_CallObject(del, (PyObject *)NULL); - if (res == NULL) - PyErr_WriteUnraisable(del); - else - Py_DECREF(res); - Py_DECREF(del); - } - /* Restore the saved exception. */ - PyErr_Restore(error_type, error_value, error_traceback); - - /* Undo the temporary resurrection; can't use DECREF here, it would - * cause a recursive call. - */ - assert(inst->ob_refcnt > 0); - if (--inst->ob_refcnt == 0) { - - /* New weakrefs could be created during the finalizer call. - If this occurs, clear them out without calling their - finalizers since they might rely on part of the object - being finalized that has already been destroyed. */ - while (inst->in_weakreflist != NULL) { - _PyWeakref_ClearRef((PyWeakReference *) - (inst->in_weakreflist)); - } - - Py_DECREF(inst->in_class); - Py_XDECREF(inst->in_dict); - PyObject_GC_Del(inst); - } - else { - Py_ssize_t refcnt = inst->ob_refcnt; - /* __del__ resurrected it! Make it look like the original - * Py_DECREF never happened. - */ - _Py_NewReference((PyObject *)inst); - inst->ob_refcnt = refcnt; - _PyObject_GC_TRACK(inst); - /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so - * we need to undo that. */ - _Py_DEC_REFTOTAL; - /* If Py_TRACE_REFS, _Py_NewReference re-added self to the - * object chain, so no more to do there. - * If COUNT_ALLOCS, the original decref bumped tp_frees, and - * _Py_NewReference bumped tp_allocs: both of those need to be - * undone. - */ -#ifdef COUNT_ALLOCS - --inst->ob_type->tp_frees; - --inst->ob_type->tp_allocs; -#endif - } -} - -static PyObject * -instance_getattr1(register PyInstanceObject *inst, PyObject *name) -{ - register PyObject *v; - register char *sname; - - if (!PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); - return NULL; - } - - sname = PyString_AsString(name); - if (sname[0] == '_' && sname[1] == '_') { - if (strcmp(sname, "__dict__") == 0) { - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "instance.__dict__ not accessible in restricted mode"); - return NULL; - } - Py_INCREF(inst->in_dict); - return inst->in_dict; - } - if (strcmp(sname, "__class__") == 0) { - Py_INCREF(inst->in_class); - return (PyObject *)inst->in_class; - } - } - v = instance_getattr2(inst, name); - if (v == NULL && !PyErr_Occurred()) { - PyErr_Format(PyExc_AttributeError, - "%.50s instance has no attribute '%.400s'", - PyString_AS_STRING(inst->in_class->cl_name), sname); - } - return v; -} - -static PyObject * -instance_getattr2(register PyInstanceObject *inst, PyObject *name) -{ - register PyObject *v; - PyClassObject *klass; - descrgetfunc f; - - v = PyDict_GetItem(inst->in_dict, name); - if (v != NULL) { - Py_INCREF(v); - return v; - } - v = class_lookup(inst->in_class, name, &klass); - if (v != NULL) { - Py_INCREF(v); - f = TP_DESCR_GET(v->ob_type); - if (f != NULL) { - PyObject *w = f(v, (PyObject *)inst, - (PyObject *)(inst->in_class)); - Py_DECREF(v); - v = w; - } - } - return v; -} - -static PyObject * -instance_getattr(register PyInstanceObject *inst, PyObject *name) -{ - register PyObject *func, *res; - res = instance_getattr1(inst, name); - if (res == NULL && (func = inst->in_class->cl_getattr) != NULL) { - PyObject *args; - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - args = PyTuple_Pack(2, inst, name); - if (args == NULL) - return NULL; - res = PyEval_CallObject(func, args); - Py_DECREF(args); - } - return res; -} - -/* See classobject.h comments: this only does dict lookups, and is always - * safe to call. - */ -PyObject * -_PyInstance_Lookup(PyObject *pinst, PyObject *name) -{ - PyObject *v; - PyClassObject *klass; - PyInstanceObject *inst; /* pinst cast to the right type */ - - assert(PyInstance_Check(pinst)); - inst = (PyInstanceObject *)pinst; - - assert(PyString_Check(name)); - - v = PyDict_GetItem(inst->in_dict, name); - if (v == NULL) - v = class_lookup(inst->in_class, name, &klass); - return v; -} - -static int -instance_setattr1(PyInstanceObject *inst, PyObject *name, PyObject *v) -{ - if (v == NULL) { - int rv = PyDict_DelItem(inst->in_dict, name); - if (rv < 0) - PyErr_Format(PyExc_AttributeError, - "%.50s instance has no attribute '%.400s'", - PyString_AS_STRING(inst->in_class->cl_name), - PyString_AS_STRING(name)); - return rv; - } - else - return PyDict_SetItem(inst->in_dict, name, v); -} - -static int -instance_setattr(PyInstanceObject *inst, PyObject *name, PyObject *v) -{ - PyObject *func, *args, *res, *tmp; - char *sname; - - if (!PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, "attribute name must be a string"); - return -1; - } - - sname = PyString_AsString(name); - if (sname[0] == '_' && sname[1] == '_') { - Py_ssize_t n = PyString_Size(name); - if (sname[n-1] == '_' && sname[n-2] == '_') { - if (strcmp(sname, "__dict__") == 0) { - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "__dict__ not accessible in restricted mode"); - return -1; - } - if (v == NULL || !PyDict_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "__dict__ must be set to a dictionary"); - return -1; - } - tmp = inst->in_dict; - Py_INCREF(v); - inst->in_dict = v; - Py_DECREF(tmp); - return 0; - } - if (strcmp(sname, "__class__") == 0) { - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "__class__ not accessible in restricted mode"); - return -1; - } - if (v == NULL || !PyClass_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "__class__ must be set to a class"); - return -1; - } - tmp = (PyObject *)(inst->in_class); - Py_INCREF(v); - inst->in_class = (PyClassObject *)v; - Py_DECREF(tmp); - return 0; - } - } - } - if (v == NULL) - func = inst->in_class->cl_delattr; - else - func = inst->in_class->cl_setattr; - if (func == NULL) - return instance_setattr1(inst, name, v); - if (v == NULL) - args = PyTuple_Pack(2, inst, name); - else - args = PyTuple_Pack(3, inst, name, v); - if (args == NULL) - return -1; - res = PyEval_CallObject(func, args); - Py_DECREF(args); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static PyObject * -instance_repr(PyInstanceObject *inst) -{ - PyObject *func; - PyObject *res; - static PyObject *reprstr; - - if (reprstr == NULL) { - reprstr = PyString_InternFromString("__repr__"); - if (reprstr == NULL) - return NULL; - } - func = instance_getattr(inst, reprstr); - if (func == NULL) { - PyObject *classname, *mod; - char *cname; - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - classname = inst->in_class->cl_name; - mod = PyDict_GetItemString(inst->in_class->cl_dict, - "__module__"); - if (classname != NULL && PyString_Check(classname)) - cname = PyString_AsString(classname); - else - cname = "?"; - if (mod == NULL || !PyString_Check(mod)) - return PyString_FromFormat("", - cname, inst); - else - return PyString_FromFormat("<%s.%s instance at %p>", - PyString_AsString(mod), - cname, inst); - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - return res; -} - -static PyObject * -instance_str(PyInstanceObject *inst) -{ - PyObject *func; - PyObject *res; - static PyObject *strstr; - - if (strstr == NULL) { - strstr = PyString_InternFromString("__str__"); - if (strstr == NULL) - return NULL; - } - func = instance_getattr(inst, strstr); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - return instance_repr(inst); - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - return res; -} - -static long -instance_hash(PyInstanceObject *inst) -{ - PyObject *func; - PyObject *res; - long outcome; - static PyObject *hashstr, *eqstr, *cmpstr; - - if (hashstr == NULL) { - hashstr = PyString_InternFromString("__hash__"); - if (hashstr == NULL) - return -1; - } - func = instance_getattr(inst, hashstr); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - /* If there is no __eq__ and no __cmp__ method, we hash on the - address. If an __eq__ or __cmp__ method exists, there must - be a __hash__. */ - if (eqstr == NULL) { - eqstr = PyString_InternFromString("__eq__"); - if (eqstr == NULL) - return -1; - } - func = instance_getattr(inst, eqstr); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - if (cmpstr == NULL) { - cmpstr = PyString_InternFromString("__cmp__"); - if (cmpstr == NULL) - return -1; - } - func = instance_getattr(inst, cmpstr); - if (func == NULL) { - if (!PyErr_ExceptionMatches( - PyExc_AttributeError)) - return -1; - PyErr_Clear(); - return _Py_HashPointer(inst); - } - } - Py_XDECREF(func); - PyErr_SetString(PyExc_TypeError, "unhashable instance"); - return -1; - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - if (res == NULL) - return -1; - if (PyInt_Check(res) || PyLong_Check(res)) - /* This already converts a -1 result to -2. */ - outcome = res->ob_type->tp_hash(res); - else { - PyErr_SetString(PyExc_TypeError, - "__hash__() should return an int"); - outcome = -1; - } - Py_DECREF(res); - return outcome; -} - -static int -instance_traverse(PyInstanceObject *o, visitproc visit, void *arg) -{ - Py_VISIT(o->in_class); - Py_VISIT(o->in_dict); - return 0; -} - -static PyObject *getitemstr, *setitemstr, *delitemstr, *lenstr; -static PyObject *iterstr, *nextstr; - -static Py_ssize_t -instance_length(PyInstanceObject *inst) -{ - PyObject *func; - PyObject *res; - Py_ssize_t outcome; - - if (lenstr == NULL) { - lenstr = PyString_InternFromString("__len__"); - if (lenstr == NULL) - return -1; - } - func = instance_getattr(inst, lenstr); - if (func == NULL) - return -1; - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - if (res == NULL) - return -1; - if (PyInt_Check(res)) { - outcome = PyInt_AsSsize_t(res); - if (outcome == -1 && PyErr_Occurred()) { - Py_DECREF(res); - return -1; - } -#if SIZEOF_SIZE_T < SIZEOF_INT - /* Overflow check -- range of PyInt is more than C int */ - if (outcome != (int)outcome) { - PyErr_SetString(PyExc_OverflowError, - "__len__() should return 0 <= outcome < 2**31"); - outcome = -1; - } - else -#endif - if (outcome < 0) { - PyErr_SetString(PyExc_ValueError, - "__len__() should return >= 0"); - outcome = -1; - } - } - else { - PyErr_SetString(PyExc_TypeError, - "__len__() should return an int"); - outcome = -1; - } - Py_DECREF(res); - return outcome; -} - -static PyObject * -instance_subscript(PyInstanceObject *inst, PyObject *key) -{ - PyObject *func; - PyObject *arg; - PyObject *res; - - if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); - if (getitemstr == NULL) - return NULL; - } - func = instance_getattr(inst, getitemstr); - if (func == NULL) - return NULL; - arg = PyTuple_Pack(1, key); - if (arg == NULL) { - Py_DECREF(func); - return NULL; - } - res = PyEval_CallObject(func, arg); - Py_DECREF(func); - Py_DECREF(arg); - return res; -} - -static int -instance_ass_subscript(PyInstanceObject *inst, PyObject *key, PyObject *value) -{ - PyObject *func; - PyObject *arg; - PyObject *res; - - if (value == NULL) { - if (delitemstr == NULL) { - delitemstr = PyString_InternFromString("__delitem__"); - if (delitemstr == NULL) - return -1; - } - func = instance_getattr(inst, delitemstr); - } - else { - if (setitemstr == NULL) { - setitemstr = PyString_InternFromString("__setitem__"); - if (setitemstr == NULL) - return -1; - } - func = instance_getattr(inst, setitemstr); - } - if (func == NULL) - return -1; - if (value == NULL) - arg = PyTuple_Pack(1, key); - else - arg = PyTuple_Pack(2, key, value); - if (arg == NULL) { - Py_DECREF(func); - return -1; - } - res = PyEval_CallObject(func, arg); - Py_DECREF(func); - Py_DECREF(arg); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static PyMappingMethods instance_as_mapping = { - (lenfunc)instance_length, /* mp_length */ - (binaryfunc)instance_subscript, /* mp_subscript */ - (objobjargproc)instance_ass_subscript, /* mp_ass_subscript */ -}; - -static PyObject * -instance_item(PyInstanceObject *inst, Py_ssize_t i) -{ - PyObject *func, *res; - - if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); - if (getitemstr == NULL) - return NULL; - } - func = instance_getattr(inst, getitemstr); - if (func == NULL) - return NULL; - res = PyObject_CallFunction(func, "n", i); - Py_DECREF(func); - return res; -} - -static PyObject * -instance_slice(PyInstanceObject *inst, Py_ssize_t i, Py_ssize_t j) -{ - PyObject *func, *arg, *res; - static PyObject *getslicestr; - - if (getslicestr == NULL) { - getslicestr = PyString_InternFromString("__getslice__"); - if (getslicestr == NULL) - return NULL; - } - func = instance_getattr(inst, getslicestr); - - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - - if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); - if (getitemstr == NULL) - return NULL; - } - func = instance_getattr(inst, getitemstr); - if (func == NULL) - return NULL; - arg = Py_BuildValue("(N)", _PySlice_FromIndices(i, j)); - } - else { - if (PyErr_WarnPy3k("in 3.x, __getslice__ has been removed; " - "use __getitem__", 1) < 0) { - Py_DECREF(func); - return NULL; - } - arg = Py_BuildValue("(nn)", i, j); - } - - if (arg == NULL) { - Py_DECREF(func); - return NULL; - } - res = PyEval_CallObject(func, arg); - Py_DECREF(func); - Py_DECREF(arg); - return res; -} - -static int -instance_ass_item(PyInstanceObject *inst, Py_ssize_t i, PyObject *item) -{ - PyObject *func, *arg, *res; - - if (item == NULL) { - if (delitemstr == NULL) { - delitemstr = PyString_InternFromString("__delitem__"); - if (delitemstr == NULL) - return -1; - } - func = instance_getattr(inst, delitemstr); - } - else { - if (setitemstr == NULL) { - setitemstr = PyString_InternFromString("__setitem__"); - if (setitemstr == NULL) - return -1; - } - func = instance_getattr(inst, setitemstr); - } - if (func == NULL) - return -1; - if (item == NULL) - arg = Py_BuildValue("(n)", i); - else - arg = Py_BuildValue("(nO)", i, item); - if (arg == NULL) { - Py_DECREF(func); - return -1; - } - res = PyEval_CallObject(func, arg); - Py_DECREF(func); - Py_DECREF(arg); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static int -instance_ass_slice(PyInstanceObject *inst, Py_ssize_t i, Py_ssize_t j, PyObject *value) -{ - PyObject *func, *arg, *res; - static PyObject *setslicestr, *delslicestr; - - if (value == NULL) { - if (delslicestr == NULL) { - delslicestr = - PyString_InternFromString("__delslice__"); - if (delslicestr == NULL) - return -1; - } - func = instance_getattr(inst, delslicestr); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - if (delitemstr == NULL) { - delitemstr = - PyString_InternFromString("__delitem__"); - if (delitemstr == NULL) - return -1; - } - func = instance_getattr(inst, delitemstr); - if (func == NULL) - return -1; - - arg = Py_BuildValue("(N)", - _PySlice_FromIndices(i, j)); - } - else { - if (PyErr_WarnPy3k("in 3.x, __delslice__ has been " - "removed; use __delitem__", 1) < 0) { - Py_DECREF(func); - return -1; - } - arg = Py_BuildValue("(nn)", i, j); - } - } - else { - if (setslicestr == NULL) { - setslicestr = - PyString_InternFromString("__setslice__"); - if (setslicestr == NULL) - return -1; - } - func = instance_getattr(inst, setslicestr); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - if (setitemstr == NULL) { - setitemstr = - PyString_InternFromString("__setitem__"); - if (setitemstr == NULL) - return -1; - } - func = instance_getattr(inst, setitemstr); - if (func == NULL) - return -1; - - arg = Py_BuildValue("(NO)", - _PySlice_FromIndices(i, j), value); - } - else { - if (PyErr_WarnPy3k("in 3.x, __setslice__ has been " - "removed; use __setitem__", 1) < 0) { - Py_DECREF(func); - return -1; - } - arg = Py_BuildValue("(nnO)", i, j, value); - } - } - if (arg == NULL) { - Py_DECREF(func); - return -1; - } - res = PyEval_CallObject(func, arg); - Py_DECREF(func); - Py_DECREF(arg); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static int -instance_contains(PyInstanceObject *inst, PyObject *member) -{ - static PyObject *__contains__; - PyObject *func; - - /* Try __contains__ first. - * If that can't be done, try iterator-based searching. - */ - - if(__contains__ == NULL) { - __contains__ = PyString_InternFromString("__contains__"); - if(__contains__ == NULL) - return -1; - } - func = instance_getattr(inst, __contains__); - if (func) { - PyObject *res; - int ret; - PyObject *arg = PyTuple_Pack(1, member); - if(arg == NULL) { - Py_DECREF(func); - return -1; - } - res = PyEval_CallObject(func, arg); - Py_DECREF(func); - Py_DECREF(arg); - if(res == NULL) - return -1; - ret = PyObject_IsTrue(res); - Py_DECREF(res); - return ret; - } - - /* Couldn't find __contains__. */ - if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - Py_ssize_t rc; - /* Assume the failure was simply due to that there is no - * __contains__ attribute, and try iterating instead. - */ - PyErr_Clear(); - rc = _PySequence_IterSearch((PyObject *)inst, member, - PY_ITERSEARCH_CONTAINS); - if (rc >= 0) - return rc > 0; - } - return -1; -} - -static PySequenceMethods -instance_as_sequence = { - (lenfunc)instance_length, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - (ssizeargfunc)instance_item, /* sq_item */ - (ssizessizeargfunc)instance_slice, /* sq_slice */ - (ssizeobjargproc)instance_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc)instance_ass_slice,/* sq_ass_slice */ - (objobjproc)instance_contains, /* sq_contains */ -}; - -static PyObject * -generic_unary_op(PyInstanceObject *self, PyObject *methodname) -{ - PyObject *func, *res; - - if ((func = instance_getattr(self, methodname)) == NULL) - return NULL; - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - return res; -} - -static PyObject * -generic_binary_op(PyObject *v, PyObject *w, char *opname) -{ - PyObject *result; - PyObject *args; - PyObject *func = PyObject_GetAttrString(v, opname); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - args = PyTuple_Pack(1, w); - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - result = PyEval_CallObject(func, args); - Py_DECREF(args); - Py_DECREF(func); - return result; -} - - -static PyObject *coerce_obj; - -/* Try one half of a binary operator involving a class instance. */ -static PyObject * -half_binop(PyObject *v, PyObject *w, char *opname, binaryfunc thisfunc, - int swapped) -{ - PyObject *args; - PyObject *coercefunc; - PyObject *coerced = NULL; - PyObject *v1; - PyObject *result; - - if (!PyInstance_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - if (coerce_obj == NULL) { - coerce_obj = PyString_InternFromString("__coerce__"); - if (coerce_obj == NULL) - return NULL; - } - coercefunc = PyObject_GetAttr(v, coerce_obj); - if (coercefunc == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - return generic_binary_op(v, w, opname); - } - - args = PyTuple_Pack(1, w); - if (args == NULL) { - Py_DECREF(coercefunc); - return NULL; - } - coerced = PyEval_CallObject(coercefunc, args); - Py_DECREF(args); - Py_DECREF(coercefunc); - if (coerced == NULL) { - return NULL; - } - if (coerced == Py_None || coerced == Py_NotImplemented) { - Py_DECREF(coerced); - return generic_binary_op(v, w, opname); - } - if (!PyTuple_Check(coerced) || PyTuple_Size(coerced) != 2) { - Py_DECREF(coerced); - PyErr_SetString(PyExc_TypeError, - "coercion should return None or 2-tuple"); - return NULL; - } - v1 = PyTuple_GetItem(coerced, 0); - w = PyTuple_GetItem(coerced, 1); - if (v1->ob_type == v->ob_type && PyInstance_Check(v)) { - /* prevent recursion if __coerce__ returns self as the first - * argument */ - result = generic_binary_op(v1, w, opname); - } else { - if (Py_EnterRecursiveCall(" after coercion")) - return NULL; - if (swapped) - result = (thisfunc)(w, v1); - else - result = (thisfunc)(v1, w); - Py_LeaveRecursiveCall(); - } - Py_DECREF(coerced); - return result; -} - -/* Implement a binary operator involving at least one class instance. */ -static PyObject * -do_binop(PyObject *v, PyObject *w, char *opname, char *ropname, - binaryfunc thisfunc) -{ - PyObject *result = half_binop(v, w, opname, thisfunc, 0); - if (result == Py_NotImplemented) { - Py_DECREF(result); - result = half_binop(w, v, ropname, thisfunc, 1); - } - return result; -} - -static PyObject * -do_binop_inplace(PyObject *v, PyObject *w, char *iopname, char *opname, - char *ropname, binaryfunc thisfunc) -{ - PyObject *result = half_binop(v, w, iopname, thisfunc, 0); - if (result == Py_NotImplemented) { - Py_DECREF(result); - result = do_binop(v, w, opname, ropname, thisfunc); - } - return result; -} - -static int -instance_coerce(PyObject **pv, PyObject **pw) -{ - PyObject *v = *pv; - PyObject *w = *pw; - PyObject *coercefunc; - PyObject *args; - PyObject *coerced; - - if (coerce_obj == NULL) { - coerce_obj = PyString_InternFromString("__coerce__"); - if (coerce_obj == NULL) - return -1; - } - coercefunc = PyObject_GetAttr(v, coerce_obj); - if (coercefunc == NULL) { - /* No __coerce__ method */ - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - return 1; - } - /* Has __coerce__ method: call it */ - args = PyTuple_Pack(1, w); - if (args == NULL) { - return -1; - } - coerced = PyEval_CallObject(coercefunc, args); - Py_DECREF(args); - Py_DECREF(coercefunc); - if (coerced == NULL) { - /* __coerce__ call raised an exception */ - return -1; - } - if (coerced == Py_None || coerced == Py_NotImplemented) { - /* __coerce__ says "I can't do it" */ - Py_DECREF(coerced); - return 1; - } - if (!PyTuple_Check(coerced) || PyTuple_Size(coerced) != 2) { - /* __coerce__ return value is malformed */ - Py_DECREF(coerced); - PyErr_SetString(PyExc_TypeError, - "coercion should return None or 2-tuple"); - return -1; - } - /* __coerce__ returned two new values */ - *pv = PyTuple_GetItem(coerced, 0); - *pw = PyTuple_GetItem(coerced, 1); - Py_INCREF(*pv); - Py_INCREF(*pw); - Py_DECREF(coerced); - return 0; -} - -#define UNARY(funcname, methodname) \ -static PyObject *funcname(PyInstanceObject *self) { \ - static PyObject *o; \ - if (o == NULL) { o = PyString_InternFromString(methodname); \ - if (o == NULL) return NULL; } \ - return generic_unary_op(self, o); \ -} - -/* unary function with a fallback */ -#define UNARY_FB(funcname, methodname, funcname_fb) \ -static PyObject *funcname(PyInstanceObject *self) { \ - static PyObject *o; \ - if (o == NULL) { o = PyString_InternFromString(methodname); \ - if (o == NULL) return NULL; } \ - if (PyObject_HasAttr((PyObject*)self, o)) \ - return generic_unary_op(self, o); \ - else \ - return funcname_fb(self); \ -} - -#define BINARY(f, m, n) \ -static PyObject *f(PyObject *v, PyObject *w) { \ - return do_binop(v, w, "__" m "__", "__r" m "__", n); \ -} - -#define BINARY_INPLACE(f, m, n) \ -static PyObject *f(PyObject *v, PyObject *w) { \ - return do_binop_inplace(v, w, "__i" m "__", "__" m "__", \ - "__r" m "__", n); \ -} - -UNARY(instance_neg, "__neg__") -UNARY(instance_pos, "__pos__") -UNARY(instance_abs, "__abs__") - -BINARY(instance_or, "or", PyNumber_Or) -BINARY(instance_and, "and", PyNumber_And) -BINARY(instance_xor, "xor", PyNumber_Xor) -BINARY(instance_lshift, "lshift", PyNumber_Lshift) -BINARY(instance_rshift, "rshift", PyNumber_Rshift) -BINARY(instance_add, "add", PyNumber_Add) -BINARY(instance_sub, "sub", PyNumber_Subtract) -BINARY(instance_mul, "mul", PyNumber_Multiply) -BINARY(instance_div, "div", PyNumber_Divide) -BINARY(instance_mod, "mod", PyNumber_Remainder) -BINARY(instance_divmod, "divmod", PyNumber_Divmod) -BINARY(instance_floordiv, "floordiv", PyNumber_FloorDivide) -BINARY(instance_truediv, "truediv", PyNumber_TrueDivide) - -BINARY_INPLACE(instance_ior, "or", PyNumber_InPlaceOr) -BINARY_INPLACE(instance_ixor, "xor", PyNumber_InPlaceXor) -BINARY_INPLACE(instance_iand, "and", PyNumber_InPlaceAnd) -BINARY_INPLACE(instance_ilshift, "lshift", PyNumber_InPlaceLshift) -BINARY_INPLACE(instance_irshift, "rshift", PyNumber_InPlaceRshift) -BINARY_INPLACE(instance_iadd, "add", PyNumber_InPlaceAdd) -BINARY_INPLACE(instance_isub, "sub", PyNumber_InPlaceSubtract) -BINARY_INPLACE(instance_imul, "mul", PyNumber_InPlaceMultiply) -BINARY_INPLACE(instance_idiv, "div", PyNumber_InPlaceDivide) -BINARY_INPLACE(instance_imod, "mod", PyNumber_InPlaceRemainder) -BINARY_INPLACE(instance_ifloordiv, "floordiv", PyNumber_InPlaceFloorDivide) -BINARY_INPLACE(instance_itruediv, "truediv", PyNumber_InPlaceTrueDivide) - -/* Try a 3-way comparison, returning an int; v is an instance. Return: - -2 for an exception; - -1 if v < w; - 0 if v == w; - 1 if v > w; - 2 if this particular 3-way comparison is not implemented or undefined. -*/ -static int -half_cmp(PyObject *v, PyObject *w) -{ - static PyObject *cmp_obj; - PyObject *args; - PyObject *cmp_func; - PyObject *result; - long l; - - assert(PyInstance_Check(v)); - - if (cmp_obj == NULL) { - cmp_obj = PyString_InternFromString("__cmp__"); - if (cmp_obj == NULL) - return -2; - } - - cmp_func = PyObject_GetAttr(v, cmp_obj); - if (cmp_func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -2; - PyErr_Clear(); - return 2; - } - - args = PyTuple_Pack(1, w); - if (args == NULL) { - Py_DECREF(cmp_func); - return -2; - } - - result = PyEval_CallObject(cmp_func, args); - Py_DECREF(args); - Py_DECREF(cmp_func); - - if (result == NULL) - return -2; - - if (result == Py_NotImplemented) { - Py_DECREF(result); - return 2; - } - - l = PyInt_AsLong(result); - Py_DECREF(result); - if (l == -1 && PyErr_Occurred()) { - PyErr_SetString(PyExc_TypeError, - "comparison did not return an int"); - return -2; - } - - return l < 0 ? -1 : l > 0 ? 1 : 0; -} - -/* Try a 3-way comparison, returning an int; either v or w is an instance. - We first try a coercion. Return: - -2 for an exception; - -1 if v < w; - 0 if v == w; - 1 if v > w; - 2 if this particular 3-way comparison is not implemented or undefined. - THIS IS ONLY CALLED FROM object.c! -*/ -static int -instance_compare(PyObject *v, PyObject *w) -{ - int c; - - c = PyNumber_CoerceEx(&v, &w); - if (c < 0) - return -2; - if (c == 0) { - /* If neither is now an instance, use regular comparison */ - if (!PyInstance_Check(v) && !PyInstance_Check(w)) { - c = PyObject_Compare(v, w); - Py_DECREF(v); - Py_DECREF(w); - if (PyErr_Occurred()) - return -2; - return c < 0 ? -1 : c > 0 ? 1 : 0; - } - } - else { - /* The coercion didn't do anything. - Treat this the same as returning v and w unchanged. */ - Py_INCREF(v); - Py_INCREF(w); - } - - if (PyInstance_Check(v)) { - c = half_cmp(v, w); - if (c <= 1) { - Py_DECREF(v); - Py_DECREF(w); - return c; - } - } - if (PyInstance_Check(w)) { - c = half_cmp(w, v); - if (c <= 1) { - Py_DECREF(v); - Py_DECREF(w); - if (c >= -1) - c = -c; - return c; - } - } - Py_DECREF(v); - Py_DECREF(w); - return 2; -} - -static int -instance_nonzero(PyInstanceObject *self) -{ - PyObject *func, *res; - long outcome; - static PyObject *nonzerostr; - - if (nonzerostr == NULL) { - nonzerostr = PyString_InternFromString("__nonzero__"); - if (nonzerostr == NULL) - return -1; - } - if ((func = instance_getattr(self, nonzerostr)) == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - if (lenstr == NULL) { - lenstr = PyString_InternFromString("__len__"); - if (lenstr == NULL) - return -1; - } - if ((func = instance_getattr(self, lenstr)) == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_Clear(); - /* Fall back to the default behavior: - all instances are nonzero */ - return 1; - } - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - if (res == NULL) - return -1; - if (!PyInt_Check(res)) { - Py_DECREF(res); - PyErr_SetString(PyExc_TypeError, - "__nonzero__ should return an int"); - return -1; - } - outcome = PyInt_AsLong(res); - Py_DECREF(res); - if (outcome < 0) { - PyErr_SetString(PyExc_ValueError, - "__nonzero__ should return >= 0"); - return -1; - } - return outcome > 0; -} - -static PyObject * -instance_index(PyInstanceObject *self) -{ - PyObject *func, *res; - static PyObject *indexstr = NULL; - - if (indexstr == NULL) { - indexstr = PyString_InternFromString("__index__"); - if (indexstr == NULL) - return NULL; - } - if ((func = instance_getattr(self, indexstr)) == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - PyErr_SetString(PyExc_TypeError, - "object cannot be interpreted as an index"); - return NULL; - } - res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - return res; -} - - -UNARY(instance_invert, "__invert__") -UNARY(_instance_trunc, "__trunc__") - -static PyObject * -instance_int(PyInstanceObject *self) -{ - PyObject *truncated; - static PyObject *int_name; - if (int_name == NULL) { - int_name = PyString_InternFromString("__int__"); - if (int_name == NULL) - return NULL; - } - if (PyObject_HasAttr((PyObject*)self, int_name)) - return generic_unary_op(self, int_name); - - truncated = _instance_trunc(self); - /* __trunc__ is specified to return an Integral type, but - int() needs to return an int. */ - return _PyNumber_ConvertIntegralToInt( - truncated, - "__trunc__ returned non-Integral (type %.200s)"); -} - -UNARY_FB(instance_long, "__long__", instance_int) -UNARY(instance_float, "__float__") -UNARY(instance_oct, "__oct__") -UNARY(instance_hex, "__hex__") - -static PyObject * -bin_power(PyObject *v, PyObject *w) -{ - return PyNumber_Power(v, w, Py_None); -} - -/* This version is for ternary calls only (z != None) */ -static PyObject * -instance_pow(PyObject *v, PyObject *w, PyObject *z) -{ - if (z == Py_None) { - return do_binop(v, w, "__pow__", "__rpow__", bin_power); - } - else { - PyObject *func; - PyObject *args; - PyObject *result; - - /* XXX Doesn't do coercions... */ - func = PyObject_GetAttrString(v, "__pow__"); - if (func == NULL) - return NULL; - args = PyTuple_Pack(2, w, z); - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - result = PyEval_CallObject(func, args); - Py_DECREF(func); - Py_DECREF(args); - return result; - } -} - -static PyObject * -bin_inplace_power(PyObject *v, PyObject *w) -{ - return PyNumber_InPlacePower(v, w, Py_None); -} - - -static PyObject * -instance_ipow(PyObject *v, PyObject *w, PyObject *z) -{ - if (z == Py_None) { - return do_binop_inplace(v, w, "__ipow__", "__pow__", - "__rpow__", bin_inplace_power); - } - else { - /* XXX Doesn't do coercions... */ - PyObject *func; - PyObject *args; - PyObject *result; - - func = PyObject_GetAttrString(v, "__ipow__"); - if (func == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - return instance_pow(v, w, z); - } - args = PyTuple_Pack(2, w, z); - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - result = PyEval_CallObject(func, args); - Py_DECREF(func); - Py_DECREF(args); - return result; - } -} - - -/* Map rich comparison operators to their __xx__ namesakes */ -#define NAME_OPS 6 -static PyObject **name_op = NULL; - -static int -init_name_op(void) -{ - int i; - char *_name_op[] = { - "__lt__", - "__le__", - "__eq__", - "__ne__", - "__gt__", - "__ge__", - }; - - name_op = (PyObject **)malloc(sizeof(PyObject *) * NAME_OPS); - if (name_op == NULL) - return -1; - for (i = 0; i < NAME_OPS; ++i) { - name_op[i] = PyString_InternFromString(_name_op[i]); - if (name_op[i] == NULL) - return -1; - } - return 0; -} - -static PyObject * -half_richcompare(PyObject *v, PyObject *w, int op) -{ - PyObject *method; - PyObject *args; - PyObject *res; - - assert(PyInstance_Check(v)); - - if (name_op == NULL) { - if (init_name_op() < 0) - return NULL; - } - /* If the instance doesn't define an __getattr__ method, use - instance_getattr2 directly because it will not set an - exception on failure. */ - if (((PyInstanceObject *)v)->in_class->cl_getattr == NULL) - method = instance_getattr2((PyInstanceObject *)v, - name_op[op]); - else - method = PyObject_GetAttr(v, name_op[op]); - if (method == NULL) { - if (PyErr_Occurred()) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - } - res = Py_NotImplemented; - Py_INCREF(res); - return res; - } - - args = PyTuple_Pack(1, w); - if (args == NULL) { - Py_DECREF(method); - return NULL; - } - - res = PyEval_CallObject(method, args); - Py_DECREF(args); - Py_DECREF(method); - - return res; -} - -static PyObject * -instance_richcompare(PyObject *v, PyObject *w, int op) -{ - PyObject *res; - - if (PyInstance_Check(v)) { - res = half_richcompare(v, w, op); - if (res != Py_NotImplemented) - return res; - Py_DECREF(res); - } - - if (PyInstance_Check(w)) { - res = half_richcompare(w, v, _Py_SwappedOp[op]); - if (res != Py_NotImplemented) - return res; - Py_DECREF(res); - } - - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -/* Get the iterator */ -static PyObject * -instance_getiter(PyInstanceObject *self) -{ - PyObject *func; - - if (iterstr == NULL) { - iterstr = PyString_InternFromString("__iter__"); - if (iterstr == NULL) - return NULL; - } - if (getitemstr == NULL) { - getitemstr = PyString_InternFromString("__getitem__"); - if (getitemstr == NULL) - return NULL; - } - - if ((func = instance_getattr(self, iterstr)) != NULL) { - PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - if (res != NULL && !PyIter_Check(res)) { - PyErr_Format(PyExc_TypeError, - "__iter__ returned non-iterator " - "of type '%.100s'", - res->ob_type->tp_name); - Py_DECREF(res); - res = NULL; - } - return res; - } - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - if ((func = instance_getattr(self, getitemstr)) == NULL) { - PyErr_SetString(PyExc_TypeError, - "iteration over non-sequence"); - return NULL; - } - Py_DECREF(func); - return PySeqIter_New((PyObject *)self); -} - - -/* Call the iterator's next */ -static PyObject * -instance_iternext(PyInstanceObject *self) -{ - PyObject *func; - - if (nextstr == NULL) { - nextstr = PyString_InternFromString("next"); - if (nextstr == NULL) - return NULL; - } - - if ((func = instance_getattr(self, nextstr)) != NULL) { - PyObject *res = PyEval_CallObject(func, (PyObject *)NULL); - Py_DECREF(func); - if (res != NULL) { - return res; - } - if (PyErr_ExceptionMatches(PyExc_StopIteration)) { - PyErr_Clear(); - return NULL; - } - return NULL; - } - PyErr_SetString(PyExc_TypeError, "instance has no next() method"); - return NULL; -} - -static PyObject * -instance_call(PyObject *func, PyObject *arg, PyObject *kw) -{ - PyObject *res, *call = PyObject_GetAttrString(func, "__call__"); - if (call == NULL) { - PyInstanceObject *inst = (PyInstanceObject*) func; - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - PyErr_Format(PyExc_AttributeError, - "%.200s instance has no __call__ method", - PyString_AsString(inst->in_class->cl_name)); - return NULL; - } - /* We must check and increment the recursion depth here. Scenario: - class A: - pass - A.__call__ = A() # that's right - a = A() # ok - a() # infinite recursion - This bounces between instance_call() and PyObject_Call() without - ever hitting eval_frame() (which has the main recursion check). */ - if (Py_EnterRecursiveCall(" in __call__")) { - res = NULL; - } - else { - res = PyObject_Call(call, arg, kw); - Py_LeaveRecursiveCall(); - } - Py_DECREF(call); - return res; -} - - -static PyNumberMethods instance_as_number = { - instance_add, /* nb_add */ - instance_sub, /* nb_subtract */ - instance_mul, /* nb_multiply */ - instance_div, /* nb_divide */ - instance_mod, /* nb_remainder */ - instance_divmod, /* nb_divmod */ - instance_pow, /* nb_power */ - (unaryfunc)instance_neg, /* nb_negative */ - (unaryfunc)instance_pos, /* nb_positive */ - (unaryfunc)instance_abs, /* nb_absolute */ - (inquiry)instance_nonzero, /* nb_nonzero */ - (unaryfunc)instance_invert, /* nb_invert */ - instance_lshift, /* nb_lshift */ - instance_rshift, /* nb_rshift */ - instance_and, /* nb_and */ - instance_xor, /* nb_xor */ - instance_or, /* nb_or */ - instance_coerce, /* nb_coerce */ - (unaryfunc)instance_int, /* nb_int */ - (unaryfunc)instance_long, /* nb_long */ - (unaryfunc)instance_float, /* nb_float */ - (unaryfunc)instance_oct, /* nb_oct */ - (unaryfunc)instance_hex, /* nb_hex */ - instance_iadd, /* nb_inplace_add */ - instance_isub, /* nb_inplace_subtract */ - instance_imul, /* nb_inplace_multiply */ - instance_idiv, /* nb_inplace_divide */ - instance_imod, /* nb_inplace_remainder */ - instance_ipow, /* nb_inplace_power */ - instance_ilshift, /* nb_inplace_lshift */ - instance_irshift, /* nb_inplace_rshift */ - instance_iand, /* nb_inplace_and */ - instance_ixor, /* nb_inplace_xor */ - instance_ior, /* nb_inplace_or */ - instance_floordiv, /* nb_floor_divide */ - instance_truediv, /* nb_true_divide */ - instance_ifloordiv, /* nb_inplace_floor_divide */ - instance_itruediv, /* nb_inplace_true_divide */ - (unaryfunc)instance_index, /* nb_index */ -}; - -PyTypeObject PyInstance_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, - "instance", - sizeof(PyInstanceObject), - 0, - (destructor)instance_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - instance_compare, /* tp_compare */ - (reprfunc)instance_repr, /* tp_repr */ - &instance_as_number, /* tp_as_number */ - &instance_as_sequence, /* tp_as_sequence */ - &instance_as_mapping, /* tp_as_mapping */ - (hashfunc)instance_hash, /* tp_hash */ - instance_call, /* tp_call */ - (reprfunc)instance_str, /* tp_str */ - (getattrofunc)instance_getattr, /* tp_getattro */ - (setattrofunc)instance_setattr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES,/*tp_flags*/ - instance_doc, /* tp_doc */ - (traverseproc)instance_traverse, /* tp_traverse */ - 0, /* tp_clear */ - instance_richcompare, /* tp_richcompare */ - offsetof(PyInstanceObject, in_weakreflist), /* tp_weaklistoffset */ - (getiterfunc)instance_getiter, /* tp_iter */ - (iternextfunc)instance_iternext, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - instance_new, /* tp_new */ -}; - - -/* Instance method objects are used for two purposes: - (a) as bound instance methods (returned by instancename.methodname) - (b) as unbound methods (returned by ClassName.methodname) - In case (b), im_self is NULL -*/ - -PyObject * -PyMethod_New(PyObject *func, PyObject *self, PyObject *klass) -{ - register PyMethodObject *im; - im = free_list; - if (im != NULL) { - free_list = (PyMethodObject *)(im->im_self); - PyObject_INIT(im, &PyMethod_Type); - numfree--; - } - else { - im = PyObject_GC_New(PyMethodObject, &PyMethod_Type); - if (im == NULL) - return NULL; - } - im->im_weakreflist = NULL; - Py_INCREF(func); - im->im_func = func; - Py_XINCREF(self); - im->im_self = self; - Py_XINCREF(klass); - im->im_class = klass; - _PyObject_GC_TRACK(im); - return (PyObject *)im; -} - -/* Descriptors for PyMethod attributes */ - -/* im_class, im_func and im_self are stored in the PyMethod object */ - -#define OFF(x) offsetof(PyMethodObject, x) - -static PyMemberDef instancemethod_memberlist[] = { - {"im_class", T_OBJECT, OFF(im_class), READONLY|RESTRICTED, - "the class associated with a method"}, - {"im_func", T_OBJECT, OFF(im_func), READONLY|RESTRICTED, - "the function (or other callable) implementing a method"}, - {"__func__", T_OBJECT, OFF(im_func), READONLY|RESTRICTED, - "the function (or other callable) implementing a method"}, - {"im_self", T_OBJECT, OFF(im_self), READONLY|RESTRICTED, - "the instance to which a method is bound; None for unbound methods"}, - {"__self__", T_OBJECT, OFF(im_self), READONLY|RESTRICTED, - "the instance to which a method is bound; None for unbound methods"}, - {NULL} /* Sentinel */ -}; - -/* Christian Tismer argued convincingly that method attributes should - (nearly) always override function attributes. - The one exception is __doc__; there's a default __doc__ which - should only be used for the class, not for instances */ - -static PyObject * -instancemethod_get_doc(PyMethodObject *im, void *context) -{ - static PyObject *docstr; - if (docstr == NULL) { - docstr= PyString_InternFromString("__doc__"); - if (docstr == NULL) - return NULL; - } - return PyObject_GetAttr(im->im_func, docstr); -} - -static PyGetSetDef instancemethod_getset[] = { - {"__doc__", (getter)instancemethod_get_doc, NULL, NULL}, - {0} -}; - -static PyObject * -instancemethod_getattro(PyObject *obj, PyObject *name) -{ - PyMethodObject *im = (PyMethodObject *)obj; - PyTypeObject *tp = obj->ob_type; - PyObject *descr = NULL; - - if (PyType_HasFeature(tp, Py_TPFLAGS_HAVE_CLASS)) { - if (tp->tp_dict == NULL) { - if (PyType_Ready(tp) < 0) - return NULL; - } - descr = _PyType_Lookup(tp, name); - } - - if (descr != NULL) { - descrgetfunc f = TP_DESCR_GET(descr->ob_type); - if (f != NULL) - return f(descr, obj, (PyObject *)obj->ob_type); - else { - Py_INCREF(descr); - return descr; - } - } - - return PyObject_GetAttr(im->im_func, name); -} - -PyDoc_STRVAR(instancemethod_doc, -"instancemethod(function, instance, class)\n\ -\n\ -Create an instance method object."); - -static PyObject * -instancemethod_new(PyTypeObject* type, PyObject* args, PyObject *kw) -{ - PyObject *func; - PyObject *self; - PyObject *classObj = NULL; - - if (!_PyArg_NoKeywords("instancemethod", kw)) - return NULL; - if (!PyArg_UnpackTuple(args, "instancemethod", 2, 3, - &func, &self, &classObj)) - return NULL; - if (!PyCallable_Check(func)) { - PyErr_SetString(PyExc_TypeError, - "first argument must be callable"); - return NULL; - } - if (self == Py_None) - self = NULL; - if (self == NULL && classObj == NULL) { - PyErr_SetString(PyExc_TypeError, - "unbound methods must have non-NULL im_class"); - return NULL; - } - - return PyMethod_New(func, self, classObj); -} - -static void -instancemethod_dealloc(register PyMethodObject *im) -{ - _PyObject_GC_UNTRACK(im); - if (im->im_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *)im); - Py_DECREF(im->im_func); - Py_XDECREF(im->im_self); - Py_XDECREF(im->im_class); - if (numfree < PyMethod_MAXFREELIST) { - im->im_self = (PyObject *)free_list; - free_list = im; - numfree++; - } - else { - PyObject_GC_Del(im); - } -} - -static int -instancemethod_compare(PyMethodObject *a, PyMethodObject *b) -{ - int cmp; - cmp = PyObject_Compare(a->im_func, b->im_func); - if (cmp) - return cmp; - - if (a->im_self == b->im_self) - return 0; - if (a->im_self == NULL || b->im_self == NULL) - return (a->im_self < b->im_self) ? -1 : 1; - else - return PyObject_Compare(a->im_self, b->im_self); -} - -static PyObject * -instancemethod_repr(PyMethodObject *a) -{ - PyObject *self = a->im_self; - PyObject *func = a->im_func; - PyObject *klass = a->im_class; - PyObject *funcname = NULL, *klassname = NULL, *result = NULL; - char *sfuncname = "?", *sklassname = "?"; - - funcname = PyObject_GetAttrString(func, "__name__"); - if (funcname == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - } - else if (!PyString_Check(funcname)) { - Py_DECREF(funcname); - funcname = NULL; - } - else - sfuncname = PyString_AS_STRING(funcname); - if (klass == NULL) - klassname = NULL; - else { - klassname = PyObject_GetAttrString(klass, "__name__"); - if (klassname == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return NULL; - PyErr_Clear(); - } - else if (!PyString_Check(klassname)) { - Py_DECREF(klassname); - klassname = NULL; - } - else - sklassname = PyString_AS_STRING(klassname); - } - if (self == NULL) - result = PyString_FromFormat("", - sklassname, sfuncname); - else { - /* XXX Shouldn't use repr() here! */ - PyObject *selfrepr = PyObject_Repr(self); - if (selfrepr == NULL) - goto fail; - if (!PyString_Check(selfrepr)) { - Py_DECREF(selfrepr); - goto fail; - } - result = PyString_FromFormat("", - sklassname, sfuncname, - PyString_AS_STRING(selfrepr)); - Py_DECREF(selfrepr); - } - fail: - Py_XDECREF(funcname); - Py_XDECREF(klassname); - return result; -} - -static long -instancemethod_hash(PyMethodObject *a) -{ - long x, y; - if (a->im_self == NULL) - x = PyObject_Hash(Py_None); - else - x = PyObject_Hash(a->im_self); - if (x == -1) - return -1; - y = PyObject_Hash(a->im_func); - if (y == -1) - return -1; - x = x ^ y; - if (x == -1) - x = -2; - return x; -} - -static int -instancemethod_traverse(PyMethodObject *im, visitproc visit, void *arg) -{ - Py_VISIT(im->im_func); - Py_VISIT(im->im_self); - Py_VISIT(im->im_class); - return 0; -} - -static void -getclassname(PyObject *klass, char *buf, int bufsize) -{ - PyObject *name; - - assert(bufsize > 1); - strcpy(buf, "?"); /* Default outcome */ - if (klass == NULL) - return; - name = PyObject_GetAttrString(klass, "__name__"); - if (name == NULL) { - /* This function cannot return an exception */ - PyErr_Clear(); - return; - } - if (PyString_Check(name)) { - strncpy(buf, PyString_AS_STRING(name), bufsize); - buf[bufsize-1] = '\0'; - } - Py_DECREF(name); -} - -static void -getinstclassname(PyObject *inst, char *buf, int bufsize) -{ - PyObject *klass; - - if (inst == NULL) { - assert(bufsize > 0 && (size_t)bufsize > strlen("nothing")); - strcpy(buf, "nothing"); - return; - } - - klass = PyObject_GetAttrString(inst, "__class__"); - if (klass == NULL) { - /* This function cannot return an exception */ - PyErr_Clear(); - klass = (PyObject *)(inst->ob_type); - Py_INCREF(klass); - } - getclassname(klass, buf, bufsize); - Py_XDECREF(klass); -} - -static PyObject * -instancemethod_call(PyObject *func, PyObject *arg, PyObject *kw) -{ - PyObject *self = PyMethod_GET_SELF(func); - PyObject *klass = PyMethod_GET_CLASS(func); - PyObject *result; - - func = PyMethod_GET_FUNCTION(func); - if (self == NULL) { - /* Unbound methods must be called with an instance of - the class (or a derived class) as first argument */ - int ok; - if (PyTuple_Size(arg) >= 1) - self = PyTuple_GET_ITEM(arg, 0); - if (self == NULL) - ok = 0; - else { - ok = PyObject_IsInstance(self, klass); - if (ok < 0) - return NULL; - } - if (!ok) { - char clsbuf[256]; - char instbuf[256]; - getclassname(klass, clsbuf, sizeof(clsbuf)); - getinstclassname(self, instbuf, sizeof(instbuf)); - PyErr_Format(PyExc_TypeError, - "unbound method %s%s must be called with " - "%s instance as first argument " - "(got %s%s instead)", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - clsbuf, - instbuf, - self == NULL ? "" : " instance"); - return NULL; - } - Py_INCREF(arg); - } - else { - Py_ssize_t argcount = PyTuple_Size(arg); - PyObject *newarg = PyTuple_New(argcount + 1); - int i; - if (newarg == NULL) - return NULL; - Py_INCREF(self); - PyTuple_SET_ITEM(newarg, 0, self); - for (i = 0; i < argcount; i++) { - PyObject *v = PyTuple_GET_ITEM(arg, i); - Py_XINCREF(v); - PyTuple_SET_ITEM(newarg, i+1, v); - } - arg = newarg; - } - result = PyObject_Call((PyObject *)func, arg, kw); - Py_DECREF(arg); - return result; -} - -static PyObject * -instancemethod_descr_get(PyObject *meth, PyObject *obj, PyObject *cls) -{ - /* Don't rebind an already bound method, or an unbound method - of a class that's not a base class of cls. */ - - if (PyMethod_GET_SELF(meth) != NULL) { - /* Already bound */ - Py_INCREF(meth); - return meth; - } - /* No, it is an unbound method */ - if (PyMethod_GET_CLASS(meth) != NULL && cls != NULL) { - /* Do subclass test. If it fails, return meth unchanged. */ - int ok = PyObject_IsSubclass(cls, PyMethod_GET_CLASS(meth)); - if (ok < 0) - return NULL; - if (!ok) { - Py_INCREF(meth); - return meth; - } - } - /* Bind it to obj */ - return PyMethod_New(PyMethod_GET_FUNCTION(meth), obj, cls); -} - -PyTypeObject PyMethod_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, - "instancemethod", - sizeof(PyMethodObject), - 0, - (destructor)instancemethod_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)instancemethod_compare, /* tp_compare */ - (reprfunc)instancemethod_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)instancemethod_hash, /* tp_hash */ - instancemethod_call, /* tp_call */ - 0, /* tp_str */ - instancemethod_getattro, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - instancemethod_doc, /* tp_doc */ - (traverseproc)instancemethod_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyMethodObject, im_weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - instancemethod_memberlist, /* tp_members */ - instancemethod_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - instancemethod_descr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - instancemethod_new, /* tp_new */ -}; - -/* Clear out the free list */ - -int -PyMethod_ClearFreeList(void) -{ - int freelist_size = numfree; - - while (free_list) { - PyMethodObject *im = free_list; - free_list = (PyMethodObject *)(im->im_self); - PyObject_GC_Del(im); - numfree--; - } - assert(numfree == 0); - return freelist_size; -} - -void -PyMethod_Fini(void) -{ - (void)PyMethod_ClearFreeList(); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/cobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/cobject.c deleted file mode 100644 index e287444..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/cobject.c +++ /dev/null @@ -1,172 +0,0 @@ - -/* Wrap void* pointers to be passed between C modules */ - -#include "Python.h" - - -/* Declarations for objects of type PyCObject */ - -typedef void (*destructor1)(void *); -typedef void (*destructor2)(void *, void*); - -static int cobject_deprecation_warning(void) -{ - return PyErr_WarnPy3k("CObject type is not supported in 3.x. " - "Please use capsule objects instead.", 1); -} - - -PyObject * -PyCObject_FromVoidPtr(void *cobj, void (*destr)(void *)) -{ - PyCObject *self; - - if (cobject_deprecation_warning()) { - return NULL; - } - - self = PyObject_NEW(PyCObject, &PyCObject_Type); - if (self == NULL) - return NULL; - self->cobject=cobj; - self->destructor=destr; - self->desc=NULL; - - return (PyObject *)self; -} - -PyObject * -PyCObject_FromVoidPtrAndDesc(void *cobj, void *desc, - void (*destr)(void *, void *)) -{ - PyCObject *self; - - if (cobject_deprecation_warning()) { - return NULL; - } - - if (!desc) { - PyErr_SetString(PyExc_TypeError, - "PyCObject_FromVoidPtrAndDesc called with null" - " description"); - return NULL; - } - self = PyObject_NEW(PyCObject, &PyCObject_Type); - if (self == NULL) - return NULL; - self->cobject = cobj; - self->destructor = (destructor1)destr; - self->desc = desc; - - return (PyObject *)self; -} - -void * -PyCObject_AsVoidPtr(PyObject *self) -{ - if (self) { - if (PyCapsule_CheckExact(self)) { - const char *name = PyCapsule_GetName(self); - return (void *)PyCapsule_GetPointer(self, name); - } - if (self->ob_type == &PyCObject_Type) - return ((PyCObject *)self)->cobject; - PyErr_SetString(PyExc_TypeError, - "PyCObject_AsVoidPtr with non-C-object"); - } - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "PyCObject_AsVoidPtr called with null pointer"); - return NULL; -} - -void * -PyCObject_GetDesc(PyObject *self) -{ - if (self) { - if (self->ob_type == &PyCObject_Type) - return ((PyCObject *)self)->desc; - PyErr_SetString(PyExc_TypeError, - "PyCObject_GetDesc with non-C-object"); - } - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "PyCObject_GetDesc called with null pointer"); - return NULL; -} - -void * -PyCObject_Import(char *module_name, char *name) -{ - PyObject *m, *c; - void *r = NULL; - - if ((m = PyImport_ImportModule(module_name))) { - if ((c = PyObject_GetAttrString(m,name))) { - r = PyCObject_AsVoidPtr(c); - Py_DECREF(c); - } - Py_DECREF(m); - } - return r; -} - -int -PyCObject_SetVoidPtr(PyObject *self, void *cobj) -{ - PyCObject* cself = (PyCObject*)self; - if (cself == NULL || !PyCObject_Check(cself) || - cself->destructor != NULL) { - PyErr_SetString(PyExc_TypeError, - "Invalid call to PyCObject_SetVoidPtr"); - return 0; - } - cself->cobject = cobj; - return 1; -} - -static void -PyCObject_dealloc(PyCObject *self) -{ - if (self->destructor) { - if(self->desc) - ((destructor2)(self->destructor))(self->cobject, self->desc); - else - (self->destructor)(self->cobject); - } - PyObject_DEL(self); -} - - -PyDoc_STRVAR(PyCObject_Type__doc__, -"C objects to be exported from one extension module to another\n\ -\n\ -C objects are used for communication between extension modules. They\n\ -provide a way for an extension module to export a C interface to other\n\ -extension modules, so that extension modules can use the Python import\n\ -mechanism to link to one another."); - -PyTypeObject PyCObject_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "PyCObject", /*tp_name*/ - sizeof(PyCObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)PyCObject_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - 0, /*tp_flags*/ - PyCObject_Type__doc__ /*tp_doc*/ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/codeobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/codeobject.c deleted file mode 100644 index a2bb178..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/codeobject.c +++ /dev/null @@ -1,581 +0,0 @@ -#include "Python.h" -#include "code.h" -#include "structmember.h" - -#define NAME_CHARS \ - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz" - -/* all_name_chars(s): true iff all chars in s are valid NAME_CHARS */ - -static int -all_name_chars(unsigned char *s) -{ - static char ok_name_char[256]; - static unsigned char *name_chars = (unsigned char *)NAME_CHARS; - - if (ok_name_char[*name_chars] == 0) { - unsigned char *p; - for (p = name_chars; *p; p++) - ok_name_char[*p] = 1; - } - while (*s) { - if (ok_name_char[*s++] == 0) - return 0; - } - return 1; -} - -static void -intern_strings(PyObject *tuple) -{ - Py_ssize_t i; - - for (i = PyTuple_GET_SIZE(tuple); --i >= 0; ) { - PyObject *v = PyTuple_GET_ITEM(tuple, i); - if (v == NULL || !PyString_CheckExact(v)) { - Py_FatalError("non-string found in code slot"); - } - PyString_InternInPlace(&PyTuple_GET_ITEM(tuple, i)); - } -} - - -PyCodeObject * -PyCode_New(int argcount, int nlocals, int stacksize, int flags, - PyObject *code, PyObject *consts, PyObject *names, - PyObject *varnames, PyObject *freevars, PyObject *cellvars, - PyObject *filename, PyObject *name, int firstlineno, - PyObject *lnotab) -{ - PyCodeObject *co; - Py_ssize_t i; - /* Check argument types */ - if (argcount < 0 || nlocals < 0 || - code == NULL || - consts == NULL || !PyTuple_Check(consts) || - names == NULL || !PyTuple_Check(names) || - varnames == NULL || !PyTuple_Check(varnames) || - freevars == NULL || !PyTuple_Check(freevars) || - cellvars == NULL || !PyTuple_Check(cellvars) || - name == NULL || !PyString_Check(name) || - filename == NULL || !PyString_Check(filename) || - lnotab == NULL || !PyString_Check(lnotab) || - !PyObject_CheckReadBuffer(code)) { - PyErr_BadInternalCall(); - return NULL; - } - intern_strings(names); - intern_strings(varnames); - intern_strings(freevars); - intern_strings(cellvars); - /* Intern selected string constants */ - for (i = PyTuple_Size(consts); --i >= 0; ) { - PyObject *v = PyTuple_GetItem(consts, i); - if (!PyString_Check(v)) - continue; - if (!all_name_chars((unsigned char *)PyString_AS_STRING(v))) - continue; - PyString_InternInPlace(&PyTuple_GET_ITEM(consts, i)); - } - co = PyObject_NEW(PyCodeObject, &PyCode_Type); - if (co != NULL) { - co->co_argcount = argcount; - co->co_nlocals = nlocals; - co->co_stacksize = stacksize; - co->co_flags = flags; - Py_INCREF(code); - co->co_code = code; - Py_INCREF(consts); - co->co_consts = consts; - Py_INCREF(names); - co->co_names = names; - Py_INCREF(varnames); - co->co_varnames = varnames; - Py_INCREF(freevars); - co->co_freevars = freevars; - Py_INCREF(cellvars); - co->co_cellvars = cellvars; - Py_INCREF(filename); - co->co_filename = filename; - Py_INCREF(name); - co->co_name = name; - co->co_firstlineno = firstlineno; - Py_INCREF(lnotab); - co->co_lnotab = lnotab; - co->co_zombieframe = NULL; - co->co_weakreflist = NULL; - } - return co; -} - -PyCodeObject * -PyCode_NewEmpty(const char *filename, const char *funcname, int firstlineno) -{ - static PyObject *emptystring = NULL; - static PyObject *nulltuple = NULL; - PyObject *filename_ob = NULL; - PyObject *funcname_ob = NULL; - PyCodeObject *result = NULL; - if (emptystring == NULL) { - emptystring = PyString_FromString(""); - if (emptystring == NULL) - goto failed; - } - if (nulltuple == NULL) { - nulltuple = PyTuple_New(0); - if (nulltuple == NULL) - goto failed; - } - funcname_ob = PyString_FromString(funcname); - if (funcname_ob == NULL) - goto failed; - filename_ob = PyString_FromString(filename); - if (filename_ob == NULL) - goto failed; - - result = PyCode_New(0, /* argcount */ - 0, /* nlocals */ - 0, /* stacksize */ - 0, /* flags */ - emptystring, /* code */ - nulltuple, /* consts */ - nulltuple, /* names */ - nulltuple, /* varnames */ - nulltuple, /* freevars */ - nulltuple, /* cellvars */ - filename_ob, /* filename */ - funcname_ob, /* name */ - firstlineno, /* firstlineno */ - emptystring /* lnotab */ - ); - -failed: - Py_XDECREF(funcname_ob); - Py_XDECREF(filename_ob); - return result; -} - -#define OFF(x) offsetof(PyCodeObject, x) - -static PyMemberDef code_memberlist[] = { - {"co_argcount", T_INT, OFF(co_argcount), READONLY}, - {"co_nlocals", T_INT, OFF(co_nlocals), READONLY}, - {"co_stacksize",T_INT, OFF(co_stacksize), READONLY}, - {"co_flags", T_INT, OFF(co_flags), READONLY}, - {"co_code", T_OBJECT, OFF(co_code), READONLY}, - {"co_consts", T_OBJECT, OFF(co_consts), READONLY}, - {"co_names", T_OBJECT, OFF(co_names), READONLY}, - {"co_varnames", T_OBJECT, OFF(co_varnames), READONLY}, - {"co_freevars", T_OBJECT, OFF(co_freevars), READONLY}, - {"co_cellvars", T_OBJECT, OFF(co_cellvars), READONLY}, - {"co_filename", T_OBJECT, OFF(co_filename), READONLY}, - {"co_name", T_OBJECT, OFF(co_name), READONLY}, - {"co_firstlineno", T_INT, OFF(co_firstlineno), READONLY}, - {"co_lnotab", T_OBJECT, OFF(co_lnotab), READONLY}, - {NULL} /* Sentinel */ -}; - -/* Helper for code_new: return a shallow copy of a tuple that is - guaranteed to contain exact strings, by converting string subclasses - to exact strings and complaining if a non-string is found. */ -static PyObject* -validate_and_copy_tuple(PyObject *tup) -{ - PyObject *newtuple; - PyObject *item; - Py_ssize_t i, len; - - len = PyTuple_GET_SIZE(tup); - newtuple = PyTuple_New(len); - if (newtuple == NULL) - return NULL; - - for (i = 0; i < len; i++) { - item = PyTuple_GET_ITEM(tup, i); - if (PyString_CheckExact(item)) { - Py_INCREF(item); - } - else if (!PyString_Check(item)) { - PyErr_Format( - PyExc_TypeError, - "name tuples must contain only " - "strings, not '%.500s'", - item->ob_type->tp_name); - Py_DECREF(newtuple); - return NULL; - } - else { - item = PyString_FromStringAndSize( - PyString_AS_STRING(item), - PyString_GET_SIZE(item)); - if (item == NULL) { - Py_DECREF(newtuple); - return NULL; - } - } - PyTuple_SET_ITEM(newtuple, i, item); - } - - return newtuple; -} - -PyDoc_STRVAR(code_doc, -"code(argcount, nlocals, stacksize, flags, codestring, constants, names,\n\ - varnames, filename, name, firstlineno, lnotab[, freevars[, cellvars]])\n\ -\n\ -Create a code object. Not for the faint of heart."); - -static PyObject * -code_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - int argcount; - int nlocals; - int stacksize; - int flags; - PyObject *co = NULL; - PyObject *code; - PyObject *consts; - PyObject *names, *ournames = NULL; - PyObject *varnames, *ourvarnames = NULL; - PyObject *freevars = NULL, *ourfreevars = NULL; - PyObject *cellvars = NULL, *ourcellvars = NULL; - PyObject *filename; - PyObject *name; - int firstlineno; - PyObject *lnotab; - - if (!PyArg_ParseTuple(args, "iiiiSO!O!O!SSiS|O!O!:code", - &argcount, &nlocals, &stacksize, &flags, - &code, - &PyTuple_Type, &consts, - &PyTuple_Type, &names, - &PyTuple_Type, &varnames, - &filename, &name, - &firstlineno, &lnotab, - &PyTuple_Type, &freevars, - &PyTuple_Type, &cellvars)) - return NULL; - - if (argcount < 0) { - PyErr_SetString( - PyExc_ValueError, - "code: argcount must not be negative"); - goto cleanup; - } - - if (nlocals < 0) { - PyErr_SetString( - PyExc_ValueError, - "code: nlocals must not be negative"); - goto cleanup; - } - - ournames = validate_and_copy_tuple(names); - if (ournames == NULL) - goto cleanup; - ourvarnames = validate_and_copy_tuple(varnames); - if (ourvarnames == NULL) - goto cleanup; - if (freevars) - ourfreevars = validate_and_copy_tuple(freevars); - else - ourfreevars = PyTuple_New(0); - if (ourfreevars == NULL) - goto cleanup; - if (cellvars) - ourcellvars = validate_and_copy_tuple(cellvars); - else - ourcellvars = PyTuple_New(0); - if (ourcellvars == NULL) - goto cleanup; - - co = (PyObject *)PyCode_New(argcount, nlocals, stacksize, flags, - code, consts, ournames, ourvarnames, - ourfreevars, ourcellvars, filename, - name, firstlineno, lnotab); - cleanup: - Py_XDECREF(ournames); - Py_XDECREF(ourvarnames); - Py_XDECREF(ourfreevars); - Py_XDECREF(ourcellvars); - return co; -} - -static void -code_dealloc(PyCodeObject *co) -{ - Py_XDECREF(co->co_code); - Py_XDECREF(co->co_consts); - Py_XDECREF(co->co_names); - Py_XDECREF(co->co_varnames); - Py_XDECREF(co->co_freevars); - Py_XDECREF(co->co_cellvars); - Py_XDECREF(co->co_filename); - Py_XDECREF(co->co_name); - Py_XDECREF(co->co_lnotab); - if (co->co_zombieframe != NULL) - PyObject_GC_Del(co->co_zombieframe); - if (co->co_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject*)co); - PyObject_DEL(co); -} - -static PyObject * -code_repr(PyCodeObject *co) -{ - char buf[500]; - int lineno = -1; - char *filename = "???"; - char *name = "???"; - - if (co->co_firstlineno != 0) - lineno = co->co_firstlineno; - if (co->co_filename && PyString_Check(co->co_filename)) - filename = PyString_AS_STRING(co->co_filename); - if (co->co_name && PyString_Check(co->co_name)) - name = PyString_AS_STRING(co->co_name); - PyOS_snprintf(buf, sizeof(buf), - "", - name, co, filename, lineno); - return PyString_FromString(buf); -} - -static int -code_compare(PyCodeObject *co, PyCodeObject *cp) -{ - int cmp; - cmp = PyObject_Compare(co->co_name, cp->co_name); - if (cmp) return cmp; - cmp = co->co_argcount - cp->co_argcount; - if (cmp) goto normalize; - cmp = co->co_nlocals - cp->co_nlocals; - if (cmp) goto normalize; - cmp = co->co_flags - cp->co_flags; - if (cmp) goto normalize; - cmp = co->co_firstlineno - cp->co_firstlineno; - if (cmp) goto normalize; - cmp = PyObject_Compare(co->co_code, cp->co_code); - if (cmp) return cmp; - cmp = PyObject_Compare(co->co_consts, cp->co_consts); - if (cmp) return cmp; - cmp = PyObject_Compare(co->co_names, cp->co_names); - if (cmp) return cmp; - cmp = PyObject_Compare(co->co_varnames, cp->co_varnames); - if (cmp) return cmp; - cmp = PyObject_Compare(co->co_freevars, cp->co_freevars); - if (cmp) return cmp; - cmp = PyObject_Compare(co->co_cellvars, cp->co_cellvars); - return cmp; - - normalize: - if (cmp > 0) - return 1; - else if (cmp < 0) - return -1; - else - return 0; -} - -static PyObject * -code_richcompare(PyObject *self, PyObject *other, int op) -{ - PyCodeObject *co, *cp; - int eq; - PyObject *res; - - if ((op != Py_EQ && op != Py_NE) || - !PyCode_Check(self) || - !PyCode_Check(other)) { - - /* Py3K warning if types are not equal and comparison - isn't == or != */ - if (PyErr_WarnPy3k("code inequality comparisons not supported " - "in 3.x", 1) < 0) { - return NULL; - } - - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - co = (PyCodeObject *)self; - cp = (PyCodeObject *)other; - - eq = PyObject_RichCompareBool(co->co_name, cp->co_name, Py_EQ); - if (eq <= 0) goto unequal; - eq = co->co_argcount == cp->co_argcount; - if (!eq) goto unequal; - eq = co->co_nlocals == cp->co_nlocals; - if (!eq) goto unequal; - eq = co->co_flags == cp->co_flags; - if (!eq) goto unequal; - eq = co->co_firstlineno == cp->co_firstlineno; - if (!eq) goto unequal; - eq = PyObject_RichCompareBool(co->co_code, cp->co_code, Py_EQ); - if (eq <= 0) goto unequal; - eq = PyObject_RichCompareBool(co->co_consts, cp->co_consts, Py_EQ); - if (eq <= 0) goto unequal; - eq = PyObject_RichCompareBool(co->co_names, cp->co_names, Py_EQ); - if (eq <= 0) goto unequal; - eq = PyObject_RichCompareBool(co->co_varnames, cp->co_varnames, Py_EQ); - if (eq <= 0) goto unequal; - eq = PyObject_RichCompareBool(co->co_freevars, cp->co_freevars, Py_EQ); - if (eq <= 0) goto unequal; - eq = PyObject_RichCompareBool(co->co_cellvars, cp->co_cellvars, Py_EQ); - if (eq <= 0) goto unequal; - - if (op == Py_EQ) - res = Py_True; - else - res = Py_False; - goto done; - - unequal: - if (eq < 0) - return NULL; - if (op == Py_NE) - res = Py_True; - else - res = Py_False; - - done: - Py_INCREF(res); - return res; -} - -static long -code_hash(PyCodeObject *co) -{ - long h, h0, h1, h2, h3, h4, h5, h6; - h0 = PyObject_Hash(co->co_name); - if (h0 == -1) return -1; - h1 = PyObject_Hash(co->co_code); - if (h1 == -1) return -1; - h2 = PyObject_Hash(co->co_consts); - if (h2 == -1) return -1; - h3 = PyObject_Hash(co->co_names); - if (h3 == -1) return -1; - h4 = PyObject_Hash(co->co_varnames); - if (h4 == -1) return -1; - h5 = PyObject_Hash(co->co_freevars); - if (h5 == -1) return -1; - h6 = PyObject_Hash(co->co_cellvars); - if (h6 == -1) return -1; - h = h0 ^ h1 ^ h2 ^ h3 ^ h4 ^ h5 ^ h6 ^ - co->co_argcount ^ co->co_nlocals ^ co->co_flags; - if (h == -1) h = -2; - return h; -} - -/* XXX code objects need to participate in GC? */ - -PyTypeObject PyCode_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "code", - sizeof(PyCodeObject), - 0, - (destructor)code_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)code_compare, /* tp_compare */ - (reprfunc)code_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)code_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - code_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - code_richcompare, /* tp_richcompare */ - offsetof(PyCodeObject, co_weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - code_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - code_new, /* tp_new */ -}; - -/* Use co_lnotab to compute the line number from a bytecode index, addrq. See - lnotab_notes.txt for the details of the lnotab representation. -*/ - -int -PyCode_Addr2Line(PyCodeObject *co, int addrq) -{ - int size = PyString_Size(co->co_lnotab) / 2; - unsigned char *p = (unsigned char*)PyString_AsString(co->co_lnotab); - int line = co->co_firstlineno; - int addr = 0; - while (--size >= 0) { - addr += *p++; - if (addr > addrq) - break; - line += *p++; - } - return line; -} - -/* Update *bounds to describe the first and one-past-the-last instructions in - the same line as lasti. Return the number of that line. */ -int -_PyCode_CheckLineNumber(PyCodeObject* co, int lasti, PyAddrPair *bounds) -{ - int size, addr, line; - unsigned char* p; - - p = (unsigned char*)PyString_AS_STRING(co->co_lnotab); - size = PyString_GET_SIZE(co->co_lnotab) / 2; - - addr = 0; - line = co->co_firstlineno; - assert(line > 0); - - /* possible optimization: if f->f_lasti == instr_ub - (likely to be a common case) then we already know - instr_lb -- if we stored the matching value of p - somwhere we could skip the first while loop. */ - - /* See lnotab_notes.txt for the description of - co_lnotab. A point to remember: increments to p - come in (addr, line) pairs. */ - - bounds->ap_lower = 0; - while (size > 0) { - if (addr + *p > lasti) - break; - addr += *p++; - if (*p) - bounds->ap_lower = addr; - line += *p++; - --size; - } - - if (size > 0) { - while (--size >= 0) { - addr += *p++; - if (*p++) - break; - } - bounds->ap_upper = addr; - } - else { - bounds->ap_upper = INT_MAX; - } - - return line; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/complexobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/complexobject.c deleted file mode 100644 index 200534c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/complexobject.c +++ /dev/null @@ -1,1357 +0,0 @@ - -/* Complex object implementation */ - -/* Borrows heavily from floatobject.c */ - -/* Submitted by Jim Hugunin */ - -#include "Python.h" -#include "structmember.h" - -#ifndef WITHOUT_COMPLEX - -/* Precisions used by repr() and str(), respectively. - - The repr() precision (17 significant decimal digits) is the minimal number - that is guaranteed to have enough precision so that if the number is read - back in the exact same binary value is recreated. This is true for IEEE - floating point by design, and also happens to work for all other modern - hardware. - - The str() precision is chosen so that in most cases, the rounding noise - created by various operations is suppressed, while giving plenty of - precision for practical use. -*/ - -#define PREC_REPR 17 -#define PREC_STR 12 - -/* elementary operations on complex numbers */ - -static Py_complex c_1 = {1., 0.}; - -Py_complex -c_sum(Py_complex a, Py_complex b) -{ - Py_complex r; - r.real = a.real + b.real; - r.imag = a.imag + b.imag; - return r; -} - -Py_complex -c_diff(Py_complex a, Py_complex b) -{ - Py_complex r; - r.real = a.real - b.real; - r.imag = a.imag - b.imag; - return r; -} - -Py_complex -c_neg(Py_complex a) -{ - Py_complex r; - r.real = -a.real; - r.imag = -a.imag; - return r; -} - -Py_complex -c_prod(Py_complex a, Py_complex b) -{ - Py_complex r; - r.real = a.real*b.real - a.imag*b.imag; - r.imag = a.real*b.imag + a.imag*b.real; - return r; -} - -Py_complex -c_quot(Py_complex a, Py_complex b) -{ - /****************************************************************** - This was the original algorithm. It's grossly prone to spurious - overflow and underflow errors. It also merrily divides by 0 despite - checking for that(!). The code still serves a doc purpose here, as - the algorithm following is a simple by-cases transformation of this - one: - - Py_complex r; - double d = b.real*b.real + b.imag*b.imag; - if (d == 0.) - errno = EDOM; - r.real = (a.real*b.real + a.imag*b.imag)/d; - r.imag = (a.imag*b.real - a.real*b.imag)/d; - return r; - ******************************************************************/ - - /* This algorithm is better, and is pretty obvious: first divide the - * numerators and denominator by whichever of {b.real, b.imag} has - * larger magnitude. The earliest reference I found was to CACM - * Algorithm 116 (Complex Division, Robert L. Smith, Stanford - * University). As usual, though, we're still ignoring all IEEE - * endcases. - */ - Py_complex r; /* the result */ - const double abs_breal = b.real < 0 ? -b.real : b.real; - const double abs_bimag = b.imag < 0 ? -b.imag : b.imag; - - if (abs_breal >= abs_bimag) { - /* divide tops and bottom by b.real */ - if (abs_breal == 0.0) { - errno = EDOM; - r.real = r.imag = 0.0; - } - else { - const double ratio = b.imag / b.real; - const double denom = b.real + b.imag * ratio; - r.real = (a.real + a.imag * ratio) / denom; - r.imag = (a.imag - a.real * ratio) / denom; - } - } - else if (abs_bimag >= abs_breal) { - /* divide tops and bottom by b.imag */ - const double ratio = b.real / b.imag; - const double denom = b.real * ratio + b.imag; - assert(b.imag != 0.0); - r.real = (a.real * ratio + a.imag) / denom; - r.imag = (a.imag * ratio - a.real) / denom; - } - else { - /* At least one of b.real or b.imag is a NaN */ - r.real = r.imag = Py_NAN; - } - return r; -} - -Py_complex -c_pow(Py_complex a, Py_complex b) -{ - Py_complex r; - double vabs,len,at,phase; - if (b.real == 0. && b.imag == 0.) { - r.real = 1.; - r.imag = 0.; - } - else if (a.real == 0. && a.imag == 0.) { - if (b.imag != 0. || b.real < 0.) - errno = EDOM; - r.real = 0.; - r.imag = 0.; - } - else { - vabs = hypot(a.real,a.imag); - len = pow(vabs,b.real); - at = atan2(a.imag, a.real); - phase = at*b.real; - if (b.imag != 0.0) { - len /= exp(at*b.imag); - phase += b.imag*log(vabs); - } - r.real = len*cos(phase); - r.imag = len*sin(phase); - } - return r; -} - -static Py_complex -c_powu(Py_complex x, long n) -{ - Py_complex r, p; - long mask = 1; - r = c_1; - p = x; - while (mask > 0 && n >= mask) { - if (n & mask) - r = c_prod(r,p); - mask <<= 1; - p = c_prod(p,p); - } - return r; -} - -static Py_complex -c_powi(Py_complex x, long n) -{ - Py_complex cn; - - if (n > 100 || n < -100) { - cn.real = (double) n; - cn.imag = 0.; - return c_pow(x,cn); - } - else if (n > 0) - return c_powu(x,n); - else - return c_quot(c_1,c_powu(x,-n)); - -} - -double -c_abs(Py_complex z) -{ - /* sets errno = ERANGE on overflow; otherwise errno = 0 */ - double result; - - if (!Py_IS_FINITE(z.real) || !Py_IS_FINITE(z.imag)) { - /* C99 rules: if either the real or the imaginary part is an - infinity, return infinity, even if the other part is a - NaN. */ - if (Py_IS_INFINITY(z.real)) { - result = fabs(z.real); - errno = 0; - return result; - } - if (Py_IS_INFINITY(z.imag)) { - result = fabs(z.imag); - errno = 0; - return result; - } - /* either the real or imaginary part is a NaN, - and neither is infinite. Result should be NaN. */ - return Py_NAN; - } - result = hypot(z.real, z.imag); - if (!Py_IS_FINITE(result)) - errno = ERANGE; - else - errno = 0; - return result; -} - -static PyObject * -complex_subtype_from_c_complex(PyTypeObject *type, Py_complex cval) -{ - PyObject *op; - - op = type->tp_alloc(type, 0); - if (op != NULL) - ((PyComplexObject *)op)->cval = cval; - return op; -} - -PyObject * -PyComplex_FromCComplex(Py_complex cval) -{ - register PyComplexObject *op; - - /* Inline PyObject_New */ - op = (PyComplexObject *) PyObject_MALLOC(sizeof(PyComplexObject)); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT(op, &PyComplex_Type); - op->cval = cval; - return (PyObject *) op; -} - -static PyObject * -complex_subtype_from_doubles(PyTypeObject *type, double real, double imag) -{ - Py_complex c; - c.real = real; - c.imag = imag; - return complex_subtype_from_c_complex(type, c); -} - -PyObject * -PyComplex_FromDoubles(double real, double imag) -{ - Py_complex c; - c.real = real; - c.imag = imag; - return PyComplex_FromCComplex(c); -} - -double -PyComplex_RealAsDouble(PyObject *op) -{ - if (PyComplex_Check(op)) { - return ((PyComplexObject *)op)->cval.real; - } - else { - return PyFloat_AsDouble(op); - } -} - -double -PyComplex_ImagAsDouble(PyObject *op) -{ - if (PyComplex_Check(op)) { - return ((PyComplexObject *)op)->cval.imag; - } - else { - return 0.0; - } -} - -static PyObject * -try_complex_special_method(PyObject *op) { - PyObject *f; - static PyObject *complexstr; - - if (complexstr == NULL) { - complexstr = PyString_InternFromString("__complex__"); - if (complexstr == NULL) - return NULL; - } - if (PyInstance_Check(op)) { - f = PyObject_GetAttr(op, complexstr); - if (f == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - } - } - else { - f = _PyObject_LookupSpecial(op, "__complex__", &complexstr); - if (f == NULL && PyErr_Occurred()) - return NULL; - } - if (f != NULL) { - PyObject *res = PyObject_CallFunctionObjArgs(f, NULL); - Py_DECREF(f); - return res; - } - return NULL; -} - -Py_complex -PyComplex_AsCComplex(PyObject *op) -{ - Py_complex cv; - PyObject *newop = NULL; - - assert(op); - /* If op is already of type PyComplex_Type, return its value */ - if (PyComplex_Check(op)) { - return ((PyComplexObject *)op)->cval; - } - /* If not, use op's __complex__ method, if it exists */ - - /* return -1 on failure */ - cv.real = -1.; - cv.imag = 0.; - - newop = try_complex_special_method(op); - - if (newop) { - if (!PyComplex_Check(newop)) { - PyErr_SetString(PyExc_TypeError, - "__complex__ should return a complex object"); - Py_DECREF(newop); - return cv; - } - cv = ((PyComplexObject *)newop)->cval; - Py_DECREF(newop); - return cv; - } - else if (PyErr_Occurred()) { - return cv; - } - /* If neither of the above works, interpret op as a float giving the - real part of the result, and fill in the imaginary part as 0. */ - else { - /* PyFloat_AsDouble will return -1 on failure */ - cv.real = PyFloat_AsDouble(op); - return cv; - } -} - -static void -complex_dealloc(PyObject *op) -{ - op->ob_type->tp_free(op); -} - - -static PyObject * -complex_format(PyComplexObject *v, int precision, char format_code) -{ - PyObject *result = NULL; - Py_ssize_t len; - - /* If these are non-NULL, they'll need to be freed. */ - char *pre = NULL; - char *im = NULL; - char *buf = NULL; - - /* These do not need to be freed. re is either an alias - for pre or a pointer to a constant. lead and tail - are pointers to constants. */ - char *re = NULL; - char *lead = ""; - char *tail = ""; - - if (v->cval.real == 0. && copysign(1.0, v->cval.real)==1.0) { - re = ""; - im = PyOS_double_to_string(v->cval.imag, format_code, - precision, 0, NULL); - if (!im) { - PyErr_NoMemory(); - goto done; - } - } else { - /* Format imaginary part with sign, real part without */ - pre = PyOS_double_to_string(v->cval.real, format_code, - precision, 0, NULL); - if (!pre) { - PyErr_NoMemory(); - goto done; - } - re = pre; - - im = PyOS_double_to_string(v->cval.imag, format_code, - precision, Py_DTSF_SIGN, NULL); - if (!im) { - PyErr_NoMemory(); - goto done; - } - lead = "("; - tail = ")"; - } - /* Alloc the final buffer. Add one for the "j" in the format string, - and one for the trailing zero. */ - len = strlen(lead) + strlen(re) + strlen(im) + strlen(tail) + 2; - buf = PyMem_Malloc(len); - if (!buf) { - PyErr_NoMemory(); - goto done; - } - PyOS_snprintf(buf, len, "%s%s%sj%s", lead, re, im, tail); - result = PyString_FromString(buf); - done: - PyMem_Free(im); - PyMem_Free(pre); - PyMem_Free(buf); - - return result; -} - -static int -complex_print(PyComplexObject *v, FILE *fp, int flags) -{ - PyObject *formatv; - char *buf; - if (flags & Py_PRINT_RAW) - formatv = complex_format(v, PyFloat_STR_PRECISION, 'g'); - else - formatv = complex_format(v, 0, 'r'); - if (formatv == NULL) - return -1; - buf = PyString_AS_STRING(formatv); - Py_BEGIN_ALLOW_THREADS - fputs(buf, fp); - Py_END_ALLOW_THREADS - Py_DECREF(formatv); - return 0; -} - -static PyObject * -complex_repr(PyComplexObject *v) -{ - return complex_format(v, 0, 'r'); -} - -static PyObject * -complex_str(PyComplexObject *v) -{ - return complex_format(v, PyFloat_STR_PRECISION, 'g'); -} - -static long -complex_hash(PyComplexObject *v) -{ - long hashreal, hashimag, combined; - hashreal = _Py_HashDouble(v->cval.real); - if (hashreal == -1) - return -1; - hashimag = _Py_HashDouble(v->cval.imag); - if (hashimag == -1) - return -1; - /* Note: if the imaginary part is 0, hashimag is 0 now, - * so the following returns hashreal unchanged. This is - * important because numbers of different types that - * compare equal must have the same hash value, so that - * hash(x + 0*j) must equal hash(x). - */ - combined = hashreal + 1000003 * hashimag; - if (combined == -1) - combined = -2; - return combined; -} - -/* This macro may return! */ -#define TO_COMPLEX(obj, c) \ - if (PyComplex_Check(obj)) \ - c = ((PyComplexObject *)(obj))->cval; \ - else if (to_complex(&(obj), &(c)) < 0) \ - return (obj) - -static int -to_complex(PyObject **pobj, Py_complex *pc) -{ - PyObject *obj = *pobj; - - pc->real = pc->imag = 0.0; - if (PyInt_Check(obj)) { - pc->real = PyInt_AS_LONG(obj); - return 0; - } - if (PyLong_Check(obj)) { - pc->real = PyLong_AsDouble(obj); - if (pc->real == -1.0 && PyErr_Occurred()) { - *pobj = NULL; - return -1; - } - return 0; - } - if (PyFloat_Check(obj)) { - pc->real = PyFloat_AsDouble(obj); - return 0; - } - Py_INCREF(Py_NotImplemented); - *pobj = Py_NotImplemented; - return -1; -} - - -static PyObject * -complex_add(PyObject *v, PyObject *w) -{ - Py_complex result; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - PyFPE_START_PROTECT("complex_add", return 0) - result = c_sum(a, b); - PyFPE_END_PROTECT(result) - return PyComplex_FromCComplex(result); -} - -static PyObject * -complex_sub(PyObject *v, PyObject *w) -{ - Py_complex result; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b);; - PyFPE_START_PROTECT("complex_sub", return 0) - result = c_diff(a, b); - PyFPE_END_PROTECT(result) - return PyComplex_FromCComplex(result); -} - -static PyObject * -complex_mul(PyObject *v, PyObject *w) -{ - Py_complex result; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - PyFPE_START_PROTECT("complex_mul", return 0) - result = c_prod(a, b); - PyFPE_END_PROTECT(result) - return PyComplex_FromCComplex(result); -} - -static PyObject * -complex_div(PyObject *v, PyObject *w) -{ - Py_complex quot; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - PyFPE_START_PROTECT("complex_div", return 0) - errno = 0; - quot = c_quot(a, b); - PyFPE_END_PROTECT(quot) - if (errno == EDOM) { - PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero"); - return NULL; - } - return PyComplex_FromCComplex(quot); -} - -static PyObject * -complex_classic_div(PyObject *v, PyObject *w) -{ - Py_complex quot; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - if (Py_DivisionWarningFlag >= 2 && - PyErr_Warn(PyExc_DeprecationWarning, - "classic complex division") < 0) - return NULL; - - PyFPE_START_PROTECT("complex_classic_div", return 0) - errno = 0; - quot = c_quot(a, b); - PyFPE_END_PROTECT(quot) - if (errno == EDOM) { - PyErr_SetString(PyExc_ZeroDivisionError, "complex division by zero"); - return NULL; - } - return PyComplex_FromCComplex(quot); -} - -static PyObject * -complex_remainder(PyObject *v, PyObject *w) -{ - Py_complex div, mod; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - if (PyErr_Warn(PyExc_DeprecationWarning, - "complex divmod(), // and % are deprecated") < 0) - return NULL; - - errno = 0; - div = c_quot(a, b); /* The raw divisor value. */ - if (errno == EDOM) { - PyErr_SetString(PyExc_ZeroDivisionError, "complex remainder"); - return NULL; - } - div.real = floor(div.real); /* Use the floor of the real part. */ - div.imag = 0.0; - mod = c_diff(a, c_prod(b, div)); - - return PyComplex_FromCComplex(mod); -} - - -static PyObject * -complex_divmod(PyObject *v, PyObject *w) -{ - Py_complex div, mod; - PyObject *d, *m, *z; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - if (PyErr_Warn(PyExc_DeprecationWarning, - "complex divmod(), // and % are deprecated") < 0) - return NULL; - - errno = 0; - div = c_quot(a, b); /* The raw divisor value. */ - if (errno == EDOM) { - PyErr_SetString(PyExc_ZeroDivisionError, "complex divmod()"); - return NULL; - } - div.real = floor(div.real); /* Use the floor of the real part. */ - div.imag = 0.0; - mod = c_diff(a, c_prod(b, div)); - d = PyComplex_FromCComplex(div); - m = PyComplex_FromCComplex(mod); - z = PyTuple_Pack(2, d, m); - Py_XDECREF(d); - Py_XDECREF(m); - return z; -} - -static PyObject * -complex_pow(PyObject *v, PyObject *w, PyObject *z) -{ - Py_complex p; - Py_complex exponent; - long int_exponent; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - if (z!=Py_None) { - PyErr_SetString(PyExc_ValueError, "complex modulo"); - return NULL; - } - PyFPE_START_PROTECT("complex_pow", return 0) - errno = 0; - exponent = b; - int_exponent = (long)exponent.real; - if (exponent.imag == 0. && exponent.real == int_exponent) - p = c_powi(a,int_exponent); - else - p = c_pow(a,exponent); - - PyFPE_END_PROTECT(p) - Py_ADJUST_ERANGE2(p.real, p.imag); - if (errno == EDOM) { - PyErr_SetString(PyExc_ZeroDivisionError, - "0.0 to a negative or complex power"); - return NULL; - } - else if (errno == ERANGE) { - PyErr_SetString(PyExc_OverflowError, - "complex exponentiation"); - return NULL; - } - return PyComplex_FromCComplex(p); -} - -static PyObject * -complex_int_div(PyObject *v, PyObject *w) -{ - PyObject *t, *r; - Py_complex a, b; - TO_COMPLEX(v, a); - TO_COMPLEX(w, b); - if (PyErr_Warn(PyExc_DeprecationWarning, - "complex divmod(), // and % are deprecated") < 0) - return NULL; - - t = complex_divmod(v, w); - if (t != NULL) { - r = PyTuple_GET_ITEM(t, 0); - Py_INCREF(r); - Py_DECREF(t); - return r; - } - return NULL; -} - -static PyObject * -complex_neg(PyComplexObject *v) -{ - Py_complex neg; - neg.real = -v->cval.real; - neg.imag = -v->cval.imag; - return PyComplex_FromCComplex(neg); -} - -static PyObject * -complex_pos(PyComplexObject *v) -{ - if (PyComplex_CheckExact(v)) { - Py_INCREF(v); - return (PyObject *)v; - } - else - return PyComplex_FromCComplex(v->cval); -} - -static PyObject * -complex_abs(PyComplexObject *v) -{ - double result; - - PyFPE_START_PROTECT("complex_abs", return 0) - result = c_abs(v->cval); - PyFPE_END_PROTECT(result) - - if (errno == ERANGE) { - PyErr_SetString(PyExc_OverflowError, - "absolute value too large"); - return NULL; - } - return PyFloat_FromDouble(result); -} - -static int -complex_nonzero(PyComplexObject *v) -{ - return v->cval.real != 0.0 || v->cval.imag != 0.0; -} - -static int -complex_coerce(PyObject **pv, PyObject **pw) -{ - Py_complex cval; - cval.imag = 0.; - if (PyInt_Check(*pw)) { - cval.real = (double)PyInt_AsLong(*pw); - *pw = PyComplex_FromCComplex(cval); - Py_INCREF(*pv); - return 0; - } - else if (PyLong_Check(*pw)) { - cval.real = PyLong_AsDouble(*pw); - if (cval.real == -1.0 && PyErr_Occurred()) - return -1; - *pw = PyComplex_FromCComplex(cval); - Py_INCREF(*pv); - return 0; - } - else if (PyFloat_Check(*pw)) { - cval.real = PyFloat_AsDouble(*pw); - *pw = PyComplex_FromCComplex(cval); - Py_INCREF(*pv); - return 0; - } - else if (PyComplex_Check(*pw)) { - Py_INCREF(*pv); - Py_INCREF(*pw); - return 0; - } - return 1; /* Can't do it */ -} - -static PyObject * -complex_richcompare(PyObject *v, PyObject *w, int op) -{ - PyObject *res; - Py_complex i; - int equal; - - if (op != Py_EQ && op != Py_NE) { - /* for backwards compatibility, comparisons with non-numbers return - * NotImplemented. Only comparisons with core numeric types raise - * TypeError. - */ - if (PyInt_Check(w) || PyLong_Check(w) || - PyFloat_Check(w) || PyComplex_Check(w)) { - PyErr_SetString(PyExc_TypeError, - "no ordering relation is defined " - "for complex numbers"); - return NULL; - } - goto Unimplemented; - } - - assert(PyComplex_Check(v)); - TO_COMPLEX(v, i); - - if (PyInt_Check(w) || PyLong_Check(w)) { - /* Check for 0.0 imaginary part first to avoid the rich - * comparison when possible. - */ - if (i.imag == 0.0) { - PyObject *j, *sub_res; - j = PyFloat_FromDouble(i.real); - if (j == NULL) - return NULL; - - sub_res = PyObject_RichCompare(j, w, op); - Py_DECREF(j); - return sub_res; - } - else { - equal = 0; - } - } - else if (PyFloat_Check(w)) { - equal = (i.real == PyFloat_AsDouble(w) && i.imag == 0.0); - } - else if (PyComplex_Check(w)) { - Py_complex j; - - TO_COMPLEX(w, j); - equal = (i.real == j.real && i.imag == j.imag); - } - else { - goto Unimplemented; - } - - if (equal == (op == Py_EQ)) - res = Py_True; - else - res = Py_False; - - Py_INCREF(res); - return res; - - Unimplemented: - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static PyObject * -complex_int(PyObject *v) -{ - PyErr_SetString(PyExc_TypeError, - "can't convert complex to int"); - return NULL; -} - -static PyObject * -complex_long(PyObject *v) -{ - PyErr_SetString(PyExc_TypeError, - "can't convert complex to long"); - return NULL; -} - -static PyObject * -complex_float(PyObject *v) -{ - PyErr_SetString(PyExc_TypeError, - "can't convert complex to float"); - return NULL; -} - -static PyObject * -complex_conjugate(PyObject *self) -{ - Py_complex c; - c = ((PyComplexObject *)self)->cval; - c.imag = -c.imag; - return PyComplex_FromCComplex(c); -} - -PyDoc_STRVAR(complex_conjugate_doc, -"complex.conjugate() -> complex\n" -"\n" -"Return the complex conjugate of its argument. (3-4j).conjugate() == 3+4j."); - -static PyObject * -complex_getnewargs(PyComplexObject *v) -{ - Py_complex c = v->cval; - return Py_BuildValue("(dd)", c.real, c.imag); -} - -PyDoc_STRVAR(complex__format__doc, -"complex.__format__() -> str\n" -"\n" -"Convert to a string according to format_spec."); - -static PyObject * -complex__format__(PyObject* self, PyObject* args) -{ - PyObject *format_spec; - - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - return NULL; - if (PyBytes_Check(format_spec)) - return _PyComplex_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); - if (PyUnicode_Check(format_spec)) { - /* Convert format_spec to a str */ - PyObject *result; - PyObject *str_spec = PyObject_Str(format_spec); - - if (str_spec == NULL) - return NULL; - - result = _PyComplex_FormatAdvanced(self, - PyBytes_AS_STRING(str_spec), - PyBytes_GET_SIZE(str_spec)); - - Py_DECREF(str_spec); - return result; - } - PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); - return NULL; -} - -#if 0 -static PyObject * -complex_is_finite(PyObject *self) -{ - Py_complex c; - c = ((PyComplexObject *)self)->cval; - return PyBool_FromLong((long)(Py_IS_FINITE(c.real) && - Py_IS_FINITE(c.imag))); -} - -PyDoc_STRVAR(complex_is_finite_doc, -"complex.is_finite() -> bool\n" -"\n" -"Returns True if the real and the imaginary part is finite."); -#endif - -static PyMethodDef complex_methods[] = { - {"conjugate", (PyCFunction)complex_conjugate, METH_NOARGS, - complex_conjugate_doc}, -#if 0 - {"is_finite", (PyCFunction)complex_is_finite, METH_NOARGS, - complex_is_finite_doc}, -#endif - {"__getnewargs__", (PyCFunction)complex_getnewargs, METH_NOARGS}, - {"__format__", (PyCFunction)complex__format__, - METH_VARARGS, complex__format__doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyMemberDef complex_members[] = { - {"real", T_DOUBLE, offsetof(PyComplexObject, cval.real), READONLY, - "the real part of a complex number"}, - {"imag", T_DOUBLE, offsetof(PyComplexObject, cval.imag), READONLY, - "the imaginary part of a complex number"}, - {0}, -}; - -static PyObject * -complex_subtype_from_string(PyTypeObject *type, PyObject *v) -{ - const char *s, *start; - char *end; - double x=0.0, y=0.0, z; - int got_bracket=0; -#ifdef Py_USING_UNICODE - char *s_buffer = NULL; -#endif - Py_ssize_t len; - - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(v)) { - s_buffer = (char *)PyMem_MALLOC(PyUnicode_GET_SIZE(v)+1); - if (s_buffer == NULL) - return PyErr_NoMemory(); - if (PyUnicode_EncodeDecimal(PyUnicode_AS_UNICODE(v), - PyUnicode_GET_SIZE(v), - s_buffer, - NULL)) - goto error; - s = s_buffer; - len = strlen(s); - } -#endif - else if (PyObject_AsCharBuffer(v, &s, &len)) { - PyErr_SetString(PyExc_TypeError, - "complex() arg is not a string"); - return NULL; - } - - /* position on first nonblank */ - start = s; - while (Py_ISSPACE(*s)) - s++; - if (*s == '(') { - /* Skip over possible bracket from repr(). */ - got_bracket = 1; - s++; - while (Py_ISSPACE(*s)) - s++; - } - - /* a valid complex string usually takes one of the three forms: - - - real part only - j - imaginary part only - j - real and imaginary parts - - where represents any numeric string that's accepted by the - float constructor (including 'nan', 'inf', 'infinity', etc.), and - is any string of the form whose first - character is '+' or '-'. - - For backwards compatibility, the extra forms - - j - j - j - - are also accepted, though support for these forms may be removed from - a future version of Python. - */ - - /* first look for forms starting with */ - z = PyOS_string_to_double(s, &end, NULL); - if (z == -1.0 && PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_ValueError)) - PyErr_Clear(); - else - goto error; - } - if (end != s) { - /* all 4 forms starting with land here */ - s = end; - if (*s == '+' || *s == '-') { - /* j | j */ - x = z; - y = PyOS_string_to_double(s, &end, NULL); - if (y == -1.0 && PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_ValueError)) - PyErr_Clear(); - else - goto error; - } - if (end != s) - /* j */ - s = end; - else { - /* j */ - y = *s == '+' ? 1.0 : -1.0; - s++; - } - if (!(*s == 'j' || *s == 'J')) - goto parse_error; - s++; - } - else if (*s == 'j' || *s == 'J') { - /* j */ - s++; - y = z; - } - else - /* */ - x = z; - } - else { - /* not starting with ; must be j or j */ - if (*s == '+' || *s == '-') { - /* j */ - y = *s == '+' ? 1.0 : -1.0; - s++; - } - else - /* j */ - y = 1.0; - if (!(*s == 'j' || *s == 'J')) - goto parse_error; - s++; - } - - /* trailing whitespace and closing bracket */ - while (Py_ISSPACE(*s)) - s++; - if (got_bracket) { - /* if there was an opening parenthesis, then the corresponding - closing parenthesis should be right here */ - if (*s != ')') - goto parse_error; - s++; - while (Py_ISSPACE(*s)) - s++; - } - - /* we should now be at the end of the string */ - if (s-start != len) - goto parse_error; - - -#ifdef Py_USING_UNICODE - if (s_buffer) - PyMem_FREE(s_buffer); -#endif - return complex_subtype_from_doubles(type, x, y); - - parse_error: - PyErr_SetString(PyExc_ValueError, - "complex() arg is a malformed string"); - error: -#ifdef Py_USING_UNICODE - if (s_buffer) - PyMem_FREE(s_buffer); -#endif - return NULL; -} - -static PyObject * -complex_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *r, *i, *tmp; - PyNumberMethods *nbr, *nbi = NULL; - Py_complex cr, ci; - int own_r = 0; - int cr_is_complex = 0; - int ci_is_complex = 0; - static char *kwlist[] = {"real", "imag", 0}; - - r = Py_False; - i = NULL; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OO:complex", kwlist, - &r, &i)) - return NULL; - - /* Special-case for a single argument when type(arg) is complex. */ - if (PyComplex_CheckExact(r) && i == NULL && - type == &PyComplex_Type) { - /* Note that we can't know whether it's safe to return - a complex *subclass* instance as-is, hence the restriction - to exact complexes here. If either the input or the - output is a complex subclass, it will be handled below - as a non-orthogonal vector. */ - Py_INCREF(r); - return r; - } - if (PyString_Check(r) || PyUnicode_Check(r)) { - if (i != NULL) { - PyErr_SetString(PyExc_TypeError, - "complex() can't take second arg" - " if first is a string"); - return NULL; - } - return complex_subtype_from_string(type, r); - } - if (i != NULL && (PyString_Check(i) || PyUnicode_Check(i))) { - PyErr_SetString(PyExc_TypeError, - "complex() second arg can't be a string"); - return NULL; - } - - tmp = try_complex_special_method(r); - if (tmp) { - r = tmp; - own_r = 1; - } - else if (PyErr_Occurred()) { - return NULL; - } - - nbr = r->ob_type->tp_as_number; - if (i != NULL) - nbi = i->ob_type->tp_as_number; - if (nbr == NULL || nbr->nb_float == NULL || - ((i != NULL) && (nbi == NULL || nbi->nb_float == NULL))) { - PyErr_SetString(PyExc_TypeError, - "complex() argument must be a string or a number"); - if (own_r) { - Py_DECREF(r); - } - return NULL; - } - - /* If we get this far, then the "real" and "imag" parts should - both be treated as numbers, and the constructor should return a - complex number equal to (real + imag*1j). - - Note that we do NOT assume the input to already be in canonical - form; the "real" and "imag" parts might themselves be complex - numbers, which slightly complicates the code below. */ - if (PyComplex_Check(r)) { - /* Note that if r is of a complex subtype, we're only - retaining its real & imag parts here, and the return - value is (properly) of the builtin complex type. */ - cr = ((PyComplexObject*)r)->cval; - cr_is_complex = 1; - if (own_r) { - Py_DECREF(r); - } - } - else { - /* The "real" part really is entirely real, and contributes - nothing in the imaginary direction. - Just treat it as a double. */ - tmp = PyNumber_Float(r); - if (own_r) { - /* r was a newly created complex number, rather - than the original "real" argument. */ - Py_DECREF(r); - } - if (tmp == NULL) - return NULL; - if (!PyFloat_Check(tmp)) { - PyErr_SetString(PyExc_TypeError, - "float(r) didn't return a float"); - Py_DECREF(tmp); - return NULL; - } - cr.real = PyFloat_AsDouble(tmp); - cr.imag = 0.0; /* Shut up compiler warning */ - Py_DECREF(tmp); - } - if (i == NULL) { - ci.real = 0.0; - } - else if (PyComplex_Check(i)) { - ci = ((PyComplexObject*)i)->cval; - ci_is_complex = 1; - } else { - /* The "imag" part really is entirely imaginary, and - contributes nothing in the real direction. - Just treat it as a double. */ - tmp = (*nbi->nb_float)(i); - if (tmp == NULL) - return NULL; - ci.real = PyFloat_AsDouble(tmp); - Py_DECREF(tmp); - } - /* If the input was in canonical form, then the "real" and "imag" - parts are real numbers, so that ci.imag and cr.imag are zero. - We need this correction in case they were not real numbers. */ - - if (ci_is_complex) { - cr.real -= ci.imag; - } - if (cr_is_complex) { - ci.real += cr.imag; - } - return complex_subtype_from_doubles(type, cr.real, ci.real); -} - -PyDoc_STRVAR(complex_doc, -"complex(real[, imag]) -> complex number\n" -"\n" -"Create a complex number from a real part and an optional imaginary part.\n" -"This is equivalent to (real + imag*1j) where imag defaults to 0."); - -static PyNumberMethods complex_as_number = { - (binaryfunc)complex_add, /* nb_add */ - (binaryfunc)complex_sub, /* nb_subtract */ - (binaryfunc)complex_mul, /* nb_multiply */ - (binaryfunc)complex_classic_div, /* nb_divide */ - (binaryfunc)complex_remainder, /* nb_remainder */ - (binaryfunc)complex_divmod, /* nb_divmod */ - (ternaryfunc)complex_pow, /* nb_power */ - (unaryfunc)complex_neg, /* nb_negative */ - (unaryfunc)complex_pos, /* nb_positive */ - (unaryfunc)complex_abs, /* nb_absolute */ - (inquiry)complex_nonzero, /* nb_nonzero */ - 0, /* nb_invert */ - 0, /* nb_lshift */ - 0, /* nb_rshift */ - 0, /* nb_and */ - 0, /* nb_xor */ - 0, /* nb_or */ - complex_coerce, /* nb_coerce */ - complex_int, /* nb_int */ - complex_long, /* nb_long */ - complex_float, /* nb_float */ - 0, /* nb_oct */ - 0, /* nb_hex */ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply*/ - 0, /* nb_inplace_divide */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - (binaryfunc)complex_int_div, /* nb_floor_divide */ - (binaryfunc)complex_div, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ -}; - -PyTypeObject PyComplex_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "complex", - sizeof(PyComplexObject), - 0, - complex_dealloc, /* tp_dealloc */ - (printfunc)complex_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)complex_repr, /* tp_repr */ - &complex_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)complex_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)complex_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - complex_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - complex_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - complex_methods, /* tp_methods */ - complex_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - complex_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/descrobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/descrobject.c deleted file mode 100644 index 62daf49..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/descrobject.c +++ /dev/null @@ -1,1440 +0,0 @@ -/* Descriptors -- a new, flexible way to describe attributes */ - -#include "Python.h" -#include "structmember.h" /* Why is this not included in Python.h? */ - -static void -descr_dealloc(PyDescrObject *descr) -{ - _PyObject_GC_UNTRACK(descr); - Py_XDECREF(descr->d_type); - Py_XDECREF(descr->d_name); - PyObject_GC_Del(descr); -} - -static char * -descr_name(PyDescrObject *descr) -{ - if (descr->d_name != NULL && PyString_Check(descr->d_name)) - return PyString_AS_STRING(descr->d_name); - else - return "?"; -} - -static PyObject * -descr_repr(PyDescrObject *descr, char *format) -{ - return PyString_FromFormat(format, descr_name(descr), - descr->d_type->tp_name); -} - -static PyObject * -method_repr(PyMethodDescrObject *descr) -{ - return descr_repr((PyDescrObject *)descr, - ""); -} - -static PyObject * -member_repr(PyMemberDescrObject *descr) -{ - return descr_repr((PyDescrObject *)descr, - ""); -} - -static PyObject * -getset_repr(PyGetSetDescrObject *descr) -{ - return descr_repr((PyDescrObject *)descr, - ""); -} - -static PyObject * -wrapperdescr_repr(PyWrapperDescrObject *descr) -{ - return descr_repr((PyDescrObject *)descr, - ""); -} - -static int -descr_check(PyDescrObject *descr, PyObject *obj, PyObject **pres) -{ - if (obj == NULL) { - Py_INCREF(descr); - *pres = (PyObject *)descr; - return 1; - } - if (!PyObject_TypeCheck(obj, descr->d_type)) { - PyErr_Format(PyExc_TypeError, - "descriptor '%s' for '%s' objects " - "doesn't apply to '%s' object", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name, - obj->ob_type->tp_name); - *pres = NULL; - return 1; - } - return 0; -} - -static PyObject * -classmethod_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type) -{ - /* Ensure a valid type. Class methods ignore obj. */ - if (type == NULL) { - if (obj != NULL) - type = (PyObject *)obj->ob_type; - else { - /* Wot - no type?! */ - PyErr_Format(PyExc_TypeError, - "descriptor '%s' for type '%s' " - "needs either an object or a type", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name); - return NULL; - } - } - if (!PyType_Check(type)) { - PyErr_Format(PyExc_TypeError, - "descriptor '%s' for type '%s' " - "needs a type, not a '%s' as arg 2", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name, - type->ob_type->tp_name); - return NULL; - } - if (!PyType_IsSubtype((PyTypeObject *)type, descr->d_type)) { - PyErr_Format(PyExc_TypeError, - "descriptor '%s' for type '%s' " - "doesn't apply to type '%s'", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name, - ((PyTypeObject *)type)->tp_name); - return NULL; - } - return PyCFunction_New(descr->d_method, type); -} - -static PyObject * -method_get(PyMethodDescrObject *descr, PyObject *obj, PyObject *type) -{ - PyObject *res; - - if (descr_check((PyDescrObject *)descr, obj, &res)) - return res; - return PyCFunction_New(descr->d_method, obj); -} - -static PyObject * -member_get(PyMemberDescrObject *descr, PyObject *obj, PyObject *type) -{ - PyObject *res; - - if (descr_check((PyDescrObject *)descr, obj, &res)) - return res; - return PyMember_GetOne((char *)obj, descr->d_member); -} - -static PyObject * -getset_get(PyGetSetDescrObject *descr, PyObject *obj, PyObject *type) -{ - PyObject *res; - - if (descr_check((PyDescrObject *)descr, obj, &res)) - return res; - if (descr->d_getset->get != NULL) - return descr->d_getset->get(obj, descr->d_getset->closure); - PyErr_Format(PyExc_AttributeError, - "attribute '%.300s' of '%.100s' objects is not readable", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name); - return NULL; -} - -static PyObject * -wrapperdescr_get(PyWrapperDescrObject *descr, PyObject *obj, PyObject *type) -{ - PyObject *res; - - if (descr_check((PyDescrObject *)descr, obj, &res)) - return res; - return PyWrapper_New((PyObject *)descr, obj); -} - -static int -descr_setcheck(PyDescrObject *descr, PyObject *obj, PyObject *value, - int *pres) -{ - assert(obj != NULL); - if (!PyObject_TypeCheck(obj, descr->d_type)) { - PyErr_Format(PyExc_TypeError, - "descriptor '%.200s' for '%.100s' objects " - "doesn't apply to '%.100s' object", - descr_name(descr), - descr->d_type->tp_name, - obj->ob_type->tp_name); - *pres = -1; - return 1; - } - return 0; -} - -static int -member_set(PyMemberDescrObject *descr, PyObject *obj, PyObject *value) -{ - int res; - - if (descr_setcheck((PyDescrObject *)descr, obj, value, &res)) - return res; - return PyMember_SetOne((char *)obj, descr->d_member, value); -} - -static int -getset_set(PyGetSetDescrObject *descr, PyObject *obj, PyObject *value) -{ - int res; - - if (descr_setcheck((PyDescrObject *)descr, obj, value, &res)) - return res; - if (descr->d_getset->set != NULL) - return descr->d_getset->set(obj, value, - descr->d_getset->closure); - PyErr_Format(PyExc_AttributeError, - "attribute '%.300s' of '%.100s' objects is not writable", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name); - return -1; -} - -static PyObject * -methoddescr_call(PyMethodDescrObject *descr, PyObject *args, PyObject *kwds) -{ - Py_ssize_t argc; - PyObject *self, *func, *result; - - /* Make sure that the first argument is acceptable as 'self' */ - assert(PyTuple_Check(args)); - argc = PyTuple_GET_SIZE(args); - if (argc < 1) { - PyErr_Format(PyExc_TypeError, - "descriptor '%.300s' of '%.100s' " - "object needs an argument", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name); - return NULL; - } - self = PyTuple_GET_ITEM(args, 0); - if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), - (PyObject *)(descr->d_type))) { - PyErr_Format(PyExc_TypeError, - "descriptor '%.200s' " - "requires a '%.100s' object " - "but received a '%.100s'", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name, - self->ob_type->tp_name); - return NULL; - } - - func = PyCFunction_New(descr->d_method, self); - if (func == NULL) - return NULL; - args = PyTuple_GetSlice(args, 1, argc); - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - result = PyEval_CallObjectWithKeywords(func, args, kwds); - Py_DECREF(args); - Py_DECREF(func); - return result; -} - -static PyObject * -classmethoddescr_call(PyMethodDescrObject *descr, PyObject *args, - PyObject *kwds) -{ - Py_ssize_t argc; - PyObject *self, *func, *result; - - /* Make sure that the first argument is acceptable as 'self' */ - assert(PyTuple_Check(args)); - argc = PyTuple_GET_SIZE(args); - if (argc < 1) { - PyErr_Format(PyExc_TypeError, - "descriptor '%s' of '%.100s' " - "object needs an argument", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name); - return NULL; - } - self = PyTuple_GET_ITEM(args, 0); - if (!PyType_Check(self)) { - PyErr_Format(PyExc_TypeError, - "descriptor '%s' requires a type " - "but received a '%.100s'", - descr_name((PyDescrObject *)descr), - self->ob_type->tp_name); - return NULL; - } - if (!PyType_IsSubtype((PyTypeObject *)self, descr->d_type)) { - PyErr_Format(PyExc_TypeError, - "descriptor '%s' " - "requires a subtype of '%.100s' " - "but received '%.100s", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name, - self->ob_type->tp_name); - return NULL; - } - - func = PyCFunction_New(descr->d_method, self); - if (func == NULL) - return NULL; - args = PyTuple_GetSlice(args, 1, argc); - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - result = PyEval_CallObjectWithKeywords(func, args, kwds); - Py_DECREF(func); - Py_DECREF(args); - return result; -} - -static PyObject * -wrapperdescr_call(PyWrapperDescrObject *descr, PyObject *args, PyObject *kwds) -{ - Py_ssize_t argc; - PyObject *self, *func, *result; - - /* Make sure that the first argument is acceptable as 'self' */ - assert(PyTuple_Check(args)); - argc = PyTuple_GET_SIZE(args); - if (argc < 1) { - PyErr_Format(PyExc_TypeError, - "descriptor '%.300s' of '%.100s' " - "object needs an argument", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name); - return NULL; - } - self = PyTuple_GET_ITEM(args, 0); - if (!_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), - (PyObject *)(descr->d_type))) { - PyErr_Format(PyExc_TypeError, - "descriptor '%.200s' " - "requires a '%.100s' object " - "but received a '%.100s'", - descr_name((PyDescrObject *)descr), - descr->d_type->tp_name, - self->ob_type->tp_name); - return NULL; - } - - func = PyWrapper_New((PyObject *)descr, self); - if (func == NULL) - return NULL; - args = PyTuple_GetSlice(args, 1, argc); - if (args == NULL) { - Py_DECREF(func); - return NULL; - } - result = PyEval_CallObjectWithKeywords(func, args, kwds); - Py_DECREF(args); - Py_DECREF(func); - return result; -} - -static PyObject * -method_get_doc(PyMethodDescrObject *descr, void *closure) -{ - if (descr->d_method->ml_doc == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(descr->d_method->ml_doc); -} - -static PyMemberDef descr_members[] = { - {"__objclass__", T_OBJECT, offsetof(PyDescrObject, d_type), READONLY}, - {"__name__", T_OBJECT, offsetof(PyDescrObject, d_name), READONLY}, - {0} -}; - -static PyGetSetDef method_getset[] = { - {"__doc__", (getter)method_get_doc}, - {0} -}; - -static PyObject * -member_get_doc(PyMemberDescrObject *descr, void *closure) -{ - if (descr->d_member->doc == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(descr->d_member->doc); -} - -static PyGetSetDef member_getset[] = { - {"__doc__", (getter)member_get_doc}, - {0} -}; - -static PyObject * -getset_get_doc(PyGetSetDescrObject *descr, void *closure) -{ - if (descr->d_getset->doc == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(descr->d_getset->doc); -} - -static PyGetSetDef getset_getset[] = { - {"__doc__", (getter)getset_get_doc}, - {0} -}; - -static PyObject * -wrapperdescr_get_doc(PyWrapperDescrObject *descr, void *closure) -{ - if (descr->d_base->doc == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyString_FromString(descr->d_base->doc); -} - -static PyGetSetDef wrapperdescr_getset[] = { - {"__doc__", (getter)wrapperdescr_get_doc}, - {0} -}; - -static int -descr_traverse(PyObject *self, visitproc visit, void *arg) -{ - PyDescrObject *descr = (PyDescrObject *)self; - Py_VISIT(descr->d_type); - return 0; -} - -static PyTypeObject PyMethodDescr_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "method_descriptor", - sizeof(PyMethodDescrObject), - 0, - (destructor)descr_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)method_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)methoddescr_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - descr_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - descr_members, /* tp_members */ - method_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - (descrgetfunc)method_get, /* tp_descr_get */ - 0, /* tp_descr_set */ -}; - -/* This is for METH_CLASS in C, not for "f = classmethod(f)" in Python! */ -static PyTypeObject PyClassMethodDescr_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "classmethod_descriptor", - sizeof(PyMethodDescrObject), - 0, - (destructor)descr_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)method_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)classmethoddescr_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - descr_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - descr_members, /* tp_members */ - method_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - (descrgetfunc)classmethod_get, /* tp_descr_get */ - 0, /* tp_descr_set */ -}; - -PyTypeObject PyMemberDescr_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "member_descriptor", - sizeof(PyMemberDescrObject), - 0, - (destructor)descr_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)member_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - descr_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - descr_members, /* tp_members */ - member_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - (descrgetfunc)member_get, /* tp_descr_get */ - (descrsetfunc)member_set, /* tp_descr_set */ -}; - -PyTypeObject PyGetSetDescr_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "getset_descriptor", - sizeof(PyGetSetDescrObject), - 0, - (destructor)descr_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)getset_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - descr_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - descr_members, /* tp_members */ - getset_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - (descrgetfunc)getset_get, /* tp_descr_get */ - (descrsetfunc)getset_set, /* tp_descr_set */ -}; - -PyTypeObject PyWrapperDescr_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "wrapper_descriptor", - sizeof(PyWrapperDescrObject), - 0, - (destructor)descr_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)wrapperdescr_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)wrapperdescr_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - descr_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - descr_members, /* tp_members */ - wrapperdescr_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - (descrgetfunc)wrapperdescr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ -}; - -static PyDescrObject * -descr_new(PyTypeObject *descrtype, PyTypeObject *type, const char *name) -{ - PyDescrObject *descr; - - descr = (PyDescrObject *)PyType_GenericAlloc(descrtype, 0); - if (descr != NULL) { - Py_XINCREF(type); - descr->d_type = type; - descr->d_name = PyString_InternFromString(name); - if (descr->d_name == NULL) { - Py_DECREF(descr); - descr = NULL; - } - } - return descr; -} - -PyObject * -PyDescr_NewMethod(PyTypeObject *type, PyMethodDef *method) -{ - PyMethodDescrObject *descr; - - descr = (PyMethodDescrObject *)descr_new(&PyMethodDescr_Type, - type, method->ml_name); - if (descr != NULL) - descr->d_method = method; - return (PyObject *)descr; -} - -PyObject * -PyDescr_NewClassMethod(PyTypeObject *type, PyMethodDef *method) -{ - PyMethodDescrObject *descr; - - descr = (PyMethodDescrObject *)descr_new(&PyClassMethodDescr_Type, - type, method->ml_name); - if (descr != NULL) - descr->d_method = method; - return (PyObject *)descr; -} - -PyObject * -PyDescr_NewMember(PyTypeObject *type, PyMemberDef *member) -{ - PyMemberDescrObject *descr; - - descr = (PyMemberDescrObject *)descr_new(&PyMemberDescr_Type, - type, member->name); - if (descr != NULL) - descr->d_member = member; - return (PyObject *)descr; -} - -PyObject * -PyDescr_NewGetSet(PyTypeObject *type, PyGetSetDef *getset) -{ - PyGetSetDescrObject *descr; - - descr = (PyGetSetDescrObject *)descr_new(&PyGetSetDescr_Type, - type, getset->name); - if (descr != NULL) - descr->d_getset = getset; - return (PyObject *)descr; -} - -PyObject * -PyDescr_NewWrapper(PyTypeObject *type, struct wrapperbase *base, void *wrapped) -{ - PyWrapperDescrObject *descr; - - descr = (PyWrapperDescrObject *)descr_new(&PyWrapperDescr_Type, - type, base->name); - if (descr != NULL) { - descr->d_base = base; - descr->d_wrapped = wrapped; - } - return (PyObject *)descr; -} - - -/* --- Readonly proxy for dictionaries (actually any mapping) --- */ - -/* This has no reason to be in this file except that adding new files is a - bit of a pain */ - -typedef struct { - PyObject_HEAD - PyObject *dict; -} proxyobject; - -static Py_ssize_t -proxy_len(proxyobject *pp) -{ - return PyObject_Size(pp->dict); -} - -static PyObject * -proxy_getitem(proxyobject *pp, PyObject *key) -{ - return PyObject_GetItem(pp->dict, key); -} - -static PyMappingMethods proxy_as_mapping = { - (lenfunc)proxy_len, /* mp_length */ - (binaryfunc)proxy_getitem, /* mp_subscript */ - 0, /* mp_ass_subscript */ -}; - -static int -proxy_contains(proxyobject *pp, PyObject *key) -{ - return PyDict_Contains(pp->dict, key); -} - -static PySequenceMethods proxy_as_sequence = { - 0, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)proxy_contains, /* sq_contains */ - 0, /* sq_inplace_concat */ - 0, /* sq_inplace_repeat */ -}; - -static PyObject * -proxy_has_key(proxyobject *pp, PyObject *key) -{ - int res = PyDict_Contains(pp->dict, key); - if (res < 0) - return NULL; - return PyBool_FromLong(res); -} - -static PyObject * -proxy_get(proxyobject *pp, PyObject *args) -{ - PyObject *key, *def = Py_None; - - if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &def)) - return NULL; - return PyObject_CallMethod(pp->dict, "get", "(OO)", key, def); -} - -static PyObject * -proxy_keys(proxyobject *pp) -{ - return PyMapping_Keys(pp->dict); -} - -static PyObject * -proxy_values(proxyobject *pp) -{ - return PyMapping_Values(pp->dict); -} - -static PyObject * -proxy_items(proxyobject *pp) -{ - return PyMapping_Items(pp->dict); -} - -static PyObject * -proxy_iterkeys(proxyobject *pp) -{ - return PyObject_CallMethod(pp->dict, "iterkeys", NULL); -} - -static PyObject * -proxy_itervalues(proxyobject *pp) -{ - return PyObject_CallMethod(pp->dict, "itervalues", NULL); -} - -static PyObject * -proxy_iteritems(proxyobject *pp) -{ - return PyObject_CallMethod(pp->dict, "iteritems", NULL); -} -static PyObject * -proxy_copy(proxyobject *pp) -{ - return PyObject_CallMethod(pp->dict, "copy", NULL); -} - -static PyMethodDef proxy_methods[] = { - {"has_key", (PyCFunction)proxy_has_key, METH_O, - PyDoc_STR("D.has_key(k) -> True if D has a key k, else False")}, - {"get", (PyCFunction)proxy_get, METH_VARARGS, - PyDoc_STR("D.get(k[,d]) -> D[k] if D.has_key(k), else d." - " d defaults to None.")}, - {"keys", (PyCFunction)proxy_keys, METH_NOARGS, - PyDoc_STR("D.keys() -> list of D's keys")}, - {"values", (PyCFunction)proxy_values, METH_NOARGS, - PyDoc_STR("D.values() -> list of D's values")}, - {"items", (PyCFunction)proxy_items, METH_NOARGS, - PyDoc_STR("D.items() -> list of D's (key, value) pairs, as 2-tuples")}, - {"iterkeys", (PyCFunction)proxy_iterkeys, METH_NOARGS, - PyDoc_STR("D.iterkeys() -> an iterator over the keys of D")}, - {"itervalues",(PyCFunction)proxy_itervalues, METH_NOARGS, - PyDoc_STR("D.itervalues() -> an iterator over the values of D")}, - {"iteritems", (PyCFunction)proxy_iteritems, METH_NOARGS, - PyDoc_STR("D.iteritems() ->" - " an iterator over the (key, value) items of D")}, - {"copy", (PyCFunction)proxy_copy, METH_NOARGS, - PyDoc_STR("D.copy() -> a shallow copy of D")}, - {0} -}; - -static void -proxy_dealloc(proxyobject *pp) -{ - _PyObject_GC_UNTRACK(pp); - Py_DECREF(pp->dict); - PyObject_GC_Del(pp); -} - -static PyObject * -proxy_getiter(proxyobject *pp) -{ - return PyObject_GetIter(pp->dict); -} - -static PyObject * -proxy_str(proxyobject *pp) -{ - return PyObject_Str(pp->dict); -} - -static PyObject * -proxy_repr(proxyobject *pp) -{ - PyObject *dictrepr; - PyObject *result; - - dictrepr = PyObject_Repr(pp->dict); - if (dictrepr == NULL) - return NULL; - result = PyString_FromFormat("dict_proxy(%s)", PyString_AS_STRING(dictrepr)); - Py_DECREF(dictrepr); - return result; -} - -static int -proxy_traverse(PyObject *self, visitproc visit, void *arg) -{ - proxyobject *pp = (proxyobject *)self; - Py_VISIT(pp->dict); - return 0; -} - -static int -proxy_compare(proxyobject *v, PyObject *w) -{ - return PyObject_Compare(v->dict, w); -} - -static PyObject * -proxy_richcompare(proxyobject *v, PyObject *w, int op) -{ - return PyObject_RichCompare(v->dict, w, op); -} - -PyTypeObject PyDictProxy_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dictproxy", /* tp_name */ - sizeof(proxyobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)proxy_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)proxy_compare, /* tp_compare */ - (reprfunc)proxy_repr, /* tp_repr */ - 0, /* tp_as_number */ - &proxy_as_sequence, /* tp_as_sequence */ - &proxy_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)proxy_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - proxy_traverse, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)proxy_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)proxy_getiter, /* tp_iter */ - 0, /* tp_iternext */ - proxy_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ -}; - -PyObject * -PyDictProxy_New(PyObject *dict) -{ - proxyobject *pp; - - pp = PyObject_GC_New(proxyobject, &PyDictProxy_Type); - if (pp != NULL) { - Py_INCREF(dict); - pp->dict = dict; - _PyObject_GC_TRACK(pp); - } - return (PyObject *)pp; -} - - -/* --- Wrapper object for "slot" methods --- */ - -/* This has no reason to be in this file except that adding new files is a - bit of a pain */ - -typedef struct { - PyObject_HEAD - PyWrapperDescrObject *descr; - PyObject *self; -} wrapperobject; - -static void -wrapper_dealloc(wrapperobject *wp) -{ - PyObject_GC_UnTrack(wp); - Py_TRASHCAN_SAFE_BEGIN(wp) - Py_XDECREF(wp->descr); - Py_XDECREF(wp->self); - PyObject_GC_Del(wp); - Py_TRASHCAN_SAFE_END(wp) -} - -static int -wrapper_compare(wrapperobject *a, wrapperobject *b) -{ - if (a->descr == b->descr) - return PyObject_Compare(a->self, b->self); - else - return (a->descr < b->descr) ? -1 : 1; -} - -static long -wrapper_hash(wrapperobject *wp) -{ - int x, y; - x = _Py_HashPointer(wp->descr); - if (x == -1) - return -1; - y = PyObject_Hash(wp->self); - if (y == -1) - return -1; - x = x ^ y; - if (x == -1) - x = -2; - return x; -} - -static PyObject * -wrapper_repr(wrapperobject *wp) -{ - return PyString_FromFormat("", - wp->descr->d_base->name, - wp->self->ob_type->tp_name, - wp->self); -} - -static PyMemberDef wrapper_members[] = { - {"__self__", T_OBJECT, offsetof(wrapperobject, self), READONLY}, - {0} -}; - -static PyObject * -wrapper_objclass(wrapperobject *wp) -{ - PyObject *c = (PyObject *)wp->descr->d_type; - - Py_INCREF(c); - return c; -} - -static PyObject * -wrapper_name(wrapperobject *wp) -{ - char *s = wp->descr->d_base->name; - - return PyString_FromString(s); -} - -static PyObject * -wrapper_doc(wrapperobject *wp) -{ - char *s = wp->descr->d_base->doc; - - if (s == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - else { - return PyString_FromString(s); - } -} - -static PyGetSetDef wrapper_getsets[] = { - {"__objclass__", (getter)wrapper_objclass}, - {"__name__", (getter)wrapper_name}, - {"__doc__", (getter)wrapper_doc}, - {0} -}; - -static PyObject * -wrapper_call(wrapperobject *wp, PyObject *args, PyObject *kwds) -{ - wrapperfunc wrapper = wp->descr->d_base->wrapper; - PyObject *self = wp->self; - - if (wp->descr->d_base->flags & PyWrapperFlag_KEYWORDS) { - wrapperfunc_kwds wk = (wrapperfunc_kwds)wrapper; - return (*wk)(self, args, wp->descr->d_wrapped, kwds); - } - - if (kwds != NULL && (!PyDict_Check(kwds) || PyDict_Size(kwds) != 0)) { - PyErr_Format(PyExc_TypeError, - "wrapper %s doesn't take keyword arguments", - wp->descr->d_base->name); - return NULL; - } - return (*wrapper)(self, args, wp->descr->d_wrapped); -} - -static int -wrapper_traverse(PyObject *self, visitproc visit, void *arg) -{ - wrapperobject *wp = (wrapperobject *)self; - Py_VISIT(wp->descr); - Py_VISIT(wp->self); - return 0; -} - -static PyTypeObject wrappertype = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "method-wrapper", /* tp_name */ - sizeof(wrapperobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)wrapper_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)wrapper_compare, /* tp_compare */ - (reprfunc)wrapper_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)wrapper_hash, /* tp_hash */ - (ternaryfunc)wrapper_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags */ - 0, /* tp_doc */ - wrapper_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - wrapper_members, /* tp_members */ - wrapper_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ -}; - -PyObject * -PyWrapper_New(PyObject *d, PyObject *self) -{ - wrapperobject *wp; - PyWrapperDescrObject *descr; - - assert(PyObject_TypeCheck(d, &PyWrapperDescr_Type)); - descr = (PyWrapperDescrObject *)d; - assert(_PyObject_RealIsSubclass((PyObject *)Py_TYPE(self), - (PyObject *)(descr->d_type))); - - wp = PyObject_GC_New(wrapperobject, &wrappertype); - if (wp != NULL) { - Py_INCREF(descr); - wp->descr = descr; - Py_INCREF(self); - wp->self = self; - _PyObject_GC_TRACK(wp); - } - return (PyObject *)wp; -} - - -/* A built-in 'property' type */ - -/* - class property(object): - - def __init__(self, fget=None, fset=None, fdel=None, doc=None): - if doc is None and fget is not None and hasattr(fget, "__doc__"): - doc = fget.__doc__ - self.__get = fget - self.__set = fset - self.__del = fdel - self.__doc__ = doc - - def __get__(self, inst, type=None): - if inst is None: - return self - if self.__get is None: - raise AttributeError, "unreadable attribute" - return self.__get(inst) - - def __set__(self, inst, value): - if self.__set is None: - raise AttributeError, "can't set attribute" - return self.__set(inst, value) - - def __delete__(self, inst): - if self.__del is None: - raise AttributeError, "can't delete attribute" - return self.__del(inst) - -*/ - -typedef struct { - PyObject_HEAD - PyObject *prop_get; - PyObject *prop_set; - PyObject *prop_del; - PyObject *prop_doc; - int getter_doc; -} propertyobject; - -static PyObject * property_copy(PyObject *, PyObject *, PyObject *, - PyObject *); - -static PyMemberDef property_members[] = { - {"fget", T_OBJECT, offsetof(propertyobject, prop_get), READONLY}, - {"fset", T_OBJECT, offsetof(propertyobject, prop_set), READONLY}, - {"fdel", T_OBJECT, offsetof(propertyobject, prop_del), READONLY}, - {"__doc__", T_OBJECT, offsetof(propertyobject, prop_doc), READONLY}, - {0} -}; - - -PyDoc_STRVAR(getter_doc, - "Descriptor to change the getter on a property."); - -static PyObject * -property_getter(PyObject *self, PyObject *getter) -{ - return property_copy(self, getter, NULL, NULL); -} - - -PyDoc_STRVAR(setter_doc, - "Descriptor to change the setter on a property."); - -static PyObject * -property_setter(PyObject *self, PyObject *setter) -{ - return property_copy(self, NULL, setter, NULL); -} - - -PyDoc_STRVAR(deleter_doc, - "Descriptor to change the deleter on a property."); - -static PyObject * -property_deleter(PyObject *self, PyObject *deleter) -{ - return property_copy(self, NULL, NULL, deleter); -} - - -static PyMethodDef property_methods[] = { - {"getter", property_getter, METH_O, getter_doc}, - {"setter", property_setter, METH_O, setter_doc}, - {"deleter", property_deleter, METH_O, deleter_doc}, - {0} -}; - - -static void -property_dealloc(PyObject *self) -{ - propertyobject *gs = (propertyobject *)self; - - _PyObject_GC_UNTRACK(self); - Py_XDECREF(gs->prop_get); - Py_XDECREF(gs->prop_set); - Py_XDECREF(gs->prop_del); - Py_XDECREF(gs->prop_doc); - self->ob_type->tp_free(self); -} - -static PyObject * -property_descr_get(PyObject *self, PyObject *obj, PyObject *type) -{ - propertyobject *gs = (propertyobject *)self; - - if (obj == NULL || obj == Py_None) { - Py_INCREF(self); - return self; - } - if (gs->prop_get == NULL) { - PyErr_SetString(PyExc_AttributeError, "unreadable attribute"); - return NULL; - } - return PyObject_CallFunction(gs->prop_get, "(O)", obj); -} - -static int -property_descr_set(PyObject *self, PyObject *obj, PyObject *value) -{ - propertyobject *gs = (propertyobject *)self; - PyObject *func, *res; - - if (value == NULL) - func = gs->prop_del; - else - func = gs->prop_set; - if (func == NULL) { - PyErr_SetString(PyExc_AttributeError, - value == NULL ? - "can't delete attribute" : - "can't set attribute"); - return -1; - } - if (value == NULL) - res = PyObject_CallFunction(func, "(O)", obj); - else - res = PyObject_CallFunction(func, "(OO)", obj, value); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static PyObject * -property_copy(PyObject *old, PyObject *get, PyObject *set, PyObject *del) -{ - propertyobject *pold = (propertyobject *)old; - PyObject *new, *type, *doc; - - type = PyObject_Type(old); - if (type == NULL) - return NULL; - - if (get == NULL || get == Py_None) { - Py_XDECREF(get); - get = pold->prop_get ? pold->prop_get : Py_None; - } - if (set == NULL || set == Py_None) { - Py_XDECREF(set); - set = pold->prop_set ? pold->prop_set : Py_None; - } - if (del == NULL || del == Py_None) { - Py_XDECREF(del); - del = pold->prop_del ? pold->prop_del : Py_None; - } - if (pold->getter_doc && get != Py_None) { - /* make _init use __doc__ from getter */ - doc = Py_None; - } - else { - doc = pold->prop_doc ? pold->prop_doc : Py_None; - } - - new = PyObject_CallFunction(type, "OOOO", get, set, del, doc); - Py_DECREF(type); - if (new == NULL) - return NULL; - return new; -} - -static int -property_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *get = NULL, *set = NULL, *del = NULL, *doc = NULL; - static char *kwlist[] = {"fget", "fset", "fdel", "doc", 0}; - propertyobject *prop = (propertyobject *)self; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOOO:property", - kwlist, &get, &set, &del, &doc)) - return -1; - - if (get == Py_None) - get = NULL; - if (set == Py_None) - set = NULL; - if (del == Py_None) - del = NULL; - - Py_XINCREF(get); - Py_XINCREF(set); - Py_XINCREF(del); - Py_XINCREF(doc); - - prop->prop_get = get; - prop->prop_set = set; - prop->prop_del = del; - prop->prop_doc = doc; - prop->getter_doc = 0; - - /* if no docstring given and the getter has one, use that one */ - if ((doc == NULL || doc == Py_None) && get != NULL) { - PyObject *get_doc = PyObject_GetAttrString(get, "__doc__"); - if (get_doc) { - if (Py_TYPE(self) == &PyProperty_Type) { - Py_XDECREF(prop->prop_doc); - prop->prop_doc = get_doc; - } - else { - /* If this is a property subclass, put __doc__ - in dict of the subclass instance instead, - otherwise it gets shadowed by __doc__ in the - class's dict. */ - int err = PyObject_SetAttrString(self, "__doc__", get_doc); - Py_DECREF(get_doc); - if (err < 0) - return -1; - } - prop->getter_doc = 1; - } - else if (PyErr_ExceptionMatches(PyExc_Exception)) { - PyErr_Clear(); - } - else { - return -1; - } - } - - return 0; -} - -PyDoc_STRVAR(property_doc, -"property(fget=None, fset=None, fdel=None, doc=None) -> property attribute\n" -"\n" -"fget is a function to be used for getting an attribute value, and likewise\n" -"fset is a function for setting, and fdel a function for del'ing, an\n" -"attribute. Typical use is to define a managed attribute x:\n\n" -"class C(object):\n" -" def getx(self): return self._x\n" -" def setx(self, value): self._x = value\n" -" def delx(self): del self._x\n" -" x = property(getx, setx, delx, \"I'm the 'x' property.\")\n" -"\n" -"Decorators make defining new properties or modifying existing ones easy:\n\n" -"class C(object):\n" -" @property\n" -" def x(self):\n" -" \"I am the 'x' property.\"\n" -" return self._x\n" -" @x.setter\n" -" def x(self, value):\n" -" self._x = value\n" -" @x.deleter\n" -" def x(self):\n" -" del self._x\n" -); - -static int -property_traverse(PyObject *self, visitproc visit, void *arg) -{ - propertyobject *pp = (propertyobject *)self; - Py_VISIT(pp->prop_get); - Py_VISIT(pp->prop_set); - Py_VISIT(pp->prop_del); - Py_VISIT(pp->prop_doc); - return 0; -} - -PyTypeObject PyProperty_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "property", /* tp_name */ - sizeof(propertyobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - property_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - property_doc, /* tp_doc */ - property_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - property_methods, /* tp_methods */ - property_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - property_descr_get, /* tp_descr_get */ - property_descr_set, /* tp_descr_set */ - 0, /* tp_dictoffset */ - property_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/dictnotes.txt b/AppPkg/Applications/Python/Python-2.7.10/Objects/dictnotes.txt deleted file mode 100644 index 60a04c8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/dictnotes.txt +++ /dev/null @@ -1,270 +0,0 @@ -NOTES ON OPTIMIZING DICTIONARIES -================================ - - -Principal Use Cases for Dictionaries ------------------------------------- - -Passing keyword arguments - Typically, one read and one write for 1 to 3 elements. - Occurs frequently in normal python code. - -Class method lookup - Dictionaries vary in size with 8 to 16 elements being common. - Usually written once with many lookups. - When base classes are used, there are many failed lookups - followed by a lookup in a base class. - -Instance attribute lookup and Global variables - Dictionaries vary in size. 4 to 10 elements are common. - Both reads and writes are common. - -Builtins - Frequent reads. Almost never written. - Size 126 interned strings (as of Py2.3b1). - A few keys are accessed much more frequently than others. - -Uniquification - Dictionaries of any size. Bulk of work is in creation. - Repeated writes to a smaller set of keys. - Single read of each key. - Some use cases have two consecutive accesses to the same key. - - * Removing duplicates from a sequence. - dict.fromkeys(seqn).keys() - - * Counting elements in a sequence. - for e in seqn: - d[e] = d.get(e,0) + 1 - - * Accumulating references in a dictionary of lists: - - for pagenumber, page in enumerate(pages): - for word in page: - d.setdefault(word, []).append(pagenumber) - - Note, the second example is a use case characterized by a get and set - to the same key. There are similar use cases with a __contains__ - followed by a get, set, or del to the same key. Part of the - justification for d.setdefault is combining the two lookups into one. - -Membership Testing - Dictionaries of any size. Created once and then rarely changes. - Single write to each key. - Many calls to __contains__() or has_key(). - Similar access patterns occur with replacement dictionaries - such as with the % formatting operator. - -Dynamic Mappings - Characterized by deletions interspersed with adds and replacements. - Performance benefits greatly from the re-use of dummy entries. - - -Data Layout (assuming a 32-bit box with 64 bytes per cache line) ----------------------------------------------------------------- - -Smalldicts (8 entries) are attached to the dictobject structure -and the whole group nearly fills two consecutive cache lines. - -Larger dicts use the first half of the dictobject structure (one cache -line) and a separate, continuous block of entries (at 12 bytes each -for a total of 5.333 entries per cache line). - - -Tunable Dictionary Parameters ------------------------------ - -* PyDict_MINSIZE. Currently set to 8. - Must be a power of two. New dicts have to zero-out every cell. - Each additional 8 consumes 1.5 cache lines. Increasing improves - the sparseness of small dictionaries but costs time to read in - the additional cache lines if they are not already in cache. - That case is common when keyword arguments are passed. - -* Maximum dictionary load in PyDict_SetItem. Currently set to 2/3. - Increasing this ratio makes dictionaries more dense resulting - in more collisions. Decreasing it improves sparseness at the - expense of spreading entries over more cache lines and at the - cost of total memory consumed. - - The load test occurs in highly time sensitive code. Efforts - to make the test more complex (for example, varying the load - for different sizes) have degraded performance. - -* Growth rate upon hitting maximum load. Currently set to *2. - Raising this to *4 results in half the number of resizes, - less effort to resize, better sparseness for some (but not - all dict sizes), and potentially doubles memory consumption - depending on the size of the dictionary. Setting to *4 - eliminates every other resize step. - -* Maximum sparseness (minimum dictionary load). What percentage - of entries can be unused before the dictionary shrinks to - free up memory and speed up iteration? (The current CPython - code does not represent this parameter directly.) - -* Shrinkage rate upon exceeding maximum sparseness. The current - CPython code never even checks sparseness when deleting a - key. When a new key is added, it resizes based on the number - of active keys, so that the addition may trigger shrinkage - rather than growth. - -Tune-ups should be measured across a broad range of applications and -use cases. A change to any parameter will help in some situations and -hurt in others. The key is to find settings that help the most common -cases and do the least damage to the less common cases. Results will -vary dramatically depending on the exact number of keys, whether the -keys are all strings, whether reads or writes dominate, the exact -hash values of the keys (some sets of values have fewer collisions than -others). Any one test or benchmark is likely to prove misleading. - -While making a dictionary more sparse reduces collisions, it impairs -iteration and key listing. Those methods loop over every potential -entry. Doubling the size of dictionary results in twice as many -non-overlapping memory accesses for keys(), items(), values(), -__iter__(), iterkeys(), iteritems(), itervalues(), and update(). -Also, every dictionary iterates at least twice, once for the memset() -when it is created and once by dealloc(). - -Dictionary operations involving only a single key can be O(1) unless -resizing is possible. By checking for a resize only when the -dictionary can grow (and may *require* resizing), other operations -remain O(1), and the odds of resize thrashing or memory fragmentation -are reduced. In particular, an algorithm that empties a dictionary -by repeatedly invoking .pop will see no resizing, which might -not be necessary at all because the dictionary is eventually -discarded entirely. - - -Results of Cache Locality Experiments -------------------------------------- - -When an entry is retrieved from memory, 4.333 adjacent entries are also -retrieved into a cache line. Since accessing items in cache is *much* -cheaper than a cache miss, an enticing idea is to probe the adjacent -entries as a first step in collision resolution. Unfortunately, the -introduction of any regularity into collision searches results in more -collisions than the current random chaining approach. - -Exploiting cache locality at the expense of additional collisions fails -to payoff when the entries are already loaded in cache (the expense -is paid with no compensating benefit). This occurs in small dictionaries -where the whole dictionary fits into a pair of cache lines. It also -occurs frequently in large dictionaries which have a common access pattern -where some keys are accessed much more frequently than others. The -more popular entries *and* their collision chains tend to remain in cache. - -To exploit cache locality, change the collision resolution section -in lookdict() and lookdict_string(). Set i^=1 at the top of the -loop and move the i = (i << 2) + i + perturb + 1 to an unrolled -version of the loop. - -This optimization strategy can be leveraged in several ways: - -* If the dictionary is kept sparse (through the tunable parameters), -then the occurrence of additional collisions is lessened. - -* If lookdict() and lookdict_string() are specialized for small dicts -and for largedicts, then the versions for large_dicts can be given -an alternate search strategy without increasing collisions in small dicts -which already have the maximum benefit of cache locality. - -* If the use case for a dictionary is known to have a random key -access pattern (as opposed to a more common pattern with a Zipf's law -distribution), then there will be more benefit for large dictionaries -because any given key is no more likely than another to already be -in cache. - -* In use cases with paired accesses to the same key, the second access -is always in cache and gets no benefit from efforts to further improve -cache locality. - -Optimizing the Search of Small Dictionaries -------------------------------------------- - -If lookdict() and lookdict_string() are specialized for smaller dictionaries, -then a custom search approach can be implemented that exploits the small -search space and cache locality. - -* The simplest example is a linear search of contiguous entries. This is - simple to implement, guaranteed to terminate rapidly, never searches - the same entry twice, and precludes the need to check for dummy entries. - -* A more advanced example is a self-organizing search so that the most - frequently accessed entries get probed first. The organization - adapts if the access pattern changes over time. Treaps are ideally - suited for self-organization with the most common entries at the - top of the heap and a rapid binary search pattern. Most probes and - results are all located at the top of the tree allowing them all to - be located in one or two cache lines. - -* Also, small dictionaries may be made more dense, perhaps filling all - eight cells to take the maximum advantage of two cache lines. - - -Strategy Pattern ----------------- - -Consider allowing the user to set the tunable parameters or to select a -particular search method. Since some dictionary use cases have known -sizes and access patterns, the user may be able to provide useful hints. - -1) For example, if membership testing or lookups dominate runtime and memory - is not at a premium, the user may benefit from setting the maximum load - ratio at 5% or 10% instead of the usual 66.7%. This will sharply - curtail the number of collisions but will increase iteration time. - The builtin namespace is a prime example of a dictionary that can - benefit from being highly sparse. - -2) Dictionary creation time can be shortened in cases where the ultimate - size of the dictionary is known in advance. The dictionary can be - pre-sized so that no resize operations are required during creation. - Not only does this save resizes, but the key insertion will go - more quickly because the first half of the keys will be inserted into - a more sparse environment than before. The preconditions for this - strategy arise whenever a dictionary is created from a key or item - sequence and the number of *unique* keys is known. - -3) If the key space is large and the access pattern is known to be random, - then search strategies exploiting cache locality can be fruitful. - The preconditions for this strategy arise in simulations and - numerical analysis. - -4) If the keys are fixed and the access pattern strongly favors some of - the keys, then the entries can be stored contiguously and accessed - with a linear search or treap. This exploits knowledge of the data, - cache locality, and a simplified search routine. It also eliminates - the need to test for dummy entries on each probe. The preconditions - for this strategy arise in symbol tables and in the builtin dictionary. - - -Readonly Dictionaries ---------------------- -Some dictionary use cases pass through a build stage and then move to a -more heavily exercised lookup stage with no further changes to the -dictionary. - -An idea that emerged on python-dev is to be able to convert a dictionary -to a read-only state. This can help prevent programming errors and also -provide knowledge that can be exploited for lookup optimization. - -The dictionary can be immediately rebuilt (eliminating dummy entries), -resized (to an appropriate level of sparseness), and the keys can be -jostled (to minimize collisions). The lookdict() routine can then -eliminate the test for dummy entries (saving about 1/4 of the time -spent in the collision resolution loop). - -An additional possibility is to insert links into the empty spaces -so that dictionary iteration can proceed in len(d) steps instead of -(mp->mask + 1) steps. Alternatively, a separate tuple of keys can be -kept just for iteration. - - -Caching Lookups ---------------- -The idea is to exploit key access patterns by anticipating future lookups -based on previous lookups. - -The simplest incarnation is to save the most recently accessed entry. -This gives optimal performance for use cases where every get is followed -by a set or del to the same key. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/dictobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/dictobject.c deleted file mode 100644 index c6bfc28..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/dictobject.c +++ /dev/null @@ -1,3248 +0,0 @@ - -/* Dictionary object implementation using a hash table */ - -/* The distribution includes a separate file, Objects/dictnotes.txt, - describing explorations into dictionary design and optimization. - It covers typical dictionary use patterns, the parameters for - tuning dictionaries, and several ideas for possible optimizations. -*/ - -#include "Python.h" - - -/* Set a key error with the specified argument, wrapping it in a - * tuple automatically so that tuple keys are not unpacked as the - * exception arguments. */ -static void -set_key_error(PyObject *arg) -{ - PyObject *tup; - tup = PyTuple_Pack(1, arg); - if (!tup) - return; /* caller will expect error to be set anyway */ - PyErr_SetObject(PyExc_KeyError, tup); - Py_DECREF(tup); -} - -/* Define this out if you don't want conversion statistics on exit. */ -#undef SHOW_CONVERSION_COUNTS - -/* See large comment block below. This must be >= 1. */ -#define PERTURB_SHIFT 5 - -/* -Major subtleties ahead: Most hash schemes depend on having a "good" hash -function, in the sense of simulating randomness. Python doesn't: its most -important hash functions (for strings and ints) are very regular in common -cases: - ->>> map(hash, (0, 1, 2, 3)) -[0, 1, 2, 3] ->>> map(hash, ("namea", "nameb", "namec", "named")) -[-1658398457, -1658398460, -1658398459, -1658398462] ->>> - -This isn't necessarily bad! To the contrary, in a table of size 2**i, taking -the low-order i bits as the initial table index is extremely fast, and there -are no collisions at all for dicts indexed by a contiguous range of ints. -The same is approximately true when keys are "consecutive" strings. So this -gives better-than-random behavior in common cases, and that's very desirable. - -OTOH, when collisions occur, the tendency to fill contiguous slices of the -hash table makes a good collision resolution strategy crucial. Taking only -the last i bits of the hash code is also vulnerable: for example, consider -[i << 16 for i in range(20000)] as a set of keys. Since ints are their own -hash codes, and this fits in a dict of size 2**15, the last 15 bits of every -hash code are all 0: they *all* map to the same table index. - -But catering to unusual cases should not slow the usual ones, so we just take -the last i bits anyway. It's up to collision resolution to do the rest. If -we *usually* find the key we're looking for on the first try (and, it turns -out, we usually do -- the table load factor is kept under 2/3, so the odds -are solidly in our favor), then it makes best sense to keep the initial index -computation dirt cheap. - -The first half of collision resolution is to visit table indices via this -recurrence: - - j = ((5*j) + 1) mod 2**i - -For any initial j in range(2**i), repeating that 2**i times generates each -int in range(2**i) exactly once (see any text on random-number generation for -proof). By itself, this doesn't help much: like linear probing (setting -j += 1, or j -= 1, on each loop trip), it scans the table entries in a fixed -order. This would be bad, except that's not the only thing we do, and it's -actually *good* in the common cases where hash keys are consecutive. In an -example that's really too small to make this entirely clear, for a table of -size 2**3 the order of indices is: - - 0 -> 1 -> 6 -> 7 -> 4 -> 5 -> 2 -> 3 -> 0 [and here it's repeating] - -If two things come in at index 5, the first place we look after is index 2, -not 6, so if another comes in at index 6 the collision at 5 didn't hurt it. -Linear probing is deadly in this case because there the fixed probe order -is the *same* as the order consecutive keys are likely to arrive. But it's -extremely unlikely hash codes will follow a 5*j+1 recurrence by accident, -and certain that consecutive hash codes do not. - -The other half of the strategy is to get the other bits of the hash code -into play. This is done by initializing a (unsigned) vrbl "perturb" to the -full hash code, and changing the recurrence to: - - j = (5*j) + 1 + perturb; - perturb >>= PERTURB_SHIFT; - use j % 2**i as the next table index; - -Now the probe sequence depends (eventually) on every bit in the hash code, -and the pseudo-scrambling property of recurring on 5*j+1 is more valuable, -because it quickly magnifies small differences in the bits that didn't affect -the initial index. Note that because perturb is unsigned, if the recurrence -is executed often enough perturb eventually becomes and remains 0. At that -point (very rarely reached) the recurrence is on (just) 5*j+1 again, and -that's certain to find an empty slot eventually (since it generates every int -in range(2**i), and we make sure there's always at least one empty slot). - -Selecting a good value for PERTURB_SHIFT is a balancing act. You want it -small so that the high bits of the hash code continue to affect the probe -sequence across iterations; but you want it large so that in really bad cases -the high-order hash bits have an effect on early iterations. 5 was "the -best" in minimizing total collisions across experiments Tim Peters ran (on -both normal and pathological cases), but 4 and 6 weren't significantly worse. - -Historical: Reimer Behrends contributed the idea of using a polynomial-based -approach, using repeated multiplication by x in GF(2**n) where an irreducible -polynomial for each table size was chosen such that x was a primitive root. -Christian Tismer later extended that to use division by x instead, as an -efficient way to get the high bits of the hash code into play. This scheme -also gave excellent collision statistics, but was more expensive: two -if-tests were required inside the loop; computing "the next" index took about -the same number of operations but without as much potential parallelism -(e.g., computing 5*j can go on at the same time as computing 1+perturb in the -above, and then shifting perturb can be done while the table index is being -masked); and the PyDictObject struct required a member to hold the table's -polynomial. In Tim's experiments the current scheme ran faster, produced -equally good collision statistics, needed less code & used less memory. - -Theoretical Python 2.5 headache: hash codes are only C "long", but -sizeof(Py_ssize_t) > sizeof(long) may be possible. In that case, and if a -dict is genuinely huge, then only the slots directly reachable via indexing -by a C long can be the first slot in a probe sequence. The probe sequence -will still eventually reach every slot in the table, but the collision rate -on initial probes may be much higher than this scheme was designed for. -Getting a hash code as fat as Py_ssize_t is the only real cure. But in -practice, this probably won't make a lick of difference for many years (at -which point everyone will have terabytes of RAM on 64-bit boxes). -*/ - -/* Object used as dummy key to fill deleted entries */ -static PyObject *dummy = NULL; /* Initialized by first call to newPyDictObject() */ - -#ifdef Py_REF_DEBUG -PyObject * -_PyDict_Dummy(void) -{ - return dummy; -} -#endif - -/* forward declarations */ -static PyDictEntry * -lookdict_string(PyDictObject *mp, PyObject *key, long hash); - -#ifdef SHOW_CONVERSION_COUNTS -static long created = 0L; -static long converted = 0L; - -static void -show_counts(void) -{ - fprintf(stderr, "created %ld string dicts\n", created); - fprintf(stderr, "converted %ld to normal dicts\n", converted); - fprintf(stderr, "%.2f%% conversion rate\n", (100.0*converted)/created); -} -#endif - -/* Debug statistic to compare allocations with reuse through the free list */ -#undef SHOW_ALLOC_COUNT -#ifdef SHOW_ALLOC_COUNT -static size_t count_alloc = 0; -static size_t count_reuse = 0; - -static void -show_alloc(void) -{ - fprintf(stderr, "Dict allocations: %" PY_FORMAT_SIZE_T "d\n", - count_alloc); - fprintf(stderr, "Dict reuse through freelist: %" PY_FORMAT_SIZE_T - "d\n", count_reuse); - fprintf(stderr, "%.2f%% reuse rate\n\n", - (100.0*count_reuse/(count_alloc+count_reuse))); -} -#endif - -/* Debug statistic to count GC tracking of dicts */ -#ifdef SHOW_TRACK_COUNT -static Py_ssize_t count_untracked = 0; -static Py_ssize_t count_tracked = 0; - -static void -show_track(void) -{ - fprintf(stderr, "Dicts created: %" PY_FORMAT_SIZE_T "d\n", - count_tracked + count_untracked); - fprintf(stderr, "Dicts tracked by the GC: %" PY_FORMAT_SIZE_T - "d\n", count_tracked); - fprintf(stderr, "%.2f%% dict tracking rate\n\n", - (100.0*count_tracked/(count_untracked+count_tracked))); -} -#endif - - -/* Initialization macros. - There are two ways to create a dict: PyDict_New() is the main C API - function, and the tp_new slot maps to dict_new(). In the latter case we - can save a little time over what PyDict_New does because it's guaranteed - that the PyDictObject struct is already zeroed out. - Everyone except dict_new() should use EMPTY_TO_MINSIZE (unless they have - an excellent reason not to). -*/ - -#define INIT_NONZERO_DICT_SLOTS(mp) do { \ - (mp)->ma_table = (mp)->ma_smalltable; \ - (mp)->ma_mask = PyDict_MINSIZE - 1; \ - } while(0) - -#define EMPTY_TO_MINSIZE(mp) do { \ - memset((mp)->ma_smalltable, 0, sizeof((mp)->ma_smalltable)); \ - (mp)->ma_used = (mp)->ma_fill = 0; \ - INIT_NONZERO_DICT_SLOTS(mp); \ - } while(0) - -/* Dictionary reuse scheme to save calls to malloc, free, and memset */ -#ifndef PyDict_MAXFREELIST -#define PyDict_MAXFREELIST 80 -#endif -static PyDictObject *free_list[PyDict_MAXFREELIST]; -static int numfree = 0; - -void -PyDict_Fini(void) -{ - PyDictObject *op; - - while (numfree) { - op = free_list[--numfree]; - assert(PyDict_CheckExact(op)); - PyObject_GC_Del(op); - } -} - -PyObject * -PyDict_New(void) -{ - register PyDictObject *mp; - if (dummy == NULL) { /* Auto-initialize dummy */ - dummy = PyString_FromString(""); - if (dummy == NULL) - return NULL; -#ifdef SHOW_CONVERSION_COUNTS - Py_AtExit(show_counts); -#endif -#ifdef SHOW_ALLOC_COUNT - Py_AtExit(show_alloc); -#endif -#ifdef SHOW_TRACK_COUNT - Py_AtExit(show_track); -#endif - } - if (numfree) { - mp = free_list[--numfree]; - assert (mp != NULL); - assert (Py_TYPE(mp) == &PyDict_Type); - _Py_NewReference((PyObject *)mp); - if (mp->ma_fill) { - EMPTY_TO_MINSIZE(mp); - } else { - /* At least set ma_table and ma_mask; these are wrong - if an empty but presized dict is added to freelist */ - INIT_NONZERO_DICT_SLOTS(mp); - } - assert (mp->ma_used == 0); - assert (mp->ma_table == mp->ma_smalltable); - assert (mp->ma_mask == PyDict_MINSIZE - 1); -#ifdef SHOW_ALLOC_COUNT - count_reuse++; -#endif - } else { - mp = PyObject_GC_New(PyDictObject, &PyDict_Type); - if (mp == NULL) - return NULL; - EMPTY_TO_MINSIZE(mp); -#ifdef SHOW_ALLOC_COUNT - count_alloc++; -#endif - } - mp->ma_lookup = lookdict_string; -#ifdef SHOW_TRACK_COUNT - count_untracked++; -#endif -#ifdef SHOW_CONVERSION_COUNTS - ++created; -#endif - return (PyObject *)mp; -} - -/* -The basic lookup function used by all operations. -This is based on Algorithm D from Knuth Vol. 3, Sec. 6.4. -Open addressing is preferred over chaining since the link overhead for -chaining would be substantial (100% with typical malloc overhead). - -The initial probe index is computed as hash mod the table size. Subsequent -probe indices are computed as explained earlier. - -All arithmetic on hash should ignore overflow. - -(The details in this version are due to Tim Peters, building on many past -contributions by Reimer Behrends, Jyrki Alakuijala, Vladimir Marangozov and -Christian Tismer). - -lookdict() is general-purpose, and may return NULL if (and only if) a -comparison raises an exception (this was new in Python 2.5). -lookdict_string() below is specialized to string keys, comparison of which can -never raise an exception; that function can never return NULL. For both, when -the key isn't found a PyDictEntry* is returned for which the me_value field is -NULL; this is the slot in the dict at which the key would have been found, and -the caller can (if it wishes) add the pair to the returned -PyDictEntry*. -*/ -static PyDictEntry * -lookdict(PyDictObject *mp, PyObject *key, register long hash) -{ - register size_t i; - register size_t perturb; - register PyDictEntry *freeslot; - register size_t mask = (size_t)mp->ma_mask; - PyDictEntry *ep0 = mp->ma_table; - register PyDictEntry *ep; - register int cmp; - PyObject *startkey; - - i = (size_t)hash & mask; - ep = &ep0[i]; - if (ep->me_key == NULL || ep->me_key == key) - return ep; - - if (ep->me_key == dummy) - freeslot = ep; - else { - if (ep->me_hash == hash) { - startkey = ep->me_key; - Py_INCREF(startkey); - cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); - Py_DECREF(startkey); - if (cmp < 0) - return NULL; - if (ep0 == mp->ma_table && ep->me_key == startkey) { - if (cmp > 0) - return ep; - } - else { - /* The compare did major nasty stuff to the - * dict: start over. - * XXX A clever adversary could prevent this - * XXX from terminating. - */ - return lookdict(mp, key, hash); - } - } - freeslot = NULL; - } - - /* In the loop, me_key == dummy is by far (factor of 100s) the - least likely outcome, so test for that last. */ - for (perturb = hash; ; perturb >>= PERTURB_SHIFT) { - i = (i << 2) + i + perturb + 1; - ep = &ep0[i & mask]; - if (ep->me_key == NULL) - return freeslot == NULL ? ep : freeslot; - if (ep->me_key == key) - return ep; - if (ep->me_hash == hash && ep->me_key != dummy) { - startkey = ep->me_key; - Py_INCREF(startkey); - cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); - Py_DECREF(startkey); - if (cmp < 0) - return NULL; - if (ep0 == mp->ma_table && ep->me_key == startkey) { - if (cmp > 0) - return ep; - } - else { - /* The compare did major nasty stuff to the - * dict: start over. - * XXX A clever adversary could prevent this - * XXX from terminating. - */ - return lookdict(mp, key, hash); - } - } - else if (ep->me_key == dummy && freeslot == NULL) - freeslot = ep; - } - assert(0); /* NOT REACHED */ - return 0; -} - -/* - * Hacked up version of lookdict which can assume keys are always strings; - * this assumption allows testing for errors during PyObject_RichCompareBool() - * to be dropped; string-string comparisons never raise exceptions. This also - * means we don't need to go through PyObject_RichCompareBool(); we can always - * use _PyString_Eq() directly. - * - * This is valuable because dicts with only string keys are very common. - */ -static PyDictEntry * -lookdict_string(PyDictObject *mp, PyObject *key, register long hash) -{ - register size_t i; - register size_t perturb; - register PyDictEntry *freeslot; - register size_t mask = (size_t)mp->ma_mask; - PyDictEntry *ep0 = mp->ma_table; - register PyDictEntry *ep; - - /* Make sure this function doesn't have to handle non-string keys, - including subclasses of str; e.g., one reason to subclass - strings is to override __eq__, and for speed we don't cater to - that here. */ - if (!PyString_CheckExact(key)) { -#ifdef SHOW_CONVERSION_COUNTS - ++converted; -#endif - mp->ma_lookup = lookdict; - return lookdict(mp, key, hash); - } - i = hash & mask; - ep = &ep0[i]; - if (ep->me_key == NULL || ep->me_key == key) - return ep; - if (ep->me_key == dummy) - freeslot = ep; - else { - if (ep->me_hash == hash && _PyString_Eq(ep->me_key, key)) - return ep; - freeslot = NULL; - } - - /* In the loop, me_key == dummy is by far (factor of 100s) the - least likely outcome, so test for that last. */ - for (perturb = hash; ; perturb >>= PERTURB_SHIFT) { - i = (i << 2) + i + perturb + 1; - ep = &ep0[i & mask]; - if (ep->me_key == NULL) - return freeslot == NULL ? ep : freeslot; - if (ep->me_key == key - || (ep->me_hash == hash - && ep->me_key != dummy - && _PyString_Eq(ep->me_key, key))) - return ep; - if (ep->me_key == dummy && freeslot == NULL) - freeslot = ep; - } - assert(0); /* NOT REACHED */ - return 0; -} - -#ifdef SHOW_TRACK_COUNT -#define INCREASE_TRACK_COUNT \ - (count_tracked++, count_untracked--); -#define DECREASE_TRACK_COUNT \ - (count_tracked--, count_untracked++); -#else -#define INCREASE_TRACK_COUNT -#define DECREASE_TRACK_COUNT -#endif - -#define MAINTAIN_TRACKING(mp, key, value) \ - do { \ - if (!_PyObject_GC_IS_TRACKED(mp)) { \ - if (_PyObject_GC_MAY_BE_TRACKED(key) || \ - _PyObject_GC_MAY_BE_TRACKED(value)) { \ - _PyObject_GC_TRACK(mp); \ - INCREASE_TRACK_COUNT \ - } \ - } \ - } while(0) - -void -_PyDict_MaybeUntrack(PyObject *op) -{ - PyDictObject *mp; - PyObject *value; - Py_ssize_t mask, i; - PyDictEntry *ep; - - if (!PyDict_CheckExact(op) || !_PyObject_GC_IS_TRACKED(op)) - return; - - mp = (PyDictObject *) op; - ep = mp->ma_table; - mask = mp->ma_mask; - for (i = 0; i <= mask; i++) { - if ((value = ep[i].me_value) == NULL) - continue; - if (_PyObject_GC_MAY_BE_TRACKED(value) || - _PyObject_GC_MAY_BE_TRACKED(ep[i].me_key)) - return; - } - DECREASE_TRACK_COUNT - _PyObject_GC_UNTRACK(op); -} - -/* -Internal routine to insert a new item into the table when you have entry object. -Used by insertdict. -*/ -static int -insertdict_by_entry(register PyDictObject *mp, PyObject *key, long hash, - PyDictEntry *ep, PyObject *value) -{ - PyObject *old_value; - - MAINTAIN_TRACKING(mp, key, value); - if (ep->me_value != NULL) { - old_value = ep->me_value; - ep->me_value = value; - Py_DECREF(old_value); /* which **CAN** re-enter */ - Py_DECREF(key); - } - else { - if (ep->me_key == NULL) - mp->ma_fill++; - else { - assert(ep->me_key == dummy); - Py_DECREF(dummy); - } - ep->me_key = key; - ep->me_hash = (Py_ssize_t)hash; - ep->me_value = value; - mp->ma_used++; - } - return 0; -} - - -/* -Internal routine to insert a new item into the table. -Used both by the internal resize routine and by the public insert routine. -Eats a reference to key and one to value. -Returns -1 if an error occurred, or 0 on success. -*/ -static int -insertdict(register PyDictObject *mp, PyObject *key, long hash, PyObject *value) -{ - register PyDictEntry *ep; - - assert(mp->ma_lookup != NULL); - ep = mp->ma_lookup(mp, key, hash); - if (ep == NULL) { - Py_DECREF(key); - Py_DECREF(value); - return -1; - } - return insertdict_by_entry(mp, key, hash, ep, value); -} - -/* -Internal routine used by dictresize() to insert an item which is -known to be absent from the dict. This routine also assumes that -the dict contains no deleted entries. Besides the performance benefit, -using insertdict() in dictresize() is dangerous (SF bug #1456209). -Note that no refcounts are changed by this routine; if needed, the caller -is responsible for incref'ing `key` and `value`. -*/ -static void -insertdict_clean(register PyDictObject *mp, PyObject *key, long hash, - PyObject *value) -{ - register size_t i; - register size_t perturb; - register size_t mask = (size_t)mp->ma_mask; - PyDictEntry *ep0 = mp->ma_table; - register PyDictEntry *ep; - - MAINTAIN_TRACKING(mp, key, value); - i = hash & mask; - ep = &ep0[i]; - for (perturb = hash; ep->me_key != NULL; perturb >>= PERTURB_SHIFT) { - i = (i << 2) + i + perturb + 1; - ep = &ep0[i & mask]; - } - assert(ep->me_value == NULL); - mp->ma_fill++; - ep->me_key = key; - ep->me_hash = (Py_ssize_t)hash; - ep->me_value = value; - mp->ma_used++; -} - -/* -Restructure the table by allocating a new table and reinserting all -items again. When entries have been deleted, the new table may -actually be smaller than the old one. -*/ -static int -dictresize(PyDictObject *mp, Py_ssize_t minused) -{ - Py_ssize_t newsize; - PyDictEntry *oldtable, *newtable, *ep; - Py_ssize_t i; - int is_oldtable_malloced; - PyDictEntry small_copy[PyDict_MINSIZE]; - - assert(minused >= 0); - - /* Find the smallest table size > minused. */ - for (newsize = PyDict_MINSIZE; - newsize <= minused && newsize > 0; - newsize <<= 1) - ; - if (newsize <= 0) { - PyErr_NoMemory(); - return -1; - } - - /* Get space for a new table. */ - oldtable = mp->ma_table; - assert(oldtable != NULL); - is_oldtable_malloced = oldtable != mp->ma_smalltable; - - if (newsize == PyDict_MINSIZE) { - /* A large table is shrinking, or we can't get any smaller. */ - newtable = mp->ma_smalltable; - if (newtable == oldtable) { - if (mp->ma_fill == mp->ma_used) { - /* No dummies, so no point doing anything. */ - return 0; - } - /* We're not going to resize it, but rebuild the - table anyway to purge old dummy entries. - Subtle: This is *necessary* if fill==size, - as lookdict needs at least one virgin slot to - terminate failing searches. If fill < size, it's - merely desirable, as dummies slow searches. */ - assert(mp->ma_fill > mp->ma_used); - memcpy(small_copy, oldtable, sizeof(small_copy)); - oldtable = small_copy; - } - } - else { - newtable = PyMem_NEW(PyDictEntry, newsize); - if (newtable == NULL) { - PyErr_NoMemory(); - return -1; - } - } - - /* Make the dict empty, using the new table. */ - assert(newtable != oldtable); - mp->ma_table = newtable; - mp->ma_mask = newsize - 1; - memset(newtable, 0, sizeof(PyDictEntry) * newsize); - mp->ma_used = 0; - i = mp->ma_fill; - mp->ma_fill = 0; - - /* Copy the data over; this is refcount-neutral for active entries; - dummy entries aren't copied over, of course */ - for (ep = oldtable; i > 0; ep++) { - if (ep->me_value != NULL) { /* active entry */ - --i; - insertdict_clean(mp, ep->me_key, (long)ep->me_hash, - ep->me_value); - } - else if (ep->me_key != NULL) { /* dummy entry */ - --i; - assert(ep->me_key == dummy); - Py_DECREF(ep->me_key); - } - /* else key == value == NULL: nothing to do */ - } - - if (is_oldtable_malloced) - PyMem_DEL(oldtable); - return 0; -} - -/* Create a new dictionary pre-sized to hold an estimated number of elements. - Underestimates are okay because the dictionary will resize as necessary. - Overestimates just mean the dictionary will be more sparse than usual. -*/ - -PyObject * -_PyDict_NewPresized(Py_ssize_t minused) -{ - PyObject *op = PyDict_New(); - - if (minused>5 && op != NULL && dictresize((PyDictObject *)op, minused) == -1) { - Py_DECREF(op); - return NULL; - } - return op; -} - -/* Note that, for historical reasons, PyDict_GetItem() suppresses all errors - * that may occur (originally dicts supported only string keys, and exceptions - * weren't possible). So, while the original intent was that a NULL return - * meant the key wasn't present, in reality it can mean that, or that an error - * (suppressed) occurred while computing the key's hash, or that some error - * (suppressed) occurred when comparing keys in the dict's internal probe - * sequence. A nasty example of the latter is when a Python-coded comparison - * function hits a stack-depth error, which can cause this to return NULL - * even if the key is present. - */ -PyObject * -PyDict_GetItem(PyObject *op, PyObject *key) -{ - long hash; - PyDictObject *mp = (PyDictObject *)op; - PyDictEntry *ep; - PyThreadState *tstate; - if (!PyDict_Check(op)) - return NULL; - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) - { - hash = PyObject_Hash(key); - if (hash == -1) { - PyErr_Clear(); - return NULL; - } - } - - /* We can arrive here with a NULL tstate during initialization: try - running "python -Wi" for an example related to string interning. - Let's just hope that no exception occurs then... This must be - _PyThreadState_Current and not PyThreadState_GET() because in debug - mode, the latter complains if tstate is NULL. */ - tstate = _PyThreadState_Current; - if (tstate != NULL && tstate->curexc_type != NULL) { - /* preserve the existing exception */ - PyObject *err_type, *err_value, *err_tb; - PyErr_Fetch(&err_type, &err_value, &err_tb); - ep = (mp->ma_lookup)(mp, key, hash); - /* ignore errors */ - PyErr_Restore(err_type, err_value, err_tb); - if (ep == NULL) - return NULL; - } - else { - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) { - PyErr_Clear(); - return NULL; - } - } - return ep->me_value; -} - -static int -dict_set_item_by_hash_or_entry(register PyObject *op, PyObject *key, - long hash, PyDictEntry *ep, PyObject *value) -{ - register PyDictObject *mp; - register Py_ssize_t n_used; - - mp = (PyDictObject *)op; - assert(mp->ma_fill <= mp->ma_mask); /* at least one empty slot */ - n_used = mp->ma_used; - Py_INCREF(value); - Py_INCREF(key); - if (ep == NULL) { - if (insertdict(mp, key, hash, value) != 0) - return -1; - } - else { - if (insertdict_by_entry(mp, key, hash, ep, value) != 0) - return -1; - } - /* If we added a key, we can safely resize. Otherwise just return! - * If fill >= 2/3 size, adjust size. Normally, this doubles or - * quaduples the size, but it's also possible for the dict to shrink - * (if ma_fill is much larger than ma_used, meaning a lot of dict - * keys have been * deleted). - * - * Quadrupling the size improves average dictionary sparseness - * (reducing collisions) at the cost of some memory and iteration - * speed (which loops over every possible entry). It also halves - * the number of expensive resize operations in a growing dictionary. - * - * Very large dictionaries (over 50K items) use doubling instead. - * This may help applications with severe memory constraints. - */ - if (!(mp->ma_used > n_used && mp->ma_fill*3 >= (mp->ma_mask+1)*2)) - return 0; - return dictresize(mp, (mp->ma_used > 50000 ? 2 : 4) * mp->ma_used); -} - -/* CAUTION: PyDict_SetItem() must guarantee that it won't resize the - * dictionary if it's merely replacing the value for an existing key. - * This means that it's safe to loop over a dictionary with PyDict_Next() - * and occasionally replace a value -- but you can't insert new keys or - * remove them. - */ -int -PyDict_SetItem(register PyObject *op, PyObject *key, PyObject *value) -{ - register long hash; - - if (!PyDict_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - assert(key); - assert(value); - if (PyString_CheckExact(key)) { - hash = ((PyStringObject *)key)->ob_shash; - if (hash == -1) - hash = PyObject_Hash(key); - } - else { - hash = PyObject_Hash(key); - if (hash == -1) - return -1; - } - return dict_set_item_by_hash_or_entry(op, key, hash, NULL, value); -} - -int -PyDict_DelItem(PyObject *op, PyObject *key) -{ - register PyDictObject *mp; - register long hash; - register PyDictEntry *ep; - PyObject *old_value, *old_key; - - if (!PyDict_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - assert(key); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return -1; - } - mp = (PyDictObject *)op; - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) - return -1; - if (ep->me_value == NULL) { - set_key_error(key); - return -1; - } - old_key = ep->me_key; - Py_INCREF(dummy); - ep->me_key = dummy; - old_value = ep->me_value; - ep->me_value = NULL; - mp->ma_used--; - Py_DECREF(old_value); - Py_DECREF(old_key); - return 0; -} - -void -PyDict_Clear(PyObject *op) -{ - PyDictObject *mp; - PyDictEntry *ep, *table; - int table_is_malloced; - Py_ssize_t fill; - PyDictEntry small_copy[PyDict_MINSIZE]; -#ifdef Py_DEBUG - Py_ssize_t i, n; -#endif - - if (!PyDict_Check(op)) - return; - mp = (PyDictObject *)op; -#ifdef Py_DEBUG - n = mp->ma_mask + 1; - i = 0; -#endif - - table = mp->ma_table; - assert(table != NULL); - table_is_malloced = table != mp->ma_smalltable; - - /* This is delicate. During the process of clearing the dict, - * decrefs can cause the dict to mutate. To avoid fatal confusion - * (voice of experience), we have to make the dict empty before - * clearing the slots, and never refer to anything via mp->xxx while - * clearing. - */ - fill = mp->ma_fill; - if (table_is_malloced) - EMPTY_TO_MINSIZE(mp); - - else if (fill > 0) { - /* It's a small table with something that needs to be cleared. - * Afraid the only safe way is to copy the dict entries into - * another small table first. - */ - memcpy(small_copy, table, sizeof(small_copy)); - table = small_copy; - EMPTY_TO_MINSIZE(mp); - } - /* else it's a small table that's already empty */ - - /* Now we can finally clear things. If C had refcounts, we could - * assert that the refcount on table is 1 now, i.e. that this function - * has unique access to it, so decref side-effects can't alter it. - */ - for (ep = table; fill > 0; ++ep) { -#ifdef Py_DEBUG - assert(i < n); - ++i; -#endif - if (ep->me_key) { - --fill; - Py_DECREF(ep->me_key); - Py_XDECREF(ep->me_value); - } -#ifdef Py_DEBUG - else - assert(ep->me_value == NULL); -#endif - } - - if (table_is_malloced) - PyMem_DEL(table); -} - -/* - * Iterate over a dict. Use like so: - * - * Py_ssize_t i; - * PyObject *key, *value; - * i = 0; # important! i should not otherwise be changed by you - * while (PyDict_Next(yourdict, &i, &key, &value)) { - * Refer to borrowed references in key and value. - * } - * - * CAUTION: In general, it isn't safe to use PyDict_Next in a loop that - * mutates the dict. One exception: it is safe if the loop merely changes - * the values associated with the keys (but doesn't insert new keys or - * delete keys), via PyDict_SetItem(). - */ -int -PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue) -{ - register Py_ssize_t i; - register Py_ssize_t mask; - register PyDictEntry *ep; - - if (!PyDict_Check(op)) - return 0; - i = *ppos; - if (i < 0) - return 0; - ep = ((PyDictObject *)op)->ma_table; - mask = ((PyDictObject *)op)->ma_mask; - while (i <= mask && ep[i].me_value == NULL) - i++; - *ppos = i+1; - if (i > mask) - return 0; - if (pkey) - *pkey = ep[i].me_key; - if (pvalue) - *pvalue = ep[i].me_value; - return 1; -} - -/* Internal version of PyDict_Next that returns a hash value in addition to the key and value.*/ -int -_PyDict_Next(PyObject *op, Py_ssize_t *ppos, PyObject **pkey, PyObject **pvalue, long *phash) -{ - register Py_ssize_t i; - register Py_ssize_t mask; - register PyDictEntry *ep; - - if (!PyDict_Check(op)) - return 0; - i = *ppos; - if (i < 0) - return 0; - ep = ((PyDictObject *)op)->ma_table; - mask = ((PyDictObject *)op)->ma_mask; - while (i <= mask && ep[i].me_value == NULL) - i++; - *ppos = i+1; - if (i > mask) - return 0; - *phash = (long)(ep[i].me_hash); - if (pkey) - *pkey = ep[i].me_key; - if (pvalue) - *pvalue = ep[i].me_value; - return 1; -} - -/* Methods */ - -static void -dict_dealloc(register PyDictObject *mp) -{ - register PyDictEntry *ep; - Py_ssize_t fill = mp->ma_fill; - PyObject_GC_UnTrack(mp); - Py_TRASHCAN_SAFE_BEGIN(mp) - for (ep = mp->ma_table; fill > 0; ep++) { - if (ep->me_key) { - --fill; - Py_DECREF(ep->me_key); - Py_XDECREF(ep->me_value); - } - } - if (mp->ma_table != mp->ma_smalltable) - PyMem_DEL(mp->ma_table); - if (numfree < PyDict_MAXFREELIST && Py_TYPE(mp) == &PyDict_Type) - free_list[numfree++] = mp; - else - Py_TYPE(mp)->tp_free((PyObject *)mp); - Py_TRASHCAN_SAFE_END(mp) -} - -static int -dict_print(register PyDictObject *mp, register FILE *fp, register int flags) -{ - register Py_ssize_t i; - register Py_ssize_t any; - int status; - - status = Py_ReprEnter((PyObject*)mp); - if (status != 0) { - if (status < 0) - return status; - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "{...}"); - Py_END_ALLOW_THREADS - return 0; - } - - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "{"); - Py_END_ALLOW_THREADS - any = 0; - for (i = 0; i <= mp->ma_mask; i++) { - PyDictEntry *ep = mp->ma_table + i; - PyObject *pvalue = ep->me_value; - if (pvalue != NULL) { - /* Prevent PyObject_Repr from deleting value during - key format */ - Py_INCREF(pvalue); - if (any++ > 0) { - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ", "); - Py_END_ALLOW_THREADS - } - if (PyObject_Print((PyObject *)ep->me_key, fp, 0)!=0) { - Py_DECREF(pvalue); - Py_ReprLeave((PyObject*)mp); - return -1; - } - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ": "); - Py_END_ALLOW_THREADS - if (PyObject_Print(pvalue, fp, 0) != 0) { - Py_DECREF(pvalue); - Py_ReprLeave((PyObject*)mp); - return -1; - } - Py_DECREF(pvalue); - } - } - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "}"); - Py_END_ALLOW_THREADS - Py_ReprLeave((PyObject*)mp); - return 0; -} - -static PyObject * -dict_repr(PyDictObject *mp) -{ - Py_ssize_t i; - PyObject *s, *temp, *colon = NULL; - PyObject *pieces = NULL, *result = NULL; - PyObject *key, *value; - - i = Py_ReprEnter((PyObject *)mp); - if (i != 0) { - return i > 0 ? PyString_FromString("{...}") : NULL; - } - - if (mp->ma_used == 0) { - result = PyString_FromString("{}"); - goto Done; - } - - pieces = PyList_New(0); - if (pieces == NULL) - goto Done; - - colon = PyString_FromString(": "); - if (colon == NULL) - goto Done; - - /* Do repr() on each key+value pair, and insert ": " between them. - Note that repr may mutate the dict. */ - i = 0; - while (PyDict_Next((PyObject *)mp, &i, &key, &value)) { - int status; - /* Prevent repr from deleting value during key format. */ - Py_INCREF(value); - s = PyObject_Repr(key); - PyString_Concat(&s, colon); - PyString_ConcatAndDel(&s, PyObject_Repr(value)); - Py_DECREF(value); - if (s == NULL) - goto Done; - status = PyList_Append(pieces, s); - Py_DECREF(s); /* append created a new ref */ - if (status < 0) - goto Done; - } - - /* Add "{}" decorations to the first and last items. */ - assert(PyList_GET_SIZE(pieces) > 0); - s = PyString_FromString("{"); - if (s == NULL) - goto Done; - temp = PyList_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); - PyList_SET_ITEM(pieces, 0, s); - if (s == NULL) - goto Done; - - s = PyString_FromString("}"); - if (s == NULL) - goto Done; - temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyString_ConcatAndDel(&temp, s); - PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); - if (temp == NULL) - goto Done; - - /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); - if (s == NULL) - goto Done; - result = _PyString_Join(s, pieces); - Py_DECREF(s); - -Done: - Py_XDECREF(pieces); - Py_XDECREF(colon); - Py_ReprLeave((PyObject *)mp); - return result; -} - -static Py_ssize_t -dict_length(PyDictObject *mp) -{ - return mp->ma_used; -} - -static PyObject * -dict_subscript(PyDictObject *mp, register PyObject *key) -{ - PyObject *v; - long hash; - PyDictEntry *ep; - assert(mp->ma_table != NULL); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) - return NULL; - v = ep->me_value; - if (v == NULL) { - if (!PyDict_CheckExact(mp)) { - /* Look up __missing__ method if we're a subclass. */ - PyObject *missing, *res; - static PyObject *missing_str = NULL; - missing = _PyObject_LookupSpecial((PyObject *)mp, - "__missing__", - &missing_str); - if (missing != NULL) { - res = PyObject_CallFunctionObjArgs(missing, - key, NULL); - Py_DECREF(missing); - return res; - } - else if (PyErr_Occurred()) - return NULL; - } - set_key_error(key); - return NULL; - } - else - Py_INCREF(v); - return v; -} - -static int -dict_ass_sub(PyDictObject *mp, PyObject *v, PyObject *w) -{ - if (w == NULL) - return PyDict_DelItem((PyObject *)mp, v); - else - return PyDict_SetItem((PyObject *)mp, v, w); -} - -static PyMappingMethods dict_as_mapping = { - (lenfunc)dict_length, /*mp_length*/ - (binaryfunc)dict_subscript, /*mp_subscript*/ - (objobjargproc)dict_ass_sub, /*mp_ass_subscript*/ -}; - -static PyObject * -dict_keys(register PyDictObject *mp) -{ - register PyObject *v; - register Py_ssize_t i, j; - PyDictEntry *ep; - Py_ssize_t mask, n; - - again: - n = mp->ma_used; - v = PyList_New(n); - if (v == NULL) - return NULL; - if (n != mp->ma_used) { - /* Durnit. The allocations caused the dict to resize. - * Just start over, this shouldn't normally happen. - */ - Py_DECREF(v); - goto again; - } - ep = mp->ma_table; - mask = mp->ma_mask; - for (i = 0, j = 0; i <= mask; i++) { - if (ep[i].me_value != NULL) { - PyObject *key = ep[i].me_key; - Py_INCREF(key); - PyList_SET_ITEM(v, j, key); - j++; - } - } - assert(j == n); - return v; -} - -static PyObject * -dict_values(register PyDictObject *mp) -{ - register PyObject *v; - register Py_ssize_t i, j; - PyDictEntry *ep; - Py_ssize_t mask, n; - - again: - n = mp->ma_used; - v = PyList_New(n); - if (v == NULL) - return NULL; - if (n != mp->ma_used) { - /* Durnit. The allocations caused the dict to resize. - * Just start over, this shouldn't normally happen. - */ - Py_DECREF(v); - goto again; - } - ep = mp->ma_table; - mask = mp->ma_mask; - for (i = 0, j = 0; i <= mask; i++) { - if (ep[i].me_value != NULL) { - PyObject *value = ep[i].me_value; - Py_INCREF(value); - PyList_SET_ITEM(v, j, value); - j++; - } - } - assert(j == n); - return v; -} - -static PyObject * -dict_items(register PyDictObject *mp) -{ - register PyObject *v; - register Py_ssize_t i, j, n; - Py_ssize_t mask; - PyObject *item, *key, *value; - PyDictEntry *ep; - - /* Preallocate the list of tuples, to avoid allocations during - * the loop over the items, which could trigger GC, which - * could resize the dict. :-( - */ - again: - n = mp->ma_used; - v = PyList_New(n); - if (v == NULL) - return NULL; - for (i = 0; i < n; i++) { - item = PyTuple_New(2); - if (item == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SET_ITEM(v, i, item); - } - if (n != mp->ma_used) { - /* Durnit. The allocations caused the dict to resize. - * Just start over, this shouldn't normally happen. - */ - Py_DECREF(v); - goto again; - } - /* Nothing we do below makes any function calls. */ - ep = mp->ma_table; - mask = mp->ma_mask; - for (i = 0, j = 0; i <= mask; i++) { - if ((value=ep[i].me_value) != NULL) { - key = ep[i].me_key; - item = PyList_GET_ITEM(v, j); - Py_INCREF(key); - PyTuple_SET_ITEM(item, 0, key); - Py_INCREF(value); - PyTuple_SET_ITEM(item, 1, value); - j++; - } - } - assert(j == n); - return v; -} - -static PyObject * -dict_fromkeys(PyObject *cls, PyObject *args) -{ - PyObject *seq; - PyObject *value = Py_None; - PyObject *it; /* iter(seq) */ - PyObject *key; - PyObject *d; - int status; - - if (!PyArg_UnpackTuple(args, "fromkeys", 1, 2, &seq, &value)) - return NULL; - - d = PyObject_CallObject(cls, NULL); - if (d == NULL) - return NULL; - - if (PyDict_CheckExact(d) && ((PyDictObject *)d)->ma_used == 0) { - if (PyDict_CheckExact(seq)) { - PyDictObject *mp = (PyDictObject *)d; - PyObject *oldvalue; - Py_ssize_t pos = 0; - PyObject *key; - long hash; - - if (dictresize(mp, Py_SIZE(seq))) { - Py_DECREF(d); - return NULL; - } - - while (_PyDict_Next(seq, &pos, &key, &oldvalue, &hash)) { - Py_INCREF(key); - Py_INCREF(value); - if (insertdict(mp, key, hash, value)) { - Py_DECREF(d); - return NULL; - } - } - return d; - } - if (PyAnySet_CheckExact(seq)) { - PyDictObject *mp = (PyDictObject *)d; - Py_ssize_t pos = 0; - PyObject *key; - long hash; - - if (dictresize(mp, PySet_GET_SIZE(seq))) { - Py_DECREF(d); - return NULL; - } - - while (_PySet_NextEntry(seq, &pos, &key, &hash)) { - Py_INCREF(key); - Py_INCREF(value); - if (insertdict(mp, key, hash, value)) { - Py_DECREF(d); - return NULL; - } - } - return d; - } - } - - it = PyObject_GetIter(seq); - if (it == NULL){ - Py_DECREF(d); - return NULL; - } - - if (PyDict_CheckExact(d)) { - while ((key = PyIter_Next(it)) != NULL) { - status = PyDict_SetItem(d, key, value); - Py_DECREF(key); - if (status < 0) - goto Fail; - } - } else { - while ((key = PyIter_Next(it)) != NULL) { - status = PyObject_SetItem(d, key, value); - Py_DECREF(key); - if (status < 0) - goto Fail; - } - } - - if (PyErr_Occurred()) - goto Fail; - Py_DECREF(it); - return d; - -Fail: - Py_DECREF(it); - Py_DECREF(d); - return NULL; -} - -static int -dict_update_common(PyObject *self, PyObject *args, PyObject *kwds, char *methname) -{ - PyObject *arg = NULL; - int result = 0; - - if (!PyArg_UnpackTuple(args, methname, 0, 1, &arg)) - result = -1; - - else if (arg != NULL) { - if (PyObject_HasAttrString(arg, "keys")) - result = PyDict_Merge(self, arg, 1); - else - result = PyDict_MergeFromSeq2(self, arg, 1); - } - if (result == 0 && kwds != NULL) - result = PyDict_Merge(self, kwds, 1); - return result; -} - -static PyObject * -dict_update(PyObject *self, PyObject *args, PyObject *kwds) -{ - if (dict_update_common(self, args, kwds, "update") != -1) - Py_RETURN_NONE; - return NULL; -} - -/* Update unconditionally replaces existing items. - Merge has a 3rd argument 'override'; if set, it acts like Update, - otherwise it leaves existing items unchanged. - - PyDict_{Update,Merge} update/merge from a mapping object. - - PyDict_MergeFromSeq2 updates/merges from any iterable object - producing iterable objects of length 2. -*/ - -int -PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override) -{ - PyObject *it; /* iter(seq2) */ - Py_ssize_t i; /* index into seq2 of current element */ - PyObject *item; /* seq2[i] */ - PyObject *fast; /* item as a 2-tuple or 2-list */ - - assert(d != NULL); - assert(PyDict_Check(d)); - assert(seq2 != NULL); - - it = PyObject_GetIter(seq2); - if (it == NULL) - return -1; - - for (i = 0; ; ++i) { - PyObject *key, *value; - Py_ssize_t n; - - fast = NULL; - item = PyIter_Next(it); - if (item == NULL) { - if (PyErr_Occurred()) - goto Fail; - break; - } - - /* Convert item to sequence, and verify length 2. */ - fast = PySequence_Fast(item, ""); - if (fast == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, - "cannot convert dictionary update " - "sequence element #%zd to a sequence", - i); - goto Fail; - } - n = PySequence_Fast_GET_SIZE(fast); - if (n != 2) { - PyErr_Format(PyExc_ValueError, - "dictionary update sequence element #%zd " - "has length %zd; 2 is required", - i, n); - goto Fail; - } - - /* Update/merge with this (key, value) pair. */ - key = PySequence_Fast_GET_ITEM(fast, 0); - value = PySequence_Fast_GET_ITEM(fast, 1); - if (override || PyDict_GetItem(d, key) == NULL) { - int status = PyDict_SetItem(d, key, value); - if (status < 0) - goto Fail; - } - Py_DECREF(fast); - Py_DECREF(item); - } - - i = 0; - goto Return; -Fail: - Py_XDECREF(item); - Py_XDECREF(fast); - i = -1; -Return: - Py_DECREF(it); - return Py_SAFE_DOWNCAST(i, Py_ssize_t, int); -} - -int -PyDict_Update(PyObject *a, PyObject *b) -{ - return PyDict_Merge(a, b, 1); -} - -int -PyDict_Merge(PyObject *a, PyObject *b, int override) -{ - register PyDictObject *mp, *other; - register Py_ssize_t i; - PyDictEntry *entry; - - /* We accept for the argument either a concrete dictionary object, - * or an abstract "mapping" object. For the former, we can do - * things quite efficiently. For the latter, we only require that - * PyMapping_Keys() and PyObject_GetItem() be supported. - */ - if (a == NULL || !PyDict_Check(a) || b == NULL) { - PyErr_BadInternalCall(); - return -1; - } - mp = (PyDictObject*)a; - if (PyDict_Check(b)) { - other = (PyDictObject*)b; - if (other == mp || other->ma_used == 0) - /* a.update(a) or a.update({}); nothing to do */ - return 0; - if (mp->ma_used == 0) - /* Since the target dict is empty, PyDict_GetItem() - * always returns NULL. Setting override to 1 - * skips the unnecessary test. - */ - override = 1; - /* Do one big resize at the start, rather than - * incrementally resizing as we insert new items. Expect - * that there will be no (or few) overlapping keys. - */ - if ((mp->ma_fill + other->ma_used)*3 >= (mp->ma_mask+1)*2) { - if (dictresize(mp, (mp->ma_used + other->ma_used)*2) != 0) - return -1; - } - for (i = 0; i <= other->ma_mask; i++) { - entry = &other->ma_table[i]; - if (entry->me_value != NULL && - (override || - PyDict_GetItem(a, entry->me_key) == NULL)) { - Py_INCREF(entry->me_key); - Py_INCREF(entry->me_value); - if (insertdict(mp, entry->me_key, - (long)entry->me_hash, - entry->me_value) != 0) - return -1; - } - } - } - else { - /* Do it the generic, slower way */ - PyObject *keys = PyMapping_Keys(b); - PyObject *iter; - PyObject *key, *value; - int status; - - if (keys == NULL) - /* Docstring says this is equivalent to E.keys() so - * if E doesn't have a .keys() method we want - * AttributeError to percolate up. Might as well - * do the same for any other error. - */ - return -1; - - iter = PyObject_GetIter(keys); - Py_DECREF(keys); - if (iter == NULL) - return -1; - - for (key = PyIter_Next(iter); key; key = PyIter_Next(iter)) { - if (!override && PyDict_GetItem(a, key) != NULL) { - Py_DECREF(key); - continue; - } - value = PyObject_GetItem(b, key); - if (value == NULL) { - Py_DECREF(iter); - Py_DECREF(key); - return -1; - } - status = PyDict_SetItem(a, key, value); - Py_DECREF(key); - Py_DECREF(value); - if (status < 0) { - Py_DECREF(iter); - return -1; - } - } - Py_DECREF(iter); - if (PyErr_Occurred()) - /* Iterator completed, via error */ - return -1; - } - return 0; -} - -static PyObject * -dict_copy(register PyDictObject *mp) -{ - return PyDict_Copy((PyObject*)mp); -} - -PyObject * -PyDict_Copy(PyObject *o) -{ - PyObject *copy; - - if (o == NULL || !PyDict_Check(o)) { - PyErr_BadInternalCall(); - return NULL; - } - copy = PyDict_New(); - if (copy == NULL) - return NULL; - if (PyDict_Merge(copy, o, 1) == 0) - return copy; - Py_DECREF(copy); - return NULL; -} - -Py_ssize_t -PyDict_Size(PyObject *mp) -{ - if (mp == NULL || !PyDict_Check(mp)) { - PyErr_BadInternalCall(); - return -1; - } - return ((PyDictObject *)mp)->ma_used; -} - -PyObject * -PyDict_Keys(PyObject *mp) -{ - if (mp == NULL || !PyDict_Check(mp)) { - PyErr_BadInternalCall(); - return NULL; - } - return dict_keys((PyDictObject *)mp); -} - -PyObject * -PyDict_Values(PyObject *mp) -{ - if (mp == NULL || !PyDict_Check(mp)) { - PyErr_BadInternalCall(); - return NULL; - } - return dict_values((PyDictObject *)mp); -} - -PyObject * -PyDict_Items(PyObject *mp) -{ - if (mp == NULL || !PyDict_Check(mp)) { - PyErr_BadInternalCall(); - return NULL; - } - return dict_items((PyDictObject *)mp); -} - -/* Subroutine which returns the smallest key in a for which b's value - is different or absent. The value is returned too, through the - pval argument. Both are NULL if no key in a is found for which b's status - differs. The refcounts on (and only on) non-NULL *pval and function return - values must be decremented by the caller (characterize() increments them - to ensure that mutating comparison and PyDict_GetItem calls can't delete - them before the caller is done looking at them). */ - -static PyObject * -characterize(PyDictObject *a, PyDictObject *b, PyObject **pval) -{ - PyObject *akey = NULL; /* smallest key in a s.t. a[akey] != b[akey] */ - PyObject *aval = NULL; /* a[akey] */ - Py_ssize_t i; - int cmp; - - for (i = 0; i <= a->ma_mask; i++) { - PyObject *thiskey, *thisaval, *thisbval; - if (a->ma_table[i].me_value == NULL) - continue; - thiskey = a->ma_table[i].me_key; - Py_INCREF(thiskey); /* keep alive across compares */ - if (akey != NULL) { - cmp = PyObject_RichCompareBool(akey, thiskey, Py_LT); - if (cmp < 0) { - Py_DECREF(thiskey); - goto Fail; - } - if (cmp > 0 || - i > a->ma_mask || - a->ma_table[i].me_value == NULL) - { - /* Not the *smallest* a key; or maybe it is - * but the compare shrunk the dict so we can't - * find its associated value anymore; or - * maybe it is but the compare deleted the - * a[thiskey] entry. - */ - Py_DECREF(thiskey); - continue; - } - } - - /* Compare a[thiskey] to b[thiskey]; cmp <- true iff equal. */ - thisaval = a->ma_table[i].me_value; - assert(thisaval); - Py_INCREF(thisaval); /* keep alive */ - thisbval = PyDict_GetItem((PyObject *)b, thiskey); - if (thisbval == NULL) - cmp = 0; - else { - /* both dicts have thiskey: same values? */ - cmp = PyObject_RichCompareBool( - thisaval, thisbval, Py_EQ); - if (cmp < 0) { - Py_DECREF(thiskey); - Py_DECREF(thisaval); - goto Fail; - } - } - if (cmp == 0) { - /* New winner. */ - Py_XDECREF(akey); - Py_XDECREF(aval); - akey = thiskey; - aval = thisaval; - } - else { - Py_DECREF(thiskey); - Py_DECREF(thisaval); - } - } - *pval = aval; - return akey; - -Fail: - Py_XDECREF(akey); - Py_XDECREF(aval); - *pval = NULL; - return NULL; -} - -static int -dict_compare(PyDictObject *a, PyDictObject *b) -{ - PyObject *adiff, *bdiff, *aval, *bval; - int res; - - /* Compare lengths first */ - if (a->ma_used < b->ma_used) - return -1; /* a is shorter */ - else if (a->ma_used > b->ma_used) - return 1; /* b is shorter */ - - /* Same length -- check all keys */ - bdiff = bval = NULL; - adiff = characterize(a, b, &aval); - if (adiff == NULL) { - assert(!aval); - /* Either an error, or a is a subset with the same length so - * must be equal. - */ - res = PyErr_Occurred() ? -1 : 0; - goto Finished; - } - bdiff = characterize(b, a, &bval); - if (bdiff == NULL && PyErr_Occurred()) { - assert(!bval); - res = -1; - goto Finished; - } - res = 0; - if (bdiff) { - /* bdiff == NULL "should be" impossible now, but perhaps - * the last comparison done by the characterize() on a had - * the side effect of making the dicts equal! - */ - res = PyObject_Compare(adiff, bdiff); - } - if (res == 0 && bval != NULL) - res = PyObject_Compare(aval, bval); - -Finished: - Py_XDECREF(adiff); - Py_XDECREF(bdiff); - Py_XDECREF(aval); - Py_XDECREF(bval); - return res; -} - -/* Return 1 if dicts equal, 0 if not, -1 if error. - * Gets out as soon as any difference is detected. - * Uses only Py_EQ comparison. - */ -static int -dict_equal(PyDictObject *a, PyDictObject *b) -{ - Py_ssize_t i; - - if (a->ma_used != b->ma_used) - /* can't be equal if # of entries differ */ - return 0; - - /* Same # of entries -- check all of 'em. Exit early on any diff. */ - for (i = 0; i <= a->ma_mask; i++) { - PyObject *aval = a->ma_table[i].me_value; - if (aval != NULL) { - int cmp; - PyObject *bval; - PyObject *key = a->ma_table[i].me_key; - /* temporarily bump aval's refcount to ensure it stays - alive until we're done with it */ - Py_INCREF(aval); - /* ditto for key */ - Py_INCREF(key); - bval = PyDict_GetItem((PyObject *)b, key); - Py_DECREF(key); - if (bval == NULL) { - Py_DECREF(aval); - return 0; - } - cmp = PyObject_RichCompareBool(aval, bval, Py_EQ); - Py_DECREF(aval); - if (cmp <= 0) /* error or not equal */ - return cmp; - } - } - return 1; - } - -static PyObject * -dict_richcompare(PyObject *v, PyObject *w, int op) -{ - int cmp; - PyObject *res; - - if (!PyDict_Check(v) || !PyDict_Check(w)) { - res = Py_NotImplemented; - } - else if (op == Py_EQ || op == Py_NE) { - cmp = dict_equal((PyDictObject *)v, (PyDictObject *)w); - if (cmp < 0) - return NULL; - res = (cmp == (op == Py_EQ)) ? Py_True : Py_False; - } - else { - /* Py3K warning if comparison isn't == or != */ - if (PyErr_WarnPy3k("dict inequality comparisons not supported " - "in 3.x", 1) < 0) { - return NULL; - } - res = Py_NotImplemented; - } - Py_INCREF(res); - return res; - } - -static PyObject * -dict_contains(register PyDictObject *mp, PyObject *key) -{ - long hash; - PyDictEntry *ep; - - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) - return NULL; - return PyBool_FromLong(ep->me_value != NULL); -} - -static PyObject * -dict_has_key(register PyDictObject *mp, PyObject *key) -{ - if (PyErr_WarnPy3k("dict.has_key() not supported in 3.x; " - "use the in operator", 1) < 0) - return NULL; - return dict_contains(mp, key); -} - -static PyObject * -dict_get(register PyDictObject *mp, PyObject *args) -{ - PyObject *key; - PyObject *failobj = Py_None; - PyObject *val = NULL; - long hash; - PyDictEntry *ep; - - if (!PyArg_UnpackTuple(args, "get", 1, 2, &key, &failobj)) - return NULL; - - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) - return NULL; - val = ep->me_value; - if (val == NULL) - val = failobj; - Py_INCREF(val); - return val; -} - - -static PyObject * -dict_setdefault(register PyDictObject *mp, PyObject *args) -{ - PyObject *key; - PyObject *failobj = Py_None; - PyObject *val = NULL; - long hash; - PyDictEntry *ep; - - if (!PyArg_UnpackTuple(args, "setdefault", 1, 2, &key, &failobj)) - return NULL; - - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) - return NULL; - val = ep->me_value; - if (val == NULL) { - if (dict_set_item_by_hash_or_entry((PyObject*)mp, key, hash, ep, - failobj) == 0) - val = failobj; - } - Py_XINCREF(val); - return val; -} - - -static PyObject * -dict_clear(register PyDictObject *mp) -{ - PyDict_Clear((PyObject *)mp); - Py_RETURN_NONE; -} - -static PyObject * -dict_pop(PyDictObject *mp, PyObject *args) -{ - long hash; - PyDictEntry *ep; - PyObject *old_value, *old_key; - PyObject *key, *deflt = NULL; - - if(!PyArg_UnpackTuple(args, "pop", 1, 2, &key, &deflt)) - return NULL; - if (mp->ma_used == 0) { - if (deflt) { - Py_INCREF(deflt); - return deflt; - } - set_key_error(key); - return NULL; - } - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return NULL; - } - ep = (mp->ma_lookup)(mp, key, hash); - if (ep == NULL) - return NULL; - if (ep->me_value == NULL) { - if (deflt) { - Py_INCREF(deflt); - return deflt; - } - set_key_error(key); - return NULL; - } - old_key = ep->me_key; - Py_INCREF(dummy); - ep->me_key = dummy; - old_value = ep->me_value; - ep->me_value = NULL; - mp->ma_used--; - Py_DECREF(old_key); - return old_value; -} - -static PyObject * -dict_popitem(PyDictObject *mp) -{ - Py_ssize_t i = 0; - PyDictEntry *ep; - PyObject *res; - - /* Allocate the result tuple before checking the size. Believe it - * or not, this allocation could trigger a garbage collection which - * could empty the dict, so if we checked the size first and that - * happened, the result would be an infinite loop (searching for an - * entry that no longer exists). Note that the usual popitem() - * idiom is "while d: k, v = d.popitem()". so needing to throw the - * tuple away if the dict *is* empty isn't a significant - * inefficiency -- possible, but unlikely in practice. - */ - res = PyTuple_New(2); - if (res == NULL) - return NULL; - if (mp->ma_used == 0) { - Py_DECREF(res); - PyErr_SetString(PyExc_KeyError, - "popitem(): dictionary is empty"); - return NULL; - } - /* Set ep to "the first" dict entry with a value. We abuse the hash - * field of slot 0 to hold a search finger: - * If slot 0 has a value, use slot 0. - * Else slot 0 is being used to hold a search finger, - * and we use its hash value as the first index to look. - */ - ep = &mp->ma_table[0]; - if (ep->me_value == NULL) { - i = ep->me_hash; - /* The hash field may be a real hash value, or it may be a - * legit search finger, or it may be a once-legit search - * finger that's out of bounds now because it wrapped around - * or the table shrunk -- simply make sure it's in bounds now. - */ - if (i > mp->ma_mask || i < 1) - i = 1; /* skip slot 0 */ - while ((ep = &mp->ma_table[i])->me_value == NULL) { - i++; - if (i > mp->ma_mask) - i = 1; - } - } - PyTuple_SET_ITEM(res, 0, ep->me_key); - PyTuple_SET_ITEM(res, 1, ep->me_value); - Py_INCREF(dummy); - ep->me_key = dummy; - ep->me_value = NULL; - mp->ma_used--; - assert(mp->ma_table[0].me_value == NULL); - mp->ma_table[0].me_hash = i + 1; /* next place to start */ - return res; -} - -static int -dict_traverse(PyObject *op, visitproc visit, void *arg) -{ - Py_ssize_t i = 0; - PyObject *pk; - PyObject *pv; - - while (PyDict_Next(op, &i, &pk, &pv)) { - Py_VISIT(pk); - Py_VISIT(pv); - } - return 0; -} - -static int -dict_tp_clear(PyObject *op) -{ - PyDict_Clear(op); - return 0; -} - - -extern PyTypeObject PyDictIterKey_Type; /* Forward */ -extern PyTypeObject PyDictIterValue_Type; /* Forward */ -extern PyTypeObject PyDictIterItem_Type; /* Forward */ -static PyObject *dictiter_new(PyDictObject *, PyTypeObject *); - -static PyObject * -dict_iterkeys(PyDictObject *dict) -{ - return dictiter_new(dict, &PyDictIterKey_Type); -} - -static PyObject * -dict_itervalues(PyDictObject *dict) -{ - return dictiter_new(dict, &PyDictIterValue_Type); -} - -static PyObject * -dict_iteritems(PyDictObject *dict) -{ - return dictiter_new(dict, &PyDictIterItem_Type); -} - -static PyObject * -dict_sizeof(PyDictObject *mp) -{ - Py_ssize_t res; - - res = sizeof(PyDictObject); - if (mp->ma_table != mp->ma_smalltable) - res = res + (mp->ma_mask + 1) * sizeof(PyDictEntry); - return PyInt_FromSsize_t(res); -} - -PyDoc_STRVAR(has_key__doc__, -"D.has_key(k) -> True if D has a key k, else False"); - -PyDoc_STRVAR(contains__doc__, -"D.__contains__(k) -> True if D has a key k, else False"); - -PyDoc_STRVAR(getitem__doc__, "x.__getitem__(y) <==> x[y]"); - -PyDoc_STRVAR(sizeof__doc__, -"D.__sizeof__() -> size of D in memory, in bytes"); - -PyDoc_STRVAR(get__doc__, -"D.get(k[,d]) -> D[k] if k in D, else d. d defaults to None."); - -PyDoc_STRVAR(setdefault_doc__, -"D.setdefault(k[,d]) -> D.get(k,d), also set D[k]=d if k not in D"); - -PyDoc_STRVAR(pop__doc__, -"D.pop(k[,d]) -> v, remove specified key and return the corresponding value.\n\ -If key is not found, d is returned if given, otherwise KeyError is raised"); - -PyDoc_STRVAR(popitem__doc__, -"D.popitem() -> (k, v), remove and return some (key, value) pair as a\n\ -2-tuple; but raise KeyError if D is empty."); - -PyDoc_STRVAR(keys__doc__, -"D.keys() -> list of D's keys"); - -PyDoc_STRVAR(items__doc__, -"D.items() -> list of D's (key, value) pairs, as 2-tuples"); - -PyDoc_STRVAR(values__doc__, -"D.values() -> list of D's values"); - -PyDoc_STRVAR(update__doc__, -"D.update([E, ]**F) -> None. Update D from dict/iterable E and F.\n" -"If E present and has a .keys() method, does: for k in E: D[k] = E[k]\n\ -If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v\n\ -In either case, this is followed by: for k in F: D[k] = F[k]"); - -PyDoc_STRVAR(fromkeys__doc__, -"dict.fromkeys(S[,v]) -> New dict with keys from S and values equal to v.\n\ -v defaults to None."); - -PyDoc_STRVAR(clear__doc__, -"D.clear() -> None. Remove all items from D."); - -PyDoc_STRVAR(copy__doc__, -"D.copy() -> a shallow copy of D"); - -PyDoc_STRVAR(iterkeys__doc__, -"D.iterkeys() -> an iterator over the keys of D"); - -PyDoc_STRVAR(itervalues__doc__, -"D.itervalues() -> an iterator over the values of D"); - -PyDoc_STRVAR(iteritems__doc__, -"D.iteritems() -> an iterator over the (key, value) items of D"); - -/* Forward */ -static PyObject *dictkeys_new(PyObject *); -static PyObject *dictitems_new(PyObject *); -static PyObject *dictvalues_new(PyObject *); - -PyDoc_STRVAR(viewkeys__doc__, - "D.viewkeys() -> a set-like object providing a view on D's keys"); -PyDoc_STRVAR(viewitems__doc__, - "D.viewitems() -> a set-like object providing a view on D's items"); -PyDoc_STRVAR(viewvalues__doc__, - "D.viewvalues() -> an object providing a view on D's values"); - -static PyMethodDef mapp_methods[] = { - {"__contains__",(PyCFunction)dict_contains, METH_O | METH_COEXIST, - contains__doc__}, - {"__getitem__", (PyCFunction)dict_subscript, METH_O | METH_COEXIST, - getitem__doc__}, - {"__sizeof__", (PyCFunction)dict_sizeof, METH_NOARGS, - sizeof__doc__}, - {"has_key", (PyCFunction)dict_has_key, METH_O, - has_key__doc__}, - {"get", (PyCFunction)dict_get, METH_VARARGS, - get__doc__}, - {"setdefault", (PyCFunction)dict_setdefault, METH_VARARGS, - setdefault_doc__}, - {"pop", (PyCFunction)dict_pop, METH_VARARGS, - pop__doc__}, - {"popitem", (PyCFunction)dict_popitem, METH_NOARGS, - popitem__doc__}, - {"keys", (PyCFunction)dict_keys, METH_NOARGS, - keys__doc__}, - {"items", (PyCFunction)dict_items, METH_NOARGS, - items__doc__}, - {"values", (PyCFunction)dict_values, METH_NOARGS, - values__doc__}, - {"viewkeys", (PyCFunction)dictkeys_new, METH_NOARGS, - viewkeys__doc__}, - {"viewitems", (PyCFunction)dictitems_new, METH_NOARGS, - viewitems__doc__}, - {"viewvalues", (PyCFunction)dictvalues_new, METH_NOARGS, - viewvalues__doc__}, - {"update", (PyCFunction)dict_update, METH_VARARGS | METH_KEYWORDS, - update__doc__}, - {"fromkeys", (PyCFunction)dict_fromkeys, METH_VARARGS | METH_CLASS, - fromkeys__doc__}, - {"clear", (PyCFunction)dict_clear, METH_NOARGS, - clear__doc__}, - {"copy", (PyCFunction)dict_copy, METH_NOARGS, - copy__doc__}, - {"iterkeys", (PyCFunction)dict_iterkeys, METH_NOARGS, - iterkeys__doc__}, - {"itervalues", (PyCFunction)dict_itervalues, METH_NOARGS, - itervalues__doc__}, - {"iteritems", (PyCFunction)dict_iteritems, METH_NOARGS, - iteritems__doc__}, - {NULL, NULL} /* sentinel */ -}; - -/* Return 1 if `key` is in dict `op`, 0 if not, and -1 on error. */ -int -PyDict_Contains(PyObject *op, PyObject *key) -{ - long hash; - PyDictObject *mp = (PyDictObject *)op; - PyDictEntry *ep; - - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return -1; - } - ep = (mp->ma_lookup)(mp, key, hash); - return ep == NULL ? -1 : (ep->me_value != NULL); -} - -/* Internal version of PyDict_Contains used when the hash value is already known */ -int -_PyDict_Contains(PyObject *op, PyObject *key, long hash) -{ - PyDictObject *mp = (PyDictObject *)op; - PyDictEntry *ep; - - ep = (mp->ma_lookup)(mp, key, hash); - return ep == NULL ? -1 : (ep->me_value != NULL); -} - -/* Hack to implement "key in dict" */ -static PySequenceMethods dict_as_sequence = { - 0, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - PyDict_Contains, /* sq_contains */ - 0, /* sq_inplace_concat */ - 0, /* sq_inplace_repeat */ -}; - -static PyObject * -dict_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *self; - - assert(type != NULL && type->tp_alloc != NULL); - self = type->tp_alloc(type, 0); - if (self != NULL) { - PyDictObject *d = (PyDictObject *)self; - /* It's guaranteed that tp->alloc zeroed out the struct. */ - assert(d->ma_table == NULL && d->ma_fill == 0 && d->ma_used == 0); - INIT_NONZERO_DICT_SLOTS(d); - d->ma_lookup = lookdict_string; - /* The object has been implicitly tracked by tp_alloc */ - if (type == &PyDict_Type) - _PyObject_GC_UNTRACK(d); -#ifdef SHOW_CONVERSION_COUNTS - ++created; -#endif -#ifdef SHOW_TRACK_COUNT - if (_PyObject_GC_IS_TRACKED(d)) - count_tracked++; - else - count_untracked++; -#endif - } - return self; -} - -static int -dict_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - return dict_update_common(self, args, kwds, "dict"); -} - -static PyObject * -dict_iter(PyDictObject *dict) -{ - return dictiter_new(dict, &PyDictIterKey_Type); -} - -PyDoc_STRVAR(dictionary_doc, -"dict() -> new empty dictionary\n" -"dict(mapping) -> new dictionary initialized from a mapping object's\n" -" (key, value) pairs\n" -"dict(iterable) -> new dictionary initialized as if via:\n" -" d = {}\n" -" for k, v in iterable:\n" -" d[k] = v\n" -"dict(**kwargs) -> new dictionary initialized with the name=value pairs\n" -" in the keyword argument list. For example: dict(one=1, two=2)"); - -PyTypeObject PyDict_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dict", - sizeof(PyDictObject), - 0, - (destructor)dict_dealloc, /* tp_dealloc */ - (printfunc)dict_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)dict_compare, /* tp_compare */ - (reprfunc)dict_repr, /* tp_repr */ - 0, /* tp_as_number */ - &dict_as_sequence, /* tp_as_sequence */ - &dict_as_mapping, /* tp_as_mapping */ - (hashfunc)PyObject_HashNotImplemented, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_DICT_SUBCLASS, /* tp_flags */ - dictionary_doc, /* tp_doc */ - dict_traverse, /* tp_traverse */ - dict_tp_clear, /* tp_clear */ - dict_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)dict_iter, /* tp_iter */ - 0, /* tp_iternext */ - mapp_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - dict_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - dict_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* For backward compatibility with old dictionary interface */ - -PyObject * -PyDict_GetItemString(PyObject *v, const char *key) -{ - PyObject *kv, *rv; - kv = PyString_FromString(key); - if (kv == NULL) - return NULL; - rv = PyDict_GetItem(v, kv); - Py_DECREF(kv); - return rv; -} - -int -PyDict_SetItemString(PyObject *v, const char *key, PyObject *item) -{ - PyObject *kv; - int err; - kv = PyString_FromString(key); - if (kv == NULL) - return -1; - PyString_InternInPlace(&kv); /* XXX Should we really? */ - err = PyDict_SetItem(v, kv, item); - Py_DECREF(kv); - return err; -} - -int -PyDict_DelItemString(PyObject *v, const char *key) -{ - PyObject *kv; - int err; - kv = PyString_FromString(key); - if (kv == NULL) - return -1; - err = PyDict_DelItem(v, kv); - Py_DECREF(kv); - return err; -} - -/* Dictionary iterator types */ - -typedef struct { - PyObject_HEAD - PyDictObject *di_dict; /* Set to NULL when iterator is exhausted */ - Py_ssize_t di_used; - Py_ssize_t di_pos; - PyObject* di_result; /* reusable result tuple for iteritems */ - Py_ssize_t len; -} dictiterobject; - -static PyObject * -dictiter_new(PyDictObject *dict, PyTypeObject *itertype) -{ - dictiterobject *di; - di = PyObject_GC_New(dictiterobject, itertype); - if (di == NULL) - return NULL; - Py_INCREF(dict); - di->di_dict = dict; - di->di_used = dict->ma_used; - di->di_pos = 0; - di->len = dict->ma_used; - if (itertype == &PyDictIterItem_Type) { - di->di_result = PyTuple_Pack(2, Py_None, Py_None); - if (di->di_result == NULL) { - Py_DECREF(di); - return NULL; - } - } - else - di->di_result = NULL; - _PyObject_GC_TRACK(di); - return (PyObject *)di; -} - -static void -dictiter_dealloc(dictiterobject *di) -{ - Py_XDECREF(di->di_dict); - Py_XDECREF(di->di_result); - PyObject_GC_Del(di); -} - -static int -dictiter_traverse(dictiterobject *di, visitproc visit, void *arg) -{ - Py_VISIT(di->di_dict); - Py_VISIT(di->di_result); - return 0; -} - -static PyObject * -dictiter_len(dictiterobject *di) -{ - Py_ssize_t len = 0; - if (di->di_dict != NULL && di->di_used == di->di_dict->ma_used) - len = di->len; - return PyInt_FromSize_t(len); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef dictiter_methods[] = { - {"__length_hint__", (PyCFunction)dictiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject *dictiter_iternextkey(dictiterobject *di) -{ - PyObject *key; - register Py_ssize_t i, mask; - register PyDictEntry *ep; - PyDictObject *d = di->di_dict; - - if (d == NULL) - return NULL; - assert (PyDict_Check(d)); - - if (di->di_used != d->ma_used) { - PyErr_SetString(PyExc_RuntimeError, - "dictionary changed size during iteration"); - di->di_used = -1; /* Make this state sticky */ - return NULL; - } - - i = di->di_pos; - if (i < 0) - goto fail; - ep = d->ma_table; - mask = d->ma_mask; - while (i <= mask && ep[i].me_value == NULL) - i++; - di->di_pos = i+1; - if (i > mask) - goto fail; - di->len--; - key = ep[i].me_key; - Py_INCREF(key); - return key; - -fail: - Py_DECREF(d); - di->di_dict = NULL; - return NULL; -} - -PyTypeObject PyDictIterKey_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dictionary-keyiterator", /* tp_name */ - sizeof(dictiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dictiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dictiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dictiter_iternextkey, /* tp_iternext */ - dictiter_methods, /* tp_methods */ - 0, -}; - -static PyObject *dictiter_iternextvalue(dictiterobject *di) -{ - PyObject *value; - register Py_ssize_t i, mask; - register PyDictEntry *ep; - PyDictObject *d = di->di_dict; - - if (d == NULL) - return NULL; - assert (PyDict_Check(d)); - - if (di->di_used != d->ma_used) { - PyErr_SetString(PyExc_RuntimeError, - "dictionary changed size during iteration"); - di->di_used = -1; /* Make this state sticky */ - return NULL; - } - - i = di->di_pos; - mask = d->ma_mask; - if (i < 0 || i > mask) - goto fail; - ep = d->ma_table; - while ((value=ep[i].me_value) == NULL) { - i++; - if (i > mask) - goto fail; - } - di->di_pos = i+1; - di->len--; - Py_INCREF(value); - return value; - -fail: - Py_DECREF(d); - di->di_dict = NULL; - return NULL; -} - -PyTypeObject PyDictIterValue_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dictionary-valueiterator", /* tp_name */ - sizeof(dictiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dictiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dictiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dictiter_iternextvalue, /* tp_iternext */ - dictiter_methods, /* tp_methods */ - 0, -}; - -static PyObject *dictiter_iternextitem(dictiterobject *di) -{ - PyObject *key, *value, *result = di->di_result; - register Py_ssize_t i, mask; - register PyDictEntry *ep; - PyDictObject *d = di->di_dict; - - if (d == NULL) - return NULL; - assert (PyDict_Check(d)); - - if (di->di_used != d->ma_used) { - PyErr_SetString(PyExc_RuntimeError, - "dictionary changed size during iteration"); - di->di_used = -1; /* Make this state sticky */ - return NULL; - } - - i = di->di_pos; - if (i < 0) - goto fail; - ep = d->ma_table; - mask = d->ma_mask; - while (i <= mask && ep[i].me_value == NULL) - i++; - di->di_pos = i+1; - if (i > mask) - goto fail; - - if (result->ob_refcnt == 1) { - Py_INCREF(result); - Py_DECREF(PyTuple_GET_ITEM(result, 0)); - Py_DECREF(PyTuple_GET_ITEM(result, 1)); - } else { - result = PyTuple_New(2); - if (result == NULL) - return NULL; - } - di->len--; - key = ep[i].me_key; - value = ep[i].me_value; - Py_INCREF(key); - Py_INCREF(value); - PyTuple_SET_ITEM(result, 0, key); - PyTuple_SET_ITEM(result, 1, value); - return result; - -fail: - Py_DECREF(d); - di->di_dict = NULL; - return NULL; -} - -PyTypeObject PyDictIterItem_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dictionary-itemiterator", /* tp_name */ - sizeof(dictiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dictiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dictiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)dictiter_iternextitem, /* tp_iternext */ - dictiter_methods, /* tp_methods */ - 0, -}; - -/***********************************************/ -/* View objects for keys(), items(), values(). */ -/***********************************************/ - -/* The instance lay-out is the same for all three; but the type differs. */ - -typedef struct { - PyObject_HEAD - PyDictObject *dv_dict; -} dictviewobject; - - -static void -dictview_dealloc(dictviewobject *dv) -{ - Py_XDECREF(dv->dv_dict); - PyObject_GC_Del(dv); -} - -static int -dictview_traverse(dictviewobject *dv, visitproc visit, void *arg) -{ - Py_VISIT(dv->dv_dict); - return 0; -} - -static Py_ssize_t -dictview_len(dictviewobject *dv) -{ - Py_ssize_t len = 0; - if (dv->dv_dict != NULL) - len = dv->dv_dict->ma_used; - return len; -} - -static PyObject * -dictview_new(PyObject *dict, PyTypeObject *type) -{ - dictviewobject *dv; - if (dict == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - if (!PyDict_Check(dict)) { - /* XXX Get rid of this restriction later */ - PyErr_Format(PyExc_TypeError, - "%s() requires a dict argument, not '%s'", - type->tp_name, dict->ob_type->tp_name); - return NULL; - } - dv = PyObject_GC_New(dictviewobject, type); - if (dv == NULL) - return NULL; - Py_INCREF(dict); - dv->dv_dict = (PyDictObject *)dict; - _PyObject_GC_TRACK(dv); - return (PyObject *)dv; -} - -/* TODO(guido): The views objects are not complete: - - * support more set operations - * support arbitrary mappings? - - either these should be static or exported in dictobject.h - - if public then they should probably be in builtins -*/ - -/* Return 1 if self is a subset of other, iterating over self; - 0 if not; -1 if an error occurred. */ -static int -all_contained_in(PyObject *self, PyObject *other) -{ - PyObject *iter = PyObject_GetIter(self); - int ok = 1; - - if (iter == NULL) - return -1; - for (;;) { - PyObject *next = PyIter_Next(iter); - if (next == NULL) { - if (PyErr_Occurred()) - ok = -1; - break; - } - ok = PySequence_Contains(other, next); - Py_DECREF(next); - if (ok <= 0) - break; - } - Py_DECREF(iter); - return ok; -} - -static PyObject * -dictview_richcompare(PyObject *self, PyObject *other, int op) -{ - Py_ssize_t len_self, len_other; - int ok; - PyObject *result; - - assert(self != NULL); - assert(PyDictViewSet_Check(self)); - assert(other != NULL); - - if (!PyAnySet_Check(other) && !PyDictViewSet_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - len_self = PyObject_Size(self); - if (len_self < 0) - return NULL; - len_other = PyObject_Size(other); - if (len_other < 0) - return NULL; - - ok = 0; - switch(op) { - - case Py_NE: - case Py_EQ: - if (len_self == len_other) - ok = all_contained_in(self, other); - if (op == Py_NE && ok >= 0) - ok = !ok; - break; - - case Py_LT: - if (len_self < len_other) - ok = all_contained_in(self, other); - break; - - case Py_LE: - if (len_self <= len_other) - ok = all_contained_in(self, other); - break; - - case Py_GT: - if (len_self > len_other) - ok = all_contained_in(other, self); - break; - - case Py_GE: - if (len_self >= len_other) - ok = all_contained_in(other, self); - break; - - } - if (ok < 0) - return NULL; - result = ok ? Py_True : Py_False; - Py_INCREF(result); - return result; -} - -static PyObject * -dictview_repr(dictviewobject *dv) -{ - PyObject *seq; - PyObject *seq_str; - PyObject *result; - - seq = PySequence_List((PyObject *)dv); - if (seq == NULL) - return NULL; - - seq_str = PyObject_Repr(seq); - if (seq_str == NULL) { - Py_DECREF(seq); - return NULL; - } - result = PyString_FromFormat("%s(%s)", Py_TYPE(dv)->tp_name, - PyString_AS_STRING(seq_str)); - Py_DECREF(seq_str); - Py_DECREF(seq); - return result; -} - -/*** dict_keys ***/ - -static PyObject * -dictkeys_iter(dictviewobject *dv) -{ - if (dv->dv_dict == NULL) { - Py_RETURN_NONE; - } - return dictiter_new(dv->dv_dict, &PyDictIterKey_Type); -} - -static int -dictkeys_contains(dictviewobject *dv, PyObject *obj) -{ - if (dv->dv_dict == NULL) - return 0; - return PyDict_Contains((PyObject *)dv->dv_dict, obj); -} - -static PySequenceMethods dictkeys_as_sequence = { - (lenfunc)dictview_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)dictkeys_contains, /* sq_contains */ -}; - -static PyObject* -dictviews_sub(PyObject* self, PyObject *other) -{ - PyObject *result = PySet_New(self); - PyObject *tmp; - if (result == NULL) - return NULL; - - tmp = PyObject_CallMethod(result, "difference_update", "O", other); - if (tmp == NULL) { - Py_DECREF(result); - return NULL; - } - - Py_DECREF(tmp); - return result; -} - -static PyObject* -dictviews_and(PyObject* self, PyObject *other) -{ - PyObject *result = PySet_New(self); - PyObject *tmp; - if (result == NULL) - return NULL; - - tmp = PyObject_CallMethod(result, "intersection_update", "O", other); - if (tmp == NULL) { - Py_DECREF(result); - return NULL; - } - - Py_DECREF(tmp); - return result; -} - -static PyObject* -dictviews_or(PyObject* self, PyObject *other) -{ - PyObject *result = PySet_New(self); - PyObject *tmp; - if (result == NULL) - return NULL; - - tmp = PyObject_CallMethod(result, "update", "O", other); - if (tmp == NULL) { - Py_DECREF(result); - return NULL; - } - - Py_DECREF(tmp); - return result; -} - -static PyObject* -dictviews_xor(PyObject* self, PyObject *other) -{ - PyObject *result = PySet_New(self); - PyObject *tmp; - if (result == NULL) - return NULL; - - tmp = PyObject_CallMethod(result, "symmetric_difference_update", "O", - other); - if (tmp == NULL) { - Py_DECREF(result); - return NULL; - } - - Py_DECREF(tmp); - return result; -} - -static PyNumberMethods dictviews_as_number = { - 0, /*nb_add*/ - (binaryfunc)dictviews_sub, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - (binaryfunc)dictviews_and, /*nb_and*/ - (binaryfunc)dictviews_xor, /*nb_xor*/ - (binaryfunc)dictviews_or, /*nb_or*/ -}; - -static PyMethodDef dictkeys_methods[] = { - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyDictKeys_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dict_keys", /* tp_name */ - sizeof(dictviewobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dictview_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)dictview_repr, /* tp_repr */ - &dictviews_as_number, /* tp_as_number */ - &dictkeys_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_CHECKTYPES, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dictview_traverse, /* tp_traverse */ - 0, /* tp_clear */ - dictview_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)dictkeys_iter, /* tp_iter */ - 0, /* tp_iternext */ - dictkeys_methods, /* tp_methods */ - 0, -}; - -static PyObject * -dictkeys_new(PyObject *dict) -{ - return dictview_new(dict, &PyDictKeys_Type); -} - -/*** dict_items ***/ - -static PyObject * -dictitems_iter(dictviewobject *dv) -{ - if (dv->dv_dict == NULL) { - Py_RETURN_NONE; - } - return dictiter_new(dv->dv_dict, &PyDictIterItem_Type); -} - -static int -dictitems_contains(dictviewobject *dv, PyObject *obj) -{ - PyObject *key, *value, *found; - if (dv->dv_dict == NULL) - return 0; - if (!PyTuple_Check(obj) || PyTuple_GET_SIZE(obj) != 2) - return 0; - key = PyTuple_GET_ITEM(obj, 0); - value = PyTuple_GET_ITEM(obj, 1); - found = PyDict_GetItem((PyObject *)dv->dv_dict, key); - if (found == NULL) { - if (PyErr_Occurred()) - return -1; - return 0; - } - return PyObject_RichCompareBool(value, found, Py_EQ); -} - -static PySequenceMethods dictitems_as_sequence = { - (lenfunc)dictview_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)dictitems_contains, /* sq_contains */ -}; - -static PyMethodDef dictitems_methods[] = { - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyDictItems_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dict_items", /* tp_name */ - sizeof(dictviewobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dictview_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)dictview_repr, /* tp_repr */ - &dictviews_as_number, /* tp_as_number */ - &dictitems_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_CHECKTYPES, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dictview_traverse, /* tp_traverse */ - 0, /* tp_clear */ - dictview_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)dictitems_iter, /* tp_iter */ - 0, /* tp_iternext */ - dictitems_methods, /* tp_methods */ - 0, -}; - -static PyObject * -dictitems_new(PyObject *dict) -{ - return dictview_new(dict, &PyDictItems_Type); -} - -/*** dict_values ***/ - -static PyObject * -dictvalues_iter(dictviewobject *dv) -{ - if (dv->dv_dict == NULL) { - Py_RETURN_NONE; - } - return dictiter_new(dv->dv_dict, &PyDictIterValue_Type); -} - -static PySequenceMethods dictvalues_as_sequence = { - (lenfunc)dictview_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)0, /* sq_contains */ -}; - -static PyMethodDef dictvalues_methods[] = { - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyDictValues_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "dict_values", /* tp_name */ - sizeof(dictviewobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)dictview_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - (reprfunc)dictview_repr, /* tp_repr */ - 0, /* tp_as_number */ - &dictvalues_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)dictview_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)dictvalues_iter, /* tp_iter */ - 0, /* tp_iternext */ - dictvalues_methods, /* tp_methods */ - 0, -}; - -static PyObject * -dictvalues_new(PyObject *dict) -{ - return dictview_new(dict, &PyDictValues_Type); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/enumobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/enumobject.c deleted file mode 100644 index 9b6de23..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/enumobject.c +++ /dev/null @@ -1,381 +0,0 @@ -/* enumerate object */ - -#include "Python.h" - -typedef struct { - PyObject_HEAD - Py_ssize_t en_index; /* current index of enumeration */ - PyObject* en_sit; /* secondary iterator of enumeration */ - PyObject* en_result; /* result tuple */ - PyObject* en_longindex; /* index for sequences >= PY_SSIZE_T_MAX */ -} enumobject; - -static PyObject * -enum_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - enumobject *en; - PyObject *seq = NULL; - PyObject *start = NULL; - static char *kwlist[] = {"sequence", "start", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:enumerate", kwlist, - &seq, &start)) - return NULL; - - en = (enumobject *)type->tp_alloc(type, 0); - if (en == NULL) - return NULL; - if (start != NULL) { - start = PyNumber_Index(start); - if (start == NULL) { - Py_DECREF(en); - return NULL; - } - assert(PyInt_Check(start) || PyLong_Check(start)); - en->en_index = PyInt_AsSsize_t(start); - if (en->en_index == -1 && PyErr_Occurred()) { - PyErr_Clear(); - en->en_index = PY_SSIZE_T_MAX; - en->en_longindex = start; - } else { - en->en_longindex = NULL; - Py_DECREF(start); - } - } else { - en->en_index = 0; - en->en_longindex = NULL; - } - en->en_sit = PyObject_GetIter(seq); - if (en->en_sit == NULL) { - Py_DECREF(en); - return NULL; - } - en->en_result = PyTuple_Pack(2, Py_None, Py_None); - if (en->en_result == NULL) { - Py_DECREF(en); - return NULL; - } - return (PyObject *)en; -} - -static void -enum_dealloc(enumobject *en) -{ - PyObject_GC_UnTrack(en); - Py_XDECREF(en->en_sit); - Py_XDECREF(en->en_result); - Py_XDECREF(en->en_longindex); - Py_TYPE(en)->tp_free(en); -} - -static int -enum_traverse(enumobject *en, visitproc visit, void *arg) -{ - Py_VISIT(en->en_sit); - Py_VISIT(en->en_result); - Py_VISIT(en->en_longindex); - return 0; -} - -static PyObject * -enum_next_long(enumobject *en, PyObject* next_item) -{ - static PyObject *one = NULL; - PyObject *result = en->en_result; - PyObject *next_index; - PyObject *stepped_up; - - if (en->en_longindex == NULL) { - en->en_longindex = PyInt_FromSsize_t(PY_SSIZE_T_MAX); - if (en->en_longindex == NULL) - return NULL; - } - if (one == NULL) { - one = PyInt_FromLong(1); - if (one == NULL) - return NULL; - } - next_index = en->en_longindex; - assert(next_index != NULL); - stepped_up = PyNumber_Add(next_index, one); - if (stepped_up == NULL) - return NULL; - en->en_longindex = stepped_up; - - if (result->ob_refcnt == 1) { - Py_INCREF(result); - Py_DECREF(PyTuple_GET_ITEM(result, 0)); - Py_DECREF(PyTuple_GET_ITEM(result, 1)); - } else { - result = PyTuple_New(2); - if (result == NULL) { - Py_DECREF(next_index); - Py_DECREF(next_item); - return NULL; - } - } - PyTuple_SET_ITEM(result, 0, next_index); - PyTuple_SET_ITEM(result, 1, next_item); - return result; -} - -static PyObject * -enum_next(enumobject *en) -{ - PyObject *next_index; - PyObject *next_item; - PyObject *result = en->en_result; - PyObject *it = en->en_sit; - - next_item = (*Py_TYPE(it)->tp_iternext)(it); - if (next_item == NULL) - return NULL; - - if (en->en_index == PY_SSIZE_T_MAX) - return enum_next_long(en, next_item); - - next_index = PyInt_FromSsize_t(en->en_index); - if (next_index == NULL) { - Py_DECREF(next_item); - return NULL; - } - en->en_index++; - - if (result->ob_refcnt == 1) { - Py_INCREF(result); - Py_DECREF(PyTuple_GET_ITEM(result, 0)); - Py_DECREF(PyTuple_GET_ITEM(result, 1)); - } else { - result = PyTuple_New(2); - if (result == NULL) { - Py_DECREF(next_index); - Py_DECREF(next_item); - return NULL; - } - } - PyTuple_SET_ITEM(result, 0, next_index); - PyTuple_SET_ITEM(result, 1, next_item); - return result; -} - -PyDoc_STRVAR(enum_doc, -"enumerate(iterable[, start]) -> iterator for index, value of iterable\n" -"\n" -"Return an enumerate object. iterable must be another object that supports\n" -"iteration. The enumerate object yields pairs containing a count (from\n" -"start, which defaults to zero) and a value yielded by the iterable argument.\n" -"enumerate is useful for obtaining an indexed list:\n" -" (0, seq[0]), (1, seq[1]), (2, seq[2]), ..."); - -PyTypeObject PyEnum_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "enumerate", /* tp_name */ - sizeof(enumobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)enum_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - enum_doc, /* tp_doc */ - (traverseproc)enum_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)enum_next, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - enum_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* Reversed Object ***************************************************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t index; - PyObject* seq; -} reversedobject; - -static PyObject * -reversed_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - Py_ssize_t n; - PyObject *seq, *reversed_meth; - static PyObject *reversed_cache = NULL; - reversedobject *ro; - - if (type == &PyReversed_Type && !_PyArg_NoKeywords("reversed()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, "reversed", 1, 1, &seq) ) - return NULL; - - if (PyInstance_Check(seq)) { - reversed_meth = PyObject_GetAttrString(seq, "__reversed__"); - if (reversed_meth == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - } - } - else { - reversed_meth = _PyObject_LookupSpecial(seq, "__reversed__", - &reversed_cache); - if (reversed_meth == NULL && PyErr_Occurred()) - return NULL; - } - if (reversed_meth != NULL) { - PyObject *res = PyObject_CallFunctionObjArgs(reversed_meth, NULL); - Py_DECREF(reversed_meth); - return res; - } - - if (!PySequence_Check(seq)) { - PyErr_SetString(PyExc_TypeError, - "argument to reversed() must be a sequence"); - return NULL; - } - - n = PySequence_Size(seq); - if (n == -1) - return NULL; - - ro = (reversedobject *)type->tp_alloc(type, 0); - if (ro == NULL) - return NULL; - - ro->index = n-1; - Py_INCREF(seq); - ro->seq = seq; - return (PyObject *)ro; -} - -static void -reversed_dealloc(reversedobject *ro) -{ - PyObject_GC_UnTrack(ro); - Py_XDECREF(ro->seq); - Py_TYPE(ro)->tp_free(ro); -} - -static int -reversed_traverse(reversedobject *ro, visitproc visit, void *arg) -{ - Py_VISIT(ro->seq); - return 0; -} - -static PyObject * -reversed_next(reversedobject *ro) -{ - PyObject *item; - Py_ssize_t index = ro->index; - - if (index >= 0) { - item = PySequence_GetItem(ro->seq, index); - if (item != NULL) { - ro->index--; - return item; - } - if (PyErr_ExceptionMatches(PyExc_IndexError) || - PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - } - ro->index = -1; - Py_CLEAR(ro->seq); - return NULL; -} - -PyDoc_STRVAR(reversed_doc, -"reversed(sequence) -> reverse iterator over values of the sequence\n" -"\n" -"Return a reverse iterator"); - -static PyObject * -reversed_len(reversedobject *ro) -{ - Py_ssize_t position, seqsize; - - if (ro->seq == NULL) - return PyInt_FromLong(0); - seqsize = PySequence_Size(ro->seq); - if (seqsize == -1) - return NULL; - position = ro->index + 1; - return PyInt_FromSsize_t((seqsize < position) ? 0 : position); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef reversediter_methods[] = { - {"__length_hint__", (PyCFunction)reversed_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyReversed_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "reversed", /* tp_name */ - sizeof(reversedobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)reversed_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - reversed_doc, /* tp_doc */ - (traverseproc)reversed_traverse,/* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)reversed_next, /* tp_iternext */ - reversediter_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - reversed_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/exceptions.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/exceptions.c deleted file mode 100644 index d637fe3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/exceptions.c +++ /dev/null @@ -1,2231 +0,0 @@ -/* - * New exceptions.c written in Iceland by Richard Jones and Georg Brandl. - * - * Thanks go to Tim Peters and Michael Hudson for debugging. - */ - -#define PY_SSIZE_T_CLEAN -#include -#include "structmember.h" -#include "osdefs.h" - -#define EXC_MODULE_NAME "exceptions." - -/* NOTE: If the exception class hierarchy changes, don't forget to update - * Lib/test/exception_hierarchy.txt - */ - -PyDoc_STRVAR(exceptions_doc, "Python's standard exception class hierarchy.\n\ -\n\ -Exceptions found here are defined both in the exceptions module and the\n\ -built-in namespace. It is recommended that user-defined exceptions\n\ -inherit from Exception. See the documentation for the exception\n\ -inheritance hierarchy.\n\ -"); - -/* - * BaseException - */ -static PyObject * -BaseException_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyBaseExceptionObject *self; - - self = (PyBaseExceptionObject *)type->tp_alloc(type, 0); - if (!self) - return NULL; - /* the dict is created on the fly in PyObject_GenericSetAttr */ - self->message = self->dict = NULL; - - self->args = PyTuple_New(0); - if (!self->args) { - Py_DECREF(self); - return NULL; - } - - self->message = PyString_FromString(""); - if (!self->message) { - Py_DECREF(self); - return NULL; - } - - return (PyObject *)self; -} - -static int -BaseException_init(PyBaseExceptionObject *self, PyObject *args, PyObject *kwds) -{ - if (!_PyArg_NoKeywords(Py_TYPE(self)->tp_name, kwds)) - return -1; - - Py_DECREF(self->args); - self->args = args; - Py_INCREF(self->args); - - if (PyTuple_GET_SIZE(self->args) == 1) { - Py_CLEAR(self->message); - self->message = PyTuple_GET_ITEM(self->args, 0); - Py_INCREF(self->message); - } - return 0; -} - -static int -BaseException_clear(PyBaseExceptionObject *self) -{ - Py_CLEAR(self->dict); - Py_CLEAR(self->args); - Py_CLEAR(self->message); - return 0; -} - -static void -BaseException_dealloc(PyBaseExceptionObject *self) -{ - _PyObject_GC_UNTRACK(self); - BaseException_clear(self); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -BaseException_traverse(PyBaseExceptionObject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->dict); - Py_VISIT(self->args); - Py_VISIT(self->message); - return 0; -} - -static PyObject * -BaseException_str(PyBaseExceptionObject *self) -{ - PyObject *out; - - switch (PyTuple_GET_SIZE(self->args)) { - case 0: - out = PyString_FromString(""); - break; - case 1: - out = PyObject_Str(PyTuple_GET_ITEM(self->args, 0)); - break; - default: - out = PyObject_Str(self->args); - break; - } - - return out; -} - -#ifdef Py_USING_UNICODE -static PyObject * -BaseException_unicode(PyBaseExceptionObject *self) -{ - PyObject *out; - - /* issue6108: if __str__ has been overridden in the subclass, unicode() - should return the message returned by __str__ as used to happen - before this method was implemented. */ - if (Py_TYPE(self)->tp_str != (reprfunc)BaseException_str) { - PyObject *str; - /* Unlike PyObject_Str, tp_str can return unicode (i.e. return the - equivalent of unicode(e.__str__()) instead of unicode(str(e))). */ - str = Py_TYPE(self)->tp_str((PyObject*)self); - if (str == NULL) - return NULL; - out = PyObject_Unicode(str); - Py_DECREF(str); - return out; - } - - switch (PyTuple_GET_SIZE(self->args)) { - case 0: - out = PyUnicode_FromString(""); - break; - case 1: - out = PyObject_Unicode(PyTuple_GET_ITEM(self->args, 0)); - break; - default: - out = PyObject_Unicode(self->args); - break; - } - - return out; -} -#endif - -static PyObject * -BaseException_repr(PyBaseExceptionObject *self) -{ - PyObject *repr_suffix; - PyObject *repr; - char *name; - char *dot; - - repr_suffix = PyObject_Repr(self->args); - if (!repr_suffix) - return NULL; - - name = (char *)Py_TYPE(self)->tp_name; - dot = strrchr(name, '.'); - if (dot != NULL) name = dot+1; - - repr = PyString_FromString(name); - if (!repr) { - Py_DECREF(repr_suffix); - return NULL; - } - - PyString_ConcatAndDel(&repr, repr_suffix); - return repr; -} - -/* Pickling support */ -static PyObject * -BaseException_reduce(PyBaseExceptionObject *self) -{ - if (self->args && self->dict) - return PyTuple_Pack(3, Py_TYPE(self), self->args, self->dict); - else - return PyTuple_Pack(2, Py_TYPE(self), self->args); -} - -/* - * Needed for backward compatibility, since exceptions used to store - * all their attributes in the __dict__. Code is taken from cPickle's - * load_build function. - */ -static PyObject * -BaseException_setstate(PyObject *self, PyObject *state) -{ - PyObject *d_key, *d_value; - Py_ssize_t i = 0; - - if (state != Py_None) { - if (!PyDict_Check(state)) { - PyErr_SetString(PyExc_TypeError, "state is not a dictionary"); - return NULL; - } - while (PyDict_Next(state, &i, &d_key, &d_value)) { - if (PyObject_SetAttr(self, d_key, d_value) < 0) - return NULL; - } - } - Py_RETURN_NONE; -} - - -static PyMethodDef BaseException_methods[] = { - {"__reduce__", (PyCFunction)BaseException_reduce, METH_NOARGS }, - {"__setstate__", (PyCFunction)BaseException_setstate, METH_O }, -#ifdef Py_USING_UNICODE - {"__unicode__", (PyCFunction)BaseException_unicode, METH_NOARGS }, -#endif - {NULL, NULL, 0, NULL}, -}; - - - -static PyObject * -BaseException_getitem(PyBaseExceptionObject *self, Py_ssize_t index) -{ - if (PyErr_WarnPy3k("__getitem__ not supported for exception " - "classes in 3.x; use args attribute", 1) < 0) - return NULL; - return PySequence_GetItem(self->args, index); -} - -static PyObject * -BaseException_getslice(PyBaseExceptionObject *self, - Py_ssize_t start, Py_ssize_t stop) -{ - if (PyErr_WarnPy3k("__getslice__ not supported for exception " - "classes in 3.x; use args attribute", 1) < 0) - return NULL; - return PySequence_GetSlice(self->args, start, stop); -} - -static PySequenceMethods BaseException_as_sequence = { - 0, /* sq_length; */ - 0, /* sq_concat; */ - 0, /* sq_repeat; */ - (ssizeargfunc)BaseException_getitem, /* sq_item; */ - (ssizessizeargfunc)BaseException_getslice, /* sq_slice; */ - 0, /* sq_ass_item; */ - 0, /* sq_ass_slice; */ - 0, /* sq_contains; */ - 0, /* sq_inplace_concat; */ - 0 /* sq_inplace_repeat; */ -}; - -static PyObject * -BaseException_get_dict(PyBaseExceptionObject *self) -{ - if (self->dict == NULL) { - self->dict = PyDict_New(); - if (!self->dict) - return NULL; - } - Py_INCREF(self->dict); - return self->dict; -} - -static int -BaseException_set_dict(PyBaseExceptionObject *self, PyObject *val) -{ - if (val == NULL) { - PyErr_SetString(PyExc_TypeError, "__dict__ may not be deleted"); - return -1; - } - if (!PyDict_Check(val)) { - PyErr_SetString(PyExc_TypeError, "__dict__ must be a dictionary"); - return -1; - } - Py_CLEAR(self->dict); - Py_INCREF(val); - self->dict = val; - return 0; -} - -static PyObject * -BaseException_get_args(PyBaseExceptionObject *self) -{ - if (self->args == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - Py_INCREF(self->args); - return self->args; -} - -static int -BaseException_set_args(PyBaseExceptionObject *self, PyObject *val) -{ - PyObject *seq; - if (val == NULL) { - PyErr_SetString(PyExc_TypeError, "args may not be deleted"); - return -1; - } - seq = PySequence_Tuple(val); - if (!seq) - return -1; - Py_CLEAR(self->args); - self->args = seq; - return 0; -} - -static PyObject * -BaseException_get_message(PyBaseExceptionObject *self) -{ - PyObject *msg; - - /* if "message" is in self->dict, accessing a user-set message attribute */ - if (self->dict && - (msg = PyDict_GetItemString(self->dict, "message"))) { - Py_INCREF(msg); - return msg; - } - - if (self->message == NULL) { - PyErr_SetString(PyExc_AttributeError, "message attribute was deleted"); - return NULL; - } - - /* accessing the deprecated "builtin" message attribute of Exception */ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "BaseException.message has been deprecated as " - "of Python 2.6", 1) < 0) - return NULL; - - Py_INCREF(self->message); - return self->message; -} - -static int -BaseException_set_message(PyBaseExceptionObject *self, PyObject *val) -{ - /* if val is NULL, delete the message attribute */ - if (val == NULL) { - if (self->dict && PyDict_GetItemString(self->dict, "message")) { - if (PyDict_DelItemString(self->dict, "message") < 0) - return -1; - } - Py_CLEAR(self->message); - return 0; - } - - /* else set it in __dict__, but may need to create the dict first */ - if (self->dict == NULL) { - self->dict = PyDict_New(); - if (!self->dict) - return -1; - } - return PyDict_SetItemString(self->dict, "message", val); -} - -static PyGetSetDef BaseException_getset[] = { - {"__dict__", (getter)BaseException_get_dict, (setter)BaseException_set_dict}, - {"args", (getter)BaseException_get_args, (setter)BaseException_set_args}, - {"message", (getter)BaseException_get_message, - (setter)BaseException_set_message}, - {NULL}, -}; - - -static PyTypeObject _PyExc_BaseException = { - PyObject_HEAD_INIT(NULL) - 0, /*ob_size*/ - EXC_MODULE_NAME "BaseException", /*tp_name*/ - sizeof(PyBaseExceptionObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - (destructor)BaseException_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /* tp_compare; */ - (reprfunc)BaseException_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - &BaseException_as_sequence, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - (reprfunc)BaseException_str, /*tp_str*/ - PyObject_GenericGetAttr, /*tp_getattro*/ - PyObject_GenericSetAttr, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASE_EXC_SUBCLASS, /*tp_flags*/ - PyDoc_STR("Common base class for all exceptions"), /* tp_doc */ - (traverseproc)BaseException_traverse, /* tp_traverse */ - (inquiry)BaseException_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - BaseException_methods, /* tp_methods */ - 0, /* tp_members */ - BaseException_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(PyBaseExceptionObject, dict), /* tp_dictoffset */ - (initproc)BaseException_init, /* tp_init */ - 0, /* tp_alloc */ - BaseException_new, /* tp_new */ -}; -/* the CPython API expects exceptions to be (PyObject *) - both a hold-over -from the previous implmentation and also allowing Python objects to be used -in the API */ -PyObject *PyExc_BaseException = (PyObject *)&_PyExc_BaseException; - -/* note these macros omit the last semicolon so the macro invocation may - * include it and not look strange. - */ -#define SimpleExtendsException(EXCBASE, EXCNAME, EXCDOC) \ -static PyTypeObject _PyExc_ ## EXCNAME = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ - EXC_MODULE_NAME # EXCNAME, \ - sizeof(PyBaseExceptionObject), \ - 0, (destructor)BaseException_dealloc, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, 0, 0, \ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, \ - PyDoc_STR(EXCDOC), (traverseproc)BaseException_traverse, \ - (inquiry)BaseException_clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \ - 0, 0, 0, offsetof(PyBaseExceptionObject, dict), \ - (initproc)BaseException_init, 0, BaseException_new,\ -}; \ -PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME - -#define MiddlingExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDOC) \ -static PyTypeObject _PyExc_ ## EXCNAME = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ - EXC_MODULE_NAME # EXCNAME, \ - sizeof(Py ## EXCSTORE ## Object), \ - 0, (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - 0, 0, 0, 0, 0, \ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, \ - PyDoc_STR(EXCDOC), (traverseproc)EXCSTORE ## _traverse, \ - (inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, 0, 0, 0, &_ ## EXCBASE, \ - 0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \ - (initproc)EXCSTORE ## _init, 0, BaseException_new,\ -}; \ -PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME - -#define ComplexExtendsException(EXCBASE, EXCNAME, EXCSTORE, EXCDEALLOC, EXCMETHODS, EXCMEMBERS, EXCSTR, EXCDOC) \ -static PyTypeObject _PyExc_ ## EXCNAME = { \ - PyObject_HEAD_INIT(NULL) \ - 0, \ - EXC_MODULE_NAME # EXCNAME, \ - sizeof(Py ## EXCSTORE ## Object), 0, \ - (destructor)EXCSTORE ## _dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ - (reprfunc)EXCSTR, 0, 0, 0, \ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, \ - PyDoc_STR(EXCDOC), (traverseproc)EXCSTORE ## _traverse, \ - (inquiry)EXCSTORE ## _clear, 0, 0, 0, 0, EXCMETHODS, \ - EXCMEMBERS, 0, &_ ## EXCBASE, \ - 0, 0, 0, offsetof(Py ## EXCSTORE ## Object, dict), \ - (initproc)EXCSTORE ## _init, 0, BaseException_new,\ -}; \ -PyObject *PyExc_ ## EXCNAME = (PyObject *)&_PyExc_ ## EXCNAME - - -/* - * Exception extends BaseException - */ -SimpleExtendsException(PyExc_BaseException, Exception, - "Common base class for all non-exit exceptions."); - - -/* - * StandardError extends Exception - */ -SimpleExtendsException(PyExc_Exception, StandardError, - "Base class for all standard Python exceptions that do not represent\n" - "interpreter exiting."); - - -/* - * TypeError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, TypeError, - "Inappropriate argument type."); - - -/* - * StopIteration extends Exception - */ -SimpleExtendsException(PyExc_Exception, StopIteration, - "Signal the end from iterator.next()."); - - -/* - * GeneratorExit extends BaseException - */ -SimpleExtendsException(PyExc_BaseException, GeneratorExit, - "Request that a generator exit."); - - -/* - * SystemExit extends BaseException - */ - -static int -SystemExit_init(PySystemExitObject *self, PyObject *args, PyObject *kwds) -{ - Py_ssize_t size = PyTuple_GET_SIZE(args); - - if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) - return -1; - - if (size == 0) - return 0; - Py_CLEAR(self->code); - if (size == 1) - self->code = PyTuple_GET_ITEM(args, 0); - else if (size > 1) - self->code = args; - Py_INCREF(self->code); - return 0; -} - -static int -SystemExit_clear(PySystemExitObject *self) -{ - Py_CLEAR(self->code); - return BaseException_clear((PyBaseExceptionObject *)self); -} - -static void -SystemExit_dealloc(PySystemExitObject *self) -{ - _PyObject_GC_UNTRACK(self); - SystemExit_clear(self); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -SystemExit_traverse(PySystemExitObject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->code); - return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); -} - -static PyMemberDef SystemExit_members[] = { - {"code", T_OBJECT, offsetof(PySystemExitObject, code), 0, - PyDoc_STR("exception code")}, - {NULL} /* Sentinel */ -}; - -ComplexExtendsException(PyExc_BaseException, SystemExit, SystemExit, - SystemExit_dealloc, 0, SystemExit_members, 0, - "Request to exit from the interpreter."); - -/* - * KeyboardInterrupt extends BaseException - */ -SimpleExtendsException(PyExc_BaseException, KeyboardInterrupt, - "Program interrupted by user."); - - -/* - * ImportError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, ImportError, - "Import can't find module, or can't find name in module."); - - -/* - * EnvironmentError extends StandardError - */ - -/* Where a function has a single filename, such as open() or some - * of the os module functions, PyErr_SetFromErrnoWithFilename() is - * called, giving a third argument which is the filename. But, so - * that old code using in-place unpacking doesn't break, e.g.: - * - * except IOError, (errno, strerror): - * - * we hack args so that it only contains two items. This also - * means we need our own __str__() which prints out the filename - * when it was supplied. - */ -static int -EnvironmentError_init(PyEnvironmentErrorObject *self, PyObject *args, - PyObject *kwds) -{ - PyObject *myerrno = NULL, *strerror = NULL, *filename = NULL; - PyObject *subslice = NULL; - - if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) - return -1; - - if (PyTuple_GET_SIZE(args) <= 1 || PyTuple_GET_SIZE(args) > 3) { - return 0; - } - - if (!PyArg_UnpackTuple(args, "EnvironmentError", 2, 3, - &myerrno, &strerror, &filename)) { - return -1; - } - Py_CLEAR(self->myerrno); /* replacing */ - self->myerrno = myerrno; - Py_INCREF(self->myerrno); - - Py_CLEAR(self->strerror); /* replacing */ - self->strerror = strerror; - Py_INCREF(self->strerror); - - /* self->filename will remain Py_None otherwise */ - if (filename != NULL) { - Py_CLEAR(self->filename); /* replacing */ - self->filename = filename; - Py_INCREF(self->filename); - - subslice = PyTuple_GetSlice(args, 0, 2); - if (!subslice) - return -1; - - Py_DECREF(self->args); /* replacing args */ - self->args = subslice; - } - return 0; -} - -static int -EnvironmentError_clear(PyEnvironmentErrorObject *self) -{ - Py_CLEAR(self->myerrno); - Py_CLEAR(self->strerror); - Py_CLEAR(self->filename); - return BaseException_clear((PyBaseExceptionObject *)self); -} - -static void -EnvironmentError_dealloc(PyEnvironmentErrorObject *self) -{ - _PyObject_GC_UNTRACK(self); - EnvironmentError_clear(self); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -EnvironmentError_traverse(PyEnvironmentErrorObject *self, visitproc visit, - void *arg) -{ - Py_VISIT(self->myerrno); - Py_VISIT(self->strerror); - Py_VISIT(self->filename); - return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); -} - -static PyObject * -EnvironmentError_str(PyEnvironmentErrorObject *self) -{ - PyObject *rtnval = NULL; - - if (self->filename) { - PyObject *fmt; - PyObject *repr; - PyObject *tuple; - - fmt = PyString_FromString("[Errno %s] %s: %s"); - if (!fmt) - return NULL; - - repr = PyObject_Repr(self->filename); - if (!repr) { - Py_DECREF(fmt); - return NULL; - } - tuple = PyTuple_New(3); - if (!tuple) { - Py_DECREF(repr); - Py_DECREF(fmt); - return NULL; - } - - if (self->myerrno) { - Py_INCREF(self->myerrno); - PyTuple_SET_ITEM(tuple, 0, self->myerrno); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 0, Py_None); - } - if (self->strerror) { - Py_INCREF(self->strerror); - PyTuple_SET_ITEM(tuple, 1, self->strerror); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 1, Py_None); - } - - PyTuple_SET_ITEM(tuple, 2, repr); - - rtnval = PyString_Format(fmt, tuple); - - Py_DECREF(fmt); - Py_DECREF(tuple); - } - else if (self->myerrno && self->strerror) { - PyObject *fmt; - PyObject *tuple; - - fmt = PyString_FromString("[Errno %s] %s"); - if (!fmt) - return NULL; - - tuple = PyTuple_New(2); - if (!tuple) { - Py_DECREF(fmt); - return NULL; - } - - if (self->myerrno) { - Py_INCREF(self->myerrno); - PyTuple_SET_ITEM(tuple, 0, self->myerrno); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 0, Py_None); - } - if (self->strerror) { - Py_INCREF(self->strerror); - PyTuple_SET_ITEM(tuple, 1, self->strerror); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 1, Py_None); - } - - rtnval = PyString_Format(fmt, tuple); - - Py_DECREF(fmt); - Py_DECREF(tuple); - } - else - rtnval = BaseException_str((PyBaseExceptionObject *)self); - - return rtnval; -} - -static PyMemberDef EnvironmentError_members[] = { - {"errno", T_OBJECT, offsetof(PyEnvironmentErrorObject, myerrno), 0, - PyDoc_STR("exception errno")}, - {"strerror", T_OBJECT, offsetof(PyEnvironmentErrorObject, strerror), 0, - PyDoc_STR("exception strerror")}, - {"filename", T_OBJECT, offsetof(PyEnvironmentErrorObject, filename), 0, - PyDoc_STR("exception filename")}, - {NULL} /* Sentinel */ -}; - - -static PyObject * -EnvironmentError_reduce(PyEnvironmentErrorObject *self) -{ - PyObject *args = self->args; - PyObject *res = NULL, *tmp; - - /* self->args is only the first two real arguments if there was a - * file name given to EnvironmentError. */ - if (PyTuple_GET_SIZE(args) == 2 && self->filename) { - args = PyTuple_New(3); - if (!args) - return NULL; - - tmp = PyTuple_GET_ITEM(self->args, 0); - Py_INCREF(tmp); - PyTuple_SET_ITEM(args, 0, tmp); - - tmp = PyTuple_GET_ITEM(self->args, 1); - Py_INCREF(tmp); - PyTuple_SET_ITEM(args, 1, tmp); - - Py_INCREF(self->filename); - PyTuple_SET_ITEM(args, 2, self->filename); - } else - Py_INCREF(args); - - if (self->dict) - res = PyTuple_Pack(3, Py_TYPE(self), args, self->dict); - else - res = PyTuple_Pack(2, Py_TYPE(self), args); - Py_DECREF(args); - return res; -} - - -static PyMethodDef EnvironmentError_methods[] = { - {"__reduce__", (PyCFunction)EnvironmentError_reduce, METH_NOARGS}, - {NULL} -}; - -ComplexExtendsException(PyExc_StandardError, EnvironmentError, - EnvironmentError, EnvironmentError_dealloc, - EnvironmentError_methods, EnvironmentError_members, - EnvironmentError_str, - "Base class for I/O related errors."); - - -/* - * IOError extends EnvironmentError - */ -MiddlingExtendsException(PyExc_EnvironmentError, IOError, - EnvironmentError, "I/O operation failed."); - - -/* - * OSError extends EnvironmentError - */ -MiddlingExtendsException(PyExc_EnvironmentError, OSError, - EnvironmentError, "OS system call failed."); - - -/* - * WindowsError extends OSError - */ -#ifdef MS_WINDOWS -#include "errmap.h" - -static int -WindowsError_clear(PyWindowsErrorObject *self) -{ - Py_CLEAR(self->myerrno); - Py_CLEAR(self->strerror); - Py_CLEAR(self->filename); - Py_CLEAR(self->winerror); - return BaseException_clear((PyBaseExceptionObject *)self); -} - -static void -WindowsError_dealloc(PyWindowsErrorObject *self) -{ - _PyObject_GC_UNTRACK(self); - WindowsError_clear(self); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -WindowsError_traverse(PyWindowsErrorObject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->myerrno); - Py_VISIT(self->strerror); - Py_VISIT(self->filename); - Py_VISIT(self->winerror); - return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); -} - -static int -WindowsError_init(PyWindowsErrorObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *o_errcode = NULL; - long errcode; - long posix_errno; - - if (EnvironmentError_init((PyEnvironmentErrorObject *)self, args, kwds) - == -1) - return -1; - - if (self->myerrno == NULL) - return 0; - - /* Set errno to the POSIX errno, and winerror to the Win32 - error code. */ - errcode = PyInt_AsLong(self->myerrno); - if (errcode == -1 && PyErr_Occurred()) - return -1; - posix_errno = winerror_to_errno(errcode); - - Py_CLEAR(self->winerror); - self->winerror = self->myerrno; - - o_errcode = PyInt_FromLong(posix_errno); - if (!o_errcode) - return -1; - - self->myerrno = o_errcode; - - return 0; -} - - -static PyObject * -WindowsError_str(PyWindowsErrorObject *self) -{ - PyObject *rtnval = NULL; - - if (self->filename) { - PyObject *fmt; - PyObject *repr; - PyObject *tuple; - - fmt = PyString_FromString("[Error %s] %s: %s"); - if (!fmt) - return NULL; - - repr = PyObject_Repr(self->filename); - if (!repr) { - Py_DECREF(fmt); - return NULL; - } - tuple = PyTuple_New(3); - if (!tuple) { - Py_DECREF(repr); - Py_DECREF(fmt); - return NULL; - } - - if (self->winerror) { - Py_INCREF(self->winerror); - PyTuple_SET_ITEM(tuple, 0, self->winerror); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 0, Py_None); - } - if (self->strerror) { - Py_INCREF(self->strerror); - PyTuple_SET_ITEM(tuple, 1, self->strerror); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 1, Py_None); - } - - PyTuple_SET_ITEM(tuple, 2, repr); - - rtnval = PyString_Format(fmt, tuple); - - Py_DECREF(fmt); - Py_DECREF(tuple); - } - else if (self->winerror && self->strerror) { - PyObject *fmt; - PyObject *tuple; - - fmt = PyString_FromString("[Error %s] %s"); - if (!fmt) - return NULL; - - tuple = PyTuple_New(2); - if (!tuple) { - Py_DECREF(fmt); - return NULL; - } - - if (self->winerror) { - Py_INCREF(self->winerror); - PyTuple_SET_ITEM(tuple, 0, self->winerror); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 0, Py_None); - } - if (self->strerror) { - Py_INCREF(self->strerror); - PyTuple_SET_ITEM(tuple, 1, self->strerror); - } - else { - Py_INCREF(Py_None); - PyTuple_SET_ITEM(tuple, 1, Py_None); - } - - rtnval = PyString_Format(fmt, tuple); - - Py_DECREF(fmt); - Py_DECREF(tuple); - } - else - rtnval = EnvironmentError_str((PyEnvironmentErrorObject *)self); - - return rtnval; -} - -static PyMemberDef WindowsError_members[] = { - {"errno", T_OBJECT, offsetof(PyWindowsErrorObject, myerrno), 0, - PyDoc_STR("POSIX exception code")}, - {"strerror", T_OBJECT, offsetof(PyWindowsErrorObject, strerror), 0, - PyDoc_STR("exception strerror")}, - {"filename", T_OBJECT, offsetof(PyWindowsErrorObject, filename), 0, - PyDoc_STR("exception filename")}, - {"winerror", T_OBJECT, offsetof(PyWindowsErrorObject, winerror), 0, - PyDoc_STR("Win32 exception code")}, - {NULL} /* Sentinel */ -}; - -ComplexExtendsException(PyExc_OSError, WindowsError, WindowsError, - WindowsError_dealloc, 0, WindowsError_members, - WindowsError_str, "MS-Windows OS system call failed."); - -#endif /* MS_WINDOWS */ - - -/* - * VMSError extends OSError (I think) - */ -#ifdef __VMS -MiddlingExtendsException(PyExc_OSError, VMSError, EnvironmentError, - "OpenVMS OS system call failed."); -#endif - - -/* - * EOFError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, EOFError, - "Read beyond end of file."); - - -/* - * RuntimeError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, RuntimeError, - "Unspecified run-time error."); - - -/* - * NotImplementedError extends RuntimeError - */ -SimpleExtendsException(PyExc_RuntimeError, NotImplementedError, - "Method or function hasn't been implemented yet."); - -/* - * NameError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, NameError, - "Name not found globally."); - -/* - * UnboundLocalError extends NameError - */ -SimpleExtendsException(PyExc_NameError, UnboundLocalError, - "Local name referenced but not bound to a value."); - -/* - * AttributeError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, AttributeError, - "Attribute not found."); - - -/* - * SyntaxError extends StandardError - */ - -static int -SyntaxError_init(PySyntaxErrorObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *info = NULL; - Py_ssize_t lenargs = PyTuple_GET_SIZE(args); - - if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) - return -1; - - if (lenargs >= 1) { - Py_CLEAR(self->msg); - self->msg = PyTuple_GET_ITEM(args, 0); - Py_INCREF(self->msg); - } - if (lenargs == 2) { - info = PyTuple_GET_ITEM(args, 1); - info = PySequence_Tuple(info); - if (!info) - return -1; - - if (PyTuple_GET_SIZE(info) != 4) { - /* not a very good error message, but it's what Python 2.4 gives */ - PyErr_SetString(PyExc_IndexError, "tuple index out of range"); - Py_DECREF(info); - return -1; - } - - Py_CLEAR(self->filename); - self->filename = PyTuple_GET_ITEM(info, 0); - Py_INCREF(self->filename); - - Py_CLEAR(self->lineno); - self->lineno = PyTuple_GET_ITEM(info, 1); - Py_INCREF(self->lineno); - - Py_CLEAR(self->offset); - self->offset = PyTuple_GET_ITEM(info, 2); - Py_INCREF(self->offset); - - Py_CLEAR(self->text); - self->text = PyTuple_GET_ITEM(info, 3); - Py_INCREF(self->text); - - Py_DECREF(info); - } - return 0; -} - -static int -SyntaxError_clear(PySyntaxErrorObject *self) -{ - Py_CLEAR(self->msg); - Py_CLEAR(self->filename); - Py_CLEAR(self->lineno); - Py_CLEAR(self->offset); - Py_CLEAR(self->text); - Py_CLEAR(self->print_file_and_line); - return BaseException_clear((PyBaseExceptionObject *)self); -} - -static void -SyntaxError_dealloc(PySyntaxErrorObject *self) -{ - _PyObject_GC_UNTRACK(self); - SyntaxError_clear(self); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -SyntaxError_traverse(PySyntaxErrorObject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->msg); - Py_VISIT(self->filename); - Py_VISIT(self->lineno); - Py_VISIT(self->offset); - Py_VISIT(self->text); - Py_VISIT(self->print_file_and_line); - return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); -} - -/* This is called "my_basename" instead of just "basename" to avoid name - conflicts with glibc; basename is already prototyped if _GNU_SOURCE is - defined, and Python does define that. */ -static char * -my_basename(char *name) -{ - char *cp = name; - char *result = name; - - if (name == NULL) - return "???"; - while (*cp != '\0') { - if (*cp == SEP) - result = cp + 1; - ++cp; - } - return result; -} - - -static PyObject * -SyntaxError_str(PySyntaxErrorObject *self) -{ - PyObject *str; - PyObject *result; - int have_filename = 0; - int have_lineno = 0; - char *buffer = NULL; - Py_ssize_t bufsize; - - if (self->msg) - str = PyObject_Str(self->msg); - else - str = PyObject_Str(Py_None); - if (!str) - return NULL; - /* Don't fiddle with non-string return (shouldn't happen anyway) */ - if (!PyString_Check(str)) - return str; - - /* XXX -- do all the additional formatting with filename and - lineno here */ - - have_filename = (self->filename != NULL) && - PyString_Check(self->filename); - have_lineno = (self->lineno != NULL) && PyInt_Check(self->lineno); - - if (!have_filename && !have_lineno) - return str; - - bufsize = PyString_GET_SIZE(str) + 64; - if (have_filename) - bufsize += PyString_GET_SIZE(self->filename); - - buffer = PyMem_MALLOC(bufsize); - if (buffer == NULL) - return str; - - if (have_filename && have_lineno) - PyOS_snprintf(buffer, bufsize, "%s (%s, line %ld)", - PyString_AS_STRING(str), - my_basename(PyString_AS_STRING(self->filename)), - PyInt_AsLong(self->lineno)); - else if (have_filename) - PyOS_snprintf(buffer, bufsize, "%s (%s)", - PyString_AS_STRING(str), - my_basename(PyString_AS_STRING(self->filename))); - else /* only have_lineno */ - PyOS_snprintf(buffer, bufsize, "%s (line %ld)", - PyString_AS_STRING(str), - PyInt_AsLong(self->lineno)); - - result = PyString_FromString(buffer); - PyMem_FREE(buffer); - - if (result == NULL) - result = str; - else - Py_DECREF(str); - return result; -} - -static PyMemberDef SyntaxError_members[] = { - {"msg", T_OBJECT, offsetof(PySyntaxErrorObject, msg), 0, - PyDoc_STR("exception msg")}, - {"filename", T_OBJECT, offsetof(PySyntaxErrorObject, filename), 0, - PyDoc_STR("exception filename")}, - {"lineno", T_OBJECT, offsetof(PySyntaxErrorObject, lineno), 0, - PyDoc_STR("exception lineno")}, - {"offset", T_OBJECT, offsetof(PySyntaxErrorObject, offset), 0, - PyDoc_STR("exception offset")}, - {"text", T_OBJECT, offsetof(PySyntaxErrorObject, text), 0, - PyDoc_STR("exception text")}, - {"print_file_and_line", T_OBJECT, - offsetof(PySyntaxErrorObject, print_file_and_line), 0, - PyDoc_STR("exception print_file_and_line")}, - {NULL} /* Sentinel */ -}; - -ComplexExtendsException(PyExc_StandardError, SyntaxError, SyntaxError, - SyntaxError_dealloc, 0, SyntaxError_members, - SyntaxError_str, "Invalid syntax."); - - -/* - * IndentationError extends SyntaxError - */ -MiddlingExtendsException(PyExc_SyntaxError, IndentationError, SyntaxError, - "Improper indentation."); - - -/* - * TabError extends IndentationError - */ -MiddlingExtendsException(PyExc_IndentationError, TabError, SyntaxError, - "Improper mixture of spaces and tabs."); - - -/* - * LookupError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, LookupError, - "Base class for lookup errors."); - - -/* - * IndexError extends LookupError - */ -SimpleExtendsException(PyExc_LookupError, IndexError, - "Sequence index out of range."); - - -/* - * KeyError extends LookupError - */ -static PyObject * -KeyError_str(PyBaseExceptionObject *self) -{ - /* If args is a tuple of exactly one item, apply repr to args[0]. - This is done so that e.g. the exception raised by {}[''] prints - KeyError: '' - rather than the confusing - KeyError - alone. The downside is that if KeyError is raised with an explanatory - string, that string will be displayed in quotes. Too bad. - If args is anything else, use the default BaseException__str__(). - */ - if (PyTuple_GET_SIZE(self->args) == 1) { - return PyObject_Repr(PyTuple_GET_ITEM(self->args, 0)); - } - return BaseException_str(self); -} - -ComplexExtendsException(PyExc_LookupError, KeyError, BaseException, - 0, 0, 0, KeyError_str, "Mapping key not found."); - - -/* - * ValueError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, ValueError, - "Inappropriate argument value (of correct type)."); - -/* - * UnicodeError extends ValueError - */ - -SimpleExtendsException(PyExc_ValueError, UnicodeError, - "Unicode related error."); - -#ifdef Py_USING_UNICODE -static PyObject * -get_string(PyObject *attr, const char *name) -{ - if (!attr) { - PyErr_Format(PyExc_TypeError, "%.200s attribute not set", name); - return NULL; - } - - if (!PyString_Check(attr)) { - PyErr_Format(PyExc_TypeError, "%.200s attribute must be str", name); - return NULL; - } - Py_INCREF(attr); - return attr; -} - - -static int -set_string(PyObject **attr, const char *value) -{ - PyObject *obj = PyString_FromString(value); - if (!obj) - return -1; - Py_CLEAR(*attr); - *attr = obj; - return 0; -} - - -static PyObject * -get_unicode(PyObject *attr, const char *name) -{ - if (!attr) { - PyErr_Format(PyExc_TypeError, "%.200s attribute not set", name); - return NULL; - } - - if (!PyUnicode_Check(attr)) { - PyErr_Format(PyExc_TypeError, - "%.200s attribute must be unicode", name); - return NULL; - } - Py_INCREF(attr); - return attr; -} - -PyObject * -PyUnicodeEncodeError_GetEncoding(PyObject *exc) -{ - return get_string(((PyUnicodeErrorObject *)exc)->encoding, "encoding"); -} - -PyObject * -PyUnicodeDecodeError_GetEncoding(PyObject *exc) -{ - return get_string(((PyUnicodeErrorObject *)exc)->encoding, "encoding"); -} - -PyObject * -PyUnicodeEncodeError_GetObject(PyObject *exc) -{ - return get_unicode(((PyUnicodeErrorObject *)exc)->object, "object"); -} - -PyObject * -PyUnicodeDecodeError_GetObject(PyObject *exc) -{ - return get_string(((PyUnicodeErrorObject *)exc)->object, "object"); -} - -PyObject * -PyUnicodeTranslateError_GetObject(PyObject *exc) -{ - return get_unicode(((PyUnicodeErrorObject *)exc)->object, "object"); -} - -int -PyUnicodeEncodeError_GetStart(PyObject *exc, Py_ssize_t *start) -{ - Py_ssize_t size; - PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) - return -1; - *start = ((PyUnicodeErrorObject *)exc)->start; - size = PyUnicode_GET_SIZE(obj); - if (*start<0) - *start = 0; /*XXX check for values <0*/ - if (*start>=size) - *start = size-1; - Py_DECREF(obj); - return 0; -} - - -int -PyUnicodeDecodeError_GetStart(PyObject *exc, Py_ssize_t *start) -{ - Py_ssize_t size; - PyObject *obj = get_string(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) - return -1; - size = PyString_GET_SIZE(obj); - *start = ((PyUnicodeErrorObject *)exc)->start; - if (*start<0) - *start = 0; - if (*start>=size) - *start = size-1; - Py_DECREF(obj); - return 0; -} - - -int -PyUnicodeTranslateError_GetStart(PyObject *exc, Py_ssize_t *start) -{ - return PyUnicodeEncodeError_GetStart(exc, start); -} - - -int -PyUnicodeEncodeError_SetStart(PyObject *exc, Py_ssize_t start) -{ - ((PyUnicodeErrorObject *)exc)->start = start; - return 0; -} - - -int -PyUnicodeDecodeError_SetStart(PyObject *exc, Py_ssize_t start) -{ - ((PyUnicodeErrorObject *)exc)->start = start; - return 0; -} - - -int -PyUnicodeTranslateError_SetStart(PyObject *exc, Py_ssize_t start) -{ - ((PyUnicodeErrorObject *)exc)->start = start; - return 0; -} - - -int -PyUnicodeEncodeError_GetEnd(PyObject *exc, Py_ssize_t *end) -{ - Py_ssize_t size; - PyObject *obj = get_unicode(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) - return -1; - *end = ((PyUnicodeErrorObject *)exc)->end; - size = PyUnicode_GET_SIZE(obj); - if (*end<1) - *end = 1; - if (*end>size) - *end = size; - Py_DECREF(obj); - return 0; -} - - -int -PyUnicodeDecodeError_GetEnd(PyObject *exc, Py_ssize_t *end) -{ - Py_ssize_t size; - PyObject *obj = get_string(((PyUnicodeErrorObject *)exc)->object, - "object"); - if (!obj) - return -1; - *end = ((PyUnicodeErrorObject *)exc)->end; - size = PyString_GET_SIZE(obj); - if (*end<1) - *end = 1; - if (*end>size) - *end = size; - Py_DECREF(obj); - return 0; -} - - -int -PyUnicodeTranslateError_GetEnd(PyObject *exc, Py_ssize_t *start) -{ - return PyUnicodeEncodeError_GetEnd(exc, start); -} - - -int -PyUnicodeEncodeError_SetEnd(PyObject *exc, Py_ssize_t end) -{ - ((PyUnicodeErrorObject *)exc)->end = end; - return 0; -} - - -int -PyUnicodeDecodeError_SetEnd(PyObject *exc, Py_ssize_t end) -{ - ((PyUnicodeErrorObject *)exc)->end = end; - return 0; -} - - -int -PyUnicodeTranslateError_SetEnd(PyObject *exc, Py_ssize_t end) -{ - ((PyUnicodeErrorObject *)exc)->end = end; - return 0; -} - -PyObject * -PyUnicodeEncodeError_GetReason(PyObject *exc) -{ - return get_string(((PyUnicodeErrorObject *)exc)->reason, "reason"); -} - - -PyObject * -PyUnicodeDecodeError_GetReason(PyObject *exc) -{ - return get_string(((PyUnicodeErrorObject *)exc)->reason, "reason"); -} - - -PyObject * -PyUnicodeTranslateError_GetReason(PyObject *exc) -{ - return get_string(((PyUnicodeErrorObject *)exc)->reason, "reason"); -} - - -int -PyUnicodeEncodeError_SetReason(PyObject *exc, const char *reason) -{ - return set_string(&((PyUnicodeErrorObject *)exc)->reason, reason); -} - - -int -PyUnicodeDecodeError_SetReason(PyObject *exc, const char *reason) -{ - return set_string(&((PyUnicodeErrorObject *)exc)->reason, reason); -} - - -int -PyUnicodeTranslateError_SetReason(PyObject *exc, const char *reason) -{ - return set_string(&((PyUnicodeErrorObject *)exc)->reason, reason); -} - - -static int -UnicodeError_init(PyUnicodeErrorObject *self, PyObject *args, PyObject *kwds, - PyTypeObject *objecttype) -{ - Py_CLEAR(self->encoding); - Py_CLEAR(self->object); - Py_CLEAR(self->reason); - - if (!PyArg_ParseTuple(args, "O!O!nnO!", - &PyString_Type, &self->encoding, - objecttype, &self->object, - &self->start, - &self->end, - &PyString_Type, &self->reason)) { - self->encoding = self->object = self->reason = NULL; - return -1; - } - - Py_INCREF(self->encoding); - Py_INCREF(self->object); - Py_INCREF(self->reason); - - return 0; -} - -static int -UnicodeError_clear(PyUnicodeErrorObject *self) -{ - Py_CLEAR(self->encoding); - Py_CLEAR(self->object); - Py_CLEAR(self->reason); - return BaseException_clear((PyBaseExceptionObject *)self); -} - -static void -UnicodeError_dealloc(PyUnicodeErrorObject *self) -{ - _PyObject_GC_UNTRACK(self); - UnicodeError_clear(self); - Py_TYPE(self)->tp_free((PyObject *)self); -} - -static int -UnicodeError_traverse(PyUnicodeErrorObject *self, visitproc visit, void *arg) -{ - Py_VISIT(self->encoding); - Py_VISIT(self->object); - Py_VISIT(self->reason); - return BaseException_traverse((PyBaseExceptionObject *)self, visit, arg); -} - -static PyMemberDef UnicodeError_members[] = { - {"encoding", T_OBJECT, offsetof(PyUnicodeErrorObject, encoding), 0, - PyDoc_STR("exception encoding")}, - {"object", T_OBJECT, offsetof(PyUnicodeErrorObject, object), 0, - PyDoc_STR("exception object")}, - {"start", T_PYSSIZET, offsetof(PyUnicodeErrorObject, start), 0, - PyDoc_STR("exception start")}, - {"end", T_PYSSIZET, offsetof(PyUnicodeErrorObject, end), 0, - PyDoc_STR("exception end")}, - {"reason", T_OBJECT, offsetof(PyUnicodeErrorObject, reason), 0, - PyDoc_STR("exception reason")}, - {NULL} /* Sentinel */ -}; - - -/* - * UnicodeEncodeError extends UnicodeError - */ - -static int -UnicodeEncodeError_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) - return -1; - return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyUnicode_Type); -} - -static PyObject * -UnicodeEncodeError_str(PyObject *self) -{ - PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; - PyObject *result = NULL; - PyObject *reason_str = NULL; - PyObject *encoding_str = NULL; - - if (!uself->object) - /* Not properly initialized. */ - return PyUnicode_FromString(""); - - /* Get reason and encoding as strings, which they might not be if - they've been modified after we were contructed. */ - reason_str = PyObject_Str(uself->reason); - if (reason_str == NULL) - goto done; - encoding_str = PyObject_Str(uself->encoding); - if (encoding_str == NULL) - goto done; - - if (uself->start < PyUnicode_GET_SIZE(uself->object) && uself->end == uself->start+1) { - int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start]; - char badchar_str[20]; - if (badchar <= 0xff) - PyOS_snprintf(badchar_str, sizeof(badchar_str), "x%02x", badchar); - else if (badchar <= 0xffff) - PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); - else - PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - result = PyString_FromFormat( - "'%.400s' codec can't encode character u'\\%s' in position %zd: %.400s", - PyString_AS_STRING(encoding_str), - badchar_str, - uself->start, - PyString_AS_STRING(reason_str)); - } - else { - result = PyString_FromFormat( - "'%.400s' codec can't encode characters in position %zd-%zd: %.400s", - PyString_AS_STRING(encoding_str), - uself->start, - uself->end-1, - PyString_AS_STRING(reason_str)); - } -done: - Py_XDECREF(reason_str); - Py_XDECREF(encoding_str); - return result; -} - -static PyTypeObject _PyExc_UnicodeEncodeError = { - PyObject_HEAD_INIT(NULL) - 0, - EXC_MODULE_NAME "UnicodeEncodeError", - sizeof(PyUnicodeErrorObject), 0, - (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - (reprfunc)UnicodeEncodeError_str, 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - PyDoc_STR("Unicode encoding error."), (traverseproc)UnicodeError_traverse, - (inquiry)UnicodeError_clear, 0, 0, 0, 0, 0, UnicodeError_members, - 0, &_PyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict), - (initproc)UnicodeEncodeError_init, 0, BaseException_new, -}; -PyObject *PyExc_UnicodeEncodeError = (PyObject *)&_PyExc_UnicodeEncodeError; - -PyObject * -PyUnicodeEncodeError_Create( - const char *encoding, const Py_UNICODE *object, Py_ssize_t length, - Py_ssize_t start, Py_ssize_t end, const char *reason) -{ - return PyObject_CallFunction(PyExc_UnicodeEncodeError, "su#nns", - encoding, object, length, start, end, reason); -} - - -/* - * UnicodeDecodeError extends UnicodeError - */ - -static int -UnicodeDecodeError_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) - return -1; - return UnicodeError_init((PyUnicodeErrorObject *)self, args, - kwds, &PyString_Type); -} - -static PyObject * -UnicodeDecodeError_str(PyObject *self) -{ - PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; - PyObject *result = NULL; - PyObject *reason_str = NULL; - PyObject *encoding_str = NULL; - - if (!uself->object) - /* Not properly initialized. */ - return PyUnicode_FromString(""); - - /* Get reason and encoding as strings, which they might not be if - they've been modified after we were contructed. */ - reason_str = PyObject_Str(uself->reason); - if (reason_str == NULL) - goto done; - encoding_str = PyObject_Str(uself->encoding); - if (encoding_str == NULL) - goto done; - - if (uself->start < PyUnicode_GET_SIZE(uself->object) && uself->end == uself->start+1) { - /* FromFormat does not support %02x, so format that separately */ - char byte[4]; - PyOS_snprintf(byte, sizeof(byte), "%02x", - ((int)PyString_AS_STRING(uself->object)[uself->start])&0xff); - result = PyString_FromFormat( - "'%.400s' codec can't decode byte 0x%s in position %zd: %.400s", - PyString_AS_STRING(encoding_str), - byte, - uself->start, - PyString_AS_STRING(reason_str)); - } - else { - result = PyString_FromFormat( - "'%.400s' codec can't decode bytes in position %zd-%zd: %.400s", - PyString_AS_STRING(encoding_str), - uself->start, - uself->end-1, - PyString_AS_STRING(reason_str)); - } -done: - Py_XDECREF(reason_str); - Py_XDECREF(encoding_str); - return result; -} - -static PyTypeObject _PyExc_UnicodeDecodeError = { - PyObject_HEAD_INIT(NULL) - 0, - EXC_MODULE_NAME "UnicodeDecodeError", - sizeof(PyUnicodeErrorObject), 0, - (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - (reprfunc)UnicodeDecodeError_str, 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - PyDoc_STR("Unicode decoding error."), (traverseproc)UnicodeError_traverse, - (inquiry)UnicodeError_clear, 0, 0, 0, 0, 0, UnicodeError_members, - 0, &_PyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict), - (initproc)UnicodeDecodeError_init, 0, BaseException_new, -}; -PyObject *PyExc_UnicodeDecodeError = (PyObject *)&_PyExc_UnicodeDecodeError; - -PyObject * -PyUnicodeDecodeError_Create( - const char *encoding, const char *object, Py_ssize_t length, - Py_ssize_t start, Py_ssize_t end, const char *reason) -{ - return PyObject_CallFunction(PyExc_UnicodeDecodeError, "ss#nns", - encoding, object, length, start, end, reason); -} - - -/* - * UnicodeTranslateError extends UnicodeError - */ - -static int -UnicodeTranslateError_init(PyUnicodeErrorObject *self, PyObject *args, - PyObject *kwds) -{ - if (BaseException_init((PyBaseExceptionObject *)self, args, kwds) == -1) - return -1; - - Py_CLEAR(self->object); - Py_CLEAR(self->reason); - - if (!PyArg_ParseTuple(args, "O!nnO!", - &PyUnicode_Type, &self->object, - &self->start, - &self->end, - &PyString_Type, &self->reason)) { - self->object = self->reason = NULL; - return -1; - } - - Py_INCREF(self->object); - Py_INCREF(self->reason); - - return 0; -} - - -static PyObject * -UnicodeTranslateError_str(PyObject *self) -{ - PyUnicodeErrorObject *uself = (PyUnicodeErrorObject *)self; - PyObject *result = NULL; - PyObject *reason_str = NULL; - - if (!uself->object) - /* Not properly initialized. */ - return PyUnicode_FromString(""); - - /* Get reason as a string, which it might not be if it's been - modified after we were contructed. */ - reason_str = PyObject_Str(uself->reason); - if (reason_str == NULL) - goto done; - - if (uself->start < PyUnicode_GET_SIZE(uself->object) && uself->end == uself->start+1) { - int badchar = (int)PyUnicode_AS_UNICODE(uself->object)[uself->start]; - char badchar_str[20]; - if (badchar <= 0xff) - PyOS_snprintf(badchar_str, sizeof(badchar_str), "x%02x", badchar); - else if (badchar <= 0xffff) - PyOS_snprintf(badchar_str, sizeof(badchar_str), "u%04x", badchar); - else - PyOS_snprintf(badchar_str, sizeof(badchar_str), "U%08x", badchar); - result = PyString_FromFormat( - "can't translate character u'\\%s' in position %zd: %.400s", - badchar_str, - uself->start, - PyString_AS_STRING(reason_str)); - } else { - result = PyString_FromFormat( - "can't translate characters in position %zd-%zd: %.400s", - uself->start, - uself->end-1, - PyString_AS_STRING(reason_str)); - } -done: - Py_XDECREF(reason_str); - return result; -} - -static PyTypeObject _PyExc_UnicodeTranslateError = { - PyObject_HEAD_INIT(NULL) - 0, - EXC_MODULE_NAME "UnicodeTranslateError", - sizeof(PyUnicodeErrorObject), 0, - (destructor)UnicodeError_dealloc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - (reprfunc)UnicodeTranslateError_str, 0, 0, 0, - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - PyDoc_STR("Unicode translation error."), (traverseproc)UnicodeError_traverse, - (inquiry)UnicodeError_clear, 0, 0, 0, 0, 0, UnicodeError_members, - 0, &_PyExc_UnicodeError, 0, 0, 0, offsetof(PyUnicodeErrorObject, dict), - (initproc)UnicodeTranslateError_init, 0, BaseException_new, -}; -PyObject *PyExc_UnicodeTranslateError = (PyObject *)&_PyExc_UnicodeTranslateError; - -PyObject * -PyUnicodeTranslateError_Create( - const Py_UNICODE *object, Py_ssize_t length, - Py_ssize_t start, Py_ssize_t end, const char *reason) -{ - return PyObject_CallFunction(PyExc_UnicodeTranslateError, "u#nns", - object, length, start, end, reason); -} -#endif - - -/* - * AssertionError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, AssertionError, - "Assertion failed."); - - -/* - * ArithmeticError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, ArithmeticError, - "Base class for arithmetic errors."); - - -/* - * FloatingPointError extends ArithmeticError - */ -SimpleExtendsException(PyExc_ArithmeticError, FloatingPointError, - "Floating point operation failed."); - - -/* - * OverflowError extends ArithmeticError - */ -SimpleExtendsException(PyExc_ArithmeticError, OverflowError, - "Result too large to be represented."); - - -/* - * ZeroDivisionError extends ArithmeticError - */ -SimpleExtendsException(PyExc_ArithmeticError, ZeroDivisionError, - "Second argument to a division or modulo operation was zero."); - - -/* - * SystemError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, SystemError, - "Internal error in the Python interpreter.\n" - "\n" - "Please report this to the Python maintainer, along with the traceback,\n" - "the Python version, and the hardware/OS platform and version."); - - -/* - * ReferenceError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, ReferenceError, - "Weak ref proxy used after referent went away."); - - -/* - * MemoryError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, MemoryError, "Out of memory."); - -/* - * BufferError extends StandardError - */ -SimpleExtendsException(PyExc_StandardError, BufferError, "Buffer error."); - - -/* Warning category docstrings */ - -/* - * Warning extends Exception - */ -SimpleExtendsException(PyExc_Exception, Warning, - "Base class for warning categories."); - - -/* - * UserWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, UserWarning, - "Base class for warnings generated by user code."); - - -/* - * DeprecationWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, DeprecationWarning, - "Base class for warnings about deprecated features."); - - -/* - * PendingDeprecationWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, PendingDeprecationWarning, - "Base class for warnings about features which will be deprecated\n" - "in the future."); - - -/* - * SyntaxWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, SyntaxWarning, - "Base class for warnings about dubious syntax."); - - -/* - * RuntimeWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, RuntimeWarning, - "Base class for warnings about dubious runtime behavior."); - - -/* - * FutureWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, FutureWarning, - "Base class for warnings about constructs that will change semantically\n" - "in the future."); - - -/* - * ImportWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, ImportWarning, - "Base class for warnings about probable mistakes in module imports"); - - -/* - * UnicodeWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, UnicodeWarning, - "Base class for warnings about Unicode related problems, mostly\n" - "related to conversion problems."); - -/* - * BytesWarning extends Warning - */ -SimpleExtendsException(PyExc_Warning, BytesWarning, - "Base class for warnings about bytes and buffer related problems, mostly\n" - "related to conversion from str or comparing to str."); - -/* Pre-computed MemoryError instance. Best to create this as early as - * possible and not wait until a MemoryError is actually raised! - */ -PyObject *PyExc_MemoryErrorInst=NULL; - -/* Pre-computed RuntimeError instance for when recursion depth is reached. - Meant to be used when normalizing the exception for exceeding the recursion - depth will cause its own infinite recursion. -*/ -PyObject *PyExc_RecursionErrorInst = NULL; - -/* module global functions */ -static PyMethodDef functions[] = { - /* Sentinel */ - {NULL, NULL} -}; - -#define PRE_INIT(TYPE) if (PyType_Ready(&_PyExc_ ## TYPE) < 0) \ - Py_FatalError("exceptions bootstrapping error."); - -#define POST_INIT(TYPE) Py_INCREF(PyExc_ ## TYPE); \ - PyModule_AddObject(m, # TYPE, PyExc_ ## TYPE); \ - if (PyDict_SetItemString(bdict, # TYPE, PyExc_ ## TYPE)) \ - Py_FatalError("Module dictionary insertion problem."); - - -PyMODINIT_FUNC -_PyExc_Init(void) -{ - PyObject *m, *bltinmod, *bdict; - - PRE_INIT(BaseException) - PRE_INIT(Exception) - PRE_INIT(StandardError) - PRE_INIT(TypeError) - PRE_INIT(StopIteration) - PRE_INIT(GeneratorExit) - PRE_INIT(SystemExit) - PRE_INIT(KeyboardInterrupt) - PRE_INIT(ImportError) - PRE_INIT(EnvironmentError) - PRE_INIT(IOError) - PRE_INIT(OSError) -#ifdef MS_WINDOWS - PRE_INIT(WindowsError) -#endif -#ifdef __VMS - PRE_INIT(VMSError) -#endif - PRE_INIT(EOFError) - PRE_INIT(RuntimeError) - PRE_INIT(NotImplementedError) - PRE_INIT(NameError) - PRE_INIT(UnboundLocalError) - PRE_INIT(AttributeError) - PRE_INIT(SyntaxError) - PRE_INIT(IndentationError) - PRE_INIT(TabError) - PRE_INIT(LookupError) - PRE_INIT(IndexError) - PRE_INIT(KeyError) - PRE_INIT(ValueError) - PRE_INIT(UnicodeError) -#ifdef Py_USING_UNICODE - PRE_INIT(UnicodeEncodeError) - PRE_INIT(UnicodeDecodeError) - PRE_INIT(UnicodeTranslateError) -#endif - PRE_INIT(AssertionError) - PRE_INIT(ArithmeticError) - PRE_INIT(FloatingPointError) - PRE_INIT(OverflowError) - PRE_INIT(ZeroDivisionError) - PRE_INIT(SystemError) - PRE_INIT(ReferenceError) - PRE_INIT(MemoryError) - PRE_INIT(BufferError) - PRE_INIT(Warning) - PRE_INIT(UserWarning) - PRE_INIT(DeprecationWarning) - PRE_INIT(PendingDeprecationWarning) - PRE_INIT(SyntaxWarning) - PRE_INIT(RuntimeWarning) - PRE_INIT(FutureWarning) - PRE_INIT(ImportWarning) - PRE_INIT(UnicodeWarning) - PRE_INIT(BytesWarning) - - m = Py_InitModule4("exceptions", functions, exceptions_doc, - (PyObject *)NULL, PYTHON_API_VERSION); - if (m == NULL) - return; - - bltinmod = PyImport_ImportModule("__builtin__"); - if (bltinmod == NULL) - Py_FatalError("exceptions bootstrapping error."); - bdict = PyModule_GetDict(bltinmod); - if (bdict == NULL) - Py_FatalError("exceptions bootstrapping error."); - - POST_INIT(BaseException) - POST_INIT(Exception) - POST_INIT(StandardError) - POST_INIT(TypeError) - POST_INIT(StopIteration) - POST_INIT(GeneratorExit) - POST_INIT(SystemExit) - POST_INIT(KeyboardInterrupt) - POST_INIT(ImportError) - POST_INIT(EnvironmentError) - POST_INIT(IOError) - POST_INIT(OSError) -#ifdef MS_WINDOWS - POST_INIT(WindowsError) -#endif -#ifdef __VMS - POST_INIT(VMSError) -#endif - POST_INIT(EOFError) - POST_INIT(RuntimeError) - POST_INIT(NotImplementedError) - POST_INIT(NameError) - POST_INIT(UnboundLocalError) - POST_INIT(AttributeError) - POST_INIT(SyntaxError) - POST_INIT(IndentationError) - POST_INIT(TabError) - POST_INIT(LookupError) - POST_INIT(IndexError) - POST_INIT(KeyError) - POST_INIT(ValueError) - POST_INIT(UnicodeError) -#ifdef Py_USING_UNICODE - POST_INIT(UnicodeEncodeError) - POST_INIT(UnicodeDecodeError) - POST_INIT(UnicodeTranslateError) -#endif - POST_INIT(AssertionError) - POST_INIT(ArithmeticError) - POST_INIT(FloatingPointError) - POST_INIT(OverflowError) - POST_INIT(ZeroDivisionError) - POST_INIT(SystemError) - POST_INIT(ReferenceError) - POST_INIT(MemoryError) - POST_INIT(BufferError) - POST_INIT(Warning) - POST_INIT(UserWarning) - POST_INIT(DeprecationWarning) - POST_INIT(PendingDeprecationWarning) - POST_INIT(SyntaxWarning) - POST_INIT(RuntimeWarning) - POST_INIT(FutureWarning) - POST_INIT(ImportWarning) - POST_INIT(UnicodeWarning) - POST_INIT(BytesWarning) - - PyExc_MemoryErrorInst = BaseException_new(&_PyExc_MemoryError, NULL, NULL); - if (!PyExc_MemoryErrorInst) - Py_FatalError("Cannot pre-allocate MemoryError instance"); - - PyExc_RecursionErrorInst = BaseException_new(&_PyExc_RuntimeError, NULL, NULL); - if (!PyExc_RecursionErrorInst) - Py_FatalError("Cannot pre-allocate RuntimeError instance for " - "recursion errors"); - else { - PyBaseExceptionObject *err_inst = - (PyBaseExceptionObject *)PyExc_RecursionErrorInst; - PyObject *args_tuple; - PyObject *exc_message; - exc_message = PyString_FromString("maximum recursion depth exceeded"); - if (!exc_message) - Py_FatalError("cannot allocate argument for RuntimeError " - "pre-allocation"); - args_tuple = PyTuple_Pack(1, exc_message); - if (!args_tuple) - Py_FatalError("cannot allocate tuple for RuntimeError " - "pre-allocation"); - Py_DECREF(exc_message); - if (BaseException_init(err_inst, args_tuple, NULL)) - Py_FatalError("init of pre-allocated RuntimeError failed"); - Py_DECREF(args_tuple); - } - Py_DECREF(bltinmod); -} - -void -_PyExc_Fini(void) -{ - Py_CLEAR(PyExc_MemoryErrorInst); - Py_CLEAR(PyExc_RecursionErrorInst); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/fileobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/fileobject.c deleted file mode 100644 index a26e03e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/fileobject.c +++ /dev/null @@ -1,2889 +0,0 @@ -/* File object implementation */ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" -#include "structmember.h" - -#ifdef HAVE_SYS_TYPES_H -#include -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef MS_WINDOWS -#define fileno _fileno -/* can simulate truncate with Win32 API functions; see file_truncate */ -#define HAVE_FTRUNCATE -#define WIN32_LEAN_AND_MEAN -#include -#endif - -#if defined(PYOS_OS2) && defined(PYCC_GCC) -#include -#endif - -#define BUF(v) PyString_AS_STRING((PyStringObject *)v) - -#ifdef HAVE_ERRNO_H -#include -#endif - -#ifdef HAVE_GETC_UNLOCKED -#define GETC(f) getc_unlocked(f) -#define FLOCKFILE(f) flockfile(f) -#define FUNLOCKFILE(f) funlockfile(f) -#else -#define GETC(f) getc(f) -#define FLOCKFILE(f) -#define FUNLOCKFILE(f) -#endif - -/* Bits in f_newlinetypes */ -#define NEWLINE_UNKNOWN 0 /* No newline seen, yet */ -#define NEWLINE_CR 1 /* \r newline seen */ -#define NEWLINE_LF 2 /* \n newline seen */ -#define NEWLINE_CRLF 4 /* \r\n newline seen */ - -/* - * These macros release the GIL while preventing the f_close() function being - * called in the interval between them. For that purpose, a running total of - * the number of currently running unlocked code sections is kept in - * the unlocked_count field of the PyFileObject. The close() method raises - * an IOError if that field is non-zero. See issue #815646, #595601. - */ - -#define FILE_BEGIN_ALLOW_THREADS(fobj) \ -{ \ - fobj->unlocked_count++; \ - Py_BEGIN_ALLOW_THREADS - -#define FILE_END_ALLOW_THREADS(fobj) \ - Py_END_ALLOW_THREADS \ - fobj->unlocked_count--; \ - assert(fobj->unlocked_count >= 0); \ -} - -#define FILE_ABORT_ALLOW_THREADS(fobj) \ - Py_BLOCK_THREADS \ - fobj->unlocked_count--; \ - assert(fobj->unlocked_count >= 0); - -#ifdef __cplusplus -extern "C" { -#endif - -FILE * -PyFile_AsFile(PyObject *f) -{ - if (f == NULL || !PyFile_Check(f)) - return NULL; - else - return ((PyFileObject *)f)->f_fp; -} - -void PyFile_IncUseCount(PyFileObject *fobj) -{ - fobj->unlocked_count++; -} - -void PyFile_DecUseCount(PyFileObject *fobj) -{ - fobj->unlocked_count--; - assert(fobj->unlocked_count >= 0); -} - -PyObject * -PyFile_Name(PyObject *f) -{ - if (f == NULL || !PyFile_Check(f)) - return NULL; - else - return ((PyFileObject *)f)->f_name; -} - -/* This is a safe wrapper around PyObject_Print to print to the FILE - of a PyFileObject. PyObject_Print releases the GIL but knows nothing - about PyFileObject. */ -static int -file_PyObject_Print(PyObject *op, PyFileObject *f, int flags) -{ - int result; - PyFile_IncUseCount(f); - result = PyObject_Print(op, f->f_fp, flags); - PyFile_DecUseCount(f); - return result; -} - -/* On Unix, fopen will succeed for directories. - In Python, there should be no file objects referring to - directories, so we need a check. */ - -static PyFileObject* -dircheck(PyFileObject* f) -{ -#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) - struct stat buf; - if (f->f_fp == NULL) - return f; - if (fstat(fileno(f->f_fp), &buf) == 0 && - S_ISDIR(buf.st_mode)) { - char *msg = strerror(EISDIR); - PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(isO)", - EISDIR, msg, f->f_name); - PyErr_SetObject(PyExc_IOError, exc); - Py_XDECREF(exc); - return NULL; - } -#endif - return f; -} - - -static PyObject * -fill_file_fields(PyFileObject *f, FILE *fp, PyObject *name, char *mode, - int (*close)(FILE *)) -{ - assert(name != NULL); - assert(f != NULL); - assert(PyFile_Check(f)); - assert(f->f_fp == NULL); - - Py_DECREF(f->f_name); - Py_DECREF(f->f_mode); - Py_DECREF(f->f_encoding); - Py_DECREF(f->f_errors); - - Py_INCREF(name); - f->f_name = name; - - f->f_mode = PyString_FromString(mode); - - f->f_close = close; - f->f_softspace = 0; - f->f_binary = strchr(mode,'b') != NULL; - f->f_buf = NULL; - f->f_univ_newline = (strchr(mode, 'U') != NULL); - f->f_newlinetypes = NEWLINE_UNKNOWN; - f->f_skipnextlf = 0; - Py_INCREF(Py_None); - f->f_encoding = Py_None; - Py_INCREF(Py_None); - f->f_errors = Py_None; - f->readable = f->writable = 0; - if (strchr(mode, 'r') != NULL || f->f_univ_newline) - f->readable = 1; - if (strchr(mode, 'w') != NULL || strchr(mode, 'a') != NULL) - f->writable = 1; - if (strchr(mode, '+') != NULL) - f->readable = f->writable = 1; - - if (f->f_mode == NULL) - return NULL; - f->f_fp = fp; - f = dircheck(f); - return (PyObject *) f; -} - -#if defined _MSC_VER && _MSC_VER >= 1400 && defined(__STDC_SECURE_LIB__) -#define Py_VERIFY_WINNT -/* The CRT on windows compiled with Visual Studio 2005 and higher may - * assert if given invalid mode strings. This is all fine and well - * in static languages like C where the mode string is typcially hard - * coded. But in Python, were we pass in the mode string from the user, - * we need to verify it first manually - */ -static int _PyVerify_Mode_WINNT(const char *mode) -{ - /* See if mode string is valid on Windows to avoid hard assertions */ - /* remove leading spacese */ - int singles = 0; - int pairs = 0; - int encoding = 0; - const char *s, *c; - - while(*mode == ' ') /* strip initial spaces */ - ++mode; - if (!strchr("rwa", *mode)) /* must start with one of these */ - return 0; - while (*++mode) { - if (*mode == ' ' || *mode == 'N') /* ignore spaces and N */ - continue; - s = "+TD"; /* each of this can appear only once */ - c = strchr(s, *mode); - if (c) { - ptrdiff_t idx = s-c; - if (singles & (1<f_name != NULL); -#else - assert(name != NULL); -#endif - assert(mode != NULL); - assert(f->f_fp == NULL); - - /* probably need to replace 'U' by 'rb' */ - newmode = PyMem_MALLOC(strlen(mode) + 3); - if (!newmode) { - PyErr_NoMemory(); - return NULL; - } - strcpy(newmode, mode); - - if (_PyFile_SanitizeMode(newmode)) { - f = NULL; - goto cleanup; - } - - /* rexec.py can't stop a user from getting the file() constructor -- - all they have to do is get *any* file object f, and then do - type(f). Here we prevent them from doing damage with it. */ - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_IOError, - "file() constructor not accessible in restricted mode"); - f = NULL; - goto cleanup; - } - errno = 0; - -#ifdef MS_WINDOWS - if (PyUnicode_Check(f->f_name)) { - PyObject *wmode; - wmode = PyUnicode_DecodeASCII(newmode, strlen(newmode), NULL); - if (f->f_name && wmode) { - FILE_BEGIN_ALLOW_THREADS(f) - /* PyUnicode_AS_UNICODE OK without thread - lock as it is a simple dereference. */ - f->f_fp = _wfopen(PyUnicode_AS_UNICODE(f->f_name), - PyUnicode_AS_UNICODE(wmode)); - FILE_END_ALLOW_THREADS(f) - } - Py_XDECREF(wmode); - } -#endif - if (NULL == f->f_fp && NULL != name) { - FILE_BEGIN_ALLOW_THREADS(f) - f->f_fp = fopen(name, newmode); - FILE_END_ALLOW_THREADS(f) - } - - if (f->f_fp == NULL) { -#if defined _MSC_VER && (_MSC_VER < 1400 || !defined(__STDC_SECURE_LIB__)) - /* MSVC 6 (Microsoft) leaves errno at 0 for bad mode strings, - * across all Windows flavors. When it sets EINVAL varies - * across Windows flavors, the exact conditions aren't - * documented, and the answer lies in the OS's implementation - * of Win32's CreateFile function (whose source is secret). - * Seems the best we can do is map EINVAL to ENOENT. - * Starting with Visual Studio .NET 2005, EINVAL is correctly - * set by our CRT error handler (set in exceptions.c.) - */ - if (errno == 0) /* bad mode string */ - errno = EINVAL; - else if (errno == EINVAL) /* unknown, but not a mode string */ - errno = ENOENT; -#endif - /* EINVAL is returned when an invalid filename or - * an invalid mode is supplied. */ - if (errno == EINVAL) { - PyObject *v; - char message[100]; - PyOS_snprintf(message, 100, - "invalid mode ('%.50s') or filename", mode); - v = Py_BuildValue("(isO)", errno, message, f->f_name); - if (v != NULL) { - PyErr_SetObject(PyExc_IOError, v); - Py_DECREF(v); - } - } - else - PyErr_SetFromErrnoWithFilenameObject(PyExc_IOError, f->f_name); - f = NULL; - } - if (f != NULL) - f = dircheck(f); - -cleanup: - PyMem_FREE(newmode); - - return (PyObject *)f; -} - -static PyObject * -close_the_file(PyFileObject *f) -{ - int sts = 0; - int (*local_close)(FILE *); - FILE *local_fp = f->f_fp; - char *local_setbuf = f->f_setbuf; - if (local_fp != NULL) { - local_close = f->f_close; - if (local_close != NULL && f->unlocked_count > 0) { - if (f->ob_refcnt > 0) { - PyErr_SetString(PyExc_IOError, - "close() called during concurrent " - "operation on the same file object."); - } else { - /* This should not happen unless someone is - * carelessly playing with the PyFileObject - * struct fields and/or its associated FILE - * pointer. */ - PyErr_SetString(PyExc_SystemError, - "PyFileObject locking error in " - "destructor (refcnt <= 0 at close)."); - } - return NULL; - } - /* NULL out the FILE pointer before releasing the GIL, because - * it will not be valid anymore after the close() function is - * called. */ - f->f_fp = NULL; - if (local_close != NULL) { - /* Issue #9295: must temporarily reset f_setbuf so that another - thread doesn't free it when running file_close() concurrently. - Otherwise this close() will crash when flushing the buffer. */ - f->f_setbuf = NULL; - Py_BEGIN_ALLOW_THREADS - errno = 0; - sts = (*local_close)(local_fp); - Py_END_ALLOW_THREADS - f->f_setbuf = local_setbuf; - if (sts == EOF) - return PyErr_SetFromErrno(PyExc_IOError); - if (sts != 0) - return PyInt_FromLong((long)sts); - } - } - Py_RETURN_NONE; -} - -PyObject * -PyFile_FromFile(FILE *fp, char *name, char *mode, int (*close)(FILE *)) -{ - PyFileObject *f; - PyObject *o_name; - - f = (PyFileObject *)PyFile_Type.tp_new(&PyFile_Type, NULL, NULL); - if (f == NULL) - return NULL; - o_name = PyString_FromString(name); - if (o_name == NULL) { - if (close != NULL && fp != NULL) - close(fp); - Py_DECREF(f); - return NULL; - } - if (fill_file_fields(f, fp, o_name, mode, close) == NULL) { - Py_DECREF(f); - Py_DECREF(o_name); - return NULL; - } - Py_DECREF(o_name); - return (PyObject *)f; -} - -PyObject * -PyFile_FromString(char *name, char *mode) -{ - extern int fclose(FILE *); - PyFileObject *f; - - f = (PyFileObject *)PyFile_FromFile((FILE *)NULL, name, mode, fclose); - if (f != NULL) { - if (open_the_file(f, name, mode) == NULL) { - Py_DECREF(f); - f = NULL; - } - } - return (PyObject *)f; -} - -void -PyFile_SetBufSize(PyObject *f, int bufsize) -{ - PyFileObject *file = (PyFileObject *)f; - if (bufsize >= 0) { - int type; - switch (bufsize) { - case 0: - type = _IONBF; - break; -#ifdef HAVE_SETVBUF - case 1: - type = _IOLBF; - bufsize = BUFSIZ; - break; -#endif - default: - type = _IOFBF; -#ifndef HAVE_SETVBUF - bufsize = BUFSIZ; -#endif - break; - } - fflush(file->f_fp); - if (type == _IONBF) { - PyMem_Free(file->f_setbuf); - file->f_setbuf = NULL; - } else { - file->f_setbuf = (char *)PyMem_Realloc(file->f_setbuf, - bufsize); - } -#ifdef HAVE_SETVBUF - setvbuf(file->f_fp, file->f_setbuf, type, bufsize); -#else /* !HAVE_SETVBUF */ - setbuf(file->f_fp, file->f_setbuf); -#endif /* !HAVE_SETVBUF */ - } -} - -/* Set the encoding used to output Unicode strings. - Return 1 on success, 0 on failure. */ - -int -PyFile_SetEncoding(PyObject *f, const char *enc) -{ - return PyFile_SetEncodingAndErrors(f, enc, NULL); -} - -int -PyFile_SetEncodingAndErrors(PyObject *f, const char *enc, char* errors) -{ - PyFileObject *file = (PyFileObject*)f; - PyObject *str, *oerrors; - - assert(PyFile_Check(f)); - str = PyString_FromString(enc); - if (!str) - return 0; - if (errors) { - oerrors = PyString_FromString(errors); - if (!oerrors) { - Py_DECREF(str); - return 0; - } - } else { - oerrors = Py_None; - Py_INCREF(Py_None); - } - Py_DECREF(file->f_encoding); - file->f_encoding = str; - Py_DECREF(file->f_errors); - file->f_errors = oerrors; - return 1; -} - -static PyObject * -err_closed(void) -{ - PyErr_SetString(PyExc_ValueError, "I/O operation on closed file"); - return NULL; -} - -static PyObject * -err_mode(char *action) -{ - PyErr_Format(PyExc_IOError, "File not open for %s", action); - return NULL; -} - -/* Refuse regular file I/O if there's data in the iteration-buffer. - * Mixing them would cause data to arrive out of order, as the read* - * methods don't use the iteration buffer. */ -static PyObject * -err_iterbuffered(void) -{ - PyErr_SetString(PyExc_ValueError, - "Mixing iteration and read methods would lose data"); - return NULL; -} - -static void drop_readahead(PyFileObject *); - -/* Methods */ - -static void -file_dealloc(PyFileObject *f) -{ - PyObject *ret; - if (f->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) f); - ret = close_the_file(f); - if (!ret) { - PySys_WriteStderr("close failed in file object destructor:\n"); - PyErr_Print(); - } - else { - Py_DECREF(ret); - } - PyMem_Free(f->f_setbuf); - Py_XDECREF(f->f_name); - Py_XDECREF(f->f_mode); - Py_XDECREF(f->f_encoding); - Py_XDECREF(f->f_errors); - drop_readahead(f); - Py_TYPE(f)->tp_free((PyObject *)f); -} - -static PyObject * -file_repr(PyFileObject *f) -{ - PyObject *ret = NULL; - PyObject *name = NULL; - if (PyUnicode_Check(f->f_name)) { -#ifdef Py_USING_UNICODE - const char *name_str; - name = PyUnicode_AsUnicodeEscapeString(f->f_name); - name_str = name ? PyString_AsString(name) : "?"; - ret = PyString_FromFormat("<%s file u'%s', mode '%s' at %p>", - f->f_fp == NULL ? "closed" : "open", - name_str, - PyString_AsString(f->f_mode), - f); - Py_XDECREF(name); - return ret; -#endif - } else { - name = PyObject_Repr(f->f_name); - if (name == NULL) - return NULL; - ret = PyString_FromFormat("<%s file %s, mode '%s' at %p>", - f->f_fp == NULL ? "closed" : "open", - PyString_AsString(name), - PyString_AsString(f->f_mode), - f); - Py_XDECREF(name); - return ret; - } -} - -static PyObject * -file_close(PyFileObject *f) -{ - PyObject *sts = close_the_file(f); - if (sts) { - PyMem_Free(f->f_setbuf); - f->f_setbuf = NULL; - } - return sts; -} - - -/* Our very own off_t-like type, 64-bit if possible */ -#if !defined(HAVE_LARGEFILE_SUPPORT) -typedef off_t Py_off_t; -#elif SIZEOF_OFF_T >= 8 -typedef off_t Py_off_t; -#elif SIZEOF_FPOS_T >= 8 -typedef fpos_t Py_off_t; -#else -#error "Large file support, but neither off_t nor fpos_t is large enough." -#endif - - -/* a portable fseek() function - return 0 on success, non-zero on failure (with errno set) */ -static int -_portable_fseek(FILE *fp, Py_off_t offset, int whence) -{ -#if !defined(HAVE_LARGEFILE_SUPPORT) - return fseek(fp, offset, whence); -#elif defined(HAVE_FSEEKO) && SIZEOF_OFF_T >= 8 - return fseeko(fp, offset, whence); -#elif defined(HAVE_FSEEK64) - return fseek64(fp, offset, whence); -#elif defined(__BEOS__) - return _fseek(fp, offset, whence); -#elif SIZEOF_FPOS_T >= 8 - /* lacking a 64-bit capable fseek(), use a 64-bit capable fsetpos() - and fgetpos() to implement fseek()*/ - fpos_t pos; - switch (whence) { - case SEEK_END: -#ifdef MS_WINDOWS - fflush(fp); - if (_lseeki64(fileno(fp), 0, 2) == -1) - return -1; -#else - if (fseek(fp, 0, SEEK_END) != 0) - return -1; -#endif - /* fall through */ - case SEEK_CUR: - if (fgetpos(fp, &pos) != 0) - return -1; - offset += pos; - break; - /* case SEEK_SET: break; */ - } - return fsetpos(fp, &offset); -#else -#error "Large file support, but no way to fseek." -#endif -} - - -/* a portable ftell() function - Return -1 on failure with errno set appropriately, current file - position on success */ -static Py_off_t -_portable_ftell(FILE* fp) -{ -#if !defined(HAVE_LARGEFILE_SUPPORT) - return ftell(fp); -#elif defined(HAVE_FTELLO) && SIZEOF_OFF_T >= 8 - return ftello(fp); -#elif defined(HAVE_FTELL64) - return ftell64(fp); -#elif SIZEOF_FPOS_T >= 8 - fpos_t pos; - if (fgetpos(fp, &pos) != 0) - return -1; - return pos; -#else -#error "Large file support, but no way to ftell." -#endif -} - - -static PyObject * -file_seek(PyFileObject *f, PyObject *args) -{ - int whence; - int ret; - Py_off_t offset; - PyObject *offobj, *off_index; - - if (f->f_fp == NULL) - return err_closed(); - drop_readahead(f); - whence = 0; - if (!PyArg_ParseTuple(args, "O|i:seek", &offobj, &whence)) - return NULL; - off_index = PyNumber_Index(offobj); - if (!off_index) { - if (!PyFloat_Check(offobj)) - return NULL; - /* Deprecated in 2.6 */ - PyErr_Clear(); - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "integer argument expected, got float", - 1) < 0) - return NULL; - off_index = offobj; - Py_INCREF(offobj); - } -#if !defined(HAVE_LARGEFILE_SUPPORT) - offset = PyInt_AsLong(off_index); -#else - offset = PyLong_Check(off_index) ? - PyLong_AsLongLong(off_index) : PyInt_AsLong(off_index); -#endif - Py_DECREF(off_index); - if (PyErr_Occurred()) - return NULL; - - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - ret = _portable_fseek(f->f_fp, offset, whence); - FILE_END_ALLOW_THREADS(f) - - if (ret != 0) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - return NULL; - } - f->f_skipnextlf = 0; - Py_INCREF(Py_None); - return Py_None; -} - - -#ifdef HAVE_FTRUNCATE -static PyObject * -file_truncate(PyFileObject *f, PyObject *args) -{ - Py_off_t newsize; - PyObject *newsizeobj = NULL; - Py_off_t initialpos; - int ret; - - if (f->f_fp == NULL) - return err_closed(); - if (!f->writable) - return err_mode("writing"); - if (!PyArg_UnpackTuple(args, "truncate", 0, 1, &newsizeobj)) - return NULL; - - /* Get current file position. If the file happens to be open for - * update and the last operation was an input operation, C doesn't - * define what the later fflush() will do, but we promise truncate() - * won't change the current position (and fflush() *does* change it - * then at least on Windows). The easiest thing is to capture - * current pos now and seek back to it at the end. - */ - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - initialpos = _portable_ftell(f->f_fp); - FILE_END_ALLOW_THREADS(f) - if (initialpos == -1) - goto onioerror; - - /* Set newsize to current postion if newsizeobj NULL, else to the - * specified value. - */ - if (newsizeobj != NULL) { -#if !defined(HAVE_LARGEFILE_SUPPORT) - newsize = PyInt_AsLong(newsizeobj); -#else - newsize = PyLong_Check(newsizeobj) ? - PyLong_AsLongLong(newsizeobj) : - PyInt_AsLong(newsizeobj); -#endif - if (PyErr_Occurred()) - return NULL; - } - else /* default to current position */ - newsize = initialpos; - - /* Flush the stream. We're mixing stream-level I/O with lower-level - * I/O, and a flush may be necessary to synch both platform views - * of the current file state. - */ - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - ret = fflush(f->f_fp); - FILE_END_ALLOW_THREADS(f) - if (ret != 0) - goto onioerror; - -#ifdef MS_WINDOWS - /* MS _chsize doesn't work if newsize doesn't fit in 32 bits, - so don't even try using it. */ - { - HANDLE hFile; - - /* Have to move current pos to desired endpoint on Windows. */ - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - ret = _portable_fseek(f->f_fp, newsize, SEEK_SET) != 0; - FILE_END_ALLOW_THREADS(f) - if (ret) - goto onioerror; - - /* Truncate. Note that this may grow the file! */ - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - hFile = (HANDLE)_get_osfhandle(fileno(f->f_fp)); - ret = hFile == (HANDLE)-1; - if (ret == 0) { - ret = SetEndOfFile(hFile) == 0; - if (ret) - errno = EACCES; - } - FILE_END_ALLOW_THREADS(f) - if (ret) - goto onioerror; - } -#else - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - ret = ftruncate(fileno(f->f_fp), newsize); - FILE_END_ALLOW_THREADS(f) - if (ret != 0) - goto onioerror; -#endif /* !MS_WINDOWS */ - - /* Restore original file position. */ - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - ret = _portable_fseek(f->f_fp, initialpos, SEEK_SET) != 0; - FILE_END_ALLOW_THREADS(f) - if (ret) - goto onioerror; - - Py_INCREF(Py_None); - return Py_None; - -onioerror: - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - return NULL; -} -#endif /* HAVE_FTRUNCATE */ - -static PyObject * -file_tell(PyFileObject *f) -{ - Py_off_t pos; - - if (f->f_fp == NULL) - return err_closed(); - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - pos = _portable_ftell(f->f_fp); - FILE_END_ALLOW_THREADS(f) - - if (pos == -1) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - return NULL; - } - if (f->f_skipnextlf) { - int c; - c = GETC(f->f_fp); - if (c == '\n') { - f->f_newlinetypes |= NEWLINE_CRLF; - pos++; - f->f_skipnextlf = 0; - } else if (c != EOF) ungetc(c, f->f_fp); - } -#if !defined(HAVE_LARGEFILE_SUPPORT) - return PyInt_FromLong(pos); -#else - return PyLong_FromLongLong(pos); -#endif -} - -static PyObject * -file_fileno(PyFileObject *f) -{ - if (f->f_fp == NULL) - return err_closed(); - return PyInt_FromLong((long) fileno(f->f_fp)); -} - -static PyObject * -file_flush(PyFileObject *f) -{ - int res; - - if (f->f_fp == NULL) - return err_closed(); - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - res = fflush(f->f_fp); - FILE_END_ALLOW_THREADS(f) - if (res != 0) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - return NULL; - } - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -file_isatty(PyFileObject *f) -{ - long res; - if (f->f_fp == NULL) - return err_closed(); - FILE_BEGIN_ALLOW_THREADS(f) - res = isatty((int)fileno(f->f_fp)); - FILE_END_ALLOW_THREADS(f) - return PyBool_FromLong(res); -} - - -#if BUFSIZ < 8192 -#define SMALLCHUNK 8192 -#else -#define SMALLCHUNK BUFSIZ -#endif - -static size_t -new_buffersize(PyFileObject *f, size_t currentsize) -{ -#ifdef HAVE_FSTAT - off_t pos, end; - struct stat st; - if (fstat(fileno(f->f_fp), &st) == 0) { - end = st.st_size; - /* The following is not a bug: we really need to call lseek() - *and* ftell(). The reason is that some stdio libraries - mistakenly flush their buffer when ftell() is called and - the lseek() call it makes fails, thereby throwing away - data that cannot be recovered in any way. To avoid this, - we first test lseek(), and only call ftell() if lseek() - works. We can't use the lseek() value either, because we - need to take the amount of buffered data into account. - (Yet another reason why stdio stinks. :-) */ - pos = lseek(fileno(f->f_fp), 0L, SEEK_CUR); - if (pos >= 0) { - pos = ftell(f->f_fp); - } - if (pos < 0) - clearerr(f->f_fp); - if (end > pos && pos >= 0) - return currentsize + end - pos + 1; - /* Add 1 so if the file were to grow we'd notice. */ - } -#endif - /* Expand the buffer by an amount proportional to the current size, - giving us amortized linear-time behavior. Use a less-than-double - growth factor to avoid excessive allocation. */ - return currentsize + (currentsize >> 3) + 6; -} - -#if defined(EWOULDBLOCK) && defined(EAGAIN) && EWOULDBLOCK != EAGAIN -#define BLOCKED_ERRNO(x) ((x) == EWOULDBLOCK || (x) == EAGAIN) -#else -#ifdef EWOULDBLOCK -#define BLOCKED_ERRNO(x) ((x) == EWOULDBLOCK) -#else -#ifdef EAGAIN -#define BLOCKED_ERRNO(x) ((x) == EAGAIN) -#else -#define BLOCKED_ERRNO(x) 0 -#endif -#endif -#endif - -static PyObject * -file_read(PyFileObject *f, PyObject *args) -{ - long bytesrequested = -1; - size_t bytesread, buffersize, chunksize; - PyObject *v; - - if (f->f_fp == NULL) - return err_closed(); - if (!f->readable) - return err_mode("reading"); - /* refuse to mix with f.next() */ - if (f->f_buf != NULL && - (f->f_bufend - f->f_bufptr) > 0 && - f->f_buf[0] != '\0') - return err_iterbuffered(); - if (!PyArg_ParseTuple(args, "|l:read", &bytesrequested)) - return NULL; - if (bytesrequested < 0) - buffersize = new_buffersize(f, (size_t)0); - else - buffersize = bytesrequested; - if (buffersize > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "requested number of bytes is more than a Python string can hold"); - return NULL; - } - v = PyString_FromStringAndSize((char *)NULL, buffersize); - if (v == NULL) - return NULL; - bytesread = 0; - for (;;) { - int interrupted; - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - chunksize = Py_UniversalNewlineFread(BUF(v) + bytesread, - buffersize - bytesread, f->f_fp, (PyObject *)f); - interrupted = ferror(f->f_fp) && errno == EINTR; - FILE_END_ALLOW_THREADS(f) - if (interrupted) { - clearerr(f->f_fp); - if (PyErr_CheckSignals()) { - Py_DECREF(v); - return NULL; - } - } - if (chunksize == 0) { - if (interrupted) - continue; - if (!ferror(f->f_fp)) - break; - clearerr(f->f_fp); - /* When in non-blocking mode, data shouldn't - * be discarded if a blocking signal was - * received. That will also happen if - * chunksize != 0, but bytesread < buffersize. */ - if (bytesread > 0 && BLOCKED_ERRNO(errno)) - break; - PyErr_SetFromErrno(PyExc_IOError); - Py_DECREF(v); - return NULL; - } - bytesread += chunksize; - if (bytesread < buffersize && !interrupted) { - clearerr(f->f_fp); - break; - } - if (bytesrequested < 0) { - buffersize = new_buffersize(f, buffersize); - if (_PyString_Resize(&v, buffersize) < 0) - return NULL; - } else { - /* Got what was requested. */ - break; - } - } - if (bytesread != buffersize && _PyString_Resize(&v, bytesread)) - return NULL; - return v; -} - -static PyObject * -file_readinto(PyFileObject *f, PyObject *args) -{ - char *ptr; - Py_ssize_t ntodo; - Py_ssize_t ndone, nnow; - Py_buffer pbuf; - - if (f->f_fp == NULL) - return err_closed(); - if (!f->readable) - return err_mode("reading"); - /* refuse to mix with f.next() */ - if (f->f_buf != NULL && - (f->f_bufend - f->f_bufptr) > 0 && - f->f_buf[0] != '\0') - return err_iterbuffered(); - if (!PyArg_ParseTuple(args, "w*", &pbuf)) - return NULL; - ptr = pbuf.buf; - ntodo = pbuf.len; - ndone = 0; - while (ntodo > 0) { - int interrupted; - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - nnow = Py_UniversalNewlineFread(ptr+ndone, ntodo, f->f_fp, - (PyObject *)f); - interrupted = ferror(f->f_fp) && errno == EINTR; - FILE_END_ALLOW_THREADS(f) - if (interrupted) { - clearerr(f->f_fp); - if (PyErr_CheckSignals()) { - PyBuffer_Release(&pbuf); - return NULL; - } - } - if (nnow == 0) { - if (interrupted) - continue; - if (!ferror(f->f_fp)) - break; - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - PyBuffer_Release(&pbuf); - return NULL; - } - ndone += nnow; - ntodo -= nnow; - } - PyBuffer_Release(&pbuf); - return PyInt_FromSsize_t(ndone); -} - -/************************************************************************** -Routine to get next line using platform fgets(). - -Under MSVC 6: - -+ MS threadsafe getc is very slow (multiple layers of function calls before+ - after each character, to lock+unlock the stream). -+ The stream-locking functions are MS-internal -- can't access them from user - code. -+ There's nothing Tim could find in the MS C or platform SDK libraries that - can worm around this. -+ MS fgets locks/unlocks only once per line; it's the only hook we have. - -So we use fgets for speed(!), despite that it's painful. - -MS realloc is also slow. - -Reports from other platforms on this method vs getc_unlocked (which MS doesn't -have): - Linux a wash - Solaris a wash - Tru64 Unix getline_via_fgets significantly faster - -CAUTION: The C std isn't clear about this: in those cases where fgets -writes something into the buffer, can it write into any position beyond the -required trailing null byte? MSVC 6 fgets does not, and no platform is (yet) -known on which it does; and it would be a strange way to code fgets. Still, -getline_via_fgets may not work correctly if it does. The std test -test_bufio.py should fail if platform fgets() routinely writes beyond the -trailing null byte. #define DONT_USE_FGETS_IN_GETLINE to disable this code. -**************************************************************************/ - -/* Use this routine if told to, or by default on non-get_unlocked() - * platforms unless told not to. Yikes! Let's spell that out: - * On a platform with getc_unlocked(): - * By default, use getc_unlocked(). - * If you want to use fgets() instead, #define USE_FGETS_IN_GETLINE. - * On a platform without getc_unlocked(): - * By default, use fgets(). - * If you don't want to use fgets(), #define DONT_USE_FGETS_IN_GETLINE. - */ -#if !defined(USE_FGETS_IN_GETLINE) && !defined(HAVE_GETC_UNLOCKED) -#define USE_FGETS_IN_GETLINE -#endif - -#if defined(DONT_USE_FGETS_IN_GETLINE) && defined(USE_FGETS_IN_GETLINE) -#undef USE_FGETS_IN_GETLINE -#endif - -#ifdef USE_FGETS_IN_GETLINE -static PyObject* -getline_via_fgets(PyFileObject *f, FILE *fp) -{ -/* INITBUFSIZE is the maximum line length that lets us get away with the fast - * no-realloc, one-fgets()-call path. Boosting it isn't free, because we have - * to fill this much of the buffer with a known value in order to figure out - * how much of the buffer fgets() overwrites. So if INITBUFSIZE is larger - * than "most" lines, we waste time filling unused buffer slots. 100 is - * surely adequate for most peoples' email archives, chewing over source code, - * etc -- "regular old text files". - * MAXBUFSIZE is the maximum line length that lets us get away with the less - * fast (but still zippy) no-realloc, two-fgets()-call path. See above for - * cautions about boosting that. 300 was chosen because the worst real-life - * text-crunching job reported on Python-Dev was a mail-log crawler where over - * half the lines were 254 chars. - */ -#define INITBUFSIZE 100 -#define MAXBUFSIZE 300 - char* p; /* temp */ - char buf[MAXBUFSIZE]; - PyObject* v; /* the string object result */ - char* pvfree; /* address of next free slot */ - char* pvend; /* address one beyond last free slot */ - size_t nfree; /* # of free buffer slots; pvend-pvfree */ - size_t total_v_size; /* total # of slots in buffer */ - size_t increment; /* amount to increment the buffer */ - size_t prev_v_size; - - /* Optimize for normal case: avoid _PyString_Resize if at all - * possible via first reading into stack buffer "buf". - */ - total_v_size = INITBUFSIZE; /* start small and pray */ - pvfree = buf; - for (;;) { - FILE_BEGIN_ALLOW_THREADS(f) - pvend = buf + total_v_size; - nfree = pvend - pvfree; - memset(pvfree, '\n', nfree); - assert(nfree < INT_MAX); /* Should be atmost MAXBUFSIZE */ - p = fgets(pvfree, (int)nfree, fp); - FILE_END_ALLOW_THREADS(f) - - if (p == NULL) { - clearerr(fp); - if (PyErr_CheckSignals()) - return NULL; - v = PyString_FromStringAndSize(buf, pvfree - buf); - return v; - } - /* fgets read *something* */ - p = memchr(pvfree, '\n', nfree); - if (p != NULL) { - /* Did the \n come from fgets or from us? - * Since fgets stops at the first \n, and then writes - * \0, if it's from fgets a \0 must be next. But if - * that's so, it could not have come from us, since - * the \n's we filled the buffer with have only more - * \n's to the right. - */ - if (p+1 < pvend && *(p+1) == '\0') { - /* It's from fgets: we win! In particular, - * we haven't done any mallocs yet, and can - * build the final result on the first try. - */ - ++p; /* include \n from fgets */ - } - else { - /* Must be from us: fgets didn't fill the - * buffer and didn't find a newline, so it - * must be the last and newline-free line of - * the file. - */ - assert(p > pvfree && *(p-1) == '\0'); - --p; /* don't include \0 from fgets */ - } - v = PyString_FromStringAndSize(buf, p - buf); - return v; - } - /* yuck: fgets overwrote all the newlines, i.e. the entire - * buffer. So this line isn't over yet, or maybe it is but - * we're exactly at EOF. If we haven't already, try using the - * rest of the stack buffer. - */ - assert(*(pvend-1) == '\0'); - if (pvfree == buf) { - pvfree = pvend - 1; /* overwrite trailing null */ - total_v_size = MAXBUFSIZE; - } - else - break; - } - - /* The stack buffer isn't big enough; malloc a string object and read - * into its buffer. - */ - total_v_size = MAXBUFSIZE << 1; - v = PyString_FromStringAndSize((char*)NULL, (int)total_v_size); - if (v == NULL) - return v; - /* copy over everything except the last null byte */ - memcpy(BUF(v), buf, MAXBUFSIZE-1); - pvfree = BUF(v) + MAXBUFSIZE - 1; - - /* Keep reading stuff into v; if it ever ends successfully, break - * after setting p one beyond the end of the line. The code here is - * very much like the code above, except reads into v's buffer; see - * the code above for detailed comments about the logic. - */ - for (;;) { - FILE_BEGIN_ALLOW_THREADS(f) - pvend = BUF(v) + total_v_size; - nfree = pvend - pvfree; - memset(pvfree, '\n', nfree); - assert(nfree < INT_MAX); - p = fgets(pvfree, (int)nfree, fp); - FILE_END_ALLOW_THREADS(f) - - if (p == NULL) { - clearerr(fp); - if (PyErr_CheckSignals()) { - Py_DECREF(v); - return NULL; - } - p = pvfree; - break; - } - p = memchr(pvfree, '\n', nfree); - if (p != NULL) { - if (p+1 < pvend && *(p+1) == '\0') { - /* \n came from fgets */ - ++p; - break; - } - /* \n came from us; last line of file, no newline */ - assert(p > pvfree && *(p-1) == '\0'); - --p; - break; - } - /* expand buffer and try again */ - assert(*(pvend-1) == '\0'); - increment = total_v_size >> 2; /* mild exponential growth */ - prev_v_size = total_v_size; - total_v_size += increment; - /* check for overflow */ - if (total_v_size <= prev_v_size || - total_v_size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "line is longer than a Python string can hold"); - Py_DECREF(v); - return NULL; - } - if (_PyString_Resize(&v, (int)total_v_size) < 0) - return NULL; - /* overwrite the trailing null byte */ - pvfree = BUF(v) + (prev_v_size - 1); - } - if (BUF(v) + total_v_size != p && _PyString_Resize(&v, p - BUF(v))) - return NULL; - return v; -#undef INITBUFSIZE -#undef MAXBUFSIZE -} -#endif /* ifdef USE_FGETS_IN_GETLINE */ - -/* Internal routine to get a line. - Size argument interpretation: - > 0: max length; - <= 0: read arbitrary line -*/ - -static PyObject * -get_line(PyFileObject *f, int n) -{ - FILE *fp = f->f_fp; - int c; - char *buf, *end; - size_t total_v_size; /* total # of slots in buffer */ - size_t used_v_size; /* # used slots in buffer */ - size_t increment; /* amount to increment the buffer */ - PyObject *v; - int newlinetypes = f->f_newlinetypes; - int skipnextlf = f->f_skipnextlf; - int univ_newline = f->f_univ_newline; - -#if defined(USE_FGETS_IN_GETLINE) - if (n <= 0 && !univ_newline ) - return getline_via_fgets(f, fp); -#endif - total_v_size = n > 0 ? n : 100; - v = PyString_FromStringAndSize((char *)NULL, total_v_size); - if (v == NULL) - return NULL; - buf = BUF(v); - end = buf + total_v_size; - - for (;;) { - FILE_BEGIN_ALLOW_THREADS(f) - FLOCKFILE(fp); - if (univ_newline) { - c = 'x'; /* Shut up gcc warning */ - while ( buf != end && (c = GETC(fp)) != EOF ) { - if (skipnextlf ) { - skipnextlf = 0; - if (c == '\n') { - /* Seeing a \n here with - * skipnextlf true means we - * saw a \r before. - */ - newlinetypes |= NEWLINE_CRLF; - c = GETC(fp); - if (c == EOF) break; - } else { - newlinetypes |= NEWLINE_CR; - } - } - if (c == '\r') { - skipnextlf = 1; - c = '\n'; - } else if ( c == '\n') - newlinetypes |= NEWLINE_LF; - *buf++ = c; - if (c == '\n') break; - } - if (c == EOF) { - if (ferror(fp) && errno == EINTR) { - FUNLOCKFILE(fp); - FILE_ABORT_ALLOW_THREADS(f) - f->f_newlinetypes = newlinetypes; - f->f_skipnextlf = skipnextlf; - - if (PyErr_CheckSignals()) { - Py_DECREF(v); - return NULL; - } - /* We executed Python signal handlers and got no exception. - * Now back to reading the line where we left off. */ - clearerr(fp); - continue; - } - if (skipnextlf) - newlinetypes |= NEWLINE_CR; - } - } else /* If not universal newlines use the normal loop */ - while ((c = GETC(fp)) != EOF && - (*buf++ = c) != '\n' && - buf != end) - ; - FUNLOCKFILE(fp); - FILE_END_ALLOW_THREADS(f) - f->f_newlinetypes = newlinetypes; - f->f_skipnextlf = skipnextlf; - if (c == '\n') - break; - if (c == EOF) { - if (ferror(fp)) { - if (errno == EINTR) { - if (PyErr_CheckSignals()) { - Py_DECREF(v); - return NULL; - } - /* We executed Python signal handlers and got no exception. - * Now back to reading the line where we left off. */ - clearerr(fp); - continue; - } - PyErr_SetFromErrno(PyExc_IOError); - clearerr(fp); - Py_DECREF(v); - return NULL; - } - clearerr(fp); - if (PyErr_CheckSignals()) { - Py_DECREF(v); - return NULL; - } - break; - } - /* Must be because buf == end */ - if (n > 0) - break; - used_v_size = total_v_size; - increment = total_v_size >> 2; /* mild exponential growth */ - total_v_size += increment; - if (total_v_size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "line is longer than a Python string can hold"); - Py_DECREF(v); - return NULL; - } - if (_PyString_Resize(&v, total_v_size) < 0) - return NULL; - buf = BUF(v) + used_v_size; - end = BUF(v) + total_v_size; - } - - used_v_size = buf - BUF(v); - if (used_v_size != total_v_size && _PyString_Resize(&v, used_v_size)) - return NULL; - return v; -} - -/* External C interface */ - -PyObject * -PyFile_GetLine(PyObject *f, int n) -{ - PyObject *result; - - if (f == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - - if (PyFile_Check(f)) { - PyFileObject *fo = (PyFileObject *)f; - if (fo->f_fp == NULL) - return err_closed(); - if (!fo->readable) - return err_mode("reading"); - /* refuse to mix with f.next() */ - if (fo->f_buf != NULL && - (fo->f_bufend - fo->f_bufptr) > 0 && - fo->f_buf[0] != '\0') - return err_iterbuffered(); - result = get_line(fo, n); - } - else { - PyObject *reader; - PyObject *args; - - reader = PyObject_GetAttrString(f, "readline"); - if (reader == NULL) - return NULL; - if (n <= 0) - args = PyTuple_New(0); - else - args = Py_BuildValue("(i)", n); - if (args == NULL) { - Py_DECREF(reader); - return NULL; - } - result = PyEval_CallObject(reader, args); - Py_DECREF(reader); - Py_DECREF(args); - if (result != NULL && !PyString_Check(result) && - !PyUnicode_Check(result)) { - Py_DECREF(result); - result = NULL; - PyErr_SetString(PyExc_TypeError, - "object.readline() returned non-string"); - } - } - - if (n < 0 && result != NULL && PyString_Check(result)) { - char *s = PyString_AS_STRING(result); - Py_ssize_t len = PyString_GET_SIZE(result); - if (len == 0) { - Py_DECREF(result); - result = NULL; - PyErr_SetString(PyExc_EOFError, - "EOF when reading a line"); - } - else if (s[len-1] == '\n') { - if (result->ob_refcnt == 1) { - if (_PyString_Resize(&result, len-1)) - return NULL; - } - else { - PyObject *v; - v = PyString_FromStringAndSize(s, len-1); - Py_DECREF(result); - result = v; - } - } - } -#ifdef Py_USING_UNICODE - if (n < 0 && result != NULL && PyUnicode_Check(result)) { - Py_UNICODE *s = PyUnicode_AS_UNICODE(result); - Py_ssize_t len = PyUnicode_GET_SIZE(result); - if (len == 0) { - Py_DECREF(result); - result = NULL; - PyErr_SetString(PyExc_EOFError, - "EOF when reading a line"); - } - else if (s[len-1] == '\n') { - if (result->ob_refcnt == 1) - PyUnicode_Resize(&result, len-1); - else { - PyObject *v; - v = PyUnicode_FromUnicode(s, len-1); - Py_DECREF(result); - result = v; - } - } - } -#endif - return result; -} - -/* Python method */ - -static PyObject * -file_readline(PyFileObject *f, PyObject *args) -{ - int n = -1; - - if (f->f_fp == NULL) - return err_closed(); - if (!f->readable) - return err_mode("reading"); - /* refuse to mix with f.next() */ - if (f->f_buf != NULL && - (f->f_bufend - f->f_bufptr) > 0 && - f->f_buf[0] != '\0') - return err_iterbuffered(); - if (!PyArg_ParseTuple(args, "|i:readline", &n)) - return NULL; - if (n == 0) - return PyString_FromString(""); - if (n < 0) - n = 0; - return get_line(f, n); -} - -static PyObject * -file_readlines(PyFileObject *f, PyObject *args) -{ - long sizehint = 0; - PyObject *list = NULL; - PyObject *line; - char small_buffer[SMALLCHUNK]; - char *buffer = small_buffer; - size_t buffersize = SMALLCHUNK; - PyObject *big_buffer = NULL; - size_t nfilled = 0; - size_t nread; - size_t totalread = 0; - char *p, *q, *end; - int err; - int shortread = 0; /* bool, did the previous read come up short? */ - - if (f->f_fp == NULL) - return err_closed(); - if (!f->readable) - return err_mode("reading"); - /* refuse to mix with f.next() */ - if (f->f_buf != NULL && - (f->f_bufend - f->f_bufptr) > 0 && - f->f_buf[0] != '\0') - return err_iterbuffered(); - if (!PyArg_ParseTuple(args, "|l:readlines", &sizehint)) - return NULL; - if ((list = PyList_New(0)) == NULL) - return NULL; - for (;;) { - if (shortread) - nread = 0; - else { - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - nread = Py_UniversalNewlineFread(buffer+nfilled, - buffersize-nfilled, f->f_fp, (PyObject *)f); - FILE_END_ALLOW_THREADS(f) - shortread = (nread < buffersize-nfilled); - } - if (nread == 0) { - sizehint = 0; - if (!ferror(f->f_fp)) - break; - if (errno == EINTR) { - if (PyErr_CheckSignals()) { - goto error; - } - clearerr(f->f_fp); - shortread = 0; - continue; - } - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - goto error; - } - totalread += nread; - p = (char *)memchr(buffer+nfilled, '\n', nread); - if (p == NULL) { - /* Need a larger buffer to fit this line */ - nfilled += nread; - buffersize *= 2; - if (buffersize > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "line is longer than a Python string can hold"); - goto error; - } - if (big_buffer == NULL) { - /* Create the big buffer */ - big_buffer = PyString_FromStringAndSize( - NULL, buffersize); - if (big_buffer == NULL) - goto error; - buffer = PyString_AS_STRING(big_buffer); - memcpy(buffer, small_buffer, nfilled); - } - else { - /* Grow the big buffer */ - if ( _PyString_Resize(&big_buffer, buffersize) < 0 ) - goto error; - buffer = PyString_AS_STRING(big_buffer); - } - continue; - } - end = buffer+nfilled+nread; - q = buffer; - do { - /* Process complete lines */ - p++; - line = PyString_FromStringAndSize(q, p-q); - if (line == NULL) - goto error; - err = PyList_Append(list, line); - Py_DECREF(line); - if (err != 0) - goto error; - q = p; - p = (char *)memchr(q, '\n', end-q); - } while (p != NULL); - /* Move the remaining incomplete line to the start */ - nfilled = end-q; - memmove(buffer, q, nfilled); - if (sizehint > 0) - if (totalread >= (size_t)sizehint) - break; - } - if (nfilled != 0) { - /* Partial last line */ - line = PyString_FromStringAndSize(buffer, nfilled); - if (line == NULL) - goto error; - if (sizehint > 0) { - /* Need to complete the last line */ - PyObject *rest = get_line(f, 0); - if (rest == NULL) { - Py_DECREF(line); - goto error; - } - PyString_Concat(&line, rest); - Py_DECREF(rest); - if (line == NULL) - goto error; - } - err = PyList_Append(list, line); - Py_DECREF(line); - if (err != 0) - goto error; - } - -cleanup: - Py_XDECREF(big_buffer); - return list; - -error: - Py_CLEAR(list); - goto cleanup; -} - -static PyObject * -file_write(PyFileObject *f, PyObject *args) -{ - Py_buffer pbuf; - const char *s; - Py_ssize_t n, n2; - PyObject *encoded = NULL; - int err_flag = 0, err; - - if (f->f_fp == NULL) - return err_closed(); - if (!f->writable) - return err_mode("writing"); - if (f->f_binary) { - if (!PyArg_ParseTuple(args, "s*", &pbuf)) - return NULL; - s = pbuf.buf; - n = pbuf.len; - } - else { - PyObject *text; - if (!PyArg_ParseTuple(args, "O", &text)) - return NULL; - - if (PyString_Check(text)) { - s = PyString_AS_STRING(text); - n = PyString_GET_SIZE(text); -#ifdef Py_USING_UNICODE - } else if (PyUnicode_Check(text)) { - const char *encoding, *errors; - if (f->f_encoding != Py_None) - encoding = PyString_AS_STRING(f->f_encoding); - else - encoding = PyUnicode_GetDefaultEncoding(); - if (f->f_errors != Py_None) - errors = PyString_AS_STRING(f->f_errors); - else - errors = "strict"; - encoded = PyUnicode_AsEncodedString(text, encoding, errors); - if (encoded == NULL) - return NULL; - s = PyString_AS_STRING(encoded); - n = PyString_GET_SIZE(encoded); -#endif - } else { - if (PyObject_AsCharBuffer(text, &s, &n)) - return NULL; - } - } - f->f_softspace = 0; - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - n2 = fwrite(s, 1, n, f->f_fp); - if (n2 != n || ferror(f->f_fp)) { - err_flag = 1; - err = errno; - } - FILE_END_ALLOW_THREADS(f) - Py_XDECREF(encoded); - if (f->f_binary) - PyBuffer_Release(&pbuf); - if (err_flag) { - errno = err; - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - return NULL; - } - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -file_writelines(PyFileObject *f, PyObject *seq) -{ -#define CHUNKSIZE 1000 - PyObject *list, *line; - PyObject *it; /* iter(seq) */ - PyObject *result; - int index, islist; - Py_ssize_t i, j, nwritten, len; - - assert(seq != NULL); - if (f->f_fp == NULL) - return err_closed(); - if (!f->writable) - return err_mode("writing"); - - result = NULL; - list = NULL; - islist = PyList_Check(seq); - if (islist) - it = NULL; - else { - it = PyObject_GetIter(seq); - if (it == NULL) { - PyErr_SetString(PyExc_TypeError, - "writelines() requires an iterable argument"); - return NULL; - } - /* From here on, fail by going to error, to reclaim "it". */ - list = PyList_New(CHUNKSIZE); - if (list == NULL) - goto error; - } - - /* Strategy: slurp CHUNKSIZE lines into a private list, - checking that they are all strings, then write that list - without holding the interpreter lock, then come back for more. */ - for (index = 0; ; index += CHUNKSIZE) { - if (islist) { - Py_XDECREF(list); - list = PyList_GetSlice(seq, index, index+CHUNKSIZE); - if (list == NULL) - goto error; - j = PyList_GET_SIZE(list); - } - else { - for (j = 0; j < CHUNKSIZE; j++) { - line = PyIter_Next(it); - if (line == NULL) { - if (PyErr_Occurred()) - goto error; - break; - } - PyList_SetItem(list, j, line); - } - /* The iterator might have closed the file on us. */ - if (f->f_fp == NULL) { - err_closed(); - goto error; - } - } - if (j == 0) - break; - - /* Check that all entries are indeed strings. If not, - apply the same rules as for file.write() and - convert the results to strings. This is slow, but - seems to be the only way since all conversion APIs - could potentially execute Python code. */ - for (i = 0; i < j; i++) { - PyObject *v = PyList_GET_ITEM(list, i); - if (!PyString_Check(v)) { - const char *buffer; - int res; - if (f->f_binary) { - res = PyObject_AsReadBuffer(v, (const void**)&buffer, &len); - } else { - res = PyObject_AsCharBuffer(v, &buffer, &len); - } - if (res) { - PyErr_SetString(PyExc_TypeError, - "writelines() argument must be a sequence of strings"); - goto error; - } - line = PyString_FromStringAndSize(buffer, - len); - if (line == NULL) - goto error; - Py_DECREF(v); - PyList_SET_ITEM(list, i, line); - } - } - - /* Since we are releasing the global lock, the - following code may *not* execute Python code. */ - f->f_softspace = 0; - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - for (i = 0; i < j; i++) { - line = PyList_GET_ITEM(list, i); - len = PyString_GET_SIZE(line); - nwritten = fwrite(PyString_AS_STRING(line), - 1, len, f->f_fp); - if (nwritten != len) { - FILE_ABORT_ALLOW_THREADS(f) - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - goto error; - } - } - FILE_END_ALLOW_THREADS(f) - - if (j < CHUNKSIZE) - break; - } - - Py_INCREF(Py_None); - result = Py_None; - error: - Py_XDECREF(list); - Py_XDECREF(it); - return result; -#undef CHUNKSIZE -} - -static PyObject * -file_self(PyFileObject *f) -{ - if (f->f_fp == NULL) - return err_closed(); - Py_INCREF(f); - return (PyObject *)f; -} - -static PyObject * -file_xreadlines(PyFileObject *f) -{ - if (PyErr_WarnPy3k("f.xreadlines() not supported in 3.x, " - "try 'for line in f' instead", 1) < 0) - return NULL; - return file_self(f); -} - -static PyObject * -file_exit(PyObject *f, PyObject *args) -{ - PyObject *ret = PyObject_CallMethod(f, "close", NULL); - if (!ret) - /* If error occurred, pass through */ - return NULL; - Py_DECREF(ret); - /* We cannot return the result of close since a true - * value will be interpreted as "yes, swallow the - * exception if one was raised inside the with block". */ - Py_RETURN_NONE; -} - -PyDoc_STRVAR(readline_doc, -"readline([size]) -> next line from the file, as a string.\n" -"\n" -"Retain newline. A non-negative size argument limits the maximum\n" -"number of bytes to return (an incomplete line may be returned then).\n" -"Return an empty string at EOF."); - -PyDoc_STRVAR(read_doc, -"read([size]) -> read at most size bytes, returned as a string.\n" -"\n" -"If the size argument is negative or omitted, read until EOF is reached.\n" -"Notice that when in non-blocking mode, less data than what was requested\n" -"may be returned, even if no size parameter was given."); - -PyDoc_STRVAR(write_doc, -"write(str) -> None. Write string str to file.\n" -"\n" -"Note that due to buffering, flush() or close() may be needed before\n" -"the file on disk reflects the data written."); - -PyDoc_STRVAR(fileno_doc, -"fileno() -> integer \"file descriptor\".\n" -"\n" -"This is needed for lower-level file interfaces, such os.read()."); - -PyDoc_STRVAR(seek_doc, -"seek(offset[, whence]) -> None. Move to new file position.\n" -"\n" -"Argument offset is a byte count. Optional argument whence defaults to\n" -"0 (offset from start of file, offset should be >= 0); other values are 1\n" -"(move relative to current position, positive or negative), and 2 (move\n" -"relative to end of file, usually negative, although many platforms allow\n" -"seeking beyond the end of a file). If the file is opened in text mode,\n" -"only offsets returned by tell() are legal. Use of other offsets causes\n" -"undefined behavior." -"\n" -"Note that not all file objects are seekable."); - -#ifdef HAVE_FTRUNCATE -PyDoc_STRVAR(truncate_doc, -"truncate([size]) -> None. Truncate the file to at most size bytes.\n" -"\n" -"Size defaults to the current file position, as returned by tell()."); -#endif - -PyDoc_STRVAR(tell_doc, -"tell() -> current file position, an integer (may be a long integer)."); - -PyDoc_STRVAR(readinto_doc, -"readinto() -> Undocumented. Don't use this; it may go away."); - -PyDoc_STRVAR(readlines_doc, -"readlines([size]) -> list of strings, each a line from the file.\n" -"\n" -"Call readline() repeatedly and return a list of the lines so read.\n" -"The optional size argument, if given, is an approximate bound on the\n" -"total number of bytes in the lines returned."); - -PyDoc_STRVAR(xreadlines_doc, -"xreadlines() -> returns self.\n" -"\n" -"For backward compatibility. File objects now include the performance\n" -"optimizations previously implemented in the xreadlines module."); - -PyDoc_STRVAR(writelines_doc, -"writelines(sequence_of_strings) -> None. Write the strings to the file.\n" -"\n" -"Note that newlines are not added. The sequence can be any iterable object\n" -"producing strings. This is equivalent to calling write() for each string."); - -PyDoc_STRVAR(flush_doc, -"flush() -> None. Flush the internal I/O buffer."); - -PyDoc_STRVAR(close_doc, -"close() -> None or (perhaps) an integer. Close the file.\n" -"\n" -"Sets data attribute .closed to True. A closed file cannot be used for\n" -"further I/O operations. close() may be called more than once without\n" -"error. Some kinds of file objects (for example, opened by popen())\n" -"may return an exit status upon closing."); - -PyDoc_STRVAR(isatty_doc, -"isatty() -> true or false. True if the file is connected to a tty device."); - -PyDoc_STRVAR(enter_doc, - "__enter__() -> self."); - -PyDoc_STRVAR(exit_doc, - "__exit__(*excinfo) -> None. Closes the file."); - -static PyMethodDef file_methods[] = { - {"readline", (PyCFunction)file_readline, METH_VARARGS, readline_doc}, - {"read", (PyCFunction)file_read, METH_VARARGS, read_doc}, - {"write", (PyCFunction)file_write, METH_VARARGS, write_doc}, - {"fileno", (PyCFunction)file_fileno, METH_NOARGS, fileno_doc}, - {"seek", (PyCFunction)file_seek, METH_VARARGS, seek_doc}, -#ifdef HAVE_FTRUNCATE - {"truncate", (PyCFunction)file_truncate, METH_VARARGS, truncate_doc}, -#endif - {"tell", (PyCFunction)file_tell, METH_NOARGS, tell_doc}, - {"readinto", (PyCFunction)file_readinto, METH_VARARGS, readinto_doc}, - {"readlines", (PyCFunction)file_readlines, METH_VARARGS, readlines_doc}, - {"xreadlines",(PyCFunction)file_xreadlines, METH_NOARGS, xreadlines_doc}, - {"writelines",(PyCFunction)file_writelines, METH_O, writelines_doc}, - {"flush", (PyCFunction)file_flush, METH_NOARGS, flush_doc}, - {"close", (PyCFunction)file_close, METH_NOARGS, close_doc}, - {"isatty", (PyCFunction)file_isatty, METH_NOARGS, isatty_doc}, - {"__enter__", (PyCFunction)file_self, METH_NOARGS, enter_doc}, - {"__exit__", (PyCFunction)file_exit, METH_VARARGS, exit_doc}, - {NULL, NULL} /* sentinel */ -}; - -#define OFF(x) offsetof(PyFileObject, x) - -static PyMemberDef file_memberlist[] = { - {"mode", T_OBJECT, OFF(f_mode), RO, - "file mode ('r', 'U', 'w', 'a', possibly with 'b' or '+' added)"}, - {"name", T_OBJECT, OFF(f_name), RO, - "file name"}, - {"encoding", T_OBJECT, OFF(f_encoding), RO, - "file encoding"}, - {"errors", T_OBJECT, OFF(f_errors), RO, - "Unicode error handler"}, - /* getattr(f, "closed") is implemented without this table */ - {NULL} /* Sentinel */ -}; - -static PyObject * -get_closed(PyFileObject *f, void *closure) -{ - return PyBool_FromLong((long)(f->f_fp == 0)); -} -static PyObject * -get_newlines(PyFileObject *f, void *closure) -{ - switch (f->f_newlinetypes) { - case NEWLINE_UNKNOWN: - Py_INCREF(Py_None); - return Py_None; - case NEWLINE_CR: - return PyString_FromString("\r"); - case NEWLINE_LF: - return PyString_FromString("\n"); - case NEWLINE_CR|NEWLINE_LF: - return Py_BuildValue("(ss)", "\r", "\n"); - case NEWLINE_CRLF: - return PyString_FromString("\r\n"); - case NEWLINE_CR|NEWLINE_CRLF: - return Py_BuildValue("(ss)", "\r", "\r\n"); - case NEWLINE_LF|NEWLINE_CRLF: - return Py_BuildValue("(ss)", "\n", "\r\n"); - case NEWLINE_CR|NEWLINE_LF|NEWLINE_CRLF: - return Py_BuildValue("(sss)", "\r", "\n", "\r\n"); - default: - PyErr_Format(PyExc_SystemError, - "Unknown newlines value 0x%x\n", - f->f_newlinetypes); - return NULL; - } -} - -static PyObject * -get_softspace(PyFileObject *f, void *closure) -{ - if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0) - return NULL; - return PyInt_FromLong(f->f_softspace); -} - -static int -set_softspace(PyFileObject *f, PyObject *value) -{ - int new; - if (PyErr_WarnPy3k("file.softspace not supported in 3.x", 1) < 0) - return -1; - - if (value == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't delete softspace attribute"); - return -1; - } - - new = PyInt_AsLong(value); - if (new == -1 && PyErr_Occurred()) - return -1; - f->f_softspace = new; - return 0; -} - -static PyGetSetDef file_getsetlist[] = { - {"closed", (getter)get_closed, NULL, "True if the file is closed"}, - {"newlines", (getter)get_newlines, NULL, - "end-of-line convention used in this file"}, - {"softspace", (getter)get_softspace, (setter)set_softspace, - "flag indicating that a space needs to be printed; used by print"}, - {0}, -}; - -static void -drop_readahead(PyFileObject *f) -{ - if (f->f_buf != NULL) { - PyMem_Free(f->f_buf); - f->f_buf = NULL; - } -} - -/* Make sure that file has a readahead buffer with at least one byte - (unless at EOF) and no more than bufsize. Returns negative value on - error, will set MemoryError if bufsize bytes cannot be allocated. */ -static int -readahead(PyFileObject *f, Py_ssize_t bufsize) -{ - Py_ssize_t chunksize; - - if (f->f_buf != NULL) { - if( (f->f_bufend - f->f_bufptr) >= 1) - return 0; - else - drop_readahead(f); - } - if ((f->f_buf = (char *)PyMem_Malloc(bufsize)) == NULL) { - PyErr_NoMemory(); - return -1; - } - FILE_BEGIN_ALLOW_THREADS(f) - errno = 0; - chunksize = Py_UniversalNewlineFread( - f->f_buf, bufsize, f->f_fp, (PyObject *)f); - FILE_END_ALLOW_THREADS(f) - if (chunksize == 0) { - if (ferror(f->f_fp)) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(f->f_fp); - drop_readahead(f); - return -1; - } - } - f->f_bufptr = f->f_buf; - f->f_bufend = f->f_buf + chunksize; - return 0; -} - -/* Used by file_iternext. The returned string will start with 'skip' - uninitialized bytes followed by the remainder of the line. Don't be - horrified by the recursive call: maximum recursion depth is limited by - logarithmic buffer growth to about 50 even when reading a 1gb line. */ - -static PyStringObject * -readahead_get_line_skip(PyFileObject *f, Py_ssize_t skip, Py_ssize_t bufsize) -{ - PyStringObject* s; - char *bufptr; - char *buf; - Py_ssize_t len; - - if (f->f_buf == NULL) - if (readahead(f, bufsize) < 0) - return NULL; - - len = f->f_bufend - f->f_bufptr; - if (len == 0) - return (PyStringObject *) - PyString_FromStringAndSize(NULL, skip); - bufptr = (char *)memchr(f->f_bufptr, '\n', len); - if (bufptr != NULL) { - bufptr++; /* Count the '\n' */ - len = bufptr - f->f_bufptr; - s = (PyStringObject *) - PyString_FromStringAndSize(NULL, skip + len); - if (s == NULL) - return NULL; - memcpy(PyString_AS_STRING(s) + skip, f->f_bufptr, len); - f->f_bufptr = bufptr; - if (bufptr == f->f_bufend) - drop_readahead(f); - } else { - bufptr = f->f_bufptr; - buf = f->f_buf; - f->f_buf = NULL; /* Force new readahead buffer */ - assert(len <= PY_SSIZE_T_MAX - skip); - s = readahead_get_line_skip(f, skip + len, bufsize + (bufsize>>2)); - if (s == NULL) { - PyMem_Free(buf); - return NULL; - } - memcpy(PyString_AS_STRING(s) + skip, bufptr, len); - PyMem_Free(buf); - } - return s; -} - -/* A larger buffer size may actually decrease performance. */ -#define READAHEAD_BUFSIZE 8192 - -static PyObject * -file_iternext(PyFileObject *f) -{ - PyStringObject* l; - - if (f->f_fp == NULL) - return err_closed(); - if (!f->readable) - return err_mode("reading"); - - l = readahead_get_line_skip(f, 0, READAHEAD_BUFSIZE); - if (l == NULL || PyString_GET_SIZE(l) == 0) { - Py_XDECREF(l); - return NULL; - } - return (PyObject *)l; -} - - -static PyObject * -file_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *self; - static PyObject *not_yet_string; - - assert(type != NULL && type->tp_alloc != NULL); - - if (not_yet_string == NULL) { - not_yet_string = PyString_InternFromString(""); - if (not_yet_string == NULL) - return NULL; - } - - self = type->tp_alloc(type, 0); - if (self != NULL) { - /* Always fill in the name and mode, so that nobody else - needs to special-case NULLs there. */ - Py_INCREF(not_yet_string); - ((PyFileObject *)self)->f_name = not_yet_string; - Py_INCREF(not_yet_string); - ((PyFileObject *)self)->f_mode = not_yet_string; - Py_INCREF(Py_None); - ((PyFileObject *)self)->f_encoding = Py_None; - Py_INCREF(Py_None); - ((PyFileObject *)self)->f_errors = Py_None; - ((PyFileObject *)self)->weakreflist = NULL; - ((PyFileObject *)self)->unlocked_count = 0; - } - return self; -} - -static int -file_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyFileObject *foself = (PyFileObject *)self; - int ret = 0; - static char *kwlist[] = {"name", "mode", "buffering", 0}; - char *name = NULL; - char *mode = "r"; - int bufsize = -1; - int wideargument = 0; -#ifdef MS_WINDOWS - PyObject *po; -#endif - - assert(PyFile_Check(self)); - if (foself->f_fp != NULL) { - /* Have to close the existing file first. */ - PyObject *closeresult = file_close(foself); - if (closeresult == NULL) - return -1; - Py_DECREF(closeresult); - } - -#ifdef MS_WINDOWS - if (PyArg_ParseTupleAndKeywords(args, kwds, "U|si:file", - kwlist, &po, &mode, &bufsize)) { - wideargument = 1; - if (fill_file_fields(foself, NULL, po, mode, - fclose) == NULL) - goto Error; - } else { - /* Drop the argument parsing error as narrow - strings are also valid. */ - PyErr_Clear(); - } -#endif - - if (!wideargument) { - PyObject *o_name; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "et|si:file", kwlist, - Py_FileSystemDefaultEncoding, - &name, - &mode, &bufsize)) - return -1; - - /* We parse again to get the name as a PyObject */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|si:file", - kwlist, &o_name, &mode, - &bufsize)) - goto Error; - - if (fill_file_fields(foself, NULL, o_name, mode, - fclose) == NULL) - goto Error; - } - if (open_the_file(foself, name, mode) == NULL) - goto Error; - foself->f_setbuf = NULL; - PyFile_SetBufSize(self, bufsize); - goto Done; - -Error: - ret = -1; - /* fall through */ -Done: - PyMem_Free(name); /* free the encoded string */ - return ret; -} - -PyDoc_VAR(file_doc) = -PyDoc_STR( -"file(name[, mode[, buffering]]) -> file object\n" -"\n" -"Open a file. The mode can be 'r', 'w' or 'a' for reading (default),\n" -"writing or appending. The file will be created if it doesn't exist\n" -"when opened for writing or appending; it will be truncated when\n" -"opened for writing. Add a 'b' to the mode for binary files.\n" -"Add a '+' to the mode to allow simultaneous reading and writing.\n" -"If the buffering argument is given, 0 means unbuffered, 1 means line\n" -"buffered, and larger numbers specify the buffer size. The preferred way\n" -"to open a file is with the builtin open() function.\n" -) -PyDoc_STR( -"Add a 'U' to mode to open the file for input with universal newline\n" -"support. Any line ending in the input file will be seen as a '\\n'\n" -"in Python. Also, a file so opened gains the attribute 'newlines';\n" -"the value for this attribute is one of None (no newline read yet),\n" -"'\\r', '\\n', '\\r\\n' or a tuple containing all the newline types seen.\n" -"\n" -"'U' cannot be combined with 'w' or '+' mode.\n" -); - -PyTypeObject PyFile_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "file", - sizeof(PyFileObject), - 0, - (destructor)file_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)file_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - /* softspace is writable: we must supply tp_setattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_WEAKREFS, /* tp_flags */ - file_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyFileObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)file_self, /* tp_iter */ - (iternextfunc)file_iternext, /* tp_iternext */ - file_methods, /* tp_methods */ - file_memberlist, /* tp_members */ - file_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - file_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - file_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -/* Interface for the 'soft space' between print items. */ - -int -PyFile_SoftSpace(PyObject *f, int newflag) -{ - long oldflag = 0; - if (f == NULL) { - /* Do nothing */ - } - else if (PyFile_Check(f)) { - oldflag = ((PyFileObject *)f)->f_softspace; - ((PyFileObject *)f)->f_softspace = newflag; - } - else { - PyObject *v; - v = PyObject_GetAttrString(f, "softspace"); - if (v == NULL) - PyErr_Clear(); - else { - if (PyInt_Check(v)) - oldflag = PyInt_AsLong(v); - assert(oldflag < INT_MAX); - Py_DECREF(v); - } - v = PyInt_FromLong((long)newflag); - if (v == NULL) - PyErr_Clear(); - else { - if (PyObject_SetAttrString(f, "softspace", v) != 0) - PyErr_Clear(); - Py_DECREF(v); - } - } - return (int)oldflag; -} - -/* Interfaces to write objects/strings to file-like objects */ - -int -PyFile_WriteObject(PyObject *v, PyObject *f, int flags) -{ - PyObject *writer, *value, *args, *result; - if (f == NULL) { - PyErr_SetString(PyExc_TypeError, "writeobject with NULL file"); - return -1; - } - else if (PyFile_Check(f)) { - PyFileObject *fobj = (PyFileObject *) f; -#ifdef Py_USING_UNICODE - PyObject *enc = fobj->f_encoding; - int result; -#endif - if (fobj->f_fp == NULL) { - err_closed(); - return -1; - } -#ifdef Py_USING_UNICODE - if ((flags & Py_PRINT_RAW) && - PyUnicode_Check(v) && enc != Py_None) { - char *cenc = PyString_AS_STRING(enc); - char *errors = fobj->f_errors == Py_None ? - "strict" : PyString_AS_STRING(fobj->f_errors); - value = PyUnicode_AsEncodedString(v, cenc, errors); - if (value == NULL) - return -1; - } else { - value = v; - Py_INCREF(value); - } - result = file_PyObject_Print(value, fobj, flags); - Py_DECREF(value); - return result; -#else - return file_PyObject_Print(v, fobj, flags); -#endif - } - writer = PyObject_GetAttrString(f, "write"); - if (writer == NULL) - return -1; - if (flags & Py_PRINT_RAW) { - if (PyUnicode_Check(v)) { - value = v; - Py_INCREF(value); - } else - value = PyObject_Str(v); - } - else - value = PyObject_Repr(v); - if (value == NULL) { - Py_DECREF(writer); - return -1; - } - args = PyTuple_Pack(1, value); - if (args == NULL) { - Py_DECREF(value); - Py_DECREF(writer); - return -1; - } - result = PyEval_CallObject(writer, args); - Py_DECREF(args); - Py_DECREF(value); - Py_DECREF(writer); - if (result == NULL) - return -1; - Py_DECREF(result); - return 0; -} - -int -PyFile_WriteString(const char *s, PyObject *f) -{ - - if (f == NULL) { - /* Should be caused by a pre-existing error */ - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, - "null file for PyFile_WriteString"); - return -1; - } - else if (PyFile_Check(f)) { - PyFileObject *fobj = (PyFileObject *) f; - FILE *fp = PyFile_AsFile(f); - if (fp == NULL) { - err_closed(); - return -1; - } - FILE_BEGIN_ALLOW_THREADS(fobj) - fputs(s, fp); - FILE_END_ALLOW_THREADS(fobj) - return 0; - } - else if (!PyErr_Occurred()) { - PyObject *v = PyString_FromString(s); - int err; - if (v == NULL) - return -1; - err = PyFile_WriteObject(v, f, Py_PRINT_RAW); - Py_DECREF(v); - return err; - } - else - return -1; -} - -/* Try to get a file-descriptor from a Python object. If the object - is an integer or long integer, its value is returned. If not, the - object's fileno() method is called if it exists; the method must return - an integer or long integer, which is returned as the file descriptor value. - -1 is returned on failure. -*/ - -int PyObject_AsFileDescriptor(PyObject *o) -{ - int fd; - PyObject *meth; - - if (PyInt_Check(o)) { - fd = _PyInt_AsInt(o); - } - else if (PyLong_Check(o)) { - fd = _PyLong_AsInt(o); - } - else if ((meth = PyObject_GetAttrString(o, "fileno")) != NULL) - { - PyObject *fno = PyEval_CallObject(meth, NULL); - Py_DECREF(meth); - if (fno == NULL) - return -1; - - if (PyInt_Check(fno)) { - fd = _PyInt_AsInt(fno); - Py_DECREF(fno); - } - else if (PyLong_Check(fno)) { - fd = _PyLong_AsInt(fno); - Py_DECREF(fno); - } - else { - PyErr_SetString(PyExc_TypeError, - "fileno() returned a non-integer"); - Py_DECREF(fno); - return -1; - } - } - else { - PyErr_SetString(PyExc_TypeError, - "argument must be an int, or have a fileno() method."); - return -1; - } - - if (fd < 0) { - PyErr_Format(PyExc_ValueError, - "file descriptor cannot be a negative integer (%i)", - fd); - return -1; - } - return fd; -} - -/* From here on we need access to the real fgets and fread */ -#undef fgets -#undef fread - -/* -** Py_UniversalNewlineFgets is an fgets variation that understands -** all of \r, \n and \r\n conventions. -** The stream should be opened in binary mode. -** If fobj is NULL the routine always does newline conversion, and -** it may peek one char ahead to gobble the second char in \r\n. -** If fobj is non-NULL it must be a PyFileObject. In this case there -** is no readahead but in stead a flag is used to skip a following -** \n on the next read. Also, if the file is open in binary mode -** the whole conversion is skipped. Finally, the routine keeps track of -** the different types of newlines seen. -** Note that we need no error handling: fgets() treats error and eof -** identically. -*/ -char * -Py_UniversalNewlineFgets(char *buf, int n, FILE *stream, PyObject *fobj) -{ - char *p = buf; - int c; - int newlinetypes = 0; - int skipnextlf = 0; - int univ_newline = 1; - - if (fobj) { - if (!PyFile_Check(fobj)) { - errno = ENXIO; /* What can you do... */ - return NULL; - } - univ_newline = ((PyFileObject *)fobj)->f_univ_newline; - if ( !univ_newline ) - return fgets(buf, n, stream); - newlinetypes = ((PyFileObject *)fobj)->f_newlinetypes; - skipnextlf = ((PyFileObject *)fobj)->f_skipnextlf; - } - FLOCKFILE(stream); - c = 'x'; /* Shut up gcc warning */ - while (--n > 0 && (c = GETC(stream)) != EOF ) { - if (skipnextlf ) { - skipnextlf = 0; - if (c == '\n') { - /* Seeing a \n here with skipnextlf true - ** means we saw a \r before. - */ - newlinetypes |= NEWLINE_CRLF; - c = GETC(stream); - if (c == EOF) break; - } else { - /* - ** Note that c == EOF also brings us here, - ** so we're okay if the last char in the file - ** is a CR. - */ - newlinetypes |= NEWLINE_CR; - } - } - if (c == '\r') { - /* A \r is translated into a \n, and we skip - ** an adjacent \n, if any. We don't set the - ** newlinetypes flag until we've seen the next char. - */ - skipnextlf = 1; - c = '\n'; - } else if ( c == '\n') { - newlinetypes |= NEWLINE_LF; - } - *p++ = c; - if (c == '\n') break; - } - if ( c == EOF && skipnextlf ) - newlinetypes |= NEWLINE_CR; - FUNLOCKFILE(stream); - *p = '\0'; - if (fobj) { - ((PyFileObject *)fobj)->f_newlinetypes = newlinetypes; - ((PyFileObject *)fobj)->f_skipnextlf = skipnextlf; - } else if ( skipnextlf ) { - /* If we have no file object we cannot save the - ** skipnextlf flag. We have to readahead, which - ** will cause a pause if we're reading from an - ** interactive stream, but that is very unlikely - ** unless we're doing something silly like - ** execfile("/dev/tty"). - */ - c = GETC(stream); - if ( c != '\n' ) - ungetc(c, stream); - } - if (p == buf) - return NULL; - return buf; -} - -/* -** Py_UniversalNewlineFread is an fread variation that understands -** all of \r, \n and \r\n conventions. -** The stream should be opened in binary mode. -** fobj must be a PyFileObject. In this case there -** is no readahead but in stead a flag is used to skip a following -** \n on the next read. Also, if the file is open in binary mode -** the whole conversion is skipped. Finally, the routine keeps track of -** the different types of newlines seen. -*/ -size_t -Py_UniversalNewlineFread(char *buf, size_t n, - FILE *stream, PyObject *fobj) -{ - char *dst = buf; - PyFileObject *f = (PyFileObject *)fobj; - int newlinetypes, skipnextlf; - - assert(buf != NULL); - assert(stream != NULL); - - if (!fobj || !PyFile_Check(fobj)) { - errno = ENXIO; /* What can you do... */ - return 0; - } - if (!f->f_univ_newline) - return fread(buf, 1, n, stream); - newlinetypes = f->f_newlinetypes; - skipnextlf = f->f_skipnextlf; - /* Invariant: n is the number of bytes remaining to be filled - * in the buffer. - */ - while (n) { - size_t nread; - int shortread; - char *src = dst; - - nread = fread(dst, 1, n, stream); - assert(nread <= n); - if (nread == 0) - break; - - n -= nread; /* assuming 1 byte out for each in; will adjust */ - shortread = n != 0; /* true iff EOF or error */ - while (nread--) { - char c = *src++; - if (c == '\r') { - /* Save as LF and set flag to skip next LF. */ - *dst++ = '\n'; - skipnextlf = 1; - } - else if (skipnextlf && c == '\n') { - /* Skip LF, and remember we saw CR LF. */ - skipnextlf = 0; - newlinetypes |= NEWLINE_CRLF; - ++n; - } - else { - /* Normal char to be stored in buffer. Also - * update the newlinetypes flag if either this - * is an LF or the previous char was a CR. - */ - if (c == '\n') - newlinetypes |= NEWLINE_LF; - else if (skipnextlf) - newlinetypes |= NEWLINE_CR; - *dst++ = c; - skipnextlf = 0; - } - } - if (shortread) { - /* If this is EOF, update type flags. */ - if (skipnextlf && feof(stream)) - newlinetypes |= NEWLINE_CR; - break; - } - } - f->f_newlinetypes = newlinetypes; - f->f_skipnextlf = skipnextlf; - return dst - buf; -} - -#ifdef __cplusplus -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/floatobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/floatobject.c deleted file mode 100644 index 41db7a9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/floatobject.c +++ /dev/null @@ -1,2708 +0,0 @@ - -/* Float object implementation */ - -/* XXX There should be overflow checks here, but it's hard to check - for any kind of float exception without losing portability. */ - -#include "Python.h" -#include "structseq.h" - -#include -#include - -#undef MAX -#undef MIN -#define MAX(x, y) ((x) < (y) ? (y) : (x)) -#define MIN(x, y) ((x) < (y) ? (x) : (y)) - -#ifdef _OSF_SOURCE -/* OSF1 5.1 doesn't make this available with XOPEN_SOURCE_EXTENDED defined */ -extern int finite(double); -#endif - -/* Special free list -- see comments for same code in intobject.c. */ -#define BLOCK_SIZE 1000 /* 1K less typical malloc overhead */ -#define BHEAD_SIZE 8 /* Enough for a 64-bit pointer */ -#define N_FLOATOBJECTS ((BLOCK_SIZE - BHEAD_SIZE) / sizeof(PyFloatObject)) - -struct _floatblock { - struct _floatblock *next; - PyFloatObject objects[N_FLOATOBJECTS]; -}; - -typedef struct _floatblock PyFloatBlock; - -static PyFloatBlock *block_list = NULL; -static PyFloatObject *free_list = NULL; - -static PyFloatObject * -fill_free_list(void) -{ - PyFloatObject *p, *q; - /* XXX Float blocks escape the object heap. Use PyObject_MALLOC ??? */ - p = (PyFloatObject *) PyMem_MALLOC(sizeof(PyFloatBlock)); - if (p == NULL) - return (PyFloatObject *) PyErr_NoMemory(); - ((PyFloatBlock *)p)->next = block_list; - block_list = (PyFloatBlock *)p; - p = &((PyFloatBlock *)p)->objects[0]; - q = p + N_FLOATOBJECTS; - while (--q > p) - Py_TYPE(q) = (struct _typeobject *)(q-1); - Py_TYPE(q) = NULL; - return p + N_FLOATOBJECTS - 1; -} - -double -PyFloat_GetMax(void) -{ - return DBL_MAX; -} - -double -PyFloat_GetMin(void) -{ - return DBL_MIN; -} - -static PyTypeObject FloatInfoType = {0, 0, 0, 0, 0, 0}; - -PyDoc_STRVAR(floatinfo__doc__, -"sys.float_info\n\ -\n\ -A structseq holding information about the float type. It contains low level\n\ -information about the precision and internal representation. Please study\n\ -your system's :file:`float.h` for more information."); - -static PyStructSequence_Field floatinfo_fields[] = { - {"max", "DBL_MAX -- maximum representable finite float"}, - {"max_exp", "DBL_MAX_EXP -- maximum int e such that radix**(e-1) " - "is representable"}, - {"max_10_exp", "DBL_MAX_10_EXP -- maximum int e such that 10**e " - "is representable"}, - {"min", "DBL_MIN -- Minimum positive normalizer float"}, - {"min_exp", "DBL_MIN_EXP -- minimum int e such that radix**(e-1) " - "is a normalized float"}, - {"min_10_exp", "DBL_MIN_10_EXP -- minimum int e such that 10**e is " - "a normalized"}, - {"dig", "DBL_DIG -- digits"}, - {"mant_dig", "DBL_MANT_DIG -- mantissa digits"}, - {"epsilon", "DBL_EPSILON -- Difference between 1 and the next " - "representable float"}, - {"radix", "FLT_RADIX -- radix of exponent"}, - {"rounds", "FLT_ROUNDS -- addition rounds"}, - {0} -}; - -static PyStructSequence_Desc floatinfo_desc = { - "sys.float_info", /* name */ - floatinfo__doc__, /* doc */ - floatinfo_fields, /* fields */ - 11 -}; - -PyObject * -PyFloat_GetInfo(void) -{ - PyObject* floatinfo; - int pos = 0; - - floatinfo = PyStructSequence_New(&FloatInfoType); - if (floatinfo == NULL) { - return NULL; - } - -#define SetIntFlag(flag) \ - PyStructSequence_SET_ITEM(floatinfo, pos++, PyInt_FromLong(flag)) -#define SetDblFlag(flag) \ - PyStructSequence_SET_ITEM(floatinfo, pos++, PyFloat_FromDouble(flag)) - - SetDblFlag(DBL_MAX); - SetIntFlag(DBL_MAX_EXP); - SetIntFlag(DBL_MAX_10_EXP); - SetDblFlag(DBL_MIN); - SetIntFlag(DBL_MIN_EXP); - SetIntFlag(DBL_MIN_10_EXP); - SetIntFlag(DBL_DIG); - SetIntFlag(DBL_MANT_DIG); - SetDblFlag(DBL_EPSILON); - SetIntFlag(FLT_RADIX); - SetIntFlag(FLT_ROUNDS); -#undef SetIntFlag -#undef SetDblFlag - - if (PyErr_Occurred()) { - Py_CLEAR(floatinfo); - return NULL; - } - return floatinfo; -} - -PyObject * -PyFloat_FromDouble(double fval) -{ - register PyFloatObject *op; - if (free_list == NULL) { - if ((free_list = fill_free_list()) == NULL) - return NULL; - } - /* Inline PyObject_New */ - op = free_list; - free_list = (PyFloatObject *)Py_TYPE(op); - PyObject_INIT(op, &PyFloat_Type); - op->ob_fval = fval; - return (PyObject *) op; -} - -/************************************************************************** -RED_FLAG 22-Sep-2000 tim -PyFloat_FromString's pend argument is braindead. Prior to this RED_FLAG, - -1. If v was a regular string, *pend was set to point to its terminating - null byte. That's useless (the caller can find that without any - help from this function!). - -2. If v was a Unicode string, or an object convertible to a character - buffer, *pend was set to point into stack trash (the auto temp - vector holding the character buffer). That was downright dangerous. - -Since we can't change the interface of a public API function, pend is -still supported but now *officially* useless: if pend is not NULL, -*pend is set to NULL. -**************************************************************************/ -PyObject * -PyFloat_FromString(PyObject *v, char **pend) -{ - const char *s, *last, *end; - double x; - char buffer[256]; /* for errors */ -#ifdef Py_USING_UNICODE - char *s_buffer = NULL; -#endif - Py_ssize_t len; - PyObject *result = NULL; - - if (pend) - *pend = NULL; - if (PyString_Check(v)) { - s = PyString_AS_STRING(v); - len = PyString_GET_SIZE(v); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(v)) { - s_buffer = (char *)PyMem_MALLOC(PyUnicode_GET_SIZE(v)+1); - if (s_buffer == NULL) - return PyErr_NoMemory(); - if (PyUnicode_EncodeDecimal(PyUnicode_AS_UNICODE(v), - PyUnicode_GET_SIZE(v), - s_buffer, - NULL)) - goto error; - s = s_buffer; - len = strlen(s); - } -#endif - else if (PyObject_AsCharBuffer(v, &s, &len)) { - PyErr_SetString(PyExc_TypeError, - "float() argument must be a string or a number"); - return NULL; - } - last = s + len; - - while (Py_ISSPACE(*s)) - s++; - /* We don't care about overflow or underflow. If the platform - * supports them, infinities and signed zeroes (on underflow) are - * fine. */ - x = PyOS_string_to_double(s, (char **)&end, NULL); - if (x == -1.0 && PyErr_Occurred()) - goto error; - while (Py_ISSPACE(*end)) - end++; - if (end == last) - result = PyFloat_FromDouble(x); - else { - PyOS_snprintf(buffer, sizeof(buffer), - "invalid literal for float(): %.200s", s); - PyErr_SetString(PyExc_ValueError, buffer); - result = NULL; - } - - error: -#ifdef Py_USING_UNICODE - if (s_buffer) - PyMem_FREE(s_buffer); -#endif - return result; -} - -static void -float_dealloc(PyFloatObject *op) -{ - if (PyFloat_CheckExact(op)) { - Py_TYPE(op) = (struct _typeobject *)free_list; - free_list = op; - } - else - Py_TYPE(op)->tp_free((PyObject *)op); -} - -double -PyFloat_AsDouble(PyObject *op) -{ - PyNumberMethods *nb; - PyFloatObject *fo; - double val; - - if (op && PyFloat_Check(op)) - return PyFloat_AS_DOUBLE((PyFloatObject*) op); - - if (op == NULL) { - PyErr_BadArgument(); - return -1; - } - - if ((nb = Py_TYPE(op)->tp_as_number) == NULL || nb->nb_float == NULL) { - PyErr_SetString(PyExc_TypeError, "a float is required"); - return -1; - } - - fo = (PyFloatObject*) (*nb->nb_float) (op); - if (fo == NULL) - return -1; - if (!PyFloat_Check(fo)) { - Py_DECREF(fo); - PyErr_SetString(PyExc_TypeError, - "nb_float should return float object"); - return -1; - } - - val = PyFloat_AS_DOUBLE(fo); - Py_DECREF(fo); - - return val; -} - -/* Methods */ - -/* Macro and helper that convert PyObject obj to a C double and store - the value in dbl; this replaces the functionality of the coercion - slot function. If conversion to double raises an exception, obj is - set to NULL, and the function invoking this macro returns NULL. If - obj is not of float, int or long type, Py_NotImplemented is incref'ed, - stored in obj, and returned from the function invoking this macro. -*/ -#define CONVERT_TO_DOUBLE(obj, dbl) \ - if (PyFloat_Check(obj)) \ - dbl = PyFloat_AS_DOUBLE(obj); \ - else if (convert_to_double(&(obj), &(dbl)) < 0) \ - return obj; - -static int -convert_to_double(PyObject **v, double *dbl) -{ - register PyObject *obj = *v; - - if (PyInt_Check(obj)) { - *dbl = (double)PyInt_AS_LONG(obj); - } - else if (PyLong_Check(obj)) { - *dbl = PyLong_AsDouble(obj); - if (*dbl == -1.0 && PyErr_Occurred()) { - *v = NULL; - return -1; - } - } - else { - Py_INCREF(Py_NotImplemented); - *v = Py_NotImplemented; - return -1; - } - return 0; -} - -/* XXX PyFloat_AsString and PyFloat_AsReprString are deprecated: - XXX they pass a char buffer without passing a length. -*/ -void -PyFloat_AsString(char *buf, PyFloatObject *v) -{ - char *tmp = PyOS_double_to_string(v->ob_fval, 'g', - PyFloat_STR_PRECISION, - Py_DTSF_ADD_DOT_0, NULL); - strcpy(buf, tmp); - PyMem_Free(tmp); -} - -void -PyFloat_AsReprString(char *buf, PyFloatObject *v) -{ - char * tmp = PyOS_double_to_string(v->ob_fval, 'r', 0, - Py_DTSF_ADD_DOT_0, NULL); - strcpy(buf, tmp); - PyMem_Free(tmp); -} - -/* ARGSUSED */ -static int -float_print(PyFloatObject *v, FILE *fp, int flags) -{ - char *buf; - if (flags & Py_PRINT_RAW) - buf = PyOS_double_to_string(v->ob_fval, - 'g', PyFloat_STR_PRECISION, - Py_DTSF_ADD_DOT_0, NULL); - else - buf = PyOS_double_to_string(v->ob_fval, - 'r', 0, Py_DTSF_ADD_DOT_0, NULL); - Py_BEGIN_ALLOW_THREADS - fputs(buf, fp); - Py_END_ALLOW_THREADS - PyMem_Free(buf); - return 0; -} - -static PyObject * -float_str_or_repr(PyFloatObject *v, int precision, char format_code) -{ - PyObject *result; - char *buf = PyOS_double_to_string(PyFloat_AS_DOUBLE(v), - format_code, precision, - Py_DTSF_ADD_DOT_0, - NULL); - if (!buf) - return PyErr_NoMemory(); - result = PyString_FromString(buf); - PyMem_Free(buf); - return result; -} - -static PyObject * -float_repr(PyFloatObject *v) -{ - return float_str_or_repr(v, 0, 'r'); -} - -static PyObject * -float_str(PyFloatObject *v) -{ - return float_str_or_repr(v, PyFloat_STR_PRECISION, 'g'); -} - -/* Comparison is pretty much a nightmare. When comparing float to float, - * we do it as straightforwardly (and long-windedly) as conceivable, so - * that, e.g., Python x == y delivers the same result as the platform - * C x == y when x and/or y is a NaN. - * When mixing float with an integer type, there's no good *uniform* approach. - * Converting the double to an integer obviously doesn't work, since we - * may lose info from fractional bits. Converting the integer to a double - * also has two failure modes: (1) a long int may trigger overflow (too - * large to fit in the dynamic range of a C double); (2) even a C long may have - * more bits than fit in a C double (e.g., on a a 64-bit box long may have - * 63 bits of precision, but a C double probably has only 53), and then - * we can falsely claim equality when low-order integer bits are lost by - * coercion to double. So this part is painful too. - */ - -static PyObject* -float_richcompare(PyObject *v, PyObject *w, int op) -{ - double i, j; - int r = 0; - - assert(PyFloat_Check(v)); - i = PyFloat_AS_DOUBLE(v); - - /* Switch on the type of w. Set i and j to doubles to be compared, - * and op to the richcomp to use. - */ - if (PyFloat_Check(w)) - j = PyFloat_AS_DOUBLE(w); - - else if (!Py_IS_FINITE(i)) { - if (PyInt_Check(w) || PyLong_Check(w)) - /* If i is an infinity, its magnitude exceeds any - * finite integer, so it doesn't matter which int we - * compare i with. If i is a NaN, similarly. - */ - j = 0.0; - else - goto Unimplemented; - } - - else if (PyInt_Check(w)) { - long jj = PyInt_AS_LONG(w); - /* In the worst realistic case I can imagine, C double is a - * Cray single with 48 bits of precision, and long has 64 - * bits. - */ -#if SIZEOF_LONG > 6 - unsigned long abs = (unsigned long)(jj < 0 ? -jj : jj); - if (abs >> 48) { - /* Needs more than 48 bits. Make it take the - * PyLong path. - */ - PyObject *result; - PyObject *ww = PyLong_FromLong(jj); - - if (ww == NULL) - return NULL; - result = float_richcompare(v, ww, op); - Py_DECREF(ww); - return result; - } -#endif - j = (double)jj; - assert((long)j == jj); - } - - else if (PyLong_Check(w)) { - int vsign = i == 0.0 ? 0 : i < 0.0 ? -1 : 1; - int wsign = _PyLong_Sign(w); - size_t nbits; - int exponent; - - if (vsign != wsign) { - /* Magnitudes are irrelevant -- the signs alone - * determine the outcome. - */ - i = (double)vsign; - j = (double)wsign; - goto Compare; - } - /* The signs are the same. */ - /* Convert w to a double if it fits. In particular, 0 fits. */ - nbits = _PyLong_NumBits(w); - if (nbits == (size_t)-1 && PyErr_Occurred()) { - /* This long is so large that size_t isn't big enough - * to hold the # of bits. Replace with little doubles - * that give the same outcome -- w is so large that - * its magnitude must exceed the magnitude of any - * finite float. - */ - PyErr_Clear(); - i = (double)vsign; - assert(wsign != 0); - j = wsign * 2.0; - goto Compare; - } - if (nbits <= 48) { - j = PyLong_AsDouble(w); - /* It's impossible that <= 48 bits overflowed. */ - assert(j != -1.0 || ! PyErr_Occurred()); - goto Compare; - } - assert(wsign != 0); /* else nbits was 0 */ - assert(vsign != 0); /* if vsign were 0, then since wsign is - * not 0, we would have taken the - * vsign != wsign branch at the start */ - /* We want to work with non-negative numbers. */ - if (vsign < 0) { - /* "Multiply both sides" by -1; this also swaps the - * comparator. - */ - i = -i; - op = _Py_SwappedOp[op]; - } - assert(i > 0.0); - (void) frexp(i, &exponent); - /* exponent is the # of bits in v before the radix point; - * we know that nbits (the # of bits in w) > 48 at this point - */ - if (exponent < 0 || (size_t)exponent < nbits) { - i = 1.0; - j = 2.0; - goto Compare; - } - if ((size_t)exponent > nbits) { - i = 2.0; - j = 1.0; - goto Compare; - } - /* v and w have the same number of bits before the radix - * point. Construct two longs that have the same comparison - * outcome. - */ - { - double fracpart; - double intpart; - PyObject *result = NULL; - PyObject *one = NULL; - PyObject *vv = NULL; - PyObject *ww = w; - - if (wsign < 0) { - ww = PyNumber_Negative(w); - if (ww == NULL) - goto Error; - } - else - Py_INCREF(ww); - - fracpart = modf(i, &intpart); - vv = PyLong_FromDouble(intpart); - if (vv == NULL) - goto Error; - - if (fracpart != 0.0) { - /* Shift left, and or a 1 bit into vv - * to represent the lost fraction. - */ - PyObject *temp; - - one = PyInt_FromLong(1); - if (one == NULL) - goto Error; - - temp = PyNumber_Lshift(ww, one); - if (temp == NULL) - goto Error; - Py_DECREF(ww); - ww = temp; - - temp = PyNumber_Lshift(vv, one); - if (temp == NULL) - goto Error; - Py_DECREF(vv); - vv = temp; - - temp = PyNumber_Or(vv, one); - if (temp == NULL) - goto Error; - Py_DECREF(vv); - vv = temp; - } - - r = PyObject_RichCompareBool(vv, ww, op); - if (r < 0) - goto Error; - result = PyBool_FromLong(r); - Error: - Py_XDECREF(vv); - Py_XDECREF(ww); - Py_XDECREF(one); - return result; - } - } /* else if (PyLong_Check(w)) */ - - else /* w isn't float, int, or long */ - goto Unimplemented; - - Compare: - PyFPE_START_PROTECT("richcompare", return NULL) - switch (op) { - case Py_EQ: - r = i == j; - break; - case Py_NE: - r = i != j; - break; - case Py_LE: - r = i <= j; - break; - case Py_GE: - r = i >= j; - break; - case Py_LT: - r = i < j; - break; - case Py_GT: - r = i > j; - break; - } - PyFPE_END_PROTECT(r) - return PyBool_FromLong(r); - - Unimplemented: - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static long -float_hash(PyFloatObject *v) -{ - return _Py_HashDouble(v->ob_fval); -} - -static PyObject * -float_add(PyObject *v, PyObject *w) -{ - double a,b; - CONVERT_TO_DOUBLE(v, a); - CONVERT_TO_DOUBLE(w, b); - PyFPE_START_PROTECT("add", return 0) - a = a + b; - PyFPE_END_PROTECT(a) - return PyFloat_FromDouble(a); -} - -static PyObject * -float_sub(PyObject *v, PyObject *w) -{ - double a,b; - CONVERT_TO_DOUBLE(v, a); - CONVERT_TO_DOUBLE(w, b); - PyFPE_START_PROTECT("subtract", return 0) - a = a - b; - PyFPE_END_PROTECT(a) - return PyFloat_FromDouble(a); -} - -static PyObject * -float_mul(PyObject *v, PyObject *w) -{ - double a,b; - CONVERT_TO_DOUBLE(v, a); - CONVERT_TO_DOUBLE(w, b); - PyFPE_START_PROTECT("multiply", return 0) - a = a * b; - PyFPE_END_PROTECT(a) - return PyFloat_FromDouble(a); -} - -static PyObject * -float_div(PyObject *v, PyObject *w) -{ - double a,b; - CONVERT_TO_DOUBLE(v, a); - CONVERT_TO_DOUBLE(w, b); -#ifdef Py_NAN - if (b == 0.0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "float division by zero"); - return NULL; - } -#endif - PyFPE_START_PROTECT("divide", return 0) - a = a / b; - PyFPE_END_PROTECT(a) - return PyFloat_FromDouble(a); -} - -static PyObject * -float_classic_div(PyObject *v, PyObject *w) -{ - double a,b; - CONVERT_TO_DOUBLE(v, a); - CONVERT_TO_DOUBLE(w, b); - if (Py_DivisionWarningFlag >= 2 && - PyErr_Warn(PyExc_DeprecationWarning, "classic float division") < 0) - return NULL; -#ifdef Py_NAN - if (b == 0.0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "float division by zero"); - return NULL; - } -#endif - PyFPE_START_PROTECT("divide", return 0) - a = a / b; - PyFPE_END_PROTECT(a) - return PyFloat_FromDouble(a); -} - -static PyObject * -float_rem(PyObject *v, PyObject *w) -{ - double vx, wx; - double mod; - CONVERT_TO_DOUBLE(v, vx); - CONVERT_TO_DOUBLE(w, wx); -#ifdef Py_NAN - if (wx == 0.0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "float modulo"); - return NULL; - } -#endif - PyFPE_START_PROTECT("modulo", return 0) - mod = fmod(vx, wx); - if (mod) { - /* ensure the remainder has the same sign as the denominator */ - if ((wx < 0) != (mod < 0)) { - mod += wx; - } - } - else { - /* the remainder is zero, and in the presence of signed zeroes - fmod returns different results across platforms; ensure - it has the same sign as the denominator; we'd like to do - "mod = wx * 0.0", but that may get optimized away */ - mod *= mod; /* hide "mod = +0" from optimizer */ - if (wx < 0.0) - mod = -mod; - } - PyFPE_END_PROTECT(mod) - return PyFloat_FromDouble(mod); -} - -static PyObject * -float_divmod(PyObject *v, PyObject *w) -{ - double vx, wx; - double div, mod, floordiv; - CONVERT_TO_DOUBLE(v, vx); - CONVERT_TO_DOUBLE(w, wx); - if (wx == 0.0) { - PyErr_SetString(PyExc_ZeroDivisionError, "float divmod()"); - return NULL; - } - PyFPE_START_PROTECT("divmod", return 0) - mod = fmod(vx, wx); - /* fmod is typically exact, so vx-mod is *mathematically* an - exact multiple of wx. But this is fp arithmetic, and fp - vx - mod is an approximation; the result is that div may - not be an exact integral value after the division, although - it will always be very close to one. - */ - div = (vx - mod) / wx; - if (mod) { - /* ensure the remainder has the same sign as the denominator */ - if ((wx < 0) != (mod < 0)) { - mod += wx; - div -= 1.0; - } - } - else { - /* the remainder is zero, and in the presence of signed zeroes - fmod returns different results across platforms; ensure - it has the same sign as the denominator; we'd like to do - "mod = wx * 0.0", but that may get optimized away */ - mod *= mod; /* hide "mod = +0" from optimizer */ - if (wx < 0.0) - mod = -mod; - } - /* snap quotient to nearest integral value */ - if (div) { - floordiv = floor(div); - if (div - floordiv > 0.5) - floordiv += 1.0; - } - else { - /* div is zero - get the same sign as the true quotient */ - div *= div; /* hide "div = +0" from optimizers */ - floordiv = div * vx / wx; /* zero w/ sign of vx/wx */ - } - PyFPE_END_PROTECT(floordiv) - return Py_BuildValue("(dd)", floordiv, mod); -} - -static PyObject * -float_floor_div(PyObject *v, PyObject *w) -{ - PyObject *t, *r; - - t = float_divmod(v, w); - if (t == NULL || t == Py_NotImplemented) - return t; - assert(PyTuple_CheckExact(t)); - r = PyTuple_GET_ITEM(t, 0); - Py_INCREF(r); - Py_DECREF(t); - return r; -} - -/* determine whether x is an odd integer or not; assumes that - x is not an infinity or nan. */ -#define DOUBLE_IS_ODD_INTEGER(x) (fmod(fabs(x), 2.0) == 1.0) - -static PyObject * -float_pow(PyObject *v, PyObject *w, PyObject *z) -{ - double iv, iw, ix; - int negate_result = 0; - - if ((PyObject *)z != Py_None) { - PyErr_SetString(PyExc_TypeError, "pow() 3rd argument not " - "allowed unless all arguments are integers"); - return NULL; - } - - CONVERT_TO_DOUBLE(v, iv); - CONVERT_TO_DOUBLE(w, iw); - - /* Sort out special cases here instead of relying on pow() */ - if (iw == 0) { /* v**0 is 1, even 0**0 */ - return PyFloat_FromDouble(1.0); - } - if (Py_IS_NAN(iv)) { /* nan**w = nan, unless w == 0 */ - return PyFloat_FromDouble(iv); - } - if (Py_IS_NAN(iw)) { /* v**nan = nan, unless v == 1; 1**nan = 1 */ - return PyFloat_FromDouble(iv == 1.0 ? 1.0 : iw); - } - if (Py_IS_INFINITY(iw)) { - /* v**inf is: 0.0 if abs(v) < 1; 1.0 if abs(v) == 1; inf if - * abs(v) > 1 (including case where v infinite) - * - * v**-inf is: inf if abs(v) < 1; 1.0 if abs(v) == 1; 0.0 if - * abs(v) > 1 (including case where v infinite) - */ - iv = fabs(iv); - if (iv == 1.0) - return PyFloat_FromDouble(1.0); - else if ((iw > 0.0) == (iv > 1.0)) - return PyFloat_FromDouble(fabs(iw)); /* return inf */ - else - return PyFloat_FromDouble(0.0); - } - if (Py_IS_INFINITY(iv)) { - /* (+-inf)**w is: inf for w positive, 0 for w negative; in - * both cases, we need to add the appropriate sign if w is - * an odd integer. - */ - int iw_is_odd = DOUBLE_IS_ODD_INTEGER(iw); - if (iw > 0.0) - return PyFloat_FromDouble(iw_is_odd ? iv : fabs(iv)); - else - return PyFloat_FromDouble(iw_is_odd ? - copysign(0.0, iv) : 0.0); - } - if (iv == 0.0) { /* 0**w is: 0 for w positive, 1 for w zero - (already dealt with above), and an error - if w is negative. */ - int iw_is_odd = DOUBLE_IS_ODD_INTEGER(iw); - if (iw < 0.0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "0.0 cannot be raised to a " - "negative power"); - return NULL; - } - /* use correct sign if iw is odd */ - return PyFloat_FromDouble(iw_is_odd ? iv : 0.0); - } - - if (iv < 0.0) { - /* Whether this is an error is a mess, and bumps into libm - * bugs so we have to figure it out ourselves. - */ - if (iw != floor(iw)) { - PyErr_SetString(PyExc_ValueError, "negative number " - "cannot be raised to a fractional power"); - return NULL; - } - /* iw is an exact integer, albeit perhaps a very large - * one. Replace iv by its absolute value and remember - * to negate the pow result if iw is odd. - */ - iv = -iv; - negate_result = DOUBLE_IS_ODD_INTEGER(iw); - } - - if (iv == 1.0) { /* 1**w is 1, even 1**inf and 1**nan */ - /* (-1) ** large_integer also ends up here. Here's an - * extract from the comments for the previous - * implementation explaining why this special case is - * necessary: - * - * -1 raised to an exact integer should never be exceptional. - * Alas, some libms (chiefly glibc as of early 2003) return - * NaN and set EDOM on pow(-1, large_int) if the int doesn't - * happen to be representable in a *C* integer. That's a - * bug. - */ - return PyFloat_FromDouble(negate_result ? -1.0 : 1.0); - } - - /* Now iv and iw are finite, iw is nonzero, and iv is - * positive and not equal to 1.0. We finally allow - * the platform pow to step in and do the rest. - */ - errno = 0; - PyFPE_START_PROTECT("pow", return NULL) - ix = pow(iv, iw); - PyFPE_END_PROTECT(ix) - Py_ADJUST_ERANGE1(ix); - if (negate_result) - ix = -ix; - - if (errno != 0) { - /* We don't expect any errno value other than ERANGE, but - * the range of libm bugs appears unbounded. - */ - PyErr_SetFromErrno(errno == ERANGE ? PyExc_OverflowError : - PyExc_ValueError); - return NULL; - } - return PyFloat_FromDouble(ix); -} - -#undef DOUBLE_IS_ODD_INTEGER - -static PyObject * -float_neg(PyFloatObject *v) -{ - return PyFloat_FromDouble(-v->ob_fval); -} - -static PyObject * -float_abs(PyFloatObject *v) -{ - return PyFloat_FromDouble(fabs(v->ob_fval)); -} - -static int -float_nonzero(PyFloatObject *v) -{ - return v->ob_fval != 0.0; -} - -static int -float_coerce(PyObject **pv, PyObject **pw) -{ - if (PyInt_Check(*pw)) { - long x = PyInt_AsLong(*pw); - *pw = PyFloat_FromDouble((double)x); - Py_INCREF(*pv); - return 0; - } - else if (PyLong_Check(*pw)) { - double x = PyLong_AsDouble(*pw); - if (x == -1.0 && PyErr_Occurred()) - return -1; - *pw = PyFloat_FromDouble(x); - Py_INCREF(*pv); - return 0; - } - else if (PyFloat_Check(*pw)) { - Py_INCREF(*pv); - Py_INCREF(*pw); - return 0; - } - return 1; /* Can't do it */ -} - -static PyObject * -float_is_integer(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - PyObject *o; - - if (x == -1.0 && PyErr_Occurred()) - return NULL; - if (!Py_IS_FINITE(x)) - Py_RETURN_FALSE; - errno = 0; - PyFPE_START_PROTECT("is_integer", return NULL) - o = (floor(x) == x) ? Py_True : Py_False; - PyFPE_END_PROTECT(x) - if (errno != 0) { - PyErr_SetFromErrno(errno == ERANGE ? PyExc_OverflowError : - PyExc_ValueError); - return NULL; - } - Py_INCREF(o); - return o; -} - -#if 0 -static PyObject * -float_is_inf(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_INFINITY(x)); -} - -static PyObject * -float_is_nan(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_NAN(x)); -} - -static PyObject * -float_is_finite(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)Py_IS_FINITE(x)); -} -#endif - -static PyObject * -float_trunc(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - double wholepart; /* integral portion of x, rounded toward 0 */ - - (void)modf(x, &wholepart); - /* Try to get out cheap if this fits in a Python int. The attempt - * to cast to long must be protected, as C doesn't define what - * happens if the double is too big to fit in a long. Some rare - * systems raise an exception then (RISCOS was mentioned as one, - * and someone using a non-default option on Sun also bumped into - * that). Note that checking for <= LONG_MAX is unsafe: if a long - * has more bits of precision than a double, casting LONG_MAX to - * double may yield an approximation, and if that's rounded up, - * then, e.g., wholepart=LONG_MAX+1 would yield true from the C - * expression wholepart<=LONG_MAX, despite that wholepart is - * actually greater than LONG_MAX. However, assuming a two's complement - * machine with no trap representation, LONG_MIN will be a power of 2 (and - * hence exactly representable as a double), and LONG_MAX = -1-LONG_MIN, so - * the comparisons with (double)LONG_MIN below should be safe. - */ - if ((double)LONG_MIN <= wholepart && wholepart < -(double)LONG_MIN) { - const long aslong = (long)wholepart; - return PyInt_FromLong(aslong); - } - return PyLong_FromDouble(wholepart); -} - -static PyObject * -float_long(PyObject *v) -{ - double x = PyFloat_AsDouble(v); - return PyLong_FromDouble(x); -} - -/* _Py_double_round: rounds a finite nonzero double to the closest multiple of - 10**-ndigits; here ndigits is within reasonable bounds (typically, -308 <= - ndigits <= 323). Returns a Python float, or sets a Python error and - returns NULL on failure (OverflowError and memory errors are possible). */ - -#ifndef PY_NO_SHORT_FLOAT_REPR -/* version of _Py_double_round that uses the correctly-rounded string<->double - conversions from Python/dtoa.c */ - -/* FIVE_POW_LIMIT is the largest k such that 5**k is exactly representable as - a double. Since we're using the code in Python/dtoa.c, it should be safe - to assume that C doubles are IEEE 754 binary64 format. To be on the safe - side, we check this. */ -#if DBL_MANT_DIG == 53 -#define FIVE_POW_LIMIT 22 -#else -#error "C doubles do not appear to be IEEE 754 binary64 format" -#endif - -PyObject * -_Py_double_round(double x, int ndigits) { - - double rounded, m; - Py_ssize_t buflen, mybuflen=100; - char *buf, *buf_end, shortbuf[100], *mybuf=shortbuf; - int decpt, sign, val, halfway_case; - PyObject *result = NULL; - _Py_SET_53BIT_PRECISION_HEADER; - - /* Easy path for the common case ndigits == 0. */ - if (ndigits == 0) { - rounded = round(x); - if (fabs(rounded - x) == 0.5) - /* halfway between two integers; use round-away-from-zero */ - rounded = x + (x > 0.0 ? 0.5 : -0.5); - return PyFloat_FromDouble(rounded); - } - - /* The basic idea is very simple: convert and round the double to a - decimal string using _Py_dg_dtoa, then convert that decimal string - back to a double with _Py_dg_strtod. There's one minor difficulty: - Python 2.x expects round to do round-half-away-from-zero, while - _Py_dg_dtoa does round-half-to-even. So we need some way to detect - and correct the halfway cases. - - Detection: a halfway value has the form k * 0.5 * 10**-ndigits for - some odd integer k. Or in other words, a rational number x is - exactly halfway between two multiples of 10**-ndigits if its - 2-valuation is exactly -ndigits-1 and its 5-valuation is at least - -ndigits. For ndigits >= 0 the latter condition is automatically - satisfied for a binary float x, since any such float has - nonnegative 5-valuation. For 0 > ndigits >= -22, x needs to be an - integral multiple of 5**-ndigits; we can check this using fmod. - For -22 > ndigits, there are no halfway cases: 5**23 takes 54 bits - to represent exactly, so any odd multiple of 0.5 * 10**n for n >= - 23 takes at least 54 bits of precision to represent exactly. - - Correction: a simple strategy for dealing with halfway cases is to - (for the halfway cases only) call _Py_dg_dtoa with an argument of - ndigits+1 instead of ndigits (thus doing an exact conversion to - decimal), round the resulting string manually, and then convert - back using _Py_dg_strtod. - */ - - /* nans, infinities and zeros should have already been dealt - with by the caller (in this case, builtin_round) */ - assert(Py_IS_FINITE(x) && x != 0.0); - - /* find 2-valuation val of x */ - m = frexp(x, &val); - while (m != floor(m)) { - m *= 2.0; - val--; - } - - /* determine whether this is a halfway case */ - if (val == -ndigits-1) { - if (ndigits >= 0) - halfway_case = 1; - else if (ndigits >= -FIVE_POW_LIMIT) { - double five_pow = 1.0; - int i; - for (i=0; i < -ndigits; i++) - five_pow *= 5.0; - halfway_case = fmod(x, five_pow) == 0.0; - } - else - halfway_case = 0; - } - else - halfway_case = 0; - - /* round to a decimal string; use an extra place for halfway case */ - _Py_SET_53BIT_PRECISION_START; - buf = _Py_dg_dtoa(x, 3, ndigits+halfway_case, &decpt, &sign, &buf_end); - _Py_SET_53BIT_PRECISION_END; - if (buf == NULL) { - PyErr_NoMemory(); - return NULL; - } - buflen = buf_end - buf; - - /* in halfway case, do the round-half-away-from-zero manually */ - if (halfway_case) { - int i, carry; - /* sanity check: _Py_dg_dtoa should not have stripped - any zeros from the result: there should be exactly - ndigits+1 places following the decimal point, and - the last digit in the buffer should be a '5'.*/ - assert(buflen - decpt == ndigits+1); - assert(buf[buflen-1] == '5'); - - /* increment and shift right at the same time. */ - decpt += 1; - carry = 1; - for (i=buflen-1; i-- > 0;) { - carry += buf[i] - '0'; - buf[i+1] = carry % 10 + '0'; - carry /= 10; - } - buf[0] = carry + '0'; - } - - /* Get new buffer if shortbuf is too small. Space needed <= buf_end - - buf + 8: (1 extra for '0', 1 for sign, 5 for exp, 1 for '\0'). */ - if (buflen + 8 > mybuflen) { - mybuflen = buflen+8; - mybuf = (char *)PyMem_Malloc(mybuflen); - if (mybuf == NULL) { - PyErr_NoMemory(); - goto exit; - } - } - /* copy buf to mybuf, adding exponent, sign and leading 0 */ - PyOS_snprintf(mybuf, mybuflen, "%s0%se%d", (sign ? "-" : ""), - buf, decpt - (int)buflen); - - /* and convert the resulting string back to a double */ - errno = 0; - _Py_SET_53BIT_PRECISION_START; - rounded = _Py_dg_strtod(mybuf, NULL); - _Py_SET_53BIT_PRECISION_END; - if (errno == ERANGE && fabs(rounded) >= 1.) - PyErr_SetString(PyExc_OverflowError, - "rounded value too large to represent"); - else - result = PyFloat_FromDouble(rounded); - - /* done computing value; now clean up */ - if (mybuf != shortbuf) - PyMem_Free(mybuf); - exit: - _Py_dg_freedtoa(buf); - return result; -} - -#undef FIVE_POW_LIMIT - -#else /* PY_NO_SHORT_FLOAT_REPR */ - -/* fallback version, to be used when correctly rounded binary<->decimal - conversions aren't available */ - -PyObject * -_Py_double_round(double x, int ndigits) { - double pow1, pow2, y, z; - if (ndigits >= 0) { - if (ndigits > 22) { - /* pow1 and pow2 are each safe from overflow, but - pow1*pow2 ~= pow(10.0, ndigits) might overflow */ - pow1 = pow(10.0, (double)(ndigits-22)); - pow2 = 1e22; - } - else { - pow1 = pow(10.0, (double)ndigits); - pow2 = 1.0; - } - y = (x*pow1)*pow2; - /* if y overflows, then rounded value is exactly x */ - if (!Py_IS_FINITE(y)) - return PyFloat_FromDouble(x); - } - else { - pow1 = pow(10.0, (double)-ndigits); - pow2 = 1.0; /* unused; silences a gcc compiler warning */ - y = x / pow1; - } - - z = round(y); - if (fabs(y-z) == 0.5) - /* halfway between two integers; use round-away-from-zero */ - z = y + copysign(0.5, y); - - if (ndigits >= 0) - z = (z / pow2) / pow1; - else - z *= pow1; - - /* if computation resulted in overflow, raise OverflowError */ - if (!Py_IS_FINITE(z)) { - PyErr_SetString(PyExc_OverflowError, - "overflow occurred during round"); - return NULL; - } - - return PyFloat_FromDouble(z); -} - -#endif /* PY_NO_SHORT_FLOAT_REPR */ - -static PyObject * -float_float(PyObject *v) -{ - if (PyFloat_CheckExact(v)) - Py_INCREF(v); - else - v = PyFloat_FromDouble(((PyFloatObject *)v)->ob_fval); - return v; -} - -/* turn ASCII hex characters into integer values and vice versa */ - -static char -char_from_hex(int x) -{ - assert(0 <= x && x < 16); - return "0123456789abcdef"[x]; -} - -static int -hex_from_char(char c) { - int x; - switch(c) { - case '0': - x = 0; - break; - case '1': - x = 1; - break; - case '2': - x = 2; - break; - case '3': - x = 3; - break; - case '4': - x = 4; - break; - case '5': - x = 5; - break; - case '6': - x = 6; - break; - case '7': - x = 7; - break; - case '8': - x = 8; - break; - case '9': - x = 9; - break; - case 'a': - case 'A': - x = 10; - break; - case 'b': - case 'B': - x = 11; - break; - case 'c': - case 'C': - x = 12; - break; - case 'd': - case 'D': - x = 13; - break; - case 'e': - case 'E': - x = 14; - break; - case 'f': - case 'F': - x = 15; - break; - default: - x = -1; - break; - } - return x; -} - -/* convert a float to a hexadecimal string */ - -/* TOHEX_NBITS is DBL_MANT_DIG rounded up to the next integer - of the form 4k+1. */ -#define TOHEX_NBITS DBL_MANT_DIG + 3 - (DBL_MANT_DIG+2)%4 - -static PyObject * -float_hex(PyObject *v) -{ - double x, m; - int e, shift, i, si, esign; - /* Space for 1+(TOHEX_NBITS-1)/4 digits, a decimal point, and the - trailing NUL byte. */ - char s[(TOHEX_NBITS-1)/4+3]; - - CONVERT_TO_DOUBLE(v, x); - - if (Py_IS_NAN(x) || Py_IS_INFINITY(x)) - return float_str((PyFloatObject *)v); - - if (x == 0.0) { - if (copysign(1.0, x) == -1.0) - return PyString_FromString("-0x0.0p+0"); - else - return PyString_FromString("0x0.0p+0"); - } - - m = frexp(fabs(x), &e); - shift = 1 - MAX(DBL_MIN_EXP - e, 0); - m = ldexp(m, shift); - e -= shift; - - si = 0; - s[si] = char_from_hex((int)m); - si++; - m -= (int)m; - s[si] = '.'; - si++; - for (i=0; i < (TOHEX_NBITS-1)/4; i++) { - m *= 16.0; - s[si] = char_from_hex((int)m); - si++; - m -= (int)m; - } - s[si] = '\0'; - - if (e < 0) { - esign = (int)'-'; - e = -e; - } - else - esign = (int)'+'; - - if (x < 0.0) - return PyString_FromFormat("-0x%sp%c%d", s, esign, e); - else - return PyString_FromFormat("0x%sp%c%d", s, esign, e); -} - -PyDoc_STRVAR(float_hex_doc, -"float.hex() -> string\n\ -\n\ -Return a hexadecimal representation of a floating-point number.\n\ ->>> (-0.1).hex()\n\ -'-0x1.999999999999ap-4'\n\ ->>> 3.14159.hex()\n\ -'0x1.921f9f01b866ep+1'"); - -/* Case-insensitive locale-independent string match used for nan and inf - detection. t should be lower-case and null-terminated. Return a nonzero - result if the first strlen(t) characters of s match t and 0 otherwise. */ - -static int -case_insensitive_match(const char *s, const char *t) -{ - while(*t && Py_TOLOWER(*s) == *t) { - s++; - t++; - } - return *t ? 0 : 1; -} - -/* Convert a hexadecimal string to a float. */ - -static PyObject * -float_fromhex(PyObject *cls, PyObject *arg) -{ - PyObject *result_as_float, *result; - double x; - long exp, top_exp, lsb, key_digit; - char *s, *coeff_start, *s_store, *coeff_end, *exp_start, *s_end; - int half_eps, digit, round_up, sign=1; - Py_ssize_t length, ndigits, fdigits, i; - - /* - * For the sake of simplicity and correctness, we impose an artificial - * limit on ndigits, the total number of hex digits in the coefficient - * The limit is chosen to ensure that, writing exp for the exponent, - * - * (1) if exp > LONG_MAX/2 then the value of the hex string is - * guaranteed to overflow (provided it's nonzero) - * - * (2) if exp < LONG_MIN/2 then the value of the hex string is - * guaranteed to underflow to 0. - * - * (3) if LONG_MIN/2 <= exp <= LONG_MAX/2 then there's no danger of - * overflow in the calculation of exp and top_exp below. - * - * More specifically, ndigits is assumed to satisfy the following - * inequalities: - * - * 4*ndigits <= DBL_MIN_EXP - DBL_MANT_DIG - LONG_MIN/2 - * 4*ndigits <= LONG_MAX/2 + 1 - DBL_MAX_EXP - * - * If either of these inequalities is not satisfied, a ValueError is - * raised. Otherwise, write x for the value of the hex string, and - * assume x is nonzero. Then - * - * 2**(exp-4*ndigits) <= |x| < 2**(exp+4*ndigits). - * - * Now if exp > LONG_MAX/2 then: - * - * exp - 4*ndigits >= LONG_MAX/2 + 1 - (LONG_MAX/2 + 1 - DBL_MAX_EXP) - * = DBL_MAX_EXP - * - * so |x| >= 2**DBL_MAX_EXP, which is too large to be stored in C - * double, so overflows. If exp < LONG_MIN/2, then - * - * exp + 4*ndigits <= LONG_MIN/2 - 1 + ( - * DBL_MIN_EXP - DBL_MANT_DIG - LONG_MIN/2) - * = DBL_MIN_EXP - DBL_MANT_DIG - 1 - * - * and so |x| < 2**(DBL_MIN_EXP-DBL_MANT_DIG-1), hence underflows to 0 - * when converted to a C double. - * - * It's easy to show that if LONG_MIN/2 <= exp <= LONG_MAX/2 then both - * exp+4*ndigits and exp-4*ndigits are within the range of a long. - */ - - if (PyString_AsStringAndSize(arg, &s, &length)) - return NULL; - s_end = s + length; - - /******************** - * Parse the string * - ********************/ - - /* leading whitespace and optional sign */ - while (Py_ISSPACE(*s)) - s++; - if (*s == '-') { - s++; - sign = -1; - } - else if (*s == '+') - s++; - - /* infinities and nans */ - if (*s == 'i' || *s == 'I') { - if (!case_insensitive_match(s+1, "nf")) - goto parse_error; - s += 3; - x = Py_HUGE_VAL; - if (case_insensitive_match(s, "inity")) - s += 5; - goto finished; - } - if (*s == 'n' || *s == 'N') { - if (!case_insensitive_match(s+1, "an")) - goto parse_error; - s += 3; - x = Py_NAN; - goto finished; - } - - /* [0x] */ - s_store = s; - if (*s == '0') { - s++; - if (*s == 'x' || *s == 'X') - s++; - else - s = s_store; - } - - /* coefficient: [. ] */ - coeff_start = s; - while (hex_from_char(*s) >= 0) - s++; - s_store = s; - if (*s == '.') { - s++; - while (hex_from_char(*s) >= 0) - s++; - coeff_end = s-1; - } - else - coeff_end = s; - - /* ndigits = total # of hex digits; fdigits = # after point */ - ndigits = coeff_end - coeff_start; - fdigits = coeff_end - s_store; - if (ndigits == 0) - goto parse_error; - if (ndigits > MIN(DBL_MIN_EXP - DBL_MANT_DIG - LONG_MIN/2, - LONG_MAX/2 + 1 - DBL_MAX_EXP)/4) - goto insane_length_error; - - /* [p ] */ - if (*s == 'p' || *s == 'P') { - s++; - exp_start = s; - if (*s == '-' || *s == '+') - s++; - if (!('0' <= *s && *s <= '9')) - goto parse_error; - s++; - while ('0' <= *s && *s <= '9') - s++; - exp = strtol(exp_start, NULL, 10); - } - else - exp = 0; - -/* for 0 <= j < ndigits, HEX_DIGIT(j) gives the jth most significant digit */ -#define HEX_DIGIT(j) hex_from_char(*((j) < fdigits ? \ - coeff_end-(j) : \ - coeff_end-1-(j))) - - /******************************************* - * Compute rounded value of the hex string * - *******************************************/ - - /* Discard leading zeros, and catch extreme overflow and underflow */ - while (ndigits > 0 && HEX_DIGIT(ndigits-1) == 0) - ndigits--; - if (ndigits == 0 || exp < LONG_MIN/2) { - x = 0.0; - goto finished; - } - if (exp > LONG_MAX/2) - goto overflow_error; - - /* Adjust exponent for fractional part. */ - exp = exp - 4*((long)fdigits); - - /* top_exp = 1 more than exponent of most sig. bit of coefficient */ - top_exp = exp + 4*((long)ndigits - 1); - for (digit = HEX_DIGIT(ndigits-1); digit != 0; digit /= 2) - top_exp++; - - /* catch almost all nonextreme cases of overflow and underflow here */ - if (top_exp < DBL_MIN_EXP - DBL_MANT_DIG) { - x = 0.0; - goto finished; - } - if (top_exp > DBL_MAX_EXP) - goto overflow_error; - - /* lsb = exponent of least significant bit of the *rounded* value. - This is top_exp - DBL_MANT_DIG unless result is subnormal. */ - lsb = MAX(top_exp, (long)DBL_MIN_EXP) - DBL_MANT_DIG; - - x = 0.0; - if (exp >= lsb) { - /* no rounding required */ - for (i = ndigits-1; i >= 0; i--) - x = 16.0*x + HEX_DIGIT(i); - x = ldexp(x, (int)(exp)); - goto finished; - } - /* rounding required. key_digit is the index of the hex digit - containing the first bit to be rounded away. */ - half_eps = 1 << (int)((lsb - exp - 1) % 4); - key_digit = (lsb - exp - 1) / 4; - for (i = ndigits-1; i > key_digit; i--) - x = 16.0*x + HEX_DIGIT(i); - digit = HEX_DIGIT(key_digit); - x = 16.0*x + (double)(digit & (16-2*half_eps)); - - /* round-half-even: round up if bit lsb-1 is 1 and at least one of - bits lsb, lsb-2, lsb-3, lsb-4, ... is 1. */ - if ((digit & half_eps) != 0) { - round_up = 0; - if ((digit & (3*half_eps-1)) != 0 || - (half_eps == 8 && (HEX_DIGIT(key_digit+1) & 1) != 0)) - round_up = 1; - else - for (i = key_digit-1; i >= 0; i--) - if (HEX_DIGIT(i) != 0) { - round_up = 1; - break; - } - if (round_up == 1) { - x += 2*half_eps; - if (top_exp == DBL_MAX_EXP && - x == ldexp((double)(2*half_eps), DBL_MANT_DIG)) - /* overflow corner case: pre-rounded value < - 2**DBL_MAX_EXP; rounded=2**DBL_MAX_EXP. */ - goto overflow_error; - } - } - x = ldexp(x, (int)(exp+4*key_digit)); - - finished: - /* optional trailing whitespace leading to the end of the string */ - while (Py_ISSPACE(*s)) - s++; - if (s != s_end) - goto parse_error; - result_as_float = Py_BuildValue("(d)", sign * x); - if (result_as_float == NULL) - return NULL; - result = PyObject_CallObject(cls, result_as_float); - Py_DECREF(result_as_float); - return result; - - overflow_error: - PyErr_SetString(PyExc_OverflowError, - "hexadecimal value too large to represent as a float"); - return NULL; - - parse_error: - PyErr_SetString(PyExc_ValueError, - "invalid hexadecimal floating-point string"); - return NULL; - - insane_length_error: - PyErr_SetString(PyExc_ValueError, - "hexadecimal string too long to convert"); - return NULL; -} - -PyDoc_STRVAR(float_fromhex_doc, -"float.fromhex(string) -> float\n\ -\n\ -Create a floating-point number from a hexadecimal string.\n\ ->>> float.fromhex('0x1.ffffp10')\n\ -2047.984375\n\ ->>> float.fromhex('-0x1p-1074')\n\ --4.9406564584124654e-324"); - - -static PyObject * -float_as_integer_ratio(PyObject *v, PyObject *unused) -{ - double self; - double float_part; - int exponent; - int i; - - PyObject *prev; - PyObject *py_exponent = NULL; - PyObject *numerator = NULL; - PyObject *denominator = NULL; - PyObject *result_pair = NULL; - PyNumberMethods *long_methods = PyLong_Type.tp_as_number; - -#define INPLACE_UPDATE(obj, call) \ - prev = obj; \ - obj = call; \ - Py_DECREF(prev); \ - - CONVERT_TO_DOUBLE(v, self); - - if (Py_IS_INFINITY(self)) { - PyErr_SetString(PyExc_OverflowError, - "Cannot pass infinity to float.as_integer_ratio."); - return NULL; - } -#ifdef Py_NAN - if (Py_IS_NAN(self)) { - PyErr_SetString(PyExc_ValueError, - "Cannot pass NaN to float.as_integer_ratio."); - return NULL; - } -#endif - - PyFPE_START_PROTECT("as_integer_ratio", goto error); - float_part = frexp(self, &exponent); /* self == float_part * 2**exponent exactly */ - PyFPE_END_PROTECT(float_part); - - for (i=0; i<300 && float_part != floor(float_part) ; i++) { - float_part *= 2.0; - exponent--; - } - /* self == float_part * 2**exponent exactly and float_part is integral. - If FLT_RADIX != 2, the 300 steps may leave a tiny fractional part - to be truncated by PyLong_FromDouble(). */ - - numerator = PyLong_FromDouble(float_part); - if (numerator == NULL) goto error; - - /* fold in 2**exponent */ - denominator = PyLong_FromLong(1); - py_exponent = PyLong_FromLong(labs((long)exponent)); - if (py_exponent == NULL) goto error; - INPLACE_UPDATE(py_exponent, - long_methods->nb_lshift(denominator, py_exponent)); - if (py_exponent == NULL) goto error; - if (exponent > 0) { - INPLACE_UPDATE(numerator, - long_methods->nb_multiply(numerator, py_exponent)); - if (numerator == NULL) goto error; - } - else { - Py_DECREF(denominator); - denominator = py_exponent; - py_exponent = NULL; - } - - /* Returns ints instead of longs where possible */ - INPLACE_UPDATE(numerator, PyNumber_Int(numerator)); - if (numerator == NULL) goto error; - INPLACE_UPDATE(denominator, PyNumber_Int(denominator)); - if (denominator == NULL) goto error; - - result_pair = PyTuple_Pack(2, numerator, denominator); - -#undef INPLACE_UPDATE -error: - Py_XDECREF(py_exponent); - Py_XDECREF(denominator); - Py_XDECREF(numerator); - return result_pair; -} - -PyDoc_STRVAR(float_as_integer_ratio_doc, -"float.as_integer_ratio() -> (int, int)\n" -"\n" -"Return a pair of integers, whose ratio is exactly equal to the original\n" -"float and with a positive denominator.\n" -"Raise OverflowError on infinities and a ValueError on NaNs.\n" -"\n" -">>> (10.0).as_integer_ratio()\n" -"(10, 1)\n" -">>> (0.0).as_integer_ratio()\n" -"(0, 1)\n" -">>> (-.25).as_integer_ratio()\n" -"(-1, 4)"); - - -static PyObject * -float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -float_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = Py_False; /* Integer zero */ - static char *kwlist[] = {"x", 0}; - - if (type != &PyFloat_Type) - return float_subtype_new(type, args, kwds); /* Wimp out */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:float", kwlist, &x)) - return NULL; - /* If it's a string, but not a string subclass, use - PyFloat_FromString. */ - if (PyString_CheckExact(x)) - return PyFloat_FromString(x, NULL); - return PyNumber_Float(x); -} - -/* Wimpy, slow approach to tp_new calls for subtypes of float: - first create a regular float from whatever arguments we got, - then allocate a subtype instance and initialize its ob_fval - from the regular float. The regular float is then thrown away. -*/ -static PyObject * -float_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *newobj; - - assert(PyType_IsSubtype(type, &PyFloat_Type)); - tmp = float_new(&PyFloat_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyFloat_CheckExact(tmp)); - newobj = type->tp_alloc(type, 0); - if (newobj == NULL) { - Py_DECREF(tmp); - return NULL; - } - ((PyFloatObject *)newobj)->ob_fval = ((PyFloatObject *)tmp)->ob_fval; - Py_DECREF(tmp); - return newobj; -} - -static PyObject * -float_getnewargs(PyFloatObject *v) -{ - return Py_BuildValue("(d)", v->ob_fval); -} - -/* this is for the benefit of the pack/unpack routines below */ - -typedef enum { - unknown_format, ieee_big_endian_format, ieee_little_endian_format -} float_format_type; - -static float_format_type double_format, float_format; -static float_format_type detected_double_format, detected_float_format; - -static PyObject * -float_getformat(PyTypeObject *v, PyObject* arg) -{ - char* s; - float_format_type r; - - if (!PyString_Check(arg)) { - PyErr_Format(PyExc_TypeError, - "__getformat__() argument must be string, not %.500s", - Py_TYPE(arg)->tp_name); - return NULL; - } - s = PyString_AS_STRING(arg); - if (strcmp(s, "double") == 0) { - r = double_format; - } - else if (strcmp(s, "float") == 0) { - r = float_format; - } - else { - PyErr_SetString(PyExc_ValueError, - "__getformat__() argument 1 must be " - "'double' or 'float'"); - return NULL; - } - - switch (r) { - case unknown_format: - return PyString_FromString("unknown"); - case ieee_little_endian_format: - return PyString_FromString("IEEE, little-endian"); - case ieee_big_endian_format: - return PyString_FromString("IEEE, big-endian"); - default: - Py_FatalError("insane float_format or double_format"); - return NULL; - } -} - -PyDoc_STRVAR(float_getformat_doc, -"float.__getformat__(typestr) -> string\n" -"\n" -"You probably don't want to use this function. It exists mainly to be\n" -"used in Python's test suite.\n" -"\n" -"typestr must be 'double' or 'float'. This function returns whichever of\n" -"'unknown', 'IEEE, big-endian' or 'IEEE, little-endian' best describes the\n" -"format of floating point numbers used by the C type named by typestr."); - -static PyObject * -float_setformat(PyTypeObject *v, PyObject* args) -{ - char* typestr; - char* format; - float_format_type f; - float_format_type detected; - float_format_type *p; - - if (!PyArg_ParseTuple(args, "ss:__setformat__", &typestr, &format)) - return NULL; - - if (strcmp(typestr, "double") == 0) { - p = &double_format; - detected = detected_double_format; - } - else if (strcmp(typestr, "float") == 0) { - p = &float_format; - detected = detected_float_format; - } - else { - PyErr_SetString(PyExc_ValueError, - "__setformat__() argument 1 must " - "be 'double' or 'float'"); - return NULL; - } - - if (strcmp(format, "unknown") == 0) { - f = unknown_format; - } - else if (strcmp(format, "IEEE, little-endian") == 0) { - f = ieee_little_endian_format; - } - else if (strcmp(format, "IEEE, big-endian") == 0) { - f = ieee_big_endian_format; - } - else { - PyErr_SetString(PyExc_ValueError, - "__setformat__() argument 2 must be " - "'unknown', 'IEEE, little-endian' or " - "'IEEE, big-endian'"); - return NULL; - - } - - if (f != unknown_format && f != detected) { - PyErr_Format(PyExc_ValueError, - "can only set %s format to 'unknown' or the " - "detected platform value", typestr); - return NULL; - } - - *p = f; - Py_RETURN_NONE; -} - -PyDoc_STRVAR(float_setformat_doc, -"float.__setformat__(typestr, fmt) -> None\n" -"\n" -"You probably don't want to use this function. It exists mainly to be\n" -"used in Python's test suite.\n" -"\n" -"typestr must be 'double' or 'float'. fmt must be one of 'unknown',\n" -"'IEEE, big-endian' or 'IEEE, little-endian', and in addition can only be\n" -"one of the latter two if it appears to match the underlying C reality.\n" -"\n" -"Override the automatic determination of C-level floating point type.\n" -"This affects how floats are converted to and from binary strings."); - -static PyObject * -float_getzero(PyObject *v, void *closure) -{ - return PyFloat_FromDouble(0.0); -} - -static PyObject * -float__format__(PyObject *self, PyObject *args) -{ - PyObject *format_spec; - - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - return NULL; - if (PyBytes_Check(format_spec)) - return _PyFloat_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); - if (PyUnicode_Check(format_spec)) { - /* Convert format_spec to a str */ - PyObject *result; - PyObject *str_spec = PyObject_Str(format_spec); - - if (str_spec == NULL) - return NULL; - - result = _PyFloat_FormatAdvanced(self, - PyBytes_AS_STRING(str_spec), - PyBytes_GET_SIZE(str_spec)); - - Py_DECREF(str_spec); - return result; - } - PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); - return NULL; -} - -PyDoc_STRVAR(float__format__doc, -"float.__format__(format_spec) -> string\n" -"\n" -"Formats the float according to format_spec."); - - -static PyMethodDef float_methods[] = { - {"conjugate", (PyCFunction)float_float, METH_NOARGS, - "Return self, the complex conjugate of any float."}, - {"__trunc__", (PyCFunction)float_trunc, METH_NOARGS, - "Return the Integral closest to x between 0 and x."}, - {"as_integer_ratio", (PyCFunction)float_as_integer_ratio, METH_NOARGS, - float_as_integer_ratio_doc}, - {"fromhex", (PyCFunction)float_fromhex, - METH_O|METH_CLASS, float_fromhex_doc}, - {"hex", (PyCFunction)float_hex, - METH_NOARGS, float_hex_doc}, - {"is_integer", (PyCFunction)float_is_integer, METH_NOARGS, - "Return True if the float is an integer."}, -#if 0 - {"is_inf", (PyCFunction)float_is_inf, METH_NOARGS, - "Return True if the float is positive or negative infinite."}, - {"is_finite", (PyCFunction)float_is_finite, METH_NOARGS, - "Return True if the float is finite, neither infinite nor NaN."}, - {"is_nan", (PyCFunction)float_is_nan, METH_NOARGS, - "Return True if the float is not a number (NaN)."}, -#endif - {"__getnewargs__", (PyCFunction)float_getnewargs, METH_NOARGS}, - {"__getformat__", (PyCFunction)float_getformat, - METH_O|METH_CLASS, float_getformat_doc}, - {"__setformat__", (PyCFunction)float_setformat, - METH_VARARGS|METH_CLASS, float_setformat_doc}, - {"__format__", (PyCFunction)float__format__, - METH_VARARGS, float__format__doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyGetSetDef float_getset[] = { - {"real", - (getter)float_float, (setter)NULL, - "the real part of a complex number", - NULL}, - {"imag", - (getter)float_getzero, (setter)NULL, - "the imaginary part of a complex number", - NULL}, - {NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(float_doc, -"float(x) -> floating point number\n\ -\n\ -Convert a string or number to a floating point number, if possible."); - - -static PyNumberMethods float_as_number = { - float_add, /*nb_add*/ - float_sub, /*nb_subtract*/ - float_mul, /*nb_multiply*/ - float_classic_div, /*nb_divide*/ - float_rem, /*nb_remainder*/ - float_divmod, /*nb_divmod*/ - float_pow, /*nb_power*/ - (unaryfunc)float_neg, /*nb_negative*/ - (unaryfunc)float_float, /*nb_positive*/ - (unaryfunc)float_abs, /*nb_absolute*/ - (inquiry)float_nonzero, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - float_coerce, /*nb_coerce*/ - float_trunc, /*nb_int*/ - float_long, /*nb_long*/ - float_float, /*nb_float*/ - 0, /* nb_oct */ - 0, /* nb_hex */ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply */ - 0, /* nb_inplace_divide */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - float_floor_div, /* nb_floor_divide */ - float_div, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ -}; - -PyTypeObject PyFloat_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "float", - sizeof(PyFloatObject), - 0, - (destructor)float_dealloc, /* tp_dealloc */ - (printfunc)float_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)float_repr, /* tp_repr */ - &float_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)float_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)float_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - float_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - float_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - float_methods, /* tp_methods */ - 0, /* tp_members */ - float_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - float_new, /* tp_new */ -}; - -void -_PyFloat_Init(void) -{ - /* We attempt to determine if this machine is using IEEE - floating point formats by peering at the bits of some - carefully chosen values. If it looks like we are on an - IEEE platform, the float packing/unpacking routines can - just copy bits, if not they resort to arithmetic & shifts - and masks. The shifts & masks approach works on all finite - values, but what happens to infinities, NaNs and signed - zeroes on packing is an accident, and attempting to unpack - a NaN or an infinity will raise an exception. - - Note that if we're on some whacked-out platform which uses - IEEE formats but isn't strictly little-endian or big- - endian, we will fall back to the portable shifts & masks - method. */ - -#if SIZEOF_DOUBLE == 8 - { - double x = 9006104071832581.0; - if (memcmp(&x, "\x43\x3f\xff\x01\x02\x03\x04\x05", 8) == 0) - detected_double_format = ieee_big_endian_format; - else if (memcmp(&x, "\x05\x04\x03\x02\x01\xff\x3f\x43", 8) == 0) - detected_double_format = ieee_little_endian_format; - else - detected_double_format = unknown_format; - } -#else - detected_double_format = unknown_format; -#endif - -#if SIZEOF_FLOAT == 4 - { - float y = 16711938.0; - if (memcmp(&y, "\x4b\x7f\x01\x02", 4) == 0) - detected_float_format = ieee_big_endian_format; - else if (memcmp(&y, "\x02\x01\x7f\x4b", 4) == 0) - detected_float_format = ieee_little_endian_format; - else - detected_float_format = unknown_format; - } -#else - detected_float_format = unknown_format; -#endif - - double_format = detected_double_format; - float_format = detected_float_format; - - /* Init float info */ - if (FloatInfoType.tp_name == 0) - PyStructSequence_InitType(&FloatInfoType, &floatinfo_desc); -} - -int -PyFloat_ClearFreeList(void) -{ - PyFloatObject *p; - PyFloatBlock *list, *next; - int i; - int u; /* remaining unfreed ints per block */ - int freelist_size = 0; - - list = block_list; - block_list = NULL; - free_list = NULL; - while (list != NULL) { - u = 0; - for (i = 0, p = &list->objects[0]; - i < N_FLOATOBJECTS; - i++, p++) { - if (PyFloat_CheckExact(p) && Py_REFCNT(p) != 0) - u++; - } - next = list->next; - if (u) { - list->next = block_list; - block_list = list; - for (i = 0, p = &list->objects[0]; - i < N_FLOATOBJECTS; - i++, p++) { - if (!PyFloat_CheckExact(p) || - Py_REFCNT(p) == 0) { - Py_TYPE(p) = (struct _typeobject *) - free_list; - free_list = p; - } - } - } - else { - PyMem_FREE(list); - } - freelist_size += u; - list = next; - } - return freelist_size; -} - -void -PyFloat_Fini(void) -{ - PyFloatObject *p; - PyFloatBlock *list; - int i; - int u; /* total unfreed floats per block */ - - u = PyFloat_ClearFreeList(); - - if (!Py_VerboseFlag) - return; - fprintf(stderr, "# cleanup floats"); - if (!u) { - fprintf(stderr, "\n"); - } - else { - fprintf(stderr, - ": %d unfreed float%s\n", - u, u == 1 ? "" : "s"); - } - if (Py_VerboseFlag > 1) { - list = block_list; - while (list != NULL) { - for (i = 0, p = &list->objects[0]; - i < N_FLOATOBJECTS; - i++, p++) { - if (PyFloat_CheckExact(p) && - Py_REFCNT(p) != 0) { - char *buf = PyOS_double_to_string( - PyFloat_AS_DOUBLE(p), 'r', - 0, 0, NULL); - if (buf) { - /* XXX(twouters) cast - refcount to long - until %zd is - universally - available - */ - fprintf(stderr, - "# \n", - p, (long)Py_REFCNT(p), buf); - PyMem_Free(buf); - } - } - } - list = list->next; - } - } -} - -/*---------------------------------------------------------------------------- - * _PyFloat_{Pack,Unpack}{4,8}. See floatobject.h. - */ -int -_PyFloat_Pack4(double x, unsigned char *p, int le) -{ - if (float_format == unknown_format) { - unsigned char sign; - int e; - double f; - unsigned int fbits; - int incr = 1; - - if (le) { - p += 3; - incr = -1; - } - - if (x < 0) { - sign = 1; - x = -x; - } - else - sign = 0; - - f = frexp(x, &e); - - /* Normalize f to be in the range [1.0, 2.0) */ - if (0.5 <= f && f < 1.0) { - f *= 2.0; - e--; - } - else if (f == 0.0) - e = 0; - else { - PyErr_SetString(PyExc_SystemError, - "frexp() result out of range"); - return -1; - } - - if (e >= 128) - goto Overflow; - else if (e < -126) { - /* Gradual underflow */ - f = ldexp(f, 126 + e); - e = 0; - } - else if (!(e == 0 && f == 0.0)) { - e += 127; - f -= 1.0; /* Get rid of leading 1 */ - } - - f *= 8388608.0; /* 2**23 */ - fbits = (unsigned int)(f + 0.5); /* Round */ - assert(fbits <= 8388608); - if (fbits >> 23) { - /* The carry propagated out of a string of 23 1 bits. */ - fbits = 0; - ++e; - if (e >= 255) - goto Overflow; - } - - /* First byte */ - *p = (sign << 7) | (e >> 1); - p += incr; - - /* Second byte */ - *p = (char) (((e & 1) << 7) | (fbits >> 16)); - p += incr; - - /* Third byte */ - *p = (fbits >> 8) & 0xFF; - p += incr; - - /* Fourth byte */ - *p = fbits & 0xFF; - - /* Done */ - return 0; - - } - else { - float y = (float)x; - const char *s = (char*)&y; - int i, incr = 1; - - if (Py_IS_INFINITY(y) && !Py_IS_INFINITY(x)) - goto Overflow; - - if ((float_format == ieee_little_endian_format && !le) - || (float_format == ieee_big_endian_format && le)) { - p += 3; - incr = -1; - } - - for (i = 0; i < 4; i++) { - *p = *s++; - p += incr; - } - return 0; - } - Overflow: - PyErr_SetString(PyExc_OverflowError, - "float too large to pack with f format"); - return -1; -} - -int -_PyFloat_Pack8(double x, unsigned char *p, int le) -{ - if (double_format == unknown_format) { - unsigned char sign; - int e; - double f; - unsigned int fhi, flo; - int incr = 1; - - if (le) { - p += 7; - incr = -1; - } - - if (x < 0) { - sign = 1; - x = -x; - } - else - sign = 0; - - f = frexp(x, &e); - - /* Normalize f to be in the range [1.0, 2.0) */ - if (0.5 <= f && f < 1.0) { - f *= 2.0; - e--; - } - else if (f == 0.0) - e = 0; - else { - PyErr_SetString(PyExc_SystemError, - "frexp() result out of range"); - return -1; - } - - if (e >= 1024) - goto Overflow; - else if (e < -1022) { - /* Gradual underflow */ - f = ldexp(f, 1022 + e); - e = 0; - } - else if (!(e == 0 && f == 0.0)) { - e += 1023; - f -= 1.0; /* Get rid of leading 1 */ - } - - /* fhi receives the high 28 bits; flo the low 24 bits (== 52 bits) */ - f *= 268435456.0; /* 2**28 */ - fhi = (unsigned int)f; /* Truncate */ - assert(fhi < 268435456); - - f -= (double)fhi; - f *= 16777216.0; /* 2**24 */ - flo = (unsigned int)(f + 0.5); /* Round */ - assert(flo <= 16777216); - if (flo >> 24) { - /* The carry propagated out of a string of 24 1 bits. */ - flo = 0; - ++fhi; - if (fhi >> 28) { - /* And it also progagated out of the next 28 bits. */ - fhi = 0; - ++e; - if (e >= 2047) - goto Overflow; - } - } - - /* First byte */ - *p = (sign << 7) | (e >> 4); - p += incr; - - /* Second byte */ - *p = (unsigned char) (((e & 0xF) << 4) | (fhi >> 24)); - p += incr; - - /* Third byte */ - *p = (fhi >> 16) & 0xFF; - p += incr; - - /* Fourth byte */ - *p = (fhi >> 8) & 0xFF; - p += incr; - - /* Fifth byte */ - *p = fhi & 0xFF; - p += incr; - - /* Sixth byte */ - *p = (flo >> 16) & 0xFF; - p += incr; - - /* Seventh byte */ - *p = (flo >> 8) & 0xFF; - p += incr; - - /* Eighth byte */ - *p = flo & 0xFF; - /* p += incr; Unneeded (for now) */ - - /* Done */ - return 0; - - Overflow: - PyErr_SetString(PyExc_OverflowError, - "float too large to pack with d format"); - return -1; - } - else { - const char *s = (char*)&x; - int i, incr = 1; - - if ((double_format == ieee_little_endian_format && !le) - || (double_format == ieee_big_endian_format && le)) { - p += 7; - incr = -1; - } - - for (i = 0; i < 8; i++) { - *p = *s++; - p += incr; - } - return 0; - } -} - -double -_PyFloat_Unpack4(const unsigned char *p, int le) -{ - if (float_format == unknown_format) { - unsigned char sign; - int e; - unsigned int f; - double x; - int incr = 1; - - if (le) { - p += 3; - incr = -1; - } - - /* First byte */ - sign = (*p >> 7) & 1; - e = (*p & 0x7F) << 1; - p += incr; - - /* Second byte */ - e |= (*p >> 7) & 1; - f = (*p & 0x7F) << 16; - p += incr; - - if (e == 255) { - PyErr_SetString( - PyExc_ValueError, - "can't unpack IEEE 754 special value " - "on non-IEEE platform"); - return -1; - } - - /* Third byte */ - f |= *p << 8; - p += incr; - - /* Fourth byte */ - f |= *p; - - x = (double)f / 8388608.0; - - /* XXX This sadly ignores Inf/NaN issues */ - if (e == 0) - e = -126; - else { - x += 1.0; - e -= 127; - } - x = ldexp(x, e); - - if (sign) - x = -x; - - return x; - } - else { - float x; - - if ((float_format == ieee_little_endian_format && !le) - || (float_format == ieee_big_endian_format && le)) { - char buf[4]; - char *d = &buf[3]; - int i; - - for (i = 0; i < 4; i++) { - *d-- = *p++; - } - memcpy(&x, buf, 4); - } - else { - memcpy(&x, p, 4); - } - - return x; - } -} - -double -_PyFloat_Unpack8(const unsigned char *p, int le) -{ - if (double_format == unknown_format) { - unsigned char sign; - int e; - unsigned int fhi, flo; - double x; - int incr = 1; - - if (le) { - p += 7; - incr = -1; - } - - /* First byte */ - sign = (*p >> 7) & 1; - e = (*p & 0x7F) << 4; - - p += incr; - - /* Second byte */ - e |= (*p >> 4) & 0xF; - fhi = (*p & 0xF) << 24; - p += incr; - - if (e == 2047) { - PyErr_SetString( - PyExc_ValueError, - "can't unpack IEEE 754 special value " - "on non-IEEE platform"); - return -1.0; - } - - /* Third byte */ - fhi |= *p << 16; - p += incr; - - /* Fourth byte */ - fhi |= *p << 8; - p += incr; - - /* Fifth byte */ - fhi |= *p; - p += incr; - - /* Sixth byte */ - flo = *p << 16; - p += incr; - - /* Seventh byte */ - flo |= *p << 8; - p += incr; - - /* Eighth byte */ - flo |= *p; - - x = (double)fhi + (double)flo / 16777216.0; /* 2**24 */ - x /= 268435456.0; /* 2**28 */ - - if (e == 0) - e = -1022; - else { - x += 1.0; - e -= 1023; - } - x = ldexp(x, e); - - if (sign) - x = -x; - - return x; - } - else { - double x; - - if ((double_format == ieee_little_endian_format && !le) - || (double_format == ieee_big_endian_format && le)) { - char buf[8]; - char *d = &buf[7]; - int i; - - for (i = 0; i < 8; i++) { - *d-- = *p++; - } - memcpy(&x, buf, 8); - } - else { - memcpy(&x, p, 8); - } - - return x; - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/frameobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/frameobject.c deleted file mode 100644 index 2261b59..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/frameobject.c +++ /dev/null @@ -1,984 +0,0 @@ -/* Frame object implementation */ - -#include "Python.h" - -#include "code.h" -#include "frameobject.h" -#include "opcode.h" -#include "structmember.h" - -#undef MIN -#undef MAX -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define MAX(a, b) ((a) > (b) ? (a) : (b)) - -#define OFF(x) offsetof(PyFrameObject, x) - -static PyMemberDef frame_memberlist[] = { - {"f_back", T_OBJECT, OFF(f_back), RO}, - {"f_code", T_OBJECT, OFF(f_code), RO}, - {"f_builtins", T_OBJECT, OFF(f_builtins),RO}, - {"f_globals", T_OBJECT, OFF(f_globals), RO}, - {"f_lasti", T_INT, OFF(f_lasti), RO}, - {NULL} /* Sentinel */ -}; - -#define WARN_GET_SET(NAME) \ -static PyObject * frame_get_ ## NAME(PyFrameObject *f) { \ - if (PyErr_WarnPy3k(#NAME " has been removed in 3.x", 2) < 0) \ - return NULL; \ - if (f->NAME) { \ - Py_INCREF(f->NAME); \ - return f->NAME; \ - } \ - Py_RETURN_NONE; \ -} \ -static int frame_set_ ## NAME(PyFrameObject *f, PyObject *new) { \ - if (PyErr_WarnPy3k(#NAME " has been removed in 3.x", 2) < 0) \ - return -1; \ - if (f->NAME) { \ - Py_CLEAR(f->NAME); \ - } \ - if (new == Py_None) \ - new = NULL; \ - Py_XINCREF(new); \ - f->NAME = new; \ - return 0; \ -} - - -WARN_GET_SET(f_exc_traceback) -WARN_GET_SET(f_exc_type) -WARN_GET_SET(f_exc_value) - - -static PyObject * -frame_getlocals(PyFrameObject *f, void *closure) -{ - PyFrame_FastToLocals(f); - Py_INCREF(f->f_locals); - return f->f_locals; -} - -int -PyFrame_GetLineNumber(PyFrameObject *f) -{ - if (f->f_trace) - return f->f_lineno; - else - return PyCode_Addr2Line(f->f_code, f->f_lasti); -} - -static PyObject * -frame_getlineno(PyFrameObject *f, void *closure) -{ - return PyInt_FromLong(PyFrame_GetLineNumber(f)); -} - -/* Setter for f_lineno - you can set f_lineno from within a trace function in - * order to jump to a given line of code, subject to some restrictions. Most - * lines are OK to jump to because they don't make any assumptions about the - * state of the stack (obvious because you could remove the line and the code - * would still work without any stack errors), but there are some constructs - * that limit jumping: - * - * o Lines with an 'except' statement on them can't be jumped to, because - * they expect an exception to be on the top of the stack. - * o Lines that live in a 'finally' block can't be jumped from or to, since - * the END_FINALLY expects to clean up the stack after the 'try' block. - * o 'try'/'for'/'while' blocks can't be jumped into because the blockstack - * needs to be set up before their code runs, and for 'for' loops the - * iterator needs to be on the stack. - */ -static int -frame_setlineno(PyFrameObject *f, PyObject* p_new_lineno) -{ - int new_lineno = 0; /* The new value of f_lineno */ - int new_lasti = 0; /* The new value of f_lasti */ - int new_iblock = 0; /* The new value of f_iblock */ - unsigned char *code = NULL; /* The bytecode for the frame... */ - Py_ssize_t code_len = 0; /* ...and its length */ - unsigned char *lnotab = NULL; /* Iterating over co_lnotab */ - Py_ssize_t lnotab_len = 0; /* (ditto) */ - int offset = 0; /* (ditto) */ - int line = 0; /* (ditto) */ - int addr = 0; /* (ditto) */ - int min_addr = 0; /* Scanning the SETUPs and POPs */ - int max_addr = 0; /* (ditto) */ - int delta_iblock = 0; /* (ditto) */ - int min_delta_iblock = 0; /* (ditto) */ - int min_iblock = 0; /* (ditto) */ - int f_lasti_setup_addr = 0; /* Policing no-jump-into-finally */ - int new_lasti_setup_addr = 0; /* (ditto) */ - int blockstack[CO_MAXBLOCKS]; /* Walking the 'finally' blocks */ - int in_finally[CO_MAXBLOCKS]; /* (ditto) */ - int blockstack_top = 0; /* (ditto) */ - unsigned char setup_op = 0; /* (ditto) */ - - /* f_lineno must be an integer. */ - if (!PyInt_Check(p_new_lineno)) { - PyErr_SetString(PyExc_ValueError, - "lineno must be an integer"); - return -1; - } - - /* You can only do this from within a trace function, not via - * _getframe or similar hackery. */ - if (!f->f_trace) - { - PyErr_Format(PyExc_ValueError, - "f_lineno can only be set by a" - " line trace function"); - return -1; - } - - /* Fail if the line comes before the start of the code block. */ - new_lineno = (int) PyInt_AsLong(p_new_lineno); - if (new_lineno < f->f_code->co_firstlineno) { - PyErr_Format(PyExc_ValueError, - "line %d comes before the current code block", - new_lineno); - return -1; - } - else if (new_lineno == f->f_code->co_firstlineno) { - new_lasti = 0; - new_lineno = f->f_code->co_firstlineno; - } - else { - /* Find the bytecode offset for the start of the given - * line, or the first code-owning line after it. */ - char *tmp; - PyString_AsStringAndSize(f->f_code->co_lnotab, - &tmp, &lnotab_len); - lnotab = (unsigned char *) tmp; - addr = 0; - line = f->f_code->co_firstlineno; - new_lasti = -1; - for (offset = 0; offset < lnotab_len; offset += 2) { - addr += lnotab[offset]; - line += lnotab[offset+1]; - if (line >= new_lineno) { - new_lasti = addr; - new_lineno = line; - break; - } - } - } - - /* If we didn't reach the requested line, return an error. */ - if (new_lasti == -1) { - PyErr_Format(PyExc_ValueError, - "line %d comes after the current code block", - new_lineno); - return -1; - } - - /* We're now ready to look at the bytecode. */ - PyString_AsStringAndSize(f->f_code->co_code, (char **)&code, &code_len); - min_addr = MIN(new_lasti, f->f_lasti); - max_addr = MAX(new_lasti, f->f_lasti); - - /* You can't jump onto a line with an 'except' statement on it - - * they expect to have an exception on the top of the stack, which - * won't be true if you jump to them. They always start with code - * that either pops the exception using POP_TOP (plain 'except:' - * lines do this) or duplicates the exception on the stack using - * DUP_TOP (if there's an exception type specified). See compile.c, - * 'com_try_except' for the full details. There aren't any other - * cases (AFAIK) where a line's code can start with DUP_TOP or - * POP_TOP, but if any ever appear, they'll be subject to the same - * restriction (but with a different error message). */ - if (code[new_lasti] == DUP_TOP || code[new_lasti] == POP_TOP) { - PyErr_SetString(PyExc_ValueError, - "can't jump to 'except' line as there's no exception"); - return -1; - } - - /* You can't jump into or out of a 'finally' block because the 'try' - * block leaves something on the stack for the END_FINALLY to clean - * up. So we walk the bytecode, maintaining a simulated blockstack. - * When we reach the old or new address and it's in a 'finally' block - * we note the address of the corresponding SETUP_FINALLY. The jump - * is only legal if neither address is in a 'finally' block or - * they're both in the same one. 'blockstack' is a stack of the - * bytecode addresses of the SETUP_X opcodes, and 'in_finally' tracks - * whether we're in a 'finally' block at each blockstack level. */ - f_lasti_setup_addr = -1; - new_lasti_setup_addr = -1; - memset(blockstack, '\0', sizeof(blockstack)); - memset(in_finally, '\0', sizeof(in_finally)); - blockstack_top = 0; - for (addr = 0; addr < code_len; addr++) { - unsigned char op = code[addr]; - switch (op) { - case SETUP_LOOP: - case SETUP_EXCEPT: - case SETUP_FINALLY: - case SETUP_WITH: - blockstack[blockstack_top++] = addr; - in_finally[blockstack_top-1] = 0; - break; - - case POP_BLOCK: - assert(blockstack_top > 0); - setup_op = code[blockstack[blockstack_top-1]]; - if (setup_op == SETUP_FINALLY || setup_op == SETUP_WITH) { - in_finally[blockstack_top-1] = 1; - } - else { - blockstack_top--; - } - break; - - case END_FINALLY: - /* Ignore END_FINALLYs for SETUP_EXCEPTs - they exist - * in the bytecode but don't correspond to an actual - * 'finally' block. (If blockstack_top is 0, we must - * be seeing such an END_FINALLY.) */ - if (blockstack_top > 0) { - setup_op = code[blockstack[blockstack_top-1]]; - if (setup_op == SETUP_FINALLY || setup_op == SETUP_WITH) { - blockstack_top--; - } - } - break; - } - - /* For the addresses we're interested in, see whether they're - * within a 'finally' block and if so, remember the address - * of the SETUP_FINALLY. */ - if (addr == new_lasti || addr == f->f_lasti) { - int i = 0; - int setup_addr = -1; - for (i = blockstack_top-1; i >= 0; i--) { - if (in_finally[i]) { - setup_addr = blockstack[i]; - break; - } - } - - if (setup_addr != -1) { - if (addr == new_lasti) { - new_lasti_setup_addr = setup_addr; - } - - if (addr == f->f_lasti) { - f_lasti_setup_addr = setup_addr; - } - } - } - - if (op >= HAVE_ARGUMENT) { - addr += 2; - } - } - - /* Verify that the blockstack tracking code didn't get lost. */ - assert(blockstack_top == 0); - - /* After all that, are we jumping into / out of a 'finally' block? */ - if (new_lasti_setup_addr != f_lasti_setup_addr) { - PyErr_SetString(PyExc_ValueError, - "can't jump into or out of a 'finally' block"); - return -1; - } - - - /* Police block-jumping (you can't jump into the middle of a block) - * and ensure that the blockstack finishes up in a sensible state (by - * popping any blocks we're jumping out of). We look at all the - * blockstack operations between the current position and the new - * one, and keep track of how many blocks we drop out of on the way. - * By also keeping track of the lowest blockstack position we see, we - * can tell whether the jump goes into any blocks without coming out - * again - in that case we raise an exception below. */ - delta_iblock = 0; - for (addr = min_addr; addr < max_addr; addr++) { - unsigned char op = code[addr]; - switch (op) { - case SETUP_LOOP: - case SETUP_EXCEPT: - case SETUP_FINALLY: - case SETUP_WITH: - delta_iblock++; - break; - - case POP_BLOCK: - delta_iblock--; - break; - } - - min_delta_iblock = MIN(min_delta_iblock, delta_iblock); - - if (op >= HAVE_ARGUMENT) { - addr += 2; - } - } - - /* Derive the absolute iblock values from the deltas. */ - min_iblock = f->f_iblock + min_delta_iblock; - if (new_lasti > f->f_lasti) { - /* Forwards jump. */ - new_iblock = f->f_iblock + delta_iblock; - } - else { - /* Backwards jump. */ - new_iblock = f->f_iblock - delta_iblock; - } - - /* Are we jumping into a block? */ - if (new_iblock > min_iblock) { - PyErr_SetString(PyExc_ValueError, - "can't jump into the middle of a block"); - return -1; - } - - /* Pop any blocks that we're jumping out of. */ - while (f->f_iblock > new_iblock) { - PyTryBlock *b = &f->f_blockstack[--f->f_iblock]; - while ((f->f_stacktop - f->f_valuestack) > b->b_level) { - PyObject *v = (*--f->f_stacktop); - Py_DECREF(v); - } - } - - /* Finally set the new f_lineno and f_lasti and return OK. */ - f->f_lineno = new_lineno; - f->f_lasti = new_lasti; - return 0; -} - -static PyObject * -frame_gettrace(PyFrameObject *f, void *closure) -{ - PyObject* trace = f->f_trace; - - if (trace == NULL) - trace = Py_None; - - Py_INCREF(trace); - - return trace; -} - -static int -frame_settrace(PyFrameObject *f, PyObject* v, void *closure) -{ - PyObject* old_value; - - /* We rely on f_lineno being accurate when f_trace is set. */ - f->f_lineno = PyFrame_GetLineNumber(f); - - old_value = f->f_trace; - Py_XINCREF(v); - f->f_trace = v; - Py_XDECREF(old_value); - - return 0; -} - -static PyObject * -frame_getrestricted(PyFrameObject *f, void *closure) -{ - return PyBool_FromLong(PyFrame_IsRestricted(f)); -} - -static PyGetSetDef frame_getsetlist[] = { - {"f_locals", (getter)frame_getlocals, NULL, NULL}, - {"f_lineno", (getter)frame_getlineno, - (setter)frame_setlineno, NULL}, - {"f_trace", (getter)frame_gettrace, (setter)frame_settrace, NULL}, - {"f_restricted",(getter)frame_getrestricted,NULL, NULL}, - {"f_exc_traceback", (getter)frame_get_f_exc_traceback, - (setter)frame_set_f_exc_traceback, NULL}, - {"f_exc_type", (getter)frame_get_f_exc_type, - (setter)frame_set_f_exc_type, NULL}, - {"f_exc_value", (getter)frame_get_f_exc_value, - (setter)frame_set_f_exc_value, NULL}, - {0} -}; - -/* Stack frames are allocated and deallocated at a considerable rate. - In an attempt to improve the speed of function calls, we: - - 1. Hold a single "zombie" frame on each code object. This retains - the allocated and initialised frame object from an invocation of - the code object. The zombie is reanimated the next time we need a - frame object for that code object. Doing this saves the malloc/ - realloc required when using a free_list frame that isn't the - correct size. It also saves some field initialisation. - - In zombie mode, no field of PyFrameObject holds a reference, but - the following fields are still valid: - - * ob_type, ob_size, f_code, f_valuestack; - - * f_locals, f_trace, - f_exc_type, f_exc_value, f_exc_traceback are NULL; - - * f_localsplus does not require re-allocation and - the local variables in f_localsplus are NULL. - - 2. We also maintain a separate free list of stack frames (just like - integers are allocated in a special way -- see intobject.c). When - a stack frame is on the free list, only the following members have - a meaning: - ob_type == &Frametype - f_back next item on free list, or NULL - f_stacksize size of value stack - ob_size size of localsplus - Note that the value and block stacks are preserved -- this can save - another malloc() call or two (and two free() calls as well!). - Also note that, unlike for integers, each frame object is a - malloc'ed object in its own right -- it is only the actual calls to - malloc() that we are trying to save here, not the administration. - After all, while a typical program may make millions of calls, a - call depth of more than 20 or 30 is probably already exceptional - unless the program contains run-away recursion. I hope. - - Later, PyFrame_MAXFREELIST was added to bound the # of frames saved on - free_list. Else programs creating lots of cyclic trash involving - frames could provoke free_list into growing without bound. -*/ - -static PyFrameObject *free_list = NULL; -static int numfree = 0; /* number of frames currently in free_list */ -/* max value for numfree */ -#define PyFrame_MAXFREELIST 200 - -static void -frame_dealloc(PyFrameObject *f) -{ - PyObject **p, **valuestack; - PyCodeObject *co; - - PyObject_GC_UnTrack(f); - Py_TRASHCAN_SAFE_BEGIN(f) - /* Kill all local variables */ - valuestack = f->f_valuestack; - for (p = f->f_localsplus; p < valuestack; p++) - Py_CLEAR(*p); - - /* Free stack */ - if (f->f_stacktop != NULL) { - for (p = valuestack; p < f->f_stacktop; p++) - Py_XDECREF(*p); - } - - Py_XDECREF(f->f_back); - Py_DECREF(f->f_builtins); - Py_DECREF(f->f_globals); - Py_CLEAR(f->f_locals); - Py_CLEAR(f->f_trace); - Py_CLEAR(f->f_exc_type); - Py_CLEAR(f->f_exc_value); - Py_CLEAR(f->f_exc_traceback); - - co = f->f_code; - if (co->co_zombieframe == NULL) - co->co_zombieframe = f; - else if (numfree < PyFrame_MAXFREELIST) { - ++numfree; - f->f_back = free_list; - free_list = f; - } - else - PyObject_GC_Del(f); - - Py_DECREF(co); - Py_TRASHCAN_SAFE_END(f) -} - -static int -frame_traverse(PyFrameObject *f, visitproc visit, void *arg) -{ - PyObject **fastlocals, **p; - int i, slots; - - Py_VISIT(f->f_back); - Py_VISIT(f->f_code); - Py_VISIT(f->f_builtins); - Py_VISIT(f->f_globals); - Py_VISIT(f->f_locals); - Py_VISIT(f->f_trace); - Py_VISIT(f->f_exc_type); - Py_VISIT(f->f_exc_value); - Py_VISIT(f->f_exc_traceback); - - /* locals */ - slots = f->f_code->co_nlocals + PyTuple_GET_SIZE(f->f_code->co_cellvars) + PyTuple_GET_SIZE(f->f_code->co_freevars); - fastlocals = f->f_localsplus; - for (i = slots; --i >= 0; ++fastlocals) - Py_VISIT(*fastlocals); - - /* stack */ - if (f->f_stacktop != NULL) { - for (p = f->f_valuestack; p < f->f_stacktop; p++) - Py_VISIT(*p); - } - return 0; -} - -static void -frame_clear(PyFrameObject *f) -{ - PyObject **fastlocals, **p, **oldtop; - int i, slots; - - /* Before anything else, make sure that this frame is clearly marked - * as being defunct! Else, e.g., a generator reachable from this - * frame may also point to this frame, believe itself to still be - * active, and try cleaning up this frame again. - */ - oldtop = f->f_stacktop; - f->f_stacktop = NULL; - - Py_CLEAR(f->f_exc_type); - Py_CLEAR(f->f_exc_value); - Py_CLEAR(f->f_exc_traceback); - Py_CLEAR(f->f_trace); - - /* locals */ - slots = f->f_code->co_nlocals + PyTuple_GET_SIZE(f->f_code->co_cellvars) + PyTuple_GET_SIZE(f->f_code->co_freevars); - fastlocals = f->f_localsplus; - for (i = slots; --i >= 0; ++fastlocals) - Py_CLEAR(*fastlocals); - - /* stack */ - if (oldtop != NULL) { - for (p = f->f_valuestack; p < oldtop; p++) - Py_CLEAR(*p); - } -} - -static PyObject * -frame_sizeof(PyFrameObject *f) -{ - Py_ssize_t res, extras, ncells, nfrees; - - ncells = PyTuple_GET_SIZE(f->f_code->co_cellvars); - nfrees = PyTuple_GET_SIZE(f->f_code->co_freevars); - extras = f->f_code->co_stacksize + f->f_code->co_nlocals + - ncells + nfrees; - /* subtract one as it is already included in PyFrameObject */ - res = sizeof(PyFrameObject) + (extras-1) * sizeof(PyObject *); - - return PyInt_FromSsize_t(res); -} - -PyDoc_STRVAR(sizeof__doc__, -"F.__sizeof__() -> size of F in memory, in bytes"); - -static PyMethodDef frame_methods[] = { - {"__sizeof__", (PyCFunction)frame_sizeof, METH_NOARGS, - sizeof__doc__}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyFrame_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "frame", - sizeof(PyFrameObject), - sizeof(PyObject *), - (destructor)frame_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)frame_traverse, /* tp_traverse */ - (inquiry)frame_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - frame_methods, /* tp_methods */ - frame_memberlist, /* tp_members */ - frame_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ -}; - -static PyObject *builtin_object; - -int _PyFrame_Init() -{ - builtin_object = PyString_InternFromString("__builtins__"); - if (builtin_object == NULL) - return 0; - return 1; -} - -PyFrameObject * -PyFrame_New(PyThreadState *tstate, PyCodeObject *code, PyObject *globals, - PyObject *locals) -{ - PyFrameObject *back = tstate->frame; - PyFrameObject *f; - PyObject *builtins; - Py_ssize_t i; - -#ifdef Py_DEBUG - if (code == NULL || globals == NULL || !PyDict_Check(globals) || - (locals != NULL && !PyMapping_Check(locals))) { - PyErr_BadInternalCall(); - return NULL; - } -#endif - if (back == NULL || back->f_globals != globals) { - builtins = PyDict_GetItem(globals, builtin_object); - if (builtins) { - if (PyModule_Check(builtins)) { - builtins = PyModule_GetDict(builtins); - assert(!builtins || PyDict_Check(builtins)); - } - else if (!PyDict_Check(builtins)) - builtins = NULL; - } - if (builtins == NULL) { - /* No builtins! Make up a minimal one - Give them 'None', at least. */ - builtins = PyDict_New(); - if (builtins == NULL || - PyDict_SetItemString( - builtins, "None", Py_None) < 0) - return NULL; - } - else - Py_INCREF(builtins); - - } - else { - /* If we share the globals, we share the builtins. - Save a lookup and a call. */ - builtins = back->f_builtins; - assert(builtins != NULL && PyDict_Check(builtins)); - Py_INCREF(builtins); - } - if (code->co_zombieframe != NULL) { - f = code->co_zombieframe; - code->co_zombieframe = NULL; - _Py_NewReference((PyObject *)f); - assert(f->f_code == code); - } - else { - Py_ssize_t extras, ncells, nfrees; - ncells = PyTuple_GET_SIZE(code->co_cellvars); - nfrees = PyTuple_GET_SIZE(code->co_freevars); - extras = code->co_stacksize + code->co_nlocals + ncells + - nfrees; - if (free_list == NULL) { - f = PyObject_GC_NewVar(PyFrameObject, &PyFrame_Type, - extras); - if (f == NULL) { - Py_DECREF(builtins); - return NULL; - } - } - else { - assert(numfree > 0); - --numfree; - f = free_list; - free_list = free_list->f_back; - if (Py_SIZE(f) < extras) { - f = PyObject_GC_Resize(PyFrameObject, f, extras); - if (f == NULL) { - Py_DECREF(builtins); - return NULL; - } - } - _Py_NewReference((PyObject *)f); - } - - f->f_code = code; - extras = code->co_nlocals + ncells + nfrees; - f->f_valuestack = f->f_localsplus + extras; - for (i=0; if_localsplus[i] = NULL; - f->f_locals = NULL; - f->f_trace = NULL; - f->f_exc_type = f->f_exc_value = f->f_exc_traceback = NULL; - } - f->f_stacktop = f->f_valuestack; - f->f_builtins = builtins; - Py_XINCREF(back); - f->f_back = back; - Py_INCREF(code); - Py_INCREF(globals); - f->f_globals = globals; - /* Most functions have CO_NEWLOCALS and CO_OPTIMIZED set. */ - if ((code->co_flags & (CO_NEWLOCALS | CO_OPTIMIZED)) == - (CO_NEWLOCALS | CO_OPTIMIZED)) - ; /* f_locals = NULL; will be set by PyFrame_FastToLocals() */ - else if (code->co_flags & CO_NEWLOCALS) { - locals = PyDict_New(); - if (locals == NULL) { - Py_DECREF(f); - return NULL; - } - f->f_locals = locals; - } - else { - if (locals == NULL) - locals = globals; - Py_INCREF(locals); - f->f_locals = locals; - } - f->f_tstate = tstate; - - f->f_lasti = -1; - f->f_lineno = code->co_firstlineno; - f->f_iblock = 0; - - _PyObject_GC_TRACK(f); - return f; -} - -/* Block management */ - -void -PyFrame_BlockSetup(PyFrameObject *f, int type, int handler, int level) -{ - PyTryBlock *b; - if (f->f_iblock >= CO_MAXBLOCKS) - Py_FatalError("XXX block stack overflow"); - b = &f->f_blockstack[f->f_iblock++]; - b->b_type = type; - b->b_level = level; - b->b_handler = handler; -} - -PyTryBlock * -PyFrame_BlockPop(PyFrameObject *f) -{ - PyTryBlock *b; - if (f->f_iblock <= 0) - Py_FatalError("XXX block stack underflow"); - b = &f->f_blockstack[--f->f_iblock]; - return b; -} - -/* Convert between "fast" version of locals and dictionary version. - - map and values are input arguments. map is a tuple of strings. - values is an array of PyObject*. At index i, map[i] is the name of - the variable with value values[i]. The function copies the first - nmap variable from map/values into dict. If values[i] is NULL, - the variable is deleted from dict. - - If deref is true, then the values being copied are cell variables - and the value is extracted from the cell variable before being put - in dict. - - Exceptions raised while modifying the dict are silently ignored, - because there is no good way to report them. - */ - -static void -map_to_dict(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, - int deref) -{ - Py_ssize_t j; - assert(PyTuple_Check(map)); - assert(PyDict_Check(dict)); - assert(PyTuple_Size(map) >= nmap); - for (j = nmap; --j >= 0; ) { - PyObject *key = PyTuple_GET_ITEM(map, j); - PyObject *value = values[j]; - assert(PyString_Check(key)); - if (deref) { - assert(PyCell_Check(value)); - value = PyCell_GET(value); - } - if (value == NULL) { - if (PyObject_DelItem(dict, key) != 0) - PyErr_Clear(); - } - else { - if (PyObject_SetItem(dict, key, value) != 0) - PyErr_Clear(); - } - } -} - -/* Copy values from the "locals" dict into the fast locals. - - dict is an input argument containing string keys representing - variables names and arbitrary PyObject* as values. - - map and values are input arguments. map is a tuple of strings. - values is an array of PyObject*. At index i, map[i] is the name of - the variable with value values[i]. The function copies the first - nmap variable from map/values into dict. If values[i] is NULL, - the variable is deleted from dict. - - If deref is true, then the values being copied are cell variables - and the value is extracted from the cell variable before being put - in dict. If clear is true, then variables in map but not in dict - are set to NULL in map; if clear is false, variables missing in - dict are ignored. - - Exceptions raised while modifying the dict are silently ignored, - because there is no good way to report them. -*/ - -static void -dict_to_map(PyObject *map, Py_ssize_t nmap, PyObject *dict, PyObject **values, - int deref, int clear) -{ - Py_ssize_t j; - assert(PyTuple_Check(map)); - assert(PyDict_Check(dict)); - assert(PyTuple_Size(map) >= nmap); - for (j = nmap; --j >= 0; ) { - PyObject *key = PyTuple_GET_ITEM(map, j); - PyObject *value = PyObject_GetItem(dict, key); - assert(PyString_Check(key)); - /* We only care about NULLs if clear is true. */ - if (value == NULL) { - PyErr_Clear(); - if (!clear) - continue; - } - if (deref) { - assert(PyCell_Check(values[j])); - if (PyCell_GET(values[j]) != value) { - if (PyCell_Set(values[j], value) < 0) - PyErr_Clear(); - } - } else if (values[j] != value) { - Py_XINCREF(value); - Py_XDECREF(values[j]); - values[j] = value; - } - Py_XDECREF(value); - } -} - -void -PyFrame_FastToLocals(PyFrameObject *f) -{ - /* Merge fast locals into f->f_locals */ - PyObject *locals, *map; - PyObject **fast; - PyObject *error_type, *error_value, *error_traceback; - PyCodeObject *co; - Py_ssize_t j; - int ncells, nfreevars; - if (f == NULL) - return; - locals = f->f_locals; - if (locals == NULL) { - locals = f->f_locals = PyDict_New(); - if (locals == NULL) { - PyErr_Clear(); /* Can't report it :-( */ - return; - } - } - co = f->f_code; - map = co->co_varnames; - if (!PyTuple_Check(map)) - return; - PyErr_Fetch(&error_type, &error_value, &error_traceback); - fast = f->f_localsplus; - j = PyTuple_GET_SIZE(map); - if (j > co->co_nlocals) - j = co->co_nlocals; - if (co->co_nlocals) - map_to_dict(map, j, locals, fast, 0); - ncells = PyTuple_GET_SIZE(co->co_cellvars); - nfreevars = PyTuple_GET_SIZE(co->co_freevars); - if (ncells || nfreevars) { - map_to_dict(co->co_cellvars, ncells, - locals, fast + co->co_nlocals, 1); - /* If the namespace is unoptimized, then one of the - following cases applies: - 1. It does not contain free variables, because it - uses import * or is a top-level namespace. - 2. It is a class namespace. - We don't want to accidentally copy free variables - into the locals dict used by the class. - */ - if (co->co_flags & CO_OPTIMIZED) { - map_to_dict(co->co_freevars, nfreevars, - locals, fast + co->co_nlocals + ncells, 1); - } - } - PyErr_Restore(error_type, error_value, error_traceback); -} - -void -PyFrame_LocalsToFast(PyFrameObject *f, int clear) -{ - /* Merge f->f_locals into fast locals */ - PyObject *locals, *map; - PyObject **fast; - PyObject *error_type, *error_value, *error_traceback; - PyCodeObject *co; - Py_ssize_t j; - int ncells, nfreevars; - if (f == NULL) - return; - locals = f->f_locals; - co = f->f_code; - map = co->co_varnames; - if (locals == NULL) - return; - if (!PyTuple_Check(map)) - return; - PyErr_Fetch(&error_type, &error_value, &error_traceback); - fast = f->f_localsplus; - j = PyTuple_GET_SIZE(map); - if (j > co->co_nlocals) - j = co->co_nlocals; - if (co->co_nlocals) - dict_to_map(co->co_varnames, j, locals, fast, 0, clear); - ncells = PyTuple_GET_SIZE(co->co_cellvars); - nfreevars = PyTuple_GET_SIZE(co->co_freevars); - if (ncells || nfreevars) { - dict_to_map(co->co_cellvars, ncells, - locals, fast + co->co_nlocals, 1, clear); - /* Same test as in PyFrame_FastToLocals() above. */ - if (co->co_flags & CO_OPTIMIZED) { - dict_to_map(co->co_freevars, nfreevars, - locals, fast + co->co_nlocals + ncells, 1, - clear); - } - } - PyErr_Restore(error_type, error_value, error_traceback); -} - -/* Clear out the free list */ -int -PyFrame_ClearFreeList(void) -{ - int freelist_size = numfree; - - while (free_list != NULL) { - PyFrameObject *f = free_list; - free_list = free_list->f_back; - PyObject_GC_Del(f); - --numfree; - } - assert(numfree == 0); - return freelist_size; -} - -void -PyFrame_Fini(void) -{ - (void)PyFrame_ClearFreeList(); - Py_XDECREF(builtin_object); - builtin_object = NULL; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/funcobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/funcobject.c deleted file mode 100644 index 571ab60..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/funcobject.c +++ /dev/null @@ -1,895 +0,0 @@ - -/* Function object implementation */ - -#include "Python.h" -#include "code.h" -#include "eval.h" -#include "structmember.h" - -PyObject * -PyFunction_New(PyObject *code, PyObject *globals) -{ - PyFunctionObject *op = PyObject_GC_New(PyFunctionObject, - &PyFunction_Type); - static PyObject *__name__ = 0; - if (op != NULL) { - PyObject *doc; - PyObject *consts; - PyObject *module; - op->func_weakreflist = NULL; - Py_INCREF(code); - op->func_code = code; - Py_INCREF(globals); - op->func_globals = globals; - op->func_name = ((PyCodeObject *)code)->co_name; - Py_INCREF(op->func_name); - op->func_defaults = NULL; /* No default arguments */ - op->func_closure = NULL; - consts = ((PyCodeObject *)code)->co_consts; - if (PyTuple_Size(consts) >= 1) { - doc = PyTuple_GetItem(consts, 0); - if (!PyString_Check(doc) && !PyUnicode_Check(doc)) - doc = Py_None; - } - else - doc = Py_None; - Py_INCREF(doc); - op->func_doc = doc; - op->func_dict = NULL; - op->func_module = NULL; - - /* __module__: If module name is in globals, use it. - Otherwise, use None. - */ - if (!__name__) { - __name__ = PyString_InternFromString("__name__"); - if (!__name__) { - Py_DECREF(op); - return NULL; - } - } - module = PyDict_GetItem(globals, __name__); - if (module) { - Py_INCREF(module); - op->func_module = module; - } - } - else - return NULL; - _PyObject_GC_TRACK(op); - return (PyObject *)op; -} - -PyObject * -PyFunction_GetCode(PyObject *op) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyFunctionObject *) op) -> func_code; -} - -PyObject * -PyFunction_GetGlobals(PyObject *op) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyFunctionObject *) op) -> func_globals; -} - -PyObject * -PyFunction_GetModule(PyObject *op) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyFunctionObject *) op) -> func_module; -} - -PyObject * -PyFunction_GetDefaults(PyObject *op) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyFunctionObject *) op) -> func_defaults; -} - -int -PyFunction_SetDefaults(PyObject *op, PyObject *defaults) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - if (defaults == Py_None) - defaults = NULL; - else if (defaults && PyTuple_Check(defaults)) { - Py_INCREF(defaults); - } - else { - PyErr_SetString(PyExc_SystemError, "non-tuple default args"); - return -1; - } - Py_XDECREF(((PyFunctionObject *) op) -> func_defaults); - ((PyFunctionObject *) op) -> func_defaults = defaults; - return 0; -} - -PyObject * -PyFunction_GetClosure(PyObject *op) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyFunctionObject *) op) -> func_closure; -} - -int -PyFunction_SetClosure(PyObject *op, PyObject *closure) -{ - if (!PyFunction_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - if (closure == Py_None) - closure = NULL; - else if (PyTuple_Check(closure)) { - Py_INCREF(closure); - } - else { - PyErr_Format(PyExc_SystemError, - "expected tuple for closure, got '%.100s'", - closure->ob_type->tp_name); - return -1; - } - Py_XDECREF(((PyFunctionObject *) op) -> func_closure); - ((PyFunctionObject *) op) -> func_closure = closure; - return 0; -} - -/* Methods */ - -#define OFF(x) offsetof(PyFunctionObject, x) - -static PyMemberDef func_memberlist[] = { - {"func_closure", T_OBJECT, OFF(func_closure), - RESTRICTED|READONLY}, - {"__closure__", T_OBJECT, OFF(func_closure), - RESTRICTED|READONLY}, - {"func_doc", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED}, - {"__doc__", T_OBJECT, OFF(func_doc), PY_WRITE_RESTRICTED}, - {"func_globals", T_OBJECT, OFF(func_globals), - RESTRICTED|READONLY}, - {"__globals__", T_OBJECT, OFF(func_globals), - RESTRICTED|READONLY}, - {"__module__", T_OBJECT, OFF(func_module), PY_WRITE_RESTRICTED}, - {NULL} /* Sentinel */ -}; - -static int -restricted(void) -{ - if (!PyEval_GetRestricted()) - return 0; - PyErr_SetString(PyExc_RuntimeError, - "function attributes not accessible in restricted mode"); - return 1; -} - -static PyObject * -func_get_dict(PyFunctionObject *op) -{ - if (restricted()) - return NULL; - if (op->func_dict == NULL) { - op->func_dict = PyDict_New(); - if (op->func_dict == NULL) - return NULL; - } - Py_INCREF(op->func_dict); - return op->func_dict; -} - -static int -func_set_dict(PyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - - if (restricted()) - return -1; - /* It is illegal to del f.func_dict */ - if (value == NULL) { - PyErr_SetString(PyExc_TypeError, - "function's dictionary may not be deleted"); - return -1; - } - /* Can only set func_dict to a dictionary */ - if (!PyDict_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "setting function's dictionary to a non-dict"); - return -1; - } - tmp = op->func_dict; - Py_INCREF(value); - op->func_dict = value; - Py_XDECREF(tmp); - return 0; -} - -static PyObject * -func_get_code(PyFunctionObject *op) -{ - if (restricted()) - return NULL; - Py_INCREF(op->func_code); - return op->func_code; -} - -static int -func_set_code(PyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - Py_ssize_t nfree, nclosure; - - if (restricted()) - return -1; - /* Not legal to del f.func_code or to set it to anything - * other than a code object. */ - if (value == NULL || !PyCode_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__code__ must be set to a code object"); - return -1; - } - nfree = PyCode_GetNumFree((PyCodeObject *)value); - nclosure = (op->func_closure == NULL ? 0 : - PyTuple_GET_SIZE(op->func_closure)); - if (nclosure != nfree) { - PyErr_Format(PyExc_ValueError, - "%s() requires a code object with %zd free vars," - " not %zd", - PyString_AsString(op->func_name), - nclosure, nfree); - return -1; - } - tmp = op->func_code; - Py_INCREF(value); - op->func_code = value; - Py_DECREF(tmp); - return 0; -} - -static PyObject * -func_get_name(PyFunctionObject *op) -{ - Py_INCREF(op->func_name); - return op->func_name; -} - -static int -func_set_name(PyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - - if (restricted()) - return -1; - /* Not legal to del f.func_name or to set it to anything - * other than a string object. */ - if (value == NULL || !PyString_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__name__ must be set to a string object"); - return -1; - } - tmp = op->func_name; - Py_INCREF(value); - op->func_name = value; - Py_DECREF(tmp); - return 0; -} - -static PyObject * -func_get_defaults(PyFunctionObject *op) -{ - if (restricted()) - return NULL; - if (op->func_defaults == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - Py_INCREF(op->func_defaults); - return op->func_defaults; -} - -static int -func_set_defaults(PyFunctionObject *op, PyObject *value) -{ - PyObject *tmp; - - if (restricted()) - return -1; - /* Legal to del f.func_defaults. - * Can only set func_defaults to NULL or a tuple. */ - if (value == Py_None) - value = NULL; - if (value != NULL && !PyTuple_Check(value)) { - PyErr_SetString(PyExc_TypeError, - "__defaults__ must be set to a tuple object"); - return -1; - } - tmp = op->func_defaults; - Py_XINCREF(value); - op->func_defaults = value; - Py_XDECREF(tmp); - return 0; -} - -static PyGetSetDef func_getsetlist[] = { - {"func_code", (getter)func_get_code, (setter)func_set_code}, - {"__code__", (getter)func_get_code, (setter)func_set_code}, - {"func_defaults", (getter)func_get_defaults, - (setter)func_set_defaults}, - {"__defaults__", (getter)func_get_defaults, - (setter)func_set_defaults}, - {"func_dict", (getter)func_get_dict, (setter)func_set_dict}, - {"__dict__", (getter)func_get_dict, (setter)func_set_dict}, - {"func_name", (getter)func_get_name, (setter)func_set_name}, - {"__name__", (getter)func_get_name, (setter)func_set_name}, - {NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(func_doc, -"function(code, globals[, name[, argdefs[, closure]]])\n\ -\n\ -Create a function object from a code object and a dictionary.\n\ -The optional name string overrides the name from the code object.\n\ -The optional argdefs tuple specifies the default argument values.\n\ -The optional closure tuple supplies the bindings for free variables."); - -/* func_new() maintains the following invariants for closures. The - closure must correspond to the free variables of the code object. - - if len(code.co_freevars) == 0: - closure = NULL - else: - len(closure) == len(code.co_freevars) - for every elt in closure, type(elt) == cell -*/ - -static PyObject * -func_new(PyTypeObject* type, PyObject* args, PyObject* kw) -{ - PyCodeObject *code; - PyObject *globals; - PyObject *name = Py_None; - PyObject *defaults = Py_None; - PyObject *closure = Py_None; - PyFunctionObject *newfunc; - Py_ssize_t nfree, nclosure; - static char *kwlist[] = {"code", "globals", "name", - "argdefs", "closure", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "O!O!|OOO:function", - kwlist, - &PyCode_Type, &code, - &PyDict_Type, &globals, - &name, &defaults, &closure)) - return NULL; - if (name != Py_None && !PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, - "arg 3 (name) must be None or string"); - return NULL; - } - if (defaults != Py_None && !PyTuple_Check(defaults)) { - PyErr_SetString(PyExc_TypeError, - "arg 4 (defaults) must be None or tuple"); - return NULL; - } - nfree = PyTuple_GET_SIZE(code->co_freevars); - if (!PyTuple_Check(closure)) { - if (nfree && closure == Py_None) { - PyErr_SetString(PyExc_TypeError, - "arg 5 (closure) must be tuple"); - return NULL; - } - else if (closure != Py_None) { - PyErr_SetString(PyExc_TypeError, - "arg 5 (closure) must be None or tuple"); - return NULL; - } - } - - /* check that the closure is well-formed */ - nclosure = closure == Py_None ? 0 : PyTuple_GET_SIZE(closure); - if (nfree != nclosure) - return PyErr_Format(PyExc_ValueError, - "%s requires closure of length %zd, not %zd", - PyString_AS_STRING(code->co_name), - nfree, nclosure); - if (nclosure) { - Py_ssize_t i; - for (i = 0; i < nclosure; i++) { - PyObject *o = PyTuple_GET_ITEM(closure, i); - if (!PyCell_Check(o)) { - return PyErr_Format(PyExc_TypeError, - "arg 5 (closure) expected cell, found %s", - o->ob_type->tp_name); - } - } - } - - newfunc = (PyFunctionObject *)PyFunction_New((PyObject *)code, - globals); - if (newfunc == NULL) - return NULL; - - if (name != Py_None) { - Py_INCREF(name); - Py_DECREF(newfunc->func_name); - newfunc->func_name = name; - } - if (defaults != Py_None) { - Py_INCREF(defaults); - newfunc->func_defaults = defaults; - } - if (closure != Py_None) { - Py_INCREF(closure); - newfunc->func_closure = closure; - } - - return (PyObject *)newfunc; -} - -static void -func_dealloc(PyFunctionObject *op) -{ - _PyObject_GC_UNTRACK(op); - if (op->func_weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) op); - Py_DECREF(op->func_code); - Py_DECREF(op->func_globals); - Py_XDECREF(op->func_module); - Py_DECREF(op->func_name); - Py_XDECREF(op->func_defaults); - Py_XDECREF(op->func_doc); - Py_XDECREF(op->func_dict); - Py_XDECREF(op->func_closure); - PyObject_GC_Del(op); -} - -static PyObject* -func_repr(PyFunctionObject *op) -{ - return PyString_FromFormat("", - PyString_AsString(op->func_name), - op); -} - -static int -func_traverse(PyFunctionObject *f, visitproc visit, void *arg) -{ - Py_VISIT(f->func_code); - Py_VISIT(f->func_globals); - Py_VISIT(f->func_module); - Py_VISIT(f->func_defaults); - Py_VISIT(f->func_doc); - Py_VISIT(f->func_name); - Py_VISIT(f->func_dict); - Py_VISIT(f->func_closure); - return 0; -} - -static PyObject * -function_call(PyObject *func, PyObject *arg, PyObject *kw) -{ - PyObject *result; - PyObject *argdefs; - PyObject *kwtuple = NULL; - PyObject **d, **k; - Py_ssize_t nk, nd; - - argdefs = PyFunction_GET_DEFAULTS(func); - if (argdefs != NULL && PyTuple_Check(argdefs)) { - d = &PyTuple_GET_ITEM((PyTupleObject *)argdefs, 0); - nd = PyTuple_GET_SIZE(argdefs); - } - else { - d = NULL; - nd = 0; - } - - if (kw != NULL && PyDict_Check(kw)) { - Py_ssize_t pos, i; - nk = PyDict_Size(kw); - kwtuple = PyTuple_New(2*nk); - if (kwtuple == NULL) - return NULL; - k = &PyTuple_GET_ITEM(kwtuple, 0); - pos = i = 0; - while (PyDict_Next(kw, &pos, &k[i], &k[i+1])) { - Py_INCREF(k[i]); - Py_INCREF(k[i+1]); - i += 2; - } - nk = i/2; - } - else { - k = NULL; - nk = 0; - } - - result = PyEval_EvalCodeEx( - (PyCodeObject *)PyFunction_GET_CODE(func), - PyFunction_GET_GLOBALS(func), (PyObject *)NULL, - &PyTuple_GET_ITEM(arg, 0), PyTuple_GET_SIZE(arg), - k, nk, d, nd, - PyFunction_GET_CLOSURE(func)); - - Py_XDECREF(kwtuple); - - return result; -} - -/* Bind a function to an object */ -static PyObject * -func_descr_get(PyObject *func, PyObject *obj, PyObject *type) -{ - if (obj == Py_None) - obj = NULL; - return PyMethod_New(func, obj, type); -} - -PyTypeObject PyFunction_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "function", - sizeof(PyFunctionObject), - 0, - (destructor)func_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)func_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - function_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - func_doc, /* tp_doc */ - (traverseproc)func_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyFunctionObject, func_weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - func_memberlist, /* tp_members */ - func_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - func_descr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(PyFunctionObject, func_dict), /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - func_new, /* tp_new */ -}; - - -/* Class method object */ - -/* A class method receives the class as implicit first argument, - just like an instance method receives the instance. - To declare a class method, use this idiom: - - class C: - def f(cls, arg1, arg2, ...): ... - f = classmethod(f) - - It can be called either on the class (e.g. C.f()) or on an instance - (e.g. C().f()); the instance is ignored except for its class. - If a class method is called for a derived class, the derived class - object is passed as the implied first argument. - - Class methods are different than C++ or Java static methods. - If you want those, see static methods below. -*/ - -typedef struct { - PyObject_HEAD - PyObject *cm_callable; -} classmethod; - -static void -cm_dealloc(classmethod *cm) -{ - _PyObject_GC_UNTRACK((PyObject *)cm); - Py_XDECREF(cm->cm_callable); - Py_TYPE(cm)->tp_free((PyObject *)cm); -} - -static int -cm_traverse(classmethod *cm, visitproc visit, void *arg) -{ - Py_VISIT(cm->cm_callable); - return 0; -} - -static int -cm_clear(classmethod *cm) -{ - Py_CLEAR(cm->cm_callable); - return 0; -} - - -static PyObject * -cm_descr_get(PyObject *self, PyObject *obj, PyObject *type) -{ - classmethod *cm = (classmethod *)self; - - if (cm->cm_callable == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "uninitialized classmethod object"); - return NULL; - } - if (type == NULL) - type = (PyObject *)(Py_TYPE(obj)); - return PyMethod_New(cm->cm_callable, - type, (PyObject *)(Py_TYPE(type))); -} - -static int -cm_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - classmethod *cm = (classmethod *)self; - PyObject *callable; - - if (!PyArg_UnpackTuple(args, "classmethod", 1, 1, &callable)) - return -1; - if (!_PyArg_NoKeywords("classmethod", kwds)) - return -1; - Py_INCREF(callable); - cm->cm_callable = callable; - return 0; -} - -static PyMemberDef cm_memberlist[] = { - {"__func__", T_OBJECT, offsetof(classmethod, cm_callable), READONLY}, - {NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(classmethod_doc, -"classmethod(function) -> method\n\ -\n\ -Convert a function to be a class method.\n\ -\n\ -A class method receives the class as implicit first argument,\n\ -just like an instance method receives the instance.\n\ -To declare a class method, use this idiom:\n\ -\n\ - class C:\n\ - def f(cls, arg1, arg2, ...): ...\n\ - f = classmethod(f)\n\ -\n\ -It can be called either on the class (e.g. C.f()) or on an instance\n\ -(e.g. C().f()). The instance is ignored except for its class.\n\ -If a class method is called for a derived class, the derived class\n\ -object is passed as the implied first argument.\n\ -\n\ -Class methods are different than C++ or Java static methods.\n\ -If you want those, see the staticmethod builtin."); - -PyTypeObject PyClassMethod_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "classmethod", - sizeof(classmethod), - 0, - (destructor)cm_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - classmethod_doc, /* tp_doc */ - (traverseproc)cm_traverse, /* tp_traverse */ - (inquiry)cm_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - cm_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - cm_descr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - cm_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -PyObject * -PyClassMethod_New(PyObject *callable) -{ - classmethod *cm = (classmethod *) - PyType_GenericAlloc(&PyClassMethod_Type, 0); - if (cm != NULL) { - Py_INCREF(callable); - cm->cm_callable = callable; - } - return (PyObject *)cm; -} - - -/* Static method object */ - -/* A static method does not receive an implicit first argument. - To declare a static method, use this idiom: - - class C: - def f(arg1, arg2, ...): ... - f = staticmethod(f) - - It can be called either on the class (e.g. C.f()) or on an instance - (e.g. C().f()); the instance is ignored except for its class. - - Static methods in Python are similar to those found in Java or C++. - For a more advanced concept, see class methods above. -*/ - -typedef struct { - PyObject_HEAD - PyObject *sm_callable; -} staticmethod; - -static void -sm_dealloc(staticmethod *sm) -{ - _PyObject_GC_UNTRACK((PyObject *)sm); - Py_XDECREF(sm->sm_callable); - Py_TYPE(sm)->tp_free((PyObject *)sm); -} - -static int -sm_traverse(staticmethod *sm, visitproc visit, void *arg) -{ - Py_VISIT(sm->sm_callable); - return 0; -} - -static int -sm_clear(staticmethod *sm) -{ - Py_CLEAR(sm->sm_callable); - return 0; -} - -static PyObject * -sm_descr_get(PyObject *self, PyObject *obj, PyObject *type) -{ - staticmethod *sm = (staticmethod *)self; - - if (sm->sm_callable == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "uninitialized staticmethod object"); - return NULL; - } - Py_INCREF(sm->sm_callable); - return sm->sm_callable; -} - -static int -sm_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - staticmethod *sm = (staticmethod *)self; - PyObject *callable; - - if (!PyArg_UnpackTuple(args, "staticmethod", 1, 1, &callable)) - return -1; - if (!_PyArg_NoKeywords("staticmethod", kwds)) - return -1; - Py_INCREF(callable); - sm->sm_callable = callable; - return 0; -} - -static PyMemberDef sm_memberlist[] = { - {"__func__", T_OBJECT, offsetof(staticmethod, sm_callable), READONLY}, - {NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(staticmethod_doc, -"staticmethod(function) -> method\n\ -\n\ -Convert a function to be a static method.\n\ -\n\ -A static method does not receive an implicit first argument.\n\ -To declare a static method, use this idiom:\n\ -\n\ - class C:\n\ - def f(arg1, arg2, ...): ...\n\ - f = staticmethod(f)\n\ -\n\ -It can be called either on the class (e.g. C.f()) or on an instance\n\ -(e.g. C().f()). The instance is ignored except for its class.\n\ -\n\ -Static methods in Python are similar to those found in Java or C++.\n\ -For a more advanced concept, see the classmethod builtin."); - -PyTypeObject PyStaticMethod_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "staticmethod", - sizeof(staticmethod), - 0, - (destructor)sm_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE | Py_TPFLAGS_HAVE_GC, - staticmethod_doc, /* tp_doc */ - (traverseproc)sm_traverse, /* tp_traverse */ - (inquiry)sm_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - sm_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - sm_descr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - sm_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -PyObject * -PyStaticMethod_New(PyObject *callable) -{ - staticmethod *sm = (staticmethod *) - PyType_GenericAlloc(&PyStaticMethod_Type, 0); - if (sm != NULL) { - Py_INCREF(callable); - sm->sm_callable = callable; - } - return (PyObject *)sm; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/genobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/genobject.c deleted file mode 100644 index 57272ce..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/genobject.c +++ /dev/null @@ -1,417 +0,0 @@ -/* Generator object implementation */ - -#include "Python.h" -#include "frameobject.h" -#include "genobject.h" -#include "ceval.h" -#include "structmember.h" -#include "opcode.h" - -static int -gen_traverse(PyGenObject *gen, visitproc visit, void *arg) -{ - Py_VISIT((PyObject *)gen->gi_frame); - Py_VISIT(gen->gi_code); - return 0; -} - -static void -gen_dealloc(PyGenObject *gen) -{ - PyObject *self = (PyObject *) gen; - - _PyObject_GC_UNTRACK(gen); - - if (gen->gi_weakreflist != NULL) - PyObject_ClearWeakRefs(self); - - _PyObject_GC_TRACK(self); - - if (gen->gi_frame != NULL && gen->gi_frame->f_stacktop != NULL) { - /* Generator is paused, so we need to close */ - Py_TYPE(gen)->tp_del(self); - if (self->ob_refcnt > 0) - return; /* resurrected. :( */ - } - - _PyObject_GC_UNTRACK(self); - Py_CLEAR(gen->gi_frame); - Py_CLEAR(gen->gi_code); - PyObject_GC_Del(gen); -} - - -static PyObject * -gen_send_ex(PyGenObject *gen, PyObject *arg, int exc) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyFrameObject *f = gen->gi_frame; - PyObject *result; - - if (gen->gi_running) { - PyErr_SetString(PyExc_ValueError, - "generator already executing"); - return NULL; - } - if (f==NULL || f->f_stacktop == NULL) { - /* Only set exception if called from send() */ - if (arg && !exc) - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } - - if (f->f_lasti == -1) { - if (arg && arg != Py_None) { - PyErr_SetString(PyExc_TypeError, - "can't send non-None value to a " - "just-started generator"); - return NULL; - } - } else { - /* Push arg onto the frame's value stack */ - result = arg ? arg : Py_None; - Py_INCREF(result); - *(f->f_stacktop++) = result; - } - - /* Generators always return to their most recent caller, not - * necessarily their creator. */ - f->f_tstate = tstate; - Py_XINCREF(tstate->frame); - assert(f->f_back == NULL); - f->f_back = tstate->frame; - - gen->gi_running = 1; - result = PyEval_EvalFrameEx(f, exc); - gen->gi_running = 0; - - /* Don't keep the reference to f_back any longer than necessary. It - * may keep a chain of frames alive or it could create a reference - * cycle. */ - assert(f->f_back == tstate->frame); - Py_CLEAR(f->f_back); - /* Clear the borrowed reference to the thread state */ - f->f_tstate = NULL; - - /* If the generator just returned (as opposed to yielding), signal - * that the generator is exhausted. */ - if (result == Py_None && f->f_stacktop == NULL) { - Py_DECREF(result); - result = NULL; - /* Set exception if not called by gen_iternext() */ - if (arg) - PyErr_SetNone(PyExc_StopIteration); - } - - if (!result || f->f_stacktop == NULL) { - /* generator can't be rerun, so release the frame */ - Py_DECREF(f); - gen->gi_frame = NULL; - } - - return result; -} - -PyDoc_STRVAR(send_doc, -"send(arg) -> send 'arg' into generator,\n\ -return next yielded value or raise StopIteration."); - -static PyObject * -gen_send(PyGenObject *gen, PyObject *arg) -{ - return gen_send_ex(gen, arg, 0); -} - -PyDoc_STRVAR(close_doc, -"close() -> raise GeneratorExit inside generator."); - -static PyObject * -gen_close(PyGenObject *gen, PyObject *args) -{ - PyObject *retval; - PyErr_SetNone(PyExc_GeneratorExit); - retval = gen_send_ex(gen, Py_None, 1); - if (retval) { - Py_DECREF(retval); - PyErr_SetString(PyExc_RuntimeError, - "generator ignored GeneratorExit"); - return NULL; - } - if (PyErr_ExceptionMatches(PyExc_StopIteration) - || PyErr_ExceptionMatches(PyExc_GeneratorExit)) - { - PyErr_Clear(); /* ignore these errors */ - Py_INCREF(Py_None); - return Py_None; - } - return NULL; -} - -static void -gen_del(PyObject *self) -{ - PyObject *res; - PyObject *error_type, *error_value, *error_traceback; - PyGenObject *gen = (PyGenObject *)self; - - if (gen->gi_frame == NULL || gen->gi_frame->f_stacktop == NULL) - /* Generator isn't paused, so no need to close */ - return; - - /* Temporarily resurrect the object. */ - assert(self->ob_refcnt == 0); - self->ob_refcnt = 1; - - /* Save the current exception, if any. */ - PyErr_Fetch(&error_type, &error_value, &error_traceback); - - res = gen_close(gen, NULL); - - if (res == NULL) - PyErr_WriteUnraisable(self); - else - Py_DECREF(res); - - /* Restore the saved exception. */ - PyErr_Restore(error_type, error_value, error_traceback); - - /* Undo the temporary resurrection; can't use DECREF here, it would - * cause a recursive call. - */ - assert(self->ob_refcnt > 0); - if (--self->ob_refcnt == 0) - return; /* this is the normal path out */ - - /* close() resurrected it! Make it look like the original Py_DECREF - * never happened. - */ - { - Py_ssize_t refcnt = self->ob_refcnt; - _Py_NewReference(self); - self->ob_refcnt = refcnt; - } - assert(PyType_IS_GC(self->ob_type) && - _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); - - /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so - * we need to undo that. */ - _Py_DEC_REFTOTAL; - /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object - * chain, so no more to do there. - * If COUNT_ALLOCS, the original decref bumped tp_frees, and - * _Py_NewReference bumped tp_allocs: both of those need to be - * undone. - */ -#ifdef COUNT_ALLOCS - --self->ob_type->tp_frees; - --self->ob_type->tp_allocs; -#endif -} - - - -PyDoc_STRVAR(throw_doc, -"throw(typ[,val[,tb]]) -> raise exception in generator,\n\ -return next yielded value or raise StopIteration."); - -static PyObject * -gen_throw(PyGenObject *gen, PyObject *args) -{ - PyObject *typ; - PyObject *tb = NULL; - PyObject *val = NULL; - - if (!PyArg_UnpackTuple(args, "throw", 1, 3, &typ, &val, &tb)) - return NULL; - - /* First, check the traceback argument, replacing None with - NULL. */ - if (tb == Py_None) - tb = NULL; - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "throw() third argument must be a traceback object"); - return NULL; - } - - Py_INCREF(typ); - Py_XINCREF(val); - Py_XINCREF(tb); - - if (PyExceptionClass_Check(typ)) { - PyErr_NormalizeException(&typ, &val, &tb); - } - - else if (PyExceptionInstance_Check(typ)) { - /* Raising an instance. The value should be a dummy. */ - if (val && val != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto failed_throw; - } - else { - /* Normalize to raise , */ - Py_XDECREF(val); - val = typ; - typ = PyExceptionInstance_Class(typ); - Py_INCREF(typ); - } - } - else { - /* Not something you can raise. throw() fails. */ - PyErr_Format(PyExc_TypeError, - "exceptions must be classes, or instances, not %s", - typ->ob_type->tp_name); - goto failed_throw; - } - - PyErr_Restore(typ, val, tb); - return gen_send_ex(gen, Py_None, 1); - -failed_throw: - /* Didn't use our arguments, so restore their original refcounts */ - Py_DECREF(typ); - Py_XDECREF(val); - Py_XDECREF(tb); - return NULL; -} - - -static PyObject * -gen_iternext(PyGenObject *gen) -{ - return gen_send_ex(gen, NULL, 0); -} - - -static PyObject * -gen_repr(PyGenObject *gen) -{ - char *code_name; - code_name = PyString_AsString(((PyCodeObject *)gen->gi_code)->co_name); - if (code_name == NULL) - return NULL; - return PyString_FromFormat("", - code_name, gen); -} - - -static PyObject * -gen_get_name(PyGenObject *gen) -{ - PyObject *name = ((PyCodeObject *)gen->gi_code)->co_name; - Py_INCREF(name); - return name; -} - - -PyDoc_STRVAR(gen__name__doc__, -"Return the name of the generator's associated code object."); - -static PyGetSetDef gen_getsetlist[] = { - {"__name__", (getter)gen_get_name, NULL, gen__name__doc__}, - {NULL} -}; - - -static PyMemberDef gen_memberlist[] = { - {"gi_frame", T_OBJECT, offsetof(PyGenObject, gi_frame), RO}, - {"gi_running", T_INT, offsetof(PyGenObject, gi_running), RO}, - {"gi_code", T_OBJECT, offsetof(PyGenObject, gi_code), RO}, - {NULL} /* Sentinel */ -}; - -static PyMethodDef gen_methods[] = { - {"send",(PyCFunction)gen_send, METH_O, send_doc}, - {"throw",(PyCFunction)gen_throw, METH_VARARGS, throw_doc}, - {"close",(PyCFunction)gen_close, METH_NOARGS, close_doc}, - {NULL, NULL} /* Sentinel */ -}; - -PyTypeObject PyGen_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "generator", /* tp_name */ - sizeof(PyGenObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)gen_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)gen_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)gen_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PyGenObject, gi_weakreflist), /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)gen_iternext, /* tp_iternext */ - gen_methods, /* tp_methods */ - gen_memberlist, /* tp_members */ - gen_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ - 0, /* tp_is_gc */ - 0, /* tp_bases */ - 0, /* tp_mro */ - 0, /* tp_cache */ - 0, /* tp_subclasses */ - 0, /* tp_weaklist */ - gen_del, /* tp_del */ -}; - -PyObject * -PyGen_New(PyFrameObject *f) -{ - PyGenObject *gen = PyObject_GC_New(PyGenObject, &PyGen_Type); - if (gen == NULL) { - Py_DECREF(f); - return NULL; - } - gen->gi_frame = f; - Py_INCREF(f->f_code); - gen->gi_code = (PyObject *)(f->f_code); - gen->gi_running = 0; - gen->gi_weakreflist = NULL; - _PyObject_GC_TRACK(gen); - return (PyObject *)gen; -} - -int -PyGen_NeedsFinalizing(PyGenObject *gen) -{ - int i; - PyFrameObject *f = gen->gi_frame; - - if (f == NULL || f->f_stacktop == NULL || f->f_iblock <= 0) - return 0; /* no frame or empty blockstack == no finalization */ - - /* Any block type besides a loop requires cleanup. */ - i = f->f_iblock; - while (--i >= 0) { - if (f->f_blockstack[i].b_type != SETUP_LOOP) - return 1; - } - - /* No blocks except loops, it's safe to skip finalization. */ - return 0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/intobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/intobject.c deleted file mode 100644 index 93732b0..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/intobject.c +++ /dev/null @@ -1,1581 +0,0 @@ - -/* Integer object implementation */ - -#include "Python.h" -#include -#include - -static PyObject *int_int(PyIntObject *v); - -long -PyInt_GetMax(void) -{ - return LONG_MAX; /* To initialize sys.maxint */ -} - -/* Integers are quite normal objects, to make object handling uniform. - (Using odd pointers to represent integers would save much space - but require extra checks for this special case throughout the code.) - Since a typical Python program spends much of its time allocating - and deallocating integers, these operations should be very fast. - Therefore we use a dedicated allocation scheme with a much lower - overhead (in space and time) than straight malloc(): a simple - dedicated free list, filled when necessary with memory from malloc(). - - block_list is a singly-linked list of all PyIntBlocks ever allocated, - linked via their next members. PyIntBlocks are never returned to the - system before shutdown (PyInt_Fini). - - free_list is a singly-linked list of available PyIntObjects, linked - via abuse of their ob_type members. -*/ - -#define BLOCK_SIZE 1000 /* 1K less typical malloc overhead */ -#define BHEAD_SIZE 8 /* Enough for a 64-bit pointer */ -#define N_INTOBJECTS ((BLOCK_SIZE - BHEAD_SIZE) / sizeof(PyIntObject)) - -struct _intblock { - struct _intblock *next; - PyIntObject objects[N_INTOBJECTS]; -}; - -typedef struct _intblock PyIntBlock; - -static PyIntBlock *block_list = NULL; -static PyIntObject *free_list = NULL; - -static PyIntObject * -fill_free_list(void) -{ - PyIntObject *p, *q; - /* Python's object allocator isn't appropriate for large blocks. */ - p = (PyIntObject *) PyMem_MALLOC(sizeof(PyIntBlock)); - if (p == NULL) - return (PyIntObject *) PyErr_NoMemory(); - ((PyIntBlock *)p)->next = block_list; - block_list = (PyIntBlock *)p; - /* Link the int objects together, from rear to front, then return - the address of the last int object in the block. */ - p = &((PyIntBlock *)p)->objects[0]; - q = p + N_INTOBJECTS; - while (--q > p) - Py_TYPE(q) = (struct _typeobject *)(q-1); - Py_TYPE(q) = NULL; - return p + N_INTOBJECTS - 1; -} - -#ifndef NSMALLPOSINTS -#define NSMALLPOSINTS 257 -#endif -#ifndef NSMALLNEGINTS -#define NSMALLNEGINTS 5 -#endif -#if NSMALLNEGINTS + NSMALLPOSINTS > 0 -/* References to small integers are saved in this array so that they - can be shared. - The integers that are saved are those in the range - -NSMALLNEGINTS (inclusive) to NSMALLPOSINTS (not inclusive). -*/ -static PyIntObject *small_ints[NSMALLNEGINTS + NSMALLPOSINTS]; -#endif -#ifdef COUNT_ALLOCS -Py_ssize_t quick_int_allocs; -Py_ssize_t quick_neg_int_allocs; -#endif - -PyObject * -PyInt_FromLong(long ival) -{ - register PyIntObject *v; -#if NSMALLNEGINTS + NSMALLPOSINTS > 0 - if (-NSMALLNEGINTS <= ival && ival < NSMALLPOSINTS) { - v = small_ints[ival + NSMALLNEGINTS]; - Py_INCREF(v); -#ifdef COUNT_ALLOCS - if (ival >= 0) - quick_int_allocs++; - else - quick_neg_int_allocs++; -#endif - return (PyObject *) v; - } -#endif - if (free_list == NULL) { - if ((free_list = fill_free_list()) == NULL) - return NULL; - } - /* Inline PyObject_New */ - v = free_list; - free_list = (PyIntObject *)Py_TYPE(v); - PyObject_INIT(v, &PyInt_Type); - v->ob_ival = ival; - return (PyObject *) v; -} - -PyObject * -PyInt_FromSize_t(size_t ival) -{ - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - return _PyLong_FromSize_t(ival); -} - -PyObject * -PyInt_FromSsize_t(Py_ssize_t ival) -{ - if (ival >= LONG_MIN && ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - return _PyLong_FromSsize_t(ival); -} - -static void -int_dealloc(PyIntObject *v) -{ - if (PyInt_CheckExact(v)) { - Py_TYPE(v) = (struct _typeobject *)free_list; - free_list = v; - } - else - Py_TYPE(v)->tp_free((PyObject *)v); -} - -static void -int_free(PyIntObject *v) -{ - Py_TYPE(v) = (struct _typeobject *)free_list; - free_list = v; -} - -long -PyInt_AsLong(register PyObject *op) -{ - PyNumberMethods *nb; - PyIntObject *io; - long val; - - if (op && PyInt_Check(op)) - return PyInt_AS_LONG((PyIntObject*) op); - - if (op == NULL || (nb = Py_TYPE(op)->tp_as_number) == NULL || - nb->nb_int == NULL) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return -1; - } - - io = (PyIntObject*) (*nb->nb_int) (op); - if (io == NULL) - return -1; - if (!PyInt_Check(io)) { - if (PyLong_Check(io)) { - /* got a long? => retry int conversion */ - val = PyLong_AsLong((PyObject *)io); - Py_DECREF(io); - if ((val == -1) && PyErr_Occurred()) - return -1; - return val; - } - else - { - Py_DECREF(io); - PyErr_SetString(PyExc_TypeError, - "__int__ method should return an integer"); - return -1; - } - } - - val = PyInt_AS_LONG(io); - Py_DECREF(io); - - return val; -} - -int -_PyInt_AsInt(PyObject *obj) -{ - long result = PyInt_AsLong(obj); - if (result == -1 && PyErr_Occurred()) - return -1; - if (result > INT_MAX || result < INT_MIN) { - PyErr_SetString(PyExc_OverflowError, - "Python int too large to convert to C int"); - return -1; - } - return (int)result; -} - -Py_ssize_t -PyInt_AsSsize_t(register PyObject *op) -{ -#if SIZEOF_SIZE_T != SIZEOF_LONG - PyNumberMethods *nb; - PyObject *io; - Py_ssize_t val; -#endif - - if (op == NULL) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return -1; - } - - if (PyInt_Check(op)) - return PyInt_AS_LONG((PyIntObject*) op); - if (PyLong_Check(op)) - return _PyLong_AsSsize_t(op); -#if SIZEOF_SIZE_T == SIZEOF_LONG - return PyInt_AsLong(op); -#else - - if ((nb = Py_TYPE(op)->tp_as_number) == NULL || - (nb->nb_int == NULL && nb->nb_long == 0)) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return -1; - } - - if (nb->nb_long != 0) - io = (*nb->nb_long)(op); - else - io = (*nb->nb_int)(op); - if (io == NULL) - return -1; - if (!PyInt_Check(io)) { - if (PyLong_Check(io)) { - /* got a long? => retry int conversion */ - val = _PyLong_AsSsize_t(io); - Py_DECREF(io); - if ((val == -1) && PyErr_Occurred()) - return -1; - return val; - } - else - { - Py_DECREF(io); - PyErr_SetString(PyExc_TypeError, - "__int__ method should return an integer"); - return -1; - } - } - - val = PyInt_AS_LONG(io); - Py_DECREF(io); - - return val; -#endif -} - -unsigned long -PyInt_AsUnsignedLongMask(register PyObject *op) -{ - PyNumberMethods *nb; - PyIntObject *io; - unsigned long val; - - if (op && PyInt_Check(op)) - return PyInt_AS_LONG((PyIntObject*) op); - if (op && PyLong_Check(op)) - return PyLong_AsUnsignedLongMask(op); - - if (op == NULL || (nb = Py_TYPE(op)->tp_as_number) == NULL || - nb->nb_int == NULL) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return (unsigned long)-1; - } - - io = (PyIntObject*) (*nb->nb_int) (op); - if (io == NULL) - return (unsigned long)-1; - if (!PyInt_Check(io)) { - if (PyLong_Check(io)) { - val = PyLong_AsUnsignedLongMask((PyObject *)io); - Py_DECREF(io); - if (PyErr_Occurred()) - return (unsigned long)-1; - return val; - } - else - { - Py_DECREF(io); - PyErr_SetString(PyExc_TypeError, - "__int__ method should return an integer"); - return (unsigned long)-1; - } - } - - val = PyInt_AS_LONG(io); - Py_DECREF(io); - - return val; -} - -#ifdef HAVE_LONG_LONG -unsigned PY_LONG_LONG -PyInt_AsUnsignedLongLongMask(register PyObject *op) -{ - PyNumberMethods *nb; - PyIntObject *io; - unsigned PY_LONG_LONG val; - - if (op && PyInt_Check(op)) - return PyInt_AS_LONG((PyIntObject*) op); - if (op && PyLong_Check(op)) - return PyLong_AsUnsignedLongLongMask(op); - - if (op == NULL || (nb = Py_TYPE(op)->tp_as_number) == NULL || - nb->nb_int == NULL) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return (unsigned PY_LONG_LONG)-1; - } - - io = (PyIntObject*) (*nb->nb_int) (op); - if (io == NULL) - return (unsigned PY_LONG_LONG)-1; - if (!PyInt_Check(io)) { - if (PyLong_Check(io)) { - val = PyLong_AsUnsignedLongLongMask((PyObject *)io); - Py_DECREF(io); - if (PyErr_Occurred()) - return (unsigned PY_LONG_LONG)-1; - return val; - } - else - { - Py_DECREF(io); - PyErr_SetString(PyExc_TypeError, - "__int__ method should return an integer"); - return (unsigned PY_LONG_LONG)-1; - } - } - - val = PyInt_AS_LONG(io); - Py_DECREF(io); - - return val; -} -#endif - -PyObject * -PyInt_FromString(char *s, char **pend, int base) -{ - char *end; - long x; - Py_ssize_t slen; - PyObject *sobj, *srepr; - - if ((base != 0 && base < 2) || base > 36) { - PyErr_SetString(PyExc_ValueError, - "int() base must be >= 2 and <= 36"); - return NULL; - } - - while (*s && isspace(Py_CHARMASK(*s))) - s++; - errno = 0; - if (base == 0 && s[0] == '0') { - x = (long) PyOS_strtoul(s, &end, base); - if (x < 0) - return PyLong_FromString(s, pend, base); - } - else - x = PyOS_strtol(s, &end, base); - if (end == s || !isalnum(Py_CHARMASK(end[-1]))) - goto bad; - while (*end && isspace(Py_CHARMASK(*end))) - end++; - if (*end != '\0') { - bad: - slen = strlen(s) < 200 ? strlen(s) : 200; - sobj = PyString_FromStringAndSize(s, slen); - if (sobj == NULL) - return NULL; - srepr = PyObject_Repr(sobj); - Py_DECREF(sobj); - if (srepr == NULL) - return NULL; - PyErr_Format(PyExc_ValueError, - "invalid literal for int() with base %d: %s", - base, PyString_AS_STRING(srepr)); - Py_DECREF(srepr); - return NULL; - } - else if (errno != 0) - return PyLong_FromString(s, pend, base); - if (pend) - *pend = end; - return PyInt_FromLong(x); -} - -#ifdef Py_USING_UNICODE -PyObject * -PyInt_FromUnicode(Py_UNICODE *s, Py_ssize_t length, int base) -{ - PyObject *result; - char *buffer = (char *)PyMem_MALLOC(length+1); - - if (buffer == NULL) - return PyErr_NoMemory(); - - if (PyUnicode_EncodeDecimal(s, length, buffer, NULL)) { - PyMem_FREE(buffer); - return NULL; - } - result = PyInt_FromString(buffer, NULL, base); - PyMem_FREE(buffer); - return result; -} -#endif - -/* Methods */ - -/* Integers are seen as the "smallest" of all numeric types and thus - don't have any knowledge about conversion of other types to - integers. */ - -#define CONVERT_TO_LONG(obj, lng) \ - if (PyInt_Check(obj)) { \ - lng = PyInt_AS_LONG(obj); \ - } \ - else { \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ - } - -/* ARGSUSED */ -static int -int_print(PyIntObject *v, FILE *fp, int flags) - /* flags -- not used but required by interface */ -{ - long int_val = v->ob_ival; - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "%ld", int_val); - Py_END_ALLOW_THREADS - return 0; -} - -static int -int_compare(PyIntObject *v, PyIntObject *w) -{ - register long i = v->ob_ival; - register long j = w->ob_ival; - return (i < j) ? -1 : (i > j) ? 1 : 0; -} - -static long -int_hash(PyIntObject *v) -{ - /* XXX If this is changed, you also need to change the way - Python's long, float and complex types are hashed. */ - long x = v -> ob_ival; - if (x == -1) - x = -2; - return x; -} - -static PyObject * -int_add(PyIntObject *v, PyIntObject *w) -{ - register long a, b, x; - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - /* casts in the line below avoid undefined behaviour on overflow */ - x = (long)((unsigned long)a + b); - if ((x^a) >= 0 || (x^b) >= 0) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_add((PyObject *)v, (PyObject *)w); -} - -static PyObject * -int_sub(PyIntObject *v, PyIntObject *w) -{ - register long a, b, x; - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - /* casts in the line below avoid undefined behaviour on overflow */ - x = (long)((unsigned long)a - b); - if ((x^a) >= 0 || (x^~b) >= 0) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract((PyObject *)v, - (PyObject *)w); -} - -/* -Integer overflow checking for * is painful: Python tried a couple ways, but -they didn't work on all platforms, or failed in endcases (a product of --sys.maxint-1 has been a particular pain). - -Here's another way: - -The native long product x*y is either exactly right or *way* off, being -just the last n bits of the true product, where n is the number of bits -in a long (the delivered product is the true product plus i*2**n for -some integer i). - -The native double product (double)x * (double)y is subject to three -rounding errors: on a sizeof(long)==8 box, each cast to double can lose -info, and even on a sizeof(long)==4 box, the multiplication can lose info. -But, unlike the native long product, it's not in *range* trouble: even -if sizeof(long)==32 (256-bit longs), the product easily fits in the -dynamic range of a double. So the leading 50 (or so) bits of the double -product are correct. - -We check these two ways against each other, and declare victory if they're -approximately the same. Else, because the native long product is the only -one that can lose catastrophic amounts of information, it's the native long -product that must have overflowed. -*/ - -static PyObject * -int_mul(PyObject *v, PyObject *w) -{ - long a, b; - long longprod; /* a*b in native long arithmetic */ - double doubled_longprod; /* (double)longprod */ - double doubleprod; /* (double)a * (double)b */ - - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - /* casts in the next line avoid undefined behaviour on overflow */ - longprod = (long)((unsigned long)a * b); - doubleprod = (double)a * (double)b; - doubled_longprod = (double)longprod; - - /* Fast path for normal case: small multiplicands, and no info - is lost in either method. */ - if (doubled_longprod == doubleprod) - return PyInt_FromLong(longprod); - - /* Somebody somewhere lost info. Close enough, or way off? Note - that a != 0 and b != 0 (else doubled_longprod == doubleprod == 0). - The difference either is or isn't significant compared to the - true value (of which doubleprod is a good approximation). - */ - { - const double diff = doubled_longprod - doubleprod; - const double absdiff = diff >= 0.0 ? diff : -diff; - const double absprod = doubleprod >= 0.0 ? doubleprod : - -doubleprod; - /* absdiff/absprod <= 1/32 iff - 32 * absdiff <= absprod -- 5 good bits is "close enough" */ - if (32.0 * absdiff <= absprod) - return PyInt_FromLong(longprod); - else - return PyLong_Type.tp_as_number->nb_multiply(v, w); - } -} - -/* Integer overflow checking for unary negation: on a 2's-complement - * box, -x overflows iff x is the most negative long. In this case we - * get -x == x. However, -x is undefined (by C) if x /is/ the most - * negative long (it's a signed overflow case), and some compilers care. - * So we cast x to unsigned long first. However, then other compilers - * warn about applying unary minus to an unsigned operand. Hence the - * weird "0-". - */ -#define UNARY_NEG_WOULD_OVERFLOW(x) \ - ((x) < 0 && (unsigned long)(x) == 0-(unsigned long)(x)) - -/* Return type of i_divmod */ -enum divmod_result { - DIVMOD_OK, /* Correct result */ - DIVMOD_OVERFLOW, /* Overflow, try again using longs */ - DIVMOD_ERROR /* Exception raised */ -}; - -static enum divmod_result -i_divmod(register long x, register long y, - long *p_xdivy, long *p_xmody) -{ - long xdivy, xmody; - - if (y == 0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "integer division or modulo by zero"); - return DIVMOD_ERROR; - } - /* (-sys.maxint-1)/-1 is the only overflow case. */ - if (y == -1 && UNARY_NEG_WOULD_OVERFLOW(x)) - return DIVMOD_OVERFLOW; - xdivy = x / y; - /* xdiv*y can overflow on platforms where x/y gives floor(x/y) - * for x and y with differing signs. (This is unusual - * behaviour, and C99 prohibits it, but it's allowed by C89; - * for an example of overflow, take x = LONG_MIN, y = 5 or x = - * LONG_MAX, y = -5.) However, x - xdivy*y is always - * representable as a long, since it lies strictly between - * -abs(y) and abs(y). We add casts to avoid intermediate - * overflow. - */ - xmody = (long)(x - (unsigned long)xdivy * y); - /* If the signs of x and y differ, and the remainder is non-0, - * C89 doesn't define whether xdivy is now the floor or the - * ceiling of the infinitely precise quotient. We want the floor, - * and we have it iff the remainder's sign matches y's. - */ - if (xmody && ((y ^ xmody) < 0) /* i.e. and signs differ */) { - xmody += y; - --xdivy; - assert(xmody && ((y ^ xmody) >= 0)); - } - *p_xdivy = xdivy; - *p_xmody = xmody; - return DIVMOD_OK; -} - -static PyObject * -int_div(PyIntObject *x, PyIntObject *y) -{ - long xi, yi; - long d, m; - CONVERT_TO_LONG(x, xi); - CONVERT_TO_LONG(y, yi); - switch (i_divmod(xi, yi, &d, &m)) { - case DIVMOD_OK: - return PyInt_FromLong(d); - case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_divide((PyObject *)x, - (PyObject *)y); - default: - return NULL; - } -} - -static PyObject * -int_classic_div(PyIntObject *x, PyIntObject *y) -{ - long xi, yi; - long d, m; - CONVERT_TO_LONG(x, xi); - CONVERT_TO_LONG(y, yi); - if (Py_DivisionWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, "classic int division") < 0) - return NULL; - switch (i_divmod(xi, yi, &d, &m)) { - case DIVMOD_OK: - return PyInt_FromLong(d); - case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_divide((PyObject *)x, - (PyObject *)y); - default: - return NULL; - } -} - -static PyObject * -int_true_divide(PyIntObject *x, PyIntObject *y) -{ - long xi, yi; - /* If they aren't both ints, give someone else a chance. In - particular, this lets int/long get handled by longs, which - underflows to 0 gracefully if the long is too big to convert - to float. */ - CONVERT_TO_LONG(x, xi); - CONVERT_TO_LONG(y, yi); - if (yi == 0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "division by zero"); - return NULL; - } - if (xi == 0) - return PyFloat_FromDouble(yi < 0 ? -0.0 : 0.0); - -#define WIDTH_OF_ULONG (CHAR_BIT*SIZEOF_LONG) -#if DBL_MANT_DIG < WIDTH_OF_ULONG - if ((xi >= 0 ? 0UL + xi : 0UL - xi) >> DBL_MANT_DIG || - (yi >= 0 ? 0UL + yi : 0UL - yi) >> DBL_MANT_DIG) - /* Large x or y. Use long integer arithmetic. */ - return PyLong_Type.tp_as_number->nb_true_divide( - (PyObject *)x, (PyObject *)y); - else -#endif - /* Both ints can be exactly represented as doubles. Do a - floating-point division. */ - return PyFloat_FromDouble((double)xi / (double)yi); -} - -static PyObject * -int_mod(PyIntObject *x, PyIntObject *y) -{ - long xi, yi; - long d, m; - CONVERT_TO_LONG(x, xi); - CONVERT_TO_LONG(y, yi); - switch (i_divmod(xi, yi, &d, &m)) { - case DIVMOD_OK: - return PyInt_FromLong(m); - case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_remainder((PyObject *)x, - (PyObject *)y); - default: - return NULL; - } -} - -static PyObject * -int_divmod(PyIntObject *x, PyIntObject *y) -{ - long xi, yi; - long d, m; - CONVERT_TO_LONG(x, xi); - CONVERT_TO_LONG(y, yi); - switch (i_divmod(xi, yi, &d, &m)) { - case DIVMOD_OK: - return Py_BuildValue("(ll)", d, m); - case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_divmod((PyObject *)x, - (PyObject *)y); - default: - return NULL; - } -} - -static PyObject * -int_pow(PyIntObject *v, PyIntObject *w, PyIntObject *z) -{ - register long iv, iw, iz=0, ix, temp, prev; - CONVERT_TO_LONG(v, iv); - CONVERT_TO_LONG(w, iw); - if (iw < 0) { - if ((PyObject *)z != Py_None) { - PyErr_SetString(PyExc_TypeError, "pow() 2nd argument " - "cannot be negative when 3rd argument specified"); - return NULL; - } - /* Return a float. This works because we know that - this calls float_pow() which converts its - arguments to double. */ - return PyFloat_Type.tp_as_number->nb_power( - (PyObject *)v, (PyObject *)w, (PyObject *)z); - } - if ((PyObject *)z != Py_None) { - CONVERT_TO_LONG(z, iz); - if (iz == 0) { - PyErr_SetString(PyExc_ValueError, - "pow() 3rd argument cannot be 0"); - return NULL; - } - } - /* - * XXX: The original exponentiation code stopped looping - * when temp hit zero; this code will continue onwards - * unnecessarily, but at least it won't cause any errors. - * Hopefully the speed improvement from the fast exponentiation - * will compensate for the slight inefficiency. - * XXX: Better handling of overflows is desperately needed. - */ - temp = iv; - ix = 1; - while (iw > 0) { - prev = ix; /* Save value for overflow check */ - if (iw & 1) { - /* - * The (unsigned long) cast below ensures that the multiplication - * is interpreted as an unsigned operation rather than a signed one - * (C99 6.3.1.8p1), thus avoiding the perils of undefined behaviour - * from signed arithmetic overflow (C99 6.5p5). See issue #12973. - */ - ix = (unsigned long)ix * temp; - if (temp == 0) - break; /* Avoid ix / 0 */ - if (ix / temp != prev) { - return PyLong_Type.tp_as_number->nb_power( - (PyObject *)v, - (PyObject *)w, - (PyObject *)z); - } - } - iw >>= 1; /* Shift exponent down by 1 bit */ - if (iw==0) break; - prev = temp; - temp = (unsigned long)temp * temp; /* Square the value of temp */ - if (prev != 0 && temp / prev != prev) { - return PyLong_Type.tp_as_number->nb_power( - (PyObject *)v, (PyObject *)w, (PyObject *)z); - } - if (iz) { - /* If we did a multiplication, perform a modulo */ - ix = ix % iz; - temp = temp % iz; - } - } - if (iz) { - long div, mod; - switch (i_divmod(ix, iz, &div, &mod)) { - case DIVMOD_OK: - ix = mod; - break; - case DIVMOD_OVERFLOW: - return PyLong_Type.tp_as_number->nb_power( - (PyObject *)v, (PyObject *)w, (PyObject *)z); - default: - return NULL; - } - } - return PyInt_FromLong(ix); -} - -static PyObject * -int_neg(PyIntObject *v) -{ - register long a; - a = v->ob_ival; - /* check for overflow */ - if (UNARY_NEG_WOULD_OVERFLOW(a)) { - PyObject *o = PyLong_FromLong(a); - if (o != NULL) { - PyObject *result = PyNumber_Negative(o); - Py_DECREF(o); - return result; - } - return NULL; - } - return PyInt_FromLong(-a); -} - -static PyObject * -int_abs(PyIntObject *v) -{ - if (v->ob_ival >= 0) - return int_int(v); - else - return int_neg(v); -} - -static int -int_nonzero(PyIntObject *v) -{ - return v->ob_ival != 0; -} - -static PyObject * -int_invert(PyIntObject *v) -{ - return PyInt_FromLong(~v->ob_ival); -} - -static PyObject * -int_lshift(PyIntObject *v, PyIntObject *w) -{ - long a, b, c; - PyObject *vv, *ww, *result; - - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - if (b < 0) { - PyErr_SetString(PyExc_ValueError, "negative shift count"); - return NULL; - } - if (a == 0 || b == 0) - return int_int(v); - if (b >= LONG_BIT) { - vv = PyLong_FromLong(PyInt_AS_LONG(v)); - if (vv == NULL) - return NULL; - ww = PyLong_FromLong(PyInt_AS_LONG(w)); - if (ww == NULL) { - Py_DECREF(vv); - return NULL; - } - result = PyNumber_Lshift(vv, ww); - Py_DECREF(vv); - Py_DECREF(ww); - return result; - } - c = a << b; - if (a != Py_ARITHMETIC_RIGHT_SHIFT(long, c, b)) { - vv = PyLong_FromLong(PyInt_AS_LONG(v)); - if (vv == NULL) - return NULL; - ww = PyLong_FromLong(PyInt_AS_LONG(w)); - if (ww == NULL) { - Py_DECREF(vv); - return NULL; - } - result = PyNumber_Lshift(vv, ww); - Py_DECREF(vv); - Py_DECREF(ww); - return result; - } - return PyInt_FromLong(c); -} - -static PyObject * -int_rshift(PyIntObject *v, PyIntObject *w) -{ - register long a, b; - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - if (b < 0) { - PyErr_SetString(PyExc_ValueError, "negative shift count"); - return NULL; - } - if (a == 0 || b == 0) - return int_int(v); - if (b >= LONG_BIT) { - if (a < 0) - a = -1; - else - a = 0; - } - else { - a = Py_ARITHMETIC_RIGHT_SHIFT(long, a, b); - } - return PyInt_FromLong(a); -} - -static PyObject * -int_and(PyIntObject *v, PyIntObject *w) -{ - register long a, b; - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - return PyInt_FromLong(a & b); -} - -static PyObject * -int_xor(PyIntObject *v, PyIntObject *w) -{ - register long a, b; - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - return PyInt_FromLong(a ^ b); -} - -static PyObject * -int_or(PyIntObject *v, PyIntObject *w) -{ - register long a, b; - CONVERT_TO_LONG(v, a); - CONVERT_TO_LONG(w, b); - return PyInt_FromLong(a | b); -} - -static int -int_coerce(PyObject **pv, PyObject **pw) -{ - if (PyInt_Check(*pw)) { - Py_INCREF(*pv); - Py_INCREF(*pw); - return 0; - } - return 1; /* Can't do it */ -} - -static PyObject * -int_int(PyIntObject *v) -{ - if (PyInt_CheckExact(v)) - Py_INCREF(v); - else - v = (PyIntObject *)PyInt_FromLong(v->ob_ival); - return (PyObject *)v; -} - -static PyObject * -int_long(PyIntObject *v) -{ - return PyLong_FromLong((v -> ob_ival)); -} - -static const unsigned char BitLengthTable[32] = { - 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 -}; - -static int -bits_in_ulong(unsigned long d) -{ - int d_bits = 0; - while (d >= 32) { - d_bits += 6; - d >>= 6; - } - d_bits += (int)BitLengthTable[d]; - return d_bits; -} - -#if 8*SIZEOF_LONG-1 <= DBL_MANT_DIG -/* Every Python int can be exactly represented as a float. */ - -static PyObject * -int_float(PyIntObject *v) -{ - return PyFloat_FromDouble((double)(v -> ob_ival)); -} - -#else -/* Here not all Python ints are exactly representable as floats, so we may - have to round. We do this manually, since the C standards don't specify - whether converting an integer to a float rounds up or down */ - -static PyObject * -int_float(PyIntObject *v) -{ - unsigned long abs_ival, lsb; - int round_up; - - if (v->ob_ival < 0) - abs_ival = 0U-(unsigned long)v->ob_ival; - else - abs_ival = (unsigned long)v->ob_ival; - if (abs_ival < (1L << DBL_MANT_DIG)) - /* small integer; no need to round */ - return PyFloat_FromDouble((double)v->ob_ival); - - /* Round abs_ival to MANT_DIG significant bits, using the - round-half-to-even rule. abs_ival & lsb picks out the 'rounding' - bit: the first bit after the most significant MANT_DIG bits of - abs_ival. We round up if this bit is set, provided that either: - - (1) abs_ival isn't exactly halfway between two floats, in which - case at least one of the bits following the rounding bit must be - set; i.e., abs_ival & lsb-1 != 0, or: - - (2) the resulting rounded value has least significant bit 0; or - in other words the bit above the rounding bit is set (this is the - 'to-even' bit of round-half-to-even); i.e., abs_ival & 2*lsb != 0 - - The condition "(1) or (2)" equates to abs_ival & 3*lsb-1 != 0. */ - - lsb = 1L << (bits_in_ulong(abs_ival)-DBL_MANT_DIG-1); - round_up = (abs_ival & lsb) && (abs_ival & (3*lsb-1)); - abs_ival &= -2*lsb; - if (round_up) - abs_ival += 2*lsb; - return PyFloat_FromDouble(v->ob_ival < 0 ? - -(double)abs_ival : - (double)abs_ival); -} - -#endif - -static PyObject * -int_oct(PyIntObject *v) -{ - return _PyInt_Format(v, 8, 0); -} - -static PyObject * -int_hex(PyIntObject *v) -{ - return _PyInt_Format(v, 16, 0); -} - -static PyObject * -int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -int_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - int base = -909; - static char *kwlist[] = {"x", "base", 0}; - - if (type != &PyInt_Type) - return int_subtype_new(type, args, kwds); /* Wimp out */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oi:int", kwlist, - &x, &base)) - return NULL; - if (x == NULL) { - if (base != -909) { - PyErr_SetString(PyExc_TypeError, - "int() missing string argument"); - return NULL; - } - return PyInt_FromLong(0L); - } - if (base == -909) - return PyNumber_Int(x); - if (PyString_Check(x)) { - /* Since PyInt_FromString doesn't have a length parameter, - * check here for possible NULs in the string. */ - char *string = PyString_AS_STRING(x); - if (strlen(string) != PyString_Size(x)) { - /* create a repr() of the input string, - * just like PyInt_FromString does */ - PyObject *srepr; - srepr = PyObject_Repr(x); - if (srepr == NULL) - return NULL; - PyErr_Format(PyExc_ValueError, - "invalid literal for int() with base %d: %s", - base, PyString_AS_STRING(srepr)); - Py_DECREF(srepr); - return NULL; - } - return PyInt_FromString(string, NULL, base); - } -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(x)) - return PyInt_FromUnicode(PyUnicode_AS_UNICODE(x), - PyUnicode_GET_SIZE(x), - base); -#endif - PyErr_SetString(PyExc_TypeError, - "int() can't convert non-string with explicit base"); - return NULL; -} - -/* Wimpy, slow approach to tp_new calls for subtypes of int: - first create a regular int from whatever arguments we got, - then allocate a subtype instance and initialize its ob_ival - from the regular int. The regular int is then thrown away. -*/ -static PyObject * -int_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *newobj; - long ival; - - assert(PyType_IsSubtype(type, &PyInt_Type)); - tmp = int_new(&PyInt_Type, args, kwds); - if (tmp == NULL) - return NULL; - if (!PyInt_Check(tmp)) { - ival = PyLong_AsLong(tmp); - if (ival == -1 && PyErr_Occurred()) { - Py_DECREF(tmp); - return NULL; - } - } else { - ival = ((PyIntObject *)tmp)->ob_ival; - } - - newobj = type->tp_alloc(type, 0); - if (newobj == NULL) { - Py_DECREF(tmp); - return NULL; - } - ((PyIntObject *)newobj)->ob_ival = ival; - Py_DECREF(tmp); - return newobj; -} - -static PyObject * -int_getnewargs(PyIntObject *v) -{ - return Py_BuildValue("(l)", v->ob_ival); -} - -static PyObject * -int_get0(PyIntObject *v, void *context) { - return PyInt_FromLong(0L); -} - -static PyObject * -int_get1(PyIntObject *v, void *context) { - return PyInt_FromLong(1L); -} - -/* Convert an integer to a decimal string. On many platforms, this - will be significantly faster than the general arbitrary-base - conversion machinery in _PyInt_Format, thanks to optimization - opportunities offered by division by a compile-time constant. */ -static PyObject * -int_to_decimal_string(PyIntObject *v) { - char buf[sizeof(long)*CHAR_BIT/3+6], *p, *bufend; - long n = v->ob_ival; - unsigned long absn; - p = bufend = buf + sizeof(buf); - absn = n < 0 ? 0UL - n : n; - do { - *--p = '0' + (char)(absn % 10); - absn /= 10; - } while (absn); - if (n < 0) - *--p = '-'; - return PyString_FromStringAndSize(p, bufend - p); -} - -/* Convert an integer to the given base. Returns a string. - If base is 2, 8 or 16, add the proper prefix '0b', '0o' or '0x'. - If newstyle is zero, then use the pre-2.6 behavior of octal having - a leading "0" */ -PyAPI_FUNC(PyObject*) -_PyInt_Format(PyIntObject *v, int base, int newstyle) -{ - /* There are no doubt many, many ways to optimize this, using code - similar to _PyLong_Format */ - long n = v->ob_ival; - int negative = n < 0; - int is_zero = n == 0; - - /* For the reasoning behind this size, see - http://c-faq.com/misc/hexio.html. Then, add a few bytes for - the possible sign and prefix "0[box]" */ - char buf[sizeof(n)*CHAR_BIT+6]; - - /* Start by pointing to the end of the buffer. We fill in from - the back forward. */ - char* p = &buf[sizeof(buf)]; - - assert(base >= 2 && base <= 36); - - /* Special case base 10, for speed */ - if (base == 10) - return int_to_decimal_string(v); - - do { - /* I'd use i_divmod, except it doesn't produce the results - I want when n is negative. So just duplicate the salient - part here. */ - long div = n / base; - long mod = n - div * base; - - /* convert abs(mod) to the right character in [0-9, a-z] */ - char cdigit = (char)(mod < 0 ? -mod : mod); - cdigit += (cdigit < 10) ? '0' : 'a'-10; - *--p = cdigit; - - n = div; - } while(n); - - if (base == 2) { - *--p = 'b'; - *--p = '0'; - } - else if (base == 8) { - if (newstyle) { - *--p = 'o'; - *--p = '0'; - } - else - if (!is_zero) - *--p = '0'; - } - else if (base == 16) { - *--p = 'x'; - *--p = '0'; - } - else { - *--p = '#'; - *--p = '0' + base%10; - if (base > 10) - *--p = '0' + base/10; - } - if (negative) - *--p = '-'; - - return PyString_FromStringAndSize(p, &buf[sizeof(buf)] - p); -} - -static PyObject * -int__format__(PyObject *self, PyObject *args) -{ - PyObject *format_spec; - - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - return NULL; - if (PyBytes_Check(format_spec)) - return _PyInt_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); - if (PyUnicode_Check(format_spec)) { - /* Convert format_spec to a str */ - PyObject *result; - PyObject *str_spec = PyObject_Str(format_spec); - - if (str_spec == NULL) - return NULL; - - result = _PyInt_FormatAdvanced(self, - PyBytes_AS_STRING(str_spec), - PyBytes_GET_SIZE(str_spec)); - - Py_DECREF(str_spec); - return result; - } - PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); - return NULL; -} - -static PyObject * -int_bit_length(PyIntObject *v) -{ - unsigned long n; - - if (v->ob_ival < 0) - /* avoid undefined behaviour when v->ob_ival == -LONG_MAX-1 */ - n = 0U-(unsigned long)v->ob_ival; - else - n = (unsigned long)v->ob_ival; - - return PyInt_FromLong(bits_in_ulong(n)); -} - -PyDoc_STRVAR(int_bit_length_doc, -"int.bit_length() -> int\n\ -\n\ -Number of bits necessary to represent self in binary.\n\ ->>> bin(37)\n\ -'0b100101'\n\ ->>> (37).bit_length()\n\ -6"); - -#if 0 -static PyObject * -int_is_finite(PyObject *v) -{ - Py_RETURN_TRUE; -} -#endif - -static PyMethodDef int_methods[] = { - {"conjugate", (PyCFunction)int_int, METH_NOARGS, - "Returns self, the complex conjugate of any int."}, - {"bit_length", (PyCFunction)int_bit_length, METH_NOARGS, - int_bit_length_doc}, -#if 0 - {"is_finite", (PyCFunction)int_is_finite, METH_NOARGS, - "Returns always True."}, -#endif - {"__trunc__", (PyCFunction)int_int, METH_NOARGS, - "Truncating an Integral returns itself."}, - {"__getnewargs__", (PyCFunction)int_getnewargs, METH_NOARGS}, - {"__format__", (PyCFunction)int__format__, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyGetSetDef int_getset[] = { - {"real", - (getter)int_int, (setter)NULL, - "the real part of a complex number", - NULL}, - {"imag", - (getter)int_get0, (setter)NULL, - "the imaginary part of a complex number", - NULL}, - {"numerator", - (getter)int_int, (setter)NULL, - "the numerator of a rational number in lowest terms", - NULL}, - {"denominator", - (getter)int_get1, (setter)NULL, - "the denominator of a rational number in lowest terms", - NULL}, - {NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(int_doc, -"int(x=0) -> int or long\n\ -int(x, base=10) -> int or long\n\ -\n\ -Convert a number or string to an integer, or return 0 if no arguments\n\ -are given. If x is floating point, the conversion truncates towards zero.\n\ -If x is outside the integer range, the function returns a long instead.\n\ -\n\ -If x is not a number or if base is given, then x must be a string or\n\ -Unicode object representing an integer literal in the given base. The\n\ -literal can be preceded by '+' or '-' and be surrounded by whitespace.\n\ -The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to\n\ -interpret the base from the string as an integer literal.\n\ ->>> int('0b100', base=0)\n\ -4"); - -static PyNumberMethods int_as_number = { - (binaryfunc)int_add, /*nb_add*/ - (binaryfunc)int_sub, /*nb_subtract*/ - (binaryfunc)int_mul, /*nb_multiply*/ - (binaryfunc)int_classic_div, /*nb_divide*/ - (binaryfunc)int_mod, /*nb_remainder*/ - (binaryfunc)int_divmod, /*nb_divmod*/ - (ternaryfunc)int_pow, /*nb_power*/ - (unaryfunc)int_neg, /*nb_negative*/ - (unaryfunc)int_int, /*nb_positive*/ - (unaryfunc)int_abs, /*nb_absolute*/ - (inquiry)int_nonzero, /*nb_nonzero*/ - (unaryfunc)int_invert, /*nb_invert*/ - (binaryfunc)int_lshift, /*nb_lshift*/ - (binaryfunc)int_rshift, /*nb_rshift*/ - (binaryfunc)int_and, /*nb_and*/ - (binaryfunc)int_xor, /*nb_xor*/ - (binaryfunc)int_or, /*nb_or*/ - int_coerce, /*nb_coerce*/ - (unaryfunc)int_int, /*nb_int*/ - (unaryfunc)int_long, /*nb_long*/ - (unaryfunc)int_float, /*nb_float*/ - (unaryfunc)int_oct, /*nb_oct*/ - (unaryfunc)int_hex, /*nb_hex*/ - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - 0, /*nb_inplace_divide*/ - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - (binaryfunc)int_div, /* nb_floor_divide */ - (binaryfunc)int_true_divide, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ - (unaryfunc)int_int, /* nb_index */ -}; - -PyTypeObject PyInt_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "int", - sizeof(PyIntObject), - 0, - (destructor)int_dealloc, /* tp_dealloc */ - (printfunc)int_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)int_compare, /* tp_compare */ - (reprfunc)int_to_decimal_string, /* tp_repr */ - &int_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)int_hash, /* tp_hash */ - 0, /* tp_call */ - (reprfunc)int_to_decimal_string, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_INT_SUBCLASS, /* tp_flags */ - int_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - int_methods, /* tp_methods */ - 0, /* tp_members */ - int_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - int_new, /* tp_new */ - (freefunc)int_free, /* tp_free */ -}; - -int -_PyInt_Init(void) -{ - PyIntObject *v; - int ival; -#if NSMALLNEGINTS + NSMALLPOSINTS > 0 - for (ival = -NSMALLNEGINTS; ival < NSMALLPOSINTS; ival++) { - if (!free_list && (free_list = fill_free_list()) == NULL) - return 0; - /* PyObject_New is inlined */ - v = free_list; - free_list = (PyIntObject *)Py_TYPE(v); - PyObject_INIT(v, &PyInt_Type); - v->ob_ival = ival; - small_ints[ival + NSMALLNEGINTS] = v; - } -#endif - return 1; -} - -int -PyInt_ClearFreeList(void) -{ - PyIntObject *p; - PyIntBlock *list, *next; - int i; - int u; /* remaining unfreed ints per block */ - int freelist_size = 0; - - list = block_list; - block_list = NULL; - free_list = NULL; - while (list != NULL) { - u = 0; - for (i = 0, p = &list->objects[0]; - i < N_INTOBJECTS; - i++, p++) { - if (PyInt_CheckExact(p) && p->ob_refcnt != 0) - u++; - } - next = list->next; - if (u) { - list->next = block_list; - block_list = list; - for (i = 0, p = &list->objects[0]; - i < N_INTOBJECTS; - i++, p++) { - if (!PyInt_CheckExact(p) || - p->ob_refcnt == 0) { - Py_TYPE(p) = (struct _typeobject *) - free_list; - free_list = p; - } -#if NSMALLNEGINTS + NSMALLPOSINTS > 0 - else if (-NSMALLNEGINTS <= p->ob_ival && - p->ob_ival < NSMALLPOSINTS && - small_ints[p->ob_ival + - NSMALLNEGINTS] == NULL) { - Py_INCREF(p); - small_ints[p->ob_ival + - NSMALLNEGINTS] = p; - } -#endif - } - } - else { - PyMem_FREE(list); - } - freelist_size += u; - list = next; - } - - return freelist_size; -} - -void -PyInt_Fini(void) -{ - PyIntObject *p; - PyIntBlock *list; - int i; - int u; /* total unfreed ints per block */ - -#if NSMALLNEGINTS + NSMALLPOSINTS > 0 - PyIntObject **q; - - i = NSMALLNEGINTS + NSMALLPOSINTS; - q = small_ints; - while (--i >= 0) { - Py_XDECREF(*q); - *q++ = NULL; - } -#endif - u = PyInt_ClearFreeList(); - if (!Py_VerboseFlag) - return; - fprintf(stderr, "# cleanup ints"); - if (!u) { - fprintf(stderr, "\n"); - } - else { - fprintf(stderr, - ": %d unfreed int%s\n", - u, u == 1 ? "" : "s"); - } - if (Py_VerboseFlag > 1) { - list = block_list; - while (list != NULL) { - for (i = 0, p = &list->objects[0]; - i < N_INTOBJECTS; - i++, p++) { - if (PyInt_CheckExact(p) && p->ob_refcnt != 0) - /* XXX(twouters) cast refcount to - long until %zd is universally - available - */ - fprintf(stderr, - "# \n", - p, (long)p->ob_refcnt, - p->ob_ival); - } - list = list->next; - } - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/iterobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/iterobject.c deleted file mode 100644 index 529b593..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/iterobject.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Iterator objects */ - -#include "Python.h" - -typedef struct { - PyObject_HEAD - long it_index; - PyObject *it_seq; /* Set to NULL when iterator is exhausted */ -} seqiterobject; - -PyObject * -PySeqIter_New(PyObject *seq) -{ - seqiterobject *it; - - if (!PySequence_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_GC_New(seqiterobject, &PySeqIter_Type); - if (it == NULL) - return NULL; - it->it_index = 0; - Py_INCREF(seq); - it->it_seq = seq; - _PyObject_GC_TRACK(it); - return (PyObject *)it; -} - -static void -iter_dealloc(seqiterobject *it) -{ - _PyObject_GC_UNTRACK(it); - Py_XDECREF(it->it_seq); - PyObject_GC_Del(it); -} - -static int -iter_traverse(seqiterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->it_seq); - return 0; -} - -static PyObject * -iter_iternext(PyObject *iterator) -{ - seqiterobject *it; - PyObject *seq; - PyObject *result; - - assert(PySeqIter_Check(iterator)); - it = (seqiterobject *)iterator; - seq = it->it_seq; - if (seq == NULL) - return NULL; - - result = PySequence_GetItem(seq, it->it_index); - if (result != NULL) { - it->it_index++; - return result; - } - if (PyErr_ExceptionMatches(PyExc_IndexError) || - PyErr_ExceptionMatches(PyExc_StopIteration)) - { - PyErr_Clear(); - Py_DECREF(seq); - it->it_seq = NULL; - } - return NULL; -} - -static PyObject * -iter_len(seqiterobject *it) -{ - Py_ssize_t seqsize, len; - - if (it->it_seq) { - seqsize = PySequence_Size(it->it_seq); - if (seqsize == -1) - return NULL; - len = seqsize - it->it_index; - if (len >= 0) - return PyInt_FromSsize_t(len); - } - return PyInt_FromLong(0); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef seqiter_methods[] = { - {"__length_hint__", (PyCFunction)iter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PySeqIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "iterator", /* tp_name */ - sizeof(seqiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)iter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)iter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - iter_iternext, /* tp_iternext */ - seqiter_methods, /* tp_methods */ - 0, /* tp_members */ -}; - -/* -------------------------------------- */ - -typedef struct { - PyObject_HEAD - PyObject *it_callable; /* Set to NULL when iterator is exhausted */ - PyObject *it_sentinel; /* Set to NULL when iterator is exhausted */ -} calliterobject; - -PyObject * -PyCallIter_New(PyObject *callable, PyObject *sentinel) -{ - calliterobject *it; - it = PyObject_GC_New(calliterobject, &PyCallIter_Type); - if (it == NULL) - return NULL; - Py_INCREF(callable); - it->it_callable = callable; - Py_INCREF(sentinel); - it->it_sentinel = sentinel; - _PyObject_GC_TRACK(it); - return (PyObject *)it; -} -static void -calliter_dealloc(calliterobject *it) -{ - _PyObject_GC_UNTRACK(it); - Py_XDECREF(it->it_callable); - Py_XDECREF(it->it_sentinel); - PyObject_GC_Del(it); -} - -static int -calliter_traverse(calliterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->it_callable); - Py_VISIT(it->it_sentinel); - return 0; -} - -static PyObject * -calliter_iternext(calliterobject *it) -{ - if (it->it_callable != NULL) { - PyObject *args = PyTuple_New(0); - PyObject *result; - if (args == NULL) - return NULL; - result = PyObject_Call(it->it_callable, args, NULL); - Py_DECREF(args); - if (result != NULL) { - int ok; - ok = PyObject_RichCompareBool(result, - it->it_sentinel, - Py_EQ); - if (ok == 0) - return result; /* Common case, fast path */ - Py_DECREF(result); - if (ok > 0) { - Py_CLEAR(it->it_callable); - Py_CLEAR(it->it_sentinel); - } - } - else if (PyErr_ExceptionMatches(PyExc_StopIteration)) { - PyErr_Clear(); - Py_CLEAR(it->it_callable); - Py_CLEAR(it->it_sentinel); - } - } - return NULL; -} - -PyTypeObject PyCallIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "callable-iterator", /* tp_name */ - sizeof(calliterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)calliter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)calliter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)calliter_iternext, /* tp_iternext */ - 0, /* tp_methods */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/listobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/listobject.c deleted file mode 100644 index 221bce2..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/listobject.c +++ /dev/null @@ -1,3045 +0,0 @@ -/* List object implementation */ - -#include "Python.h" - -#ifdef STDC_HEADERS -#include -#else -#include /* For size_t */ -#endif - -/* Ensure ob_item has room for at least newsize elements, and set - * ob_size to newsize. If newsize > ob_size on entry, the content - * of the new slots at exit is undefined heap trash; it's the caller's - * responsibility to overwrite them with sane values. - * The number of allocated elements may grow, shrink, or stay the same. - * Failure is impossible if newsize <= self.allocated on entry, although - * that partly relies on an assumption that the system realloc() never - * fails when passed a number of bytes <= the number of bytes last - * allocated (the C standard doesn't guarantee this, but it's hard to - * imagine a realloc implementation where it wouldn't be true). - * Note that self->ob_item may change, and even if newsize is less - * than ob_size on entry. - */ -static int -list_resize(PyListObject *self, Py_ssize_t newsize) -{ - PyObject **items; - size_t new_allocated; - Py_ssize_t allocated = self->allocated; - - /* Bypass realloc() when a previous overallocation is large enough - to accommodate the newsize. If the newsize falls lower than half - the allocated size, then proceed with the realloc() to shrink the list. - */ - if (allocated >= newsize && newsize >= (allocated >> 1)) { - assert(self->ob_item != NULL || newsize == 0); - Py_SIZE(self) = newsize; - return 0; - } - - /* This over-allocates proportional to the list size, making room - * for additional growth. The over-allocation is mild, but is - * enough to give linear-time amortized behavior over a long - * sequence of appends() in the presence of a poorly-performing - * system realloc(). - * The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ... - */ - new_allocated = (newsize >> 3) + (newsize < 9 ? 3 : 6); - - /* check for integer overflow */ - if (new_allocated > PY_SIZE_MAX - newsize) { - PyErr_NoMemory(); - return -1; - } else { - new_allocated += newsize; - } - - if (newsize == 0) - new_allocated = 0; - items = self->ob_item; - if (new_allocated <= (PY_SIZE_MAX / sizeof(PyObject *))) - PyMem_RESIZE(items, PyObject *, new_allocated); - else - items = NULL; - if (items == NULL) { - PyErr_NoMemory(); - return -1; - } - self->ob_item = items; - Py_SIZE(self) = newsize; - self->allocated = new_allocated; - return 0; -} - -/* Debug statistic to compare allocations with reuse through the free list */ -#undef SHOW_ALLOC_COUNT -#ifdef SHOW_ALLOC_COUNT -static size_t count_alloc = 0; -static size_t count_reuse = 0; - -static void -show_alloc(void) -{ - fprintf(stderr, "List allocations: %" PY_FORMAT_SIZE_T "d\n", - count_alloc); - fprintf(stderr, "List reuse through freelist: %" PY_FORMAT_SIZE_T - "d\n", count_reuse); - fprintf(stderr, "%.2f%% reuse rate\n\n", - (100.0*count_reuse/(count_alloc+count_reuse))); -} -#endif - -/* Empty list reuse scheme to save calls to malloc and free */ -#ifndef PyList_MAXFREELIST -#define PyList_MAXFREELIST 80 -#endif -static PyListObject *free_list[PyList_MAXFREELIST]; -static int numfree = 0; - -void -PyList_Fini(void) -{ - PyListObject *op; - - while (numfree) { - op = free_list[--numfree]; - assert(PyList_CheckExact(op)); - PyObject_GC_Del(op); - } -} - -PyObject * -PyList_New(Py_ssize_t size) -{ - PyListObject *op; - size_t nbytes; -#ifdef SHOW_ALLOC_COUNT - static int initialized = 0; - if (!initialized) { - Py_AtExit(show_alloc); - initialized = 1; - } -#endif - - if (size < 0) { - PyErr_BadInternalCall(); - return NULL; - } - /* Check for overflow without an actual overflow, - * which can cause compiler to optimise out */ - if ((size_t)size > PY_SIZE_MAX / sizeof(PyObject *)) - return PyErr_NoMemory(); - nbytes = size * sizeof(PyObject *); - if (numfree) { - numfree--; - op = free_list[numfree]; - _Py_NewReference((PyObject *)op); -#ifdef SHOW_ALLOC_COUNT - count_reuse++; -#endif - } else { - op = PyObject_GC_New(PyListObject, &PyList_Type); - if (op == NULL) - return NULL; -#ifdef SHOW_ALLOC_COUNT - count_alloc++; -#endif - } - if (size <= 0) - op->ob_item = NULL; - else { - op->ob_item = (PyObject **) PyMem_MALLOC(nbytes); - if (op->ob_item == NULL) { - Py_DECREF(op); - return PyErr_NoMemory(); - } - memset(op->ob_item, 0, nbytes); - } - Py_SIZE(op) = size; - op->allocated = size; - _PyObject_GC_TRACK(op); - return (PyObject *) op; -} - -Py_ssize_t -PyList_Size(PyObject *op) -{ - if (!PyList_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - else - return Py_SIZE(op); -} - -static PyObject *indexerr = NULL; - -PyObject * -PyList_GetItem(PyObject *op, Py_ssize_t i) -{ - if (!PyList_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - if (i < 0 || i >= Py_SIZE(op)) { - if (indexerr == NULL) { - indexerr = PyString_FromString( - "list index out of range"); - if (indexerr == NULL) - return NULL; - } - PyErr_SetObject(PyExc_IndexError, indexerr); - return NULL; - } - return ((PyListObject *)op) -> ob_item[i]; -} - -int -PyList_SetItem(register PyObject *op, register Py_ssize_t i, - register PyObject *newitem) -{ - register PyObject *olditem; - register PyObject **p; - if (!PyList_Check(op)) { - Py_XDECREF(newitem); - PyErr_BadInternalCall(); - return -1; - } - if (i < 0 || i >= Py_SIZE(op)) { - Py_XDECREF(newitem); - PyErr_SetString(PyExc_IndexError, - "list assignment index out of range"); - return -1; - } - p = ((PyListObject *)op) -> ob_item + i; - olditem = *p; - *p = newitem; - Py_XDECREF(olditem); - return 0; -} - -static int -ins1(PyListObject *self, Py_ssize_t where, PyObject *v) -{ - Py_ssize_t i, n = Py_SIZE(self); - PyObject **items; - if (v == NULL) { - PyErr_BadInternalCall(); - return -1; - } - if (n == PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "cannot add more objects to list"); - return -1; - } - - if (list_resize(self, n+1) == -1) - return -1; - - if (where < 0) { - where += n; - if (where < 0) - where = 0; - } - if (where > n) - where = n; - items = self->ob_item; - for (i = n; --i >= where; ) - items[i+1] = items[i]; - Py_INCREF(v); - items[where] = v; - return 0; -} - -int -PyList_Insert(PyObject *op, Py_ssize_t where, PyObject *newitem) -{ - if (!PyList_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - return ins1((PyListObject *)op, where, newitem); -} - -static int -app1(PyListObject *self, PyObject *v) -{ - Py_ssize_t n = PyList_GET_SIZE(self); - - assert (v != NULL); - if (n == PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "cannot add more objects to list"); - return -1; - } - - if (list_resize(self, n+1) == -1) - return -1; - - Py_INCREF(v); - PyList_SET_ITEM(self, n, v); - return 0; -} - -int -PyList_Append(PyObject *op, PyObject *newitem) -{ - if (PyList_Check(op) && (newitem != NULL)) - return app1((PyListObject *)op, newitem); - PyErr_BadInternalCall(); - return -1; -} - -/* Methods */ - -static void -list_dealloc(PyListObject *op) -{ - Py_ssize_t i; - PyObject_GC_UnTrack(op); - Py_TRASHCAN_SAFE_BEGIN(op) - if (op->ob_item != NULL) { - /* Do it backwards, for Christian Tismer. - There's a simple test case where somehow this reduces - thrashing when a *very* large list is created and - immediately deleted. */ - i = Py_SIZE(op); - while (--i >= 0) { - Py_XDECREF(op->ob_item[i]); - } - PyMem_FREE(op->ob_item); - } - if (numfree < PyList_MAXFREELIST && PyList_CheckExact(op)) - free_list[numfree++] = op; - else - Py_TYPE(op)->tp_free((PyObject *)op); - Py_TRASHCAN_SAFE_END(op) -} - -static int -list_print(PyListObject *op, FILE *fp, int flags) -{ - int rc; - Py_ssize_t i; - PyObject *item; - - rc = Py_ReprEnter((PyObject*)op); - if (rc != 0) { - if (rc < 0) - return rc; - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "[...]"); - Py_END_ALLOW_THREADS - return 0; - } - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "["); - Py_END_ALLOW_THREADS - for (i = 0; i < Py_SIZE(op); i++) { - item = op->ob_item[i]; - Py_INCREF(item); - if (i > 0) { - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ", "); - Py_END_ALLOW_THREADS - } - if (PyObject_Print(item, fp, 0) != 0) { - Py_DECREF(item); - Py_ReprLeave((PyObject *)op); - return -1; - } - Py_DECREF(item); - } - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "]"); - Py_END_ALLOW_THREADS - Py_ReprLeave((PyObject *)op); - return 0; -} - -static PyObject * -list_repr(PyListObject *v) -{ - Py_ssize_t i; - PyObject *s, *temp; - PyObject *pieces = NULL, *result = NULL; - - i = Py_ReprEnter((PyObject*)v); - if (i != 0) { - return i > 0 ? PyString_FromString("[...]") : NULL; - } - - if (Py_SIZE(v) == 0) { - result = PyString_FromString("[]"); - goto Done; - } - - pieces = PyList_New(0); - if (pieces == NULL) - goto Done; - - /* Do repr() on each element. Note that this may mutate the list, - so must refetch the list size on each iteration. */ - for (i = 0; i < Py_SIZE(v); ++i) { - int status; - if (Py_EnterRecursiveCall(" while getting the repr of a list")) - goto Done; - s = PyObject_Repr(v->ob_item[i]); - Py_LeaveRecursiveCall(); - if (s == NULL) - goto Done; - status = PyList_Append(pieces, s); - Py_DECREF(s); /* append created a new ref */ - if (status < 0) - goto Done; - } - - /* Add "[]" decorations to the first and last items. */ - assert(PyList_GET_SIZE(pieces) > 0); - s = PyString_FromString("["); - if (s == NULL) - goto Done; - temp = PyList_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); - PyList_SET_ITEM(pieces, 0, s); - if (s == NULL) - goto Done; - - s = PyString_FromString("]"); - if (s == NULL) - goto Done; - temp = PyList_GET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1); - PyString_ConcatAndDel(&temp, s); - PyList_SET_ITEM(pieces, PyList_GET_SIZE(pieces) - 1, temp); - if (temp == NULL) - goto Done; - - /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); - if (s == NULL) - goto Done; - result = _PyString_Join(s, pieces); - Py_DECREF(s); - -Done: - Py_XDECREF(pieces); - Py_ReprLeave((PyObject *)v); - return result; -} - -static Py_ssize_t -list_length(PyListObject *a) -{ - return Py_SIZE(a); -} - -static int -list_contains(PyListObject *a, PyObject *el) -{ - Py_ssize_t i; - int cmp; - - for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i) - cmp = PyObject_RichCompareBool(el, PyList_GET_ITEM(a, i), - Py_EQ); - return cmp; -} - -static PyObject * -list_item(PyListObject *a, Py_ssize_t i) -{ - if (i < 0 || i >= Py_SIZE(a)) { - if (indexerr == NULL) { - indexerr = PyString_FromString( - "list index out of range"); - if (indexerr == NULL) - return NULL; - } - PyErr_SetObject(PyExc_IndexError, indexerr); - return NULL; - } - Py_INCREF(a->ob_item[i]); - return a->ob_item[i]; -} - -static PyObject * -list_slice(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh) -{ - PyListObject *np; - PyObject **src, **dest; - Py_ssize_t i, len; - if (ilow < 0) - ilow = 0; - else if (ilow > Py_SIZE(a)) - ilow = Py_SIZE(a); - if (ihigh < ilow) - ihigh = ilow; - else if (ihigh > Py_SIZE(a)) - ihigh = Py_SIZE(a); - len = ihigh - ilow; - np = (PyListObject *) PyList_New(len); - if (np == NULL) - return NULL; - - src = a->ob_item + ilow; - dest = np->ob_item; - for (i = 0; i < len; i++) { - PyObject *v = src[i]; - Py_INCREF(v); - dest[i] = v; - } - return (PyObject *)np; -} - -PyObject * -PyList_GetSlice(PyObject *a, Py_ssize_t ilow, Py_ssize_t ihigh) -{ - if (!PyList_Check(a)) { - PyErr_BadInternalCall(); - return NULL; - } - return list_slice((PyListObject *)a, ilow, ihigh); -} - -static PyObject * -list_concat(PyListObject *a, PyObject *bb) -{ - Py_ssize_t size; - Py_ssize_t i; - PyObject **src, **dest; - PyListObject *np; - if (!PyList_Check(bb)) { - PyErr_Format(PyExc_TypeError, - "can only concatenate list (not \"%.200s\") to list", - bb->ob_type->tp_name); - return NULL; - } -#define b ((PyListObject *)bb) - size = Py_SIZE(a) + Py_SIZE(b); - if (size < 0) - return PyErr_NoMemory(); - np = (PyListObject *) PyList_New(size); - if (np == NULL) { - return NULL; - } - src = a->ob_item; - dest = np->ob_item; - for (i = 0; i < Py_SIZE(a); i++) { - PyObject *v = src[i]; - Py_INCREF(v); - dest[i] = v; - } - src = b->ob_item; - dest = np->ob_item + Py_SIZE(a); - for (i = 0; i < Py_SIZE(b); i++) { - PyObject *v = src[i]; - Py_INCREF(v); - dest[i] = v; - } - return (PyObject *)np; -#undef b -} - -static PyObject * -list_repeat(PyListObject *a, Py_ssize_t n) -{ - Py_ssize_t i, j; - Py_ssize_t size; - PyListObject *np; - PyObject **p, **items; - PyObject *elem; - if (n < 0) - n = 0; - if (n > 0 && Py_SIZE(a) > PY_SSIZE_T_MAX / n) - return PyErr_NoMemory(); - size = Py_SIZE(a) * n; - if (size == 0) - return PyList_New(0); - np = (PyListObject *) PyList_New(size); - if (np == NULL) - return NULL; - - items = np->ob_item; - if (Py_SIZE(a) == 1) { - elem = a->ob_item[0]; - for (i = 0; i < n; i++) { - items[i] = elem; - Py_INCREF(elem); - } - return (PyObject *) np; - } - p = np->ob_item; - items = a->ob_item; - for (i = 0; i < n; i++) { - for (j = 0; j < Py_SIZE(a); j++) { - *p = items[j]; - Py_INCREF(*p); - p++; - } - } - return (PyObject *) np; -} - -static int -list_clear(PyListObject *a) -{ - Py_ssize_t i; - PyObject **item = a->ob_item; - if (item != NULL) { - /* Because XDECREF can recursively invoke operations on - this list, we make it empty first. */ - i = Py_SIZE(a); - Py_SIZE(a) = 0; - a->ob_item = NULL; - a->allocated = 0; - while (--i >= 0) { - Py_XDECREF(item[i]); - } - PyMem_FREE(item); - } - /* Never fails; the return value can be ignored. - Note that there is no guarantee that the list is actually empty - at this point, because XDECREF may have populated it again! */ - return 0; -} - -/* a[ilow:ihigh] = v if v != NULL. - * del a[ilow:ihigh] if v == NULL. - * - * Special speed gimmick: when v is NULL and ihigh - ilow <= 8, it's - * guaranteed the call cannot fail. - */ -static int -list_ass_slice(PyListObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v) -{ - /* Because [X]DECREF can recursively invoke list operations on - this list, we must postpone all [X]DECREF activity until - after the list is back in its canonical shape. Therefore - we must allocate an additional array, 'recycle', into which - we temporarily copy the items that are deleted from the - list. :-( */ - PyObject *recycle_on_stack[8]; - PyObject **recycle = recycle_on_stack; /* will allocate more if needed */ - PyObject **item; - PyObject **vitem = NULL; - PyObject *v_as_SF = NULL; /* PySequence_Fast(v) */ - Py_ssize_t n; /* # of elements in replacement list */ - Py_ssize_t norig; /* # of elements in list getting replaced */ - Py_ssize_t d; /* Change in size */ - Py_ssize_t k; - size_t s; - int result = -1; /* guilty until proved innocent */ -#define b ((PyListObject *)v) - if (v == NULL) - n = 0; - else { - if (a == b) { - /* Special case "a[i:j] = a" -- copy b first */ - v = list_slice(b, 0, Py_SIZE(b)); - if (v == NULL) - return result; - result = list_ass_slice(a, ilow, ihigh, v); - Py_DECREF(v); - return result; - } - v_as_SF = PySequence_Fast(v, "can only assign an iterable"); - if(v_as_SF == NULL) - goto Error; - n = PySequence_Fast_GET_SIZE(v_as_SF); - vitem = PySequence_Fast_ITEMS(v_as_SF); - } - if (ilow < 0) - ilow = 0; - else if (ilow > Py_SIZE(a)) - ilow = Py_SIZE(a); - - if (ihigh < ilow) - ihigh = ilow; - else if (ihigh > Py_SIZE(a)) - ihigh = Py_SIZE(a); - - norig = ihigh - ilow; - assert(norig >= 0); - d = n - norig; - if (Py_SIZE(a) + d == 0) { - Py_XDECREF(v_as_SF); - return list_clear(a); - } - item = a->ob_item; - /* recycle the items that we are about to remove */ - s = norig * sizeof(PyObject *); - if (s > sizeof(recycle_on_stack)) { - recycle = (PyObject **)PyMem_MALLOC(s); - if (recycle == NULL) { - PyErr_NoMemory(); - goto Error; - } - } - memcpy(recycle, &item[ilow], s); - - if (d < 0) { /* Delete -d items */ - memmove(&item[ihigh+d], &item[ihigh], - (Py_SIZE(a) - ihigh)*sizeof(PyObject *)); - list_resize(a, Py_SIZE(a) + d); - item = a->ob_item; - } - else if (d > 0) { /* Insert d items */ - k = Py_SIZE(a); - if (list_resize(a, k+d) < 0) - goto Error; - item = a->ob_item; - memmove(&item[ihigh+d], &item[ihigh], - (k - ihigh)*sizeof(PyObject *)); - } - for (k = 0; k < n; k++, ilow++) { - PyObject *w = vitem[k]; - Py_XINCREF(w); - item[ilow] = w; - } - for (k = norig - 1; k >= 0; --k) - Py_XDECREF(recycle[k]); - result = 0; - Error: - if (recycle != recycle_on_stack) - PyMem_FREE(recycle); - Py_XDECREF(v_as_SF); - return result; -#undef b -} - -int -PyList_SetSlice(PyObject *a, Py_ssize_t ilow, Py_ssize_t ihigh, PyObject *v) -{ - if (!PyList_Check(a)) { - PyErr_BadInternalCall(); - return -1; - } - return list_ass_slice((PyListObject *)a, ilow, ihigh, v); -} - -static PyObject * -list_inplace_repeat(PyListObject *self, Py_ssize_t n) -{ - PyObject **items; - Py_ssize_t size, i, j, p; - - - size = PyList_GET_SIZE(self); - if (size == 0 || n == 1) { - Py_INCREF(self); - return (PyObject *)self; - } - - if (n < 1) { - (void)list_clear(self); - Py_INCREF(self); - return (PyObject *)self; - } - - if (size > PY_SSIZE_T_MAX / n) { - return PyErr_NoMemory(); - } - - if (list_resize(self, size*n) == -1) - return NULL; - - p = size; - items = self->ob_item; - for (i = 1; i < n; i++) { /* Start counting at 1, not 0 */ - for (j = 0; j < size; j++) { - PyObject *o = items[j]; - Py_INCREF(o); - items[p++] = o; - } - } - Py_INCREF(self); - return (PyObject *)self; -} - -static int -list_ass_item(PyListObject *a, Py_ssize_t i, PyObject *v) -{ - PyObject *old_value; - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, - "list assignment index out of range"); - return -1; - } - if (v == NULL) - return list_ass_slice(a, i, i+1, v); - Py_INCREF(v); - old_value = a->ob_item[i]; - a->ob_item[i] = v; - Py_DECREF(old_value); - return 0; -} - -static PyObject * -listinsert(PyListObject *self, PyObject *args) -{ - Py_ssize_t i; - PyObject *v; - if (!PyArg_ParseTuple(args, "nO:insert", &i, &v)) - return NULL; - if (ins1(self, i, v) == 0) - Py_RETURN_NONE; - return NULL; -} - -static PyObject * -listappend(PyListObject *self, PyObject *v) -{ - if (app1(self, v) == 0) - Py_RETURN_NONE; - return NULL; -} - -static PyObject * -listextend(PyListObject *self, PyObject *b) -{ - PyObject *it; /* iter(v) */ - Py_ssize_t m; /* size of self */ - Py_ssize_t n; /* guess for size of b */ - Py_ssize_t mn; /* m + n */ - Py_ssize_t i; - PyObject *(*iternext)(PyObject *); - - /* Special cases: - 1) lists and tuples which can use PySequence_Fast ops - 2) extending self to self requires making a copy first - */ - if (PyList_CheckExact(b) || PyTuple_CheckExact(b) || (PyObject *)self == b) { - PyObject **src, **dest; - b = PySequence_Fast(b, "argument must be iterable"); - if (!b) - return NULL; - n = PySequence_Fast_GET_SIZE(b); - if (n == 0) { - /* short circuit when b is empty */ - Py_DECREF(b); - Py_RETURN_NONE; - } - m = Py_SIZE(self); - if (list_resize(self, m + n) == -1) { - Py_DECREF(b); - return NULL; - } - /* note that we may still have self == b here for the - * situation a.extend(a), but the following code works - * in that case too. Just make sure to resize self - * before calling PySequence_Fast_ITEMS. - */ - /* populate the end of self with b's items */ - src = PySequence_Fast_ITEMS(b); - dest = self->ob_item + m; - for (i = 0; i < n; i++) { - PyObject *o = src[i]; - Py_INCREF(o); - dest[i] = o; - } - Py_DECREF(b); - Py_RETURN_NONE; - } - - it = PyObject_GetIter(b); - if (it == NULL) - return NULL; - iternext = *it->ob_type->tp_iternext; - - /* Guess a result list size. */ - n = _PyObject_LengthHint(b, 8); - if (n == -1) { - Py_DECREF(it); - return NULL; - } - m = Py_SIZE(self); - mn = m + n; - if (mn >= m) { - /* Make room. */ - if (list_resize(self, mn) == -1) - goto error; - /* Make the list sane again. */ - Py_SIZE(self) = m; - } - /* Else m + n overflowed; on the chance that n lied, and there really - * is enough room, ignore it. If n was telling the truth, we'll - * eventually run out of memory during the loop. - */ - - /* Run iterator to exhaustion. */ - for (;;) { - PyObject *item = iternext(it); - if (item == NULL) { - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - else - goto error; - } - break; - } - if (Py_SIZE(self) < self->allocated) { - /* steals ref */ - PyList_SET_ITEM(self, Py_SIZE(self), item); - ++Py_SIZE(self); - } - else { - int status = app1(self, item); - Py_DECREF(item); /* append creates a new ref */ - if (status < 0) - goto error; - } - } - - /* Cut back result list if initial guess was too large. */ - if (Py_SIZE(self) < self->allocated) - list_resize(self, Py_SIZE(self)); /* shrinking can't fail */ - - Py_DECREF(it); - Py_RETURN_NONE; - - error: - Py_DECREF(it); - return NULL; -} - -PyObject * -_PyList_Extend(PyListObject *self, PyObject *b) -{ - return listextend(self, b); -} - -static PyObject * -list_inplace_concat(PyListObject *self, PyObject *other) -{ - PyObject *result; - - result = listextend(self, other); - if (result == NULL) - return result; - Py_DECREF(result); - Py_INCREF(self); - return (PyObject *)self; -} - -static PyObject * -listpop(PyListObject *self, PyObject *args) -{ - Py_ssize_t i = -1; - PyObject *v; - int status; - - if (!PyArg_ParseTuple(args, "|n:pop", &i)) - return NULL; - - if (Py_SIZE(self) == 0) { - /* Special-case most common failure cause */ - PyErr_SetString(PyExc_IndexError, "pop from empty list"); - return NULL; - } - if (i < 0) - i += Py_SIZE(self); - if (i < 0 || i >= Py_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, "pop index out of range"); - return NULL; - } - v = self->ob_item[i]; - if (i == Py_SIZE(self) - 1) { - status = list_resize(self, Py_SIZE(self) - 1); - assert(status >= 0); - return v; /* and v now owns the reference the list had */ - } - Py_INCREF(v); - status = list_ass_slice(self, i, i+1, (PyObject *)NULL); - assert(status >= 0); - /* Use status, so that in a release build compilers don't - * complain about the unused name. - */ - (void) status; - - return v; -} - -/* Reverse a slice of a list in place, from lo up to (exclusive) hi. */ -static void -reverse_slice(PyObject **lo, PyObject **hi) -{ - assert(lo && hi); - - --hi; - while (lo < hi) { - PyObject *t = *lo; - *lo = *hi; - *hi = t; - ++lo; - --hi; - } -} - -/* Lots of code for an adaptive, stable, natural mergesort. There are many - * pieces to this algorithm; read listsort.txt for overviews and details. - */ - -/* Comparison function. Takes care of calling a user-supplied - * comparison function (any callable Python object), which must not be - * NULL (use the ISLT macro if you don't know, or call PyObject_RichCompareBool - * with Py_LT if you know it's NULL). - * Returns -1 on error, 1 if x < y, 0 if x >= y. - */ -static int -islt(PyObject *x, PyObject *y, PyObject *compare) -{ - PyObject *res; - PyObject *args; - Py_ssize_t i; - - assert(compare != NULL); - /* Call the user's comparison function and translate the 3-way - * result into true or false (or error). - */ - args = PyTuple_New(2); - if (args == NULL) - return -1; - Py_INCREF(x); - Py_INCREF(y); - PyTuple_SET_ITEM(args, 0, x); - PyTuple_SET_ITEM(args, 1, y); - res = PyObject_Call(compare, args, NULL); - Py_DECREF(args); - if (res == NULL) - return -1; - if (!PyInt_Check(res)) { - PyErr_Format(PyExc_TypeError, - "comparison function must return int, not %.200s", - res->ob_type->tp_name); - Py_DECREF(res); - return -1; - } - i = PyInt_AsLong(res); - Py_DECREF(res); - return i < 0; -} - -/* If COMPARE is NULL, calls PyObject_RichCompareBool with Py_LT, else calls - * islt. This avoids a layer of function call in the usual case, and - * sorting does many comparisons. - * Returns -1 on error, 1 if x < y, 0 if x >= y. - */ -#define ISLT(X, Y, COMPARE) ((COMPARE) == NULL ? \ - PyObject_RichCompareBool(X, Y, Py_LT) : \ - islt(X, Y, COMPARE)) - -/* Compare X to Y via "<". Goto "fail" if the comparison raises an - error. Else "k" is set to true iff X. X and Y are PyObject*s. -*/ -#define IFLT(X, Y) if ((k = ISLT(X, Y, compare)) < 0) goto fail; \ - if (k) - -/* binarysort is the best method for sorting small arrays: it does - few compares, but can do data movement quadratic in the number of - elements. - [lo, hi) is a contiguous slice of a list, and is sorted via - binary insertion. This sort is stable. - On entry, must have lo <= start <= hi, and that [lo, start) is already - sorted (pass start == lo if you don't know!). - If islt() complains return -1, else 0. - Even in case of error, the output slice will be some permutation of - the input (nothing is lost or duplicated). -*/ -static int -binarysort(PyObject **lo, PyObject **hi, PyObject **start, PyObject *compare) - /* compare -- comparison function object, or NULL for default */ -{ - register Py_ssize_t k; - register PyObject **l, **p, **r; - register PyObject *pivot; - - assert(lo <= start && start <= hi); - /* assert [lo, start) is sorted */ - if (lo == start) - ++start; - for (; start < hi; ++start) { - /* set l to where *start belongs */ - l = lo; - r = start; - pivot = *r; - /* Invariants: - * pivot >= all in [lo, l). - * pivot < all in [r, start). - * The second is vacuously true at the start. - */ - assert(l < r); - do { - p = l + ((r - l) >> 1); - IFLT(pivot, *p) - r = p; - else - l = p+1; - } while (l < r); - assert(l == r); - /* The invariants still hold, so pivot >= all in [lo, l) and - pivot < all in [l, start), so pivot belongs at l. Note - that if there are elements equal to pivot, l points to the - first slot after them -- that's why this sort is stable. - Slide over to make room. - Caution: using memmove is much slower under MSVC 5; - we're not usually moving many slots. */ - for (p = start; p > l; --p) - *p = *(p-1); - *l = pivot; - } - return 0; - - fail: - return -1; -} - -/* -Return the length of the run beginning at lo, in the slice [lo, hi). lo < hi -is required on entry. "A run" is the longest ascending sequence, with - - lo[0] <= lo[1] <= lo[2] <= ... - -or the longest descending sequence, with - - lo[0] > lo[1] > lo[2] > ... - -Boolean *descending is set to 0 in the former case, or to 1 in the latter. -For its intended use in a stable mergesort, the strictness of the defn of -"descending" is needed so that the caller can safely reverse a descending -sequence without violating stability (strict > ensures there are no equal -elements to get out of order). - -Returns -1 in case of error. -*/ -static Py_ssize_t -count_run(PyObject **lo, PyObject **hi, PyObject *compare, int *descending) -{ - Py_ssize_t k; - Py_ssize_t n; - - assert(lo < hi); - *descending = 0; - ++lo; - if (lo == hi) - return 1; - - n = 2; - IFLT(*lo, *(lo-1)) { - *descending = 1; - for (lo = lo+1; lo < hi; ++lo, ++n) { - IFLT(*lo, *(lo-1)) - ; - else - break; - } - } - else { - for (lo = lo+1; lo < hi; ++lo, ++n) { - IFLT(*lo, *(lo-1)) - break; - } - } - - return n; -fail: - return -1; -} - -/* -Locate the proper position of key in a sorted vector; if the vector contains -an element equal to key, return the position immediately to the left of -the leftmost equal element. [gallop_right() does the same except returns -the position to the right of the rightmost equal element (if any).] - -"a" is a sorted vector with n elements, starting at a[0]. n must be > 0. - -"hint" is an index at which to begin the search, 0 <= hint < n. The closer -hint is to the final result, the faster this runs. - -The return value is the int k in 0..n such that - - a[k-1] < key <= a[k] - -pretending that *(a-1) is minus infinity and a[n] is plus infinity. IOW, -key belongs at index k; or, IOW, the first k elements of a should precede -key, and the last n-k should follow key. - -Returns -1 on error. See listsort.txt for info on the method. -*/ -static Py_ssize_t -gallop_left(PyObject *key, PyObject **a, Py_ssize_t n, Py_ssize_t hint, PyObject *compare) -{ - Py_ssize_t ofs; - Py_ssize_t lastofs; - Py_ssize_t k; - - assert(key && a && n > 0 && hint >= 0 && hint < n); - - a += hint; - lastofs = 0; - ofs = 1; - IFLT(*a, key) { - /* a[hint] < key -- gallop right, until - * a[hint + lastofs] < key <= a[hint + ofs] - */ - const Py_ssize_t maxofs = n - hint; /* &a[n-1] is highest */ - while (ofs < maxofs) { - IFLT(a[ofs], key) { - lastofs = ofs; - ofs = (ofs << 1) + 1; - if (ofs <= 0) /* int overflow */ - ofs = maxofs; - } - else /* key <= a[hint + ofs] */ - break; - } - if (ofs > maxofs) - ofs = maxofs; - /* Translate back to offsets relative to &a[0]. */ - lastofs += hint; - ofs += hint; - } - else { - /* key <= a[hint] -- gallop left, until - * a[hint - ofs] < key <= a[hint - lastofs] - */ - const Py_ssize_t maxofs = hint + 1; /* &a[0] is lowest */ - while (ofs < maxofs) { - IFLT(*(a-ofs), key) - break; - /* key <= a[hint - ofs] */ - lastofs = ofs; - ofs = (ofs << 1) + 1; - if (ofs <= 0) /* int overflow */ - ofs = maxofs; - } - if (ofs > maxofs) - ofs = maxofs; - /* Translate back to positive offsets relative to &a[0]. */ - k = lastofs; - lastofs = hint - ofs; - ofs = hint - k; - } - a -= hint; - - assert(-1 <= lastofs && lastofs < ofs && ofs <= n); - /* Now a[lastofs] < key <= a[ofs], so key belongs somewhere to the - * right of lastofs but no farther right than ofs. Do a binary - * search, with invariant a[lastofs-1] < key <= a[ofs]. - */ - ++lastofs; - while (lastofs < ofs) { - Py_ssize_t m = lastofs + ((ofs - lastofs) >> 1); - - IFLT(a[m], key) - lastofs = m+1; /* a[m] < key */ - else - ofs = m; /* key <= a[m] */ - } - assert(lastofs == ofs); /* so a[ofs-1] < key <= a[ofs] */ - return ofs; - -fail: - return -1; -} - -/* -Exactly like gallop_left(), except that if key already exists in a[0:n], -finds the position immediately to the right of the rightmost equal value. - -The return value is the int k in 0..n such that - - a[k-1] <= key < a[k] - -or -1 if error. - -The code duplication is massive, but this is enough different given that -we're sticking to "<" comparisons that it's much harder to follow if -written as one routine with yet another "left or right?" flag. -*/ -static Py_ssize_t -gallop_right(PyObject *key, PyObject **a, Py_ssize_t n, Py_ssize_t hint, PyObject *compare) -{ - Py_ssize_t ofs; - Py_ssize_t lastofs; - Py_ssize_t k; - - assert(key && a && n > 0 && hint >= 0 && hint < n); - - a += hint; - lastofs = 0; - ofs = 1; - IFLT(key, *a) { - /* key < a[hint] -- gallop left, until - * a[hint - ofs] <= key < a[hint - lastofs] - */ - const Py_ssize_t maxofs = hint + 1; /* &a[0] is lowest */ - while (ofs < maxofs) { - IFLT(key, *(a-ofs)) { - lastofs = ofs; - ofs = (ofs << 1) + 1; - if (ofs <= 0) /* int overflow */ - ofs = maxofs; - } - else /* a[hint - ofs] <= key */ - break; - } - if (ofs > maxofs) - ofs = maxofs; - /* Translate back to positive offsets relative to &a[0]. */ - k = lastofs; - lastofs = hint - ofs; - ofs = hint - k; - } - else { - /* a[hint] <= key -- gallop right, until - * a[hint + lastofs] <= key < a[hint + ofs] - */ - const Py_ssize_t maxofs = n - hint; /* &a[n-1] is highest */ - while (ofs < maxofs) { - IFLT(key, a[ofs]) - break; - /* a[hint + ofs] <= key */ - lastofs = ofs; - ofs = (ofs << 1) + 1; - if (ofs <= 0) /* int overflow */ - ofs = maxofs; - } - if (ofs > maxofs) - ofs = maxofs; - /* Translate back to offsets relative to &a[0]. */ - lastofs += hint; - ofs += hint; - } - a -= hint; - - assert(-1 <= lastofs && lastofs < ofs && ofs <= n); - /* Now a[lastofs] <= key < a[ofs], so key belongs somewhere to the - * right of lastofs but no farther right than ofs. Do a binary - * search, with invariant a[lastofs-1] <= key < a[ofs]. - */ - ++lastofs; - while (lastofs < ofs) { - Py_ssize_t m = lastofs + ((ofs - lastofs) >> 1); - - IFLT(key, a[m]) - ofs = m; /* key < a[m] */ - else - lastofs = m+1; /* a[m] <= key */ - } - assert(lastofs == ofs); /* so a[ofs-1] <= key < a[ofs] */ - return ofs; - -fail: - return -1; -} - -/* The maximum number of entries in a MergeState's pending-runs stack. - * This is enough to sort arrays of size up to about - * 32 * phi ** MAX_MERGE_PENDING - * where phi ~= 1.618. 85 is ridiculouslylarge enough, good for an array - * with 2**64 elements. - */ -#define MAX_MERGE_PENDING 85 - -/* When we get into galloping mode, we stay there until both runs win less - * often than MIN_GALLOP consecutive times. See listsort.txt for more info. - */ -#define MIN_GALLOP 7 - -/* Avoid malloc for small temp arrays. */ -#define MERGESTATE_TEMP_SIZE 256 - -/* One MergeState exists on the stack per invocation of mergesort. It's just - * a convenient way to pass state around among the helper functions. - */ -struct s_slice { - PyObject **base; - Py_ssize_t len; -}; - -typedef struct s_MergeState { - /* The user-supplied comparison function. or NULL if none given. */ - PyObject *compare; - - /* This controls when we get *into* galloping mode. It's initialized - * to MIN_GALLOP. merge_lo and merge_hi tend to nudge it higher for - * random data, and lower for highly structured data. - */ - Py_ssize_t min_gallop; - - /* 'a' is temp storage to help with merges. It contains room for - * alloced entries. - */ - PyObject **a; /* may point to temparray below */ - Py_ssize_t alloced; - - /* A stack of n pending runs yet to be merged. Run #i starts at - * address base[i] and extends for len[i] elements. It's always - * true (so long as the indices are in bounds) that - * - * pending[i].base + pending[i].len == pending[i+1].base - * - * so we could cut the storage for this, but it's a minor amount, - * and keeping all the info explicit simplifies the code. - */ - int n; - struct s_slice pending[MAX_MERGE_PENDING]; - - /* 'a' points to this when possible, rather than muck with malloc. */ - PyObject *temparray[MERGESTATE_TEMP_SIZE]; -} MergeState; - -/* Conceptually a MergeState's constructor. */ -static void -merge_init(MergeState *ms, PyObject *compare) -{ - assert(ms != NULL); - ms->compare = compare; - ms->a = ms->temparray; - ms->alloced = MERGESTATE_TEMP_SIZE; - ms->n = 0; - ms->min_gallop = MIN_GALLOP; -} - -/* Free all the temp memory owned by the MergeState. This must be called - * when you're done with a MergeState, and may be called before then if - * you want to free the temp memory early. - */ -static void -merge_freemem(MergeState *ms) -{ - assert(ms != NULL); - if (ms->a != ms->temparray) - PyMem_Free(ms->a); - ms->a = ms->temparray; - ms->alloced = MERGESTATE_TEMP_SIZE; -} - -/* Ensure enough temp memory for 'need' array slots is available. - * Returns 0 on success and -1 if the memory can't be gotten. - */ -static int -merge_getmem(MergeState *ms, Py_ssize_t need) -{ - assert(ms != NULL); - if (need <= ms->alloced) - return 0; - /* Don't realloc! That can cost cycles to copy the old data, but - * we don't care what's in the block. - */ - merge_freemem(ms); - if ((size_t)need > PY_SSIZE_T_MAX / sizeof(PyObject*)) { - PyErr_NoMemory(); - return -1; - } - ms->a = (PyObject **)PyMem_Malloc(need * sizeof(PyObject*)); - if (ms->a) { - ms->alloced = need; - return 0; - } - PyErr_NoMemory(); - merge_freemem(ms); /* reset to sane state */ - return -1; -} -#define MERGE_GETMEM(MS, NEED) ((NEED) <= (MS)->alloced ? 0 : \ - merge_getmem(MS, NEED)) - -/* Merge the na elements starting at pa with the nb elements starting at pb - * in a stable way, in-place. na and nb must be > 0, and pa + na == pb. - * Must also have that *pb < *pa, that pa[na-1] belongs at the end of the - * merge, and should have na <= nb. See listsort.txt for more info. - * Return 0 if successful, -1 if error. - */ -static Py_ssize_t -merge_lo(MergeState *ms, PyObject **pa, Py_ssize_t na, - PyObject **pb, Py_ssize_t nb) -{ - Py_ssize_t k; - PyObject *compare; - PyObject **dest; - int result = -1; /* guilty until proved innocent */ - Py_ssize_t min_gallop; - - assert(ms && pa && pb && na > 0 && nb > 0 && pa + na == pb); - if (MERGE_GETMEM(ms, na) < 0) - return -1; - memcpy(ms->a, pa, na * sizeof(PyObject*)); - dest = pa; - pa = ms->a; - - *dest++ = *pb++; - --nb; - if (nb == 0) - goto Succeed; - if (na == 1) - goto CopyB; - - min_gallop = ms->min_gallop; - compare = ms->compare; - for (;;) { - Py_ssize_t acount = 0; /* # of times A won in a row */ - Py_ssize_t bcount = 0; /* # of times B won in a row */ - - /* Do the straightforward thing until (if ever) one run - * appears to win consistently. - */ - for (;;) { - assert(na > 1 && nb > 0); - k = ISLT(*pb, *pa, compare); - if (k) { - if (k < 0) - goto Fail; - *dest++ = *pb++; - ++bcount; - acount = 0; - --nb; - if (nb == 0) - goto Succeed; - if (bcount >= min_gallop) - break; - } - else { - *dest++ = *pa++; - ++acount; - bcount = 0; - --na; - if (na == 1) - goto CopyB; - if (acount >= min_gallop) - break; - } - } - - /* One run is winning so consistently that galloping may - * be a huge win. So try that, and continue galloping until - * (if ever) neither run appears to be winning consistently - * anymore. - */ - ++min_gallop; - do { - assert(na > 1 && nb > 0); - min_gallop -= min_gallop > 1; - ms->min_gallop = min_gallop; - k = gallop_right(*pb, pa, na, 0, compare); - acount = k; - if (k) { - if (k < 0) - goto Fail; - memcpy(dest, pa, k * sizeof(PyObject *)); - dest += k; - pa += k; - na -= k; - if (na == 1) - goto CopyB; - /* na==0 is impossible now if the comparison - * function is consistent, but we can't assume - * that it is. - */ - if (na == 0) - goto Succeed; - } - *dest++ = *pb++; - --nb; - if (nb == 0) - goto Succeed; - - k = gallop_left(*pa, pb, nb, 0, compare); - bcount = k; - if (k) { - if (k < 0) - goto Fail; - memmove(dest, pb, k * sizeof(PyObject *)); - dest += k; - pb += k; - nb -= k; - if (nb == 0) - goto Succeed; - } - *dest++ = *pa++; - --na; - if (na == 1) - goto CopyB; - } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); - ++min_gallop; /* penalize it for leaving galloping mode */ - ms->min_gallop = min_gallop; - } -Succeed: - result = 0; -Fail: - if (na) - memcpy(dest, pa, na * sizeof(PyObject*)); - return result; -CopyB: - assert(na == 1 && nb > 0); - /* The last element of pa belongs at the end of the merge. */ - memmove(dest, pb, nb * sizeof(PyObject *)); - dest[nb] = *pa; - return 0; -} - -/* Merge the na elements starting at pa with the nb elements starting at pb - * in a stable way, in-place. na and nb must be > 0, and pa + na == pb. - * Must also have that *pb < *pa, that pa[na-1] belongs at the end of the - * merge, and should have na >= nb. See listsort.txt for more info. - * Return 0 if successful, -1 if error. - */ -static Py_ssize_t -merge_hi(MergeState *ms, PyObject **pa, Py_ssize_t na, PyObject **pb, Py_ssize_t nb) -{ - Py_ssize_t k; - PyObject *compare; - PyObject **dest; - int result = -1; /* guilty until proved innocent */ - PyObject **basea; - PyObject **baseb; - Py_ssize_t min_gallop; - - assert(ms && pa && pb && na > 0 && nb > 0 && pa + na == pb); - if (MERGE_GETMEM(ms, nb) < 0) - return -1; - dest = pb + nb - 1; - memcpy(ms->a, pb, nb * sizeof(PyObject*)); - basea = pa; - baseb = ms->a; - pb = ms->a + nb - 1; - pa += na - 1; - - *dest-- = *pa--; - --na; - if (na == 0) - goto Succeed; - if (nb == 1) - goto CopyA; - - min_gallop = ms->min_gallop; - compare = ms->compare; - for (;;) { - Py_ssize_t acount = 0; /* # of times A won in a row */ - Py_ssize_t bcount = 0; /* # of times B won in a row */ - - /* Do the straightforward thing until (if ever) one run - * appears to win consistently. - */ - for (;;) { - assert(na > 0 && nb > 1); - k = ISLT(*pb, *pa, compare); - if (k) { - if (k < 0) - goto Fail; - *dest-- = *pa--; - ++acount; - bcount = 0; - --na; - if (na == 0) - goto Succeed; - if (acount >= min_gallop) - break; - } - else { - *dest-- = *pb--; - ++bcount; - acount = 0; - --nb; - if (nb == 1) - goto CopyA; - if (bcount >= min_gallop) - break; - } - } - - /* One run is winning so consistently that galloping may - * be a huge win. So try that, and continue galloping until - * (if ever) neither run appears to be winning consistently - * anymore. - */ - ++min_gallop; - do { - assert(na > 0 && nb > 1); - min_gallop -= min_gallop > 1; - ms->min_gallop = min_gallop; - k = gallop_right(*pb, basea, na, na-1, compare); - if (k < 0) - goto Fail; - k = na - k; - acount = k; - if (k) { - dest -= k; - pa -= k; - memmove(dest+1, pa+1, k * sizeof(PyObject *)); - na -= k; - if (na == 0) - goto Succeed; - } - *dest-- = *pb--; - --nb; - if (nb == 1) - goto CopyA; - - k = gallop_left(*pa, baseb, nb, nb-1, compare); - if (k < 0) - goto Fail; - k = nb - k; - bcount = k; - if (k) { - dest -= k; - pb -= k; - memcpy(dest+1, pb+1, k * sizeof(PyObject *)); - nb -= k; - if (nb == 1) - goto CopyA; - /* nb==0 is impossible now if the comparison - * function is consistent, but we can't assume - * that it is. - */ - if (nb == 0) - goto Succeed; - } - *dest-- = *pa--; - --na; - if (na == 0) - goto Succeed; - } while (acount >= MIN_GALLOP || bcount >= MIN_GALLOP); - ++min_gallop; /* penalize it for leaving galloping mode */ - ms->min_gallop = min_gallop; - } -Succeed: - result = 0; -Fail: - if (nb) - memcpy(dest-(nb-1), baseb, nb * sizeof(PyObject*)); - return result; -CopyA: - assert(nb == 1 && na > 0); - /* The first element of pb belongs at the front of the merge. */ - dest -= na; - pa -= na; - memmove(dest+1, pa+1, na * sizeof(PyObject *)); - *dest = *pb; - return 0; -} - -/* Merge the two runs at stack indices i and i+1. - * Returns 0 on success, -1 on error. - */ -static Py_ssize_t -merge_at(MergeState *ms, Py_ssize_t i) -{ - PyObject **pa, **pb; - Py_ssize_t na, nb; - Py_ssize_t k; - PyObject *compare; - - assert(ms != NULL); - assert(ms->n >= 2); - assert(i >= 0); - assert(i == ms->n - 2 || i == ms->n - 3); - - pa = ms->pending[i].base; - na = ms->pending[i].len; - pb = ms->pending[i+1].base; - nb = ms->pending[i+1].len; - assert(na > 0 && nb > 0); - assert(pa + na == pb); - - /* Record the length of the combined runs; if i is the 3rd-last - * run now, also slide over the last run (which isn't involved - * in this merge). The current run i+1 goes away in any case. - */ - ms->pending[i].len = na + nb; - if (i == ms->n - 3) - ms->pending[i+1] = ms->pending[i+2]; - --ms->n; - - /* Where does b start in a? Elements in a before that can be - * ignored (already in place). - */ - compare = ms->compare; - k = gallop_right(*pb, pa, na, 0, compare); - if (k < 0) - return -1; - pa += k; - na -= k; - if (na == 0) - return 0; - - /* Where does a end in b? Elements in b after that can be - * ignored (already in place). - */ - nb = gallop_left(pa[na-1], pb, nb, nb-1, compare); - if (nb <= 0) - return nb; - - /* Merge what remains of the runs, using a temp array with - * min(na, nb) elements. - */ - if (na <= nb) - return merge_lo(ms, pa, na, pb, nb); - else - return merge_hi(ms, pa, na, pb, nb); -} - -/* Examine the stack of runs waiting to be merged, merging adjacent runs - * until the stack invariants are re-established: - * - * 1. len[-3] > len[-2] + len[-1] - * 2. len[-2] > len[-1] - * - * See listsort.txt for more info. - * - * Returns 0 on success, -1 on error. - */ -static int -merge_collapse(MergeState *ms) -{ - struct s_slice *p = ms->pending; - - assert(ms); - while (ms->n > 1) { - Py_ssize_t n = ms->n - 2; - if ((n > 0 && p[n-1].len <= p[n].len + p[n+1].len) || - (n > 1 && p[n-2].len <= p[n-1].len + p[n].len)) { - if (p[n-1].len < p[n+1].len) - --n; - if (merge_at(ms, n) < 0) - return -1; - } - else if (p[n].len <= p[n+1].len) { - if (merge_at(ms, n) < 0) - return -1; - } - else - break; - } - return 0; -} - -/* Regardless of invariants, merge all runs on the stack until only one - * remains. This is used at the end of the mergesort. - * - * Returns 0 on success, -1 on error. - */ -static int -merge_force_collapse(MergeState *ms) -{ - struct s_slice *p = ms->pending; - - assert(ms); - while (ms->n > 1) { - Py_ssize_t n = ms->n - 2; - if (n > 0 && p[n-1].len < p[n+1].len) - --n; - if (merge_at(ms, n) < 0) - return -1; - } - return 0; -} - -/* Compute a good value for the minimum run length; natural runs shorter - * than this are boosted artificially via binary insertion. - * - * If n < 64, return n (it's too small to bother with fancy stuff). - * Else if n is an exact power of 2, return 32. - * Else return an int k, 32 <= k <= 64, such that n/k is close to, but - * strictly less than, an exact power of 2. - * - * See listsort.txt for more info. - */ -static Py_ssize_t -merge_compute_minrun(Py_ssize_t n) -{ - Py_ssize_t r = 0; /* becomes 1 if any 1 bits are shifted off */ - - assert(n >= 0); - while (n >= 64) { - r |= n & 1; - n >>= 1; - } - return n + r; -} - -/* Special wrapper to support stable sorting using the decorate-sort-undecorate - pattern. Holds a key which is used for comparisons and the original record - which is returned during the undecorate phase. By exposing only the key - during comparisons, the underlying sort stability characteristics are left - unchanged. Also, if a custom comparison function is used, it will only see - the key instead of a full record. */ - -typedef struct { - PyObject_HEAD - PyObject *key; - PyObject *value; -} sortwrapperobject; - -PyDoc_STRVAR(sortwrapper_doc, "Object wrapper with a custom sort key."); -static PyObject * -sortwrapper_richcompare(sortwrapperobject *, sortwrapperobject *, int); -static void -sortwrapper_dealloc(sortwrapperobject *); - -static PyTypeObject sortwrapper_type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "sortwrapper", /* tp_name */ - sizeof(sortwrapperobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)sortwrapper_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | - Py_TPFLAGS_HAVE_RICHCOMPARE, /* tp_flags */ - sortwrapper_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)sortwrapper_richcompare, /* tp_richcompare */ -}; - - -static PyObject * -sortwrapper_richcompare(sortwrapperobject *a, sortwrapperobject *b, int op) -{ - if (!PyObject_TypeCheck(b, &sortwrapper_type)) { - PyErr_SetString(PyExc_TypeError, - "expected a sortwrapperobject"); - return NULL; - } - return PyObject_RichCompare(a->key, b->key, op); -} - -static void -sortwrapper_dealloc(sortwrapperobject *so) -{ - Py_XDECREF(so->key); - Py_XDECREF(so->value); - PyObject_Del(so); -} - -/* Returns a new reference to a sortwrapper. - Consumes the references to the two underlying objects. */ - -static PyObject * -build_sortwrapper(PyObject *key, PyObject *value) -{ - sortwrapperobject *so; - - so = PyObject_New(sortwrapperobject, &sortwrapper_type); - if (so == NULL) - return NULL; - so->key = key; - so->value = value; - return (PyObject *)so; -} - -/* Returns a new reference to the value underlying the wrapper. */ -static PyObject * -sortwrapper_getvalue(PyObject *so) -{ - PyObject *value; - - if (!PyObject_TypeCheck(so, &sortwrapper_type)) { - PyErr_SetString(PyExc_TypeError, - "expected a sortwrapperobject"); - return NULL; - } - value = ((sortwrapperobject *)so)->value; - Py_INCREF(value); - return value; -} - -/* Wrapper for user specified cmp functions in combination with a - specified key function. Makes sure the cmp function is presented - with the actual key instead of the sortwrapper */ - -typedef struct { - PyObject_HEAD - PyObject *func; -} cmpwrapperobject; - -static void -cmpwrapper_dealloc(cmpwrapperobject *co) -{ - Py_XDECREF(co->func); - PyObject_Del(co); -} - -static PyObject * -cmpwrapper_call(cmpwrapperobject *co, PyObject *args, PyObject *kwds) -{ - PyObject *x, *y, *xx, *yy; - - if (!PyArg_UnpackTuple(args, "", 2, 2, &x, &y)) - return NULL; - if (!PyObject_TypeCheck(x, &sortwrapper_type) || - !PyObject_TypeCheck(y, &sortwrapper_type)) { - PyErr_SetString(PyExc_TypeError, - "expected a sortwrapperobject"); - return NULL; - } - xx = ((sortwrapperobject *)x)->key; - yy = ((sortwrapperobject *)y)->key; - return PyObject_CallFunctionObjArgs(co->func, xx, yy, NULL); -} - -PyDoc_STRVAR(cmpwrapper_doc, "cmp() wrapper for sort with custom keys."); - -static PyTypeObject cmpwrapper_type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "cmpwrapper", /* tp_name */ - sizeof(cmpwrapperobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)cmpwrapper_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - (ternaryfunc)cmpwrapper_call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - cmpwrapper_doc, /* tp_doc */ -}; - -static PyObject * -build_cmpwrapper(PyObject *cmpfunc) -{ - cmpwrapperobject *co; - - co = PyObject_New(cmpwrapperobject, &cmpwrapper_type); - if (co == NULL) - return NULL; - Py_INCREF(cmpfunc); - co->func = cmpfunc; - return (PyObject *)co; -} - -/* An adaptive, stable, natural mergesort. See listsort.txt. - * Returns Py_None on success, NULL on error. Even in case of error, the - * list will be some permutation of its input state (nothing is lost or - * duplicated). - */ -static PyObject * -listsort(PyListObject *self, PyObject *args, PyObject *kwds) -{ - MergeState ms; - PyObject **lo, **hi; - Py_ssize_t nremaining; - Py_ssize_t minrun; - Py_ssize_t saved_ob_size, saved_allocated; - PyObject **saved_ob_item; - PyObject **final_ob_item; - PyObject *compare = NULL; - PyObject *result = NULL; /* guilty until proved innocent */ - int reverse = 0; - PyObject *keyfunc = NULL; - Py_ssize_t i; - PyObject *key, *value, *kvpair; - static char *kwlist[] = {"cmp", "key", "reverse", 0}; - - assert(self != NULL); - assert (PyList_Check(self)); - if (args != NULL) { - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OOi:sort", - kwlist, &compare, &keyfunc, &reverse)) - return NULL; - } - if (compare == Py_None) - compare = NULL; - if (compare != NULL && - PyErr_WarnPy3k("the cmp argument is not supported in 3.x", 1) < 0) - return NULL; - if (keyfunc == Py_None) - keyfunc = NULL; - if (compare != NULL && keyfunc != NULL) { - compare = build_cmpwrapper(compare); - if (compare == NULL) - return NULL; - } else - Py_XINCREF(compare); - - /* The list is temporarily made empty, so that mutations performed - * by comparison functions can't affect the slice of memory we're - * sorting (allowing mutations during sorting is a core-dump - * factory, since ob_item may change). - */ - saved_ob_size = Py_SIZE(self); - saved_ob_item = self->ob_item; - saved_allocated = self->allocated; - Py_SIZE(self) = 0; - self->ob_item = NULL; - self->allocated = -1; /* any operation will reset it to >= 0 */ - - if (keyfunc != NULL) { - for (i=0 ; i < saved_ob_size ; i++) { - value = saved_ob_item[i]; - key = PyObject_CallFunctionObjArgs(keyfunc, value, - NULL); - if (key == NULL) { - for (i=i-1 ; i>=0 ; i--) { - kvpair = saved_ob_item[i]; - value = sortwrapper_getvalue(kvpair); - saved_ob_item[i] = value; - Py_DECREF(kvpair); - } - goto dsu_fail; - } - kvpair = build_sortwrapper(key, value); - if (kvpair == NULL) - goto dsu_fail; - saved_ob_item[i] = kvpair; - } - } - - /* Reverse sort stability achieved by initially reversing the list, - applying a stable forward sort, then reversing the final result. */ - if (reverse && saved_ob_size > 1) - reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size); - - merge_init(&ms, compare); - - nremaining = saved_ob_size; - if (nremaining < 2) - goto succeed; - - /* March over the array once, left to right, finding natural runs, - * and extending short natural runs to minrun elements. - */ - lo = saved_ob_item; - hi = lo + nremaining; - minrun = merge_compute_minrun(nremaining); - do { - int descending; - Py_ssize_t n; - - /* Identify next run. */ - n = count_run(lo, hi, compare, &descending); - if (n < 0) - goto fail; - if (descending) - reverse_slice(lo, lo + n); - /* If short, extend to min(minrun, nremaining). */ - if (n < minrun) { - const Py_ssize_t force = nremaining <= minrun ? - nremaining : minrun; - if (binarysort(lo, lo + force, lo + n, compare) < 0) - goto fail; - n = force; - } - /* Push run onto pending-runs stack, and maybe merge. */ - assert(ms.n < MAX_MERGE_PENDING); - ms.pending[ms.n].base = lo; - ms.pending[ms.n].len = n; - ++ms.n; - if (merge_collapse(&ms) < 0) - goto fail; - /* Advance to find next run. */ - lo += n; - nremaining -= n; - } while (nremaining); - assert(lo == hi); - - if (merge_force_collapse(&ms) < 0) - goto fail; - assert(ms.n == 1); - assert(ms.pending[0].base == saved_ob_item); - assert(ms.pending[0].len == saved_ob_size); - -succeed: - result = Py_None; -fail: - if (keyfunc != NULL) { - for (i=0 ; i < saved_ob_size ; i++) { - kvpair = saved_ob_item[i]; - value = sortwrapper_getvalue(kvpair); - saved_ob_item[i] = value; - Py_DECREF(kvpair); - } - } - - if (self->allocated != -1 && result != NULL) { - /* The user mucked with the list during the sort, - * and we don't already have another error to report. - */ - PyErr_SetString(PyExc_ValueError, "list modified during sort"); - result = NULL; - } - - if (reverse && saved_ob_size > 1) - reverse_slice(saved_ob_item, saved_ob_item + saved_ob_size); - - merge_freemem(&ms); - -dsu_fail: - final_ob_item = self->ob_item; - i = Py_SIZE(self); - Py_SIZE(self) = saved_ob_size; - self->ob_item = saved_ob_item; - self->allocated = saved_allocated; - if (final_ob_item != NULL) { - /* we cannot use list_clear() for this because it does not - guarantee that the list is really empty when it returns */ - while (--i >= 0) { - Py_XDECREF(final_ob_item[i]); - } - PyMem_FREE(final_ob_item); - } - Py_XDECREF(compare); - Py_XINCREF(result); - return result; -} -#undef IFLT -#undef ISLT - -int -PyList_Sort(PyObject *v) -{ - if (v == NULL || !PyList_Check(v)) { - PyErr_BadInternalCall(); - return -1; - } - v = listsort((PyListObject *)v, (PyObject *)NULL, (PyObject *)NULL); - if (v == NULL) - return -1; - Py_DECREF(v); - return 0; -} - -static PyObject * -listreverse(PyListObject *self) -{ - if (Py_SIZE(self) > 1) - reverse_slice(self->ob_item, self->ob_item + Py_SIZE(self)); - Py_RETURN_NONE; -} - -int -PyList_Reverse(PyObject *v) -{ - PyListObject *self = (PyListObject *)v; - - if (v == NULL || !PyList_Check(v)) { - PyErr_BadInternalCall(); - return -1; - } - if (Py_SIZE(self) > 1) - reverse_slice(self->ob_item, self->ob_item + Py_SIZE(self)); - return 0; -} - -PyObject * -PyList_AsTuple(PyObject *v) -{ - PyObject *w; - PyObject **p, **q; - Py_ssize_t n; - if (v == NULL || !PyList_Check(v)) { - PyErr_BadInternalCall(); - return NULL; - } - n = Py_SIZE(v); - w = PyTuple_New(n); - if (w == NULL) - return NULL; - p = ((PyTupleObject *)w)->ob_item; - q = ((PyListObject *)v)->ob_item; - while (--n >= 0) { - Py_INCREF(*q); - *p = *q; - p++; - q++; - } - return w; -} - -static PyObject * -listindex(PyListObject *self, PyObject *args) -{ - Py_ssize_t i, start=0, stop=Py_SIZE(self); - PyObject *v, *format_tuple, *err_string; - static PyObject *err_format = NULL; - - if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, - _PyEval_SliceIndex, &start, - _PyEval_SliceIndex, &stop)) - return NULL; - if (start < 0) { - start += Py_SIZE(self); - if (start < 0) - start = 0; - } - if (stop < 0) { - stop += Py_SIZE(self); - if (stop < 0) - stop = 0; - } - for (i = start; i < stop && i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); - if (cmp > 0) - return PyInt_FromSsize_t(i); - else if (cmp < 0) - return NULL; - } - if (err_format == NULL) { - err_format = PyString_FromString("%r is not in list"); - if (err_format == NULL) - return NULL; - } - format_tuple = PyTuple_Pack(1, v); - if (format_tuple == NULL) - return NULL; - err_string = PyString_Format(err_format, format_tuple); - Py_DECREF(format_tuple); - if (err_string == NULL) - return NULL; - PyErr_SetObject(PyExc_ValueError, err_string); - Py_DECREF(err_string); - return NULL; -} - -static PyObject * -listcount(PyListObject *self, PyObject *v) -{ - Py_ssize_t count = 0; - Py_ssize_t i; - - for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); - if (cmp > 0) - count++; - else if (cmp < 0) - return NULL; - } - return PyInt_FromSsize_t(count); -} - -static PyObject * -listremove(PyListObject *self, PyObject *v) -{ - Py_ssize_t i; - - for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); - if (cmp > 0) { - if (list_ass_slice(self, i, i+1, - (PyObject *)NULL) == 0) - Py_RETURN_NONE; - return NULL; - } - else if (cmp < 0) - return NULL; - } - PyErr_SetString(PyExc_ValueError, "list.remove(x): x not in list"); - return NULL; -} - -static int -list_traverse(PyListObject *o, visitproc visit, void *arg) -{ - Py_ssize_t i; - - for (i = Py_SIZE(o); --i >= 0; ) - Py_VISIT(o->ob_item[i]); - return 0; -} - -static PyObject * -list_richcompare(PyObject *v, PyObject *w, int op) -{ - PyListObject *vl, *wl; - Py_ssize_t i; - - if (!PyList_Check(v) || !PyList_Check(w)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - vl = (PyListObject *)v; - wl = (PyListObject *)w; - - if (Py_SIZE(vl) != Py_SIZE(wl) && (op == Py_EQ || op == Py_NE)) { - /* Shortcut: if the lengths differ, the lists differ */ - PyObject *res; - if (op == Py_EQ) - res = Py_False; - else - res = Py_True; - Py_INCREF(res); - return res; - } - - /* Search for the first index where items are different */ - for (i = 0; i < Py_SIZE(vl) && i < Py_SIZE(wl); i++) { - int k = PyObject_RichCompareBool(vl->ob_item[i], - wl->ob_item[i], Py_EQ); - if (k < 0) - return NULL; - if (!k) - break; - } - - if (i >= Py_SIZE(vl) || i >= Py_SIZE(wl)) { - /* No more items to compare -- compare sizes */ - Py_ssize_t vs = Py_SIZE(vl); - Py_ssize_t ws = Py_SIZE(wl); - int cmp; - PyObject *res; - switch (op) { - case Py_LT: cmp = vs < ws; break; - case Py_LE: cmp = vs <= ws; break; - case Py_EQ: cmp = vs == ws; break; - case Py_NE: cmp = vs != ws; break; - case Py_GT: cmp = vs > ws; break; - case Py_GE: cmp = vs >= ws; break; - default: return NULL; /* cannot happen */ - } - if (cmp) - res = Py_True; - else - res = Py_False; - Py_INCREF(res); - return res; - } - - /* We have an item that differs -- shortcuts for EQ/NE */ - if (op == Py_EQ) { - Py_INCREF(Py_False); - return Py_False; - } - if (op == Py_NE) { - Py_INCREF(Py_True); - return Py_True; - } - - /* Compare the final item again using the proper operator */ - return PyObject_RichCompare(vl->ob_item[i], wl->ob_item[i], op); -} - -static int -list_init(PyListObject *self, PyObject *args, PyObject *kw) -{ - PyObject *arg = NULL; - static char *kwlist[] = {"sequence", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:list", kwlist, &arg)) - return -1; - - /* Verify list invariants established by PyType_GenericAlloc() */ - assert(0 <= Py_SIZE(self)); - assert(Py_SIZE(self) <= self->allocated || self->allocated == -1); - assert(self->ob_item != NULL || - self->allocated == 0 || self->allocated == -1); - - /* Empty previous contents */ - if (self->ob_item != NULL) { - (void)list_clear(self); - } - if (arg != NULL) { - PyObject *rv = listextend(self, arg); - if (rv == NULL) - return -1; - Py_DECREF(rv); - } - return 0; -} - -static PyObject * -list_sizeof(PyListObject *self) -{ - Py_ssize_t res; - - res = sizeof(PyListObject) + self->allocated * sizeof(void*); - return PyInt_FromSsize_t(res); -} - -static PyObject *list_iter(PyObject *seq); -static PyObject *list_reversed(PyListObject* seq, PyObject* unused); - -PyDoc_STRVAR(getitem_doc, -"x.__getitem__(y) <==> x[y]"); -PyDoc_STRVAR(reversed_doc, -"L.__reversed__() -- return a reverse iterator over the list"); -PyDoc_STRVAR(sizeof_doc, -"L.__sizeof__() -- size of L in memory, in bytes"); -PyDoc_STRVAR(append_doc, -"L.append(object) -- append object to end"); -PyDoc_STRVAR(extend_doc, -"L.extend(iterable) -- extend list by appending elements from the iterable"); -PyDoc_STRVAR(insert_doc, -"L.insert(index, object) -- insert object before index"); -PyDoc_STRVAR(pop_doc, -"L.pop([index]) -> item -- remove and return item at index (default last).\n" -"Raises IndexError if list is empty or index is out of range."); -PyDoc_STRVAR(remove_doc, -"L.remove(value) -- remove first occurrence of value.\n" -"Raises ValueError if the value is not present."); -PyDoc_STRVAR(index_doc, -"L.index(value, [start, [stop]]) -> integer -- return first index of value.\n" -"Raises ValueError if the value is not present."); -PyDoc_STRVAR(count_doc, -"L.count(value) -> integer -- return number of occurrences of value"); -PyDoc_STRVAR(reverse_doc, -"L.reverse() -- reverse *IN PLACE*"); -PyDoc_STRVAR(sort_doc, -"L.sort(cmp=None, key=None, reverse=False) -- stable sort *IN PLACE*;\n\ -cmp(x, y) -> -1, 0, 1"); - -static PyObject *list_subscript(PyListObject*, PyObject*); - -static PyMethodDef list_methods[] = { - {"__getitem__", (PyCFunction)list_subscript, METH_O|METH_COEXIST, getitem_doc}, - {"__reversed__",(PyCFunction)list_reversed, METH_NOARGS, reversed_doc}, - {"__sizeof__", (PyCFunction)list_sizeof, METH_NOARGS, sizeof_doc}, - {"append", (PyCFunction)listappend, METH_O, append_doc}, - {"insert", (PyCFunction)listinsert, METH_VARARGS, insert_doc}, - {"extend", (PyCFunction)listextend, METH_O, extend_doc}, - {"pop", (PyCFunction)listpop, METH_VARARGS, pop_doc}, - {"remove", (PyCFunction)listremove, METH_O, remove_doc}, - {"index", (PyCFunction)listindex, METH_VARARGS, index_doc}, - {"count", (PyCFunction)listcount, METH_O, count_doc}, - {"reverse", (PyCFunction)listreverse, METH_NOARGS, reverse_doc}, - {"sort", (PyCFunction)listsort, METH_VARARGS | METH_KEYWORDS, sort_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PySequenceMethods list_as_sequence = { - (lenfunc)list_length, /* sq_length */ - (binaryfunc)list_concat, /* sq_concat */ - (ssizeargfunc)list_repeat, /* sq_repeat */ - (ssizeargfunc)list_item, /* sq_item */ - (ssizessizeargfunc)list_slice, /* sq_slice */ - (ssizeobjargproc)list_ass_item, /* sq_ass_item */ - (ssizessizeobjargproc)list_ass_slice, /* sq_ass_slice */ - (objobjproc)list_contains, /* sq_contains */ - (binaryfunc)list_inplace_concat, /* sq_inplace_concat */ - (ssizeargfunc)list_inplace_repeat, /* sq_inplace_repeat */ -}; - -PyDoc_STRVAR(list_doc, -"list() -> new empty list\n" -"list(iterable) -> new list initialized from iterable's items"); - - -static PyObject * -list_subscript(PyListObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i; - i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyList_GET_SIZE(self); - return list_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - PyObject* result; - PyObject* it; - PyObject **src, **dest; - - if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyList_New(0); - } - else if (step == 1) { - return list_slice(self, start, stop); - } - else { - result = PyList_New(slicelength); - if (!result) return NULL; - - src = self->ob_item; - dest = ((PyListObject *)result)->ob_item; - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - it = src[cur]; - Py_INCREF(it); - dest[i] = it; - } - - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "list indices must be integers, not %.200s", - item->ob_type->tp_name); - return NULL; - } -} - -static int -list_ass_subscript(PyListObject* self, PyObject* item, PyObject* value) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return -1; - if (i < 0) - i += PyList_GET_SIZE(self); - return list_ass_item(self, i, value); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength; - - if (PySlice_GetIndicesEx((PySliceObject*)item, Py_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return -1; - } - - if (step == 1) - return list_ass_slice(self, start, stop, value); - - /* Make sure s[5:2] = [..] inserts at the right place: - before 5, not before 2. */ - if ((step < 0 && start < stop) || - (step > 0 && start > stop)) - stop = start; - - if (value == NULL) { - /* delete slice */ - PyObject **garbage; - size_t cur; - Py_ssize_t i; - - if (slicelength <= 0) - return 0; - - if (step < 0) { - stop = start + 1; - start = stop + step*(slicelength - 1) - 1; - step = -step; - } - - assert((size_t)slicelength <= - PY_SIZE_MAX / sizeof(PyObject*)); - - garbage = (PyObject**) - PyMem_MALLOC(slicelength*sizeof(PyObject*)); - if (!garbage) { - PyErr_NoMemory(); - return -1; - } - - /* drawing pictures might help understand these for - loops. Basically, we memmove the parts of the - list that are *not* part of the slice: step-1 - items for each item that is part of the slice, - and then tail end of the list that was not - covered by the slice */ - for (cur = start, i = 0; - cur < (size_t)stop; - cur += step, i++) { - Py_ssize_t lim = step - 1; - - garbage[i] = PyList_GET_ITEM(self, cur); - - if (cur + step >= (size_t)Py_SIZE(self)) { - lim = Py_SIZE(self) - cur - 1; - } - - memmove(self->ob_item + cur - i, - self->ob_item + cur + 1, - lim * sizeof(PyObject *)); - } - cur = start + slicelength*step; - if (cur < (size_t)Py_SIZE(self)) { - memmove(self->ob_item + cur - slicelength, - self->ob_item + cur, - (Py_SIZE(self) - cur) * - sizeof(PyObject *)); - } - - Py_SIZE(self) -= slicelength; - list_resize(self, Py_SIZE(self)); - - for (i = 0; i < slicelength; i++) { - Py_DECREF(garbage[i]); - } - PyMem_FREE(garbage); - - return 0; - } - else { - /* assign slice */ - PyObject *ins, *seq; - PyObject **garbage, **seqitems, **selfitems; - Py_ssize_t cur, i; - - /* protect against a[::-1] = a */ - if (self == (PyListObject*)value) { - seq = list_slice((PyListObject*)value, 0, - PyList_GET_SIZE(value)); - } - else { - seq = PySequence_Fast(value, - "must assign iterable " - "to extended slice"); - } - if (!seq) - return -1; - - if (PySequence_Fast_GET_SIZE(seq) != slicelength) { - PyErr_Format(PyExc_ValueError, - "attempt to assign sequence of " - "size %zd to extended slice of " - "size %zd", - PySequence_Fast_GET_SIZE(seq), - slicelength); - Py_DECREF(seq); - return -1; - } - - if (!slicelength) { - Py_DECREF(seq); - return 0; - } - - garbage = (PyObject**) - PyMem_MALLOC(slicelength*sizeof(PyObject*)); - if (!garbage) { - Py_DECREF(seq); - PyErr_NoMemory(); - return -1; - } - - selfitems = self->ob_item; - seqitems = PySequence_Fast_ITEMS(seq); - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - garbage[i] = selfitems[cur]; - ins = seqitems[i]; - Py_INCREF(ins); - selfitems[cur] = ins; - } - - for (i = 0; i < slicelength; i++) { - Py_DECREF(garbage[i]); - } - - PyMem_FREE(garbage); - Py_DECREF(seq); - - return 0; - } - } - else { - PyErr_Format(PyExc_TypeError, - "list indices must be integers, not %.200s", - item->ob_type->tp_name); - return -1; - } -} - -static PyMappingMethods list_as_mapping = { - (lenfunc)list_length, - (binaryfunc)list_subscript, - (objobjargproc)list_ass_subscript -}; - -PyTypeObject PyList_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "list", - sizeof(PyListObject), - 0, - (destructor)list_dealloc, /* tp_dealloc */ - (printfunc)list_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)list_repr, /* tp_repr */ - 0, /* tp_as_number */ - &list_as_sequence, /* tp_as_sequence */ - &list_as_mapping, /* tp_as_mapping */ - (hashfunc)PyObject_HashNotImplemented, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LIST_SUBCLASS, /* tp_flags */ - list_doc, /* tp_doc */ - (traverseproc)list_traverse, /* tp_traverse */ - (inquiry)list_clear, /* tp_clear */ - list_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - list_iter, /* tp_iter */ - 0, /* tp_iternext */ - list_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)list_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/*********************** List Iterator **************************/ - -typedef struct { - PyObject_HEAD - long it_index; - PyListObject *it_seq; /* Set to NULL when iterator is exhausted */ -} listiterobject; - -static PyObject *list_iter(PyObject *); -static void listiter_dealloc(listiterobject *); -static int listiter_traverse(listiterobject *, visitproc, void *); -static PyObject *listiter_next(listiterobject *); -static PyObject *listiter_len(listiterobject *); - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef listiter_methods[] = { - {"__length_hint__", (PyCFunction)listiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyListIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "listiterator", /* tp_name */ - sizeof(listiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)listiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)listiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)listiter_next, /* tp_iternext */ - listiter_methods, /* tp_methods */ - 0, /* tp_members */ -}; - - -static PyObject * -list_iter(PyObject *seq) -{ - listiterobject *it; - - if (!PyList_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_GC_New(listiterobject, &PyListIter_Type); - if (it == NULL) - return NULL; - it->it_index = 0; - Py_INCREF(seq); - it->it_seq = (PyListObject *)seq; - _PyObject_GC_TRACK(it); - return (PyObject *)it; -} - -static void -listiter_dealloc(listiterobject *it) -{ - _PyObject_GC_UNTRACK(it); - Py_XDECREF(it->it_seq); - PyObject_GC_Del(it); -} - -static int -listiter_traverse(listiterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->it_seq); - return 0; -} - -static PyObject * -listiter_next(listiterobject *it) -{ - PyListObject *seq; - PyObject *item; - - assert(it != NULL); - seq = it->it_seq; - if (seq == NULL) - return NULL; - assert(PyList_Check(seq)); - - if (it->it_index < PyList_GET_SIZE(seq)) { - item = PyList_GET_ITEM(seq, it->it_index); - ++it->it_index; - Py_INCREF(item); - return item; - } - - Py_DECREF(seq); - it->it_seq = NULL; - return NULL; -} - -static PyObject * -listiter_len(listiterobject *it) -{ - Py_ssize_t len; - if (it->it_seq) { - len = PyList_GET_SIZE(it->it_seq) - it->it_index; - if (len >= 0) - return PyInt_FromSsize_t(len); - } - return PyInt_FromLong(0); -} -/*********************** List Reverse Iterator **************************/ - -typedef struct { - PyObject_HEAD - Py_ssize_t it_index; - PyListObject *it_seq; /* Set to NULL when iterator is exhausted */ -} listreviterobject; - -static PyObject *list_reversed(PyListObject *, PyObject *); -static void listreviter_dealloc(listreviterobject *); -static int listreviter_traverse(listreviterobject *, visitproc, void *); -static PyObject *listreviter_next(listreviterobject *); -static PyObject *listreviter_len(listreviterobject *); - -static PyMethodDef listreviter_methods[] = { - {"__length_hint__", (PyCFunction)listreviter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyListRevIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "listreverseiterator", /* tp_name */ - sizeof(listreviterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)listreviter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)listreviter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)listreviter_next, /* tp_iternext */ - listreviter_methods, /* tp_methods */ - 0, -}; - -static PyObject * -list_reversed(PyListObject *seq, PyObject *unused) -{ - listreviterobject *it; - - it = PyObject_GC_New(listreviterobject, &PyListRevIter_Type); - if (it == NULL) - return NULL; - assert(PyList_Check(seq)); - it->it_index = PyList_GET_SIZE(seq) - 1; - Py_INCREF(seq); - it->it_seq = seq; - PyObject_GC_Track(it); - return (PyObject *)it; -} - -static void -listreviter_dealloc(listreviterobject *it) -{ - PyObject_GC_UnTrack(it); - Py_XDECREF(it->it_seq); - PyObject_GC_Del(it); -} - -static int -listreviter_traverse(listreviterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->it_seq); - return 0; -} - -static PyObject * -listreviter_next(listreviterobject *it) -{ - PyObject *item; - Py_ssize_t index = it->it_index; - PyListObject *seq = it->it_seq; - - if (index>=0 && index < PyList_GET_SIZE(seq)) { - item = PyList_GET_ITEM(seq, index); - it->it_index--; - Py_INCREF(item); - return item; - } - it->it_index = -1; - if (seq != NULL) { - it->it_seq = NULL; - Py_DECREF(seq); - } - return NULL; -} - -static PyObject * -listreviter_len(listreviterobject *it) -{ - Py_ssize_t len = it->it_index + 1; - if (it->it_seq == NULL || PyList_GET_SIZE(it->it_seq) < len) - len = 0; - return PyLong_FromSsize_t(len); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/listsort.txt b/AppPkg/Applications/Python/Python-2.7.10/Objects/listsort.txt deleted file mode 100644 index 4dd9c17..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/listsort.txt +++ /dev/null @@ -1,755 +0,0 @@ -Intro ------ -This describes an adaptive, stable, natural mergesort, modestly called -timsort (hey, I earned it ). It has supernatural performance on many -kinds of partially ordered arrays (less than lg(N!) comparisons needed, and -as few as N-1), yet as fast as Python's previous highly tuned samplesort -hybrid on random arrays. - -In a nutshell, the main routine marches over the array once, left to right, -alternately identifying the next run, then merging it into the previous -runs "intelligently". Everything else is complication for speed, and some -hard-won measure of memory efficiency. - - -Comparison with Python's Samplesort Hybrid ------------------------------------------- -+ timsort can require a temp array containing as many as N//2 pointers, - which means as many as 2*N extra bytes on 32-bit boxes. It can be - expected to require a temp array this large when sorting random data; on - data with significant structure, it may get away without using any extra - heap memory. This appears to be the strongest argument against it, but - compared to the size of an object, 2 temp bytes worst-case (also expected- - case for random data) doesn't scare me much. - - It turns out that Perl is moving to a stable mergesort, and the code for - that appears always to require a temp array with room for at least N - pointers. (Note that I wouldn't want to do that even if space weren't an - issue; I believe its efforts at memory frugality also save timsort - significant pointer-copying costs, and allow it to have a smaller working - set.) - -+ Across about four hours of generating random arrays, and sorting them - under both methods, samplesort required about 1.5% more comparisons - (the program is at the end of this file). - -+ In real life, this may be faster or slower on random arrays than - samplesort was, depending on platform quirks. Since it does fewer - comparisons on average, it can be expected to do better the more - expensive a comparison function is. OTOH, it does more data movement - (pointer copying) than samplesort, and that may negate its small - comparison advantage (depending on platform quirks) unless comparison - is very expensive. - -+ On arrays with many kinds of pre-existing order, this blows samplesort out - of the water. It's significantly faster than samplesort even on some - cases samplesort was special-casing the snot out of. I believe that lists - very often do have exploitable partial order in real life, and this is the - strongest argument in favor of timsort (indeed, samplesort's special cases - for extreme partial order are appreciated by real users, and timsort goes - much deeper than those, in particular naturally covering every case where - someone has suggested "and it would be cool if list.sort() had a special - case for this too ... and for that ..."). - -+ Here are exact comparison counts across all the tests in sortperf.py, - when run with arguments "15 20 1". - - Column Key: - *sort: random data - \sort: descending data - /sort: ascending data - 3sort: ascending, then 3 random exchanges - +sort: ascending, then 10 random at the end - %sort: ascending, then randomly replace 1% of elements w/ random values - ~sort: many duplicates - =sort: all equal - !sort: worst case scenario - - First the trivial cases, trivial for samplesort because it special-cased - them, and trivial for timsort because it naturally works on runs. Within - an "n" block, the first line gives the # of compares done by samplesort, - the second line by timsort, and the third line is the percentage by - which the samplesort count exceeds the timsort count: - - n \sort /sort =sort -------- ------ ------ ------ - 32768 32768 32767 32767 samplesort - 32767 32767 32767 timsort - 0.00% 0.00% 0.00% (samplesort - timsort) / timsort - - 65536 65536 65535 65535 - 65535 65535 65535 - 0.00% 0.00% 0.00% - - 131072 131072 131071 131071 - 131071 131071 131071 - 0.00% 0.00% 0.00% - - 262144 262144 262143 262143 - 262143 262143 262143 - 0.00% 0.00% 0.00% - - 524288 524288 524287 524287 - 524287 524287 524287 - 0.00% 0.00% 0.00% - -1048576 1048576 1048575 1048575 - 1048575 1048575 1048575 - 0.00% 0.00% 0.00% - - The algorithms are effectively identical in these cases, except that - timsort does one less compare in \sort. - - Now for the more interesting cases. Where lg(x) is the logarithm of x to - the base 2 (e.g., lg(8)=3), lg(n!) is the information-theoretic limit for - the best any comparison-based sorting algorithm can do on average (across - all permutations). When a method gets significantly below that, it's - either astronomically lucky, or is finding exploitable structure in the - data. - - - n lg(n!) *sort 3sort +sort %sort ~sort !sort -------- ------- ------ ------- ------- ------ ------- -------- - 32768 444255 453096 453614 32908 452871 130491 469141 old - 448885 33016 33007 50426 182083 65534 new - 0.94% 1273.92% -0.30% 798.09% -28.33% 615.87% %ch from new - - 65536 954037 972699 981940 65686 973104 260029 1004607 - 962991 65821 65808 101667 364341 131070 - 1.01% 1391.83% -0.19% 857.15% -28.63% 666.47% - - 131072 2039137 2101881 2091491 131232 2092894 554790 2161379 - 2057533 131410 131361 206193 728871 262142 - 2.16% 1491.58% -0.10% 915.02% -23.88% 724.51% - - 262144 4340409 4464460 4403233 262314 4445884 1107842 4584560 - 4377402 262437 262459 416347 1457945 524286 - 1.99% 1577.82% -0.06% 967.83% -24.01% 774.44% - - 524288 9205096 9453356 9408463 524468 9441930 2218577 9692015 - 9278734 524580 524633 837947 2916107 1048574 - 1.88% 1693.52% -0.03% 1026.79% -23.92% 824.30% - -1048576 19458756 19950272 19838588 1048766 19912134 4430649 20434212 - 19606028 1048958 1048941 1694896 5832445 2097150 - 1.76% 1791.27% -0.02% 1074.83% -24.03% 874.38% - - Discussion of cases: - - *sort: There's no structure in random data to exploit, so the theoretical - limit is lg(n!). Both methods get close to that, and timsort is hugging - it (indeed, in a *marginal* sense, it's a spectacular improvement -- - there's only about 1% left before hitting the wall, and timsort knows - darned well it's doing compares that won't pay on random data -- but so - does the samplesort hybrid). For contrast, Hoare's original random-pivot - quicksort does about 39% more compares than the limit, and the median-of-3 - variant about 19% more. - - 3sort, %sort, and !sort: No contest; there's structure in this data, but - not of the specific kinds samplesort special-cases. Note that structure - in !sort wasn't put there on purpose -- it was crafted as a worst case for - a previous quicksort implementation. That timsort nails it came as a - surprise to me (although it's obvious in retrospect). - - +sort: samplesort special-cases this data, and does a few less compares - than timsort. However, timsort runs this case significantly faster on all - boxes we have timings for, because timsort is in the business of merging - runs efficiently, while samplesort does much more data movement in this - (for it) special case. - - ~sort: samplesort's special cases for large masses of equal elements are - extremely effective on ~sort's specific data pattern, and timsort just - isn't going to get close to that, despite that it's clearly getting a - great deal of benefit out of the duplicates (the # of compares is much less - than lg(n!)). ~sort has a perfectly uniform distribution of just 4 - distinct values, and as the distribution gets more skewed, samplesort's - equal-element gimmicks become less effective, while timsort's adaptive - strategies find more to exploit; in a database supplied by Kevin Altis, a - sort on its highly skewed "on which stock exchange does this company's - stock trade?" field ran over twice as fast under timsort. - - However, despite that timsort does many more comparisons on ~sort, and - that on several platforms ~sort runs highly significantly slower under - timsort, on other platforms ~sort runs highly significantly faster under - timsort. No other kind of data has shown this wild x-platform behavior, - and we don't have an explanation for it. The only thing I can think of - that could transform what "should be" highly significant slowdowns into - highly significant speedups on some boxes are catastrophic cache effects - in samplesort. - - But timsort "should be" slower than samplesort on ~sort, so it's hard - to count that it isn't on some boxes as a strike against it . - -+ Here's the highwater mark for the number of heap-based temp slots (4 - bytes each on this box) needed by each test, again with arguments - "15 20 1": - - 2**i *sort \sort /sort 3sort +sort %sort ~sort =sort !sort - 32768 16384 0 0 6256 0 10821 12288 0 16383 - 65536 32766 0 0 21652 0 31276 24576 0 32767 - 131072 65534 0 0 17258 0 58112 49152 0 65535 - 262144 131072 0 0 35660 0 123561 98304 0 131071 - 524288 262142 0 0 31302 0 212057 196608 0 262143 -1048576 524286 0 0 312438 0 484942 393216 0 524287 - - Discussion: The tests that end up doing (close to) perfectly balanced - merges (*sort, !sort) need all N//2 temp slots (or almost all). ~sort - also ends up doing balanced merges, but systematically benefits a lot from - the preliminary pre-merge searches described under "Merge Memory" later. - %sort approaches having a balanced merge at the end because the random - selection of elements to replace is expected to produce an out-of-order - element near the midpoint. \sort, /sort, =sort are the trivial one-run - cases, needing no merging at all. +sort ends up having one very long run - and one very short, and so gets all the temp space it needs from the small - temparray member of the MergeState struct (note that the same would be - true if the new random elements were prefixed to the sorted list instead, - but not if they appeared "in the middle"). 3sort approaches N//3 temp - slots twice, but the run lengths that remain after 3 random exchanges - clearly has very high variance. - - -A detailed description of timsort follows. - -Runs ----- -count_run() returns the # of elements in the next run. A run is either -"ascending", which means non-decreasing: - - a0 <= a1 <= a2 <= ... - -or "descending", which means strictly decreasing: - - a0 > a1 > a2 > ... - -Note that a run is always at least 2 long, unless we start at the array's -last element. - -The definition of descending is strict, because the main routine reverses -a descending run in-place, transforming a descending run into an ascending -run. Reversal is done via the obvious fast "swap elements starting at each -end, and converge at the middle" method, and that can violate stability if -the slice contains any equal elements. Using a strict definition of -descending ensures that a descending run contains distinct elements. - -If an array is random, it's very unlikely we'll see long runs. If a natural -run contains less than minrun elements (see next section), the main loop -artificially boosts it to minrun elements, via a stable binary insertion sort -applied to the right number of array elements following the short natural -run. In a random array, *all* runs are likely to be minrun long as a -result. This has two primary good effects: - -1. Random data strongly tends then toward perfectly balanced (both runs have - the same length) merges, which is the most efficient way to proceed when - data is random. - -2. Because runs are never very short, the rest of the code doesn't make - heroic efforts to shave a few cycles off per-merge overheads. For - example, reasonable use of function calls is made, rather than trying to - inline everything. Since there are no more than N/minrun runs to begin - with, a few "extra" function calls per merge is barely measurable. - - -Computing minrun ----------------- -If N < 64, minrun is N. IOW, binary insertion sort is used for the whole -array then; it's hard to beat that given the overheads of trying something -fancier (see note BINSORT). - -When N is a power of 2, testing on random data showed that minrun values of -16, 32, 64 and 128 worked about equally well. At 256 the data-movement cost -in binary insertion sort clearly hurt, and at 8 the increase in the number -of function calls clearly hurt. Picking *some* power of 2 is important -here, so that the merges end up perfectly balanced (see next section). We -pick 32 as a good value in the sweet range; picking a value at the low end -allows the adaptive gimmicks more opportunity to exploit shorter natural -runs. - -Because sortperf.py only tries powers of 2, it took a long time to notice -that 32 isn't a good choice for the general case! Consider N=2112: - ->>> divmod(2112, 32) -(66, 0) ->>> - -If the data is randomly ordered, we're very likely to end up with 66 runs -each of length 32. The first 64 of these trigger a sequence of perfectly -balanced merges (see next section), leaving runs of lengths 2048 and 64 to -merge at the end. The adaptive gimmicks can do that with fewer than 2048+64 -compares, but it's still more compares than necessary, and-- mergesort's -bugaboo relative to samplesort --a lot more data movement (O(N) copies just -to get 64 elements into place). - -If we take minrun=33 in this case, then we're very likely to end up with 64 -runs each of length 33, and then all merges are perfectly balanced. Better! - -What we want to avoid is picking minrun such that in - - q, r = divmod(N, minrun) - -q is a power of 2 and r>0 (then the last merge only gets r elements into -place, and r < minrun is small compared to N), or q a little larger than a -power of 2 regardless of r (then we've got a case similar to "2112", again -leaving too little work for the last merge to do). - -Instead we pick a minrun in range(32, 65) such that N/minrun is exactly a -power of 2, or if that isn't possible, is close to, but strictly less than, -a power of 2. This is easier to do than it may sound: take the first 6 -bits of N, and add 1 if any of the remaining bits are set. In fact, that -rule covers every case in this section, including small N and exact powers -of 2; merge_compute_minrun() is a deceptively simple function. - - -The Merge Pattern ------------------ -In order to exploit regularities in the data, we're merging on natural -run lengths, and they can become wildly unbalanced. That's a Good Thing -for this sort! It means we have to find a way to manage an assortment of -potentially very different run lengths, though. - -Stability constrains permissible merging patterns. For example, if we have -3 consecutive runs of lengths - - A:10000 B:20000 C:10000 - -we dare not merge A with C first, because if A, B and C happen to contain -a common element, it would get out of order wrt its occurrence(s) in B. The -merging must be done as (A+B)+C or A+(B+C) instead. - -So merging is always done on two consecutive runs at a time, and in-place, -although this may require some temp memory (more on that later). - -When a run is identified, its base address and length are pushed on a stack -in the MergeState struct. merge_collapse() is then called to see whether it -should merge it with preceding run(s). We would like to delay merging as -long as possible in order to exploit patterns that may come up later, but we -like even more to do merging as soon as possible to exploit that the run just -found is still high in the memory hierarchy. We also can't delay merging -"too long" because it consumes memory to remember the runs that are still -unmerged, and the stack has a fixed size. - -What turned out to be a good compromise maintains two invariants on the -stack entries, where A, B and C are the lengths of the three righmost not-yet -merged slices: - -1. A > B+C -2. B > C - -Note that, by induction, #2 implies the lengths of pending runs form a -decreasing sequence. #1 implies that, reading the lengths right to left, -the pending-run lengths grow at least as fast as the Fibonacci numbers. -Therefore the stack can never grow larger than about log_base_phi(N) entries, -where phi = (1+sqrt(5))/2 ~= 1.618. Thus a small # of stack slots suffice -for very large arrays. - -If A <= B+C, the smaller of A and C is merged with B (ties favor C, for the -freshness-in-cache reason), and the new run replaces the A,B or B,C entries; -e.g., if the last 3 entries are - - A:30 B:20 C:10 - -then B is merged with C, leaving - - A:30 BC:30 - -on the stack. Or if they were - - A:500 B:400: C:1000 - -then A is merged with B, leaving - - AB:900 C:1000 - -on the stack. - -In both examples, the stack configuration after the merge still violates -invariant #2, and merge_collapse() goes on to continue merging runs until -both invariants are satisfied. As an extreme case, suppose we didn't do the -minrun gimmick, and natural runs were of lengths 128, 64, 32, 16, 8, 4, 2, -and 2. Nothing would get merged until the final 2 was seen, and that would -trigger 7 perfectly balanced merges. - -The thrust of these rules when they trigger merging is to balance the run -lengths as closely as possible, while keeping a low bound on the number of -runs we have to remember. This is maximally effective for random data, -where all runs are likely to be of (artificially forced) length minrun, and -then we get a sequence of perfectly balanced merges (with, perhaps, some -oddballs at the end). - -OTOH, one reason this sort is so good for partly ordered data has to do -with wildly unbalanced run lengths. - - -Merge Memory ------------- -Merging adjacent runs of lengths A and B in-place, and in linear time, is -difficult. Theoretical constructions are known that can do it, but they're -too difficult and slow for practical use. But if we have temp memory equal -to min(A, B), it's easy. - -If A is smaller (function merge_lo), copy A to a temp array, leave B alone, -and then we can do the obvious merge algorithm left to right, from the temp -area and B, starting the stores into where A used to live. There's always a -free area in the original area comprising a number of elements equal to the -number not yet merged from the temp array (trivially true at the start; -proceed by induction). The only tricky bit is that if a comparison raises an -exception, we have to remember to copy the remaining elements back in from -the temp area, lest the array end up with duplicate entries from B. But -that's exactly the same thing we need to do if we reach the end of B first, -so the exit code is pleasantly common to both the normal and error cases. - -If B is smaller (function merge_hi, which is merge_lo's "mirror image"), -much the same, except that we need to merge right to left, copying B into a -temp array and starting the stores at the right end of where B used to live. - -A refinement: When we're about to merge adjacent runs A and B, we first do -a form of binary search (more on that later) to see where B[0] should end up -in A. Elements in A preceding that point are already in their final -positions, effectively shrinking the size of A. Likewise we also search to -see where A[-1] should end up in B, and elements of B after that point can -also be ignored. This cuts the amount of temp memory needed by the same -amount. - -These preliminary searches may not pay off, and can be expected *not* to -repay their cost if the data is random. But they can win huge in all of -time, copying, and memory savings when they do pay, so this is one of the -"per-merge overheads" mentioned above that we're happy to endure because -there is at most one very short run. It's generally true in this algorithm -that we're willing to gamble a little to win a lot, even though the net -expectation is negative for random data. - - -Merge Algorithms ----------------- -merge_lo() and merge_hi() are where the bulk of the time is spent. merge_lo -deals with runs where A <= B, and merge_hi where A > B. They don't know -whether the data is clustered or uniform, but a lovely thing about merging -is that many kinds of clustering "reveal themselves" by how many times in a -row the winning merge element comes from the same run. We'll only discuss -merge_lo here; merge_hi is exactly analogous. - -Merging begins in the usual, obvious way, comparing the first element of A -to the first of B, and moving B[0] to the merge area if it's less than A[0], -else moving A[0] to the merge area. Call that the "one pair at a time" -mode. The only twist here is keeping track of how many times in a row "the -winner" comes from the same run. - -If that count reaches MIN_GALLOP, we switch to "galloping mode". Here -we *search* B for where A[0] belongs, and move over all the B's before -that point in one chunk to the merge area, then move A[0] to the merge -area. Then we search A for where B[0] belongs, and similarly move a -slice of A in one chunk. Then back to searching B for where A[0] belongs, -etc. We stay in galloping mode until both searches find slices to copy -less than MIN_GALLOP elements long, at which point we go back to one-pair- -at-a-time mode. - -A refinement: The MergeState struct contains the value of min_gallop that -controls when we enter galloping mode, initialized to MIN_GALLOP. -merge_lo() and merge_hi() adjust this higher when galloping isn't paying -off, and lower when it is. - - -Galloping ---------- -Still without loss of generality, assume A is the shorter run. In galloping -mode, we first look for A[0] in B. We do this via "galloping", comparing -A[0] in turn to B[0], B[1], B[3], B[7], ..., B[2**j - 1], ..., until finding -the k such that B[2**(k-1) - 1] < A[0] <= B[2**k - 1]. This takes at most -roughly lg(B) comparisons, and, unlike a straight binary search, favors -finding the right spot early in B (more on that later). - -After finding such a k, the region of uncertainty is reduced to 2**(k-1) - 1 -consecutive elements, and a straight binary search requires exactly k-1 -additional comparisons to nail it (see note REGION OF UNCERTAINTY). Then we -copy all the B's up to that point in one chunk, and then copy A[0]. Note -that no matter where A[0] belongs in B, the combination of galloping + binary -search finds it in no more than about 2*lg(B) comparisons. - -If we did a straight binary search, we could find it in no more than -ceiling(lg(B+1)) comparisons -- but straight binary search takes that many -comparisons no matter where A[0] belongs. Straight binary search thus loses -to galloping unless the run is quite long, and we simply can't guess -whether it is in advance. - -If data is random and runs have the same length, A[0] belongs at B[0] half -the time, at B[1] a quarter of the time, and so on: a consecutive winning -sub-run in B of length k occurs with probability 1/2**(k+1). So long -winning sub-runs are extremely unlikely in random data, and guessing that a -winning sub-run is going to be long is a dangerous game. - -OTOH, if data is lopsided or lumpy or contains many duplicates, long -stretches of winning sub-runs are very likely, and cutting the number of -comparisons needed to find one from O(B) to O(log B) is a huge win. - -Galloping compromises by getting out fast if there isn't a long winning -sub-run, yet finding such very efficiently when they exist. - -I first learned about the galloping strategy in a related context; see: - - "Adaptive Set Intersections, Unions, and Differences" (2000) - Erik D. Demaine, Alejandro López-Ortiz, J. Ian Munro - -and its followup(s). An earlier paper called the same strategy -"exponential search": - - "Optimistic Sorting and Information Theoretic Complexity" - Peter McIlroy - SODA (Fourth Annual ACM-SIAM Symposium on Discrete Algorithms), pp - 467-474, Austin, Texas, 25-27 January 1993. - -and it probably dates back to an earlier paper by Bentley and Yao. The -McIlroy paper in particular has good analysis of a mergesort that's -probably strongly related to this one in its galloping strategy. - - -Galloping with a Broken Leg ---------------------------- -So why don't we always gallop? Because it can lose, on two counts: - -1. While we're willing to endure small per-merge overheads, per-comparison - overheads are a different story. Calling Yet Another Function per - comparison is expensive, and gallop_left() and gallop_right() are - too long-winded for sane inlining. - -2. Galloping can-- alas --require more comparisons than linear one-at-time - search, depending on the data. - -#2 requires details. If A[0] belongs before B[0], galloping requires 1 -compare to determine that, same as linear search, except it costs more -to call the gallop function. If A[0] belongs right before B[1], galloping -requires 2 compares, again same as linear search. On the third compare, -galloping checks A[0] against B[3], and if it's <=, requires one more -compare to determine whether A[0] belongs at B[2] or B[3]. That's a total -of 4 compares, but if A[0] does belong at B[2], linear search would have -discovered that in only 3 compares, and that's a huge loss! Really. It's -an increase of 33% in the number of compares needed, and comparisons are -expensive in Python. - -index in B where # compares linear # gallop # binary gallop -A[0] belongs search needs compares compares total ----------------- ----------------- -------- -------- ------ - 0 1 1 0 1 - - 1 2 2 0 2 - - 2 3 3 1 4 - 3 4 3 1 4 - - 4 5 4 2 6 - 5 6 4 2 6 - 6 7 4 2 6 - 7 8 4 2 6 - - 8 9 5 3 8 - 9 10 5 3 8 - 10 11 5 3 8 - 11 12 5 3 8 - ... - -In general, if A[0] belongs at B[i], linear search requires i+1 comparisons -to determine that, and galloping a total of 2*floor(lg(i))+2 comparisons. -The advantage of galloping is unbounded as i grows, but it doesn't win at -all until i=6. Before then, it loses twice (at i=2 and i=4), and ties -at the other values. At and after i=6, galloping always wins. - -We can't guess in advance when it's going to win, though, so we do one pair -at a time until the evidence seems strong that galloping may pay. MIN_GALLOP -is 7, and that's pretty strong evidence. However, if the data is random, it -simply will trigger galloping mode purely by luck every now and again, and -it's quite likely to hit one of the losing cases next. On the other hand, -in cases like ~sort, galloping always pays, and MIN_GALLOP is larger than it -"should be" then. So the MergeState struct keeps a min_gallop variable -that merge_lo and merge_hi adjust: the longer we stay in galloping mode, -the smaller min_gallop gets, making it easier to transition back to -galloping mode (if we ever leave it in the current merge, and at the -start of the next merge). But whenever the gallop loop doesn't pay, -min_gallop is increased by one, making it harder to transition back -to galloping mode (and again both within a merge and across merges). For -random data, this all but eliminates the gallop penalty: min_gallop grows -large enough that we almost never get into galloping mode. And for cases -like ~sort, min_gallop can fall to as low as 1. This seems to work well, -but in all it's a minor improvement over using a fixed MIN_GALLOP value. - - -Galloping Complication ----------------------- -The description above was for merge_lo. merge_hi has to merge "from the -other end", and really needs to gallop starting at the last element in a run -instead of the first. Galloping from the first still works, but does more -comparisons than it should (this is significant -- I timed it both ways). For -this reason, the gallop_left() and gallop_right() (see note LEFT OR RIGHT) -functions have a "hint" argument, which is the index at which galloping -should begin. So galloping can actually start at any index, and proceed at -offsets of 1, 3, 7, 15, ... or -1, -3, -7, -15, ... from the starting index. - -In the code as I type it's always called with either 0 or n-1 (where n is -the # of elements in a run). It's tempting to try to do something fancier, -melding galloping with some form of interpolation search; for example, if -we're merging a run of length 1 with a run of length 10000, index 5000 is -probably a better guess at the final result than either 0 or 9999. But -it's unclear how to generalize that intuition usefully, and merging of -wildly unbalanced runs already enjoys excellent performance. - -~sort is a good example of when balanced runs could benefit from a better -hint value: to the extent possible, this would like to use a starting -offset equal to the previous value of acount/bcount. Doing so saves about -10% of the compares in ~sort. However, doing so is also a mixed bag, -hurting other cases. - - -Comparing Average # of Compares on Random Arrays ------------------------------------------------- -[NOTE: This was done when the new algorithm used about 0.1% more compares - on random data than does its current incarnation.] - -Here list.sort() is samplesort, and list.msort() this sort: - -""" -import random -from time import clock as now - -def fill(n): - from random import random - return [random() for i in xrange(n)] - -def mycmp(x, y): - global ncmp - ncmp += 1 - return cmp(x, y) - -def timeit(values, method): - global ncmp - X = values[:] - bound = getattr(X, method) - ncmp = 0 - t1 = now() - bound(mycmp) - t2 = now() - return t2-t1, ncmp - -format = "%5s %9.2f %11d" -f2 = "%5s %9.2f %11.2f" - -def drive(): - count = sst = sscmp = mst = mscmp = nelts = 0 - while True: - n = random.randrange(100000) - nelts += n - x = fill(n) - - t, c = timeit(x, 'sort') - sst += t - sscmp += c - - t, c = timeit(x, 'msort') - mst += t - mscmp += c - - count += 1 - if count % 10: - continue - - print "count", count, "nelts", nelts - print format % ("sort", sst, sscmp) - print format % ("msort", mst, mscmp) - print f2 % ("", (sst-mst)*1e2/mst, (sscmp-mscmp)*1e2/mscmp) - -drive() -""" - -I ran this on Windows and kept using the computer lightly while it was -running. time.clock() is wall-clock time on Windows, with better than -microsecond resolution. samplesort started with a 1.52% #-of-comparisons -disadvantage, fell quickly to 1.48%, and then fluctuated within that small -range. Here's the last chunk of output before I killed the job: - -count 2630 nelts 130906543 - sort 6110.80 1937887573 -msort 6002.78 1909389381 - 1.80 1.49 - -We've done nearly 2 billion comparisons apiece at Python speed there, and -that's enough . - -For random arrays of size 2 (yes, there are only 2 interesting ones), -samplesort has a 50%(!) comparison disadvantage. This is a consequence of -samplesort special-casing at most one ascending run at the start, then -falling back to the general case if it doesn't find an ascending run -immediately. The consequence is that it ends up using two compares to sort -[2, 1]. Gratifyingly, timsort doesn't do any special-casing, so had to be -taught how to deal with mixtures of ascending and descending runs -efficiently in all cases. - - -NOTES ------ - -BINSORT -A "binary insertion sort" is just like a textbook insertion sort, but instead -of locating the correct position of the next item via linear (one at a time) -search, an equivalent to Python's bisect.bisect_right is used to find the -correct position in logarithmic time. Most texts don't mention this -variation, and those that do usually say it's not worth the bother: insertion -sort remains quadratic (expected and worst cases) either way. Speeding the -search doesn't reduce the quadratic data movement costs. - -But in CPython's case, comparisons are extraordinarily expensive compared to -moving data, and the details matter. Moving objects is just copying -pointers. Comparisons can be arbitrarily expensive (can invoke arbitary -user-supplied Python code), but even in simple cases (like 3 < 4) _all_ -decisions are made at runtime: what's the type of the left comparand? the -type of the right? do they need to be coerced to a common type? where's the -code to compare these types? And so on. Even the simplest Python comparison -triggers a large pile of C-level pointer dereferences, conditionals, and -function calls. - -So cutting the number of compares is almost always measurably helpful in -CPython, and the savings swamp the quadratic-time data movement costs for -reasonable minrun values. - - -LEFT OR RIGHT -gallop_left() and gallop_right() are akin to the Python bisect module's -bisect_left() and bisect_right(): they're the same unless the slice they're -searching contains a (at least one) value equal to the value being searched -for. In that case, gallop_left() returns the position immediately before the -leftmost equal value, and gallop_right() the position immediately after the -rightmost equal value. The distinction is needed to preserve stability. In -general, when merging adjacent runs A and B, gallop_left is used to search -thru B for where an element from A belongs, and gallop_right to search thru A -for where an element from B belongs. - - -REGION OF UNCERTAINTY -Two kinds of confusion seem to be common about the claim that after finding -a k such that - - B[2**(k-1) - 1] < A[0] <= B[2**k - 1] - -then a binary search requires exactly k-1 tries to find A[0]'s proper -location. For concreteness, say k=3, so B[3] < A[0] <= B[7]. - -The first confusion takes the form "OK, then the region of uncertainty is at -indices 3, 4, 5, 6 and 7: that's 5 elements, not the claimed 2**(k-1) - 1 = -3"; or the region is viewed as a Python slice and the objection is "but that's -the slice B[3:7], so has 7-3 = 4 elements". Resolution: we've already -compared A[0] against B[3] and against B[7], so A[0]'s correct location is -already known wrt _both_ endpoints. What remains is to find A[0]'s correct -location wrt B[4], B[5] and B[6], which spans 3 elements. Or in general, the -slice (leaving off both endpoints) (2**(k-1)-1)+1 through (2**k-1)-1 -inclusive = 2**(k-1) through (2**k-1)-1 inclusive, which has - (2**k-1)-1 - 2**(k-1) + 1 = - 2**k-1 - 2**(k-1) = - 2*2**k-1 - 2**(k-1) = - (2-1)*2**(k-1) - 1 = - 2**(k-1) - 1 -elements. - -The second confusion: "k-1 = 2 binary searches can find the correct location -among 2**(k-1) = 4 elements, but you're only applying it to 3 elements: we -could make this more efficient by arranging for the region of uncertainty to -span 2**(k-1) elements." Resolution: that confuses "elements" with -"locations". In a slice with N elements, there are N+1 _locations_. In the -example, with the region of uncertainty B[4], B[5], B[6], there are 4 -locations: before B[4], between B[4] and B[5], between B[5] and B[6], and -after B[6]. In general, across 2**(k-1)-1 elements, there are 2**(k-1) -locations. That's why k-1 binary searches are necessary and sufficient. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/lnotab_notes.txt b/AppPkg/Applications/Python/Python-2.7.10/Objects/lnotab_notes.txt deleted file mode 100644 index c9d45cf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/lnotab_notes.txt +++ /dev/null @@ -1,124 +0,0 @@ -All about co_lnotab, the line number table. - -Code objects store a field named co_lnotab. This is an array of unsigned bytes -disguised as a Python string. It is used to map bytecode offsets to source code -line #s for tracebacks and to identify line number boundaries for line tracing. - -The array is conceptually a compressed list of - (bytecode offset increment, line number increment) -pairs. The details are important and delicate, best illustrated by example: - - byte code offset source code line number - 0 1 - 6 2 - 50 7 - 350 307 - 361 308 - -Instead of storing these numbers literally, we compress the list by storing only -the increments from one row to the next. Conceptually, the stored list might -look like: - - 0, 1, 6, 1, 44, 5, 300, 300, 11, 1 - -The above doesn't really work, but it's a start. Note that an unsigned byte -can't hold negative values, or values larger than 255, and the above example -contains two such values. So we make two tweaks: - - (a) there's a deep assumption that byte code offsets and their corresponding - line #s both increase monotonically, and - (b) if at least one column jumps by more than 255 from one row to the next, - more than one pair is written to the table. In case #b, there's no way to know - from looking at the table later how many were written. That's the delicate - part. A user of co_lnotab desiring to find the source line number - corresponding to a bytecode address A should do something like this - - lineno = addr = 0 - for addr_incr, line_incr in co_lnotab: - addr += addr_incr - if addr > A: - return lineno - lineno += line_incr - -(In C, this is implemented by PyCode_Addr2Line().) In order for this to work, -when the addr field increments by more than 255, the line # increment in each -pair generated must be 0 until the remaining addr increment is < 256. So, in -the example above, assemble_lnotab in compile.c should not (as was actually done -until 2.2) expand 300, 300 to - 255, 255, 45, 45, -but to - 255, 0, 45, 255, 0, 45. - -The above is sufficient to reconstruct line numbers for tracebacks, but not for -line tracing. Tracing is handled by PyCode_CheckLineNumber() in codeobject.c -and maybe_call_line_trace() in ceval.c. - -*** Tracing *** - -To a first approximation, we want to call the tracing function when the line -number of the current instruction changes. Re-computing the current line for -every instruction is a little slow, though, so each time we compute the line -number we save the bytecode indices where it's valid: - - *instr_lb <= frame->f_lasti < *instr_ub - -is true so long as execution does not change lines. That is, *instr_lb holds -the first bytecode index of the current line, and *instr_ub holds the first -bytecode index of the next line. As long as the above expression is true, -maybe_call_line_trace() does not need to call PyCode_CheckLineNumber(). Note -that the same line may appear multiple times in the lnotab, either because the -bytecode jumped more than 255 indices between line number changes or because -the compiler inserted the same line twice. Even in that case, *instr_ub holds -the first index of the next line. - -However, we don't *always* want to call the line trace function when the above -test fails. - -Consider this code: - -1: def f(a): -2: while a: -3: print 1, -4: break -5: else: -6: print 2, - -which compiles to this: - - 2 0 SETUP_LOOP 19 (to 22) - >> 3 LOAD_FAST 0 (a) - 6 POP_JUMP_IF_FALSE 17 - - 3 9 LOAD_CONST 1 (1) - 12 PRINT_ITEM - - 4 13 BREAK_LOOP - 14 JUMP_ABSOLUTE 3 - >> 17 POP_BLOCK - - 6 18 LOAD_CONST 2 (2) - 21 PRINT_ITEM - >> 22 LOAD_CONST 0 (None) - 25 RETURN_VALUE - -If 'a' is false, execution will jump to the POP_BLOCK instruction at offset 17 -and the co_lnotab will claim that execution has moved to line 4, which is wrong. -In this case, we could instead associate the POP_BLOCK with line 5, but that -would break jumps around loops without else clauses. - -We fix this by only calling the line trace function for a forward jump if the -co_lnotab indicates we have jumped to the *start* of a line, i.e. if the current -instruction offset matches the offset given for the start of a line by the -co_lnotab. For backward jumps, however, we always call the line trace function, -which lets a debugger stop on every evaluation of a loop guard (which usually -won't be the first opcode in a line). - -Why do we set f_lineno when tracing, and only just before calling the trace -function? Well, consider the code above when 'a' is true. If stepping through -this with 'n' in pdb, you would stop at line 1 with a "call" type event, then -line events on lines 2, 3, and 4, then a "return" type event -- but because the -code for the return actually falls in the range of the "line 6" opcodes, you -would be shown line 6 during this event. This is a change from the behaviour in -2.2 and before, and I've found it confusing in practice. By setting and using -f_lineno when tracing, one can report a line number different from that -suggested by f_lasti on this one occasion where it's desirable. diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/memoryobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/memoryobject.c deleted file mode 100644 index 00da8b9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/memoryobject.c +++ /dev/null @@ -1,842 +0,0 @@ - -/* Memoryview object implementation */ - -#include "Python.h" - -static Py_ssize_t -get_shape0(Py_buffer *buf) -{ - if (buf->shape != NULL) - return buf->shape[0]; - if (buf->ndim == 0) - return 1; - PyErr_SetString(PyExc_TypeError, - "exported buffer does not have any shape information associated " - "to it"); - return -1; -} - -static void -dup_buffer(Py_buffer *dest, Py_buffer *src) -{ - *dest = *src; - if (src->ndim == 1 && src->shape != NULL) { - dest->shape = &(dest->smalltable[0]); - dest->shape[0] = get_shape0(src); - } - if (src->ndim == 1 && src->strides != NULL) { - dest->strides = &(dest->smalltable[1]); - dest->strides[0] = src->strides[0]; - } -} - -static int -memory_getbuf(PyMemoryViewObject *self, Py_buffer *view, int flags) -{ - int res = 0; - if (self->view.obj != NULL) - res = PyObject_GetBuffer(self->view.obj, view, flags); - if (view) - dup_buffer(view, &self->view); - return res; -} - -static void -memory_releasebuf(PyMemoryViewObject *self, Py_buffer *view) -{ - PyBuffer_Release(view); -} - -PyDoc_STRVAR(memory_doc, -"memoryview(object)\n\ -\n\ -Create a new memoryview object which references the given object."); - -PyObject * -PyMemoryView_FromBuffer(Py_buffer *info) -{ - PyMemoryViewObject *mview; - - mview = (PyMemoryViewObject *) - PyObject_GC_New(PyMemoryViewObject, &PyMemoryView_Type); - if (mview == NULL) - return NULL; - mview->base = NULL; - dup_buffer(&mview->view, info); - /* NOTE: mview->view.obj should already have been incref'ed as - part of PyBuffer_FillInfo(). */ - _PyObject_GC_TRACK(mview); - return (PyObject *)mview; -} - -PyObject * -PyMemoryView_FromObject(PyObject *base) -{ - PyMemoryViewObject *mview; - Py_buffer view; - - if (!PyObject_CheckBuffer(base)) { - PyErr_SetString(PyExc_TypeError, - "cannot make memory view because object does " - "not have the buffer interface"); - return NULL; - } - - if (PyObject_GetBuffer(base, &view, PyBUF_FULL_RO) < 0) - return NULL; - - mview = (PyMemoryViewObject *)PyMemoryView_FromBuffer(&view); - if (mview == NULL) { - PyBuffer_Release(&view); - return NULL; - } - - mview->base = base; - Py_INCREF(base); - return (PyObject *)mview; -} - -static PyObject * -memory_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds) -{ - PyObject *obj; - static char *kwlist[] = {"object", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:memoryview", kwlist, - &obj)) { - return NULL; - } - - return PyMemoryView_FromObject(obj); -} - - -static void -_strided_copy_nd(char *dest, char *src, int nd, Py_ssize_t *shape, - Py_ssize_t *strides, Py_ssize_t itemsize, char fort) -{ - int k; - Py_ssize_t outstride; - - if (nd==0) { - memcpy(dest, src, itemsize); - } - else if (nd == 1) { - for (k = 0; kndim > PY_SSIZE_T_MAX / sizeof(Py_ssize_t)) { - PyErr_NoMemory(); - return -1; - } - - indices = (Py_ssize_t *)PyMem_Malloc(sizeof(Py_ssize_t)*view->ndim); - if (indices == NULL) { - PyErr_NoMemory(); - return -1; - } - for (k=0; kndim;k++) { - indices[k] = 0; - } - - elements = 1; - for (k=0; kndim; k++) { - elements *= view->shape[k]; - } - if (fort == 'F') { - func = _Py_add_one_to_index_F; - } - else { - func = _Py_add_one_to_index_C; - } - while (elements--) { - func(view->ndim, indices, view->shape); - ptr = PyBuffer_GetPointer(view, indices); - memcpy(dest, ptr, view->itemsize); - dest += view->itemsize; - } - - PyMem_Free(indices); - return 0; -} - -/* - Get a the data from an object as a contiguous chunk of memory (in - either 'C' or 'F'ortran order) even if it means copying it into a - separate memory area. - - Returns a new reference to a Memory view object. If no copy is needed, - the memory view object points to the original memory and holds a - lock on the original. If a copy is needed, then the memory view object - points to a brand-new Bytes object (and holds a memory lock on it). - - buffertype - - PyBUF_READ buffer only needs to be read-only - PyBUF_WRITE buffer needs to be writable (give error if not contiguous) - PyBUF_SHADOW buffer needs to be writable so shadow it with - a contiguous buffer if it is not. The view will point to - the shadow buffer which can be written to and then - will be copied back into the other buffer when the memory - view is de-allocated. While the shadow buffer is - being used, it will have an exclusive write lock on - the original buffer. - */ - -PyObject * -PyMemoryView_GetContiguous(PyObject *obj, int buffertype, char fort) -{ - PyMemoryViewObject *mem; - PyObject *bytes; - Py_buffer *view; - int flags; - char *dest; - - if (!PyObject_CheckBuffer(obj)) { - PyErr_SetString(PyExc_TypeError, - "object does not have the buffer interface"); - return NULL; - } - - mem = PyObject_GC_New(PyMemoryViewObject, &PyMemoryView_Type); - if (mem == NULL) - return NULL; - - view = &mem->view; - flags = PyBUF_FULL_RO; - switch(buffertype) { - case PyBUF_WRITE: - flags = PyBUF_FULL; - break; - } - - if (PyObject_GetBuffer(obj, view, flags) != 0) { - Py_DECREF(mem); - return NULL; - } - - if (PyBuffer_IsContiguous(view, fort)) { - /* no copy needed */ - Py_INCREF(obj); - mem->base = obj; - _PyObject_GC_TRACK(mem); - return (PyObject *)mem; - } - /* otherwise a copy is needed */ - if (buffertype == PyBUF_WRITE) { - Py_DECREF(mem); - PyErr_SetString(PyExc_BufferError, - "writable contiguous buffer requested " - "for a non-contiguousobject."); - return NULL; - } - bytes = PyBytes_FromStringAndSize(NULL, view->len); - if (bytes == NULL) { - Py_DECREF(mem); - return NULL; - } - dest = PyBytes_AS_STRING(bytes); - /* different copying strategy depending on whether - or not any pointer de-referencing is needed - */ - /* strided or in-direct copy */ - if (view->suboffsets==NULL) { - _strided_copy_nd(dest, view->buf, view->ndim, view->shape, - view->strides, view->itemsize, fort); - } - else { - if (_indirect_copy_nd(dest, view, fort) < 0) { - Py_DECREF(bytes); - Py_DECREF(mem); - return NULL; - } - } - if (buffertype == PyBUF_SHADOW) { - /* return a shadowed memory-view object */ - view->buf = dest; - mem->base = PyTuple_Pack(2, obj, bytes); - Py_DECREF(bytes); - if (mem->base == NULL) { - Py_DECREF(mem); - return NULL; - } - } - else { - PyBuffer_Release(view); /* XXX ? */ - /* steal the reference */ - mem->base = bytes; - } - _PyObject_GC_TRACK(mem); - return (PyObject *)mem; -} - - -static PyObject * -memory_format_get(PyMemoryViewObject *self) -{ - return PyString_FromString(self->view.format); -} - -static PyObject * -memory_itemsize_get(PyMemoryViewObject *self) -{ - return PyLong_FromSsize_t(self->view.itemsize); -} - -static PyObject * -_IntTupleFromSsizet(int len, Py_ssize_t *vals) -{ - int i; - PyObject *o; - PyObject *intTuple; - - if (vals == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - intTuple = PyTuple_New(len); - if (!intTuple) return NULL; - for(i=0; iview.ndim, self->view.shape); -} - -static PyObject * -memory_strides_get(PyMemoryViewObject *self) -{ - return _IntTupleFromSsizet(self->view.ndim, self->view.strides); -} - -static PyObject * -memory_suboffsets_get(PyMemoryViewObject *self) -{ - return _IntTupleFromSsizet(self->view.ndim, self->view.suboffsets); -} - -static PyObject * -memory_readonly_get(PyMemoryViewObject *self) -{ - return PyBool_FromLong(self->view.readonly); -} - -static PyObject * -memory_ndim_get(PyMemoryViewObject *self) -{ - return PyLong_FromLong(self->view.ndim); -} - -static PyGetSetDef memory_getsetlist[] ={ - {"format", (getter)memory_format_get, NULL, NULL}, - {"itemsize", (getter)memory_itemsize_get, NULL, NULL}, - {"shape", (getter)memory_shape_get, NULL, NULL}, - {"strides", (getter)memory_strides_get, NULL, NULL}, - {"suboffsets", (getter)memory_suboffsets_get, NULL, NULL}, - {"readonly", (getter)memory_readonly_get, NULL, NULL}, - {"ndim", (getter)memory_ndim_get, NULL, NULL}, - {NULL, NULL, NULL, NULL}, -}; - - -static PyObject * -memory_tobytes(PyMemoryViewObject *self, PyObject *noargs) -{ - Py_buffer view; - PyObject *res; - - if (PyObject_GetBuffer((PyObject *)self, &view, PyBUF_SIMPLE) < 0) - return NULL; - - res = PyBytes_FromStringAndSize(NULL, view.len); - PyBuffer_ToContiguous(PyBytes_AS_STRING(res), &view, view.len, 'C'); - PyBuffer_Release(&view); - return res; -} - -/* TODO: rewrite this function using the struct module to unpack - each buffer item */ - -static PyObject * -memory_tolist(PyMemoryViewObject *mem, PyObject *noargs) -{ - Py_buffer *view = &(mem->view); - Py_ssize_t i; - PyObject *res, *item; - char *buf; - - if (strcmp(view->format, "B") || view->itemsize != 1) { - PyErr_SetString(PyExc_NotImplementedError, - "tolist() only supports byte views"); - return NULL; - } - if (view->ndim != 1) { - PyErr_SetString(PyExc_NotImplementedError, - "tolist() only supports one-dimensional objects"); - return NULL; - } - res = PyList_New(view->len); - if (res == NULL) - return NULL; - buf = view->buf; - for (i = 0; i < view->len; i++) { - item = PyInt_FromLong((unsigned char) *buf); - if (item == NULL) { - Py_DECREF(res); - return NULL; - } - PyList_SET_ITEM(res, i, item); - buf++; - } - return res; -} - -static PyMethodDef memory_methods[] = { - {"tobytes", (PyCFunction)memory_tobytes, METH_NOARGS, NULL}, - {"tolist", (PyCFunction)memory_tolist, METH_NOARGS, NULL}, - {NULL, NULL} /* sentinel */ -}; - - -static void -memory_dealloc(PyMemoryViewObject *self) -{ - _PyObject_GC_UNTRACK(self); - if (self->view.obj != NULL) { - if (self->base && PyTuple_Check(self->base)) { - /* Special case when first element is generic object - with buffer interface and the second element is a - contiguous "shadow" that must be copied back into - the data areay of the first tuple element before - releasing the buffer on the first element. - */ - - PyObject_CopyData(PyTuple_GET_ITEM(self->base,0), - PyTuple_GET_ITEM(self->base,1)); - - /* The view member should have readonly == -1 in - this instance indicating that the memory can - be "locked" and was locked and will be unlocked - again after this call. - */ - PyBuffer_Release(&(self->view)); - } - else { - PyBuffer_Release(&(self->view)); - } - Py_CLEAR(self->base); - } - PyObject_GC_Del(self); -} - -static PyObject * -memory_repr(PyMemoryViewObject *self) -{ - return PyString_FromFormat("", self); -} - -/* Sequence methods */ -static Py_ssize_t -memory_length(PyMemoryViewObject *self) -{ - return get_shape0(&self->view); -} - -/* Alternate version of memory_subcript that only accepts indices. - Used by PySeqIter_New(). -*/ -static PyObject * -memory_item(PyMemoryViewObject *self, Py_ssize_t result) -{ - Py_buffer *view = &(self->view); - - if (view->ndim == 0) { - PyErr_SetString(PyExc_IndexError, - "invalid indexing of 0-dim memory"); - return NULL; - } - if (view->ndim == 1) { - /* Return a bytes object */ - char *ptr; - ptr = (char *)view->buf; - if (result < 0) { - result += get_shape0(view); - } - if ((result < 0) || (result >= get_shape0(view))) { - PyErr_SetString(PyExc_IndexError, - "index out of bounds"); - return NULL; - } - if (view->strides == NULL) - ptr += view->itemsize * result; - else - ptr += view->strides[0] * result; - if (view->suboffsets != NULL && - view->suboffsets[0] >= 0) { - ptr = *((char **)ptr) + view->suboffsets[0]; - } - return PyBytes_FromStringAndSize(ptr, view->itemsize); - } else { - /* Return a new memory-view object */ - Py_buffer newview; - memset(&newview, 0, sizeof(newview)); - /* XXX: This needs to be fixed so it actually returns a sub-view */ - return PyMemoryView_FromBuffer(&newview); - } -} - -/* - mem[obj] returns a bytes object holding the data for one element if - obj fully indexes the memory view or another memory-view object - if it does not. - - 0-d memory-view objects can be referenced using ... or () but - not with anything else. - */ -static PyObject * -memory_subscript(PyMemoryViewObject *self, PyObject *key) -{ - Py_buffer *view; - view = &(self->view); - - if (view->ndim == 0) { - if (key == Py_Ellipsis || - (PyTuple_Check(key) && PyTuple_GET_SIZE(key)==0)) { - Py_INCREF(self); - return (PyObject *)self; - } - else { - PyErr_SetString(PyExc_IndexError, - "invalid indexing of 0-dim memory"); - return NULL; - } - } - if (PyIndex_Check(key)) { - Py_ssize_t result; - result = PyNumber_AsSsize_t(key, NULL); - if (result == -1 && PyErr_Occurred()) - return NULL; - return memory_item(self, result); - } - else if (PySlice_Check(key)) { - Py_ssize_t start, stop, step, slicelength; - - if (PySlice_GetIndicesEx((PySliceObject*)key, get_shape0(view), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (step == 1 && view->ndim == 1) { - Py_buffer newview; - void *newbuf = (char *) view->buf - + start * view->itemsize; - int newflags = view->readonly - ? PyBUF_CONTIG_RO : PyBUF_CONTIG; - - /* XXX There should be an API to create a subbuffer */ - if (view->obj != NULL) { - if (PyObject_GetBuffer(view->obj, &newview, newflags) == -1) - return NULL; - } - else { - newview = *view; - } - newview.buf = newbuf; - newview.len = slicelength * newview.itemsize; - newview.format = view->format; - newview.shape = &(newview.smalltable[0]); - newview.shape[0] = slicelength; - newview.strides = &(newview.itemsize); - return PyMemoryView_FromBuffer(&newview); - } - PyErr_SetNone(PyExc_NotImplementedError); - return NULL; - } - PyErr_Format(PyExc_TypeError, - "cannot index memory using \"%.200s\"", - key->ob_type->tp_name); - return NULL; -} - - -/* Need to support assigning memory if we can */ -static int -memory_ass_sub(PyMemoryViewObject *self, PyObject *key, PyObject *value) -{ - Py_ssize_t start, len, bytelen; - Py_buffer srcview; - Py_buffer *view = &(self->view); - char *srcbuf, *destbuf; - - if (view->readonly) { - PyErr_SetString(PyExc_TypeError, - "cannot modify read-only memory"); - return -1; - } - if (value == NULL) { - PyErr_SetString(PyExc_TypeError, - "cannot delete memory"); - return -1; - } - if (view->ndim != 1) { - PyErr_SetNone(PyExc_NotImplementedError); - return -1; - } - if (PyIndex_Check(key)) { - start = PyNumber_AsSsize_t(key, NULL); - if (start == -1 && PyErr_Occurred()) - return -1; - if (start < 0) { - start += get_shape0(view); - } - if ((start < 0) || (start >= get_shape0(view))) { - PyErr_SetString(PyExc_IndexError, - "index out of bounds"); - return -1; - } - len = 1; - } - else if (PySlice_Check(key)) { - Py_ssize_t stop, step; - - if (PySlice_GetIndicesEx((PySliceObject*)key, get_shape0(view), - &start, &stop, &step, &len) < 0) { - return -1; - } - if (step != 1) { - PyErr_SetNone(PyExc_NotImplementedError); - return -1; - } - } - else { - PyErr_Format(PyExc_TypeError, - "cannot index memory using \"%.200s\"", - key->ob_type->tp_name); - return -1; - } - if (PyObject_GetBuffer(value, &srcview, PyBUF_CONTIG_RO) == -1) { - return -1; - } - /* XXX should we allow assignment of different item sizes - as long as the byte length is the same? - (e.g. assign 2 shorts to a 4-byte slice) */ - if (srcview.itemsize != view->itemsize) { - PyErr_Format(PyExc_TypeError, - "mismatching item sizes for \"%.200s\" and \"%.200s\"", - view->obj->ob_type->tp_name, srcview.obj->ob_type->tp_name); - goto _error; - } - bytelen = len * view->itemsize; - if (bytelen != srcview.len) { - PyErr_SetString(PyExc_ValueError, - "cannot modify size of memoryview object"); - goto _error; - } - /* Do the actual copy */ - destbuf = (char *) view->buf + start * view->itemsize; - srcbuf = (char *) srcview.buf; - if (destbuf + bytelen < srcbuf || srcbuf + bytelen < destbuf) - /* No overlapping */ - memcpy(destbuf, srcbuf, bytelen); - else - memmove(destbuf, srcbuf, bytelen); - - PyBuffer_Release(&srcview); - return 0; - -_error: - PyBuffer_Release(&srcview); - return -1; -} - -static PyObject * -memory_richcompare(PyObject *v, PyObject *w, int op) -{ - Py_buffer vv, ww; - int equal = 0; - PyObject *res; - - vv.obj = NULL; - ww.obj = NULL; - if (op != Py_EQ && op != Py_NE) - goto _notimpl; - if (PyObject_GetBuffer(v, &vv, PyBUF_CONTIG_RO) == -1) { - PyErr_Clear(); - goto _notimpl; - } - if (PyObject_GetBuffer(w, &ww, PyBUF_CONTIG_RO) == -1) { - PyErr_Clear(); - goto _notimpl; - } - - if (vv.itemsize != ww.itemsize || vv.len != ww.len) - goto _end; - - equal = !memcmp(vv.buf, ww.buf, vv.len); - -_end: - PyBuffer_Release(&vv); - PyBuffer_Release(&ww); - if ((equal && op == Py_EQ) || (!equal && op == Py_NE)) - res = Py_True; - else - res = Py_False; - Py_INCREF(res); - return res; - -_notimpl: - PyBuffer_Release(&vv); - PyBuffer_Release(&ww); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - - -static int -memory_traverse(PyMemoryViewObject *self, visitproc visit, void *arg) -{ - if (self->base != NULL) - Py_VISIT(self->base); - if (self->view.obj != NULL) - Py_VISIT(self->view.obj); - return 0; -} - -static int -memory_clear(PyMemoryViewObject *self) -{ - Py_CLEAR(self->base); - PyBuffer_Release(&self->view); - return 0; -} - - -/* As mapping */ -static PyMappingMethods memory_as_mapping = { - (lenfunc)memory_length, /* mp_length */ - (binaryfunc)memory_subscript, /* mp_subscript */ - (objobjargproc)memory_ass_sub, /* mp_ass_subscript */ -}; - -static PySequenceMethods memory_as_sequence = { - 0, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - (ssizeargfunc)memory_item, /* sq_item */ -}; - -/* Buffer methods */ -static PyBufferProcs memory_as_buffer = { - 0, /* bf_getreadbuffer */ - 0, /* bf_getwritebuffer */ - 0, /* bf_getsegcount */ - 0, /* bf_getcharbuffer */ - (getbufferproc)memory_getbuf, /* bf_getbuffer */ - (releasebufferproc)memory_releasebuf, /* bf_releasebuffer */ -}; - - -PyTypeObject PyMemoryView_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "memoryview", - sizeof(PyMemoryViewObject), - 0, - (destructor)memory_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)memory_repr, /* tp_repr */ - 0, /* tp_as_number */ - &memory_as_sequence, /* tp_as_sequence */ - &memory_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &memory_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - memory_doc, /* tp_doc */ - (traverseproc)memory_traverse, /* tp_traverse */ - (inquiry)memory_clear, /* tp_clear */ - memory_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - memory_methods, /* tp_methods */ - 0, /* tp_members */ - memory_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - memory_new, /* tp_new */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/methodobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/methodobject.c deleted file mode 100644 index 5fe69a09..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/methodobject.c +++ /dev/null @@ -1,427 +0,0 @@ - -/* Method object implementation */ - -#include "Python.h" -#include "structmember.h" - -/* Free list for method objects to safe malloc/free overhead - * The m_self element is used to chain the objects. - */ -static PyCFunctionObject *free_list = NULL; -static int numfree = 0; -#ifndef PyCFunction_MAXFREELIST -#define PyCFunction_MAXFREELIST 256 -#endif - -PyObject * -PyCFunction_NewEx(PyMethodDef *ml, PyObject *self, PyObject *module) -{ - PyCFunctionObject *op; - op = free_list; - if (op != NULL) { - free_list = (PyCFunctionObject *)(op->m_self); - PyObject_INIT(op, &PyCFunction_Type); - numfree--; - } - else { - op = PyObject_GC_New(PyCFunctionObject, &PyCFunction_Type); - if (op == NULL) - return NULL; - } - op->m_ml = ml; - Py_XINCREF(self); - op->m_self = self; - Py_XINCREF(module); - op->m_module = module; - _PyObject_GC_TRACK(op); - return (PyObject *)op; -} - -PyCFunction -PyCFunction_GetFunction(PyObject *op) -{ - if (!PyCFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyCFunctionObject *)op) -> m_ml -> ml_meth; -} - -PyObject * -PyCFunction_GetSelf(PyObject *op) -{ - if (!PyCFunction_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return ((PyCFunctionObject *)op) -> m_self; -} - -int -PyCFunction_GetFlags(PyObject *op) -{ - if (!PyCFunction_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - return ((PyCFunctionObject *)op) -> m_ml -> ml_flags; -} - -PyObject * -PyCFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) -{ - PyCFunctionObject* f = (PyCFunctionObject*)func; - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - Py_ssize_t size; - - switch (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)) { - case METH_VARARGS: - if (kw == NULL || PyDict_Size(kw) == 0) - return (*meth)(self, arg); - break; - case METH_VARARGS | METH_KEYWORDS: - case METH_OLDARGS | METH_KEYWORDS: - return (*(PyCFunctionWithKeywords)meth)(self, arg, kw); - case METH_NOARGS: - if (kw == NULL || PyDict_Size(kw) == 0) { - size = PyTuple_GET_SIZE(arg); - if (size == 0) - return (*meth)(self, NULL); - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%zd given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_O: - if (kw == NULL || PyDict_Size(kw) == 0) { - size = PyTuple_GET_SIZE(arg); - if (size == 1) - return (*meth)(self, PyTuple_GET_ITEM(arg, 0)); - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%zd given)", - f->m_ml->ml_name, size); - return NULL; - } - break; - case METH_OLDARGS: - /* the really old style */ - if (kw == NULL || PyDict_Size(kw) == 0) { - size = PyTuple_GET_SIZE(arg); - if (size == 1) - arg = PyTuple_GET_ITEM(arg, 0); - else if (size == 0) - arg = NULL; - return (*meth)(self, arg); - } - break; - default: - PyErr_BadInternalCall(); - return NULL; - } - PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments", - f->m_ml->ml_name); - return NULL; -} - -/* Methods (the standard built-in methods, that is) */ - -static void -meth_dealloc(PyCFunctionObject *m) -{ - _PyObject_GC_UNTRACK(m); - Py_XDECREF(m->m_self); - Py_XDECREF(m->m_module); - if (numfree < PyCFunction_MAXFREELIST) { - m->m_self = (PyObject *)free_list; - free_list = m; - numfree++; - } - else { - PyObject_GC_Del(m); - } -} - -static PyObject * -meth_get__doc__(PyCFunctionObject *m, void *closure) -{ - const char *doc = m->m_ml->ml_doc; - - if (doc != NULL) - return PyString_FromString(doc); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -meth_get__name__(PyCFunctionObject *m, void *closure) -{ - return PyString_FromString(m->m_ml->ml_name); -} - -static int -meth_traverse(PyCFunctionObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->m_self); - Py_VISIT(m->m_module); - return 0; -} - -static PyObject * -meth_get__self__(PyCFunctionObject *m, void *closure) -{ - PyObject *self; - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "method.__self__ not accessible in restricted mode"); - return NULL; - } - self = m->m_self; - if (self == NULL) - self = Py_None; - Py_INCREF(self); - return self; -} - -static PyGetSetDef meth_getsets [] = { - {"__doc__", (getter)meth_get__doc__, NULL, NULL}, - {"__name__", (getter)meth_get__name__, NULL, NULL}, - {"__self__", (getter)meth_get__self__, NULL, NULL}, - {0} -}; - -#define OFF(x) offsetof(PyCFunctionObject, x) - -static PyMemberDef meth_members[] = { - {"__module__", T_OBJECT, OFF(m_module), PY_WRITE_RESTRICTED}, - {NULL} -}; - -static PyObject * -meth_repr(PyCFunctionObject *m) -{ - if (m->m_self == NULL) - return PyString_FromFormat("", - m->m_ml->ml_name); - return PyString_FromFormat("", - m->m_ml->ml_name, - m->m_self->ob_type->tp_name, - m->m_self); -} - -static int -meth_compare(PyCFunctionObject *a, PyCFunctionObject *b) -{ - if (a->m_self != b->m_self) - return (a->m_self < b->m_self) ? -1 : 1; - if (a->m_ml->ml_meth == b->m_ml->ml_meth) - return 0; - if (strcmp(a->m_ml->ml_name, b->m_ml->ml_name) < 0) - return -1; - else - return 1; -} - -static PyObject * -meth_richcompare(PyObject *self, PyObject *other, int op) -{ - PyCFunctionObject *a, *b; - PyObject *res; - int eq; - - if (op != Py_EQ && op != Py_NE) { - /* Py3K warning if comparison isn't == or !=. */ - if (PyErr_WarnPy3k("builtin_function_or_method order " - "comparisons not supported in 3.x", 1) < 0) { - return NULL; - } - - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - else if (!PyCFunction_Check(self) || !PyCFunction_Check(other)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - a = (PyCFunctionObject *)self; - b = (PyCFunctionObject *)other; - eq = a->m_self == b->m_self; - if (eq) - eq = a->m_ml->ml_meth == b->m_ml->ml_meth; - if (op == Py_EQ) - res = eq ? Py_True : Py_False; - else - res = eq ? Py_False : Py_True; - Py_INCREF(res); - return res; -} - -static long -meth_hash(PyCFunctionObject *a) -{ - long x,y; - if (a->m_self == NULL) - x = 0; - else { - x = PyObject_Hash(a->m_self); - if (x == -1) - return -1; - } - y = _Py_HashPointer((void*)(a->m_ml->ml_meth)); - if (y == -1) - return -1; - x ^= y; - if (x == -1) - x = -2; - return x; -} - - -PyTypeObject PyCFunction_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "builtin_function_or_method", - sizeof(PyCFunctionObject), - 0, - (destructor)meth_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)meth_compare, /* tp_compare */ - (reprfunc)meth_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)meth_hash, /* tp_hash */ - PyCFunction_Call, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)meth_traverse, /* tp_traverse */ - 0, /* tp_clear */ - meth_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - meth_members, /* tp_members */ - meth_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ -}; - -/* List all methods in a chain -- helper for findmethodinchain */ - -static PyObject * -listmethodchain(PyMethodChain *chain) -{ - PyMethodChain *c; - PyMethodDef *ml; - int i, n; - PyObject *v; - - n = 0; - for (c = chain; c != NULL; c = c->link) { - for (ml = c->methods; ml->ml_name != NULL; ml++) - n++; - } - v = PyList_New(n); - if (v == NULL) - return NULL; - i = 0; - for (c = chain; c != NULL; c = c->link) { - for (ml = c->methods; ml->ml_name != NULL; ml++) { - PyList_SetItem(v, i, PyString_FromString(ml->ml_name)); - i++; - } - } - if (PyErr_Occurred()) { - Py_DECREF(v); - return NULL; - } - PyList_Sort(v); - return v; -} - -/* Find a method in a method chain */ - -PyObject * -Py_FindMethodInChain(PyMethodChain *chain, PyObject *self, const char *name) -{ - if (name[0] == '_' && name[1] == '_') { - if (strcmp(name, "__methods__") == 0) { - if (PyErr_WarnPy3k("__methods__ not supported in 3.x", - 1) < 0) - return NULL; - return listmethodchain(chain); - } - if (strcmp(name, "__doc__") == 0) { - const char *doc = self->ob_type->tp_doc; - if (doc != NULL) - return PyString_FromString(doc); - } - } - while (chain != NULL) { - PyMethodDef *ml = chain->methods; - for (; ml->ml_name != NULL; ml++) { - if (name[0] == ml->ml_name[0] && - strcmp(name+1, ml->ml_name+1) == 0) - /* XXX */ - return PyCFunction_New(ml, self); - } - chain = chain->link; - } - PyErr_SetString(PyExc_AttributeError, name); - return NULL; -} - -/* Find a method in a single method list */ - -PyObject * -Py_FindMethod(PyMethodDef *methods, PyObject *self, const char *name) -{ - PyMethodChain chain; - chain.methods = methods; - chain.link = NULL; - return Py_FindMethodInChain(&chain, self, name); -} - -/* Clear out the free list */ - -int -PyCFunction_ClearFreeList(void) -{ - int freelist_size = numfree; - - while (free_list) { - PyCFunctionObject *v = free_list; - free_list = (PyCFunctionObject *)(v->m_self); - PyObject_GC_Del(v); - numfree--; - } - assert(numfree == 0); - return freelist_size; -} - -void -PyCFunction_Fini(void) -{ - (void)PyCFunction_ClearFreeList(); -} - -/* PyCFunction_New() is now just a macro that calls PyCFunction_NewEx(), - but it's part of the API so we need to keep a function around that - existing C extensions can call. -*/ - -#undef PyCFunction_New -PyAPI_FUNC(PyObject *) PyCFunction_New(PyMethodDef *, PyObject *); - -PyObject * -PyCFunction_New(PyMethodDef *ml, PyObject *self) -{ - return PyCFunction_NewEx(ml, self, NULL); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/moduleobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/moduleobject.c deleted file mode 100644 index 8aa788d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/moduleobject.c +++ /dev/null @@ -1,262 +0,0 @@ - -/* Module object implementation */ - -#include "Python.h" -#include "structmember.h" - -typedef struct { - PyObject_HEAD - PyObject *md_dict; -} PyModuleObject; - -static PyMemberDef module_members[] = { - {"__dict__", T_OBJECT, offsetof(PyModuleObject, md_dict), READONLY}, - {0} -}; - -PyObject * -PyModule_New(const char *name) -{ - PyModuleObject *m; - PyObject *nameobj; - m = PyObject_GC_New(PyModuleObject, &PyModule_Type); - if (m == NULL) - return NULL; - nameobj = PyString_FromString(name); - m->md_dict = PyDict_New(); - if (m->md_dict == NULL || nameobj == NULL) - goto fail; - if (PyDict_SetItemString(m->md_dict, "__name__", nameobj) != 0) - goto fail; - if (PyDict_SetItemString(m->md_dict, "__doc__", Py_None) != 0) - goto fail; - if (PyDict_SetItemString(m->md_dict, "__package__", Py_None) != 0) - goto fail; - Py_DECREF(nameobj); - PyObject_GC_Track(m); - return (PyObject *)m; - - fail: - Py_XDECREF(nameobj); - Py_DECREF(m); - return NULL; -} - -PyObject * -PyModule_GetDict(PyObject *m) -{ - PyObject *d; - if (!PyModule_Check(m)) { - PyErr_BadInternalCall(); - return NULL; - } - d = ((PyModuleObject *)m) -> md_dict; - if (d == NULL) - ((PyModuleObject *)m) -> md_dict = d = PyDict_New(); - return d; -} - -char * -PyModule_GetName(PyObject *m) -{ - PyObject *d; - PyObject *nameobj; - if (!PyModule_Check(m)) { - PyErr_BadArgument(); - return NULL; - } - d = ((PyModuleObject *)m)->md_dict; - if (d == NULL || - (nameobj = PyDict_GetItemString(d, "__name__")) == NULL || - !PyString_Check(nameobj)) - { - PyErr_SetString(PyExc_SystemError, "nameless module"); - return NULL; - } - return PyString_AsString(nameobj); -} - -char * -PyModule_GetFilename(PyObject *m) -{ - PyObject *d; - PyObject *fileobj; - if (!PyModule_Check(m)) { - PyErr_BadArgument(); - return NULL; - } - d = ((PyModuleObject *)m)->md_dict; - if (d == NULL || - (fileobj = PyDict_GetItemString(d, "__file__")) == NULL || - !PyString_Check(fileobj)) - { - PyErr_SetString(PyExc_SystemError, "module filename missing"); - return NULL; - } - return PyString_AsString(fileobj); -} - -void -_PyModule_Clear(PyObject *m) -{ - /* To make the execution order of destructors for global - objects a bit more predictable, we first zap all objects - whose name starts with a single underscore, before we clear - the entire dictionary. We zap them by replacing them with - None, rather than deleting them from the dictionary, to - avoid rehashing the dictionary (to some extent). */ - - Py_ssize_t pos; - PyObject *key, *value; - PyObject *d; - - d = ((PyModuleObject *)m)->md_dict; - if (d == NULL) - return; - - /* First, clear only names starting with a single underscore */ - pos = 0; - while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); - if (s[0] == '_' && s[1] != '_') { - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# clear[1] %s\n", s); - if (PyDict_SetItem(d, key, Py_None) != 0) - PyErr_Clear(); - } - } - } - - /* Next, clear all names except for __builtins__ */ - pos = 0; - while (PyDict_Next(d, &pos, &key, &value)) { - if (value != Py_None && PyString_Check(key)) { - char *s = PyString_AsString(key); - if (s[0] != '_' || strcmp(s, "__builtins__") != 0) { - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# clear[2] %s\n", s); - if (PyDict_SetItem(d, key, Py_None) != 0) - PyErr_Clear(); - } - } - } - - /* Note: we leave __builtins__ in place, so that destructors - of non-global objects defined in this module can still use - builtins, in particularly 'None'. */ - -} - -/* Methods */ - -static int -module_init(PyModuleObject *m, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"name", "doc", NULL}; - PyObject *dict, *name = Py_None, *doc = Py_None; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "S|O:module.__init__", - kwlist, &name, &doc)) - return -1; - dict = m->md_dict; - if (dict == NULL) { - dict = PyDict_New(); - if (dict == NULL) - return -1; - m->md_dict = dict; - } - if (PyDict_SetItemString(dict, "__name__", name) < 0) - return -1; - if (PyDict_SetItemString(dict, "__doc__", doc) < 0) - return -1; - return 0; -} - -static void -module_dealloc(PyModuleObject *m) -{ - PyObject_GC_UnTrack(m); - if (m->md_dict != NULL) { - _PyModule_Clear((PyObject *)m); - Py_DECREF(m->md_dict); - } - Py_TYPE(m)->tp_free((PyObject *)m); -} - -static PyObject * -module_repr(PyModuleObject *m) -{ - char *name; - char *filename; - - name = PyModule_GetName((PyObject *)m); - if (name == NULL) { - PyErr_Clear(); - name = "?"; - } - filename = PyModule_GetFilename((PyObject *)m); - if (filename == NULL) { - PyErr_Clear(); - return PyString_FromFormat("", name); - } - return PyString_FromFormat("", name, filename); -} - -/* We only need a traverse function, no clear function: If the module - is in a cycle, md_dict will be cleared as well, which will break - the cycle. */ -static int -module_traverse(PyModuleObject *m, visitproc visit, void *arg) -{ - Py_VISIT(m->md_dict); - return 0; -} - -PyDoc_STRVAR(module_doc, -"module(name[, doc])\n\ -\n\ -Create a module object.\n\ -The name must be a string; the optional doc argument can have any type."); - -PyTypeObject PyModule_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "module", /* tp_name */ - sizeof(PyModuleObject), /* tp_size */ - 0, /* tp_itemsize */ - (destructor)module_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)module_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - module_doc, /* tp_doc */ - (traverseproc)module_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - module_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(PyModuleObject, md_dict), /* tp_dictoffset */ - (initproc)module_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/object.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/object.c deleted file mode 100644 index bbc2a2e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/object.c +++ /dev/null @@ -1,2513 +0,0 @@ - -/* Generic object operations; and implementation of None (NoObject) */ - -#include "Python.h" -#include "frameobject.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef Py_REF_DEBUG -Py_ssize_t _Py_RefTotal; - -Py_ssize_t -_Py_GetRefTotal(void) -{ - PyObject *o; - Py_ssize_t total = _Py_RefTotal; - /* ignore the references to the dummy object of the dicts and sets - because they are not reliable and not useful (now that the - hash table code is well-tested) */ - o = _PyDict_Dummy(); - if (o != NULL) - total -= o->ob_refcnt; - o = _PySet_Dummy(); - if (o != NULL) - total -= o->ob_refcnt; - return total; -} -#endif /* Py_REF_DEBUG */ - -int Py_DivisionWarningFlag; -int Py_Py3kWarningFlag; - -/* Object allocation routines used by NEWOBJ and NEWVAROBJ macros. - These are used by the individual routines for object creation. - Do not call them otherwise, they do not initialize the object! */ - -#ifdef Py_TRACE_REFS -/* Head of circular doubly-linked list of all objects. These are linked - * together via the _ob_prev and _ob_next members of a PyObject, which - * exist only in a Py_TRACE_REFS build. - */ -static PyObject refchain = {&refchain, &refchain}; - -/* Insert op at the front of the list of all objects. If force is true, - * op is added even if _ob_prev and _ob_next are non-NULL already. If - * force is false amd _ob_prev or _ob_next are non-NULL, do nothing. - * force should be true if and only if op points to freshly allocated, - * uninitialized memory, or you've unlinked op from the list and are - * relinking it into the front. - * Note that objects are normally added to the list via _Py_NewReference, - * which is called by PyObject_Init. Not all objects are initialized that - * way, though; exceptions include statically allocated type objects, and - * statically allocated singletons (like Py_True and Py_None). - */ -void -_Py_AddToAllObjects(PyObject *op, int force) -{ -#ifdef Py_DEBUG - if (!force) { - /* If it's initialized memory, op must be in or out of - * the list unambiguously. - */ - assert((op->_ob_prev == NULL) == (op->_ob_next == NULL)); - } -#endif - if (force || op->_ob_prev == NULL) { - op->_ob_next = refchain._ob_next; - op->_ob_prev = &refchain; - refchain._ob_next->_ob_prev = op; - refchain._ob_next = op; - } -} -#endif /* Py_TRACE_REFS */ - -#ifdef COUNT_ALLOCS -static PyTypeObject *type_list; -/* All types are added to type_list, at least when - they get one object created. That makes them - immortal, which unfortunately contributes to - garbage itself. If unlist_types_without_objects - is set, they will be removed from the type_list - once the last object is deallocated. */ -static int unlist_types_without_objects; -extern Py_ssize_t tuple_zero_allocs, fast_tuple_allocs; -extern Py_ssize_t quick_int_allocs, quick_neg_int_allocs; -extern Py_ssize_t null_strings, one_strings; -void -dump_counts(FILE* f) -{ - PyTypeObject *tp; - - for (tp = type_list; tp; tp = tp->tp_next) - fprintf(f, "%s alloc'd: %" PY_FORMAT_SIZE_T "d, " - "freed: %" PY_FORMAT_SIZE_T "d, " - "max in use: %" PY_FORMAT_SIZE_T "d\n", - tp->tp_name, tp->tp_allocs, tp->tp_frees, - tp->tp_maxalloc); - fprintf(f, "fast tuple allocs: %" PY_FORMAT_SIZE_T "d, " - "empty: %" PY_FORMAT_SIZE_T "d\n", - fast_tuple_allocs, tuple_zero_allocs); - fprintf(f, "fast int allocs: pos: %" PY_FORMAT_SIZE_T "d, " - "neg: %" PY_FORMAT_SIZE_T "d\n", - quick_int_allocs, quick_neg_int_allocs); - fprintf(f, "null strings: %" PY_FORMAT_SIZE_T "d, " - "1-strings: %" PY_FORMAT_SIZE_T "d\n", - null_strings, one_strings); -} - -PyObject * -get_counts(void) -{ - PyTypeObject *tp; - PyObject *result; - PyObject *v; - - result = PyList_New(0); - if (result == NULL) - return NULL; - for (tp = type_list; tp; tp = tp->tp_next) { - v = Py_BuildValue("(snnn)", tp->tp_name, tp->tp_allocs, - tp->tp_frees, tp->tp_maxalloc); - if (v == NULL) { - Py_DECREF(result); - return NULL; - } - if (PyList_Append(result, v) < 0) { - Py_DECREF(v); - Py_DECREF(result); - return NULL; - } - Py_DECREF(v); - } - return result; -} - -void -inc_count(PyTypeObject *tp) -{ - if (tp->tp_next == NULL && tp->tp_prev == NULL) { - /* first time; insert in linked list */ - if (tp->tp_next != NULL) /* sanity check */ - Py_FatalError("XXX inc_count sanity check"); - if (type_list) - type_list->tp_prev = tp; - tp->tp_next = type_list; - /* Note that as of Python 2.2, heap-allocated type objects - * can go away, but this code requires that they stay alive - * until program exit. That's why we're careful with - * refcounts here. type_list gets a new reference to tp, - * while ownership of the reference type_list used to hold - * (if any) was transferred to tp->tp_next in the line above. - * tp is thus effectively immortal after this. - */ - Py_INCREF(tp); - type_list = tp; -#ifdef Py_TRACE_REFS - /* Also insert in the doubly-linked list of all objects, - * if not already there. - */ - _Py_AddToAllObjects((PyObject *)tp, 0); -#endif - } - tp->tp_allocs++; - if (tp->tp_allocs - tp->tp_frees > tp->tp_maxalloc) - tp->tp_maxalloc = tp->tp_allocs - tp->tp_frees; -} - -void dec_count(PyTypeObject *tp) -{ - tp->tp_frees++; - if (unlist_types_without_objects && - tp->tp_allocs == tp->tp_frees) { - /* unlink the type from type_list */ - if (tp->tp_prev) - tp->tp_prev->tp_next = tp->tp_next; - else - type_list = tp->tp_next; - if (tp->tp_next) - tp->tp_next->tp_prev = tp->tp_prev; - tp->tp_next = tp->tp_prev = NULL; - Py_DECREF(tp); - } -} - -#endif - -#ifdef Py_REF_DEBUG -/* Log a fatal error; doesn't return. */ -void -_Py_NegativeRefcount(const char *fname, int lineno, PyObject *op) -{ - char buf[300]; - - PyOS_snprintf(buf, sizeof(buf), - "%s:%i object at %p has negative ref count " - "%" PY_FORMAT_SIZE_T "d", - fname, lineno, op, op->ob_refcnt); - Py_FatalError(buf); -} - -#endif /* Py_REF_DEBUG */ - -void -Py_IncRef(PyObject *o) -{ - Py_XINCREF(o); -} - -void -Py_DecRef(PyObject *o) -{ - Py_XDECREF(o); -} - -PyObject * -PyObject_Init(PyObject *op, PyTypeObject *tp) -{ - if (op == NULL) - return PyErr_NoMemory(); - /* Any changes should be reflected in PyObject_INIT (objimpl.h) */ - Py_TYPE(op) = tp; - _Py_NewReference(op); - return op; -} - -PyVarObject * -PyObject_InitVar(PyVarObject *op, PyTypeObject *tp, Py_ssize_t size) -{ - if (op == NULL) - return (PyVarObject *) PyErr_NoMemory(); - /* Any changes should be reflected in PyObject_INIT_VAR */ - op->ob_size = size; - Py_TYPE(op) = tp; - _Py_NewReference((PyObject *)op); - return op; -} - -PyObject * -_PyObject_New(PyTypeObject *tp) -{ - PyObject *op; - op = (PyObject *) PyObject_MALLOC(_PyObject_SIZE(tp)); - if (op == NULL) - return PyErr_NoMemory(); - return PyObject_INIT(op, tp); -} - -PyVarObject * -_PyObject_NewVar(PyTypeObject *tp, Py_ssize_t nitems) -{ - PyVarObject *op; - const size_t size = _PyObject_VAR_SIZE(tp, nitems); - op = (PyVarObject *) PyObject_MALLOC(size); - if (op == NULL) - return (PyVarObject *)PyErr_NoMemory(); - return PyObject_INIT_VAR(op, tp, nitems); -} - -/* for binary compatibility with 2.2 */ -#undef _PyObject_Del -void -_PyObject_Del(PyObject *op) -{ - PyObject_FREE(op); -} - -/* Implementation of PyObject_Print with recursion checking */ -static int -internal_print(PyObject *op, FILE *fp, int flags, int nesting) -{ - int ret = 0; - if (nesting > 10) { - PyErr_SetString(PyExc_RuntimeError, "print recursion"); - return -1; - } - if (PyErr_CheckSignals()) - return -1; -#ifdef USE_STACKCHECK - if (PyOS_CheckStack()) { - PyErr_SetString(PyExc_MemoryError, "stack overflow"); - return -1; - } -#endif - clearerr(fp); /* Clear any previous error condition */ - if (op == NULL) { - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ""); - Py_END_ALLOW_THREADS - } - else { - if (op->ob_refcnt <= 0) - /* XXX(twouters) cast refcount to long until %zd is - universally available */ - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "", - (long)op->ob_refcnt, op); - Py_END_ALLOW_THREADS - else if (Py_TYPE(op)->tp_print == NULL) { - PyObject *s; - if (flags & Py_PRINT_RAW) - s = PyObject_Str(op); - else - s = PyObject_Repr(op); - if (s == NULL) - ret = -1; - else { - ret = internal_print(s, fp, Py_PRINT_RAW, - nesting+1); - } - Py_XDECREF(s); - } - else - ret = (*Py_TYPE(op)->tp_print)(op, fp, flags); - } - if (ret == 0) { - if (ferror(fp)) { - PyErr_SetFromErrno(PyExc_IOError); - clearerr(fp); - ret = -1; - } - } - return ret; -} - -int -PyObject_Print(PyObject *op, FILE *fp, int flags) -{ - return internal_print(op, fp, flags, 0); -} - - -/* For debugging convenience. See Misc/gdbinit for some useful gdb hooks */ -void _PyObject_Dump(PyObject* op) -{ - if (op == NULL) - fprintf(stderr, "NULL\n"); - else { -#ifdef WITH_THREAD - PyGILState_STATE gil; -#endif - fprintf(stderr, "object : "); -#ifdef WITH_THREAD - gil = PyGILState_Ensure(); -#endif - (void)PyObject_Print(op, stderr, 0); -#ifdef WITH_THREAD - PyGILState_Release(gil); -#endif - /* XXX(twouters) cast refcount to long until %zd is - universally available */ - fprintf(stderr, "\n" - "type : %s\n" - "refcount: %ld\n" - "address : %p\n", - Py_TYPE(op)==NULL ? "NULL" : Py_TYPE(op)->tp_name, - (long)op->ob_refcnt, - op); - } -} - -PyObject * -PyObject_Repr(PyObject *v) -{ - if (PyErr_CheckSignals()) - return NULL; -#ifdef USE_STACKCHECK - if (PyOS_CheckStack()) { - PyErr_SetString(PyExc_MemoryError, "stack overflow"); - return NULL; - } -#endif - if (v == NULL) - return PyString_FromString(""); - else if (Py_TYPE(v)->tp_repr == NULL) - return PyString_FromFormat("<%s object at %p>", - Py_TYPE(v)->tp_name, v); - else { - PyObject *res; - res = (*Py_TYPE(v)->tp_repr)(v); - if (res == NULL) - return NULL; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(res)) { - PyObject* str; - str = PyUnicode_AsEncodedString(res, NULL, NULL); - Py_DECREF(res); - if (str) - res = str; - else - return NULL; - } -#endif - if (!PyString_Check(res)) { - PyErr_Format(PyExc_TypeError, - "__repr__ returned non-string (type %.200s)", - Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - return res; - } -} - -PyObject * -_PyObject_Str(PyObject *v) -{ - PyObject *res; - int type_ok; - if (v == NULL) - return PyString_FromString(""); - if (PyString_CheckExact(v)) { - Py_INCREF(v); - return v; - } -#ifdef Py_USING_UNICODE - if (PyUnicode_CheckExact(v)) { - Py_INCREF(v); - return v; - } -#endif - if (Py_TYPE(v)->tp_str == NULL) - return PyObject_Repr(v); - - /* It is possible for a type to have a tp_str representation that loops - infinitely. */ - if (Py_EnterRecursiveCall(" while getting the str of an object")) - return NULL; - res = (*Py_TYPE(v)->tp_str)(v); - Py_LeaveRecursiveCall(); - if (res == NULL) - return NULL; - type_ok = PyString_Check(res); -#ifdef Py_USING_UNICODE - type_ok = type_ok || PyUnicode_Check(res); -#endif - if (!type_ok) { - PyErr_Format(PyExc_TypeError, - "__str__ returned non-string (type %.200s)", - Py_TYPE(res)->tp_name); - Py_DECREF(res); - return NULL; - } - return res; -} - -PyObject * -PyObject_Str(PyObject *v) -{ - PyObject *res = _PyObject_Str(v); - if (res == NULL) - return NULL; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(res)) { - PyObject* str; - str = PyUnicode_AsEncodedString(res, NULL, NULL); - Py_DECREF(res); - if (str) - res = str; - else - return NULL; - } -#endif - assert(PyString_Check(res)); - return res; -} - -#ifdef Py_USING_UNICODE -PyObject * -PyObject_Unicode(PyObject *v) -{ - PyObject *res; - PyObject *func; - PyObject *str; - int unicode_method_found = 0; - static PyObject *unicodestr = NULL; - - if (v == NULL) { - res = PyString_FromString(""); - if (res == NULL) - return NULL; - str = PyUnicode_FromEncodedObject(res, NULL, "strict"); - Py_DECREF(res); - return str; - } else if (PyUnicode_CheckExact(v)) { - Py_INCREF(v); - return v; - } - - if (PyInstance_Check(v)) { - /* We're an instance of a classic class */ - /* Try __unicode__ from the instance -- alas we have no type */ - if (!unicodestr) { - unicodestr = PyString_InternFromString("__unicode__"); - if (!unicodestr) - return NULL; - } - func = PyObject_GetAttr(v, unicodestr); - if (func != NULL) { - unicode_method_found = 1; - res = PyObject_CallFunctionObjArgs(func, NULL); - Py_DECREF(func); - } - else { - PyErr_Clear(); - } - } - else { - /* Not a classic class instance, try __unicode__. */ - func = _PyObject_LookupSpecial(v, "__unicode__", &unicodestr); - if (func != NULL) { - unicode_method_found = 1; - res = PyObject_CallFunctionObjArgs(func, NULL); - Py_DECREF(func); - } - else if (PyErr_Occurred()) - return NULL; - } - - /* Didn't find __unicode__ */ - if (!unicode_method_found) { - if (PyUnicode_Check(v)) { - /* For a Unicode subtype that's didn't overwrite __unicode__, - return a true Unicode object with the same data. */ - return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(v), - PyUnicode_GET_SIZE(v)); - } - if (PyString_CheckExact(v)) { - Py_INCREF(v); - res = v; - } - else { - if (Py_TYPE(v)->tp_str != NULL) - res = (*Py_TYPE(v)->tp_str)(v); - else - res = PyObject_Repr(v); - } - } - - if (res == NULL) - return NULL; - if (!PyUnicode_Check(res)) { - str = PyUnicode_FromEncodedObject(res, NULL, "strict"); - Py_DECREF(res); - res = str; - } - return res; -} -#endif - - -/* Helper to warn about deprecated tp_compare return values. Return: - -2 for an exception; - -1 if v < w; - 0 if v == w; - 1 if v > w. - (This function cannot return 2.) -*/ -static int -adjust_tp_compare(int c) -{ - if (PyErr_Occurred()) { - if (c != -1 && c != -2) { - PyObject *t, *v, *tb; - PyErr_Fetch(&t, &v, &tb); - if (PyErr_Warn(PyExc_RuntimeWarning, - "tp_compare didn't return -1 or -2 " - "for exception") < 0) { - Py_XDECREF(t); - Py_XDECREF(v); - Py_XDECREF(tb); - } - else - PyErr_Restore(t, v, tb); - } - return -2; - } - else if (c < -1 || c > 1) { - if (PyErr_Warn(PyExc_RuntimeWarning, - "tp_compare didn't return -1, 0 or 1") < 0) - return -2; - else - return c < -1 ? -1 : 1; - } - else { - assert(c >= -1 && c <= 1); - return c; - } -} - - -/* Macro to get the tp_richcompare field of a type if defined */ -#define RICHCOMPARE(t) (PyType_HasFeature((t), Py_TPFLAGS_HAVE_RICHCOMPARE) \ - ? (t)->tp_richcompare : NULL) - -/* Map rich comparison operators to their swapped version, e.g. LT --> GT */ -int _Py_SwappedOp[] = {Py_GT, Py_GE, Py_EQ, Py_NE, Py_LT, Py_LE}; - -/* Try a genuine rich comparison, returning an object. Return: - NULL for exception; - NotImplemented if this particular rich comparison is not implemented or - undefined; - some object not equal to NotImplemented if it is implemented - (this latter object may not be a Boolean). -*/ -static PyObject * -try_rich_compare(PyObject *v, PyObject *w, int op) -{ - richcmpfunc f; - PyObject *res; - - if (v->ob_type != w->ob_type && - PyType_IsSubtype(w->ob_type, v->ob_type) && - (f = RICHCOMPARE(w->ob_type)) != NULL) { - res = (*f)(w, v, _Py_SwappedOp[op]); - if (res != Py_NotImplemented) - return res; - Py_DECREF(res); - } - if ((f = RICHCOMPARE(v->ob_type)) != NULL) { - res = (*f)(v, w, op); - if (res != Py_NotImplemented) - return res; - Py_DECREF(res); - } - if ((f = RICHCOMPARE(w->ob_type)) != NULL) { - return (*f)(w, v, _Py_SwappedOp[op]); - } - res = Py_NotImplemented; - Py_INCREF(res); - return res; -} - -/* Try a genuine rich comparison, returning an int. Return: - -1 for exception (including the case where try_rich_compare() returns an - object that's not a Boolean); - 0 if the outcome is false; - 1 if the outcome is true; - 2 if this particular rich comparison is not implemented or undefined. -*/ -static int -try_rich_compare_bool(PyObject *v, PyObject *w, int op) -{ - PyObject *res; - int ok; - - if (RICHCOMPARE(v->ob_type) == NULL && RICHCOMPARE(w->ob_type) == NULL) - return 2; /* Shortcut, avoid INCREF+DECREF */ - res = try_rich_compare(v, w, op); - if (res == NULL) - return -1; - if (res == Py_NotImplemented) { - Py_DECREF(res); - return 2; - } - ok = PyObject_IsTrue(res); - Py_DECREF(res); - return ok; -} - -/* Try rich comparisons to determine a 3-way comparison. Return: - -2 for an exception; - -1 if v < w; - 0 if v == w; - 1 if v > w; - 2 if this particular rich comparison is not implemented or undefined. -*/ -static int -try_rich_to_3way_compare(PyObject *v, PyObject *w) -{ - static struct { int op; int outcome; } tries[3] = { - /* Try this operator, and if it is true, use this outcome: */ - {Py_EQ, 0}, - {Py_LT, -1}, - {Py_GT, 1}, - }; - int i; - - if (RICHCOMPARE(v->ob_type) == NULL && RICHCOMPARE(w->ob_type) == NULL) - return 2; /* Shortcut */ - - for (i = 0; i < 3; i++) { - switch (try_rich_compare_bool(v, w, tries[i].op)) { - case -1: - return -2; - case 1: - return tries[i].outcome; - } - } - - return 2; -} - -/* Try a 3-way comparison, returning an int. Return: - -2 for an exception; - -1 if v < w; - 0 if v == w; - 1 if v > w; - 2 if this particular 3-way comparison is not implemented or undefined. -*/ -static int -try_3way_compare(PyObject *v, PyObject *w) -{ - int c; - cmpfunc f; - - /* Comparisons involving instances are given to instance_compare, - which has the same return conventions as this function. */ - - f = v->ob_type->tp_compare; - if (PyInstance_Check(v)) - return (*f)(v, w); - if (PyInstance_Check(w)) - return (*w->ob_type->tp_compare)(v, w); - - /* If both have the same (non-NULL) tp_compare, use it. */ - if (f != NULL && f == w->ob_type->tp_compare) { - c = (*f)(v, w); - return adjust_tp_compare(c); - } - - /* If either tp_compare is _PyObject_SlotCompare, that's safe. */ - if (f == _PyObject_SlotCompare || - w->ob_type->tp_compare == _PyObject_SlotCompare) - return _PyObject_SlotCompare(v, w); - - /* If we're here, v and w, - a) are not instances; - b) have different types or a type without tp_compare; and - c) don't have a user-defined tp_compare. - tp_compare implementations in C assume that both arguments - have their type, so we give up if the coercion fails or if - it yields types which are still incompatible (which can - happen with a user-defined nb_coerce). - */ - c = PyNumber_CoerceEx(&v, &w); - if (c < 0) - return -2; - if (c > 0) - return 2; - f = v->ob_type->tp_compare; - if (f != NULL && f == w->ob_type->tp_compare) { - c = (*f)(v, w); - Py_DECREF(v); - Py_DECREF(w); - return adjust_tp_compare(c); - } - - /* No comparison defined */ - Py_DECREF(v); - Py_DECREF(w); - return 2; -} - -/* Final fallback 3-way comparison, returning an int. Return: - -2 if an error occurred; - -1 if v < w; - 0 if v == w; - 1 if v > w. -*/ -static int -default_3way_compare(PyObject *v, PyObject *w) -{ - int c; - const char *vname, *wname; - - if (v->ob_type == w->ob_type) { - /* When comparing these pointers, they must be cast to - * integer types (i.e. Py_uintptr_t, our spelling of C9X's - * uintptr_t). ANSI specifies that pointer compares other - * than == and != to non-related structures are undefined. - */ - Py_uintptr_t vv = (Py_uintptr_t)v; - Py_uintptr_t ww = (Py_uintptr_t)w; - return (vv < ww) ? -1 : (vv > ww) ? 1 : 0; - } - - /* None is smaller than anything */ - if (v == Py_None) - return -1; - if (w == Py_None) - return 1; - - /* different type: compare type names; numbers are smaller */ - if (PyNumber_Check(v)) - vname = ""; - else - vname = v->ob_type->tp_name; - if (PyNumber_Check(w)) - wname = ""; - else - wname = w->ob_type->tp_name; - c = strcmp(vname, wname); - if (c < 0) - return -1; - if (c > 0) - return 1; - /* Same type name, or (more likely) incomparable numeric types */ - return ((Py_uintptr_t)(v->ob_type) < ( - Py_uintptr_t)(w->ob_type)) ? -1 : 1; -} - -/* Do a 3-way comparison, by hook or by crook. Return: - -2 for an exception (but see below); - -1 if v < w; - 0 if v == w; - 1 if v > w; - BUT: if the object implements a tp_compare function, it returns - whatever this function returns (whether with an exception or not). -*/ -static int -do_cmp(PyObject *v, PyObject *w) -{ - int c; - cmpfunc f; - - if (v->ob_type == w->ob_type - && (f = v->ob_type->tp_compare) != NULL) { - c = (*f)(v, w); - if (PyInstance_Check(v)) { - /* Instance tp_compare has a different signature. - But if it returns undefined we fall through. */ - if (c != 2) - return c; - /* Else fall through to try_rich_to_3way_compare() */ - } - else - return adjust_tp_compare(c); - } - /* We only get here if one of the following is true: - a) v and w have different types - b) v and w have the same type, which doesn't have tp_compare - c) v and w are instances, and either __cmp__ is not defined or - __cmp__ returns NotImplemented - */ - c = try_rich_to_3way_compare(v, w); - if (c < 2) - return c; - c = try_3way_compare(v, w); - if (c < 2) - return c; - return default_3way_compare(v, w); -} - -/* Compare v to w. Return - -1 if v < w or exception (PyErr_Occurred() true in latter case). - 0 if v == w. - 1 if v > w. - XXX The docs (C API manual) say the return value is undefined in case - XXX of error. -*/ -int -PyObject_Compare(PyObject *v, PyObject *w) -{ - int result; - - if (v == NULL || w == NULL) { - PyErr_BadInternalCall(); - return -1; - } - if (v == w) - return 0; - if (Py_EnterRecursiveCall(" in cmp")) - return -1; - result = do_cmp(v, w); - Py_LeaveRecursiveCall(); - return result < 0 ? -1 : result; -} - -/* Return (new reference to) Py_True or Py_False. */ -static PyObject * -convert_3way_to_object(int op, int c) -{ - PyObject *result; - switch (op) { - case Py_LT: c = c < 0; break; - case Py_LE: c = c <= 0; break; - case Py_EQ: c = c == 0; break; - case Py_NE: c = c != 0; break; - case Py_GT: c = c > 0; break; - case Py_GE: c = c >= 0; break; - } - result = c ? Py_True : Py_False; - Py_INCREF(result); - return result; -} - -/* We want a rich comparison but don't have one. Try a 3-way cmp instead. - Return - NULL if error - Py_True if v op w - Py_False if not (v op w) -*/ -static PyObject * -try_3way_to_rich_compare(PyObject *v, PyObject *w, int op) -{ - int c; - - c = try_3way_compare(v, w); - if (c >= 2) { - - /* Py3K warning if types are not equal and comparison isn't == or != */ - if (Py_Py3kWarningFlag && - v->ob_type != w->ob_type && op != Py_EQ && op != Py_NE && - PyErr_WarnEx(PyExc_DeprecationWarning, - "comparing unequal types not supported " - "in 3.x", 1) < 0) { - return NULL; - } - - c = default_3way_compare(v, w); - } - if (c <= -2) - return NULL; - return convert_3way_to_object(op, c); -} - -/* Do rich comparison on v and w. Return - NULL if error - Else a new reference to an object other than Py_NotImplemented, usually(?): - Py_True if v op w - Py_False if not (v op w) -*/ -static PyObject * -do_richcmp(PyObject *v, PyObject *w, int op) -{ - PyObject *res; - - res = try_rich_compare(v, w, op); - if (res != Py_NotImplemented) - return res; - Py_DECREF(res); - - return try_3way_to_rich_compare(v, w, op); -} - -/* Return: - NULL for exception; - some object not equal to NotImplemented if it is implemented - (this latter object may not be a Boolean). -*/ -PyObject * -PyObject_RichCompare(PyObject *v, PyObject *w, int op) -{ - PyObject *res; - - assert(Py_LT <= op && op <= Py_GE); - if (Py_EnterRecursiveCall(" in cmp")) - return NULL; - - /* If the types are equal, and not old-style instances, try to - get out cheap (don't bother with coercions etc.). */ - if (v->ob_type == w->ob_type && !PyInstance_Check(v)) { - cmpfunc fcmp; - richcmpfunc frich = RICHCOMPARE(v->ob_type); - /* If the type has richcmp, try it first. try_rich_compare - tries it two-sided, which is not needed since we've a - single type only. */ - if (frich != NULL) { - res = (*frich)(v, w, op); - if (res != Py_NotImplemented) - goto Done; - Py_DECREF(res); - } - /* No richcmp, or this particular richmp not implemented. - Try 3-way cmp. */ - fcmp = v->ob_type->tp_compare; - if (fcmp != NULL) { - int c = (*fcmp)(v, w); - c = adjust_tp_compare(c); - if (c == -2) { - res = NULL; - goto Done; - } - res = convert_3way_to_object(op, c); - goto Done; - } - } - - /* Fast path not taken, or couldn't deliver a useful result. */ - res = do_richcmp(v, w, op); -Done: - Py_LeaveRecursiveCall(); - return res; -} - -/* Return -1 if error; 1 if v op w; 0 if not (v op w). */ -int -PyObject_RichCompareBool(PyObject *v, PyObject *w, int op) -{ - PyObject *res; - int ok; - - /* Quick result when objects are the same. - Guarantees that identity implies equality. */ - if (v == w) { - if (op == Py_EQ) - return 1; - else if (op == Py_NE) - return 0; - } - - res = PyObject_RichCompare(v, w, op); - if (res == NULL) - return -1; - if (PyBool_Check(res)) - ok = (res == Py_True); - else - ok = PyObject_IsTrue(res); - Py_DECREF(res); - return ok; -} - -/* Set of hash utility functions to help maintaining the invariant that - if a==b then hash(a)==hash(b) - - All the utility functions (_Py_Hash*()) return "-1" to signify an error. -*/ - -long -_Py_HashDouble(double v) -{ - double intpart, fractpart; - int expo; - long hipart; - long x; /* the final hash value */ - /* This is designed so that Python numbers of different types - * that compare equal hash to the same value; otherwise comparisons - * of mapping keys will turn out weird. - */ - - if (!Py_IS_FINITE(v)) { - if (Py_IS_INFINITY(v)) - return v < 0 ? -271828 : 314159; - else - return 0; - } - fractpart = modf(v, &intpart); - if (fractpart == 0.0) { - /* This must return the same hash as an equal int or long. */ - if (intpart > LONG_MAX/2 || -intpart > LONG_MAX/2) { - /* Convert to long and use its hash. */ - PyObject *plong; /* converted to Python long */ - plong = PyLong_FromDouble(v); - if (plong == NULL) - return -1; - x = PyObject_Hash(plong); - Py_DECREF(plong); - return x; - } - /* Fits in a C long == a Python int, so is its own hash. */ - x = (long)intpart; - if (x == -1) - x = -2; - return x; - } - /* The fractional part is non-zero, so we don't have to worry about - * making this match the hash of some other type. - * Use frexp to get at the bits in the double. - * Since the VAX D double format has 56 mantissa bits, which is the - * most of any double format in use, each of these parts may have as - * many as (but no more than) 56 significant bits. - * So, assuming sizeof(long) >= 4, each part can be broken into two - * longs; frexp and multiplication are used to do that. - * Also, since the Cray double format has 15 exponent bits, which is - * the most of any double format in use, shifting the exponent field - * left by 15 won't overflow a long (again assuming sizeof(long) >= 4). - */ - v = frexp(v, &expo); - v *= 2147483648.0; /* 2**31 */ - hipart = (long)v; /* take the top 32 bits */ - v = (v - (double)hipart) * 2147483648.0; /* get the next 32 bits */ - x = hipart + (long)v + (expo << 15); - if (x == -1) - x = -2; - return x; -} - -long -_Py_HashPointer(void *p) -{ - long x; - size_t y = (size_t)p; - /* bottom 3 or 4 bits are likely to be 0; rotate y by 4 to avoid - excessive hash collisions for dicts and sets */ - y = (y >> 4) | (y << (8 * SIZEOF_VOID_P - 4)); - x = (long)y; - if (x == -1) - x = -2; - return x; -} - -long -PyObject_HashNotImplemented(PyObject *self) -{ - PyErr_Format(PyExc_TypeError, "unhashable type: '%.200s'", - self->ob_type->tp_name); - return -1; -} - -_Py_HashSecret_t _Py_HashSecret; - -long -PyObject_Hash(PyObject *v) -{ - PyTypeObject *tp = v->ob_type; - if (tp->tp_hash != NULL) - return (*tp->tp_hash)(v); - /* To keep to the general practice that inheriting - * solely from object in C code should work without - * an explicit call to PyType_Ready, we implicitly call - * PyType_Ready here and then check the tp_hash slot again - */ - if (tp->tp_dict == NULL) { - if (PyType_Ready(tp) < 0) - return -1; - if (tp->tp_hash != NULL) - return (*tp->tp_hash)(v); - } - if (tp->tp_compare == NULL && RICHCOMPARE(tp) == NULL) { - return _Py_HashPointer(v); /* Use address as hash value */ - } - /* If there's a cmp but no hash defined, the object can't be hashed */ - return PyObject_HashNotImplemented(v); -} - -PyObject * -PyObject_GetAttrString(PyObject *v, const char *name) -{ - PyObject *w, *res; - - if (Py_TYPE(v)->tp_getattr != NULL) - return (*Py_TYPE(v)->tp_getattr)(v, (char*)name); - w = PyString_InternFromString(name); - if (w == NULL) - return NULL; - res = PyObject_GetAttr(v, w); - Py_XDECREF(w); - return res; -} - -int -PyObject_HasAttrString(PyObject *v, const char *name) -{ - PyObject *res = PyObject_GetAttrString(v, name); - if (res != NULL) { - Py_DECREF(res); - return 1; - } - PyErr_Clear(); - return 0; -} - -int -PyObject_SetAttrString(PyObject *v, const char *name, PyObject *w) -{ - PyObject *s; - int res; - - if (Py_TYPE(v)->tp_setattr != NULL) - return (*Py_TYPE(v)->tp_setattr)(v, (char*)name, w); - s = PyString_InternFromString(name); - if (s == NULL) - return -1; - res = PyObject_SetAttr(v, s, w); - Py_XDECREF(s); - return res; -} - -PyObject * -PyObject_GetAttr(PyObject *v, PyObject *name) -{ - PyTypeObject *tp = Py_TYPE(v); - - if (!PyString_Check(name)) { -#ifdef Py_USING_UNICODE - /* The Unicode to string conversion is done here because the - existing tp_getattro slots expect a string object as name - and we wouldn't want to break those. */ - if (PyUnicode_Check(name)) { - name = _PyUnicode_AsDefaultEncodedString(name, NULL); - if (name == NULL) - return NULL; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "attribute name must be string, not '%.200s'", - Py_TYPE(name)->tp_name); - return NULL; - } - } - if (tp->tp_getattro != NULL) - return (*tp->tp_getattro)(v, name); - if (tp->tp_getattr != NULL) - return (*tp->tp_getattr)(v, PyString_AS_STRING(name)); - PyErr_Format(PyExc_AttributeError, - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); - return NULL; -} - -int -PyObject_HasAttr(PyObject *v, PyObject *name) -{ - PyObject *res = PyObject_GetAttr(v, name); - if (res != NULL) { - Py_DECREF(res); - return 1; - } - PyErr_Clear(); - return 0; -} - -int -PyObject_SetAttr(PyObject *v, PyObject *name, PyObject *value) -{ - PyTypeObject *tp = Py_TYPE(v); - int err; - - if (!PyString_Check(name)){ -#ifdef Py_USING_UNICODE - /* The Unicode to string conversion is done here because the - existing tp_setattro slots expect a string object as name - and we wouldn't want to break those. */ - if (PyUnicode_Check(name)) { - name = PyUnicode_AsEncodedString(name, NULL, NULL); - if (name == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "attribute name must be string, not '%.200s'", - Py_TYPE(name)->tp_name); - return -1; - } - } - else - Py_INCREF(name); - - PyString_InternInPlace(&name); - if (tp->tp_setattro != NULL) { - err = (*tp->tp_setattro)(v, name, value); - Py_DECREF(name); - return err; - } - if (tp->tp_setattr != NULL) { - err = (*tp->tp_setattr)(v, PyString_AS_STRING(name), value); - Py_DECREF(name); - return err; - } - Py_DECREF(name); - if (tp->tp_getattr == NULL && tp->tp_getattro == NULL) - PyErr_Format(PyExc_TypeError, - "'%.100s' object has no attributes " - "(%s .%.100s)", - tp->tp_name, - value==NULL ? "del" : "assign to", - PyString_AS_STRING(name)); - else - PyErr_Format(PyExc_TypeError, - "'%.100s' object has only read-only attributes " - "(%s .%.100s)", - tp->tp_name, - value==NULL ? "del" : "assign to", - PyString_AS_STRING(name)); - return -1; -} - -/* Helper to get a pointer to an object's __dict__ slot, if any */ - -PyObject ** -_PyObject_GetDictPtr(PyObject *obj) -{ - Py_ssize_t dictoffset; - PyTypeObject *tp = Py_TYPE(obj); - - if (!(tp->tp_flags & Py_TPFLAGS_HAVE_CLASS)) - return NULL; - dictoffset = tp->tp_dictoffset; - if (dictoffset == 0) - return NULL; - if (dictoffset < 0) { - Py_ssize_t tsize; - size_t size; - - tsize = ((PyVarObject *)obj)->ob_size; - if (tsize < 0) - tsize = -tsize; - size = _PyObject_VAR_SIZE(tp, tsize); - - dictoffset += (long)size; - assert(dictoffset > 0); - assert(dictoffset % SIZEOF_VOID_P == 0); - } - return (PyObject **) ((char *)obj + dictoffset); -} - -PyObject * -PyObject_SelfIter(PyObject *obj) -{ - Py_INCREF(obj); - return obj; -} - -/* Helper used when the __next__ method is removed from a type: - tp_iternext is never NULL and can be safely called without checking - on every iteration. - */ - -PyObject * -_PyObject_NextNotImplemented(PyObject *self) -{ - PyErr_Format(PyExc_TypeError, - "'%.200s' object is not iterable", - Py_TYPE(self)->tp_name); - return NULL; -} - -/* Generic GetAttr functions - put these in your tp_[gs]etattro slot */ - -PyObject * -_PyObject_GenericGetAttrWithDict(PyObject *obj, PyObject *name, PyObject *dict) -{ - PyTypeObject *tp = Py_TYPE(obj); - PyObject *descr = NULL; - PyObject *res = NULL; - descrgetfunc f; - Py_ssize_t dictoffset; - PyObject **dictptr; - - if (!PyString_Check(name)){ -#ifdef Py_USING_UNICODE - /* The Unicode to string conversion is done here because the - existing tp_setattro slots expect a string object as name - and we wouldn't want to break those. */ - if (PyUnicode_Check(name)) { - name = PyUnicode_AsEncodedString(name, NULL, NULL); - if (name == NULL) - return NULL; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "attribute name must be string, not '%.200s'", - Py_TYPE(name)->tp_name); - return NULL; - } - } - else - Py_INCREF(name); - - if (tp->tp_dict == NULL) { - if (PyType_Ready(tp) < 0) - goto done; - } - -#if 0 /* XXX this is not quite _PyType_Lookup anymore */ - /* Inline _PyType_Lookup */ - { - Py_ssize_t i, n; - PyObject *mro, *base, *dict; - - /* Look in tp_dict of types in MRO */ - mro = tp->tp_mro; - assert(mro != NULL); - assert(PyTuple_Check(mro)); - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - base = PyTuple_GET_ITEM(mro, i); - if (PyClass_Check(base)) - dict = ((PyClassObject *)base)->cl_dict; - else { - assert(PyType_Check(base)); - dict = ((PyTypeObject *)base)->tp_dict; - } - assert(dict && PyDict_Check(dict)); - descr = PyDict_GetItem(dict, name); - if (descr != NULL) - break; - } - } -#else - descr = _PyType_Lookup(tp, name); -#endif - - Py_XINCREF(descr); - - f = NULL; - if (descr != NULL && - PyType_HasFeature(descr->ob_type, Py_TPFLAGS_HAVE_CLASS)) { - f = descr->ob_type->tp_descr_get; - if (f != NULL && PyDescr_IsData(descr)) { - res = f(descr, obj, (PyObject *)obj->ob_type); - Py_DECREF(descr); - goto done; - } - } - - if (dict == NULL) { - /* Inline _PyObject_GetDictPtr */ - dictoffset = tp->tp_dictoffset; - if (dictoffset != 0) { - if (dictoffset < 0) { - Py_ssize_t tsize; - size_t size; - - tsize = ((PyVarObject *)obj)->ob_size; - if (tsize < 0) - tsize = -tsize; - size = _PyObject_VAR_SIZE(tp, tsize); - - dictoffset += (long)size; - assert(dictoffset > 0); - assert(dictoffset % SIZEOF_VOID_P == 0); - } - dictptr = (PyObject **) ((char *)obj + dictoffset); - dict = *dictptr; - } - } - if (dict != NULL) { - Py_INCREF(dict); - res = PyDict_GetItem(dict, name); - if (res != NULL) { - Py_INCREF(res); - Py_XDECREF(descr); - Py_DECREF(dict); - goto done; - } - Py_DECREF(dict); - } - - if (f != NULL) { - res = f(descr, obj, (PyObject *)Py_TYPE(obj)); - Py_DECREF(descr); - goto done; - } - - if (descr != NULL) { - res = descr; - /* descr was already increfed above */ - goto done; - } - - PyErr_Format(PyExc_AttributeError, - "'%.50s' object has no attribute '%.400s'", - tp->tp_name, PyString_AS_STRING(name)); - done: - Py_DECREF(name); - return res; -} - -PyObject * -PyObject_GenericGetAttr(PyObject *obj, PyObject *name) -{ - return _PyObject_GenericGetAttrWithDict(obj, name, NULL); -} - -int -_PyObject_GenericSetAttrWithDict(PyObject *obj, PyObject *name, - PyObject *value, PyObject *dict) -{ - PyTypeObject *tp = Py_TYPE(obj); - PyObject *descr; - descrsetfunc f; - PyObject **dictptr; - int res = -1; - - if (!PyString_Check(name)){ -#ifdef Py_USING_UNICODE - /* The Unicode to string conversion is done here because the - existing tp_setattro slots expect a string object as name - and we wouldn't want to break those. */ - if (PyUnicode_Check(name)) { - name = PyUnicode_AsEncodedString(name, NULL, NULL); - if (name == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "attribute name must be string, not '%.200s'", - Py_TYPE(name)->tp_name); - return -1; - } - } - else - Py_INCREF(name); - - if (tp->tp_dict == NULL) { - if (PyType_Ready(tp) < 0) - goto done; - } - - descr = _PyType_Lookup(tp, name); - f = NULL; - if (descr != NULL && - PyType_HasFeature(descr->ob_type, Py_TPFLAGS_HAVE_CLASS)) { - f = descr->ob_type->tp_descr_set; - if (f != NULL && PyDescr_IsData(descr)) { - res = f(descr, obj, value); - goto done; - } - } - - if (dict == NULL) { - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr != NULL) { - dict = *dictptr; - if (dict == NULL && value != NULL) { - dict = PyDict_New(); - if (dict == NULL) - goto done; - *dictptr = dict; - } - } - } - if (dict != NULL) { - Py_INCREF(dict); - if (value == NULL) - res = PyDict_DelItem(dict, name); - else - res = PyDict_SetItem(dict, name, value); - if (res < 0 && PyErr_ExceptionMatches(PyExc_KeyError)) - PyErr_SetObject(PyExc_AttributeError, name); - Py_DECREF(dict); - goto done; - } - - if (f != NULL) { - res = f(descr, obj, value); - goto done; - } - - if (descr == NULL) { - PyErr_Format(PyExc_AttributeError, - "'%.100s' object has no attribute '%.200s'", - tp->tp_name, PyString_AS_STRING(name)); - goto done; - } - - PyErr_Format(PyExc_AttributeError, - "'%.50s' object attribute '%.400s' is read-only", - tp->tp_name, PyString_AS_STRING(name)); - done: - Py_DECREF(name); - return res; -} - -int -PyObject_GenericSetAttr(PyObject *obj, PyObject *name, PyObject *value) -{ - return _PyObject_GenericSetAttrWithDict(obj, name, value, NULL); -} - - -/* Test a value used as condition, e.g., in a for or if statement. - Return -1 if an error occurred */ - -int -PyObject_IsTrue(PyObject *v) -{ - Py_ssize_t res; - if (v == Py_True) - return 1; - if (v == Py_False) - return 0; - if (v == Py_None) - return 0; - else if (v->ob_type->tp_as_number != NULL && - v->ob_type->tp_as_number->nb_nonzero != NULL) - res = (*v->ob_type->tp_as_number->nb_nonzero)(v); - else if (v->ob_type->tp_as_mapping != NULL && - v->ob_type->tp_as_mapping->mp_length != NULL) - res = (*v->ob_type->tp_as_mapping->mp_length)(v); - else if (v->ob_type->tp_as_sequence != NULL && - v->ob_type->tp_as_sequence->sq_length != NULL) - res = (*v->ob_type->tp_as_sequence->sq_length)(v); - else - return 1; - /* if it is negative, it should be either -1 or -2 */ - return (res > 0) ? 1 : Py_SAFE_DOWNCAST(res, Py_ssize_t, int); -} - -/* equivalent of 'not v' - Return -1 if an error occurred */ - -int -PyObject_Not(PyObject *v) -{ - int res; - res = PyObject_IsTrue(v); - if (res < 0) - return res; - return res == 0; -} - -/* Coerce two numeric types to the "larger" one. - Increment the reference count on each argument. - Return value: - -1 if an error occurred; - 0 if the coercion succeeded (and then the reference counts are increased); - 1 if no coercion is possible (and no error is raised). -*/ -int -PyNumber_CoerceEx(PyObject **pv, PyObject **pw) -{ - register PyObject *v = *pv; - register PyObject *w = *pw; - int res; - - /* Shortcut only for old-style types */ - if (v->ob_type == w->ob_type && - !PyType_HasFeature(v->ob_type, Py_TPFLAGS_CHECKTYPES)) - { - Py_INCREF(v); - Py_INCREF(w); - return 0; - } - if (v->ob_type->tp_as_number && v->ob_type->tp_as_number->nb_coerce) { - res = (*v->ob_type->tp_as_number->nb_coerce)(pv, pw); - if (res <= 0) - return res; - } - if (w->ob_type->tp_as_number && w->ob_type->tp_as_number->nb_coerce) { - res = (*w->ob_type->tp_as_number->nb_coerce)(pw, pv); - if (res <= 0) - return res; - } - return 1; -} - -/* Coerce two numeric types to the "larger" one. - Increment the reference count on each argument. - Return -1 and raise an exception if no coercion is possible - (and then no reference count is incremented). -*/ -int -PyNumber_Coerce(PyObject **pv, PyObject **pw) -{ - int err = PyNumber_CoerceEx(pv, pw); - if (err <= 0) - return err; - PyErr_SetString(PyExc_TypeError, "number coercion failed"); - return -1; -} - - -/* Test whether an object can be called */ - -int -PyCallable_Check(PyObject *x) -{ - if (x == NULL) - return 0; - if (PyInstance_Check(x)) { - PyObject *call = PyObject_GetAttrString(x, "__call__"); - if (call == NULL) { - PyErr_Clear(); - return 0; - } - /* Could test recursively but don't, for fear of endless - recursion if some joker sets self.__call__ = self */ - Py_DECREF(call); - return 1; - } - else { - return x->ob_type->tp_call != NULL; - } -} - -/* ------------------------- PyObject_Dir() helpers ------------------------- */ - -/* Helper for PyObject_Dir. - Merge the __dict__ of aclass into dict, and recursively also all - the __dict__s of aclass's base classes. The order of merging isn't - defined, as it's expected that only the final set of dict keys is - interesting. - Return 0 on success, -1 on error. -*/ - -static int -merge_class_dict(PyObject* dict, PyObject* aclass) -{ - PyObject *classdict; - PyObject *bases; - - assert(PyDict_Check(dict)); - assert(aclass); - - /* Merge in the type's dict (if any). */ - classdict = PyObject_GetAttrString(aclass, "__dict__"); - if (classdict == NULL) - PyErr_Clear(); - else { - int status = PyDict_Update(dict, classdict); - Py_DECREF(classdict); - if (status < 0) - return -1; - } - - /* Recursively merge in the base types' (if any) dicts. */ - bases = PyObject_GetAttrString(aclass, "__bases__"); - if (bases == NULL) - PyErr_Clear(); - else { - /* We have no guarantee that bases is a real tuple */ - Py_ssize_t i, n; - n = PySequence_Size(bases); /* This better be right */ - if (n < 0) - PyErr_Clear(); - else { - for (i = 0; i < n; i++) { - int status; - PyObject *base = PySequence_GetItem(bases, i); - if (base == NULL) { - Py_DECREF(bases); - return -1; - } - status = merge_class_dict(dict, base); - Py_DECREF(base); - if (status < 0) { - Py_DECREF(bases); - return -1; - } - } - } - Py_DECREF(bases); - } - return 0; -} - -/* Helper for PyObject_Dir. - If obj has an attr named attrname that's a list, merge its string - elements into keys of dict. - Return 0 on success, -1 on error. Errors due to not finding the attr, - or the attr not being a list, are suppressed. -*/ - -static int -merge_list_attr(PyObject* dict, PyObject* obj, const char *attrname) -{ - PyObject *list; - int result = 0; - - assert(PyDict_Check(dict)); - assert(obj); - assert(attrname); - - list = PyObject_GetAttrString(obj, attrname); - if (list == NULL) - PyErr_Clear(); - - else if (PyList_Check(list)) { - int i; - for (i = 0; i < PyList_GET_SIZE(list); ++i) { - PyObject *item = PyList_GET_ITEM(list, i); - if (PyString_Check(item)) { - result = PyDict_SetItem(dict, item, Py_None); - if (result < 0) - break; - } - } - if (Py_Py3kWarningFlag && - (strcmp(attrname, "__members__") == 0 || - strcmp(attrname, "__methods__") == 0)) { - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "__members__ and __methods__ not " - "supported in 3.x", 1) < 0) { - Py_XDECREF(list); - return -1; - } - } - } - - Py_XDECREF(list); - return result; -} - -/* Helper for PyObject_Dir without arguments: returns the local scope. */ -static PyObject * -_dir_locals(void) -{ - PyObject *names; - PyObject *locals = PyEval_GetLocals(); - - if (locals == NULL) { - PyErr_SetString(PyExc_SystemError, "frame does not exist"); - return NULL; - } - - names = PyMapping_Keys(locals); - if (!names) - return NULL; - if (!PyList_Check(names)) { - PyErr_Format(PyExc_TypeError, - "dir(): expected keys() of locals to be a list, " - "not '%.200s'", Py_TYPE(names)->tp_name); - Py_DECREF(names); - return NULL; - } - /* the locals don't need to be DECREF'd */ - return names; -} - -/* Helper for PyObject_Dir of type objects: returns __dict__ and __bases__. - We deliberately don't suck up its __class__, as methods belonging to the - metaclass would probably be more confusing than helpful. -*/ -static PyObject * -_specialized_dir_type(PyObject *obj) -{ - PyObject *result = NULL; - PyObject *dict = PyDict_New(); - - if (dict != NULL && merge_class_dict(dict, obj) == 0) - result = PyDict_Keys(dict); - - Py_XDECREF(dict); - return result; -} - -/* Helper for PyObject_Dir of module objects: returns the module's __dict__. */ -static PyObject * -_specialized_dir_module(PyObject *obj) -{ - PyObject *result = NULL; - PyObject *dict = PyObject_GetAttrString(obj, "__dict__"); - - if (dict != NULL) { - if (PyDict_Check(dict)) - result = PyDict_Keys(dict); - else { - char *name = PyModule_GetName(obj); - if (name) - PyErr_Format(PyExc_TypeError, - "%.200s.__dict__ is not a dictionary", - name); - } - } - - Py_XDECREF(dict); - return result; -} - -/* Helper for PyObject_Dir of generic objects: returns __dict__, __class__, - and recursively up the __class__.__bases__ chain. -*/ -static PyObject * -_generic_dir(PyObject *obj) -{ - PyObject *result = NULL; - PyObject *dict = NULL; - PyObject *itsclass = NULL; - - /* Get __dict__ (which may or may not be a real dict...) */ - dict = PyObject_GetAttrString(obj, "__dict__"); - if (dict == NULL) { - PyErr_Clear(); - dict = PyDict_New(); - } - else if (!PyDict_Check(dict)) { - Py_DECREF(dict); - dict = PyDict_New(); - } - else { - /* Copy __dict__ to avoid mutating it. */ - PyObject *temp = PyDict_Copy(dict); - Py_DECREF(dict); - dict = temp; - } - - if (dict == NULL) - goto error; - - /* Merge in __members__ and __methods__ (if any). - * This is removed in Python 3000. */ - if (merge_list_attr(dict, obj, "__members__") < 0) - goto error; - if (merge_list_attr(dict, obj, "__methods__") < 0) - goto error; - - /* Merge in attrs reachable from its class. */ - itsclass = PyObject_GetAttrString(obj, "__class__"); - if (itsclass == NULL) - /* XXX(tomer): Perhaps fall back to obj->ob_type if no - __class__ exists? */ - PyErr_Clear(); - else { - if (merge_class_dict(dict, itsclass) != 0) - goto error; - } - - result = PyDict_Keys(dict); - /* fall through */ -error: - Py_XDECREF(itsclass); - Py_XDECREF(dict); - return result; -} - -/* Helper for PyObject_Dir: object introspection. - This calls one of the above specialized versions if no __dir__ method - exists. */ -static PyObject * -_dir_object(PyObject *obj) -{ - PyObject *result = NULL; - static PyObject *dir_str = NULL; - PyObject *dirfunc; - - assert(obj); - if (PyInstance_Check(obj)) { - dirfunc = PyObject_GetAttrString(obj, "__dir__"); - if (dirfunc == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - } - } - else { - dirfunc = _PyObject_LookupSpecial(obj, "__dir__", &dir_str); - if (PyErr_Occurred()) - return NULL; - } - if (dirfunc == NULL) { - /* use default implementation */ - if (PyModule_Check(obj)) - result = _specialized_dir_module(obj); - else if (PyType_Check(obj) || PyClass_Check(obj)) - result = _specialized_dir_type(obj); - else - result = _generic_dir(obj); - } - else { - /* use __dir__ */ - result = PyObject_CallFunctionObjArgs(dirfunc, NULL); - Py_DECREF(dirfunc); - if (result == NULL) - return NULL; - - /* result must be a list */ - /* XXX(gbrandl): could also check if all items are strings */ - if (!PyList_Check(result)) { - PyErr_Format(PyExc_TypeError, - "__dir__() must return a list, not %.200s", - Py_TYPE(result)->tp_name); - Py_DECREF(result); - result = NULL; - } - } - - return result; -} - -/* Implementation of dir() -- if obj is NULL, returns the names in the current - (local) scope. Otherwise, performs introspection of the object: returns a - sorted list of attribute names (supposedly) accessible from the object -*/ -PyObject * -PyObject_Dir(PyObject *obj) -{ - PyObject * result; - - if (obj == NULL) - /* no object -- introspect the locals */ - result = _dir_locals(); - else - /* object -- introspect the object */ - result = _dir_object(obj); - - assert(result == NULL || PyList_Check(result)); - - if (result != NULL && PyList_Sort(result) != 0) { - /* sorting the list failed */ - Py_DECREF(result); - result = NULL; - } - - return result; -} - -/* -NoObject is usable as a non-NULL undefined value, used by the macro None. -There is (and should be!) no way to create other objects of this type, -so there is exactly one (which is indestructible, by the way). -(XXX This type and the type of NotImplemented below should be unified.) -*/ - -/* ARGSUSED */ -static PyObject * -none_repr(PyObject *op) -{ - return PyString_FromString("None"); -} - -/* ARGUSED */ -static void -none_dealloc(PyObject* ignore) -{ - /* This should never get called, but we also don't want to SEGV if - * we accidentally decref None out of existence. - */ - Py_FatalError("deallocating None"); -} - - -static PyTypeObject PyNone_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "NoneType", - 0, - 0, - none_dealloc, /*tp_dealloc*/ /*never called*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - none_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)_Py_HashPointer, /*tp_hash */ -}; - -PyObject _Py_NoneStruct = { - _PyObject_EXTRA_INIT - 1, &PyNone_Type -}; - -/* NotImplemented is an object that can be used to signal that an - operation is not implemented for the given type combination. */ - -static PyObject * -NotImplemented_repr(PyObject *op) -{ - return PyString_FromString("NotImplemented"); -} - -static PyTypeObject PyNotImplemented_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "NotImplementedType", - 0, - 0, - none_dealloc, /*tp_dealloc*/ /*never called*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - NotImplemented_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ -}; - -PyObject _Py_NotImplementedStruct = { - _PyObject_EXTRA_INIT - 1, &PyNotImplemented_Type -}; - -void -_Py_ReadyTypes(void) -{ - if (PyType_Ready(&PyType_Type) < 0) - Py_FatalError("Can't initialize type type"); - - if (PyType_Ready(&_PyWeakref_RefType) < 0) - Py_FatalError("Can't initialize weakref type"); - - if (PyType_Ready(&_PyWeakref_CallableProxyType) < 0) - Py_FatalError("Can't initialize callable weakref proxy type"); - - if (PyType_Ready(&_PyWeakref_ProxyType) < 0) - Py_FatalError("Can't initialize weakref proxy type"); - - if (PyType_Ready(&PyBool_Type) < 0) - Py_FatalError("Can't initialize bool type"); - - if (PyType_Ready(&PyString_Type) < 0) - Py_FatalError("Can't initialize str type"); - - if (PyType_Ready(&PyByteArray_Type) < 0) - Py_FatalError("Can't initialize bytearray type"); - - if (PyType_Ready(&PyList_Type) < 0) - Py_FatalError("Can't initialize list type"); - - if (PyType_Ready(&PyNone_Type) < 0) - Py_FatalError("Can't initialize None type"); - - if (PyType_Ready(&PyNotImplemented_Type) < 0) - Py_FatalError("Can't initialize NotImplemented type"); - - if (PyType_Ready(&PyTraceBack_Type) < 0) - Py_FatalError("Can't initialize traceback type"); - - if (PyType_Ready(&PySuper_Type) < 0) - Py_FatalError("Can't initialize super type"); - - if (PyType_Ready(&PyBaseObject_Type) < 0) - Py_FatalError("Can't initialize object type"); - - if (PyType_Ready(&PyRange_Type) < 0) - Py_FatalError("Can't initialize xrange type"); - - if (PyType_Ready(&PyDict_Type) < 0) - Py_FatalError("Can't initialize dict type"); - - if (PyType_Ready(&PySet_Type) < 0) - Py_FatalError("Can't initialize set type"); - -#ifdef Py_USING_UNICODE - if (PyType_Ready(&PyUnicode_Type) < 0) - Py_FatalError("Can't initialize unicode type"); -#endif - - if (PyType_Ready(&PySlice_Type) < 0) - Py_FatalError("Can't initialize slice type"); - - if (PyType_Ready(&PyStaticMethod_Type) < 0) - Py_FatalError("Can't initialize static method type"); - -#ifndef WITHOUT_COMPLEX - if (PyType_Ready(&PyComplex_Type) < 0) - Py_FatalError("Can't initialize complex type"); -#endif - - if (PyType_Ready(&PyFloat_Type) < 0) - Py_FatalError("Can't initialize float type"); - - if (PyType_Ready(&PyBuffer_Type) < 0) - Py_FatalError("Can't initialize buffer type"); - - if (PyType_Ready(&PyLong_Type) < 0) - Py_FatalError("Can't initialize long type"); - - if (PyType_Ready(&PyInt_Type) < 0) - Py_FatalError("Can't initialize int type"); - - if (PyType_Ready(&PyFrozenSet_Type) < 0) - Py_FatalError("Can't initialize frozenset type"); - - if (PyType_Ready(&PyProperty_Type) < 0) - Py_FatalError("Can't initialize property type"); - - if (PyType_Ready(&PyMemoryView_Type) < 0) - Py_FatalError("Can't initialize memoryview type"); - - if (PyType_Ready(&PyTuple_Type) < 0) - Py_FatalError("Can't initialize tuple type"); - - if (PyType_Ready(&PyEnum_Type) < 0) - Py_FatalError("Can't initialize enumerate type"); - - if (PyType_Ready(&PyReversed_Type) < 0) - Py_FatalError("Can't initialize reversed type"); - - if (PyType_Ready(&PyCode_Type) < 0) - Py_FatalError("Can't initialize code type"); - - if (PyType_Ready(&PyFrame_Type) < 0) - Py_FatalError("Can't initialize frame type"); - - if (PyType_Ready(&PyCFunction_Type) < 0) - Py_FatalError("Can't initialize builtin function type"); - - if (PyType_Ready(&PyMethod_Type) < 0) - Py_FatalError("Can't initialize method type"); - - if (PyType_Ready(&PyFunction_Type) < 0) - Py_FatalError("Can't initialize function type"); - - if (PyType_Ready(&PyClass_Type) < 0) - Py_FatalError("Can't initialize class type"); - - if (PyType_Ready(&PyDictProxy_Type) < 0) - Py_FatalError("Can't initialize dict proxy type"); - - if (PyType_Ready(&PyGen_Type) < 0) - Py_FatalError("Can't initialize generator type"); - - if (PyType_Ready(&PyGetSetDescr_Type) < 0) - Py_FatalError("Can't initialize get-set descriptor type"); - - if (PyType_Ready(&PyWrapperDescr_Type) < 0) - Py_FatalError("Can't initialize wrapper type"); - - if (PyType_Ready(&PyInstance_Type) < 0) - Py_FatalError("Can't initialize instance type"); - - if (PyType_Ready(&PyEllipsis_Type) < 0) - Py_FatalError("Can't initialize ellipsis type"); - - if (PyType_Ready(&PyMemberDescr_Type) < 0) - Py_FatalError("Can't initialize member descriptor type"); - - if (PyType_Ready(&PyFile_Type) < 0) - Py_FatalError("Can't initialize file type"); - - if (PyType_Ready(&PyCapsule_Type) < 0) - Py_FatalError("Can't initialize capsule type"); - - if (PyType_Ready(&PyCell_Type) < 0) - Py_FatalError("Can't initialize cell type"); - - if (PyType_Ready(&PyCallIter_Type) < 0) - Py_FatalError("Can't initialize call iter type"); - - if (PyType_Ready(&PySeqIter_Type) < 0) - Py_FatalError("Can't initialize sequence iterator type"); -} - - -#ifdef Py_TRACE_REFS - -void -_Py_NewReference(PyObject *op) -{ - _Py_INC_REFTOTAL; - op->ob_refcnt = 1; - _Py_AddToAllObjects(op, 1); - _Py_INC_TPALLOCS(op); -} - -void -_Py_ForgetReference(register PyObject *op) -{ -#ifdef SLOW_UNREF_CHECK - register PyObject *p; -#endif - if (op->ob_refcnt < 0) - Py_FatalError("UNREF negative refcnt"); - if (op == &refchain || - op->_ob_prev->_ob_next != op || op->_ob_next->_ob_prev != op) - Py_FatalError("UNREF invalid object"); -#ifdef SLOW_UNREF_CHECK - for (p = refchain._ob_next; p != &refchain; p = p->_ob_next) { - if (p == op) - break; - } - if (p == &refchain) /* Not found */ - Py_FatalError("UNREF unknown object"); -#endif - op->_ob_next->_ob_prev = op->_ob_prev; - op->_ob_prev->_ob_next = op->_ob_next; - op->_ob_next = op->_ob_prev = NULL; - _Py_INC_TPFREES(op); -} - -void -_Py_Dealloc(PyObject *op) -{ - destructor dealloc = Py_TYPE(op)->tp_dealloc; - _Py_ForgetReference(op); - (*dealloc)(op); -} - -/* Print all live objects. Because PyObject_Print is called, the - * interpreter must be in a healthy state. - */ -void -_Py_PrintReferences(FILE *fp) -{ - PyObject *op; - fprintf(fp, "Remaining objects:\n"); - for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) { - fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] ", op, op->ob_refcnt); - if (PyObject_Print(op, fp, 0) != 0) - PyErr_Clear(); - putc('\n', fp); - } -} - -/* Print the addresses of all live objects. Unlike _Py_PrintReferences, this - * doesn't make any calls to the Python C API, so is always safe to call. - */ -void -_Py_PrintReferenceAddresses(FILE *fp) -{ - PyObject *op; - fprintf(fp, "Remaining object addresses:\n"); - for (op = refchain._ob_next; op != &refchain; op = op->_ob_next) - fprintf(fp, "%p [%" PY_FORMAT_SIZE_T "d] %s\n", op, - op->ob_refcnt, Py_TYPE(op)->tp_name); -} - -PyObject * -_Py_GetObjects(PyObject *self, PyObject *args) -{ - int i, n; - PyObject *t = NULL; - PyObject *res, *op; - - if (!PyArg_ParseTuple(args, "i|O", &n, &t)) - return NULL; - op = refchain._ob_next; - res = PyList_New(0); - if (res == NULL) - return NULL; - for (i = 0; (n == 0 || i < n) && op != &refchain; i++) { - while (op == self || op == args || op == res || op == t || - (t != NULL && Py_TYPE(op) != (PyTypeObject *) t)) { - op = op->_ob_next; - if (op == &refchain) - return res; - } - if (PyList_Append(res, op) < 0) { - Py_DECREF(res); - return NULL; - } - op = op->_ob_next; - } - return res; -} - -#endif - - -/* Hack to force loading of capsule.o */ -PyTypeObject *_Py_capsule_hack = &PyCapsule_Type; - - -/* Hack to force loading of cobject.o */ -PyTypeObject *_Py_cobject_hack = &PyCObject_Type; - - -/* Hack to force loading of abstract.o */ -Py_ssize_t (*_Py_abstract_hack)(PyObject *) = PyObject_Size; - - -/* Python's malloc wrappers (see pymem.h) */ - -void * -PyMem_Malloc(size_t nbytes) -{ - return PyMem_MALLOC(nbytes); -} - -void * -PyMem_Realloc(void *p, size_t nbytes) -{ - return PyMem_REALLOC(p, nbytes); -} - -void -PyMem_Free(void *p) -{ - PyMem_FREE(p); -} - - -/* These methods are used to control infinite recursion in repr, str, print, - etc. Container objects that may recursively contain themselves, - e.g. builtin dictionaries and lists, should used Py_ReprEnter() and - Py_ReprLeave() to avoid infinite recursion. - - Py_ReprEnter() returns 0 the first time it is called for a particular - object and 1 every time thereafter. It returns -1 if an exception - occurred. Py_ReprLeave() has no return value. - - See dictobject.c and listobject.c for examples of use. -*/ - -#define KEY "Py_Repr" - -int -Py_ReprEnter(PyObject *obj) -{ - PyObject *dict; - PyObject *list; - Py_ssize_t i; - - dict = PyThreadState_GetDict(); - if (dict == NULL) - return 0; - list = PyDict_GetItemString(dict, KEY); - if (list == NULL) { - list = PyList_New(0); - if (list == NULL) - return -1; - if (PyDict_SetItemString(dict, KEY, list) < 0) - return -1; - Py_DECREF(list); - } - i = PyList_GET_SIZE(list); - while (--i >= 0) { - if (PyList_GET_ITEM(list, i) == obj) - return 1; - } - PyList_Append(list, obj); - return 0; -} - -void -Py_ReprLeave(PyObject *obj) -{ - PyObject *dict; - PyObject *list; - Py_ssize_t i; - - dict = PyThreadState_GetDict(); - if (dict == NULL) - return; - list = PyDict_GetItemString(dict, KEY); - if (list == NULL || !PyList_Check(list)) - return; - i = PyList_GET_SIZE(list); - /* Count backwards because we always expect obj to be list[-1] */ - while (--i >= 0) { - if (PyList_GET_ITEM(list, i) == obj) { - PyList_SetSlice(list, i, i + 1, NULL); - break; - } - } -} - -/* Trashcan support. */ - -/* Current call-stack depth of tp_dealloc calls. */ -int _PyTrash_delete_nesting = 0; - -/* List of objects that still need to be cleaned up, singly linked via their - * gc headers' gc_prev pointers. - */ -PyObject *_PyTrash_delete_later = NULL; - -/* Add op to the _PyTrash_delete_later list. Called when the current - * call-stack depth gets large. op must be a currently untracked gc'ed - * object, with refcount 0. Py_DECREF must already have been called on it. - */ -void -_PyTrash_deposit_object(PyObject *op) -{ - assert(PyObject_IS_GC(op)); - assert(_Py_AS_GC(op)->gc.gc_refs == _PyGC_REFS_UNTRACKED); - assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *)_PyTrash_delete_later; - _PyTrash_delete_later = op; -} - -/* The equivalent API, using per-thread state recursion info */ -void -_PyTrash_thread_deposit_object(PyObject *op) -{ - PyThreadState *tstate = PyThreadState_GET(); - assert(PyObject_IS_GC(op)); - assert(_Py_AS_GC(op)->gc.gc_refs == _PyGC_REFS_UNTRACKED); - assert(op->ob_refcnt == 0); - _Py_AS_GC(op)->gc.gc_prev = (PyGC_Head *) tstate->trash_delete_later; - tstate->trash_delete_later = op; -} - -/* Dealloccate all the objects in the _PyTrash_delete_later list. Called when - * the call-stack unwinds again. - */ -void -_PyTrash_destroy_chain(void) -{ - while (_PyTrash_delete_later) { - PyObject *op = _PyTrash_delete_later; - destructor dealloc = Py_TYPE(op)->tp_dealloc; - - _PyTrash_delete_later = - (PyObject*) _Py_AS_GC(op)->gc.gc_prev; - - /* Call the deallocator directly. This used to try to - * fool Py_DECREF into calling it indirectly, but - * Py_DECREF was already called on this object, and in - * assorted non-release builds calling Py_DECREF again ends - * up distorting allocation statistics. - */ - assert(op->ob_refcnt == 0); - ++_PyTrash_delete_nesting; - (*dealloc)(op); - --_PyTrash_delete_nesting; - } -} - -/* The equivalent API, using per-thread state recursion info */ -void -_PyTrash_thread_destroy_chain(void) -{ - PyThreadState *tstate = PyThreadState_GET(); - while (tstate->trash_delete_later) { - PyObject *op = tstate->trash_delete_later; - destructor dealloc = Py_TYPE(op)->tp_dealloc; - - tstate->trash_delete_later = - (PyObject*) _Py_AS_GC(op)->gc.gc_prev; - - /* Call the deallocator directly. This used to try to - * fool Py_DECREF into calling it indirectly, but - * Py_DECREF was already called on this object, and in - * assorted non-release builds calling Py_DECREF again ends - * up distorting allocation statistics. - */ - assert(op->ob_refcnt == 0); - ++tstate->trash_delete_nesting; - (*dealloc)(op); - --tstate->trash_delete_nesting; - } -} - -#ifdef __cplusplus -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/obmalloc.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/obmalloc.c deleted file mode 100644 index 2e83c3e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/obmalloc.c +++ /dev/null @@ -1,1937 +0,0 @@ -#include "Python.h" - -#if defined(__has_feature) /* Clang */ - #if __has_feature(address_sanitizer) /* is ASAN enabled? */ - #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) \ - __attribute__ ((noinline)) - #else - #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS - #endif -#else - #if defined(__SANITIZE_ADDRESS__) /* GCC 4.8.x, is ASAN enabled? */ - #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS \ - __attribute__((no_address_safety_analysis)) \ - __attribute__ ((noinline)) - #else - #define ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS - #endif -#endif - -#ifdef WITH_PYMALLOC - -#ifdef HAVE_MMAP - #include - #ifdef MAP_ANONYMOUS - #define ARENAS_USE_MMAP - #endif -#endif - -#ifdef WITH_VALGRIND -#include - -/* If we're using GCC, use __builtin_expect() to reduce overhead of - the valgrind checks */ -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -# define UNLIKELY(value) __builtin_expect((value), 0) -#else -# define UNLIKELY(value) (value) -#endif - -/* -1 indicates that we haven't checked that we're running on valgrind yet. */ -static int running_on_valgrind = -1; -#endif - -/* An object allocator for Python. - - Here is an introduction to the layers of the Python memory architecture, - showing where the object allocator is actually used (layer +2), It is - called for every object allocation and deallocation (PyObject_New/Del), - unless the object-specific allocators implement a proprietary allocation - scheme (ex.: ints use a simple free list). This is also the place where - the cyclic garbage collector operates selectively on container objects. - - - Object-specific allocators - _____ ______ ______ ________ - [ int ] [ dict ] [ list ] ... [ string ] Python core | -+3 | <----- Object-specific memory -----> | <-- Non-object memory --> | - _______________________________ | | - [ Python's object allocator ] | | -+2 | ####### Object memory ####### | <------ Internal buffers ------> | - ______________________________________________________________ | - [ Python's raw memory allocator (PyMem_ API) ] | -+1 | <----- Python memory (under PyMem manager's control) ------> | | - __________________________________________________________________ - [ Underlying general-purpose allocator (ex: C library malloc) ] - 0 | <------ Virtual memory allocated for the python process -------> | - - ========================================================================= - _______________________________________________________________________ - [ OS-specific Virtual Memory Manager (VMM) ] --1 | <--- Kernel dynamic storage allocation & management (page-based) ---> | - __________________________________ __________________________________ - [ ] [ ] --2 | <-- Physical memory: ROM/RAM --> | | <-- Secondary storage (swap) --> | - -*/ -/*==========================================================================*/ - -/* A fast, special-purpose memory allocator for small blocks, to be used - on top of a general-purpose malloc -- heavily based on previous art. */ - -/* Vladimir Marangozov -- August 2000 */ - -/* - * "Memory management is where the rubber meets the road -- if we do the wrong - * thing at any level, the results will not be good. And if we don't make the - * levels work well together, we are in serious trouble." (1) - * - * (1) Paul R. Wilson, Mark S. Johnstone, Michael Neely, and David Boles, - * "Dynamic Storage Allocation: A Survey and Critical Review", - * in Proc. 1995 Int'l. Workshop on Memory Management, September 1995. - */ - -/* #undef WITH_MEMORY_LIMITS */ /* disable mem limit checks */ - -/*==========================================================================*/ - -/* - * Allocation strategy abstract: - * - * For small requests, the allocator sub-allocates blocks of memory. - * Requests greater than SMALL_REQUEST_THRESHOLD bytes are routed to the - * system's allocator. - * - * Small requests are grouped in size classes spaced 8 bytes apart, due - * to the required valid alignment of the returned address. Requests of - * a particular size are serviced from memory pools of 4K (one VMM page). - * Pools are fragmented on demand and contain free lists of blocks of one - * particular size class. In other words, there is a fixed-size allocator - * for each size class. Free pools are shared by the different allocators - * thus minimizing the space reserved for a particular size class. - * - * This allocation strategy is a variant of what is known as "simple - * segregated storage based on array of free lists". The main drawback of - * simple segregated storage is that we might end up with lot of reserved - * memory for the different free lists, which degenerate in time. To avoid - * this, we partition each free list in pools and we share dynamically the - * reserved space between all free lists. This technique is quite efficient - * for memory intensive programs which allocate mainly small-sized blocks. - * - * For small requests we have the following table: - * - * Request in bytes Size of allocated block Size class idx - * ---------------------------------------------------------------- - * 1-8 8 0 - * 9-16 16 1 - * 17-24 24 2 - * 25-32 32 3 - * 33-40 40 4 - * 41-48 48 5 - * 49-56 56 6 - * 57-64 64 7 - * 65-72 72 8 - * ... ... ... - * 497-504 504 62 - * 505-512 512 63 - * - * 0, SMALL_REQUEST_THRESHOLD + 1 and up: routed to the underlying - * allocator. - */ - -/*==========================================================================*/ - -/* - * -- Main tunable settings section -- - */ - -/* - * Alignment of addresses returned to the user. 8-bytes alignment works - * on most current architectures (with 32-bit or 64-bit address busses). - * The alignment value is also used for grouping small requests in size - * classes spaced ALIGNMENT bytes apart. - * - * You shouldn't change this unless you know what you are doing. - */ -#define ALIGNMENT 8 /* must be 2^N */ -#define ALIGNMENT_SHIFT 3 -#define ALIGNMENT_MASK (ALIGNMENT - 1) - -/* Return the number of bytes in size class I, as a uint. */ -#define INDEX2SIZE(I) (((uint)(I) + 1) << ALIGNMENT_SHIFT) - -/* - * Max size threshold below which malloc requests are considered to be - * small enough in order to use preallocated memory pools. You can tune - * this value according to your application behaviour and memory needs. - * - * The following invariants must hold: - * 1) ALIGNMENT <= SMALL_REQUEST_THRESHOLD <= 256 - * 2) SMALL_REQUEST_THRESHOLD is evenly divisible by ALIGNMENT - * - * Note: a size threshold of 512 guarantees that newly created dictionaries - * will be allocated from preallocated memory pools on 64-bit. - * - * Although not required, for better performance and space efficiency, - * it is recommended that SMALL_REQUEST_THRESHOLD is set to a power of 2. - */ -#define SMALL_REQUEST_THRESHOLD 512 -#define NB_SMALL_SIZE_CLASSES (SMALL_REQUEST_THRESHOLD / ALIGNMENT) - -/* - * The system's VMM page size can be obtained on most unices with a - * getpagesize() call or deduced from various header files. To make - * things simpler, we assume that it is 4K, which is OK for most systems. - * It is probably better if this is the native page size, but it doesn't - * have to be. In theory, if SYSTEM_PAGE_SIZE is larger than the native page - * size, then `POOL_ADDR(p)->arenaindex' could rarely cause a segmentation - * violation fault. 4K is apparently OK for all the platforms that python - * currently targets. - */ -#define SYSTEM_PAGE_SIZE (4 * 1024) -#define SYSTEM_PAGE_SIZE_MASK (SYSTEM_PAGE_SIZE - 1) - -/* - * Maximum amount of memory managed by the allocator for small requests. - */ -#ifdef WITH_MEMORY_LIMITS -#ifndef SMALL_MEMORY_LIMIT -#define SMALL_MEMORY_LIMIT (64 * 1024 * 1024) /* 64 MB -- more? */ -#endif -#endif - -/* - * The allocator sub-allocates blocks of memory (called arenas) aligned - * on a page boundary. This is a reserved virtual address space for the - * current process (obtained through a malloc()/mmap() call). In no way this - * means that the memory arenas will be used entirely. A malloc() is - * usually an address range reservation for bytes, unless all pages within - * this space are referenced subsequently. So malloc'ing big blocks and not - * using them does not mean "wasting memory". It's an addressable range - * wastage... - * - * Arenas are allocated with mmap() on systems supporting anonymous memory - * mappings to reduce heap fragmentation. - */ -#define ARENA_SIZE (256 << 10) /* 256KB */ - -#ifdef WITH_MEMORY_LIMITS -#define MAX_ARENAS (SMALL_MEMORY_LIMIT / ARENA_SIZE) -#endif - -/* - * Size of the pools used for small blocks. Should be a power of 2, - * between 1K and SYSTEM_PAGE_SIZE, that is: 1k, 2k, 4k. - */ -#define POOL_SIZE SYSTEM_PAGE_SIZE /* must be 2^N */ -#define POOL_SIZE_MASK SYSTEM_PAGE_SIZE_MASK - -/* - * -- End of tunable settings section -- - */ - -/*==========================================================================*/ - -/* - * Locking - * - * To reduce lock contention, it would probably be better to refine the - * crude function locking with per size class locking. I'm not positive - * however, whether it's worth switching to such locking policy because - * of the performance penalty it might introduce. - * - * The following macros describe the simplest (should also be the fastest) - * lock object on a particular platform and the init/fini/lock/unlock - * operations on it. The locks defined here are not expected to be recursive - * because it is assumed that they will always be called in the order: - * INIT, [LOCK, UNLOCK]*, FINI. - */ - -/* - * Python's threads are serialized, so object malloc locking is disabled. - */ -#define SIMPLELOCK_DECL(lock) /* simple lock declaration */ -#define SIMPLELOCK_INIT(lock) /* allocate (if needed) and initialize */ -#define SIMPLELOCK_FINI(lock) /* free/destroy an existing lock */ -#define SIMPLELOCK_LOCK(lock) /* acquire released lock */ -#define SIMPLELOCK_UNLOCK(lock) /* release acquired lock */ - -/* - * Basic types - * I don't care if these are defined in or elsewhere. Axiom. - */ -#undef uchar -#define uchar unsigned char /* assuming == 8 bits */ - -#undef uint -#define uint unsigned int /* assuming >= 16 bits */ - -#undef ulong -#define ulong unsigned long /* assuming >= 32 bits */ - -#undef uptr -#define uptr Py_uintptr_t - -/* When you say memory, my mind reasons in terms of (pointers to) blocks */ -typedef uchar block; - -/* Pool for small blocks. */ -struct pool_header { - union { block *_padding; - uint count; } ref; /* number of allocated blocks */ - block *freeblock; /* pool's free list head */ - struct pool_header *nextpool; /* next pool of this size class */ - struct pool_header *prevpool; /* previous pool "" */ - uint arenaindex; /* index into arenas of base adr */ - uint szidx; /* block size class index */ - uint nextoffset; /* bytes to virgin block */ - uint maxnextoffset; /* largest valid nextoffset */ -}; - -typedef struct pool_header *poolp; - -/* Record keeping for arenas. */ -struct arena_object { - /* The address of the arena, as returned by malloc. Note that 0 - * will never be returned by a successful malloc, and is used - * here to mark an arena_object that doesn't correspond to an - * allocated arena. - */ - uptr address; - - /* Pool-aligned pointer to the next pool to be carved off. */ - block* pool_address; - - /* The number of available pools in the arena: free pools + never- - * allocated pools. - */ - uint nfreepools; - - /* The total number of pools in the arena, whether or not available. */ - uint ntotalpools; - - /* Singly-linked list of available pools. */ - struct pool_header* freepools; - - /* Whenever this arena_object is not associated with an allocated - * arena, the nextarena member is used to link all unassociated - * arena_objects in the singly-linked `unused_arena_objects` list. - * The prevarena member is unused in this case. - * - * When this arena_object is associated with an allocated arena - * with at least one available pool, both members are used in the - * doubly-linked `usable_arenas` list, which is maintained in - * increasing order of `nfreepools` values. - * - * Else this arena_object is associated with an allocated arena - * all of whose pools are in use. `nextarena` and `prevarena` - * are both meaningless in this case. - */ - struct arena_object* nextarena; - struct arena_object* prevarena; -}; - -#undef ROUNDUP -#define ROUNDUP(x) (((x) + ALIGNMENT_MASK) & ~ALIGNMENT_MASK) -#define POOL_OVERHEAD ROUNDUP(sizeof(struct pool_header)) - -#define DUMMY_SIZE_IDX 0xffff /* size class of newly cached pools */ - -/* Round pointer P down to the closest pool-aligned address <= P, as a poolp */ -#define POOL_ADDR(P) ((poolp)((uptr)(P) & ~(uptr)POOL_SIZE_MASK)) - -/* Return total number of blocks in pool of size index I, as a uint. */ -#define NUMBLOCKS(I) ((uint)(POOL_SIZE - POOL_OVERHEAD) / INDEX2SIZE(I)) - -/*==========================================================================*/ - -/* - * This malloc lock - */ -SIMPLELOCK_DECL(_malloc_lock) -#define LOCK() SIMPLELOCK_LOCK(_malloc_lock) -#define UNLOCK() SIMPLELOCK_UNLOCK(_malloc_lock) -#define LOCK_INIT() SIMPLELOCK_INIT(_malloc_lock) -#define LOCK_FINI() SIMPLELOCK_FINI(_malloc_lock) - -/* - * Pool table -- headed, circular, doubly-linked lists of partially used pools. - -This is involved. For an index i, usedpools[i+i] is the header for a list of -all partially used pools holding small blocks with "size class idx" i. So -usedpools[0] corresponds to blocks of size 8, usedpools[2] to blocks of size -16, and so on: index 2*i <-> blocks of size (i+1)<freeblock points to -the start of a singly-linked list of free blocks within the pool. When a -block is freed, it's inserted at the front of its pool's freeblock list. Note -that the available blocks in a pool are *not* linked all together when a pool -is initialized. Instead only "the first two" (lowest addresses) blocks are -set up, returning the first such block, and setting pool->freeblock to a -one-block list holding the second such block. This is consistent with that -pymalloc strives at all levels (arena, pool, and block) never to touch a piece -of memory until it's actually needed. - -So long as a pool is in the used state, we're certain there *is* a block -available for allocating, and pool->freeblock is not NULL. If pool->freeblock -points to the end of the free list before we've carved the entire pool into -blocks, that means we simply haven't yet gotten to one of the higher-address -blocks. The offset from the pool_header to the start of "the next" virgin -block is stored in the pool_header nextoffset member, and the largest value -of nextoffset that makes sense is stored in the maxnextoffset member when a -pool is initialized. All the blocks in a pool have been passed out at least -once when and only when nextoffset > maxnextoffset. - - -Major obscurity: While the usedpools vector is declared to have poolp -entries, it doesn't really. It really contains two pointers per (conceptual) -poolp entry, the nextpool and prevpool members of a pool_header. The -excruciating initialization code below fools C so that - - usedpool[i+i] - -"acts like" a genuine poolp, but only so long as you only reference its -nextpool and prevpool members. The "- 2*sizeof(block *)" gibberish is -compensating for that a pool_header's nextpool and prevpool members -immediately follow a pool_header's first two members: - - union { block *_padding; - uint count; } ref; - block *freeblock; - -each of which consume sizeof(block *) bytes. So what usedpools[i+i] really -contains is a fudged-up pointer p such that *if* C believes it's a poolp -pointer, then p->nextpool and p->prevpool are both p (meaning that the headed -circular list is empty). - -It's unclear why the usedpools setup is so convoluted. It could be to -minimize the amount of cache required to hold this heavily-referenced table -(which only *needs* the two interpool pointer members of a pool_header). OTOH, -referencing code has to remember to "double the index" and doing so isn't -free, usedpools[0] isn't a strictly legal pointer, and we're crucially relying -on that C doesn't insert any padding anywhere in a pool_header at or before -the prevpool member. -**************************************************************************** */ - -#define PTA(x) ((poolp )((uchar *)&(usedpools[2*(x)]) - 2*sizeof(block *))) -#define PT(x) PTA(x), PTA(x) - -static poolp usedpools[2 * ((NB_SMALL_SIZE_CLASSES + 7) / 8) * 8] = { - PT(0), PT(1), PT(2), PT(3), PT(4), PT(5), PT(6), PT(7) -#if NB_SMALL_SIZE_CLASSES > 8 - , PT(8), PT(9), PT(10), PT(11), PT(12), PT(13), PT(14), PT(15) -#if NB_SMALL_SIZE_CLASSES > 16 - , PT(16), PT(17), PT(18), PT(19), PT(20), PT(21), PT(22), PT(23) -#if NB_SMALL_SIZE_CLASSES > 24 - , PT(24), PT(25), PT(26), PT(27), PT(28), PT(29), PT(30), PT(31) -#if NB_SMALL_SIZE_CLASSES > 32 - , PT(32), PT(33), PT(34), PT(35), PT(36), PT(37), PT(38), PT(39) -#if NB_SMALL_SIZE_CLASSES > 40 - , PT(40), PT(41), PT(42), PT(43), PT(44), PT(45), PT(46), PT(47) -#if NB_SMALL_SIZE_CLASSES > 48 - , PT(48), PT(49), PT(50), PT(51), PT(52), PT(53), PT(54), PT(55) -#if NB_SMALL_SIZE_CLASSES > 56 - , PT(56), PT(57), PT(58), PT(59), PT(60), PT(61), PT(62), PT(63) -#if NB_SMALL_SIZE_CLASSES > 64 -#error "NB_SMALL_SIZE_CLASSES should be less than 64" -#endif /* NB_SMALL_SIZE_CLASSES > 64 */ -#endif /* NB_SMALL_SIZE_CLASSES > 56 */ -#endif /* NB_SMALL_SIZE_CLASSES > 48 */ -#endif /* NB_SMALL_SIZE_CLASSES > 40 */ -#endif /* NB_SMALL_SIZE_CLASSES > 32 */ -#endif /* NB_SMALL_SIZE_CLASSES > 24 */ -#endif /* NB_SMALL_SIZE_CLASSES > 16 */ -#endif /* NB_SMALL_SIZE_CLASSES > 8 */ -}; - -/*========================================================================== -Arena management. - -`arenas` is a vector of arena_objects. It contains maxarenas entries, some of -which may not be currently used (== they're arena_objects that aren't -currently associated with an allocated arena). Note that arenas proper are -separately malloc'ed. - -Prior to Python 2.5, arenas were never free()'ed. Starting with Python 2.5, -we do try to free() arenas, and use some mild heuristic strategies to increase -the likelihood that arenas eventually can be freed. - -unused_arena_objects - - This is a singly-linked list of the arena_objects that are currently not - being used (no arena is associated with them). Objects are taken off the - head of the list in new_arena(), and are pushed on the head of the list in - PyObject_Free() when the arena is empty. Key invariant: an arena_object - is on this list if and only if its .address member is 0. - -usable_arenas - - This is a doubly-linked list of the arena_objects associated with arenas - that have pools available. These pools are either waiting to be reused, - or have not been used before. The list is sorted to have the most- - allocated arenas first (ascending order based on the nfreepools member). - This means that the next allocation will come from a heavily used arena, - which gives the nearly empty arenas a chance to be returned to the system. - In my unscientific tests this dramatically improved the number of arenas - that could be freed. - -Note that an arena_object associated with an arena all of whose pools are -currently in use isn't on either list. -*/ - -/* Array of objects used to track chunks of memory (arenas). */ -static struct arena_object* arenas = NULL; -/* Number of slots currently allocated in the `arenas` vector. */ -static uint maxarenas = 0; - -/* The head of the singly-linked, NULL-terminated list of available - * arena_objects. - */ -static struct arena_object* unused_arena_objects = NULL; - -/* The head of the doubly-linked, NULL-terminated at each end, list of - * arena_objects associated with arenas that have pools available. - */ -static struct arena_object* usable_arenas = NULL; - -/* How many arena_objects do we initially allocate? - * 16 = can allocate 16 arenas = 16 * ARENA_SIZE = 4MB before growing the - * `arenas` vector. - */ -#define INITIAL_ARENA_OBJECTS 16 - -/* Number of arenas allocated that haven't been free()'d. */ -static size_t narenas_currently_allocated = 0; - -#ifdef PYMALLOC_DEBUG -/* Total number of times malloc() called to allocate an arena. */ -static size_t ntimes_arena_allocated = 0; -/* High water mark (max value ever seen) for narenas_currently_allocated. */ -static size_t narenas_highwater = 0; -#endif - -/* Allocate a new arena. If we run out of memory, return NULL. Else - * allocate a new arena, and return the address of an arena_object - * describing the new arena. It's expected that the caller will set - * `usable_arenas` to the return value. - */ -static struct arena_object* -new_arena(void) -{ - struct arena_object* arenaobj; - uint excess; /* number of bytes above pool alignment */ - void *address; - int err; - -#ifdef PYMALLOC_DEBUG - if (Py_GETENV("PYTHONMALLOCSTATS")) - _PyObject_DebugMallocStats(); -#endif - if (unused_arena_objects == NULL) { - uint i; - uint numarenas; - size_t nbytes; - - /* Double the number of arena objects on each allocation. - * Note that it's possible for `numarenas` to overflow. - */ - numarenas = maxarenas ? maxarenas << 1 : INITIAL_ARENA_OBJECTS; - if (numarenas <= maxarenas) - return NULL; /* overflow */ -#if SIZEOF_SIZE_T <= SIZEOF_INT - if (numarenas > PY_SIZE_MAX / sizeof(*arenas)) - return NULL; /* overflow */ -#endif - nbytes = numarenas * sizeof(*arenas); - arenaobj = (struct arena_object *)realloc(arenas, nbytes); - if (arenaobj == NULL) - return NULL; - arenas = arenaobj; - - /* We might need to fix pointers that were copied. However, - * new_arena only gets called when all the pages in the - * previous arenas are full. Thus, there are *no* pointers - * into the old array. Thus, we don't have to worry about - * invalid pointers. Just to be sure, some asserts: - */ - assert(usable_arenas == NULL); - assert(unused_arena_objects == NULL); - - /* Put the new arenas on the unused_arena_objects list. */ - for (i = maxarenas; i < numarenas; ++i) { - arenas[i].address = 0; /* mark as unassociated */ - arenas[i].nextarena = i < numarenas - 1 ? - &arenas[i+1] : NULL; - } - - /* Update globals. */ - unused_arena_objects = &arenas[maxarenas]; - maxarenas = numarenas; - } - - /* Take the next available arena object off the head of the list. */ - assert(unused_arena_objects != NULL); - arenaobj = unused_arena_objects; - unused_arena_objects = arenaobj->nextarena; - assert(arenaobj->address == 0); -#ifdef ARENAS_USE_MMAP - address = mmap(NULL, ARENA_SIZE, PROT_READ|PROT_WRITE, - MAP_PRIVATE|MAP_ANONYMOUS, -1, 0); - err = (address == MAP_FAILED); -#else - address = malloc(ARENA_SIZE); - err = (address == 0); -#endif - if (err) { - /* The allocation failed: return NULL after putting the - * arenaobj back. - */ - arenaobj->nextarena = unused_arena_objects; - unused_arena_objects = arenaobj; - return NULL; - } - arenaobj->address = (uptr)address; - - ++narenas_currently_allocated; -#ifdef PYMALLOC_DEBUG - ++ntimes_arena_allocated; - if (narenas_currently_allocated > narenas_highwater) - narenas_highwater = narenas_currently_allocated; -#endif - arenaobj->freepools = NULL; - /* pool_address <- first pool-aligned address in the arena - nfreepools <- number of whole pools that fit after alignment */ - arenaobj->pool_address = (block*)arenaobj->address; - arenaobj->nfreepools = ARENA_SIZE / POOL_SIZE; - assert(POOL_SIZE * arenaobj->nfreepools == ARENA_SIZE); - excess = (uint)(arenaobj->address & POOL_SIZE_MASK); - if (excess != 0) { - --arenaobj->nfreepools; - arenaobj->pool_address += POOL_SIZE - excess; - } - arenaobj->ntotalpools = arenaobj->nfreepools; - - return arenaobj; -} - -/* -Py_ADDRESS_IN_RANGE(P, POOL) - -Return true if and only if P is an address that was allocated by pymalloc. -POOL must be the pool address associated with P, i.e., POOL = POOL_ADDR(P) -(the caller is asked to compute this because the macro expands POOL more than -once, and for efficiency it's best for the caller to assign POOL_ADDR(P) to a -variable and pass the latter to the macro; because Py_ADDRESS_IN_RANGE is -called on every alloc/realloc/free, micro-efficiency is important here). - -Tricky: Let B be the arena base address associated with the pool, B = -arenas[(POOL)->arenaindex].address. Then P belongs to the arena if and only if - - B <= P < B + ARENA_SIZE - -Subtracting B throughout, this is true iff - - 0 <= P-B < ARENA_SIZE - -By using unsigned arithmetic, the "0 <=" half of the test can be skipped. - -Obscure: A PyMem "free memory" function can call the pymalloc free or realloc -before the first arena has been allocated. `arenas` is still NULL in that -case. We're relying on that maxarenas is also 0 in that case, so that -(POOL)->arenaindex < maxarenas must be false, saving us from trying to index -into a NULL arenas. - -Details: given P and POOL, the arena_object corresponding to P is AO = -arenas[(POOL)->arenaindex]. Suppose obmalloc controls P. Then (barring wild -stores, etc), POOL is the correct address of P's pool, AO.address is the -correct base address of the pool's arena, and P must be within ARENA_SIZE of -AO.address. In addition, AO.address is not 0 (no arena can start at address 0 -(NULL)). Therefore Py_ADDRESS_IN_RANGE correctly reports that obmalloc -controls P. - -Now suppose obmalloc does not control P (e.g., P was obtained via a direct -call to the system malloc() or realloc()). (POOL)->arenaindex may be anything -in this case -- it may even be uninitialized trash. If the trash arenaindex -is >= maxarenas, the macro correctly concludes at once that obmalloc doesn't -control P. - -Else arenaindex is < maxarena, and AO is read up. If AO corresponds to an -allocated arena, obmalloc controls all the memory in slice AO.address : -AO.address+ARENA_SIZE. By case assumption, P is not controlled by obmalloc, -so P doesn't lie in that slice, so the macro correctly reports that P is not -controlled by obmalloc. - -Finally, if P is not controlled by obmalloc and AO corresponds to an unused -arena_object (one not currently associated with an allocated arena), -AO.address is 0, and the second test in the macro reduces to: - - P < ARENA_SIZE - -If P >= ARENA_SIZE (extremely likely), the macro again correctly concludes -that P is not controlled by obmalloc. However, if P < ARENA_SIZE, this part -of the test still passes, and the third clause (AO.address != 0) is necessary -to get the correct result: AO.address is 0 in this case, so the macro -correctly reports that P is not controlled by obmalloc (despite that P lies in -slice AO.address : AO.address + ARENA_SIZE). - -Note: The third (AO.address != 0) clause was added in Python 2.5. Before -2.5, arenas were never free()'ed, and an arenaindex < maxarena always -corresponded to a currently-allocated arena, so the "P is not controlled by -obmalloc, AO corresponds to an unused arena_object, and P < ARENA_SIZE" case -was impossible. - -Note that the logic is excruciating, and reading up possibly uninitialized -memory when P is not controlled by obmalloc (to get at (POOL)->arenaindex) -creates problems for some memory debuggers. The overwhelming advantage is -that this test determines whether an arbitrary address is controlled by -obmalloc in a small constant time, independent of the number of arenas -obmalloc controls. Since this test is needed at every entry point, it's -extremely desirable that it be this fast. - -Since Py_ADDRESS_IN_RANGE may be reading from memory which was not allocated -by Python, it is important that (POOL)->arenaindex is read only once, as -another thread may be concurrently modifying the value without holding the -GIL. To accomplish this, the arenaindex_temp variable is used to store -(POOL)->arenaindex for the duration of the Py_ADDRESS_IN_RANGE macro's -execution. The caller of the macro is responsible for declaring this -variable. -*/ -#define Py_ADDRESS_IN_RANGE(P, POOL) \ - ((arenaindex_temp = (POOL)->arenaindex) < maxarenas && \ - (uptr)(P) - arenas[arenaindex_temp].address < (uptr)ARENA_SIZE && \ - arenas[arenaindex_temp].address != 0) - - -/* This is only useful when running memory debuggers such as - * Purify or Valgrind. Uncomment to use. - * -#define Py_USING_MEMORY_DEBUGGER - */ - -#ifdef Py_USING_MEMORY_DEBUGGER - -/* Py_ADDRESS_IN_RANGE may access uninitialized memory by design - * This leads to thousands of spurious warnings when using - * Purify or Valgrind. By making a function, we can easily - * suppress the uninitialized memory reads in this one function. - * So we won't ignore real errors elsewhere. - * - * Disable the macro and use a function. - */ - -#undef Py_ADDRESS_IN_RANGE - -#if defined(__GNUC__) && ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1) || \ - (__GNUC__ >= 4)) -#define Py_NO_INLINE __attribute__((__noinline__)) -#else -#define Py_NO_INLINE -#endif - -/* Don't make static, to try to ensure this isn't inlined. */ -int Py_ADDRESS_IN_RANGE(void *P, poolp pool) Py_NO_INLINE; -#undef Py_NO_INLINE -#endif - -/*==========================================================================*/ - -/* malloc. Note that nbytes==0 tries to return a non-NULL pointer, distinct - * from all other currently live pointers. This may not be possible. - */ - -/* - * The basic blocks are ordered by decreasing execution frequency, - * which minimizes the number of jumps in the most common cases, - * improves branching prediction and instruction scheduling (small - * block allocations typically result in a couple of instructions). - * Unless the optimizer reorders everything, being too smart... - */ - -#undef PyObject_Malloc -void * -PyObject_Malloc(size_t nbytes) -{ - block *bp; - poolp pool; - poolp next; - uint size; - -#ifdef WITH_VALGRIND - if (UNLIKELY(running_on_valgrind == -1)) - running_on_valgrind = RUNNING_ON_VALGRIND; - if (UNLIKELY(running_on_valgrind)) - goto redirect; -#endif - - /* - * Limit ourselves to PY_SSIZE_T_MAX bytes to prevent security holes. - * Most python internals blindly use a signed Py_ssize_t to track - * things without checking for overflows or negatives. - * As size_t is unsigned, checking for nbytes < 0 is not required. - */ - if (nbytes > PY_SSIZE_T_MAX) - return NULL; - - /* - * This implicitly redirects malloc(0). - */ - if ((nbytes - 1) < SMALL_REQUEST_THRESHOLD) { - LOCK(); - /* - * Most frequent paths first - */ - size = (uint)(nbytes - 1) >> ALIGNMENT_SHIFT; - pool = usedpools[size + size]; - if (pool != pool->nextpool) { - /* - * There is a used pool for this size class. - * Pick up the head block of its free list. - */ - ++pool->ref.count; - bp = pool->freeblock; - assert(bp != NULL); - if ((pool->freeblock = *(block **)bp) != NULL) { - UNLOCK(); - return (void *)bp; - } - /* - * Reached the end of the free list, try to extend it. - */ - if (pool->nextoffset <= pool->maxnextoffset) { - /* There is room for another block. */ - pool->freeblock = (block*)pool + - pool->nextoffset; - pool->nextoffset += INDEX2SIZE(size); - *(block **)(pool->freeblock) = NULL; - UNLOCK(); - return (void *)bp; - } - /* Pool is full, unlink from used pools. */ - next = pool->nextpool; - pool = pool->prevpool; - next->prevpool = pool; - pool->nextpool = next; - UNLOCK(); - return (void *)bp; - } - - /* There isn't a pool of the right size class immediately - * available: use a free pool. - */ - if (usable_arenas == NULL) { - /* No arena has a free pool: allocate a new arena. */ -#ifdef WITH_MEMORY_LIMITS - if (narenas_currently_allocated >= MAX_ARENAS) { - UNLOCK(); - goto redirect; - } -#endif - usable_arenas = new_arena(); - if (usable_arenas == NULL) { - UNLOCK(); - goto redirect; - } - usable_arenas->nextarena = - usable_arenas->prevarena = NULL; - } - assert(usable_arenas->address != 0); - - /* Try to get a cached free pool. */ - pool = usable_arenas->freepools; - if (pool != NULL) { - /* Unlink from cached pools. */ - usable_arenas->freepools = pool->nextpool; - - /* This arena already had the smallest nfreepools - * value, so decreasing nfreepools doesn't change - * that, and we don't need to rearrange the - * usable_arenas list. However, if the arena has - * become wholly allocated, we need to remove its - * arena_object from usable_arenas. - */ - --usable_arenas->nfreepools; - if (usable_arenas->nfreepools == 0) { - /* Wholly allocated: remove. */ - assert(usable_arenas->freepools == NULL); - assert(usable_arenas->nextarena == NULL || - usable_arenas->nextarena->prevarena == - usable_arenas); - - usable_arenas = usable_arenas->nextarena; - if (usable_arenas != NULL) { - usable_arenas->prevarena = NULL; - assert(usable_arenas->address != 0); - } - } - else { - /* nfreepools > 0: it must be that freepools - * isn't NULL, or that we haven't yet carved - * off all the arena's pools for the first - * time. - */ - assert(usable_arenas->freepools != NULL || - usable_arenas->pool_address <= - (block*)usable_arenas->address + - ARENA_SIZE - POOL_SIZE); - } - init_pool: - /* Frontlink to used pools. */ - next = usedpools[size + size]; /* == prev */ - pool->nextpool = next; - pool->prevpool = next; - next->nextpool = pool; - next->prevpool = pool; - pool->ref.count = 1; - if (pool->szidx == size) { - /* Luckily, this pool last contained blocks - * of the same size class, so its header - * and free list are already initialized. - */ - bp = pool->freeblock; - pool->freeblock = *(block **)bp; - UNLOCK(); - return (void *)bp; - } - /* - * Initialize the pool header, set up the free list to - * contain just the second block, and return the first - * block. - */ - pool->szidx = size; - size = INDEX2SIZE(size); - bp = (block *)pool + POOL_OVERHEAD; - pool->nextoffset = POOL_OVERHEAD + (size << 1); - pool->maxnextoffset = POOL_SIZE - size; - pool->freeblock = bp + size; - *(block **)(pool->freeblock) = NULL; - UNLOCK(); - return (void *)bp; - } - - /* Carve off a new pool. */ - assert(usable_arenas->nfreepools > 0); - assert(usable_arenas->freepools == NULL); - pool = (poolp)usable_arenas->pool_address; - assert((block*)pool <= (block*)usable_arenas->address + - ARENA_SIZE - POOL_SIZE); - pool->arenaindex = usable_arenas - arenas; - assert(&arenas[pool->arenaindex] == usable_arenas); - pool->szidx = DUMMY_SIZE_IDX; - usable_arenas->pool_address += POOL_SIZE; - --usable_arenas->nfreepools; - - if (usable_arenas->nfreepools == 0) { - assert(usable_arenas->nextarena == NULL || - usable_arenas->nextarena->prevarena == - usable_arenas); - /* Unlink the arena: it is completely allocated. */ - usable_arenas = usable_arenas->nextarena; - if (usable_arenas != NULL) { - usable_arenas->prevarena = NULL; - assert(usable_arenas->address != 0); - } - } - - goto init_pool; - } - - /* The small block allocator ends here. */ - -redirect: - /* Redirect the original request to the underlying (libc) allocator. - * We jump here on bigger requests, on error in the code above (as a - * last chance to serve the request) or when the max memory limit - * has been reached. - */ - if (nbytes == 0) - nbytes = 1; - return (void *)malloc(nbytes); -} - -/* free */ - -#undef PyObject_Free -ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS -void -PyObject_Free(void *p) -{ - poolp pool; - block *lastfree; - poolp next, prev; - uint size; -#ifndef Py_USING_MEMORY_DEBUGGER - uint arenaindex_temp; -#endif - - if (p == NULL) /* free(NULL) has no effect */ - return; - -#ifdef WITH_VALGRIND - if (UNLIKELY(running_on_valgrind > 0)) - goto redirect; -#endif - - pool = POOL_ADDR(p); - if (Py_ADDRESS_IN_RANGE(p, pool)) { - /* We allocated this address. */ - LOCK(); - /* Link p to the start of the pool's freeblock list. Since - * the pool had at least the p block outstanding, the pool - * wasn't empty (so it's already in a usedpools[] list, or - * was full and is in no list -- it's not in the freeblocks - * list in any case). - */ - assert(pool->ref.count > 0); /* else it was empty */ - *(block **)p = lastfree = pool->freeblock; - pool->freeblock = (block *)p; - if (lastfree) { - struct arena_object* ao; - uint nf; /* ao->nfreepools */ - - /* freeblock wasn't NULL, so the pool wasn't full, - * and the pool is in a usedpools[] list. - */ - if (--pool->ref.count != 0) { - /* pool isn't empty: leave it in usedpools */ - UNLOCK(); - return; - } - /* Pool is now empty: unlink from usedpools, and - * link to the front of freepools. This ensures that - * previously freed pools will be allocated later - * (being not referenced, they are perhaps paged out). - */ - next = pool->nextpool; - prev = pool->prevpool; - next->prevpool = prev; - prev->nextpool = next; - - /* Link the pool to freepools. This is a singly-linked - * list, and pool->prevpool isn't used there. - */ - ao = &arenas[pool->arenaindex]; - pool->nextpool = ao->freepools; - ao->freepools = pool; - nf = ++ao->nfreepools; - - /* All the rest is arena management. We just freed - * a pool, and there are 4 cases for arena mgmt: - * 1. If all the pools are free, return the arena to - * the system free(). - * 2. If this is the only free pool in the arena, - * add the arena back to the `usable_arenas` list. - * 3. If the "next" arena has a smaller count of free - * pools, we have to "slide this arena right" to - * restore that usable_arenas is sorted in order of - * nfreepools. - * 4. Else there's nothing more to do. - */ - if (nf == ao->ntotalpools) { - /* Case 1. First unlink ao from usable_arenas. - */ - assert(ao->prevarena == NULL || - ao->prevarena->address != 0); - assert(ao ->nextarena == NULL || - ao->nextarena->address != 0); - - /* Fix the pointer in the prevarena, or the - * usable_arenas pointer. - */ - if (ao->prevarena == NULL) { - usable_arenas = ao->nextarena; - assert(usable_arenas == NULL || - usable_arenas->address != 0); - } - else { - assert(ao->prevarena->nextarena == ao); - ao->prevarena->nextarena = - ao->nextarena; - } - /* Fix the pointer in the nextarena. */ - if (ao->nextarena != NULL) { - assert(ao->nextarena->prevarena == ao); - ao->nextarena->prevarena = - ao->prevarena; - } - /* Record that this arena_object slot is - * available to be reused. - */ - ao->nextarena = unused_arena_objects; - unused_arena_objects = ao; - - /* Free the entire arena. */ -#ifdef ARENAS_USE_MMAP - munmap((void *)ao->address, ARENA_SIZE); -#else - free((void *)ao->address); -#endif - ao->address = 0; /* mark unassociated */ - --narenas_currently_allocated; - - UNLOCK(); - return; - } - if (nf == 1) { - /* Case 2. Put ao at the head of - * usable_arenas. Note that because - * ao->nfreepools was 0 before, ao isn't - * currently on the usable_arenas list. - */ - ao->nextarena = usable_arenas; - ao->prevarena = NULL; - if (usable_arenas) - usable_arenas->prevarena = ao; - usable_arenas = ao; - assert(usable_arenas->address != 0); - - UNLOCK(); - return; - } - /* If this arena is now out of order, we need to keep - * the list sorted. The list is kept sorted so that - * the "most full" arenas are used first, which allows - * the nearly empty arenas to be completely freed. In - * a few un-scientific tests, it seems like this - * approach allowed a lot more memory to be freed. - */ - if (ao->nextarena == NULL || - nf <= ao->nextarena->nfreepools) { - /* Case 4. Nothing to do. */ - UNLOCK(); - return; - } - /* Case 3: We have to move the arena towards the end - * of the list, because it has more free pools than - * the arena to its right. - * First unlink ao from usable_arenas. - */ - if (ao->prevarena != NULL) { - /* ao isn't at the head of the list */ - assert(ao->prevarena->nextarena == ao); - ao->prevarena->nextarena = ao->nextarena; - } - else { - /* ao is at the head of the list */ - assert(usable_arenas == ao); - usable_arenas = ao->nextarena; - } - ao->nextarena->prevarena = ao->prevarena; - - /* Locate the new insertion point by iterating over - * the list, using our nextarena pointer. - */ - while (ao->nextarena != NULL && - nf > ao->nextarena->nfreepools) { - ao->prevarena = ao->nextarena; - ao->nextarena = ao->nextarena->nextarena; - } - - /* Insert ao at this point. */ - assert(ao->nextarena == NULL || - ao->prevarena == ao->nextarena->prevarena); - assert(ao->prevarena->nextarena == ao->nextarena); - - ao->prevarena->nextarena = ao; - if (ao->nextarena != NULL) - ao->nextarena->prevarena = ao; - - /* Verify that the swaps worked. */ - assert(ao->nextarena == NULL || - nf <= ao->nextarena->nfreepools); - assert(ao->prevarena == NULL || - nf > ao->prevarena->nfreepools); - assert(ao->nextarena == NULL || - ao->nextarena->prevarena == ao); - assert((usable_arenas == ao && - ao->prevarena == NULL) || - ao->prevarena->nextarena == ao); - - UNLOCK(); - return; - } - /* Pool was full, so doesn't currently live in any list: - * link it to the front of the appropriate usedpools[] list. - * This mimics LRU pool usage for new allocations and - * targets optimal filling when several pools contain - * blocks of the same size class. - */ - --pool->ref.count; - assert(pool->ref.count > 0); /* else the pool is empty */ - size = pool->szidx; - next = usedpools[size + size]; - prev = next->prevpool; - /* insert pool before next: prev <-> pool <-> next */ - pool->nextpool = next; - pool->prevpool = prev; - next->prevpool = pool; - prev->nextpool = pool; - UNLOCK(); - return; - } - -#ifdef WITH_VALGRIND -redirect: -#endif - /* We didn't allocate this address. */ - free(p); -} - -/* realloc. If p is NULL, this acts like malloc(nbytes). Else if nbytes==0, - * then as the Python docs promise, we do not treat this like free(p), and - * return a non-NULL result. - */ - -#undef PyObject_Realloc -ATTRIBUTE_NO_ADDRESS_SAFETY_ANALYSIS -void * -PyObject_Realloc(void *p, size_t nbytes) -{ - void *bp; - poolp pool; - size_t size; -#ifndef Py_USING_MEMORY_DEBUGGER - uint arenaindex_temp; -#endif - - if (p == NULL) - return PyObject_Malloc(nbytes); - - /* - * Limit ourselves to PY_SSIZE_T_MAX bytes to prevent security holes. - * Most python internals blindly use a signed Py_ssize_t to track - * things without checking for overflows or negatives. - * As size_t is unsigned, checking for nbytes < 0 is not required. - */ - if (nbytes > PY_SSIZE_T_MAX) - return NULL; - -#ifdef WITH_VALGRIND - /* Treat running_on_valgrind == -1 the same as 0 */ - if (UNLIKELY(running_on_valgrind > 0)) - goto redirect; -#endif - - pool = POOL_ADDR(p); - if (Py_ADDRESS_IN_RANGE(p, pool)) { - /* We're in charge of this block */ - size = INDEX2SIZE(pool->szidx); - if (nbytes <= size) { - /* The block is staying the same or shrinking. If - * it's shrinking, there's a tradeoff: it costs - * cycles to copy the block to a smaller size class, - * but it wastes memory not to copy it. The - * compromise here is to copy on shrink only if at - * least 25% of size can be shaved off. - */ - if (4 * nbytes > 3 * size) { - /* It's the same, - * or shrinking and new/old > 3/4. - */ - return p; - } - size = nbytes; - } - bp = PyObject_Malloc(nbytes); - if (bp != NULL) { - memcpy(bp, p, size); - PyObject_Free(p); - } - return bp; - } -#ifdef WITH_VALGRIND - redirect: -#endif - /* We're not managing this block. If nbytes <= - * SMALL_REQUEST_THRESHOLD, it's tempting to try to take over this - * block. However, if we do, we need to copy the valid data from - * the C-managed block to one of our blocks, and there's no portable - * way to know how much of the memory space starting at p is valid. - * As bug 1185883 pointed out the hard way, it's possible that the - * C-managed block is "at the end" of allocated VM space, so that - * a memory fault can occur if we try to copy nbytes bytes starting - * at p. Instead we punt: let C continue to manage this block. - */ - if (nbytes) - return realloc(p, nbytes); - /* C doesn't define the result of realloc(p, 0) (it may or may not - * return NULL then), but Python's docs promise that nbytes==0 never - * returns NULL. We don't pass 0 to realloc(), to avoid that endcase - * to begin with. Even then, we can't be sure that realloc() won't - * return NULL. - */ - bp = realloc(p, 1); - return bp ? bp : p; -} - -#else /* ! WITH_PYMALLOC */ - -/*==========================================================================*/ -/* pymalloc not enabled: Redirect the entry points to malloc. These will - * only be used by extensions that are compiled with pymalloc enabled. */ - -void * -PyObject_Malloc(size_t n) -{ - return PyMem_MALLOC(n); -} - -void * -PyObject_Realloc(void *p, size_t n) -{ - return PyMem_REALLOC(p, n); -} - -void -PyObject_Free(void *p) -{ - PyMem_FREE(p); -} -#endif /* WITH_PYMALLOC */ - -#ifdef PYMALLOC_DEBUG -/*==========================================================================*/ -/* A x-platform debugging allocator. This doesn't manage memory directly, - * it wraps a real allocator, adding extra debugging info to the memory blocks. - */ - -/* Special bytes broadcast into debug memory blocks at appropriate times. - * Strings of these are unlikely to be valid addresses, floats, ints or - * 7-bit ASCII. - */ -#undef CLEANBYTE -#undef DEADBYTE -#undef FORBIDDENBYTE -#define CLEANBYTE 0xCB /* clean (newly allocated) memory */ -#define DEADBYTE 0xDB /* dead (newly freed) memory */ -#define FORBIDDENBYTE 0xFB /* untouchable bytes at each end of a block */ - -/* We tag each block with an API ID in order to tag API violations */ -#define _PYMALLOC_MEM_ID 'm' /* the PyMem_Malloc() API */ -#define _PYMALLOC_OBJ_ID 'o' /* The PyObject_Malloc() API */ - -static size_t serialno = 0; /* incremented on each debug {m,re}alloc */ - -/* serialno is always incremented via calling this routine. The point is - * to supply a single place to set a breakpoint. - */ -static void -bumpserialno(void) -{ - ++serialno; -} - -#define SST SIZEOF_SIZE_T - -/* Read sizeof(size_t) bytes at p as a big-endian size_t. */ -static size_t -read_size_t(const void *p) -{ - const uchar *q = (const uchar *)p; - size_t result = *q++; - int i; - - for (i = SST; --i > 0; ++q) - result = (result << 8) | *q; - return result; -} - -/* Write n as a big-endian size_t, MSB at address p, LSB at - * p + sizeof(size_t) - 1. - */ -static void -write_size_t(void *p, size_t n) -{ - uchar *q = (uchar *)p + SST - 1; - int i; - - for (i = SST; --i >= 0; --q) { - *q = (uchar)(n & 0xff); - n >>= 8; - } -} - -#ifdef Py_DEBUG -/* Is target in the list? The list is traversed via the nextpool pointers. - * The list may be NULL-terminated, or circular. Return 1 if target is in - * list, else 0. - */ -static int -pool_is_in_list(const poolp target, poolp list) -{ - poolp origlist = list; - assert(target != NULL); - if (list == NULL) - return 0; - do { - if (target == list) - return 1; - list = list->nextpool; - } while (list != NULL && list != origlist); - return 0; -} - -#else -#define pool_is_in_list(X, Y) 1 - -#endif /* Py_DEBUG */ - -/* Let S = sizeof(size_t). The debug malloc asks for 4*S extra bytes and - fills them with useful stuff, here calling the underlying malloc's result p: - -p[0: S] - Number of bytes originally asked for. This is a size_t, big-endian (easier - to read in a memory dump). -p[S: 2*S] - Copies of FORBIDDENBYTE. Used to catch under- writes and reads. -p[2*S: 2*S+n] - The requested memory, filled with copies of CLEANBYTE. - Used to catch reference to uninitialized memory. - &p[2*S] is returned. Note that this is 8-byte aligned if pymalloc - handled the request itself. -p[2*S+n: 2*S+n+S] - Copies of FORBIDDENBYTE. Used to catch over- writes and reads. -p[2*S+n+S: 2*S+n+2*S] - A serial number, incremented by 1 on each call to _PyObject_DebugMalloc - and _PyObject_DebugRealloc. - This is a big-endian size_t. - If "bad memory" is detected later, the serial number gives an - excellent way to set a breakpoint on the next run, to capture the - instant at which this block was passed out. -*/ - -/* debug replacements for the PyMem_* memory API */ -void * -_PyMem_DebugMalloc(size_t nbytes) -{ - return _PyObject_DebugMallocApi(_PYMALLOC_MEM_ID, nbytes); -} -void * -_PyMem_DebugRealloc(void *p, size_t nbytes) -{ - return _PyObject_DebugReallocApi(_PYMALLOC_MEM_ID, p, nbytes); -} -void -_PyMem_DebugFree(void *p) -{ - _PyObject_DebugFreeApi(_PYMALLOC_MEM_ID, p); -} - -/* debug replacements for the PyObject_* memory API */ -void * -_PyObject_DebugMalloc(size_t nbytes) -{ - return _PyObject_DebugMallocApi(_PYMALLOC_OBJ_ID, nbytes); -} -void * -_PyObject_DebugRealloc(void *p, size_t nbytes) -{ - return _PyObject_DebugReallocApi(_PYMALLOC_OBJ_ID, p, nbytes); -} -void -_PyObject_DebugFree(void *p) -{ - _PyObject_DebugFreeApi(_PYMALLOC_OBJ_ID, p); -} -void -_PyObject_DebugCheckAddress(const void *p) -{ - _PyObject_DebugCheckAddressApi(_PYMALLOC_OBJ_ID, p); -} - - -/* generic debug memory api, with an "id" to identify the API in use */ -void * -_PyObject_DebugMallocApi(char id, size_t nbytes) -{ - uchar *p; /* base address of malloc'ed block */ - uchar *tail; /* p + 2*SST + nbytes == pointer to tail pad bytes */ - size_t total; /* nbytes + 4*SST */ - - bumpserialno(); - total = nbytes + 4*SST; - if (total < nbytes) - /* overflow: can't represent total as a size_t */ - return NULL; - - p = (uchar *)PyObject_Malloc(total); - if (p == NULL) - return NULL; - - /* at p, write size (SST bytes), id (1 byte), pad (SST-1 bytes) */ - write_size_t(p, nbytes); - p[SST] = (uchar)id; - memset(p + SST + 1 , FORBIDDENBYTE, SST-1); - - if (nbytes > 0) - memset(p + 2*SST, CLEANBYTE, nbytes); - - /* at tail, write pad (SST bytes) and serialno (SST bytes) */ - tail = p + 2*SST + nbytes; - memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, serialno); - - return p + 2*SST; -} - -/* The debug free first checks the 2*SST bytes on each end for sanity (in - particular, that the FORBIDDENBYTEs with the api ID are still intact). - Then fills the original bytes with DEADBYTE. - Then calls the underlying free. -*/ -void -_PyObject_DebugFreeApi(char api, void *p) -{ - uchar *q = (uchar *)p - 2*SST; /* address returned from malloc */ - size_t nbytes; - - if (p == NULL) - return; - _PyObject_DebugCheckAddressApi(api, p); - nbytes = read_size_t(q); - nbytes += 4*SST; - if (nbytes > 0) - memset(q, DEADBYTE, nbytes); - PyObject_Free(q); -} - -void * -_PyObject_DebugReallocApi(char api, void *p, size_t nbytes) -{ - uchar *q = (uchar *)p; - uchar *tail; - size_t total; /* nbytes + 4*SST */ - size_t original_nbytes; - int i; - - if (p == NULL) - return _PyObject_DebugMallocApi(api, nbytes); - - _PyObject_DebugCheckAddressApi(api, p); - bumpserialno(); - original_nbytes = read_size_t(q - 2*SST); - total = nbytes + 4*SST; - if (total < nbytes) - /* overflow: can't represent total as a size_t */ - return NULL; - - if (nbytes < original_nbytes) { - /* shrinking: mark old extra memory dead */ - memset(q + nbytes, DEADBYTE, original_nbytes - nbytes + 2*SST); - } - - /* Resize and add decorations. We may get a new pointer here, in which - * case we didn't get the chance to mark the old memory with DEADBYTE, - * but we live with that. - */ - q = (uchar *)PyObject_Realloc(q - 2*SST, total); - if (q == NULL) - return NULL; - - write_size_t(q, nbytes); - assert(q[SST] == (uchar)api); - for (i = 1; i < SST; ++i) - assert(q[SST + i] == FORBIDDENBYTE); - q += 2*SST; - tail = q + nbytes; - memset(tail, FORBIDDENBYTE, SST); - write_size_t(tail + SST, serialno); - - if (nbytes > original_nbytes) { - /* growing: mark new extra memory clean */ - memset(q + original_nbytes, CLEANBYTE, - nbytes - original_nbytes); - } - - return q; -} - -/* Check the forbidden bytes on both ends of the memory allocated for p. - * If anything is wrong, print info to stderr via _PyObject_DebugDumpAddress, - * and call Py_FatalError to kill the program. - * The API id, is also checked. - */ - void -_PyObject_DebugCheckAddressApi(char api, const void *p) -{ - const uchar *q = (const uchar *)p; - char msgbuf[64]; - char *msg; - size_t nbytes; - const uchar *tail; - int i; - char id; - - if (p == NULL) { - msg = "didn't expect a NULL pointer"; - goto error; - } - - /* Check the API id */ - id = (char)q[-SST]; - if (id != api) { - msg = msgbuf; - snprintf(msg, sizeof(msgbuf), "bad ID: Allocated using API '%c', verified using API '%c'", id, api); - msgbuf[sizeof(msgbuf)-1] = 0; - goto error; - } - - /* Check the stuff at the start of p first: if there's underwrite - * corruption, the number-of-bytes field may be nuts, and checking - * the tail could lead to a segfault then. - */ - for (i = SST-1; i >= 1; --i) { - if (*(q-i) != FORBIDDENBYTE) { - msg = "bad leading pad byte"; - goto error; - } - } - - nbytes = read_size_t(q - 2*SST); - tail = q + nbytes; - for (i = 0; i < SST; ++i) { - if (tail[i] != FORBIDDENBYTE) { - msg = "bad trailing pad byte"; - goto error; - } - } - - return; - -error: - _PyObject_DebugDumpAddress(p); - Py_FatalError(msg); -} - -/* Display info to stderr about the memory block at p. */ -void -_PyObject_DebugDumpAddress(const void *p) -{ - const uchar *q = (const uchar *)p; - const uchar *tail; - size_t nbytes, serial; - int i; - int ok; - char id; - - fprintf(stderr, "Debug memory block at address p=%p:", p); - if (p == NULL) { - fprintf(stderr, "\n"); - return; - } - id = (char)q[-SST]; - fprintf(stderr, " API '%c'\n", id); - - nbytes = read_size_t(q - 2*SST); - fprintf(stderr, " %" PY_FORMAT_SIZE_T "u bytes originally " - "requested\n", nbytes); - - /* In case this is nuts, check the leading pad bytes first. */ - fprintf(stderr, " The %d pad bytes at p-%d are ", SST-1, SST-1); - ok = 1; - for (i = 1; i <= SST-1; ++i) { - if (*(q-i) != FORBIDDENBYTE) { - ok = 0; - break; - } - } - if (ok) - fputs("FORBIDDENBYTE, as expected.\n", stderr); - else { - fprintf(stderr, "not all FORBIDDENBYTE (0x%02x):\n", - FORBIDDENBYTE); - for (i = SST-1; i >= 1; --i) { - const uchar byte = *(q-i); - fprintf(stderr, " at p-%d: 0x%02x", i, byte); - if (byte != FORBIDDENBYTE) - fputs(" *** OUCH", stderr); - fputc('\n', stderr); - } - - fputs(" Because memory is corrupted at the start, the " - "count of bytes requested\n" - " may be bogus, and checking the trailing pad " - "bytes may segfault.\n", stderr); - } - - tail = q + nbytes; - fprintf(stderr, " The %d pad bytes at tail=%p are ", SST, tail); - ok = 1; - for (i = 0; i < SST; ++i) { - if (tail[i] != FORBIDDENBYTE) { - ok = 0; - break; - } - } - if (ok) - fputs("FORBIDDENBYTE, as expected.\n", stderr); - else { - fprintf(stderr, "not all FORBIDDENBYTE (0x%02x):\n", - FORBIDDENBYTE); - for (i = 0; i < SST; ++i) { - const uchar byte = tail[i]; - fprintf(stderr, " at tail+%d: 0x%02x", - i, byte); - if (byte != FORBIDDENBYTE) - fputs(" *** OUCH", stderr); - fputc('\n', stderr); - } - } - - serial = read_size_t(tail + SST); - fprintf(stderr, " The block was made by call #%" PY_FORMAT_SIZE_T - "u to debug malloc/realloc.\n", serial); - - if (nbytes > 0) { - i = 0; - fputs(" Data at p:", stderr); - /* print up to 8 bytes at the start */ - while (q < tail && i < 8) { - fprintf(stderr, " %02x", *q); - ++i; - ++q; - } - /* and up to 8 at the end */ - if (q < tail) { - if (tail - q > 8) { - fputs(" ...", stderr); - q = tail - 8; - } - while (q < tail) { - fprintf(stderr, " %02x", *q); - ++q; - } - } - fputc('\n', stderr); - } -} - -static size_t -printone(const char* msg, size_t value) -{ - int i, k; - char buf[100]; - size_t origvalue = value; - - fputs(msg, stderr); - for (i = (int)strlen(msg); i < 35; ++i) - fputc(' ', stderr); - fputc('=', stderr); - - /* Write the value with commas. */ - i = 22; - buf[i--] = '\0'; - buf[i--] = '\n'; - k = 3; - do { - size_t nextvalue = value / 10; - unsigned int digit = (unsigned int)(value - nextvalue * 10); - value = nextvalue; - buf[i--] = (char)(digit + '0'); - --k; - if (k == 0 && value && i >= 0) { - k = 3; - buf[i--] = ','; - } - } while (value && i >= 0); - - while (i >= 0) - buf[i--] = ' '; - fputs(buf, stderr); - - return origvalue; -} - -/* Print summary info to stderr about the state of pymalloc's structures. - * In Py_DEBUG mode, also perform some expensive internal consistency - * checks. - */ -void -_PyObject_DebugMallocStats(void) -{ - uint i; - const uint numclasses = SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT; - /* # of pools, allocated blocks, and free blocks per class index */ - size_t numpools[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; - size_t numblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; - size_t numfreeblocks[SMALL_REQUEST_THRESHOLD >> ALIGNMENT_SHIFT]; - /* total # of allocated bytes in used and full pools */ - size_t allocated_bytes = 0; - /* total # of available bytes in used pools */ - size_t available_bytes = 0; - /* # of free pools + pools not yet carved out of current arena */ - uint numfreepools = 0; - /* # of bytes for arena alignment padding */ - size_t arena_alignment = 0; - /* # of bytes in used and full pools used for pool_headers */ - size_t pool_header_bytes = 0; - /* # of bytes in used and full pools wasted due to quantization, - * i.e. the necessarily leftover space at the ends of used and - * full pools. - */ - size_t quantization = 0; - /* # of arenas actually allocated. */ - size_t narenas = 0; - /* running total -- should equal narenas * ARENA_SIZE */ - size_t total; - char buf[128]; - - fprintf(stderr, "Small block threshold = %d, in %u size classes.\n", - SMALL_REQUEST_THRESHOLD, numclasses); - - for (i = 0; i < numclasses; ++i) - numpools[i] = numblocks[i] = numfreeblocks[i] = 0; - - /* Because full pools aren't linked to from anything, it's easiest - * to march over all the arenas. If we're lucky, most of the memory - * will be living in full pools -- would be a shame to miss them. - */ - for (i = 0; i < maxarenas; ++i) { - uint j; - uptr base = arenas[i].address; - - /* Skip arenas which are not allocated. */ - if (arenas[i].address == (uptr)NULL) - continue; - narenas += 1; - - numfreepools += arenas[i].nfreepools; - - /* round up to pool alignment */ - if (base & (uptr)POOL_SIZE_MASK) { - arena_alignment += POOL_SIZE; - base &= ~(uptr)POOL_SIZE_MASK; - base += POOL_SIZE; - } - - /* visit every pool in the arena */ - assert(base <= (uptr) arenas[i].pool_address); - for (j = 0; - base < (uptr) arenas[i].pool_address; - ++j, base += POOL_SIZE) { - poolp p = (poolp)base; - const uint sz = p->szidx; - uint freeblocks; - - if (p->ref.count == 0) { - /* currently unused */ - assert(pool_is_in_list(p, arenas[i].freepools)); - continue; - } - ++numpools[sz]; - numblocks[sz] += p->ref.count; - freeblocks = NUMBLOCKS(sz) - p->ref.count; - numfreeblocks[sz] += freeblocks; -#ifdef Py_DEBUG - if (freeblocks > 0) - assert(pool_is_in_list(p, usedpools[sz + sz])); -#endif - } - } - assert(narenas == narenas_currently_allocated); - - fputc('\n', stderr); - fputs("class size num pools blocks in use avail blocks\n" - "----- ---- --------- ------------- ------------\n", - stderr); - - for (i = 0; i < numclasses; ++i) { - size_t p = numpools[i]; - size_t b = numblocks[i]; - size_t f = numfreeblocks[i]; - uint size = INDEX2SIZE(i); - if (p == 0) { - assert(b == 0 && f == 0); - continue; - } - fprintf(stderr, "%5u %6u " - "%11" PY_FORMAT_SIZE_T "u " - "%15" PY_FORMAT_SIZE_T "u " - "%13" PY_FORMAT_SIZE_T "u\n", - i, size, p, b, f); - allocated_bytes += b * size; - available_bytes += f * size; - pool_header_bytes += p * POOL_OVERHEAD; - quantization += p * ((POOL_SIZE - POOL_OVERHEAD) % size); - } - fputc('\n', stderr); - (void)printone("# times object malloc called", serialno); - - (void)printone("# arenas allocated total", ntimes_arena_allocated); - (void)printone("# arenas reclaimed", ntimes_arena_allocated - narenas); - (void)printone("# arenas highwater mark", narenas_highwater); - (void)printone("# arenas allocated current", narenas); - - PyOS_snprintf(buf, sizeof(buf), - "%" PY_FORMAT_SIZE_T "u arenas * %d bytes/arena", - narenas, ARENA_SIZE); - (void)printone(buf, narenas * ARENA_SIZE); - - fputc('\n', stderr); - - total = printone("# bytes in allocated blocks", allocated_bytes); - total += printone("# bytes in available blocks", available_bytes); - - PyOS_snprintf(buf, sizeof(buf), - "%u unused pools * %d bytes", numfreepools, POOL_SIZE); - total += printone(buf, (size_t)numfreepools * POOL_SIZE); - - total += printone("# bytes lost to pool headers", pool_header_bytes); - total += printone("# bytes lost to quantization", quantization); - total += printone("# bytes lost to arena alignment", arena_alignment); - (void)printone("Total", total); -} - -#endif /* PYMALLOC_DEBUG */ - -#ifdef Py_USING_MEMORY_DEBUGGER -/* Make this function last so gcc won't inline it since the definition is - * after the reference. - */ -int -Py_ADDRESS_IN_RANGE(void *P, poolp pool) -{ - uint arenaindex_temp = pool->arenaindex; - - return arenaindex_temp < maxarenas && - (uptr)P - arenas[arenaindex_temp].address < (uptr)ARENA_SIZE && - arenas[arenaindex_temp].address != 0; -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/rangeobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/rangeobject.c deleted file mode 100644 index ae8cb67..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/rangeobject.c +++ /dev/null @@ -1,347 +0,0 @@ -/* Range object implementation */ - -#include "Python.h" - -typedef struct { - PyObject_HEAD - long start; - long step; - long len; -} rangeobject; - -/* Return number of items in range (lo, hi, step). step != 0 - * required. The result always fits in an unsigned long. - */ -static unsigned long -get_len_of_range(long lo, long hi, long step) -{ - /* ------------------------------------------------------------- - If step > 0 and lo >= hi, or step < 0 and lo <= hi, the range is empty. - Else for step > 0, if n values are in the range, the last one is - lo + (n-1)*step, which must be <= hi-1. Rearranging, - n <= (hi - lo - 1)/step + 1, so taking the floor of the RHS gives - the proper value. Since lo < hi in this case, hi-lo-1 >= 0, so - the RHS is non-negative and so truncation is the same as the - floor. Letting M be the largest positive long, the worst case - for the RHS numerator is hi=M, lo=-M-1, and then - hi-lo-1 = M-(-M-1)-1 = 2*M. Therefore unsigned long has enough - precision to compute the RHS exactly. The analysis for step < 0 - is similar. - ---------------------------------------------------------------*/ - assert(step != 0); - if (step > 0 && lo < hi) - return 1UL + (hi - 1UL - lo) / step; - else if (step < 0 && lo > hi) - return 1UL + (lo - 1UL - hi) / (0UL - step); - else - return 0UL; -} - -/* Return a stop value suitable for reconstructing the xrange from - * a (start, stop, step) triple. Used in range_repr and range_reduce. - * Computes start + len * step, clipped to the range [LONG_MIN, LONG_MAX]. - */ -static long -get_stop_for_range(rangeobject *r) -{ - long last; - - if (r->len == 0) - return r->start; - - /* The tricky bit is avoiding overflow. We first compute the last entry in - the xrange, start + (len - 1) * step, which is guaranteed to lie within - the range of a long, and then add step to it. See the range_reverse - comments for an explanation of the casts below. - */ - last = (long)(r->start + (unsigned long)(r->len - 1) * r->step); - if (r->step > 0) - return last > LONG_MAX - r->step ? LONG_MAX : last + r->step; - else - return last < LONG_MIN - r->step ? LONG_MIN : last + r->step; -} - -static PyObject * -range_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - rangeobject *obj; - long ilow = 0, ihigh = 0, istep = 1; - unsigned long n; - - if (!_PyArg_NoKeywords("xrange()", kw)) - return NULL; - - if (PyTuple_Size(args) <= 1) { - if (!PyArg_ParseTuple(args, - "l;xrange() requires 1-3 int arguments", - &ihigh)) - return NULL; - } - else { - if (!PyArg_ParseTuple(args, - "ll|l;xrange() requires 1-3 int arguments", - &ilow, &ihigh, &istep)) - return NULL; - } - if (istep == 0) { - PyErr_SetString(PyExc_ValueError, "xrange() arg 3 must not be zero"); - return NULL; - } - n = get_len_of_range(ilow, ihigh, istep); - if (n > (unsigned long)LONG_MAX || (long)n > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "xrange() result has too many items"); - return NULL; - } - - obj = PyObject_New(rangeobject, &PyRange_Type); - if (obj == NULL) - return NULL; - obj->start = ilow; - obj->len = (long)n; - obj->step = istep; - return (PyObject *) obj; -} - -PyDoc_STRVAR(range_doc, -"xrange(stop) -> xrange object\n\ -xrange(start, stop[, step]) -> xrange object\n\ -\n\ -Like range(), but instead of returning a list, returns an object that\n\ -generates the numbers in the range on demand. For looping, this is \n\ -slightly faster than range() and more memory efficient."); - -static PyObject * -range_item(rangeobject *r, Py_ssize_t i) -{ - if (i < 0 || i >= r->len) { - PyErr_SetString(PyExc_IndexError, - "xrange object index out of range"); - return NULL; - } - /* do calculation entirely using unsigned longs, to avoid - undefined behaviour due to signed overflow. */ - return PyInt_FromLong((long)(r->start + (unsigned long)i * r->step)); -} - -static Py_ssize_t -range_length(rangeobject *r) -{ - return (Py_ssize_t)(r->len); -} - -static PyObject * -range_repr(rangeobject *r) -{ - PyObject *rtn; - - if (r->start == 0 && r->step == 1) - rtn = PyString_FromFormat("xrange(%ld)", - get_stop_for_range(r)); - - else if (r->step == 1) - rtn = PyString_FromFormat("xrange(%ld, %ld)", - r->start, - get_stop_for_range(r)); - - else - rtn = PyString_FromFormat("xrange(%ld, %ld, %ld)", - r->start, - get_stop_for_range(r), - r->step); - return rtn; -} - -/* Pickling support */ -static PyObject * -range_reduce(rangeobject *r, PyObject *args) -{ - return Py_BuildValue("(O(lll))", Py_TYPE(r), - r->start, - get_stop_for_range(r), - r->step); -} - -static PySequenceMethods range_as_sequence = { - (lenfunc)range_length, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - (ssizeargfunc)range_item, /* sq_item */ - 0, /* sq_slice */ -}; - -static PyObject * range_iter(PyObject *seq); -static PyObject * range_reverse(PyObject *seq); - -PyDoc_STRVAR(reverse_doc, -"Returns a reverse iterator."); - -static PyMethodDef range_methods[] = { - {"__reversed__", (PyCFunction)range_reverse, METH_NOARGS, reverse_doc}, - {"__reduce__", (PyCFunction)range_reduce, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyRange_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* Number of items for varobject */ - "xrange", /* Name of this type */ - sizeof(rangeobject), /* Basic object size */ - 0, /* Item size for varobject */ - (destructor)PyObject_Del, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)range_repr, /* tp_repr */ - 0, /* tp_as_number */ - &range_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - range_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - range_iter, /* tp_iter */ - 0, /* tp_iternext */ - range_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - range_new, /* tp_new */ -}; - -/*********************** Xrange Iterator **************************/ - -typedef struct { - PyObject_HEAD - long index; - long start; - long step; - long len; -} rangeiterobject; - -static PyObject * -rangeiter_next(rangeiterobject *r) -{ - if (r->index < r->len) - return PyInt_FromLong(r->start + (r->index++) * r->step); - return NULL; -} - -static PyObject * -rangeiter_len(rangeiterobject *r) -{ - return PyInt_FromLong(r->len - r->index); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef rangeiter_methods[] = { - {"__length_hint__", (PyCFunction)rangeiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject Pyrangeiter_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ - "rangeiterator", /* tp_name */ - sizeof(rangeiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)PyObject_Del, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)rangeiter_next, /* tp_iternext */ - rangeiter_methods, /* tp_methods */ - 0, -}; - -static PyObject * -range_iter(PyObject *seq) -{ - rangeiterobject *it; - - if (!PyRange_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_New(rangeiterobject, &Pyrangeiter_Type); - if (it == NULL) - return NULL; - it->index = 0; - it->start = ((rangeobject *)seq)->start; - it->step = ((rangeobject *)seq)->step; - it->len = ((rangeobject *)seq)->len; - return (PyObject *)it; -} - -static PyObject * -range_reverse(PyObject *seq) -{ - rangeiterobject *it; - long start, step, len; - - if (!PyRange_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_New(rangeiterobject, &Pyrangeiter_Type); - if (it == NULL) - return NULL; - - start = ((rangeobject *)seq)->start; - step = ((rangeobject *)seq)->step; - len = ((rangeobject *)seq)->len; - - it->index = 0; - it->len = len; - /* the casts below guard against signed overflow by turning it - into unsigned overflow instead. The correctness of this - code still depends on conversion from unsigned long to long - wrapping modulo ULONG_MAX+1, which isn't guaranteed (see - C99 6.3.1.3p3) but seems to hold in practice for all - platforms we're likely to meet. - - If step == LONG_MIN then we still end up with LONG_MIN - after negation; but this works out, since we've still got - the correct value modulo ULONG_MAX+1, and the range_item - calculation is also done modulo ULONG_MAX+1. - */ - it->start = (long)(start + (unsigned long)(len-1) * step); - it->step = (long)(0UL-step); - - return (PyObject *)it; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/setobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/setobject.c deleted file mode 100644 index 6428530..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/setobject.c +++ /dev/null @@ -1,2514 +0,0 @@ - -/* set object implementation - Written and maintained by Raymond D. Hettinger - Derived from Lib/sets.py and Objects/dictobject.c. - - Copyright (c) 2003-2007 Python Software Foundation. - All rights reserved. -*/ - -#include "Python.h" -#include "structmember.h" - -/* Set a key error with the specified argument, wrapping it in a - * tuple automatically so that tuple keys are not unpacked as the - * exception arguments. */ -static void -set_key_error(PyObject *arg) -{ - PyObject *tup; - tup = PyTuple_Pack(1, arg); - if (!tup) - return; /* caller will expect error to be set anyway */ - PyErr_SetObject(PyExc_KeyError, tup); - Py_DECREF(tup); -} - -/* This must be >= 1. */ -#define PERTURB_SHIFT 5 - -/* Object used as dummy key to fill deleted entries */ -static PyObject *dummy = NULL; /* Initialized by first call to make_new_set() */ - -#ifdef Py_REF_DEBUG -PyObject * -_PySet_Dummy(void) -{ - return dummy; -} -#endif - -#define INIT_NONZERO_SET_SLOTS(so) do { \ - (so)->table = (so)->smalltable; \ - (so)->mask = PySet_MINSIZE - 1; \ - (so)->hash = -1; \ - } while(0) - -#define EMPTY_TO_MINSIZE(so) do { \ - memset((so)->smalltable, 0, sizeof((so)->smalltable)); \ - (so)->used = (so)->fill = 0; \ - INIT_NONZERO_SET_SLOTS(so); \ - } while(0) - -/* Reuse scheme to save calls to malloc, free, and memset */ -#ifndef PySet_MAXFREELIST -#define PySet_MAXFREELIST 80 -#endif -static PySetObject *free_list[PySet_MAXFREELIST]; -static int numfree = 0; - -/* -The basic lookup function used by all operations. -This is based on Algorithm D from Knuth Vol. 3, Sec. 6.4. -Open addressing is preferred over chaining since the link overhead for -chaining would be substantial (100% with typical malloc overhead). - -The initial probe index is computed as hash mod the table size. Subsequent -probe indices are computed as explained in Objects/dictobject.c. - -All arithmetic on hash should ignore overflow. - -Unlike the dictionary implementation, the lookkey functions can return -NULL if the rich comparison returns an error. -*/ - -static setentry * -set_lookkey(PySetObject *so, PyObject *key, register long hash) -{ - register Py_ssize_t i; - register size_t perturb; - register setentry *freeslot; - register size_t mask = so->mask; - setentry *table = so->table; - register setentry *entry; - register int cmp; - PyObject *startkey; - - i = hash & mask; - entry = &table[i]; - if (entry->key == NULL || entry->key == key) - return entry; - - if (entry->key == dummy) - freeslot = entry; - else { - if (entry->hash == hash) { - startkey = entry->key; - Py_INCREF(startkey); - cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); - Py_DECREF(startkey); - if (cmp < 0) - return NULL; - if (table == so->table && entry->key == startkey) { - if (cmp > 0) - return entry; - } - else { - /* The compare did major nasty stuff to the - * set: start over. - */ - return set_lookkey(so, key, hash); - } - } - freeslot = NULL; - } - - /* In the loop, key == dummy is by far (factor of 100s) the - least likely outcome, so test for that last. */ - for (perturb = hash; ; perturb >>= PERTURB_SHIFT) { - i = (i << 2) + i + perturb + 1; - entry = &table[i & mask]; - if (entry->key == NULL) { - if (freeslot != NULL) - entry = freeslot; - break; - } - if (entry->key == key) - break; - if (entry->hash == hash && entry->key != dummy) { - startkey = entry->key; - Py_INCREF(startkey); - cmp = PyObject_RichCompareBool(startkey, key, Py_EQ); - Py_DECREF(startkey); - if (cmp < 0) - return NULL; - if (table == so->table && entry->key == startkey) { - if (cmp > 0) - break; - } - else { - /* The compare did major nasty stuff to the - * set: start over. - */ - return set_lookkey(so, key, hash); - } - } - else if (entry->key == dummy && freeslot == NULL) - freeslot = entry; - } - return entry; -} - -/* - * Hacked up version of set_lookkey which can assume keys are always strings; - * This means we can always use _PyString_Eq directly and not have to check to - * see if the comparison altered the table. - */ -static setentry * -set_lookkey_string(PySetObject *so, PyObject *key, register long hash) -{ - register Py_ssize_t i; - register size_t perturb; - register setentry *freeslot; - register size_t mask = so->mask; - setentry *table = so->table; - register setentry *entry; - - /* Make sure this function doesn't have to handle non-string keys, - including subclasses of str; e.g., one reason to subclass - strings is to override __eq__, and for speed we don't cater to - that here. */ - if (!PyString_CheckExact(key)) { - so->lookup = set_lookkey; - return set_lookkey(so, key, hash); - } - i = hash & mask; - entry = &table[i]; - if (entry->key == NULL || entry->key == key) - return entry; - if (entry->key == dummy) - freeslot = entry; - else { - if (entry->hash == hash && _PyString_Eq(entry->key, key)) - return entry; - freeslot = NULL; - } - - /* In the loop, key == dummy is by far (factor of 100s) the - least likely outcome, so test for that last. */ - for (perturb = hash; ; perturb >>= PERTURB_SHIFT) { - i = (i << 2) + i + perturb + 1; - entry = &table[i & mask]; - if (entry->key == NULL) - return freeslot == NULL ? entry : freeslot; - if (entry->key == key - || (entry->hash == hash - && entry->key != dummy - && _PyString_Eq(entry->key, key))) - return entry; - if (entry->key == dummy && freeslot == NULL) - freeslot = entry; - } - assert(0); /* NOT REACHED */ - return 0; -} - -/* -Internal routine to insert a new key into the table. -Used by the public insert routine. -Eats a reference to key. -*/ -static int -set_insert_key(register PySetObject *so, PyObject *key, long hash) -{ - register setentry *entry; - - assert(so->lookup != NULL); - entry = so->lookup(so, key, hash); - if (entry == NULL) - return -1; - if (entry->key == NULL) { - /* UNUSED */ - so->fill++; - entry->key = key; - entry->hash = hash; - so->used++; - } else if (entry->key == dummy) { - /* DUMMY */ - entry->key = key; - entry->hash = hash; - so->used++; - Py_DECREF(dummy); - } else { - /* ACTIVE */ - Py_DECREF(key); - } - return 0; -} - -/* -Internal routine used by set_table_resize() to insert an item which is -known to be absent from the set. This routine also assumes that -the set contains no deleted entries. Besides the performance benefit, -using set_insert_clean() in set_table_resize() is dangerous (SF bug #1456209). -Note that no refcounts are changed by this routine; if needed, the caller -is responsible for incref'ing `key`. -*/ -static void -set_insert_clean(register PySetObject *so, PyObject *key, long hash) -{ - register size_t i; - register size_t perturb; - register size_t mask = (size_t)so->mask; - setentry *table = so->table; - register setentry *entry; - - i = hash & mask; - entry = &table[i]; - for (perturb = hash; entry->key != NULL; perturb >>= PERTURB_SHIFT) { - i = (i << 2) + i + perturb + 1; - entry = &table[i & mask]; - } - so->fill++; - entry->key = key; - entry->hash = hash; - so->used++; -} - -/* -Restructure the table by allocating a new table and reinserting all -keys again. When entries have been deleted, the new table may -actually be smaller than the old one. -*/ -static int -set_table_resize(PySetObject *so, Py_ssize_t minused) -{ - Py_ssize_t newsize; - setentry *oldtable, *newtable, *entry; - Py_ssize_t i; - int is_oldtable_malloced; - setentry small_copy[PySet_MINSIZE]; - - assert(minused >= 0); - - /* Find the smallest table size > minused. */ - for (newsize = PySet_MINSIZE; - newsize <= minused && newsize > 0; - newsize <<= 1) - ; - if (newsize <= 0) { - PyErr_NoMemory(); - return -1; - } - - /* Get space for a new table. */ - oldtable = so->table; - assert(oldtable != NULL); - is_oldtable_malloced = oldtable != so->smalltable; - - if (newsize == PySet_MINSIZE) { - /* A large table is shrinking, or we can't get any smaller. */ - newtable = so->smalltable; - if (newtable == oldtable) { - if (so->fill == so->used) { - /* No dummies, so no point doing anything. */ - return 0; - } - /* We're not going to resize it, but rebuild the - table anyway to purge old dummy entries. - Subtle: This is *necessary* if fill==size, - as set_lookkey needs at least one virgin slot to - terminate failing searches. If fill < size, it's - merely desirable, as dummies slow searches. */ - assert(so->fill > so->used); - memcpy(small_copy, oldtable, sizeof(small_copy)); - oldtable = small_copy; - } - } - else { - newtable = PyMem_NEW(setentry, newsize); - if (newtable == NULL) { - PyErr_NoMemory(); - return -1; - } - } - - /* Make the set empty, using the new table. */ - assert(newtable != oldtable); - so->table = newtable; - so->mask = newsize - 1; - memset(newtable, 0, sizeof(setentry) * newsize); - so->used = 0; - i = so->fill; - so->fill = 0; - - /* Copy the data over; this is refcount-neutral for active entries; - dummy entries aren't copied over, of course */ - for (entry = oldtable; i > 0; entry++) { - if (entry->key == NULL) { - /* UNUSED */ - ; - } else if (entry->key == dummy) { - /* DUMMY */ - --i; - assert(entry->key == dummy); - Py_DECREF(entry->key); - } else { - /* ACTIVE */ - --i; - set_insert_clean(so, entry->key, entry->hash); - } - } - - if (is_oldtable_malloced) - PyMem_DEL(oldtable); - return 0; -} - -/* CAUTION: set_add_key/entry() must guarantee it won't resize the table */ - -static int -set_add_entry(register PySetObject *so, setentry *entry) -{ - register Py_ssize_t n_used; - PyObject *key = entry->key; - long hash = entry->hash; - - assert(so->fill <= so->mask); /* at least one empty slot */ - n_used = so->used; - Py_INCREF(key); - if (set_insert_key(so, key, hash) == -1) { - Py_DECREF(key); - return -1; - } - if (!(so->used > n_used && so->fill*3 >= (so->mask+1)*2)) - return 0; - return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4); -} - -static int -set_add_key(register PySetObject *so, PyObject *key) -{ - register long hash; - register Py_ssize_t n_used; - - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return -1; - } - assert(so->fill <= so->mask); /* at least one empty slot */ - n_used = so->used; - Py_INCREF(key); - if (set_insert_key(so, key, hash) == -1) { - Py_DECREF(key); - return -1; - } - if (!(so->used > n_used && so->fill*3 >= (so->mask+1)*2)) - return 0; - return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4); -} - -#define DISCARD_NOTFOUND 0 -#define DISCARD_FOUND 1 - -static int -set_discard_entry(PySetObject *so, setentry *oldentry) -{ register setentry *entry; - PyObject *old_key; - - entry = (so->lookup)(so, oldentry->key, oldentry->hash); - if (entry == NULL) - return -1; - if (entry->key == NULL || entry->key == dummy) - return DISCARD_NOTFOUND; - old_key = entry->key; - Py_INCREF(dummy); - entry->key = dummy; - so->used--; - Py_DECREF(old_key); - return DISCARD_FOUND; -} - -static int -set_discard_key(PySetObject *so, PyObject *key) -{ - register long hash; - register setentry *entry; - PyObject *old_key; - - assert (PyAnySet_Check(so)); - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return -1; - } - entry = (so->lookup)(so, key, hash); - if (entry == NULL) - return -1; - if (entry->key == NULL || entry->key == dummy) - return DISCARD_NOTFOUND; - old_key = entry->key; - Py_INCREF(dummy); - entry->key = dummy; - so->used--; - Py_DECREF(old_key); - return DISCARD_FOUND; -} - -static int -set_clear_internal(PySetObject *so) -{ - setentry *entry, *table; - int table_is_malloced; - Py_ssize_t fill; - setentry small_copy[PySet_MINSIZE]; -#ifdef Py_DEBUG - Py_ssize_t i, n; - assert (PyAnySet_Check(so)); - - n = so->mask + 1; - i = 0; -#endif - - table = so->table; - assert(table != NULL); - table_is_malloced = table != so->smalltable; - - /* This is delicate. During the process of clearing the set, - * decrefs can cause the set to mutate. To avoid fatal confusion - * (voice of experience), we have to make the set empty before - * clearing the slots, and never refer to anything via so->ref while - * clearing. - */ - fill = so->fill; - if (table_is_malloced) - EMPTY_TO_MINSIZE(so); - - else if (fill > 0) { - /* It's a small table with something that needs to be cleared. - * Afraid the only safe way is to copy the set entries into - * another small table first. - */ - memcpy(small_copy, table, sizeof(small_copy)); - table = small_copy; - EMPTY_TO_MINSIZE(so); - } - /* else it's a small table that's already empty */ - - /* Now we can finally clear things. If C had refcounts, we could - * assert that the refcount on table is 1 now, i.e. that this function - * has unique access to it, so decref side-effects can't alter it. - */ - for (entry = table; fill > 0; ++entry) { -#ifdef Py_DEBUG - assert(i < n); - ++i; -#endif - if (entry->key) { - --fill; - Py_DECREF(entry->key); - } -#ifdef Py_DEBUG - else - assert(entry->key == NULL); -#endif - } - - if (table_is_malloced) - PyMem_DEL(table); - return 0; -} - -/* - * Iterate over a set table. Use like so: - * - * Py_ssize_t pos; - * setentry *entry; - * pos = 0; # important! pos should not otherwise be changed by you - * while (set_next(yourset, &pos, &entry)) { - * Refer to borrowed reference in entry->key. - * } - * - * CAUTION: In general, it isn't safe to use set_next in a loop that - * mutates the table. - */ -static int -set_next(PySetObject *so, Py_ssize_t *pos_ptr, setentry **entry_ptr) -{ - Py_ssize_t i; - Py_ssize_t mask; - register setentry *table; - - assert (PyAnySet_Check(so)); - i = *pos_ptr; - assert(i >= 0); - table = so->table; - mask = so->mask; - while (i <= mask && (table[i].key == NULL || table[i].key == dummy)) - i++; - *pos_ptr = i+1; - if (i > mask) - return 0; - assert(table[i].key != NULL); - *entry_ptr = &table[i]; - return 1; -} - -static void -set_dealloc(PySetObject *so) -{ - register setentry *entry; - Py_ssize_t fill = so->fill; - PyObject_GC_UnTrack(so); - Py_TRASHCAN_SAFE_BEGIN(so) - if (so->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) so); - - for (entry = so->table; fill > 0; entry++) { - if (entry->key) { - --fill; - Py_DECREF(entry->key); - } - } - if (so->table != so->smalltable) - PyMem_DEL(so->table); - if (numfree < PySet_MAXFREELIST && PyAnySet_CheckExact(so)) - free_list[numfree++] = so; - else - Py_TYPE(so)->tp_free(so); - Py_TRASHCAN_SAFE_END(so) -} - -static int -set_tp_print(PySetObject *so, FILE *fp, int flags) -{ - setentry *entry; - Py_ssize_t pos=0; - char *emit = ""; /* No separator emitted on first pass */ - char *separator = ", "; - int status = Py_ReprEnter((PyObject*)so); - - if (status != 0) { - if (status < 0) - return status; - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "%s(...)", so->ob_type->tp_name); - Py_END_ALLOW_THREADS - return 0; - } - - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "%s([", so->ob_type->tp_name); - Py_END_ALLOW_THREADS - while (set_next(so, &pos, &entry)) { - Py_BEGIN_ALLOW_THREADS - fputs(emit, fp); - Py_END_ALLOW_THREADS - emit = separator; - if (PyObject_Print(entry->key, fp, 0) != 0) { - Py_ReprLeave((PyObject*)so); - return -1; - } - } - Py_BEGIN_ALLOW_THREADS - fputs("])", fp); - Py_END_ALLOW_THREADS - Py_ReprLeave((PyObject*)so); - return 0; -} - -static PyObject * -set_repr(PySetObject *so) -{ - PyObject *keys, *result=NULL, *listrepr; - int status = Py_ReprEnter((PyObject*)so); - - if (status != 0) { - if (status < 0) - return NULL; - return PyString_FromFormat("%s(...)", so->ob_type->tp_name); - } - - keys = PySequence_List((PyObject *)so); - if (keys == NULL) - goto done; - listrepr = PyObject_Repr(keys); - Py_DECREF(keys); - if (listrepr == NULL) - goto done; - - result = PyString_FromFormat("%s(%s)", so->ob_type->tp_name, - PyString_AS_STRING(listrepr)); - Py_DECREF(listrepr); -done: - Py_ReprLeave((PyObject*)so); - return result; -} - -static Py_ssize_t -set_len(PyObject *so) -{ - return ((PySetObject *)so)->used; -} - -static int -set_merge(PySetObject *so, PyObject *otherset) -{ - PySetObject *other; - PyObject *key; - long hash; - register Py_ssize_t i; - register setentry *entry; - - assert (PyAnySet_Check(so)); - assert (PyAnySet_Check(otherset)); - - other = (PySetObject*)otherset; - if (other == so || other->used == 0) - /* a.update(a) or a.update({}); nothing to do */ - return 0; - /* Do one big resize at the start, rather than - * incrementally resizing as we insert new keys. Expect - * that there will be no (or few) overlapping keys. - */ - if ((so->fill + other->used)*3 >= (so->mask+1)*2) { - if (set_table_resize(so, (so->used + other->used)*2) != 0) - return -1; - } - for (i = 0; i <= other->mask; i++) { - entry = &other->table[i]; - key = entry->key; - hash = entry->hash; - if (key != NULL && - key != dummy) { - Py_INCREF(key); - if (set_insert_key(so, key, hash) == -1) { - Py_DECREF(key); - return -1; - } - } - } - return 0; -} - -static int -set_contains_key(PySetObject *so, PyObject *key) -{ - long hash; - setentry *entry; - - if (!PyString_CheckExact(key) || - (hash = ((PyStringObject *) key)->ob_shash) == -1) { - hash = PyObject_Hash(key); - if (hash == -1) - return -1; - } - entry = (so->lookup)(so, key, hash); - if (entry == NULL) - return -1; - key = entry->key; - return key != NULL && key != dummy; -} - -static int -set_contains_entry(PySetObject *so, setentry *entry) -{ - PyObject *key; - setentry *lu_entry; - - lu_entry = (so->lookup)(so, entry->key, entry->hash); - if (lu_entry == NULL) - return -1; - key = lu_entry->key; - return key != NULL && key != dummy; -} - -static PyObject * -set_pop(PySetObject *so) -{ - register Py_ssize_t i = 0; - register setentry *entry; - PyObject *key; - - assert (PyAnySet_Check(so)); - if (so->used == 0) { - PyErr_SetString(PyExc_KeyError, "pop from an empty set"); - return NULL; - } - - /* Set entry to "the first" unused or dummy set entry. We abuse - * the hash field of slot 0 to hold a search finger: - * If slot 0 has a value, use slot 0. - * Else slot 0 is being used to hold a search finger, - * and we use its hash value as the first index to look. - */ - entry = &so->table[0]; - if (entry->key == NULL || entry->key == dummy) { - i = entry->hash; - /* The hash field may be a real hash value, or it may be a - * legit search finger, or it may be a once-legit search - * finger that's out of bounds now because it wrapped around - * or the table shrunk -- simply make sure it's in bounds now. - */ - if (i > so->mask || i < 1) - i = 1; /* skip slot 0 */ - while ((entry = &so->table[i])->key == NULL || entry->key==dummy) { - i++; - if (i > so->mask) - i = 1; - } - } - key = entry->key; - Py_INCREF(dummy); - entry->key = dummy; - so->used--; - so->table[0].hash = i + 1; /* next place to start */ - return key; -} - -PyDoc_STRVAR(pop_doc, "Remove and return an arbitrary set element.\n\ -Raises KeyError if the set is empty."); - -static int -set_traverse(PySetObject *so, visitproc visit, void *arg) -{ - Py_ssize_t pos = 0; - setentry *entry; - - while (set_next(so, &pos, &entry)) - Py_VISIT(entry->key); - return 0; -} - -static long -frozenset_hash(PyObject *self) -{ - PySetObject *so = (PySetObject *)self; - long h, hash = 1927868237L; - setentry *entry; - Py_ssize_t pos = 0; - - if (so->hash != -1) - return so->hash; - - hash *= PySet_GET_SIZE(self) + 1; - while (set_next(so, &pos, &entry)) { - /* Work to increase the bit dispersion for closely spaced hash - values. The is important because some use cases have many - combinations of a small number of elements with nearby - hashes so that many distinct combinations collapse to only - a handful of distinct hash values. */ - h = entry->hash; - hash ^= (h ^ (h << 16) ^ 89869747L) * 3644798167u; - } - hash = hash * 69069L + 907133923L; - if (hash == -1) - hash = 590923713L; - so->hash = hash; - return hash; -} - -/***** Set iterator type ***********************************************/ - -typedef struct { - PyObject_HEAD - PySetObject *si_set; /* Set to NULL when iterator is exhausted */ - Py_ssize_t si_used; - Py_ssize_t si_pos; - Py_ssize_t len; -} setiterobject; - -static void -setiter_dealloc(setiterobject *si) -{ - Py_XDECREF(si->si_set); - PyObject_GC_Del(si); -} - -static int -setiter_traverse(setiterobject *si, visitproc visit, void *arg) -{ - Py_VISIT(si->si_set); - return 0; -} - -static PyObject * -setiter_len(setiterobject *si) -{ - Py_ssize_t len = 0; - if (si->si_set != NULL && si->si_used == si->si_set->used) - len = si->len; - return PyInt_FromLong(len); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef setiter_methods[] = { - {"__length_hint__", (PyCFunction)setiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject *setiter_iternext(setiterobject *si) -{ - PyObject *key; - register Py_ssize_t i, mask; - register setentry *entry; - PySetObject *so = si->si_set; - - if (so == NULL) - return NULL; - assert (PyAnySet_Check(so)); - - if (si->si_used != so->used) { - PyErr_SetString(PyExc_RuntimeError, - "Set changed size during iteration"); - si->si_used = -1; /* Make this state sticky */ - return NULL; - } - - i = si->si_pos; - assert(i>=0); - entry = so->table; - mask = so->mask; - while (i <= mask && (entry[i].key == NULL || entry[i].key == dummy)) - i++; - si->si_pos = i+1; - if (i > mask) - goto fail; - si->len--; - key = entry[i].key; - Py_INCREF(key); - return key; - -fail: - Py_DECREF(so); - si->si_set = NULL; - return NULL; -} - -static PyTypeObject PySetIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "setiterator", /* tp_name */ - sizeof(setiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)setiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)setiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)setiter_iternext, /* tp_iternext */ - setiter_methods, /* tp_methods */ - 0, -}; - -static PyObject * -set_iter(PySetObject *so) -{ - setiterobject *si = PyObject_GC_New(setiterobject, &PySetIter_Type); - if (si == NULL) - return NULL; - Py_INCREF(so); - si->si_set = so; - si->si_used = so->used; - si->si_pos = 0; - si->len = so->used; - _PyObject_GC_TRACK(si); - return (PyObject *)si; -} - -static int -set_update_internal(PySetObject *so, PyObject *other) -{ - PyObject *key, *it; - - if (PyAnySet_Check(other)) - return set_merge(so, other); - - if (PyDict_CheckExact(other)) { - PyObject *value; - Py_ssize_t pos = 0; - long hash; - Py_ssize_t dictsize = PyDict_Size(other); - - /* Do one big resize at the start, rather than - * incrementally resizing as we insert new keys. Expect - * that there will be no (or few) overlapping keys. - */ - if (dictsize == -1) - return -1; - if ((so->fill + dictsize)*3 >= (so->mask+1)*2) { - if (set_table_resize(so, (so->used + dictsize)*2) != 0) - return -1; - } - while (_PyDict_Next(other, &pos, &key, &value, &hash)) { - setentry an_entry; - - an_entry.hash = hash; - an_entry.key = key; - if (set_add_entry(so, &an_entry) == -1) - return -1; - } - return 0; - } - - it = PyObject_GetIter(other); - if (it == NULL) - return -1; - - while ((key = PyIter_Next(it)) != NULL) { - if (set_add_key(so, key) == -1) { - Py_DECREF(it); - Py_DECREF(key); - return -1; - } - Py_DECREF(key); - } - Py_DECREF(it); - if (PyErr_Occurred()) - return -1; - return 0; -} - -static PyObject * -set_update(PySetObject *so, PyObject *args) -{ - Py_ssize_t i; - - for (i=0 ; i"); - if (dummy == NULL) - return NULL; - } - - /* create PySetObject structure */ - if (numfree && - (type == &PySet_Type || type == &PyFrozenSet_Type)) { - so = free_list[--numfree]; - assert (so != NULL && PyAnySet_CheckExact(so)); - Py_TYPE(so) = type; - _Py_NewReference((PyObject *)so); - EMPTY_TO_MINSIZE(so); - PyObject_GC_Track(so); - } else { - so = (PySetObject *)type->tp_alloc(type, 0); - if (so == NULL) - return NULL; - /* tp_alloc has already zeroed the structure */ - assert(so->table == NULL && so->fill == 0 && so->used == 0); - INIT_NONZERO_SET_SLOTS(so); - } - - so->lookup = set_lookkey_string; - so->weakreflist = NULL; - - if (iterable != NULL) { - if (set_update_internal(so, iterable) == -1) { - Py_DECREF(so); - return NULL; - } - } - - return (PyObject *)so; -} - -/* The empty frozenset is a singleton */ -static PyObject *emptyfrozenset = NULL; - -static PyObject * -frozenset_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *iterable = NULL, *result; - - if (type == &PyFrozenSet_Type && !_PyArg_NoKeywords("frozenset()", kwds)) - return NULL; - - if (!PyArg_UnpackTuple(args, type->tp_name, 0, 1, &iterable)) - return NULL; - - if (type != &PyFrozenSet_Type) - return make_new_set(type, iterable); - - if (iterable != NULL) { - /* frozenset(f) is idempotent */ - if (PyFrozenSet_CheckExact(iterable)) { - Py_INCREF(iterable); - return iterable; - } - result = make_new_set(type, iterable); - if (result == NULL || PySet_GET_SIZE(result)) - return result; - Py_DECREF(result); - } - /* The empty frozenset is a singleton */ - if (emptyfrozenset == NULL) - emptyfrozenset = make_new_set(type, NULL); - Py_XINCREF(emptyfrozenset); - return emptyfrozenset; -} - -void -PySet_Fini(void) -{ - PySetObject *so; - - while (numfree) { - numfree--; - so = free_list[numfree]; - PyObject_GC_Del(so); - } - Py_CLEAR(dummy); - Py_CLEAR(emptyfrozenset); -} - -static PyObject * -set_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - if (type == &PySet_Type && !_PyArg_NoKeywords("set()", kwds)) - return NULL; - - return make_new_set(type, NULL); -} - -/* set_swap_bodies() switches the contents of any two sets by moving their - internal data pointers and, if needed, copying the internal smalltables. - Semantically equivalent to: - - t=set(a); a.clear(); a.update(b); b.clear(); b.update(t); del t - - The function always succeeds and it leaves both objects in a stable state. - Useful for creating temporary frozensets from sets for membership testing - in __contains__(), discard(), and remove(). Also useful for operations - that update in-place (by allowing an intermediate result to be swapped - into one of the original inputs). -*/ - -static void -set_swap_bodies(PySetObject *a, PySetObject *b) -{ - Py_ssize_t t; - setentry *u; - setentry *(*f)(PySetObject *so, PyObject *key, long hash); - setentry tab[PySet_MINSIZE]; - long h; - - t = a->fill; a->fill = b->fill; b->fill = t; - t = a->used; a->used = b->used; b->used = t; - t = a->mask; a->mask = b->mask; b->mask = t; - - u = a->table; - if (a->table == a->smalltable) - u = b->smalltable; - a->table = b->table; - if (b->table == b->smalltable) - a->table = a->smalltable; - b->table = u; - - f = a->lookup; a->lookup = b->lookup; b->lookup = f; - - if (a->table == a->smalltable || b->table == b->smalltable) { - memcpy(tab, a->smalltable, sizeof(tab)); - memcpy(a->smalltable, b->smalltable, sizeof(tab)); - memcpy(b->smalltable, tab, sizeof(tab)); - } - - if (PyType_IsSubtype(Py_TYPE(a), &PyFrozenSet_Type) && - PyType_IsSubtype(Py_TYPE(b), &PyFrozenSet_Type)) { - h = a->hash; a->hash = b->hash; b->hash = h; - } else { - a->hash = -1; - b->hash = -1; - } -} - -static PyObject * -set_copy(PySetObject *so) -{ - return make_new_set(Py_TYPE(so), (PyObject *)so); -} - -static PyObject * -frozenset_copy(PySetObject *so) -{ - if (PyFrozenSet_CheckExact(so)) { - Py_INCREF(so); - return (PyObject *)so; - } - return set_copy(so); -} - -PyDoc_STRVAR(copy_doc, "Return a shallow copy of a set."); - -static PyObject * -set_clear(PySetObject *so) -{ - set_clear_internal(so); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(clear_doc, "Remove all elements from this set."); - -static PyObject * -set_union(PySetObject *so, PyObject *args) -{ - PySetObject *result; - PyObject *other; - Py_ssize_t i; - - result = (PySetObject *)set_copy(so); - if (result == NULL) - return NULL; - - for (i=0 ; i PySet_GET_SIZE(so)) { - tmp = (PyObject *)so; - so = (PySetObject *)other; - other = tmp; - } - - while (set_next((PySetObject *)other, &pos, &entry)) { - int rv = set_contains_entry(so, entry); - if (rv == -1) { - Py_DECREF(result); - return NULL; - } - if (rv) { - if (set_add_entry(result, entry) == -1) { - Py_DECREF(result); - return NULL; - } - } - } - return (PyObject *)result; - } - - it = PyObject_GetIter(other); - if (it == NULL) { - Py_DECREF(result); - return NULL; - } - - while ((key = PyIter_Next(it)) != NULL) { - int rv; - setentry entry; - long hash = PyObject_Hash(key); - - if (hash == -1) { - Py_DECREF(it); - Py_DECREF(result); - Py_DECREF(key); - return NULL; - } - entry.hash = hash; - entry.key = key; - rv = set_contains_entry(so, &entry); - if (rv == -1) { - Py_DECREF(it); - Py_DECREF(result); - Py_DECREF(key); - return NULL; - } - if (rv) { - if (set_add_entry(result, &entry) == -1) { - Py_DECREF(it); - Py_DECREF(result); - Py_DECREF(key); - return NULL; - } - } - Py_DECREF(key); - } - Py_DECREF(it); - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; - } - return (PyObject *)result; -} - -static PyObject * -set_intersection_multi(PySetObject *so, PyObject *args) -{ - Py_ssize_t i; - PyObject *result = (PyObject *)so; - - if (PyTuple_GET_SIZE(args) == 0) - return set_copy(so); - - Py_INCREF(so); - for (i=0 ; i PySet_GET_SIZE(so)) { - tmp = (PyObject *)so; - so = (PySetObject *)other; - other = tmp; - } - while (set_next((PySetObject *)other, &pos, &entry)) { - int rv = set_contains_entry(so, entry); - if (rv == -1) - return NULL; - if (rv) - Py_RETURN_FALSE; - } - Py_RETURN_TRUE; - } - - it = PyObject_GetIter(other); - if (it == NULL) - return NULL; - - while ((key = PyIter_Next(it)) != NULL) { - int rv; - setentry entry; - long hash = PyObject_Hash(key); - - if (hash == -1) { - Py_DECREF(key); - Py_DECREF(it); - return NULL; - } - entry.hash = hash; - entry.key = key; - rv = set_contains_entry(so, &entry); - Py_DECREF(key); - if (rv == -1) { - Py_DECREF(it); - return NULL; - } - if (rv) { - Py_DECREF(it); - Py_RETURN_FALSE; - } - } - Py_DECREF(it); - if (PyErr_Occurred()) - return NULL; - Py_RETURN_TRUE; -} - -PyDoc_STRVAR(isdisjoint_doc, -"Return True if two sets have a null intersection."); - -static int -set_difference_update_internal(PySetObject *so, PyObject *other) -{ - if ((PyObject *)so == other) - return set_clear_internal(so); - - if (PyAnySet_Check(other)) { - setentry *entry; - Py_ssize_t pos = 0; - - while (set_next((PySetObject *)other, &pos, &entry)) - if (set_discard_entry(so, entry) == -1) - return -1; - } else { - PyObject *key, *it; - it = PyObject_GetIter(other); - if (it == NULL) - return -1; - - while ((key = PyIter_Next(it)) != NULL) { - if (set_discard_key(so, key) == -1) { - Py_DECREF(it); - Py_DECREF(key); - return -1; - } - Py_DECREF(key); - } - Py_DECREF(it); - if (PyErr_Occurred()) - return -1; - } - /* If more than 1/5 are dummies, then resize them away. */ - if ((so->fill - so->used) * 5 < so->mask) - return 0; - return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4); -} - -static PyObject * -set_difference_update(PySetObject *so, PyObject *args) -{ - Py_ssize_t i; - - for (i=0 ; ihash; - entrycopy.key = entry->key; - if (!_PyDict_Contains(other, entry->key, entry->hash)) { - if (set_add_entry((PySetObject *)result, &entrycopy) == -1) { - Py_DECREF(result); - return NULL; - } - } - } - return result; - } - - while (set_next(so, &pos, &entry)) { - int rv = set_contains_entry((PySetObject *)other, entry); - if (rv == -1) { - Py_DECREF(result); - return NULL; - } - if (!rv) { - if (set_add_entry((PySetObject *)result, entry) == -1) { - Py_DECREF(result); - return NULL; - } - } - } - return result; -} - -static PyObject * -set_difference_multi(PySetObject *so, PyObject *args) -{ - Py_ssize_t i; - PyObject *result, *other; - - if (PyTuple_GET_SIZE(args) == 0) - return set_copy(so); - - other = PyTuple_GET_ITEM(args, 0); - result = set_difference(so, other); - if (result == NULL) - return NULL; - - for (i=1 ; i PySet_GET_SIZE(other)) - Py_RETURN_FALSE; - - while (set_next(so, &pos, &entry)) { - int rv = set_contains_entry((PySetObject *)other, entry); - if (rv == -1) - return NULL; - if (!rv) - Py_RETURN_FALSE; - } - Py_RETURN_TRUE; -} - -PyDoc_STRVAR(issubset_doc, "Report whether another set contains this set."); - -static PyObject * -set_issuperset(PySetObject *so, PyObject *other) -{ - PyObject *tmp, *result; - - if (!PyAnySet_Check(other)) { - tmp = make_new_set(&PySet_Type, other); - if (tmp == NULL) - return NULL; - result = set_issuperset(so, tmp); - Py_DECREF(tmp); - return result; - } - return set_issubset((PySetObject *)other, (PyObject *)so); -} - -PyDoc_STRVAR(issuperset_doc, "Report whether this set contains another set."); - -static PyObject * -set_richcompare(PySetObject *v, PyObject *w, int op) -{ - PyObject *r1, *r2; - - if(!PyAnySet_Check(w)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - switch (op) { - case Py_EQ: - if (PySet_GET_SIZE(v) != PySet_GET_SIZE(w)) - Py_RETURN_FALSE; - if (v->hash != -1 && - ((PySetObject *)w)->hash != -1 && - v->hash != ((PySetObject *)w)->hash) - Py_RETURN_FALSE; - return set_issubset(v, w); - case Py_NE: - r1 = set_richcompare(v, w, Py_EQ); - if (r1 == NULL) - return NULL; - r2 = PyBool_FromLong(PyObject_Not(r1)); - Py_DECREF(r1); - return r2; - case Py_LE: - return set_issubset(v, w); - case Py_GE: - return set_issuperset(v, w); - case Py_LT: - if (PySet_GET_SIZE(v) >= PySet_GET_SIZE(w)) - Py_RETURN_FALSE; - return set_issubset(v, w); - case Py_GT: - if (PySet_GET_SIZE(v) <= PySet_GET_SIZE(w)) - Py_RETURN_FALSE; - return set_issuperset(v, w); - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static int -set_nocmp(PyObject *self, PyObject *other) -{ - PyErr_SetString(PyExc_TypeError, "cannot compare sets using cmp()"); - return -1; -} - -static PyObject * -set_add(PySetObject *so, PyObject *key) -{ - if (set_add_key(so, key) == -1) - return NULL; - Py_RETURN_NONE; -} - -PyDoc_STRVAR(add_doc, -"Add an element to a set.\n\ -\n\ -This has no effect if the element is already present."); - -static int -set_contains(PySetObject *so, PyObject *key) -{ - PyObject *tmpkey; - int rv; - - rv = set_contains_key(so, key); - if (rv == -1) { - if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)) - return -1; - PyErr_Clear(); - tmpkey = make_new_set(&PyFrozenSet_Type, key); - if (tmpkey == NULL) - return -1; - rv = set_contains_key(so, tmpkey); - Py_DECREF(tmpkey); - } - return rv; -} - -static PyObject * -set_direct_contains(PySetObject *so, PyObject *key) -{ - long result; - - result = set_contains(so, key); - if (result == -1) - return NULL; - return PyBool_FromLong(result); -} - -PyDoc_STRVAR(contains_doc, "x.__contains__(y) <==> y in x."); - -static PyObject * -set_remove(PySetObject *so, PyObject *key) -{ - PyObject *tmpkey; - int rv; - - rv = set_discard_key(so, key); - if (rv == -1) { - if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)) - return NULL; - PyErr_Clear(); - tmpkey = make_new_set(&PyFrozenSet_Type, key); - if (tmpkey == NULL) - return NULL; - rv = set_discard_key(so, tmpkey); - Py_DECREF(tmpkey); - if (rv == -1) - return NULL; - } - - if (rv == DISCARD_NOTFOUND) { - set_key_error(key); - return NULL; - } - Py_RETURN_NONE; -} - -PyDoc_STRVAR(remove_doc, -"Remove an element from a set; it must be a member.\n\ -\n\ -If the element is not a member, raise a KeyError."); - -static PyObject * -set_discard(PySetObject *so, PyObject *key) -{ - PyObject *tmpkey; - int rv; - - rv = set_discard_key(so, key); - if (rv == -1) { - if (!PySet_Check(key) || !PyErr_ExceptionMatches(PyExc_TypeError)) - return NULL; - PyErr_Clear(); - tmpkey = make_new_set(&PyFrozenSet_Type, key); - if (tmpkey == NULL) - return NULL; - rv = set_discard_key(so, tmpkey); - Py_DECREF(tmpkey); - if (rv == -1) - return NULL; - } - Py_RETURN_NONE; -} - -PyDoc_STRVAR(discard_doc, -"Remove an element from a set if it is a member.\n\ -\n\ -If the element is not a member, do nothing."); - -static PyObject * -set_reduce(PySetObject *so) -{ - PyObject *keys=NULL, *args=NULL, *result=NULL, *dict=NULL; - - keys = PySequence_List((PyObject *)so); - if (keys == NULL) - goto done; - args = PyTuple_Pack(1, keys); - if (args == NULL) - goto done; - dict = PyObject_GetAttrString((PyObject *)so, "__dict__"); - if (dict == NULL) { - PyErr_Clear(); - dict = Py_None; - Py_INCREF(dict); - } - result = PyTuple_Pack(3, Py_TYPE(so), args, dict); -done: - Py_XDECREF(args); - Py_XDECREF(keys); - Py_XDECREF(dict); - return result; -} - -PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); - -static PyObject * -set_sizeof(PySetObject *so) -{ - Py_ssize_t res; - - res = sizeof(PySetObject); - if (so->table != so->smalltable) - res = res + (so->mask + 1) * sizeof(setentry); - return PyInt_FromSsize_t(res); -} - -PyDoc_STRVAR(sizeof_doc, "S.__sizeof__() -> size of S in memory, in bytes"); -static int -set_init(PySetObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *iterable = NULL; - - if (!PyAnySet_Check(self)) - return -1; - if (PySet_Check(self) && !_PyArg_NoKeywords("set()", kwds)) - return -1; - if (!PyArg_UnpackTuple(args, Py_TYPE(self)->tp_name, 0, 1, &iterable)) - return -1; - set_clear_internal(self); - self->hash = -1; - if (iterable == NULL) - return 0; - return set_update_internal(self, iterable); -} - -static PySequenceMethods set_as_sequence = { - set_len, /* sq_length */ - 0, /* sq_concat */ - 0, /* sq_repeat */ - 0, /* sq_item */ - 0, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)set_contains, /* sq_contains */ -}; - -/* set object ********************************************************/ - -#ifdef Py_DEBUG -static PyObject *test_c_api(PySetObject *so); - -PyDoc_STRVAR(test_c_api_doc, "Exercises C API. Returns True.\n\ -All is well if assertions don't fail."); -#endif - -static PyMethodDef set_methods[] = { - {"add", (PyCFunction)set_add, METH_O, - add_doc}, - {"clear", (PyCFunction)set_clear, METH_NOARGS, - clear_doc}, - {"__contains__",(PyCFunction)set_direct_contains, METH_O | METH_COEXIST, - contains_doc}, - {"copy", (PyCFunction)set_copy, METH_NOARGS, - copy_doc}, - {"discard", (PyCFunction)set_discard, METH_O, - discard_doc}, - {"difference", (PyCFunction)set_difference_multi, METH_VARARGS, - difference_doc}, - {"difference_update", (PyCFunction)set_difference_update, METH_VARARGS, - difference_update_doc}, - {"intersection",(PyCFunction)set_intersection_multi, METH_VARARGS, - intersection_doc}, - {"intersection_update",(PyCFunction)set_intersection_update_multi, METH_VARARGS, - intersection_update_doc}, - {"isdisjoint", (PyCFunction)set_isdisjoint, METH_O, - isdisjoint_doc}, - {"issubset", (PyCFunction)set_issubset, METH_O, - issubset_doc}, - {"issuperset", (PyCFunction)set_issuperset, METH_O, - issuperset_doc}, - {"pop", (PyCFunction)set_pop, METH_NOARGS, - pop_doc}, - {"__reduce__", (PyCFunction)set_reduce, METH_NOARGS, - reduce_doc}, - {"remove", (PyCFunction)set_remove, METH_O, - remove_doc}, - {"__sizeof__", (PyCFunction)set_sizeof, METH_NOARGS, - sizeof_doc}, - {"symmetric_difference",(PyCFunction)set_symmetric_difference, METH_O, - symmetric_difference_doc}, - {"symmetric_difference_update",(PyCFunction)set_symmetric_difference_update, METH_O, - symmetric_difference_update_doc}, -#ifdef Py_DEBUG - {"test_c_api", (PyCFunction)test_c_api, METH_NOARGS, - test_c_api_doc}, -#endif - {"union", (PyCFunction)set_union, METH_VARARGS, - union_doc}, - {"update", (PyCFunction)set_update, METH_VARARGS, - update_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyNumberMethods set_as_number = { - 0, /*nb_add*/ - (binaryfunc)set_sub, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - (binaryfunc)set_and, /*nb_and*/ - (binaryfunc)set_xor, /*nb_xor*/ - (binaryfunc)set_or, /*nb_or*/ - 0, /*nb_coerce*/ - 0, /*nb_int*/ - 0, /*nb_long*/ - 0, /*nb_float*/ - 0, /*nb_oct*/ - 0, /*nb_hex*/ - 0, /*nb_inplace_add*/ - (binaryfunc)set_isub, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - 0, /*nb_inplace_divide*/ - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - (binaryfunc)set_iand, /*nb_inplace_and*/ - (binaryfunc)set_ixor, /*nb_inplace_xor*/ - (binaryfunc)set_ior, /*nb_inplace_or*/ -}; - -PyDoc_STRVAR(set_doc, -"set() -> new empty set object\n\ -set(iterable) -> new set object\n\ -\n\ -Build an unordered collection of unique elements."); - -PyTypeObject PySet_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "set", /* tp_name */ - sizeof(PySetObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)set_dealloc, /* tp_dealloc */ - (printfunc)set_tp_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ - (reprfunc)set_repr, /* tp_repr */ - &set_as_number, /* tp_as_number */ - &set_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)PyObject_HashNotImplemented, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - set_doc, /* tp_doc */ - (traverseproc)set_traverse, /* tp_traverse */ - (inquiry)set_clear_internal, /* tp_clear */ - (richcmpfunc)set_richcompare, /* tp_richcompare */ - offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)set_iter, /* tp_iter */ - 0, /* tp_iternext */ - set_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)set_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - set_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* frozenset object ********************************************************/ - - -static PyMethodDef frozenset_methods[] = { - {"__contains__",(PyCFunction)set_direct_contains, METH_O | METH_COEXIST, - contains_doc}, - {"copy", (PyCFunction)frozenset_copy, METH_NOARGS, - copy_doc}, - {"difference", (PyCFunction)set_difference_multi, METH_VARARGS, - difference_doc}, - {"intersection",(PyCFunction)set_intersection_multi, METH_VARARGS, - intersection_doc}, - {"isdisjoint", (PyCFunction)set_isdisjoint, METH_O, - isdisjoint_doc}, - {"issubset", (PyCFunction)set_issubset, METH_O, - issubset_doc}, - {"issuperset", (PyCFunction)set_issuperset, METH_O, - issuperset_doc}, - {"__reduce__", (PyCFunction)set_reduce, METH_NOARGS, - reduce_doc}, - {"__sizeof__", (PyCFunction)set_sizeof, METH_NOARGS, - sizeof_doc}, - {"symmetric_difference",(PyCFunction)set_symmetric_difference, METH_O, - symmetric_difference_doc}, - {"union", (PyCFunction)set_union, METH_VARARGS, - union_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyNumberMethods frozenset_as_number = { - 0, /*nb_add*/ - (binaryfunc)set_sub, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - (binaryfunc)set_and, /*nb_and*/ - (binaryfunc)set_xor, /*nb_xor*/ - (binaryfunc)set_or, /*nb_or*/ -}; - -PyDoc_STRVAR(frozenset_doc, -"frozenset() -> empty frozenset object\n\ -frozenset(iterable) -> frozenset object\n\ -\n\ -Build an immutable unordered collection of unique elements."); - -PyTypeObject PyFrozenSet_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "frozenset", /* tp_name */ - sizeof(PySetObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)set_dealloc, /* tp_dealloc */ - (printfunc)set_tp_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - set_nocmp, /* tp_compare */ - (reprfunc)set_repr, /* tp_repr */ - &frozenset_as_number, /* tp_as_number */ - &set_as_sequence, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - frozenset_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - frozenset_doc, /* tp_doc */ - (traverseproc)set_traverse, /* tp_traverse */ - (inquiry)set_clear_internal, /* tp_clear */ - (richcmpfunc)set_richcompare, /* tp_richcompare */ - offsetof(PySetObject, weakreflist), /* tp_weaklistoffset */ - (getiterfunc)set_iter, /* tp_iter */ - 0, /* tp_iternext */ - frozenset_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - frozenset_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - - -/***** C API functions *************************************************/ - -PyObject * -PySet_New(PyObject *iterable) -{ - return make_new_set(&PySet_Type, iterable); -} - -PyObject * -PyFrozenSet_New(PyObject *iterable) -{ - return make_new_set(&PyFrozenSet_Type, iterable); -} - -Py_ssize_t -PySet_Size(PyObject *anyset) -{ - if (!PyAnySet_Check(anyset)) { - PyErr_BadInternalCall(); - return -1; - } - return PySet_GET_SIZE(anyset); -} - -int -PySet_Clear(PyObject *set) -{ - if (!PySet_Check(set)) { - PyErr_BadInternalCall(); - return -1; - } - return set_clear_internal((PySetObject *)set); -} - -int -PySet_Contains(PyObject *anyset, PyObject *key) -{ - if (!PyAnySet_Check(anyset)) { - PyErr_BadInternalCall(); - return -1; - } - return set_contains_key((PySetObject *)anyset, key); -} - -int -PySet_Discard(PyObject *set, PyObject *key) -{ - if (!PySet_Check(set)) { - PyErr_BadInternalCall(); - return -1; - } - return set_discard_key((PySetObject *)set, key); -} - -int -PySet_Add(PyObject *anyset, PyObject *key) -{ - if (!PySet_Check(anyset) && - (!PyFrozenSet_Check(anyset) || Py_REFCNT(anyset) != 1)) { - PyErr_BadInternalCall(); - return -1; - } - return set_add_key((PySetObject *)anyset, key); -} - -int -_PySet_Next(PyObject *set, Py_ssize_t *pos, PyObject **key) -{ - setentry *entry_ptr; - - if (!PyAnySet_Check(set)) { - PyErr_BadInternalCall(); - return -1; - } - if (set_next((PySetObject *)set, pos, &entry_ptr) == 0) - return 0; - *key = entry_ptr->key; - return 1; -} - -int -_PySet_NextEntry(PyObject *set, Py_ssize_t *pos, PyObject **key, long *hash) -{ - setentry *entry; - - if (!PyAnySet_Check(set)) { - PyErr_BadInternalCall(); - return -1; - } - if (set_next((PySetObject *)set, pos, &entry) == 0) - return 0; - *key = entry->key; - *hash = entry->hash; - return 1; -} - -PyObject * -PySet_Pop(PyObject *set) -{ - if (!PySet_Check(set)) { - PyErr_BadInternalCall(); - return NULL; - } - return set_pop((PySetObject *)set); -} - -int -_PySet_Update(PyObject *set, PyObject *iterable) -{ - if (!PySet_Check(set)) { - PyErr_BadInternalCall(); - return -1; - } - return set_update_internal((PySetObject *)set, iterable); -} - -#ifdef Py_DEBUG - -/* Test code to be called with any three element set. - Returns True and original set is restored. */ - -#define assertRaises(call_return_value, exception) \ - do { \ - assert(call_return_value); \ - assert(PyErr_ExceptionMatches(exception)); \ - PyErr_Clear(); \ - } while(0) - -static PyObject * -test_c_api(PySetObject *so) -{ - Py_ssize_t count; - char *s; - Py_ssize_t i; - PyObject *elem=NULL, *dup=NULL, *t, *f, *dup2, *x; - PyObject *ob = (PyObject *)so; - PyObject *str; - - /* Verify preconditions */ - assert(PyAnySet_Check(ob)); - assert(PyAnySet_CheckExact(ob)); - assert(!PyFrozenSet_CheckExact(ob)); - - /* so.clear(); so |= set("abc"); */ - str = PyString_FromString("abc"); - if (str == NULL) - return NULL; - set_clear_internal(so); - if (set_update_internal(so, str) == -1) { - Py_DECREF(str); - return NULL; - } - Py_DECREF(str); - - /* Exercise type/size checks */ - assert(PySet_Size(ob) == 3); - assert(PySet_GET_SIZE(ob) == 3); - - /* Raise TypeError for non-iterable constructor arguments */ - assertRaises(PySet_New(Py_None) == NULL, PyExc_TypeError); - assertRaises(PyFrozenSet_New(Py_None) == NULL, PyExc_TypeError); - - /* Raise TypeError for unhashable key */ - dup = PySet_New(ob); - assertRaises(PySet_Discard(ob, dup) == -1, PyExc_TypeError); - assertRaises(PySet_Contains(ob, dup) == -1, PyExc_TypeError); - assertRaises(PySet_Add(ob, dup) == -1, PyExc_TypeError); - - /* Exercise successful pop, contains, add, and discard */ - elem = PySet_Pop(ob); - assert(PySet_Contains(ob, elem) == 0); - assert(PySet_GET_SIZE(ob) == 2); - assert(PySet_Add(ob, elem) == 0); - assert(PySet_Contains(ob, elem) == 1); - assert(PySet_GET_SIZE(ob) == 3); - assert(PySet_Discard(ob, elem) == 1); - assert(PySet_GET_SIZE(ob) == 2); - assert(PySet_Discard(ob, elem) == 0); - assert(PySet_GET_SIZE(ob) == 2); - - /* Exercise clear */ - dup2 = PySet_New(dup); - assert(PySet_Clear(dup2) == 0); - assert(PySet_Size(dup2) == 0); - Py_DECREF(dup2); - - /* Raise SystemError on clear or update of frozen set */ - f = PyFrozenSet_New(dup); - assertRaises(PySet_Clear(f) == -1, PyExc_SystemError); - assertRaises(_PySet_Update(f, dup) == -1, PyExc_SystemError); - assert(PySet_Add(f, elem) == 0); - Py_INCREF(f); - assertRaises(PySet_Add(f, elem) == -1, PyExc_SystemError); - Py_DECREF(f); - Py_DECREF(f); - - /* Exercise direct iteration */ - i = 0, count = 0; - while (_PySet_Next((PyObject *)dup, &i, &x)) { - s = PyString_AsString(x); - assert(s && (s[0] == 'a' || s[0] == 'b' || s[0] == 'c')); - count++; - } - assert(count == 3); - - /* Exercise updates */ - dup2 = PySet_New(NULL); - assert(_PySet_Update(dup2, dup) == 0); - assert(PySet_Size(dup2) == 3); - assert(_PySet_Update(dup2, dup) == 0); - assert(PySet_Size(dup2) == 3); - Py_DECREF(dup2); - - /* Raise SystemError when self argument is not a set or frozenset. */ - t = PyTuple_New(0); - assertRaises(PySet_Size(t) == -1, PyExc_SystemError); - assertRaises(PySet_Contains(t, elem) == -1, PyExc_SystemError); - Py_DECREF(t); - - /* Raise SystemError when self argument is not a set. */ - f = PyFrozenSet_New(dup); - assert(PySet_Size(f) == 3); - assert(PyFrozenSet_CheckExact(f)); - assertRaises(PySet_Discard(f, elem) == -1, PyExc_SystemError); - assertRaises(PySet_Pop(f) == NULL, PyExc_SystemError); - Py_DECREF(f); - - /* Raise KeyError when popping from an empty set */ - assert(PyNumber_InPlaceSubtract(ob, ob) == ob); - Py_DECREF(ob); - assert(PySet_GET_SIZE(ob) == 0); - assertRaises(PySet_Pop(ob) == NULL, PyExc_KeyError); - - /* Restore the set from the copy using the PyNumber API */ - assert(PyNumber_InPlaceOr(ob, dup) == ob); - Py_DECREF(ob); - - /* Verify constructors accept NULL arguments */ - f = PySet_New(NULL); - assert(f != NULL); - assert(PySet_GET_SIZE(f) == 0); - Py_DECREF(f); - f = PyFrozenSet_New(NULL); - assert(f != NULL); - assert(PyFrozenSet_CheckExact(f)); - assert(PySet_GET_SIZE(f) == 0); - Py_DECREF(f); - - Py_DECREF(elem); - Py_DECREF(dup); - Py_RETURN_TRUE; -} - -#undef assertRaises - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/sliceobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/sliceobject.c deleted file mode 100644 index 00b579b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/sliceobject.c +++ /dev/null @@ -1,362 +0,0 @@ -/* -Written by Jim Hugunin and Chris Chase. - -This includes both the singular ellipsis object and slice objects. - -Guido, feel free to do whatever you want in the way of copyrights -for this file. -*/ - -/* -Py_Ellipsis encodes the '...' rubber index token. It is similar to -the Py_NoneStruct in that there is no way to create other objects of -this type and there is exactly one in existence. -*/ - -#include "Python.h" -#include "structmember.h" - -static PyObject * -ellipsis_repr(PyObject *op) -{ - return PyString_FromString("Ellipsis"); -} - -PyTypeObject PyEllipsis_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "ellipsis", /* tp_name */ - 0, /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /*never called*/ /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - ellipsis_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ -}; - -PyObject _Py_EllipsisObject = { - _PyObject_EXTRA_INIT - 1, &PyEllipsis_Type -}; - - -/* Slice object implementation - - start, stop, and step are python objects with None indicating no - index is present. -*/ - -PyObject * -PySlice_New(PyObject *start, PyObject *stop, PyObject *step) -{ - PySliceObject *obj = PyObject_New(PySliceObject, &PySlice_Type); - - if (obj == NULL) - return NULL; - - if (step == NULL) step = Py_None; - Py_INCREF(step); - if (start == NULL) start = Py_None; - Py_INCREF(start); - if (stop == NULL) stop = Py_None; - Py_INCREF(stop); - - obj->step = step; - obj->start = start; - obj->stop = stop; - - return (PyObject *) obj; -} - -PyObject * -_PySlice_FromIndices(Py_ssize_t istart, Py_ssize_t istop) -{ - PyObject *start, *end, *slice; - start = PyInt_FromSsize_t(istart); - if (!start) - return NULL; - end = PyInt_FromSsize_t(istop); - if (!end) { - Py_DECREF(start); - return NULL; - } - - slice = PySlice_New(start, end, NULL); - Py_DECREF(start); - Py_DECREF(end); - return slice; -} - -int -PySlice_GetIndices(PySliceObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step) -{ - /* XXX support long ints */ - if (r->step == Py_None) { - *step = 1; - } else { - if (!PyInt_Check(r->step) && !PyLong_Check(r->step)) return -1; - *step = PyInt_AsSsize_t(r->step); - } - if (r->start == Py_None) { - *start = *step < 0 ? length-1 : 0; - } else { - if (!PyInt_Check(r->start) && !PyLong_Check(r->step)) return -1; - *start = PyInt_AsSsize_t(r->start); - if (*start < 0) *start += length; - } - if (r->stop == Py_None) { - *stop = *step < 0 ? -1 : length; - } else { - if (!PyInt_Check(r->stop) && !PyLong_Check(r->step)) return -1; - *stop = PyInt_AsSsize_t(r->stop); - if (*stop < 0) *stop += length; - } - if (*stop > length) return -1; - if (*start >= length) return -1; - if (*step == 0) return -1; - return 0; -} - -int -PySlice_GetIndicesEx(PySliceObject *r, Py_ssize_t length, - Py_ssize_t *start, Py_ssize_t *stop, Py_ssize_t *step, Py_ssize_t *slicelength) -{ - /* this is harder to get right than you might think */ - - Py_ssize_t defstart, defstop; - - if (r->step == Py_None) { - *step = 1; - } - else { - if (!_PyEval_SliceIndex(r->step, step)) return -1; - if (*step == 0) { - PyErr_SetString(PyExc_ValueError, - "slice step cannot be zero"); - return -1; - } - } - - defstart = *step < 0 ? length-1 : 0; - defstop = *step < 0 ? -1 : length; - - if (r->start == Py_None) { - *start = defstart; - } - else { - if (!_PyEval_SliceIndex(r->start, start)) return -1; - if (*start < 0) *start += length; - if (*start < 0) *start = (*step < 0) ? -1 : 0; - if (*start >= length) - *start = (*step < 0) ? length - 1 : length; - } - - if (r->stop == Py_None) { - *stop = defstop; - } - else { - if (!_PyEval_SliceIndex(r->stop, stop)) return -1; - if (*stop < 0) *stop += length; - if (*stop < 0) *stop = (*step < 0) ? -1 : 0; - if (*stop >= length) - *stop = (*step < 0) ? length - 1 : length; - } - - if ((*step < 0 && *stop >= *start) - || (*step > 0 && *start >= *stop)) { - *slicelength = 0; - } - else if (*step < 0) { - *slicelength = (*stop-*start+1)/(*step)+1; - } - else { - *slicelength = (*stop-*start-1)/(*step)+1; - } - - return 0; -} - -static PyObject * -slice_new(PyTypeObject *type, PyObject *args, PyObject *kw) -{ - PyObject *start, *stop, *step; - - start = stop = step = NULL; - - if (!_PyArg_NoKeywords("slice()", kw)) - return NULL; - - if (!PyArg_UnpackTuple(args, "slice", 1, 3, &start, &stop, &step)) - return NULL; - - /* This swapping of stop and start is to maintain similarity with - range(). */ - if (stop == NULL) { - stop = start; - start = NULL; - } - return PySlice_New(start, stop, step); -} - -PyDoc_STRVAR(slice_doc, -"slice(stop)\n\ -slice(start, stop[, step])\n\ -\n\ -Create a slice object. This is used for extended slicing (e.g. a[0:10:2])."); - -static void -slice_dealloc(PySliceObject *r) -{ - Py_DECREF(r->step); - Py_DECREF(r->start); - Py_DECREF(r->stop); - PyObject_Del(r); -} - -static PyObject * -slice_repr(PySliceObject *r) -{ - PyObject *s, *comma; - - s = PyString_FromString("slice("); - comma = PyString_FromString(", "); - PyString_ConcatAndDel(&s, PyObject_Repr(r->start)); - PyString_Concat(&s, comma); - PyString_ConcatAndDel(&s, PyObject_Repr(r->stop)); - PyString_Concat(&s, comma); - PyString_ConcatAndDel(&s, PyObject_Repr(r->step)); - PyString_ConcatAndDel(&s, PyString_FromString(")")); - Py_DECREF(comma); - return s; -} - -static PyMemberDef slice_members[] = { - {"start", T_OBJECT, offsetof(PySliceObject, start), READONLY}, - {"stop", T_OBJECT, offsetof(PySliceObject, stop), READONLY}, - {"step", T_OBJECT, offsetof(PySliceObject, step), READONLY}, - {0} -}; - -static PyObject* -slice_indices(PySliceObject* self, PyObject* len) -{ - Py_ssize_t ilen, start, stop, step, slicelength; - - ilen = PyNumber_AsSsize_t(len, PyExc_OverflowError); - - if (ilen == -1 && PyErr_Occurred()) { - return NULL; - } - - if (PySlice_GetIndicesEx(self, ilen, &start, &stop, - &step, &slicelength) < 0) { - return NULL; - } - - return Py_BuildValue("(nnn)", start, stop, step); -} - -PyDoc_STRVAR(slice_indices_doc, -"S.indices(len) -> (start, stop, stride)\n\ -\n\ -Assuming a sequence of length len, calculate the start and stop\n\ -indices, and the stride length of the extended slice described by\n\ -S. Out of bounds indices are clipped in a manner consistent with the\n\ -handling of normal slices."); - -static PyObject * -slice_reduce(PySliceObject* self) -{ - return Py_BuildValue("O(OOO)", Py_TYPE(self), self->start, self->stop, self->step); -} - -PyDoc_STRVAR(reduce_doc, "Return state information for pickling."); - -static PyMethodDef slice_methods[] = { - {"indices", (PyCFunction)slice_indices, - METH_O, slice_indices_doc}, - {"__reduce__", (PyCFunction)slice_reduce, - METH_NOARGS, reduce_doc}, - {NULL, NULL} -}; - -static int -slice_compare(PySliceObject *v, PySliceObject *w) -{ - int result = 0; - - if (v == w) - return 0; - - if (PyObject_Cmp(v->start, w->start, &result) < 0) - return -2; - if (result != 0) - return result; - if (PyObject_Cmp(v->stop, w->stop, &result) < 0) - return -2; - if (result != 0) - return result; - if (PyObject_Cmp(v->step, w->step, &result) < 0) - return -2; - return result; -} - -static long -slice_hash(PySliceObject *v) -{ - PyErr_SetString(PyExc_TypeError, "unhashable type"); - return -1L; -} - -PyTypeObject PySlice_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "slice", /* Name of this type */ - sizeof(PySliceObject), /* Basic object size */ - 0, /* Item size for varobject */ - (destructor)slice_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)slice_compare, /* tp_compare */ - (reprfunc)slice_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)slice_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - slice_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - slice_methods, /* tp_methods */ - slice_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - slice_new, /* tp_new */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/README.txt b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/README.txt deleted file mode 100644 index 66e671f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/README.txt +++ /dev/null @@ -1,40 +0,0 @@ -bits shared by the stringobject and unicodeobject implementations (and -possibly other modules, in a not too distant future). - -the stuff in here is included into relevant places; see the individual -source files for details. - --------------------------------------------------------------------- -the following defines used by the different modules: - -STRINGLIB_CHAR - - the type used to hold a character (char or Py_UNICODE) - -STRINGLIB_EMPTY - - a PyObject representing the empty string, only to be used if - STRINGLIB_MUTABLE is 0 - -Py_ssize_t STRINGLIB_LEN(PyObject*) - - returns the length of the given string object (which must be of the - right type) - -PyObject* STRINGLIB_NEW(STRINGLIB_CHAR*, Py_ssize_t) - - creates a new string object - -STRINGLIB_CHAR* STRINGLIB_STR(PyObject*) - - returns the pointer to the character data for the given string - object (which must be of the right type) - -int STRINGLIB_CHECK_EXACT(PyObject *) - - returns true if the object is an instance of our type, not a subclass - -STRINGLIB_MUTABLE - - must be 0 or 1 to tell the cpp macros in stringlib code if the object - being operated on is mutable or not diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/count.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/count.h deleted file mode 100644 index 216c269..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/count.h +++ /dev/null @@ -1,30 +0,0 @@ -/* stringlib: count implementation */ - -#ifndef STRINGLIB_COUNT_H -#define STRINGLIB_COUNT_H - -#ifndef STRINGLIB_FASTSEARCH_H -#error must include "stringlib/fastsearch.h" before including this module -#endif - -Py_LOCAL_INLINE(Py_ssize_t) -stringlib_count(const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, - Py_ssize_t maxcount) -{ - Py_ssize_t count; - - if (str_len < 0) - return 0; /* start > len(str) */ - if (sub_len == 0) - return (str_len < maxcount) ? str_len + 1 : maxcount; - - count = fastsearch(str, str_len, sub, sub_len, maxcount, FAST_COUNT); - - if (count < 0) - return 0; /* no match */ - - return count; -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/ctype.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/ctype.h deleted file mode 100644 index df2fede..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/ctype.h +++ /dev/null @@ -1,109 +0,0 @@ -/* NOTE: this API is -ONLY- for use with single byte character strings. */ -/* Do not use it with Unicode. */ - -#include "bytes_methods.h" - -static PyObject* -stringlib_isspace(PyObject *self) -{ - return _Py_bytes_isspace(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - -static PyObject* -stringlib_isalpha(PyObject *self) -{ - return _Py_bytes_isalpha(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - -static PyObject* -stringlib_isalnum(PyObject *self) -{ - return _Py_bytes_isalnum(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - -static PyObject* -stringlib_isdigit(PyObject *self) -{ - return _Py_bytes_isdigit(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - -static PyObject* -stringlib_islower(PyObject *self) -{ - return _Py_bytes_islower(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - -static PyObject* -stringlib_isupper(PyObject *self) -{ - return _Py_bytes_isupper(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - -static PyObject* -stringlib_istitle(PyObject *self) -{ - return _Py_bytes_istitle(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -} - - -/* functions that return a new object partially translated by ctype funcs: */ - -static PyObject* -stringlib_lower(PyObject *self) -{ - PyObject* newobj; - newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); - if (!newobj) - return NULL; - _Py_bytes_lower(STRINGLIB_STR(newobj), STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - return newobj; -} - -static PyObject* -stringlib_upper(PyObject *self) -{ - PyObject* newobj; - newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); - if (!newobj) - return NULL; - _Py_bytes_upper(STRINGLIB_STR(newobj), STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - return newobj; -} - -static PyObject* -stringlib_title(PyObject *self) -{ - PyObject* newobj; - newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); - if (!newobj) - return NULL; - _Py_bytes_title(STRINGLIB_STR(newobj), STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - return newobj; -} - -static PyObject* -stringlib_capitalize(PyObject *self) -{ - PyObject* newobj; - newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); - if (!newobj) - return NULL; - _Py_bytes_capitalize(STRINGLIB_STR(newobj), STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - return newobj; -} - -static PyObject* -stringlib_swapcase(PyObject *self) -{ - PyObject* newobj; - newobj = STRINGLIB_NEW(NULL, STRINGLIB_LEN(self)); - if (!newobj) - return NULL; - _Py_bytes_swapcase(STRINGLIB_STR(newobj), STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - return newobj; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/fastsearch.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/fastsearch.h deleted file mode 100644 index 6255b36..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/fastsearch.h +++ /dev/null @@ -1,160 +0,0 @@ -/* stringlib: fastsearch implementation */ - -#ifndef STRINGLIB_FASTSEARCH_H -#define STRINGLIB_FASTSEARCH_H - -/* fast search/count implementation, based on a mix between boyer- - moore and horspool, with a few more bells and whistles on the top. - for some more background, see: http://effbot.org/zone/stringlib.htm */ - -/* note: fastsearch may access s[n], which isn't a problem when using - Python's ordinary string types, but may cause problems if you're - using this code in other contexts. also, the count mode returns -1 - if there cannot possible be a match in the target string, and 0 if - it has actually checked for matches, but didn't find any. callers - beware! */ - -#define FAST_COUNT 0 -#define FAST_SEARCH 1 -#define FAST_RSEARCH 2 - -#if LONG_BIT >= 128 -#define STRINGLIB_BLOOM_WIDTH 128 -#elif LONG_BIT >= 64 -#define STRINGLIB_BLOOM_WIDTH 64 -#elif LONG_BIT >= 32 -#define STRINGLIB_BLOOM_WIDTH 32 -#else -#error "LONG_BIT is smaller than 32" -#endif - -#define STRINGLIB_BLOOM_ADD(mask, ch) \ - ((mask |= (1UL << ((ch) & (STRINGLIB_BLOOM_WIDTH -1))))) -#define STRINGLIB_BLOOM(mask, ch) \ - ((mask & (1UL << ((ch) & (STRINGLIB_BLOOM_WIDTH -1))))) - -Py_LOCAL_INLINE(Py_ssize_t) -fastsearch(const STRINGLIB_CHAR* s, Py_ssize_t n, - const STRINGLIB_CHAR* p, Py_ssize_t m, - Py_ssize_t maxcount, int mode) -{ - unsigned long mask; - Py_ssize_t skip, count = 0; - Py_ssize_t i, j, mlast, w; - - w = n - m; - - if (w < 0 || (mode == FAST_COUNT && maxcount == 0)) - return -1; - - /* look for special cases */ - if (m <= 1) { - if (m <= 0) - return -1; - /* use special case for 1-character strings */ - if (mode == FAST_COUNT) { - for (i = 0; i < n; i++) - if (s[i] == p[0]) { - count++; - if (count == maxcount) - return maxcount; - } - return count; - } else if (mode == FAST_SEARCH) { - for (i = 0; i < n; i++) - if (s[i] == p[0]) - return i; - } else { /* FAST_RSEARCH */ - for (i = n - 1; i > -1; i--) - if (s[i] == p[0]) - return i; - } - return -1; - } - - mlast = m - 1; - skip = mlast - 1; - mask = 0; - - if (mode != FAST_RSEARCH) { - - /* create compressed boyer-moore delta 1 table */ - - /* process pattern[:-1] */ - for (i = 0; i < mlast; i++) { - STRINGLIB_BLOOM_ADD(mask, p[i]); - if (p[i] == p[mlast]) - skip = mlast - i - 1; - } - /* process pattern[-1] outside the loop */ - STRINGLIB_BLOOM_ADD(mask, p[mlast]); - - for (i = 0; i <= w; i++) { - /* note: using mlast in the skip path slows things down on x86 */ - if (s[i+m-1] == p[m-1]) { - /* candidate match */ - for (j = 0; j < mlast; j++) - if (s[i+j] != p[j]) - break; - if (j == mlast) { - /* got a match! */ - if (mode != FAST_COUNT) - return i; - count++; - if (count == maxcount) - return maxcount; - i = i + mlast; - continue; - } - /* miss: check if next character is part of pattern */ - if (!STRINGLIB_BLOOM(mask, s[i+m])) - i = i + m; - else - i = i + skip; - } else { - /* skip: check if next character is part of pattern */ - if (!STRINGLIB_BLOOM(mask, s[i+m])) - i = i + m; - } - } - } else { /* FAST_RSEARCH */ - - /* create compressed boyer-moore delta 1 table */ - - /* process pattern[0] outside the loop */ - STRINGLIB_BLOOM_ADD(mask, p[0]); - /* process pattern[:0:-1] */ - for (i = mlast; i > 0; i--) { - STRINGLIB_BLOOM_ADD(mask, p[i]); - if (p[i] == p[0]) - skip = i - 1; - } - - for (i = w; i >= 0; i--) { - if (s[i] == p[0]) { - /* candidate match */ - for (j = mlast; j > 0; j--) - if (s[i+j] != p[j]) - break; - if (j == 0) - /* got a match! */ - return i; - /* miss: check if previous character is part of pattern */ - if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1])) - i = i - m; - else - i = i - skip; - } else { - /* skip: check if previous character is part of pattern */ - if (i > 0 && !STRINGLIB_BLOOM(mask, s[i-1])) - i = i - m; - } - } - } - - if (mode != FAST_COUNT) - return -1; - return count; -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/find.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/find.h deleted file mode 100644 index a580e4b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/find.h +++ /dev/null @@ -1,175 +0,0 @@ -/* stringlib: find/index implementation */ - -#ifndef STRINGLIB_FIND_H -#define STRINGLIB_FIND_H - -#ifndef STRINGLIB_FASTSEARCH_H -#error must include "stringlib/fastsearch.h" before including this module -#endif - -Py_LOCAL_INLINE(Py_ssize_t) -stringlib_find(const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, - Py_ssize_t offset) -{ - Py_ssize_t pos; - - if (str_len < 0) - return -1; - if (sub_len == 0) - return offset; - - pos = fastsearch(str, str_len, sub, sub_len, -1, FAST_SEARCH); - - if (pos >= 0) - pos += offset; - - return pos; -} - -Py_LOCAL_INLINE(Py_ssize_t) -stringlib_rfind(const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, - Py_ssize_t offset) -{ - Py_ssize_t pos; - - if (str_len < 0) - return -1; - if (sub_len == 0) - return str_len + offset; - - pos = fastsearch(str, str_len, sub, sub_len, -1, FAST_RSEARCH); - - if (pos >= 0) - pos += offset; - - return pos; -} - -/* helper macro to fixup start/end slice values */ -#define ADJUST_INDICES(start, end, len) \ - if (end > len) \ - end = len; \ - else if (end < 0) { \ - end += len; \ - if (end < 0) \ - end = 0; \ - } \ - if (start < 0) { \ - start += len; \ - if (start < 0) \ - start = 0; \ - } - -Py_LOCAL_INLINE(Py_ssize_t) -stringlib_find_slice(const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, - Py_ssize_t start, Py_ssize_t end) -{ - ADJUST_INDICES(start, end, str_len); - return stringlib_find(str + start, end - start, sub, sub_len, start); -} - -Py_LOCAL_INLINE(Py_ssize_t) -stringlib_rfind_slice(const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sub, Py_ssize_t sub_len, - Py_ssize_t start, Py_ssize_t end) -{ - ADJUST_INDICES(start, end, str_len); - return stringlib_rfind(str + start, end - start, sub, sub_len, start); -} - -#ifdef STRINGLIB_WANT_CONTAINS_OBJ - -Py_LOCAL_INLINE(int) -stringlib_contains_obj(PyObject* str, PyObject* sub) -{ - return stringlib_find( - STRINGLIB_STR(str), STRINGLIB_LEN(str), - STRINGLIB_STR(sub), STRINGLIB_LEN(sub), 0 - ) != -1; -} - -#endif /* STRINGLIB_WANT_CONTAINS_OBJ */ - -/* -This function is a helper for the "find" family (find, rfind, index, -rindex) and for count, startswith and endswith, because they all have -the same behaviour for the arguments. - -It does not touch the variables received until it knows everything -is ok. -*/ - -#define FORMAT_BUFFER_SIZE 50 - -Py_LOCAL_INLINE(int) -stringlib_parse_args_finds(const char * function_name, PyObject *args, - PyObject **subobj, - Py_ssize_t *start, Py_ssize_t *end) -{ - PyObject *tmp_subobj; - Py_ssize_t tmp_start = 0; - Py_ssize_t tmp_end = PY_SSIZE_T_MAX; - PyObject *obj_start=Py_None, *obj_end=Py_None; - char format[FORMAT_BUFFER_SIZE] = "O|OO:"; - size_t len = strlen(format); - - strncpy(format + len, function_name, FORMAT_BUFFER_SIZE - len - 1); - format[FORMAT_BUFFER_SIZE - 1] = '\0'; - - if (!PyArg_ParseTuple(args, format, &tmp_subobj, &obj_start, &obj_end)) - return 0; - - /* To support None in "start" and "end" arguments, meaning - the same as if they were not passed. - */ - if (obj_start != Py_None) - if (!_PyEval_SliceIndex(obj_start, &tmp_start)) - return 0; - if (obj_end != Py_None) - if (!_PyEval_SliceIndex(obj_end, &tmp_end)) - return 0; - - *start = tmp_start; - *end = tmp_end; - *subobj = tmp_subobj; - return 1; -} - -#undef FORMAT_BUFFER_SIZE - -#if STRINGLIB_IS_UNICODE - -/* -Wraps stringlib_parse_args_finds() and additionally ensures that the -first argument is a unicode object. - -Note that we receive a pointer to the pointer of the substring object, -so when we create that object in this function we don't DECREF it, -because it continues living in the caller functions (those functions, -after finishing using the substring, must DECREF it). -*/ - -Py_LOCAL_INLINE(int) -stringlib_parse_args_finds_unicode(const char * function_name, PyObject *args, - PyUnicodeObject **substring, - Py_ssize_t *start, Py_ssize_t *end) -{ - PyObject *tmp_substring; - - if(stringlib_parse_args_finds(function_name, args, &tmp_substring, - start, end)) { - tmp_substring = PyUnicode_FromObject(tmp_substring); - if (!tmp_substring) - return 0; - *substring = (PyUnicodeObject *)tmp_substring; - return 1; - } - return 0; -} - -#endif /* STRINGLIB_IS_UNICODE */ - -#endif /* STRINGLIB_FIND_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/formatter.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/formatter.h deleted file mode 100644 index f10a6a1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/formatter.h +++ /dev/null @@ -1,1539 +0,0 @@ -/* implements the string, long, and float formatters. that is, - string.__format__, etc. */ - -#include - -/* Before including this, you must include either: - stringlib/unicodedefs.h - stringlib/stringdefs.h - - Also, you should define the names: - FORMAT_STRING - FORMAT_LONG - FORMAT_FLOAT - FORMAT_COMPLEX - to be whatever you want the public names of these functions to - be. These are the only non-static functions defined here. -*/ - -/* Raises an exception about an unknown presentation type for this - * type. */ - -static void -unknown_presentation_type(STRINGLIB_CHAR presentation_type, - const char* type_name) -{ -#if STRINGLIB_IS_UNICODE - /* If STRINGLIB_CHAR is Py_UNICODE, %c might be out-of-range, - hence the two cases. If it is char, gcc complains that the - condition below is always true, hence the ifdef. */ - if (presentation_type > 32 && presentation_type < 128) -#endif - PyErr_Format(PyExc_ValueError, - "Unknown format code '%c' " - "for object of type '%.200s'", - (char)presentation_type, - type_name); -#if STRINGLIB_IS_UNICODE - else - PyErr_Format(PyExc_ValueError, - "Unknown format code '\\x%x' " - "for object of type '%.200s'", - (unsigned int)presentation_type, - type_name); -#endif -} - -static void -invalid_comma_type(STRINGLIB_CHAR presentation_type) -{ -#if STRINGLIB_IS_UNICODE - /* See comment in unknown_presentation_type */ - if (presentation_type > 32 && presentation_type < 128) -#endif - PyErr_Format(PyExc_ValueError, - "Cannot specify ',' with '%c'.", - (char)presentation_type); -#if STRINGLIB_IS_UNICODE - else - PyErr_Format(PyExc_ValueError, - "Cannot specify ',' with '\\x%x'.", - (unsigned int)presentation_type); -#endif -} - -/* - get_integer consumes 0 or more decimal digit characters from an - input string, updates *result with the corresponding positive - integer, and returns the number of digits consumed. - - returns -1 on error. -*/ -static int -get_integer(STRINGLIB_CHAR **ptr, STRINGLIB_CHAR *end, - Py_ssize_t *result) -{ - Py_ssize_t accumulator, digitval; - int numdigits; - accumulator = numdigits = 0; - for (;;(*ptr)++, numdigits++) { - if (*ptr >= end) - break; - digitval = STRINGLIB_TODECIMAL(**ptr); - if (digitval < 0) - break; - /* - Detect possible overflow before it happens: - - accumulator * 10 + digitval > PY_SSIZE_T_MAX if and only if - accumulator > (PY_SSIZE_T_MAX - digitval) / 10. - */ - if (accumulator > (PY_SSIZE_T_MAX - digitval) / 10) { - PyErr_Format(PyExc_ValueError, - "Too many decimal digits in format string"); - return -1; - } - accumulator = accumulator * 10 + digitval; - } - *result = accumulator; - return numdigits; -} - -/************************************************************************/ -/*********** standard format specifier parsing **************************/ -/************************************************************************/ - -/* returns true if this character is a specifier alignment token */ -Py_LOCAL_INLINE(int) -is_alignment_token(STRINGLIB_CHAR c) -{ - switch (c) { - case '<': case '>': case '=': case '^': - return 1; - default: - return 0; - } -} - -/* returns true if this character is a sign element */ -Py_LOCAL_INLINE(int) -is_sign_element(STRINGLIB_CHAR c) -{ - switch (c) { - case ' ': case '+': case '-': - return 1; - default: - return 0; - } -} - - -typedef struct { - STRINGLIB_CHAR fill_char; - STRINGLIB_CHAR align; - int alternate; - STRINGLIB_CHAR sign; - Py_ssize_t width; - int thousands_separators; - Py_ssize_t precision; - STRINGLIB_CHAR type; -} InternalFormatSpec; - - -#if 0 -/* Occassionally useful for debugging. Should normally be commented out. */ -static void -DEBUG_PRINT_FORMAT_SPEC(InternalFormatSpec *format) -{ - printf("internal format spec: fill_char %d\n", format->fill_char); - printf("internal format spec: align %d\n", format->align); - printf("internal format spec: alternate %d\n", format->alternate); - printf("internal format spec: sign %d\n", format->sign); - printf("internal format spec: width %zd\n", format->width); - printf("internal format spec: thousands_separators %d\n", - format->thousands_separators); - printf("internal format spec: precision %zd\n", format->precision); - printf("internal format spec: type %c\n", format->type); - printf("\n"); -} -#endif - - -/* - ptr points to the start of the format_spec, end points just past its end. - fills in format with the parsed information. - returns 1 on success, 0 on failure. - if failure, sets the exception -*/ -static int -parse_internal_render_format_spec(STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len, - InternalFormatSpec *format, - char default_type, - char default_align) -{ - STRINGLIB_CHAR *ptr = format_spec; - STRINGLIB_CHAR *end = format_spec + format_spec_len; - - /* end-ptr is used throughout this code to specify the length of - the input string */ - - Py_ssize_t consumed; - int align_specified = 0; - int fill_char_specified = 0; - - format->fill_char = ' '; - format->align = default_align; - format->alternate = 0; - format->sign = '\0'; - format->width = -1; - format->thousands_separators = 0; - format->precision = -1; - format->type = default_type; - - /* If the second char is an alignment token, - then parse the fill char */ - if (end-ptr >= 2 && is_alignment_token(ptr[1])) { - format->align = ptr[1]; - format->fill_char = ptr[0]; - fill_char_specified = 1; - align_specified = 1; - ptr += 2; - } - else if (end-ptr >= 1 && is_alignment_token(ptr[0])) { - format->align = ptr[0]; - align_specified = 1; - ++ptr; - } - - /* Parse the various sign options */ - if (end-ptr >= 1 && is_sign_element(ptr[0])) { - format->sign = ptr[0]; - ++ptr; - } - - /* If the next character is #, we're in alternate mode. This only - applies to integers. */ - if (end-ptr >= 1 && ptr[0] == '#') { - format->alternate = 1; - ++ptr; - } - - /* The special case for 0-padding (backwards compat) */ - if (!fill_char_specified && end-ptr >= 1 && ptr[0] == '0') { - format->fill_char = '0'; - if (!align_specified) { - format->align = '='; - } - ++ptr; - } - - consumed = get_integer(&ptr, end, &format->width); - if (consumed == -1) - /* Overflow error. Exception already set. */ - return 0; - - /* If consumed is 0, we didn't consume any characters for the - width. In that case, reset the width to -1, because - get_integer() will have set it to zero. -1 is how we record - that the width wasn't specified. */ - if (consumed == 0) - format->width = -1; - - /* Comma signifies add thousands separators */ - if (end-ptr && ptr[0] == ',') { - format->thousands_separators = 1; - ++ptr; - } - - /* Parse field precision */ - if (end-ptr && ptr[0] == '.') { - ++ptr; - - consumed = get_integer(&ptr, end, &format->precision); - if (consumed == -1) - /* Overflow error. Exception already set. */ - return 0; - - /* Not having a precision after a dot is an error. */ - if (consumed == 0) { - PyErr_Format(PyExc_ValueError, - "Format specifier missing precision"); - return 0; - } - - } - - /* Finally, parse the type field. */ - - if (end-ptr > 1) { - /* More than one char remain, invalid conversion spec. */ - PyErr_Format(PyExc_ValueError, "Invalid conversion specification"); - return 0; - } - - if (end-ptr == 1) { - format->type = ptr[0]; - ++ptr; - } - - /* Do as much validating as we can, just by looking at the format - specifier. Do not take into account what type of formatting - we're doing (int, float, string). */ - - if (format->thousands_separators) { - switch (format->type) { - case 'd': - case 'e': - case 'f': - case 'g': - case 'E': - case 'G': - case '%': - case 'F': - case '\0': - /* These are allowed. See PEP 378.*/ - break; - default: - invalid_comma_type(format->type); - return 0; - } - } - - return 1; -} - -/* Calculate the padding needed. */ -static void -calc_padding(Py_ssize_t nchars, Py_ssize_t width, STRINGLIB_CHAR align, - Py_ssize_t *n_lpadding, Py_ssize_t *n_rpadding, - Py_ssize_t *n_total) -{ - if (width >= 0) { - if (nchars > width) - *n_total = nchars; - else - *n_total = width; - } - else { - /* not specified, use all of the chars and no more */ - *n_total = nchars; - } - - /* Figure out how much leading space we need, based on the - aligning */ - if (align == '>') - *n_lpadding = *n_total - nchars; - else if (align == '^') - *n_lpadding = (*n_total - nchars) / 2; - else if (align == '<' || align == '=') - *n_lpadding = 0; - else { - /* We should never have an unspecified alignment. */ - *n_lpadding = 0; - assert(0); - } - - *n_rpadding = *n_total - nchars - *n_lpadding; -} - -/* Do the padding, and return a pointer to where the caller-supplied - content goes. */ -static STRINGLIB_CHAR * -fill_padding(STRINGLIB_CHAR *p, Py_ssize_t nchars, STRINGLIB_CHAR fill_char, - Py_ssize_t n_lpadding, Py_ssize_t n_rpadding) -{ - /* Pad on left. */ - if (n_lpadding) - STRINGLIB_FILL(p, fill_char, n_lpadding); - - /* Pad on right. */ - if (n_rpadding) - STRINGLIB_FILL(p + nchars + n_lpadding, fill_char, n_rpadding); - - /* Pointer to the user content. */ - return p + n_lpadding; -} - -#if defined FORMAT_FLOAT || defined FORMAT_LONG || defined FORMAT_COMPLEX -/************************************************************************/ -/*********** common routines for numeric formatting *********************/ -/************************************************************************/ - -/* Locale type codes. */ -#define LT_CURRENT_LOCALE 0 -#define LT_DEFAULT_LOCALE 1 -#define LT_NO_LOCALE 2 - -/* Locale info needed for formatting integers and the part of floats - before and including the decimal. Note that locales only support - 8-bit chars, not unicode. */ -typedef struct { - char *decimal_point; - char *thousands_sep; - char *grouping; -} LocaleInfo; - -/* describes the layout for an integer, see the comment in - calc_number_widths() for details */ -typedef struct { - Py_ssize_t n_lpadding; - Py_ssize_t n_prefix; - Py_ssize_t n_spadding; - Py_ssize_t n_rpadding; - char sign; - Py_ssize_t n_sign; /* number of digits needed for sign (0/1) */ - Py_ssize_t n_grouped_digits; /* Space taken up by the digits, including - any grouping chars. */ - Py_ssize_t n_decimal; /* 0 if only an integer */ - Py_ssize_t n_remainder; /* Digits in decimal and/or exponent part, - excluding the decimal itself, if - present. */ - - /* These 2 are not the widths of fields, but are needed by - STRINGLIB_GROUPING. */ - Py_ssize_t n_digits; /* The number of digits before a decimal - or exponent. */ - Py_ssize_t n_min_width; /* The min_width we used when we computed - the n_grouped_digits width. */ -} NumberFieldWidths; - - -/* Given a number of the form: - digits[remainder] - where ptr points to the start and end points to the end, find where - the integer part ends. This could be a decimal, an exponent, both, - or neither. - If a decimal point is present, set *has_decimal and increment - remainder beyond it. - Results are undefined (but shouldn't crash) for improperly - formatted strings. -*/ -static void -parse_number(STRINGLIB_CHAR *ptr, Py_ssize_t len, - Py_ssize_t *n_remainder, int *has_decimal) -{ - STRINGLIB_CHAR *end = ptr + len; - STRINGLIB_CHAR *remainder; - - while (ptrn_digits = n_number - n_remainder - (has_decimal?1:0); - spec->n_lpadding = 0; - spec->n_prefix = n_prefix; - spec->n_decimal = has_decimal ? strlen(locale->decimal_point) : 0; - spec->n_remainder = n_remainder; - spec->n_spadding = 0; - spec->n_rpadding = 0; - spec->sign = '\0'; - spec->n_sign = 0; - - /* the output will look like: - | | - | | - | | - - sign is computed from format->sign and the actual - sign of the number - - prefix is given (it's for the '0x' prefix) - - digits is already known - - the total width is either given, or computed from the - actual digits - - only one of lpadding, spadding, and rpadding can be non-zero, - and it's calculated from the width and other fields - */ - - /* compute the various parts we're going to write */ - switch (format->sign) { - case '+': - /* always put a + or - */ - spec->n_sign = 1; - spec->sign = (sign_char == '-' ? '-' : '+'); - break; - case ' ': - spec->n_sign = 1; - spec->sign = (sign_char == '-' ? '-' : ' '); - break; - default: - /* Not specified, or the default (-) */ - if (sign_char == '-') { - spec->n_sign = 1; - spec->sign = '-'; - } - } - - /* The number of chars used for non-digits and non-padding. */ - n_non_digit_non_padding = spec->n_sign + spec->n_prefix + spec->n_decimal + - spec->n_remainder; - - /* min_width can go negative, that's okay. format->width == -1 means - we don't care. */ - if (format->fill_char == '0' && format->align == '=') - spec->n_min_width = format->width - n_non_digit_non_padding; - else - spec->n_min_width = 0; - - if (spec->n_digits == 0) - /* This case only occurs when using 'c' formatting, we need - to special case it because the grouping code always wants - to have at least one character. */ - spec->n_grouped_digits = 0; - else - spec->n_grouped_digits = STRINGLIB_GROUPING(NULL, 0, NULL, - spec->n_digits, - spec->n_min_width, - locale->grouping, - locale->thousands_sep); - - /* Given the desired width and the total of digit and non-digit - space we consume, see if we need any padding. format->width can - be negative (meaning no padding), but this code still works in - that case. */ - n_padding = format->width - - (n_non_digit_non_padding + spec->n_grouped_digits); - if (n_padding > 0) { - /* Some padding is needed. Determine if it's left, space, or right. */ - switch (format->align) { - case '<': - spec->n_rpadding = n_padding; - break; - case '^': - spec->n_lpadding = n_padding / 2; - spec->n_rpadding = n_padding - spec->n_lpadding; - break; - case '=': - spec->n_spadding = n_padding; - break; - case '>': - spec->n_lpadding = n_padding; - break; - default: - /* Shouldn't get here, but treat it as '>' */ - spec->n_lpadding = n_padding; - assert(0); - break; - } - } - return spec->n_lpadding + spec->n_sign + spec->n_prefix + - spec->n_spadding + spec->n_grouped_digits + spec->n_decimal + - spec->n_remainder + spec->n_rpadding; -} - -/* Fill in the digit parts of a numbers's string representation, - as determined in calc_number_widths(). - No error checking, since we know the buffer is the correct size. */ -static void -fill_number(STRINGLIB_CHAR *buf, const NumberFieldWidths *spec, - STRINGLIB_CHAR *digits, Py_ssize_t n_digits, - STRINGLIB_CHAR *prefix, STRINGLIB_CHAR fill_char, - LocaleInfo *locale, int toupper) -{ - /* Used to keep track of digits, decimal, and remainder. */ - STRINGLIB_CHAR *p = digits; - -#ifndef NDEBUG - Py_ssize_t r; -#endif - - if (spec->n_lpadding) { - STRINGLIB_FILL(buf, fill_char, spec->n_lpadding); - buf += spec->n_lpadding; - } - if (spec->n_sign == 1) { - *buf++ = spec->sign; - } - if (spec->n_prefix) { - memmove(buf, - prefix, - spec->n_prefix * sizeof(STRINGLIB_CHAR)); - if (toupper) { - Py_ssize_t t; - for (t = 0; t < spec->n_prefix; ++t) - buf[t] = STRINGLIB_TOUPPER(buf[t]); - } - buf += spec->n_prefix; - } - if (spec->n_spadding) { - STRINGLIB_FILL(buf, fill_char, spec->n_spadding); - buf += spec->n_spadding; - } - - /* Only for type 'c' special case, it has no digits. */ - if (spec->n_digits != 0) { - /* Fill the digits with InsertThousandsGrouping. */ -#ifndef NDEBUG - r = -#endif - STRINGLIB_GROUPING(buf, spec->n_grouped_digits, digits, - spec->n_digits, spec->n_min_width, - locale->grouping, locale->thousands_sep); -#ifndef NDEBUG - assert(r == spec->n_grouped_digits); -#endif - p += spec->n_digits; - } - if (toupper) { - Py_ssize_t t; - for (t = 0; t < spec->n_grouped_digits; ++t) - buf[t] = STRINGLIB_TOUPPER(buf[t]); - } - buf += spec->n_grouped_digits; - - if (spec->n_decimal) { - Py_ssize_t t; - for (t = 0; t < spec->n_decimal; ++t) - buf[t] = locale->decimal_point[t]; - buf += spec->n_decimal; - p += 1; - } - - if (spec->n_remainder) { - memcpy(buf, p, spec->n_remainder * sizeof(STRINGLIB_CHAR)); - buf += spec->n_remainder; - p += spec->n_remainder; - } - - if (spec->n_rpadding) { - STRINGLIB_FILL(buf, fill_char, spec->n_rpadding); - buf += spec->n_rpadding; - } -} - -static char no_grouping[1] = {CHAR_MAX}; - -/* Find the decimal point character(s?), thousands_separator(s?), and - grouping description, either for the current locale if type is - LT_CURRENT_LOCALE, a hard-coded locale if LT_DEFAULT_LOCALE, or - none if LT_NO_LOCALE. */ -static void -get_locale_info(int type, LocaleInfo *locale_info) -{ - switch (type) { - case LT_CURRENT_LOCALE: { - struct lconv *locale_data = localeconv(); - locale_info->decimal_point = locale_data->decimal_point; - locale_info->thousands_sep = locale_data->thousands_sep; - locale_info->grouping = locale_data->grouping; - break; - } - case LT_DEFAULT_LOCALE: - locale_info->decimal_point = "."; - locale_info->thousands_sep = ","; - locale_info->grouping = "\3"; /* Group every 3 characters. The - (implicit) trailing 0 means repeat - infinitely. */ - break; - case LT_NO_LOCALE: - locale_info->decimal_point = "."; - locale_info->thousands_sep = ""; - locale_info->grouping = no_grouping; - break; - default: - assert(0); - } -} - -#endif /* FORMAT_FLOAT || FORMAT_LONG || FORMAT_COMPLEX */ - -/************************************************************************/ -/*********** string formatting ******************************************/ -/************************************************************************/ - -static PyObject * -format_string_internal(PyObject *value, const InternalFormatSpec *format) -{ - Py_ssize_t lpad; - Py_ssize_t rpad; - Py_ssize_t total; - STRINGLIB_CHAR *p; - Py_ssize_t len = STRINGLIB_LEN(value); - PyObject *result = NULL; - - /* sign is not allowed on strings */ - if (format->sign != '\0') { - PyErr_SetString(PyExc_ValueError, - "Sign not allowed in string format specifier"); - goto done; - } - - /* alternate is not allowed on strings */ - if (format->alternate) { - PyErr_SetString(PyExc_ValueError, - "Alternate form (#) not allowed in string format " - "specifier"); - goto done; - } - - /* '=' alignment not allowed on strings */ - if (format->align == '=') { - PyErr_SetString(PyExc_ValueError, - "'=' alignment not allowed " - "in string format specifier"); - goto done; - } - - /* if precision is specified, output no more that format.precision - characters */ - if (format->precision >= 0 && len >= format->precision) { - len = format->precision; - } - - calc_padding(len, format->width, format->align, &lpad, &rpad, &total); - - /* allocate the resulting string */ - result = STRINGLIB_NEW(NULL, total); - if (result == NULL) - goto done; - - /* Write into that space. First the padding. */ - p = fill_padding(STRINGLIB_STR(result), len, - format->fill_char, lpad, rpad); - - /* Then the source string. */ - memcpy(p, STRINGLIB_STR(value), len * sizeof(STRINGLIB_CHAR)); - -done: - return result; -} - - -/************************************************************************/ -/*********** long formatting ********************************************/ -/************************************************************************/ - -#if defined FORMAT_LONG || defined FORMAT_INT -typedef PyObject* -(*IntOrLongToString)(PyObject *value, int base); - -static PyObject * -format_int_or_long_internal(PyObject *value, const InternalFormatSpec *format, - IntOrLongToString tostring) -{ - PyObject *result = NULL; - PyObject *tmp = NULL; - STRINGLIB_CHAR *pnumeric_chars; - STRINGLIB_CHAR numeric_char; - STRINGLIB_CHAR sign_char = '\0'; - Py_ssize_t n_digits; /* count of digits need from the computed - string */ - Py_ssize_t n_remainder = 0; /* Used only for 'c' formatting, which - produces non-digits */ - Py_ssize_t n_prefix = 0; /* Count of prefix chars, (e.g., '0x') */ - Py_ssize_t n_total; - STRINGLIB_CHAR *prefix = NULL; - NumberFieldWidths spec; - long x; - - /* Locale settings, either from the actual locale or - from a hard-code pseudo-locale */ - LocaleInfo locale; - - /* no precision allowed on integers */ - if (format->precision != -1) { - PyErr_SetString(PyExc_ValueError, - "Precision not allowed in integer format specifier"); - goto done; - } - - /* special case for character formatting */ - if (format->type == 'c') { - /* error to specify a sign */ - if (format->sign != '\0') { - PyErr_SetString(PyExc_ValueError, - "Sign not allowed with integer" - " format specifier 'c'"); - goto done; - } - - /* Error to specify a comma. */ - if (format->thousands_separators) { - PyErr_SetString(PyExc_ValueError, - "Thousands separators not allowed with integer" - " format specifier 'c'"); - goto done; - } - - /* taken from unicodeobject.c formatchar() */ - /* Integer input truncated to a character */ -/* XXX: won't work for int */ - x = PyLong_AsLong(value); - if (x == -1 && PyErr_Occurred()) - goto done; -#ifdef Py_UNICODE_WIDE - if (x < 0 || x > 0x10ffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000) " - "(wide Python build)"); - goto done; - } -#else - if (x < 0 || x > 0xffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x10000) " - "(narrow Python build)"); - goto done; - } -#endif - numeric_char = (STRINGLIB_CHAR)x; - pnumeric_chars = &numeric_char; - n_digits = 1; - - /* As a sort-of hack, we tell calc_number_widths that we only - have "remainder" characters. calc_number_widths thinks - these are characters that don't get formatted, only copied - into the output string. We do this for 'c' formatting, - because the characters are likely to be non-digits. */ - n_remainder = 1; - } - else { - int base; - int leading_chars_to_skip = 0; /* Number of characters added by - PyNumber_ToBase that we want to - skip over. */ - - /* Compute the base and how many characters will be added by - PyNumber_ToBase */ - switch (format->type) { - case 'b': - base = 2; - leading_chars_to_skip = 2; /* 0b */ - break; - case 'o': - base = 8; - leading_chars_to_skip = 2; /* 0o */ - break; - case 'x': - case 'X': - base = 16; - leading_chars_to_skip = 2; /* 0x */ - break; - default: /* shouldn't be needed, but stops a compiler warning */ - case 'd': - case 'n': - base = 10; - break; - } - - /* The number of prefix chars is the same as the leading - chars to skip */ - if (format->alternate) - n_prefix = leading_chars_to_skip; - - /* Do the hard part, converting to a string in a given base */ - tmp = tostring(value, base); - if (tmp == NULL) - goto done; - - pnumeric_chars = STRINGLIB_STR(tmp); - n_digits = STRINGLIB_LEN(tmp); - - prefix = pnumeric_chars; - - /* Remember not to modify what pnumeric_chars points to. it - might be interned. Only modify it after we copy it into a - newly allocated output buffer. */ - - /* Is a sign character present in the output? If so, remember it - and skip it */ - if (pnumeric_chars[0] == '-') { - sign_char = pnumeric_chars[0]; - ++prefix; - ++leading_chars_to_skip; - } - - /* Skip over the leading chars (0x, 0b, etc.) */ - n_digits -= leading_chars_to_skip; - pnumeric_chars += leading_chars_to_skip; - } - - /* Determine the grouping, separator, and decimal point, if any. */ - get_locale_info(format->type == 'n' ? LT_CURRENT_LOCALE : - (format->thousands_separators ? - LT_DEFAULT_LOCALE : - LT_NO_LOCALE), - &locale); - - /* Calculate how much memory we'll need. */ - n_total = calc_number_widths(&spec, n_prefix, sign_char, pnumeric_chars, - n_digits, n_remainder, 0, &locale, format); - - /* Allocate the memory. */ - result = STRINGLIB_NEW(NULL, n_total); - if (!result) - goto done; - - /* Populate the memory. */ - fill_number(STRINGLIB_STR(result), &spec, pnumeric_chars, n_digits, - prefix, format->fill_char, &locale, format->type == 'X'); - -done: - Py_XDECREF(tmp); - return result; -} -#endif /* defined FORMAT_LONG || defined FORMAT_INT */ - -/************************************************************************/ -/*********** float formatting *******************************************/ -/************************************************************************/ - -#ifdef FORMAT_FLOAT -#if STRINGLIB_IS_UNICODE -static void -strtounicode(Py_UNICODE *buffer, const char *charbuffer, Py_ssize_t len) -{ - Py_ssize_t i; - for (i = 0; i < len; ++i) - buffer[i] = (Py_UNICODE)charbuffer[i]; -} -#endif - -/* much of this is taken from unicodeobject.c */ -static PyObject * -format_float_internal(PyObject *value, - const InternalFormatSpec *format) -{ - char *buf = NULL; /* buffer returned from PyOS_double_to_string */ - Py_ssize_t n_digits; - Py_ssize_t n_remainder; - Py_ssize_t n_total; - int has_decimal; - double val; - Py_ssize_t precision; - Py_ssize_t default_precision = 6; - STRINGLIB_CHAR type = format->type; - int add_pct = 0; - STRINGLIB_CHAR *p; - NumberFieldWidths spec; - int flags = 0; - PyObject *result = NULL; - STRINGLIB_CHAR sign_char = '\0'; - int float_type; /* Used to see if we have a nan, inf, or regular float. */ - -#if STRINGLIB_IS_UNICODE - Py_UNICODE *unicode_tmp = NULL; -#endif - - /* Locale settings, either from the actual locale or - from a hard-code pseudo-locale */ - LocaleInfo locale; - - if (format->precision > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "precision too big"); - goto done; - } - precision = (int)format->precision; - - /* Alternate is not allowed on floats. */ - if (format->alternate) { - PyErr_SetString(PyExc_ValueError, - "Alternate form (#) not allowed in float format " - "specifier"); - goto done; - } - - if (type == '\0') { - /* Omitted type specifier. This is like 'g' but with at least one - digit after the decimal point, and different default precision.*/ - type = 'g'; - default_precision = PyFloat_STR_PRECISION; - flags |= Py_DTSF_ADD_DOT_0; - } - - if (type == 'n') - /* 'n' is the same as 'g', except for the locale used to - format the result. We take care of that later. */ - type = 'g'; - - val = PyFloat_AsDouble(value); - if (val == -1.0 && PyErr_Occurred()) - goto done; - - if (type == '%') { - type = 'f'; - val *= 100; - add_pct = 1; - } - - if (precision < 0) - precision = default_precision; - - /* Cast "type", because if we're in unicode we need to pass a - 8-bit char. This is safe, because we've restricted what "type" - can be. */ - buf = PyOS_double_to_string(val, (char)type, precision, flags, - &float_type); - if (buf == NULL) - goto done; - n_digits = strlen(buf); - - if (add_pct) { - /* We know that buf has a trailing zero (since we just called - strlen() on it), and we don't use that fact any more. So we - can just write over the trailing zero. */ - buf[n_digits] = '%'; - n_digits += 1; - } - - /* Since there is no unicode version of PyOS_double_to_string, - just use the 8 bit version and then convert to unicode. */ -#if STRINGLIB_IS_UNICODE - unicode_tmp = (Py_UNICODE*)PyMem_Malloc((n_digits)*sizeof(Py_UNICODE)); - if (unicode_tmp == NULL) { - PyErr_NoMemory(); - goto done; - } - strtounicode(unicode_tmp, buf, n_digits); - p = unicode_tmp; -#else - p = buf; -#endif - - /* Is a sign character present in the output? If so, remember it - and skip it */ - if (*p == '-') { - sign_char = *p; - ++p; - --n_digits; - } - - /* Determine if we have any "remainder" (after the digits, might include - decimal or exponent or both (or neither)) */ - parse_number(p, n_digits, &n_remainder, &has_decimal); - - /* Determine the grouping, separator, and decimal point, if any. */ - get_locale_info(format->type == 'n' ? LT_CURRENT_LOCALE : - (format->thousands_separators ? - LT_DEFAULT_LOCALE : - LT_NO_LOCALE), - &locale); - - /* Calculate how much memory we'll need. */ - n_total = calc_number_widths(&spec, 0, sign_char, p, n_digits, - n_remainder, has_decimal, &locale, format); - - /* Allocate the memory. */ - result = STRINGLIB_NEW(NULL, n_total); - if (result == NULL) - goto done; - - /* Populate the memory. */ - fill_number(STRINGLIB_STR(result), &spec, p, n_digits, NULL, - format->fill_char, &locale, 0); - -done: - PyMem_Free(buf); -#if STRINGLIB_IS_UNICODE - PyMem_Free(unicode_tmp); -#endif - return result; -} -#endif /* FORMAT_FLOAT */ - -/************************************************************************/ -/*********** complex formatting *****************************************/ -/************************************************************************/ - -#ifdef FORMAT_COMPLEX - -static PyObject * -format_complex_internal(PyObject *value, - const InternalFormatSpec *format) -{ - double re; - double im; - char *re_buf = NULL; /* buffer returned from PyOS_double_to_string */ - char *im_buf = NULL; /* buffer returned from PyOS_double_to_string */ - - InternalFormatSpec tmp_format = *format; - Py_ssize_t n_re_digits; - Py_ssize_t n_im_digits; - Py_ssize_t n_re_remainder; - Py_ssize_t n_im_remainder; - Py_ssize_t n_re_total; - Py_ssize_t n_im_total; - int re_has_decimal; - int im_has_decimal; - Py_ssize_t precision; - Py_ssize_t default_precision = 6; - STRINGLIB_CHAR type = format->type; - STRINGLIB_CHAR *p_re; - STRINGLIB_CHAR *p_im; - NumberFieldWidths re_spec; - NumberFieldWidths im_spec; - int flags = 0; - PyObject *result = NULL; - STRINGLIB_CHAR *p; - STRINGLIB_CHAR re_sign_char = '\0'; - STRINGLIB_CHAR im_sign_char = '\0'; - int re_float_type; /* Used to see if we have a nan, inf, or regular float. */ - int im_float_type; - int add_parens = 0; - int skip_re = 0; - Py_ssize_t lpad; - Py_ssize_t rpad; - Py_ssize_t total; - -#if STRINGLIB_IS_UNICODE - Py_UNICODE *re_unicode_tmp = NULL; - Py_UNICODE *im_unicode_tmp = NULL; -#endif - - /* Locale settings, either from the actual locale or - from a hard-code pseudo-locale */ - LocaleInfo locale; - - if (format->precision > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "precision too big"); - goto done; - } - precision = (int)format->precision; - - /* Alternate is not allowed on complex. */ - if (format->alternate) { - PyErr_SetString(PyExc_ValueError, - "Alternate form (#) not allowed in complex format " - "specifier"); - goto done; - } - - /* Neither is zero pading. */ - if (format->fill_char == '0') { - PyErr_SetString(PyExc_ValueError, - "Zero padding is not allowed in complex format " - "specifier"); - goto done; - } - - /* Neither is '=' alignment . */ - if (format->align == '=') { - PyErr_SetString(PyExc_ValueError, - "'=' alignment flag is not allowed in complex format " - "specifier"); - goto done; - } - - re = PyComplex_RealAsDouble(value); - if (re == -1.0 && PyErr_Occurred()) - goto done; - im = PyComplex_ImagAsDouble(value); - if (im == -1.0 && PyErr_Occurred()) - goto done; - - if (type == '\0') { - /* Omitted type specifier. Should be like str(self). */ - type = 'g'; - default_precision = PyFloat_STR_PRECISION; - if (re == 0.0 && copysign(1.0, re) == 1.0) - skip_re = 1; - else - add_parens = 1; - } - - if (type == 'n') - /* 'n' is the same as 'g', except for the locale used to - format the result. We take care of that later. */ - type = 'g'; - - if (precision < 0) - precision = default_precision; - - /* Cast "type", because if we're in unicode we need to pass a - 8-bit char. This is safe, because we've restricted what "type" - can be. */ - re_buf = PyOS_double_to_string(re, (char)type, precision, flags, - &re_float_type); - if (re_buf == NULL) - goto done; - im_buf = PyOS_double_to_string(im, (char)type, precision, flags, - &im_float_type); - if (im_buf == NULL) - goto done; - - n_re_digits = strlen(re_buf); - n_im_digits = strlen(im_buf); - - /* Since there is no unicode version of PyOS_double_to_string, - just use the 8 bit version and then convert to unicode. */ -#if STRINGLIB_IS_UNICODE - re_unicode_tmp = (Py_UNICODE*)PyMem_Malloc((n_re_digits)*sizeof(Py_UNICODE)); - if (re_unicode_tmp == NULL) { - PyErr_NoMemory(); - goto done; - } - strtounicode(re_unicode_tmp, re_buf, n_re_digits); - p_re = re_unicode_tmp; - - im_unicode_tmp = (Py_UNICODE*)PyMem_Malloc((n_im_digits)*sizeof(Py_UNICODE)); - if (im_unicode_tmp == NULL) { - PyErr_NoMemory(); - goto done; - } - strtounicode(im_unicode_tmp, im_buf, n_im_digits); - p_im = im_unicode_tmp; -#else - p_re = re_buf; - p_im = im_buf; -#endif - - /* Is a sign character present in the output? If so, remember it - and skip it */ - if (*p_re == '-') { - re_sign_char = *p_re; - ++p_re; - --n_re_digits; - } - if (*p_im == '-') { - im_sign_char = *p_im; - ++p_im; - --n_im_digits; - } - - /* Determine if we have any "remainder" (after the digits, might include - decimal or exponent or both (or neither)) */ - parse_number(p_re, n_re_digits, &n_re_remainder, &re_has_decimal); - parse_number(p_im, n_im_digits, &n_im_remainder, &im_has_decimal); - - /* Determine the grouping, separator, and decimal point, if any. */ - get_locale_info(format->type == 'n' ? LT_CURRENT_LOCALE : - (format->thousands_separators ? - LT_DEFAULT_LOCALE : - LT_NO_LOCALE), - &locale); - - /* Turn off any padding. We'll do it later after we've composed - the numbers without padding. */ - tmp_format.fill_char = '\0'; - tmp_format.align = '<'; - tmp_format.width = -1; - - /* Calculate how much memory we'll need. */ - n_re_total = calc_number_widths(&re_spec, 0, re_sign_char, p_re, - n_re_digits, n_re_remainder, - re_has_decimal, &locale, &tmp_format); - - /* Same formatting, but always include a sign, unless the real part is - * going to be omitted, in which case we use whatever sign convention was - * requested by the original format. */ - if (!skip_re) - tmp_format.sign = '+'; - n_im_total = calc_number_widths(&im_spec, 0, im_sign_char, p_im, - n_im_digits, n_im_remainder, - im_has_decimal, &locale, &tmp_format); - - if (skip_re) - n_re_total = 0; - - /* Add 1 for the 'j', and optionally 2 for parens. */ - calc_padding(n_re_total + n_im_total + 1 + add_parens * 2, - format->width, format->align, &lpad, &rpad, &total); - - result = STRINGLIB_NEW(NULL, total); - if (result == NULL) - goto done; - - /* Populate the memory. First, the padding. */ - p = fill_padding(STRINGLIB_STR(result), - n_re_total + n_im_total + 1 + add_parens * 2, - format->fill_char, lpad, rpad); - - if (add_parens) - *p++ = '('; - - if (!skip_re) { - fill_number(p, &re_spec, p_re, n_re_digits, NULL, 0, &locale, 0); - p += n_re_total; - } - fill_number(p, &im_spec, p_im, n_im_digits, NULL, 0, &locale, 0); - p += n_im_total; - *p++ = 'j'; - - if (add_parens) - *p++ = ')'; - -done: - PyMem_Free(re_buf); - PyMem_Free(im_buf); -#if STRINGLIB_IS_UNICODE - PyMem_Free(re_unicode_tmp); - PyMem_Free(im_unicode_tmp); -#endif - return result; -} -#endif /* FORMAT_COMPLEX */ - -/************************************************************************/ -/*********** built in formatters ****************************************/ -/************************************************************************/ -PyObject * -FORMAT_STRING(PyObject *obj, - STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len) -{ - InternalFormatSpec format; - PyObject *result = NULL; - - /* check for the special case of zero length format spec, make - it equivalent to str(obj) */ - if (format_spec_len == 0) { - result = STRINGLIB_TOSTR(obj); - goto done; - } - - /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, format_spec_len, - &format, 's', '<')) - goto done; - - /* type conversion? */ - switch (format.type) { - case 's': - /* no type conversion needed, already a string. do the formatting */ - result = format_string_internal(obj, &format); - break; - default: - /* unknown */ - unknown_presentation_type(format.type, obj->ob_type->tp_name); - goto done; - } - -done: - return result; -} - -#if defined FORMAT_LONG || defined FORMAT_INT -static PyObject* -format_int_or_long(PyObject* obj, - STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len, - IntOrLongToString tostring) -{ - PyObject *result = NULL; - PyObject *tmp = NULL; - InternalFormatSpec format; - - /* check for the special case of zero length format spec, make - it equivalent to str(obj) */ - if (format_spec_len == 0) { - result = STRINGLIB_TOSTR(obj); - goto done; - } - - /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, - format_spec_len, - &format, 'd', '>')) - goto done; - - /* type conversion? */ - switch (format.type) { - case 'b': - case 'c': - case 'd': - case 'o': - case 'x': - case 'X': - case 'n': - /* no type conversion needed, already an int (or long). do - the formatting */ - result = format_int_or_long_internal(obj, &format, tostring); - break; - - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - case '%': - /* convert to float */ - tmp = PyNumber_Float(obj); - if (tmp == NULL) - goto done; - result = format_float_internal(tmp, &format); - break; - - default: - /* unknown */ - unknown_presentation_type(format.type, obj->ob_type->tp_name); - goto done; - } - -done: - Py_XDECREF(tmp); - return result; -} -#endif /* FORMAT_LONG || defined FORMAT_INT */ - -#ifdef FORMAT_LONG -/* Need to define long_format as a function that will convert a long - to a string. In 3.0, _PyLong_Format has the correct signature. In - 2.x, we need to fudge a few parameters */ -#if PY_VERSION_HEX >= 0x03000000 -#define long_format _PyLong_Format -#else -static PyObject* -long_format(PyObject* value, int base) -{ - /* Convert to base, don't add trailing 'L', and use the new octal - format. We already know this is a long object */ - assert(PyLong_Check(value)); - /* convert to base, don't add 'L', and use the new octal format */ - return _PyLong_Format(value, base, 0, 1); -} -#endif - -PyObject * -FORMAT_LONG(PyObject *obj, - STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len) -{ - return format_int_or_long(obj, format_spec, format_spec_len, - long_format); -} -#endif /* FORMAT_LONG */ - -#ifdef FORMAT_INT -/* this is only used for 2.x, not 3.0 */ -static PyObject* -int_format(PyObject* value, int base) -{ - /* Convert to base, and use the new octal format. We already - know this is an int object */ - assert(PyInt_Check(value)); - return _PyInt_Format((PyIntObject*)value, base, 1); -} - -PyObject * -FORMAT_INT(PyObject *obj, - STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len) -{ - return format_int_or_long(obj, format_spec, format_spec_len, - int_format); -} -#endif /* FORMAT_INT */ - -#ifdef FORMAT_FLOAT -PyObject * -FORMAT_FLOAT(PyObject *obj, - STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len) -{ - PyObject *result = NULL; - InternalFormatSpec format; - - /* check for the special case of zero length format spec, make - it equivalent to str(obj) */ - if (format_spec_len == 0) { - result = STRINGLIB_TOSTR(obj); - goto done; - } - - /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, - format_spec_len, - &format, '\0', '>')) - goto done; - - /* type conversion? */ - switch (format.type) { - case '\0': /* No format code: like 'g', but with at least one decimal. */ - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - case 'n': - case '%': - /* no conversion, already a float. do the formatting */ - result = format_float_internal(obj, &format); - break; - - default: - /* unknown */ - unknown_presentation_type(format.type, obj->ob_type->tp_name); - goto done; - } - -done: - return result; -} -#endif /* FORMAT_FLOAT */ - -#ifdef FORMAT_COMPLEX -PyObject * -FORMAT_COMPLEX(PyObject *obj, - STRINGLIB_CHAR *format_spec, - Py_ssize_t format_spec_len) -{ - PyObject *result = NULL; - InternalFormatSpec format; - - /* check for the special case of zero length format spec, make - it equivalent to str(obj) */ - if (format_spec_len == 0) { - result = STRINGLIB_TOSTR(obj); - goto done; - } - - /* parse the format_spec */ - if (!parse_internal_render_format_spec(format_spec, - format_spec_len, - &format, '\0', '>')) - goto done; - - /* type conversion? */ - switch (format.type) { - case '\0': /* No format code: like 'g', but with at least one decimal. */ - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - case 'n': - /* no conversion, already a complex. do the formatting */ - result = format_complex_internal(obj, &format); - break; - - default: - /* unknown */ - unknown_presentation_type(format.type, obj->ob_type->tp_name); - goto done; - } - -done: - return result; -} -#endif /* FORMAT_COMPLEX */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/partition.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/partition.h deleted file mode 100644 index fc07640..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/partition.h +++ /dev/null @@ -1,110 +0,0 @@ -/* stringlib: partition implementation */ - -#ifndef STRINGLIB_PARTITION_H -#define STRINGLIB_PARTITION_H - -#ifndef STRINGLIB_FASTSEARCH_H -#error must include "stringlib/fastsearch.h" before including this module -#endif - -Py_LOCAL_INLINE(PyObject*) -stringlib_partition(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - PyObject* sep_obj, - const STRINGLIB_CHAR* sep, Py_ssize_t sep_len) -{ - PyObject* out; - Py_ssize_t pos; - - if (sep_len == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - - out = PyTuple_New(3); - if (!out) - return NULL; - - pos = fastsearch(str, str_len, sep, sep_len, -1, FAST_SEARCH); - - if (pos < 0) { -#if STRINGLIB_MUTABLE - PyTuple_SET_ITEM(out, 0, STRINGLIB_NEW(str, str_len)); - PyTuple_SET_ITEM(out, 1, STRINGLIB_NEW(NULL, 0)); - PyTuple_SET_ITEM(out, 2, STRINGLIB_NEW(NULL, 0)); -#else - Py_INCREF(str_obj); - PyTuple_SET_ITEM(out, 0, (PyObject*) str_obj); - Py_INCREF(STRINGLIB_EMPTY); - PyTuple_SET_ITEM(out, 1, (PyObject*) STRINGLIB_EMPTY); - Py_INCREF(STRINGLIB_EMPTY); - PyTuple_SET_ITEM(out, 2, (PyObject*) STRINGLIB_EMPTY); -#endif - return out; - } - - PyTuple_SET_ITEM(out, 0, STRINGLIB_NEW(str, pos)); - Py_INCREF(sep_obj); - PyTuple_SET_ITEM(out, 1, sep_obj); - pos += sep_len; - PyTuple_SET_ITEM(out, 2, STRINGLIB_NEW(str + pos, str_len - pos)); - - if (PyErr_Occurred()) { - Py_DECREF(out); - return NULL; - } - - return out; -} - -Py_LOCAL_INLINE(PyObject*) -stringlib_rpartition(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - PyObject* sep_obj, - const STRINGLIB_CHAR* sep, Py_ssize_t sep_len) -{ - PyObject* out; - Py_ssize_t pos; - - if (sep_len == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - - out = PyTuple_New(3); - if (!out) - return NULL; - - pos = fastsearch(str, str_len, sep, sep_len, -1, FAST_RSEARCH); - - if (pos < 0) { -#if STRINGLIB_MUTABLE - PyTuple_SET_ITEM(out, 0, STRINGLIB_NEW(NULL, 0)); - PyTuple_SET_ITEM(out, 1, STRINGLIB_NEW(NULL, 0)); - PyTuple_SET_ITEM(out, 2, STRINGLIB_NEW(str, str_len)); -#else - Py_INCREF(STRINGLIB_EMPTY); - PyTuple_SET_ITEM(out, 0, (PyObject*) STRINGLIB_EMPTY); - Py_INCREF(STRINGLIB_EMPTY); - PyTuple_SET_ITEM(out, 1, (PyObject*) STRINGLIB_EMPTY); - Py_INCREF(str_obj); - PyTuple_SET_ITEM(out, 2, (PyObject*) str_obj); -#endif - return out; - } - - PyTuple_SET_ITEM(out, 0, STRINGLIB_NEW(str, pos)); - Py_INCREF(sep_obj); - PyTuple_SET_ITEM(out, 1, sep_obj); - pos += sep_len; - PyTuple_SET_ITEM(out, 2, STRINGLIB_NEW(str + pos, str_len - pos)); - - if (PyErr_Occurred()) { - Py_DECREF(out); - return NULL; - } - - return out; -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/split.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/split.h deleted file mode 100644 index 13eb93e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/split.h +++ /dev/null @@ -1,394 +0,0 @@ -/* stringlib: split implementation */ - -#ifndef STRINGLIB_SPLIT_H -#define STRINGLIB_SPLIT_H - -#ifndef STRINGLIB_FASTSEARCH_H -#error must include "stringlib/fastsearch.h" before including this module -#endif - -/* Overallocate the initial list to reduce the number of reallocs for small - split sizes. Eg, "A A A A A A A A A A".split() (10 elements) has three - resizes, to sizes 4, 8, then 16. Most observed string splits are for human - text (roughly 11 words per line) and field delimited data (usually 1-10 - fields). For large strings the split algorithms are bandwidth limited - so increasing the preallocation likely will not improve things.*/ - -#define MAX_PREALLOC 12 - -/* 5 splits gives 6 elements */ -#define PREALLOC_SIZE(maxsplit) \ - (maxsplit >= MAX_PREALLOC ? MAX_PREALLOC : maxsplit+1) - -#define SPLIT_APPEND(data, left, right) \ - sub = STRINGLIB_NEW((data) + (left), \ - (right) - (left)); \ - if (sub == NULL) \ - goto onError; \ - if (PyList_Append(list, sub)) { \ - Py_DECREF(sub); \ - goto onError; \ - } \ - else \ - Py_DECREF(sub); - -#define SPLIT_ADD(data, left, right) { \ - sub = STRINGLIB_NEW((data) + (left), \ - (right) - (left)); \ - if (sub == NULL) \ - goto onError; \ - if (count < MAX_PREALLOC) { \ - PyList_SET_ITEM(list, count, sub); \ - } else { \ - if (PyList_Append(list, sub)) { \ - Py_DECREF(sub); \ - goto onError; \ - } \ - else \ - Py_DECREF(sub); \ - } \ - count++; } - - -/* Always force the list to the expected size. */ -#define FIX_PREALLOC_SIZE(list) Py_SIZE(list) = count - -Py_LOCAL_INLINE(PyObject *) -stringlib_split_whitespace(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - Py_ssize_t maxcount) -{ - Py_ssize_t i, j, count=0; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - PyObject *sub; - - if (list == NULL) - return NULL; - - i = j = 0; - while (maxcount-- > 0) { - while (i < str_len && STRINGLIB_ISSPACE(str[i])) - i++; - if (i == str_len) break; - j = i; i++; - while (i < str_len && !STRINGLIB_ISSPACE(str[i])) - i++; -#ifndef STRINGLIB_MUTABLE - if (j == 0 && i == str_len && STRINGLIB_CHECK_EXACT(str_obj)) { - /* No whitespace in str_obj, so just use it as list[0] */ - Py_INCREF(str_obj); - PyList_SET_ITEM(list, 0, (PyObject *)str_obj); - count++; - break; - } -#endif - SPLIT_ADD(str, j, i); - } - - if (i < str_len) { - /* Only occurs when maxcount was reached */ - /* Skip any remaining whitespace and copy to end of string */ - while (i < str_len && STRINGLIB_ISSPACE(str[i])) - i++; - if (i != str_len) - SPLIT_ADD(str, i, str_len); - } - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -stringlib_split_char(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR ch, - Py_ssize_t maxcount) -{ - Py_ssize_t i, j, count=0; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - PyObject *sub; - - if (list == NULL) - return NULL; - - i = j = 0; - while ((j < str_len) && (maxcount-- > 0)) { - for(; j < str_len; j++) { - /* I found that using memchr makes no difference */ - if (str[j] == ch) { - SPLIT_ADD(str, i, j); - i = j = j + 1; - break; - } - } - } -#ifndef STRINGLIB_MUTABLE - if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) { - /* ch not in str_obj, so just use str_obj as list[0] */ - Py_INCREF(str_obj); - PyList_SET_ITEM(list, 0, (PyObject *)str_obj); - count++; - } else -#endif - if (i <= str_len) { - SPLIT_ADD(str, i, str_len); - } - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -stringlib_split(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sep, Py_ssize_t sep_len, - Py_ssize_t maxcount) -{ - Py_ssize_t i, j, pos, count=0; - PyObject *list, *sub; - - if (sep_len == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (sep_len == 1) - return stringlib_split_char(str_obj, str, str_len, sep[0], maxcount); - - list = PyList_New(PREALLOC_SIZE(maxcount)); - if (list == NULL) - return NULL; - - i = j = 0; - while (maxcount-- > 0) { - pos = fastsearch(str+i, str_len-i, sep, sep_len, -1, FAST_SEARCH); - if (pos < 0) - break; - j = i + pos; - SPLIT_ADD(str, i, j); - i = j + sep_len; - } -#ifndef STRINGLIB_MUTABLE - if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) { - /* No match in str_obj, so just use it as list[0] */ - Py_INCREF(str_obj); - PyList_SET_ITEM(list, 0, (PyObject *)str_obj); - count++; - } else -#endif - { - SPLIT_ADD(str, i, str_len); - } - FIX_PREALLOC_SIZE(list); - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -stringlib_rsplit_whitespace(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - Py_ssize_t maxcount) -{ - Py_ssize_t i, j, count=0; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - PyObject *sub; - - if (list == NULL) - return NULL; - - i = j = str_len - 1; - while (maxcount-- > 0) { - while (i >= 0 && STRINGLIB_ISSPACE(str[i])) - i--; - if (i < 0) break; - j = i; i--; - while (i >= 0 && !STRINGLIB_ISSPACE(str[i])) - i--; -#ifndef STRINGLIB_MUTABLE - if (j == str_len - 1 && i < 0 && STRINGLIB_CHECK_EXACT(str_obj)) { - /* No whitespace in str_obj, so just use it as list[0] */ - Py_INCREF(str_obj); - PyList_SET_ITEM(list, 0, (PyObject *)str_obj); - count++; - break; - } -#endif - SPLIT_ADD(str, i + 1, j + 1); - } - - if (i >= 0) { - /* Only occurs when maxcount was reached */ - /* Skip any remaining whitespace and copy to beginning of string */ - while (i >= 0 && STRINGLIB_ISSPACE(str[i])) - i--; - if (i >= 0) - SPLIT_ADD(str, 0, i + 1); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -stringlib_rsplit_char(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR ch, - Py_ssize_t maxcount) -{ - Py_ssize_t i, j, count=0; - PyObject *list = PyList_New(PREALLOC_SIZE(maxcount)); - PyObject *sub; - - if (list == NULL) - return NULL; - - i = j = str_len - 1; - while ((i >= 0) && (maxcount-- > 0)) { - for(; i >= 0; i--) { - if (str[i] == ch) { - SPLIT_ADD(str, i + 1, j + 1); - j = i = i - 1; - break; - } - } - } -#ifndef STRINGLIB_MUTABLE - if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) { - /* ch not in str_obj, so just use str_obj as list[0] */ - Py_INCREF(str_obj); - PyList_SET_ITEM(list, 0, (PyObject *)str_obj); - count++; - } else -#endif - if (j >= -1) { - SPLIT_ADD(str, 0, j + 1); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -stringlib_rsplit(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - const STRINGLIB_CHAR* sep, Py_ssize_t sep_len, - Py_ssize_t maxcount) -{ - Py_ssize_t j, pos, count=0; - PyObject *list, *sub; - - if (sep_len == 0) { - PyErr_SetString(PyExc_ValueError, "empty separator"); - return NULL; - } - else if (sep_len == 1) - return stringlib_rsplit_char(str_obj, str, str_len, sep[0], maxcount); - - list = PyList_New(PREALLOC_SIZE(maxcount)); - if (list == NULL) - return NULL; - - j = str_len; - while (maxcount-- > 0) { - pos = fastsearch(str, j, sep, sep_len, -1, FAST_RSEARCH); - if (pos < 0) - break; - SPLIT_ADD(str, pos + sep_len, j); - j = pos; - } -#ifndef STRINGLIB_MUTABLE - if (count == 0 && STRINGLIB_CHECK_EXACT(str_obj)) { - /* No match in str_obj, so just use it as list[0] */ - Py_INCREF(str_obj); - PyList_SET_ITEM(list, 0, (PyObject *)str_obj); - count++; - } else -#endif - { - SPLIT_ADD(str, 0, j); - } - FIX_PREALLOC_SIZE(list); - if (PyList_Reverse(list) < 0) - goto onError; - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -stringlib_splitlines(PyObject* str_obj, - const STRINGLIB_CHAR* str, Py_ssize_t str_len, - int keepends) -{ - /* This does not use the preallocated list because splitlines is - usually run with hundreds of newlines. The overhead of - switching between PyList_SET_ITEM and append causes about a - 2-3% slowdown for that common case. A smarter implementation - could move the if check out, so the SET_ITEMs are done first - and the appends only done when the prealloc buffer is full. - That's too much work for little gain.*/ - - register Py_ssize_t i; - register Py_ssize_t j; - PyObject *list = PyList_New(0); - PyObject *sub; - - if (list == NULL) - return NULL; - - for (i = j = 0; i < str_len; ) { - Py_ssize_t eol; - - /* Find a line and append it */ - while (i < str_len && !STRINGLIB_ISLINEBREAK(str[i])) - i++; - - /* Skip the line break reading CRLF as one line break */ - eol = i; - if (i < str_len) { - if (str[i] == '\r' && i + 1 < str_len && str[i+1] == '\n') - i += 2; - else - i++; - if (keepends) - eol = i; - } -#ifndef STRINGLIB_MUTABLE - if (j == 0 && eol == str_len && STRINGLIB_CHECK_EXACT(str_obj)) { - /* No linebreak in str_obj, so just use it as list[0] */ - if (PyList_Append(list, str_obj)) - goto onError; - break; - } -#endif - SPLIT_APPEND(str, j, eol); - j = i; - } - return list; - - onError: - Py_DECREF(list); - return NULL; -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/string_format.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/string_format.h deleted file mode 100644 index 77392a9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/string_format.h +++ /dev/null @@ -1,1361 +0,0 @@ -/* - string_format.h -- implementation of string.format(). - - It uses the Objects/stringlib conventions, so that it can be - compiled for both unicode and string objects. -*/ - - -/* Defines for Python 2.6 compatibility */ -#if PY_VERSION_HEX < 0x03000000 -#define PyLong_FromSsize_t _PyLong_FromSsize_t -#endif - -/* Defines for more efficiently reallocating the string buffer */ -#define INITIAL_SIZE_INCREMENT 100 -#define SIZE_MULTIPLIER 2 -#define MAX_SIZE_INCREMENT 3200 - - -/************************************************************************/ -/*********** Global data structures and forward declarations *********/ -/************************************************************************/ - -/* - A SubString consists of the characters between two string or - unicode pointers. -*/ -typedef struct { - STRINGLIB_CHAR *ptr; - STRINGLIB_CHAR *end; -} SubString; - - -typedef enum { - ANS_INIT, - ANS_AUTO, - ANS_MANUAL -} AutoNumberState; /* Keep track if we're auto-numbering fields */ - -/* Keeps track of our auto-numbering state, and which number field we're on */ -typedef struct { - AutoNumberState an_state; - int an_field_number; -} AutoNumber; - - -/* forward declaration for recursion */ -static PyObject * -build_string(SubString *input, PyObject *args, PyObject *kwargs, - int recursion_depth, AutoNumber *auto_number); - - - -/************************************************************************/ -/************************** Utility functions ************************/ -/************************************************************************/ - -static void -AutoNumber_Init(AutoNumber *auto_number) -{ - auto_number->an_state = ANS_INIT; - auto_number->an_field_number = 0; -} - -/* fill in a SubString from a pointer and length */ -Py_LOCAL_INLINE(void) -SubString_init(SubString *str, STRINGLIB_CHAR *p, Py_ssize_t len) -{ - str->ptr = p; - if (p == NULL) - str->end = NULL; - else - str->end = str->ptr + len; -} - -/* return a new string. if str->ptr is NULL, return None */ -Py_LOCAL_INLINE(PyObject *) -SubString_new_object(SubString *str) -{ - if (str->ptr == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return STRINGLIB_NEW(str->ptr, str->end - str->ptr); -} - -/* return a new string. if str->ptr is NULL, return None */ -Py_LOCAL_INLINE(PyObject *) -SubString_new_object_or_empty(SubString *str) -{ - if (str->ptr == NULL) { - return STRINGLIB_NEW(NULL, 0); - } - return STRINGLIB_NEW(str->ptr, str->end - str->ptr); -} - -/* Return 1 if an error has been detected switching between automatic - field numbering and manual field specification, else return 0. Set - ValueError on error. */ -static int -autonumber_state_error(AutoNumberState state, int field_name_is_empty) -{ - if (state == ANS_MANUAL) { - if (field_name_is_empty) { - PyErr_SetString(PyExc_ValueError, "cannot switch from " - "manual field specification to " - "automatic field numbering"); - return 1; - } - } - else { - if (!field_name_is_empty) { - PyErr_SetString(PyExc_ValueError, "cannot switch from " - "automatic field numbering to " - "manual field specification"); - return 1; - } - } - return 0; -} - - -/************************************************************************/ -/*********** Output string management functions ****************/ -/************************************************************************/ - -typedef struct { - STRINGLIB_CHAR *ptr; - STRINGLIB_CHAR *end; - PyObject *obj; - Py_ssize_t size_increment; -} OutputString; - -/* initialize an OutputString object, reserving size characters */ -static int -output_initialize(OutputString *output, Py_ssize_t size) -{ - output->obj = STRINGLIB_NEW(NULL, size); - if (output->obj == NULL) - return 0; - - output->ptr = STRINGLIB_STR(output->obj); - output->end = STRINGLIB_LEN(output->obj) + output->ptr; - output->size_increment = INITIAL_SIZE_INCREMENT; - - return 1; -} - -/* - output_extend reallocates the output string buffer. - It returns a status: 0 for a failed reallocation, - 1 for success. -*/ - -static int -output_extend(OutputString *output, Py_ssize_t count) -{ - STRINGLIB_CHAR *startptr = STRINGLIB_STR(output->obj); - Py_ssize_t curlen = output->ptr - startptr; - Py_ssize_t maxlen = curlen + count + output->size_increment; - - if (STRINGLIB_RESIZE(&output->obj, maxlen) < 0) - return 0; - startptr = STRINGLIB_STR(output->obj); - output->ptr = startptr + curlen; - output->end = startptr + maxlen; - if (output->size_increment < MAX_SIZE_INCREMENT) - output->size_increment *= SIZE_MULTIPLIER; - return 1; -} - -/* - output_data dumps characters into our output string - buffer. - - In some cases, it has to reallocate the string. - - It returns a status: 0 for a failed reallocation, - 1 for success. -*/ -static int -output_data(OutputString *output, const STRINGLIB_CHAR *s, Py_ssize_t count) -{ - if ((count > output->end - output->ptr) && !output_extend(output, count)) - return 0; - memcpy(output->ptr, s, count * sizeof(STRINGLIB_CHAR)); - output->ptr += count; - return 1; -} - -/************************************************************************/ -/*********** Format string parsing -- integers and identifiers *********/ -/************************************************************************/ - -static Py_ssize_t -get_integer(const SubString *str) -{ - Py_ssize_t accumulator = 0; - Py_ssize_t digitval; - STRINGLIB_CHAR *p; - - /* empty string is an error */ - if (str->ptr >= str->end) - return -1; - - for (p = str->ptr; p < str->end; p++) { - digitval = STRINGLIB_TODECIMAL(*p); - if (digitval < 0) - return -1; - /* - Detect possible overflow before it happens: - - accumulator * 10 + digitval > PY_SSIZE_T_MAX if and only if - accumulator > (PY_SSIZE_T_MAX - digitval) / 10. - */ - if (accumulator > (PY_SSIZE_T_MAX - digitval) / 10) { - PyErr_Format(PyExc_ValueError, - "Too many decimal digits in format string"); - return -1; - } - accumulator = accumulator * 10 + digitval; - } - return accumulator; -} - -/************************************************************************/ -/******** Functions to get field objects and specification strings ******/ -/************************************************************************/ - -/* do the equivalent of obj.name */ -static PyObject * -getattr(PyObject *obj, SubString *name) -{ - PyObject *newobj; - PyObject *str = SubString_new_object(name); - if (str == NULL) - return NULL; - newobj = PyObject_GetAttr(obj, str); - Py_DECREF(str); - return newobj; -} - -/* do the equivalent of obj[idx], where obj is a sequence */ -static PyObject * -getitem_sequence(PyObject *obj, Py_ssize_t idx) -{ - return PySequence_GetItem(obj, idx); -} - -/* do the equivalent of obj[idx], where obj is not a sequence */ -static PyObject * -getitem_idx(PyObject *obj, Py_ssize_t idx) -{ - PyObject *newobj; - PyObject *idx_obj = PyLong_FromSsize_t(idx); - if (idx_obj == NULL) - return NULL; - newobj = PyObject_GetItem(obj, idx_obj); - Py_DECREF(idx_obj); - return newobj; -} - -/* do the equivalent of obj[name] */ -static PyObject * -getitem_str(PyObject *obj, SubString *name) -{ - PyObject *newobj; - PyObject *str = SubString_new_object(name); - if (str == NULL) - return NULL; - newobj = PyObject_GetItem(obj, str); - Py_DECREF(str); - return newobj; -} - -typedef struct { - /* the entire string we're parsing. we assume that someone else - is managing its lifetime, and that it will exist for the - lifetime of the iterator. can be empty */ - SubString str; - - /* pointer to where we are inside field_name */ - STRINGLIB_CHAR *ptr; -} FieldNameIterator; - - -static int -FieldNameIterator_init(FieldNameIterator *self, STRINGLIB_CHAR *ptr, - Py_ssize_t len) -{ - SubString_init(&self->str, ptr, len); - self->ptr = self->str.ptr; - return 1; -} - -static int -_FieldNameIterator_attr(FieldNameIterator *self, SubString *name) -{ - STRINGLIB_CHAR c; - - name->ptr = self->ptr; - - /* return everything until '.' or '[' */ - while (self->ptr < self->str.end) { - switch (c = *self->ptr++) { - case '[': - case '.': - /* backup so that we this character will be seen next time */ - self->ptr--; - break; - default: - continue; - } - break; - } - /* end of string is okay */ - name->end = self->ptr; - return 1; -} - -static int -_FieldNameIterator_item(FieldNameIterator *self, SubString *name) -{ - int bracket_seen = 0; - STRINGLIB_CHAR c; - - name->ptr = self->ptr; - - /* return everything until ']' */ - while (self->ptr < self->str.end) { - switch (c = *self->ptr++) { - case ']': - bracket_seen = 1; - break; - default: - continue; - } - break; - } - /* make sure we ended with a ']' */ - if (!bracket_seen) { - PyErr_SetString(PyExc_ValueError, "Missing ']' in format string"); - return 0; - } - - /* end of string is okay */ - /* don't include the ']' */ - name->end = self->ptr-1; - return 1; -} - -/* returns 0 on error, 1 on non-error termination, and 2 if it returns a value */ -static int -FieldNameIterator_next(FieldNameIterator *self, int *is_attribute, - Py_ssize_t *name_idx, SubString *name) -{ - /* check at end of input */ - if (self->ptr >= self->str.end) - return 1; - - switch (*self->ptr++) { - case '.': - *is_attribute = 1; - if (_FieldNameIterator_attr(self, name) == 0) - return 0; - *name_idx = -1; - break; - case '[': - *is_attribute = 0; - if (_FieldNameIterator_item(self, name) == 0) - return 0; - *name_idx = get_integer(name); - if (*name_idx == -1 && PyErr_Occurred()) - return 0; - break; - default: - /* Invalid character follows ']' */ - PyErr_SetString(PyExc_ValueError, "Only '.' or '[' may " - "follow ']' in format field specifier"); - return 0; - } - - /* empty string is an error */ - if (name->ptr == name->end) { - PyErr_SetString(PyExc_ValueError, "Empty attribute in format string"); - return 0; - } - - return 2; -} - - -/* input: field_name - output: 'first' points to the part before the first '[' or '.' - 'first_idx' is -1 if 'first' is not an integer, otherwise - it's the value of first converted to an integer - 'rest' is an iterator to return the rest -*/ -static int -field_name_split(STRINGLIB_CHAR *ptr, Py_ssize_t len, SubString *first, - Py_ssize_t *first_idx, FieldNameIterator *rest, - AutoNumber *auto_number) -{ - STRINGLIB_CHAR c; - STRINGLIB_CHAR *p = ptr; - STRINGLIB_CHAR *end = ptr + len; - int field_name_is_empty; - int using_numeric_index; - - /* find the part up until the first '.' or '[' */ - while (p < end) { - switch (c = *p++) { - case '[': - case '.': - /* backup so that we this character is available to the - "rest" iterator */ - p--; - break; - default: - continue; - } - break; - } - - /* set up the return values */ - SubString_init(first, ptr, p - ptr); - FieldNameIterator_init(rest, p, end - p); - - /* see if "first" is an integer, in which case it's used as an index */ - *first_idx = get_integer(first); - if (*first_idx == -1 && PyErr_Occurred()) - return 0; - - field_name_is_empty = first->ptr >= first->end; - - /* If the field name is omitted or if we have a numeric index - specified, then we're doing numeric indexing into args. */ - using_numeric_index = field_name_is_empty || *first_idx != -1; - - /* We always get here exactly one time for each field we're - processing. And we get here in field order (counting by left - braces). So this is the perfect place to handle automatic field - numbering if the field name is omitted. */ - - /* Check if we need to do the auto-numbering. It's not needed if - we're called from string.Format routines, because it's handled - in that class by itself. */ - if (auto_number) { - /* Initialize our auto numbering state if this is the first - time we're either auto-numbering or manually numbering. */ - if (auto_number->an_state == ANS_INIT && using_numeric_index) - auto_number->an_state = field_name_is_empty ? - ANS_AUTO : ANS_MANUAL; - - /* Make sure our state is consistent with what we're doing - this time through. Only check if we're using a numeric - index. */ - if (using_numeric_index) - if (autonumber_state_error(auto_number->an_state, - field_name_is_empty)) - return 0; - /* Zero length field means we want to do auto-numbering of the - fields. */ - if (field_name_is_empty) - *first_idx = (auto_number->an_field_number)++; - } - - return 1; -} - - -/* - get_field_object returns the object inside {}, before the - format_spec. It handles getindex and getattr lookups and consumes - the entire input string. -*/ -static PyObject * -get_field_object(SubString *input, PyObject *args, PyObject *kwargs, - AutoNumber *auto_number) -{ - PyObject *obj = NULL; - int ok; - int is_attribute; - SubString name; - SubString first; - Py_ssize_t index; - FieldNameIterator rest; - - if (!field_name_split(input->ptr, input->end - input->ptr, &first, - &index, &rest, auto_number)) { - goto error; - } - - if (index == -1) { - /* look up in kwargs */ - PyObject *key = SubString_new_object(&first); - if (key == NULL) - goto error; - if ((kwargs == NULL) || (obj = PyDict_GetItem(kwargs, key)) == NULL) { - PyErr_SetObject(PyExc_KeyError, key); - Py_DECREF(key); - goto error; - } - Py_DECREF(key); - Py_INCREF(obj); - } - else { - /* look up in args */ - obj = PySequence_GetItem(args, index); - if (obj == NULL) - goto error; - } - - /* iterate over the rest of the field_name */ - while ((ok = FieldNameIterator_next(&rest, &is_attribute, &index, - &name)) == 2) { - PyObject *tmp; - - if (is_attribute) - /* getattr lookup "." */ - tmp = getattr(obj, &name); - else - /* getitem lookup "[]" */ - if (index == -1) - tmp = getitem_str(obj, &name); - else - if (PySequence_Check(obj)) - tmp = getitem_sequence(obj, index); - else - /* not a sequence */ - tmp = getitem_idx(obj, index); - if (tmp == NULL) - goto error; - - /* assign to obj */ - Py_DECREF(obj); - obj = tmp; - } - /* end of iterator, this is the non-error case */ - if (ok == 1) - return obj; -error: - Py_XDECREF(obj); - return NULL; -} - -/************************************************************************/ -/***************** Field rendering functions **************************/ -/************************************************************************/ - -/* - render_field() is the main function in this section. It takes the - field object and field specification string generated by - get_field_and_spec, and renders the field into the output string. - - render_field calls fieldobj.__format__(format_spec) method, and - appends to the output. -*/ -static int -render_field(PyObject *fieldobj, SubString *format_spec, OutputString *output) -{ - int ok = 0; - PyObject *result = NULL; - PyObject *format_spec_object = NULL; - PyObject *(*formatter)(PyObject *, STRINGLIB_CHAR *, Py_ssize_t) = NULL; - STRINGLIB_CHAR* format_spec_start = format_spec->ptr ? - format_spec->ptr : NULL; - Py_ssize_t format_spec_len = format_spec->ptr ? - format_spec->end - format_spec->ptr : 0; - - /* If we know the type exactly, skip the lookup of __format__ and just - call the formatter directly. */ -#if STRINGLIB_IS_UNICODE - if (PyUnicode_CheckExact(fieldobj)) - formatter = _PyUnicode_FormatAdvanced; - /* Unfortunately, there's a problem with checking for int, long, - and float here. If we're being included as unicode, their - formatters expect string format_spec args. For now, just skip - this optimization for unicode. This could be fixed, but it's a - hassle. */ -#else - if (PyString_CheckExact(fieldobj)) - formatter = _PyBytes_FormatAdvanced; - else if (PyInt_CheckExact(fieldobj)) - formatter =_PyInt_FormatAdvanced; - else if (PyLong_CheckExact(fieldobj)) - formatter =_PyLong_FormatAdvanced; - else if (PyFloat_CheckExact(fieldobj)) - formatter = _PyFloat_FormatAdvanced; -#endif - - if (formatter) { - /* we know exactly which formatter will be called when __format__ is - looked up, so call it directly, instead. */ - result = formatter(fieldobj, format_spec_start, format_spec_len); - } - else { - /* We need to create an object out of the pointers we have, because - __format__ takes a string/unicode object for format_spec. */ - format_spec_object = STRINGLIB_NEW(format_spec_start, - format_spec_len); - if (format_spec_object == NULL) - goto done; - - result = PyObject_Format(fieldobj, format_spec_object); - } - if (result == NULL) - goto done; - -#if PY_VERSION_HEX >= 0x03000000 - assert(PyUnicode_Check(result)); -#else - assert(PyString_Check(result) || PyUnicode_Check(result)); - - /* Convert result to our type. We could be str, and result could - be unicode */ - { - PyObject *tmp = STRINGLIB_TOSTR(result); - if (tmp == NULL) - goto done; - Py_DECREF(result); - result = tmp; - } -#endif - - ok = output_data(output, - STRINGLIB_STR(result), STRINGLIB_LEN(result)); -done: - Py_XDECREF(format_spec_object); - Py_XDECREF(result); - return ok; -} - -static int -parse_field(SubString *str, SubString *field_name, SubString *format_spec, - STRINGLIB_CHAR *conversion) -{ - /* Note this function works if the field name is zero length, - which is good. Zero length field names are handled later, in - field_name_split. */ - - STRINGLIB_CHAR c = 0; - - /* initialize these, as they may be empty */ - *conversion = '\0'; - SubString_init(format_spec, NULL, 0); - - /* Search for the field name. it's terminated by the end of - the string, or a ':' or '!' */ - field_name->ptr = str->ptr; - while (str->ptr < str->end) { - switch (c = *(str->ptr++)) { - case ':': - case '!': - break; - default: - continue; - } - break; - } - - if (c == '!' || c == ':') { - /* we have a format specifier and/or a conversion */ - /* don't include the last character */ - field_name->end = str->ptr-1; - - /* the format specifier is the rest of the string */ - format_spec->ptr = str->ptr; - format_spec->end = str->end; - - /* see if there's a conversion specifier */ - if (c == '!') { - /* there must be another character present */ - if (format_spec->ptr >= format_spec->end) { - PyErr_SetString(PyExc_ValueError, - "end of format while looking for conversion " - "specifier"); - return 0; - } - *conversion = *(format_spec->ptr++); - - /* if there is another character, it must be a colon */ - if (format_spec->ptr < format_spec->end) { - c = *(format_spec->ptr++); - if (c != ':') { - PyErr_SetString(PyExc_ValueError, - "expected ':' after format specifier"); - return 0; - } - } - } - } - else - /* end of string, there's no format_spec or conversion */ - field_name->end = str->ptr; - - return 1; -} - -/************************************************************************/ -/******* Output string allocation and escape-to-markup processing ******/ -/************************************************************************/ - -/* MarkupIterator breaks the string into pieces of either literal - text, or things inside {} that need to be marked up. it is - designed to make it easy to wrap a Python iterator around it, for - use with the Formatter class */ - -typedef struct { - SubString str; -} MarkupIterator; - -static int -MarkupIterator_init(MarkupIterator *self, STRINGLIB_CHAR *ptr, Py_ssize_t len) -{ - SubString_init(&self->str, ptr, len); - return 1; -} - -/* returns 0 on error, 1 on non-error termination, and 2 if it got a - string (or something to be expanded) */ -static int -MarkupIterator_next(MarkupIterator *self, SubString *literal, - int *field_present, SubString *field_name, - SubString *format_spec, STRINGLIB_CHAR *conversion, - int *format_spec_needs_expanding) -{ - int at_end; - STRINGLIB_CHAR c = 0; - STRINGLIB_CHAR *start; - int count; - Py_ssize_t len; - int markup_follows = 0; - - /* initialize all of the output variables */ - SubString_init(literal, NULL, 0); - SubString_init(field_name, NULL, 0); - SubString_init(format_spec, NULL, 0); - *conversion = '\0'; - *format_spec_needs_expanding = 0; - *field_present = 0; - - /* No more input, end of iterator. This is the normal exit - path. */ - if (self->str.ptr >= self->str.end) - return 1; - - start = self->str.ptr; - - /* First read any literal text. Read until the end of string, an - escaped '{' or '}', or an unescaped '{'. In order to never - allocate memory and so I can just pass pointers around, if - there's an escaped '{' or '}' then we'll return the literal - including the brace, but no format object. The next time - through, we'll return the rest of the literal, skipping past - the second consecutive brace. */ - while (self->str.ptr < self->str.end) { - switch (c = *(self->str.ptr++)) { - case '{': - case '}': - markup_follows = 1; - break; - default: - continue; - } - break; - } - - at_end = self->str.ptr >= self->str.end; - len = self->str.ptr - start; - - if ((c == '}') && (at_end || (c != *self->str.ptr))) { - PyErr_SetString(PyExc_ValueError, "Single '}' encountered " - "in format string"); - return 0; - } - if (at_end && c == '{') { - PyErr_SetString(PyExc_ValueError, "Single '{' encountered " - "in format string"); - return 0; - } - if (!at_end) { - if (c == *self->str.ptr) { - /* escaped } or {, skip it in the input. there is no - markup object following us, just this literal text */ - self->str.ptr++; - markup_follows = 0; - } - else - len--; - } - - /* record the literal text */ - literal->ptr = start; - literal->end = start + len; - - if (!markup_follows) - return 2; - - /* this is markup, find the end of the string by counting nested - braces. note that this prohibits escaped braces, so that - format_specs cannot have braces in them. */ - *field_present = 1; - count = 1; - - start = self->str.ptr; - - /* we know we can't have a zero length string, so don't worry - about that case */ - while (self->str.ptr < self->str.end) { - switch (c = *(self->str.ptr++)) { - case '{': - /* the format spec needs to be recursively expanded. - this is an optimization, and not strictly needed */ - *format_spec_needs_expanding = 1; - count++; - break; - case '}': - count--; - if (count <= 0) { - /* we're done. parse and get out */ - SubString s; - - SubString_init(&s, start, self->str.ptr - 1 - start); - if (parse_field(&s, field_name, format_spec, conversion) == 0) - return 0; - - /* success */ - return 2; - } - break; - } - } - - /* end of string while searching for matching '}' */ - PyErr_SetString(PyExc_ValueError, "unmatched '{' in format"); - return 0; -} - - -/* do the !r or !s conversion on obj */ -static PyObject * -do_conversion(PyObject *obj, STRINGLIB_CHAR conversion) -{ - /* XXX in pre-3.0, do we need to convert this to unicode, since it - might have returned a string? */ - switch (conversion) { - case 'r': - return PyObject_Repr(obj); - case 's': - return STRINGLIB_TOSTR(obj); - default: - if (conversion > 32 && conversion < 127) { - /* It's the ASCII subrange; casting to char is safe - (assuming the execution character set is an ASCII - superset). */ - PyErr_Format(PyExc_ValueError, - "Unknown conversion specifier %c", - (char)conversion); - } else - PyErr_Format(PyExc_ValueError, - "Unknown conversion specifier \\x%x", - (unsigned int)conversion); - return NULL; - } -} - -/* given: - - {field_name!conversion:format_spec} - - compute the result and write it to output. - format_spec_needs_expanding is an optimization. if it's false, - just output the string directly, otherwise recursively expand the - format_spec string. - - field_name is allowed to be zero length, in which case we - are doing auto field numbering. -*/ - -static int -output_markup(SubString *field_name, SubString *format_spec, - int format_spec_needs_expanding, STRINGLIB_CHAR conversion, - OutputString *output, PyObject *args, PyObject *kwargs, - int recursion_depth, AutoNumber *auto_number) -{ - PyObject *tmp = NULL; - PyObject *fieldobj = NULL; - SubString expanded_format_spec; - SubString *actual_format_spec; - int result = 0; - - /* convert field_name to an object */ - fieldobj = get_field_object(field_name, args, kwargs, auto_number); - if (fieldobj == NULL) - goto done; - - if (conversion != '\0') { - tmp = do_conversion(fieldobj, conversion); - if (tmp == NULL) - goto done; - - /* do the assignment, transferring ownership: fieldobj = tmp */ - Py_DECREF(fieldobj); - fieldobj = tmp; - tmp = NULL; - } - - /* if needed, recurively compute the format_spec */ - if (format_spec_needs_expanding) { - tmp = build_string(format_spec, args, kwargs, recursion_depth-1, - auto_number); - if (tmp == NULL) - goto done; - - /* note that in the case we're expanding the format string, - tmp must be kept around until after the call to - render_field. */ - SubString_init(&expanded_format_spec, - STRINGLIB_STR(tmp), STRINGLIB_LEN(tmp)); - actual_format_spec = &expanded_format_spec; - } - else - actual_format_spec = format_spec; - - if (render_field(fieldobj, actual_format_spec, output) == 0) - goto done; - - result = 1; - -done: - Py_XDECREF(fieldobj); - Py_XDECREF(tmp); - - return result; -} - -/* - do_markup is the top-level loop for the format() method. It - searches through the format string for escapes to markup codes, and - calls other functions to move non-markup text to the output, - and to perform the markup to the output. -*/ -static int -do_markup(SubString *input, PyObject *args, PyObject *kwargs, - OutputString *output, int recursion_depth, AutoNumber *auto_number) -{ - MarkupIterator iter; - int format_spec_needs_expanding; - int result; - int field_present; - SubString literal; - SubString field_name; - SubString format_spec; - STRINGLIB_CHAR conversion; - - MarkupIterator_init(&iter, input->ptr, input->end - input->ptr); - while ((result = MarkupIterator_next(&iter, &literal, &field_present, - &field_name, &format_spec, - &conversion, - &format_spec_needs_expanding)) == 2) { - if (!output_data(output, literal.ptr, literal.end - literal.ptr)) - return 0; - if (field_present) - if (!output_markup(&field_name, &format_spec, - format_spec_needs_expanding, conversion, output, - args, kwargs, recursion_depth, auto_number)) - return 0; - } - return result; -} - - -/* - build_string allocates the output string and then - calls do_markup to do the heavy lifting. -*/ -static PyObject * -build_string(SubString *input, PyObject *args, PyObject *kwargs, - int recursion_depth, AutoNumber *auto_number) -{ - OutputString output; - PyObject *result = NULL; - Py_ssize_t count; - - output.obj = NULL; /* needed so cleanup code always works */ - - /* check the recursion level */ - if (recursion_depth <= 0) { - PyErr_SetString(PyExc_ValueError, - "Max string recursion exceeded"); - goto done; - } - - /* initial size is the length of the format string, plus the size - increment. seems like a reasonable default */ - if (!output_initialize(&output, - input->end - input->ptr + - INITIAL_SIZE_INCREMENT)) - goto done; - - if (!do_markup(input, args, kwargs, &output, recursion_depth, - auto_number)) { - goto done; - } - - count = output.ptr - STRINGLIB_STR(output.obj); - if (STRINGLIB_RESIZE(&output.obj, count) < 0) { - goto done; - } - - /* transfer ownership to result */ - result = output.obj; - output.obj = NULL; - -done: - Py_XDECREF(output.obj); - return result; -} - -/************************************************************************/ -/*********** main routine ***********************************************/ -/************************************************************************/ - -/* this is the main entry point */ -static PyObject * -do_string_format(PyObject *self, PyObject *args, PyObject *kwargs) -{ - SubString input; - - /* PEP 3101 says only 2 levels, so that - "{0:{1}}".format('abc', 's') # works - "{0:{1:{2}}}".format('abc', 's', '') # fails - */ - int recursion_depth = 2; - - AutoNumber auto_number; - - AutoNumber_Init(&auto_number); - SubString_init(&input, STRINGLIB_STR(self), STRINGLIB_LEN(self)); - return build_string(&input, args, kwargs, recursion_depth, &auto_number); -} - - - -/************************************************************************/ -/*********** formatteriterator ******************************************/ -/************************************************************************/ - -/* This is used to implement string.Formatter.vparse(). It exists so - Formatter can share code with the built in unicode.format() method. - It's really just a wrapper around MarkupIterator that is callable - from Python. */ - -typedef struct { - PyObject_HEAD - - STRINGLIB_OBJECT *str; - - MarkupIterator it_markup; -} formatteriterobject; - -static void -formatteriter_dealloc(formatteriterobject *it) -{ - Py_XDECREF(it->str); - PyObject_FREE(it); -} - -/* returns a tuple: - (literal, field_name, format_spec, conversion) - - literal is any literal text to output. might be zero length - field_name is the string before the ':'. might be None - format_spec is the string after the ':'. mibht be None - conversion is either None, or the string after the '!' -*/ -static PyObject * -formatteriter_next(formatteriterobject *it) -{ - SubString literal; - SubString field_name; - SubString format_spec; - STRINGLIB_CHAR conversion; - int format_spec_needs_expanding; - int field_present; - int result = MarkupIterator_next(&it->it_markup, &literal, &field_present, - &field_name, &format_spec, &conversion, - &format_spec_needs_expanding); - - /* all of the SubString objects point into it->str, so no - memory management needs to be done on them */ - assert(0 <= result && result <= 2); - if (result == 0 || result == 1) - /* if 0, error has already been set, if 1, iterator is empty */ - return NULL; - else { - PyObject *literal_str = NULL; - PyObject *field_name_str = NULL; - PyObject *format_spec_str = NULL; - PyObject *conversion_str = NULL; - PyObject *tuple = NULL; - - literal_str = SubString_new_object(&literal); - if (literal_str == NULL) - goto done; - - field_name_str = SubString_new_object(&field_name); - if (field_name_str == NULL) - goto done; - - /* if field_name is non-zero length, return a string for - format_spec (even if zero length), else return None */ - format_spec_str = (field_present ? - SubString_new_object_or_empty : - SubString_new_object)(&format_spec); - if (format_spec_str == NULL) - goto done; - - /* if the conversion is not specified, return a None, - otherwise create a one length string with the conversion - character */ - if (conversion == '\0') { - conversion_str = Py_None; - Py_INCREF(conversion_str); - } - else - conversion_str = STRINGLIB_NEW(&conversion, 1); - if (conversion_str == NULL) - goto done; - - tuple = PyTuple_Pack(4, literal_str, field_name_str, format_spec_str, - conversion_str); - done: - Py_XDECREF(literal_str); - Py_XDECREF(field_name_str); - Py_XDECREF(format_spec_str); - Py_XDECREF(conversion_str); - return tuple; - } -} - -static PyMethodDef formatteriter_methods[] = { - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject PyFormatterIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "formatteriterator", /* tp_name */ - sizeof(formatteriterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)formatteriter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)formatteriter_next, /* tp_iternext */ - formatteriter_methods, /* tp_methods */ - 0, -}; - -/* unicode_formatter_parser is used to implement - string.Formatter.vformat. it parses a string and returns tuples - describing the parsed elements. It's a wrapper around - stringlib/string_format.h's MarkupIterator */ -static PyObject * -formatter_parser(STRINGLIB_OBJECT *self) -{ - formatteriterobject *it; - - it = PyObject_New(formatteriterobject, &PyFormatterIter_Type); - if (it == NULL) - return NULL; - - /* take ownership, give the object to the iterator */ - Py_INCREF(self); - it->str = self; - - /* initialize the contained MarkupIterator */ - MarkupIterator_init(&it->it_markup, - STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - - return (PyObject *)it; -} - - -/************************************************************************/ -/*********** fieldnameiterator ******************************************/ -/************************************************************************/ - - -/* This is used to implement string.Formatter.vparse(). It parses the - field name into attribute and item values. It's a Python-callable - wrapper around FieldNameIterator */ - -typedef struct { - PyObject_HEAD - - STRINGLIB_OBJECT *str; - - FieldNameIterator it_field; -} fieldnameiterobject; - -static void -fieldnameiter_dealloc(fieldnameiterobject *it) -{ - Py_XDECREF(it->str); - PyObject_FREE(it); -} - -/* returns a tuple: - (is_attr, value) - is_attr is true if we used attribute syntax (e.g., '.foo') - false if we used index syntax (e.g., '[foo]') - value is an integer or string -*/ -static PyObject * -fieldnameiter_next(fieldnameiterobject *it) -{ - int result; - int is_attr; - Py_ssize_t idx; - SubString name; - - result = FieldNameIterator_next(&it->it_field, &is_attr, - &idx, &name); - if (result == 0 || result == 1) - /* if 0, error has already been set, if 1, iterator is empty */ - return NULL; - else { - PyObject* result = NULL; - PyObject* is_attr_obj = NULL; - PyObject* obj = NULL; - - is_attr_obj = PyBool_FromLong(is_attr); - if (is_attr_obj == NULL) - goto done; - - /* either an integer or a string */ - if (idx != -1) - obj = PyLong_FromSsize_t(idx); - else - obj = SubString_new_object(&name); - if (obj == NULL) - goto done; - - /* return a tuple of values */ - result = PyTuple_Pack(2, is_attr_obj, obj); - - done: - Py_XDECREF(is_attr_obj); - Py_XDECREF(obj); - return result; - } -} - -static PyMethodDef fieldnameiter_methods[] = { - {NULL, NULL} /* sentinel */ -}; - -static PyTypeObject PyFieldNameIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "fieldnameiterator", /* tp_name */ - sizeof(fieldnameiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)fieldnameiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)fieldnameiter_next, /* tp_iternext */ - fieldnameiter_methods, /* tp_methods */ - 0}; - -/* unicode_formatter_field_name_split is used to implement - string.Formatter.vformat. it takes an PEP 3101 "field name", and - returns a tuple of (first, rest): "first", the part before the - first '.' or '['; and "rest", an iterator for the rest of the field - name. it's a wrapper around stringlib/string_format.h's - field_name_split. The iterator it returns is a - FieldNameIterator */ -static PyObject * -formatter_field_name_split(STRINGLIB_OBJECT *self) -{ - SubString first; - Py_ssize_t first_idx; - fieldnameiterobject *it; - - PyObject *first_obj = NULL; - PyObject *result = NULL; - - it = PyObject_New(fieldnameiterobject, &PyFieldNameIter_Type); - if (it == NULL) - return NULL; - - /* take ownership, give the object to the iterator. this is - just to keep the field_name alive */ - Py_INCREF(self); - it->str = self; - - /* Pass in auto_number = NULL. We'll return an empty string for - first_obj in that case. */ - if (!field_name_split(STRINGLIB_STR(self), - STRINGLIB_LEN(self), - &first, &first_idx, &it->it_field, NULL)) - goto done; - - /* first becomes an integer, if possible; else a string */ - if (first_idx != -1) - first_obj = PyLong_FromSsize_t(first_idx); - else - /* convert "first" into a string object */ - first_obj = SubString_new_object(&first); - if (first_obj == NULL) - goto done; - - /* return a tuple of values */ - result = PyTuple_Pack(2, first_obj, it); - -done: - Py_XDECREF(it); - Py_XDECREF(first_obj); - return result; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/stringdefs.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/stringdefs.h deleted file mode 100644 index a301d4e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/stringdefs.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef STRINGLIB_STRINGDEFS_H -#define STRINGLIB_STRINGDEFS_H - -/* this is sort of a hack. there's at least one place (formatting - floats) where some stringlib code takes a different path if it's - compiled as unicode. */ -#define STRINGLIB_IS_UNICODE 0 - -#define STRINGLIB_OBJECT PyStringObject -#define STRINGLIB_CHAR char -#define STRINGLIB_TYPE_NAME "string" -#define STRINGLIB_PARSE_CODE "S" -#define STRINGLIB_EMPTY nullstring -#define STRINGLIB_ISSPACE Py_ISSPACE -#define STRINGLIB_ISLINEBREAK(x) ((x == '\n') || (x == '\r')) -#define STRINGLIB_ISDECIMAL(x) ((x >= '0') && (x <= '9')) -#define STRINGLIB_TODECIMAL(x) (STRINGLIB_ISDECIMAL(x) ? (x - '0') : -1) -#define STRINGLIB_TOUPPER Py_TOUPPER -#define STRINGLIB_TOLOWER Py_TOLOWER -#define STRINGLIB_FILL memset -#define STRINGLIB_STR PyString_AS_STRING -#define STRINGLIB_LEN PyString_GET_SIZE -#define STRINGLIB_NEW PyString_FromStringAndSize -#define STRINGLIB_RESIZE _PyString_Resize -#define STRINGLIB_CHECK PyString_Check -#define STRINGLIB_CHECK_EXACT PyString_CheckExact -#define STRINGLIB_TOSTR PyObject_Str -#define STRINGLIB_GROUPING _PyString_InsertThousandsGrouping -#define STRINGLIB_GROUPING_LOCALE _PyString_InsertThousandsGroupingLocale - -#define STRINGLIB_WANT_CONTAINS_OBJ 1 - -#endif /* !STRINGLIB_STRINGDEFS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/transmogrify.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/transmogrify.h deleted file mode 100644 index 9f61025..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/transmogrify.h +++ /dev/null @@ -1,264 +0,0 @@ -/* NOTE: this API is -ONLY- for use with single byte character strings. */ -/* Do not use it with Unicode. */ - -/* the more complicated methods. parts of these should be pulled out into the - shared code in bytes_methods.c to cut down on duplicate code bloat. */ - -PyDoc_STRVAR(expandtabs__doc__, -"B.expandtabs([tabsize]) -> copy of B\n\ -\n\ -Return a copy of B where all tab characters are expanded using spaces.\n\ -If tabsize is not given, a tab size of 8 characters is assumed."); - -static PyObject* -stringlib_expandtabs(PyObject *self, PyObject *args) -{ - const char *e, *p; - char *q; - Py_ssize_t i, j; - PyObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = j = 0; - e = STRINGLIB_STR(self) + STRINGLIB_LEN(self); - for (p = STRINGLIB_STR(self); p < e; p++) { - if (*p == '\t') { - if (tabsize > 0) { - Py_ssize_t incr = tabsize - (j % tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow; - i += j; - j = 0; - } - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow; - - /* Second pass: create output string and fill it */ - u = STRINGLIB_NEW(NULL, i + j); - if (!u) - return NULL; - - j = 0; - q = STRINGLIB_STR(u); - - for (p = STRINGLIB_STR(self); p < e; p++) { - if (*p == '\t') { - if (tabsize > 0) { - i = tabsize - (j % tabsize); - j += i; - while (i--) - *q++ = ' '; - } - } - else { - j++; - *q++ = *p; - if (*p == '\n' || *p == '\r') - j = 0; - } - } - - return u; - overflow: - PyErr_SetString(PyExc_OverflowError, "result too long"); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -pad(PyObject *self, Py_ssize_t left, Py_ssize_t right, char fill) -{ - PyObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && STRINGLIB_CHECK_EXACT(self)) { -#if STRINGLIB_MUTABLE - /* We're defined as returning a copy; If the object is mutable - * that means we must make an identical copy. */ - return STRINGLIB_NEW(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -#else - Py_INCREF(self); - return (PyObject *)self; -#endif /* STRINGLIB_MUTABLE */ - } - - u = STRINGLIB_NEW(NULL, - left + STRINGLIB_LEN(self) + right); - if (u) { - if (left) - memset(STRINGLIB_STR(u), fill, left); - Py_MEMCPY(STRINGLIB_STR(u) + left, - STRINGLIB_STR(self), - STRINGLIB_LEN(self)); - if (right) - memset(STRINGLIB_STR(u) + left + STRINGLIB_LEN(self), - fill, right); - } - - return u; -} - -PyDoc_STRVAR(ljust__doc__, -"B.ljust(width[, fillchar]) -> copy of B\n" -"\n" -"Return B left justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -stringlib_ljust(PyObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) - return NULL; - - if (STRINGLIB_LEN(self) >= width && STRINGLIB_CHECK_EXACT(self)) { -#if STRINGLIB_MUTABLE - /* We're defined as returning a copy; If the object is mutable - * that means we must make an identical copy. */ - return STRINGLIB_NEW(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -#else - Py_INCREF(self); - return (PyObject*) self; -#endif - } - - return pad(self, 0, width - STRINGLIB_LEN(self), fillchar); -} - - -PyDoc_STRVAR(rjust__doc__, -"B.rjust(width[, fillchar]) -> copy of B\n" -"\n" -"Return B right justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -stringlib_rjust(PyObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) - return NULL; - - if (STRINGLIB_LEN(self) >= width && STRINGLIB_CHECK_EXACT(self)) { -#if STRINGLIB_MUTABLE - /* We're defined as returning a copy; If the object is mutable - * that means we must make an identical copy. */ - return STRINGLIB_NEW(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -#else - Py_INCREF(self); - return (PyObject*) self; -#endif - } - - return pad(self, width - STRINGLIB_LEN(self), 0, fillchar); -} - - -PyDoc_STRVAR(center__doc__, -"B.center(width[, fillchar]) -> copy of B\n" -"\n" -"Return B centered in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -stringlib_center(PyObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) - return NULL; - - if (STRINGLIB_LEN(self) >= width && STRINGLIB_CHECK_EXACT(self)) { -#if STRINGLIB_MUTABLE - /* We're defined as returning a copy; If the object is mutable - * that means we must make an identical copy. */ - return STRINGLIB_NEW(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -#else - Py_INCREF(self); - return (PyObject*) self; -#endif - } - - marg = width - STRINGLIB_LEN(self); - left = marg / 2 + (marg & width & 1); - - return pad(self, left, marg - left, fillchar); -} - -PyDoc_STRVAR(zfill__doc__, -"B.zfill(width) -> copy of B\n" -"\n" -"Pad a numeric string B with zeros on the left, to fill a field\n" -"of the specified width. B is never truncated."); - -static PyObject * -stringlib_zfill(PyObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyObject *s; - char *p; - Py_ssize_t width; - - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (STRINGLIB_LEN(self) >= width) { - if (STRINGLIB_CHECK_EXACT(self)) { -#if STRINGLIB_MUTABLE - /* We're defined as returning a copy; If the object is mutable - * that means we must make an identical copy. */ - return STRINGLIB_NEW(STRINGLIB_STR(self), STRINGLIB_LEN(self)); -#else - Py_INCREF(self); - return (PyObject*) self; -#endif - } - else - return STRINGLIB_NEW( - STRINGLIB_STR(self), - STRINGLIB_LEN(self) - ); - } - - fill = width - STRINGLIB_LEN(self); - - s = pad(self, fill, 0, '0'); - - if (s == NULL) - return NULL; - - p = STRINGLIB_STR(s); - if (p[fill] == '+' || p[fill] == '-') { - /* move sign to beginning of string */ - p[0] = p[fill]; - p[fill] = '0'; - } - - return (PyObject*) s; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/unicodedefs.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/unicodedefs.h deleted file mode 100644 index ecb4425..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringlib/unicodedefs.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef STRINGLIB_UNICODEDEFS_H -#define STRINGLIB_UNICODEDEFS_H - -/* this is sort of a hack. there's at least one place (formatting - floats) where some stringlib code takes a different path if it's - compiled as unicode. */ -#define STRINGLIB_IS_UNICODE 1 - -#define STRINGLIB_OBJECT PyUnicodeObject -#define STRINGLIB_CHAR Py_UNICODE -#define STRINGLIB_TYPE_NAME "unicode" -#define STRINGLIB_PARSE_CODE "U" -#define STRINGLIB_EMPTY unicode_empty -#define STRINGLIB_ISSPACE Py_UNICODE_ISSPACE -#define STRINGLIB_ISLINEBREAK BLOOM_LINEBREAK -#define STRINGLIB_ISDECIMAL Py_UNICODE_ISDECIMAL -#define STRINGLIB_TODECIMAL Py_UNICODE_TODECIMAL -#define STRINGLIB_TOUPPER Py_UNICODE_TOUPPER -#define STRINGLIB_TOLOWER Py_UNICODE_TOLOWER -#define STRINGLIB_FILL Py_UNICODE_FILL -#define STRINGLIB_STR PyUnicode_AS_UNICODE -#define STRINGLIB_LEN PyUnicode_GET_SIZE -#define STRINGLIB_NEW PyUnicode_FromUnicode -#define STRINGLIB_RESIZE PyUnicode_Resize -#define STRINGLIB_CHECK PyUnicode_Check -#define STRINGLIB_CHECK_EXACT PyUnicode_CheckExact -#define STRINGLIB_GROUPING _PyUnicode_InsertThousandsGrouping - -#if PY_VERSION_HEX < 0x03000000 -#define STRINGLIB_TOSTR PyObject_Unicode -#else -#define STRINGLIB_TOSTR PyObject_Str -#endif - -#define STRINGLIB_WANT_CONTAINS_OBJ 1 - -#endif /* !STRINGLIB_UNICODEDEFS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/stringobject.c deleted file mode 100644 index 92e8939..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/stringobject.c +++ /dev/null @@ -1,4847 +0,0 @@ -/* String (str/bytes) object implementation */ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include -#include - -#ifdef COUNT_ALLOCS -Py_ssize_t null_strings, one_strings; -#endif - -static PyStringObject *characters[UCHAR_MAX + 1]; -static PyStringObject *nullstring; - -/* This dictionary holds all interned strings. Note that references to - strings in this dictionary are *not* counted in the string's ob_refcnt. - When the interned string reaches a refcnt of 0 the string deallocation - function will delete the reference from this dictionary. - - Another way to look at this is that to say that the actual reference - count of a string is: s->ob_refcnt + (s->ob_sstate?2:0) -*/ -static PyObject *interned; - -/* PyStringObject_SIZE gives the basic size of a string; any memory allocation - for a string of length n should request PyStringObject_SIZE + n bytes. - - Using PyStringObject_SIZE instead of sizeof(PyStringObject) saves - 3 bytes per string allocation on a typical system. -*/ -#define PyStringObject_SIZE (offsetof(PyStringObject, ob_sval) + 1) - -/* - For PyString_FromString(), the parameter `str' points to a null-terminated - string containing exactly `size' bytes. - - For PyString_FromStringAndSize(), the parameter the parameter `str' is - either NULL or else points to a string containing at least `size' bytes. - For PyString_FromStringAndSize(), the string in the `str' parameter does - not have to be null-terminated. (Therefore it is safe to construct a - substring by calling `PyString_FromStringAndSize(origstring, substrlen)'.) - If `str' is NULL then PyString_FromStringAndSize() will allocate `size+1' - bytes (setting the last byte to the null terminating character) and you can - fill in the data yourself. If `str' is non-NULL then the resulting - PyString object must be treated as immutable and you must not fill in nor - alter the data yourself, since the strings may be shared. - - The PyObject member `op->ob_size', which denotes the number of "extra - items" in a variable-size object, will contain the number of bytes - allocated for string data, not counting the null terminating character. - It is therefore equal to the `size' parameter (for - PyString_FromStringAndSize()) or the length of the string in the `str' - parameter (for PyString_FromString()). -*/ -PyObject * -PyString_FromStringAndSize(const char *str, Py_ssize_t size) -{ - register PyStringObject *op; - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyString_FromStringAndSize"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && str != NULL && - (op = characters[*str & UCHAR_MAX]) != NULL) - { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - if (size > PY_SSIZE_T_MAX - PyStringObject_SIZE) { - PyErr_SetString(PyExc_OverflowError, "string is too large"); - return NULL; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - if (str != NULL) - Py_MEMCPY(op->ob_sval, str, size); - op->ob_sval[size] = '\0'; - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1 && str != NULL) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromString(const char *str) -{ - register size_t size; - register PyStringObject *op; - - assert(str != NULL); - size = strlen(str); - if (size > PY_SSIZE_T_MAX - PyStringObject_SIZE) { - PyErr_SetString(PyExc_OverflowError, - "string is too long for a Python string"); - return NULL; - } - if (size == 0 && (op = nullstring) != NULL) { -#ifdef COUNT_ALLOCS - null_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - if (size == 1 && (op = characters[*str & UCHAR_MAX]) != NULL) { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(op); - return (PyObject *)op; - } - - /* Inline PyObject_NewVar */ - op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, str, size+1); - /* share short strings */ - if (size == 0) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - nullstring = op; - Py_INCREF(op); - } else if (size == 1) { - PyObject *t = (PyObject *)op; - PyString_InternInPlace(&t); - op = (PyStringObject *)t; - characters[*str & UCHAR_MAX] = op; - Py_INCREF(op); - } - return (PyObject *) op; -} - -PyObject * -PyString_FromFormatV(const char *format, va_list vargs) -{ - va_list count; - Py_ssize_t n = 0; - const char* f; - char *s; - PyObject* string; - -#ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(count, vargs); -#else - count = vargs; -#endif -#endif - /* step 1: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { -#ifdef HAVE_LONG_LONG - int longlongflag = 0; -#endif - const char* p = f; - while (*++f && *f != '%' && !isalpha(Py_CHARMASK(*f))) - ; - - /* skip the 'l' or 'z' in {%ld, %zd, %lu, %zu} since - * they don't affect the amount of space we reserve. - */ - if (*f == 'l') { - if (f[1] == 'd' || f[1] == 'u') { - ++f; - } -#ifdef HAVE_LONG_LONG - else if (f[1] == 'l' && - (f[2] == 'd' || f[2] == 'u')) { - longlongflag = 1; - f += 2; - } -#endif - } - else if (*f == 'z' && (f[1] == 'd' || f[1] == 'u')) { - ++f; - } - - switch (*f) { - case 'c': - (void)va_arg(count, int); - /* fall through... */ - case '%': - n++; - break; - case 'd': case 'u': case 'i': case 'x': - (void) va_arg(count, int); -#ifdef HAVE_LONG_LONG - /* Need at most - ceil(log10(256)*SIZEOF_LONG_LONG) digits, - plus 1 for the sign. 53/22 is an upper - bound for log10(256). */ - if (longlongflag) - n += 2 + (SIZEOF_LONG_LONG*53-1) / 22; - else -#endif - /* 20 bytes is enough to hold a 64-bit - integer. Decimal takes the most - space. This isn't enough for - octal. */ - n += 20; - - break; - case 's': - s = va_arg(count, char*); - n += strlen(s); - break; - case 'p': - (void) va_arg(count, int); - /* maximum 64-bit pointer representation: - * 0xffffffffffffffff - * so 19 characters is enough. - * XXX I count 18 -- what's the extra for? - */ - n += 19; - break; - default: - /* if we stumble upon an unknown - formatting code, copy the rest of - the format string to the output - string. (we cannot just skip the - code, since there's no way to know - what's in the argument list) */ - n += strlen(p); - goto expand; - } - } else - n++; - } - expand: - /* step 2: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - use sprintf directly instead of the slower PyOS_snprintf. */ - string = PyString_FromStringAndSize(NULL, n); - if (!string) - return NULL; - - s = PyString_AsString(string); - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - Py_ssize_t i; - int longflag = 0; -#ifdef HAVE_LONG_LONG - int longlongflag = 0; -#endif - int size_tflag = 0; - /* parse the width.precision part (we're only - interested in the precision value, if any) */ - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - if (*f == '.') { - f++; - n = 0; - while (isdigit(Py_CHARMASK(*f))) - n = (n*10) + *f++ - '0'; - } - while (*f && *f != '%' && !isalpha(Py_CHARMASK(*f))) - f++; - /* Handle %ld, %lu, %lld and %llu. */ - if (*f == 'l') { - if (f[1] == 'd' || f[1] == 'u') { - longflag = 1; - ++f; - } -#ifdef HAVE_LONG_LONG - else if (f[1] == 'l' && - (f[2] == 'd' || f[2] == 'u')) { - longlongflag = 1; - f += 2; - } -#endif - } - /* handle the size_t flag. */ - else if (*f == 'z' && (f[1] == 'd' || f[1] == 'u')) { - size_tflag = 1; - ++f; - } - - switch (*f) { - case 'c': - *s++ = va_arg(vargs, int); - break; - case 'd': - if (longflag) - sprintf(s, "%ld", va_arg(vargs, long)); -#ifdef HAVE_LONG_LONG - else if (longlongflag) - sprintf(s, "%" PY_FORMAT_LONG_LONG "d", - va_arg(vargs, PY_LONG_LONG)); -#endif - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "d", - va_arg(vargs, Py_ssize_t)); - else - sprintf(s, "%d", va_arg(vargs, int)); - s += strlen(s); - break; - case 'u': - if (longflag) - sprintf(s, "%lu", - va_arg(vargs, unsigned long)); -#ifdef HAVE_LONG_LONG - else if (longlongflag) - sprintf(s, "%" PY_FORMAT_LONG_LONG "u", - va_arg(vargs, PY_LONG_LONG)); -#endif - else if (size_tflag) - sprintf(s, "%" PY_FORMAT_SIZE_T "u", - va_arg(vargs, size_t)); - else - sprintf(s, "%u", - va_arg(vargs, unsigned int)); - s += strlen(s); - break; - case 'i': - sprintf(s, "%i", va_arg(vargs, int)); - s += strlen(s); - break; - case 'x': - sprintf(s, "%x", va_arg(vargs, int)); - s += strlen(s); - break; - case 's': - p = va_arg(vargs, char*); - i = strlen(p); - if (n > 0 && i > n) - i = n; - Py_MEMCPY(s, p, i); - s += i; - break; - case 'p': - sprintf(s, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (s[1] == 'X') - s[1] = 'x'; - else if (s[1] != 'x') { - memmove(s+2, s, strlen(s)+1); - s[0] = '0'; - s[1] = 'x'; - } - s += strlen(s); - break; - case '%': - *s++ = '%'; - break; - default: - strcpy(s, p); - s += strlen(s); - goto end; - } - } else - *s++ = *f; - } - - end: - if (_PyString_Resize(&string, s - PyString_AS_STRING(string))) - return NULL; - return string; -} - -PyObject * -PyString_FromFormat(const char *format, ...) -{ - PyObject* ret; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - ret = PyString_FromFormatV(format, vargs); - va_end(vargs); - return ret; -} - - -PyObject *PyString_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsDecodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsDecodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Decode via the codec registry */ - v = PyCodec_Decode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsDecodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsDecodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -PyObject *PyString_Encode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *str; - - str = PyString_FromStringAndSize(s, size); - if (str == NULL) - return NULL; - v = PyString_AsEncodedString(str, encoding, errors); - Py_DECREF(str); - return v; -} - -PyObject *PyString_AsEncodedObject(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyString_Check(str)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) { -#ifdef Py_USING_UNICODE - encoding = PyUnicode_GetDefaultEncoding(); -#else - PyErr_SetString(PyExc_ValueError, "no encoding specified"); - goto onError; -#endif - } - - /* Encode via the codec registry */ - v = PyCodec_Encode(str, encoding, errors); - if (v == NULL) - goto onError; - - return v; - - onError: - return NULL; -} - -PyObject *PyString_AsEncodedString(PyObject *str, - const char *encoding, - const char *errors) -{ - PyObject *v; - - v = PyString_AsEncodedObject(str, encoding, errors); - if (v == NULL) - goto onError; - -#ifdef Py_USING_UNICODE - /* Convert Unicode to a string using the default encoding */ - if (PyUnicode_Check(v)) { - PyObject *temp = v; - v = PyUnicode_AsEncodedString(v, NULL, NULL); - Py_DECREF(temp); - if (v == NULL) - goto onError; - } -#endif - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - - return v; - - onError: - return NULL; -} - -static void -string_dealloc(PyObject *op) -{ - switch (PyString_CHECK_INTERNED(op)) { - case SSTATE_NOT_INTERNED: - break; - - case SSTATE_INTERNED_MORTAL: - /* revive dead object temporarily for DelItem */ - Py_REFCNT(op) = 3; - if (PyDict_DelItem(interned, op) != 0) - Py_FatalError( - "deletion of interned string failed"); - break; - - case SSTATE_INTERNED_IMMORTAL: - Py_FatalError("Immortal interned string died."); - - default: - Py_FatalError("Inconsistent interned string state."); - } - Py_TYPE(op)->tp_free(op); -} - -/* Unescape a backslash-escaped string. If unicode is non-zero, - the string is a u-literal. If recode_encoding is non-zero, - the string is UTF-8 encoded and should be re-encoded in the - specified encoding. */ - -PyObject *PyString_DecodeEscape(const char *s, - Py_ssize_t len, - const char *errors, - Py_ssize_t unicode, - const char *recode_encoding) -{ - int c; - char *p, *buf; - const char *end; - PyObject *v; - Py_ssize_t newlen = recode_encoding ? 4*len:len; - v = PyString_FromStringAndSize((char *)NULL, newlen); - if (v == NULL) - return NULL; - p = buf = PyString_AsString(v); - end = s + len; - while (s < end) { - if (*s != '\\') { - non_esc: -#ifdef Py_USING_UNICODE - if (recode_encoding && (*s & 0x80)) { - PyObject *u, *w; - char *r; - const char* t; - Py_ssize_t rn; - t = s; - /* Decode non-ASCII bytes as UTF-8. */ - while (t < end && (*t & 0x80)) t++; - u = PyUnicode_DecodeUTF8(s, t - s, errors); - if(!u) goto failed; - - /* Recode them in target encoding. */ - w = PyUnicode_AsEncodedString( - u, recode_encoding, errors); - Py_DECREF(u); - if (!w) goto failed; - - /* Append bytes to output buffer. */ - assert(PyString_Check(w)); - r = PyString_AS_STRING(w); - rn = PyString_GET_SIZE(w); - Py_MEMCPY(p, r, rn); - p += rn; - Py_DECREF(w); - s = t; - } else { - *p++ = *s++; - } -#else - *p++ = *s++; -#endif - continue; - } - s++; - if (s==end) { - PyErr_SetString(PyExc_ValueError, - "Trailing \\ in string"); - goto failed; - } - switch (*s++) { - /* XXX This assumes ASCII! */ - case '\n': break; - case '\\': *p++ = '\\'; break; - case '\'': *p++ = '\''; break; - case '\"': *p++ = '\"'; break; - case 'b': *p++ = '\b'; break; - case 'f': *p++ = '\014'; break; /* FF */ - case 't': *p++ = '\t'; break; - case 'n': *p++ = '\n'; break; - case 'r': *p++ = '\r'; break; - case 'v': *p++ = '\013'; break; /* VT */ - case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - c = s[-1] - '0'; - if (s < end && '0' <= *s && *s <= '7') { - c = (c<<3) + *s++ - '0'; - if (s < end && '0' <= *s && *s <= '7') - c = (c<<3) + *s++ - '0'; - } - *p++ = c; - break; - case 'x': - if (s+1 < end && - isxdigit(Py_CHARMASK(s[0])) && - isxdigit(Py_CHARMASK(s[1]))) - { - unsigned int x = 0; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x = c - '0'; - else if (islower(c)) - x = 10 + c - 'a'; - else - x = 10 + c - 'A'; - x = x << 4; - c = Py_CHARMASK(*s); - s++; - if (isdigit(c)) - x += c - '0'; - else if (islower(c)) - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - *p++ = x; - break; - } - if (!errors || strcmp(errors, "strict") == 0) { - PyErr_SetString(PyExc_ValueError, - "invalid \\x escape"); - goto failed; - } - if (strcmp(errors, "replace") == 0) { - *p++ = '?'; - } else if (strcmp(errors, "ignore") == 0) - /* do nothing */; - else { - PyErr_Format(PyExc_ValueError, - "decoding error; " - "unknown error handling code: %.400s", - errors); - goto failed; - } - /* skip \x */ - if (s < end && isxdigit(Py_CHARMASK(s[0]))) - s++; /* and a hexdigit */ - break; -#ifndef Py_USING_UNICODE - case 'u': - case 'U': - case 'N': - if (unicode) { - PyErr_SetString(PyExc_ValueError, - "Unicode escapes not legal " - "when Unicode disabled"); - goto failed; - } -#endif - default: - *p++ = '\\'; - s--; - goto non_esc; /* an arbitrary number of unescaped - UTF-8 bytes may follow. */ - } - } - if (p-buf < newlen) - _PyString_Resize(&v, p - buf); /* v is cleared on error */ - return v; - failed: - Py_DECREF(v); - return NULL; -} - -/* -------------------------------------------------------------------- */ -/* object api */ - -static Py_ssize_t -string_getsize(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return -1; - return len; -} - -static /*const*/ char * -string_getbuffer(register PyObject *op) -{ - char *s; - Py_ssize_t len; - if (PyString_AsStringAndSize(op, &s, &len)) - return NULL; - return s; -} - -Py_ssize_t -PyString_Size(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getsize(op); - return Py_SIZE(op); -} - -/*const*/ char * -PyString_AsString(register PyObject *op) -{ - if (!PyString_Check(op)) - return string_getbuffer(op); - return ((PyStringObject *)op) -> ob_sval; -} - -int -PyString_AsStringAndSize(register PyObject *obj, - register char **s, - register Py_ssize_t *len) -{ - if (s == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if (!PyString_Check(obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(obj)) { - obj = _PyUnicode_AsDefaultEncodedString(obj, NULL); - if (obj == NULL) - return -1; - } - else -#endif - { - PyErr_Format(PyExc_TypeError, - "expected string or Unicode object, " - "%.200s found", Py_TYPE(obj)->tp_name); - return -1; - } - } - - *s = PyString_AS_STRING(obj); - if (len != NULL) - *len = PyString_GET_SIZE(obj); - else if (strlen(*s) != (size_t)PyString_GET_SIZE(obj)) { - PyErr_SetString(PyExc_TypeError, - "expected string without null bytes"); - return -1; - } - return 0; -} - -/* -------------------------------------------------------------------- */ -/* Methods */ - -#include "stringlib/stringdefs.h" -#include "stringlib/fastsearch.h" - -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" -#include "stringlib/split.h" - -#define _Py_InsertThousandsGrouping _PyString_InsertThousandsGrouping -#include "stringlib/localeutil.h" - - - -static int -string_print(PyStringObject *op, FILE *fp, int flags) -{ - Py_ssize_t i, str_len; - char c; - int quote; - - /* XXX Ought to check for interrupts when writing long strings */ - if (! PyString_CheckExact(op)) { - int ret; - /* A str subclass may have its own __str__ method. */ - op = (PyStringObject *) PyObject_Str((PyObject *)op); - if (op == NULL) - return -1; - ret = string_print(op, fp, flags); - Py_DECREF(op); - return ret; - } - if (flags & Py_PRINT_RAW) { - char *data = op->ob_sval; - Py_ssize_t size = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - while (size > INT_MAX) { - /* Very long strings cannot be written atomically. - * But don't write exactly INT_MAX bytes at a time - * to avoid memory aligment issues. - */ - const int chunk_size = INT_MAX & ~0x3FFF; - fwrite(data, 1, chunk_size, fp); - data += chunk_size; - size -= chunk_size; - } -#ifdef __VMS - if (size) fwrite(data, (size_t)size, 1, fp); -#else - fwrite(data, 1, (size_t)size, fp); -#endif - Py_END_ALLOW_THREADS - return 0; - } - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - str_len = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - fputc(quote, fp); - for (i = 0; i < str_len; i++) { - /* Since strings are immutable and the caller should have a - reference, accessing the interal buffer should not be an issue - with the GIL released. */ - c = op->ob_sval[i]; - if (c == quote || c == '\\') - fprintf(fp, "\\%c", c); - else if (c == '\t') - fprintf(fp, "\\t"); - else if (c == '\n') - fprintf(fp, "\\n"); - else if (c == '\r') - fprintf(fp, "\\r"); - else if (c < ' ' || c >= 0x7f) - fprintf(fp, "\\x%02x", c & 0xff); - else - fputc(c, fp); - } - fputc(quote, fp); - Py_END_ALLOW_THREADS - return 0; -} - -PyObject * -PyString_Repr(PyObject *obj, int smartquotes) -{ - register PyStringObject* op = (PyStringObject*) obj; - size_t newsize; - PyObject *v; - if (Py_SIZE(op) > (PY_SSIZE_T_MAX - 2)/4) { - PyErr_SetString(PyExc_OverflowError, - "string is too large to make repr"); - return NULL; - } - newsize = 2 + 4*Py_SIZE(op); - v = PyString_FromStringAndSize((char *)NULL, newsize); - if (v == NULL) { - return NULL; - } - else { - register Py_ssize_t i; - register char c; - register char *p; - int quote; - - /* figure out which quote to use; single is preferred */ - quote = '\''; - if (smartquotes && - memchr(op->ob_sval, '\'', Py_SIZE(op)) && - !memchr(op->ob_sval, '"', Py_SIZE(op))) - quote = '"'; - - p = PyString_AS_STRING(v); - *p++ = quote; - for (i = 0; i < Py_SIZE(op); i++) { - /* There's at least enough room for a hex escape - and a closing quote. */ - assert(newsize - (p - PyString_AS_STRING(v)) >= 5); - c = op->ob_sval[i]; - if (c == quote || c == '\\') - *p++ = '\\', *p++ = c; - else if (c == '\t') - *p++ = '\\', *p++ = 't'; - else if (c == '\n') - *p++ = '\\', *p++ = 'n'; - else if (c == '\r') - *p++ = '\\', *p++ = 'r'; - else if (c < ' ' || c >= 0x7f) { - /* For performance, we don't want to call - PyOS_snprintf here (extra layers of - function call). */ - sprintf(p, "\\x%02x", c & 0xff); - p += 4; - } - else - *p++ = c; - } - assert(newsize - (p - PyString_AS_STRING(v)) >= 1); - *p++ = quote; - *p = '\0'; - if (_PyString_Resize(&v, (p - PyString_AS_STRING(v)))) - return NULL; - return v; - } -} - -static PyObject * -string_repr(PyObject *op) -{ - return PyString_Repr(op, 1); -} - -static PyObject * -string_str(PyObject *s) -{ - assert(PyString_Check(s)); - if (PyString_CheckExact(s)) { - Py_INCREF(s); - return s; - } - else { - /* Subtype -- return genuine string with the same value. */ - PyStringObject *t = (PyStringObject *) s; - return PyString_FromStringAndSize(t->ob_sval, Py_SIZE(t)); - } -} - -static Py_ssize_t -string_length(PyStringObject *a) -{ - return Py_SIZE(a); -} - -static PyObject * -string_concat(register PyStringObject *a, register PyObject *bb) -{ - register Py_ssize_t size; - register PyStringObject *op; - if (!PyString_Check(bb)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(bb)) - return PyUnicode_Concat((PyObject *)a, bb); -#endif - if (PyByteArray_Check(bb)) - return PyByteArray_Concat((PyObject *)a, bb); - PyErr_Format(PyExc_TypeError, - "cannot concatenate 'str' and '%.200s' objects", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((PyStringObject *)bb) - /* Optimize cases with empty left or right operand */ - if ((Py_SIZE(a) == 0 || Py_SIZE(b) == 0) && - PyString_CheckExact(a) && PyString_CheckExact(b)) { - if (Py_SIZE(a) == 0) { - Py_INCREF(bb); - return bb; - } - Py_INCREF(a); - return (PyObject *)a; - } - size = Py_SIZE(a) + Py_SIZE(b); - /* Check that string sizes are not negative, to prevent an - overflow in cases where we are passed incorrectly-created - strings with negative lengths (due to a bug in other code). - */ - if (Py_SIZE(a) < 0 || Py_SIZE(b) < 0 || - Py_SIZE(a) > PY_SSIZE_T_MAX - Py_SIZE(b)) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - - /* Inline PyObject_NewVar */ - if (size > PY_SSIZE_T_MAX - PyStringObject_SIZE) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + size); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - Py_MEMCPY(op->ob_sval + Py_SIZE(a), b->ob_sval, Py_SIZE(b)); - op->ob_sval[size] = '\0'; - return (PyObject *) op; -#undef b -} - -static PyObject * -string_repeat(register PyStringObject *a, register Py_ssize_t n) -{ - register Py_ssize_t i; - register Py_ssize_t j; - register Py_ssize_t size; - register PyStringObject *op; - size_t nbytes; - if (n < 0) - n = 0; - /* watch out for overflows: the size can overflow int, - * and the # of bytes needed can overflow size_t - */ - size = Py_SIZE(a) * n; - if (n && size / n != Py_SIZE(a)) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - if (size == Py_SIZE(a) && PyString_CheckExact(a)) { - Py_INCREF(a); - return (PyObject *)a; - } - nbytes = (size_t)size; - if (nbytes + PyStringObject_SIZE <= nbytes) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - op = (PyStringObject *)PyObject_MALLOC(PyStringObject_SIZE + nbytes); - if (op == NULL) - return PyErr_NoMemory(); - PyObject_INIT_VAR(op, &PyString_Type, size); - op->ob_shash = -1; - op->ob_sstate = SSTATE_NOT_INTERNED; - op->ob_sval[size] = '\0'; - if (Py_SIZE(a) == 1 && n > 0) { - memset(op->ob_sval, a->ob_sval[0] , n); - return (PyObject *) op; - } - i = 0; - if (i < size) { - Py_MEMCPY(op->ob_sval, a->ob_sval, Py_SIZE(a)); - i = Py_SIZE(a); - } - while (i < size) { - j = (i <= size-i) ? i : size-i; - Py_MEMCPY(op->ob_sval+i, op->ob_sval, j); - i += j; - } - return (PyObject *) op; -} - -/* String slice a[i:j] consists of characters a[i] ... a[j-1] */ - -static PyObject * -string_slice(register PyStringObject *a, register Py_ssize_t i, - register Py_ssize_t j) - /* j -- may be negative! */ -{ - if (i < 0) - i = 0; - if (j < 0) - j = 0; /* Avoid signed/unsigned bug in next line */ - if (j > Py_SIZE(a)) - j = Py_SIZE(a); - if (i == 0 && j == Py_SIZE(a) && PyString_CheckExact(a)) { - /* It's the same as a */ - Py_INCREF(a); - return (PyObject *)a; - } - if (j < i) - j = i; - return PyString_FromStringAndSize(a->ob_sval + i, j-i); -} - -static int -string_contains(PyObject *str_obj, PyObject *sub_obj) -{ - if (!PyString_CheckExact(sub_obj)) { -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(sub_obj)) - return PyUnicode_Contains(str_obj, sub_obj); -#endif - if (!PyString_Check(sub_obj)) { - PyErr_Format(PyExc_TypeError, - "'in ' requires string as left operand, " - "not %.200s", Py_TYPE(sub_obj)->tp_name); - return -1; - } - } - - return stringlib_contains_obj(str_obj, sub_obj); -} - -static PyObject * -string_item(PyStringObject *a, register Py_ssize_t i) -{ - char pchar; - PyObject *v; - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return NULL; - } - pchar = a->ob_sval[i]; - v = (PyObject *)characters[pchar & UCHAR_MAX]; - if (v == NULL) - v = PyString_FromStringAndSize(&pchar, 1); - else { -#ifdef COUNT_ALLOCS - one_strings++; -#endif - Py_INCREF(v); - } - return v; -} - -static PyObject* -string_richcompare(PyStringObject *a, PyStringObject *b, int op) -{ - int c; - Py_ssize_t len_a, len_b; - Py_ssize_t min_len; - PyObject *result; - - /* Make sure both arguments are strings. */ - if (!(PyString_Check(a) && PyString_Check(b))) { - result = Py_NotImplemented; - goto out; - } - if (a == b) { - switch (op) { - case Py_EQ:case Py_LE:case Py_GE: - result = Py_True; - goto out; - case Py_NE:case Py_LT:case Py_GT: - result = Py_False; - goto out; - } - } - if (op == Py_EQ) { - /* Supporting Py_NE here as well does not save - much time, since Py_NE is rarely used. */ - if (Py_SIZE(a) == Py_SIZE(b) - && (a->ob_sval[0] == b->ob_sval[0] - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0)) { - result = Py_True; - } else { - result = Py_False; - } - goto out; - } - len_a = Py_SIZE(a); len_b = Py_SIZE(b); - min_len = (len_a < len_b) ? len_a : len_b; - if (min_len > 0) { - c = Py_CHARMASK(*a->ob_sval) - Py_CHARMASK(*b->ob_sval); - if (c==0) - c = memcmp(a->ob_sval, b->ob_sval, min_len); - } else - c = 0; - if (c == 0) - c = (len_a < len_b) ? -1 : (len_a > len_b) ? 1 : 0; - switch (op) { - case Py_LT: c = c < 0; break; - case Py_LE: c = c <= 0; break; - case Py_EQ: assert(0); break; /* unreachable */ - case Py_NE: c = c != 0; break; - case Py_GT: c = c > 0; break; - case Py_GE: c = c >= 0; break; - default: - result = Py_NotImplemented; - goto out; - } - result = c ? Py_True : Py_False; - out: - Py_INCREF(result); - return result; -} - -int -_PyString_Eq(PyObject *o1, PyObject *o2) -{ - PyStringObject *a = (PyStringObject*) o1; - PyStringObject *b = (PyStringObject*) o2; - return Py_SIZE(a) == Py_SIZE(b) - && memcmp(a->ob_sval, b->ob_sval, Py_SIZE(a)) == 0; -} - -static long -string_hash(PyStringObject *a) -{ - register Py_ssize_t len; - register unsigned char *p; - register long x; - -#ifdef Py_DEBUG - assert(_Py_HashSecret_Initialized); -#endif - if (a->ob_shash != -1) - return a->ob_shash; - len = Py_SIZE(a); - /* - We make the hash of the empty string be 0, rather than using - (prefix ^ suffix), since this slightly obfuscates the hash secret - */ - if (len == 0) { - a->ob_shash = 0; - return 0; - } - p = (unsigned char *) a->ob_sval; - x = _Py_HashSecret.prefix; - x ^= *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= Py_SIZE(a); - x ^= _Py_HashSecret.suffix; - if (x == -1) - x = -2; - a->ob_shash = x; - return x; -} - -static PyObject* -string_subscript(PyStringObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyString_GET_SIZE(self); - return string_item(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - char* source_buf; - char* result_buf; - PyObject* result; - - if (PySlice_GetIndicesEx((PySliceObject*)item, - PyString_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyString_FromStringAndSize("", 0); - } - else if (start == 0 && step == 1 && - slicelength == PyString_GET_SIZE(self) && - PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - else if (step == 1) { - return PyString_FromStringAndSize( - PyString_AS_STRING(self) + start, - slicelength); - } - else { - source_buf = PyString_AsString((PyObject*)self); - result_buf = (char *)PyMem_Malloc(slicelength); - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyString_FromStringAndSize(result_buf, - slicelength); - PyMem_Free(result_buf); - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "string indices must be integers, not %.200s", - Py_TYPE(item)->tp_name); - return NULL; - } -} - -static Py_ssize_t -string_buffer_getreadbuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = (void *)self->ob_sval; - return Py_SIZE(self); -} - -static Py_ssize_t -string_buffer_getwritebuf(PyStringObject *self, Py_ssize_t index, const void **ptr) -{ - PyErr_SetString(PyExc_TypeError, - "Cannot use string as modifiable buffer"); - return -1; -} - -static Py_ssize_t -string_buffer_getsegcount(PyStringObject *self, Py_ssize_t *lenp) -{ - if ( lenp ) - *lenp = Py_SIZE(self); - return 1; -} - -static Py_ssize_t -string_buffer_getcharbuf(PyStringObject *self, Py_ssize_t index, const char **ptr) -{ - if ( index != 0 ) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent string segment"); - return -1; - } - *ptr = self->ob_sval; - return Py_SIZE(self); -} - -static int -string_buffer_getbuffer(PyStringObject *self, Py_buffer *view, int flags) -{ - return PyBuffer_FillInfo(view, (PyObject*)self, - (void *)self->ob_sval, Py_SIZE(self), - 1, flags); -} - -static PySequenceMethods string_as_sequence = { - (lenfunc)string_length, /*sq_length*/ - (binaryfunc)string_concat, /*sq_concat*/ - (ssizeargfunc)string_repeat, /*sq_repeat*/ - (ssizeargfunc)string_item, /*sq_item*/ - (ssizessizeargfunc)string_slice, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - (objobjproc)string_contains /*sq_contains*/ -}; - -static PyMappingMethods string_as_mapping = { - (lenfunc)string_length, - (binaryfunc)string_subscript, - 0, -}; - -static PyBufferProcs string_as_buffer = { - (readbufferproc)string_buffer_getreadbuf, - (writebufferproc)string_buffer_getwritebuf, - (segcountproc)string_buffer_getsegcount, - (charbufferproc)string_buffer_getcharbuf, - (getbufferproc)string_buffer_getbuffer, - 0, /* XXX */ -}; - - - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - -/* Arrays indexed by above */ -static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; - -#define STRIPNAME(i) (stripformat[i]+3) - -PyDoc_STRVAR(split__doc__, -"S.split([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified or is None, any\n\ -whitespace string is a separator and empty strings are removed\n\ -from the result."); - -static PyObject * -string_split(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n; - Py_ssize_t maxsplit = -1; - const char *s = PyString_AS_STRING(self), *sub; - PyObject *subobj = Py_None; - - if (!PyArg_ParseTuple(args, "|On:split", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return stringlib_split_whitespace((PyObject*) self, s, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Split((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - return stringlib_split((PyObject*) self, s, len, sub, n, maxsplit); -} - -PyDoc_STRVAR(partition__doc__, -"S.partition(sep) -> (head, sep, tail)\n\ -\n\ -Search for the separator sep in S, and return the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, return S and two empty strings."); - -static PyObject * -string_partition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_Partition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_partition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -PyDoc_STRVAR(rpartition__doc__, -"S.rpartition(sep) -> (head, sep, tail)\n\ -\n\ -Search for the separator sep in S, starting at the end of S, and return\n\ -the part before it, the separator itself, and the part after it. If the\n\ -separator is not found, return two empty strings and S."); - -static PyObject * -string_rpartition(PyStringObject *self, PyObject *sep_obj) -{ - const char *sep; - Py_ssize_t sep_len; - - if (PyString_Check(sep_obj)) { - sep = PyString_AS_STRING(sep_obj); - sep_len = PyString_GET_SIZE(sep_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep_obj)) - return PyUnicode_RPartition((PyObject *) self, sep_obj); -#endif - else if (PyObject_AsCharBuffer(sep_obj, &sep, &sep_len)) - return NULL; - - return stringlib_rpartition( - (PyObject*) self, - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sep_obj, sep, sep_len - ); -} - -PyDoc_STRVAR(rsplit__doc__, -"S.rsplit([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in the string S, using sep as the\n\ -delimiter string, starting at the end of the string and working\n\ -to the front. If maxsplit is given, at most maxsplit splits are\n\ -done. If sep is not specified or is None, any whitespace string\n\ -is a separator."); - -static PyObject * -string_rsplit(PyStringObject *self, PyObject *args) -{ - Py_ssize_t len = PyString_GET_SIZE(self), n; - Py_ssize_t maxsplit = -1; - const char *s = PyString_AS_STRING(self), *sub; - PyObject *subobj = Py_None; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &subobj, &maxsplit)) - return NULL; - if (maxsplit < 0) - maxsplit = PY_SSIZE_T_MAX; - if (subobj == Py_None) - return stringlib_rsplit_whitespace((PyObject*) self, s, len, maxsplit); - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - n = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_RSplit((PyObject *)self, subobj, maxsplit); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &n)) - return NULL; - - return stringlib_rsplit((PyObject*) self, s, len, sub, n, maxsplit); -} - - -PyDoc_STRVAR(join__doc__, -"S.join(iterable) -> string\n\ -\n\ -Return a string which is the concatenation of the strings in the\n\ -iterable. The separator between elements is S."); - -static PyObject * -string_join(PyStringObject *self, PyObject *orig) -{ - char *sep = PyString_AS_STRING(self); - const Py_ssize_t seplen = PyString_GET_SIZE(self); - PyObject *res = NULL; - char *p; - Py_ssize_t seqlen = 0; - size_t sz = 0; - Py_ssize_t i; - PyObject *seq, *item; - - seq = PySequence_Fast(orig, "can only join an iterable"); - if (seq == NULL) { - return NULL; - } - - seqlen = PySequence_Size(seq); - if (seqlen == 0) { - Py_DECREF(seq); - return PyString_FromString(""); - } - if (seqlen == 1) { - item = PySequence_Fast_GET_ITEM(seq, 0); - if (PyString_CheckExact(item) || PyUnicode_CheckExact(item)) { - Py_INCREF(item); - Py_DECREF(seq); - return item; - } - } - - /* There are at least two things to join, or else we have a subclass - * of the builtin types in the sequence. - * Do a pre-pass to figure out the total amount of space we'll - * need (sz), see whether any argument is absurd, and defer to - * the Unicode join if appropriate. - */ - for (i = 0; i < seqlen; i++) { - const size_t old_sz = sz; - item = PySequence_Fast_GET_ITEM(seq, i); - if (!PyString_Check(item)){ -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(item)) { - /* Defer to Unicode join. - * CAUTION: There's no gurantee that the - * original sequence can be iterated over - * again, so we must pass seq here. - */ - PyObject *result; - result = PyUnicode_Join((PyObject *)self, seq); - Py_DECREF(seq); - return result; - } -#endif - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected string," - " %.80s found", - i, Py_TYPE(item)->tp_name); - Py_DECREF(seq); - return NULL; - } - sz += PyString_GET_SIZE(item); - if (i != 0) - sz += seplen; - if (sz < old_sz || sz > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "join() result is too long for a Python string"); - Py_DECREF(seq); - return NULL; - } - } - - /* Allocate result space. */ - res = PyString_FromStringAndSize((char*)NULL, sz); - if (res == NULL) { - Py_DECREF(seq); - return NULL; - } - - /* Catenate everything. */ - p = PyString_AS_STRING(res); - for (i = 0; i < seqlen; ++i) { - size_t n; - item = PySequence_Fast_GET_ITEM(seq, i); - n = PyString_GET_SIZE(item); - Py_MEMCPY(p, PyString_AS_STRING(item), n); - p += n; - if (i < seqlen - 1) { - Py_MEMCPY(p, sep, seplen); - p += seplen; - } - } - - Py_DECREF(seq); - return res; -} - -PyObject * -_PyString_Join(PyObject *sep, PyObject *x) -{ - assert(sep != NULL && PyString_Check(sep)); - assert(x != NULL); - return string_join((PyStringObject *)sep, x); -} - -/* helper macro to fixup start/end slice values */ -#define ADJUST_INDICES(start, end, len) \ - if (end > len) \ - end = len; \ - else if (end < 0) { \ - end += len; \ - if (end < 0) \ - end = 0; \ - } \ - if (start < 0) { \ - start += len; \ - if (start < 0) \ - start = 0; \ - } - -Py_LOCAL_INLINE(Py_ssize_t) -string_find_internal(PyStringObject *self, PyObject *args, int dir) -{ - PyObject *subobj; - const char *sub; - Py_ssize_t sub_len; - Py_ssize_t start=0, end=PY_SSIZE_T_MAX; - - if (!stringlib_parse_args_finds("find/rfind/index/rindex", - args, &subobj, &start, &end)) - return -2; - - if (PyString_Check(subobj)) { - sub = PyString_AS_STRING(subobj); - sub_len = PyString_GET_SIZE(subobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(subobj)) - return PyUnicode_Find( - (PyObject *)self, subobj, start, end, dir); -#endif - else if (PyObject_AsCharBuffer(subobj, &sub, &sub_len)) - /* XXX - the "expected a character buffer object" is pretty - confusing for a non-expert. remap to something else ? */ - return -2; - - if (dir > 0) - return stringlib_find_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); - else - return stringlib_rfind_slice( - PyString_AS_STRING(self), PyString_GET_SIZE(self), - sub, sub_len, start, end); -} - - -PyDoc_STRVAR(find__doc__, -"S.find(sub [,start [,end]]) -> int\n\ -\n\ -Return the lowest index in S where substring sub is found,\n\ -such that sub is contained within S[start:end]. Optional\n\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_find(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(index__doc__, -"S.index(sub [,start [,end]]) -> int\n\ -\n\ -Like S.find() but raise ValueError when the substring is not found."); - -static PyObject * -string_index(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, +1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rfind__doc__, -"S.rfind(sub [,start [,end]]) -> int\n\ -\n\ -Return the highest index in S where substring sub is found,\n\ -such that sub is contained within S[start:end]. Optional\n\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -string_rfind(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - return PyInt_FromSsize_t(result); -} - - -PyDoc_STRVAR(rindex__doc__, -"S.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like S.rfind() but raise ValueError when the substring is not found."); - -static PyObject * -string_rindex(PyStringObject *self, PyObject *args) -{ - Py_ssize_t result = string_find_internal(self, args, -1); - if (result == -2) - return NULL; - if (result == -1) { - PyErr_SetString(PyExc_ValueError, - "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - - -Py_LOCAL_INLINE(PyObject *) -do_xstrip(PyStringObject *self, int striptype, PyObject *sepobj) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self); - char *sep = PyString_AS_STRING(sepobj); - Py_ssize_t seplen = PyString_GET_SIZE(sepobj); - Py_ssize_t i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && memchr(sep, Py_CHARMASK(s[i]), seplen)) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && memchr(sep, Py_CHARMASK(s[j]), seplen)); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_strip(PyStringObject *self, int striptype) -{ - char *s = PyString_AS_STRING(self); - Py_ssize_t len = PyString_GET_SIZE(self), i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && isspace(Py_CHARMASK(s[i]))) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && isspace(Py_CHARMASK(s[j]))); - j++; - } - - if (i == 0 && j == len && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyString_FromStringAndSize(s+i, j-i); -} - - -Py_LOCAL_INLINE(PyObject *) -do_argstrip(PyStringObject *self, int striptype, PyObject *args) -{ - PyObject *sep = NULL; - - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; - - if (sep != NULL && sep != Py_None) { - if (PyString_Check(sep)) - return do_xstrip(self, striptype, sep); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sep)) { - PyObject *uniself = PyUnicode_FromObject((PyObject *)self); - PyObject *res; - if (uniself==NULL) - return NULL; - res = _PyUnicode_XStrip((PyUnicodeObject *)uniself, - striptype, sep); - Py_DECREF(uniself); - return res; - } -#endif - PyErr_Format(PyExc_TypeError, -#ifdef Py_USING_UNICODE - "%s arg must be None, str or unicode", -#else - "%s arg must be None or str", -#endif - STRIPNAME(striptype)); - return NULL; - } - - return do_strip(self, striptype); -} - - -PyDoc_STRVAR(strip__doc__, -"S.strip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with leading and trailing\n\ -whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_strip(PyStringObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, BOTHSTRIP); /* Common case */ - else - return do_argstrip(self, BOTHSTRIP, args); -} - - -PyDoc_STRVAR(lstrip__doc__, -"S.lstrip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with leading whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_lstrip(PyStringObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, LEFTSTRIP); /* Common case */ - else - return do_argstrip(self, LEFTSTRIP, args); -} - - -PyDoc_STRVAR(rstrip__doc__, -"S.rstrip([chars]) -> string or unicode\n\ -\n\ -Return a copy of the string S with trailing whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is unicode, S will be converted to unicode before stripping"); - -static PyObject * -string_rstrip(PyStringObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); -} - - -PyDoc_STRVAR(lower__doc__, -"S.lower() -> string\n\ -\n\ -Return a copy of the string S converted to lowercase."); - -/* _tolower and _toupper are defined by SUSv2, but they're not ISO C */ -#ifndef _tolower -#define _tolower tolower -#endif - -static PyObject * -string_lower(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (isupper(c)) - s[i] = _tolower(c); - } - - return newobj; -} - -PyDoc_STRVAR(upper__doc__, -"S.upper() -> string\n\ -\n\ -Return a copy of the string S converted to uppercase."); - -#ifndef _toupper -#define _toupper toupper -#endif - -static PyObject * -string_upper(PyStringObject *self) -{ - char *s; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (!newobj) - return NULL; - - s = PyString_AS_STRING(newobj); - - Py_MEMCPY(s, PyString_AS_STRING(self), n); - - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(s[i]); - if (islower(c)) - s[i] = _toupper(c); - } - - return newobj; -} - -PyDoc_STRVAR(title__doc__, -"S.title() -> string\n\ -\n\ -Return a titlecased version of S, i.e. words start with uppercase\n\ -characters, all remaining cased characters have lowercase."); - -static PyObject* -string_title(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - int previous_is_cased = 0; - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - if (!previous_is_cased) - c = toupper(c); - previous_is_cased = 1; - } else if (isupper(c)) { - if (previous_is_cased) - c = tolower(c); - previous_is_cased = 1; - } else - previous_is_cased = 0; - *s_new++ = c; - } - return newobj; -} - -PyDoc_STRVAR(capitalize__doc__, -"S.capitalize() -> string\n\ -\n\ -Return a copy of the string S with only its first character\n\ -capitalized."); - -static PyObject * -string_capitalize(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - if (0 < n) { - int c = Py_CHARMASK(*s++); - if (islower(c)) - *s_new = toupper(c); - else - *s_new = c; - s_new++; - } - for (i = 1; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (isupper(c)) - *s_new = tolower(c); - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(count__doc__, -"S.count(sub[, start[, end]]) -> int\n\ -\n\ -Return the number of non-overlapping occurrences of substring sub in\n\ -string S[start:end]. Optional arguments start and end are interpreted\n\ -as in slice notation."); - -static PyObject * -string_count(PyStringObject *self, PyObject *args) -{ - PyObject *sub_obj; - const char *str = PyString_AS_STRING(self), *sub; - Py_ssize_t sub_len; - Py_ssize_t start = 0, end = PY_SSIZE_T_MAX; - - if (!stringlib_parse_args_finds("count", args, &sub_obj, &start, &end)) - return NULL; - - if (PyString_Check(sub_obj)) { - sub = PyString_AS_STRING(sub_obj); - sub_len = PyString_GET_SIZE(sub_obj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(sub_obj)) { - Py_ssize_t count; - count = PyUnicode_Count((PyObject *)self, sub_obj, start, end); - if (count == -1) - return NULL; - else - return PyInt_FromSsize_t(count); - } -#endif - else if (PyObject_AsCharBuffer(sub_obj, &sub, &sub_len)) - return NULL; - - ADJUST_INDICES(start, end, PyString_GET_SIZE(self)); - - return PyInt_FromSsize_t( - stringlib_count(str + start, end - start, sub, sub_len, PY_SSIZE_T_MAX) - ); -} - -PyDoc_STRVAR(swapcase__doc__, -"S.swapcase() -> string\n\ -\n\ -Return a copy of the string S with uppercase characters\n\ -converted to lowercase and vice versa."); - -static PyObject * -string_swapcase(PyStringObject *self) -{ - char *s = PyString_AS_STRING(self), *s_new; - Py_ssize_t i, n = PyString_GET_SIZE(self); - PyObject *newobj; - - newobj = PyString_FromStringAndSize(NULL, n); - if (newobj == NULL) - return NULL; - s_new = PyString_AsString(newobj); - for (i = 0; i < n; i++) { - int c = Py_CHARMASK(*s++); - if (islower(c)) { - *s_new = toupper(c); - } - else if (isupper(c)) { - *s_new = tolower(c); - } - else - *s_new = c; - s_new++; - } - return newobj; -} - - -PyDoc_STRVAR(translate__doc__, -"S.translate(table [,deletechars]) -> string\n\ -\n\ -Return a copy of the string S, where all characters occurring\n\ -in the optional argument deletechars are removed, and the\n\ -remaining characters have been mapped through the given\n\ -translation table, which must be a string of length 256 or None.\n\ -If the table argument is None, no translation is applied and\n\ -the operation simply removes the characters in deletechars."); - -static PyObject * -string_translate(PyStringObject *self, PyObject *args) -{ - register char *input, *output; - const char *table; - register Py_ssize_t i, c, changed = 0; - PyObject *input_obj = (PyObject*)self; - const char *output_start, *del_table=NULL; - Py_ssize_t inlen, tablen, dellen = 0; - PyObject *result; - int trans_table[256]; - PyObject *tableobj, *delobj = NULL; - - if (!PyArg_UnpackTuple(args, "translate", 1, 2, - &tableobj, &delobj)) - return NULL; - - if (PyString_Check(tableobj)) { - table = PyString_AS_STRING(tableobj); - tablen = PyString_GET_SIZE(tableobj); - } - else if (tableobj == Py_None) { - table = NULL; - tablen = 256; - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(tableobj)) { - /* Unicode .translate() does not support the deletechars - parameter; instead a mapping to None will cause characters - to be deleted. */ - if (delobj != NULL) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } - return PyUnicode_Translate((PyObject *)self, tableobj, NULL); - } -#endif - else if (PyObject_AsCharBuffer(tableobj, &table, &tablen)) - return NULL; - - if (tablen != 256) { - PyErr_SetString(PyExc_ValueError, - "translation table must be 256 characters long"); - return NULL; - } - - if (delobj != NULL) { - if (PyString_Check(delobj)) { - del_table = PyString_AS_STRING(delobj); - dellen = PyString_GET_SIZE(delobj); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(delobj)) { - PyErr_SetString(PyExc_TypeError, - "deletions are implemented differently for unicode"); - return NULL; - } -#endif - else if (PyObject_AsCharBuffer(delobj, &del_table, &dellen)) - return NULL; - } - else { - del_table = NULL; - dellen = 0; - } - - inlen = PyString_GET_SIZE(input_obj); - result = PyString_FromStringAndSize((char *)NULL, inlen); - if (result == NULL) - return NULL; - output_start = output = PyString_AsString(result); - input = PyString_AS_STRING(input_obj); - - if (dellen == 0 && table != NULL) { - /* If no deletions are required, use faster code */ - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (Py_CHARMASK((*output++ = table[c])) != c) - changed = 1; - } - if (changed || !PyString_CheckExact(input_obj)) - return result; - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - - if (table == NULL) { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(i); - } else { - for (i = 0; i < 256; i++) - trans_table[i] = Py_CHARMASK(table[i]); - } - - for (i = 0; i < dellen; i++) - trans_table[(int) Py_CHARMASK(del_table[i])] = -1; - - for (i = inlen; --i >= 0; ) { - c = Py_CHARMASK(*input++); - if (trans_table[c] != -1) - if (Py_CHARMASK(*output++ = (char)trans_table[c]) == c) - continue; - changed = 1; - } - if (!changed && PyString_CheckExact(input_obj)) { - Py_DECREF(result); - Py_INCREF(input_obj); - return input_obj; - } - /* Fix the size of the resulting string */ - if (inlen > 0 && _PyString_Resize(&result, output - output_start)) - return NULL; - return result; -} - - -/* find and count characters and substrings */ - -#define findchar(target, target_len, c) \ - ((char *)memchr((const void *)(target), c, target_len)) - -/* String ops must return a string. */ -/* If the object is subclass of string, create a copy */ -Py_LOCAL(PyStringObject *) -return_self(PyStringObject *self) -{ - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return self; - } - return (PyStringObject *)PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); -} - -Py_LOCAL_INLINE(Py_ssize_t) -countchar(const char *target, Py_ssize_t target_len, char c, Py_ssize_t maxcount) -{ - Py_ssize_t count=0; - const char *start=target; - const char *end=target+target_len; - - while ( (start=findchar(start, end-start, c)) != NULL ) { - count++; - if (count >= maxcount) - break; - start += 1; - } - return count; -} - - -/* Algorithms for different cases of string replacement */ - -/* len(self)>=1, from="", len(to)>=1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_interleave(PyStringObject *self, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - Py_ssize_t self_len, result_len; - Py_ssize_t count, i, product; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - - /* 1 at the end plus 1 after every character */ - count = self_len+1; - if (maxcount < count) - count = maxcount; - - /* Check for overflow */ - /* result_len = count * to_len + self_len; */ - product = count * to_len; - if (product / to_len != count) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - result_len = product + self_len; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - - if (! (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) ) - return NULL; - - self_s = PyString_AS_STRING(self); - result_s = PyString_AS_STRING(result); - - /* TODO: special case single character, which doesn't need memcpy */ - - /* Lay the first one down (guaranteed this will occur) */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - count -= 1; - - for (i=0; i=1, len(from)==1, to="", maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_delete_single_character(PyStringObject *self, - char from_c, Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - return return_self(self); - } - - result_len = self_len - count; /* from_len == 1 */ - assert(result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - start = next+1; - } - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, to="", maxcount>=1 */ - -Py_LOCAL(PyStringObject *) -replace_delete_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset; - PyStringObject *result; - - self_len = PyString_GET_SIZE(self); - self_s = PyString_AS_STRING(self); - - count = stringlib_count(self_s, self_len, - from_s, from_len, - maxcount); - - if (count == 0) { - /* no matches */ - return return_self(self); - } - - result_len = self_len - (count * from_len); - assert (result_len>=0); - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL ) - return NULL; - - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = stringlib_find(start, end-start, - from_s, from_len, - 0); - if (offset == -1) - break; - next = start + offset; - - Py_MEMCPY(result_s, start, next-start); - - result_s += (next-start); - start = next+from_len; - } - Py_MEMCPY(result_s, start, end-start); - return result; -} - -/* len(self)>=1, len(from)==len(to)==1, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character_in_place(PyStringObject *self, - char from_c, char to_c, - Py_ssize_t maxcount) -{ - char *self_s, *result_s, *start, *end, *next; - Py_ssize_t self_len; - PyStringObject *result; - - /* The result string will be the same size */ - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - next = findchar(self_s, self_len, from_c); - - if (next == NULL) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + (next-self_s); - *start = to_c; - start++; - end = result_s + self_len; - - while (--maxcount > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - *next = to_c; - start = next+1; - } - - return result; -} - -/* len(self)>=1, len(from)==len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring_in_place(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *result_s, *start, *end; - char *self_s; - Py_ssize_t self_len, offset; - PyStringObject *result; - - /* The result string will be the same size */ - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - offset = stringlib_find(self_s, self_len, - from_s, from_len, - 0); - if (offset == -1) { - /* No matches; return the original string */ - return return_self(self); - } - - /* Need to make a new string */ - result = (PyStringObject *) PyString_FromStringAndSize(NULL, self_len); - if (result == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - Py_MEMCPY(result_s, self_s, self_len); - - /* change everything in-place, starting with this one */ - start = result_s + offset; - Py_MEMCPY(start, to_s, from_len); - start += from_len; - end = result_s + self_len; - - while ( --maxcount > 0) { - offset = stringlib_find(start, end-start, - from_s, from_len, - 0); - if (offset==-1) - break; - Py_MEMCPY(start+offset, to_s, from_len); - start += offset+from_len; - } - - return result; -} - -/* len(self)>=1, len(from)==1, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_single_character(PyStringObject *self, - char from_c, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = countchar(self_s, self_len, from_c, maxcount); - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* use the difference between current and new, hence the "-1" */ - /* result_len = self_len + count * (to_len-1) */ - product = count * (to_len-1); - if (product / (to_len-1) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - next = findchar(start, end-start, from_c); - if (next == NULL) - break; - - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += 1; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+1; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - -/* len(self)>=1, len(from)>=2, len(to)>=2, maxcount>=1 */ -Py_LOCAL(PyStringObject *) -replace_substring(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) { - char *self_s, *result_s; - char *start, *next, *end; - Py_ssize_t self_len, result_len; - Py_ssize_t count, offset, product; - PyStringObject *result; - - self_s = PyString_AS_STRING(self); - self_len = PyString_GET_SIZE(self); - - count = stringlib_count(self_s, self_len, - from_s, from_len, - maxcount); - - if (count == 0) { - /* no matches, return unchanged */ - return return_self(self); - } - - /* Check for overflow */ - /* result_len = self_len + count * (to_len-from_len) */ - product = count * (to_len-from_len); - if (product / (to_len-from_len) != count) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - result_len = self_len + product; - if (result_len < 0) { - PyErr_SetString(PyExc_OverflowError, "replace string is too long"); - return NULL; - } - - if ( (result = (PyStringObject *) - PyString_FromStringAndSize(NULL, result_len)) == NULL) - return NULL; - result_s = PyString_AS_STRING(result); - - start = self_s; - end = self_s + self_len; - while (count-- > 0) { - offset = stringlib_find(start, end-start, - from_s, from_len, - 0); - if (offset == -1) - break; - next = start+offset; - if (next == start) { - /* replace with the 'to' */ - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start += from_len; - } else { - /* copy the unchanged old then the 'to' */ - Py_MEMCPY(result_s, start, next-start); - result_s += (next-start); - Py_MEMCPY(result_s, to_s, to_len); - result_s += to_len; - start = next+from_len; - } - } - /* Copy the remainder of the remaining string */ - Py_MEMCPY(result_s, start, end-start); - - return result; -} - - -Py_LOCAL(PyStringObject *) -replace(PyStringObject *self, - const char *from_s, Py_ssize_t from_len, - const char *to_s, Py_ssize_t to_len, - Py_ssize_t maxcount) -{ - if (maxcount < 0) { - maxcount = PY_SSIZE_T_MAX; - } else if (maxcount == 0 || PyString_GET_SIZE(self) == 0) { - /* nothing to do; return the original string */ - return return_self(self); - } - - if (maxcount == 0 || - (from_len == 0 && to_len == 0)) { - /* nothing to do; return the original string */ - return return_self(self); - } - - /* Handle zero-length special cases */ - - if (from_len == 0) { - /* insert the 'to' string everywhere. */ - /* >>> "Python".replace("", ".") */ - /* '.P.y.t.h.o.n.' */ - return replace_interleave(self, to_s, to_len, maxcount); - } - - /* Except for "".replace("", "A") == "A" there is no way beyond this */ - /* point for an empty self string to generate a non-empty string */ - /* Special case so the remaining code always gets a non-empty string */ - if (PyString_GET_SIZE(self) == 0) { - return return_self(self); - } - - if (to_len == 0) { - /* delete all occurances of 'from' string */ - if (from_len == 1) { - return replace_delete_single_character( - self, from_s[0], maxcount); - } else { - return replace_delete_substring(self, from_s, from_len, maxcount); - } - } - - /* Handle special case where both strings have the same length */ - - if (from_len == to_len) { - if (from_len == 1) { - return replace_single_character_in_place( - self, - from_s[0], - to_s[0], - maxcount); - } else { - return replace_substring_in_place( - self, from_s, from_len, to_s, to_len, maxcount); - } - } - - /* Otherwise use the more generic algorithms */ - if (from_len == 1) { - return replace_single_character(self, from_s[0], - to_s, to_len, maxcount); - } else { - /* len('from')>=2, len('to')>=1 */ - return replace_substring(self, from_s, from_len, to_s, to_len, maxcount); - } -} - -PyDoc_STRVAR(replace__doc__, -"S.replace(old, new[, count]) -> string\n\ -\n\ -Return a copy of string S with all occurrences of substring\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject * -string_replace(PyStringObject *self, PyObject *args) -{ - Py_ssize_t count = -1; - PyObject *from, *to; - const char *from_s, *to_s; - Py_ssize_t from_len, to_len; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &from, &to, &count)) - return NULL; - - if (PyString_Check(from)) { - from_s = PyString_AS_STRING(from); - from_len = PyString_GET_SIZE(from); - } -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(from)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(from, &from_s, &from_len)) - return NULL; - - if (PyString_Check(to)) { - to_s = PyString_AS_STRING(to); - to_len = PyString_GET_SIZE(to); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(to)) - return PyUnicode_Replace((PyObject *)self, - from, to, count); -#endif - else if (PyObject_AsCharBuffer(to, &to_s, &to_len)) - return NULL; - - return (PyObject *)replace((PyStringObject *) self, - from_s, from_len, - to_s, to_len, count); -} - -/** End DALKE **/ - -/* Matches the end (direction >= 0) or start (direction < 0) of self - * against substr, using the start and end arguments. Returns - * -1 on error, 0 if not found and 1 if found. - */ -Py_LOCAL(int) -_string_tailmatch(PyStringObject *self, PyObject *substr, Py_ssize_t start, - Py_ssize_t end, int direction) -{ - Py_ssize_t len = PyString_GET_SIZE(self); - Py_ssize_t slen; - const char* sub; - const char* str; - - if (PyString_Check(substr)) { - sub = PyString_AS_STRING(substr); - slen = PyString_GET_SIZE(substr); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(substr)) - return PyUnicode_Tailmatch((PyObject *)self, - substr, start, end, direction); -#endif - else if (PyObject_AsCharBuffer(substr, &sub, &slen)) - return -1; - str = PyString_AS_STRING(self); - - ADJUST_INDICES(start, end, len); - - if (direction < 0) { - /* startswith */ - if (start+slen > len) - return 0; - } else { - /* endswith */ - if (end-start < slen || start > len) - return 0; - - if (end-slen > start) - start = end - slen; - } - if (end-start >= slen) - return ! memcmp(str+start, sub, slen); - return 0; -} - - -PyDoc_STRVAR(startswith__doc__, -"S.startswith(prefix[, start[, end]]) -> bool\n\ -\n\ -Return True if S starts with the specified prefix, False otherwise.\n\ -With optional start, test S beginning at that position.\n\ -With optional end, stop comparing S at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -string_startswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end)) - return NULL; - if (PyTuple_Check(subobj)) { - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, -1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, -1); - if (result == -1) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, "startswith first arg must be str, " - "unicode, or tuple, not %s", Py_TYPE(subobj)->tp_name); - return NULL; - } - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(endswith__doc__, -"S.endswith(suffix[, start[, end]]) -> bool\n\ -\n\ -Return True if S ends with the specified suffix, False otherwise.\n\ -With optional start, test S beginning at that position.\n\ -With optional end, stop comparing S at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -string_endswith(PyStringObject *self, PyObject *args) -{ - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *subobj; - int result; - - if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end)) - return NULL; - if (PyTuple_Check(subobj)) { - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { - result = _string_tailmatch(self, - PyTuple_GET_ITEM(subobj, i), - start, end, +1); - if (result == -1) - return NULL; - else if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - result = _string_tailmatch(self, subobj, start, end, +1); - if (result == -1) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, "endswith first arg must be str, " - "unicode, or tuple, not %s", Py_TYPE(subobj)->tp_name); - return NULL; - } - else - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(encode__doc__, -"S.encode([encoding[,errors]]) -> object\n\ -\n\ -Encodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ -'xmlcharrefreplace' as well as any other name registered with\n\ -codecs.register_error that is able to handle UnicodeEncodeErrors."); - -static PyObject * -string_encode(PyStringObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = {"encoding", "errors", 0}; - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:encode", - kwlist, &encoding, &errors)) - return NULL; - v = PyString_AsEncodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(decode__doc__, -"S.decode([encoding[,errors]]) -> object\n\ -\n\ -Decodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registered with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -string_decode(PyStringObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = {"encoding", "errors", 0}; - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", - kwlist, &encoding, &errors)) - return NULL; - v = PyString_AsDecodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - - -PyDoc_STRVAR(expandtabs__doc__, -"S.expandtabs([tabsize]) -> string\n\ -\n\ -Return a copy of S where all tab characters are expanded using spaces.\n\ -If tabsize is not given, a tab size of 8 characters is assumed."); - -static PyObject* -string_expandtabs(PyStringObject *self, PyObject *args) -{ - const char *e, *p, *qe; - char *q; - Py_ssize_t i, j, incr; - PyObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = 0; /* chars up to and including most recent \n or \r */ - j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = PyString_AS_STRING(self) + PyString_GET_SIZE(self); /* end of input */ - for (p = PyString_AS_STRING(self); p < e; p++) { - if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - i += j; - j = 0; - } - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - - /* Second pass: create output string and fill it */ - u = PyString_FromStringAndSize(NULL, i + j); - if (!u) - return NULL; - - j = 0; /* same as in first pass */ - q = PyString_AS_STRING(u); /* next output char */ - qe = PyString_AS_STRING(u) + PyString_GET_SIZE(u); /* end of output */ - - for (p = PyString_AS_STRING(self); p < e; p++) { - if (*p == '\t') { - if (tabsize > 0) { - i = tabsize - (j % tabsize); - j += i; - while (i--) { - if (q >= qe) - goto overflow2; - *q++ = ' '; - } - } - } - else { - if (q >= qe) - goto overflow2; - *q++ = *p; - j++; - if (*p == '\n' || *p == '\r') - j = 0; - } - } - - return u; - - overflow2: - Py_DECREF(u); - overflow1: - PyErr_SetString(PyExc_OverflowError, "new string is too long"); - return NULL; -} - -Py_LOCAL_INLINE(PyObject *) -pad(PyStringObject *self, Py_ssize_t left, Py_ssize_t right, char fill) -{ - PyObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - - u = PyString_FromStringAndSize(NULL, - left + PyString_GET_SIZE(self) + right); - if (u) { - if (left) - memset(PyString_AS_STRING(u), fill, left); - Py_MEMCPY(PyString_AS_STRING(u) + left, - PyString_AS_STRING(self), - PyString_GET_SIZE(self)); - if (right) - memset(PyString_AS_STRING(u) + left + PyString_GET_SIZE(self), - fill, right); - } - - return u; -} - -PyDoc_STRVAR(ljust__doc__, -"S.ljust(width[, fillchar]) -> string\n" -"\n" -"Return S left-justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)."); - -static PyObject * -string_ljust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:ljust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, 0, width - PyString_GET_SIZE(self), fillchar); -} - - -PyDoc_STRVAR(rjust__doc__, -"S.rjust(width[, fillchar]) -> string\n" -"\n" -"Return S right-justified in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -string_rjust(PyStringObject *self, PyObject *args) -{ - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:rjust", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return pad(self, width - PyString_GET_SIZE(self), 0, fillchar); -} - - -PyDoc_STRVAR(center__doc__, -"S.center(width[, fillchar]) -> string\n" -"\n" -"Return S centered in a string of length width. Padding is\n" -"done using the specified fill character (default is a space)"); - -static PyObject * -string_center(PyStringObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - char fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|c:center", &width, &fillchar)) - return NULL; - - if (PyString_GET_SIZE(self) >= width && PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - marg = width - PyString_GET_SIZE(self); - left = marg / 2 + (marg & width & 1); - - return pad(self, left, marg - left, fillchar); -} - -PyDoc_STRVAR(zfill__doc__, -"S.zfill(width) -> string\n" -"\n" -"Pad a numeric string S with zeros on the left, to fill a field\n" -"of the specified width. The string S is never truncated."); - -static PyObject * -string_zfill(PyStringObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyObject *s; - char *p; - Py_ssize_t width; - - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (PyString_GET_SIZE(self) >= width) { - if (PyString_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - else - return PyString_FromStringAndSize( - PyString_AS_STRING(self), - PyString_GET_SIZE(self) - ); - } - - fill = width - PyString_GET_SIZE(self); - - s = pad(self, fill, 0, '0'); - - if (s == NULL) - return NULL; - - p = PyString_AS_STRING(s); - if (p[fill] == '+' || p[fill] == '-') { - /* move sign to beginning of string */ - p[0] = p[fill]; - p[fill] = '0'; - } - - return (PyObject*) s; -} - -PyDoc_STRVAR(isspace__doc__, -"S.isspace() -> bool\n\ -\n\ -Return True if all characters in S are whitespace\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -string_isspace(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isspace(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isspace(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalpha__doc__, -"S.isalpha() -> bool\n\ -\n\ -Return True if all characters in S are alphabetic\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -string_isalpha(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalpha(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalpha(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isalnum__doc__, -"S.isalnum() -> bool\n\ -\n\ -Return True if all characters in S are alphanumeric\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -string_isalnum(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isalnum(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isalnum(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(isdigit__doc__, -"S.isdigit() -> bool\n\ -\n\ -Return True if all characters in S are digits\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -string_isdigit(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1 && - isdigit(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - for (; p < e; p++) { - if (!isdigit(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - - -PyDoc_STRVAR(islower__doc__, -"S.islower() -> bool\n\ -\n\ -Return True if all cased characters in S are lowercase and there is\n\ -at least one cased character in S, False otherwise."); - -static PyObject* -string_islower(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(islower(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (isupper(*p)) - return PyBool_FromLong(0); - else if (!cased && islower(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(isupper__doc__, -"S.isupper() -> bool\n\ -\n\ -Return True if all cased characters in S are uppercase and there is\n\ -at least one cased character in S, False otherwise."); - -static PyObject* -string_isupper(PyStringObject *self) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - if (islower(*p)) - return PyBool_FromLong(0); - else if (!cased && isupper(*p)) - cased = 1; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(istitle__doc__, -"S.istitle() -> bool\n\ -\n\ -Return True if S is a titlecased string and there is at least one\n\ -character in S, i.e. uppercase characters may only follow uncased\n\ -characters and lowercase characters only cased ones. Return False\n\ -otherwise."); - -static PyObject* -string_istitle(PyStringObject *self, PyObject *uncased) -{ - register const unsigned char *p - = (unsigned char *) PyString_AS_STRING(self); - register const unsigned char *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (PyString_GET_SIZE(self) == 1) - return PyBool_FromLong(isupper(*p) != 0); - - /* Special case for empty strings */ - if (PyString_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyString_GET_SIZE(self); - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const unsigned char ch = *p; - - if (isupper(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (islower(ch)) { - if (!previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else - previous_is_cased = 0; - } - return PyBool_FromLong(cased); -} - - -PyDoc_STRVAR(splitlines__doc__, -"S.splitlines(keepends=False) -> list of strings\n\ -\n\ -Return a list of the lines in S, breaking at line boundaries.\n\ -Line breaks are not included in the resulting list unless keepends\n\ -is given and true."); - -static PyObject* -string_splitlines(PyStringObject *self, PyObject *args) -{ - int keepends = 0; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - return stringlib_splitlines( - (PyObject*) self, PyString_AS_STRING(self), PyString_GET_SIZE(self), - keepends - ); -} - -PyDoc_STRVAR(sizeof__doc__, -"S.__sizeof__() -> size of S in memory, in bytes"); - -static PyObject * -string_sizeof(PyStringObject *v) -{ - Py_ssize_t res; - res = PyStringObject_SIZE + PyString_GET_SIZE(v) * Py_TYPE(v)->tp_itemsize; - return PyInt_FromSsize_t(res); -} - -static PyObject * -string_getnewargs(PyStringObject *v) -{ - return Py_BuildValue("(s#)", v->ob_sval, Py_SIZE(v)); -} - - -#include "stringlib/string_format.h" - -PyDoc_STRVAR(format__doc__, -"S.format(*args, **kwargs) -> string\n\ -\n\ -Return a formatted version of S, using substitutions from args and kwargs.\n\ -The substitutions are identified by braces ('{' and '}')."); - -static PyObject * -string__format__(PyObject* self, PyObject* args) -{ - PyObject *format_spec; - PyObject *result = NULL; - PyObject *tmp = NULL; - - /* If 2.x, convert format_spec to the same type as value */ - /* This is to allow things like u''.format('') */ - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!(PyString_Check(format_spec) || PyUnicode_Check(format_spec))) { - PyErr_Format(PyExc_TypeError, "__format__ arg must be str " - "or unicode, not %s", Py_TYPE(format_spec)->tp_name); - goto done; - } - tmp = PyObject_Str(format_spec); - if (tmp == NULL) - goto done; - format_spec = tmp; - - result = _PyBytes_FormatAdvanced(self, - PyString_AS_STRING(format_spec), - PyString_GET_SIZE(format_spec)); -done: - Py_XDECREF(tmp); - return result; -} - -PyDoc_STRVAR(p_format__doc__, -"S.__format__(format_spec) -> string\n\ -\n\ -Return a formatted version of S as described by format_spec."); - - -static PyMethodDef -string_methods[] = { - /* Counterparts of the obsolete stropmodule functions; except - string.maketrans(). */ - {"join", (PyCFunction)string_join, METH_O, join__doc__}, - {"split", (PyCFunction)string_split, METH_VARARGS, split__doc__}, - {"rsplit", (PyCFunction)string_rsplit, METH_VARARGS, rsplit__doc__}, - {"lower", (PyCFunction)string_lower, METH_NOARGS, lower__doc__}, - {"upper", (PyCFunction)string_upper, METH_NOARGS, upper__doc__}, - {"islower", (PyCFunction)string_islower, METH_NOARGS, islower__doc__}, - {"isupper", (PyCFunction)string_isupper, METH_NOARGS, isupper__doc__}, - {"isspace", (PyCFunction)string_isspace, METH_NOARGS, isspace__doc__}, - {"isdigit", (PyCFunction)string_isdigit, METH_NOARGS, isdigit__doc__}, - {"istitle", (PyCFunction)string_istitle, METH_NOARGS, istitle__doc__}, - {"isalpha", (PyCFunction)string_isalpha, METH_NOARGS, isalpha__doc__}, - {"isalnum", (PyCFunction)string_isalnum, METH_NOARGS, isalnum__doc__}, - {"capitalize", (PyCFunction)string_capitalize, METH_NOARGS, - capitalize__doc__}, - {"count", (PyCFunction)string_count, METH_VARARGS, count__doc__}, - {"endswith", (PyCFunction)string_endswith, METH_VARARGS, - endswith__doc__}, - {"partition", (PyCFunction)string_partition, METH_O, partition__doc__}, - {"find", (PyCFunction)string_find, METH_VARARGS, find__doc__}, - {"index", (PyCFunction)string_index, METH_VARARGS, index__doc__}, - {"lstrip", (PyCFunction)string_lstrip, METH_VARARGS, lstrip__doc__}, - {"replace", (PyCFunction)string_replace, METH_VARARGS, replace__doc__}, - {"rfind", (PyCFunction)string_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction)string_rindex, METH_VARARGS, rindex__doc__}, - {"rstrip", (PyCFunction)string_rstrip, METH_VARARGS, rstrip__doc__}, - {"rpartition", (PyCFunction)string_rpartition, METH_O, - rpartition__doc__}, - {"startswith", (PyCFunction)string_startswith, METH_VARARGS, - startswith__doc__}, - {"strip", (PyCFunction)string_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction)string_swapcase, METH_NOARGS, - swapcase__doc__}, - {"translate", (PyCFunction)string_translate, METH_VARARGS, - translate__doc__}, - {"title", (PyCFunction)string_title, METH_NOARGS, title__doc__}, - {"ljust", (PyCFunction)string_ljust, METH_VARARGS, ljust__doc__}, - {"rjust", (PyCFunction)string_rjust, METH_VARARGS, rjust__doc__}, - {"center", (PyCFunction)string_center, METH_VARARGS, center__doc__}, - {"zfill", (PyCFunction)string_zfill, METH_VARARGS, zfill__doc__}, - {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, - {"__format__", (PyCFunction) string__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, - {"encode", (PyCFunction)string_encode, METH_VARARGS | METH_KEYWORDS, encode__doc__}, - {"decode", (PyCFunction)string_decode, METH_VARARGS | METH_KEYWORDS, decode__doc__}, - {"expandtabs", (PyCFunction)string_expandtabs, METH_VARARGS, - expandtabs__doc__}, - {"splitlines", (PyCFunction)string_splitlines, METH_VARARGS, - splitlines__doc__}, - {"__sizeof__", (PyCFunction)string_sizeof, METH_NOARGS, - sizeof__doc__}, - {"__getnewargs__", (PyCFunction)string_getnewargs, METH_NOARGS}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -string_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - static char *kwlist[] = {"object", 0}; - - if (type != &PyString_Type) - return str_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:str", kwlist, &x)) - return NULL; - if (x == NULL) - return PyString_FromString(""); - return PyObject_Str(x); -} - -static PyObject * -str_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *pnew; - Py_ssize_t n; - - assert(PyType_IsSubtype(type, &PyString_Type)); - tmp = string_new(&PyString_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyString_CheckExact(tmp)); - n = PyString_GET_SIZE(tmp); - pnew = type->tp_alloc(type, n); - if (pnew != NULL) { - Py_MEMCPY(PyString_AS_STRING(pnew), PyString_AS_STRING(tmp), n+1); - ((PyStringObject *)pnew)->ob_shash = - ((PyStringObject *)tmp)->ob_shash; - ((PyStringObject *)pnew)->ob_sstate = SSTATE_NOT_INTERNED; - } - Py_DECREF(tmp); - return pnew; -} - -static PyObject * -basestring_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyErr_SetString(PyExc_TypeError, - "The basestring type cannot be instantiated"); - return NULL; -} - -static PyObject * -string_mod(PyObject *v, PyObject *w) -{ - if (!PyString_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyString_Format(v, w); -} - -PyDoc_STRVAR(basestring_doc, -"Type basestring cannot be instantiated; it is the base for str and unicode."); - -static PyNumberMethods string_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - string_mod, /*nb_remainder*/ -}; - - -PyTypeObject PyBaseString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "basestring", - 0, - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - basestring_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseObject_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - basestring_new, /* tp_new */ - 0, /* tp_free */ -}; - -PyDoc_STRVAR(string_doc, -"str(object='') -> string\n\ -\n\ -Return a nice string representation of the object.\n\ -If the argument is a string, the return value is the same object."); - -PyTypeObject PyString_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "str", - PyStringObject_SIZE, - sizeof(char), - string_dealloc, /* tp_dealloc */ - (printfunc)string_print, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - string_repr, /* tp_repr */ - &string_as_number, /* tp_as_number */ - &string_as_sequence, /* tp_as_sequence */ - &string_as_mapping, /* tp_as_mapping */ - (hashfunc)string_hash, /* tp_hash */ - 0, /* tp_call */ - string_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &string_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_STRING_SUBCLASS | - Py_TPFLAGS_HAVE_NEWBUFFER, /* tp_flags */ - string_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)string_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - string_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseString_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - string_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -void -PyString_Concat(register PyObject **pv, register PyObject *w) -{ - register PyObject *v; - if (*pv == NULL) - return; - if (w == NULL || !PyString_Check(*pv)) { - Py_CLEAR(*pv); - return; - } - v = string_concat((PyStringObject *) *pv, w); - Py_DECREF(*pv); - *pv = v; -} - -void -PyString_ConcatAndDel(register PyObject **pv, register PyObject *w) -{ - PyString_Concat(pv, w); - Py_XDECREF(w); -} - - -/* The following function breaks the notion that strings are immutable: - it changes the size of a string. We get away with this only if there - is only one module referencing the object. You can also think of it - as creating a new string object and destroying the old one, only - more efficiently. In any case, don't use this if the string may - already be known to some other part of the code... - Note that if there's not enough memory to resize the string, the original - string object at *pv is deallocated, *pv is set to NULL, an "out of - memory" exception is set, and -1 is returned. Else (on success) 0 is - returned, and the value in *pv may or may not be the same as on input. - As always, an extra byte is allocated for a trailing \0 byte (newsize - does *not* include that), and a trailing \0 byte is stored. -*/ - -int -_PyString_Resize(PyObject **pv, Py_ssize_t newsize) -{ - register PyObject *v; - register PyStringObject *sv; - v = *pv; - if (!PyString_Check(v) || Py_REFCNT(v) != 1 || newsize < 0 || - PyString_CHECK_INTERNED(v)) { - *pv = 0; - Py_DECREF(v); - PyErr_BadInternalCall(); - return -1; - } - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - _Py_ForgetReference(v); - *pv = (PyObject *) - PyObject_REALLOC((char *)v, PyStringObject_SIZE + newsize); - if (*pv == NULL) { - PyObject_Del(v); - PyErr_NoMemory(); - return -1; - } - _Py_NewReference(*pv); - sv = (PyStringObject *) *pv; - Py_SIZE(sv) = newsize; - sv->ob_sval[newsize] = '\0'; - sv->ob_shash = -1; /* invalidate cached hash value */ - return 0; -} - -/* Helpers for formatstring */ - -Py_LOCAL_INLINE(PyObject *) -getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) -{ - Py_ssize_t argidx = *p_argidx; - if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); - } - PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); - return NULL; -} - -/* Format codes - * F_LJUST '-' - * F_SIGN '+' - * F_BLANK ' ' - * F_ALT '#' - * F_ZERO '0' - */ -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - -/* Returns a new reference to a PyString object, or NULL on failure. */ - -static PyObject * -formatfloat(PyObject *v, int flags, int prec, int type) -{ - char *p; - PyObject *result; - double x; - - x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "float argument required, " - "not %.200s", Py_TYPE(v)->tp_name); - return NULL; - } - - if (prec < 0) - prec = 6; - - p = PyOS_double_to_string(x, type, prec, - (flags & F_ALT) ? Py_DTSF_ALT : 0, NULL); - - if (p == NULL) - return NULL; - result = PyString_FromStringAndSize(p, strlen(p)); - PyMem_Free(p); - return result; -} - -/* _PyString_FormatLong emulates the format codes d, u, o, x and X, and - * the F_ALT flag, for Python's long (unbounded) ints. It's not used for - * Python's regular ints. - * Return value: a new PyString*, or NULL if error. - * . *pbuf is set to point into it, - * *plen set to the # of chars following that. - * Caller must decref it when done using pbuf. - * The string starting at *pbuf is of the form - * "-"? ("0x" | "0X")? digit+ - * "0x"/"0X" are present only for x and X conversions, with F_ALT - * set in flags. The case of hex digits will be correct, - * There will be at least prec digits, zero-filled on the left if - * necessary to get that many. - * val object to be converted - * flags bitmask of format flags; only F_ALT is looked at - * prec minimum number of digits; 0-fill on left if needed - * type a character in [duoxX]; u acts the same as d - * - * CAUTION: o, x and X conversions on regular ints can never - * produce a '-' sign, but can for Python's unbounded ints. - */ -PyObject* -_PyString_FormatLong(PyObject *val, int flags, int prec, int type, - char **pbuf, int *plen) -{ - PyObject *result = NULL; - char *buf; - Py_ssize_t i; - int sign; /* 1 if '-', else 0 */ - int len; /* number of characters */ - Py_ssize_t llen; - int numdigits; /* len == numnondigits + numdigits */ - int numnondigits = 0; - - switch (type) { - case 'd': - case 'u': - result = Py_TYPE(val)->tp_str(val); - break; - case 'o': - result = Py_TYPE(val)->tp_as_number->nb_oct(val); - break; - case 'x': - case 'X': - numnondigits = 2; - result = Py_TYPE(val)->tp_as_number->nb_hex(val); - break; - default: - assert(!"'type' not in [duoxX]"); - } - if (!result) - return NULL; - - buf = PyString_AsString(result); - if (!buf) { - Py_DECREF(result); - return NULL; - } - - /* To modify the string in-place, there can only be one reference. */ - if (Py_REFCNT(result) != 1) { - PyErr_BadInternalCall(); - return NULL; - } - llen = PyString_Size(result); - if (llen > INT_MAX) { - PyErr_SetString(PyExc_ValueError, "string too large in _PyString_FormatLong"); - return NULL; - } - len = (int)llen; - if (buf[len-1] == 'L') { - --len; - buf[len] = '\0'; - } - sign = buf[0] == '-'; - numnondigits += sign; - numdigits = len - numnondigits; - assert(numdigits > 0); - - /* Get rid of base marker unless F_ALT */ - if ((flags & F_ALT) == 0) { - /* Need to skip 0x, 0X or 0. */ - int skipped = 0; - switch (type) { - case 'o': - assert(buf[sign] == '0'); - /* If 0 is only digit, leave it alone. */ - if (numdigits > 1) { - skipped = 1; - --numdigits; - } - break; - case 'x': - case 'X': - assert(buf[sign] == '0'); - assert(buf[sign + 1] == 'x'); - skipped = 2; - numnondigits -= 2; - break; - } - if (skipped) { - buf += skipped; - len -= skipped; - if (sign) - buf[0] = '-'; - } - assert(len == numnondigits + numdigits); - assert(numdigits > 0); - } - - /* Fill with leading zeroes to meet minimum width. */ - if (prec > numdigits) { - PyObject *r1 = PyString_FromStringAndSize(NULL, - numnondigits + prec); - char *b1; - if (!r1) { - Py_DECREF(result); - return NULL; - } - b1 = PyString_AS_STRING(r1); - for (i = 0; i < numnondigits; ++i) - *b1++ = *buf++; - for (i = 0; i < prec - numdigits; i++) - *b1++ = '0'; - for (i = 0; i < numdigits; i++) - *b1++ = *buf++; - *b1 = '\0'; - Py_DECREF(result); - result = r1; - buf = PyString_AS_STRING(result); - len = numnondigits + prec; - } - - /* Fix up case for hex conversions. */ - if (type == 'X') { - /* Need to convert all lower case letters to upper case. - and need to convert 0x to 0X (and -0x to -0X). */ - for (i = 0; i < len; i++) - if (buf[i] >= 'a' && buf[i] <= 'x') - buf[i] -= 'a'-'A'; - } - *pbuf = buf; - *plen = len; - return result; -} - -Py_LOCAL_INLINE(int) -formatint(char *buf, size_t buflen, int flags, - int prec, int type, PyObject *v) -{ - /* fmt = '%#.' + `prec` + 'l' + `type` - worst case length = 3 + 19 (worst len of INT_MAX on 64-bit machine) - + 1 + 1 = 24 */ - char fmt[64]; /* plenty big enough! */ - char *sign; - long x; - - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) { - PyErr_Format(PyExc_TypeError, "int argument required, not %.200s", - Py_TYPE(v)->tp_name); - return -1; - } - if (x < 0 && type == 'u') { - type = 'd'; - } - if (x < 0 && (type == 'x' || type == 'X' || type == 'o')) - sign = "-"; - else - sign = ""; - if (prec < 0) - prec = 1; - - if ((flags & F_ALT) && - (type == 'x' || type == 'X')) { - /* When converting under %#x or %#X, there are a number - * of issues that cause pain: - * - when 0 is being converted, the C standard leaves off - * the '0x' or '0X', which is inconsistent with other - * %#x/%#X conversions and inconsistent with Python's - * hex() function - * - there are platforms that violate the standard and - * convert 0 with the '0x' or '0X' - * (Metrowerks, Compaq Tru64) - * - there are platforms that give '0x' when converting - * under %#X, but convert 0 in accordance with the - * standard (OS/2 EMX) - * - * We can achieve the desired consistency by inserting our - * own '0x' or '0X' prefix, and substituting %x/%X in place - * of %#x/%#X. - * - * Note that this is the same approach as used in - * formatint() in unicodeobject.c - */ - PyOS_snprintf(fmt, sizeof(fmt), "%s0%c%%.%dl%c", - sign, type, prec, type); - } - else { - PyOS_snprintf(fmt, sizeof(fmt), "%s%%%s.%dl%c", - sign, (flags&F_ALT) ? "#" : "", - prec, type); - } - - /* buf = '+'/'-'/'' + '0'/'0x'/'' + '[0-9]'*max(prec, len(x in octal)) - * worst case buf = '-0x' + [0-9]*prec, where prec >= 11 - */ - if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { - PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); - return -1; - } - if (sign[0]) - PyOS_snprintf(buf, buflen, fmt, -x); - else - PyOS_snprintf(buf, buflen, fmt, x); - return (int)strlen(buf); -} - -Py_LOCAL_INLINE(int) -formatchar(char *buf, size_t buflen, PyObject *v) -{ - /* presume that the buffer is at least 2 characters long */ - if (PyString_Check(v)) { - if (!PyArg_Parse(v, "c;%c requires int or char", &buf[0])) - return -1; - } - else { - if (!PyArg_Parse(v, "b;%c requires int or char", &buf[0])) - return -1; - } - buf[1] = '\0'; - return 1; -} - -/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) - - FORMATBUFLEN is the length of the buffer in which the ints & - chars are formatted. XXX This is a magic number. Each formatting - routine does bounds checking to ensure no overflow, but a better - solution may be to malloc a buffer of appropriate size for each - format. For now, the current solution is sufficient. -*/ -#define FORMATBUFLEN (size_t)120 - -PyObject * -PyString_Format(PyObject *format, PyObject *args) -{ - char *fmt, *res; - Py_ssize_t arglen, argidx; - Py_ssize_t reslen, rescnt, fmtcnt; - int args_owned = 0; - PyObject *result, *orig_args; -#ifdef Py_USING_UNICODE - PyObject *v, *w; -#endif - PyObject *dict = NULL; - if (format == NULL || !PyString_Check(format) || args == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - orig_args = args; - fmt = PyString_AS_STRING(format); - fmtcnt = PyString_GET_SIZE(format); - reslen = rescnt = fmtcnt + 100; - result = PyString_FromStringAndSize((char *)NULL, reslen); - if (result == NULL) - return NULL; - res = PyString_AsString(result); - if (PyTuple_Check(args)) { - arglen = PyTuple_GET_SIZE(args); - argidx = 0; - } - else { - arglen = -1; - argidx = -2; - } - if (Py_TYPE(args)->tp_as_mapping && Py_TYPE(args)->tp_as_mapping->mp_subscript && - !PyTuple_Check(args) && !PyObject_TypeCheck(args, &PyBaseString_Type)) - dict = args; - while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyString_Resize(&result, reslen)) - return NULL; - res = PyString_AS_STRING(result) - + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - int c = '\0'; - int fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - char *pbuf; - int sign; - Py_ssize_t len; - char formatbuf[FORMATBUFLEN]; - /* For format{int,char}() */ -#ifdef Py_USING_UNICODE - char *fmt_start = fmt; - Py_ssize_t argidx_start = argidx; -#endif - - fmt++; - if (*fmt == '(') { - char *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto error; - } - ++fmt; - --fmtcnt; - keystart = fmt; - /* Skip over balanced parentheses */ - while (pcount > 0 && --fmtcnt >= 0) { - if (*fmt == ')') - --pcount; - else if (*fmt == '(') - ++pcount; - fmt++; - } - keylen = fmt - keystart - 1; - if (fmtcnt < 0 || pcount > 0) { - PyErr_SetString(PyExc_ValueError, - "incomplete format key"); - goto error; - } - key = PyString_FromStringAndSize(keystart, - keylen); - if (key == NULL) - goto error; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto error; - } - args_owned = 1; - arglen = -1; - argidx = -2; - } - while (--fmtcnt >= 0) { - switch (c = *fmt++) { - case '-': flags |= F_LJUST; continue; - case '+': flags |= F_SIGN; continue; - case ' ': flags |= F_BLANK; continue; - case '#': flags |= F_ALT; continue; - case '0': flags |= F_ZERO; continue; - } - break; - } - if (c == '*') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto error; - } - width = PyInt_AsSsize_t(v); - if (width == -1 && PyErr_Occurred()) - goto error; - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - width = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if (width > (PY_SSIZE_T_MAX - ((int)c - '0')) / 10) { - PyErr_SetString( - PyExc_ValueError, - "width too big"); - goto error; - } - width = width*10 + (c - '0'); - } - } - if (c == '.') { - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - if (c == '*') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - if (!PyInt_Check(v)) { - PyErr_SetString( - PyExc_TypeError, - "* wants int"); - goto error; - } - prec = _PyInt_AsInt(v); - if (prec == -1 && PyErr_Occurred()) - goto error; - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= 0 && isdigit(c)) { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = Py_CHARMASK(*fmt++); - if (!isdigit(c)) - break; - if (prec > (INT_MAX - ((int)c - '0')) / 10) { - PyErr_SetString( - PyExc_ValueError, - "prec too big"); - goto error; - } - prec = prec*10 + (c - '0'); - } - } - } /* prec */ - if (fmtcnt >= 0) { - if (c == 'h' || c == 'l' || c == 'L') { - if (--fmtcnt >= 0) - c = *fmt++; - } - } - if (fmtcnt < 0) { - PyErr_SetString(PyExc_ValueError, - "incomplete format"); - goto error; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto error; - } - sign = 0; - fill = ' '; - switch (c) { - case '%': - pbuf = "%"; - len = 1; - break; - case 's': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - temp = _PyObject_Str(v); -#ifdef Py_USING_UNICODE - if (temp != NULL && PyUnicode_Check(temp)) { - Py_DECREF(temp); - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - /* Fall through */ - case 'r': - if (c == 'r') - temp = PyObject_Repr(v); - if (temp == NULL) - goto error; - if (!PyString_Check(temp)) { - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - Py_DECREF(temp); - goto error; - } - pbuf = PyString_AS_STRING(temp); - len = PyString_GET_SIZE(temp); - if (prec >= 0 && len > prec) - len = prec; - break; - case 'i': - case 'd': - case 'u': - case 'o': - case 'x': - case 'X': - if (c == 'i') - c = 'd'; - isnumok = 0; - if (PyNumber_Check(v)) { - PyObject *iobj=NULL; - - if (PyInt_Check(v) || (PyLong_Check(v))) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Int(v); - if (iobj==NULL) { - PyErr_Clear(); - iobj = PyNumber_Long(v); - } - } - if (iobj!=NULL) { - if (PyInt_Check(iobj)) { - isnumok = 1; - pbuf = formatbuf; - len = formatint(pbuf, - sizeof(formatbuf), - flags, prec, c, iobj); - Py_DECREF(iobj); - if (len < 0) - goto error; - sign = 1; - } - else if (PyLong_Check(iobj)) { - int ilen; - - isnumok = 1; - temp = _PyString_FormatLong(iobj, flags, - prec, c, &pbuf, &ilen); - Py_DECREF(iobj); - len = ilen; - if (!temp) - goto error; - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", c, Py_TYPE(v)->tp_name); - goto error; - } - if (flags & F_ZERO) - fill = '0'; - break; - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - temp = formatfloat(v, flags, prec, c); - if (temp == NULL) - goto error; - pbuf = PyString_AS_STRING(temp); - len = PyString_GET_SIZE(temp); - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - case 'c': -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - fmt = fmt_start; - argidx = argidx_start; - goto unicode; - } -#endif - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf), v); - if (len < 0) - goto error; - break; - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - c, c, - (Py_ssize_t)(fmt - 1 - - PyString_AsString(format))); - goto error; - } - if (sign) { - if (*pbuf == '-' || *pbuf == '+') { - sign = *pbuf++; - len--; - } - else if (flags & F_SIGN) - sign = '+'; - else if (flags & F_BLANK) - sign = ' '; - else - sign = 0; - } - if (width < len) - width = len; - if (rescnt - (sign != 0) < width) { - reslen -= rescnt; - rescnt = width + fmtcnt + 100; - reslen += rescnt; - if (reslen < 0) { - Py_DECREF(result); - Py_XDECREF(temp); - return PyErr_NoMemory(); - } - if (_PyString_Resize(&result, reslen)) { - Py_XDECREF(temp); - return NULL; - } - res = PyString_AS_STRING(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - if (fill != ' ') { - *res++ = *pbuf++; - *res++ = *pbuf++; - } - rescnt -= 2; - width -= 2; - if (width < 0) - width = 0; - len -= 2; - } - if (width > len && !(flags & F_LJUST)) { - do { - --rescnt; - *res++ = fill; - } while (--width > len); - } - if (fill == ' ') { - if (sign) - *res++ = sign; - if ((flags & F_ALT) && - (c == 'x' || c == 'X')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_MEMCPY(res, pbuf, len); - res += len; - rescnt -= len; - while (--width >= len) { - --rescnt; - *res++ = ' '; - } - if (dict && (argidx < arglen) && c != '%') { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - Py_XDECREF(temp); - goto error; - } - Py_XDECREF(temp); - } /* '%' */ - } /* until end */ - if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto error; - } - if (args_owned) { - Py_DECREF(args); - } - if (_PyString_Resize(&result, reslen - rescnt)) - return NULL; - return result; - -#ifdef Py_USING_UNICODE - unicode: - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - /* Fiddle args right (remove the first argidx arguments) */ - if (PyTuple_Check(orig_args) && argidx > 0) { - PyObject *v; - Py_ssize_t n = PyTuple_GET_SIZE(orig_args) - argidx; - v = PyTuple_New(n); - if (v == NULL) - goto error; - while (--n >= 0) { - PyObject *w = PyTuple_GET_ITEM(orig_args, n + argidx); - Py_INCREF(w); - PyTuple_SET_ITEM(v, n, w); - } - args = v; - } else { - Py_INCREF(orig_args); - args = orig_args; - } - args_owned = 1; - /* Take what we have of the result and let the Unicode formatting - function format the rest of the input. */ - rescnt = res - PyString_AS_STRING(result); - if (_PyString_Resize(&result, rescnt)) - goto error; - fmtcnt = PyString_GET_SIZE(format) - \ - (fmt - PyString_AS_STRING(format)); - format = PyUnicode_Decode(fmt, fmtcnt, NULL, NULL); - if (format == NULL) - goto error; - v = PyUnicode_Format(format, args); - Py_DECREF(format); - if (v == NULL) - goto error; - /* Paste what we have (result) to what the Unicode formatting - function returned (v) and return the result (or error) */ - w = PyUnicode_Concat(result, v); - Py_DECREF(result); - Py_DECREF(v); - Py_DECREF(args); - return w; -#endif /* Py_USING_UNICODE */ - - error: - Py_DECREF(result); - if (args_owned) { - Py_DECREF(args); - } - return NULL; -} - -void -PyString_InternInPlace(PyObject **p) -{ - register PyStringObject *s = (PyStringObject *)(*p); - PyObject *t; - if (s == NULL || !PyString_Check(s)) - Py_FatalError("PyString_InternInPlace: strings only please!"); - /* If it's a string subclass, we don't really know what putting - it in the interned dict might do. */ - if (!PyString_CheckExact(s)) - return; - if (PyString_CHECK_INTERNED(s)) - return; - if (interned == NULL) { - interned = PyDict_New(); - if (interned == NULL) { - PyErr_Clear(); /* Don't leave an exception */ - return; - } - } - t = PyDict_GetItem(interned, (PyObject *)s); - if (t) { - Py_INCREF(t); - Py_DECREF(*p); - *p = t; - return; - } - - if (PyDict_SetItem(interned, (PyObject *)s, (PyObject *)s) < 0) { - PyErr_Clear(); - return; - } - /* The two references in interned are not counted by refcnt. - The string deallocator will take care of this */ - Py_REFCNT(s) -= 2; - PyString_CHECK_INTERNED(s) = SSTATE_INTERNED_MORTAL; -} - -void -PyString_InternImmortal(PyObject **p) -{ - PyString_InternInPlace(p); - if (PyString_CHECK_INTERNED(*p) != SSTATE_INTERNED_IMMORTAL) { - PyString_CHECK_INTERNED(*p) = SSTATE_INTERNED_IMMORTAL; - Py_INCREF(*p); - } -} - - -PyObject * -PyString_InternFromString(const char *cp) -{ - PyObject *s = PyString_FromString(cp); - if (s == NULL) - return NULL; - PyString_InternInPlace(&s); - return s; -} - -void -PyString_Fini(void) -{ - int i; - for (i = 0; i < UCHAR_MAX + 1; i++) - Py_CLEAR(characters[i]); - Py_CLEAR(nullstring); -} - -void _Py_ReleaseInternedStrings(void) -{ - PyObject *keys; - PyStringObject *s; - Py_ssize_t i, n; - Py_ssize_t immortal_size = 0, mortal_size = 0; - - if (interned == NULL || !PyDict_Check(interned)) - return; - keys = PyDict_Keys(interned); - if (keys == NULL || !PyList_Check(keys)) { - PyErr_Clear(); - return; - } - - /* Since _Py_ReleaseInternedStrings() is intended to help a leak - detector, interned strings are not forcibly deallocated; rather, we - give them their stolen references back, and then clear and DECREF - the interned dict. */ - - n = PyList_GET_SIZE(keys); - fprintf(stderr, "releasing %" PY_FORMAT_SIZE_T "d interned strings\n", - n); - for (i = 0; i < n; i++) { - s = (PyStringObject *) PyList_GET_ITEM(keys, i); - switch (s->ob_sstate) { - case SSTATE_NOT_INTERNED: - /* XXX Shouldn't happen */ - break; - case SSTATE_INTERNED_IMMORTAL: - Py_REFCNT(s) += 1; - immortal_size += Py_SIZE(s); - break; - case SSTATE_INTERNED_MORTAL: - Py_REFCNT(s) += 2; - mortal_size += Py_SIZE(s); - break; - default: - Py_FatalError("Inconsistent interned string state."); - } - s->ob_sstate = SSTATE_NOT_INTERNED; - } - fprintf(stderr, "total size of all interned strings: " - "%" PY_FORMAT_SIZE_T "d/%" PY_FORMAT_SIZE_T "d " - "mortal/immortal\n", mortal_size, immortal_size); - Py_DECREF(keys); - PyDict_Clear(interned); - Py_CLEAR(interned); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/structseq.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/structseq.c deleted file mode 100644 index 6dc4312..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/structseq.c +++ /dev/null @@ -1,540 +0,0 @@ -/* Implementation helper: a struct that looks like a tuple. See timemodule - and posixmodule for example uses. */ - -#include "Python.h" -#include "structmember.h" -#include "structseq.h" - -static char visible_length_key[] = "n_sequence_fields"; -static char real_length_key[] = "n_fields"; -static char unnamed_fields_key[] = "n_unnamed_fields"; - -/* Fields with this name have only a field index, not a field name. - They are only allowed for indices < n_visible_fields. */ -char *PyStructSequence_UnnamedField = "unnamed field"; - -#define VISIBLE_SIZE(op) Py_SIZE(op) -#define VISIBLE_SIZE_TP(tp) PyInt_AsLong( \ - PyDict_GetItemString((tp)->tp_dict, visible_length_key)) - -#define REAL_SIZE_TP(tp) PyInt_AsLong( \ - PyDict_GetItemString((tp)->tp_dict, real_length_key)) -#define REAL_SIZE(op) REAL_SIZE_TP(Py_TYPE(op)) - -#define UNNAMED_FIELDS_TP(tp) PyInt_AsLong( \ - PyDict_GetItemString((tp)->tp_dict, unnamed_fields_key)) -#define UNNAMED_FIELDS(op) UNNAMED_FIELDS_TP(Py_TYPE(op)) - - -PyObject * -PyStructSequence_New(PyTypeObject *type) -{ - PyStructSequence *obj; - - obj = PyObject_New(PyStructSequence, type); - if (obj == NULL) - return NULL; - Py_SIZE(obj) = VISIBLE_SIZE_TP(type); - - return (PyObject*) obj; -} - -static void -structseq_dealloc(PyStructSequence *obj) -{ - Py_ssize_t i, size; - - size = REAL_SIZE(obj); - for (i = 0; i < size; ++i) { - Py_XDECREF(obj->ob_item[i]); - } - PyObject_Del(obj); -} - -static Py_ssize_t -structseq_length(PyStructSequence *obj) -{ - return VISIBLE_SIZE(obj); -} - -static PyObject* -structseq_item(PyStructSequence *obj, Py_ssize_t i) -{ - if (i < 0 || i >= VISIBLE_SIZE(obj)) { - PyErr_SetString(PyExc_IndexError, "tuple index out of range"); - return NULL; - } - Py_INCREF(obj->ob_item[i]); - return obj->ob_item[i]; -} - -static PyObject* -structseq_slice(PyStructSequence *obj, Py_ssize_t low, Py_ssize_t high) -{ - PyTupleObject *np; - Py_ssize_t i; - - if (low < 0) - low = 0; - if (high > VISIBLE_SIZE(obj)) - high = VISIBLE_SIZE(obj); - if (high < low) - high = low; - np = (PyTupleObject *)PyTuple_New(high-low); - if (np == NULL) - return NULL; - for(i = low; i < high; ++i) { - PyObject *v = obj->ob_item[i]; - Py_INCREF(v); - PyTuple_SET_ITEM(np, i-low, v); - } - return (PyObject *) np; -} - -static PyObject * -structseq_subscript(PyStructSequence *self, PyObject *item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - - if (i < 0) - i += VISIBLE_SIZE(self); - - if (i < 0 || i >= VISIBLE_SIZE(self)) { - PyErr_SetString(PyExc_IndexError, - "tuple index out of range"); - return NULL; - } - Py_INCREF(self->ob_item[i]); - return self->ob_item[i]; - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelen, cur, i; - PyObject *result; - - if (PySlice_GetIndicesEx((PySliceObject *)item, - VISIBLE_SIZE(self), &start, &stop, - &step, &slicelen) < 0) { - return NULL; - } - if (slicelen <= 0) - return PyTuple_New(0); - result = PyTuple_New(slicelen); - if (result == NULL) - return NULL; - for (cur = start, i = 0; i < slicelen; - cur += step, i++) { - PyObject *v = self->ob_item[cur]; - Py_INCREF(v); - PyTuple_SET_ITEM(result, i, v); - } - return result; - } - else { - PyErr_SetString(PyExc_TypeError, - "structseq index must be integer"); - return NULL; - } -} - -static PyObject * -structseq_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *arg = NULL; - PyObject *dict = NULL; - PyObject *ob; - PyStructSequence *res = NULL; - Py_ssize_t len, min_len, max_len, i, n_unnamed_fields; - static char *kwlist[] = {"sequence", "dict", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:structseq", - kwlist, &arg, &dict)) - return NULL; - - arg = PySequence_Fast(arg, "constructor requires a sequence"); - - if (!arg) { - return NULL; - } - - if (dict && !PyDict_Check(dict)) { - PyErr_Format(PyExc_TypeError, - "%.500s() takes a dict as second arg, if any", - type->tp_name); - Py_DECREF(arg); - return NULL; - } - - len = PySequence_Fast_GET_SIZE(arg); - min_len = VISIBLE_SIZE_TP(type); - max_len = REAL_SIZE_TP(type); - n_unnamed_fields = UNNAMED_FIELDS_TP(type); - - if (min_len != max_len) { - if (len < min_len) { - PyErr_Format(PyExc_TypeError, - "%.500s() takes an at least %zd-sequence (%zd-sequence given)", - type->tp_name, min_len, len); - Py_DECREF(arg); - return NULL; - } - - if (len > max_len) { - PyErr_Format(PyExc_TypeError, - "%.500s() takes an at most %zd-sequence (%zd-sequence given)", - type->tp_name, max_len, len); - Py_DECREF(arg); - return NULL; - } - } - else { - if (len != min_len) { - PyErr_Format(PyExc_TypeError, - "%.500s() takes a %zd-sequence (%zd-sequence given)", - type->tp_name, min_len, len); - Py_DECREF(arg); - return NULL; - } - } - - res = (PyStructSequence*) PyStructSequence_New(type); - if (res == NULL) { - Py_DECREF(arg); - return NULL; - } - for (i = 0; i < len; ++i) { - PyObject *v = PySequence_Fast_GET_ITEM(arg, i); - Py_INCREF(v); - res->ob_item[i] = v; - } - for (; i < max_len; ++i) { - if (dict && (ob = PyDict_GetItemString( - dict, type->tp_members[i-n_unnamed_fields].name))) { - } - else { - ob = Py_None; - } - Py_INCREF(ob); - res->ob_item[i] = ob; - } - - Py_DECREF(arg); - return (PyObject*) res; -} - -static PyObject * -make_tuple(PyStructSequence *obj) -{ - return structseq_slice(obj, 0, VISIBLE_SIZE(obj)); -} - -static PyObject * -structseq_repr(PyStructSequence *obj) -{ - /* buffer and type size were chosen well considered. */ -#define REPR_BUFFER_SIZE 512 -#define TYPE_MAXSIZE 100 - - PyObject *tup; - PyTypeObject *typ = Py_TYPE(obj); - int i, removelast = 0; - Py_ssize_t len; - char buf[REPR_BUFFER_SIZE]; - char *endofbuf, *pbuf = buf; - - /* pointer to end of writeable buffer; safes space for "...)\0" */ - endofbuf= &buf[REPR_BUFFER_SIZE-5]; - - if ((tup = make_tuple(obj)) == NULL) { - return NULL; - } - - /* "typename(", limited to TYPE_MAXSIZE */ - len = strlen(typ->tp_name) > TYPE_MAXSIZE ? TYPE_MAXSIZE : - strlen(typ->tp_name); - strncpy(pbuf, typ->tp_name, len); - pbuf += len; - *pbuf++ = '('; - - for (i=0; i < VISIBLE_SIZE(obj); i++) { - PyObject *val, *repr; - char *cname, *crepr; - - cname = typ->tp_members[i].name; - - val = PyTuple_GetItem(tup, i); - if (cname == NULL || val == NULL) { - return NULL; - } - repr = PyObject_Repr(val); - if (repr == NULL) { - Py_DECREF(tup); - return NULL; - } - crepr = PyString_AsString(repr); - if (crepr == NULL) { - Py_DECREF(tup); - Py_DECREF(repr); - return NULL; - } - - /* + 3: keep space for "=" and ", " */ - len = strlen(cname) + strlen(crepr) + 3; - if ((pbuf+len) <= endofbuf) { - strcpy(pbuf, cname); - pbuf += strlen(cname); - *pbuf++ = '='; - strcpy(pbuf, crepr); - pbuf += strlen(crepr); - *pbuf++ = ','; - *pbuf++ = ' '; - removelast = 1; - Py_DECREF(repr); - } - else { - strcpy(pbuf, "..."); - pbuf += 3; - removelast = 0; - Py_DECREF(repr); - break; - } - } - Py_DECREF(tup); - if (removelast) { - /* overwrite last ", " */ - pbuf-=2; - } - *pbuf++ = ')'; - *pbuf = '\0'; - - return PyString_FromString(buf); -} - -static PyObject * -structseq_concat(PyStructSequence *obj, PyObject *b) -{ - PyObject *tup, *result; - tup = make_tuple(obj); - result = PySequence_Concat(tup, b); - Py_DECREF(tup); - return result; -} - -static PyObject * -structseq_repeat(PyStructSequence *obj, Py_ssize_t n) -{ - PyObject *tup, *result; - tup = make_tuple(obj); - result = PySequence_Repeat(tup, n); - Py_DECREF(tup); - return result; -} - -static int -structseq_contains(PyStructSequence *obj, PyObject *o) -{ - PyObject *tup; - int result; - tup = make_tuple(obj); - if (!tup) - return -1; - result = PySequence_Contains(tup, o); - Py_DECREF(tup); - return result; -} - -static long -structseq_hash(PyObject *obj) -{ - PyObject *tup; - long result; - tup = make_tuple((PyStructSequence*) obj); - if (!tup) - return -1; - result = PyObject_Hash(tup); - Py_DECREF(tup); - return result; -} - -static PyObject * -structseq_richcompare(PyObject *obj, PyObject *o2, int op) -{ - PyObject *tup, *result; - tup = make_tuple((PyStructSequence*) obj); - result = PyObject_RichCompare(tup, o2, op); - Py_DECREF(tup); - return result; -} - -static PyObject * -structseq_reduce(PyStructSequence* self) -{ - PyObject* tup; - PyObject* dict; - PyObject* result; - Py_ssize_t n_fields, n_visible_fields, n_unnamed_fields; - int i; - - n_fields = REAL_SIZE(self); - n_visible_fields = VISIBLE_SIZE(self); - n_unnamed_fields = UNNAMED_FIELDS(self); - tup = PyTuple_New(n_visible_fields); - if (!tup) { - return NULL; - } - - dict = PyDict_New(); - if (!dict) { - Py_DECREF(tup); - return NULL; - } - - for (i = 0; i < n_visible_fields; i++) { - Py_INCREF(self->ob_item[i]); - PyTuple_SET_ITEM(tup, i, self->ob_item[i]); - } - - for (; i < n_fields; i++) { - char *n = Py_TYPE(self)->tp_members[i-n_unnamed_fields].name; - PyDict_SetItemString(dict, n, - self->ob_item[i]); - } - - result = Py_BuildValue("(O(OO))", Py_TYPE(self), tup, dict); - - Py_DECREF(tup); - Py_DECREF(dict); - - return result; -} - -static PySequenceMethods structseq_as_sequence = { - (lenfunc)structseq_length, - (binaryfunc)structseq_concat, /* sq_concat */ - (ssizeargfunc)structseq_repeat, /* sq_repeat */ - (ssizeargfunc)structseq_item, /* sq_item */ - (ssizessizeargfunc)structseq_slice, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)structseq_contains, /* sq_contains */ -}; - -static PyMappingMethods structseq_as_mapping = { - (lenfunc)structseq_length, - (binaryfunc)structseq_subscript, -}; - -static PyMethodDef structseq_methods[] = { - {"__reduce__", (PyCFunction)structseq_reduce, - METH_NOARGS, NULL}, - {NULL, NULL} -}; - -static PyTypeObject _struct_sequence_template = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - NULL, /* tp_name */ - 0, /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)structseq_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)structseq_repr, /* tp_repr */ - 0, /* tp_as_number */ - &structseq_as_sequence, /* tp_as_sequence */ - &structseq_as_mapping, /* tp_as_mapping */ - structseq_hash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - NULL, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - structseq_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - structseq_methods, /* tp_methods */ - NULL, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - structseq_new, /* tp_new */ -}; - -void -PyStructSequence_InitType(PyTypeObject *type, PyStructSequence_Desc *desc) -{ - PyObject *dict; - PyMemberDef* members; - int n_members, n_unnamed_members, i, k; - -#ifdef Py_TRACE_REFS - /* if the type object was chained, unchain it first - before overwriting its storage */ - if (type->_ob_next) { - _Py_ForgetReference((PyObject*)type); - } -#endif - - n_unnamed_members = 0; - for (i = 0; desc->fields[i].name != NULL; ++i) - if (desc->fields[i].name == PyStructSequence_UnnamedField) - n_unnamed_members++; - n_members = i; - - memcpy(type, &_struct_sequence_template, sizeof(PyTypeObject)); - type->tp_name = desc->name; - type->tp_doc = desc->doc; - type->tp_basicsize = sizeof(PyStructSequence)+ - sizeof(PyObject*)*(n_members-1); - type->tp_itemsize = 0; - - members = PyMem_NEW(PyMemberDef, n_members-n_unnamed_members+1); - if (members == NULL) - return; - - for (i = k = 0; i < n_members; ++i) { - if (desc->fields[i].name == PyStructSequence_UnnamedField) - continue; - members[k].name = desc->fields[i].name; - members[k].type = T_OBJECT; - members[k].offset = offsetof(PyStructSequence, ob_item) - + i * sizeof(PyObject*); - members[k].flags = READONLY; - members[k].doc = desc->fields[i].doc; - k++; - } - members[k].name = NULL; - - type->tp_members = members; - - if (PyType_Ready(type) < 0) - return; - Py_INCREF(type); - - dict = type->tp_dict; -#define SET_DICT_FROM_INT(key, value) \ - do { \ - PyObject *v = PyInt_FromLong((long) value); \ - if (v != NULL) { \ - PyDict_SetItemString(dict, key, v); \ - Py_DECREF(v); \ - } \ - } while (0) - - SET_DICT_FROM_INT(visible_length_key, desc->n_in_sequence); - SET_DICT_FROM_INT(real_length_key, n_members); - SET_DICT_FROM_INT(unnamed_fields_key, n_unnamed_members); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/tupleobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/tupleobject.c deleted file mode 100644 index 8193e44..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/tupleobject.c +++ /dev/null @@ -1,1040 +0,0 @@ - -/* Tuple object implementation */ - -#include "Python.h" - -/* Speed optimization to avoid frequent malloc/free of small tuples */ -#ifndef PyTuple_MAXSAVESIZE -#define PyTuple_MAXSAVESIZE 20 /* Largest tuple to save on free list */ -#endif -#ifndef PyTuple_MAXFREELIST -#define PyTuple_MAXFREELIST 2000 /* Maximum number of tuples of each size to save */ -#endif - -#if PyTuple_MAXSAVESIZE > 0 -/* Entries 1 up to PyTuple_MAXSAVESIZE are free lists, entry 0 is the empty - tuple () of which at most one instance will be allocated. -*/ -static PyTupleObject *free_list[PyTuple_MAXSAVESIZE]; -static int numfree[PyTuple_MAXSAVESIZE]; -#endif -#ifdef COUNT_ALLOCS -Py_ssize_t fast_tuple_allocs; -Py_ssize_t tuple_zero_allocs; -#endif - -/* Debug statistic to count GC tracking of tuples. - Please note that tuples are only untracked when considered by the GC, and - many of them will be dead before. Therefore, a tracking rate close to 100% - does not necessarily prove that the heuristic is inefficient. -*/ -#ifdef SHOW_TRACK_COUNT -static Py_ssize_t count_untracked = 0; -static Py_ssize_t count_tracked = 0; - -static void -show_track(void) -{ - fprintf(stderr, "Tuples created: %" PY_FORMAT_SIZE_T "d\n", - count_tracked + count_untracked); - fprintf(stderr, "Tuples tracked by the GC: %" PY_FORMAT_SIZE_T - "d\n", count_tracked); - fprintf(stderr, "%.2f%% tuple tracking rate\n\n", - (100.0*count_tracked/(count_untracked+count_tracked))); -} -#endif - - -PyObject * -PyTuple_New(register Py_ssize_t size) -{ - register PyTupleObject *op; - Py_ssize_t i; - if (size < 0) { - PyErr_BadInternalCall(); - return NULL; - } -#if PyTuple_MAXSAVESIZE > 0 - if (size == 0 && free_list[0]) { - op = free_list[0]; - Py_INCREF(op); -#ifdef COUNT_ALLOCS - tuple_zero_allocs++; -#endif - return (PyObject *) op; - } - if (size < PyTuple_MAXSAVESIZE && (op = free_list[size]) != NULL) { - free_list[size] = (PyTupleObject *) op->ob_item[0]; - numfree[size]--; -#ifdef COUNT_ALLOCS - fast_tuple_allocs++; -#endif - /* Inline PyObject_InitVar */ -#ifdef Py_TRACE_REFS - Py_SIZE(op) = size; - Py_TYPE(op) = &PyTuple_Type; -#endif - _Py_NewReference((PyObject *)op); - } - else -#endif - { - Py_ssize_t nbytes = size * sizeof(PyObject *); - /* Check for overflow */ - if (nbytes / sizeof(PyObject *) != (size_t)size || - (nbytes > PY_SSIZE_T_MAX - sizeof(PyTupleObject) - sizeof(PyObject *))) - { - return PyErr_NoMemory(); - } - - op = PyObject_GC_NewVar(PyTupleObject, &PyTuple_Type, size); - if (op == NULL) - return NULL; - } - for (i=0; i < size; i++) - op->ob_item[i] = NULL; -#if PyTuple_MAXSAVESIZE > 0 - if (size == 0) { - free_list[0] = op; - ++numfree[0]; - Py_INCREF(op); /* extra INCREF so that this is never freed */ - } -#endif -#ifdef SHOW_TRACK_COUNT - count_tracked++; -#endif - _PyObject_GC_TRACK(op); - return (PyObject *) op; -} - -Py_ssize_t -PyTuple_Size(register PyObject *op) -{ - if (!PyTuple_Check(op)) { - PyErr_BadInternalCall(); - return -1; - } - else - return Py_SIZE(op); -} - -PyObject * -PyTuple_GetItem(register PyObject *op, register Py_ssize_t i) -{ - if (!PyTuple_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - if (i < 0 || i >= Py_SIZE(op)) { - PyErr_SetString(PyExc_IndexError, "tuple index out of range"); - return NULL; - } - return ((PyTupleObject *)op) -> ob_item[i]; -} - -int -PyTuple_SetItem(register PyObject *op, register Py_ssize_t i, PyObject *newitem) -{ - register PyObject *olditem; - register PyObject **p; - if (!PyTuple_Check(op) || op->ob_refcnt != 1) { - Py_XDECREF(newitem); - PyErr_BadInternalCall(); - return -1; - } - if (i < 0 || i >= Py_SIZE(op)) { - Py_XDECREF(newitem); - PyErr_SetString(PyExc_IndexError, - "tuple assignment index out of range"); - return -1; - } - p = ((PyTupleObject *)op) -> ob_item + i; - olditem = *p; - *p = newitem; - Py_XDECREF(olditem); - return 0; -} - -void -_PyTuple_MaybeUntrack(PyObject *op) -{ - PyTupleObject *t; - Py_ssize_t i, n; - - if (!PyTuple_CheckExact(op) || !_PyObject_GC_IS_TRACKED(op)) - return; - t = (PyTupleObject *) op; - n = Py_SIZE(t); - for (i = 0; i < n; i++) { - PyObject *elt = PyTuple_GET_ITEM(t, i); - /* Tuple with NULL elements aren't - fully constructed, don't untrack - them yet. */ - if (!elt || - _PyObject_GC_MAY_BE_TRACKED(elt)) - return; - } -#ifdef SHOW_TRACK_COUNT - count_tracked--; - count_untracked++; -#endif - _PyObject_GC_UNTRACK(op); -} - -PyObject * -PyTuple_Pack(Py_ssize_t n, ...) -{ - Py_ssize_t i; - PyObject *o; - PyObject *result; - PyObject **items; - va_list vargs; - - va_start(vargs, n); - result = PyTuple_New(n); - if (result == NULL) { - va_end(vargs); - return NULL; - } - items = ((PyTupleObject *)result)->ob_item; - for (i = 0; i < n; i++) { - o = va_arg(vargs, PyObject *); - Py_INCREF(o); - items[i] = o; - } - va_end(vargs); - return result; -} - - -/* Methods */ - -static void -tupledealloc(register PyTupleObject *op) -{ - register Py_ssize_t i; - register Py_ssize_t len = Py_SIZE(op); - PyObject_GC_UnTrack(op); - Py_TRASHCAN_SAFE_BEGIN(op) - if (len > 0) { - i = len; - while (--i >= 0) - Py_XDECREF(op->ob_item[i]); -#if PyTuple_MAXSAVESIZE > 0 - if (len < PyTuple_MAXSAVESIZE && - numfree[len] < PyTuple_MAXFREELIST && - Py_TYPE(op) == &PyTuple_Type) - { - op->ob_item[0] = (PyObject *) free_list[len]; - numfree[len]++; - free_list[len] = op; - goto done; /* return */ - } -#endif - } - Py_TYPE(op)->tp_free((PyObject *)op); -done: - Py_TRASHCAN_SAFE_END(op) -} - -static int -tupleprint(PyTupleObject *op, FILE *fp, int flags) -{ - Py_ssize_t i; - Py_BEGIN_ALLOW_THREADS - fprintf(fp, "("); - Py_END_ALLOW_THREADS - for (i = 0; i < Py_SIZE(op); i++) { - if (i > 0) { - Py_BEGIN_ALLOW_THREADS - fprintf(fp, ", "); - Py_END_ALLOW_THREADS - } - if (PyObject_Print(op->ob_item[i], fp, 0) != 0) - return -1; - } - i = Py_SIZE(op); - Py_BEGIN_ALLOW_THREADS - if (i == 1) - fprintf(fp, ","); - fprintf(fp, ")"); - Py_END_ALLOW_THREADS - return 0; -} - -static PyObject * -tuplerepr(PyTupleObject *v) -{ - Py_ssize_t i, n; - PyObject *s, *temp; - PyObject *pieces, *result = NULL; - - n = Py_SIZE(v); - if (n == 0) - return PyString_FromString("()"); - - /* While not mutable, it is still possible to end up with a cycle in a - tuple through an object that stores itself within a tuple (and thus - infinitely asks for the repr of itself). This should only be - possible within a type. */ - i = Py_ReprEnter((PyObject *)v); - if (i != 0) { - return i > 0 ? PyString_FromString("(...)") : NULL; - } - - pieces = PyTuple_New(n); - if (pieces == NULL) - return NULL; - - /* Do repr() on each element. */ - for (i = 0; i < n; ++i) { - if (Py_EnterRecursiveCall(" while getting the repr of a tuple")) - goto Done; - s = PyObject_Repr(v->ob_item[i]); - Py_LeaveRecursiveCall(); - if (s == NULL) - goto Done; - PyTuple_SET_ITEM(pieces, i, s); - } - - /* Add "()" decorations to the first and last items. */ - assert(n > 0); - s = PyString_FromString("("); - if (s == NULL) - goto Done; - temp = PyTuple_GET_ITEM(pieces, 0); - PyString_ConcatAndDel(&s, temp); - PyTuple_SET_ITEM(pieces, 0, s); - if (s == NULL) - goto Done; - - s = PyString_FromString(n == 1 ? ",)" : ")"); - if (s == NULL) - goto Done; - temp = PyTuple_GET_ITEM(pieces, n-1); - PyString_ConcatAndDel(&temp, s); - PyTuple_SET_ITEM(pieces, n-1, temp); - if (temp == NULL) - goto Done; - - /* Paste them all together with ", " between. */ - s = PyString_FromString(", "); - if (s == NULL) - goto Done; - result = _PyString_Join(s, pieces); - Py_DECREF(s); - -Done: - Py_DECREF(pieces); - Py_ReprLeave((PyObject *)v); - return result; -} - -/* The addend 82520, was selected from the range(0, 1000000) for - generating the greatest number of prime multipliers for tuples - upto length eight: - - 1082527, 1165049, 1082531, 1165057, 1247581, 1330103, 1082533, - 1330111, 1412633, 1165069, 1247599, 1495177, 1577699 -*/ - -static long -tuplehash(PyTupleObject *v) -{ - register long x, y; - register Py_ssize_t len = Py_SIZE(v); - register PyObject **p; - long mult = 1000003L; - x = 0x345678L; - p = v->ob_item; - while (--len >= 0) { - y = PyObject_Hash(*p++); - if (y == -1) - return -1; - x = (x ^ y) * mult; - /* the cast might truncate len; that doesn't change hash stability */ - mult += (long)(82520L + len + len); - } - x += 97531L; - if (x == -1) - x = -2; - return x; -} - -static Py_ssize_t -tuplelength(PyTupleObject *a) -{ - return Py_SIZE(a); -} - -static int -tuplecontains(PyTupleObject *a, PyObject *el) -{ - Py_ssize_t i; - int cmp; - - for (i = 0, cmp = 0 ; cmp == 0 && i < Py_SIZE(a); ++i) - cmp = PyObject_RichCompareBool(el, PyTuple_GET_ITEM(a, i), - Py_EQ); - return cmp; -} - -static PyObject * -tupleitem(register PyTupleObject *a, register Py_ssize_t i) -{ - if (i < 0 || i >= Py_SIZE(a)) { - PyErr_SetString(PyExc_IndexError, "tuple index out of range"); - return NULL; - } - Py_INCREF(a->ob_item[i]); - return a->ob_item[i]; -} - -static PyObject * -tupleslice(register PyTupleObject *a, register Py_ssize_t ilow, - register Py_ssize_t ihigh) -{ - register PyTupleObject *np; - PyObject **src, **dest; - register Py_ssize_t i; - Py_ssize_t len; - if (ilow < 0) - ilow = 0; - if (ihigh > Py_SIZE(a)) - ihigh = Py_SIZE(a); - if (ihigh < ilow) - ihigh = ilow; - if (ilow == 0 && ihigh == Py_SIZE(a) && PyTuple_CheckExact(a)) { - Py_INCREF(a); - return (PyObject *)a; - } - len = ihigh - ilow; - np = (PyTupleObject *)PyTuple_New(len); - if (np == NULL) - return NULL; - src = a->ob_item + ilow; - dest = np->ob_item; - for (i = 0; i < len; i++) { - PyObject *v = src[i]; - Py_INCREF(v); - dest[i] = v; - } - return (PyObject *)np; -} - -PyObject * -PyTuple_GetSlice(PyObject *op, Py_ssize_t i, Py_ssize_t j) -{ - if (op == NULL || !PyTuple_Check(op)) { - PyErr_BadInternalCall(); - return NULL; - } - return tupleslice((PyTupleObject *)op, i, j); -} - -static PyObject * -tupleconcat(register PyTupleObject *a, register PyObject *bb) -{ - register Py_ssize_t size; - register Py_ssize_t i; - PyObject **src, **dest; - PyTupleObject *np; - if (!PyTuple_Check(bb)) { - PyErr_Format(PyExc_TypeError, - "can only concatenate tuple (not \"%.200s\") to tuple", - Py_TYPE(bb)->tp_name); - return NULL; - } -#define b ((PyTupleObject *)bb) - size = Py_SIZE(a) + Py_SIZE(b); - if (size < 0) - return PyErr_NoMemory(); - np = (PyTupleObject *) PyTuple_New(size); - if (np == NULL) { - return NULL; - } - src = a->ob_item; - dest = np->ob_item; - for (i = 0; i < Py_SIZE(a); i++) { - PyObject *v = src[i]; - Py_INCREF(v); - dest[i] = v; - } - src = b->ob_item; - dest = np->ob_item + Py_SIZE(a); - for (i = 0; i < Py_SIZE(b); i++) { - PyObject *v = src[i]; - Py_INCREF(v); - dest[i] = v; - } - return (PyObject *)np; -#undef b -} - -static PyObject * -tuplerepeat(PyTupleObject *a, Py_ssize_t n) -{ - Py_ssize_t i, j; - Py_ssize_t size; - PyTupleObject *np; - PyObject **p, **items; - if (n < 0) - n = 0; - if (Py_SIZE(a) == 0 || n == 1) { - if (PyTuple_CheckExact(a)) { - /* Since tuples are immutable, we can return a shared - copy in this case */ - Py_INCREF(a); - return (PyObject *)a; - } - if (Py_SIZE(a) == 0) - return PyTuple_New(0); - } - size = Py_SIZE(a) * n; - if (size/Py_SIZE(a) != n) - return PyErr_NoMemory(); - np = (PyTupleObject *) PyTuple_New(size); - if (np == NULL) - return NULL; - p = np->ob_item; - items = a->ob_item; - for (i = 0; i < n; i++) { - for (j = 0; j < Py_SIZE(a); j++) { - *p = items[j]; - Py_INCREF(*p); - p++; - } - } - return (PyObject *) np; -} - -static PyObject * -tupleindex(PyTupleObject *self, PyObject *args) -{ - Py_ssize_t i, start=0, stop=Py_SIZE(self); - PyObject *v; - - if (!PyArg_ParseTuple(args, "O|O&O&:index", &v, - _PyEval_SliceIndex, &start, - _PyEval_SliceIndex, &stop)) - return NULL; - if (start < 0) { - start += Py_SIZE(self); - if (start < 0) - start = 0; - } - if (stop < 0) { - stop += Py_SIZE(self); - if (stop < 0) - stop = 0; - } - for (i = start; i < stop && i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); - if (cmp > 0) - return PyInt_FromSsize_t(i); - else if (cmp < 0) - return NULL; - } - PyErr_SetString(PyExc_ValueError, "tuple.index(x): x not in tuple"); - return NULL; -} - -static PyObject * -tuplecount(PyTupleObject *self, PyObject *v) -{ - Py_ssize_t count = 0; - Py_ssize_t i; - - for (i = 0; i < Py_SIZE(self); i++) { - int cmp = PyObject_RichCompareBool(self->ob_item[i], v, Py_EQ); - if (cmp > 0) - count++; - else if (cmp < 0) - return NULL; - } - return PyInt_FromSsize_t(count); -} - -static int -tupletraverse(PyTupleObject *o, visitproc visit, void *arg) -{ - Py_ssize_t i; - - for (i = Py_SIZE(o); --i >= 0; ) - Py_VISIT(o->ob_item[i]); - return 0; -} - -static PyObject * -tuplerichcompare(PyObject *v, PyObject *w, int op) -{ - PyTupleObject *vt, *wt; - Py_ssize_t i; - Py_ssize_t vlen, wlen; - - if (!PyTuple_Check(v) || !PyTuple_Check(w)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - vt = (PyTupleObject *)v; - wt = (PyTupleObject *)w; - - vlen = Py_SIZE(vt); - wlen = Py_SIZE(wt); - - /* Note: the corresponding code for lists has an "early out" test - * here when op is EQ or NE and the lengths differ. That pays there, - * but Tim was unable to find any real code where EQ/NE tuple - * compares don't have the same length, so testing for it here would - * have cost without benefit. - */ - - /* Search for the first index where items are different. - * Note that because tuples are immutable, it's safe to reuse - * vlen and wlen across the comparison calls. - */ - for (i = 0; i < vlen && i < wlen; i++) { - int k = PyObject_RichCompareBool(vt->ob_item[i], - wt->ob_item[i], Py_EQ); - if (k < 0) - return NULL; - if (!k) - break; - } - - if (i >= vlen || i >= wlen) { - /* No more items to compare -- compare sizes */ - int cmp; - PyObject *res; - switch (op) { - case Py_LT: cmp = vlen < wlen; break; - case Py_LE: cmp = vlen <= wlen; break; - case Py_EQ: cmp = vlen == wlen; break; - case Py_NE: cmp = vlen != wlen; break; - case Py_GT: cmp = vlen > wlen; break; - case Py_GE: cmp = vlen >= wlen; break; - default: return NULL; /* cannot happen */ - } - if (cmp) - res = Py_True; - else - res = Py_False; - Py_INCREF(res); - return res; - } - - /* We have an item that differs -- shortcuts for EQ/NE */ - if (op == Py_EQ) { - Py_INCREF(Py_False); - return Py_False; - } - if (op == Py_NE) { - Py_INCREF(Py_True); - return Py_True; - } - - /* Compare the final item again using the proper operator */ - return PyObject_RichCompare(vt->ob_item[i], wt->ob_item[i], op); -} - -static PyObject * -tuple_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -tuple_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *arg = NULL; - static char *kwlist[] = {"sequence", 0}; - - if (type != &PyTuple_Type) - return tuple_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O:tuple", kwlist, &arg)) - return NULL; - - if (arg == NULL) - return PyTuple_New(0); - else - return PySequence_Tuple(arg); -} - -static PyObject * -tuple_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *tmp, *newobj, *item; - Py_ssize_t i, n; - - assert(PyType_IsSubtype(type, &PyTuple_Type)); - tmp = tuple_new(&PyTuple_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyTuple_Check(tmp)); - newobj = type->tp_alloc(type, n = PyTuple_GET_SIZE(tmp)); - if (newobj == NULL) - return NULL; - for (i = 0; i < n; i++) { - item = PyTuple_GET_ITEM(tmp, i); - Py_INCREF(item); - PyTuple_SET_ITEM(newobj, i, item); - } - Py_DECREF(tmp); - return newobj; -} - -PyDoc_STRVAR(tuple_doc, -"tuple() -> empty tuple\n\ -tuple(iterable) -> tuple initialized from iterable's items\n\ -\n\ -If the argument is a tuple, the return value is the same object."); - -static PySequenceMethods tuple_as_sequence = { - (lenfunc)tuplelength, /* sq_length */ - (binaryfunc)tupleconcat, /* sq_concat */ - (ssizeargfunc)tuplerepeat, /* sq_repeat */ - (ssizeargfunc)tupleitem, /* sq_item */ - (ssizessizeargfunc)tupleslice, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - (objobjproc)tuplecontains, /* sq_contains */ -}; - -static PyObject* -tuplesubscript(PyTupleObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyTuple_GET_SIZE(self); - return tupleitem(self, i); - } - else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - PyObject* result; - PyObject* it; - PyObject **src, **dest; - - if (PySlice_GetIndicesEx((PySliceObject*)item, - PyTuple_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyTuple_New(0); - } - else if (start == 0 && step == 1 && - slicelength == PyTuple_GET_SIZE(self) && - PyTuple_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } - else { - result = PyTuple_New(slicelength); - if (!result) return NULL; - - src = self->ob_item; - dest = ((PyTupleObject *)result)->ob_item; - for (cur = start, i = 0; i < slicelength; - cur += step, i++) { - it = src[cur]; - Py_INCREF(it); - dest[i] = it; - } - - return result; - } - } - else { - PyErr_Format(PyExc_TypeError, - "tuple indices must be integers, not %.200s", - Py_TYPE(item)->tp_name); - return NULL; - } -} - -static PyObject * -tuple_getnewargs(PyTupleObject *v) -{ - return Py_BuildValue("(N)", tupleslice(v, 0, Py_SIZE(v))); - -} - -PyDoc_STRVAR(index_doc, -"T.index(value, [start, [stop]]) -> integer -- return first index of value.\n" -"Raises ValueError if the value is not present." -); -PyDoc_STRVAR(count_doc, -"T.count(value) -> integer -- return number of occurrences of value"); - -static PyMethodDef tuple_methods[] = { - {"__getnewargs__", (PyCFunction)tuple_getnewargs, METH_NOARGS}, - {"index", (PyCFunction)tupleindex, METH_VARARGS, index_doc}, - {"count", (PyCFunction)tuplecount, METH_O, count_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyMappingMethods tuple_as_mapping = { - (lenfunc)tuplelength, - (binaryfunc)tuplesubscript, - 0 -}; - -static PyObject *tuple_iter(PyObject *seq); - -PyTypeObject PyTuple_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "tuple", - sizeof(PyTupleObject) - sizeof(PyObject *), - sizeof(PyObject *), - (destructor)tupledealloc, /* tp_dealloc */ - (printfunc)tupleprint, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)tuplerepr, /* tp_repr */ - 0, /* tp_as_number */ - &tuple_as_sequence, /* tp_as_sequence */ - &tuple_as_mapping, /* tp_as_mapping */ - (hashfunc)tuplehash, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TUPLE_SUBCLASS, /* tp_flags */ - tuple_doc, /* tp_doc */ - (traverseproc)tupletraverse, /* tp_traverse */ - 0, /* tp_clear */ - tuplerichcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - tuple_iter, /* tp_iter */ - 0, /* tp_iternext */ - tuple_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - tuple_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; - -/* The following function breaks the notion that tuples are immutable: - it changes the size of a tuple. We get away with this only if there - is only one module referencing the object. You can also think of it - as creating a new tuple object and destroying the old one, only more - efficiently. In any case, don't use this if the tuple may already be - known to some other part of the code. */ - -int -_PyTuple_Resize(PyObject **pv, Py_ssize_t newsize) -{ - register PyTupleObject *v; - register PyTupleObject *sv; - Py_ssize_t i; - Py_ssize_t oldsize; - - v = (PyTupleObject *) *pv; - if (v == NULL || Py_TYPE(v) != &PyTuple_Type || - (Py_SIZE(v) != 0 && Py_REFCNT(v) != 1)) { - *pv = 0; - Py_XDECREF(v); - PyErr_BadInternalCall(); - return -1; - } - oldsize = Py_SIZE(v); - if (oldsize == newsize) - return 0; - - if (oldsize == 0) { - /* Empty tuples are often shared, so we should never - resize them in-place even if we do own the only - (current) reference */ - Py_DECREF(v); - *pv = PyTuple_New(newsize); - return *pv == NULL ? -1 : 0; - } - - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - if (_PyObject_GC_IS_TRACKED(v)) - _PyObject_GC_UNTRACK(v); - _Py_ForgetReference((PyObject *) v); - /* DECREF items deleted by shrinkage */ - for (i = newsize; i < oldsize; i++) { - Py_CLEAR(v->ob_item[i]); - } - sv = PyObject_GC_Resize(PyTupleObject, v, newsize); - if (sv == NULL) { - *pv = NULL; - PyObject_GC_Del(v); - return -1; - } - _Py_NewReference((PyObject *) sv); - /* Zero out items added by growing */ - if (newsize > oldsize) - memset(&sv->ob_item[oldsize], 0, - sizeof(*sv->ob_item) * (newsize - oldsize)); - *pv = (PyObject *) sv; - _PyObject_GC_TRACK(sv); - return 0; -} - -int -PyTuple_ClearFreeList(void) -{ - int freelist_size = 0; -#if PyTuple_MAXSAVESIZE > 0 - int i; - for (i = 1; i < PyTuple_MAXSAVESIZE; i++) { - PyTupleObject *p, *q; - p = free_list[i]; - freelist_size += numfree[i]; - free_list[i] = NULL; - numfree[i] = 0; - while (p) { - q = p; - p = (PyTupleObject *)(p->ob_item[0]); - PyObject_GC_Del(q); - } - } -#endif - return freelist_size; -} - -void -PyTuple_Fini(void) -{ -#if PyTuple_MAXSAVESIZE > 0 - /* empty tuples are used all over the place and applications may - * rely on the fact that an empty tuple is a singleton. */ - Py_CLEAR(free_list[0]); - - (void)PyTuple_ClearFreeList(); -#endif -#ifdef SHOW_TRACK_COUNT - show_track(); -#endif -} - -/*********************** Tuple Iterator **************************/ - -typedef struct { - PyObject_HEAD - long it_index; - PyTupleObject *it_seq; /* Set to NULL when iterator is exhausted */ -} tupleiterobject; - -static void -tupleiter_dealloc(tupleiterobject *it) -{ - _PyObject_GC_UNTRACK(it); - Py_XDECREF(it->it_seq); - PyObject_GC_Del(it); -} - -static int -tupleiter_traverse(tupleiterobject *it, visitproc visit, void *arg) -{ - Py_VISIT(it->it_seq); - return 0; -} - -static PyObject * -tupleiter_next(tupleiterobject *it) -{ - PyTupleObject *seq; - PyObject *item; - - assert(it != NULL); - seq = it->it_seq; - if (seq == NULL) - return NULL; - assert(PyTuple_Check(seq)); - - if (it->it_index < PyTuple_GET_SIZE(seq)) { - item = PyTuple_GET_ITEM(seq, it->it_index); - ++it->it_index; - Py_INCREF(item); - return item; - } - - Py_DECREF(seq); - it->it_seq = NULL; - return NULL; -} - -static PyObject * -tupleiter_len(tupleiterobject *it) -{ - Py_ssize_t len = 0; - if (it->it_seq) - len = PyTuple_GET_SIZE(it->it_seq) - it->it_index; - return PyInt_FromSsize_t(len); -} - -PyDoc_STRVAR(length_hint_doc, "Private method returning an estimate of len(list(it))."); - -static PyMethodDef tupleiter_methods[] = { - {"__length_hint__", (PyCFunction)tupleiter_len, METH_NOARGS, length_hint_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyTypeObject PyTupleIter_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "tupleiterator", /* tp_name */ - sizeof(tupleiterobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - (destructor)tupleiter_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)tupleiter_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - PyObject_SelfIter, /* tp_iter */ - (iternextfunc)tupleiter_next, /* tp_iternext */ - tupleiter_methods, /* tp_methods */ - 0, -}; - -static PyObject * -tuple_iter(PyObject *seq) -{ - tupleiterobject *it; - - if (!PyTuple_Check(seq)) { - PyErr_BadInternalCall(); - return NULL; - } - it = PyObject_GC_New(tupleiterobject, &PyTupleIter_Type); - if (it == NULL) - return NULL; - it->it_index = 0; - Py_INCREF(seq); - it->it_seq = (PyTupleObject *)seq; - _PyObject_GC_TRACK(it); - return (PyObject *)it; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/typeobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/typeobject.c deleted file mode 100644 index e42a86b..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/typeobject.c +++ /dev/null @@ -1,6748 +0,0 @@ -/* Type object implementation */ - -#include "Python.h" -#include "structmember.h" - -#include - - -/* Support type attribute cache */ - -/* The cache can keep references to the names alive for longer than - they normally would. This is why the maximum size is limited to - MCACHE_MAX_ATTR_SIZE, since it might be a problem if very large - strings are used as attribute names. */ -#define MCACHE_MAX_ATTR_SIZE 100 -#define MCACHE_SIZE_EXP 10 -#define MCACHE_HASH(version, name_hash) \ - (((unsigned int)(version) * (unsigned int)(name_hash)) \ - >> (8*sizeof(unsigned int) - MCACHE_SIZE_EXP)) -#define MCACHE_HASH_METHOD(type, name) \ - MCACHE_HASH((type)->tp_version_tag, \ - ((PyStringObject *)(name))->ob_shash) -#define MCACHE_CACHEABLE_NAME(name) \ - PyString_CheckExact(name) && \ - PyString_GET_SIZE(name) <= MCACHE_MAX_ATTR_SIZE - -struct method_cache_entry { - unsigned int version; - PyObject *name; /* reference to exactly a str or None */ - PyObject *value; /* borrowed */ -}; - -static struct method_cache_entry method_cache[1 << MCACHE_SIZE_EXP]; -static unsigned int next_version_tag = 0; - -unsigned int -PyType_ClearCache(void) -{ - Py_ssize_t i; - unsigned int cur_version_tag = next_version_tag - 1; - - for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) { - method_cache[i].version = 0; - Py_CLEAR(method_cache[i].name); - method_cache[i].value = NULL; - } - next_version_tag = 0; - /* mark all version tags as invalid */ - PyType_Modified(&PyBaseObject_Type); - return cur_version_tag; -} - -void -PyType_Modified(PyTypeObject *type) -{ - /* Invalidate any cached data for the specified type and all - subclasses. This function is called after the base - classes, mro, or attributes of the type are altered. - - Invariants: - - - Py_TPFLAGS_VALID_VERSION_TAG is never set if - Py_TPFLAGS_HAVE_VERSION_TAG is not set (e.g. on type - objects coming from non-recompiled extension modules) - - - before Py_TPFLAGS_VALID_VERSION_TAG can be set on a type, - it must first be set on all super types. - - This function clears the Py_TPFLAGS_VALID_VERSION_TAG of a - type (so it must first clear it on all subclasses). The - tp_version_tag value is meaningless unless this flag is set. - We don't assign new version tags eagerly, but only as - needed. - */ - PyObject *raw, *ref; - Py_ssize_t i, n; - - if (!PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) - return; - - raw = type->tp_subclasses; - if (raw != NULL) { - n = PyList_GET_SIZE(raw); - for (i = 0; i < n; i++) { - ref = PyList_GET_ITEM(raw, i); - ref = PyWeakref_GET_OBJECT(ref); - if (ref != Py_None) { - PyType_Modified((PyTypeObject *)ref); - } - } - } - type->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG; -} - -static void -type_mro_modified(PyTypeObject *type, PyObject *bases) { - /* - Check that all base classes or elements of the mro of type are - able to be cached. This function is called after the base - classes or mro of the type are altered. - - Unset HAVE_VERSION_TAG and VALID_VERSION_TAG if the type - inherits from an old-style class, either directly or if it - appears in the MRO of a new-style class. No support either for - custom MROs that include types that are not officially super - types. - - Called from mro_internal, which will subsequently be called on - each subclass when their mro is recursively updated. - */ - Py_ssize_t i, n; - int clear = 0; - - if (!PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG)) - return; - - n = PyTuple_GET_SIZE(bases); - for (i = 0; i < n; i++) { - PyObject *b = PyTuple_GET_ITEM(bases, i); - PyTypeObject *cls; - - if (!PyType_Check(b) ) { - clear = 1; - break; - } - - cls = (PyTypeObject *)b; - - if (!PyType_HasFeature(cls, Py_TPFLAGS_HAVE_VERSION_TAG) || - !PyType_IsSubtype(type, cls)) { - clear = 1; - break; - } - } - - if (clear) - type->tp_flags &= ~(Py_TPFLAGS_HAVE_VERSION_TAG| - Py_TPFLAGS_VALID_VERSION_TAG); -} - -static int -assign_version_tag(PyTypeObject *type) -{ - /* Ensure that the tp_version_tag is valid and set - Py_TPFLAGS_VALID_VERSION_TAG. To respect the invariant, this - must first be done on all super classes. Return 0 if this - cannot be done, 1 if Py_TPFLAGS_VALID_VERSION_TAG. - */ - Py_ssize_t i, n; - PyObject *bases; - - if (PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) - return 1; - if (!PyType_HasFeature(type, Py_TPFLAGS_HAVE_VERSION_TAG)) - return 0; - if (!PyType_HasFeature(type, Py_TPFLAGS_READY)) - return 0; - - type->tp_version_tag = next_version_tag++; - /* for stress-testing: next_version_tag &= 0xFF; */ - - if (type->tp_version_tag == 0) { - /* wrap-around or just starting Python - clear the whole - cache by filling names with references to Py_None. - Values are also set to NULL for added protection, as they - are borrowed reference */ - for (i = 0; i < (1 << MCACHE_SIZE_EXP); i++) { - method_cache[i].value = NULL; - Py_XDECREF(method_cache[i].name); - method_cache[i].name = Py_None; - Py_INCREF(Py_None); - } - /* mark all version tags as invalid */ - PyType_Modified(&PyBaseObject_Type); - return 1; - } - bases = type->tp_bases; - n = PyTuple_GET_SIZE(bases); - for (i = 0; i < n; i++) { - PyObject *b = PyTuple_GET_ITEM(bases, i); - assert(PyType_Check(b)); - if (!assign_version_tag((PyTypeObject *)b)) - return 0; - } - type->tp_flags |= Py_TPFLAGS_VALID_VERSION_TAG; - return 1; -} - - -static PyMemberDef type_members[] = { - {"__basicsize__", T_PYSSIZET, offsetof(PyTypeObject,tp_basicsize),READONLY}, - {"__itemsize__", T_PYSSIZET, offsetof(PyTypeObject, tp_itemsize), READONLY}, - {"__flags__", T_LONG, offsetof(PyTypeObject, tp_flags), READONLY}, - {"__weakrefoffset__", T_LONG, - offsetof(PyTypeObject, tp_weaklistoffset), READONLY}, - {"__base__", T_OBJECT, offsetof(PyTypeObject, tp_base), READONLY}, - {"__dictoffset__", T_LONG, - offsetof(PyTypeObject, tp_dictoffset), READONLY}, - {"__mro__", T_OBJECT, offsetof(PyTypeObject, tp_mro), READONLY}, - {0} -}; - -static PyObject * -type_name(PyTypeObject *type, void *context) -{ - const char *s; - - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { - PyHeapTypeObject* et = (PyHeapTypeObject*)type; - - Py_INCREF(et->ht_name); - return et->ht_name; - } - else { - s = strrchr(type->tp_name, '.'); - if (s == NULL) - s = type->tp_name; - else - s++; - return PyString_FromString(s); - } -} - -static int -type_set_name(PyTypeObject *type, PyObject *value, void *context) -{ - PyHeapTypeObject* et; - PyObject *tmp; - - if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - PyErr_Format(PyExc_TypeError, - "can't set %s.__name__", type->tp_name); - return -1; - } - if (!value) { - PyErr_Format(PyExc_TypeError, - "can't delete %s.__name__", type->tp_name); - return -1; - } - if (!PyString_Check(value)) { - PyErr_Format(PyExc_TypeError, - "can only assign string to %s.__name__, not '%s'", - type->tp_name, Py_TYPE(value)->tp_name); - return -1; - } - if (strlen(PyString_AS_STRING(value)) - != (size_t)PyString_GET_SIZE(value)) { - PyErr_Format(PyExc_ValueError, - "__name__ must not contain null bytes"); - return -1; - } - - et = (PyHeapTypeObject*)type; - - Py_INCREF(value); - - /* Wait until et is a sane state before Py_DECREF'ing the old et->ht_name - value. (Bug #16447.) */ - tmp = et->ht_name; - et->ht_name = value; - - type->tp_name = PyString_AS_STRING(value); - Py_DECREF(tmp); - - return 0; -} - -static PyObject * -type_module(PyTypeObject *type, void *context) -{ - PyObject *mod; - char *s; - - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) { - mod = PyDict_GetItemString(type->tp_dict, "__module__"); - if (!mod) { - PyErr_Format(PyExc_AttributeError, "__module__"); - return 0; - } - Py_XINCREF(mod); - return mod; - } - else { - s = strrchr(type->tp_name, '.'); - if (s != NULL) - return PyString_FromStringAndSize( - type->tp_name, (Py_ssize_t)(s - type->tp_name)); - return PyString_FromString("__builtin__"); - } -} - -static int -type_set_module(PyTypeObject *type, PyObject *value, void *context) -{ - if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - PyErr_Format(PyExc_TypeError, - "can't set %s.__module__", type->tp_name); - return -1; - } - if (!value) { - PyErr_Format(PyExc_TypeError, - "can't delete %s.__module__", type->tp_name); - return -1; - } - - PyType_Modified(type); - - return PyDict_SetItemString(type->tp_dict, "__module__", value); -} - -static PyObject * -type_abstractmethods(PyTypeObject *type, void *context) -{ - PyObject *mod = NULL; - /* type itself has an __abstractmethods__ descriptor (this). Don't return - that. */ - if (type != &PyType_Type) - mod = PyDict_GetItemString(type->tp_dict, "__abstractmethods__"); - if (!mod) { - PyErr_SetString(PyExc_AttributeError, "__abstractmethods__"); - return NULL; - } - Py_XINCREF(mod); - return mod; -} - -static int -type_set_abstractmethods(PyTypeObject *type, PyObject *value, void *context) -{ - /* __abstractmethods__ should only be set once on a type, in - abc.ABCMeta.__new__, so this function doesn't do anything - special to update subclasses. - */ - int abstract, res; - if (value != NULL) { - abstract = PyObject_IsTrue(value); - if (abstract < 0) - return -1; - res = PyDict_SetItemString(type->tp_dict, "__abstractmethods__", value); - } - else { - abstract = 0; - res = PyDict_DelItemString(type->tp_dict, "__abstractmethods__"); - if (res && PyErr_ExceptionMatches(PyExc_KeyError)) { - PyErr_SetString(PyExc_AttributeError, "__abstractmethods__"); - return -1; - } - } - if (res == 0) { - PyType_Modified(type); - if (abstract) - type->tp_flags |= Py_TPFLAGS_IS_ABSTRACT; - else - type->tp_flags &= ~Py_TPFLAGS_IS_ABSTRACT; - } - return res; -} - -static PyObject * -type_get_bases(PyTypeObject *type, void *context) -{ - Py_INCREF(type->tp_bases); - return type->tp_bases; -} - -static PyTypeObject *best_base(PyObject *); -static int mro_internal(PyTypeObject *); -static int compatible_for_assignment(PyTypeObject *, PyTypeObject *, char *); -static int add_subclass(PyTypeObject*, PyTypeObject*); -static void remove_subclass(PyTypeObject *, PyTypeObject *); -static void update_all_slots(PyTypeObject *); - -typedef int (*update_callback)(PyTypeObject *, void *); -static int update_subclasses(PyTypeObject *type, PyObject *name, - update_callback callback, void *data); -static int recurse_down_subclasses(PyTypeObject *type, PyObject *name, - update_callback callback, void *data); - -static int -mro_subclasses(PyTypeObject *type, PyObject* temp) -{ - PyTypeObject *subclass; - PyObject *ref, *subclasses, *old_mro; - Py_ssize_t i, n; - - subclasses = type->tp_subclasses; - if (subclasses == NULL) - return 0; - assert(PyList_Check(subclasses)); - n = PyList_GET_SIZE(subclasses); - for (i = 0; i < n; i++) { - ref = PyList_GET_ITEM(subclasses, i); - assert(PyWeakref_CheckRef(ref)); - subclass = (PyTypeObject *)PyWeakref_GET_OBJECT(ref); - assert(subclass != NULL); - if ((PyObject *)subclass == Py_None) - continue; - assert(PyType_Check(subclass)); - old_mro = subclass->tp_mro; - if (mro_internal(subclass) < 0) { - subclass->tp_mro = old_mro; - return -1; - } - else { - PyObject* tuple; - tuple = PyTuple_Pack(2, subclass, old_mro); - Py_DECREF(old_mro); - if (!tuple) - return -1; - if (PyList_Append(temp, tuple) < 0) - return -1; - Py_DECREF(tuple); - } - if (mro_subclasses(subclass, temp) < 0) - return -1; - } - return 0; -} - -static int -type_set_bases(PyTypeObject *type, PyObject *value, void *context) -{ - Py_ssize_t i; - int r = 0; - PyObject *ob, *temp; - PyTypeObject *new_base, *old_base; - PyObject *old_bases, *old_mro; - - if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - PyErr_Format(PyExc_TypeError, - "can't set %s.__bases__", type->tp_name); - return -1; - } - if (!value) { - PyErr_Format(PyExc_TypeError, - "can't delete %s.__bases__", type->tp_name); - return -1; - } - if (!PyTuple_Check(value)) { - PyErr_Format(PyExc_TypeError, - "can only assign tuple to %s.__bases__, not %s", - type->tp_name, Py_TYPE(value)->tp_name); - return -1; - } - if (PyTuple_GET_SIZE(value) == 0) { - PyErr_Format(PyExc_TypeError, - "can only assign non-empty tuple to %s.__bases__, not ()", - type->tp_name); - return -1; - } - for (i = 0; i < PyTuple_GET_SIZE(value); i++) { - ob = PyTuple_GET_ITEM(value, i); - if (!PyClass_Check(ob) && !PyType_Check(ob)) { - PyErr_Format( - PyExc_TypeError, - "%s.__bases__ must be tuple of old- or new-style classes, not '%s'", - type->tp_name, Py_TYPE(ob)->tp_name); - return -1; - } - if (PyType_Check(ob)) { - if (PyType_IsSubtype((PyTypeObject*)ob, type)) { - PyErr_SetString(PyExc_TypeError, - "a __bases__ item causes an inheritance cycle"); - return -1; - } - } - } - - new_base = best_base(value); - - if (!new_base) { - return -1; - } - - if (!compatible_for_assignment(type->tp_base, new_base, "__bases__")) - return -1; - - Py_INCREF(new_base); - Py_INCREF(value); - - old_bases = type->tp_bases; - old_base = type->tp_base; - old_mro = type->tp_mro; - - type->tp_bases = value; - type->tp_base = new_base; - - if (mro_internal(type) < 0) { - goto bail; - } - - temp = PyList_New(0); - if (!temp) - goto bail; - - r = mro_subclasses(type, temp); - - if (r < 0) { - for (i = 0; i < PyList_Size(temp); i++) { - PyTypeObject* cls; - PyObject* mro; - PyArg_UnpackTuple(PyList_GET_ITEM(temp, i), - "", 2, 2, &cls, &mro); - Py_INCREF(mro); - ob = cls->tp_mro; - cls->tp_mro = mro; - Py_DECREF(ob); - } - Py_DECREF(temp); - goto bail; - } - - Py_DECREF(temp); - - /* any base that was in __bases__ but now isn't, we - need to remove |type| from its tp_subclasses. - conversely, any class now in __bases__ that wasn't - needs to have |type| added to its subclasses. */ - - /* for now, sod that: just remove from all old_bases, - add to all new_bases */ - - for (i = PyTuple_GET_SIZE(old_bases) - 1; i >= 0; i--) { - ob = PyTuple_GET_ITEM(old_bases, i); - if (PyType_Check(ob)) { - remove_subclass( - (PyTypeObject*)ob, type); - } - } - - for (i = PyTuple_GET_SIZE(value) - 1; i >= 0; i--) { - ob = PyTuple_GET_ITEM(value, i); - if (PyType_Check(ob)) { - if (add_subclass((PyTypeObject*)ob, type) < 0) - r = -1; - } - } - - update_all_slots(type); - - Py_DECREF(old_bases); - Py_DECREF(old_base); - Py_DECREF(old_mro); - - return r; - - bail: - Py_DECREF(type->tp_bases); - Py_DECREF(type->tp_base); - if (type->tp_mro != old_mro) { - Py_DECREF(type->tp_mro); - } - - type->tp_bases = old_bases; - type->tp_base = old_base; - type->tp_mro = old_mro; - - return -1; -} - -static PyObject * -type_dict(PyTypeObject *type, void *context) -{ - if (type->tp_dict == NULL) { - Py_INCREF(Py_None); - return Py_None; - } - return PyDictProxy_New(type->tp_dict); -} - -static PyObject * -type_get_doc(PyTypeObject *type, void *context) -{ - PyObject *result; - if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE) && type->tp_doc != NULL) - return PyString_FromString(type->tp_doc); - result = PyDict_GetItemString(type->tp_dict, "__doc__"); - if (result == NULL) { - result = Py_None; - Py_INCREF(result); - } - else if (Py_TYPE(result)->tp_descr_get) { - result = Py_TYPE(result)->tp_descr_get(result, NULL, - (PyObject *)type); - } - else { - Py_INCREF(result); - } - return result; -} - -static PyObject * -type___instancecheck__(PyObject *type, PyObject *inst) -{ - switch (_PyObject_RealIsInstance(inst, type)) { - case -1: - return NULL; - case 0: - Py_RETURN_FALSE; - default: - Py_RETURN_TRUE; - } -} - - -static PyObject * -type___subclasscheck__(PyObject *type, PyObject *inst) -{ - switch (_PyObject_RealIsSubclass(inst, type)) { - case -1: - return NULL; - case 0: - Py_RETURN_FALSE; - default: - Py_RETURN_TRUE; - } -} - - -static PyGetSetDef type_getsets[] = { - {"__name__", (getter)type_name, (setter)type_set_name, NULL}, - {"__bases__", (getter)type_get_bases, (setter)type_set_bases, NULL}, - {"__module__", (getter)type_module, (setter)type_set_module, NULL}, - {"__abstractmethods__", (getter)type_abstractmethods, - (setter)type_set_abstractmethods, NULL}, - {"__dict__", (getter)type_dict, NULL, NULL}, - {"__doc__", (getter)type_get_doc, NULL, NULL}, - {0} -}; - - -static PyObject* -type_richcompare(PyObject *v, PyObject *w, int op) -{ - PyObject *result; - Py_uintptr_t vv, ww; - int c; - - /* Make sure both arguments are types. */ - if (!PyType_Check(v) || !PyType_Check(w) || - /* If there is a __cmp__ method defined, let it be called instead - of our dumb function designed merely to warn. See bug - #7491. */ - Py_TYPE(v)->tp_compare || Py_TYPE(w)->tp_compare) { - result = Py_NotImplemented; - goto out; - } - - /* Py3K warning if comparison isn't == or != */ - if (Py_Py3kWarningFlag && op != Py_EQ && op != Py_NE && - PyErr_WarnEx(PyExc_DeprecationWarning, - "type inequality comparisons not supported " - "in 3.x", 1) < 0) { - return NULL; - } - - /* Compare addresses */ - vv = (Py_uintptr_t)v; - ww = (Py_uintptr_t)w; - switch (op) { - case Py_LT: c = vv < ww; break; - case Py_LE: c = vv <= ww; break; - case Py_EQ: c = vv == ww; break; - case Py_NE: c = vv != ww; break; - case Py_GT: c = vv > ww; break; - case Py_GE: c = vv >= ww; break; - default: - result = Py_NotImplemented; - goto out; - } - result = c ? Py_True : Py_False; - - /* incref and return */ - out: - Py_INCREF(result); - return result; -} - -static PyObject * -type_repr(PyTypeObject *type) -{ - PyObject *mod, *name, *rtn; - char *kind; - - mod = type_module(type, NULL); - if (mod == NULL) - PyErr_Clear(); - else if (!PyString_Check(mod)) { - Py_DECREF(mod); - mod = NULL; - } - name = type_name(type, NULL); - if (name == NULL) { - Py_XDECREF(mod); - return NULL; - } - - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) - kind = "class"; - else - kind = "type"; - - if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) { - rtn = PyString_FromFormat("<%s '%s.%s'>", - kind, - PyString_AS_STRING(mod), - PyString_AS_STRING(name)); - } - else - rtn = PyString_FromFormat("<%s '%s'>", kind, type->tp_name); - - Py_XDECREF(mod); - Py_DECREF(name); - return rtn; -} - -static PyObject * -type_call(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *obj; - - if (type->tp_new == NULL) { - PyErr_Format(PyExc_TypeError, - "cannot create '%.100s' instances", - type->tp_name); - return NULL; - } - - obj = type->tp_new(type, args, kwds); - if (obj != NULL) { - /* Ugly exception: when the call was type(something), - don't call tp_init on the result. */ - if (type == &PyType_Type && - PyTuple_Check(args) && PyTuple_GET_SIZE(args) == 1 && - (kwds == NULL || - (PyDict_Check(kwds) && PyDict_Size(kwds) == 0))) - return obj; - /* If the returned object is not an instance of type, - it won't be initialized. */ - if (!PyType_IsSubtype(obj->ob_type, type)) - return obj; - type = obj->ob_type; - if (PyType_HasFeature(type, Py_TPFLAGS_HAVE_CLASS) && - type->tp_init != NULL && - type->tp_init(obj, args, kwds) < 0) { - Py_DECREF(obj); - obj = NULL; - } - } - return obj; -} - -PyObject * -PyType_GenericAlloc(PyTypeObject *type, Py_ssize_t nitems) -{ - PyObject *obj; - const size_t size = _PyObject_VAR_SIZE(type, nitems+1); - /* note that we need to add one, for the sentinel */ - - if (PyType_IS_GC(type)) - obj = _PyObject_GC_Malloc(size); - else - obj = (PyObject *)PyObject_MALLOC(size); - - if (obj == NULL) - return PyErr_NoMemory(); - - memset(obj, '\0', size); - - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) - Py_INCREF(type); - - if (type->tp_itemsize == 0) - PyObject_INIT(obj, type); - else - (void) PyObject_INIT_VAR((PyVarObject *)obj, type, nitems); - - if (PyType_IS_GC(type)) - _PyObject_GC_TRACK(obj); - return obj; -} - -PyObject * -PyType_GenericNew(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - return type->tp_alloc(type, 0); -} - -/* Helpers for subtyping */ - -static int -traverse_slots(PyTypeObject *type, PyObject *self, visitproc visit, void *arg) -{ - Py_ssize_t i, n; - PyMemberDef *mp; - - n = Py_SIZE(type); - mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type); - for (i = 0; i < n; i++, mp++) { - if (mp->type == T_OBJECT_EX) { - char *addr = (char *)self + mp->offset; - PyObject *obj = *(PyObject **)addr; - if (obj != NULL) { - int err = visit(obj, arg); - if (err) - return err; - } - } - } - return 0; -} - -static int -subtype_traverse(PyObject *self, visitproc visit, void *arg) -{ - PyTypeObject *type, *base; - traverseproc basetraverse; - - /* Find the nearest base with a different tp_traverse, - and traverse slots while we're at it */ - type = Py_TYPE(self); - base = type; - while ((basetraverse = base->tp_traverse) == subtype_traverse) { - if (Py_SIZE(base)) { - int err = traverse_slots(base, self, visit, arg); - if (err) - return err; - } - base = base->tp_base; - assert(base); - } - - if (type->tp_dictoffset != base->tp_dictoffset) { - PyObject **dictptr = _PyObject_GetDictPtr(self); - if (dictptr && *dictptr) - Py_VISIT(*dictptr); - } - - if (type->tp_flags & Py_TPFLAGS_HEAPTYPE) - /* For a heaptype, the instances count as references - to the type. Traverse the type so the collector - can find cycles involving this link. */ - Py_VISIT(type); - - if (basetraverse) - return basetraverse(self, visit, arg); - return 0; -} - -static void -clear_slots(PyTypeObject *type, PyObject *self) -{ - Py_ssize_t i, n; - PyMemberDef *mp; - - n = Py_SIZE(type); - mp = PyHeapType_GET_MEMBERS((PyHeapTypeObject *)type); - for (i = 0; i < n; i++, mp++) { - if (mp->type == T_OBJECT_EX && !(mp->flags & READONLY)) { - char *addr = (char *)self + mp->offset; - PyObject *obj = *(PyObject **)addr; - if (obj != NULL) { - *(PyObject **)addr = NULL; - Py_DECREF(obj); - } - } - } -} - -static int -subtype_clear(PyObject *self) -{ - PyTypeObject *type, *base; - inquiry baseclear; - - /* Find the nearest base with a different tp_clear - and clear slots while we're at it */ - type = Py_TYPE(self); - base = type; - while ((baseclear = base->tp_clear) == subtype_clear) { - if (Py_SIZE(base)) - clear_slots(base, self); - base = base->tp_base; - assert(base); - } - - /* Clear the instance dict (if any), to break cycles involving only - __dict__ slots (as in the case 'self.__dict__ is self'). */ - if (type->tp_dictoffset != base->tp_dictoffset) { - PyObject **dictptr = _PyObject_GetDictPtr(self); - if (dictptr && *dictptr) - Py_CLEAR(*dictptr); - } - - if (baseclear) - return baseclear(self); - return 0; -} - -static void -subtype_dealloc(PyObject *self) -{ - PyTypeObject *type, *base; - destructor basedealloc; - PyThreadState *tstate = PyThreadState_GET(); - - /* Extract the type; we expect it to be a heap type */ - type = Py_TYPE(self); - assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); - - /* Test whether the type has GC exactly once */ - - if (!PyType_IS_GC(type)) { - /* It's really rare to find a dynamic type that doesn't have - GC; it can only happen when deriving from 'object' and not - adding any slots or instance variables. This allows - certain simplifications: there's no need to call - clear_slots(), or DECREF the dict, or clear weakrefs. */ - - /* Maybe call finalizer; exit early if resurrected */ - if (type->tp_del) { - type->tp_del(self); - if (self->ob_refcnt > 0) - return; - } - - /* Find the nearest base with a different tp_dealloc */ - base = type; - while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { - assert(Py_SIZE(base) == 0); - base = base->tp_base; - assert(base); - } - - /* Extract the type again; tp_del may have changed it */ - type = Py_TYPE(self); - - /* Call the base tp_dealloc() */ - assert(basedealloc); - basedealloc(self); - - /* Can't reference self beyond this point */ - Py_DECREF(type); - - /* Done */ - return; - } - - /* We get here only if the type has GC */ - - /* UnTrack and re-Track around the trashcan macro, alas */ - /* See explanation at end of function for full disclosure */ - PyObject_GC_UnTrack(self); - ++_PyTrash_delete_nesting; - ++ tstate->trash_delete_nesting; - Py_TRASHCAN_SAFE_BEGIN(self); - --_PyTrash_delete_nesting; - -- tstate->trash_delete_nesting; - /* DO NOT restore GC tracking at this point. weakref callbacks - * (if any, and whether directly here or indirectly in something we - * call) may trigger GC, and if self is tracked at that point, it - * will look like trash to GC and GC will try to delete self again. - */ - - /* Find the nearest base with a different tp_dealloc */ - base = type; - while ((basedealloc = base->tp_dealloc) == subtype_dealloc) { - base = base->tp_base; - assert(base); - } - - /* If we added a weaklist, we clear it. Do this *before* calling - the finalizer (__del__), clearing slots, or clearing the instance - dict. */ - - if (type->tp_weaklistoffset && !base->tp_weaklistoffset) - PyObject_ClearWeakRefs(self); - - /* Maybe call finalizer; exit early if resurrected */ - if (type->tp_del) { - _PyObject_GC_TRACK(self); - type->tp_del(self); - if (self->ob_refcnt > 0) - goto endlabel; /* resurrected */ - else - _PyObject_GC_UNTRACK(self); - /* New weakrefs could be created during the finalizer call. - If this occurs, clear them out without calling their - finalizers since they might rely on part of the object - being finalized that has already been destroyed. */ - if (type->tp_weaklistoffset && !base->tp_weaklistoffset) { - /* Modeled after GET_WEAKREFS_LISTPTR() */ - PyWeakReference **list = (PyWeakReference **) \ - PyObject_GET_WEAKREFS_LISTPTR(self); - while (*list) - _PyWeakref_ClearRef(*list); - } - } - - /* Clear slots up to the nearest base with a different tp_dealloc */ - base = type; - while (base->tp_dealloc == subtype_dealloc) { - if (Py_SIZE(base)) - clear_slots(base, self); - base = base->tp_base; - assert(base); - } - - /* If we added a dict, DECREF it */ - if (type->tp_dictoffset && !base->tp_dictoffset) { - PyObject **dictptr = _PyObject_GetDictPtr(self); - if (dictptr != NULL) { - PyObject *dict = *dictptr; - if (dict != NULL) { - Py_DECREF(dict); - *dictptr = NULL; - } - } - } - - /* Extract the type again; tp_del may have changed it */ - type = Py_TYPE(self); - - /* Call the base tp_dealloc(); first retrack self if - * basedealloc knows about gc. - */ - if (PyType_IS_GC(base)) - _PyObject_GC_TRACK(self); - assert(basedealloc); - basedealloc(self); - - /* Can't reference self beyond this point */ - Py_DECREF(type); - - endlabel: - ++_PyTrash_delete_nesting; - ++ tstate->trash_delete_nesting; - Py_TRASHCAN_SAFE_END(self); - --_PyTrash_delete_nesting; - -- tstate->trash_delete_nesting; - - /* Explanation of the weirdness around the trashcan macros: - - Q. What do the trashcan macros do? - - A. Read the comment titled "Trashcan mechanism" in object.h. - For one, this explains why there must be a call to GC-untrack - before the trashcan begin macro. Without understanding the - trashcan code, the answers to the following questions don't make - sense. - - Q. Why do we GC-untrack before the trashcan and then immediately - GC-track again afterward? - - A. In the case that the base class is GC-aware, the base class - probably GC-untracks the object. If it does that using the - UNTRACK macro, this will crash when the object is already - untracked. Because we don't know what the base class does, the - only safe thing is to make sure the object is tracked when we - call the base class dealloc. But... The trashcan begin macro - requires that the object is *untracked* before it is called. So - the dance becomes: - - GC untrack - trashcan begin - GC track - - Q. Why did the last question say "immediately GC-track again"? - It's nowhere near immediately. - - A. Because the code *used* to re-track immediately. Bad Idea. - self has a refcount of 0, and if gc ever gets its hands on it - (which can happen if any weakref callback gets invoked), it - looks like trash to gc too, and gc also tries to delete self - then. But we're already deleting self. Double deallocation is - a subtle disaster. - - Q. Why the bizarre (net-zero) manipulation of - _PyTrash_delete_nesting around the trashcan macros? - - A. Some base classes (e.g. list) also use the trashcan mechanism. - The following scenario used to be possible: - - - suppose the trashcan level is one below the trashcan limit - - - subtype_dealloc() is called - - - the trashcan limit is not yet reached, so the trashcan level - is incremented and the code between trashcan begin and end is - executed - - - this destroys much of the object's contents, including its - slots and __dict__ - - - basedealloc() is called; this is really list_dealloc(), or - some other type which also uses the trashcan macros - - - the trashcan limit is now reached, so the object is put on the - trashcan's to-be-deleted-later list - - - basedealloc() returns - - - subtype_dealloc() decrefs the object's type - - - subtype_dealloc() returns - - - later, the trashcan code starts deleting the objects from its - to-be-deleted-later list - - - subtype_dealloc() is called *AGAIN* for the same object - - - at the very least (if the destroyed slots and __dict__ don't - cause problems) the object's type gets decref'ed a second - time, which is *BAD*!!! - - The remedy is to make sure that if the code between trashcan - begin and end in subtype_dealloc() is called, the code between - trashcan begin and end in basedealloc() will also be called. - This is done by decrementing the level after passing into the - trashcan block, and incrementing it just before leaving the - block. - - But now it's possible that a chain of objects consisting solely - of objects whose deallocator is subtype_dealloc() will defeat - the trashcan mechanism completely: the decremented level means - that the effective level never reaches the limit. Therefore, we - *increment* the level *before* entering the trashcan block, and - matchingly decrement it after leaving. This means the trashcan - code will trigger a little early, but that's no big deal. - - Q. Are there any live examples of code in need of all this - complexity? - - A. Yes. See SF bug 668433 for code that crashed (when Python was - compiled in debug mode) before the trashcan level manipulations - were added. For more discussion, see SF patches 581742, 575073 - and bug 574207. - */ -} - -static PyTypeObject *solid_base(PyTypeObject *type); - -/* type test with subclassing support */ - -int -PyType_IsSubtype(PyTypeObject *a, PyTypeObject *b) -{ - PyObject *mro; - - if (!(a->tp_flags & Py_TPFLAGS_HAVE_CLASS)) - return b == a || b == &PyBaseObject_Type; - - mro = a->tp_mro; - if (mro != NULL) { - /* Deal with multiple inheritance without recursion - by walking the MRO tuple */ - Py_ssize_t i, n; - assert(PyTuple_Check(mro)); - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - if (PyTuple_GET_ITEM(mro, i) == (PyObject *)b) - return 1; - } - return 0; - } - else { - /* a is not completely initilized yet; follow tp_base */ - do { - if (a == b) - return 1; - a = a->tp_base; - } while (a != NULL); - return b == &PyBaseObject_Type; - } -} - -/* Internal routines to do a method lookup in the type - without looking in the instance dictionary - (so we can't use PyObject_GetAttr) but still binding - it to the instance. The arguments are the object, - the method name as a C string, and the address of a - static variable used to cache the interned Python string. - - Two variants: - - - lookup_maybe() returns NULL without raising an exception - when the _PyType_Lookup() call fails; - - - lookup_method() always raises an exception upon errors. - - - _PyObject_LookupSpecial() exported for the benefit of other places. -*/ - -static PyObject * -lookup_maybe(PyObject *self, char *attrstr, PyObject **attrobj) -{ - PyObject *res; - - if (*attrobj == NULL) { - *attrobj = PyString_InternFromString(attrstr); - if (*attrobj == NULL) - return NULL; - } - res = _PyType_Lookup(Py_TYPE(self), *attrobj); - if (res != NULL) { - descrgetfunc f; - if ((f = Py_TYPE(res)->tp_descr_get) == NULL) - Py_INCREF(res); - else - res = f(res, self, (PyObject *)(Py_TYPE(self))); - } - return res; -} - -static PyObject * -lookup_method(PyObject *self, char *attrstr, PyObject **attrobj) -{ - PyObject *res = lookup_maybe(self, attrstr, attrobj); - if (res == NULL && !PyErr_Occurred()) - PyErr_SetObject(PyExc_AttributeError, *attrobj); - return res; -} - -PyObject * -_PyObject_LookupSpecial(PyObject *self, char *attrstr, PyObject **attrobj) -{ - assert(!PyInstance_Check(self)); - return lookup_maybe(self, attrstr, attrobj); -} - -/* A variation of PyObject_CallMethod that uses lookup_method() - instead of PyObject_GetAttrString(). This uses the same convention - as lookup_method to cache the interned name string object. */ - -static PyObject * -call_method(PyObject *o, char *name, PyObject **nameobj, char *format, ...) -{ - va_list va; - PyObject *args, *func = 0, *retval; - va_start(va, format); - - func = lookup_maybe(o, name, nameobj); - if (func == NULL) { - va_end(va); - if (!PyErr_Occurred()) - PyErr_SetObject(PyExc_AttributeError, *nameobj); - return NULL; - } - - if (format && *format) - args = Py_VaBuildValue(format, va); - else - args = PyTuple_New(0); - - va_end(va); - - if (args == NULL) - return NULL; - - assert(PyTuple_Check(args)); - retval = PyObject_Call(func, args, NULL); - - Py_DECREF(args); - Py_DECREF(func); - - return retval; -} - -/* Clone of call_method() that returns NotImplemented when the lookup fails. */ - -static PyObject * -call_maybe(PyObject *o, char *name, PyObject **nameobj, char *format, ...) -{ - va_list va; - PyObject *args, *func = 0, *retval; - va_start(va, format); - - func = lookup_maybe(o, name, nameobj); - if (func == NULL) { - va_end(va); - if (!PyErr_Occurred()) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return NULL; - } - - if (format && *format) - args = Py_VaBuildValue(format, va); - else - args = PyTuple_New(0); - - va_end(va); - - if (args == NULL) - return NULL; - - assert(PyTuple_Check(args)); - retval = PyObject_Call(func, args, NULL); - - Py_DECREF(args); - Py_DECREF(func); - - return retval; -} - -static int -fill_classic_mro(PyObject *mro, PyObject *cls) -{ - PyObject *bases, *base; - Py_ssize_t i, n; - - assert(PyList_Check(mro)); - assert(PyClass_Check(cls)); - i = PySequence_Contains(mro, cls); - if (i < 0) - return -1; - if (!i) { - if (PyList_Append(mro, cls) < 0) - return -1; - } - bases = ((PyClassObject *)cls)->cl_bases; - assert(bases && PyTuple_Check(bases)); - n = PyTuple_GET_SIZE(bases); - for (i = 0; i < n; i++) { - base = PyTuple_GET_ITEM(bases, i); - if (fill_classic_mro(mro, base) < 0) - return -1; - } - return 0; -} - -static PyObject * -classic_mro(PyObject *cls) -{ - PyObject *mro; - - assert(PyClass_Check(cls)); - mro = PyList_New(0); - if (mro != NULL) { - if (fill_classic_mro(mro, cls) == 0) - return mro; - Py_DECREF(mro); - } - return NULL; -} - -/* - Method resolution order algorithm C3 described in - "A Monotonic Superclass Linearization for Dylan", - by Kim Barrett, Bob Cassel, Paul Haahr, - David A. Moon, Keith Playford, and P. Tucker Withington. - (OOPSLA 1996) - - Some notes about the rules implied by C3: - - No duplicate bases. - It isn't legal to repeat a class in a list of base classes. - - The next three properties are the 3 constraints in "C3". - - Local precendece order. - If A precedes B in C's MRO, then A will precede B in the MRO of all - subclasses of C. - - Monotonicity. - The MRO of a class must be an extension without reordering of the - MRO of each of its superclasses. - - Extended Precedence Graph (EPG). - Linearization is consistent if there is a path in the EPG from - each class to all its successors in the linearization. See - the paper for definition of EPG. - */ - -static int -tail_contains(PyObject *list, int whence, PyObject *o) { - Py_ssize_t j, size; - size = PyList_GET_SIZE(list); - - for (j = whence+1; j < size; j++) { - if (PyList_GET_ITEM(list, j) == o) - return 1; - } - return 0; -} - -static PyObject * -class_name(PyObject *cls) -{ - PyObject *name = PyObject_GetAttrString(cls, "__name__"); - if (name == NULL) { - PyErr_Clear(); - Py_XDECREF(name); - name = PyObject_Repr(cls); - } - if (name == NULL) - return NULL; - if (!PyString_Check(name)) { - Py_DECREF(name); - return NULL; - } - return name; -} - -static int -check_duplicates(PyObject *list) -{ - Py_ssize_t i, j, n; - /* Let's use a quadratic time algorithm, - assuming that the bases lists is short. - */ - n = PyList_GET_SIZE(list); - for (i = 0; i < n; i++) { - PyObject *o = PyList_GET_ITEM(list, i); - for (j = i + 1; j < n; j++) { - if (PyList_GET_ITEM(list, j) == o) { - o = class_name(o); - PyErr_Format(PyExc_TypeError, - "duplicate base class %s", - o ? PyString_AS_STRING(o) : "?"); - Py_XDECREF(o); - return -1; - } - } - } - return 0; -} - -/* Raise a TypeError for an MRO order disagreement. - - It's hard to produce a good error message. In the absence of better - insight into error reporting, report the classes that were candidates - to be put next into the MRO. There is some conflict between the - order in which they should be put in the MRO, but it's hard to - diagnose what constraint can't be satisfied. -*/ - -static void -set_mro_error(PyObject *to_merge, int *remain) -{ - Py_ssize_t i, n, off, to_merge_size; - char buf[1000]; - PyObject *k, *v; - PyObject *set = PyDict_New(); - if (!set) return; - - to_merge_size = PyList_GET_SIZE(to_merge); - for (i = 0; i < to_merge_size; i++) { - PyObject *L = PyList_GET_ITEM(to_merge, i); - if (remain[i] < PyList_GET_SIZE(L)) { - PyObject *c = PyList_GET_ITEM(L, remain[i]); - if (PyDict_SetItem(set, c, Py_None) < 0) { - Py_DECREF(set); - return; - } - } - } - n = PyDict_Size(set); - - off = PyOS_snprintf(buf, sizeof(buf), "Cannot create a \ -consistent method resolution\norder (MRO) for bases"); - i = 0; - while (PyDict_Next(set, &i, &k, &v) && (size_t)off < sizeof(buf)) { - PyObject *name = class_name(k); - off += PyOS_snprintf(buf + off, sizeof(buf) - off, " %s", - name ? PyString_AS_STRING(name) : "?"); - Py_XDECREF(name); - if (--n && (size_t)(off+1) < sizeof(buf)) { - buf[off++] = ','; - buf[off] = '\0'; - } - } - PyErr_SetString(PyExc_TypeError, buf); - Py_DECREF(set); -} - -static int -pmerge(PyObject *acc, PyObject* to_merge) { - Py_ssize_t i, j, to_merge_size, empty_cnt; - int *remain; - int ok; - - to_merge_size = PyList_GET_SIZE(to_merge); - - /* remain stores an index into each sublist of to_merge. - remain[i] is the index of the next base in to_merge[i] - that is not included in acc. - */ - remain = (int *)PyMem_MALLOC(SIZEOF_INT*to_merge_size); - if (remain == NULL) - return -1; - for (i = 0; i < to_merge_size; i++) - remain[i] = 0; - - again: - empty_cnt = 0; - for (i = 0; i < to_merge_size; i++) { - PyObject *candidate; - - PyObject *cur_list = PyList_GET_ITEM(to_merge, i); - - if (remain[i] >= PyList_GET_SIZE(cur_list)) { - empty_cnt++; - continue; - } - - /* Choose next candidate for MRO. - - The input sequences alone can determine the choice. - If not, choose the class which appears in the MRO - of the earliest direct superclass of the new class. - */ - - candidate = PyList_GET_ITEM(cur_list, remain[i]); - for (j = 0; j < to_merge_size; j++) { - PyObject *j_lst = PyList_GET_ITEM(to_merge, j); - if (tail_contains(j_lst, remain[j], candidate)) { - goto skip; /* continue outer loop */ - } - } - ok = PyList_Append(acc, candidate); - if (ok < 0) { - PyMem_Free(remain); - return -1; - } - for (j = 0; j < to_merge_size; j++) { - PyObject *j_lst = PyList_GET_ITEM(to_merge, j); - if (remain[j] < PyList_GET_SIZE(j_lst) && - PyList_GET_ITEM(j_lst, remain[j]) == candidate) { - remain[j]++; - } - } - goto again; - skip: ; - } - - if (empty_cnt == to_merge_size) { - PyMem_FREE(remain); - return 0; - } - set_mro_error(to_merge, remain); - PyMem_FREE(remain); - return -1; -} - -static PyObject * -mro_implementation(PyTypeObject *type) -{ - Py_ssize_t i, n; - int ok; - PyObject *bases, *result; - PyObject *to_merge, *bases_aslist; - - if (type->tp_dict == NULL) { - if (PyType_Ready(type) < 0) - return NULL; - } - - /* Find a superclass linearization that honors the constraints - of the explicit lists of bases and the constraints implied by - each base class. - - to_merge is a list of lists, where each list is a superclass - linearization implied by a base class. The last element of - to_merge is the declared list of bases. - */ - - bases = type->tp_bases; - n = PyTuple_GET_SIZE(bases); - - to_merge = PyList_New(n+1); - if (to_merge == NULL) - return NULL; - - for (i = 0; i < n; i++) { - PyObject *base = PyTuple_GET_ITEM(bases, i); - PyObject *parentMRO; - if (PyType_Check(base)) - parentMRO = PySequence_List( - ((PyTypeObject*)base)->tp_mro); - else - parentMRO = classic_mro(base); - if (parentMRO == NULL) { - Py_DECREF(to_merge); - return NULL; - } - - PyList_SET_ITEM(to_merge, i, parentMRO); - } - - bases_aslist = PySequence_List(bases); - if (bases_aslist == NULL) { - Py_DECREF(to_merge); - return NULL; - } - /* This is just a basic sanity check. */ - if (check_duplicates(bases_aslist) < 0) { - Py_DECREF(to_merge); - Py_DECREF(bases_aslist); - return NULL; - } - PyList_SET_ITEM(to_merge, n, bases_aslist); - - result = Py_BuildValue("[O]", (PyObject *)type); - if (result == NULL) { - Py_DECREF(to_merge); - return NULL; - } - - ok = pmerge(result, to_merge); - Py_DECREF(to_merge); - if (ok < 0) { - Py_DECREF(result); - return NULL; - } - - return result; -} - -static PyObject * -mro_external(PyObject *self) -{ - PyTypeObject *type = (PyTypeObject *)self; - - return mro_implementation(type); -} - -static int -mro_internal(PyTypeObject *type) -{ - PyObject *mro, *result, *tuple; - int checkit = 0; - - if (Py_TYPE(type) == &PyType_Type) { - result = mro_implementation(type); - } - else { - static PyObject *mro_str; - checkit = 1; - mro = lookup_method((PyObject *)type, "mro", &mro_str); - if (mro == NULL) - return -1; - result = PyObject_CallObject(mro, NULL); - Py_DECREF(mro); - } - if (result == NULL) - return -1; - tuple = PySequence_Tuple(result); - Py_DECREF(result); - if (tuple == NULL) - return -1; - if (checkit) { - Py_ssize_t i, len; - PyObject *cls; - PyTypeObject *solid; - - solid = solid_base(type); - - len = PyTuple_GET_SIZE(tuple); - - for (i = 0; i < len; i++) { - PyTypeObject *t; - cls = PyTuple_GET_ITEM(tuple, i); - if (PyClass_Check(cls)) - continue; - else if (!PyType_Check(cls)) { - PyErr_Format(PyExc_TypeError, - "mro() returned a non-class ('%.500s')", - Py_TYPE(cls)->tp_name); - Py_DECREF(tuple); - return -1; - } - t = (PyTypeObject*)cls; - if (!PyType_IsSubtype(solid, solid_base(t))) { - PyErr_Format(PyExc_TypeError, - "mro() returned base with unsuitable layout ('%.500s')", - t->tp_name); - Py_DECREF(tuple); - return -1; - } - } - } - type->tp_mro = tuple; - - type_mro_modified(type, type->tp_mro); - /* corner case: the old-style super class might have been hidden - from the custom MRO */ - type_mro_modified(type, type->tp_bases); - - PyType_Modified(type); - - return 0; -} - - -/* Calculate the best base amongst multiple base classes. - This is the first one that's on the path to the "solid base". */ - -static PyTypeObject * -best_base(PyObject *bases) -{ - Py_ssize_t i, n; - PyTypeObject *base, *winner, *candidate, *base_i; - PyObject *base_proto; - - assert(PyTuple_Check(bases)); - n = PyTuple_GET_SIZE(bases); - assert(n > 0); - base = NULL; - winner = NULL; - for (i = 0; i < n; i++) { - base_proto = PyTuple_GET_ITEM(bases, i); - if (PyClass_Check(base_proto)) - continue; - if (!PyType_Check(base_proto)) { - PyErr_SetString( - PyExc_TypeError, - "bases must be types"); - return NULL; - } - base_i = (PyTypeObject *)base_proto; - if (base_i->tp_dict == NULL) { - if (PyType_Ready(base_i) < 0) - return NULL; - } - candidate = solid_base(base_i); - if (winner == NULL) { - winner = candidate; - base = base_i; - } - else if (PyType_IsSubtype(winner, candidate)) - ; - else if (PyType_IsSubtype(candidate, winner)) { - winner = candidate; - base = base_i; - } - else { - PyErr_SetString( - PyExc_TypeError, - "multiple bases have " - "instance lay-out conflict"); - return NULL; - } - } - if (base == NULL) - PyErr_SetString(PyExc_TypeError, - "a new-style class can't have only classic bases"); - return base; -} - -static int -extra_ivars(PyTypeObject *type, PyTypeObject *base) -{ - size_t t_size = type->tp_basicsize; - size_t b_size = base->tp_basicsize; - - assert(t_size >= b_size); /* Else type smaller than base! */ - if (type->tp_itemsize || base->tp_itemsize) { - /* If itemsize is involved, stricter rules */ - return t_size != b_size || - type->tp_itemsize != base->tp_itemsize; - } - if (type->tp_weaklistoffset && base->tp_weaklistoffset == 0 && - type->tp_weaklistoffset + sizeof(PyObject *) == t_size && - type->tp_flags & Py_TPFLAGS_HEAPTYPE) - t_size -= sizeof(PyObject *); - if (type->tp_dictoffset && base->tp_dictoffset == 0 && - type->tp_dictoffset + sizeof(PyObject *) == t_size && - type->tp_flags & Py_TPFLAGS_HEAPTYPE) - t_size -= sizeof(PyObject *); - - return t_size != b_size; -} - -static PyTypeObject * -solid_base(PyTypeObject *type) -{ - PyTypeObject *base; - - if (type->tp_base) - base = solid_base(type->tp_base); - else - base = &PyBaseObject_Type; - if (extra_ivars(type, base)) - return type; - else - return base; -} - -static void object_dealloc(PyObject *); -static int object_init(PyObject *, PyObject *, PyObject *); -static int update_slot(PyTypeObject *, PyObject *); -static void fixup_slot_dispatchers(PyTypeObject *); - -/* - * Helpers for __dict__ descriptor. We don't want to expose the dicts - * inherited from various builtin types. The builtin base usually provides - * its own __dict__ descriptor, so we use that when we can. - */ -static PyTypeObject * -get_builtin_base_with_dict(PyTypeObject *type) -{ - while (type->tp_base != NULL) { - if (type->tp_dictoffset != 0 && - !(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) - return type; - type = type->tp_base; - } - return NULL; -} - -static PyObject * -get_dict_descriptor(PyTypeObject *type) -{ - static PyObject *dict_str; - PyObject *descr; - - if (dict_str == NULL) { - dict_str = PyString_InternFromString("__dict__"); - if (dict_str == NULL) - return NULL; - } - descr = _PyType_Lookup(type, dict_str); - if (descr == NULL || !PyDescr_IsData(descr)) - return NULL; - - return descr; -} - -static void -raise_dict_descr_error(PyObject *obj) -{ - PyErr_Format(PyExc_TypeError, - "this __dict__ descriptor does not support " - "'%.200s' objects", obj->ob_type->tp_name); -} - -static PyObject * -subtype_dict(PyObject *obj, void *context) -{ - PyObject **dictptr; - PyObject *dict; - PyTypeObject *base; - - base = get_builtin_base_with_dict(obj->ob_type); - if (base != NULL) { - descrgetfunc func; - PyObject *descr = get_dict_descriptor(base); - if (descr == NULL) { - raise_dict_descr_error(obj); - return NULL; - } - func = descr->ob_type->tp_descr_get; - if (func == NULL) { - raise_dict_descr_error(obj); - return NULL; - } - return func(descr, obj, (PyObject *)(obj->ob_type)); - } - - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr == NULL) { - PyErr_SetString(PyExc_AttributeError, - "This object has no __dict__"); - return NULL; - } - dict = *dictptr; - if (dict == NULL) - *dictptr = dict = PyDict_New(); - Py_XINCREF(dict); - return dict; -} - -static int -subtype_setdict(PyObject *obj, PyObject *value, void *context) -{ - PyObject **dictptr; - PyObject *dict; - PyTypeObject *base; - - base = get_builtin_base_with_dict(obj->ob_type); - if (base != NULL) { - descrsetfunc func; - PyObject *descr = get_dict_descriptor(base); - if (descr == NULL) { - raise_dict_descr_error(obj); - return -1; - } - func = descr->ob_type->tp_descr_set; - if (func == NULL) { - raise_dict_descr_error(obj); - return -1; - } - return func(descr, obj, value); - } - - dictptr = _PyObject_GetDictPtr(obj); - if (dictptr == NULL) { - PyErr_SetString(PyExc_AttributeError, - "This object has no __dict__"); - return -1; - } - if (value != NULL && !PyDict_Check(value)) { - PyErr_Format(PyExc_TypeError, - "__dict__ must be set to a dictionary, " - "not a '%.200s'", Py_TYPE(value)->tp_name); - return -1; - } - dict = *dictptr; - Py_XINCREF(value); - *dictptr = value; - Py_XDECREF(dict); - return 0; -} - -static PyObject * -subtype_getweakref(PyObject *obj, void *context) -{ - PyObject **weaklistptr; - PyObject *result; - - if (Py_TYPE(obj)->tp_weaklistoffset == 0) { - PyErr_SetString(PyExc_AttributeError, - "This object has no __weakref__"); - return NULL; - } - assert(Py_TYPE(obj)->tp_weaklistoffset > 0); - assert(Py_TYPE(obj)->tp_weaklistoffset + sizeof(PyObject *) <= - (size_t)(Py_TYPE(obj)->tp_basicsize)); - weaklistptr = (PyObject **) - ((char *)obj + Py_TYPE(obj)->tp_weaklistoffset); - if (*weaklistptr == NULL) - result = Py_None; - else - result = *weaklistptr; - Py_INCREF(result); - return result; -} - -/* Three variants on the subtype_getsets list. */ - -static PyGetSetDef subtype_getsets_full[] = { - {"__dict__", subtype_dict, subtype_setdict, - PyDoc_STR("dictionary for instance variables (if defined)")}, - {"__weakref__", subtype_getweakref, NULL, - PyDoc_STR("list of weak references to the object (if defined)")}, - {0} -}; - -static PyGetSetDef subtype_getsets_dict_only[] = { - {"__dict__", subtype_dict, subtype_setdict, - PyDoc_STR("dictionary for instance variables (if defined)")}, - {0} -}; - -static PyGetSetDef subtype_getsets_weakref_only[] = { - {"__weakref__", subtype_getweakref, NULL, - PyDoc_STR("list of weak references to the object (if defined)")}, - {0} -}; - -static int -valid_identifier(PyObject *s) -{ - unsigned char *p; - Py_ssize_t i, n; - - if (!PyString_Check(s)) { - PyErr_Format(PyExc_TypeError, - "__slots__ items must be strings, not '%.200s'", - Py_TYPE(s)->tp_name); - return 0; - } - p = (unsigned char *) PyString_AS_STRING(s); - n = PyString_GET_SIZE(s); - /* We must reject an empty name. As a hack, we bump the - length to 1 so that the loop will balk on the trailing \0. */ - if (n == 0) - n = 1; - for (i = 0; i < n; i++, p++) { - if (!(i == 0 ? isalpha(*p) : isalnum(*p)) && *p != '_') { - PyErr_SetString(PyExc_TypeError, - "__slots__ must be identifiers"); - return 0; - } - } - return 1; -} - -#ifdef Py_USING_UNICODE -/* Replace Unicode objects in slots. */ - -static PyObject * -_unicode_to_string(PyObject *slots, Py_ssize_t nslots) -{ - PyObject *tmp = NULL; - PyObject *slot_name, *new_name; - Py_ssize_t i; - - for (i = 0; i < nslots; i++) { - if (PyUnicode_Check(slot_name = PyTuple_GET_ITEM(slots, i))) { - if (tmp == NULL) { - tmp = PySequence_List(slots); - if (tmp == NULL) - return NULL; - } - new_name = _PyUnicode_AsDefaultEncodedString(slot_name, - NULL); - if (new_name == NULL) { - Py_DECREF(tmp); - return NULL; - } - Py_INCREF(new_name); - PyList_SET_ITEM(tmp, i, new_name); - Py_DECREF(slot_name); - } - } - if (tmp != NULL) { - slots = PyList_AsTuple(tmp); - Py_DECREF(tmp); - } - return slots; -} -#endif - -/* Forward */ -static int -object_init(PyObject *self, PyObject *args, PyObject *kwds); - -static int -type_init(PyObject *cls, PyObject *args, PyObject *kwds) -{ - int res; - - assert(args != NULL && PyTuple_Check(args)); - assert(kwds == NULL || PyDict_Check(kwds)); - - if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds) != 0) { - PyErr_SetString(PyExc_TypeError, - "type.__init__() takes no keyword arguments"); - return -1; - } - - if (args != NULL && PyTuple_Check(args) && - (PyTuple_GET_SIZE(args) != 1 && PyTuple_GET_SIZE(args) != 3)) { - PyErr_SetString(PyExc_TypeError, - "type.__init__() takes 1 or 3 arguments"); - return -1; - } - - /* Call object.__init__(self) now. */ - /* XXX Could call super(type, cls).__init__() but what's the point? */ - args = PyTuple_GetSlice(args, 0, 0); - res = object_init(cls, args, NULL); - Py_DECREF(args); - return res; -} - -static PyObject * -type_new(PyTypeObject *metatype, PyObject *args, PyObject *kwds) -{ - PyObject *name, *bases, *dict; - static char *kwlist[] = {"name", "bases", "dict", 0}; - PyObject *slots, *tmp, *newslots; - PyTypeObject *type, *base, *tmptype, *winner; - PyHeapTypeObject *et; - PyMemberDef *mp; - Py_ssize_t i, nbases, nslots, slotoffset, add_dict, add_weak; - int j, may_add_dict, may_add_weak; - - assert(args != NULL && PyTuple_Check(args)); - assert(kwds == NULL || PyDict_Check(kwds)); - - /* Special case: type(x) should return x->ob_type */ - { - const Py_ssize_t nargs = PyTuple_GET_SIZE(args); - const Py_ssize_t nkwds = kwds == NULL ? 0 : PyDict_Size(kwds); - - if (PyType_CheckExact(metatype) && nargs == 1 && nkwds == 0) { - PyObject *x = PyTuple_GET_ITEM(args, 0); - Py_INCREF(Py_TYPE(x)); - return (PyObject *) Py_TYPE(x); - } - - /* SF bug 475327 -- if that didn't trigger, we need 3 - arguments. but PyArg_ParseTupleAndKeywords below may give - a msg saying type() needs exactly 3. */ - if (nargs + nkwds != 3) { - PyErr_SetString(PyExc_TypeError, - "type() takes 1 or 3 arguments"); - return NULL; - } - } - - /* Check arguments: (name, bases, dict) */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "SO!O!:type", kwlist, - &name, - &PyTuple_Type, &bases, - &PyDict_Type, &dict)) - return NULL; - - /* Determine the proper metatype to deal with this, - and check for metatype conflicts while we're at it. - Note that if some other metatype wins to contract, - it's possible that its instances are not types. */ - nbases = PyTuple_GET_SIZE(bases); - winner = metatype; - for (i = 0; i < nbases; i++) { - tmp = PyTuple_GET_ITEM(bases, i); - tmptype = tmp->ob_type; - if (tmptype == &PyClass_Type) - continue; /* Special case classic classes */ - if (PyType_IsSubtype(winner, tmptype)) - continue; - if (PyType_IsSubtype(tmptype, winner)) { - winner = tmptype; - continue; - } - PyErr_SetString(PyExc_TypeError, - "metaclass conflict: " - "the metaclass of a derived class " - "must be a (non-strict) subclass " - "of the metaclasses of all its bases"); - return NULL; - } - if (winner != metatype) { - if (winner->tp_new != type_new) /* Pass it to the winner */ - return winner->tp_new(winner, args, kwds); - metatype = winner; - } - - /* Adjust for empty tuple bases */ - if (nbases == 0) { - bases = PyTuple_Pack(1, &PyBaseObject_Type); - if (bases == NULL) - return NULL; - nbases = 1; - } - else - Py_INCREF(bases); - - /* XXX From here until type is allocated, "return NULL" leaks bases! */ - - /* Calculate best base, and check that all bases are type objects */ - base = best_base(bases); - if (base == NULL) { - Py_DECREF(bases); - return NULL; - } - if (!PyType_HasFeature(base, Py_TPFLAGS_BASETYPE)) { - PyErr_Format(PyExc_TypeError, - "type '%.100s' is not an acceptable base type", - base->tp_name); - Py_DECREF(bases); - return NULL; - } - - /* Check for a __slots__ sequence variable in dict, and count it */ - slots = PyDict_GetItemString(dict, "__slots__"); - nslots = 0; - add_dict = 0; - add_weak = 0; - may_add_dict = base->tp_dictoffset == 0; - may_add_weak = base->tp_weaklistoffset == 0 && base->tp_itemsize == 0; - if (slots == NULL) { - if (may_add_dict) { - add_dict++; - } - if (may_add_weak) { - add_weak++; - } - } - else { - /* Have slots */ - - /* Make it into a tuple */ - if (PyString_Check(slots) || PyUnicode_Check(slots)) - slots = PyTuple_Pack(1, slots); - else - slots = PySequence_Tuple(slots); - if (slots == NULL) { - Py_DECREF(bases); - return NULL; - } - assert(PyTuple_Check(slots)); - - /* Are slots allowed? */ - nslots = PyTuple_GET_SIZE(slots); - if (nslots > 0 && base->tp_itemsize != 0) { - PyErr_Format(PyExc_TypeError, - "nonempty __slots__ " - "not supported for subtype of '%s'", - base->tp_name); - bad_slots: - Py_DECREF(bases); - Py_DECREF(slots); - return NULL; - } - -#ifdef Py_USING_UNICODE - tmp = _unicode_to_string(slots, nslots); - if (tmp == NULL) - goto bad_slots; - if (tmp != slots) { - Py_DECREF(slots); - slots = tmp; - } -#endif - /* Check for valid slot names and two special cases */ - for (i = 0; i < nslots; i++) { - PyObject *tmp = PyTuple_GET_ITEM(slots, i); - char *s; - if (!valid_identifier(tmp)) - goto bad_slots; - assert(PyString_Check(tmp)); - s = PyString_AS_STRING(tmp); - if (strcmp(s, "__dict__") == 0) { - if (!may_add_dict || add_dict) { - PyErr_SetString(PyExc_TypeError, - "__dict__ slot disallowed: " - "we already got one"); - goto bad_slots; - } - add_dict++; - } - if (strcmp(s, "__weakref__") == 0) { - if (!may_add_weak || add_weak) { - PyErr_SetString(PyExc_TypeError, - "__weakref__ slot disallowed: " - "either we already got one, " - "or __itemsize__ != 0"); - goto bad_slots; - } - add_weak++; - } - } - - /* Copy slots into a list, mangle names and sort them. - Sorted names are needed for __class__ assignment. - Convert them back to tuple at the end. - */ - newslots = PyList_New(nslots - add_dict - add_weak); - if (newslots == NULL) - goto bad_slots; - for (i = j = 0; i < nslots; i++) { - char *s; - tmp = PyTuple_GET_ITEM(slots, i); - s = PyString_AS_STRING(tmp); - if ((add_dict && strcmp(s, "__dict__") == 0) || - (add_weak && strcmp(s, "__weakref__") == 0)) - continue; - tmp =_Py_Mangle(name, tmp); - if (!tmp) { - Py_DECREF(newslots); - goto bad_slots; - } - PyList_SET_ITEM(newslots, j, tmp); - j++; - } - assert(j == nslots - add_dict - add_weak); - nslots = j; - Py_DECREF(slots); - if (PyList_Sort(newslots) == -1) { - Py_DECREF(bases); - Py_DECREF(newslots); - return NULL; - } - slots = PyList_AsTuple(newslots); - Py_DECREF(newslots); - if (slots == NULL) { - Py_DECREF(bases); - return NULL; - } - - /* Secondary bases may provide weakrefs or dict */ - if (nbases > 1 && - ((may_add_dict && !add_dict) || - (may_add_weak && !add_weak))) { - for (i = 0; i < nbases; i++) { - tmp = PyTuple_GET_ITEM(bases, i); - if (tmp == (PyObject *)base) - continue; /* Skip primary base */ - if (PyClass_Check(tmp)) { - /* Classic base class provides both */ - if (may_add_dict && !add_dict) - add_dict++; - if (may_add_weak && !add_weak) - add_weak++; - break; - } - assert(PyType_Check(tmp)); - tmptype = (PyTypeObject *)tmp; - if (may_add_dict && !add_dict && - tmptype->tp_dictoffset != 0) - add_dict++; - if (may_add_weak && !add_weak && - tmptype->tp_weaklistoffset != 0) - add_weak++; - if (may_add_dict && !add_dict) - continue; - if (may_add_weak && !add_weak) - continue; - /* Nothing more to check */ - break; - } - } - } - - /* XXX From here until type is safely allocated, - "return NULL" may leak slots! */ - - /* Allocate the type object */ - type = (PyTypeObject *)metatype->tp_alloc(metatype, nslots); - if (type == NULL) { - Py_XDECREF(slots); - Py_DECREF(bases); - return NULL; - } - - /* Keep name and slots alive in the extended type object */ - et = (PyHeapTypeObject *)type; - Py_INCREF(name); - et->ht_name = name; - et->ht_slots = slots; - - /* Initialize tp_flags */ - type->tp_flags = Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HEAPTYPE | - Py_TPFLAGS_BASETYPE; - if (base->tp_flags & Py_TPFLAGS_HAVE_GC) - type->tp_flags |= Py_TPFLAGS_HAVE_GC; - if (base->tp_flags & Py_TPFLAGS_HAVE_NEWBUFFER) - type->tp_flags |= Py_TPFLAGS_HAVE_NEWBUFFER; - - /* It's a new-style number unless it specifically inherits any - old-style numeric behavior */ - if ((base->tp_flags & Py_TPFLAGS_CHECKTYPES) || - (base->tp_as_number == NULL)) - type->tp_flags |= Py_TPFLAGS_CHECKTYPES; - - /* Initialize essential fields */ - type->tp_as_number = &et->as_number; - type->tp_as_sequence = &et->as_sequence; - type->tp_as_mapping = &et->as_mapping; - type->tp_as_buffer = &et->as_buffer; - type->tp_name = PyString_AS_STRING(name); - - /* Set tp_base and tp_bases */ - type->tp_bases = bases; - Py_INCREF(base); - type->tp_base = base; - - /* Initialize tp_dict from passed-in dict */ - type->tp_dict = dict = PyDict_Copy(dict); - if (dict == NULL) { - Py_DECREF(type); - return NULL; - } - - /* Set __module__ in the dict */ - if (PyDict_GetItemString(dict, "__module__") == NULL) { - tmp = PyEval_GetGlobals(); - if (tmp != NULL) { - tmp = PyDict_GetItemString(tmp, "__name__"); - if (tmp != NULL) { - if (PyDict_SetItemString(dict, "__module__", - tmp) < 0) - return NULL; - } - } - } - - /* Set tp_doc to a copy of dict['__doc__'], if the latter is there - and is a string. The __doc__ accessor will first look for tp_doc; - if that fails, it will still look into __dict__. - */ - { - PyObject *doc = PyDict_GetItemString(dict, "__doc__"); - if (doc != NULL && PyString_Check(doc)) { - const size_t n = (size_t)PyString_GET_SIZE(doc); - char *tp_doc = (char *)PyObject_MALLOC(n+1); - if (tp_doc == NULL) { - Py_DECREF(type); - return NULL; - } - memcpy(tp_doc, PyString_AS_STRING(doc), n+1); - type->tp_doc = tp_doc; - } - } - - /* Special-case __new__: if it's a plain function, - make it a static function */ - tmp = PyDict_GetItemString(dict, "__new__"); - if (tmp != NULL && PyFunction_Check(tmp)) { - tmp = PyStaticMethod_New(tmp); - if (tmp == NULL) { - Py_DECREF(type); - return NULL; - } - PyDict_SetItemString(dict, "__new__", tmp); - Py_DECREF(tmp); - } - - /* Add descriptors for custom slots from __slots__, or for __dict__ */ - mp = PyHeapType_GET_MEMBERS(et); - slotoffset = base->tp_basicsize; - if (slots != NULL) { - for (i = 0; i < nslots; i++, mp++) { - mp->name = PyString_AS_STRING( - PyTuple_GET_ITEM(slots, i)); - mp->type = T_OBJECT_EX; - mp->offset = slotoffset; - - /* __dict__ and __weakref__ are already filtered out */ - assert(strcmp(mp->name, "__dict__") != 0); - assert(strcmp(mp->name, "__weakref__") != 0); - - slotoffset += sizeof(PyObject *); - } - } - if (add_dict) { - if (base->tp_itemsize) - type->tp_dictoffset = -(long)sizeof(PyObject *); - else - type->tp_dictoffset = slotoffset; - slotoffset += sizeof(PyObject *); - } - if (add_weak) { - assert(!base->tp_itemsize); - type->tp_weaklistoffset = slotoffset; - slotoffset += sizeof(PyObject *); - } - type->tp_basicsize = slotoffset; - type->tp_itemsize = base->tp_itemsize; - type->tp_members = PyHeapType_GET_MEMBERS(et); - - if (type->tp_weaklistoffset && type->tp_dictoffset) - type->tp_getset = subtype_getsets_full; - else if (type->tp_weaklistoffset && !type->tp_dictoffset) - type->tp_getset = subtype_getsets_weakref_only; - else if (!type->tp_weaklistoffset && type->tp_dictoffset) - type->tp_getset = subtype_getsets_dict_only; - else - type->tp_getset = NULL; - - /* Special case some slots */ - if (type->tp_dictoffset != 0 || nslots > 0) { - if (base->tp_getattr == NULL && base->tp_getattro == NULL) - type->tp_getattro = PyObject_GenericGetAttr; - if (base->tp_setattr == NULL && base->tp_setattro == NULL) - type->tp_setattro = PyObject_GenericSetAttr; - } - type->tp_dealloc = subtype_dealloc; - - /* Enable GC unless there are really no instance variables possible */ - if (!(type->tp_basicsize == sizeof(PyObject) && - type->tp_itemsize == 0)) - type->tp_flags |= Py_TPFLAGS_HAVE_GC; - - /* Always override allocation strategy to use regular heap */ - type->tp_alloc = PyType_GenericAlloc; - if (type->tp_flags & Py_TPFLAGS_HAVE_GC) { - type->tp_free = PyObject_GC_Del; - type->tp_traverse = subtype_traverse; - type->tp_clear = subtype_clear; - } - else - type->tp_free = PyObject_Del; - - /* Initialize the rest */ - if (PyType_Ready(type) < 0) { - Py_DECREF(type); - return NULL; - } - - /* Put the proper slots in place */ - fixup_slot_dispatchers(type); - - return (PyObject *)type; -} - -/* Internal API to look for a name through the MRO. - This returns a borrowed reference, and doesn't set an exception! */ -PyObject * -_PyType_Lookup(PyTypeObject *type, PyObject *name) -{ - Py_ssize_t i, n; - PyObject *mro, *res, *base, *dict; - unsigned int h; - - if (MCACHE_CACHEABLE_NAME(name) && - PyType_HasFeature(type, Py_TPFLAGS_VALID_VERSION_TAG)) { - /* fast path */ - h = MCACHE_HASH_METHOD(type, name); - if (method_cache[h].version == type->tp_version_tag && - method_cache[h].name == name) - return method_cache[h].value; - } - - /* Look in tp_dict of types in MRO */ - mro = type->tp_mro; - - /* If mro is NULL, the type is either not yet initialized - by PyType_Ready(), or already cleared by type_clear(). - Either way the safest thing to do is to return NULL. */ - if (mro == NULL) - return NULL; - - res = NULL; - assert(PyTuple_Check(mro)); - n = PyTuple_GET_SIZE(mro); - for (i = 0; i < n; i++) { - base = PyTuple_GET_ITEM(mro, i); - if (PyClass_Check(base)) - dict = ((PyClassObject *)base)->cl_dict; - else { - assert(PyType_Check(base)); - dict = ((PyTypeObject *)base)->tp_dict; - } - assert(dict && PyDict_Check(dict)); - res = PyDict_GetItem(dict, name); - if (res != NULL) - break; - } - - if (MCACHE_CACHEABLE_NAME(name) && assign_version_tag(type)) { - h = MCACHE_HASH_METHOD(type, name); - method_cache[h].version = type->tp_version_tag; - method_cache[h].value = res; /* borrowed */ - Py_INCREF(name); - Py_DECREF(method_cache[h].name); - method_cache[h].name = name; - } - return res; -} - -/* This is similar to PyObject_GenericGetAttr(), - but uses _PyType_Lookup() instead of just looking in type->tp_dict. */ -static PyObject * -type_getattro(PyTypeObject *type, PyObject *name) -{ - PyTypeObject *metatype = Py_TYPE(type); - PyObject *meta_attribute, *attribute; - descrgetfunc meta_get; - - if (!PyString_Check(name)) { - PyErr_Format(PyExc_TypeError, - "attribute name must be string, not '%.200s'", - name->ob_type->tp_name); - return NULL; - } - - /* Initialize this type (we'll assume the metatype is initialized) */ - if (type->tp_dict == NULL) { - if (PyType_Ready(type) < 0) - return NULL; - } - - /* No readable descriptor found yet */ - meta_get = NULL; - - /* Look for the attribute in the metatype */ - meta_attribute = _PyType_Lookup(metatype, name); - - if (meta_attribute != NULL) { - meta_get = Py_TYPE(meta_attribute)->tp_descr_get; - - if (meta_get != NULL && PyDescr_IsData(meta_attribute)) { - /* Data descriptors implement tp_descr_set to intercept - * writes. Assume the attribute is not overridden in - * type's tp_dict (and bases): call the descriptor now. - */ - return meta_get(meta_attribute, (PyObject *)type, - (PyObject *)metatype); - } - Py_INCREF(meta_attribute); - } - - /* No data descriptor found on metatype. Look in tp_dict of this - * type and its bases */ - attribute = _PyType_Lookup(type, name); - if (attribute != NULL) { - /* Implement descriptor functionality, if any */ - descrgetfunc local_get = Py_TYPE(attribute)->tp_descr_get; - - Py_XDECREF(meta_attribute); - - if (local_get != NULL) { - /* NULL 2nd argument indicates the descriptor was - * found on the target object itself (or a base) */ - return local_get(attribute, (PyObject *)NULL, - (PyObject *)type); - } - - Py_INCREF(attribute); - return attribute; - } - - /* No attribute found in local __dict__ (or bases): use the - * descriptor from the metatype, if any */ - if (meta_get != NULL) { - PyObject *res; - res = meta_get(meta_attribute, (PyObject *)type, - (PyObject *)metatype); - Py_DECREF(meta_attribute); - return res; - } - - /* If an ordinary attribute was found on the metatype, return it now */ - if (meta_attribute != NULL) { - return meta_attribute; - } - - /* Give up */ - PyErr_Format(PyExc_AttributeError, - "type object '%.50s' has no attribute '%.400s'", - type->tp_name, PyString_AS_STRING(name)); - return NULL; -} - -static int -type_setattro(PyTypeObject *type, PyObject *name, PyObject *value) -{ - if (!(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - PyErr_Format( - PyExc_TypeError, - "can't set attributes of built-in/extension type '%s'", - type->tp_name); - return -1; - } - if (PyObject_GenericSetAttr((PyObject *)type, name, value) < 0) - return -1; - return update_slot(type, name); -} - -static void -type_dealloc(PyTypeObject *type) -{ - PyHeapTypeObject *et; - - /* Assert this is a heap-allocated type object */ - assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); - _PyObject_GC_UNTRACK(type); - PyObject_ClearWeakRefs((PyObject *)type); - et = (PyHeapTypeObject *)type; - Py_XDECREF(type->tp_base); - Py_XDECREF(type->tp_dict); - Py_XDECREF(type->tp_bases); - Py_XDECREF(type->tp_mro); - Py_XDECREF(type->tp_cache); - Py_XDECREF(type->tp_subclasses); - /* A type's tp_doc is heap allocated, unlike the tp_doc slots - * of most other objects. It's okay to cast it to char *. - */ - PyObject_Free((char *)type->tp_doc); - Py_XDECREF(et->ht_name); - Py_XDECREF(et->ht_slots); - Py_TYPE(type)->tp_free((PyObject *)type); -} - -static PyObject * -type_subclasses(PyTypeObject *type, PyObject *args_ignored) -{ - PyObject *list, *raw, *ref; - Py_ssize_t i, n; - - list = PyList_New(0); - if (list == NULL) - return NULL; - raw = type->tp_subclasses; - if (raw == NULL) - return list; - assert(PyList_Check(raw)); - n = PyList_GET_SIZE(raw); - for (i = 0; i < n; i++) { - ref = PyList_GET_ITEM(raw, i); - assert(PyWeakref_CheckRef(ref)); - ref = PyWeakref_GET_OBJECT(ref); - if (ref != Py_None) { - if (PyList_Append(list, ref) < 0) { - Py_DECREF(list); - return NULL; - } - } - } - return list; -} - -static PyMethodDef type_methods[] = { - {"mro", (PyCFunction)mro_external, METH_NOARGS, - PyDoc_STR("mro() -> list\nreturn a type's method resolution order")}, - {"__subclasses__", (PyCFunction)type_subclasses, METH_NOARGS, - PyDoc_STR("__subclasses__() -> list of immediate subclasses")}, - {"__instancecheck__", type___instancecheck__, METH_O, - PyDoc_STR("__instancecheck__() -> bool\ncheck if an object is an instance")}, - {"__subclasscheck__", type___subclasscheck__, METH_O, - PyDoc_STR("__subclasscheck__() -> bool\ncheck if a class is a subclass")}, - {0} -}; - -PyDoc_STRVAR(type_doc, -"type(object) -> the object's type\n" -"type(name, bases, dict) -> a new type"); - -static int -type_traverse(PyTypeObject *type, visitproc visit, void *arg) -{ - /* Because of type_is_gc(), the collector only calls this - for heaptypes. */ - assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); - - Py_VISIT(type->tp_dict); - Py_VISIT(type->tp_cache); - Py_VISIT(type->tp_mro); - Py_VISIT(type->tp_bases); - Py_VISIT(type->tp_base); - - /* There's no need to visit type->tp_subclasses or - ((PyHeapTypeObject *)type)->ht_slots, because they can't be involved - in cycles; tp_subclasses is a list of weak references, - and slots is a tuple of strings. */ - - return 0; -} - -static int -type_clear(PyTypeObject *type) -{ - /* Because of type_is_gc(), the collector only calls this - for heaptypes. */ - assert(type->tp_flags & Py_TPFLAGS_HEAPTYPE); - - /* We need to invalidate the method cache carefully before clearing - the dict, so that other objects caught in a reference cycle - don't start calling destroyed methods. - - Otherwise, the only field we need to clear is tp_mro, which is - part of a hard cycle (its first element is the class itself) that - won't be broken otherwise (it's a tuple and tuples don't have a - tp_clear handler). None of the other fields need to be - cleared, and here's why: - - tp_cache: - Not used; if it were, it would be a dict. - - tp_bases, tp_base: - If these are involved in a cycle, there must be at least - one other, mutable object in the cycle, e.g. a base - class's dict; the cycle will be broken that way. - - tp_subclasses: - A list of weak references can't be part of a cycle; and - lists have their own tp_clear. - - slots (in PyHeapTypeObject): - A tuple of strings can't be part of a cycle. - */ - - PyType_Modified(type); - if (type->tp_dict) - PyDict_Clear(type->tp_dict); - Py_CLEAR(type->tp_mro); - - return 0; -} - -static int -type_is_gc(PyTypeObject *type) -{ - return type->tp_flags & Py_TPFLAGS_HEAPTYPE; -} - -PyTypeObject PyType_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "type", /* tp_name */ - sizeof(PyHeapTypeObject), /* tp_basicsize */ - sizeof(PyMemberDef), /* tp_itemsize */ - (destructor)type_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)type_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)_Py_HashPointer, /* tp_hash */ - (ternaryfunc)type_call, /* tp_call */ - 0, /* tp_str */ - (getattrofunc)type_getattro, /* tp_getattro */ - (setattrofunc)type_setattro, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_TYPE_SUBCLASS, /* tp_flags */ - type_doc, /* tp_doc */ - (traverseproc)type_traverse, /* tp_traverse */ - (inquiry)type_clear, /* tp_clear */ - type_richcompare, /* tp_richcompare */ - offsetof(PyTypeObject, tp_weaklist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - type_methods, /* tp_methods */ - type_members, /* tp_members */ - type_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - offsetof(PyTypeObject, tp_dict), /* tp_dictoffset */ - type_init, /* tp_init */ - 0, /* tp_alloc */ - type_new, /* tp_new */ - PyObject_GC_Del, /* tp_free */ - (inquiry)type_is_gc, /* tp_is_gc */ -}; - - -/* The base type of all types (eventually)... except itself. */ - -/* You may wonder why object.__new__() only complains about arguments - when object.__init__() is not overridden, and vice versa. - - Consider the use cases: - - 1. When neither is overridden, we want to hear complaints about - excess (i.e., any) arguments, since their presence could - indicate there's a bug. - - 2. When defining an Immutable type, we are likely to override only - __new__(), since __init__() is called too late to initialize an - Immutable object. Since __new__() defines the signature for the - type, it would be a pain to have to override __init__() just to - stop it from complaining about excess arguments. - - 3. When defining a Mutable type, we are likely to override only - __init__(). So here the converse reasoning applies: we don't - want to have to override __new__() just to stop it from - complaining. - - 4. When __init__() is overridden, and the subclass __init__() calls - object.__init__(), the latter should complain about excess - arguments; ditto for __new__(). - - Use cases 2 and 3 make it unattractive to unconditionally check for - excess arguments. The best solution that addresses all four use - cases is as follows: __init__() complains about excess arguments - unless __new__() is overridden and __init__() is not overridden - (IOW, if __init__() is overridden or __new__() is not overridden); - symmetrically, __new__() complains about excess arguments unless - __init__() is overridden and __new__() is not overridden - (IOW, if __new__() is overridden or __init__() is not overridden). - - However, for backwards compatibility, this breaks too much code. - Therefore, in 2.6, we'll *warn* about excess arguments when both - methods are overridden; for all other cases we'll use the above - rules. - -*/ - -/* Forward */ -static PyObject * -object_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static int -excess_args(PyObject *args, PyObject *kwds) -{ - return PyTuple_GET_SIZE(args) || - (kwds && PyDict_Check(kwds) && PyDict_Size(kwds)); -} - -static int -object_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - int err = 0; - if (excess_args(args, kwds)) { - PyTypeObject *type = Py_TYPE(self); - if (type->tp_init != object_init && - type->tp_new != object_new) - { - err = PyErr_WarnEx(PyExc_DeprecationWarning, - "object.__init__() takes no parameters", - 1); - } - else if (type->tp_init != object_init || - type->tp_new == object_new) - { - PyErr_SetString(PyExc_TypeError, - "object.__init__() takes no parameters"); - err = -1; - } - } - return err; -} - -static PyObject * -object_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - int err = 0; - if (excess_args(args, kwds)) { - if (type->tp_new != object_new && - type->tp_init != object_init) - { - err = PyErr_WarnEx(PyExc_DeprecationWarning, - "object() takes no parameters", - 1); - } - else if (type->tp_new != object_new || - type->tp_init == object_init) - { - PyErr_SetString(PyExc_TypeError, - "object() takes no parameters"); - err = -1; - } - } - if (err < 0) - return NULL; - - if (type->tp_flags & Py_TPFLAGS_IS_ABSTRACT) { - static PyObject *comma = NULL; - PyObject *abstract_methods = NULL; - PyObject *builtins; - PyObject *sorted; - PyObject *sorted_methods = NULL; - PyObject *joined = NULL; - const char *joined_str; - - /* Compute ", ".join(sorted(type.__abstractmethods__)) - into joined. */ - abstract_methods = type_abstractmethods(type, NULL); - if (abstract_methods == NULL) - goto error; - builtins = PyEval_GetBuiltins(); - if (builtins == NULL) - goto error; - sorted = PyDict_GetItemString(builtins, "sorted"); - if (sorted == NULL) - goto error; - sorted_methods = PyObject_CallFunctionObjArgs(sorted, - abstract_methods, - NULL); - if (sorted_methods == NULL) - goto error; - if (comma == NULL) { - comma = PyString_InternFromString(", "); - if (comma == NULL) - goto error; - } - joined = PyObject_CallMethod(comma, "join", - "O", sorted_methods); - if (joined == NULL) - goto error; - joined_str = PyString_AsString(joined); - if (joined_str == NULL) - goto error; - - PyErr_Format(PyExc_TypeError, - "Can't instantiate abstract class %s " - "with abstract methods %s", - type->tp_name, - joined_str); - error: - Py_XDECREF(joined); - Py_XDECREF(sorted_methods); - Py_XDECREF(abstract_methods); - return NULL; - } - return type->tp_alloc(type, 0); -} - -static void -object_dealloc(PyObject *self) -{ - Py_TYPE(self)->tp_free(self); -} - -static PyObject * -object_repr(PyObject *self) -{ - PyTypeObject *type; - PyObject *mod, *name, *rtn; - - type = Py_TYPE(self); - mod = type_module(type, NULL); - if (mod == NULL) - PyErr_Clear(); - else if (!PyString_Check(mod)) { - Py_DECREF(mod); - mod = NULL; - } - name = type_name(type, NULL); - if (name == NULL) { - Py_XDECREF(mod); - return NULL; - } - if (mod != NULL && strcmp(PyString_AS_STRING(mod), "__builtin__")) - rtn = PyString_FromFormat("<%s.%s object at %p>", - PyString_AS_STRING(mod), - PyString_AS_STRING(name), - self); - else - rtn = PyString_FromFormat("<%s object at %p>", - type->tp_name, self); - Py_XDECREF(mod); - Py_DECREF(name); - return rtn; -} - -static PyObject * -object_str(PyObject *self) -{ - unaryfunc f; - - f = Py_TYPE(self)->tp_repr; - if (f == NULL) - f = object_repr; - return f(self); -} - -static PyObject * -object_get_class(PyObject *self, void *closure) -{ - Py_INCREF(Py_TYPE(self)); - return (PyObject *)(Py_TYPE(self)); -} - -static int -equiv_structs(PyTypeObject *a, PyTypeObject *b) -{ - return a == b || - (a != NULL && - b != NULL && - a->tp_basicsize == b->tp_basicsize && - a->tp_itemsize == b->tp_itemsize && - a->tp_dictoffset == b->tp_dictoffset && - a->tp_weaklistoffset == b->tp_weaklistoffset && - ((a->tp_flags & Py_TPFLAGS_HAVE_GC) == - (b->tp_flags & Py_TPFLAGS_HAVE_GC))); -} - -static int -same_slots_added(PyTypeObject *a, PyTypeObject *b) -{ - PyTypeObject *base = a->tp_base; - Py_ssize_t size; - PyObject *slots_a, *slots_b; - - assert(base == b->tp_base); - size = base->tp_basicsize; - if (a->tp_dictoffset == size && b->tp_dictoffset == size) - size += sizeof(PyObject *); - if (a->tp_weaklistoffset == size && b->tp_weaklistoffset == size) - size += sizeof(PyObject *); - - /* Check slots compliance */ - slots_a = ((PyHeapTypeObject *)a)->ht_slots; - slots_b = ((PyHeapTypeObject *)b)->ht_slots; - if (slots_a && slots_b) { - if (PyObject_Compare(slots_a, slots_b) != 0) - return 0; - size += sizeof(PyObject *) * PyTuple_GET_SIZE(slots_a); - } - return size == a->tp_basicsize && size == b->tp_basicsize; -} - -static int -compatible_for_assignment(PyTypeObject* oldto, PyTypeObject* newto, char* attr) -{ - PyTypeObject *newbase, *oldbase; - - if (newto->tp_dealloc != oldto->tp_dealloc || - newto->tp_free != oldto->tp_free) - { - PyErr_Format(PyExc_TypeError, - "%s assignment: " - "'%s' deallocator differs from '%s'", - attr, - newto->tp_name, - oldto->tp_name); - return 0; - } - newbase = newto; - oldbase = oldto; - while (equiv_structs(newbase, newbase->tp_base)) - newbase = newbase->tp_base; - while (equiv_structs(oldbase, oldbase->tp_base)) - oldbase = oldbase->tp_base; - if (newbase != oldbase && - (newbase->tp_base != oldbase->tp_base || - !same_slots_added(newbase, oldbase))) { - PyErr_Format(PyExc_TypeError, - "%s assignment: " - "'%s' object layout differs from '%s'", - attr, - newto->tp_name, - oldto->tp_name); - return 0; - } - - return 1; -} - -static int -object_set_class(PyObject *self, PyObject *value, void *closure) -{ - PyTypeObject *oldto = Py_TYPE(self); - PyTypeObject *newto; - - if (value == NULL) { - PyErr_SetString(PyExc_TypeError, - "can't delete __class__ attribute"); - return -1; - } - if (!PyType_Check(value)) { - PyErr_Format(PyExc_TypeError, - "__class__ must be set to new-style class, not '%s' object", - Py_TYPE(value)->tp_name); - return -1; - } - newto = (PyTypeObject *)value; - if (!(newto->tp_flags & Py_TPFLAGS_HEAPTYPE) || - !(oldto->tp_flags & Py_TPFLAGS_HEAPTYPE)) - { - PyErr_Format(PyExc_TypeError, - "__class__ assignment: only for heap types"); - return -1; - } - if (compatible_for_assignment(newto, oldto, "__class__")) { - Py_INCREF(newto); - Py_TYPE(self) = newto; - Py_DECREF(oldto); - return 0; - } - else { - return -1; - } -} - -static PyGetSetDef object_getsets[] = { - {"__class__", object_get_class, object_set_class, - PyDoc_STR("the object's class")}, - {0} -}; - - -/* Stuff to implement __reduce_ex__ for pickle protocols >= 2. - We fall back to helpers in copy_reg for: - - pickle protocols < 2 - - calculating the list of slot names (done only once per class) - - the __newobj__ function (which is used as a token but never called) -*/ - -static PyObject * -import_copyreg(void) -{ - static PyObject *copyreg_str; - - if (!copyreg_str) { - copyreg_str = PyString_InternFromString("copy_reg"); - if (copyreg_str == NULL) - return NULL; - } - - return PyImport_Import(copyreg_str); -} - -static PyObject * -slotnames(PyObject *cls) -{ - PyObject *clsdict; - PyObject *copyreg; - PyObject *slotnames; - - if (!PyType_Check(cls)) { - Py_INCREF(Py_None); - return Py_None; - } - - clsdict = ((PyTypeObject *)cls)->tp_dict; - slotnames = PyDict_GetItemString(clsdict, "__slotnames__"); - if (slotnames != NULL && PyList_Check(slotnames)) { - Py_INCREF(slotnames); - return slotnames; - } - - copyreg = import_copyreg(); - if (copyreg == NULL) - return NULL; - - slotnames = PyObject_CallMethod(copyreg, "_slotnames", "O", cls); - Py_DECREF(copyreg); - if (slotnames != NULL && - slotnames != Py_None && - !PyList_Check(slotnames)) - { - PyErr_SetString(PyExc_TypeError, - "copy_reg._slotnames didn't return a list or None"); - Py_DECREF(slotnames); - slotnames = NULL; - } - - return slotnames; -} - -static PyObject * -reduce_2(PyObject *obj) -{ - PyObject *cls, *getnewargs; - PyObject *args = NULL, *args2 = NULL; - PyObject *getstate = NULL, *state = NULL, *names = NULL; - PyObject *slots = NULL, *listitems = NULL, *dictitems = NULL; - PyObject *copyreg = NULL, *newobj = NULL, *res = NULL; - Py_ssize_t i, n; - - cls = PyObject_GetAttrString(obj, "__class__"); - if (cls == NULL) - return NULL; - - getnewargs = PyObject_GetAttrString(obj, "__getnewargs__"); - if (getnewargs != NULL) { - args = PyObject_CallObject(getnewargs, NULL); - Py_DECREF(getnewargs); - if (args != NULL && !PyTuple_Check(args)) { - PyErr_Format(PyExc_TypeError, - "__getnewargs__ should return a tuple, " - "not '%.200s'", Py_TYPE(args)->tp_name); - goto end; - } - } - else { - PyErr_Clear(); - args = PyTuple_New(0); - } - if (args == NULL) - goto end; - - getstate = PyObject_GetAttrString(obj, "__getstate__"); - if (getstate != NULL) { - state = PyObject_CallObject(getstate, NULL); - Py_DECREF(getstate); - if (state == NULL) - goto end; - } - else { - PyErr_Clear(); - state = PyObject_GetAttrString(obj, "__dict__"); - if (state == NULL) { - PyErr_Clear(); - state = Py_None; - Py_INCREF(state); - } - names = slotnames(cls); - if (names == NULL) - goto end; - if (names != Py_None) { - assert(PyList_Check(names)); - slots = PyDict_New(); - if (slots == NULL) - goto end; - n = 0; - /* Can't pre-compute the list size; the list - is stored on the class so accessible to other - threads, which may be run by DECREF */ - for (i = 0; i < PyList_GET_SIZE(names); i++) { - PyObject *name, *value; - name = PyList_GET_ITEM(names, i); - value = PyObject_GetAttr(obj, name); - if (value == NULL) - PyErr_Clear(); - else { - int err = PyDict_SetItem(slots, name, - value); - Py_DECREF(value); - if (err) - goto end; - n++; - } - } - if (n) { - state = Py_BuildValue("(NO)", state, slots); - if (state == NULL) - goto end; - } - } - } - - if (!PyList_Check(obj)) { - listitems = Py_None; - Py_INCREF(listitems); - } - else { - listitems = PyObject_GetIter(obj); - if (listitems == NULL) - goto end; - } - - if (!PyDict_Check(obj)) { - dictitems = Py_None; - Py_INCREF(dictitems); - } - else { - dictitems = PyObject_CallMethod(obj, "iteritems", ""); - if (dictitems == NULL) - goto end; - } - - copyreg = import_copyreg(); - if (copyreg == NULL) - goto end; - newobj = PyObject_GetAttrString(copyreg, "__newobj__"); - if (newobj == NULL) - goto end; - - n = PyTuple_GET_SIZE(args); - args2 = PyTuple_New(n+1); - if (args2 == NULL) - goto end; - PyTuple_SET_ITEM(args2, 0, cls); - cls = NULL; - for (i = 0; i < n; i++) { - PyObject *v = PyTuple_GET_ITEM(args, i); - Py_INCREF(v); - PyTuple_SET_ITEM(args2, i+1, v); - } - - res = PyTuple_Pack(5, newobj, args2, state, listitems, dictitems); - - end: - Py_XDECREF(cls); - Py_XDECREF(args); - Py_XDECREF(args2); - Py_XDECREF(slots); - Py_XDECREF(state); - Py_XDECREF(names); - Py_XDECREF(listitems); - Py_XDECREF(dictitems); - Py_XDECREF(copyreg); - Py_XDECREF(newobj); - return res; -} - -/* - * There were two problems when object.__reduce__ and object.__reduce_ex__ - * were implemented in the same function: - * - trying to pickle an object with a custom __reduce__ method that - * fell back to object.__reduce__ in certain circumstances led to - * infinite recursion at Python level and eventual RuntimeError. - * - Pickling objects that lied about their type by overwriting the - * __class__ descriptor could lead to infinite recursion at C level - * and eventual segfault. - * - * Because of backwards compatibility, the two methods still have to - * behave in the same way, even if this is not required by the pickle - * protocol. This common functionality was moved to the _common_reduce - * function. - */ -static PyObject * -_common_reduce(PyObject *self, int proto) -{ - PyObject *copyreg, *res; - - if (proto >= 2) - return reduce_2(self); - - copyreg = import_copyreg(); - if (!copyreg) - return NULL; - - res = PyEval_CallMethod(copyreg, "_reduce_ex", "(Oi)", self, proto); - Py_DECREF(copyreg); - - return res; -} - -static PyObject * -object_reduce(PyObject *self, PyObject *args) -{ - int proto = 0; - - if (!PyArg_ParseTuple(args, "|i:__reduce__", &proto)) - return NULL; - - return _common_reduce(self, proto); -} - -static PyObject * -object_reduce_ex(PyObject *self, PyObject *args) -{ - PyObject *reduce, *res; - int proto = 0; - - if (!PyArg_ParseTuple(args, "|i:__reduce_ex__", &proto)) - return NULL; - - reduce = PyObject_GetAttrString(self, "__reduce__"); - if (reduce == NULL) - PyErr_Clear(); - else { - PyObject *cls, *clsreduce, *objreduce; - int override; - cls = PyObject_GetAttrString(self, "__class__"); - if (cls == NULL) { - Py_DECREF(reduce); - return NULL; - } - clsreduce = PyObject_GetAttrString(cls, "__reduce__"); - Py_DECREF(cls); - if (clsreduce == NULL) { - Py_DECREF(reduce); - return NULL; - } - objreduce = PyDict_GetItemString(PyBaseObject_Type.tp_dict, - "__reduce__"); - override = (clsreduce != objreduce); - Py_DECREF(clsreduce); - if (override) { - res = PyObject_CallObject(reduce, NULL); - Py_DECREF(reduce); - return res; - } - else - Py_DECREF(reduce); - } - - return _common_reduce(self, proto); -} - -static PyObject * -object_subclasshook(PyObject *cls, PyObject *args) -{ - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -PyDoc_STRVAR(object_subclasshook_doc, -"Abstract classes can override this to customize issubclass().\n" -"\n" -"This is invoked early on by abc.ABCMeta.__subclasscheck__().\n" -"It should return True, False or NotImplemented. If it returns\n" -"NotImplemented, the normal algorithm is used. Otherwise, it\n" -"overrides the normal algorithm (and the outcome is cached).\n"); - -/* - from PEP 3101, this code implements: - - class object: - def __format__(self, format_spec): - if isinstance(format_spec, str): - return format(str(self), format_spec) - elif isinstance(format_spec, unicode): - return format(unicode(self), format_spec) -*/ -static PyObject * -object_format(PyObject *self, PyObject *args) -{ - PyObject *format_spec; - PyObject *self_as_str = NULL; - PyObject *result = NULL; - Py_ssize_t format_len; - - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - return NULL; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(format_spec)) { - format_len = PyUnicode_GET_SIZE(format_spec); - self_as_str = PyObject_Unicode(self); - } else if (PyString_Check(format_spec)) { -#else - if (PyString_Check(format_spec)) { -#endif - format_len = PyString_GET_SIZE(format_spec); - self_as_str = PyObject_Str(self); - } else { - PyErr_SetString(PyExc_TypeError, - "argument to __format__ must be unicode or str"); - return NULL; - } - - if (self_as_str != NULL) { - /* Issue 7994: If we're converting to a string, we - should reject format specifications */ - if (format_len > 0) { - if (PyErr_WarnEx(PyExc_PendingDeprecationWarning, - "object.__format__ with a non-empty format " - "string is deprecated", 1) < 0) { - goto done; - } - /* Eventually this will become an error: - PyErr_Format(PyExc_TypeError, - "non-empty format string passed to object.__format__"); - goto done; - */ - } - result = PyObject_Format(self_as_str, format_spec); - } - -done: - Py_XDECREF(self_as_str); - - return result; -} - -static PyObject * -object_sizeof(PyObject *self, PyObject *args) -{ - Py_ssize_t res, isize; - - res = 0; - isize = self->ob_type->tp_itemsize; - if (isize > 0) - res = Py_SIZE(self) * isize; - res += self->ob_type->tp_basicsize; - - return PyInt_FromSsize_t(res); -} - -static PyMethodDef object_methods[] = { - {"__reduce_ex__", object_reduce_ex, METH_VARARGS, - PyDoc_STR("helper for pickle")}, - {"__reduce__", object_reduce, METH_VARARGS, - PyDoc_STR("helper for pickle")}, - {"__subclasshook__", object_subclasshook, METH_CLASS | METH_VARARGS, - object_subclasshook_doc}, - {"__format__", object_format, METH_VARARGS, - PyDoc_STR("default object formatter")}, - {"__sizeof__", object_sizeof, METH_NOARGS, - PyDoc_STR("__sizeof__() -> int\nsize of object in memory, in bytes")}, - {0} -}; - - -PyTypeObject PyBaseObject_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "object", /* tp_name */ - sizeof(PyObject), /* tp_basicsize */ - 0, /* tp_itemsize */ - object_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - object_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)_Py_HashPointer, /* tp_hash */ - 0, /* tp_call */ - object_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - PyDoc_STR("The most base type"), /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - object_methods, /* tp_methods */ - 0, /* tp_members */ - object_getsets, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - object_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - object_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - - -/* Initialize the __dict__ in a type object */ - -static int -add_methods(PyTypeObject *type, PyMethodDef *meth) -{ - PyObject *dict = type->tp_dict; - - for (; meth->ml_name != NULL; meth++) { - PyObject *descr; - int err; - if (PyDict_GetItemString(dict, meth->ml_name) && - !(meth->ml_flags & METH_COEXIST)) - continue; - if (meth->ml_flags & METH_CLASS) { - if (meth->ml_flags & METH_STATIC) { - PyErr_SetString(PyExc_ValueError, - "method cannot be both class and static"); - return -1; - } - descr = PyDescr_NewClassMethod(type, meth); - } - else if (meth->ml_flags & METH_STATIC) { - PyObject *cfunc = PyCFunction_New(meth, NULL); - if (cfunc == NULL) - return -1; - descr = PyStaticMethod_New(cfunc); - Py_DECREF(cfunc); - } - else { - descr = PyDescr_NewMethod(type, meth); - } - if (descr == NULL) - return -1; - err = PyDict_SetItemString(dict, meth->ml_name, descr); - Py_DECREF(descr); - if (err < 0) - return -1; - } - return 0; -} - -static int -add_members(PyTypeObject *type, PyMemberDef *memb) -{ - PyObject *dict = type->tp_dict; - - for (; memb->name != NULL; memb++) { - PyObject *descr; - if (PyDict_GetItemString(dict, memb->name)) - continue; - descr = PyDescr_NewMember(type, memb); - if (descr == NULL) - return -1; - if (PyDict_SetItemString(dict, memb->name, descr) < 0) - return -1; - Py_DECREF(descr); - } - return 0; -} - -static int -add_getset(PyTypeObject *type, PyGetSetDef *gsp) -{ - PyObject *dict = type->tp_dict; - - for (; gsp->name != NULL; gsp++) { - PyObject *descr; - if (PyDict_GetItemString(dict, gsp->name)) - continue; - descr = PyDescr_NewGetSet(type, gsp); - - if (descr == NULL) - return -1; - if (PyDict_SetItemString(dict, gsp->name, descr) < 0) - return -1; - Py_DECREF(descr); - } - return 0; -} - -#define BUFFER_FLAGS (Py_TPFLAGS_HAVE_GETCHARBUFFER | Py_TPFLAGS_HAVE_NEWBUFFER) - -static void -inherit_special(PyTypeObject *type, PyTypeObject *base) -{ - Py_ssize_t oldsize, newsize; - - /* Special flag magic */ - if (!type->tp_as_buffer && base->tp_as_buffer) { - type->tp_flags &= ~BUFFER_FLAGS; - type->tp_flags |= - base->tp_flags & BUFFER_FLAGS; - } - if (!type->tp_as_sequence && base->tp_as_sequence) { - type->tp_flags &= ~Py_TPFLAGS_HAVE_SEQUENCE_IN; - type->tp_flags |= base->tp_flags & Py_TPFLAGS_HAVE_SEQUENCE_IN; - } - if ((type->tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS) != - (base->tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS)) { - if ((!type->tp_as_number && base->tp_as_number) || - (!type->tp_as_sequence && base->tp_as_sequence)) { - type->tp_flags &= ~Py_TPFLAGS_HAVE_INPLACEOPS; - if (!type->tp_as_number && !type->tp_as_sequence) { - type->tp_flags |= base->tp_flags & - Py_TPFLAGS_HAVE_INPLACEOPS; - } - } - /* Wow */ - } - if (!type->tp_as_number && base->tp_as_number) { - type->tp_flags &= ~Py_TPFLAGS_CHECKTYPES; - type->tp_flags |= base->tp_flags & Py_TPFLAGS_CHECKTYPES; - } - - /* Copying basicsize is connected to the GC flags */ - oldsize = base->tp_basicsize; - newsize = type->tp_basicsize ? type->tp_basicsize : oldsize; - if (!(type->tp_flags & Py_TPFLAGS_HAVE_GC) && - (base->tp_flags & Py_TPFLAGS_HAVE_GC) && - (type->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE/*GC slots exist*/) && - (!type->tp_traverse && !type->tp_clear)) { - type->tp_flags |= Py_TPFLAGS_HAVE_GC; - if (type->tp_traverse == NULL) - type->tp_traverse = base->tp_traverse; - if (type->tp_clear == NULL) - type->tp_clear = base->tp_clear; - } - if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - /* The condition below could use some explanation. - It appears that tp_new is not inherited for static types - whose base class is 'object'; this seems to be a precaution - so that old extension types don't suddenly become - callable (object.__new__ wouldn't insure the invariants - that the extension type's own factory function ensures). - Heap types, of course, are under our control, so they do - inherit tp_new; static extension types that specify some - other built-in type as the default are considered - new-style-aware so they also inherit object.__new__. */ - if (base != &PyBaseObject_Type || - (type->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - if (type->tp_new == NULL) - type->tp_new = base->tp_new; - } - } - type->tp_basicsize = newsize; - - /* Copy other non-function slots */ - -#undef COPYVAL -#define COPYVAL(SLOT) \ - if (type->SLOT == 0) type->SLOT = base->SLOT - - COPYVAL(tp_itemsize); - if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_WEAKREFS) { - COPYVAL(tp_weaklistoffset); - } - if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - COPYVAL(tp_dictoffset); - } - - /* Setup fast subclass flags */ - if (PyType_IsSubtype(base, (PyTypeObject*)PyExc_BaseException)) - type->tp_flags |= Py_TPFLAGS_BASE_EXC_SUBCLASS; - else if (PyType_IsSubtype(base, &PyType_Type)) - type->tp_flags |= Py_TPFLAGS_TYPE_SUBCLASS; - else if (PyType_IsSubtype(base, &PyInt_Type)) - type->tp_flags |= Py_TPFLAGS_INT_SUBCLASS; - else if (PyType_IsSubtype(base, &PyLong_Type)) - type->tp_flags |= Py_TPFLAGS_LONG_SUBCLASS; - else if (PyType_IsSubtype(base, &PyString_Type)) - type->tp_flags |= Py_TPFLAGS_STRING_SUBCLASS; -#ifdef Py_USING_UNICODE - else if (PyType_IsSubtype(base, &PyUnicode_Type)) - type->tp_flags |= Py_TPFLAGS_UNICODE_SUBCLASS; -#endif - else if (PyType_IsSubtype(base, &PyTuple_Type)) - type->tp_flags |= Py_TPFLAGS_TUPLE_SUBCLASS; - else if (PyType_IsSubtype(base, &PyList_Type)) - type->tp_flags |= Py_TPFLAGS_LIST_SUBCLASS; - else if (PyType_IsSubtype(base, &PyDict_Type)) - type->tp_flags |= Py_TPFLAGS_DICT_SUBCLASS; -} - -static int -overrides_name(PyTypeObject *type, char *name) -{ - PyObject *dict = type->tp_dict; - - assert(dict != NULL); - if (PyDict_GetItemString(dict, name) != NULL) { - return 1; - } - return 0; -} - -#define OVERRIDES_HASH(x) overrides_name(x, "__hash__") -#define OVERRIDES_EQ(x) overrides_name(x, "__eq__") - -static void -inherit_slots(PyTypeObject *type, PyTypeObject *base) -{ - PyTypeObject *basebase; - -#undef SLOTDEFINED -#undef COPYSLOT -#undef COPYNUM -#undef COPYSEQ -#undef COPYMAP -#undef COPYBUF - -#define SLOTDEFINED(SLOT) \ - (base->SLOT != 0 && \ - (basebase == NULL || base->SLOT != basebase->SLOT)) - -#define COPYSLOT(SLOT) \ - if (!type->SLOT && SLOTDEFINED(SLOT)) type->SLOT = base->SLOT - -#define COPYNUM(SLOT) COPYSLOT(tp_as_number->SLOT) -#define COPYSEQ(SLOT) COPYSLOT(tp_as_sequence->SLOT) -#define COPYMAP(SLOT) COPYSLOT(tp_as_mapping->SLOT) -#define COPYBUF(SLOT) COPYSLOT(tp_as_buffer->SLOT) - - /* This won't inherit indirect slots (from tp_as_number etc.) - if type doesn't provide the space. */ - - if (type->tp_as_number != NULL && base->tp_as_number != NULL) { - basebase = base->tp_base; - if (basebase->tp_as_number == NULL) - basebase = NULL; - COPYNUM(nb_add); - COPYNUM(nb_subtract); - COPYNUM(nb_multiply); - COPYNUM(nb_divide); - COPYNUM(nb_remainder); - COPYNUM(nb_divmod); - COPYNUM(nb_power); - COPYNUM(nb_negative); - COPYNUM(nb_positive); - COPYNUM(nb_absolute); - COPYNUM(nb_nonzero); - COPYNUM(nb_invert); - COPYNUM(nb_lshift); - COPYNUM(nb_rshift); - COPYNUM(nb_and); - COPYNUM(nb_xor); - COPYNUM(nb_or); - COPYNUM(nb_coerce); - COPYNUM(nb_int); - COPYNUM(nb_long); - COPYNUM(nb_float); - COPYNUM(nb_oct); - COPYNUM(nb_hex); - COPYNUM(nb_inplace_add); - COPYNUM(nb_inplace_subtract); - COPYNUM(nb_inplace_multiply); - COPYNUM(nb_inplace_divide); - COPYNUM(nb_inplace_remainder); - COPYNUM(nb_inplace_power); - COPYNUM(nb_inplace_lshift); - COPYNUM(nb_inplace_rshift); - COPYNUM(nb_inplace_and); - COPYNUM(nb_inplace_xor); - COPYNUM(nb_inplace_or); - if (base->tp_flags & Py_TPFLAGS_CHECKTYPES) { - COPYNUM(nb_true_divide); - COPYNUM(nb_floor_divide); - COPYNUM(nb_inplace_true_divide); - COPYNUM(nb_inplace_floor_divide); - } - if (base->tp_flags & Py_TPFLAGS_HAVE_INDEX) { - COPYNUM(nb_index); - } - } - - if (type->tp_as_sequence != NULL && base->tp_as_sequence != NULL) { - basebase = base->tp_base; - if (basebase->tp_as_sequence == NULL) - basebase = NULL; - COPYSEQ(sq_length); - COPYSEQ(sq_concat); - COPYSEQ(sq_repeat); - COPYSEQ(sq_item); - COPYSEQ(sq_slice); - COPYSEQ(sq_ass_item); - COPYSEQ(sq_ass_slice); - COPYSEQ(sq_contains); - COPYSEQ(sq_inplace_concat); - COPYSEQ(sq_inplace_repeat); - } - - if (type->tp_as_mapping != NULL && base->tp_as_mapping != NULL) { - basebase = base->tp_base; - if (basebase->tp_as_mapping == NULL) - basebase = NULL; - COPYMAP(mp_length); - COPYMAP(mp_subscript); - COPYMAP(mp_ass_subscript); - } - - if (type->tp_as_buffer != NULL && base->tp_as_buffer != NULL) { - basebase = base->tp_base; - if (basebase->tp_as_buffer == NULL) - basebase = NULL; - COPYBUF(bf_getreadbuffer); - COPYBUF(bf_getwritebuffer); - COPYBUF(bf_getsegcount); - COPYBUF(bf_getcharbuffer); - COPYBUF(bf_getbuffer); - COPYBUF(bf_releasebuffer); - } - - basebase = base->tp_base; - - COPYSLOT(tp_dealloc); - COPYSLOT(tp_print); - if (type->tp_getattr == NULL && type->tp_getattro == NULL) { - type->tp_getattr = base->tp_getattr; - type->tp_getattro = base->tp_getattro; - } - if (type->tp_setattr == NULL && type->tp_setattro == NULL) { - type->tp_setattr = base->tp_setattr; - type->tp_setattro = base->tp_setattro; - } - /* tp_compare see tp_richcompare */ - COPYSLOT(tp_repr); - /* tp_hash see tp_richcompare */ - COPYSLOT(tp_call); - COPYSLOT(tp_str); - if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_RICHCOMPARE) { - if (type->tp_compare == NULL && - type->tp_richcompare == NULL && - type->tp_hash == NULL) - { - type->tp_compare = base->tp_compare; - type->tp_richcompare = base->tp_richcompare; - type->tp_hash = base->tp_hash; - /* Check for changes to inherited methods in Py3k*/ - if (Py_Py3kWarningFlag) { - if (base->tp_hash && - (base->tp_hash != PyObject_HashNotImplemented) && - !OVERRIDES_HASH(type)) { - if (OVERRIDES_EQ(type)) { - if (PyErr_WarnPy3k("Overriding " - "__eq__ blocks inheritance " - "of __hash__ in 3.x", - 1) < 0) - /* XXX This isn't right. If the warning is turned - into an exception, we should be communicating - the error back to the caller, but figuring out - how to clean up in that case is tricky. See - issue 8627 for more. */ - PyErr_Clear(); - } - } - } - } - } - else { - COPYSLOT(tp_compare); - } - if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_ITER) { - COPYSLOT(tp_iter); - COPYSLOT(tp_iternext); - } - if (type->tp_flags & base->tp_flags & Py_TPFLAGS_HAVE_CLASS) { - COPYSLOT(tp_descr_get); - COPYSLOT(tp_descr_set); - COPYSLOT(tp_dictoffset); - COPYSLOT(tp_init); - COPYSLOT(tp_alloc); - COPYSLOT(tp_is_gc); - if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) == - (base->tp_flags & Py_TPFLAGS_HAVE_GC)) { - /* They agree about gc. */ - COPYSLOT(tp_free); - } - else if ((type->tp_flags & Py_TPFLAGS_HAVE_GC) && - type->tp_free == NULL && - base->tp_free == _PyObject_Del) { - /* A bit of magic to plug in the correct default - * tp_free function when a derived class adds gc, - * didn't define tp_free, and the base uses the - * default non-gc tp_free. - */ - type->tp_free = PyObject_GC_Del; - } - /* else they didn't agree about gc, and there isn't something - * obvious to be done -- the type is on its own. - */ - } -} - -static int add_operators(PyTypeObject *); - -int -PyType_Ready(PyTypeObject *type) -{ - PyObject *dict, *bases; - PyTypeObject *base; - Py_ssize_t i, n; - - if (type->tp_flags & Py_TPFLAGS_READY) { - assert(type->tp_dict != NULL); - return 0; - } - assert((type->tp_flags & Py_TPFLAGS_READYING) == 0); - - type->tp_flags |= Py_TPFLAGS_READYING; - -#ifdef Py_TRACE_REFS - /* PyType_Ready is the closest thing we have to a choke point - * for type objects, so is the best place I can think of to try - * to get type objects into the doubly-linked list of all objects. - * Still, not all type objects go thru PyType_Ready. - */ - _Py_AddToAllObjects((PyObject *)type, 0); -#endif - - /* Initialize tp_base (defaults to BaseObject unless that's us) */ - base = type->tp_base; - if (base == NULL && type != &PyBaseObject_Type) { - base = type->tp_base = &PyBaseObject_Type; - Py_INCREF(base); - } - - /* Now the only way base can still be NULL is if type is - * &PyBaseObject_Type. - */ - - /* Initialize the base class */ - if (base && base->tp_dict == NULL) { - if (PyType_Ready(base) < 0) - goto error; - } - - /* Initialize ob_type if NULL. This means extensions that want to be - compilable separately on Windows can call PyType_Ready() instead of - initializing the ob_type field of their type objects. */ - /* The test for base != NULL is really unnecessary, since base is only - NULL when type is &PyBaseObject_Type, and we know its ob_type is - not NULL (it's initialized to &PyType_Type). But coverity doesn't - know that. */ - if (Py_TYPE(type) == NULL && base != NULL) - Py_TYPE(type) = Py_TYPE(base); - - /* Initialize tp_bases */ - bases = type->tp_bases; - if (bases == NULL) { - if (base == NULL) - bases = PyTuple_New(0); - else - bases = PyTuple_Pack(1, base); - if (bases == NULL) - goto error; - type->tp_bases = bases; - } - - /* Initialize tp_dict */ - dict = type->tp_dict; - if (dict == NULL) { - dict = PyDict_New(); - if (dict == NULL) - goto error; - type->tp_dict = dict; - } - - /* Add type-specific descriptors to tp_dict */ - if (add_operators(type) < 0) - goto error; - if (type->tp_methods != NULL) { - if (add_methods(type, type->tp_methods) < 0) - goto error; - } - if (type->tp_members != NULL) { - if (add_members(type, type->tp_members) < 0) - goto error; - } - if (type->tp_getset != NULL) { - if (add_getset(type, type->tp_getset) < 0) - goto error; - } - - /* Calculate method resolution order */ - if (mro_internal(type) < 0) { - goto error; - } - - /* Inherit special flags from dominant base */ - if (type->tp_base != NULL) - inherit_special(type, type->tp_base); - - /* Initialize tp_dict properly */ - bases = type->tp_mro; - assert(bases != NULL); - assert(PyTuple_Check(bases)); - n = PyTuple_GET_SIZE(bases); - for (i = 1; i < n; i++) { - PyObject *b = PyTuple_GET_ITEM(bases, i); - if (PyType_Check(b)) - inherit_slots(type, (PyTypeObject *)b); - } - - /* All bases of statically allocated type should be statically allocated */ - if (Py_Py3kWarningFlag && !(type->tp_flags & Py_TPFLAGS_HEAPTYPE)) - for (i = 0; i < n; i++) { - PyObject *b = PyTuple_GET_ITEM(bases, i); - if (PyType_Check(b) && - (((PyTypeObject *)b)->tp_flags & Py_TPFLAGS_HEAPTYPE)) { - char buf[300]; - PyOS_snprintf(buf, sizeof(buf), - "type '%.100s' is not dynamically allocated but " - "its base type '%.100s' is dynamically allocated", - type->tp_name, ((PyTypeObject *)b)->tp_name); - if (PyErr_WarnPy3k(buf, 1) < 0) - goto error; - break; - } - } - - /* Sanity check for tp_free. */ - if (PyType_IS_GC(type) && (type->tp_flags & Py_TPFLAGS_BASETYPE) && - (type->tp_free == NULL || type->tp_free == PyObject_Del)) { - /* This base class needs to call tp_free, but doesn't have - * one, or its tp_free is for non-gc'ed objects. - */ - PyErr_Format(PyExc_TypeError, "type '%.100s' participates in " - "gc and is a base type but has inappropriate " - "tp_free slot", - type->tp_name); - goto error; - } - - /* if the type dictionary doesn't contain a __doc__, set it from - the tp_doc slot. - */ - if (PyDict_GetItemString(type->tp_dict, "__doc__") == NULL) { - if (type->tp_doc != NULL) { - PyObject *doc = PyString_FromString(type->tp_doc); - if (doc == NULL) - goto error; - PyDict_SetItemString(type->tp_dict, "__doc__", doc); - Py_DECREF(doc); - } else { - PyDict_SetItemString(type->tp_dict, - "__doc__", Py_None); - } - } - - /* Some more special stuff */ - base = type->tp_base; - if (base != NULL) { - if (type->tp_as_number == NULL) - type->tp_as_number = base->tp_as_number; - if (type->tp_as_sequence == NULL) - type->tp_as_sequence = base->tp_as_sequence; - if (type->tp_as_mapping == NULL) - type->tp_as_mapping = base->tp_as_mapping; - if (type->tp_as_buffer == NULL) - type->tp_as_buffer = base->tp_as_buffer; - } - - /* Link into each base class's list of subclasses */ - bases = type->tp_bases; - n = PyTuple_GET_SIZE(bases); - for (i = 0; i < n; i++) { - PyObject *b = PyTuple_GET_ITEM(bases, i); - if (PyType_Check(b) && - add_subclass((PyTypeObject *)b, type) < 0) - goto error; - } - - /* All done -- set the ready flag */ - assert(type->tp_dict != NULL); - type->tp_flags = - (type->tp_flags & ~Py_TPFLAGS_READYING) | Py_TPFLAGS_READY; - return 0; - - error: - type->tp_flags &= ~Py_TPFLAGS_READYING; - return -1; -} - -static int -add_subclass(PyTypeObject *base, PyTypeObject *type) -{ - Py_ssize_t i; - int result; - PyObject *list, *ref, *newobj; - - list = base->tp_subclasses; - if (list == NULL) { - base->tp_subclasses = list = PyList_New(0); - if (list == NULL) - return -1; - } - assert(PyList_Check(list)); - newobj = PyWeakref_NewRef((PyObject *)type, NULL); - i = PyList_GET_SIZE(list); - while (--i >= 0) { - ref = PyList_GET_ITEM(list, i); - assert(PyWeakref_CheckRef(ref)); - if (PyWeakref_GET_OBJECT(ref) == Py_None) - return PyList_SetItem(list, i, newobj); - } - result = PyList_Append(list, newobj); - Py_DECREF(newobj); - return result; -} - -static void -remove_subclass(PyTypeObject *base, PyTypeObject *type) -{ - Py_ssize_t i; - PyObject *list, *ref; - - list = base->tp_subclasses; - if (list == NULL) { - return; - } - assert(PyList_Check(list)); - i = PyList_GET_SIZE(list); - while (--i >= 0) { - ref = PyList_GET_ITEM(list, i); - assert(PyWeakref_CheckRef(ref)); - if (PyWeakref_GET_OBJECT(ref) == (PyObject*)type) { - /* this can't fail, right? */ - PySequence_DelItem(list, i); - return; - } - } -} - -static int -check_num_args(PyObject *ob, int n) -{ - if (!PyTuple_CheckExact(ob)) { - PyErr_SetString(PyExc_SystemError, - "PyArg_UnpackTuple() argument list is not a tuple"); - return 0; - } - if (n == PyTuple_GET_SIZE(ob)) - return 1; - PyErr_Format( - PyExc_TypeError, - "expected %d arguments, got %zd", n, PyTuple_GET_SIZE(ob)); - return 0; -} - -/* Generic wrappers for overloadable 'operators' such as __getitem__ */ - -/* There's a wrapper *function* for each distinct function typedef used - for type object slots (e.g. binaryfunc, ternaryfunc, etc.). There's a - wrapper *table* for each distinct operation (e.g. __len__, __add__). - Most tables have only one entry; the tables for binary operators have two - entries, one regular and one with reversed arguments. */ - -static PyObject * -wrap_lenfunc(PyObject *self, PyObject *args, void *wrapped) -{ - lenfunc func = (lenfunc)wrapped; - Py_ssize_t res; - - if (!check_num_args(args, 0)) - return NULL; - res = (*func)(self); - if (res == -1 && PyErr_Occurred()) - return NULL; - return PyInt_FromLong((long)res); -} - -static PyObject * -wrap_inquirypred(PyObject *self, PyObject *args, void *wrapped) -{ - inquiry func = (inquiry)wrapped; - int res; - - if (!check_num_args(args, 0)) - return NULL; - res = (*func)(self); - if (res == -1 && PyErr_Occurred()) - return NULL; - return PyBool_FromLong((long)res); -} - -static PyObject * -wrap_binaryfunc(PyObject *self, PyObject *args, void *wrapped) -{ - binaryfunc func = (binaryfunc)wrapped; - PyObject *other; - - if (!check_num_args(args, 1)) - return NULL; - other = PyTuple_GET_ITEM(args, 0); - return (*func)(self, other); -} - -static PyObject * -wrap_binaryfunc_l(PyObject *self, PyObject *args, void *wrapped) -{ - binaryfunc func = (binaryfunc)wrapped; - PyObject *other; - - if (!check_num_args(args, 1)) - return NULL; - other = PyTuple_GET_ITEM(args, 0); - if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) && - !PyType_IsSubtype(other->ob_type, self->ob_type)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return (*func)(self, other); -} - -static PyObject * -wrap_binaryfunc_r(PyObject *self, PyObject *args, void *wrapped) -{ - binaryfunc func = (binaryfunc)wrapped; - PyObject *other; - - if (!check_num_args(args, 1)) - return NULL; - other = PyTuple_GET_ITEM(args, 0); - if (!(self->ob_type->tp_flags & Py_TPFLAGS_CHECKTYPES) && - !PyType_IsSubtype(other->ob_type, self->ob_type)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return (*func)(other, self); -} - -static PyObject * -wrap_coercefunc(PyObject *self, PyObject *args, void *wrapped) -{ - coercion func = (coercion)wrapped; - PyObject *other, *res; - int ok; - - if (!check_num_args(args, 1)) - return NULL; - other = PyTuple_GET_ITEM(args, 0); - ok = func(&self, &other); - if (ok < 0) - return NULL; - if (ok > 0) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - res = PyTuple_New(2); - if (res == NULL) { - Py_DECREF(self); - Py_DECREF(other); - return NULL; - } - PyTuple_SET_ITEM(res, 0, self); - PyTuple_SET_ITEM(res, 1, other); - return res; -} - -static PyObject * -wrap_ternaryfunc(PyObject *self, PyObject *args, void *wrapped) -{ - ternaryfunc func = (ternaryfunc)wrapped; - PyObject *other; - PyObject *third = Py_None; - - /* Note: This wrapper only works for __pow__() */ - - if (!PyArg_UnpackTuple(args, "", 1, 2, &other, &third)) - return NULL; - return (*func)(self, other, third); -} - -static PyObject * -wrap_ternaryfunc_r(PyObject *self, PyObject *args, void *wrapped) -{ - ternaryfunc func = (ternaryfunc)wrapped; - PyObject *other; - PyObject *third = Py_None; - - /* Note: This wrapper only works for __pow__() */ - - if (!PyArg_UnpackTuple(args, "", 1, 2, &other, &third)) - return NULL; - return (*func)(other, self, third); -} - -static PyObject * -wrap_unaryfunc(PyObject *self, PyObject *args, void *wrapped) -{ - unaryfunc func = (unaryfunc)wrapped; - - if (!check_num_args(args, 0)) - return NULL; - return (*func)(self); -} - -static PyObject * -wrap_indexargfunc(PyObject *self, PyObject *args, void *wrapped) -{ - ssizeargfunc func = (ssizeargfunc)wrapped; - PyObject* o; - Py_ssize_t i; - - if (!PyArg_UnpackTuple(args, "", 1, 1, &o)) - return NULL; - i = PyNumber_AsSsize_t(o, PyExc_OverflowError); - if (i == -1 && PyErr_Occurred()) - return NULL; - return (*func)(self, i); -} - -static Py_ssize_t -getindex(PyObject *self, PyObject *arg) -{ - Py_ssize_t i; - - i = PyNumber_AsSsize_t(arg, PyExc_OverflowError); - if (i == -1 && PyErr_Occurred()) - return -1; - if (i < 0) { - PySequenceMethods *sq = Py_TYPE(self)->tp_as_sequence; - if (sq && sq->sq_length) { - Py_ssize_t n = (*sq->sq_length)(self); - if (n < 0) - return -1; - i += n; - } - } - return i; -} - -static PyObject * -wrap_sq_item(PyObject *self, PyObject *args, void *wrapped) -{ - ssizeargfunc func = (ssizeargfunc)wrapped; - PyObject *arg; - Py_ssize_t i; - - if (PyTuple_GET_SIZE(args) == 1) { - arg = PyTuple_GET_ITEM(args, 0); - i = getindex(self, arg); - if (i == -1 && PyErr_Occurred()) - return NULL; - return (*func)(self, i); - } - check_num_args(args, 1); - assert(PyErr_Occurred()); - return NULL; -} - -static PyObject * -wrap_ssizessizeargfunc(PyObject *self, PyObject *args, void *wrapped) -{ - ssizessizeargfunc func = (ssizessizeargfunc)wrapped; - Py_ssize_t i, j; - - if (!PyArg_ParseTuple(args, "nn", &i, &j)) - return NULL; - return (*func)(self, i, j); -} - -static PyObject * -wrap_sq_setitem(PyObject *self, PyObject *args, void *wrapped) -{ - ssizeobjargproc func = (ssizeobjargproc)wrapped; - Py_ssize_t i; - int res; - PyObject *arg, *value; - - if (!PyArg_UnpackTuple(args, "", 2, 2, &arg, &value)) - return NULL; - i = getindex(self, arg); - if (i == -1 && PyErr_Occurred()) - return NULL; - res = (*func)(self, i, value); - if (res == -1 && PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_sq_delitem(PyObject *self, PyObject *args, void *wrapped) -{ - ssizeobjargproc func = (ssizeobjargproc)wrapped; - Py_ssize_t i; - int res; - PyObject *arg; - - if (!check_num_args(args, 1)) - return NULL; - arg = PyTuple_GET_ITEM(args, 0); - i = getindex(self, arg); - if (i == -1 && PyErr_Occurred()) - return NULL; - res = (*func)(self, i, NULL); - if (res == -1 && PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_ssizessizeobjargproc(PyObject *self, PyObject *args, void *wrapped) -{ - ssizessizeobjargproc func = (ssizessizeobjargproc)wrapped; - Py_ssize_t i, j; - int res; - PyObject *value; - - if (!PyArg_ParseTuple(args, "nnO", &i, &j, &value)) - return NULL; - res = (*func)(self, i, j, value); - if (res == -1 && PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_delslice(PyObject *self, PyObject *args, void *wrapped) -{ - ssizessizeobjargproc func = (ssizessizeobjargproc)wrapped; - Py_ssize_t i, j; - int res; - - if (!PyArg_ParseTuple(args, "nn", &i, &j)) - return NULL; - res = (*func)(self, i, j, NULL); - if (res == -1 && PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -/* XXX objobjproc is a misnomer; should be objargpred */ -static PyObject * -wrap_objobjproc(PyObject *self, PyObject *args, void *wrapped) -{ - objobjproc func = (objobjproc)wrapped; - int res; - PyObject *value; - - if (!check_num_args(args, 1)) - return NULL; - value = PyTuple_GET_ITEM(args, 0); - res = (*func)(self, value); - if (res == -1 && PyErr_Occurred()) - return NULL; - else - return PyBool_FromLong(res); -} - -static PyObject * -wrap_objobjargproc(PyObject *self, PyObject *args, void *wrapped) -{ - objobjargproc func = (objobjargproc)wrapped; - int res; - PyObject *key, *value; - - if (!PyArg_UnpackTuple(args, "", 2, 2, &key, &value)) - return NULL; - res = (*func)(self, key, value); - if (res == -1 && PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_delitem(PyObject *self, PyObject *args, void *wrapped) -{ - objobjargproc func = (objobjargproc)wrapped; - int res; - PyObject *key; - - if (!check_num_args(args, 1)) - return NULL; - key = PyTuple_GET_ITEM(args, 0); - res = (*func)(self, key, NULL); - if (res == -1 && PyErr_Occurred()) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_cmpfunc(PyObject *self, PyObject *args, void *wrapped) -{ - cmpfunc func = (cmpfunc)wrapped; - int res; - PyObject *other; - - if (!check_num_args(args, 1)) - return NULL; - other = PyTuple_GET_ITEM(args, 0); - if (Py_TYPE(other)->tp_compare != func && - !PyType_IsSubtype(Py_TYPE(other), Py_TYPE(self))) { - PyErr_Format( - PyExc_TypeError, - "%s.__cmp__(x,y) requires y to be a '%s', not a '%s'", - Py_TYPE(self)->tp_name, - Py_TYPE(self)->tp_name, - Py_TYPE(other)->tp_name); - return NULL; - } - res = (*func)(self, other); - if (PyErr_Occurred()) - return NULL; - return PyInt_FromLong((long)res); -} - -/* Helper to check for object.__setattr__ or __delattr__ applied to a type. - This is called the Carlo Verre hack after its discoverer. */ -static int -hackcheck(PyObject *self, setattrofunc func, char *what) -{ - PyTypeObject *type = Py_TYPE(self); - while (type && type->tp_flags & Py_TPFLAGS_HEAPTYPE) - type = type->tp_base; - /* If type is NULL now, this is a really weird type. - In the spirit of backwards compatibility (?), just shut up. */ - if (type && type->tp_setattro != func) { - PyErr_Format(PyExc_TypeError, - "can't apply this %s to %s object", - what, - type->tp_name); - return 0; - } - return 1; -} - -static PyObject * -wrap_setattr(PyObject *self, PyObject *args, void *wrapped) -{ - setattrofunc func = (setattrofunc)wrapped; - int res; - PyObject *name, *value; - - if (!PyArg_UnpackTuple(args, "", 2, 2, &name, &value)) - return NULL; - if (!hackcheck(self, func, "__setattr__")) - return NULL; - res = (*func)(self, name, value); - if (res < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_delattr(PyObject *self, PyObject *args, void *wrapped) -{ - setattrofunc func = (setattrofunc)wrapped; - int res; - PyObject *name; - - if (!check_num_args(args, 1)) - return NULL; - name = PyTuple_GET_ITEM(args, 0); - if (!hackcheck(self, func, "__delattr__")) - return NULL; - res = (*func)(self, name, NULL); - if (res < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_hashfunc(PyObject *self, PyObject *args, void *wrapped) -{ - hashfunc func = (hashfunc)wrapped; - long res; - - if (!check_num_args(args, 0)) - return NULL; - res = (*func)(self); - if (res == -1 && PyErr_Occurred()) - return NULL; - return PyInt_FromLong(res); -} - -static PyObject * -wrap_call(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds) -{ - ternaryfunc func = (ternaryfunc)wrapped; - - return (*func)(self, args, kwds); -} - -static PyObject * -wrap_richcmpfunc(PyObject *self, PyObject *args, void *wrapped, int op) -{ - richcmpfunc func = (richcmpfunc)wrapped; - PyObject *other; - - if (!check_num_args(args, 1)) - return NULL; - other = PyTuple_GET_ITEM(args, 0); - return (*func)(self, other, op); -} - -#undef RICHCMP_WRAPPER -#define RICHCMP_WRAPPER(NAME, OP) \ -static PyObject * \ -richcmp_##NAME(PyObject *self, PyObject *args, void *wrapped) \ -{ \ - return wrap_richcmpfunc(self, args, wrapped, OP); \ -} - -RICHCMP_WRAPPER(lt, Py_LT) -RICHCMP_WRAPPER(le, Py_LE) -RICHCMP_WRAPPER(eq, Py_EQ) -RICHCMP_WRAPPER(ne, Py_NE) -RICHCMP_WRAPPER(gt, Py_GT) -RICHCMP_WRAPPER(ge, Py_GE) - -static PyObject * -wrap_next(PyObject *self, PyObject *args, void *wrapped) -{ - unaryfunc func = (unaryfunc)wrapped; - PyObject *res; - - if (!check_num_args(args, 0)) - return NULL; - res = (*func)(self); - if (res == NULL && !PyErr_Occurred()) - PyErr_SetNone(PyExc_StopIteration); - return res; -} - -static PyObject * -wrap_descr_get(PyObject *self, PyObject *args, void *wrapped) -{ - descrgetfunc func = (descrgetfunc)wrapped; - PyObject *obj; - PyObject *type = NULL; - - if (!PyArg_UnpackTuple(args, "", 1, 2, &obj, &type)) - return NULL; - if (obj == Py_None) - obj = NULL; - if (type == Py_None) - type = NULL; - if (type == NULL &&obj == NULL) { - PyErr_SetString(PyExc_TypeError, - "__get__(None, None) is invalid"); - return NULL; - } - return (*func)(self, obj, type); -} - -static PyObject * -wrap_descr_set(PyObject *self, PyObject *args, void *wrapped) -{ - descrsetfunc func = (descrsetfunc)wrapped; - PyObject *obj, *value; - int ret; - - if (!PyArg_UnpackTuple(args, "", 2, 2, &obj, &value)) - return NULL; - ret = (*func)(self, obj, value); - if (ret < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_descr_delete(PyObject *self, PyObject *args, void *wrapped) -{ - descrsetfunc func = (descrsetfunc)wrapped; - PyObject *obj; - int ret; - - if (!check_num_args(args, 1)) - return NULL; - obj = PyTuple_GET_ITEM(args, 0); - ret = (*func)(self, obj, NULL); - if (ret < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -wrap_init(PyObject *self, PyObject *args, void *wrapped, PyObject *kwds) -{ - initproc func = (initproc)wrapped; - - if (func(self, args, kwds) < 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -tp_new_wrapper(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyTypeObject *type, *subtype, *staticbase; - PyObject *arg0, *res; - - if (self == NULL || !PyType_Check(self)) - Py_FatalError("__new__() called with non-type 'self'"); - type = (PyTypeObject *)self; - if (!PyTuple_Check(args) || PyTuple_GET_SIZE(args) < 1) { - PyErr_Format(PyExc_TypeError, - "%s.__new__(): not enough arguments", - type->tp_name); - return NULL; - } - arg0 = PyTuple_GET_ITEM(args, 0); - if (!PyType_Check(arg0)) { - PyErr_Format(PyExc_TypeError, - "%s.__new__(X): X is not a type object (%s)", - type->tp_name, - Py_TYPE(arg0)->tp_name); - return NULL; - } - subtype = (PyTypeObject *)arg0; - if (!PyType_IsSubtype(subtype, type)) { - PyErr_Format(PyExc_TypeError, - "%s.__new__(%s): %s is not a subtype of %s", - type->tp_name, - subtype->tp_name, - subtype->tp_name, - type->tp_name); - return NULL; - } - - /* Check that the use doesn't do something silly and unsafe like - object.__new__(dict). To do this, we check that the - most derived base that's not a heap type is this type. */ - staticbase = subtype; - while (staticbase && (staticbase->tp_flags & Py_TPFLAGS_HEAPTYPE)) - staticbase = staticbase->tp_base; - /* If staticbase is NULL now, it is a really weird type. - In the spirit of backwards compatibility (?), just shut up. */ - if (staticbase && staticbase->tp_new != type->tp_new) { - PyErr_Format(PyExc_TypeError, - "%s.__new__(%s) is not safe, use %s.__new__()", - type->tp_name, - subtype->tp_name, - staticbase->tp_name); - return NULL; - } - - args = PyTuple_GetSlice(args, 1, PyTuple_GET_SIZE(args)); - if (args == NULL) - return NULL; - res = type->tp_new(subtype, args, kwds); - Py_DECREF(args); - return res; -} - -static struct PyMethodDef tp_new_methoddef[] = { - {"__new__", (PyCFunction)tp_new_wrapper, METH_VARARGS|METH_KEYWORDS, - PyDoc_STR("T.__new__(S, ...) -> " - "a new object with type S, a subtype of T")}, - {0} -}; - -static int -add_tp_new_wrapper(PyTypeObject *type) -{ - PyObject *func; - - if (PyDict_GetItemString(type->tp_dict, "__new__") != NULL) - return 0; - func = PyCFunction_New(tp_new_methoddef, (PyObject *)type); - if (func == NULL) - return -1; - if (PyDict_SetItemString(type->tp_dict, "__new__", func)) { - Py_DECREF(func); - return -1; - } - Py_DECREF(func); - return 0; -} - -/* Slot wrappers that call the corresponding __foo__ slot. See comments - below at override_slots() for more explanation. */ - -#define SLOT0(FUNCNAME, OPSTR) \ -static PyObject * \ -FUNCNAME(PyObject *self) \ -{ \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, "()"); \ -} - -#define SLOT1(FUNCNAME, OPSTR, ARG1TYPE, ARGCODES) \ -static PyObject * \ -FUNCNAME(PyObject *self, ARG1TYPE arg1) \ -{ \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, "(" ARGCODES ")", arg1); \ -} - -/* Boolean helper for SLOT1BINFULL(). - right.__class__ is a nontrivial subclass of left.__class__. */ -static int -method_is_overloaded(PyObject *left, PyObject *right, char *name) -{ - PyObject *a, *b; - int ok; - - b = PyObject_GetAttrString((PyObject *)(Py_TYPE(right)), name); - if (b == NULL) { - PyErr_Clear(); - /* If right doesn't have it, it's not overloaded */ - return 0; - } - - a = PyObject_GetAttrString((PyObject *)(Py_TYPE(left)), name); - if (a == NULL) { - PyErr_Clear(); - Py_DECREF(b); - /* If right has it but left doesn't, it's overloaded */ - return 1; - } - - ok = PyObject_RichCompareBool(a, b, Py_NE); - Py_DECREF(a); - Py_DECREF(b); - if (ok < 0) { - PyErr_Clear(); - return 0; - } - - return ok; -} - - -#define SLOT1BINFULL(FUNCNAME, TESTFUNC, SLOTNAME, OPSTR, ROPSTR) \ -static PyObject * \ -FUNCNAME(PyObject *self, PyObject *other) \ -{ \ - static PyObject *cache_str, *rcache_str; \ - int do_other = Py_TYPE(self) != Py_TYPE(other) && \ - Py_TYPE(other)->tp_as_number != NULL && \ - Py_TYPE(other)->tp_as_number->SLOTNAME == TESTFUNC; \ - if (Py_TYPE(self)->tp_as_number != NULL && \ - Py_TYPE(self)->tp_as_number->SLOTNAME == TESTFUNC) { \ - PyObject *r; \ - if (do_other && \ - PyType_IsSubtype(Py_TYPE(other), Py_TYPE(self)) && \ - method_is_overloaded(self, other, ROPSTR)) { \ - r = call_maybe( \ - other, ROPSTR, &rcache_str, "(O)", self); \ - if (r != Py_NotImplemented) \ - return r; \ - Py_DECREF(r); \ - do_other = 0; \ - } \ - r = call_maybe( \ - self, OPSTR, &cache_str, "(O)", other); \ - if (r != Py_NotImplemented || \ - Py_TYPE(other) == Py_TYPE(self)) \ - return r; \ - Py_DECREF(r); \ - } \ - if (do_other) { \ - return call_maybe( \ - other, ROPSTR, &rcache_str, "(O)", self); \ - } \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ -} - -#define SLOT1BIN(FUNCNAME, SLOTNAME, OPSTR, ROPSTR) \ - SLOT1BINFULL(FUNCNAME, FUNCNAME, SLOTNAME, OPSTR, ROPSTR) - -#define SLOT2(FUNCNAME, OPSTR, ARG1TYPE, ARG2TYPE, ARGCODES) \ -static PyObject * \ -FUNCNAME(PyObject *self, ARG1TYPE arg1, ARG2TYPE arg2) \ -{ \ - static PyObject *cache_str; \ - return call_method(self, OPSTR, &cache_str, \ - "(" ARGCODES ")", arg1, arg2); \ -} - -static Py_ssize_t -slot_sq_length(PyObject *self) -{ - static PyObject *len_str; - PyObject *res = call_method(self, "__len__", &len_str, "()"); - Py_ssize_t len; - - if (res == NULL) - return -1; - len = PyInt_AsSsize_t(res); - Py_DECREF(res); - if (len < 0) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_ValueError, - "__len__() should return >= 0"); - return -1; - } - return len; -} - -/* Super-optimized version of slot_sq_item. - Other slots could do the same... */ -static PyObject * -slot_sq_item(PyObject *self, Py_ssize_t i) -{ - static PyObject *getitem_str; - PyObject *func, *args = NULL, *ival = NULL, *retval = NULL; - descrgetfunc f; - - if (getitem_str == NULL) { - getitem_str = PyString_InternFromString("__getitem__"); - if (getitem_str == NULL) - return NULL; - } - func = _PyType_Lookup(Py_TYPE(self), getitem_str); - if (func != NULL) { - if ((f = Py_TYPE(func)->tp_descr_get) == NULL) - Py_INCREF(func); - else { - func = f(func, self, (PyObject *)(Py_TYPE(self))); - if (func == NULL) { - return NULL; - } - } - ival = PyInt_FromSsize_t(i); - if (ival != NULL) { - args = PyTuple_New(1); - if (args != NULL) { - PyTuple_SET_ITEM(args, 0, ival); - retval = PyObject_Call(func, args, NULL); - Py_XDECREF(args); - Py_XDECREF(func); - return retval; - } - } - } - else { - PyErr_SetObject(PyExc_AttributeError, getitem_str); - } - Py_XDECREF(args); - Py_XDECREF(ival); - Py_XDECREF(func); - return NULL; -} - -static PyObject* -slot_sq_slice(PyObject *self, Py_ssize_t i, Py_ssize_t j) -{ - static PyObject *getslice_str; - - if (PyErr_WarnPy3k("in 3.x, __getslice__ has been removed; " - "use __getitem__", 1) < 0) - return NULL; - return call_method(self, "__getslice__", &getslice_str, - "nn", i, j); -} - -static int -slot_sq_ass_item(PyObject *self, Py_ssize_t index, PyObject *value) -{ - PyObject *res; - static PyObject *delitem_str, *setitem_str; - - if (value == NULL) - res = call_method(self, "__delitem__", &delitem_str, - "(n)", index); - else - res = call_method(self, "__setitem__", &setitem_str, - "(nO)", index, value); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static int -slot_sq_ass_slice(PyObject *self, Py_ssize_t i, Py_ssize_t j, PyObject *value) -{ - PyObject *res; - static PyObject *delslice_str, *setslice_str; - - if (value == NULL) { - if (PyErr_WarnPy3k("in 3.x, __delslice__ has been removed; " - "use __delitem__", 1) < 0) - return -1; - res = call_method(self, "__delslice__", &delslice_str, - "(nn)", i, j); - } - else { - if (PyErr_WarnPy3k("in 3.x, __setslice__ has been removed; " - "use __setitem__", 1) < 0) - return -1; - res = call_method(self, "__setslice__", &setslice_str, - "(nnO)", i, j, value); - } - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static int -slot_sq_contains(PyObject *self, PyObject *value) -{ - PyObject *func, *res, *args; - int result = -1; - - static PyObject *contains_str; - - func = lookup_maybe(self, "__contains__", &contains_str); - if (func != NULL) { - args = PyTuple_Pack(1, value); - if (args == NULL) - res = NULL; - else { - res = PyObject_Call(func, args, NULL); - Py_DECREF(args); - } - Py_DECREF(func); - if (res != NULL) { - result = PyObject_IsTrue(res); - Py_DECREF(res); - } - } - else if (! PyErr_Occurred()) { - /* Possible results: -1 and 1 */ - result = (int)_PySequence_IterSearch(self, value, - PY_ITERSEARCH_CONTAINS); - } - return result; -} - -#define slot_mp_length slot_sq_length - -SLOT1(slot_mp_subscript, "__getitem__", PyObject *, "O") - -static int -slot_mp_ass_subscript(PyObject *self, PyObject *key, PyObject *value) -{ - PyObject *res; - static PyObject *delitem_str, *setitem_str; - - if (value == NULL) - res = call_method(self, "__delitem__", &delitem_str, - "(O)", key); - else - res = call_method(self, "__setitem__", &setitem_str, - "(OO)", key, value); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -SLOT1BIN(slot_nb_add, nb_add, "__add__", "__radd__") -SLOT1BIN(slot_nb_subtract, nb_subtract, "__sub__", "__rsub__") -SLOT1BIN(slot_nb_multiply, nb_multiply, "__mul__", "__rmul__") -SLOT1BIN(slot_nb_divide, nb_divide, "__div__", "__rdiv__") -SLOT1BIN(slot_nb_remainder, nb_remainder, "__mod__", "__rmod__") -SLOT1BIN(slot_nb_divmod, nb_divmod, "__divmod__", "__rdivmod__") - -static PyObject *slot_nb_power(PyObject *, PyObject *, PyObject *); - -SLOT1BINFULL(slot_nb_power_binary, slot_nb_power, - nb_power, "__pow__", "__rpow__") - -static PyObject * -slot_nb_power(PyObject *self, PyObject *other, PyObject *modulus) -{ - static PyObject *pow_str; - - if (modulus == Py_None) - return slot_nb_power_binary(self, other); - /* Three-arg power doesn't use __rpow__. But ternary_op - can call this when the second argument's type uses - slot_nb_power, so check before calling self.__pow__. */ - if (Py_TYPE(self)->tp_as_number != NULL && - Py_TYPE(self)->tp_as_number->nb_power == slot_nb_power) { - return call_method(self, "__pow__", &pow_str, - "(OO)", other, modulus); - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -SLOT0(slot_nb_negative, "__neg__") -SLOT0(slot_nb_positive, "__pos__") -SLOT0(slot_nb_absolute, "__abs__") - -static int -slot_nb_nonzero(PyObject *self) -{ - PyObject *func, *args; - static PyObject *nonzero_str, *len_str; - int result = -1; - int using_len = 0; - - func = lookup_maybe(self, "__nonzero__", &nonzero_str); - if (func == NULL) { - if (PyErr_Occurred()) - return -1; - func = lookup_maybe(self, "__len__", &len_str); - if (func == NULL) - return PyErr_Occurred() ? -1 : 1; - using_len = 1; - } - args = PyTuple_New(0); - if (args != NULL) { - PyObject *temp = PyObject_Call(func, args, NULL); - Py_DECREF(args); - if (temp != NULL) { - if (PyInt_CheckExact(temp) || PyBool_Check(temp)) - result = PyObject_IsTrue(temp); - else { - PyErr_Format(PyExc_TypeError, - "%s should return " - "bool or int, returned %s", - (using_len ? "__len__" - : "__nonzero__"), - temp->ob_type->tp_name); - result = -1; - } - Py_DECREF(temp); - } - } - Py_DECREF(func); - return result; -} - - -static PyObject * -slot_nb_index(PyObject *self) -{ - static PyObject *index_str; - return call_method(self, "__index__", &index_str, "()"); -} - - -SLOT0(slot_nb_invert, "__invert__") -SLOT1BIN(slot_nb_lshift, nb_lshift, "__lshift__", "__rlshift__") -SLOT1BIN(slot_nb_rshift, nb_rshift, "__rshift__", "__rrshift__") -SLOT1BIN(slot_nb_and, nb_and, "__and__", "__rand__") -SLOT1BIN(slot_nb_xor, nb_xor, "__xor__", "__rxor__") -SLOT1BIN(slot_nb_or, nb_or, "__or__", "__ror__") - -static int -slot_nb_coerce(PyObject **a, PyObject **b) -{ - static PyObject *coerce_str; - PyObject *self = *a, *other = *b; - - if (self->ob_type->tp_as_number != NULL && - self->ob_type->tp_as_number->nb_coerce == slot_nb_coerce) { - PyObject *r; - r = call_maybe( - self, "__coerce__", &coerce_str, "(O)", other); - if (r == NULL) - return -1; - if (r == Py_NotImplemented) { - Py_DECREF(r); - } - else { - if (!PyTuple_Check(r) || PyTuple_GET_SIZE(r) != 2) { - PyErr_SetString(PyExc_TypeError, - "__coerce__ didn't return a 2-tuple"); - Py_DECREF(r); - return -1; - } - *a = PyTuple_GET_ITEM(r, 0); - Py_INCREF(*a); - *b = PyTuple_GET_ITEM(r, 1); - Py_INCREF(*b); - Py_DECREF(r); - return 0; - } - } - if (other->ob_type->tp_as_number != NULL && - other->ob_type->tp_as_number->nb_coerce == slot_nb_coerce) { - PyObject *r; - r = call_maybe( - other, "__coerce__", &coerce_str, "(O)", self); - if (r == NULL) - return -1; - if (r == Py_NotImplemented) { - Py_DECREF(r); - return 1; - } - if (!PyTuple_Check(r) || PyTuple_GET_SIZE(r) != 2) { - PyErr_SetString(PyExc_TypeError, - "__coerce__ didn't return a 2-tuple"); - Py_DECREF(r); - return -1; - } - *a = PyTuple_GET_ITEM(r, 1); - Py_INCREF(*a); - *b = PyTuple_GET_ITEM(r, 0); - Py_INCREF(*b); - Py_DECREF(r); - return 0; - } - return 1; -} - -SLOT0(slot_nb_int, "__int__") -SLOT0(slot_nb_long, "__long__") -SLOT0(slot_nb_float, "__float__") -SLOT0(slot_nb_oct, "__oct__") -SLOT0(slot_nb_hex, "__hex__") -SLOT1(slot_nb_inplace_add, "__iadd__", PyObject *, "O") -SLOT1(slot_nb_inplace_subtract, "__isub__", PyObject *, "O") -SLOT1(slot_nb_inplace_multiply, "__imul__", PyObject *, "O") -SLOT1(slot_nb_inplace_divide, "__idiv__", PyObject *, "O") -SLOT1(slot_nb_inplace_remainder, "__imod__", PyObject *, "O") -/* Can't use SLOT1 here, because nb_inplace_power is ternary */ -static PyObject * -slot_nb_inplace_power(PyObject *self, PyObject * arg1, PyObject *arg2) -{ - static PyObject *cache_str; - return call_method(self, "__ipow__", &cache_str, "(" "O" ")", arg1); -} -SLOT1(slot_nb_inplace_lshift, "__ilshift__", PyObject *, "O") -SLOT1(slot_nb_inplace_rshift, "__irshift__", PyObject *, "O") -SLOT1(slot_nb_inplace_and, "__iand__", PyObject *, "O") -SLOT1(slot_nb_inplace_xor, "__ixor__", PyObject *, "O") -SLOT1(slot_nb_inplace_or, "__ior__", PyObject *, "O") -SLOT1BIN(slot_nb_floor_divide, nb_floor_divide, - "__floordiv__", "__rfloordiv__") -SLOT1BIN(slot_nb_true_divide, nb_true_divide, "__truediv__", "__rtruediv__") -SLOT1(slot_nb_inplace_floor_divide, "__ifloordiv__", PyObject *, "O") -SLOT1(slot_nb_inplace_true_divide, "__itruediv__", PyObject *, "O") - -static int -half_compare(PyObject *self, PyObject *other) -{ - PyObject *func, *args, *res; - static PyObject *cmp_str; - Py_ssize_t c; - - func = lookup_method(self, "__cmp__", &cmp_str); - if (func == NULL) { - PyErr_Clear(); - } - else { - args = PyTuple_Pack(1, other); - if (args == NULL) - res = NULL; - else { - res = PyObject_Call(func, args, NULL); - Py_DECREF(args); - } - Py_DECREF(func); - if (res != Py_NotImplemented) { - if (res == NULL) - return -2; - c = PyInt_AsLong(res); - Py_DECREF(res); - if (c == -1 && PyErr_Occurred()) - return -2; - return (c < 0) ? -1 : (c > 0) ? 1 : 0; - } - Py_DECREF(res); - } - return 2; -} - -/* This slot is published for the benefit of try_3way_compare in object.c */ -int -_PyObject_SlotCompare(PyObject *self, PyObject *other) -{ - int c; - - if (Py_TYPE(self)->tp_compare == _PyObject_SlotCompare) { - c = half_compare(self, other); - if (c <= 1) - return c; - } - if (Py_TYPE(other)->tp_compare == _PyObject_SlotCompare) { - c = half_compare(other, self); - if (c < -1) - return -2; - if (c <= 1) - return -c; - } - return (void *)self < (void *)other ? -1 : - (void *)self > (void *)other ? 1 : 0; -} - -static PyObject * -slot_tp_repr(PyObject *self) -{ - PyObject *func, *res; - static PyObject *repr_str; - - func = lookup_method(self, "__repr__", &repr_str); - if (func != NULL) { - res = PyEval_CallObject(func, NULL); - Py_DECREF(func); - return res; - } - PyErr_Clear(); - return PyString_FromFormat("<%s object at %p>", - Py_TYPE(self)->tp_name, self); -} - -static PyObject * -slot_tp_str(PyObject *self) -{ - PyObject *func, *res; - static PyObject *str_str; - - func = lookup_method(self, "__str__", &str_str); - if (func != NULL) { - res = PyEval_CallObject(func, NULL); - Py_DECREF(func); - return res; - } - else { - PyErr_Clear(); - return slot_tp_repr(self); - } -} - -static long -slot_tp_hash(PyObject *self) -{ - PyObject *func; - static PyObject *hash_str, *eq_str, *cmp_str; - long h; - - func = lookup_method(self, "__hash__", &hash_str); - - if (func != NULL && func != Py_None) { - PyObject *res = PyEval_CallObject(func, NULL); - Py_DECREF(func); - if (res == NULL) - return -1; - if (PyLong_Check(res)) - h = PyLong_Type.tp_hash(res); - else - h = PyInt_AsLong(res); - Py_DECREF(res); - } - else { - Py_XDECREF(func); /* may be None */ - PyErr_Clear(); - func = lookup_method(self, "__eq__", &eq_str); - if (func == NULL) { - PyErr_Clear(); - func = lookup_method(self, "__cmp__", &cmp_str); - } - if (func != NULL) { - Py_DECREF(func); - return PyObject_HashNotImplemented(self); - } - PyErr_Clear(); - h = _Py_HashPointer((void *)self); - } - if (h == -1 && !PyErr_Occurred()) - h = -2; - return h; -} - -static PyObject * -slot_tp_call(PyObject *self, PyObject *args, PyObject *kwds) -{ - static PyObject *call_str; - PyObject *meth = lookup_method(self, "__call__", &call_str); - PyObject *res; - - if (meth == NULL) - return NULL; - - res = PyObject_Call(meth, args, kwds); - - Py_DECREF(meth); - return res; -} - -/* There are two slot dispatch functions for tp_getattro. - - - slot_tp_getattro() is used when __getattribute__ is overridden - but no __getattr__ hook is present; - - - slot_tp_getattr_hook() is used when a __getattr__ hook is present. - - The code in update_one_slot() always installs slot_tp_getattr_hook(); this - detects the absence of __getattr__ and then installs the simpler slot if - necessary. */ - -static PyObject * -slot_tp_getattro(PyObject *self, PyObject *name) -{ - static PyObject *getattribute_str = NULL; - return call_method(self, "__getattribute__", &getattribute_str, - "(O)", name); -} - -static PyObject * -call_attribute(PyObject *self, PyObject *attr, PyObject *name) -{ - PyObject *res, *descr = NULL; - descrgetfunc f = Py_TYPE(attr)->tp_descr_get; - - if (f != NULL) { - descr = f(attr, self, (PyObject *)(Py_TYPE(self))); - if (descr == NULL) - return NULL; - else - attr = descr; - } - res = PyObject_CallFunctionObjArgs(attr, name, NULL); - Py_XDECREF(descr); - return res; -} - -static PyObject * -slot_tp_getattr_hook(PyObject *self, PyObject *name) -{ - PyTypeObject *tp = Py_TYPE(self); - PyObject *getattr, *getattribute, *res; - static PyObject *getattribute_str = NULL; - static PyObject *getattr_str = NULL; - - if (getattr_str == NULL) { - getattr_str = PyString_InternFromString("__getattr__"); - if (getattr_str == NULL) - return NULL; - } - if (getattribute_str == NULL) { - getattribute_str = - PyString_InternFromString("__getattribute__"); - if (getattribute_str == NULL) - return NULL; - } - /* speed hack: we could use lookup_maybe, but that would resolve the - method fully for each attribute lookup for classes with - __getattr__, even when the attribute is present. So we use - _PyType_Lookup and create the method only when needed, with - call_attribute. */ - getattr = _PyType_Lookup(tp, getattr_str); - if (getattr == NULL) { - /* No __getattr__ hook: use a simpler dispatcher */ - tp->tp_getattro = slot_tp_getattro; - return slot_tp_getattro(self, name); - } - Py_INCREF(getattr); - /* speed hack: we could use lookup_maybe, but that would resolve the - method fully for each attribute lookup for classes with - __getattr__, even when self has the default __getattribute__ - method. So we use _PyType_Lookup and create the method only when - needed, with call_attribute. */ - getattribute = _PyType_Lookup(tp, getattribute_str); - if (getattribute == NULL || - (Py_TYPE(getattribute) == &PyWrapperDescr_Type && - ((PyWrapperDescrObject *)getattribute)->d_wrapped == - (void *)PyObject_GenericGetAttr)) - res = PyObject_GenericGetAttr(self, name); - else { - Py_INCREF(getattribute); - res = call_attribute(self, getattribute, name); - Py_DECREF(getattribute); - } - if (res == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - res = call_attribute(self, getattr, name); - } - Py_DECREF(getattr); - return res; -} - -static int -slot_tp_setattro(PyObject *self, PyObject *name, PyObject *value) -{ - PyObject *res; - static PyObject *delattr_str, *setattr_str; - - if (value == NULL) - res = call_method(self, "__delattr__", &delattr_str, - "(O)", name); - else - res = call_method(self, "__setattr__", &setattr_str, - "(OO)", name, value); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static char *name_op[] = { - "__lt__", - "__le__", - "__eq__", - "__ne__", - "__gt__", - "__ge__", -}; - -static PyObject * -half_richcompare(PyObject *self, PyObject *other, int op) -{ - PyObject *func, *args, *res; - static PyObject *op_str[6]; - - func = lookup_method(self, name_op[op], &op_str[op]); - if (func == NULL) { - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - args = PyTuple_Pack(1, other); - if (args == NULL) - res = NULL; - else { - res = PyObject_Call(func, args, NULL); - Py_DECREF(args); - } - Py_DECREF(func); - return res; -} - -static PyObject * -slot_tp_richcompare(PyObject *self, PyObject *other, int op) -{ - PyObject *res; - - if (Py_TYPE(self)->tp_richcompare == slot_tp_richcompare) { - res = half_richcompare(self, other, op); - if (res != Py_NotImplemented) - return res; - Py_DECREF(res); - } - if (Py_TYPE(other)->tp_richcompare == slot_tp_richcompare) { - res = half_richcompare(other, self, _Py_SwappedOp[op]); - if (res != Py_NotImplemented) { - return res; - } - Py_DECREF(res); - } - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; -} - -static PyObject * -slot_tp_iter(PyObject *self) -{ - PyObject *func, *res; - static PyObject *iter_str, *getitem_str; - - func = lookup_method(self, "__iter__", &iter_str); - if (func != NULL) { - PyObject *args; - args = res = PyTuple_New(0); - if (args != NULL) { - res = PyObject_Call(func, args, NULL); - Py_DECREF(args); - } - Py_DECREF(func); - return res; - } - PyErr_Clear(); - func = lookup_method(self, "__getitem__", &getitem_str); - if (func == NULL) { - PyErr_Format(PyExc_TypeError, - "'%.200s' object is not iterable", - Py_TYPE(self)->tp_name); - return NULL; - } - Py_DECREF(func); - return PySeqIter_New(self); -} - -static PyObject * -slot_tp_iternext(PyObject *self) -{ - static PyObject *next_str; - return call_method(self, "next", &next_str, "()"); -} - -static PyObject * -slot_tp_descr_get(PyObject *self, PyObject *obj, PyObject *type) -{ - PyTypeObject *tp = Py_TYPE(self); - PyObject *get; - static PyObject *get_str = NULL; - - if (get_str == NULL) { - get_str = PyString_InternFromString("__get__"); - if (get_str == NULL) - return NULL; - } - get = _PyType_Lookup(tp, get_str); - if (get == NULL) { - /* Avoid further slowdowns */ - if (tp->tp_descr_get == slot_tp_descr_get) - tp->tp_descr_get = NULL; - Py_INCREF(self); - return self; - } - if (obj == NULL) - obj = Py_None; - if (type == NULL) - type = Py_None; - return PyObject_CallFunctionObjArgs(get, self, obj, type, NULL); -} - -static int -slot_tp_descr_set(PyObject *self, PyObject *target, PyObject *value) -{ - PyObject *res; - static PyObject *del_str, *set_str; - - if (value == NULL) - res = call_method(self, "__delete__", &del_str, - "(O)", target); - else - res = call_method(self, "__set__", &set_str, - "(OO)", target, value); - if (res == NULL) - return -1; - Py_DECREF(res); - return 0; -} - -static int -slot_tp_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - static PyObject *init_str; - PyObject *meth = lookup_method(self, "__init__", &init_str); - PyObject *res; - - if (meth == NULL) - return -1; - res = PyObject_Call(meth, args, kwds); - Py_DECREF(meth); - if (res == NULL) - return -1; - if (res != Py_None) { - PyErr_Format(PyExc_TypeError, - "__init__() should return None, not '%.200s'", - Py_TYPE(res)->tp_name); - Py_DECREF(res); - return -1; - } - Py_DECREF(res); - return 0; -} - -static PyObject * -slot_tp_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - static PyObject *new_str; - PyObject *func; - PyObject *newargs, *x; - Py_ssize_t i, n; - - if (new_str == NULL) { - new_str = PyString_InternFromString("__new__"); - if (new_str == NULL) - return NULL; - } - func = PyObject_GetAttr((PyObject *)type, new_str); - if (func == NULL) - return NULL; - assert(PyTuple_Check(args)); - n = PyTuple_GET_SIZE(args); - newargs = PyTuple_New(n+1); - if (newargs == NULL) - return NULL; - Py_INCREF(type); - PyTuple_SET_ITEM(newargs, 0, (PyObject *)type); - for (i = 0; i < n; i++) { - x = PyTuple_GET_ITEM(args, i); - Py_INCREF(x); - PyTuple_SET_ITEM(newargs, i+1, x); - } - x = PyObject_Call(func, newargs, kwds); - Py_DECREF(newargs); - Py_DECREF(func); - return x; -} - -static void -slot_tp_del(PyObject *self) -{ - static PyObject *del_str = NULL; - PyObject *del, *res; - PyObject *error_type, *error_value, *error_traceback; - - /* Temporarily resurrect the object. */ - assert(self->ob_refcnt == 0); - self->ob_refcnt = 1; - - /* Save the current exception, if any. */ - PyErr_Fetch(&error_type, &error_value, &error_traceback); - - /* Execute __del__ method, if any. */ - del = lookup_maybe(self, "__del__", &del_str); - if (del != NULL) { - res = PyEval_CallObject(del, NULL); - if (res == NULL) - PyErr_WriteUnraisable(del); - else - Py_DECREF(res); - Py_DECREF(del); - } - - /* Restore the saved exception. */ - PyErr_Restore(error_type, error_value, error_traceback); - - /* Undo the temporary resurrection; can't use DECREF here, it would - * cause a recursive call. - */ - assert(self->ob_refcnt > 0); - if (--self->ob_refcnt == 0) - return; /* this is the normal path out */ - - /* __del__ resurrected it! Make it look like the original Py_DECREF - * never happened. - */ - { - Py_ssize_t refcnt = self->ob_refcnt; - _Py_NewReference(self); - self->ob_refcnt = refcnt; - } - assert(!PyType_IS_GC(Py_TYPE(self)) || - _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); - /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so - * we need to undo that. */ - _Py_DEC_REFTOTAL; - /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object - * chain, so no more to do there. - * If COUNT_ALLOCS, the original decref bumped tp_frees, and - * _Py_NewReference bumped tp_allocs: both of those need to be - * undone. - */ -#ifdef COUNT_ALLOCS - --Py_TYPE(self)->tp_frees; - --Py_TYPE(self)->tp_allocs; -#endif -} - - -/* -Table mapping __foo__ names to tp_foo offsets and slot_tp_foo wrapper functions. - -The table is ordered by offsets relative to the 'PyHeapTypeObject' structure, -which incorporates the additional structures used for numbers, sequences and -mappings. Note that multiple names may map to the same slot (e.g. __eq__, -__ne__ etc. all map to tp_richcompare) and one name may map to multiple slots -(e.g. __str__ affects tp_str as well as tp_repr). The table is terminated with -an all-zero entry. (This table is further initialized in init_slotdefs().) -*/ - -typedef struct wrapperbase slotdef; - -#undef TPSLOT -#undef FLSLOT -#undef ETSLOT -#undef SQSLOT -#undef MPSLOT -#undef NBSLOT -#undef UNSLOT -#undef IBSLOT -#undef BINSLOT -#undef RBINSLOT - -#define TPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - {NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ - PyDoc_STR(DOC)} -#define FLSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC, FLAGS) \ - {NAME, offsetof(PyTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ - PyDoc_STR(DOC), FLAGS} -#define ETSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - {NAME, offsetof(PyHeapTypeObject, SLOT), (void *)(FUNCTION), WRAPPER, \ - PyDoc_STR(DOC)} -#define SQSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - ETSLOT(NAME, as_sequence.SLOT, FUNCTION, WRAPPER, DOC) -#define MPSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - ETSLOT(NAME, as_mapping.SLOT, FUNCTION, WRAPPER, DOC) -#define NBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, DOC) -#define UNSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \ - "x." NAME "() <==> " DOC) -#define IBSLOT(NAME, SLOT, FUNCTION, WRAPPER, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, WRAPPER, \ - "x." NAME "(y) <==> x" DOC "y") -#define BINSLOT(NAME, SLOT, FUNCTION, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \ - "x." NAME "(y) <==> x" DOC "y") -#define RBINSLOT(NAME, SLOT, FUNCTION, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \ - "x." NAME "(y) <==> y" DOC "x") -#define BINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_l, \ - "x." NAME "(y) <==> " DOC) -#define RBINSLOTNOTINFIX(NAME, SLOT, FUNCTION, DOC) \ - ETSLOT(NAME, as_number.SLOT, FUNCTION, wrap_binaryfunc_r, \ - "x." NAME "(y) <==> " DOC) - -static slotdef slotdefs[] = { - TPSLOT("__str__", tp_print, NULL, NULL, ""), - TPSLOT("__repr__", tp_print, NULL, NULL, ""), - TPSLOT("__getattribute__", tp_getattr, NULL, NULL, ""), - TPSLOT("__getattr__", tp_getattr, NULL, NULL, ""), - TPSLOT("__setattr__", tp_setattr, NULL, NULL, ""), - TPSLOT("__delattr__", tp_setattr, NULL, NULL, ""), - TPSLOT("__cmp__", tp_compare, _PyObject_SlotCompare, wrap_cmpfunc, - "x.__cmp__(y) <==> cmp(x,y)"), - TPSLOT("__repr__", tp_repr, slot_tp_repr, wrap_unaryfunc, - "x.__repr__() <==> repr(x)"), - TPSLOT("__hash__", tp_hash, slot_tp_hash, wrap_hashfunc, - "x.__hash__() <==> hash(x)"), - FLSLOT("__call__", tp_call, slot_tp_call, (wrapperfunc)wrap_call, - "x.__call__(...) <==> x(...)", PyWrapperFlag_KEYWORDS), - TPSLOT("__str__", tp_str, slot_tp_str, wrap_unaryfunc, - "x.__str__() <==> str(x)"), - TPSLOT("__getattribute__", tp_getattro, slot_tp_getattr_hook, - wrap_binaryfunc, "x.__getattribute__('name') <==> x.name"), - TPSLOT("__getattr__", tp_getattro, slot_tp_getattr_hook, NULL, ""), - TPSLOT("__setattr__", tp_setattro, slot_tp_setattro, wrap_setattr, - "x.__setattr__('name', value) <==> x.name = value"), - TPSLOT("__delattr__", tp_setattro, slot_tp_setattro, wrap_delattr, - "x.__delattr__('name') <==> del x.name"), - TPSLOT("__lt__", tp_richcompare, slot_tp_richcompare, richcmp_lt, - "x.__lt__(y) <==> x x<=y"), - TPSLOT("__eq__", tp_richcompare, slot_tp_richcompare, richcmp_eq, - "x.__eq__(y) <==> x==y"), - TPSLOT("__ne__", tp_richcompare, slot_tp_richcompare, richcmp_ne, - "x.__ne__(y) <==> x!=y"), - TPSLOT("__gt__", tp_richcompare, slot_tp_richcompare, richcmp_gt, - "x.__gt__(y) <==> x>y"), - TPSLOT("__ge__", tp_richcompare, slot_tp_richcompare, richcmp_ge, - "x.__ge__(y) <==> x>=y"), - TPSLOT("__iter__", tp_iter, slot_tp_iter, wrap_unaryfunc, - "x.__iter__() <==> iter(x)"), - TPSLOT("next", tp_iternext, slot_tp_iternext, wrap_next, - "x.next() -> the next value, or raise StopIteration"), - TPSLOT("__get__", tp_descr_get, slot_tp_descr_get, wrap_descr_get, - "descr.__get__(obj[, type]) -> value"), - TPSLOT("__set__", tp_descr_set, slot_tp_descr_set, wrap_descr_set, - "descr.__set__(obj, value)"), - TPSLOT("__delete__", tp_descr_set, slot_tp_descr_set, - wrap_descr_delete, "descr.__delete__(obj)"), - FLSLOT("__init__", tp_init, slot_tp_init, (wrapperfunc)wrap_init, - "x.__init__(...) initializes x; " - "see help(type(x)) for signature", - PyWrapperFlag_KEYWORDS), - TPSLOT("__new__", tp_new, slot_tp_new, NULL, ""), - TPSLOT("__del__", tp_del, slot_tp_del, NULL, ""), - BINSLOT("__add__", nb_add, slot_nb_add, - "+"), - RBINSLOT("__radd__", nb_add, slot_nb_add, - "+"), - BINSLOT("__sub__", nb_subtract, slot_nb_subtract, - "-"), - RBINSLOT("__rsub__", nb_subtract, slot_nb_subtract, - "-"), - BINSLOT("__mul__", nb_multiply, slot_nb_multiply, - "*"), - RBINSLOT("__rmul__", nb_multiply, slot_nb_multiply, - "*"), - BINSLOT("__div__", nb_divide, slot_nb_divide, - "/"), - RBINSLOT("__rdiv__", nb_divide, slot_nb_divide, - "/"), - BINSLOT("__mod__", nb_remainder, slot_nb_remainder, - "%"), - RBINSLOT("__rmod__", nb_remainder, slot_nb_remainder, - "%"), - BINSLOTNOTINFIX("__divmod__", nb_divmod, slot_nb_divmod, - "divmod(x, y)"), - RBINSLOTNOTINFIX("__rdivmod__", nb_divmod, slot_nb_divmod, - "divmod(y, x)"), - NBSLOT("__pow__", nb_power, slot_nb_power, wrap_ternaryfunc, - "x.__pow__(y[, z]) <==> pow(x, y[, z])"), - NBSLOT("__rpow__", nb_power, slot_nb_power, wrap_ternaryfunc_r, - "y.__rpow__(x[, z]) <==> pow(x, y[, z])"), - UNSLOT("__neg__", nb_negative, slot_nb_negative, wrap_unaryfunc, "-x"), - UNSLOT("__pos__", nb_positive, slot_nb_positive, wrap_unaryfunc, "+x"), - UNSLOT("__abs__", nb_absolute, slot_nb_absolute, wrap_unaryfunc, - "abs(x)"), - UNSLOT("__nonzero__", nb_nonzero, slot_nb_nonzero, wrap_inquirypred, - "x != 0"), - UNSLOT("__invert__", nb_invert, slot_nb_invert, wrap_unaryfunc, "~x"), - BINSLOT("__lshift__", nb_lshift, slot_nb_lshift, "<<"), - RBINSLOT("__rlshift__", nb_lshift, slot_nb_lshift, "<<"), - BINSLOT("__rshift__", nb_rshift, slot_nb_rshift, ">>"), - RBINSLOT("__rrshift__", nb_rshift, slot_nb_rshift, ">>"), - BINSLOT("__and__", nb_and, slot_nb_and, "&"), - RBINSLOT("__rand__", nb_and, slot_nb_and, "&"), - BINSLOT("__xor__", nb_xor, slot_nb_xor, "^"), - RBINSLOT("__rxor__", nb_xor, slot_nb_xor, "^"), - BINSLOT("__or__", nb_or, slot_nb_or, "|"), - RBINSLOT("__ror__", nb_or, slot_nb_or, "|"), - NBSLOT("__coerce__", nb_coerce, slot_nb_coerce, wrap_coercefunc, - "x.__coerce__(y) <==> coerce(x, y)"), - UNSLOT("__int__", nb_int, slot_nb_int, wrap_unaryfunc, - "int(x)"), - UNSLOT("__long__", nb_long, slot_nb_long, wrap_unaryfunc, - "long(x)"), - UNSLOT("__float__", nb_float, slot_nb_float, wrap_unaryfunc, - "float(x)"), - UNSLOT("__oct__", nb_oct, slot_nb_oct, wrap_unaryfunc, - "oct(x)"), - UNSLOT("__hex__", nb_hex, slot_nb_hex, wrap_unaryfunc, - "hex(x)"), - IBSLOT("__iadd__", nb_inplace_add, slot_nb_inplace_add, - wrap_binaryfunc, "+="), - IBSLOT("__isub__", nb_inplace_subtract, slot_nb_inplace_subtract, - wrap_binaryfunc, "-="), - IBSLOT("__imul__", nb_inplace_multiply, slot_nb_inplace_multiply, - wrap_binaryfunc, "*="), - IBSLOT("__idiv__", nb_inplace_divide, slot_nb_inplace_divide, - wrap_binaryfunc, "/="), - IBSLOT("__imod__", nb_inplace_remainder, slot_nb_inplace_remainder, - wrap_binaryfunc, "%="), - IBSLOT("__ipow__", nb_inplace_power, slot_nb_inplace_power, - wrap_binaryfunc, "**="), - IBSLOT("__ilshift__", nb_inplace_lshift, slot_nb_inplace_lshift, - wrap_binaryfunc, "<<="), - IBSLOT("__irshift__", nb_inplace_rshift, slot_nb_inplace_rshift, - wrap_binaryfunc, ">>="), - IBSLOT("__iand__", nb_inplace_and, slot_nb_inplace_and, - wrap_binaryfunc, "&="), - IBSLOT("__ixor__", nb_inplace_xor, slot_nb_inplace_xor, - wrap_binaryfunc, "^="), - IBSLOT("__ior__", nb_inplace_or, slot_nb_inplace_or, - wrap_binaryfunc, "|="), - BINSLOT("__floordiv__", nb_floor_divide, slot_nb_floor_divide, "//"), - RBINSLOT("__rfloordiv__", nb_floor_divide, slot_nb_floor_divide, "//"), - BINSLOT("__truediv__", nb_true_divide, slot_nb_true_divide, "/"), - RBINSLOT("__rtruediv__", nb_true_divide, slot_nb_true_divide, "/"), - IBSLOT("__ifloordiv__", nb_inplace_floor_divide, - slot_nb_inplace_floor_divide, wrap_binaryfunc, "//="), - IBSLOT("__itruediv__", nb_inplace_true_divide, - slot_nb_inplace_true_divide, wrap_binaryfunc, "/="), - NBSLOT("__index__", nb_index, slot_nb_index, wrap_unaryfunc, - "x[y:z] <==> x[y.__index__():z.__index__()]"), - MPSLOT("__len__", mp_length, slot_mp_length, wrap_lenfunc, - "x.__len__() <==> len(x)"), - MPSLOT("__getitem__", mp_subscript, slot_mp_subscript, - wrap_binaryfunc, - "x.__getitem__(y) <==> x[y]"), - MPSLOT("__setitem__", mp_ass_subscript, slot_mp_ass_subscript, - wrap_objobjargproc, - "x.__setitem__(i, y) <==> x[i]=y"), - MPSLOT("__delitem__", mp_ass_subscript, slot_mp_ass_subscript, - wrap_delitem, - "x.__delitem__(y) <==> del x[y]"), - SQSLOT("__len__", sq_length, slot_sq_length, wrap_lenfunc, - "x.__len__() <==> len(x)"), - /* Heap types defining __add__/__mul__ have sq_concat/sq_repeat == NULL. - The logic in abstract.c always falls back to nb_add/nb_multiply in - this case. Defining both the nb_* and the sq_* slots to call the - user-defined methods has unexpected side-effects, as shown by - test_descr.notimplemented() */ - SQSLOT("__add__", sq_concat, NULL, wrap_binaryfunc, - "x.__add__(y) <==> x+y"), - SQSLOT("__mul__", sq_repeat, NULL, wrap_indexargfunc, - "x.__mul__(n) <==> x*n"), - SQSLOT("__rmul__", sq_repeat, NULL, wrap_indexargfunc, - "x.__rmul__(n) <==> n*x"), - SQSLOT("__getitem__", sq_item, slot_sq_item, wrap_sq_item, - "x.__getitem__(y) <==> x[y]"), - SQSLOT("__getslice__", sq_slice, slot_sq_slice, wrap_ssizessizeargfunc, - "x.__getslice__(i, j) <==> x[i:j]\n\ - \n\ - Use of negative indices is not supported."), - SQSLOT("__setitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_setitem, - "x.__setitem__(i, y) <==> x[i]=y"), - SQSLOT("__delitem__", sq_ass_item, slot_sq_ass_item, wrap_sq_delitem, - "x.__delitem__(y) <==> del x[y]"), - SQSLOT("__setslice__", sq_ass_slice, slot_sq_ass_slice, - wrap_ssizessizeobjargproc, - "x.__setslice__(i, j, y) <==> x[i:j]=y\n\ - \n\ - Use of negative indices is not supported."), - SQSLOT("__delslice__", sq_ass_slice, slot_sq_ass_slice, wrap_delslice, - "x.__delslice__(i, j) <==> del x[i:j]\n\ - \n\ - Use of negative indices is not supported."), - SQSLOT("__contains__", sq_contains, slot_sq_contains, wrap_objobjproc, - "x.__contains__(y) <==> y in x"), - SQSLOT("__iadd__", sq_inplace_concat, NULL, - wrap_binaryfunc, "x.__iadd__(y) <==> x+=y"), - SQSLOT("__imul__", sq_inplace_repeat, NULL, - wrap_indexargfunc, "x.__imul__(y) <==> x*=y"), - {NULL} -}; - -/* Given a type pointer and an offset gotten from a slotdef entry, return a - pointer to the actual slot. This is not quite the same as simply adding - the offset to the type pointer, since it takes care to indirect through the - proper indirection pointer (as_buffer, etc.); it returns NULL if the - indirection pointer is NULL. */ -static void ** -slotptr(PyTypeObject *type, int ioffset) -{ - char *ptr; - long offset = ioffset; - - /* Note: this depends on the order of the members of PyHeapTypeObject! */ - assert(offset >= 0); - assert((size_t)offset < offsetof(PyHeapTypeObject, as_buffer)); - if ((size_t)offset >= offsetof(PyHeapTypeObject, as_sequence)) { - ptr = (char *)type->tp_as_sequence; - offset -= offsetof(PyHeapTypeObject, as_sequence); - } - else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_mapping)) { - ptr = (char *)type->tp_as_mapping; - offset -= offsetof(PyHeapTypeObject, as_mapping); - } - else if ((size_t)offset >= offsetof(PyHeapTypeObject, as_number)) { - ptr = (char *)type->tp_as_number; - offset -= offsetof(PyHeapTypeObject, as_number); - } - else { - ptr = (char *)type; - } - if (ptr != NULL) - ptr += offset; - return (void **)ptr; -} - -/* Length of array of slotdef pointers used to store slots with the - same __name__. There should be at most MAX_EQUIV-1 slotdef entries with - the same __name__, for any __name__. Since that's a static property, it is - appropriate to declare fixed-size arrays for this. */ -#define MAX_EQUIV 10 - -/* Return a slot pointer for a given name, but ONLY if the attribute has - exactly one slot function. The name must be an interned string. */ -static void ** -resolve_slotdups(PyTypeObject *type, PyObject *name) -{ - /* XXX Maybe this could be optimized more -- but is it worth it? */ - - /* pname and ptrs act as a little cache */ - static PyObject *pname; - static slotdef *ptrs[MAX_EQUIV]; - slotdef *p, **pp; - void **res, **ptr; - - if (pname != name) { - /* Collect all slotdefs that match name into ptrs. */ - pname = name; - pp = ptrs; - for (p = slotdefs; p->name_strobj; p++) { - if (p->name_strobj == name) - *pp++ = p; - } - *pp = NULL; - } - - /* Look in all matching slots of the type; if exactly one of these has - a filled-in slot, return its value. Otherwise return NULL. */ - res = NULL; - for (pp = ptrs; *pp; pp++) { - ptr = slotptr(type, (*pp)->offset); - if (ptr == NULL || *ptr == NULL) - continue; - if (res != NULL) - return NULL; - res = ptr; - } - return res; -} - -/* Common code for update_slots_callback() and fixup_slot_dispatchers(). This - does some incredibly complex thinking and then sticks something into the - slot. (It sees if the adjacent slotdefs for the same slot have conflicting - interests, and then stores a generic wrapper or a specific function into - the slot.) Return a pointer to the next slotdef with a different offset, - because that's convenient for fixup_slot_dispatchers(). */ -static slotdef * -update_one_slot(PyTypeObject *type, slotdef *p) -{ - PyObject *descr; - PyWrapperDescrObject *d; - void *generic = NULL, *specific = NULL; - int use_generic = 0; - int offset = p->offset; - void **ptr = slotptr(type, offset); - - if (ptr == NULL) { - do { - ++p; - } while (p->offset == offset); - return p; - } - do { - descr = _PyType_Lookup(type, p->name_strobj); - if (descr == NULL) { - if (ptr == (void**)&type->tp_iternext) { - specific = _PyObject_NextNotImplemented; - } - continue; - } - if (Py_TYPE(descr) == &PyWrapperDescr_Type && - ((PyWrapperDescrObject *)descr)->d_base->name_strobj == p->name_strobj) { - void **tptr = resolve_slotdups(type, p->name_strobj); - if (tptr == NULL || tptr == ptr) - generic = p->function; - d = (PyWrapperDescrObject *)descr; - if (d->d_base->wrapper == p->wrapper && - PyType_IsSubtype(type, d->d_type)) - { - if (specific == NULL || - specific == d->d_wrapped) - specific = d->d_wrapped; - else - use_generic = 1; - } - } - else if (Py_TYPE(descr) == &PyCFunction_Type && - PyCFunction_GET_FUNCTION(descr) == - (PyCFunction)tp_new_wrapper && - ptr == (void**)&type->tp_new) - { - /* The __new__ wrapper is not a wrapper descriptor, - so must be special-cased differently. - If we don't do this, creating an instance will - always use slot_tp_new which will look up - __new__ in the MRO which will call tp_new_wrapper - which will look through the base classes looking - for a static base and call its tp_new (usually - PyType_GenericNew), after performing various - sanity checks and constructing a new argument - list. Cut all that nonsense short -- this speeds - up instance creation tremendously. */ - specific = (void *)type->tp_new; - /* XXX I'm not 100% sure that there isn't a hole - in this reasoning that requires additional - sanity checks. I'll buy the first person to - point out a bug in this reasoning a beer. */ - } - else if (descr == Py_None && - ptr == (void**)&type->tp_hash) { - /* We specifically allow __hash__ to be set to None - to prevent inheritance of the default - implementation from object.__hash__ */ - specific = PyObject_HashNotImplemented; - } - else { - use_generic = 1; - generic = p->function; - } - } while ((++p)->offset == offset); - if (specific && !use_generic) - *ptr = specific; - else - *ptr = generic; - return p; -} - -/* In the type, update the slots whose slotdefs are gathered in the pp array. - This is a callback for update_subclasses(). */ -static int -update_slots_callback(PyTypeObject *type, void *data) -{ - slotdef **pp = (slotdef **)data; - - for (; *pp; pp++) - update_one_slot(type, *pp); - return 0; -} - -/* Initialize the slotdefs table by adding interned string objects for the - names and sorting the entries. */ -static void -init_slotdefs(void) -{ - slotdef *p; - static int initialized = 0; - - if (initialized) - return; - for (p = slotdefs; p->name; p++) { - /* Slots must be ordered by their offset in the PyHeapTypeObject. */ - assert(!p[1].name || p->offset <= p[1].offset); - p->name_strobj = PyString_InternFromString(p->name); - if (!p->name_strobj) - Py_FatalError("Out of memory interning slotdef names"); - } - initialized = 1; -} - -/* Update the slots after assignment to a class (type) attribute. */ -static int -update_slot(PyTypeObject *type, PyObject *name) -{ - slotdef *ptrs[MAX_EQUIV]; - slotdef *p; - slotdef **pp; - int offset; - - /* Clear the VALID_VERSION flag of 'type' and all its - subclasses. This could possibly be unified with the - update_subclasses() recursion below, but carefully: - they each have their own conditions on which to stop - recursing into subclasses. */ - PyType_Modified(type); - - init_slotdefs(); - pp = ptrs; - for (p = slotdefs; p->name; p++) { - /* XXX assume name is interned! */ - if (p->name_strobj == name) - *pp++ = p; - } - *pp = NULL; - for (pp = ptrs; *pp; pp++) { - p = *pp; - offset = p->offset; - while (p > slotdefs && (p-1)->offset == offset) - --p; - *pp = p; - } - if (ptrs[0] == NULL) - return 0; /* Not an attribute that affects any slots */ - return update_subclasses(type, name, - update_slots_callback, (void *)ptrs); -} - -/* Store the proper functions in the slot dispatches at class (type) - definition time, based upon which operations the class overrides in its - dict. */ -static void -fixup_slot_dispatchers(PyTypeObject *type) -{ - slotdef *p; - - init_slotdefs(); - for (p = slotdefs; p->name; ) - p = update_one_slot(type, p); -} - -static void -update_all_slots(PyTypeObject* type) -{ - slotdef *p; - - init_slotdefs(); - for (p = slotdefs; p->name; p++) { - /* update_slot returns int but can't actually fail */ - update_slot(type, p->name_strobj); - } -} - -/* recurse_down_subclasses() and update_subclasses() are mutually - recursive functions to call a callback for all subclasses, - but refraining from recursing into subclasses that define 'name'. */ - -static int -update_subclasses(PyTypeObject *type, PyObject *name, - update_callback callback, void *data) -{ - if (callback(type, data) < 0) - return -1; - return recurse_down_subclasses(type, name, callback, data); -} - -static int -recurse_down_subclasses(PyTypeObject *type, PyObject *name, - update_callback callback, void *data) -{ - PyTypeObject *subclass; - PyObject *ref, *subclasses, *dict; - Py_ssize_t i, n; - - subclasses = type->tp_subclasses; - if (subclasses == NULL) - return 0; - assert(PyList_Check(subclasses)); - n = PyList_GET_SIZE(subclasses); - for (i = 0; i < n; i++) { - ref = PyList_GET_ITEM(subclasses, i); - assert(PyWeakref_CheckRef(ref)); - subclass = (PyTypeObject *)PyWeakref_GET_OBJECT(ref); - assert(subclass != NULL); - if ((PyObject *)subclass == Py_None) - continue; - assert(PyType_Check(subclass)); - /* Avoid recursing down into unaffected classes */ - dict = subclass->tp_dict; - if (dict != NULL && PyDict_Check(dict) && - PyDict_GetItem(dict, name) != NULL) - continue; - if (update_subclasses(subclass, name, callback, data) < 0) - return -1; - } - return 0; -} - -/* This function is called by PyType_Ready() to populate the type's - dictionary with method descriptors for function slots. For each - function slot (like tp_repr) that's defined in the type, one or more - corresponding descriptors are added in the type's tp_dict dictionary - under the appropriate name (like __repr__). Some function slots - cause more than one descriptor to be added (for example, the nb_add - slot adds both __add__ and __radd__ descriptors) and some function - slots compete for the same descriptor (for example both sq_item and - mp_subscript generate a __getitem__ descriptor). - - In the latter case, the first slotdef entry encountered wins. Since - slotdef entries are sorted by the offset of the slot in the - PyHeapTypeObject, this gives us some control over disambiguating - between competing slots: the members of PyHeapTypeObject are listed - from most general to least general, so the most general slot is - preferred. In particular, because as_mapping comes before as_sequence, - for a type that defines both mp_subscript and sq_item, mp_subscript - wins. - - This only adds new descriptors and doesn't overwrite entries in - tp_dict that were previously defined. The descriptors contain a - reference to the C function they must call, so that it's safe if they - are copied into a subtype's __dict__ and the subtype has a different - C function in its slot -- calling the method defined by the - descriptor will call the C function that was used to create it, - rather than the C function present in the slot when it is called. - (This is important because a subtype may have a C function in the - slot that calls the method from the dictionary, and we want to avoid - infinite recursion here.) */ - -static int -add_operators(PyTypeObject *type) -{ - PyObject *dict = type->tp_dict; - slotdef *p; - PyObject *descr; - void **ptr; - - init_slotdefs(); - for (p = slotdefs; p->name; p++) { - if (p->wrapper == NULL) - continue; - ptr = slotptr(type, p->offset); - if (!ptr || !*ptr) - continue; - if (PyDict_GetItem(dict, p->name_strobj)) - continue; - if (*ptr == PyObject_HashNotImplemented) { - /* Classes may prevent the inheritance of the tp_hash - slot by storing PyObject_HashNotImplemented in it. Make it - visible as a None value for the __hash__ attribute. */ - if (PyDict_SetItem(dict, p->name_strobj, Py_None) < 0) - return -1; - } - else { - descr = PyDescr_NewWrapper(type, p, *ptr); - if (descr == NULL) - return -1; - if (PyDict_SetItem(dict, p->name_strobj, descr) < 0) - return -1; - Py_DECREF(descr); - } - } - if (type->tp_new != NULL) { - if (add_tp_new_wrapper(type) < 0) - return -1; - } - return 0; -} - - -/* Cooperative 'super' */ - -typedef struct { - PyObject_HEAD - PyTypeObject *type; - PyObject *obj; - PyTypeObject *obj_type; -} superobject; - -static PyMemberDef super_members[] = { - {"__thisclass__", T_OBJECT, offsetof(superobject, type), READONLY, - "the class invoking super()"}, - {"__self__", T_OBJECT, offsetof(superobject, obj), READONLY, - "the instance invoking super(); may be None"}, - {"__self_class__", T_OBJECT, offsetof(superobject, obj_type), READONLY, - "the type of the instance invoking super(); may be None"}, - {0} -}; - -static void -super_dealloc(PyObject *self) -{ - superobject *su = (superobject *)self; - - _PyObject_GC_UNTRACK(self); - Py_XDECREF(su->obj); - Py_XDECREF(su->type); - Py_XDECREF(su->obj_type); - Py_TYPE(self)->tp_free(self); -} - -static PyObject * -super_repr(PyObject *self) -{ - superobject *su = (superobject *)self; - - if (su->obj_type) - return PyString_FromFormat( - ", <%s object>>", - su->type ? su->type->tp_name : "NULL", - su->obj_type->tp_name); - else - return PyString_FromFormat( - ", NULL>", - su->type ? su->type->tp_name : "NULL"); -} - -static PyObject * -super_getattro(PyObject *self, PyObject *name) -{ - superobject *su = (superobject *)self; - int skip = su->obj_type == NULL; - - if (!skip) { - /* We want __class__ to return the class of the super object - (i.e. super, or a subclass), not the class of su->obj. */ - skip = (PyString_Check(name) && - PyString_GET_SIZE(name) == 9 && - strcmp(PyString_AS_STRING(name), "__class__") == 0); - } - - if (!skip) { - PyObject *mro, *res, *tmp, *dict; - PyTypeObject *starttype; - descrgetfunc f; - Py_ssize_t i, n; - - starttype = su->obj_type; - mro = starttype->tp_mro; - - if (mro == NULL) - n = 0; - else { - assert(PyTuple_Check(mro)); - n = PyTuple_GET_SIZE(mro); - } - for (i = 0; i < n; i++) { - if ((PyObject *)(su->type) == PyTuple_GET_ITEM(mro, i)) - break; - } - i++; - res = NULL; - for (; i < n; i++) { - tmp = PyTuple_GET_ITEM(mro, i); - if (PyType_Check(tmp)) - dict = ((PyTypeObject *)tmp)->tp_dict; - else if (PyClass_Check(tmp)) - dict = ((PyClassObject *)tmp)->cl_dict; - else - continue; - res = PyDict_GetItem(dict, name); - if (res != NULL) { - Py_INCREF(res); - f = Py_TYPE(res)->tp_descr_get; - if (f != NULL) { - tmp = f(res, - /* Only pass 'obj' param if - this is instance-mode super - (See SF ID #743627) - */ - (su->obj == (PyObject *) - su->obj_type - ? (PyObject *)NULL - : su->obj), - (PyObject *)starttype); - Py_DECREF(res); - res = tmp; - } - return res; - } - } - } - return PyObject_GenericGetAttr(self, name); -} - -static PyTypeObject * -supercheck(PyTypeObject *type, PyObject *obj) -{ - /* Check that a super() call makes sense. Return a type object. - - obj can be a new-style class, or an instance of one: - - - If it is a class, it must be a subclass of 'type'. This case is - used for class methods; the return value is obj. - - - If it is an instance, it must be an instance of 'type'. This is - the normal case; the return value is obj.__class__. - - But... when obj is an instance, we want to allow for the case where - Py_TYPE(obj) is not a subclass of type, but obj.__class__ is! - This will allow using super() with a proxy for obj. - */ - - /* Check for first bullet above (special case) */ - if (PyType_Check(obj) && PyType_IsSubtype((PyTypeObject *)obj, type)) { - Py_INCREF(obj); - return (PyTypeObject *)obj; - } - - /* Normal case */ - if (PyType_IsSubtype(Py_TYPE(obj), type)) { - Py_INCREF(Py_TYPE(obj)); - return Py_TYPE(obj); - } - else { - /* Try the slow way */ - static PyObject *class_str = NULL; - PyObject *class_attr; - - if (class_str == NULL) { - class_str = PyString_FromString("__class__"); - if (class_str == NULL) - return NULL; - } - - class_attr = PyObject_GetAttr(obj, class_str); - - if (class_attr != NULL && - PyType_Check(class_attr) && - (PyTypeObject *)class_attr != Py_TYPE(obj)) - { - int ok = PyType_IsSubtype( - (PyTypeObject *)class_attr, type); - if (ok) - return (PyTypeObject *)class_attr; - } - - if (class_attr == NULL) - PyErr_Clear(); - else - Py_DECREF(class_attr); - } - - PyErr_SetString(PyExc_TypeError, - "super(type, obj): " - "obj must be an instance or subtype of type"); - return NULL; -} - -static PyObject * -super_descr_get(PyObject *self, PyObject *obj, PyObject *type) -{ - superobject *su = (superobject *)self; - superobject *newobj; - - if (obj == NULL || obj == Py_None || su->obj != NULL) { - /* Not binding to an object, or already bound */ - Py_INCREF(self); - return self; - } - if (Py_TYPE(su) != &PySuper_Type) - /* If su is an instance of a (strict) subclass of super, - call its type */ - return PyObject_CallFunctionObjArgs((PyObject *)Py_TYPE(su), - su->type, obj, NULL); - else { - /* Inline the common case */ - PyTypeObject *obj_type = supercheck(su->type, obj); - if (obj_type == NULL) - return NULL; - newobj = (superobject *)PySuper_Type.tp_new(&PySuper_Type, - NULL, NULL); - if (newobj == NULL) - return NULL; - Py_INCREF(su->type); - Py_INCREF(obj); - newobj->type = su->type; - newobj->obj = obj; - newobj->obj_type = obj_type; - return (PyObject *)newobj; - } -} - -static int -super_init(PyObject *self, PyObject *args, PyObject *kwds) -{ - superobject *su = (superobject *)self; - PyTypeObject *type; - PyObject *obj = NULL; - PyTypeObject *obj_type = NULL; - - if (!_PyArg_NoKeywords("super", kwds)) - return -1; - if (!PyArg_ParseTuple(args, "O!|O:super", &PyType_Type, &type, &obj)) - return -1; - if (obj == Py_None) - obj = NULL; - if (obj != NULL) { - obj_type = supercheck(type, obj); - if (obj_type == NULL) - return -1; - Py_INCREF(obj); - } - Py_INCREF(type); - su->type = type; - su->obj = obj; - su->obj_type = obj_type; - return 0; -} - -PyDoc_STRVAR(super_doc, -"super(type, obj) -> bound super object; requires isinstance(obj, type)\n" -"super(type) -> unbound super object\n" -"super(type, type2) -> bound super object; requires issubclass(type2, type)\n" -"Typical use to call a cooperative superclass method:\n" -"class C(B):\n" -" def meth(self, arg):\n" -" super(C, self).meth(arg)"); - -static int -super_traverse(PyObject *self, visitproc visit, void *arg) -{ - superobject *su = (superobject *)self; - - Py_VISIT(su->obj); - Py_VISIT(su->type); - Py_VISIT(su->obj_type); - - return 0; -} - -PyTypeObject PySuper_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "super", /* tp_name */ - sizeof(superobject), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - super_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - super_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - super_getattro, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | - Py_TPFLAGS_BASETYPE, /* tp_flags */ - super_doc, /* tp_doc */ - super_traverse, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - super_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - super_descr_get, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - super_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_GC_Del, /* tp_free */ -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodectype.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodectype.c deleted file mode 100644 index ca44bce..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodectype.c +++ /dev/null @@ -1,215 +0,0 @@ -/* - Unicode character type helpers. - - Written by Marc-Andre Lemburg (mal@lemburg.com). - Modified for Python 2.0 by Fredrik Lundh (fredrik@pythonware.com) - - Copyright (c) Corporation for National Research Initiatives. - -*/ - -#include "Python.h" -#include "unicodeobject.h" - -#define ALPHA_MASK 0x01 -#define DECIMAL_MASK 0x02 -#define DIGIT_MASK 0x04 -#define LOWER_MASK 0x08 -#define LINEBREAK_MASK 0x10 -#define SPACE_MASK 0x20 -#define TITLE_MASK 0x40 -#define UPPER_MASK 0x80 -#define NODELTA_MASK 0x100 -#define NUMERIC_MASK 0x200 - -typedef struct { - const Py_UNICODE upper; - const Py_UNICODE lower; - const Py_UNICODE title; - const unsigned char decimal; - const unsigned char digit; - const unsigned short flags; -} _PyUnicode_TypeRecord; - -#include "unicodetype_db.h" - -static const _PyUnicode_TypeRecord * -gettyperecord(Py_UNICODE code) -{ - int index; - -#ifdef Py_UNICODE_WIDE - if (code >= 0x110000) - index = 0; - else -#endif - { - index = index1[(code>>SHIFT)]; - index = index2[(index<title; - - if (ctype->flags & NODELTA_MASK) - return delta; - - if (delta >= 32768) - delta -= 65536; - - return ch + delta; -} - -/* Returns 1 for Unicode characters having the category 'Lt', 0 - otherwise. */ - -int _PyUnicode_IsTitlecase(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & TITLE_MASK) != 0; -} - -/* Returns the integer decimal (0-9) for Unicode characters having - this property, -1 otherwise. */ - -int _PyUnicode_ToDecimalDigit(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & DECIMAL_MASK) ? ctype->decimal : -1; -} - -int _PyUnicode_IsDecimalDigit(Py_UNICODE ch) -{ - if (_PyUnicode_ToDecimalDigit(ch) < 0) - return 0; - return 1; -} - -/* Returns the integer digit (0-9) for Unicode characters having - this property, -1 otherwise. */ - -int _PyUnicode_ToDigit(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & DIGIT_MASK) ? ctype->digit : -1; -} - -int _PyUnicode_IsDigit(Py_UNICODE ch) -{ - if (_PyUnicode_ToDigit(ch) < 0) - return 0; - return 1; -} - -/* Returns the numeric value as double for Unicode characters having - this property, -1.0 otherwise. */ - -int _PyUnicode_IsNumeric(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & NUMERIC_MASK) != 0; -} - -#ifndef WANT_WCTYPE_FUNCTIONS - -/* Returns 1 for Unicode characters having the category 'Ll', 0 - otherwise. */ - -int _PyUnicode_IsLowercase(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & LOWER_MASK) != 0; -} - -/* Returns 1 for Unicode characters having the category 'Lu', 0 - otherwise. */ - -int _PyUnicode_IsUppercase(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & UPPER_MASK) != 0; -} - -/* Returns the uppercase Unicode characters corresponding to ch or just - ch if no uppercase mapping is known. */ - -Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - int delta = ctype->upper; - if (ctype->flags & NODELTA_MASK) - return delta; - if (delta >= 32768) - delta -= 65536; - return ch + delta; -} - -/* Returns the lowercase Unicode characters corresponding to ch or just - ch if no lowercase mapping is known. */ - -Py_UNICODE _PyUnicode_ToLowercase(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - int delta = ctype->lower; - if (ctype->flags & NODELTA_MASK) - return delta; - if (delta >= 32768) - delta -= 65536; - return ch + delta; -} - -/* Returns 1 for Unicode characters having the category 'Ll', 'Lu', 'Lt', - 'Lo' or 'Lm', 0 otherwise. */ - -int _PyUnicode_IsAlpha(Py_UNICODE ch) -{ - const _PyUnicode_TypeRecord *ctype = gettyperecord(ch); - - return (ctype->flags & ALPHA_MASK) != 0; -} - -#else - -/* Export the interfaces using the wchar_t type for portability - reasons: */ - -int _PyUnicode_IsLowercase(Py_UNICODE ch) -{ - return iswlower(ch); -} - -int _PyUnicode_IsUppercase(Py_UNICODE ch) -{ - return iswupper(ch); -} - -Py_UNICODE _PyUnicode_ToLowercase(Py_UNICODE ch) -{ - return towlower(ch); -} - -Py_UNICODE _PyUnicode_ToUppercase(Py_UNICODE ch) -{ - return towupper(ch); -} - -int _PyUnicode_IsAlpha(Py_UNICODE ch) -{ - return iswalpha(ch); -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodeobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodeobject.c deleted file mode 100644 index 41b6f0e..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodeobject.c +++ /dev/null @@ -1,8994 +0,0 @@ -/* - -Unicode implementation based on original code by Fredrik Lundh, -modified by Marc-Andre Lemburg according to the -Unicode Integration Proposal (see file Misc/unicode.txt). - -Major speed upgrades to the method implementations at the Reykjavik -NeedForSpeed sprint, by Fredrik Lundh and Andrew Dalke. - -Copyright (c) Corporation for National Research Initiatives. - --------------------------------------------------------------------- -The original string type implementation is: - - Copyright (c) 1999 by Secret Labs AB - Copyright (c) 1999 by Fredrik Lundh - -By obtaining, using, and/or copying this software and/or its -associated documentation, you agree that you have read, understood, -and will comply with the following terms and conditions: - -Permission to use, copy, modify, and distribute this software and its -associated documentation for any purpose and without fee is hereby -granted, provided that the above copyright notice appears in all -copies, and that both that copyright notice and this permission notice -appear in supporting documentation, and that the name of Secret Labs -AB or the author not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. - -SECRET LABS AB AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO -THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS. IN NO EVENT SHALL SECRET LABS AB OR THE AUTHOR BE LIABLE FOR -ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------------------------------------------- - -*/ - -#define PY_SSIZE_T_CLEAN -#include "Python.h" - -#include "unicodeobject.h" -#include "ucnhash.h" - -#ifdef MS_WINDOWS -#include -#endif - -/* Limit for the Unicode object free list */ - -#define PyUnicode_MAXFREELIST 1024 - -/* Limit for the Unicode object free list stay alive optimization. - - The implementation will keep allocated Unicode memory intact for - all objects on the free list having a size less than this - limit. This reduces malloc() overhead for small Unicode objects. - - At worst this will result in PyUnicode_MAXFREELIST * - (sizeof(PyUnicodeObject) + KEEPALIVE_SIZE_LIMIT + - malloc()-overhead) bytes of unused garbage. - - Setting the limit to 0 effectively turns the feature off. - - Note: This is an experimental feature ! If you get core dumps when - using Unicode objects, turn this feature off. - -*/ - -#define KEEPALIVE_SIZE_LIMIT 9 - -/* Endianness switches; defaults to little endian */ - -#ifdef WORDS_BIGENDIAN -# define BYTEORDER_IS_BIG_ENDIAN -#else -# define BYTEORDER_IS_LITTLE_ENDIAN -#endif - -/* --- Globals ------------------------------------------------------------ - -NOTE: In the interpreter's initialization phase, some globals are currently - initialized dynamically as needed. In the process Unicode objects may - be created before the Unicode type is ready. - -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Free list for Unicode objects */ -static PyUnicodeObject *free_list = NULL; -static int numfree = 0; - -/* The empty Unicode object is shared to improve performance. */ -static PyUnicodeObject *unicode_empty = NULL; - -#define _Py_RETURN_UNICODE_EMPTY() \ - do { \ - if (unicode_empty != NULL) \ - Py_INCREF(unicode_empty); \ - else { \ - unicode_empty = _PyUnicode_New(0); \ - if (unicode_empty != NULL) \ - Py_INCREF(unicode_empty); \ - } \ - return (PyObject *)unicode_empty; \ - } while (0) - -/* Single character Unicode strings in the Latin-1 range are being - shared as well. */ -static PyUnicodeObject *unicode_latin1[256] = {NULL}; - -/* Default encoding to use and assume when NULL is passed as encoding - parameter; it is initialized by _PyUnicode_Init(). - - Always use the PyUnicode_SetDefaultEncoding() and - PyUnicode_GetDefaultEncoding() APIs to access this global. - -*/ -static char unicode_default_encoding[100 + 1] = "ascii"; - -/* Fast detection of the most frequent whitespace characters */ -const unsigned char _Py_ascii_whitespace[] = { - 0, 0, 0, 0, 0, 0, 0, 0, -/* case 0x0009: * CHARACTER TABULATION */ -/* case 0x000A: * LINE FEED */ -/* case 0x000B: * LINE TABULATION */ -/* case 0x000C: * FORM FEED */ -/* case 0x000D: * CARRIAGE RETURN */ - 0, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -/* case 0x001C: * FILE SEPARATOR */ -/* case 0x001D: * GROUP SEPARATOR */ -/* case 0x001E: * RECORD SEPARATOR */ -/* case 0x001F: * UNIT SEPARATOR */ - 0, 0, 0, 0, 1, 1, 1, 1, -/* case 0x0020: * SPACE */ - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* Same for linebreaks */ -static unsigned char ascii_linebreak[] = { - 0, 0, 0, 0, 0, 0, 0, 0, -/* 0x000A, * LINE FEED */ -/* 0x000B, * LINE TABULATION */ -/* 0x000C, * FORM FEED */ -/* 0x000D, * CARRIAGE RETURN */ - 0, 0, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, -/* 0x001C, * FILE SEPARATOR */ -/* 0x001D, * GROUP SEPARATOR */ -/* 0x001E, * RECORD SEPARATOR */ - 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 -}; - - -Py_UNICODE -PyUnicode_GetMax(void) -{ -#ifdef Py_UNICODE_WIDE - return 0x10FFFF; -#else - /* This is actually an illegal character, so it should - not be passed to unichr. */ - return 0xFFFF; -#endif -} - -/* --- Bloom Filters ----------------------------------------------------- */ - -/* stuff to implement simple "bloom filters" for Unicode characters. - to keep things simple, we use a single bitmask, using the least 5 - bits from each unicode characters as the bit index. */ - -/* the linebreak mask is set up by Unicode_Init below */ - -#if LONG_BIT >= 128 -#define BLOOM_WIDTH 128 -#elif LONG_BIT >= 64 -#define BLOOM_WIDTH 64 -#elif LONG_BIT >= 32 -#define BLOOM_WIDTH 32 -#else -#error "LONG_BIT is smaller than 32" -#endif - -#define BLOOM_MASK unsigned long - -static BLOOM_MASK bloom_linebreak = ~(BLOOM_MASK)0; - -#define BLOOM_ADD(mask, ch) ((mask |= (1UL << ((ch) & (BLOOM_WIDTH - 1))))) -#define BLOOM(mask, ch) ((mask & (1UL << ((ch) & (BLOOM_WIDTH - 1))))) - -#define BLOOM_LINEBREAK(ch) \ - ((ch) < 128U ? ascii_linebreak[(ch)] : \ - (BLOOM(bloom_linebreak, (ch)) && Py_UNICODE_ISLINEBREAK(ch))) - -Py_LOCAL_INLINE(BLOOM_MASK) make_bloom_mask(Py_UNICODE* ptr, Py_ssize_t len) -{ - /* calculate simple bloom-style bitmask for a given unicode string */ - - BLOOM_MASK mask; - Py_ssize_t i; - - mask = 0; - for (i = 0; i < len; i++) - BLOOM_ADD(mask, ptr[i]); - - return mask; -} - -Py_LOCAL_INLINE(int) unicode_member(Py_UNICODE chr, Py_UNICODE* set, Py_ssize_t setlen) -{ - Py_ssize_t i; - - for (i = 0; i < setlen; i++) - if (set[i] == chr) - return 1; - - return 0; -} - -#define BLOOM_MEMBER(mask, chr, set, setlen) \ - BLOOM(mask, chr) && unicode_member(chr, set, setlen) - -/* --- Unicode Object ----------------------------------------------------- */ - -static -int unicode_resize(register PyUnicodeObject *unicode, - Py_ssize_t length) -{ - void *oldstr; - - /* Shortcut if there's nothing much to do. */ - if (unicode->length == length) - goto reset; - - /* Resizing shared object (unicode_empty or single character - objects) in-place is not allowed. Use PyUnicode_Resize() - instead ! */ - - if (unicode == unicode_empty || - (unicode->length == 1 && - unicode->str[0] < 256U && - unicode_latin1[unicode->str[0]] == unicode)) { - PyErr_SetString(PyExc_SystemError, - "can't resize shared unicode objects"); - return -1; - } - - /* We allocate one more byte to make sure the string is Ux0000 terminated. - The overallocation is also used by fastsearch, which assumes that it's - safe to look at str[length] (without making any assumptions about what - it contains). */ - - oldstr = unicode->str; - unicode->str = PyObject_REALLOC(unicode->str, - sizeof(Py_UNICODE) * (length + 1)); - if (!unicode->str) { - unicode->str = (Py_UNICODE *)oldstr; - PyErr_NoMemory(); - return -1; - } - unicode->str[length] = 0; - unicode->length = length; - - reset: - /* Reset the object caches */ - if (unicode->defenc) { - Py_CLEAR(unicode->defenc); - } - unicode->hash = -1; - - return 0; -} - -/* We allocate one more byte to make sure the string is - Ux0000 terminated; some code relies on that. - - XXX This allocator could further be enhanced by assuring that the - free list never reduces its size below 1. - -*/ - -static -PyUnicodeObject *_PyUnicode_New(Py_ssize_t length) -{ - register PyUnicodeObject *unicode; - - /* Optimization for empty strings */ - if (length == 0 && unicode_empty != NULL) { - Py_INCREF(unicode_empty); - return unicode_empty; - } - - /* Ensure we won't overflow the size. */ - if (length > ((PY_SSIZE_T_MAX / sizeof(Py_UNICODE)) - 1)) { - return (PyUnicodeObject *)PyErr_NoMemory(); - } - - /* Unicode freelist & memory allocation */ - if (free_list) { - unicode = free_list; - free_list = *(PyUnicodeObject **)unicode; - numfree--; - if (unicode->str) { - /* Keep-Alive optimization: we only upsize the buffer, - never downsize it. */ - if ((unicode->length < length) && - unicode_resize(unicode, length) < 0) { - PyObject_DEL(unicode->str); - unicode->str = NULL; - } - } - else { - size_t new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); - unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); - } - PyObject_INIT(unicode, &PyUnicode_Type); - } - else { - size_t new_size; - unicode = PyObject_New(PyUnicodeObject, &PyUnicode_Type); - if (unicode == NULL) - return NULL; - new_size = sizeof(Py_UNICODE) * ((size_t)length + 1); - unicode->str = (Py_UNICODE*) PyObject_MALLOC(new_size); - } - - if (!unicode->str) { - PyErr_NoMemory(); - goto onError; - } - /* Initialize the first element to guard against cases where - * the caller fails before initializing str -- unicode_resize() - * reads str[0], and the Keep-Alive optimization can keep memory - * allocated for str alive across a call to unicode_dealloc(unicode). - * We don't want unicode_resize to read uninitialized memory in - * that case. - */ - unicode->str[0] = 0; - unicode->str[length] = 0; - unicode->length = length; - unicode->hash = -1; - unicode->defenc = NULL; - return unicode; - - onError: - /* XXX UNREF/NEWREF interface should be more symmetrical */ - _Py_DEC_REFTOTAL; - _Py_ForgetReference((PyObject *)unicode); - PyObject_Del(unicode); - return NULL; -} - -static -void unicode_dealloc(register PyUnicodeObject *unicode) -{ - if (PyUnicode_CheckExact(unicode) && - numfree < PyUnicode_MAXFREELIST) { - /* Keep-Alive optimization */ - if (unicode->length >= KEEPALIVE_SIZE_LIMIT) { - PyObject_DEL(unicode->str); - unicode->str = NULL; - unicode->length = 0; - } - if (unicode->defenc) { - Py_CLEAR(unicode->defenc); - } - /* Add to free list */ - *(PyUnicodeObject **)unicode = free_list; - free_list = unicode; - numfree++; - } - else { - PyObject_DEL(unicode->str); - Py_XDECREF(unicode->defenc); - Py_TYPE(unicode)->tp_free((PyObject *)unicode); - } -} - -static -int _PyUnicode_Resize(PyUnicodeObject **unicode, Py_ssize_t length) -{ - register PyUnicodeObject *v; - - /* Argument checks */ - if (unicode == NULL) { - PyErr_BadInternalCall(); - return -1; - } - v = *unicode; - if (v == NULL || !PyUnicode_Check(v) || Py_REFCNT(v) != 1 || length < 0) { - PyErr_BadInternalCall(); - return -1; - } - - /* Resizing unicode_empty and single character objects is not - possible since these are being shared. We simply return a fresh - copy with the same Unicode content. */ - if (v->length != length && - (v == unicode_empty || v->length == 1)) { - PyUnicodeObject *w = _PyUnicode_New(length); - if (w == NULL) - return -1; - Py_UNICODE_COPY(w->str, v->str, - length < v->length ? length : v->length); - Py_DECREF(*unicode); - *unicode = w; - return 0; - } - - /* Note that we don't have to modify *unicode for unshared Unicode - objects, since we can modify them in-place. */ - return unicode_resize(v, length); -} - -int PyUnicode_Resize(PyObject **unicode, Py_ssize_t length) -{ - return _PyUnicode_Resize((PyUnicodeObject **)unicode, length); -} - -PyObject *PyUnicode_FromUnicode(const Py_UNICODE *u, - Py_ssize_t size) -{ - PyUnicodeObject *unicode; - - /* If the Unicode data is known at construction time, we can apply - some optimizations which share commonly used objects. */ - if (u != NULL) { - - /* Optimization for empty strings */ - if (size == 0) - _Py_RETURN_UNICODE_EMPTY(); - - /* Single character Unicode objects in the Latin-1 range are - shared when using this constructor */ - if (size == 1 && *u < 256) { - unicode = unicode_latin1[*u]; - if (!unicode) { - unicode = _PyUnicode_New(1); - if (!unicode) - return NULL; - unicode->str[0] = *u; - unicode_latin1[*u] = unicode; - } - Py_INCREF(unicode); - return (PyObject *)unicode; - } - } - - unicode = _PyUnicode_New(size); - if (!unicode) - return NULL; - - /* Copy the Unicode data into the new object */ - if (u != NULL) - Py_UNICODE_COPY(unicode->str, u, size); - - return (PyObject *)unicode; -} - -PyObject *PyUnicode_FromStringAndSize(const char *u, Py_ssize_t size) -{ - PyUnicodeObject *unicode; - - if (size < 0) { - PyErr_SetString(PyExc_SystemError, - "Negative size passed to PyUnicode_FromStringAndSize"); - return NULL; - } - - /* If the Unicode data is known at construction time, we can apply - some optimizations which share commonly used objects. - Also, this means the input must be UTF-8, so fall back to the - UTF-8 decoder at the end. */ - if (u != NULL) { - - /* Optimization for empty strings */ - if (size == 0) - _Py_RETURN_UNICODE_EMPTY(); - - /* Single characters are shared when using this constructor. - Restrict to ASCII, since the input must be UTF-8. */ - if (size == 1 && Py_CHARMASK(*u) < 128) { - unicode = unicode_latin1[Py_CHARMASK(*u)]; - if (!unicode) { - unicode = _PyUnicode_New(1); - if (!unicode) - return NULL; - unicode->str[0] = Py_CHARMASK(*u); - unicode_latin1[Py_CHARMASK(*u)] = unicode; - } - Py_INCREF(unicode); - return (PyObject *)unicode; - } - - return PyUnicode_DecodeUTF8(u, size, NULL); - } - - unicode = _PyUnicode_New(size); - if (!unicode) - return NULL; - - return (PyObject *)unicode; -} - -PyObject *PyUnicode_FromString(const char *u) -{ - size_t size = strlen(u); - if (size > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, "input too long"); - return NULL; - } - - return PyUnicode_FromStringAndSize(u, size); -} - -/* _Py_UNICODE_NEXT is a private macro used to retrieve the character pointed - * by 'ptr', possibly combining surrogate pairs on narrow builds. - * 'ptr' and 'end' must be Py_UNICODE*, with 'ptr' pointing at the character - * that should be returned and 'end' pointing to the end of the buffer. - * ('end' is used on narrow builds to detect a lone surrogate at the - * end of the buffer that should be returned unchanged.) - * The ptr and end arguments should be side-effect free and ptr must an lvalue. - * The type of the returned char is always Py_UCS4. - * - * Note: the macro advances ptr to next char, so it might have side-effects - * (especially if used with other macros). - */ - -/* helper macros used by _Py_UNICODE_NEXT */ -#define _Py_UNICODE_IS_HIGH_SURROGATE(ch) (0xD800 <= ch && ch <= 0xDBFF) -#define _Py_UNICODE_IS_LOW_SURROGATE(ch) (0xDC00 <= ch && ch <= 0xDFFF) -/* Join two surrogate characters and return a single Py_UCS4 value. */ -#define _Py_UNICODE_JOIN_SURROGATES(high, low) \ - (((((Py_UCS4)(high) & 0x03FF) << 10) | \ - ((Py_UCS4)(low) & 0x03FF)) + 0x10000) - -#ifdef Py_UNICODE_WIDE -#define _Py_UNICODE_NEXT(ptr, end) *(ptr)++ -#else -#define _Py_UNICODE_NEXT(ptr, end) \ - (((_Py_UNICODE_IS_HIGH_SURROGATE(*(ptr)) && (ptr) < (end)) && \ - _Py_UNICODE_IS_LOW_SURROGATE((ptr)[1])) ? \ - ((ptr) += 2,_Py_UNICODE_JOIN_SURROGATES((ptr)[-2], (ptr)[-1])) : \ - (Py_UCS4)*(ptr)++) -#endif - -#ifdef HAVE_WCHAR_H - -#if (Py_UNICODE_SIZE == 2) && defined(SIZEOF_WCHAR_T) && (SIZEOF_WCHAR_T == 4) -# define CONVERT_WCHAR_TO_SURROGATES -#endif - -#ifdef CONVERT_WCHAR_TO_SURROGATES - -/* Here sizeof(wchar_t) is 4 but Py_UNICODE_SIZE == 2, so we need - to convert from UTF32 to UTF16. */ - -PyObject *PyUnicode_FromWideChar(register const wchar_t *w, - Py_ssize_t size) -{ - PyUnicodeObject *unicode; - register Py_ssize_t i; - Py_ssize_t alloc; - const wchar_t *orig_w; - - if (w == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - - alloc = size; - orig_w = w; - for (i = size; i > 0; i--) { - if (*w > 0xFFFF) - alloc++; - w++; - } - w = orig_w; - unicode = _PyUnicode_New(alloc); - if (!unicode) - return NULL; - - /* Copy the wchar_t data into the new object */ - { - register Py_UNICODE *u; - u = PyUnicode_AS_UNICODE(unicode); - for (i = size; i > 0; i--) { - if (*w > 0xFFFF) { - wchar_t ordinal = *w++; - ordinal -= 0x10000; - *u++ = 0xD800 | (ordinal >> 10); - *u++ = 0xDC00 | (ordinal & 0x3FF); - } - else - *u++ = *w++; - } - } - return (PyObject *)unicode; -} - -#else - -PyObject *PyUnicode_FromWideChar(register const wchar_t *w, - Py_ssize_t size) -{ - PyUnicodeObject *unicode; - - if (w == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - - unicode = _PyUnicode_New(size); - if (!unicode) - return NULL; - - /* Copy the wchar_t data into the new object */ -#ifdef HAVE_USABLE_WCHAR_T - memcpy(unicode->str, w, size * sizeof(wchar_t)); -#else - { - register Py_UNICODE *u; - register Py_ssize_t i; - u = PyUnicode_AS_UNICODE(unicode); - for (i = size; i > 0; i--) - *u++ = *w++; - } -#endif - - return (PyObject *)unicode; -} - -#endif /* CONVERT_WCHAR_TO_SURROGATES */ - -#undef CONVERT_WCHAR_TO_SURROGATES - -static void -makefmt(char *fmt, int longflag, int size_tflag, int zeropad, int width, int precision, char c) -{ - *fmt++ = '%'; - if (width) { - if (zeropad) - *fmt++ = '0'; - fmt += sprintf(fmt, "%d", width); - } - if (precision) - fmt += sprintf(fmt, ".%d", precision); - if (longflag) - *fmt++ = 'l'; - else if (size_tflag) { - char *f = PY_FORMAT_SIZE_T; - while (*f) - *fmt++ = *f++; - } - *fmt++ = c; - *fmt = '\0'; -} - -#define appendstring(string) \ - do { \ - for (copy = string;*copy; copy++) { \ - *s++ = (unsigned char)*copy; \ - } \ - } while (0) - -PyObject * -PyUnicode_FromFormatV(const char *format, va_list vargs) -{ - va_list count; - Py_ssize_t callcount = 0; - PyObject **callresults = NULL; - PyObject **callresult = NULL; - Py_ssize_t n = 0; - int width = 0; - int precision = 0; - int zeropad; - const char* f; - Py_UNICODE *s; - PyObject *string; - /* used by sprintf */ - char buffer[21]; - /* use abuffer instead of buffer, if we need more space - * (which can happen if there's a format specifier with width). */ - char *abuffer = NULL; - char *realbuffer; - Py_ssize_t abuffersize = 0; - char fmt[60]; /* should be enough for %0width.precisionld */ - const char *copy; - -#ifdef VA_LIST_IS_ARRAY - Py_MEMCPY(count, vargs, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(count, vargs); -#else - count = vargs; -#endif -#endif - /* step 1: count the number of %S/%R/%s format specifications - * (we call PyObject_Str()/PyObject_Repr()/PyUnicode_DecodeUTF8() for these - * objects once during step 3 and put the result in an array) */ - for (f = format; *f; f++) { - if (*f == '%') { - f++; - while (*f && *f != '%' && !isalpha((unsigned)*f)) - f++; - if (!*f) - break; - if (*f == 's' || *f=='S' || *f=='R') - ++callcount; - } - } - /* step 2: allocate memory for the results of - * PyObject_Str()/PyObject_Repr()/PyUnicode_DecodeUTF8() calls */ - if (callcount) { - callresults = PyObject_Malloc(sizeof(PyObject *)*callcount); - if (!callresults) { - PyErr_NoMemory(); - return NULL; - } - callresult = callresults; - } - /* step 3: figure out how large a buffer we need */ - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - width = 0; - while (isdigit((unsigned)*f)) - width = (width*10) + *f++ - '0'; - precision = 0; - if (*f == '.') { - f++; - while (isdigit((unsigned)*f)) - precision = (precision*10) + *f++ - '0'; - } - - /* skip the 'l' or 'z' in {%ld, %zd, %lu, %zu} since - * they don't affect the amount of space we reserve. - */ - if ((*f == 'l' || *f == 'z') && - (f[1] == 'd' || f[1] == 'u')) - ++f; - - switch (*f) { - case 'c': - { - int ordinal = va_arg(count, int); -#ifdef Py_UNICODE_WIDE - if (ordinal < 0 || ordinal > 0x10ffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000) " - "(wide Python build)"); - goto fail; - } -#else - if (ordinal < 0 || ordinal > 0xffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x10000) " - "(narrow Python build)"); - goto fail; - } -#endif - /* fall through... */ - } - case '%': - n++; - break; - case 'd': case 'u': case 'i': case 'x': - (void) va_arg(count, int); - if (width < precision) - width = precision; - /* 20 bytes is enough to hold a 64-bit - integer. Decimal takes the most space. - This isn't enough for octal. - If a width is specified we need more - (which we allocate later). */ - if (width < 20) - width = 20; - n += width; - if (abuffersize < width) - abuffersize = width; - break; - case 's': - { - /* UTF-8 */ - const char *s = va_arg(count, const char*); - PyObject *str = PyUnicode_DecodeUTF8(s, strlen(s), "replace"); - if (!str) - goto fail; - n += PyUnicode_GET_SIZE(str); - /* Remember the str and switch to the next slot */ - *callresult++ = str; - break; - } - case 'U': - { - PyObject *obj = va_arg(count, PyObject *); - assert(obj && PyUnicode_Check(obj)); - n += PyUnicode_GET_SIZE(obj); - break; - } - case 'V': - { - PyObject *obj = va_arg(count, PyObject *); - const char *str = va_arg(count, const char *); - assert(obj || str); - assert(!obj || PyUnicode_Check(obj)); - if (obj) - n += PyUnicode_GET_SIZE(obj); - else - n += strlen(str); - break; - } - case 'S': - { - PyObject *obj = va_arg(count, PyObject *); - PyObject *str; - assert(obj); - str = PyObject_Str(obj); - if (!str) - goto fail; - n += PyString_GET_SIZE(str); - /* Remember the str and switch to the next slot */ - *callresult++ = str; - break; - } - case 'R': - { - PyObject *obj = va_arg(count, PyObject *); - PyObject *repr; - assert(obj); - repr = PyObject_Repr(obj); - if (!repr) - goto fail; - n += PyUnicode_GET_SIZE(repr); - /* Remember the repr and switch to the next slot */ - *callresult++ = repr; - break; - } - case 'p': - (void) va_arg(count, int); - /* maximum 64-bit pointer representation: - * 0xffffffffffffffff - * so 19 characters is enough. - * XXX I count 18 -- what's the extra for? - */ - n += 19; - break; - default: - /* if we stumble upon an unknown - formatting code, copy the rest of - the format string to the output - string. (we cannot just skip the - code, since there's no way to know - what's in the argument list) */ - n += strlen(p); - goto expand; - } - } else - n++; - } - expand: - if (abuffersize > 20) { - /* add 1 for sprintf's trailing null byte */ - abuffer = PyObject_Malloc(abuffersize + 1); - if (!abuffer) { - PyErr_NoMemory(); - goto fail; - } - realbuffer = abuffer; - } - else - realbuffer = buffer; - /* step 4: fill the buffer */ - /* Since we've analyzed how much space we need for the worst case, - we don't have to resize the string. - There can be no errors beyond this point. */ - string = PyUnicode_FromUnicode(NULL, n); - if (!string) - goto fail; - - s = PyUnicode_AS_UNICODE(string); - callresult = callresults; - - for (f = format; *f; f++) { - if (*f == '%') { - const char* p = f++; - int longflag = 0; - int size_tflag = 0; - zeropad = (*f == '0'); - /* parse the width.precision part */ - width = 0; - while (isdigit((unsigned)*f)) - width = (width*10) + *f++ - '0'; - precision = 0; - if (*f == '.') { - f++; - while (isdigit((unsigned)*f)) - precision = (precision*10) + *f++ - '0'; - } - /* handle the long flag, but only for %ld and %lu. - others can be added when necessary. */ - if (*f == 'l' && (f[1] == 'd' || f[1] == 'u')) { - longflag = 1; - ++f; - } - /* handle the size_t flag. */ - if (*f == 'z' && (f[1] == 'd' || f[1] == 'u')) { - size_tflag = 1; - ++f; - } - - switch (*f) { - case 'c': - *s++ = va_arg(vargs, int); - break; - case 'd': - makefmt(fmt, longflag, size_tflag, zeropad, width, precision, 'd'); - if (longflag) - sprintf(realbuffer, fmt, va_arg(vargs, long)); - else if (size_tflag) - sprintf(realbuffer, fmt, va_arg(vargs, Py_ssize_t)); - else - sprintf(realbuffer, fmt, va_arg(vargs, int)); - appendstring(realbuffer); - break; - case 'u': - makefmt(fmt, longflag, size_tflag, zeropad, width, precision, 'u'); - if (longflag) - sprintf(realbuffer, fmt, va_arg(vargs, unsigned long)); - else if (size_tflag) - sprintf(realbuffer, fmt, va_arg(vargs, size_t)); - else - sprintf(realbuffer, fmt, va_arg(vargs, unsigned int)); - appendstring(realbuffer); - break; - case 'i': - makefmt(fmt, 0, 0, zeropad, width, precision, 'i'); - sprintf(realbuffer, fmt, va_arg(vargs, int)); - appendstring(realbuffer); - break; - case 'x': - makefmt(fmt, 0, 0, zeropad, width, precision, 'x'); - sprintf(realbuffer, fmt, va_arg(vargs, int)); - appendstring(realbuffer); - break; - case 's': - { - /* unused, since we already have the result */ - (void) va_arg(vargs, char *); - Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(*callresult), - PyUnicode_GET_SIZE(*callresult)); - s += PyUnicode_GET_SIZE(*callresult); - /* We're done with the unicode()/repr() => forget it */ - Py_DECREF(*callresult); - /* switch to next unicode()/repr() result */ - ++callresult; - break; - } - case 'U': - { - PyObject *obj = va_arg(vargs, PyObject *); - Py_ssize_t size = PyUnicode_GET_SIZE(obj); - Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); - s += size; - break; - } - case 'V': - { - PyObject *obj = va_arg(vargs, PyObject *); - const char *str = va_arg(vargs, const char *); - if (obj) { - Py_ssize_t size = PyUnicode_GET_SIZE(obj); - Py_UNICODE_COPY(s, PyUnicode_AS_UNICODE(obj), size); - s += size; - } else { - appendstring(str); - } - break; - } - case 'S': - case 'R': - { - const char *str = PyString_AS_STRING(*callresult); - /* unused, since we already have the result */ - (void) va_arg(vargs, PyObject *); - appendstring(str); - /* We're done with the unicode()/repr() => forget it */ - Py_DECREF(*callresult); - /* switch to next unicode()/repr() result */ - ++callresult; - break; - } - case 'p': - sprintf(buffer, "%p", va_arg(vargs, void*)); - /* %p is ill-defined: ensure leading 0x. */ - if (buffer[1] == 'X') - buffer[1] = 'x'; - else if (buffer[1] != 'x') { - memmove(buffer+2, buffer, strlen(buffer)+1); - buffer[0] = '0'; - buffer[1] = 'x'; - } - appendstring(buffer); - break; - case '%': - *s++ = '%'; - break; - default: - appendstring(p); - goto end; - } - } else - *s++ = *f; - } - - end: - if (callresults) - PyObject_Free(callresults); - if (abuffer) - PyObject_Free(abuffer); - PyUnicode_Resize(&string, s - PyUnicode_AS_UNICODE(string)); - return string; - fail: - if (callresults) { - PyObject **callresult2 = callresults; - while (callresult2 < callresult) { - Py_DECREF(*callresult2); - ++callresult2; - } - PyObject_Free(callresults); - } - if (abuffer) - PyObject_Free(abuffer); - return NULL; -} - -#undef appendstring - -PyObject * -PyUnicode_FromFormat(const char *format, ...) -{ - PyObject* ret; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - ret = PyUnicode_FromFormatV(format, vargs); - va_end(vargs); - return ret; -} - -Py_ssize_t PyUnicode_AsWideChar(PyUnicodeObject *unicode, - wchar_t *w, - Py_ssize_t size) -{ - if (unicode == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - /* If possible, try to copy the 0-termination as well */ - if (size > PyUnicode_GET_SIZE(unicode)) - size = PyUnicode_GET_SIZE(unicode) + 1; - -#ifdef HAVE_USABLE_WCHAR_T - memcpy(w, unicode->str, size * sizeof(wchar_t)); -#else - { - register Py_UNICODE *u; - register Py_ssize_t i; - u = PyUnicode_AS_UNICODE(unicode); - for (i = size; i > 0; i--) - *w++ = *u++; - } -#endif - - if (size > PyUnicode_GET_SIZE(unicode)) - return PyUnicode_GET_SIZE(unicode); - else - return size; -} - -#endif - -PyObject *PyUnicode_FromOrdinal(int ordinal) -{ - Py_UNICODE s[1]; - -#ifdef Py_UNICODE_WIDE - if (ordinal < 0 || ordinal > 0x10ffff) { - PyErr_SetString(PyExc_ValueError, - "unichr() arg not in range(0x110000) " - "(wide Python build)"); - return NULL; - } -#else - if (ordinal < 0 || ordinal > 0xffff) { - PyErr_SetString(PyExc_ValueError, - "unichr() arg not in range(0x10000) " - "(narrow Python build)"); - return NULL; - } -#endif - - s[0] = (Py_UNICODE)ordinal; - return PyUnicode_FromUnicode(s, 1); -} - -PyObject *PyUnicode_FromObject(register PyObject *obj) -{ - /* XXX Perhaps we should make this API an alias of - PyObject_Unicode() instead ?! */ - if (PyUnicode_CheckExact(obj)) { - Py_INCREF(obj); - return obj; - } - if (PyUnicode_Check(obj)) { - /* For a Unicode subtype that's not a Unicode object, - return a true Unicode object with the same data. */ - return PyUnicode_FromUnicode(PyUnicode_AS_UNICODE(obj), - PyUnicode_GET_SIZE(obj)); - } - return PyUnicode_FromEncodedObject(obj, NULL, "strict"); -} - -PyObject *PyUnicode_FromEncodedObject(register PyObject *obj, - const char *encoding, - const char *errors) -{ - const char *s = NULL; - Py_ssize_t len; - PyObject *v; - - if (obj == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - -#if 0 - /* For b/w compatibility we also accept Unicode objects provided - that no encodings is given and then redirect to - PyObject_Unicode() which then applies the additional logic for - Unicode subclasses. - - NOTE: This API should really only be used for object which - represent *encoded* Unicode ! - - */ - if (PyUnicode_Check(obj)) { - if (encoding) { - PyErr_SetString(PyExc_TypeError, - "decoding Unicode is not supported"); - return NULL; - } - return PyObject_Unicode(obj); - } -#else - if (PyUnicode_Check(obj)) { - PyErr_SetString(PyExc_TypeError, - "decoding Unicode is not supported"); - return NULL; - } -#endif - - /* Coerce object */ - if (PyString_Check(obj)) { - s = PyString_AS_STRING(obj); - len = PyString_GET_SIZE(obj); - } - else if (PyByteArray_Check(obj)) { - /* Python 2.x specific */ - PyErr_Format(PyExc_TypeError, - "decoding bytearray is not supported"); - return NULL; - } - else if (PyObject_AsCharBuffer(obj, &s, &len)) { - /* Overwrite the error message with something more useful in - case of a TypeError. */ - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, - "coercing to Unicode: need string or buffer, " - "%.80s found", - Py_TYPE(obj)->tp_name); - goto onError; - } - - /* Convert to Unicode */ - if (len == 0) - _Py_RETURN_UNICODE_EMPTY(); - - v = PyUnicode_Decode(s, len, encoding, errors); - return v; - - onError: - return NULL; -} - -PyObject *PyUnicode_Decode(const char *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *buffer = NULL, *unicode; - - if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); - - /* Shortcuts for common default encodings */ - if (strcmp(encoding, "utf-8") == 0) - return PyUnicode_DecodeUTF8(s, size, errors); - else if (strcmp(encoding, "latin-1") == 0) - return PyUnicode_DecodeLatin1(s, size, errors); -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) - else if (strcmp(encoding, "mbcs") == 0) - return PyUnicode_DecodeMBCS(s, size, errors); -#endif - else if (strcmp(encoding, "ascii") == 0) - return PyUnicode_DecodeASCII(s, size, errors); - - /* Decode via the codec registry */ - buffer = PyBuffer_FromMemory((void *)s, size); - if (buffer == NULL) - goto onError; - unicode = PyCodec_Decode(buffer, encoding, errors); - if (unicode == NULL) - goto onError; - if (!PyUnicode_Check(unicode)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return an unicode object (type=%.400s)", - Py_TYPE(unicode)->tp_name); - Py_DECREF(unicode); - goto onError; - } - Py_DECREF(buffer); - return unicode; - - onError: - Py_XDECREF(buffer); - return NULL; -} - -PyObject *PyUnicode_AsDecodedObject(PyObject *unicode, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); - - /* Decode via the codec registry */ - v = PyCodec_Decode(unicode, encoding, errors); - if (v == NULL) - goto onError; - return v; - - onError: - return NULL; -} - -PyObject *PyUnicode_Encode(const Py_UNICODE *s, - Py_ssize_t size, - const char *encoding, - const char *errors) -{ - PyObject *v, *unicode; - - unicode = PyUnicode_FromUnicode(s, size); - if (unicode == NULL) - return NULL; - v = PyUnicode_AsEncodedString(unicode, encoding, errors); - Py_DECREF(unicode); - return v; -} - -PyObject *PyUnicode_AsEncodedObject(PyObject *unicode, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); - - /* Encode via the codec registry */ - v = PyCodec_Encode(unicode, encoding, errors); - if (v == NULL) - goto onError; - return v; - - onError: - return NULL; -} - -PyObject *PyUnicode_AsEncodedString(PyObject *unicode, - const char *encoding, - const char *errors) -{ - PyObject *v; - - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - goto onError; - } - - if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); - - /* Shortcuts for common default encodings */ - if (errors == NULL) { - if (strcmp(encoding, "utf-8") == 0) - return PyUnicode_AsUTF8String(unicode); - else if (strcmp(encoding, "latin-1") == 0) - return PyUnicode_AsLatin1String(unicode); -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) - else if (strcmp(encoding, "mbcs") == 0) - return PyUnicode_AsMBCSString(unicode); -#endif - else if (strcmp(encoding, "ascii") == 0) - return PyUnicode_AsASCIIString(unicode); - } - - /* Encode via the codec registry */ - v = PyCodec_Encode(unicode, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string object (type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - goto onError; - } - return v; - - onError: - return NULL; -} - -PyObject *_PyUnicode_AsDefaultEncodedString(PyObject *unicode, - const char *errors) -{ - PyObject *v = ((PyUnicodeObject *)unicode)->defenc; - - if (v) - return v; - v = PyUnicode_AsEncodedString(unicode, NULL, errors); - if (v && errors == NULL) - ((PyUnicodeObject *)unicode)->defenc = v; - return v; -} - -Py_UNICODE *PyUnicode_AsUnicode(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - goto onError; - } - return PyUnicode_AS_UNICODE(unicode); - - onError: - return NULL; -} - -Py_ssize_t PyUnicode_GetSize(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - goto onError; - } - return PyUnicode_GET_SIZE(unicode); - - onError: - return -1; -} - -const char *PyUnicode_GetDefaultEncoding(void) -{ - return unicode_default_encoding; -} - -int PyUnicode_SetDefaultEncoding(const char *encoding) -{ - PyObject *v; - - /* Make sure the encoding is valid. As side effect, this also - loads the encoding into the codec registry cache. */ - v = _PyCodec_Lookup(encoding); - if (v == NULL) - goto onError; - Py_DECREF(v); - strncpy(unicode_default_encoding, - encoding, - sizeof(unicode_default_encoding) - 1); - return 0; - - onError: - return -1; -} - -/* error handling callback helper: - build arguments, call the callback and check the arguments, - if no exception occurred, copy the replacement to the output - and adjust various state variables. - return 0 on success, -1 on error -*/ - -static -int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler, - const char *encoding, const char *reason, - const char *input, Py_ssize_t insize, Py_ssize_t *startinpos, - Py_ssize_t *endinpos, PyObject **exceptionObject, const char **inptr, - PyUnicodeObject **output, Py_ssize_t *outpos, Py_UNICODE **outptr) -{ - static char *argparse = "O!n;decoding error handler must return (unicode, int) tuple"; - - PyObject *restuple = NULL; - PyObject *repunicode = NULL; - Py_ssize_t outsize = PyUnicode_GET_SIZE(*output); - Py_ssize_t requiredsize; - Py_ssize_t newpos; - Py_UNICODE *repptr; - Py_ssize_t repsize; - int res = -1; - - if (*errorHandler == NULL) { - *errorHandler = PyCodec_LookupError(errors); - if (*errorHandler == NULL) - goto onError; - } - - if (*exceptionObject == NULL) { - *exceptionObject = PyUnicodeDecodeError_Create( - encoding, input, insize, *startinpos, *endinpos, reason); - if (*exceptionObject == NULL) - goto onError; - } - else { - if (PyUnicodeDecodeError_SetStart(*exceptionObject, *startinpos)) - goto onError; - if (PyUnicodeDecodeError_SetEnd(*exceptionObject, *endinpos)) - goto onError; - if (PyUnicodeDecodeError_SetReason(*exceptionObject, reason)) - goto onError; - } - - restuple = PyObject_CallFunctionObjArgs(*errorHandler, *exceptionObject, NULL); - if (restuple == NULL) - goto onError; - if (!PyTuple_Check(restuple)) { - PyErr_SetString(PyExc_TypeError, &argparse[4]); - goto onError; - } - if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, &repunicode, &newpos)) - goto onError; - if (newpos<0) - newpos = insize+newpos; - if (newpos<0 || newpos>insize) { - PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", newpos); - goto onError; - } - - /* need more space? (at least enough for what we - have+the replacement+the rest of the string (starting - at the new input position), so we won't have to check space - when there are no errors in the rest of the string) */ - repptr = PyUnicode_AS_UNICODE(repunicode); - repsize = PyUnicode_GET_SIZE(repunicode); - requiredsize = *outpos; - if (requiredsize > PY_SSIZE_T_MAX - repsize) - goto overflow; - requiredsize += repsize; - if (requiredsize > PY_SSIZE_T_MAX - (insize - newpos)) - goto overflow; - requiredsize += insize - newpos; - if (requiredsize > outsize) { - if (outsize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*outsize) - requiredsize = 2*outsize; - if (_PyUnicode_Resize(output, requiredsize) < 0) - goto onError; - *outptr = PyUnicode_AS_UNICODE(*output) + *outpos; - } - *endinpos = newpos; - *inptr = input + newpos; - Py_UNICODE_COPY(*outptr, repptr, repsize); - *outptr += repsize; - *outpos += repsize; - /* we made it! */ - res = 0; - - onError: - Py_XDECREF(restuple); - return res; - - overflow: - PyErr_SetString(PyExc_OverflowError, - "decoded result is too long for a Python string"); - goto onError; -} - -/* --- UTF-7 Codec -------------------------------------------------------- */ - -/* See RFC2152 for details. We encode conservatively and decode liberally. */ - -/* Three simple macros defining base-64. */ - -/* Is c a base-64 character? */ - -#define IS_BASE64(c) \ - (isalnum(c) || (c) == '+' || (c) == '/') - -/* given that c is a base-64 character, what is its base-64 value? */ - -#define FROM_BASE64(c) \ - (((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' : \ - ((c) >= 'a' && (c) <= 'z') ? (c) - 'a' + 26 : \ - ((c) >= '0' && (c) <= '9') ? (c) - '0' + 52 : \ - (c) == '+' ? 62 : 63) - -/* What is the base-64 character of the bottom 6 bits of n? */ - -#define TO_BASE64(n) \ - ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(n) & 0x3f]) - -/* DECODE_DIRECT: this byte encountered in a UTF-7 string should be - * decoded as itself. We are permissive on decoding; the only ASCII - * byte not decoding to itself is the + which begins a base64 - * string. */ - -#define DECODE_DIRECT(c) \ - ((c) <= 127 && (c) != '+') - -/* The UTF-7 encoder treats ASCII characters differently according to - * whether they are Set D, Set O, Whitespace, or special (i.e. none of - * the above). See RFC2152. This array identifies these different - * sets: - * 0 : "Set D" - * alphanumeric and '(),-./:? - * 1 : "Set O" - * !"#$%&*;<=>@[]^_`{|} - * 2 : "whitespace" - * ht nl cr sp - * 3 : special (must be base64 encoded) - * everything else (i.e. +\~ and non-printing codes 0-8 11-12 14-31 127) - */ - -static -char utf7_category[128] = { -/* nul soh stx etx eot enq ack bel bs ht nl vt np cr so si */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 3, 3, 2, 3, 3, -/* dle dc1 dc2 dc3 dc4 nak syn etb can em sub esc fs gs rs us */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, -/* sp ! " # $ % & ' ( ) * + , - . / */ - 2, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 3, 0, 0, 0, 0, -/* 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, -/* @ A B C D E F G H I J K L M N O */ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* P Q R S T U V W X Y Z [ \ ] ^ _ */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 3, 1, 1, 1, -/* ` a b c d e f g h i j k l m n o */ - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -/* p q r s t u v w x y z { | } ~ del */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 3, 3, -}; - -/* ENCODE_DIRECT: this character should be encoded as itself. The - * answer depends on whether we are encoding set O as itself, and also - * on whether we are encoding whitespace as itself. RFC2152 makes it - * clear that the answers to these questions vary between - * applications, so this code needs to be flexible. */ - -#define ENCODE_DIRECT(c, directO, directWS) \ - ((c) < 128 && (c) > 0 && \ - ((utf7_category[(c)] == 0) || \ - (directWS && (utf7_category[(c)] == 2)) || \ - (directO && (utf7_category[(c)] == 1)))) - -PyObject *PyUnicode_DecodeUTF7(const char *s, - Py_ssize_t size, - const char *errors) -{ - return PyUnicode_DecodeUTF7Stateful(s, size, errors, NULL); -} - -/* The decoder. The only state we preserve is our read position, - * i.e. how many characters we have consumed. So if we end in the - * middle of a shift sequence we have to back off the read position - * and the output to the beginning of the sequence, otherwise we lose - * all the shift state (seen bits, number of bits seen, high - * surrogate). */ - -PyObject *PyUnicode_DecodeUTF7Stateful(const char *s, - Py_ssize_t size, - const char *errors, - Py_ssize_t *consumed) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - const char *e; - PyUnicodeObject *unicode; - Py_UNICODE *p; - const char *errmsg = ""; - int inShift = 0; - Py_UNICODE *shiftOutStart; - unsigned int base64bits = 0; - unsigned long base64buffer = 0; - Py_UNICODE surrogate = 0; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - unicode = _PyUnicode_New(size); - if (!unicode) - return NULL; - if (size == 0) { - if (consumed) - *consumed = 0; - return (PyObject *)unicode; - } - - p = unicode->str; - shiftOutStart = p; - e = s + size; - - while (s < e) { - Py_UNICODE ch = (unsigned char) *s; - - if (inShift) { /* in a base-64 section */ - if (IS_BASE64(ch)) { /* consume a base-64 character */ - base64buffer = (base64buffer << 6) | FROM_BASE64(ch); - base64bits += 6; - s++; - if (base64bits >= 16) { - /* we have enough bits for a UTF-16 value */ - Py_UNICODE outCh = (Py_UNICODE) - (base64buffer >> (base64bits-16)); - base64bits -= 16; - base64buffer &= (1 << base64bits) - 1; /* clear high bits */ - assert(outCh <= 0xffff); - if (surrogate) { - /* expecting a second surrogate */ - if (outCh >= 0xDC00 && outCh <= 0xDFFF) { -#ifdef Py_UNICODE_WIDE - *p++ = (((surrogate & 0x3FF)<<10) - | (outCh & 0x3FF)) + 0x10000; -#else - *p++ = surrogate; - *p++ = outCh; -#endif - surrogate = 0; - continue; - } - else { - *p++ = surrogate; - surrogate = 0; - } - } - if (outCh >= 0xD800 && outCh <= 0xDBFF) { - /* first surrogate */ - surrogate = outCh; - } - else { - *p++ = outCh; - } - } - } - else { /* now leaving a base-64 section */ - inShift = 0; - s++; - if (surrogate) { - *p++ = surrogate; - surrogate = 0; - } - if (base64bits > 0) { /* left-over bits */ - if (base64bits >= 6) { - /* We've seen at least one base-64 character */ - errmsg = "partial character in shift sequence"; - goto utf7Error; - } - else { - /* Some bits remain; they should be zero */ - if (base64buffer != 0) { - errmsg = "non-zero padding bits in shift sequence"; - goto utf7Error; - } - } - } - if (ch != '-') { - /* '-' is absorbed; other terminating - characters are preserved */ - *p++ = ch; - } - } - } - else if ( ch == '+' ) { - startinpos = s-starts; - s++; /* consume '+' */ - if (s < e && *s == '-') { /* '+-' encodes '+' */ - s++; - *p++ = '+'; - } - else { /* begin base64-encoded section */ - inShift = 1; - shiftOutStart = p; - base64bits = 0; - base64buffer = 0; - } - } - else if (DECODE_DIRECT(ch)) { /* character decodes as itself */ - *p++ = ch; - s++; - } - else { - startinpos = s-starts; - s++; - errmsg = "unexpected special character"; - goto utf7Error; - } - continue; -utf7Error: - outpos = p-PyUnicode_AS_UNICODE(unicode); - endinpos = s-starts; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf7", errmsg, - starts, size, &startinpos, &endinpos, &exc, &s, - &unicode, &outpos, &p)) - goto onError; - } - - /* end of string */ - - if (inShift && !consumed) { /* in shift sequence, no more to follow */ - /* if we're in an inconsistent state, that's an error */ - if (surrogate || - (base64bits >= 6) || - (base64bits > 0 && base64buffer != 0)) { - outpos = p-PyUnicode_AS_UNICODE(unicode); - endinpos = size; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf7", "unterminated shift sequence", - starts, size, &startinpos, &endinpos, &exc, &s, - &unicode, &outpos, &p)) - goto onError; - } - } - - /* return state */ - if (consumed) { - if (inShift) { - p = shiftOutStart; /* back off output */ - *consumed = startinpos; - } - else { - *consumed = s-starts; - } - } - - if (_PyUnicode_Resize(&unicode, p - PyUnicode_AS_UNICODE(unicode)) < 0) - goto onError; - - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)unicode; - - onError: - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - Py_DECREF(unicode); - return NULL; -} - - -PyObject *PyUnicode_EncodeUTF7(const Py_UNICODE *s, - Py_ssize_t size, - int base64SetO, - int base64WhiteSpace, - const char *errors) -{ - PyObject *v; - /* It might be possible to tighten this worst case */ - Py_ssize_t allocated = 8 * size; - int inShift = 0; - Py_ssize_t i = 0; - unsigned int base64bits = 0; - unsigned long base64buffer = 0; - char * out; - char * start; - - if (allocated / 8 != size) - return PyErr_NoMemory(); - - if (size == 0) - return PyString_FromStringAndSize(NULL, 0); - - v = PyString_FromStringAndSize(NULL, allocated); - if (v == NULL) - return NULL; - - start = out = PyString_AS_STRING(v); - for (;i < size; ++i) { - Py_UNICODE ch = s[i]; - - if (inShift) { - if (ENCODE_DIRECT(ch, !base64SetO, !base64WhiteSpace)) { - /* shifting out */ - if (base64bits) { /* output remaining bits */ - *out++ = TO_BASE64(base64buffer << (6-base64bits)); - base64buffer = 0; - base64bits = 0; - } - inShift = 0; - /* Characters not in the BASE64 set implicitly unshift the sequence - so no '-' is required, except if the character is itself a '-' */ - if (IS_BASE64(ch) || ch == '-') { - *out++ = '-'; - } - *out++ = (char) ch; - } - else { - goto encode_char; - } - } - else { /* not in a shift sequence */ - if (ch == '+') { - *out++ = '+'; - *out++ = '-'; - } - else if (ENCODE_DIRECT(ch, !base64SetO, !base64WhiteSpace)) { - *out++ = (char) ch; - } - else { - *out++ = '+'; - inShift = 1; - goto encode_char; - } - } - continue; -encode_char: -#ifdef Py_UNICODE_WIDE - if (ch >= 0x10000) { - /* code first surrogate */ - base64bits += 16; - base64buffer = (base64buffer << 16) | 0xd800 | ((ch-0x10000) >> 10); - while (base64bits >= 6) { - *out++ = TO_BASE64(base64buffer >> (base64bits-6)); - base64bits -= 6; - } - /* prepare second surrogate */ - ch = 0xDC00 | ((ch-0x10000) & 0x3FF); - } -#endif - base64bits += 16; - base64buffer = (base64buffer << 16) | ch; - while (base64bits >= 6) { - *out++ = TO_BASE64(base64buffer >> (base64bits-6)); - base64bits -= 6; - } - } - if (base64bits) - *out++= TO_BASE64(base64buffer << (6-base64bits) ); - if (inShift) - *out++ = '-'; - - if (_PyString_Resize(&v, out - start)) - return NULL; - return v; -} - -#undef IS_BASE64 -#undef FROM_BASE64 -#undef TO_BASE64 -#undef DECODE_DIRECT -#undef ENCODE_DIRECT - -/* --- UTF-8 Codec -------------------------------------------------------- */ - -static -char utf8_code_length[256] = { - /* Map UTF-8 encoded prefix byte to sequence length. Zero means - illegal prefix. See RFC 3629 for details */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 00-0F */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 70-7F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 80-8F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* B0-BF */ - 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* C0-C1 + C2-CF */ - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, /* D0-DF */ - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* E0-EF */ - 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* F0-F4 + F5-FF */ -}; - -PyObject *PyUnicode_DecodeUTF8(const char *s, - Py_ssize_t size, - const char *errors) -{ - return PyUnicode_DecodeUTF8Stateful(s, size, errors, NULL); -} - -PyObject *PyUnicode_DecodeUTF8Stateful(const char *s, - Py_ssize_t size, - const char *errors, - Py_ssize_t *consumed) -{ - const char *starts = s; - int n; - int k; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - const char *e; - PyUnicodeObject *unicode; - Py_UNICODE *p; - const char *errmsg = ""; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - /* Note: size will always be longer than the resulting Unicode - character count */ - unicode = _PyUnicode_New(size); - if (!unicode) - return NULL; - if (size == 0) { - if (consumed) - *consumed = 0; - return (PyObject *)unicode; - } - - /* Unpack UTF-8 encoded data */ - p = unicode->str; - e = s + size; - - while (s < e) { - Py_UCS4 ch = (unsigned char)*s; - - if (ch < 0x80) { - *p++ = (Py_UNICODE)ch; - s++; - continue; - } - - n = utf8_code_length[ch]; - - if (s + n > e) { - if (consumed) - break; - else { - errmsg = "unexpected end of data"; - startinpos = s-starts; - endinpos = startinpos+1; - for (k=1; (k < size-startinpos) && ((s[k]&0xC0) == 0x80); k++) - endinpos++; - goto utf8Error; - } - } - - switch (n) { - - case 0: - errmsg = "invalid start byte"; - startinpos = s-starts; - endinpos = startinpos+1; - goto utf8Error; - - case 1: - errmsg = "internal error"; - startinpos = s-starts; - endinpos = startinpos+1; - goto utf8Error; - - case 2: - if ((s[1] & 0xc0) != 0x80) { - errmsg = "invalid continuation byte"; - startinpos = s-starts; - endinpos = startinpos + 1; - goto utf8Error; - } - ch = ((s[0] & 0x1f) << 6) + (s[1] & 0x3f); - assert ((ch > 0x007F) && (ch <= 0x07FF)); - *p++ = (Py_UNICODE)ch; - break; - - case 3: - /* XXX: surrogates shouldn't be valid UTF-8! - see http://www.unicode.org/versions/Unicode5.2.0/ch03.pdf - (table 3-7) and http://www.rfc-editor.org/rfc/rfc3629.txt - Uncomment the 2 lines below to make them invalid, - code points: d800-dfff; UTF-8: \xed\xa0\x80-\xed\xbf\xbf. */ - if ((s[1] & 0xc0) != 0x80 || - (s[2] & 0xc0) != 0x80 || - ((unsigned char)s[0] == 0xE0 && - (unsigned char)s[1] < 0xA0)/* || - ((unsigned char)s[0] == 0xED && - (unsigned char)s[1] > 0x9F)*/) { - errmsg = "invalid continuation byte"; - startinpos = s-starts; - endinpos = startinpos + 1; - - /* if s[1] first two bits are 1 and 0, then the invalid - continuation byte is s[2], so increment endinpos by 1, - if not, s[1] is invalid and endinpos doesn't need to - be incremented. */ - if ((s[1] & 0xC0) == 0x80) - endinpos++; - goto utf8Error; - } - ch = ((s[0] & 0x0f) << 12) + ((s[1] & 0x3f) << 6) + (s[2] & 0x3f); - assert ((ch > 0x07FF) && (ch <= 0xFFFF)); - *p++ = (Py_UNICODE)ch; - break; - - case 4: - if ((s[1] & 0xc0) != 0x80 || - (s[2] & 0xc0) != 0x80 || - (s[3] & 0xc0) != 0x80 || - ((unsigned char)s[0] == 0xF0 && - (unsigned char)s[1] < 0x90) || - ((unsigned char)s[0] == 0xF4 && - (unsigned char)s[1] > 0x8F)) { - errmsg = "invalid continuation byte"; - startinpos = s-starts; - endinpos = startinpos + 1; - if ((s[1] & 0xC0) == 0x80) { - endinpos++; - if ((s[2] & 0xC0) == 0x80) - endinpos++; - } - goto utf8Error; - } - ch = ((s[0] & 0x7) << 18) + ((s[1] & 0x3f) << 12) + - ((s[2] & 0x3f) << 6) + (s[3] & 0x3f); - assert ((ch > 0xFFFF) && (ch <= 0x10ffff)); - -#ifdef Py_UNICODE_WIDE - *p++ = (Py_UNICODE)ch; -#else - /* compute and append the two surrogates: */ - - /* translate from 10000..10FFFF to 0..FFFF */ - ch -= 0x10000; - - /* high surrogate = top 10 bits added to D800 */ - *p++ = (Py_UNICODE)(0xD800 + (ch >> 10)); - - /* low surrogate = bottom 10 bits added to DC00 */ - *p++ = (Py_UNICODE)(0xDC00 + (ch & 0x03FF)); -#endif - break; - } - s += n; - continue; - - utf8Error: - outpos = p-PyUnicode_AS_UNICODE(unicode); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf8", errmsg, - starts, size, &startinpos, &endinpos, &exc, &s, - &unicode, &outpos, &p)) - goto onError; - } - if (consumed) - *consumed = s-starts; - - /* Adjust length */ - if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) - goto onError; - - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)unicode; - - onError: - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - Py_DECREF(unicode); - return NULL; -} - -/* Allocation strategy: if the string is short, convert into a stack buffer - and allocate exactly as much space needed at the end. Else allocate the - maximum possible needed (4 result bytes per Unicode character), and return - the excess memory at the end. -*/ -PyObject * -PyUnicode_EncodeUTF8(const Py_UNICODE *s, - Py_ssize_t size, - const char *errors) -{ -#define MAX_SHORT_UNICHARS 300 /* largest size we'll do on the stack */ - - Py_ssize_t i; /* index into s of next input byte */ - PyObject *v; /* result string object */ - char *p; /* next free byte in output buffer */ - Py_ssize_t nallocated; /* number of result bytes allocated */ - Py_ssize_t nneeded; /* number of result bytes needed */ - char stackbuf[MAX_SHORT_UNICHARS * 4]; - - assert(s != NULL); - assert(size >= 0); - - if (size <= MAX_SHORT_UNICHARS) { - /* Write into the stack buffer; nallocated can't overflow. - * At the end, we'll allocate exactly as much heap space as it - * turns out we need. - */ - nallocated = Py_SAFE_DOWNCAST(sizeof(stackbuf), size_t, int); - v = NULL; /* will allocate after we're done */ - p = stackbuf; - } - else { - /* Overallocate on the heap, and give the excess back at the end. */ - nallocated = size * 4; - if (nallocated / 4 != size) /* overflow! */ - return PyErr_NoMemory(); - v = PyString_FromStringAndSize(NULL, nallocated); - if (v == NULL) - return NULL; - p = PyString_AS_STRING(v); - } - - for (i = 0; i < size;) { - Py_UCS4 ch = s[i++]; - - if (ch < 0x80) - /* Encode ASCII */ - *p++ = (char) ch; - - else if (ch < 0x0800) { - /* Encode Latin-1 */ - *p++ = (char)(0xc0 | (ch >> 6)); - *p++ = (char)(0x80 | (ch & 0x3f)); - } - else { - /* Encode UCS2 Unicode ordinals */ - if (ch < 0x10000) { - /* Special case: check for high surrogate */ - if (0xD800 <= ch && ch <= 0xDBFF && i != size) { - Py_UCS4 ch2 = s[i]; - /* Check for low surrogate and combine the two to - form a UCS4 value */ - if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { - ch = ((ch - 0xD800) << 10 | (ch2 - 0xDC00)) + 0x10000; - i++; - goto encodeUCS4; - } - /* Fall through: handles isolated high surrogates */ - } - *p++ = (char)(0xe0 | (ch >> 12)); - *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); - *p++ = (char)(0x80 | (ch & 0x3f)); - continue; - } - encodeUCS4: - /* Encode UCS4 Unicode ordinals */ - *p++ = (char)(0xf0 | (ch >> 18)); - *p++ = (char)(0x80 | ((ch >> 12) & 0x3f)); - *p++ = (char)(0x80 | ((ch >> 6) & 0x3f)); - *p++ = (char)(0x80 | (ch & 0x3f)); - } - } - - if (v == NULL) { - /* This was stack allocated. */ - nneeded = p - stackbuf; - assert(nneeded <= nallocated); - v = PyString_FromStringAndSize(stackbuf, nneeded); - } - else { - /* Cut back to size actually needed. */ - nneeded = p - PyString_AS_STRING(v); - assert(nneeded <= nallocated); - if (_PyString_Resize(&v, nneeded)) - return NULL; - } - return v; - -#undef MAX_SHORT_UNICHARS -} - -PyObject *PyUnicode_AsUTF8String(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeUTF8(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); -} - -/* --- UTF-32 Codec ------------------------------------------------------- */ - -PyObject * -PyUnicode_DecodeUTF32(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder) -{ - return PyUnicode_DecodeUTF32Stateful(s, size, errors, byteorder, NULL); -} - -PyObject * -PyUnicode_DecodeUTF32Stateful(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder, - Py_ssize_t *consumed) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - PyUnicodeObject *unicode; - Py_UNICODE *p; -#ifndef Py_UNICODE_WIDE - int pairs = 0; - const unsigned char *qq; -#else - const int pairs = 0; -#endif - const unsigned char *q, *e; - int bo = 0; /* assume native ordering by default */ - const char *errmsg = ""; - /* Offsets from q for retrieving bytes in the right order. */ -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - int iorder[] = {0, 1, 2, 3}; -#else - int iorder[] = {3, 2, 1, 0}; -#endif - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - q = (unsigned char *)s; - e = q + size; - - if (byteorder) - bo = *byteorder; - - /* Check for BOM marks (U+FEFF) in the input and adjust current - byte order setting accordingly. In native mode, the leading BOM - mark is skipped, in all other modes, it is copied to the output - stream as-is (giving a ZWNBSP character). */ - if (bo == 0) { - if (size >= 4) { - const Py_UCS4 bom = (q[iorder[3]] << 24) | (q[iorder[2]] << 16) | - (q[iorder[1]] << 8) | q[iorder[0]]; -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - if (bom == 0x0000FEFF) { - q += 4; - bo = -1; - } - else if (bom == 0xFFFE0000) { - q += 4; - bo = 1; - } -#else - if (bom == 0x0000FEFF) { - q += 4; - bo = 1; - } - else if (bom == 0xFFFE0000) { - q += 4; - bo = -1; - } -#endif - } - } - - if (bo == -1) { - /* force LE */ - iorder[0] = 0; - iorder[1] = 1; - iorder[2] = 2; - iorder[3] = 3; - } - else if (bo == 1) { - /* force BE */ - iorder[0] = 3; - iorder[1] = 2; - iorder[2] = 1; - iorder[3] = 0; - } - - /* On narrow builds we split characters outside the BMP into two - code points => count how much extra space we need. */ -#ifndef Py_UNICODE_WIDE - for (qq = q; e - qq >= 4; qq += 4) - if (qq[iorder[2]] != 0 || qq[iorder[3]] != 0) - pairs++; -#endif - - /* This might be one to much, because of a BOM */ - unicode = _PyUnicode_New((size+3)/4+pairs); - if (!unicode) - return NULL; - if (size == 0) - return (PyObject *)unicode; - - /* Unpack UTF-32 encoded data */ - p = unicode->str; - - while (q < e) { - Py_UCS4 ch; - /* remaining bytes at the end? (size should be divisible by 4) */ - if (e-q<4) { - if (consumed) - break; - errmsg = "truncated data"; - startinpos = ((const char *)q)-starts; - endinpos = ((const char *)e)-starts; - goto utf32Error; - /* The remaining input chars are ignored if the callback - chooses to skip the input */ - } - ch = (q[iorder[3]] << 24) | (q[iorder[2]] << 16) | - (q[iorder[1]] << 8) | q[iorder[0]]; - - if (ch >= 0x110000) - { - errmsg = "code point not in range(0x110000)"; - startinpos = ((const char *)q)-starts; - endinpos = startinpos+4; - goto utf32Error; - } -#ifndef Py_UNICODE_WIDE - if (ch >= 0x10000) - { - *p++ = 0xD800 | ((ch-0x10000) >> 10); - *p++ = 0xDC00 | ((ch-0x10000) & 0x3FF); - } - else -#endif - *p++ = ch; - q += 4; - continue; - utf32Error: - outpos = p-PyUnicode_AS_UNICODE(unicode); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf32", errmsg, - starts, size, &startinpos, &endinpos, &exc, (const char **)&q, - &unicode, &outpos, &p)) - goto onError; - } - - if (byteorder) - *byteorder = bo; - - if (consumed) - *consumed = (const char *)q-starts; - - /* Adjust length */ - if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) - goto onError; - - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)unicode; - - onError: - Py_DECREF(unicode); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -PyObject * -PyUnicode_EncodeUTF32(const Py_UNICODE *s, - Py_ssize_t size, - const char *errors, - int byteorder) -{ - PyObject *v; - unsigned char *p; - Py_ssize_t nsize, bytesize; -#ifndef Py_UNICODE_WIDE - Py_ssize_t i, pairs; -#else - const int pairs = 0; -#endif - /* Offsets from p for storing byte pairs in the right order. */ -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - int iorder[] = {0, 1, 2, 3}; -#else - int iorder[] = {3, 2, 1, 0}; -#endif - -#define STORECHAR(CH) \ - do { \ - p[iorder[3]] = ((CH) >> 24) & 0xff; \ - p[iorder[2]] = ((CH) >> 16) & 0xff; \ - p[iorder[1]] = ((CH) >> 8) & 0xff; \ - p[iorder[0]] = (CH) & 0xff; \ - p += 4; \ - } while(0) - - /* In narrow builds we can output surrogate pairs as one code point, - so we need less space. */ -#ifndef Py_UNICODE_WIDE - for (i = pairs = 0; i < size-1; i++) - if (0xD800 <= s[i] && s[i] <= 0xDBFF && - 0xDC00 <= s[i+1] && s[i+1] <= 0xDFFF) - pairs++; -#endif - nsize = (size - pairs + (byteorder == 0)); - bytesize = nsize * 4; - if (bytesize / 4 != nsize) - return PyErr_NoMemory(); - v = PyString_FromStringAndSize(NULL, bytesize); - if (v == NULL) - return NULL; - - p = (unsigned char *)PyString_AS_STRING(v); - if (byteorder == 0) - STORECHAR(0xFEFF); - if (size == 0) - return v; - - if (byteorder == -1) { - /* force LE */ - iorder[0] = 0; - iorder[1] = 1; - iorder[2] = 2; - iorder[3] = 3; - } - else if (byteorder == 1) { - /* force BE */ - iorder[0] = 3; - iorder[1] = 2; - iorder[2] = 1; - iorder[3] = 0; - } - - while (size-- > 0) { - Py_UCS4 ch = *s++; -#ifndef Py_UNICODE_WIDE - if (0xD800 <= ch && ch <= 0xDBFF && size > 0) { - Py_UCS4 ch2 = *s; - if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { - ch = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; - s++; - size--; - } - } -#endif - STORECHAR(ch); - } - return v; -#undef STORECHAR -} - -PyObject *PyUnicode_AsUTF32String(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeUTF32(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL, - 0); -} - -/* --- UTF-16 Codec ------------------------------------------------------- */ - -PyObject * -PyUnicode_DecodeUTF16(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder) -{ - return PyUnicode_DecodeUTF16Stateful(s, size, errors, byteorder, NULL); -} - -PyObject * -PyUnicode_DecodeUTF16Stateful(const char *s, - Py_ssize_t size, - const char *errors, - int *byteorder, - Py_ssize_t *consumed) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - PyUnicodeObject *unicode; - Py_UNICODE *p; - const unsigned char *q, *e; - int bo = 0; /* assume native ordering by default */ - const char *errmsg = ""; - /* Offsets from q for retrieving byte pairs in the right order. */ -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - int ihi = 1, ilo = 0; -#else - int ihi = 0, ilo = 1; -#endif - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - /* Note: size will always be longer than the resulting Unicode - character count */ - unicode = _PyUnicode_New(size); - if (!unicode) - return NULL; - if (size == 0) - return (PyObject *)unicode; - - /* Unpack UTF-16 encoded data */ - p = unicode->str; - q = (unsigned char *)s; - e = q + size; - - if (byteorder) - bo = *byteorder; - - /* Check for BOM marks (U+FEFF) in the input and adjust current - byte order setting accordingly. In native mode, the leading BOM - mark is skipped, in all other modes, it is copied to the output - stream as-is (giving a ZWNBSP character). */ - if (bo == 0) { - if (size >= 2) { - const Py_UNICODE bom = (q[ihi] << 8) | q[ilo]; -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - if (bom == 0xFEFF) { - q += 2; - bo = -1; - } - else if (bom == 0xFFFE) { - q += 2; - bo = 1; - } -#else - if (bom == 0xFEFF) { - q += 2; - bo = 1; - } - else if (bom == 0xFFFE) { - q += 2; - bo = -1; - } -#endif - } - } - - if (bo == -1) { - /* force LE */ - ihi = 1; - ilo = 0; - } - else if (bo == 1) { - /* force BE */ - ihi = 0; - ilo = 1; - } - - while (q < e) { - Py_UNICODE ch; - /* remaining bytes at the end? (size should be even) */ - if (e-q<2) { - if (consumed) - break; - errmsg = "truncated data"; - startinpos = ((const char *)q)-starts; - endinpos = ((const char *)e)-starts; - goto utf16Error; - /* The remaining input chars are ignored if the callback - chooses to skip the input */ - } - ch = (q[ihi] << 8) | q[ilo]; - - q += 2; - - if (ch < 0xD800 || ch > 0xDFFF) { - *p++ = ch; - continue; - } - - /* UTF-16 code pair: */ - if (e - q < 2) { - q -= 2; - if (consumed) - break; - errmsg = "unexpected end of data"; - startinpos = ((const char *)q)-starts; - endinpos = ((const char *)e)-starts; - goto utf16Error; - } - if (0xD800 <= ch && ch <= 0xDBFF) { - Py_UNICODE ch2 = (q[ihi] << 8) | q[ilo]; - q += 2; - if (0xDC00 <= ch2 && ch2 <= 0xDFFF) { -#ifndef Py_UNICODE_WIDE - *p++ = ch; - *p++ = ch2; -#else - *p++ = (((ch & 0x3FF)<<10) | (ch2 & 0x3FF)) + 0x10000; -#endif - continue; - } - else { - errmsg = "illegal UTF-16 surrogate"; - startinpos = (((const char *)q)-4)-starts; - endinpos = startinpos+2; - goto utf16Error; - } - - } - errmsg = "illegal encoding"; - startinpos = (((const char *)q)-2)-starts; - endinpos = startinpos+2; - /* Fall through to report the error */ - - utf16Error: - outpos = p-PyUnicode_AS_UNICODE(unicode); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "utf16", errmsg, - starts, size, &startinpos, &endinpos, &exc, (const char **)&q, - &unicode, &outpos, &p)) - goto onError; - } - - if (byteorder) - *byteorder = bo; - - if (consumed) - *consumed = (const char *)q-starts; - - /* Adjust length */ - if (_PyUnicode_Resize(&unicode, p - unicode->str) < 0) - goto onError; - - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)unicode; - - onError: - Py_DECREF(unicode); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -PyObject * -PyUnicode_EncodeUTF16(const Py_UNICODE *s, - Py_ssize_t size, - const char *errors, - int byteorder) -{ - PyObject *v; - unsigned char *p; - Py_ssize_t nsize, bytesize; -#ifdef Py_UNICODE_WIDE - Py_ssize_t i, pairs; -#else - const int pairs = 0; -#endif - /* Offsets from p for storing byte pairs in the right order. */ -#ifdef BYTEORDER_IS_LITTLE_ENDIAN - int ihi = 1, ilo = 0; -#else - int ihi = 0, ilo = 1; -#endif - -#define STORECHAR(CH) \ - do { \ - p[ihi] = ((CH) >> 8) & 0xff; \ - p[ilo] = (CH) & 0xff; \ - p += 2; \ - } while(0) - -#ifdef Py_UNICODE_WIDE - for (i = pairs = 0; i < size; i++) - if (s[i] >= 0x10000) - pairs++; -#endif - /* 2 * (size + pairs + (byteorder == 0)) */ - if (size > PY_SSIZE_T_MAX || - size > PY_SSIZE_T_MAX - pairs - (byteorder == 0)) - return PyErr_NoMemory(); - nsize = size + pairs + (byteorder == 0); - bytesize = nsize * 2; - if (bytesize / 2 != nsize) - return PyErr_NoMemory(); - v = PyString_FromStringAndSize(NULL, bytesize); - if (v == NULL) - return NULL; - - p = (unsigned char *)PyString_AS_STRING(v); - if (byteorder == 0) - STORECHAR(0xFEFF); - if (size == 0) - return v; - - if (byteorder == -1) { - /* force LE */ - ihi = 1; - ilo = 0; - } - else if (byteorder == 1) { - /* force BE */ - ihi = 0; - ilo = 1; - } - - while (size-- > 0) { - Py_UNICODE ch = *s++; - Py_UNICODE ch2 = 0; -#ifdef Py_UNICODE_WIDE - if (ch >= 0x10000) { - ch2 = 0xDC00 | ((ch-0x10000) & 0x3FF); - ch = 0xD800 | ((ch-0x10000) >> 10); - } -#endif - STORECHAR(ch); - if (ch2) - STORECHAR(ch2); - } - return v; -#undef STORECHAR -} - -PyObject *PyUnicode_AsUTF16String(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeUTF16(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL, - 0); -} - -/* --- Unicode Escape Codec ----------------------------------------------- */ - -static _PyUnicode_Name_CAPI *ucnhash_CAPI = NULL; - -PyObject *PyUnicode_DecodeUnicodeEscape(const char *s, - Py_ssize_t size, - const char *errors) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - PyUnicodeObject *v; - Py_UNICODE *p; - const char *end; - char* message; - Py_UCS4 chr = 0xffffffff; /* in case 'getcode' messes up */ - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - /* Escaped strings will always be longer than the resulting - Unicode string, so we start with size here and then reduce the - length after conversion to the true value. - (but if the error callback returns a long replacement string - we'll have to allocate more space) */ - v = _PyUnicode_New(size); - if (v == NULL) - goto onError; - if (size == 0) - return (PyObject *)v; - - p = PyUnicode_AS_UNICODE(v); - end = s + size; - - while (s < end) { - unsigned char c; - Py_UNICODE x; - int digits; - - /* Non-escape characters are interpreted as Unicode ordinals */ - if (*s != '\\') { - *p++ = (unsigned char) *s++; - continue; - } - - startinpos = s-starts; - /* \ - Escapes */ - s++; - c = *s++; - if (s > end) - c = '\0'; /* Invalid after \ */ - switch (c) { - - /* \x escapes */ - case '\n': break; - case '\\': *p++ = '\\'; break; - case '\'': *p++ = '\''; break; - case '\"': *p++ = '\"'; break; - case 'b': *p++ = '\b'; break; - case 'f': *p++ = '\014'; break; /* FF */ - case 't': *p++ = '\t'; break; - case 'n': *p++ = '\n'; break; - case 'r': *p++ = '\r'; break; - case 'v': *p++ = '\013'; break; /* VT */ - case 'a': *p++ = '\007'; break; /* BEL, not classic C */ - - /* \OOO (octal) escapes */ - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - x = s[-1] - '0'; - if (s < end && '0' <= *s && *s <= '7') { - x = (x<<3) + *s++ - '0'; - if (s < end && '0' <= *s && *s <= '7') - x = (x<<3) + *s++ - '0'; - } - *p++ = x; - break; - - /* hex escapes */ - /* \xXX */ - case 'x': - digits = 2; - message = "truncated \\xXX escape"; - goto hexescape; - - /* \uXXXX */ - case 'u': - digits = 4; - message = "truncated \\uXXXX escape"; - goto hexescape; - - /* \UXXXXXXXX */ - case 'U': - digits = 8; - message = "truncated \\UXXXXXXXX escape"; - hexescape: - chr = 0; - if (end - s < digits) { - /* count only hex digits */ - for (; s < end; ++s) { - c = (unsigned char)*s; - if (!Py_ISXDIGIT(c)) - goto error; - } - goto error; - } - for (; digits--; ++s) { - c = (unsigned char)*s; - if (!Py_ISXDIGIT(c)) - goto error; - chr = (chr<<4) & ~0xF; - if (c >= '0' && c <= '9') - chr += c - '0'; - else if (c >= 'a' && c <= 'f') - chr += 10 + c - 'a'; - else - chr += 10 + c - 'A'; - } - if (chr == 0xffffffff && PyErr_Occurred()) - /* _decoding_error will have already written into the - target buffer. */ - break; - store: - /* when we get here, chr is a 32-bit unicode character */ - if (chr <= 0xffff) - /* UCS-2 character */ - *p++ = (Py_UNICODE) chr; - else if (chr <= 0x10ffff) { - /* UCS-4 character. Either store directly, or as - surrogate pair. */ -#ifdef Py_UNICODE_WIDE - *p++ = chr; -#else - chr -= 0x10000L; - *p++ = 0xD800 + (Py_UNICODE) (chr >> 10); - *p++ = 0xDC00 + (Py_UNICODE) (chr & 0x03FF); -#endif - } else { - message = "illegal Unicode character"; - goto error; - } - break; - - /* \N{name} */ - case 'N': - message = "malformed \\N character escape"; - if (ucnhash_CAPI == NULL) { - /* load the unicode data module */ - ucnhash_CAPI = (_PyUnicode_Name_CAPI *)PyCapsule_Import(PyUnicodeData_CAPSULE_NAME, 1); - if (ucnhash_CAPI == NULL) - goto ucnhashError; - } - if (*s == '{') { - const char *start = s+1; - /* look for the closing brace */ - while (*s != '}' && s < end) - s++; - if (s > start && s < end && *s == '}') { - /* found a name. look it up in the unicode database */ - message = "unknown Unicode character name"; - s++; - if (s - start - 1 <= INT_MAX && - ucnhash_CAPI->getcode(NULL, start, (int)(s-start-1), &chr)) - goto store; - } - } - goto error; - - default: - if (s > end) { - message = "\\ at end of string"; - s--; - goto error; - } - else { - *p++ = '\\'; - *p++ = (unsigned char)s[-1]; - } - break; - } - continue; - - error: - endinpos = s-starts; - outpos = p-PyUnicode_AS_UNICODE(v); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicodeescape", message, - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; - continue; - } - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)v; - - ucnhashError: - PyErr_SetString( - PyExc_UnicodeError, - "\\N escapes not supported (can't load unicodedata module)" - ); - Py_XDECREF(v); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; - - onError: - Py_XDECREF(v); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -/* Return a Unicode-Escape string version of the Unicode object. - - If quotes is true, the string is enclosed in u"" or u'' quotes as - appropriate. - -*/ - -Py_LOCAL_INLINE(const Py_UNICODE *) findchar(const Py_UNICODE *s, - Py_ssize_t size, - Py_UNICODE ch) -{ - /* like wcschr, but doesn't stop at NULL characters */ - - while (size-- > 0) { - if (*s == ch) - return s; - s++; - } - - return NULL; -} - -static -PyObject *unicodeescape_string(const Py_UNICODE *s, - Py_ssize_t size, - int quotes) -{ - PyObject *repr; - char *p; - - static const char *hexdigit = "0123456789abcdef"; -#ifdef Py_UNICODE_WIDE - const Py_ssize_t expandsize = 10; -#else - const Py_ssize_t expandsize = 6; -#endif - - /* XXX(nnorwitz): rather than over-allocating, it would be - better to choose a different scheme. Perhaps scan the - first N-chars of the string and allocate based on that size. - */ - /* Initial allocation is based on the longest-possible unichr - escape. - - In wide (UTF-32) builds '\U00xxxxxx' is 10 chars per source - unichr, so in this case it's the longest unichr escape. In - narrow (UTF-16) builds this is five chars per source unichr - since there are two unichrs in the surrogate pair, so in narrow - (UTF-16) builds it's not the longest unichr escape. - - In wide or narrow builds '\uxxxx' is 6 chars per source unichr, - so in the narrow (UTF-16) build case it's the longest unichr - escape. - */ - - if (size > (PY_SSIZE_T_MAX - 2 - 1) / expandsize) - return PyErr_NoMemory(); - - repr = PyString_FromStringAndSize(NULL, - 2 - + expandsize*size - + 1); - if (repr == NULL) - return NULL; - - p = PyString_AS_STRING(repr); - - if (quotes) { - *p++ = 'u'; - *p++ = (findchar(s, size, '\'') && - !findchar(s, size, '"')) ? '"' : '\''; - } - while (size-- > 0) { - Py_UNICODE ch = *s++; - - /* Escape quotes and backslashes */ - if ((quotes && - ch == (Py_UNICODE) PyString_AS_STRING(repr)[1]) || ch == '\\') { - *p++ = '\\'; - *p++ = (char) ch; - continue; - } - -#ifdef Py_UNICODE_WIDE - /* Map 21-bit characters to '\U00xxxxxx' */ - else if (ch >= 0x10000) { - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigit[(ch >> 28) & 0x0000000F]; - *p++ = hexdigit[(ch >> 24) & 0x0000000F]; - *p++ = hexdigit[(ch >> 20) & 0x0000000F]; - *p++ = hexdigit[(ch >> 16) & 0x0000000F]; - *p++ = hexdigit[(ch >> 12) & 0x0000000F]; - *p++ = hexdigit[(ch >> 8) & 0x0000000F]; - *p++ = hexdigit[(ch >> 4) & 0x0000000F]; - *p++ = hexdigit[ch & 0x0000000F]; - continue; - } -#else - /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ - else if (ch >= 0xD800 && ch < 0xDC00) { - Py_UNICODE ch2; - Py_UCS4 ucs; - - ch2 = *s++; - size--; - if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { - ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigit[(ucs >> 28) & 0x0000000F]; - *p++ = hexdigit[(ucs >> 24) & 0x0000000F]; - *p++ = hexdigit[(ucs >> 20) & 0x0000000F]; - *p++ = hexdigit[(ucs >> 16) & 0x0000000F]; - *p++ = hexdigit[(ucs >> 12) & 0x0000000F]; - *p++ = hexdigit[(ucs >> 8) & 0x0000000F]; - *p++ = hexdigit[(ucs >> 4) & 0x0000000F]; - *p++ = hexdigit[ucs & 0x0000000F]; - continue; - } - /* Fall through: isolated surrogates are copied as-is */ - s--; - size++; - } -#endif - - /* Map 16-bit characters to '\uxxxx' */ - if (ch >= 256) { - *p++ = '\\'; - *p++ = 'u'; - *p++ = hexdigit[(ch >> 12) & 0x000F]; - *p++ = hexdigit[(ch >> 8) & 0x000F]; - *p++ = hexdigit[(ch >> 4) & 0x000F]; - *p++ = hexdigit[ch & 0x000F]; - } - - /* Map special whitespace to '\t', \n', '\r' */ - else if (ch == '\t') { - *p++ = '\\'; - *p++ = 't'; - } - else if (ch == '\n') { - *p++ = '\\'; - *p++ = 'n'; - } - else if (ch == '\r') { - *p++ = '\\'; - *p++ = 'r'; - } - - /* Map non-printable US ASCII to '\xhh' */ - else if (ch < ' ' || ch >= 0x7F) { - *p++ = '\\'; - *p++ = 'x'; - *p++ = hexdigit[(ch >> 4) & 0x000F]; - *p++ = hexdigit[ch & 0x000F]; - } - - /* Copy everything else as-is */ - else - *p++ = (char) ch; - } - if (quotes) - *p++ = PyString_AS_STRING(repr)[1]; - - *p = '\0'; - if (_PyString_Resize(&repr, p - PyString_AS_STRING(repr))) - return NULL; - return repr; -} - -PyObject *PyUnicode_EncodeUnicodeEscape(const Py_UNICODE *s, - Py_ssize_t size) -{ - return unicodeescape_string(s, size, 0); -} - -PyObject *PyUnicode_AsUnicodeEscapeString(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeUnicodeEscape(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode)); -} - -/* --- Raw Unicode Escape Codec ------------------------------------------- */ - -PyObject *PyUnicode_DecodeRawUnicodeEscape(const char *s, - Py_ssize_t size, - const char *errors) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - PyUnicodeObject *v; - Py_UNICODE *p; - const char *end; - const char *bs; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - /* Escaped strings will always be longer than the resulting - Unicode string, so we start with size here and then reduce the - length after conversion to the true value. (But decoding error - handler might have to resize the string) */ - v = _PyUnicode_New(size); - if (v == NULL) - goto onError; - if (size == 0) - return (PyObject *)v; - p = PyUnicode_AS_UNICODE(v); - end = s + size; - while (s < end) { - unsigned char c; - Py_UCS4 x; - int i; - int count; - - /* Non-escape characters are interpreted as Unicode ordinals */ - if (*s != '\\') { - *p++ = (unsigned char)*s++; - continue; - } - startinpos = s-starts; - - /* \u-escapes are only interpreted iff the number of leading - backslashes if odd */ - bs = s; - for (;s < end;) { - if (*s != '\\') - break; - *p++ = (unsigned char)*s++; - } - if (((s - bs) & 1) == 0 || - s >= end || - (*s != 'u' && *s != 'U')) { - continue; - } - p--; - count = *s=='u' ? 4 : 8; - s++; - - /* \uXXXX with 4 hex digits, \Uxxxxxxxx with 8 */ - outpos = p-PyUnicode_AS_UNICODE(v); - for (x = 0, i = 0; i < count; ++i, ++s) { - c = (unsigned char)*s; - if (!isxdigit(c)) { - endinpos = s-starts; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "rawunicodeescape", "truncated \\uXXXX", - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; - goto nextByte; - } - x = (x<<4) & ~0xF; - if (c >= '0' && c <= '9') - x += c - '0'; - else if (c >= 'a' && c <= 'f') - x += 10 + c - 'a'; - else - x += 10 + c - 'A'; - } - if (x <= 0xffff) - /* UCS-2 character */ - *p++ = (Py_UNICODE) x; - else if (x <= 0x10ffff) { - /* UCS-4 character. Either store directly, or as - surrogate pair. */ -#ifdef Py_UNICODE_WIDE - *p++ = (Py_UNICODE) x; -#else - x -= 0x10000L; - *p++ = 0xD800 + (Py_UNICODE) (x >> 10); - *p++ = 0xDC00 + (Py_UNICODE) (x & 0x03FF); -#endif - } else { - endinpos = s-starts; - outpos = p-PyUnicode_AS_UNICODE(v); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "rawunicodeescape", "\\Uxxxxxxxx out of range", - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; - } - nextByte: - ; - } - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)v; - - onError: - Py_XDECREF(v); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -PyObject *PyUnicode_EncodeRawUnicodeEscape(const Py_UNICODE *s, - Py_ssize_t size) -{ - PyObject *repr; - char *p; - char *q; - - static const char *hexdigit = "0123456789abcdef"; -#ifdef Py_UNICODE_WIDE - const Py_ssize_t expandsize = 10; -#else - const Py_ssize_t expandsize = 6; -#endif - - if (size > PY_SSIZE_T_MAX / expandsize) - return PyErr_NoMemory(); - - repr = PyString_FromStringAndSize(NULL, expandsize * size); - if (repr == NULL) - return NULL; - if (size == 0) - return repr; - - p = q = PyString_AS_STRING(repr); - while (size-- > 0) { - Py_UNICODE ch = *s++; -#ifdef Py_UNICODE_WIDE - /* Map 32-bit characters to '\Uxxxxxxxx' */ - if (ch >= 0x10000) { - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigit[(ch >> 28) & 0xf]; - *p++ = hexdigit[(ch >> 24) & 0xf]; - *p++ = hexdigit[(ch >> 20) & 0xf]; - *p++ = hexdigit[(ch >> 16) & 0xf]; - *p++ = hexdigit[(ch >> 12) & 0xf]; - *p++ = hexdigit[(ch >> 8) & 0xf]; - *p++ = hexdigit[(ch >> 4) & 0xf]; - *p++ = hexdigit[ch & 15]; - } - else -#else - /* Map UTF-16 surrogate pairs to '\U00xxxxxx' */ - if (ch >= 0xD800 && ch < 0xDC00) { - Py_UNICODE ch2; - Py_UCS4 ucs; - - ch2 = *s++; - size--; - if (ch2 >= 0xDC00 && ch2 <= 0xDFFF) { - ucs = (((ch & 0x03FF) << 10) | (ch2 & 0x03FF)) + 0x00010000; - *p++ = '\\'; - *p++ = 'U'; - *p++ = hexdigit[(ucs >> 28) & 0xf]; - *p++ = hexdigit[(ucs >> 24) & 0xf]; - *p++ = hexdigit[(ucs >> 20) & 0xf]; - *p++ = hexdigit[(ucs >> 16) & 0xf]; - *p++ = hexdigit[(ucs >> 12) & 0xf]; - *p++ = hexdigit[(ucs >> 8) & 0xf]; - *p++ = hexdigit[(ucs >> 4) & 0xf]; - *p++ = hexdigit[ucs & 0xf]; - continue; - } - /* Fall through: isolated surrogates are copied as-is */ - s--; - size++; - } -#endif - /* Map 16-bit characters to '\uxxxx' */ - if (ch >= 256) { - *p++ = '\\'; - *p++ = 'u'; - *p++ = hexdigit[(ch >> 12) & 0xf]; - *p++ = hexdigit[(ch >> 8) & 0xf]; - *p++ = hexdigit[(ch >> 4) & 0xf]; - *p++ = hexdigit[ch & 15]; - } - /* Copy everything else as-is */ - else - *p++ = (char) ch; - } - *p = '\0'; - if (_PyString_Resize(&repr, p - q)) - return NULL; - return repr; -} - -PyObject *PyUnicode_AsRawUnicodeEscapeString(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeRawUnicodeEscape(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode)); -} - -/* --- Unicode Internal Codec ------------------------------------------- */ - -PyObject *_PyUnicode_DecodeUnicodeInternal(const char *s, - Py_ssize_t size, - const char *errors) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - PyUnicodeObject *v; - Py_UNICODE *p; - const char *end; - const char *reason; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - -#ifdef Py_UNICODE_WIDE - Py_UNICODE unimax = PyUnicode_GetMax(); -#endif - - /* XXX overflow detection missing */ - v = _PyUnicode_New((size+Py_UNICODE_SIZE-1)/ Py_UNICODE_SIZE); - if (v == NULL) - goto onError; - if (PyUnicode_GetSize((PyObject *)v) == 0) - return (PyObject *)v; - p = PyUnicode_AS_UNICODE(v); - end = s + size; - - while (s < end) { - if (end-s < Py_UNICODE_SIZE) { - endinpos = end-starts; - reason = "truncated input"; - goto error; - } - memcpy(p, s, sizeof(Py_UNICODE)); -#ifdef Py_UNICODE_WIDE - /* We have to sanity check the raw data, otherwise doom looms for - some malformed UCS-4 data. */ - if (*p > unimax || *p < 0) { - endinpos = s - starts + Py_UNICODE_SIZE; - reason = "illegal code point (> 0x10FFFF)"; - goto error; - } -#endif - p++; - s += Py_UNICODE_SIZE; - continue; - - error: - startinpos = s - starts; - outpos = p - PyUnicode_AS_UNICODE(v); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "unicode_internal", reason, - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) { - goto onError; - } - } - - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)v; - - onError: - Py_XDECREF(v); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -/* --- Latin-1 Codec ------------------------------------------------------ */ - -PyObject *PyUnicode_DecodeLatin1(const char *s, - Py_ssize_t size, - const char *errors) -{ - PyUnicodeObject *v; - Py_UNICODE *p; - - /* Latin-1 is equivalent to the first 256 ordinals in Unicode. */ - if (size == 1) { - Py_UNICODE r = *(unsigned char*)s; - return PyUnicode_FromUnicode(&r, 1); - } - - v = _PyUnicode_New(size); - if (v == NULL) - goto onError; - if (size == 0) - return (PyObject *)v; - p = PyUnicode_AS_UNICODE(v); - while (size-- > 0) - *p++ = (unsigned char)*s++; - return (PyObject *)v; - - onError: - Py_XDECREF(v); - return NULL; -} - -/* create or adjust a UnicodeEncodeError */ -static void make_encode_exception(PyObject **exceptionObject, - const char *encoding, - const Py_UNICODE *unicode, Py_ssize_t size, - Py_ssize_t startpos, Py_ssize_t endpos, - const char *reason) -{ - if (*exceptionObject == NULL) { - *exceptionObject = PyUnicodeEncodeError_Create( - encoding, unicode, size, startpos, endpos, reason); - } - else { - if (PyUnicodeEncodeError_SetStart(*exceptionObject, startpos)) - goto onError; - if (PyUnicodeEncodeError_SetEnd(*exceptionObject, endpos)) - goto onError; - if (PyUnicodeEncodeError_SetReason(*exceptionObject, reason)) - goto onError; - return; - onError: - Py_CLEAR(*exceptionObject); - } -} - -/* raises a UnicodeEncodeError */ -static void raise_encode_exception(PyObject **exceptionObject, - const char *encoding, - const Py_UNICODE *unicode, Py_ssize_t size, - Py_ssize_t startpos, Py_ssize_t endpos, - const char *reason) -{ - make_encode_exception(exceptionObject, - encoding, unicode, size, startpos, endpos, reason); - if (*exceptionObject != NULL) - PyCodec_StrictErrors(*exceptionObject); -} - -/* error handling callback helper: - build arguments, call the callback and check the arguments, - put the result into newpos and return the replacement string, which - has to be freed by the caller */ -static PyObject *unicode_encode_call_errorhandler(const char *errors, - PyObject **errorHandler, - const char *encoding, const char *reason, - const Py_UNICODE *unicode, Py_ssize_t size, PyObject **exceptionObject, - Py_ssize_t startpos, Py_ssize_t endpos, - Py_ssize_t *newpos) -{ - static char *argparse = "O!n;encoding error handler must return (unicode, int) tuple"; - - PyObject *restuple; - PyObject *resunicode; - - if (*errorHandler == NULL) { - *errorHandler = PyCodec_LookupError(errors); - if (*errorHandler == NULL) - return NULL; - } - - make_encode_exception(exceptionObject, - encoding, unicode, size, startpos, endpos, reason); - if (*exceptionObject == NULL) - return NULL; - - restuple = PyObject_CallFunctionObjArgs( - *errorHandler, *exceptionObject, NULL); - if (restuple == NULL) - return NULL; - if (!PyTuple_Check(restuple)) { - PyErr_SetString(PyExc_TypeError, &argparse[4]); - Py_DECREF(restuple); - return NULL; - } - if (!PyArg_ParseTuple(restuple, argparse, &PyUnicode_Type, - &resunicode, newpos)) { - Py_DECREF(restuple); - return NULL; - } - if (*newpos<0) - *newpos = size+*newpos; - if (*newpos<0 || *newpos>size) { - PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", *newpos); - Py_DECREF(restuple); - return NULL; - } - Py_INCREF(resunicode); - Py_DECREF(restuple); - return resunicode; -} - -static PyObject *unicode_encode_ucs1(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors, - int limit) -{ - /* output object */ - PyObject *res; - /* pointers to the beginning and end+1 of input */ - const Py_UNICODE *startp = p; - const Py_UNICODE *endp = p + size; - /* pointer to the beginning of the unencodable characters */ - /* const Py_UNICODE *badp = NULL; */ - /* pointer into the output */ - char *str; - /* current output position */ - Py_ssize_t respos = 0; - Py_ssize_t ressize; - const char *encoding = (limit == 256) ? "latin-1" : "ascii"; - const char *reason = (limit == 256) ? "ordinal not in range(256)" : "ordinal not in range(128)"; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - /* the following variable is used for caching string comparisons - * -1=not initialized, 0=unknown, 1=strict, 2=replace, 3=ignore, 4=xmlcharrefreplace */ - int known_errorHandler = -1; - - /* allocate enough for a simple encoding without - replacements, if we need more, we'll resize */ - res = PyString_FromStringAndSize(NULL, size); - if (res == NULL) - goto onError; - if (size == 0) - return res; - str = PyString_AS_STRING(res); - ressize = size; - - while (p= limit)) - ++collend; - /* cache callback name lookup (if not done yet, i.e. it's the first error) */ - if (known_errorHandler==-1) { - if ((errors==NULL) || (!strcmp(errors, "strict"))) - known_errorHandler = 1; - else if (!strcmp(errors, "replace")) - known_errorHandler = 2; - else if (!strcmp(errors, "ignore")) - known_errorHandler = 3; - else if (!strcmp(errors, "xmlcharrefreplace")) - known_errorHandler = 4; - else - known_errorHandler = 0; - } - switch (known_errorHandler) { - case 1: /* strict */ - raise_encode_exception(&exc, encoding, startp, size, collstart-startp, collend-startp, reason); - goto onError; - case 2: /* replace */ - while (collstart++ < collend) - *str++ = '?'; /* fall through */ - case 3: /* ignore */ - p = collend; - break; - case 4: /* xmlcharrefreplace */ - respos = str - PyString_AS_STRING(res); - /* determine replacement size (temporarily (mis)uses p) */ - requiredsize = respos; - for (p = collstart; p < collend;) { - Py_UCS4 ch = _Py_UNICODE_NEXT(p, collend); - Py_ssize_t incr; - if (ch < 10) - incr = 2+1+1; - else if (ch < 100) - incr = 2+2+1; - else if (ch < 1000) - incr = 2+3+1; - else if (ch < 10000) - incr = 2+4+1; - else if (ch < 100000) - incr = 2+5+1; - else if (ch < 1000000) - incr = 2+6+1; - else - incr = 2+7+1; - if (requiredsize > PY_SSIZE_T_MAX - incr) - goto overflow; - requiredsize += incr; - } - if (requiredsize > PY_SSIZE_T_MAX - (endp - collend)) - goto overflow; - requiredsize += endp - collend; - if (requiredsize > ressize) { - if (ressize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*ressize) - requiredsize = 2*ressize; - if (_PyString_Resize(&res, requiredsize)) - goto onError; - str = PyString_AS_STRING(res) + respos; - ressize = requiredsize; - } - /* generate replacement (temporarily (mis)uses p) */ - for (p = collstart; p < collend;) { - Py_UCS4 ch = _Py_UNICODE_NEXT(p, collend); - str += sprintf(str, "&#%d;", (int)ch); - } - p = collend; - break; - default: - repunicode = unicode_encode_call_errorhandler(errors, &errorHandler, - encoding, reason, startp, size, &exc, - collstart-startp, collend-startp, &newpos); - if (repunicode == NULL) - goto onError; - /* need more space? (at least enough for what we have+the - replacement+the rest of the string, so we won't have to - check space for encodable characters) */ - respos = str - PyString_AS_STRING(res); - repsize = PyUnicode_GET_SIZE(repunicode); - if (respos > PY_SSIZE_T_MAX - repsize) - goto overflow; - requiredsize = respos + repsize; - if (requiredsize > PY_SSIZE_T_MAX - (endp - collend)) - goto overflow; - requiredsize += endp - collend; - if (requiredsize > ressize) { - if (ressize <= PY_SSIZE_T_MAX/2 && requiredsize < 2*ressize) - requiredsize = 2*ressize; - if (_PyString_Resize(&res, requiredsize)) { - Py_DECREF(repunicode); - goto onError; - } - str = PyString_AS_STRING(res) + respos; - ressize = requiredsize; - } - /* check if there is anything unencodable in the replacement - and copy it to the output */ - for (uni2 = PyUnicode_AS_UNICODE(repunicode); repsize-->0; ++uni2, ++str) { - c = *uni2; - if (c >= limit) { - raise_encode_exception(&exc, encoding, startp, size, - unicodepos, unicodepos+1, reason); - Py_DECREF(repunicode); - goto onError; - } - *str = (char)c; - } - p = startp + newpos; - Py_DECREF(repunicode); - } - } - } - /* Resize if we allocated to much */ - respos = str - PyString_AS_STRING(res); - if (respos < ressize) - /* If this falls res will be NULL */ - _PyString_Resize(&res, respos); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return res; - - overflow: - PyErr_SetString(PyExc_OverflowError, - "encoded result is too long for a Python string"); - - onError: - Py_XDECREF(res); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -PyObject *PyUnicode_EncodeLatin1(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors) -{ - return unicode_encode_ucs1(p, size, errors, 256); -} - -PyObject *PyUnicode_AsLatin1String(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeLatin1(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); -} - -/* --- 7-bit ASCII Codec -------------------------------------------------- */ - -PyObject *PyUnicode_DecodeASCII(const char *s, - Py_ssize_t size, - const char *errors) -{ - const char *starts = s; - PyUnicodeObject *v; - Py_UNICODE *p; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - const char *e; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - - /* ASCII is equivalent to the first 128 ordinals in Unicode. */ - if (size == 1 && *(unsigned char*)s < 128) { - Py_UNICODE r = *(unsigned char*)s; - return PyUnicode_FromUnicode(&r, 1); - } - - v = _PyUnicode_New(size); - if (v == NULL) - goto onError; - if (size == 0) - return (PyObject *)v; - p = PyUnicode_AS_UNICODE(v); - e = s + size; - while (s < e) { - register unsigned char c = (unsigned char)*s; - if (c < 128) { - *p++ = c; - ++s; - } - else { - startinpos = s-starts; - endinpos = startinpos + 1; - outpos = p - (Py_UNICODE *)PyUnicode_AS_UNICODE(v); - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "ascii", "ordinal not in range(128)", - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) - goto onError; - } - } - if (p - PyUnicode_AS_UNICODE(v) < PyString_GET_SIZE(v)) - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)v; - - onError: - Py_XDECREF(v); - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return NULL; -} - -PyObject *PyUnicode_EncodeASCII(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors) -{ - return unicode_encode_ucs1(p, size, errors, 128); -} - -PyObject *PyUnicode_AsASCIIString(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeASCII(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); -} - -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) - -/* --- MBCS codecs for Windows -------------------------------------------- */ - -#if SIZEOF_INT < SIZEOF_SIZE_T -#define NEED_RETRY -#endif - -/* XXX This code is limited to "true" double-byte encodings, as - a) it assumes an incomplete character consists of a single byte, and - b) IsDBCSLeadByte (probably) does not work for non-DBCS multi-byte - encodings, see IsDBCSLeadByteEx documentation. */ - -static int is_dbcs_lead_byte(const char *s, int offset) -{ - const char *curr = s + offset; - - if (IsDBCSLeadByte(*curr)) { - const char *prev = CharPrev(s, curr); - return (prev == curr) || !IsDBCSLeadByte(*prev) || (curr - prev == 2); - } - return 0; -} - -/* - * Decode MBCS string into unicode object. If 'final' is set, converts - * trailing lead-byte too. Returns consumed size if succeed, -1 otherwise. - */ -static int decode_mbcs(PyUnicodeObject **v, - const char *s, /* MBCS string */ - int size, /* sizeof MBCS string */ - int final) -{ - Py_UNICODE *p; - Py_ssize_t n = 0; - int usize = 0; - - assert(size >= 0); - - /* Skip trailing lead-byte unless 'final' is set */ - if (!final && size >= 1 && is_dbcs_lead_byte(s, size - 1)) - --size; - - /* First get the size of the result */ - if (size > 0) { - usize = MultiByteToWideChar(CP_ACP, 0, s, size, NULL, 0); - if (usize == 0) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } - } - - if (*v == NULL) { - /* Create unicode object */ - *v = _PyUnicode_New(usize); - if (*v == NULL) - return -1; - } - else { - /* Extend unicode object */ - n = PyUnicode_GET_SIZE(*v); - if (_PyUnicode_Resize(v, n + usize) < 0) - return -1; - } - - /* Do the conversion */ - if (size > 0) { - p = PyUnicode_AS_UNICODE(*v) + n; - if (0 == MultiByteToWideChar(CP_ACP, 0, s, size, p, usize)) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } - } - - return size; -} - -PyObject *PyUnicode_DecodeMBCSStateful(const char *s, - Py_ssize_t size, - const char *errors, - Py_ssize_t *consumed) -{ - PyUnicodeObject *v = NULL; - int done; - - if (consumed) - *consumed = 0; - -#ifdef NEED_RETRY - retry: - if (size > INT_MAX) - done = decode_mbcs(&v, s, INT_MAX, 0); - else -#endif - done = decode_mbcs(&v, s, (int)size, !consumed); - - if (done < 0) { - Py_XDECREF(v); - return NULL; - } - - if (consumed) - *consumed += done; - -#ifdef NEED_RETRY - if (size > INT_MAX) { - s += done; - size -= done; - goto retry; - } -#endif - - return (PyObject *)v; -} - -PyObject *PyUnicode_DecodeMBCS(const char *s, - Py_ssize_t size, - const char *errors) -{ - return PyUnicode_DecodeMBCSStateful(s, size, errors, NULL); -} - -/* - * Convert unicode into string object (MBCS). - * Returns 0 if succeed, -1 otherwise. - */ -static int encode_mbcs(PyObject **repr, - const Py_UNICODE *p, /* unicode */ - int size) /* size of unicode */ -{ - int mbcssize = 0; - Py_ssize_t n = 0; - - assert(size >= 0); - - /* First get the size of the result */ - if (size > 0) { - mbcssize = WideCharToMultiByte(CP_ACP, 0, p, size, NULL, 0, NULL, NULL); - if (mbcssize == 0) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } - } - - if (*repr == NULL) { - /* Create string object */ - *repr = PyString_FromStringAndSize(NULL, mbcssize); - if (*repr == NULL) - return -1; - } - else { - /* Extend string object */ - n = PyString_Size(*repr); - if (_PyString_Resize(repr, n + mbcssize) < 0) - return -1; - } - - /* Do the conversion */ - if (size > 0) { - char *s = PyString_AS_STRING(*repr) + n; - if (0 == WideCharToMultiByte(CP_ACP, 0, p, size, s, mbcssize, NULL, NULL)) { - PyErr_SetFromWindowsErrWithFilename(0, NULL); - return -1; - } - } - - return 0; -} - -PyObject *PyUnicode_EncodeMBCS(const Py_UNICODE *p, - Py_ssize_t size, - const char *errors) -{ - PyObject *repr = NULL; - int ret; - -#ifdef NEED_RETRY - retry: - if (size > INT_MAX) - ret = encode_mbcs(&repr, p, INT_MAX); - else -#endif - ret = encode_mbcs(&repr, p, (int)size); - - if (ret < 0) { - Py_XDECREF(repr); - return NULL; - } - -#ifdef NEED_RETRY - if (size > INT_MAX) { - p += INT_MAX; - size -= INT_MAX; - goto retry; - } -#endif - - return repr; -} - -PyObject *PyUnicode_AsMBCSString(PyObject *unicode) -{ - if (!PyUnicode_Check(unicode)) { - PyErr_BadArgument(); - return NULL; - } - return PyUnicode_EncodeMBCS(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - NULL); -} - -#undef NEED_RETRY - -#endif /* MS_WINDOWS */ - -/* --- Character Mapping Codec -------------------------------------------- */ - -PyObject *PyUnicode_DecodeCharmap(const char *s, - Py_ssize_t size, - PyObject *mapping, - const char *errors) -{ - const char *starts = s; - Py_ssize_t startinpos; - Py_ssize_t endinpos; - Py_ssize_t outpos; - const char *e; - PyUnicodeObject *v; - Py_UNICODE *p; - Py_ssize_t extrachars = 0; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - Py_UNICODE *mapstring = NULL; - Py_ssize_t maplen = 0; - - /* Default to Latin-1 */ - if (mapping == NULL) - return PyUnicode_DecodeLatin1(s, size, errors); - - v = _PyUnicode_New(size); - if (v == NULL) - goto onError; - if (size == 0) - return (PyObject *)v; - p = PyUnicode_AS_UNICODE(v); - e = s + size; - if (PyUnicode_CheckExact(mapping)) { - mapstring = PyUnicode_AS_UNICODE(mapping); - maplen = PyUnicode_GET_SIZE(mapping); - while (s < e) { - unsigned char ch = *s; - Py_UNICODE x = 0xfffe; /* illegal value */ - - if (ch < maplen) - x = mapstring[ch]; - - if (x == 0xfffe) { - /* undefined mapping */ - outpos = p-PyUnicode_AS_UNICODE(v); - startinpos = s-starts; - endinpos = startinpos+1; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "charmap", "character maps to ", - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) { - goto onError; - } - continue; - } - *p++ = x; - ++s; - } - } - else { - while (s < e) { - unsigned char ch = *s; - PyObject *w, *x; - - /* Get mapping (char ordinal -> integer, Unicode char or None) */ - w = PyInt_FromLong((long)ch); - if (w == NULL) - goto onError; - x = PyObject_GetItem(mapping, w); - Py_DECREF(w); - if (x == NULL) { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - /* No mapping found means: mapping is undefined. */ - PyErr_Clear(); - goto Undefined; - } else - goto onError; - } - - /* Apply mapping */ - if (x == Py_None) - goto Undefined; - if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); - if (value == 0xFFFE) - goto Undefined; - if (value < 0 || value > 0x10FFFF) { - PyErr_SetString(PyExc_TypeError, - "character mapping must be in range(0x110000)"); - Py_DECREF(x); - goto onError; - } - -#ifndef Py_UNICODE_WIDE - if (value > 0xFFFF) { - /* see the code for 1-n mapping below */ - if (extrachars < 2) { - /* resize first */ - Py_ssize_t oldpos = p - PyUnicode_AS_UNICODE(v); - Py_ssize_t needed = 10 - extrachars; - extrachars += needed; - /* XXX overflow detection missing */ - if (_PyUnicode_Resize(&v, - PyUnicode_GET_SIZE(v) + needed) < 0) { - Py_DECREF(x); - goto onError; - } - p = PyUnicode_AS_UNICODE(v) + oldpos; - } - value -= 0x10000; - *p++ = 0xD800 | (value >> 10); - *p++ = 0xDC00 | (value & 0x3FF); - extrachars -= 2; - } - else -#endif - *p++ = (Py_UNICODE)value; - } - else if (PyUnicode_Check(x)) { - Py_ssize_t targetsize = PyUnicode_GET_SIZE(x); - - if (targetsize == 1) { - /* 1-1 mapping */ - Py_UNICODE value = *PyUnicode_AS_UNICODE(x); - if (value == 0xFFFE) - goto Undefined; - *p++ = value; - } - else if (targetsize > 1) { - /* 1-n mapping */ - if (targetsize > extrachars) { - /* resize first */ - Py_ssize_t oldpos = p - PyUnicode_AS_UNICODE(v); - Py_ssize_t needed = (targetsize - extrachars) + \ - (targetsize << 2); - extrachars += needed; - /* XXX overflow detection missing */ - if (_PyUnicode_Resize(&v, - PyUnicode_GET_SIZE(v) + needed) < 0) { - Py_DECREF(x); - goto onError; - } - p = PyUnicode_AS_UNICODE(v) + oldpos; - } - Py_UNICODE_COPY(p, - PyUnicode_AS_UNICODE(x), - targetsize); - p += targetsize; - extrachars -= targetsize; - } - /* 1-0 mapping: skip the character */ - } - else { - /* wrong return value */ - PyErr_SetString(PyExc_TypeError, - "character mapping must return integer, None or unicode"); - Py_DECREF(x); - goto onError; - } - Py_DECREF(x); - ++s; - continue; -Undefined: - /* undefined mapping */ - Py_XDECREF(x); - outpos = p-PyUnicode_AS_UNICODE(v); - startinpos = s-starts; - endinpos = startinpos+1; - if (unicode_decode_call_errorhandler( - errors, &errorHandler, - "charmap", "character maps to ", - starts, size, &startinpos, &endinpos, &exc, &s, - &v, &outpos, &p)) { - goto onError; - } - } - } - if (p - PyUnicode_AS_UNICODE(v) < PyUnicode_GET_SIZE(v)) - if (_PyUnicode_Resize(&v, p - PyUnicode_AS_UNICODE(v)) < 0) - goto onError; - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - return (PyObject *)v; - - onError: - Py_XDECREF(errorHandler); - Py_XDECREF(exc); - Py_XDECREF(v); - return NULL; -} - -/* Charmap encoding: the lookup table */ - -struct encoding_map{ - PyObject_HEAD - unsigned char level1[32]; - int count2, count3; - unsigned char level23[1]; -}; - -static PyObject* -encoding_map_size(PyObject *obj, PyObject* args) -{ - struct encoding_map *map = (struct encoding_map*)obj; - return PyInt_FromLong(sizeof(*map) - 1 + 16*map->count2 + - 128*map->count3); -} - -static PyMethodDef encoding_map_methods[] = { - {"size", encoding_map_size, METH_NOARGS, - PyDoc_STR("Return the size (in bytes) of this object") }, - { 0 } -}; - -static void -encoding_map_dealloc(PyObject* o) -{ - PyObject_FREE(o); -} - -static PyTypeObject EncodingMapType = { - PyVarObject_HEAD_INIT(NULL, 0) - "EncodingMap", /*tp_name*/ - sizeof(struct encoding_map), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - encoding_map_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - encoding_map_methods, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - 0, /*tp_init*/ - 0, /*tp_alloc*/ - 0, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ -}; - -PyObject* -PyUnicode_BuildEncodingMap(PyObject* string) -{ - Py_UNICODE *decode; - PyObject *result; - struct encoding_map *mresult; - int i; - int need_dict = 0; - unsigned char level1[32]; - unsigned char level2[512]; - unsigned char *mlevel1, *mlevel2, *mlevel3; - int count2 = 0, count3 = 0; - - if (!PyUnicode_Check(string) || PyUnicode_GetSize(string) != 256) { - PyErr_BadArgument(); - return NULL; - } - decode = PyUnicode_AS_UNICODE(string); - memset(level1, 0xFF, sizeof level1); - memset(level2, 0xFF, sizeof level2); - - /* If there isn't a one-to-one mapping of NULL to \0, - or if there are non-BMP characters, we need to use - a mapping dictionary. */ - if (decode[0] != 0) - need_dict = 1; - for (i = 1; i < 256; i++) { - int l1, l2; - if (decode[i] == 0 -#ifdef Py_UNICODE_WIDE - || decode[i] > 0xFFFF -#endif - ) { - need_dict = 1; - break; - } - if (decode[i] == 0xFFFE) - /* unmapped character */ - continue; - l1 = decode[i] >> 11; - l2 = decode[i] >> 7; - if (level1[l1] == 0xFF) - level1[l1] = count2++; - if (level2[l2] == 0xFF) - level2[l2] = count3++; - } - - if (count2 >= 0xFF || count3 >= 0xFF) - need_dict = 1; - - if (need_dict) { - PyObject *result = PyDict_New(); - PyObject *key, *value; - if (!result) - return NULL; - for (i = 0; i < 256; i++) { - value = NULL; - key = PyInt_FromLong(decode[i]); - value = PyInt_FromLong(i); - if (!key || !value) - goto failed1; - if (PyDict_SetItem(result, key, value) == -1) - goto failed1; - Py_DECREF(key); - Py_DECREF(value); - } - return result; - failed1: - Py_XDECREF(key); - Py_XDECREF(value); - Py_DECREF(result); - return NULL; - } - - /* Create a three-level trie */ - result = PyObject_MALLOC(sizeof(struct encoding_map) + - 16*count2 + 128*count3 - 1); - if (!result) - return PyErr_NoMemory(); - PyObject_Init(result, &EncodingMapType); - mresult = (struct encoding_map*)result; - mresult->count2 = count2; - mresult->count3 = count3; - mlevel1 = mresult->level1; - mlevel2 = mresult->level23; - mlevel3 = mresult->level23 + 16*count2; - memcpy(mlevel1, level1, 32); - memset(mlevel2, 0xFF, 16*count2); - memset(mlevel3, 0, 128*count3); - count3 = 0; - for (i = 1; i < 256; i++) { - int o1, o2, o3, i2, i3; - if (decode[i] == 0xFFFE) - /* unmapped character */ - continue; - o1 = decode[i]>>11; - o2 = (decode[i]>>7) & 0xF; - i2 = 16*mlevel1[o1] + o2; - if (mlevel2[i2] == 0xFF) - mlevel2[i2] = count3++; - o3 = decode[i] & 0x7F; - i3 = 128*mlevel2[i2] + o3; - mlevel3[i3] = i; - } - return result; -} - -static int -encoding_map_lookup(Py_UNICODE c, PyObject *mapping) -{ - struct encoding_map *map = (struct encoding_map*)mapping; - int l1 = c>>11; - int l2 = (c>>7) & 0xF; - int l3 = c & 0x7F; - int i; - -#ifdef Py_UNICODE_WIDE - if (c > 0xFFFF) { - return -1; - } -#endif - if (c == 0) - return 0; - /* level 1*/ - i = map->level1[l1]; - if (i == 0xFF) { - return -1; - } - /* level 2*/ - i = map->level23[16*i+l2]; - if (i == 0xFF) { - return -1; - } - /* level 3 */ - i = map->level23[16*map->count2 + 128*i + l3]; - if (i == 0) { - return -1; - } - return i; -} - -/* Lookup the character ch in the mapping. If the character - can't be found, Py_None is returned (or NULL, if another - error occurred). */ -static PyObject *charmapencode_lookup(Py_UNICODE c, PyObject *mapping) -{ - PyObject *w = PyInt_FromLong((long)c); - PyObject *x; - - if (w == NULL) - return NULL; - x = PyObject_GetItem(mapping, w); - Py_DECREF(w); - if (x == NULL) { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - /* No mapping found means: mapping is undefined. */ - PyErr_Clear(); - x = Py_None; - Py_INCREF(x); - return x; - } else - return NULL; - } - else if (x == Py_None) - return x; - else if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); - if (value < 0 || value > 255) { - PyErr_SetString(PyExc_TypeError, - "character mapping must be in range(256)"); - Py_DECREF(x); - return NULL; - } - return x; - } - else if (PyString_Check(x)) - return x; - else { - /* wrong return value */ - PyErr_SetString(PyExc_TypeError, - "character mapping must return integer, None or str"); - Py_DECREF(x); - return NULL; - } -} - -static int -charmapencode_resize(PyObject **outobj, Py_ssize_t *outpos, Py_ssize_t requiredsize) -{ - Py_ssize_t outsize = PyString_GET_SIZE(*outobj); - /* exponentially overallocate to minimize reallocations */ - if (requiredsize < 2*outsize) - requiredsize = 2*outsize; - if (_PyString_Resize(outobj, requiredsize)) { - return 0; - } - return 1; -} - -typedef enum charmapencode_result { - enc_SUCCESS, enc_FAILED, enc_EXCEPTION -}charmapencode_result; -/* lookup the character, put the result in the output string and adjust - various state variables. Reallocate the output string if not enough - space is available. Return a new reference to the object that - was put in the output buffer, or Py_None, if the mapping was undefined - (in which case no character was written) or NULL, if a - reallocation error occurred. The caller must decref the result */ -static -charmapencode_result charmapencode_output(Py_UNICODE c, PyObject *mapping, - PyObject **outobj, Py_ssize_t *outpos) -{ - PyObject *rep; - char *outstart; - Py_ssize_t outsize = PyString_GET_SIZE(*outobj); - - if (Py_TYPE(mapping) == &EncodingMapType) { - int res = encoding_map_lookup(c, mapping); - Py_ssize_t requiredsize = *outpos+1; - if (res == -1) - return enc_FAILED; - if (outsize0; ++uni2) { - x = charmapencode_output(*uni2, mapping, res, respos); - if (x==enc_EXCEPTION) { - return -1; - } - else if (x==enc_FAILED) { - Py_DECREF(repunicode); - raise_encode_exception(exceptionObject, encoding, p, size, collstartpos, collendpos, reason); - return -1; - } - } - *inpos = newpos; - Py_DECREF(repunicode); - } - return 0; -} - -PyObject *PyUnicode_EncodeCharmap(const Py_UNICODE *p, - Py_ssize_t size, - PyObject *mapping, - const char *errors) -{ - /* output object */ - PyObject *res = NULL; - /* current input position */ - Py_ssize_t inpos = 0; - /* current output position */ - Py_ssize_t respos = 0; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - /* the following variable is used for caching string comparisons - * -1=not initialized, 0=unknown, 1=strict, 2=replace, - * 3=ignore, 4=xmlcharrefreplace */ - int known_errorHandler = -1; - - /* Default to Latin-1 */ - if (mapping == NULL) - return PyUnicode_EncodeLatin1(p, size, errors); - - /* allocate enough for a simple encoding without - replacements, if we need more, we'll resize */ - res = PyString_FromStringAndSize(NULL, size); - if (res == NULL) - goto onError; - if (size == 0) - return res; - - while (inpos adjust input position */ - ++inpos; - } - - /* Resize if we allocated to much */ - if (respossize) { - PyErr_Format(PyExc_IndexError, "position %zd from error handler out of bounds", *newpos); - Py_DECREF(restuple); - return NULL; - } - Py_INCREF(resunicode); - Py_DECREF(restuple); - return resunicode; -} - -/* Lookup the character ch in the mapping and put the result in result, - which must be decrefed by the caller. - Return 0 on success, -1 on error */ -static -int charmaptranslate_lookup(Py_UNICODE c, PyObject *mapping, PyObject **result) -{ - PyObject *w = PyInt_FromLong((long)c); - PyObject *x; - - if (w == NULL) - return -1; - x = PyObject_GetItem(mapping, w); - Py_DECREF(w); - if (x == NULL) { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - /* No mapping found means: use 1:1 mapping. */ - PyErr_Clear(); - *result = NULL; - return 0; - } else - return -1; - } - else if (x == Py_None) { - *result = x; - return 0; - } - else if (PyInt_Check(x)) { - long value = PyInt_AS_LONG(x); - long max = PyUnicode_GetMax(); - if (value < 0 || value > max) { - PyErr_Format(PyExc_TypeError, - "character mapping must be in range(0x%lx)", max+1); - Py_DECREF(x); - return -1; - } - *result = x; - return 0; - } - else if (PyUnicode_Check(x)) { - *result = x; - return 0; - } - else { - /* wrong return value */ - PyErr_SetString(PyExc_TypeError, - "character mapping must return integer, None or unicode"); - Py_DECREF(x); - return -1; - } -} -/* ensure that *outobj is at least requiredsize characters long, - if not reallocate and adjust various state variables. - Return 0 on success, -1 on error */ -static -int charmaptranslate_makespace(PyObject **outobj, Py_UNICODE **outp, - Py_ssize_t requiredsize) -{ - Py_ssize_t oldsize = PyUnicode_GET_SIZE(*outobj); - if (requiredsize > oldsize) { - /* remember old output position */ - Py_ssize_t outpos = *outp-PyUnicode_AS_UNICODE(*outobj); - /* exponentially overallocate to minimize reallocations */ - if (requiredsize < 2 * oldsize) - requiredsize = 2 * oldsize; - if (PyUnicode_Resize(outobj, requiredsize) < 0) - return -1; - *outp = PyUnicode_AS_UNICODE(*outobj) + outpos; - } - return 0; -} -/* lookup the character, put the result in the output string and adjust - various state variables. Return a new reference to the object that - was put in the output buffer in *result, or Py_None, if the mapping was - undefined (in which case no character was written). - The called must decref result. - Return 0 on success, -1 on error. */ -static -int charmaptranslate_output(const Py_UNICODE *startinp, const Py_UNICODE *curinp, - Py_ssize_t insize, PyObject *mapping, PyObject **outobj, Py_UNICODE **outp, - PyObject **res) -{ - if (charmaptranslate_lookup(*curinp, mapping, res)) - return -1; - if (*res==NULL) { - /* not found => default to 1:1 mapping */ - *(*outp)++ = *curinp; - } - else if (*res==Py_None) - ; - else if (PyInt_Check(*res)) { - /* no overflow check, because we know that the space is enough */ - *(*outp)++ = (Py_UNICODE)PyInt_AS_LONG(*res); - } - else if (PyUnicode_Check(*res)) { - Py_ssize_t repsize = PyUnicode_GET_SIZE(*res); - if (repsize==1) { - /* no overflow check, because we know that the space is enough */ - *(*outp)++ = *PyUnicode_AS_UNICODE(*res); - } - else if (repsize!=0) { - /* more than one character */ - Py_ssize_t requiredsize = (*outp-PyUnicode_AS_UNICODE(*outobj)) + - (insize - (curinp-startinp)) + - repsize - 1; - if (charmaptranslate_makespace(outobj, outp, requiredsize)) - return -1; - memcpy(*outp, PyUnicode_AS_UNICODE(*res), sizeof(Py_UNICODE)*repsize); - *outp += repsize; - } - } - else - return -1; - return 0; -} - -PyObject *PyUnicode_TranslateCharmap(const Py_UNICODE *p, - Py_ssize_t size, - PyObject *mapping, - const char *errors) -{ - /* output object */ - PyObject *res = NULL; - /* pointers to the beginning and end+1 of input */ - const Py_UNICODE *startp = p; - const Py_UNICODE *endp = p + size; - /* pointer into the output */ - Py_UNICODE *str; - /* current output position */ - Py_ssize_t respos = 0; - char *reason = "character maps to "; - PyObject *errorHandler = NULL; - PyObject *exc = NULL; - /* the following variable is used for caching string comparisons - * -1=not initialized, 0=unknown, 1=strict, 2=replace, - * 3=ignore, 4=xmlcharrefreplace */ - int known_errorHandler = -1; - - if (mapping == NULL) { - PyErr_BadArgument(); - return NULL; - } - - /* allocate enough for a simple 1:1 translation without - replacements, if we need more, we'll resize */ - res = PyUnicode_FromUnicode(NULL, size); - if (res == NULL) - goto onError; - if (size == 0) - return res; - str = PyUnicode_AS_UNICODE(res); - - while (p adjust input pointer */ - ++p; - else { /* untranslatable character */ - PyObject *repunicode = NULL; /* initialize to prevent gcc warning */ - Py_ssize_t repsize; - Py_ssize_t newpos; - Py_UNICODE *uni2; - /* startpos for collecting untranslatable chars */ - const Py_UNICODE *collstart = p; - const Py_UNICODE *collend = p+1; - const Py_UNICODE *coll; - - /* find all untranslatable characters */ - while (collend < endp) { - if (charmaptranslate_lookup(*collend, mapping, &x)) - goto onError; - Py_XDECREF(x); - if (x!=Py_None) - break; - ++collend; - } - /* cache callback name lookup - * (if not done yet, i.e. it's the first error) */ - if (known_errorHandler==-1) { - if ((errors==NULL) || (!strcmp(errors, "strict"))) - known_errorHandler = 1; - else if (!strcmp(errors, "replace")) - known_errorHandler = 2; - else if (!strcmp(errors, "ignore")) - known_errorHandler = 3; - else if (!strcmp(errors, "xmlcharrefreplace")) - known_errorHandler = 4; - else - known_errorHandler = 0; - } - switch (known_errorHandler) { - case 1: /* strict */ - raise_translate_exception(&exc, startp, size, collstart-startp, collend-startp, reason); - goto onError; - case 2: /* replace */ - /* No need to check for space, this is a 1:1 replacement */ - for (coll = collstart; coll0; ++uni2) - *str++ = *uni2; - p = startp + newpos; - Py_DECREF(repunicode); - } - } - } - /* Resize if we allocated to much */ - respos = str-PyUnicode_AS_UNICODE(res); - if (respos= 0) { - *output++ = '0' + decimal; - ++p; - continue; - } - if (0 < ch && ch < 256) { - *output++ = (char)ch; - ++p; - continue; - } - /* All other characters are considered unencodable */ - collstart = p; - for (collend = p+1; collend < end; collend++) { - if ((0 < *collend && *collend < 256) || - Py_UNICODE_ISSPACE(*collend) || - 0 <= Py_UNICODE_TODECIMAL(*collend)) - break; - } - /* cache callback name lookup - * (if not done yet, i.e. it's the first error) */ - if (known_errorHandler==-1) { - if ((errors==NULL) || (!strcmp(errors, "strict"))) - known_errorHandler = 1; - else if (!strcmp(errors, "replace")) - known_errorHandler = 2; - else if (!strcmp(errors, "ignore")) - known_errorHandler = 3; - else if (!strcmp(errors, "xmlcharrefreplace")) - known_errorHandler = 4; - else - known_errorHandler = 0; - } - switch (known_errorHandler) { - case 1: /* strict */ - raise_encode_exception(&exc, encoding, s, length, collstart-s, collend-s, reason); - goto onError; - case 2: /* replace */ - for (p = collstart; p < collend; ++p) - *output++ = '?'; - /* fall through */ - case 3: /* ignore */ - p = collend; - break; - case 4: /* xmlcharrefreplace */ - /* generate replacement (temporarily (mis)uses p) */ - for (p = collstart; p < collend;) { - Py_UCS4 ch = _Py_UNICODE_NEXT(p, collend); - output += sprintf(output, "&#%d;", ch); - } - p = collend; - break; - default: - repunicode = unicode_encode_call_errorhandler(errors, &errorHandler, - encoding, reason, s, length, &exc, - collstart-s, collend-s, &newpos); - if (repunicode == NULL) - goto onError; - /* generate replacement */ - repsize = PyUnicode_GET_SIZE(repunicode); - for (uni2 = PyUnicode_AS_UNICODE(repunicode); repsize-->0; ++uni2) { - Py_UNICODE ch = *uni2; - if (Py_UNICODE_ISSPACE(ch)) - *output++ = ' '; - else { - decimal = Py_UNICODE_TODECIMAL(ch); - if (decimal >= 0) - *output++ = '0' + decimal; - else if (0 < ch && ch < 256) - *output++ = (char)ch; - else { - Py_DECREF(repunicode); - raise_encode_exception(&exc, encoding, - s, length, collstart-s, collend-s, reason); - goto onError; - } - } - } - p = s + newpos; - Py_DECREF(repunicode); - } - } - /* 0-terminate the output string */ - *output++ = '\0'; - Py_XDECREF(exc); - Py_XDECREF(errorHandler); - return 0; - - onError: - Py_XDECREF(exc); - Py_XDECREF(errorHandler); - return -1; -} - -/* --- Helpers ------------------------------------------------------------ */ - -#include "stringlib/unicodedefs.h" -#include "stringlib/fastsearch.h" - -#include "stringlib/count.h" -#include "stringlib/find.h" -#include "stringlib/partition.h" -#include "stringlib/split.h" - -/* helper macro to fixup start/end slice values */ -#define ADJUST_INDICES(start, end, len) \ - if (end > len) \ - end = len; \ - else if (end < 0) { \ - end += len; \ - if (end < 0) \ - end = 0; \ - } \ - if (start < 0) { \ - start += len; \ - if (start < 0) \ - start = 0; \ - } - -Py_ssize_t PyUnicode_Count(PyObject *str, - PyObject *substr, - Py_ssize_t start, - Py_ssize_t end) -{ - Py_ssize_t result; - PyUnicodeObject* str_obj; - PyUnicodeObject* sub_obj; - - str_obj = (PyUnicodeObject*) PyUnicode_FromObject(str); - if (!str_obj) - return -1; - sub_obj = (PyUnicodeObject*) PyUnicode_FromObject(substr); - if (!sub_obj) { - Py_DECREF(str_obj); - return -1; - } - - ADJUST_INDICES(start, end, str_obj->length); - result = stringlib_count( - str_obj->str + start, end - start, sub_obj->str, sub_obj->length, - PY_SSIZE_T_MAX - ); - - Py_DECREF(sub_obj); - Py_DECREF(str_obj); - - return result; -} - -Py_ssize_t PyUnicode_Find(PyObject *str, - PyObject *sub, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - Py_ssize_t result; - - str = PyUnicode_FromObject(str); - if (!str) - return -2; - sub = PyUnicode_FromObject(sub); - if (!sub) { - Py_DECREF(str); - return -2; - } - - if (direction > 0) - result = stringlib_find_slice( - PyUnicode_AS_UNICODE(str), PyUnicode_GET_SIZE(str), - PyUnicode_AS_UNICODE(sub), PyUnicode_GET_SIZE(sub), - start, end - ); - else - result = stringlib_rfind_slice( - PyUnicode_AS_UNICODE(str), PyUnicode_GET_SIZE(str), - PyUnicode_AS_UNICODE(sub), PyUnicode_GET_SIZE(sub), - start, end - ); - - Py_DECREF(str); - Py_DECREF(sub); - - return result; -} - -static -int tailmatch(PyUnicodeObject *self, - PyUnicodeObject *substring, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - if (substring->length == 0) - return 1; - - ADJUST_INDICES(start, end, self->length); - end -= substring->length; - if (end < start) - return 0; - - if (direction > 0) { - if (Py_UNICODE_MATCH(self, end, substring)) - return 1; - } else { - if (Py_UNICODE_MATCH(self, start, substring)) - return 1; - } - - return 0; -} - -Py_ssize_t PyUnicode_Tailmatch(PyObject *str, - PyObject *substr, - Py_ssize_t start, - Py_ssize_t end, - int direction) -{ - Py_ssize_t result; - - str = PyUnicode_FromObject(str); - if (str == NULL) - return -1; - substr = PyUnicode_FromObject(substr); - if (substr == NULL) { - Py_DECREF(str); - return -1; - } - - result = tailmatch((PyUnicodeObject *)str, - (PyUnicodeObject *)substr, - start, end, direction); - Py_DECREF(str); - Py_DECREF(substr); - return result; -} - -/* Apply fixfct filter to the Unicode object self and return a - reference to the modified object */ - -static -PyObject *fixup(PyUnicodeObject *self, - int (*fixfct)(PyUnicodeObject *s)) -{ - - PyUnicodeObject *u; - - u = (PyUnicodeObject*) PyUnicode_FromUnicode(NULL, self->length); - if (u == NULL) - return NULL; - - Py_UNICODE_COPY(u->str, self->str, self->length); - - if (!fixfct(u) && PyUnicode_CheckExact(self)) { - /* fixfct should return TRUE if it modified the buffer. If - FALSE, return a reference to the original buffer instead - (to save space, not time) */ - Py_INCREF(self); - Py_DECREF(u); - return (PyObject*) self; - } - return (PyObject*) u; -} - -static -int fixupper(PyUnicodeObject *self) -{ - Py_ssize_t len = self->length; - Py_UNICODE *s = self->str; - int status = 0; - - while (len-- > 0) { - register Py_UNICODE ch; - - ch = Py_UNICODE_TOUPPER(*s); - if (ch != *s) { - status = 1; - *s = ch; - } - s++; - } - - return status; -} - -static -int fixlower(PyUnicodeObject *self) -{ - Py_ssize_t len = self->length; - Py_UNICODE *s = self->str; - int status = 0; - - while (len-- > 0) { - register Py_UNICODE ch; - - ch = Py_UNICODE_TOLOWER(*s); - if (ch != *s) { - status = 1; - *s = ch; - } - s++; - } - - return status; -} - -static -int fixswapcase(PyUnicodeObject *self) -{ - Py_ssize_t len = self->length; - Py_UNICODE *s = self->str; - int status = 0; - - while (len-- > 0) { - if (Py_UNICODE_ISUPPER(*s)) { - *s = Py_UNICODE_TOLOWER(*s); - status = 1; - } else if (Py_UNICODE_ISLOWER(*s)) { - *s = Py_UNICODE_TOUPPER(*s); - status = 1; - } - s++; - } - - return status; -} - -static -int fixcapitalize(PyUnicodeObject *self) -{ - Py_ssize_t len = self->length; - Py_UNICODE *s = self->str; - int status = 0; - - if (len == 0) - return 0; - if (!Py_UNICODE_ISUPPER(*s)) { - *s = Py_UNICODE_TOUPPER(*s); - status = 1; - } - s++; - while (--len > 0) { - if (!Py_UNICODE_ISLOWER(*s)) { - *s = Py_UNICODE_TOLOWER(*s); - status = 1; - } - s++; - } - return status; -} - -static -int fixtitle(PyUnicodeObject *self) -{ - register Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register Py_UNICODE *e; - int previous_is_cased; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1) { - Py_UNICODE ch = Py_UNICODE_TOTITLE(*p); - if (*p != ch) { - *p = ch; - return 1; - } - else - return 0; - } - - e = p + PyUnicode_GET_SIZE(self); - previous_is_cased = 0; - for (; p < e; p++) { - register const Py_UNICODE ch = *p; - - if (previous_is_cased) - *p = Py_UNICODE_TOLOWER(ch); - else - *p = Py_UNICODE_TOTITLE(ch); - - if (Py_UNICODE_ISLOWER(ch) || - Py_UNICODE_ISUPPER(ch) || - Py_UNICODE_ISTITLE(ch)) - previous_is_cased = 1; - else - previous_is_cased = 0; - } - return 1; -} - -PyObject * -PyUnicode_Join(PyObject *separator, PyObject *seq) -{ - PyObject *internal_separator = NULL; - const Py_UNICODE blank = ' '; - const Py_UNICODE *sep = ␣ - Py_ssize_t seplen = 1; - PyUnicodeObject *res = NULL; /* the result */ - Py_ssize_t res_alloc = 100; /* # allocated bytes for string in res */ - Py_ssize_t res_used; /* # used bytes */ - Py_UNICODE *res_p; /* pointer to free byte in res's string area */ - PyObject *fseq; /* PySequence_Fast(seq) */ - Py_ssize_t seqlen; /* len(fseq) -- number of items in sequence */ - PyObject *item; - Py_ssize_t i; - - fseq = PySequence_Fast(seq, "can only join an iterable"); - if (fseq == NULL) { - return NULL; - } - - /* Grrrr. A codec may be invoked to convert str objects to - * Unicode, and so it's possible to call back into Python code - * during PyUnicode_FromObject(), and so it's possible for a sick - * codec to change the size of fseq (if seq is a list). Therefore - * we have to keep refetching the size -- can't assume seqlen - * is invariant. - */ - seqlen = PySequence_Fast_GET_SIZE(fseq); - /* If empty sequence, return u"". */ - if (seqlen == 0) { - res = _PyUnicode_New(0); /* empty sequence; return u"" */ - goto Done; - } - /* If singleton sequence with an exact Unicode, return that. */ - if (seqlen == 1) { - item = PySequence_Fast_GET_ITEM(fseq, 0); - if (PyUnicode_CheckExact(item)) { - Py_INCREF(item); - res = (PyUnicodeObject *)item; - goto Done; - } - } - - /* At least two items to join, or one that isn't exact Unicode. */ - if (seqlen > 1) { - /* Set up sep and seplen -- they're needed. */ - if (separator == NULL) { - sep = ␣ - seplen = 1; - } - else { - internal_separator = PyUnicode_FromObject(separator); - if (internal_separator == NULL) - goto onError; - sep = PyUnicode_AS_UNICODE(internal_separator); - seplen = PyUnicode_GET_SIZE(internal_separator); - /* In case PyUnicode_FromObject() mutated seq. */ - seqlen = PySequence_Fast_GET_SIZE(fseq); - } - } - - /* Get space. */ - res = _PyUnicode_New(res_alloc); - if (res == NULL) - goto onError; - res_p = PyUnicode_AS_UNICODE(res); - res_used = 0; - - for (i = 0; i < seqlen; ++i) { - Py_ssize_t itemlen; - Py_ssize_t new_res_used; - - item = PySequence_Fast_GET_ITEM(fseq, i); - /* Convert item to Unicode. */ - if (! PyUnicode_Check(item) && ! PyString_Check(item)) { - PyErr_Format(PyExc_TypeError, - "sequence item %zd: expected string or Unicode," - " %.80s found", - i, Py_TYPE(item)->tp_name); - goto onError; - } - item = PyUnicode_FromObject(item); - if (item == NULL) - goto onError; - /* We own a reference to item from here on. */ - - /* In case PyUnicode_FromObject() mutated seq. */ - seqlen = PySequence_Fast_GET_SIZE(fseq); - - /* Make sure we have enough space for the separator and the item. */ - itemlen = PyUnicode_GET_SIZE(item); - new_res_used = res_used + itemlen; - if (new_res_used < 0) - goto Overflow; - if (i < seqlen - 1) { - new_res_used += seplen; - if (new_res_used < 0) - goto Overflow; - } - if (new_res_used > res_alloc) { - /* double allocated size until it's big enough */ - do { - res_alloc += res_alloc; - if (res_alloc <= 0) - goto Overflow; - } while (new_res_used > res_alloc); - if (_PyUnicode_Resize(&res, res_alloc) < 0) { - Py_DECREF(item); - goto onError; - } - res_p = PyUnicode_AS_UNICODE(res) + res_used; - } - - /* Copy item, and maybe the separator. */ - Py_UNICODE_COPY(res_p, PyUnicode_AS_UNICODE(item), itemlen); - res_p += itemlen; - if (i < seqlen - 1) { - Py_UNICODE_COPY(res_p, sep, seplen); - res_p += seplen; - } - Py_DECREF(item); - res_used = new_res_used; - } - - /* Shrink res to match the used area; this probably can't fail, - * but it's cheap to check. - */ - if (_PyUnicode_Resize(&res, res_used) < 0) - goto onError; - - Done: - Py_XDECREF(internal_separator); - Py_DECREF(fseq); - return (PyObject *)res; - - Overflow: - PyErr_SetString(PyExc_OverflowError, - "join() result is too long for a Python string"); - Py_DECREF(item); - /* fall through */ - - onError: - Py_XDECREF(internal_separator); - Py_DECREF(fseq); - Py_XDECREF(res); - return NULL; -} - -static -PyUnicodeObject *pad(PyUnicodeObject *self, - Py_ssize_t left, - Py_ssize_t right, - Py_UNICODE fill) -{ - PyUnicodeObject *u; - - if (left < 0) - left = 0; - if (right < 0) - right = 0; - - if (left == 0 && right == 0 && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return self; - } - - if (left > PY_SSIZE_T_MAX - self->length || - right > PY_SSIZE_T_MAX - (left + self->length)) { - PyErr_SetString(PyExc_OverflowError, "padded string is too long"); - return NULL; - } - u = _PyUnicode_New(left + self->length + right); - if (u) { - if (left) - Py_UNICODE_FILL(u->str, fill, left); - Py_UNICODE_COPY(u->str + left, self->str, self->length); - if (right) - Py_UNICODE_FILL(u->str + left + self->length, fill, right); - } - - return u; -} - -PyObject *PyUnicode_Splitlines(PyObject *string, int keepends) -{ - PyObject *list; - - string = PyUnicode_FromObject(string); - if (string == NULL) - return NULL; - - list = stringlib_splitlines( - (PyObject*) string, PyUnicode_AS_UNICODE(string), - PyUnicode_GET_SIZE(string), keepends); - - Py_DECREF(string); - return list; -} - -static -PyObject *split(PyUnicodeObject *self, - PyUnicodeObject *substring, - Py_ssize_t maxcount) -{ - if (maxcount < 0) - maxcount = PY_SSIZE_T_MAX; - - if (substring == NULL) - return stringlib_split_whitespace( - (PyObject*) self, self->str, self->length, maxcount - ); - - return stringlib_split( - (PyObject*) self, self->str, self->length, - substring->str, substring->length, - maxcount - ); -} - -static -PyObject *rsplit(PyUnicodeObject *self, - PyUnicodeObject *substring, - Py_ssize_t maxcount) -{ - if (maxcount < 0) - maxcount = PY_SSIZE_T_MAX; - - if (substring == NULL) - return stringlib_rsplit_whitespace( - (PyObject*) self, self->str, self->length, maxcount - ); - - return stringlib_rsplit( - (PyObject*) self, self->str, self->length, - substring->str, substring->length, - maxcount - ); -} - -static -PyObject *replace(PyUnicodeObject *self, - PyUnicodeObject *str1, - PyUnicodeObject *str2, - Py_ssize_t maxcount) -{ - PyUnicodeObject *u; - - if (maxcount < 0) - maxcount = PY_SSIZE_T_MAX; - else if (maxcount == 0 || self->length == 0) - goto nothing; - - if (str1->length == str2->length) { - Py_ssize_t i; - /* same length */ - if (str1->length == 0) - goto nothing; - if (str1->length == 1) { - /* replace characters */ - Py_UNICODE u1, u2; - if (!findchar(self->str, self->length, str1->str[0])) - goto nothing; - u = (PyUnicodeObject*) PyUnicode_FromUnicode(NULL, self->length); - if (!u) - return NULL; - Py_UNICODE_COPY(u->str, self->str, self->length); - u1 = str1->str[0]; - u2 = str2->str[0]; - for (i = 0; i < u->length; i++) - if (u->str[i] == u1) { - if (--maxcount < 0) - break; - u->str[i] = u2; - } - } else { - i = stringlib_find( - self->str, self->length, str1->str, str1->length, 0 - ); - if (i < 0) - goto nothing; - u = (PyUnicodeObject*) PyUnicode_FromUnicode(NULL, self->length); - if (!u) - return NULL; - Py_UNICODE_COPY(u->str, self->str, self->length); - - /* change everything in-place, starting with this one */ - Py_UNICODE_COPY(u->str+i, str2->str, str2->length); - i += str1->length; - - while ( --maxcount > 0) { - i = stringlib_find(self->str+i, self->length-i, - str1->str, str1->length, - i); - if (i == -1) - break; - Py_UNICODE_COPY(u->str+i, str2->str, str2->length); - i += str1->length; - } - } - } else { - - Py_ssize_t n, i, j; - Py_ssize_t product, new_size, delta; - Py_UNICODE *p; - - /* replace strings */ - n = stringlib_count(self->str, self->length, str1->str, str1->length, - maxcount); - if (n == 0) - goto nothing; - /* new_size = self->length + n * (str2->length - str1->length)); */ - delta = (str2->length - str1->length); - if (delta == 0) { - new_size = self->length; - } else { - product = n * (str2->length - str1->length); - if ((product / (str2->length - str1->length)) != n) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - new_size = self->length + product; - if (new_size < 0) { - PyErr_SetString(PyExc_OverflowError, - "replace string is too long"); - return NULL; - } - } - u = _PyUnicode_New(new_size); - if (!u) - return NULL; - i = 0; - p = u->str; - if (str1->length > 0) { - while (n-- > 0) { - /* look for next match */ - j = stringlib_find(self->str+i, self->length-i, - str1->str, str1->length, - i); - if (j == -1) - break; - else if (j > i) { - /* copy unchanged part [i:j] */ - Py_UNICODE_COPY(p, self->str+i, j-i); - p += j - i; - } - /* copy substitution string */ - if (str2->length > 0) { - Py_UNICODE_COPY(p, str2->str, str2->length); - p += str2->length; - } - i = j + str1->length; - } - if (i < self->length) - /* copy tail [i:] */ - Py_UNICODE_COPY(p, self->str+i, self->length-i); - } else { - /* interleave */ - while (n > 0) { - Py_UNICODE_COPY(p, str2->str, str2->length); - p += str2->length; - if (--n <= 0) - break; - *p++ = self->str[i++]; - } - Py_UNICODE_COPY(p, self->str+i, self->length-i); - } - } - return (PyObject *) u; - - nothing: - /* nothing to replace; return original string (when possible) */ - if (PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *) self; - } - return PyUnicode_FromUnicode(self->str, self->length); -} - -/* --- Unicode Object Methods --------------------------------------------- */ - -PyDoc_STRVAR(title__doc__, - "S.title() -> unicode\n\ -\n\ -Return a titlecased version of S, i.e. words start with title case\n\ -characters, all remaining cased characters have lower case."); - -static PyObject* -unicode_title(PyUnicodeObject *self) -{ - return fixup(self, fixtitle); -} - -PyDoc_STRVAR(capitalize__doc__, - "S.capitalize() -> unicode\n\ -\n\ -Return a capitalized version of S, i.e. make the first character\n\ -have upper case and the rest lower case."); - -static PyObject* -unicode_capitalize(PyUnicodeObject *self) -{ - return fixup(self, fixcapitalize); -} - -#if 0 -PyDoc_STRVAR(capwords__doc__, - "S.capwords() -> unicode\n\ -\n\ -Apply .capitalize() to all words in S and return the result with\n\ -normalized whitespace (all whitespace strings are replaced by ' ')."); - -static PyObject* -unicode_capwords(PyUnicodeObject *self) -{ - PyObject *list; - PyObject *item; - Py_ssize_t i; - - /* Split into words */ - list = split(self, NULL, -1); - if (!list) - return NULL; - - /* Capitalize each word */ - for (i = 0; i < PyList_GET_SIZE(list); i++) { - item = fixup((PyUnicodeObject *)PyList_GET_ITEM(list, i), - fixcapitalize); - if (item == NULL) - goto onError; - Py_DECREF(PyList_GET_ITEM(list, i)); - PyList_SET_ITEM(list, i, item); - } - - /* Join the words to form a new string */ - item = PyUnicode_Join(NULL, list); - - onError: - Py_DECREF(list); - return (PyObject *)item; -} -#endif - -/* Argument converter. Coerces to a single unicode character */ - -static int -convert_uc(PyObject *obj, void *addr) -{ - Py_UNICODE *fillcharloc = (Py_UNICODE *)addr; - PyObject *uniobj; - Py_UNICODE *unistr; - - uniobj = PyUnicode_FromObject(obj); - if (uniobj == NULL) { - PyErr_SetString(PyExc_TypeError, - "The fill character cannot be converted to Unicode"); - return 0; - } - if (PyUnicode_GET_SIZE(uniobj) != 1) { - PyErr_SetString(PyExc_TypeError, - "The fill character must be exactly one character long"); - Py_DECREF(uniobj); - return 0; - } - unistr = PyUnicode_AS_UNICODE(uniobj); - *fillcharloc = unistr[0]; - Py_DECREF(uniobj); - return 1; -} - -PyDoc_STRVAR(center__doc__, - "S.center(width[, fillchar]) -> unicode\n\ -\n\ -Return S centered in a Unicode string of length width. Padding is\n\ -done using the specified fill character (default is a space)"); - -static PyObject * -unicode_center(PyUnicodeObject *self, PyObject *args) -{ - Py_ssize_t marg, left; - Py_ssize_t width; - Py_UNICODE fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|O&:center", &width, convert_uc, &fillchar)) - return NULL; - - if (self->length >= width && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - marg = width - self->length; - left = marg / 2 + (marg & width & 1); - - return (PyObject*) pad(self, left, marg - left, fillchar); -} - -#if 0 - -/* This code should go into some future Unicode collation support - module. The basic comparison should compare ordinals on a naive - basis (this is what Java does and thus Jython too). */ - -/* speedy UTF-16 code point order comparison */ -/* gleaned from: */ -/* http://www-4.ibm.com/software/developer/library/utf16.html?dwzone=unicode */ - -static short utf16Fixup[32] = -{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0x2000, -0x800, -0x800, -0x800, -0x800 -}; - -static int -unicode_compare(PyUnicodeObject *str1, PyUnicodeObject *str2) -{ - Py_ssize_t len1, len2; - - Py_UNICODE *s1 = str1->str; - Py_UNICODE *s2 = str2->str; - - len1 = str1->length; - len2 = str2->length; - - while (len1 > 0 && len2 > 0) { - Py_UNICODE c1, c2; - - c1 = *s1++; - c2 = *s2++; - - if (c1 > (1<<11) * 26) - c1 += utf16Fixup[c1>>11]; - if (c2 > (1<<11) * 26) - c2 += utf16Fixup[c2>>11]; - /* now c1 and c2 are in UTF-32-compatible order */ - - if (c1 != c2) - return (c1 < c2) ? -1 : 1; - - len1--; len2--; - } - - return (len1 < len2) ? -1 : (len1 != len2); -} - -#else - -static int -unicode_compare(PyUnicodeObject *str1, PyUnicodeObject *str2) -{ - register Py_ssize_t len1, len2; - - Py_UNICODE *s1 = str1->str; - Py_UNICODE *s2 = str2->str; - - len1 = str1->length; - len2 = str2->length; - - while (len1 > 0 && len2 > 0) { - Py_UNICODE c1, c2; - - c1 = *s1++; - c2 = *s2++; - - if (c1 != c2) - return (c1 < c2) ? -1 : 1; - - len1--; len2--; - } - - return (len1 < len2) ? -1 : (len1 != len2); -} - -#endif - -int PyUnicode_Compare(PyObject *left, - PyObject *right) -{ - PyUnicodeObject *u = NULL, *v = NULL; - int result; - - /* Coerce the two arguments */ - u = (PyUnicodeObject *)PyUnicode_FromObject(left); - if (u == NULL) - goto onError; - v = (PyUnicodeObject *)PyUnicode_FromObject(right); - if (v == NULL) - goto onError; - - /* Shortcut for empty or interned objects */ - if (v == u) { - Py_DECREF(u); - Py_DECREF(v); - return 0; - } - - result = unicode_compare(u, v); - - Py_DECREF(u); - Py_DECREF(v); - return result; - - onError: - Py_XDECREF(u); - Py_XDECREF(v); - return -1; -} - -PyObject *PyUnicode_RichCompare(PyObject *left, - PyObject *right, - int op) -{ - int result; - - result = PyUnicode_Compare(left, right); - if (result == -1 && PyErr_Occurred()) - goto onError; - - /* Convert the return value to a Boolean */ - switch (op) { - case Py_EQ: - result = (result == 0); - break; - case Py_NE: - result = (result != 0); - break; - case Py_LE: - result = (result <= 0); - break; - case Py_GE: - result = (result >= 0); - break; - case Py_LT: - result = (result == -1); - break; - case Py_GT: - result = (result == 1); - break; - } - return PyBool_FromLong(result); - - onError: - - /* Standard case - - Type errors mean that PyUnicode_FromObject() could not convert - one of the arguments (usually the right hand side) to Unicode, - ie. we can't handle the comparison request. However, it is - possible that the other object knows a comparison method, which - is why we return Py_NotImplemented to give the other object a - chance. - - */ - if (PyErr_ExceptionMatches(PyExc_TypeError)) { - PyErr_Clear(); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - if (op != Py_EQ && op != Py_NE) - return NULL; - - /* Equality comparison. - - This is a special case: we silence any PyExc_UnicodeDecodeError - and instead turn it into a PyErr_UnicodeWarning. - - */ - if (!PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) - return NULL; - PyErr_Clear(); - if (PyErr_Warn(PyExc_UnicodeWarning, - (op == Py_EQ) ? - "Unicode equal comparison " - "failed to convert both arguments to Unicode - " - "interpreting them as being unequal" : - "Unicode unequal comparison " - "failed to convert both arguments to Unicode - " - "interpreting them as being unequal" - ) < 0) - return NULL; - result = (op == Py_NE); - return PyBool_FromLong(result); -} - -int PyUnicode_Contains(PyObject *container, - PyObject *element) -{ - PyObject *str, *sub; - int result; - - /* Coerce the two arguments */ - sub = PyUnicode_FromObject(element); - if (!sub) { - return -1; - } - - str = PyUnicode_FromObject(container); - if (!str) { - Py_DECREF(sub); - return -1; - } - - result = stringlib_contains_obj(str, sub); - - Py_DECREF(str); - Py_DECREF(sub); - - return result; -} - -/* Concat to string or Unicode object giving a new Unicode object. */ - -PyObject *PyUnicode_Concat(PyObject *left, - PyObject *right) -{ - PyUnicodeObject *u = NULL, *v = NULL, *w; - - /* Coerce the two arguments */ - u = (PyUnicodeObject *)PyUnicode_FromObject(left); - if (u == NULL) - goto onError; - v = (PyUnicodeObject *)PyUnicode_FromObject(right); - if (v == NULL) - goto onError; - - /* Shortcuts */ - if (v == unicode_empty) { - Py_DECREF(v); - return (PyObject *)u; - } - if (u == unicode_empty) { - Py_DECREF(u); - return (PyObject *)v; - } - - /* Concat the two Unicode strings */ - w = _PyUnicode_New(u->length + v->length); - if (w == NULL) - goto onError; - Py_UNICODE_COPY(w->str, u->str, u->length); - Py_UNICODE_COPY(w->str + u->length, v->str, v->length); - - Py_DECREF(u); - Py_DECREF(v); - return (PyObject *)w; - - onError: - Py_XDECREF(u); - Py_XDECREF(v); - return NULL; -} - -PyDoc_STRVAR(count__doc__, - "S.count(sub[, start[, end]]) -> int\n\ -\n\ -Return the number of non-overlapping occurrences of substring sub in\n\ -Unicode string S[start:end]. Optional arguments start and end are\n\ -interpreted as in slice notation."); - -static PyObject * -unicode_count(PyUnicodeObject *self, PyObject *args) -{ - PyUnicodeObject *substring; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - PyObject *result; - - if (!stringlib_parse_args_finds_unicode("count", args, &substring, - &start, &end)) - return NULL; - - ADJUST_INDICES(start, end, self->length); - result = PyInt_FromSsize_t( - stringlib_count(self->str + start, end - start, - substring->str, substring->length, - PY_SSIZE_T_MAX) - ); - - Py_DECREF(substring); - - return result; -} - -PyDoc_STRVAR(encode__doc__, - "S.encode([encoding[,errors]]) -> string or unicode\n\ -\n\ -Encodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeEncodeError. Other possible values are 'ignore', 'replace' and\n\ -'xmlcharrefreplace' as well as any other name registered with\n\ -codecs.register_error that can handle UnicodeEncodeErrors."); - -static PyObject * -unicode_encode(PyUnicodeObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = {"encoding", "errors", 0}; - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:encode", - kwlist, &encoding, &errors)) - return NULL; - v = PyUnicode_AsEncodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "encoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - -PyDoc_STRVAR(decode__doc__, - "S.decode([encoding[,errors]]) -> string or unicode\n\ -\n\ -Decodes S using the codec registered for encoding. encoding defaults\n\ -to the default encoding. errors may be given to set a different error\n\ -handling scheme. Default is 'strict' meaning that encoding errors raise\n\ -a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n\ -as well as any other name registered with codecs.register_error that is\n\ -able to handle UnicodeDecodeErrors."); - -static PyObject * -unicode_decode(PyUnicodeObject *self, PyObject *args, PyObject *kwargs) -{ - static char *kwlist[] = {"encoding", "errors", 0}; - char *encoding = NULL; - char *errors = NULL; - PyObject *v; - - if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ss:decode", - kwlist, &encoding, &errors)) - return NULL; - v = PyUnicode_AsDecodedObject((PyObject *)self, encoding, errors); - if (v == NULL) - goto onError; - if (!PyString_Check(v) && !PyUnicode_Check(v)) { - PyErr_Format(PyExc_TypeError, - "decoder did not return a string/unicode object " - "(type=%.400s)", - Py_TYPE(v)->tp_name); - Py_DECREF(v); - return NULL; - } - return v; - - onError: - return NULL; -} - -PyDoc_STRVAR(expandtabs__doc__, - "S.expandtabs([tabsize]) -> unicode\n\ -\n\ -Return a copy of S where all tab characters are expanded using spaces.\n\ -If tabsize is not given, a tab size of 8 characters is assumed."); - -static PyObject* -unicode_expandtabs(PyUnicodeObject *self, PyObject *args) -{ - Py_UNICODE *e; - Py_UNICODE *p; - Py_UNICODE *q; - Py_UNICODE *qe; - Py_ssize_t i, j, incr; - PyUnicodeObject *u; - int tabsize = 8; - - if (!PyArg_ParseTuple(args, "|i:expandtabs", &tabsize)) - return NULL; - - /* First pass: determine size of output string */ - i = 0; /* chars up to and including most recent \n or \r */ - j = 0; /* chars since most recent \n or \r (use in tab calculations) */ - e = self->str + self->length; /* end of input */ - for (p = self->str; p < e; p++) - if (*p == '\t') { - if (tabsize > 0) { - incr = tabsize - (j % tabsize); /* cannot overflow */ - if (j > PY_SSIZE_T_MAX - incr) - goto overflow1; - j += incr; - } - } - else { - if (j > PY_SSIZE_T_MAX - 1) - goto overflow1; - j++; - if (*p == '\n' || *p == '\r') { - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - i += j; - j = 0; - } - } - - if (i > PY_SSIZE_T_MAX - j) - goto overflow1; - - /* Second pass: create output string and fill it */ - u = _PyUnicode_New(i + j); - if (!u) - return NULL; - - j = 0; /* same as in first pass */ - q = u->str; /* next output char */ - qe = u->str + u->length; /* end of output */ - - for (p = self->str; p < e; p++) - if (*p == '\t') { - if (tabsize > 0) { - i = tabsize - (j % tabsize); - j += i; - while (i--) { - if (q >= qe) - goto overflow2; - *q++ = ' '; - } - } - } - else { - if (q >= qe) - goto overflow2; - *q++ = *p; - j++; - if (*p == '\n' || *p == '\r') - j = 0; - } - - return (PyObject*) u; - - overflow2: - Py_DECREF(u); - overflow1: - PyErr_SetString(PyExc_OverflowError, "new string is too long"); - return NULL; -} - -PyDoc_STRVAR(find__doc__, - "S.find(sub [,start [,end]]) -> int\n\ -\n\ -Return the lowest index in S where substring sub is found,\n\ -such that sub is contained within S[start:end]. Optional\n\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -unicode_find(PyUnicodeObject *self, PyObject *args) -{ - PyUnicodeObject *substring; - Py_ssize_t start; - Py_ssize_t end; - Py_ssize_t result; - - if (!stringlib_parse_args_finds_unicode("find", args, &substring, - &start, &end)) - return NULL; - - result = stringlib_find_slice( - PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self), - PyUnicode_AS_UNICODE(substring), PyUnicode_GET_SIZE(substring), - start, end - ); - - Py_DECREF(substring); - - return PyInt_FromSsize_t(result); -} - -static PyObject * -unicode_getitem(PyUnicodeObject *self, Py_ssize_t index) -{ - if (index < 0 || index >= self->length) { - PyErr_SetString(PyExc_IndexError, "string index out of range"); - return NULL; - } - - return (PyObject*) PyUnicode_FromUnicode(&self->str[index], 1); -} - -static long -unicode_hash(PyUnicodeObject *self) -{ - /* Since Unicode objects compare equal to their ASCII string - counterparts, they should use the individual character values - as basis for their hash value. This is needed to assure that - strings and Unicode objects behave in the same way as - dictionary keys. */ - - register Py_ssize_t len; - register Py_UNICODE *p; - register long x; - -#ifdef Py_DEBUG - assert(_Py_HashSecret_Initialized); -#endif - if (self->hash != -1) - return self->hash; - len = PyUnicode_GET_SIZE(self); - /* - We make the hash of the empty string be 0, rather than using - (prefix ^ suffix), since this slightly obfuscates the hash secret - */ - if (len == 0) { - self->hash = 0; - return 0; - } - p = PyUnicode_AS_UNICODE(self); - x = _Py_HashSecret.prefix; - x ^= *p << 7; - while (--len >= 0) - x = (1000003*x) ^ *p++; - x ^= PyUnicode_GET_SIZE(self); - x ^= _Py_HashSecret.suffix; - if (x == -1) - x = -2; - self->hash = x; - return x; -} - -PyDoc_STRVAR(index__doc__, - "S.index(sub [,start [,end]]) -> int\n\ -\n\ -Like S.find() but raise ValueError when the substring is not found."); - -static PyObject * -unicode_index(PyUnicodeObject *self, PyObject *args) -{ - Py_ssize_t result; - PyUnicodeObject *substring; - Py_ssize_t start; - Py_ssize_t end; - - if (!stringlib_parse_args_finds_unicode("index", args, &substring, - &start, &end)) - return NULL; - - result = stringlib_find_slice( - PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self), - PyUnicode_AS_UNICODE(substring), PyUnicode_GET_SIZE(substring), - start, end - ); - - Py_DECREF(substring); - - if (result < 0) { - PyErr_SetString(PyExc_ValueError, "substring not found"); - return NULL; - } - - return PyInt_FromSsize_t(result); -} - -PyDoc_STRVAR(islower__doc__, - "S.islower() -> bool\n\ -\n\ -Return True if all cased characters in S are lowercase and there is\n\ -at least one cased character in S, False otherwise."); - -static PyObject* -unicode_islower(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - int cased; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1) - return PyBool_FromLong(Py_UNICODE_ISLOWER(*p)); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - register const Py_UNICODE ch = *p; - - if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) - return PyBool_FromLong(0); - else if (!cased && Py_UNICODE_ISLOWER(ch)) - cased = 1; - } - return PyBool_FromLong(cased); -} - -PyDoc_STRVAR(isupper__doc__, - "S.isupper() -> bool\n\ -\n\ -Return True if all cased characters in S are uppercase and there is\n\ -at least one cased character in S, False otherwise."); - -static PyObject* -unicode_isupper(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - int cased; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1) - return PyBool_FromLong(Py_UNICODE_ISUPPER(*p) != 0); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - cased = 0; - for (; p < e; p++) { - register const Py_UNICODE ch = *p; - - if (Py_UNICODE_ISLOWER(ch) || Py_UNICODE_ISTITLE(ch)) - return PyBool_FromLong(0); - else if (!cased && Py_UNICODE_ISUPPER(ch)) - cased = 1; - } - return PyBool_FromLong(cased); -} - -PyDoc_STRVAR(istitle__doc__, - "S.istitle() -> bool\n\ -\n\ -Return True if S is a titlecased string and there is at least one\n\ -character in S, i.e. upper- and titlecase characters may only\n\ -follow uncased characters and lowercase characters only cased ones.\n\ -Return False otherwise."); - -static PyObject* -unicode_istitle(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - int cased, previous_is_cased; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1) - return PyBool_FromLong((Py_UNICODE_ISTITLE(*p) != 0) || - (Py_UNICODE_ISUPPER(*p) != 0)); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - cased = 0; - previous_is_cased = 0; - for (; p < e; p++) { - register const Py_UNICODE ch = *p; - - if (Py_UNICODE_ISUPPER(ch) || Py_UNICODE_ISTITLE(ch)) { - if (previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else if (Py_UNICODE_ISLOWER(ch)) { - if (!previous_is_cased) - return PyBool_FromLong(0); - previous_is_cased = 1; - cased = 1; - } - else - previous_is_cased = 0; - } - return PyBool_FromLong(cased); -} - -PyDoc_STRVAR(isspace__doc__, - "S.isspace() -> bool\n\ -\n\ -Return True if all characters in S are whitespace\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -unicode_isspace(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISSPACE(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - for (; p < e; p++) { - if (!Py_UNICODE_ISSPACE(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - -PyDoc_STRVAR(isalpha__doc__, - "S.isalpha() -> bool\n\ -\n\ -Return True if all characters in S are alphabetic\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -unicode_isalpha(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISALPHA(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - for (; p < e; p++) { - if (!Py_UNICODE_ISALPHA(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - -PyDoc_STRVAR(isalnum__doc__, - "S.isalnum() -> bool\n\ -\n\ -Return True if all characters in S are alphanumeric\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -unicode_isalnum(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISALNUM(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - for (; p < e; p++) { - if (!Py_UNICODE_ISALNUM(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - -PyDoc_STRVAR(isdecimal__doc__, - "S.isdecimal() -> bool\n\ -\n\ -Return True if there are only decimal characters in S,\n\ -False otherwise."); - -static PyObject* -unicode_isdecimal(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISDECIMAL(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - for (; p < e; p++) { - if (!Py_UNICODE_ISDECIMAL(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - -PyDoc_STRVAR(isdigit__doc__, - "S.isdigit() -> bool\n\ -\n\ -Return True if all characters in S are digits\n\ -and there is at least one character in S, False otherwise."); - -static PyObject* -unicode_isdigit(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISDIGIT(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - for (; p < e; p++) { - if (!Py_UNICODE_ISDIGIT(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - -PyDoc_STRVAR(isnumeric__doc__, - "S.isnumeric() -> bool\n\ -\n\ -Return True if there are only numeric characters in S,\n\ -False otherwise."); - -static PyObject* -unicode_isnumeric(PyUnicodeObject *self) -{ - register const Py_UNICODE *p = PyUnicode_AS_UNICODE(self); - register const Py_UNICODE *e; - - /* Shortcut for single character strings */ - if (PyUnicode_GET_SIZE(self) == 1 && - Py_UNICODE_ISNUMERIC(*p)) - return PyBool_FromLong(1); - - /* Special case for empty strings */ - if (PyUnicode_GET_SIZE(self) == 0) - return PyBool_FromLong(0); - - e = p + PyUnicode_GET_SIZE(self); - for (; p < e; p++) { - if (!Py_UNICODE_ISNUMERIC(*p)) - return PyBool_FromLong(0); - } - return PyBool_FromLong(1); -} - -PyDoc_STRVAR(join__doc__, - "S.join(iterable) -> unicode\n\ -\n\ -Return a string which is the concatenation of the strings in the\n\ -iterable. The separator between elements is S."); - -static PyObject* -unicode_join(PyObject *self, PyObject *data) -{ - return PyUnicode_Join(self, data); -} - -static Py_ssize_t -unicode_length(PyUnicodeObject *self) -{ - return self->length; -} - -PyDoc_STRVAR(ljust__doc__, - "S.ljust(width[, fillchar]) -> int\n\ -\n\ -Return S left-justified in a Unicode string of length width. Padding is\n\ -done using the specified fill character (default is a space)."); - -static PyObject * -unicode_ljust(PyUnicodeObject *self, PyObject *args) -{ - Py_ssize_t width; - Py_UNICODE fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|O&:ljust", &width, convert_uc, &fillchar)) - return NULL; - - if (self->length >= width && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return (PyObject*) pad(self, 0, width - self->length, fillchar); -} - -PyDoc_STRVAR(lower__doc__, - "S.lower() -> unicode\n\ -\n\ -Return a copy of the string S converted to lowercase."); - -static PyObject* -unicode_lower(PyUnicodeObject *self) -{ - return fixup(self, fixlower); -} - -#define LEFTSTRIP 0 -#define RIGHTSTRIP 1 -#define BOTHSTRIP 2 - -/* Arrays indexed by above */ -static const char *stripformat[] = {"|O:lstrip", "|O:rstrip", "|O:strip"}; - -#define STRIPNAME(i) (stripformat[i]+3) - -/* externally visible for str.strip(unicode) */ -PyObject * -_PyUnicode_XStrip(PyUnicodeObject *self, int striptype, PyObject *sepobj) -{ - Py_UNICODE *s = PyUnicode_AS_UNICODE(self); - Py_ssize_t len = PyUnicode_GET_SIZE(self); - Py_UNICODE *sep = PyUnicode_AS_UNICODE(sepobj); - Py_ssize_t seplen = PyUnicode_GET_SIZE(sepobj); - Py_ssize_t i, j; - - BLOOM_MASK sepmask = make_bloom_mask(sep, seplen); - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && BLOOM_MEMBER(sepmask, s[i], sep, seplen)) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && BLOOM_MEMBER(sepmask, s[j], sep, seplen)); - j++; - } - - if (i == 0 && j == len && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyUnicode_FromUnicode(s+i, j-i); -} - - -static PyObject * -do_strip(PyUnicodeObject *self, int striptype) -{ - Py_UNICODE *s = PyUnicode_AS_UNICODE(self); - Py_ssize_t len = PyUnicode_GET_SIZE(self), i, j; - - i = 0; - if (striptype != RIGHTSTRIP) { - while (i < len && Py_UNICODE_ISSPACE(s[i])) { - i++; - } - } - - j = len; - if (striptype != LEFTSTRIP) { - do { - j--; - } while (j >= i && Py_UNICODE_ISSPACE(s[j])); - j++; - } - - if (i == 0 && j == len && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*)self; - } - else - return PyUnicode_FromUnicode(s+i, j-i); -} - - -static PyObject * -do_argstrip(PyUnicodeObject *self, int striptype, PyObject *args) -{ - PyObject *sep = NULL; - - if (!PyArg_ParseTuple(args, (char *)stripformat[striptype], &sep)) - return NULL; - - if (sep != NULL && sep != Py_None) { - if (PyUnicode_Check(sep)) - return _PyUnicode_XStrip(self, striptype, sep); - else if (PyString_Check(sep)) { - PyObject *res; - sep = PyUnicode_FromObject(sep); - if (sep==NULL) - return NULL; - res = _PyUnicode_XStrip(self, striptype, sep); - Py_DECREF(sep); - return res; - } - else { - PyErr_Format(PyExc_TypeError, - "%s arg must be None, unicode or str", - STRIPNAME(striptype)); - return NULL; - } - } - - return do_strip(self, striptype); -} - - -PyDoc_STRVAR(strip__doc__, - "S.strip([chars]) -> unicode\n\ -\n\ -Return a copy of the string S with leading and trailing\n\ -whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is a str, it will be converted to unicode before stripping"); - -static PyObject * -unicode_strip(PyUnicodeObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, BOTHSTRIP); /* Common case */ - else - return do_argstrip(self, BOTHSTRIP, args); -} - - -PyDoc_STRVAR(lstrip__doc__, - "S.lstrip([chars]) -> unicode\n\ -\n\ -Return a copy of the string S with leading whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is a str, it will be converted to unicode before stripping"); - -static PyObject * -unicode_lstrip(PyUnicodeObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, LEFTSTRIP); /* Common case */ - else - return do_argstrip(self, LEFTSTRIP, args); -} - - -PyDoc_STRVAR(rstrip__doc__, - "S.rstrip([chars]) -> unicode\n\ -\n\ -Return a copy of the string S with trailing whitespace removed.\n\ -If chars is given and not None, remove characters in chars instead.\n\ -If chars is a str, it will be converted to unicode before stripping"); - -static PyObject * -unicode_rstrip(PyUnicodeObject *self, PyObject *args) -{ - if (PyTuple_GET_SIZE(args) == 0) - return do_strip(self, RIGHTSTRIP); /* Common case */ - else - return do_argstrip(self, RIGHTSTRIP, args); -} - - -static PyObject* -unicode_repeat(PyUnicodeObject *str, Py_ssize_t len) -{ - PyUnicodeObject *u; - Py_UNICODE *p; - Py_ssize_t nchars; - size_t nbytes; - - if (len < 0) - len = 0; - - if (len == 1 && PyUnicode_CheckExact(str)) { - /* no repeat, return original string */ - Py_INCREF(str); - return (PyObject*) str; - } - - /* ensure # of chars needed doesn't overflow int and # of bytes - * needed doesn't overflow size_t - */ - nchars = len * str->length; - if (len && nchars / len != str->length) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - nbytes = (nchars + 1) * sizeof(Py_UNICODE); - if (nbytes / sizeof(Py_UNICODE) != (size_t)(nchars + 1)) { - PyErr_SetString(PyExc_OverflowError, - "repeated string is too long"); - return NULL; - } - u = _PyUnicode_New(nchars); - if (!u) - return NULL; - - p = u->str; - - if (str->length == 1 && len > 0) { - Py_UNICODE_FILL(p, str->str[0], len); - } else { - Py_ssize_t done = 0; /* number of characters copied this far */ - if (done < nchars) { - Py_UNICODE_COPY(p, str->str, str->length); - done = str->length; - } - while (done < nchars) { - Py_ssize_t n = (done <= nchars-done) ? done : nchars-done; - Py_UNICODE_COPY(p+done, p, n); - done += n; - } - } - - return (PyObject*) u; -} - -PyObject *PyUnicode_Replace(PyObject *obj, - PyObject *subobj, - PyObject *replobj, - Py_ssize_t maxcount) -{ - PyObject *self; - PyObject *str1; - PyObject *str2; - PyObject *result; - - self = PyUnicode_FromObject(obj); - if (self == NULL) - return NULL; - str1 = PyUnicode_FromObject(subobj); - if (str1 == NULL) { - Py_DECREF(self); - return NULL; - } - str2 = PyUnicode_FromObject(replobj); - if (str2 == NULL) { - Py_DECREF(self); - Py_DECREF(str1); - return NULL; - } - result = replace((PyUnicodeObject *)self, - (PyUnicodeObject *)str1, - (PyUnicodeObject *)str2, - maxcount); - Py_DECREF(self); - Py_DECREF(str1); - Py_DECREF(str2); - return result; -} - -PyDoc_STRVAR(replace__doc__, - "S.replace(old, new[, count]) -> unicode\n\ -\n\ -Return a copy of S with all occurrences of substring\n\ -old replaced by new. If the optional argument count is\n\ -given, only the first count occurrences are replaced."); - -static PyObject* -unicode_replace(PyUnicodeObject *self, PyObject *args) -{ - PyUnicodeObject *str1; - PyUnicodeObject *str2; - Py_ssize_t maxcount = -1; - PyObject *result; - - if (!PyArg_ParseTuple(args, "OO|n:replace", &str1, &str2, &maxcount)) - return NULL; - str1 = (PyUnicodeObject *)PyUnicode_FromObject((PyObject *)str1); - if (str1 == NULL) - return NULL; - str2 = (PyUnicodeObject *)PyUnicode_FromObject((PyObject *)str2); - if (str2 == NULL) { - Py_DECREF(str1); - return NULL; - } - - result = replace(self, str1, str2, maxcount); - - Py_DECREF(str1); - Py_DECREF(str2); - return result; -} - -static -PyObject *unicode_repr(PyObject *unicode) -{ - return unicodeescape_string(PyUnicode_AS_UNICODE(unicode), - PyUnicode_GET_SIZE(unicode), - 1); -} - -PyDoc_STRVAR(rfind__doc__, - "S.rfind(sub [,start [,end]]) -> int\n\ -\n\ -Return the highest index in S where substring sub is found,\n\ -such that sub is contained within S[start:end]. Optional\n\ -arguments start and end are interpreted as in slice notation.\n\ -\n\ -Return -1 on failure."); - -static PyObject * -unicode_rfind(PyUnicodeObject *self, PyObject *args) -{ - PyUnicodeObject *substring; - Py_ssize_t start; - Py_ssize_t end; - Py_ssize_t result; - - if (!stringlib_parse_args_finds_unicode("rfind", args, &substring, - &start, &end)) - return NULL; - - result = stringlib_rfind_slice( - PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self), - PyUnicode_AS_UNICODE(substring), PyUnicode_GET_SIZE(substring), - start, end - ); - - Py_DECREF(substring); - - return PyInt_FromSsize_t(result); -} - -PyDoc_STRVAR(rindex__doc__, - "S.rindex(sub [,start [,end]]) -> int\n\ -\n\ -Like S.rfind() but raise ValueError when the substring is not found."); - -static PyObject * -unicode_rindex(PyUnicodeObject *self, PyObject *args) -{ - PyUnicodeObject *substring; - Py_ssize_t start; - Py_ssize_t end; - Py_ssize_t result; - - if (!stringlib_parse_args_finds_unicode("rindex", args, &substring, - &start, &end)) - return NULL; - - result = stringlib_rfind_slice( - PyUnicode_AS_UNICODE(self), PyUnicode_GET_SIZE(self), - PyUnicode_AS_UNICODE(substring), PyUnicode_GET_SIZE(substring), - start, end - ); - - Py_DECREF(substring); - - if (result < 0) { - PyErr_SetString(PyExc_ValueError, "substring not found"); - return NULL; - } - return PyInt_FromSsize_t(result); -} - -PyDoc_STRVAR(rjust__doc__, - "S.rjust(width[, fillchar]) -> unicode\n\ -\n\ -Return S right-justified in a Unicode string of length width. Padding is\n\ -done using the specified fill character (default is a space)."); - -static PyObject * -unicode_rjust(PyUnicodeObject *self, PyObject *args) -{ - Py_ssize_t width; - Py_UNICODE fillchar = ' '; - - if (!PyArg_ParseTuple(args, "n|O&:rjust", &width, convert_uc, &fillchar)) - return NULL; - - if (self->length >= width && PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - - return (PyObject*) pad(self, width - self->length, 0, fillchar); -} - -static PyObject* -unicode_slice(PyUnicodeObject *self, Py_ssize_t start, Py_ssize_t end) -{ - /* standard clamping */ - if (start < 0) - start = 0; - if (end < 0) - end = 0; - if (end > self->length) - end = self->length; - if (start == 0 && end == self->length && PyUnicode_CheckExact(self)) { - /* full slice, return original string */ - Py_INCREF(self); - return (PyObject*) self; - } - if (start > end) - start = end; - /* copy slice */ - return (PyObject*) PyUnicode_FromUnicode(self->str + start, - end - start); -} - -PyObject *PyUnicode_Split(PyObject *s, - PyObject *sep, - Py_ssize_t maxsplit) -{ - PyObject *result; - - s = PyUnicode_FromObject(s); - if (s == NULL) - return NULL; - if (sep != NULL) { - sep = PyUnicode_FromObject(sep); - if (sep == NULL) { - Py_DECREF(s); - return NULL; - } - } - - result = split((PyUnicodeObject *)s, (PyUnicodeObject *)sep, maxsplit); - - Py_DECREF(s); - Py_XDECREF(sep); - return result; -} - -PyDoc_STRVAR(split__doc__, - "S.split([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in S, using sep as the\n\ -delimiter string. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified or is None, any\n\ -whitespace string is a separator and empty strings are\n\ -removed from the result."); - -static PyObject* -unicode_split(PyUnicodeObject *self, PyObject *args) -{ - PyObject *substring = Py_None; - Py_ssize_t maxcount = -1; - - if (!PyArg_ParseTuple(args, "|On:split", &substring, &maxcount)) - return NULL; - - if (substring == Py_None) - return split(self, NULL, maxcount); - else if (PyUnicode_Check(substring)) - return split(self, (PyUnicodeObject *)substring, maxcount); - else - return PyUnicode_Split((PyObject *)self, substring, maxcount); -} - -PyObject * -PyUnicode_Partition(PyObject *str_in, PyObject *sep_in) -{ - PyObject* str_obj; - PyObject* sep_obj; - PyObject* out; - - str_obj = PyUnicode_FromObject(str_in); - if (!str_obj) - return NULL; - sep_obj = PyUnicode_FromObject(sep_in); - if (!sep_obj) { - Py_DECREF(str_obj); - return NULL; - } - - out = stringlib_partition( - str_obj, PyUnicode_AS_UNICODE(str_obj), PyUnicode_GET_SIZE(str_obj), - sep_obj, PyUnicode_AS_UNICODE(sep_obj), PyUnicode_GET_SIZE(sep_obj) - ); - - Py_DECREF(sep_obj); - Py_DECREF(str_obj); - - return out; -} - - -PyObject * -PyUnicode_RPartition(PyObject *str_in, PyObject *sep_in) -{ - PyObject* str_obj; - PyObject* sep_obj; - PyObject* out; - - str_obj = PyUnicode_FromObject(str_in); - if (!str_obj) - return NULL; - sep_obj = PyUnicode_FromObject(sep_in); - if (!sep_obj) { - Py_DECREF(str_obj); - return NULL; - } - - out = stringlib_rpartition( - str_obj, PyUnicode_AS_UNICODE(str_obj), PyUnicode_GET_SIZE(str_obj), - sep_obj, PyUnicode_AS_UNICODE(sep_obj), PyUnicode_GET_SIZE(sep_obj) - ); - - Py_DECREF(sep_obj); - Py_DECREF(str_obj); - - return out; -} - -PyDoc_STRVAR(partition__doc__, - "S.partition(sep) -> (head, sep, tail)\n\ -\n\ -Search for the separator sep in S, and return the part before it,\n\ -the separator itself, and the part after it. If the separator is not\n\ -found, return S and two empty strings."); - -static PyObject* -unicode_partition(PyUnicodeObject *self, PyObject *separator) -{ - return PyUnicode_Partition((PyObject *)self, separator); -} - -PyDoc_STRVAR(rpartition__doc__, - "S.rpartition(sep) -> (head, sep, tail)\n\ -\n\ -Search for the separator sep in S, starting at the end of S, and return\n\ -the part before it, the separator itself, and the part after it. If the\n\ -separator is not found, return two empty strings and S."); - -static PyObject* -unicode_rpartition(PyUnicodeObject *self, PyObject *separator) -{ - return PyUnicode_RPartition((PyObject *)self, separator); -} - -PyObject *PyUnicode_RSplit(PyObject *s, - PyObject *sep, - Py_ssize_t maxsplit) -{ - PyObject *result; - - s = PyUnicode_FromObject(s); - if (s == NULL) - return NULL; - if (sep != NULL) { - sep = PyUnicode_FromObject(sep); - if (sep == NULL) { - Py_DECREF(s); - return NULL; - } - } - - result = rsplit((PyUnicodeObject *)s, (PyUnicodeObject *)sep, maxsplit); - - Py_DECREF(s); - Py_XDECREF(sep); - return result; -} - -PyDoc_STRVAR(rsplit__doc__, - "S.rsplit([sep [,maxsplit]]) -> list of strings\n\ -\n\ -Return a list of the words in S, using sep as the\n\ -delimiter string, starting at the end of the string and\n\ -working to the front. If maxsplit is given, at most maxsplit\n\ -splits are done. If sep is not specified, any whitespace string\n\ -is a separator."); - -static PyObject* -unicode_rsplit(PyUnicodeObject *self, PyObject *args) -{ - PyObject *substring = Py_None; - Py_ssize_t maxcount = -1; - - if (!PyArg_ParseTuple(args, "|On:rsplit", &substring, &maxcount)) - return NULL; - - if (substring == Py_None) - return rsplit(self, NULL, maxcount); - else if (PyUnicode_Check(substring)) - return rsplit(self, (PyUnicodeObject *)substring, maxcount); - else - return PyUnicode_RSplit((PyObject *)self, substring, maxcount); -} - -PyDoc_STRVAR(splitlines__doc__, - "S.splitlines(keepends=False) -> list of strings\n\ -\n\ -Return a list of the lines in S, breaking at line boundaries.\n\ -Line breaks are not included in the resulting list unless keepends\n\ -is given and true."); - -static PyObject* -unicode_splitlines(PyUnicodeObject *self, PyObject *args) -{ - int keepends = 0; - - if (!PyArg_ParseTuple(args, "|i:splitlines", &keepends)) - return NULL; - - return PyUnicode_Splitlines((PyObject *)self, keepends); -} - -static -PyObject *unicode_str(PyUnicodeObject *self) -{ - return PyUnicode_AsEncodedString((PyObject *)self, NULL, NULL); -} - -PyDoc_STRVAR(swapcase__doc__, - "S.swapcase() -> unicode\n\ -\n\ -Return a copy of S with uppercase characters converted to lowercase\n\ -and vice versa."); - -static PyObject* -unicode_swapcase(PyUnicodeObject *self) -{ - return fixup(self, fixswapcase); -} - -PyDoc_STRVAR(translate__doc__, - "S.translate(table) -> unicode\n\ -\n\ -Return a copy of the string S, where all characters have been mapped\n\ -through the given translation table, which must be a mapping of\n\ -Unicode ordinals to Unicode ordinals, Unicode strings or None.\n\ -Unmapped characters are left untouched. Characters mapped to None\n\ -are deleted."); - -static PyObject* -unicode_translate(PyUnicodeObject *self, PyObject *table) -{ - return PyUnicode_TranslateCharmap(self->str, - self->length, - table, - "ignore"); -} - -PyDoc_STRVAR(upper__doc__, - "S.upper() -> unicode\n\ -\n\ -Return a copy of S converted to uppercase."); - -static PyObject* -unicode_upper(PyUnicodeObject *self) -{ - return fixup(self, fixupper); -} - -PyDoc_STRVAR(zfill__doc__, - "S.zfill(width) -> unicode\n\ -\n\ -Pad a numeric string S with zeros on the left, to fill a field\n\ -of the specified width. The string S is never truncated."); - -static PyObject * -unicode_zfill(PyUnicodeObject *self, PyObject *args) -{ - Py_ssize_t fill; - PyUnicodeObject *u; - - Py_ssize_t width; - if (!PyArg_ParseTuple(args, "n:zfill", &width)) - return NULL; - - if (self->length >= width) { - if (PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject*) self; - } - else - return PyUnicode_FromUnicode( - PyUnicode_AS_UNICODE(self), - PyUnicode_GET_SIZE(self) - ); - } - - fill = width - self->length; - - u = pad(self, fill, 0, '0'); - - if (u == NULL) - return NULL; - - if (u->str[fill] == '+' || u->str[fill] == '-') { - /* move sign to beginning of string */ - u->str[0] = u->str[fill]; - u->str[fill] = '0'; - } - - return (PyObject*) u; -} - -#if 0 -static PyObject* -free_listsize(PyUnicodeObject *self) -{ - return PyInt_FromLong(numfree); -} -#endif - -PyDoc_STRVAR(startswith__doc__, - "S.startswith(prefix[, start[, end]]) -> bool\n\ -\n\ -Return True if S starts with the specified prefix, False otherwise.\n\ -With optional start, test S beginning at that position.\n\ -With optional end, stop comparing S at that position.\n\ -prefix can also be a tuple of strings to try."); - -static PyObject * -unicode_startswith(PyUnicodeObject *self, - PyObject *args) -{ - PyObject *subobj; - PyUnicodeObject *substring; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - int result; - - if (!stringlib_parse_args_finds("startswith", args, &subobj, &start, &end)) - return NULL; - if (PyTuple_Check(subobj)) { - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { - substring = (PyUnicodeObject *)PyUnicode_FromObject( - PyTuple_GET_ITEM(subobj, i)); - if (substring == NULL) - return NULL; - result = tailmatch(self, substring, start, end, -1); - Py_DECREF(substring); - if (result) { - Py_RETURN_TRUE; - } - } - /* nothing matched */ - Py_RETURN_FALSE; - } - substring = (PyUnicodeObject *)PyUnicode_FromObject(subobj); - if (substring == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, "startswith first arg must be str, " - "unicode, or tuple, not %s", Py_TYPE(subobj)->tp_name); - return NULL; - } - result = tailmatch(self, substring, start, end, -1); - Py_DECREF(substring); - return PyBool_FromLong(result); -} - - -PyDoc_STRVAR(endswith__doc__, - "S.endswith(suffix[, start[, end]]) -> bool\n\ -\n\ -Return True if S ends with the specified suffix, False otherwise.\n\ -With optional start, test S beginning at that position.\n\ -With optional end, stop comparing S at that position.\n\ -suffix can also be a tuple of strings to try."); - -static PyObject * -unicode_endswith(PyUnicodeObject *self, - PyObject *args) -{ - PyObject *subobj; - PyUnicodeObject *substring; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - int result; - - if (!stringlib_parse_args_finds("endswith", args, &subobj, &start, &end)) - return NULL; - if (PyTuple_Check(subobj)) { - Py_ssize_t i; - for (i = 0; i < PyTuple_GET_SIZE(subobj); i++) { - substring = (PyUnicodeObject *)PyUnicode_FromObject( - PyTuple_GET_ITEM(subobj, i)); - if (substring == NULL) - return NULL; - result = tailmatch(self, substring, start, end, +1); - Py_DECREF(substring); - if (result) { - Py_RETURN_TRUE; - } - } - Py_RETURN_FALSE; - } - substring = (PyUnicodeObject *)PyUnicode_FromObject(subobj); - if (substring == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, "endswith first arg must be str, " - "unicode, or tuple, not %s", Py_TYPE(subobj)->tp_name); - return NULL; - } - result = tailmatch(self, substring, start, end, +1); - Py_DECREF(substring); - return PyBool_FromLong(result); -} - - -/* Implements do_string_format, which is unicode because of stringlib */ -#include "stringlib/string_format.h" - -PyDoc_STRVAR(format__doc__, - "S.format(*args, **kwargs) -> unicode\n\ -\n\ -Return a formatted version of S, using substitutions from args and kwargs.\n\ -The substitutions are identified by braces ('{' and '}')."); - -static PyObject * -unicode__format__(PyObject *self, PyObject *args) -{ - PyObject *format_spec; - PyObject *result = NULL; - PyObject *tmp = NULL; - - /* If 2.x, convert format_spec to the same type as value */ - /* This is to allow things like u''.format('') */ - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - goto done; - if (!(PyBytes_Check(format_spec) || PyUnicode_Check(format_spec))) { - PyErr_Format(PyExc_TypeError, "__format__ arg must be str " - "or unicode, not %s", Py_TYPE(format_spec)->tp_name); - goto done; - } - tmp = PyObject_Unicode(format_spec); - if (tmp == NULL) - goto done; - format_spec = tmp; - - result = _PyUnicode_FormatAdvanced(self, - PyUnicode_AS_UNICODE(format_spec), - PyUnicode_GET_SIZE(format_spec)); - done: - Py_XDECREF(tmp); - return result; -} - -PyDoc_STRVAR(p_format__doc__, - "S.__format__(format_spec) -> unicode\n\ -\n\ -Return a formatted version of S as described by format_spec."); - -static PyObject * -unicode__sizeof__(PyUnicodeObject *v) -{ - return PyInt_FromSsize_t(sizeof(PyUnicodeObject) + - sizeof(Py_UNICODE) * (v->length + 1)); -} - -PyDoc_STRVAR(sizeof__doc__, - "S.__sizeof__() -> size of S in memory, in bytes\n\ -\n\ -"); - -static PyObject * -unicode_getnewargs(PyUnicodeObject *v) -{ - return Py_BuildValue("(u#)", v->str, v->length); -} - - -static PyMethodDef unicode_methods[] = { - {"encode", (PyCFunction) unicode_encode, METH_VARARGS | METH_KEYWORDS, encode__doc__}, - {"replace", (PyCFunction) unicode_replace, METH_VARARGS, replace__doc__}, - {"split", (PyCFunction) unicode_split, METH_VARARGS, split__doc__}, - {"rsplit", (PyCFunction) unicode_rsplit, METH_VARARGS, rsplit__doc__}, - {"join", (PyCFunction) unicode_join, METH_O, join__doc__}, - {"capitalize", (PyCFunction) unicode_capitalize, METH_NOARGS, capitalize__doc__}, - {"title", (PyCFunction) unicode_title, METH_NOARGS, title__doc__}, - {"center", (PyCFunction) unicode_center, METH_VARARGS, center__doc__}, - {"count", (PyCFunction) unicode_count, METH_VARARGS, count__doc__}, - {"expandtabs", (PyCFunction) unicode_expandtabs, METH_VARARGS, expandtabs__doc__}, - {"find", (PyCFunction) unicode_find, METH_VARARGS, find__doc__}, - {"partition", (PyCFunction) unicode_partition, METH_O, partition__doc__}, - {"index", (PyCFunction) unicode_index, METH_VARARGS, index__doc__}, - {"ljust", (PyCFunction) unicode_ljust, METH_VARARGS, ljust__doc__}, - {"lower", (PyCFunction) unicode_lower, METH_NOARGS, lower__doc__}, - {"lstrip", (PyCFunction) unicode_lstrip, METH_VARARGS, lstrip__doc__}, - {"decode", (PyCFunction) unicode_decode, METH_VARARGS | METH_KEYWORDS, decode__doc__}, -/* {"maketrans", (PyCFunction) unicode_maketrans, METH_VARARGS, maketrans__doc__}, */ - {"rfind", (PyCFunction) unicode_rfind, METH_VARARGS, rfind__doc__}, - {"rindex", (PyCFunction) unicode_rindex, METH_VARARGS, rindex__doc__}, - {"rjust", (PyCFunction) unicode_rjust, METH_VARARGS, rjust__doc__}, - {"rstrip", (PyCFunction) unicode_rstrip, METH_VARARGS, rstrip__doc__}, - {"rpartition", (PyCFunction) unicode_rpartition, METH_O, rpartition__doc__}, - {"splitlines", (PyCFunction) unicode_splitlines, METH_VARARGS, splitlines__doc__}, - {"strip", (PyCFunction) unicode_strip, METH_VARARGS, strip__doc__}, - {"swapcase", (PyCFunction) unicode_swapcase, METH_NOARGS, swapcase__doc__}, - {"translate", (PyCFunction) unicode_translate, METH_O, translate__doc__}, - {"upper", (PyCFunction) unicode_upper, METH_NOARGS, upper__doc__}, - {"startswith", (PyCFunction) unicode_startswith, METH_VARARGS, startswith__doc__}, - {"endswith", (PyCFunction) unicode_endswith, METH_VARARGS, endswith__doc__}, - {"islower", (PyCFunction) unicode_islower, METH_NOARGS, islower__doc__}, - {"isupper", (PyCFunction) unicode_isupper, METH_NOARGS, isupper__doc__}, - {"istitle", (PyCFunction) unicode_istitle, METH_NOARGS, istitle__doc__}, - {"isspace", (PyCFunction) unicode_isspace, METH_NOARGS, isspace__doc__}, - {"isdecimal", (PyCFunction) unicode_isdecimal, METH_NOARGS, isdecimal__doc__}, - {"isdigit", (PyCFunction) unicode_isdigit, METH_NOARGS, isdigit__doc__}, - {"isnumeric", (PyCFunction) unicode_isnumeric, METH_NOARGS, isnumeric__doc__}, - {"isalpha", (PyCFunction) unicode_isalpha, METH_NOARGS, isalpha__doc__}, - {"isalnum", (PyCFunction) unicode_isalnum, METH_NOARGS, isalnum__doc__}, - {"zfill", (PyCFunction) unicode_zfill, METH_VARARGS, zfill__doc__}, - {"format", (PyCFunction) do_string_format, METH_VARARGS | METH_KEYWORDS, format__doc__}, - {"__format__", (PyCFunction) unicode__format__, METH_VARARGS, p_format__doc__}, - {"_formatter_field_name_split", (PyCFunction) formatter_field_name_split, METH_NOARGS}, - {"_formatter_parser", (PyCFunction) formatter_parser, METH_NOARGS}, - {"__sizeof__", (PyCFunction) unicode__sizeof__, METH_NOARGS, sizeof__doc__}, -#if 0 - {"capwords", (PyCFunction) unicode_capwords, METH_NOARGS, capwords__doc__}, -#endif - -#if 0 - /* This one is just used for debugging the implementation. */ - {"freelistsize", (PyCFunction) free_listsize, METH_NOARGS}, -#endif - - {"__getnewargs__", (PyCFunction)unicode_getnewargs, METH_NOARGS}, - {NULL, NULL} -}; - -static PyObject * -unicode_mod(PyObject *v, PyObject *w) -{ - if (!PyUnicode_Check(v)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - return PyUnicode_Format(v, w); -} - -static PyNumberMethods unicode_as_number = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - 0, /*nb_divide*/ - unicode_mod, /*nb_remainder*/ -}; - -static PySequenceMethods unicode_as_sequence = { - (lenfunc) unicode_length, /* sq_length */ - PyUnicode_Concat, /* sq_concat */ - (ssizeargfunc) unicode_repeat, /* sq_repeat */ - (ssizeargfunc) unicode_getitem, /* sq_item */ - (ssizessizeargfunc) unicode_slice, /* sq_slice */ - 0, /* sq_ass_item */ - 0, /* sq_ass_slice */ - PyUnicode_Contains, /* sq_contains */ -}; - -static PyObject* -unicode_subscript(PyUnicodeObject* self, PyObject* item) -{ - if (PyIndex_Check(item)) { - Py_ssize_t i = PyNumber_AsSsize_t(item, PyExc_IndexError); - if (i == -1 && PyErr_Occurred()) - return NULL; - if (i < 0) - i += PyUnicode_GET_SIZE(self); - return unicode_getitem(self, i); - } else if (PySlice_Check(item)) { - Py_ssize_t start, stop, step, slicelength, cur, i; - Py_UNICODE* source_buf; - Py_UNICODE* result_buf; - PyObject* result; - - if (PySlice_GetIndicesEx((PySliceObject*)item, PyUnicode_GET_SIZE(self), - &start, &stop, &step, &slicelength) < 0) { - return NULL; - } - - if (slicelength <= 0) { - return PyUnicode_FromUnicode(NULL, 0); - } else if (start == 0 && step == 1 && slicelength == self->length && - PyUnicode_CheckExact(self)) { - Py_INCREF(self); - return (PyObject *)self; - } else if (step == 1) { - return PyUnicode_FromUnicode(self->str + start, slicelength); - } else { - source_buf = PyUnicode_AS_UNICODE((PyObject*)self); - result_buf = (Py_UNICODE *)PyObject_MALLOC(slicelength* - sizeof(Py_UNICODE)); - - if (result_buf == NULL) - return PyErr_NoMemory(); - - for (cur = start, i = 0; i < slicelength; cur += step, i++) { - result_buf[i] = source_buf[cur]; - } - - result = PyUnicode_FromUnicode(result_buf, slicelength); - PyObject_FREE(result_buf); - return result; - } - } else { - PyErr_SetString(PyExc_TypeError, "string indices must be integers"); - return NULL; - } -} - -static PyMappingMethods unicode_as_mapping = { - (lenfunc)unicode_length, /* mp_length */ - (binaryfunc)unicode_subscript, /* mp_subscript */ - (objobjargproc)0, /* mp_ass_subscript */ -}; - -static Py_ssize_t -unicode_buffer_getreadbuf(PyUnicodeObject *self, - Py_ssize_t index, - const void **ptr) -{ - if (index != 0) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent unicode segment"); - return -1; - } - *ptr = (void *) self->str; - return PyUnicode_GET_DATA_SIZE(self); -} - -static Py_ssize_t -unicode_buffer_getwritebuf(PyUnicodeObject *self, Py_ssize_t index, - const void **ptr) -{ - PyErr_SetString(PyExc_TypeError, - "cannot use unicode as modifiable buffer"); - return -1; -} - -static int -unicode_buffer_getsegcount(PyUnicodeObject *self, - Py_ssize_t *lenp) -{ - if (lenp) - *lenp = PyUnicode_GET_DATA_SIZE(self); - return 1; -} - -static Py_ssize_t -unicode_buffer_getcharbuf(PyUnicodeObject *self, - Py_ssize_t index, - const void **ptr) -{ - PyObject *str; - - if (index != 0) { - PyErr_SetString(PyExc_SystemError, - "accessing non-existent unicode segment"); - return -1; - } - str = _PyUnicode_AsDefaultEncodedString((PyObject *)self, NULL); - if (str == NULL) - return -1; - *ptr = (void *) PyString_AS_STRING(str); - return PyString_GET_SIZE(str); -} - -/* Helpers for PyUnicode_Format() */ - -static PyObject * -getnextarg(PyObject *args, Py_ssize_t arglen, Py_ssize_t *p_argidx) -{ - Py_ssize_t argidx = *p_argidx; - if (argidx < arglen) { - (*p_argidx)++; - if (arglen < 0) - return args; - else - return PyTuple_GetItem(args, argidx); - } - PyErr_SetString(PyExc_TypeError, - "not enough arguments for format string"); - return NULL; -} - -#define F_LJUST (1<<0) -#define F_SIGN (1<<1) -#define F_BLANK (1<<2) -#define F_ALT (1<<3) -#define F_ZERO (1<<4) - -static Py_ssize_t -strtounicode(Py_UNICODE *buffer, const char *charbuffer) -{ - register Py_ssize_t i; - Py_ssize_t len = strlen(charbuffer); - for (i = len - 1; i >= 0; i--) - buffer[i] = (Py_UNICODE) charbuffer[i]; - - return len; -} - -static int -longtounicode(Py_UNICODE *buffer, size_t len, const char *format, long x) -{ - Py_ssize_t result; - - PyOS_snprintf((char *)buffer, len, format, x); - result = strtounicode(buffer, (char *)buffer); - return Py_SAFE_DOWNCAST(result, Py_ssize_t, int); -} - -/* XXX To save some code duplication, formatfloat/long/int could have been - shared with stringobject.c, converting from 8-bit to Unicode after the - formatting is done. */ - -/* Returns a new reference to a PyUnicode object, or NULL on failure. */ - -static PyObject * -formatfloat(PyObject *v, int flags, int prec, int type) -{ - char *p; - PyObject *result; - double x; - - x = PyFloat_AsDouble(v); - if (x == -1.0 && PyErr_Occurred()) - return NULL; - - if (prec < 0) - prec = 6; - - p = PyOS_double_to_string(x, type, prec, - (flags & F_ALT) ? Py_DTSF_ALT : 0, NULL); - if (p == NULL) - return NULL; - result = PyUnicode_FromStringAndSize(p, strlen(p)); - PyMem_Free(p); - return result; -} - -static PyObject* -formatlong(PyObject *val, int flags, int prec, int type) -{ - char *buf; - int i, len; - PyObject *str; /* temporary string object. */ - PyUnicodeObject *result; - - str = _PyString_FormatLong(val, flags, prec, type, &buf, &len); - if (!str) - return NULL; - result = _PyUnicode_New(len); - if (!result) { - Py_DECREF(str); - return NULL; - } - for (i = 0; i < len; i++) - result->str[i] = buf[i]; - result->str[len] = 0; - Py_DECREF(str); - return (PyObject*)result; -} - -static int -formatint(Py_UNICODE *buf, - size_t buflen, - int flags, - int prec, - int type, - PyObject *v) -{ - /* fmt = '%#.' + `prec` + 'l' + `type` - * worst case length = 3 + 19 (worst len of INT_MAX on 64-bit machine) - * + 1 + 1 - * = 24 - */ - char fmt[64]; /* plenty big enough! */ - char *sign; - long x; - - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) - return -1; - if (x < 0 && type == 'u') { - type = 'd'; - } - if (x < 0 && (type == 'x' || type == 'X' || type == 'o')) - sign = "-"; - else - sign = ""; - if (prec < 0) - prec = 1; - - /* buf = '+'/'-'/'' + '0'/'0x'/'' + '[0-9]'*max(prec, len(x in octal)) - * worst case buf = '-0x' + [0-9]*prec, where prec >= 11 - */ - if (buflen <= 14 || buflen <= (size_t)3 + (size_t)prec) { - PyErr_SetString(PyExc_OverflowError, - "formatted integer is too long (precision too large?)"); - return -1; - } - - if ((flags & F_ALT) && - (type == 'x' || type == 'X')) { - /* When converting under %#x or %#X, there are a number - * of issues that cause pain: - * - when 0 is being converted, the C standard leaves off - * the '0x' or '0X', which is inconsistent with other - * %#x/%#X conversions and inconsistent with Python's - * hex() function - * - there are platforms that violate the standard and - * convert 0 with the '0x' or '0X' - * (Metrowerks, Compaq Tru64) - * - there are platforms that give '0x' when converting - * under %#X, but convert 0 in accordance with the - * standard (OS/2 EMX) - * - * We can achieve the desired consistency by inserting our - * own '0x' or '0X' prefix, and substituting %x/%X in place - * of %#x/%#X. - * - * Note that this is the same approach as used in - * formatint() in stringobject.c - */ - PyOS_snprintf(fmt, sizeof(fmt), "%s0%c%%.%dl%c", - sign, type, prec, type); - } - else { - PyOS_snprintf(fmt, sizeof(fmt), "%s%%%s.%dl%c", - sign, (flags&F_ALT) ? "#" : "", - prec, type); - } - if (sign[0]) - return longtounicode(buf, buflen, fmt, -x); - else - return longtounicode(buf, buflen, fmt, x); -} - -static int -formatchar(Py_UNICODE *buf, - size_t buflen, - PyObject *v) -{ - PyObject *unistr; - char *str; - /* presume that the buffer is at least 2 characters long */ - if (PyUnicode_Check(v)) { - if (PyUnicode_GET_SIZE(v) != 1) - goto onError; - buf[0] = PyUnicode_AS_UNICODE(v)[0]; - } - - else if (PyString_Check(v)) { - if (PyString_GET_SIZE(v) != 1) - goto onError; - /* #7649: "u'%c' % char" should behave like "u'%s' % char" and fail - with a UnicodeDecodeError if 'char' is not decodable with the - default encoding (usually ASCII, but it might be something else) */ - str = PyString_AS_STRING(v); - if ((unsigned char)str[0] > 0x7F) { - /* the char is not ASCII; try to decode the string using the - default encoding and return -1 to let the UnicodeDecodeError - be raised if the string can't be decoded */ - unistr = PyUnicode_Decode(str, 1, NULL, "strict"); - if (unistr == NULL) - return -1; - buf[0] = PyUnicode_AS_UNICODE(unistr)[0]; - Py_DECREF(unistr); - } - else - buf[0] = (Py_UNICODE)str[0]; - } - - else { - /* Integer input truncated to a character */ - long x; - x = PyInt_AsLong(v); - if (x == -1 && PyErr_Occurred()) - goto onError; -#ifdef Py_UNICODE_WIDE - if (x < 0 || x > 0x10ffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x110000) " - "(wide Python build)"); - return -1; - } -#else - if (x < 0 || x > 0xffff) { - PyErr_SetString(PyExc_OverflowError, - "%c arg not in range(0x10000) " - "(narrow Python build)"); - return -1; - } -#endif - buf[0] = (Py_UNICODE) x; - } - buf[1] = '\0'; - return 1; - - onError: - PyErr_SetString(PyExc_TypeError, - "%c requires int or char"); - return -1; -} - -/* fmt%(v1,v2,...) is roughly equivalent to sprintf(fmt, v1, v2, ...) - - FORMATBUFLEN is the length of the buffer in which the ints & - chars are formatted. XXX This is a magic number. Each formatting - routine does bounds checking to ensure no overflow, but a better - solution may be to malloc a buffer of appropriate size for each - format. For now, the current solution is sufficient. -*/ -#define FORMATBUFLEN (size_t)120 - -PyObject *PyUnicode_Format(PyObject *format, - PyObject *args) -{ - Py_UNICODE *fmt, *res; - Py_ssize_t fmtcnt, rescnt, reslen, arglen, argidx; - int args_owned = 0; - PyUnicodeObject *result = NULL; - PyObject *dict = NULL; - PyObject *uformat; - - if (format == NULL || args == NULL) { - PyErr_BadInternalCall(); - return NULL; - } - uformat = PyUnicode_FromObject(format); - if (uformat == NULL) - return NULL; - fmt = PyUnicode_AS_UNICODE(uformat); - fmtcnt = PyUnicode_GET_SIZE(uformat); - - reslen = rescnt = fmtcnt + 100; - result = _PyUnicode_New(reslen); - if (result == NULL) - goto onError; - res = PyUnicode_AS_UNICODE(result); - - if (PyTuple_Check(args)) { - arglen = PyTuple_Size(args); - argidx = 0; - } - else { - arglen = -1; - argidx = -2; - } - if (Py_TYPE(args)->tp_as_mapping && Py_TYPE(args)->tp_as_mapping->mp_subscript && - !PyTuple_Check(args) && !PyObject_TypeCheck(args, &PyBaseString_Type)) - dict = args; - - while (--fmtcnt >= 0) { - if (*fmt != '%') { - if (--rescnt < 0) { - rescnt = fmtcnt + 100; - reslen += rescnt; - if (_PyUnicode_Resize(&result, reslen) < 0) - goto onError; - res = PyUnicode_AS_UNICODE(result) + reslen - rescnt; - --rescnt; - } - *res++ = *fmt++; - } - else { - /* Got a format specifier */ - int flags = 0; - Py_ssize_t width = -1; - int prec = -1; - Py_UNICODE c = '\0'; - Py_UNICODE fill; - int isnumok; - PyObject *v = NULL; - PyObject *temp = NULL; - Py_UNICODE *pbuf; - Py_UNICODE sign; - Py_ssize_t len; - Py_UNICODE formatbuf[FORMATBUFLEN]; /* For format{int,char}() */ - - fmt++; - if (*fmt == '(') { - Py_UNICODE *keystart; - Py_ssize_t keylen; - PyObject *key; - int pcount = 1; - - if (dict == NULL) { - PyErr_SetString(PyExc_TypeError, - "format requires a mapping"); - goto onError; - } - ++fmt; - --fmtcnt; - keystart = fmt; - /* Skip over balanced parentheses */ - while (pcount > 0 && --fmtcnt >= 0) { - if (*fmt == ')') - --pcount; - else if (*fmt == '(') - ++pcount; - fmt++; - } - keylen = fmt - keystart - 1; - if (fmtcnt < 0 || pcount > 0) { - PyErr_SetString(PyExc_ValueError, - "incomplete format key"); - goto onError; - } -#if 0 - /* keys are converted to strings using UTF-8 and - then looked up since Python uses strings to hold - variables names etc. in its namespaces and we - wouldn't want to break common idioms. */ - key = PyUnicode_EncodeUTF8(keystart, - keylen, - NULL); -#else - key = PyUnicode_FromUnicode(keystart, keylen); -#endif - if (key == NULL) - goto onError; - if (args_owned) { - Py_DECREF(args); - args_owned = 0; - } - args = PyObject_GetItem(dict, key); - Py_DECREF(key); - if (args == NULL) { - goto onError; - } - args_owned = 1; - arglen = -1; - argidx = -2; - } - while (--fmtcnt >= 0) { - switch (c = *fmt++) { - case '-': flags |= F_LJUST; continue; - case '+': flags |= F_SIGN; continue; - case ' ': flags |= F_BLANK; continue; - case '#': flags |= F_ALT; continue; - case '0': flags |= F_ZERO; continue; - } - break; - } - if (c == '*') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto onError; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto onError; - } - width = PyInt_AsSsize_t(v); - if (width == -1 && PyErr_Occurred()) - goto onError; - if (width < 0) { - flags |= F_LJUST; - width = -width; - } - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= '0' && c <= '9') { - width = c - '0'; - while (--fmtcnt >= 0) { - c = *fmt++; - if (c < '0' || c > '9') - break; - if (width > (PY_SSIZE_T_MAX - ((int)c - '0')) / 10) { - PyErr_SetString(PyExc_ValueError, - "width too big"); - goto onError; - } - width = width*10 + (c - '0'); - } - } - if (c == '.') { - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - if (c == '*') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto onError; - if (!PyInt_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "* wants int"); - goto onError; - } - prec = _PyInt_AsInt(v); - if (prec == -1 && PyErr_Occurred()) - goto onError; - if (prec < 0) - prec = 0; - if (--fmtcnt >= 0) - c = *fmt++; - } - else if (c >= '0' && c <= '9') { - prec = c - '0'; - while (--fmtcnt >= 0) { - c = *fmt++; - if (c < '0' || c > '9') - break; - if (prec > (INT_MAX - ((int)c - '0')) / 10) { - PyErr_SetString(PyExc_ValueError, - "prec too big"); - goto onError; - } - prec = prec*10 + (c - '0'); - } - } - } /* prec */ - if (fmtcnt >= 0) { - if (c == 'h' || c == 'l' || c == 'L') { - if (--fmtcnt >= 0) - c = *fmt++; - } - } - if (fmtcnt < 0) { - PyErr_SetString(PyExc_ValueError, - "incomplete format"); - goto onError; - } - if (c != '%') { - v = getnextarg(args, arglen, &argidx); - if (v == NULL) - goto onError; - } - sign = 0; - fill = ' '; - switch (c) { - - case '%': - pbuf = formatbuf; - /* presume that buffer length is at least 1 */ - pbuf[0] = '%'; - len = 1; - break; - - case 's': - case 'r': - if (PyUnicode_CheckExact(v) && c == 's') { - temp = v; - Py_INCREF(temp); - } - else { - PyObject *unicode; - if (c == 's') - temp = PyObject_Unicode(v); - else - temp = PyObject_Repr(v); - if (temp == NULL) - goto onError; - if (PyUnicode_Check(temp)) - /* nothing to do */; - else if (PyString_Check(temp)) { - /* convert to string to Unicode */ - unicode = PyUnicode_Decode(PyString_AS_STRING(temp), - PyString_GET_SIZE(temp), - NULL, - "strict"); - Py_DECREF(temp); - temp = unicode; - if (temp == NULL) - goto onError; - } - else { - Py_DECREF(temp); - PyErr_SetString(PyExc_TypeError, - "%s argument has non-string str()"); - goto onError; - } - } - pbuf = PyUnicode_AS_UNICODE(temp); - len = PyUnicode_GET_SIZE(temp); - if (prec >= 0 && len > prec) - len = prec; - break; - - case 'i': - case 'd': - case 'u': - case 'o': - case 'x': - case 'X': - if (c == 'i') - c = 'd'; - isnumok = 0; - if (PyNumber_Check(v)) { - PyObject *iobj=NULL; - - if (PyInt_Check(v) || (PyLong_Check(v))) { - iobj = v; - Py_INCREF(iobj); - } - else { - iobj = PyNumber_Int(v); - if (iobj==NULL) iobj = PyNumber_Long(v); - } - if (iobj!=NULL) { - if (PyInt_Check(iobj)) { - isnumok = 1; - pbuf = formatbuf; - len = formatint(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), - flags, prec, c, iobj); - Py_DECREF(iobj); - if (len < 0) - goto onError; - sign = 1; - } - else if (PyLong_Check(iobj)) { - isnumok = 1; - temp = formatlong(iobj, flags, prec, c); - Py_DECREF(iobj); - if (!temp) - goto onError; - pbuf = PyUnicode_AS_UNICODE(temp); - len = PyUnicode_GET_SIZE(temp); - sign = 1; - } - else { - Py_DECREF(iobj); - } - } - } - if (!isnumok) { - PyErr_Format(PyExc_TypeError, - "%%%c format: a number is required, " - "not %.200s", (char)c, Py_TYPE(v)->tp_name); - goto onError; - } - if (flags & F_ZERO) - fill = '0'; - break; - - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - temp = formatfloat(v, flags, prec, c); - if (temp == NULL) - goto onError; - pbuf = PyUnicode_AS_UNICODE(temp); - len = PyUnicode_GET_SIZE(temp); - sign = 1; - if (flags & F_ZERO) - fill = '0'; - break; - - case 'c': - pbuf = formatbuf; - len = formatchar(pbuf, sizeof(formatbuf)/sizeof(Py_UNICODE), v); - if (len < 0) - goto onError; - break; - - default: - PyErr_Format(PyExc_ValueError, - "unsupported format character '%c' (0x%x) " - "at index %zd", - (31<=c && c<=126) ? (char)c : '?', - (int)c, - (Py_ssize_t)(fmt - 1 - - PyUnicode_AS_UNICODE(uformat))); - goto onError; - } - if (sign) { - if (*pbuf == '-' || *pbuf == '+') { - sign = *pbuf++; - len--; - } - else if (flags & F_SIGN) - sign = '+'; - else if (flags & F_BLANK) - sign = ' '; - else - sign = 0; - } - if (width < len) - width = len; - if (rescnt - (sign != 0) < width) { - reslen -= rescnt; - rescnt = width + fmtcnt + 100; - reslen += rescnt; - if (reslen < 0) { - Py_XDECREF(temp); - PyErr_NoMemory(); - goto onError; - } - if (_PyUnicode_Resize(&result, reslen) < 0) { - Py_XDECREF(temp); - goto onError; - } - res = PyUnicode_AS_UNICODE(result) - + reslen - rescnt; - } - if (sign) { - if (fill != ' ') - *res++ = sign; - rescnt--; - if (width > len) - width--; - } - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - if (fill != ' ') { - *res++ = *pbuf++; - *res++ = *pbuf++; - } - rescnt -= 2; - width -= 2; - if (width < 0) - width = 0; - len -= 2; - } - if (width > len && !(flags & F_LJUST)) { - do { - --rescnt; - *res++ = fill; - } while (--width > len); - } - if (fill == ' ') { - if (sign) - *res++ = sign; - if ((flags & F_ALT) && (c == 'x' || c == 'X')) { - assert(pbuf[0] == '0'); - assert(pbuf[1] == c); - *res++ = *pbuf++; - *res++ = *pbuf++; - } - } - Py_UNICODE_COPY(res, pbuf, len); - res += len; - rescnt -= len; - while (--width >= len) { - --rescnt; - *res++ = ' '; - } - if (dict && (argidx < arglen) && c != '%') { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - Py_XDECREF(temp); - goto onError; - } - Py_XDECREF(temp); - } /* '%' */ - } /* until end */ - if (argidx < arglen && !dict) { - PyErr_SetString(PyExc_TypeError, - "not all arguments converted during string formatting"); - goto onError; - } - - if (_PyUnicode_Resize(&result, reslen - rescnt) < 0) - goto onError; - if (args_owned) { - Py_DECREF(args); - } - Py_DECREF(uformat); - return (PyObject *)result; - - onError: - Py_XDECREF(result); - Py_DECREF(uformat); - if (args_owned) { - Py_DECREF(args); - } - return NULL; -} - -static PyBufferProcs unicode_as_buffer = { - (readbufferproc) unicode_buffer_getreadbuf, - (writebufferproc) unicode_buffer_getwritebuf, - (segcountproc) unicode_buffer_getsegcount, - (charbufferproc) unicode_buffer_getcharbuf, -}; - -static PyObject * -unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -unicode_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - static char *kwlist[] = {"string", "encoding", "errors", 0}; - char *encoding = NULL; - char *errors = NULL; - - if (type != &PyUnicode_Type) - return unicode_subtype_new(type, args, kwds); - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oss:unicode", - kwlist, &x, &encoding, &errors)) - return NULL; - if (x == NULL) - return (PyObject *)_PyUnicode_New(0); - if (encoding == NULL && errors == NULL) - return PyObject_Unicode(x); - else - return PyUnicode_FromEncodedObject(x, encoding, errors); -} - -static PyObject * -unicode_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyUnicodeObject *tmp, *pnew; - Py_ssize_t n; - - assert(PyType_IsSubtype(type, &PyUnicode_Type)); - tmp = (PyUnicodeObject *)unicode_new(&PyUnicode_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyUnicode_Check(tmp)); - pnew = (PyUnicodeObject *) type->tp_alloc(type, n = tmp->length); - if (pnew == NULL) { - Py_DECREF(tmp); - return NULL; - } - pnew->str = (Py_UNICODE*) PyObject_MALLOC(sizeof(Py_UNICODE) * (n+1)); - if (pnew->str == NULL) { - _Py_ForgetReference((PyObject *)pnew); - PyObject_Del(pnew); - Py_DECREF(tmp); - return PyErr_NoMemory(); - } - Py_UNICODE_COPY(pnew->str, tmp->str, n+1); - pnew->length = n; - pnew->hash = tmp->hash; - Py_DECREF(tmp); - return (PyObject *)pnew; -} - -PyDoc_STRVAR(unicode_doc, - "unicode(object='') -> unicode object\n\ -unicode(string[, encoding[, errors]]) -> unicode object\n\ -\n\ -Create a new Unicode object from the given encoded string.\n\ -encoding defaults to the current default string encoding.\n\ -errors can be 'strict', 'replace' or 'ignore' and defaults to 'strict'."); - -PyTypeObject PyUnicode_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "unicode", /* tp_name */ - sizeof(PyUnicodeObject), /* tp_size */ - 0, /* tp_itemsize */ - /* Slots */ - (destructor)unicode_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - unicode_repr, /* tp_repr */ - &unicode_as_number, /* tp_as_number */ - &unicode_as_sequence, /* tp_as_sequence */ - &unicode_as_mapping, /* tp_as_mapping */ - (hashfunc) unicode_hash, /* tp_hash*/ - 0, /* tp_call*/ - (reprfunc) unicode_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - &unicode_as_buffer, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_UNICODE_SUBCLASS, /* tp_flags */ - unicode_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - PyUnicode_RichCompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - unicode_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &PyBaseString_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - unicode_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -/* Initialize the Unicode implementation */ - -void _PyUnicode_Init(void) -{ - /* XXX - move this array to unicodectype.c ? */ - Py_UNICODE linebreak[] = { - 0x000A, /* LINE FEED */ - 0x000D, /* CARRIAGE RETURN */ - 0x001C, /* FILE SEPARATOR */ - 0x001D, /* GROUP SEPARATOR */ - 0x001E, /* RECORD SEPARATOR */ - 0x0085, /* NEXT LINE */ - 0x2028, /* LINE SEPARATOR */ - 0x2029, /* PARAGRAPH SEPARATOR */ - }; - - /* Init the implementation */ - if (!unicode_empty) { - unicode_empty = _PyUnicode_New(0); - if (!unicode_empty) - return; - } - - if (PyType_Ready(&PyUnicode_Type) < 0) - Py_FatalError("Can't initialize 'unicode'"); - - /* initialize the linebreak bloom filter */ - bloom_linebreak = make_bloom_mask( - linebreak, sizeof(linebreak) / sizeof(linebreak[0]) - ); - - PyType_Ready(&EncodingMapType); - - if (PyType_Ready(&PyFieldNameIter_Type) < 0) - Py_FatalError("Can't initialize field name iterator type"); - - if (PyType_Ready(&PyFormatterIter_Type) < 0) - Py_FatalError("Can't initialize formatter iter type"); -} - -/* Finalize the Unicode implementation */ - -int -PyUnicode_ClearFreeList(void) -{ - int freelist_size = numfree; - PyUnicodeObject *u; - - for (u = free_list; u != NULL;) { - PyUnicodeObject *v = u; - u = *(PyUnicodeObject **)u; - if (v->str) - PyObject_DEL(v->str); - Py_XDECREF(v->defenc); - PyObject_Del(v); - numfree--; - } - free_list = NULL; - assert(numfree == 0); - return freelist_size; -} - -void -_PyUnicode_Fini(void) -{ - int i; - - Py_CLEAR(unicode_empty); - - for (i = 0; i < 256; i++) - Py_CLEAR(unicode_latin1[i]); - - (void)PyUnicode_ClearFreeList(); -} - -#ifdef __cplusplus -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodetype_db.h b/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodetype_db.h deleted file mode 100644 index 0423400..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/unicodetype_db.h +++ /dev/null @@ -1,3337 +0,0 @@ -/* this file was generated by Tools/unicode/makeunicodedata.py 2.6 */ - -/* a list of unique character type descriptors */ -const _PyUnicode_TypeRecord _PyUnicode_TypeRecords[] = { - {0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 0}, - {0, 0, 0, 0, 0, 32}, - {0, 0, 0, 0, 0, 48}, - {0, 0, 0, 0, 0, 518}, - {0, 0, 0, 1, 1, 518}, - {0, 0, 0, 2, 2, 518}, - {0, 0, 0, 3, 3, 518}, - {0, 0, 0, 4, 4, 518}, - {0, 0, 0, 5, 5, 518}, - {0, 0, 0, 6, 6, 518}, - {0, 0, 0, 7, 7, 518}, - {0, 0, 0, 8, 8, 518}, - {0, 0, 0, 9, 9, 518}, - {0, 32, 0, 0, 0, 129}, - {65504, 0, 65504, 0, 0, 9}, - {0, 0, 0, 0, 0, 9}, - {0, 0, 0, 0, 2, 516}, - {0, 0, 0, 0, 3, 516}, - {743, 0, 743, 0, 0, 9}, - {0, 0, 0, 0, 1, 516}, - {0, 0, 0, 0, 0, 512}, - {121, 0, 121, 0, 0, 9}, - {0, 1, 0, 0, 0, 129}, - {65535, 0, 65535, 0, 0, 9}, - {0, 65337, 0, 0, 0, 129}, - {65304, 0, 65304, 0, 0, 9}, - {0, 65415, 0, 0, 0, 129}, - {65236, 0, 65236, 0, 0, 9}, - {195, 0, 195, 0, 0, 9}, - {0, 210, 0, 0, 0, 129}, - {0, 206, 0, 0, 0, 129}, - {0, 205, 0, 0, 0, 129}, - {0, 79, 0, 0, 0, 129}, - {0, 202, 0, 0, 0, 129}, - {0, 203, 0, 0, 0, 129}, - {0, 207, 0, 0, 0, 129}, - {97, 0, 97, 0, 0, 9}, - {0, 211, 0, 0, 0, 129}, - {0, 209, 0, 0, 0, 129}, - {163, 0, 163, 0, 0, 9}, - {0, 213, 0, 0, 0, 129}, - {130, 0, 130, 0, 0, 9}, - {0, 214, 0, 0, 0, 129}, - {0, 218, 0, 0, 0, 129}, - {0, 217, 0, 0, 0, 129}, - {0, 219, 0, 0, 0, 129}, - {0, 0, 0, 0, 0, 1}, - {56, 0, 56, 0, 0, 9}, - {0, 2, 1, 0, 0, 129}, - {65535, 1, 0, 0, 0, 65}, - {65534, 0, 65535, 0, 0, 9}, - {65457, 0, 65457, 0, 0, 9}, - {0, 65439, 0, 0, 0, 129}, - {0, 65480, 0, 0, 0, 129}, - {0, 65406, 0, 0, 0, 129}, - {0, 10795, 0, 0, 0, 129}, - {0, 65373, 0, 0, 0, 129}, - {0, 10792, 0, 0, 0, 129}, - {10815, 0, 10815, 0, 0, 9}, - {0, 65341, 0, 0, 0, 129}, - {0, 69, 0, 0, 0, 129}, - {0, 71, 0, 0, 0, 129}, - {10783, 0, 10783, 0, 0, 9}, - {10780, 0, 10780, 0, 0, 9}, - {10782, 0, 10782, 0, 0, 9}, - {65326, 0, 65326, 0, 0, 9}, - {65330, 0, 65330, 0, 0, 9}, - {65331, 0, 65331, 0, 0, 9}, - {65334, 0, 65334, 0, 0, 9}, - {65333, 0, 65333, 0, 0, 9}, - {65329, 0, 65329, 0, 0, 9}, - {65327, 0, 65327, 0, 0, 9}, - {65325, 0, 65325, 0, 0, 9}, - {10743, 0, 10743, 0, 0, 9}, - {10749, 0, 10749, 0, 0, 9}, - {65323, 0, 65323, 0, 0, 9}, - {65322, 0, 65322, 0, 0, 9}, - {10727, 0, 10727, 0, 0, 9}, - {65318, 0, 65318, 0, 0, 9}, - {65467, 0, 65467, 0, 0, 9}, - {65319, 0, 65319, 0, 0, 9}, - {65465, 0, 65465, 0, 0, 9}, - {65317, 0, 65317, 0, 0, 9}, - {84, 0, 84, 0, 0, 0}, - {0, 38, 0, 0, 0, 129}, - {0, 37, 0, 0, 0, 129}, - {0, 64, 0, 0, 0, 129}, - {0, 63, 0, 0, 0, 129}, - {65498, 0, 65498, 0, 0, 9}, - {65499, 0, 65499, 0, 0, 9}, - {65505, 0, 65505, 0, 0, 9}, - {65472, 0, 65472, 0, 0, 9}, - {65473, 0, 65473, 0, 0, 9}, - {0, 8, 0, 0, 0, 129}, - {65474, 0, 65474, 0, 0, 9}, - {65479, 0, 65479, 0, 0, 9}, - {0, 0, 0, 0, 0, 129}, - {65489, 0, 65489, 0, 0, 9}, - {65482, 0, 65482, 0, 0, 9}, - {65528, 0, 65528, 0, 0, 9}, - {65450, 0, 65450, 0, 0, 9}, - {65456, 0, 65456, 0, 0, 9}, - {7, 0, 7, 0, 0, 9}, - {0, 65476, 0, 0, 0, 129}, - {65440, 0, 65440, 0, 0, 9}, - {0, 65529, 0, 0, 0, 129}, - {0, 80, 0, 0, 0, 129}, - {0, 15, 0, 0, 0, 129}, - {65521, 0, 65521, 0, 0, 9}, - {0, 48, 0, 0, 0, 129}, - {65488, 0, 65488, 0, 0, 9}, - {0, 7264, 0, 0, 0, 129}, - {0, 0, 0, 0, 4, 516}, - {0, 0, 0, 0, 5, 516}, - {0, 0, 0, 0, 6, 516}, - {0, 0, 0, 0, 7, 516}, - {0, 0, 0, 0, 8, 516}, - {0, 0, 0, 0, 9, 516}, - {42877, 7545, 42877, 0, 0, 265}, - {3814, 0, 3814, 0, 0, 9}, - {65477, 0, 65477, 0, 0, 9}, - {0, 57921, 0, 0, 0, 129}, - {8, 0, 8, 0, 0, 9}, - {0, 65528, 0, 0, 0, 129}, - {74, 0, 74, 0, 0, 9}, - {86, 0, 86, 0, 0, 9}, - {100, 0, 100, 0, 0, 9}, - {128, 0, 128, 0, 0, 9}, - {112, 0, 112, 0, 0, 9}, - {126, 0, 126, 0, 0, 9}, - {0, 65528, 0, 0, 0, 65}, - {9, 0, 9, 0, 0, 9}, - {0, 65462, 0, 0, 0, 129}, - {0, 65527, 0, 0, 0, 65}, - {58331, 0, 58331, 0, 0, 9}, - {0, 65450, 0, 0, 0, 129}, - {0, 65436, 0, 0, 0, 129}, - {0, 65424, 0, 0, 0, 129}, - {0, 65408, 0, 0, 0, 129}, - {0, 65410, 0, 0, 0, 129}, - {0, 0, 0, 0, 0, 516}, - {0, 58019, 0, 0, 0, 129}, - {0, 57153, 0, 0, 0, 129}, - {0, 57274, 0, 0, 0, 129}, - {0, 28, 0, 0, 0, 129}, - {65508, 0, 65508, 0, 0, 9}, - {0, 16, 0, 0, 0, 512}, - {65520, 0, 65520, 0, 0, 512}, - {0, 26, 0, 0, 0, 0}, - {65510, 0, 65510, 0, 0, 0}, - {0, 54793, 0, 0, 0, 129}, - {0, 61722, 0, 0, 0, 129}, - {0, 54809, 0, 0, 0, 129}, - {54741, 0, 54741, 0, 0, 9}, - {54744, 0, 54744, 0, 0, 9}, - {0, 54756, 0, 0, 0, 129}, - {0, 54787, 0, 0, 0, 129}, - {0, 54753, 0, 0, 0, 129}, - {0, 54754, 0, 0, 0, 129}, - {0, 54721, 0, 0, 0, 129}, - {58272, 0, 58272, 0, 0, 9}, - {0, 0, 0, 0, 0, 513}, - {42877, 7545, 42877, 0, 0, 385}, - {0, 40, 0, 0, 0, 129}, - {65496, 0, 65496, 0, 0, 9}, -}; - -/* type indexes */ -#define SHIFT 7 -static unsigned char index1[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 34, 35, 36, 37, - 38, 39, 34, 34, 34, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, - 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 65, 66, 67, 64, - 64, 64, 68, 69, 70, 64, 64, 64, 64, 64, 64, 71, 17, 72, 73, 74, 75, 76, - 77, 64, 78, 79, 80, 81, 82, 83, 84, 64, 64, 85, 86, 34, 34, 34, 34, 34, - 34, 87, 34, 34, 34, 34, 34, 88, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 89, 90, 91, 92, 34, 34, 34, 93, 34, 34, - 34, 94, 95, 34, 34, 34, 34, 34, 96, 34, 34, 34, 97, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 98, 99, 100, 34, 34, 34, 34, 34, 34, 101, 102, 34, - 34, 34, 34, 34, 34, 34, 34, 103, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 104, 34, 34, 34, 34, 34, 34, 34, 34, 105, 34, 34, 34, 34, - 101, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 104, 34, 34, 34, 34, 34, 34, 106, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 107, 108, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 109, 110, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 111, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 112, 34, 34, 113, 114, 115, 116, 117, 118, 119, 120, 121, - 122, 17, 123, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 124, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 125, 126, 127, 128, - 129, 130, 34, 34, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 17, - 141, 142, 143, 144, 145, 17, 17, 17, 17, 17, 17, 146, 17, 147, 17, 148, - 17, 149, 17, 150, 17, 17, 17, 151, 17, 17, 17, 17, 152, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 34, 34, 34, 34, 34, 34, 153, 17, 154, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 34, 34, 34, 34, 34, 34, 34, 34, 155, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 64, 156, 157, 158, 159, 17, 160, 17, 161, 162, 163, 164, 165, 166, 167, - 168, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 169, 170, 171, 172, - 173, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 174, 175, 176, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 87, 177, 34, 178, 179, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 180, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 181, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 182, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 183, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 184, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, - 185, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 34, 180, 34, 34, 186, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 187, 17, 64, 188, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, - 17, 17, 17, 17, 17, 17, 17, 17, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 189, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 189, -}; - -static unsigned char index2[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 3, 3, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 1, 1, 1, 1, 1, 1, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 1, 1, 1, 1, 1, 1, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 16, 1, 1, 1, - 1, 1, 1, 1, 17, 18, 1, 19, 1, 1, 1, 20, 16, 1, 21, 21, 21, 1, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 1, 14, 14, 14, 14, 14, 14, 14, 16, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 1, 15, - 15, 15, 15, 15, 15, 15, 22, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 25, 26, 23, 24, 23, 24, 23, 24, 16, 23, 24, 23, 24, 23, 24, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 16, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 27, 23, 24, 23, 24, 23, 24, 28, 29, 30, 23, 24, 23, 24, 31, 23, 24, - 32, 32, 23, 24, 16, 33, 34, 35, 23, 24, 32, 36, 37, 38, 39, 23, 24, 40, - 16, 38, 41, 42, 43, 23, 24, 23, 24, 23, 24, 44, 23, 24, 44, 16, 16, 23, - 24, 44, 23, 24, 45, 45, 23, 24, 23, 24, 46, 23, 24, 16, 47, 23, 24, 16, - 48, 47, 47, 47, 47, 49, 50, 51, 49, 50, 51, 49, 50, 51, 23, 24, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 52, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 16, 49, 50, 51, 23, - 24, 53, 54, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 55, 16, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 16, 16, 16, 16, 16, 16, 56, 23, 24, - 57, 58, 59, 59, 23, 24, 60, 61, 62, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 63, 64, 65, 66, 67, 16, 68, 68, 16, 69, 16, 70, 16, 16, 16, 16, 68, - 16, 16, 71, 16, 16, 16, 16, 72, 73, 16, 74, 16, 16, 16, 73, 16, 75, 76, - 16, 16, 77, 16, 16, 16, 16, 16, 16, 16, 78, 16, 16, 79, 16, 16, 79, 16, - 16, 16, 16, 79, 80, 81, 81, 82, 16, 16, 16, 16, 16, 83, 16, 47, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, - 47, 1, 1, 1, 1, 1, 1, 1, 47, 1, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 84, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 23, 24, - 23, 24, 47, 1, 23, 24, 0, 0, 47, 42, 42, 42, 1, 0, 0, 0, 0, 0, 1, 1, 85, - 1, 86, 86, 86, 0, 87, 0, 88, 88, 16, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 0, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 89, 90, 90, 90, 16, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 91, 15, 15, 15, 15, 15, 15, 15, 15, 15, 92, 93, 93, 94, - 95, 96, 97, 97, 97, 98, 99, 100, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 101, 102, 103, - 16, 104, 105, 1, 23, 24, 106, 23, 24, 16, 55, 55, 55, 107, 107, 107, 107, - 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 107, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 102, 102, 102, 102, 102, 102, 102, 102, 102, - 102, 102, 102, 102, 102, 102, 102, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 1, 1, 1, 1, 1, 1, 1, 1, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 108, 23, 24, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 109, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 0, 0, 47, 1, 1, 1, 1, 1, 1, 0, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 16, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 0, 0, 0, 0, 47, 47, 47, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 1, 1, 1, 1, 47, 47, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 1, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 1, 1, 1, 1, - 1, 1, 1, 47, 47, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 47, 47, 47, 1, 1, 47, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 47, 1, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 13, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 47, 47, 1, 1, 1, 1, 47, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 1, 1, 1, 1, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 1, 1, 1, 47, 1, 1, 1, - 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 0, 0, 1, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 47, 1, - 1, 1, 1, 1, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 47, 47, 0, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 0, 1, 1, 1, 0, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 47, - 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 0, 0, 0, - 47, 47, 47, 47, 0, 0, 1, 47, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, - 1, 47, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 47, 47, 0, 47, 47, 47, 1, - 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 47, 47, 1, 1, 21, 21, 21, 21, - 21, 21, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 47, 47, 47, 47, 47, 47, 0, 0, 0, - 0, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, - 0, 47, 47, 0, 47, 47, 0, 0, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, - 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 0, 47, 0, 0, 0, - 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 1, 47, 47, 47, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 47, 0, 47, 47, 47, 47, 47, 0, 0, 1, 47, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, - 1, 0, 1, 1, 1, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, - 47, 1, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 47, 47, 47, 47, 47, 47, 47, 47, 0, - 0, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, - 0, 47, 47, 47, 47, 47, 0, 0, 1, 47, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 0, - 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 47, 47, 0, 47, 47, - 47, 1, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 47, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 47, 0, 47, 47, 47, 47, 47, 47, 0, 0, - 0, 47, 47, 47, 0, 47, 47, 47, 47, 0, 0, 0, 47, 47, 0, 47, 0, 47, 47, 0, - 0, 0, 47, 47, 0, 0, 0, 47, 47, 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 1, - 1, 1, 0, 0, 47, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 47, 47, 47, 47, 47, 0, 0, 0, 47, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, - 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 47, 47, 0, 0, 0, 0, 0, 0, - 47, 47, 1, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, - 0, 0, 21, 21, 21, 21, 21, 21, 21, 1, 0, 0, 1, 1, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 0, 0, 1, 47, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 47, 0, 47, 47, 1, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 47, 1, 1, 1, 1, - 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 47, 1, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 21, 21, 21, 21, 21, 21, 0, 0, 0, 1, 47, 47, 47, 47, 47, 47, 0, 0, 1, 1, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 1, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 47, 47, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 1, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 47, 47, 0, 47, 0, 0, 47, 47, 0, 47, 0, 0, 47, 0, 0, 0, 0, - 0, 0, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 0, - 47, 0, 47, 0, 0, 47, 47, 0, 47, 47, 47, 47, 1, 47, 47, 1, 1, 1, 1, 1, 1, - 0, 1, 1, 47, 0, 0, 47, 47, 47, 47, 47, 0, 47, 0, 1, 1, 1, 1, 1, 1, 0, 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 4, 5, 6, 7, 8, - 9, 10, 11, 12, 13, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, - 47, 47, 47, 47, 1, 1, 1, 47, 1, 1, 1, 47, 47, 1, 1, 1, 1, 1, 1, 1, 47, - 47, 47, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 1, 1, 1, 1, 1, 1, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, - 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 112, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 47, 0, 0, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, - 0, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 0, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 0, 47, 47, 47, 47, 0, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 0, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 17, 18, 113, 114, 115, - 116, 117, 118, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 2, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 1, 1, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 21, 21, 21, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 0, 47, 47, 47, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 47, 1, 1, 1, 1, 47, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 0, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, - 47, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 4, 5, 6, - 7, 8, 9, 10, 11, 12, 13, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 0, 0, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 1, 1, 0, 0, 0, 0, 0, 0, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 5, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 1, 1, 1, 1, 1, 0, 0, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 47, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 4, 5, 6, 7, 8, 9, - 10, 11, 12, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 47, 47, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 0, 0, 47, 47, 47, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 1, 47, 47, 47, 47, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 47, 119, 16, 16, 16, 120, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 16, 16, 16, 16, 16, 121, 16, 16, 122, 16, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 123, - 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, 124, - 124, 123, 123, 123, 123, 123, 123, 0, 0, 124, 124, 124, 124, 124, 124, 0, - 0, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 124, - 124, 124, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, 124, - 124, 124, 124, 124, 123, 123, 123, 123, 123, 123, 0, 0, 124, 124, 124, - 124, 124, 124, 0, 0, 16, 123, 16, 123, 16, 123, 16, 123, 0, 124, 0, 124, - 0, 124, 0, 124, 123, 123, 123, 123, 123, 123, 123, 123, 124, 124, 124, - 124, 124, 124, 124, 124, 125, 125, 126, 126, 126, 126, 127, 127, 128, - 128, 129, 129, 130, 130, 0, 0, 123, 123, 123, 123, 123, 123, 123, 123, - 131, 131, 131, 131, 131, 131, 131, 131, 123, 123, 123, 123, 123, 123, - 123, 123, 131, 131, 131, 131, 131, 131, 131, 131, 123, 123, 123, 123, - 123, 123, 123, 123, 131, 131, 131, 131, 131, 131, 131, 131, 123, 123, 16, - 132, 16, 0, 16, 16, 124, 124, 133, 133, 134, 1, 135, 1, 1, 1, 16, 132, - 16, 0, 16, 16, 136, 136, 136, 136, 134, 1, 1, 1, 123, 123, 16, 16, 0, 0, - 16, 16, 124, 124, 137, 137, 0, 1, 1, 1, 123, 123, 16, 16, 16, 103, 16, - 16, 124, 124, 138, 138, 106, 1, 1, 1, 0, 0, 16, 132, 16, 0, 16, 16, 139, - 139, 140, 140, 134, 1, 1, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 3, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 141, 47, 0, 0, 113, 114, 115, 116, 117, 118, 1, 1, 1, 1, 1, 47, 141, - 20, 17, 18, 113, 114, 115, 116, 117, 118, 1, 1, 1, 1, 1, 0, 47, 47, 47, - 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 97, 1, 1, 1, 1, 97, 1, 1, - 16, 97, 97, 97, 16, 16, 97, 97, 97, 16, 1, 97, 1, 1, 1, 97, 97, 97, 97, - 97, 1, 1, 1, 1, 1, 1, 97, 1, 142, 1, 97, 1, 143, 144, 97, 97, 1, 16, 97, - 97, 145, 97, 16, 47, 47, 47, 47, 16, 1, 1, 16, 16, 97, 97, 1, 1, 1, 1, 1, - 97, 16, 16, 16, 16, 1, 1, 1, 1, 146, 1, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 147, 147, 147, 147, 147, 147, 147, 147, - 147, 147, 147, 147, 147, 147, 147, 147, 148, 148, 148, 148, 148, 148, - 148, 148, 148, 148, 148, 148, 148, 148, 148, 148, 21, 21, 21, 23, 24, 21, - 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 17, 18, 113, - 114, 115, 116, 117, 118, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, - 17, 18, 113, 114, 115, 116, 117, 118, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 20, 17, 18, 113, 114, 115, 116, 117, 118, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, 149, - 149, 149, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, - 141, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 20, 17, 18, 113, 114, 115, - 116, 117, 118, 21, 141, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, - 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, - 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 20, 17, 18, 113, 114, 115, 116, - 117, 118, 21, 20, 17, 18, 113, 114, 115, 116, 117, 118, 21, 20, 17, 18, - 113, 114, 115, 116, 117, 118, 21, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, - 110, 110, 110, 110, 110, 110, 110, 110, 110, 0, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, - 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 111, 0, - 23, 24, 151, 152, 153, 154, 155, 23, 24, 23, 24, 23, 24, 156, 157, 158, - 159, 16, 23, 24, 16, 23, 24, 16, 16, 16, 16, 16, 16, 47, 160, 160, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 16, 1, 1, 1, 1, 1, 1, 23, 24, 23, 24, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 21, 1, 1, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, 161, - 161, 161, 161, 161, 161, 161, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 0, - 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, - 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, - 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 47, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 2, 1, 1, 1, 1, 47, 47, 21, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 1, 1, 21, 21, - 21, 47, 47, 1, 1, 1, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 0, 1, 1, 1, 1, 47, 47, 47, 1, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 47, 47, 47, 47, 0, 0, 0, 0, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 1, 1, 21, 21, 21, 21, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 162, 47, 47, 162, - 47, 47, 47, 162, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, - 162, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 162, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 162, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 162, - 162, 162, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 162, 162, 162, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 162, 162, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 47, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 0, 0, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 47, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 47, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, - 23, 24, 23, 24, 23, 24, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 1, 1, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 16, 16, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 23, 24, 47, 16, 16, 16, 16, - 16, 16, 16, 16, 23, 24, 23, 24, 163, 23, 24, 23, 24, 23, 24, 23, 24, 23, - 24, 47, 1, 1, 23, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, - 47, 47, 47, 47, 47, 1, 47, 47, 47, 1, 47, 47, 47, 47, 1, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 1, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 13, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 1, 1, 1, 47, 0, 0, 0, 0, 4, 5, 6, 7, - 8, 9, 10, 11, 12, 13, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 47, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 1, 47, 47, 47, 47, 47, - 47, 47, 47, 1, 1, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 1, 1, 1, - 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 1, 1, 1, 47, 1, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 1, 47, 1, 1, 1, 47, 47, 1, 1, 47, 47, 47, 47, - 47, 1, 1, 47, 1, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 162, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 16, 16, 16, 16, 16, 0, 0, 0, 0, 0, 47, 1, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 47, 47, 47, 47, 47, 0, 47, 0, 47, 47, 0, 47, 47, 0, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 47, 47, 47, 47, 47, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 1, 1, 1, 1, 1, - 1, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, 14, 1, 1, 1, 1, 1, 1, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 47, 47, 47, 47, 47, 47, - 0, 0, 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, - 47, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 47, 47, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 21, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 21, - 47, 47, 47, 47, 47, 47, 47, 47, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 0, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 1, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, - 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 165, - 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, - 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 165, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 0, 0, 47, 0, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 47, 47, 0, 0, 0, 47, 0, 0, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 1, 21, - 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 21, - 21, 21, 21, 21, 21, 0, 0, 0, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 1, 1, 1, 0, - 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 47, 47, 47, 47, 0, 47, 47, 47, 0, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 20, - 17, 18, 113, 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 21, 21, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 21, 21, 21, - 21, 21, 21, 21, 21, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 21, 21, 21, 21, 21, 21, 21, 21, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 20, 17, 18, 113, 114, 115, 116, 117, 118, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 0, 1, 1, 1, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 1, 1, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 1, 1, 21, 21, 21, 21, 21, - 21, 21, 21, 21, 21, 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 21, - 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, - 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 97, 0, 97, 97, 0, 0, 97, 0, 0, 97, 97, 0, 0, 97, 97, 97, 97, 0, - 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, 0, 16, 0, 16, 16, 16, 16, - 16, 16, 16, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 97, 0, 97, 97, - 97, 97, 0, 0, 97, 97, 97, 97, 97, 97, 97, 97, 0, 97, 97, 97, 97, 97, 97, - 97, 0, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 97, 0, 97, 97, 97, 97, 0, 97, - 97, 97, 97, 97, 0, 97, 0, 0, 0, 97, 97, 97, 97, 97, 97, 97, 0, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 0, 0, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 16, 16, 16, 16, - 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 1, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, - 16, 16, 16, 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 1, 16, 16, 16, 16, 16, 16, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 1, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 1, 16, 16, 16, 16, 16, 16, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, - 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 16, 16, 16, 16, 16, 97, - 16, 0, 0, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, - 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 141, 141, 20, 17, 18, 113, 114, 115, 116, 117, 118, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, - 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 162, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, -}; - -/* Returns the numeric value as double for Unicode characters - * having this property, -1.0 otherwise. - */ -double _PyUnicode_ToNumeric(Py_UNICODE ch) -{ - switch (ch) { - case 0x0F33: - return (double) -1.0/2.0; - case 0x0030: - case 0x0660: - case 0x06F0: - case 0x07C0: - case 0x0966: - case 0x09E6: - case 0x0A66: - case 0x0AE6: - case 0x0B66: - case 0x0BE6: - case 0x0C66: - case 0x0C78: - case 0x0CE6: - case 0x0D66: - case 0x0E50: - case 0x0ED0: - case 0x0F20: - case 0x1040: - case 0x1090: - case 0x17E0: - case 0x17F0: - case 0x1810: - case 0x1946: - case 0x19D0: - case 0x1A80: - case 0x1A90: - case 0x1B50: - case 0x1BB0: - case 0x1C40: - case 0x1C50: - case 0x2070: - case 0x2080: - case 0x2189: - case 0x24EA: - case 0x24FF: - case 0x3007: - case 0x96F6: - case 0xA620: - case 0xA6EF: - case 0xA8D0: - case 0xA900: - case 0xA9D0: - case 0xAA50: - case 0xABF0: - case 0xF9B2: - case 0xFF10: -#ifdef Py_UNICODE_WIDE - case 0x1018A: - case 0x104A0: - case 0x1D7CE: - case 0x1D7D8: - case 0x1D7E2: - case 0x1D7EC: - case 0x1D7F6: - case 0x1F100: - case 0x1F101: -#endif - return (double) 0.0; - case 0x0031: - case 0x00B9: - case 0x0661: - case 0x06F1: - case 0x07C1: - case 0x0967: - case 0x09E7: - case 0x0A67: - case 0x0AE7: - case 0x0B67: - case 0x0BE7: - case 0x0C67: - case 0x0C79: - case 0x0C7C: - case 0x0CE7: - case 0x0D67: - case 0x0E51: - case 0x0ED1: - case 0x0F21: - case 0x1041: - case 0x1091: - case 0x1369: - case 0x17E1: - case 0x17F1: - case 0x1811: - case 0x1947: - case 0x19D1: - case 0x19DA: - case 0x1A81: - case 0x1A91: - case 0x1B51: - case 0x1BB1: - case 0x1C41: - case 0x1C51: - case 0x2081: - case 0x215F: - case 0x2160: - case 0x2170: - case 0x2460: - case 0x2474: - case 0x2488: - case 0x24F5: - case 0x2776: - case 0x2780: - case 0x278A: - case 0x3021: - case 0x3192: - case 0x3220: - case 0x3280: - case 0x4E00: - case 0x58F1: - case 0x58F9: - case 0x5E7A: - case 0x5F0C: - case 0xA621: - case 0xA6E6: - case 0xA8D1: - case 0xA901: - case 0xA9D1: - case 0xAA51: - case 0xABF1: - case 0xFF11: -#ifdef Py_UNICODE_WIDE - case 0x10107: - case 0x10142: - case 0x10158: - case 0x10159: - case 0x1015A: - case 0x10320: - case 0x103D1: - case 0x104A1: - case 0x10858: - case 0x10916: - case 0x10A40: - case 0x10A7D: - case 0x10B58: - case 0x10B78: - case 0x10E60: - case 0x12415: - case 0x1241E: - case 0x1242C: - case 0x12434: - case 0x1244F: - case 0x12458: - case 0x1D360: - case 0x1D7CF: - case 0x1D7D9: - case 0x1D7E3: - case 0x1D7ED: - case 0x1D7F7: - case 0x1F102: - case 0x2092A: -#endif - return (double) 1.0; - case 0x2152: - return (double) 1.0/10.0; - case 0x09F4: - case 0xA833: - return (double) 1.0/16.0; - case 0x00BD: - case 0x0D74: - case 0x0F2A: - case 0x2CFD: - case 0xA831: -#ifdef Py_UNICODE_WIDE - case 0x10141: - case 0x10175: - case 0x10176: - case 0x10E7B: -#endif - return (double) 1.0/2.0; - case 0x2153: -#ifdef Py_UNICODE_WIDE - case 0x10E7D: - case 0x1245A: - case 0x1245D: -#endif - return (double) 1.0/3.0; - case 0x00BC: - case 0x09F7: - case 0x0D73: - case 0xA830: -#ifdef Py_UNICODE_WIDE - case 0x10140: - case 0x10E7C: - case 0x12460: - case 0x12462: -#endif - return (double) 1.0/4.0; - case 0x2155: - return (double) 1.0/5.0; - case 0x2159: -#ifdef Py_UNICODE_WIDE - case 0x12461: -#endif - return (double) 1.0/6.0; - case 0x2150: - return (double) 1.0/7.0; - case 0x09F5: - case 0x215B: - case 0xA834: -#ifdef Py_UNICODE_WIDE - case 0x1245F: -#endif - return (double) 1.0/8.0; - case 0x2151: - return (double) 1.0/9.0; - case 0x0BF0: - case 0x0D70: - case 0x1372: - case 0x2169: - case 0x2179: - case 0x2469: - case 0x247D: - case 0x2491: - case 0x24FE: - case 0x277F: - case 0x2789: - case 0x2793: - case 0x3038: - case 0x3229: - case 0x3289: - case 0x4EC0: - case 0x5341: - case 0x62FE: - case 0xF973: - case 0xF9FD: -#ifdef Py_UNICODE_WIDE - case 0x10110: - case 0x10149: - case 0x10150: - case 0x10157: - case 0x10160: - case 0x10161: - case 0x10162: - case 0x10163: - case 0x10164: - case 0x10322: - case 0x103D3: - case 0x1085B: - case 0x10917: - case 0x10A44: - case 0x10B5C: - case 0x10B7C: - case 0x10E69: - case 0x1D369: -#endif - return (double) 10.0; - case 0x0BF1: - case 0x0D71: - case 0x137B: - case 0x216D: - case 0x217D: - case 0x4F70: - case 0x767E: - case 0x964C: -#ifdef Py_UNICODE_WIDE - case 0x10119: - case 0x1014B: - case 0x10152: - case 0x1016A: - case 0x103D5: - case 0x1085D: - case 0x10919: - case 0x10A46: - case 0x10B5E: - case 0x10B7E: - case 0x10E72: -#endif - return (double) 100.0; - case 0x0BF2: - case 0x0D72: - case 0x216F: - case 0x217F: - case 0x2180: - case 0x4EDF: - case 0x5343: - case 0x9621: -#ifdef Py_UNICODE_WIDE - case 0x10122: - case 0x1014D: - case 0x10154: - case 0x10171: - case 0x1085E: - case 0x10A47: - case 0x10B5F: - case 0x10B7F: -#endif - return (double) 1000.0; - case 0x137C: - case 0x2182: - case 0x4E07: - case 0x842C: -#ifdef Py_UNICODE_WIDE - case 0x1012B: - case 0x10155: - case 0x1085F: -#endif - return (double) 10000.0; - case 0x2188: - return (double) 100000.0; - case 0x4EBF: - case 0x5104: - return (double) 100000000.0; - case 0x5146: - return (double) 1000000000000.0; - case 0x216A: - case 0x217A: - case 0x246A: - case 0x247E: - case 0x2492: - case 0x24EB: - return (double) 11.0; - case 0x0F2F: - return (double) 11.0/2.0; - case 0x216B: - case 0x217B: - case 0x246B: - case 0x247F: - case 0x2493: - case 0x24EC: - return (double) 12.0; - case 0x246C: - case 0x2480: - case 0x2494: - case 0x24ED: - return (double) 13.0; - case 0x0F30: - return (double) 13.0/2.0; - case 0x246D: - case 0x2481: - case 0x2495: - case 0x24EE: - return (double) 14.0; - case 0x246E: - case 0x2482: - case 0x2496: - case 0x24EF: - return (double) 15.0; - case 0x0F31: - return (double) 15.0/2.0; - case 0x09F9: - case 0x246F: - case 0x2483: - case 0x2497: - case 0x24F0: - return (double) 16.0; - case 0x16EE: - case 0x2470: - case 0x2484: - case 0x2498: - case 0x24F1: - return (double) 17.0; - case 0x0F32: - return (double) 17.0/2.0; - case 0x16EF: - case 0x2471: - case 0x2485: - case 0x2499: - case 0x24F2: - return (double) 18.0; - case 0x16F0: - case 0x2472: - case 0x2486: - case 0x249A: - case 0x24F3: - return (double) 19.0; - case 0x0032: - case 0x00B2: - case 0x0662: - case 0x06F2: - case 0x07C2: - case 0x0968: - case 0x09E8: - case 0x0A68: - case 0x0AE8: - case 0x0B68: - case 0x0BE8: - case 0x0C68: - case 0x0C7A: - case 0x0C7D: - case 0x0CE8: - case 0x0D68: - case 0x0E52: - case 0x0ED2: - case 0x0F22: - case 0x1042: - case 0x1092: - case 0x136A: - case 0x17E2: - case 0x17F2: - case 0x1812: - case 0x1948: - case 0x19D2: - case 0x1A82: - case 0x1A92: - case 0x1B52: - case 0x1BB2: - case 0x1C42: - case 0x1C52: - case 0x2082: - case 0x2161: - case 0x2171: - case 0x2461: - case 0x2475: - case 0x2489: - case 0x24F6: - case 0x2777: - case 0x2781: - case 0x278B: - case 0x3022: - case 0x3193: - case 0x3221: - case 0x3281: - case 0x3483: - case 0x4E8C: - case 0x5169: - case 0x5F0D: - case 0x5F10: - case 0x8CAE: - case 0x8CB3: - case 0x8D30: - case 0xA622: - case 0xA6E7: - case 0xA8D2: - case 0xA902: - case 0xA9D2: - case 0xAA52: - case 0xABF2: - case 0xF978: - case 0xFF12: -#ifdef Py_UNICODE_WIDE - case 0x10108: - case 0x1015B: - case 0x1015C: - case 0x1015D: - case 0x1015E: - case 0x103D2: - case 0x104A2: - case 0x10859: - case 0x1091A: - case 0x10A41: - case 0x10B59: - case 0x10B79: - case 0x10E61: - case 0x12400: - case 0x12416: - case 0x1241F: - case 0x12423: - case 0x1242D: - case 0x12435: - case 0x1244A: - case 0x12450: - case 0x12459: - case 0x1D361: - case 0x1D7D0: - case 0x1D7DA: - case 0x1D7E4: - case 0x1D7EE: - case 0x1D7F8: - case 0x1F103: - case 0x22390: -#endif - return (double) 2.0; - case 0x2154: -#ifdef Py_UNICODE_WIDE - case 0x10177: - case 0x10E7E: - case 0x1245B: - case 0x1245E: -#endif - return (double) 2.0/3.0; - case 0x2156: - return (double) 2.0/5.0; - case 0x1373: - case 0x2473: - case 0x2487: - case 0x249B: - case 0x24F4: - case 0x3039: - case 0x5344: - case 0x5EFF: -#ifdef Py_UNICODE_WIDE - case 0x10111: - case 0x103D4: - case 0x1085C: - case 0x10918: - case 0x10A45: - case 0x10B5D: - case 0x10B7D: - case 0x10E6A: - case 0x1D36A: -#endif - return (double) 20.0; -#ifdef Py_UNICODE_WIDE - case 0x1011A: - case 0x10E73: - return (double) 200.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10123: - return (double) 2000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x1012C: - return (double) 20000.0; -#endif - case 0x3251: - return (double) 21.0; - case 0x3252: - return (double) 22.0; - case 0x3253: - return (double) 23.0; - case 0x3254: - return (double) 24.0; - case 0x3255: - return (double) 25.0; - case 0x3256: - return (double) 26.0; - case 0x3257: - return (double) 27.0; - case 0x3258: - return (double) 28.0; - case 0x3259: - return (double) 29.0; - case 0x0033: - case 0x00B3: - case 0x0663: - case 0x06F3: - case 0x07C3: - case 0x0969: - case 0x09E9: - case 0x0A69: - case 0x0AE9: - case 0x0B69: - case 0x0BE9: - case 0x0C69: - case 0x0C7B: - case 0x0C7E: - case 0x0CE9: - case 0x0D69: - case 0x0E53: - case 0x0ED3: - case 0x0F23: - case 0x1043: - case 0x1093: - case 0x136B: - case 0x17E3: - case 0x17F3: - case 0x1813: - case 0x1949: - case 0x19D3: - case 0x1A83: - case 0x1A93: - case 0x1B53: - case 0x1BB3: - case 0x1C43: - case 0x1C53: - case 0x2083: - case 0x2162: - case 0x2172: - case 0x2462: - case 0x2476: - case 0x248A: - case 0x24F7: - case 0x2778: - case 0x2782: - case 0x278C: - case 0x3023: - case 0x3194: - case 0x3222: - case 0x3282: - case 0x4E09: - case 0x4EE8: - case 0x53C1: - case 0x53C2: - case 0x53C3: - case 0x53C4: - case 0x5F0E: - case 0xA623: - case 0xA6E8: - case 0xA8D3: - case 0xA903: - case 0xA9D3: - case 0xAA53: - case 0xABF3: - case 0xF96B: - case 0xFF13: -#ifdef Py_UNICODE_WIDE - case 0x10109: - case 0x104A3: - case 0x1085A: - case 0x1091B: - case 0x10A42: - case 0x10B5A: - case 0x10B7A: - case 0x10E62: - case 0x12401: - case 0x12408: - case 0x12417: - case 0x12420: - case 0x12424: - case 0x12425: - case 0x1242E: - case 0x1242F: - case 0x12436: - case 0x12437: - case 0x1243A: - case 0x1243B: - case 0x1244B: - case 0x12451: - case 0x1D362: - case 0x1D7D1: - case 0x1D7DB: - case 0x1D7E5: - case 0x1D7EF: - case 0x1D7F9: - case 0x1F104: - case 0x20AFD: - case 0x20B19: - case 0x22998: - case 0x23B1B: -#endif - return (double) 3.0; - case 0x09F6: - case 0xA835: - return (double) 3.0/16.0; - case 0x0F2B: - return (double) 3.0/2.0; - case 0x00BE: - case 0x09F8: - case 0x0D75: - case 0xA832: -#ifdef Py_UNICODE_WIDE - case 0x10178: -#endif - return (double) 3.0/4.0; - case 0x2157: - return (double) 3.0/5.0; - case 0x215C: - return (double) 3.0/8.0; - case 0x1374: - case 0x303A: - case 0x325A: - case 0x5345: -#ifdef Py_UNICODE_WIDE - case 0x10112: - case 0x10165: - case 0x10E6B: - case 0x1D36B: - case 0x20983: -#endif - return (double) 30.0; -#ifdef Py_UNICODE_WIDE - case 0x1011B: - case 0x1016B: - case 0x10E74: - return (double) 300.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10124: - return (double) 3000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x1012D: - return (double) 30000.0; -#endif - case 0x325B: - return (double) 31.0; - case 0x325C: - return (double) 32.0; - case 0x325D: - return (double) 33.0; - case 0x325E: - return (double) 34.0; - case 0x325F: - return (double) 35.0; - case 0x32B1: - return (double) 36.0; - case 0x32B2: - return (double) 37.0; - case 0x32B3: - return (double) 38.0; - case 0x32B4: - return (double) 39.0; - case 0x0034: - case 0x0664: - case 0x06F4: - case 0x07C4: - case 0x096A: - case 0x09EA: - case 0x0A6A: - case 0x0AEA: - case 0x0B6A: - case 0x0BEA: - case 0x0C6A: - case 0x0CEA: - case 0x0D6A: - case 0x0E54: - case 0x0ED4: - case 0x0F24: - case 0x1044: - case 0x1094: - case 0x136C: - case 0x17E4: - case 0x17F4: - case 0x1814: - case 0x194A: - case 0x19D4: - case 0x1A84: - case 0x1A94: - case 0x1B54: - case 0x1BB4: - case 0x1C44: - case 0x1C54: - case 0x2074: - case 0x2084: - case 0x2163: - case 0x2173: - case 0x2463: - case 0x2477: - case 0x248B: - case 0x24F8: - case 0x2779: - case 0x2783: - case 0x278D: - case 0x3024: - case 0x3195: - case 0x3223: - case 0x3283: - case 0x4E96: - case 0x56DB: - case 0x8086: - case 0xA624: - case 0xA6E9: - case 0xA8D4: - case 0xA904: - case 0xA9D4: - case 0xAA54: - case 0xABF4: - case 0xFF14: -#ifdef Py_UNICODE_WIDE - case 0x1010A: - case 0x104A4: - case 0x10A43: - case 0x10B5B: - case 0x10B7B: - case 0x10E63: - case 0x12402: - case 0x12409: - case 0x1240F: - case 0x12418: - case 0x12421: - case 0x12426: - case 0x12430: - case 0x12438: - case 0x1243C: - case 0x1243D: - case 0x1243E: - case 0x1243F: - case 0x1244C: - case 0x12452: - case 0x12453: - case 0x1D363: - case 0x1D7D2: - case 0x1D7DC: - case 0x1D7E6: - case 0x1D7F0: - case 0x1D7FA: - case 0x1F105: - case 0x20064: - case 0x200E2: - case 0x2626D: -#endif - return (double) 4.0; - case 0x2158: - return (double) 4.0/5.0; - case 0x1375: - case 0x32B5: - case 0x534C: -#ifdef Py_UNICODE_WIDE - case 0x10113: - case 0x10E6C: - case 0x1D36C: - case 0x2098C: - case 0x2099C: -#endif - return (double) 40.0; -#ifdef Py_UNICODE_WIDE - case 0x1011C: - case 0x10E75: - return (double) 400.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10125: - return (double) 4000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x1012E: - return (double) 40000.0; -#endif - case 0x32B6: - return (double) 41.0; - case 0x32B7: - return (double) 42.0; - case 0x32B8: - return (double) 43.0; - case 0x32B9: - return (double) 44.0; - case 0x32BA: - return (double) 45.0; - case 0x32BB: - return (double) 46.0; - case 0x32BC: - return (double) 47.0; - case 0x32BD: - return (double) 48.0; - case 0x32BE: - return (double) 49.0; - case 0x0035: - case 0x0665: - case 0x06F5: - case 0x07C5: - case 0x096B: - case 0x09EB: - case 0x0A6B: - case 0x0AEB: - case 0x0B6B: - case 0x0BEB: - case 0x0C6B: - case 0x0CEB: - case 0x0D6B: - case 0x0E55: - case 0x0ED5: - case 0x0F25: - case 0x1045: - case 0x1095: - case 0x136D: - case 0x17E5: - case 0x17F5: - case 0x1815: - case 0x194B: - case 0x19D5: - case 0x1A85: - case 0x1A95: - case 0x1B55: - case 0x1BB5: - case 0x1C45: - case 0x1C55: - case 0x2075: - case 0x2085: - case 0x2164: - case 0x2174: - case 0x2464: - case 0x2478: - case 0x248C: - case 0x24F9: - case 0x277A: - case 0x2784: - case 0x278E: - case 0x3025: - case 0x3224: - case 0x3284: - case 0x3405: - case 0x382A: - case 0x4E94: - case 0x4F0D: - case 0xA625: - case 0xA6EA: - case 0xA8D5: - case 0xA905: - case 0xA9D5: - case 0xAA55: - case 0xABF5: - case 0xFF15: -#ifdef Py_UNICODE_WIDE - case 0x1010B: - case 0x10143: - case 0x10148: - case 0x1014F: - case 0x1015F: - case 0x10173: - case 0x10321: - case 0x104A5: - case 0x10E64: - case 0x12403: - case 0x1240A: - case 0x12410: - case 0x12419: - case 0x12422: - case 0x12427: - case 0x12431: - case 0x12439: - case 0x1244D: - case 0x12454: - case 0x12455: - case 0x1D364: - case 0x1D7D3: - case 0x1D7DD: - case 0x1D7E7: - case 0x1D7F1: - case 0x1D7FB: - case 0x1F106: - case 0x20121: -#endif - return (double) 5.0; - case 0x0F2C: - return (double) 5.0/2.0; - case 0x215A: -#ifdef Py_UNICODE_WIDE - case 0x1245C: -#endif - return (double) 5.0/6.0; - case 0x215D: - return (double) 5.0/8.0; - case 0x1376: - case 0x216C: - case 0x217C: - case 0x2186: - case 0x32BF: -#ifdef Py_UNICODE_WIDE - case 0x10114: - case 0x10144: - case 0x1014A: - case 0x10151: - case 0x10166: - case 0x10167: - case 0x10168: - case 0x10169: - case 0x10174: - case 0x10323: - case 0x10A7E: - case 0x10E6D: - case 0x1D36D: -#endif - return (double) 50.0; - case 0x216E: - case 0x217E: -#ifdef Py_UNICODE_WIDE - case 0x1011D: - case 0x10145: - case 0x1014C: - case 0x10153: - case 0x1016C: - case 0x1016D: - case 0x1016E: - case 0x1016F: - case 0x10170: - case 0x10E76: -#endif - return (double) 500.0; - case 0x2181: -#ifdef Py_UNICODE_WIDE - case 0x10126: - case 0x10146: - case 0x1014E: - case 0x10172: -#endif - return (double) 5000.0; - case 0x2187: -#ifdef Py_UNICODE_WIDE - case 0x1012F: - case 0x10147: - case 0x10156: -#endif - return (double) 50000.0; - case 0x0036: - case 0x0666: - case 0x06F6: - case 0x07C6: - case 0x096C: - case 0x09EC: - case 0x0A6C: - case 0x0AEC: - case 0x0B6C: - case 0x0BEC: - case 0x0C6C: - case 0x0CEC: - case 0x0D6C: - case 0x0E56: - case 0x0ED6: - case 0x0F26: - case 0x1046: - case 0x1096: - case 0x136E: - case 0x17E6: - case 0x17F6: - case 0x1816: - case 0x194C: - case 0x19D6: - case 0x1A86: - case 0x1A96: - case 0x1B56: - case 0x1BB6: - case 0x1C46: - case 0x1C56: - case 0x2076: - case 0x2086: - case 0x2165: - case 0x2175: - case 0x2185: - case 0x2465: - case 0x2479: - case 0x248D: - case 0x24FA: - case 0x277B: - case 0x2785: - case 0x278F: - case 0x3026: - case 0x3225: - case 0x3285: - case 0x516D: - case 0x9646: - case 0x9678: - case 0xA626: - case 0xA6EB: - case 0xA8D6: - case 0xA906: - case 0xA9D6: - case 0xAA56: - case 0xABF6: - case 0xF9D1: - case 0xF9D3: - case 0xFF16: -#ifdef Py_UNICODE_WIDE - case 0x1010C: - case 0x104A6: - case 0x10E65: - case 0x12404: - case 0x1240B: - case 0x12411: - case 0x1241A: - case 0x12428: - case 0x12440: - case 0x1244E: - case 0x1D365: - case 0x1D7D4: - case 0x1D7DE: - case 0x1D7E8: - case 0x1D7F2: - case 0x1D7FC: - case 0x1F107: - case 0x20AEA: -#endif - return (double) 6.0; - case 0x1377: -#ifdef Py_UNICODE_WIDE - case 0x10115: - case 0x10E6E: - case 0x1D36E: -#endif - return (double) 60.0; -#ifdef Py_UNICODE_WIDE - case 0x1011E: - case 0x10E77: - return (double) 600.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10127: - return (double) 6000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10130: - return (double) 60000.0; -#endif - case 0x0037: - case 0x0667: - case 0x06F7: - case 0x07C7: - case 0x096D: - case 0x09ED: - case 0x0A6D: - case 0x0AED: - case 0x0B6D: - case 0x0BED: - case 0x0C6D: - case 0x0CED: - case 0x0D6D: - case 0x0E57: - case 0x0ED7: - case 0x0F27: - case 0x1047: - case 0x1097: - case 0x136F: - case 0x17E7: - case 0x17F7: - case 0x1817: - case 0x194D: - case 0x19D7: - case 0x1A87: - case 0x1A97: - case 0x1B57: - case 0x1BB7: - case 0x1C47: - case 0x1C57: - case 0x2077: - case 0x2087: - case 0x2166: - case 0x2176: - case 0x2466: - case 0x247A: - case 0x248E: - case 0x24FB: - case 0x277C: - case 0x2786: - case 0x2790: - case 0x3027: - case 0x3226: - case 0x3286: - case 0x3B4D: - case 0x4E03: - case 0x67D2: - case 0x6F06: - case 0xA627: - case 0xA6EC: - case 0xA8D7: - case 0xA907: - case 0xA9D7: - case 0xAA57: - case 0xABF7: - case 0xFF17: -#ifdef Py_UNICODE_WIDE - case 0x1010D: - case 0x104A7: - case 0x10E66: - case 0x12405: - case 0x1240C: - case 0x12412: - case 0x1241B: - case 0x12429: - case 0x12441: - case 0x12442: - case 0x12443: - case 0x1D366: - case 0x1D7D5: - case 0x1D7DF: - case 0x1D7E9: - case 0x1D7F3: - case 0x1D7FD: - case 0x1F108: - case 0x20001: -#endif - return (double) 7.0; - case 0x0F2D: - return (double) 7.0/2.0; - case 0x215E: - return (double) 7.0/8.0; - case 0x1378: -#ifdef Py_UNICODE_WIDE - case 0x10116: - case 0x10E6F: - case 0x1D36F: -#endif - return (double) 70.0; -#ifdef Py_UNICODE_WIDE - case 0x1011F: - case 0x10E78: - return (double) 700.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10128: - return (double) 7000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10131: - return (double) 70000.0; -#endif - case 0x0038: - case 0x0668: - case 0x06F8: - case 0x07C8: - case 0x096E: - case 0x09EE: - case 0x0A6E: - case 0x0AEE: - case 0x0B6E: - case 0x0BEE: - case 0x0C6E: - case 0x0CEE: - case 0x0D6E: - case 0x0E58: - case 0x0ED8: - case 0x0F28: - case 0x1048: - case 0x1098: - case 0x1370: - case 0x17E8: - case 0x17F8: - case 0x1818: - case 0x194E: - case 0x19D8: - case 0x1A88: - case 0x1A98: - case 0x1B58: - case 0x1BB8: - case 0x1C48: - case 0x1C58: - case 0x2078: - case 0x2088: - case 0x2167: - case 0x2177: - case 0x2467: - case 0x247B: - case 0x248F: - case 0x24FC: - case 0x277D: - case 0x2787: - case 0x2791: - case 0x3028: - case 0x3227: - case 0x3287: - case 0x516B: - case 0x634C: - case 0xA628: - case 0xA6ED: - case 0xA8D8: - case 0xA908: - case 0xA9D8: - case 0xAA58: - case 0xABF8: - case 0xFF18: -#ifdef Py_UNICODE_WIDE - case 0x1010E: - case 0x104A8: - case 0x10E67: - case 0x12406: - case 0x1240D: - case 0x12413: - case 0x1241C: - case 0x1242A: - case 0x12444: - case 0x12445: - case 0x1D367: - case 0x1D7D6: - case 0x1D7E0: - case 0x1D7EA: - case 0x1D7F4: - case 0x1D7FE: - case 0x1F109: -#endif - return (double) 8.0; - case 0x1379: -#ifdef Py_UNICODE_WIDE - case 0x10117: - case 0x10E70: - case 0x1D370: -#endif - return (double) 80.0; -#ifdef Py_UNICODE_WIDE - case 0x10120: - case 0x10E79: - return (double) 800.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10129: - return (double) 8000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10132: - return (double) 80000.0; -#endif - case 0x0039: - case 0x0669: - case 0x06F9: - case 0x07C9: - case 0x096F: - case 0x09EF: - case 0x0A6F: - case 0x0AEF: - case 0x0B6F: - case 0x0BEF: - case 0x0C6F: - case 0x0CEF: - case 0x0D6F: - case 0x0E59: - case 0x0ED9: - case 0x0F29: - case 0x1049: - case 0x1099: - case 0x1371: - case 0x17E9: - case 0x17F9: - case 0x1819: - case 0x194F: - case 0x19D9: - case 0x1A89: - case 0x1A99: - case 0x1B59: - case 0x1BB9: - case 0x1C49: - case 0x1C59: - case 0x2079: - case 0x2089: - case 0x2168: - case 0x2178: - case 0x2468: - case 0x247C: - case 0x2490: - case 0x24FD: - case 0x277E: - case 0x2788: - case 0x2792: - case 0x3029: - case 0x3228: - case 0x3288: - case 0x4E5D: - case 0x5EFE: - case 0x7396: - case 0xA629: - case 0xA6EE: - case 0xA8D9: - case 0xA909: - case 0xA9D9: - case 0xAA59: - case 0xABF9: - case 0xFF19: -#ifdef Py_UNICODE_WIDE - case 0x1010F: - case 0x104A9: - case 0x10E68: - case 0x12407: - case 0x1240E: - case 0x12414: - case 0x1241D: - case 0x1242B: - case 0x12446: - case 0x12447: - case 0x12448: - case 0x12449: - case 0x1D368: - case 0x1D7D7: - case 0x1D7E1: - case 0x1D7EB: - case 0x1D7F5: - case 0x1D7FF: - case 0x1F10A: - case 0x2F890: -#endif - return (double) 9.0; - case 0x0F2E: - return (double) 9.0/2.0; - case 0x137A: -#ifdef Py_UNICODE_WIDE - case 0x10118: - case 0x10341: - case 0x10E71: - case 0x1D371: -#endif - return (double) 90.0; -#ifdef Py_UNICODE_WIDE - case 0x10121: - case 0x1034A: - case 0x10E7A: - return (double) 900.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x1012A: - return (double) 9000.0; -#endif -#ifdef Py_UNICODE_WIDE - case 0x10133: - return (double) 90000.0; -#endif - } - return -1.0; -} - -/* Returns 1 for Unicode characters having the bidirectional - * type 'WS', 'B' or 'S' or the category 'Zs', 0 otherwise. - */ -int _PyUnicode_IsWhitespace(register const Py_UNICODE ch) -{ -#ifdef WANT_WCTYPE_FUNCTIONS - return iswspace(ch); -#else - switch (ch) { - case 0x0009: - case 0x000A: - case 0x000B: - case 0x000C: - case 0x000D: - case 0x001C: - case 0x001D: - case 0x001E: - case 0x001F: - case 0x0020: - case 0x0085: - case 0x00A0: - case 0x1680: - case 0x180E: - case 0x2000: - case 0x2001: - case 0x2002: - case 0x2003: - case 0x2004: - case 0x2005: - case 0x2006: - case 0x2007: - case 0x2008: - case 0x2009: - case 0x200A: - case 0x2028: - case 0x2029: - case 0x202F: - case 0x205F: - case 0x3000: - return 1; - } - return 0; -#endif -} - -/* Returns 1 for Unicode characters having the line break - * property 'BK', 'CR', 'LF' or 'NL' or having bidirectional - * type 'B', 0 otherwise. - */ -int _PyUnicode_IsLinebreak(register const Py_UNICODE ch) -{ - switch (ch) { - case 0x000A: - case 0x000B: - case 0x000C: - case 0x000D: - case 0x001C: - case 0x001D: - case 0x001E: - case 0x0085: - case 0x2028: - case 0x2029: - return 1; - } - return 0; -} - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Objects/weakrefobject.c b/AppPkg/Applications/Python/Python-2.7.10/Objects/weakrefobject.c deleted file mode 100644 index dbb87d1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Objects/weakrefobject.c +++ /dev/null @@ -1,981 +0,0 @@ -#include "Python.h" -#include "structmember.h" - - -#define GET_WEAKREFS_LISTPTR(o) \ - ((PyWeakReference **) PyObject_GET_WEAKREFS_LISTPTR(o)) - - -Py_ssize_t -_PyWeakref_GetWeakrefCount(PyWeakReference *head) -{ - Py_ssize_t count = 0; - - while (head != NULL) { - ++count; - head = head->wr_next; - } - return count; -} - - -static void -init_weakref(PyWeakReference *self, PyObject *ob, PyObject *callback) -{ - self->hash = -1; - self->wr_object = ob; - Py_XINCREF(callback); - self->wr_callback = callback; -} - -static PyWeakReference * -new_weakref(PyObject *ob, PyObject *callback) -{ - PyWeakReference *result; - - result = PyObject_GC_New(PyWeakReference, &_PyWeakref_RefType); - if (result) { - init_weakref(result, ob, callback); - PyObject_GC_Track(result); - } - return result; -} - - -/* This function clears the passed-in reference and removes it from the - * list of weak references for the referent. This is the only code that - * removes an item from the doubly-linked list of weak references for an - * object; it is also responsible for clearing the callback slot. - */ -static void -clear_weakref(PyWeakReference *self) -{ - PyObject *callback = self->wr_callback; - - if (self->wr_object != Py_None) { - PyWeakReference **list = GET_WEAKREFS_LISTPTR(self->wr_object); - - if (*list == self) - /* If 'self' is the end of the list (and thus self->wr_next == NULL) - then the weakref list itself (and thus the value of *list) will - end up being set to NULL. */ - *list = self->wr_next; - self->wr_object = Py_None; - if (self->wr_prev != NULL) - self->wr_prev->wr_next = self->wr_next; - if (self->wr_next != NULL) - self->wr_next->wr_prev = self->wr_prev; - self->wr_prev = NULL; - self->wr_next = NULL; - } - if (callback != NULL) { - Py_DECREF(callback); - self->wr_callback = NULL; - } -} - -/* Cyclic gc uses this to *just* clear the passed-in reference, leaving - * the callback intact and uncalled. It must be possible to call self's - * tp_dealloc() after calling this, so self has to be left in a sane enough - * state for that to work. We expect tp_dealloc to decref the callback - * then. The reason for not letting clear_weakref() decref the callback - * right now is that if the callback goes away, that may in turn trigger - * another callback (if a weak reference to the callback exists) -- running - * arbitrary Python code in the middle of gc is a disaster. The convolution - * here allows gc to delay triggering such callbacks until the world is in - * a sane state again. - */ -void -_PyWeakref_ClearRef(PyWeakReference *self) -{ - PyObject *callback; - - assert(self != NULL); - assert(PyWeakref_Check(self)); - /* Preserve and restore the callback around clear_weakref. */ - callback = self->wr_callback; - self->wr_callback = NULL; - clear_weakref(self); - self->wr_callback = callback; -} - -static void -weakref_dealloc(PyObject *self) -{ - PyObject_GC_UnTrack(self); - clear_weakref((PyWeakReference *) self); - Py_TYPE(self)->tp_free(self); -} - - -static int -gc_traverse(PyWeakReference *self, visitproc visit, void *arg) -{ - Py_VISIT(self->wr_callback); - return 0; -} - - -static int -gc_clear(PyWeakReference *self) -{ - clear_weakref(self); - return 0; -} - - -static PyObject * -weakref_call(PyWeakReference *self, PyObject *args, PyObject *kw) -{ - static char *kwlist[] = {NULL}; - - if (PyArg_ParseTupleAndKeywords(args, kw, ":__call__", kwlist)) { - PyObject *object = PyWeakref_GET_OBJECT(self); - Py_INCREF(object); - return (object); - } - return NULL; -} - - -static long -weakref_hash(PyWeakReference *self) -{ - if (self->hash != -1) - return self->hash; - if (PyWeakref_GET_OBJECT(self) == Py_None) { - PyErr_SetString(PyExc_TypeError, "weak object has gone away"); - return -1; - } - self->hash = PyObject_Hash(PyWeakref_GET_OBJECT(self)); - return self->hash; -} - - -static PyObject * -weakref_repr(PyWeakReference *self) -{ - char buffer[256]; - if (PyWeakref_GET_OBJECT(self) == Py_None) { - PyOS_snprintf(buffer, sizeof(buffer), "", self); - } - else { - char *name = NULL; - PyObject *nameobj = PyObject_GetAttrString(PyWeakref_GET_OBJECT(self), - "__name__"); - if (nameobj == NULL) - PyErr_Clear(); - else if (PyString_Check(nameobj)) - name = PyString_AS_STRING(nameobj); - if (name != NULL) { - PyOS_snprintf(buffer, sizeof(buffer), - "", - self, - Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, - PyWeakref_GET_OBJECT(self), - name); - } - else { - PyOS_snprintf(buffer, sizeof(buffer), - "", - self, - Py_TYPE(PyWeakref_GET_OBJECT(self))->tp_name, - PyWeakref_GET_OBJECT(self)); - } - Py_XDECREF(nameobj); - } - return PyString_FromString(buffer); -} - -/* Weak references only support equality, not ordering. Two weak references - are equal if the underlying objects are equal. If the underlying object has - gone away, they are equal if they are identical. */ - -static PyObject * -weakref_richcompare(PyWeakReference* self, PyWeakReference* other, int op) -{ - if ((op != Py_EQ && op != Py_NE) || self->ob_type != other->ob_type) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - if (PyWeakref_GET_OBJECT(self) == Py_None - || PyWeakref_GET_OBJECT(other) == Py_None) { - int res = (self == other); - if (op == Py_NE) - res = !res; - if (res) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; - } - return PyObject_RichCompare(PyWeakref_GET_OBJECT(self), - PyWeakref_GET_OBJECT(other), op); -} - -/* Given the head of an object's list of weak references, extract the - * two callback-less refs (ref and proxy). Used to determine if the - * shared references exist and to determine the back link for newly - * inserted references. - */ -static void -get_basic_refs(PyWeakReference *head, - PyWeakReference **refp, PyWeakReference **proxyp) -{ - *refp = NULL; - *proxyp = NULL; - - if (head != NULL && head->wr_callback == NULL) { - /* We need to be careful that the "basic refs" aren't - subclasses of the main types. That complicates this a - little. */ - if (PyWeakref_CheckRefExact(head)) { - *refp = head; - head = head->wr_next; - } - if (head != NULL - && head->wr_callback == NULL - && PyWeakref_CheckProxy(head)) { - *proxyp = head; - /* head = head->wr_next; */ - } - } -} - -/* Insert 'newref' in the list after 'prev'. Both must be non-NULL. */ -static void -insert_after(PyWeakReference *newref, PyWeakReference *prev) -{ - newref->wr_prev = prev; - newref->wr_next = prev->wr_next; - if (prev->wr_next != NULL) - prev->wr_next->wr_prev = newref; - prev->wr_next = newref; -} - -/* Insert 'newref' at the head of the list; 'list' points to the variable - * that stores the head. - */ -static void -insert_head(PyWeakReference *newref, PyWeakReference **list) -{ - PyWeakReference *next = *list; - - newref->wr_prev = NULL; - newref->wr_next = next; - if (next != NULL) - next->wr_prev = newref; - *list = newref; -} - -static int -parse_weakref_init_args(char *funcname, PyObject *args, PyObject *kwargs, - PyObject **obp, PyObject **callbackp) -{ - /* XXX Should check that kwargs == NULL or is empty. */ - return PyArg_UnpackTuple(args, funcname, 1, 2, obp, callbackp); -} - -static PyObject * -weakref___new__(PyTypeObject *type, PyObject *args, PyObject *kwargs) -{ - PyWeakReference *self = NULL; - PyObject *ob, *callback = NULL; - - if (parse_weakref_init_args("__new__", args, kwargs, &ob, &callback)) { - PyWeakReference *ref, *proxy; - PyWeakReference **list; - - if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { - PyErr_Format(PyExc_TypeError, - "cannot create weak reference to '%s' object", - Py_TYPE(ob)->tp_name); - return NULL; - } - if (callback == Py_None) - callback = NULL; - list = GET_WEAKREFS_LISTPTR(ob); - get_basic_refs(*list, &ref, &proxy); - if (callback == NULL && type == &_PyWeakref_RefType) { - if (ref != NULL) { - /* We can re-use an existing reference. */ - Py_INCREF(ref); - return (PyObject *)ref; - } - } - /* We have to create a new reference. */ - /* Note: the tp_alloc() can trigger cyclic GC, so the weakref - list on ob can be mutated. This means that the ref and - proxy pointers we got back earlier may have been collected, - so we need to compute these values again before we use - them. */ - self = (PyWeakReference *) (type->tp_alloc(type, 0)); - if (self != NULL) { - init_weakref(self, ob, callback); - if (callback == NULL && type == &_PyWeakref_RefType) { - insert_head(self, list); - } - else { - PyWeakReference *prev; - - get_basic_refs(*list, &ref, &proxy); - prev = (proxy == NULL) ? ref : proxy; - if (prev == NULL) - insert_head(self, list); - else - insert_after(self, prev); - } - } - } - return (PyObject *)self; -} - -static int -weakref___init__(PyObject *self, PyObject *args, PyObject *kwargs) -{ - PyObject *tmp; - - if (parse_weakref_init_args("__init__", args, kwargs, &tmp, &tmp)) - return 0; - else - return -1; -} - - -PyTypeObject -_PyWeakref_RefType = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "weakref", - sizeof(PyWeakReference), - 0, - weakref_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - (reprfunc)weakref_repr, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - (hashfunc)weakref_hash, /*tp_hash*/ - (ternaryfunc)weakref_call, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC | Py_TPFLAGS_HAVE_RICHCOMPARE - | Py_TPFLAGS_BASETYPE, /*tp_flags*/ - 0, /*tp_doc*/ - (traverseproc)gc_traverse, /*tp_traverse*/ - (inquiry)gc_clear, /*tp_clear*/ - (richcmpfunc)weakref_richcompare, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - 0, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - weakref___init__, /*tp_init*/ - PyType_GenericAlloc, /*tp_alloc*/ - weakref___new__, /*tp_new*/ - PyObject_GC_Del, /*tp_free*/ -}; - - -static int -proxy_checkref(PyWeakReference *proxy) -{ - if (PyWeakref_GET_OBJECT(proxy) == Py_None) { - PyErr_SetString(PyExc_ReferenceError, - "weakly-referenced object no longer exists"); - return 0; - } - return 1; -} - - -/* If a parameter is a proxy, check that it is still "live" and wrap it, - * replacing the original value with the raw object. Raises ReferenceError - * if the param is a dead proxy. - */ -#define UNWRAP(o) \ - if (PyWeakref_CheckProxy(o)) { \ - if (!proxy_checkref((PyWeakReference *)o)) \ - return NULL; \ - o = PyWeakref_GET_OBJECT(o); \ - } - -#define UNWRAP_I(o) \ - if (PyWeakref_CheckProxy(o)) { \ - if (!proxy_checkref((PyWeakReference *)o)) \ - return -1; \ - o = PyWeakref_GET_OBJECT(o); \ - } - -#define WRAP_UNARY(method, generic) \ - static PyObject * \ - method(PyObject *proxy) { \ - UNWRAP(proxy); \ - return generic(proxy); \ - } - -#define WRAP_BINARY(method, generic) \ - static PyObject * \ - method(PyObject *x, PyObject *y) { \ - UNWRAP(x); \ - UNWRAP(y); \ - return generic(x, y); \ - } - -/* Note that the third arg needs to be checked for NULL since the tp_call - * slot can receive NULL for this arg. - */ -#define WRAP_TERNARY(method, generic) \ - static PyObject * \ - method(PyObject *proxy, PyObject *v, PyObject *w) { \ - UNWRAP(proxy); \ - UNWRAP(v); \ - if (w != NULL) \ - UNWRAP(w); \ - return generic(proxy, v, w); \ - } - -#define WRAP_METHOD(method, special) \ - static PyObject * \ - method(PyObject *proxy) { \ - UNWRAP(proxy); \ - return PyObject_CallMethod(proxy, special, ""); \ - } - - -/* direct slots */ - -WRAP_BINARY(proxy_getattr, PyObject_GetAttr) -WRAP_UNARY(proxy_str, PyObject_Str) -WRAP_TERNARY(proxy_call, PyEval_CallObjectWithKeywords) - -static PyObject * -proxy_repr(PyWeakReference *proxy) -{ - char buf[160]; - PyOS_snprintf(buf, sizeof(buf), - "", proxy, - Py_TYPE(PyWeakref_GET_OBJECT(proxy))->tp_name, - PyWeakref_GET_OBJECT(proxy)); - return PyString_FromString(buf); -} - - -static int -proxy_setattr(PyWeakReference *proxy, PyObject *name, PyObject *value) -{ - if (!proxy_checkref(proxy)) - return -1; - return PyObject_SetAttr(PyWeakref_GET_OBJECT(proxy), name, value); -} - -static int -proxy_compare(PyObject *proxy, PyObject *v) -{ - UNWRAP_I(proxy); - UNWRAP_I(v); - return PyObject_Compare(proxy, v); -} - -/* number slots */ -WRAP_BINARY(proxy_add, PyNumber_Add) -WRAP_BINARY(proxy_sub, PyNumber_Subtract) -WRAP_BINARY(proxy_mul, PyNumber_Multiply) -WRAP_BINARY(proxy_div, PyNumber_Divide) -WRAP_BINARY(proxy_floor_div, PyNumber_FloorDivide) -WRAP_BINARY(proxy_true_div, PyNumber_TrueDivide) -WRAP_BINARY(proxy_mod, PyNumber_Remainder) -WRAP_BINARY(proxy_divmod, PyNumber_Divmod) -WRAP_TERNARY(proxy_pow, PyNumber_Power) -WRAP_UNARY(proxy_neg, PyNumber_Negative) -WRAP_UNARY(proxy_pos, PyNumber_Positive) -WRAP_UNARY(proxy_abs, PyNumber_Absolute) -WRAP_UNARY(proxy_invert, PyNumber_Invert) -WRAP_BINARY(proxy_lshift, PyNumber_Lshift) -WRAP_BINARY(proxy_rshift, PyNumber_Rshift) -WRAP_BINARY(proxy_and, PyNumber_And) -WRAP_BINARY(proxy_xor, PyNumber_Xor) -WRAP_BINARY(proxy_or, PyNumber_Or) -WRAP_UNARY(proxy_int, PyNumber_Int) -WRAP_UNARY(proxy_long, PyNumber_Long) -WRAP_UNARY(proxy_float, PyNumber_Float) -WRAP_BINARY(proxy_iadd, PyNumber_InPlaceAdd) -WRAP_BINARY(proxy_isub, PyNumber_InPlaceSubtract) -WRAP_BINARY(proxy_imul, PyNumber_InPlaceMultiply) -WRAP_BINARY(proxy_idiv, PyNumber_InPlaceDivide) -WRAP_BINARY(proxy_ifloor_div, PyNumber_InPlaceFloorDivide) -WRAP_BINARY(proxy_itrue_div, PyNumber_InPlaceTrueDivide) -WRAP_BINARY(proxy_imod, PyNumber_InPlaceRemainder) -WRAP_TERNARY(proxy_ipow, PyNumber_InPlacePower) -WRAP_BINARY(proxy_ilshift, PyNumber_InPlaceLshift) -WRAP_BINARY(proxy_irshift, PyNumber_InPlaceRshift) -WRAP_BINARY(proxy_iand, PyNumber_InPlaceAnd) -WRAP_BINARY(proxy_ixor, PyNumber_InPlaceXor) -WRAP_BINARY(proxy_ior, PyNumber_InPlaceOr) -WRAP_UNARY(proxy_index, PyNumber_Index) - -static int -proxy_nonzero(PyWeakReference *proxy) -{ - PyObject *o = PyWeakref_GET_OBJECT(proxy); - if (!proxy_checkref(proxy)) - return -1; - return PyObject_IsTrue(o); -} - -static void -proxy_dealloc(PyWeakReference *self) -{ - if (self->wr_callback != NULL) - PyObject_GC_UnTrack((PyObject *)self); - clear_weakref(self); - PyObject_GC_Del(self); -} - -/* sequence slots */ - -static PyObject * -proxy_slice(PyWeakReference *proxy, Py_ssize_t i, Py_ssize_t j) -{ - if (!proxy_checkref(proxy)) - return NULL; - return PySequence_GetSlice(PyWeakref_GET_OBJECT(proxy), i, j); -} - -static int -proxy_ass_slice(PyWeakReference *proxy, Py_ssize_t i, Py_ssize_t j, PyObject *value) -{ - if (!proxy_checkref(proxy)) - return -1; - return PySequence_SetSlice(PyWeakref_GET_OBJECT(proxy), i, j, value); -} - -static int -proxy_contains(PyWeakReference *proxy, PyObject *value) -{ - if (!proxy_checkref(proxy)) - return -1; - return PySequence_Contains(PyWeakref_GET_OBJECT(proxy), value); -} - - -/* mapping slots */ - -static Py_ssize_t -proxy_length(PyWeakReference *proxy) -{ - if (!proxy_checkref(proxy)) - return -1; - return PyObject_Length(PyWeakref_GET_OBJECT(proxy)); -} - -WRAP_BINARY(proxy_getitem, PyObject_GetItem) - -static int -proxy_setitem(PyWeakReference *proxy, PyObject *key, PyObject *value) -{ - if (!proxy_checkref(proxy)) - return -1; - - if (value == NULL) - return PyObject_DelItem(PyWeakref_GET_OBJECT(proxy), key); - else - return PyObject_SetItem(PyWeakref_GET_OBJECT(proxy), key, value); -} - -/* iterator slots */ - -static PyObject * -proxy_iter(PyWeakReference *proxy) -{ - if (!proxy_checkref(proxy)) - return NULL; - return PyObject_GetIter(PyWeakref_GET_OBJECT(proxy)); -} - -static PyObject * -proxy_iternext(PyWeakReference *proxy) -{ - if (!proxy_checkref(proxy)) - return NULL; - return PyIter_Next(PyWeakref_GET_OBJECT(proxy)); -} - - -WRAP_METHOD(proxy_unicode, "__unicode__"); - - -static PyMethodDef proxy_methods[] = { - {"__unicode__", (PyCFunction)proxy_unicode, METH_NOARGS}, - {NULL, NULL} -}; - - -static PyNumberMethods proxy_as_number = { - proxy_add, /*nb_add*/ - proxy_sub, /*nb_subtract*/ - proxy_mul, /*nb_multiply*/ - proxy_div, /*nb_divide*/ - proxy_mod, /*nb_remainder*/ - proxy_divmod, /*nb_divmod*/ - proxy_pow, /*nb_power*/ - proxy_neg, /*nb_negative*/ - proxy_pos, /*nb_positive*/ - proxy_abs, /*nb_absolute*/ - (inquiry)proxy_nonzero, /*nb_nonzero*/ - proxy_invert, /*nb_invert*/ - proxy_lshift, /*nb_lshift*/ - proxy_rshift, /*nb_rshift*/ - proxy_and, /*nb_and*/ - proxy_xor, /*nb_xor*/ - proxy_or, /*nb_or*/ - 0, /*nb_coerce*/ - proxy_int, /*nb_int*/ - proxy_long, /*nb_long*/ - proxy_float, /*nb_float*/ - 0, /*nb_oct*/ - 0, /*nb_hex*/ - proxy_iadd, /*nb_inplace_add*/ - proxy_isub, /*nb_inplace_subtract*/ - proxy_imul, /*nb_inplace_multiply*/ - proxy_idiv, /*nb_inplace_divide*/ - proxy_imod, /*nb_inplace_remainder*/ - proxy_ipow, /*nb_inplace_power*/ - proxy_ilshift, /*nb_inplace_lshift*/ - proxy_irshift, /*nb_inplace_rshift*/ - proxy_iand, /*nb_inplace_and*/ - proxy_ixor, /*nb_inplace_xor*/ - proxy_ior, /*nb_inplace_or*/ - proxy_floor_div, /*nb_floor_divide*/ - proxy_true_div, /*nb_true_divide*/ - proxy_ifloor_div, /*nb_inplace_floor_divide*/ - proxy_itrue_div, /*nb_inplace_true_divide*/ - proxy_index, /*nb_index*/ -}; - -static PySequenceMethods proxy_as_sequence = { - (lenfunc)proxy_length, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - (ssizessizeargfunc)proxy_slice, /*sq_slice*/ - 0, /*sq_ass_item*/ - (ssizessizeobjargproc)proxy_ass_slice, /*sq_ass_slice*/ - (objobjproc)proxy_contains, /* sq_contains */ -}; - -static PyMappingMethods proxy_as_mapping = { - (lenfunc)proxy_length, /*mp_length*/ - proxy_getitem, /*mp_subscript*/ - (objobjargproc)proxy_setitem, /*mp_ass_subscript*/ -}; - - -PyTypeObject -_PyWeakref_ProxyType = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "weakproxy", - sizeof(PyWeakReference), - 0, - /* methods */ - (destructor)proxy_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - proxy_compare, /* tp_compare */ - (reprfunc)proxy_repr, /* tp_repr */ - &proxy_as_number, /* tp_as_number */ - &proxy_as_sequence, /* tp_as_sequence */ - &proxy_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - proxy_str, /* tp_str */ - proxy_getattr, /* tp_getattro */ - (setattrofunc)proxy_setattr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)gc_traverse, /* tp_traverse */ - (inquiry)gc_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)proxy_iter, /* tp_iter */ - (iternextfunc)proxy_iternext, /* tp_iternext */ - proxy_methods, /* tp_methods */ -}; - - -PyTypeObject -_PyWeakref_CallableProxyType = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "weakcallableproxy", - sizeof(PyWeakReference), - 0, - /* methods */ - (destructor)proxy_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - proxy_compare, /* tp_compare */ - (unaryfunc)proxy_repr, /* tp_repr */ - &proxy_as_number, /* tp_as_number */ - &proxy_as_sequence, /* tp_as_sequence */ - &proxy_as_mapping, /* tp_as_mapping */ - 0, /* tp_hash */ - proxy_call, /* tp_call */ - proxy_str, /* tp_str */ - proxy_getattr, /* tp_getattro */ - (setattrofunc)proxy_setattr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC - | Py_TPFLAGS_CHECKTYPES, /* tp_flags */ - 0, /* tp_doc */ - (traverseproc)gc_traverse, /* tp_traverse */ - (inquiry)gc_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - (getiterfunc)proxy_iter, /* tp_iter */ - (iternextfunc)proxy_iternext, /* tp_iternext */ -}; - - - -PyObject * -PyWeakref_NewRef(PyObject *ob, PyObject *callback) -{ - PyWeakReference *result = NULL; - PyWeakReference **list; - PyWeakReference *ref, *proxy; - - if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { - PyErr_Format(PyExc_TypeError, - "cannot create weak reference to '%s' object", - Py_TYPE(ob)->tp_name); - return NULL; - } - list = GET_WEAKREFS_LISTPTR(ob); - get_basic_refs(*list, &ref, &proxy); - if (callback == Py_None) - callback = NULL; - if (callback == NULL) - /* return existing weak reference if it exists */ - result = ref; - if (result != NULL) - Py_INCREF(result); - else { - /* Note: new_weakref() can trigger cyclic GC, so the weakref - list on ob can be mutated. This means that the ref and - proxy pointers we got back earlier may have been collected, - so we need to compute these values again before we use - them. */ - result = new_weakref(ob, callback); - if (result != NULL) { - get_basic_refs(*list, &ref, &proxy); - if (callback == NULL) { - if (ref == NULL) - insert_head(result, list); - else { - /* Someone else added a ref without a callback - during GC. Return that one instead of this one - to avoid violating the invariants of the list - of weakrefs for ob. */ - Py_DECREF(result); - Py_INCREF(ref); - result = ref; - } - } - else { - PyWeakReference *prev; - - prev = (proxy == NULL) ? ref : proxy; - if (prev == NULL) - insert_head(result, list); - else - insert_after(result, prev); - } - } - } - return (PyObject *) result; -} - - -PyObject * -PyWeakref_NewProxy(PyObject *ob, PyObject *callback) -{ - PyWeakReference *result = NULL; - PyWeakReference **list; - PyWeakReference *ref, *proxy; - - if (!PyType_SUPPORTS_WEAKREFS(Py_TYPE(ob))) { - PyErr_Format(PyExc_TypeError, - "cannot create weak reference to '%s' object", - Py_TYPE(ob)->tp_name); - return NULL; - } - list = GET_WEAKREFS_LISTPTR(ob); - get_basic_refs(*list, &ref, &proxy); - if (callback == Py_None) - callback = NULL; - if (callback == NULL) - /* attempt to return an existing weak reference if it exists */ - result = proxy; - if (result != NULL) - Py_INCREF(result); - else { - /* Note: new_weakref() can trigger cyclic GC, so the weakref - list on ob can be mutated. This means that the ref and - proxy pointers we got back earlier may have been collected, - so we need to compute these values again before we use - them. */ - result = new_weakref(ob, callback); - if (result != NULL) { - PyWeakReference *prev; - - if (PyCallable_Check(ob)) - Py_TYPE(result) = &_PyWeakref_CallableProxyType; - else - Py_TYPE(result) = &_PyWeakref_ProxyType; - get_basic_refs(*list, &ref, &proxy); - if (callback == NULL) { - if (proxy != NULL) { - /* Someone else added a proxy without a callback - during GC. Return that one instead of this one - to avoid violating the invariants of the list - of weakrefs for ob. */ - Py_DECREF(result); - Py_INCREF(result = proxy); - goto skip_insert; - } - prev = ref; - } - else - prev = (proxy == NULL) ? ref : proxy; - - if (prev == NULL) - insert_head(result, list); - else - insert_after(result, prev); - skip_insert: - ; - } - } - return (PyObject *) result; -} - - -PyObject * -PyWeakref_GetObject(PyObject *ref) -{ - if (ref == NULL || !PyWeakref_Check(ref)) { - PyErr_BadInternalCall(); - return NULL; - } - return PyWeakref_GET_OBJECT(ref); -} - -/* Note that there's an inlined copy-paste of handle_callback() in gcmodule.c's - * handle_weakrefs(). - */ -static void -handle_callback(PyWeakReference *ref, PyObject *callback) -{ - PyObject *cbresult = PyObject_CallFunctionObjArgs(callback, ref, NULL); - - if (cbresult == NULL) - PyErr_WriteUnraisable(callback); - else - Py_DECREF(cbresult); -} - -/* This function is called by the tp_dealloc handler to clear weak references. - * - * This iterates through the weak references for 'object' and calls callbacks - * for those references which have one. It returns when all callbacks have - * been attempted. - */ -void -PyObject_ClearWeakRefs(PyObject *object) -{ - PyWeakReference **list; - - if (object == NULL - || !PyType_SUPPORTS_WEAKREFS(Py_TYPE(object)) - || object->ob_refcnt != 0) { - PyErr_BadInternalCall(); - return; - } - list = GET_WEAKREFS_LISTPTR(object); - /* Remove the callback-less basic and proxy references */ - if (*list != NULL && (*list)->wr_callback == NULL) { - clear_weakref(*list); - if (*list != NULL && (*list)->wr_callback == NULL) - clear_weakref(*list); - } - if (*list != NULL) { - PyWeakReference *current = *list; - Py_ssize_t count = _PyWeakref_GetWeakrefCount(current); - PyObject *err_type, *err_value, *err_tb; - - PyErr_Fetch(&err_type, &err_value, &err_tb); - if (count == 1) { - PyObject *callback = current->wr_callback; - - current->wr_callback = NULL; - clear_weakref(current); - if (callback != NULL) { - if (current->ob_refcnt > 0) - handle_callback(current, callback); - Py_DECREF(callback); - } - } - else { - PyObject *tuple; - Py_ssize_t i = 0; - - tuple = PyTuple_New(count * 2); - if (tuple == NULL) { - _PyErr_ReplaceException(err_type, err_value, err_tb); - return; - } - - for (i = 0; i < count; ++i) { - PyWeakReference *next = current->wr_next; - - if (current->ob_refcnt > 0) - { - Py_INCREF(current); - PyTuple_SET_ITEM(tuple, i * 2, (PyObject *) current); - PyTuple_SET_ITEM(tuple, i * 2 + 1, current->wr_callback); - } - else { - Py_DECREF(current->wr_callback); - } - current->wr_callback = NULL; - clear_weakref(current); - current = next; - } - for (i = 0; i < count; ++i) { - PyObject *callback = PyTuple_GET_ITEM(tuple, i * 2 + 1); - - /* The tuple may have slots left to NULL */ - if (callback != NULL) { - PyObject *item = PyTuple_GET_ITEM(tuple, i * 2); - handle_callback((PyWeakReference *)item, callback); - } - } - Py_DECREF(tuple); - } - assert(!PyErr_Occurred()); - PyErr_Restore(err_type, err_value, err_tb); - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/acceler.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/acceler.c deleted file mode 100644 index f6036d9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/acceler.c +++ /dev/null @@ -1,125 +0,0 @@ - -/* Parser accelerator module */ - -/* The parser as originally conceived had disappointing performance. - This module does some precomputation that speeds up the selection - of a DFA based upon a token, turning a search through an array - into a simple indexing operation. The parser now cannot work - without the accelerators installed. Note that the accelerators - are installed dynamically when the parser is initialized, they - are not part of the static data structure written on graminit.[ch] - by the parser generator. */ - -#include "pgenheaders.h" -#include "grammar.h" -#include "node.h" -#include "token.h" -#include "parser.h" - -/* Forward references */ -static void fixdfa(grammar *, dfa *); -static void fixstate(grammar *, state *); - -void -PyGrammar_AddAccelerators(grammar *g) -{ - dfa *d; - int i; - d = g->g_dfa; - for (i = g->g_ndfas; --i >= 0; d++) - fixdfa(g, d); - g->g_accel = 1; -} - -void -PyGrammar_RemoveAccelerators(grammar *g) -{ - dfa *d; - int i; - g->g_accel = 0; - d = g->g_dfa; - for (i = g->g_ndfas; --i >= 0; d++) { - state *s; - int j; - s = d->d_state; - for (j = 0; j < d->d_nstates; j++, s++) { - if (s->s_accel) - PyObject_FREE(s->s_accel); - s->s_accel = NULL; - } - } -} - -static void -fixdfa(grammar *g, dfa *d) -{ - state *s; - int j; - s = d->d_state; - for (j = 0; j < d->d_nstates; j++, s++) - fixstate(g, s); -} - -static void -fixstate(grammar *g, state *s) -{ - arc *a; - int k; - int *accel; - int nl = g->g_ll.ll_nlabels; - s->s_accept = 0; - accel = (int *) PyObject_MALLOC(nl * sizeof(int)); - if (accel == NULL) { - fprintf(stderr, "no mem to build parser accelerators\n"); - exit(1); - } - for (k = 0; k < nl; k++) - accel[k] = -1; - a = s->s_arc; - for (k = s->s_narcs; --k >= 0; a++) { - int lbl = a->a_lbl; - label *l = &g->g_ll.ll_label[lbl]; - int type = l->lb_type; - if (a->a_arrow >= (1 << 7)) { - printf("XXX too many states!\n"); - continue; - } - if (ISNONTERMINAL(type)) { - dfa *d1 = PyGrammar_FindDFA(g, type); - int ibit; - if (type - NT_OFFSET >= (1 << 7)) { - printf("XXX too high nonterminal number!\n"); - continue; - } - for (ibit = 0; ibit < g->g_ll.ll_nlabels; ibit++) { - if (testbit(d1->d_first, ibit)) { - if (accel[ibit] != -1) - printf("XXX ambiguity!\n"); - accel[ibit] = a->a_arrow | (1 << 7) | - ((type - NT_OFFSET) << 8); - } - } - } - else if (lbl == EMPTY) - s->s_accept = 1; - else if (lbl >= 0 && lbl < nl) - accel[lbl] = a->a_arrow; - } - while (nl > 0 && accel[nl-1] == -1) - nl--; - for (k = 0; k < nl && accel[k] == -1;) - k++; - if (k < nl) { - int i; - s->s_accel = (int *) PyObject_MALLOC((nl-k) * sizeof(int)); - if (s->s_accel == NULL) { - fprintf(stderr, "no mem to add parser accelerators\n"); - exit(1); - } - s->s_lower = k; - s->s_upper = nl; - for (i = 0; k < nl; i++, k++) - s->s_accel[i] = accel[k]; - } - PyObject_FREE(accel); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/bitset.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/bitset.c deleted file mode 100644 index 3bf5da1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/bitset.c +++ /dev/null @@ -1,66 +0,0 @@ - -/* Bitset primitives used by the parser generator */ - -#include "pgenheaders.h" -#include "bitset.h" - -bitset -newbitset(int nbits) -{ - int nbytes = NBYTES(nbits); - bitset ss = (char *)PyObject_MALLOC(sizeof(BYTE) * nbytes); - - if (ss == NULL) - Py_FatalError("no mem for bitset"); - - ss += nbytes; - while (--nbytes >= 0) - *--ss = 0; - return ss; -} - -void -delbitset(bitset ss) -{ - PyObject_FREE(ss); -} - -int -addbit(bitset ss, int ibit) -{ - int ibyte = BIT2BYTE(ibit); - BYTE mask = BIT2MASK(ibit); - - if (ss[ibyte] & mask) - return 0; /* Bit already set */ - ss[ibyte] |= mask; - return 1; -} - -#if 0 /* Now a macro */ -int -testbit(bitset ss, int ibit) -{ - return (ss[BIT2BYTE(ibit)] & BIT2MASK(ibit)) != 0; -} -#endif - -int -samebitset(bitset ss1, bitset ss2, int nbits) -{ - int i; - - for (i = NBYTES(nbits); --i >= 0; ) - if (*ss1++ != *ss2++) - return 0; - return 1; -} - -void -mergebitset(bitset ss1, bitset ss2, int nbits) -{ - int i; - - for (i = NBYTES(nbits); --i >= 0; ) - *ss1++ |= *ss2++; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/firstsets.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/firstsets.c deleted file mode 100644 index 69faf8f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/firstsets.c +++ /dev/null @@ -1,113 +0,0 @@ - -/* Computation of FIRST stets */ - -#include "pgenheaders.h" -#include "grammar.h" -#include "token.h" - -extern int Py_DebugFlag; - -/* Forward */ -static void calcfirstset(grammar *, dfa *); - -void -addfirstsets(grammar *g) -{ - int i; - dfa *d; - - if (Py_DebugFlag) - printf("Adding FIRST sets ...\n"); - for (i = 0; i < g->g_ndfas; i++) { - d = &g->g_dfa[i]; - if (d->d_first == NULL) - calcfirstset(g, d); - } -} - -static void -calcfirstset(grammar *g, dfa *d) -{ - int i, j; - state *s; - arc *a; - int nsyms; - int *sym; - int nbits; - static bitset dummy; - bitset result; - int type; - dfa *d1; - label *l0; - - if (Py_DebugFlag) - printf("Calculate FIRST set for '%s'\n", d->d_name); - - if (dummy == NULL) - dummy = newbitset(1); - if (d->d_first == dummy) { - fprintf(stderr, "Left-recursion for '%s'\n", d->d_name); - return; - } - if (d->d_first != NULL) { - fprintf(stderr, "Re-calculating FIRST set for '%s' ???\n", - d->d_name); - } - d->d_first = dummy; - - l0 = g->g_ll.ll_label; - nbits = g->g_ll.ll_nlabels; - result = newbitset(nbits); - - sym = (int *)PyObject_MALLOC(sizeof(int)); - if (sym == NULL) - Py_FatalError("no mem for new sym in calcfirstset"); - nsyms = 1; - sym[0] = findlabel(&g->g_ll, d->d_type, (char *)NULL); - - s = &d->d_state[d->d_initial]; - for (i = 0; i < s->s_narcs; i++) { - a = &s->s_arc[i]; - for (j = 0; j < nsyms; j++) { - if (sym[j] == a->a_lbl) - break; - } - if (j >= nsyms) { /* New label */ - sym = (int *)PyObject_REALLOC(sym, - sizeof(int) * (nsyms + 1)); - if (sym == NULL) - Py_FatalError( - "no mem to resize sym in calcfirstset"); - sym[nsyms++] = a->a_lbl; - type = l0[a->a_lbl].lb_type; - if (ISNONTERMINAL(type)) { - d1 = PyGrammar_FindDFA(g, type); - if (d1->d_first == dummy) { - fprintf(stderr, - "Left-recursion below '%s'\n", - d->d_name); - } - else { - if (d1->d_first == NULL) - calcfirstset(g, d1); - mergebitset(result, - d1->d_first, nbits); - } - } - else if (ISTERMINAL(type)) { - addbit(result, a->a_lbl); - } - } - } - d->d_first = result; - if (Py_DebugFlag) { - printf("FIRST set for '%s': {", d->d_name); - for (i = 0; i < nbits; i++) { - if (testbit(result, i)) - printf(" %s", PyGrammar_LabelRepr(&l0[i])); - } - printf(" }\n"); - } - - PyObject_FREE(sym); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/grammar.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/grammar.c deleted file mode 100644 index 4cce422..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/grammar.c +++ /dev/null @@ -1,254 +0,0 @@ - -/* Grammar implementation */ - -#include "Python.h" -#include "pgenheaders.h" - -#include - -#include "token.h" -#include "grammar.h" - -#ifdef RISCOS -#include -#endif - -extern int Py_DebugFlag; - -grammar * -newgrammar(int start) -{ - grammar *g; - - g = (grammar *)PyObject_MALLOC(sizeof(grammar)); - if (g == NULL) - Py_FatalError("no mem for new grammar"); - g->g_ndfas = 0; - g->g_dfa = NULL; - g->g_start = start; - g->g_ll.ll_nlabels = 0; - g->g_ll.ll_label = NULL; - g->g_accel = 0; - return g; -} - -dfa * -adddfa(grammar *g, int type, char *name) -{ - dfa *d; - - g->g_dfa = (dfa *)PyObject_REALLOC(g->g_dfa, - sizeof(dfa) * (g->g_ndfas + 1)); - if (g->g_dfa == NULL) - Py_FatalError("no mem to resize dfa in adddfa"); - d = &g->g_dfa[g->g_ndfas++]; - d->d_type = type; - d->d_name = strdup(name); - d->d_nstates = 0; - d->d_state = NULL; - d->d_initial = -1; - d->d_first = NULL; - return d; /* Only use while fresh! */ -} - -int -addstate(dfa *d) -{ - state *s; - - d->d_state = (state *)PyObject_REALLOC(d->d_state, - sizeof(state) * (d->d_nstates + 1)); - if (d->d_state == NULL) - Py_FatalError("no mem to resize state in addstate"); - s = &d->d_state[d->d_nstates++]; - s->s_narcs = 0; - s->s_arc = NULL; - s->s_lower = 0; - s->s_upper = 0; - s->s_accel = NULL; - s->s_accept = 0; - return s - d->d_state; -} - -void -addarc(dfa *d, int from, int to, int lbl) -{ - state *s; - arc *a; - - assert(0 <= from && from < d->d_nstates); - assert(0 <= to && to < d->d_nstates); - - s = &d->d_state[from]; - s->s_arc = (arc *)PyObject_REALLOC(s->s_arc, sizeof(arc) * (s->s_narcs + 1)); - if (s->s_arc == NULL) - Py_FatalError("no mem to resize arc list in addarc"); - a = &s->s_arc[s->s_narcs++]; - a->a_lbl = lbl; - a->a_arrow = to; -} - -int -addlabel(labellist *ll, int type, char *str) -{ - int i; - label *lb; - - for (i = 0; i < ll->ll_nlabels; i++) { - if (ll->ll_label[i].lb_type == type && - strcmp(ll->ll_label[i].lb_str, str) == 0) - return i; - } - ll->ll_label = (label *)PyObject_REALLOC(ll->ll_label, - sizeof(label) * (ll->ll_nlabels + 1)); - if (ll->ll_label == NULL) - Py_FatalError("no mem to resize labellist in addlabel"); - lb = &ll->ll_label[ll->ll_nlabels++]; - lb->lb_type = type; - lb->lb_str = strdup(str); - if (Py_DebugFlag) - printf("Label @ %8p, %d: %s\n", ll, ll->ll_nlabels, - PyGrammar_LabelRepr(lb)); - return lb - ll->ll_label; -} - -/* Same, but rather dies than adds */ - -int -findlabel(labellist *ll, int type, char *str) -{ - int i; - - for (i = 0; i < ll->ll_nlabels; i++) { - if (ll->ll_label[i].lb_type == type /*&& - strcmp(ll->ll_label[i].lb_str, str) == 0*/) - return i; - } - fprintf(stderr, "Label %d/'%s' not found\n", type, str); - Py_FatalError("grammar.c:findlabel()"); - return 0; /* Make gcc -Wall happy */ -} - -/* Forward */ -static void translabel(grammar *, label *); - -void -translatelabels(grammar *g) -{ - int i; - -#ifdef Py_DEBUG - printf("Translating labels ...\n"); -#endif - /* Don't translate EMPTY */ - for (i = EMPTY+1; i < g->g_ll.ll_nlabels; i++) - translabel(g, &g->g_ll.ll_label[i]); -} - -static void -translabel(grammar *g, label *lb) -{ - int i; - - if (Py_DebugFlag) - printf("Translating label %s ...\n", PyGrammar_LabelRepr(lb)); - - if (lb->lb_type == NAME) { - for (i = 0; i < g->g_ndfas; i++) { - if (strcmp(lb->lb_str, g->g_dfa[i].d_name) == 0) { - if (Py_DebugFlag) - printf( - "Label %s is non-terminal %d.\n", - lb->lb_str, - g->g_dfa[i].d_type); - lb->lb_type = g->g_dfa[i].d_type; - free(lb->lb_str); - lb->lb_str = NULL; - return; - } - } - for (i = 0; i < (int)N_TOKENS; i++) { - if (strcmp(lb->lb_str, _PyParser_TokenNames[i]) == 0) { - if (Py_DebugFlag) - printf("Label %s is terminal %d.\n", - lb->lb_str, i); - lb->lb_type = i; - free(lb->lb_str); - lb->lb_str = NULL; - return; - } - } - printf("Can't translate NAME label '%s'\n", lb->lb_str); - return; - } - - if (lb->lb_type == STRING) { - if (isalpha(Py_CHARMASK(lb->lb_str[1])) || - lb->lb_str[1] == '_') { - char *p; - char *src; - char *dest; - size_t name_len; - if (Py_DebugFlag) - printf("Label %s is a keyword\n", lb->lb_str); - lb->lb_type = NAME; - src = lb->lb_str + 1; - p = strchr(src, '\''); - if (p) - name_len = p - src; - else - name_len = strlen(src); - dest = (char *)malloc(name_len + 1); - if (!dest) { - printf("Can't alloc dest '%s'\n", src); - return; - } - strncpy(dest, src, name_len); - dest[name_len] = '\0'; - free(lb->lb_str); - lb->lb_str = dest; - } - else if (lb->lb_str[2] == lb->lb_str[0]) { - int type = (int) PyToken_OneChar(lb->lb_str[1]); - if (type != OP) { - lb->lb_type = type; - free(lb->lb_str); - lb->lb_str = NULL; - } - else - printf("Unknown OP label %s\n", - lb->lb_str); - } - else if (lb->lb_str[2] && lb->lb_str[3] == lb->lb_str[0]) { - int type = (int) PyToken_TwoChars(lb->lb_str[1], - lb->lb_str[2]); - if (type != OP) { - lb->lb_type = type; - free(lb->lb_str); - lb->lb_str = NULL; - } - else - printf("Unknown OP label %s\n", - lb->lb_str); - } - else if (lb->lb_str[2] && lb->lb_str[3] && lb->lb_str[4] == lb->lb_str[0]) { - int type = (int) PyToken_ThreeChars(lb->lb_str[1], - lb->lb_str[2], - lb->lb_str[3]); - if (type != OP) { - lb->lb_type = type; - free(lb->lb_str); - lb->lb_str = NULL; - } - else - printf("Unknown OP label %s\n", - lb->lb_str); - } - else - printf("Can't translate STRING label %s\n", - lb->lb_str); - } - else - printf("Can't translate label '%s'\n", - PyGrammar_LabelRepr(lb)); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/grammar1.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/grammar1.c deleted file mode 100644 index 27db22f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/grammar1.c +++ /dev/null @@ -1,57 +0,0 @@ - -/* Grammar subroutines needed by parser */ - -#include "Python.h" -#include "pgenheaders.h" -#include "grammar.h" -#include "token.h" - -/* Return the DFA for the given type */ - -dfa * -PyGrammar_FindDFA(grammar *g, register int type) -{ - register dfa *d; -#if 1 - /* Massive speed-up */ - d = &g->g_dfa[type - NT_OFFSET]; - assert(d->d_type == type); - return d; -#else - /* Old, slow version */ - register int i; - - for (i = g->g_ndfas, d = g->g_dfa; --i >= 0; d++) { - if (d->d_type == type) - return d; - } - assert(0); - /* NOTREACHED */ -#endif -} - -char * -PyGrammar_LabelRepr(label *lb) -{ - static char buf[100]; - - if (lb->lb_type == ENDMARKER) - return "EMPTY"; - else if (ISNONTERMINAL(lb->lb_type)) { - if (lb->lb_str == NULL) { - PyOS_snprintf(buf, sizeof(buf), "NT%d", lb->lb_type); - return buf; - } - else - return lb->lb_str; - } - else { - if (lb->lb_str == NULL) - return _PyParser_TokenNames[lb->lb_type]; - else { - PyOS_snprintf(buf, sizeof(buf), "%.32s(%.32s)", - _PyParser_TokenNames[lb->lb_type], lb->lb_str); - return buf; - } - } -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/listnode.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/listnode.c deleted file mode 100644 index 8d59233..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/listnode.c +++ /dev/null @@ -1,66 +0,0 @@ - -/* List a node on a file */ - -#include "pgenheaders.h" -#include "token.h" -#include "node.h" - -/* Forward */ -static void list1node(FILE *, node *); -static void listnode(FILE *, node *); - -void -PyNode_ListTree(node *n) -{ - listnode(stdout, n); -} - -static int level, atbol; - -static void -listnode(FILE *fp, node *n) -{ - level = 0; - atbol = 1; - list1node(fp, n); -} - -static void -list1node(FILE *fp, node *n) -{ - if (n == 0) - return; - if (ISNONTERMINAL(TYPE(n))) { - int i; - for (i = 0; i < NCH(n); i++) - list1node(fp, CHILD(n, i)); - } - else if (ISTERMINAL(TYPE(n))) { - switch (TYPE(n)) { - case INDENT: - ++level; - break; - case DEDENT: - --level; - break; - default: - if (atbol) { - int i; - for (i = 0; i < level; ++i) - fprintf(fp, "\t"); - atbol = 0; - } - if (TYPE(n) == NEWLINE) { - if (STR(n) != NULL) - fprintf(fp, "%s", STR(n)); - fprintf(fp, "\n"); - atbol = 1; - } - else - fprintf(fp, "%s ", STR(n)); - break; - } - } - else - fprintf(fp, "? "); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/metagrammar.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/metagrammar.c deleted file mode 100644 index 299ccaa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/metagrammar.c +++ /dev/null @@ -1,159 +0,0 @@ - -#include "pgenheaders.h" -#include "metagrammar.h" -#include "grammar.h" -#include "pgen.h" -static arc arcs_0_0[3] = { - {2, 0}, - {3, 0}, - {4, 1}, -}; -static arc arcs_0_1[1] = { - {0, 1}, -}; -static state states_0[2] = { - {3, arcs_0_0}, - {1, arcs_0_1}, -}; -static arc arcs_1_0[1] = { - {5, 1}, -}; -static arc arcs_1_1[1] = { - {6, 2}, -}; -static arc arcs_1_2[1] = { - {7, 3}, -}; -static arc arcs_1_3[1] = { - {3, 4}, -}; -static arc arcs_1_4[1] = { - {0, 4}, -}; -static state states_1[5] = { - {1, arcs_1_0}, - {1, arcs_1_1}, - {1, arcs_1_2}, - {1, arcs_1_3}, - {1, arcs_1_4}, -}; -static arc arcs_2_0[1] = { - {8, 1}, -}; -static arc arcs_2_1[2] = { - {9, 0}, - {0, 1}, -}; -static state states_2[2] = { - {1, arcs_2_0}, - {2, arcs_2_1}, -}; -static arc arcs_3_0[1] = { - {10, 1}, -}; -static arc arcs_3_1[2] = { - {10, 1}, - {0, 1}, -}; -static state states_3[2] = { - {1, arcs_3_0}, - {2, arcs_3_1}, -}; -static arc arcs_4_0[2] = { - {11, 1}, - {13, 2}, -}; -static arc arcs_4_1[1] = { - {7, 3}, -}; -static arc arcs_4_2[3] = { - {14, 4}, - {15, 4}, - {0, 2}, -}; -static arc arcs_4_3[1] = { - {12, 4}, -}; -static arc arcs_4_4[1] = { - {0, 4}, -}; -static state states_4[5] = { - {2, arcs_4_0}, - {1, arcs_4_1}, - {3, arcs_4_2}, - {1, arcs_4_3}, - {1, arcs_4_4}, -}; -static arc arcs_5_0[3] = { - {5, 1}, - {16, 1}, - {17, 2}, -}; -static arc arcs_5_1[1] = { - {0, 1}, -}; -static arc arcs_5_2[1] = { - {7, 3}, -}; -static arc arcs_5_3[1] = { - {18, 1}, -}; -static state states_5[4] = { - {3, arcs_5_0}, - {1, arcs_5_1}, - {1, arcs_5_2}, - {1, arcs_5_3}, -}; -static dfa dfas[6] = { - {256, "MSTART", 0, 2, states_0, - "\070\000\000"}, - {257, "RULE", 0, 5, states_1, - "\040\000\000"}, - {258, "RHS", 0, 2, states_2, - "\040\010\003"}, - {259, "ALT", 0, 2, states_3, - "\040\010\003"}, - {260, "ITEM", 0, 5, states_4, - "\040\010\003"}, - {261, "ATOM", 0, 4, states_5, - "\040\000\003"}, -}; -static label labels[19] = { - {0, "EMPTY"}, - {256, 0}, - {257, 0}, - {4, 0}, - {0, 0}, - {1, 0}, - {11, 0}, - {258, 0}, - {259, 0}, - {18, 0}, - {260, 0}, - {9, 0}, - {10, 0}, - {261, 0}, - {16, 0}, - {14, 0}, - {3, 0}, - {7, 0}, - {8, 0}, -}; -static grammar _PyParser_Grammar = { - 6, - dfas, - {19, labels}, - 256 -}; - -grammar * -meta_grammar(void) -{ - return &_PyParser_Grammar; -} - -grammar * -Py_meta_grammar(void) -{ - return meta_grammar(); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/myreadline.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/myreadline.c deleted file mode 100644 index ca99e35..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/myreadline.c +++ /dev/null @@ -1,218 +0,0 @@ - -/* Readline interface for tokenizer.c and [raw_]input() in bltinmodule.c. - By default, or when stdin is not a tty device, we have a super - simple my_readline function using fgets. - Optionally, we can use the GNU readline library. - my_readline() has a different return value from GNU readline(): - - NULL if an interrupt occurred or if an error occurred - - a malloc'ed empty string if EOF was read - - a malloc'ed string ending in \n normally -*/ - -#include "Python.h" -#ifdef MS_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include "windows.h" -#endif /* MS_WINDOWS */ - -#ifdef __VMS -extern char* vms__StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt); -#endif - - -PyThreadState* _PyOS_ReadlineTState; - -#ifdef WITH_THREAD -#include "pythread.h" -static PyThread_type_lock _PyOS_ReadlineLock = NULL; -#endif - -int (*PyOS_InputHook)(void) = NULL; - -#ifdef RISCOS -int Py_RISCOSWimpFlag; -#endif - -/* This function restarts a fgets() after an EINTR error occurred - except if PyOS_InterruptOccurred() returns true. */ - -static int -my_fgets(char *buf, int len, FILE *fp) -{ - char *p; -#ifdef MS_WINDOWS - int i; -#endif - - while (1) { - if (PyOS_InputHook != NULL) - (void)(PyOS_InputHook)(); - errno = 0; - clearerr(fp); - p = fgets(buf, len, fp); - if (p != NULL) - return 0; /* No error */ -#ifdef MS_WINDOWS - /* Ctrl-C anywhere on the line or Ctrl-Z if the only character - on a line will set ERROR_OPERATION_ABORTED. Under normal - circumstances Ctrl-C will also have caused the SIGINT handler - to fire. This signal fires in another thread and is not - guaranteed to have occurred before this point in the code. - - Therefore: check in a small loop to see if the trigger has - fired, in which case assume this is a Ctrl-C event. If it - hasn't fired within 10ms assume that this is a Ctrl-Z on its - own or that the signal isn't going to fire for some other - reason and drop through to check for EOF. - */ - if (GetLastError()==ERROR_OPERATION_ABORTED) { - for (i = 0; i < 10; i++) { - if (PyOS_InterruptOccurred()) - return 1; - Sleep(1); - } - } -#endif /* MS_WINDOWS */ - if (feof(fp)) { - clearerr(fp); - return -1; /* EOF */ - } -#ifdef EINTR - if (errno == EINTR) { - int s; -#ifdef WITH_THREAD - PyEval_RestoreThread(_PyOS_ReadlineTState); -#endif - s = PyErr_CheckSignals(); -#ifdef WITH_THREAD - PyEval_SaveThread(); -#endif - if (s < 0) - return 1; - /* try again */ - continue; - } -#endif - if (PyOS_InterruptOccurred()) { - return 1; /* Interrupt */ - } - return -2; /* Error */ - } - /* NOTREACHED */ -} - - -/* Readline implementation using fgets() */ - -char * -PyOS_StdioReadline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) -{ - size_t n; - char *p; - n = 100; - if ((p = (char *)PyMem_MALLOC(n)) == NULL) - return NULL; - fflush(sys_stdout); -#ifndef RISCOS - if (prompt) - fprintf(stderr, "%s", prompt); -#else - if (prompt) { - if(Py_RISCOSWimpFlag) - fprintf(stderr, "\x0cr%s\x0c", prompt); - else - fprintf(stderr, "%s", prompt); - } -#endif - fflush(stderr); - switch (my_fgets(p, (int)n, sys_stdin)) { - case 0: /* Normal case */ - break; - case 1: /* Interrupt */ - PyMem_FREE(p); - return NULL; - case -1: /* EOF */ - case -2: /* Error */ - default: /* Shouldn't happen */ - *p = '\0'; - break; - } - n = strlen(p); - while (n > 0 && p[n-1] != '\n') { - size_t incr = n+2; - p = (char *)PyMem_REALLOC(p, n + incr); - if (p == NULL) - return NULL; - if (incr > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, "input line too long"); - } - if (my_fgets(p+n, (int)incr, sys_stdin) != 0) - break; - n += strlen(p+n); - } - return (char *)PyMem_REALLOC(p, n+1); -} - - -/* By initializing this function pointer, systems embedding Python can - override the readline function. - - Note: Python expects in return a buffer allocated with PyMem_Malloc. */ - -char *(*PyOS_ReadlineFunctionPointer)(FILE *, FILE *, char *); - - -/* Interface used by tokenizer.c and bltinmodule.c */ - -char * -PyOS_Readline(FILE *sys_stdin, FILE *sys_stdout, char *prompt) -{ - char *rv; - - if (_PyOS_ReadlineTState == PyThreadState_GET()) { - PyErr_SetString(PyExc_RuntimeError, - "can't re-enter readline"); - return NULL; - } - - - if (PyOS_ReadlineFunctionPointer == NULL) { -#ifdef __VMS - PyOS_ReadlineFunctionPointer = vms__StdioReadline; -#else - PyOS_ReadlineFunctionPointer = PyOS_StdioReadline; -#endif - } - -#ifdef WITH_THREAD - if (_PyOS_ReadlineLock == NULL) { - _PyOS_ReadlineLock = PyThread_allocate_lock(); - } -#endif - - _PyOS_ReadlineTState = PyThreadState_GET(); - Py_BEGIN_ALLOW_THREADS -#ifdef WITH_THREAD - PyThread_acquire_lock(_PyOS_ReadlineLock, 1); -#endif - - /* This is needed to handle the unlikely case that the - * interpreter is in interactive mode *and* stdin/out are not - * a tty. This can happen, for example if python is run like - * this: python -i < test1.py - */ - if (!isatty (fileno (sys_stdin)) || !isatty (fileno (sys_stdout))) - rv = PyOS_StdioReadline (sys_stdin, sys_stdout, prompt); - else - rv = (*PyOS_ReadlineFunctionPointer)(sys_stdin, sys_stdout, - prompt); - Py_END_ALLOW_THREADS - -#ifdef WITH_THREAD - PyThread_release_lock(_PyOS_ReadlineLock); -#endif - - _PyOS_ReadlineTState = NULL; - - return rv; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/node.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/node.c deleted file mode 100644 index 4f1fbf8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/node.c +++ /dev/null @@ -1,164 +0,0 @@ -/* Parse tree node implementation */ - -#include "Python.h" -#include "node.h" -#include "errcode.h" - -node * -PyNode_New(int type) -{ - node *n = (node *) PyObject_MALLOC(1 * sizeof(node)); - if (n == NULL) - return NULL; - n->n_type = type; - n->n_str = NULL; - n->n_lineno = 0; - n->n_nchildren = 0; - n->n_child = NULL; - return n; -} - -/* See comments at XXXROUNDUP below. Returns -1 on overflow. */ -static int -fancy_roundup(int n) -{ - /* Round up to the closest power of 2 >= n. */ - int result = 256; - assert(n > 128); - while (result < n) { - result <<= 1; - if (result <= 0) - return -1; - } - return result; -} - -/* A gimmick to make massive numbers of reallocs quicker. The result is - * a number >= the input. In PyNode_AddChild, it's used like so, when - * we're about to add child number current_size + 1: - * - * if XXXROUNDUP(current_size) < XXXROUNDUP(current_size + 1): - * allocate space for XXXROUNDUP(current_size + 1) total children - * else: - * we already have enough space - * - * Since a node starts out empty, we must have - * - * XXXROUNDUP(0) < XXXROUNDUP(1) - * - * so that we allocate space for the first child. One-child nodes are very - * common (presumably that would change if we used a more abstract form - * of syntax tree), so to avoid wasting memory it's desirable that - * XXXROUNDUP(1) == 1. That in turn forces XXXROUNDUP(0) == 0. - * - * Else for 2 <= n <= 128, we round up to the closest multiple of 4. Why 4? - * Rounding up to a multiple of an exact power of 2 is very efficient, and - * most nodes with more than one child have <= 4 kids. - * - * Else we call fancy_roundup() to grow proportionately to n. We've got an - * extreme case then (like test_longexp.py), and on many platforms doing - * anything less than proportional growth leads to exorbitant runtime - * (e.g., MacPython), or extreme fragmentation of user address space (e.g., - * Win98). - * - * In a run of compileall across the 2.3a0 Lib directory, Andrew MacIntyre - * reported that, with this scheme, 89% of PyObject_REALLOC calls in - * PyNode_AddChild passed 1 for the size, and 9% passed 4. So this usually - * wastes very little memory, but is very effective at sidestepping - * platform-realloc disasters on vulnerable platforms. - * - * Note that this would be straightforward if a node stored its current - * capacity. The code is tricky to avoid that. - */ -#define XXXROUNDUP(n) ((n) <= 1 ? (n) : \ - (n) <= 128 ? (((n) + 3) & ~3) : \ - fancy_roundup(n)) - - -int -PyNode_AddChild(register node *n1, int type, char *str, int lineno, int col_offset) -{ - const int nch = n1->n_nchildren; - int current_capacity; - int required_capacity; - node *n; - - if (nch == INT_MAX || nch < 0) - return E_OVERFLOW; - - current_capacity = XXXROUNDUP(nch); - required_capacity = XXXROUNDUP(nch + 1); - if (current_capacity < 0 || required_capacity < 0) - return E_OVERFLOW; - if (current_capacity < required_capacity) { - if (required_capacity > PY_SIZE_MAX / sizeof(node)) { - return E_NOMEM; - } - n = n1->n_child; - n = (node *) PyObject_REALLOC(n, - required_capacity * sizeof(node)); - if (n == NULL) - return E_NOMEM; - n1->n_child = n; - } - - n = &n1->n_child[n1->n_nchildren++]; - n->n_type = type; - n->n_str = str; - n->n_lineno = lineno; - n->n_col_offset = col_offset; - n->n_nchildren = 0; - n->n_child = NULL; - return 0; -} - -/* Forward */ -static void freechildren(node *); -static Py_ssize_t sizeofchildren(node *n); - - -void -PyNode_Free(node *n) -{ - if (n != NULL) { - freechildren(n); - PyObject_FREE(n); - } -} - -Py_ssize_t -_PyNode_SizeOf(node *n) -{ - Py_ssize_t res = 0; - - if (n != NULL) - res = sizeof(node) + sizeofchildren(n); - return res; -} - -static void -freechildren(node *n) -{ - int i; - for (i = NCH(n); --i >= 0; ) - freechildren(CHILD(n, i)); - if (n->n_child != NULL) - PyObject_FREE(n->n_child); - if (STR(n) != NULL) - PyObject_FREE(STR(n)); -} - -static Py_ssize_t -sizeofchildren(node *n) -{ - Py_ssize_t res = 0; - int i; - for (i = NCH(n); --i >= 0; ) - res += sizeofchildren(CHILD(n, i)); - if (n->n_child != NULL) - /* allocated size of n->n_child array */ - res += XXXROUNDUP(NCH(n)) * sizeof(node); - if (STR(n) != NULL) - res += strlen(STR(n)) + 1; - return res; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/parser.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/parser.c deleted file mode 100644 index d98dfaa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/parser.c +++ /dev/null @@ -1,436 +0,0 @@ - -/* Parser implementation */ - -/* For a description, see the comments at end of this file */ - -/* XXX To do: error recovery */ - -#include "Python.h" -#include "pgenheaders.h" -#include "token.h" -#include "grammar.h" -#include "node.h" -#include "parser.h" -#include "errcode.h" - - -#ifdef Py_DEBUG -extern int Py_DebugFlag; -#define D(x) if (!Py_DebugFlag); else x -#else -#define D(x) -#endif - - -/* STACK DATA TYPE */ - -static void s_reset(stack *); - -static void -s_reset(stack *s) -{ - s->s_top = &s->s_base[MAXSTACK]; -} - -#define s_empty(s) ((s)->s_top == &(s)->s_base[MAXSTACK]) - -static int -s_push(register stack *s, dfa *d, node *parent) -{ - register stackentry *top; - if (s->s_top == s->s_base) { - fprintf(stderr, "s_push: parser stack overflow\n"); - return E_NOMEM; - } - top = --s->s_top; - top->s_dfa = d; - top->s_parent = parent; - top->s_state = 0; - return 0; -} - -#ifdef Py_DEBUG - -static void -s_pop(register stack *s) -{ - if (s_empty(s)) - Py_FatalError("s_pop: parser stack underflow -- FATAL"); - s->s_top++; -} - -#else /* !Py_DEBUG */ - -#define s_pop(s) (s)->s_top++ - -#endif - - -/* PARSER CREATION */ - -parser_state * -PyParser_New(grammar *g, int start) -{ - parser_state *ps; - - if (!g->g_accel) - PyGrammar_AddAccelerators(g); - ps = (parser_state *)PyMem_MALLOC(sizeof(parser_state)); - if (ps == NULL) - return NULL; - ps->p_grammar = g; -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - ps->p_flags = 0; -#endif - ps->p_tree = PyNode_New(start); - if (ps->p_tree == NULL) { - PyMem_FREE(ps); - return NULL; - } - s_reset(&ps->p_stack); - (void) s_push(&ps->p_stack, PyGrammar_FindDFA(g, start), ps->p_tree); - return ps; -} - -void -PyParser_Delete(parser_state *ps) -{ - /* NB If you want to save the parse tree, - you must set p_tree to NULL before calling delparser! */ - PyNode_Free(ps->p_tree); - PyMem_FREE(ps); -} - - -/* PARSER STACK OPERATIONS */ - -static int -shift(register stack *s, int type, char *str, int newstate, int lineno, int col_offset) -{ - int err; - assert(!s_empty(s)); - err = PyNode_AddChild(s->s_top->s_parent, type, str, lineno, col_offset); - if (err) - return err; - s->s_top->s_state = newstate; - return 0; -} - -static int -push(register stack *s, int type, dfa *d, int newstate, int lineno, int col_offset) -{ - int err; - register node *n; - n = s->s_top->s_parent; - assert(!s_empty(s)); - err = PyNode_AddChild(n, type, (char *)NULL, lineno, col_offset); - if (err) - return err; - s->s_top->s_state = newstate; - return s_push(s, d, CHILD(n, NCH(n)-1)); -} - - -/* PARSER PROPER */ - -static int -classify(parser_state *ps, int type, char *str) -{ - grammar *g = ps->p_grammar; - register int n = g->g_ll.ll_nlabels; - - if (type == NAME) { - register char *s = str; - register label *l = g->g_ll.ll_label; - register int i; - for (i = n; i > 0; i--, l++) { - if (l->lb_type != NAME || l->lb_str == NULL || - l->lb_str[0] != s[0] || - strcmp(l->lb_str, s) != 0) - continue; -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - if (ps->p_flags & CO_FUTURE_PRINT_FUNCTION && - s[0] == 'p' && strcmp(s, "print") == 0) { - break; /* no longer a keyword */ - } -#endif - D(printf("It's a keyword\n")); - return n - i; - } - } - - { - register label *l = g->g_ll.ll_label; - register int i; - for (i = n; i > 0; i--, l++) { - if (l->lb_type == type && l->lb_str == NULL) { - D(printf("It's a token we know\n")); - return n - i; - } - } - } - - D(printf("Illegal token\n")); - return -1; -} - -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD -static void -future_hack(parser_state *ps) -{ - node *n = ps->p_stack.s_top->s_parent; - node *ch, *cch; - int i; - - /* from __future__ import ..., must have at least 4 children */ - n = CHILD(n, 0); - if (NCH(n) < 4) - return; - ch = CHILD(n, 0); - if (STR(ch) == NULL || strcmp(STR(ch), "from") != 0) - return; - ch = CHILD(n, 1); - if (NCH(ch) == 1 && STR(CHILD(ch, 0)) && - strcmp(STR(CHILD(ch, 0)), "__future__") != 0) - return; - ch = CHILD(n, 3); - /* ch can be a star, a parenthesis or import_as_names */ - if (TYPE(ch) == STAR) - return; - if (TYPE(ch) == LPAR) - ch = CHILD(n, 4); - - for (i = 0; i < NCH(ch); i += 2) { - cch = CHILD(ch, i); - if (NCH(cch) >= 1 && TYPE(CHILD(cch, 0)) == NAME) { - char *str_ch = STR(CHILD(cch, 0)); - if (strcmp(str_ch, FUTURE_WITH_STATEMENT) == 0) { - ps->p_flags |= CO_FUTURE_WITH_STATEMENT; - } else if (strcmp(str_ch, FUTURE_PRINT_FUNCTION) == 0) { - ps->p_flags |= CO_FUTURE_PRINT_FUNCTION; - } else if (strcmp(str_ch, FUTURE_UNICODE_LITERALS) == 0) { - ps->p_flags |= CO_FUTURE_UNICODE_LITERALS; - } - } - } -} -#endif /* future keyword */ - -int -PyParser_AddToken(register parser_state *ps, register int type, char *str, - int lineno, int col_offset, int *expected_ret) -{ - register int ilabel; - int err; - - D(printf("Token %s/'%s' ... ", _PyParser_TokenNames[type], str)); - - /* Find out which label this token is */ - ilabel = classify(ps, type, str); - if (ilabel < 0) - return E_SYNTAX; - - /* Loop until the token is shifted or an error occurred */ - for (;;) { - /* Fetch the current dfa and state */ - register dfa *d = ps->p_stack.s_top->s_dfa; - register state *s = &d->d_state[ps->p_stack.s_top->s_state]; - - D(printf(" DFA '%s', state %d:", - d->d_name, ps->p_stack.s_top->s_state)); - - /* Check accelerator */ - if (s->s_lower <= ilabel && ilabel < s->s_upper) { - register int x = s->s_accel[ilabel - s->s_lower]; - if (x != -1) { - if (x & (1<<7)) { - /* Push non-terminal */ - int nt = (x >> 8) + NT_OFFSET; - int arrow = x & ((1<<7)-1); - dfa *d1 = PyGrammar_FindDFA( - ps->p_grammar, nt); - if ((err = push(&ps->p_stack, nt, d1, - arrow, lineno, col_offset)) > 0) { - D(printf(" MemError: push\n")); - return err; - } - D(printf(" Push ...\n")); - continue; - } - - /* Shift the token */ - if ((err = shift(&ps->p_stack, type, str, - x, lineno, col_offset)) > 0) { - D(printf(" MemError: shift.\n")); - return err; - } - D(printf(" Shift.\n")); - /* Pop while we are in an accept-only state */ - while (s = &d->d_state - [ps->p_stack.s_top->s_state], - s->s_accept && s->s_narcs == 1) { - D(printf(" DFA '%s', state %d: " - "Direct pop.\n", - d->d_name, - ps->p_stack.s_top->s_state)); -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - if (d->d_name[0] == 'i' && - strcmp(d->d_name, - "import_stmt") == 0) - future_hack(ps); -#endif - s_pop(&ps->p_stack); - if (s_empty(&ps->p_stack)) { - D(printf(" ACCEPT.\n")); - return E_DONE; - } - d = ps->p_stack.s_top->s_dfa; - } - return E_OK; - } - } - - if (s->s_accept) { -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - if (d->d_name[0] == 'i' && - strcmp(d->d_name, "import_stmt") == 0) - future_hack(ps); -#endif - /* Pop this dfa and try again */ - s_pop(&ps->p_stack); - D(printf(" Pop ...\n")); - if (s_empty(&ps->p_stack)) { - D(printf(" Error: bottom of stack.\n")); - return E_SYNTAX; - } - continue; - } - - /* Stuck, report syntax error */ - D(printf(" Error.\n")); - if (expected_ret) { - if (s->s_lower == s->s_upper - 1) { - /* Only one possible expected token */ - *expected_ret = ps->p_grammar-> - g_ll.ll_label[s->s_lower].lb_type; - } - else - *expected_ret = -1; - } - return E_SYNTAX; - } -} - - -#ifdef Py_DEBUG - -/* DEBUG OUTPUT */ - -void -dumptree(grammar *g, node *n) -{ - int i; - - if (n == NULL) - printf("NIL"); - else { - label l; - l.lb_type = TYPE(n); - l.lb_str = STR(n); - printf("%s", PyGrammar_LabelRepr(&l)); - if (ISNONTERMINAL(TYPE(n))) { - printf("("); - for (i = 0; i < NCH(n); i++) { - if (i > 0) - printf(","); - dumptree(g, CHILD(n, i)); - } - printf(")"); - } - } -} - -void -showtree(grammar *g, node *n) -{ - int i; - - if (n == NULL) - return; - if (ISNONTERMINAL(TYPE(n))) { - for (i = 0; i < NCH(n); i++) - showtree(g, CHILD(n, i)); - } - else if (ISTERMINAL(TYPE(n))) { - printf("%s", _PyParser_TokenNames[TYPE(n)]); - if (TYPE(n) == NUMBER || TYPE(n) == NAME) - printf("(%s)", STR(n)); - printf(" "); - } - else - printf("? "); -} - -void -printtree(parser_state *ps) -{ - if (Py_DebugFlag) { - printf("Parse tree:\n"); - dumptree(ps->p_grammar, ps->p_tree); - printf("\n"); - printf("Tokens:\n"); - showtree(ps->p_grammar, ps->p_tree); - printf("\n"); - } - printf("Listing:\n"); - PyNode_ListTree(ps->p_tree); - printf("\n"); -} - -#endif /* Py_DEBUG */ - -/* - -Description ------------ - -The parser's interface is different than usual: the function addtoken() -must be called for each token in the input. This makes it possible to -turn it into an incremental parsing system later. The parsing system -constructs a parse tree as it goes. - -A parsing rule is represented as a Deterministic Finite-state Automaton -(DFA). A node in a DFA represents a state of the parser; an arc represents -a transition. Transitions are either labeled with terminal symbols or -with non-terminals. When the parser decides to follow an arc labeled -with a non-terminal, it is invoked recursively with the DFA representing -the parsing rule for that as its initial state; when that DFA accepts, -the parser that invoked it continues. The parse tree constructed by the -recursively called parser is inserted as a child in the current parse tree. - -The DFA's can be constructed automatically from a more conventional -language description. An extended LL(1) grammar (ELL(1)) is suitable. -Certain restrictions make the parser's life easier: rules that can produce -the empty string should be outlawed (there are other ways to put loops -or optional parts in the language). To avoid the need to construct -FIRST sets, we can require that all but the last alternative of a rule -(really: arc going out of a DFA's state) must begin with a terminal -symbol. - -As an example, consider this grammar: - -expr: term (OP term)* -term: CONSTANT | '(' expr ')' - -The DFA corresponding to the rule for expr is: - -------->.---term-->.-------> - ^ | - | | - \----OP----/ - -The parse tree generated for the input a+b is: - -(expr: (term: (NAME: a)), (OP: +), (term: (NAME: b))) - -*/ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/parser.h b/AppPkg/Applications/Python/Python-2.7.10/Parser/parser.h deleted file mode 100644 index bc09396..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/parser.h +++ /dev/null @@ -1,42 +0,0 @@ -#ifndef Py_PARSER_H -#define Py_PARSER_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Parser interface */ - -#define MAXSTACK 1500 - -typedef struct { - int s_state; /* State in current DFA */ - dfa *s_dfa; /* Current DFA */ - struct _node *s_parent; /* Where to add next node */ -} stackentry; - -typedef struct { - stackentry *s_top; /* Top entry */ - stackentry s_base[MAXSTACK];/* Array of stack entries */ - /* NB The stack grows down */ -} stack; - -typedef struct { - stack p_stack; /* Stack of parser states */ - grammar *p_grammar; /* Grammar to use */ - node *p_tree; /* Top of parse tree */ -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - unsigned long p_flags; /* see co_flags in Include/code.h */ -#endif -} parser_state; - -parser_state *PyParser_New(grammar *g, int start); -void PyParser_Delete(parser_state *ps); -int PyParser_AddToken(parser_state *ps, int type, char *str, int lineno, int col_offset, - int *expected_ret); -void PyGrammar_AddAccelerators(grammar *g); - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PARSER_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/parsetok.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/parsetok.c deleted file mode 100644 index ac1eeb6..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/parsetok.c +++ /dev/null @@ -1,282 +0,0 @@ - -/* Parser-tokenizer link implementation */ - -#include "pgenheaders.h" -#include "tokenizer.h" -#include "node.h" -#include "grammar.h" -#include "parser.h" -#include "parsetok.h" -#include "errcode.h" -#include "graminit.h" - -int Py_TabcheckFlag; - - -/* Forward */ -static node *parsetok(struct tok_state *, grammar *, int, perrdetail *, int *); -static void initerr(perrdetail *err_ret, const char* filename); - -/* Parse input coming from a string. Return error code, print some errors. */ -node * -PyParser_ParseString(const char *s, grammar *g, int start, perrdetail *err_ret) -{ - return PyParser_ParseStringFlagsFilename(s, NULL, g, start, err_ret, 0); -} - -node * -PyParser_ParseStringFlags(const char *s, grammar *g, int start, - perrdetail *err_ret, int flags) -{ - return PyParser_ParseStringFlagsFilename(s, NULL, - g, start, err_ret, flags); -} - -node * -PyParser_ParseStringFlagsFilename(const char *s, const char *filename, - grammar *g, int start, - perrdetail *err_ret, int flags) -{ - int iflags = flags; - return PyParser_ParseStringFlagsFilenameEx(s, filename, g, start, - err_ret, &iflags); -} - -node * -PyParser_ParseStringFlagsFilenameEx(const char *s, const char *filename, - grammar *g, int start, - perrdetail *err_ret, int *flags) -{ - struct tok_state *tok; - - initerr(err_ret, filename); - - if ((tok = PyTokenizer_FromString(s, start == file_input)) == NULL) { - err_ret->error = PyErr_Occurred() ? E_DECODE : E_NOMEM; - return NULL; - } - - tok->filename = filename ? filename : ""; - if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->altwarning = (tok->filename != NULL); - if (Py_TabcheckFlag >= 2) - tok->alterror++; - } - - return parsetok(tok, g, start, err_ret, flags); -} - -/* Parse input coming from a file. Return error code, print some errors. */ - -node * -PyParser_ParseFile(FILE *fp, const char *filename, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret) -{ - return PyParser_ParseFileFlags(fp, filename, g, start, ps1, ps2, - err_ret, 0); -} - -node * -PyParser_ParseFileFlags(FILE *fp, const char *filename, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret, int flags) -{ - int iflags = flags; - return PyParser_ParseFileFlagsEx(fp, filename, g, start, ps1, ps2, err_ret, &iflags); -} - -node * -PyParser_ParseFileFlagsEx(FILE *fp, const char *filename, grammar *g, int start, - char *ps1, char *ps2, perrdetail *err_ret, int *flags) -{ - struct tok_state *tok; - - initerr(err_ret, filename); - - if ((tok = PyTokenizer_FromFile(fp, ps1, ps2)) == NULL) { - err_ret->error = E_NOMEM; - return NULL; - } - tok->filename = filename; - if (Py_TabcheckFlag || Py_VerboseFlag) { - tok->altwarning = (filename != NULL); - if (Py_TabcheckFlag >= 2) - tok->alterror++; - } - - return parsetok(tok, g, start, err_ret, flags); -} - -#if 0 -static char with_msg[] = -"%s:%d: Warning: 'with' will become a reserved keyword in Python 2.6\n"; - -static char as_msg[] = -"%s:%d: Warning: 'as' will become a reserved keyword in Python 2.6\n"; - -static void -warn(const char *msg, const char *filename, int lineno) -{ - if (filename == NULL) - filename = ""; - PySys_WriteStderr(msg, filename, lineno); -} -#endif - -/* Parse input coming from the given tokenizer structure. - Return error code. */ - -static node * -parsetok(struct tok_state *tok, grammar *g, int start, perrdetail *err_ret, - int *flags) -{ - parser_state *ps; - node *n; - int started = 0; - - if ((ps = PyParser_New(g, start)) == NULL) { - fprintf(stderr, "no mem for new parser\n"); - err_ret->error = E_NOMEM; - PyTokenizer_Free(tok); - return NULL; - } -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - if (*flags & PyPARSE_PRINT_IS_FUNCTION) { - ps->p_flags |= CO_FUTURE_PRINT_FUNCTION; - } - if (*flags & PyPARSE_UNICODE_LITERALS) { - ps->p_flags |= CO_FUTURE_UNICODE_LITERALS; - } - -#endif - - for (;;) { - char *a, *b; - int type; - size_t len; - char *str; - int col_offset; - - type = PyTokenizer_Get(tok, &a, &b); - if (type == ERRORTOKEN) { - err_ret->error = tok->done; - break; - } - if (type == ENDMARKER && started) { - type = NEWLINE; /* Add an extra newline */ - started = 0; - /* Add the right number of dedent tokens, - except if a certain flag is given -- - codeop.py uses this. */ - if (tok->indent && - !(*flags & PyPARSE_DONT_IMPLY_DEDENT)) - { - tok->pendin = -tok->indent; - tok->indent = 0; - } - } - else - started = 1; - len = b - a; /* XXX this may compute NULL - NULL */ - str = (char *) PyObject_MALLOC(len + 1); - if (str == NULL) { - fprintf(stderr, "no mem for next token\n"); - err_ret->error = E_NOMEM; - break; - } - if (len > 0) - strncpy(str, a, len); - str[len] = '\0'; - -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD -#endif - if (a >= tok->line_start) - col_offset = a - tok->line_start; - else - col_offset = -1; - - if ((err_ret->error = - PyParser_AddToken(ps, (int)type, str, tok->lineno, col_offset, - &(err_ret->expected))) != E_OK) { - if (err_ret->error != E_DONE) { - PyObject_FREE(str); - err_ret->token = type; - } - break; - } - } - - if (err_ret->error == E_DONE) { - n = ps->p_tree; - ps->p_tree = NULL; - } - else - n = NULL; - -#ifdef PY_PARSER_REQUIRES_FUTURE_KEYWORD - *flags = ps->p_flags; -#endif - PyParser_Delete(ps); - - if (n == NULL) { - if (tok->lineno <= 1 && tok->done == E_EOF) - err_ret->error = E_EOF; - err_ret->lineno = tok->lineno; - if (tok->buf != NULL) { - char *text = NULL; - size_t len; - assert(tok->cur - tok->buf < INT_MAX); - err_ret->offset = (int)(tok->cur - tok->buf); - len = tok->inp - tok->buf; -#ifdef Py_USING_UNICODE - text = PyTokenizer_RestoreEncoding(tok, len, &err_ret->offset); - -#endif - if (text == NULL) { - text = (char *) PyObject_MALLOC(len + 1); - if (text != NULL) { - if (len > 0) - strncpy(text, tok->buf, len); - text[len] = '\0'; - } - } - err_ret->text = text; - } - } else if (tok->encoding != NULL) { - /* 'nodes->n_str' uses PyObject_*, while 'tok->encoding' was - * allocated using PyMem_ - */ - node* r = PyNode_New(encoding_decl); - if (r) - r->n_str = PyObject_MALLOC(strlen(tok->encoding)+1); - if (!r || !r->n_str) { - err_ret->error = E_NOMEM; - if (r) - PyObject_FREE(r); - n = NULL; - goto done; - } - strcpy(r->n_str, tok->encoding); - PyMem_FREE(tok->encoding); - tok->encoding = NULL; - r->n_nchildren = 1; - r->n_child = n; - n = r; - } - -done: - PyTokenizer_Free(tok); - - return n; -} - -static void -initerr(perrdetail *err_ret, const char *filename) -{ - err_ret->error = E_OK; - err_ret->filename = filename; - err_ret->lineno = 0; - err_ret->offset = 0; - err_ret->text = NULL; - err_ret->token = -1; - err_ret->expected = -1; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.c b/AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.c deleted file mode 100644 index 086dc56..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.c +++ /dev/null @@ -1,1755 +0,0 @@ - -/* Tokenizer implementation */ - -#include "Python.h" -#include "pgenheaders.h" - -#include -#include - -#include "tokenizer.h" -#include "errcode.h" - -#ifndef PGEN -#include "unicodeobject.h" -#include "stringobject.h" -#include "fileobject.h" -#include "codecs.h" -#include "abstract.h" -#include "pydebug.h" -#endif /* PGEN */ - -extern char *PyOS_Readline(FILE *, FILE *, char *); -/* Return malloc'ed string including trailing \n; - empty malloc'ed string for EOF; - NULL if interrupted */ - -/* Don't ever change this -- it would break the portability of Python code */ -#define TABSIZE 8 - -/* Forward */ -static struct tok_state *tok_new(void); -static int tok_nextc(struct tok_state *tok); -static void tok_backup(struct tok_state *tok, int c); - -/* Token names */ - -char *_PyParser_TokenNames[] = { - "ENDMARKER", - "NAME", - "NUMBER", - "STRING", - "NEWLINE", - "INDENT", - "DEDENT", - "LPAR", - "RPAR", - "LSQB", - "RSQB", - "COLON", - "COMMA", - "SEMI", - "PLUS", - "MINUS", - "STAR", - "SLASH", - "VBAR", - "AMPER", - "LESS", - "GREATER", - "EQUAL", - "DOT", - "PERCENT", - "BACKQUOTE", - "LBRACE", - "RBRACE", - "EQEQUAL", - "NOTEQUAL", - "LESSEQUAL", - "GREATEREQUAL", - "TILDE", - "CIRCUMFLEX", - "LEFTSHIFT", - "RIGHTSHIFT", - "DOUBLESTAR", - "PLUSEQUAL", - "MINEQUAL", - "STAREQUAL", - "SLASHEQUAL", - "PERCENTEQUAL", - "AMPEREQUAL", - "VBAREQUAL", - "CIRCUMFLEXEQUAL", - "LEFTSHIFTEQUAL", - "RIGHTSHIFTEQUAL", - "DOUBLESTAREQUAL", - "DOUBLESLASH", - "DOUBLESLASHEQUAL", - "AT", - /* This table must match the #defines in token.h! */ - "OP", - "", - "" -}; - -/* Create and initialize a new tok_state structure */ - -static struct tok_state * -tok_new(void) -{ - struct tok_state *tok = (struct tok_state *)PyMem_MALLOC( - sizeof(struct tok_state)); - if (tok == NULL) - return NULL; - tok->buf = tok->cur = tok->end = tok->inp = tok->start = NULL; - tok->done = E_OK; - tok->fp = NULL; - tok->input = NULL; - tok->tabsize = TABSIZE; - tok->indent = 0; - tok->indstack[0] = 0; - tok->atbol = 1; - tok->pendin = 0; - tok->prompt = tok->nextprompt = NULL; - tok->lineno = 0; - tok->level = 0; - tok->filename = NULL; - tok->altwarning = 0; - tok->alterror = 0; - tok->alttabsize = 1; - tok->altindstack[0] = 0; - tok->decoding_state = 0; - tok->decoding_erred = 0; - tok->read_coding_spec = 0; - tok->encoding = NULL; - tok->cont_line = 0; -#ifndef PGEN - tok->decoding_readline = NULL; - tok->decoding_buffer = NULL; -#endif - return tok; -} - -static char * -new_string(const char *s, Py_ssize_t len) -{ - char* result = (char *)PyMem_MALLOC(len + 1); - if (result != NULL) { - memcpy(result, s, len); - result[len] = '\0'; - } - return result; -} - -#ifdef PGEN - -static char * -decoding_fgets(char *s, int size, struct tok_state *tok) -{ - return fgets(s, size, tok->fp); -} - -static int -decoding_feof(struct tok_state *tok) -{ - return feof(tok->fp); -} - -static char * -decode_str(const char *str, int exec_input, struct tok_state *tok) -{ - return new_string(str, strlen(str)); -} - -#else /* PGEN */ - -static char * -error_ret(struct tok_state *tok) /* XXX */ -{ - tok->decoding_erred = 1; - if (tok->fp != NULL && tok->buf != NULL) /* see PyTokenizer_Free */ - PyMem_FREE(tok->buf); - tok->buf = NULL; - return NULL; /* as if it were EOF */ -} - - -static char * -get_normal_name(char *s) /* for utf-8 and latin-1 */ -{ - char buf[13]; - int i; - for (i = 0; i < 12; i++) { - int c = s[i]; - if (c == '\0') - break; - else if (c == '_') - buf[i] = '-'; - else - buf[i] = tolower(c); - } - buf[i] = '\0'; - if (strcmp(buf, "utf-8") == 0 || - strncmp(buf, "utf-8-", 6) == 0) - return "utf-8"; - else if (strcmp(buf, "latin-1") == 0 || - strcmp(buf, "iso-8859-1") == 0 || - strcmp(buf, "iso-latin-1") == 0 || - strncmp(buf, "latin-1-", 8) == 0 || - strncmp(buf, "iso-8859-1-", 11) == 0 || - strncmp(buf, "iso-latin-1-", 12) == 0) - return "iso-8859-1"; - else - return s; -} - -/* Return the coding spec in S, or NULL if none is found. */ - -static char * -get_coding_spec(const char *s, Py_ssize_t size) -{ - Py_ssize_t i; - /* Coding spec must be in a comment, and that comment must be - * the only statement on the source code line. */ - for (i = 0; i < size - 6; i++) { - if (s[i] == '#') - break; - if (s[i] != ' ' && s[i] != '\t' && s[i] != '\014') - return NULL; - } - for (; i < size - 6; i++) { /* XXX inefficient search */ - const char* t = s + i; - if (strncmp(t, "coding", 6) == 0) { - const char* begin = NULL; - t += 6; - if (t[0] != ':' && t[0] != '=') - continue; - do { - t++; - } while (t[0] == '\x20' || t[0] == '\t'); - - begin = t; - while (Py_ISALNUM(t[0]) || - t[0] == '-' || t[0] == '_' || t[0] == '.') - t++; - - if (begin < t) { - char* r = new_string(begin, t - begin); - char* q = get_normal_name(r); - if (r != q) { - PyMem_FREE(r); - r = new_string(q, strlen(q)); - } - return r; - } - } - } - return NULL; -} - -/* Check whether the line contains a coding spec. If it does, - invoke the set_readline function for the new encoding. - This function receives the tok_state and the new encoding. - Return 1 on success, 0 on failure. */ - -static int -check_coding_spec(const char* line, Py_ssize_t size, struct tok_state *tok, - int set_readline(struct tok_state *, const char *)) -{ - char * cs; - int r = 1; - - if (tok->cont_line) { - /* It's a continuation line, so it can't be a coding spec. */ - tok->read_coding_spec = 1; - return 1; - } - cs = get_coding_spec(line, size); - if (!cs) { - Py_ssize_t i; - for (i = 0; i < size; i++) { - if (line[i] == '#' || line[i] == '\n' || line[i] == '\r') - break; - if (line[i] != ' ' && line[i] != '\t' && line[i] != '\014') { - /* Stop checking coding spec after a line containing - * anything except a comment. */ - tok->read_coding_spec = 1; - break; - } - } - } else { - tok->read_coding_spec = 1; - if (tok->encoding == NULL) { - assert(tok->decoding_state == 1); /* raw */ - if (strcmp(cs, "utf-8") == 0 || - strcmp(cs, "iso-8859-1") == 0) { - tok->encoding = cs; - } else { -#ifdef Py_USING_UNICODE - r = set_readline(tok, cs); - if (r) { - tok->encoding = cs; - tok->decoding_state = -1; - } - else { - PyErr_Format(PyExc_SyntaxError, - "encoding problem: %s", cs); - PyMem_FREE(cs); - } -#else - /* Without Unicode support, we cannot - process the coding spec. Since there - won't be any Unicode literals, that - won't matter. */ - PyMem_FREE(cs); -#endif - } - } else { /* then, compare cs with BOM */ - r = (strcmp(tok->encoding, cs) == 0); - if (!r) - PyErr_Format(PyExc_SyntaxError, - "encoding problem: %s with BOM", cs); - PyMem_FREE(cs); - } - } - return r; -} - -/* See whether the file starts with a BOM. If it does, - invoke the set_readline function with the new encoding. - Return 1 on success, 0 on failure. */ - -static int -check_bom(int get_char(struct tok_state *), - void unget_char(int, struct tok_state *), - int set_readline(struct tok_state *, const char *), - struct tok_state *tok) -{ - int ch1, ch2, ch3; - ch1 = get_char(tok); - tok->decoding_state = 1; - if (ch1 == EOF) { - return 1; - } else if (ch1 == 0xEF) { - ch2 = get_char(tok); - if (ch2 != 0xBB) { - unget_char(ch2, tok); - unget_char(ch1, tok); - return 1; - } - ch3 = get_char(tok); - if (ch3 != 0xBF) { - unget_char(ch3, tok); - unget_char(ch2, tok); - unget_char(ch1, tok); - return 1; - } -#if 0 - /* Disable support for UTF-16 BOMs until a decision - is made whether this needs to be supported. */ - } else if (ch1 == 0xFE) { - ch2 = get_char(tok); - if (ch2 != 0xFF) { - unget_char(ch2, tok); - unget_char(ch1, tok); - return 1; - } - if (!set_readline(tok, "utf-16-be")) - return 0; - tok->decoding_state = -1; - } else if (ch1 == 0xFF) { - ch2 = get_char(tok); - if (ch2 != 0xFE) { - unget_char(ch2, tok); - unget_char(ch1, tok); - return 1; - } - if (!set_readline(tok, "utf-16-le")) - return 0; - tok->decoding_state = -1; -#endif - } else { - unget_char(ch1, tok); - return 1; - } - if (tok->encoding != NULL) - PyMem_FREE(tok->encoding); - tok->encoding = new_string("utf-8", 5); /* resulting is in utf-8 */ - return 1; -} - -/* Read a line of text from TOK into S, using the stream in TOK. - Return NULL on failure, else S. - - On entry, tok->decoding_buffer will be one of: - 1) NULL: need to call tok->decoding_readline to get a new line - 2) PyUnicodeObject *: decoding_feof has called tok->decoding_readline and - stored the result in tok->decoding_buffer - 3) PyStringObject *: previous call to fp_readl did not have enough room - (in the s buffer) to copy entire contents of the line read - by tok->decoding_readline. tok->decoding_buffer has the overflow. - In this case, fp_readl is called in a loop (with an expanded buffer) - until the buffer ends with a '\n' (or until the end of the file is - reached): see tok_nextc and its calls to decoding_fgets. -*/ - -static char * -fp_readl(char *s, int size, struct tok_state *tok) -{ -#ifndef Py_USING_UNICODE - /* In a non-Unicode built, this should never be called. */ - Py_FatalError("fp_readl should not be called in this build."); - return NULL; /* Keep compiler happy (not reachable) */ -#else - PyObject* utf8 = NULL; - PyObject* buf = tok->decoding_buffer; - char *str; - Py_ssize_t utf8len; - - /* Ask for one less byte so we can terminate it */ - assert(size > 0); - size--; - - if (buf == NULL) { - buf = PyObject_CallObject(tok->decoding_readline, NULL); - if (buf == NULL) - return error_ret(tok); - if (!PyUnicode_Check(buf)) { - Py_DECREF(buf); - PyErr_SetString(PyExc_SyntaxError, - "codec did not return a unicode object"); - return error_ret(tok); - } - } else { - tok->decoding_buffer = NULL; - if (PyString_CheckExact(buf)) - utf8 = buf; - } - if (utf8 == NULL) { - utf8 = PyUnicode_AsUTF8String(buf); - Py_DECREF(buf); - if (utf8 == NULL) - return error_ret(tok); - } - str = PyString_AsString(utf8); - utf8len = PyString_GET_SIZE(utf8); - if (utf8len > size) { - tok->decoding_buffer = PyString_FromStringAndSize(str+size, utf8len-size); - if (tok->decoding_buffer == NULL) { - Py_DECREF(utf8); - return error_ret(tok); - } - utf8len = size; - } - memcpy(s, str, utf8len); - s[utf8len] = '\0'; - Py_DECREF(utf8); - if (utf8len == 0) - return NULL; /* EOF */ - return s; -#endif -} - -/* Set the readline function for TOK to a StreamReader's - readline function. The StreamReader is named ENC. - - This function is called from check_bom and check_coding_spec. - - ENC is usually identical to the future value of tok->encoding, - except for the (currently unsupported) case of UTF-16. - - Return 1 on success, 0 on failure. */ - -static int -fp_setreadl(struct tok_state *tok, const char* enc) -{ - PyObject *reader, *stream, *readline; - - /* XXX: constify filename argument. */ - stream = PyFile_FromFile(tok->fp, (char*)tok->filename, "rb", NULL); - if (stream == NULL) - return 0; - - reader = PyCodec_StreamReader(enc, stream, NULL); - Py_DECREF(stream); - if (reader == NULL) - return 0; - - readline = PyObject_GetAttrString(reader, "readline"); - Py_DECREF(reader); - if (readline == NULL) - return 0; - - tok->decoding_readline = readline; - return 1; -} - -/* Fetch the next byte from TOK. */ - -static int fp_getc(struct tok_state *tok) { - return getc(tok->fp); -} - -/* Unfetch the last byte back into TOK. */ - -static void fp_ungetc(int c, struct tok_state *tok) { - ungetc(c, tok->fp); -} - -/* Read a line of input from TOK. Determine encoding - if necessary. */ - -static char * -decoding_fgets(char *s, int size, struct tok_state *tok) -{ - char *line = NULL; - int badchar = 0; - for (;;) { - if (tok->decoding_state < 0) { - /* We already have a codec associated with - this input. */ - line = fp_readl(s, size, tok); - break; - } else if (tok->decoding_state > 0) { - /* We want a 'raw' read. */ - line = Py_UniversalNewlineFgets(s, size, - tok->fp, NULL); - break; - } else { - /* We have not yet determined the encoding. - If an encoding is found, use the file-pointer - reader functions from now on. */ - if (!check_bom(fp_getc, fp_ungetc, fp_setreadl, tok)) - return error_ret(tok); - assert(tok->decoding_state != 0); - } - } - if (line != NULL && tok->lineno < 2 && !tok->read_coding_spec) { - if (!check_coding_spec(line, strlen(line), tok, fp_setreadl)) { - return error_ret(tok); - } - } -#ifndef PGEN - /* The default encoding is ASCII, so make sure we don't have any - non-ASCII bytes in it. */ - if (line && !tok->encoding) { - unsigned char *c; - for (c = (unsigned char *)line; *c; c++) - if (*c > 127) { - badchar = *c; - break; - } - } - if (badchar) { - char buf[500]; - /* Need to add 1 to the line number, since this line - has not been counted, yet. */ - sprintf(buf, - "Non-ASCII character '\\x%.2x' " - "in file %.200s on line %i, " - "but no encoding declared; " - "see http://python.org/dev/peps/pep-0263/ for details", - badchar, tok->filename, tok->lineno + 1); - PyErr_SetString(PyExc_SyntaxError, buf); - return error_ret(tok); - } -#endif - return line; -} - -static int -decoding_feof(struct tok_state *tok) -{ - if (tok->decoding_state >= 0) { - return feof(tok->fp); - } else { - PyObject* buf = tok->decoding_buffer; - if (buf == NULL) { - buf = PyObject_CallObject(tok->decoding_readline, NULL); - if (buf == NULL) { - error_ret(tok); - return 1; - } else { - tok->decoding_buffer = buf; - } - } - return PyObject_Length(buf) == 0; - } -} - -/* Fetch a byte from TOK, using the string buffer. */ - -static int -buf_getc(struct tok_state *tok) { - return Py_CHARMASK(*tok->str++); -} - -/* Unfetch a byte from TOK, using the string buffer. */ - -static void -buf_ungetc(int c, struct tok_state *tok) { - tok->str--; - assert(Py_CHARMASK(*tok->str) == c); /* tok->cur may point to read-only segment */ -} - -/* Set the readline function for TOK to ENC. For the string-based - tokenizer, this means to just record the encoding. */ - -static int -buf_setreadl(struct tok_state *tok, const char* enc) { - tok->enc = enc; - return 1; -} - -/* Return a UTF-8 encoding Python string object from the - C byte string STR, which is encoded with ENC. */ - -#ifdef Py_USING_UNICODE -static PyObject * -translate_into_utf8(const char* str, const char* enc) { - PyObject *utf8; - PyObject* buf = PyUnicode_Decode(str, strlen(str), enc, NULL); - if (buf == NULL) - return NULL; - utf8 = PyUnicode_AsUTF8String(buf); - Py_DECREF(buf); - return utf8; -} -#endif - - -static char * -translate_newlines(const char *s, int exec_input, struct tok_state *tok) { - int skip_next_lf = 0, needed_length = strlen(s) + 2, final_length; - char *buf, *current; - char c = '\0'; - buf = PyMem_MALLOC(needed_length); - if (buf == NULL) { - tok->done = E_NOMEM; - return NULL; - } - for (current = buf; *s; s++, current++) { - c = *s; - if (skip_next_lf) { - skip_next_lf = 0; - if (c == '\n') { - c = *++s; - if (!c) - break; - } - } - if (c == '\r') { - skip_next_lf = 1; - c = '\n'; - } - *current = c; - } - /* If this is exec input, add a newline to the end of the string if - there isn't one already. */ - if (exec_input && c != '\n') { - *current = '\n'; - current++; - } - *current = '\0'; - final_length = current - buf + 1; - if (final_length < needed_length && final_length) - /* should never fail */ - buf = PyMem_REALLOC(buf, final_length); - return buf; -} - -/* Decode a byte string STR for use as the buffer of TOK. - Look for encoding declarations inside STR, and record them - inside TOK. */ - -static const char * -decode_str(const char *input, int single, struct tok_state *tok) -{ - PyObject* utf8 = NULL; - const char *str; - const char *s; - const char *newl[2] = {NULL, NULL}; - int lineno = 0; - tok->input = str = translate_newlines(input, single, tok); - if (str == NULL) - return NULL; - tok->enc = NULL; - tok->str = str; - if (!check_bom(buf_getc, buf_ungetc, buf_setreadl, tok)) - return error_ret(tok); - str = tok->str; /* string after BOM if any */ - assert(str); -#ifdef Py_USING_UNICODE - if (tok->enc != NULL) { - utf8 = translate_into_utf8(str, tok->enc); - if (utf8 == NULL) - return error_ret(tok); - str = PyString_AsString(utf8); - } -#endif - for (s = str;; s++) { - if (*s == '\0') break; - else if (*s == '\n') { - assert(lineno < 2); - newl[lineno] = s; - lineno++; - if (lineno == 2) break; - } - } - tok->enc = NULL; - /* need to check line 1 and 2 separately since check_coding_spec - assumes a single line as input */ - if (newl[0]) { - if (!check_coding_spec(str, newl[0] - str, tok, buf_setreadl)) - return error_ret(tok); - if (tok->enc == NULL && !tok->read_coding_spec && newl[1]) { - if (!check_coding_spec(newl[0]+1, newl[1] - newl[0], - tok, buf_setreadl)) - return error_ret(tok); - } - } -#ifdef Py_USING_UNICODE - if (tok->enc != NULL) { - assert(utf8 == NULL); - utf8 = translate_into_utf8(str, tok->enc); - if (utf8 == NULL) - return error_ret(tok); - str = PyString_AsString(utf8); - } -#endif - assert(tok->decoding_buffer == NULL); - tok->decoding_buffer = utf8; /* CAUTION */ - return str; -} - -#endif /* PGEN */ - -/* Set up tokenizer for string */ - -struct tok_state * -PyTokenizer_FromString(const char *str, int exec_input) -{ - struct tok_state *tok = tok_new(); - if (tok == NULL) - return NULL; - str = (char *)decode_str(str, exec_input, tok); - if (str == NULL) { - PyTokenizer_Free(tok); - return NULL; - } - - /* XXX: constify members. */ - tok->buf = tok->cur = tok->end = tok->inp = (char*)str; - return tok; -} - - -/* Set up tokenizer for file */ - -struct tok_state * -PyTokenizer_FromFile(FILE *fp, char *ps1, char *ps2) -{ - struct tok_state *tok = tok_new(); - if (tok == NULL) - return NULL; - if ((tok->buf = (char *)PyMem_MALLOC(BUFSIZ)) == NULL) { - PyTokenizer_Free(tok); - return NULL; - } - tok->cur = tok->inp = tok->buf; - tok->end = tok->buf + BUFSIZ; - tok->fp = fp; - tok->prompt = ps1; - tok->nextprompt = ps2; - return tok; -} - - -/* Free a tok_state structure */ - -void -PyTokenizer_Free(struct tok_state *tok) -{ - if (tok->encoding != NULL) - PyMem_FREE(tok->encoding); -#ifndef PGEN - Py_XDECREF(tok->decoding_readline); - Py_XDECREF(tok->decoding_buffer); -#endif - if (tok->fp != NULL && tok->buf != NULL) - PyMem_FREE(tok->buf); - if (tok->input) - PyMem_FREE((char *)tok->input); - PyMem_FREE(tok); -} - -#if !defined(PGEN) && defined(Py_USING_UNICODE) -static int -tok_stdin_decode(struct tok_state *tok, char **inp) -{ - PyObject *enc, *sysstdin, *decoded, *utf8; - const char *encoding; - char *converted; - - if (PySys_GetFile((char *)"stdin", NULL) != stdin) - return 0; - sysstdin = PySys_GetObject("stdin"); - if (sysstdin == NULL || !PyFile_Check(sysstdin)) - return 0; - - enc = ((PyFileObject *)sysstdin)->f_encoding; - if (enc == NULL || !PyString_Check(enc)) - return 0; - Py_INCREF(enc); - - encoding = PyString_AsString(enc); - decoded = PyUnicode_Decode(*inp, strlen(*inp), encoding, NULL); - if (decoded == NULL) - goto error_clear; - - utf8 = PyUnicode_AsEncodedString(decoded, "utf-8", NULL); - Py_DECREF(decoded); - if (utf8 == NULL) - goto error_clear; - - assert(PyString_Check(utf8)); - converted = new_string(PyString_AS_STRING(utf8), - PyString_GET_SIZE(utf8)); - Py_DECREF(utf8); - if (converted == NULL) - goto error_nomem; - - PyMem_FREE(*inp); - *inp = converted; - if (tok->encoding != NULL) - PyMem_FREE(tok->encoding); - tok->encoding = new_string(encoding, strlen(encoding)); - if (tok->encoding == NULL) - goto error_nomem; - - Py_DECREF(enc); - return 0; - -error_nomem: - Py_DECREF(enc); - tok->done = E_NOMEM; - return -1; - -error_clear: - Py_DECREF(enc); - if (!PyErr_ExceptionMatches(PyExc_UnicodeDecodeError)) { - tok->done = E_ERROR; - return -1; - } - /* Fallback to iso-8859-1: for backward compatibility */ - PyErr_Clear(); - return 0; -} -#endif - -/* Get next char, updating state; error code goes into tok->done */ - -static int -tok_nextc(register struct tok_state *tok) -{ - for (;;) { - if (tok->cur != tok->inp) { - return Py_CHARMASK(*tok->cur++); /* Fast path */ - } - if (tok->done != E_OK) - return EOF; - if (tok->fp == NULL) { - char *end = strchr(tok->inp, '\n'); - if (end != NULL) - end++; - else { - end = strchr(tok->inp, '\0'); - if (end == tok->inp) { - tok->done = E_EOF; - return EOF; - } - } - if (tok->start == NULL) - tok->buf = tok->cur; - tok->line_start = tok->cur; - tok->lineno++; - tok->inp = end; - return Py_CHARMASK(*tok->cur++); - } - if (tok->prompt != NULL) { - char *newtok = PyOS_Readline(stdin, stdout, tok->prompt); - if (tok->nextprompt != NULL) - tok->prompt = tok->nextprompt; - if (newtok == NULL) - tok->done = E_INTR; - else if (*newtok == '\0') { - PyMem_FREE(newtok); - tok->done = E_EOF; - } -#if !defined(PGEN) && defined(Py_USING_UNICODE) - else if (tok_stdin_decode(tok, &newtok) != 0) - PyMem_FREE(newtok); -#endif - else if (tok->start != NULL) { - size_t start = tok->start - tok->buf; - size_t oldlen = tok->cur - tok->buf; - size_t newlen = oldlen + strlen(newtok); - char *buf = tok->buf; - buf = (char *)PyMem_REALLOC(buf, newlen+1); - tok->lineno++; - if (buf == NULL) { - PyMem_FREE(tok->buf); - tok->buf = NULL; - PyMem_FREE(newtok); - tok->done = E_NOMEM; - return EOF; - } - tok->buf = buf; - tok->cur = tok->buf + oldlen; - tok->line_start = tok->cur; - strcpy(tok->buf + oldlen, newtok); - PyMem_FREE(newtok); - tok->inp = tok->buf + newlen; - tok->end = tok->inp + 1; - tok->start = tok->buf + start; - } - else { - tok->lineno++; - if (tok->buf != NULL) - PyMem_FREE(tok->buf); - tok->buf = newtok; - tok->line_start = tok->buf; - tok->cur = tok->buf; - tok->line_start = tok->buf; - tok->inp = strchr(tok->buf, '\0'); - tok->end = tok->inp + 1; - } - } - else { - int done = 0; - Py_ssize_t cur = 0; - char *pt; - if (tok->start == NULL) { - if (tok->buf == NULL) { - tok->buf = (char *) - PyMem_MALLOC(BUFSIZ); - if (tok->buf == NULL) { - tok->done = E_NOMEM; - return EOF; - } - tok->end = tok->buf + BUFSIZ; - } - if (decoding_fgets(tok->buf, (int)(tok->end - tok->buf), - tok) == NULL) { - tok->done = E_EOF; - done = 1; - } - else { - tok->done = E_OK; - tok->inp = strchr(tok->buf, '\0'); - done = tok->inp[-1] == '\n'; - } - } - else { - cur = tok->cur - tok->buf; - if (decoding_feof(tok)) { - tok->done = E_EOF; - done = 1; - } - else - tok->done = E_OK; - } - tok->lineno++; - /* Read until '\n' or EOF */ - while (!done) { - Py_ssize_t curstart = tok->start == NULL ? -1 : - tok->start - tok->buf; - Py_ssize_t curvalid = tok->inp - tok->buf; - Py_ssize_t newsize = curvalid + BUFSIZ; - char *newbuf = tok->buf; - newbuf = (char *)PyMem_REALLOC(newbuf, - newsize); - if (newbuf == NULL) { - tok->done = E_NOMEM; - tok->cur = tok->inp; - return EOF; - } - tok->buf = newbuf; - tok->inp = tok->buf + curvalid; - tok->end = tok->buf + newsize; - tok->start = curstart < 0 ? NULL : - tok->buf + curstart; - if (decoding_fgets(tok->inp, - (int)(tok->end - tok->inp), - tok) == NULL) { - /* Break out early on decoding - errors, as tok->buf will be NULL - */ - if (tok->decoding_erred) - return EOF; - /* Last line does not end in \n, - fake one */ - strcpy(tok->inp, "\n"); - } - tok->inp = strchr(tok->inp, '\0'); - done = tok->inp[-1] == '\n'; - } - if (tok->buf != NULL) { - tok->cur = tok->buf + cur; - tok->line_start = tok->cur; - /* replace "\r\n" with "\n" */ - /* For Mac leave the \r, giving a syntax error */ - pt = tok->inp - 2; - if (pt >= tok->buf && *pt == '\r') { - *pt++ = '\n'; - *pt = '\0'; - tok->inp = pt; - } - } - } - if (tok->done != E_OK) { - if (tok->prompt != NULL) - PySys_WriteStderr("\n"); - tok->cur = tok->inp; - return EOF; - } - } - /*NOTREACHED*/ -} - - -/* Back-up one character */ - -static void -tok_backup(register struct tok_state *tok, register int c) -{ - if (c != EOF) { - if (--tok->cur < tok->buf) - Py_FatalError("tok_backup: beginning of buffer"); - if (*tok->cur != c) - *tok->cur = c; - } -} - - -/* Return the token corresponding to a single character */ - -int -PyToken_OneChar(int c) -{ - switch (c) { - case '(': return LPAR; - case ')': return RPAR; - case '[': return LSQB; - case ']': return RSQB; - case ':': return COLON; - case ',': return COMMA; - case ';': return SEMI; - case '+': return PLUS; - case '-': return MINUS; - case '*': return STAR; - case '/': return SLASH; - case '|': return VBAR; - case '&': return AMPER; - case '<': return LESS; - case '>': return GREATER; - case '=': return EQUAL; - case '.': return DOT; - case '%': return PERCENT; - case '`': return BACKQUOTE; - case '{': return LBRACE; - case '}': return RBRACE; - case '^': return CIRCUMFLEX; - case '~': return TILDE; - case '@': return AT; - default: return OP; - } -} - - -int -PyToken_TwoChars(int c1, int c2) -{ - switch (c1) { - case '=': - switch (c2) { - case '=': return EQEQUAL; - } - break; - case '!': - switch (c2) { - case '=': return NOTEQUAL; - } - break; - case '<': - switch (c2) { - case '>': return NOTEQUAL; - case '=': return LESSEQUAL; - case '<': return LEFTSHIFT; - } - break; - case '>': - switch (c2) { - case '=': return GREATEREQUAL; - case '>': return RIGHTSHIFT; - } - break; - case '+': - switch (c2) { - case '=': return PLUSEQUAL; - } - break; - case '-': - switch (c2) { - case '=': return MINEQUAL; - } - break; - case '*': - switch (c2) { - case '*': return DOUBLESTAR; - case '=': return STAREQUAL; - } - break; - case '/': - switch (c2) { - case '/': return DOUBLESLASH; - case '=': return SLASHEQUAL; - } - break; - case '|': - switch (c2) { - case '=': return VBAREQUAL; - } - break; - case '%': - switch (c2) { - case '=': return PERCENTEQUAL; - } - break; - case '&': - switch (c2) { - case '=': return AMPEREQUAL; - } - break; - case '^': - switch (c2) { - case '=': return CIRCUMFLEXEQUAL; - } - break; - } - return OP; -} - -int -PyToken_ThreeChars(int c1, int c2, int c3) -{ - switch (c1) { - case '<': - switch (c2) { - case '<': - switch (c3) { - case '=': - return LEFTSHIFTEQUAL; - } - break; - } - break; - case '>': - switch (c2) { - case '>': - switch (c3) { - case '=': - return RIGHTSHIFTEQUAL; - } - break; - } - break; - case '*': - switch (c2) { - case '*': - switch (c3) { - case '=': - return DOUBLESTAREQUAL; - } - break; - } - break; - case '/': - switch (c2) { - case '/': - switch (c3) { - case '=': - return DOUBLESLASHEQUAL; - } - break; - } - break; - } - return OP; -} - -static int -indenterror(struct tok_state *tok) -{ - if (tok->alterror) { - tok->done = E_TABSPACE; - tok->cur = tok->inp; - return 1; - } - if (tok->altwarning) { - PySys_WriteStderr("%s: inconsistent use of tabs and spaces " - "in indentation\n", tok->filename); - tok->altwarning = 0; - } - return 0; -} - -/* Get next token, after space stripping etc. */ - -static int -tok_get(register struct tok_state *tok, char **p_start, char **p_end) -{ - register int c; - int blankline; - - *p_start = *p_end = NULL; - nextline: - tok->start = NULL; - blankline = 0; - - /* Get indentation level */ - if (tok->atbol) { - register int col = 0; - register int altcol = 0; - tok->atbol = 0; - for (;;) { - c = tok_nextc(tok); - if (c == ' ') - col++, altcol++; - else if (c == '\t') { - col = (col/tok->tabsize + 1) * tok->tabsize; - altcol = (altcol/tok->alttabsize + 1) - * tok->alttabsize; - } - else if (c == '\014') /* Control-L (formfeed) */ - col = altcol = 0; /* For Emacs users */ - else - break; - } - tok_backup(tok, c); - if (c == '#' || c == '\n') { - /* Lines with only whitespace and/or comments - shouldn't affect the indentation and are - not passed to the parser as NEWLINE tokens, - except *totally* empty lines in interactive - mode, which signal the end of a command group. */ - if (col == 0 && c == '\n' && tok->prompt != NULL) - blankline = 0; /* Let it through */ - else - blankline = 1; /* Ignore completely */ - /* We can't jump back right here since we still - may need to skip to the end of a comment */ - } - if (!blankline && tok->level == 0) { - if (col == tok->indstack[tok->indent]) { - /* No change */ - if (altcol != tok->altindstack[tok->indent]) { - if (indenterror(tok)) - return ERRORTOKEN; - } - } - else if (col > tok->indstack[tok->indent]) { - /* Indent -- always one */ - if (tok->indent+1 >= MAXINDENT) { - tok->done = E_TOODEEP; - tok->cur = tok->inp; - return ERRORTOKEN; - } - if (altcol <= tok->altindstack[tok->indent]) { - if (indenterror(tok)) - return ERRORTOKEN; - } - tok->pendin++; - tok->indstack[++tok->indent] = col; - tok->altindstack[tok->indent] = altcol; - } - else /* col < tok->indstack[tok->indent] */ { - /* Dedent -- any number, must be consistent */ - while (tok->indent > 0 && - col < tok->indstack[tok->indent]) { - tok->pendin--; - tok->indent--; - } - if (col != tok->indstack[tok->indent]) { - tok->done = E_DEDENT; - tok->cur = tok->inp; - return ERRORTOKEN; - } - if (altcol != tok->altindstack[tok->indent]) { - if (indenterror(tok)) - return ERRORTOKEN; - } - } - } - } - - tok->start = tok->cur; - - /* Return pending indents/dedents */ - if (tok->pendin != 0) { - if (tok->pendin < 0) { - tok->pendin++; - return DEDENT; - } - else { - tok->pendin--; - return INDENT; - } - } - - again: - tok->start = NULL; - /* Skip spaces */ - do { - c = tok_nextc(tok); - } while (c == ' ' || c == '\t' || c == '\014'); - - /* Set start of current token */ - tok->start = tok->cur - 1; - - /* Skip comment, while looking for tab-setting magic */ - if (c == '#') { - static char *tabforms[] = { - "tab-width:", /* Emacs */ - ":tabstop=", /* vim, full form */ - ":ts=", /* vim, abbreviated form */ - "set tabsize=", /* will vi never die? */ - /* more templates can be added here to support other editors */ - }; - char cbuf[80]; - char *tp, **cp; - tp = cbuf; - do { - *tp++ = c = tok_nextc(tok); - } while (c != EOF && c != '\n' && - (size_t)(tp - cbuf + 1) < sizeof(cbuf)); - *tp = '\0'; - for (cp = tabforms; - cp < tabforms + sizeof(tabforms)/sizeof(tabforms[0]); - cp++) { - if ((tp = strstr(cbuf, *cp))) { - int newsize = atoi(tp + strlen(*cp)); - - if (newsize >= 1 && newsize <= 40) { - tok->tabsize = newsize; - if (Py_VerboseFlag) - PySys_WriteStderr( - "Tab size set to %d\n", - newsize); - } - } - } - while (c != EOF && c != '\n') - c = tok_nextc(tok); - } - - /* Check for EOF and errors now */ - if (c == EOF) { - return tok->done == E_EOF ? ENDMARKER : ERRORTOKEN; - } - - /* Identifier (most frequent token!) */ - if (Py_ISALPHA(c) || c == '_') { - /* Process r"", u"" and ur"" */ - switch (c) { - case 'b': - case 'B': - c = tok_nextc(tok); - if (c == 'r' || c == 'R') - c = tok_nextc(tok); - if (c == '"' || c == '\'') - goto letter_quote; - break; - case 'r': - case 'R': - c = tok_nextc(tok); - if (c == '"' || c == '\'') - goto letter_quote; - break; - case 'u': - case 'U': - c = tok_nextc(tok); - if (c == 'r' || c == 'R') - c = tok_nextc(tok); - if (c == '"' || c == '\'') - goto letter_quote; - break; - } - while (c != EOF && (Py_ISALNUM(c) || c == '_')) { - c = tok_nextc(tok); - } - tok_backup(tok, c); - *p_start = tok->start; - *p_end = tok->cur; - return NAME; - } - - /* Newline */ - if (c == '\n') { - tok->atbol = 1; - if (blankline || tok->level > 0) - goto nextline; - *p_start = tok->start; - *p_end = tok->cur - 1; /* Leave '\n' out of the string */ - tok->cont_line = 0; - return NEWLINE; - } - - /* Period or number starting with period? */ - if (c == '.') { - c = tok_nextc(tok); - if (isdigit(c)) { - goto fraction; - } - else { - tok_backup(tok, c); - *p_start = tok->start; - *p_end = tok->cur; - return DOT; - } - } - - /* Number */ - if (isdigit(c)) { - if (c == '0') { - /* Hex, octal or binary -- maybe. */ - c = tok_nextc(tok); - if (c == '.') - goto fraction; -#ifndef WITHOUT_COMPLEX - if (c == 'j' || c == 'J') - goto imaginary; -#endif - if (c == 'x' || c == 'X') { - - /* Hex */ - c = tok_nextc(tok); - if (!isxdigit(c)) { - tok->done = E_TOKEN; - tok_backup(tok, c); - return ERRORTOKEN; - } - do { - c = tok_nextc(tok); - } while (isxdigit(c)); - } - else if (c == 'o' || c == 'O') { - /* Octal */ - c = tok_nextc(tok); - if (c < '0' || c >= '8') { - tok->done = E_TOKEN; - tok_backup(tok, c); - return ERRORTOKEN; - } - do { - c = tok_nextc(tok); - } while ('0' <= c && c < '8'); - } - else if (c == 'b' || c == 'B') { - /* Binary */ - c = tok_nextc(tok); - if (c != '0' && c != '1') { - tok->done = E_TOKEN; - tok_backup(tok, c); - return ERRORTOKEN; - } - do { - c = tok_nextc(tok); - } while (c == '0' || c == '1'); - } - else { - int found_decimal = 0; - /* Octal; c is first char of it */ - /* There's no 'isoctdigit' macro, sigh */ - while ('0' <= c && c < '8') { - c = tok_nextc(tok); - } - if (isdigit(c)) { - found_decimal = 1; - do { - c = tok_nextc(tok); - } while (isdigit(c)); - } - if (c == '.') - goto fraction; - else if (c == 'e' || c == 'E') - goto exponent; -#ifndef WITHOUT_COMPLEX - else if (c == 'j' || c == 'J') - goto imaginary; -#endif - else if (found_decimal) { - tok->done = E_TOKEN; - tok_backup(tok, c); - return ERRORTOKEN; - } - } - if (c == 'l' || c == 'L') - c = tok_nextc(tok); - } - else { - /* Decimal */ - do { - c = tok_nextc(tok); - } while (isdigit(c)); - if (c == 'l' || c == 'L') - c = tok_nextc(tok); - else { - /* Accept floating point numbers. */ - if (c == '.') { - fraction: - /* Fraction */ - do { - c = tok_nextc(tok); - } while (isdigit(c)); - } - if (c == 'e' || c == 'E') { - int e; - exponent: - e = c; - /* Exponent part */ - c = tok_nextc(tok); - if (c == '+' || c == '-') { - c = tok_nextc(tok); - if (!isdigit(c)) { - tok->done = E_TOKEN; - tok_backup(tok, c); - return ERRORTOKEN; - } - } else if (!isdigit(c)) { - tok_backup(tok, c); - tok_backup(tok, e); - *p_start = tok->start; - *p_end = tok->cur; - return NUMBER; - } - do { - c = tok_nextc(tok); - } while (isdigit(c)); - } -#ifndef WITHOUT_COMPLEX - if (c == 'j' || c == 'J') - /* Imaginary part */ - imaginary: - c = tok_nextc(tok); -#endif - } - } - tok_backup(tok, c); - *p_start = tok->start; - *p_end = tok->cur; - return NUMBER; - } - - letter_quote: - /* String */ - if (c == '\'' || c == '"') { - Py_ssize_t quote2 = tok->cur - tok->start + 1; - int quote = c; - int triple = 0; - int tripcount = 0; - for (;;) { - c = tok_nextc(tok); - if (c == '\n') { - if (!triple) { - tok->done = E_EOLS; - tok_backup(tok, c); - return ERRORTOKEN; - } - tripcount = 0; - tok->cont_line = 1; /* multiline string. */ - } - else if (c == EOF) { - if (triple) - tok->done = E_EOFS; - else - tok->done = E_EOLS; - tok->cur = tok->inp; - return ERRORTOKEN; - } - else if (c == quote) { - tripcount++; - if (tok->cur - tok->start == quote2) { - c = tok_nextc(tok); - if (c == quote) { - triple = 1; - tripcount = 0; - continue; - } - tok_backup(tok, c); - } - if (!triple || tripcount == 3) - break; - } - else if (c == '\\') { - tripcount = 0; - c = tok_nextc(tok); - if (c == EOF) { - tok->done = E_EOLS; - tok->cur = tok->inp; - return ERRORTOKEN; - } - } - else - tripcount = 0; - } - *p_start = tok->start; - *p_end = tok->cur; - return STRING; - } - - /* Line continuation */ - if (c == '\\') { - c = tok_nextc(tok); - if (c != '\n') { - tok->done = E_LINECONT; - tok->cur = tok->inp; - return ERRORTOKEN; - } - tok->cont_line = 1; - goto again; /* Read next line */ - } - - /* Check for two-character token */ - { - int c2 = tok_nextc(tok); - int token = PyToken_TwoChars(c, c2); -#ifndef PGEN - if (Py_Py3kWarningFlag && token == NOTEQUAL && c == '<') { - if (PyErr_WarnExplicit(PyExc_DeprecationWarning, - "<> not supported in 3.x; use !=", - tok->filename, tok->lineno, - NULL, NULL)) { - return ERRORTOKEN; - } - } -#endif - if (token != OP) { - int c3 = tok_nextc(tok); - int token3 = PyToken_ThreeChars(c, c2, c3); - if (token3 != OP) { - token = token3; - } else { - tok_backup(tok, c3); - } - *p_start = tok->start; - *p_end = tok->cur; - return token; - } - tok_backup(tok, c2); - } - - /* Keep track of parentheses nesting level */ - switch (c) { - case '(': - case '[': - case '{': - tok->level++; - break; - case ')': - case ']': - case '}': - tok->level--; - break; - } - - /* Punctuation character */ - *p_start = tok->start; - *p_end = tok->cur; - return PyToken_OneChar(c); -} - -int -PyTokenizer_Get(struct tok_state *tok, char **p_start, char **p_end) -{ - int result = tok_get(tok, p_start, p_end); - if (tok->decoding_erred) { - result = ERRORTOKEN; - tok->done = E_DECODE; - } - return result; -} - -/* This function is only called from parsetok. However, it cannot live - there, as it must be empty for PGEN, and we can check for PGEN only - in this file. */ - -#if defined(PGEN) || !defined(Py_USING_UNICODE) -char* -PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int* offset) -{ - return NULL; -} -#else -#ifdef Py_USING_UNICODE -static PyObject * -dec_utf8(const char *enc, const char *text, size_t len) { - PyObject *ret = NULL; - PyObject *unicode_text = PyUnicode_DecodeUTF8(text, len, "replace"); - if (unicode_text) { - ret = PyUnicode_AsEncodedString(unicode_text, enc, "replace"); - Py_DECREF(unicode_text); - } - if (!ret) { - PyErr_Clear(); - } - return ret; -} -char * -PyTokenizer_RestoreEncoding(struct tok_state* tok, int len, int *offset) -{ - char *text = NULL; - if (tok->encoding) { - /* convert source to original encondig */ - PyObject *lineobj = dec_utf8(tok->encoding, tok->buf, len); - if (lineobj != NULL) { - int linelen = PyString_Size(lineobj); - const char *line = PyString_AsString(lineobj); - text = PyObject_MALLOC(linelen + 1); - if (text != NULL && line != NULL) { - if (linelen) - strncpy(text, line, linelen); - text[linelen] = '\0'; - } - Py_DECREF(lineobj); - - /* adjust error offset */ - if (*offset > 1) { - PyObject *offsetobj = dec_utf8(tok->encoding, - tok->buf, *offset-1); - if (offsetobj) { - *offset = PyString_Size(offsetobj) + 1; - Py_DECREF(offsetobj); - } - } - - } - } - return text; - -} -#endif /* defined(Py_USING_UNICODE) */ -#endif - - -#ifdef Py_DEBUG - -void -tok_dump(int type, char *start, char *end) -{ - printf("%s", _PyParser_TokenNames[type]); - if (type == NAME || type == NUMBER || type == STRING || type == OP) - printf("(%.*s)", (int)(end - start), start); -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.h b/AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.h deleted file mode 100644 index 3de3280..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Parser/tokenizer.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef Py_TOKENIZER_H -#define Py_TOKENIZER_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "object.h" - -/* Tokenizer interface */ - -#include "token.h" /* For token types */ - -#define MAXINDENT 100 /* Max indentation level */ - -/* Tokenizer state */ -struct tok_state { - /* Input state; buf <= cur <= inp <= end */ - /* NB an entire line is held in the buffer */ - char *buf; /* Input buffer, or NULL; malloc'ed if fp != NULL */ - char *cur; /* Next character in buffer */ - char *inp; /* End of data in buffer */ - char *end; /* End of input buffer if buf != NULL */ - char *start; /* Start of current token if not NULL */ - int done; /* E_OK normally, E_EOF at EOF, otherwise error code */ - /* NB If done != E_OK, cur must be == inp!!! */ - FILE *fp; /* Rest of input; NULL if tokenizing a string */ - int tabsize; /* Tab spacing */ - int indent; /* Current indentation index */ - int indstack[MAXINDENT]; /* Stack of indents */ - int atbol; /* Nonzero if at begin of new line */ - int pendin; /* Pending indents (if > 0) or dedents (if < 0) */ - char *prompt, *nextprompt; /* For interactive prompting */ - int lineno; /* Current line number */ - int level; /* () [] {} Parentheses nesting level */ - /* Used to allow free continuations inside them */ - /* Stuff for checking on different tab sizes */ - const char *filename; /* For error messages */ - int altwarning; /* Issue warning if alternate tabs don't match */ - int alterror; /* Issue error if alternate tabs don't match */ - int alttabsize; /* Alternate tab spacing */ - int altindstack[MAXINDENT]; /* Stack of alternate indents */ - /* Stuff for PEP 0263 */ - int decoding_state; /* -1:decoding, 0:init, 1:raw */ - int decoding_erred; /* whether erred in decoding */ - int read_coding_spec; /* whether 'coding:...' has been read */ - char *encoding; - int cont_line; /* whether we are in a continuation line. */ - const char* line_start; /* pointer to start of current line */ -#ifndef PGEN - PyObject *decoding_readline; /* codecs.open(...).readline */ - PyObject *decoding_buffer; -#endif - const char* enc; - const char* str; - const char* input; /* Tokenizer's newline translated copy of the string. */ -}; - -extern struct tok_state *PyTokenizer_FromString(const char *, int); -extern struct tok_state *PyTokenizer_FromFile(FILE *, char *, char *); -extern void PyTokenizer_Free(struct tok_state *); -extern int PyTokenizer_Get(struct tok_state *, char **, char **); -#if defined(PGEN) || defined(Py_USING_UNICODE) -extern char * PyTokenizer_RestoreEncoding(struct tok_state* tok, - int len, int *offset); -#endif - -#ifdef __cplusplus -} -#endif -#endif /* !Py_TOKENIZER_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Py2710ReadMe.txt b/AppPkg/Applications/Python/Python-2.7.10/Py2710ReadMe.txt deleted file mode 100644 index abe8fcf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Py2710ReadMe.txt +++ /dev/null @@ -1,259 +0,0 @@ - EDK II Python - ReadMe - Version 2.7.10 - Release 1.00 - 3 Nov. 2015 - - -1. OVERVIEW -=========== -This document is devoted to general information on building and setup of the -Python environment for UEFI, the invocation of the interpreter, and things -that make working with Python easier. - -It is assumed that you already have UDK2010 or later, or a current snapshot of -the EDK II sources from www.tianocore.org, and that you can successfully build -packages within that distribution. - -2. Release Notes -================ - 1) All C extension modules must be statically linked (built in) - 2) The site and os modules must exist as discrete files in ...\lib\python27.10 - 3) User-specific configurations are not supported. - 4) Environment variables are not supported. - -3. Getting and Building Python -====================================================== - 3.1 Getting Python - ================== - This file describes the UEFI port of version 2.7.10 of the CPython distribution. - For development ease, a subset of the Python 2.7.10 distribution has been - included as part of the AppPkg/Applications/Python/Python-2.7.10 source tree. - If this is sufficient, you may skip to section 3.2, Building Python. - - If a full distribution is desired, it can be merged into the Python-2.7.10 - source tree. Directory AppPkg/Applications/Python/Python-2.7.10 corresponds - to the root directory of the CPython 2.7.10 distribution. The full - CPython 2.7.10 source code may be downloaded from - http://www.python.org/ftp/python/2.7.10/. - - A. Within your EDK II development tree, extract the Python distribution into - AppPkg/Applications/Python/Python-2.7.10. This should merge the additional - files into the source tree. It will also create the following directories: - Demo Doc Grammar Mac Misc - PC PCbuild RISCOS Tools - - The greatest change will be within the Python-2.7.10/Lib directory where - many more packages and modules will be added. These additional components - may not have been ported to EDK II yet. - - 3.2 Building Python - =================== - A. From the AppPkg/Applications/Python/Python-2.7.10 directory, execute the - srcprep.bat (srcprep.sh) script to copy the header files from within the - PyMod-2.7.10 sub-tree into their corresponding directories within the - distribution. This step only needs to be performed prior to the first - build of Python, or if one of the header files within the PyMod tree has been - modified. - - B. Edit PyMod-2.7.10\Modules\config.c to enable the built-in modules you need. - By default, it is configured for the minimally required set of modules. - Mandatory Built-in Modules: - edk2 errno imp marshal - - Additional built-in modules which are required to use the help() - functionality provided by PyDoc, are: - _codecs _collections _functools _random - _sre _struct _weakref binascii - cStringIO gc itertools math - operator time - - C. Edit AppPkg/AppPkg.dsc to enable (uncomment) the Python2710.inf line - within the [Components] section. - - D. Build AppPkg using the standard "build" command: - For example, to build Python for an X64 CPU architecture: - build -a X64 -p AppPkg\AppPkg.dsc - -4. Python-related paths and files -================================= -Python depends upon the existence of several directories and files on the -target system. - - \EFI Root of the UEFI system area. - |- \Tools Location of the Python.efi executable. - |- \Boot UEFI specified Boot directory. - |- \StdLib Root of the Standard Libraries sub-tree. - |- \etc Configuration files used by libraries. - |- \tmp Temporary files created by tmpfile(), etc. - |- \lib Root of the libraries tree. - |- \python27.10 Directory containing the Python library - | modules. - |- \lib-dynload Dynamically loadable Python extensions. - |- \site-packages Site-specific packages and modules. - - NOTE: The name of the directory containing the Python library modules has - changed in order to distinguish it from the library modules for - version 2.7.2. - -5. Installing Python -==================== -These directories, on the target system, are populated from the development -system as follows: - - * \Efi\Tools receives a copy of Build/AppPkg/DEBUG_VS2015/X64/Python2710.efi. - ^^^^^^^^^^^^^^^^ - Modify the host path to match your build type and compiler. - - * The \Efi\StdLib\etc directory is populated from the StdLib/Efi/StdLib/etc - source directory. - - * Directory \Efi\StdLib\lib\python27.10 is populated with packages and modules - from the AppPkg/Applications/Python/Python-2.7.10/Lib directory. - The recommended minimum set of modules (.py, .pyc, and/or .pyo): - os stat ntpath warnings traceback - site types copy_reg linecache genericpath - - * Python C Extension Modules built as dynamically loadable extensions go into - the \Efi\StdLib\lib\python.27\lib-dynload directory. This functionality is not - yet implemented. - - A script, libprep.bat (libprep.sh), is provided which facilitates the population - of the target Lib directory. Execute this script from within the - AppPkg/Applications/Python/Python-2.7.10 directory, providing a single argument - which is the path to the destination directory. The appropriate contents of the - AppPkg/Applications/Python/Python-2.7.10/Lib and - AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib directories will be - recursively copied into the specified destination directory. - -6. Example: Enabling socket support -=================================== - 1. enable {"_socket", init_socket}, in Efi\config.c - 2. enable LibraryClasses BsdSocketLib and EfiSocketLib in PythonCore.inf. - 3. Build Python2710 - build -a X64 -p AppPkg\AppPkg.dsc - 6. copy Build\AppPkg\DEBUG_VS2005\X64\Python2710.efi to \Efi\Tools on your - target system. Replace "DEBUG_VS2005\X64", in the source path, with - values appropriate for your tool chain and processor architecture. - -7. Running Python -================= - Python must currently be run from an EFI FAT-32 partition, or volume, under - the UEFI Shell. At the Shell prompt enter the desired volume name, followed - by a colon ':', then press Enter. Python can then be executed by typing its - name, followed by any desired options and arguments. - - EXAMPLE: - 2.0 Shell> fs0: - 2.0 FS0:\> python2710 - Python 2.7.10 (default, Oct 13 2015, 16:21:53) [C] on uefi - Type "help", "copyright", "credits" or "license" for more information. - >>> exit() - 2.0 FS0:\> - - NOTE: - Python, as distributed, sends its interactive prompts to stderr. If - STDERR isn't enabled in UEFI Setup so that it's output goes to the - console, it may appear that Python hangs on startup. If this happens, - one may be able to rectify the condition by typing "exit()" followed - by to exit out of Python. Then, type "exit" at the Shell prompt - which should enter Setup where you can use the Boot Maintenance - Manager to modify your Console settings. - - NOTE: - Some platforms don't include the Setup utility, or don't allow STDERR to - be modified. In these cases, Python may be started with the '-#' option - which will cause stderr to be the same as stdout and should allow - Python to be used interactively on those platforms. - - Depending upon the version of Shell you are using, it may be necessary - to escape the '#' character so that the Shell doesn't interpret it as - the start of a comment. The escape character is '^'. - Example: - python -^# -V - -8. Supported C Modules -====================== - Module Name C File(s) - =============== ============================================= - _ast Python/Python-ast.c - _bisect Modules/_bisectmodule.c - _codecs Modules/_codecsmodule.c - _codecs_cn Modules/cjkcodecs/_codecs_cn.c - _codecs_hk Modules/cjkcodecs/_codecs_hk.c - _codecs_iso2022 Modules/cjkcodecs/_codecs_iso2022.c - _codecs_jp Modules/cjkcodecs/_codecs_jp - _codecs_kr Modules/cjkcodecs/_codecs_kr - _codecs_tw Modules/cjkcodecs/_codecs_tw - _collections Modules/_collectionsmodule.c - _csv Modules/_csv.c - _functools Modules/_functoolsmodule.c - _heapq Modules/_heapqmodule.c - _io Modules/_io/_iomodule.c Modules/_io/* - _json Modules/_json.c - _md5 Modules/md5module.c Modules/md5.c - _multibytecodec Modules/cjkcodecs/_multibytecodec.c - _random Modules/_randommodule.c - _sha Modules/shamodule.c - _sha256 Modules/sha256module.c - _sha512 Modules/sha512module.c - _socket Modules/socketmodule.c - _sre Modules/_sre.c - _struct Modules/_struct.c - _symtable Modules/symtablemodule.c - _weakref Modules/_weakref.c - array Modules/arraymodule.c - binascii Modules/binascii.c - cmath Modules/cmathmodule.c - cPickle Modules/cPickle.c - cStringIO Modules/cStringIO.c - datetime Modules/datetimemodule.c - edk2 Modules/Efi/edk2module.c - errno Modules/errnomodule.c - future_builtins Modules/future_builtins.c - gc Modules/gcmodule.c - imp Python/import.c - itertools Modules/itertoolsmodule.c - marshal Python/marshal.c - math Modules/mathmodule.c Modules/_math.c - operator Modules/operator.c - parser Modules/parsermodule.c - select Modules/selectmodule.c - signal Modules/signalmodule.c - strop Modules/stropmodule.c - time Modules/timemodule.c - xxsubtype Modules/xxsubtype.c - zipimport Modules/zipimport.c - zlib Modules/zlibmodule.c Modules/zlib/* - - -9. Tested Python Library Modules -================================ -This is a partial list of the packages and modules of the Python Standard -Library that have been tested or used in some manner. - - encodings genericpath.py sha.py - importlib getopt.py SimpleHTTPServer.py - json hashlib.py site.py - pydoc_data heapq.py socket.py - xml HTMLParser.py SocketServer.py - abc.py inspect.py sre.py - argparse.py io.py sre_compile.py - ast.py keyword.py sre_constants.py - atexit.py linecache.py sre_parse.py - BaseHTTPServer.py locale.py stat.py - binhex.py md5.py string.py - bisect.py modulefinder.py StringIO.py - calendar.py ntpath.py struct.py - cmd.py numbers.py textwrap.py - codecs.py optparse.py token.py - collections.py os.py tokenize.py - copy.py platform.py traceback.py - copy_reg.py posixpath.py types.py - csv.py pydoc.py warnings.py - dummy_thread.py random.py weakref.py - fileinput.py re.py xmllib.py - formatter.py repr.py zipfile.py - functools.py runpy.py expat - -# # # diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/fileobject.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/fileobject.h deleted file mode 100644 index 5007848..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/fileobject.h +++ /dev/null @@ -1,108 +0,0 @@ -/** @file - File object interface - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef Py_FILEOBJECT_H -#define Py_FILEOBJECT_H -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct { - PyObject_HEAD - FILE *f_fp; - PyObject *f_name; - PyObject *f_mode; - int (*f_close)(FILE *); - int f_softspace; /* Flag used by 'print' command */ - int f_binary; /* Flag which indicates whether the file is - open in binary (1) or text (0) mode */ - char* f_buf; /* Allocated readahead buffer */ - char* f_bufend; /* Points after last occupied position */ - char* f_bufptr; /* Current buffer position */ - char *f_setbuf; /* Buffer for setbuf(3) and setvbuf(3) */ - int f_univ_newline; /* Handle any newline convention */ - int f_newlinetypes; /* Types of newlines seen */ - int f_skipnextlf; /* Skip next \n */ - PyObject *f_encoding; - PyObject *f_errors; - PyObject *weakreflist; /* List of weak references */ - int unlocked_count; /* Num. currently running sections of code - using f_fp with the GIL released. */ - int readable; - int writable; -} PyFileObject; - -PyAPI_DATA(PyTypeObject) PyFile_Type; - -#define PyFile_Check(op) PyObject_TypeCheck(op, &PyFile_Type) -#define PyFile_CheckExact(op) (Py_TYPE(op) == &PyFile_Type) - -PyAPI_FUNC(PyObject *) PyFile_FromString(char *, char *); -PyAPI_FUNC(void) PyFile_SetBufSize(PyObject *, int); -PyAPI_FUNC(int) PyFile_SetEncoding(PyObject *, const char *); -PyAPI_FUNC(int) PyFile_SetEncodingAndErrors(PyObject *, const char *, char *errors); -PyAPI_FUNC(PyObject *) PyFile_FromFile(FILE *, char *, char *, - int (*)(FILE *)); -PyAPI_FUNC(FILE *) PyFile_AsFile(PyObject *); -PyAPI_FUNC(void) PyFile_IncUseCount(PyFileObject *); -PyAPI_FUNC(void) PyFile_DecUseCount(PyFileObject *); -PyAPI_FUNC(PyObject *) PyFile_Name(PyObject *); -PyAPI_FUNC(PyObject *) PyFile_GetLine(PyObject *, int); -PyAPI_FUNC(int) PyFile_WriteObject(PyObject *, PyObject *, int); -PyAPI_FUNC(int) PyFile_SoftSpace(PyObject *, int); -PyAPI_FUNC(int) PyFile_WriteString(const char *, PyObject *); -PyAPI_FUNC(int) PyObject_AsFileDescriptor(PyObject *); - -/* The default encoding used by the platform file system APIs - If non-NULL, this is different than the default encoding for strings -*/ -PyAPI_DATA(const char *) Py_FileSystemDefaultEncoding; - -/* Routines to replace fread() and fgets() which accept any of \r, \n - or \r\n as line terminators. -*/ -#define PY_STDIOTEXTMODE "b" -char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *); -size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *); - -/* A routine to do sanity checking on the file mode string. returns - non-zero on if an exception occurred -*/ -int _PyFile_SanitizeMode(char *mode); - -//#if defined _MSC_VER && _MSC_VER >= 1400 -/* A routine to check if a file descriptor is valid on Windows. Returns 0 - * and sets errno to EBADF if it isn't. This is to avoid Assertions - * from various functions in the Windows CRT beginning with - * Visual Studio 2005 - */ -//int _PyVerify_fd(int fd); -//#elif defined _MSC_VER && _MSC_VER >= 1200 -/* fdopen doesn't set errno EBADF and crashes for large fd on debug build */ -//#define _PyVerify_fd(fd) (_get_osfhandle(fd) >= 0) -//#else -#define _PyVerify_fd(A) (1) /* dummy */ -//#endif - -/* A routine to check if a file descriptor can be select()-ed. */ -#ifdef HAVE_SELECT - #define _PyIsSelectable_fd(FD) (((FD) >= 0) && ((FD) < FD_SETSIZE)) -#else - #define _PyIsSelectable_fd(FD) (1) -#endif /* HAVE_SELECT */ - -#ifdef __cplusplus -} -#endif -#endif /* !Py_FILEOBJECT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/osdefs.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/osdefs.h deleted file mode 100644 index e01bd49..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/osdefs.h +++ /dev/null @@ -1,81 +0,0 @@ -/** @file - Operating system dependencies. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef Py_OSDEFS_H -#define Py_OSDEFS_H -#ifdef __cplusplus -extern "C" { -#endif - - -/* Mod by chrish: QNX has WATCOM, but isn't DOS */ -#if !defined(__QNX__) && !defined(UEFI_C_SOURCE) -#if defined(MS_WINDOWS) || defined(__BORLANDC__) || defined(__WATCOMC__) || defined(__DJGPP__) || defined(PYOS_OS2) -#if defined(PYOS_OS2) && defined(PYCC_GCC) -#define MAXPATHLEN 260 -#define SEP '/' -#define ALTSEP '\\' -#else -#define SEP '\\' -#define ALTSEP '/' -#define MAXPATHLEN 256 -#endif -#define DELIM ';' -#endif -#endif - -#ifdef RISCOS -#define SEP '.' -#define MAXPATHLEN 256 -#define DELIM ',' -#endif - - -/* Filename separator */ -#ifndef SEP -#define SEP '/' -#define ALTSEP '\\' -#endif - -/* Max pathname length */ -#ifdef __hpux -# include -# include -# ifndef PATH_MAX -# define PATH_MAX MAXPATHLEN -# endif -#endif - -#ifndef MAXPATHLEN -#if defined(PATH_MAX) && PATH_MAX > 1024 -#define MAXPATHLEN PATH_MAX -#else -#define MAXPATHLEN 1024 -#endif -#endif - -/* Search path entry delimiter */ -#ifndef DELIM -# ifdef UEFI_C_SOURCE -# define DELIM ';' -# define DELIM_STR ";" -# else -# define DELIM ':' -# endif -#endif - -#ifdef __cplusplus -} -#endif -#endif /* !Py_OSDEFS_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/pyport.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/pyport.h deleted file mode 100644 index 2858cdb..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include/pyport.h +++ /dev/null @@ -1,957 +0,0 @@ -/** @file - Symbols and macros to supply platform-independent interfaces to basic - C language & library operations whose spellings vary across platforms. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef Py_PYPORT_H -#define Py_PYPORT_H - -#include "pyconfig.h" /* include for defines */ - -/* Some versions of HP-UX & Solaris need inttypes.h for int32_t, - INT32_MAX, etc. */ -#ifdef HAVE_INTTYPES_H -#include -#endif - -#ifdef HAVE_STDINT_H -#include -#endif - -/************************************************************************** -Symbols and macros to supply platform-independent interfaces to basic -C language & library operations whose spellings vary across platforms. - -Please try to make documentation here as clear as possible: by definition, -the stuff here is trying to illuminate C's darkest corners. - -Config #defines referenced here: - -SIGNED_RIGHT_SHIFT_ZERO_FILLS -Meaning: To be defined iff i>>j does not extend the sign bit when i is a - signed integral type and i < 0. -Used in: Py_ARITHMETIC_RIGHT_SHIFT - -Py_DEBUG -Meaning: Extra checks compiled in for debug mode. -Used in: Py_SAFE_DOWNCAST - -HAVE_UINTPTR_T -Meaning: The C9X type uintptr_t is supported by the compiler -Used in: Py_uintptr_t - -HAVE_LONG_LONG -Meaning: The compiler supports the C type "long long" -Used in: PY_LONG_LONG - -**************************************************************************/ - - -/* For backward compatibility only. Obsolete, do not use. */ -#ifdef HAVE_PROTOTYPES -#define Py_PROTO(x) x -#else -#define Py_PROTO(x) () -#endif -#ifndef Py_FPROTO -#define Py_FPROTO(x) Py_PROTO(x) -#endif - -/* typedefs for some C9X-defined synonyms for integral types. - * - * The names in Python are exactly the same as the C9X names, except with a - * Py_ prefix. Until C9X is universally implemented, this is the only way - * to ensure that Python gets reliable names that don't conflict with names - * in non-Python code that are playing their own tricks to define the C9X - * names. - * - * NOTE: don't go nuts here! Python has no use for *most* of the C9X - * integral synonyms. Only define the ones we actually need. - */ - -#ifdef HAVE_LONG_LONG -#ifndef PY_LONG_LONG -#define PY_LONG_LONG long long -#if defined(LLONG_MAX) -/* If LLONG_MAX is defined in limits.h, use that. */ -#define PY_LLONG_MIN LLONG_MIN -#define PY_LLONG_MAX LLONG_MAX -#define PY_ULLONG_MAX ULLONG_MAX -#elif defined(__LONG_LONG_MAX__) -/* Otherwise, if GCC has a builtin define, use that. */ -#define PY_LLONG_MAX __LONG_LONG_MAX__ -#define PY_LLONG_MIN (-PY_LLONG_MAX-1) -#define PY_ULLONG_MAX (__LONG_LONG_MAX__*2ULL + 1ULL) -#else -/* Otherwise, rely on two's complement. */ -#define PY_ULLONG_MAX (~0ULL) -#define PY_LLONG_MAX ((long long)(PY_ULLONG_MAX>>1)) -#define PY_LLONG_MIN (-PY_LLONG_MAX-1) -#endif /* LLONG_MAX */ -#endif -#endif /* HAVE_LONG_LONG */ - -/* a build with 30-bit digits for Python long integers needs an exact-width - * 32-bit unsigned integer type to store those digits. (We could just use - * type 'unsigned long', but that would be wasteful on a system where longs - * are 64-bits.) On Unix systems, the autoconf macro AC_TYPE_UINT32_T defines - * uint32_t to be such a type unless stdint.h or inttypes.h defines uint32_t. - * However, it doesn't set HAVE_UINT32_T, so we do that here. - */ -#ifdef uint32_t -#define HAVE_UINT32_T 1 -#endif - -#ifdef HAVE_UINT32_T -#ifndef PY_UINT32_T -#define PY_UINT32_T uint32_t -#endif -#endif - -/* Macros for a 64-bit unsigned integer type; used for type 'twodigits' in the - * long integer implementation, when 30-bit digits are enabled. - */ -#ifdef uint64_t -#define HAVE_UINT64_T 1 -#endif - -#ifdef HAVE_UINT64_T -#ifndef PY_UINT64_T -#define PY_UINT64_T uint64_t -#endif -#endif - -/* Signed variants of the above */ -#ifdef int32_t -#define HAVE_INT32_T 1 -#endif - -#ifdef HAVE_INT32_T -#ifndef PY_INT32_T -#define PY_INT32_T int32_t -#endif -#endif - -#ifdef int64_t -#define HAVE_INT64_T 1 -#endif - -#ifdef HAVE_INT64_T -#ifndef PY_INT64_T -#define PY_INT64_T int64_t -#endif -#endif - -/* If PYLONG_BITS_IN_DIGIT is not defined then we'll use 30-bit digits if all - the necessary integer types are available, and we're on a 64-bit platform - (as determined by SIZEOF_VOID_P); otherwise we use 15-bit digits. */ - -#ifndef PYLONG_BITS_IN_DIGIT -#if (defined HAVE_UINT64_T && defined HAVE_INT64_T && \ - defined HAVE_UINT32_T && defined HAVE_INT32_T && SIZEOF_VOID_P >= 8) -#define PYLONG_BITS_IN_DIGIT 30 -#else -#define PYLONG_BITS_IN_DIGIT 15 -#endif -#endif - -/* uintptr_t is the C9X name for an unsigned integral type such that a - * legitimate void* can be cast to uintptr_t and then back to void* again - * without loss of information. Similarly for intptr_t, wrt a signed - * integral type. - */ -#ifdef HAVE_UINTPTR_T -typedef uintptr_t Py_uintptr_t; -typedef intptr_t Py_intptr_t; - -#elif SIZEOF_VOID_P <= SIZEOF_INT -typedef unsigned int Py_uintptr_t; -typedef int Py_intptr_t; - -#elif SIZEOF_VOID_P <= SIZEOF_LONG -typedef unsigned long Py_uintptr_t; -typedef long Py_intptr_t; - -#elif defined(HAVE_LONG_LONG) && (SIZEOF_VOID_P <= SIZEOF_LONG_LONG) -typedef unsigned PY_LONG_LONG Py_uintptr_t; -typedef PY_LONG_LONG Py_intptr_t; - -#else -# error "Python needs a typedef for Py_uintptr_t in pyport.h." -#endif /* HAVE_UINTPTR_T */ - -/* Py_ssize_t is a signed integral type such that sizeof(Py_ssize_t) == - * sizeof(size_t). C99 doesn't define such a thing directly (size_t is an - * unsigned integral type). See PEP 353 for details. - */ -#ifdef HAVE_SSIZE_T -typedef ssize_t Py_ssize_t; -#elif SIZEOF_VOID_P == SIZEOF_SIZE_T -typedef Py_intptr_t Py_ssize_t; -#else -# error "Python needs a typedef for Py_ssize_t in pyport.h." -#endif - -/* Largest possible value of size_t. - SIZE_MAX is part of C99, so it might be defined on some - platforms. If it is not defined, (size_t)-1 is a portable - definition for C89, due to the way signed->unsigned - conversion is defined. */ -#ifdef SIZE_MAX -#define PY_SIZE_MAX SIZE_MAX -#else -#define PY_SIZE_MAX ((size_t)-1) -#endif - -/* Largest positive value of type Py_ssize_t. */ -#define PY_SSIZE_T_MAX ((Py_ssize_t)(((size_t)-1)>>1)) -/* Smallest negative value of type Py_ssize_t. */ -#define PY_SSIZE_T_MIN (-PY_SSIZE_T_MAX-1) - -#if SIZEOF_PID_T > SIZEOF_LONG -# error "Python doesn't support sizeof(pid_t) > sizeof(long)" -#endif - -/* PY_FORMAT_SIZE_T is a platform-specific modifier for use in a printf - * format to convert an argument with the width of a size_t or Py_ssize_t. - * C99 introduced "z" for this purpose, but not all platforms support that; - * e.g., MS compilers use "I" instead. - * - * These "high level" Python format functions interpret "z" correctly on - * all platforms (Python interprets the format string itself, and does whatever - * the platform C requires to convert a size_t/Py_ssize_t argument): - * - * PyString_FromFormat - * PyErr_Format - * PyString_FromFormatV - * - * Lower-level uses require that you interpolate the correct format modifier - * yourself (e.g., calling printf, fprintf, sprintf, PyOS_snprintf); for - * example, - * - * Py_ssize_t index; - * fprintf(stderr, "index %" PY_FORMAT_SIZE_T "d sucks\n", index); - * - * That will expand to %ld, or %Id, or to something else correct for a - * Py_ssize_t on the platform. - */ -#ifndef PY_FORMAT_SIZE_T -# if SIZEOF_SIZE_T == SIZEOF_INT && !defined(__APPLE__) -# define PY_FORMAT_SIZE_T "" -# elif SIZEOF_SIZE_T == SIZEOF_LONG -# define PY_FORMAT_SIZE_T "l" -# elif defined(MS_WINDOWS) -# define PY_FORMAT_SIZE_T "I" -# else -# error "This platform's pyconfig.h needs to define PY_FORMAT_SIZE_T" -# endif -#endif - -/* PY_FORMAT_LONG_LONG is analogous to PY_FORMAT_SIZE_T above, but for - * the long long type instead of the size_t type. It's only available - * when HAVE_LONG_LONG is defined. The "high level" Python format - * functions listed above will interpret "lld" or "llu" correctly on - * all platforms. - */ -#ifdef HAVE_LONG_LONG -# ifndef PY_FORMAT_LONG_LONG -# if defined(MS_WIN64) || defined(MS_WINDOWS) -# define PY_FORMAT_LONG_LONG "I64" -# else -# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG" -# endif -# endif -#endif - -/* Py_LOCAL can be used instead of static to get the fastest possible calling - * convention for functions that are local to a given module. - * - * Py_LOCAL_INLINE does the same thing, and also explicitly requests inlining, - * for platforms that support that. - * - * If PY_LOCAL_AGGRESSIVE is defined before python.h is included, more - * "aggressive" inlining/optimizaion is enabled for the entire module. This - * may lead to code bloat, and may slow things down for those reasons. It may - * also lead to errors, if the code relies on pointer aliasing. Use with - * care. - * - * NOTE: You can only use this for functions that are entirely local to a - * module; functions that are exported via method tables, callbacks, etc, - * should keep using static. - */ - -#undef USE_INLINE /* XXX - set via configure? */ - -#if defined(_MSC_VER) -#if defined(PY_LOCAL_AGGRESSIVE) -/* enable more aggressive optimization for visual studio */ -//#pragma optimize("agtw", on) -#pragma optimize("gt", on) // a and w are not legal for VS2005 -#endif -/* ignore warnings if the compiler decides not to inline a function */ -#pragma warning(disable: 4710) -/* fastest possible local call under MSVC */ -#define Py_LOCAL(type) static type __fastcall -#define Py_LOCAL_INLINE(type) static __inline type __fastcall -#elif defined(USE_INLINE) -#define Py_LOCAL(type) static type -#define Py_LOCAL_INLINE(type) static inline type -#else -#define Py_LOCAL(type) static type -#define Py_LOCAL_INLINE(type) static type -#endif - -/* Py_MEMCPY can be used instead of memcpy in cases where the copied blocks - * are often very short. While most platforms have highly optimized code for - * large transfers, the setup costs for memcpy are often quite high. MEMCPY - * solves this by doing short copies "in line". - */ - -#if defined(_MSC_VER) -#define Py_MEMCPY(target, source, length) do { \ - size_t i_, n_ = (length); \ - char *t_ = (void*) (target); \ - const char *s_ = (void*) (source); \ - if (n_ >= 16) \ - memcpy(t_, s_, n_); \ - else \ - for (i_ = 0; i_ < n_; i_++) \ - t_[i_] = s_[i_]; \ - } while (0) -#else -#define Py_MEMCPY memcpy -#endif - -#include - -#ifdef HAVE_IEEEFP_H -#include /* needed for 'finite' declaration on some platforms */ -#endif - -#include /* Moved here from the math section, before extern "C" */ - -/******************************************** - * WRAPPER FOR and/or * - ********************************************/ - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else /* !TIME_WITH_SYS_TIME */ -#ifdef HAVE_SYS_TIME_H -#include -#else /* !HAVE_SYS_TIME_H */ -#include -#endif /* !HAVE_SYS_TIME_H */ -#endif /* !TIME_WITH_SYS_TIME */ - - -/****************************** - * WRAPPER FOR * - ******************************/ - -/* NB caller must include */ - -#ifdef HAVE_SYS_SELECT_H - -#include - -#endif /* !HAVE_SYS_SELECT_H */ - -/******************************* - * stat() and fstat() fiddling * - *******************************/ - -/* We expect that stat and fstat exist on most systems. - * It's confirmed on Unix, Mac and Windows. - * If you don't have them, add - * #define DONT_HAVE_STAT - * and/or - * #define DONT_HAVE_FSTAT - * to your pyconfig.h. Python code beyond this should check HAVE_STAT and - * HAVE_FSTAT instead. - * Also - * #define HAVE_SYS_STAT_H - * if exists on your platform, and - * #define HAVE_STAT_H - * if does. - */ -#ifndef DONT_HAVE_STAT -#define HAVE_STAT -#endif - -#ifndef DONT_HAVE_FSTAT -#define HAVE_FSTAT -#endif - -#ifdef RISCOS -#include -#include "unixstuff.h" -#endif - -#ifdef HAVE_SYS_STAT_H -#if defined(PYOS_OS2) && defined(PYCC_GCC) -#include -#endif -#include -#elif defined(HAVE_STAT_H) -#include -#endif - -#if defined(PYCC_VACPP) -/* VisualAge C/C++ Failed to Define MountType Field in sys/stat.h */ -#define S_IFMT (S_IFDIR|S_IFCHR|S_IFREG) -#endif - -#ifndef S_ISREG -#define S_ISREG(x) (((x) & S_IFMT) == S_IFREG) -#endif - -#ifndef S_ISDIR -#define S_ISDIR(x) (((x) & S_IFMT) == S_IFDIR) -#endif - - -#ifdef __cplusplus -/* Move this down here since some C++ #include's don't like to be included - inside an extern "C" */ -extern "C" { -#endif - - -/* Py_ARITHMETIC_RIGHT_SHIFT - * C doesn't define whether a right-shift of a signed integer sign-extends - * or zero-fills. Here a macro to force sign extension: - * Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) - * Return I >> J, forcing sign extension. Arithmetically, return the - * floor of I/2**J. - * Requirements: - * I should have signed integer type. In the terminology of C99, this can - * be either one of the five standard signed integer types (signed char, - * short, int, long, long long) or an extended signed integer type. - * J is an integer >= 0 and strictly less than the number of bits in the - * type of I (because C doesn't define what happens for J outside that - * range either). - * TYPE used to specify the type of I, but is now ignored. It's been left - * in for backwards compatibility with versions <= 2.6 or 3.0. - * Caution: - * I may be evaluated more than once. - */ -#ifdef SIGNED_RIGHT_SHIFT_ZERO_FILLS -#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) \ - ((I) < 0 ? -1-((-1-(I)) >> (J)) : (I) >> (J)) -#else -#define Py_ARITHMETIC_RIGHT_SHIFT(TYPE, I, J) ((I) >> (J)) -#endif - -/* Py_FORCE_EXPANSION(X) - * "Simply" returns its argument. However, macro expansions within the - * argument are evaluated. This unfortunate trickery is needed to get - * token-pasting to work as desired in some cases. - */ -#define Py_FORCE_EXPANSION(X) X - -/* Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) - * Cast VALUE to type NARROW from type WIDE. In Py_DEBUG mode, this - * assert-fails if any information is lost. - * Caution: - * VALUE may be evaluated more than once. - */ -#ifdef Py_DEBUG -#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) \ - (assert((WIDE)(NARROW)(VALUE) == (VALUE)), (NARROW)(VALUE)) -#else -#define Py_SAFE_DOWNCAST(VALUE, WIDE, NARROW) (NARROW)(VALUE) -#endif - -/* Py_SET_ERRNO_ON_MATH_ERROR(x) - * If a libm function did not set errno, but it looks like the result - * overflowed or not-a-number, set errno to ERANGE or EDOM. Set errno - * to 0 before calling a libm function, and invoke this macro after, - * passing the function result. - * Caution: - * This isn't reliable. See Py_OVERFLOWED comments. - * X is evaluated more than once. - */ -#if defined(__FreeBSD__) || defined(__OpenBSD__) || (defined(__hpux) && defined(__ia64)) -#define _Py_SET_EDOM_FOR_NAN(X) if (isnan(X)) errno = EDOM; -#else -#define _Py_SET_EDOM_FOR_NAN(X) ; -#endif -#define Py_SET_ERRNO_ON_MATH_ERROR(X) \ - do { \ - if (errno == 0) { \ - if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ - errno = ERANGE; \ - else _Py_SET_EDOM_FOR_NAN(X) \ - } \ - } while(0) - -/* Py_SET_ERANGE_ON_OVERFLOW(x) - * An alias of Py_SET_ERRNO_ON_MATH_ERROR for backward-compatibility. - */ -#define Py_SET_ERANGE_IF_OVERFLOW(X) Py_SET_ERRNO_ON_MATH_ERROR(X) - -/* Py_ADJUST_ERANGE1(x) - * Py_ADJUST_ERANGE2(x, y) - * Set errno to 0 before calling a libm function, and invoke one of these - * macros after, passing the function result(s) (Py_ADJUST_ERANGE2 is useful - * for functions returning complex results). This makes two kinds of - * adjustments to errno: (A) If it looks like the platform libm set - * errno=ERANGE due to underflow, clear errno. (B) If it looks like the - * platform libm overflowed but didn't set errno, force errno to ERANGE. In - * effect, we're trying to force a useful implementation of C89 errno - * behavior. - * Caution: - * This isn't reliable. See Py_OVERFLOWED comments. - * X and Y may be evaluated more than once. - */ -#define Py_ADJUST_ERANGE1(X) \ - do { \ - if (errno == 0) { \ - if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL) \ - errno = ERANGE; \ - } \ - else if (errno == ERANGE && (X) == 0.0) \ - errno = 0; \ - } while(0) - -#define Py_ADJUST_ERANGE2(X, Y) \ - do { \ - if ((X) == Py_HUGE_VAL || (X) == -Py_HUGE_VAL || \ - (Y) == Py_HUGE_VAL || (Y) == -Py_HUGE_VAL) { \ - if (errno == 0) \ - errno = ERANGE; \ - } \ - else if (errno == ERANGE) \ - errno = 0; \ - } while(0) - -/* The functions _Py_dg_strtod and _Py_dg_dtoa in Python/dtoa.c (which are - * required to support the short float repr introduced in Python 3.1) require - * that the floating-point unit that's being used for arithmetic operations - * on C doubles is set to use 53-bit precision. It also requires that the - * FPU rounding mode is round-half-to-even, but that's less often an issue. - * - * If your FPU isn't already set to 53-bit precision/round-half-to-even, and - * you want to make use of _Py_dg_strtod and _Py_dg_dtoa, then you should - * - * #define HAVE_PY_SET_53BIT_PRECISION 1 - * - * and also give appropriate definitions for the following three macros: - * - * _PY_SET_53BIT_PRECISION_START : store original FPU settings, and - * set FPU to 53-bit precision/round-half-to-even - * _PY_SET_53BIT_PRECISION_END : restore original FPU settings - * _PY_SET_53BIT_PRECISION_HEADER : any variable declarations needed to - * use the two macros above. - * - * The macros are designed to be used within a single C function: see - * Python/pystrtod.c for an example of their use. - */ - -/* get and set x87 control word for gcc/x86 */ -#ifdef HAVE_GCC_ASM_FOR_X87 -#define HAVE_PY_SET_53BIT_PRECISION 1 -/* _Py_get/set_387controlword functions are defined in Python/pymath.c */ -#define _Py_SET_53BIT_PRECISION_HEADER \ - unsigned short old_387controlword, new_387controlword -#define _Py_SET_53BIT_PRECISION_START \ - do { \ - old_387controlword = _Py_get_387controlword(); \ - new_387controlword = (old_387controlword & ~0x0f00) | 0x0200; \ - if (new_387controlword != old_387controlword) \ - _Py_set_387controlword(new_387controlword); \ - } while (0) -#define _Py_SET_53BIT_PRECISION_END \ - if (new_387controlword != old_387controlword) \ - _Py_set_387controlword(old_387controlword) -#endif - -/* get and set x87 control word for VisualStudio/x86 */ -#if defined(_MSC_VER) && !defined(_WIN64) && !defined(UEFI_C_SOURCE) /* x87 not supported in 64-bit */ -#define HAVE_PY_SET_53BIT_PRECISION 1 -#define _Py_SET_53BIT_PRECISION_HEADER \ - unsigned int old_387controlword, new_387controlword, out_387controlword -/* We use the __control87_2 function to set only the x87 control word. - The SSE control word is unaffected. */ -#define _Py_SET_53BIT_PRECISION_START \ - do { \ - __control87_2(0, 0, &old_387controlword, NULL); \ - new_387controlword = \ - (old_387controlword & ~(_MCW_PC | _MCW_RC)) | (_PC_53 | _RC_NEAR); \ - if (new_387controlword != old_387controlword) \ - __control87_2(new_387controlword, _MCW_PC | _MCW_RC, \ - &out_387controlword, NULL); \ - } while (0) -#define _Py_SET_53BIT_PRECISION_END \ - do { \ - if (new_387controlword != old_387controlword) \ - __control87_2(old_387controlword, _MCW_PC | _MCW_RC, \ - &out_387controlword, NULL); \ - } while (0) -#endif - -/* default definitions are empty */ -#ifndef HAVE_PY_SET_53BIT_PRECISION -#define _Py_SET_53BIT_PRECISION_HEADER -#define _Py_SET_53BIT_PRECISION_START -#define _Py_SET_53BIT_PRECISION_END -#endif - -/* If we can't guarantee 53-bit precision, don't use the code - in Python/dtoa.c, but fall back to standard code. This - means that repr of a float will be long (17 sig digits). - - Realistically, there are two things that could go wrong: - - (1) doubles aren't IEEE 754 doubles, or - (2) we're on x86 with the rounding precision set to 64-bits - (extended precision), and we don't know how to change - the rounding precision. - */ - -#if !defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) && \ - !defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) && \ - !defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) -#define PY_NO_SHORT_FLOAT_REPR -#endif - -/* double rounding is symptomatic of use of extended precision on x86. If - we're seeing double rounding, and we don't have any mechanism available for - changing the FPU rounding precision, then don't use Python/dtoa.c. */ -#if defined(X87_DOUBLE_ROUNDING) && !defined(HAVE_PY_SET_53BIT_PRECISION) -#define PY_NO_SHORT_FLOAT_REPR -#endif - -/* Py_DEPRECATED(version) - * Declare a variable, type, or function deprecated. - * Usage: - * extern int old_var Py_DEPRECATED(2.3); - * typedef int T1 Py_DEPRECATED(2.4); - * extern int x() Py_DEPRECATED(2.5); - */ -#if defined(__GNUC__) && ((__GNUC__ >= 4) || \ - (__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)) -#define Py_DEPRECATED(VERSION_UNUSED) __attribute__((__deprecated__)) -#else -#define Py_DEPRECATED(VERSION_UNUSED) -#endif - -/************************************************************************** -Prototypes that are missing from the standard include files on some systems -(and possibly only some versions of such systems.) - -Please be conservative with adding new ones, document them and enclose them -in platform-specific #ifdefs. -**************************************************************************/ - -#ifdef SOLARIS -/* Unchecked */ -extern int gethostname(char *, int); -#endif - -#ifdef __BEOS__ -/* Unchecked */ -/* It's in the libs, but not the headers... - [cjh] */ -int shutdown( int, int ); -#endif - -#ifdef HAVE__GETPTY -#include /* we need to import mode_t */ -extern char * _getpty(int *, int, mode_t, int); -#endif - -/* On QNX 6, struct termio must be declared by including sys/termio.h - if TCGETA, TCSETA, TCSETAW, or TCSETAF are used. sys/termio.h must - be included before termios.h or it will generate an error. */ -#if defined(HAVE_SYS_TERMIO_H) && !defined(__hpux) -#include -#endif - -#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) -#if !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) && !defined(HAVE_UTIL_H) -/* BSDI does not supply a prototype for the 'openpty' and 'forkpty' - functions, even though they are included in libutil. */ -#include -extern int openpty(int *, int *, char *, struct termios *, struct winsize *); -extern pid_t forkpty(int *, char *, struct termios *, struct winsize *); -#endif /* !defined(HAVE_PTY_H) && !defined(HAVE_LIBUTIL_H) */ -#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) */ - - -/* These are pulled from various places. It isn't obvious on what platforms - they are necessary, nor what the exact prototype should look like (which - is likely to vary between platforms!) If you find you need one of these - declarations, please move them to a platform-specific block and include - proper prototypes. */ -#if 0 - -/* From Modules/resource.c */ -extern int getrusage(); -extern int getpagesize(); - -/* From Python/sysmodule.c and Modules/posixmodule.c */ -extern int fclose(FILE *); - -/* From Modules/posixmodule.c */ -extern int fdatasync(int); -#endif /* 0 */ - - -/* On 4.4BSD-descendants, ctype functions serves the whole range of - * wchar_t character set rather than single byte code points only. - * This characteristic can break some operations of string object - * including str.upper() and str.split() on UTF-8 locales. This - * workaround was provided by Tim Robbins of FreeBSD project. - */ - -#ifdef __FreeBSD__ -#include -#if __FreeBSD_version > 500039 -# define _PY_PORT_CTYPE_UTF8_ISSUE -#endif -#endif - - -#if defined(__APPLE__) -# define _PY_PORT_CTYPE_UTF8_ISSUE -#endif - -#ifdef _PY_PORT_CTYPE_UTF8_ISSUE -#include -#include -#undef isalnum -#define isalnum(c) iswalnum(btowc(c)) -#undef isalpha -#define isalpha(c) iswalpha(btowc(c)) -#undef islower -#define islower(c) iswlower(btowc(c)) -#undef isspace -#define isspace(c) iswspace(btowc(c)) -#undef isupper -#define isupper(c) iswupper(btowc(c)) -#undef tolower -#define tolower(c) towlower(btowc(c)) -#undef toupper -#define toupper(c) towupper(btowc(c)) -#endif - - -/* Declarations for symbol visibility. - - PyAPI_FUNC(type): Declares a public Python API function and return type - PyAPI_DATA(type): Declares public Python data and its type - PyMODINIT_FUNC: A Python module init function. If these functions are - inside the Python core, they are private to the core. - If in an extension module, it may be declared with - external linkage depending on the platform. - - As a number of platforms support/require "__declspec(dllimport/dllexport)", - we support a HAVE_DECLSPEC_DLL macro to save duplication. -*/ - -/* - All windows ports, except cygwin, are handled in PC/pyconfig.h. - - BeOS and cygwin are the only other autoconf platform requiring special - linkage handling and both of these use __declspec(). -*/ -#if defined(__CYGWIN__) || defined(__BEOS__) -# define HAVE_DECLSPEC_DLL -#endif - -/* only get special linkage if built as shared or platform is Cygwin */ -#if defined(Py_ENABLE_SHARED) || defined(__CYGWIN__) -# if defined(HAVE_DECLSPEC_DLL) -# ifdef Py_BUILD_CORE -# define PyAPI_FUNC(RTYPE) __declspec(dllexport) RTYPE -# define PyAPI_DATA(RTYPE) extern __declspec(dllexport) RTYPE - /* module init functions inside the core need no external linkage */ - /* except for Cygwin to handle embedding (FIXME: BeOS too?) */ -# if defined(__CYGWIN__) -# define PyMODINIT_FUNC __declspec(dllexport) void -# else /* __CYGWIN__ */ -# define PyMODINIT_FUNC void -# endif /* __CYGWIN__ */ -# else /* Py_BUILD_CORE */ - /* Building an extension module, or an embedded situation */ - /* public Python functions and data are imported */ - /* Under Cygwin, auto-import functions to prevent compilation */ - /* failures similar to those described at the bottom of 4.1: */ - /* http://docs.python.org/extending/windows.html#a-cookbook-approach */ -# if !defined(__CYGWIN__) -# define PyAPI_FUNC(RTYPE) __declspec(dllimport) RTYPE -# endif /* !__CYGWIN__ */ -# define PyAPI_DATA(RTYPE) extern __declspec(dllimport) RTYPE - /* module init functions outside the core must be exported */ -# if defined(__cplusplus) -# define PyMODINIT_FUNC extern "C" __declspec(dllexport) void -# else /* __cplusplus */ -# define PyMODINIT_FUNC __declspec(dllexport) void -# endif /* __cplusplus */ -# endif /* Py_BUILD_CORE */ -# endif /* HAVE_DECLSPEC */ -#endif /* Py_ENABLE_SHARED */ - -/* If no external linkage macros defined by now, create defaults */ -#ifndef PyAPI_FUNC -# define PyAPI_FUNC(RTYPE) RTYPE -#endif -#ifndef PyAPI_DATA -# define PyAPI_DATA(RTYPE) extern RTYPE -#endif -#ifndef PyMODINIT_FUNC -# if defined(__cplusplus) -# define PyMODINIT_FUNC extern "C" void -# else /* __cplusplus */ -# define PyMODINIT_FUNC void -# endif /* __cplusplus */ -#endif - -/* Deprecated DL_IMPORT and DL_EXPORT macros */ -#if defined(Py_ENABLE_SHARED) && defined (HAVE_DECLSPEC_DLL) -# if defined(Py_BUILD_CORE) -# define DL_IMPORT(RTYPE) __declspec(dllexport) RTYPE -# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -# else -# define DL_IMPORT(RTYPE) __declspec(dllimport) RTYPE -# define DL_EXPORT(RTYPE) __declspec(dllexport) RTYPE -# endif -#endif -#ifndef DL_EXPORT -# define DL_EXPORT(RTYPE) RTYPE -#endif -#ifndef DL_IMPORT -# define DL_IMPORT(RTYPE) RTYPE -#endif -/* End of deprecated DL_* macros */ - -/* If the fd manipulation macros aren't defined, - here is a set that should do the job */ - -#if 0 /* disabled and probably obsolete */ - -#ifndef FD_SETSIZE -#define FD_SETSIZE 256 -#endif - -#ifndef FD_SET - -typedef long fd_mask; - -#define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ -#ifndef howmany -#define howmany(x, y) (((x)+((y)-1))/(y)) -#endif /* howmany */ - -typedef struct fd_set { - fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; -} fd_set; - -#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) -#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) -#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) -#define FD_ZERO(p) memset((char *)(p), '\0', sizeof(*(p))) - -#endif /* FD_SET */ - -#endif /* fd manipulation macros */ - - -/* limits.h constants that may be missing */ - -#ifndef INT_MAX -#define INT_MAX 2147483647 -#endif - -#ifndef LONG_MAX -#if SIZEOF_LONG == 4 -#define LONG_MAX 0X7FFFFFFFL -#elif SIZEOF_LONG == 8 -#define LONG_MAX 0X7FFFFFFFFFFFFFFFL -#else -#error "could not set LONG_MAX in pyport.h" -#endif -#endif - -#ifndef LONG_MIN -#define LONG_MIN (-LONG_MAX-1) -#endif - -#ifndef LONG_BIT -#define LONG_BIT (8 * SIZEOF_LONG) -#endif - -#if LONG_BIT != 8 * SIZEOF_LONG -/* 04-Oct-2000 LONG_BIT is apparently (mis)defined as 64 on some recent - * 32-bit platforms using gcc. We try to catch that here at compile-time - * rather than waiting for integer multiplication to trigger bogus - * overflows. - */ -#error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)." -#endif - -#ifdef __cplusplus -} -#endif - -/* - * Hide GCC attributes from compilers that don't support them. - */ -#if (!defined(__GNUC__) || __GNUC__ < 2 || \ - (__GNUC__ == 2 && __GNUC_MINOR__ < 7) ) && \ - !defined(RISCOS) -#define Py_GCC_ATTRIBUTE(x) -#else -#define Py_GCC_ATTRIBUTE(x) __attribute__(x) -#endif - -/* - * Add PyArg_ParseTuple format where available. - */ -#ifdef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE -#define Py_FORMAT_PARSETUPLE(func,p1,p2) __attribute__((format(func,p1,p2))) -#else -#define Py_FORMAT_PARSETUPLE(func,p1,p2) -#endif - -/* - * Specify alignment on compilers that support it. - */ -#if defined(__GNUC__) && __GNUC__ >= 3 -#define Py_ALIGNED(x) __attribute__((aligned(x))) -#else -#define Py_ALIGNED(x) -#endif - -/* Eliminate end-of-loop code not reached warnings from SunPro C - * when using do{...}while(0) macros - */ -#ifdef __SUNPRO_C -#pragma error_messages (off,E_END_OF_LOOP_CODE_NOT_REACHED) -#endif - -/* - * Older Microsoft compilers don't support the C99 long long literal suffixes, - * so these will be defined in PC/pyconfig.h for those compilers. - */ -#ifndef Py_LL -#define Py_LL(x) x##LL -#endif - -#ifndef Py_ULL -#define Py_ULL(x) Py_LL(x##U) -#endif - -#endif /* Py_PYPORT_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py deleted file mode 100644 index ab10a28..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/ntpath.py +++ /dev/null @@ -1,568 +0,0 @@ - -# Module 'ntpath' -- common operations on WinNT/Win95 and UEFI pathnames. -# -# Copyright (c) 2015, Daryl McDaniel. All rights reserved.
-# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
-# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License that accompanies this distribution. -# The full text of the license may be found at -# http://opensource.org/licenses/bsd-license. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - -"""Common pathname manipulations, WindowsNT/95 and UEFI version. - -Instead of importing this module directly, import os and refer to this -module as os.path. -""" - -import os -import sys -import stat -import genericpath -import warnings - -from genericpath import * -from genericpath import _unicode - -__all__ = ["normcase","isabs","join","splitdrive","split","splitext", - "basename","dirname","commonprefix","getsize","getmtime", - "getatime","getctime", "islink","exists","lexists","isdir","isfile", - "ismount","walk","expanduser","expandvars","normpath","abspath", - "splitunc","curdir","pardir","sep","pathsep","defpath","altsep", - "extsep","devnull","realpath","supports_unicode_filenames","relpath"] - -# strings representing various path-related bits and pieces -curdir = '.' -pardir = '..' -extsep = '.' -sep = '\\' -pathsep = ';' -altsep = '/' -defpath = '.;C:\\bin' -if 'ce' in sys.builtin_module_names: - defpath = '\\Windows' -elif 'os2' in sys.builtin_module_names: - # OS/2 w/ VACPP - altsep = '/' -devnull = 'nul' - -# Normalize the case of a pathname and map slashes to backslashes. -# Other normalizations (such as optimizing '../' away) are not done -# (this is done by normpath). - -def normcase(s): - """Normalize case of pathname. - - Makes all characters lowercase and all slashes into backslashes.""" - return s.replace("/", "\\").lower() - - -# Return whether a path is absolute. -# Trivial in Posix, harder on the Mac or MS-DOS. -# For DOS it is absolute if it starts with a slash or backslash (current -# volume), or if a pathname after the volume letter and colon / UNC resource -# starts with a slash or backslash. - -def isabs(s): - """Test whether a path is absolute""" - s = splitdrive(s)[1] - return s != '' and s[:1] in '/\\' - - -# Join two (or more) paths. -def join(path, *paths): - """Join two or more pathname components, inserting "\\" as needed.""" - result_drive, result_path = splitdrive(path) - for p in paths: - p_drive, p_path = splitdrive(p) - if p_path and p_path[0] in '\\/': - # Second path is absolute - if p_drive or not result_drive: - result_drive = p_drive - result_path = p_path - continue - elif p_drive and p_drive != result_drive: - if p_drive.lower() != result_drive.lower(): - # Different drives => ignore the first path entirely - result_drive = p_drive - result_path = p_path - continue - # Same drive in different case - result_drive = p_drive - # Second path is relative to the first - if result_path and result_path[-1] not in '\\/': - result_path = result_path + '\\' - result_path = result_path + p_path - ## add separator between UNC and non-absolute path - if (result_path and result_path[0] not in '\\/' and - result_drive and result_drive[-1:] != ':'): - return result_drive + sep + result_path - return result_drive + result_path - - -# Split a path in a drive specification (a drive letter followed by a -# colon) and the path specification. -# It is always true that drivespec + pathspec == p -# NOTE: for UEFI (and even Windows) you can have multiple characters to the left -# of the ':' for the device or drive spec. This is reflected in the modifications -# to splitdrive() and splitunc(). -def splitdrive(p): - """Split a pathname into drive/UNC sharepoint and relative path specifiers. - Returns a 2-tuple (drive_or_unc, path); either part may be empty. - - If you assign - result = splitdrive(p) - It is always true that: - result[0] + result[1] == p - - If the path contained a drive letter, drive_or_unc will contain everything - up to and including the colon. e.g. splitdrive("c:/dir") returns ("c:", "/dir") - - If the path contained a UNC path, the drive_or_unc will contain the host name - and share up to but not including the fourth directory separator character. - e.g. splitdrive("//host/computer/dir") returns ("//host/computer", "/dir") - - Paths cannot contain both a drive letter and a UNC path. - - """ - if len(p) > 1: - normp = p.replace(altsep, sep) - if (normp[0:2] == sep*2) and (normp[2:3] != sep): - # is a UNC path: - # vvvvvvvvvvvvvvvvvvvv drive letter or UNC path - # \\machine\mountpoint\directory\etc\... - # directory ^^^^^^^^^^^^^^^ - index = normp.find(sep, 2) - if index == -1: - return '', p - index2 = normp.find(sep, index + 1) - # a UNC path can't have two slashes in a row - # (after the initial two) - if index2 == index + 1: - return '', p - if index2 == -1: - index2 = len(p) - return p[:index2], p[index2:] - index = p.find(':') - if index != -1: - index = index + 1 - return p[:index], p[index:] - return '', p - -# Parse UNC paths -def splitunc(p): - """Split a pathname into UNC mount point and relative path specifiers. - - Return a 2-tuple (unc, rest); either part may be empty. - If unc is not empty, it has the form '//host/mount' (or similar - using backslashes). unc+rest is always the input path. - Paths containing drive letters never have an UNC part. - """ - if ':' in p: - return '', p # Drive letter or device name present - firstTwo = p[0:2] - if firstTwo == '//' or firstTwo == '\\\\': - # is a UNC path: - # vvvvvvvvvvvvvvvvvvvv equivalent to drive letter - # \\machine\mountpoint\directories... - # directory ^^^^^^^^^^^^^^^ - normp = p.replace('\\', '/') - index = normp.find('/', 2) - if index <= 2: - return '', p - index2 = normp.find('/', index + 1) - # a UNC path can't have two slashes in a row - # (after the initial two) - if index2 == index + 1: - return '', p - if index2 == -1: - index2 = len(p) - return p[:index2], p[index2:] - return '', p - - -# Split a path in head (everything up to the last '/') and tail (the -# rest). After the trailing '/' is stripped, the invariant -# join(head, tail) == p holds. -# The resulting head won't end in '/' unless it is the root. - -def split(p): - """Split a pathname. - - Return tuple (head, tail) where tail is everything after the final slash. - Either part may be empty.""" - - d, p = splitdrive(p) - # set i to index beyond p's last slash - i = len(p) - while i and p[i-1] not in '/\\': - i = i - 1 - head, tail = p[:i], p[i:] # now tail has no slashes - # remove trailing slashes from head, unless it's all slashes - head2 = head - while head2 and head2[-1] in '/\\': - head2 = head2[:-1] - head = head2 or head - return d + head, tail - - -# Split a path in root and extension. -# The extension is everything starting at the last dot in the last -# pathname component; the root is everything before that. -# It is always true that root + ext == p. - -def splitext(p): - return genericpath._splitext(p, sep, altsep, extsep) -splitext.__doc__ = genericpath._splitext.__doc__ - - -# Return the tail (basename) part of a path. - -def basename(p): - """Returns the final component of a pathname""" - return split(p)[1] - - -# Return the head (dirname) part of a path. - -def dirname(p): - """Returns the directory component of a pathname""" - return split(p)[0] - -# Is a path a symbolic link? -# This will always return false on systems where posix.lstat doesn't exist. - -def islink(path): - """Test for symbolic link. - On WindowsNT/95 and OS/2 always returns false - """ - return False - -# alias exists to lexists -lexists = exists - -# Is a path a mount point? Either a root (with or without drive letter) -# or an UNC path with at most a / or \ after the mount point. - -def ismount(path): - """Test whether a path is a mount point (defined as root of drive)""" - unc, rest = splitunc(path) - if unc: - return rest in ("", "/", "\\") - p = splitdrive(path)[1] - return len(p) == 1 and p[0] in '/\\' - - -# Directory tree walk. -# For each directory under top (including top itself, but excluding -# '.' and '..'), func(arg, dirname, filenames) is called, where -# dirname is the name of the directory and filenames is the list -# of files (and subdirectories etc.) in the directory. -# The func may modify the filenames list, to implement a filter, -# or to impose a different order of visiting. - -def walk(top, func, arg): - """Directory tree walk with callback function. - - For each directory in the directory tree rooted at top (including top - itself, but excluding '.' and '..'), call func(arg, dirname, fnames). - dirname is the name of the directory, and fnames a list of the names of - the files and subdirectories in dirname (excluding '.' and '..'). func - may modify the fnames list in-place (e.g. via del or slice assignment), - and walk will only recurse into the subdirectories whose names remain in - fnames; this can be used to implement a filter, or to impose a specific - order of visiting. No semantics are defined for, or required of, arg, - beyond that arg is always passed to func. It can be used, e.g., to pass - a filename pattern, or a mutable object designed to accumulate - statistics. Passing None for arg is common.""" - warnings.warnpy3k("In 3.x, os.path.walk is removed in favor of os.walk.", - stacklevel=2) - try: - names = os.listdir(top) - except os.error: - return - func(arg, top, names) - for name in names: - name = join(top, name) - if isdir(name): - walk(name, func, arg) - - -# Expand paths beginning with '~' or '~user'. -# '~' means $HOME; '~user' means that user's home directory. -# If the path doesn't begin with '~', or if the user or $HOME is unknown, -# the path is returned unchanged (leaving error reporting to whatever -# function is called with the expanded path as argument). -# See also module 'glob' for expansion of *, ? and [...] in pathnames. -# (A function should also be defined to do full *sh-style environment -# variable expansion.) - -def expanduser(path): - """Expand ~ and ~user constructs. - - If user or $HOME is unknown, do nothing.""" - if path[:1] != '~': - return path - i, n = 1, len(path) - while i < n and path[i] not in '/\\': - i = i + 1 - - if 'HOME' in os.environ: - userhome = os.environ['HOME'] - elif 'USERPROFILE' in os.environ: - userhome = os.environ['USERPROFILE'] - elif not 'HOMEPATH' in os.environ: - return path - else: - try: - drive = os.environ['HOMEDRIVE'] - except KeyError: - drive = '' - userhome = join(drive, os.environ['HOMEPATH']) - - if i != 1: #~user - userhome = join(dirname(userhome), path[1:i]) - - return userhome + path[i:] - - -# Expand paths containing shell variable substitutions. -# The following rules apply: -# - no expansion within single quotes -# - '$$' is translated into '$' -# - '%%' is translated into '%' if '%%' are not seen in %var1%%var2% -# - ${varname} is accepted. -# - $varname is accepted. -# - %varname% is accepted. -# - varnames can be made out of letters, digits and the characters '_-' -# (though is not verified in the ${varname} and %varname% cases) -# XXX With COMMAND.COM you can use any characters in a variable name, -# XXX except '^|<>='. - -def expandvars(path): - """Expand shell variables of the forms $var, ${var} and %var%. - - Unknown variables are left unchanged.""" - if '$' not in path and '%' not in path: - return path - import string - varchars = string.ascii_letters + string.digits + '_-' - if isinstance(path, _unicode): - encoding = sys.getfilesystemencoding() - def getenv(var): - return os.environ[var.encode(encoding)].decode(encoding) - else: - def getenv(var): - return os.environ[var] - res = '' - index = 0 - pathlen = len(path) - while index < pathlen: - c = path[index] - if c == '\'': # no expansion within single quotes - path = path[index + 1:] - pathlen = len(path) - try: - index = path.index('\'') - res = res + '\'' + path[:index + 1] - except ValueError: - res = res + c + path - index = pathlen - 1 - elif c == '%': # variable or '%' - if path[index + 1:index + 2] == '%': - res = res + c - index = index + 1 - else: - path = path[index+1:] - pathlen = len(path) - try: - index = path.index('%') - except ValueError: - res = res + '%' + path - index = pathlen - 1 - else: - var = path[:index] - try: - res = res + getenv(var) - except KeyError: - res = res + '%' + var + '%' - elif c == '$': # variable or '$$' - if path[index + 1:index + 2] == '$': - res = res + c - index = index + 1 - elif path[index + 1:index + 2] == '{': - path = path[index+2:] - pathlen = len(path) - try: - index = path.index('}') - var = path[:index] - try: - res = res + getenv(var) - except KeyError: - res = res + '${' + var + '}' - except ValueError: - res = res + '${' + path - index = pathlen - 1 - else: - var = '' - index = index + 1 - c = path[index:index + 1] - while c != '' and c in varchars: - var = var + c - index = index + 1 - c = path[index:index + 1] - try: - res = res + getenv(var) - except KeyError: - res = res + '$' + var - if c != '': - index = index - 1 - else: - res = res + c - index = index + 1 - return res - - -# Normalize a path, e.g. A//B, A/./B and A/foo/../B all become A\B. -# Previously, this function also truncated pathnames to 8+3 format, -# but as this module is called "ntpath", that's obviously wrong! - -def normpath(path): - """Normalize path, eliminating double slashes, etc.""" - # Preserve unicode (if path is unicode) - backslash, dot = (u'\\', u'.') if isinstance(path, _unicode) else ('\\', '.') - if path.startswith(('\\\\.\\', '\\\\?\\')): - # in the case of paths with these prefixes: - # \\.\ -> device names - # \\?\ -> literal paths - # do not do any normalization, but return the path unchanged - return path - path = path.replace("/", "\\") - prefix, path = splitdrive(path) - # We need to be careful here. If the prefix is empty, and the path starts - # with a backslash, it could either be an absolute path on the current - # drive (\dir1\dir2\file) or a UNC filename (\\server\mount\dir1\file). It - # is therefore imperative NOT to collapse multiple backslashes blindly in - # that case. - # The code below preserves multiple backslashes when there is no drive - # letter. This means that the invalid filename \\\a\b is preserved - # unchanged, where a\\\b is normalised to a\b. It's not clear that there - # is any better behaviour for such edge cases. - if prefix == '': - # No drive letter - preserve initial backslashes - while path[:1] == "\\": - prefix = prefix + backslash - path = path[1:] - else: - # We have a drive letter - collapse initial backslashes - if path.startswith("\\"): - prefix = prefix + backslash - path = path.lstrip("\\") - comps = path.split("\\") - i = 0 - while i < len(comps): - if comps[i] in ('.', ''): - del comps[i] - elif comps[i] == '..': - if i > 0 and comps[i-1] != '..': - del comps[i-1:i+1] - i -= 1 - elif i == 0 and prefix.endswith("\\"): - del comps[i] - else: - i += 1 - else: - i += 1 - # If the path is now empty, substitute '.' - if not prefix and not comps: - comps.append(dot) - return prefix + backslash.join(comps) - - -# Return an absolute path. -try: - from nt import _getfullpathname - -except ImportError: # not running on Windows - mock up something sensible - def abspath(path): - """Return the absolute version of a path.""" - if not isabs(path): - if isinstance(path, _unicode): - cwd = os.getcwdu() - else: - cwd = os.getcwd() - path = join(cwd, path) - return normpath(path) - -else: # use native Windows method on Windows - def abspath(path): - """Return the absolute version of a path.""" - - if path: # Empty path must return current working directory. - try: - path = _getfullpathname(path) - except WindowsError: - pass # Bad path - return unchanged. - elif isinstance(path, _unicode): - path = os.getcwdu() - else: - path = os.getcwd() - return normpath(path) - -# realpath is a no-op on systems without islink support -realpath = abspath -# Win9x family and earlier have no Unicode filename support. -supports_unicode_filenames = (hasattr(sys, "getwindowsversion") and - sys.getwindowsversion()[3] >= 2) - -def _abspath_split(path): - abs = abspath(normpath(path)) - prefix, rest = splitunc(abs) - is_unc = bool(prefix) - if not is_unc: - prefix, rest = splitdrive(abs) - return is_unc, prefix, [x for x in rest.split(sep) if x] - -def relpath(path, start=curdir): - """Return a relative version of a path""" - - if not path: - raise ValueError("no path specified") - - start_is_unc, start_prefix, start_list = _abspath_split(start) - path_is_unc, path_prefix, path_list = _abspath_split(path) - - if path_is_unc ^ start_is_unc: - raise ValueError("Cannot mix UNC and non-UNC paths (%s and %s)" - % (path, start)) - if path_prefix.lower() != start_prefix.lower(): - if path_is_unc: - raise ValueError("path is on UNC root %s, start on UNC root %s" - % (path_prefix, start_prefix)) - else: - raise ValueError("path is on drive %s, start on drive %s" - % (path_prefix, start_prefix)) - # Work out how much of the filepath is shared by start and path. - i = 0 - for e1, e2 in zip(start_list, path_list): - if e1.lower() != e2.lower(): - break - i += 1 - - rel_list = [pardir] * (len(start_list)-i) + path_list[i:] - if not rel_list: - return curdir - return join(*rel_list) - -try: - # The genericpath.isdir implementation uses os.stat and checks the mode - # attribute to tell whether or not the path is a directory. - # This is overkill on Windows - just pass the path to GetFileAttributes - # and check the attribute from there. - from nt import _isdir as isdir -except ImportError: - # Use genericpath.isdir as imported above. - pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/os.py b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/os.py deleted file mode 100644 index 1175518..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/os.py +++ /dev/null @@ -1,769 +0,0 @@ - -# Module 'os' -- OS routines for NT, Posix, or UEFI depending on what system we're on. -# -# Copyright (c) 2015, Daryl McDaniel. All rights reserved.
-# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
-# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License that accompanies this distribution. -# The full text of the license may be found at -# http://opensource.org/licenses/bsd-license. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -r"""OS routines for NT, Posix, or UEFI depending on what system we're on. - -This exports: - - all functions from edk2, posix, nt, os2, or ce, e.g. unlink, stat, etc. - - os.path is one of the modules uefipath, posixpath, or ntpath - - os.name is 'edk2', 'posix', 'nt', 'os2', 'ce' or 'riscos' - - os.curdir is a string representing the current directory ('.' or ':') - - os.pardir is a string representing the parent directory ('..' or '::') - - os.sep is the (or a most common) pathname separator ('/' or ':' or '\\') - - os.extsep is the extension separator ('.' or '/') - - os.altsep is the alternate pathname separator (None or '/') - - os.pathsep is the component separator used in $PATH etc - - os.linesep is the line separator in text files ('\r' or '\n' or '\r\n') - - os.defpath is the default search path for executables - - os.devnull is the file path of the null device ('/dev/null', etc.) - -Programs that import and use 'os' stand a better chance of being -portable between different platforms. Of course, they must then -only use functions that are defined by all platforms (e.g., unlink -and opendir), and leave all pathname manipulation to os.path -(e.g., split and join). -""" - -#' - -import sys, errno - -_names = sys.builtin_module_names - -# Note: more names are added to __all__ later. -__all__ = ["altsep", "curdir", "pardir", "sep", "extsep", "pathsep", "linesep", - "defpath", "name", "path", "devnull", - "SEEK_SET", "SEEK_CUR", "SEEK_END"] - -def _get_exports_list(module): - try: - return list(module.__all__) - except AttributeError: - return [n for n in dir(module) if n[0] != '_'] - -if 'posix' in _names: - name = 'posix' - linesep = '\n' - from posix import * - try: - from posix import _exit - except ImportError: - pass - import posixpath as path - - import posix - __all__.extend(_get_exports_list(posix)) - del posix - -elif 'nt' in _names: - name = 'nt' - linesep = '\r\n' - from nt import * - try: - from nt import _exit - except ImportError: - pass - import ntpath as path - - import nt - __all__.extend(_get_exports_list(nt)) - del nt - -elif 'os2' in _names: - name = 'os2' - linesep = '\r\n' - from os2 import * - try: - from os2 import _exit - except ImportError: - pass - if sys.version.find('EMX GCC') == -1: - import ntpath as path - else: - import os2emxpath as path - from _emx_link import link - - import os2 - __all__.extend(_get_exports_list(os2)) - del os2 - -elif 'ce' in _names: - name = 'ce' - linesep = '\r\n' - from ce import * - try: - from ce import _exit - except ImportError: - pass - # We can use the standard Windows path. - import ntpath as path - - import ce - __all__.extend(_get_exports_list(ce)) - del ce - -elif 'riscos' in _names: - name = 'riscos' - linesep = '\n' - from riscos import * - try: - from riscos import _exit - except ImportError: - pass - import riscospath as path - - import riscos - __all__.extend(_get_exports_list(riscos)) - del riscos - -elif 'edk2' in _names: - name = 'edk2' - linesep = '\n' - from edk2 import * - try: - from edk2 import _exit - except ImportError: - pass - import ntpath as path - - import edk2 - __all__.extend(_get_exports_list(edk2)) - del edk2 - -else: - raise ImportError, 'no os specific module found' - -sys.modules['os.path'] = path -from os.path import (curdir, pardir, sep, pathsep, defpath, extsep, altsep, - devnull) - -del _names - -# Python uses fixed values for the SEEK_ constants; they are mapped -# to native constants if necessary in posixmodule.c -SEEK_SET = 0 -SEEK_CUR = 1 -SEEK_END = 2 - -#' - -# Super directory utilities. -# (Inspired by Eric Raymond; the doc strings are mostly his) - -def makedirs(name, mode=0777): - """makedirs(path [, mode=0777]) - - Super-mkdir; create a leaf directory and all intermediate ones. - Works like mkdir, except that any intermediate path segment (not - just the rightmost) will be created if it does not exist. This is - recursive. - - """ - head, tail = path.split(name) - if not tail: - head, tail = path.split(head) - if head and tail and not path.exists(head): - try: - makedirs(head, mode) - except OSError, e: - # be happy if someone already created the path - if e.errno != errno.EEXIST: - raise - if tail == curdir: # xxx/newdir/. exists if xxx/newdir exists - return - mkdir(name, mode) - -def removedirs(name): - """removedirs(path) - - Super-rmdir; remove a leaf directory and all empty intermediate - ones. Works like rmdir except that, if the leaf directory is - successfully removed, directories corresponding to rightmost path - segments will be pruned away until either the whole path is - consumed or an error occurs. Errors during this latter phase are - ignored -- they generally mean that a directory was not empty. - - """ - rmdir(name) - head, tail = path.split(name) - if not tail: - head, tail = path.split(head) - while head and tail: - try: - rmdir(head) - except error: - break - head, tail = path.split(head) - -def renames(old, new): - """renames(old, new) - - Super-rename; create directories as necessary and delete any left - empty. Works like rename, except creation of any intermediate - directories needed to make the new pathname good is attempted - first. After the rename, directories corresponding to rightmost - path segments of the old name will be pruned until either the - whole path is consumed or a nonempty directory is found. - - Note: this function can fail with the new directory structure made - if you lack permissions needed to unlink the leaf directory or - file. - - """ - head, tail = path.split(new) - if head and tail and not path.exists(head): - makedirs(head) - rename(old, new) - head, tail = path.split(old) - if head and tail: - try: - removedirs(head) - except error: - pass - -__all__.extend(["makedirs", "removedirs", "renames"]) - -def walk(top, topdown=True, onerror=None, followlinks=False): - """Directory tree generator. - - For each directory in the directory tree rooted at top (including top - itself, but excluding '.' and '..'), yields a 3-tuple - - dirpath, dirnames, filenames - - dirpath is a string, the path to the directory. dirnames is a list of - the names of the subdirectories in dirpath (excluding '.' and '..'). - filenames is a list of the names of the non-directory files in dirpath. - Note that the names in the lists are just names, with no path components. - To get a full path (which begins with top) to a file or directory in - dirpath, do os.path.join(dirpath, name). - - If optional arg 'topdown' is true or not specified, the triple for a - directory is generated before the triples for any of its subdirectories - (directories are generated top down). If topdown is false, the triple - for a directory is generated after the triples for all of its - subdirectories (directories are generated bottom up). - - When topdown is true, the caller can modify the dirnames list in-place - (e.g., via del or slice assignment), and walk will only recurse into the - subdirectories whose names remain in dirnames; this can be used to prune the - search, or to impose a specific order of visiting. Modifying dirnames when - topdown is false is ineffective, since the directories in dirnames have - already been generated by the time dirnames itself is generated. No matter - the value of topdown, the list of subdirectories is retrieved before the - tuples for the directory and its subdirectories are generated. - - By default errors from the os.listdir() call are ignored. If - optional arg 'onerror' is specified, it should be a function; it - will be called with one argument, an os.error instance. It can - report the error to continue with the walk, or raise the exception - to abort the walk. Note that the filename is available as the - filename attribute of the exception object. - - By default, os.walk does not follow symbolic links to subdirectories on - systems that support them. In order to get this functionality, set the - optional argument 'followlinks' to true. - - Caution: if you pass a relative pathname for top, don't change the - current working directory between resumptions of walk. walk never - changes the current directory, and assumes that the client doesn't - either. - - Example: - - import os - from os.path import join, getsize - for root, dirs, files in os.walk('python/Lib/email'): - print root, "consumes", - print sum([getsize(join(root, name)) for name in files]), - print "bytes in", len(files), "non-directory files" - if 'CVS' in dirs: - dirs.remove('CVS') # don't visit CVS directories - - """ - - islink, join, isdir = path.islink, path.join, path.isdir - - # We may not have read permission for top, in which case we can't - # get a list of the files the directory contains. os.path.walk - # always suppressed the exception then, rather than blow up for a - # minor reason when (say) a thousand readable directories are still - # left to visit. That logic is copied here. - try: - # Note that listdir and error are globals in this module due - # to earlier import-*. - names = listdir(top) - except error, err: - if onerror is not None: - onerror(err) - return - - dirs, nondirs = [], [] - for name in names: - if isdir(join(top, name)): - dirs.append(name) - else: - nondirs.append(name) - - if topdown: - yield top, dirs, nondirs - for name in dirs: - new_path = join(top, name) - if followlinks or not islink(new_path): - for x in walk(new_path, topdown, onerror, followlinks): - yield x - if not topdown: - yield top, dirs, nondirs - -__all__.append("walk") - -# Make sure os.environ exists, at least -try: - environ -except NameError: - environ = {} - -def execl(file, *args): - """execl(file, *args) - - Execute the executable file with argument list args, replacing the - current process. """ - execv(file, args) - -def execle(file, *args): - """execle(file, *args, env) - - Execute the executable file with argument list args and - environment env, replacing the current process. """ - env = args[-1] - execve(file, args[:-1], env) - -def execlp(file, *args): - """execlp(file, *args) - - Execute the executable file (which is searched for along $PATH) - with argument list args, replacing the current process. """ - execvp(file, args) - -def execlpe(file, *args): - """execlpe(file, *args, env) - - Execute the executable file (which is searched for along $PATH) - with argument list args and environment env, replacing the current - process. """ - env = args[-1] - execvpe(file, args[:-1], env) - -def execvp(file, args): - """execvp(file, args) - - Execute the executable file (which is searched for along $PATH) - with argument list args, replacing the current process. - args may be a list or tuple of strings. """ - _execvpe(file, args) - -def execvpe(file, args, env): - """execvpe(file, args, env) - - Execute the executable file (which is searched for along $PATH) - with argument list args and environment env , replacing the - current process. - args may be a list or tuple of strings. """ - _execvpe(file, args, env) - -__all__.extend(["execl","execle","execlp","execlpe","execvp","execvpe"]) - -def _execvpe(file, args, env=None): - if env is not None: - func = execve - argrest = (args, env) - else: - func = execv - argrest = (args,) - env = environ - - head, tail = path.split(file) - if head: - func(file, *argrest) - return - if 'PATH' in env: - envpath = env['PATH'] - else: - envpath = defpath - PATH = envpath.split(pathsep) - saved_exc = None - saved_tb = None - for dir in PATH: - fullname = path.join(dir, file) - try: - func(fullname, *argrest) - except error, e: - tb = sys.exc_info()[2] - if (e.errno != errno.ENOENT and e.errno != errno.ENOTDIR - and saved_exc is None): - saved_exc = e - saved_tb = tb - if saved_exc: - raise error, saved_exc, saved_tb - raise error, e, tb - -# Change environ to automatically call putenv() if it exists -try: - # This will fail if there's no putenv - putenv -except NameError: - pass -else: - import UserDict - - # Fake unsetenv() for Windows - # not sure about os2 here but - # I'm guessing they are the same. - - if name in ('os2', 'nt'): - def unsetenv(key): - putenv(key, "") - - if name == "riscos": - # On RISC OS, all env access goes through getenv and putenv - from riscosenviron import _Environ - elif name in ('os2', 'nt'): # Where Env Var Names Must Be UPPERCASE - # But we store them as upper case - class _Environ(UserDict.IterableUserDict): - def __init__(self, environ): - UserDict.UserDict.__init__(self) - data = self.data - for k, v in environ.items(): - data[k.upper()] = v - def __setitem__(self, key, item): - putenv(key, item) - self.data[key.upper()] = item - def __getitem__(self, key): - return self.data[key.upper()] - try: - unsetenv - except NameError: - def __delitem__(self, key): - del self.data[key.upper()] - else: - def __delitem__(self, key): - unsetenv(key) - del self.data[key.upper()] - def clear(self): - for key in self.data.keys(): - unsetenv(key) - del self.data[key] - def pop(self, key, *args): - unsetenv(key) - return self.data.pop(key.upper(), *args) - def has_key(self, key): - return key.upper() in self.data - def __contains__(self, key): - return key.upper() in self.data - def get(self, key, failobj=None): - return self.data.get(key.upper(), failobj) - def update(self, dict=None, **kwargs): - if dict: - try: - keys = dict.keys() - except AttributeError: - # List of (key, value) - for k, v in dict: - self[k] = v - else: - # got keys - # cannot use items(), since mappings - # may not have them. - for k in keys: - self[k] = dict[k] - if kwargs: - self.update(kwargs) - def copy(self): - return dict(self) - - else: # Where Env Var Names Can Be Mixed Case - class _Environ(UserDict.IterableUserDict): - def __init__(self, environ): - UserDict.UserDict.__init__(self) - self.data = environ - def __setitem__(self, key, item): - putenv(key, item) - self.data[key] = item - def update(self, dict=None, **kwargs): - if dict: - try: - keys = dict.keys() - except AttributeError: - # List of (key, value) - for k, v in dict: - self[k] = v - else: - # got keys - # cannot use items(), since mappings - # may not have them. - for k in keys: - self[k] = dict[k] - if kwargs: - self.update(kwargs) - try: - unsetenv - except NameError: - pass - else: - def __delitem__(self, key): - unsetenv(key) - del self.data[key] - def clear(self): - for key in self.data.keys(): - unsetenv(key) - del self.data[key] - def pop(self, key, *args): - unsetenv(key) - return self.data.pop(key, *args) - def copy(self): - return dict(self) - - - environ = _Environ(environ) - -def getenv(key, default=None): - """Get an environment variable, return None if it doesn't exist. - The optional second argument can specify an alternate default.""" - return environ.get(key, default) -__all__.append("getenv") - -def _exists(name): - return name in globals() - -# Supply spawn*() (probably only for Unix) -if _exists("fork") and not _exists("spawnv") and _exists("execv"): - - P_WAIT = 0 - P_NOWAIT = P_NOWAITO = 1 - - # XXX Should we support P_DETACH? I suppose it could fork()**2 - # and close the std I/O streams. Also, P_OVERLAY is the same - # as execv*()? - - def _spawnvef(mode, file, args, env, func): - # Internal helper; func is the exec*() function to use - pid = fork() - if not pid: - # Child - try: - if env is None: - func(file, args) - else: - func(file, args, env) - except: - _exit(127) - else: - # Parent - if mode == P_NOWAIT: - return pid # Caller is responsible for waiting! - while 1: - wpid, sts = waitpid(pid, 0) - if WIFSTOPPED(sts): - continue - elif WIFSIGNALED(sts): - return -WTERMSIG(sts) - elif WIFEXITED(sts): - return WEXITSTATUS(sts) - else: - raise error, "Not stopped, signaled or exited???" - - def spawnv(mode, file, args): - """spawnv(mode, file, args) -> integer - -Execute file with arguments from args in a subprocess. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - return _spawnvef(mode, file, args, None, execv) - - def spawnve(mode, file, args, env): - """spawnve(mode, file, args, env) -> integer - -Execute file with arguments from args in a subprocess with the -specified environment. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - return _spawnvef(mode, file, args, env, execve) - - # Note: spawnvp[e] is't currently supported on Windows - - def spawnvp(mode, file, args): - """spawnvp(mode, file, args) -> integer - -Execute file (which is looked for along $PATH) with arguments from -args in a subprocess. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - return _spawnvef(mode, file, args, None, execvp) - - def spawnvpe(mode, file, args, env): - """spawnvpe(mode, file, args, env) -> integer - -Execute file (which is looked for along $PATH) with arguments from -args in a subprocess with the supplied environment. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - return _spawnvef(mode, file, args, env, execvpe) - -if _exists("spawnv"): - # These aren't supplied by the basic Windows code - # but can be easily implemented in Python - - def spawnl(mode, file, *args): - """spawnl(mode, file, *args) -> integer - -Execute file with arguments from args in a subprocess. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - return spawnv(mode, file, args) - - def spawnle(mode, file, *args): - """spawnle(mode, file, *args, env) -> integer - -Execute file with arguments from args in a subprocess with the -supplied environment. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - env = args[-1] - return spawnve(mode, file, args[:-1], env) - - - __all__.extend(["spawnv", "spawnve", "spawnl", "spawnle",]) - - -if _exists("spawnvp"): - # At the moment, Windows doesn't implement spawnvp[e], - # so it won't have spawnlp[e] either. - def spawnlp(mode, file, *args): - """spawnlp(mode, file, *args) -> integer - -Execute file (which is looked for along $PATH) with arguments from -args in a subprocess with the supplied environment. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - return spawnvp(mode, file, args) - - def spawnlpe(mode, file, *args): - """spawnlpe(mode, file, *args, env) -> integer - -Execute file (which is looked for along $PATH) with arguments from -args in a subprocess with the supplied environment. -If mode == P_NOWAIT return the pid of the process. -If mode == P_WAIT return the process's exit code if it exits normally; -otherwise return -SIG, where SIG is the signal that killed it. """ - env = args[-1] - return spawnvpe(mode, file, args[:-1], env) - - - __all__.extend(["spawnvp", "spawnvpe", "spawnlp", "spawnlpe",]) - - -# Supply popen2 etc. (for Unix) -if _exists("fork"): - if not _exists("popen2"): - def popen2(cmd, mode="t", bufsize=-1): - """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' - may be a sequence, in which case arguments will be passed directly to - the program without shell intervention (as with os.spawnv()). If 'cmd' - is a string it will be passed to the shell (as with os.system()). If - 'bufsize' is specified, it sets the buffer size for the I/O pipes. The - file objects (child_stdin, child_stdout) are returned.""" - import warnings - msg = "os.popen2 is deprecated. Use the subprocess module." - warnings.warn(msg, DeprecationWarning, stacklevel=2) - - import subprocess - PIPE = subprocess.PIPE - p = subprocess.Popen(cmd, shell=isinstance(cmd, basestring), - bufsize=bufsize, stdin=PIPE, stdout=PIPE, - close_fds=True) - return p.stdin, p.stdout - __all__.append("popen2") - - if not _exists("popen3"): - def popen3(cmd, mode="t", bufsize=-1): - """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' - may be a sequence, in which case arguments will be passed directly to - the program without shell intervention (as with os.spawnv()). If 'cmd' - is a string it will be passed to the shell (as with os.system()). If - 'bufsize' is specified, it sets the buffer size for the I/O pipes. The - file objects (child_stdin, child_stdout, child_stderr) are returned.""" - import warnings - msg = "os.popen3 is deprecated. Use the subprocess module." - warnings.warn(msg, DeprecationWarning, stacklevel=2) - - import subprocess - PIPE = subprocess.PIPE - p = subprocess.Popen(cmd, shell=isinstance(cmd, basestring), - bufsize=bufsize, stdin=PIPE, stdout=PIPE, - stderr=PIPE, close_fds=True) - return p.stdin, p.stdout, p.stderr - __all__.append("popen3") - - if not _exists("popen4"): - def popen4(cmd, mode="t", bufsize=-1): - """Execute the shell command 'cmd' in a sub-process. On UNIX, 'cmd' - may be a sequence, in which case arguments will be passed directly to - the program without shell intervention (as with os.spawnv()). If 'cmd' - is a string it will be passed to the shell (as with os.system()). If - 'bufsize' is specified, it sets the buffer size for the I/O pipes. The - file objects (child_stdin, child_stdout_stderr) are returned.""" - import warnings - msg = "os.popen4 is deprecated. Use the subprocess module." - warnings.warn(msg, DeprecationWarning, stacklevel=2) - - import subprocess - PIPE = subprocess.PIPE - p = subprocess.Popen(cmd, shell=isinstance(cmd, basestring), - bufsize=bufsize, stdin=PIPE, stdout=PIPE, - stderr=subprocess.STDOUT, close_fds=True) - return p.stdin, p.stdout - __all__.append("popen4") - -import copy_reg as _copy_reg - -def _make_stat_result(tup, dict): - return stat_result(tup, dict) - -def _pickle_stat_result(sr): - (type, args) = sr.__reduce__() - return (_make_stat_result, args) - -try: - _copy_reg.pickle(stat_result, _pickle_stat_result, _make_stat_result) -except NameError: # stat_result may not exist - pass - -def _make_statvfs_result(tup, dict): - return statvfs_result(tup, dict) - -def _pickle_statvfs_result(sr): - (type, args) = sr.__reduce__() - return (_make_statvfs_result, args) - -try: - _copy_reg.pickle(statvfs_result, _pickle_statvfs_result, - _make_statvfs_result) -except NameError: # statvfs_result may not exist - pass diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/pydoc.py b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/pydoc.py deleted file mode 100644 index c5866f9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/pydoc.py +++ /dev/null @@ -1,2423 +0,0 @@ -#!/usr/bin/env python -# -*- coding: latin-1 -*- - -# Module 'pydoc' -- Generate Python documentation in HTML or text for interactive use. -# -# Copyright (c) 2015, Daryl McDaniel. All rights reserved.
-# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
-# This program and the accompanying materials are licensed and made available under -# the terms and conditions of the BSD License that accompanies this distribution. -# The full text of the license may be found at -# http://opensource.org/licenses/bsd-license. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - -"""Generate Python documentation in HTML or text for interactive use. - -In the Python interpreter, do "from pydoc import help" to provide online -help. Calling help(thing) on a Python object documents the object. - -Or, at the shell command line outside of Python: - -Run "pydoc " to show documentation on something. may be -the name of a function, module, package, or a dotted reference to a -class or function within a module or module in a package. If the -argument contains a path segment delimiter (e.g. slash on Unix, -backslash on Windows) it is treated as the path to a Python source file. - -Run "pydoc -k " to search for a keyword in the synopsis lines -of all available modules. - -Run "pydoc -p " to start an HTTP server on a given port on the -local machine to generate documentation web pages. Port number 0 can be -used to get an arbitrary unused port. - -For platforms without a command line, "pydoc -g" starts the HTTP server -and also pops up a little window for controlling it. - -Run "pydoc -w " to write out the HTML documentation for a module -to a file named ".html". - -Module docs for core modules are assumed to be in - - http://docs.python.org/library/ - -This can be overridden by setting the PYTHONDOCS environment variable -to a different URL or to a local directory containing the Library -Reference Manual pages. -""" - -__author__ = "Ka-Ping Yee " -__date__ = "26 February 2001" - -__version__ = "$Revision: 88564 $" -__credits__ = """Guido van Rossum, for an excellent programming language. -Tommy Burnette, the original creator of manpy. -Paul Prescod, for all his work on onlinehelp. -Richard Chamberlain, for the first implementation of textdoc. -""" - -# Known bugs that can't be fixed here: -# - imp.load_module() cannot be prevented from clobbering existing -# loaded modules, so calling synopsis() on a binary module file -# changes the contents of any existing module with the same name. -# - If the __file__ attribute on a module is a relative path and -# the current directory is changed with os.chdir(), an incorrect -# path will be displayed. - -import sys, imp, os, re, types, inspect, __builtin__, pkgutil, warnings -from repr import Repr -from string import expandtabs, find, join, lower, split, strip, rfind, rstrip -from traceback import extract_tb -try: - from collections import deque -except ImportError: - # Python 2.3 compatibility - class deque(list): - def popleft(self): - return self.pop(0) - -# --------------------------------------------------------- common routines - -def pathdirs(): - """Convert sys.path into a list of absolute, existing, unique paths.""" - dirs = [] - normdirs = [] - for dir in sys.path: - dir = os.path.abspath(dir or '.') - normdir = os.path.normcase(dir) - if normdir not in normdirs and os.path.isdir(dir): - dirs.append(dir) - normdirs.append(normdir) - return dirs - -def getdoc(object): - """Get the doc string or comments for an object.""" - result = inspect.getdoc(object) or inspect.getcomments(object) - result = _encode(result) - return result and re.sub('^ *\n', '', rstrip(result)) or '' - -def splitdoc(doc): - """Split a doc string into a synopsis line (if any) and the rest.""" - lines = split(strip(doc), '\n') - if len(lines) == 1: - return lines[0], '' - elif len(lines) >= 2 and not rstrip(lines[1]): - return lines[0], join(lines[2:], '\n') - return '', join(lines, '\n') - -def classname(object, modname): - """Get a class name and qualify it with a module name if necessary.""" - name = object.__name__ - if object.__module__ != modname: - name = object.__module__ + '.' + name - return name - -def isdata(object): - """Check if an object is of a type that probably means it's data.""" - return not (inspect.ismodule(object) or inspect.isclass(object) or - inspect.isroutine(object) or inspect.isframe(object) or - inspect.istraceback(object) or inspect.iscode(object)) - -def replace(text, *pairs): - """Do a series of global replacements on a string.""" - while pairs: - text = join(split(text, pairs[0]), pairs[1]) - pairs = pairs[2:] - return text - -def cram(text, maxlen): - """Omit part of a string if needed to make it fit in a maximum length.""" - if len(text) > maxlen: - pre = max(0, (maxlen-3)//2) - post = max(0, maxlen-3-pre) - return text[:pre] + '...' + text[len(text)-post:] - return text - -_re_stripid = re.compile(r' at 0x[0-9a-f]{6,16}(>+)$', re.IGNORECASE) -def stripid(text): - """Remove the hexadecimal id from a Python object representation.""" - # The behaviour of %p is implementation-dependent in terms of case. - return _re_stripid.sub(r'\1', text) - -def _is_some_method(obj): - return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj) - -def allmethods(cl): - methods = {} - for key, value in inspect.getmembers(cl, _is_some_method): - methods[key] = 1 - for base in cl.__bases__: - methods.update(allmethods(base)) # all your base are belong to us - for key in methods.keys(): - methods[key] = getattr(cl, key) - return methods - -def _split_list(s, predicate): - """Split sequence s via predicate, and return pair ([true], [false]). - - The return value is a 2-tuple of lists, - ([x for x in s if predicate(x)], - [x for x in s if not predicate(x)]) - """ - - yes = [] - no = [] - for x in s: - if predicate(x): - yes.append(x) - else: - no.append(x) - return yes, no - -def visiblename(name, all=None, obj=None): - """Decide whether to show documentation on a variable.""" - # Certain special names are redundant. - _hidden_names = ('__builtins__', '__doc__', '__file__', '__path__', - '__module__', '__name__', '__slots__', '__package__') - if name in _hidden_names: return 0 - # Private names are hidden, but special names are displayed. - if name.startswith('__') and name.endswith('__'): return 1 - # Namedtuples have public fields and methods with a single leading underscore - if name.startswith('_') and hasattr(obj, '_fields'): - return 1 - if all is not None: - # only document that which the programmer exported in __all__ - return name in all - else: - return not name.startswith('_') - -def classify_class_attrs(object): - """Wrap inspect.classify_class_attrs, with fixup for data descriptors.""" - def fixup(data): - name, kind, cls, value = data - if inspect.isdatadescriptor(value): - kind = 'data descriptor' - return name, kind, cls, value - return map(fixup, inspect.classify_class_attrs(object)) - -# ----------------------------------------------------- Unicode support helpers - -try: - _unicode = unicode -except NameError: - # If Python is built without Unicode support, the unicode type - # will not exist. Fake one that nothing will match, and make - # the _encode function that do nothing. - class _unicode(object): - pass - _encoding = 'ascii' - def _encode(text, encoding='ascii'): - return text -else: - import locale - _encoding = locale.getpreferredencoding() - - def _encode(text, encoding=None): - if isinstance(text, unicode): - return text.encode(encoding or _encoding, 'xmlcharrefreplace') - else: - return text - -def _binstr(obj): - # Ensure that we have an encoded (binary) string representation of obj, - # even if it is a unicode string. - if isinstance(obj, _unicode): - return obj.encode(_encoding, 'xmlcharrefreplace') - return str(obj) - -# ----------------------------------------------------- module manipulation - -def ispackage(path): - """Guess whether a path refers to a package directory.""" - if os.path.isdir(path): - for ext in ('.py', '.pyc', '.pyo'): - if os.path.isfile(os.path.join(path, '__init__' + ext)): - return True - return False - -def source_synopsis(file): - line = file.readline() - while line[:1] == '#' or not strip(line): - line = file.readline() - if not line: break - line = strip(line) - if line[:4] == 'r"""': line = line[1:] - if line[:3] == '"""': - line = line[3:] - if line[-1:] == '\\': line = line[:-1] - while not strip(line): - line = file.readline() - if not line: break - result = strip(split(line, '"""')[0]) - else: result = None - return result - -def synopsis(filename, cache={}): - """Get the one-line summary out of a module file.""" - mtime = os.stat(filename).st_mtime - lastupdate, result = cache.get(filename, (None, None)) - if lastupdate is None or lastupdate < mtime: - info = inspect.getmoduleinfo(filename) - try: - file = open(filename) - except IOError: - # module can't be opened, so skip it - return None - if info and 'b' in info[2]: # binary modules have to be imported - try: module = imp.load_module('__temp__', file, filename, info[1:]) - except: return None - result = module.__doc__.splitlines()[0] if module.__doc__ else None - del sys.modules['__temp__'] - else: # text modules can be directly examined - result = source_synopsis(file) - file.close() - cache[filename] = (mtime, result) - return result - -class ErrorDuringImport(Exception): - """Errors that occurred while trying to import something to document it.""" - def __init__(self, filename, exc_info): - exc, value, tb = exc_info - self.filename = filename - self.exc = exc - self.value = value - self.tb = tb - - def __str__(self): - exc = self.exc - if type(exc) is types.ClassType: - exc = exc.__name__ - return 'problem in %s - %s: %s' % (self.filename, exc, self.value) - -def importfile(path): - """Import a Python source file or compiled file given its path.""" - magic = imp.get_magic() - file = open(path, 'r') - if file.read(len(magic)) == magic: - kind = imp.PY_COMPILED - else: - kind = imp.PY_SOURCE - file.close() - filename = os.path.basename(path) - name, ext = os.path.splitext(filename) - file = open(path, 'r') - try: - module = imp.load_module(name, file, path, (ext, 'r', kind)) - except: - raise ErrorDuringImport(path, sys.exc_info()) - file.close() - return module - -def safeimport(path, forceload=0, cache={}): - """Import a module; handle errors; return None if the module isn't found. - - If the module *is* found but an exception occurs, it's wrapped in an - ErrorDuringImport exception and reraised. Unlike __import__, if a - package path is specified, the module at the end of the path is returned, - not the package at the beginning. If the optional 'forceload' argument - is 1, we reload the module from disk (unless it's a dynamic extension).""" - try: - # If forceload is 1 and the module has been previously loaded from - # disk, we always have to reload the module. Checking the file's - # mtime isn't good enough (e.g. the module could contain a class - # that inherits from another module that has changed). - if forceload and path in sys.modules: - if path not in sys.builtin_module_names: - # Avoid simply calling reload() because it leaves names in - # the currently loaded module lying around if they're not - # defined in the new source file. Instead, remove the - # module from sys.modules and re-import. Also remove any - # submodules because they won't appear in the newly loaded - # module's namespace if they're already in sys.modules. - subs = [m for m in sys.modules if m.startswith(path + '.')] - for key in [path] + subs: - # Prevent garbage collection. - cache[key] = sys.modules[key] - del sys.modules[key] - module = __import__(path) - except: - # Did the error occur before or after the module was found? - (exc, value, tb) = info = sys.exc_info() - if path in sys.modules: - # An error occurred while executing the imported module. - raise ErrorDuringImport(sys.modules[path].__file__, info) - elif exc is SyntaxError: - # A SyntaxError occurred before we could execute the module. - raise ErrorDuringImport(value.filename, info) - elif exc is ImportError and extract_tb(tb)[-1][2]=='safeimport': - # The import error occurred directly in this function, - # which means there is no such module in the path. - return None - else: - # Some other error occurred during the importing process. - raise ErrorDuringImport(path, sys.exc_info()) - for part in split(path, '.')[1:]: - try: module = getattr(module, part) - except AttributeError: return None - return module - -# ---------------------------------------------------- formatter base class - -class Doc: - def document(self, object, name=None, *args): - """Generate documentation for an object.""" - args = (object, name) + args - # 'try' clause is to attempt to handle the possibility that inspect - # identifies something in a way that pydoc itself has issues handling; - # think 'super' and how it is a descriptor (which raises the exception - # by lacking a __name__ attribute) and an instance. - if inspect.isgetsetdescriptor(object): return self.docdata(*args) - if inspect.ismemberdescriptor(object): return self.docdata(*args) - try: - if inspect.ismodule(object): return self.docmodule(*args) - if inspect.isclass(object): return self.docclass(*args) - if inspect.isroutine(object): return self.docroutine(*args) - except AttributeError: - pass - if isinstance(object, property): return self.docproperty(*args) - return self.docother(*args) - - def fail(self, object, name=None, *args): - """Raise an exception for unimplemented types.""" - message = "don't know how to document object%s of type %s" % ( - name and ' ' + repr(name), type(object).__name__) - raise TypeError, message - - docmodule = docclass = docroutine = docother = docproperty = docdata = fail - - def getdocloc(self, object): - """Return the location of module docs or None""" - - try: - file = inspect.getabsfile(object) - except TypeError: - file = '(built-in)' - - docloc = os.environ.get("PYTHONDOCS", - "http://docs.python.org/library") - basedir = os.path.join(sys.exec_prefix, "lib", - "python"+sys.version[0:3]) - if (isinstance(object, type(os)) and - (object.__name__ in ('errno', 'exceptions', 'gc', 'imp', - 'marshal', 'posix', 'signal', 'sys', - 'thread', 'zipimport') or - (file.startswith(basedir) and - not file.startswith(os.path.join(basedir, 'site-packages')))) and - object.__name__ not in ('xml.etree', 'test.pydoc_mod')): - if docloc.startswith("http://"): - docloc = "%s/%s" % (docloc.rstrip("/"), object.__name__) - else: - docloc = os.path.join(docloc, object.__name__ + ".html") - else: - docloc = None - return docloc - -# -------------------------------------------- HTML documentation generator - -class HTMLRepr(Repr): - """Class for safely making an HTML representation of a Python object.""" - def __init__(self): - Repr.__init__(self) - self.maxlist = self.maxtuple = 20 - self.maxdict = 10 - self.maxstring = self.maxother = 100 - - def escape(self, text): - return replace(text, '&', '&', '<', '<', '>', '>') - - def repr(self, object): - return Repr.repr(self, object) - - def repr1(self, x, level): - if hasattr(type(x), '__name__'): - methodname = 'repr_' + join(split(type(x).__name__), '_') - if hasattr(self, methodname): - return getattr(self, methodname)(x, level) - return self.escape(cram(stripid(repr(x)), self.maxother)) - - def repr_string(self, x, level): - test = cram(x, self.maxstring) - testrepr = repr(test) - if '\\' in test and '\\' not in replace(testrepr, r'\\', ''): - # Backslashes are only literal in the string and are never - # needed to make any special characters, so show a raw string. - return 'r' + testrepr[0] + self.escape(test) + testrepr[0] - return re.sub(r'((\\[\\abfnrtv\'"]|\\[0-9]..|\\x..|\\u....)+)', - r'\1', - self.escape(testrepr)) - - repr_str = repr_string - - def repr_instance(self, x, level): - try: - return self.escape(cram(stripid(repr(x)), self.maxstring)) - except: - return self.escape('<%s instance>' % x.__class__.__name__) - - repr_unicode = repr_string - -class HTMLDoc(Doc): - """Formatter class for HTML documentation.""" - - # ------------------------------------------- HTML formatting utilities - - _repr_instance = HTMLRepr() - repr = _repr_instance.repr - escape = _repr_instance.escape - - def page(self, title, contents): - """Format an HTML page.""" - return _encode(''' - -Python: %s - - -%s -''' % (title, contents), 'ascii') - - def heading(self, title, fgcol, bgcol, extras=''): - """Format a page heading.""" - return ''' - - -
 
- 
%s
%s
- ''' % (bgcol, fgcol, title, fgcol, extras or ' ') - - def section(self, title, fgcol, bgcol, contents, width=6, - prelude='', marginalia=None, gap=' '): - """Format a section with a heading.""" - if marginalia is None: - marginalia = '' + ' ' * width + '' - result = '''

- - - - ''' % (bgcol, fgcol, title) - if prelude: - result = result + ''' - - -''' % (bgcol, marginalia, prelude, gap) - else: - result = result + ''' -''' % (bgcol, marginalia, gap) - - return result + '\n
 
-%s
%s%s
%s
%s%s%s
' % contents - - def bigsection(self, title, *args): - """Format a section with a big heading.""" - title = '%s' % title - return self.section(title, *args) - - def preformat(self, text): - """Format literal preformatted text.""" - text = self.escape(expandtabs(text)) - return replace(text, '\n\n', '\n \n', '\n\n', '\n \n', - ' ', ' ', '\n', '
\n') - - def multicolumn(self, list, format, cols=4): - """Format a list of items into a multi-column list.""" - result = '' - rows = (len(list)+cols-1)//cols - for col in range(cols): - result = result + '' % (100//cols) - for i in range(rows*col, rows*col+rows): - if i < len(list): - result = result + format(list[i]) + '
\n' - result = result + '' - return '%s
' % result - - def grey(self, text): return '%s' % text - - def namelink(self, name, *dicts): - """Make a link for an identifier, given name-to-URL mappings.""" - for dict in dicts: - if name in dict: - return '%s' % (dict[name], name) - return name - - def classlink(self, object, modname): - """Make a link for a class.""" - name, module = object.__name__, sys.modules.get(object.__module__) - if hasattr(module, name) and getattr(module, name) is object: - return '%s' % ( - module.__name__, name, classname(object, modname)) - return classname(object, modname) - - def modulelink(self, object): - """Make a link for a module.""" - return '%s' % (object.__name__, object.__name__) - - def modpkglink(self, data): - """Make a link for a module or package to display in an index.""" - name, path, ispackage, shadowed = data - if shadowed: - return self.grey(name) - if path: - url = '%s.%s.html' % (path, name) - else: - url = '%s.html' % name - if ispackage: - text = '%s (package)' % name - else: - text = name - return '%s' % (url, text) - - def markup(self, text, escape=None, funcs={}, classes={}, methods={}): - """Mark up some plain text, given a context of symbols to look for. - Each context dictionary maps object names to anchor names.""" - escape = escape or self.escape - results = [] - here = 0 - pattern = re.compile(r'\b((http|ftp)://\S+[\w/]|' - r'RFC[- ]?(\d+)|' - r'PEP[- ]?(\d+)|' - r'(self\.)?(\w+))') - while True: - match = pattern.search(text, here) - if not match: break - start, end = match.span() - results.append(escape(text[here:start])) - - all, scheme, rfc, pep, selfdot, name = match.groups() - if scheme: - url = escape(all).replace('"', '"') - results.append('%s' % (url, url)) - elif rfc: - url = 'http://www.rfc-editor.org/rfc/rfc%d.txt' % int(rfc) - results.append('%s' % (url, escape(all))) - elif pep: - url = 'http://www.python.org/dev/peps/pep-%04d/' % int(pep) - results.append('%s' % (url, escape(all))) - elif selfdot: - # Create a link for methods like 'self.method(...)' - # and use for attributes like 'self.attr' - if text[end:end+1] == '(': - results.append('self.' + self.namelink(name, methods)) - else: - results.append('self.%s' % name) - elif text[end:end+1] == '(': - results.append(self.namelink(name, methods, funcs, classes)) - else: - results.append(self.namelink(name, classes)) - here = end - results.append(escape(text[here:])) - return join(results, '') - - # ---------------------------------------------- type-specific routines - - def formattree(self, tree, modname, parent=None): - """Produce HTML for a class tree as given by inspect.getclasstree().""" - result = '' - for entry in tree: - if type(entry) is type(()): - c, bases = entry - result = result + '

' - result = result + self.classlink(c, modname) - if bases and bases != (parent,): - parents = [] - for base in bases: - parents.append(self.classlink(base, modname)) - result = result + '(' + join(parents, ', ') + ')' - result = result + '\n
' - elif type(entry) is type([]): - result = result + '
\n%s
\n' % self.formattree( - entry, modname, c) - return '
\n%s
\n' % result - - def docmodule(self, object, name=None, mod=None, *ignored): - """Produce HTML documentation for a module object.""" - name = object.__name__ # ignore the passed-in name - try: - all = object.__all__ - except AttributeError: - all = None - parts = split(name, '.') - links = [] - for i in range(len(parts)-1): - links.append( - '%s' % - (join(parts[:i+1], '.'), parts[i])) - linkedname = join(links + parts[-1:], '.') - head = '%s' % linkedname - try: - path = inspect.getabsfile(object) - url = path - if sys.platform == 'win32': - import nturl2path - url = nturl2path.pathname2url(path) - filelink = '%s' % (url, path) - except TypeError: - filelink = '(built-in)' - info = [] - if hasattr(object, '__version__'): - version = _binstr(object.__version__) - if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': - version = strip(version[11:-1]) - info.append('version %s' % self.escape(version)) - if hasattr(object, '__date__'): - info.append(self.escape(_binstr(object.__date__))) - if info: - head = head + ' (%s)' % join(info, ', ') - docloc = self.getdocloc(object) - if docloc is not None: - docloc = '
Module Docs' % locals() - else: - docloc = '' - result = self.heading( - head, '#ffffff', '#7799ee', - 'index
' + filelink + docloc) - - modules = inspect.getmembers(object, inspect.ismodule) - - classes, cdict = [], {} - for key, value in inspect.getmembers(object, inspect.isclass): - # if __all__ exists, believe it. Otherwise use old heuristic. - if (all is not None or - (inspect.getmodule(value) or object) is object): - if visiblename(key, all, object): - classes.append((key, value)) - cdict[key] = cdict[value] = '#' + key - for key, value in classes: - for base in value.__bases__: - key, modname = base.__name__, base.__module__ - module = sys.modules.get(modname) - if modname != name and module and hasattr(module, key): - if getattr(module, key) is base: - if not key in cdict: - cdict[key] = cdict[base] = modname + '.html#' + key - funcs, fdict = [], {} - for key, value in inspect.getmembers(object, inspect.isroutine): - # if __all__ exists, believe it. Otherwise use old heuristic. - if (all is not None or - inspect.isbuiltin(value) or inspect.getmodule(value) is object): - if visiblename(key, all, object): - funcs.append((key, value)) - fdict[key] = '#-' + key - if inspect.isfunction(value): fdict[value] = fdict[key] - data = [] - for key, value in inspect.getmembers(object, isdata): - if visiblename(key, all, object): - data.append((key, value)) - - doc = self.markup(getdoc(object), self.preformat, fdict, cdict) - doc = doc and '%s' % doc - result = result + '

%s

\n' % doc - - if hasattr(object, '__path__'): - modpkgs = [] - for importer, modname, ispkg in pkgutil.iter_modules(object.__path__): - modpkgs.append((modname, name, ispkg, 0)) - modpkgs.sort() - contents = self.multicolumn(modpkgs, self.modpkglink) - result = result + self.bigsection( - 'Package Contents', '#ffffff', '#aa55cc', contents) - elif modules: - contents = self.multicolumn( - modules, lambda key_value, s=self: s.modulelink(key_value[1])) - result = result + self.bigsection( - 'Modules', '#ffffff', '#aa55cc', contents) - - if classes: - classlist = map(lambda key_value: key_value[1], classes) - contents = [ - self.formattree(inspect.getclasstree(classlist, 1), name)] - for key, value in classes: - contents.append(self.document(value, key, name, fdict, cdict)) - result = result + self.bigsection( - 'Classes', '#ffffff', '#ee77aa', join(contents)) - if funcs: - contents = [] - for key, value in funcs: - contents.append(self.document(value, key, name, fdict, cdict)) - result = result + self.bigsection( - 'Functions', '#ffffff', '#eeaa77', join(contents)) - if data: - contents = [] - for key, value in data: - contents.append(self.document(value, key)) - result = result + self.bigsection( - 'Data', '#ffffff', '#55aa55', join(contents, '
\n')) - if hasattr(object, '__author__'): - contents = self.markup(_binstr(object.__author__), self.preformat) - result = result + self.bigsection( - 'Author', '#ffffff', '#7799ee', contents) - if hasattr(object, '__credits__'): - contents = self.markup(_binstr(object.__credits__), self.preformat) - result = result + self.bigsection( - 'Credits', '#ffffff', '#7799ee', contents) - - return result - - def docclass(self, object, name=None, mod=None, funcs={}, classes={}, - *ignored): - """Produce HTML documentation for a class object.""" - realname = object.__name__ - name = name or realname - bases = object.__bases__ - - contents = [] - push = contents.append - - # Cute little class to pump out a horizontal rule between sections. - class HorizontalRule: - def __init__(self): - self.needone = 0 - def maybe(self): - if self.needone: - push('
\n') - self.needone = 1 - hr = HorizontalRule() - - # List the mro, if non-trivial. - mro = deque(inspect.getmro(object)) - if len(mro) > 2: - hr.maybe() - push('
Method resolution order:
\n') - for base in mro: - push('
%s
\n' % self.classlink(base, - object.__module__)) - push('
\n') - - def spill(msg, attrs, predicate): - ok, attrs = _split_list(attrs, predicate) - if ok: - hr.maybe() - push(msg) - for name, kind, homecls, value in ok: - try: - value = getattr(object, name) - except Exception: - # Some descriptors may meet a failure in their __get__. - # (bug #1785) - push(self._docdescriptor(name, value, mod)) - else: - push(self.document(value, name, mod, - funcs, classes, mdict, object)) - push('\n') - return attrs - - def spilldescriptors(msg, attrs, predicate): - ok, attrs = _split_list(attrs, predicate) - if ok: - hr.maybe() - push(msg) - for name, kind, homecls, value in ok: - push(self._docdescriptor(name, value, mod)) - return attrs - - def spilldata(msg, attrs, predicate): - ok, attrs = _split_list(attrs, predicate) - if ok: - hr.maybe() - push(msg) - for name, kind, homecls, value in ok: - base = self.docother(getattr(object, name), name, mod) - if (hasattr(value, '__call__') or - inspect.isdatadescriptor(value)): - doc = getattr(value, "__doc__", None) - else: - doc = None - if doc is None: - push('
%s
\n' % base) - else: - doc = self.markup(getdoc(value), self.preformat, - funcs, classes, mdict) - doc = '
%s' % doc - push('
%s%s
\n' % (base, doc)) - push('\n') - return attrs - - attrs = filter(lambda data: visiblename(data[0], obj=object), - classify_class_attrs(object)) - mdict = {} - for key, kind, homecls, value in attrs: - mdict[key] = anchor = '#' + name + '-' + key - try: - value = getattr(object, name) - except Exception: - # Some descriptors may meet a failure in their __get__. - # (bug #1785) - pass - try: - # The value may not be hashable (e.g., a data attr with - # a dict or list value). - mdict[value] = anchor - except TypeError: - pass - - while attrs: - if mro: - thisclass = mro.popleft() - else: - thisclass = attrs[0][2] - attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) - - if thisclass is __builtin__.object: - attrs = inherited - continue - elif thisclass is object: - tag = 'defined here' - else: - tag = 'inherited from %s' % self.classlink(thisclass, - object.__module__) - tag += ':
\n' - - # Sort attrs by name. - try: - attrs.sort(key=lambda t: t[0]) - except TypeError: - attrs.sort(lambda t1, t2: cmp(t1[0], t2[0])) # 2.3 compat - - # Pump out the attrs, segregated by kind. - attrs = spill('Methods %s' % tag, attrs, - lambda t: t[1] == 'method') - attrs = spill('Class methods %s' % tag, attrs, - lambda t: t[1] == 'class method') - attrs = spill('Static methods %s' % tag, attrs, - lambda t: t[1] == 'static method') - attrs = spilldescriptors('Data descriptors %s' % tag, attrs, - lambda t: t[1] == 'data descriptor') - attrs = spilldata('Data and other attributes %s' % tag, attrs, - lambda t: t[1] == 'data') - assert attrs == [] - attrs = inherited - - contents = ''.join(contents) - - if name == realname: - title = 'class %s' % ( - name, realname) - else: - title = '%s = class %s' % ( - name, name, realname) - if bases: - parents = [] - for base in bases: - parents.append(self.classlink(base, object.__module__)) - title = title + '(%s)' % join(parents, ', ') - doc = self.markup(getdoc(object), self.preformat, funcs, classes, mdict) - doc = doc and '%s
 
' % doc - - return self.section(title, '#000000', '#ffc8d8', contents, 3, doc) - - def formatvalue(self, object): - """Format an argument default value as text.""" - return self.grey('=' + self.repr(object)) - - def docroutine(self, object, name=None, mod=None, - funcs={}, classes={}, methods={}, cl=None): - """Produce HTML documentation for a function or method object.""" - realname = object.__name__ - name = name or realname - anchor = (cl and cl.__name__ or '') + '-' + name - note = '' - skipdocs = 0 - if inspect.ismethod(object): - imclass = object.im_class - if cl: - if imclass is not cl: - note = ' from ' + self.classlink(imclass, mod) - else: - if object.im_self is not None: - note = ' method of %s instance' % self.classlink( - object.im_self.__class__, mod) - else: - note = ' unbound %s method' % self.classlink(imclass,mod) - object = object.im_func - - if name == realname: - title = '%s' % (anchor, realname) - else: - if (cl and realname in cl.__dict__ and - cl.__dict__[realname] is object): - reallink = '%s' % ( - cl.__name__ + '-' + realname, realname) - skipdocs = 1 - else: - reallink = realname - title = '%s = %s' % ( - anchor, name, reallink) - if inspect.isfunction(object): - args, varargs, varkw, defaults = inspect.getargspec(object) - argspec = inspect.formatargspec( - args, varargs, varkw, defaults, formatvalue=self.formatvalue) - if realname == '': - title = '%s lambda ' % name - argspec = argspec[1:-1] # remove parentheses - else: - argspec = '(...)' - - decl = title + argspec + (note and self.grey( - '%s' % note)) - - if skipdocs: - return '
%s
\n' % decl - else: - doc = self.markup( - getdoc(object), self.preformat, funcs, classes, methods) - doc = doc and '
%s
' % doc - return '
%s
%s
\n' % (decl, doc) - - def _docdescriptor(self, name, value, mod): - results = [] - push = results.append - - if name: - push('
%s
\n' % name) - if value.__doc__ is not None: - doc = self.markup(getdoc(value), self.preformat) - push('
%s
\n' % doc) - push('
\n') - - return ''.join(results) - - def docproperty(self, object, name=None, mod=None, cl=None): - """Produce html documentation for a property.""" - return self._docdescriptor(name, object, mod) - - def docother(self, object, name=None, mod=None, *ignored): - """Produce HTML documentation for a data object.""" - lhs = name and '%s = ' % name or '' - return lhs + self.repr(object) - - def docdata(self, object, name=None, mod=None, cl=None): - """Produce html documentation for a data descriptor.""" - return self._docdescriptor(name, object, mod) - - def index(self, dir, shadowed=None): - """Generate an HTML index for a directory of modules.""" - modpkgs = [] - if shadowed is None: shadowed = {} - for importer, name, ispkg in pkgutil.iter_modules([dir]): - modpkgs.append((name, '', ispkg, name in shadowed)) - shadowed[name] = 1 - - modpkgs.sort() - contents = self.multicolumn(modpkgs, self.modpkglink) - return self.bigsection(dir, '#ffffff', '#ee77aa', contents) - -# -------------------------------------------- text documentation generator - -class TextRepr(Repr): - """Class for safely making a text representation of a Python object.""" - def __init__(self): - Repr.__init__(self) - self.maxlist = self.maxtuple = 20 - self.maxdict = 10 - self.maxstring = self.maxother = 100 - - def repr1(self, x, level): - if hasattr(type(x), '__name__'): - methodname = 'repr_' + join(split(type(x).__name__), '_') - if hasattr(self, methodname): - return getattr(self, methodname)(x, level) - return cram(stripid(repr(x)), self.maxother) - - def repr_string(self, x, level): - test = cram(x, self.maxstring) - testrepr = repr(test) - if '\\' in test and '\\' not in replace(testrepr, r'\\', ''): - # Backslashes are only literal in the string and are never - # needed to make any special characters, so show a raw string. - return 'r' + testrepr[0] + test + testrepr[0] - return testrepr - - repr_str = repr_string - - def repr_instance(self, x, level): - try: - return cram(stripid(repr(x)), self.maxstring) - except: - return '<%s instance>' % x.__class__.__name__ - -class TextDoc(Doc): - """Formatter class for text documentation.""" - - # ------------------------------------------- text formatting utilities - - _repr_instance = TextRepr() - repr = _repr_instance.repr - - def bold(self, text): - """Format a string in bold by overstriking.""" - return join(map(lambda ch: ch + '\b' + ch, text), '') - - def indent(self, text, prefix=' '): - """Indent text by prepending a given prefix to each line.""" - if not text: return '' - lines = split(text, '\n') - lines = map(lambda line, prefix=prefix: prefix + line, lines) - if lines: lines[-1] = rstrip(lines[-1]) - return join(lines, '\n') - - def section(self, title, contents): - """Format a section with a given heading.""" - return self.bold(title) + '\n' + rstrip(self.indent(contents)) + '\n\n' - - # ---------------------------------------------- type-specific routines - - def formattree(self, tree, modname, parent=None, prefix=''): - """Render in text a class tree as returned by inspect.getclasstree().""" - result = '' - for entry in tree: - if type(entry) is type(()): - c, bases = entry - result = result + prefix + classname(c, modname) - if bases and bases != (parent,): - parents = map(lambda c, m=modname: classname(c, m), bases) - result = result + '(%s)' % join(parents, ', ') - result = result + '\n' - elif type(entry) is type([]): - result = result + self.formattree( - entry, modname, c, prefix + ' ') - return result - - def docmodule(self, object, name=None, mod=None): - """Produce text documentation for a given module object.""" - name = object.__name__ # ignore the passed-in name - synop, desc = splitdoc(getdoc(object)) - result = self.section('NAME', name + (synop and ' - ' + synop)) - - try: - all = object.__all__ - except AttributeError: - all = None - - try: - file = inspect.getabsfile(object) - except TypeError: - file = '(built-in)' - result = result + self.section('FILE', file) - - docloc = self.getdocloc(object) - if docloc is not None: - result = result + self.section('MODULE DOCS', docloc) - - if desc: - result = result + self.section('DESCRIPTION', desc) - - classes = [] - for key, value in inspect.getmembers(object, inspect.isclass): - # if __all__ exists, believe it. Otherwise use old heuristic. - if (all is not None - or (inspect.getmodule(value) or object) is object): - if visiblename(key, all, object): - classes.append((key, value)) - funcs = [] - for key, value in inspect.getmembers(object, inspect.isroutine): - # if __all__ exists, believe it. Otherwise use old heuristic. - if (all is not None or - inspect.isbuiltin(value) or inspect.getmodule(value) is object): - if visiblename(key, all, object): - funcs.append((key, value)) - data = [] - for key, value in inspect.getmembers(object, isdata): - if visiblename(key, all, object): - data.append((key, value)) - - modpkgs = [] - modpkgs_names = set() - if hasattr(object, '__path__'): - for importer, modname, ispkg in pkgutil.iter_modules(object.__path__): - modpkgs_names.add(modname) - if ispkg: - modpkgs.append(modname + ' (package)') - else: - modpkgs.append(modname) - - modpkgs.sort() - result = result + self.section( - 'PACKAGE CONTENTS', join(modpkgs, '\n')) - - # Detect submodules as sometimes created by C extensions - submodules = [] - for key, value in inspect.getmembers(object, inspect.ismodule): - if value.__name__.startswith(name + '.') and key not in modpkgs_names: - submodules.append(key) - if submodules: - submodules.sort() - result = result + self.section( - 'SUBMODULES', join(submodules, '\n')) - - if classes: - classlist = map(lambda key_value: key_value[1], classes) - contents = [self.formattree( - inspect.getclasstree(classlist, 1), name)] - for key, value in classes: - contents.append(self.document(value, key, name)) - result = result + self.section('CLASSES', join(contents, '\n')) - - if funcs: - contents = [] - for key, value in funcs: - contents.append(self.document(value, key, name)) - result = result + self.section('FUNCTIONS', join(contents, '\n')) - - if data: - contents = [] - for key, value in data: - contents.append(self.docother(value, key, name, maxlen=70)) - result = result + self.section('DATA', join(contents, '\n')) - - if hasattr(object, '__version__'): - version = _binstr(object.__version__) - if version[:11] == '$' + 'Revision: ' and version[-1:] == '$': - version = strip(version[11:-1]) - result = result + self.section('VERSION', version) - if hasattr(object, '__date__'): - result = result + self.section('DATE', _binstr(object.__date__)) - if hasattr(object, '__author__'): - result = result + self.section('AUTHOR', _binstr(object.__author__)) - if hasattr(object, '__credits__'): - result = result + self.section('CREDITS', _binstr(object.__credits__)) - return result - - def docclass(self, object, name=None, mod=None, *ignored): - """Produce text documentation for a given class object.""" - realname = object.__name__ - name = name or realname - bases = object.__bases__ - - def makename(c, m=object.__module__): - return classname(c, m) - - if name == realname: - title = 'class ' + self.bold(realname) - else: - title = self.bold(name) + ' = class ' + realname - if bases: - parents = map(makename, bases) - title = title + '(%s)' % join(parents, ', ') - - doc = getdoc(object) - contents = doc and [doc + '\n'] or [] - push = contents.append - - # List the mro, if non-trivial. - mro = deque(inspect.getmro(object)) - if len(mro) > 2: - push("Method resolution order:") - for base in mro: - push(' ' + makename(base)) - push('') - - # Cute little class to pump out a horizontal rule between sections. - class HorizontalRule: - def __init__(self): - self.needone = 0 - def maybe(self): - if self.needone: - push('-' * 70) - self.needone = 1 - hr = HorizontalRule() - - def spill(msg, attrs, predicate): - ok, attrs = _split_list(attrs, predicate) - if ok: - hr.maybe() - push(msg) - for name, kind, homecls, value in ok: - try: - value = getattr(object, name) - except Exception: - # Some descriptors may meet a failure in their __get__. - # (bug #1785) - push(self._docdescriptor(name, value, mod)) - else: - push(self.document(value, - name, mod, object)) - return attrs - - def spilldescriptors(msg, attrs, predicate): - ok, attrs = _split_list(attrs, predicate) - if ok: - hr.maybe() - push(msg) - for name, kind, homecls, value in ok: - push(self._docdescriptor(name, value, mod)) - return attrs - - def spilldata(msg, attrs, predicate): - ok, attrs = _split_list(attrs, predicate) - if ok: - hr.maybe() - push(msg) - for name, kind, homecls, value in ok: - if (hasattr(value, '__call__') or - inspect.isdatadescriptor(value)): - doc = getdoc(value) - else: - doc = None - push(self.docother(getattr(object, name), - name, mod, maxlen=70, doc=doc) + '\n') - return attrs - - attrs = filter(lambda data: visiblename(data[0], obj=object), - classify_class_attrs(object)) - while attrs: - if mro: - thisclass = mro.popleft() - else: - thisclass = attrs[0][2] - attrs, inherited = _split_list(attrs, lambda t: t[2] is thisclass) - - if thisclass is __builtin__.object: - attrs = inherited - continue - elif thisclass is object: - tag = "defined here" - else: - tag = "inherited from %s" % classname(thisclass, - object.__module__) - - # Sort attrs by name. - attrs.sort() - - # Pump out the attrs, segregated by kind. - attrs = spill("Methods %s:\n" % tag, attrs, - lambda t: t[1] == 'method') - attrs = spill("Class methods %s:\n" % tag, attrs, - lambda t: t[1] == 'class method') - attrs = spill("Static methods %s:\n" % tag, attrs, - lambda t: t[1] == 'static method') - attrs = spilldescriptors("Data descriptors %s:\n" % tag, attrs, - lambda t: t[1] == 'data descriptor') - attrs = spilldata("Data and other attributes %s:\n" % tag, attrs, - lambda t: t[1] == 'data') - assert attrs == [] - attrs = inherited - - contents = '\n'.join(contents) - if not contents: - return title + '\n' - return title + '\n' + self.indent(rstrip(contents), ' | ') + '\n' - - def formatvalue(self, object): - """Format an argument default value as text.""" - return '=' + self.repr(object) - - def docroutine(self, object, name=None, mod=None, cl=None): - """Produce text documentation for a function or method object.""" - realname = object.__name__ - name = name or realname - note = '' - skipdocs = 0 - if inspect.ismethod(object): - imclass = object.im_class - if cl: - if imclass is not cl: - note = ' from ' + classname(imclass, mod) - else: - if object.im_self is not None: - note = ' method of %s instance' % classname( - object.im_self.__class__, mod) - else: - note = ' unbound %s method' % classname(imclass,mod) - object = object.im_func - - if name == realname: - title = self.bold(realname) - else: - if (cl and realname in cl.__dict__ and - cl.__dict__[realname] is object): - skipdocs = 1 - title = self.bold(name) + ' = ' + realname - if inspect.isfunction(object): - args, varargs, varkw, defaults = inspect.getargspec(object) - argspec = inspect.formatargspec( - args, varargs, varkw, defaults, formatvalue=self.formatvalue) - if realname == '': - title = self.bold(name) + ' lambda ' - argspec = argspec[1:-1] # remove parentheses - else: - argspec = '(...)' - decl = title + argspec + note - - if skipdocs: - return decl + '\n' - else: - doc = getdoc(object) or '' - return decl + '\n' + (doc and rstrip(self.indent(doc)) + '\n') - - def _docdescriptor(self, name, value, mod): - results = [] - push = results.append - - if name: - push(self.bold(name)) - push('\n') - doc = getdoc(value) or '' - if doc: - push(self.indent(doc)) - push('\n') - return ''.join(results) - - def docproperty(self, object, name=None, mod=None, cl=None): - """Produce text documentation for a property.""" - return self._docdescriptor(name, object, mod) - - def docdata(self, object, name=None, mod=None, cl=None): - """Produce text documentation for a data descriptor.""" - return self._docdescriptor(name, object, mod) - - def docother(self, object, name=None, mod=None, parent=None, maxlen=None, doc=None): - """Produce text documentation for a data object.""" - repr = self.repr(object) - if maxlen: - line = (name and name + ' = ' or '') + repr - chop = maxlen - len(line) - if chop < 0: repr = repr[:chop] + '...' - line = (name and self.bold(name) + ' = ' or '') + repr - if doc is not None: - line += '\n' + self.indent(str(doc)) - return line - -# --------------------------------------------------------- user interfaces - -def pager(text): - """The first time this is called, determine what kind of pager to use.""" - global pager - pager = getpager() - pager(text) - -def getpager(): - """Decide what method to use for paging through text.""" - if type(sys.stdout) is not types.FileType: - return plainpager - if not hasattr(sys.stdin, "isatty"): - return plainpager - if not sys.stdin.isatty() or not sys.stdout.isatty(): - return plainpager - if 'PAGER' in os.environ: - if sys.platform == 'win32': # pipes completely broken in Windows - return lambda text: tempfilepager(plain(text), os.environ['PAGER']) - elif sys.platform == 'uefi': - return lambda text: tempfilepager(plain(text), os.environ['PAGER']) - elif os.environ.get('TERM') in ('dumb', 'emacs'): - return lambda text: pipepager(plain(text), os.environ['PAGER']) - else: - return lambda text: pipepager(text, os.environ['PAGER']) - if os.environ.get('TERM') in ('dumb', 'emacs'): - return plainpager - if sys.platform == 'uefi': - return plainpager - if sys.platform == 'win32' or sys.platform.startswith('os2'): - return lambda text: tempfilepager(plain(text), 'more <') - if hasattr(os, 'system') and os.system('(less) 2>/dev/null') == 0: - return lambda text: pipepager(text, 'less') - - import tempfile - (fd, filename) = tempfile.mkstemp() - os.close(fd) - try: - if hasattr(os, 'system') and os.system('more "%s"' % filename) == 0: - return lambda text: pipepager(text, 'more') - else: - return ttypager - finally: - os.unlink(filename) - -def plain(text): - """Remove boldface formatting from text.""" - return re.sub('.\b', '', text) - -def pipepager(text, cmd): - """Page through text by feeding it to another program.""" - pipe = os.popen(cmd, 'w') - try: - pipe.write(_encode(text)) - pipe.close() - except IOError: - pass # Ignore broken pipes caused by quitting the pager program. - -def tempfilepager(text, cmd): - """Page through text by invoking a program on a temporary file.""" - import tempfile - filename = tempfile.mktemp() - file = open(filename, 'w') - file.write(_encode(text)) - file.close() - try: - os.system(cmd + ' "' + filename + '"') - finally: - os.unlink(filename) - -def ttypager(text): - """Page through text on a text terminal.""" - lines = plain(_encode(plain(text), getattr(sys.stdout, 'encoding', _encoding))).split('\n') - try: - import tty - fd = sys.stdin.fileno() - old = tty.tcgetattr(fd) - tty.setcbreak(fd) - getchar = lambda: sys.stdin.read(1) - except (ImportError, AttributeError): - tty = None - getchar = lambda: sys.stdin.readline()[:-1][:1] - - try: - try: - h = int(os.environ.get('LINES', 0)) - except ValueError: - h = 0 - if h <= 1: - h = 25 - r = inc = h - 1 - sys.stdout.write(join(lines[:inc], '\n') + '\n') - while lines[r:]: - sys.stdout.write('-- more --') - sys.stdout.flush() - c = getchar() - - if c in ('q', 'Q'): - sys.stdout.write('\r \r') - break - elif c in ('\r', '\n'): - sys.stdout.write('\r \r' + lines[r] + '\n') - r = r + 1 - continue - if c in ('b', 'B', '\x1b'): - r = r - inc - inc - if r < 0: r = 0 - sys.stdout.write('\n' + join(lines[r:r+inc], '\n') + '\n') - r = r + inc - - finally: - if tty: - tty.tcsetattr(fd, tty.TCSAFLUSH, old) - -def plainpager(text): - """Simply print unformatted text. This is the ultimate fallback.""" - sys.stdout.write(_encode(plain(text), getattr(sys.stdout, 'encoding', _encoding))) - -def describe(thing): - """Produce a short description of the given thing.""" - if inspect.ismodule(thing): - if thing.__name__ in sys.builtin_module_names: - return 'built-in module ' + thing.__name__ - if hasattr(thing, '__path__'): - return 'package ' + thing.__name__ - else: - return 'module ' + thing.__name__ - if inspect.isbuiltin(thing): - return 'built-in function ' + thing.__name__ - if inspect.isgetsetdescriptor(thing): - return 'getset descriptor %s.%s.%s' % ( - thing.__objclass__.__module__, thing.__objclass__.__name__, - thing.__name__) - if inspect.ismemberdescriptor(thing): - return 'member descriptor %s.%s.%s' % ( - thing.__objclass__.__module__, thing.__objclass__.__name__, - thing.__name__) - if inspect.isclass(thing): - return 'class ' + thing.__name__ - if inspect.isfunction(thing): - return 'function ' + thing.__name__ - if inspect.ismethod(thing): - return 'method ' + thing.__name__ - if type(thing) is types.InstanceType: - return 'instance of ' + thing.__class__.__name__ - return type(thing).__name__ - -def locate(path, forceload=0): - """Locate an object by name or dotted path, importing as necessary.""" - parts = [part for part in split(path, '.') if part] - module, n = None, 0 - while n < len(parts): - nextmodule = safeimport(join(parts[:n+1], '.'), forceload) - if nextmodule: module, n = nextmodule, n + 1 - else: break - if module: - object = module - else: - object = __builtin__ - for part in parts[n:]: - try: - object = getattr(object, part) - except AttributeError: - return None - return object - -# --------------------------------------- interactive interpreter interface - -text = TextDoc() -html = HTMLDoc() - -class _OldStyleClass: pass -_OLD_INSTANCE_TYPE = type(_OldStyleClass()) - -def resolve(thing, forceload=0): - """Given an object or a path to an object, get the object and its name.""" - if isinstance(thing, str): - object = locate(thing, forceload) - if object is None: - raise ImportError, 'no Python documentation found for %r' % thing - return object, thing - else: - name = getattr(thing, '__name__', None) - return thing, name if isinstance(name, str) else None - -def render_doc(thing, title='Python Library Documentation: %s', forceload=0): - """Render text documentation, given an object or a path to an object.""" - object, name = resolve(thing, forceload) - desc = describe(object) - module = inspect.getmodule(object) - if name and '.' in name: - desc += ' in ' + name[:name.rfind('.')] - elif module and module is not object: - desc += ' in module ' + module.__name__ - if type(object) is _OLD_INSTANCE_TYPE: - # If the passed object is an instance of an old-style class, - # document its available methods instead of its value. - object = object.__class__ - elif not (inspect.ismodule(object) or - inspect.isclass(object) or - inspect.isroutine(object) or - inspect.isgetsetdescriptor(object) or - inspect.ismemberdescriptor(object) or - isinstance(object, property)): - # If the passed object is a piece of data or an instance, - # document its available methods instead of its value. - object = type(object) - desc += ' object' - return title % desc + '\n\n' + text.document(object, name) - -def doc(thing, title='Python Library Documentation: %s', forceload=0): - """Display text documentation, given an object or a path to an object.""" - try: - pager(render_doc(thing, title, forceload)) - except (ImportError, ErrorDuringImport), value: - print value - -def writedoc(thing, forceload=0): - """Write HTML documentation to a file in the current directory.""" - try: - object, name = resolve(thing, forceload) - page = html.page(describe(object), html.document(object, name)) - file = open(name + '.html', 'w') - file.write(page) - file.close() - print 'wrote', name + '.html' - except (ImportError, ErrorDuringImport), value: - print value - -def writedocs(dir, pkgpath='', done=None): - """Write out HTML documentation for all modules in a directory tree.""" - if done is None: done = {} - for importer, modname, ispkg in pkgutil.walk_packages([dir], pkgpath): - writedoc(modname) - return - -class Helper: - - # These dictionaries map a topic name to either an alias, or a tuple - # (label, seealso-items). The "label" is the label of the corresponding - # section in the .rst file under Doc/ and an index into the dictionary - # in pydoc_data/topics.py. - # - # CAUTION: if you change one of these dictionaries, be sure to adapt the - # list of needed labels in Doc/tools/pyspecific.py and - # regenerate the pydoc_data/topics.py file by running - # make pydoc-topics - # in Doc/ and copying the output file into the Lib/ directory. - - keywords = { - 'and': 'BOOLEAN', - 'as': 'with', - 'assert': ('assert', ''), - 'break': ('break', 'while for'), - 'class': ('class', 'CLASSES SPECIALMETHODS'), - 'continue': ('continue', 'while for'), - 'def': ('function', ''), - 'del': ('del', 'BASICMETHODS'), - 'elif': 'if', - 'else': ('else', 'while for'), - 'except': 'try', - 'exec': ('exec', ''), - 'finally': 'try', - 'for': ('for', 'break continue while'), - 'from': 'import', - 'global': ('global', 'NAMESPACES'), - 'if': ('if', 'TRUTHVALUE'), - 'import': ('import', 'MODULES'), - 'in': ('in', 'SEQUENCEMETHODS2'), - 'is': 'COMPARISON', - 'lambda': ('lambda', 'FUNCTIONS'), - 'not': 'BOOLEAN', - 'or': 'BOOLEAN', - 'pass': ('pass', ''), - 'print': ('print', ''), - 'raise': ('raise', 'EXCEPTIONS'), - 'return': ('return', 'FUNCTIONS'), - 'try': ('try', 'EXCEPTIONS'), - 'while': ('while', 'break continue if TRUTHVALUE'), - 'with': ('with', 'CONTEXTMANAGERS EXCEPTIONS yield'), - 'yield': ('yield', ''), - } - # Either add symbols to this dictionary or to the symbols dictionary - # directly: Whichever is easier. They are merged later. - _symbols_inverse = { - 'STRINGS' : ("'", "'''", "r'", "u'", '"""', '"', 'r"', 'u"'), - 'OPERATORS' : ('+', '-', '*', '**', '/', '//', '%', '<<', '>>', '&', - '|', '^', '~', '<', '>', '<=', '>=', '==', '!=', '<>'), - 'COMPARISON' : ('<', '>', '<=', '>=', '==', '!=', '<>'), - 'UNARY' : ('-', '~'), - 'AUGMENTEDASSIGNMENT' : ('+=', '-=', '*=', '/=', '%=', '&=', '|=', - '^=', '<<=', '>>=', '**=', '//='), - 'BITWISE' : ('<<', '>>', '&', '|', '^', '~'), - 'COMPLEX' : ('j', 'J') - } - symbols = { - '%': 'OPERATORS FORMATTING', - '**': 'POWER', - ',': 'TUPLES LISTS FUNCTIONS', - '.': 'ATTRIBUTES FLOAT MODULES OBJECTS', - '...': 'ELLIPSIS', - ':': 'SLICINGS DICTIONARYLITERALS', - '@': 'def class', - '\\': 'STRINGS', - '_': 'PRIVATENAMES', - '__': 'PRIVATENAMES SPECIALMETHODS', - '`': 'BACKQUOTES', - '(': 'TUPLES FUNCTIONS CALLS', - ')': 'TUPLES FUNCTIONS CALLS', - '[': 'LISTS SUBSCRIPTS SLICINGS', - ']': 'LISTS SUBSCRIPTS SLICINGS' - } - for topic, symbols_ in _symbols_inverse.iteritems(): - for symbol in symbols_: - topics = symbols.get(symbol, topic) - if topic not in topics: - topics = topics + ' ' + topic - symbols[symbol] = topics - - topics = { - 'TYPES': ('types', 'STRINGS UNICODE NUMBERS SEQUENCES MAPPINGS ' - 'FUNCTIONS CLASSES MODULES FILES inspect'), - 'STRINGS': ('strings', 'str UNICODE SEQUENCES STRINGMETHODS FORMATTING ' - 'TYPES'), - 'STRINGMETHODS': ('string-methods', 'STRINGS FORMATTING'), - 'FORMATTING': ('formatstrings', 'OPERATORS'), - 'UNICODE': ('strings', 'encodings unicode SEQUENCES STRINGMETHODS ' - 'FORMATTING TYPES'), - 'NUMBERS': ('numbers', 'INTEGER FLOAT COMPLEX TYPES'), - 'INTEGER': ('integers', 'int range'), - 'FLOAT': ('floating', 'float math'), - 'COMPLEX': ('imaginary', 'complex cmath'), - 'SEQUENCES': ('typesseq', 'STRINGMETHODS FORMATTING xrange LISTS'), - 'MAPPINGS': 'DICTIONARIES', - 'FUNCTIONS': ('typesfunctions', 'def TYPES'), - 'METHODS': ('typesmethods', 'class def CLASSES TYPES'), - 'CODEOBJECTS': ('bltin-code-objects', 'compile FUNCTIONS TYPES'), - 'TYPEOBJECTS': ('bltin-type-objects', 'types TYPES'), - 'FRAMEOBJECTS': 'TYPES', - 'TRACEBACKS': 'TYPES', - 'NONE': ('bltin-null-object', ''), - 'ELLIPSIS': ('bltin-ellipsis-object', 'SLICINGS'), - 'FILES': ('bltin-file-objects', ''), - 'SPECIALATTRIBUTES': ('specialattrs', ''), - 'CLASSES': ('types', 'class SPECIALMETHODS PRIVATENAMES'), - 'MODULES': ('typesmodules', 'import'), - 'PACKAGES': 'import', - 'EXPRESSIONS': ('operator-summary', 'lambda or and not in is BOOLEAN ' - 'COMPARISON BITWISE SHIFTING BINARY FORMATTING POWER ' - 'UNARY ATTRIBUTES SUBSCRIPTS SLICINGS CALLS TUPLES ' - 'LISTS DICTIONARIES BACKQUOTES'), - 'OPERATORS': 'EXPRESSIONS', - 'PRECEDENCE': 'EXPRESSIONS', - 'OBJECTS': ('objects', 'TYPES'), - 'SPECIALMETHODS': ('specialnames', 'BASICMETHODS ATTRIBUTEMETHODS ' - 'CALLABLEMETHODS SEQUENCEMETHODS1 MAPPINGMETHODS ' - 'SEQUENCEMETHODS2 NUMBERMETHODS CLASSES'), - 'BASICMETHODS': ('customization', 'cmp hash repr str SPECIALMETHODS'), - 'ATTRIBUTEMETHODS': ('attribute-access', 'ATTRIBUTES SPECIALMETHODS'), - 'CALLABLEMETHODS': ('callable-types', 'CALLS SPECIALMETHODS'), - 'SEQUENCEMETHODS1': ('sequence-types', 'SEQUENCES SEQUENCEMETHODS2 ' - 'SPECIALMETHODS'), - 'SEQUENCEMETHODS2': ('sequence-methods', 'SEQUENCES SEQUENCEMETHODS1 ' - 'SPECIALMETHODS'), - 'MAPPINGMETHODS': ('sequence-types', 'MAPPINGS SPECIALMETHODS'), - 'NUMBERMETHODS': ('numeric-types', 'NUMBERS AUGMENTEDASSIGNMENT ' - 'SPECIALMETHODS'), - 'EXECUTION': ('execmodel', 'NAMESPACES DYNAMICFEATURES EXCEPTIONS'), - 'NAMESPACES': ('naming', 'global ASSIGNMENT DELETION DYNAMICFEATURES'), - 'DYNAMICFEATURES': ('dynamic-features', ''), - 'SCOPING': 'NAMESPACES', - 'FRAMES': 'NAMESPACES', - 'EXCEPTIONS': ('exceptions', 'try except finally raise'), - 'COERCIONS': ('coercion-rules','CONVERSIONS'), - 'CONVERSIONS': ('conversions', 'COERCIONS'), - 'IDENTIFIERS': ('identifiers', 'keywords SPECIALIDENTIFIERS'), - 'SPECIALIDENTIFIERS': ('id-classes', ''), - 'PRIVATENAMES': ('atom-identifiers', ''), - 'LITERALS': ('atom-literals', 'STRINGS BACKQUOTES NUMBERS ' - 'TUPLELITERALS LISTLITERALS DICTIONARYLITERALS'), - 'TUPLES': 'SEQUENCES', - 'TUPLELITERALS': ('exprlists', 'TUPLES LITERALS'), - 'LISTS': ('typesseq-mutable', 'LISTLITERALS'), - 'LISTLITERALS': ('lists', 'LISTS LITERALS'), - 'DICTIONARIES': ('typesmapping', 'DICTIONARYLITERALS'), - 'DICTIONARYLITERALS': ('dict', 'DICTIONARIES LITERALS'), - 'BACKQUOTES': ('string-conversions', 'repr str STRINGS LITERALS'), - 'ATTRIBUTES': ('attribute-references', 'getattr hasattr setattr ' - 'ATTRIBUTEMETHODS'), - 'SUBSCRIPTS': ('subscriptions', 'SEQUENCEMETHODS1'), - 'SLICINGS': ('slicings', 'SEQUENCEMETHODS2'), - 'CALLS': ('calls', 'EXPRESSIONS'), - 'POWER': ('power', 'EXPRESSIONS'), - 'UNARY': ('unary', 'EXPRESSIONS'), - 'BINARY': ('binary', 'EXPRESSIONS'), - 'SHIFTING': ('shifting', 'EXPRESSIONS'), - 'BITWISE': ('bitwise', 'EXPRESSIONS'), - 'COMPARISON': ('comparisons', 'EXPRESSIONS BASICMETHODS'), - 'BOOLEAN': ('booleans', 'EXPRESSIONS TRUTHVALUE'), - 'ASSERTION': 'assert', - 'ASSIGNMENT': ('assignment', 'AUGMENTEDASSIGNMENT'), - 'AUGMENTEDASSIGNMENT': ('augassign', 'NUMBERMETHODS'), - 'DELETION': 'del', - 'PRINTING': 'print', - 'RETURNING': 'return', - 'IMPORTING': 'import', - 'CONDITIONAL': 'if', - 'LOOPING': ('compound', 'for while break continue'), - 'TRUTHVALUE': ('truth', 'if while and or not BASICMETHODS'), - 'DEBUGGING': ('debugger', 'pdb'), - 'CONTEXTMANAGERS': ('context-managers', 'with'), - } - - def __init__(self, input=None, output=None): - self._input = input - self._output = output - - input = property(lambda self: self._input or sys.stdin) - output = property(lambda self: self._output or sys.stdout) - - def __repr__(self): - if inspect.stack()[1][3] == '?': - self() - return '' - return '' - - _GoInteractive = object() - def __call__(self, request=_GoInteractive): - if request is not self._GoInteractive: - self.help(request) - else: - self.intro() - self.interact() - self.output.write(''' -You are now leaving help and returning to the Python interpreter. -If you want to ask for help on a particular object directly from the -interpreter, you can type "help(object)". Executing "help('string')" -has the same effect as typing a particular string at the help> prompt. -''') - - def interact(self): - self.output.write('\n') - while True: - try: - request = self.getline('help> ') - if not request: break - except (KeyboardInterrupt, EOFError): - break - request = strip(replace(request, '"', '', "'", '')) - if lower(request) in ('q', 'quit'): break - self.help(request) - - def getline(self, prompt): - """Read one line, using raw_input when available.""" - if self.input is sys.stdin: - return raw_input(prompt) - else: - self.output.write(prompt) - self.output.flush() - return self.input.readline() - - def help(self, request): - if type(request) is type(''): - request = request.strip() - if request == 'help': self.intro() - elif request == 'keywords': self.listkeywords() - elif request == 'symbols': self.listsymbols() - elif request == 'topics': self.listtopics() - elif request == 'modules': self.listmodules() - elif request[:8] == 'modules ': - self.listmodules(split(request)[1]) - elif request in self.symbols: self.showsymbol(request) - elif request in self.keywords: self.showtopic(request) - elif request in self.topics: self.showtopic(request) - elif request: doc(request, 'Help on %s:') - elif isinstance(request, Helper): self() - else: doc(request, 'Help on %s:') - self.output.write('\n') - - def intro(self): - self.output.write(''' -Welcome to Python %s! This is the online help utility. - -If this is your first time using Python, you should definitely check out -the tutorial on the Internet at http://docs.python.org/%s/tutorial/. - -Enter the name of any module, keyword, or topic to get help on writing -Python programs and using Python modules. To quit this help utility and -return to the interpreter, just type "quit". - -To get a list of available modules, keywords, or topics, type "modules", -"keywords", or "topics". Each module also comes with a one-line summary -of what it does; to list the modules whose summaries contain a given word -such as "spam", type "modules spam". -''' % tuple([sys.version[:3]]*2)) - - def list(self, items, columns=4, width=80): - items = items[:] - items.sort() - colw = width / columns - rows = (len(items) + columns - 1) / columns - for row in range(rows): - for col in range(columns): - i = col * rows + row - if i < len(items): - self.output.write(items[i]) - if col < columns - 1: - self.output.write(' ' + ' ' * (colw-1 - len(items[i]))) - self.output.write('\n') - - def listkeywords(self): - self.output.write(''' -Here is a list of the Python keywords. Enter any keyword to get more help. - -''') - self.list(self.keywords.keys()) - - def listsymbols(self): - self.output.write(''' -Here is a list of the punctuation symbols which Python assigns special meaning -to. Enter any symbol to get more help. - -''') - self.list(self.symbols.keys()) - - def listtopics(self): - self.output.write(''' -Here is a list of available topics. Enter any topic name to get more help. - -''') - self.list(self.topics.keys()) - - def showtopic(self, topic, more_xrefs=''): - try: - import pydoc_data.topics - except ImportError: - self.output.write(''' -Sorry, topic and keyword documentation is not available because the -module "pydoc_data.topics" could not be found. -''') - return - target = self.topics.get(topic, self.keywords.get(topic)) - if not target: - self.output.write('no documentation found for %s\n' % repr(topic)) - return - if type(target) is type(''): - return self.showtopic(target, more_xrefs) - - label, xrefs = target - try: - doc = pydoc_data.topics.topics[label] - except KeyError: - self.output.write('no documentation found for %s\n' % repr(topic)) - return - pager(strip(doc) + '\n') - if more_xrefs: - xrefs = (xrefs or '') + ' ' + more_xrefs - if xrefs: - import StringIO, formatter - buffer = StringIO.StringIO() - formatter.DumbWriter(buffer).send_flowing_data( - 'Related help topics: ' + join(split(xrefs), ', ') + '\n') - self.output.write('\n%s\n' % buffer.getvalue()) - - def showsymbol(self, symbol): - target = self.symbols[symbol] - topic, _, xrefs = target.partition(' ') - self.showtopic(topic, xrefs) - - def listmodules(self, key=''): - if key: - self.output.write(''' -Here is a list of matching modules. Enter any module name to get more help. - -''') - apropos(key) - else: - self.output.write(''' -Please wait a moment while I gather a list of all available modules... - -''') - modules = {} - def callback(path, modname, desc, modules=modules): - if modname and modname[-9:] == '.__init__': - modname = modname[:-9] + ' (package)' - if find(modname, '.') < 0: - modules[modname] = 1 - def onerror(modname): - callback(None, modname, None) - ModuleScanner().run(callback, onerror=onerror) - self.list(modules.keys()) - self.output.write(''' -Enter any module name to get more help. Or, type "modules spam" to search -for modules whose descriptions contain the word "spam". -''') - -help = Helper() - -class Scanner: - """A generic tree iterator.""" - def __init__(self, roots, children, descendp): - self.roots = roots[:] - self.state = [] - self.children = children - self.descendp = descendp - - def next(self): - if not self.state: - if not self.roots: - return None - root = self.roots.pop(0) - self.state = [(root, self.children(root))] - node, children = self.state[-1] - if not children: - self.state.pop() - return self.next() - child = children.pop(0) - if self.descendp(child): - self.state.append((child, self.children(child))) - return child - - -class ModuleScanner: - """An interruptible scanner that searches module synopses.""" - - def run(self, callback, key=None, completer=None, onerror=None): - if key: key = lower(key) - self.quit = False - seen = {} - - for modname in sys.builtin_module_names: - if modname != '__main__': - seen[modname] = 1 - if key is None: - callback(None, modname, '') - else: - desc = split(__import__(modname).__doc__ or '', '\n')[0] - if find(lower(modname + ' - ' + desc), key) >= 0: - callback(None, modname, desc) - - for importer, modname, ispkg in pkgutil.walk_packages(onerror=onerror): - if self.quit: - break - if key is None: - callback(None, modname, '') - else: - loader = importer.find_module(modname) - if hasattr(loader,'get_source'): - import StringIO - desc = source_synopsis( - StringIO.StringIO(loader.get_source(modname)) - ) or '' - if hasattr(loader,'get_filename'): - path = loader.get_filename(modname) - else: - path = None - else: - module = loader.load_module(modname) - desc = module.__doc__.splitlines()[0] if module.__doc__ else '' - path = getattr(module,'__file__',None) - if find(lower(modname + ' - ' + desc), key) >= 0: - callback(path, modname, desc) - - if completer: - completer() - -def apropos(key): - """Print all the one-line module summaries that contain a substring.""" - def callback(path, modname, desc): - if modname[-9:] == '.__init__': - modname = modname[:-9] + ' (package)' - print modname, desc and '- ' + desc - def onerror(modname): - pass - with warnings.catch_warnings(): - warnings.filterwarnings('ignore') # ignore problems during import - ModuleScanner().run(callback, key, onerror=onerror) - -# --------------------------------------------------- web browser interface - -def serve(port, callback=None, completer=None): - import BaseHTTPServer, mimetools, select - - # Patch up mimetools.Message so it doesn't break if rfc822 is reloaded. - class Message(mimetools.Message): - def __init__(self, fp, seekable=1): - Message = self.__class__ - Message.__bases__[0].__bases__[0].__init__(self, fp, seekable) - self.encodingheader = self.getheader('content-transfer-encoding') - self.typeheader = self.getheader('content-type') - self.parsetype() - self.parseplist() - - class DocHandler(BaseHTTPServer.BaseHTTPRequestHandler): - def send_document(self, title, contents): - try: - self.send_response(200) - self.send_header('Content-Type', 'text/html') - self.end_headers() - self.wfile.write(html.page(title, contents)) - except IOError: pass - - def do_GET(self): - path = self.path - if path[-5:] == '.html': path = path[:-5] - if path[:1] == '/': path = path[1:] - if path and path != '.': - try: - obj = locate(path, forceload=1) - except ErrorDuringImport, value: - self.send_document(path, html.escape(str(value))) - return - if obj: - self.send_document(describe(obj), html.document(obj, path)) - else: - self.send_document(path, -'no Python documentation found for %s' % repr(path)) - else: - heading = html.heading( -'Python: Index of Modules', -'#ffffff', '#7799ee') - def bltinlink(name): - return '%s' % (name, name) - names = filter(lambda x: x != '__main__', - sys.builtin_module_names) - contents = html.multicolumn(names, bltinlink) - indices = ['

' + html.bigsection( - 'Built-in Modules', '#ffffff', '#ee77aa', contents)] - - seen = {} - for dir in sys.path: - indices.append(html.index(dir, seen)) - contents = heading + join(indices) + '''

- -pydoc by Ka-Ping Yee <ping@lfw.org>''' - self.send_document('Index of Modules', contents) - - def log_message(self, *args): pass - - class DocServer(BaseHTTPServer.HTTPServer): - def __init__(self, port, callback): - host = 'localhost' - self.address = (host, port) - self.callback = callback - self.base.__init__(self, self.address, self.handler) - - def serve_until_quit(self): - import select - self.quit = False - while not self.quit: - rd, wr, ex = select.select([self.socket.fileno()], [], [], 1) - if rd: self.handle_request() - - def server_activate(self): - self.base.server_activate(self) - self.url = 'http://%s:%d/' % (self.address[0], self.server_port) - if self.callback: self.callback(self) - - DocServer.base = BaseHTTPServer.HTTPServer - DocServer.handler = DocHandler - DocHandler.MessageClass = Message - try: - try: - DocServer(port, callback).serve_until_quit() - except (KeyboardInterrupt, select.error): - pass - finally: - if completer: completer() - -# ----------------------------------------------------- graphical interface - -def gui(): - """Graphical interface (starts web server and pops up a control window).""" - class GUI: - def __init__(self, window, port=7464): - self.window = window - self.server = None - self.scanner = None - - import Tkinter - self.server_frm = Tkinter.Frame(window) - self.title_lbl = Tkinter.Label(self.server_frm, - text='Starting server...\n ') - self.open_btn = Tkinter.Button(self.server_frm, - text='open browser', command=self.open, state='disabled') - self.quit_btn = Tkinter.Button(self.server_frm, - text='quit serving', command=self.quit, state='disabled') - - self.search_frm = Tkinter.Frame(window) - self.search_lbl = Tkinter.Label(self.search_frm, text='Search for') - self.search_ent = Tkinter.Entry(self.search_frm) - self.search_ent.bind('', self.search) - self.stop_btn = Tkinter.Button(self.search_frm, - text='stop', pady=0, command=self.stop, state='disabled') - if sys.platform == 'win32': - # Trying to hide and show this button crashes under Windows. - self.stop_btn.pack(side='right') - - self.window.title('pydoc') - self.window.protocol('WM_DELETE_WINDOW', self.quit) - self.title_lbl.pack(side='top', fill='x') - self.open_btn.pack(side='left', fill='x', expand=1) - self.quit_btn.pack(side='right', fill='x', expand=1) - self.server_frm.pack(side='top', fill='x') - - self.search_lbl.pack(side='left') - self.search_ent.pack(side='right', fill='x', expand=1) - self.search_frm.pack(side='top', fill='x') - self.search_ent.focus_set() - - font = ('helvetica', sys.platform == 'win32' and 8 or 10) - self.result_lst = Tkinter.Listbox(window, font=font, height=6) - self.result_lst.bind('', self.select) - self.result_lst.bind('', self.goto) - self.result_scr = Tkinter.Scrollbar(window, - orient='vertical', command=self.result_lst.yview) - self.result_lst.config(yscrollcommand=self.result_scr.set) - - self.result_frm = Tkinter.Frame(window) - self.goto_btn = Tkinter.Button(self.result_frm, - text='go to selected', command=self.goto) - self.hide_btn = Tkinter.Button(self.result_frm, - text='hide results', command=self.hide) - self.goto_btn.pack(side='left', fill='x', expand=1) - self.hide_btn.pack(side='right', fill='x', expand=1) - - self.window.update() - self.minwidth = self.window.winfo_width() - self.minheight = self.window.winfo_height() - self.bigminheight = (self.server_frm.winfo_reqheight() + - self.search_frm.winfo_reqheight() + - self.result_lst.winfo_reqheight() + - self.result_frm.winfo_reqheight()) - self.bigwidth, self.bigheight = self.minwidth, self.bigminheight - self.expanded = 0 - self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight)) - self.window.wm_minsize(self.minwidth, self.minheight) - self.window.tk.willdispatch() - - import threading - threading.Thread( - target=serve, args=(port, self.ready, self.quit)).start() - - def ready(self, server): - self.server = server - self.title_lbl.config( - text='Python documentation server at\n' + server.url) - self.open_btn.config(state='normal') - self.quit_btn.config(state='normal') - - def open(self, event=None, url=None): - url = url or self.server.url - try: - import webbrowser - webbrowser.open(url) - except ImportError: # pre-webbrowser.py compatibility - if sys.platform == 'win32': - os.system('start "%s"' % url) - else: - rc = os.system('netscape -remote "openURL(%s)" &' % url) - if rc: os.system('netscape "%s" &' % url) - - def quit(self, event=None): - if self.server: - self.server.quit = 1 - self.window.quit() - - def search(self, event=None): - key = self.search_ent.get() - self.stop_btn.pack(side='right') - self.stop_btn.config(state='normal') - self.search_lbl.config(text='Searching for "%s"...' % key) - self.search_ent.forget() - self.search_lbl.pack(side='left') - self.result_lst.delete(0, 'end') - self.goto_btn.config(state='disabled') - self.expand() - - import threading - if self.scanner: - self.scanner.quit = 1 - self.scanner = ModuleScanner() - threading.Thread(target=self.scanner.run, - args=(self.update, key, self.done)).start() - - def update(self, path, modname, desc): - if modname[-9:] == '.__init__': - modname = modname[:-9] + ' (package)' - self.result_lst.insert('end', - modname + ' - ' + (desc or '(no description)')) - - def stop(self, event=None): - if self.scanner: - self.scanner.quit = 1 - self.scanner = None - - def done(self): - self.scanner = None - self.search_lbl.config(text='Search for') - self.search_lbl.pack(side='left') - self.search_ent.pack(side='right', fill='x', expand=1) - if sys.platform != 'win32': self.stop_btn.forget() - self.stop_btn.config(state='disabled') - - def select(self, event=None): - self.goto_btn.config(state='normal') - - def goto(self, event=None): - selection = self.result_lst.curselection() - if selection: - modname = split(self.result_lst.get(selection[0]))[0] - self.open(url=self.server.url + modname + '.html') - - def collapse(self): - if not self.expanded: return - self.result_frm.forget() - self.result_scr.forget() - self.result_lst.forget() - self.bigwidth = self.window.winfo_width() - self.bigheight = self.window.winfo_height() - self.window.wm_geometry('%dx%d' % (self.minwidth, self.minheight)) - self.window.wm_minsize(self.minwidth, self.minheight) - self.expanded = 0 - - def expand(self): - if self.expanded: return - self.result_frm.pack(side='bottom', fill='x') - self.result_scr.pack(side='right', fill='y') - self.result_lst.pack(side='top', fill='both', expand=1) - self.window.wm_geometry('%dx%d' % (self.bigwidth, self.bigheight)) - self.window.wm_minsize(self.minwidth, self.bigminheight) - self.expanded = 1 - - def hide(self, event=None): - self.stop() - self.collapse() - - import Tkinter - try: - root = Tkinter.Tk() - # Tk will crash if pythonw.exe has an XP .manifest - # file and the root has is not destroyed explicitly. - # If the problem is ever fixed in Tk, the explicit - # destroy can go. - try: - gui = GUI(root) - root.mainloop() - finally: - root.destroy() - except KeyboardInterrupt: - pass - -# -------------------------------------------------- command-line interface - -def ispath(x): - return isinstance(x, str) and find(x, os.sep) >= 0 - -def cli(): - """Command-line interface (looks at sys.argv to decide what to do).""" - import getopt - class BadUsage: pass - - # Scripts don't get the current directory in their path by default - # unless they are run with the '-m' switch - if '' not in sys.path: - scriptdir = os.path.dirname(sys.argv[0]) - if scriptdir in sys.path: - sys.path.remove(scriptdir) - sys.path.insert(0, '.') - - try: - opts, args = getopt.getopt(sys.argv[1:], 'gk:p:w') - writing = 0 - - for opt, val in opts: - if opt == '-g': - gui() - return - if opt == '-k': - apropos(val) - return - if opt == '-p': - try: - port = int(val) - except ValueError: - raise BadUsage - def ready(server): - print 'pydoc server ready at %s' % server.url - def stopped(): - print 'pydoc server stopped' - serve(port, ready, stopped) - return - if opt == '-w': - writing = 1 - - if not args: raise BadUsage - for arg in args: - if ispath(arg) and not os.path.exists(arg): - print 'file %r does not exist' % arg - break - try: - if ispath(arg) and os.path.isfile(arg): - arg = importfile(arg) - if writing: - if ispath(arg) and os.path.isdir(arg): - writedocs(arg) - else: - writedoc(arg) - else: - help.help(arg) - except ErrorDuringImport, value: - print value - - except (getopt.error, BadUsage): - cmd = os.path.basename(sys.argv[0]) - print """pydoc - the Python documentation tool - -%s ... - Show text documentation on something. may be the name of a - Python keyword, topic, function, module, or package, or a dotted - reference to a class or function within a module or module in a - package. If contains a '%s', it is used as the path to a - Python source file to document. If name is 'keywords', 'topics', - or 'modules', a listing of these things is displayed. - -%s -k - Search for a keyword in the synopsis lines of all available modules. - -%s -p - Start an HTTP server on the given port on the local machine. Port - number 0 can be used to get an arbitrary unused port. - -%s -g - Pop up a graphical interface for finding and serving documentation. - -%s -w ... - Write out the HTML documentation for a module to a file in the current - directory. If contains a '%s', it is treated as a filename; if - it names a directory, documentation is written for all the contents. -""" % (cmd, os.sep, cmd, cmd, cmd, cmd, os.sep) - -if __name__ == '__main__': cli() diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/site.py b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/site.py deleted file mode 100644 index e397b9d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Lib/site.py +++ /dev/null @@ -1,531 +0,0 @@ -"""Append module search paths for third-party packages to sys.path. - -**************************************************************** -* This module is automatically imported during initialization. * -**************************************************************** - -This is a UEFI-specific version of site.py. - -In earlier versions of Python (up to 1.5a3), scripts or modules that -needed to use site-specific modules would place ``import site'' -somewhere near the top of their code. Because of the automatic -import, this is no longer necessary (but code that does it still -works). - -This will append site-specific paths to the module search path. It starts with sys.prefix and -sys.exec_prefix (if different) and appends -lib/python/site-packages as well as lib/site-python. -The -resulting directories, if they exist, are appended to sys.path, and -also inspected for path configuration files. - -A path configuration file is a file whose name has the form -.pth; its contents are additional directories (one per line) -to be added to sys.path. Non-existing directories (or -non-directories) are never added to sys.path; no directory is added to -sys.path more than once. Blank lines and lines beginning with -'#' are skipped. Lines starting with 'import' are executed. - -For example, suppose sys.prefix and sys.exec_prefix are set to -/Efi/StdLib and there is a directory /Efi/StdLib/lib/python27.10/site-packages -with three subdirectories, foo, bar and spam, and two path -configuration files, foo.pth and bar.pth. Assume foo.pth contains the -following: - - # foo package configuration - foo - bar - bletch - -and bar.pth contains: - - # bar package configuration - bar - -Then the following directories are added to sys.path, in this order: - - /Efi/StdLib/lib/python27.10/site-packages/bar - /Efi/StdLib/lib/python27.10/site-packages/foo - -Note that bletch is omitted because it doesn't exist; bar precedes foo -because bar.pth comes alphabetically before foo.pth; and spam is -omitted because it is not mentioned in either path configuration file. - -After these path manipulations, an attempt is made to import a module -named sitecustomize, which can perform arbitrary additional -site-specific customizations. If this import fails with an -ImportError exception, it is silently ignored. - -Copyright (c) 2015, Daryl McDaniel. All rights reserved.
-Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
-This program and the accompanying materials are licensed and made available under -the terms and conditions of the BSD License that accompanies this distribution. -The full text of the license may be found at -http://opensource.org/licenses/bsd-license. - -THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -""" - -import sys -import os -import __builtin__ -import traceback - -# Prefixes for site-packages; add additional prefixes like /usr/local here -PREFIXES = [sys.prefix, sys.exec_prefix] -# Enable per user site-packages directory -# set it to False to disable the feature or True to force the feature -ENABLE_USER_SITE = False - -# for distutils.commands.install -# These values are initialized by the getuserbase() and getusersitepackages() -# functions, through the main() function when Python starts. -USER_SITE = None -USER_BASE = None - - -def makepath(*paths): - dir = os.path.join(*paths) - try: - dir = os.path.abspath(dir) - except OSError: - pass - return dir, os.path.normcase(dir) - - -def abs__file__(): - """Set all module' __file__ attribute to an absolute path""" - for m in sys.modules.values(): - if hasattr(m, '__loader__'): - continue # don't mess with a PEP 302-supplied __file__ - try: - m.__file__ = os.path.abspath(m.__file__) - except (AttributeError, OSError): - pass - - -def removeduppaths(): - """ Remove duplicate entries from sys.path along with making them - absolute""" - # This ensures that the initial path provided by the interpreter contains - # only absolute pathnames, even if we're running from the build directory. - L = [] - known_paths = set() - for dir in sys.path: - # Filter out duplicate paths (on case-insensitive file systems also - # if they only differ in case); turn relative paths into absolute - # paths. - dir, dircase = makepath(dir) - if not dircase in known_paths: - L.append(dir) - known_paths.add(dircase) - sys.path[:] = L - return known_paths - - -def _init_pathinfo(): - """Return a set containing all existing directory entries from sys.path""" - d = set() - for dir in sys.path: - try: - if os.path.isdir(dir): - dir, dircase = makepath(dir) - d.add(dircase) - except TypeError: - continue - return d - - -def addpackage(sitedir, name, known_paths): - """Process a .pth file within the site-packages directory: - For each line in the file, either combine it with sitedir to a path - and add that to known_paths, or execute it if it starts with 'import '. - """ - if known_paths is None: - _init_pathinfo() - reset = 1 - else: - reset = 0 - fullname = os.path.join(sitedir, name) - try: - f = open(fullname, "rU") - except IOError: - return - with f: - for n, line in enumerate(f): - if line.startswith("#"): - continue - try: - if line.startswith(("import ", "import\t")): - exec line - continue - line = line.rstrip() - dir, dircase = makepath(sitedir, line) - if not dircase in known_paths and os.path.exists(dir): - sys.path.append(dir) - known_paths.add(dircase) - except Exception as err: - print >>sys.stderr, "Error processing line {:d} of {}:\n".format( - n+1, fullname) - for record in traceback.format_exception(*sys.exc_info()): - for line in record.splitlines(): - print >>sys.stderr, ' '+line - print >>sys.stderr, "\nRemainder of file ignored" - break - if reset: - known_paths = None - return known_paths - - -def addsitedir(sitedir, known_paths=None): - """Add 'sitedir' argument to sys.path if missing and handle .pth files in - 'sitedir'""" - if known_paths is None: - known_paths = _init_pathinfo() - reset = 1 - else: - reset = 0 - sitedir, sitedircase = makepath(sitedir) - if not sitedircase in known_paths: - sys.path.append(sitedir) # Add path component - try: - names = os.listdir(sitedir) - except os.error: - return - dotpth = os.extsep + "pth" - names = [name for name in names if name.endswith(dotpth)] - for name in sorted(names): - addpackage(sitedir, name, known_paths) - if reset: - known_paths = None - return known_paths - - -def check_enableusersite(): - """Check if user site directory is safe for inclusion - - The function tests for the command line flag (including environment var), - process uid/gid equal to effective uid/gid. - - None: Disabled for security reasons - False: Disabled by user (command line option) - True: Safe and enabled - """ - if sys.flags.no_user_site: - return False - - if hasattr(os, "getuid") and hasattr(os, "geteuid"): - # check process uid == effective uid - if os.geteuid() != os.getuid(): - return None - if hasattr(os, "getgid") and hasattr(os, "getegid"): - # check process gid == effective gid - if os.getegid() != os.getgid(): - return None - - return True - -def getuserbase(): - """Returns the `user base` directory path. - - The `user base` directory can be used to store data. If the global - variable ``USER_BASE`` is not initialized yet, this function will also set - it. - """ - global USER_BASE - if USER_BASE is not None: - return USER_BASE - from sysconfig import get_config_var - USER_BASE = get_config_var('userbase') - return USER_BASE - -def getusersitepackages(): - """Returns the user-specific site-packages directory path. - - If the global variable ``USER_SITE`` is not initialized yet, this - function will also set it. - """ - global USER_SITE - user_base = getuserbase() # this will also set USER_BASE - - if USER_SITE is not None: - return USER_SITE - - from sysconfig import get_path - import os - - USER_SITE = get_path('purelib', '%s_user' % os.name) - return USER_SITE - -def addusersitepackages(known_paths): - """Add a per user site-package to sys.path - - Each user has its own python directory with site-packages in the - home directory. - """ - if ENABLE_USER_SITE and os.path.isdir(user_site): - # get the per user site-package path - # this call will also make sure USER_BASE and USER_SITE are set - user_site = getusersitepackages() - - addsitedir(user_site, known_paths) - return known_paths - -def getsitepackages(): - """Returns a list containing all global site-packages directories - (and possibly site-python). - - For each directory present in the global ``PREFIXES``, this function - will find its `site-packages` subdirectory depending on the system - environment, and will return a list of full paths. - """ - sitepackages = [] - seen = set() - - for prefix in PREFIXES: - if not prefix or prefix in seen: - continue - seen.add(prefix) - - ix = sys.version.find(' ') - if ix != -1: - micro = sys.version[4:ix] - else: - micro = '0' - - sitepackages.append(os.path.join(prefix, "lib", - "python" + sys.version[0] + sys.version[2] + '.' + micro, - "site-packages")) - sitepackages.append(os.path.join(prefix, "lib", "site-python")) - return sitepackages - -def addsitepackages(known_paths): - """Add site-packages (and possibly site-python) to sys.path""" - for sitedir in getsitepackages(): - if os.path.isdir(sitedir): - addsitedir(sitedir, known_paths) - - return known_paths - -def setBEGINLIBPATH(): - """The UEFI port has optional extension modules that do double duty - as DLLs (even though they have .efi file extensions) for other extensions. - The library search path needs to be amended so these will be found - during module import. Use BEGINLIBPATH so that these are at the start - of the library search path. - - """ - dllpath = os.path.join(sys.prefix, "Lib", "lib-dynload") - libpath = os.environ['BEGINLIBPATH'].split(os.path.pathsep) - if libpath[-1]: - libpath.append(dllpath) - else: - libpath[-1] = dllpath - os.environ['BEGINLIBPATH'] = os.path.pathsep.join(libpath) - - -def setquit(): - """Define new builtins 'quit' and 'exit'. - - These are objects which make the interpreter exit when called. - The repr of each object contains a hint at how it works. - - """ - eof = 'Ctrl-D (i.e. EOF)' - - class Quitter(object): - def __init__(self, name): - self.name = name - def __repr__(self): - return 'Use %s() or %s to exit' % (self.name, eof) - def __call__(self, code=None): - # Shells like IDLE catch the SystemExit, but listen when their - # stdin wrapper is closed. - try: - sys.stdin.close() - except: - pass - raise SystemExit(code) - __builtin__.quit = Quitter('quit') - __builtin__.exit = Quitter('exit') - - -class _Printer(object): - """interactive prompt objects for printing the license text, a list of - contributors and the copyright notice.""" - - MAXLINES = 23 - - def __init__(self, name, data, files=(), dirs=()): - self.__name = name - self.__data = data - self.__files = files - self.__dirs = dirs - self.__lines = None - - def __setup(self): - if self.__lines: - return - data = None - for dir in self.__dirs: - for filename in self.__files: - filename = os.path.join(dir, filename) - try: - fp = file(filename, "rU") - data = fp.read() - fp.close() - break - except IOError: - pass - if data: - break - if not data: - data = self.__data - self.__lines = data.split('\n') - self.__linecnt = len(self.__lines) - - def __repr__(self): - self.__setup() - if len(self.__lines) <= self.MAXLINES: - return "\n".join(self.__lines) - else: - return "Type %s() to see the full %s text" % ((self.__name,)*2) - - def __call__(self): - self.__setup() - prompt = 'Hit Return for more, or q (and Return) to quit: ' - lineno = 0 - while 1: - try: - for i in range(lineno, lineno + self.MAXLINES): - print self.__lines[i] - except IndexError: - break - else: - lineno += self.MAXLINES - key = None - while key is None: - key = raw_input(prompt) - if key not in ('', 'q'): - key = None - if key == 'q': - break - -def setcopyright(): - """Set 'copyright' and 'credits' in __builtin__""" - __builtin__.copyright = _Printer("copyright", sys.copyright) - __builtin__.credits = _Printer("credits", """\ - Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands - for supporting Python development. See www.python.org for more information.""") - here = os.path.dirname(os.__file__) - __builtin__.license = _Printer( - "license", "See https://www.python.org/psf/license/", - ["LICENSE.txt", "LICENSE"], - [os.path.join(here, os.pardir), here, os.curdir]) - - -class _Helper(object): - """Define the builtin 'help'. - This is a wrapper around pydoc.help (with a twist). - - """ - - def __repr__(self): - return "Type help() for interactive help, " \ - "or help(object) for help about object." - def __call__(self, *args, **kwds): - import pydoc - return pydoc.help(*args, **kwds) - -def sethelper(): - __builtin__.help = _Helper() - -def setencoding(): - """Set the string encoding used by the Unicode implementation. The - default is 'ascii', but if you're willing to experiment, you can - change this.""" - encoding = "ascii" # Default value set by _PyUnicode_Init() - if 0: - # Enable to support locale aware default string encodings. - import locale - loc = locale.getdefaultlocale() - if loc[1]: - encoding = loc[1] - if 0: - # Enable to switch off string to Unicode coercion and implicit - # Unicode to string conversion. - encoding = "undefined" - if encoding != "ascii": - # On Non-Unicode builds this will raise an AttributeError... - sys.setdefaultencoding(encoding) # Needs Python Unicode build ! - - -def execsitecustomize(): - """Run custom site specific code, if available.""" - try: - import sitecustomize - except ImportError: - pass - except Exception: - if sys.flags.verbose: - sys.excepthook(*sys.exc_info()) - else: - print >>sys.stderr, \ - "'import sitecustomize' failed; use -v for traceback" - - -def execusercustomize(): - """Run custom user specific code, if available.""" - try: - import usercustomize - except ImportError: - pass - except Exception: - if sys.flags.verbose: - sys.excepthook(*sys.exc_info()) - else: - print>>sys.stderr, \ - "'import usercustomize' failed; use -v for traceback" - - -def main(): - global ENABLE_USER_SITE - - abs__file__() - known_paths = removeduppaths() - if ENABLE_USER_SITE is None: - ENABLE_USER_SITE = check_enableusersite() - known_paths = addusersitepackages(known_paths) - known_paths = addsitepackages(known_paths) - setquit() - setcopyright() - sethelper() - setencoding() - execsitecustomize() - # Remove sys.setdefaultencoding() so that users cannot change the - # encoding after initialization. The test for presence is needed when - # this module is run as a script, because this code is executed twice. - if hasattr(sys, "setdefaultencoding"): - del sys.setdefaultencoding - -main() - -def _script(): - help = """\ - %s - - Path elements are normally separated by '%s'. - """ - - print "sys.path = [" - for dir in sys.path: - print " %r," % (dir,) - print "]" - - import textwrap - print textwrap.dedent(help % (sys.argv[0], os.pathsep)) - sys.exit(0) - -if __name__ == '__main__': - _script() diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/_sre.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/_sre.c deleted file mode 100644 index d6fd806..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/_sre.c +++ /dev/null @@ -1,4048 +0,0 @@ -/* - * Secret Labs' Regular Expression Engine - * - * regular expression matching engine - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - * - * partial history: - * 1999-10-24 fl created (based on existing template matcher code) - * 2000-03-06 fl first alpha, sort of - * 2000-08-01 fl fixes for 1.6b1 - * 2000-08-07 fl use PyOS_CheckStack() if available - * 2000-09-20 fl added expand method - * 2001-03-20 fl lots of fixes for 2.1b2 - * 2001-04-15 fl export copyright as Python attribute, not global - * 2001-04-28 fl added __copy__ methods (work in progress) - * 2001-05-14 fl fixes for 1.5.2 compatibility - * 2001-07-01 fl added BIGCHARSET support (from Martin von Loewis) - * 2001-10-18 fl fixed group reset issue (from Matthew Mueller) - * 2001-10-20 fl added split primitive; reenable unicode for 1.6/2.0/2.1 - * 2001-10-21 fl added sub/subn primitive - * 2001-10-24 fl added finditer primitive (for 2.2 only) - * 2001-12-07 fl fixed memory leak in sub/subn (Guido van Rossum) - * 2002-11-09 fl fixed empty sub/subn return type - * 2003-04-18 mvl fully support 4-byte codes - * 2003-10-17 gn implemented non recursive scheme - * - * Copyright (c) 1997-2001 by Secret Labs AB. All rights reserved. - * - * This version of the SRE library can be redistributed under CNRI's - * Python 1.6 license. For any other use, please contact Secret Labs - * AB (info@pythonware.com). - * - * Portions of this engine have been developed in cooperation with - * CNRI. Hewlett-Packard provided funding for 1.6 integration and - * other compatibility work. - */ - -/* Get rid of these macros to prevent collisions between EFI and Python in this file. */ -#undef RETURN_ERROR -#undef RETURN_SUCCESS - -#ifndef SRE_RECURSIVE - -static char copyright[] = - " SRE 2.2.2 Copyright (c) 1997-2002 by Secret Labs AB "; - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "structmember.h" /* offsetof */ - -#include "sre.h" - -#include - -/* name of this module, minus the leading underscore */ -#if !defined(SRE_MODULE) -#define SRE_MODULE "sre" -#endif - -#define SRE_PY_MODULE "re" - -/* defining this one enables tracing */ -#undef VERBOSE - -#if PY_VERSION_HEX >= 0x01060000 -#if PY_VERSION_HEX < 0x02020000 || defined(Py_USING_UNICODE) -/* defining this enables unicode support (default under 1.6a1 and later) */ -#define HAVE_UNICODE -#endif -#endif - -/* -------------------------------------------------------------------- */ -/* optional features */ - -/* enables fast searching */ -#define USE_FAST_SEARCH - -/* enables aggressive inlining (always on for Visual C) */ -#undef USE_INLINE - -/* enables copy/deepcopy handling (work in progress) */ -#undef USE_BUILTIN_COPY - -#if PY_VERSION_HEX < 0x01060000 -#define PyObject_DEL(op) PyMem_DEL((op)) -#endif - -/* -------------------------------------------------------------------- */ - -#if defined(_MSC_VER) -#pragma optimize("gt", on) /* doesn't seem to make much difference... */ -#pragma warning(disable: 4710) /* who cares if functions are not inlined ;-) */ -/* fastest possible local call under MSVC */ -#define LOCAL(type) static __inline type __fastcall -#elif defined(USE_INLINE) -#define LOCAL(type) static inline type -#else -#define LOCAL(type) static type -#endif - -/* error codes */ -#define SRE_ERROR_ILLEGAL -1 /* illegal opcode */ -#define SRE_ERROR_STATE -2 /* illegal state */ -#define SRE_ERROR_RECURSION_LIMIT -3 /* runaway recursion */ -#define SRE_ERROR_MEMORY -9 /* out of memory */ -#define SRE_ERROR_INTERRUPTED -10 /* signal handler raised exception */ - -#if defined(VERBOSE) -#define TRACE(v) printf v -#else -#define TRACE(v) -#endif - -/* -------------------------------------------------------------------- */ -/* search engine state */ - -/* default character predicates (run sre_chars.py to regenerate tables) */ - -#define SRE_DIGIT_MASK 1 -#define SRE_SPACE_MASK 2 -#define SRE_LINEBREAK_MASK 4 -#define SRE_ALNUM_MASK 8 -#define SRE_WORD_MASK 16 - -/* FIXME: this assumes ASCII. create tables in init_sre() instead */ - -static char sre_char_info[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 2, -2, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, -0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 25, 25, 25, 25, 25, 25, 25, -25, 25, 0, 0, 0, 0, 0, 0, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, -0, 0, 16, 0, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, -24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 0, 0, 0, 0, 0 }; - -static char sre_char_lower[128] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, -27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, -61, 62, 63, 64, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, -108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, -122, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, -106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, -120, 121, 122, 123, 124, 125, 126, 127 }; - -#define SRE_IS_DIGIT(ch)\ - ((ch) < 128 ? (sre_char_info[(ch)] & SRE_DIGIT_MASK) : 0) -#define SRE_IS_SPACE(ch)\ - ((ch) < 128 ? (sre_char_info[(ch)] & SRE_SPACE_MASK) : 0) -#define SRE_IS_LINEBREAK(ch)\ - ((ch) < 128 ? (sre_char_info[(ch)] & SRE_LINEBREAK_MASK) : 0) -#define SRE_IS_ALNUM(ch)\ - ((ch) < 128 ? (sre_char_info[(ch)] & SRE_ALNUM_MASK) : 0) -#define SRE_IS_WORD(ch)\ - ((ch) < 128 ? (sre_char_info[(ch)] & SRE_WORD_MASK) : 0) - -static unsigned int sre_lower(unsigned int ch) -{ - return ((ch) < 128 ? (unsigned int)sre_char_lower[ch] : ch); -} - -/* locale-specific character predicates */ -/* !(c & ~N) == (c < N+1) for any unsigned c, this avoids - * warnings when c's type supports only numbers < N+1 */ -#define SRE_LOC_IS_DIGIT(ch) (!((ch) & ~255) ? isdigit((ch)) : 0) -#define SRE_LOC_IS_SPACE(ch) (!((ch) & ~255) ? isspace((ch)) : 0) -#define SRE_LOC_IS_LINEBREAK(ch) ((ch) == '\n') -#define SRE_LOC_IS_ALNUM(ch) (!((ch) & ~255) ? isalnum((ch)) : 0) -#define SRE_LOC_IS_WORD(ch) (SRE_LOC_IS_ALNUM((ch)) || (ch) == '_') - -static unsigned int sre_lower_locale(unsigned int ch) -{ - return ((ch) < 256 ? (unsigned int)tolower((ch)) : ch); -} - -/* unicode-specific character predicates */ - -#if defined(HAVE_UNICODE) - -#define SRE_UNI_IS_DIGIT(ch) Py_UNICODE_ISDECIMAL((Py_UNICODE)(ch)) -#define SRE_UNI_IS_SPACE(ch) Py_UNICODE_ISSPACE((Py_UNICODE)(ch)) -#define SRE_UNI_IS_LINEBREAK(ch) Py_UNICODE_ISLINEBREAK((Py_UNICODE)(ch)) -#define SRE_UNI_IS_ALNUM(ch) Py_UNICODE_ISALNUM((Py_UNICODE)(ch)) -#define SRE_UNI_IS_WORD(ch) (SRE_UNI_IS_ALNUM((ch)) || (ch) == '_') - -static unsigned int sre_lower_unicode(unsigned int ch) -{ - return (unsigned int) Py_UNICODE_TOLOWER((Py_UNICODE)(ch)); -} - -#endif - -LOCAL(int) -sre_category(SRE_CODE category, unsigned int ch) -{ - switch (category) { - - case SRE_CATEGORY_DIGIT: - return SRE_IS_DIGIT(ch); - case SRE_CATEGORY_NOT_DIGIT: - return !SRE_IS_DIGIT(ch); - case SRE_CATEGORY_SPACE: - return SRE_IS_SPACE(ch); - case SRE_CATEGORY_NOT_SPACE: - return !SRE_IS_SPACE(ch); - case SRE_CATEGORY_WORD: - return SRE_IS_WORD(ch); - case SRE_CATEGORY_NOT_WORD: - return !SRE_IS_WORD(ch); - case SRE_CATEGORY_LINEBREAK: - return SRE_IS_LINEBREAK(ch); - case SRE_CATEGORY_NOT_LINEBREAK: - return !SRE_IS_LINEBREAK(ch); - - case SRE_CATEGORY_LOC_WORD: - return SRE_LOC_IS_WORD(ch); - case SRE_CATEGORY_LOC_NOT_WORD: - return !SRE_LOC_IS_WORD(ch); - -#if defined(HAVE_UNICODE) - case SRE_CATEGORY_UNI_DIGIT: - return SRE_UNI_IS_DIGIT(ch); - case SRE_CATEGORY_UNI_NOT_DIGIT: - return !SRE_UNI_IS_DIGIT(ch); - case SRE_CATEGORY_UNI_SPACE: - return SRE_UNI_IS_SPACE(ch); - case SRE_CATEGORY_UNI_NOT_SPACE: - return !SRE_UNI_IS_SPACE(ch); - case SRE_CATEGORY_UNI_WORD: - return SRE_UNI_IS_WORD(ch); - case SRE_CATEGORY_UNI_NOT_WORD: - return !SRE_UNI_IS_WORD(ch); - case SRE_CATEGORY_UNI_LINEBREAK: - return SRE_UNI_IS_LINEBREAK(ch); - case SRE_CATEGORY_UNI_NOT_LINEBREAK: - return !SRE_UNI_IS_LINEBREAK(ch); -#else - case SRE_CATEGORY_UNI_DIGIT: - return SRE_IS_DIGIT(ch); - case SRE_CATEGORY_UNI_NOT_DIGIT: - return !SRE_IS_DIGIT(ch); - case SRE_CATEGORY_UNI_SPACE: - return SRE_IS_SPACE(ch); - case SRE_CATEGORY_UNI_NOT_SPACE: - return !SRE_IS_SPACE(ch); - case SRE_CATEGORY_UNI_WORD: - return SRE_LOC_IS_WORD(ch); - case SRE_CATEGORY_UNI_NOT_WORD: - return !SRE_LOC_IS_WORD(ch); - case SRE_CATEGORY_UNI_LINEBREAK: - return SRE_IS_LINEBREAK(ch); - case SRE_CATEGORY_UNI_NOT_LINEBREAK: - return !SRE_IS_LINEBREAK(ch); -#endif - } - return 0; -} - -/* helpers */ - -static void -data_stack_dealloc(SRE_STATE* state) -{ - if (state->data_stack) { - PyMem_FREE(state->data_stack); - state->data_stack = NULL; - } - state->data_stack_size = state->data_stack_base = 0; -} - -static int -data_stack_grow(SRE_STATE* state, Py_ssize_t size) -{ - Py_ssize_t minsize, cursize; - minsize = state->data_stack_base+size; - cursize = state->data_stack_size; - if (cursize < minsize) { - void* stack; - cursize = minsize+minsize/4+1024; - TRACE(("allocate/grow stack %" PY_FORMAT_SIZE_T "d\n", cursize)); - stack = PyMem_REALLOC(state->data_stack, cursize); - if (!stack) { - data_stack_dealloc(state); - return SRE_ERROR_MEMORY; - } - state->data_stack = (char *)stack; - state->data_stack_size = cursize; - } - return 0; -} - -/* generate 8-bit version */ - -#define SRE_CHAR unsigned char -#define SRE_AT sre_at -#define SRE_COUNT sre_count -#define SRE_CHARSET sre_charset -#define SRE_INFO sre_info -#define SRE_MATCH sre_match -#define SRE_MATCH_CONTEXT sre_match_context -#define SRE_SEARCH sre_search -#define SRE_LITERAL_TEMPLATE sre_literal_template - -#if defined(HAVE_UNICODE) - -#define SRE_RECURSIVE -#include "_sre.c" -#undef SRE_RECURSIVE - -#undef SRE_LITERAL_TEMPLATE -#undef SRE_SEARCH -#undef SRE_MATCH -#undef SRE_MATCH_CONTEXT -#undef SRE_INFO -#undef SRE_CHARSET -#undef SRE_COUNT -#undef SRE_AT -#undef SRE_CHAR - -/* generate 16-bit unicode version */ - -#define SRE_CHAR Py_UNICODE -#define SRE_AT sre_uat -#define SRE_COUNT sre_ucount -#define SRE_CHARSET sre_ucharset -#define SRE_INFO sre_uinfo -#define SRE_MATCH sre_umatch -#define SRE_MATCH_CONTEXT sre_umatch_context -#define SRE_SEARCH sre_usearch -#define SRE_LITERAL_TEMPLATE sre_uliteral_template -#endif - -#endif /* SRE_RECURSIVE */ - -/* -------------------------------------------------------------------- */ -/* String matching engine */ - -/* the following section is compiled twice, with different character - settings */ - -LOCAL(int) -SRE_AT(SRE_STATE* state, SRE_CHAR* ptr, SRE_CODE at) -{ - /* check if pointer is at given position */ - - Py_ssize_t thisp, thatp; - - switch (at) { - - case SRE_AT_BEGINNING: - case SRE_AT_BEGINNING_STRING: - return ((void*) ptr == state->beginning); - - case SRE_AT_BEGINNING_LINE: - return ((void*) ptr == state->beginning || - SRE_IS_LINEBREAK((int) ptr[-1])); - - case SRE_AT_END: - return (((void*) (ptr+1) == state->end && - SRE_IS_LINEBREAK((int) ptr[0])) || - ((void*) ptr == state->end)); - - case SRE_AT_END_LINE: - return ((void*) ptr == state->end || - SRE_IS_LINEBREAK((int) ptr[0])); - - case SRE_AT_END_STRING: - return ((void*) ptr == state->end); - - case SRE_AT_BOUNDARY: - if (state->beginning == state->end) - return 0; - thatp = ((void*) ptr > state->beginning) ? - SRE_IS_WORD((int) ptr[-1]) : 0; - thisp = ((void*) ptr < state->end) ? - SRE_IS_WORD((int) ptr[0]) : 0; - return thisp != thatp; - - case SRE_AT_NON_BOUNDARY: - if (state->beginning == state->end) - return 0; - thatp = ((void*) ptr > state->beginning) ? - SRE_IS_WORD((int) ptr[-1]) : 0; - thisp = ((void*) ptr < state->end) ? - SRE_IS_WORD((int) ptr[0]) : 0; - return thisp == thatp; - - case SRE_AT_LOC_BOUNDARY: - if (state->beginning == state->end) - return 0; - thatp = ((void*) ptr > state->beginning) ? - SRE_LOC_IS_WORD((int) ptr[-1]) : 0; - thisp = ((void*) ptr < state->end) ? - SRE_LOC_IS_WORD((int) ptr[0]) : 0; - return thisp != thatp; - - case SRE_AT_LOC_NON_BOUNDARY: - if (state->beginning == state->end) - return 0; - thatp = ((void*) ptr > state->beginning) ? - SRE_LOC_IS_WORD((int) ptr[-1]) : 0; - thisp = ((void*) ptr < state->end) ? - SRE_LOC_IS_WORD((int) ptr[0]) : 0; - return thisp == thatp; - -#if defined(HAVE_UNICODE) - case SRE_AT_UNI_BOUNDARY: - if (state->beginning == state->end) - return 0; - thatp = ((void*) ptr > state->beginning) ? - SRE_UNI_IS_WORD((int) ptr[-1]) : 0; - thisp = ((void*) ptr < state->end) ? - SRE_UNI_IS_WORD((int) ptr[0]) : 0; - return thisp != thatp; - - case SRE_AT_UNI_NON_BOUNDARY: - if (state->beginning == state->end) - return 0; - thatp = ((void*) ptr > state->beginning) ? - SRE_UNI_IS_WORD((int) ptr[-1]) : 0; - thisp = ((void*) ptr < state->end) ? - SRE_UNI_IS_WORD((int) ptr[0]) : 0; - return thisp == thatp; -#endif - - } - - return 0; -} - -LOCAL(int) -SRE_CHARSET(SRE_CODE* set, SRE_CODE ch) -{ - /* check if character is a member of the given set */ - - int ok = 1; - - for (;;) { - switch (*set++) { - - case SRE_OP_FAILURE: - return !ok; - - case SRE_OP_LITERAL: - /* */ - if (ch == set[0]) - return ok; - set++; - break; - - case SRE_OP_CATEGORY: - /* */ - if (sre_category(set[0], (int) ch)) - return ok; - set += 1; - break; - - case SRE_OP_CHARSET: - if (sizeof(SRE_CODE) == 2) { - /* (16 bits per code word) */ - if (ch < 256 && (set[ch >> 4] & (1 << (ch & 15)))) - return ok; - set += 16; - } - else { - /* (32 bits per code word) */ - if (ch < 256 && (set[ch >> 5] & (1u << (ch & 31)))) - return ok; - set += 8; - } - break; - - case SRE_OP_RANGE: - /* */ - if (set[0] <= ch && ch <= set[1]) - return ok; - set += 2; - break; - - case SRE_OP_NEGATE: - ok = !ok; - break; - - case SRE_OP_BIGCHARSET: - /* <256 blockindices> */ - { - Py_ssize_t count, block; - count = *(set++); - - if (sizeof(SRE_CODE) == 2) { - block = ((unsigned char*)set)[ch >> 8]; - set += 128; - if (set[block*16 + ((ch & 255)>>4)] & (1 << (ch & 15))) - return ok; - set += count*16; - } - else { - /* !(c & ~N) == (c < N+1) for any unsigned c, this avoids - * warnings when c's type supports only numbers < N+1 */ - if (!(ch & ~65535)) - block = ((unsigned char*)set)[ch >> 8]; - else - block = -1; - set += 64; - if (block >=0 && - (set[block*8 + ((ch & 255)>>5)] & (1u << (ch & 31)))) - return ok; - set += count*8; - } - break; - } - - default: - /* internal error -- there's not much we can do about it - here, so let's just pretend it didn't match... */ - return 0; - } - } -} - -LOCAL(Py_ssize_t) SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern); - -LOCAL(Py_ssize_t) -SRE_COUNT(SRE_STATE* state, SRE_CODE* pattern, Py_ssize_t maxcount) -{ - SRE_CODE chr; - SRE_CHAR* ptr = (SRE_CHAR *)state->ptr; - SRE_CHAR* end = (SRE_CHAR *)state->end; - Py_ssize_t i; - - /* adjust end */ - if (maxcount < end - ptr && maxcount != SRE_MAXREPEAT) - end = ptr + maxcount; - - switch (pattern[0]) { - - case SRE_OP_IN: - /* repeated set */ - TRACE(("|%p|%p|COUNT IN\n", pattern, ptr)); - while (ptr < end && SRE_CHARSET(pattern + 2, *ptr)) - ptr++; - break; - - case SRE_OP_ANY: - /* repeated dot wildcard. */ - TRACE(("|%p|%p|COUNT ANY\n", pattern, ptr)); - while (ptr < end && !SRE_IS_LINEBREAK(*ptr)) - ptr++; - break; - - case SRE_OP_ANY_ALL: - /* repeated dot wildcard. skip to the end of the target - string, and backtrack from there */ - TRACE(("|%p|%p|COUNT ANY_ALL\n", pattern, ptr)); - ptr = end; - break; - - case SRE_OP_LITERAL: - /* repeated literal */ - chr = pattern[1]; - TRACE(("|%p|%p|COUNT LITERAL %d\n", pattern, ptr, chr)); - while (ptr < end && (SRE_CODE) *ptr == chr) - ptr++; - break; - - case SRE_OP_LITERAL_IGNORE: - /* repeated literal */ - chr = pattern[1]; - TRACE(("|%p|%p|COUNT LITERAL_IGNORE %d\n", pattern, ptr, chr)); - while (ptr < end && (SRE_CODE) state->lower(*ptr) == chr) - ptr++; - break; - - case SRE_OP_NOT_LITERAL: - /* repeated non-literal */ - chr = pattern[1]; - TRACE(("|%p|%p|COUNT NOT_LITERAL %d\n", pattern, ptr, chr)); - while (ptr < end && (SRE_CODE) *ptr != chr) - ptr++; - break; - - case SRE_OP_NOT_LITERAL_IGNORE: - /* repeated non-literal */ - chr = pattern[1]; - TRACE(("|%p|%p|COUNT NOT_LITERAL_IGNORE %d\n", pattern, ptr, chr)); - while (ptr < end && (SRE_CODE) state->lower(*ptr) != chr) - ptr++; - break; - - default: - /* repeated single character pattern */ - TRACE(("|%p|%p|COUNT SUBPATTERN\n", pattern, ptr)); - while ((SRE_CHAR*) state->ptr < end) { - i = SRE_MATCH(state, pattern); - if (i < 0) - return i; - if (!i) - break; - } - TRACE(("|%p|%p|COUNT %" PY_FORMAT_SIZE_T "d\n", pattern, ptr, - (SRE_CHAR*) state->ptr - ptr)); - return (SRE_CHAR*) state->ptr - ptr; - } - - TRACE(("|%p|%p|COUNT %" PY_FORMAT_SIZE_T "d\n", pattern, ptr, - ptr - (SRE_CHAR*) state->ptr)); - return ptr - (SRE_CHAR*) state->ptr; -} - -#if 0 /* not used in this release */ -LOCAL(int) -SRE_INFO(SRE_STATE* state, SRE_CODE* pattern) -{ - /* check if an SRE_OP_INFO block matches at the current position. - returns the number of SRE_CODE objects to skip if successful, 0 - if no match */ - - SRE_CHAR* end = state->end; - SRE_CHAR* ptr = state->ptr; - Py_ssize_t i; - - /* check minimal length */ - if (pattern[3] && (end - ptr) < pattern[3]) - return 0; - - /* check known prefix */ - if (pattern[2] & SRE_INFO_PREFIX && pattern[5] > 1) { - /* */ - for (i = 0; i < pattern[5]; i++) - if ((SRE_CODE) ptr[i] != pattern[7 + i]) - return 0; - return pattern[0] + 2 * pattern[6]; - } - return pattern[0]; -} -#endif - -/* The macros below should be used to protect recursive SRE_MATCH() - * calls that *failed* and do *not* return immediately (IOW, those - * that will backtrack). Explaining: - * - * - Recursive SRE_MATCH() returned true: that's usually a success - * (besides atypical cases like ASSERT_NOT), therefore there's no - * reason to restore lastmark; - * - * - Recursive SRE_MATCH() returned false but the current SRE_MATCH() - * is returning to the caller: If the current SRE_MATCH() is the - * top function of the recursion, returning false will be a matching - * failure, and it doesn't matter where lastmark is pointing to. - * If it's *not* the top function, it will be a recursive SRE_MATCH() - * failure by itself, and the calling SRE_MATCH() will have to deal - * with the failure by the same rules explained here (it will restore - * lastmark by itself if necessary); - * - * - Recursive SRE_MATCH() returned false, and will continue the - * outside 'for' loop: must be protected when breaking, since the next - * OP could potentially depend on lastmark; - * - * - Recursive SRE_MATCH() returned false, and will be called again - * inside a local for/while loop: must be protected between each - * loop iteration, since the recursive SRE_MATCH() could do anything, - * and could potentially depend on lastmark. - * - * For more information, check the discussion at SF patch #712900. - */ -#define LASTMARK_SAVE() \ - do { \ - ctx->lastmark = state->lastmark; \ - ctx->lastindex = state->lastindex; \ - } while (0) -#define LASTMARK_RESTORE() \ - do { \ - state->lastmark = ctx->lastmark; \ - state->lastindex = ctx->lastindex; \ - } while (0) - -#define RETURN_ERROR(i) do { return i; } while(0) -#define RETURN_FAILURE do { ret = 0; goto exit; } while(0) -#define RETURN_SUCCESS do { ret = 1; goto exit; } while(0) - -#define RETURN_ON_ERROR(i) \ - do { if (i < 0) RETURN_ERROR(i); } while (0) -#define RETURN_ON_SUCCESS(i) \ - do { RETURN_ON_ERROR(i); if (i > 0) RETURN_SUCCESS; } while (0) -#define RETURN_ON_FAILURE(i) \ - do { RETURN_ON_ERROR(i); if (i == 0) RETURN_FAILURE; } while (0) - -#define SFY(x) #x - -#define DATA_STACK_ALLOC(state, type, ptr) \ -do { \ - alloc_pos = state->data_stack_base; \ - TRACE(("allocating %s in %" PY_FORMAT_SIZE_T "d " \ - "(%" PY_FORMAT_SIZE_T "d)\n", \ - SFY(type), alloc_pos, sizeof(type))); \ - if (sizeof(type) > state->data_stack_size - alloc_pos) { \ - int j = data_stack_grow(state, sizeof(type)); \ - if (j < 0) return j; \ - if (ctx_pos != -1) \ - DATA_STACK_LOOKUP_AT(state, SRE_MATCH_CONTEXT, ctx, ctx_pos); \ - } \ - ptr = (type*)(state->data_stack+alloc_pos); \ - state->data_stack_base += sizeof(type); \ -} while (0) - -#define DATA_STACK_LOOKUP_AT(state, type, ptr, pos) \ -do { \ - TRACE(("looking up %s at %" PY_FORMAT_SIZE_T "d\n", SFY(type), pos)); \ - ptr = (type*)(state->data_stack+pos); \ -} while (0) - -#define DATA_STACK_PUSH(state, data, size) \ -do { \ - TRACE(("copy data in %p to %" PY_FORMAT_SIZE_T "d " \ - "(%" PY_FORMAT_SIZE_T "d)\n", \ - data, state->data_stack_base, size)); \ - if (size > state->data_stack_size - state->data_stack_base) { \ - int j = data_stack_grow(state, size); \ - if (j < 0) return j; \ - if (ctx_pos != -1) \ - DATA_STACK_LOOKUP_AT(state, SRE_MATCH_CONTEXT, ctx, ctx_pos); \ - } \ - memcpy(state->data_stack+state->data_stack_base, data, size); \ - state->data_stack_base += size; \ -} while (0) - -#define DATA_STACK_POP(state, data, size, discard) \ -do { \ - TRACE(("copy data to %p from %" PY_FORMAT_SIZE_T "d " \ - "(%" PY_FORMAT_SIZE_T "d)\n", \ - data, state->data_stack_base-size, size)); \ - memcpy(data, state->data_stack+state->data_stack_base-size, size); \ - if (discard) \ - state->data_stack_base -= size; \ -} while (0) - -#define DATA_STACK_POP_DISCARD(state, size) \ -do { \ - TRACE(("discard data from %" PY_FORMAT_SIZE_T "d " \ - "(%" PY_FORMAT_SIZE_T "d)\n", \ - state->data_stack_base-size, size)); \ - state->data_stack_base -= size; \ -} while(0) - -#define DATA_PUSH(x) \ - DATA_STACK_PUSH(state, (x), sizeof(*(x))) -#define DATA_POP(x) \ - DATA_STACK_POP(state, (x), sizeof(*(x)), 1) -#define DATA_POP_DISCARD(x) \ - DATA_STACK_POP_DISCARD(state, sizeof(*(x))) -#define DATA_ALLOC(t,p) \ - DATA_STACK_ALLOC(state, t, p) -#define DATA_LOOKUP_AT(t,p,pos) \ - DATA_STACK_LOOKUP_AT(state,t,p,pos) - -#define MARK_PUSH(lastmark) \ - do if (lastmark > 0) { \ - i = lastmark; /* ctx->lastmark may change if reallocated */ \ - DATA_STACK_PUSH(state, state->mark, (i+1)*sizeof(void*)); \ - } while (0) -#define MARK_POP(lastmark) \ - do if (lastmark > 0) { \ - DATA_STACK_POP(state, state->mark, (lastmark+1)*sizeof(void*), 1); \ - } while (0) -#define MARK_POP_KEEP(lastmark) \ - do if (lastmark > 0) { \ - DATA_STACK_POP(state, state->mark, (lastmark+1)*sizeof(void*), 0); \ - } while (0) -#define MARK_POP_DISCARD(lastmark) \ - do if (lastmark > 0) { \ - DATA_STACK_POP_DISCARD(state, (lastmark+1)*sizeof(void*)); \ - } while (0) - -#define JUMP_NONE 0 -#define JUMP_MAX_UNTIL_1 1 -#define JUMP_MAX_UNTIL_2 2 -#define JUMP_MAX_UNTIL_3 3 -#define JUMP_MIN_UNTIL_1 4 -#define JUMP_MIN_UNTIL_2 5 -#define JUMP_MIN_UNTIL_3 6 -#define JUMP_REPEAT 7 -#define JUMP_REPEAT_ONE_1 8 -#define JUMP_REPEAT_ONE_2 9 -#define JUMP_MIN_REPEAT_ONE 10 -#define JUMP_BRANCH 11 -#define JUMP_ASSERT 12 -#define JUMP_ASSERT_NOT 13 - -#define DO_JUMP(jumpvalue, jumplabel, nextpattern) \ - DATA_ALLOC(SRE_MATCH_CONTEXT, nextctx); \ - nextctx->last_ctx_pos = ctx_pos; \ - nextctx->jump = jumpvalue; \ - nextctx->pattern = nextpattern; \ - ctx_pos = alloc_pos; \ - ctx = nextctx; \ - goto entrance; \ - jumplabel: \ - while (0) /* gcc doesn't like labels at end of scopes */ \ - -typedef struct { - Py_ssize_t last_ctx_pos; - Py_ssize_t jump; - SRE_CHAR* ptr; - SRE_CODE* pattern; - Py_ssize_t count; - Py_ssize_t lastmark; - Py_ssize_t lastindex; - union { - SRE_CODE chr; - SRE_REPEAT* rep; - } u; -} SRE_MATCH_CONTEXT; - -/* check if string matches the given pattern. returns <0 for - error, 0 for failure, and 1 for success */ -LOCAL(Py_ssize_t) -SRE_MATCH(SRE_STATE* state, SRE_CODE* pattern) -{ - SRE_CHAR* end = (SRE_CHAR *)state->end; - Py_ssize_t alloc_pos, ctx_pos = -1; - Py_ssize_t i, ret = 0; - Py_ssize_t jump; - unsigned int sigcount=0; - - SRE_MATCH_CONTEXT* ctx; - SRE_MATCH_CONTEXT* nextctx; - - TRACE(("|%p|%p|ENTER\n", pattern, state->ptr)); - - DATA_ALLOC(SRE_MATCH_CONTEXT, ctx); - ctx->last_ctx_pos = -1; - ctx->jump = JUMP_NONE; - ctx->pattern = pattern; - ctx_pos = alloc_pos; - -entrance: - - ctx->ptr = (SRE_CHAR *)state->ptr; - - if (ctx->pattern[0] == SRE_OP_INFO) { - /* optimization info block */ - /* <1=skip> <2=flags> <3=min> ... */ - if (ctx->pattern[3] && (end - ctx->ptr) < ctx->pattern[3]) { - TRACE(("reject (got %" PY_FORMAT_SIZE_T "d chars, " - "need %" PY_FORMAT_SIZE_T "d)\n", - (end - ctx->ptr), (Py_ssize_t) ctx->pattern[3])); - RETURN_FAILURE; - } - ctx->pattern += ctx->pattern[1] + 1; - } - - for (;;) { - ++sigcount; - if ((0 == (sigcount & 0xfff)) && PyErr_CheckSignals()) - RETURN_ERROR(SRE_ERROR_INTERRUPTED); - - switch (*ctx->pattern++) { - - case SRE_OP_MARK: - /* set mark */ - /* */ - TRACE(("|%p|%p|MARK %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[0])); - i = ctx->pattern[0]; - if (i & 1) - state->lastindex = i/2 + 1; - if (i > state->lastmark) { - /* state->lastmark is the highest valid index in the - state->mark array. If it is increased by more than 1, - the intervening marks must be set to NULL to signal - that these marks have not been encountered. */ - Py_ssize_t j = state->lastmark + 1; - while (j < i) - state->mark[j++] = NULL; - state->lastmark = i; - } - state->mark[i] = ctx->ptr; - ctx->pattern++; - break; - - case SRE_OP_LITERAL: - /* match literal string */ - /* */ - TRACE(("|%p|%p|LITERAL %d\n", ctx->pattern, - ctx->ptr, *ctx->pattern)); - if (ctx->ptr >= end || (SRE_CODE) ctx->ptr[0] != ctx->pattern[0]) - RETURN_FAILURE; - ctx->pattern++; - ctx->ptr++; - break; - - case SRE_OP_NOT_LITERAL: - /* match anything that is not literal character */ - /* */ - TRACE(("|%p|%p|NOT_LITERAL %d\n", ctx->pattern, - ctx->ptr, *ctx->pattern)); - if (ctx->ptr >= end || (SRE_CODE) ctx->ptr[0] == ctx->pattern[0]) - RETURN_FAILURE; - ctx->pattern++; - ctx->ptr++; - break; - - case SRE_OP_SUCCESS: - /* end of pattern */ - TRACE(("|%p|%p|SUCCESS\n", ctx->pattern, ctx->ptr)); - state->ptr = ctx->ptr; - RETURN_SUCCESS; - - case SRE_OP_AT: - /* match at given position */ - /* */ - TRACE(("|%p|%p|AT %d\n", ctx->pattern, ctx->ptr, *ctx->pattern)); - if (!SRE_AT(state, ctx->ptr, *ctx->pattern)) - RETURN_FAILURE; - ctx->pattern++; - break; - - case SRE_OP_CATEGORY: - /* match at given category */ - /* */ - TRACE(("|%p|%p|CATEGORY %d\n", ctx->pattern, - ctx->ptr, *ctx->pattern)); - if (ctx->ptr >= end || !sre_category(ctx->pattern[0], ctx->ptr[0])) - RETURN_FAILURE; - ctx->pattern++; - ctx->ptr++; - break; - - case SRE_OP_ANY: - /* match anything (except a newline) */ - /* */ - TRACE(("|%p|%p|ANY\n", ctx->pattern, ctx->ptr)); - if (ctx->ptr >= end || SRE_IS_LINEBREAK(ctx->ptr[0])) - RETURN_FAILURE; - ctx->ptr++; - break; - - case SRE_OP_ANY_ALL: - /* match anything */ - /* */ - TRACE(("|%p|%p|ANY_ALL\n", ctx->pattern, ctx->ptr)); - if (ctx->ptr >= end) - RETURN_FAILURE; - ctx->ptr++; - break; - - case SRE_OP_IN: - /* match set member (or non_member) */ - /* */ - TRACE(("|%p|%p|IN\n", ctx->pattern, ctx->ptr)); - if (ctx->ptr >= end || !SRE_CHARSET(ctx->pattern + 1, *ctx->ptr)) - RETURN_FAILURE; - ctx->pattern += ctx->pattern[0]; - ctx->ptr++; - break; - - case SRE_OP_LITERAL_IGNORE: - TRACE(("|%p|%p|LITERAL_IGNORE %d\n", - ctx->pattern, ctx->ptr, ctx->pattern[0])); - if (ctx->ptr >= end || - state->lower(*ctx->ptr) != state->lower(*ctx->pattern)) - RETURN_FAILURE; - ctx->pattern++; - ctx->ptr++; - break; - - case SRE_OP_NOT_LITERAL_IGNORE: - TRACE(("|%p|%p|NOT_LITERAL_IGNORE %d\n", - ctx->pattern, ctx->ptr, *ctx->pattern)); - if (ctx->ptr >= end || - state->lower(*ctx->ptr) == state->lower(*ctx->pattern)) - RETURN_FAILURE; - ctx->pattern++; - ctx->ptr++; - break; - - case SRE_OP_IN_IGNORE: - TRACE(("|%p|%p|IN_IGNORE\n", ctx->pattern, ctx->ptr)); - if (ctx->ptr >= end - || !SRE_CHARSET(ctx->pattern+1, - (SRE_CODE)state->lower(*ctx->ptr))) - RETURN_FAILURE; - ctx->pattern += ctx->pattern[0]; - ctx->ptr++; - break; - - case SRE_OP_JUMP: - case SRE_OP_INFO: - /* jump forward */ - /* */ - TRACE(("|%p|%p|JUMP %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[0])); - ctx->pattern += ctx->pattern[0]; - break; - - case SRE_OP_BRANCH: - /* alternation */ - /* <0=skip> code ... */ - TRACE(("|%p|%p|BRANCH\n", ctx->pattern, ctx->ptr)); - LASTMARK_SAVE(); - ctx->u.rep = state->repeat; - if (ctx->u.rep) - MARK_PUSH(ctx->lastmark); - for (; ctx->pattern[0]; ctx->pattern += ctx->pattern[0]) { - if (ctx->pattern[1] == SRE_OP_LITERAL && - (ctx->ptr >= end || - (SRE_CODE) *ctx->ptr != ctx->pattern[2])) - continue; - if (ctx->pattern[1] == SRE_OP_IN && - (ctx->ptr >= end || - !SRE_CHARSET(ctx->pattern + 3, (SRE_CODE) *ctx->ptr))) - continue; - state->ptr = ctx->ptr; - DO_JUMP(JUMP_BRANCH, jump_branch, ctx->pattern+1); - if (ret) { - if (ctx->u.rep) - MARK_POP_DISCARD(ctx->lastmark); - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - if (ctx->u.rep) - MARK_POP_KEEP(ctx->lastmark); - LASTMARK_RESTORE(); - } - if (ctx->u.rep) - MARK_POP_DISCARD(ctx->lastmark); - RETURN_FAILURE; - - case SRE_OP_REPEAT_ONE: - /* match repeated sequence (maximizing regexp) */ - - /* this operator only works if the repeated item is - exactly one character wide, and we're not already - collecting backtracking points. for other cases, - use the MAX_REPEAT operator */ - - /* <1=min> <2=max> item tail */ - - TRACE(("|%p|%p|REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr, - ctx->pattern[1], ctx->pattern[2])); - - if ((Py_ssize_t) ctx->pattern[1] > end - ctx->ptr) - RETURN_FAILURE; /* cannot match */ - - state->ptr = ctx->ptr; - - ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[2]); - RETURN_ON_ERROR(ret); - DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); - ctx->count = ret; - ctx->ptr += ctx->count; - - /* when we arrive here, count contains the number of - matches, and ctx->ptr points to the tail of the target - string. check if the rest of the pattern matches, - and backtrack if not. */ - - if (ctx->count < (Py_ssize_t) ctx->pattern[1]) - RETURN_FAILURE; - - if (ctx->pattern[ctx->pattern[0]] == SRE_OP_SUCCESS) { - /* tail is empty. we're finished */ - state->ptr = ctx->ptr; - RETURN_SUCCESS; - } - - LASTMARK_SAVE(); - - if (ctx->pattern[ctx->pattern[0]] == SRE_OP_LITERAL) { - /* tail starts with a literal. skip positions where - the rest of the pattern cannot possibly match */ - ctx->u.chr = ctx->pattern[ctx->pattern[0]+1]; - for (;;) { - while (ctx->count >= (Py_ssize_t) ctx->pattern[1] && - (ctx->ptr >= end || *ctx->ptr != ctx->u.chr)) { - ctx->ptr--; - ctx->count--; - } - if (ctx->count < (Py_ssize_t) ctx->pattern[1]) - break; - state->ptr = ctx->ptr; - DO_JUMP(JUMP_REPEAT_ONE_1, jump_repeat_one_1, - ctx->pattern+ctx->pattern[0]); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - - LASTMARK_RESTORE(); - - ctx->ptr--; - ctx->count--; - } - - } else { - /* general case */ - while (ctx->count >= (Py_ssize_t) ctx->pattern[1]) { - state->ptr = ctx->ptr; - DO_JUMP(JUMP_REPEAT_ONE_2, jump_repeat_one_2, - ctx->pattern+ctx->pattern[0]); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - ctx->ptr--; - ctx->count--; - LASTMARK_RESTORE(); - } - } - RETURN_FAILURE; - - case SRE_OP_MIN_REPEAT_ONE: - /* match repeated sequence (minimizing regexp) */ - - /* this operator only works if the repeated item is - exactly one character wide, and we're not already - collecting backtracking points. for other cases, - use the MIN_REPEAT operator */ - - /* <1=min> <2=max> item tail */ - - TRACE(("|%p|%p|MIN_REPEAT_ONE %d %d\n", ctx->pattern, ctx->ptr, - ctx->pattern[1], ctx->pattern[2])); - - if ((Py_ssize_t) ctx->pattern[1] > end - ctx->ptr) - RETURN_FAILURE; /* cannot match */ - - state->ptr = ctx->ptr; - - if (ctx->pattern[1] == 0) - ctx->count = 0; - else { - /* count using pattern min as the maximum */ - ret = SRE_COUNT(state, ctx->pattern+3, ctx->pattern[1]); - RETURN_ON_ERROR(ret); - DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); - if (ret < (Py_ssize_t) ctx->pattern[1]) - /* didn't match minimum number of times */ - RETURN_FAILURE; - /* advance past minimum matches of repeat */ - ctx->count = ret; - ctx->ptr += ctx->count; - } - - if (ctx->pattern[ctx->pattern[0]] == SRE_OP_SUCCESS) { - /* tail is empty. we're finished */ - state->ptr = ctx->ptr; - RETURN_SUCCESS; - - } else { - /* general case */ - LASTMARK_SAVE(); - while ((Py_ssize_t)ctx->pattern[2] == SRE_MAXREPEAT - || ctx->count <= (Py_ssize_t)ctx->pattern[2]) { - state->ptr = ctx->ptr; - DO_JUMP(JUMP_MIN_REPEAT_ONE,jump_min_repeat_one, - ctx->pattern+ctx->pattern[0]); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - state->ptr = ctx->ptr; - ret = SRE_COUNT(state, ctx->pattern+3, 1); - RETURN_ON_ERROR(ret); - DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); - if (ret == 0) - break; - assert(ret == 1); - ctx->ptr++; - ctx->count++; - LASTMARK_RESTORE(); - } - } - RETURN_FAILURE; - - case SRE_OP_REPEAT: - /* create repeat context. all the hard work is done - by the UNTIL operator (MAX_UNTIL, MIN_UNTIL) */ - /* <1=min> <2=max> item tail */ - TRACE(("|%p|%p|REPEAT %d %d\n", ctx->pattern, ctx->ptr, - ctx->pattern[1], ctx->pattern[2])); - - /* install new repeat context */ - ctx->u.rep = (SRE_REPEAT*) PyObject_MALLOC(sizeof(*ctx->u.rep)); - if (!ctx->u.rep) { - PyErr_NoMemory(); - RETURN_FAILURE; - } - ctx->u.rep->count = -1; - ctx->u.rep->pattern = ctx->pattern; - ctx->u.rep->prev = state->repeat; - ctx->u.rep->last_ptr = NULL; - state->repeat = ctx->u.rep; - - state->ptr = ctx->ptr; - DO_JUMP(JUMP_REPEAT, jump_repeat, ctx->pattern+ctx->pattern[0]); - state->repeat = ctx->u.rep->prev; - PyObject_FREE(ctx->u.rep); - - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - RETURN_FAILURE; - - case SRE_OP_MAX_UNTIL: - /* maximizing repeat */ - /* <1=min> <2=max> item tail */ - - /* FIXME: we probably need to deal with zero-width - matches in here... */ - - ctx->u.rep = state->repeat; - if (!ctx->u.rep) - RETURN_ERROR(SRE_ERROR_STATE); - - state->ptr = ctx->ptr; - - ctx->count = ctx->u.rep->count+1; - - TRACE(("|%p|%p|MAX_UNTIL %" PY_FORMAT_SIZE_T "d\n", ctx->pattern, - ctx->ptr, ctx->count)); - - if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) { - /* not enough matches */ - ctx->u.rep->count = ctx->count; - DO_JUMP(JUMP_MAX_UNTIL_1, jump_max_until_1, - ctx->u.rep->pattern+3); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - ctx->u.rep->count = ctx->count-1; - state->ptr = ctx->ptr; - RETURN_FAILURE; - } - - if ((ctx->count < (Py_ssize_t) ctx->u.rep->pattern[2] || - ctx->u.rep->pattern[2] == SRE_MAXREPEAT) && - state->ptr != ctx->u.rep->last_ptr) { - /* we may have enough matches, but if we can - match another item, do so */ - ctx->u.rep->count = ctx->count; - LASTMARK_SAVE(); - MARK_PUSH(ctx->lastmark); - /* zero-width match protection */ - DATA_PUSH(&ctx->u.rep->last_ptr); - ctx->u.rep->last_ptr = state->ptr; - DO_JUMP(JUMP_MAX_UNTIL_2, jump_max_until_2, - ctx->u.rep->pattern+3); - DATA_POP(&ctx->u.rep->last_ptr); - if (ret) { - MARK_POP_DISCARD(ctx->lastmark); - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - MARK_POP(ctx->lastmark); - LASTMARK_RESTORE(); - ctx->u.rep->count = ctx->count-1; - state->ptr = ctx->ptr; - } - - /* cannot match more repeated items here. make sure the - tail matches */ - state->repeat = ctx->u.rep->prev; - DO_JUMP(JUMP_MAX_UNTIL_3, jump_max_until_3, ctx->pattern); - RETURN_ON_SUCCESS(ret); - state->repeat = ctx->u.rep; - state->ptr = ctx->ptr; - RETURN_FAILURE; - - case SRE_OP_MIN_UNTIL: - /* minimizing repeat */ - /* <1=min> <2=max> item tail */ - - ctx->u.rep = state->repeat; - if (!ctx->u.rep) - RETURN_ERROR(SRE_ERROR_STATE); - - state->ptr = ctx->ptr; - - ctx->count = ctx->u.rep->count+1; - - TRACE(("|%p|%p|MIN_UNTIL %" PY_FORMAT_SIZE_T "d %p\n", ctx->pattern, - ctx->ptr, ctx->count, ctx->u.rep->pattern)); - - if (ctx->count < (Py_ssize_t) ctx->u.rep->pattern[1]) { - /* not enough matches */ - ctx->u.rep->count = ctx->count; - DO_JUMP(JUMP_MIN_UNTIL_1, jump_min_until_1, - ctx->u.rep->pattern+3); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - ctx->u.rep->count = ctx->count-1; - state->ptr = ctx->ptr; - RETURN_FAILURE; - } - - LASTMARK_SAVE(); - - /* see if the tail matches */ - state->repeat = ctx->u.rep->prev; - DO_JUMP(JUMP_MIN_UNTIL_2, jump_min_until_2, ctx->pattern); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - - state->repeat = ctx->u.rep; - state->ptr = ctx->ptr; - - LASTMARK_RESTORE(); - - if ((ctx->count >= (Py_ssize_t) ctx->u.rep->pattern[2] - && ctx->u.rep->pattern[2] != SRE_MAXREPEAT) || - state->ptr == ctx->u.rep->last_ptr) - RETURN_FAILURE; - - ctx->u.rep->count = ctx->count; - /* zero-width match protection */ - DATA_PUSH(&ctx->u.rep->last_ptr); - ctx->u.rep->last_ptr = state->ptr; - DO_JUMP(JUMP_MIN_UNTIL_3,jump_min_until_3, - ctx->u.rep->pattern+3); - DATA_POP(&ctx->u.rep->last_ptr); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_SUCCESS; - } - ctx->u.rep->count = ctx->count-1; - state->ptr = ctx->ptr; - RETURN_FAILURE; - - case SRE_OP_GROUPREF: - /* match backreference */ - TRACE(("|%p|%p|GROUPREF %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[0])); - i = ctx->pattern[0]; - { - Py_ssize_t groupref = i+i; - if (groupref >= state->lastmark) { - RETURN_FAILURE; - } else { - SRE_CHAR* p = (SRE_CHAR*) state->mark[groupref]; - SRE_CHAR* e = (SRE_CHAR*) state->mark[groupref+1]; - if (!p || !e || e < p) - RETURN_FAILURE; - while (p < e) { - if (ctx->ptr >= end || *ctx->ptr != *p) - RETURN_FAILURE; - p++; ctx->ptr++; - } - } - } - ctx->pattern++; - break; - - case SRE_OP_GROUPREF_IGNORE: - /* match backreference */ - TRACE(("|%p|%p|GROUPREF_IGNORE %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[0])); - i = ctx->pattern[0]; - { - Py_ssize_t groupref = i+i; - if (groupref >= state->lastmark) { - RETURN_FAILURE; - } else { - SRE_CHAR* p = (SRE_CHAR*) state->mark[groupref]; - SRE_CHAR* e = (SRE_CHAR*) state->mark[groupref+1]; - if (!p || !e || e < p) - RETURN_FAILURE; - while (p < e) { - if (ctx->ptr >= end || - state->lower(*ctx->ptr) != state->lower(*p)) - RETURN_FAILURE; - p++; ctx->ptr++; - } - } - } - ctx->pattern++; - break; - - case SRE_OP_GROUPREF_EXISTS: - TRACE(("|%p|%p|GROUPREF_EXISTS %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[0])); - /* codeyes codeno ... */ - i = ctx->pattern[0]; - { - Py_ssize_t groupref = i+i; - if (groupref >= state->lastmark) { - ctx->pattern += ctx->pattern[1]; - break; - } else { - SRE_CHAR* p = (SRE_CHAR*) state->mark[groupref]; - SRE_CHAR* e = (SRE_CHAR*) state->mark[groupref+1]; - if (!p || !e || e < p) { - ctx->pattern += ctx->pattern[1]; - break; - } - } - } - ctx->pattern += 2; - break; - - case SRE_OP_ASSERT: - /* assert subpattern */ - /* */ - TRACE(("|%p|%p|ASSERT %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[1])); - state->ptr = ctx->ptr - ctx->pattern[1]; - if (state->ptr < state->beginning) - RETURN_FAILURE; - DO_JUMP(JUMP_ASSERT, jump_assert, ctx->pattern+2); - RETURN_ON_FAILURE(ret); - ctx->pattern += ctx->pattern[0]; - break; - - case SRE_OP_ASSERT_NOT: - /* assert not subpattern */ - /* */ - TRACE(("|%p|%p|ASSERT_NOT %d\n", ctx->pattern, - ctx->ptr, ctx->pattern[1])); - state->ptr = ctx->ptr - ctx->pattern[1]; - if (state->ptr >= state->beginning) { - DO_JUMP(JUMP_ASSERT_NOT, jump_assert_not, ctx->pattern+2); - if (ret) { - RETURN_ON_ERROR(ret); - RETURN_FAILURE; - } - } - ctx->pattern += ctx->pattern[0]; - break; - - case SRE_OP_FAILURE: - /* immediate failure */ - TRACE(("|%p|%p|FAILURE\n", ctx->pattern, ctx->ptr)); - RETURN_FAILURE; - - default: - TRACE(("|%p|%p|UNKNOWN %d\n", ctx->pattern, ctx->ptr, - ctx->pattern[-1])); - RETURN_ERROR(SRE_ERROR_ILLEGAL); - } - } - -exit: - ctx_pos = ctx->last_ctx_pos; - jump = ctx->jump; - DATA_POP_DISCARD(ctx); - if (ctx_pos == -1) - return ret; - DATA_LOOKUP_AT(SRE_MATCH_CONTEXT, ctx, ctx_pos); - - switch (jump) { - case JUMP_MAX_UNTIL_2: - TRACE(("|%p|%p|JUMP_MAX_UNTIL_2\n", ctx->pattern, ctx->ptr)); - goto jump_max_until_2; - case JUMP_MAX_UNTIL_3: - TRACE(("|%p|%p|JUMP_MAX_UNTIL_3\n", ctx->pattern, ctx->ptr)); - goto jump_max_until_3; - case JUMP_MIN_UNTIL_2: - TRACE(("|%p|%p|JUMP_MIN_UNTIL_2\n", ctx->pattern, ctx->ptr)); - goto jump_min_until_2; - case JUMP_MIN_UNTIL_3: - TRACE(("|%p|%p|JUMP_MIN_UNTIL_3\n", ctx->pattern, ctx->ptr)); - goto jump_min_until_3; - case JUMP_BRANCH: - TRACE(("|%p|%p|JUMP_BRANCH\n", ctx->pattern, ctx->ptr)); - goto jump_branch; - case JUMP_MAX_UNTIL_1: - TRACE(("|%p|%p|JUMP_MAX_UNTIL_1\n", ctx->pattern, ctx->ptr)); - goto jump_max_until_1; - case JUMP_MIN_UNTIL_1: - TRACE(("|%p|%p|JUMP_MIN_UNTIL_1\n", ctx->pattern, ctx->ptr)); - goto jump_min_until_1; - case JUMP_REPEAT: - TRACE(("|%p|%p|JUMP_REPEAT\n", ctx->pattern, ctx->ptr)); - goto jump_repeat; - case JUMP_REPEAT_ONE_1: - TRACE(("|%p|%p|JUMP_REPEAT_ONE_1\n", ctx->pattern, ctx->ptr)); - goto jump_repeat_one_1; - case JUMP_REPEAT_ONE_2: - TRACE(("|%p|%p|JUMP_REPEAT_ONE_2\n", ctx->pattern, ctx->ptr)); - goto jump_repeat_one_2; - case JUMP_MIN_REPEAT_ONE: - TRACE(("|%p|%p|JUMP_MIN_REPEAT_ONE\n", ctx->pattern, ctx->ptr)); - goto jump_min_repeat_one; - case JUMP_ASSERT: - TRACE(("|%p|%p|JUMP_ASSERT\n", ctx->pattern, ctx->ptr)); - goto jump_assert; - case JUMP_ASSERT_NOT: - TRACE(("|%p|%p|JUMP_ASSERT_NOT\n", ctx->pattern, ctx->ptr)); - goto jump_assert_not; - case JUMP_NONE: - TRACE(("|%p|%p|RETURN %" PY_FORMAT_SIZE_T "d\n", ctx->pattern, - ctx->ptr, ret)); - break; - } - - return ret; /* should never get here */ -} - -LOCAL(Py_ssize_t) -SRE_SEARCH(SRE_STATE* state, SRE_CODE* pattern) -{ - SRE_CHAR* ptr = (SRE_CHAR *)state->start; - SRE_CHAR* end = (SRE_CHAR *)state->end; - Py_ssize_t status = 0; - Py_ssize_t prefix_len = 0; - Py_ssize_t prefix_skip = 0; - SRE_CODE* prefix = NULL; - SRE_CODE* charset = NULL; - SRE_CODE* overlap = NULL; - int flags = 0; - - if (pattern[0] == SRE_OP_INFO) { - /* optimization info block */ - /* <1=skip> <2=flags> <3=min> <4=max> <5=prefix info> */ - - flags = pattern[2]; - - if (pattern[3] > 1) { - /* adjust end point (but make sure we leave at least one - character in there, so literal search will work) */ - end -= pattern[3]-1; - if (end <= ptr) - end = ptr+1; - } - - if (flags & SRE_INFO_PREFIX) { - /* pattern starts with a known prefix */ - /* */ - prefix_len = pattern[5]; - prefix_skip = pattern[6]; - prefix = pattern + 7; - overlap = prefix + prefix_len - 1; - } else if (flags & SRE_INFO_CHARSET) - /* pattern starts with a character from a known set */ - /* */ - charset = pattern + 5; - - pattern += 1 + pattern[1]; - } - - TRACE(("prefix = %p %" PY_FORMAT_SIZE_T "d %" PY_FORMAT_SIZE_T "d\n", - prefix, prefix_len, prefix_skip)); - TRACE(("charset = %p\n", charset)); - -#if defined(USE_FAST_SEARCH) - if (prefix_len > 1) { - /* pattern starts with a known prefix. use the overlap - table to skip forward as fast as we possibly can */ - Py_ssize_t i = 0; - end = (SRE_CHAR *)state->end; - while (ptr < end) { - for (;;) { - if ((SRE_CODE) ptr[0] != prefix[i]) { - if (!i) - break; - else - i = overlap[i]; - } else { - if (++i == prefix_len) { - /* found a potential match */ - TRACE(("|%p|%p|SEARCH SCAN\n", pattern, ptr)); - state->start = ptr + 1 - prefix_len; - state->ptr = ptr + 1 - prefix_len + prefix_skip; - if (flags & SRE_INFO_LITERAL) - return 1; /* we got all of it */ - status = SRE_MATCH(state, pattern + 2*prefix_skip); - if (status != 0) - return status; - /* close but no cigar -- try again */ - i = overlap[i]; - } - break; - } - } - ptr++; - } - return 0; - } -#endif - - if (pattern[0] == SRE_OP_LITERAL) { - /* pattern starts with a literal character. this is used - for short prefixes, and if fast search is disabled */ - SRE_CODE chr = pattern[1]; - end = (SRE_CHAR *)state->end; - for (;;) { - while (ptr < end && (SRE_CODE) ptr[0] != chr) - ptr++; - if (ptr >= end) - return 0; - TRACE(("|%p|%p|SEARCH LITERAL\n", pattern, ptr)); - state->start = ptr; - state->ptr = ++ptr; - if (flags & SRE_INFO_LITERAL) - return 1; /* we got all of it */ - status = SRE_MATCH(state, pattern + 2); - if (status != 0) - break; - } - } else if (charset) { - /* pattern starts with a character from a known set */ - end = (SRE_CHAR *)state->end; - for (;;) { - while (ptr < end && !SRE_CHARSET(charset, ptr[0])) - ptr++; - if (ptr >= end) - return 0; - TRACE(("|%p|%p|SEARCH CHARSET\n", pattern, ptr)); - state->start = ptr; - state->ptr = ptr; - status = SRE_MATCH(state, pattern); - if (status != 0) - break; - ptr++; - } - } else - /* general case */ - while (ptr <= end) { - TRACE(("|%p|%p|SEARCH\n", pattern, ptr)); - state->start = state->ptr = ptr++; - status = SRE_MATCH(state, pattern); - if (status != 0) - break; - } - - return status; -} - -LOCAL(int) -SRE_LITERAL_TEMPLATE(SRE_CHAR* ptr, Py_ssize_t len) -{ - /* check if given string is a literal template (i.e. no escapes) */ - while (len-- > 0) - if (*ptr++ == '\\') - return 0; - return 1; -} - -#if !defined(SRE_RECURSIVE) - -/* -------------------------------------------------------------------- */ -/* factories and destructors */ - -/* see sre.h for object declarations */ -static PyObject*pattern_new_match(PatternObject*, SRE_STATE*, int); -static PyObject*pattern_scanner(PatternObject*, PyObject*); - -static PyObject * -sre_codesize(PyObject* self, PyObject *unused) -{ - return PyInt_FromSize_t(sizeof(SRE_CODE)); -} - -static PyObject * -sre_getlower(PyObject* self, PyObject* args) -{ - int character, flags; - if (!PyArg_ParseTuple(args, "ii", &character, &flags)) - return NULL; - if (flags & SRE_FLAG_LOCALE) - return Py_BuildValue("i", sre_lower_locale(character)); - if (flags & SRE_FLAG_UNICODE) -#if defined(HAVE_UNICODE) - return Py_BuildValue("i", sre_lower_unicode(character)); -#else - return Py_BuildValue("i", sre_lower_locale(character)); -#endif - return Py_BuildValue("i", sre_lower(character)); -} - -LOCAL(void) -state_reset(SRE_STATE* state) -{ - /* FIXME: dynamic! */ - /*memset(state->mark, 0, sizeof(*state->mark) * SRE_MARK_SIZE);*/ - - state->lastmark = -1; - state->lastindex = -1; - - state->repeat = NULL; - - data_stack_dealloc(state); -} - -static void* -getstring(PyObject* string, Py_ssize_t* p_length, int* p_charsize) -{ - /* given a python object, return a data pointer, a length (in - characters), and a character size. return NULL if the object - is not a string (or not compatible) */ - - PyBufferProcs *buffer; - Py_ssize_t size, bytes; - int charsize; - void* ptr; - -#if defined(HAVE_UNICODE) - if (PyUnicode_Check(string)) { - /* unicode strings doesn't always support the buffer interface */ - ptr = (void*) PyUnicode_AS_DATA(string); - /* bytes = PyUnicode_GET_DATA_SIZE(string); */ - size = PyUnicode_GET_SIZE(string); - charsize = sizeof(Py_UNICODE); - - } else { -#endif - - /* get pointer to string buffer */ - buffer = Py_TYPE(string)->tp_as_buffer; - if (!buffer || !buffer->bf_getreadbuffer || !buffer->bf_getsegcount || - buffer->bf_getsegcount(string, NULL) != 1) { - PyErr_SetString(PyExc_TypeError, "expected string or buffer"); - return NULL; - } - - /* determine buffer size */ - bytes = buffer->bf_getreadbuffer(string, 0, &ptr); - if (bytes < 0) { - PyErr_SetString(PyExc_TypeError, "buffer has negative size"); - return NULL; - } - - /* determine character size */ -#if PY_VERSION_HEX >= 0x01060000 - size = PyObject_Size(string); -#else - size = PyObject_Length(string); -#endif - - if (PyString_Check(string) || bytes == size) - charsize = 1; -#if defined(HAVE_UNICODE) - else if (bytes == (Py_ssize_t) (size * sizeof(Py_UNICODE))) - charsize = sizeof(Py_UNICODE); -#endif - else { - PyErr_SetString(PyExc_TypeError, "buffer size mismatch"); - return NULL; - } - -#if defined(HAVE_UNICODE) - } -#endif - - *p_length = size; - *p_charsize = charsize; - - return ptr; -} - -LOCAL(PyObject*) -state_init(SRE_STATE* state, PatternObject* pattern, PyObject* string, - Py_ssize_t start, Py_ssize_t end) -{ - /* prepare state object */ - - Py_ssize_t length; - int charsize; - void* ptr; - - memset(state, 0, sizeof(SRE_STATE)); - - state->lastmark = -1; - state->lastindex = -1; - - ptr = getstring(string, &length, &charsize); - if (!ptr) - return NULL; - - /* adjust boundaries */ - if (start < 0) - start = 0; - else if (start > length) - start = length; - - if (end < 0) - end = 0; - else if (end > length) - end = length; - - state->charsize = charsize; - - state->beginning = ptr; - - state->start = (void*) ((char*) ptr + start * state->charsize); - state->end = (void*) ((char*) ptr + end * state->charsize); - - Py_INCREF(string); - state->string = string; - state->pos = start; - state->endpos = end; - - if (pattern->flags & SRE_FLAG_LOCALE) - state->lower = sre_lower_locale; - else if (pattern->flags & SRE_FLAG_UNICODE) -#if defined(HAVE_UNICODE) - state->lower = sre_lower_unicode; -#else - state->lower = sre_lower_locale; -#endif - else - state->lower = sre_lower; - - return string; -} - -LOCAL(void) -state_fini(SRE_STATE* state) -{ - Py_XDECREF(state->string); - data_stack_dealloc(state); -} - -/* calculate offset from start of string */ -#define STATE_OFFSET(state, member)\ - (((char*)(member) - (char*)(state)->beginning) / (state)->charsize) - -LOCAL(PyObject*) -state_getslice(SRE_STATE* state, Py_ssize_t index, PyObject* string, int empty) -{ - Py_ssize_t i, j; - - index = (index - 1) * 2; - - if (string == Py_None || index >= state->lastmark || !state->mark[index] || !state->mark[index+1]) { - if (empty) - /* want empty string */ - i = j = 0; - else { - Py_INCREF(Py_None); - return Py_None; - } - } else { - i = STATE_OFFSET(state, state->mark[index]); - j = STATE_OFFSET(state, state->mark[index+1]); - } - - return PySequence_GetSlice(string, i, j); -} - -static void -pattern_error(int status) -{ - switch (status) { - case SRE_ERROR_RECURSION_LIMIT: - PyErr_SetString( - PyExc_RuntimeError, - "maximum recursion limit exceeded" - ); - break; - case SRE_ERROR_MEMORY: - PyErr_NoMemory(); - break; - case SRE_ERROR_INTERRUPTED: - /* An exception has already been raised, so let it fly */ - break; - default: - /* other error codes indicate compiler/engine bugs */ - PyErr_SetString( - PyExc_RuntimeError, - "internal error in regular expression engine" - ); - } -} - -static void -pattern_dealloc(PatternObject* self) -{ - if (self->weakreflist != NULL) - PyObject_ClearWeakRefs((PyObject *) self); - Py_XDECREF(self->pattern); - Py_XDECREF(self->groupindex); - Py_XDECREF(self->indexgroup); - PyObject_DEL(self); -} - -static int -check_args_size(const char *name, PyObject* args, PyObject* kw, int n) -{ - Py_ssize_t m = PyTuple_GET_SIZE(args) + (kw ? PyDict_Size(kw) : 0); - if (m <= n) - return 1; - PyErr_Format(PyExc_TypeError, - "%s() takes at most %d positional arguments (%zd given)", - name, n, m); - return 0; -} - -static PyObject* -fix_string_param(PyObject *string, PyObject *string2, const char *oldname) -{ - if (string2 != NULL) { - char buf[100]; - if (string != NULL) { - PyErr_Format(PyExc_TypeError, - "Argument given by name ('%s') and position (1)", - oldname); - return NULL; - } - sprintf(buf, "The '%s' keyword parameter name is deprecated. " - "Use 'string' instead.", oldname); - if (PyErr_Warn(PyExc_DeprecationWarning, buf) < 0) - return NULL; - return string2; - } - if (string == NULL) { - PyErr_SetString(PyExc_TypeError, - "Required argument 'string' (pos 1) not found"); - return NULL; - } - return string; -} - -static PyObject* -pattern_match(PatternObject* self, PyObject* args, PyObject* kw) -{ - SRE_STATE state; - int status; - - PyObject *string = NULL, *string2 = NULL; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - static char* kwlist[] = { "string", "pos", "endpos", "pattern", NULL }; - if (!check_args_size("match", args, kw, 3)) - return NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|OnnO:match", kwlist, - &string, &start, &end, &string2)) - return NULL; - - string = fix_string_param(string, string2, "pattern"); - if (!string) - return NULL; - - string = state_init(&state, self, string, start, end); - if (!string) - return NULL; - - state.ptr = state.start; - - TRACE(("|%p|%p|MATCH\n", PatternObject_GetCode(self), state.ptr)); - - if (state.charsize == 1) { - status = sre_match(&state, PatternObject_GetCode(self)); - } else { -#if defined(HAVE_UNICODE) - status = sre_umatch(&state, PatternObject_GetCode(self)); -#endif - } - - TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr)); - if (PyErr_Occurred()) - return NULL; - - state_fini(&state); - - return pattern_new_match(self, &state, status); -} - -static PyObject* -pattern_search(PatternObject* self, PyObject* args, PyObject* kw) -{ - SRE_STATE state; - int status; - - PyObject *string = NULL, *string2 = NULL; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - static char* kwlist[] = { "string", "pos", "endpos", "pattern", NULL }; - if (!check_args_size("search", args, kw, 3)) - return NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|OnnO:search", kwlist, - &string, &start, &end, &string2)) - return NULL; - - string = fix_string_param(string, string2, "pattern"); - if (!string) - return NULL; - - string = state_init(&state, self, string, start, end); - if (!string) - return NULL; - - TRACE(("|%p|%p|SEARCH\n", PatternObject_GetCode(self), state.ptr)); - - if (state.charsize == 1) { - status = sre_search(&state, PatternObject_GetCode(self)); - } else { -#if defined(HAVE_UNICODE) - status = sre_usearch(&state, PatternObject_GetCode(self)); -#endif - } - - TRACE(("|%p|%p|END\n", PatternObject_GetCode(self), state.ptr)); - - state_fini(&state); - - if (PyErr_Occurred()) - return NULL; - - return pattern_new_match(self, &state, status); -} - -static PyObject* -call(char* module, char* function, PyObject* args) -{ - PyObject* name; - PyObject* mod; - PyObject* func; - PyObject* result; - - if (!args) - return NULL; - name = PyString_FromString(module); - if (!name) - return NULL; - mod = PyImport_Import(name); - Py_DECREF(name); - if (!mod) - return NULL; - func = PyObject_GetAttrString(mod, function); - Py_DECREF(mod); - if (!func) - return NULL; - result = PyObject_CallObject(func, args); - Py_DECREF(func); - Py_DECREF(args); - return result; -} - -#ifdef USE_BUILTIN_COPY -static int -deepcopy(PyObject** object, PyObject* memo) -{ - PyObject* copy; - - copy = call( - "copy", "deepcopy", - PyTuple_Pack(2, *object, memo) - ); - if (!copy) - return 0; - - Py_DECREF(*object); - *object = copy; - - return 1; /* success */ -} -#endif - -static PyObject* -join_list(PyObject* list, PyObject* string) -{ - /* join list elements */ - - PyObject* joiner; -#if PY_VERSION_HEX >= 0x01060000 - PyObject* function; - PyObject* args; -#endif - PyObject* result; - - joiner = PySequence_GetSlice(string, 0, 0); - if (!joiner) - return NULL; - - if (PyList_GET_SIZE(list) == 0) { - Py_DECREF(list); - return joiner; - } - -#if PY_VERSION_HEX >= 0x01060000 - function = PyObject_GetAttrString(joiner, "join"); - if (!function) { - Py_DECREF(joiner); - return NULL; - } - args = PyTuple_New(1); - if (!args) { - Py_DECREF(function); - Py_DECREF(joiner); - return NULL; - } - PyTuple_SET_ITEM(args, 0, list); - result = PyObject_CallObject(function, args); - Py_DECREF(args); /* also removes list */ - Py_DECREF(function); -#else - result = call( - "string", "join", - PyTuple_Pack(2, list, joiner) - ); -#endif - Py_DECREF(joiner); - - return result; -} - -static PyObject* -pattern_findall(PatternObject* self, PyObject* args, PyObject* kw) -{ - SRE_STATE state; - PyObject* list; - int status; - Py_ssize_t i, b, e; - - PyObject *string = NULL, *string2 = NULL; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - static char* kwlist[] = { "string", "pos", "endpos", "source", NULL }; - if (!check_args_size("findall", args, kw, 3)) - return NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|OnnO:findall", kwlist, - &string, &start, &end, &string2)) - return NULL; - - string = fix_string_param(string, string2, "source"); - if (!string) - return NULL; - - string = state_init(&state, self, string, start, end); - if (!string) - return NULL; - - list = PyList_New(0); - if (!list) { - state_fini(&state); - return NULL; - } - - while (state.start <= state.end) { - - PyObject* item; - - state_reset(&state); - - state.ptr = state.start; - - if (state.charsize == 1) { - status = sre_search(&state, PatternObject_GetCode(self)); - } else { -#if defined(HAVE_UNICODE) - status = sre_usearch(&state, PatternObject_GetCode(self)); -#endif - } - - if (PyErr_Occurred()) - goto error; - - if (status <= 0) { - if (status == 0) - break; - pattern_error(status); - goto error; - } - - /* don't bother to build a match object */ - switch (self->groups) { - case 0: - b = STATE_OFFSET(&state, state.start); - e = STATE_OFFSET(&state, state.ptr); - item = PySequence_GetSlice(string, b, e); - if (!item) - goto error; - break; - case 1: - item = state_getslice(&state, 1, string, 1); - if (!item) - goto error; - break; - default: - item = PyTuple_New(self->groups); - if (!item) - goto error; - for (i = 0; i < self->groups; i++) { - PyObject* o = state_getslice(&state, i+1, string, 1); - if (!o) { - Py_DECREF(item); - goto error; - } - PyTuple_SET_ITEM(item, i, o); - } - break; - } - - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - - if (state.ptr == state.start) - state.start = (void*) ((char*) state.ptr + state.charsize); - else - state.start = state.ptr; - - } - - state_fini(&state); - return list; - -error: - Py_DECREF(list); - state_fini(&state); - return NULL; - -} - -#if PY_VERSION_HEX >= 0x02020000 -static PyObject* -pattern_finditer(PatternObject* pattern, PyObject* args) -{ - PyObject* scanner; - PyObject* search; - PyObject* iterator; - - scanner = pattern_scanner(pattern, args); - if (!scanner) - return NULL; - - search = PyObject_GetAttrString(scanner, "search"); - Py_DECREF(scanner); - if (!search) - return NULL; - - iterator = PyCallIter_New(search, Py_None); - Py_DECREF(search); - - return iterator; -} -#endif - -static PyObject* -pattern_split(PatternObject* self, PyObject* args, PyObject* kw) -{ - SRE_STATE state; - PyObject* list; - PyObject* item; - int status; - Py_ssize_t n; - Py_ssize_t i; - void* last; - - PyObject *string = NULL, *string2 = NULL; - Py_ssize_t maxsplit = 0; - static char* kwlist[] = { "string", "maxsplit", "source", NULL }; - if (!check_args_size("split", args, kw, 2)) - return NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kw, "|OnO:split", kwlist, - &string, &maxsplit, &string2)) - return NULL; - - string = fix_string_param(string, string2, "source"); - if (!string) - return NULL; - - string = state_init(&state, self, string, 0, PY_SSIZE_T_MAX); - if (!string) - return NULL; - - list = PyList_New(0); - if (!list) { - state_fini(&state); - return NULL; - } - - n = 0; - last = state.start; - - while (!maxsplit || n < maxsplit) { - - state_reset(&state); - - state.ptr = state.start; - - if (state.charsize == 1) { - status = sre_search(&state, PatternObject_GetCode(self)); - } else { -#if defined(HAVE_UNICODE) - status = sre_usearch(&state, PatternObject_GetCode(self)); -#endif - } - - if (PyErr_Occurred()) - goto error; - - if (status <= 0) { - if (status == 0) - break; - pattern_error(status); - goto error; - } - - if (state.start == state.ptr) { - if (last == state.end) - break; - /* skip one character */ - state.start = (void*) ((char*) state.ptr + state.charsize); - continue; - } - - /* get segment before this match */ - item = PySequence_GetSlice( - string, STATE_OFFSET(&state, last), - STATE_OFFSET(&state, state.start) - ); - if (!item) - goto error; - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - - /* add groups (if any) */ - for (i = 0; i < self->groups; i++) { - item = state_getslice(&state, i+1, string, 0); - if (!item) - goto error; - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - } - - n = n + 1; - - last = state.start = state.ptr; - - } - - /* get segment following last match (even if empty) */ - item = PySequence_GetSlice( - string, STATE_OFFSET(&state, last), state.endpos - ); - if (!item) - goto error; - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - - state_fini(&state); - return list; - -error: - Py_DECREF(list); - state_fini(&state); - return NULL; - -} - -static PyObject* -pattern_subx(PatternObject* self, PyObject* ptemplate, PyObject* string, - Py_ssize_t count, Py_ssize_t subn) -{ - SRE_STATE state; - PyObject* list; - PyObject* item; - PyObject* filter; - PyObject* args; - PyObject* match; - void* ptr; - int status; - Py_ssize_t n; - Py_ssize_t i, b, e; - int bint; - int filter_is_callable; - - if (PyCallable_Check(ptemplate)) { - /* sub/subn takes either a function or a template */ - filter = ptemplate; - Py_INCREF(filter); - filter_is_callable = 1; - } else { - /* if not callable, check if it's a literal string */ - int literal; - ptr = getstring(ptemplate, &n, &bint); - b = bint; - if (ptr) { - if (b == 1) { - literal = sre_literal_template((unsigned char *)ptr, n); - } else { -#if defined(HAVE_UNICODE) - literal = sre_uliteral_template((Py_UNICODE *)ptr, n); -#endif - } - } else { - PyErr_Clear(); - literal = 0; - } - if (literal) { - filter = ptemplate; - Py_INCREF(filter); - filter_is_callable = 0; - } else { - /* not a literal; hand it over to the template compiler */ - filter = call( - SRE_PY_MODULE, "_subx", - PyTuple_Pack(2, self, ptemplate) - ); - if (!filter) - return NULL; - filter_is_callable = PyCallable_Check(filter); - } - } - - string = state_init(&state, self, string, 0, PY_SSIZE_T_MAX); - if (!string) { - Py_DECREF(filter); - return NULL; - } - - list = PyList_New(0); - if (!list) { - Py_DECREF(filter); - state_fini(&state); - return NULL; - } - - n = i = 0; - - while (!count || n < count) { - - state_reset(&state); - - state.ptr = state.start; - - if (state.charsize == 1) { - status = sre_search(&state, PatternObject_GetCode(self)); - } else { -#if defined(HAVE_UNICODE) - status = sre_usearch(&state, PatternObject_GetCode(self)); -#endif - } - - if (PyErr_Occurred()) - goto error; - - if (status <= 0) { - if (status == 0) - break; - pattern_error(status); - goto error; - } - - b = STATE_OFFSET(&state, state.start); - e = STATE_OFFSET(&state, state.ptr); - - if (i < b) { - /* get segment before this match */ - item = PySequence_GetSlice(string, i, b); - if (!item) - goto error; - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - - } else if (i == b && i == e && n > 0) - /* ignore empty match on latest position */ - goto next; - - if (filter_is_callable) { - /* pass match object through filter */ - match = pattern_new_match(self, &state, 1); - if (!match) - goto error; - args = PyTuple_Pack(1, match); - if (!args) { - Py_DECREF(match); - goto error; - } - item = PyObject_CallObject(filter, args); - Py_DECREF(args); - Py_DECREF(match); - if (!item) - goto error; - } else { - /* filter is literal string */ - item = filter; - Py_INCREF(item); - } - - /* add to list */ - if (item != Py_None) { - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - } - - i = e; - n = n + 1; - -next: - /* move on */ - if (state.ptr == state.start) - state.start = (void*) ((char*) state.ptr + state.charsize); - else - state.start = state.ptr; - - } - - /* get segment following last match */ - if (i < state.endpos) { - item = PySequence_GetSlice(string, i, state.endpos); - if (!item) - goto error; - status = PyList_Append(list, item); - Py_DECREF(item); - if (status < 0) - goto error; - } - - state_fini(&state); - - Py_DECREF(filter); - - /* convert list to single string (also removes list) */ - item = join_list(list, string); - - if (!item) - return NULL; - - if (subn) - return Py_BuildValue("Nn", item, n); - - return item; - -error: - Py_DECREF(list); - state_fini(&state); - Py_DECREF(filter); - return NULL; - -} - -static PyObject* -pattern_sub(PatternObject* self, PyObject* args, PyObject* kw) -{ - PyObject* ptemplate; - PyObject* string; - Py_ssize_t count = 0; - static char* kwlist[] = { "repl", "string", "count", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|n:sub", kwlist, - &ptemplate, &string, &count)) - return NULL; - - return pattern_subx(self, ptemplate, string, count, 0); -} - -static PyObject* -pattern_subn(PatternObject* self, PyObject* args, PyObject* kw) -{ - PyObject* ptemplate; - PyObject* string; - Py_ssize_t count = 0; - static char* kwlist[] = { "repl", "string", "count", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kw, "OO|n:subn", kwlist, - &ptemplate, &string, &count)) - return NULL; - - return pattern_subx(self, ptemplate, string, count, 1); -} - -static PyObject* -pattern_copy(PatternObject* self, PyObject *unused) -{ -#ifdef USE_BUILTIN_COPY - PatternObject* copy; - int offset; - - copy = PyObject_NEW_VAR(PatternObject, &Pattern_Type, self->codesize); - if (!copy) - return NULL; - - offset = offsetof(PatternObject, groups); - - Py_XINCREF(self->groupindex); - Py_XINCREF(self->indexgroup); - Py_XINCREF(self->pattern); - - memcpy((char*) copy + offset, (char*) self + offset, - sizeof(PatternObject) + self->codesize * sizeof(SRE_CODE) - offset); - copy->weakreflist = NULL; - - return (PyObject*) copy; -#else - PyErr_SetString(PyExc_TypeError, "cannot copy this pattern object"); - return NULL; -#endif -} - -static PyObject* -pattern_deepcopy(PatternObject* self, PyObject* memo) -{ -#ifdef USE_BUILTIN_COPY - PatternObject* copy; - - copy = (PatternObject*) pattern_copy(self); - if (!copy) - return NULL; - - if (!deepcopy(©->groupindex, memo) || - !deepcopy(©->indexgroup, memo) || - !deepcopy(©->pattern, memo)) { - Py_DECREF(copy); - return NULL; - } - -#else - PyErr_SetString(PyExc_TypeError, "cannot deepcopy this pattern object"); - return NULL; -#endif -} - -PyDoc_STRVAR(pattern_match_doc, -"match(string[, pos[, endpos]]) --> match object or None.\n\ - Matches zero or more characters at the beginning of the string"); - -PyDoc_STRVAR(pattern_search_doc, -"search(string[, pos[, endpos]]) --> match object or None.\n\ - Scan through string looking for a match, and return a corresponding\n\ - match object instance. Return None if no position in the string matches."); - -PyDoc_STRVAR(pattern_split_doc, -"split(string[, maxsplit = 0]) --> list.\n\ - Split string by the occurrences of pattern."); - -PyDoc_STRVAR(pattern_findall_doc, -"findall(string[, pos[, endpos]]) --> list.\n\ - Return a list of all non-overlapping matches of pattern in string."); - -PyDoc_STRVAR(pattern_finditer_doc, -"finditer(string[, pos[, endpos]]) --> iterator.\n\ - Return an iterator over all non-overlapping matches for the \n\ - RE pattern in string. For each match, the iterator returns a\n\ - match object."); - -PyDoc_STRVAR(pattern_sub_doc, -"sub(repl, string[, count = 0]) --> newstring\n\ - Return the string obtained by replacing the leftmost non-overlapping\n\ - occurrences of pattern in string by the replacement repl."); - -PyDoc_STRVAR(pattern_subn_doc, -"subn(repl, string[, count = 0]) --> (newstring, number of subs)\n\ - Return the tuple (new_string, number_of_subs_made) found by replacing\n\ - the leftmost non-overlapping occurrences of pattern with the\n\ - replacement repl."); - -PyDoc_STRVAR(pattern_doc, "Compiled regular expression objects"); - -static PyMethodDef pattern_methods[] = { - {"match", (PyCFunction) pattern_match, METH_VARARGS|METH_KEYWORDS, - pattern_match_doc}, - {"search", (PyCFunction) pattern_search, METH_VARARGS|METH_KEYWORDS, - pattern_search_doc}, - {"sub", (PyCFunction) pattern_sub, METH_VARARGS|METH_KEYWORDS, - pattern_sub_doc}, - {"subn", (PyCFunction) pattern_subn, METH_VARARGS|METH_KEYWORDS, - pattern_subn_doc}, - {"split", (PyCFunction) pattern_split, METH_VARARGS|METH_KEYWORDS, - pattern_split_doc}, - {"findall", (PyCFunction) pattern_findall, METH_VARARGS|METH_KEYWORDS, - pattern_findall_doc}, -#if PY_VERSION_HEX >= 0x02020000 - {"finditer", (PyCFunction) pattern_finditer, METH_VARARGS, - pattern_finditer_doc}, -#endif - {"scanner", (PyCFunction) pattern_scanner, METH_VARARGS}, - {"__copy__", (PyCFunction) pattern_copy, METH_NOARGS}, - {"__deepcopy__", (PyCFunction) pattern_deepcopy, METH_O}, - {NULL, NULL} -}; - -#define PAT_OFF(x) offsetof(PatternObject, x) -static PyMemberDef pattern_members[] = { - {"pattern", T_OBJECT, PAT_OFF(pattern), READONLY}, - {"flags", T_INT, PAT_OFF(flags), READONLY}, - {"groups", T_PYSSIZET, PAT_OFF(groups), READONLY}, - {"groupindex", T_OBJECT, PAT_OFF(groupindex), READONLY}, - {NULL} /* Sentinel */ -}; - -statichere PyTypeObject Pattern_Type = { - PyObject_HEAD_INIT(NULL) - 0, "_" SRE_MODULE ".SRE_Pattern", - sizeof(PatternObject), sizeof(SRE_CODE), - (destructor)pattern_dealloc, /*tp_dealloc*/ - 0, /* tp_print */ - 0, /* tp_getattrn */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - pattern_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - offsetof(PatternObject, weakreflist), /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - pattern_methods, /* tp_methods */ - pattern_members, /* tp_members */ -}; - -static int _validate(PatternObject *self); /* Forward */ - -static PyObject * -_compile(PyObject* self_, PyObject* args) -{ - /* "compile" pattern descriptor to pattern object */ - - PatternObject* self; - Py_ssize_t i, n; - - PyObject* pattern; - int flags = 0; - PyObject* code; - Py_ssize_t groups = 0; - PyObject* groupindex = NULL; - PyObject* indexgroup = NULL; - if (!PyArg_ParseTuple(args, "OiO!|nOO", &pattern, &flags, - &PyList_Type, &code, &groups, - &groupindex, &indexgroup)) - return NULL; - - n = PyList_GET_SIZE(code); - /* coverity[ampersand_in_size] */ - self = PyObject_NEW_VAR(PatternObject, &Pattern_Type, n); - if (!self) - return NULL; - self->weakreflist = NULL; - self->pattern = NULL; - self->groupindex = NULL; - self->indexgroup = NULL; - - self->codesize = n; - - for (i = 0; i < n; i++) { - PyObject *o = PyList_GET_ITEM(code, i); - unsigned long value = PyInt_Check(o) ? (unsigned long)PyInt_AsLong(o) - : PyLong_AsUnsignedLong(o); - if (value == (unsigned long)-1 && PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) { - PyErr_SetString(PyExc_OverflowError, - "regular expression code size limit exceeded"); - } - break; - } - self->code[i] = (SRE_CODE) value; - if ((unsigned long) self->code[i] != value) { - PyErr_SetString(PyExc_OverflowError, - "regular expression code size limit exceeded"); - break; - } - } - - if (PyErr_Occurred()) { - Py_DECREF(self); - return NULL; - } - - Py_INCREF(pattern); - self->pattern = pattern; - - self->flags = flags; - - self->groups = groups; - - Py_XINCREF(groupindex); - self->groupindex = groupindex; - - Py_XINCREF(indexgroup); - self->indexgroup = indexgroup; - - self->weakreflist = NULL; - - if (!_validate(self)) { - Py_DECREF(self); - return NULL; - } - - return (PyObject*) self; -} - -/* -------------------------------------------------------------------- */ -/* Code validation */ - -/* To learn more about this code, have a look at the _compile() function in - Lib/sre_compile.py. The validation functions below checks the code array - for conformance with the code patterns generated there. - - The nice thing about the generated code is that it is position-independent: - all jumps are relative jumps forward. Also, jumps don't cross each other: - the target of a later jump is always earlier than the target of an earlier - jump. IOW, this is okay: - - J---------J-------T--------T - \ \_____/ / - \______________________/ - - but this is not: - - J---------J-------T--------T - \_________\_____/ / - \____________/ - - It also helps that SRE_CODE is always an unsigned type. -*/ - -/* Defining this one enables tracing of the validator */ -#undef VVERBOSE - -/* Trace macro for the validator */ -#if defined(VVERBOSE) -#define VTRACE(v) printf v -#else -#define VTRACE(v) do {} while(0) /* do nothing */ -#endif - -/* Report failure */ -#define FAIL do { VTRACE(("FAIL: %d\n", __LINE__)); return 0; } while (0) - -/* Extract opcode, argument, or skip count from code array */ -#define GET_OP \ - do { \ - VTRACE(("%p: ", code)); \ - if (code >= end) FAIL; \ - op = *code++; \ - VTRACE(("%lu (op)\n", (unsigned long)op)); \ - } while (0) -#define GET_ARG \ - do { \ - VTRACE(("%p= ", code)); \ - if (code >= end) FAIL; \ - arg = *code++; \ - VTRACE(("%lu (arg)\n", (unsigned long)arg)); \ - } while (0) -#define GET_SKIP_ADJ(adj) \ - do { \ - VTRACE(("%p= ", code)); \ - if (code >= end) FAIL; \ - skip = *code; \ - VTRACE(("%lu (skip to %p)\n", \ - (unsigned long)skip, code+skip)); \ - if (skip-adj > end-code) \ - FAIL; \ - code++; \ - } while (0) -#define GET_SKIP GET_SKIP_ADJ(0) - -static int -_validate_charset(SRE_CODE *code, SRE_CODE *end) -{ - /* Some variables are manipulated by the macros above */ - SRE_CODE op; - SRE_CODE arg; - SRE_CODE offset; - int i; - - while (code < end) { - GET_OP; - switch (op) { - - case SRE_OP_NEGATE: - break; - - case SRE_OP_LITERAL: - GET_ARG; - break; - - case SRE_OP_RANGE: - GET_ARG; - GET_ARG; - break; - - case SRE_OP_CHARSET: - offset = 32/sizeof(SRE_CODE); /* 32-byte bitmap */ - if (offset > end-code) - FAIL; - code += offset; - break; - - case SRE_OP_BIGCHARSET: - GET_ARG; /* Number of blocks */ - offset = 256/sizeof(SRE_CODE); /* 256-byte table */ - if (offset > end-code) - FAIL; - /* Make sure that each byte points to a valid block */ - for (i = 0; i < 256; i++) { - if (((unsigned char *)code)[i] >= arg) - FAIL; - } - code += offset; - offset = arg * 32/sizeof(SRE_CODE); /* 32-byte bitmap times arg */ - if (offset > end-code) - FAIL; - code += offset; - break; - - case SRE_OP_CATEGORY: - GET_ARG; - switch (arg) { - case SRE_CATEGORY_DIGIT: - case SRE_CATEGORY_NOT_DIGIT: - case SRE_CATEGORY_SPACE: - case SRE_CATEGORY_NOT_SPACE: - case SRE_CATEGORY_WORD: - case SRE_CATEGORY_NOT_WORD: - case SRE_CATEGORY_LINEBREAK: - case SRE_CATEGORY_NOT_LINEBREAK: - case SRE_CATEGORY_LOC_WORD: - case SRE_CATEGORY_LOC_NOT_WORD: - case SRE_CATEGORY_UNI_DIGIT: - case SRE_CATEGORY_UNI_NOT_DIGIT: - case SRE_CATEGORY_UNI_SPACE: - case SRE_CATEGORY_UNI_NOT_SPACE: - case SRE_CATEGORY_UNI_WORD: - case SRE_CATEGORY_UNI_NOT_WORD: - case SRE_CATEGORY_UNI_LINEBREAK: - case SRE_CATEGORY_UNI_NOT_LINEBREAK: - break; - default: - FAIL; - } - break; - - default: - FAIL; - - } - } - - return 1; -} - -static int -_validate_inner(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups) -{ - /* Some variables are manipulated by the macros above */ - SRE_CODE op; - SRE_CODE arg; - SRE_CODE skip; - - VTRACE(("code=%p, end=%p\n", code, end)); - - if (code > end) - FAIL; - - while (code < end) { - GET_OP; - switch (op) { - - case SRE_OP_MARK: - /* We don't check whether marks are properly nested; the - sre_match() code is robust even if they don't, and the worst - you can get is nonsensical match results. */ - GET_ARG; - if (arg > 2*groups+1) { - VTRACE(("arg=%d, groups=%d\n", (int)arg, (int)groups)); - FAIL; - } - break; - - case SRE_OP_LITERAL: - case SRE_OP_NOT_LITERAL: - case SRE_OP_LITERAL_IGNORE: - case SRE_OP_NOT_LITERAL_IGNORE: - GET_ARG; - /* The arg is just a character, nothing to check */ - break; - - case SRE_OP_SUCCESS: - case SRE_OP_FAILURE: - /* Nothing to check; these normally end the matching process */ - break; - - case SRE_OP_AT: - GET_ARG; - switch (arg) { - case SRE_AT_BEGINNING: - case SRE_AT_BEGINNING_STRING: - case SRE_AT_BEGINNING_LINE: - case SRE_AT_END: - case SRE_AT_END_LINE: - case SRE_AT_END_STRING: - case SRE_AT_BOUNDARY: - case SRE_AT_NON_BOUNDARY: - case SRE_AT_LOC_BOUNDARY: - case SRE_AT_LOC_NON_BOUNDARY: - case SRE_AT_UNI_BOUNDARY: - case SRE_AT_UNI_NON_BOUNDARY: - break; - default: - FAIL; - } - break; - - case SRE_OP_ANY: - case SRE_OP_ANY_ALL: - /* These have no operands */ - break; - - case SRE_OP_IN: - case SRE_OP_IN_IGNORE: - GET_SKIP; - /* Stop 1 before the end; we check the FAILURE below */ - if (!_validate_charset(code, code+skip-2)) - FAIL; - if (code[skip-2] != SRE_OP_FAILURE) - FAIL; - code += skip-1; - break; - - case SRE_OP_INFO: - { - /* A minimal info field is - <1=skip> <2=flags> <3=min> <4=max>; - If SRE_INFO_PREFIX or SRE_INFO_CHARSET is in the flags, - more follows. */ - SRE_CODE flags, i; - SRE_CODE *newcode; - GET_SKIP; - newcode = code+skip-1; - GET_ARG; flags = arg; - GET_ARG; /* min */ - GET_ARG; /* max */ - /* Check that only valid flags are present */ - if ((flags & ~(SRE_INFO_PREFIX | - SRE_INFO_LITERAL | - SRE_INFO_CHARSET)) != 0) - FAIL; - /* PREFIX and CHARSET are mutually exclusive */ - if ((flags & SRE_INFO_PREFIX) && - (flags & SRE_INFO_CHARSET)) - FAIL; - /* LITERAL implies PREFIX */ - if ((flags & SRE_INFO_LITERAL) && - !(flags & SRE_INFO_PREFIX)) - FAIL; - /* Validate the prefix */ - if (flags & SRE_INFO_PREFIX) { - SRE_CODE prefix_len; - GET_ARG; prefix_len = arg; - GET_ARG; /* prefix skip */ - /* Here comes the prefix string */ - if (prefix_len > newcode-code) - FAIL; - code += prefix_len; - /* And here comes the overlap table */ - if (prefix_len > newcode-code) - FAIL; - /* Each overlap value should be < prefix_len */ - for (i = 0; i < prefix_len; i++) { - if (code[i] >= prefix_len) - FAIL; - } - code += prefix_len; - } - /* Validate the charset */ - if (flags & SRE_INFO_CHARSET) { - if (!_validate_charset(code, newcode-1)) - FAIL; - if (newcode[-1] != SRE_OP_FAILURE) - FAIL; - code = newcode; - } - else if (code != newcode) { - VTRACE(("code=%p, newcode=%p\n", code, newcode)); - FAIL; - } - } - break; - - case SRE_OP_BRANCH: - { - SRE_CODE *target = NULL; - for (;;) { - GET_SKIP; - if (skip == 0) - break; - /* Stop 2 before the end; we check the JUMP below */ - if (!_validate_inner(code, code+skip-3, groups)) - FAIL; - code += skip-3; - /* Check that it ends with a JUMP, and that each JUMP - has the same target */ - GET_OP; - if (op != SRE_OP_JUMP) - FAIL; - GET_SKIP; - if (target == NULL) - target = code+skip-1; - else if (code+skip-1 != target) - FAIL; - } - } - break; - - case SRE_OP_REPEAT_ONE: - case SRE_OP_MIN_REPEAT_ONE: - { - SRE_CODE min, max; - GET_SKIP; - GET_ARG; min = arg; - GET_ARG; max = arg; - if (min > max) - FAIL; - if (max > SRE_MAXREPEAT) - FAIL; - if (!_validate_inner(code, code+skip-4, groups)) - FAIL; - code += skip-4; - GET_OP; - if (op != SRE_OP_SUCCESS) - FAIL; - } - break; - - case SRE_OP_REPEAT: - { - SRE_CODE min, max; - GET_SKIP; - GET_ARG; min = arg; - GET_ARG; max = arg; - if (min > max) - FAIL; - if (max > SRE_MAXREPEAT) - FAIL; - if (!_validate_inner(code, code+skip-3, groups)) - FAIL; - code += skip-3; - GET_OP; - if (op != SRE_OP_MAX_UNTIL && op != SRE_OP_MIN_UNTIL) - FAIL; - } - break; - - case SRE_OP_GROUPREF: - case SRE_OP_GROUPREF_IGNORE: - GET_ARG; - if (arg >= groups) - FAIL; - break; - - case SRE_OP_GROUPREF_EXISTS: - /* The regex syntax for this is: '(?(group)then|else)', where - 'group' is either an integer group number or a group name, - 'then' and 'else' are sub-regexes, and 'else' is optional. */ - GET_ARG; - if (arg >= groups) - FAIL; - GET_SKIP_ADJ(1); - code--; /* The skip is relative to the first arg! */ - /* There are two possibilities here: if there is both a 'then' - part and an 'else' part, the generated code looks like: - - GROUPREF_EXISTS - - - ...then part... - JUMP - - ( jumps here) - ...else part... - ( jumps here) - - If there is only a 'then' part, it looks like: - - GROUPREF_EXISTS - - - ...then part... - ( jumps here) - - There is no direct way to decide which it is, and we don't want - to allow arbitrary jumps anywhere in the code; so we just look - for a JUMP opcode preceding our skip target. - */ - if (skip >= 3 && skip-3 < end-code && - code[skip-3] == SRE_OP_JUMP) - { - VTRACE(("both then and else parts present\n")); - if (!_validate_inner(code+1, code+skip-3, groups)) - FAIL; - code += skip-2; /* Position after JUMP, at */ - GET_SKIP; - if (!_validate_inner(code, code+skip-1, groups)) - FAIL; - code += skip-1; - } - else { - VTRACE(("only a then part present\n")); - if (!_validate_inner(code+1, code+skip-1, groups)) - FAIL; - code += skip-1; - } - break; - - case SRE_OP_ASSERT: - case SRE_OP_ASSERT_NOT: - GET_SKIP; - GET_ARG; /* 0 for lookahead, width for lookbehind */ - code--; /* Back up over arg to simplify math below */ - if (arg & 0x80000000) - FAIL; /* Width too large */ - /* Stop 1 before the end; we check the SUCCESS below */ - if (!_validate_inner(code+1, code+skip-2, groups)) - FAIL; - code += skip-2; - GET_OP; - if (op != SRE_OP_SUCCESS) - FAIL; - break; - - default: - FAIL; - - } - } - - VTRACE(("okay\n")); - return 1; -} - -static int -_validate_outer(SRE_CODE *code, SRE_CODE *end, Py_ssize_t groups) -{ - if (groups < 0 || groups > 100 || code >= end || end[-1] != SRE_OP_SUCCESS) - FAIL; - if (groups == 0) /* fix for simplejson */ - groups = 100; /* 100 groups should always be safe */ - return _validate_inner(code, end-1, groups); -} - -static int -_validate(PatternObject *self) -{ - if (!_validate_outer(self->code, self->code+self->codesize, self->groups)) - { - PyErr_SetString(PyExc_RuntimeError, "invalid SRE code"); - return 0; - } - else - VTRACE(("Success!\n")); - return 1; -} - -/* -------------------------------------------------------------------- */ -/* match methods */ - -static void -match_dealloc(MatchObject* self) -{ - Py_XDECREF(self->regs); - Py_XDECREF(self->string); - Py_DECREF(self->pattern); - PyObject_DEL(self); -} - -static PyObject* -match_getslice_by_index(MatchObject* self, Py_ssize_t index, PyObject* def) -{ - if (index < 0 || index >= self->groups) { - /* raise IndexError if we were given a bad group number */ - PyErr_SetString( - PyExc_IndexError, - "no such group" - ); - return NULL; - } - - index *= 2; - - if (self->string == Py_None || self->mark[index] < 0) { - /* return default value if the string or group is undefined */ - Py_INCREF(def); - return def; - } - - return PySequence_GetSlice( - self->string, self->mark[index], self->mark[index+1] - ); -} - -static Py_ssize_t -match_getindex(MatchObject* self, PyObject* index) -{ - Py_ssize_t i; - - if (PyInt_Check(index) || PyLong_Check(index)) - return PyInt_AsSsize_t(index); - - i = -1; - - if (self->pattern->groupindex) { - index = PyObject_GetItem(self->pattern->groupindex, index); - if (index) { - if (PyInt_Check(index) || PyLong_Check(index)) - i = PyInt_AsSsize_t(index); - Py_DECREF(index); - } else - PyErr_Clear(); - } - - return i; -} - -static PyObject* -match_getslice(MatchObject* self, PyObject* index, PyObject* def) -{ - return match_getslice_by_index(self, match_getindex(self, index), def); -} - -static PyObject* -match_expand(MatchObject* self, PyObject* ptemplate) -{ - /* delegate to Python code */ - return call( - SRE_PY_MODULE, "_expand", - PyTuple_Pack(3, self->pattern, self, ptemplate) - ); -} - -static PyObject* -match_group(MatchObject* self, PyObject* args) -{ - PyObject* result; - Py_ssize_t i, size; - - size = PyTuple_GET_SIZE(args); - - switch (size) { - case 0: - result = match_getslice(self, Py_False, Py_None); - break; - case 1: - result = match_getslice(self, PyTuple_GET_ITEM(args, 0), Py_None); - break; - default: - /* fetch multiple items */ - result = PyTuple_New(size); - if (!result) - return NULL; - for (i = 0; i < size; i++) { - PyObject* item = match_getslice( - self, PyTuple_GET_ITEM(args, i), Py_None - ); - if (!item) { - Py_DECREF(result); - return NULL; - } - PyTuple_SET_ITEM(result, i, item); - } - break; - } - return result; -} - -static PyObject* -match_groups(MatchObject* self, PyObject* args, PyObject* kw) -{ - PyObject* result; - Py_ssize_t index; - - PyObject* def = Py_None; - static char* kwlist[] = { "default", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groups", kwlist, &def)) - return NULL; - - result = PyTuple_New(self->groups-1); - if (!result) - return NULL; - - for (index = 1; index < self->groups; index++) { - PyObject* item; - item = match_getslice_by_index(self, index, def); - if (!item) { - Py_DECREF(result); - return NULL; - } - PyTuple_SET_ITEM(result, index-1, item); - } - - return result; -} - -static PyObject* -match_groupdict(MatchObject* self, PyObject* args, PyObject* kw) -{ - PyObject* result; - PyObject* keys; - Py_ssize_t index; - - PyObject* def = Py_None; - static char* kwlist[] = { "default", NULL }; - if (!PyArg_ParseTupleAndKeywords(args, kw, "|O:groupdict", kwlist, &def)) - return NULL; - - result = PyDict_New(); - if (!result || !self->pattern->groupindex) - return result; - - keys = PyMapping_Keys(self->pattern->groupindex); - if (!keys) - goto failed; - - for (index = 0; index < PyList_GET_SIZE(keys); index++) { - int status; - PyObject* key; - PyObject* value; - key = PyList_GET_ITEM(keys, index); - if (!key) - goto failed; - value = match_getslice(self, key, def); - if (!value) { - Py_DECREF(key); - goto failed; - } - status = PyDict_SetItem(result, key, value); - Py_DECREF(value); - if (status < 0) - goto failed; - } - - Py_DECREF(keys); - - return result; - -failed: - Py_XDECREF(keys); - Py_DECREF(result); - return NULL; -} - -static PyObject* -match_start(MatchObject* self, PyObject* args) -{ - Py_ssize_t index; - - PyObject* index_ = Py_False; /* zero */ - if (!PyArg_UnpackTuple(args, "start", 0, 1, &index_)) - return NULL; - - index = match_getindex(self, index_); - - if (index < 0 || index >= self->groups) { - PyErr_SetString( - PyExc_IndexError, - "no such group" - ); - return NULL; - } - - /* mark is -1 if group is undefined */ - return PyInt_FromSsize_t(self->mark[index*2]); -} - -static PyObject* -match_end(MatchObject* self, PyObject* args) -{ - Py_ssize_t index; - - PyObject* index_ = Py_False; /* zero */ - if (!PyArg_UnpackTuple(args, "end", 0, 1, &index_)) - return NULL; - - index = match_getindex(self, index_); - - if (index < 0 || index >= self->groups) { - PyErr_SetString( - PyExc_IndexError, - "no such group" - ); - return NULL; - } - - /* mark is -1 if group is undefined */ - return PyInt_FromSsize_t(self->mark[index*2+1]); -} - -LOCAL(PyObject*) -_pair(Py_ssize_t i1, Py_ssize_t i2) -{ - PyObject* pair; - PyObject* item; - - pair = PyTuple_New(2); - if (!pair) - return NULL; - - item = PyInt_FromSsize_t(i1); - if (!item) - goto error; - PyTuple_SET_ITEM(pair, 0, item); - - item = PyInt_FromSsize_t(i2); - if (!item) - goto error; - PyTuple_SET_ITEM(pair, 1, item); - - return pair; - - error: - Py_DECREF(pair); - return NULL; -} - -static PyObject* -match_span(MatchObject* self, PyObject* args) -{ - Py_ssize_t index; - - PyObject* index_ = Py_False; /* zero */ - if (!PyArg_UnpackTuple(args, "span", 0, 1, &index_)) - return NULL; - - index = match_getindex(self, index_); - - if (index < 0 || index >= self->groups) { - PyErr_SetString( - PyExc_IndexError, - "no such group" - ); - return NULL; - } - - /* marks are -1 if group is undefined */ - return _pair(self->mark[index*2], self->mark[index*2+1]); -} - -static PyObject* -match_regs(MatchObject* self) -{ - PyObject* regs; - PyObject* item; - Py_ssize_t index; - - regs = PyTuple_New(self->groups); - if (!regs) - return NULL; - - for (index = 0; index < self->groups; index++) { - item = _pair(self->mark[index*2], self->mark[index*2+1]); - if (!item) { - Py_DECREF(regs); - return NULL; - } - PyTuple_SET_ITEM(regs, index, item); - } - - Py_INCREF(regs); - self->regs = regs; - - return regs; -} - -static PyObject* -match_copy(MatchObject* self, PyObject *unused) -{ -#ifdef USE_BUILTIN_COPY - MatchObject* copy; - Py_ssize_t slots, offset; - - slots = 2 * (self->pattern->groups+1); - - copy = PyObject_NEW_VAR(MatchObject, &Match_Type, slots); - if (!copy) - return NULL; - - /* this value a constant, but any compiler should be able to - figure that out all by itself */ - offset = offsetof(MatchObject, string); - - Py_XINCREF(self->pattern); - Py_XINCREF(self->string); - Py_XINCREF(self->regs); - - memcpy((char*) copy + offset, (char*) self + offset, - sizeof(MatchObject) + slots * sizeof(Py_ssize_t) - offset); - - return (PyObject*) copy; -#else - PyErr_SetString(PyExc_TypeError, "cannot copy this match object"); - return NULL; -#endif -} - -static PyObject* -match_deepcopy(MatchObject* self, PyObject* memo) -{ -#ifdef USE_BUILTIN_COPY - MatchObject* copy; - - copy = (MatchObject*) match_copy(self); - if (!copy) - return NULL; - - if (!deepcopy((PyObject**) ©->pattern, memo) || - !deepcopy(©->string, memo) || - !deepcopy(©->regs, memo)) { - Py_DECREF(copy); - return NULL; - } - -#else - PyErr_SetString(PyExc_TypeError, "cannot deepcopy this match object"); - return NULL; -#endif -} - -PyDoc_STRVAR(match_doc, -"The result of re.match() and re.search().\n\ -Match objects always have a boolean value of True."); - -PyDoc_STRVAR(match_group_doc, -"group([group1, ...]) -> str or tuple.\n\ - Return subgroup(s) of the match by indices or names.\n\ - For 0 returns the entire match."); - -PyDoc_STRVAR(match_start_doc, -"start([group=0]) -> int.\n\ - Return index of the start of the substring matched by group."); - -PyDoc_STRVAR(match_end_doc, -"end([group=0]) -> int.\n\ - Return index of the end of the substring matched by group."); - -PyDoc_STRVAR(match_span_doc, -"span([group]) -> tuple.\n\ - For MatchObject m, return the 2-tuple (m.start(group), m.end(group))."); - -PyDoc_STRVAR(match_groups_doc, -"groups([default=None]) -> tuple.\n\ - Return a tuple containing all the subgroups of the match, from 1.\n\ - The default argument is used for groups\n\ - that did not participate in the match"); - -PyDoc_STRVAR(match_groupdict_doc, -"groupdict([default=None]) -> dict.\n\ - Return a dictionary containing all the named subgroups of the match,\n\ - keyed by the subgroup name. The default argument is used for groups\n\ - that did not participate in the match"); - -PyDoc_STRVAR(match_expand_doc, -"expand(template) -> str.\n\ - Return the string obtained by doing backslash substitution\n\ - on the string template, as done by the sub() method."); - -static PyMethodDef match_methods[] = { - {"group", (PyCFunction) match_group, METH_VARARGS, match_group_doc}, - {"start", (PyCFunction) match_start, METH_VARARGS, match_start_doc}, - {"end", (PyCFunction) match_end, METH_VARARGS, match_end_doc}, - {"span", (PyCFunction) match_span, METH_VARARGS, match_span_doc}, - {"groups", (PyCFunction) match_groups, METH_VARARGS|METH_KEYWORDS, - match_groups_doc}, - {"groupdict", (PyCFunction) match_groupdict, METH_VARARGS|METH_KEYWORDS, - match_groupdict_doc}, - {"expand", (PyCFunction) match_expand, METH_O, match_expand_doc}, - {"__copy__", (PyCFunction) match_copy, METH_NOARGS}, - {"__deepcopy__", (PyCFunction) match_deepcopy, METH_O}, - {NULL, NULL} -}; - -static PyObject * -match_lastindex_get(MatchObject *self) -{ - if (self->lastindex >= 0) - return PyInt_FromSsize_t(self->lastindex); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -match_lastgroup_get(MatchObject *self) -{ - if (self->pattern->indexgroup && self->lastindex >= 0) { - PyObject* result = PySequence_GetItem( - self->pattern->indexgroup, self->lastindex - ); - if (result) - return result; - PyErr_Clear(); - } - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -match_regs_get(MatchObject *self) -{ - if (self->regs) { - Py_INCREF(self->regs); - return self->regs; - } else - return match_regs(self); -} - -static PyGetSetDef match_getset[] = { - {"lastindex", (getter)match_lastindex_get, (setter)NULL}, - {"lastgroup", (getter)match_lastgroup_get, (setter)NULL}, - {"regs", (getter)match_regs_get, (setter)NULL}, - {NULL} -}; - -#define MATCH_OFF(x) offsetof(MatchObject, x) -static PyMemberDef match_members[] = { - {"string", T_OBJECT, MATCH_OFF(string), READONLY}, - {"re", T_OBJECT, MATCH_OFF(pattern), READONLY}, - {"pos", T_PYSSIZET, MATCH_OFF(pos), READONLY}, - {"endpos", T_PYSSIZET, MATCH_OFF(endpos), READONLY}, - {NULL} -}; - - -/* FIXME: implement setattr("string", None) as a special case (to - detach the associated string, if any */ - -static PyTypeObject Match_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "_" SRE_MODULE ".SRE_Match", - sizeof(MatchObject), sizeof(Py_ssize_t), - (destructor)match_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, - match_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - match_methods, /* tp_methods */ - match_members, /* tp_members */ - match_getset, /* tp_getset */ -}; - -static PyObject* -pattern_new_match(PatternObject* pattern, SRE_STATE* state, int status) -{ - /* create match object (from state object) */ - - MatchObject* match; - Py_ssize_t i, j; - char* base; - int n; - - if (status > 0) { - - /* create match object (with room for extra group marks) */ - /* coverity[ampersand_in_size] */ - match = PyObject_NEW_VAR(MatchObject, &Match_Type, - 2*(pattern->groups+1)); - if (!match) - return NULL; - - Py_INCREF(pattern); - match->pattern = pattern; - - Py_INCREF(state->string); - match->string = state->string; - - match->regs = NULL; - match->groups = pattern->groups+1; - - /* fill in group slices */ - - base = (char*) state->beginning; - n = state->charsize; - - match->mark[0] = ((char*) state->start - base) / n; - match->mark[1] = ((char*) state->ptr - base) / n; - - for (i = j = 0; i < pattern->groups; i++, j+=2) - if (j+1 <= state->lastmark && state->mark[j] && state->mark[j+1]) { - match->mark[j+2] = ((char*) state->mark[j] - base) / n; - match->mark[j+3] = ((char*) state->mark[j+1] - base) / n; - } else - match->mark[j+2] = match->mark[j+3] = -1; /* undefined */ - - match->pos = state->pos; - match->endpos = state->endpos; - - match->lastindex = state->lastindex; - - return (PyObject*) match; - - } else if (status == 0) { - - /* no match */ - Py_INCREF(Py_None); - return Py_None; - - } - - /* internal error */ - pattern_error(status); - return NULL; -} - - -/* -------------------------------------------------------------------- */ -/* scanner methods (experimental) */ - -static void -scanner_dealloc(ScannerObject* self) -{ - state_fini(&self->state); - Py_XDECREF(self->pattern); - PyObject_DEL(self); -} - -static PyObject* -scanner_match(ScannerObject* self, PyObject *unused) -{ - SRE_STATE* state = &self->state; - PyObject* match; - int status; - - state_reset(state); - - state->ptr = state->start; - - if (state->charsize == 1) { - status = sre_match(state, PatternObject_GetCode(self->pattern)); - } else { -#if defined(HAVE_UNICODE) - status = sre_umatch(state, PatternObject_GetCode(self->pattern)); -#endif - } - if (PyErr_Occurred()) - return NULL; - - match = pattern_new_match((PatternObject*) self->pattern, - state, status); - - if (status == 0 || state->ptr == state->start) - state->start = (void*) ((char*) state->ptr + state->charsize); - else - state->start = state->ptr; - - return match; -} - - -static PyObject* -scanner_search(ScannerObject* self, PyObject *unused) -{ - SRE_STATE* state = &self->state; - PyObject* match; - int status; - - state_reset(state); - - state->ptr = state->start; - - if (state->charsize == 1) { - status = sre_search(state, PatternObject_GetCode(self->pattern)); - } else { -#if defined(HAVE_UNICODE) - status = sre_usearch(state, PatternObject_GetCode(self->pattern)); -#endif - } - if (PyErr_Occurred()) - return NULL; - - match = pattern_new_match((PatternObject*) self->pattern, - state, status); - - if (status == 0 || state->ptr == state->start) - state->start = (void*) ((char*) state->ptr + state->charsize); - else - state->start = state->ptr; - - return match; -} - -static PyMethodDef scanner_methods[] = { - {"match", (PyCFunction) scanner_match, METH_NOARGS}, - {"search", (PyCFunction) scanner_search, METH_NOARGS}, - {NULL, NULL} -}; - -#define SCAN_OFF(x) offsetof(ScannerObject, x) -static PyMemberDef scanner_members[] = { - {"pattern", T_OBJECT, SCAN_OFF(pattern), READONLY}, - {NULL} /* Sentinel */ -}; - -statichere PyTypeObject Scanner_Type = { - PyObject_HEAD_INIT(NULL) - 0, "_" SRE_MODULE ".SRE_Scanner", - sizeof(ScannerObject), 0, - (destructor)scanner_dealloc, /*tp_dealloc*/ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - scanner_methods, /* tp_methods */ - scanner_members, /* tp_members */ - 0, /* tp_getset */ -}; - -static PyObject* -pattern_scanner(PatternObject* pattern, PyObject* args) -{ - /* create search state object */ - - ScannerObject* self; - - PyObject* string; - Py_ssize_t start = 0; - Py_ssize_t end = PY_SSIZE_T_MAX; - if (!PyArg_ParseTuple(args, "O|nn:scanner", &string, &start, &end)) - return NULL; - - /* create scanner object */ - self = PyObject_NEW(ScannerObject, &Scanner_Type); - if (!self) - return NULL; - self->pattern = NULL; - - string = state_init(&self->state, pattern, string, start, end); - if (!string) { - Py_DECREF(self); - return NULL; - } - - Py_INCREF(pattern); - self->pattern = (PyObject*) pattern; - - return (PyObject*) self; -} - -static PyMethodDef _functions[] = { - {"compile", _compile, METH_VARARGS}, - {"getcodesize", sre_codesize, METH_NOARGS}, - {"getlower", sre_getlower, METH_VARARGS}, - {NULL, NULL} -}; - -#if PY_VERSION_HEX < 0x02030000 -DL_EXPORT(void) init_sre(void) -#else -PyMODINIT_FUNC init_sre(void) -#endif -{ - PyObject* m; - PyObject* d; - PyObject* x; - - /* Patch object types */ - if (PyType_Ready(&Pattern_Type) || PyType_Ready(&Match_Type) || - PyType_Ready(&Scanner_Type)) - return; - - m = Py_InitModule("_" SRE_MODULE, _functions); - if (m == NULL) - return; - d = PyModule_GetDict(m); - - x = PyInt_FromLong(SRE_MAGIC); - if (x) { - PyDict_SetItemString(d, "MAGIC", x); - Py_DECREF(x); - } - - x = PyInt_FromLong(sizeof(SRE_CODE)); - if (x) { - PyDict_SetItemString(d, "CODESIZE", x); - Py_DECREF(x); - } - - x = PyLong_FromUnsignedLong(SRE_MAXREPEAT); - if (x) { - PyDict_SetItemString(d, "MAXREPEAT", x); - Py_DECREF(x); - } - - x = PyString_FromString(copyright); - if (x) { - PyDict_SetItemString(d, "copyright", x); - Py_DECREF(x); - } -} - -#endif /* !defined(SRE_RECURSIVE) */ - -/* vim:ts=4:sw=4:et -*/ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/addrinfo.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/addrinfo.h deleted file mode 100644 index edf74fa..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/addrinfo.h +++ /dev/null @@ -1,187 +0,0 @@ -/** @file - Copyright (c) 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. - - * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. -**/ - -#ifndef HAVE_GETADDRINFO - -/* - * Error return codes from getaddrinfo() - */ -#ifdef EAI_ADDRFAMILY -/* If this is defined, there is a conflicting implementation - in the C library, which can't be used for some reason. - Make sure it won't interfere with this emulation. */ - -#undef EAI_ADDRFAMILY -#undef EAI_AGAIN -#undef EAI_BADFLAGS -#undef EAI_FAIL -#undef EAI_FAMILY -#undef EAI_MEMORY -#undef EAI_NODATA -#undef EAI_NONAME -#undef EAI_SERVICE -#undef EAI_SOCKTYPE -#undef EAI_SYSTEM -#undef EAI_BADHINTS -#undef EAI_PROTOCOL -#undef EAI_MAX -#undef getaddrinfo -#define getaddrinfo fake_getaddrinfo -#endif /* EAI_ADDRFAMILY */ - -#define EAI_ADDRFAMILY 1 /* address family for hostname not supported */ -#define EAI_AGAIN 2 /* temporary failure in name resolution */ -#define EAI_BADFLAGS 3 /* invalid value for ai_flags */ -#define EAI_FAIL 4 /* non-recoverable failure in name resolution */ -#define EAI_FAMILY 5 /* ai_family not supported */ -#define EAI_MEMORY 6 /* memory allocation failure */ -#define EAI_NODATA 7 /* no address associated with hostname */ -#define EAI_NONAME 8 /* hostname nor servname provided, or not known */ -#define EAI_SERVICE 9 /* servname not supported for ai_socktype */ -#define EAI_SOCKTYPE 10 /* ai_socktype not supported */ -#define EAI_SYSTEM 11 /* system error returned in errno */ -#define EAI_BADHINTS 12 -#define EAI_PROTOCOL 13 -#define EAI_MAX 14 - -/* - * Flag values for getaddrinfo() - */ -#ifdef AI_PASSIVE -#undef AI_PASSIVE -#undef AI_CANONNAME -#undef AI_NUMERICHOST -#undef AI_MASK -#undef AI_ALL -#undef AI_V4MAPPED_CFG -#undef AI_ADDRCONFIG -#undef AI_V4MAPPED -#undef AI_DEFAULT -#endif /* AI_PASSIVE */ - -#define AI_PASSIVE 0x00000001 /* get address to use bind() */ -#define AI_CANONNAME 0x00000002 /* fill ai_canonname */ -#define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ -/* valid flags for addrinfo */ -#define AI_MASK (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST) - -#define AI_ALL 0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */ -#define AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */ -#define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ -#define AI_V4MAPPED 0x00000800 /* accept IPv4-mapped IPv6 address */ -/* special recommended flags for getipnodebyname */ -#define AI_DEFAULT (AI_V4MAPPED_CFG | AI_ADDRCONFIG) - -#endif /* !HAVE_GETADDRINFO */ - -#ifndef HAVE_GETNAMEINFO - -/* - * Constants for getnameinfo() - */ -#ifndef NI_MAXHOST -#define NI_MAXHOST 1025 -#define NI_MAXSERV 32 -#endif /* !NI_MAXHOST */ - -/* - * Flag values for getnameinfo() - */ -#ifndef NI_NOFQDN -#define NI_NOFQDN 0x00000001 -#define NI_NUMERICHOST 0x00000002 -#define NI_NAMEREQD 0x00000004 -#define NI_NUMERICSERV 0x00000008 -#define NI_DGRAM 0x00000010 -#endif /* !NI_NOFQDN */ - -#endif /* !HAVE_GETNAMEINFO */ - -#ifndef _SYS_SOCKET_H_ - #ifndef HAVE_ADDRINFO - struct addrinfo { - int ai_flags; /* AI_PASSIVE, AI_CANONNAME */ - int ai_family; /* PF_xxx */ - int ai_socktype; /* SOCK_xxx */ - int ai_protocol; /* 0 or IPPROTO_xxx for IPv4 and IPv6 */ - size_t ai_addrlen; /* length of ai_addr */ - char *ai_canonname; /* canonical name for hostname */ - struct sockaddr *ai_addr; /* binary address */ - struct addrinfo *ai_next; /* next structure in linked list */ - }; - #endif /* !HAVE_ADDRINFO */ - - #ifndef HAVE_SOCKADDR_STORAGE - /* - * RFC 2553: protocol-independent placeholder for socket addresses - */ - #define _SS_MAXSIZE 128 - #ifdef HAVE_LONG_LONG - #define _SS_ALIGNSIZE (sizeof(PY_LONG_LONG)) - #else - #define _SS_ALIGNSIZE (sizeof(double)) - #endif /* HAVE_LONG_LONG */ - #define _SS_PAD1SIZE (_SS_ALIGNSIZE - sizeof(u_char) * 2) - #define _SS_PAD2SIZE (_SS_MAXSIZE - sizeof(u_char) * 2 - \ - _SS_PAD1SIZE - _SS_ALIGNSIZE) - - struct sockaddr_storage { - #ifdef HAVE_SOCKADDR_SA_LEN - unsigned char ss_len; /* address length */ - unsigned char ss_family; /* address family */ - #else - unsigned short ss_family; /* address family */ - #endif /* HAVE_SOCKADDR_SA_LEN */ - char __ss_pad1[_SS_PAD1SIZE]; - #ifdef HAVE_LONG_LONG - PY_LONG_LONG __ss_align; /* force desired structure storage alignment */ - #else - double __ss_align; /* force desired structure storage alignment */ - #endif /* HAVE_LONG_LONG */ - char __ss_pad2[_SS_PAD2SIZE]; - }; - #endif /* !HAVE_SOCKADDR_STORAGE */ -#endif /* _SYS_SOCKET_H_ */ - -#ifdef __cplusplus -extern "C" { -#endif -extern void freehostent Py_PROTO((struct hostent *)); -#ifdef __cplusplus -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/config.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/config.c deleted file mode 100644 index 7cc021c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/config.c +++ /dev/null @@ -1,155 +0,0 @@ -/** @file - Python Module configuration. - - Copyright (c) 2011-2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -/* This file contains the table of built-in modules. - See init_builtin() in import.c. */ - -#include "Python.h" - -extern void initarray(void); -extern void init_ast(void); -extern void initbinascii(void); -extern void init_bisect(void); -extern void initcmath(void); -extern void init_codecs(void); -extern void init_collections(void); -extern void initcPickle(void); -extern void initcStringIO(void); -extern void init_csv(void); -extern void init_ctypes(void); -extern void initdatetime(void); -extern void initedk2(void); -extern void initerrno(void); -extern void init_functools(void); -extern void initfuture_builtins(void); -extern void initgc(void); -extern void init_heapq(void); -extern void init_hotshot(void); -extern void initimp(void); -extern void init_io(void); -extern void inititertools(void); -extern void init_json(void); -extern void init_lsprof(void); -extern void initmath(void); -extern void init_md5(void); -extern void initmmap(void); -extern void initoperator(void); -extern void initparser(void); -extern void initpyexpat(void); -extern void init_random(void); -extern void initselect(void); -extern void init_sha(void); -extern void init_sha256(void); -extern void init_sha512(void); -extern void initsignal(void); -extern void init_socket(void); -extern void init_sre(void); -extern void initstrop(void); -extern void init_struct(void); -extern void init_subprocess(void); -extern void init_symtable(void); -extern void initthread(void); -extern void inittime(void); -extern void initunicodedata(void); -extern void init_weakref(void); -extern void init_winreg(void); -extern void initxxsubtype(void); -extern void initzipimport(void); -extern void initzlib(void); - -extern void PyMarshal_Init(void); -extern void _PyWarnings_Init(void); - -extern void init_multibytecodec(void); -extern void init_codecs_cn(void); -extern void init_codecs_hk(void); -extern void init_codecs_iso2022(void); -extern void init_codecs_jp(void); -extern void init_codecs_kr(void); -extern void init_codecs_tw(void); - -struct _inittab _PyImport_Inittab[] = { - - //{"_ast", init_ast}, - //{"_bisect", init_bisect}, /* A fast version of bisect.py */ - //{"_csv", init_csv}, - //{"_heapq", init_heapq}, /* A fast version of heapq.py */ - //{"_io", init_io}, - //{"_json", init_json}, - //{"_md5", init_md5}, - //{"_sha", init_sha}, - //{"_sha256", init_sha256}, - //{"_sha512", init_sha512}, - //{"_socket", init_socket}, - //{"_symtable", init_symtable}, - - //{"array", initarray}, - //{"cmath", initcmath}, - //{"cPickle", initcPickle}, - //{"datetime", initdatetime}, - //{"future_builtins", initfuture_builtins}, - //{"parser", initparser}, - //{"pyexpat", initpyexpat}, - //{"select", initselect}, - //{"signal", initsignal}, - //{"strop", initstrop}, /* redefines some string operations that are 100-1000 times faster */ - //{"unicodedata", initunicodedata}, - //{"xxsubtype", initxxsubtype}, - //{"zipimport", initzipimport}, - //{"zlib", initzlib}, - - /* CJK codecs */ - //{"_multibytecodec", init_multibytecodec}, - //{"_codecs_cn", init_codecs_cn}, - //{"_codecs_hk", init_codecs_hk}, - //{"_codecs_iso2022", init_codecs_iso2022}, - //{"_codecs_jp", init_codecs_jp}, - //{"_codecs_kr", init_codecs_kr}, - //{"_codecs_tw", init_codecs_tw}, - -#ifdef WITH_THREAD - {"thread", initthread}, -#endif - - /* These modules are required for the full built-in help() facility provided by pydoc. */ - {"_codecs", init_codecs}, - {"_collections", init_collections}, - {"_functools", init_functools}, - {"_random", init_random}, - {"_sre", init_sre}, - {"_struct", init_struct}, /* Required by the logging package. */ - {"_weakref", init_weakref}, - {"binascii", initbinascii}, - {"cStringIO", initcStringIO}, /* Required by several modules, such as logging. */ - {"gc", initgc}, - {"itertools", inititertools}, - {"math", initmath}, - {"operator", initoperator}, - {"time", inittime}, - - /* These four modules should always be built in. */ - {"edk2", initedk2}, - {"errno", initerrno}, - {"imp", initimp}, /* We get this for free from Python/import.c */ - {"marshal", PyMarshal_Init}, /* We get this for free from Python/marshal.c */ - - /* These entries are here for sys.builtin_module_names */ - {"__main__", NULL}, - {"__builtin__", NULL}, - {"sys", NULL}, - {"exceptions", NULL}, - {"_warnings", _PyWarnings_Init}, - - /* Sentinel */ - {0, 0} -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/edk2module.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/edk2module.c deleted file mode 100644 index 11a3760..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/edk2module.c +++ /dev/null @@ -1,4234 +0,0 @@ -/** @file - OS-specific module implementation for EDK II and UEFI. - Derived from posixmodule.c in Python 2.7.2. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "structseq.h" - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -PyDoc_STRVAR(edk2__doc__, - "This module provides access to UEFI firmware functionality that is\n\ - standardized by the C Standard and the POSIX standard (a thinly\n\ - disguised Unix interface). Refer to the library manual and\n\ - corresponding UEFI Specification entries for more information on calls."); - -#ifndef Py_USING_UNICODE - /* This is used in signatures of functions. */ - #define Py_UNICODE void -#endif - -#ifdef HAVE_SYS_TYPES_H - #include -#endif /* HAVE_SYS_TYPES_H */ - -#ifdef HAVE_SYS_STAT_H - #include -#endif /* HAVE_SYS_STAT_H */ - -#ifdef HAVE_SYS_WAIT_H - #include /* For WNOHANG */ -#endif - -#ifdef HAVE_SIGNAL_H - #include -#endif - -#ifdef HAVE_FCNTL_H - #include -#endif /* HAVE_FCNTL_H */ - -#ifdef HAVE_GRP_H - #include -#endif - -#ifdef HAVE_SYSEXITS_H - #include -#endif /* HAVE_SYSEXITS_H */ - -#ifdef HAVE_SYS_LOADAVG_H - #include -#endif - -#ifdef HAVE_UTIME_H - #include -#endif /* HAVE_UTIME_H */ - -#ifdef HAVE_SYS_UTIME_H - #include - #define HAVE_UTIME_H /* pretend we do for the rest of this file */ -#endif /* HAVE_SYS_UTIME_H */ - -#ifdef HAVE_SYS_TIMES_H - #include -#endif /* HAVE_SYS_TIMES_H */ - -#ifdef HAVE_SYS_PARAM_H - #include -#endif /* HAVE_SYS_PARAM_H */ - -#ifdef HAVE_SYS_UTSNAME_H - #include -#endif /* HAVE_SYS_UTSNAME_H */ - -#ifdef HAVE_DIRENT_H - #include - #define NAMLEN(dirent) wcslen((dirent)->FileName) -#else - #define dirent direct - #define NAMLEN(dirent) (dirent)->d_namlen - #ifdef HAVE_SYS_NDIR_H - #include - #endif - #ifdef HAVE_SYS_DIR_H - #include - #endif - #ifdef HAVE_NDIR_H - #include - #endif -#endif - -#ifndef MAXPATHLEN - #if defined(PATH_MAX) && PATH_MAX > 1024 - #define MAXPATHLEN PATH_MAX - #else - #define MAXPATHLEN 1024 - #endif -#endif /* MAXPATHLEN */ - -#define WAIT_TYPE int -#define WAIT_STATUS_INT(s) (s) - -/* Issue #1983: pid_t can be longer than a C long on some systems */ -#if !defined(SIZEOF_PID_T) || SIZEOF_PID_T == SIZEOF_INT - #define PARSE_PID "i" - #define PyLong_FromPid PyInt_FromLong - #define PyLong_AsPid PyInt_AsLong -#elif SIZEOF_PID_T == SIZEOF_LONG - #define PARSE_PID "l" - #define PyLong_FromPid PyInt_FromLong - #define PyLong_AsPid PyInt_AsLong -#elif defined(SIZEOF_LONG_LONG) && SIZEOF_PID_T == SIZEOF_LONG_LONG - #define PARSE_PID "L" - #define PyLong_FromPid PyLong_FromLongLong - #define PyLong_AsPid PyInt_AsLongLong -#else - #error "sizeof(pid_t) is neither sizeof(int), sizeof(long) or sizeof(long long)" -#endif /* SIZEOF_PID_T */ - -/* Don't use the "_r" form if we don't need it (also, won't have a - prototype for it, at least on Solaris -- maybe others as well?). */ -#if defined(HAVE_CTERMID_R) && defined(WITH_THREAD) - #define USE_CTERMID_R -#endif - -#if defined(HAVE_TMPNAM_R) && defined(WITH_THREAD) - #define USE_TMPNAM_R -#endif - -/* choose the appropriate stat and fstat functions and return structs */ -#undef STAT -#undef FSTAT -#undef STRUCT_STAT -#define STAT stat -#define FSTAT fstat -#define STRUCT_STAT struct stat - -/* dummy version. _PyVerify_fd() is already defined in fileobject.h */ -#define _PyVerify_fd_dup2(A, B) (1) - -#ifndef UEFI_C_SOURCE -/* Return a dictionary corresponding to the POSIX environment table */ -extern char **environ; - -static PyObject * -convertenviron(void) -{ - PyObject *d; - char **e; - d = PyDict_New(); - if (d == NULL) - return NULL; - if (environ == NULL) - return d; - /* This part ignores errors */ - for (e = environ; *e != NULL; e++) { - PyObject *k; - PyObject *v; - char *p = strchr(*e, '='); - if (p == NULL) - continue; - k = PyString_FromStringAndSize(*e, (int)(p-*e)); - if (k == NULL) { - PyErr_Clear(); - continue; - } - v = PyString_FromString(p+1); - if (v == NULL) { - PyErr_Clear(); - Py_DECREF(k); - continue; - } - if (PyDict_GetItem(d, k) == NULL) { - if (PyDict_SetItem(d, k, v) != 0) - PyErr_Clear(); - } - Py_DECREF(k); - Py_DECREF(v); - } - return d; -} -#endif /* UEFI_C_SOURCE */ - -/* Set a POSIX-specific error from errno, and return NULL */ - -static PyObject * -edk2_error(void) -{ - return PyErr_SetFromErrno(PyExc_OSError); -} -static PyObject * -edk2_error_with_filename(char* name) -{ - return PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); -} - - -static PyObject * -edk2_error_with_allocated_filename(char* name) -{ - PyObject *rc = PyErr_SetFromErrnoWithFilename(PyExc_OSError, name); - PyMem_Free(name); - return rc; -} - -/* POSIX generic methods */ - -#ifndef UEFI_C_SOURCE - static PyObject * - edk2_fildes(PyObject *fdobj, int (*func)(int)) - { - int fd; - int res; - fd = PyObject_AsFileDescriptor(fdobj); - if (fd < 0) - return NULL; - if (!_PyVerify_fd(fd)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS - res = (*func)(fd); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; - } -#endif /* UEFI_C_SOURCE */ - -static PyObject * -edk2_1str(PyObject *args, char *format, int (*func)(const char*)) -{ - char *path1 = NULL; - int res; - if (!PyArg_ParseTuple(args, format, - Py_FileSystemDefaultEncoding, &path1)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = (*func)(path1); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path1); - PyMem_Free(path1); - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -edk2_2str(PyObject *args, - char *format, - int (*func)(const char *, const char *)) -{ - char *path1 = NULL, *path2 = NULL; - int res; - if (!PyArg_ParseTuple(args, format, - Py_FileSystemDefaultEncoding, &path1, - Py_FileSystemDefaultEncoding, &path2)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = (*func)(path1, path2); - Py_END_ALLOW_THREADS - PyMem_Free(path1); - PyMem_Free(path2); - if (res != 0) - /* XXX how to report both path1 and path2??? */ - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(stat_result__doc__, -"stat_result: Result from stat or lstat.\n\n\ -This object may be accessed either as a tuple of\n\ - (mode, ino, dev, nlink, uid, gid, size, atime, mtime, ctime)\n\ -or via the attributes st_mode, st_ino, st_dev, st_nlink, st_uid, and so on.\n\ -\n\ -Posix/windows: If your platform supports st_blksize, st_blocks, st_rdev,\n\ -or st_flags, they are available as attributes only.\n\ -\n\ -See os.stat for more information."); - -static PyStructSequence_Field stat_result_fields[] = { - {"st_mode", "protection bits"}, - //{"st_ino", "inode"}, - //{"st_dev", "device"}, - //{"st_nlink", "number of hard links"}, - //{"st_uid", "user ID of owner"}, - //{"st_gid", "group ID of owner"}, - {"st_size", "total size, in bytes"}, - /* The NULL is replaced with PyStructSequence_UnnamedField later. */ - {NULL, "integer time of last access"}, - {NULL, "integer time of last modification"}, - {NULL, "integer time of last change"}, - {"st_atime", "time of last access"}, - {"st_mtime", "time of last modification"}, - {"st_ctime", "time of last change"}, -#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - {"st_blksize", "blocksize for filesystem I/O"}, -#endif -#ifdef HAVE_STRUCT_STAT_ST_BLOCKS - {"st_blocks", "number of blocks allocated"}, -#endif -#ifdef HAVE_STRUCT_STAT_ST_RDEV - {"st_rdev", "device type (if inode device)"}, -#endif -#ifdef HAVE_STRUCT_STAT_ST_FLAGS - {"st_flags", "user defined flags for file"}, -#endif -#ifdef HAVE_STRUCT_STAT_ST_GEN - {"st_gen", "generation number"}, -#endif -#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME - {"st_birthtime", "time of creation"}, -#endif - {0} -}; - -#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE -#define ST_BLKSIZE_IDX 8 -#else -#define ST_BLKSIZE_IDX 12 -#endif - -#ifdef HAVE_STRUCT_STAT_ST_BLOCKS -#define ST_BLOCKS_IDX (ST_BLKSIZE_IDX+1) -#else -#define ST_BLOCKS_IDX ST_BLKSIZE_IDX -#endif - -#ifdef HAVE_STRUCT_STAT_ST_RDEV -#define ST_RDEV_IDX (ST_BLOCKS_IDX+1) -#else -#define ST_RDEV_IDX ST_BLOCKS_IDX -#endif - -#ifdef HAVE_STRUCT_STAT_ST_FLAGS -#define ST_FLAGS_IDX (ST_RDEV_IDX+1) -#else -#define ST_FLAGS_IDX ST_RDEV_IDX -#endif - -#ifdef HAVE_STRUCT_STAT_ST_GEN -#define ST_GEN_IDX (ST_FLAGS_IDX+1) -#else -#define ST_GEN_IDX ST_FLAGS_IDX -#endif - -#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME -#define ST_BIRTHTIME_IDX (ST_GEN_IDX+1) -#else -#define ST_BIRTHTIME_IDX ST_GEN_IDX -#endif - -static PyStructSequence_Desc stat_result_desc = { - "stat_result", /* name */ - stat_result__doc__, /* doc */ - stat_result_fields, - 10 -}; - -#ifndef UEFI_C_SOURCE /* Not in UEFI */ -PyDoc_STRVAR(statvfs_result__doc__, -"statvfs_result: Result from statvfs or fstatvfs.\n\n\ -This object may be accessed either as a tuple of\n\ - (bsize, frsize, blocks, bfree, bavail, files, ffree, favail, flag, namemax),\n\ -or via the attributes f_bsize, f_frsize, f_blocks, f_bfree, and so on.\n\ -\n\ -See os.statvfs for more information."); - -static PyStructSequence_Field statvfs_result_fields[] = { - {"f_bsize", }, - {"f_frsize", }, - {"f_blocks", }, - {"f_bfree", }, - {"f_bavail", }, - {"f_files", }, - {"f_ffree", }, - {"f_favail", }, - {"f_flag", }, - {"f_namemax",}, - {0} -}; - -static PyStructSequence_Desc statvfs_result_desc = { - "statvfs_result", /* name */ - statvfs_result__doc__, /* doc */ - statvfs_result_fields, - 10 -}; - -static PyTypeObject StatVFSResultType; -#endif - -static int initialized; -static PyTypeObject StatResultType; -static newfunc structseq_new; - -static PyObject * -statresult_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyStructSequence *result; - int i; - - result = (PyStructSequence*)structseq_new(type, args, kwds); - if (!result) - return NULL; - /* If we have been initialized from a tuple, - st_?time might be set to None. Initialize it - from the int slots. */ - for (i = 7; i <= 9; i++) { - if (result->ob_item[i+3] == Py_None) { - Py_DECREF(Py_None); - Py_INCREF(result->ob_item[i]); - result->ob_item[i+3] = result->ob_item[i]; - } - } - return (PyObject*)result; -} - - - -/* If true, st_?time is float. */ -#if defined(UEFI_C_SOURCE) - static int _stat_float_times = 0; -#else - static int _stat_float_times = 1; - -PyDoc_STRVAR(stat_float_times__doc__, -"stat_float_times([newval]) -> oldval\n\n\ -Determine whether os.[lf]stat represents time stamps as float objects.\n\ -If newval is True, future calls to stat() return floats, if it is False,\n\ -future calls return ints. \n\ -If newval is omitted, return the current setting.\n"); - -static PyObject* -stat_float_times(PyObject* self, PyObject *args) -{ - int newval = -1; - - if (!PyArg_ParseTuple(args, "|i:stat_float_times", &newval)) - return NULL; - if (newval == -1) - /* Return old value */ - return PyBool_FromLong(_stat_float_times); - _stat_float_times = newval; - Py_INCREF(Py_None); - return Py_None; -} -#endif /* UEFI_C_SOURCE */ - -static void -fill_time(PyObject *v, int index, time_t sec, unsigned long nsec) -{ - PyObject *fval,*ival; -#if SIZEOF_TIME_T > SIZEOF_LONG - ival = PyLong_FromLongLong((PY_LONG_LONG)sec); -#else - ival = PyInt_FromLong((long)sec); -#endif - if (!ival) - return; - if (_stat_float_times) { - fval = PyFloat_FromDouble(sec + 1e-9*nsec); - } else { - fval = ival; - Py_INCREF(fval); - } - PyStructSequence_SET_ITEM(v, index, ival); - PyStructSequence_SET_ITEM(v, index+3, fval); -} - -/* pack a system stat C structure into the Python stat tuple - (used by edk2_stat() and edk2_fstat()) */ -static PyObject* -_pystat_fromstructstat(STRUCT_STAT *st) -{ - unsigned long ansec, mnsec, cnsec; - PyObject *v = PyStructSequence_New(&StatResultType); - if (v == NULL) - return NULL; - - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st->st_mode)); - PyStructSequence_SET_ITEM(v, 1, - PyLong_FromLongLong((PY_LONG_LONG)st->st_size)); - - ansec = mnsec = cnsec = 0; - /* The index used by fill_time is the index of the integer time. - fill_time will add 3 to the index to get the floating time index. - */ - fill_time(v, 2, st->st_atime, ansec); - fill_time(v, 3, st->st_mtime, mnsec); - fill_time(v, 4, st->st_mtime, cnsec); - -#ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - PyStructSequence_SET_ITEM(v, ST_BLKSIZE_IDX, - PyInt_FromLong((long)st->st_blksize)); -#endif -#ifdef HAVE_STRUCT_STAT_ST_BLOCKS - PyStructSequence_SET_ITEM(v, ST_BLOCKS_IDX, - PyInt_FromLong((long)st->st_blocks)); -#endif -#ifdef HAVE_STRUCT_STAT_ST_RDEV - PyStructSequence_SET_ITEM(v, ST_RDEV_IDX, - PyInt_FromLong((long)st->st_rdev)); -#endif -#ifdef HAVE_STRUCT_STAT_ST_GEN - PyStructSequence_SET_ITEM(v, ST_GEN_IDX, - PyInt_FromLong((long)st->st_gen)); -#endif -#ifdef HAVE_STRUCT_STAT_ST_BIRTHTIME - { - PyObject *val; - unsigned long bsec,bnsec; - bsec = (long)st->st_birthtime; -#ifdef HAVE_STAT_TV_NSEC2 - bnsec = st->st_birthtimespec.tv_nsec; -#else - bnsec = 0; -#endif - if (_stat_float_times) { - val = PyFloat_FromDouble(bsec + 1e-9*bnsec); - } else { - val = PyInt_FromLong((long)bsec); - } - PyStructSequence_SET_ITEM(v, ST_BIRTHTIME_IDX, - val); - } -#endif -#ifdef HAVE_STRUCT_STAT_ST_FLAGS - PyStructSequence_SET_ITEM(v, ST_FLAGS_IDX, - PyInt_FromLong((long)st->st_flags)); -#endif - - if (PyErr_Occurred()) { - Py_DECREF(v); - return NULL; - } - - return v; -} - -static PyObject * -edk2_do_stat(PyObject *self, PyObject *args, - char *format, - int (*statfunc)(const char *, STRUCT_STAT *), - char *wformat, - int (*wstatfunc)(const Py_UNICODE *, STRUCT_STAT *)) -{ - STRUCT_STAT st; - char *path = NULL; /* pass this to stat; do not free() it */ - char *pathfree = NULL; /* this memory must be free'd */ - int res; - PyObject *result; - - if (!PyArg_ParseTuple(args, format, - Py_FileSystemDefaultEncoding, &path)) - return NULL; - pathfree = path; - - Py_BEGIN_ALLOW_THREADS - res = (*statfunc)(path, &st); - Py_END_ALLOW_THREADS - - if (res != 0) { - result = edk2_error_with_filename(pathfree); - } - else - result = _pystat_fromstructstat(&st); - - PyMem_Free(pathfree); - return result; -} - -/* POSIX methods */ - -PyDoc_STRVAR(edk2_access__doc__, -"access(path, mode) -> True if granted, False otherwise\n\n\ -Use the real uid/gid to test for access to a path. Note that most\n\ -operations will use the effective uid/gid, therefore this routine can\n\ -be used in a suid/sgid environment to test if the invoking user has the\n\ -specified access to the path. The mode argument can be F_OK to test\n\ -existence, or the inclusive-OR of R_OK, W_OK, and X_OK."); - -static PyObject * -edk2_access(PyObject *self, PyObject *args) -{ - char *path; - int mode; - - int res; - if (!PyArg_ParseTuple(args, "eti:access", - Py_FileSystemDefaultEncoding, &path, &mode)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = access(path, mode); - Py_END_ALLOW_THREADS - PyMem_Free(path); - return PyBool_FromLong(res == 0); -} - -#ifndef F_OK - #define F_OK 0 -#endif -#ifndef R_OK - #define R_OK 4 -#endif -#ifndef W_OK - #define W_OK 2 -#endif -#ifndef X_OK - #define X_OK 1 -#endif - -PyDoc_STRVAR(edk2_chdir__doc__, -"chdir(path)\n\n\ -Change the current working directory to the specified path."); - -static PyObject * -edk2_chdir(PyObject *self, PyObject *args) -{ - return edk2_1str(args, "et:chdir", chdir); -} - -PyDoc_STRVAR(edk2_chmod__doc__, -"chmod(path, mode)\n\n\ -Change the access permissions of a file."); - -static PyObject * -edk2_chmod(PyObject *self, PyObject *args) -{ - char *path = NULL; - int i; - int res; - if (!PyArg_ParseTuple(args, "eti:chmod", Py_FileSystemDefaultEncoding, - &path, &i)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = chmod(path, i); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} - -#ifdef HAVE_FCHMOD -PyDoc_STRVAR(edk2_fchmod__doc__, -"fchmod(fd, mode)\n\n\ -Change the access permissions of the file given by file\n\ -descriptor fd."); - -static PyObject * -edk2_fchmod(PyObject *self, PyObject *args) -{ - int fd, mode, res; - if (!PyArg_ParseTuple(args, "ii:fchmod", &fd, &mode)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = fchmod(fd, mode); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_RETURN_NONE; -} -#endif /* HAVE_FCHMOD */ - -#ifdef HAVE_LCHMOD -PyDoc_STRVAR(edk2_lchmod__doc__, -"lchmod(path, mode)\n\n\ -Change the access permissions of a file. If path is a symlink, this\n\ -affects the link itself rather than the target."); - -static PyObject * -edk2_lchmod(PyObject *self, PyObject *args) -{ - char *path = NULL; - int i; - int res; - if (!PyArg_ParseTuple(args, "eti:lchmod", Py_FileSystemDefaultEncoding, - &path, &i)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = lchmod(path, i); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_RETURN_NONE; -} -#endif /* HAVE_LCHMOD */ - - -#ifdef HAVE_CHFLAGS -PyDoc_STRVAR(edk2_chflags__doc__, -"chflags(path, flags)\n\n\ -Set file flags."); - -static PyObject * -edk2_chflags(PyObject *self, PyObject *args) -{ - char *path; - unsigned long flags; - int res; - if (!PyArg_ParseTuple(args, "etk:chflags", - Py_FileSystemDefaultEncoding, &path, &flags)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = chflags(path, flags); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_CHFLAGS */ - -#ifdef HAVE_LCHFLAGS -PyDoc_STRVAR(edk2_lchflags__doc__, -"lchflags(path, flags)\n\n\ -Set file flags.\n\ -This function will not follow symbolic links."); - -static PyObject * -edk2_lchflags(PyObject *self, PyObject *args) -{ - char *path; - unsigned long flags; - int res; - if (!PyArg_ParseTuple(args, "etk:lchflags", - Py_FileSystemDefaultEncoding, &path, &flags)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = lchflags(path, flags); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_LCHFLAGS */ - -#ifdef HAVE_CHROOT -PyDoc_STRVAR(edk2_chroot__doc__, -"chroot(path)\n\n\ -Change root directory to path."); - -static PyObject * -edk2_chroot(PyObject *self, PyObject *args) -{ - return edk2_1str(args, "et:chroot", chroot); -} -#endif - -#ifdef HAVE_FSYNC -PyDoc_STRVAR(edk2_fsync__doc__, -"fsync(fildes)\n\n\ -force write of file with filedescriptor to disk."); - -static PyObject * -edk2_fsync(PyObject *self, PyObject *fdobj) -{ - return edk2_fildes(fdobj, fsync); -} -#endif /* HAVE_FSYNC */ - -#ifdef HAVE_FDATASYNC - -#ifdef __hpux -extern int fdatasync(int); /* On HP-UX, in libc but not in unistd.h */ -#endif - -PyDoc_STRVAR(edk2_fdatasync__doc__, -"fdatasync(fildes)\n\n\ -force write of file with filedescriptor to disk.\n\ - does not force update of metadata."); - -static PyObject * -edk2_fdatasync(PyObject *self, PyObject *fdobj) -{ - return edk2_fildes(fdobj, fdatasync); -} -#endif /* HAVE_FDATASYNC */ - - -#ifdef HAVE_CHOWN -PyDoc_STRVAR(edk2_chown__doc__, -"chown(path, uid, gid)\n\n\ -Change the owner and group id of path to the numeric uid and gid."); - -static PyObject * -edk2_chown(PyObject *self, PyObject *args) -{ - char *path = NULL; - long uid, gid; - int res; - if (!PyArg_ParseTuple(args, "etll:chown", - Py_FileSystemDefaultEncoding, &path, - &uid, &gid)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = chown(path, (uid_t) uid, (gid_t) gid); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_CHOWN */ - -#ifdef HAVE_FCHOWN -PyDoc_STRVAR(edk2_fchown__doc__, -"fchown(fd, uid, gid)\n\n\ -Change the owner and group id of the file given by file descriptor\n\ -fd to the numeric uid and gid."); - -static PyObject * -edk2_fchown(PyObject *self, PyObject *args) -{ - int fd; - long uid, gid; - int res; - if (!PyArg_ParseTuple(args, "ill:chown", &fd, &uid, &gid)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = fchown(fd, (uid_t) uid, (gid_t) gid); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_RETURN_NONE; -} -#endif /* HAVE_FCHOWN */ - -#ifdef HAVE_LCHOWN -PyDoc_STRVAR(edk2_lchown__doc__, -"lchown(path, uid, gid)\n\n\ -Change the owner and group id of path to the numeric uid and gid.\n\ -This function will not follow symbolic links."); - -static PyObject * -edk2_lchown(PyObject *self, PyObject *args) -{ - char *path = NULL; - long uid, gid; - int res; - if (!PyArg_ParseTuple(args, "etll:lchown", - Py_FileSystemDefaultEncoding, &path, - &uid, &gid)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = lchown(path, (uid_t) uid, (gid_t) gid); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_LCHOWN */ - - -#ifdef HAVE_GETCWD -PyDoc_STRVAR(edk2_getcwd__doc__, -"getcwd() -> path\n\n\ -Return a string representing the current working directory."); - -static PyObject * -edk2_getcwd(PyObject *self, PyObject *noargs) -{ - int bufsize_incr = 1024; - int bufsize = 0; - char *tmpbuf = NULL; - char *res = NULL; - PyObject *dynamic_return; - - Py_BEGIN_ALLOW_THREADS - do { - bufsize = bufsize + bufsize_incr; - tmpbuf = malloc(bufsize); - if (tmpbuf == NULL) { - break; - } - res = getcwd(tmpbuf, bufsize); - if (res == NULL) { - free(tmpbuf); - } - } while ((res == NULL) && (errno == ERANGE)); - Py_END_ALLOW_THREADS - - if (res == NULL) - return edk2_error(); - - dynamic_return = PyString_FromString(tmpbuf); - free(tmpbuf); - - return dynamic_return; -} - -#ifdef Py_USING_UNICODE -PyDoc_STRVAR(edk2_getcwdu__doc__, -"getcwdu() -> path\n\n\ -Return a unicode string representing the current working directory."); - -static PyObject * -edk2_getcwdu(PyObject *self, PyObject *noargs) -{ - char buf[1026]; - char *res; - - Py_BEGIN_ALLOW_THREADS - res = getcwd(buf, sizeof buf); - Py_END_ALLOW_THREADS - if (res == NULL) - return edk2_error(); - return PyUnicode_Decode(buf, strlen(buf), Py_FileSystemDefaultEncoding,"strict"); -} -#endif /* Py_USING_UNICODE */ -#endif /* HAVE_GETCWD */ - - -PyDoc_STRVAR(edk2_listdir__doc__, -"listdir(path) -> list_of_strings\n\n\ -Return a list containing the names of the entries in the directory.\n\ -\n\ - path: path of directory to list\n\ -\n\ -The list is in arbitrary order. It does not include the special\n\ -entries '.' and '..' even if they are present in the directory."); - -static PyObject * -edk2_listdir(PyObject *self, PyObject *args) -{ - /* XXX Should redo this putting the (now four) versions of opendir - in separate files instead of having them all here... */ - - char *name = NULL; - char *MBname; - PyObject *d, *v; - DIR *dirp; - struct dirent *ep; - int arg_is_unicode = 1; - - errno = 0; - if (!PyArg_ParseTuple(args, "U:listdir", &v)) { - arg_is_unicode = 0; - PyErr_Clear(); - } - if (!PyArg_ParseTuple(args, "et:listdir", Py_FileSystemDefaultEncoding, &name)) - return NULL; - Py_BEGIN_ALLOW_THREADS - dirp = opendir(name); - Py_END_ALLOW_THREADS - if (dirp == NULL) { - return edk2_error_with_allocated_filename(name); - } - if ((d = PyList_New(0)) == NULL) { - Py_BEGIN_ALLOW_THREADS - closedir(dirp); - Py_END_ALLOW_THREADS - PyMem_Free(name); - return NULL; - } - if((MBname = malloc(NAME_MAX)) == NULL) { - Py_BEGIN_ALLOW_THREADS - closedir(dirp); - Py_END_ALLOW_THREADS - Py_DECREF(d); - PyMem_Free(name); - return NULL; - } - for (;;) { - errno = 0; - Py_BEGIN_ALLOW_THREADS - ep = readdir(dirp); - Py_END_ALLOW_THREADS - if (ep == NULL) { - if ((errno == 0) || (errno == EISDIR)) { - break; - } else { - Py_BEGIN_ALLOW_THREADS - closedir(dirp); - Py_END_ALLOW_THREADS - Py_DECREF(d); - return edk2_error_with_allocated_filename(name); - } - } - if (ep->FileName[0] == L'.' && - (NAMLEN(ep) == 1 || - (ep->FileName[1] == L'.' && NAMLEN(ep) == 2))) - continue; - if(wcstombs(MBname, ep->FileName, NAME_MAX) == -1) { - free(MBname); - Py_BEGIN_ALLOW_THREADS - closedir(dirp); - Py_END_ALLOW_THREADS - Py_DECREF(d); - PyMem_Free(name); - return NULL; - } - v = PyString_FromStringAndSize(MBname, strlen(MBname)); - if (v == NULL) { - Py_DECREF(d); - d = NULL; - break; - } -#ifdef Py_USING_UNICODE - if (arg_is_unicode) { - PyObject *w; - - w = PyUnicode_FromEncodedObject(v, - Py_FileSystemDefaultEncoding, - "strict"); - if (w != NULL) { - Py_DECREF(v); - v = w; - } - else { - /* fall back to the original byte string, as - discussed in patch #683592 */ - PyErr_Clear(); - } - } -#endif - if (PyList_Append(d, v) != 0) { - Py_DECREF(v); - Py_DECREF(d); - d = NULL; - break; - } - Py_DECREF(v); - } - Py_BEGIN_ALLOW_THREADS - closedir(dirp); - Py_END_ALLOW_THREADS - PyMem_Free(name); - if(MBname != NULL) { - free(MBname); - } - - return d; - -} /* end of edk2_listdir */ - -PyDoc_STRVAR(edk2_mkdir__doc__, -"mkdir(path [, mode=0777])\n\n\ -Create a directory."); - -static PyObject * -edk2_mkdir(PyObject *self, PyObject *args) -{ - int res; - char *path = NULL; - int mode = 0777; - - if (!PyArg_ParseTuple(args, "et|i:mkdir", - Py_FileSystemDefaultEncoding, &path, &mode)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = mkdir(path, mode); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error_with_allocated_filename(path); - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -} - - -/* sys/resource.h is needed for at least: wait3(), wait4(), broken nice. */ -#if defined(HAVE_SYS_RESOURCE_H) -#include -#endif - - -#ifdef HAVE_NICE -PyDoc_STRVAR(edk2_nice__doc__, -"nice(inc) -> new_priority\n\n\ -Decrease the priority of process by inc and return the new priority."); - -static PyObject * -edk2_nice(PyObject *self, PyObject *args) -{ - int increment, value; - - if (!PyArg_ParseTuple(args, "i:nice", &increment)) - return NULL; - - /* There are two flavours of 'nice': one that returns the new - priority (as required by almost all standards out there) and the - Linux/FreeBSD/BSDI one, which returns '0' on success and advices - the use of getpriority() to get the new priority. - - If we are of the nice family that returns the new priority, we - need to clear errno before the call, and check if errno is filled - before calling edk2_error() on a returnvalue of -1, because the - -1 may be the actual new priority! */ - - errno = 0; - value = nice(increment); -#if defined(HAVE_BROKEN_NICE) && defined(HAVE_GETPRIORITY) - if (value == 0) - value = getpriority(PRIO_PROCESS, 0); -#endif - if (value == -1 && errno != 0) - /* either nice() or getpriority() returned an error */ - return edk2_error(); - return PyInt_FromLong((long) value); -} -#endif /* HAVE_NICE */ - -PyDoc_STRVAR(edk2_rename__doc__, -"rename(old, new)\n\n\ -Rename a file or directory."); - -static PyObject * -edk2_rename(PyObject *self, PyObject *args) -{ - return edk2_2str(args, "etet:rename", rename); -} - - -PyDoc_STRVAR(edk2_rmdir__doc__, -"rmdir(path)\n\n\ -Remove a directory."); - -static PyObject * -edk2_rmdir(PyObject *self, PyObject *args) -{ - return edk2_1str(args, "et:rmdir", rmdir); -} - - -PyDoc_STRVAR(edk2_stat__doc__, -"stat(path) -> stat result\n\n\ -Perform a stat system call on the given path."); - -static PyObject * -edk2_stat(PyObject *self, PyObject *args) -{ - return edk2_do_stat(self, args, "et:stat", STAT, NULL, NULL); -} - - -#ifdef HAVE_SYSTEM -PyDoc_STRVAR(edk2_system__doc__, -"system(command) -> exit_status\n\n\ -Execute the command (a string) in a subshell."); - -static PyObject * -edk2_system(PyObject *self, PyObject *args) -{ - char *command; - long sts; - if (!PyArg_ParseTuple(args, "s:system", &command)) - return NULL; - Py_BEGIN_ALLOW_THREADS - sts = system(command); - Py_END_ALLOW_THREADS - return PyInt_FromLong(sts); -} -#endif - - -PyDoc_STRVAR(edk2_umask__doc__, -"umask(new_mask) -> old_mask\n\n\ -Set the current numeric umask and return the previous umask."); - -static PyObject * -edk2_umask(PyObject *self, PyObject *args) -{ - int i; - if (!PyArg_ParseTuple(args, "i:umask", &i)) - return NULL; - i = (int)umask(i); - if (i < 0) - return edk2_error(); - return PyInt_FromLong((long)i); -} - - -PyDoc_STRVAR(edk2_unlink__doc__, -"unlink(path)\n\n\ -Remove a file (same as remove(path))."); - -PyDoc_STRVAR(edk2_remove__doc__, -"remove(path)\n\n\ -Remove a file (same as unlink(path))."); - -static PyObject * -edk2_unlink(PyObject *self, PyObject *args) -{ - return edk2_1str(args, "et:remove", unlink); -} - - -static int -extract_time(PyObject *t, time_t* sec, long* usec) -{ - time_t intval; - if (PyFloat_Check(t)) { - double tval = PyFloat_AsDouble(t); - PyObject *intobj = PyNumber_Long(t); - if (!intobj) - return -1; -#if SIZEOF_TIME_T > SIZEOF_LONG - intval = PyInt_AsUnsignedLongLongMask(intobj); -#else - intval = PyInt_AsLong(intobj); -#endif - Py_DECREF(intobj); - if (intval == -1 && PyErr_Occurred()) - return -1; - *sec = intval; - *usec = (long)((tval - intval) * 1e6); /* can't exceed 1000000 */ - if (*usec < 0) - /* If rounding gave us a negative number, - truncate. */ - *usec = 0; - return 0; - } -#if SIZEOF_TIME_T > SIZEOF_LONG - intval = PyInt_AsUnsignedLongLongMask(t); -#else - intval = PyInt_AsLong(t); -#endif - if (intval == -1 && PyErr_Occurred()) - return -1; - *sec = intval; - *usec = 0; - return 0; -} - -PyDoc_STRVAR(edk2_utime__doc__, -"utime(path, (atime, mtime))\n\ -utime(path, None)\n\n\ -Set the access and modified time of the file to the given values. If the\n\ -second form is used, set the access and modified times to the current time."); - -static PyObject * -edk2_utime(PyObject *self, PyObject *args) -{ - char *path = NULL; - time_t atime, mtime; - long ausec, musec; - int res; - PyObject* arg; - -#if defined(HAVE_UTIMES) - struct timeval buf[2]; -#define ATIME buf[0].tv_sec -#define MTIME buf[1].tv_sec -#elif defined(HAVE_UTIME_H) -/* XXX should define struct utimbuf instead, above */ - struct utimbuf buf; -#define ATIME buf.actime -#define MTIME buf.modtime -#define UTIME_ARG &buf -#else /* HAVE_UTIMES */ - time_t buf[2]; -#define ATIME buf[0] -#define MTIME buf[1] -#define UTIME_ARG buf -#endif /* HAVE_UTIMES */ - - - if (!PyArg_ParseTuple(args, "etO:utime", - Py_FileSystemDefaultEncoding, &path, &arg)) - return NULL; - if (arg == Py_None) { - /* optional time values not given */ - Py_BEGIN_ALLOW_THREADS - res = utime(path, NULL); - Py_END_ALLOW_THREADS - } - else if (!PyTuple_Check(arg) || PyTuple_Size(arg) != 2) { - PyErr_SetString(PyExc_TypeError, - "utime() arg 2 must be a tuple (atime, mtime)"); - PyMem_Free(path); - return NULL; - } - else { - if (extract_time(PyTuple_GET_ITEM(arg, 0), - &atime, &ausec) == -1) { - PyMem_Free(path); - return NULL; - } - if (extract_time(PyTuple_GET_ITEM(arg, 1), - &mtime, &musec) == -1) { - PyMem_Free(path); - return NULL; - } - ATIME = atime; - MTIME = mtime; -#ifdef HAVE_UTIMES - buf[0].tv_usec = ausec; - buf[1].tv_usec = musec; - Py_BEGIN_ALLOW_THREADS - res = utimes(path, buf); - Py_END_ALLOW_THREADS -#else - Py_BEGIN_ALLOW_THREADS - res = utime(path, UTIME_ARG); - Py_END_ALLOW_THREADS -#endif /* HAVE_UTIMES */ - } - if (res < 0) { - return edk2_error_with_allocated_filename(path); - } - PyMem_Free(path); - Py_INCREF(Py_None); - return Py_None; -#undef UTIME_ARG -#undef ATIME -#undef MTIME -} - - -/* Process operations */ - -PyDoc_STRVAR(edk2__exit__doc__, -"_exit(status)\n\n\ -Exit to the system with specified status, without normal exit processing."); - -static PyObject * -edk2__exit(PyObject *self, PyObject *args) -{ - int sts; - if (!PyArg_ParseTuple(args, "i:_exit", &sts)) - return NULL; - _Exit(sts); - return NULL; /* Make gcc -Wall happy */ -} - -#if defined(HAVE_EXECV) || defined(HAVE_SPAWNV) -static void -free_string_array(char **array, Py_ssize_t count) -{ - Py_ssize_t i; - for (i = 0; i < count; i++) - PyMem_Free(array[i]); - PyMem_DEL(array); -} -#endif - - -#ifdef HAVE_EXECV -PyDoc_STRVAR(edk2_execv__doc__, -"execv(path, args)\n\n\ -Execute an executable path with arguments, replacing current process.\n\ -\n\ - path: path of executable file\n\ - args: tuple or list of strings"); - -static PyObject * -edk2_execv(PyObject *self, PyObject *args) -{ - char *path; - PyObject *argv; - char **argvlist; - Py_ssize_t i, argc; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - - /* execv has two arguments: (path, argv), where - argv is a list or tuple of strings. */ - - if (!PyArg_ParseTuple(args, "etO:execv", - Py_FileSystemDefaultEncoding, - &path, &argv)) - return NULL; - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, "execv() arg 2 must be a tuple or list"); - PyMem_Free(path); - return NULL; - } - if (argc < 1) { - PyErr_SetString(PyExc_ValueError, "execv() arg 2 must not be empty"); - PyMem_Free(path); - return NULL; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyMem_Free(path); - return PyErr_NoMemory(); - } - for (i = 0; i < argc; i++) { - if (!PyArg_Parse((*getitem)(argv, i), "et", - Py_FileSystemDefaultEncoding, - &argvlist[i])) { - free_string_array(argvlist, i); - PyErr_SetString(PyExc_TypeError, - "execv() arg 2 must contain only strings"); - PyMem_Free(path); - return NULL; - - } - } - argvlist[argc] = NULL; - - execv(path, argvlist); - - /* If we get here it's definitely an error */ - - free_string_array(argvlist, argc); - PyMem_Free(path); - return edk2_error(); -} - - -PyDoc_STRVAR(edk2_execve__doc__, -"execve(path, args, env)\n\n\ -Execute a path with arguments and environment, replacing current process.\n\ -\n\ - path: path of executable file\n\ - args: tuple or list of arguments\n\ - env: dictionary of strings mapping to strings"); - -static PyObject * -edk2_execve(PyObject *self, PyObject *args) -{ - char *path; - PyObject *argv, *env; - char **argvlist; - char **envlist; - PyObject *key, *val, *keys=NULL, *vals=NULL; - Py_ssize_t i, pos, argc, envc; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - Py_ssize_t lastarg = 0; - - /* execve has three arguments: (path, argv, env), where - argv is a list or tuple of strings and env is a dictionary - like posix.environ. */ - - if (!PyArg_ParseTuple(args, "etOO:execve", - Py_FileSystemDefaultEncoding, - &path, &argv, &env)) - return NULL; - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "execve() arg 2 must be a tuple or list"); - goto fail_0; - } - if (!PyMapping_Check(env)) { - PyErr_SetString(PyExc_TypeError, - "execve() arg 3 must be a mapping object"); - goto fail_0; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyErr_NoMemory(); - goto fail_0; - } - for (i = 0; i < argc; i++) { - if (!PyArg_Parse((*getitem)(argv, i), - "et;execve() arg 2 must contain only strings", - Py_FileSystemDefaultEncoding, - &argvlist[i])) - { - lastarg = i; - goto fail_1; - } - } - lastarg = argc; - argvlist[argc] = NULL; - - i = PyMapping_Size(env); - if (i < 0) - goto fail_1; - envlist = PyMem_NEW(char *, i + 1); - if (envlist == NULL) { - PyErr_NoMemory(); - goto fail_1; - } - envc = 0; - keys = PyMapping_Keys(env); - vals = PyMapping_Values(env); - if (!keys || !vals) - goto fail_2; - if (!PyList_Check(keys) || !PyList_Check(vals)) { - PyErr_SetString(PyExc_TypeError, - "execve(): env.keys() or env.values() is not a list"); - goto fail_2; - } - - for (pos = 0; pos < i; pos++) { - char *p, *k, *v; - size_t len; - - key = PyList_GetItem(keys, pos); - val = PyList_GetItem(vals, pos); - if (!key || !val) - goto fail_2; - - if (!PyArg_Parse( - key, - "s;execve() arg 3 contains a non-string key", - &k) || - !PyArg_Parse( - val, - "s;execve() arg 3 contains a non-string value", - &v)) - { - goto fail_2; - } - -#if defined(PYOS_OS2) - /* Omit Pseudo-Env Vars that Would Confuse Programs if Passed On */ - if (stricmp(k, "BEGINLIBPATH") != 0 && stricmp(k, "ENDLIBPATH") != 0) { -#endif - len = PyString_Size(key) + PyString_Size(val) + 2; - p = PyMem_NEW(char, len); - if (p == NULL) { - PyErr_NoMemory(); - goto fail_2; - } - PyOS_snprintf(p, len, "%s=%s", k, v); - envlist[envc++] = p; -#if defined(PYOS_OS2) - } -#endif - } - envlist[envc] = 0; - - execve(path, argvlist, envlist); - - /* If we get here it's definitely an error */ - - (void) edk2_error(); - - fail_2: - while (--envc >= 0) - PyMem_DEL(envlist[envc]); - PyMem_DEL(envlist); - fail_1: - free_string_array(argvlist, lastarg); - Py_XDECREF(vals); - Py_XDECREF(keys); - fail_0: - PyMem_Free(path); - return NULL; -} -#endif /* HAVE_EXECV */ - - -#ifdef HAVE_SPAWNV -PyDoc_STRVAR(edk2_spawnv__doc__, -"spawnv(mode, path, args)\n\n\ -Execute the program 'path' in a new process.\n\ -\n\ - mode: mode of process creation\n\ - path: path of executable file\n\ - args: tuple or list of strings"); - -static PyObject * -edk2_spawnv(PyObject *self, PyObject *args) -{ - char *path; - PyObject *argv; - char **argvlist; - int mode, i; - Py_ssize_t argc; - Py_intptr_t spawnval; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - - /* spawnv has three arguments: (mode, path, argv), where - argv is a list or tuple of strings. */ - - if (!PyArg_ParseTuple(args, "ietO:spawnv", &mode, - Py_FileSystemDefaultEncoding, - &path, &argv)) - return NULL; - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "spawnv() arg 2 must be a tuple or list"); - PyMem_Free(path); - return NULL; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyMem_Free(path); - return PyErr_NoMemory(); - } - for (i = 0; i < argc; i++) { - if (!PyArg_Parse((*getitem)(argv, i), "et", - Py_FileSystemDefaultEncoding, - &argvlist[i])) { - free_string_array(argvlist, i); - PyErr_SetString( - PyExc_TypeError, - "spawnv() arg 2 must contain only strings"); - PyMem_Free(path); - return NULL; - } - } - argvlist[argc] = NULL; - -#if defined(PYOS_OS2) && defined(PYCC_GCC) - Py_BEGIN_ALLOW_THREADS - spawnval = spawnv(mode, path, argvlist); - Py_END_ALLOW_THREADS -#else - if (mode == _OLD_P_OVERLAY) - mode = _P_OVERLAY; - - Py_BEGIN_ALLOW_THREADS - spawnval = _spawnv(mode, path, argvlist); - Py_END_ALLOW_THREADS -#endif - - free_string_array(argvlist, argc); - PyMem_Free(path); - - if (spawnval == -1) - return edk2_error(); - else -#if SIZEOF_LONG == SIZEOF_VOID_P - return Py_BuildValue("l", (long) spawnval); -#else - return Py_BuildValue("L", (PY_LONG_LONG) spawnval); -#endif -} - - -PyDoc_STRVAR(edk2_spawnve__doc__, -"spawnve(mode, path, args, env)\n\n\ -Execute the program 'path' in a new process.\n\ -\n\ - mode: mode of process creation\n\ - path: path of executable file\n\ - args: tuple or list of arguments\n\ - env: dictionary of strings mapping to strings"); - -static PyObject * -edk2_spawnve(PyObject *self, PyObject *args) -{ - char *path; - PyObject *argv, *env; - char **argvlist; - char **envlist; - PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; - int mode, pos, envc; - Py_ssize_t argc, i; - Py_intptr_t spawnval; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - Py_ssize_t lastarg = 0; - - /* spawnve has four arguments: (mode, path, argv, env), where - argv is a list or tuple of strings and env is a dictionary - like posix.environ. */ - - if (!PyArg_ParseTuple(args, "ietOO:spawnve", &mode, - Py_FileSystemDefaultEncoding, - &path, &argv, &env)) - return NULL; - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "spawnve() arg 2 must be a tuple or list"); - goto fail_0; - } - if (!PyMapping_Check(env)) { - PyErr_SetString(PyExc_TypeError, - "spawnve() arg 3 must be a mapping object"); - goto fail_0; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyErr_NoMemory(); - goto fail_0; - } - for (i = 0; i < argc; i++) { - if (!PyArg_Parse((*getitem)(argv, i), - "et;spawnve() arg 2 must contain only strings", - Py_FileSystemDefaultEncoding, - &argvlist[i])) - { - lastarg = i; - goto fail_1; - } - } - lastarg = argc; - argvlist[argc] = NULL; - - i = PyMapping_Size(env); - if (i < 0) - goto fail_1; - envlist = PyMem_NEW(char *, i + 1); - if (envlist == NULL) { - PyErr_NoMemory(); - goto fail_1; - } - envc = 0; - keys = PyMapping_Keys(env); - vals = PyMapping_Values(env); - if (!keys || !vals) - goto fail_2; - if (!PyList_Check(keys) || !PyList_Check(vals)) { - PyErr_SetString(PyExc_TypeError, - "spawnve(): env.keys() or env.values() is not a list"); - goto fail_2; - } - - for (pos = 0; pos < i; pos++) { - char *p, *k, *v; - size_t len; - - key = PyList_GetItem(keys, pos); - val = PyList_GetItem(vals, pos); - if (!key || !val) - goto fail_2; - - if (!PyArg_Parse( - key, - "s;spawnve() arg 3 contains a non-string key", - &k) || - !PyArg_Parse( - val, - "s;spawnve() arg 3 contains a non-string value", - &v)) - { - goto fail_2; - } - len = PyString_Size(key) + PyString_Size(val) + 2; - p = PyMem_NEW(char, len); - if (p == NULL) { - PyErr_NoMemory(); - goto fail_2; - } - PyOS_snprintf(p, len, "%s=%s", k, v); - envlist[envc++] = p; - } - envlist[envc] = 0; - -#if defined(PYOS_OS2) && defined(PYCC_GCC) - Py_BEGIN_ALLOW_THREADS - spawnval = spawnve(mode, path, argvlist, envlist); - Py_END_ALLOW_THREADS -#else - if (mode == _OLD_P_OVERLAY) - mode = _P_OVERLAY; - - Py_BEGIN_ALLOW_THREADS - spawnval = _spawnve(mode, path, argvlist, envlist); - Py_END_ALLOW_THREADS -#endif - - if (spawnval == -1) - (void) edk2_error(); - else -#if SIZEOF_LONG == SIZEOF_VOID_P - res = Py_BuildValue("l", (long) spawnval); -#else - res = Py_BuildValue("L", (PY_LONG_LONG) spawnval); -#endif - - fail_2: - while (--envc >= 0) - PyMem_DEL(envlist[envc]); - PyMem_DEL(envlist); - fail_1: - free_string_array(argvlist, lastarg); - Py_XDECREF(vals); - Py_XDECREF(keys); - fail_0: - PyMem_Free(path); - return res; -} - -/* OS/2 supports spawnvp & spawnvpe natively */ -#if defined(PYOS_OS2) -PyDoc_STRVAR(edk2_spawnvp__doc__, -"spawnvp(mode, file, args)\n\n\ -Execute the program 'file' in a new process, using the environment\n\ -search path to find the file.\n\ -\n\ - mode: mode of process creation\n\ - file: executable file name\n\ - args: tuple or list of strings"); - -static PyObject * -edk2_spawnvp(PyObject *self, PyObject *args) -{ - char *path; - PyObject *argv; - char **argvlist; - int mode, i, argc; - Py_intptr_t spawnval; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - - /* spawnvp has three arguments: (mode, path, argv), where - argv is a list or tuple of strings. */ - - if (!PyArg_ParseTuple(args, "ietO:spawnvp", &mode, - Py_FileSystemDefaultEncoding, - &path, &argv)) - return NULL; - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "spawnvp() arg 2 must be a tuple or list"); - PyMem_Free(path); - return NULL; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyMem_Free(path); - return PyErr_NoMemory(); - } - for (i = 0; i < argc; i++) { - if (!PyArg_Parse((*getitem)(argv, i), "et", - Py_FileSystemDefaultEncoding, - &argvlist[i])) { - free_string_array(argvlist, i); - PyErr_SetString( - PyExc_TypeError, - "spawnvp() arg 2 must contain only strings"); - PyMem_Free(path); - return NULL; - } - } - argvlist[argc] = NULL; - - Py_BEGIN_ALLOW_THREADS -#if defined(PYCC_GCC) - spawnval = spawnvp(mode, path, argvlist); -#else - spawnval = _spawnvp(mode, path, argvlist); -#endif - Py_END_ALLOW_THREADS - - free_string_array(argvlist, argc); - PyMem_Free(path); - - if (spawnval == -1) - return edk2_error(); - else - return Py_BuildValue("l", (long) spawnval); -} - - -PyDoc_STRVAR(edk2_spawnvpe__doc__, -"spawnvpe(mode, file, args, env)\n\n\ -Execute the program 'file' in a new process, using the environment\n\ -search path to find the file.\n\ -\n\ - mode: mode of process creation\n\ - file: executable file name\n\ - args: tuple or list of arguments\n\ - env: dictionary of strings mapping to strings"); - -static PyObject * -edk2_spawnvpe(PyObject *self, PyObject *args) -{ - char *path; - PyObject *argv, *env; - char **argvlist; - char **envlist; - PyObject *key, *val, *keys=NULL, *vals=NULL, *res=NULL; - int mode, i, pos, argc, envc; - Py_intptr_t spawnval; - PyObject *(*getitem)(PyObject *, Py_ssize_t); - int lastarg = 0; - - /* spawnvpe has four arguments: (mode, path, argv, env), where - argv is a list or tuple of strings and env is a dictionary - like posix.environ. */ - - if (!PyArg_ParseTuple(args, "ietOO:spawnvpe", &mode, - Py_FileSystemDefaultEncoding, - &path, &argv, &env)) - return NULL; - if (PyList_Check(argv)) { - argc = PyList_Size(argv); - getitem = PyList_GetItem; - } - else if (PyTuple_Check(argv)) { - argc = PyTuple_Size(argv); - getitem = PyTuple_GetItem; - } - else { - PyErr_SetString(PyExc_TypeError, - "spawnvpe() arg 2 must be a tuple or list"); - goto fail_0; - } - if (!PyMapping_Check(env)) { - PyErr_SetString(PyExc_TypeError, - "spawnvpe() arg 3 must be a mapping object"); - goto fail_0; - } - - argvlist = PyMem_NEW(char *, argc+1); - if (argvlist == NULL) { - PyErr_NoMemory(); - goto fail_0; - } - for (i = 0; i < argc; i++) { - if (!PyArg_Parse((*getitem)(argv, i), - "et;spawnvpe() arg 2 must contain only strings", - Py_FileSystemDefaultEncoding, - &argvlist[i])) - { - lastarg = i; - goto fail_1; - } - } - lastarg = argc; - argvlist[argc] = NULL; - - i = PyMapping_Size(env); - if (i < 0) - goto fail_1; - envlist = PyMem_NEW(char *, i + 1); - if (envlist == NULL) { - PyErr_NoMemory(); - goto fail_1; - } - envc = 0; - keys = PyMapping_Keys(env); - vals = PyMapping_Values(env); - if (!keys || !vals) - goto fail_2; - if (!PyList_Check(keys) || !PyList_Check(vals)) { - PyErr_SetString(PyExc_TypeError, - "spawnvpe(): env.keys() or env.values() is not a list"); - goto fail_2; - } - - for (pos = 0; pos < i; pos++) { - char *p, *k, *v; - size_t len; - - key = PyList_GetItem(keys, pos); - val = PyList_GetItem(vals, pos); - if (!key || !val) - goto fail_2; - - if (!PyArg_Parse( - key, - "s;spawnvpe() arg 3 contains a non-string key", - &k) || - !PyArg_Parse( - val, - "s;spawnvpe() arg 3 contains a non-string value", - &v)) - { - goto fail_2; - } - len = PyString_Size(key) + PyString_Size(val) + 2; - p = PyMem_NEW(char, len); - if (p == NULL) { - PyErr_NoMemory(); - goto fail_2; - } - PyOS_snprintf(p, len, "%s=%s", k, v); - envlist[envc++] = p; - } - envlist[envc] = 0; - - Py_BEGIN_ALLOW_THREADS -#if defined(PYCC_GCC) - spawnval = spawnvpe(mode, path, argvlist, envlist); -#else - spawnval = _spawnvpe(mode, path, argvlist, envlist); -#endif - Py_END_ALLOW_THREADS - - if (spawnval == -1) - (void) edk2_error(); - else - res = Py_BuildValue("l", (long) spawnval); - - fail_2: - while (--envc >= 0) - PyMem_DEL(envlist[envc]); - PyMem_DEL(envlist); - fail_1: - free_string_array(argvlist, lastarg); - Py_XDECREF(vals); - Py_XDECREF(keys); - fail_0: - PyMem_Free(path); - return res; -} -#endif /* PYOS_OS2 */ -#endif /* HAVE_SPAWNV */ - - -#ifdef HAVE_FORK1 -PyDoc_STRVAR(edk2_fork1__doc__, -"fork1() -> pid\n\n\ -Fork a child process with a single multiplexed (i.e., not bound) thread.\n\ -\n\ -Return 0 to child process and PID of child to parent process."); - -static PyObject * -edk2_fork1(PyObject *self, PyObject *noargs) -{ - pid_t pid; - int result = 0; - _PyImport_AcquireLock(); - pid = fork1(); - if (pid == 0) { - /* child: this clobbers and resets the import lock. */ - PyOS_AfterFork(); - } else { - /* parent: release the import lock. */ - result = _PyImport_ReleaseLock(); - } - if (pid == -1) - return edk2_error(); - if (result < 0) { - /* Don't clobber the OSError if the fork failed. */ - PyErr_SetString(PyExc_RuntimeError, - "not holding the import lock"); - return NULL; - } - return PyLong_FromPid(pid); -} -#endif - - -#ifdef HAVE_FORK -PyDoc_STRVAR(edk2_fork__doc__, -"fork() -> pid\n\n\ -Fork a child process.\n\ -Return 0 to child process and PID of child to parent process."); - -static PyObject * -edk2_fork(PyObject *self, PyObject *noargs) -{ - pid_t pid; - int result = 0; - _PyImport_AcquireLock(); - pid = fork(); - if (pid == 0) { - /* child: this clobbers and resets the import lock. */ - PyOS_AfterFork(); - } else { - /* parent: release the import lock. */ - result = _PyImport_ReleaseLock(); - } - if (pid == -1) - return edk2_error(); - if (result < 0) { - /* Don't clobber the OSError if the fork failed. */ - PyErr_SetString(PyExc_RuntimeError, - "not holding the import lock"); - return NULL; - } - return PyLong_FromPid(pid); -} -#endif - -/* AIX uses /dev/ptc but is otherwise the same as /dev/ptmx */ -/* IRIX has both /dev/ptc and /dev/ptmx, use ptmx */ -#if defined(HAVE_DEV_PTC) && !defined(HAVE_DEV_PTMX) -#define DEV_PTY_FILE "/dev/ptc" -#define HAVE_DEV_PTMX -#else -#define DEV_PTY_FILE "/dev/ptmx" -#endif - -#if defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX) -#ifdef HAVE_PTY_H -#include -#else -#ifdef HAVE_LIBUTIL_H -#include -#else -#ifdef HAVE_UTIL_H -#include -#endif /* HAVE_UTIL_H */ -#endif /* HAVE_LIBUTIL_H */ -#endif /* HAVE_PTY_H */ -#ifdef HAVE_STROPTS_H -#include -#endif -#endif /* defined(HAVE_OPENPTY) || defined(HAVE_FORKPTY) || defined(HAVE_DEV_PTMX */ - -#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) -PyDoc_STRVAR(edk2_openpty__doc__, -"openpty() -> (master_fd, slave_fd)\n\n\ -Open a pseudo-terminal, returning open fd's for both master and slave end.\n"); - -static PyObject * -edk2_openpty(PyObject *self, PyObject *noargs) -{ - int master_fd, slave_fd; -#ifndef HAVE_OPENPTY - char * slave_name; -#endif -#if defined(HAVE_DEV_PTMX) && !defined(HAVE_OPENPTY) && !defined(HAVE__GETPTY) - PyOS_sighandler_t sig_saved; -#ifdef sun - extern char *ptsname(int fildes); -#endif -#endif - -#ifdef HAVE_OPENPTY - if (openpty(&master_fd, &slave_fd, NULL, NULL, NULL) != 0) - return edk2_error(); -#elif defined(HAVE__GETPTY) - slave_name = _getpty(&master_fd, O_RDWR, 0666, 0); - if (slave_name == NULL) - return edk2_error(); - - slave_fd = open(slave_name, O_RDWR); - if (slave_fd < 0) - return edk2_error(); -#else - master_fd = open(DEV_PTY_FILE, O_RDWR | O_NOCTTY); /* open master */ - if (master_fd < 0) - return edk2_error(); - sig_saved = PyOS_setsig(SIGCHLD, SIG_DFL); - /* change permission of slave */ - if (grantpt(master_fd) < 0) { - PyOS_setsig(SIGCHLD, sig_saved); - return edk2_error(); - } - /* unlock slave */ - if (unlockpt(master_fd) < 0) { - PyOS_setsig(SIGCHLD, sig_saved); - return edk2_error(); - } - PyOS_setsig(SIGCHLD, sig_saved); - slave_name = ptsname(master_fd); /* get name of slave */ - if (slave_name == NULL) - return edk2_error(); - slave_fd = open(slave_name, O_RDWR | O_NOCTTY); /* open slave */ - if (slave_fd < 0) - return edk2_error(); -#if !defined(__CYGWIN__) && !defined(HAVE_DEV_PTC) - ioctl(slave_fd, I_PUSH, "ptem"); /* push ptem */ - ioctl(slave_fd, I_PUSH, "ldterm"); /* push ldterm */ -#ifndef __hpux - ioctl(slave_fd, I_PUSH, "ttcompat"); /* push ttcompat */ -#endif /* __hpux */ -#endif /* HAVE_CYGWIN */ -#endif /* HAVE_OPENPTY */ - - return Py_BuildValue("(ii)", master_fd, slave_fd); - -} -#endif /* defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) */ - -#ifdef HAVE_FORKPTY -PyDoc_STRVAR(edk2_forkpty__doc__, -"forkpty() -> (pid, master_fd)\n\n\ -Fork a new process with a new pseudo-terminal as controlling tty.\n\n\ -Like fork(), return 0 as pid to child process, and PID of child to parent.\n\ -To both, return fd of newly opened pseudo-terminal.\n"); - -static PyObject * -edk2_forkpty(PyObject *self, PyObject *noargs) -{ - int master_fd = -1, result = 0; - pid_t pid; - - _PyImport_AcquireLock(); - pid = forkpty(&master_fd, NULL, NULL, NULL); - if (pid == 0) { - /* child: this clobbers and resets the import lock. */ - PyOS_AfterFork(); - } else { - /* parent: release the import lock. */ - result = _PyImport_ReleaseLock(); - } - if (pid == -1) - return edk2_error(); - if (result < 0) { - /* Don't clobber the OSError if the fork failed. */ - PyErr_SetString(PyExc_RuntimeError, - "not holding the import lock"); - return NULL; - } - return Py_BuildValue("(Ni)", PyLong_FromPid(pid), master_fd); -} -#endif - -PyDoc_STRVAR(edk2_getpid__doc__, -"getpid() -> pid\n\n\ -Return the current process id"); - -static PyObject * -edk2_getpid(PyObject *self, PyObject *noargs) -{ - return PyLong_FromPid(getpid()); -} - - -#ifdef HAVE_GETLOGIN -PyDoc_STRVAR(edk2_getlogin__doc__, -"getlogin() -> string\n\n\ -Return the actual login name."); - -static PyObject * -edk2_getlogin(PyObject *self, PyObject *noargs) -{ - PyObject *result = NULL; - char *name; - int old_errno = errno; - - errno = 0; - name = getlogin(); - if (name == NULL) { - if (errno) - edk2_error(); - else - PyErr_SetString(PyExc_OSError, - "unable to determine login name"); - } - else - result = PyString_FromString(name); - errno = old_errno; - - return result; -} -#endif - -#ifdef HAVE_KILL -PyDoc_STRVAR(edk2_kill__doc__, -"kill(pid, sig)\n\n\ -Kill a process with a signal."); - -static PyObject * -edk2_kill(PyObject *self, PyObject *args) -{ - pid_t pid; - int sig; - if (!PyArg_ParseTuple(args, PARSE_PID "i:kill", &pid, &sig)) - return NULL; -#if defined(PYOS_OS2) && !defined(PYCC_GCC) - if (sig == XCPT_SIGNAL_INTR || sig == XCPT_SIGNAL_BREAK) { - APIRET rc; - if ((rc = DosSendSignalException(pid, sig)) != NO_ERROR) - return os2_error(rc); - - } else if (sig == XCPT_SIGNAL_KILLPROC) { - APIRET rc; - if ((rc = DosKillProcess(DKP_PROCESS, pid)) != NO_ERROR) - return os2_error(rc); - - } else - return NULL; /* Unrecognized Signal Requested */ -#else - if (kill(pid, sig) == -1) - return edk2_error(); -#endif - Py_INCREF(Py_None); - return Py_None; -} -#endif - -#ifdef HAVE_PLOCK - -#ifdef HAVE_SYS_LOCK_H -#include -#endif - -PyDoc_STRVAR(edk2_plock__doc__, -"plock(op)\n\n\ -Lock program segments into memory."); - -static PyObject * -edk2_plock(PyObject *self, PyObject *args) -{ - int op; - if (!PyArg_ParseTuple(args, "i:plock", &op)) - return NULL; - if (plock(op) == -1) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif - - -#ifdef HAVE_POPEN -PyDoc_STRVAR(edk2_popen__doc__, -"popen(command [, mode='r' [, bufsize]]) -> pipe\n\n\ -Open a pipe to/from a command returning a file object."); - -static PyObject * -edk2_popen(PyObject *self, PyObject *args) -{ - char *name; - char *mode = "r"; - int bufsize = -1; - FILE *fp; - PyObject *f; - if (!PyArg_ParseTuple(args, "s|si:popen", &name, &mode, &bufsize)) - return NULL; - /* Strip mode of binary or text modifiers */ - if (strcmp(mode, "rb") == 0 || strcmp(mode, "rt") == 0) - mode = "r"; - else if (strcmp(mode, "wb") == 0 || strcmp(mode, "wt") == 0) - mode = "w"; - Py_BEGIN_ALLOW_THREADS - fp = popen(name, mode); - Py_END_ALLOW_THREADS - if (fp == NULL) - return edk2_error(); - f = PyFile_FromFile(fp, name, mode, pclose); - if (f != NULL) - PyFile_SetBufSize(f, bufsize); - return f; -} - -#endif /* HAVE_POPEN */ - - -#if defined(HAVE_WAIT3) || defined(HAVE_WAIT4) -static PyObject * -wait_helper(pid_t pid, int status, struct rusage *ru) -{ - PyObject *result; - static PyObject *struct_rusage; - - if (pid == -1) - return edk2_error(); - - if (struct_rusage == NULL) { - PyObject *m = PyImport_ImportModuleNoBlock("resource"); - if (m == NULL) - return NULL; - struct_rusage = PyObject_GetAttrString(m, "struct_rusage"); - Py_DECREF(m); - if (struct_rusage == NULL) - return NULL; - } - - /* XXX(nnorwitz): Copied (w/mods) from resource.c, there should be only one. */ - result = PyStructSequence_New((PyTypeObject*) struct_rusage); - if (!result) - return NULL; - -#ifndef doubletime -#define doubletime(TV) ((double)(TV).tv_sec + (TV).tv_usec * 0.000001) -#endif - - PyStructSequence_SET_ITEM(result, 0, - PyFloat_FromDouble(doubletime(ru->ru_utime))); - PyStructSequence_SET_ITEM(result, 1, - PyFloat_FromDouble(doubletime(ru->ru_stime))); -#define SET_INT(result, index, value)\ - PyStructSequence_SET_ITEM(result, index, PyInt_FromLong(value)) - SET_INT(result, 2, ru->ru_maxrss); - SET_INT(result, 3, ru->ru_ixrss); - SET_INT(result, 4, ru->ru_idrss); - SET_INT(result, 5, ru->ru_isrss); - SET_INT(result, 6, ru->ru_minflt); - SET_INT(result, 7, ru->ru_majflt); - SET_INT(result, 8, ru->ru_nswap); - SET_INT(result, 9, ru->ru_inblock); - SET_INT(result, 10, ru->ru_oublock); - SET_INT(result, 11, ru->ru_msgsnd); - SET_INT(result, 12, ru->ru_msgrcv); - SET_INT(result, 13, ru->ru_nsignals); - SET_INT(result, 14, ru->ru_nvcsw); - SET_INT(result, 15, ru->ru_nivcsw); -#undef SET_INT - - if (PyErr_Occurred()) { - Py_DECREF(result); - return NULL; - } - - return Py_BuildValue("NiN", PyLong_FromPid(pid), status, result); -} -#endif /* HAVE_WAIT3 || HAVE_WAIT4 */ - -#ifdef HAVE_WAIT3 -PyDoc_STRVAR(edk2_wait3__doc__, -"wait3(options) -> (pid, status, rusage)\n\n\ -Wait for completion of a child process."); - -static PyObject * -edk2_wait3(PyObject *self, PyObject *args) -{ - pid_t pid; - int options; - struct rusage ru; - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:wait3", &options)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - pid = wait3(&status, options, &ru); - Py_END_ALLOW_THREADS - - return wait_helper(pid, WAIT_STATUS_INT(status), &ru); -} -#endif /* HAVE_WAIT3 */ - -#ifdef HAVE_WAIT4 -PyDoc_STRVAR(edk2_wait4__doc__, -"wait4(pid, options) -> (pid, status, rusage)\n\n\ -Wait for completion of a given child process."); - -static PyObject * -edk2_wait4(PyObject *self, PyObject *args) -{ - pid_t pid; - int options; - struct rusage ru; - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, PARSE_PID "i:wait4", &pid, &options)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - pid = wait4(pid, &status, options, &ru); - Py_END_ALLOW_THREADS - - return wait_helper(pid, WAIT_STATUS_INT(status), &ru); -} -#endif /* HAVE_WAIT4 */ - -#ifdef HAVE_WAITPID -PyDoc_STRVAR(edk2_waitpid__doc__, -"waitpid(pid, options) -> (pid, status)\n\n\ -Wait for completion of a given child process."); - -static PyObject * -edk2_waitpid(PyObject *self, PyObject *args) -{ - pid_t pid; - int options; - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, PARSE_PID "i:waitpid", &pid, &options)) - return NULL; - Py_BEGIN_ALLOW_THREADS - pid = waitpid(pid, &status, options); - Py_END_ALLOW_THREADS - if (pid == -1) - return edk2_error(); - - return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); -} - -#elif defined(HAVE_CWAIT) - -/* MS C has a variant of waitpid() that's usable for most purposes. */ -PyDoc_STRVAR(edk2_waitpid__doc__, -"waitpid(pid, options) -> (pid, status << 8)\n\n" -"Wait for completion of a given process. options is ignored on Windows."); - -static PyObject * -edk2_waitpid(PyObject *self, PyObject *args) -{ - Py_intptr_t pid; - int status, options; - - if (!PyArg_ParseTuple(args, PARSE_PID "i:waitpid", &pid, &options)) - return NULL; - Py_BEGIN_ALLOW_THREADS - pid = _cwait(&status, pid, options); - Py_END_ALLOW_THREADS - if (pid == -1) - return edk2_error(); - - /* shift the status left a byte so this is more like the POSIX waitpid */ - return Py_BuildValue("Ni", PyLong_FromPid(pid), status << 8); -} -#endif /* HAVE_WAITPID || HAVE_CWAIT */ - -#ifdef HAVE_WAIT -PyDoc_STRVAR(edk2_wait__doc__, -"wait() -> (pid, status)\n\n\ -Wait for completion of a child process."); - -static PyObject * -edk2_wait(PyObject *self, PyObject *noargs) -{ - pid_t pid; - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - Py_BEGIN_ALLOW_THREADS - pid = wait(&status); - Py_END_ALLOW_THREADS - if (pid == -1) - return edk2_error(); - - return Py_BuildValue("Ni", PyLong_FromPid(pid), WAIT_STATUS_INT(status)); -} -#endif - - -PyDoc_STRVAR(edk2_lstat__doc__, -"lstat(path) -> stat result\n\n\ -Like stat(path), but do not follow symbolic links."); - -static PyObject * -edk2_lstat(PyObject *self, PyObject *args) -{ -#ifdef HAVE_LSTAT - return edk2_do_stat(self, args, "et:lstat", lstat, NULL, NULL); -#else /* !HAVE_LSTAT */ - return edk2_do_stat(self, args, "et:lstat", STAT, NULL, NULL); -#endif /* !HAVE_LSTAT */ -} - - -#ifdef HAVE_READLINK -PyDoc_STRVAR(edk2_readlink__doc__, -"readlink(path) -> path\n\n\ -Return a string representing the path to which the symbolic link points."); - -static PyObject * -edk2_readlink(PyObject *self, PyObject *args) -{ - PyObject* v; - char buf[MAXPATHLEN]; - char *path; - int n; -#ifdef Py_USING_UNICODE - int arg_is_unicode = 0; -#endif - - if (!PyArg_ParseTuple(args, "et:readlink", - Py_FileSystemDefaultEncoding, &path)) - return NULL; -#ifdef Py_USING_UNICODE - v = PySequence_GetItem(args, 0); - if (v == NULL) { - PyMem_Free(path); - return NULL; - } - - if (PyUnicode_Check(v)) { - arg_is_unicode = 1; - } - Py_DECREF(v); -#endif - - Py_BEGIN_ALLOW_THREADS - n = readlink(path, buf, (int) sizeof buf); - Py_END_ALLOW_THREADS - if (n < 0) - return edk2_error_with_allocated_filename(path); - - PyMem_Free(path); - v = PyString_FromStringAndSize(buf, n); -#ifdef Py_USING_UNICODE - if (arg_is_unicode) { - PyObject *w; - - w = PyUnicode_FromEncodedObject(v, - Py_FileSystemDefaultEncoding, - "strict"); - if (w != NULL) { - Py_DECREF(v); - v = w; - } - else { - /* fall back to the original byte string, as - discussed in patch #683592 */ - PyErr_Clear(); - } - } -#endif - return v; -} -#endif /* HAVE_READLINK */ - - -#ifdef HAVE_SYMLINK -PyDoc_STRVAR(edk2_symlink__doc__, -"symlink(src, dst)\n\n\ -Create a symbolic link pointing to src named dst."); - -static PyObject * -edk2_symlink(PyObject *self, PyObject *args) -{ - return edk2_2str(args, "etet:symlink", symlink); -} -#endif /* HAVE_SYMLINK */ - - -#ifdef HAVE_TIMES -#define NEED_TICKS_PER_SECOND -static long ticks_per_second = -1; -static PyObject * -edk2_times(PyObject *self, PyObject *noargs) -{ - struct tms t; - clock_t c; - errno = 0; - c = times(&t); - if (c == (clock_t) -1) - return edk2_error(); - return Py_BuildValue("ddddd", - (double)t.tms_utime / ticks_per_second, - (double)t.tms_stime / ticks_per_second, - (double)t.tms_cutime / ticks_per_second, - (double)t.tms_cstime / ticks_per_second, - (double)c / ticks_per_second); -} -#endif /* HAVE_TIMES */ - - -#ifdef HAVE_TIMES -PyDoc_STRVAR(edk2_times__doc__, -"times() -> (utime, stime, cutime, cstime, elapsed_time)\n\n\ -Return a tuple of floating point numbers indicating process times."); -#endif - - -#ifdef HAVE_GETSID -PyDoc_STRVAR(edk2_getsid__doc__, -"getsid(pid) -> sid\n\n\ -Call the system call getsid()."); - -static PyObject * -edk2_getsid(PyObject *self, PyObject *args) -{ - pid_t pid; - int sid; - if (!PyArg_ParseTuple(args, PARSE_PID ":getsid", &pid)) - return NULL; - sid = getsid(pid); - if (sid < 0) - return edk2_error(); - return PyInt_FromLong((long)sid); -} -#endif /* HAVE_GETSID */ - - -#ifdef HAVE_SETSID -PyDoc_STRVAR(edk2_setsid__doc__, -"setsid()\n\n\ -Call the system call setsid()."); - -static PyObject * -edk2_setsid(PyObject *self, PyObject *noargs) -{ - if (setsid() < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_SETSID */ - -#ifdef HAVE_SETPGID -PyDoc_STRVAR(edk2_setpgid__doc__, -"setpgid(pid, pgrp)\n\n\ -Call the system call setpgid()."); - -static PyObject * -edk2_setpgid(PyObject *self, PyObject *args) -{ - pid_t pid; - int pgrp; - if (!PyArg_ParseTuple(args, PARSE_PID "i:setpgid", &pid, &pgrp)) - return NULL; - if (setpgid(pid, pgrp) < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_SETPGID */ - - -#ifdef HAVE_TCGETPGRP -PyDoc_STRVAR(edk2_tcgetpgrp__doc__, -"tcgetpgrp(fd) -> pgid\n\n\ -Return the process group associated with the terminal given by a fd."); - -static PyObject * -edk2_tcgetpgrp(PyObject *self, PyObject *args) -{ - int fd; - pid_t pgid; - if (!PyArg_ParseTuple(args, "i:tcgetpgrp", &fd)) - return NULL; - pgid = tcgetpgrp(fd); - if (pgid < 0) - return edk2_error(); - return PyLong_FromPid(pgid); -} -#endif /* HAVE_TCGETPGRP */ - - -#ifdef HAVE_TCSETPGRP -PyDoc_STRVAR(edk2_tcsetpgrp__doc__, -"tcsetpgrp(fd, pgid)\n\n\ -Set the process group associated with the terminal given by a fd."); - -static PyObject * -edk2_tcsetpgrp(PyObject *self, PyObject *args) -{ - int fd; - pid_t pgid; - if (!PyArg_ParseTuple(args, "i" PARSE_PID ":tcsetpgrp", &fd, &pgid)) - return NULL; - if (tcsetpgrp(fd, pgid) < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* HAVE_TCSETPGRP */ - -/* Functions acting on file descriptors */ - -PyDoc_STRVAR(edk2_open__doc__, -"open(filename, flag [, mode=0777]) -> fd\n\n\ -Open a file (for low level IO)."); - -static PyObject * -edk2_open(PyObject *self, PyObject *args) -{ - char *file = NULL; - int flag; - int mode = 0777; - int fd; - - if (!PyArg_ParseTuple(args, "eti|i", - Py_FileSystemDefaultEncoding, &file, - &flag, &mode)) - return NULL; - - Py_BEGIN_ALLOW_THREADS - fd = open(file, flag, mode); - Py_END_ALLOW_THREADS - if (fd < 0) - return edk2_error_with_allocated_filename(file); - PyMem_Free(file); - return PyInt_FromLong((long)fd); -} - - -PyDoc_STRVAR(edk2_close__doc__, -"close(fd)\n\n\ -Close a file descriptor (for low level IO)."); - -static PyObject * -edk2_close(PyObject *self, PyObject *args) -{ - int fd, res; - if (!PyArg_ParseTuple(args, "i:close", &fd)) - return NULL; - if (!_PyVerify_fd(fd)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS - res = close(fd); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(edk2_closerange__doc__, -"closerange(fd_low, fd_high)\n\n\ -Closes all file descriptors in [fd_low, fd_high), ignoring errors."); - -static PyObject * -edk2_closerange(PyObject *self, PyObject *args) -{ - int fd_from, fd_to, i; - if (!PyArg_ParseTuple(args, "ii:closerange", &fd_from, &fd_to)) - return NULL; - Py_BEGIN_ALLOW_THREADS - for (i = fd_from; i < fd_to; i++) - if (_PyVerify_fd(i)) - close(i); - Py_END_ALLOW_THREADS - Py_RETURN_NONE; -} - - -PyDoc_STRVAR(edk2_dup__doc__, -"dup(fd) -> fd2\n\n\ -Return a duplicate of a file descriptor."); - -static PyObject * -edk2_dup(PyObject *self, PyObject *args) -{ - int fd; - if (!PyArg_ParseTuple(args, "i:dup", &fd)) - return NULL; - if (!_PyVerify_fd(fd)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS - fd = dup(fd); - Py_END_ALLOW_THREADS - if (fd < 0) - return edk2_error(); - return PyInt_FromLong((long)fd); -} - - -PyDoc_STRVAR(edk2_dup2__doc__, -"dup2(old_fd, new_fd)\n\n\ -Duplicate file descriptor."); - -static PyObject * -edk2_dup2(PyObject *self, PyObject *args) -{ - int fd, fd2, res; - if (!PyArg_ParseTuple(args, "ii:dup2", &fd, &fd2)) - return NULL; - if (!_PyVerify_fd_dup2(fd, fd2)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS - res = dup2(fd, fd2); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(edk2_lseek__doc__, -"lseek(fd, pos, how) -> newpos\n\n\ -Set the current position of a file descriptor."); - -static PyObject * -edk2_lseek(PyObject *self, PyObject *args) -{ - int fd, how; - off_t pos, res; - PyObject *posobj; - if (!PyArg_ParseTuple(args, "iOi:lseek", &fd, &posobj, &how)) - return NULL; -#ifdef SEEK_SET - /* Turn 0, 1, 2 into SEEK_{SET,CUR,END} */ - switch (how) { - case 0: how = SEEK_SET; break; - case 1: how = SEEK_CUR; break; - case 2: how = SEEK_END; break; - } -#endif /* SEEK_END */ - -#if !defined(HAVE_LARGEFILE_SUPPORT) - pos = PyInt_AsLong(posobj); -#else - pos = PyLong_Check(posobj) ? - PyLong_AsLongLong(posobj) : PyInt_AsLong(posobj); -#endif - if (PyErr_Occurred()) - return NULL; - - if (!_PyVerify_fd(fd)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS - res = lseek(fd, pos, how); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - -#if !defined(HAVE_LARGEFILE_SUPPORT) - return PyInt_FromLong(res); -#else - return PyLong_FromLongLong(res); -#endif -} - - -PyDoc_STRVAR(edk2_read__doc__, -"read(fd, buffersize) -> string\n\n\ -Read a file descriptor."); - -static PyObject * -edk2_read(PyObject *self, PyObject *args) -{ - int fd, size, n; - PyObject *buffer; - if (!PyArg_ParseTuple(args, "ii:read", &fd, &size)) - return NULL; - if (size < 0) { - errno = EINVAL; - return edk2_error(); - } - buffer = PyString_FromStringAndSize((char *)NULL, size); - if (buffer == NULL) - return NULL; - if (!_PyVerify_fd(fd)) { - Py_DECREF(buffer); - return edk2_error(); - } - Py_BEGIN_ALLOW_THREADS - n = read(fd, PyString_AsString(buffer), size); - Py_END_ALLOW_THREADS - if (n < 0) { - Py_DECREF(buffer); - return edk2_error(); - } - if (n != size) - _PyString_Resize(&buffer, n); - return buffer; -} - - -PyDoc_STRVAR(edk2_write__doc__, -"write(fd, string) -> byteswritten\n\n\ -Write a string to a file descriptor."); - -static PyObject * -edk2_write(PyObject *self, PyObject *args) -{ - Py_buffer pbuf; - int fd; - Py_ssize_t size; - - if (!PyArg_ParseTuple(args, "is*:write", &fd, &pbuf)) - return NULL; - if (!_PyVerify_fd(fd)) { - PyBuffer_Release(&pbuf); - return edk2_error(); - } - Py_BEGIN_ALLOW_THREADS - size = write(fd, pbuf.buf, (size_t)pbuf.len); - Py_END_ALLOW_THREADS - PyBuffer_Release(&pbuf); - if (size < 0) - return edk2_error(); - return PyInt_FromSsize_t(size); -} - - -PyDoc_STRVAR(edk2_fstat__doc__, -"fstat(fd) -> stat result\n\n\ -Like stat(), but for an open file descriptor."); - -static PyObject * -edk2_fstat(PyObject *self, PyObject *args) -{ - int fd; - STRUCT_STAT st; - int res; - if (!PyArg_ParseTuple(args, "i:fstat", &fd)) - return NULL; - if (!_PyVerify_fd(fd)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS - res = FSTAT(fd, &st); - Py_END_ALLOW_THREADS - if (res != 0) { - return edk2_error(); - } - - return _pystat_fromstructstat(&st); -} - - -PyDoc_STRVAR(edk2_fdopen__doc__, -"fdopen(fd [, mode='r' [, bufsize]]) -> file_object\n\n\ -Return an open file object connected to a file descriptor."); - -static PyObject * -edk2_fdopen(PyObject *self, PyObject *args) -{ - int fd; - char *orgmode = "r"; - int bufsize = -1; - FILE *fp; - PyObject *f; - char *mode; - if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize)) - return NULL; - - /* Sanitize mode. See fileobject.c */ - mode = PyMem_MALLOC(strlen(orgmode)+3); - if (!mode) { - PyErr_NoMemory(); - return NULL; - } - strcpy(mode, orgmode); - if (_PyFile_SanitizeMode(mode)) { - PyMem_FREE(mode); - return NULL; - } - if (!_PyVerify_fd(fd)) - return edk2_error(); - Py_BEGIN_ALLOW_THREADS -#if defined(HAVE_FCNTL_H) - if (mode[0] == 'a') { - /* try to make sure the O_APPEND flag is set */ - int flags; - flags = fcntl(fd, F_GETFL); - if (flags != -1) - fcntl(fd, F_SETFL, flags | O_APPEND); - fp = fdopen(fd, mode); - if (fp == NULL && flags != -1) - /* restore old mode if fdopen failed */ - fcntl(fd, F_SETFL, flags); - } else { - fp = fdopen(fd, mode); - } -#else - fp = fdopen(fd, mode); -#endif - Py_END_ALLOW_THREADS - PyMem_FREE(mode); - if (fp == NULL) - return edk2_error(); - f = PyFile_FromFile(fp, "", orgmode, fclose); - if (f != NULL) - PyFile_SetBufSize(f, bufsize); - return f; -} - -PyDoc_STRVAR(edk2_isatty__doc__, -"isatty(fd) -> bool\n\n\ -Return True if the file descriptor 'fd' is an open file descriptor\n\ -connected to the slave end of a terminal."); - -static PyObject * -edk2_isatty(PyObject *self, PyObject *args) -{ - int fd; - if (!PyArg_ParseTuple(args, "i:isatty", &fd)) - return NULL; - if (!_PyVerify_fd(fd)) - return PyBool_FromLong(0); - return PyBool_FromLong(isatty(fd)); -} - -#ifdef HAVE_PIPE -PyDoc_STRVAR(edk2_pipe__doc__, -"pipe() -> (read_end, write_end)\n\n\ -Create a pipe."); - -static PyObject * -edk2_pipe(PyObject *self, PyObject *noargs) -{ - int fds[2]; - int res; - Py_BEGIN_ALLOW_THREADS - res = pipe(fds); - Py_END_ALLOW_THREADS - if (res != 0) - return edk2_error(); - return Py_BuildValue("(ii)", fds[0], fds[1]); -} -#endif /* HAVE_PIPE */ - - -#ifdef HAVE_MKFIFO -PyDoc_STRVAR(edk2_mkfifo__doc__, -"mkfifo(filename [, mode=0666])\n\n\ -Create a FIFO (a POSIX named pipe)."); - -static PyObject * -edk2_mkfifo(PyObject *self, PyObject *args) -{ - char *filename; - int mode = 0666; - int res; - if (!PyArg_ParseTuple(args, "s|i:mkfifo", &filename, &mode)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = mkfifo(filename, mode); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif - - -#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) -PyDoc_STRVAR(edk2_mknod__doc__, -"mknod(filename [, mode=0600, device])\n\n\ -Create a filesystem node (file, device special file or named pipe)\n\ -named filename. mode specifies both the permissions to use and the\n\ -type of node to be created, being combined (bitwise OR) with one of\n\ -S_IFREG, S_IFCHR, S_IFBLK, and S_IFIFO. For S_IFCHR and S_IFBLK,\n\ -device defines the newly created device special file (probably using\n\ -os.makedev()), otherwise it is ignored."); - - -static PyObject * -edk2_mknod(PyObject *self, PyObject *args) -{ - char *filename; - int mode = 0600; - int device = 0; - int res; - if (!PyArg_ParseTuple(args, "s|ii:mknod", &filename, &mode, &device)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = mknod(filename, mode, device); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif - -#ifdef HAVE_DEVICE_MACROS -PyDoc_STRVAR(edk2_major__doc__, -"major(device) -> major number\n\ -Extracts a device major number from a raw device number."); - -static PyObject * -edk2_major(PyObject *self, PyObject *args) -{ - int device; - if (!PyArg_ParseTuple(args, "i:major", &device)) - return NULL; - return PyInt_FromLong((long)major(device)); -} - -PyDoc_STRVAR(edk2_minor__doc__, -"minor(device) -> minor number\n\ -Extracts a device minor number from a raw device number."); - -static PyObject * -edk2_minor(PyObject *self, PyObject *args) -{ - int device; - if (!PyArg_ParseTuple(args, "i:minor", &device)) - return NULL; - return PyInt_FromLong((long)minor(device)); -} - -PyDoc_STRVAR(edk2_makedev__doc__, -"makedev(major, minor) -> device number\n\ -Composes a raw device number from the major and minor device numbers."); - -static PyObject * -edk2_makedev(PyObject *self, PyObject *args) -{ - int major, minor; - if (!PyArg_ParseTuple(args, "ii:makedev", &major, &minor)) - return NULL; - return PyInt_FromLong((long)makedev(major, minor)); -} -#endif /* device macros */ - - -#ifdef HAVE_FTRUNCATE -PyDoc_STRVAR(edk2_ftruncate__doc__, -"ftruncate(fd, length)\n\n\ -Truncate a file to a specified length."); - -static PyObject * -edk2_ftruncate(PyObject *self, PyObject *args) -{ - int fd; - off_t length; - int res; - PyObject *lenobj; - - if (!PyArg_ParseTuple(args, "iO:ftruncate", &fd, &lenobj)) - return NULL; - -#if !defined(HAVE_LARGEFILE_SUPPORT) - length = PyInt_AsLong(lenobj); -#else - length = PyLong_Check(lenobj) ? - PyLong_AsLongLong(lenobj) : PyInt_AsLong(lenobj); -#endif - if (PyErr_Occurred()) - return NULL; - - Py_BEGIN_ALLOW_THREADS - res = ftruncate(fd, length); - Py_END_ALLOW_THREADS - if (res < 0) - return edk2_error(); - Py_INCREF(Py_None); - return Py_None; -} -#endif - -#ifdef HAVE_PUTENV -PyDoc_STRVAR(edk2_putenv__doc__, -"putenv(key, value)\n\n\ -Change or add an environment variable."); - -/* Save putenv() parameters as values here, so we can collect them when they - * get re-set with another call for the same key. */ -static PyObject *edk2_putenv_garbage; - -static PyObject * -edk2_putenv(PyObject *self, PyObject *args) -{ - char *s1, *s2; - char *newenv; - PyObject *newstr; - size_t len; - - if (!PyArg_ParseTuple(args, "ss:putenv", &s1, &s2)) - return NULL; - - /* XXX This can leak memory -- not easy to fix :-( */ - len = strlen(s1) + strlen(s2) + 2; - /* len includes space for a trailing \0; the size arg to - PyString_FromStringAndSize does not count that */ - newstr = PyString_FromStringAndSize(NULL, (int)len - 1); - if (newstr == NULL) - return PyErr_NoMemory(); - newenv = PyString_AS_STRING(newstr); - PyOS_snprintf(newenv, len, "%s=%s", s1, s2); - if (putenv(newenv)) { - Py_DECREF(newstr); - edk2_error(); - return NULL; - } - /* Install the first arg and newstr in edk2_putenv_garbage; - * this will cause previous value to be collected. This has to - * happen after the real putenv() call because the old value - * was still accessible until then. */ - if (PyDict_SetItem(edk2_putenv_garbage, - PyTuple_GET_ITEM(args, 0), newstr)) { - /* really not much we can do; just leak */ - PyErr_Clear(); - } - else { - Py_DECREF(newstr); - } - - Py_INCREF(Py_None); - return Py_None; -} -#endif /* putenv */ - -#ifdef HAVE_UNSETENV -PyDoc_STRVAR(edk2_unsetenv__doc__, -"unsetenv(key)\n\n\ -Delete an environment variable."); - -static PyObject * -edk2_unsetenv(PyObject *self, PyObject *args) -{ - char *s1; - - if (!PyArg_ParseTuple(args, "s:unsetenv", &s1)) - return NULL; - - unsetenv(s1); - - /* Remove the key from edk2_putenv_garbage; - * this will cause it to be collected. This has to - * happen after the real unsetenv() call because the - * old value was still accessible until then. - */ - if (PyDict_DelItem(edk2_putenv_garbage, - PyTuple_GET_ITEM(args, 0))) { - /* really not much we can do; just leak */ - PyErr_Clear(); - } - - Py_INCREF(Py_None); - return Py_None; -} -#endif /* unsetenv */ - -PyDoc_STRVAR(edk2_strerror__doc__, -"strerror(code) -> string\n\n\ -Translate an error code to a message string."); - -static PyObject * -edk2_strerror(PyObject *self, PyObject *args) -{ - int code; - char *message; - if (!PyArg_ParseTuple(args, "i:strerror", &code)) - return NULL; - message = strerror(code); - if (message == NULL) { - PyErr_SetString(PyExc_ValueError, - "strerror() argument out of range"); - return NULL; - } - return PyString_FromString(message); -} - - -#ifdef HAVE_SYS_WAIT_H - -#ifdef WCOREDUMP -PyDoc_STRVAR(edk2_WCOREDUMP__doc__, -"WCOREDUMP(status) -> bool\n\n\ -Return True if the process returning 'status' was dumped to a core file."); - -static PyObject * -edk2_WCOREDUMP(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WCOREDUMP", &WAIT_STATUS_INT(status))) - return NULL; - - return PyBool_FromLong(WCOREDUMP(status)); -} -#endif /* WCOREDUMP */ - -#ifdef WIFCONTINUED -PyDoc_STRVAR(edk2_WIFCONTINUED__doc__, -"WIFCONTINUED(status) -> bool\n\n\ -Return True if the process returning 'status' was continued from a\n\ -job control stop."); - -static PyObject * -edk2_WIFCONTINUED(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WCONTINUED", &WAIT_STATUS_INT(status))) - return NULL; - - return PyBool_FromLong(WIFCONTINUED(status)); -} -#endif /* WIFCONTINUED */ - -#ifdef WIFSTOPPED -PyDoc_STRVAR(edk2_WIFSTOPPED__doc__, -"WIFSTOPPED(status) -> bool\n\n\ -Return True if the process returning 'status' was stopped."); - -static PyObject * -edk2_WIFSTOPPED(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WIFSTOPPED", &WAIT_STATUS_INT(status))) - return NULL; - - return PyBool_FromLong(WIFSTOPPED(status)); -} -#endif /* WIFSTOPPED */ - -#ifdef WIFSIGNALED -PyDoc_STRVAR(edk2_WIFSIGNALED__doc__, -"WIFSIGNALED(status) -> bool\n\n\ -Return True if the process returning 'status' was terminated by a signal."); - -static PyObject * -edk2_WIFSIGNALED(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WIFSIGNALED", &WAIT_STATUS_INT(status))) - return NULL; - - return PyBool_FromLong(WIFSIGNALED(status)); -} -#endif /* WIFSIGNALED */ - -#ifdef WIFEXITED -PyDoc_STRVAR(edk2_WIFEXITED__doc__, -"WIFEXITED(status) -> bool\n\n\ -Return true if the process returning 'status' exited using the exit()\n\ -system call."); - -static PyObject * -edk2_WIFEXITED(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WIFEXITED", &WAIT_STATUS_INT(status))) - return NULL; - - return PyBool_FromLong(WIFEXITED(status)); -} -#endif /* WIFEXITED */ - -#ifdef WEXITSTATUS -PyDoc_STRVAR(edk2_WEXITSTATUS__doc__, -"WEXITSTATUS(status) -> integer\n\n\ -Return the process return code from 'status'."); - -static PyObject * -edk2_WEXITSTATUS(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WEXITSTATUS", &WAIT_STATUS_INT(status))) - return NULL; - - return Py_BuildValue("i", WEXITSTATUS(status)); -} -#endif /* WEXITSTATUS */ - -#ifdef WTERMSIG -PyDoc_STRVAR(edk2_WTERMSIG__doc__, -"WTERMSIG(status) -> integer\n\n\ -Return the signal that terminated the process that provided the 'status'\n\ -value."); - -static PyObject * -edk2_WTERMSIG(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WTERMSIG", &WAIT_STATUS_INT(status))) - return NULL; - - return Py_BuildValue("i", WTERMSIG(status)); -} -#endif /* WTERMSIG */ - -#ifdef WSTOPSIG -PyDoc_STRVAR(edk2_WSTOPSIG__doc__, -"WSTOPSIG(status) -> integer\n\n\ -Return the signal that stopped the process that provided\n\ -the 'status' value."); - -static PyObject * -edk2_WSTOPSIG(PyObject *self, PyObject *args) -{ - WAIT_TYPE status; - WAIT_STATUS_INT(status) = 0; - - if (!PyArg_ParseTuple(args, "i:WSTOPSIG", &WAIT_STATUS_INT(status))) - return NULL; - - return Py_BuildValue("i", WSTOPSIG(status)); -} -#endif /* WSTOPSIG */ - -#endif /* HAVE_SYS_WAIT_H */ - - -#if defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H) -#include - -static PyObject* -_pystatvfs_fromstructstatvfs(struct statvfs st) { - PyObject *v = PyStructSequence_New(&StatVFSResultType); - if (v == NULL) - return NULL; - -#if !defined(HAVE_LARGEFILE_SUPPORT) - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); - PyStructSequence_SET_ITEM(v, 2, PyInt_FromLong((long) st.f_blocks)); - PyStructSequence_SET_ITEM(v, 3, PyInt_FromLong((long) st.f_bfree)); - PyStructSequence_SET_ITEM(v, 4, PyInt_FromLong((long) st.f_bavail)); - PyStructSequence_SET_ITEM(v, 5, PyInt_FromLong((long) st.f_files)); - PyStructSequence_SET_ITEM(v, 6, PyInt_FromLong((long) st.f_ffree)); - PyStructSequence_SET_ITEM(v, 7, PyInt_FromLong((long) st.f_favail)); - PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); - PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); -#else - PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long) st.f_bsize)); - PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long) st.f_frsize)); - PyStructSequence_SET_ITEM(v, 2, - PyLong_FromLongLong((PY_LONG_LONG) st.f_blocks)); - PyStructSequence_SET_ITEM(v, 3, - PyLong_FromLongLong((PY_LONG_LONG) st.f_bfree)); - PyStructSequence_SET_ITEM(v, 4, - PyLong_FromLongLong((PY_LONG_LONG) st.f_bavail)); - PyStructSequence_SET_ITEM(v, 5, - PyLong_FromLongLong((PY_LONG_LONG) st.f_files)); - PyStructSequence_SET_ITEM(v, 6, - PyLong_FromLongLong((PY_LONG_LONG) st.f_ffree)); - PyStructSequence_SET_ITEM(v, 7, - PyLong_FromLongLong((PY_LONG_LONG) st.f_favail)); - PyStructSequence_SET_ITEM(v, 8, PyInt_FromLong((long) st.f_flag)); - PyStructSequence_SET_ITEM(v, 9, PyInt_FromLong((long) st.f_namemax)); -#endif - - return v; -} - -PyDoc_STRVAR(edk2_fstatvfs__doc__, -"fstatvfs(fd) -> statvfs result\n\n\ -Perform an fstatvfs system call on the given fd."); - -static PyObject * -edk2_fstatvfs(PyObject *self, PyObject *args) -{ - int fd, res; - struct statvfs st; - - if (!PyArg_ParseTuple(args, "i:fstatvfs", &fd)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = fstatvfs(fd, &st); - Py_END_ALLOW_THREADS - if (res != 0) - return edk2_error(); - - return _pystatvfs_fromstructstatvfs(st); -} -#endif /* HAVE_FSTATVFS && HAVE_SYS_STATVFS_H */ - - -#if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) -#include - -PyDoc_STRVAR(edk2_statvfs__doc__, -"statvfs(path) -> statvfs result\n\n\ -Perform a statvfs system call on the given path."); - -static PyObject * -edk2_statvfs(PyObject *self, PyObject *args) -{ - char *path; - int res; - struct statvfs st; - if (!PyArg_ParseTuple(args, "s:statvfs", &path)) - return NULL; - Py_BEGIN_ALLOW_THREADS - res = statvfs(path, &st); - Py_END_ALLOW_THREADS - if (res != 0) - return edk2_error_with_filename(path); - - return _pystatvfs_fromstructstatvfs(st); -} -#endif /* HAVE_STATVFS */ - - -#ifdef HAVE_TEMPNAM -PyDoc_STRVAR(edk2_tempnam__doc__, -"tempnam([dir[, prefix]]) -> string\n\n\ -Return a unique name for a temporary file.\n\ -The directory and a prefix may be specified as strings; they may be omitted\n\ -or None if not needed."); - -static PyObject * -edk2_tempnam(PyObject *self, PyObject *args) -{ - PyObject *result = NULL; - char *dir = NULL; - char *pfx = NULL; - char *name; - - if (!PyArg_ParseTuple(args, "|zz:tempnam", &dir, &pfx)) - return NULL; - - if (PyErr_Warn(PyExc_RuntimeWarning, - "tempnam is a potential security risk to your program") < 0) - return NULL; - - if (PyErr_WarnPy3k("tempnam has been removed in 3.x; " - "use the tempfile module", 1) < 0) - return NULL; - - name = tempnam(dir, pfx); - if (name == NULL) - return PyErr_NoMemory(); - result = PyString_FromString(name); - free(name); - return result; -} -#endif - - -#ifdef HAVE_TMPFILE -PyDoc_STRVAR(edk2_tmpfile__doc__, -"tmpfile() -> file object\n\n\ -Create a temporary file with no directory entries."); - -static PyObject * -edk2_tmpfile(PyObject *self, PyObject *noargs) -{ - FILE *fp; - - if (PyErr_WarnPy3k("tmpfile has been removed in 3.x; " - "use the tempfile module", 1) < 0) - return NULL; - - fp = tmpfile(); - if (fp == NULL) - return edk2_error(); - return PyFile_FromFile(fp, "", "w+b", fclose); -} -#endif - - -#ifdef HAVE_TMPNAM -PyDoc_STRVAR(edk2_tmpnam__doc__, -"tmpnam() -> string\n\n\ -Return a unique name for a temporary file."); - -static PyObject * -edk2_tmpnam(PyObject *self, PyObject *noargs) -{ - char buffer[L_tmpnam]; - char *name; - - if (PyErr_Warn(PyExc_RuntimeWarning, - "tmpnam is a potential security risk to your program") < 0) - return NULL; - - if (PyErr_WarnPy3k("tmpnam has been removed in 3.x; " - "use the tempfile module", 1) < 0) - return NULL; - -#ifdef USE_TMPNAM_R - name = tmpnam_r(buffer); -#else - name = tmpnam(buffer); -#endif - if (name == NULL) { - PyObject *err = Py_BuildValue("is", 0, -#ifdef USE_TMPNAM_R - "unexpected NULL from tmpnam_r" -#else - "unexpected NULL from tmpnam" -#endif - ); - PyErr_SetObject(PyExc_OSError, err); - Py_XDECREF(err); - return NULL; - } - return PyString_FromString(buffer); -} -#endif - -PyDoc_STRVAR(edk2_abort__doc__, -"abort() -> does not return!\n\n\ -Abort the interpreter immediately. This 'dumps core' or otherwise fails\n\ -in the hardest way possible on the hosting operating system."); - -static PyObject * -edk2_abort(PyObject *self, PyObject *noargs) -{ - abort(); - /*NOTREACHED*/ - Py_FatalError("abort() called from Python code didn't abort!"); - return NULL; -} - -static PyMethodDef edk2_methods[] = { - {"access", edk2_access, METH_VARARGS, edk2_access__doc__}, -#ifdef HAVE_TTYNAME - {"ttyname", edk2_ttyname, METH_VARARGS, edk2_ttyname__doc__}, -#endif - {"chdir", edk2_chdir, METH_VARARGS, edk2_chdir__doc__}, -#ifdef HAVE_CHFLAGS - {"chflags", edk2_chflags, METH_VARARGS, edk2_chflags__doc__}, -#endif /* HAVE_CHFLAGS */ - {"chmod", edk2_chmod, METH_VARARGS, edk2_chmod__doc__}, -#ifdef HAVE_FCHMOD - {"fchmod", edk2_fchmod, METH_VARARGS, edk2_fchmod__doc__}, -#endif /* HAVE_FCHMOD */ -#ifdef HAVE_CHOWN - {"chown", edk2_chown, METH_VARARGS, edk2_chown__doc__}, -#endif /* HAVE_CHOWN */ -#ifdef HAVE_LCHMOD - {"lchmod", edk2_lchmod, METH_VARARGS, edk2_lchmod__doc__}, -#endif /* HAVE_LCHMOD */ -#ifdef HAVE_FCHOWN - {"fchown", edk2_fchown, METH_VARARGS, edk2_fchown__doc__}, -#endif /* HAVE_FCHOWN */ -#ifdef HAVE_LCHFLAGS - {"lchflags", edk2_lchflags, METH_VARARGS, edk2_lchflags__doc__}, -#endif /* HAVE_LCHFLAGS */ -#ifdef HAVE_LCHOWN - {"lchown", edk2_lchown, METH_VARARGS, edk2_lchown__doc__}, -#endif /* HAVE_LCHOWN */ -#ifdef HAVE_CHROOT - {"chroot", edk2_chroot, METH_VARARGS, edk2_chroot__doc__}, -#endif -#ifdef HAVE_CTERMID - {"ctermid", edk2_ctermid, METH_NOARGS, edk2_ctermid__doc__}, -#endif -#ifdef HAVE_GETCWD - {"getcwd", edk2_getcwd, METH_NOARGS, edk2_getcwd__doc__}, -#ifdef Py_USING_UNICODE - {"getcwdu", edk2_getcwdu, METH_NOARGS, edk2_getcwdu__doc__}, -#endif -#endif -#ifdef HAVE_LINK - {"link", edk2_link, METH_VARARGS, edk2_link__doc__}, -#endif /* HAVE_LINK */ - {"listdir", edk2_listdir, METH_VARARGS, edk2_listdir__doc__}, - {"lstat", edk2_lstat, METH_VARARGS, edk2_lstat__doc__}, - {"mkdir", edk2_mkdir, METH_VARARGS, edk2_mkdir__doc__}, -#ifdef HAVE_NICE - {"nice", edk2_nice, METH_VARARGS, edk2_nice__doc__}, -#endif /* HAVE_NICE */ -#ifdef HAVE_READLINK - {"readlink", edk2_readlink, METH_VARARGS, edk2_readlink__doc__}, -#endif /* HAVE_READLINK */ - {"rename", edk2_rename, METH_VARARGS, edk2_rename__doc__}, - {"rmdir", edk2_rmdir, METH_VARARGS, edk2_rmdir__doc__}, - {"stat", edk2_stat, METH_VARARGS, edk2_stat__doc__}, - //{"stat_float_times", stat_float_times, METH_VARARGS, stat_float_times__doc__}, -#ifdef HAVE_SYMLINK - {"symlink", edk2_symlink, METH_VARARGS, edk2_symlink__doc__}, -#endif /* HAVE_SYMLINK */ -#ifdef HAVE_SYSTEM - {"system", edk2_system, METH_VARARGS, edk2_system__doc__}, -#endif - {"umask", edk2_umask, METH_VARARGS, edk2_umask__doc__}, -#ifdef HAVE_UNAME - {"uname", edk2_uname, METH_NOARGS, edk2_uname__doc__}, -#endif /* HAVE_UNAME */ - {"unlink", edk2_unlink, METH_VARARGS, edk2_unlink__doc__}, - {"remove", edk2_unlink, METH_VARARGS, edk2_remove__doc__}, - {"utime", edk2_utime, METH_VARARGS, edk2_utime__doc__}, -#ifdef HAVE_TIMES - {"times", edk2_times, METH_NOARGS, edk2_times__doc__}, -#endif /* HAVE_TIMES */ - {"_exit", edk2__exit, METH_VARARGS, edk2__exit__doc__}, -#ifdef HAVE_EXECV - {"execv", edk2_execv, METH_VARARGS, edk2_execv__doc__}, - {"execve", edk2_execve, METH_VARARGS, edk2_execve__doc__}, -#endif /* HAVE_EXECV */ -#ifdef HAVE_SPAWNV - {"spawnv", edk2_spawnv, METH_VARARGS, edk2_spawnv__doc__}, - {"spawnve", edk2_spawnve, METH_VARARGS, edk2_spawnve__doc__}, -#if defined(PYOS_OS2) - {"spawnvp", edk2_spawnvp, METH_VARARGS, edk2_spawnvp__doc__}, - {"spawnvpe", edk2_spawnvpe, METH_VARARGS, edk2_spawnvpe__doc__}, -#endif /* PYOS_OS2 */ -#endif /* HAVE_SPAWNV */ -#ifdef HAVE_FORK1 - {"fork1", edk2_fork1, METH_NOARGS, edk2_fork1__doc__}, -#endif /* HAVE_FORK1 */ -#ifdef HAVE_FORK - {"fork", edk2_fork, METH_NOARGS, edk2_fork__doc__}, -#endif /* HAVE_FORK */ -#if defined(HAVE_OPENPTY) || defined(HAVE__GETPTY) || defined(HAVE_DEV_PTMX) - {"openpty", edk2_openpty, METH_NOARGS, edk2_openpty__doc__}, -#endif /* HAVE_OPENPTY || HAVE__GETPTY || HAVE_DEV_PTMX */ -#ifdef HAVE_FORKPTY - {"forkpty", edk2_forkpty, METH_NOARGS, edk2_forkpty__doc__}, -#endif /* HAVE_FORKPTY */ - {"getpid", edk2_getpid, METH_NOARGS, edk2_getpid__doc__}, -#ifdef HAVE_GETPGRP - {"getpgrp", edk2_getpgrp, METH_NOARGS, edk2_getpgrp__doc__}, -#endif /* HAVE_GETPGRP */ -#ifdef HAVE_GETPPID - {"getppid", edk2_getppid, METH_NOARGS, edk2_getppid__doc__}, -#endif /* HAVE_GETPPID */ -#ifdef HAVE_GETLOGIN - {"getlogin", edk2_getlogin, METH_NOARGS, edk2_getlogin__doc__}, -#endif -#ifdef HAVE_KILL - {"kill", edk2_kill, METH_VARARGS, edk2_kill__doc__}, -#endif /* HAVE_KILL */ -#ifdef HAVE_KILLPG - {"killpg", edk2_killpg, METH_VARARGS, edk2_killpg__doc__}, -#endif /* HAVE_KILLPG */ -#ifdef HAVE_PLOCK - {"plock", edk2_plock, METH_VARARGS, edk2_plock__doc__}, -#endif /* HAVE_PLOCK */ -#ifdef HAVE_POPEN - {"popen", edk2_popen, METH_VARARGS, edk2_popen__doc__}, -#endif /* HAVE_POPEN */ -#ifdef HAVE_SETGROUPS - {"setgroups", edk2_setgroups, METH_O, edk2_setgroups__doc__}, -#endif /* HAVE_SETGROUPS */ -#ifdef HAVE_INITGROUPS - {"initgroups", edk2_initgroups, METH_VARARGS, edk2_initgroups__doc__}, -#endif /* HAVE_INITGROUPS */ -#ifdef HAVE_GETPGID - {"getpgid", edk2_getpgid, METH_VARARGS, edk2_getpgid__doc__}, -#endif /* HAVE_GETPGID */ -#ifdef HAVE_SETPGRP - {"setpgrp", edk2_setpgrp, METH_NOARGS, edk2_setpgrp__doc__}, -#endif /* HAVE_SETPGRP */ -#ifdef HAVE_WAIT - {"wait", edk2_wait, METH_NOARGS, edk2_wait__doc__}, -#endif /* HAVE_WAIT */ -#ifdef HAVE_WAIT3 - {"wait3", edk2_wait3, METH_VARARGS, edk2_wait3__doc__}, -#endif /* HAVE_WAIT3 */ -#ifdef HAVE_WAIT4 - {"wait4", edk2_wait4, METH_VARARGS, edk2_wait4__doc__}, -#endif /* HAVE_WAIT4 */ -#if defined(HAVE_WAITPID) || defined(HAVE_CWAIT) - {"waitpid", edk2_waitpid, METH_VARARGS, edk2_waitpid__doc__}, -#endif /* HAVE_WAITPID */ -#ifdef HAVE_GETSID - {"getsid", edk2_getsid, METH_VARARGS, edk2_getsid__doc__}, -#endif /* HAVE_GETSID */ -#ifdef HAVE_SETSID - {"setsid", edk2_setsid, METH_NOARGS, edk2_setsid__doc__}, -#endif /* HAVE_SETSID */ -#ifdef HAVE_SETPGID - {"setpgid", edk2_setpgid, METH_VARARGS, edk2_setpgid__doc__}, -#endif /* HAVE_SETPGID */ -#ifdef HAVE_TCGETPGRP - {"tcgetpgrp", edk2_tcgetpgrp, METH_VARARGS, edk2_tcgetpgrp__doc__}, -#endif /* HAVE_TCGETPGRP */ -#ifdef HAVE_TCSETPGRP - {"tcsetpgrp", edk2_tcsetpgrp, METH_VARARGS, edk2_tcsetpgrp__doc__}, -#endif /* HAVE_TCSETPGRP */ - {"open", edk2_open, METH_VARARGS, edk2_open__doc__}, - {"close", edk2_close, METH_VARARGS, edk2_close__doc__}, - {"closerange", edk2_closerange, METH_VARARGS, edk2_closerange__doc__}, - {"dup", edk2_dup, METH_VARARGS, edk2_dup__doc__}, - {"dup2", edk2_dup2, METH_VARARGS, edk2_dup2__doc__}, - {"lseek", edk2_lseek, METH_VARARGS, edk2_lseek__doc__}, - {"read", edk2_read, METH_VARARGS, edk2_read__doc__}, - {"write", edk2_write, METH_VARARGS, edk2_write__doc__}, - {"fstat", edk2_fstat, METH_VARARGS, edk2_fstat__doc__}, - {"fdopen", edk2_fdopen, METH_VARARGS, edk2_fdopen__doc__}, - {"isatty", edk2_isatty, METH_VARARGS, edk2_isatty__doc__}, -#ifdef HAVE_PIPE - {"pipe", edk2_pipe, METH_NOARGS, edk2_pipe__doc__}, -#endif -#ifdef HAVE_MKFIFO - {"mkfifo", edk2_mkfifo, METH_VARARGS, edk2_mkfifo__doc__}, -#endif -#if defined(HAVE_MKNOD) && defined(HAVE_MAKEDEV) - {"mknod", edk2_mknod, METH_VARARGS, edk2_mknod__doc__}, -#endif -#ifdef HAVE_DEVICE_MACROS - {"major", edk2_major, METH_VARARGS, edk2_major__doc__}, - {"minor", edk2_minor, METH_VARARGS, edk2_minor__doc__}, - {"makedev", edk2_makedev, METH_VARARGS, edk2_makedev__doc__}, -#endif -#ifdef HAVE_FTRUNCATE - {"ftruncate", edk2_ftruncate, METH_VARARGS, edk2_ftruncate__doc__}, -#endif -#ifdef HAVE_PUTENV - {"putenv", edk2_putenv, METH_VARARGS, edk2_putenv__doc__}, -#endif -#ifdef HAVE_UNSETENV - {"unsetenv", edk2_unsetenv, METH_VARARGS, edk2_unsetenv__doc__}, -#endif - {"strerror", edk2_strerror, METH_VARARGS, edk2_strerror__doc__}, -#ifdef HAVE_FCHDIR - {"fchdir", edk2_fchdir, METH_O, edk2_fchdir__doc__}, -#endif -#ifdef HAVE_FSYNC - {"fsync", edk2_fsync, METH_O, edk2_fsync__doc__}, -#endif -#ifdef HAVE_FDATASYNC - {"fdatasync", edk2_fdatasync, METH_O, edk2_fdatasync__doc__}, -#endif -#ifdef HAVE_SYS_WAIT_H -#ifdef WCOREDUMP - {"WCOREDUMP", edk2_WCOREDUMP, METH_VARARGS, edk2_WCOREDUMP__doc__}, -#endif /* WCOREDUMP */ -#ifdef WIFCONTINUED - {"WIFCONTINUED",edk2_WIFCONTINUED, METH_VARARGS, edk2_WIFCONTINUED__doc__}, -#endif /* WIFCONTINUED */ -#ifdef WIFSTOPPED - {"WIFSTOPPED", edk2_WIFSTOPPED, METH_VARARGS, edk2_WIFSTOPPED__doc__}, -#endif /* WIFSTOPPED */ -#ifdef WIFSIGNALED - {"WIFSIGNALED", edk2_WIFSIGNALED, METH_VARARGS, edk2_WIFSIGNALED__doc__}, -#endif /* WIFSIGNALED */ -#ifdef WIFEXITED - {"WIFEXITED", edk2_WIFEXITED, METH_VARARGS, edk2_WIFEXITED__doc__}, -#endif /* WIFEXITED */ -#ifdef WEXITSTATUS - {"WEXITSTATUS", edk2_WEXITSTATUS, METH_VARARGS, edk2_WEXITSTATUS__doc__}, -#endif /* WEXITSTATUS */ -#ifdef WTERMSIG - {"WTERMSIG", edk2_WTERMSIG, METH_VARARGS, edk2_WTERMSIG__doc__}, -#endif /* WTERMSIG */ -#ifdef WSTOPSIG - {"WSTOPSIG", edk2_WSTOPSIG, METH_VARARGS, edk2_WSTOPSIG__doc__}, -#endif /* WSTOPSIG */ -#endif /* HAVE_SYS_WAIT_H */ -#if defined(HAVE_FSTATVFS) && defined(HAVE_SYS_STATVFS_H) - {"fstatvfs", edk2_fstatvfs, METH_VARARGS, edk2_fstatvfs__doc__}, -#endif -#if defined(HAVE_STATVFS) && defined(HAVE_SYS_STATVFS_H) - {"statvfs", edk2_statvfs, METH_VARARGS, edk2_statvfs__doc__}, -#endif -#ifdef HAVE_TMPFILE - {"tmpfile", edk2_tmpfile, METH_NOARGS, edk2_tmpfile__doc__}, -#endif -#ifdef HAVE_TEMPNAM - {"tempnam", edk2_tempnam, METH_VARARGS, edk2_tempnam__doc__}, -#endif -#ifdef HAVE_TMPNAM - {"tmpnam", edk2_tmpnam, METH_NOARGS, edk2_tmpnam__doc__}, -#endif -#ifdef HAVE_CONFSTR - {"confstr", edk2_confstr, METH_VARARGS, edk2_confstr__doc__}, -#endif -#ifdef HAVE_SYSCONF - {"sysconf", edk2_sysconf, METH_VARARGS, edk2_sysconf__doc__}, -#endif -#ifdef HAVE_FPATHCONF - {"fpathconf", edk2_fpathconf, METH_VARARGS, edk2_fpathconf__doc__}, -#endif -#ifdef HAVE_PATHCONF - {"pathconf", edk2_pathconf, METH_VARARGS, edk2_pathconf__doc__}, -#endif - {"abort", edk2_abort, METH_NOARGS, edk2_abort__doc__}, - - {NULL, NULL} /* Sentinel */ -}; - - -static int -ins(PyObject *module, char *symbol, long value) -{ - return PyModule_AddIntConstant(module, symbol, value); -} - -static int -all_ins(PyObject *d) -{ -#ifdef F_OK - if (ins(d, "F_OK", (long)F_OK)) return -1; -#endif -#ifdef R_OK - if (ins(d, "R_OK", (long)R_OK)) return -1; -#endif -#ifdef W_OK - if (ins(d, "W_OK", (long)W_OK)) return -1; -#endif -#ifdef X_OK - if (ins(d, "X_OK", (long)X_OK)) return -1; -#endif -#ifdef NGROUPS_MAX - if (ins(d, "NGROUPS_MAX", (long)NGROUPS_MAX)) return -1; -#endif -#ifdef TMP_MAX - if (ins(d, "TMP_MAX", (long)TMP_MAX)) return -1; -#endif -#ifdef WCONTINUED - if (ins(d, "WCONTINUED", (long)WCONTINUED)) return -1; -#endif -#ifdef WNOHANG - if (ins(d, "WNOHANG", (long)WNOHANG)) return -1; -#endif -#ifdef WUNTRACED - if (ins(d, "WUNTRACED", (long)WUNTRACED)) return -1; -#endif -#ifdef O_RDONLY - if (ins(d, "O_RDONLY", (long)O_RDONLY)) return -1; -#endif -#ifdef O_WRONLY - if (ins(d, "O_WRONLY", (long)O_WRONLY)) return -1; -#endif -#ifdef O_RDWR - if (ins(d, "O_RDWR", (long)O_RDWR)) return -1; -#endif -#ifdef O_NDELAY - if (ins(d, "O_NDELAY", (long)O_NDELAY)) return -1; -#endif -#ifdef O_NONBLOCK - if (ins(d, "O_NONBLOCK", (long)O_NONBLOCK)) return -1; -#endif -#ifdef O_APPEND - if (ins(d, "O_APPEND", (long)O_APPEND)) return -1; -#endif -#ifdef O_DSYNC - if (ins(d, "O_DSYNC", (long)O_DSYNC)) return -1; -#endif -#ifdef O_RSYNC - if (ins(d, "O_RSYNC", (long)O_RSYNC)) return -1; -#endif -#ifdef O_SYNC - if (ins(d, "O_SYNC", (long)O_SYNC)) return -1; -#endif -#ifdef O_NOCTTY - if (ins(d, "O_NOCTTY", (long)O_NOCTTY)) return -1; -#endif -#ifdef O_CREAT - if (ins(d, "O_CREAT", (long)O_CREAT)) return -1; -#endif -#ifdef O_EXCL - if (ins(d, "O_EXCL", (long)O_EXCL)) return -1; -#endif -#ifdef O_TRUNC - if (ins(d, "O_TRUNC", (long)O_TRUNC)) return -1; -#endif -#ifdef O_BINARY - if (ins(d, "O_BINARY", (long)O_BINARY)) return -1; -#endif -#ifdef O_TEXT - if (ins(d, "O_TEXT", (long)O_TEXT)) return -1; -#endif -#ifdef O_LARGEFILE - if (ins(d, "O_LARGEFILE", (long)O_LARGEFILE)) return -1; -#endif -#ifdef O_SHLOCK - if (ins(d, "O_SHLOCK", (long)O_SHLOCK)) return -1; -#endif -#ifdef O_EXLOCK - if (ins(d, "O_EXLOCK", (long)O_EXLOCK)) return -1; -#endif - -/* MS Windows */ -#ifdef O_NOINHERIT - /* Don't inherit in child processes. */ - if (ins(d, "O_NOINHERIT", (long)O_NOINHERIT)) return -1; -#endif -#ifdef _O_SHORT_LIVED - /* Optimize for short life (keep in memory). */ - /* MS forgot to define this one with a non-underscore form too. */ - if (ins(d, "O_SHORT_LIVED", (long)_O_SHORT_LIVED)) return -1; -#endif -#ifdef O_TEMPORARY - /* Automatically delete when last handle is closed. */ - if (ins(d, "O_TEMPORARY", (long)O_TEMPORARY)) return -1; -#endif -#ifdef O_RANDOM - /* Optimize for random access. */ - if (ins(d, "O_RANDOM", (long)O_RANDOM)) return -1; -#endif -#ifdef O_SEQUENTIAL - /* Optimize for sequential access. */ - if (ins(d, "O_SEQUENTIAL", (long)O_SEQUENTIAL)) return -1; -#endif - -/* GNU extensions. */ -#ifdef O_ASYNC - /* Send a SIGIO signal whenever input or output - becomes available on file descriptor */ - if (ins(d, "O_ASYNC", (long)O_ASYNC)) return -1; -#endif -#ifdef O_DIRECT - /* Direct disk access. */ - if (ins(d, "O_DIRECT", (long)O_DIRECT)) return -1; -#endif -#ifdef O_DIRECTORY - /* Must be a directory. */ - if (ins(d, "O_DIRECTORY", (long)O_DIRECTORY)) return -1; -#endif -#ifdef O_NOFOLLOW - /* Do not follow links. */ - if (ins(d, "O_NOFOLLOW", (long)O_NOFOLLOW)) return -1; -#endif -#ifdef O_NOATIME - /* Do not update the access time. */ - if (ins(d, "O_NOATIME", (long)O_NOATIME)) return -1; -#endif - - /* These come from sysexits.h */ -#ifdef EX_OK - if (ins(d, "EX_OK", (long)EX_OK)) return -1; -#endif /* EX_OK */ -#ifdef EX_USAGE - if (ins(d, "EX_USAGE", (long)EX_USAGE)) return -1; -#endif /* EX_USAGE */ -#ifdef EX_DATAERR - if (ins(d, "EX_DATAERR", (long)EX_DATAERR)) return -1; -#endif /* EX_DATAERR */ -#ifdef EX_NOINPUT - if (ins(d, "EX_NOINPUT", (long)EX_NOINPUT)) return -1; -#endif /* EX_NOINPUT */ -#ifdef EX_NOUSER - if (ins(d, "EX_NOUSER", (long)EX_NOUSER)) return -1; -#endif /* EX_NOUSER */ -#ifdef EX_NOHOST - if (ins(d, "EX_NOHOST", (long)EX_NOHOST)) return -1; -#endif /* EX_NOHOST */ -#ifdef EX_UNAVAILABLE - if (ins(d, "EX_UNAVAILABLE", (long)EX_UNAVAILABLE)) return -1; -#endif /* EX_UNAVAILABLE */ -#ifdef EX_SOFTWARE - if (ins(d, "EX_SOFTWARE", (long)EX_SOFTWARE)) return -1; -#endif /* EX_SOFTWARE */ -#ifdef EX_OSERR - if (ins(d, "EX_OSERR", (long)EX_OSERR)) return -1; -#endif /* EX_OSERR */ -#ifdef EX_OSFILE - if (ins(d, "EX_OSFILE", (long)EX_OSFILE)) return -1; -#endif /* EX_OSFILE */ -#ifdef EX_CANTCREAT - if (ins(d, "EX_CANTCREAT", (long)EX_CANTCREAT)) return -1; -#endif /* EX_CANTCREAT */ -#ifdef EX_IOERR - if (ins(d, "EX_IOERR", (long)EX_IOERR)) return -1; -#endif /* EX_IOERR */ -#ifdef EX_TEMPFAIL - if (ins(d, "EX_TEMPFAIL", (long)EX_TEMPFAIL)) return -1; -#endif /* EX_TEMPFAIL */ -#ifdef EX_PROTOCOL - if (ins(d, "EX_PROTOCOL", (long)EX_PROTOCOL)) return -1; -#endif /* EX_PROTOCOL */ -#ifdef EX_NOPERM - if (ins(d, "EX_NOPERM", (long)EX_NOPERM)) return -1; -#endif /* EX_NOPERM */ -#ifdef EX_CONFIG - if (ins(d, "EX_CONFIG", (long)EX_CONFIG)) return -1; -#endif /* EX_CONFIG */ -#ifdef EX_NOTFOUND - if (ins(d, "EX_NOTFOUND", (long)EX_NOTFOUND)) return -1; -#endif /* EX_NOTFOUND */ - -#ifdef HAVE_SPAWNV - if (ins(d, "P_WAIT", (long)_P_WAIT)) return -1; - if (ins(d, "P_NOWAIT", (long)_P_NOWAIT)) return -1; - if (ins(d, "P_OVERLAY", (long)_OLD_P_OVERLAY)) return -1; - if (ins(d, "P_NOWAITO", (long)_P_NOWAITO)) return -1; - if (ins(d, "P_DETACH", (long)_P_DETACH)) return -1; -#endif - return 0; -} - -#define INITFUNC initedk2 -#define MODNAME "edk2" - -PyMODINIT_FUNC -INITFUNC(void) -{ - PyObject *m; - -#ifndef UEFI_C_SOURCE - PyObject *v; -#endif - - m = Py_InitModule3(MODNAME, - edk2_methods, - edk2__doc__); - if (m == NULL) - return; - -#ifndef UEFI_C_SOURCE - /* Initialize environ dictionary */ - v = convertenviron(); - Py_XINCREF(v); - if (v == NULL || PyModule_AddObject(m, "environ", v) != 0) - return; - Py_DECREF(v); -#endif /* UEFI_C_SOURCE */ - - if (all_ins(m)) - return; - - Py_INCREF(PyExc_OSError); - PyModule_AddObject(m, "error", PyExc_OSError); - -#ifdef HAVE_PUTENV - if (edk2_putenv_garbage == NULL) - edk2_putenv_garbage = PyDict_New(); -#endif - - if (!initialized) { - stat_result_desc.name = MODNAME ".stat_result"; - stat_result_desc.fields[2].name = PyStructSequence_UnnamedField; - stat_result_desc.fields[3].name = PyStructSequence_UnnamedField; - stat_result_desc.fields[4].name = PyStructSequence_UnnamedField; - PyStructSequence_InitType(&StatResultType, &stat_result_desc); - structseq_new = StatResultType.tp_new; - StatResultType.tp_new = statresult_new; - - //statvfs_result_desc.name = MODNAME ".statvfs_result"; - //PyStructSequence_InitType(&StatVFSResultType, &statvfs_result_desc); -#ifdef NEED_TICKS_PER_SECOND -# if defined(HAVE_SYSCONF) && defined(_SC_CLK_TCK) - ticks_per_second = sysconf(_SC_CLK_TCK); -# elif defined(HZ) - ticks_per_second = HZ; -# else - ticks_per_second = 60; /* magic fallback value; may be bogus */ -# endif -#endif - } - Py_INCREF((PyObject*) &StatResultType); - PyModule_AddObject(m, "stat_result", (PyObject*) &StatResultType); - //Py_INCREF((PyObject*) &StatVFSResultType); - //PyModule_AddObject(m, "statvfs_result", - // (PyObject*) &StatVFSResultType); - initialized = 1; - -} - -#ifdef __cplusplus -} -#endif - - diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/errnomodule.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/errnomodule.c deleted file mode 100644 index 615af2c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/errnomodule.c +++ /dev/null @@ -1,844 +0,0 @@ -/* Errno module - - Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -*/ - -#include "Python.h" - -/* Windows socket errors (WSA*) */ -#ifdef MS_WINDOWS -#include -#endif - -/* - * Pull in the system error definitions - */ - -static PyMethodDef errno_methods[] = { - {NULL, NULL} -}; - -/* Helper function doing the dictionary inserting */ - -static void -_inscode(PyObject *d, PyObject *de, char *name, int code) -{ - PyObject *u = PyString_FromString(name); - PyObject *v = PyInt_FromLong((long) code); - - /* Don't bother checking for errors; they'll be caught at the end - * of the module initialization function by the caller of - * initerrno(). - */ - if (u && v) { - /* insert in modules dict */ - PyDict_SetItem(d, u, v); - /* insert in errorcode dict */ - PyDict_SetItem(de, v, u); - } - Py_XDECREF(u); - Py_XDECREF(v); -} - -PyDoc_STRVAR(errno__doc__, -"This module makes available standard errno system symbols.\n\ -\n\ -The value of each symbol is the corresponding integer value,\n\ -e.g., on most systems, errno.ENOENT equals the integer 2.\n\ -\n\ -The dictionary errno.errorcode maps numeric codes to symbol names,\n\ -e.g., errno.errorcode[2] could be the string 'ENOENT'.\n\ -\n\ -Symbols that are not relevant to the underlying system are not defined.\n\ -\n\ -To map error codes to error messages, use the function os.strerror(),\n\ -e.g. os.strerror(2) could return 'No such file or directory'."); - -PyMODINIT_FUNC -initerrno(void) -{ - PyObject *m, *d, *de; - m = Py_InitModule3("errno", errno_methods, errno__doc__); - if (m == NULL) - return; - d = PyModule_GetDict(m); - de = PyDict_New(); - if (!d || !de || PyDict_SetItemString(d, "errorcode", de) < 0) - return; - -/* Macro so I don't have to edit each and every line below... */ -#define inscode(d, ds, de, name, code, comment) _inscode(d, de, name, code) - - /* - * The names and comments are borrowed from linux/include/errno.h, - * which should be pretty all-inclusive - */ - -#ifdef ENODEV - inscode(d, ds, de, "ENODEV", ENODEV, "No such device"); -#endif -#ifdef ENOCSI - inscode(d, ds, de, "ENOCSI", ENOCSI, "No CSI structure available"); -#endif -#ifdef EHOSTUNREACH - inscode(d, ds, de, "EHOSTUNREACH", EHOSTUNREACH, "No route to host"); -#else -#ifdef WSAEHOSTUNREACH - inscode(d, ds, de, "EHOSTUNREACH", WSAEHOSTUNREACH, "No route to host"); -#endif -#endif -#ifdef ENOMSG - inscode(d, ds, de, "ENOMSG", ENOMSG, "No message of desired type"); -#endif -#ifdef EUCLEAN - inscode(d, ds, de, "EUCLEAN", EUCLEAN, "Structure needs cleaning"); -#endif -#ifdef EL2NSYNC - inscode(d, ds, de, "EL2NSYNC", EL2NSYNC, "Level 2 not synchronized"); -#endif -#ifdef EL2HLT - inscode(d, ds, de, "EL2HLT", EL2HLT, "Level 2 halted"); -#endif -#ifdef ENODATA - inscode(d, ds, de, "ENODATA", ENODATA, "No data available"); -#endif -#ifdef ENOTBLK - inscode(d, ds, de, "ENOTBLK", ENOTBLK, "Block device required"); -#endif -#ifdef ENOSYS - inscode(d, ds, de, "ENOSYS", ENOSYS, "Function not implemented"); -#endif -#ifdef EPIPE - inscode(d, ds, de, "EPIPE", EPIPE, "Broken pipe"); -#endif -#ifdef EINVAL - inscode(d, ds, de, "EINVAL", EINVAL, "Invalid argument"); -#else -#ifdef WSAEINVAL - inscode(d, ds, de, "EINVAL", WSAEINVAL, "Invalid argument"); -#endif -#endif -#ifdef EOVERFLOW - inscode(d, ds, de, "EOVERFLOW", EOVERFLOW, "Value too large for defined data type"); -#endif -#ifdef EADV - inscode(d, ds, de, "EADV", EADV, "Advertise error"); -#endif -#ifdef EINTR - inscode(d, ds, de, "EINTR", EINTR, "Interrupted system call"); -#else -#ifdef WSAEINTR - inscode(d, ds, de, "EINTR", WSAEINTR, "Interrupted system call"); -#endif -#endif -#ifdef EUSERS - inscode(d, ds, de, "EUSERS", EUSERS, "Too many users"); -#else -#ifdef WSAEUSERS - inscode(d, ds, de, "EUSERS", WSAEUSERS, "Too many users"); -#endif -#endif -#ifdef ENOTEMPTY - inscode(d, ds, de, "ENOTEMPTY", ENOTEMPTY, "Directory not empty"); -#else -#ifdef WSAENOTEMPTY - inscode(d, ds, de, "ENOTEMPTY", WSAENOTEMPTY, "Directory not empty"); -#endif -#endif -#ifdef ENOBUFS - inscode(d, ds, de, "ENOBUFS", ENOBUFS, "No buffer space available"); -#else -#ifdef WSAENOBUFS - inscode(d, ds, de, "ENOBUFS", WSAENOBUFS, "No buffer space available"); -#endif -#endif -#ifdef EPROTO - inscode(d, ds, de, "EPROTO", EPROTO, "Protocol error"); -#endif -#ifdef EREMOTE - inscode(d, ds, de, "EREMOTE", EREMOTE, "Object is remote"); -#else -#ifdef WSAEREMOTE - inscode(d, ds, de, "EREMOTE", WSAEREMOTE, "Object is remote"); -#endif -#endif -#ifdef ENAVAIL - inscode(d, ds, de, "ENAVAIL", ENAVAIL, "No XENIX semaphores available"); -#endif -#ifdef ECHILD - inscode(d, ds, de, "ECHILD", ECHILD, "No child processes"); -#endif -#ifdef ELOOP - inscode(d, ds, de, "ELOOP", ELOOP, "Too many symbolic links encountered"); -#else -#ifdef WSAELOOP - inscode(d, ds, de, "ELOOP", WSAELOOP, "Too many symbolic links encountered"); -#endif -#endif -#ifdef EXDEV - inscode(d, ds, de, "EXDEV", EXDEV, "Cross-device link"); -#endif -#ifdef E2BIG - inscode(d, ds, de, "E2BIG", E2BIG, "Arg list too long"); -#endif -#ifdef ESRCH - inscode(d, ds, de, "ESRCH", ESRCH, "No such process"); -#endif -#ifdef EMSGSIZE - inscode(d, ds, de, "EMSGSIZE", EMSGSIZE, "Message too long"); -#else -#ifdef WSAEMSGSIZE - inscode(d, ds, de, "EMSGSIZE", WSAEMSGSIZE, "Message too long"); -#endif -#endif -#ifdef EAFNOSUPPORT - inscode(d, ds, de, "EAFNOSUPPORT", EAFNOSUPPORT, "Address family not supported by protocol"); -#else -#ifdef WSAEAFNOSUPPORT - inscode(d, ds, de, "EAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol"); -#endif -#endif -#ifdef EBADR - inscode(d, ds, de, "EBADR", EBADR, "Invalid request descriptor"); -#endif -#ifdef EHOSTDOWN - inscode(d, ds, de, "EHOSTDOWN", EHOSTDOWN, "Host is down"); -#else -#ifdef WSAEHOSTDOWN - inscode(d, ds, de, "EHOSTDOWN", WSAEHOSTDOWN, "Host is down"); -#endif -#endif -#ifdef EPFNOSUPPORT - inscode(d, ds, de, "EPFNOSUPPORT", EPFNOSUPPORT, "Protocol family not supported"); -#else -#ifdef WSAEPFNOSUPPORT - inscode(d, ds, de, "EPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported"); -#endif -#endif -#ifdef ENOPROTOOPT - inscode(d, ds, de, "ENOPROTOOPT", ENOPROTOOPT, "Protocol not available"); -#else -#ifdef WSAENOPROTOOPT - inscode(d, ds, de, "ENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available"); -#endif -#endif -#ifdef EBUSY - inscode(d, ds, de, "EBUSY", EBUSY, "Device or resource busy"); -#endif -#ifdef EWOULDBLOCK - inscode(d, ds, de, "EWOULDBLOCK", EWOULDBLOCK, "Operation would block"); -#else -#ifdef WSAEWOULDBLOCK - inscode(d, ds, de, "EWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block"); -#endif -#endif -#ifdef EBADFD - inscode(d, ds, de, "EBADFD", EBADFD, "File descriptor in bad state"); -#endif -#ifdef EDOTDOT - inscode(d, ds, de, "EDOTDOT", EDOTDOT, "RFS specific error"); -#endif -#ifdef EISCONN - inscode(d, ds, de, "EISCONN", EISCONN, "Transport endpoint is already connected"); -#else -#ifdef WSAEISCONN - inscode(d, ds, de, "EISCONN", WSAEISCONN, "Transport endpoint is already connected"); -#endif -#endif -#ifdef ENOANO - inscode(d, ds, de, "ENOANO", ENOANO, "No anode"); -#endif -#ifdef ESHUTDOWN - inscode(d, ds, de, "ESHUTDOWN", ESHUTDOWN, "Cannot send after transport endpoint shutdown"); -#else -#ifdef WSAESHUTDOWN - inscode(d, ds, de, "ESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown"); -#endif -#endif -#ifdef ECHRNG - inscode(d, ds, de, "ECHRNG", ECHRNG, "Channel number out of range"); -#endif -#ifdef ELIBBAD - inscode(d, ds, de, "ELIBBAD", ELIBBAD, "Accessing a corrupted shared library"); -#endif -#ifdef ENONET - inscode(d, ds, de, "ENONET", ENONET, "Machine is not on the network"); -#endif -#ifdef EBADE - inscode(d, ds, de, "EBADE", EBADE, "Invalid exchange"); -#endif -#ifdef EBADF - inscode(d, ds, de, "EBADF", EBADF, "Bad file number"); -#else -#ifdef WSAEBADF - inscode(d, ds, de, "EBADF", WSAEBADF, "Bad file number"); -#endif -#endif -#ifdef EMULTIHOP - inscode(d, ds, de, "EMULTIHOP", EMULTIHOP, "Multihop attempted"); -#endif -#ifdef EIO - inscode(d, ds, de, "EIO", EIO, "I/O error"); -#endif -#ifdef EUNATCH - inscode(d, ds, de, "EUNATCH", EUNATCH, "Protocol driver not attached"); -#endif -#ifdef EPROTOTYPE - inscode(d, ds, de, "EPROTOTYPE", EPROTOTYPE, "Protocol wrong type for socket"); -#else -#ifdef WSAEPROTOTYPE - inscode(d, ds, de, "EPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket"); -#endif -#endif -#ifdef ENOSPC - inscode(d, ds, de, "ENOSPC", ENOSPC, "No space left on device"); -#endif -#ifdef ENOEXEC - inscode(d, ds, de, "ENOEXEC", ENOEXEC, "Exec format error"); -#endif -#ifdef EALREADY - inscode(d, ds, de, "EALREADY", EALREADY, "Operation already in progress"); -#else -#ifdef WSAEALREADY - inscode(d, ds, de, "EALREADY", WSAEALREADY, "Operation already in progress"); -#endif -#endif -#ifdef ENETDOWN - inscode(d, ds, de, "ENETDOWN", ENETDOWN, "Network is down"); -#else -#ifdef WSAENETDOWN - inscode(d, ds, de, "ENETDOWN", WSAENETDOWN, "Network is down"); -#endif -#endif -#ifdef ENOTNAM - inscode(d, ds, de, "ENOTNAM", ENOTNAM, "Not a XENIX named type file"); -#endif -#ifdef EACCES - inscode(d, ds, de, "EACCES", EACCES, "Permission denied"); -#else -#ifdef WSAEACCES - inscode(d, ds, de, "EACCES", WSAEACCES, "Permission denied"); -#endif -#endif -#ifdef ELNRNG - inscode(d, ds, de, "ELNRNG", ELNRNG, "Link number out of range"); -#endif -#ifdef EILSEQ - inscode(d, ds, de, "EILSEQ", EILSEQ, "Illegal byte sequence"); -#endif -#ifdef ENOTDIR - inscode(d, ds, de, "ENOTDIR", ENOTDIR, "Not a directory"); -#endif -#ifdef ENOTUNIQ - inscode(d, ds, de, "ENOTUNIQ", ENOTUNIQ, "Name not unique on network"); -#endif -#ifdef EPERM - inscode(d, ds, de, "EPERM", EPERM, "Operation not permitted"); -#endif -#ifdef EDOM - inscode(d, ds, de, "EDOM", EDOM, "Math argument out of domain of func"); -#endif -#ifdef EXFULL - inscode(d, ds, de, "EXFULL", EXFULL, "Exchange full"); -#endif -#ifdef ECONNREFUSED - inscode(d, ds, de, "ECONNREFUSED", ECONNREFUSED, "Connection refused"); -#else -#ifdef WSAECONNREFUSED - inscode(d, ds, de, "ECONNREFUSED", WSAECONNREFUSED, "Connection refused"); -#endif -#endif -#ifdef EISDIR - inscode(d, ds, de, "EISDIR", EISDIR, "Is a directory"); -#endif -#ifdef EPROTONOSUPPORT - inscode(d, ds, de, "EPROTONOSUPPORT", EPROTONOSUPPORT, "Protocol not supported"); -#else -#ifdef WSAEPROTONOSUPPORT - inscode(d, ds, de, "EPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported"); -#endif -#endif -#ifdef EROFS - inscode(d, ds, de, "EROFS", EROFS, "Read-only file system"); -#endif -#ifdef EADDRNOTAVAIL - inscode(d, ds, de, "EADDRNOTAVAIL", EADDRNOTAVAIL, "Cannot assign requested address"); -#else -#ifdef WSAEADDRNOTAVAIL - inscode(d, ds, de, "EADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address"); -#endif -#endif -#ifdef EIDRM - inscode(d, ds, de, "EIDRM", EIDRM, "Identifier removed"); -#endif -#ifdef ECOMM - inscode(d, ds, de, "ECOMM", ECOMM, "Communication error on send"); -#endif -#ifdef ESRMNT - inscode(d, ds, de, "ESRMNT", ESRMNT, "Srmount error"); -#endif -#ifdef EREMOTEIO - inscode(d, ds, de, "EREMOTEIO", EREMOTEIO, "Remote I/O error"); -#endif -#ifdef EL3RST - inscode(d, ds, de, "EL3RST", EL3RST, "Level 3 reset"); -#endif -#ifdef EBADMSG - inscode(d, ds, de, "EBADMSG", EBADMSG, "Not a data message"); -#endif -#ifdef ENFILE - inscode(d, ds, de, "ENFILE", ENFILE, "File table overflow"); -#endif -#ifdef ELIBMAX - inscode(d, ds, de, "ELIBMAX", ELIBMAX, "Attempting to link in too many shared libraries"); -#endif -#ifdef ESPIPE - inscode(d, ds, de, "ESPIPE", ESPIPE, "Illegal seek"); -#endif -#ifdef ENOLINK - inscode(d, ds, de, "ENOLINK", ENOLINK, "Link has been severed"); -#endif -#ifdef ENETRESET - inscode(d, ds, de, "ENETRESET", ENETRESET, "Network dropped connection because of reset"); -#else -#ifdef WSAENETRESET - inscode(d, ds, de, "ENETRESET", WSAENETRESET, "Network dropped connection because of reset"); -#endif -#endif -#ifdef ETIMEDOUT - inscode(d, ds, de, "ETIMEDOUT", ETIMEDOUT, "Connection timed out"); -#else -#ifdef WSAETIMEDOUT - inscode(d, ds, de, "ETIMEDOUT", WSAETIMEDOUT, "Connection timed out"); -#endif -#endif -#ifdef ENOENT - inscode(d, ds, de, "ENOENT", ENOENT, "No such file or directory"); -#endif -#ifdef EEXIST - inscode(d, ds, de, "EEXIST", EEXIST, "File exists"); -#endif -#ifdef EDQUOT - inscode(d, ds, de, "EDQUOT", EDQUOT, "Quota exceeded"); -#else -#ifdef WSAEDQUOT - inscode(d, ds, de, "EDQUOT", WSAEDQUOT, "Quota exceeded"); -#endif -#endif -#ifdef ENOSTR - inscode(d, ds, de, "ENOSTR", ENOSTR, "Device not a stream"); -#endif -#ifdef EBADSLT - inscode(d, ds, de, "EBADSLT", EBADSLT, "Invalid slot"); -#endif -#ifdef EBADRQC - inscode(d, ds, de, "EBADRQC", EBADRQC, "Invalid request code"); -#endif -#ifdef ELIBACC - inscode(d, ds, de, "ELIBACC", ELIBACC, "Can not access a needed shared library"); -#endif -#ifdef EFAULT - inscode(d, ds, de, "EFAULT", EFAULT, "Bad address"); -#else -#ifdef WSAEFAULT - inscode(d, ds, de, "EFAULT", WSAEFAULT, "Bad address"); -#endif -#endif -#ifdef EFBIG - inscode(d, ds, de, "EFBIG", EFBIG, "File too large"); -#endif -#ifdef EDEADLK - inscode(d, ds, de, "EDEADLK", EDEADLK, "Resource deadlock would occur"); -#endif -#ifdef ENOTCONN - inscode(d, ds, de, "ENOTCONN", ENOTCONN, "Transport endpoint is not connected"); -#else -#ifdef WSAENOTCONN - inscode(d, ds, de, "ENOTCONN", WSAENOTCONN, "Transport endpoint is not connected"); -#endif -#endif -#ifdef EDESTADDRREQ - inscode(d, ds, de, "EDESTADDRREQ", EDESTADDRREQ, "Destination address required"); -#else -#ifdef WSAEDESTADDRREQ - inscode(d, ds, de, "EDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required"); -#endif -#endif -#ifdef ELIBSCN - inscode(d, ds, de, "ELIBSCN", ELIBSCN, ".lib section in a.out corrupted"); -#endif -#ifdef ENOLCK - inscode(d, ds, de, "ENOLCK", ENOLCK, "No record locks available"); -#endif -#ifdef EISNAM - inscode(d, ds, de, "EISNAM", EISNAM, "Is a named type file"); -#endif -#ifdef ECONNABORTED - inscode(d, ds, de, "ECONNABORTED", ECONNABORTED, "Software caused connection abort"); -#else -#ifdef WSAECONNABORTED - inscode(d, ds, de, "ECONNABORTED", WSAECONNABORTED, "Software caused connection abort"); -#endif -#endif -#ifdef ENETUNREACH - inscode(d, ds, de, "ENETUNREACH", ENETUNREACH, "Network is unreachable"); -#else -#ifdef WSAENETUNREACH - inscode(d, ds, de, "ENETUNREACH", WSAENETUNREACH, "Network is unreachable"); -#endif -#endif -#ifdef ESTALE - inscode(d, ds, de, "ESTALE", ESTALE, "Stale NFS file handle"); -#else -#ifdef WSAESTALE - inscode(d, ds, de, "ESTALE", WSAESTALE, "Stale NFS file handle"); -#endif -#endif -#ifdef ENOSR - inscode(d, ds, de, "ENOSR", ENOSR, "Out of streams resources"); -#endif -#ifdef ENOMEM - inscode(d, ds, de, "ENOMEM", ENOMEM, "Out of memory"); -#endif -#ifdef ENOTSOCK - inscode(d, ds, de, "ENOTSOCK", ENOTSOCK, "Socket operation on non-socket"); -#else -#ifdef WSAENOTSOCK - inscode(d, ds, de, "ENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket"); -#endif -#endif -#ifdef ESTRPIPE - inscode(d, ds, de, "ESTRPIPE", ESTRPIPE, "Streams pipe error"); -#endif -#ifdef EMLINK - inscode(d, ds, de, "EMLINK", EMLINK, "Too many links"); -#endif -#ifdef ERANGE - inscode(d, ds, de, "ERANGE", ERANGE, "Math result not representable"); -#endif -#ifdef ELIBEXEC - inscode(d, ds, de, "ELIBEXEC", ELIBEXEC, "Cannot exec a shared library directly"); -#endif -#ifdef EL3HLT - inscode(d, ds, de, "EL3HLT", EL3HLT, "Level 3 halted"); -#endif -#ifdef ECONNRESET - inscode(d, ds, de, "ECONNRESET", ECONNRESET, "Connection reset by peer"); -#else -#ifdef WSAECONNRESET - inscode(d, ds, de, "ECONNRESET", WSAECONNRESET, "Connection reset by peer"); -#endif -#endif -#ifdef EADDRINUSE - inscode(d, ds, de, "EADDRINUSE", EADDRINUSE, "Address already in use"); -#else -#ifdef WSAEADDRINUSE - inscode(d, ds, de, "EADDRINUSE", WSAEADDRINUSE, "Address already in use"); -#endif -#endif -#ifdef EOPNOTSUPP - inscode(d, ds, de, "EOPNOTSUPP", EOPNOTSUPP, "Operation not supported on transport endpoint"); -#else -#ifdef WSAEOPNOTSUPP - inscode(d, ds, de, "EOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint"); -#endif -#endif -#ifdef EREMCHG - inscode(d, ds, de, "EREMCHG", EREMCHG, "Remote address changed"); -#endif -#ifdef EAGAIN - inscode(d, ds, de, "EAGAIN", EAGAIN, "Try again"); -#endif -#ifdef ENAMETOOLONG - inscode(d, ds, de, "ENAMETOOLONG", ENAMETOOLONG, "File name too long"); -#else -#ifdef WSAENAMETOOLONG - inscode(d, ds, de, "ENAMETOOLONG", WSAENAMETOOLONG, "File name too long"); -#endif -#endif -#ifdef ENOTTY - inscode(d, ds, de, "ENOTTY", ENOTTY, "Not a typewriter"); -#endif -#ifdef ERESTART - inscode(d, ds, de, "ERESTART", ERESTART, "Interrupted system call should be restarted"); -#endif -#ifdef ESOCKTNOSUPPORT - inscode(d, ds, de, "ESOCKTNOSUPPORT", ESOCKTNOSUPPORT, "Socket type not supported"); -#else -#ifdef WSAESOCKTNOSUPPORT - inscode(d, ds, de, "ESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported"); -#endif -#endif -#ifdef ETIME - inscode(d, ds, de, "ETIME", ETIME, "Timer expired"); -#endif -#ifdef EBFONT - inscode(d, ds, de, "EBFONT", EBFONT, "Bad font file format"); -#endif -#ifdef EDEADLOCK - inscode(d, ds, de, "EDEADLOCK", EDEADLOCK, "Error EDEADLOCK"); -#endif -#ifdef ETOOMANYREFS - inscode(d, ds, de, "ETOOMANYREFS", ETOOMANYREFS, "Too many references: cannot splice"); -#else -#ifdef WSAETOOMANYREFS - inscode(d, ds, de, "ETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice"); -#endif -#endif -#ifdef EMFILE - inscode(d, ds, de, "EMFILE", EMFILE, "Too many open files"); -#else -#ifdef WSAEMFILE - inscode(d, ds, de, "EMFILE", WSAEMFILE, "Too many open files"); -#endif -#endif -#ifdef ETXTBSY - inscode(d, ds, de, "ETXTBSY", ETXTBSY, "Text file busy"); -#endif -#ifdef EINPROGRESS - inscode(d, ds, de, "EINPROGRESS", EINPROGRESS, "Operation now in progress"); -#else -#ifdef WSAEINPROGRESS - inscode(d, ds, de, "EINPROGRESS", WSAEINPROGRESS, "Operation now in progress"); -#endif -#endif -#ifdef ENXIO - inscode(d, ds, de, "ENXIO", ENXIO, "No such device or address"); -#endif -#ifdef ENOPKG - inscode(d, ds, de, "ENOPKG", ENOPKG, "Package not installed"); -#endif -#ifdef WSASY - inscode(d, ds, de, "WSASY", WSASY, "Error WSASY"); -#endif -#ifdef WSAEHOSTDOWN - inscode(d, ds, de, "WSAEHOSTDOWN", WSAEHOSTDOWN, "Host is down"); -#endif -#ifdef WSAENETDOWN - inscode(d, ds, de, "WSAENETDOWN", WSAENETDOWN, "Network is down"); -#endif -#ifdef WSAENOTSOCK - inscode(d, ds, de, "WSAENOTSOCK", WSAENOTSOCK, "Socket operation on non-socket"); -#endif -#ifdef WSAEHOSTUNREACH - inscode(d, ds, de, "WSAEHOSTUNREACH", WSAEHOSTUNREACH, "No route to host"); -#endif -#ifdef WSAELOOP - inscode(d, ds, de, "WSAELOOP", WSAELOOP, "Too many symbolic links encountered"); -#endif -#ifdef WSAEMFILE - inscode(d, ds, de, "WSAEMFILE", WSAEMFILE, "Too many open files"); -#endif -#ifdef WSAESTALE - inscode(d, ds, de, "WSAESTALE", WSAESTALE, "Stale NFS file handle"); -#endif -#ifdef WSAVERNOTSUPPORTED - inscode(d, ds, de, "WSAVERNOTSUPPORTED", WSAVERNOTSUPPORTED, "Error WSAVERNOTSUPPORTED"); -#endif -#ifdef WSAENETUNREACH - inscode(d, ds, de, "WSAENETUNREACH", WSAENETUNREACH, "Network is unreachable"); -#endif -#ifdef WSAEPROCLIM - inscode(d, ds, de, "WSAEPROCLIM", WSAEPROCLIM, "Error WSAEPROCLIM"); -#endif -#ifdef WSAEFAULT - inscode(d, ds, de, "WSAEFAULT", WSAEFAULT, "Bad address"); -#endif -#ifdef WSANOTINITIALISED - inscode(d, ds, de, "WSANOTINITIALISED", WSANOTINITIALISED, "Error WSANOTINITIALISED"); -#endif -#ifdef WSAEUSERS - inscode(d, ds, de, "WSAEUSERS", WSAEUSERS, "Too many users"); -#endif -#ifdef WSAMAKEASYNCREPL - inscode(d, ds, de, "WSAMAKEASYNCREPL", WSAMAKEASYNCREPL, "Error WSAMAKEASYNCREPL"); -#endif -#ifdef WSAENOPROTOOPT - inscode(d, ds, de, "WSAENOPROTOOPT", WSAENOPROTOOPT, "Protocol not available"); -#endif -#ifdef WSAECONNABORTED - inscode(d, ds, de, "WSAECONNABORTED", WSAECONNABORTED, "Software caused connection abort"); -#endif -#ifdef WSAENAMETOOLONG - inscode(d, ds, de, "WSAENAMETOOLONG", WSAENAMETOOLONG, "File name too long"); -#endif -#ifdef WSAENOTEMPTY - inscode(d, ds, de, "WSAENOTEMPTY", WSAENOTEMPTY, "Directory not empty"); -#endif -#ifdef WSAESHUTDOWN - inscode(d, ds, de, "WSAESHUTDOWN", WSAESHUTDOWN, "Cannot send after transport endpoint shutdown"); -#endif -#ifdef WSAEAFNOSUPPORT - inscode(d, ds, de, "WSAEAFNOSUPPORT", WSAEAFNOSUPPORT, "Address family not supported by protocol"); -#endif -#ifdef WSAETOOMANYREFS - inscode(d, ds, de, "WSAETOOMANYREFS", WSAETOOMANYREFS, "Too many references: cannot splice"); -#endif -#ifdef WSAEACCES - inscode(d, ds, de, "WSAEACCES", WSAEACCES, "Permission denied"); -#endif -#ifdef WSATR - inscode(d, ds, de, "WSATR", WSATR, "Error WSATR"); -#endif -#ifdef WSABASEERR - inscode(d, ds, de, "WSABASEERR", WSABASEERR, "Error WSABASEERR"); -#endif -#ifdef WSADESCRIPTIO - inscode(d, ds, de, "WSADESCRIPTIO", WSADESCRIPTIO, "Error WSADESCRIPTIO"); -#endif -#ifdef WSAEMSGSIZE - inscode(d, ds, de, "WSAEMSGSIZE", WSAEMSGSIZE, "Message too long"); -#endif -#ifdef WSAEBADF - inscode(d, ds, de, "WSAEBADF", WSAEBADF, "Bad file number"); -#endif -#ifdef WSAECONNRESET - inscode(d, ds, de, "WSAECONNRESET", WSAECONNRESET, "Connection reset by peer"); -#endif -#ifdef WSAGETSELECTERRO - inscode(d, ds, de, "WSAGETSELECTERRO", WSAGETSELECTERRO, "Error WSAGETSELECTERRO"); -#endif -#ifdef WSAETIMEDOUT - inscode(d, ds, de, "WSAETIMEDOUT", WSAETIMEDOUT, "Connection timed out"); -#endif -#ifdef WSAENOBUFS - inscode(d, ds, de, "WSAENOBUFS", WSAENOBUFS, "No buffer space available"); -#endif -#ifdef WSAEDISCON - inscode(d, ds, de, "WSAEDISCON", WSAEDISCON, "Error WSAEDISCON"); -#endif -#ifdef WSAEINTR - inscode(d, ds, de, "WSAEINTR", WSAEINTR, "Interrupted system call"); -#endif -#ifdef WSAEPROTOTYPE - inscode(d, ds, de, "WSAEPROTOTYPE", WSAEPROTOTYPE, "Protocol wrong type for socket"); -#endif -#ifdef WSAHOS - inscode(d, ds, de, "WSAHOS", WSAHOS, "Error WSAHOS"); -#endif -#ifdef WSAEADDRINUSE - inscode(d, ds, de, "WSAEADDRINUSE", WSAEADDRINUSE, "Address already in use"); -#endif -#ifdef WSAEADDRNOTAVAIL - inscode(d, ds, de, "WSAEADDRNOTAVAIL", WSAEADDRNOTAVAIL, "Cannot assign requested address"); -#endif -#ifdef WSAEALREADY - inscode(d, ds, de, "WSAEALREADY", WSAEALREADY, "Operation already in progress"); -#endif -#ifdef WSAEPROTONOSUPPORT - inscode(d, ds, de, "WSAEPROTONOSUPPORT", WSAEPROTONOSUPPORT, "Protocol not supported"); -#endif -#ifdef WSASYSNOTREADY - inscode(d, ds, de, "WSASYSNOTREADY", WSASYSNOTREADY, "Error WSASYSNOTREADY"); -#endif -#ifdef WSAEWOULDBLOCK - inscode(d, ds, de, "WSAEWOULDBLOCK", WSAEWOULDBLOCK, "Operation would block"); -#endif -#ifdef WSAEPFNOSUPPORT - inscode(d, ds, de, "WSAEPFNOSUPPORT", WSAEPFNOSUPPORT, "Protocol family not supported"); -#endif -#ifdef WSAEOPNOTSUPP - inscode(d, ds, de, "WSAEOPNOTSUPP", WSAEOPNOTSUPP, "Operation not supported on transport endpoint"); -#endif -#ifdef WSAEISCONN - inscode(d, ds, de, "WSAEISCONN", WSAEISCONN, "Transport endpoint is already connected"); -#endif -#ifdef WSAEDQUOT - inscode(d, ds, de, "WSAEDQUOT", WSAEDQUOT, "Quota exceeded"); -#endif -#ifdef WSAENOTCONN - inscode(d, ds, de, "WSAENOTCONN", WSAENOTCONN, "Transport endpoint is not connected"); -#endif -#ifdef WSAEREMOTE - inscode(d, ds, de, "WSAEREMOTE", WSAEREMOTE, "Object is remote"); -#endif -#ifdef WSAEINVAL - inscode(d, ds, de, "WSAEINVAL", WSAEINVAL, "Invalid argument"); -#endif -#ifdef WSAEINPROGRESS - inscode(d, ds, de, "WSAEINPROGRESS", WSAEINPROGRESS, "Operation now in progress"); -#endif -#ifdef WSAGETSELECTEVEN - inscode(d, ds, de, "WSAGETSELECTEVEN", WSAGETSELECTEVEN, "Error WSAGETSELECTEVEN"); -#endif -#ifdef WSAESOCKTNOSUPPORT - inscode(d, ds, de, "WSAESOCKTNOSUPPORT", WSAESOCKTNOSUPPORT, "Socket type not supported"); -#endif -#ifdef WSAGETASYNCERRO - inscode(d, ds, de, "WSAGETASYNCERRO", WSAGETASYNCERRO, "Error WSAGETASYNCERRO"); -#endif -#ifdef WSAMAKESELECTREPL - inscode(d, ds, de, "WSAMAKESELECTREPL", WSAMAKESELECTREPL, "Error WSAMAKESELECTREPL"); -#endif -#ifdef WSAGETASYNCBUFLE - inscode(d, ds, de, "WSAGETASYNCBUFLE", WSAGETASYNCBUFLE, "Error WSAGETASYNCBUFLE"); -#endif -#ifdef WSAEDESTADDRREQ - inscode(d, ds, de, "WSAEDESTADDRREQ", WSAEDESTADDRREQ, "Destination address required"); -#endif -#ifdef WSAECONNREFUSED - inscode(d, ds, de, "WSAECONNREFUSED", WSAECONNREFUSED, "Connection refused"); -#endif -#ifdef WSAENETRESET - inscode(d, ds, de, "WSAENETRESET", WSAENETRESET, "Network dropped connection because of reset"); -#endif -#ifdef WSAN - inscode(d, ds, de, "WSAN", WSAN, "Error WSAN"); -#endif - -/* These symbols are added for EDK II support. */ -#ifdef EMINERRORVAL - inscode(d, ds, de, "EMINERRORVAL", EMINERRORVAL, "Lowest valid error value"); -#endif -#ifdef ENOTSUP - inscode(d, ds, de, "ENOTSUP", ENOTSUP, "Operation not supported"); -#endif -#ifdef EBADRPC - inscode(d, ds, de, "EBADRPC", EBADRPC, "RPC struct is bad"); -#endif -#ifdef ERPCMISMATCH - inscode(d, ds, de, "ERPCMISMATCH", ERPCMISMATCH, "RPC version wrong"); -#endif -#ifdef EPROGUNAVAIL - inscode(d, ds, de, "EPROGUNAVAIL", EPROGUNAVAIL, "RPC prog. not avail"); -#endif -#ifdef EPROGMISMATCH - inscode(d, ds, de, "EPROGMISMATCH", EPROGMISMATCH, "Program version wrong"); -#endif -#ifdef EPROCUNAVAIL - inscode(d, ds, de, "EPROCUNAVAIL", EPROCUNAVAIL, "Bad procedure for program"); -#endif -#ifdef EFTYPE - inscode(d, ds, de, "EFTYPE", EFTYPE, "Inappropriate file type or format"); -#endif -#ifdef EAUTH - inscode(d, ds, de, "EAUTH", EAUTH, "Authentication error"); -#endif -#ifdef ENEEDAUTH - inscode(d, ds, de, "ENEEDAUTH", ENEEDAUTH, "Need authenticator"); -#endif -#ifdef ECANCELED - inscode(d, ds, de, "ECANCELED", ECANCELED, "Operation canceled"); -#endif -#ifdef ENOATTR - inscode(d, ds, de, "ENOATTR", ENOATTR, "Attribute not found"); -#endif -#ifdef EDOOFUS - inscode(d, ds, de, "EDOOFUS", EDOOFUS, "Programming Error"); -#endif -#ifdef EBUFSIZE - inscode(d, ds, de, "EBUFSIZE", EBUFSIZE, "Buffer too small to hold result"); -#endif -#ifdef EMAXERRORVAL - inscode(d, ds, de, "EMAXERRORVAL", EMAXERRORVAL, "One more than the highest defined error value"); -#endif - - Py_DECREF(de); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/expat/expat_external.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/expat/expat_external.h deleted file mode 100644 index 8b312b5..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/expat/expat_external.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_External_INCLUDED -#define Expat_External_INCLUDED 1 - -/* External API definitions */ - -/* Namespace external symbols to allow multiple libexpat version to - co-exist. */ -#if !defined(UEFI_C_SOURCE) - #include "pyexpatns.h" -#endif - -#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -#define XML_USE_MSC_EXTENSIONS 1 -#endif - -/* Expat tries very hard to make the API boundary very specifically - defined. There are two macros defined to control this boundary; - each of these can be defined before including this header to - achieve some different behavior, but doing so it not recommended or - tested frequently. - - XMLCALL - The calling convention to use for all calls across the - "library boundary." This will default to cdecl, and - try really hard to tell the compiler that's what we - want. - - XMLIMPORT - Whatever magic is needed to note that a function is - to be imported from a dynamically loaded library - (.dll, .so, or .sl, depending on your platform). - - The XMLCALL macro was added in Expat 1.95.7. The only one which is - expected to be directly useful in client code is XMLCALL. - - Note that on at least some Unix versions, the Expat library must be - compiled with the cdecl calling convention as the default since - system headers may assume the cdecl convention. -*/ -#ifndef XMLCALL -#if defined(_MSC_VER) -#define XMLCALL __cdecl -#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) -#define XMLCALL __attribute__((cdecl)) -#else -/* For any platform which uses this definition and supports more than - one calling convention, we need to extend this definition to - declare the convention used on that platform, if it's possible to - do so. - - If this is the case for your platform, please file a bug report - with information on how to identify your platform via the C - pre-processor and how to specify the same calling convention as the - platform's malloc() implementation. -*/ -#define XMLCALL -#endif -#endif /* not defined XMLCALL */ - - -#if !defined(XML_STATIC) && !defined(XMLIMPORT) -#ifndef XML_BUILDING_EXPAT -/* using Expat from an application */ - -#ifdef XML_USE_MSC_EXTENSIONS -#define XMLIMPORT __declspec(dllimport) -#endif - -#endif -#endif /* not defined XML_STATIC */ - - -/* If we didn't define it above, define it away: */ -#ifndef XMLIMPORT -#define XMLIMPORT -#endif - - -#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE -#endif - -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ -#ifdef XML_UNICODE_WCHAR_T -typedef wchar_t XML_Char; -typedef wchar_t XML_LChar; -#else -typedef unsigned short XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ -typedef char XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE */ - -#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -typedef __int64 XML_Index; -typedef unsigned __int64 XML_Size; -#else -typedef long long XML_Index; -typedef unsigned long long XML_Size; -#endif -#else -typedef long XML_Index; -typedef unsigned long XML_Size; -#endif /* XML_LARGE_SIZE */ - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_External_INCLUDED */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/getpath.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/getpath.c deleted file mode 100644 index 5564d17..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/getpath.c +++ /dev/null @@ -1,656 +0,0 @@ -/** @file - Return the initial module search path. - - This file is based upon the Modules/getpath.c file from the Python distribution - but has had everything not exactly necessary for operation on EDK II stripped - out. - - Search in specified locations for the associated Python libraries. - - For the EDK II, UEFI, implementation of Python, PREFIX and EXEC_PREFIX - are set as follows: - PREFIX = /Efi/StdLib - EXEC_PREFIX = PREFIX - - The volume is assumed to be the current volume when Python was started. - - Py_GetPath returns module_search_path. - Py_GetPrefix returns PREFIX - Py_GetExec_Prefix returns PREFIX - Py_GetProgramFullPath returns the full path to the python executable. - - These are built dynamically so that the proper volume name can be prefixed - to the paths. - - The following final paths (for Python 2.7.10) are assumed: - /Efi/Tools/Python.efi The Python executable. - /Efi/StdLib/lib/python27.10 The version dependent Python modules. - /Efi/StdLib/lib/python.27 The version independent Python modules. - /Efi/StdLib/lib/python27.10/lib-dynload Dynamically loadable Python extension modules. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#include -#include -#include - -#define SIFY_I( x ) #x -#define SIFY( y ) SIFY_I( y ) - -/* VERSION must be at least two characters long. */ -#ifndef VERSION - #define VERSION SIFY(PY_MAJOR_VERSION) SIFY(PY_MINOR_VERSION) -#endif - -#ifndef VPATH - #define VPATH "." -#endif - -/* Search path entry delimiter */ -#ifdef DELIM - #define sDELIM ";" -#endif - -#ifndef PREFIX - #define PREFIX "/Efi/StdLib" -#endif - -#ifndef EXEC_PREFIX - #define EXEC_PREFIX PREFIX -#endif - -#ifndef LIBPYTHON - #define LIBPYTHON "lib/python" VERSION "." SIFY(PY_MICRO_VERSION) -#endif - -#ifndef PYTHONPATH - #define PYTHONPATH LIBPYTHON -#endif - -#ifndef LANDMARK - #define LANDMARK "os.py" -#endif - -#ifdef __cplusplus - extern "C" { -#endif - -static char prefix[MAXPATHLEN+1]; -static char exec_prefix[MAXPATHLEN+1]; -static char progpath[MAXPATHLEN+1]; -static char *module_search_path = NULL; -static char lib_python[] = LIBPYTHON; -static char volume_name[32] = { 0 }; - -/** Determine if "ch" is a separator character. - - @param[in] ch The character to test. - - @retval TRUE ch is a separator character. - @retval FALSE ch is NOT a separator character. -**/ -static int -is_sep(char ch) -{ - return ch == SEP || ch == ALTSEP; -} - -/** Reduce a path by its last element. - - The last element (everything to the right of the last separator character) - in the path, dir, is removed from the path. Parameter dir is modified in place. - - @param[in,out] dir Pointer to the path to modify. -**/ -static void -reduce(char *dir) -{ - size_t i = strlen(dir); - while (i > 0 && !is_sep(dir[i])) - --i; - dir[i] = '\0'; -} - -/** Determine if a path is absolute, or not. - An absolute path consists of a volume name, "VOL:", followed by a rooted path, - "/path/elements". If both of these components are present, the path is absolute. - - Let P be a pointer to the path to test. - Let A be a pointer to the first ':' in P. - Let B be a pointer to the first '/' or '\\' in P. - - If A and B are not NULL - If (A-P+1) == (B-P) then the path is absolute. - Otherwise, the path is NOT absolute. - - @param[in] path The path to test. - - @retval -1 Path is absolute but lacking volume name. - @retval 0 Path is NOT absolute. - @retval 1 Path is absolute. -*/ -static int -is_absolute(char *path) -{ - char *A; - char *B; - - A = strchr(path, ':'); - B = strpbrk(path, "/\\"); - - if(B != NULL) { - if(A == NULL) { - if(B == path) { - return -1; - } - } - else { - if(((A - path) + 1) == (B - path)) { - return 1; - } - } - } - return 0; -} - - -/** Add a path component, by appending stuff to buffer. - buffer must have at least MAXPATHLEN + 1 bytes allocated, and contain a - NUL-terminated string with no more than MAXPATHLEN characters (not counting - the trailing NUL). It's a fatal error if it contains a string longer than - that (callers must be careful!). If these requirements are met, it's - guaranteed that buffer will still be a NUL-terminated string with no more - than MAXPATHLEN characters at exit. If stuff is too long, only as much of - stuff as fits will be appended. - - @param[in,out] buffer The path to be extended. - @param[in] stuff The stuff to join onto the path. -*/ -static void -joinpath(char *buffer, char *stuff) -{ - size_t n, k; - - k = 0; - if (is_absolute(stuff) == 1) { - n = 0; - } - else { - n = strlen(buffer); - if(n == 0) { - strncpy(buffer, volume_name, MAXPATHLEN); - n = strlen(buffer); - } - /* We must not use an else clause here because we want to test n again. - volume_name may have been empty. - */ - if (n > 0 && n < MAXPATHLEN) { - if(!is_sep(buffer[n-1])) { - buffer[n++] = SEP; - } - if(is_sep(stuff[0])) ++stuff; - } - } - if (n > MAXPATHLEN) - Py_FatalError("buffer overflow in getpath.c's joinpath()"); - k = strlen(stuff); - if (n + k > MAXPATHLEN) - k = MAXPATHLEN - n; - strncpy(buffer+n, stuff, k); - buffer[n+k] = '\0'; -} - -/** Is filename an executable file? - - An executable file: - 1) exists - 2) is a file, not a directory - 3) has a name ending with ".efi" - 4) Only has a single '.' in the name. - - If basename(filename) does not contain a '.', append ".efi" to filename - If filename ends in ".efi", it is executable, else it isn't. - - This routine is used to when searching for the file named by argv[0]. - As such, there is no need to search for extensions other than ".efi". - - @param[in] filename The name of the file to test. It may, or may not, have an extension. - - @retval 0 filename already has a path other than ".efi", or it doesn't exist, or is a directory. - @retval 1 filename refers to an executable file. -**/ -static int -isxfile(char *filename) -{ - struct stat buf; - char *bn; - char *newbn; - int bnlen; - - bn = basename(filename); // Separate off the file name component - reduce(filename); // and isolate the path component - bnlen = strlen(bn); - newbn = strrchr(bn, '.'); // Does basename contain a period? - if(newbn == NULL) { // Does NOT contain a period. - newbn = &bn[bnlen]; - strncpyX(newbn, ".efi", MAXPATHLEN - bnlen); // append ".efi" to basename - bnlen += 4; - } - else if(strcmp(newbn, ".efi") != 0) { - return 0; // File can not be executable. - } - joinpath(filename, bn); // Stitch path and file name back together - - if (stat(filename, &buf) != 0) { // Now, verify that file exists - return 0; - } - if(S_ISDIR(buf.st_mode)) { // And it is not a directory. - return 0; - } - - return 1; -} - -/** Copy p into path, ensuring that the result is an absolute path. - - copy_absolute requires that path be allocated at least - MAXPATHLEN + 1 bytes and that p be no more than MAXPATHLEN bytes. - - @param[out] path Destination to receive the absolute path. - @param[in] p Path to be tested and possibly converted. -**/ -static void -copy_absolute(char *path, char *p) -{ - if (is_absolute(p) == 1) - strcpy(path, p); - else { - if (!getcwd(path, MAXPATHLEN)) { - /* unable to get the current directory */ - if(volume_name[0] != 0) { - strcpy(path, volume_name); - joinpath(path, p); - } - else - strcpy(path, p); - return; - } - if (p[0] == '.' && is_sep(p[1])) - p += 2; - joinpath(path, p); - } -} - -/** Modify path so that the result is an absolute path. - absolutize() requires that path be allocated at least MAXPATHLEN+1 bytes. - - @param[in,out] path The path to be made absolute. -*/ -static void -absolutize(char *path) -{ - char buffer[MAXPATHLEN + 1]; - - if (is_absolute(path) == 1) - return; - copy_absolute(buffer, path); - strcpy(path, buffer); -} - -/** Extract the volume name from a path. - - @param[out] Dest Pointer to location in which to store the extracted volume name. - @param[in] path Pointer to the path to extract the volume name from. -**/ -static void -set_volume(char *Dest, char *path) -{ - size_t VolLen; - - if(is_absolute(path)) { - VolLen = strcspn(path, "/\\:"); - if((VolLen != 0) && (path[VolLen] == ':')) { - (void) strncpyX(Dest, path, VolLen + 1); - } - } -} - - -/** Determine paths. - - Two directories must be found, the platform independent directory - (prefix), containing the common .py and .pyc files, and the platform - dependent directory (exec_prefix), containing the shared library - modules. Note that prefix and exec_prefix are the same directory - for UEFI installations. - - Separate searches are carried out for prefix and exec_prefix. - Each search tries a number of different locations until a ``landmark'' - file or directory is found. If no prefix or exec_prefix is found, a - warning message is issued and the preprocessor defined PREFIX and - EXEC_PREFIX are used (even though they may not work); python carries on - as best as is possible, but some imports may fail. - - Before any searches are done, the location of the executable is - determined. If argv[0] has one or more slashes in it, it is used - unchanged. Otherwise, it must have been invoked from the shell's path, - so we search %PATH% for the named executable and use that. If the - executable was not found on %PATH% (or there was no %PATH% environment - variable), the original argv[0] string is used. - - Finally, argv0_path is set to the directory containing the executable - (i.e. the last component is stripped). - - With argv0_path in hand, we perform a number of steps. The same steps - are performed for prefix and for exec_prefix, but with a different - landmark. - - The prefix landmark will always be lib/python.VERSION/os.py and the - exec_prefix will always be lib/python.VERSION/dynaload, where VERSION - is Python's version number as defined at the beginning of this file. - - First. See if the %PYTHONHOME% environment variable points to the - installed location of the Python libraries. If %PYTHONHOME% is set, then - it points to prefix and exec_prefix. %PYTHONHOME% can be a single - directory, which is used for both, or the prefix and exec_prefix - directories separated by the DELIM character. - - Next. Search the directories pointed to by the preprocessor variables - PREFIX and EXEC_PREFIX. These paths are prefixed with the volume name - extracted from argv0_path. The volume names correspond to the UEFI - shell "map" names. - - That's it! - - Well, almost. Once we have determined prefix and exec_prefix, the - preprocessor variable PYTHONPATH is used to construct a path. Each - relative path on PYTHONPATH is prefixed with prefix. Then the directory - containing the shared library modules is appended. The environment - variable $PYTHONPATH is inserted in front of it all. Finally, the - prefix and exec_prefix globals are tweaked so they reflect the values - expected by other code, by stripping the "lib/python$VERSION/..." stuff - off. This seems to make more sense given that currently the only - known use of sys.prefix and sys.exec_prefix is for the ILU installation - process to find the installed Python tree. - - The final, fully resolved, paths should look something like: - fs0:/Efi/Tools/python.efi - fs0:/Efi/StdLib/lib/python27 - fs0:/Efi/StdLib/lib/python27/dynaload - -**/ -static void -calculate_path(void) -{ - extern char *Py_GetProgramName(void); - - static char delimiter[2] = {DELIM, '\0'}; - static char separator[2] = {SEP, '\0'}; - char *pythonpath = PYTHONPATH; - char *rtpypath = Py_GETENV("PYTHONPATH"); - //char *home = Py_GetPythonHome(); - char *path = getenv("path"); - char *prog = Py_GetProgramName(); - char argv0_path[MAXPATHLEN+1]; - char zip_path[MAXPATHLEN+1]; - char *buf; - size_t bufsz; - size_t prefixsz; - char *defpath; - - -/* ########################################################################### - Determine path to the Python.efi binary. - Produces progpath, argv0_path, and volume_name. -########################################################################### */ - - /* If there is no slash in the argv0 path, then we have to - * assume python is on the user's $PATH, since there's no - * other way to find a directory to start the search from. If - * $PATH isn't exported, you lose. - */ - if (strchr(prog, SEP)) - strncpy(progpath, prog, MAXPATHLEN); - else if (path) { - while (1) { - char *delim = strchr(path, DELIM); - - if (delim) { - size_t len = delim - path; - if (len > MAXPATHLEN) - len = MAXPATHLEN; - strncpy(progpath, path, len); - *(progpath + len) = '\0'; - } - else - strncpy(progpath, path, MAXPATHLEN); - - joinpath(progpath, prog); - if (isxfile(progpath)) - break; - - if (!delim) { - progpath[0] = '\0'; - break; - } - path = delim + 1; - } - } - else - progpath[0] = '\0'; - if ( (!is_absolute(progpath)) && (progpath[0] != '\0') ) - absolutize(progpath); - strncpy(argv0_path, progpath, MAXPATHLEN); - argv0_path[MAXPATHLEN] = '\0'; - set_volume(volume_name, argv0_path); - - reduce(argv0_path); - /* At this point, argv0_path is guaranteed to be less than - MAXPATHLEN bytes long. - */ - -/* ########################################################################### - Build the FULL prefix string, including volume name. - This is the full path to the platform independent libraries. -########################################################################### */ - - strncpy(prefix, volume_name, MAXPATHLEN); - joinpath(prefix, PREFIX); - joinpath(prefix, lib_python); - -/* ########################################################################### - Build the FULL path to the zipped-up Python library. -########################################################################### */ - - strncpy(zip_path, prefix, MAXPATHLEN); - zip_path[MAXPATHLEN] = '\0'; - reduce(zip_path); - joinpath(zip_path, "python00.zip"); - bufsz = strlen(zip_path); /* Replace "00" with version */ - zip_path[bufsz - 6] = VERSION[0]; - zip_path[bufsz - 5] = VERSION[1]; - -/* ########################################################################### - Build the FULL path to dynamically loadable libraries. -########################################################################### */ - - strncpy(exec_prefix, volume_name, MAXPATHLEN); // "fs0:" - joinpath(exec_prefix, EXEC_PREFIX); // "fs0:/Efi/StdLib" - joinpath(exec_prefix, lib_python); // "fs0:/Efi/StdLib/lib/python.27" - joinpath(exec_prefix, "lib-dynload"); // "fs0:/Efi/StdLib/lib/python.27/lib-dynload" - -/* ########################################################################### - Build the module search path. -########################################################################### */ - - /* Reduce prefix and exec_prefix to their essence, - * e.g. /usr/local/lib/python1.5 is reduced to /usr/local. - * If we're loading relative to the build directory, - * return the compiled-in defaults instead. - */ - reduce(prefix); - reduce(prefix); - /* The prefix is the root directory, but reduce() chopped - * off the "/". */ - if (!prefix[0]) { - strcpy(prefix, volume_name); - } - bufsz = strlen(prefix); - if(prefix[bufsz-1] == ':') { // if prefix consists solely of a volume_name - prefix[bufsz] = SEP; // then append SEP indicating the root directory - prefix[bufsz+1] = 0; // and ensure the new string is terminated - } - - /* Calculate size of return buffer. - */ - defpath = pythonpath; - bufsz = 0; - - if (rtpypath) - bufsz += strlen(rtpypath) + 1; - - prefixsz = strlen(prefix) + 1; - - while (1) { - char *delim = strchr(defpath, DELIM); - - if (is_absolute(defpath) == 0) - /* Paths are relative to prefix */ - bufsz += prefixsz; - - if (delim) - bufsz += delim - defpath + 1; - else { - bufsz += strlen(defpath) + 1; - break; - } - defpath = delim + 1; - } - - bufsz += strlen(zip_path) + 1; - bufsz += strlen(exec_prefix) + 1; - - /* This is the only malloc call in this file */ - buf = (char *)PyMem_Malloc(bufsz); - - if (buf == NULL) { - /* We can't exit, so print a warning and limp along */ - fprintf(stderr, "Not enough memory for dynamic PYTHONPATH.\n"); - fprintf(stderr, "Using default static PYTHONPATH.\n"); - module_search_path = PYTHONPATH; - } - else { - /* Run-time value of $PYTHONPATH goes first */ - if (rtpypath) { - strcpy(buf, rtpypath); - strcat(buf, delimiter); - } - else - buf[0] = '\0'; - - /* Next is the default zip path */ - strcat(buf, zip_path); - strcat(buf, delimiter); - - /* Next goes merge of compile-time $PYTHONPATH with - * dynamically located prefix. - */ - defpath = pythonpath; - while (1) { - char *delim = strchr(defpath, DELIM); - - if (is_absolute(defpath) != 1) { - strcat(buf, prefix); - strcat(buf, separator); - } - - if (delim) { - size_t len = delim - defpath + 1; - size_t end = strlen(buf) + len; - strncat(buf, defpath, len); - *(buf + end) = '\0'; - } - else { - strcat(buf, defpath); - break; - } - defpath = delim + 1; - } - strcat(buf, delimiter); - - /* Finally, on goes the directory for dynamic-load modules */ - strcat(buf, exec_prefix); - - /* And publish the results */ - module_search_path = buf; - } - /* At this point, exec_prefix is set to VOL:/Efi/StdLib/lib/python.27/dynalib. - We want to get back to the root value, so we have to remove the final three - segments to get VOL:/Efi/StdLib. Because we don't know what VOL is, and - EXEC_PREFIX is also indeterminate, we just remove the three final segments. - */ - reduce(exec_prefix); - reduce(exec_prefix); - reduce(exec_prefix); - if (!exec_prefix[0]) { - strcpy(exec_prefix, volume_name); - } - bufsz = strlen(exec_prefix); - if(exec_prefix[bufsz-1] == ':') { - exec_prefix[bufsz] = SEP; - exec_prefix[bufsz+1] = 0; - } - if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: module_search_path = \"%s\"\n", __func__, __LINE__, module_search_path); - if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: prefix = \"%s\"\n", __func__, __LINE__, prefix); - if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: exec_prefix = \"%s\"\n", __func__, __LINE__, exec_prefix); - if (Py_VerboseFlag) PySys_WriteStderr("%s[%d]: progpath = \"%s\"\n", __func__, __LINE__, progpath); -} - - -/* External interface */ - -char * -Py_GetPath(void) -{ - if (!module_search_path) - calculate_path(); - return module_search_path; -} - -char * -Py_GetPrefix(void) -{ - if (!module_search_path) - calculate_path(); - return prefix; -} - -char * -Py_GetExecPrefix(void) -{ - if (!module_search_path) - calculate_path(); - return exec_prefix; -} - -char * -Py_GetProgramFullPath(void) -{ - if (!module_search_path) - calculate_path(); - return progpath; -} - - -#ifdef __cplusplus -} -#endif - diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/main.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/main.c deleted file mode 100644 index c7d6c5f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/main.c +++ /dev/null @@ -1,701 +0,0 @@ -/** @file - Python interpreter main program. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
-**/ - -#include "Python.h" -#include "osdefs.h" -#include "code.h" /* For CO_FUTURE_DIVISION */ -#include "import.h" - -#ifdef __VMS -#include -#endif - -#if defined(MS_WINDOWS) || defined(__CYGWIN__) -#ifdef HAVE_FCNTL_H -#include -#endif -#endif - -#if (defined(PYOS_OS2) && !defined(PYCC_GCC)) || defined(MS_WINDOWS) -#define PYTHONHOMEHELP "\\lib" -#else -#if defined(PYOS_OS2) && defined(PYCC_GCC) -#define PYTHONHOMEHELP "/Lib" -#else -#define PYTHONHOMEHELP "/pythonX.X" -#endif -#endif - -#include "pygetopt.h" - -#define COPYRIGHT \ - "Type \"help\", \"copyright\", \"credits\" or \"license\" " \ - "for more information." - -#ifdef __cplusplus -extern "C" { -#endif - -/* For Py_GetArgcArgv(); set by main() */ -static char **orig_argv; -static int orig_argc; - -/* command line options */ -#define BASE_OPTS "#3bBc:dEhiJm:OQ:sStuUvVW:xX?" - -#ifndef RISCOS -#define PROGRAM_OPTS BASE_OPTS -#else /*RISCOS*/ -/* extra option saying that we are running under a special task window - frontend; especially my_readline will behave different */ -#define PROGRAM_OPTS BASE_OPTS "w" -/* corresponding flag */ -extern int Py_RISCOSWimpFlag; -#endif /*RISCOS*/ - -/* Short usage message (with %s for argv0) */ -static char *usage_line = -"usage: %s [option] ... [-c cmd | -m mod | file | -] [arg] ...\n"; - -/* Long usage message, split into parts < 512 bytes */ -static char *usage_1 = "\ -Options and arguments (and corresponding environment variables):\n\ --# : alias stderr to stdout for platforms without STDERR output.\n\ --B : don't write .py[co] files on import; also PYTHONDONTWRITEBYTECODE=x\n\ --c cmd : program passed in as string (terminates option list)\n\ --d : debug output from parser; also PYTHONDEBUG=x\n\ --E : ignore PYTHON* environment variables (such as PYTHONPATH)\n\ --h : print this help message and exit (also --help)\n\ --i : inspect interactively after running script; forces a prompt even\n\ -"; -static char *usage_2 = "\ - if stdin does not appear to be a terminal; also PYTHONINSPECT=x\n\ --m mod : run library module as a script (terminates option list)\n\ --O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\ --OO : remove doc-strings in addition to the -O optimizations\n\ --Q arg : division options: -Qold (default), -Qwarn, -Qwarnall, -Qnew\n\ --s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\ --S : don't imply 'import site' on initialization\n\ --t : issue warnings about inconsistent tab usage (-tt: issue errors)\n\ -"; -static char *usage_3 = "\ --u : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x\n\ - see man page for details on internal buffering relating to '-u'\n\ --v : verbose (trace import statements); also PYTHONVERBOSE=x\n\ - can be supplied multiple times to increase verbosity\n\ --V : print the Python version number and exit (also --version)\n\ --W arg : warning control; arg is action:message:category:module:lineno\n\ - also PYTHONWARNINGS=arg\n\ --x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ -"; -static char *usage_4 = "\ --3 : warn about Python 3.x incompatibilities that 2to3 cannot trivially fix\n\ -file : program read from script file\n\ -- : program read from stdin (default; interactive mode if a tty)\n\ -arg ...: arguments passed to program in sys.argv[1:]\n\n\ -Other environment variables:\n\ -PYTHONSTARTUP: file executed on interactive startup (no default)\n\ -PYTHONPATH : '%c'-separated list of directories prefixed to the\n\ - default module search path. The result is sys.path.\n\ -"; -static char *usage_5 = "\ -PYTHONHOME : alternate directory (or %c).\n\ - The default module search path uses %s.\n\ -PYTHONCASEOK : ignore case in 'import' statements (UEFI default).\n\ -PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n\ -"; - - -static int -usage(int exitcode, char* program) -{ - FILE *f = exitcode ? stderr : stdout; - - fprintf(f, usage_line, program); - if (exitcode) - fprintf(f, "Try `python -h' for more information.\n"); - else { - fputs(usage_1, f); - fputs(usage_2, f); - fputs(usage_3, f); - fprintf(f, usage_4, DELIM); - fprintf(f, usage_5, DELIM, PYTHONHOMEHELP); - } -#if defined(__VMS) - if (exitcode == 0) { - /* suppress 'error' message */ - return 1; - } - else { - /* STS$M_INHIB_MSG + SS$_ABORT */ - return 0x1000002c; - } -#else - return exitcode; -#endif - /*NOTREACHED*/ -} - -static void RunStartupFile(PyCompilerFlags *cf) -{ - char *startup = Py_GETENV("PYTHONSTARTUP"); - if (startup != NULL && startup[0] != '\0') { - FILE *fp = fopen(startup, "r"); - if (fp != NULL) { - (void) PyRun_SimpleFileExFlags(fp, startup, 0, cf); - PyErr_Clear(); - fclose(fp); - } else { - int save_errno; - save_errno = errno; - PySys_WriteStderr("Could not open PYTHONSTARTUP\n"); - errno = save_errno; - PyErr_SetFromErrnoWithFilename(PyExc_IOError, - startup); - PyErr_Print(); - PyErr_Clear(); - } - } -} - - -static int RunModule(char *module, int set_argv0) -{ - PyObject *runpy, *runmodule, *runargs, *result; - runpy = PyImport_ImportModule("runpy"); - if (runpy == NULL) { - fprintf(stderr, "Could not import runpy module\n"); - return -1; - } - runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main"); - if (runmodule == NULL) { - fprintf(stderr, "Could not access runpy._run_module_as_main\n"); - Py_DECREF(runpy); - return -1; - } - runargs = Py_BuildValue("(si)", module, set_argv0); - if (runargs == NULL) { - fprintf(stderr, - "Could not create arguments for runpy._run_module_as_main\n"); - Py_DECREF(runpy); - Py_DECREF(runmodule); - return -1; - } - result = PyObject_Call(runmodule, runargs, NULL); - if (result == NULL) { - PyErr_Print(); - } - Py_DECREF(runpy); - Py_DECREF(runmodule); - Py_DECREF(runargs); - if (result == NULL) { - return -1; - } - Py_DECREF(result); - return 0; -} - -static int RunMainFromImporter(char *filename) -{ - PyObject *argv0 = NULL, *importer = NULL; - - if ((argv0 = PyString_FromString(filename)) && - (importer = PyImport_GetImporter(argv0)) && - (importer->ob_type != &PyNullImporter_Type)) - { - /* argv0 is usable as an import source, so - put it in sys.path[0] and import __main__ */ - PyObject *sys_path = NULL; - if ((sys_path = PySys_GetObject("path")) && - !PyList_SetItem(sys_path, 0, argv0)) - { - Py_INCREF(argv0); - Py_DECREF(importer); - sys_path = NULL; - return RunModule("__main__", 0) != 0; - } - } - Py_XDECREF(argv0); - Py_XDECREF(importer); - if (PyErr_Occurred()) { - PyErr_Print(); - return 1; - } - return -1; -} - - -/* Main program */ - -int -Py_Main(int argc, char **argv) -{ - int c; - int sts; - char *command = NULL; - char *filename = NULL; - char *module = NULL; - FILE *fp = stdin; - char *p; - int unbuffered = 0; - int skipfirstline = 0; - int stdin_is_interactive = 0; - int help = 0; - int version = 0; - int saw_unbuffered_flag = 0; - int saw_pound_flag = 0; - PyCompilerFlags cf; - - cf.cf_flags = 0; - - orig_argc = argc; /* For Py_GetArgcArgv() */ - orig_argv = argv; - -#ifdef RISCOS - Py_RISCOSWimpFlag = 0; -#endif - - /* Hash randomization needed early for all string operations - (including -W and -X options). */ - _PyOS_opterr = 0; /* prevent printing the error in 1st pass */ - while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { - if (c == 'm' || c == 'c') { - /* -c / -m is the last option: following arguments are - not interpreter options. */ - break; - } - switch (c) { - case '#': - if (saw_pound_flag == 0) { - if(freopen("stdout:", "w", stderr) == NULL) { - puts("ERROR: Unable to reopen stderr as an alias to stdout!"); - } - saw_pound_flag = 0xFF; - } - break; - case 'E': - Py_IgnoreEnvironmentFlag++; - break; - default: - break; - } - } - _PyRandom_Init(); - - PySys_ResetWarnOptions(); - _PyOS_ResetGetOpt(); - - while ((c = _PyOS_GetOpt(argc, argv, PROGRAM_OPTS)) != EOF) { - if (c == 'c') { - /* -c is the last option; following arguments - that look like options are left for the - command to interpret. */ - command = (char *)malloc(strlen(_PyOS_optarg) + 2); - if (command == NULL) - Py_FatalError( - "not enough memory to copy -c argument"); - strcpy(command, _PyOS_optarg); - strcat(command, "\n"); - break; - } - - if (c == 'm') { - /* -m is the last option; following arguments - that look like options are left for the - module to interpret. */ - module = (char *)malloc(strlen(_PyOS_optarg) + 2); - if (module == NULL) - Py_FatalError( - "not enough memory to copy -m argument"); - strcpy(module, _PyOS_optarg); - break; - } - - switch (c) { - case 'b': - Py_BytesWarningFlag++; - break; - - case 'd': - Py_DebugFlag++; - break; - - case '3': - Py_Py3kWarningFlag++; - if (!Py_DivisionWarningFlag) - Py_DivisionWarningFlag = 1; - break; - - case 'Q': - if (strcmp(_PyOS_optarg, "old") == 0) { - Py_DivisionWarningFlag = 0; - break; - } - if (strcmp(_PyOS_optarg, "warn") == 0) { - Py_DivisionWarningFlag = 1; - break; - } - if (strcmp(_PyOS_optarg, "warnall") == 0) { - Py_DivisionWarningFlag = 2; - break; - } - if (strcmp(_PyOS_optarg, "new") == 0) { - /* This only affects __main__ */ - cf.cf_flags |= CO_FUTURE_DIVISION; - /* And this tells the eval loop to treat - BINARY_DIVIDE as BINARY_TRUE_DIVIDE */ - _Py_QnewFlag = 1; - break; - } - fprintf(stderr, - "-Q option should be `-Qold', " - "`-Qwarn', `-Qwarnall', or `-Qnew' only\n"); - return usage(2, argv[0]); - /* NOTREACHED */ - - case 'i': - Py_InspectFlag++; - Py_InteractiveFlag++; - break; - - /* case 'J': reserved for Jython */ - - case 'O': - Py_OptimizeFlag++; - break; - - case 'B': - Py_DontWriteBytecodeFlag++; - break; - - case 's': - Py_NoUserSiteDirectory++; - break; - - case 'S': - Py_NoSiteFlag++; - break; - - case 'E': - /* Already handled above */ - break; - - case 't': - Py_TabcheckFlag++; - break; - - case 'u': - unbuffered++; - saw_unbuffered_flag = 1; - break; - - case 'v': - Py_VerboseFlag++; - break; - -#ifdef RISCOS - case 'w': - Py_RISCOSWimpFlag = 1; - break; -#endif - - case 'x': - skipfirstline = 1; - break; - - /* case 'X': reserved for implementation-specific arguments */ - - case 'U': - Py_UnicodeFlag++; - break; - case 'h': - case '?': - help++; - break; - case 'V': - version++; - break; - - case 'W': - PySys_AddWarnOption(_PyOS_optarg); - break; - - case '#': - /* Already handled above */ - break; - - /* This space reserved for other options */ - - default: - return usage(2, argv[0]); - /*NOTREACHED*/ - - } - } - - if (help) - return usage(0, argv[0]); - - if (version) { - fprintf(stderr, "Python %s\n", PY_VERSION); - return 0; - } - - if (Py_Py3kWarningFlag && !Py_TabcheckFlag) - /* -3 implies -t (but not -tt) */ - Py_TabcheckFlag = 1; - - if (!Py_InspectFlag && - (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') - Py_InspectFlag = 1; - if (!saw_unbuffered_flag && - (p = Py_GETENV("PYTHONUNBUFFERED")) && *p != '\0') - unbuffered = 1; - - if (!Py_NoUserSiteDirectory && - (p = Py_GETENV("PYTHONNOUSERSITE")) && *p != '\0') - Py_NoUserSiteDirectory = 1; - - if ((p = Py_GETENV("PYTHONWARNINGS")) && *p != '\0') { - char *buf, *warning; - - buf = (char *)malloc(strlen(p) + 1); - if (buf == NULL) - Py_FatalError( - "not enough memory to copy PYTHONWARNINGS"); - strcpy(buf, p); - for (warning = strtok(buf, ","); - warning != NULL; - warning = strtok(NULL, ",")) - PySys_AddWarnOption(warning); - free(buf); - } - - if (command == NULL && module == NULL && _PyOS_optind < argc && - strcmp(argv[_PyOS_optind], "-") != 0) - { -#ifdef __VMS - filename = decc$translate_vms(argv[_PyOS_optind]); - if (filename == (char *)0 || filename == (char *)-1) - filename = argv[_PyOS_optind]; - -#else - filename = argv[_PyOS_optind]; -#endif - } - - stdin_is_interactive = Py_FdIsInteractive(stdin, (char *)0); - - if (unbuffered) { -#if defined(MS_WINDOWS) || defined(__CYGWIN__) - _setmode(fileno(stdin), O_BINARY); - _setmode(fileno(stdout), O_BINARY); -#endif -#ifdef HAVE_SETVBUF - setvbuf(stdin, (char *)NULL, _IONBF, BUFSIZ); - setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ); - setvbuf(stderr, (char *)NULL, _IONBF, BUFSIZ); -#else /* !HAVE_SETVBUF */ - setbuf(stdin, (char *)NULL); - setbuf(stdout, (char *)NULL); - setbuf(stderr, (char *)NULL); -#endif /* !HAVE_SETVBUF */ - } - else if (Py_InteractiveFlag) { -#ifdef MS_WINDOWS - /* Doesn't have to have line-buffered -- use unbuffered */ - /* Any set[v]buf(stdin, ...) screws up Tkinter :-( */ - setvbuf(stdout, (char *)NULL, _IONBF, BUFSIZ); -#else /* !MS_WINDOWS */ -#ifdef HAVE_SETVBUF - setvbuf(stdin, (char *)NULL, _IOLBF, BUFSIZ); - setvbuf(stdout, (char *)NULL, _IOLBF, BUFSIZ); -#endif /* HAVE_SETVBUF */ -#endif /* !MS_WINDOWS */ - /* Leave stderr alone - it should be unbuffered anyway. */ - } -#ifdef __VMS - else { - setvbuf (stdout, (char *)NULL, _IOLBF, BUFSIZ); - } -#endif /* __VMS */ - -#ifdef __APPLE__ - /* On MacOS X, when the Python interpreter is embedded in an - application bundle, it gets executed by a bootstrapping script - that does os.execve() with an argv[0] that's different from the - actual Python executable. This is needed to keep the Finder happy, - or rather, to work around Apple's overly strict requirements of - the process name. However, we still need a usable sys.executable, - so the actual executable path is passed in an environment variable. - See Lib/plat-mac/bundlebuiler.py for details about the bootstrap - script. */ - if ((p = Py_GETENV("PYTHONEXECUTABLE")) && *p != '\0') - Py_SetProgramName(p); - else - Py_SetProgramName(argv[0]); -#else - Py_SetProgramName(argv[0]); -#endif - Py_Initialize(); - - if (Py_VerboseFlag || - (command == NULL && filename == NULL && module == NULL && stdin_is_interactive)) { - fprintf(stderr, "Python %s on %s\n", - Py_GetVersion(), Py_GetPlatform()); - if (!Py_NoSiteFlag) - fprintf(stderr, "%s\n", COPYRIGHT); - } - - if (command != NULL) { - /* Backup _PyOS_optind and force sys.argv[0] = '-c' */ - _PyOS_optind--; - argv[_PyOS_optind] = "-c"; - } - - if (module != NULL) { - /* Backup _PyOS_optind and force sys.argv[0] = '-c' - so that PySys_SetArgv correctly sets sys.path[0] to '' - rather than looking for a file called "-m". See - tracker issue #8202 for details. */ - _PyOS_optind--; - argv[_PyOS_optind] = "-c"; - } - - PySys_SetArgv(argc-_PyOS_optind, argv+_PyOS_optind); - - if ((Py_InspectFlag || (command == NULL && filename == NULL && module == NULL)) && - isatty(fileno(stdin))) { - PyObject *v; - v = PyImport_ImportModule("readline"); - if (v == NULL) - PyErr_Clear(); - else - Py_DECREF(v); - } - - if (command) { - sts = PyRun_SimpleStringFlags(command, &cf) != 0; - free(command); - } else if (module) { - sts = (RunModule(module, 1) != 0); - free(module); - } - else { - - if (filename == NULL && stdin_is_interactive) { - Py_InspectFlag = 0; /* do exit on SystemExit */ - RunStartupFile(&cf); - } - /* XXX */ - - sts = -1; /* keep track of whether we've already run __main__ */ - - if (filename != NULL) { - sts = RunMainFromImporter(filename); - } - - if (sts==-1 && filename!=NULL) { - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "%s: can't open file '%s': [Errno %d] %s\n", - argv[0], filename, errno, strerror(errno)); - - return 2; - } - else if (skipfirstline) { - int ch; - /* Push back first newline so line numbers - remain the same */ - while ((ch = getc(fp)) != EOF) { - if (ch == '\n') { - (void)ungetc(ch, fp); - break; - } - } - } - { - /* XXX: does this work on Win/Win64? (see posix_fstat) */ - struct stat sb; - if (fstat(fileno(fp), &sb) == 0 && - S_ISDIR(sb.st_mode)) { - fprintf(stderr, "%s: '%s' is a directory, cannot continue\n", argv[0], filename); - fclose(fp); - return 1; - } - } - } - - if (sts==-1) { - /* call pending calls like signal handlers (SIGINT) */ - if (Py_MakePendingCalls() == -1) { - PyErr_Print(); - sts = 1; - } else { - sts = PyRun_AnyFileExFlags( - fp, - filename == NULL ? "" : filename, - filename != NULL, &cf) != 0; - } - } - - } - - /* Check this environment variable at the end, to give programs the - * opportunity to set it from Python. - */ - if (!Py_InspectFlag && - (p = Py_GETENV("PYTHONINSPECT")) && *p != '\0') - { - Py_InspectFlag = 1; - } - - if (Py_InspectFlag && stdin_is_interactive && - (filename != NULL || command != NULL || module != NULL)) { - Py_InspectFlag = 0; - /* XXX */ - sts = PyRun_AnyFileFlags(stdin, "", &cf) != 0; - } - - Py_Finalize(); -#ifdef RISCOS - if (Py_RISCOSWimpFlag) - fprintf(stderr, "\x0cq\x0c"); /* make frontend quit */ -#endif - -#ifdef __INSURE__ - /* Insure++ is a memory analysis tool that aids in discovering - * memory leaks and other memory problems. On Python exit, the - * interned string dictionary is flagged as being in use at exit - * (which it is). Under normal circumstances, this is fine because - * the memory will be automatically reclaimed by the system. Under - * memory debugging, it's a huge source of useless noise, so we - * trade off slower shutdown for less distraction in the memory - * reports. -baw - */ - _Py_ReleaseInternedStrings(); -#endif /* __INSURE__ */ - - return sts; -} - -/* this is gonna seem *real weird*, but if you put some other code between - Py_Main() and Py_GetArgcArgv() you will need to adjust the test in the - while statement in Misc/gdbinit:ppystack */ - -/* Make the *original* argc/argv available to other modules. - This is rare, but it is needed by the secureware extension. */ - -void -Py_GetArgcArgv(int *argc, char ***argv) -{ - *argc = orig_argc; - *argv = orig_argv; -} - -#ifdef __cplusplus -} -#endif - diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/selectmodule.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/selectmodule.c deleted file mode 100644 index a62774a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/selectmodule.c +++ /dev/null @@ -1,1967 +0,0 @@ -/* @file - select - Module containing unix select(2) call. - Under Unix, the file descriptors are small integers. - Under Win32, select only exists for sockets, and sockets may - have any value except INVALID_SOCKET. - Under BeOS, we suffer the same dichotomy as Win32; sockets can be anything - >= 0. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -*/ - -#include "Python.h" -#include - -#ifdef __APPLE__ - /* Perform runtime testing for a broken poll on OSX to make it easier - * to use the same binary on multiple releases of the OS. - */ -#undef HAVE_BROKEN_POLL -#endif - -/* Windows #defines FD_SETSIZE to 64 if FD_SETSIZE isn't already defined. - 64 is too small (too many people have bumped into that limit). - Here we boost it. - Users who want even more than the boosted limit should #define - FD_SETSIZE higher before this; e.g., via compiler /D switch. -*/ -#if defined(MS_WINDOWS) && !defined(FD_SETSIZE) -#define FD_SETSIZE 512 -#endif - -#if defined(HAVE_POLL_H) -#include -#elif defined(HAVE_SYS_POLL_H) -#include -#endif - -#ifdef __sgi -/* This is missing from unistd.h */ -extern void bzero(void *, int); -#endif - -#ifdef HAVE_SYS_TYPES_H -#include -#endif - -#if defined(PYOS_OS2) && !defined(PYCC_GCC) -#include -#include -#endif - -#ifdef MS_WINDOWS -# include -#else -# define SOCKET int -# ifdef __BEOS__ -# include -# elif defined(__VMS) -# include -# endif -#endif - -static PyObject *SelectError; - -/* list of Python objects and their file descriptor */ -typedef struct { - PyObject *obj; /* owned reference */ - SOCKET fd; - int sentinel; /* -1 == sentinel */ -} pylist; - -static void -reap_obj(pylist fd2obj[FD_SETSIZE + 1]) -{ - int i; - for (i = 0; i < FD_SETSIZE + 1 && fd2obj[i].sentinel >= 0; i++) { - Py_CLEAR(fd2obj[i].obj); - } - fd2obj[0].sentinel = -1; -} - - -/* returns -1 and sets the Python exception if an error occurred, otherwise - returns a number >= 0 -*/ -static int -seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1]) -{ - int i; - int max = -1; - int index = 0; - PyObject* fast_seq = NULL; - PyObject* o = NULL; - - fd2obj[0].obj = (PyObject*)0; /* set list to zero size */ - FD_ZERO(set); - - fast_seq = PySequence_Fast(seq, "arguments 1-3 must be sequences"); - if (!fast_seq) - return -1; - - for (i = 0; i < PySequence_Fast_GET_SIZE(fast_seq); i++) { - SOCKET v; - - /* any intervening fileno() calls could decr this refcnt */ - if (!(o = PySequence_Fast_GET_ITEM(fast_seq, i))) - return -1; - - Py_INCREF(o); - v = PyObject_AsFileDescriptor( o ); - if (v == -1) goto finally; - -#if defined(_MSC_VER) && !defined(UEFI_C_SOURCE) - max = 0; /* not used for Win32 */ -#else /* !_MSC_VER */ - if (!_PyIsSelectable_fd(v)) { - PyErr_SetString(PyExc_ValueError, - "filedescriptor out of range in select()"); - goto finally; - } - if (v > max) - max = v; -#endif /* _MSC_VER */ - FD_SET(v, set); - - /* add object and its file descriptor to the list */ - if (index >= FD_SETSIZE) { - PyErr_SetString(PyExc_ValueError, - "too many file descriptors in select()"); - goto finally; - } - fd2obj[index].obj = o; - fd2obj[index].fd = v; - fd2obj[index].sentinel = 0; - fd2obj[++index].sentinel = -1; - } - Py_DECREF(fast_seq); - return max+1; - - finally: - Py_XDECREF(o); - Py_DECREF(fast_seq); - return -1; -} - -/* returns NULL and sets the Python exception if an error occurred */ -static PyObject * -set2list(fd_set *set, pylist fd2obj[FD_SETSIZE + 1]) -{ - int i, j, count=0; - PyObject *list, *o; - SOCKET fd; - - for (j = 0; fd2obj[j].sentinel >= 0; j++) { - if (FD_ISSET(fd2obj[j].fd, set)) - count++; - } - list = PyList_New(count); - if (!list) - return NULL; - - i = 0; - for (j = 0; fd2obj[j].sentinel >= 0; j++) { - fd = fd2obj[j].fd; - if (FD_ISSET(fd, set)) { - o = fd2obj[j].obj; - fd2obj[j].obj = NULL; - /* transfer ownership */ - if (PyList_SetItem(list, i, o) < 0) - goto finally; - - i++; - } - } - return list; - finally: - Py_DECREF(list); - return NULL; -} - -#undef SELECT_USES_HEAP -#if FD_SETSIZE > 1024 -#define SELECT_USES_HEAP -#endif /* FD_SETSIZE > 1024 */ - -static PyObject * -select_select(PyObject *self, PyObject *args) -{ -#ifdef SELECT_USES_HEAP - pylist *rfd2obj, *wfd2obj, *efd2obj; -#else /* !SELECT_USES_HEAP */ - /* XXX: All this should probably be implemented as follows: - * - find the highest descriptor we're interested in - * - add one - * - that's the size - * See: Stevens, APitUE, $12.5.1 - */ - pylist rfd2obj[FD_SETSIZE + 1]; - pylist wfd2obj[FD_SETSIZE + 1]; - pylist efd2obj[FD_SETSIZE + 1]; -#endif /* SELECT_USES_HEAP */ - PyObject *ifdlist, *ofdlist, *efdlist; - PyObject *ret = NULL; - PyObject *tout = Py_None; - fd_set ifdset, ofdset, efdset; - double timeout; - struct timeval tv, *tvp; - long seconds; - int imax, omax, emax, max; - int n; - - /* convert arguments */ - if (!PyArg_UnpackTuple(args, "select", 3, 4, - &ifdlist, &ofdlist, &efdlist, &tout)) - return NULL; - - if (tout == Py_None) - tvp = (struct timeval *)0; - else if (!PyNumber_Check(tout)) { - PyErr_SetString(PyExc_TypeError, - "timeout must be a float or None"); - return NULL; - } - else { - timeout = PyFloat_AsDouble(tout); - if (timeout == -1 && PyErr_Occurred()) - return NULL; - if (timeout > (double)LONG_MAX) { - PyErr_SetString(PyExc_OverflowError, - "timeout period too long"); - return NULL; - } - seconds = (long)timeout; - timeout = timeout - (double)seconds; - tv.tv_sec = seconds; - tv.tv_usec = (long)(timeout * 1E6); - tvp = &tv; - } - - -#ifdef SELECT_USES_HEAP - /* Allocate memory for the lists */ - rfd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1); - wfd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1); - efd2obj = PyMem_NEW(pylist, FD_SETSIZE + 1); - if (rfd2obj == NULL || wfd2obj == NULL || efd2obj == NULL) { - if (rfd2obj) PyMem_DEL(rfd2obj); - if (wfd2obj) PyMem_DEL(wfd2obj); - if (efd2obj) PyMem_DEL(efd2obj); - return PyErr_NoMemory(); - } -#endif /* SELECT_USES_HEAP */ - /* Convert sequences to fd_sets, and get maximum fd number - * propagates the Python exception set in seq2set() - */ - rfd2obj[0].sentinel = -1; - wfd2obj[0].sentinel = -1; - efd2obj[0].sentinel = -1; - if ((imax=seq2set(ifdlist, &ifdset, rfd2obj)) < 0) - goto finally; - if ((omax=seq2set(ofdlist, &ofdset, wfd2obj)) < 0) - goto finally; - if ((emax=seq2set(efdlist, &efdset, efd2obj)) < 0) - goto finally; - max = imax; - if (omax > max) max = omax; - if (emax > max) max = emax; - - Py_BEGIN_ALLOW_THREADS - n = select(max, &ifdset, &ofdset, &efdset, tvp); - Py_END_ALLOW_THREADS - -#ifdef MS_WINDOWS - if (n == SOCKET_ERROR) { - PyErr_SetExcFromWindowsErr(SelectError, WSAGetLastError()); - } -#else - if (n < 0) { - PyErr_SetFromErrno(SelectError); - } -#endif - else { - /* any of these three calls can raise an exception. it's more - convenient to test for this after all three calls... but - is that acceptable? - */ - ifdlist = set2list(&ifdset, rfd2obj); - ofdlist = set2list(&ofdset, wfd2obj); - efdlist = set2list(&efdset, efd2obj); - if (PyErr_Occurred()) - ret = NULL; - else - ret = PyTuple_Pack(3, ifdlist, ofdlist, efdlist); - - Py_DECREF(ifdlist); - Py_DECREF(ofdlist); - Py_DECREF(efdlist); - } - - finally: - reap_obj(rfd2obj); - reap_obj(wfd2obj); - reap_obj(efd2obj); -#ifdef SELECT_USES_HEAP - PyMem_DEL(rfd2obj); - PyMem_DEL(wfd2obj); - PyMem_DEL(efd2obj); -#endif /* SELECT_USES_HEAP */ - return ret; -} - -#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) -/* - * poll() support - */ - -typedef struct { - PyObject_HEAD - PyObject *dict; - int ufd_uptodate; - int ufd_len; - struct pollfd *ufds; - int poll_running; -} pollObject; - -static PyTypeObject poll_Type; - -/* Update the malloc'ed array of pollfds to match the dictionary - contained within a pollObject. Return 1 on success, 0 on an error. -*/ - -static int -update_ufd_array(pollObject *self) -{ - Py_ssize_t i, pos; - PyObject *key, *value; - struct pollfd *old_ufds = self->ufds; - - self->ufd_len = PyDict_Size(self->dict); - PyMem_RESIZE(self->ufds, struct pollfd, self->ufd_len); - if (self->ufds == NULL) { - self->ufds = old_ufds; - PyErr_NoMemory(); - return 0; - } - - i = pos = 0; - while (PyDict_Next(self->dict, &pos, &key, &value)) { - assert(i < self->ufd_len); - /* Never overflow */ - self->ufds[i].fd = (int)PyInt_AsLong(key); - self->ufds[i].events = (short)(unsigned short)PyInt_AsLong(value); - i++; - } - assert(i == self->ufd_len); - self->ufd_uptodate = 1; - return 1; -} - -static int -ushort_converter(PyObject *obj, void *ptr) -{ - unsigned long uval; - - uval = PyLong_AsUnsignedLong(obj); - if (uval == (unsigned long)-1 && PyErr_Occurred()) - return 0; - if (uval > USHRT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "Python int too large for C unsigned short"); - return 0; - } - - *(unsigned short *)ptr = Py_SAFE_DOWNCAST(uval, unsigned long, unsigned short); - return 1; -} - -PyDoc_STRVAR(poll_register_doc, -"register(fd [, eventmask] ) -> None\n\n\ -Register a file descriptor with the polling object.\n\ -fd -- either an integer, or an object with a fileno() method returning an\n\ - int.\n\ -events -- an optional bitmask describing the type of events to check for"); - -static PyObject * -poll_register(pollObject *self, PyObject *args) -{ - PyObject *o, *key, *value; - int fd; - unsigned short events = POLLIN | POLLPRI | POLLOUT; - int err; - - if (!PyArg_ParseTuple(args, "O|O&:register", &o, ushort_converter, &events)) - return NULL; - - fd = PyObject_AsFileDescriptor(o); - if (fd == -1) return NULL; - - /* Add entry to the internal dictionary: the key is the - file descriptor, and the value is the event mask. */ - key = PyInt_FromLong(fd); - if (key == NULL) - return NULL; - value = PyInt_FromLong(events); - if (value == NULL) { - Py_DECREF(key); - return NULL; - } - err = PyDict_SetItem(self->dict, key, value); - Py_DECREF(key); - Py_DECREF(value); - if (err < 0) - return NULL; - - self->ufd_uptodate = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(poll_modify_doc, -"modify(fd, eventmask) -> None\n\n\ -Modify an already registered file descriptor.\n\ -fd -- either an integer, or an object with a fileno() method returning an\n\ - int.\n\ -events -- an optional bitmask describing the type of events to check for"); - -static PyObject * -poll_modify(pollObject *self, PyObject *args) -{ - PyObject *o, *key, *value; - int fd; - unsigned short events; - int err; - - if (!PyArg_ParseTuple(args, "OO&:modify", &o, ushort_converter, &events)) - return NULL; - - fd = PyObject_AsFileDescriptor(o); - if (fd == -1) return NULL; - - /* Modify registered fd */ - key = PyInt_FromLong(fd); - if (key == NULL) - return NULL; - if (PyDict_GetItem(self->dict, key) == NULL) { - errno = ENOENT; - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - value = PyInt_FromLong(events); - if (value == NULL) { - Py_DECREF(key); - return NULL; - } - err = PyDict_SetItem(self->dict, key, value); - Py_DECREF(key); - Py_DECREF(value); - if (err < 0) - return NULL; - - self->ufd_uptodate = 0; - - Py_INCREF(Py_None); - return Py_None; -} - - -PyDoc_STRVAR(poll_unregister_doc, -"unregister(fd) -> None\n\n\ -Remove a file descriptor being tracked by the polling object."); - -static PyObject * -poll_unregister(pollObject *self, PyObject *o) -{ - PyObject *key; - int fd; - - fd = PyObject_AsFileDescriptor( o ); - if (fd == -1) - return NULL; - - /* Check whether the fd is already in the array */ - key = PyInt_FromLong(fd); - if (key == NULL) - return NULL; - - if (PyDict_DelItem(self->dict, key) == -1) { - Py_DECREF(key); - /* This will simply raise the KeyError set by PyDict_DelItem - if the file descriptor isn't registered. */ - return NULL; - } - - Py_DECREF(key); - self->ufd_uptodate = 0; - - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(poll_poll_doc, -"poll( [timeout] ) -> list of (fd, event) 2-tuples\n\n\ -Polls the set of registered file descriptors, returning a list containing \n\ -any descriptors that have events or errors to report."); - -static PyObject * -poll_poll(pollObject *self, PyObject *args) -{ - PyObject *result_list = NULL, *tout = NULL; - int timeout = 0, poll_result, i, j; - PyObject *value = NULL, *num = NULL; - - if (!PyArg_UnpackTuple(args, "poll", 0, 1, &tout)) { - return NULL; - } - - /* Check values for timeout */ - if (tout == NULL || tout == Py_None) - timeout = -1; - else if (!PyNumber_Check(tout)) { - PyErr_SetString(PyExc_TypeError, - "timeout must be an integer or None"); - return NULL; - } - else { - tout = PyNumber_Int(tout); - if (!tout) - return NULL; - timeout = _PyInt_AsInt(tout); - Py_DECREF(tout); - if (timeout == -1 && PyErr_Occurred()) - return NULL; - } - - /* Avoid concurrent poll() invocation, issue 8865 */ - if (self->poll_running) { - PyErr_SetString(PyExc_RuntimeError, - "concurrent poll() invocation"); - return NULL; - } - - /* Ensure the ufd array is up to date */ - if (!self->ufd_uptodate) - if (update_ufd_array(self) == 0) - return NULL; - - self->poll_running = 1; - - /* call poll() */ - Py_BEGIN_ALLOW_THREADS - poll_result = poll(self->ufds, self->ufd_len, timeout); - Py_END_ALLOW_THREADS - - self->poll_running = 0; - - if (poll_result < 0) { - PyErr_SetFromErrno(SelectError); - return NULL; - } - - /* build the result list */ - - result_list = PyList_New(poll_result); - if (!result_list) - return NULL; - else { - for (i = 0, j = 0; j < poll_result; j++) { - /* skip to the next fired descriptor */ - while (!self->ufds[i].revents) { - i++; - } - /* if we hit a NULL return, set value to NULL - and break out of loop; code at end will - clean up result_list */ - value = PyTuple_New(2); - if (value == NULL) - goto error; - num = PyInt_FromLong(self->ufds[i].fd); - if (num == NULL) { - Py_DECREF(value); - goto error; - } - PyTuple_SET_ITEM(value, 0, num); - - /* The &0xffff is a workaround for AIX. 'revents' - is a 16-bit short, and IBM assigned POLLNVAL - to be 0x8000, so the conversion to int results - in a negative number. See SF bug #923315. */ - num = PyInt_FromLong(self->ufds[i].revents & 0xffff); - if (num == NULL) { - Py_DECREF(value); - goto error; - } - PyTuple_SET_ITEM(value, 1, num); - if ((PyList_SetItem(result_list, j, value)) == -1) { - Py_DECREF(value); - goto error; - } - i++; - } - } - return result_list; - - error: - Py_DECREF(result_list); - return NULL; -} - -static PyMethodDef poll_methods[] = { - {"register", (PyCFunction)poll_register, - METH_VARARGS, poll_register_doc}, - {"modify", (PyCFunction)poll_modify, - METH_VARARGS, poll_modify_doc}, - {"unregister", (PyCFunction)poll_unregister, - METH_O, poll_unregister_doc}, - {"poll", (PyCFunction)poll_poll, - METH_VARARGS, poll_poll_doc}, - {NULL, NULL} /* sentinel */ -}; - -static pollObject * -newPollObject(void) -{ - pollObject *self; - self = PyObject_New(pollObject, &poll_Type); - if (self == NULL) - return NULL; - /* ufd_uptodate is a Boolean, denoting whether the - array pointed to by ufds matches the contents of the dictionary. */ - self->ufd_uptodate = 0; - self->ufds = NULL; - self->poll_running = 0; - self->dict = PyDict_New(); - if (self->dict == NULL) { - Py_DECREF(self); - return NULL; - } - return self; -} - -static void -poll_dealloc(pollObject *self) -{ - if (self->ufds != NULL) - PyMem_DEL(self->ufds); - Py_XDECREF(self->dict); - PyObject_Del(self); -} - -static PyObject * -poll_getattr(pollObject *self, char *name) -{ - return Py_FindMethod(poll_methods, (PyObject *)self, name); -} - -static PyTypeObject poll_Type = { - /* The ob_type field must be initialized in the module init function - * to be portable to Windows without using C++. */ - PyVarObject_HEAD_INIT(NULL, 0) - "select.poll", /*tp_name*/ - sizeof(pollObject), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - /* methods */ - (destructor)poll_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - (getattrfunc)poll_getattr, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash*/ -}; - -PyDoc_STRVAR(poll_doc, -"Returns a polling object, which supports registering and\n\ -unregistering file descriptors, and then polling them for I/O events."); - -static PyObject * -select_poll(PyObject *self, PyObject *unused) -{ - return (PyObject *)newPollObject(); -} - -#ifdef __APPLE__ -/* - * On some systems poll() sets errno on invalid file descriptors. We test - * for this at runtime because this bug may be fixed or introduced between - * OS releases. - */ -static int select_have_broken_poll(void) -{ - int poll_test; - int filedes[2]; - - struct pollfd poll_struct = { 0, POLLIN|POLLPRI|POLLOUT, 0 }; - - /* Create a file descriptor to make invalid */ - if (pipe(filedes) < 0) { - return 1; - } - poll_struct.fd = filedes[0]; - close(filedes[0]); - close(filedes[1]); - poll_test = poll(&poll_struct, 1, 0); - if (poll_test < 0) { - return 1; - } else if (poll_test == 0 && poll_struct.revents != POLLNVAL) { - return 1; - } - return 0; -} -#endif /* __APPLE__ */ - -#endif /* HAVE_POLL */ - -#ifdef HAVE_EPOLL -/* ************************************************************************** - * epoll interface for Linux 2.6 - * - * Written by Christian Heimes - * Inspired by Twisted's _epoll.pyx and select.poll() - */ - -#ifdef HAVE_SYS_EPOLL_H -#include -#endif - -typedef struct { - PyObject_HEAD - SOCKET epfd; /* epoll control file descriptor */ -} pyEpoll_Object; - -static PyTypeObject pyEpoll_Type; -#define pyepoll_CHECK(op) (PyObject_TypeCheck((op), &pyEpoll_Type)) - -static PyObject * -pyepoll_err_closed(void) -{ - PyErr_SetString(PyExc_ValueError, "I/O operation on closed epoll fd"); - return NULL; -} - -static int -pyepoll_internal_close(pyEpoll_Object *self) -{ - int save_errno = 0; - if (self->epfd >= 0) { - int epfd = self->epfd; - self->epfd = -1; - Py_BEGIN_ALLOW_THREADS - if (close(epfd) < 0) - save_errno = errno; - Py_END_ALLOW_THREADS - } - return save_errno; -} - -static PyObject * -newPyEpoll_Object(PyTypeObject *type, int sizehint, SOCKET fd) -{ - pyEpoll_Object *self; - - if (sizehint == -1) { - sizehint = FD_SETSIZE-1; - } - else if (sizehint < 1) { - PyErr_Format(PyExc_ValueError, - "sizehint must be greater zero, got %d", - sizehint); - return NULL; - } - - assert(type != NULL && type->tp_alloc != NULL); - self = (pyEpoll_Object *) type->tp_alloc(type, 0); - if (self == NULL) - return NULL; - - if (fd == -1) { - Py_BEGIN_ALLOW_THREADS - self->epfd = epoll_create(sizehint); - Py_END_ALLOW_THREADS - } - else { - self->epfd = fd; - } - if (self->epfd < 0) { - Py_DECREF(self); - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - return (PyObject *)self; -} - - -static PyObject * -pyepoll_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - int sizehint = -1; - static char *kwlist[] = {"sizehint", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|i:epoll", kwlist, - &sizehint)) - return NULL; - - return newPyEpoll_Object(type, sizehint, -1); -} - - -static void -pyepoll_dealloc(pyEpoll_Object *self) -{ - (void)pyepoll_internal_close(self); - Py_TYPE(self)->tp_free(self); -} - -static PyObject* -pyepoll_close(pyEpoll_Object *self) -{ - errno = pyepoll_internal_close(self); - if (errno < 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - Py_RETURN_NONE; -} - -PyDoc_STRVAR(pyepoll_close_doc, -"close() -> None\n\ -\n\ -Close the epoll control file descriptor. Further operations on the epoll\n\ -object will raise an exception."); - -static PyObject* -pyepoll_get_closed(pyEpoll_Object *self) -{ - if (self->epfd < 0) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -} - -static PyObject* -pyepoll_fileno(pyEpoll_Object *self) -{ - if (self->epfd < 0) - return pyepoll_err_closed(); - return PyInt_FromLong(self->epfd); -} - -PyDoc_STRVAR(pyepoll_fileno_doc, -"fileno() -> int\n\ -\n\ -Return the epoll control file descriptor."); - -static PyObject* -pyepoll_fromfd(PyObject *cls, PyObject *args) -{ - SOCKET fd; - - if (!PyArg_ParseTuple(args, "i:fromfd", &fd)) - return NULL; - - return newPyEpoll_Object((PyTypeObject*)cls, -1, fd); -} - -PyDoc_STRVAR(pyepoll_fromfd_doc, -"fromfd(fd) -> epoll\n\ -\n\ -Create an epoll object from a given control fd."); - -static PyObject * -pyepoll_internal_ctl(int epfd, int op, PyObject *pfd, unsigned int events) -{ - struct epoll_event ev; - int result; - int fd; - - if (epfd < 0) - return pyepoll_err_closed(); - - fd = PyObject_AsFileDescriptor(pfd); - if (fd == -1) { - return NULL; - } - - switch(op) { - case EPOLL_CTL_ADD: - case EPOLL_CTL_MOD: - ev.events = events; - ev.data.fd = fd; - Py_BEGIN_ALLOW_THREADS - result = epoll_ctl(epfd, op, fd, &ev); - Py_END_ALLOW_THREADS - break; - case EPOLL_CTL_DEL: - /* In kernel versions before 2.6.9, the EPOLL_CTL_DEL - * operation required a non-NULL pointer in event, even - * though this argument is ignored. */ - Py_BEGIN_ALLOW_THREADS - result = epoll_ctl(epfd, op, fd, &ev); - if (errno == EBADF) { - /* fd already closed */ - result = 0; - errno = 0; - } - Py_END_ALLOW_THREADS - break; - default: - result = -1; - errno = EINVAL; - } - - if (result < 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - Py_RETURN_NONE; -} - -static PyObject * -pyepoll_register(pyEpoll_Object *self, PyObject *args, PyObject *kwds) -{ - PyObject *pfd; - unsigned int events = EPOLLIN | EPOLLOUT | EPOLLPRI; - static char *kwlist[] = {"fd", "eventmask", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|I:register", kwlist, - &pfd, &events)) { - return NULL; - } - - return pyepoll_internal_ctl(self->epfd, EPOLL_CTL_ADD, pfd, events); -} - -PyDoc_STRVAR(pyepoll_register_doc, -"register(fd[, eventmask]) -> None\n\ -\n\ -Registers a new fd or raises an IOError if the fd is already registered.\n\ -fd is the target file descriptor of the operation.\n\ -events is a bit set composed of the various EPOLL constants; the default\n\ -is EPOLL_IN | EPOLL_OUT | EPOLL_PRI.\n\ -\n\ -The epoll interface supports all file descriptors that support poll."); - -static PyObject * -pyepoll_modify(pyEpoll_Object *self, PyObject *args, PyObject *kwds) -{ - PyObject *pfd; - unsigned int events; - static char *kwlist[] = {"fd", "eventmask", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OI:modify", kwlist, - &pfd, &events)) { - return NULL; - } - - return pyepoll_internal_ctl(self->epfd, EPOLL_CTL_MOD, pfd, events); -} - -PyDoc_STRVAR(pyepoll_modify_doc, -"modify(fd, eventmask) -> None\n\ -\n\ -fd is the target file descriptor of the operation\n\ -events is a bit set composed of the various EPOLL constants"); - -static PyObject * -pyepoll_unregister(pyEpoll_Object *self, PyObject *args, PyObject *kwds) -{ - PyObject *pfd; - static char *kwlist[] = {"fd", NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:unregister", kwlist, - &pfd)) { - return NULL; - } - - return pyepoll_internal_ctl(self->epfd, EPOLL_CTL_DEL, pfd, 0); -} - -PyDoc_STRVAR(pyepoll_unregister_doc, -"unregister(fd) -> None\n\ -\n\ -fd is the target file descriptor of the operation."); - -static PyObject * -pyepoll_poll(pyEpoll_Object *self, PyObject *args, PyObject *kwds) -{ - double dtimeout = -1.; - int timeout; - int maxevents = -1; - int nfds, i; - PyObject *elist = NULL, *etuple = NULL; - struct epoll_event *evs = NULL; - static char *kwlist[] = {"timeout", "maxevents", NULL}; - - if (self->epfd < 0) - return pyepoll_err_closed(); - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|di:poll", kwlist, - &dtimeout, &maxevents)) { - return NULL; - } - - if (dtimeout < 0) { - timeout = -1; - } - else if (dtimeout * 1000.0 > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "timeout is too large"); - return NULL; - } - else { - timeout = (int)(dtimeout * 1000.0); - } - - if (maxevents == -1) { - maxevents = FD_SETSIZE-1; - } - else if (maxevents < 1) { - PyErr_Format(PyExc_ValueError, - "maxevents must be greater than 0, got %d", - maxevents); - return NULL; - } - - evs = PyMem_New(struct epoll_event, maxevents); - if (evs == NULL) { - Py_DECREF(self); - PyErr_NoMemory(); - return NULL; - } - - Py_BEGIN_ALLOW_THREADS - nfds = epoll_wait(self->epfd, evs, maxevents, timeout); - Py_END_ALLOW_THREADS - if (nfds < 0) { - PyErr_SetFromErrno(PyExc_IOError); - goto error; - } - - elist = PyList_New(nfds); - if (elist == NULL) { - goto error; - } - - for (i = 0; i < nfds; i++) { - etuple = Py_BuildValue("iI", evs[i].data.fd, evs[i].events); - if (etuple == NULL) { - Py_CLEAR(elist); - goto error; - } - PyList_SET_ITEM(elist, i, etuple); - } - - error: - PyMem_Free(evs); - return elist; -} - -PyDoc_STRVAR(pyepoll_poll_doc, -"poll([timeout=-1[, maxevents=-1]]) -> [(fd, events), (...)]\n\ -\n\ -Wait for events on the epoll file descriptor for a maximum time of timeout\n\ -in seconds (as float). -1 makes poll wait indefinitely.\n\ -Up to maxevents are returned to the caller."); - -static PyMethodDef pyepoll_methods[] = { - {"fromfd", (PyCFunction)pyepoll_fromfd, - METH_VARARGS | METH_CLASS, pyepoll_fromfd_doc}, - {"close", (PyCFunction)pyepoll_close, METH_NOARGS, - pyepoll_close_doc}, - {"fileno", (PyCFunction)pyepoll_fileno, METH_NOARGS, - pyepoll_fileno_doc}, - {"modify", (PyCFunction)pyepoll_modify, - METH_VARARGS | METH_KEYWORDS, pyepoll_modify_doc}, - {"register", (PyCFunction)pyepoll_register, - METH_VARARGS | METH_KEYWORDS, pyepoll_register_doc}, - {"unregister", (PyCFunction)pyepoll_unregister, - METH_VARARGS | METH_KEYWORDS, pyepoll_unregister_doc}, - {"poll", (PyCFunction)pyepoll_poll, - METH_VARARGS | METH_KEYWORDS, pyepoll_poll_doc}, - {NULL, NULL}, -}; - -static PyGetSetDef pyepoll_getsetlist[] = { - {"closed", (getter)pyepoll_get_closed, NULL, - "True if the epoll handler is closed"}, - {0}, -}; - -PyDoc_STRVAR(pyepoll_doc, -"select.epoll([sizehint=-1])\n\ -\n\ -Returns an epolling object\n\ -\n\ -sizehint must be a positive integer or -1 for the default size. The\n\ -sizehint is used to optimize internal data structures. It doesn't limit\n\ -the maximum number of monitored events."); - -static PyTypeObject pyEpoll_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "select.epoll", /* tp_name */ - sizeof(pyEpoll_Object), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)pyepoll_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - pyepoll_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - pyepoll_methods, /* tp_methods */ - 0, /* tp_members */ - pyepoll_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - pyepoll_new, /* tp_new */ - 0, /* tp_free */ -}; - -#endif /* HAVE_EPOLL */ - -#ifdef HAVE_KQUEUE -/* ************************************************************************** - * kqueue interface for BSD - * - * Copyright (c) 2000 Doug White, 2006 James Knight, 2007 Christian Heimes - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifdef HAVE_SYS_EVENT_H -#include -#endif - -PyDoc_STRVAR(kqueue_event_doc, -"kevent(ident, filter=KQ_FILTER_READ, flags=KQ_EV_ADD, fflags=0, data=0, udata=0)\n\ -\n\ -This object is the equivalent of the struct kevent for the C API.\n\ -\n\ -See the kqueue manpage for more detailed information about the meaning\n\ -of the arguments.\n\ -\n\ -One minor note: while you might hope that udata could store a\n\ -reference to a python object, it cannot, because it is impossible to\n\ -keep a proper reference count of the object once it's passed into the\n\ -kernel. Therefore, I have restricted it to only storing an integer. I\n\ -recommend ignoring it and simply using the 'ident' field to key off\n\ -of. You could also set up a dictionary on the python side to store a\n\ -udata->object mapping."); - -typedef struct { - PyObject_HEAD - struct kevent e; -} kqueue_event_Object; - -static PyTypeObject kqueue_event_Type; - -#define kqueue_event_Check(op) (PyObject_TypeCheck((op), &kqueue_event_Type)) - -typedef struct { - PyObject_HEAD - SOCKET kqfd; /* kqueue control fd */ -} kqueue_queue_Object; - -static PyTypeObject kqueue_queue_Type; - -#define kqueue_queue_Check(op) (PyObject_TypeCheck((op), &kqueue_queue_Type)) - -#if (SIZEOF_UINTPTR_T != SIZEOF_VOID_P) -# error uintptr_t does not match void *! -#elif (SIZEOF_UINTPTR_T == SIZEOF_LONG_LONG) -# define T_UINTPTRT T_ULONGLONG -# define T_INTPTRT T_LONGLONG -# define PyLong_AsUintptr_t PyLong_AsUnsignedLongLong -# define UINTPTRT_FMT_UNIT "K" -# define INTPTRT_FMT_UNIT "L" -#elif (SIZEOF_UINTPTR_T == SIZEOF_LONG) -# define T_UINTPTRT T_ULONG -# define T_INTPTRT T_LONG -# define PyLong_AsUintptr_t PyLong_AsUnsignedLong -# define UINTPTRT_FMT_UNIT "k" -# define INTPTRT_FMT_UNIT "l" -#elif (SIZEOF_UINTPTR_T == SIZEOF_INT) -# define T_UINTPTRT T_UINT -# define T_INTPTRT T_INT -# define PyLong_AsUintptr_t PyLong_AsUnsignedLong -# define UINTPTRT_FMT_UNIT "I" -# define INTPTRT_FMT_UNIT "i" -#else -# error uintptr_t does not match int, long, or long long! -#endif - -/* - * kevent is not standard and its members vary across BSDs. - */ -#if !defined(__OpenBSD__) -# define IDENT_TYPE T_UINTPTRT -# define IDENT_CAST Py_intptr_t -# define DATA_TYPE T_INTPTRT -# define DATA_FMT_UNIT INTPTRT_FMT_UNIT -# define IDENT_AsType PyLong_AsUintptr_t -#else -# define IDENT_TYPE T_UINT -# define IDENT_CAST int -# define DATA_TYPE T_INT -# define DATA_FMT_UNIT "i" -# define IDENT_AsType PyLong_AsUnsignedLong -#endif - -/* Unfortunately, we can't store python objects in udata, because - * kevents in the kernel can be removed without warning, which would - * forever lose the refcount on the object stored with it. - */ - -#define KQ_OFF(x) offsetof(kqueue_event_Object, x) -static struct PyMemberDef kqueue_event_members[] = { - {"ident", IDENT_TYPE, KQ_OFF(e.ident)}, - {"filter", T_SHORT, KQ_OFF(e.filter)}, - {"flags", T_USHORT, KQ_OFF(e.flags)}, - {"fflags", T_UINT, KQ_OFF(e.fflags)}, - {"data", DATA_TYPE, KQ_OFF(e.data)}, - {"udata", T_UINTPTRT, KQ_OFF(e.udata)}, - {NULL} /* Sentinel */ -}; -#undef KQ_OFF - -static PyObject * - -kqueue_event_repr(kqueue_event_Object *s) -{ - char buf[1024]; - PyOS_snprintf( - buf, sizeof(buf), - "", - (size_t)(s->e.ident), s->e.filter, s->e.flags, - s->e.fflags, (Py_ssize_t)(s->e.data), s->e.udata); - return PyString_FromString(buf); -} - -static int -kqueue_event_init(kqueue_event_Object *self, PyObject *args, PyObject *kwds) -{ - PyObject *pfd; - static char *kwlist[] = {"ident", "filter", "flags", "fflags", - "data", "udata", NULL}; - static char *fmt = "O|hHI" DATA_FMT_UNIT UINTPTRT_FMT_UNIT ":kevent"; - - EV_SET(&(self->e), 0, EVFILT_READ, EV_ADD, 0, 0, 0); /* defaults */ - - if (!PyArg_ParseTupleAndKeywords(args, kwds, fmt, kwlist, - &pfd, &(self->e.filter), &(self->e.flags), - &(self->e.fflags), &(self->e.data), &(self->e.udata))) { - return -1; - } - - if (PyLong_Check(pfd) -#if IDENT_TYPE == T_UINT - && PyLong_AsUnsignedLong(pfd) <= UINT_MAX -#endif - ) { - self->e.ident = IDENT_AsType(pfd); - } - else { - self->e.ident = PyObject_AsFileDescriptor(pfd); - } - if (PyErr_Occurred()) { - return -1; - } - return 0; -} - -static PyObject * -kqueue_event_richcompare(kqueue_event_Object *s, kqueue_event_Object *o, - int op) -{ - Py_intptr_t result = 0; - - if (!kqueue_event_Check(o)) { - if (op == Py_EQ || op == Py_NE) { - PyObject *res = op == Py_EQ ? Py_False : Py_True; - Py_INCREF(res); - return res; - } - PyErr_Format(PyExc_TypeError, - "can't compare %.200s to %.200s", - Py_TYPE(s)->tp_name, Py_TYPE(o)->tp_name); - return NULL; - } - if (((result = (IDENT_CAST)(s->e.ident - o->e.ident)) == 0) && - ((result = s->e.filter - o->e.filter) == 0) && - ((result = s->e.flags - o->e.flags) == 0) && - ((result = (int)(s->e.fflags - o->e.fflags)) == 0) && - ((result = s->e.data - o->e.data) == 0) && - ((result = s->e.udata - o->e.udata) == 0) - ) { - result = 0; - } - - switch (op) { - case Py_EQ: - result = (result == 0); - break; - case Py_NE: - result = (result != 0); - break; - case Py_LE: - result = (result <= 0); - break; - case Py_GE: - result = (result >= 0); - break; - case Py_LT: - result = (result < 0); - break; - case Py_GT: - result = (result > 0); - break; - } - return PyBool_FromLong((long)result); -} - -static PyTypeObject kqueue_event_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "select.kevent", /* tp_name */ - sizeof(kqueue_event_Object), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)kqueue_event_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - kqueue_event_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - (richcmpfunc)kqueue_event_richcompare, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - kqueue_event_members, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)kqueue_event_init, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ - 0, /* tp_free */ -}; - -static PyObject * -kqueue_queue_err_closed(void) -{ - PyErr_SetString(PyExc_ValueError, "I/O operation on closed kqueue fd"); - return NULL; -} - -static int -kqueue_queue_internal_close(kqueue_queue_Object *self) -{ - int save_errno = 0; - if (self->kqfd >= 0) { - int kqfd = self->kqfd; - self->kqfd = -1; - Py_BEGIN_ALLOW_THREADS - if (close(kqfd) < 0) - save_errno = errno; - Py_END_ALLOW_THREADS - } - return save_errno; -} - -static PyObject * -newKqueue_Object(PyTypeObject *type, SOCKET fd) -{ - kqueue_queue_Object *self; - assert(type != NULL && type->tp_alloc != NULL); - self = (kqueue_queue_Object *) type->tp_alloc(type, 0); - if (self == NULL) { - return NULL; - } - - if (fd == -1) { - Py_BEGIN_ALLOW_THREADS - self->kqfd = kqueue(); - Py_END_ALLOW_THREADS - } - else { - self->kqfd = fd; - } - if (self->kqfd < 0) { - Py_DECREF(self); - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - return (PyObject *)self; -} - -static PyObject * -kqueue_queue_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - - if ((args != NULL && PyObject_Size(args)) || - (kwds != NULL && PyObject_Size(kwds))) { - PyErr_SetString(PyExc_ValueError, - "select.kqueue doesn't accept arguments"); - return NULL; - } - - return newKqueue_Object(type, -1); -} - -static void -kqueue_queue_dealloc(kqueue_queue_Object *self) -{ - kqueue_queue_internal_close(self); - Py_TYPE(self)->tp_free(self); -} - -static PyObject* -kqueue_queue_close(kqueue_queue_Object *self) -{ - errno = kqueue_queue_internal_close(self); - if (errno < 0) { - PyErr_SetFromErrno(PyExc_IOError); - return NULL; - } - Py_RETURN_NONE; -} - -PyDoc_STRVAR(kqueue_queue_close_doc, -"close() -> None\n\ -\n\ -Close the kqueue control file descriptor. Further operations on the kqueue\n\ -object will raise an exception."); - -static PyObject* -kqueue_queue_get_closed(kqueue_queue_Object *self) -{ - if (self->kqfd < 0) - Py_RETURN_TRUE; - else - Py_RETURN_FALSE; -} - -static PyObject* -kqueue_queue_fileno(kqueue_queue_Object *self) -{ - if (self->kqfd < 0) - return kqueue_queue_err_closed(); - return PyInt_FromLong(self->kqfd); -} - -PyDoc_STRVAR(kqueue_queue_fileno_doc, -"fileno() -> int\n\ -\n\ -Return the kqueue control file descriptor."); - -static PyObject* -kqueue_queue_fromfd(PyObject *cls, PyObject *args) -{ - SOCKET fd; - - if (!PyArg_ParseTuple(args, "i:fromfd", &fd)) - return NULL; - - return newKqueue_Object((PyTypeObject*)cls, fd); -} - -PyDoc_STRVAR(kqueue_queue_fromfd_doc, -"fromfd(fd) -> kqueue\n\ -\n\ -Create a kqueue object from a given control fd."); - -static PyObject * -kqueue_queue_control(kqueue_queue_Object *self, PyObject *args) -{ - int nevents = 0; - int gotevents = 0; - int nchanges = 0; - int i = 0; - PyObject *otimeout = NULL; - PyObject *ch = NULL; - PyObject *it = NULL, *ei = NULL; - PyObject *result = NULL; - struct kevent *evl = NULL; - struct kevent *chl = NULL; - struct timespec timeoutspec; - struct timespec *ptimeoutspec; - - if (self->kqfd < 0) - return kqueue_queue_err_closed(); - - if (!PyArg_ParseTuple(args, "Oi|O:control", &ch, &nevents, &otimeout)) - return NULL; - - if (nevents < 0) { - PyErr_Format(PyExc_ValueError, - "Length of eventlist must be 0 or positive, got %d", - nevents); - return NULL; - } - - if (otimeout == Py_None || otimeout == NULL) { - ptimeoutspec = NULL; - } - else if (PyNumber_Check(otimeout)) { - double timeout; - long seconds; - - timeout = PyFloat_AsDouble(otimeout); - if (timeout == -1 && PyErr_Occurred()) - return NULL; - if (timeout > (double)LONG_MAX) { - PyErr_SetString(PyExc_OverflowError, - "timeout period too long"); - return NULL; - } - if (timeout < 0) { - PyErr_SetString(PyExc_ValueError, - "timeout must be positive or None"); - return NULL; - } - - seconds = (long)timeout; - timeout = timeout - (double)seconds; - timeoutspec.tv_sec = seconds; - timeoutspec.tv_nsec = (long)(timeout * 1E9); - ptimeoutspec = &timeoutspec; - } - else { - PyErr_Format(PyExc_TypeError, - "timeout argument must be an number " - "or None, got %.200s", - Py_TYPE(otimeout)->tp_name); - return NULL; - } - - if (ch != NULL && ch != Py_None) { - it = PyObject_GetIter(ch); - if (it == NULL) { - PyErr_SetString(PyExc_TypeError, - "changelist is not iterable"); - return NULL; - } - nchanges = PyObject_Size(ch); - if (nchanges < 0) { - goto error; - } - - chl = PyMem_New(struct kevent, nchanges); - if (chl == NULL) { - PyErr_NoMemory(); - goto error; - } - i = 0; - while ((ei = PyIter_Next(it)) != NULL) { - if (!kqueue_event_Check(ei)) { - Py_DECREF(ei); - PyErr_SetString(PyExc_TypeError, - "changelist must be an iterable of " - "select.kevent objects"); - goto error; - } else { - chl[i++] = ((kqueue_event_Object *)ei)->e; - } - Py_DECREF(ei); - } - } - Py_CLEAR(it); - - /* event list */ - if (nevents) { - evl = PyMem_New(struct kevent, nevents); - if (evl == NULL) { - PyErr_NoMemory(); - goto error; - } - } - - Py_BEGIN_ALLOW_THREADS - gotevents = kevent(self->kqfd, chl, nchanges, - evl, nevents, ptimeoutspec); - Py_END_ALLOW_THREADS - - if (gotevents == -1) { - PyErr_SetFromErrno(PyExc_OSError); - goto error; - } - - result = PyList_New(gotevents); - if (result == NULL) { - goto error; - } - - for (i = 0; i < gotevents; i++) { - kqueue_event_Object *ch; - - ch = PyObject_New(kqueue_event_Object, &kqueue_event_Type); - if (ch == NULL) { - goto error; - } - ch->e = evl[i]; - PyList_SET_ITEM(result, i, (PyObject *)ch); - } - PyMem_Free(chl); - PyMem_Free(evl); - return result; - - error: - PyMem_Free(chl); - PyMem_Free(evl); - Py_XDECREF(result); - Py_XDECREF(it); - return NULL; -} - -PyDoc_STRVAR(kqueue_queue_control_doc, -"control(changelist, max_events[, timeout=None]) -> eventlist\n\ -\n\ -Calls the kernel kevent function.\n\ -- changelist must be a list of kevent objects describing the changes\n\ - to be made to the kernel's watch list or None.\n\ -- max_events lets you specify the maximum number of events that the\n\ - kernel will return.\n\ -- timeout is the maximum time to wait in seconds, or else None,\n\ - to wait forever. timeout accepts floats for smaller timeouts, too."); - - -static PyMethodDef kqueue_queue_methods[] = { - {"fromfd", (PyCFunction)kqueue_queue_fromfd, - METH_VARARGS | METH_CLASS, kqueue_queue_fromfd_doc}, - {"close", (PyCFunction)kqueue_queue_close, METH_NOARGS, - kqueue_queue_close_doc}, - {"fileno", (PyCFunction)kqueue_queue_fileno, METH_NOARGS, - kqueue_queue_fileno_doc}, - {"control", (PyCFunction)kqueue_queue_control, - METH_VARARGS , kqueue_queue_control_doc}, - {NULL, NULL}, -}; - -static PyGetSetDef kqueue_queue_getsetlist[] = { - {"closed", (getter)kqueue_queue_get_closed, NULL, - "True if the kqueue handler is closed"}, - {0}, -}; - -PyDoc_STRVAR(kqueue_queue_doc, -"Kqueue syscall wrapper.\n\ -\n\ -For example, to start watching a socket for input:\n\ ->>> kq = kqueue()\n\ ->>> sock = socket()\n\ ->>> sock.connect((host, port))\n\ ->>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_ADD)], 0)\n\ -\n\ -To wait one second for it to become writeable:\n\ ->>> kq.control(None, 1, 1000)\n\ -\n\ -To stop listening:\n\ ->>> kq.control([kevent(sock, KQ_FILTER_WRITE, KQ_EV_DELETE)], 0)"); - -static PyTypeObject kqueue_queue_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "select.kqueue", /* tp_name */ - sizeof(kqueue_queue_Object), /* tp_basicsize */ - 0, /* tp_itemsize */ - (destructor)kqueue_queue_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - kqueue_queue_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - kqueue_queue_methods, /* tp_methods */ - 0, /* tp_members */ - kqueue_queue_getsetlist, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - kqueue_queue_new, /* tp_new */ - 0, /* tp_free */ -}; - -#endif /* HAVE_KQUEUE */ -/* ************************************************************************ */ - -PyDoc_STRVAR(select_doc, -"select(rlist, wlist, xlist[, timeout]) -> (rlist, wlist, xlist)\n\ -\n\ -Wait until one or more file descriptors are ready for some kind of I/O.\n\ -The first three arguments are sequences of file descriptors to be waited for:\n\ -rlist -- wait until ready for reading\n\ -wlist -- wait until ready for writing\n\ -xlist -- wait for an ``exceptional condition''\n\ -If only one kind of condition is required, pass [] for the other lists.\n\ -A file descriptor is either a socket or file object, or a small integer\n\ -gotten from a fileno() method call on one of those.\n\ -\n\ -The optional 4th argument specifies a timeout in seconds; it may be\n\ -a floating point number to specify fractions of seconds. If it is absent\n\ -or None, the call will never time out.\n\ -\n\ -The return value is a tuple of three lists corresponding to the first three\n\ -arguments; each contains the subset of the corresponding file descriptors\n\ -that are ready.\n\ -\n\ -*** IMPORTANT NOTICE ***\n\ -On Windows and OpenVMS, only sockets are supported; on Unix, all file\n\ -descriptors can be used."); - -static PyMethodDef select_methods[] = { - {"select", select_select, METH_VARARGS, select_doc}, -#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) - {"poll", select_poll, METH_NOARGS, poll_doc}, -#endif /* HAVE_POLL */ - {0, 0}, /* sentinel */ -}; - -PyDoc_STRVAR(module_doc, -"This module supports asynchronous I/O on multiple file descriptors.\n\ -\n\ -*** IMPORTANT NOTICE ***\n\ -On Windows and OpenVMS, only sockets are supported; on Unix, all file descriptors."); - -PyMODINIT_FUNC -initselect(void) -{ - PyObject *m; - m = Py_InitModule3("select", select_methods, module_doc); - if (m == NULL) - return; - - SelectError = PyErr_NewException("select.error", NULL, NULL); - Py_INCREF(SelectError); - PyModule_AddObject(m, "error", SelectError); - -#ifdef PIPE_BUF -#ifdef HAVE_BROKEN_PIPE_BUF -#undef PIPE_BUF -#define PIPE_BUF 512 -#endif - PyModule_AddIntConstant(m, "PIPE_BUF", PIPE_BUF); -#endif - -#if defined(HAVE_POLL) && !defined(HAVE_BROKEN_POLL) -#ifdef __APPLE__ - if (select_have_broken_poll()) { - if (PyObject_DelAttrString(m, "poll") == -1) { - PyErr_Clear(); - } - } else { -#else - { -#endif - Py_TYPE(&poll_Type) = &PyType_Type; - PyModule_AddIntConstant(m, "POLLIN", POLLIN); - PyModule_AddIntConstant(m, "POLLPRI", POLLPRI); - PyModule_AddIntConstant(m, "POLLOUT", POLLOUT); - PyModule_AddIntConstant(m, "POLLERR", POLLERR); - PyModule_AddIntConstant(m, "POLLHUP", POLLHUP); - PyModule_AddIntConstant(m, "POLLNVAL", POLLNVAL); - -#ifdef POLLRDNORM - PyModule_AddIntConstant(m, "POLLRDNORM", POLLRDNORM); -#endif -#ifdef POLLRDBAND - PyModule_AddIntConstant(m, "POLLRDBAND", POLLRDBAND); -#endif -#ifdef POLLWRNORM - PyModule_AddIntConstant(m, "POLLWRNORM", POLLWRNORM); -#endif -#ifdef POLLWRBAND - PyModule_AddIntConstant(m, "POLLWRBAND", POLLWRBAND); -#endif -#ifdef POLLMSG - PyModule_AddIntConstant(m, "POLLMSG", POLLMSG); -#endif - } -#endif /* HAVE_POLL */ - -#ifdef HAVE_EPOLL - Py_TYPE(&pyEpoll_Type) = &PyType_Type; - if (PyType_Ready(&pyEpoll_Type) < 0) - return; - - Py_INCREF(&pyEpoll_Type); - PyModule_AddObject(m, "epoll", (PyObject *) &pyEpoll_Type); - - PyModule_AddIntConstant(m, "EPOLLIN", EPOLLIN); - PyModule_AddIntConstant(m, "EPOLLOUT", EPOLLOUT); - PyModule_AddIntConstant(m, "EPOLLPRI", EPOLLPRI); - PyModule_AddIntConstant(m, "EPOLLERR", EPOLLERR); - PyModule_AddIntConstant(m, "EPOLLHUP", EPOLLHUP); - PyModule_AddIntConstant(m, "EPOLLET", EPOLLET); -#ifdef EPOLLONESHOT - /* Kernel 2.6.2+ */ - PyModule_AddIntConstant(m, "EPOLLONESHOT", EPOLLONESHOT); -#endif - /* PyModule_AddIntConstant(m, "EPOLL_RDHUP", EPOLLRDHUP); */ - PyModule_AddIntConstant(m, "EPOLLRDNORM", EPOLLRDNORM); - PyModule_AddIntConstant(m, "EPOLLRDBAND", EPOLLRDBAND); - PyModule_AddIntConstant(m, "EPOLLWRNORM", EPOLLWRNORM); - PyModule_AddIntConstant(m, "EPOLLWRBAND", EPOLLWRBAND); - PyModule_AddIntConstant(m, "EPOLLMSG", EPOLLMSG); -#endif /* HAVE_EPOLL */ - -#ifdef HAVE_KQUEUE - kqueue_event_Type.tp_new = PyType_GenericNew; - Py_TYPE(&kqueue_event_Type) = &PyType_Type; - if(PyType_Ready(&kqueue_event_Type) < 0) - return; - - Py_INCREF(&kqueue_event_Type); - PyModule_AddObject(m, "kevent", (PyObject *)&kqueue_event_Type); - - Py_TYPE(&kqueue_queue_Type) = &PyType_Type; - if(PyType_Ready(&kqueue_queue_Type) < 0) - return; - Py_INCREF(&kqueue_queue_Type); - PyModule_AddObject(m, "kqueue", (PyObject *)&kqueue_queue_Type); - - /* event filters */ - PyModule_AddIntConstant(m, "KQ_FILTER_READ", EVFILT_READ); - PyModule_AddIntConstant(m, "KQ_FILTER_WRITE", EVFILT_WRITE); - PyModule_AddIntConstant(m, "KQ_FILTER_AIO", EVFILT_AIO); - PyModule_AddIntConstant(m, "KQ_FILTER_VNODE", EVFILT_VNODE); - PyModule_AddIntConstant(m, "KQ_FILTER_PROC", EVFILT_PROC); -#ifdef EVFILT_NETDEV - PyModule_AddIntConstant(m, "KQ_FILTER_NETDEV", EVFILT_NETDEV); -#endif - PyModule_AddIntConstant(m, "KQ_FILTER_SIGNAL", EVFILT_SIGNAL); - PyModule_AddIntConstant(m, "KQ_FILTER_TIMER", EVFILT_TIMER); - - /* event flags */ - PyModule_AddIntConstant(m, "KQ_EV_ADD", EV_ADD); - PyModule_AddIntConstant(m, "KQ_EV_DELETE", EV_DELETE); - PyModule_AddIntConstant(m, "KQ_EV_ENABLE", EV_ENABLE); - PyModule_AddIntConstant(m, "KQ_EV_DISABLE", EV_DISABLE); - PyModule_AddIntConstant(m, "KQ_EV_ONESHOT", EV_ONESHOT); - PyModule_AddIntConstant(m, "KQ_EV_CLEAR", EV_CLEAR); - - PyModule_AddIntConstant(m, "KQ_EV_SYSFLAGS", EV_SYSFLAGS); - PyModule_AddIntConstant(m, "KQ_EV_FLAG1", EV_FLAG1); - - PyModule_AddIntConstant(m, "KQ_EV_EOF", EV_EOF); - PyModule_AddIntConstant(m, "KQ_EV_ERROR", EV_ERROR); - - /* READ WRITE filter flag */ - PyModule_AddIntConstant(m, "KQ_NOTE_LOWAT", NOTE_LOWAT); - - /* VNODE filter flags */ - PyModule_AddIntConstant(m, "KQ_NOTE_DELETE", NOTE_DELETE); - PyModule_AddIntConstant(m, "KQ_NOTE_WRITE", NOTE_WRITE); - PyModule_AddIntConstant(m, "KQ_NOTE_EXTEND", NOTE_EXTEND); - PyModule_AddIntConstant(m, "KQ_NOTE_ATTRIB", NOTE_ATTRIB); - PyModule_AddIntConstant(m, "KQ_NOTE_LINK", NOTE_LINK); - PyModule_AddIntConstant(m, "KQ_NOTE_RENAME", NOTE_RENAME); - PyModule_AddIntConstant(m, "KQ_NOTE_REVOKE", NOTE_REVOKE); - - /* PROC filter flags */ - PyModule_AddIntConstant(m, "KQ_NOTE_EXIT", NOTE_EXIT); - PyModule_AddIntConstant(m, "KQ_NOTE_FORK", NOTE_FORK); - PyModule_AddIntConstant(m, "KQ_NOTE_EXEC", NOTE_EXEC); - PyModule_AddIntConstant(m, "KQ_NOTE_PCTRLMASK", NOTE_PCTRLMASK); - PyModule_AddIntConstant(m, "KQ_NOTE_PDATAMASK", NOTE_PDATAMASK); - - PyModule_AddIntConstant(m, "KQ_NOTE_TRACK", NOTE_TRACK); - PyModule_AddIntConstant(m, "KQ_NOTE_CHILD", NOTE_CHILD); - PyModule_AddIntConstant(m, "KQ_NOTE_TRACKERR", NOTE_TRACKERR); - - /* NETDEV filter flags */ -#ifdef EVFILT_NETDEV - PyModule_AddIntConstant(m, "KQ_NOTE_LINKUP", NOTE_LINKUP); - PyModule_AddIntConstant(m, "KQ_NOTE_LINKDOWN", NOTE_LINKDOWN); - PyModule_AddIntConstant(m, "KQ_NOTE_LINKINV", NOTE_LINKINV); -#endif - -#endif /* HAVE_KQUEUE */ -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/gzguts.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/gzguts.h deleted file mode 100644 index d527486..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/gzguts.h +++ /dev/null @@ -1,215 +0,0 @@ -/* gzguts.h -- zlib internal header definitions for gz* operations - * Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- * Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - */ - -#ifdef _LARGEFILE64_SOURCE -# ifndef _LARGEFILE_SOURCE -# define _LARGEFILE_SOURCE 1 -# endif -# ifdef _FILE_OFFSET_BITS -# undef _FILE_OFFSET_BITS -# endif -#endif - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include -#include "zlib.h" -#ifdef STDC -# include -# include -# include -#endif -#include - -#ifdef _WIN32 -# include -#endif - -#if (defined(__TURBOC__) || defined(_MSC_VER) || defined(_WIN32)) && !defined(UEFI_C_SOURCE) -# include -#endif - -#ifdef WINAPI_FAMILY -# define open _open -# define read _read -# define write _write -# define close _close -#endif - -// Needed to get the declarations for open, read, write, close -#ifdef UEFI_C_SOURCE -# include -#endif - -#ifdef NO_DEFLATE /* for compatibility with old definition */ -# define NO_GZCOMPRESS -#endif - -#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#if defined(__CYGWIN__) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#if defined(MSDOS) && defined(__BORLANDC__) && (BORLANDC > 0x410) -# ifndef HAVE_VSNPRINTF -# define HAVE_VSNPRINTF -# endif -#endif - -#ifndef HAVE_VSNPRINTF -# ifdef MSDOS -/* vsnprintf may exist on some MS-DOS compilers (DJGPP?), - but for now we just assume it doesn't. */ -# define NO_vsnprintf -# endif -# ifdef __TURBOC__ -# define NO_vsnprintf -# endif -# ifdef WIN32 -/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */ -# if !defined(vsnprintf) && !defined(NO_vsnprintf) -# if !defined(_MSC_VER) || ( defined(_MSC_VER) && _MSC_VER < 1500 ) -# define vsnprintf _vsnprintf -# endif -# endif -# endif -# ifdef __SASC -# define NO_vsnprintf -# endif -# ifdef VMS -# define NO_vsnprintf -# endif -# ifdef __OS400__ -# define NO_vsnprintf -# endif -# ifdef __MVS__ -# define NO_vsnprintf -# endif -#endif - -/* unlike snprintf (which is required in C99, yet still not supported by - Microsoft more than a decade later!), _snprintf does not guarantee null - termination of the result -- however this is only used in gzlib.c where - the result is assured to fit in the space provided */ -#if defined(_MSC_VER) && !defined(UEFI_C_SOURCE) -# define snprintf _snprintf -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -/* gz* functions always use library allocation functions */ -#ifndef STDC - extern voidp malloc OF((uInt size)); - extern void free OF((voidpf ptr)); -#endif - -/* get errno and strerror definition */ -#if defined UNDER_CE -# include -# define zstrerror() gz_strwinerror((DWORD)GetLastError()) -#else -# ifndef NO_STRERROR -# include -# define zstrerror() strerror(errno) -# else -# define zstrerror() "stdio error (consult errno)" -# endif -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0 - ZEXTERN gzFile ZEXPORT gzopen64 OF((const char *, const char *)); - ZEXTERN z_off64_t ZEXPORT gzseek64 OF((gzFile, z_off64_t, int)); - ZEXTERN z_off64_t ZEXPORT gztell64 OF((gzFile)); - ZEXTERN z_off64_t ZEXPORT gzoffset64 OF((gzFile)); -#endif - -/* default memLevel */ -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif - -/* default i/o buffer size -- double this for output when reading (this and - twice this must be able to fit in an unsigned type) */ -#define GZBUFSIZE 8192 - -/* gzip modes, also provide a little integrity check on the passed structure */ -#define GZ_NONE 0 -#define GZ_READ 7247 -#define GZ_WRITE 31153 -#define GZ_APPEND 1 /* mode set to GZ_WRITE after the file is opened */ - -/* values for gz_state how */ -#define LOOK 0 /* look for a gzip header */ -#define COPY 1 /* copy input directly */ -#define GZIP 2 /* decompress a gzip stream */ - -/* internal gzip file state data structure */ -typedef struct { - /* exposed contents for gzgetc() macro */ - struct gzFile_s x; /* "x" for exposed */ - /* x.have: number of bytes available at x.next */ - /* x.next: next output data to deliver or write */ - /* x.pos: current position in uncompressed data */ - /* used for both reading and writing */ - int mode; /* see gzip modes above */ - int fd; /* file descriptor */ - char *path; /* path or fd for error messages */ - unsigned size; /* buffer size, zero if not allocated yet */ - unsigned want; /* requested buffer size, default is GZBUFSIZE */ - unsigned char *in; /* input buffer */ - unsigned char *out; /* output buffer (double-sized when reading) */ - int direct; /* 0 if processing gzip, 1 if transparent */ - /* just for reading */ - int how; /* 0: get header, 1: copy, 2: decompress */ - z_off64_t start; /* where the gzip data started, for rewinding */ - int eof; /* true if end of input file reached */ - int past; /* true if read requested past end */ - /* just for writing */ - int level; /* compression level */ - int strategy; /* compression strategy */ - /* seek request */ - z_off64_t skip; /* amount to skip (already rewound if backwards) */ - int seek; /* true if seek request pending */ - /* error information */ - int err; /* error code */ - char *msg; /* error message */ - /* zlib inflate or deflate stream */ - z_stream strm; /* stream structure in-place (not a pointer) */ -} gz_state; -typedef gz_state FAR *gz_statep; - -/* shared functions */ -void ZLIB_INTERNAL gz_error OF((gz_statep, int, const char *)); -#if defined UNDER_CE -char ZLIB_INTERNAL *gz_strwinerror OF((DWORD error)); -#endif - -/* GT_OFF(x), where x is an unsigned value, is true if x > maximum z_off64_t - value -- needed when comparing unsigned to z_off64_t, which is signed - (possible z_off64_t types off_t, off64_t, and long are all signed) */ -#ifdef INT_MAX -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > INT_MAX) -#else -unsigned ZLIB_INTERNAL gz_intmax OF((void)); -# define GT_OFF(x) (sizeof(int) == sizeof(z_off64_t) && (x) > gz_intmax()) -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/zutil.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/zutil.h deleted file mode 100644 index fb716ac..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Modules/zlib/zutil.h +++ /dev/null @@ -1,256 +0,0 @@ -/** @file - zutil.h -- internal interface and configuration of the compression library - - Copyright (C) 2015, Daryl McDaniel.
- * Copyright (C) 1995-2013 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h -**/ - -/* WARNING: this file should *not* be used by applications. It is - part of the implementation of the compression library and is - subject to change. Applications should only use zlib.h. - */ - -/* @(#) $Id$ */ - -#ifndef ZUTIL_H -#define ZUTIL_H - -#ifdef HAVE_HIDDEN -# define ZLIB_INTERNAL __attribute__((visibility ("hidden"))) -#else -# define ZLIB_INTERNAL -#endif - -#include "zlib.h" - -#if defined(UEFI_C_SOURCE) || (defined(STDC) && !defined(Z_SOLO)) -# if !(defined(_WIN32_WCE) && defined(_MSC_VER)) -# include -# endif -# include -# include -#endif - -#ifdef Z_SOLO - typedef long ptrdiff_t; /* guess -- will be caught if guess is wrong */ -#endif - -#ifndef local -# define local static -#endif -/* compile with -Dlocal if your debugger can't find static symbols */ - -typedef unsigned char uch; -typedef uch FAR uchf; -typedef unsigned short ush; -typedef ush FAR ushf; -typedef unsigned long ulg; - -extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ -/* (size given to avoid silly warnings with Visual C++) */ - -#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] - -#define ERR_RETURN(strm,err) \ - return (strm->msg = ERR_MSG(err), (err)) -/* To be used only when the state is known to be valid */ - - /* common constants */ - -#ifndef DEF_WBITS -# define DEF_WBITS MAX_WBITS -#endif -/* default windowBits for decompression. MAX_WBITS is for compression only */ - -#if MAX_MEM_LEVEL >= 8 -# define DEF_MEM_LEVEL 8 -#else -# define DEF_MEM_LEVEL MAX_MEM_LEVEL -#endif -/* default memLevel */ - -#define STORED_BLOCK 0 -#define STATIC_TREES 1 -#define DYN_TREES 2 -/* The three kinds of block type */ - -#define MIN_MATCH 3 -#define MAX_MATCH 258 -/* The minimum and maximum match lengths */ - -#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ - - /* target dependencies */ - -#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) -# define OS_CODE 0x00 -# ifndef Z_SOLO -# if defined(__TURBOC__) || defined(__BORLANDC__) -# if (__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) - /* Allow compilation with ANSI keywords only enabled */ - void _Cdecl farfree( void *block ); - void *_Cdecl farmalloc( unsigned long nbytes ); -# else -# include -# endif -# else /* MSC or DJGPP */ -# include -# endif -# endif -#endif - -#ifdef AMIGA -# define OS_CODE 0x01 -#endif - -#if defined(VAXC) || defined(VMS) -# define OS_CODE 0x02 -# define F_OPEN(name, mode) \ - fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") -#endif - -#if defined(ATARI) || defined(atarist) -# define OS_CODE 0x05 -#endif - -#ifdef OS2 -# define OS_CODE 0x06 -# if defined(M_I86) && !defined(Z_SOLO) -# include -# endif -#endif - -#if defined(MACOS) || defined(TARGET_OS_MAC) -# define OS_CODE 0x07 -# ifndef Z_SOLO -# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os -# include /* for fdopen */ -# else -# ifndef fdopen -# define fdopen(fd,mode) NULL /* No fdopen() */ -# endif -# endif -# endif -#endif - -#ifdef TOPS20 -# define OS_CODE 0x0a -#endif - -#ifdef WIN32 -# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */ -# define OS_CODE 0x0b -# endif -#endif - -#ifdef __50SERIES /* Prime/PRIMOS */ -# define OS_CODE 0x0f -#endif - -#if defined(_BEOS_) || defined(RISCOS) -# define fdopen(fd,mode) NULL /* No fdopen() */ -#endif - -#if !defined(UEFI_C_SOURCE) && (defined(_MSC_VER) && (_MSC_VER > 600)) && !defined(__INTERIX) -# if defined(_WIN32_WCE) -# define fdopen(fd,mode) NULL /* No fdopen() */ -# ifndef _PTRDIFF_T_DEFINED - typedef int ptrdiff_t; -# define _PTRDIFF_T_DEFINED -# endif -# else -# define fdopen(fd,type) _fdopen(fd,type) -# endif -#endif - -#if defined(__BORLANDC__) && !defined(MSDOS) - #pragma warn -8004 - #pragma warn -8008 - #pragma warn -8066 -#endif - -/* provide prototypes for these when building zlib without LFS */ -#if !defined(_WIN32) && \ - (!defined(_LARGEFILE64_SOURCE) || _LFS64_LARGEFILE-0 == 0) - ZEXTERN uLong ZEXPORT adler32_combine64 OF((uLong, uLong, z_off_t)); - ZEXTERN uLong ZEXPORT crc32_combine64 OF((uLong, uLong, z_off_t)); -#endif - - /* common defaults */ - -#ifndef OS_CODE -# define OS_CODE 0x03 /* assume Unix */ -#endif - -#ifndef F_OPEN -# define F_OPEN(name, mode) fopen((name), (mode)) -#endif - - /* functions */ - -#if defined(pyr) || defined(Z_SOLO) -# define NO_MEMCPY -#endif -#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) - /* Use our own functions for small and medium model with MSC <= 5.0. - * You may have to use the same strategy for Borland C (untested). - * The __SC__ check is for Symantec. - */ -# define NO_MEMCPY -#endif -#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) -# define HAVE_MEMCPY -#endif -#ifdef HAVE_MEMCPY -# ifdef SMALL_MEDIUM /* MSDOS small or medium model */ -# define zmemcpy _fmemcpy -# define zmemcmp _fmemcmp -# define zmemzero(dest, len) _fmemset(dest, 0, len) -# else -# define zmemcpy memcpy -# define zmemcmp memcmp -# define zmemzero(dest, len) memset(dest, 0, len) -# endif -#else - void ZLIB_INTERNAL zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); - int ZLIB_INTERNAL zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); - void ZLIB_INTERNAL zmemzero OF((Bytef* dest, uInt len)); -#endif - -/* Diagnostic functions */ -#ifdef DEBUG -# include - extern int ZLIB_INTERNAL z_verbose; - extern void ZLIB_INTERNAL z_error OF((char *m)); -# define Assert(cond,msg) {if(!(cond)) z_error(msg);} -# define Trace(x) {if (z_verbose>=0) fprintf x ;} -# define Tracev(x) {if (z_verbose>0) fprintf x ;} -# define Tracevv(x) {if (z_verbose>1) fprintf x ;} -# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} -# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} -#else -# define Assert(cond,msg) -# define Trace(x) -# define Tracev(x) -# define Tracevv(x) -# define Tracec(c,x) -# define Tracecv(c,x) -#endif - -#ifndef Z_SOLO - voidpf ZLIB_INTERNAL zcalloc OF((voidpf opaque, unsigned items, - unsigned size)); - void ZLIB_INTERNAL zcfree OF((voidpf opaque, voidpf ptr)); -#endif - -#define ZALLOC(strm, items, size) \ - (*((strm)->zalloc))((strm)->opaque, (items), (size)) -#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) -#define TRY_FREE(s, p) {if (p) ZFREE(s, p);} - -/* Reverse the bytes in a 32-bit value */ -#define ZSWAP32(q) ((((q) >> 24) & 0xff) + (((q) >> 8) & 0xff00) + \ - (((q) & 0xff00) << 8) + (((q) & 0xff) << 24)) - -#endif /* ZUTIL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/longobject.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/longobject.c deleted file mode 100644 index 1745ce9..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/longobject.c +++ /dev/null @@ -1,4413 +0,0 @@ -/** @file - Long (arbitrary precision) integer object implementation. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -/* XXX The functional organization of this file is terrible */ - -#include "Python.h" -#include "longintrepr.h" -#include "structseq.h" - -#include -#include -#include - -/* For long multiplication, use the O(N**2) school algorithm unless - * both operands contain more than KARATSUBA_CUTOFF digits (this - * being an internal Python long digit, in base PyLong_BASE). - */ -#define KARATSUBA_CUTOFF 70 -#define KARATSUBA_SQUARE_CUTOFF (2 * KARATSUBA_CUTOFF) - -/* For exponentiation, use the binary left-to-right algorithm - * unless the exponent contains more than FIVEARY_CUTOFF digits. - * In that case, do 5 bits at a time. The potential drawback is that - * a table of 2**5 intermediate results is computed. - */ -#define FIVEARY_CUTOFF 8 - -#undef ABS -#define ABS(x) ((x) < 0 ? -(x) : (x)) - -#undef MIN -#undef MAX -#define MAX(x, y) ((x) < (y) ? (y) : (x)) -#define MIN(x, y) ((x) > (y) ? (y) : (x)) - -#define SIGCHECK(PyTryBlock) \ - do { \ - if (--_Py_Ticker < 0) { \ - _Py_Ticker = _Py_CheckInterval; \ - if (PyErr_CheckSignals()) PyTryBlock \ - } \ - } while(0) - -/* Normalize (remove leading zeros from) a long int object. - Doesn't attempt to free the storage--in most cases, due to the nature - of the algorithms used, this could save at most be one word anyway. */ - -static PyLongObject * -long_normalize(register PyLongObject *v) -{ - Py_ssize_t j = ABS(Py_SIZE(v)); - Py_ssize_t i = j; - - while (i > 0 && v->ob_digit[i-1] == 0) - --i; - if (i != j) - Py_SIZE(v) = (Py_SIZE(v) < 0) ? -(i) : i; - return v; -} - -/* Allocate a new long int object with size digits. - Return NULL and set exception if we run out of memory. */ - -#define MAX_LONG_DIGITS \ - ((PY_SSIZE_T_MAX - offsetof(PyLongObject, ob_digit))/sizeof(digit)) - -PyLongObject * -_PyLong_New(Py_ssize_t size) -{ - if (size > (Py_ssize_t)MAX_LONG_DIGITS) { - PyErr_SetString(PyExc_OverflowError, - "too many digits in integer"); - return NULL; - } - /* coverity[ampersand_in_size] */ - /* XXX(nnorwitz): PyObject_NEW_VAR / _PyObject_VAR_SIZE need to detect - overflow */ - return PyObject_NEW_VAR(PyLongObject, &PyLong_Type, size); -} - -PyObject * -_PyLong_Copy(PyLongObject *src) -{ - PyLongObject *result; - Py_ssize_t i; - - assert(src != NULL); - i = src->ob_size; - if (i < 0) - i = -(i); - result = _PyLong_New(i); - if (result != NULL) { - result->ob_size = src->ob_size; - while (--i >= 0) - result->ob_digit[i] = src->ob_digit[i]; - } - return (PyObject *)result; -} - -/* Create a new long int object from a C long int */ - -PyObject * -PyLong_FromLong(long ival) -{ - PyLongObject *v; - unsigned long abs_ival; - unsigned long t; /* unsigned so >> doesn't propagate sign bit */ - int ndigits = 0; - int negative = 0; - - if (ival < 0) { - /* if LONG_MIN == -LONG_MAX-1 (true on most platforms) then - ANSI C says that the result of -ival is undefined when ival - == LONG_MIN. Hence the following workaround. */ - abs_ival = (unsigned long)(-1-ival) + 1; - negative = 1; - } - else { - abs_ival = (unsigned long)ival; - } - - /* Count the number of Python digits. - We used to pick 5 ("big enough for anything"), but that's a - waste of time and space given that 5*15 = 75 bits are rarely - needed. */ - t = abs_ival; - while (t) { - ++ndigits; - t >>= PyLong_SHIFT; - } - v = _PyLong_New(ndigits); - if (v != NULL) { - digit *p = v->ob_digit; - v->ob_size = negative ? -ndigits : ndigits; - t = abs_ival; - while (t) { - *p++ = (digit)(t & PyLong_MASK); - t >>= PyLong_SHIFT; - } - } - return (PyObject *)v; -} - -/* Create a new long int object from a C unsigned long int */ - -PyObject * -PyLong_FromUnsignedLong(unsigned long ival) -{ - PyLongObject *v; - unsigned long t; - int ndigits = 0; - - /* Count the number of Python digits. */ - t = (unsigned long)ival; - while (t) { - ++ndigits; - t >>= PyLong_SHIFT; - } - v = _PyLong_New(ndigits); - if (v != NULL) { - digit *p = v->ob_digit; - Py_SIZE(v) = ndigits; - while (ival) { - *p++ = (digit)(ival & PyLong_MASK); - ival >>= PyLong_SHIFT; - } - } - return (PyObject *)v; -} - -/* Create a new long int object from a C double */ - -PyObject * -PyLong_FromDouble(double dval) -{ - PyLongObject *v; - double frac; - int i, ndig, expo, neg; - neg = 0; - if (Py_IS_INFINITY(dval)) { - PyErr_SetString(PyExc_OverflowError, - "cannot convert float infinity to integer"); - return NULL; - } - if (Py_IS_NAN(dval)) { - PyErr_SetString(PyExc_ValueError, - "cannot convert float NaN to integer"); - return NULL; - } - if (dval < 0.0) { - neg = 1; - dval = -dval; - } - frac = frexp(dval, &expo); /* dval = frac*2**expo; 0.0 <= frac < 1.0 */ - if (expo <= 0) - return PyLong_FromLong(0L); - ndig = (expo-1) / PyLong_SHIFT + 1; /* Number of 'digits' in result */ - v = _PyLong_New(ndig); - if (v == NULL) - return NULL; - frac = ldexp(frac, (expo-1) % PyLong_SHIFT + 1); - for (i = ndig; --i >= 0; ) { - digit bits = (digit)frac; - v->ob_digit[i] = bits; - frac = frac - (double)bits; - frac = ldexp(frac, PyLong_SHIFT); - } - if (neg) - Py_SIZE(v) = -(Py_SIZE(v)); - return (PyObject *)v; -} - -/* Checking for overflow in PyLong_AsLong is a PITA since C doesn't define - * anything about what happens when a signed integer operation overflows, - * and some compilers think they're doing you a favor by being "clever" - * then. The bit pattern for the largest postive signed long is - * (unsigned long)LONG_MAX, and for the smallest negative signed long - * it is abs(LONG_MIN), which we could write -(unsigned long)LONG_MIN. - * However, some other compilers warn about applying unary minus to an - * unsigned operand. Hence the weird "0-". - */ -#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) -#define PY_ABS_SSIZE_T_MIN (0-(size_t)PY_SSIZE_T_MIN) - -/* Get a C long int from a Python long or Python int object. - On overflow, returns -1 and sets *overflow to 1 or -1 depending - on the sign of the result. Otherwise *overflow is 0. - - For other errors (e.g., type error), returns -1 and sets an error - condition. -*/ - -long -PyLong_AsLongAndOverflow(PyObject *vv, int *overflow) -{ - /* This version by Tim Peters */ - register PyLongObject *v; - unsigned long x, prev; - long res; - Py_ssize_t i; - int sign; - int do_decref = 0; /* if nb_int was called */ - - *overflow = 0; - if (vv == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if(PyInt_Check(vv)) - return PyInt_AsLong(vv); - - if (!PyLong_Check(vv)) { - PyNumberMethods *nb; - nb = vv->ob_type->tp_as_number; - if (nb == NULL || nb->nb_int == NULL) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - return -1; - } - vv = (*nb->nb_int) (vv); - if (vv == NULL) - return -1; - do_decref = 1; - if(PyInt_Check(vv)) { - res = PyInt_AsLong(vv); - goto exit; - } - if (!PyLong_Check(vv)) { - Py_DECREF(vv); - PyErr_SetString(PyExc_TypeError, - "nb_int should return int object"); - return -1; - } - } - - res = -1; - v = (PyLongObject *)vv; - i = Py_SIZE(v); - - switch (i) { - case -1: - res = -(sdigit)v->ob_digit[0]; - break; - case 0: - res = 0; - break; - case 1: - res = v->ob_digit[0]; - break; - default: - sign = 1; - x = 0; - if (i < 0) { - sign = -1; - i = -(i); - } - while (--i >= 0) { - prev = x; - x = (x << PyLong_SHIFT) + v->ob_digit[i]; - if ((x >> PyLong_SHIFT) != prev) { - *overflow = sign; - goto exit; - } - } - /* Haven't lost any bits, but casting to long requires extra - * care (see comment above). - */ - if (x <= (unsigned long)LONG_MAX) { - res = (long)x * sign; - } - else if (sign < 0 && x == PY_ABS_LONG_MIN) { - res = LONG_MIN; - } - else { - *overflow = sign; - /* res is already set to -1 */ - } - } - exit: - if (do_decref) { - Py_DECREF(vv); - } - return res; -} - -/* Get a C long int from a long int object. - Returns -1 and sets an error condition if overflow occurs. */ - -long -PyLong_AsLong(PyObject *obj) -{ - int overflow; - long result = PyLong_AsLongAndOverflow(obj, &overflow); - if (overflow) { - /* XXX: could be cute and give a different - message for overflow == -1 */ - PyErr_SetString(PyExc_OverflowError, - "Python int too large to convert to C long"); - } - return result; -} - -/* Get a C int from a long int object or any object that has an __int__ - method. Return -1 and set an error if overflow occurs. */ - -int -_PyLong_AsInt(PyObject *obj) -{ - int overflow; - long result = PyLong_AsLongAndOverflow(obj, &overflow); - if (overflow || result > INT_MAX || result < INT_MIN) { - /* XXX: could be cute and give a different - message for overflow == -1 */ - PyErr_SetString(PyExc_OverflowError, - "Python int too large to convert to C int"); - return -1; - } - return (int)result; -} - -/* Get a Py_ssize_t from a long int object. - Returns -1 and sets an error condition if overflow occurs. */ - -Py_ssize_t -PyLong_AsSsize_t(PyObject *vv) { - register PyLongObject *v; - size_t x, prev; - Py_ssize_t i; - int sign; - - if (vv == NULL || !PyLong_Check(vv)) { - PyErr_BadInternalCall(); - return -1; - } - v = (PyLongObject *)vv; - i = v->ob_size; - sign = 1; - x = 0; - if (i < 0) { - sign = -1; - i = -(i); - } - while (--i >= 0) { - prev = x; - x = (x << PyLong_SHIFT) | v->ob_digit[i]; - if ((x >> PyLong_SHIFT) != prev) - goto overflow; - } - /* Haven't lost any bits, but casting to a signed type requires - * extra care (see comment above). - */ - if (x <= (size_t)PY_SSIZE_T_MAX) { - return (Py_ssize_t)x * sign; - } - else if (sign < 0 && x == PY_ABS_SSIZE_T_MIN) { - return PY_SSIZE_T_MIN; - } - /* else overflow */ - - overflow: - PyErr_SetString(PyExc_OverflowError, - "long int too large to convert to int"); - return -1; -} - -/* Get a C unsigned long int from a long int object. - Returns -1 and sets an error condition if overflow occurs. */ - -unsigned long -PyLong_AsUnsignedLong(PyObject *vv) -{ - register PyLongObject *v; - unsigned long x, prev; - Py_ssize_t i; - - if (vv == NULL || !PyLong_Check(vv)) { - if (vv != NULL && PyInt_Check(vv)) { - long val = PyInt_AsLong(vv); - if (val < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value " - "to unsigned long"); - return (unsigned long) -1; - } - return val; - } - PyErr_BadInternalCall(); - return (unsigned long) -1; - } - v = (PyLongObject *)vv; - i = Py_SIZE(v); - x = 0; - if (i < 0) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long) -1; - } - while (--i >= 0) { - prev = x; - x = (x << PyLong_SHIFT) | v->ob_digit[i]; - if ((x >> PyLong_SHIFT) != prev) { - PyErr_SetString(PyExc_OverflowError, - "long int too large to convert"); - return (unsigned long) -1; - } - } - return x; -} - -/* Get a C unsigned long int from a long int object, ignoring the high bits. - Returns -1 and sets an error condition if an error occurs. */ - -unsigned long -PyLong_AsUnsignedLongMask(PyObject *vv) -{ - register PyLongObject *v; - unsigned long x; - Py_ssize_t i; - int sign; - - if (vv == NULL || !PyLong_Check(vv)) { - if (vv != NULL && PyInt_Check(vv)) - return PyInt_AsUnsignedLongMask(vv); - PyErr_BadInternalCall(); - return (unsigned long) -1; - } - v = (PyLongObject *)vv; - i = v->ob_size; - sign = 1; - x = 0; - if (i < 0) { - sign = -1; - i = -i; - } - while (--i >= 0) { - x = (x << PyLong_SHIFT) | v->ob_digit[i]; - } - return x * sign; -} - -int -_PyLong_Sign(PyObject *vv) -{ - PyLongObject *v = (PyLongObject *)vv; - - assert(v != NULL); - assert(PyLong_Check(v)); - - return Py_SIZE(v) == 0 ? 0 : (Py_SIZE(v) < 0 ? -1 : 1); -} - -size_t -_PyLong_NumBits(PyObject *vv) -{ - PyLongObject *v = (PyLongObject *)vv; - size_t result = 0; - Py_ssize_t ndigits; - - assert(v != NULL); - assert(PyLong_Check(v)); - ndigits = ABS(Py_SIZE(v)); - assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0); - if (ndigits > 0) { - digit msd = v->ob_digit[ndigits - 1]; - - result = (ndigits - 1) * PyLong_SHIFT; - if (result / PyLong_SHIFT != (size_t)(ndigits - 1)) - goto Overflow; - do { - ++result; - if (result == 0) - goto Overflow; - msd >>= 1; - } while (msd); - } - return result; - - Overflow: - PyErr_SetString(PyExc_OverflowError, "long has too many bits " - "to express in a platform size_t"); - return (size_t)-1; -} - -PyObject * -_PyLong_FromByteArray(const unsigned char* bytes, size_t n, - int little_endian, int is_signed) -{ - const unsigned char* pstartbyte; /* LSB of bytes */ - int incr; /* direction to move pstartbyte */ - const unsigned char* pendbyte; /* MSB of bytes */ - size_t numsignificantbytes; /* number of bytes that matter */ - Py_ssize_t ndigits; /* number of Python long digits */ - PyLongObject* v; /* result */ - Py_ssize_t idigit = 0; /* next free index in v->ob_digit */ - - if (n == 0) - return PyLong_FromLong(0L); - - if (little_endian) { - pstartbyte = bytes; - pendbyte = bytes + n - 1; - incr = 1; - } - else { - pstartbyte = bytes + n - 1; - pendbyte = bytes; - incr = -1; - } - - if (is_signed) - is_signed = *pendbyte >= 0x80; - - /* Compute numsignificantbytes. This consists of finding the most - significant byte. Leading 0 bytes are insignificant if the number - is positive, and leading 0xff bytes if negative. */ - { - size_t i; - const unsigned char* p = pendbyte; - const int pincr = -incr; /* search MSB to LSB */ - const unsigned char insignficant = is_signed ? 0xff : 0x00; - - for (i = 0; i < n; ++i, p += pincr) { - if (*p != insignficant) - break; - } - numsignificantbytes = n - i; - /* 2's-comp is a bit tricky here, e.g. 0xff00 == -0x0100, so - actually has 2 significant bytes. OTOH, 0xff0001 == - -0x00ffff, so we wouldn't *need* to bump it there; but we - do for 0xffff = -0x0001. To be safe without bothering to - check every case, bump it regardless. */ - if (is_signed && numsignificantbytes < n) - ++numsignificantbytes; - } - - /* How many Python long digits do we need? We have - 8*numsignificantbytes bits, and each Python long digit has - PyLong_SHIFT bits, so it's the ceiling of the quotient. */ - /* catch overflow before it happens */ - if (numsignificantbytes > (PY_SSIZE_T_MAX - PyLong_SHIFT) / 8) { - PyErr_SetString(PyExc_OverflowError, - "byte array too long to convert to int"); - return NULL; - } - ndigits = (numsignificantbytes * 8 + PyLong_SHIFT - 1) / PyLong_SHIFT; - v = _PyLong_New(ndigits); - if (v == NULL) - return NULL; - - /* Copy the bits over. The tricky parts are computing 2's-comp on - the fly for signed numbers, and dealing with the mismatch between - 8-bit bytes and (probably) 15-bit Python digits.*/ - { - size_t i; - twodigits carry = 1; /* for 2's-comp calculation */ - twodigits accum = 0; /* sliding register */ - unsigned int accumbits = 0; /* number of bits in accum */ - const unsigned char* p = pstartbyte; - - for (i = 0; i < numsignificantbytes; ++i, p += incr) { - twodigits thisbyte = *p; - /* Compute correction for 2's comp, if needed. */ - if (is_signed) { - thisbyte = (0xff ^ thisbyte) + carry; - carry = thisbyte >> 8; - thisbyte &= 0xff; - } - /* Because we're going LSB to MSB, thisbyte is - more significant than what's already in accum, - so needs to be prepended to accum. */ - accum |= (twodigits)thisbyte << accumbits; - accumbits += 8; - if (accumbits >= PyLong_SHIFT) { - /* There's enough to fill a Python digit. */ - assert(idigit < ndigits); - v->ob_digit[idigit] = (digit)(accum & PyLong_MASK); - ++idigit; - accum >>= PyLong_SHIFT; - accumbits -= PyLong_SHIFT; - assert(accumbits < PyLong_SHIFT); - } - } - assert(accumbits < PyLong_SHIFT); - if (accumbits) { - assert(idigit < ndigits); - v->ob_digit[idigit] = (digit)accum; - ++idigit; - } - } - - Py_SIZE(v) = is_signed ? -idigit : idigit; - return (PyObject *)long_normalize(v); -} - -int -_PyLong_AsByteArray(PyLongObject* v, - unsigned char* bytes, size_t n, - int little_endian, int is_signed) -{ - Py_ssize_t i; /* index into v->ob_digit */ - Py_ssize_t ndigits; /* |v->ob_size| */ - twodigits accum; /* sliding register */ - unsigned int accumbits; /* # bits in accum */ - int do_twos_comp; /* store 2's-comp? is_signed and v < 0 */ - digit carry; /* for computing 2's-comp */ - size_t j; /* # bytes filled */ - unsigned char* p; /* pointer to next byte in bytes */ - int pincr; /* direction to move p */ - - assert(v != NULL && PyLong_Check(v)); - - if (Py_SIZE(v) < 0) { - ndigits = -(Py_SIZE(v)); - if (!is_signed) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative long to unsigned"); - return -1; - } - do_twos_comp = 1; - } - else { - ndigits = Py_SIZE(v); - do_twos_comp = 0; - } - - if (little_endian) { - p = bytes; - pincr = 1; - } - else { - p = bytes + n - 1; - pincr = -1; - } - - /* Copy over all the Python digits. - It's crucial that every Python digit except for the MSD contribute - exactly PyLong_SHIFT bits to the total, so first assert that the long is - normalized. */ - assert(ndigits == 0 || v->ob_digit[ndigits - 1] != 0); - j = 0; - accum = 0; - accumbits = 0; - carry = do_twos_comp ? 1 : 0; - for (i = 0; i < ndigits; ++i) { - digit thisdigit = v->ob_digit[i]; - if (do_twos_comp) { - thisdigit = (thisdigit ^ PyLong_MASK) + carry; - carry = thisdigit >> PyLong_SHIFT; - thisdigit &= PyLong_MASK; - } - /* Because we're going LSB to MSB, thisdigit is more - significant than what's already in accum, so needs to be - prepended to accum. */ - accum |= (twodigits)thisdigit << accumbits; - - /* The most-significant digit may be (probably is) at least - partly empty. */ - if (i == ndigits - 1) { - /* Count # of sign bits -- they needn't be stored, - * although for signed conversion we need later to - * make sure at least one sign bit gets stored. */ - digit s = do_twos_comp ? thisdigit ^ PyLong_MASK : thisdigit; - while (s != 0) { - s >>= 1; - accumbits++; - } - } - else - accumbits += PyLong_SHIFT; - - /* Store as many bytes as possible. */ - while (accumbits >= 8) { - if (j >= n) - goto Overflow; - ++j; - *p = (unsigned char)(accum & 0xff); - p += pincr; - accumbits -= 8; - accum >>= 8; - } - } - - /* Store the straggler (if any). */ - assert(accumbits < 8); - assert(carry == 0); /* else do_twos_comp and *every* digit was 0 */ - if (accumbits > 0) { - if (j >= n) - goto Overflow; - ++j; - if (do_twos_comp) { - /* Fill leading bits of the byte with sign bits - (appropriately pretending that the long had an - infinite supply of sign bits). */ - accum |= (~(twodigits)0) << accumbits; - } - *p = (unsigned char)(accum & 0xff); - p += pincr; - } - else if (j == n && n > 0 && is_signed) { - /* The main loop filled the byte array exactly, so the code - just above didn't get to ensure there's a sign bit, and the - loop below wouldn't add one either. Make sure a sign bit - exists. */ - unsigned char msb = *(p - pincr); - int sign_bit_set = msb >= 0x80; - assert(accumbits == 0); - if (sign_bit_set == do_twos_comp) - return 0; - else - goto Overflow; - } - - /* Fill remaining bytes with copies of the sign bit. */ - { - unsigned char signbyte = do_twos_comp ? 0xffU : 0U; - for ( ; j < n; ++j, p += pincr) - *p = signbyte; - } - - return 0; - - Overflow: - PyErr_SetString(PyExc_OverflowError, "long too big to convert"); - return -1; - -} - -/* Create a new long (or int) object from a C pointer */ - -PyObject * -PyLong_FromVoidPtr(void *p) -{ -#if SIZEOF_VOID_P <= SIZEOF_LONG - if ((long)p < 0) - return PyLong_FromUnsignedLong((unsigned long)p); - return PyInt_FromLong((long)p); -#else - -#ifndef HAVE_LONG_LONG -# error "PyLong_FromVoidPtr: sizeof(void*) > sizeof(long), but no long long" -#endif -#if SIZEOF_LONG_LONG < SIZEOF_VOID_P -# error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" -#endif - /* optimize null pointers */ - if (p == NULL) - return PyInt_FromLong(0); - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)p); - -#endif /* SIZEOF_VOID_P <= SIZEOF_LONG */ -} - -/* Get a C pointer from a long object (or an int object in some cases) */ - -void * -PyLong_AsVoidPtr(PyObject *vv) -{ - /* This function will allow int or long objects. If vv is neither, - then the PyLong_AsLong*() functions will raise the exception: - PyExc_SystemError, "bad argument to internal function" - */ -#if SIZEOF_VOID_P <= SIZEOF_LONG - long x; - - if (PyInt_Check(vv)) - x = PyInt_AS_LONG(vv); - else if (PyLong_Check(vv) && _PyLong_Sign(vv) < 0) - x = PyLong_AsLong(vv); - else - x = PyLong_AsUnsignedLong(vv); -#else - -#ifndef HAVE_LONG_LONG -# error "PyLong_AsVoidPtr: sizeof(void*) > sizeof(long), but no long long" -#endif -#if SIZEOF_LONG_LONG < SIZEOF_VOID_P -# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)" -#endif - PY_LONG_LONG x; - - if (PyInt_Check(vv)) - x = PyInt_AS_LONG(vv); - else if (PyLong_Check(vv) && _PyLong_Sign(vv) < 0) - x = PyLong_AsLongLong(vv); - else - x = PyLong_AsUnsignedLongLong(vv); - -#endif /* SIZEOF_VOID_P <= SIZEOF_LONG */ - - if (x == -1 && PyErr_Occurred()) - return NULL; - return (void *)x; -} - -#ifdef HAVE_LONG_LONG - -/* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later - * rewritten to use the newer PyLong_{As,From}ByteArray API. - */ - -#define IS_LITTLE_ENDIAN (int)*(unsigned char*)&one -#define PY_ABS_LLONG_MIN (0-(unsigned PY_LONG_LONG)PY_LLONG_MIN) - -/* Create a new long int object from a C PY_LONG_LONG int. */ - -PyObject * -PyLong_FromLongLong(PY_LONG_LONG ival) -{ - PyLongObject *v; - unsigned PY_LONG_LONG abs_ival; - unsigned PY_LONG_LONG t; /* unsigned so >> doesn't propagate sign bit */ - int ndigits = 0; - int negative = 0; - - if (ival < 0) { - /* avoid signed overflow on negation; see comments - in PyLong_FromLong above. */ - abs_ival = (unsigned PY_LONG_LONG)(-1-ival) + 1; - negative = 1; - } - else { - abs_ival = (unsigned PY_LONG_LONG)ival; - } - - /* Count the number of Python digits. - We used to pick 5 ("big enough for anything"), but that's a - waste of time and space given that 5*15 = 75 bits are rarely - needed. */ - t = abs_ival; - while (t) { - ++ndigits; - t >>= PyLong_SHIFT; - } - v = _PyLong_New(ndigits); - if (v != NULL) { - digit *p = v->ob_digit; - Py_SIZE(v) = negative ? -ndigits : ndigits; - t = abs_ival; - while (t) { - *p++ = (digit)(t & PyLong_MASK); - t >>= PyLong_SHIFT; - } - } - return (PyObject *)v; -} - -/* Create a new long int object from a C unsigned PY_LONG_LONG int. */ - -PyObject * -PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG ival) -{ - PyLongObject *v; - unsigned PY_LONG_LONG t; - int ndigits = 0; - - /* Count the number of Python digits. */ - t = (unsigned PY_LONG_LONG)ival; - while (t) { - ++ndigits; - t >>= PyLong_SHIFT; - } - v = _PyLong_New(ndigits); - if (v != NULL) { - digit *p = v->ob_digit; - Py_SIZE(v) = ndigits; - while (ival) { - *p++ = (digit)(ival & PyLong_MASK); - ival >>= PyLong_SHIFT; - } - } - return (PyObject *)v; -} - -/* Create a new long int object from a C Py_ssize_t. */ - -PyObject * -PyLong_FromSsize_t(Py_ssize_t ival) -{ - Py_ssize_t bytes = ival; - int one = 1; - return _PyLong_FromByteArray((unsigned char *)&bytes, - SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 1); -} - -/* Create a new long int object from a C size_t. */ - -PyObject * -PyLong_FromSize_t(size_t ival) -{ - size_t bytes = ival; - int one = 1; - return _PyLong_FromByteArray((unsigned char *)&bytes, - SIZEOF_SIZE_T, IS_LITTLE_ENDIAN, 0); -} - -/* Get a C PY_LONG_LONG int from a long int object. - Return -1 and set an error if overflow occurs. */ - -PY_LONG_LONG -PyLong_AsLongLong(PyObject *vv) -{ - PY_LONG_LONG bytes; - int one = 1; - int res; - - if (vv == NULL) { - PyErr_BadInternalCall(); - return -1; - } - if (!PyLong_Check(vv)) { - PyNumberMethods *nb; - PyObject *io; - if (PyInt_Check(vv)) - return (PY_LONG_LONG)PyInt_AsLong(vv); - if ((nb = vv->ob_type->tp_as_number) == NULL || - nb->nb_int == NULL) { - PyErr_SetString(PyExc_TypeError, "an integer is required"); - return -1; - } - io = (*nb->nb_int) (vv); - if (io == NULL) - return -1; - if (PyInt_Check(io)) { - bytes = PyInt_AsLong(io); - Py_DECREF(io); - return bytes; - } - if (PyLong_Check(io)) { - bytes = PyLong_AsLongLong(io); - Py_DECREF(io); - return bytes; - } - Py_DECREF(io); - PyErr_SetString(PyExc_TypeError, "integer conversion failed"); - return -1; - } - - res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes, - SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 1); - - /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ - if (res < 0) - return (PY_LONG_LONG)-1; - else - return bytes; -} - -/* Get a C unsigned PY_LONG_LONG int from a long int object. - Return -1 and set an error if overflow occurs. */ - -unsigned PY_LONG_LONG -PyLong_AsUnsignedLongLong(PyObject *vv) -{ - unsigned PY_LONG_LONG bytes; - int one = 1; - int res; - - if (vv == NULL || !PyLong_Check(vv)) { - PyErr_BadInternalCall(); - return (unsigned PY_LONG_LONG)-1; - } - - res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes, - SIZEOF_LONG_LONG, IS_LITTLE_ENDIAN, 0); - - /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */ - if (res < 0) - return (unsigned PY_LONG_LONG)res; - else - return bytes; -} - -/* Get a C unsigned long int from a long int object, ignoring the high bits. - Returns -1 and sets an error condition if an error occurs. */ - -unsigned PY_LONG_LONG -PyLong_AsUnsignedLongLongMask(PyObject *vv) -{ - register PyLongObject *v; - unsigned PY_LONG_LONG x; - Py_ssize_t i; - int sign; - - if (vv == NULL || !PyLong_Check(vv)) { - PyErr_BadInternalCall(); - return (unsigned long) -1; - } - v = (PyLongObject *)vv; - i = v->ob_size; - sign = 1; - x = 0; - if (i < 0) { - sign = -1; - i = -i; - } - while (--i >= 0) { - x = (x << PyLong_SHIFT) | v->ob_digit[i]; - } - return x * sign; -} - -/* Get a C long long int from a Python long or Python int object. - On overflow, returns -1 and sets *overflow to 1 or -1 depending - on the sign of the result. Otherwise *overflow is 0. - - For other errors (e.g., type error), returns -1 and sets an error - condition. -*/ - -PY_LONG_LONG -PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow) -{ - /* This version by Tim Peters */ - register PyLongObject *v; - unsigned PY_LONG_LONG x, prev; - PY_LONG_LONG res; - Py_ssize_t i; - int sign; - int do_decref = 0; /* if nb_int was called */ - - *overflow = 0; - if (vv == NULL) { - PyErr_BadInternalCall(); - return -1; - } - - if (PyInt_Check(vv)) - return PyInt_AsLong(vv); - - if (!PyLong_Check(vv)) { - PyNumberMethods *nb; - nb = vv->ob_type->tp_as_number; - if (nb == NULL || nb->nb_int == NULL) { - PyErr_SetString(PyExc_TypeError, - "an integer is required"); - return -1; - } - vv = (*nb->nb_int) (vv); - if (vv == NULL) - return -1; - do_decref = 1; - if(PyInt_Check(vv)) { - res = PyInt_AsLong(vv); - goto exit; - } - if (!PyLong_Check(vv)) { - Py_DECREF(vv); - PyErr_SetString(PyExc_TypeError, - "nb_int should return int object"); - return -1; - } - } - - res = -1; - v = (PyLongObject *)vv; - i = Py_SIZE(v); - - switch (i) { - case -1: - res = -(sdigit)v->ob_digit[0]; - break; - case 0: - res = 0; - break; - case 1: - res = v->ob_digit[0]; - break; - default: - sign = 1; - x = 0; - if (i < 0) { - sign = -1; - i = -(i); - } - while (--i >= 0) { - prev = x; - x = (x << PyLong_SHIFT) + v->ob_digit[i]; - if ((x >> PyLong_SHIFT) != prev) { - *overflow = sign; - goto exit; - } - } - /* Haven't lost any bits, but casting to long requires extra - * care (see comment above). - */ - if (x <= (unsigned PY_LONG_LONG)PY_LLONG_MAX) { - res = (PY_LONG_LONG)x * sign; - } - else if (sign < 0 && x == PY_ABS_LLONG_MIN) { - res = PY_LLONG_MIN; - } - else { - *overflow = sign; - /* res is already set to -1 */ - } - } - exit: - if (do_decref) { - Py_DECREF(vv); - } - return res; -} - -#undef IS_LITTLE_ENDIAN - -#endif /* HAVE_LONG_LONG */ - - -static int -convert_binop(PyObject *v, PyObject *w, PyLongObject **a, PyLongObject **b) { - if (PyLong_Check(v)) { - *a = (PyLongObject *) v; - Py_INCREF(v); - } - else if (PyInt_Check(v)) { - *a = (PyLongObject *) PyLong_FromLong(PyInt_AS_LONG(v)); - } - else { - return 0; - } - if (PyLong_Check(w)) { - *b = (PyLongObject *) w; - Py_INCREF(w); - } - else if (PyInt_Check(w)) { - *b = (PyLongObject *) PyLong_FromLong(PyInt_AS_LONG(w)); - } - else { - Py_DECREF(*a); - return 0; - } - return 1; -} - -#define CONVERT_BINOP(v, w, a, b) \ - do { \ - if (!convert_binop(v, w, a, b)) { \ - Py_INCREF(Py_NotImplemented); \ - return Py_NotImplemented; \ - } \ - } while(0) \ - -/* bits_in_digit(d) returns the unique integer k such that 2**(k-1) <= d < - 2**k if d is nonzero, else 0. */ - -static const unsigned char BitLengthTable[32] = { - 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, - 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 -}; - -static int -bits_in_digit(digit d) -{ - int d_bits = 0; - while (d >= 32) { - d_bits += 6; - d >>= 6; - } - d_bits += (int)BitLengthTable[d]; - return d_bits; -} - -/* x[0:m] and y[0:n] are digit vectors, LSD first, m >= n required. x[0:n] - * is modified in place, by adding y to it. Carries are propagated as far as - * x[m-1], and the remaining carry (0 or 1) is returned. - */ -static digit -v_iadd(digit *x, Py_ssize_t m, digit *y, Py_ssize_t n) -{ - Py_ssize_t i; - digit carry = 0; - - assert(m >= n); - for (i = 0; i < n; ++i) { - carry += x[i] + y[i]; - x[i] = carry & PyLong_MASK; - carry >>= PyLong_SHIFT; - assert((carry & 1) == carry); - } - for (; carry && i < m; ++i) { - carry += x[i]; - x[i] = carry & PyLong_MASK; - carry >>= PyLong_SHIFT; - assert((carry & 1) == carry); - } - return carry; -} - -/* x[0:m] and y[0:n] are digit vectors, LSD first, m >= n required. x[0:n] - * is modified in place, by subtracting y from it. Borrows are propagated as - * far as x[m-1], and the remaining borrow (0 or 1) is returned. - */ -static digit -v_isub(digit *x, Py_ssize_t m, digit *y, Py_ssize_t n) -{ - Py_ssize_t i; - digit borrow = 0; - - assert(m >= n); - for (i = 0; i < n; ++i) { - borrow = x[i] - y[i] - borrow; - x[i] = borrow & PyLong_MASK; - borrow >>= PyLong_SHIFT; - borrow &= 1; /* keep only 1 sign bit */ - } - for (; borrow && i < m; ++i) { - borrow = x[i] - borrow; - x[i] = borrow & PyLong_MASK; - borrow >>= PyLong_SHIFT; - borrow &= 1; - } - return borrow; -} - -/* Shift digit vector a[0:m] d bits left, with 0 <= d < PyLong_SHIFT. Put - * result in z[0:m], and return the d bits shifted out of the top. - */ -static digit -v_lshift(digit *z, digit *a, Py_ssize_t m, int d) -{ - Py_ssize_t i; - digit carry = 0; - - assert(0 <= d && d < PyLong_SHIFT); - for (i=0; i < m; i++) { - twodigits acc = (twodigits)a[i] << d | carry; - z[i] = (digit)acc & PyLong_MASK; - carry = (digit)(acc >> PyLong_SHIFT); - } - return carry; -} - -/* Shift digit vector a[0:m] d bits right, with 0 <= d < PyLong_SHIFT. Put - * result in z[0:m], and return the d bits shifted out of the bottom. - */ -static digit -v_rshift(digit *z, digit *a, Py_ssize_t m, int d) -{ - Py_ssize_t i; - digit carry = 0; - digit mask = ((digit)1 << d) - 1U; - - assert(0 <= d && d < PyLong_SHIFT); - for (i=m; i-- > 0;) { - twodigits acc = (twodigits)carry << PyLong_SHIFT | a[i]; - carry = (digit)acc & mask; - z[i] = (digit)(acc >> d); - } - return carry; -} - -/* Divide long pin, w/ size digits, by non-zero digit n, storing quotient - in pout, and returning the remainder. pin and pout point at the LSD. - It's OK for pin == pout on entry, which saves oodles of mallocs/frees in - _PyLong_Format, but that should be done with great care since longs are - immutable. */ - -static digit -inplace_divrem1(digit *pout, digit *pin, Py_ssize_t size, digit n) -{ - twodigits rem = 0; - - assert(n > 0 && n <= PyLong_MASK); - pin += size; - pout += size; - while (--size >= 0) { - digit hi; - rem = (rem << PyLong_SHIFT) | *--pin; - *--pout = hi = (digit)(rem / n); - rem -= (twodigits)hi * n; - } - return (digit)rem; -} - -/* Divide a long integer by a digit, returning both the quotient - (as function result) and the remainder (through *prem). - The sign of a is ignored; n should not be zero. */ - -static PyLongObject * -divrem1(PyLongObject *a, digit n, digit *prem) -{ - const Py_ssize_t size = ABS(Py_SIZE(a)); - PyLongObject *z; - - assert(n > 0 && n <= PyLong_MASK); - z = _PyLong_New(size); - if (z == NULL) - return NULL; - *prem = inplace_divrem1(z->ob_digit, a->ob_digit, size, n); - return long_normalize(z); -} - -/* Convert a long integer to a base 10 string. Returns a new non-shared - string. (Return value is non-shared so that callers can modify the - returned value if necessary.) */ - -static PyObject * -long_to_decimal_string(PyObject *aa, int addL) -{ - PyLongObject *scratch, *a; - PyObject *str; - Py_ssize_t size, strlen, size_a, i, j; - digit *pout, *pin, rem, tenpow; - char *p; - int negative; - - a = (PyLongObject *)aa; - if (a == NULL || !PyLong_Check(a)) { - PyErr_BadInternalCall(); - return NULL; - } - size_a = ABS(Py_SIZE(a)); - negative = Py_SIZE(a) < 0; - - /* quick and dirty upper bound for the number of digits - required to express a in base _PyLong_DECIMAL_BASE: - - #digits = 1 + floor(log2(a) / log2(_PyLong_DECIMAL_BASE)) - - But log2(a) < size_a * PyLong_SHIFT, and - log2(_PyLong_DECIMAL_BASE) = log2(10) * _PyLong_DECIMAL_SHIFT - > 3 * _PyLong_DECIMAL_SHIFT - */ - if (size_a > PY_SSIZE_T_MAX / PyLong_SHIFT) { - PyErr_SetString(PyExc_OverflowError, - "long is too large to format"); - return NULL; - } - /* the expression size_a * PyLong_SHIFT is now safe from overflow */ - size = 1 + size_a * PyLong_SHIFT / (3 * _PyLong_DECIMAL_SHIFT); - scratch = _PyLong_New(size); - if (scratch == NULL) - return NULL; - - /* convert array of base _PyLong_BASE digits in pin to an array of - base _PyLong_DECIMAL_BASE digits in pout, following Knuth (TAOCP, - Volume 2 (3rd edn), section 4.4, Method 1b). */ - pin = a->ob_digit; - pout = scratch->ob_digit; - size = 0; - for (i = size_a; --i >= 0; ) { - digit hi = pin[i]; - for (j = 0; j < size; j++) { - twodigits z = (twodigits)pout[j] << PyLong_SHIFT | hi; - hi = (digit)(z / _PyLong_DECIMAL_BASE); - pout[j] = (digit)(z - (twodigits)hi * - _PyLong_DECIMAL_BASE); - } - while (hi) { - pout[size++] = hi % _PyLong_DECIMAL_BASE; - hi /= _PyLong_DECIMAL_BASE; - } - /* check for keyboard interrupt */ - SIGCHECK({ - Py_DECREF(scratch); - return NULL; - }); - } - /* pout should have at least one digit, so that the case when a = 0 - works correctly */ - if (size == 0) - pout[size++] = 0; - - /* calculate exact length of output string, and allocate */ - strlen = (addL != 0) + negative + - 1 + (size - 1) * _PyLong_DECIMAL_SHIFT; - tenpow = 10; - rem = pout[size-1]; - while (rem >= tenpow) { - tenpow *= 10; - strlen++; - } - str = PyString_FromStringAndSize(NULL, strlen); - if (str == NULL) { - Py_DECREF(scratch); - return NULL; - } - - /* fill the string right-to-left */ - p = PyString_AS_STRING(str) + strlen; - *p = '\0'; - if (addL) - *--p = 'L'; - /* pout[0] through pout[size-2] contribute exactly - _PyLong_DECIMAL_SHIFT digits each */ - for (i=0; i < size - 1; i++) { - rem = pout[i]; - for (j = 0; j < _PyLong_DECIMAL_SHIFT; j++) { - *--p = '0' + rem % 10; - rem /= 10; - } - } - /* pout[size-1]: always produce at least one decimal digit */ - rem = pout[i]; - do { - *--p = '0' + rem % 10; - rem /= 10; - } while (rem != 0); - - /* and sign */ - if (negative) - *--p = '-'; - - /* check we've counted correctly */ - assert(p == PyString_AS_STRING(str)); - Py_DECREF(scratch); - return (PyObject *)str; -} - -/* Convert the long to a string object with given base, - appending a base prefix of 0[box] if base is 2, 8 or 16. - Add a trailing "L" if addL is non-zero. - If newstyle is zero, then use the pre-2.6 behavior of octal having - a leading "0", instead of the prefix "0o" */ -PyAPI_FUNC(PyObject *) -_PyLong_Format(PyObject *aa, int base, int addL, int newstyle) -{ - register PyLongObject *a = (PyLongObject *)aa; - PyStringObject *str; - Py_ssize_t i, sz; - Py_ssize_t size_a; - char *p; - int bits; - char sign = '\0'; - - if (base == 10) - return long_to_decimal_string((PyObject *)a, addL); - - if (a == NULL || !PyLong_Check(a)) { - PyErr_BadInternalCall(); - return NULL; - } - assert(base >= 2 && base <= 36); - size_a = ABS(Py_SIZE(a)); - - /* Compute a rough upper bound for the length of the string */ - i = base; - bits = 0; - while (i > 1) { - ++bits; - i >>= 1; - } - i = 5 + (addL ? 1 : 0); - /* ensure we don't get signed overflow in sz calculation */ - if (size_a > (PY_SSIZE_T_MAX - i) / PyLong_SHIFT) { - PyErr_SetString(PyExc_OverflowError, - "long is too large to format"); - return NULL; - } - sz = i + 1 + (size_a * PyLong_SHIFT - 1) / bits; - assert(sz >= 0); - str = (PyStringObject *) PyString_FromStringAndSize((char *)0, sz); - if (str == NULL) - return NULL; - p = PyString_AS_STRING(str) + sz; - *p = '\0'; - if (addL) - *--p = 'L'; - if (a->ob_size < 0) - sign = '-'; - - if (a->ob_size == 0) { - *--p = '0'; - } - else if ((base & (base - 1)) == 0) { - /* JRH: special case for power-of-2 bases */ - twodigits accum = 0; - int accumbits = 0; /* # of bits in accum */ - int basebits = 1; /* # of bits in base-1 */ - i = base; - while ((i >>= 1) > 1) - ++basebits; - - for (i = 0; i < size_a; ++i) { - accum |= (twodigits)a->ob_digit[i] << accumbits; - accumbits += PyLong_SHIFT; - assert(accumbits >= basebits); - do { - char cdigit = (char)(accum & (base - 1)); - cdigit += (cdigit < 10) ? '0' : 'a'-10; - assert(p > PyString_AS_STRING(str)); - *--p = cdigit; - accumbits -= basebits; - accum >>= basebits; - } while (i < size_a-1 ? accumbits >= basebits : accum > 0); - } - } - else { - /* Not 0, and base not a power of 2. Divide repeatedly by - base, but for speed use the highest power of base that - fits in a digit. */ - Py_ssize_t size = size_a; - digit *pin = a->ob_digit; - PyLongObject *scratch; - /* powbasw <- largest power of base that fits in a digit. */ - digit powbase = base; /* powbase == base ** power */ - int power = 1; - for (;;) { - twodigits newpow = powbase * (twodigits)base; - if (newpow >> PyLong_SHIFT) - /* doesn't fit in a digit */ - break; - powbase = (digit)newpow; - ++power; - } - - /* Get a scratch area for repeated division. */ - scratch = _PyLong_New(size); - if (scratch == NULL) { - Py_DECREF(str); - return NULL; - } - - /* Repeatedly divide by powbase. */ - do { - int ntostore = power; - digit rem = inplace_divrem1(scratch->ob_digit, - pin, size, powbase); - pin = scratch->ob_digit; /* no need to use a again */ - if (pin[size - 1] == 0) - --size; - SIGCHECK({ - Py_DECREF(scratch); - Py_DECREF(str); - return NULL; - }); - - /* Break rem into digits. */ - assert(ntostore > 0); - do { - digit nextrem = (digit)(rem / base); - char c = (char)(rem - nextrem * base); - assert(p > PyString_AS_STRING(str)); - c += (c < 10) ? '0' : 'a'-10; - *--p = c; - rem = nextrem; - --ntostore; - /* Termination is a bit delicate: must not - store leading zeroes, so must get out if - remaining quotient and rem are both 0. */ - } while (ntostore && (size || rem)); - } while (size != 0); - Py_DECREF(scratch); - } - - if (base == 2) { - *--p = 'b'; - *--p = '0'; - } - else if (base == 8) { - if (newstyle) { - *--p = 'o'; - *--p = '0'; - } - else - if (size_a != 0) - *--p = '0'; - } - else if (base == 16) { - *--p = 'x'; - *--p = '0'; - } - else if (base != 10) { - *--p = '#'; - *--p = '0' + base%10; - if (base > 10) - *--p = '0' + base/10; - } - if (sign) - *--p = sign; - if (p != PyString_AS_STRING(str)) { - char *q = PyString_AS_STRING(str); - assert(p > q); - do { - } while ((*q++ = *p++) != '\0'); - q--; - _PyString_Resize((PyObject **)&str, - (Py_ssize_t) (q - PyString_AS_STRING(str))); - } - return (PyObject *)str; -} - -/* Table of digit values for 8-bit string -> integer conversion. - * '0' maps to 0, ..., '9' maps to 9. - * 'a' and 'A' map to 10, ..., 'z' and 'Z' map to 35. - * All other indices map to 37. - * Note that when converting a base B string, a char c is a legitimate - * base B digit iff _PyLong_DigitValue[Py_CHARMASK(c)] < B. - */ -int _PyLong_DigitValue[256] = { - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 37, 37, 37, 37, 37, 37, - 37, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 37, 37, 37, 37, - 37, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, - 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, -}; - -/* *str points to the first digit in a string of base `base` digits. base - * is a power of 2 (2, 4, 8, 16, or 32). *str is set to point to the first - * non-digit (which may be *str!). A normalized long is returned. - * The point to this routine is that it takes time linear in the number of - * string characters. - */ -static PyLongObject * -long_from_binary_base(char **str, int base) -{ - char *p = *str; - char *start = p; - int bits_per_char; - Py_ssize_t n; - PyLongObject *z; - twodigits accum; - int bits_in_accum; - digit *pdigit; - - assert(base >= 2 && base <= 32 && (base & (base - 1)) == 0); - n = base; - for (bits_per_char = -1; n; ++bits_per_char) - n >>= 1; - /* n <- total # of bits needed, while setting p to end-of-string */ - while (_PyLong_DigitValue[Py_CHARMASK(*p)] < base) - ++p; - *str = p; - /* n <- # of Python digits needed, = ceiling(n/PyLong_SHIFT). */ - n = (p - start) * bits_per_char + PyLong_SHIFT - 1; - if (n / bits_per_char < p - start) { - PyErr_SetString(PyExc_ValueError, - "long string too large to convert"); - return NULL; - } - n = n / PyLong_SHIFT; - z = _PyLong_New(n); - if (z == NULL) - return NULL; - /* Read string from right, and fill in long from left; i.e., - * from least to most significant in both. - */ - accum = 0; - bits_in_accum = 0; - pdigit = z->ob_digit; - while (--p >= start) { - int k = _PyLong_DigitValue[Py_CHARMASK(*p)]; - assert(k >= 0 && k < base); - accum |= (twodigits)k << bits_in_accum; - bits_in_accum += bits_per_char; - if (bits_in_accum >= PyLong_SHIFT) { - *pdigit++ = (digit)(accum & PyLong_MASK); - assert(pdigit - z->ob_digit <= n); - accum >>= PyLong_SHIFT; - bits_in_accum -= PyLong_SHIFT; - assert(bits_in_accum < PyLong_SHIFT); - } - } - if (bits_in_accum) { - assert(bits_in_accum <= PyLong_SHIFT); - *pdigit++ = (digit)accum; - assert(pdigit - z->ob_digit <= n); - } - while (pdigit - z->ob_digit < n) - *pdigit++ = 0; - return long_normalize(z); -} - -PyObject * -PyLong_FromString(char *str, char **pend, int base) -{ - int sign = 1; - char *start, *orig_str = str; - PyLongObject *z; - PyObject *strobj, *strrepr; - Py_ssize_t slen; - - if ((base != 0 && base < 2) || base > 36) { - PyErr_SetString(PyExc_ValueError, - "long() arg 2 must be >= 2 and <= 36"); - return NULL; - } - while (*str != '\0' && isspace(Py_CHARMASK(*str))) - str++; - if (*str == '+') - ++str; - else if (*str == '-') { - ++str; - sign = -1; - } - while (*str != '\0' && isspace(Py_CHARMASK(*str))) - str++; - if (base == 0) { - /* No base given. Deduce the base from the contents - of the string */ - if (str[0] != '0') - base = 10; - else if (str[1] == 'x' || str[1] == 'X') - base = 16; - else if (str[1] == 'o' || str[1] == 'O') - base = 8; - else if (str[1] == 'b' || str[1] == 'B') - base = 2; - else - /* "old" (C-style) octal literal, still valid in - 2.x, although illegal in 3.x */ - base = 8; - } - /* Whether or not we were deducing the base, skip leading chars - as needed */ - if (str[0] == '0' && - ((base == 16 && (str[1] == 'x' || str[1] == 'X')) || - (base == 8 && (str[1] == 'o' || str[1] == 'O')) || - (base == 2 && (str[1] == 'b' || str[1] == 'B')))) - str += 2; - - start = str; - if ((base & (base - 1)) == 0) - z = long_from_binary_base(&str, base); - else { -/*** -Binary bases can be converted in time linear in the number of digits, because -Python's representation base is binary. Other bases (including decimal!) use -the simple quadratic-time algorithm below, complicated by some speed tricks. - -First some math: the largest integer that can be expressed in N base-B digits -is B**N-1. Consequently, if we have an N-digit input in base B, the worst- -case number of Python digits needed to hold it is the smallest integer n s.t. - - PyLong_BASE**n-1 >= B**N-1 [or, adding 1 to both sides] - PyLong_BASE**n >= B**N [taking logs to base PyLong_BASE] - n >= log(B**N)/log(PyLong_BASE) = N * log(B)/log(PyLong_BASE) - -The static array log_base_PyLong_BASE[base] == log(base)/log(PyLong_BASE) so -we can compute this quickly. A Python long with that much space is reserved -near the start, and the result is computed into it. - -The input string is actually treated as being in base base**i (i.e., i digits -are processed at a time), where two more static arrays hold: - - convwidth_base[base] = the largest integer i such that - base**i <= PyLong_BASE - convmultmax_base[base] = base ** convwidth_base[base] - -The first of these is the largest i such that i consecutive input digits -must fit in a single Python digit. The second is effectively the input -base we're really using. - -Viewing the input as a sequence of digits in base -convmultmax_base[base], the result is "simply" - - (((c0*B + c1)*B + c2)*B + c3)*B + ... ))) + c_n-1 - -where B = convmultmax_base[base]. - -Error analysis: as above, the number of Python digits `n` needed is worst- -case - - n >= N * log(B)/log(PyLong_BASE) - -where `N` is the number of input digits in base `B`. This is computed via - - size_z = (Py_ssize_t)((scan - str) * log_base_PyLong_BASE[base]) + 1; - -below. Two numeric concerns are how much space this can waste, and whether -the computed result can be too small. To be concrete, assume PyLong_BASE = -2**15, which is the default (and it's unlikely anyone changes that). - -Waste isn't a problem: provided the first input digit isn't 0, the difference -between the worst-case input with N digits and the smallest input with N -digits is about a factor of B, but B is small compared to PyLong_BASE so at -most one allocated Python digit can remain unused on that count. If -N*log(B)/log(PyLong_BASE) is mathematically an exact integer, then truncating -that and adding 1 returns a result 1 larger than necessary. However, that -can't happen: whenever B is a power of 2, long_from_binary_base() is called -instead, and it's impossible for B**i to be an integer power of 2**15 when B -is not a power of 2 (i.e., it's impossible for N*log(B)/log(PyLong_BASE) to be -an exact integer when B is not a power of 2, since B**i has a prime factor -other than 2 in that case, but (2**15)**j's only prime factor is 2). - -The computed result can be too small if the true value of -N*log(B)/log(PyLong_BASE) is a little bit larger than an exact integer, but -due to roundoff errors (in computing log(B), log(PyLong_BASE), their quotient, -and/or multiplying that by N) yields a numeric result a little less than that -integer. Unfortunately, "how close can a transcendental function get to an -integer over some range?" questions are generally theoretically intractable. -Computer analysis via continued fractions is practical: expand -log(B)/log(PyLong_BASE) via continued fractions, giving a sequence i/j of "the -best" rational approximations. Then j*log(B)/log(PyLong_BASE) is -approximately equal to (the integer) i. This shows that we can get very close -to being in trouble, but very rarely. For example, 76573 is a denominator in -one of the continued-fraction approximations to log(10)/log(2**15), and -indeed: - - >>> log(10)/log(2**15)*76573 - 16958.000000654003 - -is very close to an integer. If we were working with IEEE single-precision, -rounding errors could kill us. Finding worst cases in IEEE double-precision -requires better-than-double-precision log() functions, and Tim didn't bother. -Instead the code checks to see whether the allocated space is enough as each -new Python digit is added, and copies the whole thing to a larger long if not. -This should happen extremely rarely, and in fact I don't have a test case -that triggers it(!). Instead the code was tested by artificially allocating -just 1 digit at the start, so that the copying code was exercised for every -digit beyond the first. -***/ - register twodigits c; /* current input character */ - Py_ssize_t size_z; - int i; - int convwidth; - twodigits convmultmax, convmult; - digit *pz, *pzstop; - char* scan; - - static double log_base_PyLong_BASE[37] = {0.0e0,}; - static int convwidth_base[37] = {0,}; - static twodigits convmultmax_base[37] = {0,}; - - if (log_base_PyLong_BASE[base] == 0.0) { - twodigits convmax = base; - int i = 1; - - log_base_PyLong_BASE[base] = (log((double)base) / - log((double)PyLong_BASE)); - for (;;) { - twodigits next = convmax * base; - if (next > PyLong_BASE) - break; - convmax = next; - ++i; - } - convmultmax_base[base] = convmax; - assert(i > 0); - convwidth_base[base] = i; - } - - /* Find length of the string of numeric characters. */ - scan = str; - while (_PyLong_DigitValue[Py_CHARMASK(*scan)] < base) - ++scan; - - /* Create a long object that can contain the largest possible - * integer with this base and length. Note that there's no - * need to initialize z->ob_digit -- no slot is read up before - * being stored into. - */ - size_z = (Py_ssize_t)((scan - str) * log_base_PyLong_BASE[base]) + 1; - /* Uncomment next line to test exceedingly rare copy code */ - /* size_z = 1; */ - assert(size_z > 0); - z = _PyLong_New(size_z); - if (z == NULL) - return NULL; - Py_SIZE(z) = 0; - - /* `convwidth` consecutive input digits are treated as a single - * digit in base `convmultmax`. - */ - convwidth = convwidth_base[base]; - convmultmax = convmultmax_base[base]; - - /* Work ;-) */ - while (str < scan) { - /* grab up to convwidth digits from the input string */ - c = (digit)_PyLong_DigitValue[Py_CHARMASK(*str++)]; - for (i = 1; i < convwidth && str != scan; ++i, ++str) { - c = (twodigits)(c * base + - _PyLong_DigitValue[Py_CHARMASK(*str)]); - assert(c < PyLong_BASE); - } - - convmult = convmultmax; - /* Calculate the shift only if we couldn't get - * convwidth digits. - */ - if (i != convwidth) { - convmult = base; - for ( ; i > 1; --i) - convmult *= base; - } - - /* Multiply z by convmult, and add c. */ - pz = z->ob_digit; - pzstop = pz + Py_SIZE(z); - for (; pz < pzstop; ++pz) { - c += (twodigits)*pz * convmult; - *pz = (digit)(c & PyLong_MASK); - c >>= PyLong_SHIFT; - } - /* carry off the current end? */ - if (c) { - assert(c < PyLong_BASE); - if (Py_SIZE(z) < size_z) { - *pz = (digit)c; - ++Py_SIZE(z); - } - else { - PyLongObject *tmp; - /* Extremely rare. Get more space. */ - assert(Py_SIZE(z) == size_z); - tmp = _PyLong_New(size_z + 1); - if (tmp == NULL) { - Py_DECREF(z); - return NULL; - } - memcpy(tmp->ob_digit, - z->ob_digit, - sizeof(digit) * size_z); - Py_DECREF(z); - z = tmp; - z->ob_digit[size_z] = (digit)c; - ++size_z; - } - } - } - } - if (z == NULL) - return NULL; - if (str == start) - goto onError; - if (sign < 0) - Py_SIZE(z) = -(Py_SIZE(z)); - if (*str == 'L' || *str == 'l') - str++; - while (*str && isspace(Py_CHARMASK(*str))) - str++; - if (*str != '\0') - goto onError; - if (pend) - *pend = str; - return (PyObject *) z; - - onError: - Py_XDECREF(z); - slen = strlen(orig_str) < 200 ? strlen(orig_str) : 200; - strobj = PyString_FromStringAndSize(orig_str, slen); - if (strobj == NULL) - return NULL; - strrepr = PyObject_Repr(strobj); - Py_DECREF(strobj); - if (strrepr == NULL) - return NULL; - PyErr_Format(PyExc_ValueError, - "invalid literal for long() with base %d: %s", - base, PyString_AS_STRING(strrepr)); - Py_DECREF(strrepr); - return NULL; -} - -#ifdef Py_USING_UNICODE -PyObject * -PyLong_FromUnicode(Py_UNICODE *u, Py_ssize_t length, int base) -{ - PyObject *result; - char *buffer = (char *)PyMem_MALLOC(length+1); - - if (buffer == NULL) - return NULL; - - if (PyUnicode_EncodeDecimal(u, length, buffer, NULL)) { - PyMem_FREE(buffer); - return NULL; - } - result = PyLong_FromString(buffer, NULL, base); - PyMem_FREE(buffer); - return result; -} -#endif - -/* forward */ -static PyLongObject *x_divrem - (PyLongObject *, PyLongObject *, PyLongObject **); -static PyObject *long_long(PyObject *v); - -/* Long division with remainder, top-level routine */ - -static int -long_divrem(PyLongObject *a, PyLongObject *b, - PyLongObject **pdiv, PyLongObject **prem) -{ - Py_ssize_t size_a = ABS(Py_SIZE(a)), size_b = ABS(Py_SIZE(b)); - PyLongObject *z; - - if (size_b == 0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "long division or modulo by zero"); - return -1; - } - if (size_a < size_b || - (size_a == size_b && - a->ob_digit[size_a-1] < b->ob_digit[size_b-1])) { - /* |a| < |b|. */ - *pdiv = _PyLong_New(0); - if (*pdiv == NULL) - return -1; - Py_INCREF(a); - *prem = (PyLongObject *) a; - return 0; - } - if (size_b == 1) { - digit rem = 0; - z = divrem1(a, b->ob_digit[0], &rem); - if (z == NULL) - return -1; - *prem = (PyLongObject *) PyLong_FromLong((long)rem); - if (*prem == NULL) { - Py_DECREF(z); - return -1; - } - } - else { - z = x_divrem(a, b, prem); - if (z == NULL) - return -1; - } - /* Set the signs. - The quotient z has the sign of a*b; - the remainder r has the sign of a, - so a = b*z + r. */ - if ((a->ob_size < 0) != (b->ob_size < 0)) - z->ob_size = -(z->ob_size); - if (a->ob_size < 0 && (*prem)->ob_size != 0) - (*prem)->ob_size = -((*prem)->ob_size); - *pdiv = z; - return 0; -} - -/* Unsigned long division with remainder -- the algorithm. The arguments v1 - and w1 should satisfy 2 <= ABS(Py_SIZE(w1)) <= ABS(Py_SIZE(v1)). */ - -static PyLongObject * -x_divrem(PyLongObject *v1, PyLongObject *w1, PyLongObject **prem) -{ - PyLongObject *v, *w, *a; - Py_ssize_t i, k, size_v, size_w; - int d; - digit wm1, wm2, carry, q, r, vtop, *v0, *vk, *w0, *ak; - twodigits vv; - sdigit zhi; - stwodigits z; - - /* We follow Knuth [The Art of Computer Programming, Vol. 2 (3rd - edn.), section 4.3.1, Algorithm D], except that we don't explicitly - handle the special case when the initial estimate q for a quotient - digit is >= PyLong_BASE: the max value for q is PyLong_BASE+1, and - that won't overflow a digit. */ - - /* allocate space; w will also be used to hold the final remainder */ - size_v = ABS(Py_SIZE(v1)); - size_w = ABS(Py_SIZE(w1)); - assert(size_v >= size_w && size_w >= 2); /* Assert checks by div() */ - v = _PyLong_New(size_v+1); - if (v == NULL) { - *prem = NULL; - return NULL; - } - w = _PyLong_New(size_w); - if (w == NULL) { - Py_DECREF(v); - *prem = NULL; - return NULL; - } - - /* normalize: shift w1 left so that its top digit is >= PyLong_BASE/2. - shift v1 left by the same amount. Results go into w and v. */ - d = PyLong_SHIFT - bits_in_digit(w1->ob_digit[size_w-1]); - carry = v_lshift(w->ob_digit, w1->ob_digit, size_w, d); - assert(carry == 0); - carry = v_lshift(v->ob_digit, v1->ob_digit, size_v, d); - if (carry != 0 || v->ob_digit[size_v-1] >= w->ob_digit[size_w-1]) { - v->ob_digit[size_v] = carry; - size_v++; - } - - /* Now v->ob_digit[size_v-1] < w->ob_digit[size_w-1], so quotient has - at most (and usually exactly) k = size_v - size_w digits. */ - k = size_v - size_w; - assert(k >= 0); - a = _PyLong_New(k); - if (a == NULL) { - Py_DECREF(w); - Py_DECREF(v); - *prem = NULL; - return NULL; - } - v0 = v->ob_digit; - w0 = w->ob_digit; - wm1 = w0[size_w-1]; - wm2 = w0[size_w-2]; - for (vk = v0+k, ak = a->ob_digit + k; vk-- > v0;) { - /* inner loop: divide vk[0:size_w+1] by w0[0:size_w], giving - single-digit quotient q, remainder in vk[0:size_w]. */ - - SIGCHECK({ - Py_DECREF(a); - Py_DECREF(w); - Py_DECREF(v); - *prem = NULL; - return NULL; - }); - - /* estimate quotient digit q; may overestimate by 1 (rare) */ - vtop = vk[size_w]; - assert(vtop <= wm1); - vv = ((twodigits)vtop << PyLong_SHIFT) | vk[size_w-1]; - q = (digit)(vv / wm1); - r = (digit)(vv - (twodigits)wm1 * q); /* r = vv % wm1 */ - while ((twodigits)wm2 * q > (((twodigits)r << PyLong_SHIFT) - | vk[size_w-2])) { - --q; - r += wm1; - if (r >= PyLong_BASE) - break; - } - assert(q <= PyLong_BASE); - - /* subtract q*w0[0:size_w] from vk[0:size_w+1] */ - zhi = 0; - for (i = 0; i < size_w; ++i) { - /* invariants: -PyLong_BASE <= -q <= zhi <= 0; - -PyLong_BASE * q <= z < PyLong_BASE */ - z = (sdigit)vk[i] + zhi - - (stwodigits)q * (stwodigits)w0[i]; - vk[i] = (digit)z & PyLong_MASK; - zhi = (sdigit)Py_ARITHMETIC_RIGHT_SHIFT(stwodigits, - z, PyLong_SHIFT); - } - - /* add w back if q was too large (this branch taken rarely) */ - assert((sdigit)vtop + zhi == -1 || (sdigit)vtop + zhi == 0); - if ((sdigit)vtop + zhi < 0) { - carry = 0; - for (i = 0; i < size_w; ++i) { - carry += vk[i] + w0[i]; - vk[i] = carry & PyLong_MASK; - carry >>= PyLong_SHIFT; - } - --q; - } - - /* store quotient digit */ - assert(q < PyLong_BASE); - *--ak = q; - } - - /* unshift remainder; we reuse w to store the result */ - carry = v_rshift(w0, v0, size_w, d); - assert(carry==0); - Py_DECREF(v); - - *prem = long_normalize(w); - return long_normalize(a); -} - -/* For a nonzero PyLong a, express a in the form x * 2**e, with 0.5 <= - abs(x) < 1.0 and e >= 0; return x and put e in *e. Here x is - rounded to DBL_MANT_DIG significant bits using round-half-to-even. - If a == 0, return 0.0 and set *e = 0. If the resulting exponent - e is larger than PY_SSIZE_T_MAX, raise OverflowError and return - -1.0. */ - -/* attempt to define 2.0**DBL_MANT_DIG as a compile-time constant */ -#if DBL_MANT_DIG == 53 -#define EXP2_DBL_MANT_DIG 9007199254740992.0 -#else -#define EXP2_DBL_MANT_DIG (ldexp(1.0, DBL_MANT_DIG)) -#endif - -double -_PyLong_Frexp(PyLongObject *a, Py_ssize_t *e) -{ - Py_ssize_t a_size, a_bits, shift_digits, shift_bits, x_size; - /* See below for why x_digits is always large enough. */ - digit rem, x_digits[2 + (DBL_MANT_DIG + 1) / PyLong_SHIFT]; - double dx; - /* Correction term for round-half-to-even rounding. For a digit x, - "x + half_even_correction[x & 7]" gives x rounded to the nearest - multiple of 4, rounding ties to a multiple of 8. */ - static const int half_even_correction[8] = {0, -1, -2, 1, 0, -1, 2, 1}; - - a_size = ABS(Py_SIZE(a)); - if (a_size == 0) { - /* Special case for 0: significand 0.0, exponent 0. */ - *e = 0; - return 0.0; - } - a_bits = bits_in_digit(a->ob_digit[a_size-1]); - /* The following is an overflow-free version of the check - "if ((a_size - 1) * PyLong_SHIFT + a_bits > PY_SSIZE_T_MAX) ..." */ - if (a_size >= (PY_SSIZE_T_MAX - 1) / PyLong_SHIFT + 1 && - (a_size > (PY_SSIZE_T_MAX - 1) / PyLong_SHIFT + 1 || - a_bits > (PY_SSIZE_T_MAX - 1) % PyLong_SHIFT + 1)) - goto overflow; - a_bits = (a_size - 1) * PyLong_SHIFT + a_bits; - - /* Shift the first DBL_MANT_DIG + 2 bits of a into x_digits[0:x_size] - (shifting left if a_bits <= DBL_MANT_DIG + 2). - - Number of digits needed for result: write // for floor division. - Then if shifting left, we end up using - - 1 + a_size + (DBL_MANT_DIG + 2 - a_bits) // PyLong_SHIFT - - digits. If shifting right, we use - - a_size - (a_bits - DBL_MANT_DIG - 2) // PyLong_SHIFT - - digits. Using a_size = 1 + (a_bits - 1) // PyLong_SHIFT along with - the inequalities - - m // PyLong_SHIFT + n // PyLong_SHIFT <= (m + n) // PyLong_SHIFT - m // PyLong_SHIFT - n // PyLong_SHIFT <= - 1 + (m - n - 1) // PyLong_SHIFT, - - valid for any integers m and n, we find that x_size satisfies - - x_size <= 2 + (DBL_MANT_DIG + 1) // PyLong_SHIFT - - in both cases. - */ - if (a_bits <= DBL_MANT_DIG + 2) { - shift_digits = (DBL_MANT_DIG + 2 - a_bits) / PyLong_SHIFT; - shift_bits = (DBL_MANT_DIG + 2 - a_bits) % PyLong_SHIFT; - x_size = 0; - while (x_size < shift_digits) - x_digits[x_size++] = 0; - rem = v_lshift(x_digits + x_size, a->ob_digit, a_size, - (int)shift_bits); - x_size += a_size; - x_digits[x_size++] = rem; - } - else { - shift_digits = (a_bits - DBL_MANT_DIG - 2) / PyLong_SHIFT; - shift_bits = (a_bits - DBL_MANT_DIG - 2) % PyLong_SHIFT; - rem = v_rshift(x_digits, a->ob_digit + shift_digits, - a_size - shift_digits, (int)shift_bits); - x_size = a_size - shift_digits; - /* For correct rounding below, we need the least significant - bit of x to be 'sticky' for this shift: if any of the bits - shifted out was nonzero, we set the least significant bit - of x. */ - if (rem) - x_digits[0] |= 1; - else - while (shift_digits > 0) - if (a->ob_digit[--shift_digits]) { - x_digits[0] |= 1; - break; - } - } - assert(1 <= x_size && - x_size <= (Py_ssize_t)(sizeof(x_digits)/sizeof(digit))); - - /* Round, and convert to double. */ - x_digits[0] += half_even_correction[x_digits[0] & 7]; - dx = x_digits[--x_size]; - while (x_size > 0) - dx = dx * PyLong_BASE + x_digits[--x_size]; - - /* Rescale; make correction if result is 1.0. */ - dx /= 4.0 * EXP2_DBL_MANT_DIG; - if (dx == 1.0) { - if (a_bits == PY_SSIZE_T_MAX) - goto overflow; - dx = 0.5; - a_bits += 1; - } - - *e = a_bits; - return Py_SIZE(a) < 0 ? -dx : dx; - - overflow: - /* exponent > PY_SSIZE_T_MAX */ - PyErr_SetString(PyExc_OverflowError, - "huge integer: number of bits overflows a Py_ssize_t"); - *e = 0; - return -1.0; -} - -/* Get a C double from a long int object. Rounds to the nearest double, - using the round-half-to-even rule in the case of a tie. */ - -double -PyLong_AsDouble(PyObject *v) -{ - Py_ssize_t exponent; - double x; - - if (v == NULL || !PyLong_Check(v)) { - PyErr_BadInternalCall(); - return -1.0; - } - x = _PyLong_Frexp((PyLongObject *)v, &exponent); - if ((x == -1.0 && PyErr_Occurred()) || exponent > DBL_MAX_EXP) { - PyErr_SetString(PyExc_OverflowError, - "long int too large to convert to float"); - return -1.0; - } - return ldexp(x, (int)exponent); -} - -/* Methods */ - -static void -long_dealloc(PyObject *v) -{ - Py_TYPE(v)->tp_free(v); -} - -static PyObject * -long_repr(PyObject *v) -{ - return _PyLong_Format(v, 10, 1, 0); -} - -static PyObject * -long_str(PyObject *v) -{ - return _PyLong_Format(v, 10, 0, 0); -} - -static int -long_compare(PyLongObject *a, PyLongObject *b) -{ - Py_ssize_t sign; - - if (Py_SIZE(a) != Py_SIZE(b)) { - sign = Py_SIZE(a) - Py_SIZE(b); - } - else { - Py_ssize_t i = ABS(Py_SIZE(a)); - while (--i >= 0 && a->ob_digit[i] == b->ob_digit[i]) - ; - if (i < 0) - sign = 0; - else { - sign = (sdigit)a->ob_digit[i] - (sdigit)b->ob_digit[i]; - if (Py_SIZE(a) < 0) - sign = -sign; - } - } - return sign < 0 ? -1 : sign > 0 ? 1 : 0; -} - -static long -long_hash(PyLongObject *v) -{ - unsigned long x; - Py_ssize_t i; - int sign; - - /* This is designed so that Python ints and longs with the - same value hash to the same value, otherwise comparisons - of mapping keys will turn out weird */ - i = v->ob_size; - sign = 1; - x = 0; - if (i < 0) { - sign = -1; - i = -(i); - } - /* The following loop produces a C unsigned long x such that x is - congruent to the absolute value of v modulo ULONG_MAX. The - resulting x is nonzero if and only if v is. */ - while (--i >= 0) { - /* Force a native long #-bits (32 or 64) circular shift */ - x = (x >> (8*SIZEOF_LONG-PyLong_SHIFT)) | (x << PyLong_SHIFT); - x += v->ob_digit[i]; - /* If the addition above overflowed we compensate by - incrementing. This preserves the value modulo - ULONG_MAX. */ - if (x < v->ob_digit[i]) - x++; - } - x = x * sign; - if (x == (unsigned long)-1) - x = (unsigned long)-2; - return (long)x; -} - - -/* Add the absolute values of two long integers. */ - -static PyLongObject * -x_add(PyLongObject *a, PyLongObject *b) -{ - Py_ssize_t size_a = ABS(Py_SIZE(a)), size_b = ABS(Py_SIZE(b)); - PyLongObject *z; - Py_ssize_t i; - digit carry = 0; - - /* Ensure a is the larger of the two: */ - if (size_a < size_b) { - { PyLongObject *temp = a; a = b; b = temp; } - { Py_ssize_t size_temp = size_a; - size_a = size_b; - size_b = size_temp; } - } - z = _PyLong_New(size_a+1); - if (z == NULL) - return NULL; - for (i = 0; i < size_b; ++i) { - carry += a->ob_digit[i] + b->ob_digit[i]; - z->ob_digit[i] = carry & PyLong_MASK; - carry >>= PyLong_SHIFT; - } - for (; i < size_a; ++i) { - carry += a->ob_digit[i]; - z->ob_digit[i] = carry & PyLong_MASK; - carry >>= PyLong_SHIFT; - } - z->ob_digit[i] = carry; - return long_normalize(z); -} - -/* Subtract the absolute values of two integers. */ - -static PyLongObject * -x_sub(PyLongObject *a, PyLongObject *b) -{ - Py_ssize_t size_a = ABS(Py_SIZE(a)), size_b = ABS(Py_SIZE(b)); - PyLongObject *z; - Py_ssize_t i; - int sign = 1; - digit borrow = 0; - - /* Ensure a is the larger of the two: */ - if (size_a < size_b) { - sign = -1; - { PyLongObject *temp = a; a = b; b = temp; } - { Py_ssize_t size_temp = size_a; - size_a = size_b; - size_b = size_temp; } - } - else if (size_a == size_b) { - /* Find highest digit where a and b differ: */ - i = size_a; - while (--i >= 0 && a->ob_digit[i] == b->ob_digit[i]) - ; - if (i < 0) - return _PyLong_New(0); - if (a->ob_digit[i] < b->ob_digit[i]) { - sign = -1; - { PyLongObject *temp = a; a = b; b = temp; } - } - size_a = size_b = i+1; - } - z = _PyLong_New(size_a); - if (z == NULL) - return NULL; - for (i = 0; i < size_b; ++i) { - /* The following assumes unsigned arithmetic - works module 2**N for some N>PyLong_SHIFT. */ - borrow = a->ob_digit[i] - b->ob_digit[i] - borrow; - z->ob_digit[i] = borrow & PyLong_MASK; - borrow >>= PyLong_SHIFT; - borrow &= 1; /* Keep only one sign bit */ - } - for (; i < size_a; ++i) { - borrow = a->ob_digit[i] - borrow; - z->ob_digit[i] = borrow & PyLong_MASK; - borrow >>= PyLong_SHIFT; - borrow &= 1; /* Keep only one sign bit */ - } - assert(borrow == 0); - if (sign < 0) - z->ob_size = -(z->ob_size); - return long_normalize(z); -} - -static PyObject * -long_add(PyLongObject *v, PyLongObject *w) -{ - PyLongObject *a, *b, *z; - - CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); - - if (a->ob_size < 0) { - if (b->ob_size < 0) { - z = x_add(a, b); - if (z != NULL && z->ob_size != 0) - z->ob_size = -(z->ob_size); - } - else - z = x_sub(b, a); - } - else { - if (b->ob_size < 0) - z = x_sub(a, b); - else - z = x_add(a, b); - } - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)z; -} - -static PyObject * -long_sub(PyLongObject *v, PyLongObject *w) -{ - PyLongObject *a, *b, *z; - - CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); - - if (a->ob_size < 0) { - if (b->ob_size < 0) - z = x_sub(a, b); - else - z = x_add(a, b); - if (z != NULL && z->ob_size != 0) - z->ob_size = -(z->ob_size); - } - else { - if (b->ob_size < 0) - z = x_add(a, b); - else - z = x_sub(a, b); - } - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)z; -} - -/* Grade school multiplication, ignoring the signs. - * Returns the absolute value of the product, or NULL if error. - */ -static PyLongObject * -x_mul(PyLongObject *a, PyLongObject *b) -{ - PyLongObject *z; - Py_ssize_t size_a = ABS(Py_SIZE(a)); - Py_ssize_t size_b = ABS(Py_SIZE(b)); - Py_ssize_t i; - - z = _PyLong_New(size_a + size_b); - if (z == NULL) - return NULL; - - memset(z->ob_digit, 0, Py_SIZE(z) * sizeof(digit)); - if (a == b) { - /* Efficient squaring per HAC, Algorithm 14.16: - * http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf - * Gives slightly less than a 2x speedup when a == b, - * via exploiting that each entry in the multiplication - * pyramid appears twice (except for the size_a squares). - */ - for (i = 0; i < size_a; ++i) { - twodigits carry; - twodigits f = a->ob_digit[i]; - digit *pz = z->ob_digit + (i << 1); - digit *pa = a->ob_digit + i + 1; - digit *paend = a->ob_digit + size_a; - - SIGCHECK({ - Py_DECREF(z); - return NULL; - }); - - carry = *pz + f * f; - *pz++ = (digit)(carry & PyLong_MASK); - carry >>= PyLong_SHIFT; - assert(carry <= PyLong_MASK); - - /* Now f is added in twice in each column of the - * pyramid it appears. Same as adding f<<1 once. - */ - f <<= 1; - while (pa < paend) { - carry += *pz + *pa++ * f; - *pz++ = (digit)(carry & PyLong_MASK); - carry >>= PyLong_SHIFT; - assert(carry <= (PyLong_MASK << 1)); - } - if (carry) { - carry += *pz; - *pz++ = (digit)(carry & PyLong_MASK); - carry >>= PyLong_SHIFT; - } - if (carry) - *pz += (digit)(carry & PyLong_MASK); - assert((carry >> PyLong_SHIFT) == 0); - } - } - else { /* a is not the same as b -- gradeschool long mult */ - for (i = 0; i < size_a; ++i) { - twodigits carry = 0; - twodigits f = a->ob_digit[i]; - digit *pz = z->ob_digit + i; - digit *pb = b->ob_digit; - digit *pbend = b->ob_digit + size_b; - - SIGCHECK({ - Py_DECREF(z); - return NULL; - }); - - while (pb < pbend) { - carry += *pz + *pb++ * f; - *pz++ = (digit)(carry & PyLong_MASK); - carry >>= PyLong_SHIFT; - assert(carry <= PyLong_MASK); - } - if (carry) - *pz += (digit)(carry & PyLong_MASK); - assert((carry >> PyLong_SHIFT) == 0); - } - } - return long_normalize(z); -} - -/* A helper for Karatsuba multiplication (k_mul). - Takes a long "n" and an integer "size" representing the place to - split, and sets low and high such that abs(n) == (high << size) + low, - viewing the shift as being by digits. The sign bit is ignored, and - the return values are >= 0. - Returns 0 on success, -1 on failure. -*/ -static int -kmul_split(PyLongObject *n, - Py_ssize_t size, - PyLongObject **high, - PyLongObject **low) -{ - PyLongObject *hi, *lo; - Py_ssize_t size_lo, size_hi; - const Py_ssize_t size_n = ABS(Py_SIZE(n)); - - size_lo = MIN(size_n, size); - size_hi = size_n - size_lo; - - if ((hi = _PyLong_New(size_hi)) == NULL) - return -1; - if ((lo = _PyLong_New(size_lo)) == NULL) { - Py_DECREF(hi); - return -1; - } - - memcpy(lo->ob_digit, n->ob_digit, size_lo * sizeof(digit)); - memcpy(hi->ob_digit, n->ob_digit + size_lo, size_hi * sizeof(digit)); - - *high = long_normalize(hi); - *low = long_normalize(lo); - return 0; -} - -static PyLongObject *k_lopsided_mul(PyLongObject *a, PyLongObject *b); - -/* Karatsuba multiplication. Ignores the input signs, and returns the - * absolute value of the product (or NULL if error). - * See Knuth Vol. 2 Chapter 4.3.3 (Pp. 294-295). - */ -static PyLongObject * -k_mul(PyLongObject *a, PyLongObject *b) -{ - Py_ssize_t asize = ABS(Py_SIZE(a)); - Py_ssize_t bsize = ABS(Py_SIZE(b)); - PyLongObject *ah = NULL; - PyLongObject *al = NULL; - PyLongObject *bh = NULL; - PyLongObject *bl = NULL; - PyLongObject *ret = NULL; - PyLongObject *t1, *t2, *t3; - Py_ssize_t shift; /* the number of digits we split off */ - Py_ssize_t i; - - /* (ah*X+al)(bh*X+bl) = ah*bh*X*X + (ah*bl + al*bh)*X + al*bl - * Let k = (ah+al)*(bh+bl) = ah*bl + al*bh + ah*bh + al*bl - * Then the original product is - * ah*bh*X*X + (k - ah*bh - al*bl)*X + al*bl - * By picking X to be a power of 2, "*X" is just shifting, and it's - * been reduced to 3 multiplies on numbers half the size. - */ - - /* We want to split based on the larger number; fiddle so that b - * is largest. - */ - if (asize > bsize) { - t1 = a; - a = b; - b = t1; - - i = asize; - asize = bsize; - bsize = i; - } - - /* Use gradeschool math when either number is too small. */ - i = a == b ? KARATSUBA_SQUARE_CUTOFF : KARATSUBA_CUTOFF; - if (asize <= i) { - if (asize == 0) - return _PyLong_New(0); - else - return x_mul(a, b); - } - - /* If a is small compared to b, splitting on b gives a degenerate - * case with ah==0, and Karatsuba may be (even much) less efficient - * than "grade school" then. However, we can still win, by viewing - * b as a string of "big digits", each of width a->ob_size. That - * leads to a sequence of balanced calls to k_mul. - */ - if (2 * asize <= bsize) - return k_lopsided_mul(a, b); - - /* Split a & b into hi & lo pieces. */ - shift = bsize >> 1; - if (kmul_split(a, shift, &ah, &al) < 0) goto fail; - assert(Py_SIZE(ah) > 0); /* the split isn't degenerate */ - - if (a == b) { - bh = ah; - bl = al; - Py_INCREF(bh); - Py_INCREF(bl); - } - else if (kmul_split(b, shift, &bh, &bl) < 0) goto fail; - - /* The plan: - * 1. Allocate result space (asize + bsize digits: that's always - * enough). - * 2. Compute ah*bh, and copy into result at 2*shift. - * 3. Compute al*bl, and copy into result at 0. Note that this - * can't overlap with #2. - * 4. Subtract al*bl from the result, starting at shift. This may - * underflow (borrow out of the high digit), but we don't care: - * we're effectively doing unsigned arithmetic mod - * PyLong_BASE**(sizea + sizeb), and so long as the *final* result fits, - * borrows and carries out of the high digit can be ignored. - * 5. Subtract ah*bh from the result, starting at shift. - * 6. Compute (ah+al)*(bh+bl), and add it into the result starting - * at shift. - */ - - /* 1. Allocate result space. */ - ret = _PyLong_New(asize + bsize); - if (ret == NULL) goto fail; -#ifdef Py_DEBUG - /* Fill with trash, to catch reference to uninitialized digits. */ - memset(ret->ob_digit, 0xDF, Py_SIZE(ret) * sizeof(digit)); -#endif - - /* 2. t1 <- ah*bh, and copy into high digits of result. */ - if ((t1 = k_mul(ah, bh)) == NULL) goto fail; - assert(Py_SIZE(t1) >= 0); - assert(2*shift + Py_SIZE(t1) <= Py_SIZE(ret)); - memcpy(ret->ob_digit + 2*shift, t1->ob_digit, - Py_SIZE(t1) * sizeof(digit)); - - /* Zero-out the digits higher than the ah*bh copy. */ - i = Py_SIZE(ret) - 2*shift - Py_SIZE(t1); - if (i) - memset(ret->ob_digit + 2*shift + Py_SIZE(t1), 0, - i * sizeof(digit)); - - /* 3. t2 <- al*bl, and copy into the low digits. */ - if ((t2 = k_mul(al, bl)) == NULL) { - Py_DECREF(t1); - goto fail; - } - assert(Py_SIZE(t2) >= 0); - assert(Py_SIZE(t2) <= 2*shift); /* no overlap with high digits */ - memcpy(ret->ob_digit, t2->ob_digit, Py_SIZE(t2) * sizeof(digit)); - - /* Zero out remaining digits. */ - i = 2*shift - Py_SIZE(t2); /* number of uninitialized digits */ - if (i) - memset(ret->ob_digit + Py_SIZE(t2), 0, i * sizeof(digit)); - - /* 4 & 5. Subtract ah*bh (t1) and al*bl (t2). We do al*bl first - * because it's fresher in cache. - */ - i = Py_SIZE(ret) - shift; /* # digits after shift */ - (void)v_isub(ret->ob_digit + shift, i, t2->ob_digit, Py_SIZE(t2)); - Py_DECREF(t2); - - (void)v_isub(ret->ob_digit + shift, i, t1->ob_digit, Py_SIZE(t1)); - Py_DECREF(t1); - - /* 6. t3 <- (ah+al)(bh+bl), and add into result. */ - if ((t1 = x_add(ah, al)) == NULL) goto fail; - Py_DECREF(ah); - Py_DECREF(al); - ah = al = NULL; - - if (a == b) { - t2 = t1; - Py_INCREF(t2); - } - else if ((t2 = x_add(bh, bl)) == NULL) { - Py_DECREF(t1); - goto fail; - } - Py_DECREF(bh); - Py_DECREF(bl); - bh = bl = NULL; - - t3 = k_mul(t1, t2); - Py_DECREF(t1); - Py_DECREF(t2); - if (t3 == NULL) goto fail; - assert(Py_SIZE(t3) >= 0); - - /* Add t3. It's not obvious why we can't run out of room here. - * See the (*) comment after this function. - */ - (void)v_iadd(ret->ob_digit + shift, i, t3->ob_digit, Py_SIZE(t3)); - Py_DECREF(t3); - - return long_normalize(ret); - - fail: - Py_XDECREF(ret); - Py_XDECREF(ah); - Py_XDECREF(al); - Py_XDECREF(bh); - Py_XDECREF(bl); - return NULL; -} - -/* (*) Why adding t3 can't "run out of room" above. - -Let f(x) mean the floor of x and c(x) mean the ceiling of x. Some facts -to start with: - -1. For any integer i, i = c(i/2) + f(i/2). In particular, - bsize = c(bsize/2) + f(bsize/2). -2. shift = f(bsize/2) -3. asize <= bsize -4. Since we call k_lopsided_mul if asize*2 <= bsize, asize*2 > bsize in this - routine, so asize > bsize/2 >= f(bsize/2) in this routine. - -We allocated asize + bsize result digits, and add t3 into them at an offset -of shift. This leaves asize+bsize-shift allocated digit positions for t3 -to fit into, = (by #1 and #2) asize + f(bsize/2) + c(bsize/2) - f(bsize/2) = -asize + c(bsize/2) available digit positions. - -bh has c(bsize/2) digits, and bl at most f(size/2) digits. So bh+hl has -at most c(bsize/2) digits + 1 bit. - -If asize == bsize, ah has c(bsize/2) digits, else ah has at most f(bsize/2) -digits, and al has at most f(bsize/2) digits in any case. So ah+al has at -most (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 1 bit. - -The product (ah+al)*(bh+bl) therefore has at most - - c(bsize/2) + (asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits - -and we have asize + c(bsize/2) available digit positions. We need to show -this is always enough. An instance of c(bsize/2) cancels out in both, so -the question reduces to whether asize digits is enough to hold -(asize == bsize ? c(bsize/2) : f(bsize/2)) digits + 2 bits. If asize < bsize, -then we're asking whether asize digits >= f(bsize/2) digits + 2 bits. By #4, -asize is at least f(bsize/2)+1 digits, so this in turn reduces to whether 1 -digit is enough to hold 2 bits. This is so since PyLong_SHIFT=15 >= 2. If -asize == bsize, then we're asking whether bsize digits is enough to hold -c(bsize/2) digits + 2 bits, or equivalently (by #1) whether f(bsize/2) digits -is enough to hold 2 bits. This is so if bsize >= 2, which holds because -bsize >= KARATSUBA_CUTOFF >= 2. - -Note that since there's always enough room for (ah+al)*(bh+bl), and that's -clearly >= each of ah*bh and al*bl, there's always enough room to subtract -ah*bh and al*bl too. -*/ - -/* b has at least twice the digits of a, and a is big enough that Karatsuba - * would pay off *if* the inputs had balanced sizes. View b as a sequence - * of slices, each with a->ob_size digits, and multiply the slices by a, - * one at a time. This gives k_mul balanced inputs to work with, and is - * also cache-friendly (we compute one double-width slice of the result - * at a time, then move on, never backtracking except for the helpful - * single-width slice overlap between successive partial sums). - */ -static PyLongObject * -k_lopsided_mul(PyLongObject *a, PyLongObject *b) -{ - const Py_ssize_t asize = ABS(Py_SIZE(a)); - Py_ssize_t bsize = ABS(Py_SIZE(b)); - Py_ssize_t nbdone; /* # of b digits already multiplied */ - PyLongObject *ret; - PyLongObject *bslice = NULL; - - assert(asize > KARATSUBA_CUTOFF); - assert(2 * asize <= bsize); - - /* Allocate result space, and zero it out. */ - ret = _PyLong_New(asize + bsize); - if (ret == NULL) - return NULL; - memset(ret->ob_digit, 0, Py_SIZE(ret) * sizeof(digit)); - - /* Successive slices of b are copied into bslice. */ - bslice = _PyLong_New(asize); - if (bslice == NULL) - goto fail; - - nbdone = 0; - while (bsize > 0) { - PyLongObject *product; - const Py_ssize_t nbtouse = MIN(bsize, asize); - - /* Multiply the next slice of b by a. */ - memcpy(bslice->ob_digit, b->ob_digit + nbdone, - nbtouse * sizeof(digit)); - Py_SIZE(bslice) = nbtouse; - product = k_mul(a, bslice); - if (product == NULL) - goto fail; - - /* Add into result. */ - (void)v_iadd(ret->ob_digit + nbdone, Py_SIZE(ret) - nbdone, - product->ob_digit, Py_SIZE(product)); - Py_DECREF(product); - - bsize -= nbtouse; - nbdone += nbtouse; - } - - Py_DECREF(bslice); - return long_normalize(ret); - - fail: - Py_DECREF(ret); - Py_XDECREF(bslice); - return NULL; -} - -static PyObject * -long_mul(PyLongObject *v, PyLongObject *w) -{ - PyLongObject *a, *b, *z; - - if (!convert_binop((PyObject *)v, (PyObject *)w, &a, &b)) { - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - z = k_mul(a, b); - /* Negate if exactly one of the inputs is negative. */ - if (((a->ob_size ^ b->ob_size) < 0) && z) - z->ob_size = -(z->ob_size); - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)z; -} - -/* The / and % operators are now defined in terms of divmod(). - The expression a mod b has the value a - b*floor(a/b). - The long_divrem function gives the remainder after division of - |a| by |b|, with the sign of a. This is also expressed - as a - b*trunc(a/b), if trunc truncates towards zero. - Some examples: - a b a rem b a mod b - 13 10 3 3 - -13 10 -3 7 - 13 -10 3 -7 - -13 -10 -3 -3 - So, to get from rem to mod, we have to add b if a and b - have different signs. We then subtract one from the 'div' - part of the outcome to keep the invariant intact. */ - -/* Compute - * *pdiv, *pmod = divmod(v, w) - * NULL can be passed for pdiv or pmod, in which case that part of - * the result is simply thrown away. The caller owns a reference to - * each of these it requests (does not pass NULL for). - */ -static int -l_divmod(PyLongObject *v, PyLongObject *w, - PyLongObject **pdiv, PyLongObject **pmod) -{ - PyLongObject *div, *mod; - - if (long_divrem(v, w, &div, &mod) < 0) - return -1; - if ((Py_SIZE(mod) < 0 && Py_SIZE(w) > 0) || - (Py_SIZE(mod) > 0 && Py_SIZE(w) < 0)) { - PyLongObject *temp; - PyLongObject *one; - temp = (PyLongObject *) long_add(mod, w); - Py_DECREF(mod); - mod = temp; - if (mod == NULL) { - Py_DECREF(div); - return -1; - } - one = (PyLongObject *) PyLong_FromLong(1L); - if (one == NULL || - (temp = (PyLongObject *) long_sub(div, one)) == NULL) { - Py_DECREF(mod); - Py_DECREF(div); - Py_XDECREF(one); - return -1; - } - Py_DECREF(one); - Py_DECREF(div); - div = temp; - } - if (pdiv != NULL) - *pdiv = div; - else - Py_DECREF(div); - - if (pmod != NULL) - *pmod = mod; - else - Py_DECREF(mod); - - return 0; -} - -static PyObject * -long_div(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b, *div; - - CONVERT_BINOP(v, w, &a, &b); - if (l_divmod(a, b, &div, NULL) < 0) - div = NULL; - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)div; -} - -static PyObject * -long_classic_div(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b, *div; - - CONVERT_BINOP(v, w, &a, &b); - if (Py_DivisionWarningFlag && - PyErr_Warn(PyExc_DeprecationWarning, "classic long division") < 0) - div = NULL; - else if (l_divmod(a, b, &div, NULL) < 0) - div = NULL; - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)div; -} - -/* PyLong/PyLong -> float, with correctly rounded result. */ - -#define MANT_DIG_DIGITS (DBL_MANT_DIG / PyLong_SHIFT) -#define MANT_DIG_BITS (DBL_MANT_DIG % PyLong_SHIFT) - -static PyObject * -long_true_divide(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b, *x; - Py_ssize_t a_size, b_size, shift, extra_bits, diff, x_size, x_bits; - digit mask, low; - int inexact, negate, a_is_small, b_is_small; - double dx, result; - - CONVERT_BINOP(v, w, &a, &b); - - /* - Method in a nutshell: - - 0. reduce to case a, b > 0; filter out obvious underflow/overflow - 1. choose a suitable integer 'shift' - 2. use integer arithmetic to compute x = floor(2**-shift*a/b) - 3. adjust x for correct rounding - 4. convert x to a double dx with the same value - 5. return ldexp(dx, shift). - - In more detail: - - 0. For any a, a/0 raises ZeroDivisionError; for nonzero b, 0/b - returns either 0.0 or -0.0, depending on the sign of b. For a and - b both nonzero, ignore signs of a and b, and add the sign back in - at the end. Now write a_bits and b_bits for the bit lengths of a - and b respectively (that is, a_bits = 1 + floor(log_2(a)); likewise - for b). Then - - 2**(a_bits - b_bits - 1) < a/b < 2**(a_bits - b_bits + 1). - - So if a_bits - b_bits > DBL_MAX_EXP then a/b > 2**DBL_MAX_EXP and - so overflows. Similarly, if a_bits - b_bits < DBL_MIN_EXP - - DBL_MANT_DIG - 1 then a/b underflows to 0. With these cases out of - the way, we can assume that - - DBL_MIN_EXP - DBL_MANT_DIG - 1 <= a_bits - b_bits <= DBL_MAX_EXP. - - 1. The integer 'shift' is chosen so that x has the right number of - bits for a double, plus two or three extra bits that will be used - in the rounding decisions. Writing a_bits and b_bits for the - number of significant bits in a and b respectively, a - straightforward formula for shift is: - - shift = a_bits - b_bits - DBL_MANT_DIG - 2 - - This is fine in the usual case, but if a/b is smaller than the - smallest normal float then it can lead to double rounding on an - IEEE 754 platform, giving incorrectly rounded results. So we - adjust the formula slightly. The actual formula used is: - - shift = MAX(a_bits - b_bits, DBL_MIN_EXP) - DBL_MANT_DIG - 2 - - 2. The quantity x is computed by first shifting a (left -shift bits - if shift <= 0, right shift bits if shift > 0) and then dividing by - b. For both the shift and the division, we keep track of whether - the result is inexact, in a flag 'inexact'; this information is - needed at the rounding stage. - - With the choice of shift above, together with our assumption that - a_bits - b_bits >= DBL_MIN_EXP - DBL_MANT_DIG - 1, it follows - that x >= 1. - - 3. Now x * 2**shift <= a/b < (x+1) * 2**shift. We want to replace - this with an exactly representable float of the form - - round(x/2**extra_bits) * 2**(extra_bits+shift). - - For float representability, we need x/2**extra_bits < - 2**DBL_MANT_DIG and extra_bits + shift >= DBL_MIN_EXP - - DBL_MANT_DIG. This translates to the condition: - - extra_bits >= MAX(x_bits, DBL_MIN_EXP - shift) - DBL_MANT_DIG - - To round, we just modify the bottom digit of x in-place; this can - end up giving a digit with value > PyLONG_MASK, but that's not a - problem since digits can hold values up to 2*PyLONG_MASK+1. - - With the original choices for shift above, extra_bits will always - be 2 or 3. Then rounding under the round-half-to-even rule, we - round up iff the most significant of the extra bits is 1, and - either: (a) the computation of x in step 2 had an inexact result, - or (b) at least one other of the extra bits is 1, or (c) the least - significant bit of x (above those to be rounded) is 1. - - 4. Conversion to a double is straightforward; all floating-point - operations involved in the conversion are exact, so there's no - danger of rounding errors. - - 5. Use ldexp(x, shift) to compute x*2**shift, the final result. - The result will always be exactly representable as a double, except - in the case that it overflows. To avoid dependence on the exact - behaviour of ldexp on overflow, we check for overflow before - applying ldexp. The result of ldexp is adjusted for sign before - returning. - */ - - /* Reduce to case where a and b are both positive. */ - a_size = ABS(Py_SIZE(a)); - b_size = ABS(Py_SIZE(b)); - negate = (Py_SIZE(a) < 0) ^ (Py_SIZE(b) < 0); - if (b_size == 0) { - PyErr_SetString(PyExc_ZeroDivisionError, - "division by zero"); - goto error; - } - if (a_size == 0) - goto underflow_or_zero; - - /* Fast path for a and b small (exactly representable in a double). - Relies on floating-point division being correctly rounded; results - may be subject to double rounding on x86 machines that operate with - the x87 FPU set to 64-bit precision. */ - a_is_small = a_size <= MANT_DIG_DIGITS || - (a_size == MANT_DIG_DIGITS+1 && - a->ob_digit[MANT_DIG_DIGITS] >> MANT_DIG_BITS == 0); - b_is_small = b_size <= MANT_DIG_DIGITS || - (b_size == MANT_DIG_DIGITS+1 && - b->ob_digit[MANT_DIG_DIGITS] >> MANT_DIG_BITS == 0); - if (a_is_small && b_is_small) { - double da, db; - da = a->ob_digit[--a_size]; - while (a_size > 0) - da = da * PyLong_BASE + a->ob_digit[--a_size]; - db = b->ob_digit[--b_size]; - while (b_size > 0) - db = db * PyLong_BASE + b->ob_digit[--b_size]; - result = da / db; - goto success; - } - - /* Catch obvious cases of underflow and overflow */ - diff = a_size - b_size; - if (diff > PY_SSIZE_T_MAX/PyLong_SHIFT - 1) - /* Extreme overflow */ - goto overflow; - else if (diff < 1 - PY_SSIZE_T_MAX/PyLong_SHIFT) - /* Extreme underflow */ - goto underflow_or_zero; - /* Next line is now safe from overflowing a Py_ssize_t */ - diff = diff * PyLong_SHIFT + bits_in_digit(a->ob_digit[a_size - 1]) - - bits_in_digit(b->ob_digit[b_size - 1]); - /* Now diff = a_bits - b_bits. */ - if (diff > DBL_MAX_EXP) - goto overflow; - else if (diff < DBL_MIN_EXP - DBL_MANT_DIG - 1) - goto underflow_or_zero; - - /* Choose value for shift; see comments for step 1 above. */ - shift = MAX(diff, DBL_MIN_EXP) - DBL_MANT_DIG - 2; - - inexact = 0; - - /* x = abs(a * 2**-shift) */ - if (shift <= 0) { - Py_ssize_t i, shift_digits = -shift / PyLong_SHIFT; - digit rem; - /* x = a << -shift */ - if (a_size >= PY_SSIZE_T_MAX - 1 - shift_digits) { - /* In practice, it's probably impossible to end up - here. Both a and b would have to be enormous, - using close to SIZE_T_MAX bytes of memory each. */ - PyErr_SetString(PyExc_OverflowError, - "intermediate overflow during division"); - goto error; - } - x = _PyLong_New(a_size + shift_digits + 1); - if (x == NULL) - goto error; - for (i = 0; i < shift_digits; i++) - x->ob_digit[i] = 0; - rem = v_lshift(x->ob_digit + shift_digits, a->ob_digit, - a_size, -shift % PyLong_SHIFT); - x->ob_digit[a_size + shift_digits] = rem; - } - else { - Py_ssize_t shift_digits = shift / PyLong_SHIFT; - digit rem; - /* x = a >> shift */ - assert(a_size >= shift_digits); - x = _PyLong_New(a_size - shift_digits); - if (x == NULL) - goto error; - rem = v_rshift(x->ob_digit, a->ob_digit + shift_digits, - a_size - shift_digits, shift % PyLong_SHIFT); - /* set inexact if any of the bits shifted out is nonzero */ - if (rem) - inexact = 1; - while (!inexact && shift_digits > 0) - if (a->ob_digit[--shift_digits]) - inexact = 1; - } - long_normalize(x); - x_size = Py_SIZE(x); - - /* x //= b. If the remainder is nonzero, set inexact. We own the only - reference to x, so it's safe to modify it in-place. */ - if (b_size == 1) { - digit rem = inplace_divrem1(x->ob_digit, x->ob_digit, x_size, - b->ob_digit[0]); - long_normalize(x); - if (rem) - inexact = 1; - } - else { - PyLongObject *div, *rem; - div = x_divrem(x, b, &rem); - Py_DECREF(x); - x = div; - if (x == NULL) - goto error; - if (Py_SIZE(rem)) - inexact = 1; - Py_DECREF(rem); - } - x_size = ABS(Py_SIZE(x)); - assert(x_size > 0); /* result of division is never zero */ - x_bits = (x_size-1)*PyLong_SHIFT+bits_in_digit(x->ob_digit[x_size-1]); - - /* The number of extra bits that have to be rounded away. */ - extra_bits = MAX(x_bits, DBL_MIN_EXP - shift) - DBL_MANT_DIG; - assert(extra_bits == 2 || extra_bits == 3); - - /* Round by directly modifying the low digit of x. */ - mask = (digit)1 << (extra_bits - 1); - low = x->ob_digit[0] | inexact; - if (low & mask && low & (3*mask-1)) - low += mask; - x->ob_digit[0] = low & ~(mask-1U); - - /* Convert x to a double dx; the conversion is exact. */ - dx = x->ob_digit[--x_size]; - while (x_size > 0) - dx = dx * PyLong_BASE + x->ob_digit[--x_size]; - Py_DECREF(x); - - /* Check whether ldexp result will overflow a double. */ - if (shift + x_bits >= DBL_MAX_EXP && - (shift + x_bits > DBL_MAX_EXP || dx == ldexp(1.0, (int)x_bits))) - goto overflow; - result = ldexp(dx, (int)shift); - - success: - Py_DECREF(a); - Py_DECREF(b); - return PyFloat_FromDouble(negate ? -result : result); - - underflow_or_zero: - Py_DECREF(a); - Py_DECREF(b); - return PyFloat_FromDouble(negate ? -0.0 : 0.0); - - overflow: - PyErr_SetString(PyExc_OverflowError, - "integer division result too large for a float"); - error: - Py_DECREF(a); - Py_DECREF(b); - return NULL; -} - -static PyObject * -long_mod(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b, *mod; - - CONVERT_BINOP(v, w, &a, &b); - - if (l_divmod(a, b, NULL, &mod) < 0) - mod = NULL; - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)mod; -} - -static PyObject * -long_divmod(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b, *div, *mod; - PyObject *z; - - CONVERT_BINOP(v, w, &a, &b); - - if (l_divmod(a, b, &div, &mod) < 0) { - Py_DECREF(a); - Py_DECREF(b); - return NULL; - } - z = PyTuple_New(2); - if (z != NULL) { - PyTuple_SetItem(z, 0, (PyObject *) div); - PyTuple_SetItem(z, 1, (PyObject *) mod); - } - else { - Py_DECREF(div); - Py_DECREF(mod); - } - Py_DECREF(a); - Py_DECREF(b); - return z; -} - -/* pow(v, w, x) */ -static PyObject * -long_pow(PyObject *v, PyObject *w, PyObject *x) -{ - PyLongObject *a, *b, *c; /* a,b,c = v,w,x */ - int negativeOutput = 0; /* if x<0 return negative output */ - - PyLongObject *z = NULL; /* accumulated result */ - Py_ssize_t i, j, k; /* counters */ - PyLongObject *temp = NULL; - - /* 5-ary values. If the exponent is large enough, table is - * precomputed so that table[i] == a**i % c for i in range(32). - */ - PyLongObject *table[32] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - - /* a, b, c = v, w, x */ - CONVERT_BINOP(v, w, &a, &b); - if (PyLong_Check(x)) { - c = (PyLongObject *)x; - Py_INCREF(x); - } - else if (PyInt_Check(x)) { - c = (PyLongObject *)PyLong_FromLong(PyInt_AS_LONG(x)); - if (c == NULL) - goto Error; - } - else if (x == Py_None) - c = NULL; - else { - Py_DECREF(a); - Py_DECREF(b); - Py_INCREF(Py_NotImplemented); - return Py_NotImplemented; - } - - if (Py_SIZE(b) < 0) { /* if exponent is negative */ - if (c) { - PyErr_SetString(PyExc_TypeError, "pow() 2nd argument " - "cannot be negative when 3rd argument specified"); - goto Error; - } - else { - /* else return a float. This works because we know - that this calls float_pow() which converts its - arguments to double. */ - Py_DECREF(a); - Py_DECREF(b); - return PyFloat_Type.tp_as_number->nb_power(v, w, x); - } - } - - if (c) { - /* if modulus == 0: - raise ValueError() */ - if (Py_SIZE(c) == 0) { - PyErr_SetString(PyExc_ValueError, - "pow() 3rd argument cannot be 0"); - goto Error; - } - - /* if modulus < 0: - negativeOutput = True - modulus = -modulus */ - if (Py_SIZE(c) < 0) { - negativeOutput = 1; - temp = (PyLongObject *)_PyLong_Copy(c); - if (temp == NULL) - goto Error; - Py_DECREF(c); - c = temp; - temp = NULL; - c->ob_size = - c->ob_size; - } - - /* if modulus == 1: - return 0 */ - if ((Py_SIZE(c) == 1) && (c->ob_digit[0] == 1)) { - z = (PyLongObject *)PyLong_FromLong(0L); - goto Done; - } - - /* Reduce base by modulus in some cases: - 1. If base < 0. Forcing the base non-negative makes things easier. - 2. If base is obviously larger than the modulus. The "small - exponent" case later can multiply directly by base repeatedly, - while the "large exponent" case multiplies directly by base 31 - times. It can be unboundedly faster to multiply by - base % modulus instead. - We could _always_ do this reduction, but l_divmod() isn't cheap, - so we only do it when it buys something. */ - if (Py_SIZE(a) < 0 || Py_SIZE(a) > Py_SIZE(c)) { - if (l_divmod(a, c, NULL, &temp) < 0) - goto Error; - Py_DECREF(a); - a = temp; - temp = NULL; - } - } - - /* At this point a, b, and c are guaranteed non-negative UNLESS - c is NULL, in which case a may be negative. */ - - z = (PyLongObject *)PyLong_FromLong(1L); - if (z == NULL) - goto Error; - - /* Perform a modular reduction, X = X % c, but leave X alone if c - * is NULL. - */ -#define REDUCE(X) \ - do { \ - if (c != NULL) { \ - if (l_divmod(X, c, NULL, &temp) < 0) \ - goto Error; \ - Py_XDECREF(X); \ - X = temp; \ - temp = NULL; \ - } \ - } while(0) - - /* Multiply two values, then reduce the result: - result = X*Y % c. If c is NULL, skip the mod. */ -#define MULT(X, Y, result) \ - do { \ - temp = (PyLongObject *)long_mul(X, Y); \ - if (temp == NULL) \ - goto Error; \ - Py_XDECREF(result); \ - result = temp; \ - temp = NULL; \ - REDUCE(result); \ - } while(0) - - if (Py_SIZE(b) <= FIVEARY_CUTOFF) { - /* Left-to-right binary exponentiation (HAC Algorithm 14.79) */ - /* http://www.cacr.math.uwaterloo.ca/hac/about/chap14.pdf */ - for (i = Py_SIZE(b) - 1; i >= 0; --i) { - digit bi = b->ob_digit[i]; - - for (j = (digit)1 << (PyLong_SHIFT-1); j != 0; j >>= 1) { - MULT(z, z, z); - if (bi & j) - MULT(z, a, z); - } - } - } - else { - /* Left-to-right 5-ary exponentiation (HAC Algorithm 14.82) */ - Py_INCREF(z); /* still holds 1L */ - table[0] = z; - for (i = 1; i < 32; ++i) - MULT(table[i-1], a, table[i]); - - for (i = Py_SIZE(b) - 1; i >= 0; --i) { - const digit bi = b->ob_digit[i]; - - for (j = PyLong_SHIFT - 5; j >= 0; j -= 5) { - const int index = (bi >> j) & 0x1f; - for (k = 0; k < 5; ++k) - MULT(z, z, z); - if (index) - MULT(z, table[index], z); - } - } - } - - if (negativeOutput && (Py_SIZE(z) != 0)) { - temp = (PyLongObject *)long_sub(z, c); - if (temp == NULL) - goto Error; - Py_DECREF(z); - z = temp; - temp = NULL; - } - goto Done; - - Error: - if (z != NULL) { - Py_DECREF(z); - z = NULL; - } - /* fall through */ - Done: - if (Py_SIZE(b) > FIVEARY_CUTOFF) { - for (i = 0; i < 32; ++i) - Py_XDECREF(table[i]); - } - Py_DECREF(a); - Py_DECREF(b); - Py_XDECREF(c); - Py_XDECREF(temp); - return (PyObject *)z; -} - -static PyObject * -long_invert(PyLongObject *v) -{ - /* Implement ~x as -(x+1) */ - PyLongObject *x; - PyLongObject *w; - w = (PyLongObject *)PyLong_FromLong(1L); - if (w == NULL) - return NULL; - x = (PyLongObject *) long_add(v, w); - Py_DECREF(w); - if (x == NULL) - return NULL; - Py_SIZE(x) = -(Py_SIZE(x)); - return (PyObject *)x; -} - -static PyObject * -long_neg(PyLongObject *v) -{ - PyLongObject *z; - if (v->ob_size == 0 && PyLong_CheckExact(v)) { - /* -0 == 0 */ - Py_INCREF(v); - return (PyObject *) v; - } - z = (PyLongObject *)_PyLong_Copy(v); - if (z != NULL) - z->ob_size = -(v->ob_size); - return (PyObject *)z; -} - -static PyObject * -long_abs(PyLongObject *v) -{ - if (v->ob_size < 0) - return long_neg(v); - else - return long_long((PyObject *)v); -} - -static int -long_nonzero(PyLongObject *v) -{ - return Py_SIZE(v) != 0; -} - -static PyObject * -long_rshift(PyLongObject *v, PyLongObject *w) -{ - PyLongObject *a, *b; - PyLongObject *z = NULL; - Py_ssize_t shiftby, newsize, wordshift, loshift, hishift, i, j; - digit lomask, himask; - - CONVERT_BINOP((PyObject *)v, (PyObject *)w, &a, &b); - - if (Py_SIZE(a) < 0) { - /* Right shifting negative numbers is harder */ - PyLongObject *a1, *a2; - a1 = (PyLongObject *) long_invert(a); - if (a1 == NULL) - goto rshift_error; - a2 = (PyLongObject *) long_rshift(a1, b); - Py_DECREF(a1); - if (a2 == NULL) - goto rshift_error; - z = (PyLongObject *) long_invert(a2); - Py_DECREF(a2); - } - else { - shiftby = PyLong_AsSsize_t((PyObject *)b); - if (shiftby == -1L && PyErr_Occurred()) - goto rshift_error; - if (shiftby < 0) { - PyErr_SetString(PyExc_ValueError, - "negative shift count"); - goto rshift_error; - } - wordshift = shiftby / PyLong_SHIFT; - newsize = ABS(Py_SIZE(a)) - wordshift; - if (newsize <= 0) { - z = _PyLong_New(0); - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)z; - } - loshift = shiftby % PyLong_SHIFT; - hishift = PyLong_SHIFT - loshift; - lomask = ((digit)1 << hishift) - 1; - himask = PyLong_MASK ^ lomask; - z = _PyLong_New(newsize); - if (z == NULL) - goto rshift_error; - if (Py_SIZE(a) < 0) - Py_SIZE(z) = -(Py_SIZE(z)); - for (i = 0, j = wordshift; i < newsize; i++, j++) { - z->ob_digit[i] = (a->ob_digit[j] >> loshift) & lomask; - if (i+1 < newsize) - z->ob_digit[i] |= (a->ob_digit[j+1] << hishift) & himask; - } - z = long_normalize(z); - } - rshift_error: - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *) z; - -} - -static PyObject * -long_lshift(PyObject *v, PyObject *w) -{ - /* This version due to Tim Peters */ - PyLongObject *a, *b; - PyLongObject *z = NULL; - Py_ssize_t shiftby, oldsize, newsize, wordshift, remshift, i, j; - twodigits accum; - - CONVERT_BINOP(v, w, &a, &b); - - shiftby = PyLong_AsSsize_t((PyObject *)b); - if (shiftby == -1L && PyErr_Occurred()) - goto lshift_error; - if (shiftby < 0) { - PyErr_SetString(PyExc_ValueError, "negative shift count"); - goto lshift_error; - } - /* wordshift, remshift = divmod(shiftby, PyLong_SHIFT) */ - wordshift = shiftby / PyLong_SHIFT; - remshift = shiftby - wordshift * PyLong_SHIFT; - - oldsize = ABS(a->ob_size); - newsize = oldsize + wordshift; - if (remshift) - ++newsize; - z = _PyLong_New(newsize); - if (z == NULL) - goto lshift_error; - if (a->ob_size < 0) - z->ob_size = -(z->ob_size); - for (i = 0; i < wordshift; i++) - z->ob_digit[i] = 0; - accum = 0; - for (i = wordshift, j = 0; j < oldsize; i++, j++) { - accum |= (twodigits)a->ob_digit[j] << remshift; - z->ob_digit[i] = (digit)(accum & PyLong_MASK); - accum >>= PyLong_SHIFT; - } - if (remshift) - z->ob_digit[newsize-1] = (digit)accum; - else - assert(!accum); - z = long_normalize(z); - lshift_error: - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *) z; -} - -/* Compute two's complement of digit vector a[0:m], writing result to - z[0:m]. The digit vector a need not be normalized, but should not - be entirely zero. a and z may point to the same digit vector. */ - -static void -v_complement(digit *z, digit *a, Py_ssize_t m) -{ - Py_ssize_t i; - digit carry = 1; - for (i = 0; i < m; ++i) { - carry += a[i] ^ PyLong_MASK; - z[i] = carry & PyLong_MASK; - carry >>= PyLong_SHIFT; - } - assert(carry == 0); -} - -/* Bitwise and/xor/or operations */ - -static PyObject * -long_bitwise(PyLongObject *a, - int op, /* '&', '|', '^' */ - PyLongObject *b) -{ - int nega, negb, negz; - Py_ssize_t size_a, size_b, size_z, i; - PyLongObject *z; - - /* Bitwise operations for negative numbers operate as though - on a two's complement representation. So convert arguments - from sign-magnitude to two's complement, and convert the - result back to sign-magnitude at the end. */ - - /* If a is negative, replace it by its two's complement. */ - size_a = ABS(Py_SIZE(a)); - nega = Py_SIZE(a) < 0; - if (nega) { - z = _PyLong_New(size_a); - if (z == NULL) - return NULL; - v_complement(z->ob_digit, a->ob_digit, size_a); - a = z; - } - else - /* Keep reference count consistent. */ - Py_INCREF(a); - - /* Same for b. */ - size_b = ABS(Py_SIZE(b)); - negb = Py_SIZE(b) < 0; - if (negb) { - z = _PyLong_New(size_b); - if (z == NULL) { - Py_DECREF(a); - return NULL; - } - v_complement(z->ob_digit, b->ob_digit, size_b); - b = z; - } - else - Py_INCREF(b); - - /* Swap a and b if necessary to ensure size_a >= size_b. */ - if (size_a < size_b) { - z = a; a = b; b = z; - size_z = size_a; size_a = size_b; size_b = size_z; - negz = nega; nega = negb; negb = negz; - } - - /* JRH: The original logic here was to allocate the result value (z) - as the longer of the two operands. However, there are some cases - where the result is guaranteed to be shorter than that: AND of two - positives, OR of two negatives: use the shorter number. AND with - mixed signs: use the positive number. OR with mixed signs: use the - negative number. - */ - switch (op) { - case '^': - negz = nega ^ negb; - size_z = size_a; - break; - case '&': - negz = nega & negb; - size_z = negb ? size_a : size_b; - break; - case '|': - negz = nega | negb; - size_z = negb ? size_b : size_a; - break; - default: - PyErr_BadArgument(); - return NULL; - } - - /* We allow an extra digit if z is negative, to make sure that - the final two's complement of z doesn't overflow. */ - z = _PyLong_New(size_z + negz); - if (z == NULL) { - Py_DECREF(a); - Py_DECREF(b); - return NULL; - } - - /* Compute digits for overlap of a and b. */ - switch(op) { - case '&': - for (i = 0; i < size_b; ++i) - z->ob_digit[i] = a->ob_digit[i] & b->ob_digit[i]; - break; - case '|': - for (i = 0; i < size_b; ++i) - z->ob_digit[i] = a->ob_digit[i] | b->ob_digit[i]; - break; - case '^': - for (i = 0; i < size_b; ++i) - z->ob_digit[i] = a->ob_digit[i] ^ b->ob_digit[i]; - break; - default: - PyErr_BadArgument(); - return NULL; - } - - /* Copy any remaining digits of a, inverting if necessary. */ - if (op == '^' && negb) - for (; i < size_z; ++i) - z->ob_digit[i] = a->ob_digit[i] ^ PyLong_MASK; - else if (i < size_z) - memcpy(&z->ob_digit[i], &a->ob_digit[i], - (size_z-i)*sizeof(digit)); - - /* Complement result if negative. */ - if (negz) { - Py_SIZE(z) = -(Py_SIZE(z)); - z->ob_digit[size_z] = PyLong_MASK; - v_complement(z->ob_digit, z->ob_digit, size_z+1); - } - - Py_DECREF(a); - Py_DECREF(b); - return (PyObject *)long_normalize(z); -} - -static PyObject * -long_and(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b; - PyObject *c; - CONVERT_BINOP(v, w, &a, &b); - c = long_bitwise(a, '&', b); - Py_DECREF(a); - Py_DECREF(b); - return c; -} - -static PyObject * -long_xor(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b; - PyObject *c; - CONVERT_BINOP(v, w, &a, &b); - c = long_bitwise(a, '^', b); - Py_DECREF(a); - Py_DECREF(b); - return c; -} - -static PyObject * -long_or(PyObject *v, PyObject *w) -{ - PyLongObject *a, *b; - PyObject *c; - CONVERT_BINOP(v, w, &a, &b); - c = long_bitwise(a, '|', b); - Py_DECREF(a); - Py_DECREF(b); - return c; -} - -static int -long_coerce(PyObject **pv, PyObject **pw) -{ - if (PyInt_Check(*pw)) { - *pw = PyLong_FromLong(PyInt_AS_LONG(*pw)); - if (*pw == NULL) - return -1; - Py_INCREF(*pv); - return 0; - } - else if (PyLong_Check(*pw)) { - Py_INCREF(*pv); - Py_INCREF(*pw); - return 0; - } - return 1; /* Can't do it */ -} - -static PyObject * -long_long(PyObject *v) -{ - if (PyLong_CheckExact(v)) - Py_INCREF(v); - else - v = _PyLong_Copy((PyLongObject *)v); - return v; -} - -static PyObject * -long_int(PyObject *v) -{ - long x; - x = PyLong_AsLong(v); - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) { - PyErr_Clear(); - if (PyLong_CheckExact(v)) { - Py_INCREF(v); - return v; - } - else - return _PyLong_Copy((PyLongObject *)v); - } - else - return NULL; - } - return PyInt_FromLong(x); -} - -static PyObject * -long_float(PyObject *v) -{ - double result; - result = PyLong_AsDouble(v); - if (result == -1.0 && PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(result); -} - -static PyObject * -long_oct(PyObject *v) -{ - return _PyLong_Format(v, 8, 1, 0); -} - -static PyObject * -long_hex(PyObject *v) -{ - return _PyLong_Format(v, 16, 1, 0); -} - -static PyObject * -long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds); - -static PyObject * -long_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyObject *x = NULL; - int base = -909; /* unlikely! */ - static char *kwlist[] = {"x", "base", 0}; - - if (type != &PyLong_Type) - return long_subtype_new(type, args, kwds); /* Wimp out */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "|Oi:long", kwlist, - &x, &base)) - return NULL; - if (x == NULL) { - if (base != -909) { - PyErr_SetString(PyExc_TypeError, - "long() missing string argument"); - return NULL; - } - return PyLong_FromLong(0L); - } - if (base == -909) - return PyNumber_Long(x); - else if (PyString_Check(x)) { - /* Since PyLong_FromString doesn't have a length parameter, - * check here for possible NULs in the string. */ - char *string = PyString_AS_STRING(x); - if (strlen(string) != (size_t)PyString_Size(x)) { - /* create a repr() of the input string, - * just like PyLong_FromString does. */ - PyObject *srepr; - srepr = PyObject_Repr(x); - if (srepr == NULL) - return NULL; - PyErr_Format(PyExc_ValueError, - "invalid literal for long() with base %d: %s", - base, PyString_AS_STRING(srepr)); - Py_DECREF(srepr); - return NULL; - } - return PyLong_FromString(PyString_AS_STRING(x), NULL, base); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(x)) - return PyLong_FromUnicode(PyUnicode_AS_UNICODE(x), - PyUnicode_GET_SIZE(x), - base); -#endif - else { - PyErr_SetString(PyExc_TypeError, - "long() can't convert non-string with explicit base"); - return NULL; - } -} - -/* Wimpy, slow approach to tp_new calls for subtypes of long: - first create a regular long from whatever arguments we got, - then allocate a subtype instance and initialize it from - the regular long. The regular long is then thrown away. -*/ -static PyObject * -long_subtype_new(PyTypeObject *type, PyObject *args, PyObject *kwds) -{ - PyLongObject *tmp, *newobj; - Py_ssize_t i, n; - - assert(PyType_IsSubtype(type, &PyLong_Type)); - tmp = (PyLongObject *)long_new(&PyLong_Type, args, kwds); - if (tmp == NULL) - return NULL; - assert(PyLong_CheckExact(tmp)); - n = Py_SIZE(tmp); - if (n < 0) - n = -n; - newobj = (PyLongObject *)type->tp_alloc(type, n); - if (newobj == NULL) { - Py_DECREF(tmp); - return NULL; - } - assert(PyLong_Check(newobj)); - Py_SIZE(newobj) = Py_SIZE(tmp); - for (i = 0; i < n; i++) - newobj->ob_digit[i] = tmp->ob_digit[i]; - Py_DECREF(tmp); - return (PyObject *)newobj; -} - -static PyObject * -long_getnewargs(PyLongObject *v) -{ - return Py_BuildValue("(N)", _PyLong_Copy(v)); -} - -static PyObject * -long_get0(PyLongObject *v, void *context) { - return PyLong_FromLong(0L); -} - -static PyObject * -long_get1(PyLongObject *v, void *context) { - return PyLong_FromLong(1L); -} - -static PyObject * -long__format__(PyObject *self, PyObject *args) -{ - PyObject *format_spec; - - if (!PyArg_ParseTuple(args, "O:__format__", &format_spec)) - return NULL; - if (PyBytes_Check(format_spec)) - return _PyLong_FormatAdvanced(self, - PyBytes_AS_STRING(format_spec), - PyBytes_GET_SIZE(format_spec)); - if (PyUnicode_Check(format_spec)) { - /* Convert format_spec to a str */ - PyObject *result; - PyObject *str_spec = PyObject_Str(format_spec); - - if (str_spec == NULL) - return NULL; - - result = _PyLong_FormatAdvanced(self, - PyBytes_AS_STRING(str_spec), - PyBytes_GET_SIZE(str_spec)); - - Py_DECREF(str_spec); - return result; - } - PyErr_SetString(PyExc_TypeError, "__format__ requires str or unicode"); - return NULL; -} - -static PyObject * -long_sizeof(PyLongObject *v) -{ - Py_ssize_t res; - - res = v->ob_type->tp_basicsize + ABS(Py_SIZE(v))*sizeof(digit); - return PyInt_FromSsize_t(res); -} - -static PyObject * -long_bit_length(PyLongObject *v) -{ - PyLongObject *result, *x, *y; - Py_ssize_t ndigits, msd_bits = 0; - digit msd; - - assert(v != NULL); - assert(PyLong_Check(v)); - - ndigits = ABS(Py_SIZE(v)); - if (ndigits == 0) - return PyInt_FromLong(0); - - msd = v->ob_digit[ndigits-1]; - while (msd >= 32) { - msd_bits += 6; - msd >>= 6; - } - msd_bits += (long)(BitLengthTable[msd]); - - if (ndigits <= PY_SSIZE_T_MAX/PyLong_SHIFT) - return PyInt_FromSsize_t((ndigits-1)*PyLong_SHIFT + msd_bits); - - /* expression above may overflow; use Python integers instead */ - result = (PyLongObject *)PyLong_FromSsize_t(ndigits - 1); - if (result == NULL) - return NULL; - x = (PyLongObject *)PyLong_FromLong(PyLong_SHIFT); - if (x == NULL) - goto error; - y = (PyLongObject *)long_mul(result, x); - Py_DECREF(x); - if (y == NULL) - goto error; - Py_DECREF(result); - result = y; - - x = (PyLongObject *)PyLong_FromLong((long)msd_bits); - if (x == NULL) - goto error; - y = (PyLongObject *)long_add(result, x); - Py_DECREF(x); - if (y == NULL) - goto error; - Py_DECREF(result); - result = y; - - return (PyObject *)result; - - error: - Py_DECREF(result); - return NULL; -} - -PyDoc_STRVAR(long_bit_length_doc, -"long.bit_length() -> int or long\n\ -\n\ -Number of bits necessary to represent self in binary.\n\ ->>> bin(37L)\n\ -'0b100101'\n\ ->>> (37L).bit_length()\n\ -6"); - -#if 0 -static PyObject * -long_is_finite(PyObject *v) -{ - Py_RETURN_TRUE; -} -#endif - -static PyMethodDef long_methods[] = { - {"conjugate", (PyCFunction)long_long, METH_NOARGS, - "Returns self, the complex conjugate of any long."}, - {"bit_length", (PyCFunction)long_bit_length, METH_NOARGS, - long_bit_length_doc}, -#if 0 - {"is_finite", (PyCFunction)long_is_finite, METH_NOARGS, - "Returns always True."}, -#endif - {"__trunc__", (PyCFunction)long_long, METH_NOARGS, - "Truncating an Integral returns itself."}, - {"__getnewargs__", (PyCFunction)long_getnewargs, METH_NOARGS}, - {"__format__", (PyCFunction)long__format__, METH_VARARGS}, - {"__sizeof__", (PyCFunction)long_sizeof, METH_NOARGS, - "Returns size in memory, in bytes"}, - {NULL, NULL} /* sentinel */ -}; - -static PyGetSetDef long_getset[] = { - {"real", - (getter)long_long, (setter)NULL, - "the real part of a complex number", - NULL}, - {"imag", - (getter)long_get0, (setter)NULL, - "the imaginary part of a complex number", - NULL}, - {"numerator", - (getter)long_long, (setter)NULL, - "the numerator of a rational number in lowest terms", - NULL}, - {"denominator", - (getter)long_get1, (setter)NULL, - "the denominator of a rational number in lowest terms", - NULL}, - {NULL} /* Sentinel */ -}; - -PyDoc_STRVAR(long_doc, -"long(x=0) -> long\n\ -long(x, base=10) -> long\n\ -\n\ -Convert a number or string to a long integer, or return 0L if no arguments\n\ -are given. If x is floating point, the conversion truncates towards zero.\n\ -\n\ -If x is not a number or if base is given, then x must be a string or\n\ -Unicode object representing an integer literal in the given base. The\n\ -literal can be preceded by '+' or '-' and be surrounded by whitespace.\n\ -The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to\n\ -interpret the base from the string as an integer literal.\n\ ->>> int('0b100', base=0)\n\ -4L"); - -static PyNumberMethods long_as_number = { - (binaryfunc)long_add, /*nb_add*/ - (binaryfunc)long_sub, /*nb_subtract*/ - (binaryfunc)long_mul, /*nb_multiply*/ - long_classic_div, /*nb_divide*/ - long_mod, /*nb_remainder*/ - long_divmod, /*nb_divmod*/ - long_pow, /*nb_power*/ - (unaryfunc)long_neg, /*nb_negative*/ - (unaryfunc)long_long, /*tp_positive*/ - (unaryfunc)long_abs, /*tp_absolute*/ - (inquiry)long_nonzero, /*tp_nonzero*/ - (unaryfunc)long_invert, /*nb_invert*/ - long_lshift, /*nb_lshift*/ - (binaryfunc)long_rshift, /*nb_rshift*/ - long_and, /*nb_and*/ - long_xor, /*nb_xor*/ - long_or, /*nb_or*/ - long_coerce, /*nb_coerce*/ - long_int, /*nb_int*/ - long_long, /*nb_long*/ - long_float, /*nb_float*/ - long_oct, /*nb_oct*/ - long_hex, /*nb_hex*/ - 0, /* nb_inplace_add */ - 0, /* nb_inplace_subtract */ - 0, /* nb_inplace_multiply */ - 0, /* nb_inplace_divide */ - 0, /* nb_inplace_remainder */ - 0, /* nb_inplace_power */ - 0, /* nb_inplace_lshift */ - 0, /* nb_inplace_rshift */ - 0, /* nb_inplace_and */ - 0, /* nb_inplace_xor */ - 0, /* nb_inplace_or */ - long_div, /* nb_floor_divide */ - long_true_divide, /* nb_true_divide */ - 0, /* nb_inplace_floor_divide */ - 0, /* nb_inplace_true_divide */ - long_long, /* nb_index */ -}; - -PyTypeObject PyLong_Type = { - PyObject_HEAD_INIT(&PyType_Type) - 0, /* ob_size */ - "long", /* tp_name */ - offsetof(PyLongObject, ob_digit), /* tp_basicsize */ - sizeof(digit), /* tp_itemsize */ - long_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - (cmpfunc)long_compare, /* tp_compare */ - long_repr, /* tp_repr */ - &long_as_number, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - (hashfunc)long_hash, /* tp_hash */ - 0, /* tp_call */ - long_str, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_CHECKTYPES | - Py_TPFLAGS_BASETYPE | Py_TPFLAGS_LONG_SUBCLASS, /* tp_flags */ - long_doc, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - long_methods, /* tp_methods */ - 0, /* tp_members */ - long_getset, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - long_new, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - -static PyTypeObject Long_InfoType; - -PyDoc_STRVAR(long_info__doc__, -"sys.long_info\n\ -\n\ -A struct sequence that holds information about Python's\n\ -internal representation of integers. The attributes are read only."); - -static PyStructSequence_Field long_info_fields[] = { - {"bits_per_digit", "size of a digit in bits"}, - {"sizeof_digit", "size in bytes of the C type used to represent a digit"}, - {NULL, NULL} -}; - -static PyStructSequence_Desc long_info_desc = { - "sys.long_info", /* name */ - long_info__doc__, /* doc */ - long_info_fields, /* fields */ - 2 /* number of fields */ -}; - -PyObject * -PyLong_GetInfo(void) -{ - PyObject* long_info; - int field = 0; - long_info = PyStructSequence_New(&Long_InfoType); - if (long_info == NULL) - return NULL; - PyStructSequence_SET_ITEM(long_info, field++, - PyInt_FromLong(PyLong_SHIFT)); - PyStructSequence_SET_ITEM(long_info, field++, - PyInt_FromLong(sizeof(digit))); - if (PyErr_Occurred()) { - Py_CLEAR(long_info); - return NULL; - } - return long_info; -} - -int -_PyLong_Init(void) -{ - /* initialize long_info */ - if (Long_InfoType.tp_name == 0) - PyStructSequence_InitType(&Long_InfoType, &long_info_desc); - return 1; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/stringlib/localeutil.h b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/stringlib/localeutil.h deleted file mode 100644 index 45c980c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Objects/stringlib/localeutil.h +++ /dev/null @@ -1,227 +0,0 @@ -/** @file - stringlib: locale related helpers implementation. - - Copyright (c) 2011, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#ifndef STRINGLIB_LOCALEUTIL_H -#define STRINGLIB_LOCALEUTIL_H - -#include - -// Prevent conflicts with EFI -#undef MAX -#undef MIN - -#define MAX(x, y) ((x) < (y) ? (y) : (x)) -#define MIN(x, y) ((x) < (y) ? (x) : (y)) - -typedef struct { - const char *grouping; - char previous; - Py_ssize_t i; /* Where we're currently pointing in grouping. */ -} GroupGenerator; - -static void -_GroupGenerator_init(GroupGenerator *self, const char *grouping) -{ - self->grouping = grouping; - self->i = 0; - self->previous = 0; -} - -/* Returns the next grouping, or 0 to signify end. */ -static Py_ssize_t -_GroupGenerator_next(GroupGenerator *self) -{ - /* Note that we don't really do much error checking here. If a - grouping string contains just CHAR_MAX, for example, then just - terminate the generator. That shouldn't happen, but at least we - fail gracefully. */ - switch (self->grouping[self->i]) { - case 0: - return self->previous; - case CHAR_MAX: - /* Stop the generator. */ - return 0; - default: { - char ch = self->grouping[self->i]; - self->previous = ch; - self->i++; - return (Py_ssize_t)ch; - } - } -} - -/* Fill in some digits, leading zeros, and thousands separator. All - are optional, depending on when we're called. */ -static void -fill(STRINGLIB_CHAR **digits_end, STRINGLIB_CHAR **buffer_end, - Py_ssize_t n_chars, Py_ssize_t n_zeros, const char* thousands_sep, - Py_ssize_t thousands_sep_len) -{ -#if STRINGLIB_IS_UNICODE - Py_ssize_t i; -#endif - - if (thousands_sep) { - *buffer_end -= thousands_sep_len; - - /* Copy the thousands_sep chars into the buffer. */ -#if STRINGLIB_IS_UNICODE - /* Convert from the char's of the thousands_sep from - the locale into unicode. */ - for (i = 0; i < thousands_sep_len; ++i) - (*buffer_end)[i] = thousands_sep[i]; -#else - /* No conversion, just memcpy the thousands_sep. */ - memcpy(*buffer_end, thousands_sep, thousands_sep_len); -#endif - } - - *buffer_end -= n_chars; - *digits_end -= n_chars; - memcpy(*buffer_end, *digits_end, n_chars * sizeof(STRINGLIB_CHAR)); - - *buffer_end -= n_zeros; - STRINGLIB_FILL(*buffer_end, '0', n_zeros); -} - -/** - * _Py_InsertThousandsGrouping: - * @buffer: A pointer to the start of a string. - * @n_buffer: Number of characters in @buffer. - * @digits: A pointer to the digits we're reading from. If count - * is non-NULL, this is unused. - * @n_digits: The number of digits in the string, in which we want - * to put the grouping chars. - * @min_width: The minimum width of the digits in the output string. - * Output will be zero-padded on the left to fill. - * @grouping: see definition in localeconv(). - * @thousands_sep: see definition in localeconv(). - * - * There are 2 modes: counting and filling. If @buffer is NULL, - * we are in counting mode, else filling mode. - * If counting, the required buffer size is returned. - * If filling, we know the buffer will be large enough, so we don't - * need to pass in the buffer size. - * Inserts thousand grouping characters (as defined by grouping and - * thousands_sep) into the string between buffer and buffer+n_digits. - * - * Return value: 0 on error, else 1. Note that no error can occur if - * count is non-NULL. - * - * This name won't be used, the includer of this file should define - * it to be the actual function name, based on unicode or string. - * - * As closely as possible, this code mimics the logic in decimal.py's - _insert_thousands_sep(). - **/ -Py_ssize_t -_Py_InsertThousandsGrouping(STRINGLIB_CHAR *buffer, - Py_ssize_t n_buffer, - STRINGLIB_CHAR *digits, - Py_ssize_t n_digits, - Py_ssize_t min_width, - const char *grouping, - const char *thousands_sep) -{ - Py_ssize_t count = 0; - Py_ssize_t n_zeros; - int loop_broken = 0; - int use_separator = 0; /* First time through, don't append the - separator. They only go between - groups. */ - STRINGLIB_CHAR *buffer_end = NULL; - STRINGLIB_CHAR *digits_end = NULL; - Py_ssize_t l; - Py_ssize_t n_chars; - Py_ssize_t thousands_sep_len = strlen(thousands_sep); - Py_ssize_t remaining = n_digits; /* Number of chars remaining to - be looked at */ - /* A generator that returns all of the grouping widths, until it - returns 0. */ - GroupGenerator groupgen; - _GroupGenerator_init(&groupgen, grouping); - - if (buffer) { - buffer_end = buffer + n_buffer; - digits_end = digits + n_digits; - } - - while ((l = _GroupGenerator_next(&groupgen)) > 0) { - l = MIN(l, MAX(MAX(remaining, min_width), 1)); - n_zeros = MAX(0, l - remaining); - n_chars = MAX(0, MIN(remaining, l)); - - /* Use n_zero zero's and n_chars chars */ - - /* Count only, don't do anything. */ - count += (use_separator ? thousands_sep_len : 0) + n_zeros + n_chars; - - if (buffer) { - /* Copy into the output buffer. */ - fill(&digits_end, &buffer_end, n_chars, n_zeros, - use_separator ? thousands_sep : NULL, thousands_sep_len); - } - - /* Use a separator next time. */ - use_separator = 1; - - remaining -= n_chars; - min_width -= l; - - if (remaining <= 0 && min_width <= 0) { - loop_broken = 1; - break; - } - min_width -= thousands_sep_len; - } - if (!loop_broken) { - /* We left the loop without using a break statement. */ - - l = MAX(MAX(remaining, min_width), 1); - n_zeros = MAX(0, l - remaining); - n_chars = MAX(0, MIN(remaining, l)); - - /* Use n_zero zero's and n_chars chars */ - count += (use_separator ? thousands_sep_len : 0) + n_zeros + n_chars; - if (buffer) { - /* Copy into the output buffer. */ - fill(&digits_end, &buffer_end, n_chars, n_zeros, - use_separator ? thousands_sep : NULL, thousands_sep_len); - } - } - return count; -} - -/** - * _Py_InsertThousandsGroupingLocale: - * @buffer: A pointer to the start of a string. - * @n_digits: The number of digits in the string, in which we want - * to put the grouping chars. - * - * Reads thee current locale and calls _Py_InsertThousandsGrouping(). - **/ -Py_ssize_t -_Py_InsertThousandsGroupingLocale(STRINGLIB_CHAR *buffer, - Py_ssize_t n_buffer, - STRINGLIB_CHAR *digits, - Py_ssize_t n_digits, - Py_ssize_t min_width) -{ - struct lconv *locale_data = localeconv(); - const char *grouping = locale_data->grouping; - const char *thousands_sep = locale_data->thousands_sep; - - return _Py_InsertThousandsGrouping(buffer, n_buffer, digits, n_digits, - min_width, grouping, thousands_sep); -} -#endif /* STRINGLIB_LOCALEUTIL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/getcopyright.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/getcopyright.c deleted file mode 100644 index 7127972..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/getcopyright.c +++ /dev/null @@ -1,41 +0,0 @@ -/** @file - Return the copyright string. This is updated manually. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "Python.h" - -static char cprt[] = -"\ -Copyright (c) 2015 Daryl McDaniel.\n\ -All Rights Reserved.\n\ -\n\ -Copyright (c) 2010-2014 Intel Corporation.\n\ -All Rights Reserved.\n\ -\n\ -Copyright (c) 2001-2015 Python Software Foundation.\n\ -All Rights Reserved.\n\ -\n\ -Copyright (c) 2000 BeOpen.com.\n\ -All Rights Reserved.\n\ -\n\ -Copyright (c) 1995-2001 Corporation for National Research Initiatives.\n\ -All Rights Reserved.\n\ -\n\ -Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n\ -All Rights Reserved."; - -const char * -Py_GetCopyright(void) -{ - return cprt; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/marshal.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/marshal.c deleted file mode 100644 index 3890d13..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/marshal.c +++ /dev/null @@ -1,1423 +0,0 @@ -/** @file - Write Python objects to files and read them back. - This is intended for writing and reading compiled Python code only; - a true persistent storage facility would be much harder, since - it would have to take circular links and sharing into account. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#define PY_SSIZE_T_CLEAN - -#include "Python.h" -#include "longintrepr.h" -#include "code.h" -#include "marshal.h" - -#undef ABS -#define ABS(x) ((x) < 0 ? -(x) : (x)) - -/* High water mark to determine when the marshalled object is dangerously deep - * and risks coring the interpreter. When the object stack gets this deep, - * raise an exception instead of continuing. - */ -#define MAX_MARSHAL_STACK_DEPTH 2000 - -#define TYPE_NULL '0' -#define TYPE_NONE 'N' -#define TYPE_FALSE 'F' -#define TYPE_TRUE 'T' -#define TYPE_STOPITER 'S' -#define TYPE_ELLIPSIS '.' -#define TYPE_INT 'i' -#define TYPE_INT64 'I' -#define TYPE_FLOAT 'f' -#define TYPE_BINARY_FLOAT 'g' -#define TYPE_COMPLEX 'x' -#define TYPE_BINARY_COMPLEX 'y' -#define TYPE_LONG 'l' -#define TYPE_STRING 's' -#define TYPE_INTERNED 't' -#define TYPE_STRINGREF 'R' -#define TYPE_TUPLE '(' -#define TYPE_LIST '[' -#define TYPE_DICT '{' -#define TYPE_CODE 'c' -#define TYPE_UNICODE 'u' -#define TYPE_UNKNOWN '?' -#define TYPE_SET '<' -#define TYPE_FROZENSET '>' - -#define WFERR_OK 0 -#define WFERR_UNMARSHALLABLE 1 -#define WFERR_NESTEDTOODEEP 2 -#define WFERR_NOMEMORY 3 - -typedef struct { - FILE *fp; - int error; /* see WFERR_* values */ - int depth; - /* If fp == NULL, the following are valid: */ - PyObject *str; - char *ptr; - char *end; - PyObject *strings; /* dict on marshal, list on unmarshal */ - int version; -} WFILE; - -#define w_byte(c, p) if (((p)->fp)) putc((c), (p)->fp); \ - else if ((p)->ptr != (p)->end) *(p)->ptr++ = (c); \ - else w_more(c, p) - -static void -w_more(int c, WFILE *p) -{ - Py_ssize_t size, newsize; - if (p->str == NULL) - return; /* An error already occurred */ - size = PyString_Size(p->str); - newsize = size + size + 1024; - if (newsize > 32*1024*1024) { - newsize = size + (size >> 3); /* 12.5% overallocation */ - } - if (_PyString_Resize(&p->str, newsize) != 0) { - p->ptr = p->end = NULL; - } - else { - p->ptr = PyString_AS_STRING((PyStringObject *)p->str) + size; - p->end = - PyString_AS_STRING((PyStringObject *)p->str) + newsize; - *p->ptr++ = Py_SAFE_DOWNCAST(c, int, char); - } -} - -static void -w_string(const char *s, Py_ssize_t n, WFILE *p) -{ - if (p->fp != NULL) { - fwrite(s, 1, n, p->fp); - } - else { - while (--n >= 0) { - w_byte(*s, p); - s++; - } - } -} - -static void -w_short(int x, WFILE *p) -{ - w_byte((char)( x & 0xff), p); - w_byte((char)((x>> 8) & 0xff), p); -} - -static void -w_long(long x, WFILE *p) -{ - w_byte((char)( x & 0xff), p); - w_byte((char)((x>> 8) & 0xff), p); - w_byte((char)((x>>16) & 0xff), p); - w_byte((char)((x>>24) & 0xff), p); -} - -#if SIZEOF_LONG > 4 -static void -w_long64(long x, WFILE *p) -{ - w_long(x, p); - w_long(x>>32, p); -} -#endif - -#define SIZE32_MAX 0x7FFFFFFF - -#if SIZEOF_SIZE_T > 4 -# define W_SIZE(n, p) do { \ - if ((n) > SIZE32_MAX) { \ - (p)->depth--; \ - (p)->error = WFERR_UNMARSHALLABLE; \ - return; \ - } \ - w_long((long)(n), p); \ - } while(0) -#else -# define W_SIZE w_long -#endif - -static void -w_pstring(const char *s, Py_ssize_t n, WFILE *p) -{ - W_SIZE(n, p); - w_string(s, n, p); -} - -/* We assume that Python longs are stored internally in base some power of - 2**15; for the sake of portability we'll always read and write them in base - exactly 2**15. */ - -#define PyLong_MARSHAL_SHIFT 15 -#define PyLong_MARSHAL_BASE ((short)1 << PyLong_MARSHAL_SHIFT) -#define PyLong_MARSHAL_MASK (PyLong_MARSHAL_BASE - 1) -#if PyLong_SHIFT % PyLong_MARSHAL_SHIFT != 0 -#error "PyLong_SHIFT must be a multiple of PyLong_MARSHAL_SHIFT" -#endif -#define PyLong_MARSHAL_RATIO (PyLong_SHIFT / PyLong_MARSHAL_SHIFT) - -static void -w_PyLong(const PyLongObject *ob, WFILE *p) -{ - Py_ssize_t i, j, n, l; - digit d; - - w_byte(TYPE_LONG, p); - if (Py_SIZE(ob) == 0) { - w_long((long)0, p); - return; - } - - /* set l to number of base PyLong_MARSHAL_BASE digits */ - n = ABS(Py_SIZE(ob)); - l = (n-1) * PyLong_MARSHAL_RATIO; - d = ob->ob_digit[n-1]; - assert(d != 0); /* a PyLong is always normalized */ - do { - d >>= PyLong_MARSHAL_SHIFT; - l++; - } while (d != 0); - if (l > SIZE32_MAX) { - p->depth--; - p->error = WFERR_UNMARSHALLABLE; - return; - } - w_long((long)(Py_SIZE(ob) > 0 ? l : -l), p); - - for (i=0; i < n-1; i++) { - d = ob->ob_digit[i]; - for (j=0; j < PyLong_MARSHAL_RATIO; j++) { - w_short(d & PyLong_MARSHAL_MASK, p); - d >>= PyLong_MARSHAL_SHIFT; - } - assert (d == 0); - } - d = ob->ob_digit[n-1]; - do { - w_short(d & PyLong_MARSHAL_MASK, p); - d >>= PyLong_MARSHAL_SHIFT; - } while (d != 0); -} - -static void -w_object(PyObject *v, WFILE *p) -{ - Py_ssize_t i, n; - - p->depth++; - - if (p->depth > MAX_MARSHAL_STACK_DEPTH) { - p->error = WFERR_NESTEDTOODEEP; - } - else if (v == NULL) { - w_byte(TYPE_NULL, p); - } - else if (v == Py_None) { - w_byte(TYPE_NONE, p); - } - else if (v == PyExc_StopIteration) { - w_byte(TYPE_STOPITER, p); - } - else if (v == Py_Ellipsis) { - w_byte(TYPE_ELLIPSIS, p); - } - else if (v == Py_False) { - w_byte(TYPE_FALSE, p); - } - else if (v == Py_True) { - w_byte(TYPE_TRUE, p); - } - else if (PyInt_CheckExact(v)) { - long x = PyInt_AS_LONG((PyIntObject *)v); -#if SIZEOF_LONG > 4 - long y = Py_ARITHMETIC_RIGHT_SHIFT(long, x, 31); - if (y && y != -1) { - w_byte(TYPE_INT64, p); - w_long64(x, p); - } - else -#endif - { - w_byte(TYPE_INT, p); - w_long(x, p); - } - } - else if (PyLong_CheckExact(v)) { - PyLongObject *ob = (PyLongObject *)v; - w_PyLong(ob, p); - } - else if (PyFloat_CheckExact(v)) { - if (p->version > 1) { - unsigned char buf[8]; - if (_PyFloat_Pack8(PyFloat_AsDouble(v), - buf, 1) < 0) { - p->error = WFERR_UNMARSHALLABLE; - return; - } - w_byte(TYPE_BINARY_FLOAT, p); - w_string((char*)buf, 8, p); - } - else { - char *buf = PyOS_double_to_string(PyFloat_AS_DOUBLE(v), - 'g', 17, 0, NULL); - if (!buf) { - p->error = WFERR_NOMEMORY; - return; - } - n = strlen(buf); - w_byte(TYPE_FLOAT, p); - w_byte((int)n, p); - w_string(buf, n, p); - PyMem_Free(buf); - } - } -#ifndef WITHOUT_COMPLEX - else if (PyComplex_CheckExact(v)) { - if (p->version > 1) { - unsigned char buf[8]; - if (_PyFloat_Pack8(PyComplex_RealAsDouble(v), - buf, 1) < 0) { - p->error = WFERR_UNMARSHALLABLE; - return; - } - w_byte(TYPE_BINARY_COMPLEX, p); - w_string((char*)buf, 8, p); - if (_PyFloat_Pack8(PyComplex_ImagAsDouble(v), - buf, 1) < 0) { - p->error = WFERR_UNMARSHALLABLE; - return; - } - w_string((char*)buf, 8, p); - } - else { - char *buf; - w_byte(TYPE_COMPLEX, p); - buf = PyOS_double_to_string(PyComplex_RealAsDouble(v), - 'g', 17, 0, NULL); - if (!buf) { - p->error = WFERR_NOMEMORY; - return; - } - n = strlen(buf); - w_byte((int)n, p); - w_string(buf, n, p); - PyMem_Free(buf); - buf = PyOS_double_to_string(PyComplex_ImagAsDouble(v), - 'g', 17, 0, NULL); - if (!buf) { - p->error = WFERR_NOMEMORY; - return; - } - n = strlen(buf); - w_byte((int)n, p); - w_string(buf, n, p); - PyMem_Free(buf); - } - } -#endif - else if (PyString_CheckExact(v)) { - if (p->strings && PyString_CHECK_INTERNED(v)) { - PyObject *o = PyDict_GetItem(p->strings, v); - if (o) { - long w = PyInt_AsLong(o); - w_byte(TYPE_STRINGREF, p); - w_long(w, p); - goto exit; - } - else { - int ok; - o = PyInt_FromSsize_t(PyDict_Size(p->strings)); - ok = o && - PyDict_SetItem(p->strings, v, o) >= 0; - Py_XDECREF(o); - if (!ok) { - p->depth--; - p->error = WFERR_UNMARSHALLABLE; - return; - } - w_byte(TYPE_INTERNED, p); - } - } - else { - w_byte(TYPE_STRING, p); - } - w_pstring(PyBytes_AS_STRING(v), PyString_GET_SIZE(v), p); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_CheckExact(v)) { - PyObject *utf8; - utf8 = PyUnicode_AsUTF8String(v); - if (utf8 == NULL) { - p->depth--; - p->error = WFERR_UNMARSHALLABLE; - return; - } - w_byte(TYPE_UNICODE, p); - w_pstring(PyString_AS_STRING(utf8), PyString_GET_SIZE(utf8), p); - Py_DECREF(utf8); - } -#endif - else if (PyTuple_CheckExact(v)) { - w_byte(TYPE_TUPLE, p); - n = PyTuple_Size(v); - W_SIZE(n, p); - for (i = 0; i < n; i++) { - w_object(PyTuple_GET_ITEM(v, i), p); - } - } - else if (PyList_CheckExact(v)) { - w_byte(TYPE_LIST, p); - n = PyList_GET_SIZE(v); - W_SIZE(n, p); - for (i = 0; i < n; i++) { - w_object(PyList_GET_ITEM(v, i), p); - } - } - else if (PyDict_CheckExact(v)) { - Py_ssize_t pos; - PyObject *key, *value; - w_byte(TYPE_DICT, p); - /* This one is NULL object terminated! */ - pos = 0; - while (PyDict_Next(v, &pos, &key, &value)) { - w_object(key, p); - w_object(value, p); - } - w_object((PyObject *)NULL, p); - } - else if (PyAnySet_CheckExact(v)) { - PyObject *value, *it; - - if (PyObject_TypeCheck(v, &PySet_Type)) - w_byte(TYPE_SET, p); - else - w_byte(TYPE_FROZENSET, p); - n = PyObject_Size(v); - if (n == -1) { - p->depth--; - p->error = WFERR_UNMARSHALLABLE; - return; - } - W_SIZE(n, p); - it = PyObject_GetIter(v); - if (it == NULL) { - p->depth--; - p->error = WFERR_UNMARSHALLABLE; - return; - } - while ((value = PyIter_Next(it)) != NULL) { - w_object(value, p); - Py_DECREF(value); - } - Py_DECREF(it); - if (PyErr_Occurred()) { - p->depth--; - p->error = WFERR_UNMARSHALLABLE; - return; - } - } - else if (PyCode_Check(v)) { - PyCodeObject *co = (PyCodeObject *)v; - w_byte(TYPE_CODE, p); - w_long(co->co_argcount, p); - w_long(co->co_nlocals, p); - w_long(co->co_stacksize, p); - w_long(co->co_flags, p); - w_object(co->co_code, p); - w_object(co->co_consts, p); - w_object(co->co_names, p); - w_object(co->co_varnames, p); - w_object(co->co_freevars, p); - w_object(co->co_cellvars, p); - w_object(co->co_filename, p); - w_object(co->co_name, p); - w_long(co->co_firstlineno, p); - w_object(co->co_lnotab, p); - } - else if (PyObject_CheckReadBuffer(v)) { - /* Write unknown buffer-style objects as a string */ - char *s; - PyBufferProcs *pb = v->ob_type->tp_as_buffer; - w_byte(TYPE_STRING, p); - n = (*pb->bf_getreadbuffer)(v, 0, (void **)&s); - w_pstring(s, n, p); - } - else { - w_byte(TYPE_UNKNOWN, p); - p->error = WFERR_UNMARSHALLABLE; - } - exit: - p->depth--; -} - -/* version currently has no effect for writing longs. */ -void -PyMarshal_WriteLongToFile(long x, FILE *fp, int version) -{ - WFILE wf; - wf.fp = fp; - wf.error = WFERR_OK; - wf.depth = 0; - wf.strings = NULL; - wf.version = version; - w_long(x, &wf); -} - -void -PyMarshal_WriteObjectToFile(PyObject *x, FILE *fp, int version) -{ - WFILE wf; - wf.fp = fp; - wf.error = WFERR_OK; - wf.depth = 0; - wf.strings = (version > 0) ? PyDict_New() : NULL; - wf.version = version; - w_object(x, &wf); - Py_XDECREF(wf.strings); -} - -typedef WFILE RFILE; /* Same struct with different invariants */ - -#define rs_byte(p) (((p)->ptr < (p)->end) ? (unsigned char)*(p)->ptr++ : EOF) - -#define r_byte(p) ((p)->fp ? getc((p)->fp) : rs_byte(p)) - -static Py_ssize_t -r_string(char *s, Py_ssize_t n, RFILE *p) -{ - if (p->fp != NULL) - /* The result fits into int because it must be <=n. */ - return fread(s, 1, n, p->fp); - if (p->end - p->ptr < n) - n = p->end - p->ptr; - memcpy(s, p->ptr, n); - p->ptr += n; - return n; -} - -static int -r_short(RFILE *p) -{ - register short x; - x = r_byte(p); - x |= r_byte(p) << 8; - /* Sign-extension, in case short greater than 16 bits */ - x |= -(x & 0x8000); - return x; -} - -static long -r_long(RFILE *p) -{ - register long x; - register FILE *fp = p->fp; - if (fp) { - x = getc(fp); - x |= (long)getc(fp) << 8; - x |= (long)getc(fp) << 16; - x |= (long)getc(fp) << 24; - } - else { - x = rs_byte(p); - x |= (long)rs_byte(p) << 8; - x |= (long)rs_byte(p) << 16; - x |= (long)rs_byte(p) << 24; - } -#if SIZEOF_LONG > 4 - /* Sign extension for 64-bit machines */ - x |= -(x & 0x80000000L); -#endif - return x; -} - -/* r_long64 deals with the TYPE_INT64 code. On a machine with - sizeof(long) > 4, it returns a Python int object, else a Python long - object. Note that w_long64 writes out TYPE_INT if 32 bits is enough, - so there's no inefficiency here in returning a PyLong on 32-bit boxes - for everything written via TYPE_INT64 (i.e., if an int is written via - TYPE_INT64, it *needs* more than 32 bits). -*/ -static PyObject * -r_long64(RFILE *p) -{ - long lo4 = r_long(p); - long hi4 = r_long(p); -#if SIZEOF_LONG > 4 - long x = (hi4 << 32) | (lo4 & 0xFFFFFFFFL); - return PyInt_FromLong(x); -#else - unsigned char buf[8]; - int one = 1; - int is_little_endian = (int)*(char*)&one; - if (is_little_endian) { - memcpy(buf, &lo4, 4); - memcpy(buf+4, &hi4, 4); - } - else { - memcpy(buf, &hi4, 4); - memcpy(buf+4, &lo4, 4); - } - return _PyLong_FromByteArray(buf, 8, is_little_endian, 1); -#endif -} - -static PyObject * -r_PyLong(RFILE *p) -{ - PyLongObject *ob; - long n, size, i; - int j, md, shorts_in_top_digit; - digit d; - - n = r_long(p); - if (n == 0) - return (PyObject *)_PyLong_New(0); - if (n < -SIZE32_MAX || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, - "bad marshal data (long size out of range)"); - return NULL; - } - - size = 1 + (ABS(n) - 1) / PyLong_MARSHAL_RATIO; - shorts_in_top_digit = 1 + (ABS(n) - 1) % PyLong_MARSHAL_RATIO; - ob = _PyLong_New(size); - if (ob == NULL) - return NULL; - Py_SIZE(ob) = n > 0 ? size : -size; - - for (i = 0; i < size-1; i++) { - d = 0; - for (j=0; j < PyLong_MARSHAL_RATIO; j++) { - md = r_short(p); - if (md < 0 || md > PyLong_MARSHAL_BASE) - goto bad_digit; - d += (digit)md << j*PyLong_MARSHAL_SHIFT; - } - ob->ob_digit[i] = d; - } - d = 0; - for (j=0; j < shorts_in_top_digit; j++) { - md = r_short(p); - if (md < 0 || md > PyLong_MARSHAL_BASE) - goto bad_digit; - /* topmost marshal digit should be nonzero */ - if (md == 0 && j == shorts_in_top_digit - 1) { - Py_DECREF(ob); - PyErr_SetString(PyExc_ValueError, - "bad marshal data (unnormalized long data)"); - return NULL; - } - d += (digit)md << j*PyLong_MARSHAL_SHIFT; - } - /* top digit should be nonzero, else the resulting PyLong won't be - normalized */ - ob->ob_digit[size-1] = d; - return (PyObject *)ob; - bad_digit: - Py_DECREF(ob); - PyErr_SetString(PyExc_ValueError, - "bad marshal data (digit out of range in long)"); - return NULL; -} - - -static PyObject * -r_object(RFILE *p) -{ - /* NULL is a valid return value, it does not necessarily means that - an exception is set. */ - PyObject *v, *v2; - long i, n; - int type = r_byte(p); - PyObject *retval; - - p->depth++; - - if (p->depth > MAX_MARSHAL_STACK_DEPTH) { - p->depth--; - PyErr_SetString(PyExc_ValueError, "recursion limit exceeded"); - return NULL; - } - - switch (type) { - - case EOF: - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - - case TYPE_NULL: - retval = NULL; - break; - - case TYPE_NONE: - Py_INCREF(Py_None); - retval = Py_None; - break; - - case TYPE_STOPITER: - Py_INCREF(PyExc_StopIteration); - retval = PyExc_StopIteration; - break; - - case TYPE_ELLIPSIS: - Py_INCREF(Py_Ellipsis); - retval = Py_Ellipsis; - break; - - case TYPE_FALSE: - Py_INCREF(Py_False); - retval = Py_False; - break; - - case TYPE_TRUE: - Py_INCREF(Py_True); - retval = Py_True; - break; - - case TYPE_INT: - retval = PyInt_FromLong(r_long(p)); - break; - - case TYPE_INT64: - retval = r_long64(p); - break; - - case TYPE_LONG: - retval = r_PyLong(p); - break; - - case TYPE_FLOAT: - { - char buf[256]; - double dx; - n = r_byte(p); - if (n == EOF || r_string(buf, n, p) != n) { - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - buf[n] = '\0'; - dx = PyOS_string_to_double(buf, NULL, NULL); - if (dx == -1.0 && PyErr_Occurred()) { - retval = NULL; - break; - } - retval = PyFloat_FromDouble(dx); - break; - } - - case TYPE_BINARY_FLOAT: - { - unsigned char buf[8]; - double x; - if (r_string((char*)buf, 8, p) != 8) { - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - x = _PyFloat_Unpack8(buf, 1); - if (x == -1.0 && PyErr_Occurred()) { - retval = NULL; - break; - } - retval = PyFloat_FromDouble(x); - break; - } - -#ifndef WITHOUT_COMPLEX - case TYPE_COMPLEX: - { - char buf[256]; - Py_complex c; - n = r_byte(p); - if (n == EOF || r_string(buf, n, p) != n) { - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - buf[n] = '\0'; - c.real = PyOS_string_to_double(buf, NULL, NULL); - if (c.real == -1.0 && PyErr_Occurred()) { - retval = NULL; - break; - } - n = r_byte(p); - if (n == EOF || r_string(buf, n, p) != n) { - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - buf[n] = '\0'; - c.imag = PyOS_string_to_double(buf, NULL, NULL); - if (c.imag == -1.0 && PyErr_Occurred()) { - retval = NULL; - break; - } - retval = PyComplex_FromCComplex(c); - break; - } - - case TYPE_BINARY_COMPLEX: - { - unsigned char buf[8]; - Py_complex c; - if (r_string((char*)buf, 8, p) != 8) { - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - c.real = _PyFloat_Unpack8(buf, 1); - if (c.real == -1.0 && PyErr_Occurred()) { - retval = NULL; - break; - } - if (r_string((char*)buf, 8, p) != 8) { - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - c.imag = _PyFloat_Unpack8(buf, 1); - if (c.imag == -1.0 && PyErr_Occurred()) { - retval = NULL; - break; - } - retval = PyComplex_FromCComplex(c); - break; - } -#endif - - case TYPE_INTERNED: - case TYPE_STRING: - n = r_long(p); - if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (string size out of range)"); - retval = NULL; - break; - } - v = PyString_FromStringAndSize((char *)NULL, n); - if (v == NULL) { - retval = NULL; - break; - } - if (r_string(PyString_AS_STRING(v), n, p) != n) { - Py_DECREF(v); - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - if (type == TYPE_INTERNED) { - PyString_InternInPlace(&v); - if (PyList_Append(p->strings, v) < 0) { - retval = NULL; - break; - } - } - retval = v; - break; - - case TYPE_STRINGREF: - n = r_long(p); - if (n < 0 || n >= PyList_GET_SIZE(p->strings)) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (string ref out of range)"); - retval = NULL; - break; - } - v = PyList_GET_ITEM(p->strings, n); - Py_INCREF(v); - retval = v; - break; - -#ifdef Py_USING_UNICODE - case TYPE_UNICODE: - { - char *buffer; - - n = r_long(p); - if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (unicode size out of range)"); - retval = NULL; - break; - } - buffer = PyMem_NEW(char, n); - if (buffer == NULL) { - retval = PyErr_NoMemory(); - break; - } - if (r_string(buffer, n, p) != n) { - PyMem_DEL(buffer); - PyErr_SetString(PyExc_EOFError, - "EOF read where object expected"); - retval = NULL; - break; - } - v = PyUnicode_DecodeUTF8(buffer, n, NULL); - PyMem_DEL(buffer); - retval = v; - break; - } -#endif - - case TYPE_TUPLE: - n = r_long(p); - if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (tuple size out of range)"); - retval = NULL; - break; - } - v = PyTuple_New(n); - if (v == NULL) { - retval = NULL; - break; - } - for (i = 0; i < n; i++) { - v2 = r_object(p); - if ( v2 == NULL ) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "NULL object in marshal data for tuple"); - Py_DECREF(v); - v = NULL; - break; - } - PyTuple_SET_ITEM(v, i, v2); - } - retval = v; - break; - - case TYPE_LIST: - n = r_long(p); - if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (list size out of range)"); - retval = NULL; - break; - } - v = PyList_New(n); - if (v == NULL) { - retval = NULL; - break; - } - for (i = 0; i < n; i++) { - v2 = r_object(p); - if ( v2 == NULL ) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "NULL object in marshal data for list"); - Py_DECREF(v); - v = NULL; - break; - } - PyList_SET_ITEM(v, i, v2); - } - retval = v; - break; - - case TYPE_DICT: - v = PyDict_New(); - if (v == NULL) { - retval = NULL; - break; - } - for (;;) { - PyObject *key, *val; - key = r_object(p); - if (key == NULL) - break; - val = r_object(p); - if (val != NULL) - PyDict_SetItem(v, key, val); - Py_DECREF(key); - Py_XDECREF(val); - } - if (PyErr_Occurred()) { - Py_DECREF(v); - v = NULL; - } - retval = v; - break; - - case TYPE_SET: - case TYPE_FROZENSET: - n = r_long(p); - if (n < 0 || n > SIZE32_MAX) { - PyErr_SetString(PyExc_ValueError, "bad marshal data (set size out of range)"); - retval = NULL; - break; - } - v = (type == TYPE_SET) ? PySet_New(NULL) : PyFrozenSet_New(NULL); - if (v == NULL) { - retval = NULL; - break; - } - for (i = 0; i < n; i++) { - v2 = r_object(p); - if ( v2 == NULL ) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "NULL object in marshal data for set"); - Py_DECREF(v); - v = NULL; - break; - } - if (PySet_Add(v, v2) == -1) { - Py_DECREF(v); - Py_DECREF(v2); - v = NULL; - break; - } - Py_DECREF(v2); - } - retval = v; - break; - - case TYPE_CODE: - if (PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, - "cannot unmarshal code objects in " - "restricted execution mode"); - retval = NULL; - break; - } - else { - int argcount; - int nlocals; - int stacksize; - int flags; - PyObject *code = NULL; - PyObject *consts = NULL; - PyObject *names = NULL; - PyObject *varnames = NULL; - PyObject *freevars = NULL; - PyObject *cellvars = NULL; - PyObject *filename = NULL; - PyObject *name = NULL; - int firstlineno; - PyObject *lnotab = NULL; - - v = NULL; - - /* XXX ignore long->int overflows for now */ - argcount = (int)r_long(p); - nlocals = (int)r_long(p); - stacksize = (int)r_long(p); - flags = (int)r_long(p); - code = r_object(p); - if (code == NULL) - goto code_error; - consts = r_object(p); - if (consts == NULL) - goto code_error; - names = r_object(p); - if (names == NULL) - goto code_error; - varnames = r_object(p); - if (varnames == NULL) - goto code_error; - freevars = r_object(p); - if (freevars == NULL) - goto code_error; - cellvars = r_object(p); - if (cellvars == NULL) - goto code_error; - filename = r_object(p); - if (filename == NULL) - goto code_error; - name = r_object(p); - if (name == NULL) - goto code_error; - firstlineno = (int)r_long(p); - lnotab = r_object(p); - if (lnotab == NULL) - goto code_error; - - v = (PyObject *) PyCode_New( - argcount, nlocals, stacksize, flags, - code, consts, names, varnames, - freevars, cellvars, filename, name, - firstlineno, lnotab); - - code_error: - Py_XDECREF(code); - Py_XDECREF(consts); - Py_XDECREF(names); - Py_XDECREF(varnames); - Py_XDECREF(freevars); - Py_XDECREF(cellvars); - Py_XDECREF(filename); - Py_XDECREF(name); - Py_XDECREF(lnotab); - - } - retval = v; - break; - - default: - /* Bogus data got written, which isn't ideal. - This will let you keep working and recover. */ - PyErr_SetString(PyExc_ValueError, "bad marshal data (unknown type code)"); - retval = NULL; - break; - - } - p->depth--; - return retval; -} - -static PyObject * -read_object(RFILE *p) -{ - PyObject *v; - if (PyErr_Occurred()) { - fprintf(stderr, "XXX readobject called with exception set\n"); - return NULL; - } - v = r_object(p); - if (v == NULL && !PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, "NULL object in marshal data for object"); - return v; -} - -int -PyMarshal_ReadShortFromFile(FILE *fp) -{ - RFILE rf; - assert(fp); - rf.fp = fp; - rf.strings = NULL; - rf.end = rf.ptr = NULL; - return r_short(&rf); -} - -long -PyMarshal_ReadLongFromFile(FILE *fp) -{ - RFILE rf; - rf.fp = fp; - rf.strings = NULL; - rf.ptr = rf.end = NULL; - return r_long(&rf); -} - -#ifdef HAVE_FSTAT -/* Return size of file in bytes; < 0 if unknown. */ -static off_t -getfilesize(FILE *fp) -{ - struct stat st; - if (fstat(fileno(fp), &st) != 0) - return -1; - else - return st.st_size; -} -#endif - -/* If we can get the size of the file up-front, and it's reasonably small, - * read it in one gulp and delegate to ...FromString() instead. Much quicker - * than reading a byte at a time from file; speeds .pyc imports. - * CAUTION: since this may read the entire remainder of the file, don't - * call it unless you know you're done with the file. - */ -PyObject * -PyMarshal_ReadLastObjectFromFile(FILE *fp) -{ -/* REASONABLE_FILE_LIMIT is by defn something big enough for Tkinter.pyc. */ -#define REASONABLE_FILE_LIMIT (1L << 18) -#ifdef HAVE_FSTAT - off_t filesize; - filesize = getfilesize(fp); - if (filesize > 0 && filesize <= REASONABLE_FILE_LIMIT) { - char* pBuf = (char *)PyMem_MALLOC(filesize); - if (pBuf != NULL) { - size_t n = fread(pBuf, 1, (size_t)filesize, fp); - PyObject* v = PyMarshal_ReadObjectFromString(pBuf, n); - PyMem_FREE(pBuf); - return v; - } - - } -#endif - /* We don't have fstat, or we do but the file is larger than - * REASONABLE_FILE_LIMIT or malloc failed -- read a byte at a time. - */ - return PyMarshal_ReadObjectFromFile(fp); - -#undef REASONABLE_FILE_LIMIT -} - -PyObject * -PyMarshal_ReadObjectFromFile(FILE *fp) -{ - RFILE rf; - PyObject *result; - rf.fp = fp; - rf.strings = PyList_New(0); - rf.depth = 0; - rf.ptr = rf.end = NULL; - result = r_object(&rf); - Py_DECREF(rf.strings); - return result; -} - -PyObject * -PyMarshal_ReadObjectFromString(char *str, Py_ssize_t len) -{ - RFILE rf; - PyObject *result; - rf.fp = NULL; - rf.ptr = str; - rf.end = str + len; - rf.strings = PyList_New(0); - rf.depth = 0; - result = r_object(&rf); - Py_DECREF(rf.strings); - return result; -} - -static void -set_error(int error) -{ - switch (error) { - case WFERR_NOMEMORY: - PyErr_NoMemory(); - break; - case WFERR_UNMARSHALLABLE: - PyErr_SetString(PyExc_ValueError, "unmarshallable object"); - break; - case WFERR_NESTEDTOODEEP: - default: - PyErr_SetString(PyExc_ValueError, - "object too deeply nested to marshal"); - break; - } -} - -PyObject * -PyMarshal_WriteObjectToString(PyObject *x, int version) -{ - WFILE wf; - wf.fp = NULL; - wf.str = PyString_FromStringAndSize((char *)NULL, 50); - if (wf.str == NULL) - return NULL; - wf.ptr = PyString_AS_STRING((PyStringObject *)wf.str); - wf.end = wf.ptr + PyString_Size(wf.str); - wf.error = WFERR_OK; - wf.depth = 0; - wf.version = version; - wf.strings = (version > 0) ? PyDict_New() : NULL; - w_object(x, &wf); - Py_XDECREF(wf.strings); - if (wf.str != NULL) { - char *base = PyString_AS_STRING((PyStringObject *)wf.str); - if (wf.ptr - base > PY_SSIZE_T_MAX) { - Py_DECREF(wf.str); - PyErr_SetString(PyExc_OverflowError, - "too much marshall data for a string"); - return NULL; - } - if (_PyString_Resize(&wf.str, (Py_ssize_t)(wf.ptr - base))) - return NULL; - } - if (wf.error != WFERR_OK) { - Py_XDECREF(wf.str); - set_error(wf.error); - return NULL; - } - return wf.str; -} - -/* And an interface for Python programs... */ - -static PyObject * -marshal_dump(PyObject *self, PyObject *args) -{ - WFILE wf; - PyObject *x; - PyObject *f; - int version = Py_MARSHAL_VERSION; - if (!PyArg_ParseTuple(args, "OO|i:dump", &x, &f, &version)) - return NULL; - if (!PyFile_Check(f)) { - PyErr_SetString(PyExc_TypeError, - "marshal.dump() 2nd arg must be file"); - return NULL; - } - wf.fp = PyFile_AsFile(f); - wf.str = NULL; - wf.ptr = wf.end = NULL; - wf.error = WFERR_OK; - wf.depth = 0; - wf.strings = (version > 0) ? PyDict_New() : 0; - wf.version = version; - w_object(x, &wf); - Py_XDECREF(wf.strings); - if (wf.error != WFERR_OK) { - set_error(wf.error); - return NULL; - } - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(dump_doc, -"dump(value, file[, version])\n\ -\n\ -Write the value on the open file. The value must be a supported type.\n\ -The file must be an open file object such as sys.stdout or returned by\n\ -open() or os.popen(). It must be opened in binary mode ('wb' or 'w+b').\n\ -\n\ -If the value has (or contains an object that has) an unsupported type, a\n\ -ValueError exception is raised — but garbage data will also be written\n\ -to the file. The object will not be properly read back by load()\n\ -\n\ -New in version 2.4: The version argument indicates the data format that\n\ -dump should use."); - -static PyObject * -marshal_load(PyObject *self, PyObject *f) -{ - RFILE rf; - PyObject *result; - if (!PyFile_Check(f)) { - PyErr_SetString(PyExc_TypeError, - "marshal.load() arg must be file"); - return NULL; - } - rf.fp = PyFile_AsFile(f); - rf.strings = PyList_New(0); - rf.depth = 0; - result = read_object(&rf); - Py_DECREF(rf.strings); - return result; -} - -PyDoc_STRVAR(load_doc, -"load(file)\n\ -\n\ -Read one value from the open file and return it. If no valid value is\n\ -read (e.g. because the data has a different Python version’s\n\ -incompatible marshal format), raise EOFError, ValueError or TypeError.\n\ -The file must be an open file object opened in binary mode ('rb' or\n\ -'r+b').\n\ -\n\ -Note: If an object containing an unsupported type was marshalled with\n\ -dump(), load() will substitute None for the unmarshallable type."); - - -static PyObject * -marshal_dumps(PyObject *self, PyObject *args) -{ - PyObject *x; - int version = Py_MARSHAL_VERSION; - if (!PyArg_ParseTuple(args, "O|i:dumps", &x, &version)) - return NULL; - return PyMarshal_WriteObjectToString(x, version); -} - -PyDoc_STRVAR(dumps_doc, -"dumps(value[, version])\n\ -\n\ -Return the string that would be written to a file by dump(value, file).\n\ -The value must be a supported type. Raise a ValueError exception if\n\ -value has (or contains an object that has) an unsupported type.\n\ -\n\ -New in version 2.4: The version argument indicates the data format that\n\ -dumps should use."); - - -static PyObject * -marshal_loads(PyObject *self, PyObject *args) -{ - RFILE rf; - char *s; - Py_ssize_t n; - PyObject* result; - if (!PyArg_ParseTuple(args, "s#:loads", &s, &n)) - return NULL; - rf.fp = NULL; - rf.ptr = s; - rf.end = s + n; - rf.strings = PyList_New(0); - rf.depth = 0; - result = read_object(&rf); - Py_DECREF(rf.strings); - return result; -} - -PyDoc_STRVAR(loads_doc, -"loads(string)\n\ -\n\ -Convert the string to a value. If no valid value is found, raise\n\ -EOFError, ValueError or TypeError. Extra characters in the string are\n\ -ignored."); - -static PyMethodDef marshal_methods[] = { - {"dump", marshal_dump, METH_VARARGS, dump_doc}, - {"load", marshal_load, METH_O, load_doc}, - {"dumps", marshal_dumps, METH_VARARGS, dumps_doc}, - {"loads", marshal_loads, METH_VARARGS, loads_doc}, - {NULL, NULL} /* sentinel */ -}; - -PyDoc_STRVAR(marshal_doc, -"This module contains functions that can read and write Python values in\n\ -a binary format. The format is specific to Python, but independent of\n\ -machine architecture issues.\n\ -\n\ -Not all Python object types are supported; in general, only objects\n\ -whose value is independent from a particular invocation of Python can be\n\ -written and read by this module. The following types are supported:\n\ -None, integers, long integers, floating point numbers, strings, Unicode\n\ -objects, tuples, lists, sets, dictionaries, and code objects, where it\n\ -should be understood that tuples, lists and dictionaries are only\n\ -supported as long as the values contained therein are themselves\n\ -supported; and recursive lists and dictionaries should not be written\n\ -(they will cause infinite loops).\n\ -\n\ -Variables:\n\ -\n\ -version -- indicates the format that the module uses. Version 0 is the\n\ - historical format, version 1 (added in Python 2.4) shares interned\n\ - strings and version 2 (added in Python 2.5) uses a binary format for\n\ - floating point numbers. (New in version 2.4)\n\ -\n\ -Functions:\n\ -\n\ -dump() -- write value to a file\n\ -load() -- read value from a file\n\ -dumps() -- write value to a string\n\ -loads() -- read value from a string"); - - -PyMODINIT_FUNC -PyMarshal_Init(void) -{ - PyObject *mod = Py_InitModule3("marshal", marshal_methods, - marshal_doc); - if (mod == NULL) - return; - PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/random.c b/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/random.c deleted file mode 100644 index e69c6dd..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Python/random.c +++ /dev/null @@ -1,446 +0,0 @@ -/** @file - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ - -#include "Python.h" -#ifdef MS_WINDOWS -#include -#else -#include -#endif - -#ifdef Py_DEBUG -int _Py_HashSecret_Initialized = 0; -#else -static int _Py_HashSecret_Initialized = 0; -#endif - -#ifdef MS_WINDOWS -typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTA)(HCRYPTPROV *phProv,\ - LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType,\ - DWORD dwFlags ); -typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV hProv, DWORD dwLen,\ - BYTE *pbBuffer ); - -static CRYPTGENRANDOM pCryptGenRandom = NULL; -/* This handle is never explicitly released. Instead, the operating - system will release it when the process terminates. */ -static HCRYPTPROV hCryptProv = 0; - -static int -win32_urandom_init(int raise) -{ - HINSTANCE hAdvAPI32 = NULL; - CRYPTACQUIRECONTEXTA pCryptAcquireContext = NULL; - - /* Obtain handle to the DLL containing CryptoAPI. This should not fail. */ - hAdvAPI32 = GetModuleHandle("advapi32.dll"); - if(hAdvAPI32 == NULL) - goto error; - - /* Obtain pointers to the CryptoAPI functions. This will fail on some early - versions of Win95. */ - pCryptAcquireContext = (CRYPTACQUIRECONTEXTA)GetProcAddress( - hAdvAPI32, "CryptAcquireContextA"); - if (pCryptAcquireContext == NULL) - goto error; - - pCryptGenRandom = (CRYPTGENRANDOM)GetProcAddress(hAdvAPI32, - "CryptGenRandom"); - if (pCryptGenRandom == NULL) - goto error; - - /* Acquire context */ - if (! pCryptAcquireContext(&hCryptProv, NULL, NULL, - PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) - goto error; - - return 0; - -error: - if (raise) - PyErr_SetFromWindowsErr(0); - else - Py_FatalError("Failed to initialize Windows random API (CryptoGen)"); - return -1; -} - -/* Fill buffer with size pseudo-random bytes generated by the Windows CryptoGen - API. Return 0 on success, or -1 on error. */ -static int -win32_urandom(unsigned char *buffer, Py_ssize_t size, int raise) -{ - Py_ssize_t chunk; - - if (hCryptProv == 0) - { - if (win32_urandom_init(raise) == -1) - return -1; - } - - while (size > 0) - { - chunk = size > INT_MAX ? INT_MAX : size; - if (!pCryptGenRandom(hCryptProv, chunk, buffer)) - { - /* CryptGenRandom() failed */ - if (raise) - PyErr_SetFromWindowsErr(0); - else - Py_FatalError("Failed to initialized the randomized hash " - "secret using CryptoGen)"); - return -1; - } - buffer += chunk; - size -= chunk; - } - return 0; -} - -#elif HAVE_GETENTROPY -/* Fill buffer with size pseudo-random bytes generated by getentropy(). - Return 0 on success, or raise an exception and return -1 on error. - If fatal is nonzero, call Py_FatalError() instead of raising an exception - on error. */ -static int -py_getentropy(unsigned char *buffer, Py_ssize_t size, int fatal) -{ - while (size > 0) { - Py_ssize_t len = size < 256 ? size : 256; - int res; - - if (!fatal) { - Py_BEGIN_ALLOW_THREADS - res = getentropy(buffer, len); - Py_END_ALLOW_THREADS - - if (res < 0) { - PyErr_SetFromErrno(PyExc_OSError); - return -1; - } - } - else { - res = getentropy(buffer, len); - if (res < 0) - Py_FatalError("getentropy() failed"); - } - - buffer += len; - size -= len; - } - return 0; -} -#endif - -#ifdef __VMS -/* Use openssl random routine */ -#include -static int -vms_urandom(unsigned char *buffer, Py_ssize_t size, int raise) -{ - if (RAND_pseudo_bytes(buffer, size) < 0) { - if (raise) { - PyErr_Format(PyExc_ValueError, - "RAND_pseudo_bytes"); - } else { - Py_FatalError("Failed to initialize the randomized hash " - "secret using RAND_pseudo_bytes"); - } - return -1; - } - return 0; -} -#endif /* __VMS */ - - -#if !defined(MS_WINDOWS) && !defined(__VMS) - -static struct { - int fd; -#ifdef HAVE_STRUCT_STAT_ST_DEV - dev_t st_dev; -#endif -#ifdef HAVE_STRUCT_STAT_ST_INO - ino_t st_ino; -#endif -} urandom_cache = { -1 }; - -/* Read size bytes from /dev/urandom into buffer. - Call Py_FatalError() on error. */ -static void -dev_urandom_noraise(unsigned char *buffer, Py_ssize_t size) -{ - int fd; - Py_ssize_t n; - - assert (0 < size); - - fd = open("/dev/urandom", O_RDONLY, 0); - if (fd < 0) - Py_FatalError("Failed to open /dev/urandom"); - - while (0 < size) - { - do { - n = read(fd, buffer, (size_t)size); - } while (n < 0 && errno == EINTR); - if (n <= 0) - { - /* stop on error or if read(size) returned 0 */ - Py_FatalError("Failed to read bytes from /dev/urandom"); - break; - } - buffer += n; - size -= (Py_ssize_t)n; - } - close(fd); -} - -/* Read size bytes from /dev/urandom into buffer. - Return 0 on success, raise an exception and return -1 on error. */ -static int -dev_urandom_python(char *buffer, Py_ssize_t size) -{ - int fd; - Py_ssize_t n; - struct stat st; - int attr; - - if (size <= 0) - return 0; - - if (urandom_cache.fd >= 0) { - /* Does the fd point to the same thing as before? (issue #21207) */ - if (fstat(urandom_cache.fd, &st) -#ifdef HAVE_STRUCT_STAT_ST_DEV - || st.st_dev != urandom_cache.st_dev -#endif -#ifdef HAVE_STRUCT_STAT_ST_INO - || st.st_ino != urandom_cache.st_ino -#endif - ) - { - /* Something changed: forget the cached fd (but don't close it, - since it probably points to something important for some - third-party code). */ - urandom_cache.fd = -1; - } - } - if (urandom_cache.fd >= 0) - fd = urandom_cache.fd; - else { - Py_BEGIN_ALLOW_THREADS - fd = open("/dev/urandom", O_RDONLY, 0); - Py_END_ALLOW_THREADS - if (fd < 0) - { - if (errno == ENOENT || errno == ENXIO || - errno == ENODEV || errno == EACCES) - PyErr_SetString(PyExc_NotImplementedError, - "/dev/urandom (or equivalent) not found"); - else - PyErr_SetFromErrno(PyExc_OSError); - return -1; - } - - /* try to make the file descriptor non-inheritable, ignore errors */ - attr = fcntl(fd, F_GETFD); - if (attr >= 0) { - attr |= FD_CLOEXEC; - (void)fcntl(fd, F_SETFD, attr); - } - - if (urandom_cache.fd >= 0) { - /* urandom_fd was initialized by another thread while we were - not holding the GIL, keep it. */ - close(fd); - fd = urandom_cache.fd; - } - else { - if (fstat(fd, &st)) { - PyErr_SetFromErrno(PyExc_OSError); - close(fd); - return -1; - } - else { - urandom_cache.fd = fd; -#ifdef HAVE_STRUCT_STAT_ST_DEV - urandom_cache.st_dev = st.st_dev; -#endif -#ifdef HAVE_STRUCT_STAT_ST_INO - urandom_cache.st_ino = st.st_ino; -#endif - } - } - } - - Py_BEGIN_ALLOW_THREADS - do { - do { - n = read(fd, buffer, (size_t)size); - } while (n < 0 && errno == EINTR); - if (n <= 0) - break; - buffer += n; - size -= (Py_ssize_t)n; - } while (0 < size); - Py_END_ALLOW_THREADS - - if (n <= 0) - { - /* stop on error or if read(size) returned 0 */ - if (n < 0) - PyErr_SetFromErrno(PyExc_OSError); - else - PyErr_Format(PyExc_RuntimeError, - "Failed to read %zi bytes from /dev/urandom", - size); - return -1; - } - return 0; -} - -static void -dev_urandom_close(void) -{ - if (urandom_cache.fd >= 0) { - close(urandom_cache.fd); - urandom_cache.fd = -1; - } -} - - -#endif /* !defined(MS_WINDOWS) && !defined(__VMS) */ - -/* Fill buffer with pseudo-random bytes generated by a linear congruent - generator (LCG): - - x(n+1) = (x(n) * 214013 + 2531011) % 2^32 - - Use bits 23..16 of x(n) to generate a byte. */ -static void -lcg_urandom(unsigned int x0, unsigned char *buffer, size_t size) -{ - size_t index; - unsigned int x; - - x = x0; - for (index=0; index < size; index++) { - x *= 214013; - x += 2531011; - /* modulo 2 ^ (8 * sizeof(int)) */ - buffer[index] = (x >> 16) & 0xff; - } -} - -/* Fill buffer with size pseudo-random bytes from the operating system random - number generator (RNG). It is suitable for most cryptographic purposes - except long living private keys for asymmetric encryption. - - Return 0 on success, raise an exception and return -1 on error. */ -int -_PyOS_URandom(void *buffer, Py_ssize_t size) -{ - if (size < 0) { - PyErr_Format(PyExc_ValueError, - "negative argument not allowed"); - return -1; - } - if (size == 0) - return 0; - -#ifdef MS_WINDOWS - return win32_urandom((unsigned char *)buffer, size, 1); -#elif HAVE_GETENTROPY - return py_getentropy(buffer, size, 0); -#else -# ifdef __VMS - return vms_urandom((unsigned char *)buffer, size, 1); -# else - return dev_urandom_python((char*)buffer, size); -# endif -#endif -} - -void -_PyRandom_Init(void) -{ - char *env; - void *secret = &_Py_HashSecret; - Py_ssize_t secret_size = sizeof(_Py_HashSecret_t); - - if (_Py_HashSecret_Initialized) - return; - _Py_HashSecret_Initialized = 1; - - /* - By default, hash randomization is disabled, and only - enabled if PYTHONHASHSEED is set to non-empty or if - "-R" is provided at the command line: - */ - if (!Py_HashRandomizationFlag) { - /* Disable the randomized hash: */ - memset(secret, 0, secret_size); - return; - } - - /* - Hash randomization is enabled. Generate a per-process secret, - using PYTHONHASHSEED if provided. - */ - - env = Py_GETENV("PYTHONHASHSEED"); - if (env && *env != '\0' && strcmp(env, "random") != 0) { - char *endptr = env; - unsigned long seed; - seed = strtoul(env, &endptr, 10); - if (*endptr != '\0' - || seed > 4294967295UL - || (errno == ERANGE && seed == ULONG_MAX)) - { - Py_FatalError("PYTHONHASHSEED must be \"random\" or an integer " - "in range [0; 4294967295]"); - } - if (seed == 0) { - /* disable the randomized hash */ - memset(secret, 0, secret_size); - } - else { - lcg_urandom(seed, (unsigned char*)secret, secret_size); - } - } - else { -#ifdef MS_WINDOWS - (void)win32_urandom((unsigned char *)secret, secret_size, 0); -#elif __VMS - vms_urandom((unsigned char *)secret, secret_size, 0); -#elif HAVE_GETENTROPY - (void)py_getentropy(secret, secret_size, 1); -#else - dev_urandom_noraise(secret, secret_size); -#endif - } -} - -void -_PyRandom_Fini(void) -{ -#ifdef MS_WINDOWS - if (hCryptProv) { - CryptReleaseContext(hCryptProv, 0); - hCryptProv = 0; - } -#elif HAVE_GETENTROPY - /* nothing to clean */ -#else - dev_urandom_close(); -#endif -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/Python-ast.c b/AppPkg/Applications/Python/Python-2.7.10/Python/Python-ast.c deleted file mode 100644 index ab4009a..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/Python-ast.c +++ /dev/null @@ -1,6788 +0,0 @@ -/* File automatically generated by Parser/asdl_c.py. */ - - -/* - __version__ 82160. - - This module must be committed separately after each AST grammar change; - The __version__ number is set to the revision number of the commit - containing the grammar change. -*/ - -#include "Python.h" -#include "Python-ast.h" - -static PyTypeObject AST_type; -static PyTypeObject *mod_type; -static PyObject* ast2obj_mod(void*); -static PyTypeObject *Module_type; -static char *Module_fields[]={ - "body", -}; -static PyTypeObject *Interactive_type; -static char *Interactive_fields[]={ - "body", -}; -static PyTypeObject *Expression_type; -static char *Expression_fields[]={ - "body", -}; -static PyTypeObject *Suite_type; -static char *Suite_fields[]={ - "body", -}; -static PyTypeObject *stmt_type; -static char *stmt_attributes[] = { - "lineno", - "col_offset", -}; -static PyObject* ast2obj_stmt(void*); -static PyTypeObject *FunctionDef_type; -static char *FunctionDef_fields[]={ - "name", - "args", - "body", - "decorator_list", -}; -static PyTypeObject *ClassDef_type; -static char *ClassDef_fields[]={ - "name", - "bases", - "body", - "decorator_list", -}; -static PyTypeObject *Return_type; -static char *Return_fields[]={ - "value", -}; -static PyTypeObject *Delete_type; -static char *Delete_fields[]={ - "targets", -}; -static PyTypeObject *Assign_type; -static char *Assign_fields[]={ - "targets", - "value", -}; -static PyTypeObject *AugAssign_type; -static char *AugAssign_fields[]={ - "target", - "op", - "value", -}; -static PyTypeObject *Print_type; -static char *Print_fields[]={ - "dest", - "values", - "nl", -}; -static PyTypeObject *For_type; -static char *For_fields[]={ - "target", - "iter", - "body", - "orelse", -}; -static PyTypeObject *While_type; -static char *While_fields[]={ - "test", - "body", - "orelse", -}; -static PyTypeObject *If_type; -static char *If_fields[]={ - "test", - "body", - "orelse", -}; -static PyTypeObject *With_type; -static char *With_fields[]={ - "context_expr", - "optional_vars", - "body", -}; -static PyTypeObject *Raise_type; -static char *Raise_fields[]={ - "type", - "inst", - "tback", -}; -static PyTypeObject *TryExcept_type; -static char *TryExcept_fields[]={ - "body", - "handlers", - "orelse", -}; -static PyTypeObject *TryFinally_type; -static char *TryFinally_fields[]={ - "body", - "finalbody", -}; -static PyTypeObject *Assert_type; -static char *Assert_fields[]={ - "test", - "msg", -}; -static PyTypeObject *Import_type; -static char *Import_fields[]={ - "names", -}; -static PyTypeObject *ImportFrom_type; -static char *ImportFrom_fields[]={ - "module", - "names", - "level", -}; -static PyTypeObject *Exec_type; -static char *Exec_fields[]={ - "body", - "globals", - "locals", -}; -static PyTypeObject *Global_type; -static char *Global_fields[]={ - "names", -}; -static PyTypeObject *Expr_type; -static char *Expr_fields[]={ - "value", -}; -static PyTypeObject *Pass_type; -static PyTypeObject *Break_type; -static PyTypeObject *Continue_type; -static PyTypeObject *expr_type; -static char *expr_attributes[] = { - "lineno", - "col_offset", -}; -static PyObject* ast2obj_expr(void*); -static PyTypeObject *BoolOp_type; -static char *BoolOp_fields[]={ - "op", - "values", -}; -static PyTypeObject *BinOp_type; -static char *BinOp_fields[]={ - "left", - "op", - "right", -}; -static PyTypeObject *UnaryOp_type; -static char *UnaryOp_fields[]={ - "op", - "operand", -}; -static PyTypeObject *Lambda_type; -static char *Lambda_fields[]={ - "args", - "body", -}; -static PyTypeObject *IfExp_type; -static char *IfExp_fields[]={ - "test", - "body", - "orelse", -}; -static PyTypeObject *Dict_type; -static char *Dict_fields[]={ - "keys", - "values", -}; -static PyTypeObject *Set_type; -static char *Set_fields[]={ - "elts", -}; -static PyTypeObject *ListComp_type; -static char *ListComp_fields[]={ - "elt", - "generators", -}; -static PyTypeObject *SetComp_type; -static char *SetComp_fields[]={ - "elt", - "generators", -}; -static PyTypeObject *DictComp_type; -static char *DictComp_fields[]={ - "key", - "value", - "generators", -}; -static PyTypeObject *GeneratorExp_type; -static char *GeneratorExp_fields[]={ - "elt", - "generators", -}; -static PyTypeObject *Yield_type; -static char *Yield_fields[]={ - "value", -}; -static PyTypeObject *Compare_type; -static char *Compare_fields[]={ - "left", - "ops", - "comparators", -}; -static PyTypeObject *Call_type; -static char *Call_fields[]={ - "func", - "args", - "keywords", - "starargs", - "kwargs", -}; -static PyTypeObject *Repr_type; -static char *Repr_fields[]={ - "value", -}; -static PyTypeObject *Num_type; -static char *Num_fields[]={ - "n", -}; -static PyTypeObject *Str_type; -static char *Str_fields[]={ - "s", -}; -static PyTypeObject *Attribute_type; -static char *Attribute_fields[]={ - "value", - "attr", - "ctx", -}; -static PyTypeObject *Subscript_type; -static char *Subscript_fields[]={ - "value", - "slice", - "ctx", -}; -static PyTypeObject *Name_type; -static char *Name_fields[]={ - "id", - "ctx", -}; -static PyTypeObject *List_type; -static char *List_fields[]={ - "elts", - "ctx", -}; -static PyTypeObject *Tuple_type; -static char *Tuple_fields[]={ - "elts", - "ctx", -}; -static PyTypeObject *expr_context_type; -static PyObject *Load_singleton, *Store_singleton, *Del_singleton, -*AugLoad_singleton, *AugStore_singleton, *Param_singleton; -static PyObject* ast2obj_expr_context(expr_context_ty); -static PyTypeObject *Load_type; -static PyTypeObject *Store_type; -static PyTypeObject *Del_type; -static PyTypeObject *AugLoad_type; -static PyTypeObject *AugStore_type; -static PyTypeObject *Param_type; -static PyTypeObject *slice_type; -static PyObject* ast2obj_slice(void*); -static PyTypeObject *Ellipsis_type; -static PyTypeObject *Slice_type; -static char *Slice_fields[]={ - "lower", - "upper", - "step", -}; -static PyTypeObject *ExtSlice_type; -static char *ExtSlice_fields[]={ - "dims", -}; -static PyTypeObject *Index_type; -static char *Index_fields[]={ - "value", -}; -static PyTypeObject *boolop_type; -static PyObject *And_singleton, *Or_singleton; -static PyObject* ast2obj_boolop(boolop_ty); -static PyTypeObject *And_type; -static PyTypeObject *Or_type; -static PyTypeObject *operator_type; -static PyObject *Add_singleton, *Sub_singleton, *Mult_singleton, -*Div_singleton, *Mod_singleton, *Pow_singleton, *LShift_singleton, -*RShift_singleton, *BitOr_singleton, *BitXor_singleton, *BitAnd_singleton, -*FloorDiv_singleton; -static PyObject* ast2obj_operator(operator_ty); -static PyTypeObject *Add_type; -static PyTypeObject *Sub_type; -static PyTypeObject *Mult_type; -static PyTypeObject *Div_type; -static PyTypeObject *Mod_type; -static PyTypeObject *Pow_type; -static PyTypeObject *LShift_type; -static PyTypeObject *RShift_type; -static PyTypeObject *BitOr_type; -static PyTypeObject *BitXor_type; -static PyTypeObject *BitAnd_type; -static PyTypeObject *FloorDiv_type; -static PyTypeObject *unaryop_type; -static PyObject *Invert_singleton, *Not_singleton, *UAdd_singleton, -*USub_singleton; -static PyObject* ast2obj_unaryop(unaryop_ty); -static PyTypeObject *Invert_type; -static PyTypeObject *Not_type; -static PyTypeObject *UAdd_type; -static PyTypeObject *USub_type; -static PyTypeObject *cmpop_type; -static PyObject *Eq_singleton, *NotEq_singleton, *Lt_singleton, *LtE_singleton, -*Gt_singleton, *GtE_singleton, *Is_singleton, *IsNot_singleton, *In_singleton, -*NotIn_singleton; -static PyObject* ast2obj_cmpop(cmpop_ty); -static PyTypeObject *Eq_type; -static PyTypeObject *NotEq_type; -static PyTypeObject *Lt_type; -static PyTypeObject *LtE_type; -static PyTypeObject *Gt_type; -static PyTypeObject *GtE_type; -static PyTypeObject *Is_type; -static PyTypeObject *IsNot_type; -static PyTypeObject *In_type; -static PyTypeObject *NotIn_type; -static PyTypeObject *comprehension_type; -static PyObject* ast2obj_comprehension(void*); -static char *comprehension_fields[]={ - "target", - "iter", - "ifs", -}; -static PyTypeObject *excepthandler_type; -static char *excepthandler_attributes[] = { - "lineno", - "col_offset", -}; -static PyObject* ast2obj_excepthandler(void*); -static PyTypeObject *ExceptHandler_type; -static char *ExceptHandler_fields[]={ - "type", - "name", - "body", -}; -static PyTypeObject *arguments_type; -static PyObject* ast2obj_arguments(void*); -static char *arguments_fields[]={ - "args", - "vararg", - "kwarg", - "defaults", -}; -static PyTypeObject *keyword_type; -static PyObject* ast2obj_keyword(void*); -static char *keyword_fields[]={ - "arg", - "value", -}; -static PyTypeObject *alias_type; -static PyObject* ast2obj_alias(void*); -static char *alias_fields[]={ - "name", - "asname", -}; - - -static int -ast_type_init(PyObject *self, PyObject *args, PyObject *kw) -{ - Py_ssize_t i, numfields = 0; - int res = -1; - PyObject *key, *value, *fields; - fields = PyObject_GetAttrString((PyObject*)Py_TYPE(self), "_fields"); - if (!fields) - PyErr_Clear(); - if (fields) { - numfields = PySequence_Size(fields); - if (numfields == -1) - goto cleanup; - } - res = 0; /* if no error occurs, this stays 0 to the end */ - if (PyTuple_GET_SIZE(args) > 0) { - if (numfields != PyTuple_GET_SIZE(args)) { - PyErr_Format(PyExc_TypeError, "%.400s constructor takes %s" - "%zd positional argument%s", - Py_TYPE(self)->tp_name, - numfields == 0 ? "" : "either 0 or ", - numfields, numfields == 1 ? "" : "s"); - res = -1; - goto cleanup; - } - for (i = 0; i < PyTuple_GET_SIZE(args); i++) { - /* cannot be reached when fields is NULL */ - PyObject *name = PySequence_GetItem(fields, i); - if (!name) { - res = -1; - goto cleanup; - } - res = PyObject_SetAttr(self, name, PyTuple_GET_ITEM(args, i)); - Py_DECREF(name); - if (res < 0) - goto cleanup; - } - } - if (kw) { - i = 0; /* needed by PyDict_Next */ - while (PyDict_Next(kw, &i, &key, &value)) { - res = PyObject_SetAttr(self, key, value); - if (res < 0) - goto cleanup; - } - } - cleanup: - Py_XDECREF(fields); - return res; -} - -/* Pickling support */ -static PyObject * -ast_type_reduce(PyObject *self, PyObject *unused) -{ - PyObject *res; - PyObject *dict = PyObject_GetAttrString(self, "__dict__"); - if (dict == NULL) { - if (PyErr_ExceptionMatches(PyExc_AttributeError)) - PyErr_Clear(); - else - return NULL; - } - if (dict) { - res = Py_BuildValue("O()O", Py_TYPE(self), dict); - Py_DECREF(dict); - return res; - } - return Py_BuildValue("O()", Py_TYPE(self)); -} - -static PyMethodDef ast_type_methods[] = { - {"__reduce__", ast_type_reduce, METH_NOARGS, NULL}, - {NULL} -}; - -static PyTypeObject AST_type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "_ast.AST", - sizeof(PyObject), - 0, - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - PyObject_GenericSetAttr, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - ast_type_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ast_type_init, /* tp_init */ - PyType_GenericAlloc, /* tp_alloc */ - PyType_GenericNew, /* tp_new */ - PyObject_Del, /* tp_free */ -}; - - -static PyTypeObject* make_type(char *type, PyTypeObject* base, char**fields, int num_fields) -{ - PyObject *fnames, *result; - int i; - fnames = PyTuple_New(num_fields); - if (!fnames) return NULL; - for (i = 0; i < num_fields; i++) { - PyObject *field = PyString_FromString(fields[i]); - if (!field) { - Py_DECREF(fnames); - return NULL; - } - PyTuple_SET_ITEM(fnames, i, field); - } - result = PyObject_CallFunction((PyObject*)&PyType_Type, "s(O){sOss}", - type, base, "_fields", fnames, "__module__", "_ast"); - Py_DECREF(fnames); - return (PyTypeObject*)result; -} - -static int add_attributes(PyTypeObject* type, char**attrs, int num_fields) -{ - int i, result; - PyObject *s, *l = PyTuple_New(num_fields); - if (!l) - return 0; - for (i = 0; i < num_fields; i++) { - s = PyString_FromString(attrs[i]); - if (!s) { - Py_DECREF(l); - return 0; - } - PyTuple_SET_ITEM(l, i, s); - } - result = PyObject_SetAttrString((PyObject*)type, "_attributes", l) >= 0; - Py_DECREF(l); - return result; -} - -/* Conversion AST -> Python */ - -static PyObject* ast2obj_list(asdl_seq *seq, PyObject* (*func)(void*)) -{ - int i, n = asdl_seq_LEN(seq); - PyObject *result = PyList_New(n); - PyObject *value; - if (!result) - return NULL; - for (i = 0; i < n; i++) { - value = func(asdl_seq_GET(seq, i)); - if (!value) { - Py_DECREF(result); - return NULL; - } - PyList_SET_ITEM(result, i, value); - } - return result; -} - -static PyObject* ast2obj_object(void *o) -{ - if (!o) - o = Py_None; - Py_INCREF((PyObject*)o); - return (PyObject*)o; -} -#define ast2obj_identifier ast2obj_object -#define ast2obj_string ast2obj_object -static PyObject* ast2obj_bool(bool b) -{ - return PyBool_FromLong(b); -} - -static PyObject* ast2obj_int(long b) -{ - return PyInt_FromLong(b); -} - -/* Conversion Python -> AST */ - -static int obj2ast_object(PyObject* obj, PyObject** out, PyArena* arena) -{ - if (obj == Py_None) - obj = NULL; - if (obj) - PyArena_AddPyObject(arena, obj); - Py_XINCREF(obj); - *out = obj; - return 0; -} - -static int obj2ast_identifier(PyObject* obj, PyObject** out, PyArena* arena) -{ - if (!PyString_CheckExact(obj) && obj != Py_None) { - PyErr_Format(PyExc_TypeError, - "AST identifier must be of type str"); - return 1; - } - return obj2ast_object(obj, out, arena); -} - -static int obj2ast_string(PyObject* obj, PyObject** out, PyArena* arena) -{ - if (!PyString_CheckExact(obj) && !PyUnicode_CheckExact(obj)) { - PyErr_SetString(PyExc_TypeError, - "AST string must be of type str or unicode"); - return 1; - } - return obj2ast_object(obj, out, arena); -} - -static int obj2ast_int(PyObject* obj, int* out, PyArena* arena) -{ - int i; - if (!PyInt_Check(obj) && !PyLong_Check(obj)) { - PyObject *s = PyObject_Repr(obj); - if (s == NULL) return 1; - PyErr_Format(PyExc_ValueError, "invalid integer value: %.400s", - PyString_AS_STRING(s)); - Py_DECREF(s); - return 1; - } - - i = (int)PyLong_AsLong(obj); - if (i == -1 && PyErr_Occurred()) - return 1; - *out = i; - return 0; -} - -static int obj2ast_bool(PyObject* obj, bool* out, PyArena* arena) -{ - if (!PyBool_Check(obj)) { - PyObject *s = PyObject_Repr(obj); - if (s == NULL) return 1; - PyErr_Format(PyExc_ValueError, "invalid boolean value: %.400s", - PyString_AS_STRING(s)); - Py_DECREF(s); - return 1; - } - - *out = (obj == Py_True); - return 0; -} - -static int add_ast_fields(void) -{ - PyObject *empty_tuple, *d; - if (PyType_Ready(&AST_type) < 0) - return -1; - d = AST_type.tp_dict; - empty_tuple = PyTuple_New(0); - if (!empty_tuple || - PyDict_SetItemString(d, "_fields", empty_tuple) < 0 || - PyDict_SetItemString(d, "_attributes", empty_tuple) < 0) { - Py_XDECREF(empty_tuple); - return -1; - } - Py_DECREF(empty_tuple); - return 0; -} - - -static int init_types(void) -{ - static int initialized; - if (initialized) return 1; - if (add_ast_fields() < 0) return 0; - mod_type = make_type("mod", &AST_type, NULL, 0); - if (!mod_type) return 0; - if (!add_attributes(mod_type, NULL, 0)) return 0; - Module_type = make_type("Module", mod_type, Module_fields, 1); - if (!Module_type) return 0; - Interactive_type = make_type("Interactive", mod_type, - Interactive_fields, 1); - if (!Interactive_type) return 0; - Expression_type = make_type("Expression", mod_type, Expression_fields, - 1); - if (!Expression_type) return 0; - Suite_type = make_type("Suite", mod_type, Suite_fields, 1); - if (!Suite_type) return 0; - stmt_type = make_type("stmt", &AST_type, NULL, 0); - if (!stmt_type) return 0; - if (!add_attributes(stmt_type, stmt_attributes, 2)) return 0; - FunctionDef_type = make_type("FunctionDef", stmt_type, - FunctionDef_fields, 4); - if (!FunctionDef_type) return 0; - ClassDef_type = make_type("ClassDef", stmt_type, ClassDef_fields, 4); - if (!ClassDef_type) return 0; - Return_type = make_type("Return", stmt_type, Return_fields, 1); - if (!Return_type) return 0; - Delete_type = make_type("Delete", stmt_type, Delete_fields, 1); - if (!Delete_type) return 0; - Assign_type = make_type("Assign", stmt_type, Assign_fields, 2); - if (!Assign_type) return 0; - AugAssign_type = make_type("AugAssign", stmt_type, AugAssign_fields, 3); - if (!AugAssign_type) return 0; - Print_type = make_type("Print", stmt_type, Print_fields, 3); - if (!Print_type) return 0; - For_type = make_type("For", stmt_type, For_fields, 4); - if (!For_type) return 0; - While_type = make_type("While", stmt_type, While_fields, 3); - if (!While_type) return 0; - If_type = make_type("If", stmt_type, If_fields, 3); - if (!If_type) return 0; - With_type = make_type("With", stmt_type, With_fields, 3); - if (!With_type) return 0; - Raise_type = make_type("Raise", stmt_type, Raise_fields, 3); - if (!Raise_type) return 0; - TryExcept_type = make_type("TryExcept", stmt_type, TryExcept_fields, 3); - if (!TryExcept_type) return 0; - TryFinally_type = make_type("TryFinally", stmt_type, TryFinally_fields, - 2); - if (!TryFinally_type) return 0; - Assert_type = make_type("Assert", stmt_type, Assert_fields, 2); - if (!Assert_type) return 0; - Import_type = make_type("Import", stmt_type, Import_fields, 1); - if (!Import_type) return 0; - ImportFrom_type = make_type("ImportFrom", stmt_type, ImportFrom_fields, - 3); - if (!ImportFrom_type) return 0; - Exec_type = make_type("Exec", stmt_type, Exec_fields, 3); - if (!Exec_type) return 0; - Global_type = make_type("Global", stmt_type, Global_fields, 1); - if (!Global_type) return 0; - Expr_type = make_type("Expr", stmt_type, Expr_fields, 1); - if (!Expr_type) return 0; - Pass_type = make_type("Pass", stmt_type, NULL, 0); - if (!Pass_type) return 0; - Break_type = make_type("Break", stmt_type, NULL, 0); - if (!Break_type) return 0; - Continue_type = make_type("Continue", stmt_type, NULL, 0); - if (!Continue_type) return 0; - expr_type = make_type("expr", &AST_type, NULL, 0); - if (!expr_type) return 0; - if (!add_attributes(expr_type, expr_attributes, 2)) return 0; - BoolOp_type = make_type("BoolOp", expr_type, BoolOp_fields, 2); - if (!BoolOp_type) return 0; - BinOp_type = make_type("BinOp", expr_type, BinOp_fields, 3); - if (!BinOp_type) return 0; - UnaryOp_type = make_type("UnaryOp", expr_type, UnaryOp_fields, 2); - if (!UnaryOp_type) return 0; - Lambda_type = make_type("Lambda", expr_type, Lambda_fields, 2); - if (!Lambda_type) return 0; - IfExp_type = make_type("IfExp", expr_type, IfExp_fields, 3); - if (!IfExp_type) return 0; - Dict_type = make_type("Dict", expr_type, Dict_fields, 2); - if (!Dict_type) return 0; - Set_type = make_type("Set", expr_type, Set_fields, 1); - if (!Set_type) return 0; - ListComp_type = make_type("ListComp", expr_type, ListComp_fields, 2); - if (!ListComp_type) return 0; - SetComp_type = make_type("SetComp", expr_type, SetComp_fields, 2); - if (!SetComp_type) return 0; - DictComp_type = make_type("DictComp", expr_type, DictComp_fields, 3); - if (!DictComp_type) return 0; - GeneratorExp_type = make_type("GeneratorExp", expr_type, - GeneratorExp_fields, 2); - if (!GeneratorExp_type) return 0; - Yield_type = make_type("Yield", expr_type, Yield_fields, 1); - if (!Yield_type) return 0; - Compare_type = make_type("Compare", expr_type, Compare_fields, 3); - if (!Compare_type) return 0; - Call_type = make_type("Call", expr_type, Call_fields, 5); - if (!Call_type) return 0; - Repr_type = make_type("Repr", expr_type, Repr_fields, 1); - if (!Repr_type) return 0; - Num_type = make_type("Num", expr_type, Num_fields, 1); - if (!Num_type) return 0; - Str_type = make_type("Str", expr_type, Str_fields, 1); - if (!Str_type) return 0; - Attribute_type = make_type("Attribute", expr_type, Attribute_fields, 3); - if (!Attribute_type) return 0; - Subscript_type = make_type("Subscript", expr_type, Subscript_fields, 3); - if (!Subscript_type) return 0; - Name_type = make_type("Name", expr_type, Name_fields, 2); - if (!Name_type) return 0; - List_type = make_type("List", expr_type, List_fields, 2); - if (!List_type) return 0; - Tuple_type = make_type("Tuple", expr_type, Tuple_fields, 2); - if (!Tuple_type) return 0; - expr_context_type = make_type("expr_context", &AST_type, NULL, 0); - if (!expr_context_type) return 0; - if (!add_attributes(expr_context_type, NULL, 0)) return 0; - Load_type = make_type("Load", expr_context_type, NULL, 0); - if (!Load_type) return 0; - Load_singleton = PyType_GenericNew(Load_type, NULL, NULL); - if (!Load_singleton) return 0; - Store_type = make_type("Store", expr_context_type, NULL, 0); - if (!Store_type) return 0; - Store_singleton = PyType_GenericNew(Store_type, NULL, NULL); - if (!Store_singleton) return 0; - Del_type = make_type("Del", expr_context_type, NULL, 0); - if (!Del_type) return 0; - Del_singleton = PyType_GenericNew(Del_type, NULL, NULL); - if (!Del_singleton) return 0; - AugLoad_type = make_type("AugLoad", expr_context_type, NULL, 0); - if (!AugLoad_type) return 0; - AugLoad_singleton = PyType_GenericNew(AugLoad_type, NULL, NULL); - if (!AugLoad_singleton) return 0; - AugStore_type = make_type("AugStore", expr_context_type, NULL, 0); - if (!AugStore_type) return 0; - AugStore_singleton = PyType_GenericNew(AugStore_type, NULL, NULL); - if (!AugStore_singleton) return 0; - Param_type = make_type("Param", expr_context_type, NULL, 0); - if (!Param_type) return 0; - Param_singleton = PyType_GenericNew(Param_type, NULL, NULL); - if (!Param_singleton) return 0; - slice_type = make_type("slice", &AST_type, NULL, 0); - if (!slice_type) return 0; - if (!add_attributes(slice_type, NULL, 0)) return 0; - Ellipsis_type = make_type("Ellipsis", slice_type, NULL, 0); - if (!Ellipsis_type) return 0; - Slice_type = make_type("Slice", slice_type, Slice_fields, 3); - if (!Slice_type) return 0; - ExtSlice_type = make_type("ExtSlice", slice_type, ExtSlice_fields, 1); - if (!ExtSlice_type) return 0; - Index_type = make_type("Index", slice_type, Index_fields, 1); - if (!Index_type) return 0; - boolop_type = make_type("boolop", &AST_type, NULL, 0); - if (!boolop_type) return 0; - if (!add_attributes(boolop_type, NULL, 0)) return 0; - And_type = make_type("And", boolop_type, NULL, 0); - if (!And_type) return 0; - And_singleton = PyType_GenericNew(And_type, NULL, NULL); - if (!And_singleton) return 0; - Or_type = make_type("Or", boolop_type, NULL, 0); - if (!Or_type) return 0; - Or_singleton = PyType_GenericNew(Or_type, NULL, NULL); - if (!Or_singleton) return 0; - operator_type = make_type("operator", &AST_type, NULL, 0); - if (!operator_type) return 0; - if (!add_attributes(operator_type, NULL, 0)) return 0; - Add_type = make_type("Add", operator_type, NULL, 0); - if (!Add_type) return 0; - Add_singleton = PyType_GenericNew(Add_type, NULL, NULL); - if (!Add_singleton) return 0; - Sub_type = make_type("Sub", operator_type, NULL, 0); - if (!Sub_type) return 0; - Sub_singleton = PyType_GenericNew(Sub_type, NULL, NULL); - if (!Sub_singleton) return 0; - Mult_type = make_type("Mult", operator_type, NULL, 0); - if (!Mult_type) return 0; - Mult_singleton = PyType_GenericNew(Mult_type, NULL, NULL); - if (!Mult_singleton) return 0; - Div_type = make_type("Div", operator_type, NULL, 0); - if (!Div_type) return 0; - Div_singleton = PyType_GenericNew(Div_type, NULL, NULL); - if (!Div_singleton) return 0; - Mod_type = make_type("Mod", operator_type, NULL, 0); - if (!Mod_type) return 0; - Mod_singleton = PyType_GenericNew(Mod_type, NULL, NULL); - if (!Mod_singleton) return 0; - Pow_type = make_type("Pow", operator_type, NULL, 0); - if (!Pow_type) return 0; - Pow_singleton = PyType_GenericNew(Pow_type, NULL, NULL); - if (!Pow_singleton) return 0; - LShift_type = make_type("LShift", operator_type, NULL, 0); - if (!LShift_type) return 0; - LShift_singleton = PyType_GenericNew(LShift_type, NULL, NULL); - if (!LShift_singleton) return 0; - RShift_type = make_type("RShift", operator_type, NULL, 0); - if (!RShift_type) return 0; - RShift_singleton = PyType_GenericNew(RShift_type, NULL, NULL); - if (!RShift_singleton) return 0; - BitOr_type = make_type("BitOr", operator_type, NULL, 0); - if (!BitOr_type) return 0; - BitOr_singleton = PyType_GenericNew(BitOr_type, NULL, NULL); - if (!BitOr_singleton) return 0; - BitXor_type = make_type("BitXor", operator_type, NULL, 0); - if (!BitXor_type) return 0; - BitXor_singleton = PyType_GenericNew(BitXor_type, NULL, NULL); - if (!BitXor_singleton) return 0; - BitAnd_type = make_type("BitAnd", operator_type, NULL, 0); - if (!BitAnd_type) return 0; - BitAnd_singleton = PyType_GenericNew(BitAnd_type, NULL, NULL); - if (!BitAnd_singleton) return 0; - FloorDiv_type = make_type("FloorDiv", operator_type, NULL, 0); - if (!FloorDiv_type) return 0; - FloorDiv_singleton = PyType_GenericNew(FloorDiv_type, NULL, NULL); - if (!FloorDiv_singleton) return 0; - unaryop_type = make_type("unaryop", &AST_type, NULL, 0); - if (!unaryop_type) return 0; - if (!add_attributes(unaryop_type, NULL, 0)) return 0; - Invert_type = make_type("Invert", unaryop_type, NULL, 0); - if (!Invert_type) return 0; - Invert_singleton = PyType_GenericNew(Invert_type, NULL, NULL); - if (!Invert_singleton) return 0; - Not_type = make_type("Not", unaryop_type, NULL, 0); - if (!Not_type) return 0; - Not_singleton = PyType_GenericNew(Not_type, NULL, NULL); - if (!Not_singleton) return 0; - UAdd_type = make_type("UAdd", unaryop_type, NULL, 0); - if (!UAdd_type) return 0; - UAdd_singleton = PyType_GenericNew(UAdd_type, NULL, NULL); - if (!UAdd_singleton) return 0; - USub_type = make_type("USub", unaryop_type, NULL, 0); - if (!USub_type) return 0; - USub_singleton = PyType_GenericNew(USub_type, NULL, NULL); - if (!USub_singleton) return 0; - cmpop_type = make_type("cmpop", &AST_type, NULL, 0); - if (!cmpop_type) return 0; - if (!add_attributes(cmpop_type, NULL, 0)) return 0; - Eq_type = make_type("Eq", cmpop_type, NULL, 0); - if (!Eq_type) return 0; - Eq_singleton = PyType_GenericNew(Eq_type, NULL, NULL); - if (!Eq_singleton) return 0; - NotEq_type = make_type("NotEq", cmpop_type, NULL, 0); - if (!NotEq_type) return 0; - NotEq_singleton = PyType_GenericNew(NotEq_type, NULL, NULL); - if (!NotEq_singleton) return 0; - Lt_type = make_type("Lt", cmpop_type, NULL, 0); - if (!Lt_type) return 0; - Lt_singleton = PyType_GenericNew(Lt_type, NULL, NULL); - if (!Lt_singleton) return 0; - LtE_type = make_type("LtE", cmpop_type, NULL, 0); - if (!LtE_type) return 0; - LtE_singleton = PyType_GenericNew(LtE_type, NULL, NULL); - if (!LtE_singleton) return 0; - Gt_type = make_type("Gt", cmpop_type, NULL, 0); - if (!Gt_type) return 0; - Gt_singleton = PyType_GenericNew(Gt_type, NULL, NULL); - if (!Gt_singleton) return 0; - GtE_type = make_type("GtE", cmpop_type, NULL, 0); - if (!GtE_type) return 0; - GtE_singleton = PyType_GenericNew(GtE_type, NULL, NULL); - if (!GtE_singleton) return 0; - Is_type = make_type("Is", cmpop_type, NULL, 0); - if (!Is_type) return 0; - Is_singleton = PyType_GenericNew(Is_type, NULL, NULL); - if (!Is_singleton) return 0; - IsNot_type = make_type("IsNot", cmpop_type, NULL, 0); - if (!IsNot_type) return 0; - IsNot_singleton = PyType_GenericNew(IsNot_type, NULL, NULL); - if (!IsNot_singleton) return 0; - In_type = make_type("In", cmpop_type, NULL, 0); - if (!In_type) return 0; - In_singleton = PyType_GenericNew(In_type, NULL, NULL); - if (!In_singleton) return 0; - NotIn_type = make_type("NotIn", cmpop_type, NULL, 0); - if (!NotIn_type) return 0; - NotIn_singleton = PyType_GenericNew(NotIn_type, NULL, NULL); - if (!NotIn_singleton) return 0; - comprehension_type = make_type("comprehension", &AST_type, - comprehension_fields, 3); - if (!comprehension_type) return 0; - excepthandler_type = make_type("excepthandler", &AST_type, NULL, 0); - if (!excepthandler_type) return 0; - if (!add_attributes(excepthandler_type, excepthandler_attributes, 2)) - return 0; - ExceptHandler_type = make_type("ExceptHandler", excepthandler_type, - ExceptHandler_fields, 3); - if (!ExceptHandler_type) return 0; - arguments_type = make_type("arguments", &AST_type, arguments_fields, 4); - if (!arguments_type) return 0; - keyword_type = make_type("keyword", &AST_type, keyword_fields, 2); - if (!keyword_type) return 0; - alias_type = make_type("alias", &AST_type, alias_fields, 2); - if (!alias_type) return 0; - initialized = 1; - return 1; -} - -static int obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena); -static int obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena); -static int obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena); -static int obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* - arena); -static int obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena); -static int obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena); -static int obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena); -static int obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena); -static int obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena); -static int obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* - arena); -static int obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* - arena); -static int obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena); -static int obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena); -static int obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena); - -mod_ty -Module(asdl_seq * body, PyArena *arena) -{ - mod_ty p; - p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Module_kind; - p->v.Module.body = body; - return p; -} - -mod_ty -Interactive(asdl_seq * body, PyArena *arena) -{ - mod_ty p; - p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Interactive_kind; - p->v.Interactive.body = body; - return p; -} - -mod_ty -Expression(expr_ty body, PyArena *arena) -{ - mod_ty p; - if (!body) { - PyErr_SetString(PyExc_ValueError, - "field body is required for Expression"); - return NULL; - } - p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Expression_kind; - p->v.Expression.body = body; - return p; -} - -mod_ty -Suite(asdl_seq * body, PyArena *arena) -{ - mod_ty p; - p = (mod_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Suite_kind; - p->v.Suite.body = body; - return p; -} - -stmt_ty -FunctionDef(identifier name, arguments_ty args, asdl_seq * body, asdl_seq * - decorator_list, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - if (!name) { - PyErr_SetString(PyExc_ValueError, - "field name is required for FunctionDef"); - return NULL; - } - if (!args) { - PyErr_SetString(PyExc_ValueError, - "field args is required for FunctionDef"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = FunctionDef_kind; - p->v.FunctionDef.name = name; - p->v.FunctionDef.args = args; - p->v.FunctionDef.body = body; - p->v.FunctionDef.decorator_list = decorator_list; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -ClassDef(identifier name, asdl_seq * bases, asdl_seq * body, asdl_seq * - decorator_list, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - if (!name) { - PyErr_SetString(PyExc_ValueError, - "field name is required for ClassDef"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = ClassDef_kind; - p->v.ClassDef.name = name; - p->v.ClassDef.bases = bases; - p->v.ClassDef.body = body; - p->v.ClassDef.decorator_list = decorator_list; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Return(expr_ty value, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Return_kind; - p->v.Return.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Delete(asdl_seq * targets, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Delete_kind; - p->v.Delete.targets = targets; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Assign(asdl_seq * targets, expr_ty value, int lineno, int col_offset, PyArena - *arena) -{ - stmt_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Assign"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Assign_kind; - p->v.Assign.targets = targets; - p->v.Assign.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -AugAssign(expr_ty target, operator_ty op, expr_ty value, int lineno, int - col_offset, PyArena *arena) -{ - stmt_ty p; - if (!target) { - PyErr_SetString(PyExc_ValueError, - "field target is required for AugAssign"); - return NULL; - } - if (!op) { - PyErr_SetString(PyExc_ValueError, - "field op is required for AugAssign"); - return NULL; - } - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for AugAssign"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = AugAssign_kind; - p->v.AugAssign.target = target; - p->v.AugAssign.op = op; - p->v.AugAssign.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Print(expr_ty dest, asdl_seq * values, bool nl, int lineno, int col_offset, - PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Print_kind; - p->v.Print.dest = dest; - p->v.Print.values = values; - p->v.Print.nl = nl; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -For(expr_ty target, expr_ty iter, asdl_seq * body, asdl_seq * orelse, int - lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - if (!target) { - PyErr_SetString(PyExc_ValueError, - "field target is required for For"); - return NULL; - } - if (!iter) { - PyErr_SetString(PyExc_ValueError, - "field iter is required for For"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = For_kind; - p->v.For.target = target; - p->v.For.iter = iter; - p->v.For.body = body; - p->v.For.orelse = orelse; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -While(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int - col_offset, PyArena *arena) -{ - stmt_ty p; - if (!test) { - PyErr_SetString(PyExc_ValueError, - "field test is required for While"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = While_kind; - p->v.While.test = test; - p->v.While.body = body; - p->v.While.orelse = orelse; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -If(expr_ty test, asdl_seq * body, asdl_seq * orelse, int lineno, int - col_offset, PyArena *arena) -{ - stmt_ty p; - if (!test) { - PyErr_SetString(PyExc_ValueError, - "field test is required for If"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = If_kind; - p->v.If.test = test; - p->v.If.body = body; - p->v.If.orelse = orelse; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -With(expr_ty context_expr, expr_ty optional_vars, asdl_seq * body, int lineno, - int col_offset, PyArena *arena) -{ - stmt_ty p; - if (!context_expr) { - PyErr_SetString(PyExc_ValueError, - "field context_expr is required for With"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = With_kind; - p->v.With.context_expr = context_expr; - p->v.With.optional_vars = optional_vars; - p->v.With.body = body; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Raise(expr_ty type, expr_ty inst, expr_ty tback, int lineno, int col_offset, - PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Raise_kind; - p->v.Raise.type = type; - p->v.Raise.inst = inst; - p->v.Raise.tback = tback; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -TryExcept(asdl_seq * body, asdl_seq * handlers, asdl_seq * orelse, int lineno, - int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = TryExcept_kind; - p->v.TryExcept.body = body; - p->v.TryExcept.handlers = handlers; - p->v.TryExcept.orelse = orelse; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -TryFinally(asdl_seq * body, asdl_seq * finalbody, int lineno, int col_offset, - PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = TryFinally_kind; - p->v.TryFinally.body = body; - p->v.TryFinally.finalbody = finalbody; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Assert(expr_ty test, expr_ty msg, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - if (!test) { - PyErr_SetString(PyExc_ValueError, - "field test is required for Assert"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Assert_kind; - p->v.Assert.test = test; - p->v.Assert.msg = msg; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Import(asdl_seq * names, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Import_kind; - p->v.Import.names = names; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -ImportFrom(identifier module, asdl_seq * names, int level, int lineno, int - col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = ImportFrom_kind; - p->v.ImportFrom.module = module; - p->v.ImportFrom.names = names; - p->v.ImportFrom.level = level; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Exec(expr_ty body, expr_ty globals, expr_ty locals, int lineno, int col_offset, - PyArena *arena) -{ - stmt_ty p; - if (!body) { - PyErr_SetString(PyExc_ValueError, - "field body is required for Exec"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Exec_kind; - p->v.Exec.body = body; - p->v.Exec.globals = globals; - p->v.Exec.locals = locals; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Global(asdl_seq * names, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Global_kind; - p->v.Global.names = names; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Expr(expr_ty value, int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Expr"); - return NULL; - } - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Expr_kind; - p->v.Expr.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Pass(int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Pass_kind; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Break(int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Break_kind; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -stmt_ty -Continue(int lineno, int col_offset, PyArena *arena) -{ - stmt_ty p; - p = (stmt_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Continue_kind; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -BoolOp(boolop_ty op, asdl_seq * values, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!op) { - PyErr_SetString(PyExc_ValueError, - "field op is required for BoolOp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = BoolOp_kind; - p->v.BoolOp.op = op; - p->v.BoolOp.values = values; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -BinOp(expr_ty left, operator_ty op, expr_ty right, int lineno, int col_offset, - PyArena *arena) -{ - expr_ty p; - if (!left) { - PyErr_SetString(PyExc_ValueError, - "field left is required for BinOp"); - return NULL; - } - if (!op) { - PyErr_SetString(PyExc_ValueError, - "field op is required for BinOp"); - return NULL; - } - if (!right) { - PyErr_SetString(PyExc_ValueError, - "field right is required for BinOp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = BinOp_kind; - p->v.BinOp.left = left; - p->v.BinOp.op = op; - p->v.BinOp.right = right; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -UnaryOp(unaryop_ty op, expr_ty operand, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!op) { - PyErr_SetString(PyExc_ValueError, - "field op is required for UnaryOp"); - return NULL; - } - if (!operand) { - PyErr_SetString(PyExc_ValueError, - "field operand is required for UnaryOp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = UnaryOp_kind; - p->v.UnaryOp.op = op; - p->v.UnaryOp.operand = operand; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Lambda(arguments_ty args, expr_ty body, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!args) { - PyErr_SetString(PyExc_ValueError, - "field args is required for Lambda"); - return NULL; - } - if (!body) { - PyErr_SetString(PyExc_ValueError, - "field body is required for Lambda"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Lambda_kind; - p->v.Lambda.args = args; - p->v.Lambda.body = body; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -IfExp(expr_ty test, expr_ty body, expr_ty orelse, int lineno, int col_offset, - PyArena *arena) -{ - expr_ty p; - if (!test) { - PyErr_SetString(PyExc_ValueError, - "field test is required for IfExp"); - return NULL; - } - if (!body) { - PyErr_SetString(PyExc_ValueError, - "field body is required for IfExp"); - return NULL; - } - if (!orelse) { - PyErr_SetString(PyExc_ValueError, - "field orelse is required for IfExp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = IfExp_kind; - p->v.IfExp.test = test; - p->v.IfExp.body = body; - p->v.IfExp.orelse = orelse; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Dict(asdl_seq * keys, asdl_seq * values, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Dict_kind; - p->v.Dict.keys = keys; - p->v.Dict.values = values; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Set(asdl_seq * elts, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Set_kind; - p->v.Set.elts = elts; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -ListComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, - PyArena *arena) -{ - expr_ty p; - if (!elt) { - PyErr_SetString(PyExc_ValueError, - "field elt is required for ListComp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = ListComp_kind; - p->v.ListComp.elt = elt; - p->v.ListComp.generators = generators; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -SetComp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!elt) { - PyErr_SetString(PyExc_ValueError, - "field elt is required for SetComp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = SetComp_kind; - p->v.SetComp.elt = elt; - p->v.SetComp.generators = generators; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -DictComp(expr_ty key, expr_ty value, asdl_seq * generators, int lineno, int - col_offset, PyArena *arena) -{ - expr_ty p; - if (!key) { - PyErr_SetString(PyExc_ValueError, - "field key is required for DictComp"); - return NULL; - } - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for DictComp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = DictComp_kind; - p->v.DictComp.key = key; - p->v.DictComp.value = value; - p->v.DictComp.generators = generators; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -GeneratorExp(expr_ty elt, asdl_seq * generators, int lineno, int col_offset, - PyArena *arena) -{ - expr_ty p; - if (!elt) { - PyErr_SetString(PyExc_ValueError, - "field elt is required for GeneratorExp"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = GeneratorExp_kind; - p->v.GeneratorExp.elt = elt; - p->v.GeneratorExp.generators = generators; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Yield(expr_ty value, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Yield_kind; - p->v.Yield.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Compare(expr_ty left, asdl_int_seq * ops, asdl_seq * comparators, int lineno, - int col_offset, PyArena *arena) -{ - expr_ty p; - if (!left) { - PyErr_SetString(PyExc_ValueError, - "field left is required for Compare"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Compare_kind; - p->v.Compare.left = left; - p->v.Compare.ops = ops; - p->v.Compare.comparators = comparators; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Call(expr_ty func, asdl_seq * args, asdl_seq * keywords, expr_ty starargs, - expr_ty kwargs, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - if (!func) { - PyErr_SetString(PyExc_ValueError, - "field func is required for Call"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Call_kind; - p->v.Call.func = func; - p->v.Call.args = args; - p->v.Call.keywords = keywords; - p->v.Call.starargs = starargs; - p->v.Call.kwargs = kwargs; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Repr(expr_ty value, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Repr"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Repr_kind; - p->v.Repr.value = value; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Num(object n, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - if (!n) { - PyErr_SetString(PyExc_ValueError, - "field n is required for Num"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Num_kind; - p->v.Num.n = n; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Str(string s, int lineno, int col_offset, PyArena *arena) -{ - expr_ty p; - if (!s) { - PyErr_SetString(PyExc_ValueError, - "field s is required for Str"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Str_kind; - p->v.Str.s = s; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Attribute(expr_ty value, identifier attr, expr_context_ty ctx, int lineno, int - col_offset, PyArena *arena) -{ - expr_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Attribute"); - return NULL; - } - if (!attr) { - PyErr_SetString(PyExc_ValueError, - "field attr is required for Attribute"); - return NULL; - } - if (!ctx) { - PyErr_SetString(PyExc_ValueError, - "field ctx is required for Attribute"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Attribute_kind; - p->v.Attribute.value = value; - p->v.Attribute.attr = attr; - p->v.Attribute.ctx = ctx; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Subscript(expr_ty value, slice_ty slice, expr_context_ty ctx, int lineno, int - col_offset, PyArena *arena) -{ - expr_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Subscript"); - return NULL; - } - if (!slice) { - PyErr_SetString(PyExc_ValueError, - "field slice is required for Subscript"); - return NULL; - } - if (!ctx) { - PyErr_SetString(PyExc_ValueError, - "field ctx is required for Subscript"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Subscript_kind; - p->v.Subscript.value = value; - p->v.Subscript.slice = slice; - p->v.Subscript.ctx = ctx; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Name(identifier id, expr_context_ty ctx, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!id) { - PyErr_SetString(PyExc_ValueError, - "field id is required for Name"); - return NULL; - } - if (!ctx) { - PyErr_SetString(PyExc_ValueError, - "field ctx is required for Name"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Name_kind; - p->v.Name.id = id; - p->v.Name.ctx = ctx; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -List(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!ctx) { - PyErr_SetString(PyExc_ValueError, - "field ctx is required for List"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = List_kind; - p->v.List.elts = elts; - p->v.List.ctx = ctx; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -expr_ty -Tuple(asdl_seq * elts, expr_context_ty ctx, int lineno, int col_offset, PyArena - *arena) -{ - expr_ty p; - if (!ctx) { - PyErr_SetString(PyExc_ValueError, - "field ctx is required for Tuple"); - return NULL; - } - p = (expr_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Tuple_kind; - p->v.Tuple.elts = elts; - p->v.Tuple.ctx = ctx; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -slice_ty -Ellipsis(PyArena *arena) -{ - slice_ty p; - p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Ellipsis_kind; - return p; -} - -slice_ty -Slice(expr_ty lower, expr_ty upper, expr_ty step, PyArena *arena) -{ - slice_ty p; - p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Slice_kind; - p->v.Slice.lower = lower; - p->v.Slice.upper = upper; - p->v.Slice.step = step; - return p; -} - -slice_ty -ExtSlice(asdl_seq * dims, PyArena *arena) -{ - slice_ty p; - p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = ExtSlice_kind; - p->v.ExtSlice.dims = dims; - return p; -} - -slice_ty -Index(expr_ty value, PyArena *arena) -{ - slice_ty p; - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for Index"); - return NULL; - } - p = (slice_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = Index_kind; - p->v.Index.value = value; - return p; -} - -comprehension_ty -comprehension(expr_ty target, expr_ty iter, asdl_seq * ifs, PyArena *arena) -{ - comprehension_ty p; - if (!target) { - PyErr_SetString(PyExc_ValueError, - "field target is required for comprehension"); - return NULL; - } - if (!iter) { - PyErr_SetString(PyExc_ValueError, - "field iter is required for comprehension"); - return NULL; - } - p = (comprehension_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->target = target; - p->iter = iter; - p->ifs = ifs; - return p; -} - -excepthandler_ty -ExceptHandler(expr_ty type, expr_ty name, asdl_seq * body, int lineno, int - col_offset, PyArena *arena) -{ - excepthandler_ty p; - p = (excepthandler_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->kind = ExceptHandler_kind; - p->v.ExceptHandler.type = type; - p->v.ExceptHandler.name = name; - p->v.ExceptHandler.body = body; - p->lineno = lineno; - p->col_offset = col_offset; - return p; -} - -arguments_ty -arguments(asdl_seq * args, identifier vararg, identifier kwarg, asdl_seq * - defaults, PyArena *arena) -{ - arguments_ty p; - p = (arguments_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->args = args; - p->vararg = vararg; - p->kwarg = kwarg; - p->defaults = defaults; - return p; -} - -keyword_ty -keyword(identifier arg, expr_ty value, PyArena *arena) -{ - keyword_ty p; - if (!arg) { - PyErr_SetString(PyExc_ValueError, - "field arg is required for keyword"); - return NULL; - } - if (!value) { - PyErr_SetString(PyExc_ValueError, - "field value is required for keyword"); - return NULL; - } - p = (keyword_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->arg = arg; - p->value = value; - return p; -} - -alias_ty -alias(identifier name, identifier asname, PyArena *arena) -{ - alias_ty p; - if (!name) { - PyErr_SetString(PyExc_ValueError, - "field name is required for alias"); - return NULL; - } - p = (alias_ty)PyArena_Malloc(arena, sizeof(*p)); - if (!p) - return NULL; - p->name = name; - p->asname = asname; - return p; -} - - -PyObject* -ast2obj_mod(void* _o) -{ - mod_ty o = (mod_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - switch (o->kind) { - case Module_kind: - result = PyType_GenericNew(Module_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Module.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Interactive_kind: - result = PyType_GenericNew(Interactive_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Interactive.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Expression_kind: - result = PyType_GenericNew(Expression_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Expression.body); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Suite_kind: - result = PyType_GenericNew(Suite_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Suite.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - } - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* -ast2obj_stmt(void* _o) -{ - stmt_ty o = (stmt_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - switch (o->kind) { - case FunctionDef_kind: - result = PyType_GenericNew(FunctionDef_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_identifier(o->v.FunctionDef.name); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "name", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_arguments(o->v.FunctionDef.args); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "args", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.FunctionDef.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.FunctionDef.decorator_list, - ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "decorator_list", value) == - -1) - goto failed; - Py_DECREF(value); - break; - case ClassDef_kind: - result = PyType_GenericNew(ClassDef_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_identifier(o->v.ClassDef.name); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "name", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.ClassDef.bases, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "bases", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.ClassDef.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.ClassDef.decorator_list, - ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "decorator_list", value) == - -1) - goto failed; - Py_DECREF(value); - break; - case Return_kind: - result = PyType_GenericNew(Return_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Return.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Delete_kind: - result = PyType_GenericNew(Delete_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Delete.targets, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "targets", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Assign_kind: - result = PyType_GenericNew(Assign_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Assign.targets, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "targets", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Assign.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - case AugAssign_kind: - result = PyType_GenericNew(AugAssign_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.AugAssign.target); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "target", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_operator(o->v.AugAssign.op); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "op", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.AugAssign.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Print_kind: - result = PyType_GenericNew(Print_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Print.dest); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "dest", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.Print.values, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "values", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_bool(o->v.Print.nl); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "nl", value) == -1) - goto failed; - Py_DECREF(value); - break; - case For_kind: - result = PyType_GenericNew(For_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.For.target); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "target", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.For.iter); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "iter", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.For.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.For.orelse, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "orelse", value) == -1) - goto failed; - Py_DECREF(value); - break; - case While_kind: - result = PyType_GenericNew(While_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.While.test); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "test", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.While.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.While.orelse, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "orelse", value) == -1) - goto failed; - Py_DECREF(value); - break; - case If_kind: - result = PyType_GenericNew(If_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.If.test); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "test", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.If.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.If.orelse, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "orelse", value) == -1) - goto failed; - Py_DECREF(value); - break; - case With_kind: - result = PyType_GenericNew(With_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.With.context_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "context_expr", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.With.optional_vars); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "optional_vars", value) == - -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.With.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Raise_kind: - result = PyType_GenericNew(Raise_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Raise.type); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "type", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Raise.inst); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "inst", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Raise.tback); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "tback", value) == -1) - goto failed; - Py_DECREF(value); - break; - case TryExcept_kind: - result = PyType_GenericNew(TryExcept_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.TryExcept.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.TryExcept.handlers, - ast2obj_excepthandler); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "handlers", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.TryExcept.orelse, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "orelse", value) == -1) - goto failed; - Py_DECREF(value); - break; - case TryFinally_kind: - result = PyType_GenericNew(TryFinally_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.TryFinally.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.TryFinally.finalbody, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "finalbody", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Assert_kind: - result = PyType_GenericNew(Assert_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Assert.test); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "test", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Assert.msg); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "msg", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Import_kind: - result = PyType_GenericNew(Import_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Import.names, ast2obj_alias); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "names", value) == -1) - goto failed; - Py_DECREF(value); - break; - case ImportFrom_kind: - result = PyType_GenericNew(ImportFrom_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_identifier(o->v.ImportFrom.module); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "module", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.ImportFrom.names, ast2obj_alias); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "names", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_int(o->v.ImportFrom.level); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "level", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Exec_kind: - result = PyType_GenericNew(Exec_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Exec.body); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Exec.globals); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "globals", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Exec.locals); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "locals", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Global_kind: - result = PyType_GenericNew(Global_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Global.names, ast2obj_identifier); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "names", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Expr_kind: - result = PyType_GenericNew(Expr_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Expr.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Pass_kind: - result = PyType_GenericNew(Pass_type, NULL, NULL); - if (!result) goto failed; - break; - case Break_kind: - result = PyType_GenericNew(Break_type, NULL, NULL); - if (!result) goto failed; - break; - case Continue_kind: - result = PyType_GenericNew(Continue_type, NULL, NULL); - if (!result) goto failed; - break; - } - value = ast2obj_int(o->lineno); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "lineno", value) < 0) - goto failed; - Py_DECREF(value); - value = ast2obj_int(o->col_offset); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "col_offset", value) < 0) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* -ast2obj_expr(void* _o) -{ - expr_ty o = (expr_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - switch (o->kind) { - case BoolOp_kind: - result = PyType_GenericNew(BoolOp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_boolop(o->v.BoolOp.op); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "op", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.BoolOp.values, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "values", value) == -1) - goto failed; - Py_DECREF(value); - break; - case BinOp_kind: - result = PyType_GenericNew(BinOp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.BinOp.left); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "left", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_operator(o->v.BinOp.op); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "op", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.BinOp.right); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "right", value) == -1) - goto failed; - Py_DECREF(value); - break; - case UnaryOp_kind: - result = PyType_GenericNew(UnaryOp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_unaryop(o->v.UnaryOp.op); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "op", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.UnaryOp.operand); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "operand", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Lambda_kind: - result = PyType_GenericNew(Lambda_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_arguments(o->v.Lambda.args); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "args", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Lambda.body); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - case IfExp_kind: - result = PyType_GenericNew(IfExp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.IfExp.test); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "test", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.IfExp.body); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.IfExp.orelse); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "orelse", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Dict_kind: - result = PyType_GenericNew(Dict_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Dict.keys, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "keys", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.Dict.values, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "values", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Set_kind: - result = PyType_GenericNew(Set_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Set.elts, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "elts", value) == -1) - goto failed; - Py_DECREF(value); - break; - case ListComp_kind: - result = PyType_GenericNew(ListComp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.ListComp.elt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "elt", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.ListComp.generators, - ast2obj_comprehension); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "generators", value) == -1) - goto failed; - Py_DECREF(value); - break; - case SetComp_kind: - result = PyType_GenericNew(SetComp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.SetComp.elt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "elt", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.SetComp.generators, - ast2obj_comprehension); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "generators", value) == -1) - goto failed; - Py_DECREF(value); - break; - case DictComp_kind: - result = PyType_GenericNew(DictComp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.DictComp.key); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "key", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.DictComp.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.DictComp.generators, - ast2obj_comprehension); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "generators", value) == -1) - goto failed; - Py_DECREF(value); - break; - case GeneratorExp_kind: - result = PyType_GenericNew(GeneratorExp_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.GeneratorExp.elt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "elt", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.GeneratorExp.generators, - ast2obj_comprehension); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "generators", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Yield_kind: - result = PyType_GenericNew(Yield_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Yield.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Compare_kind: - result = PyType_GenericNew(Compare_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Compare.left); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "left", value) == -1) - goto failed; - Py_DECREF(value); - { - int i, n = asdl_seq_LEN(o->v.Compare.ops); - value = PyList_New(n); - if (!value) goto failed; - for(i = 0; i < n; i++) - PyList_SET_ITEM(value, i, ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i))); - } - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ops", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.Compare.comparators, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "comparators", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Call_kind: - result = PyType_GenericNew(Call_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Call.func); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "func", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.Call.args, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "args", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.Call.keywords, ast2obj_keyword); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "keywords", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Call.starargs); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "starargs", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Call.kwargs); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "kwargs", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Repr_kind: - result = PyType_GenericNew(Repr_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Repr.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Num_kind: - result = PyType_GenericNew(Num_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_object(o->v.Num.n); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "n", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Str_kind: - result = PyType_GenericNew(Str_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_string(o->v.Str.s); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "s", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Attribute_kind: - result = PyType_GenericNew(Attribute_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Attribute.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_identifier(o->v.Attribute.attr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "attr", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr_context(o->v.Attribute.ctx); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ctx", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Subscript_kind: - result = PyType_GenericNew(Subscript_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Subscript.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_slice(o->v.Subscript.slice); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "slice", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr_context(o->v.Subscript.ctx); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ctx", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Name_kind: - result = PyType_GenericNew(Name_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_identifier(o->v.Name.id); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "id", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr_context(o->v.Name.ctx); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ctx", value) == -1) - goto failed; - Py_DECREF(value); - break; - case List_kind: - result = PyType_GenericNew(List_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.List.elts, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "elts", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr_context(o->v.List.ctx); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ctx", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Tuple_kind: - result = PyType_GenericNew(Tuple_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.Tuple.elts, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "elts", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr_context(o->v.Tuple.ctx); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ctx", value) == -1) - goto failed; - Py_DECREF(value); - break; - } - value = ast2obj_int(o->lineno); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "lineno", value) < 0) - goto failed; - Py_DECREF(value); - value = ast2obj_int(o->col_offset); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "col_offset", value) < 0) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* ast2obj_expr_context(expr_context_ty o) -{ - switch(o) { - case Load: - Py_INCREF(Load_singleton); - return Load_singleton; - case Store: - Py_INCREF(Store_singleton); - return Store_singleton; - case Del: - Py_INCREF(Del_singleton); - return Del_singleton; - case AugLoad: - Py_INCREF(AugLoad_singleton); - return AugLoad_singleton; - case AugStore: - Py_INCREF(AugStore_singleton); - return AugStore_singleton; - case Param: - Py_INCREF(Param_singleton); - return Param_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown expr_context found"); - return NULL; - } -} -PyObject* -ast2obj_slice(void* _o) -{ - slice_ty o = (slice_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - switch (o->kind) { - case Ellipsis_kind: - result = PyType_GenericNew(Ellipsis_type, NULL, NULL); - if (!result) goto failed; - break; - case Slice_kind: - result = PyType_GenericNew(Slice_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Slice.lower); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "lower", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Slice.upper); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "upper", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.Slice.step); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "step", value) == -1) - goto failed; - Py_DECREF(value); - break; - case ExtSlice_kind: - result = PyType_GenericNew(ExtSlice_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_list(o->v.ExtSlice.dims, ast2obj_slice); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "dims", value) == -1) - goto failed; - Py_DECREF(value); - break; - case Index_kind: - result = PyType_GenericNew(Index_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.Index.value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - break; - } - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* ast2obj_boolop(boolop_ty o) -{ - switch(o) { - case And: - Py_INCREF(And_singleton); - return And_singleton; - case Or: - Py_INCREF(Or_singleton); - return Or_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown boolop found"); - return NULL; - } -} -PyObject* ast2obj_operator(operator_ty o) -{ - switch(o) { - case Add: - Py_INCREF(Add_singleton); - return Add_singleton; - case Sub: - Py_INCREF(Sub_singleton); - return Sub_singleton; - case Mult: - Py_INCREF(Mult_singleton); - return Mult_singleton; - case Div: - Py_INCREF(Div_singleton); - return Div_singleton; - case Mod: - Py_INCREF(Mod_singleton); - return Mod_singleton; - case Pow: - Py_INCREF(Pow_singleton); - return Pow_singleton; - case LShift: - Py_INCREF(LShift_singleton); - return LShift_singleton; - case RShift: - Py_INCREF(RShift_singleton); - return RShift_singleton; - case BitOr: - Py_INCREF(BitOr_singleton); - return BitOr_singleton; - case BitXor: - Py_INCREF(BitXor_singleton); - return BitXor_singleton; - case BitAnd: - Py_INCREF(BitAnd_singleton); - return BitAnd_singleton; - case FloorDiv: - Py_INCREF(FloorDiv_singleton); - return FloorDiv_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown operator found"); - return NULL; - } -} -PyObject* ast2obj_unaryop(unaryop_ty o) -{ - switch(o) { - case Invert: - Py_INCREF(Invert_singleton); - return Invert_singleton; - case Not: - Py_INCREF(Not_singleton); - return Not_singleton; - case UAdd: - Py_INCREF(UAdd_singleton); - return UAdd_singleton; - case USub: - Py_INCREF(USub_singleton); - return USub_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown unaryop found"); - return NULL; - } -} -PyObject* ast2obj_cmpop(cmpop_ty o) -{ - switch(o) { - case Eq: - Py_INCREF(Eq_singleton); - return Eq_singleton; - case NotEq: - Py_INCREF(NotEq_singleton); - return NotEq_singleton; - case Lt: - Py_INCREF(Lt_singleton); - return Lt_singleton; - case LtE: - Py_INCREF(LtE_singleton); - return LtE_singleton; - case Gt: - Py_INCREF(Gt_singleton); - return Gt_singleton; - case GtE: - Py_INCREF(GtE_singleton); - return GtE_singleton; - case Is: - Py_INCREF(Is_singleton); - return Is_singleton; - case IsNot: - Py_INCREF(IsNot_singleton); - return IsNot_singleton; - case In: - Py_INCREF(In_singleton); - return In_singleton; - case NotIn: - Py_INCREF(NotIn_singleton); - return NotIn_singleton; - default: - /* should never happen, but just in case ... */ - PyErr_Format(PyExc_SystemError, "unknown cmpop found"); - return NULL; - } -} -PyObject* -ast2obj_comprehension(void* _o) -{ - comprehension_ty o = (comprehension_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - result = PyType_GenericNew(comprehension_type, NULL, NULL); - if (!result) return NULL; - value = ast2obj_expr(o->target); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "target", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->iter); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "iter", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->ifs, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "ifs", value) == -1) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* -ast2obj_excepthandler(void* _o) -{ - excepthandler_ty o = (excepthandler_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - switch (o->kind) { - case ExceptHandler_kind: - result = PyType_GenericNew(ExceptHandler_type, NULL, NULL); - if (!result) goto failed; - value = ast2obj_expr(o->v.ExceptHandler.type); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "type", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->v.ExceptHandler.name); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "name", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->v.ExceptHandler.body, ast2obj_stmt); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "body", value) == -1) - goto failed; - Py_DECREF(value); - break; - } - value = ast2obj_int(o->lineno); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "lineno", value) < 0) - goto failed; - Py_DECREF(value); - value = ast2obj_int(o->col_offset); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "col_offset", value) < 0) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* -ast2obj_arguments(void* _o) -{ - arguments_ty o = (arguments_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - result = PyType_GenericNew(arguments_type, NULL, NULL); - if (!result) return NULL; - value = ast2obj_list(o->args, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "args", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_identifier(o->vararg); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "vararg", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_identifier(o->kwarg); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "kwarg", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_list(o->defaults, ast2obj_expr); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "defaults", value) == -1) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* -ast2obj_keyword(void* _o) -{ - keyword_ty o = (keyword_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - result = PyType_GenericNew(keyword_type, NULL, NULL); - if (!result) return NULL; - value = ast2obj_identifier(o->arg); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "arg", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_expr(o->value); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "value", value) == -1) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - -PyObject* -ast2obj_alias(void* _o) -{ - alias_ty o = (alias_ty)_o; - PyObject *result = NULL, *value = NULL; - if (!o) { - Py_INCREF(Py_None); - return Py_None; - } - - result = PyType_GenericNew(alias_type, NULL, NULL); - if (!result) return NULL; - value = ast2obj_identifier(o->name); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "name", value) == -1) - goto failed; - Py_DECREF(value); - value = ast2obj_identifier(o->asname); - if (!value) goto failed; - if (PyObject_SetAttrString(result, "asname", value) == -1) - goto failed; - Py_DECREF(value); - return result; -failed: - Py_XDECREF(value); - Py_XDECREF(result); - return NULL; -} - - -int -obj2ast_mod(PyObject* obj, mod_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - - if (obj == Py_None) { - *out = NULL; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Module_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* body; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Module field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Module"); - return 1; - } - *out = Module(body, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Interactive_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* body; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Interactive field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Interactive"); - return 1; - } - *out = Interactive(body, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Expression_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty body; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &body, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Expression"); - return 1; - } - *out = Expression(body, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Suite_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* body; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Suite field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Suite"); - return 1; - } - *out = Suite(body, arena); - if (*out == NULL) goto failed; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of mod, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_stmt(PyObject* obj, stmt_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - int lineno; - int col_offset; - - if (obj == Py_None) { - *out = NULL; - return 0; - } - if (PyObject_HasAttrString(obj, "lineno")) { - int res; - tmp = PyObject_GetAttrString(obj, "lineno"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &lineno, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from stmt"); - return 1; - } - if (PyObject_HasAttrString(obj, "col_offset")) { - int res; - tmp = PyObject_GetAttrString(obj, "col_offset"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &col_offset, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from stmt"); - return 1; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)FunctionDef_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - identifier name; - arguments_ty args; - asdl_seq* body; - asdl_seq* decorator_list; - - if (PyObject_HasAttrString(obj, "name")) { - int res; - tmp = PyObject_GetAttrString(obj, "name"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &name, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from FunctionDef"); - return 1; - } - if (PyObject_HasAttrString(obj, "args")) { - int res; - tmp = PyObject_GetAttrString(obj, "args"); - if (tmp == NULL) goto failed; - res = obj2ast_arguments(tmp, &args, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from FunctionDef"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "FunctionDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from FunctionDef"); - return 1; - } - if (PyObject_HasAttrString(obj, "decorator_list")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "decorator_list"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "FunctionDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - decorator_list = asdl_seq_new(len, arena); - if (decorator_list == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(decorator_list, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from FunctionDef"); - return 1; - } - *out = FunctionDef(name, args, body, decorator_list, lineno, - col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)ClassDef_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - identifier name; - asdl_seq* bases; - asdl_seq* body; - asdl_seq* decorator_list; - - if (PyObject_HasAttrString(obj, "name")) { - int res; - tmp = PyObject_GetAttrString(obj, "name"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &name, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from ClassDef"); - return 1; - } - if (PyObject_HasAttrString(obj, "bases")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "bases"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ClassDef field \"bases\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - bases = asdl_seq_new(len, arena); - if (bases == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(bases, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"bases\" missing from ClassDef"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ClassDef field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ClassDef"); - return 1; - } - if (PyObject_HasAttrString(obj, "decorator_list")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "decorator_list"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ClassDef field \"decorator_list\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - decorator_list = asdl_seq_new(len, arena); - if (decorator_list == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(decorator_list, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"decorator_list\" missing from ClassDef"); - return 1; - } - *out = ClassDef(name, bases, body, decorator_list, lineno, - col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Return_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - value = NULL; - } - *out = Return(value, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Delete_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* targets; - - if (PyObject_HasAttrString(obj, "targets")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "targets"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Delete field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - targets = asdl_seq_new(len, arena); - if (targets == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(targets, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Delete"); - return 1; - } - *out = Delete(targets, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Assign_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* targets; - expr_ty value; - - if (PyObject_HasAttrString(obj, "targets")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "targets"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Assign field \"targets\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - targets = asdl_seq_new(len, arena); - if (targets == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(targets, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"targets\" missing from Assign"); - return 1; - } - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Assign"); - return 1; - } - *out = Assign(targets, value, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)AugAssign_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty target; - operator_ty op; - expr_ty value; - - if (PyObject_HasAttrString(obj, "target")) { - int res; - tmp = PyObject_GetAttrString(obj, "target"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &target, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from AugAssign"); - return 1; - } - if (PyObject_HasAttrString(obj, "op")) { - int res; - tmp = PyObject_GetAttrString(obj, "op"); - if (tmp == NULL) goto failed; - res = obj2ast_operator(tmp, &op, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from AugAssign"); - return 1; - } - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from AugAssign"); - return 1; - } - *out = AugAssign(target, op, value, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Print_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty dest; - asdl_seq* values; - bool nl; - - if (PyObject_HasAttrString(obj, "dest")) { - int res; - tmp = PyObject_GetAttrString(obj, "dest"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &dest, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - dest = NULL; - } - if (PyObject_HasAttrString(obj, "values")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "values"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Print field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - values = asdl_seq_new(len, arena); - if (values == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(values, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from Print"); - return 1; - } - if (PyObject_HasAttrString(obj, "nl")) { - int res; - tmp = PyObject_GetAttrString(obj, "nl"); - if (tmp == NULL) goto failed; - res = obj2ast_bool(tmp, &nl, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"nl\" missing from Print"); - return 1; - } - *out = Print(dest, values, nl, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)For_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty target; - expr_ty iter; - asdl_seq* body; - asdl_seq* orelse; - - if (PyObject_HasAttrString(obj, "target")) { - int res; - tmp = PyObject_GetAttrString(obj, "target"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &target, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from For"); - return 1; - } - if (PyObject_HasAttrString(obj, "iter")) { - int res; - tmp = PyObject_GetAttrString(obj, "iter"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &iter, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from For"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "For field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from For"); - return 1; - } - if (PyObject_HasAttrString(obj, "orelse")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "orelse"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "For field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - orelse = asdl_seq_new(len, arena); - if (orelse == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(orelse, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from For"); - return 1; - } - *out = For(target, iter, body, orelse, lineno, col_offset, - arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)While_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty test; - asdl_seq* body; - asdl_seq* orelse; - - if (PyObject_HasAttrString(obj, "test")) { - int res; - tmp = PyObject_GetAttrString(obj, "test"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &test, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from While"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "While field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from While"); - return 1; - } - if (PyObject_HasAttrString(obj, "orelse")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "orelse"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "While field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - orelse = asdl_seq_new(len, arena); - if (orelse == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(orelse, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from While"); - return 1; - } - *out = While(test, body, orelse, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)If_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty test; - asdl_seq* body; - asdl_seq* orelse; - - if (PyObject_HasAttrString(obj, "test")) { - int res; - tmp = PyObject_GetAttrString(obj, "test"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &test, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from If"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "If field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from If"); - return 1; - } - if (PyObject_HasAttrString(obj, "orelse")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "orelse"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "If field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - orelse = asdl_seq_new(len, arena); - if (orelse == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(orelse, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from If"); - return 1; - } - *out = If(test, body, orelse, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)With_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty context_expr; - expr_ty optional_vars; - asdl_seq* body; - - if (PyObject_HasAttrString(obj, "context_expr")) { - int res; - tmp = PyObject_GetAttrString(obj, "context_expr"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &context_expr, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"context_expr\" missing from With"); - return 1; - } - if (PyObject_HasAttrString(obj, "optional_vars")) { - int res; - tmp = PyObject_GetAttrString(obj, "optional_vars"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &optional_vars, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - optional_vars = NULL; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "With field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from With"); - return 1; - } - *out = With(context_expr, optional_vars, body, lineno, - col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Raise_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty type; - expr_ty inst; - expr_ty tback; - - if (PyObject_HasAttrString(obj, "type")) { - int res; - tmp = PyObject_GetAttrString(obj, "type"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &type, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - type = NULL; - } - if (PyObject_HasAttrString(obj, "inst")) { - int res; - tmp = PyObject_GetAttrString(obj, "inst"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &inst, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - inst = NULL; - } - if (PyObject_HasAttrString(obj, "tback")) { - int res; - tmp = PyObject_GetAttrString(obj, "tback"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &tback, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - tback = NULL; - } - *out = Raise(type, inst, tback, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)TryExcept_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* body; - asdl_seq* handlers; - asdl_seq* orelse; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "TryExcept field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryExcept"); - return 1; - } - if (PyObject_HasAttrString(obj, "handlers")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "handlers"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "TryExcept field \"handlers\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - handlers = asdl_seq_new(len, arena); - if (handlers == NULL) goto failed; - for (i = 0; i < len; i++) { - excepthandler_ty value; - res = obj2ast_excepthandler(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(handlers, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"handlers\" missing from TryExcept"); - return 1; - } - if (PyObject_HasAttrString(obj, "orelse")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "orelse"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "TryExcept field \"orelse\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - orelse = asdl_seq_new(len, arena); - if (orelse == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(orelse, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from TryExcept"); - return 1; - } - *out = TryExcept(body, handlers, orelse, lineno, col_offset, - arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)TryFinally_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* body; - asdl_seq* finalbody; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "TryFinally field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from TryFinally"); - return 1; - } - if (PyObject_HasAttrString(obj, "finalbody")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "finalbody"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "TryFinally field \"finalbody\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - finalbody = asdl_seq_new(len, arena); - if (finalbody == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(finalbody, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"finalbody\" missing from TryFinally"); - return 1; - } - *out = TryFinally(body, finalbody, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Assert_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty test; - expr_ty msg; - - if (PyObject_HasAttrString(obj, "test")) { - int res; - tmp = PyObject_GetAttrString(obj, "test"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &test, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from Assert"); - return 1; - } - if (PyObject_HasAttrString(obj, "msg")) { - int res; - tmp = PyObject_GetAttrString(obj, "msg"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &msg, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - msg = NULL; - } - *out = Assert(test, msg, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Import_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* names; - - if (PyObject_HasAttrString(obj, "names")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "names"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Import field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - names = asdl_seq_new(len, arena); - if (names == NULL) goto failed; - for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(names, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Import"); - return 1; - } - *out = Import(names, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)ImportFrom_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - identifier module; - asdl_seq* names; - int level; - - if (PyObject_HasAttrString(obj, "module")) { - int res; - tmp = PyObject_GetAttrString(obj, "module"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &module, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - module = NULL; - } - if (PyObject_HasAttrString(obj, "names")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "names"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ImportFrom field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - names = asdl_seq_new(len, arena); - if (names == NULL) goto failed; - for (i = 0; i < len; i++) { - alias_ty value; - res = obj2ast_alias(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(names, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from ImportFrom"); - return 1; - } - if (PyObject_HasAttrString(obj, "level")) { - int res; - tmp = PyObject_GetAttrString(obj, "level"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &level, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - level = 0; - } - *out = ImportFrom(module, names, level, lineno, col_offset, - arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Exec_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty body; - expr_ty globals; - expr_ty locals; - - if (PyObject_HasAttrString(obj, "body")) { - int res; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &body, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Exec"); - return 1; - } - if (PyObject_HasAttrString(obj, "globals")) { - int res; - tmp = PyObject_GetAttrString(obj, "globals"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &globals, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - globals = NULL; - } - if (PyObject_HasAttrString(obj, "locals")) { - int res; - tmp = PyObject_GetAttrString(obj, "locals"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &locals, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - locals = NULL; - } - *out = Exec(body, globals, locals, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Global_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* names; - - if (PyObject_HasAttrString(obj, "names")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "names"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Global field \"names\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - names = asdl_seq_new(len, arena); - if (names == NULL) goto failed; - for (i = 0; i < len; i++) { - identifier value; - res = obj2ast_identifier(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(names, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"names\" missing from Global"); - return 1; - } - *out = Global(names, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Expr_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Expr"); - return 1; - } - *out = Expr(value, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Pass_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - - *out = Pass(lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Break_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - - *out = Break(lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Continue_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - - *out = Continue(lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of stmt, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_expr(PyObject* obj, expr_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - int lineno; - int col_offset; - - if (obj == Py_None) { - *out = NULL; - return 0; - } - if (PyObject_HasAttrString(obj, "lineno")) { - int res; - tmp = PyObject_GetAttrString(obj, "lineno"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &lineno, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from expr"); - return 1; - } - if (PyObject_HasAttrString(obj, "col_offset")) { - int res; - tmp = PyObject_GetAttrString(obj, "col_offset"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &col_offset, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from expr"); - return 1; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)BoolOp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - boolop_ty op; - asdl_seq* values; - - if (PyObject_HasAttrString(obj, "op")) { - int res; - tmp = PyObject_GetAttrString(obj, "op"); - if (tmp == NULL) goto failed; - res = obj2ast_boolop(tmp, &op, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BoolOp"); - return 1; - } - if (PyObject_HasAttrString(obj, "values")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "values"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "BoolOp field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - values = asdl_seq_new(len, arena); - if (values == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(values, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from BoolOp"); - return 1; - } - *out = BoolOp(op, values, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)BinOp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty left; - operator_ty op; - expr_ty right; - - if (PyObject_HasAttrString(obj, "left")) { - int res; - tmp = PyObject_GetAttrString(obj, "left"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &left, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from BinOp"); - return 1; - } - if (PyObject_HasAttrString(obj, "op")) { - int res; - tmp = PyObject_GetAttrString(obj, "op"); - if (tmp == NULL) goto failed; - res = obj2ast_operator(tmp, &op, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from BinOp"); - return 1; - } - if (PyObject_HasAttrString(obj, "right")) { - int res; - tmp = PyObject_GetAttrString(obj, "right"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &right, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"right\" missing from BinOp"); - return 1; - } - *out = BinOp(left, op, right, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)UnaryOp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - unaryop_ty op; - expr_ty operand; - - if (PyObject_HasAttrString(obj, "op")) { - int res; - tmp = PyObject_GetAttrString(obj, "op"); - if (tmp == NULL) goto failed; - res = obj2ast_unaryop(tmp, &op, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"op\" missing from UnaryOp"); - return 1; - } - if (PyObject_HasAttrString(obj, "operand")) { - int res; - tmp = PyObject_GetAttrString(obj, "operand"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &operand, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"operand\" missing from UnaryOp"); - return 1; - } - *out = UnaryOp(op, operand, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Lambda_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - arguments_ty args; - expr_ty body; - - if (PyObject_HasAttrString(obj, "args")) { - int res; - tmp = PyObject_GetAttrString(obj, "args"); - if (tmp == NULL) goto failed; - res = obj2ast_arguments(tmp, &args, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Lambda"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &body, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from Lambda"); - return 1; - } - *out = Lambda(args, body, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)IfExp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty test; - expr_ty body; - expr_ty orelse; - - if (PyObject_HasAttrString(obj, "test")) { - int res; - tmp = PyObject_GetAttrString(obj, "test"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &test, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"test\" missing from IfExp"); - return 1; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &body, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from IfExp"); - return 1; - } - if (PyObject_HasAttrString(obj, "orelse")) { - int res; - tmp = PyObject_GetAttrString(obj, "orelse"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &orelse, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"orelse\" missing from IfExp"); - return 1; - } - *out = IfExp(test, body, orelse, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Dict_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* keys; - asdl_seq* values; - - if (PyObject_HasAttrString(obj, "keys")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "keys"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Dict field \"keys\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - keys = asdl_seq_new(len, arena); - if (keys == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(keys, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"keys\" missing from Dict"); - return 1; - } - if (PyObject_HasAttrString(obj, "values")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "values"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Dict field \"values\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - values = asdl_seq_new(len, arena); - if (values == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(values, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"values\" missing from Dict"); - return 1; - } - *out = Dict(keys, values, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Set_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* elts; - - if (PyObject_HasAttrString(obj, "elts")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "elts"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Set field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - elts = asdl_seq_new(len, arena); - if (elts == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(elts, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Set"); - return 1; - } - *out = Set(elts, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)ListComp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty elt; - asdl_seq* generators; - - if (PyObject_HasAttrString(obj, "elt")) { - int res; - tmp = PyObject_GetAttrString(obj, "elt"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &elt, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from ListComp"); - return 1; - } - if (PyObject_HasAttrString(obj, "generators")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "generators"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ListComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - generators = asdl_seq_new(len, arena); - if (generators == NULL) goto failed; - for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(generators, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from ListComp"); - return 1; - } - *out = ListComp(elt, generators, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)SetComp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty elt; - asdl_seq* generators; - - if (PyObject_HasAttrString(obj, "elt")) { - int res; - tmp = PyObject_GetAttrString(obj, "elt"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &elt, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from SetComp"); - return 1; - } - if (PyObject_HasAttrString(obj, "generators")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "generators"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "SetComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - generators = asdl_seq_new(len, arena); - if (generators == NULL) goto failed; - for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(generators, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from SetComp"); - return 1; - } - *out = SetComp(elt, generators, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)DictComp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty key; - expr_ty value; - asdl_seq* generators; - - if (PyObject_HasAttrString(obj, "key")) { - int res; - tmp = PyObject_GetAttrString(obj, "key"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &key, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"key\" missing from DictComp"); - return 1; - } - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from DictComp"); - return 1; - } - if (PyObject_HasAttrString(obj, "generators")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "generators"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "DictComp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - generators = asdl_seq_new(len, arena); - if (generators == NULL) goto failed; - for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(generators, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from DictComp"); - return 1; - } - *out = DictComp(key, value, generators, lineno, col_offset, - arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)GeneratorExp_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty elt; - asdl_seq* generators; - - if (PyObject_HasAttrString(obj, "elt")) { - int res; - tmp = PyObject_GetAttrString(obj, "elt"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &elt, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"elt\" missing from GeneratorExp"); - return 1; - } - if (PyObject_HasAttrString(obj, "generators")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "generators"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "GeneratorExp field \"generators\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - generators = asdl_seq_new(len, arena); - if (generators == NULL) goto failed; - for (i = 0; i < len; i++) { - comprehension_ty value; - res = obj2ast_comprehension(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(generators, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"generators\" missing from GeneratorExp"); - return 1; - } - *out = GeneratorExp(elt, generators, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Yield_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - value = NULL; - } - *out = Yield(value, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Compare_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty left; - asdl_int_seq* ops; - asdl_seq* comparators; - - if (PyObject_HasAttrString(obj, "left")) { - int res; - tmp = PyObject_GetAttrString(obj, "left"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &left, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"left\" missing from Compare"); - return 1; - } - if (PyObject_HasAttrString(obj, "ops")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "ops"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Compare field \"ops\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - ops = asdl_int_seq_new(len, arena); - if (ops == NULL) goto failed; - for (i = 0; i < len; i++) { - cmpop_ty value; - res = obj2ast_cmpop(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(ops, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ops\" missing from Compare"); - return 1; - } - if (PyObject_HasAttrString(obj, "comparators")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "comparators"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Compare field \"comparators\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - comparators = asdl_seq_new(len, arena); - if (comparators == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(comparators, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"comparators\" missing from Compare"); - return 1; - } - *out = Compare(left, ops, comparators, lineno, col_offset, - arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Call_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty func; - asdl_seq* args; - asdl_seq* keywords; - expr_ty starargs; - expr_ty kwargs; - - if (PyObject_HasAttrString(obj, "func")) { - int res; - tmp = PyObject_GetAttrString(obj, "func"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &func, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"func\" missing from Call"); - return 1; - } - if (PyObject_HasAttrString(obj, "args")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "args"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Call field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - args = asdl_seq_new(len, arena); - if (args == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(args, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from Call"); - return 1; - } - if (PyObject_HasAttrString(obj, "keywords")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "keywords"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Call field \"keywords\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - keywords = asdl_seq_new(len, arena); - if (keywords == NULL) goto failed; - for (i = 0; i < len; i++) { - keyword_ty value; - res = obj2ast_keyword(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(keywords, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"keywords\" missing from Call"); - return 1; - } - if (PyObject_HasAttrString(obj, "starargs")) { - int res; - tmp = PyObject_GetAttrString(obj, "starargs"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &starargs, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - starargs = NULL; - } - if (PyObject_HasAttrString(obj, "kwargs")) { - int res; - tmp = PyObject_GetAttrString(obj, "kwargs"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &kwargs, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - kwargs = NULL; - } - *out = Call(func, args, keywords, starargs, kwargs, lineno, - col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Repr_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Repr"); - return 1; - } - *out = Repr(value, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Num_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - object n; - - if (PyObject_HasAttrString(obj, "n")) { - int res; - tmp = PyObject_GetAttrString(obj, "n"); - if (tmp == NULL) goto failed; - res = obj2ast_object(tmp, &n, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"n\" missing from Num"); - return 1; - } - *out = Num(n, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Str_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - string s; - - if (PyObject_HasAttrString(obj, "s")) { - int res; - tmp = PyObject_GetAttrString(obj, "s"); - if (tmp == NULL) goto failed; - res = obj2ast_string(tmp, &s, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"s\" missing from Str"); - return 1; - } - *out = Str(s, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Attribute_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - identifier attr; - expr_context_ty ctx; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Attribute"); - return 1; - } - if (PyObject_HasAttrString(obj, "attr")) { - int res; - tmp = PyObject_GetAttrString(obj, "attr"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &attr, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"attr\" missing from Attribute"); - return 1; - } - if (PyObject_HasAttrString(obj, "ctx")) { - int res; - tmp = PyObject_GetAttrString(obj, "ctx"); - if (tmp == NULL) goto failed; - res = obj2ast_expr_context(tmp, &ctx, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Attribute"); - return 1; - } - *out = Attribute(value, attr, ctx, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Subscript_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - slice_ty slice; - expr_context_ty ctx; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Subscript"); - return 1; - } - if (PyObject_HasAttrString(obj, "slice")) { - int res; - tmp = PyObject_GetAttrString(obj, "slice"); - if (tmp == NULL) goto failed; - res = obj2ast_slice(tmp, &slice, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"slice\" missing from Subscript"); - return 1; - } - if (PyObject_HasAttrString(obj, "ctx")) { - int res; - tmp = PyObject_GetAttrString(obj, "ctx"); - if (tmp == NULL) goto failed; - res = obj2ast_expr_context(tmp, &ctx, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Subscript"); - return 1; - } - *out = Subscript(value, slice, ctx, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Name_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - identifier id; - expr_context_ty ctx; - - if (PyObject_HasAttrString(obj, "id")) { - int res; - tmp = PyObject_GetAttrString(obj, "id"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &id, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"id\" missing from Name"); - return 1; - } - if (PyObject_HasAttrString(obj, "ctx")) { - int res; - tmp = PyObject_GetAttrString(obj, "ctx"); - if (tmp == NULL) goto failed; - res = obj2ast_expr_context(tmp, &ctx, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Name"); - return 1; - } - *out = Name(id, ctx, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)List_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* elts; - expr_context_ty ctx; - - if (PyObject_HasAttrString(obj, "elts")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "elts"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "List field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - elts = asdl_seq_new(len, arena); - if (elts == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(elts, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from List"); - return 1; - } - if (PyObject_HasAttrString(obj, "ctx")) { - int res; - tmp = PyObject_GetAttrString(obj, "ctx"); - if (tmp == NULL) goto failed; - res = obj2ast_expr_context(tmp, &ctx, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from List"); - return 1; - } - *out = List(elts, ctx, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Tuple_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* elts; - expr_context_ty ctx; - - if (PyObject_HasAttrString(obj, "elts")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "elts"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "Tuple field \"elts\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - elts = asdl_seq_new(len, arena); - if (elts == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(elts, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"elts\" missing from Tuple"); - return 1; - } - if (PyObject_HasAttrString(obj, "ctx")) { - int res; - tmp = PyObject_GetAttrString(obj, "ctx"); - if (tmp == NULL) goto failed; - res = obj2ast_expr_context(tmp, &ctx, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ctx\" missing from Tuple"); - return 1; - } - *out = Tuple(elts, ctx, lineno, col_offset, arena); - if (*out == NULL) goto failed; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_expr_context(PyObject* obj, expr_context_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - isinstance = PyObject_IsInstance(obj, (PyObject *)Load_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Load; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Store_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Store; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Del_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Del; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)AugLoad_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = AugLoad; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)AugStore_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = AugStore; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Param_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Param; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of expr_context, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_slice(PyObject* obj, slice_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - - if (obj == Py_None) { - *out = NULL; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Ellipsis_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - - *out = Ellipsis(arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Slice_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty lower; - expr_ty upper; - expr_ty step; - - if (PyObject_HasAttrString(obj, "lower")) { - int res; - tmp = PyObject_GetAttrString(obj, "lower"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &lower, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - lower = NULL; - } - if (PyObject_HasAttrString(obj, "upper")) { - int res; - tmp = PyObject_GetAttrString(obj, "upper"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &upper, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - upper = NULL; - } - if (PyObject_HasAttrString(obj, "step")) { - int res; - tmp = PyObject_GetAttrString(obj, "step"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &step, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - step = NULL; - } - *out = Slice(lower, upper, step, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)ExtSlice_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - asdl_seq* dims; - - if (PyObject_HasAttrString(obj, "dims")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "dims"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ExtSlice field \"dims\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - dims = asdl_seq_new(len, arena); - if (dims == NULL) goto failed; - for (i = 0; i < len; i++) { - slice_ty value; - res = obj2ast_slice(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(dims, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"dims\" missing from ExtSlice"); - return 1; - } - *out = ExtSlice(dims, arena); - if (*out == NULL) goto failed; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)Index_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty value; - - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from Index"); - return 1; - } - *out = Index(value, arena); - if (*out == NULL) goto failed; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of slice, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_boolop(PyObject* obj, boolop_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - isinstance = PyObject_IsInstance(obj, (PyObject *)And_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = And; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Or_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Or; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of boolop, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_operator(PyObject* obj, operator_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - isinstance = PyObject_IsInstance(obj, (PyObject *)Add_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Add; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Sub_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Sub; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Mult_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Mult; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Div_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Div; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Mod_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Mod; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Pow_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Pow; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)LShift_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = LShift; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)RShift_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = RShift; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)BitOr_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = BitOr; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)BitXor_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = BitXor; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)BitAnd_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = BitAnd; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)FloorDiv_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = FloorDiv; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of operator, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_unaryop(PyObject* obj, unaryop_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - isinstance = PyObject_IsInstance(obj, (PyObject *)Invert_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Invert; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Not_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Not; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)UAdd_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = UAdd; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)USub_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = USub; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of unaryop, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_cmpop(PyObject* obj, cmpop_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - isinstance = PyObject_IsInstance(obj, (PyObject *)Eq_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Eq; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)NotEq_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = NotEq; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Lt_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Lt; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)LtE_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = LtE; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Gt_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Gt; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)GtE_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = GtE; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)Is_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = Is; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)IsNot_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = IsNot; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)In_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = In; - return 0; - } - isinstance = PyObject_IsInstance(obj, (PyObject *)NotIn_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - *out = NotIn; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of cmpop, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_comprehension(PyObject* obj, comprehension_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - expr_ty target; - expr_ty iter; - asdl_seq* ifs; - - if (PyObject_HasAttrString(obj, "target")) { - int res; - tmp = PyObject_GetAttrString(obj, "target"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &target, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"target\" missing from comprehension"); - return 1; - } - if (PyObject_HasAttrString(obj, "iter")) { - int res; - tmp = PyObject_GetAttrString(obj, "iter"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &iter, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"iter\" missing from comprehension"); - return 1; - } - if (PyObject_HasAttrString(obj, "ifs")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "ifs"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "comprehension field \"ifs\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - ifs = asdl_seq_new(len, arena); - if (ifs == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(ifs, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"ifs\" missing from comprehension"); - return 1; - } - *out = comprehension(target, iter, ifs, arena); - return 0; -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_excepthandler(PyObject* obj, excepthandler_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - int isinstance; - - int lineno; - int col_offset; - - if (obj == Py_None) { - *out = NULL; - return 0; - } - if (PyObject_HasAttrString(obj, "lineno")) { - int res; - tmp = PyObject_GetAttrString(obj, "lineno"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &lineno, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"lineno\" missing from excepthandler"); - return 1; - } - if (PyObject_HasAttrString(obj, "col_offset")) { - int res; - tmp = PyObject_GetAttrString(obj, "col_offset"); - if (tmp == NULL) goto failed; - res = obj2ast_int(tmp, &col_offset, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"col_offset\" missing from excepthandler"); - return 1; - } - isinstance = PyObject_IsInstance(obj, (PyObject*)ExceptHandler_type); - if (isinstance == -1) { - return 1; - } - if (isinstance) { - expr_ty type; - expr_ty name; - asdl_seq* body; - - if (PyObject_HasAttrString(obj, "type")) { - int res; - tmp = PyObject_GetAttrString(obj, "type"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &type, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - type = NULL; - } - if (PyObject_HasAttrString(obj, "name")) { - int res; - tmp = PyObject_GetAttrString(obj, "name"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &name, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - name = NULL; - } - if (PyObject_HasAttrString(obj, "body")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "body"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "ExceptHandler field \"body\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - body = asdl_seq_new(len, arena); - if (body == NULL) goto failed; - for (i = 0; i < len; i++) { - stmt_ty value; - res = obj2ast_stmt(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(body, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"body\" missing from ExceptHandler"); - return 1; - } - *out = ExceptHandler(type, name, body, lineno, col_offset, - arena); - if (*out == NULL) goto failed; - return 0; - } - - tmp = PyObject_Repr(obj); - if (tmp == NULL) goto failed; - PyErr_Format(PyExc_TypeError, "expected some sort of excepthandler, but got %.400s", PyString_AS_STRING(tmp)); -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_arguments(PyObject* obj, arguments_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - asdl_seq* args; - identifier vararg; - identifier kwarg; - asdl_seq* defaults; - - if (PyObject_HasAttrString(obj, "args")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "args"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "arguments field \"args\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - args = asdl_seq_new(len, arena); - if (args == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(args, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"args\" missing from arguments"); - return 1; - } - if (PyObject_HasAttrString(obj, "vararg")) { - int res; - tmp = PyObject_GetAttrString(obj, "vararg"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &vararg, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - vararg = NULL; - } - if (PyObject_HasAttrString(obj, "kwarg")) { - int res; - tmp = PyObject_GetAttrString(obj, "kwarg"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &kwarg, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - kwarg = NULL; - } - if (PyObject_HasAttrString(obj, "defaults")) { - int res; - Py_ssize_t len; - Py_ssize_t i; - tmp = PyObject_GetAttrString(obj, "defaults"); - if (tmp == NULL) goto failed; - if (!PyList_Check(tmp)) { - PyErr_Format(PyExc_TypeError, "arguments field \"defaults\" must be a list, not a %.200s", tmp->ob_type->tp_name); - goto failed; - } - len = PyList_GET_SIZE(tmp); - defaults = asdl_seq_new(len, arena); - if (defaults == NULL) goto failed; - for (i = 0; i < len; i++) { - expr_ty value; - res = obj2ast_expr(PyList_GET_ITEM(tmp, i), &value, arena); - if (res != 0) goto failed; - asdl_seq_SET(defaults, i, value); - } - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"defaults\" missing from arguments"); - return 1; - } - *out = arguments(args, vararg, kwarg, defaults, arena); - return 0; -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_keyword(PyObject* obj, keyword_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - identifier arg; - expr_ty value; - - if (PyObject_HasAttrString(obj, "arg")) { - int res; - tmp = PyObject_GetAttrString(obj, "arg"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &arg, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"arg\" missing from keyword"); - return 1; - } - if (PyObject_HasAttrString(obj, "value")) { - int res; - tmp = PyObject_GetAttrString(obj, "value"); - if (tmp == NULL) goto failed; - res = obj2ast_expr(tmp, &value, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"value\" missing from keyword"); - return 1; - } - *out = keyword(arg, value, arena); - return 0; -failed: - Py_XDECREF(tmp); - return 1; -} - -int -obj2ast_alias(PyObject* obj, alias_ty* out, PyArena* arena) -{ - PyObject* tmp = NULL; - identifier name; - identifier asname; - - if (PyObject_HasAttrString(obj, "name")) { - int res; - tmp = PyObject_GetAttrString(obj, "name"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &name, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - PyErr_SetString(PyExc_TypeError, "required field \"name\" missing from alias"); - return 1; - } - if (PyObject_HasAttrString(obj, "asname")) { - int res; - tmp = PyObject_GetAttrString(obj, "asname"); - if (tmp == NULL) goto failed; - res = obj2ast_identifier(tmp, &asname, arena); - if (res != 0) goto failed; - Py_XDECREF(tmp); - tmp = NULL; - } else { - asname = NULL; - } - *out = alias(name, asname, arena); - return 0; -failed: - Py_XDECREF(tmp); - return 1; -} - - -PyMODINIT_FUNC -init_ast(void) -{ - PyObject *m, *d; - if (!init_types()) return; - m = Py_InitModule3("_ast", NULL, NULL); - if (!m) return; - d = PyModule_GetDict(m); - if (PyDict_SetItemString(d, "AST", (PyObject*)&AST_type) < 0) return; - if (PyModule_AddIntConstant(m, "PyCF_ONLY_AST", PyCF_ONLY_AST) < 0) - return; - if (PyModule_AddStringConstant(m, "__version__", "82160") < 0) - return; - if (PyDict_SetItemString(d, "mod", (PyObject*)mod_type) < 0) return; - if (PyDict_SetItemString(d, "Module", (PyObject*)Module_type) < 0) - return; - if (PyDict_SetItemString(d, "Interactive", (PyObject*)Interactive_type) - < 0) return; - if (PyDict_SetItemString(d, "Expression", (PyObject*)Expression_type) < - 0) return; - if (PyDict_SetItemString(d, "Suite", (PyObject*)Suite_type) < 0) return; - if (PyDict_SetItemString(d, "stmt", (PyObject*)stmt_type) < 0) return; - if (PyDict_SetItemString(d, "FunctionDef", (PyObject*)FunctionDef_type) - < 0) return; - if (PyDict_SetItemString(d, "ClassDef", (PyObject*)ClassDef_type) < 0) - return; - if (PyDict_SetItemString(d, "Return", (PyObject*)Return_type) < 0) - return; - if (PyDict_SetItemString(d, "Delete", (PyObject*)Delete_type) < 0) - return; - if (PyDict_SetItemString(d, "Assign", (PyObject*)Assign_type) < 0) - return; - if (PyDict_SetItemString(d, "AugAssign", (PyObject*)AugAssign_type) < - 0) return; - if (PyDict_SetItemString(d, "Print", (PyObject*)Print_type) < 0) return; - if (PyDict_SetItemString(d, "For", (PyObject*)For_type) < 0) return; - if (PyDict_SetItemString(d, "While", (PyObject*)While_type) < 0) return; - if (PyDict_SetItemString(d, "If", (PyObject*)If_type) < 0) return; - if (PyDict_SetItemString(d, "With", (PyObject*)With_type) < 0) return; - if (PyDict_SetItemString(d, "Raise", (PyObject*)Raise_type) < 0) return; - if (PyDict_SetItemString(d, "TryExcept", (PyObject*)TryExcept_type) < - 0) return; - if (PyDict_SetItemString(d, "TryFinally", (PyObject*)TryFinally_type) < - 0) return; - if (PyDict_SetItemString(d, "Assert", (PyObject*)Assert_type) < 0) - return; - if (PyDict_SetItemString(d, "Import", (PyObject*)Import_type) < 0) - return; - if (PyDict_SetItemString(d, "ImportFrom", (PyObject*)ImportFrom_type) < - 0) return; - if (PyDict_SetItemString(d, "Exec", (PyObject*)Exec_type) < 0) return; - if (PyDict_SetItemString(d, "Global", (PyObject*)Global_type) < 0) - return; - if (PyDict_SetItemString(d, "Expr", (PyObject*)Expr_type) < 0) return; - if (PyDict_SetItemString(d, "Pass", (PyObject*)Pass_type) < 0) return; - if (PyDict_SetItemString(d, "Break", (PyObject*)Break_type) < 0) return; - if (PyDict_SetItemString(d, "Continue", (PyObject*)Continue_type) < 0) - return; - if (PyDict_SetItemString(d, "expr", (PyObject*)expr_type) < 0) return; - if (PyDict_SetItemString(d, "BoolOp", (PyObject*)BoolOp_type) < 0) - return; - if (PyDict_SetItemString(d, "BinOp", (PyObject*)BinOp_type) < 0) return; - if (PyDict_SetItemString(d, "UnaryOp", (PyObject*)UnaryOp_type) < 0) - return; - if (PyDict_SetItemString(d, "Lambda", (PyObject*)Lambda_type) < 0) - return; - if (PyDict_SetItemString(d, "IfExp", (PyObject*)IfExp_type) < 0) return; - if (PyDict_SetItemString(d, "Dict", (PyObject*)Dict_type) < 0) return; - if (PyDict_SetItemString(d, "Set", (PyObject*)Set_type) < 0) return; - if (PyDict_SetItemString(d, "ListComp", (PyObject*)ListComp_type) < 0) - return; - if (PyDict_SetItemString(d, "SetComp", (PyObject*)SetComp_type) < 0) - return; - if (PyDict_SetItemString(d, "DictComp", (PyObject*)DictComp_type) < 0) - return; - if (PyDict_SetItemString(d, "GeneratorExp", - (PyObject*)GeneratorExp_type) < 0) return; - if (PyDict_SetItemString(d, "Yield", (PyObject*)Yield_type) < 0) return; - if (PyDict_SetItemString(d, "Compare", (PyObject*)Compare_type) < 0) - return; - if (PyDict_SetItemString(d, "Call", (PyObject*)Call_type) < 0) return; - if (PyDict_SetItemString(d, "Repr", (PyObject*)Repr_type) < 0) return; - if (PyDict_SetItemString(d, "Num", (PyObject*)Num_type) < 0) return; - if (PyDict_SetItemString(d, "Str", (PyObject*)Str_type) < 0) return; - if (PyDict_SetItemString(d, "Attribute", (PyObject*)Attribute_type) < - 0) return; - if (PyDict_SetItemString(d, "Subscript", (PyObject*)Subscript_type) < - 0) return; - if (PyDict_SetItemString(d, "Name", (PyObject*)Name_type) < 0) return; - if (PyDict_SetItemString(d, "List", (PyObject*)List_type) < 0) return; - if (PyDict_SetItemString(d, "Tuple", (PyObject*)Tuple_type) < 0) return; - if (PyDict_SetItemString(d, "expr_context", - (PyObject*)expr_context_type) < 0) return; - if (PyDict_SetItemString(d, "Load", (PyObject*)Load_type) < 0) return; - if (PyDict_SetItemString(d, "Store", (PyObject*)Store_type) < 0) return; - if (PyDict_SetItemString(d, "Del", (PyObject*)Del_type) < 0) return; - if (PyDict_SetItemString(d, "AugLoad", (PyObject*)AugLoad_type) < 0) - return; - if (PyDict_SetItemString(d, "AugStore", (PyObject*)AugStore_type) < 0) - return; - if (PyDict_SetItemString(d, "Param", (PyObject*)Param_type) < 0) return; - if (PyDict_SetItemString(d, "slice", (PyObject*)slice_type) < 0) return; - if (PyDict_SetItemString(d, "Ellipsis", (PyObject*)Ellipsis_type) < 0) - return; - if (PyDict_SetItemString(d, "Slice", (PyObject*)Slice_type) < 0) return; - if (PyDict_SetItemString(d, "ExtSlice", (PyObject*)ExtSlice_type) < 0) - return; - if (PyDict_SetItemString(d, "Index", (PyObject*)Index_type) < 0) return; - if (PyDict_SetItemString(d, "boolop", (PyObject*)boolop_type) < 0) - return; - if (PyDict_SetItemString(d, "And", (PyObject*)And_type) < 0) return; - if (PyDict_SetItemString(d, "Or", (PyObject*)Or_type) < 0) return; - if (PyDict_SetItemString(d, "operator", (PyObject*)operator_type) < 0) - return; - if (PyDict_SetItemString(d, "Add", (PyObject*)Add_type) < 0) return; - if (PyDict_SetItemString(d, "Sub", (PyObject*)Sub_type) < 0) return; - if (PyDict_SetItemString(d, "Mult", (PyObject*)Mult_type) < 0) return; - if (PyDict_SetItemString(d, "Div", (PyObject*)Div_type) < 0) return; - if (PyDict_SetItemString(d, "Mod", (PyObject*)Mod_type) < 0) return; - if (PyDict_SetItemString(d, "Pow", (PyObject*)Pow_type) < 0) return; - if (PyDict_SetItemString(d, "LShift", (PyObject*)LShift_type) < 0) - return; - if (PyDict_SetItemString(d, "RShift", (PyObject*)RShift_type) < 0) - return; - if (PyDict_SetItemString(d, "BitOr", (PyObject*)BitOr_type) < 0) return; - if (PyDict_SetItemString(d, "BitXor", (PyObject*)BitXor_type) < 0) - return; - if (PyDict_SetItemString(d, "BitAnd", (PyObject*)BitAnd_type) < 0) - return; - if (PyDict_SetItemString(d, "FloorDiv", (PyObject*)FloorDiv_type) < 0) - return; - if (PyDict_SetItemString(d, "unaryop", (PyObject*)unaryop_type) < 0) - return; - if (PyDict_SetItemString(d, "Invert", (PyObject*)Invert_type) < 0) - return; - if (PyDict_SetItemString(d, "Not", (PyObject*)Not_type) < 0) return; - if (PyDict_SetItemString(d, "UAdd", (PyObject*)UAdd_type) < 0) return; - if (PyDict_SetItemString(d, "USub", (PyObject*)USub_type) < 0) return; - if (PyDict_SetItemString(d, "cmpop", (PyObject*)cmpop_type) < 0) return; - if (PyDict_SetItemString(d, "Eq", (PyObject*)Eq_type) < 0) return; - if (PyDict_SetItemString(d, "NotEq", (PyObject*)NotEq_type) < 0) return; - if (PyDict_SetItemString(d, "Lt", (PyObject*)Lt_type) < 0) return; - if (PyDict_SetItemString(d, "LtE", (PyObject*)LtE_type) < 0) return; - if (PyDict_SetItemString(d, "Gt", (PyObject*)Gt_type) < 0) return; - if (PyDict_SetItemString(d, "GtE", (PyObject*)GtE_type) < 0) return; - if (PyDict_SetItemString(d, "Is", (PyObject*)Is_type) < 0) return; - if (PyDict_SetItemString(d, "IsNot", (PyObject*)IsNot_type) < 0) return; - if (PyDict_SetItemString(d, "In", (PyObject*)In_type) < 0) return; - if (PyDict_SetItemString(d, "NotIn", (PyObject*)NotIn_type) < 0) return; - if (PyDict_SetItemString(d, "comprehension", - (PyObject*)comprehension_type) < 0) return; - if (PyDict_SetItemString(d, "excepthandler", - (PyObject*)excepthandler_type) < 0) return; - if (PyDict_SetItemString(d, "ExceptHandler", - (PyObject*)ExceptHandler_type) < 0) return; - if (PyDict_SetItemString(d, "arguments", (PyObject*)arguments_type) < - 0) return; - if (PyDict_SetItemString(d, "keyword", (PyObject*)keyword_type) < 0) - return; - if (PyDict_SetItemString(d, "alias", (PyObject*)alias_type) < 0) return; -} - - -PyObject* PyAST_mod2obj(mod_ty t) -{ - init_types(); - return ast2obj_mod(t); -} - -/* mode is 0 for "exec", 1 for "eval" and 2 for "single" input */ -mod_ty PyAST_obj2mod(PyObject* ast, PyArena* arena, int mode) -{ - mod_ty res; - PyObject *req_type[3]; - char *req_name[3]; - int isinstance; - - req_type[0] = (PyObject*)Module_type; - req_type[1] = (PyObject*)Expression_type; - req_type[2] = (PyObject*)Interactive_type; - - req_name[0] = "Module"; - req_name[1] = "Expression"; - req_name[2] = "Interactive"; - - assert(0 <= mode && mode <= 2); - - init_types(); - - isinstance = PyObject_IsInstance(ast, req_type[mode]); - if (isinstance == -1) - return NULL; - if (!isinstance) { - PyErr_Format(PyExc_TypeError, "expected %s node, got %.400s", - req_name[mode], Py_TYPE(ast)->tp_name); - return NULL; - } - if (obj2ast_mod(ast, &res, arena) != 0) - return NULL; - else - return res; -} - -int PyAST_Check(PyObject* obj) -{ - init_types(); - return PyObject_IsInstance(obj, (PyObject*)&AST_type); -} - - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/_warnings.c b/AppPkg/Applications/Python/Python-2.7.10/Python/_warnings.c deleted file mode 100644 index c880e33..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/_warnings.c +++ /dev/null @@ -1,911 +0,0 @@ -#include "Python.h" -#include "frameobject.h" - -#define MODULE_NAME "_warnings" - -PyDoc_STRVAR(warnings__doc__, -MODULE_NAME " provides basic warning filtering support.\n" -"It is a helper module to speed up interpreter start-up."); - -/* Both 'filters' and 'onceregistry' can be set in warnings.py; - get_warnings_attr() will reset these variables accordingly. */ -static PyObject *_filters; /* List */ -static PyObject *_once_registry; /* Dict */ -static PyObject *_default_action; /* String */ - - -static int -check_matched(PyObject *obj, PyObject *arg) -{ - PyObject *result; - int rc; - - if (obj == Py_None) - return 1; - result = PyObject_CallMethod(obj, "match", "O", arg); - if (result == NULL) - return -1; - - rc = PyObject_IsTrue(result); - Py_DECREF(result); - return rc; -} - -/* - Returns a new reference. - A NULL return value can mean false or an error. -*/ -static PyObject * -get_warnings_attr(const char *attr) -{ - static PyObject *warnings_str = NULL; - PyObject *all_modules; - PyObject *warnings_module; - int result; - - if (warnings_str == NULL) { - warnings_str = PyString_InternFromString("warnings"); - if (warnings_str == NULL) - return NULL; - } - - all_modules = PyImport_GetModuleDict(); - result = PyDict_Contains(all_modules, warnings_str); - if (result == -1 || result == 0) - return NULL; - - warnings_module = PyDict_GetItem(all_modules, warnings_str); - if (!PyObject_HasAttrString(warnings_module, attr)) - return NULL; - return PyObject_GetAttrString(warnings_module, attr); -} - - -static PyObject * -get_once_registry(void) -{ - PyObject *registry; - - registry = get_warnings_attr("onceregistry"); - if (registry == NULL) { - if (PyErr_Occurred()) - return NULL; - return _once_registry; - } - Py_DECREF(_once_registry); - _once_registry = registry; - return registry; -} - - -static PyObject * -get_default_action(void) -{ - PyObject *default_action; - - default_action = get_warnings_attr("defaultaction"); - if (default_action == NULL) { - if (PyErr_Occurred()) { - return NULL; - } - return _default_action; - } - - Py_DECREF(_default_action); - _default_action = default_action; - return default_action; -} - - -/* The item is a borrowed reference. */ -static const char * -get_filter(PyObject *category, PyObject *text, Py_ssize_t lineno, - PyObject *module, PyObject **item) -{ - PyObject *action; - Py_ssize_t i; - PyObject *warnings_filters; - - warnings_filters = get_warnings_attr("filters"); - if (warnings_filters == NULL) { - if (PyErr_Occurred()) - return NULL; - } - else { - Py_DECREF(_filters); - _filters = warnings_filters; - } - - if (!PyList_Check(_filters)) { - PyErr_SetString(PyExc_ValueError, - MODULE_NAME ".filters must be a list"); - return NULL; - } - - /* _filters could change while we are iterating over it. */ - for (i = 0; i < PyList_GET_SIZE(_filters); i++) { - PyObject *tmp_item, *action, *msg, *cat, *mod, *ln_obj; - Py_ssize_t ln; - int is_subclass, good_msg, good_mod; - - tmp_item = *item = PyList_GET_ITEM(_filters, i); - if (PyTuple_Size(tmp_item) != 5) { - PyErr_Format(PyExc_ValueError, - MODULE_NAME ".filters item %zd isn't a 5-tuple", i); - return NULL; - } - - /* Python code: action, msg, cat, mod, ln = item */ - action = PyTuple_GET_ITEM(tmp_item, 0); - msg = PyTuple_GET_ITEM(tmp_item, 1); - cat = PyTuple_GET_ITEM(tmp_item, 2); - mod = PyTuple_GET_ITEM(tmp_item, 3); - ln_obj = PyTuple_GET_ITEM(tmp_item, 4); - - good_msg = check_matched(msg, text); - good_mod = check_matched(mod, module); - is_subclass = PyObject_IsSubclass(category, cat); - ln = PyInt_AsSsize_t(ln_obj); - if (good_msg == -1 || good_mod == -1 || is_subclass == -1 || - (ln == -1 && PyErr_Occurred())) - return NULL; - - if (good_msg && is_subclass && good_mod && (ln == 0 || lineno == ln)) - return PyString_AsString(action); - } - - action = get_default_action(); - if (action != NULL) { - return PyString_AsString(action); - } - - PyErr_SetString(PyExc_ValueError, - MODULE_NAME ".defaultaction not found"); - return NULL; -} - - -static int -already_warned(PyObject *registry, PyObject *key, int should_set) -{ - PyObject *already_warned; - - if (key == NULL) - return -1; - - already_warned = PyDict_GetItem(registry, key); - if (already_warned != NULL) { - int rc = PyObject_IsTrue(already_warned); - if (rc != 0) - return rc; - } - - /* This warning wasn't found in the registry, set it. */ - if (should_set) - return PyDict_SetItem(registry, key, Py_True); - return 0; -} - -/* New reference. */ -static PyObject * -normalize_module(PyObject *filename) -{ - PyObject *module; - const char *mod_str; - Py_ssize_t len; - - int rc = PyObject_IsTrue(filename); - if (rc == -1) - return NULL; - else if (rc == 0) - return PyString_FromString(""); - - mod_str = PyString_AsString(filename); - if (mod_str == NULL) - return NULL; - len = PyString_Size(filename); - if (len < 0) - return NULL; - if (len >= 3 && - strncmp(mod_str + (len - 3), ".py", 3) == 0) { - module = PyString_FromStringAndSize(mod_str, len-3); - } - else { - module = filename; - Py_INCREF(module); - } - return module; -} - -static int -update_registry(PyObject *registry, PyObject *text, PyObject *category, - int add_zero) -{ - PyObject *altkey, *zero = NULL; - int rc; - - if (add_zero) { - zero = PyInt_FromLong(0); - if (zero == NULL) - return -1; - altkey = PyTuple_Pack(3, text, category, zero); - } - else - altkey = PyTuple_Pack(2, text, category); - - rc = already_warned(registry, altkey, 1); - Py_XDECREF(zero); - Py_XDECREF(altkey); - return rc; -} - -static void -show_warning(PyObject *filename, int lineno, PyObject *text, PyObject - *category, PyObject *sourceline) -{ - PyObject *f_stderr; - PyObject *name; - char lineno_str[128]; - - PyOS_snprintf(lineno_str, sizeof(lineno_str), ":%d: ", lineno); - - name = PyObject_GetAttrString(category, "__name__"); - if (name == NULL) /* XXX Can an object lack a '__name__' attribute? */ - return; - - f_stderr = PySys_GetObject("stderr"); - if (f_stderr == NULL) { - fprintf(stderr, "lost sys.stderr\n"); - Py_DECREF(name); - return; - } - - /* Print "filename:lineno: category: text\n" */ - PyFile_WriteObject(filename, f_stderr, Py_PRINT_RAW); - PyFile_WriteString(lineno_str, f_stderr); - PyFile_WriteObject(name, f_stderr, Py_PRINT_RAW); - PyFile_WriteString(": ", f_stderr); - PyFile_WriteObject(text, f_stderr, Py_PRINT_RAW); - PyFile_WriteString("\n", f_stderr); - Py_XDECREF(name); - - /* Print " source_line\n" */ - if (sourceline) { - char *source_line_str = PyString_AS_STRING(sourceline); - while (*source_line_str == ' ' || *source_line_str == '\t' || - *source_line_str == '\014') - source_line_str++; - - PyFile_WriteString(source_line_str, f_stderr); - PyFile_WriteString("\n", f_stderr); - } - else - _Py_DisplaySourceLine(f_stderr, PyString_AS_STRING(filename), - lineno, 2); - PyErr_Clear(); -} - -static PyObject * -warn_explicit(PyObject *category, PyObject *message, - PyObject *filename, int lineno, - PyObject *module, PyObject *registry, PyObject *sourceline) -{ - PyObject *key = NULL, *text = NULL, *result = NULL, *lineno_obj = NULL; - PyObject *item = Py_None; - const char *action; - int rc; - - if (registry && !PyDict_Check(registry) && (registry != Py_None)) { - PyErr_SetString(PyExc_TypeError, "'registry' must be a dict"); - return NULL; - } - - /* Normalize module. */ - if (module == NULL) { - module = normalize_module(filename); - if (module == NULL) - return NULL; - } - else - Py_INCREF(module); - - /* Normalize message. */ - Py_INCREF(message); /* DECREF'ed in cleanup. */ - rc = PyObject_IsInstance(message, PyExc_Warning); - if (rc == -1) { - goto cleanup; - } - if (rc == 1) { - text = PyObject_Str(message); - if (text == NULL) - goto cleanup; - category = (PyObject*)message->ob_type; - } - else { - text = message; - message = PyObject_CallFunction(category, "O", message); - if (message == NULL) - goto cleanup; - } - - lineno_obj = PyInt_FromLong(lineno); - if (lineno_obj == NULL) - goto cleanup; - - /* Create key. */ - key = PyTuple_Pack(3, text, category, lineno_obj); - if (key == NULL) - goto cleanup; - - if ((registry != NULL) && (registry != Py_None)) { - rc = already_warned(registry, key, 0); - if (rc == -1) - goto cleanup; - else if (rc == 1) - goto return_none; - /* Else this warning hasn't been generated before. */ - } - - action = get_filter(category, text, lineno, module, &item); - if (action == NULL) - goto cleanup; - - if (strcmp(action, "error") == 0) { - PyErr_SetObject(category, message); - goto cleanup; - } - - /* Store in the registry that we've been here, *except* when the action - is "always". */ - rc = 0; - if (strcmp(action, "always") != 0) { - if (registry != NULL && registry != Py_None && - PyDict_SetItem(registry, key, Py_True) < 0) - goto cleanup; - else if (strcmp(action, "ignore") == 0) - goto return_none; - else if (strcmp(action, "once") == 0) { - if (registry == NULL || registry == Py_None) { - registry = get_once_registry(); - if (registry == NULL) - goto cleanup; - } - /* _once_registry[(text, category)] = 1 */ - rc = update_registry(registry, text, category, 0); - } - else if (strcmp(action, "module") == 0) { - /* registry[(text, category, 0)] = 1 */ - if (registry != NULL && registry != Py_None) - rc = update_registry(registry, text, category, 0); - } - else if (strcmp(action, "default") != 0) { - PyObject *to_str = PyObject_Str(item); - const char *err_str = "???"; - - if (to_str != NULL) - err_str = PyString_AS_STRING(to_str); - PyErr_Format(PyExc_RuntimeError, - "Unrecognized action (%s) in warnings.filters:\n %s", - action, err_str); - Py_XDECREF(to_str); - goto cleanup; - } - } - - if (rc == 1) /* Already warned for this module. */ - goto return_none; - if (rc == 0) { - PyObject *show_fxn = get_warnings_attr("showwarning"); - if (show_fxn == NULL) { - if (PyErr_Occurred()) - goto cleanup; - show_warning(filename, lineno, text, category, sourceline); - } - else { - PyObject *res; - - if (!PyMethod_Check(show_fxn) && !PyFunction_Check(show_fxn)) { - PyErr_SetString(PyExc_TypeError, - "warnings.showwarning() must be set to a " - "function or method"); - Py_DECREF(show_fxn); - goto cleanup; - } - - res = PyObject_CallFunctionObjArgs(show_fxn, message, category, - filename, lineno_obj, - NULL); - Py_DECREF(show_fxn); - Py_XDECREF(res); - if (res == NULL) - goto cleanup; - } - } - else /* if (rc == -1) */ - goto cleanup; - - return_none: - result = Py_None; - Py_INCREF(result); - - cleanup: - Py_XDECREF(key); - Py_XDECREF(text); - Py_XDECREF(lineno_obj); - Py_DECREF(module); - Py_XDECREF(message); - return result; /* Py_None or NULL. */ -} - -/* filename, module, and registry are new refs, globals is borrowed */ -/* Returns 0 on error (no new refs), 1 on success */ -static int -setup_context(Py_ssize_t stack_level, PyObject **filename, int *lineno, - PyObject **module, PyObject **registry) -{ - PyObject *globals; - - /* Setup globals and lineno. */ - PyFrameObject *f = PyThreadState_GET()->frame; - while (--stack_level > 0 && f != NULL) - f = f->f_back; - - if (f == NULL) { - globals = PyThreadState_Get()->interp->sysdict; - *lineno = 1; - } - else { - globals = f->f_globals; - *lineno = PyFrame_GetLineNumber(f); - } - - *module = NULL; - - /* Setup registry. */ - assert(globals != NULL); - assert(PyDict_Check(globals)); - *registry = PyDict_GetItemString(globals, "__warningregistry__"); - if (*registry == NULL) { - int rc; - - *registry = PyDict_New(); - if (*registry == NULL) - return 0; - - rc = PyDict_SetItemString(globals, "__warningregistry__", *registry); - if (rc < 0) - goto handle_error; - } - else - Py_INCREF(*registry); - - /* Setup module. */ - *module = PyDict_GetItemString(globals, "__name__"); - if (*module == NULL) { - *module = PyString_FromString(""); - if (*module == NULL) - goto handle_error; - } - else - Py_INCREF(*module); - - /* Setup filename. */ - *filename = PyDict_GetItemString(globals, "__file__"); - if (*filename != NULL && PyString_Check(*filename)) { - Py_ssize_t len = PyString_Size(*filename); - const char *file_str = PyString_AsString(*filename); - if (file_str == NULL || (len < 0 && PyErr_Occurred())) - goto handle_error; - - /* if filename.lower().endswith((".pyc", ".pyo")): */ - if (len >= 4 && - file_str[len-4] == '.' && - tolower(file_str[len-3]) == 'p' && - tolower(file_str[len-2]) == 'y' && - (tolower(file_str[len-1]) == 'c' || - tolower(file_str[len-1]) == 'o')) - { - *filename = PyString_FromStringAndSize(file_str, len-1); - if (*filename == NULL) - goto handle_error; - } - else - Py_INCREF(*filename); - } - else { - const char *module_str = PyString_AsString(*module); - *filename = NULL; - if (module_str && strcmp(module_str, "__main__") == 0) { - PyObject *argv = PySys_GetObject("argv"); - if (argv != NULL && PyList_Size(argv) > 0) { - int is_true; - *filename = PyList_GetItem(argv, 0); - Py_INCREF(*filename); - /* If sys.argv[0] is false, then use '__main__'. */ - is_true = PyObject_IsTrue(*filename); - if (is_true < 0) { - Py_DECREF(*filename); - goto handle_error; - } - else if (!is_true) { - Py_DECREF(*filename); - *filename = PyString_FromString("__main__"); - if (*filename == NULL) - goto handle_error; - } - } - else { - /* embedded interpreters don't have sys.argv, see bug #839151 */ - *filename = PyString_FromString("__main__"); - if (*filename == NULL) - goto handle_error; - } - } - if (*filename == NULL) { - *filename = *module; - Py_INCREF(*filename); - } - } - - return 1; - - handle_error: - /* filename not XDECREF'ed here as there is no way to jump here with a - dangling reference. */ - Py_XDECREF(*registry); - Py_XDECREF(*module); - return 0; -} - -static PyObject * -get_category(PyObject *message, PyObject *category) -{ - int rc; - - /* Get category. */ - rc = PyObject_IsInstance(message, PyExc_Warning); - if (rc == -1) - return NULL; - - if (rc == 1) - category = (PyObject*)message->ob_type; - else if (category == NULL) - category = PyExc_UserWarning; - - /* Validate category. */ - rc = PyObject_IsSubclass(category, PyExc_Warning); - if (rc == -1) - return NULL; - if (rc == 0) { - PyErr_SetString(PyExc_ValueError, - "category is not a subclass of Warning"); - return NULL; - } - - return category; -} - -static PyObject * -do_warn(PyObject *message, PyObject *category, Py_ssize_t stack_level) -{ - PyObject *filename, *module, *registry, *res; - int lineno; - - if (!setup_context(stack_level, &filename, &lineno, &module, ®istry)) - return NULL; - - res = warn_explicit(category, message, filename, lineno, module, registry, - NULL); - Py_DECREF(filename); - Py_DECREF(registry); - Py_DECREF(module); - return res; -} - -static PyObject * -warnings_warn(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kw_list[] = { "message", "category", "stacklevel", 0 }; - PyObject *message, *category = NULL; - Py_ssize_t stack_level = 1; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|On:warn", kw_list, - &message, &category, &stack_level)) - return NULL; - - category = get_category(message, category); - if (category == NULL) - return NULL; - return do_warn(message, category, stack_level); -} - -static PyObject * -warnings_warn_explicit(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwd_list[] = {"message", "category", "filename", "lineno", - "module", "registry", "module_globals", 0}; - PyObject *message; - PyObject *category; - PyObject *filename; - int lineno; - PyObject *module = NULL; - PyObject *registry = NULL; - PyObject *module_globals = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "OOOi|OOO:warn_explicit", - kwd_list, &message, &category, &filename, &lineno, &module, - ®istry, &module_globals)) - return NULL; - - if (module_globals) { - static PyObject *get_source_name = NULL; - static PyObject *splitlines_name = NULL; - PyObject *loader; - PyObject *module_name; - PyObject *source; - PyObject *source_list; - PyObject *source_line; - PyObject *returned; - - if (get_source_name == NULL) { - get_source_name = PyString_InternFromString("get_source"); - if (!get_source_name) - return NULL; - } - if (splitlines_name == NULL) { - splitlines_name = PyString_InternFromString("splitlines"); - if (!splitlines_name) - return NULL; - } - - /* Check/get the requisite pieces needed for the loader. */ - loader = PyDict_GetItemString(module_globals, "__loader__"); - module_name = PyDict_GetItemString(module_globals, "__name__"); - - if (loader == NULL || module_name == NULL) - goto standard_call; - - /* Make sure the loader implements the optional get_source() method. */ - if (!PyObject_HasAttrString(loader, "get_source")) - goto standard_call; - /* Call get_source() to get the source code. */ - source = PyObject_CallMethodObjArgs(loader, get_source_name, - module_name, NULL); - if (!source) - return NULL; - else if (source == Py_None) { - Py_DECREF(Py_None); - goto standard_call; - } - - /* Split the source into lines. */ - source_list = PyObject_CallMethodObjArgs(source, splitlines_name, - NULL); - Py_DECREF(source); - if (!source_list) - return NULL; - - /* Get the source line. */ - source_line = PyList_GetItem(source_list, lineno-1); - if (!source_line) { - Py_DECREF(source_list); - return NULL; - } - - /* Handle the warning. */ - returned = warn_explicit(category, message, filename, lineno, module, - registry, source_line); - Py_DECREF(source_list); - return returned; - } - - standard_call: - return warn_explicit(category, message, filename, lineno, module, - registry, NULL); -} - - -/* Function to issue a warning message; may raise an exception. */ -int -PyErr_WarnEx(PyObject *category, const char *text, Py_ssize_t stack_level) -{ - PyObject *res; - PyObject *message = PyString_FromString(text); - if (message == NULL) - return -1; - - if (category == NULL) - category = PyExc_RuntimeWarning; - - res = do_warn(message, category, stack_level); - Py_DECREF(message); - if (res == NULL) - return -1; - Py_DECREF(res); - - return 0; -} - -/* PyErr_Warn is only for backwards compatibility and will be removed. - Use PyErr_WarnEx instead. */ - -#undef PyErr_Warn - -PyAPI_FUNC(int) -PyErr_Warn(PyObject *category, char *text) -{ - return PyErr_WarnEx(category, text, 1); -} - -/* Warning with explicit origin */ -int -PyErr_WarnExplicit(PyObject *category, const char *text, - const char *filename_str, int lineno, - const char *module_str, PyObject *registry) -{ - PyObject *res; - PyObject *message = PyString_FromString(text); - PyObject *filename = PyString_FromString(filename_str); - PyObject *module = NULL; - int ret = -1; - - if (message == NULL || filename == NULL) - goto exit; - if (module_str != NULL) { - module = PyString_FromString(module_str); - if (module == NULL) - goto exit; - } - - if (category == NULL) - category = PyExc_RuntimeWarning; - res = warn_explicit(category, message, filename, lineno, module, registry, - NULL); - if (res == NULL) - goto exit; - Py_DECREF(res); - ret = 0; - - exit: - Py_XDECREF(message); - Py_XDECREF(module); - Py_XDECREF(filename); - return ret; -} - - -PyDoc_STRVAR(warn_doc, -"Issue a warning, or maybe ignore it or raise an exception."); - -PyDoc_STRVAR(warn_explicit_doc, -"Low-level inferface to warnings functionality."); - -static PyMethodDef warnings_functions[] = { - {"warn", (PyCFunction)warnings_warn, METH_VARARGS | METH_KEYWORDS, - warn_doc}, - {"warn_explicit", (PyCFunction)warnings_warn_explicit, - METH_VARARGS | METH_KEYWORDS, warn_explicit_doc}, - /* XXX(brett.cannon): add showwarning? */ - /* XXX(brett.cannon): Reasonable to add formatwarning? */ - {NULL, NULL} /* sentinel */ -}; - - -static PyObject * -create_filter(PyObject *category, const char *action) -{ - static PyObject *ignore_str = NULL; - static PyObject *error_str = NULL; - static PyObject *default_str = NULL; - PyObject *action_obj = NULL; - PyObject *lineno, *result; - - if (!strcmp(action, "ignore")) { - if (ignore_str == NULL) { - ignore_str = PyString_InternFromString("ignore"); - if (ignore_str == NULL) - return NULL; - } - action_obj = ignore_str; - } - else if (!strcmp(action, "error")) { - if (error_str == NULL) { - error_str = PyString_InternFromString("error"); - if (error_str == NULL) - return NULL; - } - action_obj = error_str; - } - else if (!strcmp(action, "default")) { - if (default_str == NULL) { - default_str = PyString_InternFromString("default"); - if (default_str == NULL) - return NULL; - } - action_obj = default_str; - } - else { - Py_FatalError("unknown action"); - } - - /* This assumes the line number is zero for now. */ - lineno = PyInt_FromLong(0); - if (lineno == NULL) - return NULL; - result = PyTuple_Pack(5, action_obj, Py_None, category, Py_None, lineno); - Py_DECREF(lineno); - return result; -} - -static PyObject * -init_filters(void) -{ - /* Don't silence DeprecationWarning if -3 or -Q were used. */ - PyObject *filters = PyList_New(Py_Py3kWarningFlag || - Py_DivisionWarningFlag ? 3 : 4); - unsigned int pos = 0; /* Post-incremented in each use. */ - unsigned int x; - const char *bytes_action; - - if (filters == NULL) - return NULL; - - /* If guard changes, make sure to update 'filters' initialization above. */ - if (!Py_Py3kWarningFlag && !Py_DivisionWarningFlag) { - PyList_SET_ITEM(filters, pos++, - create_filter(PyExc_DeprecationWarning, "ignore")); - } - PyList_SET_ITEM(filters, pos++, - create_filter(PyExc_PendingDeprecationWarning, "ignore")); - PyList_SET_ITEM(filters, pos++, - create_filter(PyExc_ImportWarning, "ignore")); - if (Py_BytesWarningFlag > 1) - bytes_action = "error"; - else if (Py_BytesWarningFlag) - bytes_action = "default"; - else - bytes_action = "ignore"; - PyList_SET_ITEM(filters, pos++, create_filter(PyExc_BytesWarning, - bytes_action)); - - for (x = 0; x < pos; x += 1) { - if (PyList_GET_ITEM(filters, x) == NULL) { - Py_DECREF(filters); - return NULL; - } - } - - return filters; -} - - -PyMODINIT_FUNC -_PyWarnings_Init(void) -{ - PyObject *m; - - m = Py_InitModule3(MODULE_NAME, warnings_functions, warnings__doc__); - if (m == NULL) - return; - - _filters = init_filters(); - if (_filters == NULL) - return; - Py_INCREF(_filters); - if (PyModule_AddObject(m, "filters", _filters) < 0) - return; - - _once_registry = PyDict_New(); - if (_once_registry == NULL) - return; - Py_INCREF(_once_registry); - if (PyModule_AddObject(m, "once_registry", _once_registry) < 0) - return; - - _default_action = PyString_FromString("default"); - if (_default_action == NULL) - return; - Py_INCREF(_default_action); - if (PyModule_AddObject(m, "default_action", _default_action) < 0) - return; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/asdl.c b/AppPkg/Applications/Python/Python-2.7.10/Python/asdl.c deleted file mode 100644 index 5705758..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/asdl.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "Python.h" -#include "asdl.h" - -asdl_seq * -asdl_seq_new(int size, PyArena *arena) -{ - asdl_seq *seq = NULL; - size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); - - /* check size is sane */ - if (size < 0 || size == INT_MIN || - (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { - PyErr_NoMemory(); - return NULL; - } - - /* check if size can be added safely */ - if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { - PyErr_NoMemory(); - return NULL; - } - - n += sizeof(asdl_seq); - - seq = (asdl_seq *)PyArena_Malloc(arena, n); - if (!seq) { - PyErr_NoMemory(); - return NULL; - } - memset(seq, 0, n); - seq->size = size; - return seq; -} - -asdl_int_seq * -asdl_int_seq_new(int size, PyArena *arena) -{ - asdl_int_seq *seq = NULL; - size_t n = (size ? (sizeof(void *) * (size - 1)) : 0); - - /* check size is sane */ - if (size < 0 || size == INT_MIN || - (size && ((size - 1) > (PY_SIZE_MAX / sizeof(void *))))) { - PyErr_NoMemory(); - return NULL; - } - - /* check if size can be added safely */ - if (n > PY_SIZE_MAX - sizeof(asdl_seq)) { - PyErr_NoMemory(); - return NULL; - } - - n += sizeof(asdl_seq); - - seq = (asdl_int_seq *)PyArena_Malloc(arena, n); - if (!seq) { - PyErr_NoMemory(); - return NULL; - } - memset(seq, 0, n); - seq->size = size; - return seq; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/ast.c b/AppPkg/Applications/Python/Python-2.7.10/Python/ast.c deleted file mode 100644 index 2ec1514..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/ast.c +++ /dev/null @@ -1,3587 +0,0 @@ -/* - * This file includes functions to transform a concrete syntax tree (CST) to - * an abstract syntax tree (AST). The main function is PyAST_FromNode(). - * - */ -#include "Python.h" -#include "Python-ast.h" -#include "grammar.h" -#include "node.h" -#include "pyarena.h" -#include "ast.h" -#include "token.h" -#include "parsetok.h" -#include "graminit.h" - -#include - -/* Data structure used internally */ -struct compiling { - char *c_encoding; /* source encoding */ - int c_future_unicode; /* __future__ unicode literals flag */ - PyArena *c_arena; /* arena for allocating memeory */ - const char *c_filename; /* filename */ -}; - -static asdl_seq *seq_for_testlist(struct compiling *, const node *); -static expr_ty ast_for_expr(struct compiling *, const node *); -static stmt_ty ast_for_stmt(struct compiling *, const node *); -static asdl_seq *ast_for_suite(struct compiling *, const node *); -static asdl_seq *ast_for_exprlist(struct compiling *, const node *, - expr_context_ty); -static expr_ty ast_for_testlist(struct compiling *, const node *); -static stmt_ty ast_for_classdef(struct compiling *, const node *, asdl_seq *); -static expr_ty ast_for_testlist_comp(struct compiling *, const node *); - -/* Note different signature for ast_for_call */ -static expr_ty ast_for_call(struct compiling *, const node *, expr_ty); - -static PyObject *parsenumber(struct compiling *, const char *); -static PyObject *parsestr(struct compiling *, const node *n, const char *); -static PyObject *parsestrplus(struct compiling *, const node *n); - -#ifndef LINENO -#define LINENO(n) ((n)->n_lineno) -#endif - -#define COMP_GENEXP 0 -#define COMP_SETCOMP 1 - -static identifier -new_identifier(const char* n, PyArena *arena) { - PyObject* id = PyString_InternFromString(n); - if (id != NULL) - PyArena_AddPyObject(arena, id); - return id; -} - -#define NEW_IDENTIFIER(n) new_identifier(STR(n), c->c_arena) - -/* This routine provides an invalid object for the syntax error. - The outermost routine must unpack this error and create the - proper object. We do this so that we don't have to pass - the filename to everything function. - - XXX Maybe we should just pass the filename... -*/ - -static int -ast_error(const node *n, const char *errstr) -{ - PyObject *u = Py_BuildValue("zi", errstr, LINENO(n)); - if (!u) - return 0; - PyErr_SetObject(PyExc_SyntaxError, u); - Py_DECREF(u); - return 0; -} - -static void -ast_error_finish(const char *filename) -{ - PyObject *type, *value, *tback, *errstr, *loc, *tmp; - long lineno; - - assert(PyErr_Occurred()); - if (!PyErr_ExceptionMatches(PyExc_SyntaxError)) - return; - - PyErr_Fetch(&type, &value, &tback); - errstr = PyTuple_GetItem(value, 0); - if (!errstr) - return; - Py_INCREF(errstr); - lineno = PyInt_AsLong(PyTuple_GetItem(value, 1)); - if (lineno == -1) { - Py_DECREF(errstr); - return; - } - Py_DECREF(value); - - loc = PyErr_ProgramText(filename, lineno); - if (!loc) { - Py_INCREF(Py_None); - loc = Py_None; - } - tmp = Py_BuildValue("(zlOO)", filename, lineno, Py_None, loc); - Py_DECREF(loc); - if (!tmp) { - Py_DECREF(errstr); - return; - } - value = PyTuple_Pack(2, errstr, tmp); - Py_DECREF(errstr); - Py_DECREF(tmp); - if (!value) - return; - PyErr_Restore(type, value, tback); -} - -static int -ast_warn(struct compiling *c, const node *n, char *msg) -{ - if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, c->c_filename, LINENO(n), - NULL, NULL) < 0) { - /* if -Werr, change it to a SyntaxError */ - if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_SyntaxWarning)) - ast_error(n, msg); - return 0; - } - return 1; -} - -static int -forbidden_check(struct compiling *c, const node *n, const char *x) -{ - if (!strcmp(x, "None")) - return ast_error(n, "cannot assign to None"); - if (!strcmp(x, "__debug__")) - return ast_error(n, "cannot assign to __debug__"); - if (Py_Py3kWarningFlag) { - if (!(strcmp(x, "True") && strcmp(x, "False")) && - !ast_warn(c, n, "assignment to True or False is forbidden in 3.x")) - return 0; - if (!strcmp(x, "nonlocal") && - !ast_warn(c, n, "nonlocal is a keyword in 3.x")) - return 0; - } - return 1; -} - -/* num_stmts() returns number of contained statements. - - Use this routine to determine how big a sequence is needed for - the statements in a parse tree. Its raison d'etre is this bit of - grammar: - - stmt: simple_stmt | compound_stmt - simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE - - A simple_stmt can contain multiple small_stmt elements joined - by semicolons. If the arg is a simple_stmt, the number of - small_stmt elements is returned. -*/ - -static int -num_stmts(const node *n) -{ - int i, l; - node *ch; - - switch (TYPE(n)) { - case single_input: - if (TYPE(CHILD(n, 0)) == NEWLINE) - return 0; - else - return num_stmts(CHILD(n, 0)); - case file_input: - l = 0; - for (i = 0; i < NCH(n); i++) { - ch = CHILD(n, i); - if (TYPE(ch) == stmt) - l += num_stmts(ch); - } - return l; - case stmt: - return num_stmts(CHILD(n, 0)); - case compound_stmt: - return 1; - case simple_stmt: - return NCH(n) / 2; /* Divide by 2 to remove count of semi-colons */ - case suite: - if (NCH(n) == 1) - return num_stmts(CHILD(n, 0)); - else { - l = 0; - for (i = 2; i < (NCH(n) - 1); i++) - l += num_stmts(CHILD(n, i)); - return l; - } - default: { - char buf[128]; - - sprintf(buf, "Non-statement found: %d %d", - TYPE(n), NCH(n)); - Py_FatalError(buf); - } - } - assert(0); - return 0; -} - -/* Transform the CST rooted at node * to the appropriate AST -*/ - -mod_ty -PyAST_FromNode(const node *n, PyCompilerFlags *flags, const char *filename, - PyArena *arena) -{ - int i, j, k, num; - asdl_seq *stmts = NULL; - stmt_ty s; - node *ch; - struct compiling c; - - if (flags && flags->cf_flags & PyCF_SOURCE_IS_UTF8) { - c.c_encoding = "utf-8"; - if (TYPE(n) == encoding_decl) { - ast_error(n, "encoding declaration in Unicode string"); - goto error; - } - } else if (TYPE(n) == encoding_decl) { - c.c_encoding = STR(n); - n = CHILD(n, 0); - } else { - c.c_encoding = NULL; - } - c.c_future_unicode = flags && flags->cf_flags & CO_FUTURE_UNICODE_LITERALS; - c.c_arena = arena; - c.c_filename = filename; - - k = 0; - switch (TYPE(n)) { - case file_input: - stmts = asdl_seq_new(num_stmts(n), arena); - if (!stmts) - return NULL; - for (i = 0; i < NCH(n) - 1; i++) { - ch = CHILD(n, i); - if (TYPE(ch) == NEWLINE) - continue; - REQ(ch, stmt); - num = num_stmts(ch); - if (num == 1) { - s = ast_for_stmt(&c, ch); - if (!s) - goto error; - asdl_seq_SET(stmts, k++, s); - } - else { - ch = CHILD(ch, 0); - REQ(ch, simple_stmt); - for (j = 0; j < num; j++) { - s = ast_for_stmt(&c, CHILD(ch, j * 2)); - if (!s) - goto error; - asdl_seq_SET(stmts, k++, s); - } - } - } - return Module(stmts, arena); - case eval_input: { - expr_ty testlist_ast; - - /* XXX Why not comp_for here? */ - testlist_ast = ast_for_testlist(&c, CHILD(n, 0)); - if (!testlist_ast) - goto error; - return Expression(testlist_ast, arena); - } - case single_input: - if (TYPE(CHILD(n, 0)) == NEWLINE) { - stmts = asdl_seq_new(1, arena); - if (!stmts) - goto error; - asdl_seq_SET(stmts, 0, Pass(n->n_lineno, n->n_col_offset, - arena)); - if (!asdl_seq_GET(stmts, 0)) - goto error; - return Interactive(stmts, arena); - } - else { - n = CHILD(n, 0); - num = num_stmts(n); - stmts = asdl_seq_new(num, arena); - if (!stmts) - goto error; - if (num == 1) { - s = ast_for_stmt(&c, n); - if (!s) - goto error; - asdl_seq_SET(stmts, 0, s); - } - else { - /* Only a simple_stmt can contain multiple statements. */ - REQ(n, simple_stmt); - for (i = 0; i < NCH(n); i += 2) { - if (TYPE(CHILD(n, i)) == NEWLINE) - break; - s = ast_for_stmt(&c, CHILD(n, i)); - if (!s) - goto error; - asdl_seq_SET(stmts, i / 2, s); - } - } - - return Interactive(stmts, arena); - } - default: - PyErr_Format(PyExc_SystemError, - "invalid node %d for PyAST_FromNode", TYPE(n)); - goto error; - } - error: - ast_error_finish(filename); - return NULL; -} - -/* Return the AST repr. of the operator represented as syntax (|, ^, etc.) -*/ - -static operator_ty -get_operator(const node *n) -{ - switch (TYPE(n)) { - case VBAR: - return BitOr; - case CIRCUMFLEX: - return BitXor; - case AMPER: - return BitAnd; - case LEFTSHIFT: - return LShift; - case RIGHTSHIFT: - return RShift; - case PLUS: - return Add; - case MINUS: - return Sub; - case STAR: - return Mult; - case SLASH: - return Div; - case DOUBLESLASH: - return FloorDiv; - case PERCENT: - return Mod; - default: - return (operator_ty)0; - } -} - -/* Set the context ctx for expr_ty e, recursively traversing e. - - Only sets context for expr kinds that "can appear in assignment context" - (according to ../Parser/Python.asdl). For other expr kinds, it sets - an appropriate syntax error and returns false. -*/ - -static int -set_context(struct compiling *c, expr_ty e, expr_context_ty ctx, const node *n) -{ - asdl_seq *s = NULL; - /* If a particular expression type can't be used for assign / delete, - set expr_name to its name and an error message will be generated. - */ - const char* expr_name = NULL; - - /* The ast defines augmented store and load contexts, but the - implementation here doesn't actually use them. The code may be - a little more complex than necessary as a result. It also means - that expressions in an augmented assignment have a Store context. - Consider restructuring so that augmented assignment uses - set_context(), too. - */ - assert(ctx != AugStore && ctx != AugLoad); - - switch (e->kind) { - case Attribute_kind: - if (ctx == Store && !forbidden_check(c, n, - PyBytes_AS_STRING(e->v.Attribute.attr))) - return 0; - e->v.Attribute.ctx = ctx; - break; - case Subscript_kind: - e->v.Subscript.ctx = ctx; - break; - case Name_kind: - if (ctx == Store && !forbidden_check(c, n, - PyBytes_AS_STRING(e->v.Name.id))) - return 0; - e->v.Name.ctx = ctx; - break; - case List_kind: - e->v.List.ctx = ctx; - s = e->v.List.elts; - break; - case Tuple_kind: - if (asdl_seq_LEN(e->v.Tuple.elts)) { - e->v.Tuple.ctx = ctx; - s = e->v.Tuple.elts; - } - else { - expr_name = "()"; - } - break; - case Lambda_kind: - expr_name = "lambda"; - break; - case Call_kind: - expr_name = "function call"; - break; - case BoolOp_kind: - case BinOp_kind: - case UnaryOp_kind: - expr_name = "operator"; - break; - case GeneratorExp_kind: - expr_name = "generator expression"; - break; - case Yield_kind: - expr_name = "yield expression"; - break; - case ListComp_kind: - expr_name = "list comprehension"; - break; - case SetComp_kind: - expr_name = "set comprehension"; - break; - case DictComp_kind: - expr_name = "dict comprehension"; - break; - case Dict_kind: - case Set_kind: - case Num_kind: - case Str_kind: - expr_name = "literal"; - break; - case Compare_kind: - expr_name = "comparison"; - break; - case Repr_kind: - expr_name = "repr"; - break; - case IfExp_kind: - expr_name = "conditional expression"; - break; - default: - PyErr_Format(PyExc_SystemError, - "unexpected expression in assignment %d (line %d)", - e->kind, e->lineno); - return 0; - } - /* Check for error string set by switch */ - if (expr_name) { - char buf[300]; - PyOS_snprintf(buf, sizeof(buf), - "can't %s %s", - ctx == Store ? "assign to" : "delete", - expr_name); - return ast_error(n, buf); - } - - /* If the LHS is a list or tuple, we need to set the assignment - context for all the contained elements. - */ - if (s) { - int i; - - for (i = 0; i < asdl_seq_LEN(s); i++) { - if (!set_context(c, (expr_ty)asdl_seq_GET(s, i), ctx, n)) - return 0; - } - } - return 1; -} - -static operator_ty -ast_for_augassign(struct compiling *c, const node *n) -{ - REQ(n, augassign); - n = CHILD(n, 0); - switch (STR(n)[0]) { - case '+': - return Add; - case '-': - return Sub; - case '/': - if (STR(n)[1] == '/') - return FloorDiv; - else - return Div; - case '%': - return Mod; - case '<': - return LShift; - case '>': - return RShift; - case '&': - return BitAnd; - case '^': - return BitXor; - case '|': - return BitOr; - case '*': - if (STR(n)[1] == '*') - return Pow; - else - return Mult; - default: - PyErr_Format(PyExc_SystemError, "invalid augassign: %s", STR(n)); - return (operator_ty)0; - } -} - -static cmpop_ty -ast_for_comp_op(struct compiling *c, const node *n) -{ - /* comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is' - |'is' 'not' - */ - REQ(n, comp_op); - if (NCH(n) == 1) { - n = CHILD(n, 0); - switch (TYPE(n)) { - case LESS: - return Lt; - case GREATER: - return Gt; - case EQEQUAL: /* == */ - return Eq; - case LESSEQUAL: - return LtE; - case GREATEREQUAL: - return GtE; - case NOTEQUAL: - return NotEq; - case NAME: - if (strcmp(STR(n), "in") == 0) - return In; - if (strcmp(STR(n), "is") == 0) - return Is; - default: - PyErr_Format(PyExc_SystemError, "invalid comp_op: %s", - STR(n)); - return (cmpop_ty)0; - } - } - else if (NCH(n) == 2) { - /* handle "not in" and "is not" */ - switch (TYPE(CHILD(n, 0))) { - case NAME: - if (strcmp(STR(CHILD(n, 1)), "in") == 0) - return NotIn; - if (strcmp(STR(CHILD(n, 0)), "is") == 0) - return IsNot; - default: - PyErr_Format(PyExc_SystemError, "invalid comp_op: %s %s", - STR(CHILD(n, 0)), STR(CHILD(n, 1))); - return (cmpop_ty)0; - } - } - PyErr_Format(PyExc_SystemError, "invalid comp_op: has %d children", - NCH(n)); - return (cmpop_ty)0; -} - -static asdl_seq * -seq_for_testlist(struct compiling *c, const node *n) -{ - /* testlist: test (',' test)* [','] */ - asdl_seq *seq; - expr_ty expression; - int i; - assert(TYPE(n) == testlist || - TYPE(n) == listmaker || - TYPE(n) == testlist_comp || - TYPE(n) == testlist_safe || - TYPE(n) == testlist1); - - seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); - if (!seq) - return NULL; - - for (i = 0; i < NCH(n); i += 2) { - assert(TYPE(CHILD(n, i)) == test || TYPE(CHILD(n, i)) == old_test); - - expression = ast_for_expr(c, CHILD(n, i)); - if (!expression) - return NULL; - - assert(i / 2 < seq->size); - asdl_seq_SET(seq, i / 2, expression); - } - return seq; -} - -static expr_ty -compiler_complex_args(struct compiling *c, const node *n) -{ - int i, len = (NCH(n) + 1) / 2; - expr_ty result; - asdl_seq *args = asdl_seq_new(len, c->c_arena); - if (!args) - return NULL; - - /* fpdef: NAME | '(' fplist ')' - fplist: fpdef (',' fpdef)* [','] - */ - REQ(n, fplist); - for (i = 0; i < len; i++) { - PyObject *arg_id; - const node *fpdef_node = CHILD(n, 2*i); - const node *child; - expr_ty arg; -set_name: - /* fpdef_node is either a NAME or an fplist */ - child = CHILD(fpdef_node, 0); - if (TYPE(child) == NAME) { - if (!forbidden_check(c, n, STR(child))) - return NULL; - arg_id = NEW_IDENTIFIER(child); - if (!arg_id) - return NULL; - arg = Name(arg_id, Store, LINENO(child), child->n_col_offset, - c->c_arena); - } - else { - assert(TYPE(fpdef_node) == fpdef); - /* fpdef_node[0] is not a name, so it must be '(', get CHILD[1] */ - child = CHILD(fpdef_node, 1); - assert(TYPE(child) == fplist); - /* NCH == 1 means we have (x), we need to elide the extra parens */ - if (NCH(child) == 1) { - fpdef_node = CHILD(child, 0); - assert(TYPE(fpdef_node) == fpdef); - goto set_name; - } - arg = compiler_complex_args(c, child); - } - asdl_seq_SET(args, i, arg); - } - - result = Tuple(args, Store, LINENO(n), n->n_col_offset, c->c_arena); - if (!set_context(c, result, Store, n)) - return NULL; - return result; -} - - -/* Create AST for argument list. */ - -static arguments_ty -ast_for_arguments(struct compiling *c, const node *n) -{ - /* parameters: '(' [varargslist] ')' - varargslist: (fpdef ['=' test] ',')* ('*' NAME [',' '**' NAME] - | '**' NAME) | fpdef ['=' test] (',' fpdef ['=' test])* [','] - */ - int i, j, k, n_args = 0, n_defaults = 0, found_default = 0; - asdl_seq *args, *defaults; - identifier vararg = NULL, kwarg = NULL; - node *ch; - - if (TYPE(n) == parameters) { - if (NCH(n) == 2) /* () as argument list */ - return arguments(NULL, NULL, NULL, NULL, c->c_arena); - n = CHILD(n, 1); - } - REQ(n, varargslist); - - /* first count the number of normal args & defaults */ - for (i = 0; i < NCH(n); i++) { - ch = CHILD(n, i); - if (TYPE(ch) == fpdef) - n_args++; - if (TYPE(ch) == EQUAL) - n_defaults++; - } - args = (n_args ? asdl_seq_new(n_args, c->c_arena) : NULL); - if (!args && n_args) - return NULL; - defaults = (n_defaults ? asdl_seq_new(n_defaults, c->c_arena) : NULL); - if (!defaults && n_defaults) - return NULL; - - /* fpdef: NAME | '(' fplist ')' - fplist: fpdef (',' fpdef)* [','] - */ - i = 0; - j = 0; /* index for defaults */ - k = 0; /* index for args */ - while (i < NCH(n)) { - ch = CHILD(n, i); - switch (TYPE(ch)) { - case fpdef: { - int complex_args = 0, parenthesized = 0; - handle_fpdef: - /* XXX Need to worry about checking if TYPE(CHILD(n, i+1)) is - anything other than EQUAL or a comma? */ - /* XXX Should NCH(n) check be made a separate check? */ - if (i + 1 < NCH(n) && TYPE(CHILD(n, i + 1)) == EQUAL) { - expr_ty expression = ast_for_expr(c, CHILD(n, i + 2)); - if (!expression) - return NULL; - assert(defaults != NULL); - asdl_seq_SET(defaults, j++, expression); - i += 2; - found_default = 1; - } - else if (found_default) { - /* def f((x)=4): pass should raise an error. - def f((x, (y))): pass will just incur the tuple unpacking warning. */ - if (parenthesized && !complex_args) { - ast_error(n, "parenthesized arg with default"); - return NULL; - } - ast_error(n, - "non-default argument follows default argument"); - return NULL; - } - if (NCH(ch) == 3) { - ch = CHILD(ch, 1); - /* def foo((x)): is not complex, special case. */ - if (NCH(ch) != 1) { - /* We have complex arguments, setup for unpacking. */ - if (Py_Py3kWarningFlag && !ast_warn(c, ch, - "tuple parameter unpacking has been removed in 3.x")) - return NULL; - complex_args = 1; - asdl_seq_SET(args, k++, compiler_complex_args(c, ch)); - if (!asdl_seq_GET(args, k-1)) - return NULL; - } else { - /* def foo((x)): setup for checking NAME below. */ - /* Loop because there can be many parens and tuple - unpacking mixed in. */ - parenthesized = 1; - ch = CHILD(ch, 0); - assert(TYPE(ch) == fpdef); - goto handle_fpdef; - } - } - if (TYPE(CHILD(ch, 0)) == NAME) { - PyObject *id; - expr_ty name; - if (!forbidden_check(c, n, STR(CHILD(ch, 0)))) - return NULL; - id = NEW_IDENTIFIER(CHILD(ch, 0)); - if (!id) - return NULL; - name = Name(id, Param, LINENO(ch), ch->n_col_offset, - c->c_arena); - if (!name) - return NULL; - asdl_seq_SET(args, k++, name); - - } - i += 2; /* the name and the comma */ - if (parenthesized && Py_Py3kWarningFlag && - !ast_warn(c, ch, "parenthesized argument names " - "are invalid in 3.x")) - return NULL; - - break; - } - case STAR: - if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) - return NULL; - vararg = NEW_IDENTIFIER(CHILD(n, i+1)); - if (!vararg) - return NULL; - i += 3; - break; - case DOUBLESTAR: - if (!forbidden_check(c, CHILD(n, i+1), STR(CHILD(n, i+1)))) - return NULL; - kwarg = NEW_IDENTIFIER(CHILD(n, i+1)); - if (!kwarg) - return NULL; - i += 3; - break; - default: - PyErr_Format(PyExc_SystemError, - "unexpected node in varargslist: %d @ %d", - TYPE(ch), i); - return NULL; - } - } - - return arguments(args, vararg, kwarg, defaults, c->c_arena); -} - -static expr_ty -ast_for_dotted_name(struct compiling *c, const node *n) -{ - expr_ty e; - identifier id; - int lineno, col_offset; - int i; - - REQ(n, dotted_name); - - lineno = LINENO(n); - col_offset = n->n_col_offset; - - id = NEW_IDENTIFIER(CHILD(n, 0)); - if (!id) - return NULL; - e = Name(id, Load, lineno, col_offset, c->c_arena); - if (!e) - return NULL; - - for (i = 2; i < NCH(n); i+=2) { - id = NEW_IDENTIFIER(CHILD(n, i)); - if (!id) - return NULL; - e = Attribute(e, id, Load, lineno, col_offset, c->c_arena); - if (!e) - return NULL; - } - - return e; -} - -static expr_ty -ast_for_decorator(struct compiling *c, const node *n) -{ - /* decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE */ - expr_ty d = NULL; - expr_ty name_expr; - - REQ(n, decorator); - REQ(CHILD(n, 0), AT); - REQ(RCHILD(n, -1), NEWLINE); - - name_expr = ast_for_dotted_name(c, CHILD(n, 1)); - if (!name_expr) - return NULL; - - if (NCH(n) == 3) { /* No arguments */ - d = name_expr; - name_expr = NULL; - } - else if (NCH(n) == 5) { /* Call with no arguments */ - d = Call(name_expr, NULL, NULL, NULL, NULL, LINENO(n), - n->n_col_offset, c->c_arena); - if (!d) - return NULL; - name_expr = NULL; - } - else { - d = ast_for_call(c, CHILD(n, 3), name_expr); - if (!d) - return NULL; - name_expr = NULL; - } - - return d; -} - -static asdl_seq* -ast_for_decorators(struct compiling *c, const node *n) -{ - asdl_seq* decorator_seq; - expr_ty d; - int i; - - REQ(n, decorators); - decorator_seq = asdl_seq_new(NCH(n), c->c_arena); - if (!decorator_seq) - return NULL; - - for (i = 0; i < NCH(n); i++) { - d = ast_for_decorator(c, CHILD(n, i)); - if (!d) - return NULL; - asdl_seq_SET(decorator_seq, i, d); - } - return decorator_seq; -} - -static stmt_ty -ast_for_funcdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) -{ - /* funcdef: 'def' NAME parameters ':' suite */ - identifier name; - arguments_ty args; - asdl_seq *body; - int name_i = 1; - - REQ(n, funcdef); - - name = NEW_IDENTIFIER(CHILD(n, name_i)); - if (!name) - return NULL; - else if (!forbidden_check(c, CHILD(n, name_i), STR(CHILD(n, name_i)))) - return NULL; - args = ast_for_arguments(c, CHILD(n, name_i + 1)); - if (!args) - return NULL; - body = ast_for_suite(c, CHILD(n, name_i + 3)); - if (!body) - return NULL; - - return FunctionDef(name, args, body, decorator_seq, LINENO(n), - n->n_col_offset, c->c_arena); -} - -static stmt_ty -ast_for_decorated(struct compiling *c, const node *n) -{ - /* decorated: decorators (classdef | funcdef) */ - stmt_ty thing = NULL; - asdl_seq *decorator_seq = NULL; - - REQ(n, decorated); - - decorator_seq = ast_for_decorators(c, CHILD(n, 0)); - if (!decorator_seq) - return NULL; - - assert(TYPE(CHILD(n, 1)) == funcdef || - TYPE(CHILD(n, 1)) == classdef); - - if (TYPE(CHILD(n, 1)) == funcdef) { - thing = ast_for_funcdef(c, CHILD(n, 1), decorator_seq); - } else if (TYPE(CHILD(n, 1)) == classdef) { - thing = ast_for_classdef(c, CHILD(n, 1), decorator_seq); - } - /* we count the decorators in when talking about the class' or - function's line number */ - if (thing) { - thing->lineno = LINENO(n); - thing->col_offset = n->n_col_offset; - } - return thing; -} - -static expr_ty -ast_for_lambdef(struct compiling *c, const node *n) -{ - /* lambdef: 'lambda' [varargslist] ':' test */ - arguments_ty args; - expr_ty expression; - - if (NCH(n) == 3) { - args = arguments(NULL, NULL, NULL, NULL, c->c_arena); - if (!args) - return NULL; - expression = ast_for_expr(c, CHILD(n, 2)); - if (!expression) - return NULL; - } - else { - args = ast_for_arguments(c, CHILD(n, 1)); - if (!args) - return NULL; - expression = ast_for_expr(c, CHILD(n, 3)); - if (!expression) - return NULL; - } - - return Lambda(args, expression, LINENO(n), n->n_col_offset, c->c_arena); -} - -static expr_ty -ast_for_ifexpr(struct compiling *c, const node *n) -{ - /* test: or_test 'if' or_test 'else' test */ - expr_ty expression, body, orelse; - - assert(NCH(n) == 5); - body = ast_for_expr(c, CHILD(n, 0)); - if (!body) - return NULL; - expression = ast_for_expr(c, CHILD(n, 2)); - if (!expression) - return NULL; - orelse = ast_for_expr(c, CHILD(n, 4)); - if (!orelse) - return NULL; - return IfExp(expression, body, orelse, LINENO(n), n->n_col_offset, - c->c_arena); -} - -/* XXX(nnorwitz): the listcomp and genexpr code should be refactored - so there is only a single version. Possibly for loops can also re-use - the code. -*/ - -/* Count the number of 'for' loop in a list comprehension. - - Helper for ast_for_listcomp(). -*/ - -static int -count_list_fors(struct compiling *c, const node *n) -{ - int n_fors = 0; - node *ch = CHILD(n, 1); - - count_list_for: - n_fors++; - REQ(ch, list_for); - if (NCH(ch) == 5) - ch = CHILD(ch, 4); - else - return n_fors; - count_list_iter: - REQ(ch, list_iter); - ch = CHILD(ch, 0); - if (TYPE(ch) == list_for) - goto count_list_for; - else if (TYPE(ch) == list_if) { - if (NCH(ch) == 3) { - ch = CHILD(ch, 2); - goto count_list_iter; - } - else - return n_fors; - } - - /* Should never be reached */ - PyErr_SetString(PyExc_SystemError, "logic error in count_list_fors"); - return -1; -} - -/* Count the number of 'if' statements in a list comprehension. - - Helper for ast_for_listcomp(). -*/ - -static int -count_list_ifs(struct compiling *c, const node *n) -{ - int n_ifs = 0; - - count_list_iter: - REQ(n, list_iter); - if (TYPE(CHILD(n, 0)) == list_for) - return n_ifs; - n = CHILD(n, 0); - REQ(n, list_if); - n_ifs++; - if (NCH(n) == 2) - return n_ifs; - n = CHILD(n, 2); - goto count_list_iter; -} - -static expr_ty -ast_for_listcomp(struct compiling *c, const node *n) -{ - /* listmaker: test ( list_for | (',' test)* [','] ) - list_for: 'for' exprlist 'in' testlist_safe [list_iter] - list_iter: list_for | list_if - list_if: 'if' test [list_iter] - testlist_safe: test [(',' test)+ [',']] - */ - expr_ty elt, first; - asdl_seq *listcomps; - int i, n_fors; - node *ch; - - REQ(n, listmaker); - assert(NCH(n) > 1); - - elt = ast_for_expr(c, CHILD(n, 0)); - if (!elt) - return NULL; - - n_fors = count_list_fors(c, n); - if (n_fors == -1) - return NULL; - - listcomps = asdl_seq_new(n_fors, c->c_arena); - if (!listcomps) - return NULL; - - ch = CHILD(n, 1); - for (i = 0; i < n_fors; i++) { - comprehension_ty lc; - asdl_seq *t; - expr_ty expression; - node *for_ch; - - REQ(ch, list_for); - - for_ch = CHILD(ch, 1); - t = ast_for_exprlist(c, for_ch, Store); - if (!t) - return NULL; - expression = ast_for_testlist(c, CHILD(ch, 3)); - if (!expression) - return NULL; - - /* Check the # of children rather than the length of t, since - [x for x, in ... ] has 1 element in t, but still requires a Tuple. - */ - first = (expr_ty)asdl_seq_GET(t, 0); - if (NCH(for_ch) == 1) - lc = comprehension(first, expression, NULL, c->c_arena); - else - lc = comprehension(Tuple(t, Store, first->lineno, first->col_offset, - c->c_arena), - expression, NULL, c->c_arena); - if (!lc) - return NULL; - - if (NCH(ch) == 5) { - int j, n_ifs; - asdl_seq *ifs; - expr_ty list_for_expr; - - ch = CHILD(ch, 4); - n_ifs = count_list_ifs(c, ch); - if (n_ifs == -1) - return NULL; - - ifs = asdl_seq_new(n_ifs, c->c_arena); - if (!ifs) - return NULL; - - for (j = 0; j < n_ifs; j++) { - REQ(ch, list_iter); - ch = CHILD(ch, 0); - REQ(ch, list_if); - - list_for_expr = ast_for_expr(c, CHILD(ch, 1)); - if (!list_for_expr) - return NULL; - - asdl_seq_SET(ifs, j, list_for_expr); - if (NCH(ch) == 3) - ch = CHILD(ch, 2); - } - /* on exit, must guarantee that ch is a list_for */ - if (TYPE(ch) == list_iter) - ch = CHILD(ch, 0); - lc->ifs = ifs; - } - asdl_seq_SET(listcomps, i, lc); - } - - return ListComp(elt, listcomps, LINENO(n), n->n_col_offset, c->c_arena); -} - -/* - Count the number of 'for' loops in a comprehension. - - Helper for ast_for_comprehension(). -*/ - -static int -count_comp_fors(struct compiling *c, const node *n) -{ - int n_fors = 0; - - count_comp_for: - n_fors++; - REQ(n, comp_for); - if (NCH(n) == 5) - n = CHILD(n, 4); - else - return n_fors; - count_comp_iter: - REQ(n, comp_iter); - n = CHILD(n, 0); - if (TYPE(n) == comp_for) - goto count_comp_for; - else if (TYPE(n) == comp_if) { - if (NCH(n) == 3) { - n = CHILD(n, 2); - goto count_comp_iter; - } - else - return n_fors; - } - - /* Should never be reached */ - PyErr_SetString(PyExc_SystemError, - "logic error in count_comp_fors"); - return -1; -} - -/* Count the number of 'if' statements in a comprehension. - - Helper for ast_for_comprehension(). -*/ - -static int -count_comp_ifs(struct compiling *c, const node *n) -{ - int n_ifs = 0; - - while (1) { - REQ(n, comp_iter); - if (TYPE(CHILD(n, 0)) == comp_for) - return n_ifs; - n = CHILD(n, 0); - REQ(n, comp_if); - n_ifs++; - if (NCH(n) == 2) - return n_ifs; - n = CHILD(n, 2); - } -} - -static asdl_seq * -ast_for_comprehension(struct compiling *c, const node *n) -{ - int i, n_fors; - asdl_seq *comps; - - n_fors = count_comp_fors(c, n); - if (n_fors == -1) - return NULL; - - comps = asdl_seq_new(n_fors, c->c_arena); - if (!comps) - return NULL; - - for (i = 0; i < n_fors; i++) { - comprehension_ty comp; - asdl_seq *t; - expr_ty expression, first; - node *for_ch; - - REQ(n, comp_for); - - for_ch = CHILD(n, 1); - t = ast_for_exprlist(c, for_ch, Store); - if (!t) - return NULL; - expression = ast_for_expr(c, CHILD(n, 3)); - if (!expression) - return NULL; - - /* Check the # of children rather than the length of t, since - (x for x, in ...) has 1 element in t, but still requires a Tuple. */ - first = (expr_ty)asdl_seq_GET(t, 0); - if (NCH(for_ch) == 1) - comp = comprehension(first, expression, NULL, c->c_arena); - else - comp = comprehension(Tuple(t, Store, first->lineno, first->col_offset, - c->c_arena), - expression, NULL, c->c_arena); - if (!comp) - return NULL; - - if (NCH(n) == 5) { - int j, n_ifs; - asdl_seq *ifs; - - n = CHILD(n, 4); - n_ifs = count_comp_ifs(c, n); - if (n_ifs == -1) - return NULL; - - ifs = asdl_seq_new(n_ifs, c->c_arena); - if (!ifs) - return NULL; - - for (j = 0; j < n_ifs; j++) { - REQ(n, comp_iter); - n = CHILD(n, 0); - REQ(n, comp_if); - - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - asdl_seq_SET(ifs, j, expression); - if (NCH(n) == 3) - n = CHILD(n, 2); - } - /* on exit, must guarantee that n is a comp_for */ - if (TYPE(n) == comp_iter) - n = CHILD(n, 0); - comp->ifs = ifs; - } - asdl_seq_SET(comps, i, comp); - } - return comps; -} - -static expr_ty -ast_for_itercomp(struct compiling *c, const node *n, int type) -{ - expr_ty elt; - asdl_seq *comps; - - assert(NCH(n) > 1); - - elt = ast_for_expr(c, CHILD(n, 0)); - if (!elt) - return NULL; - - comps = ast_for_comprehension(c, CHILD(n, 1)); - if (!comps) - return NULL; - - if (type == COMP_GENEXP) - return GeneratorExp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena); - else if (type == COMP_SETCOMP) - return SetComp(elt, comps, LINENO(n), n->n_col_offset, c->c_arena); - else - /* Should never happen */ - return NULL; -} - -static expr_ty -ast_for_dictcomp(struct compiling *c, const node *n) -{ - expr_ty key, value; - asdl_seq *comps; - - assert(NCH(n) > 3); - REQ(CHILD(n, 1), COLON); - - key = ast_for_expr(c, CHILD(n, 0)); - if (!key) - return NULL; - - value = ast_for_expr(c, CHILD(n, 2)); - if (!value) - return NULL; - - comps = ast_for_comprehension(c, CHILD(n, 3)); - if (!comps) - return NULL; - - return DictComp(key, value, comps, LINENO(n), n->n_col_offset, c->c_arena); -} - -static expr_ty -ast_for_genexp(struct compiling *c, const node *n) -{ - assert(TYPE(n) == (testlist_comp) || TYPE(n) == (argument)); - return ast_for_itercomp(c, n, COMP_GENEXP); -} - -static expr_ty -ast_for_setcomp(struct compiling *c, const node *n) -{ - assert(TYPE(n) == (dictorsetmaker)); - return ast_for_itercomp(c, n, COMP_SETCOMP); -} - -static expr_ty -ast_for_atom(struct compiling *c, const node *n) -{ - /* atom: '(' [yield_expr|testlist_comp] ')' | '[' [listmaker] ']' - | '{' [dictmaker] '}' | '`' testlist '`' | NAME | NUMBER | STRING+ - */ - node *ch = CHILD(n, 0); - - switch (TYPE(ch)) { - case NAME: { - /* All names start in Load context, but may later be - changed. */ - PyObject *name = NEW_IDENTIFIER(ch); - if (!name) - return NULL; - return Name(name, Load, LINENO(n), n->n_col_offset, c->c_arena); - } - case STRING: { - PyObject *str = parsestrplus(c, n); - if (!str) { -#ifdef Py_USING_UNICODE - if (PyErr_ExceptionMatches(PyExc_UnicodeError)){ - PyObject *type, *value, *tback, *errstr; - PyErr_Fetch(&type, &value, &tback); - errstr = PyObject_Str(value); - if (errstr) { - char *s = ""; - char buf[128]; - s = PyString_AsString(errstr); - PyOS_snprintf(buf, sizeof(buf), "(unicode error) %s", s); - ast_error(n, buf); - Py_DECREF(errstr); - } else { - ast_error(n, "(unicode error) unknown error"); - } - Py_DECREF(type); - Py_DECREF(value); - Py_XDECREF(tback); - } -#endif - return NULL; - } - PyArena_AddPyObject(c->c_arena, str); - return Str(str, LINENO(n), n->n_col_offset, c->c_arena); - } - case NUMBER: { - PyObject *pynum = parsenumber(c, STR(ch)); - if (!pynum) - return NULL; - - PyArena_AddPyObject(c->c_arena, pynum); - return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena); - } - case LPAR: /* some parenthesized expressions */ - ch = CHILD(n, 1); - - if (TYPE(ch) == RPAR) - return Tuple(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena); - - if (TYPE(ch) == yield_expr) - return ast_for_expr(c, ch); - - return ast_for_testlist_comp(c, ch); - case LSQB: /* list (or list comprehension) */ - ch = CHILD(n, 1); - - if (TYPE(ch) == RSQB) - return List(NULL, Load, LINENO(n), n->n_col_offset, c->c_arena); - - REQ(ch, listmaker); - if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) { - asdl_seq *elts = seq_for_testlist(c, ch); - if (!elts) - return NULL; - - return List(elts, Load, LINENO(n), n->n_col_offset, c->c_arena); - } - else - return ast_for_listcomp(c, ch); - case LBRACE: { - /* dictorsetmaker: - * (test ':' test (comp_for | (',' test ':' test)* [','])) | - * (test (comp_for | (',' test)* [','])) - */ - int i, size; - asdl_seq *keys, *values; - - ch = CHILD(n, 1); - if (TYPE(ch) == RBRACE) { - /* it's an empty dict */ - return Dict(NULL, NULL, LINENO(n), n->n_col_offset, c->c_arena); - } else if (NCH(ch) == 1 || TYPE(CHILD(ch, 1)) == COMMA) { - /* it's a simple set */ - asdl_seq *elts; - size = (NCH(ch) + 1) / 2; /* +1 in case no trailing comma */ - elts = asdl_seq_new(size, c->c_arena); - if (!elts) - return NULL; - for (i = 0; i < NCH(ch); i += 2) { - expr_ty expression; - expression = ast_for_expr(c, CHILD(ch, i)); - if (!expression) - return NULL; - asdl_seq_SET(elts, i / 2, expression); - } - return Set(elts, LINENO(n), n->n_col_offset, c->c_arena); - } else if (TYPE(CHILD(ch, 1)) == comp_for) { - /* it's a set comprehension */ - return ast_for_setcomp(c, ch); - } else if (NCH(ch) > 3 && TYPE(CHILD(ch, 3)) == comp_for) { - return ast_for_dictcomp(c, ch); - } else { - /* it's a dict */ - size = (NCH(ch) + 1) / 4; /* +1 in case no trailing comma */ - keys = asdl_seq_new(size, c->c_arena); - if (!keys) - return NULL; - - values = asdl_seq_new(size, c->c_arena); - if (!values) - return NULL; - - for (i = 0; i < NCH(ch); i += 4) { - expr_ty expression; - - expression = ast_for_expr(c, CHILD(ch, i)); - if (!expression) - return NULL; - - asdl_seq_SET(keys, i / 4, expression); - - expression = ast_for_expr(c, CHILD(ch, i + 2)); - if (!expression) - return NULL; - - asdl_seq_SET(values, i / 4, expression); - } - return Dict(keys, values, LINENO(n), n->n_col_offset, c->c_arena); - } - } - case BACKQUOTE: { /* repr */ - expr_ty expression; - if (Py_Py3kWarningFlag && - !ast_warn(c, n, "backquote not supported in 3.x; use repr()")) - return NULL; - expression = ast_for_testlist(c, CHILD(n, 1)); - if (!expression) - return NULL; - - return Repr(expression, LINENO(n), n->n_col_offset, c->c_arena); - } - default: - PyErr_Format(PyExc_SystemError, "unhandled atom %d", TYPE(ch)); - return NULL; - } -} - -static slice_ty -ast_for_slice(struct compiling *c, const node *n) -{ - node *ch; - expr_ty lower = NULL, upper = NULL, step = NULL; - - REQ(n, subscript); - - /* - subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] - sliceop: ':' [test] - */ - ch = CHILD(n, 0); - if (TYPE(ch) == DOT) - return Ellipsis(c->c_arena); - - if (NCH(n) == 1 && TYPE(ch) == test) { - /* 'step' variable hold no significance in terms of being used over - other vars */ - step = ast_for_expr(c, ch); - if (!step) - return NULL; - - return Index(step, c->c_arena); - } - - if (TYPE(ch) == test) { - lower = ast_for_expr(c, ch); - if (!lower) - return NULL; - } - - /* If there's an upper bound it's in the second or third position. */ - if (TYPE(ch) == COLON) { - if (NCH(n) > 1) { - node *n2 = CHILD(n, 1); - - if (TYPE(n2) == test) { - upper = ast_for_expr(c, n2); - if (!upper) - return NULL; - } - } - } else if (NCH(n) > 2) { - node *n2 = CHILD(n, 2); - - if (TYPE(n2) == test) { - upper = ast_for_expr(c, n2); - if (!upper) - return NULL; - } - } - - ch = CHILD(n, NCH(n) - 1); - if (TYPE(ch) == sliceop) { - if (NCH(ch) == 1) { - /* - This is an extended slice (ie "x[::]") with no expression in the - step field. We set this literally to "None" in order to - disambiguate it from x[:]. (The interpreter might have to call - __getslice__ for x[:], but it must call __getitem__ for x[::].) - */ - identifier none = new_identifier("None", c->c_arena); - if (!none) - return NULL; - ch = CHILD(ch, 0); - step = Name(none, Load, LINENO(ch), ch->n_col_offset, c->c_arena); - if (!step) - return NULL; - } else { - ch = CHILD(ch, 1); - if (TYPE(ch) == test) { - step = ast_for_expr(c, ch); - if (!step) - return NULL; - } - } - } - - return Slice(lower, upper, step, c->c_arena); -} - -static expr_ty -ast_for_binop(struct compiling *c, const node *n) -{ - /* Must account for a sequence of expressions. - How should A op B op C by represented? - BinOp(BinOp(A, op, B), op, C). - */ - - int i, nops; - expr_ty expr1, expr2, result; - operator_ty newoperator; - - expr1 = ast_for_expr(c, CHILD(n, 0)); - if (!expr1) - return NULL; - - expr2 = ast_for_expr(c, CHILD(n, 2)); - if (!expr2) - return NULL; - - newoperator = get_operator(CHILD(n, 1)); - if (!newoperator) - return NULL; - - result = BinOp(expr1, newoperator, expr2, LINENO(n), n->n_col_offset, - c->c_arena); - if (!result) - return NULL; - - nops = (NCH(n) - 1) / 2; - for (i = 1; i < nops; i++) { - expr_ty tmp_result, tmp; - const node* next_oper = CHILD(n, i * 2 + 1); - - newoperator = get_operator(next_oper); - if (!newoperator) - return NULL; - - tmp = ast_for_expr(c, CHILD(n, i * 2 + 2)); - if (!tmp) - return NULL; - - tmp_result = BinOp(result, newoperator, tmp, - LINENO(next_oper), next_oper->n_col_offset, - c->c_arena); - if (!tmp_result) - return NULL; - result = tmp_result; - } - return result; -} - -static expr_ty -ast_for_trailer(struct compiling *c, const node *n, expr_ty left_expr) -{ - /* trailer: '(' [arglist] ')' | '[' subscriptlist ']' | '.' NAME - subscriptlist: subscript (',' subscript)* [','] - subscript: '.' '.' '.' | test | [test] ':' [test] [sliceop] - */ - REQ(n, trailer); - if (TYPE(CHILD(n, 0)) == LPAR) { - if (NCH(n) == 2) - return Call(left_expr, NULL, NULL, NULL, NULL, LINENO(n), - n->n_col_offset, c->c_arena); - else - return ast_for_call(c, CHILD(n, 1), left_expr); - } - else if (TYPE(CHILD(n, 0)) == DOT ) { - PyObject *attr_id = NEW_IDENTIFIER(CHILD(n, 1)); - if (!attr_id) - return NULL; - return Attribute(left_expr, attr_id, Load, - LINENO(n), n->n_col_offset, c->c_arena); - } - else { - REQ(CHILD(n, 0), LSQB); - REQ(CHILD(n, 2), RSQB); - n = CHILD(n, 1); - if (NCH(n) == 1) { - slice_ty slc = ast_for_slice(c, CHILD(n, 0)); - if (!slc) - return NULL; - return Subscript(left_expr, slc, Load, LINENO(n), n->n_col_offset, - c->c_arena); - } - else { - /* The grammar is ambiguous here. The ambiguity is resolved - by treating the sequence as a tuple literal if there are - no slice features. - */ - int j; - slice_ty slc; - expr_ty e; - bool simple = true; - asdl_seq *slices, *elts; - slices = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); - if (!slices) - return NULL; - for (j = 0; j < NCH(n); j += 2) { - slc = ast_for_slice(c, CHILD(n, j)); - if (!slc) - return NULL; - if (slc->kind != Index_kind) - simple = false; - asdl_seq_SET(slices, j / 2, slc); - } - if (!simple) { - return Subscript(left_expr, ExtSlice(slices, c->c_arena), - Load, LINENO(n), n->n_col_offset, c->c_arena); - } - /* extract Index values and put them in a Tuple */ - elts = asdl_seq_new(asdl_seq_LEN(slices), c->c_arena); - if (!elts) - return NULL; - for (j = 0; j < asdl_seq_LEN(slices); ++j) { - slc = (slice_ty)asdl_seq_GET(slices, j); - assert(slc->kind == Index_kind && slc->v.Index.value); - asdl_seq_SET(elts, j, slc->v.Index.value); - } - e = Tuple(elts, Load, LINENO(n), n->n_col_offset, c->c_arena); - if (!e) - return NULL; - return Subscript(left_expr, Index(e, c->c_arena), - Load, LINENO(n), n->n_col_offset, c->c_arena); - } - } -} - -static expr_ty -ast_for_factor(struct compiling *c, const node *n) -{ - node *pfactor, *ppower, *patom, *pnum; - expr_ty expression; - - /* If the unary - operator is applied to a constant, don't generate - a UNARY_NEGATIVE opcode. Just store the approriate value as a - constant. The peephole optimizer already does something like - this but it doesn't handle the case where the constant is - (sys.maxint - 1). In that case, we want a PyIntObject, not a - PyLongObject. - */ - if (TYPE(CHILD(n, 0)) == MINUS && - NCH(n) == 2 && - TYPE((pfactor = CHILD(n, 1))) == factor && - NCH(pfactor) == 1 && - TYPE((ppower = CHILD(pfactor, 0))) == power && - NCH(ppower) == 1 && - TYPE((patom = CHILD(ppower, 0))) == atom && - TYPE((pnum = CHILD(patom, 0))) == NUMBER) { - PyObject *pynum; - char *s = PyObject_MALLOC(strlen(STR(pnum)) + 2); - if (s == NULL) - return NULL; - s[0] = '-'; - strcpy(s + 1, STR(pnum)); - pynum = parsenumber(c, s); - PyObject_FREE(s); - if (!pynum) - return NULL; - - PyArena_AddPyObject(c->c_arena, pynum); - return Num(pynum, LINENO(n), n->n_col_offset, c->c_arena); - } - - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - - switch (TYPE(CHILD(n, 0))) { - case PLUS: - return UnaryOp(UAdd, expression, LINENO(n), n->n_col_offset, - c->c_arena); - case MINUS: - return UnaryOp(USub, expression, LINENO(n), n->n_col_offset, - c->c_arena); - case TILDE: - return UnaryOp(Invert, expression, LINENO(n), - n->n_col_offset, c->c_arena); - } - PyErr_Format(PyExc_SystemError, "unhandled factor: %d", - TYPE(CHILD(n, 0))); - return NULL; -} - -static expr_ty -ast_for_power(struct compiling *c, const node *n) -{ - /* power: atom trailer* ('**' factor)* - */ - int i; - expr_ty e, tmp; - REQ(n, power); - e = ast_for_atom(c, CHILD(n, 0)); - if (!e) - return NULL; - if (NCH(n) == 1) - return e; - for (i = 1; i < NCH(n); i++) { - node *ch = CHILD(n, i); - if (TYPE(ch) != trailer) - break; - tmp = ast_for_trailer(c, ch, e); - if (!tmp) - return NULL; - tmp->lineno = e->lineno; - tmp->col_offset = e->col_offset; - e = tmp; - } - if (TYPE(CHILD(n, NCH(n) - 1)) == factor) { - expr_ty f = ast_for_expr(c, CHILD(n, NCH(n) - 1)); - if (!f) - return NULL; - tmp = BinOp(e, Pow, f, LINENO(n), n->n_col_offset, c->c_arena); - if (!tmp) - return NULL; - e = tmp; - } - return e; -} - -/* Do not name a variable 'expr'! Will cause a compile error. -*/ - -static expr_ty -ast_for_expr(struct compiling *c, const node *n) -{ - /* handle the full range of simple expressions - test: or_test ['if' or_test 'else' test] | lambdef - or_test: and_test ('or' and_test)* - and_test: not_test ('and' not_test)* - not_test: 'not' not_test | comparison - comparison: expr (comp_op expr)* - expr: xor_expr ('|' xor_expr)* - xor_expr: and_expr ('^' and_expr)* - and_expr: shift_expr ('&' shift_expr)* - shift_expr: arith_expr (('<<'|'>>') arith_expr)* - arith_expr: term (('+'|'-') term)* - term: factor (('*'|'/'|'%'|'//') factor)* - factor: ('+'|'-'|'~') factor | power - power: atom trailer* ('**' factor)* - - As well as modified versions that exist for backward compatibility, - to explicitly allow: - [ x for x in lambda: 0, lambda: 1 ] - (which would be ambiguous without these extra rules) - - old_test: or_test | old_lambdef - old_lambdef: 'lambda' [vararglist] ':' old_test - - */ - - asdl_seq *seq; - int i; - - loop: - switch (TYPE(n)) { - case test: - case old_test: - if (TYPE(CHILD(n, 0)) == lambdef || - TYPE(CHILD(n, 0)) == old_lambdef) - return ast_for_lambdef(c, CHILD(n, 0)); - else if (NCH(n) > 1) - return ast_for_ifexpr(c, n); - /* Fallthrough */ - case or_test: - case and_test: - if (NCH(n) == 1) { - n = CHILD(n, 0); - goto loop; - } - seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); - if (!seq) - return NULL; - for (i = 0; i < NCH(n); i += 2) { - expr_ty e = ast_for_expr(c, CHILD(n, i)); - if (!e) - return NULL; - asdl_seq_SET(seq, i / 2, e); - } - if (!strcmp(STR(CHILD(n, 1)), "and")) - return BoolOp(And, seq, LINENO(n), n->n_col_offset, - c->c_arena); - assert(!strcmp(STR(CHILD(n, 1)), "or")); - return BoolOp(Or, seq, LINENO(n), n->n_col_offset, c->c_arena); - case not_test: - if (NCH(n) == 1) { - n = CHILD(n, 0); - goto loop; - } - else { - expr_ty expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - - return UnaryOp(Not, expression, LINENO(n), n->n_col_offset, - c->c_arena); - } - case comparison: - if (NCH(n) == 1) { - n = CHILD(n, 0); - goto loop; - } - else { - expr_ty expression; - asdl_int_seq *ops; - asdl_seq *cmps; - ops = asdl_int_seq_new(NCH(n) / 2, c->c_arena); - if (!ops) - return NULL; - cmps = asdl_seq_new(NCH(n) / 2, c->c_arena); - if (!cmps) { - return NULL; - } - for (i = 1; i < NCH(n); i += 2) { - cmpop_ty newoperator; - - newoperator = ast_for_comp_op(c, CHILD(n, i)); - if (!newoperator) { - return NULL; - } - - expression = ast_for_expr(c, CHILD(n, i + 1)); - if (!expression) { - return NULL; - } - - asdl_seq_SET(ops, i / 2, newoperator); - asdl_seq_SET(cmps, i / 2, expression); - } - expression = ast_for_expr(c, CHILD(n, 0)); - if (!expression) { - return NULL; - } - - return Compare(expression, ops, cmps, LINENO(n), - n->n_col_offset, c->c_arena); - } - break; - - /* The next five cases all handle BinOps. The main body of code - is the same in each case, but the switch turned inside out to - reuse the code for each type of operator. - */ - case expr: - case xor_expr: - case and_expr: - case shift_expr: - case arith_expr: - case term: - if (NCH(n) == 1) { - n = CHILD(n, 0); - goto loop; - } - return ast_for_binop(c, n); - case yield_expr: { - expr_ty exp = NULL; - if (NCH(n) == 2) { - exp = ast_for_testlist(c, CHILD(n, 1)); - if (!exp) - return NULL; - } - return Yield(exp, LINENO(n), n->n_col_offset, c->c_arena); - } - case factor: - if (NCH(n) == 1) { - n = CHILD(n, 0); - goto loop; - } - return ast_for_factor(c, n); - case power: - return ast_for_power(c, n); - default: - PyErr_Format(PyExc_SystemError, "unhandled expr: %d", TYPE(n)); - return NULL; - } - /* should never get here unless if error is set */ - return NULL; -} - -static expr_ty -ast_for_call(struct compiling *c, const node *n, expr_ty func) -{ - /* - arglist: (argument ',')* (argument [',']| '*' test [',' '**' test] - | '**' test) - argument: [test '='] test [comp_for] # Really [keyword '='] test - */ - - int i, nargs, nkeywords, ngens; - asdl_seq *args; - asdl_seq *keywords; - expr_ty vararg = NULL, kwarg = NULL; - - REQ(n, arglist); - - nargs = 0; - nkeywords = 0; - ngens = 0; - for (i = 0; i < NCH(n); i++) { - node *ch = CHILD(n, i); - if (TYPE(ch) == argument) { - if (NCH(ch) == 1) - nargs++; - else if (TYPE(CHILD(ch, 1)) == comp_for) - ngens++; - else - nkeywords++; - } - } - if (ngens > 1 || (ngens && (nargs || nkeywords))) { - ast_error(n, "Generator expression must be parenthesized " - "if not sole argument"); - return NULL; - } - - if (nargs + nkeywords + ngens > 255) { - ast_error(n, "more than 255 arguments"); - return NULL; - } - - args = asdl_seq_new(nargs + ngens, c->c_arena); - if (!args) - return NULL; - keywords = asdl_seq_new(nkeywords, c->c_arena); - if (!keywords) - return NULL; - nargs = 0; - nkeywords = 0; - for (i = 0; i < NCH(n); i++) { - node *ch = CHILD(n, i); - if (TYPE(ch) == argument) { - expr_ty e; - if (NCH(ch) == 1) { - if (nkeywords) { - ast_error(CHILD(ch, 0), - "non-keyword arg after keyword arg"); - return NULL; - } - if (vararg) { - ast_error(CHILD(ch, 0), - "only named arguments may follow *expression"); - return NULL; - } - e = ast_for_expr(c, CHILD(ch, 0)); - if (!e) - return NULL; - asdl_seq_SET(args, nargs++, e); - } - else if (TYPE(CHILD(ch, 1)) == comp_for) { - e = ast_for_genexp(c, ch); - if (!e) - return NULL; - asdl_seq_SET(args, nargs++, e); - } - else { - keyword_ty kw; - identifier key; - int k; - char *tmp; - - /* CHILD(ch, 0) is test, but must be an identifier? */ - e = ast_for_expr(c, CHILD(ch, 0)); - if (!e) - return NULL; - /* f(lambda x: x[0] = 3) ends up getting parsed with - * LHS test = lambda x: x[0], and RHS test = 3. - * SF bug 132313 points out that complaining about a keyword - * then is very confusing. - */ - if (e->kind == Lambda_kind) { - ast_error(CHILD(ch, 0), - "lambda cannot contain assignment"); - return NULL; - } else if (e->kind != Name_kind) { - ast_error(CHILD(ch, 0), "keyword can't be an expression"); - return NULL; - } - key = e->v.Name.id; - if (!forbidden_check(c, CHILD(ch, 0), PyBytes_AS_STRING(key))) - return NULL; - for (k = 0; k < nkeywords; k++) { - tmp = PyString_AS_STRING( - ((keyword_ty)asdl_seq_GET(keywords, k))->arg); - if (!strcmp(tmp, PyString_AS_STRING(key))) { - ast_error(CHILD(ch, 0), "keyword argument repeated"); - return NULL; - } - } - e = ast_for_expr(c, CHILD(ch, 2)); - if (!e) - return NULL; - kw = keyword(key, e, c->c_arena); - if (!kw) - return NULL; - asdl_seq_SET(keywords, nkeywords++, kw); - } - } - else if (TYPE(ch) == STAR) { - vararg = ast_for_expr(c, CHILD(n, i+1)); - if (!vararg) - return NULL; - i++; - } - else if (TYPE(ch) == DOUBLESTAR) { - kwarg = ast_for_expr(c, CHILD(n, i+1)); - if (!kwarg) - return NULL; - i++; - } - } - - return Call(func, args, keywords, vararg, kwarg, func->lineno, - func->col_offset, c->c_arena); -} - -static expr_ty -ast_for_testlist(struct compiling *c, const node* n) -{ - /* testlist_comp: test (',' test)* [','] */ - /* testlist: test (',' test)* [','] */ - /* testlist_safe: test (',' test)+ [','] */ - /* testlist1: test (',' test)* */ - assert(NCH(n) > 0); - if (TYPE(n) == testlist_comp) { - if (NCH(n) > 1) - assert(TYPE(CHILD(n, 1)) != comp_for); - } - else { - assert(TYPE(n) == testlist || - TYPE(n) == testlist_safe || - TYPE(n) == testlist1); - } - if (NCH(n) == 1) - return ast_for_expr(c, CHILD(n, 0)); - else { - asdl_seq *tmp = seq_for_testlist(c, n); - if (!tmp) - return NULL; - return Tuple(tmp, Load, LINENO(n), n->n_col_offset, c->c_arena); - } -} - -static expr_ty -ast_for_testlist_comp(struct compiling *c, const node* n) -{ - /* testlist_comp: test ( comp_for | (',' test)* [','] ) */ - /* argument: test [ comp_for ] */ - assert(TYPE(n) == testlist_comp || TYPE(n) == argument); - if (NCH(n) > 1 && TYPE(CHILD(n, 1)) == comp_for) - return ast_for_genexp(c, n); - return ast_for_testlist(c, n); -} - -/* like ast_for_testlist() but returns a sequence */ -static asdl_seq* -ast_for_class_bases(struct compiling *c, const node* n) -{ - /* testlist: test (',' test)* [','] */ - assert(NCH(n) > 0); - REQ(n, testlist); - if (NCH(n) == 1) { - expr_ty base; - asdl_seq *bases = asdl_seq_new(1, c->c_arena); - if (!bases) - return NULL; - base = ast_for_expr(c, CHILD(n, 0)); - if (!base) - return NULL; - asdl_seq_SET(bases, 0, base); - return bases; - } - - return seq_for_testlist(c, n); -} - -static stmt_ty -ast_for_expr_stmt(struct compiling *c, const node *n) -{ - REQ(n, expr_stmt); - /* expr_stmt: testlist (augassign (yield_expr|testlist) - | ('=' (yield_expr|testlist))*) - testlist: test (',' test)* [','] - augassign: '+=' | '-=' | '*=' | '/=' | '%=' | '&=' | '|=' | '^=' - | '<<=' | '>>=' | '**=' | '//=' - test: ... here starts the operator precendence dance - */ - - if (NCH(n) == 1) { - expr_ty e = ast_for_testlist(c, CHILD(n, 0)); - if (!e) - return NULL; - - return Expr(e, LINENO(n), n->n_col_offset, c->c_arena); - } - else if (TYPE(CHILD(n, 1)) == augassign) { - expr_ty expr1, expr2; - operator_ty newoperator; - node *ch = CHILD(n, 0); - - expr1 = ast_for_testlist(c, ch); - if (!expr1) - return NULL; - if(!set_context(c, expr1, Store, ch)) - return NULL; - /* set_context checks that most expressions are not the left side. - Augmented assignments can only have a name, a subscript, or an - attribute on the left, though, so we have to explicitly check for - those. */ - switch (expr1->kind) { - case Name_kind: - case Attribute_kind: - case Subscript_kind: - break; - default: - ast_error(ch, "illegal expression for augmented assignment"); - return NULL; - } - - ch = CHILD(n, 2); - if (TYPE(ch) == testlist) - expr2 = ast_for_testlist(c, ch); - else - expr2 = ast_for_expr(c, ch); - if (!expr2) - return NULL; - - newoperator = ast_for_augassign(c, CHILD(n, 1)); - if (!newoperator) - return NULL; - - return AugAssign(expr1, newoperator, expr2, LINENO(n), n->n_col_offset, - c->c_arena); - } - else { - int i; - asdl_seq *targets; - node *value; - expr_ty expression; - - /* a normal assignment */ - REQ(CHILD(n, 1), EQUAL); - targets = asdl_seq_new(NCH(n) / 2, c->c_arena); - if (!targets) - return NULL; - for (i = 0; i < NCH(n) - 2; i += 2) { - expr_ty e; - node *ch = CHILD(n, i); - if (TYPE(ch) == yield_expr) { - ast_error(ch, "assignment to yield expression not possible"); - return NULL; - } - e = ast_for_testlist(c, ch); - if (!e) - return NULL; - - /* set context to assign */ - if (!set_context(c, e, Store, CHILD(n, i))) - return NULL; - - asdl_seq_SET(targets, i / 2, e); - } - value = CHILD(n, NCH(n) - 1); - if (TYPE(value) == testlist) - expression = ast_for_testlist(c, value); - else - expression = ast_for_expr(c, value); - if (!expression) - return NULL; - return Assign(targets, expression, LINENO(n), n->n_col_offset, - c->c_arena); - } -} - -static stmt_ty -ast_for_print_stmt(struct compiling *c, const node *n) -{ - /* print_stmt: 'print' ( [ test (',' test)* [','] ] - | '>>' test [ (',' test)+ [','] ] ) - */ - expr_ty dest = NULL, expression; - asdl_seq *seq = NULL; - bool nl; - int i, j, values_count, start = 1; - - REQ(n, print_stmt); - if (NCH(n) >= 2 && TYPE(CHILD(n, 1)) == RIGHTSHIFT) { - dest = ast_for_expr(c, CHILD(n, 2)); - if (!dest) - return NULL; - start = 4; - } - values_count = (NCH(n) + 1 - start) / 2; - if (values_count) { - seq = asdl_seq_new(values_count, c->c_arena); - if (!seq) - return NULL; - for (i = start, j = 0; i < NCH(n); i += 2, ++j) { - expression = ast_for_expr(c, CHILD(n, i)); - if (!expression) - return NULL; - asdl_seq_SET(seq, j, expression); - } - } - nl = (TYPE(CHILD(n, NCH(n) - 1)) == COMMA) ? false : true; - return Print(dest, seq, nl, LINENO(n), n->n_col_offset, c->c_arena); -} - -static asdl_seq * -ast_for_exprlist(struct compiling *c, const node *n, expr_context_ty context) -{ - asdl_seq *seq; - int i; - expr_ty e; - - REQ(n, exprlist); - - seq = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); - if (!seq) - return NULL; - for (i = 0; i < NCH(n); i += 2) { - e = ast_for_expr(c, CHILD(n, i)); - if (!e) - return NULL; - asdl_seq_SET(seq, i / 2, e); - if (context && !set_context(c, e, context, CHILD(n, i))) - return NULL; - } - return seq; -} - -static stmt_ty -ast_for_del_stmt(struct compiling *c, const node *n) -{ - asdl_seq *expr_list; - - /* del_stmt: 'del' exprlist */ - REQ(n, del_stmt); - - expr_list = ast_for_exprlist(c, CHILD(n, 1), Del); - if (!expr_list) - return NULL; - return Delete(expr_list, LINENO(n), n->n_col_offset, c->c_arena); -} - -static stmt_ty -ast_for_flow_stmt(struct compiling *c, const node *n) -{ - /* - flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt - | yield_stmt - break_stmt: 'break' - continue_stmt: 'continue' - return_stmt: 'return' [testlist] - yield_stmt: yield_expr - yield_expr: 'yield' testlist - raise_stmt: 'raise' [test [',' test [',' test]]] - */ - node *ch; - - REQ(n, flow_stmt); - ch = CHILD(n, 0); - switch (TYPE(ch)) { - case break_stmt: - return Break(LINENO(n), n->n_col_offset, c->c_arena); - case continue_stmt: - return Continue(LINENO(n), n->n_col_offset, c->c_arena); - case yield_stmt: { /* will reduce to yield_expr */ - expr_ty exp = ast_for_expr(c, CHILD(ch, 0)); - if (!exp) - return NULL; - return Expr(exp, LINENO(n), n->n_col_offset, c->c_arena); - } - case return_stmt: - if (NCH(ch) == 1) - return Return(NULL, LINENO(n), n->n_col_offset, c->c_arena); - else { - expr_ty expression = ast_for_testlist(c, CHILD(ch, 1)); - if (!expression) - return NULL; - return Return(expression, LINENO(n), n->n_col_offset, - c->c_arena); - } - case raise_stmt: - if (NCH(ch) == 1) - return Raise(NULL, NULL, NULL, LINENO(n), n->n_col_offset, - c->c_arena); - else if (NCH(ch) == 2) { - expr_ty expression = ast_for_expr(c, CHILD(ch, 1)); - if (!expression) - return NULL; - return Raise(expression, NULL, NULL, LINENO(n), - n->n_col_offset, c->c_arena); - } - else if (NCH(ch) == 4) { - expr_ty expr1, expr2; - - expr1 = ast_for_expr(c, CHILD(ch, 1)); - if (!expr1) - return NULL; - expr2 = ast_for_expr(c, CHILD(ch, 3)); - if (!expr2) - return NULL; - - return Raise(expr1, expr2, NULL, LINENO(n), n->n_col_offset, - c->c_arena); - } - else if (NCH(ch) == 6) { - expr_ty expr1, expr2, expr3; - - expr1 = ast_for_expr(c, CHILD(ch, 1)); - if (!expr1) - return NULL; - expr2 = ast_for_expr(c, CHILD(ch, 3)); - if (!expr2) - return NULL; - expr3 = ast_for_expr(c, CHILD(ch, 5)); - if (!expr3) - return NULL; - - return Raise(expr1, expr2, expr3, LINENO(n), n->n_col_offset, - c->c_arena); - } - default: - PyErr_Format(PyExc_SystemError, - "unexpected flow_stmt: %d", TYPE(ch)); - return NULL; - } - - PyErr_SetString(PyExc_SystemError, "unhandled flow statement"); - return NULL; -} - -static alias_ty -alias_for_import_name(struct compiling *c, const node *n, int store) -{ - /* - import_as_name: NAME ['as' NAME] - dotted_as_name: dotted_name ['as' NAME] - dotted_name: NAME ('.' NAME)* - */ - PyObject *str, *name; - - loop: - switch (TYPE(n)) { - case import_as_name: { - node *name_node = CHILD(n, 0); - str = NULL; - if (NCH(n) == 3) { - node *str_node = CHILD(n, 2); - if (store && !forbidden_check(c, str_node, STR(str_node))) - return NULL; - str = NEW_IDENTIFIER(str_node); - if (!str) - return NULL; - } - else { - if (!forbidden_check(c, name_node, STR(name_node))) - return NULL; - } - name = NEW_IDENTIFIER(name_node); - if (!name) - return NULL; - return alias(name, str, c->c_arena); - } - case dotted_as_name: - if (NCH(n) == 1) { - n = CHILD(n, 0); - goto loop; - } - else { - node *asname_node = CHILD(n, 2); - alias_ty a = alias_for_import_name(c, CHILD(n, 0), 0); - if (!a) - return NULL; - assert(!a->asname); - if (!forbidden_check(c, asname_node, STR(asname_node))) - return NULL; - a->asname = NEW_IDENTIFIER(asname_node); - if (!a->asname) - return NULL; - return a; - } - break; - case dotted_name: - if (NCH(n) == 1) { - node *name_node = CHILD(n, 0); - if (store && !forbidden_check(c, name_node, STR(name_node))) - return NULL; - name = NEW_IDENTIFIER(name_node); - if (!name) - return NULL; - return alias(name, NULL, c->c_arena); - } - else { - /* Create a string of the form "a.b.c" */ - int i; - size_t len; - char *s; - - len = 0; - for (i = 0; i < NCH(n); i += 2) - /* length of string plus one for the dot */ - len += strlen(STR(CHILD(n, i))) + 1; - len--; /* the last name doesn't have a dot */ - str = PyString_FromStringAndSize(NULL, len); - if (!str) - return NULL; - s = PyString_AS_STRING(str); - if (!s) - return NULL; - for (i = 0; i < NCH(n); i += 2) { - char *sch = STR(CHILD(n, i)); - strcpy(s, STR(CHILD(n, i))); - s += strlen(sch); - *s++ = '.'; - } - --s; - *s = '\0'; - PyString_InternInPlace(&str); - PyArena_AddPyObject(c->c_arena, str); - return alias(str, NULL, c->c_arena); - } - break; - case STAR: - str = PyString_InternFromString("*"); - PyArena_AddPyObject(c->c_arena, str); - return alias(str, NULL, c->c_arena); - default: - PyErr_Format(PyExc_SystemError, - "unexpected import name: %d", TYPE(n)); - return NULL; - } - - PyErr_SetString(PyExc_SystemError, "unhandled import name condition"); - return NULL; -} - -static stmt_ty -ast_for_import_stmt(struct compiling *c, const node *n) -{ - /* - import_stmt: import_name | import_from - import_name: 'import' dotted_as_names - import_from: 'from' ('.'* dotted_name | '.') 'import' - ('*' | '(' import_as_names ')' | import_as_names) - */ - int lineno; - int col_offset; - int i; - asdl_seq *aliases; - - REQ(n, import_stmt); - lineno = LINENO(n); - col_offset = n->n_col_offset; - n = CHILD(n, 0); - if (TYPE(n) == import_name) { - n = CHILD(n, 1); - REQ(n, dotted_as_names); - aliases = asdl_seq_new((NCH(n) + 1) / 2, c->c_arena); - if (!aliases) - return NULL; - for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); - if (!import_alias) - return NULL; - asdl_seq_SET(aliases, i / 2, import_alias); - } - return Import(aliases, lineno, col_offset, c->c_arena); - } - else if (TYPE(n) == import_from) { - int n_children; - int idx, ndots = 0; - alias_ty mod = NULL; - identifier modname = NULL; - - /* Count the number of dots (for relative imports) and check for the - optional module name */ - for (idx = 1; idx < NCH(n); idx++) { - if (TYPE(CHILD(n, idx)) == dotted_name) { - mod = alias_for_import_name(c, CHILD(n, idx), 0); - if (!mod) - return NULL; - idx++; - break; - } else if (TYPE(CHILD(n, idx)) != DOT) { - break; - } - ndots++; - } - idx++; /* skip over the 'import' keyword */ - switch (TYPE(CHILD(n, idx))) { - case STAR: - /* from ... import * */ - n = CHILD(n, idx); - n_children = 1; - break; - case LPAR: - /* from ... import (x, y, z) */ - n = CHILD(n, idx + 1); - n_children = NCH(n); - break; - case import_as_names: - /* from ... import x, y, z */ - n = CHILD(n, idx); - n_children = NCH(n); - if (n_children % 2 == 0) { - ast_error(n, "trailing comma not allowed without" - " surrounding parentheses"); - return NULL; - } - break; - default: - ast_error(n, "Unexpected node-type in from-import"); - return NULL; - } - - aliases = asdl_seq_new((n_children + 1) / 2, c->c_arena); - if (!aliases) - return NULL; - - /* handle "from ... import *" special b/c there's no children */ - if (TYPE(n) == STAR) { - alias_ty import_alias = alias_for_import_name(c, n, 1); - if (!import_alias) - return NULL; - asdl_seq_SET(aliases, 0, import_alias); - } - else { - for (i = 0; i < NCH(n); i += 2) { - alias_ty import_alias = alias_for_import_name(c, CHILD(n, i), 1); - if (!import_alias) - return NULL; - asdl_seq_SET(aliases, i / 2, import_alias); - } - } - if (mod != NULL) - modname = mod->name; - return ImportFrom(modname, aliases, ndots, lineno, col_offset, - c->c_arena); - } - PyErr_Format(PyExc_SystemError, - "unknown import statement: starts with command '%s'", - STR(CHILD(n, 0))); - return NULL; -} - -static stmt_ty -ast_for_global_stmt(struct compiling *c, const node *n) -{ - /* global_stmt: 'global' NAME (',' NAME)* */ - identifier name; - asdl_seq *s; - int i; - - REQ(n, global_stmt); - s = asdl_seq_new(NCH(n) / 2, c->c_arena); - if (!s) - return NULL; - for (i = 1; i < NCH(n); i += 2) { - name = NEW_IDENTIFIER(CHILD(n, i)); - if (!name) - return NULL; - asdl_seq_SET(s, i / 2, name); - } - return Global(s, LINENO(n), n->n_col_offset, c->c_arena); -} - -static stmt_ty -ast_for_exec_stmt(struct compiling *c, const node *n) -{ - expr_ty expr1, globals = NULL, locals = NULL; - int n_children = NCH(n); - if (n_children != 2 && n_children != 4 && n_children != 6) { - PyErr_Format(PyExc_SystemError, - "poorly formed 'exec' statement: %d parts to statement", - n_children); - return NULL; - } - - /* exec_stmt: 'exec' expr ['in' test [',' test]] */ - REQ(n, exec_stmt); - expr1 = ast_for_expr(c, CHILD(n, 1)); - if (!expr1) - return NULL; - - if (expr1->kind == Tuple_kind && n_children < 4 && - (asdl_seq_LEN(expr1->v.Tuple.elts) == 2 || - asdl_seq_LEN(expr1->v.Tuple.elts) == 3)) { - /* Backwards compatibility: passing exec args as a tuple */ - globals = asdl_seq_GET(expr1->v.Tuple.elts, 1); - if (asdl_seq_LEN(expr1->v.Tuple.elts) == 3) { - locals = asdl_seq_GET(expr1->v.Tuple.elts, 2); - } - expr1 = asdl_seq_GET(expr1->v.Tuple.elts, 0); - } - - if (n_children >= 4) { - globals = ast_for_expr(c, CHILD(n, 3)); - if (!globals) - return NULL; - } - if (n_children == 6) { - locals = ast_for_expr(c, CHILD(n, 5)); - if (!locals) - return NULL; - } - - return Exec(expr1, globals, locals, LINENO(n), n->n_col_offset, - c->c_arena); -} - -static stmt_ty -ast_for_assert_stmt(struct compiling *c, const node *n) -{ - /* assert_stmt: 'assert' test [',' test] */ - REQ(n, assert_stmt); - if (NCH(n) == 2) { - expr_ty expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - return Assert(expression, NULL, LINENO(n), n->n_col_offset, - c->c_arena); - } - else if (NCH(n) == 4) { - expr_ty expr1, expr2; - - expr1 = ast_for_expr(c, CHILD(n, 1)); - if (!expr1) - return NULL; - expr2 = ast_for_expr(c, CHILD(n, 3)); - if (!expr2) - return NULL; - - return Assert(expr1, expr2, LINENO(n), n->n_col_offset, c->c_arena); - } - PyErr_Format(PyExc_SystemError, - "improper number of parts to 'assert' statement: %d", - NCH(n)); - return NULL; -} - -static asdl_seq * -ast_for_suite(struct compiling *c, const node *n) -{ - /* suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT */ - asdl_seq *seq; - stmt_ty s; - int i, total, num, end, pos = 0; - node *ch; - - REQ(n, suite); - - total = num_stmts(n); - seq = asdl_seq_new(total, c->c_arena); - if (!seq) - return NULL; - if (TYPE(CHILD(n, 0)) == simple_stmt) { - n = CHILD(n, 0); - /* simple_stmt always ends with a NEWLINE, - and may have a trailing SEMI - */ - end = NCH(n) - 1; - if (TYPE(CHILD(n, end - 1)) == SEMI) - end--; - /* loop by 2 to skip semi-colons */ - for (i = 0; i < end; i += 2) { - ch = CHILD(n, i); - s = ast_for_stmt(c, ch); - if (!s) - return NULL; - asdl_seq_SET(seq, pos++, s); - } - } - else { - for (i = 2; i < (NCH(n) - 1); i++) { - ch = CHILD(n, i); - REQ(ch, stmt); - num = num_stmts(ch); - if (num == 1) { - /* small_stmt or compound_stmt with only one child */ - s = ast_for_stmt(c, ch); - if (!s) - return NULL; - asdl_seq_SET(seq, pos++, s); - } - else { - int j; - ch = CHILD(ch, 0); - REQ(ch, simple_stmt); - for (j = 0; j < NCH(ch); j += 2) { - /* statement terminates with a semi-colon ';' */ - if (NCH(CHILD(ch, j)) == 0) { - assert((j + 1) == NCH(ch)); - break; - } - s = ast_for_stmt(c, CHILD(ch, j)); - if (!s) - return NULL; - asdl_seq_SET(seq, pos++, s); - } - } - } - } - assert(pos == seq->size); - return seq; -} - -static stmt_ty -ast_for_if_stmt(struct compiling *c, const node *n) -{ - /* if_stmt: 'if' test ':' suite ('elif' test ':' suite)* - ['else' ':' suite] - */ - char *s; - - REQ(n, if_stmt); - - if (NCH(n) == 4) { - expr_ty expression; - asdl_seq *suite_seq; - - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, CHILD(n, 3)); - if (!suite_seq) - return NULL; - - return If(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, - c->c_arena); - } - - s = STR(CHILD(n, 4)); - /* s[2], the third character in the string, will be - 's' for el_s_e, or - 'i' for el_i_f - */ - if (s[2] == 's') { - expr_ty expression; - asdl_seq *seq1, *seq2; - - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - seq1 = ast_for_suite(c, CHILD(n, 3)); - if (!seq1) - return NULL; - seq2 = ast_for_suite(c, CHILD(n, 6)); - if (!seq2) - return NULL; - - return If(expression, seq1, seq2, LINENO(n), n->n_col_offset, - c->c_arena); - } - else if (s[2] == 'i') { - int i, n_elif, has_else = 0; - expr_ty expression; - asdl_seq *suite_seq; - asdl_seq *orelse = NULL; - n_elif = NCH(n) - 4; - /* must reference the child n_elif+1 since 'else' token is third, - not fourth, child from the end. */ - if (TYPE(CHILD(n, (n_elif + 1))) == NAME - && STR(CHILD(n, (n_elif + 1)))[2] == 's') { - has_else = 1; - n_elif -= 3; - } - n_elif /= 4; - - if (has_else) { - asdl_seq *suite_seq2; - - orelse = asdl_seq_new(1, c->c_arena); - if (!orelse) - return NULL; - expression = ast_for_expr(c, CHILD(n, NCH(n) - 6)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, CHILD(n, NCH(n) - 4)); - if (!suite_seq) - return NULL; - suite_seq2 = ast_for_suite(c, CHILD(n, NCH(n) - 1)); - if (!suite_seq2) - return NULL; - - asdl_seq_SET(orelse, 0, - If(expression, suite_seq, suite_seq2, - LINENO(CHILD(n, NCH(n) - 6)), - CHILD(n, NCH(n) - 6)->n_col_offset, - c->c_arena)); - /* the just-created orelse handled the last elif */ - n_elif--; - } - - for (i = 0; i < n_elif; i++) { - int off = 5 + (n_elif - i - 1) * 4; - asdl_seq *newobj = asdl_seq_new(1, c->c_arena); - if (!newobj) - return NULL; - expression = ast_for_expr(c, CHILD(n, off)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, CHILD(n, off + 2)); - if (!suite_seq) - return NULL; - - asdl_seq_SET(newobj, 0, - If(expression, suite_seq, orelse, - LINENO(CHILD(n, off)), - CHILD(n, off)->n_col_offset, c->c_arena)); - orelse = newobj; - } - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, CHILD(n, 3)); - if (!suite_seq) - return NULL; - return If(expression, suite_seq, orelse, - LINENO(n), n->n_col_offset, c->c_arena); - } - - PyErr_Format(PyExc_SystemError, - "unexpected token in 'if' statement: %s", s); - return NULL; -} - -static stmt_ty -ast_for_while_stmt(struct compiling *c, const node *n) -{ - /* while_stmt: 'while' test ':' suite ['else' ':' suite] */ - REQ(n, while_stmt); - - if (NCH(n) == 4) { - expr_ty expression; - asdl_seq *suite_seq; - - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, CHILD(n, 3)); - if (!suite_seq) - return NULL; - return While(expression, suite_seq, NULL, LINENO(n), n->n_col_offset, - c->c_arena); - } - else if (NCH(n) == 7) { - expr_ty expression; - asdl_seq *seq1, *seq2; - - expression = ast_for_expr(c, CHILD(n, 1)); - if (!expression) - return NULL; - seq1 = ast_for_suite(c, CHILD(n, 3)); - if (!seq1) - return NULL; - seq2 = ast_for_suite(c, CHILD(n, 6)); - if (!seq2) - return NULL; - - return While(expression, seq1, seq2, LINENO(n), n->n_col_offset, - c->c_arena); - } - - PyErr_Format(PyExc_SystemError, - "wrong number of tokens for 'while' statement: %d", - NCH(n)); - return NULL; -} - -static stmt_ty -ast_for_for_stmt(struct compiling *c, const node *n) -{ - asdl_seq *_target, *seq = NULL, *suite_seq; - expr_ty expression; - expr_ty target, first; - const node *node_target; - /* for_stmt: 'for' exprlist 'in' testlist ':' suite ['else' ':' suite] */ - REQ(n, for_stmt); - - if (NCH(n) == 9) { - seq = ast_for_suite(c, CHILD(n, 8)); - if (!seq) - return NULL; - } - - node_target = CHILD(n, 1); - _target = ast_for_exprlist(c, node_target, Store); - if (!_target) - return NULL; - /* Check the # of children rather than the length of _target, since - for x, in ... has 1 element in _target, but still requires a Tuple. */ - first = (expr_ty)asdl_seq_GET(_target, 0); - if (NCH(node_target) == 1) - target = first; - else - target = Tuple(_target, Store, first->lineno, first->col_offset, c->c_arena); - - expression = ast_for_testlist(c, CHILD(n, 3)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, CHILD(n, 5)); - if (!suite_seq) - return NULL; - - return For(target, expression, suite_seq, seq, LINENO(n), n->n_col_offset, - c->c_arena); -} - -static excepthandler_ty -ast_for_except_clause(struct compiling *c, const node *exc, node *body) -{ - /* except_clause: 'except' [test [(',' | 'as') test]] */ - REQ(exc, except_clause); - REQ(body, suite); - - if (NCH(exc) == 1) { - asdl_seq *suite_seq = ast_for_suite(c, body); - if (!suite_seq) - return NULL; - - return ExceptHandler(NULL, NULL, suite_seq, LINENO(exc), - exc->n_col_offset, c->c_arena); - } - else if (NCH(exc) == 2) { - expr_ty expression; - asdl_seq *suite_seq; - - expression = ast_for_expr(c, CHILD(exc, 1)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, body); - if (!suite_seq) - return NULL; - - return ExceptHandler(expression, NULL, suite_seq, LINENO(exc), - exc->n_col_offset, c->c_arena); - } - else if (NCH(exc) == 4) { - asdl_seq *suite_seq; - expr_ty expression; - expr_ty e = ast_for_expr(c, CHILD(exc, 3)); - if (!e) - return NULL; - if (!set_context(c, e, Store, CHILD(exc, 3))) - return NULL; - expression = ast_for_expr(c, CHILD(exc, 1)); - if (!expression) - return NULL; - suite_seq = ast_for_suite(c, body); - if (!suite_seq) - return NULL; - - return ExceptHandler(expression, e, suite_seq, LINENO(exc), - exc->n_col_offset, c->c_arena); - } - - PyErr_Format(PyExc_SystemError, - "wrong number of children for 'except' clause: %d", - NCH(exc)); - return NULL; -} - -static stmt_ty -ast_for_try_stmt(struct compiling *c, const node *n) -{ - const int nch = NCH(n); - int n_except = (nch - 3)/3; - asdl_seq *body, *orelse = NULL, *finally = NULL; - - REQ(n, try_stmt); - - body = ast_for_suite(c, CHILD(n, 2)); - if (body == NULL) - return NULL; - - if (TYPE(CHILD(n, nch - 3)) == NAME) { - if (strcmp(STR(CHILD(n, nch - 3)), "finally") == 0) { - if (nch >= 9 && TYPE(CHILD(n, nch - 6)) == NAME) { - /* we can assume it's an "else", - because nch >= 9 for try-else-finally and - it would otherwise have a type of except_clause */ - orelse = ast_for_suite(c, CHILD(n, nch - 4)); - if (orelse == NULL) - return NULL; - n_except--; - } - - finally = ast_for_suite(c, CHILD(n, nch - 1)); - if (finally == NULL) - return NULL; - n_except--; - } - else { - /* we can assume it's an "else", - otherwise it would have a type of except_clause */ - orelse = ast_for_suite(c, CHILD(n, nch - 1)); - if (orelse == NULL) - return NULL; - n_except--; - } - } - else if (TYPE(CHILD(n, nch - 3)) != except_clause) { - ast_error(n, "malformed 'try' statement"); - return NULL; - } - - if (n_except > 0) { - int i; - stmt_ty except_st; - /* process except statements to create a try ... except */ - asdl_seq *handlers = asdl_seq_new(n_except, c->c_arena); - if (handlers == NULL) - return NULL; - - for (i = 0; i < n_except; i++) { - excepthandler_ty e = ast_for_except_clause(c, CHILD(n, 3 + i * 3), - CHILD(n, 5 + i * 3)); - if (!e) - return NULL; - asdl_seq_SET(handlers, i, e); - } - - except_st = TryExcept(body, handlers, orelse, LINENO(n), - n->n_col_offset, c->c_arena); - if (!finally) - return except_st; - - /* if a 'finally' is present too, we nest the TryExcept within a - TryFinally to emulate try ... except ... finally */ - body = asdl_seq_new(1, c->c_arena); - if (body == NULL) - return NULL; - asdl_seq_SET(body, 0, except_st); - } - - /* must be a try ... finally (except clauses are in body, if any exist) */ - assert(finally != NULL); - return TryFinally(body, finally, LINENO(n), n->n_col_offset, c->c_arena); -} - -/* with_item: test ['as' expr] */ -static stmt_ty -ast_for_with_item(struct compiling *c, const node *n, asdl_seq *content) -{ - expr_ty context_expr, optional_vars = NULL; - - REQ(n, with_item); - context_expr = ast_for_expr(c, CHILD(n, 0)); - if (!context_expr) - return NULL; - if (NCH(n) == 3) { - optional_vars = ast_for_expr(c, CHILD(n, 2)); - - if (!optional_vars) { - return NULL; - } - if (!set_context(c, optional_vars, Store, n)) { - return NULL; - } - } - - return With(context_expr, optional_vars, content, LINENO(n), - n->n_col_offset, c->c_arena); -} - -/* with_stmt: 'with' with_item (',' with_item)* ':' suite */ -static stmt_ty -ast_for_with_stmt(struct compiling *c, const node *n) -{ - int i; - stmt_ty ret; - asdl_seq *inner; - - REQ(n, with_stmt); - - /* process the with items inside-out */ - i = NCH(n) - 1; - /* the suite of the innermost with item is the suite of the with stmt */ - inner = ast_for_suite(c, CHILD(n, i)); - if (!inner) - return NULL; - - for (;;) { - i -= 2; - ret = ast_for_with_item(c, CHILD(n, i), inner); - if (!ret) - return NULL; - /* was this the last item? */ - if (i == 1) - break; - /* if not, wrap the result so far in a new sequence */ - inner = asdl_seq_new(1, c->c_arena); - if (!inner) - return NULL; - asdl_seq_SET(inner, 0, ret); - } - - return ret; -} - -static stmt_ty -ast_for_classdef(struct compiling *c, const node *n, asdl_seq *decorator_seq) -{ - /* classdef: 'class' NAME ['(' testlist ')'] ':' suite */ - PyObject *classname; - asdl_seq *bases, *s; - - REQ(n, classdef); - - if (!forbidden_check(c, n, STR(CHILD(n, 1)))) - return NULL; - - if (NCH(n) == 4) { - s = ast_for_suite(c, CHILD(n, 3)); - if (!s) - return NULL; - classname = NEW_IDENTIFIER(CHILD(n, 1)); - if (!classname) - return NULL; - return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), - n->n_col_offset, c->c_arena); - } - /* check for empty base list */ - if (TYPE(CHILD(n,3)) == RPAR) { - s = ast_for_suite(c, CHILD(n,5)); - if (!s) - return NULL; - classname = NEW_IDENTIFIER(CHILD(n, 1)); - if (!classname) - return NULL; - return ClassDef(classname, NULL, s, decorator_seq, LINENO(n), - n->n_col_offset, c->c_arena); - } - - /* else handle the base class list */ - bases = ast_for_class_bases(c, CHILD(n, 3)); - if (!bases) - return NULL; - - s = ast_for_suite(c, CHILD(n, 6)); - if (!s) - return NULL; - classname = NEW_IDENTIFIER(CHILD(n, 1)); - if (!classname) - return NULL; - return ClassDef(classname, bases, s, decorator_seq, - LINENO(n), n->n_col_offset, c->c_arena); -} - -static stmt_ty -ast_for_stmt(struct compiling *c, const node *n) -{ - if (TYPE(n) == stmt) { - assert(NCH(n) == 1); - n = CHILD(n, 0); - } - if (TYPE(n) == simple_stmt) { - assert(num_stmts(n) == 1); - n = CHILD(n, 0); - } - if (TYPE(n) == small_stmt) { - n = CHILD(n, 0); - /* small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt - | flow_stmt | import_stmt | global_stmt | exec_stmt - | assert_stmt - */ - switch (TYPE(n)) { - case expr_stmt: - return ast_for_expr_stmt(c, n); - case print_stmt: - return ast_for_print_stmt(c, n); - case del_stmt: - return ast_for_del_stmt(c, n); - case pass_stmt: - return Pass(LINENO(n), n->n_col_offset, c->c_arena); - case flow_stmt: - return ast_for_flow_stmt(c, n); - case import_stmt: - return ast_for_import_stmt(c, n); - case global_stmt: - return ast_for_global_stmt(c, n); - case exec_stmt: - return ast_for_exec_stmt(c, n); - case assert_stmt: - return ast_for_assert_stmt(c, n); - default: - PyErr_Format(PyExc_SystemError, - "unhandled small_stmt: TYPE=%d NCH=%d\n", - TYPE(n), NCH(n)); - return NULL; - } - } - else { - /* compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt - | funcdef | classdef | decorated - */ - node *ch = CHILD(n, 0); - REQ(n, compound_stmt); - switch (TYPE(ch)) { - case if_stmt: - return ast_for_if_stmt(c, ch); - case while_stmt: - return ast_for_while_stmt(c, ch); - case for_stmt: - return ast_for_for_stmt(c, ch); - case try_stmt: - return ast_for_try_stmt(c, ch); - case with_stmt: - return ast_for_with_stmt(c, ch); - case funcdef: - return ast_for_funcdef(c, ch, NULL); - case classdef: - return ast_for_classdef(c, ch, NULL); - case decorated: - return ast_for_decorated(c, ch); - default: - PyErr_Format(PyExc_SystemError, - "unhandled small_stmt: TYPE=%d NCH=%d\n", - TYPE(n), NCH(n)); - return NULL; - } - } -} - -static PyObject * -parsenumber(struct compiling *c, const char *s) -{ - const char *end; - long x; - double dx; -#ifndef WITHOUT_COMPLEX - Py_complex complex; - int imflag; -#endif - - assert(s != NULL); - errno = 0; - end = s + strlen(s) - 1; -#ifndef WITHOUT_COMPLEX - imflag = *end == 'j' || *end == 'J'; -#endif - if (*end == 'l' || *end == 'L') - return PyLong_FromString((char *)s, (char **)0, 0); - x = PyOS_strtol((char *)s, (char **)&end, 0); - if (*end == '\0') { - if (errno != 0) - return PyLong_FromString((char *)s, (char **)0, 0); - return PyInt_FromLong(x); - } - /* XXX Huge floats may silently fail */ -#ifndef WITHOUT_COMPLEX - if (imflag) { - complex.real = 0.; - complex.imag = PyOS_string_to_double(s, (char **)&end, NULL); - if (complex.imag == -1.0 && PyErr_Occurred()) - return NULL; - return PyComplex_FromCComplex(complex); - } - else -#endif - { - dx = PyOS_string_to_double(s, NULL, NULL); - if (dx == -1.0 && PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(dx); - } -} - -static PyObject * -decode_utf8(struct compiling *c, const char **sPtr, const char *end, char* encoding) -{ -#ifndef Py_USING_UNICODE - Py_FatalError("decode_utf8 should not be called in this build."); - return NULL; -#else - PyObject *u, *v; - char *s, *t; - t = s = (char *)*sPtr; - /* while (s < end && *s != '\\') s++; */ /* inefficient for u".." */ - while (s < end && (*s & 0x80)) s++; - *sPtr = s; - u = PyUnicode_DecodeUTF8(t, s - t, NULL); - if (u == NULL) - return NULL; - v = PyUnicode_AsEncodedString(u, encoding, NULL); - Py_DECREF(u); - return v; -#endif -} - -#ifdef Py_USING_UNICODE -static PyObject * -decode_unicode(struct compiling *c, const char *s, size_t len, int rawmode, const char *encoding) -{ - PyObject *v; - PyObject *u = NULL; - char *buf; - char *p; - const char *end; - if (encoding != NULL && strcmp(encoding, "iso-8859-1")) { - /* check for integer overflow */ - if (len > PY_SIZE_MAX / 6) - return NULL; - /* "" (2 bytes) may become "\U000000E4" (10 bytes), or 1:5 - "\ä" (3 bytes) may become "\u005c\U000000E4" (16 bytes), or ~1:6 */ - u = PyString_FromStringAndSize((char *)NULL, len * 6); - if (u == NULL) - return NULL; - p = buf = PyString_AsString(u); - end = s + len; - while (s < end) { - if (*s == '\\') { - *p++ = *s++; - if (*s & 0x80) { - strcpy(p, "u005c"); - p += 5; - } - } - if (*s & 0x80) { /* XXX inefficient */ - PyObject *w; - char *r; - Py_ssize_t rn, i; - w = decode_utf8(c, &s, end, "utf-32-be"); - if (w == NULL) { - Py_DECREF(u); - return NULL; - } - r = PyString_AsString(w); - rn = PyString_Size(w); - assert(rn % 4 == 0); - for (i = 0; i < rn; i += 4) { - sprintf(p, "\\U%02x%02x%02x%02x", - r[i + 0] & 0xFF, - r[i + 1] & 0xFF, - r[i + 2] & 0xFF, - r[i + 3] & 0xFF); - p += 10; - } - Py_DECREF(w); - } else { - *p++ = *s++; - } - } - len = p - buf; - s = buf; - } - if (rawmode) - v = PyUnicode_DecodeRawUnicodeEscape(s, len, NULL); - else - v = PyUnicode_DecodeUnicodeEscape(s, len, NULL); - Py_XDECREF(u); - return v; -} -#endif - -/* s is a Python string literal, including the bracketing quote characters, - * and r &/or u prefixes (if any), and embedded escape sequences (if any). - * parsestr parses it, and returns the decoded Python string object. - */ -static PyObject * -parsestr(struct compiling *c, const node *n, const char *s) -{ - size_t len, i; - int quote = Py_CHARMASK(*s); - int rawmode = 0; - int need_encoding; - int unicode = c->c_future_unicode; - int bytes = 0; - - if (isalpha(quote) || quote == '_') { - if (quote == 'u' || quote == 'U') { - quote = *++s; - unicode = 1; - } - if (quote == 'b' || quote == 'B') { - quote = *++s; - unicode = 0; - bytes = 1; - } - if (quote == 'r' || quote == 'R') { - quote = *++s; - rawmode = 1; - } - } - if (quote != '\'' && quote != '\"') { - PyErr_BadInternalCall(); - return NULL; - } - s++; - len = strlen(s); - if (len > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "string to parse is too long"); - return NULL; - } - if (s[--len] != quote) { - PyErr_BadInternalCall(); - return NULL; - } - if (len >= 4 && s[0] == quote && s[1] == quote) { - s += 2; - len -= 2; - if (s[--len] != quote || s[--len] != quote) { - PyErr_BadInternalCall(); - return NULL; - } - } - if (Py_Py3kWarningFlag && bytes) { - for (i = 0; i < len; i++) { - if ((unsigned char)s[i] > 127) { - if (!ast_warn(c, n, - "non-ascii bytes literals not supported in 3.x")) - return NULL; - break; - } - } - } -#ifdef Py_USING_UNICODE - if (unicode || Py_UnicodeFlag) { - return decode_unicode(c, s, len, rawmode, c->c_encoding); - } -#endif - need_encoding = (c->c_encoding != NULL && - strcmp(c->c_encoding, "utf-8") != 0 && - strcmp(c->c_encoding, "iso-8859-1") != 0); - if (rawmode || strchr(s, '\\') == NULL) { - if (need_encoding) { -#ifndef Py_USING_UNICODE - /* This should not happen - we never see any other - encoding. */ - Py_FatalError( - "cannot deal with encodings in this build."); -#else - PyObject *v, *u = PyUnicode_DecodeUTF8(s, len, NULL); - if (u == NULL) - return NULL; - v = PyUnicode_AsEncodedString(u, c->c_encoding, NULL); - Py_DECREF(u); - return v; -#endif - } else { - return PyString_FromStringAndSize(s, len); - } - } - - return PyString_DecodeEscape(s, len, NULL, unicode, - need_encoding ? c->c_encoding : NULL); -} - -/* Build a Python string object out of a STRING atom. This takes care of - * compile-time literal catenation, calling parsestr() on each piece, and - * pasting the intermediate results together. - */ -static PyObject * -parsestrplus(struct compiling *c, const node *n) -{ - PyObject *v; - int i; - REQ(CHILD(n, 0), STRING); - if ((v = parsestr(c, n, STR(CHILD(n, 0)))) != NULL) { - /* String literal concatenation */ - for (i = 1; i < NCH(n); i++) { - PyObject *s; - s = parsestr(c, n, STR(CHILD(n, i))); - if (s == NULL) - goto onError; - if (PyString_Check(v) && PyString_Check(s)) { - PyString_ConcatAndDel(&v, s); - if (v == NULL) - goto onError; - } -#ifdef Py_USING_UNICODE - else { - PyObject *temp = PyUnicode_Concat(v, s); - Py_DECREF(s); - Py_DECREF(v); - v = temp; - if (v == NULL) - goto onError; - } -#endif - } - } - return v; - - onError: - Py_XDECREF(v); - return NULL; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/bltinmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Python/bltinmodule.c deleted file mode 100644 index 188d688..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/bltinmodule.c +++ /dev/null @@ -1,3061 +0,0 @@ -/* Built-in functions */ - -#include "Python.h" -#include "Python-ast.h" - -#include "node.h" -#include "code.h" -#include "eval.h" - -#include -#include /* for DBL_MANT_DIG and friends */ - -#ifdef RISCOS -#include "unixstuff.h" -#endif - -/* The default encoding used by the platform file system APIs - Can remain NULL for all platforms that don't have such a concept -*/ -#if defined(MS_WINDOWS) && defined(HAVE_USABLE_WCHAR_T) -const char *Py_FileSystemDefaultEncoding = "mbcs"; -#elif defined(__APPLE__) -const char *Py_FileSystemDefaultEncoding = "utf-8"; -#else -const char *Py_FileSystemDefaultEncoding = NULL; /* use default */ -#endif - -/* Forward */ -static PyObject *filterstring(PyObject *, PyObject *); -#ifdef Py_USING_UNICODE -static PyObject *filterunicode(PyObject *, PyObject *); -#endif -static PyObject *filtertuple (PyObject *, PyObject *); - -static PyObject * -builtin___import__(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"name", "globals", "locals", "fromlist", - "level", 0}; - char *name; - PyObject *globals = NULL; - PyObject *locals = NULL; - PyObject *fromlist = NULL; - int level = -1; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|OOOi:__import__", - kwlist, &name, &globals, &locals, &fromlist, &level)) - return NULL; - return PyImport_ImportModuleLevel(name, globals, locals, - fromlist, level); -} - -PyDoc_STRVAR(import_doc, -"__import__(name, globals={}, locals={}, fromlist=[], level=-1) -> module\n\ -\n\ -Import a module. Because this function is meant for use by the Python\n\ -interpreter and not for general use it is better to use\n\ -importlib.import_module() to programmatically import a module.\n\ -\n\ -The globals argument is only used to determine the context;\n\ -they are not modified. The locals argument is unused. The fromlist\n\ -should be a list of names to emulate ``from name import ...'', or an\n\ -empty list to emulate ``import name''.\n\ -When importing a module from a package, note that __import__('A.B', ...)\n\ -returns package A when fromlist is empty, but its submodule B when\n\ -fromlist is not empty. Level is used to determine whether to perform \n\ -absolute or relative imports. -1 is the original strategy of attempting\n\ -both absolute and relative imports, 0 is absolute, a positive number\n\ -is the number of parent directories to search relative to the current module."); - - -static PyObject * -builtin_abs(PyObject *self, PyObject *v) -{ - return PyNumber_Absolute(v); -} - -PyDoc_STRVAR(abs_doc, -"abs(number) -> number\n\ -\n\ -Return the absolute value of the argument."); - -static PyObject * -builtin_all(PyObject *self, PyObject *v) -{ - PyObject *it, *item; - PyObject *(*iternext)(PyObject *); - int cmp; - - it = PyObject_GetIter(v); - if (it == NULL) - return NULL; - iternext = *Py_TYPE(it)->tp_iternext; - - for (;;) { - item = iternext(it); - if (item == NULL) - break; - cmp = PyObject_IsTrue(item); - Py_DECREF(item); - if (cmp < 0) { - Py_DECREF(it); - return NULL; - } - if (cmp == 0) { - Py_DECREF(it); - Py_RETURN_FALSE; - } - } - Py_DECREF(it); - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - else - return NULL; - } - Py_RETURN_TRUE; -} - -PyDoc_STRVAR(all_doc, -"all(iterable) -> bool\n\ -\n\ -Return True if bool(x) is True for all values x in the iterable.\n\ -If the iterable is empty, return True."); - -static PyObject * -builtin_any(PyObject *self, PyObject *v) -{ - PyObject *it, *item; - PyObject *(*iternext)(PyObject *); - int cmp; - - it = PyObject_GetIter(v); - if (it == NULL) - return NULL; - iternext = *Py_TYPE(it)->tp_iternext; - - for (;;) { - item = iternext(it); - if (item == NULL) - break; - cmp = PyObject_IsTrue(item); - Py_DECREF(item); - if (cmp < 0) { - Py_DECREF(it); - return NULL; - } - if (cmp == 1) { - Py_DECREF(it); - Py_RETURN_TRUE; - } - } - Py_DECREF(it); - if (PyErr_Occurred()) { - if (PyErr_ExceptionMatches(PyExc_StopIteration)) - PyErr_Clear(); - else - return NULL; - } - Py_RETURN_FALSE; -} - -PyDoc_STRVAR(any_doc, -"any(iterable) -> bool\n\ -\n\ -Return True if bool(x) is True for any x in the iterable.\n\ -If the iterable is empty, return False."); - -static PyObject * -builtin_apply(PyObject *self, PyObject *args) -{ - PyObject *func, *alist = NULL, *kwdict = NULL; - PyObject *t = NULL, *retval = NULL; - - if (PyErr_WarnPy3k("apply() not supported in 3.x; " - "use func(*args, **kwargs)", 1) < 0) - return NULL; - - if (!PyArg_UnpackTuple(args, "apply", 1, 3, &func, &alist, &kwdict)) - return NULL; - if (alist != NULL) { - if (!PyTuple_Check(alist)) { - if (!PySequence_Check(alist)) { - PyErr_Format(PyExc_TypeError, - "apply() arg 2 expected sequence, found %s", - alist->ob_type->tp_name); - return NULL; - } - t = PySequence_Tuple(alist); - if (t == NULL) - return NULL; - alist = t; - } - } - if (kwdict != NULL && !PyDict_Check(kwdict)) { - PyErr_Format(PyExc_TypeError, - "apply() arg 3 expected dictionary, found %s", - kwdict->ob_type->tp_name); - goto finally; - } - retval = PyEval_CallObjectWithKeywords(func, alist, kwdict); - finally: - Py_XDECREF(t); - return retval; -} - -PyDoc_STRVAR(apply_doc, -"apply(object[, args[, kwargs]]) -> value\n\ -\n\ -Call a callable object with positional arguments taken from the tuple args,\n\ -and keyword arguments taken from the optional dictionary kwargs.\n\ -Note that classes are callable, as are instances with a __call__() method.\n\ -\n\ -Deprecated since release 2.3. Instead, use the extended call syntax:\n\ - function(*args, **keywords)."); - - -static PyObject * -builtin_bin(PyObject *self, PyObject *v) -{ - return PyNumber_ToBase(v, 2); -} - -PyDoc_STRVAR(bin_doc, -"bin(number) -> string\n\ -\n\ -Return the binary representation of an integer or long integer."); - - -static PyObject * -builtin_callable(PyObject *self, PyObject *v) -{ - return PyBool_FromLong((long)PyCallable_Check(v)); -} - -PyDoc_STRVAR(callable_doc, -"callable(object) -> bool\n\ -\n\ -Return whether the object is callable (i.e., some kind of function).\n\ -Note that classes are callable, as are instances with a __call__() method."); - - -static PyObject * -builtin_filter(PyObject *self, PyObject *args) -{ - PyObject *func, *seq, *result, *it, *arg; - Py_ssize_t len; /* guess for result list size */ - register Py_ssize_t j; - - if (!PyArg_UnpackTuple(args, "filter", 2, 2, &func, &seq)) - return NULL; - - /* Strings and tuples return a result of the same type. */ - if (PyString_Check(seq)) - return filterstring(func, seq); -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(seq)) - return filterunicode(func, seq); -#endif - if (PyTuple_Check(seq)) - return filtertuple(func, seq); - - /* Pre-allocate argument list tuple. */ - arg = PyTuple_New(1); - if (arg == NULL) - return NULL; - - /* Get iterator. */ - it = PyObject_GetIter(seq); - if (it == NULL) - goto Fail_arg; - - /* Guess a result list size. */ - len = _PyObject_LengthHint(seq, 8); - if (len == -1) - goto Fail_it; - - /* Get a result list. */ - if (PyList_Check(seq) && seq->ob_refcnt == 1) { - /* Eww - can modify the list in-place. */ - Py_INCREF(seq); - result = seq; - } - else { - result = PyList_New(len); - if (result == NULL) - goto Fail_it; - } - - /* Build the result list. */ - j = 0; - for (;;) { - PyObject *item; - int ok; - - item = PyIter_Next(it); - if (item == NULL) { - if (PyErr_Occurred()) - goto Fail_result_it; - break; - } - - if (func == (PyObject *)&PyBool_Type || func == Py_None) { - ok = PyObject_IsTrue(item); - } - else { - PyObject *good; - PyTuple_SET_ITEM(arg, 0, item); - good = PyObject_Call(func, arg, NULL); - PyTuple_SET_ITEM(arg, 0, NULL); - if (good == NULL) { - Py_DECREF(item); - goto Fail_result_it; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - } - if (ok > 0) { - if (j < len) - PyList_SET_ITEM(result, j, item); - else { - int status = PyList_Append(result, item); - Py_DECREF(item); - if (status < 0) - goto Fail_result_it; - } - ++j; - } - else { - Py_DECREF(item); - if (ok < 0) - goto Fail_result_it; - } - } - - - /* Cut back result list if len is too big. */ - if (j < len && PyList_SetSlice(result, j, len, NULL) < 0) - goto Fail_result_it; - - Py_DECREF(it); - Py_DECREF(arg); - return result; - -Fail_result_it: - Py_DECREF(result); -Fail_it: - Py_DECREF(it); -Fail_arg: - Py_DECREF(arg); - return NULL; -} - -PyDoc_STRVAR(filter_doc, -"filter(function or None, sequence) -> list, tuple, or string\n" -"\n" -"Return those items of sequence for which function(item) is true. If\n" -"function is None, return the items that are true. If sequence is a tuple\n" -"or string, return the same type, else return a list."); - -static PyObject * -builtin_format(PyObject *self, PyObject *args) -{ - PyObject *value; - PyObject *format_spec = NULL; - - if (!PyArg_ParseTuple(args, "O|O:format", &value, &format_spec)) - return NULL; - - return PyObject_Format(value, format_spec); -} - -PyDoc_STRVAR(format_doc, -"format(value[, format_spec]) -> string\n\ -\n\ -Returns value.__format__(format_spec)\n\ -format_spec defaults to \"\""); - -static PyObject * -builtin_chr(PyObject *self, PyObject *args) -{ - long x; - char s[1]; - - if (!PyArg_ParseTuple(args, "l:chr", &x)) - return NULL; - if (x < 0 || x >= 256) { - PyErr_SetString(PyExc_ValueError, - "chr() arg not in range(256)"); - return NULL; - } - s[0] = (char)x; - return PyString_FromStringAndSize(s, 1); -} - -PyDoc_STRVAR(chr_doc, -"chr(i) -> character\n\ -\n\ -Return a string of one character with ordinal i; 0 <= i < 256."); - - -#ifdef Py_USING_UNICODE -static PyObject * -builtin_unichr(PyObject *self, PyObject *args) -{ - int x; - - if (!PyArg_ParseTuple(args, "i:unichr", &x)) - return NULL; - - return PyUnicode_FromOrdinal(x); -} - -PyDoc_STRVAR(unichr_doc, -"unichr(i) -> Unicode character\n\ -\n\ -Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff."); -#endif - - -static PyObject * -builtin_cmp(PyObject *self, PyObject *args) -{ - PyObject *a, *b; - int c; - - if (!PyArg_UnpackTuple(args, "cmp", 2, 2, &a, &b)) - return NULL; - if (PyObject_Cmp(a, b, &c) < 0) - return NULL; - return PyInt_FromLong((long)c); -} - -PyDoc_STRVAR(cmp_doc, -"cmp(x, y) -> integer\n\ -\n\ -Return negative if xy."); - - -static PyObject * -builtin_coerce(PyObject *self, PyObject *args) -{ - PyObject *v, *w; - PyObject *res; - - if (PyErr_WarnPy3k("coerce() not supported in 3.x", 1) < 0) - return NULL; - - if (!PyArg_UnpackTuple(args, "coerce", 2, 2, &v, &w)) - return NULL; - if (PyNumber_Coerce(&v, &w) < 0) - return NULL; - res = PyTuple_Pack(2, v, w); - Py_DECREF(v); - Py_DECREF(w); - return res; -} - -PyDoc_STRVAR(coerce_doc, -"coerce(x, y) -> (x1, y1)\n\ -\n\ -Return a tuple consisting of the two numeric arguments converted to\n\ -a common type, using the same rules as used by arithmetic operations.\n\ -If coercion is not possible, raise TypeError."); - -static PyObject * -builtin_compile(PyObject *self, PyObject *args, PyObject *kwds) -{ - char *str; - char *filename; - char *startstr; - int mode = -1; - int dont_inherit = 0; - int supplied_flags = 0; - int is_ast; - PyCompilerFlags cf; - PyObject *result = NULL, *cmd, *tmp = NULL; - Py_ssize_t length; - static char *kwlist[] = {"source", "filename", "mode", "flags", - "dont_inherit", NULL}; - int start[] = {Py_file_input, Py_eval_input, Py_single_input}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "Oss|ii:compile", - kwlist, &cmd, &filename, &startstr, - &supplied_flags, &dont_inherit)) - return NULL; - - cf.cf_flags = supplied_flags; - - if (supplied_flags & - ~(PyCF_MASK | PyCF_MASK_OBSOLETE | PyCF_DONT_IMPLY_DEDENT | PyCF_ONLY_AST)) - { - PyErr_SetString(PyExc_ValueError, - "compile(): unrecognised flags"); - return NULL; - } - /* XXX Warn if (supplied_flags & PyCF_MASK_OBSOLETE) != 0? */ - - if (!dont_inherit) { - PyEval_MergeCompilerFlags(&cf); - } - - if (strcmp(startstr, "exec") == 0) - mode = 0; - else if (strcmp(startstr, "eval") == 0) - mode = 1; - else if (strcmp(startstr, "single") == 0) - mode = 2; - else { - PyErr_SetString(PyExc_ValueError, - "compile() arg 3 must be 'exec', 'eval' or 'single'"); - return NULL; - } - - is_ast = PyAST_Check(cmd); - if (is_ast == -1) - return NULL; - if (is_ast) { - if (supplied_flags & PyCF_ONLY_AST) { - Py_INCREF(cmd); - result = cmd; - } - else { - PyArena *arena; - mod_ty mod; - - arena = PyArena_New(); - if (arena == NULL) - return NULL; - mod = PyAST_obj2mod(cmd, arena, mode); - if (mod == NULL) { - PyArena_Free(arena); - return NULL; - } - result = (PyObject*)PyAST_Compile(mod, filename, - &cf, arena); - PyArena_Free(arena); - } - return result; - } - -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(cmd)) { - tmp = PyUnicode_AsUTF8String(cmd); - if (tmp == NULL) - return NULL; - cmd = tmp; - cf.cf_flags |= PyCF_SOURCE_IS_UTF8; - } -#endif - - if (PyObject_AsReadBuffer(cmd, (const void **)&str, &length)) - goto cleanup; - if ((size_t)length != strlen(str)) { - PyErr_SetString(PyExc_TypeError, - "compile() expected string without null bytes"); - goto cleanup; - } - result = Py_CompileStringFlags(str, filename, start[mode], &cf); -cleanup: - Py_XDECREF(tmp); - return result; -} - -PyDoc_STRVAR(compile_doc, -"compile(source, filename, mode[, flags[, dont_inherit]]) -> code object\n\ -\n\ -Compile the source string (a Python module, statement or expression)\n\ -into a code object that can be executed by the exec statement or eval().\n\ -The filename will be used for run-time error messages.\n\ -The mode must be 'exec' to compile a module, 'single' to compile a\n\ -single (interactive) statement, or 'eval' to compile an expression.\n\ -The flags argument, if present, controls which future statements influence\n\ -the compilation of the code.\n\ -The dont_inherit argument, if non-zero, stops the compilation inheriting\n\ -the effects of any future statements in effect in the code calling\n\ -compile; if absent or zero these statements do influence the compilation,\n\ -in addition to any features explicitly specified."); - -static PyObject * -builtin_dir(PyObject *self, PyObject *args) -{ - PyObject *arg = NULL; - - if (!PyArg_UnpackTuple(args, "dir", 0, 1, &arg)) - return NULL; - return PyObject_Dir(arg); -} - -PyDoc_STRVAR(dir_doc, -"dir([object]) -> list of strings\n" -"\n" -"If called without an argument, return the names in the current scope.\n" -"Else, return an alphabetized list of names comprising (some of) the attributes\n" -"of the given object, and of attributes reachable from it.\n" -"If the object supplies a method named __dir__, it will be used; otherwise\n" -"the default dir() logic is used and returns:\n" -" for a module object: the module's attributes.\n" -" for a class object: its attributes, and recursively the attributes\n" -" of its bases.\n" -" for any other object: its attributes, its class's attributes, and\n" -" recursively the attributes of its class's base classes."); - -static PyObject * -builtin_divmod(PyObject *self, PyObject *args) -{ - PyObject *v, *w; - - if (!PyArg_UnpackTuple(args, "divmod", 2, 2, &v, &w)) - return NULL; - return PyNumber_Divmod(v, w); -} - -PyDoc_STRVAR(divmod_doc, -"divmod(x, y) -> (quotient, remainder)\n\ -\n\ -Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x."); - - -static PyObject * -builtin_eval(PyObject *self, PyObject *args) -{ - PyObject *cmd, *result, *tmp = NULL; - PyObject *globals = Py_None, *locals = Py_None; - char *str; - PyCompilerFlags cf; - - if (!PyArg_UnpackTuple(args, "eval", 1, 3, &cmd, &globals, &locals)) - return NULL; - if (locals != Py_None && !PyMapping_Check(locals)) { - PyErr_SetString(PyExc_TypeError, "locals must be a mapping"); - return NULL; - } - if (globals != Py_None && !PyDict_Check(globals)) { - PyErr_SetString(PyExc_TypeError, PyMapping_Check(globals) ? - "globals must be a real dict; try eval(expr, {}, mapping)" - : "globals must be a dict"); - return NULL; - } - if (globals == Py_None) { - globals = PyEval_GetGlobals(); - if (locals == Py_None) - locals = PyEval_GetLocals(); - } - else if (locals == Py_None) - locals = globals; - - if (globals == NULL || locals == NULL) { - PyErr_SetString(PyExc_TypeError, - "eval must be given globals and locals " - "when called without a frame"); - return NULL; - } - - if (PyDict_GetItemString(globals, "__builtins__") == NULL) { - if (PyDict_SetItemString(globals, "__builtins__", - PyEval_GetBuiltins()) != 0) - return NULL; - } - - if (PyCode_Check(cmd)) { - if (PyCode_GetNumFree((PyCodeObject *)cmd) > 0) { - PyErr_SetString(PyExc_TypeError, - "code object passed to eval() may not contain free variables"); - return NULL; - } - return PyEval_EvalCode((PyCodeObject *) cmd, globals, locals); - } - - if (!PyString_Check(cmd) && - !PyUnicode_Check(cmd)) { - PyErr_SetString(PyExc_TypeError, - "eval() arg 1 must be a string or code object"); - return NULL; - } - cf.cf_flags = 0; - -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(cmd)) { - tmp = PyUnicode_AsUTF8String(cmd); - if (tmp == NULL) - return NULL; - cmd = tmp; - cf.cf_flags |= PyCF_SOURCE_IS_UTF8; - } -#endif - if (PyString_AsStringAndSize(cmd, &str, NULL)) { - Py_XDECREF(tmp); - return NULL; - } - while (*str == ' ' || *str == '\t') - str++; - - (void)PyEval_MergeCompilerFlags(&cf); - result = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf); - Py_XDECREF(tmp); - return result; -} - -PyDoc_STRVAR(eval_doc, -"eval(source[, globals[, locals]]) -> value\n\ -\n\ -Evaluate the source in the context of globals and locals.\n\ -The source may be a string representing a Python expression\n\ -or a code object as returned by compile().\n\ -The globals must be a dictionary and locals can be any mapping,\n\ -defaulting to the current globals and locals.\n\ -If only globals is given, locals defaults to it.\n"); - - -static PyObject * -builtin_execfile(PyObject *self, PyObject *args) -{ - char *filename; - PyObject *globals = Py_None, *locals = Py_None; - PyObject *res; - FILE* fp = NULL; - PyCompilerFlags cf; - int exists; - - if (PyErr_WarnPy3k("execfile() not supported in 3.x; use exec()", - 1) < 0) - return NULL; - - if (!PyArg_ParseTuple(args, "s|O!O:execfile", - &filename, - &PyDict_Type, &globals, - &locals)) - return NULL; - if (locals != Py_None && !PyMapping_Check(locals)) { - PyErr_SetString(PyExc_TypeError, "locals must be a mapping"); - return NULL; - } - if (globals == Py_None) { - globals = PyEval_GetGlobals(); - if (locals == Py_None) - locals = PyEval_GetLocals(); - } - else if (locals == Py_None) - locals = globals; - if (PyDict_GetItemString(globals, "__builtins__") == NULL) { - if (PyDict_SetItemString(globals, "__builtins__", - PyEval_GetBuiltins()) != 0) - return NULL; - } - - exists = 0; - /* Test for existence or directory. */ -#if defined(PLAN9) - { - Dir *d; - - if ((d = dirstat(filename))!=nil) { - if(d->mode & DMDIR) - werrstr("is a directory"); - else - exists = 1; - free(d); - } - } -#elif defined(RISCOS) - if (object_exists(filename)) { - if (isdir(filename)) - errno = EISDIR; - else - exists = 1; - } -#else /* standard Posix */ - { - struct stat s; - if (stat(filename, &s) == 0) { - if (S_ISDIR(s.st_mode)) -# if defined(PYOS_OS2) && defined(PYCC_VACPP) - errno = EOS2ERR; -# else - errno = EISDIR; -# endif - else - exists = 1; - } - } -#endif - - if (exists) { - Py_BEGIN_ALLOW_THREADS - fp = fopen(filename, "r" PY_STDIOTEXTMODE); - Py_END_ALLOW_THREADS - - if (fp == NULL) { - exists = 0; - } - } - - if (!exists) { - PyErr_SetFromErrnoWithFilename(PyExc_IOError, filename); - return NULL; - } - cf.cf_flags = 0; - if (PyEval_MergeCompilerFlags(&cf)) - res = PyRun_FileExFlags(fp, filename, Py_file_input, globals, - locals, 1, &cf); - else - res = PyRun_FileEx(fp, filename, Py_file_input, globals, - locals, 1); - return res; -} - -PyDoc_STRVAR(execfile_doc, -"execfile(filename[, globals[, locals]])\n\ -\n\ -Read and execute a Python script from a file.\n\ -The globals and locals are dictionaries, defaulting to the current\n\ -globals and locals. If only globals is given, locals defaults to it."); - - -static PyObject * -builtin_getattr(PyObject *self, PyObject *args) -{ - PyObject *v, *result, *dflt = NULL; - PyObject *name; - - if (!PyArg_UnpackTuple(args, "getattr", 2, 3, &v, &name, &dflt)) - return NULL; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(name)) { - name = _PyUnicode_AsDefaultEncodedString(name, NULL); - if (name == NULL) - return NULL; - } -#endif - - if (!PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, - "getattr(): attribute name must be string"); - return NULL; - } - result = PyObject_GetAttr(v, name); - if (result == NULL && dflt != NULL && - PyErr_ExceptionMatches(PyExc_AttributeError)) - { - PyErr_Clear(); - Py_INCREF(dflt); - result = dflt; - } - return result; -} - -PyDoc_STRVAR(getattr_doc, -"getattr(object, name[, default]) -> value\n\ -\n\ -Get a named attribute from an object; getattr(x, 'y') is equivalent to x.y.\n\ -When a default argument is given, it is returned when the attribute doesn't\n\ -exist; without it, an exception is raised in that case."); - - -static PyObject * -builtin_globals(PyObject *self) -{ - PyObject *d; - - d = PyEval_GetGlobals(); - Py_XINCREF(d); - return d; -} - -PyDoc_STRVAR(globals_doc, -"globals() -> dictionary\n\ -\n\ -Return the dictionary containing the current scope's global variables."); - - -static PyObject * -builtin_hasattr(PyObject *self, PyObject *args) -{ - PyObject *v; - PyObject *name; - - if (!PyArg_UnpackTuple(args, "hasattr", 2, 2, &v, &name)) - return NULL; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(name)) { - name = _PyUnicode_AsDefaultEncodedString(name, NULL); - if (name == NULL) - return NULL; - } -#endif - - if (!PyString_Check(name)) { - PyErr_SetString(PyExc_TypeError, - "hasattr(): attribute name must be string"); - return NULL; - } - v = PyObject_GetAttr(v, name); - if (v == NULL) { - if (!PyErr_ExceptionMatches(PyExc_Exception)) - return NULL; - else { - PyErr_Clear(); - Py_INCREF(Py_False); - return Py_False; - } - } - Py_DECREF(v); - Py_INCREF(Py_True); - return Py_True; -} - -PyDoc_STRVAR(hasattr_doc, -"hasattr(object, name) -> bool\n\ -\n\ -Return whether the object has an attribute with the given name.\n\ -(This is done by calling getattr(object, name) and catching exceptions.)"); - - -static PyObject * -builtin_id(PyObject *self, PyObject *v) -{ - return PyLong_FromVoidPtr(v); -} - -PyDoc_STRVAR(id_doc, -"id(object) -> integer\n\ -\n\ -Return the identity of an object. This is guaranteed to be unique among\n\ -simultaneously existing objects. (Hint: it's the object's memory address.)"); - - -static PyObject * -builtin_map(PyObject *self, PyObject *args) -{ - typedef struct { - PyObject *it; /* the iterator object */ - int saw_StopIteration; /* bool: did the iterator end? */ - } sequence; - - PyObject *func, *result; - sequence *seqs = NULL, *sqp; - Py_ssize_t n, len; - register int i, j; - - n = PyTuple_Size(args); - if (n < 2) { - PyErr_SetString(PyExc_TypeError, - "map() requires at least two args"); - return NULL; - } - - func = PyTuple_GetItem(args, 0); - n--; - - if (func == Py_None) { - if (PyErr_WarnPy3k("map(None, ...) not supported in 3.x; " - "use list(...)", 1) < 0) - return NULL; - if (n == 1) { - /* map(None, S) is the same as list(S). */ - return PySequence_List(PyTuple_GetItem(args, 1)); - } - } - - /* Get space for sequence descriptors. Must NULL out the iterator - * pointers so that jumping to Fail_2 later doesn't see trash. - */ - if ((seqs = PyMem_NEW(sequence, n)) == NULL) { - PyErr_NoMemory(); - return NULL; - } - for (i = 0; i < n; ++i) { - seqs[i].it = (PyObject*)NULL; - seqs[i].saw_StopIteration = 0; - } - - /* Do a first pass to obtain iterators for the arguments, and set len - * to the largest of their lengths. - */ - len = 0; - for (i = 0, sqp = seqs; i < n; ++i, ++sqp) { - PyObject *curseq; - Py_ssize_t curlen; - - /* Get iterator. */ - curseq = PyTuple_GetItem(args, i+1); - sqp->it = PyObject_GetIter(curseq); - if (sqp->it == NULL) { - static char errmsg[] = - "argument %d to map() must support iteration"; - char errbuf[sizeof(errmsg) + 25]; - PyOS_snprintf(errbuf, sizeof(errbuf), errmsg, i+2); - PyErr_SetString(PyExc_TypeError, errbuf); - goto Fail_2; - } - - /* Update len. */ - curlen = _PyObject_LengthHint(curseq, 8); - if (curlen > len) - len = curlen; - } - - /* Get space for the result list. */ - if ((result = (PyObject *) PyList_New(len)) == NULL) - goto Fail_2; - - /* Iterate over the sequences until all have stopped. */ - for (i = 0; ; ++i) { - PyObject *alist, *item=NULL, *value; - int numactive = 0; - - if (func == Py_None && n == 1) - alist = NULL; - else if ((alist = PyTuple_New(n)) == NULL) - goto Fail_1; - - for (j = 0, sqp = seqs; j < n; ++j, ++sqp) { - if (sqp->saw_StopIteration) { - Py_INCREF(Py_None); - item = Py_None; - } - else { - item = PyIter_Next(sqp->it); - if (item) - ++numactive; - else { - if (PyErr_Occurred()) { - Py_XDECREF(alist); - goto Fail_1; - } - Py_INCREF(Py_None); - item = Py_None; - sqp->saw_StopIteration = 1; - } - } - if (alist) - PyTuple_SET_ITEM(alist, j, item); - else - break; - } - - if (!alist) - alist = item; - - if (numactive == 0) { - Py_DECREF(alist); - break; - } - - if (func == Py_None) - value = alist; - else { - value = PyEval_CallObject(func, alist); - Py_DECREF(alist); - if (value == NULL) - goto Fail_1; - } - if (i >= len) { - int status = PyList_Append(result, value); - Py_DECREF(value); - if (status < 0) - goto Fail_1; - } - else if (PyList_SetItem(result, i, value) < 0) - goto Fail_1; - } - - if (i < len && PyList_SetSlice(result, i, len, NULL) < 0) - goto Fail_1; - - goto Succeed; - -Fail_1: - Py_DECREF(result); -Fail_2: - result = NULL; -Succeed: - assert(seqs); - for (i = 0; i < n; ++i) - Py_XDECREF(seqs[i].it); - PyMem_DEL(seqs); - return result; -} - -PyDoc_STRVAR(map_doc, -"map(function, sequence[, sequence, ...]) -> list\n\ -\n\ -Return a list of the results of applying the function to the items of\n\ -the argument sequence(s). If more than one sequence is given, the\n\ -function is called with an argument list consisting of the corresponding\n\ -item of each sequence, substituting None for missing values when not all\n\ -sequences have the same length. If the function is None, return a list of\n\ -the items of the sequence (or a list of tuples if more than one sequence)."); - - -static PyObject * -builtin_next(PyObject *self, PyObject *args) -{ - PyObject *it, *res; - PyObject *def = NULL; - - if (!PyArg_UnpackTuple(args, "next", 1, 2, &it, &def)) - return NULL; - if (!PyIter_Check(it)) { - PyErr_Format(PyExc_TypeError, - "%.200s object is not an iterator", - it->ob_type->tp_name); - return NULL; - } - - res = (*it->ob_type->tp_iternext)(it); - if (res != NULL) { - return res; - } else if (def != NULL) { - if (PyErr_Occurred()) { - if (!PyErr_ExceptionMatches(PyExc_StopIteration)) - return NULL; - PyErr_Clear(); - } - Py_INCREF(def); - return def; - } else if (PyErr_Occurred()) { - return NULL; - } else { - PyErr_SetNone(PyExc_StopIteration); - return NULL; - } -} - -PyDoc_STRVAR(next_doc, -"next(iterator[, default])\n\ -\n\ -Return the next item from the iterator. If default is given and the iterator\n\ -is exhausted, it is returned instead of raising StopIteration."); - - -static PyObject * -builtin_setattr(PyObject *self, PyObject *args) -{ - PyObject *v; - PyObject *name; - PyObject *value; - - if (!PyArg_UnpackTuple(args, "setattr", 3, 3, &v, &name, &value)) - return NULL; - if (PyObject_SetAttr(v, name, value) != 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setattr_doc, -"setattr(object, name, value)\n\ -\n\ -Set a named attribute on an object; setattr(x, 'y', v) is equivalent to\n\ -``x.y = v''."); - - -static PyObject * -builtin_delattr(PyObject *self, PyObject *args) -{ - PyObject *v; - PyObject *name; - - if (!PyArg_UnpackTuple(args, "delattr", 2, 2, &v, &name)) - return NULL; - if (PyObject_SetAttr(v, name, (PyObject *)NULL) != 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(delattr_doc, -"delattr(object, name)\n\ -\n\ -Delete a named attribute on an object; delattr(x, 'y') is equivalent to\n\ -``del x.y''."); - - -static PyObject * -builtin_hash(PyObject *self, PyObject *v) -{ - long x; - - x = PyObject_Hash(v); - if (x == -1) - return NULL; - return PyInt_FromLong(x); -} - -PyDoc_STRVAR(hash_doc, -"hash(object) -> integer\n\ -\n\ -Return a hash value for the object. Two objects with the same value have\n\ -the same hash value. The reverse is not necessarily true, but likely."); - - -static PyObject * -builtin_hex(PyObject *self, PyObject *v) -{ - PyNumberMethods *nb; - PyObject *res; - - if ((nb = v->ob_type->tp_as_number) == NULL || - nb->nb_hex == NULL) { - PyErr_SetString(PyExc_TypeError, - "hex() argument can't be converted to hex"); - return NULL; - } - res = (*nb->nb_hex)(v); - if (res && !PyString_Check(res)) { - PyErr_Format(PyExc_TypeError, - "__hex__ returned non-string (type %.200s)", - res->ob_type->tp_name); - Py_DECREF(res); - return NULL; - } - return res; -} - -PyDoc_STRVAR(hex_doc, -"hex(number) -> string\n\ -\n\ -Return the hexadecimal representation of an integer or long integer."); - - -static PyObject *builtin_raw_input(PyObject *, PyObject *); - -static PyObject * -builtin_input(PyObject *self, PyObject *args) -{ - PyObject *line; - char *str; - PyObject *res; - PyObject *globals, *locals; - PyCompilerFlags cf; - - line = builtin_raw_input(self, args); - if (line == NULL) - return line; - if (!PyArg_Parse(line, "s;embedded '\\0' in input line", &str)) - return NULL; - while (*str == ' ' || *str == '\t') - str++; - globals = PyEval_GetGlobals(); - locals = PyEval_GetLocals(); - if (PyDict_GetItemString(globals, "__builtins__") == NULL) { - if (PyDict_SetItemString(globals, "__builtins__", - PyEval_GetBuiltins()) != 0) - return NULL; - } - cf.cf_flags = 0; - PyEval_MergeCompilerFlags(&cf); - res = PyRun_StringFlags(str, Py_eval_input, globals, locals, &cf); - Py_DECREF(line); - return res; -} - -PyDoc_STRVAR(input_doc, -"input([prompt]) -> value\n\ -\n\ -Equivalent to eval(raw_input(prompt))."); - - -static PyObject * -builtin_intern(PyObject *self, PyObject *args) -{ - PyObject *s; - if (!PyArg_ParseTuple(args, "S:intern", &s)) - return NULL; - if (!PyString_CheckExact(s)) { - PyErr_SetString(PyExc_TypeError, - "can't intern subclass of string"); - return NULL; - } - Py_INCREF(s); - PyString_InternInPlace(&s); - return s; -} - -PyDoc_STRVAR(intern_doc, -"intern(string) -> string\n\ -\n\ -``Intern'' the given string. This enters the string in the (global)\n\ -table of interned strings whose purpose is to speed up dictionary lookups.\n\ -Return the string itself or the previously interned string object with the\n\ -same value."); - - -static PyObject * -builtin_iter(PyObject *self, PyObject *args) -{ - PyObject *v, *w = NULL; - - if (!PyArg_UnpackTuple(args, "iter", 1, 2, &v, &w)) - return NULL; - if (w == NULL) - return PyObject_GetIter(v); - if (!PyCallable_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "iter(v, w): v must be callable"); - return NULL; - } - return PyCallIter_New(v, w); -} - -PyDoc_STRVAR(iter_doc, -"iter(collection) -> iterator\n\ -iter(callable, sentinel) -> iterator\n\ -\n\ -Get an iterator from an object. In the first form, the argument must\n\ -supply its own iterator, or be a sequence.\n\ -In the second form, the callable is called until it returns the sentinel."); - - -static PyObject * -builtin_len(PyObject *self, PyObject *v) -{ - Py_ssize_t res; - - res = PyObject_Size(v); - if (res < 0 && PyErr_Occurred()) - return NULL; - return PyInt_FromSsize_t(res); -} - -PyDoc_STRVAR(len_doc, -"len(object) -> integer\n\ -\n\ -Return the number of items of a sequence or collection."); - - -static PyObject * -builtin_locals(PyObject *self) -{ - PyObject *d; - - d = PyEval_GetLocals(); - Py_XINCREF(d); - return d; -} - -PyDoc_STRVAR(locals_doc, -"locals() -> dictionary\n\ -\n\ -Update and return a dictionary containing the current scope's local variables."); - - -static PyObject * -min_max(PyObject *args, PyObject *kwds, int op) -{ - PyObject *v, *it, *item, *val, *maxitem, *maxval, *keyfunc=NULL; - const char *name = op == Py_LT ? "min" : "max"; - - if (PyTuple_Size(args) > 1) - v = args; - else if (!PyArg_UnpackTuple(args, (char *)name, 1, 1, &v)) - return NULL; - - if (kwds != NULL && PyDict_Check(kwds) && PyDict_Size(kwds)) { - keyfunc = PyDict_GetItemString(kwds, "key"); - if (PyDict_Size(kwds)!=1 || keyfunc == NULL) { - PyErr_Format(PyExc_TypeError, - "%s() got an unexpected keyword argument", name); - return NULL; - } - Py_INCREF(keyfunc); - } - - it = PyObject_GetIter(v); - if (it == NULL) { - Py_XDECREF(keyfunc); - return NULL; - } - - maxitem = NULL; /* the result */ - maxval = NULL; /* the value associated with the result */ - while (( item = PyIter_Next(it) )) { - /* get the value from the key function */ - if (keyfunc != NULL) { - val = PyObject_CallFunctionObjArgs(keyfunc, item, NULL); - if (val == NULL) - goto Fail_it_item; - } - /* no key function; the value is the item */ - else { - val = item; - Py_INCREF(val); - } - - /* maximum value and item are unset; set them */ - if (maxval == NULL) { - maxitem = item; - maxval = val; - } - /* maximum value and item are set; update them as necessary */ - else { - int cmp = PyObject_RichCompareBool(val, maxval, op); - if (cmp < 0) - goto Fail_it_item_and_val; - else if (cmp > 0) { - Py_DECREF(maxval); - Py_DECREF(maxitem); - maxval = val; - maxitem = item; - } - else { - Py_DECREF(item); - Py_DECREF(val); - } - } - } - if (PyErr_Occurred()) - goto Fail_it; - if (maxval == NULL) { - PyErr_Format(PyExc_ValueError, - "%s() arg is an empty sequence", name); - assert(maxitem == NULL); - } - else - Py_DECREF(maxval); - Py_DECREF(it); - Py_XDECREF(keyfunc); - return maxitem; - -Fail_it_item_and_val: - Py_DECREF(val); -Fail_it_item: - Py_DECREF(item); -Fail_it: - Py_XDECREF(maxval); - Py_XDECREF(maxitem); - Py_DECREF(it); - Py_XDECREF(keyfunc); - return NULL; -} - -static PyObject * -builtin_min(PyObject *self, PyObject *args, PyObject *kwds) -{ - return min_max(args, kwds, Py_LT); -} - -PyDoc_STRVAR(min_doc, -"min(iterable[, key=func]) -> value\n\ -min(a, b, c, ...[, key=func]) -> value\n\ -\n\ -With a single iterable argument, return its smallest item.\n\ -With two or more arguments, return the smallest argument."); - - -static PyObject * -builtin_max(PyObject *self, PyObject *args, PyObject *kwds) -{ - return min_max(args, kwds, Py_GT); -} - -PyDoc_STRVAR(max_doc, -"max(iterable[, key=func]) -> value\n\ -max(a, b, c, ...[, key=func]) -> value\n\ -\n\ -With a single iterable argument, return its largest item.\n\ -With two or more arguments, return the largest argument."); - - -static PyObject * -builtin_oct(PyObject *self, PyObject *v) -{ - PyNumberMethods *nb; - PyObject *res; - - if (v == NULL || (nb = v->ob_type->tp_as_number) == NULL || - nb->nb_oct == NULL) { - PyErr_SetString(PyExc_TypeError, - "oct() argument can't be converted to oct"); - return NULL; - } - res = (*nb->nb_oct)(v); - if (res && !PyString_Check(res)) { - PyErr_Format(PyExc_TypeError, - "__oct__ returned non-string (type %.200s)", - res->ob_type->tp_name); - Py_DECREF(res); - return NULL; - } - return res; -} - -PyDoc_STRVAR(oct_doc, -"oct(number) -> string\n\ -\n\ -Return the octal representation of an integer or long integer."); - - -static PyObject * -builtin_open(PyObject *self, PyObject *args, PyObject *kwds) -{ - return PyObject_Call((PyObject*)&PyFile_Type, args, kwds); -} - -PyDoc_STRVAR(open_doc, -"open(name[, mode[, buffering]]) -> file object\n\ -\n\ -Open a file using the file() type, returns a file object. This is the\n\ -preferred way to open a file. See file.__doc__ for further information."); - - -static PyObject * -builtin_ord(PyObject *self, PyObject* obj) -{ - long ord; - Py_ssize_t size; - - if (PyString_Check(obj)) { - size = PyString_GET_SIZE(obj); - if (size == 1) { - ord = (long)((unsigned char)*PyString_AS_STRING(obj)); - return PyInt_FromLong(ord); - } - } else if (PyByteArray_Check(obj)) { - size = PyByteArray_GET_SIZE(obj); - if (size == 1) { - ord = (long)((unsigned char)*PyByteArray_AS_STRING(obj)); - return PyInt_FromLong(ord); - } - -#ifdef Py_USING_UNICODE - } else if (PyUnicode_Check(obj)) { - size = PyUnicode_GET_SIZE(obj); - if (size == 1) { - ord = (long)*PyUnicode_AS_UNICODE(obj); - return PyInt_FromLong(ord); - } -#endif - } else { - PyErr_Format(PyExc_TypeError, - "ord() expected string of length 1, but " \ - "%.200s found", obj->ob_type->tp_name); - return NULL; - } - - PyErr_Format(PyExc_TypeError, - "ord() expected a character, " - "but string of length %zd found", - size); - return NULL; -} - -PyDoc_STRVAR(ord_doc, -"ord(c) -> integer\n\ -\n\ -Return the integer ordinal of a one-character string."); - - -static PyObject * -builtin_pow(PyObject *self, PyObject *args) -{ - PyObject *v, *w, *z = Py_None; - - if (!PyArg_UnpackTuple(args, "pow", 2, 3, &v, &w, &z)) - return NULL; - return PyNumber_Power(v, w, z); -} - -PyDoc_STRVAR(pow_doc, -"pow(x, y[, z]) -> number\n\ -\n\ -With two arguments, equivalent to x**y. With three arguments,\n\ -equivalent to (x**y) % z, but may be more efficient (e.g. for longs)."); - - -static PyObject * -builtin_print(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"sep", "end", "file", 0}; - static PyObject *dummy_args = NULL; - static PyObject *unicode_newline = NULL, *unicode_space = NULL; - static PyObject *str_newline = NULL, *str_space = NULL; - PyObject *newline, *space; - PyObject *sep = NULL, *end = NULL, *file = NULL; - int i, err, use_unicode = 0; - - if (dummy_args == NULL) { - if (!(dummy_args = PyTuple_New(0))) - return NULL; - } - if (str_newline == NULL) { - str_newline = PyString_FromString("\n"); - if (str_newline == NULL) - return NULL; - str_space = PyString_FromString(" "); - if (str_space == NULL) { - Py_CLEAR(str_newline); - return NULL; - } -#ifdef Py_USING_UNICODE - unicode_newline = PyUnicode_FromString("\n"); - if (unicode_newline == NULL) { - Py_CLEAR(str_newline); - Py_CLEAR(str_space); - return NULL; - } - unicode_space = PyUnicode_FromString(" "); - if (unicode_space == NULL) { - Py_CLEAR(str_newline); - Py_CLEAR(str_space); - Py_CLEAR(unicode_space); - return NULL; - } -#endif - } - if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print", - kwlist, &sep, &end, &file)) - return NULL; - if (file == NULL || file == Py_None) { - file = PySys_GetObject("stdout"); - /* sys.stdout may be None when FILE* stdout isn't connected */ - if (file == Py_None) - Py_RETURN_NONE; - } - if (sep == Py_None) { - sep = NULL; - } - else if (sep) { - if (PyUnicode_Check(sep)) { - use_unicode = 1; - } - else if (!PyString_Check(sep)) { - PyErr_Format(PyExc_TypeError, - "sep must be None, str or unicode, not %.200s", - sep->ob_type->tp_name); - return NULL; - } - } - if (end == Py_None) - end = NULL; - else if (end) { - if (PyUnicode_Check(end)) { - use_unicode = 1; - } - else if (!PyString_Check(end)) { - PyErr_Format(PyExc_TypeError, - "end must be None, str or unicode, not %.200s", - end->ob_type->tp_name); - return NULL; - } - } - - if (!use_unicode) { - for (i = 0; i < PyTuple_Size(args); i++) { - if (PyUnicode_Check(PyTuple_GET_ITEM(args, i))) { - use_unicode = 1; - break; - } - } - } - if (use_unicode) { - newline = unicode_newline; - space = unicode_space; - } - else { - newline = str_newline; - space = str_space; - } - - for (i = 0; i < PyTuple_Size(args); i++) { - if (i > 0) { - if (sep == NULL) - err = PyFile_WriteObject(space, file, - Py_PRINT_RAW); - else - err = PyFile_WriteObject(sep, file, - Py_PRINT_RAW); - if (err) - return NULL; - } - err = PyFile_WriteObject(PyTuple_GetItem(args, i), file, - Py_PRINT_RAW); - if (err) - return NULL; - } - - if (end == NULL) - err = PyFile_WriteObject(newline, file, Py_PRINT_RAW); - else - err = PyFile_WriteObject(end, file, Py_PRINT_RAW); - if (err) - return NULL; - - Py_RETURN_NONE; -} - -PyDoc_STRVAR(print_doc, -"print(value, ..., sep=' ', end='\\n', file=sys.stdout)\n\ -\n\ -Prints the values to a stream, or to sys.stdout by default.\n\ -Optional keyword arguments:\n\ -file: a file-like object (stream); defaults to the current sys.stdout.\n\ -sep: string inserted between values, default a space.\n\ -end: string appended after the last value, default a newline."); - - -/* Return number of items in range (lo, hi, step), when arguments are - * PyInt or PyLong objects. step > 0 required. Return a value < 0 if - * & only if the true value is too large to fit in a signed long. - * Arguments MUST return 1 with either PyInt_Check() or - * PyLong_Check(). Return -1 when there is an error. - */ -static long -get_len_of_range_longs(PyObject *lo, PyObject *hi, PyObject *step) -{ - /* ------------------------------------------------------------- - Algorithm is equal to that of get_len_of_range(), but it operates - on PyObjects (which are assumed to be PyLong or PyInt objects). - ---------------------------------------------------------------*/ - long n; - PyObject *diff = NULL; - PyObject *one = NULL; - PyObject *tmp1 = NULL, *tmp2 = NULL, *tmp3 = NULL; - /* holds sub-expression evaluations */ - - /* if (lo >= hi), return length of 0. */ - if (PyObject_Compare(lo, hi) >= 0) - return 0; - - if ((one = PyLong_FromLong(1L)) == NULL) - goto Fail; - - if ((tmp1 = PyNumber_Subtract(hi, lo)) == NULL) - goto Fail; - - if ((diff = PyNumber_Subtract(tmp1, one)) == NULL) - goto Fail; - - if ((tmp2 = PyNumber_FloorDivide(diff, step)) == NULL) - goto Fail; - - if ((tmp3 = PyNumber_Add(tmp2, one)) == NULL) - goto Fail; - - n = PyLong_AsLong(tmp3); - if (PyErr_Occurred()) { /* Check for Overflow */ - PyErr_Clear(); - goto Fail; - } - - Py_DECREF(tmp3); - Py_DECREF(tmp2); - Py_DECREF(diff); - Py_DECREF(tmp1); - Py_DECREF(one); - return n; - - Fail: - Py_XDECREF(tmp3); - Py_XDECREF(tmp2); - Py_XDECREF(diff); - Py_XDECREF(tmp1); - Py_XDECREF(one); - return -1; -} - -/* Helper function for handle_range_longs. If arg is int or long - object, returns it with incremented reference count. If arg is - float, raises type error. As a last resort, creates a new int by - calling arg type's nb_int method if it is defined. Returns NULL - and sets exception on error. - - Returns a new reference to an int object. */ -static PyObject * -get_range_long_argument(PyObject *arg, const char *name) -{ - PyObject *v; - PyNumberMethods *nb; - if (PyInt_Check(arg) || PyLong_Check(arg)) { - Py_INCREF(arg); - return arg; - } - if (PyFloat_Check(arg) || - (nb = Py_TYPE(arg)->tp_as_number) == NULL || - nb->nb_int == NULL) { - PyErr_Format(PyExc_TypeError, - "range() integer %s argument expected, got %s.", - name, arg->ob_type->tp_name); - return NULL; - } - v = nb->nb_int(arg); - if (v == NULL) - return NULL; - if (PyInt_Check(v) || PyLong_Check(v)) - return v; - Py_DECREF(v); - PyErr_SetString(PyExc_TypeError, - "__int__ should return int object"); - return NULL; -} - -/* An extension of builtin_range() that handles the case when PyLong - * arguments are given. */ -static PyObject * -handle_range_longs(PyObject *self, PyObject *args) -{ - PyObject *ilow = NULL; - PyObject *ihigh = NULL; - PyObject *istep = NULL; - - PyObject *low = NULL; - PyObject *high = NULL; - PyObject *step = NULL; - - PyObject *curnum = NULL; - PyObject *v = NULL; - long bign; - Py_ssize_t i, n; - int cmp_result; - - PyObject *zero = PyLong_FromLong(0); - - if (zero == NULL) - return NULL; - - if (!PyArg_UnpackTuple(args, "range", 1, 3, &ilow, &ihigh, &istep)) { - Py_DECREF(zero); - return NULL; - } - - /* Figure out which way we were called, supply defaults, and be - * sure to incref everything so that the decrefs at the end - * are correct. NB: ilow, ihigh and istep are borrowed references. - */ - assert(ilow != NULL); - if (ihigh == NULL) { - /* only 1 arg -- it's the upper limit */ - ihigh = ilow; - ilow = NULL; - } - - /* convert ihigh if necessary */ - assert(ihigh != NULL); - high = get_range_long_argument(ihigh, "end"); - if (high == NULL) - goto Fail; - - /* ihigh correct now; do ilow */ - if (ilow == NULL) { - Py_INCREF(zero); - low = zero; - } - else { - low = get_range_long_argument(ilow, "start"); - if (low == NULL) - goto Fail; - } - - /* ilow and ihigh correct now; do istep */ - if (istep == NULL) - step = PyLong_FromLong(1); - else - step = get_range_long_argument(istep, "step"); - if (step == NULL) - goto Fail; - - if (PyObject_Cmp(step, zero, &cmp_result) == -1) - goto Fail; - - if (cmp_result == 0) { - PyErr_SetString(PyExc_ValueError, - "range() step argument must not be zero"); - goto Fail; - } - - if (cmp_result > 0) - bign = get_len_of_range_longs(low, high, step); - else { - PyObject *neg_step = PyNumber_Negative(step); - if (neg_step == NULL) - goto Fail; - bign = get_len_of_range_longs(high, low, neg_step); - Py_DECREF(neg_step); - } - - n = (Py_ssize_t)bign; - if (bign < 0 || (long)n != bign) { - PyErr_SetString(PyExc_OverflowError, - "range() result has too many items"); - goto Fail; - } - - v = PyList_New(n); - if (v == NULL) - goto Fail; - - curnum = low; - Py_INCREF(curnum); - - for (i = 0; i < n; i++) { - PyObject *w = PyNumber_Long(curnum); - PyObject *tmp_num; - if (w == NULL) - goto Fail; - - PyList_SET_ITEM(v, i, w); - - tmp_num = PyNumber_Add(curnum, step); - if (tmp_num == NULL) - goto Fail; - - Py_DECREF(curnum); - curnum = tmp_num; - } - Py_DECREF(low); - Py_DECREF(high); - Py_DECREF(step); - Py_DECREF(zero); - Py_DECREF(curnum); - return v; - - Fail: - Py_XDECREF(low); - Py_XDECREF(high); - Py_XDECREF(step); - Py_DECREF(zero); - Py_XDECREF(curnum); - Py_XDECREF(v); - return NULL; -} - -/* Return number of items in range/xrange (lo, hi, step). step > 0 - * required. Return a value < 0 if & only if the true value is too - * large to fit in a signed long. - */ -static long -get_len_of_range(long lo, long hi, long step) -{ - /* ------------------------------------------------------------- - If lo >= hi, the range is empty. - Else if n values are in the range, the last one is - lo + (n-1)*step, which must be <= hi-1. Rearranging, - n <= (hi - lo - 1)/step + 1, so taking the floor of the RHS gives - the proper value. Since lo < hi in this case, hi-lo-1 >= 0, so - the RHS is non-negative and so truncation is the same as the - floor. Letting M be the largest positive long, the worst case - for the RHS numerator is hi=M, lo=-M-1, and then - hi-lo-1 = M-(-M-1)-1 = 2*M. Therefore unsigned long has enough - precision to compute the RHS exactly. - ---------------------------------------------------------------*/ - long n = 0; - if (lo < hi) { - unsigned long uhi = (unsigned long)hi; - unsigned long ulo = (unsigned long)lo; - unsigned long diff = uhi - ulo - 1; - n = (long)(diff / (unsigned long)step + 1); - } - return n; -} - -static PyObject * -builtin_range(PyObject *self, PyObject *args) -{ - long ilow = 0, ihigh = 0, istep = 1; - long bign; - Py_ssize_t i, n; - - PyObject *v; - - if (PyTuple_Size(args) <= 1) { - if (!PyArg_ParseTuple(args, - "l;range() requires 1-3 int arguments", - &ihigh)) { - PyErr_Clear(); - return handle_range_longs(self, args); - } - } - else { - if (!PyArg_ParseTuple(args, - "ll|l;range() requires 1-3 int arguments", - &ilow, &ihigh, &istep)) { - PyErr_Clear(); - return handle_range_longs(self, args); - } - } - if (istep == 0) { - PyErr_SetString(PyExc_ValueError, - "range() step argument must not be zero"); - return NULL; - } - if (istep > 0) - bign = get_len_of_range(ilow, ihigh, istep); - else - bign = get_len_of_range(ihigh, ilow, -istep); - n = (Py_ssize_t)bign; - if (bign < 0 || (long)n != bign) { - PyErr_SetString(PyExc_OverflowError, - "range() result has too many items"); - return NULL; - } - v = PyList_New(n); - if (v == NULL) - return NULL; - for (i = 0; i < n; i++) { - PyObject *w = PyInt_FromLong(ilow); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SET_ITEM(v, i, w); - ilow += istep; - } - return v; -} - -PyDoc_STRVAR(range_doc, -"range(stop) -> list of integers\n\ -range(start, stop[, step]) -> list of integers\n\ -\n\ -Return a list containing an arithmetic progression of integers.\n\ -range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.\n\ -When step is given, it specifies the increment (or decrement).\n\ -For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!\n\ -These are exactly the valid indices for a list of 4 elements."); - - -static PyObject * -builtin_raw_input(PyObject *self, PyObject *args) -{ - PyObject *v = NULL; - PyObject *fin = PySys_GetObject("stdin"); - PyObject *fout = PySys_GetObject("stdout"); - - if (!PyArg_UnpackTuple(args, "[raw_]input", 0, 1, &v)) - return NULL; - - if (fin == NULL) { - PyErr_SetString(PyExc_RuntimeError, "[raw_]input: lost sys.stdin"); - return NULL; - } - if (fout == NULL) { - PyErr_SetString(PyExc_RuntimeError, "[raw_]input: lost sys.stdout"); - return NULL; - } - if (PyFile_SoftSpace(fout, 0)) { - if (PyFile_WriteString(" ", fout) != 0) - return NULL; - } - if (PyFile_AsFile(fin) && PyFile_AsFile(fout) - && isatty(fileno(PyFile_AsFile(fin))) - && isatty(fileno(PyFile_AsFile(fout)))) { - PyObject *po; - char *prompt; - char *s; - PyObject *result; - if (v != NULL) { - po = PyObject_Str(v); - if (po == NULL) - return NULL; - prompt = PyString_AsString(po); - if (prompt == NULL) - return NULL; - } - else { - po = NULL; - prompt = ""; - } - s = PyOS_Readline(PyFile_AsFile(fin), PyFile_AsFile(fout), - prompt); - Py_XDECREF(po); - if (s == NULL) { - if (!PyErr_Occurred()) - PyErr_SetNone(PyExc_KeyboardInterrupt); - return NULL; - } - if (*s == '\0') { - PyErr_SetNone(PyExc_EOFError); - result = NULL; - } - else { /* strip trailing '\n' */ - size_t len = strlen(s); - if (len > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "[raw_]input: input too long"); - result = NULL; - } - else { - result = PyString_FromStringAndSize(s, len-1); - } - } - PyMem_FREE(s); - return result; - } - if (v != NULL) { - if (PyFile_WriteObject(v, fout, Py_PRINT_RAW) != 0) - return NULL; - } - return PyFile_GetLine(fin, -1); -} - -PyDoc_STRVAR(raw_input_doc, -"raw_input([prompt]) -> string\n\ -\n\ -Read a string from standard input. The trailing newline is stripped.\n\ -If the user hits EOF (Unix: Ctl-D, Windows: Ctl-Z+Return), raise EOFError.\n\ -On Unix, GNU readline is used if enabled. The prompt string, if given,\n\ -is printed without a trailing newline before reading."); - - -static PyObject * -builtin_reduce(PyObject *self, PyObject *args) -{ - static PyObject *functools_reduce = NULL; - - if (PyErr_WarnPy3k("reduce() not supported in 3.x; " - "use functools.reduce()", 1) < 0) - return NULL; - - if (functools_reduce == NULL) { - PyObject *functools = PyImport_ImportModule("functools"); - if (functools == NULL) - return NULL; - functools_reduce = PyObject_GetAttrString(functools, "reduce"); - Py_DECREF(functools); - if (functools_reduce == NULL) - return NULL; - } - return PyObject_Call(functools_reduce, args, NULL); -} - -PyDoc_STRVAR(reduce_doc, -"reduce(function, sequence[, initial]) -> value\n\ -\n\ -Apply a function of two arguments cumulatively to the items of a sequence,\n\ -from left to right, so as to reduce the sequence to a single value.\n\ -For example, reduce(lambda x, y: x+y, [1, 2, 3, 4, 5]) calculates\n\ -((((1+2)+3)+4)+5). If initial is present, it is placed before the items\n\ -of the sequence in the calculation, and serves as a default when the\n\ -sequence is empty."); - - -static PyObject * -builtin_reload(PyObject *self, PyObject *v) -{ - if (PyErr_WarnPy3k("In 3.x, reload() is renamed to imp.reload()", - 1) < 0) - return NULL; - - return PyImport_ReloadModule(v); -} - -PyDoc_STRVAR(reload_doc, -"reload(module) -> module\n\ -\n\ -Reload the module. The module must have been successfully imported before."); - - -static PyObject * -builtin_repr(PyObject *self, PyObject *v) -{ - return PyObject_Repr(v); -} - -PyDoc_STRVAR(repr_doc, -"repr(object) -> string\n\ -\n\ -Return the canonical string representation of the object.\n\ -For most object types, eval(repr(object)) == object."); - - -static PyObject * -builtin_round(PyObject *self, PyObject *args, PyObject *kwds) -{ - double x; - PyObject *o_ndigits = NULL; - Py_ssize_t ndigits; - static char *kwlist[] = {"number", "ndigits", 0}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "d|O:round", - kwlist, &x, &o_ndigits)) - return NULL; - - if (o_ndigits == NULL) { - /* second argument defaults to 0 */ - ndigits = 0; - } - else { - /* interpret 2nd argument as a Py_ssize_t; clip on overflow */ - ndigits = PyNumber_AsSsize_t(o_ndigits, NULL); - if (ndigits == -1 && PyErr_Occurred()) - return NULL; - } - - /* nans, infinities and zeros round to themselves */ - if (!Py_IS_FINITE(x) || x == 0.0) - return PyFloat_FromDouble(x); - - /* Deal with extreme values for ndigits. For ndigits > NDIGITS_MAX, x - always rounds to itself. For ndigits < NDIGITS_MIN, x always - rounds to +-0.0. Here 0.30103 is an upper bound for log10(2). */ -#define NDIGITS_MAX ((int)((DBL_MANT_DIG-DBL_MIN_EXP) * 0.30103)) -#define NDIGITS_MIN (-(int)((DBL_MAX_EXP + 1) * 0.30103)) - if (ndigits > NDIGITS_MAX) - /* return x */ - return PyFloat_FromDouble(x); - else if (ndigits < NDIGITS_MIN) - /* return 0.0, but with sign of x */ - return PyFloat_FromDouble(0.0*x); - else - /* finite x, and ndigits is not unreasonably large */ - /* _Py_double_round is defined in floatobject.c */ - return _Py_double_round(x, (int)ndigits); -#undef NDIGITS_MAX -#undef NDIGITS_MIN -} - -PyDoc_STRVAR(round_doc, -"round(number[, ndigits]) -> floating point number\n\ -\n\ -Round a number to a given precision in decimal digits (default 0 digits).\n\ -This always returns a floating point number. Precision may be negative."); - -static PyObject * -builtin_sorted(PyObject *self, PyObject *args, PyObject *kwds) -{ - PyObject *newlist, *v, *seq, *compare=NULL, *keyfunc=NULL, *newargs; - PyObject *callable; - static char *kwlist[] = {"iterable", "cmp", "key", "reverse", 0}; - int reverse; - - /* args 1-4 should match listsort in Objects/listobject.c */ - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|OOi:sorted", - kwlist, &seq, &compare, &keyfunc, &reverse)) - return NULL; - - newlist = PySequence_List(seq); - if (newlist == NULL) - return NULL; - - callable = PyObject_GetAttrString(newlist, "sort"); - if (callable == NULL) { - Py_DECREF(newlist); - return NULL; - } - - newargs = PyTuple_GetSlice(args, 1, 4); - if (newargs == NULL) { - Py_DECREF(newlist); - Py_DECREF(callable); - return NULL; - } - - v = PyObject_Call(callable, newargs, kwds); - Py_DECREF(newargs); - Py_DECREF(callable); - if (v == NULL) { - Py_DECREF(newlist); - return NULL; - } - Py_DECREF(v); - return newlist; -} - -PyDoc_STRVAR(sorted_doc, -"sorted(iterable, cmp=None, key=None, reverse=False) --> new sorted list"); - -static PyObject * -builtin_vars(PyObject *self, PyObject *args) -{ - PyObject *v = NULL; - PyObject *d; - - if (!PyArg_UnpackTuple(args, "vars", 0, 1, &v)) - return NULL; - if (v == NULL) { - d = PyEval_GetLocals(); - if (d == NULL) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, - "vars(): no locals!?"); - } - else - Py_INCREF(d); - } - else { - d = PyObject_GetAttrString(v, "__dict__"); - if (d == NULL) { - PyErr_SetString(PyExc_TypeError, - "vars() argument must have __dict__ attribute"); - return NULL; - } - } - return d; -} - -PyDoc_STRVAR(vars_doc, -"vars([object]) -> dictionary\n\ -\n\ -Without arguments, equivalent to locals().\n\ -With an argument, equivalent to object.__dict__."); - - -static PyObject* -builtin_sum(PyObject *self, PyObject *args) -{ - PyObject *seq; - PyObject *result = NULL; - PyObject *temp, *item, *iter; - - if (!PyArg_UnpackTuple(args, "sum", 1, 2, &seq, &result)) - return NULL; - - iter = PyObject_GetIter(seq); - if (iter == NULL) - return NULL; - - if (result == NULL) { - result = PyInt_FromLong(0); - if (result == NULL) { - Py_DECREF(iter); - return NULL; - } - } else { - /* reject string values for 'start' parameter */ - if (PyObject_TypeCheck(result, &PyBaseString_Type)) { - PyErr_SetString(PyExc_TypeError, - "sum() can't sum strings [use ''.join(seq) instead]"); - Py_DECREF(iter); - return NULL; - } - Py_INCREF(result); - } - -#ifndef SLOW_SUM - /* Fast addition by keeping temporary sums in C instead of new Python objects. - Assumes all inputs are the same type. If the assumption fails, default - to the more general routine. - */ - if (PyInt_CheckExact(result)) { - long i_result = PyInt_AS_LONG(result); - Py_DECREF(result); - result = NULL; - while(result == NULL) { - item = PyIter_Next(iter); - if (item == NULL) { - Py_DECREF(iter); - if (PyErr_Occurred()) - return NULL; - return PyInt_FromLong(i_result); - } - if (PyInt_CheckExact(item)) { - long b = PyInt_AS_LONG(item); - long x = i_result + b; - if ((x^i_result) >= 0 || (x^b) >= 0) { - i_result = x; - Py_DECREF(item); - continue; - } - } - /* Either overflowed or is not an int. Restore real objects and process normally */ - result = PyInt_FromLong(i_result); - temp = PyNumber_Add(result, item); - Py_DECREF(result); - Py_DECREF(item); - result = temp; - if (result == NULL) { - Py_DECREF(iter); - return NULL; - } - } - } - - if (PyFloat_CheckExact(result)) { - double f_result = PyFloat_AS_DOUBLE(result); - Py_DECREF(result); - result = NULL; - while(result == NULL) { - item = PyIter_Next(iter); - if (item == NULL) { - Py_DECREF(iter); - if (PyErr_Occurred()) - return NULL; - return PyFloat_FromDouble(f_result); - } - if (PyFloat_CheckExact(item)) { - PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0) - f_result += PyFloat_AS_DOUBLE(item); - PyFPE_END_PROTECT(f_result) - Py_DECREF(item); - continue; - } - if (PyInt_CheckExact(item)) { - PyFPE_START_PROTECT("add", Py_DECREF(item); Py_DECREF(iter); return 0) - f_result += (double)PyInt_AS_LONG(item); - PyFPE_END_PROTECT(f_result) - Py_DECREF(item); - continue; - } - result = PyFloat_FromDouble(f_result); - temp = PyNumber_Add(result, item); - Py_DECREF(result); - Py_DECREF(item); - result = temp; - if (result == NULL) { - Py_DECREF(iter); - return NULL; - } - } - } -#endif - - for(;;) { - item = PyIter_Next(iter); - if (item == NULL) { - /* error, or end-of-sequence */ - if (PyErr_Occurred()) { - Py_DECREF(result); - result = NULL; - } - break; - } - /* It's tempting to use PyNumber_InPlaceAdd instead of - PyNumber_Add here, to avoid quadratic running time - when doing 'sum(list_of_lists, [])'. However, this - would produce a change in behaviour: a snippet like - - empty = [] - sum([[x] for x in range(10)], empty) - - would change the value of empty. */ - temp = PyNumber_Add(result, item); - Py_DECREF(result); - Py_DECREF(item); - result = temp; - if (result == NULL) - break; - } - Py_DECREF(iter); - return result; -} - -PyDoc_STRVAR(sum_doc, -"sum(sequence[, start]) -> value\n\ -\n\ -Return the sum of a sequence of numbers (NOT strings) plus the value\n\ -of parameter 'start' (which defaults to 0). When the sequence is\n\ -empty, return start."); - - -static PyObject * -builtin_isinstance(PyObject *self, PyObject *args) -{ - PyObject *inst; - PyObject *cls; - int retval; - - if (!PyArg_UnpackTuple(args, "isinstance", 2, 2, &inst, &cls)) - return NULL; - - retval = PyObject_IsInstance(inst, cls); - if (retval < 0) - return NULL; - return PyBool_FromLong(retval); -} - -PyDoc_STRVAR(isinstance_doc, -"isinstance(object, class-or-type-or-tuple) -> bool\n\ -\n\ -Return whether an object is an instance of a class or of a subclass thereof.\n\ -With a type as second argument, return whether that is the object's type.\n\ -The form using a tuple, isinstance(x, (A, B, ...)), is a shortcut for\n\ -isinstance(x, A) or isinstance(x, B) or ... (etc.)."); - - -static PyObject * -builtin_issubclass(PyObject *self, PyObject *args) -{ - PyObject *derived; - PyObject *cls; - int retval; - - if (!PyArg_UnpackTuple(args, "issubclass", 2, 2, &derived, &cls)) - return NULL; - - retval = PyObject_IsSubclass(derived, cls); - if (retval < 0) - return NULL; - return PyBool_FromLong(retval); -} - -PyDoc_STRVAR(issubclass_doc, -"issubclass(C, B) -> bool\n\ -\n\ -Return whether class C is a subclass (i.e., a derived class) of class B.\n\ -When using a tuple as the second argument issubclass(X, (A, B, ...)),\n\ -is a shortcut for issubclass(X, A) or issubclass(X, B) or ... (etc.)."); - - -static PyObject* -builtin_zip(PyObject *self, PyObject *args) -{ - PyObject *ret; - const Py_ssize_t itemsize = PySequence_Length(args); - Py_ssize_t i; - PyObject *itlist; /* tuple of iterators */ - Py_ssize_t len; /* guess at result length */ - - if (itemsize == 0) - return PyList_New(0); - - /* args must be a tuple */ - assert(PyTuple_Check(args)); - - /* Guess at result length: the shortest of the input lengths. - If some argument refuses to say, we refuse to guess too, lest - an argument like xrange(sys.maxint) lead us astray.*/ - len = -1; /* unknown */ - for (i = 0; i < itemsize; ++i) { - PyObject *item = PyTuple_GET_ITEM(args, i); - Py_ssize_t thislen = _PyObject_LengthHint(item, -2); - if (thislen < 0) { - if (thislen == -1) - return NULL; - len = -1; - break; - } - else if (len < 0 || thislen < len) - len = thislen; - } - - /* allocate result list */ - if (len < 0) - len = 10; /* arbitrary */ - if ((ret = PyList_New(len)) == NULL) - return NULL; - - /* obtain iterators */ - itlist = PyTuple_New(itemsize); - if (itlist == NULL) - goto Fail_ret; - for (i = 0; i < itemsize; ++i) { - PyObject *item = PyTuple_GET_ITEM(args, i); - PyObject *it = PyObject_GetIter(item); - if (it == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) - PyErr_Format(PyExc_TypeError, - "zip argument #%zd must support iteration", - i+1); - goto Fail_ret_itlist; - } - PyTuple_SET_ITEM(itlist, i, it); - } - - /* build result into ret list */ - for (i = 0; ; ++i) { - int j; - PyObject *next = PyTuple_New(itemsize); - if (!next) - goto Fail_ret_itlist; - - for (j = 0; j < itemsize; j++) { - PyObject *it = PyTuple_GET_ITEM(itlist, j); - PyObject *item = PyIter_Next(it); - if (!item) { - if (PyErr_Occurred()) { - Py_DECREF(ret); - ret = NULL; - } - Py_DECREF(next); - Py_DECREF(itlist); - goto Done; - } - PyTuple_SET_ITEM(next, j, item); - } - - if (i < len) - PyList_SET_ITEM(ret, i, next); - else { - int status = PyList_Append(ret, next); - Py_DECREF(next); - ++len; - if (status < 0) - goto Fail_ret_itlist; - } - } - -Done: - if (ret != NULL && i < len) { - /* The list is too big. */ - if (PyList_SetSlice(ret, i, len, NULL) < 0) - return NULL; - } - return ret; - -Fail_ret_itlist: - Py_DECREF(itlist); -Fail_ret: - Py_DECREF(ret); - return NULL; -} - - -PyDoc_STRVAR(zip_doc, -"zip(seq1 [, seq2 [...]]) -> [(seq1[0], seq2[0] ...), (...)]\n\ -\n\ -Return a list of tuples, where each tuple contains the i-th element\n\ -from each of the argument sequences. The returned list is truncated\n\ -in length to the length of the shortest argument sequence."); - - -static PyMethodDef builtin_methods[] = { - {"__import__", (PyCFunction)builtin___import__, METH_VARARGS | METH_KEYWORDS, import_doc}, - {"abs", builtin_abs, METH_O, abs_doc}, - {"all", builtin_all, METH_O, all_doc}, - {"any", builtin_any, METH_O, any_doc}, - {"apply", builtin_apply, METH_VARARGS, apply_doc}, - {"bin", builtin_bin, METH_O, bin_doc}, - {"callable", builtin_callable, METH_O, callable_doc}, - {"chr", builtin_chr, METH_VARARGS, chr_doc}, - {"cmp", builtin_cmp, METH_VARARGS, cmp_doc}, - {"coerce", builtin_coerce, METH_VARARGS, coerce_doc}, - {"compile", (PyCFunction)builtin_compile, METH_VARARGS | METH_KEYWORDS, compile_doc}, - {"delattr", builtin_delattr, METH_VARARGS, delattr_doc}, - {"dir", builtin_dir, METH_VARARGS, dir_doc}, - {"divmod", builtin_divmod, METH_VARARGS, divmod_doc}, - {"eval", builtin_eval, METH_VARARGS, eval_doc}, - {"execfile", builtin_execfile, METH_VARARGS, execfile_doc}, - {"filter", builtin_filter, METH_VARARGS, filter_doc}, - {"format", builtin_format, METH_VARARGS, format_doc}, - {"getattr", builtin_getattr, METH_VARARGS, getattr_doc}, - {"globals", (PyCFunction)builtin_globals, METH_NOARGS, globals_doc}, - {"hasattr", builtin_hasattr, METH_VARARGS, hasattr_doc}, - {"hash", builtin_hash, METH_O, hash_doc}, - {"hex", builtin_hex, METH_O, hex_doc}, - {"id", builtin_id, METH_O, id_doc}, - {"input", builtin_input, METH_VARARGS, input_doc}, - {"intern", builtin_intern, METH_VARARGS, intern_doc}, - {"isinstance", builtin_isinstance, METH_VARARGS, isinstance_doc}, - {"issubclass", builtin_issubclass, METH_VARARGS, issubclass_doc}, - {"iter", builtin_iter, METH_VARARGS, iter_doc}, - {"len", builtin_len, METH_O, len_doc}, - {"locals", (PyCFunction)builtin_locals, METH_NOARGS, locals_doc}, - {"map", builtin_map, METH_VARARGS, map_doc}, - {"max", (PyCFunction)builtin_max, METH_VARARGS | METH_KEYWORDS, max_doc}, - {"min", (PyCFunction)builtin_min, METH_VARARGS | METH_KEYWORDS, min_doc}, - {"next", builtin_next, METH_VARARGS, next_doc}, - {"oct", builtin_oct, METH_O, oct_doc}, - {"open", (PyCFunction)builtin_open, METH_VARARGS | METH_KEYWORDS, open_doc}, - {"ord", builtin_ord, METH_O, ord_doc}, - {"pow", builtin_pow, METH_VARARGS, pow_doc}, - {"print", (PyCFunction)builtin_print, METH_VARARGS | METH_KEYWORDS, print_doc}, - {"range", builtin_range, METH_VARARGS, range_doc}, - {"raw_input", builtin_raw_input, METH_VARARGS, raw_input_doc}, - {"reduce", builtin_reduce, METH_VARARGS, reduce_doc}, - {"reload", builtin_reload, METH_O, reload_doc}, - {"repr", builtin_repr, METH_O, repr_doc}, - {"round", (PyCFunction)builtin_round, METH_VARARGS | METH_KEYWORDS, round_doc}, - {"setattr", builtin_setattr, METH_VARARGS, setattr_doc}, - {"sorted", (PyCFunction)builtin_sorted, METH_VARARGS | METH_KEYWORDS, sorted_doc}, - {"sum", builtin_sum, METH_VARARGS, sum_doc}, -#ifdef Py_USING_UNICODE - {"unichr", builtin_unichr, METH_VARARGS, unichr_doc}, -#endif - {"vars", builtin_vars, METH_VARARGS, vars_doc}, - {"zip", builtin_zip, METH_VARARGS, zip_doc}, - {NULL, NULL}, -}; - -PyDoc_STRVAR(builtin_doc, -"Built-in functions, exceptions, and other objects.\n\ -\n\ -Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices."); - -PyObject * -_PyBuiltin_Init(void) -{ - PyObject *mod, *dict, *debug; - mod = Py_InitModule4("__builtin__", builtin_methods, - builtin_doc, (PyObject *)NULL, - PYTHON_API_VERSION); - if (mod == NULL) - return NULL; - dict = PyModule_GetDict(mod); - -#ifdef Py_TRACE_REFS - /* __builtin__ exposes a number of statically allocated objects - * that, before this code was added in 2.3, never showed up in - * the list of "all objects" maintained by Py_TRACE_REFS. As a - * result, programs leaking references to None and False (etc) - * couldn't be diagnosed by examining sys.getobjects(0). - */ -#define ADD_TO_ALL(OBJECT) _Py_AddToAllObjects((PyObject *)(OBJECT), 0) -#else -#define ADD_TO_ALL(OBJECT) (void)0 -#endif - -#define SETBUILTIN(NAME, OBJECT) \ - if (PyDict_SetItemString(dict, NAME, (PyObject *)OBJECT) < 0) \ - return NULL; \ - ADD_TO_ALL(OBJECT) - - SETBUILTIN("None", Py_None); - SETBUILTIN("Ellipsis", Py_Ellipsis); - SETBUILTIN("NotImplemented", Py_NotImplemented); - SETBUILTIN("False", Py_False); - SETBUILTIN("True", Py_True); - SETBUILTIN("basestring", &PyBaseString_Type); - SETBUILTIN("bool", &PyBool_Type); - SETBUILTIN("memoryview", &PyMemoryView_Type); - SETBUILTIN("bytearray", &PyByteArray_Type); - SETBUILTIN("bytes", &PyString_Type); - SETBUILTIN("buffer", &PyBuffer_Type); - SETBUILTIN("classmethod", &PyClassMethod_Type); -#ifndef WITHOUT_COMPLEX - SETBUILTIN("complex", &PyComplex_Type); -#endif - SETBUILTIN("dict", &PyDict_Type); - SETBUILTIN("enumerate", &PyEnum_Type); - SETBUILTIN("file", &PyFile_Type); - SETBUILTIN("float", &PyFloat_Type); - SETBUILTIN("frozenset", &PyFrozenSet_Type); - SETBUILTIN("property", &PyProperty_Type); - SETBUILTIN("int", &PyInt_Type); - SETBUILTIN("list", &PyList_Type); - SETBUILTIN("long", &PyLong_Type); - SETBUILTIN("object", &PyBaseObject_Type); - SETBUILTIN("reversed", &PyReversed_Type); - SETBUILTIN("set", &PySet_Type); - SETBUILTIN("slice", &PySlice_Type); - SETBUILTIN("staticmethod", &PyStaticMethod_Type); - SETBUILTIN("str", &PyString_Type); - SETBUILTIN("super", &PySuper_Type); - SETBUILTIN("tuple", &PyTuple_Type); - SETBUILTIN("type", &PyType_Type); - SETBUILTIN("xrange", &PyRange_Type); -#ifdef Py_USING_UNICODE - SETBUILTIN("unicode", &PyUnicode_Type); -#endif - debug = PyBool_FromLong(Py_OptimizeFlag == 0); - if (PyDict_SetItemString(dict, "__debug__", debug) < 0) { - Py_XDECREF(debug); - return NULL; - } - Py_XDECREF(debug); - - return mod; -#undef ADD_TO_ALL -#undef SETBUILTIN -} - -/* Helper for filter(): filter a tuple through a function */ - -static PyObject * -filtertuple(PyObject *func, PyObject *tuple) -{ - PyObject *result; - Py_ssize_t i, j; - Py_ssize_t len = PyTuple_Size(tuple); - - if (len == 0) { - if (PyTuple_CheckExact(tuple)) - Py_INCREF(tuple); - else - tuple = PyTuple_New(0); - return tuple; - } - - if ((result = PyTuple_New(len)) == NULL) - return NULL; - - for (i = j = 0; i < len; ++i) { - PyObject *item, *good; - int ok; - - if (tuple->ob_type->tp_as_sequence && - tuple->ob_type->tp_as_sequence->sq_item) { - item = tuple->ob_type->tp_as_sequence->sq_item(tuple, i); - if (item == NULL) - goto Fail_1; - } else { - PyErr_SetString(PyExc_TypeError, "filter(): unsubscriptable tuple"); - goto Fail_1; - } - if (func == Py_None) { - Py_INCREF(item); - good = item; - } - else { - PyObject *arg = PyTuple_Pack(1, item); - if (arg == NULL) { - Py_DECREF(item); - goto Fail_1; - } - good = PyEval_CallObject(func, arg); - Py_DECREF(arg); - if (good == NULL) { - Py_DECREF(item); - goto Fail_1; - } - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - if (ok > 0) { - if (PyTuple_SetItem(result, j++, item) < 0) - goto Fail_1; - } - else { - Py_DECREF(item); - if (ok < 0) - goto Fail_1; - } - } - - if (_PyTuple_Resize(&result, j) < 0) - return NULL; - - return result; - -Fail_1: - Py_DECREF(result); - return NULL; -} - - -/* Helper for filter(): filter a string through a function */ - -static PyObject * -filterstring(PyObject *func, PyObject *strobj) -{ - PyObject *result; - Py_ssize_t i, j; - Py_ssize_t len = PyString_Size(strobj); - Py_ssize_t outlen = len; - - if (func == Py_None) { - /* If it's a real string we can return the original, - * as no character is ever false and __getitem__ - * does return this character. If it's a subclass - * we must go through the __getitem__ loop */ - if (PyString_CheckExact(strobj)) { - Py_INCREF(strobj); - return strobj; - } - } - if ((result = PyString_FromStringAndSize(NULL, len)) == NULL) - return NULL; - - for (i = j = 0; i < len; ++i) { - PyObject *item; - int ok; - - item = (*strobj->ob_type->tp_as_sequence->sq_item)(strobj, i); - if (item == NULL) - goto Fail_1; - if (func==Py_None) { - ok = 1; - } else { - PyObject *arg, *good; - arg = PyTuple_Pack(1, item); - if (arg == NULL) { - Py_DECREF(item); - goto Fail_1; - } - good = PyEval_CallObject(func, arg); - Py_DECREF(arg); - if (good == NULL) { - Py_DECREF(item); - goto Fail_1; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - } - if (ok > 0) { - Py_ssize_t reslen; - if (!PyString_Check(item)) { - PyErr_SetString(PyExc_TypeError, "can't filter str to str:" - " __getitem__ returned different type"); - Py_DECREF(item); - goto Fail_1; - } - reslen = PyString_GET_SIZE(item); - if (reslen == 1) { - PyString_AS_STRING(result)[j++] = - PyString_AS_STRING(item)[0]; - } else { - /* do we need more space? */ - Py_ssize_t need = j; - - /* calculate space requirements while checking for overflow */ - if (need > PY_SSIZE_T_MAX - reslen) { - Py_DECREF(item); - goto Fail_1; - } - - need += reslen; - - if (need > PY_SSIZE_T_MAX - len) { - Py_DECREF(item); - goto Fail_1; - } - - need += len; - - if (need <= i) { - Py_DECREF(item); - goto Fail_1; - } - - need = need - i - 1; - - assert(need >= 0); - assert(outlen >= 0); - - if (need > outlen) { - /* overallocate, to avoid reallocations */ - if (outlen > PY_SSIZE_T_MAX / 2) { - Py_DECREF(item); - return NULL; - } - - if (need<2*outlen) { - need = 2*outlen; - } - if (_PyString_Resize(&result, need)) { - Py_DECREF(item); - return NULL; - } - outlen = need; - } - memcpy( - PyString_AS_STRING(result) + j, - PyString_AS_STRING(item), - reslen - ); - j += reslen; - } - } - Py_DECREF(item); - if (ok < 0) - goto Fail_1; - } - - if (j < outlen) - _PyString_Resize(&result, j); - - return result; - -Fail_1: - Py_DECREF(result); - return NULL; -} - -#ifdef Py_USING_UNICODE -/* Helper for filter(): filter a Unicode object through a function */ - -static PyObject * -filterunicode(PyObject *func, PyObject *strobj) -{ - PyObject *result; - register Py_ssize_t i, j; - Py_ssize_t len = PyUnicode_GetSize(strobj); - Py_ssize_t outlen = len; - - if (func == Py_None) { - /* If it's a real string we can return the original, - * as no character is ever false and __getitem__ - * does return this character. If it's a subclass - * we must go through the __getitem__ loop */ - if (PyUnicode_CheckExact(strobj)) { - Py_INCREF(strobj); - return strobj; - } - } - if ((result = PyUnicode_FromUnicode(NULL, len)) == NULL) - return NULL; - - for (i = j = 0; i < len; ++i) { - PyObject *item, *arg, *good; - int ok; - - item = (*strobj->ob_type->tp_as_sequence->sq_item)(strobj, i); - if (item == NULL) - goto Fail_1; - if (func == Py_None) { - ok = 1; - } else { - arg = PyTuple_Pack(1, item); - if (arg == NULL) { - Py_DECREF(item); - goto Fail_1; - } - good = PyEval_CallObject(func, arg); - Py_DECREF(arg); - if (good == NULL) { - Py_DECREF(item); - goto Fail_1; - } - ok = PyObject_IsTrue(good); - Py_DECREF(good); - } - if (ok > 0) { - Py_ssize_t reslen; - if (!PyUnicode_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "can't filter unicode to unicode:" - " __getitem__ returned different type"); - Py_DECREF(item); - goto Fail_1; - } - reslen = PyUnicode_GET_SIZE(item); - if (reslen == 1) - PyUnicode_AS_UNICODE(result)[j++] = - PyUnicode_AS_UNICODE(item)[0]; - else { - /* do we need more space? */ - Py_ssize_t need = j + reslen + len - i - 1; - - /* check that didnt overflow */ - if ((j > PY_SSIZE_T_MAX - reslen) || - ((j + reslen) > PY_SSIZE_T_MAX - len) || - ((j + reslen + len) < i) || - ((j + reslen + len - i) <= 0)) { - Py_DECREF(item); - return NULL; - } - - assert(need >= 0); - assert(outlen >= 0); - - if (need > outlen) { - /* overallocate, - to avoid reallocations */ - if (need < 2 * outlen) { - if (outlen > PY_SSIZE_T_MAX / 2) { - Py_DECREF(item); - return NULL; - } else { - need = 2 * outlen; - } - } - - if (PyUnicode_Resize( - &result, need) < 0) { - Py_DECREF(item); - goto Fail_1; - } - outlen = need; - } - memcpy(PyUnicode_AS_UNICODE(result) + j, - PyUnicode_AS_UNICODE(item), - reslen*sizeof(Py_UNICODE)); - j += reslen; - } - } - Py_DECREF(item); - if (ok < 0) - goto Fail_1; - } - - if (j < outlen) - PyUnicode_Resize(&result, j); - - return result; - -Fail_1: - Py_DECREF(result); - return NULL; -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/ceval.c b/AppPkg/Applications/Python/Python-2.7.10/Python/ceval.c deleted file mode 100644 index 7e12374..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/ceval.c +++ /dev/null @@ -1,4917 +0,0 @@ - -/* Execute compiled code */ - -/* XXX TO DO: - XXX speed up searching for keywords by using a dictionary - XXX document it! - */ - -/* enable more aggressive intra-module optimizations, where available */ -#define PY_LOCAL_AGGRESSIVE - -#include "Python.h" - -#include "code.h" -#include "frameobject.h" -#include "eval.h" -#include "opcode.h" -#include "structmember.h" - -#include - -#ifndef WITH_TSC - -#define READ_TIMESTAMP(var) - -#else - -typedef unsigned long long uint64; - -/* PowerPC support. - "__ppc__" appears to be the preprocessor definition to detect on OS X, whereas - "__powerpc__" appears to be the correct one for Linux with GCC -*/ -#if defined(__ppc__) || defined (__powerpc__) - -#define READ_TIMESTAMP(var) ppc_getcounter(&var) - -static void -ppc_getcounter(uint64 *v) -{ - register unsigned long tbu, tb, tbu2; - - loop: - asm volatile ("mftbu %0" : "=r" (tbu) ); - asm volatile ("mftb %0" : "=r" (tb) ); - asm volatile ("mftbu %0" : "=r" (tbu2)); - if (__builtin_expect(tbu != tbu2, 0)) goto loop; - - /* The slightly peculiar way of writing the next lines is - compiled better by GCC than any other way I tried. */ - ((long*)(v))[0] = tbu; - ((long*)(v))[1] = tb; -} - -#elif defined(__i386__) - -/* this is for linux/x86 (and probably any other GCC/x86 combo) */ - -#define READ_TIMESTAMP(val) \ - __asm__ __volatile__("rdtsc" : "=A" (val)) - -#elif defined(__x86_64__) - -/* for gcc/x86_64, the "A" constraint in DI mode means *either* rax *or* rdx; - not edx:eax as it does for i386. Since rdtsc puts its result in edx:eax - even in 64-bit mode, we need to use "a" and "d" for the lower and upper - 32-bit pieces of the result. */ - -#define READ_TIMESTAMP(val) do { \ - unsigned int h, l; \ - __asm__ __volatile__("rdtsc" : "=a" (l), "=d" (h)); \ - (val) = ((uint64)l) | (((uint64)h) << 32); \ - } while(0) - - -#else - -#error "Don't know how to implement timestamp counter for this architecture" - -#endif - -void dump_tsc(int opcode, int ticked, uint64 inst0, uint64 inst1, - uint64 loop0, uint64 loop1, uint64 intr0, uint64 intr1) -{ - uint64 intr, inst, loop; - PyThreadState *tstate = PyThreadState_Get(); - if (!tstate->interp->tscdump) - return; - intr = intr1 - intr0; - inst = inst1 - inst0 - intr; - loop = loop1 - loop0 - intr; - fprintf(stderr, "opcode=%03d t=%d inst=%06lld loop=%06lld\n", - opcode, ticked, inst, loop); -} - -#endif - -/* Turn this on if your compiler chokes on the big switch: */ -/* #define CASE_TOO_BIG 1 */ - -#ifdef Py_DEBUG -/* For debugging the interpreter: */ -#define LLTRACE 1 /* Low-level trace feature */ -#define CHECKEXC 1 /* Double-check exception checking */ -#endif - -typedef PyObject *(*callproc)(PyObject *, PyObject *, PyObject *); - -/* Forward declarations */ -#ifdef WITH_TSC -static PyObject * call_function(PyObject ***, int, uint64*, uint64*); -#else -static PyObject * call_function(PyObject ***, int); -#endif -static PyObject * fast_function(PyObject *, PyObject ***, int, int, int); -static PyObject * do_call(PyObject *, PyObject ***, int, int); -static PyObject * ext_do_call(PyObject *, PyObject ***, int, int, int); -static PyObject * update_keyword_args(PyObject *, int, PyObject ***, - PyObject *); -static PyObject * update_star_args(int, int, PyObject *, PyObject ***); -static PyObject * load_args(PyObject ***, int); -#define CALL_FLAG_VAR 1 -#define CALL_FLAG_KW 2 - -#ifdef LLTRACE -static int lltrace; -static int prtrace(PyObject *, char *); -#endif -static int call_trace(Py_tracefunc, PyObject *, PyFrameObject *, - int, PyObject *); -static int call_trace_protected(Py_tracefunc, PyObject *, - PyFrameObject *, int, PyObject *); -static void call_exc_trace(Py_tracefunc, PyObject *, PyFrameObject *); -static int maybe_call_line_trace(Py_tracefunc, PyObject *, - PyFrameObject *, int *, int *, int *); - -static PyObject * apply_slice(PyObject *, PyObject *, PyObject *); -static int assign_slice(PyObject *, PyObject *, - PyObject *, PyObject *); -static PyObject * cmp_outcome(int, PyObject *, PyObject *); -static PyObject * import_from(PyObject *, PyObject *); -static int import_all_from(PyObject *, PyObject *); -static PyObject * build_class(PyObject *, PyObject *, PyObject *); -static int exec_statement(PyFrameObject *, - PyObject *, PyObject *, PyObject *); -static void set_exc_info(PyThreadState *, PyObject *, PyObject *, PyObject *); -static void reset_exc_info(PyThreadState *); -static void format_exc_check_arg(PyObject *, char *, PyObject *); -static PyObject * string_concatenate(PyObject *, PyObject *, - PyFrameObject *, unsigned char *); -static PyObject * kwd_as_string(PyObject *); -static PyObject * special_lookup(PyObject *, char *, PyObject **); - -#define NAME_ERROR_MSG \ - "name '%.200s' is not defined" -#define GLOBAL_NAME_ERROR_MSG \ - "global name '%.200s' is not defined" -#define UNBOUNDLOCAL_ERROR_MSG \ - "local variable '%.200s' referenced before assignment" -#define UNBOUNDFREE_ERROR_MSG \ - "free variable '%.200s' referenced before assignment" \ - " in enclosing scope" - -/* Dynamic execution profile */ -#ifdef DYNAMIC_EXECUTION_PROFILE -#ifdef DXPAIRS -static long dxpairs[257][256]; -#define dxp dxpairs[256] -#else -static long dxp[256]; -#endif -#endif - -/* Function call profile */ -#ifdef CALL_PROFILE -#define PCALL_NUM 11 -static int pcall[PCALL_NUM]; - -#define PCALL_ALL 0 -#define PCALL_FUNCTION 1 -#define PCALL_FAST_FUNCTION 2 -#define PCALL_FASTER_FUNCTION 3 -#define PCALL_METHOD 4 -#define PCALL_BOUND_METHOD 5 -#define PCALL_CFUNCTION 6 -#define PCALL_TYPE 7 -#define PCALL_GENERATOR 8 -#define PCALL_OTHER 9 -#define PCALL_POP 10 - -/* Notes about the statistics - - PCALL_FAST stats - - FAST_FUNCTION means no argument tuple needs to be created. - FASTER_FUNCTION means that the fast-path frame setup code is used. - - If there is a method call where the call can be optimized by changing - the argument tuple and calling the function directly, it gets recorded - twice. - - As a result, the relationship among the statistics appears to be - PCALL_ALL == PCALL_FUNCTION + PCALL_METHOD - PCALL_BOUND_METHOD + - PCALL_CFUNCTION + PCALL_TYPE + PCALL_GENERATOR + PCALL_OTHER - PCALL_FUNCTION > PCALL_FAST_FUNCTION > PCALL_FASTER_FUNCTION - PCALL_METHOD > PCALL_BOUND_METHOD -*/ - -#define PCALL(POS) pcall[POS]++ - -PyObject * -PyEval_GetCallStats(PyObject *self) -{ - return Py_BuildValue("iiiiiiiiiii", - pcall[0], pcall[1], pcall[2], pcall[3], - pcall[4], pcall[5], pcall[6], pcall[7], - pcall[8], pcall[9], pcall[10]); -} -#else -#define PCALL(O) - -PyObject * -PyEval_GetCallStats(PyObject *self) -{ - Py_INCREF(Py_None); - return Py_None; -} -#endif - - -#ifdef WITH_THREAD - -#ifdef HAVE_ERRNO_H -#include -#endif -#include "pythread.h" - -static PyThread_type_lock interpreter_lock = 0; /* This is the GIL */ -static PyThread_type_lock pending_lock = 0; /* for pending calls */ -static long main_thread = 0; - -int -PyEval_ThreadsInitialized(void) -{ - return interpreter_lock != 0; -} - -void -PyEval_InitThreads(void) -{ - if (interpreter_lock) - return; - interpreter_lock = PyThread_allocate_lock(); - PyThread_acquire_lock(interpreter_lock, 1); - main_thread = PyThread_get_thread_ident(); -} - -void -PyEval_AcquireLock(void) -{ - PyThread_acquire_lock(interpreter_lock, 1); -} - -void -PyEval_ReleaseLock(void) -{ - PyThread_release_lock(interpreter_lock); -} - -void -PyEval_AcquireThread(PyThreadState *tstate) -{ - if (tstate == NULL) - Py_FatalError("PyEval_AcquireThread: NULL new thread state"); - /* Check someone has called PyEval_InitThreads() to create the lock */ - assert(interpreter_lock); - PyThread_acquire_lock(interpreter_lock, 1); - if (PyThreadState_Swap(tstate) != NULL) - Py_FatalError( - "PyEval_AcquireThread: non-NULL old thread state"); -} - -void -PyEval_ReleaseThread(PyThreadState *tstate) -{ - if (tstate == NULL) - Py_FatalError("PyEval_ReleaseThread: NULL thread state"); - if (PyThreadState_Swap(NULL) != tstate) - Py_FatalError("PyEval_ReleaseThread: wrong thread state"); - PyThread_release_lock(interpreter_lock); -} - -/* This function is called from PyOS_AfterFork to ensure that newly - created child processes don't hold locks referring to threads which - are not running in the child process. (This could also be done using - pthread_atfork mechanism, at least for the pthreads implementation.) */ - -void -PyEval_ReInitThreads(void) -{ - PyObject *threading, *result; - PyThreadState *tstate; - - if (!interpreter_lock) - return; - /*XXX Can't use PyThread_free_lock here because it does too - much error-checking. Doing this cleanly would require - adding a new function to each thread_*.h. Instead, just - create a new lock and waste a little bit of memory */ - interpreter_lock = PyThread_allocate_lock(); - pending_lock = PyThread_allocate_lock(); - PyThread_acquire_lock(interpreter_lock, 1); - main_thread = PyThread_get_thread_ident(); - - /* Update the threading module with the new state. - */ - tstate = PyThreadState_GET(); - threading = PyMapping_GetItemString(tstate->interp->modules, - "threading"); - if (threading == NULL) { - /* threading not imported */ - PyErr_Clear(); - return; - } - result = PyObject_CallMethod(threading, "_after_fork", NULL); - if (result == NULL) - PyErr_WriteUnraisable(threading); - else - Py_DECREF(result); - Py_DECREF(threading); -} -#endif - -/* Functions save_thread and restore_thread are always defined so - dynamically loaded modules needn't be compiled separately for use - with and without threads: */ - -PyThreadState * -PyEval_SaveThread(void) -{ - PyThreadState *tstate = PyThreadState_Swap(NULL); - if (tstate == NULL) - Py_FatalError("PyEval_SaveThread: NULL tstate"); -#ifdef WITH_THREAD - if (interpreter_lock) - PyThread_release_lock(interpreter_lock); -#endif - return tstate; -} - -void -PyEval_RestoreThread(PyThreadState *tstate) -{ - if (tstate == NULL) - Py_FatalError("PyEval_RestoreThread: NULL tstate"); -#ifdef WITH_THREAD - if (interpreter_lock) { - int err = errno; - PyThread_acquire_lock(interpreter_lock, 1); - errno = err; - } -#endif - PyThreadState_Swap(tstate); -} - - -/* Mechanism whereby asynchronously executing callbacks (e.g. UNIX - signal handlers or Mac I/O completion routines) can schedule calls - to a function to be called synchronously. - The synchronous function is called with one void* argument. - It should return 0 for success or -1 for failure -- failure should - be accompanied by an exception. - - If registry succeeds, the registry function returns 0; if it fails - (e.g. due to too many pending calls) it returns -1 (without setting - an exception condition). - - Note that because registry may occur from within signal handlers, - or other asynchronous events, calling malloc() is unsafe! - -#ifdef WITH_THREAD - Any thread can schedule pending calls, but only the main thread - will execute them. - There is no facility to schedule calls to a particular thread, but - that should be easy to change, should that ever be required. In - that case, the static variables here should go into the python - threadstate. -#endif -*/ - -#ifdef WITH_THREAD - -/* The WITH_THREAD implementation is thread-safe. It allows - scheduling to be made from any thread, and even from an executing - callback. - */ - -#define NPENDINGCALLS 32 -static struct { - int (*func)(void *); - void *arg; -} pendingcalls[NPENDINGCALLS]; -static int pendingfirst = 0; -static int pendinglast = 0; -static volatile int pendingcalls_to_do = 1; /* trigger initialization of lock */ -static char pendingbusy = 0; - -int -Py_AddPendingCall(int (*func)(void *), void *arg) -{ - int i, j, result=0; - PyThread_type_lock lock = pending_lock; - - /* try a few times for the lock. Since this mechanism is used - * for signal handling (on the main thread), there is a (slim) - * chance that a signal is delivered on the same thread while we - * hold the lock during the Py_MakePendingCalls() function. - * This avoids a deadlock in that case. - * Note that signals can be delivered on any thread. In particular, - * on Windows, a SIGINT is delivered on a system-created worker - * thread. - * We also check for lock being NULL, in the unlikely case that - * this function is called before any bytecode evaluation takes place. - */ - if (lock != NULL) { - for (i = 0; i<100; i++) { - if (PyThread_acquire_lock(lock, NOWAIT_LOCK)) - break; - } - if (i == 100) - return -1; - } - - i = pendinglast; - j = (i + 1) % NPENDINGCALLS; - if (j == pendingfirst) { - result = -1; /* Queue full */ - } else { - pendingcalls[i].func = func; - pendingcalls[i].arg = arg; - pendinglast = j; - } - /* signal main loop */ - _Py_Ticker = 0; - pendingcalls_to_do = 1; - if (lock != NULL) - PyThread_release_lock(lock); - return result; -} - -int -Py_MakePendingCalls(void) -{ - int i; - int r = 0; - - if (!pending_lock) { - /* initial allocation of the lock */ - pending_lock = PyThread_allocate_lock(); - if (pending_lock == NULL) - return -1; - } - - /* only service pending calls on main thread */ - if (main_thread && PyThread_get_thread_ident() != main_thread) - return 0; - /* don't perform recursive pending calls */ - if (pendingbusy) - return 0; - pendingbusy = 1; - /* perform a bounded number of calls, in case of recursion */ - for (i=0; irecursion_depth; - PyErr_SetString(PyExc_MemoryError, "Stack overflow"); - return -1; - } -#endif - if (tstate->recursion_depth > recursion_limit) { - --tstate->recursion_depth; - PyErr_Format(PyExc_RuntimeError, - "maximum recursion depth exceeded%s", - where); - return -1; - } - _Py_CheckRecursionLimit = recursion_limit; - return 0; -} - -/* Status code for main loop (reason for stack unwind) */ -enum why_code { - WHY_NOT = 0x0001, /* No error */ - WHY_EXCEPTION = 0x0002, /* Exception occurred */ - WHY_RERAISE = 0x0004, /* Exception re-raised by 'finally' */ - WHY_RETURN = 0x0008, /* 'return' statement */ - WHY_BREAK = 0x0010, /* 'break' statement */ - WHY_CONTINUE = 0x0020, /* 'continue' statement */ - WHY_YIELD = 0x0040 /* 'yield' operator */ -}; - -static enum why_code do_raise(PyObject *, PyObject *, PyObject *); -static int unpack_iterable(PyObject *, int, PyObject **); - -/* Records whether tracing is on for any thread. Counts the number of - threads for which tstate->c_tracefunc is non-NULL, so if the value - is 0, we know we don't have to check this thread's c_tracefunc. - This speeds up the if statement in PyEval_EvalFrameEx() after - fast_next_opcode*/ -static int _Py_TracingPossible = 0; - -/* for manipulating the thread switch and periodic "stuff" - used to be - per thread, now just a pair o' globals */ -int _Py_CheckInterval = 100; -volatile int _Py_Ticker = 0; /* so that we hit a "tick" first thing */ - -PyObject * -PyEval_EvalCode(PyCodeObject *co, PyObject *globals, PyObject *locals) -{ - return PyEval_EvalCodeEx(co, - globals, locals, - (PyObject **)NULL, 0, - (PyObject **)NULL, 0, - (PyObject **)NULL, 0, - NULL); -} - - -/* Interpreter main loop */ - -PyObject * -PyEval_EvalFrame(PyFrameObject *f) { - /* This is for backward compatibility with extension modules that - used this API; core interpreter code should call - PyEval_EvalFrameEx() */ - return PyEval_EvalFrameEx(f, 0); -} - -PyObject * -PyEval_EvalFrameEx(PyFrameObject *f, int throwflag) -{ -#ifdef DXPAIRS - int lastopcode = 0; -#endif - register PyObject **stack_pointer; /* Next free slot in value stack */ - register unsigned char *next_instr; - register int opcode; /* Current opcode */ - register int oparg; /* Current opcode argument, if any */ - register enum why_code why; /* Reason for block stack unwind */ - register int err; /* Error status -- nonzero if error */ - register PyObject *x; /* Result object -- NULL if error */ - register PyObject *v; /* Temporary objects popped off stack */ - register PyObject *w; - register PyObject *u; - register PyObject *t; - register PyObject *stream = NULL; /* for PRINT opcodes */ - register PyObject **fastlocals, **freevars; - PyObject *retval = NULL; /* Return value */ - PyThreadState *tstate = PyThreadState_GET(); - PyCodeObject *co; - - /* when tracing we set things up so that - - not (instr_lb <= current_bytecode_offset < instr_ub) - - is true when the line being executed has changed. The - initial values are such as to make this false the first - time it is tested. */ - int instr_ub = -1, instr_lb = 0, instr_prev = -1; - - unsigned char *first_instr; - PyObject *names; - PyObject *consts; -#if defined(Py_DEBUG) || defined(LLTRACE) - /* Make it easier to find out where we are with a debugger */ - char *filename; -#endif - -/* Tuple access macros */ - -#ifndef Py_DEBUG -#define GETITEM(v, i) PyTuple_GET_ITEM((PyTupleObject *)(v), (i)) -#else -#define GETITEM(v, i) PyTuple_GetItem((v), (i)) -#endif - -#ifdef WITH_TSC -/* Use Pentium timestamp counter to mark certain events: - inst0 -- beginning of switch statement for opcode dispatch - inst1 -- end of switch statement (may be skipped) - loop0 -- the top of the mainloop - loop1 -- place where control returns again to top of mainloop - (may be skipped) - intr1 -- beginning of long interruption - intr2 -- end of long interruption - - Many opcodes call out to helper C functions. In some cases, the - time in those functions should be counted towards the time for the - opcode, but not in all cases. For example, a CALL_FUNCTION opcode - calls another Python function; there's no point in charge all the - bytecode executed by the called function to the caller. - - It's hard to make a useful judgement statically. In the presence - of operator overloading, it's impossible to tell if a call will - execute new Python code or not. - - It's a case-by-case judgement. I'll use intr1 for the following - cases: - - EXEC_STMT - IMPORT_STAR - IMPORT_FROM - CALL_FUNCTION (and friends) - - */ - uint64 inst0, inst1, loop0, loop1, intr0 = 0, intr1 = 0; - int ticked = 0; - - READ_TIMESTAMP(inst0); - READ_TIMESTAMP(inst1); - READ_TIMESTAMP(loop0); - READ_TIMESTAMP(loop1); - - /* shut up the compiler */ - opcode = 0; -#endif - -/* Code access macros */ - -#define INSTR_OFFSET() ((int)(next_instr - first_instr)) -#define NEXTOP() (*next_instr++) -#define NEXTARG() (next_instr += 2, (next_instr[-1]<<8) + next_instr[-2]) -#define PEEKARG() ((next_instr[2]<<8) + next_instr[1]) -#define JUMPTO(x) (next_instr = first_instr + (x)) -#define JUMPBY(x) (next_instr += (x)) - -/* OpCode prediction macros - Some opcodes tend to come in pairs thus making it possible to - predict the second code when the first is run. For example, - GET_ITER is often followed by FOR_ITER. And FOR_ITER is often - followed by STORE_FAST or UNPACK_SEQUENCE. - - Verifying the prediction costs a single high-speed test of a register - variable against a constant. If the pairing was good, then the - processor's own internal branch predication has a high likelihood of - success, resulting in a nearly zero-overhead transition to the - next opcode. A successful prediction saves a trip through the eval-loop - including its two unpredictable branches, the HAS_ARG test and the - switch-case. Combined with the processor's internal branch prediction, - a successful PREDICT has the effect of making the two opcodes run as if - they were a single new opcode with the bodies combined. - - If collecting opcode statistics, your choices are to either keep the - predictions turned-on and interpret the results as if some opcodes - had been combined or turn-off predictions so that the opcode frequency - counter updates for both opcodes. -*/ - -#ifdef DYNAMIC_EXECUTION_PROFILE -#define PREDICT(op) if (0) goto PRED_##op -#else -#define PREDICT(op) if (*next_instr == op) goto PRED_##op -#endif - -#define PREDICTED(op) PRED_##op: next_instr++ -#define PREDICTED_WITH_ARG(op) PRED_##op: oparg = PEEKARG(); next_instr += 3 - -/* Stack manipulation macros */ - -/* The stack can grow at most MAXINT deep, as co_nlocals and - co_stacksize are ints. */ -#define STACK_LEVEL() ((int)(stack_pointer - f->f_valuestack)) -#define EMPTY() (STACK_LEVEL() == 0) -#define TOP() (stack_pointer[-1]) -#define SECOND() (stack_pointer[-2]) -#define THIRD() (stack_pointer[-3]) -#define FOURTH() (stack_pointer[-4]) -#define PEEK(n) (stack_pointer[-(n)]) -#define SET_TOP(v) (stack_pointer[-1] = (v)) -#define SET_SECOND(v) (stack_pointer[-2] = (v)) -#define SET_THIRD(v) (stack_pointer[-3] = (v)) -#define SET_FOURTH(v) (stack_pointer[-4] = (v)) -#define SET_VALUE(n, v) (stack_pointer[-(n)] = (v)) -#define BASIC_STACKADJ(n) (stack_pointer += n) -#define BASIC_PUSH(v) (*stack_pointer++ = (v)) -#define BASIC_POP() (*--stack_pointer) - -#ifdef LLTRACE -#define PUSH(v) { (void)(BASIC_PUSH(v), \ - lltrace && prtrace(TOP(), "push")); \ - assert(STACK_LEVEL() <= co->co_stacksize); } -#define POP() ((void)(lltrace && prtrace(TOP(), "pop")), \ - BASIC_POP()) -#define STACKADJ(n) { (void)(BASIC_STACKADJ(n), \ - lltrace && prtrace(TOP(), "stackadj")); \ - assert(STACK_LEVEL() <= co->co_stacksize); } -#define EXT_POP(STACK_POINTER) ((void)(lltrace && \ - prtrace((STACK_POINTER)[-1], "ext_pop")), \ - *--(STACK_POINTER)) -#else -#define PUSH(v) BASIC_PUSH(v) -#define POP() BASIC_POP() -#define STACKADJ(n) BASIC_STACKADJ(n) -#define EXT_POP(STACK_POINTER) (*--(STACK_POINTER)) -#endif - -/* Local variable macros */ - -#define GETLOCAL(i) (fastlocals[i]) - -/* The SETLOCAL() macro must not DECREF the local variable in-place and - then store the new value; it must copy the old value to a temporary - value, then store the new value, and then DECREF the temporary value. - This is because it is possible that during the DECREF the frame is - accessed by other code (e.g. a __del__ method or gc.collect()) and the - variable would be pointing to already-freed memory. */ -#define SETLOCAL(i, value) do { PyObject *tmp = GETLOCAL(i); \ - GETLOCAL(i) = value; \ - Py_XDECREF(tmp); } while (0) - -/* Start of code */ - - if (f == NULL) - return NULL; - - /* push frame */ - if (Py_EnterRecursiveCall("")) - return NULL; - - tstate->frame = f; - - if (tstate->use_tracing) { - if (tstate->c_tracefunc != NULL) { - /* tstate->c_tracefunc, if defined, is a - function that will be called on *every* entry - to a code block. Its return value, if not - None, is a function that will be called at - the start of each executed line of code. - (Actually, the function must return itself - in order to continue tracing.) The trace - functions are called with three arguments: - a pointer to the current frame, a string - indicating why the function is called, and - an argument which depends on the situation. - The global trace function is also called - whenever an exception is detected. */ - if (call_trace_protected(tstate->c_tracefunc, - tstate->c_traceobj, - f, PyTrace_CALL, Py_None)) { - /* Trace function raised an error */ - goto exit_eval_frame; - } - } - if (tstate->c_profilefunc != NULL) { - /* Similar for c_profilefunc, except it needn't - return itself and isn't called for "line" events */ - if (call_trace_protected(tstate->c_profilefunc, - tstate->c_profileobj, - f, PyTrace_CALL, Py_None)) { - /* Profile function raised an error */ - goto exit_eval_frame; - } - } - } - - co = f->f_code; - names = co->co_names; - consts = co->co_consts; - fastlocals = f->f_localsplus; - freevars = f->f_localsplus + co->co_nlocals; - first_instr = (unsigned char*) PyString_AS_STRING(co->co_code); - /* An explanation is in order for the next line. - - f->f_lasti now refers to the index of the last instruction - executed. You might think this was obvious from the name, but - this wasn't always true before 2.3! PyFrame_New now sets - f->f_lasti to -1 (i.e. the index *before* the first instruction) - and YIELD_VALUE doesn't fiddle with f_lasti any more. So this - does work. Promise. - - When the PREDICT() macros are enabled, some opcode pairs follow in - direct succession without updating f->f_lasti. A successful - prediction effectively links the two codes together as if they - were a single new opcode; accordingly,f->f_lasti will point to - the first code in the pair (for instance, GET_ITER followed by - FOR_ITER is effectively a single opcode and f->f_lasti will point - at to the beginning of the combined pair.) - */ - next_instr = first_instr + f->f_lasti + 1; - stack_pointer = f->f_stacktop; - assert(stack_pointer != NULL); - f->f_stacktop = NULL; /* remains NULL unless yield suspends frame */ - -#ifdef LLTRACE - lltrace = PyDict_GetItemString(f->f_globals, "__lltrace__") != NULL; -#endif -#if defined(Py_DEBUG) || defined(LLTRACE) - filename = PyString_AsString(co->co_filename); -#endif - - why = WHY_NOT; - err = 0; - x = Py_None; /* Not a reference, just anything non-NULL */ - w = NULL; - - if (throwflag) { /* support for generator.throw() */ - why = WHY_EXCEPTION; - goto on_error; - } - - for (;;) { -#ifdef WITH_TSC - if (inst1 == 0) { - /* Almost surely, the opcode executed a break - or a continue, preventing inst1 from being set - on the way out of the loop. - */ - READ_TIMESTAMP(inst1); - loop1 = inst1; - } - dump_tsc(opcode, ticked, inst0, inst1, loop0, loop1, - intr0, intr1); - ticked = 0; - inst1 = 0; - intr0 = 0; - intr1 = 0; - READ_TIMESTAMP(loop0); -#endif - assert(stack_pointer >= f->f_valuestack); /* else underflow */ - assert(STACK_LEVEL() <= co->co_stacksize); /* else overflow */ - - /* Do periodic things. Doing this every time through - the loop would add too much overhead, so we do it - only every Nth instruction. We also do it if - ``pendingcalls_to_do'' is set, i.e. when an asynchronous - event needs attention (e.g. a signal handler or - async I/O handler); see Py_AddPendingCall() and - Py_MakePendingCalls() above. */ - - if (--_Py_Ticker < 0) { - if (*next_instr == SETUP_FINALLY) { - /* Make the last opcode before - a try: finally: block uninterruptible. */ - goto fast_next_opcode; - } - _Py_Ticker = _Py_CheckInterval; - tstate->tick_counter++; -#ifdef WITH_TSC - ticked = 1; -#endif - if (pendingcalls_to_do) { - if (Py_MakePendingCalls() < 0) { - why = WHY_EXCEPTION; - goto on_error; - } - if (pendingcalls_to_do) - /* MakePendingCalls() didn't succeed. - Force early re-execution of this - "periodic" code, possibly after - a thread switch */ - _Py_Ticker = 0; - } -#ifdef WITH_THREAD - if (interpreter_lock) { - /* Give another thread a chance */ - - if (PyThreadState_Swap(NULL) != tstate) - Py_FatalError("ceval: tstate mix-up"); - PyThread_release_lock(interpreter_lock); - - /* Other threads may run now */ - - PyThread_acquire_lock(interpreter_lock, 1); - - if (PyThreadState_Swap(tstate) != NULL) - Py_FatalError("ceval: orphan tstate"); - - /* Check for thread interrupts */ - - if (tstate->async_exc != NULL) { - x = tstate->async_exc; - tstate->async_exc = NULL; - PyErr_SetNone(x); - Py_DECREF(x); - why = WHY_EXCEPTION; - goto on_error; - } - } -#endif - } - - fast_next_opcode: - f->f_lasti = INSTR_OFFSET(); - - /* line-by-line tracing support */ - - if (_Py_TracingPossible && - tstate->c_tracefunc != NULL && !tstate->tracing) { - /* see maybe_call_line_trace - for expository comments */ - f->f_stacktop = stack_pointer; - - err = maybe_call_line_trace(tstate->c_tracefunc, - tstate->c_traceobj, - f, &instr_lb, &instr_ub, - &instr_prev); - /* Reload possibly changed frame fields */ - JUMPTO(f->f_lasti); - if (f->f_stacktop != NULL) { - stack_pointer = f->f_stacktop; - f->f_stacktop = NULL; - } - if (err) { - /* trace function raised an exception */ - goto on_error; - } - } - - /* Extract opcode and argument */ - - opcode = NEXTOP(); - oparg = 0; /* allows oparg to be stored in a register because - it doesn't have to be remembered across a full loop */ - if (HAS_ARG(opcode)) - oparg = NEXTARG(); - dispatch_opcode: -#ifdef DYNAMIC_EXECUTION_PROFILE -#ifdef DXPAIRS - dxpairs[lastopcode][opcode]++; - lastopcode = opcode; -#endif - dxp[opcode]++; -#endif - -#ifdef LLTRACE - /* Instruction tracing */ - - if (lltrace) { - if (HAS_ARG(opcode)) { - printf("%d: %d, %d\n", - f->f_lasti, opcode, oparg); - } - else { - printf("%d: %d\n", - f->f_lasti, opcode); - } - } -#endif - - /* Main switch on opcode */ - READ_TIMESTAMP(inst0); - - switch (opcode) { - - /* BEWARE! - It is essential that any operation that fails sets either - x to NULL, err to nonzero, or why to anything but WHY_NOT, - and that no operation that succeeds does this! */ - - /* case STOP_CODE: this is an error! */ - - case NOP: - goto fast_next_opcode; - - case LOAD_FAST: - x = GETLOCAL(oparg); - if (x != NULL) { - Py_INCREF(x); - PUSH(x); - goto fast_next_opcode; - } - format_exc_check_arg(PyExc_UnboundLocalError, - UNBOUNDLOCAL_ERROR_MSG, - PyTuple_GetItem(co->co_varnames, oparg)); - break; - - case LOAD_CONST: - x = GETITEM(consts, oparg); - Py_INCREF(x); - PUSH(x); - goto fast_next_opcode; - - PREDICTED_WITH_ARG(STORE_FAST); - case STORE_FAST: - v = POP(); - SETLOCAL(oparg, v); - goto fast_next_opcode; - - case POP_TOP: - v = POP(); - Py_DECREF(v); - goto fast_next_opcode; - - case ROT_TWO: - v = TOP(); - w = SECOND(); - SET_TOP(w); - SET_SECOND(v); - goto fast_next_opcode; - - case ROT_THREE: - v = TOP(); - w = SECOND(); - x = THIRD(); - SET_TOP(w); - SET_SECOND(x); - SET_THIRD(v); - goto fast_next_opcode; - - case ROT_FOUR: - u = TOP(); - v = SECOND(); - w = THIRD(); - x = FOURTH(); - SET_TOP(v); - SET_SECOND(w); - SET_THIRD(x); - SET_FOURTH(u); - goto fast_next_opcode; - - case DUP_TOP: - v = TOP(); - Py_INCREF(v); - PUSH(v); - goto fast_next_opcode; - - case DUP_TOPX: - if (oparg == 2) { - x = TOP(); - Py_INCREF(x); - w = SECOND(); - Py_INCREF(w); - STACKADJ(2); - SET_TOP(x); - SET_SECOND(w); - goto fast_next_opcode; - } else if (oparg == 3) { - x = TOP(); - Py_INCREF(x); - w = SECOND(); - Py_INCREF(w); - v = THIRD(); - Py_INCREF(v); - STACKADJ(3); - SET_TOP(x); - SET_SECOND(w); - SET_THIRD(v); - goto fast_next_opcode; - } - Py_FatalError("invalid argument to DUP_TOPX" - " (bytecode corruption?)"); - /* Never returns, so don't bother to set why. */ - break; - - case UNARY_POSITIVE: - v = TOP(); - x = PyNumber_Positive(v); - Py_DECREF(v); - SET_TOP(x); - if (x != NULL) continue; - break; - - case UNARY_NEGATIVE: - v = TOP(); - x = PyNumber_Negative(v); - Py_DECREF(v); - SET_TOP(x); - if (x != NULL) continue; - break; - - case UNARY_NOT: - v = TOP(); - err = PyObject_IsTrue(v); - Py_DECREF(v); - if (err == 0) { - Py_INCREF(Py_True); - SET_TOP(Py_True); - continue; - } - else if (err > 0) { - Py_INCREF(Py_False); - SET_TOP(Py_False); - err = 0; - continue; - } - STACKADJ(-1); - break; - - case UNARY_CONVERT: - v = TOP(); - x = PyObject_Repr(v); - Py_DECREF(v); - SET_TOP(x); - if (x != NULL) continue; - break; - - case UNARY_INVERT: - v = TOP(); - x = PyNumber_Invert(v); - Py_DECREF(v); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_POWER: - w = POP(); - v = TOP(); - x = PyNumber_Power(v, w, Py_None); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_MULTIPLY: - w = POP(); - v = TOP(); - x = PyNumber_Multiply(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_DIVIDE: - if (!_Py_QnewFlag) { - w = POP(); - v = TOP(); - x = PyNumber_Divide(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - } - /* -Qnew is in effect: fall through to - BINARY_TRUE_DIVIDE */ - case BINARY_TRUE_DIVIDE: - w = POP(); - v = TOP(); - x = PyNumber_TrueDivide(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_FLOOR_DIVIDE: - w = POP(); - v = TOP(); - x = PyNumber_FloorDivide(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_MODULO: - w = POP(); - v = TOP(); - if (PyString_CheckExact(v)) - x = PyString_Format(v, w); - else - x = PyNumber_Remainder(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_ADD: - w = POP(); - v = TOP(); - if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { - /* INLINE: int + int */ - register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); - /* cast to avoid undefined behaviour - on overflow */ - i = (long)((unsigned long)a + b); - if ((i^a) < 0 && (i^b) < 0) - goto slow_add; - x = PyInt_FromLong(i); - } - else if (PyString_CheckExact(v) && - PyString_CheckExact(w)) { - x = string_concatenate(v, w, f, next_instr); - /* string_concatenate consumed the ref to v */ - goto skip_decref_vx; - } - else { - slow_add: - x = PyNumber_Add(v, w); - } - Py_DECREF(v); - skip_decref_vx: - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_SUBTRACT: - w = POP(); - v = TOP(); - if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { - /* INLINE: int - int */ - register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); - /* cast to avoid undefined behaviour - on overflow */ - i = (long)((unsigned long)a - b); - if ((i^a) < 0 && (i^~b) < 0) - goto slow_sub; - x = PyInt_FromLong(i); - } - else { - slow_sub: - x = PyNumber_Subtract(v, w); - } - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_SUBSCR: - w = POP(); - v = TOP(); - if (PyList_CheckExact(v) && PyInt_CheckExact(w)) { - /* INLINE: list[int] */ - Py_ssize_t i = PyInt_AsSsize_t(w); - if (i < 0) - i += PyList_GET_SIZE(v); - if (i >= 0 && i < PyList_GET_SIZE(v)) { - x = PyList_GET_ITEM(v, i); - Py_INCREF(x); - } - else - goto slow_get; - } - else - slow_get: - x = PyObject_GetItem(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_LSHIFT: - w = POP(); - v = TOP(); - x = PyNumber_Lshift(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_RSHIFT: - w = POP(); - v = TOP(); - x = PyNumber_Rshift(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_AND: - w = POP(); - v = TOP(); - x = PyNumber_And(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_XOR: - w = POP(); - v = TOP(); - x = PyNumber_Xor(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case BINARY_OR: - w = POP(); - v = TOP(); - x = PyNumber_Or(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case LIST_APPEND: - w = POP(); - v = PEEK(oparg); - err = PyList_Append(v, w); - Py_DECREF(w); - if (err == 0) { - PREDICT(JUMP_ABSOLUTE); - continue; - } - break; - - case SET_ADD: - w = POP(); - v = stack_pointer[-oparg]; - err = PySet_Add(v, w); - Py_DECREF(w); - if (err == 0) { - PREDICT(JUMP_ABSOLUTE); - continue; - } - break; - - case INPLACE_POWER: - w = POP(); - v = TOP(); - x = PyNumber_InPlacePower(v, w, Py_None); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_MULTIPLY: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceMultiply(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_DIVIDE: - if (!_Py_QnewFlag) { - w = POP(); - v = TOP(); - x = PyNumber_InPlaceDivide(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - } - /* -Qnew is in effect: fall through to - INPLACE_TRUE_DIVIDE */ - case INPLACE_TRUE_DIVIDE: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceTrueDivide(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_FLOOR_DIVIDE: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceFloorDivide(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_MODULO: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceRemainder(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_ADD: - w = POP(); - v = TOP(); - if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { - /* INLINE: int + int */ - register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); - i = a + b; - if ((i^a) < 0 && (i^b) < 0) - goto slow_iadd; - x = PyInt_FromLong(i); - } - else if (PyString_CheckExact(v) && - PyString_CheckExact(w)) { - x = string_concatenate(v, w, f, next_instr); - /* string_concatenate consumed the ref to v */ - goto skip_decref_v; - } - else { - slow_iadd: - x = PyNumber_InPlaceAdd(v, w); - } - Py_DECREF(v); - skip_decref_v: - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_SUBTRACT: - w = POP(); - v = TOP(); - if (PyInt_CheckExact(v) && PyInt_CheckExact(w)) { - /* INLINE: int - int */ - register long a, b, i; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); - i = a - b; - if ((i^a) < 0 && (i^~b) < 0) - goto slow_isub; - x = PyInt_FromLong(i); - } - else { - slow_isub: - x = PyNumber_InPlaceSubtract(v, w); - } - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_LSHIFT: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceLshift(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_RSHIFT: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceRshift(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_AND: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceAnd(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_XOR: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceXor(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case INPLACE_OR: - w = POP(); - v = TOP(); - x = PyNumber_InPlaceOr(v, w); - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case SLICE+0: - case SLICE+1: - case SLICE+2: - case SLICE+3: - if ((opcode-SLICE) & 2) - w = POP(); - else - w = NULL; - if ((opcode-SLICE) & 1) - v = POP(); - else - v = NULL; - u = TOP(); - x = apply_slice(u, v, w); - Py_DECREF(u); - Py_XDECREF(v); - Py_XDECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case STORE_SLICE+0: - case STORE_SLICE+1: - case STORE_SLICE+2: - case STORE_SLICE+3: - if ((opcode-STORE_SLICE) & 2) - w = POP(); - else - w = NULL; - if ((opcode-STORE_SLICE) & 1) - v = POP(); - else - v = NULL; - u = POP(); - t = POP(); - err = assign_slice(u, v, w, t); /* u[v:w] = t */ - Py_DECREF(t); - Py_DECREF(u); - Py_XDECREF(v); - Py_XDECREF(w); - if (err == 0) continue; - break; - - case DELETE_SLICE+0: - case DELETE_SLICE+1: - case DELETE_SLICE+2: - case DELETE_SLICE+3: - if ((opcode-DELETE_SLICE) & 2) - w = POP(); - else - w = NULL; - if ((opcode-DELETE_SLICE) & 1) - v = POP(); - else - v = NULL; - u = POP(); - err = assign_slice(u, v, w, (PyObject *)NULL); - /* del u[v:w] */ - Py_DECREF(u); - Py_XDECREF(v); - Py_XDECREF(w); - if (err == 0) continue; - break; - - case STORE_SUBSCR: - w = TOP(); - v = SECOND(); - u = THIRD(); - STACKADJ(-3); - /* v[w] = u */ - err = PyObject_SetItem(v, w, u); - Py_DECREF(u); - Py_DECREF(v); - Py_DECREF(w); - if (err == 0) continue; - break; - - case DELETE_SUBSCR: - w = TOP(); - v = SECOND(); - STACKADJ(-2); - /* del v[w] */ - err = PyObject_DelItem(v, w); - Py_DECREF(v); - Py_DECREF(w); - if (err == 0) continue; - break; - - case PRINT_EXPR: - v = POP(); - w = PySys_GetObject("displayhook"); - if (w == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "lost sys.displayhook"); - err = -1; - x = NULL; - } - if (err == 0) { - x = PyTuple_Pack(1, v); - if (x == NULL) - err = -1; - } - if (err == 0) { - w = PyEval_CallObject(w, x); - Py_XDECREF(w); - if (w == NULL) - err = -1; - } - Py_DECREF(v); - Py_XDECREF(x); - break; - - case PRINT_ITEM_TO: - w = stream = POP(); - /* fall through to PRINT_ITEM */ - - case PRINT_ITEM: - v = POP(); - if (stream == NULL || stream == Py_None) { - w = PySys_GetObject("stdout"); - if (w == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "lost sys.stdout"); - err = -1; - } - } - /* PyFile_SoftSpace() can exececute arbitrary code - if sys.stdout is an instance with a __getattr__. - If __getattr__ raises an exception, w will - be freed, so we need to prevent that temporarily. */ - Py_XINCREF(w); - if (w != NULL && PyFile_SoftSpace(w, 0)) - err = PyFile_WriteString(" ", w); - if (err == 0) - err = PyFile_WriteObject(v, w, Py_PRINT_RAW); - if (err == 0) { - /* XXX move into writeobject() ? */ - if (PyString_Check(v)) { - char *s = PyString_AS_STRING(v); - Py_ssize_t len = PyString_GET_SIZE(v); - if (len == 0 || - !isspace(Py_CHARMASK(s[len-1])) || - s[len-1] == ' ') - PyFile_SoftSpace(w, 1); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(v)) { - Py_UNICODE *s = PyUnicode_AS_UNICODE(v); - Py_ssize_t len = PyUnicode_GET_SIZE(v); - if (len == 0 || - !Py_UNICODE_ISSPACE(s[len-1]) || - s[len-1] == ' ') - PyFile_SoftSpace(w, 1); - } -#endif - else - PyFile_SoftSpace(w, 1); - } - Py_XDECREF(w); - Py_DECREF(v); - Py_XDECREF(stream); - stream = NULL; - if (err == 0) - continue; - break; - - case PRINT_NEWLINE_TO: - w = stream = POP(); - /* fall through to PRINT_NEWLINE */ - - case PRINT_NEWLINE: - if (stream == NULL || stream == Py_None) { - w = PySys_GetObject("stdout"); - if (w == NULL) { - PyErr_SetString(PyExc_RuntimeError, - "lost sys.stdout"); - why = WHY_EXCEPTION; - } - } - if (w != NULL) { - /* w.write() may replace sys.stdout, so we - * have to keep our reference to it */ - Py_INCREF(w); - err = PyFile_WriteString("\n", w); - if (err == 0) - PyFile_SoftSpace(w, 0); - Py_DECREF(w); - } - Py_XDECREF(stream); - stream = NULL; - break; - - -#ifdef CASE_TOO_BIG - default: switch (opcode) { -#endif - case RAISE_VARARGS: - u = v = w = NULL; - switch (oparg) { - case 3: - u = POP(); /* traceback */ - /* Fallthrough */ - case 2: - v = POP(); /* value */ - /* Fallthrough */ - case 1: - w = POP(); /* exc */ - case 0: /* Fallthrough */ - why = do_raise(w, v, u); - break; - default: - PyErr_SetString(PyExc_SystemError, - "bad RAISE_VARARGS oparg"); - why = WHY_EXCEPTION; - break; - } - break; - - case LOAD_LOCALS: - if ((x = f->f_locals) != NULL) { - Py_INCREF(x); - PUSH(x); - continue; - } - PyErr_SetString(PyExc_SystemError, "no locals"); - break; - - case RETURN_VALUE: - retval = POP(); - why = WHY_RETURN; - goto fast_block_end; - - case YIELD_VALUE: - retval = POP(); - f->f_stacktop = stack_pointer; - why = WHY_YIELD; - goto fast_yield; - - case EXEC_STMT: - w = TOP(); - v = SECOND(); - u = THIRD(); - STACKADJ(-3); - READ_TIMESTAMP(intr0); - err = exec_statement(f, u, v, w); - READ_TIMESTAMP(intr1); - Py_DECREF(u); - Py_DECREF(v); - Py_DECREF(w); - break; - - case POP_BLOCK: - { - PyTryBlock *b = PyFrame_BlockPop(f); - while (STACK_LEVEL() > b->b_level) { - v = POP(); - Py_DECREF(v); - } - } - continue; - - PREDICTED(END_FINALLY); - case END_FINALLY: - v = POP(); - if (PyInt_Check(v)) { - why = (enum why_code) PyInt_AS_LONG(v); - assert(why != WHY_YIELD); - if (why == WHY_RETURN || - why == WHY_CONTINUE) - retval = POP(); - } - else if (PyExceptionClass_Check(v) || - PyString_Check(v)) { - w = POP(); - u = POP(); - PyErr_Restore(v, w, u); - why = WHY_RERAISE; - break; - } - else if (v != Py_None) { - PyErr_SetString(PyExc_SystemError, - "'finally' pops bad exception"); - why = WHY_EXCEPTION; - } - Py_DECREF(v); - break; - - case BUILD_CLASS: - u = TOP(); - v = SECOND(); - w = THIRD(); - STACKADJ(-2); - x = build_class(u, v, w); - SET_TOP(x); - Py_DECREF(u); - Py_DECREF(v); - Py_DECREF(w); - break; - - case STORE_NAME: - w = GETITEM(names, oparg); - v = POP(); - if ((x = f->f_locals) != NULL) { - if (PyDict_CheckExact(x)) - err = PyDict_SetItem(x, w, v); - else - err = PyObject_SetItem(x, w, v); - Py_DECREF(v); - if (err == 0) continue; - break; - } - t = PyObject_Repr(w); - if (t == NULL) - break; - PyErr_Format(PyExc_SystemError, - "no locals found when storing %s", - PyString_AS_STRING(t)); - Py_DECREF(t); - break; - - case DELETE_NAME: - w = GETITEM(names, oparg); - if ((x = f->f_locals) != NULL) { - if ((err = PyObject_DelItem(x, w)) != 0) - format_exc_check_arg(PyExc_NameError, - NAME_ERROR_MSG, - w); - break; - } - t = PyObject_Repr(w); - if (t == NULL) - break; - PyErr_Format(PyExc_SystemError, - "no locals when deleting %s", - PyString_AS_STRING(w)); - Py_DECREF(t); - break; - - PREDICTED_WITH_ARG(UNPACK_SEQUENCE); - case UNPACK_SEQUENCE: - v = POP(); - if (PyTuple_CheckExact(v) && - PyTuple_GET_SIZE(v) == oparg) { - PyObject **items = \ - ((PyTupleObject *)v)->ob_item; - while (oparg--) { - w = items[oparg]; - Py_INCREF(w); - PUSH(w); - } - Py_DECREF(v); - continue; - } else if (PyList_CheckExact(v) && - PyList_GET_SIZE(v) == oparg) { - PyObject **items = \ - ((PyListObject *)v)->ob_item; - while (oparg--) { - w = items[oparg]; - Py_INCREF(w); - PUSH(w); - } - } else if (unpack_iterable(v, oparg, - stack_pointer + oparg)) { - STACKADJ(oparg); - } else { - /* unpack_iterable() raised an exception */ - why = WHY_EXCEPTION; - } - Py_DECREF(v); - break; - - case STORE_ATTR: - w = GETITEM(names, oparg); - v = TOP(); - u = SECOND(); - STACKADJ(-2); - err = PyObject_SetAttr(v, w, u); /* v.w = u */ - Py_DECREF(v); - Py_DECREF(u); - if (err == 0) continue; - break; - - case DELETE_ATTR: - w = GETITEM(names, oparg); - v = POP(); - err = PyObject_SetAttr(v, w, (PyObject *)NULL); - /* del v.w */ - Py_DECREF(v); - break; - - case STORE_GLOBAL: - w = GETITEM(names, oparg); - v = POP(); - err = PyDict_SetItem(f->f_globals, w, v); - Py_DECREF(v); - if (err == 0) continue; - break; - - case DELETE_GLOBAL: - w = GETITEM(names, oparg); - if ((err = PyDict_DelItem(f->f_globals, w)) != 0) - format_exc_check_arg( - PyExc_NameError, GLOBAL_NAME_ERROR_MSG, w); - break; - - case LOAD_NAME: - w = GETITEM(names, oparg); - if ((v = f->f_locals) == NULL) { - why = WHY_EXCEPTION; - t = PyObject_Repr(w); - if (t == NULL) - break; - PyErr_Format(PyExc_SystemError, - "no locals when loading %s", - PyString_AS_STRING(w)); - Py_DECREF(t); - break; - } - if (PyDict_CheckExact(v)) { - x = PyDict_GetItem(v, w); - Py_XINCREF(x); - } - else { - x = PyObject_GetItem(v, w); - if (x == NULL && PyErr_Occurred()) { - if (!PyErr_ExceptionMatches( - PyExc_KeyError)) - break; - PyErr_Clear(); - } - } - if (x == NULL) { - x = PyDict_GetItem(f->f_globals, w); - if (x == NULL) { - x = PyDict_GetItem(f->f_builtins, w); - if (x == NULL) { - format_exc_check_arg( - PyExc_NameError, - NAME_ERROR_MSG, w); - break; - } - } - Py_INCREF(x); - } - PUSH(x); - continue; - - case LOAD_GLOBAL: - w = GETITEM(names, oparg); - if (PyString_CheckExact(w)) { - /* Inline the PyDict_GetItem() calls. - WARNING: this is an extreme speed hack. - Do not try this at home. */ - long hash = ((PyStringObject *)w)->ob_shash; - if (hash != -1) { - PyDictObject *d; - PyDictEntry *e; - d = (PyDictObject *)(f->f_globals); - e = d->ma_lookup(d, w, hash); - if (e == NULL) { - x = NULL; - break; - } - x = e->me_value; - if (x != NULL) { - Py_INCREF(x); - PUSH(x); - continue; - } - d = (PyDictObject *)(f->f_builtins); - e = d->ma_lookup(d, w, hash); - if (e == NULL) { - x = NULL; - break; - } - x = e->me_value; - if (x != NULL) { - Py_INCREF(x); - PUSH(x); - continue; - } - goto load_global_error; - } - } - /* This is the un-inlined version of the code above */ - x = PyDict_GetItem(f->f_globals, w); - if (x == NULL) { - x = PyDict_GetItem(f->f_builtins, w); - if (x == NULL) { - load_global_error: - format_exc_check_arg( - PyExc_NameError, - GLOBAL_NAME_ERROR_MSG, w); - break; - } - } - Py_INCREF(x); - PUSH(x); - continue; - - case DELETE_FAST: - x = GETLOCAL(oparg); - if (x != NULL) { - SETLOCAL(oparg, NULL); - continue; - } - format_exc_check_arg( - PyExc_UnboundLocalError, - UNBOUNDLOCAL_ERROR_MSG, - PyTuple_GetItem(co->co_varnames, oparg) - ); - break; - - case LOAD_CLOSURE: - x = freevars[oparg]; - Py_INCREF(x); - PUSH(x); - if (x != NULL) continue; - break; - - case LOAD_DEREF: - x = freevars[oparg]; - w = PyCell_Get(x); - if (w != NULL) { - PUSH(w); - continue; - } - err = -1; - /* Don't stomp existing exception */ - if (PyErr_Occurred()) - break; - if (oparg < PyTuple_GET_SIZE(co->co_cellvars)) { - v = PyTuple_GET_ITEM(co->co_cellvars, - oparg); - format_exc_check_arg( - PyExc_UnboundLocalError, - UNBOUNDLOCAL_ERROR_MSG, - v); - } else { - v = PyTuple_GET_ITEM(co->co_freevars, oparg - - PyTuple_GET_SIZE(co->co_cellvars)); - format_exc_check_arg(PyExc_NameError, - UNBOUNDFREE_ERROR_MSG, v); - } - break; - - case STORE_DEREF: - w = POP(); - x = freevars[oparg]; - PyCell_Set(x, w); - Py_DECREF(w); - continue; - - case BUILD_TUPLE: - x = PyTuple_New(oparg); - if (x != NULL) { - for (; --oparg >= 0;) { - w = POP(); - PyTuple_SET_ITEM(x, oparg, w); - } - PUSH(x); - continue; - } - break; - - case BUILD_LIST: - x = PyList_New(oparg); - if (x != NULL) { - for (; --oparg >= 0;) { - w = POP(); - PyList_SET_ITEM(x, oparg, w); - } - PUSH(x); - continue; - } - break; - - case BUILD_SET: - x = PySet_New(NULL); - if (x != NULL) { - for (; --oparg >= 0;) { - w = POP(); - if (err == 0) - err = PySet_Add(x, w); - Py_DECREF(w); - } - if (err != 0) { - Py_DECREF(x); - break; - } - PUSH(x); - continue; - } - break; - - - case BUILD_MAP: - x = _PyDict_NewPresized((Py_ssize_t)oparg); - PUSH(x); - if (x != NULL) continue; - break; - - case STORE_MAP: - w = TOP(); /* key */ - u = SECOND(); /* value */ - v = THIRD(); /* dict */ - STACKADJ(-2); - assert (PyDict_CheckExact(v)); - err = PyDict_SetItem(v, w, u); /* v[w] = u */ - Py_DECREF(u); - Py_DECREF(w); - if (err == 0) continue; - break; - - case MAP_ADD: - w = TOP(); /* key */ - u = SECOND(); /* value */ - STACKADJ(-2); - v = stack_pointer[-oparg]; /* dict */ - assert (PyDict_CheckExact(v)); - err = PyDict_SetItem(v, w, u); /* v[w] = u */ - Py_DECREF(u); - Py_DECREF(w); - if (err == 0) { - PREDICT(JUMP_ABSOLUTE); - continue; - } - break; - - case LOAD_ATTR: - w = GETITEM(names, oparg); - v = TOP(); - x = PyObject_GetAttr(v, w); - Py_DECREF(v); - SET_TOP(x); - if (x != NULL) continue; - break; - - case COMPARE_OP: - w = POP(); - v = TOP(); - if (PyInt_CheckExact(w) && PyInt_CheckExact(v)) { - /* INLINE: cmp(int, int) */ - register long a, b; - register int res; - a = PyInt_AS_LONG(v); - b = PyInt_AS_LONG(w); - switch (oparg) { - case PyCmp_LT: res = a < b; break; - case PyCmp_LE: res = a <= b; break; - case PyCmp_EQ: res = a == b; break; - case PyCmp_NE: res = a != b; break; - case PyCmp_GT: res = a > b; break; - case PyCmp_GE: res = a >= b; break; - case PyCmp_IS: res = v == w; break; - case PyCmp_IS_NOT: res = v != w; break; - default: goto slow_compare; - } - x = res ? Py_True : Py_False; - Py_INCREF(x); - } - else { - slow_compare: - x = cmp_outcome(oparg, v, w); - } - Py_DECREF(v); - Py_DECREF(w); - SET_TOP(x); - if (x == NULL) break; - PREDICT(POP_JUMP_IF_FALSE); - PREDICT(POP_JUMP_IF_TRUE); - continue; - - case IMPORT_NAME: - w = GETITEM(names, oparg); - x = PyDict_GetItemString(f->f_builtins, "__import__"); - if (x == NULL) { - PyErr_SetString(PyExc_ImportError, - "__import__ not found"); - break; - } - Py_INCREF(x); - v = POP(); - u = TOP(); - if (PyInt_AsLong(u) != -1 || PyErr_Occurred()) - w = PyTuple_Pack(5, - w, - f->f_globals, - f->f_locals == NULL ? - Py_None : f->f_locals, - v, - u); - else - w = PyTuple_Pack(4, - w, - f->f_globals, - f->f_locals == NULL ? - Py_None : f->f_locals, - v); - Py_DECREF(v); - Py_DECREF(u); - if (w == NULL) { - u = POP(); - Py_DECREF(x); - x = NULL; - break; - } - READ_TIMESTAMP(intr0); - v = x; - x = PyEval_CallObject(v, w); - Py_DECREF(v); - READ_TIMESTAMP(intr1); - Py_DECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case IMPORT_STAR: - v = POP(); - PyFrame_FastToLocals(f); - if ((x = f->f_locals) == NULL) { - PyErr_SetString(PyExc_SystemError, - "no locals found during 'import *'"); - break; - } - READ_TIMESTAMP(intr0); - err = import_all_from(x, v); - READ_TIMESTAMP(intr1); - PyFrame_LocalsToFast(f, 0); - Py_DECREF(v); - if (err == 0) continue; - break; - - case IMPORT_FROM: - w = GETITEM(names, oparg); - v = TOP(); - READ_TIMESTAMP(intr0); - x = import_from(v, w); - READ_TIMESTAMP(intr1); - PUSH(x); - if (x != NULL) continue; - break; - - case JUMP_FORWARD: - JUMPBY(oparg); - goto fast_next_opcode; - - PREDICTED_WITH_ARG(POP_JUMP_IF_FALSE); - case POP_JUMP_IF_FALSE: - w = POP(); - if (w == Py_True) { - Py_DECREF(w); - goto fast_next_opcode; - } - if (w == Py_False) { - Py_DECREF(w); - JUMPTO(oparg); - goto fast_next_opcode; - } - err = PyObject_IsTrue(w); - Py_DECREF(w); - if (err > 0) - err = 0; - else if (err == 0) - JUMPTO(oparg); - else - break; - continue; - - PREDICTED_WITH_ARG(POP_JUMP_IF_TRUE); - case POP_JUMP_IF_TRUE: - w = POP(); - if (w == Py_False) { - Py_DECREF(w); - goto fast_next_opcode; - } - if (w == Py_True) { - Py_DECREF(w); - JUMPTO(oparg); - goto fast_next_opcode; - } - err = PyObject_IsTrue(w); - Py_DECREF(w); - if (err > 0) { - err = 0; - JUMPTO(oparg); - } - else if (err == 0) - ; - else - break; - continue; - - case JUMP_IF_FALSE_OR_POP: - w = TOP(); - if (w == Py_True) { - STACKADJ(-1); - Py_DECREF(w); - goto fast_next_opcode; - } - if (w == Py_False) { - JUMPTO(oparg); - goto fast_next_opcode; - } - err = PyObject_IsTrue(w); - if (err > 0) { - STACKADJ(-1); - Py_DECREF(w); - err = 0; - } - else if (err == 0) - JUMPTO(oparg); - else - break; - continue; - - case JUMP_IF_TRUE_OR_POP: - w = TOP(); - if (w == Py_False) { - STACKADJ(-1); - Py_DECREF(w); - goto fast_next_opcode; - } - if (w == Py_True) { - JUMPTO(oparg); - goto fast_next_opcode; - } - err = PyObject_IsTrue(w); - if (err > 0) { - err = 0; - JUMPTO(oparg); - } - else if (err == 0) { - STACKADJ(-1); - Py_DECREF(w); - } - else - break; - continue; - - PREDICTED_WITH_ARG(JUMP_ABSOLUTE); - case JUMP_ABSOLUTE: - JUMPTO(oparg); -#if FAST_LOOPS - /* Enabling this path speeds-up all while and for-loops by bypassing - the per-loop checks for signals. By default, this should be turned-off - because it prevents detection of a control-break in tight loops like - "while 1: pass". Compile with this option turned-on when you need - the speed-up and do not need break checking inside tight loops (ones - that contain only instructions ending with goto fast_next_opcode). - */ - goto fast_next_opcode; -#else - continue; -#endif - - case GET_ITER: - /* before: [obj]; after [getiter(obj)] */ - v = TOP(); - x = PyObject_GetIter(v); - Py_DECREF(v); - if (x != NULL) { - SET_TOP(x); - PREDICT(FOR_ITER); - continue; - } - STACKADJ(-1); - break; - - PREDICTED_WITH_ARG(FOR_ITER); - case FOR_ITER: - /* before: [iter]; after: [iter, iter()] *or* [] */ - v = TOP(); - x = (*v->ob_type->tp_iternext)(v); - if (x != NULL) { - PUSH(x); - PREDICT(STORE_FAST); - PREDICT(UNPACK_SEQUENCE); - continue; - } - if (PyErr_Occurred()) { - if (!PyErr_ExceptionMatches( - PyExc_StopIteration)) - break; - PyErr_Clear(); - } - /* iterator ended normally */ - x = v = POP(); - Py_DECREF(v); - JUMPBY(oparg); - continue; - - case BREAK_LOOP: - why = WHY_BREAK; - goto fast_block_end; - - case CONTINUE_LOOP: - retval = PyInt_FromLong(oparg); - if (!retval) { - x = NULL; - break; - } - why = WHY_CONTINUE; - goto fast_block_end; - - case SETUP_LOOP: - case SETUP_EXCEPT: - case SETUP_FINALLY: - /* NOTE: If you add any new block-setup opcodes that - are not try/except/finally handlers, you may need - to update the PyGen_NeedsFinalizing() function. - */ - - PyFrame_BlockSetup(f, opcode, INSTR_OFFSET() + oparg, - STACK_LEVEL()); - continue; - - case SETUP_WITH: - { - static PyObject *exit, *enter; - w = TOP(); - x = special_lookup(w, "__exit__", &exit); - if (!x) - break; - SET_TOP(x); - u = special_lookup(w, "__enter__", &enter); - Py_DECREF(w); - if (!u) { - x = NULL; - break; - } - x = PyObject_CallFunctionObjArgs(u, NULL); - Py_DECREF(u); - if (!x) - break; - /* Setup a finally block (SETUP_WITH as a block is - equivalent to SETUP_FINALLY except it normalizes - the exception) before pushing the result of - __enter__ on the stack. */ - PyFrame_BlockSetup(f, SETUP_WITH, INSTR_OFFSET() + oparg, - STACK_LEVEL()); - - PUSH(x); - continue; - } - - case WITH_CLEANUP: - { - /* At the top of the stack are 1-3 values indicating - how/why we entered the finally clause: - - TOP = None - - (TOP, SECOND) = (WHY_{RETURN,CONTINUE}), retval - - TOP = WHY_*; no retval below it - - (TOP, SECOND, THIRD) = exc_info() - Below them is EXIT, the context.__exit__ bound method. - In the last case, we must call - EXIT(TOP, SECOND, THIRD) - otherwise we must call - EXIT(None, None, None) - - In all cases, we remove EXIT from the stack, leaving - the rest in the same order. - - In addition, if the stack represents an exception, - *and* the function call returns a 'true' value, we - "zap" this information, to prevent END_FINALLY from - re-raising the exception. (But non-local gotos - should still be resumed.) - */ - - PyObject *exit_func; - - u = POP(); - if (u == Py_None) { - exit_func = TOP(); - SET_TOP(u); - v = w = Py_None; - } - else if (PyInt_Check(u)) { - switch(PyInt_AS_LONG(u)) { - case WHY_RETURN: - case WHY_CONTINUE: - /* Retval in TOP. */ - exit_func = SECOND(); - SET_SECOND(TOP()); - SET_TOP(u); - break; - default: - exit_func = TOP(); - SET_TOP(u); - break; - } - u = v = w = Py_None; - } - else { - v = TOP(); - w = SECOND(); - exit_func = THIRD(); - SET_TOP(u); - SET_SECOND(v); - SET_THIRD(w); - } - /* XXX Not the fastest way to call it... */ - x = PyObject_CallFunctionObjArgs(exit_func, u, v, w, - NULL); - Py_DECREF(exit_func); - if (x == NULL) - break; /* Go to error exit */ - - if (u != Py_None) - err = PyObject_IsTrue(x); - else - err = 0; - Py_DECREF(x); - - if (err < 0) - break; /* Go to error exit */ - else if (err > 0) { - err = 0; - /* There was an exception and a true return */ - STACKADJ(-2); - Py_INCREF(Py_None); - SET_TOP(Py_None); - Py_DECREF(u); - Py_DECREF(v); - Py_DECREF(w); - } else { - /* The stack was rearranged to remove EXIT - above. Let END_FINALLY do its thing */ - } - PREDICT(END_FINALLY); - break; - } - - case CALL_FUNCTION: - { - PyObject **sp; - PCALL(PCALL_ALL); - sp = stack_pointer; -#ifdef WITH_TSC - x = call_function(&sp, oparg, &intr0, &intr1); -#else - x = call_function(&sp, oparg); -#endif - stack_pointer = sp; - PUSH(x); - if (x != NULL) - continue; - break; - } - - case CALL_FUNCTION_VAR: - case CALL_FUNCTION_KW: - case CALL_FUNCTION_VAR_KW: - { - int na = oparg & 0xff; - int nk = (oparg>>8) & 0xff; - int flags = (opcode - CALL_FUNCTION) & 3; - int n = na + 2 * nk; - PyObject **pfunc, *func, **sp; - PCALL(PCALL_ALL); - if (flags & CALL_FLAG_VAR) - n++; - if (flags & CALL_FLAG_KW) - n++; - pfunc = stack_pointer - n - 1; - func = *pfunc; - - if (PyMethod_Check(func) - && PyMethod_GET_SELF(func) != NULL) { - PyObject *self = PyMethod_GET_SELF(func); - Py_INCREF(self); - func = PyMethod_GET_FUNCTION(func); - Py_INCREF(func); - Py_DECREF(*pfunc); - *pfunc = self; - na++; - } else - Py_INCREF(func); - sp = stack_pointer; - READ_TIMESTAMP(intr0); - x = ext_do_call(func, &sp, flags, na, nk); - READ_TIMESTAMP(intr1); - stack_pointer = sp; - Py_DECREF(func); - - while (stack_pointer > pfunc) { - w = POP(); - Py_DECREF(w); - } - PUSH(x); - if (x != NULL) - continue; - break; - } - - case MAKE_FUNCTION: - v = POP(); /* code object */ - x = PyFunction_New(v, f->f_globals); - Py_DECREF(v); - /* XXX Maybe this should be a separate opcode? */ - if (x != NULL && oparg > 0) { - v = PyTuple_New(oparg); - if (v == NULL) { - Py_DECREF(x); - x = NULL; - break; - } - while (--oparg >= 0) { - w = POP(); - PyTuple_SET_ITEM(v, oparg, w); - } - err = PyFunction_SetDefaults(x, v); - Py_DECREF(v); - } - PUSH(x); - break; - - case MAKE_CLOSURE: - { - v = POP(); /* code object */ - x = PyFunction_New(v, f->f_globals); - Py_DECREF(v); - if (x != NULL) { - v = POP(); - if (PyFunction_SetClosure(x, v) != 0) { - /* Can't happen unless bytecode is corrupt. */ - why = WHY_EXCEPTION; - } - Py_DECREF(v); - } - if (x != NULL && oparg > 0) { - v = PyTuple_New(oparg); - if (v == NULL) { - Py_DECREF(x); - x = NULL; - break; - } - while (--oparg >= 0) { - w = POP(); - PyTuple_SET_ITEM(v, oparg, w); - } - if (PyFunction_SetDefaults(x, v) != 0) { - /* Can't happen unless - PyFunction_SetDefaults changes. */ - why = WHY_EXCEPTION; - } - Py_DECREF(v); - } - PUSH(x); - break; - } - - case BUILD_SLICE: - if (oparg == 3) - w = POP(); - else - w = NULL; - v = POP(); - u = TOP(); - x = PySlice_New(u, v, w); - Py_DECREF(u); - Py_DECREF(v); - Py_XDECREF(w); - SET_TOP(x); - if (x != NULL) continue; - break; - - case EXTENDED_ARG: - opcode = NEXTOP(); - oparg = oparg<<16 | NEXTARG(); - goto dispatch_opcode; - - default: - fprintf(stderr, - "XXX lineno: %d, opcode: %d\n", - PyFrame_GetLineNumber(f), - opcode); - PyErr_SetString(PyExc_SystemError, "unknown opcode"); - why = WHY_EXCEPTION; - break; - -#ifdef CASE_TOO_BIG - } -#endif - - } /* switch */ - - on_error: - - READ_TIMESTAMP(inst1); - - /* Quickly continue if no error occurred */ - - if (why == WHY_NOT) { - if (err == 0 && x != NULL) { -#ifdef CHECKEXC - /* This check is expensive! */ - if (PyErr_Occurred()) - fprintf(stderr, - "XXX undetected error\n"); - else { -#endif - READ_TIMESTAMP(loop1); - continue; /* Normal, fast path */ -#ifdef CHECKEXC - } -#endif - } - why = WHY_EXCEPTION; - x = Py_None; - err = 0; - } - - /* Double-check exception status */ - - if (why == WHY_EXCEPTION || why == WHY_RERAISE) { - if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_SystemError, - "error return without exception set"); - why = WHY_EXCEPTION; - } - } -#ifdef CHECKEXC - else { - /* This check is expensive! */ - if (PyErr_Occurred()) { - char buf[128]; - sprintf(buf, "Stack unwind with exception " - "set and why=%d", why); - Py_FatalError(buf); - } - } -#endif - - /* Log traceback info if this is a real exception */ - - if (why == WHY_EXCEPTION) { - PyTraceBack_Here(f); - - if (tstate->c_tracefunc != NULL) - call_exc_trace(tstate->c_tracefunc, - tstate->c_traceobj, f); - } - - /* For the rest, treat WHY_RERAISE as WHY_EXCEPTION */ - - if (why == WHY_RERAISE) - why = WHY_EXCEPTION; - - /* Unwind stacks if a (pseudo) exception occurred */ - -fast_block_end: - while (why != WHY_NOT && f->f_iblock > 0) { - /* Peek at the current block. */ - PyTryBlock *b = &f->f_blockstack[f->f_iblock - 1]; - - assert(why != WHY_YIELD); - if (b->b_type == SETUP_LOOP && why == WHY_CONTINUE) { - why = WHY_NOT; - JUMPTO(PyInt_AS_LONG(retval)); - Py_DECREF(retval); - break; - } - - /* Now we have to pop the block. */ - f->f_iblock--; - - while (STACK_LEVEL() > b->b_level) { - v = POP(); - Py_XDECREF(v); - } - if (b->b_type == SETUP_LOOP && why == WHY_BREAK) { - why = WHY_NOT; - JUMPTO(b->b_handler); - break; - } - if (b->b_type == SETUP_FINALLY || - (b->b_type == SETUP_EXCEPT && - why == WHY_EXCEPTION) || - b->b_type == SETUP_WITH) { - if (why == WHY_EXCEPTION) { - PyObject *exc, *val, *tb; - PyErr_Fetch(&exc, &val, &tb); - if (val == NULL) { - val = Py_None; - Py_INCREF(val); - } - /* Make the raw exception data - available to the handler, - so a program can emulate the - Python main loop. Don't do - this for 'finally'. */ - if (b->b_type == SETUP_EXCEPT || - b->b_type == SETUP_WITH) { - PyErr_NormalizeException( - &exc, &val, &tb); - set_exc_info(tstate, - exc, val, tb); - } - if (tb == NULL) { - Py_INCREF(Py_None); - PUSH(Py_None); - } else - PUSH(tb); - PUSH(val); - PUSH(exc); - } - else { - if (why & (WHY_RETURN | WHY_CONTINUE)) - PUSH(retval); - v = PyInt_FromLong((long)why); - PUSH(v); - } - why = WHY_NOT; - JUMPTO(b->b_handler); - break; - } - } /* unwind stack */ - - /* End the loop if we still have an error (or return) */ - - if (why != WHY_NOT) - break; - READ_TIMESTAMP(loop1); - - } /* main loop */ - - assert(why != WHY_YIELD); - /* Pop remaining stack entries. */ - while (!EMPTY()) { - v = POP(); - Py_XDECREF(v); - } - - if (why != WHY_RETURN) - retval = NULL; - -fast_yield: - if (tstate->use_tracing) { - if (tstate->c_tracefunc) { - if (why == WHY_RETURN || why == WHY_YIELD) { - if (call_trace(tstate->c_tracefunc, - tstate->c_traceobj, f, - PyTrace_RETURN, retval)) { - Py_XDECREF(retval); - retval = NULL; - why = WHY_EXCEPTION; - } - } - else if (why == WHY_EXCEPTION) { - call_trace_protected(tstate->c_tracefunc, - tstate->c_traceobj, f, - PyTrace_RETURN, NULL); - } - } - if (tstate->c_profilefunc) { - if (why == WHY_EXCEPTION) - call_trace_protected(tstate->c_profilefunc, - tstate->c_profileobj, f, - PyTrace_RETURN, NULL); - else if (call_trace(tstate->c_profilefunc, - tstate->c_profileobj, f, - PyTrace_RETURN, retval)) { - Py_XDECREF(retval); - retval = NULL; - why = WHY_EXCEPTION; - } - } - } - - if (tstate->frame->f_exc_type != NULL) - reset_exc_info(tstate); - else { - assert(tstate->frame->f_exc_value == NULL); - assert(tstate->frame->f_exc_traceback == NULL); - } - - /* pop frame */ -exit_eval_frame: - Py_LeaveRecursiveCall(); - tstate->frame = f->f_back; - - return retval; -} - -/* This is gonna seem *real weird*, but if you put some other code between - PyEval_EvalFrame() and PyEval_EvalCodeEx() you will need to adjust - the test in the if statements in Misc/gdbinit (pystack and pystackv). */ - -PyObject * -PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, - PyObject **args, int argcount, PyObject **kws, int kwcount, - PyObject **defs, int defcount, PyObject *closure) -{ - register PyFrameObject *f; - register PyObject *retval = NULL; - register PyObject **fastlocals, **freevars; - PyThreadState *tstate = PyThreadState_GET(); - PyObject *x, *u; - - if (globals == NULL) { - PyErr_SetString(PyExc_SystemError, - "PyEval_EvalCodeEx: NULL globals"); - return NULL; - } - - assert(tstate != NULL); - assert(globals != NULL); - f = PyFrame_New(tstate, co, globals, locals); - if (f == NULL) - return NULL; - - fastlocals = f->f_localsplus; - freevars = f->f_localsplus + co->co_nlocals; - - if (co->co_argcount > 0 || - co->co_flags & (CO_VARARGS | CO_VARKEYWORDS)) { - int i; - int n = argcount; - PyObject *kwdict = NULL; - if (co->co_flags & CO_VARKEYWORDS) { - kwdict = PyDict_New(); - if (kwdict == NULL) - goto fail; - i = co->co_argcount; - if (co->co_flags & CO_VARARGS) - i++; - SETLOCAL(i, kwdict); - } - if (argcount > co->co_argcount) { - if (!(co->co_flags & CO_VARARGS)) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes %s %d " - "argument%s (%d given)", - PyString_AsString(co->co_name), - defcount ? "at most" : "exactly", - co->co_argcount, - co->co_argcount == 1 ? "" : "s", - argcount + kwcount); - goto fail; - } - n = co->co_argcount; - } - for (i = 0; i < n; i++) { - x = args[i]; - Py_INCREF(x); - SETLOCAL(i, x); - } - if (co->co_flags & CO_VARARGS) { - u = PyTuple_New(argcount - n); - if (u == NULL) - goto fail; - SETLOCAL(co->co_argcount, u); - for (i = n; i < argcount; i++) { - x = args[i]; - Py_INCREF(x); - PyTuple_SET_ITEM(u, i-n, x); - } - } - for (i = 0; i < kwcount; i++) { - PyObject **co_varnames; - PyObject *keyword = kws[2*i]; - PyObject *value = kws[2*i + 1]; - int j; - if (keyword == NULL || !(PyString_Check(keyword) -#ifdef Py_USING_UNICODE - || PyUnicode_Check(keyword) -#endif - )) { - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", - PyString_AsString(co->co_name)); - goto fail; - } - /* Speed hack: do raw pointer compares. As names are - normally interned this should almost always hit. */ - co_varnames = ((PyTupleObject *)(co->co_varnames))->ob_item; - for (j = 0; j < co->co_argcount; j++) { - PyObject *nm = co_varnames[j]; - if (nm == keyword) - goto kw_found; - } - /* Slow fallback, just in case */ - for (j = 0; j < co->co_argcount; j++) { - PyObject *nm = co_varnames[j]; - int cmp = PyObject_RichCompareBool( - keyword, nm, Py_EQ); - if (cmp > 0) - goto kw_found; - else if (cmp < 0) - goto fail; - } - if (kwdict == NULL) { - PyObject *kwd_str = kwd_as_string(keyword); - if (kwd_str) { - PyErr_Format(PyExc_TypeError, - "%.200s() got an unexpected " - "keyword argument '%.400s'", - PyString_AsString(co->co_name), - PyString_AsString(kwd_str)); - Py_DECREF(kwd_str); - } - goto fail; - } - PyDict_SetItem(kwdict, keyword, value); - continue; - kw_found: - if (GETLOCAL(j) != NULL) { - PyObject *kwd_str = kwd_as_string(keyword); - if (kwd_str) { - PyErr_Format(PyExc_TypeError, - "%.200s() got multiple " - "values for keyword " - "argument '%.400s'", - PyString_AsString(co->co_name), - PyString_AsString(kwd_str)); - Py_DECREF(kwd_str); - } - goto fail; - } - Py_INCREF(value); - SETLOCAL(j, value); - } - if (argcount < co->co_argcount) { - int m = co->co_argcount - defcount; - for (i = argcount; i < m; i++) { - if (GETLOCAL(i) == NULL) { - int j, given = 0; - for (j = 0; j < co->co_argcount; j++) - if (GETLOCAL(j)) - given++; - PyErr_Format(PyExc_TypeError, - "%.200s() takes %s %d " - "argument%s (%d given)", - PyString_AsString(co->co_name), - ((co->co_flags & CO_VARARGS) || - defcount) ? "at least" - : "exactly", - m, m == 1 ? "" : "s", given); - goto fail; - } - } - if (n > m) - i = n - m; - else - i = 0; - for (; i < defcount; i++) { - if (GETLOCAL(m+i) == NULL) { - PyObject *def = defs[i]; - Py_INCREF(def); - SETLOCAL(m+i, def); - } - } - } - } - else if (argcount > 0 || kwcount > 0) { - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%d given)", - PyString_AsString(co->co_name), - argcount + kwcount); - goto fail; - } - /* Allocate and initialize storage for cell vars, and copy free - vars into frame. This isn't too efficient right now. */ - if (PyTuple_GET_SIZE(co->co_cellvars)) { - int i, j, nargs, found; - char *cellname, *argname; - PyObject *c; - - nargs = co->co_argcount; - if (co->co_flags & CO_VARARGS) - nargs++; - if (co->co_flags & CO_VARKEYWORDS) - nargs++; - - /* Initialize each cell var, taking into account - cell vars that are initialized from arguments. - - Should arrange for the compiler to put cellvars - that are arguments at the beginning of the cellvars - list so that we can march over it more efficiently? - */ - for (i = 0; i < PyTuple_GET_SIZE(co->co_cellvars); ++i) { - cellname = PyString_AS_STRING( - PyTuple_GET_ITEM(co->co_cellvars, i)); - found = 0; - for (j = 0; j < nargs; j++) { - argname = PyString_AS_STRING( - PyTuple_GET_ITEM(co->co_varnames, j)); - if (strcmp(cellname, argname) == 0) { - c = PyCell_New(GETLOCAL(j)); - if (c == NULL) - goto fail; - GETLOCAL(co->co_nlocals + i) = c; - found = 1; - break; - } - } - if (found == 0) { - c = PyCell_New(NULL); - if (c == NULL) - goto fail; - SETLOCAL(co->co_nlocals + i, c); - } - } - } - if (PyTuple_GET_SIZE(co->co_freevars)) { - int i; - for (i = 0; i < PyTuple_GET_SIZE(co->co_freevars); ++i) { - PyObject *o = PyTuple_GET_ITEM(closure, i); - Py_INCREF(o); - freevars[PyTuple_GET_SIZE(co->co_cellvars) + i] = o; - } - } - - if (co->co_flags & CO_GENERATOR) { - /* Don't need to keep the reference to f_back, it will be set - * when the generator is resumed. */ - Py_CLEAR(f->f_back); - - PCALL(PCALL_GENERATOR); - - /* Create a new generator that owns the ready to run frame - * and return that as the value. */ - return PyGen_New(f); - } - - retval = PyEval_EvalFrameEx(f,0); - -fail: /* Jump here from prelude on failure */ - - /* decref'ing the frame can cause __del__ methods to get invoked, - which can call back into Python. While we're done with the - current Python frame (f), the associated C stack is still in use, - so recursion_depth must be boosted for the duration. - */ - assert(tstate != NULL); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return retval; -} - - -static PyObject * -special_lookup(PyObject *o, char *meth, PyObject **cache) -{ - PyObject *res; - if (PyInstance_Check(o)) { - if (!*cache) - return PyObject_GetAttrString(o, meth); - else - return PyObject_GetAttr(o, *cache); - } - res = _PyObject_LookupSpecial(o, meth, cache); - if (res == NULL && !PyErr_Occurred()) { - PyErr_SetObject(PyExc_AttributeError, *cache); - return NULL; - } - return res; -} - - -static PyObject * -kwd_as_string(PyObject *kwd) { -#ifdef Py_USING_UNICODE - if (PyString_Check(kwd)) { -#else - assert(PyString_Check(kwd)); -#endif - Py_INCREF(kwd); - return kwd; -#ifdef Py_USING_UNICODE - } - return _PyUnicode_AsDefaultEncodedString(kwd, "replace"); -#endif -} - - -/* Implementation notes for set_exc_info() and reset_exc_info(): - -- Below, 'exc_ZZZ' stands for 'exc_type', 'exc_value' and - 'exc_traceback'. These always travel together. - -- tstate->curexc_ZZZ is the "hot" exception that is set by - PyErr_SetString(), cleared by PyErr_Clear(), and so on. - -- Once an exception is caught by an except clause, it is transferred - from tstate->curexc_ZZZ to tstate->exc_ZZZ, from which sys.exc_info() - can pick it up. This is the primary task of set_exc_info(). - XXX That can't be right: set_exc_info() doesn't look at tstate->curexc_ZZZ. - -- Now let me explain the complicated dance with frame->f_exc_ZZZ. - - Long ago, when none of this existed, there were just a few globals: - one set corresponding to the "hot" exception, and one set - corresponding to sys.exc_ZZZ. (Actually, the latter weren't C - globals; they were simply stored as sys.exc_ZZZ. For backwards - compatibility, they still are!) The problem was that in code like - this: - - try: - "something that may fail" - except "some exception": - "do something else first" - "print the exception from sys.exc_ZZZ." - - if "do something else first" invoked something that raised and caught - an exception, sys.exc_ZZZ were overwritten. That was a frequent - cause of subtle bugs. I fixed this by changing the semantics as - follows: - - - Within one frame, sys.exc_ZZZ will hold the last exception caught - *in that frame*. - - - But initially, and as long as no exception is caught in a given - frame, sys.exc_ZZZ will hold the last exception caught in the - previous frame (or the frame before that, etc.). - - The first bullet fixed the bug in the above example. The second - bullet was for backwards compatibility: it was (and is) common to - have a function that is called when an exception is caught, and to - have that function access the caught exception via sys.exc_ZZZ. - (Example: traceback.print_exc()). - - At the same time I fixed the problem that sys.exc_ZZZ weren't - thread-safe, by introducing sys.exc_info() which gets it from tstate; - but that's really a separate improvement. - - The reset_exc_info() function in ceval.c restores the tstate->exc_ZZZ - variables to what they were before the current frame was called. The - set_exc_info() function saves them on the frame so that - reset_exc_info() can restore them. The invariant is that - frame->f_exc_ZZZ is NULL iff the current frame never caught an - exception (where "catching" an exception applies only to successful - except clauses); and if the current frame ever caught an exception, - frame->f_exc_ZZZ is the exception that was stored in tstate->exc_ZZZ - at the start of the current frame. - -*/ - -static void -set_exc_info(PyThreadState *tstate, - PyObject *type, PyObject *value, PyObject *tb) -{ - PyFrameObject *frame = tstate->frame; - PyObject *tmp_type, *tmp_value, *tmp_tb; - - assert(type != NULL); - assert(frame != NULL); - if (frame->f_exc_type == NULL) { - assert(frame->f_exc_value == NULL); - assert(frame->f_exc_traceback == NULL); - /* This frame didn't catch an exception before. */ - /* Save previous exception of this thread in this frame. */ - if (tstate->exc_type == NULL) { - /* XXX Why is this set to Py_None? */ - Py_INCREF(Py_None); - tstate->exc_type = Py_None; - } - Py_INCREF(tstate->exc_type); - Py_XINCREF(tstate->exc_value); - Py_XINCREF(tstate->exc_traceback); - frame->f_exc_type = tstate->exc_type; - frame->f_exc_value = tstate->exc_value; - frame->f_exc_traceback = tstate->exc_traceback; - } - /* Set new exception for this thread. */ - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - Py_INCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - /* For b/w compatibility */ - PySys_SetObject("exc_type", type); - PySys_SetObject("exc_value", value); - PySys_SetObject("exc_traceback", tb); -} - -static void -reset_exc_info(PyThreadState *tstate) -{ - PyFrameObject *frame; - PyObject *tmp_type, *tmp_value, *tmp_tb; - - /* It's a precondition that the thread state's frame caught an - * exception -- verify in a debug build. - */ - assert(tstate != NULL); - frame = tstate->frame; - assert(frame != NULL); - assert(frame->f_exc_type != NULL); - - /* Copy the frame's exception info back to the thread state. */ - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - Py_INCREF(frame->f_exc_type); - Py_XINCREF(frame->f_exc_value); - Py_XINCREF(frame->f_exc_traceback); - tstate->exc_type = frame->f_exc_type; - tstate->exc_value = frame->f_exc_value; - tstate->exc_traceback = frame->f_exc_traceback; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - - /* For b/w compatibility */ - PySys_SetObject("exc_type", frame->f_exc_type); - PySys_SetObject("exc_value", frame->f_exc_value); - PySys_SetObject("exc_traceback", frame->f_exc_traceback); - - /* Clear the frame's exception info. */ - tmp_type = frame->f_exc_type; - tmp_value = frame->f_exc_value; - tmp_tb = frame->f_exc_traceback; - frame->f_exc_type = NULL; - frame->f_exc_value = NULL; - frame->f_exc_traceback = NULL; - Py_DECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - -/* Logic for the raise statement (too complicated for inlining). - This *consumes* a reference count to each of its arguments. */ -static enum why_code -do_raise(PyObject *type, PyObject *value, PyObject *tb) -{ - if (type == NULL) { - /* Reraise */ - PyThreadState *tstate = PyThreadState_GET(); - type = tstate->exc_type == NULL ? Py_None : tstate->exc_type; - value = tstate->exc_value; - tb = tstate->exc_traceback; - Py_XINCREF(type); - Py_XINCREF(value); - Py_XINCREF(tb); - } - - /* We support the following forms of raise: - raise , - raise , - raise , None - raise , - raise , None - raise , - raise , None - - An omitted second argument is the same as None. - - In addition, raise , is the same as - raising the tuple's first item (and it better have one!); - this rule is applied recursively. - - Finally, an optional third argument can be supplied, which - gives the traceback to be substituted (useful when - re-raising an exception after examining it). */ - - /* First, check the traceback argument, replacing None with - NULL. */ - if (tb == Py_None) { - Py_DECREF(tb); - tb = NULL; - } - else if (tb != NULL && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - - /* Next, replace a missing value with None */ - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - - /* Next, repeatedly, replace a tuple exception with its first item */ - while (PyTuple_Check(type) && PyTuple_Size(type) > 0) { - PyObject *tmp = type; - type = PyTuple_GET_ITEM(type, 0); - Py_INCREF(type); - Py_DECREF(tmp); - } - - if (PyExceptionClass_Check(type)) { - PyErr_NormalizeException(&type, &value, &tb); - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %s() should have returned an instance of " - "BaseException, not '%s'", - ((PyTypeObject *)type)->tp_name, - Py_TYPE(value)->tp_name); - goto raise_error; - } - } - else if (PyExceptionInstance_Check(type)) { - /* Raising an instance. The value should be a dummy. */ - if (value != Py_None) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - else { - /* Normalize to raise , */ - Py_DECREF(value); - value = type; - type = PyExceptionInstance_Class(type); - Py_INCREF(type); - } - } - else { - /* Not something you can raise. You get an exception - anyway, just not what you specified :-) */ - PyErr_Format(PyExc_TypeError, - "exceptions must be old-style classes or " - "derived from BaseException, not %s", - type->ob_type->tp_name); - goto raise_error; - } - - assert(PyExceptionClass_Check(type)); - if (Py_Py3kWarningFlag && PyClass_Check(type)) { - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "exceptions must derive from BaseException " - "in 3.x", 1) < 0) - goto raise_error; - } - - PyErr_Restore(type, value, tb); - if (tb == NULL) - return WHY_EXCEPTION; - else - return WHY_RERAISE; - raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return WHY_EXCEPTION; -} - -/* Iterate v argcnt times and store the results on the stack (via decreasing - sp). Return 1 for success, 0 if error. */ - -static int -unpack_iterable(PyObject *v, int argcnt, PyObject **sp) -{ - int i = 0; - PyObject *it; /* iter(v) */ - PyObject *w; - - assert(v != NULL); - - it = PyObject_GetIter(v); - if (it == NULL) - goto Error; - - for (; i < argcnt; i++) { - w = PyIter_Next(it); - if (w == NULL) { - /* Iterator done, via error or exhaustion. */ - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, - "need more than %d value%s to unpack", - i, i == 1 ? "" : "s"); - } - goto Error; - } - *--sp = w; - } - - /* We better have exhausted the iterator now. */ - w = PyIter_Next(it); - if (w == NULL) { - if (PyErr_Occurred()) - goto Error; - Py_DECREF(it); - return 1; - } - Py_DECREF(w); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - /* fall through */ -Error: - for (; i > 0; i--, sp++) - Py_DECREF(*sp); - Py_XDECREF(it); - return 0; -} - - -#ifdef LLTRACE -static int -prtrace(PyObject *v, char *str) -{ - printf("%s ", str); - if (PyObject_Print(v, stdout, 0) != 0) - PyErr_Clear(); /* Don't know what else to do */ - printf("\n"); - return 1; -} -#endif - -static void -call_exc_trace(Py_tracefunc func, PyObject *self, PyFrameObject *f) -{ - PyObject *type, *value, *traceback, *arg; - int err; - PyErr_Fetch(&type, &value, &traceback); - if (value == NULL) { - value = Py_None; - Py_INCREF(value); - } - arg = PyTuple_Pack(3, type, value, traceback); - if (arg == NULL) { - PyErr_Restore(type, value, traceback); - return; - } - err = call_trace(func, self, f, PyTrace_EXCEPTION, arg); - Py_DECREF(arg); - if (err == 0) - PyErr_Restore(type, value, traceback); - else { - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(traceback); - } -} - -static int -call_trace_protected(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, - int what, PyObject *arg) -{ - PyObject *type, *value, *traceback; - int err; - PyErr_Fetch(&type, &value, &traceback); - err = call_trace(func, obj, frame, what, arg); - if (err == 0) - { - PyErr_Restore(type, value, traceback); - return 0; - } - else { - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(traceback); - return -1; - } -} - -static int -call_trace(Py_tracefunc func, PyObject *obj, PyFrameObject *frame, - int what, PyObject *arg) -{ - register PyThreadState *tstate = frame->f_tstate; - int result; - if (tstate->tracing) - return 0; - tstate->tracing++; - tstate->use_tracing = 0; - result = func(obj, frame, what, arg); - tstate->use_tracing = ((tstate->c_tracefunc != NULL) - || (tstate->c_profilefunc != NULL)); - tstate->tracing--; - return result; -} - -PyObject * -_PyEval_CallTracing(PyObject *func, PyObject *args) -{ - PyFrameObject *frame = PyEval_GetFrame(); - PyThreadState *tstate = frame->f_tstate; - int save_tracing = tstate->tracing; - int save_use_tracing = tstate->use_tracing; - PyObject *result; - - tstate->tracing = 0; - tstate->use_tracing = ((tstate->c_tracefunc != NULL) - || (tstate->c_profilefunc != NULL)); - result = PyObject_Call(func, args, NULL); - tstate->tracing = save_tracing; - tstate->use_tracing = save_use_tracing; - return result; -} - -/* See Objects/lnotab_notes.txt for a description of how tracing works. */ -static int -maybe_call_line_trace(Py_tracefunc func, PyObject *obj, - PyFrameObject *frame, int *instr_lb, int *instr_ub, - int *instr_prev) -{ - int result = 0; - int line = frame->f_lineno; - - /* If the last instruction executed isn't in the current - instruction window, reset the window. - */ - if (frame->f_lasti < *instr_lb || frame->f_lasti >= *instr_ub) { - PyAddrPair bounds; - line = _PyCode_CheckLineNumber(frame->f_code, frame->f_lasti, - &bounds); - *instr_lb = bounds.ap_lower; - *instr_ub = bounds.ap_upper; - } - /* If the last instruction falls at the start of a line or if - it represents a jump backwards, update the frame's line - number and call the trace function. */ - if (frame->f_lasti == *instr_lb || frame->f_lasti < *instr_prev) { - frame->f_lineno = line; - result = call_trace(func, obj, frame, PyTrace_LINE, Py_None); - } - *instr_prev = frame->f_lasti; - return result; -} - -void -PyEval_SetProfile(Py_tracefunc func, PyObject *arg) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *temp = tstate->c_profileobj; - Py_XINCREF(arg); - tstate->c_profilefunc = NULL; - tstate->c_profileobj = NULL; - /* Must make sure that tracing is not ignored if 'temp' is freed */ - tstate->use_tracing = tstate->c_tracefunc != NULL; - Py_XDECREF(temp); - tstate->c_profilefunc = func; - tstate->c_profileobj = arg; - /* Flag that tracing or profiling is turned on */ - tstate->use_tracing = (func != NULL) || (tstate->c_tracefunc != NULL); -} - -void -PyEval_SetTrace(Py_tracefunc func, PyObject *arg) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *temp = tstate->c_traceobj; - _Py_TracingPossible += (func != NULL) - (tstate->c_tracefunc != NULL); - Py_XINCREF(arg); - tstate->c_tracefunc = NULL; - tstate->c_traceobj = NULL; - /* Must make sure that profiling is not ignored if 'temp' is freed */ - tstate->use_tracing = tstate->c_profilefunc != NULL; - Py_XDECREF(temp); - tstate->c_tracefunc = func; - tstate->c_traceobj = arg; - /* Flag that tracing or profiling is turned on */ - tstate->use_tracing = ((func != NULL) - || (tstate->c_profilefunc != NULL)); -} - -PyObject * -PyEval_GetBuiltins(void) -{ - PyFrameObject *current_frame = PyEval_GetFrame(); - if (current_frame == NULL) - return PyThreadState_GET()->interp->builtins; - else - return current_frame->f_builtins; -} - -PyObject * -PyEval_GetLocals(void) -{ - PyFrameObject *current_frame = PyEval_GetFrame(); - if (current_frame == NULL) - return NULL; - PyFrame_FastToLocals(current_frame); - return current_frame->f_locals; -} - -PyObject * -PyEval_GetGlobals(void) -{ - PyFrameObject *current_frame = PyEval_GetFrame(); - if (current_frame == NULL) - return NULL; - else - return current_frame->f_globals; -} - -PyFrameObject * -PyEval_GetFrame(void) -{ - PyThreadState *tstate = PyThreadState_GET(); - return _PyThreadState_GetFrame(tstate); -} - -int -PyEval_GetRestricted(void) -{ - PyFrameObject *current_frame = PyEval_GetFrame(); - return current_frame == NULL ? 0 : PyFrame_IsRestricted(current_frame); -} - -int -PyEval_MergeCompilerFlags(PyCompilerFlags *cf) -{ - PyFrameObject *current_frame = PyEval_GetFrame(); - int result = cf->cf_flags != 0; - - if (current_frame != NULL) { - const int codeflags = current_frame->f_code->co_flags; - const int compilerflags = codeflags & PyCF_MASK; - if (compilerflags) { - result = 1; - cf->cf_flags |= compilerflags; - } -#if 0 /* future keyword */ - if (codeflags & CO_GENERATOR_ALLOWED) { - result = 1; - cf->cf_flags |= CO_GENERATOR_ALLOWED; - } -#endif - } - return result; -} - -int -Py_FlushLine(void) -{ - PyObject *f = PySys_GetObject("stdout"); - if (f == NULL) - return 0; - if (!PyFile_SoftSpace(f, 0)) - return 0; - return PyFile_WriteString("\n", f); -} - - -/* External interface to call any callable object. - The arg must be a tuple or NULL. The kw must be a dict or NULL. */ - -PyObject * -PyEval_CallObjectWithKeywords(PyObject *func, PyObject *arg, PyObject *kw) -{ - PyObject *result; - - if (arg == NULL) { - arg = PyTuple_New(0); - if (arg == NULL) - return NULL; - } - else if (!PyTuple_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "argument list must be a tuple"); - return NULL; - } - else - Py_INCREF(arg); - - if (kw != NULL && !PyDict_Check(kw)) { - PyErr_SetString(PyExc_TypeError, - "keyword list must be a dictionary"); - Py_DECREF(arg); - return NULL; - } - - result = PyObject_Call(func, arg, kw); - Py_DECREF(arg); - return result; -} - -const char * -PyEval_GetFuncName(PyObject *func) -{ - if (PyMethod_Check(func)) - return PyEval_GetFuncName(PyMethod_GET_FUNCTION(func)); - else if (PyFunction_Check(func)) - return PyString_AsString(((PyFunctionObject*)func)->func_name); - else if (PyCFunction_Check(func)) - return ((PyCFunctionObject*)func)->m_ml->ml_name; - else if (PyClass_Check(func)) - return PyString_AsString(((PyClassObject*)func)->cl_name); - else if (PyInstance_Check(func)) { - return PyString_AsString( - ((PyInstanceObject*)func)->in_class->cl_name); - } else { - return func->ob_type->tp_name; - } -} - -const char * -PyEval_GetFuncDesc(PyObject *func) -{ - if (PyMethod_Check(func)) - return "()"; - else if (PyFunction_Check(func)) - return "()"; - else if (PyCFunction_Check(func)) - return "()"; - else if (PyClass_Check(func)) - return " constructor"; - else if (PyInstance_Check(func)) { - return " instance"; - } else { - return " object"; - } -} - -static void -err_args(PyObject *func, int flags, int nargs) -{ - if (flags & METH_NOARGS) - PyErr_Format(PyExc_TypeError, - "%.200s() takes no arguments (%d given)", - ((PyCFunctionObject *)func)->m_ml->ml_name, - nargs); - else - PyErr_Format(PyExc_TypeError, - "%.200s() takes exactly one argument (%d given)", - ((PyCFunctionObject *)func)->m_ml->ml_name, - nargs); -} - -#define C_TRACE(x, call) \ -if (tstate->use_tracing && tstate->c_profilefunc) { \ - if (call_trace(tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_CALL, \ - func)) { \ - x = NULL; \ - } \ - else { \ - x = call; \ - if (tstate->c_profilefunc != NULL) { \ - if (x == NULL) { \ - call_trace_protected(tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_EXCEPTION, \ - func); \ - /* XXX should pass (type, value, tb) */ \ - } else { \ - if (call_trace(tstate->c_profilefunc, \ - tstate->c_profileobj, \ - tstate->frame, PyTrace_C_RETURN, \ - func)) { \ - Py_DECREF(x); \ - x = NULL; \ - } \ - } \ - } \ - } \ -} else { \ - x = call; \ - } - -static PyObject * -call_function(PyObject ***pp_stack, int oparg -#ifdef WITH_TSC - , uint64* pintr0, uint64* pintr1 -#endif - ) -{ - int na = oparg & 0xff; - int nk = (oparg>>8) & 0xff; - int n = na + 2 * nk; - PyObject **pfunc = (*pp_stack) - n - 1; - PyObject *func = *pfunc; - PyObject *x, *w; - - /* Always dispatch PyCFunction first, because these are - presumed to be the most frequent callable object. - */ - if (PyCFunction_Check(func) && nk == 0) { - int flags = PyCFunction_GET_FLAGS(func); - PyThreadState *tstate = PyThreadState_GET(); - - PCALL(PCALL_CFUNCTION); - if (flags & (METH_NOARGS | METH_O)) { - PyCFunction meth = PyCFunction_GET_FUNCTION(func); - PyObject *self = PyCFunction_GET_SELF(func); - if (flags & METH_NOARGS && na == 0) { - C_TRACE(x, (*meth)(self,NULL)); - } - else if (flags & METH_O && na == 1) { - PyObject *arg = EXT_POP(*pp_stack); - C_TRACE(x, (*meth)(self,arg)); - Py_DECREF(arg); - } - else { - err_args(func, flags, na); - x = NULL; - } - } - else { - PyObject *callargs; - callargs = load_args(pp_stack, na); - READ_TIMESTAMP(*pintr0); - C_TRACE(x, PyCFunction_Call(func,callargs,NULL)); - READ_TIMESTAMP(*pintr1); - Py_XDECREF(callargs); - } - } else { - if (PyMethod_Check(func) && PyMethod_GET_SELF(func) != NULL) { - /* optimize access to bound methods */ - PyObject *self = PyMethod_GET_SELF(func); - PCALL(PCALL_METHOD); - PCALL(PCALL_BOUND_METHOD); - Py_INCREF(self); - func = PyMethod_GET_FUNCTION(func); - Py_INCREF(func); - Py_DECREF(*pfunc); - *pfunc = self; - na++; - n++; - } else - Py_INCREF(func); - READ_TIMESTAMP(*pintr0); - if (PyFunction_Check(func)) - x = fast_function(func, pp_stack, n, na, nk); - else - x = do_call(func, pp_stack, na, nk); - READ_TIMESTAMP(*pintr1); - Py_DECREF(func); - } - - /* Clear the stack of the function object. Also removes - the arguments in case they weren't consumed already - (fast_function() and err_args() leave them on the stack). - */ - while ((*pp_stack) > pfunc) { - w = EXT_POP(*pp_stack); - Py_DECREF(w); - PCALL(PCALL_POP); - } - return x; -} - -/* The fast_function() function optimize calls for which no argument - tuple is necessary; the objects are passed directly from the stack. - For the simplest case -- a function that takes only positional - arguments and is called with only positional arguments -- it - inlines the most primitive frame setup code from - PyEval_EvalCodeEx(), which vastly reduces the checks that must be - done before evaluating the frame. -*/ - -static PyObject * -fast_function(PyObject *func, PyObject ***pp_stack, int n, int na, int nk) -{ - PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func); - PyObject *globals = PyFunction_GET_GLOBALS(func); - PyObject *argdefs = PyFunction_GET_DEFAULTS(func); - PyObject **d = NULL; - int nd = 0; - - PCALL(PCALL_FUNCTION); - PCALL(PCALL_FAST_FUNCTION); - if (argdefs == NULL && co->co_argcount == n && nk==0 && - co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) { - PyFrameObject *f; - PyObject *retval = NULL; - PyThreadState *tstate = PyThreadState_GET(); - PyObject **fastlocals, **stack; - int i; - - PCALL(PCALL_FASTER_FUNCTION); - assert(globals != NULL); - /* XXX Perhaps we should create a specialized - PyFrame_New() that doesn't take locals, but does - take builtins without sanity checking them. - */ - assert(tstate != NULL); - f = PyFrame_New(tstate, co, globals, NULL); - if (f == NULL) - return NULL; - - fastlocals = f->f_localsplus; - stack = (*pp_stack) - n; - - for (i = 0; i < n; i++) { - Py_INCREF(*stack); - fastlocals[i] = *stack++; - } - retval = PyEval_EvalFrameEx(f,0); - ++tstate->recursion_depth; - Py_DECREF(f); - --tstate->recursion_depth; - return retval; - } - if (argdefs != NULL) { - d = &PyTuple_GET_ITEM(argdefs, 0); - nd = Py_SIZE(argdefs); - } - return PyEval_EvalCodeEx(co, globals, - (PyObject *)NULL, (*pp_stack)-n, na, - (*pp_stack)-2*nk, nk, d, nd, - PyFunction_GET_CLOSURE(func)); -} - -static PyObject * -update_keyword_args(PyObject *orig_kwdict, int nk, PyObject ***pp_stack, - PyObject *func) -{ - PyObject *kwdict = NULL; - if (orig_kwdict == NULL) - kwdict = PyDict_New(); - else { - kwdict = PyDict_Copy(orig_kwdict); - Py_DECREF(orig_kwdict); - } - if (kwdict == NULL) - return NULL; - while (--nk >= 0) { - int err; - PyObject *value = EXT_POP(*pp_stack); - PyObject *key = EXT_POP(*pp_stack); - if (PyDict_GetItem(kwdict, key) != NULL) { - PyErr_Format(PyExc_TypeError, - "%.200s%s got multiple values " - "for keyword argument '%.200s'", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - PyString_AsString(key)); - Py_DECREF(key); - Py_DECREF(value); - Py_DECREF(kwdict); - return NULL; - } - err = PyDict_SetItem(kwdict, key, value); - Py_DECREF(key); - Py_DECREF(value); - if (err) { - Py_DECREF(kwdict); - return NULL; - } - } - return kwdict; -} - -static PyObject * -update_star_args(int nstack, int nstar, PyObject *stararg, - PyObject ***pp_stack) -{ - PyObject *callargs, *w; - - callargs = PyTuple_New(nstack + nstar); - if (callargs == NULL) { - return NULL; - } - if (nstar) { - int i; - for (i = 0; i < nstar; i++) { - PyObject *a = PyTuple_GET_ITEM(stararg, i); - Py_INCREF(a); - PyTuple_SET_ITEM(callargs, nstack + i, a); - } - } - while (--nstack >= 0) { - w = EXT_POP(*pp_stack); - PyTuple_SET_ITEM(callargs, nstack, w); - } - return callargs; -} - -static PyObject * -load_args(PyObject ***pp_stack, int na) -{ - PyObject *args = PyTuple_New(na); - PyObject *w; - - if (args == NULL) - return NULL; - while (--na >= 0) { - w = EXT_POP(*pp_stack); - PyTuple_SET_ITEM(args, na, w); - } - return args; -} - -static PyObject * -do_call(PyObject *func, PyObject ***pp_stack, int na, int nk) -{ - PyObject *callargs = NULL; - PyObject *kwdict = NULL; - PyObject *result = NULL; - - if (nk > 0) { - kwdict = update_keyword_args(NULL, nk, pp_stack, func); - if (kwdict == NULL) - goto call_fail; - } - callargs = load_args(pp_stack, na); - if (callargs == NULL) - goto call_fail; -#ifdef CALL_PROFILE - /* At this point, we have to look at the type of func to - update the call stats properly. Do it here so as to avoid - exposing the call stats machinery outside ceval.c - */ - if (PyFunction_Check(func)) - PCALL(PCALL_FUNCTION); - else if (PyMethod_Check(func)) - PCALL(PCALL_METHOD); - else if (PyType_Check(func)) - PCALL(PCALL_TYPE); - else if (PyCFunction_Check(func)) - PCALL(PCALL_CFUNCTION); - else - PCALL(PCALL_OTHER); -#endif - if (PyCFunction_Check(func)) { - PyThreadState *tstate = PyThreadState_GET(); - C_TRACE(result, PyCFunction_Call(func, callargs, kwdict)); - } - else - result = PyObject_Call(func, callargs, kwdict); - call_fail: - Py_XDECREF(callargs); - Py_XDECREF(kwdict); - return result; -} - -static PyObject * -ext_do_call(PyObject *func, PyObject ***pp_stack, int flags, int na, int nk) -{ - int nstar = 0; - PyObject *callargs = NULL; - PyObject *stararg = NULL; - PyObject *kwdict = NULL; - PyObject *result = NULL; - - if (flags & CALL_FLAG_KW) { - kwdict = EXT_POP(*pp_stack); - if (!PyDict_Check(kwdict)) { - PyObject *d; - d = PyDict_New(); - if (d == NULL) - goto ext_call_fail; - if (PyDict_Update(d, kwdict) != 0) { - Py_DECREF(d); - /* PyDict_Update raises attribute - * error (percolated from an attempt - * to get 'keys' attribute) instead of - * a type error if its second argument - * is not a mapping. - */ - if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after ** " - "must be a mapping, not %.200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - kwdict->ob_type->tp_name); - } - goto ext_call_fail; - } - Py_DECREF(kwdict); - kwdict = d; - } - } - if (flags & CALL_FLAG_VAR) { - stararg = EXT_POP(*pp_stack); - if (!PyTuple_Check(stararg)) { - PyObject *t = NULL; - t = PySequence_Tuple(stararg); - if (t == NULL) { - if (PyErr_ExceptionMatches(PyExc_TypeError)) { - PyErr_Format(PyExc_TypeError, - "%.200s%.200s argument after * " - "must be a sequence, not %200s", - PyEval_GetFuncName(func), - PyEval_GetFuncDesc(func), - stararg->ob_type->tp_name); - } - goto ext_call_fail; - } - Py_DECREF(stararg); - stararg = t; - } - nstar = PyTuple_GET_SIZE(stararg); - } - if (nk > 0) { - kwdict = update_keyword_args(kwdict, nk, pp_stack, func); - if (kwdict == NULL) - goto ext_call_fail; - } - callargs = update_star_args(na, nstar, stararg, pp_stack); - if (callargs == NULL) - goto ext_call_fail; -#ifdef CALL_PROFILE - /* At this point, we have to look at the type of func to - update the call stats properly. Do it here so as to avoid - exposing the call stats machinery outside ceval.c - */ - if (PyFunction_Check(func)) - PCALL(PCALL_FUNCTION); - else if (PyMethod_Check(func)) - PCALL(PCALL_METHOD); - else if (PyType_Check(func)) - PCALL(PCALL_TYPE); - else if (PyCFunction_Check(func)) - PCALL(PCALL_CFUNCTION); - else - PCALL(PCALL_OTHER); -#endif - if (PyCFunction_Check(func)) { - PyThreadState *tstate = PyThreadState_GET(); - C_TRACE(result, PyCFunction_Call(func, callargs, kwdict)); - } - else - result = PyObject_Call(func, callargs, kwdict); -ext_call_fail: - Py_XDECREF(callargs); - Py_XDECREF(kwdict); - Py_XDECREF(stararg); - return result; -} - -/* Extract a slice index from a PyInt or PyLong or an object with the - nb_index slot defined, and store in *pi. - Silently reduce values larger than PY_SSIZE_T_MAX to PY_SSIZE_T_MAX, - and silently boost values less than -PY_SSIZE_T_MAX-1 to -PY_SSIZE_T_MAX-1. - Return 0 on error, 1 on success. -*/ -/* Note: If v is NULL, return success without storing into *pi. This - is because_PyEval_SliceIndex() is called by apply_slice(), which can be - called by the SLICE opcode with v and/or w equal to NULL. -*/ -int -_PyEval_SliceIndex(PyObject *v, Py_ssize_t *pi) -{ - if (v != NULL) { - Py_ssize_t x; - if (PyInt_Check(v)) { - /* XXX(nnorwitz): I think PyInt_AS_LONG is correct, - however, it looks like it should be AsSsize_t. - There should be a comment here explaining why. - */ - x = PyInt_AS_LONG(v); - } - else if (PyIndex_Check(v)) { - x = PyNumber_AsSsize_t(v, NULL); - if (x == -1 && PyErr_Occurred()) - return 0; - } - else { - PyErr_SetString(PyExc_TypeError, - "slice indices must be integers or " - "None or have an __index__ method"); - return 0; - } - *pi = x; - } - return 1; -} - -#undef ISINDEX -#define ISINDEX(x) ((x) == NULL || \ - PyInt_Check(x) || PyLong_Check(x) || PyIndex_Check(x)) - -static PyObject * -apply_slice(PyObject *u, PyObject *v, PyObject *w) /* return u[v:w] */ -{ - PyTypeObject *tp = u->ob_type; - PySequenceMethods *sq = tp->tp_as_sequence; - - if (sq && sq->sq_slice && ISINDEX(v) && ISINDEX(w)) { - Py_ssize_t ilow = 0, ihigh = PY_SSIZE_T_MAX; - if (!_PyEval_SliceIndex(v, &ilow)) - return NULL; - if (!_PyEval_SliceIndex(w, &ihigh)) - return NULL; - return PySequence_GetSlice(u, ilow, ihigh); - } - else { - PyObject *slice = PySlice_New(v, w, NULL); - if (slice != NULL) { - PyObject *res = PyObject_GetItem(u, slice); - Py_DECREF(slice); - return res; - } - else - return NULL; - } -} - -static int -assign_slice(PyObject *u, PyObject *v, PyObject *w, PyObject *x) - /* u[v:w] = x */ -{ - PyTypeObject *tp = u->ob_type; - PySequenceMethods *sq = tp->tp_as_sequence; - - if (sq && sq->sq_ass_slice && ISINDEX(v) && ISINDEX(w)) { - Py_ssize_t ilow = 0, ihigh = PY_SSIZE_T_MAX; - if (!_PyEval_SliceIndex(v, &ilow)) - return -1; - if (!_PyEval_SliceIndex(w, &ihigh)) - return -1; - if (x == NULL) - return PySequence_DelSlice(u, ilow, ihigh); - else - return PySequence_SetSlice(u, ilow, ihigh, x); - } - else { - PyObject *slice = PySlice_New(v, w, NULL); - if (slice != NULL) { - int res; - if (x != NULL) - res = PyObject_SetItem(u, slice, x); - else - res = PyObject_DelItem(u, slice); - Py_DECREF(slice); - return res; - } - else - return -1; - } -} - -#define Py3kExceptionClass_Check(x) \ - (PyType_Check((x)) && \ - PyType_FastSubclass((PyTypeObject*)(x), Py_TPFLAGS_BASE_EXC_SUBCLASS)) - -#define CANNOT_CATCH_MSG "catching classes that don't inherit from " \ - "BaseException is not allowed in 3.x" - -static PyObject * -cmp_outcome(int op, register PyObject *v, register PyObject *w) -{ - int res = 0; - switch (op) { - case PyCmp_IS: - res = (v == w); - break; - case PyCmp_IS_NOT: - res = (v != w); - break; - case PyCmp_IN: - res = PySequence_Contains(w, v); - if (res < 0) - return NULL; - break; - case PyCmp_NOT_IN: - res = PySequence_Contains(w, v); - if (res < 0) - return NULL; - res = !res; - break; - case PyCmp_EXC_MATCH: - if (PyTuple_Check(w)) { - Py_ssize_t i, length; - length = PyTuple_Size(w); - for (i = 0; i < length; i += 1) { - PyObject *exc = PyTuple_GET_ITEM(w, i); - if (PyString_Check(exc)) { - int ret_val; - ret_val = PyErr_WarnEx( - PyExc_DeprecationWarning, - "catching of string " - "exceptions is deprecated", 1); - if (ret_val < 0) - return NULL; - } - else if (Py_Py3kWarningFlag && - !PyTuple_Check(exc) && - !Py3kExceptionClass_Check(exc)) - { - int ret_val; - ret_val = PyErr_WarnEx( - PyExc_DeprecationWarning, - CANNOT_CATCH_MSG, 1); - if (ret_val < 0) - return NULL; - } - } - } - else { - if (PyString_Check(w)) { - int ret_val; - ret_val = PyErr_WarnEx( - PyExc_DeprecationWarning, - "catching of string " - "exceptions is deprecated", 1); - if (ret_val < 0) - return NULL; - } - else if (Py_Py3kWarningFlag && - !PyTuple_Check(w) && - !Py3kExceptionClass_Check(w)) - { - int ret_val; - ret_val = PyErr_WarnEx( - PyExc_DeprecationWarning, - CANNOT_CATCH_MSG, 1); - if (ret_val < 0) - return NULL; - } - } - res = PyErr_GivenExceptionMatches(v, w); - break; - default: - return PyObject_RichCompare(v, w, op); - } - v = res ? Py_True : Py_False; - Py_INCREF(v); - return v; -} - -static PyObject * -import_from(PyObject *v, PyObject *name) -{ - PyObject *x; - - x = PyObject_GetAttr(v, name); - if (x == NULL && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - "cannot import name %.230s", - PyString_AsString(name)); - } - return x; -} - -static int -import_all_from(PyObject *locals, PyObject *v) -{ - PyObject *all = PyObject_GetAttrString(v, "__all__"); - PyObject *dict, *name, *value; - int skip_leading_underscores = 0; - int pos, err; - - if (all == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; /* Unexpected error */ - PyErr_Clear(); - dict = PyObject_GetAttrString(v, "__dict__"); - if (dict == NULL) { - if (!PyErr_ExceptionMatches(PyExc_AttributeError)) - return -1; - PyErr_SetString(PyExc_ImportError, - "from-import-* object has no __dict__ and no __all__"); - return -1; - } - all = PyMapping_Keys(dict); - Py_DECREF(dict); - if (all == NULL) - return -1; - skip_leading_underscores = 1; - } - - for (pos = 0, err = 0; ; pos++) { - name = PySequence_GetItem(all, pos); - if (name == NULL) { - if (!PyErr_ExceptionMatches(PyExc_IndexError)) - err = -1; - else - PyErr_Clear(); - break; - } - if (skip_leading_underscores && - PyString_Check(name) && - PyString_AS_STRING(name)[0] == '_') - { - Py_DECREF(name); - continue; - } - value = PyObject_GetAttr(v, name); - if (value == NULL) - err = -1; - else if (PyDict_CheckExact(locals)) - err = PyDict_SetItem(locals, name, value); - else - err = PyObject_SetItem(locals, name, value); - Py_DECREF(name); - Py_XDECREF(value); - if (err != 0) - break; - } - Py_DECREF(all); - return err; -} - -static PyObject * -build_class(PyObject *methods, PyObject *bases, PyObject *name) -{ - PyObject *metaclass = NULL, *result, *base; - - if (PyDict_Check(methods)) - metaclass = PyDict_GetItemString(methods, "__metaclass__"); - if (metaclass != NULL) - Py_INCREF(metaclass); - else if (PyTuple_Check(bases) && PyTuple_GET_SIZE(bases) > 0) { - base = PyTuple_GET_ITEM(bases, 0); - metaclass = PyObject_GetAttrString(base, "__class__"); - if (metaclass == NULL) { - PyErr_Clear(); - metaclass = (PyObject *)base->ob_type; - Py_INCREF(metaclass); - } - } - else { - PyObject *g = PyEval_GetGlobals(); - if (g != NULL && PyDict_Check(g)) - metaclass = PyDict_GetItemString(g, "__metaclass__"); - if (metaclass == NULL) - metaclass = (PyObject *) &PyClass_Type; - Py_INCREF(metaclass); - } - result = PyObject_CallFunctionObjArgs(metaclass, name, bases, methods, - NULL); - Py_DECREF(metaclass); - if (result == NULL && PyErr_ExceptionMatches(PyExc_TypeError)) { - /* A type error here likely means that the user passed - in a base that was not a class (such the random module - instead of the random.random type). Help them out with - by augmenting the error message with more information.*/ - - PyObject *ptype, *pvalue, *ptraceback; - - PyErr_Fetch(&ptype, &pvalue, &ptraceback); - if (PyString_Check(pvalue)) { - PyObject *newmsg; - newmsg = PyString_FromFormat( - "Error when calling the metaclass bases\n" - " %s", - PyString_AS_STRING(pvalue)); - if (newmsg != NULL) { - Py_DECREF(pvalue); - pvalue = newmsg; - } - } - PyErr_Restore(ptype, pvalue, ptraceback); - } - return result; -} - -static int -exec_statement(PyFrameObject *f, PyObject *prog, PyObject *globals, - PyObject *locals) -{ - int n; - PyObject *v; - int plain = 0; - - if (PyTuple_Check(prog) && globals == Py_None && locals == Py_None && - ((n = PyTuple_Size(prog)) == 2 || n == 3)) { - /* Backward compatibility hack */ - globals = PyTuple_GetItem(prog, 1); - if (n == 3) - locals = PyTuple_GetItem(prog, 2); - prog = PyTuple_GetItem(prog, 0); - } - if (globals == Py_None) { - globals = PyEval_GetGlobals(); - if (locals == Py_None) { - locals = PyEval_GetLocals(); - plain = 1; - } - if (!globals || !locals) { - PyErr_SetString(PyExc_SystemError, - "globals and locals cannot be NULL"); - return -1; - } - } - else if (locals == Py_None) - locals = globals; - if (!PyString_Check(prog) && -#ifdef Py_USING_UNICODE - !PyUnicode_Check(prog) && -#endif - !PyCode_Check(prog) && - !PyFile_Check(prog)) { - PyErr_SetString(PyExc_TypeError, - "exec: arg 1 must be a string, file, or code object"); - return -1; - } - if (!PyDict_Check(globals)) { - PyErr_SetString(PyExc_TypeError, - "exec: arg 2 must be a dictionary or None"); - return -1; - } - if (!PyMapping_Check(locals)) { - PyErr_SetString(PyExc_TypeError, - "exec: arg 3 must be a mapping or None"); - return -1; - } - if (PyDict_GetItemString(globals, "__builtins__") == NULL) - PyDict_SetItemString(globals, "__builtins__", f->f_builtins); - if (PyCode_Check(prog)) { - if (PyCode_GetNumFree((PyCodeObject *)prog) > 0) { - PyErr_SetString(PyExc_TypeError, - "code object passed to exec may not contain free variables"); - return -1; - } - v = PyEval_EvalCode((PyCodeObject *) prog, globals, locals); - } - else if (PyFile_Check(prog)) { - FILE *fp = PyFile_AsFile(prog); - char *name = PyString_AsString(PyFile_Name(prog)); - PyCompilerFlags cf; - if (name == NULL) - return -1; - cf.cf_flags = 0; - if (PyEval_MergeCompilerFlags(&cf)) - v = PyRun_FileFlags(fp, name, Py_file_input, globals, - locals, &cf); - else - v = PyRun_File(fp, name, Py_file_input, globals, - locals); - } - else { - PyObject *tmp = NULL; - char *str; - PyCompilerFlags cf; - cf.cf_flags = 0; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(prog)) { - tmp = PyUnicode_AsUTF8String(prog); - if (tmp == NULL) - return -1; - prog = tmp; - cf.cf_flags |= PyCF_SOURCE_IS_UTF8; - } -#endif - if (PyString_AsStringAndSize(prog, &str, NULL)) - return -1; - if (PyEval_MergeCompilerFlags(&cf)) - v = PyRun_StringFlags(str, Py_file_input, globals, - locals, &cf); - else - v = PyRun_String(str, Py_file_input, globals, locals); - Py_XDECREF(tmp); - } - if (plain) - PyFrame_LocalsToFast(f, 0); - if (v == NULL) - return -1; - Py_DECREF(v); - return 0; -} - -static void -format_exc_check_arg(PyObject *exc, char *format_str, PyObject *obj) -{ - char *obj_str; - - if (!obj) - return; - - obj_str = PyString_AsString(obj); - if (!obj_str) - return; - - PyErr_Format(exc, format_str, obj_str); -} - -static PyObject * -string_concatenate(PyObject *v, PyObject *w, - PyFrameObject *f, unsigned char *next_instr) -{ - /* This function implements 'variable += expr' when both arguments - are strings. */ - Py_ssize_t v_len = PyString_GET_SIZE(v); - Py_ssize_t w_len = PyString_GET_SIZE(w); - Py_ssize_t new_len = v_len + w_len; - if (new_len < 0) { - PyErr_SetString(PyExc_OverflowError, - "strings are too large to concat"); - return NULL; - } - - if (v->ob_refcnt == 2) { - /* In the common case, there are 2 references to the value - * stored in 'variable' when the += is performed: one on the - * value stack (in 'v') and one still stored in the - * 'variable'. We try to delete the variable now to reduce - * the refcnt to 1. - */ - switch (*next_instr) { - case STORE_FAST: - { - int oparg = PEEKARG(); - PyObject **fastlocals = f->f_localsplus; - if (GETLOCAL(oparg) == v) - SETLOCAL(oparg, NULL); - break; - } - case STORE_DEREF: - { - PyObject **freevars = (f->f_localsplus + - f->f_code->co_nlocals); - PyObject *c = freevars[PEEKARG()]; - if (PyCell_GET(c) == v) - PyCell_Set(c, NULL); - break; - } - case STORE_NAME: - { - PyObject *names = f->f_code->co_names; - PyObject *name = GETITEM(names, PEEKARG()); - PyObject *locals = f->f_locals; - if (PyDict_CheckExact(locals) && - PyDict_GetItem(locals, name) == v) { - if (PyDict_DelItem(locals, name) != 0) { - PyErr_Clear(); - } - } - break; - } - } - } - - if (v->ob_refcnt == 1 && !PyString_CHECK_INTERNED(v)) { - /* Now we own the last reference to 'v', so we can resize it - * in-place. - */ - if (_PyString_Resize(&v, new_len) != 0) { - /* XXX if _PyString_Resize() fails, 'v' has been - * deallocated so it cannot be put back into - * 'variable'. The MemoryError is raised when there - * is no value in 'variable', which might (very - * remotely) be a cause of incompatibilities. - */ - return NULL; - } - /* copy 'w' into the newly allocated area of 'v' */ - memcpy(PyString_AS_STRING(v) + v_len, - PyString_AS_STRING(w), w_len); - return v; - } - else { - /* When in-place resizing is not an option. */ - PyString_Concat(&v, w); - return v; - } -} - -#ifdef DYNAMIC_EXECUTION_PROFILE - -static PyObject * -getarray(long a[256]) -{ - int i; - PyObject *l = PyList_New(256); - if (l == NULL) return NULL; - for (i = 0; i < 256; i++) { - PyObject *x = PyInt_FromLong(a[i]); - if (x == NULL) { - Py_DECREF(l); - return NULL; - } - PyList_SetItem(l, i, x); - } - for (i = 0; i < 256; i++) - a[i] = 0; - return l; -} - -PyObject * -_Py_GetDXProfile(PyObject *self, PyObject *args) -{ -#ifndef DXPAIRS - return getarray(dxp); -#else - int i; - PyObject *l = PyList_New(257); - if (l == NULL) return NULL; - for (i = 0; i < 257; i++) { - PyObject *x = getarray(dxpairs[i]); - if (x == NULL) { - Py_DECREF(l); - return NULL; - } - PyList_SetItem(l, i, x); - } - return l; -#endif -} - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/codecs.c b/AppPkg/Applications/Python/Python-2.7.10/Python/codecs.c deleted file mode 100644 index 8de5129..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/codecs.c +++ /dev/null @@ -1,889 +0,0 @@ -/* ------------------------------------------------------------------------ - - Python Codec Registry and support functions - -Written by Marc-Andre Lemburg (mal@lemburg.com). - -Copyright (c) Corporation for National Research Initiatives. - - ------------------------------------------------------------------------ */ - -#include "Python.h" -#include - -/* --- Codec Registry ----------------------------------------------------- */ - -/* Import the standard encodings package which will register the first - codec search function. - - This is done in a lazy way so that the Unicode implementation does - not downgrade startup time of scripts not needing it. - - ImportErrors are silently ignored by this function. Only one try is - made. - -*/ - -static int _PyCodecRegistry_Init(void); /* Forward */ - -int PyCodec_Register(PyObject *search_function) -{ - PyInterpreterState *interp = PyThreadState_GET()->interp; - if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) - goto onError; - if (search_function == NULL) { - PyErr_BadArgument(); - goto onError; - } - if (!PyCallable_Check(search_function)) { - PyErr_SetString(PyExc_TypeError, "argument must be callable"); - goto onError; - } - return PyList_Append(interp->codec_search_path, search_function); - - onError: - return -1; -} - -/* Convert a string to a normalized Python string: all characters are - converted to lower case, spaces are replaced with underscores. */ - -static -PyObject *normalizestring(const char *string) -{ - register size_t i; - size_t len = strlen(string); - char *p; - PyObject *v; - - if (len > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, "string is too large"); - return NULL; - } - - v = PyString_FromStringAndSize(NULL, len); - if (v == NULL) - return NULL; - p = PyString_AS_STRING(v); - for (i = 0; i < len; i++) { - register char ch = string[i]; - if (ch == ' ') - ch = '-'; - else - ch = Py_TOLOWER(Py_CHARMASK(ch)); - p[i] = ch; - } - return v; -} - -/* Lookup the given encoding and return a tuple providing the codec - facilities. - - The encoding string is looked up converted to all lower-case - characters. This makes encodings looked up through this mechanism - effectively case-insensitive. - - If no codec is found, a LookupError is set and NULL returned. - - As side effect, this tries to load the encodings package, if not - yet done. This is part of the lazy load strategy for the encodings - package. - -*/ - -PyObject *_PyCodec_Lookup(const char *encoding) -{ - PyInterpreterState *interp; - PyObject *result, *args = NULL, *v; - Py_ssize_t i, len; - - if (encoding == NULL) { - PyErr_BadArgument(); - goto onError; - } - - interp = PyThreadState_GET()->interp; - if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) - goto onError; - - /* Convert the encoding to a normalized Python string: all - characters are converted to lower case, spaces and hyphens are - replaced with underscores. */ - v = normalizestring(encoding); - if (v == NULL) - goto onError; - PyString_InternInPlace(&v); - - /* First, try to lookup the name in the registry dictionary */ - result = PyDict_GetItem(interp->codec_search_cache, v); - if (result != NULL) { - Py_INCREF(result); - Py_DECREF(v); - return result; - } - - /* Next, scan the search functions in order of registration */ - args = PyTuple_New(1); - if (args == NULL) - goto onError; - PyTuple_SET_ITEM(args,0,v); - - len = PyList_Size(interp->codec_search_path); - if (len < 0) - goto onError; - if (len == 0) { - PyErr_SetString(PyExc_LookupError, - "no codec search functions registered: " - "can't find encoding"); - goto onError; - } - - for (i = 0; i < len; i++) { - PyObject *func; - - func = PyList_GetItem(interp->codec_search_path, i); - if (func == NULL) - goto onError; - result = PyEval_CallObject(func, args); - if (result == NULL) - goto onError; - if (result == Py_None) { - Py_DECREF(result); - continue; - } - if (!PyTuple_Check(result) || PyTuple_GET_SIZE(result) != 4) { - PyErr_SetString(PyExc_TypeError, - "codec search functions must return 4-tuples"); - Py_DECREF(result); - goto onError; - } - break; - } - if (i == len) { - /* XXX Perhaps we should cache misses too ? */ - PyErr_Format(PyExc_LookupError, - "unknown encoding: %s", encoding); - goto onError; - } - - /* Cache and return the result */ - PyDict_SetItem(interp->codec_search_cache, v, result); - Py_DECREF(args); - return result; - - onError: - Py_XDECREF(args); - return NULL; -} - -static -PyObject *args_tuple(PyObject *object, - const char *errors) -{ - PyObject *args; - - args = PyTuple_New(1 + (errors != NULL)); - if (args == NULL) - return NULL; - Py_INCREF(object); - PyTuple_SET_ITEM(args,0,object); - if (errors) { - PyObject *v; - - v = PyString_FromString(errors); - if (v == NULL) { - Py_DECREF(args); - return NULL; - } - PyTuple_SET_ITEM(args, 1, v); - } - return args; -} - -/* Helper function to get a codec item */ - -static -PyObject *codec_getitem(const char *encoding, int index) -{ - PyObject *codecs; - PyObject *v; - - codecs = _PyCodec_Lookup(encoding); - if (codecs == NULL) - return NULL; - v = PyTuple_GET_ITEM(codecs, index); - Py_DECREF(codecs); - Py_INCREF(v); - return v; -} - -/* Helper function to create an incremental codec. */ - -static -PyObject *codec_getincrementalcodec(const char *encoding, - const char *errors, - const char *attrname) -{ - PyObject *codecs, *ret, *inccodec; - - codecs = _PyCodec_Lookup(encoding); - if (codecs == NULL) - return NULL; - inccodec = PyObject_GetAttrString(codecs, attrname); - Py_DECREF(codecs); - if (inccodec == NULL) - return NULL; - if (errors) - ret = PyObject_CallFunction(inccodec, "s", errors); - else - ret = PyObject_CallFunction(inccodec, NULL); - Py_DECREF(inccodec); - return ret; -} - -/* Helper function to create a stream codec. */ - -static -PyObject *codec_getstreamcodec(const char *encoding, - PyObject *stream, - const char *errors, - const int index) -{ - PyObject *codecs, *streamcodec, *codeccls; - - codecs = _PyCodec_Lookup(encoding); - if (codecs == NULL) - return NULL; - - codeccls = PyTuple_GET_ITEM(codecs, index); - if (errors != NULL) - streamcodec = PyObject_CallFunction(codeccls, "Os", stream, errors); - else - streamcodec = PyObject_CallFunction(codeccls, "O", stream); - Py_DECREF(codecs); - return streamcodec; -} - -/* Convenience APIs to query the Codec registry. - - All APIs return a codec object with incremented refcount. - - */ - -PyObject *PyCodec_Encoder(const char *encoding) -{ - return codec_getitem(encoding, 0); -} - -PyObject *PyCodec_Decoder(const char *encoding) -{ - return codec_getitem(encoding, 1); -} - -PyObject *PyCodec_IncrementalEncoder(const char *encoding, - const char *errors) -{ - return codec_getincrementalcodec(encoding, errors, "incrementalencoder"); -} - -PyObject *PyCodec_IncrementalDecoder(const char *encoding, - const char *errors) -{ - return codec_getincrementalcodec(encoding, errors, "incrementaldecoder"); -} - -PyObject *PyCodec_StreamReader(const char *encoding, - PyObject *stream, - const char *errors) -{ - return codec_getstreamcodec(encoding, stream, errors, 2); -} - -PyObject *PyCodec_StreamWriter(const char *encoding, - PyObject *stream, - const char *errors) -{ - return codec_getstreamcodec(encoding, stream, errors, 3); -} - -/* Encode an object (e.g. an Unicode object) using the given encoding - and return the resulting encoded object (usually a Python string). - - errors is passed to the encoder factory as argument if non-NULL. */ - -PyObject *PyCodec_Encode(PyObject *object, - const char *encoding, - const char *errors) -{ - PyObject *encoder = NULL; - PyObject *args = NULL, *result = NULL; - PyObject *v; - - encoder = PyCodec_Encoder(encoding); - if (encoder == NULL) - goto onError; - - args = args_tuple(object, errors); - if (args == NULL) - goto onError; - - result = PyEval_CallObject(encoder,args); - if (result == NULL) - goto onError; - - if (!PyTuple_Check(result) || - PyTuple_GET_SIZE(result) != 2) { - PyErr_SetString(PyExc_TypeError, - "encoder must return a tuple (object,integer)"); - goto onError; - } - v = PyTuple_GET_ITEM(result,0); - Py_INCREF(v); - /* We don't check or use the second (integer) entry. */ - - Py_DECREF(args); - Py_DECREF(encoder); - Py_DECREF(result); - return v; - - onError: - Py_XDECREF(result); - Py_XDECREF(args); - Py_XDECREF(encoder); - return NULL; -} - -/* Decode an object (usually a Python string) using the given encoding - and return an equivalent object (e.g. an Unicode object). - - errors is passed to the decoder factory as argument if non-NULL. */ - -PyObject *PyCodec_Decode(PyObject *object, - const char *encoding, - const char *errors) -{ - PyObject *decoder = NULL; - PyObject *args = NULL, *result = NULL; - PyObject *v; - - decoder = PyCodec_Decoder(encoding); - if (decoder == NULL) - goto onError; - - args = args_tuple(object, errors); - if (args == NULL) - goto onError; - - result = PyEval_CallObject(decoder,args); - if (result == NULL) - goto onError; - if (!PyTuple_Check(result) || - PyTuple_GET_SIZE(result) != 2) { - PyErr_SetString(PyExc_TypeError, - "decoder must return a tuple (object,integer)"); - goto onError; - } - v = PyTuple_GET_ITEM(result,0); - Py_INCREF(v); - /* We don't check or use the second (integer) entry. */ - - Py_DECREF(args); - Py_DECREF(decoder); - Py_DECREF(result); - return v; - - onError: - Py_XDECREF(args); - Py_XDECREF(decoder); - Py_XDECREF(result); - return NULL; -} - -/* Register the error handling callback function error under the name - name. This function will be called by the codec when it encounters - an unencodable characters/undecodable bytes and doesn't know the - callback name, when name is specified as the error parameter - in the call to the encode/decode function. - Return 0 on success, -1 on error */ -int PyCodec_RegisterError(const char *name, PyObject *error) -{ - PyInterpreterState *interp = PyThreadState_GET()->interp; - if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) - return -1; - if (!PyCallable_Check(error)) { - PyErr_SetString(PyExc_TypeError, "handler must be callable"); - return -1; - } - return PyDict_SetItemString(interp->codec_error_registry, - (char *)name, error); -} - -/* Lookup the error handling callback function registered under the - name error. As a special case NULL can be passed, in which case - the error handling callback for strict encoding will be returned. */ -PyObject *PyCodec_LookupError(const char *name) -{ - PyObject *handler = NULL; - - PyInterpreterState *interp = PyThreadState_GET()->interp; - if (interp->codec_search_path == NULL && _PyCodecRegistry_Init()) - return NULL; - - if (name==NULL) - name = "strict"; - handler = PyDict_GetItemString(interp->codec_error_registry, (char *)name); - if (!handler) - PyErr_Format(PyExc_LookupError, "unknown error handler name '%.400s'", name); - else - Py_INCREF(handler); - return handler; -} - -static void wrong_exception_type(PyObject *exc) -{ - PyObject *type = PyObject_GetAttrString(exc, "__class__"); - if (type != NULL) { - PyObject *name = PyObject_GetAttrString(type, "__name__"); - Py_DECREF(type); - if (name != NULL) { - PyObject *string = PyObject_Str(name); - Py_DECREF(name); - if (string != NULL) { - PyErr_Format(PyExc_TypeError, - "don't know how to handle %.400s in error callback", - PyString_AS_STRING(string)); - Py_DECREF(string); - } - } - } -} - -PyObject *PyCodec_StrictErrors(PyObject *exc) -{ - if (PyExceptionInstance_Check(exc)) - PyErr_SetObject(PyExceptionInstance_Class(exc), exc); - else - PyErr_SetString(PyExc_TypeError, "codec must pass exception instance"); - return NULL; -} - - -#ifdef Py_USING_UNICODE -PyObject *PyCodec_IgnoreErrors(PyObject *exc) -{ - Py_ssize_t end; - if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { - if (PyUnicodeEncodeError_GetEnd(exc, &end)) - return NULL; - } - else if (PyObject_IsInstance(exc, PyExc_UnicodeDecodeError)) { - if (PyUnicodeDecodeError_GetEnd(exc, &end)) - return NULL; - } - else if (PyObject_IsInstance(exc, PyExc_UnicodeTranslateError)) { - if (PyUnicodeTranslateError_GetEnd(exc, &end)) - return NULL; - } - else { - wrong_exception_type(exc); - return NULL; - } - /* ouch: passing NULL, 0, pos gives None instead of u'' */ - return Py_BuildValue("(u#n)", &end, 0, end); -} - - -PyObject *PyCodec_ReplaceErrors(PyObject *exc) -{ - PyObject *restuple; - Py_ssize_t start; - Py_ssize_t end; - Py_ssize_t i; - - if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { - PyObject *res; - Py_UNICODE *p; - if (PyUnicodeEncodeError_GetStart(exc, &start)) - return NULL; - if (PyUnicodeEncodeError_GetEnd(exc, &end)) - return NULL; - res = PyUnicode_FromUnicode(NULL, end-start); - if (res == NULL) - return NULL; - for (p = PyUnicode_AS_UNICODE(res), i = start; - i PY_SSIZE_T_MAX / (2+7+1)) { - end = start + PY_SSIZE_T_MAX / (2+7+1); -#ifndef Py_UNICODE_WIDE - if (0xD800 <= startp[end - 1] && startp[end - 1] <= 0xDBFF) - end--; -#endif - } - e = startp + end; - for (p = startp+start, ressize = 0; p < e;) { - Py_UCS4 ch = *p++; -#ifndef Py_UNICODE_WIDE - if ((0xD800 <= ch && ch <= 0xDBFF) && - (p < e) && - (0xDC00 <= *p && *p <= 0xDFFF)) { - ch = ((((ch & 0x03FF) << 10) | - ((Py_UCS4)*p++ & 0x03FF)) + 0x10000); - } -#endif - if (ch < 10) - ressize += 2+1+1; - else if (ch < 100) - ressize += 2+2+1; - else if (ch < 1000) - ressize += 2+3+1; - else if (ch < 10000) - ressize += 2+4+1; - else if (ch < 100000) - ressize += 2+5+1; - else if (ch < 1000000) - ressize += 2+6+1; - else - ressize += 2+7+1; - } - /* allocate replacement */ - res = PyUnicode_FromUnicode(NULL, ressize); - if (res == NULL) { - Py_DECREF(object); - return NULL; - } - /* generate replacement */ - for (p = startp+start, outp = PyUnicode_AS_UNICODE(res); p < e;) { - int digits; - int base; - Py_UCS4 ch = *p++; -#ifndef Py_UNICODE_WIDE - if ((0xD800 <= ch && ch <= 0xDBFF) && - (p < startp+end) && - (0xDC00 <= *p && *p <= 0xDFFF)) { - ch = ((((ch & 0x03FF) << 10) | - ((Py_UCS4)*p++ & 0x03FF)) + 0x10000); - } -#endif - *outp++ = '&'; - *outp++ = '#'; - if (ch < 10) { - digits = 1; - base = 1; - } - else if (ch < 100) { - digits = 2; - base = 10; - } - else if (ch < 1000) { - digits = 3; - base = 100; - } - else if (ch < 10000) { - digits = 4; - base = 1000; - } - else if (ch < 100000) { - digits = 5; - base = 10000; - } - else if (ch < 1000000) { - digits = 6; - base = 100000; - } - else { - digits = 7; - base = 1000000; - } - while (digits-->0) { - *outp++ = '0' + ch/base; - ch %= base; - base /= 10; - } - *outp++ = ';'; - } - restuple = Py_BuildValue("(On)", res, end); - Py_DECREF(res); - Py_DECREF(object); - return restuple; - } - else { - wrong_exception_type(exc); - return NULL; - } -} - -static Py_UNICODE hexdigits[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' -}; - -PyObject *PyCodec_BackslashReplaceErrors(PyObject *exc) -{ - if (PyObject_IsInstance(exc, PyExc_UnicodeEncodeError)) { - PyObject *restuple; - PyObject *object; - Py_ssize_t start; - Py_ssize_t end; - PyObject *res; - Py_UNICODE *p; - Py_UNICODE *startp; - Py_UNICODE *outp; - Py_ssize_t ressize; - if (PyUnicodeEncodeError_GetStart(exc, &start)) - return NULL; - if (PyUnicodeEncodeError_GetEnd(exc, &end)) - return NULL; - if (!(object = PyUnicodeEncodeError_GetObject(exc))) - return NULL; - if (end - start > PY_SSIZE_T_MAX / (1+1+8)) - end = start + PY_SSIZE_T_MAX / (1+1+8); - startp = PyUnicode_AS_UNICODE(object); - for (p = startp+start, ressize = 0; p < startp+end; ++p) { -#ifdef Py_UNICODE_WIDE - if (*p >= 0x00010000) - ressize += 1+1+8; - else -#endif - if (*p >= 0x100) { - ressize += 1+1+4; - } - else - ressize += 1+1+2; - } - res = PyUnicode_FromUnicode(NULL, ressize); - if (res == NULL) { - Py_DECREF(object); - return NULL; - } - for (p = startp+start, outp = PyUnicode_AS_UNICODE(res); - p < startp+end; ++p) { - Py_UNICODE c = *p; - *outp++ = '\\'; -#ifdef Py_UNICODE_WIDE - if (c >= 0x00010000) { - *outp++ = 'U'; - *outp++ = hexdigits[(c>>28)&0xf]; - *outp++ = hexdigits[(c>>24)&0xf]; - *outp++ = hexdigits[(c>>20)&0xf]; - *outp++ = hexdigits[(c>>16)&0xf]; - *outp++ = hexdigits[(c>>12)&0xf]; - *outp++ = hexdigits[(c>>8)&0xf]; - } - else -#endif - if (c >= 0x100) { - *outp++ = 'u'; - *outp++ = hexdigits[(c>>12)&0xf]; - *outp++ = hexdigits[(c>>8)&0xf]; - } - else - *outp++ = 'x'; - *outp++ = hexdigits[(c>>4)&0xf]; - *outp++ = hexdigits[c&0xf]; - } - - restuple = Py_BuildValue("(On)", res, end); - Py_DECREF(res); - Py_DECREF(object); - return restuple; - } - else { - wrong_exception_type(exc); - return NULL; - } -} -#endif - -static PyObject *strict_errors(PyObject *self, PyObject *exc) -{ - return PyCodec_StrictErrors(exc); -} - - -#ifdef Py_USING_UNICODE -static PyObject *ignore_errors(PyObject *self, PyObject *exc) -{ - return PyCodec_IgnoreErrors(exc); -} - - -static PyObject *replace_errors(PyObject *self, PyObject *exc) -{ - return PyCodec_ReplaceErrors(exc); -} - - -static PyObject *xmlcharrefreplace_errors(PyObject *self, PyObject *exc) -{ - return PyCodec_XMLCharRefReplaceErrors(exc); -} - - -static PyObject *backslashreplace_errors(PyObject *self, PyObject *exc) -{ - return PyCodec_BackslashReplaceErrors(exc); -} -#endif - -static int _PyCodecRegistry_Init(void) -{ - static struct { - char *name; - PyMethodDef def; - } methods[] = - { - { - "strict", - { - "strict_errors", - strict_errors, - METH_O, - PyDoc_STR("Implements the 'strict' error handling, which " - "raises a UnicodeError on coding errors.") - } - }, -#ifdef Py_USING_UNICODE - { - "ignore", - { - "ignore_errors", - ignore_errors, - METH_O, - PyDoc_STR("Implements the 'ignore' error handling, which " - "ignores malformed data and continues.") - } - }, - { - "replace", - { - "replace_errors", - replace_errors, - METH_O, - PyDoc_STR("Implements the 'replace' error handling, which " - "replaces malformed data with a replacement marker.") - } - }, - { - "xmlcharrefreplace", - { - "xmlcharrefreplace_errors", - xmlcharrefreplace_errors, - METH_O, - PyDoc_STR("Implements the 'xmlcharrefreplace' error handling, " - "which replaces an unencodable character with the " - "appropriate XML character reference.") - } - }, - { - "backslashreplace", - { - "backslashreplace_errors", - backslashreplace_errors, - METH_O, - PyDoc_STR("Implements the 'backslashreplace' error handling, " - "which replaces an unencodable character with a " - "backslashed escape sequence.") - } - } -#endif - }; - - PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *mod; - unsigned i; - - if (interp->codec_search_path != NULL) - return 0; - - interp->codec_search_path = PyList_New(0); - interp->codec_search_cache = PyDict_New(); - interp->codec_error_registry = PyDict_New(); - - if (interp->codec_error_registry) { - for (i = 0; i < sizeof(methods)/sizeof(methods[0]); ++i) { - PyObject *func = PyCFunction_New(&methods[i].def, NULL); - int res; - if (!func) - Py_FatalError("can't initialize codec error registry"); - res = PyCodec_RegisterError(methods[i].name, func); - Py_DECREF(func); - if (res) - Py_FatalError("can't initialize codec error registry"); - } - } - - if (interp->codec_search_path == NULL || - interp->codec_search_cache == NULL || - interp->codec_error_registry == NULL) - Py_FatalError("can't initialize codec registry"); - - mod = PyImport_ImportModuleLevel("encodings", NULL, NULL, NULL, 0); - if (mod == NULL) { - if (PyErr_ExceptionMatches(PyExc_ImportError)) { - /* Ignore ImportErrors... this is done so that - distributions can disable the encodings package. Note - that other errors are not masked, e.g. SystemErrors - raised to inform the user of an error in the Python - configuration are still reported back to the user. */ - PyErr_Clear(); - return 0; - } - return -1; - } - Py_DECREF(mod); - return 0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/compile.c b/AppPkg/Applications/Python/Python-2.7.10/Python/compile.c deleted file mode 100644 index 205f044..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/compile.c +++ /dev/null @@ -1,4003 +0,0 @@ -/* - * This file compiles an abstract syntax tree (AST) into Python bytecode. - * - * The primary entry point is PyAST_Compile(), which returns a - * PyCodeObject. The compiler makes several passes to build the code - * object: - * 1. Checks for future statements. See future.c - * 2. Builds a symbol table. See symtable.c. - * 3. Generate code for basic blocks. See compiler_mod() in this file. - * 4. Assemble the basic blocks into final code. See assemble() in - * this file. - * 5. Optimize the byte code (peephole optimizations). See peephole.c - * - * Note that compiler_mod() suggests module, but the module ast type - * (mod_ty) has cases for expressions and interactive statements. - * - * CAUTION: The VISIT_* macros abort the current function when they - * encounter a problem. So don't invoke them when there is memory - * which needs to be released. Code blocks are OK, as the compiler - * structure takes care of releasing those. Use the arena to manage - * objects. - */ - -#include "Python.h" - -#include "Python-ast.h" -#include "node.h" -#include "pyarena.h" -#include "ast.h" -#include "code.h" -#include "compile.h" -#include "symtable.h" -#include "opcode.h" - -int Py_OptimizeFlag = 0; - -#define DEFAULT_BLOCK_SIZE 16 -#define DEFAULT_BLOCKS 8 -#define DEFAULT_CODE_SIZE 128 -#define DEFAULT_LNOTAB_SIZE 16 - -#define COMP_GENEXP 0 -#define COMP_SETCOMP 1 -#define COMP_DICTCOMP 2 - -struct instr { - unsigned i_jabs : 1; - unsigned i_jrel : 1; - unsigned i_hasarg : 1; - unsigned char i_opcode; - int i_oparg; - struct basicblock_ *i_target; /* target block (if jump instruction) */ - int i_lineno; -}; - -typedef struct basicblock_ { - /* Each basicblock in a compilation unit is linked via b_list in the - reverse order that the block are allocated. b_list points to the next - block, not to be confused with b_next, which is next by control flow. */ - struct basicblock_ *b_list; - /* number of instructions used */ - int b_iused; - /* length of instruction array (b_instr) */ - int b_ialloc; - /* pointer to an array of instructions, initially NULL */ - struct instr *b_instr; - /* If b_next is non-NULL, it is a pointer to the next - block reached by normal control flow. */ - struct basicblock_ *b_next; - /* b_seen is used to perform a DFS of basicblocks. */ - unsigned b_seen : 1; - /* b_return is true if a RETURN_VALUE opcode is inserted. */ - unsigned b_return : 1; - /* depth of stack upon entry of block, computed by stackdepth() */ - int b_startdepth; - /* instruction offset for block, computed by assemble_jump_offsets() */ - int b_offset; -} basicblock; - -/* fblockinfo tracks the current frame block. - -A frame block is used to handle loops, try/except, and try/finally. -It's called a frame block to distinguish it from a basic block in the -compiler IR. -*/ - -enum fblocktype { LOOP, EXCEPT, FINALLY_TRY, FINALLY_END }; - -struct fblockinfo { - enum fblocktype fb_type; - basicblock *fb_block; -}; - -/* The following items change on entry and exit of code blocks. - They must be saved and restored when returning to a block. -*/ -struct compiler_unit { - PySTEntryObject *u_ste; - - PyObject *u_name; - /* The following fields are dicts that map objects to - the index of them in co_XXX. The index is used as - the argument for opcodes that refer to those collections. - */ - PyObject *u_consts; /* all constants */ - PyObject *u_names; /* all names */ - PyObject *u_varnames; /* local variables */ - PyObject *u_cellvars; /* cell variables */ - PyObject *u_freevars; /* free variables */ - - PyObject *u_private; /* for private name mangling */ - - int u_argcount; /* number of arguments for block */ - /* Pointer to the most recently allocated block. By following b_list - members, you can reach all early allocated blocks. */ - basicblock *u_blocks; - basicblock *u_curblock; /* pointer to current block */ - - int u_nfblocks; - struct fblockinfo u_fblock[CO_MAXBLOCKS]; - - int u_firstlineno; /* the first lineno of the block */ - int u_lineno; /* the lineno for the current stmt */ - bool u_lineno_set; /* boolean to indicate whether instr - has been generated with current lineno */ -}; - -/* This struct captures the global state of a compilation. - -The u pointer points to the current compilation unit, while units -for enclosing blocks are stored in c_stack. The u and c_stack are -managed by compiler_enter_scope() and compiler_exit_scope(). -*/ - -struct compiler { - const char *c_filename; - struct symtable *c_st; - PyFutureFeatures *c_future; /* pointer to module's __future__ */ - PyCompilerFlags *c_flags; - - int c_interactive; /* true if in interactive mode */ - int c_nestlevel; - - struct compiler_unit *u; /* compiler state for current block */ - PyObject *c_stack; /* Python list holding compiler_unit ptrs */ - PyArena *c_arena; /* pointer to memory allocation arena */ -}; - -static int compiler_enter_scope(struct compiler *, identifier, void *, int); -static void compiler_free(struct compiler *); -static basicblock *compiler_new_block(struct compiler *); -static int compiler_next_instr(struct compiler *, basicblock *); -static int compiler_addop(struct compiler *, int); -static int compiler_addop_o(struct compiler *, int, PyObject *, PyObject *); -static int compiler_addop_i(struct compiler *, int, int); -static int compiler_addop_j(struct compiler *, int, basicblock *, int); -static basicblock *compiler_use_new_block(struct compiler *); -static int compiler_error(struct compiler *, const char *); -static int compiler_nameop(struct compiler *, identifier, expr_context_ty); - -static PyCodeObject *compiler_mod(struct compiler *, mod_ty); -static int compiler_visit_stmt(struct compiler *, stmt_ty); -static int compiler_visit_keyword(struct compiler *, keyword_ty); -static int compiler_visit_expr(struct compiler *, expr_ty); -static int compiler_augassign(struct compiler *, stmt_ty); -static int compiler_visit_slice(struct compiler *, slice_ty, - expr_context_ty); - -static int compiler_push_fblock(struct compiler *, enum fblocktype, - basicblock *); -static void compiler_pop_fblock(struct compiler *, enum fblocktype, - basicblock *); -/* Returns true if there is a loop on the fblock stack. */ -static int compiler_in_loop(struct compiler *); - -static int inplace_binop(struct compiler *, operator_ty); -static int expr_constant(expr_ty e); - -static int compiler_with(struct compiler *, stmt_ty); - -static PyCodeObject *assemble(struct compiler *, int addNone); -static PyObject *__doc__; - -#define COMPILER_CAPSULE_NAME_COMPILER_UNIT "compile.c compiler unit" - -PyObject * -_Py_Mangle(PyObject *privateobj, PyObject *ident) -{ - /* Name mangling: __private becomes _classname__private. - This is independent from how the name is used. */ - const char *p, *name = PyString_AsString(ident); - char *buffer; - size_t nlen, plen; - if (privateobj == NULL || !PyString_Check(privateobj) || - name == NULL || name[0] != '_' || name[1] != '_') { - Py_INCREF(ident); - return ident; - } - p = PyString_AsString(privateobj); - nlen = strlen(name); - /* Don't mangle __id__ or names with dots. - - The only time a name with a dot can occur is when - we are compiling an import statement that has a - package name. - - TODO(jhylton): Decide whether we want to support - mangling of the module name, e.g. __M.X. - */ - if ((name[nlen-1] == '_' && name[nlen-2] == '_') - || strchr(name, '.')) { - Py_INCREF(ident); - return ident; /* Don't mangle __whatever__ */ - } - /* Strip leading underscores from class name */ - while (*p == '_') - p++; - if (*p == '\0') { - Py_INCREF(ident); - return ident; /* Don't mangle if class is just underscores */ - } - plen = strlen(p); - - if (plen + nlen >= PY_SSIZE_T_MAX - 1) { - PyErr_SetString(PyExc_OverflowError, - "private identifier too large to be mangled"); - return NULL; - } - - ident = PyString_FromStringAndSize(NULL, 1 + nlen + plen); - if (!ident) - return 0; - /* ident = "_" + p[:plen] + name # i.e. 1+plen+nlen bytes */ - buffer = PyString_AS_STRING(ident); - buffer[0] = '_'; - strncpy(buffer+1, p, plen); - strcpy(buffer+1+plen, name); - return ident; -} - -static int -compiler_init(struct compiler *c) -{ - memset(c, 0, sizeof(struct compiler)); - - c->c_stack = PyList_New(0); - if (!c->c_stack) - return 0; - - return 1; -} - -PyCodeObject * -PyAST_Compile(mod_ty mod, const char *filename, PyCompilerFlags *flags, - PyArena *arena) -{ - struct compiler c; - PyCodeObject *co = NULL; - PyCompilerFlags local_flags; - int merged; - - if (!__doc__) { - __doc__ = PyString_InternFromString("__doc__"); - if (!__doc__) - return NULL; - } - - if (!compiler_init(&c)) - return NULL; - c.c_filename = filename; - c.c_arena = arena; - c.c_future = PyFuture_FromAST(mod, filename); - if (c.c_future == NULL) - goto finally; - if (!flags) { - local_flags.cf_flags = 0; - flags = &local_flags; - } - merged = c.c_future->ff_features | flags->cf_flags; - c.c_future->ff_features = merged; - flags->cf_flags = merged; - c.c_flags = flags; - c.c_nestlevel = 0; - - c.c_st = PySymtable_Build(mod, filename, c.c_future); - if (c.c_st == NULL) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_SystemError, "no symtable"); - goto finally; - } - - co = compiler_mod(&c, mod); - - finally: - compiler_free(&c); - assert(co || PyErr_Occurred()); - return co; -} - -PyCodeObject * -PyNode_Compile(struct _node *n, const char *filename) -{ - PyCodeObject *co = NULL; - mod_ty mod; - PyArena *arena = PyArena_New(); - if (!arena) - return NULL; - mod = PyAST_FromNode(n, NULL, filename, arena); - if (mod) - co = PyAST_Compile(mod, filename, NULL, arena); - PyArena_Free(arena); - return co; -} - -static void -compiler_free(struct compiler *c) -{ - if (c->c_st) - PySymtable_Free(c->c_st); - if (c->c_future) - PyObject_Free(c->c_future); - Py_DECREF(c->c_stack); -} - -static PyObject * -list2dict(PyObject *list) -{ - Py_ssize_t i, n; - PyObject *v, *k; - PyObject *dict = PyDict_New(); - if (!dict) return NULL; - - n = PyList_Size(list); - for (i = 0; i < n; i++) { - v = PyInt_FromLong(i); - if (!v) { - Py_DECREF(dict); - return NULL; - } - k = PyList_GET_ITEM(list, i); - k = PyTuple_Pack(2, k, k->ob_type); - if (k == NULL || PyDict_SetItem(dict, k, v) < 0) { - Py_XDECREF(k); - Py_DECREF(v); - Py_DECREF(dict); - return NULL; - } - Py_DECREF(k); - Py_DECREF(v); - } - return dict; -} - -/* Return new dict containing names from src that match scope(s). - -src is a symbol table dictionary. If the scope of a name matches -either scope_type or flag is set, insert it into the new dict. The -values are integers, starting at offset and increasing by one for -each key. -*/ - -static PyObject * -dictbytype(PyObject *src, int scope_type, int flag, int offset) -{ - Py_ssize_t i = offset, scope, num_keys, key_i; - PyObject *k, *v, *dest = PyDict_New(); - PyObject *sorted_keys; - - assert(offset >= 0); - if (dest == NULL) - return NULL; - - /* Sort the keys so that we have a deterministic order on the indexes - saved in the returned dictionary. These indexes are used as indexes - into the free and cell var storage. Therefore if they aren't - deterministic, then the generated bytecode is not deterministic. - */ - sorted_keys = PyDict_Keys(src); - if (sorted_keys == NULL) - return NULL; - if (PyList_Sort(sorted_keys) != 0) { - Py_DECREF(sorted_keys); - return NULL; - } - num_keys = PyList_GET_SIZE(sorted_keys); - - for (key_i = 0; key_i < num_keys; key_i++) { - k = PyList_GET_ITEM(sorted_keys, key_i); - v = PyDict_GetItem(src, k); - /* XXX this should probably be a macro in symtable.h */ - assert(PyInt_Check(v)); - scope = (PyInt_AS_LONG(v) >> SCOPE_OFF) & SCOPE_MASK; - - if (scope == scope_type || PyInt_AS_LONG(v) & flag) { - PyObject *tuple, *item = PyInt_FromLong(i); - if (item == NULL) { - Py_DECREF(sorted_keys); - Py_DECREF(dest); - return NULL; - } - i++; - tuple = PyTuple_Pack(2, k, k->ob_type); - if (!tuple || PyDict_SetItem(dest, tuple, item) < 0) { - Py_DECREF(sorted_keys); - Py_DECREF(item); - Py_DECREF(dest); - Py_XDECREF(tuple); - return NULL; - } - Py_DECREF(item); - Py_DECREF(tuple); - } - } - Py_DECREF(sorted_keys); - return dest; -} - -static void -compiler_unit_check(struct compiler_unit *u) -{ - basicblock *block; - for (block = u->u_blocks; block != NULL; block = block->b_list) { - assert((void *)block != (void *)0xcbcbcbcb); - assert((void *)block != (void *)0xfbfbfbfb); - assert((void *)block != (void *)0xdbdbdbdb); - if (block->b_instr != NULL) { - assert(block->b_ialloc > 0); - assert(block->b_iused > 0); - assert(block->b_ialloc >= block->b_iused); - } - else { - assert (block->b_iused == 0); - assert (block->b_ialloc == 0); - } - } -} - -static void -compiler_unit_free(struct compiler_unit *u) -{ - basicblock *b, *next; - - compiler_unit_check(u); - b = u->u_blocks; - while (b != NULL) { - if (b->b_instr) - PyObject_Free((void *)b->b_instr); - next = b->b_list; - PyObject_Free((void *)b); - b = next; - } - Py_CLEAR(u->u_ste); - Py_CLEAR(u->u_name); - Py_CLEAR(u->u_consts); - Py_CLEAR(u->u_names); - Py_CLEAR(u->u_varnames); - Py_CLEAR(u->u_freevars); - Py_CLEAR(u->u_cellvars); - Py_CLEAR(u->u_private); - PyObject_Free(u); -} - -static int -compiler_enter_scope(struct compiler *c, identifier name, void *key, - int lineno) -{ - struct compiler_unit *u; - - u = (struct compiler_unit *)PyObject_Malloc(sizeof( - struct compiler_unit)); - if (!u) { - PyErr_NoMemory(); - return 0; - } - memset(u, 0, sizeof(struct compiler_unit)); - u->u_argcount = 0; - u->u_ste = PySymtable_Lookup(c->c_st, key); - if (!u->u_ste) { - compiler_unit_free(u); - return 0; - } - Py_INCREF(name); - u->u_name = name; - u->u_varnames = list2dict(u->u_ste->ste_varnames); - u->u_cellvars = dictbytype(u->u_ste->ste_symbols, CELL, 0, 0); - if (!u->u_varnames || !u->u_cellvars) { - compiler_unit_free(u); - return 0; - } - - u->u_freevars = dictbytype(u->u_ste->ste_symbols, FREE, DEF_FREE_CLASS, - PyDict_Size(u->u_cellvars)); - if (!u->u_freevars) { - compiler_unit_free(u); - return 0; - } - - u->u_blocks = NULL; - u->u_nfblocks = 0; - u->u_firstlineno = lineno; - u->u_lineno = 0; - u->u_lineno_set = false; - u->u_consts = PyDict_New(); - if (!u->u_consts) { - compiler_unit_free(u); - return 0; - } - u->u_names = PyDict_New(); - if (!u->u_names) { - compiler_unit_free(u); - return 0; - } - - u->u_private = NULL; - - /* Push the old compiler_unit on the stack. */ - if (c->u) { - PyObject *capsule = PyCapsule_New(c->u, COMPILER_CAPSULE_NAME_COMPILER_UNIT, NULL); - if (!capsule || PyList_Append(c->c_stack, capsule) < 0) { - Py_XDECREF(capsule); - compiler_unit_free(u); - return 0; - } - Py_DECREF(capsule); - u->u_private = c->u->u_private; - Py_XINCREF(u->u_private); - } - c->u = u; - - c->c_nestlevel++; - if (compiler_use_new_block(c) == NULL) - return 0; - - return 1; -} - -static void -compiler_exit_scope(struct compiler *c) -{ - int n; - PyObject *capsule; - - c->c_nestlevel--; - compiler_unit_free(c->u); - /* Restore c->u to the parent unit. */ - n = PyList_GET_SIZE(c->c_stack) - 1; - if (n >= 0) { - capsule = PyList_GET_ITEM(c->c_stack, n); - c->u = (struct compiler_unit *)PyCapsule_GetPointer(capsule, COMPILER_CAPSULE_NAME_COMPILER_UNIT); - assert(c->u); - /* we are deleting from a list so this really shouldn't fail */ - if (PySequence_DelItem(c->c_stack, n) < 0) - Py_FatalError("compiler_exit_scope()"); - compiler_unit_check(c->u); - } - else - c->u = NULL; - -} - -/* Allocate a new block and return a pointer to it. - Returns NULL on error. -*/ - -static basicblock * -compiler_new_block(struct compiler *c) -{ - basicblock *b; - struct compiler_unit *u; - - u = c->u; - b = (basicblock *)PyObject_Malloc(sizeof(basicblock)); - if (b == NULL) { - PyErr_NoMemory(); - return NULL; - } - memset((void *)b, 0, sizeof(basicblock)); - /* Extend the singly linked list of blocks with new block. */ - b->b_list = u->u_blocks; - u->u_blocks = b; - return b; -} - -static basicblock * -compiler_use_new_block(struct compiler *c) -{ - basicblock *block = compiler_new_block(c); - if (block == NULL) - return NULL; - c->u->u_curblock = block; - return block; -} - -static basicblock * -compiler_next_block(struct compiler *c) -{ - basicblock *block = compiler_new_block(c); - if (block == NULL) - return NULL; - c->u->u_curblock->b_next = block; - c->u->u_curblock = block; - return block; -} - -static basicblock * -compiler_use_next_block(struct compiler *c, basicblock *block) -{ - assert(block != NULL); - c->u->u_curblock->b_next = block; - c->u->u_curblock = block; - return block; -} - -/* Returns the offset of the next instruction in the current block's - b_instr array. Resizes the b_instr as necessary. - Returns -1 on failure. -*/ - -static int -compiler_next_instr(struct compiler *c, basicblock *b) -{ - assert(b != NULL); - if (b->b_instr == NULL) { - b->b_instr = (struct instr *)PyObject_Malloc( - sizeof(struct instr) * DEFAULT_BLOCK_SIZE); - if (b->b_instr == NULL) { - PyErr_NoMemory(); - return -1; - } - b->b_ialloc = DEFAULT_BLOCK_SIZE; - memset((char *)b->b_instr, 0, - sizeof(struct instr) * DEFAULT_BLOCK_SIZE); - } - else if (b->b_iused == b->b_ialloc) { - struct instr *tmp; - size_t oldsize, newsize; - oldsize = b->b_ialloc * sizeof(struct instr); - newsize = oldsize << 1; - - if (oldsize > (PY_SIZE_MAX >> 1)) { - PyErr_NoMemory(); - return -1; - } - - if (newsize == 0) { - PyErr_NoMemory(); - return -1; - } - b->b_ialloc <<= 1; - tmp = (struct instr *)PyObject_Realloc( - (void *)b->b_instr, newsize); - if (tmp == NULL) { - PyErr_NoMemory(); - return -1; - } - b->b_instr = tmp; - memset((char *)b->b_instr + oldsize, 0, newsize - oldsize); - } - return b->b_iused++; -} - -/* Set the i_lineno member of the instruction at offset off if the - line number for the current expression/statement has not - already been set. If it has been set, the call has no effect. - - The line number is reset in the following cases: - - when entering a new scope - - on each statement - - on each expression that start a new line - - before the "except" clause - - before the "for" and "while" expressions -*/ - -static void -compiler_set_lineno(struct compiler *c, int off) -{ - basicblock *b; - if (c->u->u_lineno_set) - return; - c->u->u_lineno_set = true; - b = c->u->u_curblock; - b->b_instr[off].i_lineno = c->u->u_lineno; -} - -static int -opcode_stack_effect(int opcode, int oparg) -{ - switch (opcode) { - case POP_TOP: - return -1; - case ROT_TWO: - case ROT_THREE: - return 0; - case DUP_TOP: - return 1; - case ROT_FOUR: - return 0; - - case UNARY_POSITIVE: - case UNARY_NEGATIVE: - case UNARY_NOT: - case UNARY_CONVERT: - case UNARY_INVERT: - return 0; - - case SET_ADD: - case LIST_APPEND: - return -1; - - case MAP_ADD: - return -2; - - case BINARY_POWER: - case BINARY_MULTIPLY: - case BINARY_DIVIDE: - case BINARY_MODULO: - case BINARY_ADD: - case BINARY_SUBTRACT: - case BINARY_SUBSCR: - case BINARY_FLOOR_DIVIDE: - case BINARY_TRUE_DIVIDE: - return -1; - case INPLACE_FLOOR_DIVIDE: - case INPLACE_TRUE_DIVIDE: - return -1; - - case SLICE+0: - return 0; - case SLICE+1: - return -1; - case SLICE+2: - return -1; - case SLICE+3: - return -2; - - case STORE_SLICE+0: - return -2; - case STORE_SLICE+1: - return -3; - case STORE_SLICE+2: - return -3; - case STORE_SLICE+3: - return -4; - - case DELETE_SLICE+0: - return -1; - case DELETE_SLICE+1: - return -2; - case DELETE_SLICE+2: - return -2; - case DELETE_SLICE+3: - return -3; - - case INPLACE_ADD: - case INPLACE_SUBTRACT: - case INPLACE_MULTIPLY: - case INPLACE_DIVIDE: - case INPLACE_MODULO: - return -1; - case STORE_SUBSCR: - return -3; - case STORE_MAP: - return -2; - case DELETE_SUBSCR: - return -2; - - case BINARY_LSHIFT: - case BINARY_RSHIFT: - case BINARY_AND: - case BINARY_XOR: - case BINARY_OR: - return -1; - case INPLACE_POWER: - return -1; - case GET_ITER: - return 0; - - case PRINT_EXPR: - return -1; - case PRINT_ITEM: - return -1; - case PRINT_NEWLINE: - return 0; - case PRINT_ITEM_TO: - return -2; - case PRINT_NEWLINE_TO: - return -1; - case INPLACE_LSHIFT: - case INPLACE_RSHIFT: - case INPLACE_AND: - case INPLACE_XOR: - case INPLACE_OR: - return -1; - case BREAK_LOOP: - return 0; - case SETUP_WITH: - return 4; - case WITH_CLEANUP: - return -1; /* XXX Sometimes more */ - case LOAD_LOCALS: - return 1; - case RETURN_VALUE: - return -1; - case IMPORT_STAR: - return -1; - case EXEC_STMT: - return -3; - case YIELD_VALUE: - return 0; - - case POP_BLOCK: - return 0; - case END_FINALLY: - return -3; /* or -1 or -2 if no exception occurred or - return/break/continue */ - case BUILD_CLASS: - return -2; - - case STORE_NAME: - return -1; - case DELETE_NAME: - return 0; - case UNPACK_SEQUENCE: - return oparg-1; - case FOR_ITER: - return 1; /* or -1, at end of iterator */ - - case STORE_ATTR: - return -2; - case DELETE_ATTR: - return -1; - case STORE_GLOBAL: - return -1; - case DELETE_GLOBAL: - return 0; - case DUP_TOPX: - return oparg; - case LOAD_CONST: - return 1; - case LOAD_NAME: - return 1; - case BUILD_TUPLE: - case BUILD_LIST: - case BUILD_SET: - return 1-oparg; - case BUILD_MAP: - return 1; - case LOAD_ATTR: - return 0; - case COMPARE_OP: - return -1; - case IMPORT_NAME: - return -1; - case IMPORT_FROM: - return 1; - - case JUMP_FORWARD: - case JUMP_IF_TRUE_OR_POP: /* -1 if jump not taken */ - case JUMP_IF_FALSE_OR_POP: /* "" */ - case JUMP_ABSOLUTE: - return 0; - - case POP_JUMP_IF_FALSE: - case POP_JUMP_IF_TRUE: - return -1; - - case LOAD_GLOBAL: - return 1; - - case CONTINUE_LOOP: - return 0; - case SETUP_LOOP: - case SETUP_EXCEPT: - case SETUP_FINALLY: - return 0; - - case LOAD_FAST: - return 1; - case STORE_FAST: - return -1; - case DELETE_FAST: - return 0; - - case RAISE_VARARGS: - return -oparg; -#define NARGS(o) (((o) % 256) + 2*((o) / 256)) - case CALL_FUNCTION: - return -NARGS(oparg); - case CALL_FUNCTION_VAR: - case CALL_FUNCTION_KW: - return -NARGS(oparg)-1; - case CALL_FUNCTION_VAR_KW: - return -NARGS(oparg)-2; -#undef NARGS - case MAKE_FUNCTION: - return -oparg; - case BUILD_SLICE: - if (oparg == 3) - return -2; - else - return -1; - - case MAKE_CLOSURE: - return -oparg-1; - case LOAD_CLOSURE: - return 1; - case LOAD_DEREF: - return 1; - case STORE_DEREF: - return -1; - default: - fprintf(stderr, "opcode = %d\n", opcode); - Py_FatalError("opcode_stack_effect()"); - - } - return 0; /* not reachable */ -} - -/* Add an opcode with no argument. - Returns 0 on failure, 1 on success. -*/ - -static int -compiler_addop(struct compiler *c, int opcode) -{ - basicblock *b; - struct instr *i; - int off; - off = compiler_next_instr(c, c->u->u_curblock); - if (off < 0) - return 0; - b = c->u->u_curblock; - i = &b->b_instr[off]; - i->i_opcode = opcode; - i->i_hasarg = 0; - if (opcode == RETURN_VALUE) - b->b_return = 1; - compiler_set_lineno(c, off); - return 1; -} - -static int -compiler_add_o(struct compiler *c, PyObject *dict, PyObject *o) -{ - PyObject *t, *v; - Py_ssize_t arg; - double d; - - /* necessary to make sure types aren't coerced (e.g., int and long) */ - /* _and_ to distinguish 0.0 from -0.0 e.g. on IEEE platforms */ - if (PyFloat_Check(o)) { - d = PyFloat_AS_DOUBLE(o); - /* all we need is to make the tuple different in either the 0.0 - * or -0.0 case from all others, just to avoid the "coercion". - */ - if (d == 0.0 && copysign(1.0, d) < 0.0) - t = PyTuple_Pack(3, o, o->ob_type, Py_None); - else - t = PyTuple_Pack(2, o, o->ob_type); - } -#ifndef WITHOUT_COMPLEX - else if (PyComplex_Check(o)) { - Py_complex z; - int real_negzero, imag_negzero; - /* For the complex case we must make complex(x, 0.) - different from complex(x, -0.) and complex(0., y) - different from complex(-0., y), for any x and y. - All four complex zeros must be distinguished.*/ - z = PyComplex_AsCComplex(o); - real_negzero = z.real == 0.0 && copysign(1.0, z.real) < 0.0; - imag_negzero = z.imag == 0.0 && copysign(1.0, z.imag) < 0.0; - if (real_negzero && imag_negzero) { - t = PyTuple_Pack(5, o, o->ob_type, - Py_None, Py_None, Py_None); - } - else if (imag_negzero) { - t = PyTuple_Pack(4, o, o->ob_type, Py_None, Py_None); - } - else if (real_negzero) { - t = PyTuple_Pack(3, o, o->ob_type, Py_None); - } - else { - t = PyTuple_Pack(2, o, o->ob_type); - } - } -#endif /* WITHOUT_COMPLEX */ - else { - t = PyTuple_Pack(2, o, o->ob_type); - } - if (t == NULL) - return -1; - - v = PyDict_GetItem(dict, t); - if (!v) { - arg = PyDict_Size(dict); - v = PyInt_FromLong(arg); - if (!v) { - Py_DECREF(t); - return -1; - } - if (PyDict_SetItem(dict, t, v) < 0) { - Py_DECREF(t); - Py_DECREF(v); - return -1; - } - Py_DECREF(v); - } - else - arg = PyInt_AsLong(v); - Py_DECREF(t); - return arg; -} - -static int -compiler_addop_o(struct compiler *c, int opcode, PyObject *dict, - PyObject *o) -{ - int arg = compiler_add_o(c, dict, o); - if (arg < 0) - return 0; - return compiler_addop_i(c, opcode, arg); -} - -static int -compiler_addop_name(struct compiler *c, int opcode, PyObject *dict, - PyObject *o) -{ - int arg; - PyObject *mangled = _Py_Mangle(c->u->u_private, o); - if (!mangled) - return 0; - arg = compiler_add_o(c, dict, mangled); - Py_DECREF(mangled); - if (arg < 0) - return 0; - return compiler_addop_i(c, opcode, arg); -} - -/* Add an opcode with an integer argument. - Returns 0 on failure, 1 on success. -*/ - -static int -compiler_addop_i(struct compiler *c, int opcode, int oparg) -{ - struct instr *i; - int off; - off = compiler_next_instr(c, c->u->u_curblock); - if (off < 0) - return 0; - i = &c->u->u_curblock->b_instr[off]; - i->i_opcode = opcode; - i->i_oparg = oparg; - i->i_hasarg = 1; - compiler_set_lineno(c, off); - return 1; -} - -static int -compiler_addop_j(struct compiler *c, int opcode, basicblock *b, int absolute) -{ - struct instr *i; - int off; - - assert(b != NULL); - off = compiler_next_instr(c, c->u->u_curblock); - if (off < 0) - return 0; - i = &c->u->u_curblock->b_instr[off]; - i->i_opcode = opcode; - i->i_target = b; - i->i_hasarg = 1; - if (absolute) - i->i_jabs = 1; - else - i->i_jrel = 1; - compiler_set_lineno(c, off); - return 1; -} - -/* The distinction between NEW_BLOCK and NEXT_BLOCK is subtle. (I'd - like to find better names.) NEW_BLOCK() creates a new block and sets - it as the current block. NEXT_BLOCK() also creates an implicit jump - from the current block to the new block. -*/ - -/* The returns inside these macros make it impossible to decref objects - created in the local function. Local objects should use the arena. -*/ - - -#define NEW_BLOCK(C) { \ - if (compiler_use_new_block((C)) == NULL) \ - return 0; \ -} - -#define NEXT_BLOCK(C) { \ - if (compiler_next_block((C)) == NULL) \ - return 0; \ -} - -#define ADDOP(C, OP) { \ - if (!compiler_addop((C), (OP))) \ - return 0; \ -} - -#define ADDOP_IN_SCOPE(C, OP) { \ - if (!compiler_addop((C), (OP))) { \ - compiler_exit_scope(c); \ - return 0; \ - } \ -} - -#define ADDOP_O(C, OP, O, TYPE) { \ - if (!compiler_addop_o((C), (OP), (C)->u->u_ ## TYPE, (O))) \ - return 0; \ -} - -#define ADDOP_NAME(C, OP, O, TYPE) { \ - if (!compiler_addop_name((C), (OP), (C)->u->u_ ## TYPE, (O))) \ - return 0; \ -} - -#define ADDOP_I(C, OP, O) { \ - if (!compiler_addop_i((C), (OP), (O))) \ - return 0; \ -} - -#define ADDOP_JABS(C, OP, O) { \ - if (!compiler_addop_j((C), (OP), (O), 1)) \ - return 0; \ -} - -#define ADDOP_JREL(C, OP, O) { \ - if (!compiler_addop_j((C), (OP), (O), 0)) \ - return 0; \ -} - -/* VISIT and VISIT_SEQ takes an ASDL type as their second argument. They use - the ASDL name to synthesize the name of the C type and the visit function. -*/ - -#define VISIT(C, TYPE, V) {\ - if (!compiler_visit_ ## TYPE((C), (V))) \ - return 0; \ -} - -#define VISIT_IN_SCOPE(C, TYPE, V) {\ - if (!compiler_visit_ ## TYPE((C), (V))) { \ - compiler_exit_scope(c); \ - return 0; \ - } \ -} - -#define VISIT_SLICE(C, V, CTX) {\ - if (!compiler_visit_slice((C), (V), (CTX))) \ - return 0; \ -} - -#define VISIT_SEQ(C, TYPE, SEQ) { \ - int _i; \ - asdl_seq *seq = (SEQ); /* avoid variable capture */ \ - for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \ - TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \ - if (!compiler_visit_ ## TYPE((C), elt)) \ - return 0; \ - } \ -} - -#define VISIT_SEQ_IN_SCOPE(C, TYPE, SEQ) { \ - int _i; \ - asdl_seq *seq = (SEQ); /* avoid variable capture */ \ - for (_i = 0; _i < asdl_seq_LEN(seq); _i++) { \ - TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, _i); \ - if (!compiler_visit_ ## TYPE((C), elt)) { \ - compiler_exit_scope(c); \ - return 0; \ - } \ - } \ -} - -static int -compiler_isdocstring(stmt_ty s) -{ - if (s->kind != Expr_kind) - return 0; - return s->v.Expr.value->kind == Str_kind; -} - -/* Compile a sequence of statements, checking for a docstring. */ - -static int -compiler_body(struct compiler *c, asdl_seq *stmts) -{ - int i = 0; - stmt_ty st; - - if (!asdl_seq_LEN(stmts)) - return 1; - st = (stmt_ty)asdl_seq_GET(stmts, 0); - if (compiler_isdocstring(st) && Py_OptimizeFlag < 2) { - /* don't generate docstrings if -OO */ - i = 1; - VISIT(c, expr, st->v.Expr.value); - if (!compiler_nameop(c, __doc__, Store)) - return 0; - } - for (; i < asdl_seq_LEN(stmts); i++) - VISIT(c, stmt, (stmt_ty)asdl_seq_GET(stmts, i)); - return 1; -} - -static PyCodeObject * -compiler_mod(struct compiler *c, mod_ty mod) -{ - PyCodeObject *co; - int addNone = 1; - static PyObject *module; - if (!module) { - module = PyString_InternFromString(""); - if (!module) - return NULL; - } - /* Use 0 for firstlineno initially, will fixup in assemble(). */ - if (!compiler_enter_scope(c, module, mod, 0)) - return NULL; - switch (mod->kind) { - case Module_kind: - if (!compiler_body(c, mod->v.Module.body)) { - compiler_exit_scope(c); - return 0; - } - break; - case Interactive_kind: - c->c_interactive = 1; - VISIT_SEQ_IN_SCOPE(c, stmt, - mod->v.Interactive.body); - break; - case Expression_kind: - VISIT_IN_SCOPE(c, expr, mod->v.Expression.body); - addNone = 0; - break; - case Suite_kind: - PyErr_SetString(PyExc_SystemError, - "suite should not be possible"); - return 0; - default: - PyErr_Format(PyExc_SystemError, - "module kind %d should not be possible", - mod->kind); - return 0; - } - co = assemble(c, addNone); - compiler_exit_scope(c); - return co; -} - -/* The test for LOCAL must come before the test for FREE in order to - handle classes where name is both local and free. The local var is - a method and the free var is a free var referenced within a method. -*/ - -static int -get_ref_type(struct compiler *c, PyObject *name) -{ - int scope = PyST_GetScope(c->u->u_ste, name); - if (scope == 0) { - char buf[350]; - PyOS_snprintf(buf, sizeof(buf), - "unknown scope for %.100s in %.100s(%s) in %s\n" - "symbols: %s\nlocals: %s\nglobals: %s", - PyString_AS_STRING(name), - PyString_AS_STRING(c->u->u_name), - PyString_AS_STRING(PyObject_Repr(c->u->u_ste->ste_id)), - c->c_filename, - PyString_AS_STRING(PyObject_Repr(c->u->u_ste->ste_symbols)), - PyString_AS_STRING(PyObject_Repr(c->u->u_varnames)), - PyString_AS_STRING(PyObject_Repr(c->u->u_names)) - ); - Py_FatalError(buf); - } - - return scope; -} - -static int -compiler_lookup_arg(PyObject *dict, PyObject *name) -{ - PyObject *k, *v; - k = PyTuple_Pack(2, name, name->ob_type); - if (k == NULL) - return -1; - v = PyDict_GetItem(dict, k); - Py_DECREF(k); - if (v == NULL) - return -1; - return PyInt_AS_LONG(v); -} - -static int -compiler_make_closure(struct compiler *c, PyCodeObject *co, int args) -{ - int i, free = PyCode_GetNumFree(co); - if (free == 0) { - ADDOP_O(c, LOAD_CONST, (PyObject*)co, consts); - ADDOP_I(c, MAKE_FUNCTION, args); - return 1; - } - for (i = 0; i < free; ++i) { - /* Bypass com_addop_varname because it will generate - LOAD_DEREF but LOAD_CLOSURE is needed. - */ - PyObject *name = PyTuple_GET_ITEM(co->co_freevars, i); - int arg, reftype; - - /* Special case: If a class contains a method with a - free variable that has the same name as a method, - the name will be considered free *and* local in the - class. It should be handled by the closure, as - well as by the normal name loookup logic. - */ - reftype = get_ref_type(c, name); - if (reftype == CELL) - arg = compiler_lookup_arg(c->u->u_cellvars, name); - else /* (reftype == FREE) */ - arg = compiler_lookup_arg(c->u->u_freevars, name); - if (arg == -1) { - printf("lookup %s in %s %d %d\n" - "freevars of %s: %s\n", - PyString_AS_STRING(PyObject_Repr(name)), - PyString_AS_STRING(c->u->u_name), - reftype, arg, - PyString_AS_STRING(co->co_name), - PyString_AS_STRING(PyObject_Repr(co->co_freevars))); - Py_FatalError("compiler_make_closure()"); - } - ADDOP_I(c, LOAD_CLOSURE, arg); - } - ADDOP_I(c, BUILD_TUPLE, free); - ADDOP_O(c, LOAD_CONST, (PyObject*)co, consts); - ADDOP_I(c, MAKE_CLOSURE, args); - return 1; -} - -static int -compiler_decorators(struct compiler *c, asdl_seq* decos) -{ - int i; - - if (!decos) - return 1; - - for (i = 0; i < asdl_seq_LEN(decos); i++) { - VISIT(c, expr, (expr_ty)asdl_seq_GET(decos, i)); - } - return 1; -} - -static int -compiler_arguments(struct compiler *c, arguments_ty args) -{ - int i; - int n = asdl_seq_LEN(args->args); - /* Correctly handle nested argument lists */ - for (i = 0; i < n; i++) { - expr_ty arg = (expr_ty)asdl_seq_GET(args->args, i); - if (arg->kind == Tuple_kind) { - PyObject *id = PyString_FromFormat(".%d", i); - if (id == NULL) { - return 0; - } - if (!compiler_nameop(c, id, Load)) { - Py_DECREF(id); - return 0; - } - Py_DECREF(id); - VISIT(c, expr, arg); - } - } - return 1; -} - -static int -compiler_function(struct compiler *c, stmt_ty s) -{ - PyCodeObject *co; - PyObject *first_const = Py_None; - arguments_ty args = s->v.FunctionDef.args; - asdl_seq* decos = s->v.FunctionDef.decorator_list; - stmt_ty st; - int i, n, docstring; - - assert(s->kind == FunctionDef_kind); - - if (!compiler_decorators(c, decos)) - return 0; - if (args->defaults) - VISIT_SEQ(c, expr, args->defaults); - if (!compiler_enter_scope(c, s->v.FunctionDef.name, (void *)s, - s->lineno)) - return 0; - - st = (stmt_ty)asdl_seq_GET(s->v.FunctionDef.body, 0); - docstring = compiler_isdocstring(st); - if (docstring && Py_OptimizeFlag < 2) - first_const = st->v.Expr.value->v.Str.s; - if (compiler_add_o(c, c->u->u_consts, first_const) < 0) { - compiler_exit_scope(c); - return 0; - } - - /* unpack nested arguments */ - compiler_arguments(c, args); - - c->u->u_argcount = asdl_seq_LEN(args->args); - n = asdl_seq_LEN(s->v.FunctionDef.body); - /* if there was a docstring, we need to skip the first statement */ - for (i = docstring; i < n; i++) { - st = (stmt_ty)asdl_seq_GET(s->v.FunctionDef.body, i); - VISIT_IN_SCOPE(c, stmt, st); - } - co = assemble(c, 1); - compiler_exit_scope(c); - if (co == NULL) - return 0; - - compiler_make_closure(c, co, asdl_seq_LEN(args->defaults)); - Py_DECREF(co); - - for (i = 0; i < asdl_seq_LEN(decos); i++) { - ADDOP_I(c, CALL_FUNCTION, 1); - } - - return compiler_nameop(c, s->v.FunctionDef.name, Store); -} - -static int -compiler_class(struct compiler *c, stmt_ty s) -{ - int n, i; - PyCodeObject *co; - PyObject *str; - asdl_seq* decos = s->v.ClassDef.decorator_list; - - if (!compiler_decorators(c, decos)) - return 0; - - /* push class name on stack, needed by BUILD_CLASS */ - ADDOP_O(c, LOAD_CONST, s->v.ClassDef.name, consts); - /* push the tuple of base classes on the stack */ - n = asdl_seq_LEN(s->v.ClassDef.bases); - if (n > 0) - VISIT_SEQ(c, expr, s->v.ClassDef.bases); - ADDOP_I(c, BUILD_TUPLE, n); - if (!compiler_enter_scope(c, s->v.ClassDef.name, (void *)s, - s->lineno)) - return 0; - Py_XDECREF(c->u->u_private); - c->u->u_private = s->v.ClassDef.name; - Py_INCREF(c->u->u_private); - str = PyString_InternFromString("__name__"); - if (!str || !compiler_nameop(c, str, Load)) { - Py_XDECREF(str); - compiler_exit_scope(c); - return 0; - } - - Py_DECREF(str); - str = PyString_InternFromString("__module__"); - if (!str || !compiler_nameop(c, str, Store)) { - Py_XDECREF(str); - compiler_exit_scope(c); - return 0; - } - Py_DECREF(str); - - if (!compiler_body(c, s->v.ClassDef.body)) { - compiler_exit_scope(c); - return 0; - } - - ADDOP_IN_SCOPE(c, LOAD_LOCALS); - ADDOP_IN_SCOPE(c, RETURN_VALUE); - co = assemble(c, 1); - compiler_exit_scope(c); - if (co == NULL) - return 0; - - compiler_make_closure(c, co, 0); - Py_DECREF(co); - - ADDOP_I(c, CALL_FUNCTION, 0); - ADDOP(c, BUILD_CLASS); - /* apply decorators */ - for (i = 0; i < asdl_seq_LEN(decos); i++) { - ADDOP_I(c, CALL_FUNCTION, 1); - } - if (!compiler_nameop(c, s->v.ClassDef.name, Store)) - return 0; - return 1; -} - -static int -compiler_ifexp(struct compiler *c, expr_ty e) -{ - basicblock *end, *next; - - assert(e->kind == IfExp_kind); - end = compiler_new_block(c); - if (end == NULL) - return 0; - next = compiler_new_block(c); - if (next == NULL) - return 0; - VISIT(c, expr, e->v.IfExp.test); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); - VISIT(c, expr, e->v.IfExp.body); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, next); - VISIT(c, expr, e->v.IfExp.orelse); - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_lambda(struct compiler *c, expr_ty e) -{ - PyCodeObject *co; - static identifier name; - arguments_ty args = e->v.Lambda.args; - assert(e->kind == Lambda_kind); - - if (!name) { - name = PyString_InternFromString(""); - if (!name) - return 0; - } - - if (args->defaults) - VISIT_SEQ(c, expr, args->defaults); - if (!compiler_enter_scope(c, name, (void *)e, e->lineno)) - return 0; - - /* unpack nested arguments */ - compiler_arguments(c, args); - - /* Make None the first constant, so the lambda can't have a - docstring. */ - if (compiler_add_o(c, c->u->u_consts, Py_None) < 0) - return 0; - - c->u->u_argcount = asdl_seq_LEN(args->args); - VISIT_IN_SCOPE(c, expr, e->v.Lambda.body); - if (c->u->u_ste->ste_generator) { - ADDOP_IN_SCOPE(c, POP_TOP); - } - else { - ADDOP_IN_SCOPE(c, RETURN_VALUE); - } - co = assemble(c, 1); - compiler_exit_scope(c); - if (co == NULL) - return 0; - - compiler_make_closure(c, co, asdl_seq_LEN(args->defaults)); - Py_DECREF(co); - - return 1; -} - -static int -compiler_print(struct compiler *c, stmt_ty s) -{ - int i, n; - bool dest; - - assert(s->kind == Print_kind); - n = asdl_seq_LEN(s->v.Print.values); - dest = false; - if (s->v.Print.dest) { - VISIT(c, expr, s->v.Print.dest); - dest = true; - } - for (i = 0; i < n; i++) { - expr_ty e = (expr_ty)asdl_seq_GET(s->v.Print.values, i); - if (dest) { - ADDOP(c, DUP_TOP); - VISIT(c, expr, e); - ADDOP(c, ROT_TWO); - ADDOP(c, PRINT_ITEM_TO); - } - else { - VISIT(c, expr, e); - ADDOP(c, PRINT_ITEM); - } - } - if (s->v.Print.nl) { - if (dest) - ADDOP(c, PRINT_NEWLINE_TO) - else - ADDOP(c, PRINT_NEWLINE) - } - else if (dest) - ADDOP(c, POP_TOP); - return 1; -} - -static int -compiler_if(struct compiler *c, stmt_ty s) -{ - basicblock *end, *next; - int constant; - assert(s->kind == If_kind); - end = compiler_new_block(c); - if (end == NULL) - return 0; - - constant = expr_constant(s->v.If.test); - /* constant = 0: "if 0" - * constant = 1: "if 1", "if 2", ... - * constant = -1: rest */ - if (constant == 0) { - if (s->v.If.orelse) - VISIT_SEQ(c, stmt, s->v.If.orelse); - } else if (constant == 1) { - VISIT_SEQ(c, stmt, s->v.If.body); - } else { - if (s->v.If.orelse) { - next = compiler_new_block(c); - if (next == NULL) - return 0; - } - else - next = end; - VISIT(c, expr, s->v.If.test); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, next); - VISIT_SEQ(c, stmt, s->v.If.body); - ADDOP_JREL(c, JUMP_FORWARD, end); - if (s->v.If.orelse) { - compiler_use_next_block(c, next); - VISIT_SEQ(c, stmt, s->v.If.orelse); - } - } - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_for(struct compiler *c, stmt_ty s) -{ - basicblock *start, *cleanup, *end; - - start = compiler_new_block(c); - cleanup = compiler_new_block(c); - end = compiler_new_block(c); - if (start == NULL || end == NULL || cleanup == NULL) - return 0; - ADDOP_JREL(c, SETUP_LOOP, end); - if (!compiler_push_fblock(c, LOOP, start)) - return 0; - VISIT(c, expr, s->v.For.iter); - ADDOP(c, GET_ITER); - compiler_use_next_block(c, start); - ADDOP_JREL(c, FOR_ITER, cleanup); - VISIT(c, expr, s->v.For.target); - VISIT_SEQ(c, stmt, s->v.For.body); - ADDOP_JABS(c, JUMP_ABSOLUTE, start); - compiler_use_next_block(c, cleanup); - ADDOP(c, POP_BLOCK); - compiler_pop_fblock(c, LOOP, start); - VISIT_SEQ(c, stmt, s->v.For.orelse); - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_while(struct compiler *c, stmt_ty s) -{ - basicblock *loop, *orelse, *end, *anchor = NULL; - int constant = expr_constant(s->v.While.test); - - if (constant == 0) { - if (s->v.While.orelse) - VISIT_SEQ(c, stmt, s->v.While.orelse); - return 1; - } - loop = compiler_new_block(c); - end = compiler_new_block(c); - if (constant == -1) { - anchor = compiler_new_block(c); - if (anchor == NULL) - return 0; - } - if (loop == NULL || end == NULL) - return 0; - if (s->v.While.orelse) { - orelse = compiler_new_block(c); - if (orelse == NULL) - return 0; - } - else - orelse = NULL; - - ADDOP_JREL(c, SETUP_LOOP, end); - compiler_use_next_block(c, loop); - if (!compiler_push_fblock(c, LOOP, loop)) - return 0; - if (constant == -1) { - VISIT(c, expr, s->v.While.test); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, anchor); - } - VISIT_SEQ(c, stmt, s->v.While.body); - ADDOP_JABS(c, JUMP_ABSOLUTE, loop); - - /* XXX should the two POP instructions be in a separate block - if there is no else clause ? - */ - - if (constant == -1) - compiler_use_next_block(c, anchor); - ADDOP(c, POP_BLOCK); - compiler_pop_fblock(c, LOOP, loop); - if (orelse != NULL) /* what if orelse is just pass? */ - VISIT_SEQ(c, stmt, s->v.While.orelse); - compiler_use_next_block(c, end); - - return 1; -} - -static int -compiler_continue(struct compiler *c) -{ - static const char LOOP_ERROR_MSG[] = "'continue' not properly in loop"; - static const char IN_FINALLY_ERROR_MSG[] = - "'continue' not supported inside 'finally' clause"; - int i; - - if (!c->u->u_nfblocks) - return compiler_error(c, LOOP_ERROR_MSG); - i = c->u->u_nfblocks - 1; - switch (c->u->u_fblock[i].fb_type) { - case LOOP: - ADDOP_JABS(c, JUMP_ABSOLUTE, c->u->u_fblock[i].fb_block); - break; - case EXCEPT: - case FINALLY_TRY: - while (--i >= 0 && c->u->u_fblock[i].fb_type != LOOP) { - /* Prevent continue anywhere under a finally - even if hidden in a sub-try or except. */ - if (c->u->u_fblock[i].fb_type == FINALLY_END) - return compiler_error(c, IN_FINALLY_ERROR_MSG); - } - if (i == -1) - return compiler_error(c, LOOP_ERROR_MSG); - ADDOP_JABS(c, CONTINUE_LOOP, c->u->u_fblock[i].fb_block); - break; - case FINALLY_END: - return compiler_error(c, IN_FINALLY_ERROR_MSG); - } - - return 1; -} - -/* Code generated for "try: finally: " is as follows: - - SETUP_FINALLY L - - POP_BLOCK - LOAD_CONST - L: - END_FINALLY - - The special instructions use the block stack. Each block - stack entry contains the instruction that created it (here - SETUP_FINALLY), the level of the value stack at the time the - block stack entry was created, and a label (here L). - - SETUP_FINALLY: - Pushes the current value stack level and the label - onto the block stack. - POP_BLOCK: - Pops en entry from the block stack, and pops the value - stack until its level is the same as indicated on the - block stack. (The label is ignored.) - END_FINALLY: - Pops a variable number of entries from the *value* stack - and re-raises the exception they specify. The number of - entries popped depends on the (pseudo) exception type. - - The block stack is unwound when an exception is raised: - when a SETUP_FINALLY entry is found, the exception is pushed - onto the value stack (and the exception condition is cleared), - and the interpreter jumps to the label gotten from the block - stack. -*/ - -static int -compiler_try_finally(struct compiler *c, stmt_ty s) -{ - basicblock *body, *end; - body = compiler_new_block(c); - end = compiler_new_block(c); - if (body == NULL || end == NULL) - return 0; - - ADDOP_JREL(c, SETUP_FINALLY, end); - compiler_use_next_block(c, body); - if (!compiler_push_fblock(c, FINALLY_TRY, body)) - return 0; - VISIT_SEQ(c, stmt, s->v.TryFinally.body); - ADDOP(c, POP_BLOCK); - compiler_pop_fblock(c, FINALLY_TRY, body); - - ADDOP_O(c, LOAD_CONST, Py_None, consts); - compiler_use_next_block(c, end); - if (!compiler_push_fblock(c, FINALLY_END, end)) - return 0; - VISIT_SEQ(c, stmt, s->v.TryFinally.finalbody); - ADDOP(c, END_FINALLY); - compiler_pop_fblock(c, FINALLY_END, end); - - return 1; -} - -/* - Code generated for "try: S except E1, V1: S1 except E2, V2: S2 ...": - (The contents of the value stack is shown in [], with the top - at the right; 'tb' is trace-back info, 'val' the exception's - associated value, and 'exc' the exception.) - - Value stack Label Instruction Argument - [] SETUP_EXCEPT L1 - [] - [] POP_BLOCK - [] JUMP_FORWARD L0 - - [tb, val, exc] L1: DUP ) - [tb, val, exc, exc] ) - [tb, val, exc, exc, E1] COMPARE_OP EXC_MATCH ) only if E1 - [tb, val, exc, 1-or-0] POP_JUMP_IF_FALSE L2 ) - [tb, val, exc] POP - [tb, val] (or POP if no V1) - [tb] POP - [] - JUMP_FORWARD L0 - - [tb, val, exc] L2: DUP - .............................etc....................... - - [tb, val, exc] Ln+1: END_FINALLY # re-raise exception - - [] L0: - - Of course, parts are not generated if Vi or Ei is not present. -*/ -static int -compiler_try_except(struct compiler *c, stmt_ty s) -{ - basicblock *body, *orelse, *except, *end; - int i, n; - - body = compiler_new_block(c); - except = compiler_new_block(c); - orelse = compiler_new_block(c); - end = compiler_new_block(c); - if (body == NULL || except == NULL || orelse == NULL || end == NULL) - return 0; - ADDOP_JREL(c, SETUP_EXCEPT, except); - compiler_use_next_block(c, body); - if (!compiler_push_fblock(c, EXCEPT, body)) - return 0; - VISIT_SEQ(c, stmt, s->v.TryExcept.body); - ADDOP(c, POP_BLOCK); - compiler_pop_fblock(c, EXCEPT, body); - ADDOP_JREL(c, JUMP_FORWARD, orelse); - n = asdl_seq_LEN(s->v.TryExcept.handlers); - compiler_use_next_block(c, except); - for (i = 0; i < n; i++) { - excepthandler_ty handler = (excepthandler_ty)asdl_seq_GET( - s->v.TryExcept.handlers, i); - if (!handler->v.ExceptHandler.type && i < n-1) - return compiler_error(c, "default 'except:' must be last"); - c->u->u_lineno_set = false; - c->u->u_lineno = handler->lineno; - except = compiler_new_block(c); - if (except == NULL) - return 0; - if (handler->v.ExceptHandler.type) { - ADDOP(c, DUP_TOP); - VISIT(c, expr, handler->v.ExceptHandler.type); - ADDOP_I(c, COMPARE_OP, PyCmp_EXC_MATCH); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, except); - } - ADDOP(c, POP_TOP); - if (handler->v.ExceptHandler.name) { - VISIT(c, expr, handler->v.ExceptHandler.name); - } - else { - ADDOP(c, POP_TOP); - } - ADDOP(c, POP_TOP); - VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body); - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, except); - } - ADDOP(c, END_FINALLY); - compiler_use_next_block(c, orelse); - VISIT_SEQ(c, stmt, s->v.TryExcept.orelse); - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_import_as(struct compiler *c, identifier name, identifier asname) -{ - /* The IMPORT_NAME opcode was already generated. This function - merely needs to bind the result to a name. - - If there is a dot in name, we need to split it and emit a - LOAD_ATTR for each name. - */ - const char *src = PyString_AS_STRING(name); - const char *dot = strchr(src, '.'); - if (dot) { - /* Consume the base module name to get the first attribute */ - src = dot + 1; - while (dot) { - /* NB src is only defined when dot != NULL */ - PyObject *attr; - dot = strchr(src, '.'); - attr = PyString_FromStringAndSize(src, - dot ? dot - src : strlen(src)); - if (!attr) - return -1; - ADDOP_O(c, LOAD_ATTR, attr, names); - Py_DECREF(attr); - src = dot + 1; - } - } - return compiler_nameop(c, asname, Store); -} - -static int -compiler_import(struct compiler *c, stmt_ty s) -{ - /* The Import node stores a module name like a.b.c as a single - string. This is convenient for all cases except - import a.b.c as d - where we need to parse that string to extract the individual - module names. - XXX Perhaps change the representation to make this case simpler? - */ - int i, n = asdl_seq_LEN(s->v.Import.names); - - for (i = 0; i < n; i++) { - alias_ty alias = (alias_ty)asdl_seq_GET(s->v.Import.names, i); - int r; - PyObject *level; - - if (c->c_flags && (c->c_flags->cf_flags & CO_FUTURE_ABSOLUTE_IMPORT)) - level = PyInt_FromLong(0); - else - level = PyInt_FromLong(-1); - - if (level == NULL) - return 0; - - ADDOP_O(c, LOAD_CONST, level, consts); - Py_DECREF(level); - ADDOP_O(c, LOAD_CONST, Py_None, consts); - ADDOP_NAME(c, IMPORT_NAME, alias->name, names); - - if (alias->asname) { - r = compiler_import_as(c, alias->name, alias->asname); - if (!r) - return r; - } - else { - identifier tmp = alias->name; - const char *base = PyString_AS_STRING(alias->name); - char *dot = strchr(base, '.'); - if (dot) - tmp = PyString_FromStringAndSize(base, - dot - base); - r = compiler_nameop(c, tmp, Store); - if (dot) { - Py_DECREF(tmp); - } - if (!r) - return r; - } - } - return 1; -} - -static int -compiler_from_import(struct compiler *c, stmt_ty s) -{ - int i, n = asdl_seq_LEN(s->v.ImportFrom.names); - - PyObject *names = PyTuple_New(n); - PyObject *level; - static PyObject *empty_string; - - if (!empty_string) { - empty_string = PyString_FromString(""); - if (!empty_string) - return 0; - } - - if (!names) - return 0; - - if (s->v.ImportFrom.level == 0 && c->c_flags && - !(c->c_flags->cf_flags & CO_FUTURE_ABSOLUTE_IMPORT)) - level = PyInt_FromLong(-1); - else - level = PyInt_FromLong(s->v.ImportFrom.level); - - if (!level) { - Py_DECREF(names); - return 0; - } - - /* build up the names */ - for (i = 0; i < n; i++) { - alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); - Py_INCREF(alias->name); - PyTuple_SET_ITEM(names, i, alias->name); - } - - if (s->lineno > c->c_future->ff_lineno && s->v.ImportFrom.module && - !strcmp(PyString_AS_STRING(s->v.ImportFrom.module), "__future__")) { - Py_DECREF(level); - Py_DECREF(names); - return compiler_error(c, "from __future__ imports must occur " - "at the beginning of the file"); - } - - ADDOP_O(c, LOAD_CONST, level, consts); - Py_DECREF(level); - ADDOP_O(c, LOAD_CONST, names, consts); - Py_DECREF(names); - if (s->v.ImportFrom.module) { - ADDOP_NAME(c, IMPORT_NAME, s->v.ImportFrom.module, names); - } - else { - ADDOP_NAME(c, IMPORT_NAME, empty_string, names); - } - for (i = 0; i < n; i++) { - alias_ty alias = (alias_ty)asdl_seq_GET(s->v.ImportFrom.names, i); - identifier store_name; - - if (i == 0 && *PyString_AS_STRING(alias->name) == '*') { - assert(n == 1); - ADDOP(c, IMPORT_STAR); - return 1; - } - - ADDOP_NAME(c, IMPORT_FROM, alias->name, names); - store_name = alias->name; - if (alias->asname) - store_name = alias->asname; - - if (!compiler_nameop(c, store_name, Store)) { - Py_DECREF(names); - return 0; - } - } - /* remove imported module */ - ADDOP(c, POP_TOP); - return 1; -} - -static int -compiler_assert(struct compiler *c, stmt_ty s) -{ - static PyObject *assertion_error = NULL; - basicblock *end; - - if (Py_OptimizeFlag) - return 1; - if (assertion_error == NULL) { - assertion_error = PyString_InternFromString("AssertionError"); - if (assertion_error == NULL) - return 0; - } - if (s->v.Assert.test->kind == Tuple_kind && - asdl_seq_LEN(s->v.Assert.test->v.Tuple.elts) > 0) { - const char* msg = - "assertion is always true, perhaps remove parentheses?"; - if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, c->c_filename, - c->u->u_lineno, NULL, NULL) == -1) - return 0; - } - VISIT(c, expr, s->v.Assert.test); - end = compiler_new_block(c); - if (end == NULL) - return 0; - ADDOP_JABS(c, POP_JUMP_IF_TRUE, end); - ADDOP_O(c, LOAD_GLOBAL, assertion_error, names); - if (s->v.Assert.msg) { - VISIT(c, expr, s->v.Assert.msg); - ADDOP_I(c, CALL_FUNCTION, 1); - } - ADDOP_I(c, RAISE_VARARGS, 1); - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_visit_stmt(struct compiler *c, stmt_ty s) -{ - int i, n; - - /* Always assign a lineno to the next instruction for a stmt. */ - c->u->u_lineno = s->lineno; - c->u->u_lineno_set = false; - - switch (s->kind) { - case FunctionDef_kind: - return compiler_function(c, s); - case ClassDef_kind: - return compiler_class(c, s); - case Return_kind: - if (c->u->u_ste->ste_type != FunctionBlock) - return compiler_error(c, "'return' outside function"); - if (s->v.Return.value) { - VISIT(c, expr, s->v.Return.value); - } - else - ADDOP_O(c, LOAD_CONST, Py_None, consts); - ADDOP(c, RETURN_VALUE); - break; - case Delete_kind: - VISIT_SEQ(c, expr, s->v.Delete.targets) - break; - case Assign_kind: - n = asdl_seq_LEN(s->v.Assign.targets); - VISIT(c, expr, s->v.Assign.value); - for (i = 0; i < n; i++) { - if (i < n - 1) - ADDOP(c, DUP_TOP); - VISIT(c, expr, - (expr_ty)asdl_seq_GET(s->v.Assign.targets, i)); - } - break; - case AugAssign_kind: - return compiler_augassign(c, s); - case Print_kind: - return compiler_print(c, s); - case For_kind: - return compiler_for(c, s); - case While_kind: - return compiler_while(c, s); - case If_kind: - return compiler_if(c, s); - case Raise_kind: - n = 0; - if (s->v.Raise.type) { - VISIT(c, expr, s->v.Raise.type); - n++; - if (s->v.Raise.inst) { - VISIT(c, expr, s->v.Raise.inst); - n++; - if (s->v.Raise.tback) { - VISIT(c, expr, s->v.Raise.tback); - n++; - } - } - } - ADDOP_I(c, RAISE_VARARGS, n); - break; - case TryExcept_kind: - return compiler_try_except(c, s); - case TryFinally_kind: - return compiler_try_finally(c, s); - case Assert_kind: - return compiler_assert(c, s); - case Import_kind: - return compiler_import(c, s); - case ImportFrom_kind: - return compiler_from_import(c, s); - case Exec_kind: - VISIT(c, expr, s->v.Exec.body); - if (s->v.Exec.globals) { - VISIT(c, expr, s->v.Exec.globals); - if (s->v.Exec.locals) { - VISIT(c, expr, s->v.Exec.locals); - } else { - ADDOP(c, DUP_TOP); - } - } else { - ADDOP_O(c, LOAD_CONST, Py_None, consts); - ADDOP(c, DUP_TOP); - } - ADDOP(c, EXEC_STMT); - break; - case Global_kind: - break; - case Expr_kind: - if (c->c_interactive && c->c_nestlevel <= 1) { - VISIT(c, expr, s->v.Expr.value); - ADDOP(c, PRINT_EXPR); - } - else if (s->v.Expr.value->kind != Str_kind && - s->v.Expr.value->kind != Num_kind) { - VISIT(c, expr, s->v.Expr.value); - ADDOP(c, POP_TOP); - } - break; - case Pass_kind: - break; - case Break_kind: - if (!compiler_in_loop(c)) - return compiler_error(c, "'break' outside loop"); - ADDOP(c, BREAK_LOOP); - break; - case Continue_kind: - return compiler_continue(c); - case With_kind: - return compiler_with(c, s); - } - return 1; -} - -static int -unaryop(unaryop_ty op) -{ - switch (op) { - case Invert: - return UNARY_INVERT; - case Not: - return UNARY_NOT; - case UAdd: - return UNARY_POSITIVE; - case USub: - return UNARY_NEGATIVE; - default: - PyErr_Format(PyExc_SystemError, - "unary op %d should not be possible", op); - return 0; - } -} - -static int -binop(struct compiler *c, operator_ty op) -{ - switch (op) { - case Add: - return BINARY_ADD; - case Sub: - return BINARY_SUBTRACT; - case Mult: - return BINARY_MULTIPLY; - case Div: - if (c->c_flags && c->c_flags->cf_flags & CO_FUTURE_DIVISION) - return BINARY_TRUE_DIVIDE; - else - return BINARY_DIVIDE; - case Mod: - return BINARY_MODULO; - case Pow: - return BINARY_POWER; - case LShift: - return BINARY_LSHIFT; - case RShift: - return BINARY_RSHIFT; - case BitOr: - return BINARY_OR; - case BitXor: - return BINARY_XOR; - case BitAnd: - return BINARY_AND; - case FloorDiv: - return BINARY_FLOOR_DIVIDE; - default: - PyErr_Format(PyExc_SystemError, - "binary op %d should not be possible", op); - return 0; - } -} - -static int -cmpop(cmpop_ty op) -{ - switch (op) { - case Eq: - return PyCmp_EQ; - case NotEq: - return PyCmp_NE; - case Lt: - return PyCmp_LT; - case LtE: - return PyCmp_LE; - case Gt: - return PyCmp_GT; - case GtE: - return PyCmp_GE; - case Is: - return PyCmp_IS; - case IsNot: - return PyCmp_IS_NOT; - case In: - return PyCmp_IN; - case NotIn: - return PyCmp_NOT_IN; - default: - return PyCmp_BAD; - } -} - -static int -inplace_binop(struct compiler *c, operator_ty op) -{ - switch (op) { - case Add: - return INPLACE_ADD; - case Sub: - return INPLACE_SUBTRACT; - case Mult: - return INPLACE_MULTIPLY; - case Div: - if (c->c_flags && c->c_flags->cf_flags & CO_FUTURE_DIVISION) - return INPLACE_TRUE_DIVIDE; - else - return INPLACE_DIVIDE; - case Mod: - return INPLACE_MODULO; - case Pow: - return INPLACE_POWER; - case LShift: - return INPLACE_LSHIFT; - case RShift: - return INPLACE_RSHIFT; - case BitOr: - return INPLACE_OR; - case BitXor: - return INPLACE_XOR; - case BitAnd: - return INPLACE_AND; - case FloorDiv: - return INPLACE_FLOOR_DIVIDE; - default: - PyErr_Format(PyExc_SystemError, - "inplace binary op %d should not be possible", op); - return 0; - } -} - -static int -compiler_nameop(struct compiler *c, identifier name, expr_context_ty ctx) -{ - int op, scope, arg; - enum { OP_FAST, OP_GLOBAL, OP_DEREF, OP_NAME } optype; - - PyObject *dict = c->u->u_names; - PyObject *mangled; - /* XXX AugStore isn't used anywhere! */ - - mangled = _Py_Mangle(c->u->u_private, name); - if (!mangled) - return 0; - - op = 0; - optype = OP_NAME; - scope = PyST_GetScope(c->u->u_ste, mangled); - switch (scope) { - case FREE: - dict = c->u->u_freevars; - optype = OP_DEREF; - break; - case CELL: - dict = c->u->u_cellvars; - optype = OP_DEREF; - break; - case LOCAL: - if (c->u->u_ste->ste_type == FunctionBlock) - optype = OP_FAST; - break; - case GLOBAL_IMPLICIT: - if (c->u->u_ste->ste_type == FunctionBlock && - !c->u->u_ste->ste_unoptimized) - optype = OP_GLOBAL; - break; - case GLOBAL_EXPLICIT: - optype = OP_GLOBAL; - break; - default: - /* scope can be 0 */ - break; - } - - /* XXX Leave assert here, but handle __doc__ and the like better */ - assert(scope || PyString_AS_STRING(name)[0] == '_'); - - switch (optype) { - case OP_DEREF: - switch (ctx) { - case Load: op = LOAD_DEREF; break; - case Store: op = STORE_DEREF; break; - case AugLoad: - case AugStore: - break; - case Del: - PyErr_Format(PyExc_SyntaxError, - "can not delete variable '%s' referenced " - "in nested scope", - PyString_AS_STRING(name)); - Py_DECREF(mangled); - return 0; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid for deref variable"); - return 0; - } - break; - case OP_FAST: - switch (ctx) { - case Load: op = LOAD_FAST; break; - case Store: op = STORE_FAST; break; - case Del: op = DELETE_FAST; break; - case AugLoad: - case AugStore: - break; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid for local variable"); - return 0; - } - ADDOP_O(c, op, mangled, varnames); - Py_DECREF(mangled); - return 1; - case OP_GLOBAL: - switch (ctx) { - case Load: op = LOAD_GLOBAL; break; - case Store: op = STORE_GLOBAL; break; - case Del: op = DELETE_GLOBAL; break; - case AugLoad: - case AugStore: - break; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid for global variable"); - return 0; - } - break; - case OP_NAME: - switch (ctx) { - case Load: op = LOAD_NAME; break; - case Store: op = STORE_NAME; break; - case Del: op = DELETE_NAME; break; - case AugLoad: - case AugStore: - break; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid for name variable"); - return 0; - } - break; - } - - assert(op); - arg = compiler_add_o(c, dict, mangled); - Py_DECREF(mangled); - if (arg < 0) - return 0; - return compiler_addop_i(c, op, arg); -} - -static int -compiler_boolop(struct compiler *c, expr_ty e) -{ - basicblock *end; - int jumpi, i, n; - asdl_seq *s; - - assert(e->kind == BoolOp_kind); - if (e->v.BoolOp.op == And) - jumpi = JUMP_IF_FALSE_OR_POP; - else - jumpi = JUMP_IF_TRUE_OR_POP; - end = compiler_new_block(c); - if (end == NULL) - return 0; - s = e->v.BoolOp.values; - n = asdl_seq_LEN(s) - 1; - assert(n >= 0); - for (i = 0; i < n; ++i) { - VISIT(c, expr, (expr_ty)asdl_seq_GET(s, i)); - ADDOP_JABS(c, jumpi, end); - } - VISIT(c, expr, (expr_ty)asdl_seq_GET(s, n)); - compiler_use_next_block(c, end); - return 1; -} - -static int -compiler_list(struct compiler *c, expr_ty e) -{ - int n = asdl_seq_LEN(e->v.List.elts); - if (e->v.List.ctx == Store) { - ADDOP_I(c, UNPACK_SEQUENCE, n); - } - VISIT_SEQ(c, expr, e->v.List.elts); - if (e->v.List.ctx == Load) { - ADDOP_I(c, BUILD_LIST, n); - } - return 1; -} - -static int -compiler_tuple(struct compiler *c, expr_ty e) -{ - int n = asdl_seq_LEN(e->v.Tuple.elts); - if (e->v.Tuple.ctx == Store) { - ADDOP_I(c, UNPACK_SEQUENCE, n); - } - VISIT_SEQ(c, expr, e->v.Tuple.elts); - if (e->v.Tuple.ctx == Load) { - ADDOP_I(c, BUILD_TUPLE, n); - } - return 1; -} - -static int -compiler_compare(struct compiler *c, expr_ty e) -{ - int i, n; - basicblock *cleanup = NULL; - - /* XXX the logic can be cleaned up for 1 or multiple comparisons */ - VISIT(c, expr, e->v.Compare.left); - n = asdl_seq_LEN(e->v.Compare.ops); - assert(n > 0); - if (n > 1) { - cleanup = compiler_new_block(c); - if (cleanup == NULL) - return 0; - VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Compare.comparators, 0)); - } - for (i = 1; i < n; i++) { - ADDOP(c, DUP_TOP); - ADDOP(c, ROT_THREE); - ADDOP_I(c, COMPARE_OP, - cmpop((cmpop_ty)(asdl_seq_GET( - e->v.Compare.ops, i - 1)))); - ADDOP_JABS(c, JUMP_IF_FALSE_OR_POP, cleanup); - NEXT_BLOCK(c); - if (i < (n - 1)) - VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Compare.comparators, i)); - } - VISIT(c, expr, (expr_ty)asdl_seq_GET(e->v.Compare.comparators, n - 1)); - ADDOP_I(c, COMPARE_OP, - cmpop((cmpop_ty)(asdl_seq_GET(e->v.Compare.ops, n - 1)))); - if (n > 1) { - basicblock *end = compiler_new_block(c); - if (end == NULL) - return 0; - ADDOP_JREL(c, JUMP_FORWARD, end); - compiler_use_next_block(c, cleanup); - ADDOP(c, ROT_TWO); - ADDOP(c, POP_TOP); - compiler_use_next_block(c, end); - } - return 1; -} - -static int -compiler_call(struct compiler *c, expr_ty e) -{ - int n, code = 0; - - VISIT(c, expr, e->v.Call.func); - n = asdl_seq_LEN(e->v.Call.args); - VISIT_SEQ(c, expr, e->v.Call.args); - if (e->v.Call.keywords) { - VISIT_SEQ(c, keyword, e->v.Call.keywords); - n |= asdl_seq_LEN(e->v.Call.keywords) << 8; - } - if (e->v.Call.starargs) { - VISIT(c, expr, e->v.Call.starargs); - code |= 1; - } - if (e->v.Call.kwargs) { - VISIT(c, expr, e->v.Call.kwargs); - code |= 2; - } - switch (code) { - case 0: - ADDOP_I(c, CALL_FUNCTION, n); - break; - case 1: - ADDOP_I(c, CALL_FUNCTION_VAR, n); - break; - case 2: - ADDOP_I(c, CALL_FUNCTION_KW, n); - break; - case 3: - ADDOP_I(c, CALL_FUNCTION_VAR_KW, n); - break; - } - return 1; -} - -static int -compiler_listcomp_generator(struct compiler *c, asdl_seq *generators, - int gen_index, expr_ty elt) -{ - /* generate code for the iterator, then each of the ifs, - and then write to the element */ - - comprehension_ty l; - basicblock *start, *anchor, *skip, *if_cleanup; - int i, n; - - start = compiler_new_block(c); - skip = compiler_new_block(c); - if_cleanup = compiler_new_block(c); - anchor = compiler_new_block(c); - - if (start == NULL || skip == NULL || if_cleanup == NULL || - anchor == NULL) - return 0; - - l = (comprehension_ty)asdl_seq_GET(generators, gen_index); - VISIT(c, expr, l->iter); - ADDOP(c, GET_ITER); - compiler_use_next_block(c, start); - ADDOP_JREL(c, FOR_ITER, anchor); - NEXT_BLOCK(c); - VISIT(c, expr, l->target); - - /* XXX this needs to be cleaned up...a lot! */ - n = asdl_seq_LEN(l->ifs); - for (i = 0; i < n; i++) { - expr_ty e = (expr_ty)asdl_seq_GET(l->ifs, i); - VISIT(c, expr, e); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, if_cleanup); - NEXT_BLOCK(c); - } - - if (++gen_index < asdl_seq_LEN(generators)) - if (!compiler_listcomp_generator(c, generators, gen_index, elt)) - return 0; - - /* only append after the last for generator */ - if (gen_index >= asdl_seq_LEN(generators)) { - VISIT(c, expr, elt); - ADDOP_I(c, LIST_APPEND, gen_index+1); - - compiler_use_next_block(c, skip); - } - compiler_use_next_block(c, if_cleanup); - ADDOP_JABS(c, JUMP_ABSOLUTE, start); - compiler_use_next_block(c, anchor); - - return 1; -} - -static int -compiler_listcomp(struct compiler *c, expr_ty e) -{ - assert(e->kind == ListComp_kind); - ADDOP_I(c, BUILD_LIST, 0); - return compiler_listcomp_generator(c, e->v.ListComp.generators, 0, - e->v.ListComp.elt); -} - -/* Dict and set comprehensions and generator expressions work by creating a - nested function to perform the actual iteration. This means that the - iteration variables don't leak into the current scope. - The defined function is called immediately following its definition, with the - result of that call being the result of the expression. - The LC/SC version returns the populated container, while the GE version is - flagged in symtable.c as a generator, so it returns the generator object - when the function is called. - This code *knows* that the loop cannot contain break, continue, or return, - so it cheats and skips the SETUP_LOOP/POP_BLOCK steps used in normal loops. - - Possible cleanups: - - iterate over the generator sequence instead of using recursion -*/ - -static int -compiler_comprehension_generator(struct compiler *c, - asdl_seq *generators, int gen_index, - expr_ty elt, expr_ty val, int type) -{ - /* generate code for the iterator, then each of the ifs, - and then write to the element */ - - comprehension_ty gen; - basicblock *start, *anchor, *skip, *if_cleanup; - int i, n; - - start = compiler_new_block(c); - skip = compiler_new_block(c); - if_cleanup = compiler_new_block(c); - anchor = compiler_new_block(c); - - if (start == NULL || skip == NULL || if_cleanup == NULL || - anchor == NULL) - return 0; - - gen = (comprehension_ty)asdl_seq_GET(generators, gen_index); - - if (gen_index == 0) { - /* Receive outermost iter as an implicit argument */ - c->u->u_argcount = 1; - ADDOP_I(c, LOAD_FAST, 0); - } - else { - /* Sub-iter - calculate on the fly */ - VISIT(c, expr, gen->iter); - ADDOP(c, GET_ITER); - } - compiler_use_next_block(c, start); - ADDOP_JREL(c, FOR_ITER, anchor); - NEXT_BLOCK(c); - VISIT(c, expr, gen->target); - - /* XXX this needs to be cleaned up...a lot! */ - n = asdl_seq_LEN(gen->ifs); - for (i = 0; i < n; i++) { - expr_ty e = (expr_ty)asdl_seq_GET(gen->ifs, i); - VISIT(c, expr, e); - ADDOP_JABS(c, POP_JUMP_IF_FALSE, if_cleanup); - NEXT_BLOCK(c); - } - - if (++gen_index < asdl_seq_LEN(generators)) - if (!compiler_comprehension_generator(c, - generators, gen_index, - elt, val, type)) - return 0; - - /* only append after the last for generator */ - if (gen_index >= asdl_seq_LEN(generators)) { - /* comprehension specific code */ - switch (type) { - case COMP_GENEXP: - VISIT(c, expr, elt); - ADDOP(c, YIELD_VALUE); - ADDOP(c, POP_TOP); - break; - case COMP_SETCOMP: - VISIT(c, expr, elt); - ADDOP_I(c, SET_ADD, gen_index + 1); - break; - case COMP_DICTCOMP: - /* With 'd[k] = v', v is evaluated before k, so we do - the same. */ - VISIT(c, expr, val); - VISIT(c, expr, elt); - ADDOP_I(c, MAP_ADD, gen_index + 1); - break; - default: - return 0; - } - - compiler_use_next_block(c, skip); - } - compiler_use_next_block(c, if_cleanup); - ADDOP_JABS(c, JUMP_ABSOLUTE, start); - compiler_use_next_block(c, anchor); - - return 1; -} - -static int -compiler_comprehension(struct compiler *c, expr_ty e, int type, identifier name, - asdl_seq *generators, expr_ty elt, expr_ty val) -{ - PyCodeObject *co = NULL; - expr_ty outermost_iter; - - outermost_iter = ((comprehension_ty) - asdl_seq_GET(generators, 0))->iter; - - if (!compiler_enter_scope(c, name, (void *)e, e->lineno)) - goto error; - - if (type != COMP_GENEXP) { - int op; - switch (type) { - case COMP_SETCOMP: - op = BUILD_SET; - break; - case COMP_DICTCOMP: - op = BUILD_MAP; - break; - default: - PyErr_Format(PyExc_SystemError, - "unknown comprehension type %d", type); - goto error_in_scope; - } - - ADDOP_I(c, op, 0); - } - - if (!compiler_comprehension_generator(c, generators, 0, elt, - val, type)) - goto error_in_scope; - - if (type != COMP_GENEXP) { - ADDOP(c, RETURN_VALUE); - } - - co = assemble(c, 1); - compiler_exit_scope(c); - if (co == NULL) - goto error; - - if (!compiler_make_closure(c, co, 0)) - goto error; - Py_DECREF(co); - - VISIT(c, expr, outermost_iter); - ADDOP(c, GET_ITER); - ADDOP_I(c, CALL_FUNCTION, 1); - return 1; -error_in_scope: - compiler_exit_scope(c); -error: - Py_XDECREF(co); - return 0; -} - -static int -compiler_genexp(struct compiler *c, expr_ty e) -{ - static identifier name; - if (!name) { - name = PyString_FromString(""); - if (!name) - return 0; - } - assert(e->kind == GeneratorExp_kind); - return compiler_comprehension(c, e, COMP_GENEXP, name, - e->v.GeneratorExp.generators, - e->v.GeneratorExp.elt, NULL); -} - -static int -compiler_setcomp(struct compiler *c, expr_ty e) -{ - static identifier name; - if (!name) { - name = PyString_FromString(""); - if (!name) - return 0; - } - assert(e->kind == SetComp_kind); - return compiler_comprehension(c, e, COMP_SETCOMP, name, - e->v.SetComp.generators, - e->v.SetComp.elt, NULL); -} - -static int -compiler_dictcomp(struct compiler *c, expr_ty e) -{ - static identifier name; - if (!name) { - name = PyString_FromString(""); - if (!name) - return 0; - } - assert(e->kind == DictComp_kind); - return compiler_comprehension(c, e, COMP_DICTCOMP, name, - e->v.DictComp.generators, - e->v.DictComp.key, e->v.DictComp.value); -} - -static int -compiler_visit_keyword(struct compiler *c, keyword_ty k) -{ - ADDOP_O(c, LOAD_CONST, k->arg, consts); - VISIT(c, expr, k->value); - return 1; -} - -/* Test whether expression is constant. For constants, report - whether they are true or false. - - Return values: 1 for true, 0 for false, -1 for non-constant. - */ - -static int -expr_constant(expr_ty e) -{ - switch (e->kind) { - case Num_kind: - return PyObject_IsTrue(e->v.Num.n); - case Str_kind: - return PyObject_IsTrue(e->v.Str.s); - case Name_kind: - /* __debug__ is not assignable, so we can optimize - * it away in if and while statements */ - if (strcmp(PyString_AS_STRING(e->v.Name.id), - "__debug__") == 0) - return ! Py_OptimizeFlag; - /* fall through */ - default: - return -1; - } -} - -/* - Implements the with statement from PEP 343. - - The semantics outlined in that PEP are as follows: - - with EXPR as VAR: - BLOCK - - It is implemented roughly as: - - context = EXPR - exit = context.__exit__ # not calling it - value = context.__enter__() - try: - VAR = value # if VAR present in the syntax - BLOCK - finally: - if an exception was raised: - exc = copy of (exception, instance, traceback) - else: - exc = (None, None, None) - exit(*exc) - */ -static int -compiler_with(struct compiler *c, stmt_ty s) -{ - basicblock *block, *finally; - - assert(s->kind == With_kind); - - block = compiler_new_block(c); - finally = compiler_new_block(c); - if (!block || !finally) - return 0; - - /* Evaluate EXPR */ - VISIT(c, expr, s->v.With.context_expr); - ADDOP_JREL(c, SETUP_WITH, finally); - - /* SETUP_WITH pushes a finally block. */ - compiler_use_next_block(c, block); - /* Note that the block is actually called SETUP_WITH in ceval.c, but - functions the same as SETUP_FINALLY except that exceptions are - normalized. */ - if (!compiler_push_fblock(c, FINALLY_TRY, block)) { - return 0; - } - - if (s->v.With.optional_vars) { - VISIT(c, expr, s->v.With.optional_vars); - } - else { - /* Discard result from context.__enter__() */ - ADDOP(c, POP_TOP); - } - - /* BLOCK code */ - VISIT_SEQ(c, stmt, s->v.With.body); - - /* End of try block; start the finally block */ - ADDOP(c, POP_BLOCK); - compiler_pop_fblock(c, FINALLY_TRY, block); - - ADDOP_O(c, LOAD_CONST, Py_None, consts); - compiler_use_next_block(c, finally); - if (!compiler_push_fblock(c, FINALLY_END, finally)) - return 0; - - /* Finally block starts; context.__exit__ is on the stack under - the exception or return information. Just issue our magic - opcode. */ - ADDOP(c, WITH_CLEANUP); - - /* Finally block ends. */ - ADDOP(c, END_FINALLY); - compiler_pop_fblock(c, FINALLY_END, finally); - return 1; -} - -static int -compiler_visit_expr(struct compiler *c, expr_ty e) -{ - int i, n; - - /* If expr e has a different line number than the last expr/stmt, - set a new line number for the next instruction. - */ - if (e->lineno > c->u->u_lineno) { - c->u->u_lineno = e->lineno; - c->u->u_lineno_set = false; - } - switch (e->kind) { - case BoolOp_kind: - return compiler_boolop(c, e); - case BinOp_kind: - VISIT(c, expr, e->v.BinOp.left); - VISIT(c, expr, e->v.BinOp.right); - ADDOP(c, binop(c, e->v.BinOp.op)); - break; - case UnaryOp_kind: - VISIT(c, expr, e->v.UnaryOp.operand); - ADDOP(c, unaryop(e->v.UnaryOp.op)); - break; - case Lambda_kind: - return compiler_lambda(c, e); - case IfExp_kind: - return compiler_ifexp(c, e); - case Dict_kind: - n = asdl_seq_LEN(e->v.Dict.values); - ADDOP_I(c, BUILD_MAP, (n>0xFFFF ? 0xFFFF : n)); - for (i = 0; i < n; i++) { - VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Dict.values, i)); - VISIT(c, expr, - (expr_ty)asdl_seq_GET(e->v.Dict.keys, i)); - ADDOP(c, STORE_MAP); - } - break; - case Set_kind: - n = asdl_seq_LEN(e->v.Set.elts); - VISIT_SEQ(c, expr, e->v.Set.elts); - ADDOP_I(c, BUILD_SET, n); - break; - case ListComp_kind: - return compiler_listcomp(c, e); - case SetComp_kind: - return compiler_setcomp(c, e); - case DictComp_kind: - return compiler_dictcomp(c, e); - case GeneratorExp_kind: - return compiler_genexp(c, e); - case Yield_kind: - if (c->u->u_ste->ste_type != FunctionBlock) - return compiler_error(c, "'yield' outside function"); - if (e->v.Yield.value) { - VISIT(c, expr, e->v.Yield.value); - } - else { - ADDOP_O(c, LOAD_CONST, Py_None, consts); - } - ADDOP(c, YIELD_VALUE); - break; - case Compare_kind: - return compiler_compare(c, e); - case Call_kind: - return compiler_call(c, e); - case Repr_kind: - VISIT(c, expr, e->v.Repr.value); - ADDOP(c, UNARY_CONVERT); - break; - case Num_kind: - ADDOP_O(c, LOAD_CONST, e->v.Num.n, consts); - break; - case Str_kind: - ADDOP_O(c, LOAD_CONST, e->v.Str.s, consts); - break; - /* The following exprs can be assignment targets. */ - case Attribute_kind: - if (e->v.Attribute.ctx != AugStore) - VISIT(c, expr, e->v.Attribute.value); - switch (e->v.Attribute.ctx) { - case AugLoad: - ADDOP(c, DUP_TOP); - /* Fall through to load */ - case Load: - ADDOP_NAME(c, LOAD_ATTR, e->v.Attribute.attr, names); - break; - case AugStore: - ADDOP(c, ROT_TWO); - /* Fall through to save */ - case Store: - ADDOP_NAME(c, STORE_ATTR, e->v.Attribute.attr, names); - break; - case Del: - ADDOP_NAME(c, DELETE_ATTR, e->v.Attribute.attr, names); - break; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid in attribute expression"); - return 0; - } - break; - case Subscript_kind: - switch (e->v.Subscript.ctx) { - case AugLoad: - VISIT(c, expr, e->v.Subscript.value); - VISIT_SLICE(c, e->v.Subscript.slice, AugLoad); - break; - case Load: - VISIT(c, expr, e->v.Subscript.value); - VISIT_SLICE(c, e->v.Subscript.slice, Load); - break; - case AugStore: - VISIT_SLICE(c, e->v.Subscript.slice, AugStore); - break; - case Store: - VISIT(c, expr, e->v.Subscript.value); - VISIT_SLICE(c, e->v.Subscript.slice, Store); - break; - case Del: - VISIT(c, expr, e->v.Subscript.value); - VISIT_SLICE(c, e->v.Subscript.slice, Del); - break; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid in subscript expression"); - return 0; - } - break; - case Name_kind: - return compiler_nameop(c, e->v.Name.id, e->v.Name.ctx); - /* child nodes of List and Tuple will have expr_context set */ - case List_kind: - return compiler_list(c, e); - case Tuple_kind: - return compiler_tuple(c, e); - } - return 1; -} - -static int -compiler_augassign(struct compiler *c, stmt_ty s) -{ - expr_ty e = s->v.AugAssign.target; - expr_ty auge; - - assert(s->kind == AugAssign_kind); - - switch (e->kind) { - case Attribute_kind: - auge = Attribute(e->v.Attribute.value, e->v.Attribute.attr, - AugLoad, e->lineno, e->col_offset, c->c_arena); - if (auge == NULL) - return 0; - VISIT(c, expr, auge); - VISIT(c, expr, s->v.AugAssign.value); - ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); - auge->v.Attribute.ctx = AugStore; - VISIT(c, expr, auge); - break; - case Subscript_kind: - auge = Subscript(e->v.Subscript.value, e->v.Subscript.slice, - AugLoad, e->lineno, e->col_offset, c->c_arena); - if (auge == NULL) - return 0; - VISIT(c, expr, auge); - VISIT(c, expr, s->v.AugAssign.value); - ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); - auge->v.Subscript.ctx = AugStore; - VISIT(c, expr, auge); - break; - case Name_kind: - if (!compiler_nameop(c, e->v.Name.id, Load)) - return 0; - VISIT(c, expr, s->v.AugAssign.value); - ADDOP(c, inplace_binop(c, s->v.AugAssign.op)); - return compiler_nameop(c, e->v.Name.id, Store); - default: - PyErr_Format(PyExc_SystemError, - "invalid node type (%d) for augmented assignment", - e->kind); - return 0; - } - return 1; -} - -static int -compiler_push_fblock(struct compiler *c, enum fblocktype t, basicblock *b) -{ - struct fblockinfo *f; - if (c->u->u_nfblocks >= CO_MAXBLOCKS) { - PyErr_SetString(PyExc_SystemError, - "too many statically nested blocks"); - return 0; - } - f = &c->u->u_fblock[c->u->u_nfblocks++]; - f->fb_type = t; - f->fb_block = b; - return 1; -} - -static void -compiler_pop_fblock(struct compiler *c, enum fblocktype t, basicblock *b) -{ - struct compiler_unit *u = c->u; - assert(u->u_nfblocks > 0); - u->u_nfblocks--; - assert(u->u_fblock[u->u_nfblocks].fb_type == t); - assert(u->u_fblock[u->u_nfblocks].fb_block == b); -} - -static int -compiler_in_loop(struct compiler *c) { - int i; - struct compiler_unit *u = c->u; - for (i = 0; i < u->u_nfblocks; ++i) { - if (u->u_fblock[i].fb_type == LOOP) - return 1; - } - return 0; -} -/* Raises a SyntaxError and returns 0. - If something goes wrong, a different exception may be raised. -*/ - -static int -compiler_error(struct compiler *c, const char *errstr) -{ - PyObject *loc; - PyObject *u = NULL, *v = NULL; - - loc = PyErr_ProgramText(c->c_filename, c->u->u_lineno); - if (!loc) { - Py_INCREF(Py_None); - loc = Py_None; - } - u = Py_BuildValue("(ziOO)", c->c_filename, c->u->u_lineno, - Py_None, loc); - if (!u) - goto exit; - v = Py_BuildValue("(zO)", errstr, u); - if (!v) - goto exit; - PyErr_SetObject(PyExc_SyntaxError, v); - exit: - Py_DECREF(loc); - Py_XDECREF(u); - Py_XDECREF(v); - return 0; -} - -static int -compiler_handle_subscr(struct compiler *c, const char *kind, - expr_context_ty ctx) -{ - int op = 0; - - /* XXX this code is duplicated */ - switch (ctx) { - case AugLoad: /* fall through to Load */ - case Load: op = BINARY_SUBSCR; break; - case AugStore:/* fall through to Store */ - case Store: op = STORE_SUBSCR; break; - case Del: op = DELETE_SUBSCR; break; - case Param: - PyErr_Format(PyExc_SystemError, - "invalid %s kind %d in subscript\n", - kind, ctx); - return 0; - } - if (ctx == AugLoad) { - ADDOP_I(c, DUP_TOPX, 2); - } - else if (ctx == AugStore) { - ADDOP(c, ROT_THREE); - } - ADDOP(c, op); - return 1; -} - -static int -compiler_slice(struct compiler *c, slice_ty s, expr_context_ty ctx) -{ - int n = 2; - assert(s->kind == Slice_kind); - - /* only handles the cases where BUILD_SLICE is emitted */ - if (s->v.Slice.lower) { - VISIT(c, expr, s->v.Slice.lower); - } - else { - ADDOP_O(c, LOAD_CONST, Py_None, consts); - } - - if (s->v.Slice.upper) { - VISIT(c, expr, s->v.Slice.upper); - } - else { - ADDOP_O(c, LOAD_CONST, Py_None, consts); - } - - if (s->v.Slice.step) { - n++; - VISIT(c, expr, s->v.Slice.step); - } - ADDOP_I(c, BUILD_SLICE, n); - return 1; -} - -static int -compiler_simple_slice(struct compiler *c, slice_ty s, expr_context_ty ctx) -{ - int op = 0, slice_offset = 0, stack_count = 0; - - assert(s->v.Slice.step == NULL); - if (s->v.Slice.lower) { - slice_offset++; - stack_count++; - if (ctx != AugStore) - VISIT(c, expr, s->v.Slice.lower); - } - if (s->v.Slice.upper) { - slice_offset += 2; - stack_count++; - if (ctx != AugStore) - VISIT(c, expr, s->v.Slice.upper); - } - - if (ctx == AugLoad) { - switch (stack_count) { - case 0: ADDOP(c, DUP_TOP); break; - case 1: ADDOP_I(c, DUP_TOPX, 2); break; - case 2: ADDOP_I(c, DUP_TOPX, 3); break; - } - } - else if (ctx == AugStore) { - switch (stack_count) { - case 0: ADDOP(c, ROT_TWO); break; - case 1: ADDOP(c, ROT_THREE); break; - case 2: ADDOP(c, ROT_FOUR); break; - } - } - - switch (ctx) { - case AugLoad: /* fall through to Load */ - case Load: op = SLICE; break; - case AugStore:/* fall through to Store */ - case Store: op = STORE_SLICE; break; - case Del: op = DELETE_SLICE; break; - case Param: - default: - PyErr_SetString(PyExc_SystemError, - "param invalid in simple slice"); - return 0; - } - - ADDOP(c, op + slice_offset); - return 1; -} - -static int -compiler_visit_nested_slice(struct compiler *c, slice_ty s, - expr_context_ty ctx) -{ - switch (s->kind) { - case Ellipsis_kind: - ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts); - break; - case Slice_kind: - return compiler_slice(c, s, ctx); - case Index_kind: - VISIT(c, expr, s->v.Index.value); - break; - case ExtSlice_kind: - default: - PyErr_SetString(PyExc_SystemError, - "extended slice invalid in nested slice"); - return 0; - } - return 1; -} - -static int -compiler_visit_slice(struct compiler *c, slice_ty s, expr_context_ty ctx) -{ - char * kindname = NULL; - switch (s->kind) { - case Index_kind: - kindname = "index"; - if (ctx != AugStore) { - VISIT(c, expr, s->v.Index.value); - } - break; - case Ellipsis_kind: - kindname = "ellipsis"; - if (ctx != AugStore) { - ADDOP_O(c, LOAD_CONST, Py_Ellipsis, consts); - } - break; - case Slice_kind: - kindname = "slice"; - if (!s->v.Slice.step) - return compiler_simple_slice(c, s, ctx); - if (ctx != AugStore) { - if (!compiler_slice(c, s, ctx)) - return 0; - } - break; - case ExtSlice_kind: - kindname = "extended slice"; - if (ctx != AugStore) { - int i, n = asdl_seq_LEN(s->v.ExtSlice.dims); - for (i = 0; i < n; i++) { - slice_ty sub = (slice_ty)asdl_seq_GET( - s->v.ExtSlice.dims, i); - if (!compiler_visit_nested_slice(c, sub, ctx)) - return 0; - } - ADDOP_I(c, BUILD_TUPLE, n); - } - break; - default: - PyErr_Format(PyExc_SystemError, - "invalid subscript kind %d", s->kind); - return 0; - } - return compiler_handle_subscr(c, kindname, ctx); -} - - -/* End of the compiler section, beginning of the assembler section */ - -/* do depth-first search of basic block graph, starting with block. - post records the block indices in post-order. - - XXX must handle implicit jumps from one block to next -*/ - -struct assembler { - PyObject *a_bytecode; /* string containing bytecode */ - int a_offset; /* offset into bytecode */ - int a_nblocks; /* number of reachable blocks */ - basicblock **a_postorder; /* list of blocks in dfs postorder */ - PyObject *a_lnotab; /* string containing lnotab */ - int a_lnotab_off; /* offset into lnotab */ - int a_lineno; /* last lineno of emitted instruction */ - int a_lineno_off; /* bytecode offset of last lineno */ -}; - -static void -dfs(struct compiler *c, basicblock *b, struct assembler *a) -{ - int i; - struct instr *instr = NULL; - - if (b->b_seen) - return; - b->b_seen = 1; - if (b->b_next != NULL) - dfs(c, b->b_next, a); - for (i = 0; i < b->b_iused; i++) { - instr = &b->b_instr[i]; - if (instr->i_jrel || instr->i_jabs) - dfs(c, instr->i_target, a); - } - a->a_postorder[a->a_nblocks++] = b; -} - -static int -stackdepth_walk(struct compiler *c, basicblock *b, int depth, int maxdepth) -{ - int i, target_depth; - struct instr *instr; - if (b->b_seen || b->b_startdepth >= depth) - return maxdepth; - b->b_seen = 1; - b->b_startdepth = depth; - for (i = 0; i < b->b_iused; i++) { - instr = &b->b_instr[i]; - depth += opcode_stack_effect(instr->i_opcode, instr->i_oparg); - if (depth > maxdepth) - maxdepth = depth; - assert(depth >= 0); /* invalid code or bug in stackdepth() */ - if (instr->i_jrel || instr->i_jabs) { - target_depth = depth; - if (instr->i_opcode == FOR_ITER) { - target_depth = depth-2; - } - else if (instr->i_opcode == SETUP_FINALLY || - instr->i_opcode == SETUP_EXCEPT) { - target_depth = depth+3; - if (target_depth > maxdepth) - maxdepth = target_depth; - } - else if (instr->i_opcode == JUMP_IF_TRUE_OR_POP || - instr->i_opcode == JUMP_IF_FALSE_OR_POP) - depth = depth - 1; - maxdepth = stackdepth_walk(c, instr->i_target, - target_depth, maxdepth); - if (instr->i_opcode == JUMP_ABSOLUTE || - instr->i_opcode == JUMP_FORWARD) { - goto out; /* remaining code is dead */ - } - } - } - if (b->b_next) - maxdepth = stackdepth_walk(c, b->b_next, depth, maxdepth); -out: - b->b_seen = 0; - return maxdepth; -} - -/* Find the flow path that needs the largest stack. We assume that - * cycles in the flow graph have no net effect on the stack depth. - */ -static int -stackdepth(struct compiler *c) -{ - basicblock *b, *entryblock; - entryblock = NULL; - for (b = c->u->u_blocks; b != NULL; b = b->b_list) { - b->b_seen = 0; - b->b_startdepth = INT_MIN; - entryblock = b; - } - if (!entryblock) - return 0; - return stackdepth_walk(c, entryblock, 0, 0); -} - -static int -assemble_init(struct assembler *a, int nblocks, int firstlineno) -{ - memset(a, 0, sizeof(struct assembler)); - a->a_lineno = firstlineno; - a->a_bytecode = PyString_FromStringAndSize(NULL, DEFAULT_CODE_SIZE); - if (!a->a_bytecode) - return 0; - a->a_lnotab = PyString_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE); - if (!a->a_lnotab) - return 0; - if (nblocks > PY_SIZE_MAX / sizeof(basicblock *)) { - PyErr_NoMemory(); - return 0; - } - a->a_postorder = (basicblock **)PyObject_Malloc( - sizeof(basicblock *) * nblocks); - if (!a->a_postorder) { - PyErr_NoMemory(); - return 0; - } - return 1; -} - -static void -assemble_free(struct assembler *a) -{ - Py_XDECREF(a->a_bytecode); - Py_XDECREF(a->a_lnotab); - if (a->a_postorder) - PyObject_Free(a->a_postorder); -} - -/* Return the size of a basic block in bytes. */ - -static int -instrsize(struct instr *instr) -{ - if (!instr->i_hasarg) - return 1; /* 1 byte for the opcode*/ - if (instr->i_oparg > 0xffff) - return 6; /* 1 (opcode) + 1 (EXTENDED_ARG opcode) + 2 (oparg) + 2(oparg extended) */ - return 3; /* 1 (opcode) + 2 (oparg) */ -} - -static int -blocksize(basicblock *b) -{ - int i; - int size = 0; - - for (i = 0; i < b->b_iused; i++) - size += instrsize(&b->b_instr[i]); - return size; -} - -/* Appends a pair to the end of the line number table, a_lnotab, representing - the instruction's bytecode offset and line number. See - Objects/lnotab_notes.txt for the description of the line number table. */ - -static int -assemble_lnotab(struct assembler *a, struct instr *i) -{ - int d_bytecode, d_lineno; - int len; - unsigned char *lnotab; - - d_bytecode = a->a_offset - a->a_lineno_off; - d_lineno = i->i_lineno - a->a_lineno; - - assert(d_bytecode >= 0); - assert(d_lineno >= 0); - - if(d_bytecode == 0 && d_lineno == 0) - return 1; - - if (d_bytecode > 255) { - int j, nbytes, ncodes = d_bytecode / 255; - nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyString_GET_SIZE(a->a_lnotab); - if (nbytes >= len) { - if ((len <= INT_MAX / 2) && (len * 2 < nbytes)) - len = nbytes; - else if (len <= INT_MAX / 2) - len *= 2; - else { - PyErr_NoMemory(); - return 0; - } - if (_PyString_Resize(&a->a_lnotab, len) < 0) - return 0; - } - lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; - for (j = 0; j < ncodes; j++) { - *lnotab++ = 255; - *lnotab++ = 0; - } - d_bytecode -= ncodes * 255; - a->a_lnotab_off += ncodes * 2; - } - assert(d_bytecode <= 255); - if (d_lineno > 255) { - int j, nbytes, ncodes = d_lineno / 255; - nbytes = a->a_lnotab_off + 2 * ncodes; - len = PyString_GET_SIZE(a->a_lnotab); - if (nbytes >= len) { - if ((len <= INT_MAX / 2) && len * 2 < nbytes) - len = nbytes; - else if (len <= INT_MAX / 2) - len *= 2; - else { - PyErr_NoMemory(); - return 0; - } - if (_PyString_Resize(&a->a_lnotab, len) < 0) - return 0; - } - lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; - *lnotab++ = d_bytecode; - *lnotab++ = 255; - d_bytecode = 0; - for (j = 1; j < ncodes; j++) { - *lnotab++ = 0; - *lnotab++ = 255; - } - d_lineno -= ncodes * 255; - a->a_lnotab_off += ncodes * 2; - } - - len = PyString_GET_SIZE(a->a_lnotab); - if (a->a_lnotab_off + 2 >= len) { - if (_PyString_Resize(&a->a_lnotab, len * 2) < 0) - return 0; - } - lnotab = (unsigned char *) - PyString_AS_STRING(a->a_lnotab) + a->a_lnotab_off; - - a->a_lnotab_off += 2; - if (d_bytecode) { - *lnotab++ = d_bytecode; - *lnotab++ = d_lineno; - } - else { /* First line of a block; def stmt, etc. */ - *lnotab++ = 0; - *lnotab++ = d_lineno; - } - a->a_lineno = i->i_lineno; - a->a_lineno_off = a->a_offset; - return 1; -} - -/* assemble_emit() - Extend the bytecode with a new instruction. - Update lnotab if necessary. -*/ - -static int -assemble_emit(struct assembler *a, struct instr *i) -{ - int size, arg = 0, ext = 0; - Py_ssize_t len = PyString_GET_SIZE(a->a_bytecode); - char *code; - - size = instrsize(i); - if (i->i_hasarg) { - arg = i->i_oparg; - ext = arg >> 16; - } - if (i->i_lineno && !assemble_lnotab(a, i)) - return 0; - if (a->a_offset + size >= len) { - if (len > PY_SSIZE_T_MAX / 2) - return 0; - if (_PyString_Resize(&a->a_bytecode, len * 2) < 0) - return 0; - } - code = PyString_AS_STRING(a->a_bytecode) + a->a_offset; - a->a_offset += size; - if (size == 6) { - assert(i->i_hasarg); - *code++ = (char)EXTENDED_ARG; - *code++ = ext & 0xff; - *code++ = ext >> 8; - arg &= 0xffff; - } - *code++ = i->i_opcode; - if (i->i_hasarg) { - assert(size == 3 || size == 6); - *code++ = arg & 0xff; - *code++ = arg >> 8; - } - return 1; -} - -static void -assemble_jump_offsets(struct assembler *a, struct compiler *c) -{ - basicblock *b; - int bsize, totsize, extended_arg_count = 0, last_extended_arg_count; - int i; - - /* Compute the size of each block and fixup jump args. - Replace block pointer with position in bytecode. */ - do { - totsize = 0; - for (i = a->a_nblocks - 1; i >= 0; i--) { - b = a->a_postorder[i]; - bsize = blocksize(b); - b->b_offset = totsize; - totsize += bsize; - } - last_extended_arg_count = extended_arg_count; - extended_arg_count = 0; - for (b = c->u->u_blocks; b != NULL; b = b->b_list) { - bsize = b->b_offset; - for (i = 0; i < b->b_iused; i++) { - struct instr *instr = &b->b_instr[i]; - /* Relative jumps are computed relative to - the instruction pointer after fetching - the jump instruction. - */ - bsize += instrsize(instr); - if (instr->i_jabs) - instr->i_oparg = instr->i_target->b_offset; - else if (instr->i_jrel) { - int delta = instr->i_target->b_offset - bsize; - instr->i_oparg = delta; - } - else - continue; - if (instr->i_oparg > 0xffff) - extended_arg_count++; - } - } - - /* XXX: This is an awful hack that could hurt performance, but - on the bright side it should work until we come up - with a better solution. - - The issue is that in the first loop blocksize() is called - which calls instrsize() which requires i_oparg be set - appropriately. There is a bootstrap problem because - i_oparg is calculated in the second loop above. - - So we loop until we stop seeing new EXTENDED_ARGs. - The only EXTENDED_ARGs that could be popping up are - ones in jump instructions. So this should converge - fairly quickly. - */ - } while (last_extended_arg_count != extended_arg_count); -} - -static PyObject * -dict_keys_inorder(PyObject *dict, int offset) -{ - PyObject *tuple, *k, *v; - Py_ssize_t i, pos = 0, size = PyDict_Size(dict); - - tuple = PyTuple_New(size); - if (tuple == NULL) - return NULL; - while (PyDict_Next(dict, &pos, &k, &v)) { - i = PyInt_AS_LONG(v); - /* The keys of the dictionary are tuples. (see compiler_add_o) - The object we want is always first, though. */ - k = PyTuple_GET_ITEM(k, 0); - Py_INCREF(k); - assert((i - offset) < size); - assert((i - offset) >= 0); - PyTuple_SET_ITEM(tuple, i - offset, k); - } - return tuple; -} - -static int -compute_code_flags(struct compiler *c) -{ - PySTEntryObject *ste = c->u->u_ste; - int flags = 0, n; - if (ste->ste_type != ModuleBlock) - flags |= CO_NEWLOCALS; - if (ste->ste_type == FunctionBlock) { - if (!ste->ste_unoptimized) - flags |= CO_OPTIMIZED; - if (ste->ste_nested) - flags |= CO_NESTED; - if (ste->ste_generator) - flags |= CO_GENERATOR; - if (ste->ste_varargs) - flags |= CO_VARARGS; - if (ste->ste_varkeywords) - flags |= CO_VARKEYWORDS; - } - - /* (Only) inherit compilerflags in PyCF_MASK */ - flags |= (c->c_flags->cf_flags & PyCF_MASK); - - n = PyDict_Size(c->u->u_freevars); - if (n < 0) - return -1; - if (n == 0) { - n = PyDict_Size(c->u->u_cellvars); - if (n < 0) - return -1; - if (n == 0) { - flags |= CO_NOFREE; - } - } - - return flags; -} - -static PyCodeObject * -makecode(struct compiler *c, struct assembler *a) -{ - PyObject *tmp; - PyCodeObject *co = NULL; - PyObject *consts = NULL; - PyObject *names = NULL; - PyObject *varnames = NULL; - PyObject *filename = NULL; - PyObject *name = NULL; - PyObject *freevars = NULL; - PyObject *cellvars = NULL; - PyObject *bytecode = NULL; - int nlocals, flags; - - tmp = dict_keys_inorder(c->u->u_consts, 0); - if (!tmp) - goto error; - consts = PySequence_List(tmp); /* optimize_code requires a list */ - Py_DECREF(tmp); - - names = dict_keys_inorder(c->u->u_names, 0); - varnames = dict_keys_inorder(c->u->u_varnames, 0); - if (!consts || !names || !varnames) - goto error; - - cellvars = dict_keys_inorder(c->u->u_cellvars, 0); - if (!cellvars) - goto error; - freevars = dict_keys_inorder(c->u->u_freevars, PyTuple_Size(cellvars)); - if (!freevars) - goto error; - filename = PyString_FromString(c->c_filename); - if (!filename) - goto error; - - nlocals = PyDict_Size(c->u->u_varnames); - flags = compute_code_flags(c); - if (flags < 0) - goto error; - - bytecode = PyCode_Optimize(a->a_bytecode, consts, names, a->a_lnotab); - if (!bytecode) - goto error; - - tmp = PyList_AsTuple(consts); /* PyCode_New requires a tuple */ - if (!tmp) - goto error; - Py_DECREF(consts); - consts = tmp; - - co = PyCode_New(c->u->u_argcount, nlocals, stackdepth(c), flags, - bytecode, consts, names, varnames, - freevars, cellvars, - filename, c->u->u_name, - c->u->u_firstlineno, - a->a_lnotab); - error: - Py_XDECREF(consts); - Py_XDECREF(names); - Py_XDECREF(varnames); - Py_XDECREF(filename); - Py_XDECREF(name); - Py_XDECREF(freevars); - Py_XDECREF(cellvars); - Py_XDECREF(bytecode); - return co; -} - - -/* For debugging purposes only */ -#if 0 -static void -dump_instr(const struct instr *i) -{ - const char *jrel = i->i_jrel ? "jrel " : ""; - const char *jabs = i->i_jabs ? "jabs " : ""; - char arg[128]; - - *arg = '\0'; - if (i->i_hasarg) - sprintf(arg, "arg: %d ", i->i_oparg); - - fprintf(stderr, "line: %d, opcode: %d %s%s%s\n", - i->i_lineno, i->i_opcode, arg, jabs, jrel); -} - -static void -dump_basicblock(const basicblock *b) -{ - const char *seen = b->b_seen ? "seen " : ""; - const char *b_return = b->b_return ? "return " : ""; - fprintf(stderr, "used: %d, depth: %d, offset: %d %s%s\n", - b->b_iused, b->b_startdepth, b->b_offset, seen, b_return); - if (b->b_instr) { - int i; - for (i = 0; i < b->b_iused; i++) { - fprintf(stderr, " [%02d] ", i); - dump_instr(b->b_instr + i); - } - } -} -#endif - -static PyCodeObject * -assemble(struct compiler *c, int addNone) -{ - basicblock *b, *entryblock; - struct assembler a; - int i, j, nblocks; - PyCodeObject *co = NULL; - - /* Make sure every block that falls off the end returns None. - XXX NEXT_BLOCK() isn't quite right, because if the last - block ends with a jump or return b_next shouldn't set. - */ - if (!c->u->u_curblock->b_return) { - NEXT_BLOCK(c); - if (addNone) - ADDOP_O(c, LOAD_CONST, Py_None, consts); - ADDOP(c, RETURN_VALUE); - } - - nblocks = 0; - entryblock = NULL; - for (b = c->u->u_blocks; b != NULL; b = b->b_list) { - nblocks++; - entryblock = b; - } - - /* Set firstlineno if it wasn't explicitly set. */ - if (!c->u->u_firstlineno) { - if (entryblock && entryblock->b_instr) - c->u->u_firstlineno = entryblock->b_instr->i_lineno; - else - c->u->u_firstlineno = 1; - } - if (!assemble_init(&a, nblocks, c->u->u_firstlineno)) - goto error; - dfs(c, entryblock, &a); - - /* Can't modify the bytecode after computing jump offsets. */ - assemble_jump_offsets(&a, c); - - /* Emit code in reverse postorder from dfs. */ - for (i = a.a_nblocks - 1; i >= 0; i--) { - b = a.a_postorder[i]; - for (j = 0; j < b->b_iused; j++) - if (!assemble_emit(&a, &b->b_instr[j])) - goto error; - } - - if (_PyString_Resize(&a.a_lnotab, a.a_lnotab_off) < 0) - goto error; - if (_PyString_Resize(&a.a_bytecode, a.a_offset) < 0) - goto error; - - co = makecode(c, &a); - error: - assemble_free(&a); - return co; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/dtoa.c b/AppPkg/Applications/Python/Python-2.7.10/Python/dtoa.c deleted file mode 100644 index 655e366..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/dtoa.c +++ /dev/null @@ -1,2949 +0,0 @@ -/**************************************************************** - * - * The author of this software is David M. Gay. - * - * Copyright (c) 1991, 2000, 2001 by Lucent Technologies. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose without fee is hereby granted, provided that this entire notice - * is included in all copies of any software which is or includes a copy - * or modification of this software and in all copies of the supporting - * documentation for such software. - * - * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTY. IN PARTICULAR, NEITHER THE AUTHOR NOR LUCENT MAKES ANY - * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE MERCHANTABILITY - * OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR PURPOSE. - * - ***************************************************************/ - -/**************************************************************** - * This is dtoa.c by David M. Gay, downloaded from - * http://www.netlib.org/fp/dtoa.c on April 15, 2009 and modified for - * inclusion into the Python core by Mark E. T. Dickinson and Eric V. Smith. - * - * Please remember to check http://www.netlib.org/fp regularly (and especially - * before any Python release) for bugfixes and updates. - * - * The major modifications from Gay's original code are as follows: - * - * 0. The original code has been specialized to Python's needs by removing - * many of the #ifdef'd sections. In particular, code to support VAX and - * IBM floating-point formats, hex NaNs, hex floats, locale-aware - * treatment of the decimal point, and setting of the inexact flag have - * been removed. - * - * 1. We use PyMem_Malloc and PyMem_Free in place of malloc and free. - * - * 2. The public functions strtod, dtoa and freedtoa all now have - * a _Py_dg_ prefix. - * - * 3. Instead of assuming that PyMem_Malloc always succeeds, we thread - * PyMem_Malloc failures through the code. The functions - * - * Balloc, multadd, s2b, i2b, mult, pow5mult, lshift, diff, d2b - * - * of return type *Bigint all return NULL to indicate a malloc failure. - * Similarly, rv_alloc and nrv_alloc (return type char *) return NULL on - * failure. bigcomp now has return type int (it used to be void) and - * returns -1 on failure and 0 otherwise. _Py_dg_dtoa returns NULL - * on failure. _Py_dg_strtod indicates failure due to malloc failure - * by returning -1.0, setting errno=ENOMEM and *se to s00. - * - * 4. The static variable dtoa_result has been removed. Callers of - * _Py_dg_dtoa are expected to call _Py_dg_freedtoa to free - * the memory allocated by _Py_dg_dtoa. - * - * 5. The code has been reformatted to better fit with Python's - * C style guide (PEP 7). - * - * 6. A bug in the memory allocation has been fixed: to avoid FREEing memory - * that hasn't been MALLOC'ed, private_mem should only be used when k <= - * Kmax. - * - * 7. _Py_dg_strtod has been modified so that it doesn't accept strings with - * leading whitespace. - * - ***************************************************************/ - -/* Please send bug reports for the original dtoa.c code to David M. Gay (dmg - * at acm dot org, with " at " changed at "@" and " dot " changed to "."). - * Please report bugs for this modified version using the Python issue tracker - * (http://bugs.python.org). */ - -/* On a machine with IEEE extended-precision registers, it is - * necessary to specify double-precision (53-bit) rounding precision - * before invoking strtod or dtoa. If the machine uses (the equivalent - * of) Intel 80x87 arithmetic, the call - * _control87(PC_53, MCW_PC); - * does this with many compilers. Whether this or another call is - * appropriate depends on the compiler; for this to work, it may be - * necessary to #include "float.h" or another system-dependent header - * file. - */ - -/* strtod for IEEE-, VAX-, and IBM-arithmetic machines. - * - * This strtod returns a nearest machine number to the input decimal - * string (or sets errno to ERANGE). With IEEE arithmetic, ties are - * broken by the IEEE round-even rule. Otherwise ties are broken by - * biased rounding (add half and chop). - * - * Inspired loosely by William D. Clinger's paper "How to Read Floating - * Point Numbers Accurately" [Proc. ACM SIGPLAN '90, pp. 92-101]. - * - * Modifications: - * - * 1. We only require IEEE, IBM, or VAX double-precision - * arithmetic (not IEEE double-extended). - * 2. We get by with floating-point arithmetic in a case that - * Clinger missed -- when we're computing d * 10^n - * for a small integer d and the integer n is not too - * much larger than 22 (the maximum integer k for which - * we can represent 10^k exactly), we may be able to - * compute (d*10^k) * 10^(e-k) with just one roundoff. - * 3. Rather than a bit-at-a-time adjustment of the binary - * result in the hard case, we use floating-point - * arithmetic to determine the adjustment to within - * one bit; only in really hard cases do we need to - * compute a second residual. - * 4. Because of 3., we don't need a large table of powers of 10 - * for ten-to-e (just some small tables, e.g. of 10^k - * for 0 <= k <= 22). - */ - -/* Linking of Python's #defines to Gay's #defines starts here. */ - -#include "Python.h" - -/* if PY_NO_SHORT_FLOAT_REPR is defined, then don't even try to compile - the following code */ -#ifndef PY_NO_SHORT_FLOAT_REPR - -#include "float.h" - -#define MALLOC PyMem_Malloc -#define FREE PyMem_Free - -/* This code should also work for ARM mixed-endian format on little-endian - machines, where doubles have byte order 45670123 (in increasing address - order, 0 being the least significant byte). */ -#ifdef DOUBLE_IS_LITTLE_ENDIAN_IEEE754 -# define IEEE_8087 -#endif -#if defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) || \ - defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754) -# define IEEE_MC68k -#endif -#if defined(IEEE_8087) + defined(IEEE_MC68k) != 1 -#error "Exactly one of IEEE_8087 or IEEE_MC68k should be defined." -#endif - -/* The code below assumes that the endianness of integers matches the - endianness of the two 32-bit words of a double. Check this. */ -#if defined(WORDS_BIGENDIAN) && (defined(DOUBLE_IS_LITTLE_ENDIAN_IEEE754) || \ - defined(DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754)) -#error "doubles and ints have incompatible endianness" -#endif - -#if !defined(WORDS_BIGENDIAN) && defined(DOUBLE_IS_BIG_ENDIAN_IEEE754) -#error "doubles and ints have incompatible endianness" -#endif - - -#if defined(HAVE_UINT32_T) && defined(HAVE_INT32_T) -typedef PY_UINT32_T ULong; -typedef PY_INT32_T Long; -#else -#error "Failed to find an exact-width 32-bit integer type" -#endif - -#if defined(HAVE_UINT64_T) -#define ULLong PY_UINT64_T -#else -#undef ULLong -#endif - -#undef DEBUG -#ifdef Py_DEBUG -#define DEBUG -#endif - -/* End Python #define linking */ - -#ifdef DEBUG -#define Bug(x) {fprintf(stderr, "%s\n", x); exit(1);} -#endif - -#ifndef PRIVATE_MEM -#define PRIVATE_MEM 2304 -#endif -#define PRIVATE_mem ((PRIVATE_MEM+sizeof(double)-1)/sizeof(double)) -static double private_mem[PRIVATE_mem], *pmem_next = private_mem; - -#ifdef __cplusplus -extern "C" { -#endif - -typedef union { double d; ULong L[2]; } U; - -#ifdef IEEE_8087 -#define word0(x) (x)->L[1] -#define word1(x) (x)->L[0] -#else -#define word0(x) (x)->L[0] -#define word1(x) (x)->L[1] -#endif -#define dval(x) (x)->d - -#ifndef STRTOD_DIGLIM -#define STRTOD_DIGLIM 40 -#endif - -/* maximum permitted exponent value for strtod; exponents larger than - MAX_ABS_EXP in absolute value get truncated to +-MAX_ABS_EXP. MAX_ABS_EXP - should fit into an int. */ -#ifndef MAX_ABS_EXP -#define MAX_ABS_EXP 1100000000U -#endif -/* Bound on length of pieces of input strings in _Py_dg_strtod; specifically, - this is used to bound the total number of digits ignoring leading zeros and - the number of digits that follow the decimal point. Ideally, MAX_DIGITS - should satisfy MAX_DIGITS + 400 < MAX_ABS_EXP; that ensures that the - exponent clipping in _Py_dg_strtod can't affect the value of the output. */ -#ifndef MAX_DIGITS -#define MAX_DIGITS 1000000000U -#endif - -/* Guard against trying to use the above values on unusual platforms with ints - * of width less than 32 bits. */ -#if MAX_ABS_EXP > INT_MAX -#error "MAX_ABS_EXP should fit in an int" -#endif -#if MAX_DIGITS > INT_MAX -#error "MAX_DIGITS should fit in an int" -#endif - -/* The following definition of Storeinc is appropriate for MIPS processors. - * An alternative that might be better on some machines is - * #define Storeinc(a,b,c) (*a++ = b << 16 | c & 0xffff) - */ -#if defined(IEEE_8087) -#define Storeinc(a,b,c) (((unsigned short *)a)[1] = (unsigned short)b, \ - ((unsigned short *)a)[0] = (unsigned short)c, a++) -#else -#define Storeinc(a,b,c) (((unsigned short *)a)[0] = (unsigned short)b, \ - ((unsigned short *)a)[1] = (unsigned short)c, a++) -#endif - -/* #define P DBL_MANT_DIG */ -/* Ten_pmax = floor(P*log(2)/log(5)) */ -/* Bletch = (highest power of 2 < DBL_MAX_10_EXP) / 16 */ -/* Quick_max = floor((P-1)*log(FLT_RADIX)/log(10) - 1) */ -/* Int_max = floor(P*log(FLT_RADIX)/log(10) - 1) */ - -#define Exp_shift 20 -#define Exp_shift1 20 -#define Exp_msk1 0x100000 -#define Exp_msk11 0x100000 -#define Exp_mask 0x7ff00000 -#define P 53 -#define Nbits 53 -#define Bias 1023 -#define Emax 1023 -#define Emin (-1022) -#define Etiny (-1074) /* smallest denormal is 2**Etiny */ -#define Exp_1 0x3ff00000 -#define Exp_11 0x3ff00000 -#define Ebits 11 -#define Frac_mask 0xfffff -#define Frac_mask1 0xfffff -#define Ten_pmax 22 -#define Bletch 0x10 -#define Bndry_mask 0xfffff -#define Bndry_mask1 0xfffff -#define Sign_bit 0x80000000 -#define Log2P 1 -#define Tiny0 0 -#define Tiny1 1 -#define Quick_max 14 -#define Int_max 14 - -#ifndef Flt_Rounds -#ifdef FLT_ROUNDS -#define Flt_Rounds FLT_ROUNDS -#else -#define Flt_Rounds 1 -#endif -#endif /*Flt_Rounds*/ - -#define Rounding Flt_Rounds - -#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1)) -#define Big1 0xffffffff - -/* struct BCinfo is used to pass information from _Py_dg_strtod to bigcomp */ - -typedef struct BCinfo BCinfo; -struct -BCinfo { - int e0, nd, nd0, scale; -}; - -#define FFFFFFFF 0xffffffffUL - -#define Kmax 7 - -/* struct Bigint is used to represent arbitrary-precision integers. These - integers are stored in sign-magnitude format, with the magnitude stored as - an array of base 2**32 digits. Bigints are always normalized: if x is a - Bigint then x->wds >= 1, and either x->wds == 1 or x[wds-1] is nonzero. - - The Bigint fields are as follows: - - - next is a header used by Balloc and Bfree to keep track of lists - of freed Bigints; it's also used for the linked list of - powers of 5 of the form 5**2**i used by pow5mult. - - k indicates which pool this Bigint was allocated from - - maxwds is the maximum number of words space was allocated for - (usually maxwds == 2**k) - - sign is 1 for negative Bigints, 0 for positive. The sign is unused - (ignored on inputs, set to 0 on outputs) in almost all operations - involving Bigints: a notable exception is the diff function, which - ignores signs on inputs but sets the sign of the output correctly. - - wds is the actual number of significant words - - x contains the vector of words (digits) for this Bigint, from least - significant (x[0]) to most significant (x[wds-1]). -*/ - -struct -Bigint { - struct Bigint *next; - int k, maxwds, sign, wds; - ULong x[1]; -}; - -typedef struct Bigint Bigint; - -#ifndef Py_USING_MEMORY_DEBUGGER - -/* Memory management: memory is allocated from, and returned to, Kmax+1 pools - of memory, where pool k (0 <= k <= Kmax) is for Bigints b with b->maxwds == - 1 << k. These pools are maintained as linked lists, with freelist[k] - pointing to the head of the list for pool k. - - On allocation, if there's no free slot in the appropriate pool, MALLOC is - called to get more memory. This memory is not returned to the system until - Python quits. There's also a private memory pool that's allocated from - in preference to using MALLOC. - - For Bigints with more than (1 << Kmax) digits (which implies at least 1233 - decimal digits), memory is directly allocated using MALLOC, and freed using - FREE. - - XXX: it would be easy to bypass this memory-management system and - translate each call to Balloc into a call to PyMem_Malloc, and each - Bfree to PyMem_Free. Investigate whether this has any significant - performance on impact. */ - -static Bigint *freelist[Kmax+1]; - -/* Allocate space for a Bigint with up to 1<next; - else { - x = 1 << k; - len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) - /sizeof(double); - if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { - rv = (Bigint*)pmem_next; - pmem_next += len; - } - else { - rv = (Bigint*)MALLOC(len*sizeof(double)); - if (rv == NULL) - return NULL; - } - rv->k = k; - rv->maxwds = x; - } - rv->sign = rv->wds = 0; - return rv; -} - -/* Free a Bigint allocated with Balloc */ - -static void -Bfree(Bigint *v) -{ - if (v) { - if (v->k > Kmax) - FREE((void*)v); - else { - v->next = freelist[v->k]; - freelist[v->k] = v; - } - } -} - -#else - -/* Alternative versions of Balloc and Bfree that use PyMem_Malloc and - PyMem_Free directly in place of the custom memory allocation scheme above. - These are provided for the benefit of memory debugging tools like - Valgrind. */ - -/* Allocate space for a Bigint with up to 1<k = k; - rv->maxwds = x; - rv->sign = rv->wds = 0; - return rv; -} - -/* Free a Bigint allocated with Balloc */ - -static void -Bfree(Bigint *v) -{ - if (v) { - FREE((void*)v); - } -} - -#endif /* Py_USING_MEMORY_DEBUGGER */ - -#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \ - y->wds*sizeof(Long) + 2*sizeof(int)) - -/* Multiply a Bigint b by m and add a. Either modifies b in place and returns - a pointer to the modified b, or Bfrees b and returns a pointer to a copy. - On failure, return NULL. In this case, b will have been already freed. */ - -static Bigint * -multadd(Bigint *b, int m, int a) /* multiply by m and add a */ -{ - int i, wds; -#ifdef ULLong - ULong *x; - ULLong carry, y; -#else - ULong carry, *x, y; - ULong xi, z; -#endif - Bigint *b1; - - wds = b->wds; - x = b->x; - i = 0; - carry = a; - do { -#ifdef ULLong - y = *x * (ULLong)m + carry; - carry = y >> 32; - *x++ = (ULong)(y & FFFFFFFF); -#else - xi = *x; - y = (xi & 0xffff) * m + carry; - z = (xi >> 16) * m + (y >> 16); - carry = z >> 16; - *x++ = (z << 16) + (y & 0xffff); -#endif - } - while(++i < wds); - if (carry) { - if (wds >= b->maxwds) { - b1 = Balloc(b->k+1); - if (b1 == NULL){ - Bfree(b); - return NULL; - } - Bcopy(b1, b); - Bfree(b); - b = b1; - } - b->x[wds++] = (ULong)carry; - b->wds = wds; - } - return b; -} - -/* convert a string s containing nd decimal digits (possibly containing a - decimal separator at position nd0, which is ignored) to a Bigint. This - function carries on where the parsing code in _Py_dg_strtod leaves off: on - entry, y9 contains the result of converting the first 9 digits. Returns - NULL on failure. */ - -static Bigint * -s2b(const char *s, int nd0, int nd, ULong y9) -{ - Bigint *b; - int i, k; - Long x, y; - - x = (nd + 8) / 9; - for(k = 0, y = 1; x > y; y <<= 1, k++) ; - b = Balloc(k); - if (b == NULL) - return NULL; - b->x[0] = y9; - b->wds = 1; - - if (nd <= 9) - return b; - - s += 9; - for (i = 9; i < nd0; i++) { - b = multadd(b, 10, *s++ - '0'); - if (b == NULL) - return NULL; - } - s++; - for(; i < nd; i++) { - b = multadd(b, 10, *s++ - '0'); - if (b == NULL) - return NULL; - } - return b; -} - -/* count leading 0 bits in the 32-bit integer x. */ - -static int -hi0bits(ULong x) -{ - int k = 0; - - if (!(x & 0xffff0000)) { - k = 16; - x <<= 16; - } - if (!(x & 0xff000000)) { - k += 8; - x <<= 8; - } - if (!(x & 0xf0000000)) { - k += 4; - x <<= 4; - } - if (!(x & 0xc0000000)) { - k += 2; - x <<= 2; - } - if (!(x & 0x80000000)) { - k++; - if (!(x & 0x40000000)) - return 32; - } - return k; -} - -/* count trailing 0 bits in the 32-bit integer y, and shift y right by that - number of bits. */ - -static int -lo0bits(ULong *y) -{ - int k; - ULong x = *y; - - if (x & 7) { - if (x & 1) - return 0; - if (x & 2) { - *y = x >> 1; - return 1; - } - *y = x >> 2; - return 2; - } - k = 0; - if (!(x & 0xffff)) { - k = 16; - x >>= 16; - } - if (!(x & 0xff)) { - k += 8; - x >>= 8; - } - if (!(x & 0xf)) { - k += 4; - x >>= 4; - } - if (!(x & 0x3)) { - k += 2; - x >>= 2; - } - if (!(x & 1)) { - k++; - x >>= 1; - if (!x) - return 32; - } - *y = x; - return k; -} - -/* convert a small nonnegative integer to a Bigint */ - -static Bigint * -i2b(int i) -{ - Bigint *b; - - b = Balloc(1); - if (b == NULL) - return NULL; - b->x[0] = i; - b->wds = 1; - return b; -} - -/* multiply two Bigints. Returns a new Bigint, or NULL on failure. Ignores - the signs of a and b. */ - -static Bigint * -mult(Bigint *a, Bigint *b) -{ - Bigint *c; - int k, wa, wb, wc; - ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0; - ULong y; -#ifdef ULLong - ULLong carry, z; -#else - ULong carry, z; - ULong z2; -#endif - - if ((!a->x[0] && a->wds == 1) || (!b->x[0] && b->wds == 1)) { - c = Balloc(0); - if (c == NULL) - return NULL; - c->wds = 1; - c->x[0] = 0; - return c; - } - - if (a->wds < b->wds) { - c = a; - a = b; - b = c; - } - k = a->k; - wa = a->wds; - wb = b->wds; - wc = wa + wb; - if (wc > a->maxwds) - k++; - c = Balloc(k); - if (c == NULL) - return NULL; - for(x = c->x, xa = x + wc; x < xa; x++) - *x = 0; - xa = a->x; - xae = xa + wa; - xb = b->x; - xbe = xb + wb; - xc0 = c->x; -#ifdef ULLong - for(; xb < xbe; xc0++) { - if ((y = *xb++)) { - x = xa; - xc = xc0; - carry = 0; - do { - z = *x++ * (ULLong)y + *xc + carry; - carry = z >> 32; - *xc++ = (ULong)(z & FFFFFFFF); - } - while(x < xae); - *xc = (ULong)carry; - } - } -#else - for(; xb < xbe; xb++, xc0++) { - if (y = *xb & 0xffff) { - x = xa; - xc = xc0; - carry = 0; - do { - z = (*x & 0xffff) * y + (*xc & 0xffff) + carry; - carry = z >> 16; - z2 = (*x++ >> 16) * y + (*xc >> 16) + carry; - carry = z2 >> 16; - Storeinc(xc, z2, z); - } - while(x < xae); - *xc = carry; - } - if (y = *xb >> 16) { - x = xa; - xc = xc0; - carry = 0; - z2 = *xc; - do { - z = (*x & 0xffff) * y + (*xc >> 16) + carry; - carry = z >> 16; - Storeinc(xc, z, z2); - z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry; - carry = z2 >> 16; - } - while(x < xae); - *xc = z2; - } - } -#endif - for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ; - c->wds = wc; - return c; -} - -#ifndef Py_USING_MEMORY_DEBUGGER - -/* p5s is a linked list of powers of 5 of the form 5**(2**i), i >= 2 */ - -static Bigint *p5s; - -/* multiply the Bigint b by 5**k. Returns a pointer to the result, or NULL on - failure; if the returned pointer is distinct from b then the original - Bigint b will have been Bfree'd. Ignores the sign of b. */ - -static Bigint * -pow5mult(Bigint *b, int k) -{ - Bigint *b1, *p5, *p51; - int i; - static int p05[3] = { 5, 25, 125 }; - - if ((i = k & 3)) { - b = multadd(b, p05[i-1], 0); - if (b == NULL) - return NULL; - } - - if (!(k >>= 2)) - return b; - p5 = p5s; - if (!p5) { - /* first time */ - p5 = i2b(625); - if (p5 == NULL) { - Bfree(b); - return NULL; - } - p5s = p5; - p5->next = 0; - } - for(;;) { - if (k & 1) { - b1 = mult(b, p5); - Bfree(b); - b = b1; - if (b == NULL) - return NULL; - } - if (!(k >>= 1)) - break; - p51 = p5->next; - if (!p51) { - p51 = mult(p5,p5); - if (p51 == NULL) { - Bfree(b); - return NULL; - } - p51->next = 0; - p5->next = p51; - } - p5 = p51; - } - return b; -} - -#else - -/* Version of pow5mult that doesn't cache powers of 5. Provided for - the benefit of memory debugging tools like Valgrind. */ - -static Bigint * -pow5mult(Bigint *b, int k) -{ - Bigint *b1, *p5, *p51; - int i; - static int p05[3] = { 5, 25, 125 }; - - if ((i = k & 3)) { - b = multadd(b, p05[i-1], 0); - if (b == NULL) - return NULL; - } - - if (!(k >>= 2)) - return b; - p5 = i2b(625); - if (p5 == NULL) { - Bfree(b); - return NULL; - } - - for(;;) { - if (k & 1) { - b1 = mult(b, p5); - Bfree(b); - b = b1; - if (b == NULL) { - Bfree(p5); - return NULL; - } - } - if (!(k >>= 1)) - break; - p51 = mult(p5, p5); - Bfree(p5); - p5 = p51; - if (p5 == NULL) { - Bfree(b); - return NULL; - } - } - Bfree(p5); - return b; -} - -#endif /* Py_USING_MEMORY_DEBUGGER */ - -/* shift a Bigint b left by k bits. Return a pointer to the shifted result, - or NULL on failure. If the returned pointer is distinct from b then the - original b will have been Bfree'd. Ignores the sign of b. */ - -static Bigint * -lshift(Bigint *b, int k) -{ - int i, k1, n, n1; - Bigint *b1; - ULong *x, *x1, *xe, z; - - if (!k || (!b->x[0] && b->wds == 1)) - return b; - - n = k >> 5; - k1 = b->k; - n1 = n + b->wds + 1; - for(i = b->maxwds; n1 > i; i <<= 1) - k1++; - b1 = Balloc(k1); - if (b1 == NULL) { - Bfree(b); - return NULL; - } - x1 = b1->x; - for(i = 0; i < n; i++) - *x1++ = 0; - x = b->x; - xe = x + b->wds; - if (k &= 0x1f) { - k1 = 32 - k; - z = 0; - do { - *x1++ = *x << k | z; - z = *x++ >> k1; - } - while(x < xe); - if ((*x1 = z)) - ++n1; - } - else do - *x1++ = *x++; - while(x < xe); - b1->wds = n1 - 1; - Bfree(b); - return b1; -} - -/* Do a three-way compare of a and b, returning -1 if a < b, 0 if a == b and - 1 if a > b. Ignores signs of a and b. */ - -static int -cmp(Bigint *a, Bigint *b) -{ - ULong *xa, *xa0, *xb, *xb0; - int i, j; - - i = a->wds; - j = b->wds; -#ifdef DEBUG - if (i > 1 && !a->x[i-1]) - Bug("cmp called with a->x[a->wds-1] == 0"); - if (j > 1 && !b->x[j-1]) - Bug("cmp called with b->x[b->wds-1] == 0"); -#endif - if (i -= j) - return i; - xa0 = a->x; - xa = xa0 + j; - xb0 = b->x; - xb = xb0 + j; - for(;;) { - if (*--xa != *--xb) - return *xa < *xb ? -1 : 1; - if (xa <= xa0) - break; - } - return 0; -} - -/* Take the difference of Bigints a and b, returning a new Bigint. Returns - NULL on failure. The signs of a and b are ignored, but the sign of the - result is set appropriately. */ - -static Bigint * -diff(Bigint *a, Bigint *b) -{ - Bigint *c; - int i, wa, wb; - ULong *xa, *xae, *xb, *xbe, *xc; -#ifdef ULLong - ULLong borrow, y; -#else - ULong borrow, y; - ULong z; -#endif - - i = cmp(a,b); - if (!i) { - c = Balloc(0); - if (c == NULL) - return NULL; - c->wds = 1; - c->x[0] = 0; - return c; - } - if (i < 0) { - c = a; - a = b; - b = c; - i = 1; - } - else - i = 0; - c = Balloc(a->k); - if (c == NULL) - return NULL; - c->sign = i; - wa = a->wds; - xa = a->x; - xae = xa + wa; - wb = b->wds; - xb = b->x; - xbe = xb + wb; - xc = c->x; - borrow = 0; -#ifdef ULLong - do { - y = (ULLong)*xa++ - *xb++ - borrow; - borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)(y & FFFFFFFF); - } - while(xb < xbe); - while(xa < xae) { - y = *xa++ - borrow; - borrow = y >> 32 & (ULong)1; - *xc++ = (ULong)(y & FFFFFFFF); - } -#else - do { - y = (*xa & 0xffff) - (*xb & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*xa++ >> 16) - (*xb++ >> 16) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(xc, z, y); - } - while(xb < xbe); - while(xa < xae) { - y = (*xa & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*xa++ >> 16) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(xc, z, y); - } -#endif - while(!*--xc) - wa--; - c->wds = wa; - return c; -} - -/* Given a positive normal double x, return the difference between x and the - next double up. Doesn't give correct results for subnormals. */ - -static double -ulp(U *x) -{ - Long L; - U u; - - L = (word0(x) & Exp_mask) - (P-1)*Exp_msk1; - word0(&u) = L; - word1(&u) = 0; - return dval(&u); -} - -/* Convert a Bigint to a double plus an exponent */ - -static double -b2d(Bigint *a, int *e) -{ - ULong *xa, *xa0, w, y, z; - int k; - U d; - - xa0 = a->x; - xa = xa0 + a->wds; - y = *--xa; -#ifdef DEBUG - if (!y) Bug("zero y in b2d"); -#endif - k = hi0bits(y); - *e = 32 - k; - if (k < Ebits) { - word0(&d) = Exp_1 | y >> (Ebits - k); - w = xa > xa0 ? *--xa : 0; - word1(&d) = y << ((32-Ebits) + k) | w >> (Ebits - k); - goto ret_d; - } - z = xa > xa0 ? *--xa : 0; - if (k -= Ebits) { - word0(&d) = Exp_1 | y << k | z >> (32 - k); - y = xa > xa0 ? *--xa : 0; - word1(&d) = z << k | y >> (32 - k); - } - else { - word0(&d) = Exp_1 | y; - word1(&d) = z; - } - ret_d: - return dval(&d); -} - -/* Convert a scaled double to a Bigint plus an exponent. Similar to d2b, - except that it accepts the scale parameter used in _Py_dg_strtod (which - should be either 0 or 2*P), and the normalization for the return value is - different (see below). On input, d should be finite and nonnegative, and d - / 2**scale should be exactly representable as an IEEE 754 double. - - Returns a Bigint b and an integer e such that - - dval(d) / 2**scale = b * 2**e. - - Unlike d2b, b is not necessarily odd: b and e are normalized so - that either 2**(P-1) <= b < 2**P and e >= Etiny, or b < 2**P - and e == Etiny. This applies equally to an input of 0.0: in that - case the return values are b = 0 and e = Etiny. - - The above normalization ensures that for all possible inputs d, - 2**e gives ulp(d/2**scale). - - Returns NULL on failure. -*/ - -static Bigint * -sd2b(U *d, int scale, int *e) -{ - Bigint *b; - - b = Balloc(1); - if (b == NULL) - return NULL; - - /* First construct b and e assuming that scale == 0. */ - b->wds = 2; - b->x[0] = word1(d); - b->x[1] = word0(d) & Frac_mask; - *e = Etiny - 1 + (int)((word0(d) & Exp_mask) >> Exp_shift); - if (*e < Etiny) - *e = Etiny; - else - b->x[1] |= Exp_msk1; - - /* Now adjust for scale, provided that b != 0. */ - if (scale && (b->x[0] || b->x[1])) { - *e -= scale; - if (*e < Etiny) { - scale = Etiny - *e; - *e = Etiny; - /* We can't shift more than P-1 bits without shifting out a 1. */ - assert(0 < scale && scale <= P - 1); - if (scale >= 32) { - /* The bits shifted out should all be zero. */ - assert(b->x[0] == 0); - b->x[0] = b->x[1]; - b->x[1] = 0; - scale -= 32; - } - if (scale) { - /* The bits shifted out should all be zero. */ - assert(b->x[0] << (32 - scale) == 0); - b->x[0] = (b->x[0] >> scale) | (b->x[1] << (32 - scale)); - b->x[1] >>= scale; - } - } - } - /* Ensure b is normalized. */ - if (!b->x[1]) - b->wds = 1; - - return b; -} - -/* Convert a double to a Bigint plus an exponent. Return NULL on failure. - - Given a finite nonzero double d, return an odd Bigint b and exponent *e - such that fabs(d) = b * 2**e. On return, *bbits gives the number of - significant bits of b; that is, 2**(*bbits-1) <= b < 2**(*bbits). - - If d is zero, then b == 0, *e == -1010, *bbits = 0. - */ - -static Bigint * -d2b(U *d, int *e, int *bits) -{ - Bigint *b; - int de, k; - ULong *x, y, z; - int i; - - b = Balloc(1); - if (b == NULL) - return NULL; - x = b->x; - - z = word0(d) & Frac_mask; - word0(d) &= 0x7fffffff; /* clear sign bit, which we ignore */ - if ((de = (int)(word0(d) >> Exp_shift))) - z |= Exp_msk1; - if ((y = word1(d))) { - if ((k = lo0bits(&y))) { - x[0] = y | z << (32 - k); - z >>= k; - } - else - x[0] = y; - i = - b->wds = (x[1] = z) ? 2 : 1; - } - else { - k = lo0bits(&z); - x[0] = z; - i = - b->wds = 1; - k += 32; - } - if (de) { - *e = de - Bias - (P-1) + k; - *bits = P - k; - } - else { - *e = de - Bias - (P-1) + 1 + k; - *bits = 32*i - hi0bits(x[i-1]); - } - return b; -} - -/* Compute the ratio of two Bigints, as a double. The result may have an - error of up to 2.5 ulps. */ - -static double -ratio(Bigint *a, Bigint *b) -{ - U da, db; - int k, ka, kb; - - dval(&da) = b2d(a, &ka); - dval(&db) = b2d(b, &kb); - k = ka - kb + 32*(a->wds - b->wds); - if (k > 0) - word0(&da) += k*Exp_msk1; - else { - k = -k; - word0(&db) += k*Exp_msk1; - } - return dval(&da) / dval(&db); -} - -static const double -tens[] = { - 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, - 1e10, 1e11, 1e12, 1e13, 1e14, 1e15, 1e16, 1e17, 1e18, 1e19, - 1e20, 1e21, 1e22 -}; - -static const double -bigtens[] = { 1e16, 1e32, 1e64, 1e128, 1e256 }; -static const double tinytens[] = { 1e-16, 1e-32, 1e-64, 1e-128, - 9007199254740992.*9007199254740992.e-256 - /* = 2^106 * 1e-256 */ -}; -/* The factor of 2^53 in tinytens[4] helps us avoid setting the underflow */ -/* flag unnecessarily. It leads to a song and dance at the end of strtod. */ -#define Scale_Bit 0x10 -#define n_bigtens 5 - -#define ULbits 32 -#define kshift 5 -#define kmask 31 - - -static int -dshift(Bigint *b, int p2) -{ - int rv = hi0bits(b->x[b->wds-1]) - 4; - if (p2 > 0) - rv -= p2; - return rv & kmask; -} - -/* special case of Bigint division. The quotient is always in the range 0 <= - quotient < 10, and on entry the divisor S is normalized so that its top 4 - bits (28--31) are zero and bit 27 is set. */ - -static int -quorem(Bigint *b, Bigint *S) -{ - int n; - ULong *bx, *bxe, q, *sx, *sxe; -#ifdef ULLong - ULLong borrow, carry, y, ys; -#else - ULong borrow, carry, y, ys; - ULong si, z, zs; -#endif - - n = S->wds; -#ifdef DEBUG - /*debug*/ if (b->wds > n) - /*debug*/ Bug("oversize b in quorem"); -#endif - if (b->wds < n) - return 0; - sx = S->x; - sxe = sx + --n; - bx = b->x; - bxe = bx + n; - q = *bxe / (*sxe + 1); /* ensure q <= true quotient */ -#ifdef DEBUG - /*debug*/ if (q > 9) - /*debug*/ Bug("oversized quotient in quorem"); -#endif - if (q) { - borrow = 0; - carry = 0; - do { -#ifdef ULLong - ys = *sx++ * (ULLong)q + carry; - carry = ys >> 32; - y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)(y & FFFFFFFF); -#else - si = *sx++; - ys = (si & 0xffff) * q + carry; - zs = (si >> 16) * q + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*bx >> 16) - (zs & 0xffff) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(bx, z, y); -#endif - } - while(sx <= sxe); - if (!*bxe) { - bx = b->x; - while(--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - if (cmp(b, S) >= 0) { - q++; - borrow = 0; - carry = 0; - bx = b->x; - sx = S->x; - do { -#ifdef ULLong - ys = *sx++ + carry; - carry = ys >> 32; - y = *bx - (ys & FFFFFFFF) - borrow; - borrow = y >> 32 & (ULong)1; - *bx++ = (ULong)(y & FFFFFFFF); -#else - si = *sx++; - ys = (si & 0xffff) + carry; - zs = (si >> 16) + (ys >> 16); - carry = zs >> 16; - y = (*bx & 0xffff) - (ys & 0xffff) - borrow; - borrow = (y & 0x10000) >> 16; - z = (*bx >> 16) - (zs & 0xffff) - borrow; - borrow = (z & 0x10000) >> 16; - Storeinc(bx, z, y); -#endif - } - while(sx <= sxe); - bx = b->x; - bxe = bx + n; - if (!*bxe) { - while(--bxe > bx && !*bxe) - --n; - b->wds = n; - } - } - return q; -} - -/* sulp(x) is a version of ulp(x) that takes bc.scale into account. - - Assuming that x is finite and nonnegative (positive zero is fine - here) and x / 2^bc.scale is exactly representable as a double, - sulp(x) is equivalent to 2^bc.scale * ulp(x / 2^bc.scale). */ - -static double -sulp(U *x, BCinfo *bc) -{ - U u; - - if (bc->scale && 2*P + 1 > (int)((word0(x) & Exp_mask) >> Exp_shift)) { - /* rv/2^bc->scale is subnormal */ - word0(&u) = (P+2)*Exp_msk1; - word1(&u) = 0; - return u.d; - } - else { - assert(word0(x) || word1(x)); /* x != 0.0 */ - return ulp(x); - } -} - -/* The bigcomp function handles some hard cases for strtod, for inputs - with more than STRTOD_DIGLIM digits. It's called once an initial - estimate for the double corresponding to the input string has - already been obtained by the code in _Py_dg_strtod. - - The bigcomp function is only called after _Py_dg_strtod has found a - double value rv such that either rv or rv + 1ulp represents the - correctly rounded value corresponding to the original string. It - determines which of these two values is the correct one by - computing the decimal digits of rv + 0.5ulp and comparing them with - the corresponding digits of s0. - - In the following, write dv for the absolute value of the number represented - by the input string. - - Inputs: - - s0 points to the first significant digit of the input string. - - rv is a (possibly scaled) estimate for the closest double value to the - value represented by the original input to _Py_dg_strtod. If - bc->scale is nonzero, then rv/2^(bc->scale) is the approximation to - the input value. - - bc is a struct containing information gathered during the parsing and - estimation steps of _Py_dg_strtod. Description of fields follows: - - bc->e0 gives the exponent of the input value, such that dv = (integer - given by the bd->nd digits of s0) * 10**e0 - - bc->nd gives the total number of significant digits of s0. It will - be at least 1. - - bc->nd0 gives the number of significant digits of s0 before the - decimal separator. If there's no decimal separator, bc->nd0 == - bc->nd. - - bc->scale is the value used to scale rv to avoid doing arithmetic with - subnormal values. It's either 0 or 2*P (=106). - - Outputs: - - On successful exit, rv/2^(bc->scale) is the closest double to dv. - - Returns 0 on success, -1 on failure (e.g., due to a failed malloc call). */ - -static int -bigcomp(U *rv, const char *s0, BCinfo *bc) -{ - Bigint *b, *d; - int b2, d2, dd, i, nd, nd0, odd, p2, p5; - - nd = bc->nd; - nd0 = bc->nd0; - p5 = nd + bc->e0; - b = sd2b(rv, bc->scale, &p2); - if (b == NULL) - return -1; - - /* record whether the lsb of rv/2^(bc->scale) is odd: in the exact halfway - case, this is used for round to even. */ - odd = b->x[0] & 1; - - /* left shift b by 1 bit and or a 1 into the least significant bit; - this gives us b * 2**p2 = rv/2^(bc->scale) + 0.5 ulp. */ - b = lshift(b, 1); - if (b == NULL) - return -1; - b->x[0] |= 1; - p2--; - - p2 -= p5; - d = i2b(1); - if (d == NULL) { - Bfree(b); - return -1; - } - /* Arrange for convenient computation of quotients: - * shift left if necessary so divisor has 4 leading 0 bits. - */ - if (p5 > 0) { - d = pow5mult(d, p5); - if (d == NULL) { - Bfree(b); - return -1; - } - } - else if (p5 < 0) { - b = pow5mult(b, -p5); - if (b == NULL) { - Bfree(d); - return -1; - } - } - if (p2 > 0) { - b2 = p2; - d2 = 0; - } - else { - b2 = 0; - d2 = -p2; - } - i = dshift(d, d2); - if ((b2 += i) > 0) { - b = lshift(b, b2); - if (b == NULL) { - Bfree(d); - return -1; - } - } - if ((d2 += i) > 0) { - d = lshift(d, d2); - if (d == NULL) { - Bfree(b); - return -1; - } - } - - /* Compare s0 with b/d: set dd to -1, 0, or 1 according as s0 < b/d, s0 == - * b/d, or s0 > b/d. Here the digits of s0 are thought of as representing - * a number in the range [0.1, 1). */ - if (cmp(b, d) >= 0) - /* b/d >= 1 */ - dd = -1; - else { - i = 0; - for(;;) { - b = multadd(b, 10, 0); - if (b == NULL) { - Bfree(d); - return -1; - } - dd = s0[i < nd0 ? i : i+1] - '0' - quorem(b, d); - i++; - - if (dd) - break; - if (!b->x[0] && b->wds == 1) { - /* b/d == 0 */ - dd = i < nd; - break; - } - if (!(i < nd)) { - /* b/d != 0, but digits of s0 exhausted */ - dd = -1; - break; - } - } - } - Bfree(b); - Bfree(d); - if (dd > 0 || (dd == 0 && odd)) - dval(rv) += sulp(rv, bc); - return 0; -} - -double -_Py_dg_strtod(const char *s00, char **se) -{ - int bb2, bb5, bbe, bd2, bd5, bs2, c, dsign, e, e1, error; - int esign, i, j, k, lz, nd, nd0, odd, sign; - const char *s, *s0, *s1; - double aadj, aadj1; - U aadj2, adj, rv, rv0; - ULong y, z, abs_exp; - Long L; - BCinfo bc; - Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; - size_t ndigits, fraclen; - - dval(&rv) = 0.; - - /* Start parsing. */ - c = *(s = s00); - - /* Parse optional sign, if present. */ - sign = 0; - switch (c) { - case '-': - sign = 1; - /* no break */ - case '+': - c = *++s; - } - - /* Skip leading zeros: lz is true iff there were leading zeros. */ - s1 = s; - while (c == '0') - c = *++s; - lz = s != s1; - - /* Point s0 at the first nonzero digit (if any). fraclen will be the - number of digits between the decimal point and the end of the - digit string. ndigits will be the total number of digits ignoring - leading zeros. */ - s0 = s1 = s; - while ('0' <= c && c <= '9') - c = *++s; - ndigits = s - s1; - fraclen = 0; - - /* Parse decimal point and following digits. */ - if (c == '.') { - c = *++s; - if (!ndigits) { - s1 = s; - while (c == '0') - c = *++s; - lz = lz || s != s1; - fraclen += (s - s1); - s0 = s; - } - s1 = s; - while ('0' <= c && c <= '9') - c = *++s; - ndigits += s - s1; - fraclen += s - s1; - } - - /* Now lz is true if and only if there were leading zero digits, and - ndigits gives the total number of digits ignoring leading zeros. A - valid input must have at least one digit. */ - if (!ndigits && !lz) { - if (se) - *se = (char *)s00; - goto parse_error; - } - - /* Range check ndigits and fraclen to make sure that they, and values - computed with them, can safely fit in an int. */ - if (ndigits > MAX_DIGITS || fraclen > MAX_DIGITS) { - if (se) - *se = (char *)s00; - goto parse_error; - } - nd = (int)ndigits; - nd0 = (int)ndigits - (int)fraclen; - - /* Parse exponent. */ - e = 0; - if (c == 'e' || c == 'E') { - s00 = s; - c = *++s; - - /* Exponent sign. */ - esign = 0; - switch (c) { - case '-': - esign = 1; - /* no break */ - case '+': - c = *++s; - } - - /* Skip zeros. lz is true iff there are leading zeros. */ - s1 = s; - while (c == '0') - c = *++s; - lz = s != s1; - - /* Get absolute value of the exponent. */ - s1 = s; - abs_exp = 0; - while ('0' <= c && c <= '9') { - abs_exp = 10*abs_exp + (c - '0'); - c = *++s; - } - - /* abs_exp will be correct modulo 2**32. But 10**9 < 2**32, so if - there are at most 9 significant exponent digits then overflow is - impossible. */ - if (s - s1 > 9 || abs_exp > MAX_ABS_EXP) - e = (int)MAX_ABS_EXP; - else - e = (int)abs_exp; - if (esign) - e = -e; - - /* A valid exponent must have at least one digit. */ - if (s == s1 && !lz) - s = s00; - } - - /* Adjust exponent to take into account position of the point. */ - e -= nd - nd0; - if (nd0 <= 0) - nd0 = nd; - - /* Finished parsing. Set se to indicate how far we parsed */ - if (se) - *se = (char *)s; - - /* If all digits were zero, exit with return value +-0.0. Otherwise, - strip trailing zeros: scan back until we hit a nonzero digit. */ - if (!nd) - goto ret; - for (i = nd; i > 0; ) { - --i; - if (s0[i < nd0 ? i : i+1] != '0') { - ++i; - break; - } - } - e += nd - i; - nd = i; - if (nd0 > nd) - nd0 = nd; - - /* Summary of parsing results. After parsing, and dealing with zero - * inputs, we have values s0, nd0, nd, e, sign, where: - * - * - s0 points to the first significant digit of the input string - * - * - nd is the total number of significant digits (here, and - * below, 'significant digits' means the set of digits of the - * significand of the input that remain after ignoring leading - * and trailing zeros). - * - * - nd0 indicates the position of the decimal point, if present; it - * satisfies 1 <= nd0 <= nd. The nd significant digits are in - * s0[0:nd0] and s0[nd0+1:nd+1] using the usual Python half-open slice - * notation. (If nd0 < nd, then s0[nd0] contains a '.' character; if - * nd0 == nd, then s0[nd0] could be any non-digit character.) - * - * - e is the adjusted exponent: the absolute value of the number - * represented by the original input string is n * 10**e, where - * n is the integer represented by the concatenation of - * s0[0:nd0] and s0[nd0+1:nd+1] - * - * - sign gives the sign of the input: 1 for negative, 0 for positive - * - * - the first and last significant digits are nonzero - */ - - /* put first DBL_DIG+1 digits into integer y and z. - * - * - y contains the value represented by the first min(9, nd) - * significant digits - * - * - if nd > 9, z contains the value represented by significant digits - * with indices in [9, min(16, nd)). So y * 10**(min(16, nd) - 9) + z - * gives the value represented by the first min(16, nd) sig. digits. - */ - - bc.e0 = e1 = e; - y = z = 0; - for (i = 0; i < nd; i++) { - if (i < 9) - y = 10*y + s0[i < nd0 ? i : i+1] - '0'; - else if (i < DBL_DIG+1) - z = 10*z + s0[i < nd0 ? i : i+1] - '0'; - else - break; - } - - k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; - dval(&rv) = y; - if (k > 9) { - dval(&rv) = tens[k - 9] * dval(&rv) + z; - } - bd0 = 0; - if (nd <= DBL_DIG - && Flt_Rounds == 1 - ) { - if (!e) - goto ret; - if (e > 0) { - if (e <= Ten_pmax) { - dval(&rv) *= tens[e]; - goto ret; - } - i = DBL_DIG - nd; - if (e <= Ten_pmax + i) { - /* A fancier test would sometimes let us do - * this for larger i values. - */ - e -= i; - dval(&rv) *= tens[i]; - dval(&rv) *= tens[e]; - goto ret; - } - } - else if (e >= -Ten_pmax) { - dval(&rv) /= tens[-e]; - goto ret; - } - } - e1 += nd - k; - - bc.scale = 0; - - /* Get starting approximation = rv * 10**e1 */ - - if (e1 > 0) { - if ((i = e1 & 15)) - dval(&rv) *= tens[i]; - if (e1 &= ~15) { - if (e1 > DBL_MAX_10_EXP) - goto ovfl; - e1 >>= 4; - for(j = 0; e1 > 1; j++, e1 >>= 1) - if (e1 & 1) - dval(&rv) *= bigtens[j]; - /* The last multiplication could overflow. */ - word0(&rv) -= P*Exp_msk1; - dval(&rv) *= bigtens[j]; - if ((z = word0(&rv) & Exp_mask) - > Exp_msk1*(DBL_MAX_EXP+Bias-P)) - goto ovfl; - if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) { - /* set to largest number */ - /* (Can't trust DBL_MAX) */ - word0(&rv) = Big0; - word1(&rv) = Big1; - } - else - word0(&rv) += P*Exp_msk1; - } - } - else if (e1 < 0) { - /* The input decimal value lies in [10**e1, 10**(e1+16)). - - If e1 <= -512, underflow immediately. - If e1 <= -256, set bc.scale to 2*P. - - So for input value < 1e-256, bc.scale is always set; - for input value >= 1e-240, bc.scale is never set. - For input values in [1e-256, 1e-240), bc.scale may or may - not be set. */ - - e1 = -e1; - if ((i = e1 & 15)) - dval(&rv) /= tens[i]; - if (e1 >>= 4) { - if (e1 >= 1 << n_bigtens) - goto undfl; - if (e1 & Scale_Bit) - bc.scale = 2*P; - for(j = 0; e1 > 0; j++, e1 >>= 1) - if (e1 & 1) - dval(&rv) *= tinytens[j]; - if (bc.scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask) - >> Exp_shift)) > 0) { - /* scaled rv is denormal; clear j low bits */ - if (j >= 32) { - word1(&rv) = 0; - if (j >= 53) - word0(&rv) = (P+2)*Exp_msk1; - else - word0(&rv) &= 0xffffffff << (j-32); - } - else - word1(&rv) &= 0xffffffff << j; - } - if (!dval(&rv)) - goto undfl; - } - } - - /* Now the hard part -- adjusting rv to the correct value.*/ - - /* Put digits into bd: true value = bd * 10^e */ - - bc.nd = nd; - bc.nd0 = nd0; /* Only needed if nd > STRTOD_DIGLIM, but done here */ - /* to silence an erroneous warning about bc.nd0 */ - /* possibly not being initialized. */ - if (nd > STRTOD_DIGLIM) { - /* ASSERT(STRTOD_DIGLIM >= 18); 18 == one more than the */ - /* minimum number of decimal digits to distinguish double values */ - /* in IEEE arithmetic. */ - - /* Truncate input to 18 significant digits, then discard any trailing - zeros on the result by updating nd, nd0, e and y suitably. (There's - no need to update z; it's not reused beyond this point.) */ - for (i = 18; i > 0; ) { - /* scan back until we hit a nonzero digit. significant digit 'i' - is s0[i] if i < nd0, s0[i+1] if i >= nd0. */ - --i; - if (s0[i < nd0 ? i : i+1] != '0') { - ++i; - break; - } - } - e += nd - i; - nd = i; - if (nd0 > nd) - nd0 = nd; - if (nd < 9) { /* must recompute y */ - y = 0; - for(i = 0; i < nd0; ++i) - y = 10*y + s0[i] - '0'; - for(; i < nd; ++i) - y = 10*y + s0[i+1] - '0'; - } - } - bd0 = s2b(s0, nd0, nd, y); - if (bd0 == NULL) - goto failed_malloc; - - /* Notation for the comments below. Write: - - - dv for the absolute value of the number represented by the original - decimal input string. - - - if we've truncated dv, write tdv for the truncated value. - Otherwise, set tdv == dv. - - - srv for the quantity rv/2^bc.scale; so srv is the current binary - approximation to tdv (and dv). It should be exactly representable - in an IEEE 754 double. - */ - - for(;;) { - - /* This is the main correction loop for _Py_dg_strtod. - - We've got a decimal value tdv, and a floating-point approximation - srv=rv/2^bc.scale to tdv. The aim is to determine whether srv is - close enough (i.e., within 0.5 ulps) to tdv, and to compute a new - approximation if not. - - To determine whether srv is close enough to tdv, compute integers - bd, bb and bs proportional to tdv, srv and 0.5 ulp(srv) - respectively, and then use integer arithmetic to determine whether - |tdv - srv| is less than, equal to, or greater than 0.5 ulp(srv). - */ - - bd = Balloc(bd0->k); - if (bd == NULL) { - Bfree(bd0); - goto failed_malloc; - } - Bcopy(bd, bd0); - bb = sd2b(&rv, bc.scale, &bbe); /* srv = bb * 2^bbe */ - if (bb == NULL) { - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - /* Record whether lsb of bb is odd, in case we need this - for the round-to-even step later. */ - odd = bb->x[0] & 1; - - /* tdv = bd * 10**e; srv = bb * 2**bbe */ - bs = i2b(1); - if (bs == NULL) { - Bfree(bb); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - - if (e >= 0) { - bb2 = bb5 = 0; - bd2 = bd5 = e; - } - else { - bb2 = bb5 = -e; - bd2 = bd5 = 0; - } - if (bbe >= 0) - bb2 += bbe; - else - bd2 -= bbe; - bs2 = bb2; - bb2++; - bd2++; - - /* At this stage bd5 - bb5 == e == bd2 - bb2 + bbe, bb2 - bs2 == 1, - and bs == 1, so: - - tdv == bd * 10**e = bd * 2**(bbe - bb2 + bd2) * 5**(bd5 - bb5) - srv == bb * 2**bbe = bb * 2**(bbe - bb2 + bb2) - 0.5 ulp(srv) == 2**(bbe-1) = bs * 2**(bbe - bb2 + bs2) - - It follows that: - - M * tdv = bd * 2**bd2 * 5**bd5 - M * srv = bb * 2**bb2 * 5**bb5 - M * 0.5 ulp(srv) = bs * 2**bs2 * 5**bb5 - - for some constant M. (Actually, M == 2**(bb2 - bbe) * 5**bb5, but - this fact is not needed below.) - */ - - /* Remove factor of 2**i, where i = min(bb2, bd2, bs2). */ - i = bb2 < bd2 ? bb2 : bd2; - if (i > bs2) - i = bs2; - if (i > 0) { - bb2 -= i; - bd2 -= i; - bs2 -= i; - } - - /* Scale bb, bd, bs by the appropriate powers of 2 and 5. */ - if (bb5 > 0) { - bs = pow5mult(bs, bb5); - if (bs == NULL) { - Bfree(bb); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - bb1 = mult(bs, bb); - Bfree(bb); - bb = bb1; - if (bb == NULL) { - Bfree(bs); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - } - if (bb2 > 0) { - bb = lshift(bb, bb2); - if (bb == NULL) { - Bfree(bs); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - } - if (bd5 > 0) { - bd = pow5mult(bd, bd5); - if (bd == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd0); - goto failed_malloc; - } - } - if (bd2 > 0) { - bd = lshift(bd, bd2); - if (bd == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd0); - goto failed_malloc; - } - } - if (bs2 > 0) { - bs = lshift(bs, bs2); - if (bs == NULL) { - Bfree(bb); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - } - - /* Now bd, bb and bs are scaled versions of tdv, srv and 0.5 ulp(srv), - respectively. Compute the difference |tdv - srv|, and compare - with 0.5 ulp(srv). */ - - delta = diff(bb, bd); - if (delta == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - dsign = delta->sign; - delta->sign = 0; - i = cmp(delta, bs); - if (bc.nd > nd && i <= 0) { - if (dsign) - break; /* Must use bigcomp(). */ - - /* Here rv overestimates the truncated decimal value by at most - 0.5 ulp(rv). Hence rv either overestimates the true decimal - value by <= 0.5 ulp(rv), or underestimates it by some small - amount (< 0.1 ulp(rv)); either way, rv is within 0.5 ulps of - the true decimal value, so it's possible to exit. - - Exception: if scaled rv is a normal exact power of 2, but not - DBL_MIN, then rv - 0.5 ulp(rv) takes us all the way down to the - next double, so the correctly rounded result is either rv - 0.5 - ulp(rv) or rv; in this case, use bigcomp to distinguish. */ - - if (!word1(&rv) && !(word0(&rv) & Bndry_mask)) { - /* rv can't be 0, since it's an overestimate for some - nonzero value. So rv is a normal power of 2. */ - j = (int)(word0(&rv) & Exp_mask) >> Exp_shift; - /* rv / 2^bc.scale = 2^(j - 1023 - bc.scale); use bigcomp if - rv / 2^bc.scale >= 2^-1021. */ - if (j - bc.scale >= 2) { - dval(&rv) -= 0.5 * sulp(&rv, &bc); - break; /* Use bigcomp. */ - } - } - - { - bc.nd = nd; - i = -1; /* Discarded digits make delta smaller. */ - } - } - - if (i < 0) { - /* Error is less than half an ulp -- check for - * special case of mantissa a power of two. - */ - if (dsign || word1(&rv) || word0(&rv) & Bndry_mask - || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1 - ) { - break; - } - if (!delta->x[0] && delta->wds <= 1) { - /* exact result */ - break; - } - delta = lshift(delta,Log2P); - if (delta == NULL) { - Bfree(bb); - Bfree(bs); - Bfree(bd); - Bfree(bd0); - goto failed_malloc; - } - if (cmp(delta, bs) > 0) - goto drop_down; - break; - } - if (i == 0) { - /* exactly half-way between */ - if (dsign) { - if ((word0(&rv) & Bndry_mask1) == Bndry_mask1 - && word1(&rv) == ( - (bc.scale && - (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1) ? - (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) : - 0xffffffff)) { - /*boundary case -- increment exponent*/ - word0(&rv) = (word0(&rv) & Exp_mask) - + Exp_msk1 - ; - word1(&rv) = 0; - dsign = 0; - break; - } - } - else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) { - drop_down: - /* boundary case -- decrement exponent */ - if (bc.scale) { - L = word0(&rv) & Exp_mask; - if (L <= (2*P+1)*Exp_msk1) { - if (L > (P+2)*Exp_msk1) - /* round even ==> */ - /* accept rv */ - break; - /* rv = smallest denormal */ - if (bc.nd > nd) - break; - goto undfl; - } - } - L = (word0(&rv) & Exp_mask) - Exp_msk1; - word0(&rv) = L | Bndry_mask1; - word1(&rv) = 0xffffffff; - break; - } - if (!odd) - break; - if (dsign) - dval(&rv) += sulp(&rv, &bc); - else { - dval(&rv) -= sulp(&rv, &bc); - if (!dval(&rv)) { - if (bc.nd >nd) - break; - goto undfl; - } - } - dsign = 1 - dsign; - break; - } - if ((aadj = ratio(delta, bs)) <= 2.) { - if (dsign) - aadj = aadj1 = 1.; - else if (word1(&rv) || word0(&rv) & Bndry_mask) { - if (word1(&rv) == Tiny1 && !word0(&rv)) { - if (bc.nd >nd) - break; - goto undfl; - } - aadj = 1.; - aadj1 = -1.; - } - else { - /* special case -- power of FLT_RADIX to be */ - /* rounded down... */ - - if (aadj < 2./FLT_RADIX) - aadj = 1./FLT_RADIX; - else - aadj *= 0.5; - aadj1 = -aadj; - } - } - else { - aadj *= 0.5; - aadj1 = dsign ? aadj : -aadj; - if (Flt_Rounds == 0) - aadj1 += 0.5; - } - y = word0(&rv) & Exp_mask; - - /* Check for overflow */ - - if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) { - dval(&rv0) = dval(&rv); - word0(&rv) -= P*Exp_msk1; - adj.d = aadj1 * ulp(&rv); - dval(&rv) += adj.d; - if ((word0(&rv) & Exp_mask) >= - Exp_msk1*(DBL_MAX_EXP+Bias-P)) { - if (word0(&rv0) == Big0 && word1(&rv0) == Big1) { - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); - goto ovfl; - } - word0(&rv) = Big0; - word1(&rv) = Big1; - goto cont; - } - else - word0(&rv) += P*Exp_msk1; - } - else { - if (bc.scale && y <= 2*P*Exp_msk1) { - if (aadj <= 0x7fffffff) { - if ((z = (ULong)aadj) <= 0) - z = 1; - aadj = z; - aadj1 = dsign ? aadj : -aadj; - } - dval(&aadj2) = aadj1; - word0(&aadj2) += (2*P+1)*Exp_msk1 - y; - aadj1 = dval(&aadj2); - } - adj.d = aadj1 * ulp(&rv); - dval(&rv) += adj.d; - } - z = word0(&rv) & Exp_mask; - if (bc.nd == nd) { - if (!bc.scale) - if (y == z) { - /* Can we stop now? */ - L = (Long)aadj; - aadj -= L; - /* The tolerances below are conservative. */ - if (dsign || word1(&rv) || word0(&rv) & Bndry_mask) { - if (aadj < .4999999 || aadj > .5000001) - break; - } - else if (aadj < .4999999/FLT_RADIX) - break; - } - } - cont: - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(delta); - } - Bfree(bb); - Bfree(bd); - Bfree(bs); - Bfree(bd0); - Bfree(delta); - if (bc.nd > nd) { - error = bigcomp(&rv, s0, &bc); - if (error) - goto failed_malloc; - } - - if (bc.scale) { - word0(&rv0) = Exp_1 - 2*P*Exp_msk1; - word1(&rv0) = 0; - dval(&rv) *= dval(&rv0); - } - - ret: - return sign ? -dval(&rv) : dval(&rv); - - parse_error: - return 0.0; - - failed_malloc: - errno = ENOMEM; - return -1.0; - - undfl: - return sign ? -0.0 : 0.0; - - ovfl: - errno = ERANGE; - /* Can't trust HUGE_VAL */ - word0(&rv) = Exp_mask; - word1(&rv) = 0; - return sign ? -dval(&rv) : dval(&rv); - -} - -static char * -rv_alloc(int i) -{ - int j, k, *r; - - j = sizeof(ULong); - for(k = 0; - sizeof(Bigint) - sizeof(ULong) - sizeof(int) + j <= (unsigned)i; - j <<= 1) - k++; - r = (int*)Balloc(k); - if (r == NULL) - return NULL; - *r = k; - return (char *)(r+1); -} - -static char * -nrv_alloc(char *s, char **rve, int n) -{ - char *rv, *t; - - rv = rv_alloc(n); - if (rv == NULL) - return NULL; - t = rv; - while((*t = *s++)) t++; - if (rve) - *rve = t; - return rv; -} - -/* freedtoa(s) must be used to free values s returned by dtoa - * when MULTIPLE_THREADS is #defined. It should be used in all cases, - * but for consistency with earlier versions of dtoa, it is optional - * when MULTIPLE_THREADS is not defined. - */ - -void -_Py_dg_freedtoa(char *s) -{ - Bigint *b = (Bigint *)((int *)s - 1); - b->maxwds = 1 << (b->k = *(int*)b); - Bfree(b); -} - -/* dtoa for IEEE arithmetic (dmg): convert double to ASCII string. - * - * Inspired by "How to Print Floating-Point Numbers Accurately" by - * Guy L. Steele, Jr. and Jon L. White [Proc. ACM SIGPLAN '90, pp. 112-126]. - * - * Modifications: - * 1. Rather than iterating, we use a simple numeric overestimate - * to determine k = floor(log10(d)). We scale relevant - * quantities using O(log2(k)) rather than O(k) multiplications. - * 2. For some modes > 2 (corresponding to ecvt and fcvt), we don't - * try to generate digits strictly left to right. Instead, we - * compute with fewer bits and propagate the carry if necessary - * when rounding the final digit up. This is often faster. - * 3. Under the assumption that input will be rounded nearest, - * mode 0 renders 1e23 as 1e23 rather than 9.999999999999999e22. - * That is, we allow equality in stopping tests when the - * round-nearest rule will give the same floating-point value - * as would satisfaction of the stopping test with strict - * inequality. - * 4. We remove common factors of powers of 2 from relevant - * quantities. - * 5. When converting floating-point integers less than 1e16, - * we use floating-point arithmetic rather than resorting - * to multiple-precision integers. - * 6. When asked to produce fewer than 15 digits, we first try - * to get by with floating-point arithmetic; we resort to - * multiple-precision integer arithmetic only if we cannot - * guarantee that the floating-point calculation has given - * the correctly rounded result. For k requested digits and - * "uniformly" distributed input, the probability is - * something like 10^(k-15) that we must resort to the Long - * calculation. - */ - -/* Additional notes (METD): (1) returns NULL on failure. (2) to avoid memory - leakage, a successful call to _Py_dg_dtoa should always be matched by a - call to _Py_dg_freedtoa. */ - -char * -_Py_dg_dtoa(double dd, int mode, int ndigits, - int *decpt, int *sign, char **rve) -{ - /* Arguments ndigits, decpt, sign are similar to those - of ecvt and fcvt; trailing zeros are suppressed from - the returned string. If not null, *rve is set to point - to the end of the return value. If d is +-Infinity or NaN, - then *decpt is set to 9999. - - mode: - 0 ==> shortest string that yields d when read in - and rounded to nearest. - 1 ==> like 0, but with Steele & White stopping rule; - e.g. with IEEE P754 arithmetic , mode 0 gives - 1e23 whereas mode 1 gives 9.999999999999999e22. - 2 ==> max(1,ndigits) significant digits. This gives a - return value similar to that of ecvt, except - that trailing zeros are suppressed. - 3 ==> through ndigits past the decimal point. This - gives a return value similar to that from fcvt, - except that trailing zeros are suppressed, and - ndigits can be negative. - 4,5 ==> similar to 2 and 3, respectively, but (in - round-nearest mode) with the tests of mode 0 to - possibly return a shorter string that rounds to d. - With IEEE arithmetic and compilation with - -DHonor_FLT_ROUNDS, modes 4 and 5 behave the same - as modes 2 and 3 when FLT_ROUNDS != 1. - 6-9 ==> Debugging modes similar to mode - 4: don't try - fast floating-point estimate (if applicable). - - Values of mode other than 0-9 are treated as mode 0. - - Sufficient space is allocated to the return value - to hold the suppressed trailing zeros. - */ - - int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, - j, j1, k, k0, k_check, leftright, m2, m5, s2, s5, - spec_case, try_quick; - Long L; - int denorm; - ULong x; - Bigint *b, *b1, *delta, *mlo, *mhi, *S; - U d2, eps, u; - double ds; - char *s, *s0; - - /* set pointers to NULL, to silence gcc compiler warnings and make - cleanup easier on error */ - mlo = mhi = S = 0; - s0 = 0; - - u.d = dd; - if (word0(&u) & Sign_bit) { - /* set sign for everything, including 0's and NaNs */ - *sign = 1; - word0(&u) &= ~Sign_bit; /* clear sign bit */ - } - else - *sign = 0; - - /* quick return for Infinities, NaNs and zeros */ - if ((word0(&u) & Exp_mask) == Exp_mask) - { - /* Infinity or NaN */ - *decpt = 9999; - if (!word1(&u) && !(word0(&u) & 0xfffff)) - return nrv_alloc("Infinity", rve, 8); - return nrv_alloc("NaN", rve, 3); - } - if (!dval(&u)) { - *decpt = 1; - return nrv_alloc("0", rve, 1); - } - - /* compute k = floor(log10(d)). The computation may leave k - one too large, but should never leave k too small. */ - b = d2b(&u, &be, &bbits); - if (b == NULL) - goto failed_malloc; - if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) { - dval(&d2) = dval(&u); - word0(&d2) &= Frac_mask1; - word0(&d2) |= Exp_11; - - /* log(x) ~=~ log(1.5) + (x-1.5)/1.5 - * log10(x) = log(x) / log(10) - * ~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10)) - * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2) - * - * This suggests computing an approximation k to log10(d) by - * - * k = (i - Bias)*0.301029995663981 - * + ( (d2-1.5)*0.289529654602168 + 0.176091259055681 ); - * - * We want k to be too large rather than too small. - * The error in the first-order Taylor series approximation - * is in our favor, so we just round up the constant enough - * to compensate for any error in the multiplication of - * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077, - * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14, - * adding 1e-13 to the constant term more than suffices. - * Hence we adjust the constant term to 0.1760912590558. - * (We could get a more accurate k by invoking log10, - * but this is probably not worthwhile.) - */ - - i -= Bias; - denorm = 0; - } - else { - /* d is denormalized */ - - i = bbits + be + (Bias + (P-1) - 1); - x = i > 32 ? word0(&u) << (64 - i) | word1(&u) >> (i - 32) - : word1(&u) << (32 - i); - dval(&d2) = x; - word0(&d2) -= 31*Exp_msk1; /* adjust exponent */ - i -= (Bias + (P-1) - 1) + 1; - denorm = 1; - } - ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + - i*0.301029995663981; - k = (int)ds; - if (ds < 0. && ds != k) - k--; /* want k = floor(ds) */ - k_check = 1; - if (k >= 0 && k <= Ten_pmax) { - if (dval(&u) < tens[k]) - k--; - k_check = 0; - } - j = bbits - i - 1; - if (j >= 0) { - b2 = 0; - s2 = j; - } - else { - b2 = -j; - s2 = 0; - } - if (k >= 0) { - b5 = 0; - s5 = k; - s2 += k; - } - else { - b2 -= k; - b5 = -k; - s5 = 0; - } - if (mode < 0 || mode > 9) - mode = 0; - - try_quick = 1; - - if (mode > 5) { - mode -= 4; - try_quick = 0; - } - leftright = 1; - ilim = ilim1 = -1; /* Values for cases 0 and 1; done here to */ - /* silence erroneous "gcc -Wall" warning. */ - switch(mode) { - case 0: - case 1: - i = 18; - ndigits = 0; - break; - case 2: - leftright = 0; - /* no break */ - case 4: - if (ndigits <= 0) - ndigits = 1; - ilim = ilim1 = i = ndigits; - break; - case 3: - leftright = 0; - /* no break */ - case 5: - i = ndigits + k + 1; - ilim = i; - ilim1 = i - 1; - if (i <= 0) - i = 1; - } - s0 = rv_alloc(i); - if (s0 == NULL) - goto failed_malloc; - s = s0; - - - if (ilim >= 0 && ilim <= Quick_max && try_quick) { - - /* Try to get by with floating-point arithmetic. */ - - i = 0; - dval(&d2) = dval(&u); - k0 = k; - ilim0 = ilim; - ieps = 2; /* conservative */ - if (k > 0) { - ds = tens[k&0xf]; - j = k >> 4; - if (j & Bletch) { - /* prevent overflows */ - j &= Bletch - 1; - dval(&u) /= bigtens[n_bigtens-1]; - ieps++; - } - for(; j; j >>= 1, i++) - if (j & 1) { - ieps++; - ds *= bigtens[i]; - } - dval(&u) /= ds; - } - else if ((j1 = -k)) { - dval(&u) *= tens[j1 & 0xf]; - for(j = j1 >> 4; j; j >>= 1, i++) - if (j & 1) { - ieps++; - dval(&u) *= bigtens[i]; - } - } - if (k_check && dval(&u) < 1. && ilim > 0) { - if (ilim1 <= 0) - goto fast_failed; - ilim = ilim1; - k--; - dval(&u) *= 10.; - ieps++; - } - dval(&eps) = ieps*dval(&u) + 7.; - word0(&eps) -= (P-1)*Exp_msk1; - if (ilim == 0) { - S = mhi = 0; - dval(&u) -= 5.; - if (dval(&u) > dval(&eps)) - goto one_digit; - if (dval(&u) < -dval(&eps)) - goto no_digits; - goto fast_failed; - } - if (leftright) { - /* Use Steele & White method of only - * generating digits needed. - */ - dval(&eps) = 0.5/tens[ilim-1] - dval(&eps); - for(i = 0;;) { - L = (Long)dval(&u); - dval(&u) -= L; - *s++ = '0' + (int)L; - if (dval(&u) < dval(&eps)) - goto ret1; - if (1. - dval(&u) < dval(&eps)) - goto bump_up; - if (++i >= ilim) - break; - dval(&eps) *= 10.; - dval(&u) *= 10.; - } - } - else { - /* Generate ilim digits, then fix them up. */ - dval(&eps) *= tens[ilim-1]; - for(i = 1;; i++, dval(&u) *= 10.) { - L = (Long)(dval(&u)); - if (!(dval(&u) -= L)) - ilim = i; - *s++ = '0' + (int)L; - if (i == ilim) { - if (dval(&u) > 0.5 + dval(&eps)) - goto bump_up; - else if (dval(&u) < 0.5 - dval(&eps)) { - while(*--s == '0'); - s++; - goto ret1; - } - break; - } - } - } - fast_failed: - s = s0; - dval(&u) = dval(&d2); - k = k0; - ilim = ilim0; - } - - /* Do we have a "small" integer? */ - - if (be >= 0 && k <= Int_max) { - /* Yes. */ - ds = tens[k]; - if (ndigits < 0 && ilim <= 0) { - S = mhi = 0; - if (ilim < 0 || dval(&u) <= 5*ds) - goto no_digits; - goto one_digit; - } - for(i = 1;; i++, dval(&u) *= 10.) { - L = (Long)(dval(&u) / ds); - dval(&u) -= L*ds; - *s++ = '0' + (int)L; - if (!dval(&u)) { - break; - } - if (i == ilim) { - dval(&u) += dval(&u); - if (dval(&u) > ds || (dval(&u) == ds && L & 1)) { - bump_up: - while(*--s == '9') - if (s == s0) { - k++; - *s = '0'; - break; - } - ++*s++; - } - break; - } - } - goto ret1; - } - - m2 = b2; - m5 = b5; - if (leftright) { - i = - denorm ? be + (Bias + (P-1) - 1 + 1) : - 1 + P - bbits; - b2 += i; - s2 += i; - mhi = i2b(1); - if (mhi == NULL) - goto failed_malloc; - } - if (m2 > 0 && s2 > 0) { - i = m2 < s2 ? m2 : s2; - b2 -= i; - m2 -= i; - s2 -= i; - } - if (b5 > 0) { - if (leftright) { - if (m5 > 0) { - mhi = pow5mult(mhi, m5); - if (mhi == NULL) - goto failed_malloc; - b1 = mult(mhi, b); - Bfree(b); - b = b1; - if (b == NULL) - goto failed_malloc; - } - if ((j = b5 - m5)) { - b = pow5mult(b, j); - if (b == NULL) - goto failed_malloc; - } - } - else { - b = pow5mult(b, b5); - if (b == NULL) - goto failed_malloc; - } - } - S = i2b(1); - if (S == NULL) - goto failed_malloc; - if (s5 > 0) { - S = pow5mult(S, s5); - if (S == NULL) - goto failed_malloc; - } - - /* Check for special case that d is a normalized power of 2. */ - - spec_case = 0; - if ((mode < 2 || leftright) - ) { - if (!word1(&u) && !(word0(&u) & Bndry_mask) - && word0(&u) & (Exp_mask & ~Exp_msk1) - ) { - /* The special case */ - b2 += Log2P; - s2 += Log2P; - spec_case = 1; - } - } - - /* Arrange for convenient computation of quotients: - * shift left if necessary so divisor has 4 leading 0 bits. - * - * Perhaps we should just compute leading 28 bits of S once - * and for all and pass them and a shift to quorem, so it - * can do shifts and ors to compute the numerator for q. - */ -#define iInc 28 - i = dshift(S, s2); - b2 += i; - m2 += i; - s2 += i; - if (b2 > 0) { - b = lshift(b, b2); - if (b == NULL) - goto failed_malloc; - } - if (s2 > 0) { - S = lshift(S, s2); - if (S == NULL) - goto failed_malloc; - } - if (k_check) { - if (cmp(b,S) < 0) { - k--; - b = multadd(b, 10, 0); /* we botched the k estimate */ - if (b == NULL) - goto failed_malloc; - if (leftright) { - mhi = multadd(mhi, 10, 0); - if (mhi == NULL) - goto failed_malloc; - } - ilim = ilim1; - } - } - if (ilim <= 0 && (mode == 3 || mode == 5)) { - if (ilim < 0) { - /* no digits, fcvt style */ - no_digits: - k = -1 - ndigits; - goto ret; - } - else { - S = multadd(S, 5, 0); - if (S == NULL) - goto failed_malloc; - if (cmp(b, S) <= 0) - goto no_digits; - } - one_digit: - *s++ = '1'; - k++; - goto ret; - } - if (leftright) { - if (m2 > 0) { - mhi = lshift(mhi, m2); - if (mhi == NULL) - goto failed_malloc; - } - - /* Compute mlo -- check for special case - * that d is a normalized power of 2. - */ - - mlo = mhi; - if (spec_case) { - mhi = Balloc(mhi->k); - if (mhi == NULL) - goto failed_malloc; - Bcopy(mhi, mlo); - mhi = lshift(mhi, Log2P); - if (mhi == NULL) - goto failed_malloc; - } - - for(i = 1;;i++) { - dig = quorem(b,S) + '0'; - /* Do we yet have the shortest decimal string - * that will round to d? - */ - j = cmp(b, mlo); - delta = diff(S, mhi); - if (delta == NULL) - goto failed_malloc; - j1 = delta->sign ? 1 : cmp(b, delta); - Bfree(delta); - if (j1 == 0 && mode != 1 && !(word1(&u) & 1) - ) { - if (dig == '9') - goto round_9_up; - if (j > 0) - dig++; - *s++ = dig; - goto ret; - } - if (j < 0 || (j == 0 && mode != 1 - && !(word1(&u) & 1) - )) { - if (!b->x[0] && b->wds <= 1) { - goto accept_dig; - } - if (j1 > 0) { - b = lshift(b, 1); - if (b == NULL) - goto failed_malloc; - j1 = cmp(b, S); - if ((j1 > 0 || (j1 == 0 && dig & 1)) - && dig++ == '9') - goto round_9_up; - } - accept_dig: - *s++ = dig; - goto ret; - } - if (j1 > 0) { - if (dig == '9') { /* possible if i == 1 */ - round_9_up: - *s++ = '9'; - goto roundoff; - } - *s++ = dig + 1; - goto ret; - } - *s++ = dig; - if (i == ilim) - break; - b = multadd(b, 10, 0); - if (b == NULL) - goto failed_malloc; - if (mlo == mhi) { - mlo = mhi = multadd(mhi, 10, 0); - if (mlo == NULL) - goto failed_malloc; - } - else { - mlo = multadd(mlo, 10, 0); - if (mlo == NULL) - goto failed_malloc; - mhi = multadd(mhi, 10, 0); - if (mhi == NULL) - goto failed_malloc; - } - } - } - else - for(i = 1;; i++) { - *s++ = dig = quorem(b,S) + '0'; - if (!b->x[0] && b->wds <= 1) { - goto ret; - } - if (i >= ilim) - break; - b = multadd(b, 10, 0); - if (b == NULL) - goto failed_malloc; - } - - /* Round off last digit */ - - b = lshift(b, 1); - if (b == NULL) - goto failed_malloc; - j = cmp(b, S); - if (j > 0 || (j == 0 && dig & 1)) { - roundoff: - while(*--s == '9') - if (s == s0) { - k++; - *s++ = '1'; - goto ret; - } - ++*s++; - } - else { - while(*--s == '0'); - s++; - } - ret: - Bfree(S); - if (mhi) { - if (mlo && mlo != mhi) - Bfree(mlo); - Bfree(mhi); - } - ret1: - Bfree(b); - *s = 0; - *decpt = k + 1; - if (rve) - *rve = s; - return s0; - failed_malloc: - if (S) - Bfree(S); - if (mlo && mlo != mhi) - Bfree(mlo); - if (mhi) - Bfree(mhi); - if (b) - Bfree(b); - if (s0) - _Py_dg_freedtoa(s0); - return NULL; -} -#ifdef __cplusplus -} -#endif - -#endif /* PY_NO_SHORT_FLOAT_REPR */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/dynload_stub.c b/AppPkg/Applications/Python/Python-2.7.10/Python/dynload_stub.c deleted file mode 100644 index 80f4abf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/dynload_stub.c +++ /dev/null @@ -1,11 +0,0 @@ - -/* This module provides the necessary stubs for when dynamic loading is - not present. */ - -#include "Python.h" -#include "importdl.h" - - -const struct filedescr _PyImport_DynLoadFiletab[] = { - {0, 0} -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/errors.c b/AppPkg/Applications/Python/Python-2.7.10/Python/errors.c deleted file mode 100644 index 8e9b5da..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/errors.c +++ /dev/null @@ -1,827 +0,0 @@ - -/* Error handling */ - -#include "Python.h" - -#ifndef __STDC__ -#ifndef MS_WINDOWS -extern char *strerror(int); -#endif -#endif - -#ifdef MS_WINDOWS -#include "windows.h" -#include "winbase.h" -#endif - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - -void -PyErr_Restore(PyObject *type, PyObject *value, PyObject *traceback) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *oldtype, *oldvalue, *oldtraceback; - - if (traceback != NULL && !PyTraceBack_Check(traceback)) { - /* XXX Should never happen -- fatal error instead? */ - /* Well, it could be None. */ - Py_DECREF(traceback); - traceback = NULL; - } - - /* Save these in locals to safeguard against recursive - invocation through Py_XDECREF */ - oldtype = tstate->curexc_type; - oldvalue = tstate->curexc_value; - oldtraceback = tstate->curexc_traceback; - - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = traceback; - - Py_XDECREF(oldtype); - Py_XDECREF(oldvalue); - Py_XDECREF(oldtraceback); -} - -void -PyErr_SetObject(PyObject *exception, PyObject *value) -{ - Py_XINCREF(exception); - Py_XINCREF(value); - PyErr_Restore(exception, value, (PyObject *)NULL); -} - -void -PyErr_SetNone(PyObject *exception) -{ - PyErr_SetObject(exception, (PyObject *)NULL); -} - -void -PyErr_SetString(PyObject *exception, const char *string) -{ - PyObject *value = PyString_FromString(string); - PyErr_SetObject(exception, value); - Py_XDECREF(value); -} - - -PyObject * -PyErr_Occurred(void) -{ - PyThreadState *tstate = PyThreadState_GET(); - - return tstate->curexc_type; -} - - -int -PyErr_GivenExceptionMatches(PyObject *err, PyObject *exc) -{ - if (err == NULL || exc == NULL) { - /* maybe caused by "import exceptions" that failed early on */ - return 0; - } - if (PyTuple_Check(exc)) { - Py_ssize_t i, n; - n = PyTuple_Size(exc); - for (i = 0; i < n; i++) { - /* Test recursively */ - if (PyErr_GivenExceptionMatches( - err, PyTuple_GET_ITEM(exc, i))) - { - return 1; - } - } - return 0; - } - /* err might be an instance, so check its class. */ - if (PyExceptionInstance_Check(err)) - err = PyExceptionInstance_Class(err); - - if (PyExceptionClass_Check(err) && PyExceptionClass_Check(exc)) { - int res = 0, reclimit; - PyObject *exception, *value, *tb; - PyErr_Fetch(&exception, &value, &tb); - /* Temporarily bump the recursion limit, so that in the most - common case PyObject_IsSubclass will not raise a recursion - error we have to ignore anyway. Don't do it when the limit - is already insanely high, to avoid overflow */ - reclimit = Py_GetRecursionLimit(); - if (reclimit < (1 << 30)) - Py_SetRecursionLimit(reclimit + 5); - res = PyObject_IsSubclass(err, exc); - Py_SetRecursionLimit(reclimit); - /* This function must not fail, so print the error here */ - if (res == -1) { - PyErr_WriteUnraisable(err); - res = 0; - } - PyErr_Restore(exception, value, tb); - return res; - } - - return err == exc; -} - - -int -PyErr_ExceptionMatches(PyObject *exc) -{ - return PyErr_GivenExceptionMatches(PyErr_Occurred(), exc); -} - - -/* Used in many places to normalize a raised exception, including in - eval_code2(), do_raise(), and PyErr_Print() -*/ -void -PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb) -{ - PyObject *type = *exc; - PyObject *value = *val; - PyObject *inclass = NULL; - PyObject *initial_tb = NULL; - PyThreadState *tstate = NULL; - - if (type == NULL) { - /* There was no exception, so nothing to do. */ - return; - } - - /* If PyErr_SetNone() was used, the value will have been actually - set to NULL. - */ - if (!value) { - value = Py_None; - Py_INCREF(value); - } - - if (PyExceptionInstance_Check(value)) - inclass = PyExceptionInstance_Class(value); - - /* Normalize the exception so that if the type is a class, the - value will be an instance. - */ - if (PyExceptionClass_Check(type)) { - /* if the value was not an instance, or is not an instance - whose class is (or is derived from) type, then use the - value as an argument to instantiation of the type - class. - */ - if (!inclass || !PyObject_IsSubclass(inclass, type)) { - PyObject *args, *res; - - if (value == Py_None) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } - else - args = PyTuple_Pack(1, value); - - if (args == NULL) - goto finally; - res = PyEval_CallObject(type, args); - Py_DECREF(args); - if (res == NULL) - goto finally; - Py_DECREF(value); - value = res; - } - /* if the class of the instance doesn't exactly match the - class of the type, believe the instance - */ - else if (inclass != type) { - Py_DECREF(type); - type = inclass; - Py_INCREF(type); - } - } - *exc = type; - *val = value; - return; -finally: - Py_DECREF(type); - Py_DECREF(value); - /* If the new exception doesn't set a traceback and the old - exception had a traceback, use the old traceback for the - new exception. It's better than nothing. - */ - initial_tb = *tb; - PyErr_Fetch(exc, val, tb); - if (initial_tb != NULL) { - if (*tb == NULL) - *tb = initial_tb; - else - Py_DECREF(initial_tb); - } - /* normalize recursively */ - tstate = PyThreadState_GET(); - if (++tstate->recursion_depth > Py_GetRecursionLimit()) { - --tstate->recursion_depth; - /* throw away the old exception... */ - Py_DECREF(*exc); - Py_DECREF(*val); - /* ... and use the recursion error instead */ - *exc = PyExc_RuntimeError; - *val = PyExc_RecursionErrorInst; - Py_INCREF(*exc); - Py_INCREF(*val); - /* just keeping the old traceback */ - return; - } - PyErr_NormalizeException(exc, val, tb); - --tstate->recursion_depth; -} - - -void -PyErr_Fetch(PyObject **p_type, PyObject **p_value, PyObject **p_traceback) -{ - PyThreadState *tstate = PyThreadState_GET(); - - *p_type = tstate->curexc_type; - *p_value = tstate->curexc_value; - *p_traceback = tstate->curexc_traceback; - - tstate->curexc_type = NULL; - tstate->curexc_value = NULL; - tstate->curexc_traceback = NULL; -} - -void -PyErr_Clear(void) -{ - PyErr_Restore(NULL, NULL, NULL); -} - -/* Restore previously fetched exception if an exception is not set, - otherwise drop previously fetched exception. - Like _PyErr_ChainExceptions() in Python 3, but doesn't set the context. - */ -void -_PyErr_ReplaceException(PyObject *exc, PyObject *val, PyObject *tb) -{ - if (exc == NULL) - return; - - if (PyErr_Occurred()) { - Py_DECREF(exc); - Py_XDECREF(val); - Py_XDECREF(tb); - } - else { - PyErr_Restore(exc, val, tb); - } -} - -/* Convenience functions to set a type error exception and return 0 */ - -int -PyErr_BadArgument(void) -{ - PyErr_SetString(PyExc_TypeError, - "bad argument type for built-in operation"); - return 0; -} - -PyObject * -PyErr_NoMemory(void) -{ - if (PyErr_ExceptionMatches(PyExc_MemoryError)) - /* already current */ - return NULL; - - /* raise the pre-allocated instance if it still exists */ - if (PyExc_MemoryErrorInst) - PyErr_SetObject(PyExc_MemoryError, PyExc_MemoryErrorInst); - else - /* this will probably fail since there's no memory and hee, - hee, we have to instantiate this class - */ - PyErr_SetNone(PyExc_MemoryError); - - return NULL; -} - -PyObject * -PyErr_SetFromErrnoWithFilenameObject(PyObject *exc, PyObject *filenameObject) -{ - PyObject *v; - char *s; - int i = errno; -#ifdef PLAN9 - char errbuf[ERRMAX]; -#endif -#ifdef MS_WINDOWS - char *s_buf = NULL; - char s_small_buf[28]; /* Room for "Windows Error 0xFFFFFFFF" */ -#endif -#ifdef EINTR - if (i == EINTR && PyErr_CheckSignals()) - return NULL; -#endif -#ifdef PLAN9 - rerrstr(errbuf, sizeof errbuf); - s = errbuf; -#else - if (i == 0) - s = "Error"; /* Sometimes errno didn't get set */ - else -#ifndef MS_WINDOWS - s = strerror(i); -#else - { - /* Note that the Win32 errors do not lineup with the - errno error. So if the error is in the MSVC error - table, we use it, otherwise we assume it really _is_ - a Win32 error code - */ - if (i > 0 && i < _sys_nerr) { - s = _sys_errlist[i]; - } - else { - int len = FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, /* no message source */ - i, - MAKELANGID(LANG_NEUTRAL, - SUBLANG_DEFAULT), - /* Default language */ - (LPTSTR) &s_buf, - 0, /* size not used */ - NULL); /* no args */ - if (len==0) { - /* Only ever seen this in out-of-mem - situations */ - sprintf(s_small_buf, "Windows Error 0x%X", i); - s = s_small_buf; - s_buf = NULL; - } else { - s = s_buf; - /* remove trailing cr/lf and dots */ - while (len > 0 && (s[len-1] <= ' ' || s[len-1] == '.')) - s[--len] = '\0'; - } - } - } -#endif /* Unix/Windows */ -#endif /* PLAN 9*/ - if (filenameObject != NULL) - v = Py_BuildValue("(isO)", i, s, filenameObject); - else - v = Py_BuildValue("(is)", i, s); - if (v != NULL) { - PyErr_SetObject(exc, v); - Py_DECREF(v); - } -#ifdef MS_WINDOWS - LocalFree(s_buf); -#endif - return NULL; -} - - -PyObject * -PyErr_SetFromErrnoWithFilename(PyObject *exc, const char *filename) -{ - PyObject *name = filename ? PyString_FromString(filename) : NULL; - PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); - Py_XDECREF(name); - return result; -} - -#ifdef MS_WINDOWS -PyObject * -PyErr_SetFromErrnoWithUnicodeFilename(PyObject *exc, const Py_UNICODE *filename) -{ - PyObject *name = filename ? - PyUnicode_FromUnicode(filename, wcslen(filename)) : - NULL; - PyObject *result = PyErr_SetFromErrnoWithFilenameObject(exc, name); - Py_XDECREF(name); - return result; -} -#endif /* MS_WINDOWS */ - -PyObject * -PyErr_SetFromErrno(PyObject *exc) -{ - return PyErr_SetFromErrnoWithFilenameObject(exc, NULL); -} - -#ifdef MS_WINDOWS -/* Windows specific error code handling */ -PyObject *PyErr_SetExcFromWindowsErrWithFilenameObject( - PyObject *exc, - int ierr, - PyObject *filenameObject) -{ - int len; - char *s; - char *s_buf = NULL; /* Free via LocalFree */ - char s_small_buf[28]; /* Room for "Windows Error 0xFFFFFFFF" */ - PyObject *v; - DWORD err = (DWORD)ierr; - if (err==0) err = GetLastError(); - len = FormatMessage( - /* Error API error */ - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, /* no message source */ - err, - MAKELANGID(LANG_NEUTRAL, - SUBLANG_DEFAULT), /* Default language */ - (LPTSTR) &s_buf, - 0, /* size not used */ - NULL); /* no args */ - if (len==0) { - /* Only seen this in out of mem situations */ - sprintf(s_small_buf, "Windows Error 0x%X", err); - s = s_small_buf; - s_buf = NULL; - } else { - s = s_buf; - /* remove trailing cr/lf and dots */ - while (len > 0 && (s[len-1] <= ' ' || s[len-1] == '.')) - s[--len] = '\0'; - } - if (filenameObject != NULL) - v = Py_BuildValue("(isO)", err, s, filenameObject); - else - v = Py_BuildValue("(is)", err, s); - if (v != NULL) { - PyErr_SetObject(exc, v); - Py_DECREF(v); - } - LocalFree(s_buf); - return NULL; -} - -PyObject *PyErr_SetExcFromWindowsErrWithFilename( - PyObject *exc, - int ierr, - const char *filename) -{ - PyObject *name = filename ? PyString_FromString(filename) : NULL; - PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, - ierr, - name); - Py_XDECREF(name); - return ret; -} - -PyObject *PyErr_SetExcFromWindowsErrWithUnicodeFilename( - PyObject *exc, - int ierr, - const Py_UNICODE *filename) -{ - PyObject *name = filename ? - PyUnicode_FromUnicode(filename, wcslen(filename)) : - NULL; - PyObject *ret = PyErr_SetExcFromWindowsErrWithFilenameObject(exc, - ierr, - name); - Py_XDECREF(name); - return ret; -} - -PyObject *PyErr_SetExcFromWindowsErr(PyObject *exc, int ierr) -{ - return PyErr_SetExcFromWindowsErrWithFilename(exc, ierr, NULL); -} - -PyObject *PyErr_SetFromWindowsErr(int ierr) -{ - return PyErr_SetExcFromWindowsErrWithFilename(PyExc_WindowsError, - ierr, NULL); -} -PyObject *PyErr_SetFromWindowsErrWithFilename( - int ierr, - const char *filename) -{ - PyObject *name = filename ? PyString_FromString(filename) : NULL; - PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( - PyExc_WindowsError, - ierr, name); - Py_XDECREF(name); - return result; -} - -PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename( - int ierr, - const Py_UNICODE *filename) -{ - PyObject *name = filename ? - PyUnicode_FromUnicode(filename, wcslen(filename)) : - NULL; - PyObject *result = PyErr_SetExcFromWindowsErrWithFilenameObject( - PyExc_WindowsError, - ierr, name); - Py_XDECREF(name); - return result; -} -#endif /* MS_WINDOWS */ - -void -_PyErr_BadInternalCall(char *filename, int lineno) -{ - PyErr_Format(PyExc_SystemError, - "%s:%d: bad argument to internal function", - filename, lineno); -} - -/* Remove the preprocessor macro for PyErr_BadInternalCall() so that we can - export the entry point for existing object code: */ -#undef PyErr_BadInternalCall -void -PyErr_BadInternalCall(void) -{ - PyErr_Format(PyExc_SystemError, - "bad argument to internal function"); -} -#define PyErr_BadInternalCall() _PyErr_BadInternalCall(__FILE__, __LINE__) - - - -PyObject * -PyErr_Format(PyObject *exception, const char *format, ...) -{ - va_list vargs; - PyObject* string; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, format); -#else - va_start(vargs); -#endif - - string = PyString_FromFormatV(format, vargs); - PyErr_SetObject(exception, string); - Py_XDECREF(string); - va_end(vargs); - return NULL; -} - - - -PyObject * -PyErr_NewException(char *name, PyObject *base, PyObject *dict) -{ - char *dot; - PyObject *modulename = NULL; - PyObject *classname = NULL; - PyObject *mydict = NULL; - PyObject *bases = NULL; - PyObject *result = NULL; - dot = strrchr(name, '.'); - if (dot == NULL) { - PyErr_SetString(PyExc_SystemError, - "PyErr_NewException: name must be module.class"); - return NULL; - } - if (base == NULL) - base = PyExc_Exception; - if (dict == NULL) { - dict = mydict = PyDict_New(); - if (dict == NULL) - goto failure; - } - if (PyDict_GetItemString(dict, "__module__") == NULL) { - modulename = PyString_FromStringAndSize(name, - (Py_ssize_t)(dot-name)); - if (modulename == NULL) - goto failure; - if (PyDict_SetItemString(dict, "__module__", modulename) != 0) - goto failure; - } - if (PyTuple_Check(base)) { - bases = base; - /* INCREF as we create a new ref in the else branch */ - Py_INCREF(bases); - } else { - bases = PyTuple_Pack(1, base); - if (bases == NULL) - goto failure; - } - /* Create a real new-style class. */ - result = PyObject_CallFunction((PyObject *)&PyType_Type, "sOO", - dot+1, bases, dict); - failure: - Py_XDECREF(bases); - Py_XDECREF(mydict); - Py_XDECREF(classname); - Py_XDECREF(modulename); - return result; -} - - -/* Create an exception with docstring */ -PyObject * -PyErr_NewExceptionWithDoc(char *name, char *doc, PyObject *base, PyObject *dict) -{ - int result; - PyObject *ret = NULL; - PyObject *mydict = NULL; /* points to the dict only if we create it */ - PyObject *docobj; - - if (dict == NULL) { - dict = mydict = PyDict_New(); - if (dict == NULL) { - return NULL; - } - } - - if (doc != NULL) { - docobj = PyString_FromString(doc); - if (docobj == NULL) - goto failure; - result = PyDict_SetItemString(dict, "__doc__", docobj); - Py_DECREF(docobj); - if (result < 0) - goto failure; - } - - ret = PyErr_NewException(name, base, dict); - failure: - Py_XDECREF(mydict); - return ret; -} - - -/* Call when an exception has occurred but there is no way for Python - to handle it. Examples: exception in __del__ or during GC. */ -void -PyErr_WriteUnraisable(PyObject *obj) -{ - PyObject *f, *t, *v, *tb; - PyErr_Fetch(&t, &v, &tb); - f = PySys_GetObject("stderr"); - if (f != NULL) { - PyFile_WriteString("Exception ", f); - if (t) { - PyObject* moduleName; - char* className; - assert(PyExceptionClass_Check(t)); - className = PyExceptionClass_Name(t); - if (className != NULL) { - char *dot = strrchr(className, '.'); - if (dot != NULL) - className = dot+1; - } - - moduleName = PyObject_GetAttrString(t, "__module__"); - if (moduleName == NULL) - PyFile_WriteString("", f); - else { - char* modstr = PyString_AsString(moduleName); - if (modstr && - strcmp(modstr, "exceptions") != 0) - { - PyFile_WriteString(modstr, f); - PyFile_WriteString(".", f); - } - } - if (className == NULL) - PyFile_WriteString("", f); - else - PyFile_WriteString(className, f); - if (v && v != Py_None) { - PyFile_WriteString(": ", f); - PyFile_WriteObject(v, f, 0); - } - Py_XDECREF(moduleName); - } - PyFile_WriteString(" in ", f); - PyFile_WriteObject(obj, f, 0); - PyFile_WriteString(" ignored\n", f); - PyErr_Clear(); /* Just in case */ - } - Py_XDECREF(t); - Py_XDECREF(v); - Py_XDECREF(tb); -} - -extern PyObject *PyModule_GetWarningsModule(void); - - -/* Set file and line information for the current exception. - If the exception is not a SyntaxError, also sets additional attributes - to make printing of exceptions believe it is a syntax error. */ - -void -PyErr_SyntaxLocation(const char *filename, int lineno) -{ - PyObject *exc, *v, *tb, *tmp; - - /* add attributes for the line number and filename for the error */ - PyErr_Fetch(&exc, &v, &tb); - PyErr_NormalizeException(&exc, &v, &tb); - /* XXX check that it is, indeed, a syntax error. It might not - * be, though. */ - tmp = PyInt_FromLong(lineno); - if (tmp == NULL) - PyErr_Clear(); - else { - if (PyObject_SetAttrString(v, "lineno", tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } - if (filename != NULL) { - tmp = PyString_FromString(filename); - if (tmp == NULL) - PyErr_Clear(); - else { - if (PyObject_SetAttrString(v, "filename", tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } - - tmp = PyErr_ProgramText(filename, lineno); - if (tmp) { - if (PyObject_SetAttrString(v, "text", tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } - } - if (PyObject_SetAttrString(v, "offset", Py_None)) { - PyErr_Clear(); - } - if (exc != PyExc_SyntaxError) { - if (!PyObject_HasAttrString(v, "msg")) { - tmp = PyObject_Str(v); - if (tmp) { - if (PyObject_SetAttrString(v, "msg", tmp)) - PyErr_Clear(); - Py_DECREF(tmp); - } else { - PyErr_Clear(); - } - } - if (!PyObject_HasAttrString(v, "print_file_and_line")) { - if (PyObject_SetAttrString(v, "print_file_and_line", - Py_None)) - PyErr_Clear(); - } - } - PyErr_Restore(exc, v, tb); -} - -/* com_fetch_program_text will attempt to load the line of text that - the exception refers to. If it fails, it will return NULL but will - not set an exception. - - XXX The functionality of this function is quite similar to the - functionality in tb_displayline() in traceback.c. -*/ - -PyObject * -PyErr_ProgramText(const char *filename, int lineno) -{ - FILE *fp; - int i; - char linebuf[1000]; - - if (filename == NULL || *filename == '\0' || lineno <= 0) - return NULL; - fp = fopen(filename, "r" PY_STDIOTEXTMODE); - if (fp == NULL) - return NULL; - for (i = 0; i < lineno; i++) { - char *pLastChar = &linebuf[sizeof(linebuf) - 2]; - do { - *pLastChar = '\0'; - if (Py_UniversalNewlineFgets(linebuf, sizeof linebuf, fp, NULL) == NULL) - break; - /* fgets read *something*; if it didn't get as - far as pLastChar, it must have found a newline - or hit the end of the file; if pLastChar is \n, - it obviously found a newline; else we haven't - yet seen a newline, so must continue */ - } while (*pLastChar != '\0' && *pLastChar != '\n'); - } - fclose(fp); - if (i == lineno) { - char *p = linebuf; - while (*p == ' ' || *p == '\t' || *p == '\014') - p++; - return PyString_FromString(p); - } - return NULL; -} - -#ifdef __cplusplus -} -#endif - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/formatter_string.c b/AppPkg/Applications/Python/Python-2.7.10/Python/formatter_string.c deleted file mode 100644 index 1ab52e7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/formatter_string.c +++ /dev/null @@ -1,17 +0,0 @@ -/***********************************************************************/ -/* Implements the string (as opposed to unicode) version of the - built-in formatters for string, int, float. That is, the versions - of int.__format__, etc., that take and return string objects */ - -#include "Python.h" -#include "../Objects/stringlib/stringdefs.h" - -#define FORMAT_STRING _PyBytes_FormatAdvanced -#define FORMAT_LONG _PyLong_FormatAdvanced -#define FORMAT_INT _PyInt_FormatAdvanced -#define FORMAT_FLOAT _PyFloat_FormatAdvanced -#ifndef WITHOUT_COMPLEX -#define FORMAT_COMPLEX _PyComplex_FormatAdvanced -#endif - -#include "../Objects/stringlib/formatter.h" diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/formatter_unicode.c b/AppPkg/Applications/Python/Python-2.7.10/Python/formatter_unicode.c deleted file mode 100644 index c431639..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/formatter_unicode.c +++ /dev/null @@ -1,18 +0,0 @@ -/* Implements the unicode (as opposed to string) version of the - built-in formatter for unicode. That is, unicode.__format__(). */ - -#include "Python.h" - -#ifdef Py_USING_UNICODE - -#include "../Objects/stringlib/unicodedefs.h" - -#define FORMAT_STRING _PyUnicode_FormatAdvanced - -/* don't define FORMAT_LONG, FORMAT_FLOAT, and FORMAT_COMPLEX, since - we can live with only the string versions of those. The builtin - format() will convert them to unicode. */ - -#include "../Objects/stringlib/formatter.h" - -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/frozen.c b/AppPkg/Applications/Python/Python-2.7.10/Python/frozen.c deleted file mode 100644 index 1ec3603..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/frozen.c +++ /dev/null @@ -1,38 +0,0 @@ - -/* Dummy frozen modules initializer */ - -#include "Python.h" - -/* In order to test the support for frozen modules, by default we - define a single frozen module, __hello__. Loading it will print - some famous words... */ - -/* To regenerate this data after the bytecode or marshal format has changed, - go to ../Tools/freeze/ and freeze the hello.py file; then copy and paste - the appropriate bytes from M___main__.c. */ - -static unsigned char M___hello__[] = { - 99,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0, - 0,115,9,0,0,0,100,0,0,71,72,100,1,0,83,40, - 2,0,0,0,115,14,0,0,0,72,101,108,108,111,32,119, - 111,114,108,100,46,46,46,78,40,0,0,0,0,40,0,0, - 0,0,40,0,0,0,0,40,0,0,0,0,115,8,0,0, - 0,104,101,108,108,111,46,112,121,115,1,0,0,0,63,1, - 0,0,0,115,0,0,0,0, -}; - -#define SIZE (int)sizeof(M___hello__) - -static struct _frozen _PyImport_FrozenModules[] = { - /* Test module */ - {"__hello__", M___hello__, SIZE}, - /* Test package (negative size indicates package-ness) */ - {"__phello__", M___hello__, -SIZE}, - {"__phello__.spam", M___hello__, SIZE}, - {0, 0, 0} /* sentinel */ -}; - -/* Embedding apps may change this pointer to point to their favorite - collection of frozen modules: */ - -struct _frozen *PyImport_FrozenModules = _PyImport_FrozenModules; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/future.c b/AppPkg/Applications/Python/Python-2.7.10/Python/future.c deleted file mode 100644 index 740678d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/future.c +++ /dev/null @@ -1,137 +0,0 @@ -#include "Python.h" -#include "Python-ast.h" -#include "node.h" -#include "token.h" -#include "graminit.h" -#include "code.h" -#include "compile.h" -#include "symtable.h" - -#define UNDEFINED_FUTURE_FEATURE "future feature %.100s is not defined" -#define ERR_LATE_FUTURE \ -"from __future__ imports must occur at the beginning of the file" - -static int -future_check_features(PyFutureFeatures *ff, stmt_ty s, const char *filename) -{ - int i; - asdl_seq *names; - - assert(s->kind == ImportFrom_kind); - - names = s->v.ImportFrom.names; - for (i = 0; i < asdl_seq_LEN(names); i++) { - alias_ty name = (alias_ty)asdl_seq_GET(names, i); - const char *feature = PyString_AsString(name->name); - if (!feature) - return 0; - if (strcmp(feature, FUTURE_NESTED_SCOPES) == 0) { - continue; - } else if (strcmp(feature, FUTURE_GENERATORS) == 0) { - continue; - } else if (strcmp(feature, FUTURE_DIVISION) == 0) { - ff->ff_features |= CO_FUTURE_DIVISION; - } else if (strcmp(feature, FUTURE_ABSOLUTE_IMPORT) == 0) { - ff->ff_features |= CO_FUTURE_ABSOLUTE_IMPORT; - } else if (strcmp(feature, FUTURE_WITH_STATEMENT) == 0) { - ff->ff_features |= CO_FUTURE_WITH_STATEMENT; - } else if (strcmp(feature, FUTURE_PRINT_FUNCTION) == 0) { - ff->ff_features |= CO_FUTURE_PRINT_FUNCTION; - } else if (strcmp(feature, FUTURE_UNICODE_LITERALS) == 0) { - ff->ff_features |= CO_FUTURE_UNICODE_LITERALS; - } else if (strcmp(feature, "braces") == 0) { - PyErr_SetString(PyExc_SyntaxError, - "not a chance"); - PyErr_SyntaxLocation(filename, s->lineno); - return 0; - } else { - PyErr_Format(PyExc_SyntaxError, - UNDEFINED_FUTURE_FEATURE, feature); - PyErr_SyntaxLocation(filename, s->lineno); - return 0; - } - } - return 1; -} - -static int -future_parse(PyFutureFeatures *ff, mod_ty mod, const char *filename) -{ - int i, found_docstring = 0, done = 0, prev_line = 0; - - if (!(mod->kind == Module_kind || mod->kind == Interactive_kind)) - return 1; - - /* A subsequent pass will detect future imports that don't - appear at the beginning of the file. There's one case, - however, that is easier to handle here: A series of imports - joined by semi-colons, where the first import is a future - statement but some subsequent import has the future form - but is preceded by a regular import. - */ - - - for (i = 0; i < asdl_seq_LEN(mod->v.Module.body); i++) { - stmt_ty s = (stmt_ty)asdl_seq_GET(mod->v.Module.body, i); - - if (done && s->lineno > prev_line) - return 1; - prev_line = s->lineno; - - /* The tests below will return from this function unless it is - still possible to find a future statement. The only things - that can precede a future statement are another future - statement and a doc string. - */ - - if (s->kind == ImportFrom_kind) { - identifier modname = s->v.ImportFrom.module; - if (modname && PyString_GET_SIZE(modname) == 10 && - !strcmp(PyString_AS_STRING(modname), "__future__")) { - if (done) { - PyErr_SetString(PyExc_SyntaxError, - ERR_LATE_FUTURE); - PyErr_SyntaxLocation(filename, - s->lineno); - return 0; - } - if (!future_check_features(ff, s, filename)) - return 0; - ff->ff_lineno = s->lineno; - } - else - done = 1; - } - else if (s->kind == Expr_kind && !found_docstring) { - expr_ty e = s->v.Expr.value; - if (e->kind != Str_kind) - done = 1; - else - found_docstring = 1; - } - else - done = 1; - } - return 1; -} - - -PyFutureFeatures * -PyFuture_FromAST(mod_ty mod, const char *filename) -{ - PyFutureFeatures *ff; - - ff = (PyFutureFeatures *)PyObject_Malloc(sizeof(PyFutureFeatures)); - if (ff == NULL) { - PyErr_NoMemory(); - return NULL; - } - ff->ff_features = 0; - ff->ff_lineno = -1; - - if (!future_parse(ff, mod, filename)) { - PyObject_Free(ff); - return NULL; - } - return ff; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/getargs.c b/AppPkg/Applications/Python/Python-2.7.10/Python/getargs.c deleted file mode 100644 index debec57..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/getargs.c +++ /dev/null @@ -1,1908 +0,0 @@ - -/* New getargs implementation */ - -#include "Python.h" - -#include - - -#ifdef __cplusplus -extern "C" { -#endif -int PyArg_Parse(PyObject *, const char *, ...); -int PyArg_ParseTuple(PyObject *, const char *, ...); -int PyArg_VaParse(PyObject *, const char *, va_list); - -int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, - const char *, char **, ...); -int PyArg_VaParseTupleAndKeywords(PyObject *, PyObject *, - const char *, char **, va_list); - -#ifdef HAVE_DECLSPEC_DLL -/* Export functions */ -PyAPI_FUNC(int) _PyArg_Parse_SizeT(PyObject *, char *, ...); -PyAPI_FUNC(int) _PyArg_ParseTuple_SizeT(PyObject *, char *, ...); -PyAPI_FUNC(int) _PyArg_ParseTupleAndKeywords_SizeT(PyObject *, PyObject *, - const char *, char **, ...); -PyAPI_FUNC(PyObject *) _Py_BuildValue_SizeT(const char *, ...); -PyAPI_FUNC(int) _PyArg_VaParse_SizeT(PyObject *, char *, va_list); -PyAPI_FUNC(int) _PyArg_VaParseTupleAndKeywords_SizeT(PyObject *, PyObject *, - const char *, char **, va_list); -#endif - -#define FLAG_COMPAT 1 -#define FLAG_SIZE_T 2 - - -/* Forward */ -static int vgetargs1(PyObject *, const char *, va_list *, int); -static void seterror(int, const char *, int *, const char *, const char *); -static char *convertitem(PyObject *, const char **, va_list *, int, int *, - char *, size_t, PyObject **); -static char *converttuple(PyObject *, const char **, va_list *, int, - int *, char *, size_t, int, PyObject **); -static char *convertsimple(PyObject *, const char **, va_list *, int, char *, - size_t, PyObject **); -static Py_ssize_t convertbuffer(PyObject *, void **p, char **); -static int getbuffer(PyObject *, Py_buffer *, char**); - -static int vgetargskeywords(PyObject *, PyObject *, - const char *, char **, va_list *, int); -static char *skipitem(const char **, va_list *, int); - -int -PyArg_Parse(PyObject *args, const char *format, ...) -{ - int retval; - va_list va; - - va_start(va, format); - retval = vgetargs1(args, format, &va, FLAG_COMPAT); - va_end(va); - return retval; -} - -int -_PyArg_Parse_SizeT(PyObject *args, char *format, ...) -{ - int retval; - va_list va; - - va_start(va, format); - retval = vgetargs1(args, format, &va, FLAG_COMPAT|FLAG_SIZE_T); - va_end(va); - return retval; -} - - -int -PyArg_ParseTuple(PyObject *args, const char *format, ...) -{ - int retval; - va_list va; - - va_start(va, format); - retval = vgetargs1(args, format, &va, 0); - va_end(va); - return retval; -} - -int -_PyArg_ParseTuple_SizeT(PyObject *args, char *format, ...) -{ - int retval; - va_list va; - - va_start(va, format); - retval = vgetargs1(args, format, &va, FLAG_SIZE_T); - va_end(va); - return retval; -} - - -int -PyArg_VaParse(PyObject *args, const char *format, va_list va) -{ - va_list lva; - -#ifdef VA_LIST_IS_ARRAY - memcpy(lva, va, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(lva, va); -#else - lva = va; -#endif -#endif - - return vgetargs1(args, format, &lva, 0); -} - -int -_PyArg_VaParse_SizeT(PyObject *args, char *format, va_list va) -{ - va_list lva; - -#ifdef VA_LIST_IS_ARRAY - memcpy(lva, va, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(lva, va); -#else - lva = va; -#endif -#endif - - return vgetargs1(args, format, &lva, FLAG_SIZE_T); -} - - -/* Handle cleanup of allocated memory in case of exception */ - -#define GETARGS_CAPSULE_NAME_CLEANUP_PTR "getargs.cleanup_ptr" -#define GETARGS_CAPSULE_NAME_CLEANUP_BUFFER "getargs.cleanup_buffer" - -static void -cleanup_ptr(PyObject *self) -{ - void *ptr = PyCapsule_GetPointer(self, GETARGS_CAPSULE_NAME_CLEANUP_PTR); - if (ptr) { - PyMem_FREE(ptr); - } -} - -static void -cleanup_buffer(PyObject *self) -{ - Py_buffer *ptr = (Py_buffer *)PyCapsule_GetPointer(self, GETARGS_CAPSULE_NAME_CLEANUP_BUFFER); - if (ptr) { - PyBuffer_Release(ptr); - } -} - -static int -addcleanup(void *ptr, PyObject **freelist, PyCapsule_Destructor destr) -{ - PyObject *cobj; - const char *name; - - if (!*freelist) { - *freelist = PyList_New(0); - if (!*freelist) { - destr(ptr); - return -1; - } - } - - if (destr == cleanup_ptr) { - name = GETARGS_CAPSULE_NAME_CLEANUP_PTR; - } else if (destr == cleanup_buffer) { - name = GETARGS_CAPSULE_NAME_CLEANUP_BUFFER; - } else { - return -1; - } - cobj = PyCapsule_New(ptr, name, destr); - if (!cobj) { - destr(ptr); - return -1; - } - if (PyList_Append(*freelist, cobj)) { - Py_DECREF(cobj); - return -1; - } - Py_DECREF(cobj); - return 0; -} - -static int -cleanreturn(int retval, PyObject *freelist) -{ - if (freelist && retval != 0) { - /* We were successful, reset the destructors so that they - don't get called. */ - Py_ssize_t len = PyList_GET_SIZE(freelist), i; - for (i = 0; i < len; i++) - PyCapsule_SetDestructor(PyList_GET_ITEM(freelist, i), NULL); - } - Py_XDECREF(freelist); - return retval; -} - - -static int -vgetargs1(PyObject *args, const char *format, va_list *p_va, int flags) -{ - char msgbuf[256]; - int levels[32]; - const char *fname = NULL; - const char *message = NULL; - int min = -1; - int max = 0; - int level = 0; - int endfmt = 0; - const char *formatsave = format; - Py_ssize_t i, len; - char *msg; - PyObject *freelist = NULL; - int compat = flags & FLAG_COMPAT; - - assert(compat || (args != (PyObject*)NULL)); - flags = flags & ~FLAG_COMPAT; - - while (endfmt == 0) { - int c = *format++; - switch (c) { - case '(': - if (level == 0) - max++; - level++; - if (level >= 30) - Py_FatalError("too many tuple nesting levels " - "in argument format string"); - break; - case ')': - if (level == 0) - Py_FatalError("excess ')' in getargs format"); - else - level--; - break; - case '\0': - endfmt = 1; - break; - case ':': - fname = format; - endfmt = 1; - break; - case ';': - message = format; - endfmt = 1; - break; - default: - if (level == 0) { - if (c == 'O') - max++; - else if (isalpha(Py_CHARMASK(c))) { - if (c != 'e') /* skip encoded */ - max++; - } else if (c == '|') - min = max; - } - break; - } - } - - if (level != 0) - Py_FatalError(/* '(' */ "missing ')' in getargs format"); - - if (min < 0) - min = max; - - format = formatsave; - - if (compat) { - if (max == 0) { - if (args == NULL) - return 1; - PyOS_snprintf(msgbuf, sizeof(msgbuf), - "%.200s%s takes no arguments", - fname==NULL ? "function" : fname, - fname==NULL ? "" : "()"); - PyErr_SetString(PyExc_TypeError, msgbuf); - return 0; - } - else if (min == 1 && max == 1) { - if (args == NULL) { - PyOS_snprintf(msgbuf, sizeof(msgbuf), - "%.200s%s takes at least one argument", - fname==NULL ? "function" : fname, - fname==NULL ? "" : "()"); - PyErr_SetString(PyExc_TypeError, msgbuf); - return 0; - } - msg = convertitem(args, &format, p_va, flags, levels, - msgbuf, sizeof(msgbuf), &freelist); - if (msg == NULL) - return cleanreturn(1, freelist); - seterror(levels[0], msg, levels+1, fname, message); - return cleanreturn(0, freelist); - } - else { - PyErr_SetString(PyExc_SystemError, - "old style getargs format uses new features"); - return 0; - } - } - - if (!PyTuple_Check(args)) { - PyErr_SetString(PyExc_SystemError, - "new style getargs format but argument is not a tuple"); - return 0; - } - - len = PyTuple_GET_SIZE(args); - - if (len < min || max < len) { - if (message == NULL) { - PyOS_snprintf(msgbuf, sizeof(msgbuf), - "%.150s%s takes %s %d argument%s " - "(%ld given)", - fname==NULL ? "function" : fname, - fname==NULL ? "" : "()", - min==max ? "exactly" - : len < min ? "at least" : "at most", - len < min ? min : max, - (len < min ? min : max) == 1 ? "" : "s", - Py_SAFE_DOWNCAST(len, Py_ssize_t, long)); - message = msgbuf; - } - PyErr_SetString(PyExc_TypeError, message); - return 0; - } - - for (i = 0; i < len; i++) { - if (*format == '|') - format++; - msg = convertitem(PyTuple_GET_ITEM(args, i), &format, p_va, - flags, levels, msgbuf, - sizeof(msgbuf), &freelist); - if (msg) { - seterror(i+1, msg, levels, fname, msg); - return cleanreturn(0, freelist); - } - } - - if (*format != '\0' && !isalpha(Py_CHARMASK(*format)) && - *format != '(' && - *format != '|' && *format != ':' && *format != ';') { - PyErr_Format(PyExc_SystemError, - "bad format string: %.200s", formatsave); - return cleanreturn(0, freelist); - } - - return cleanreturn(1, freelist); -} - - - -static void -seterror(int iarg, const char *msg, int *levels, const char *fname, - const char *message) -{ - char buf[512]; - int i; - char *p = buf; - - if (PyErr_Occurred()) - return; - else if (message == NULL) { - if (fname != NULL) { - PyOS_snprintf(p, sizeof(buf), "%.200s() ", fname); - p += strlen(p); - } - if (iarg != 0) { - PyOS_snprintf(p, sizeof(buf) - (p - buf), - "argument %d", iarg); - i = 0; - p += strlen(p); - while (levels[i] > 0 && i < 32 && (int)(p-buf) < 220) { - PyOS_snprintf(p, sizeof(buf) - (p - buf), - ", item %d", levels[i]-1); - p += strlen(p); - i++; - } - } - else { - PyOS_snprintf(p, sizeof(buf) - (p - buf), "argument"); - p += strlen(p); - } - PyOS_snprintf(p, sizeof(buf) - (p - buf), " %.256s", msg); - message = buf; - } - PyErr_SetString(PyExc_TypeError, message); -} - - -/* Convert a tuple argument. - On entry, *p_format points to the character _after_ the opening '('. - On successful exit, *p_format points to the closing ')'. - If successful: - *p_format and *p_va are updated, - *levels and *msgbuf are untouched, - and NULL is returned. - If the argument is invalid: - *p_format is unchanged, - *p_va is undefined, - *levels is a 0-terminated list of item numbers, - *msgbuf contains an error message, whose format is: - "must be , not ", where: - is the name of the expected type, and - is the name of the actual type, - and msgbuf is returned. -*/ - -static char * -converttuple(PyObject *arg, const char **p_format, va_list *p_va, int flags, - int *levels, char *msgbuf, size_t bufsize, int toplevel, - PyObject **freelist) -{ - int level = 0; - int n = 0; - const char *format = *p_format; - int i; - - for (;;) { - int c = *format++; - if (c == '(') { - if (level == 0) - n++; - level++; - } - else if (c == ')') { - if (level == 0) - break; - level--; - } - else if (c == ':' || c == ';' || c == '\0') - break; - else if (level == 0 && isalpha(Py_CHARMASK(c))) - n++; - } - - if (!PySequence_Check(arg) || PyString_Check(arg)) { - levels[0] = 0; - PyOS_snprintf(msgbuf, bufsize, - toplevel ? "expected %d arguments, not %.50s" : - "must be %d-item sequence, not %.50s", - n, - arg == Py_None ? "None" : arg->ob_type->tp_name); - return msgbuf; - } - - if ((i = PySequence_Size(arg)) != n) { - levels[0] = 0; - PyOS_snprintf(msgbuf, bufsize, - toplevel ? "expected %d arguments, not %d" : - "must be sequence of length %d, not %d", - n, i); - return msgbuf; - } - - format = *p_format; - for (i = 0; i < n; i++) { - char *msg; - PyObject *item; - item = PySequence_GetItem(arg, i); - if (item == NULL) { - PyErr_Clear(); - levels[0] = i+1; - levels[1] = 0; - strncpy(msgbuf, "is not retrievable", bufsize); - return msgbuf; - } - msg = convertitem(item, &format, p_va, flags, levels+1, - msgbuf, bufsize, freelist); - /* PySequence_GetItem calls tp->sq_item, which INCREFs */ - Py_XDECREF(item); - if (msg != NULL) { - levels[0] = i+1; - return msg; - } - } - - *p_format = format; - return NULL; -} - - -/* Convert a single item. */ - -static char * -convertitem(PyObject *arg, const char **p_format, va_list *p_va, int flags, - int *levels, char *msgbuf, size_t bufsize, PyObject **freelist) -{ - char *msg; - const char *format = *p_format; - - if (*format == '(' /* ')' */) { - format++; - msg = converttuple(arg, &format, p_va, flags, levels, msgbuf, - bufsize, 0, freelist); - if (msg == NULL) - format++; - } - else { - msg = convertsimple(arg, &format, p_va, flags, - msgbuf, bufsize, freelist); - if (msg != NULL) - levels[0] = 0; - } - if (msg == NULL) - *p_format = format; - return msg; -} - - - -#define UNICODE_DEFAULT_ENCODING(arg) \ - _PyUnicode_AsDefaultEncodedString(arg, NULL) - -/* Format an error message generated by convertsimple(). */ - -static char * -converterr(const char *expected, PyObject *arg, char *msgbuf, size_t bufsize) -{ - assert(expected != NULL); - assert(arg != NULL); - PyOS_snprintf(msgbuf, bufsize, - "must be %.50s, not %.50s", expected, - arg == Py_None ? "None" : arg->ob_type->tp_name); - return msgbuf; -} - -#define CONV_UNICODE "(unicode conversion error)" - -/* explicitly check for float arguments when integers are expected. For now - * signal a warning. Returns true if an exception was raised. */ -static int -float_argument_warning(PyObject *arg) -{ - if (PyFloat_Check(arg) && - PyErr_Warn(PyExc_DeprecationWarning, - "integer argument expected, got float" )) - return 1; - else - return 0; -} - -/* explicitly check for float arguments when integers are expected. Raises - TypeError and returns true for float arguments. */ -static int -float_argument_error(PyObject *arg) -{ - if (PyFloat_Check(arg)) { - PyErr_SetString(PyExc_TypeError, - "integer argument expected, got float"); - return 1; - } - else - return 0; -} - -/* Convert a non-tuple argument. Return NULL if conversion went OK, - or a string with a message describing the failure. The message is - formatted as "must be , not ". - When failing, an exception may or may not have been raised. - Don't call if a tuple is expected. - - When you add new format codes, please don't forget poor skipitem() below. -*/ - -static char * -convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags, - char *msgbuf, size_t bufsize, PyObject **freelist) -{ - /* For # codes */ -#define FETCH_SIZE int *q=NULL;Py_ssize_t *q2=NULL;\ - if (flags & FLAG_SIZE_T) q2=va_arg(*p_va, Py_ssize_t*); \ - else q=va_arg(*p_va, int*); -#define STORE_SIZE(s) \ - if (flags & FLAG_SIZE_T) \ - *q2=s; \ - else { \ - if (INT_MAX < s) { \ - PyErr_SetString(PyExc_OverflowError, \ - "size does not fit in an int"); \ - return converterr("", arg, msgbuf, bufsize); \ - } \ - *q=s; \ - } -#define BUFFER_LEN ((flags & FLAG_SIZE_T) ? *q2:*q) - - const char *format = *p_format; - char c = *format++; -#ifdef Py_USING_UNICODE - PyObject *uarg; -#endif - - switch (c) { - - case 'b': { /* unsigned byte -- very short int */ - char *p = va_arg(*p_va, char *); - long ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else if (ival < 0) { - PyErr_SetString(PyExc_OverflowError, - "unsigned byte integer is less than minimum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else if (ival > UCHAR_MAX) { - PyErr_SetString(PyExc_OverflowError, - "unsigned byte integer is greater than maximum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else - *p = (unsigned char) ival; - break; - } - - case 'B': {/* byte sized bitfield - both signed and unsigned - values allowed */ - char *p = va_arg(*p_va, char *); - long ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsUnsignedLongMask(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else - *p = (unsigned char) ival; - break; - } - - case 'h': {/* signed short int */ - short *p = va_arg(*p_va, short *); - long ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else if (ival < SHRT_MIN) { - PyErr_SetString(PyExc_OverflowError, - "signed short integer is less than minimum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else if (ival > SHRT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "signed short integer is greater than maximum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else - *p = (short) ival; - break; - } - - case 'H': { /* short int sized bitfield, both signed and - unsigned allowed */ - unsigned short *p = va_arg(*p_va, unsigned short *); - long ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsUnsignedLongMask(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else - *p = (unsigned short) ival; - break; - } - - case 'i': {/* signed int */ - int *p = va_arg(*p_va, int *); - long ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else if (ival > INT_MAX) { - PyErr_SetString(PyExc_OverflowError, - "signed integer is greater than maximum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else if (ival < INT_MIN) { - PyErr_SetString(PyExc_OverflowError, - "signed integer is less than minimum"); - return converterr("integer", arg, msgbuf, bufsize); - } - else - *p = ival; - break; - } - - case 'I': { /* int sized bitfield, both signed and - unsigned allowed */ - unsigned int *p = va_arg(*p_va, unsigned int *); - unsigned int ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = (unsigned int)PyInt_AsUnsignedLongMask(arg); - if (ival == (unsigned int)-1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else - *p = ival; - break; - } - - case 'n': /* Py_ssize_t */ -#if SIZEOF_SIZE_T != SIZEOF_LONG - { - Py_ssize_t *p = va_arg(*p_va, Py_ssize_t *); - Py_ssize_t ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsSsize_t(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - *p = ival; - break; - } -#endif - /* Fall through from 'n' to 'l' if Py_ssize_t is int */ - case 'l': {/* long int */ - long *p = va_arg(*p_va, long *); - long ival; - if (float_argument_error(arg)) - return converterr("integer", arg, msgbuf, bufsize); - ival = PyInt_AsLong(arg); - if (ival == -1 && PyErr_Occurred()) - return converterr("integer", arg, msgbuf, bufsize); - else - *p = ival; - break; - } - - case 'k': { /* long sized bitfield */ - unsigned long *p = va_arg(*p_va, unsigned long *); - unsigned long ival; - if (PyInt_Check(arg)) - ival = PyInt_AsUnsignedLongMask(arg); - else if (PyLong_Check(arg)) - ival = PyLong_AsUnsignedLongMask(arg); - else - return converterr("integer", arg, msgbuf, bufsize); - *p = ival; - break; - } - -#ifdef HAVE_LONG_LONG - case 'L': {/* PY_LONG_LONG */ - PY_LONG_LONG *p = va_arg( *p_va, PY_LONG_LONG * ); - PY_LONG_LONG ival; - if (float_argument_warning(arg)) - return converterr("long", arg, msgbuf, bufsize); - ival = PyLong_AsLongLong(arg); - if (ival == (PY_LONG_LONG)-1 && PyErr_Occurred() ) { - return converterr("long", arg, msgbuf, bufsize); - } else { - *p = ival; - } - break; - } - - case 'K': { /* long long sized bitfield */ - unsigned PY_LONG_LONG *p = va_arg(*p_va, unsigned PY_LONG_LONG *); - unsigned PY_LONG_LONG ival; - if (PyInt_Check(arg)) - ival = PyInt_AsUnsignedLongMask(arg); - else if (PyLong_Check(arg)) - ival = PyLong_AsUnsignedLongLongMask(arg); - else - return converterr("integer", arg, msgbuf, bufsize); - *p = ival; - break; - } -#endif - - case 'f': {/* float */ - float *p = va_arg(*p_va, float *); - double dval = PyFloat_AsDouble(arg); - if (PyErr_Occurred()) - return converterr("float", arg, msgbuf, bufsize); - else - *p = (float) dval; - break; - } - - case 'd': {/* double */ - double *p = va_arg(*p_va, double *); - double dval = PyFloat_AsDouble(arg); - if (PyErr_Occurred()) - return converterr("float", arg, msgbuf, bufsize); - else - *p = dval; - break; - } - -#ifndef WITHOUT_COMPLEX - case 'D': {/* complex double */ - Py_complex *p = va_arg(*p_va, Py_complex *); - Py_complex cval; - cval = PyComplex_AsCComplex(arg); - if (PyErr_Occurred()) - return converterr("complex", arg, msgbuf, bufsize); - else - *p = cval; - break; - } -#endif /* WITHOUT_COMPLEX */ - - case 'c': {/* char */ - char *p = va_arg(*p_va, char *); - if (PyString_Check(arg) && PyString_Size(arg) == 1) - *p = PyString_AS_STRING(arg)[0]; - else - return converterr("char", arg, msgbuf, bufsize); - break; - } - - case 's': {/* string */ - if (*format == '*') { - Py_buffer *p = (Py_buffer *)va_arg(*p_va, Py_buffer *); - - if (PyString_Check(arg)) { - PyBuffer_FillInfo(p, arg, - PyString_AS_STRING(arg), PyString_GET_SIZE(arg), - 1, 0); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(arg)) { - uarg = UNICODE_DEFAULT_ENCODING(arg); - if (uarg == NULL) - return converterr(CONV_UNICODE, - arg, msgbuf, bufsize); - PyBuffer_FillInfo(p, arg, - PyString_AS_STRING(uarg), PyString_GET_SIZE(uarg), - 1, 0); - } -#endif - else { /* any buffer-like object */ - char *buf; - if (getbuffer(arg, p, &buf) < 0) - return converterr(buf, arg, msgbuf, bufsize); - } - if (addcleanup(p, freelist, cleanup_buffer)) { - return converterr( - "(cleanup problem)", - arg, msgbuf, bufsize); - } - format++; - } else if (*format == '#') { - void **p = (void **)va_arg(*p_va, char **); - FETCH_SIZE; - - if (PyString_Check(arg)) { - *p = PyString_AS_STRING(arg); - STORE_SIZE(PyString_GET_SIZE(arg)); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(arg)) { - uarg = UNICODE_DEFAULT_ENCODING(arg); - if (uarg == NULL) - return converterr(CONV_UNICODE, - arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - STORE_SIZE(PyString_GET_SIZE(uarg)); - } -#endif - else { /* any buffer-like object */ - char *buf; - Py_ssize_t count = convertbuffer(arg, p, &buf); - if (count < 0) - return converterr(buf, arg, msgbuf, bufsize); - STORE_SIZE(count); - } - format++; - } else { - char **p = va_arg(*p_va, char **); - - if (PyString_Check(arg)) - *p = PyString_AS_STRING(arg); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(arg)) { - uarg = UNICODE_DEFAULT_ENCODING(arg); - if (uarg == NULL) - return converterr(CONV_UNICODE, - arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - } -#endif - else - return converterr("string", arg, msgbuf, bufsize); - if ((Py_ssize_t)strlen(*p) != PyString_Size(arg)) - return converterr("string without null bytes", - arg, msgbuf, bufsize); - } - break; - } - - case 'z': {/* string, may be NULL (None) */ - if (*format == '*') { - Py_buffer *p = (Py_buffer *)va_arg(*p_va, Py_buffer *); - - if (arg == Py_None) - PyBuffer_FillInfo(p, NULL, NULL, 0, 1, 0); - else if (PyString_Check(arg)) { - PyBuffer_FillInfo(p, arg, - PyString_AS_STRING(arg), PyString_GET_SIZE(arg), - 1, 0); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(arg)) { - uarg = UNICODE_DEFAULT_ENCODING(arg); - if (uarg == NULL) - return converterr(CONV_UNICODE, - arg, msgbuf, bufsize); - PyBuffer_FillInfo(p, arg, - PyString_AS_STRING(uarg), PyString_GET_SIZE(uarg), - 1, 0); - } -#endif - else { /* any buffer-like object */ - char *buf; - if (getbuffer(arg, p, &buf) < 0) - return converterr(buf, arg, msgbuf, bufsize); - } - if (addcleanup(p, freelist, cleanup_buffer)) { - return converterr( - "(cleanup problem)", - arg, msgbuf, bufsize); - } - format++; - } else if (*format == '#') { /* any buffer-like object */ - void **p = (void **)va_arg(*p_va, char **); - FETCH_SIZE; - - if (arg == Py_None) { - *p = 0; - STORE_SIZE(0); - } - else if (PyString_Check(arg)) { - *p = PyString_AS_STRING(arg); - STORE_SIZE(PyString_GET_SIZE(arg)); - } -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(arg)) { - uarg = UNICODE_DEFAULT_ENCODING(arg); - if (uarg == NULL) - return converterr(CONV_UNICODE, - arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - STORE_SIZE(PyString_GET_SIZE(uarg)); - } -#endif - else { /* any buffer-like object */ - char *buf; - Py_ssize_t count = convertbuffer(arg, p, &buf); - if (count < 0) - return converterr(buf, arg, msgbuf, bufsize); - STORE_SIZE(count); - } - format++; - } else { - char **p = va_arg(*p_va, char **); - - if (arg == Py_None) - *p = 0; - else if (PyString_Check(arg)) - *p = PyString_AS_STRING(arg); -#ifdef Py_USING_UNICODE - else if (PyUnicode_Check(arg)) { - uarg = UNICODE_DEFAULT_ENCODING(arg); - if (uarg == NULL) - return converterr(CONV_UNICODE, - arg, msgbuf, bufsize); - *p = PyString_AS_STRING(uarg); - } -#endif - else - return converterr("string or None", - arg, msgbuf, bufsize); - if (*format == '#') { - FETCH_SIZE; - assert(0); /* XXX redundant with if-case */ - if (arg == Py_None) { - STORE_SIZE(0); - } else { - STORE_SIZE(PyString_Size(arg)); - } - format++; - } - else if (*p != NULL && - (Py_ssize_t)strlen(*p) != PyString_Size(arg)) - return converterr( - "string without null bytes or None", - arg, msgbuf, bufsize); - } - break; - } - - case 'e': {/* encoded string */ - char **buffer; - const char *encoding; - PyObject *s; - Py_ssize_t size; - int recode_strings; - - /* Get 'e' parameter: the encoding name */ - encoding = (const char *)va_arg(*p_va, const char *); -#ifdef Py_USING_UNICODE - if (encoding == NULL) - encoding = PyUnicode_GetDefaultEncoding(); -#endif - - /* Get output buffer parameter: - 's' (recode all objects via Unicode) or - 't' (only recode non-string objects) - */ - if (*format == 's') - recode_strings = 1; - else if (*format == 't') - recode_strings = 0; - else - return converterr( - "(unknown parser marker combination)", - arg, msgbuf, bufsize); - buffer = (char **)va_arg(*p_va, char **); - format++; - if (buffer == NULL) - return converterr("(buffer is NULL)", - arg, msgbuf, bufsize); - - /* Encode object */ - if (!recode_strings && PyString_Check(arg)) { - s = arg; - Py_INCREF(s); - } - else { -#ifdef Py_USING_UNICODE - PyObject *u; - - /* Convert object to Unicode */ - u = PyUnicode_FromObject(arg); - if (u == NULL) - return converterr( - "string or unicode or text buffer", - arg, msgbuf, bufsize); - - /* Encode object; use default error handling */ - s = PyUnicode_AsEncodedString(u, - encoding, - NULL); - Py_DECREF(u); - if (s == NULL) - return converterr("(encoding failed)", - arg, msgbuf, bufsize); - if (!PyString_Check(s)) { - Py_DECREF(s); - return converterr( - "(encoder failed to return a string)", - arg, msgbuf, bufsize); - } -#else - return converterr("string", arg, msgbuf, bufsize); -#endif - } - size = PyString_GET_SIZE(s); - - /* Write output; output is guaranteed to be 0-terminated */ - if (*format == '#') { - /* Using buffer length parameter '#': - - - if *buffer is NULL, a new buffer of the - needed size is allocated and the data - copied into it; *buffer is updated to point - to the new buffer; the caller is - responsible for PyMem_Free()ing it after - usage - - - if *buffer is not NULL, the data is - copied to *buffer; *buffer_len has to be - set to the size of the buffer on input; - buffer overflow is signalled with an error; - buffer has to provide enough room for the - encoded string plus the trailing 0-byte - - - in both cases, *buffer_len is updated to - the size of the buffer /excluding/ the - trailing 0-byte - - */ - FETCH_SIZE; - - format++; - if (q == NULL && q2 == NULL) { - Py_DECREF(s); - return converterr( - "(buffer_len is NULL)", - arg, msgbuf, bufsize); - } - if (*buffer == NULL) { - *buffer = PyMem_NEW(char, size + 1); - if (*buffer == NULL) { - Py_DECREF(s); - return converterr( - "(memory error)", - arg, msgbuf, bufsize); - } - if (addcleanup(*buffer, freelist, cleanup_ptr)) { - Py_DECREF(s); - return converterr( - "(cleanup problem)", - arg, msgbuf, bufsize); - } - } else { - if (size + 1 > BUFFER_LEN) { - Py_DECREF(s); - return converterr( - "(buffer overflow)", - arg, msgbuf, bufsize); - } - } - memcpy(*buffer, - PyString_AS_STRING(s), - size + 1); - STORE_SIZE(size); - } else { - /* Using a 0-terminated buffer: - - - the encoded string has to be 0-terminated - for this variant to work; if it is not, an - error raised - - - a new buffer of the needed size is - allocated and the data copied into it; - *buffer is updated to point to the new - buffer; the caller is responsible for - PyMem_Free()ing it after usage - - */ - if ((Py_ssize_t)strlen(PyString_AS_STRING(s)) - != size) { - Py_DECREF(s); - return converterr( - "encoded string without NULL bytes", - arg, msgbuf, bufsize); - } - *buffer = PyMem_NEW(char, size + 1); - if (*buffer == NULL) { - Py_DECREF(s); - return converterr("(memory error)", - arg, msgbuf, bufsize); - } - if (addcleanup(*buffer, freelist, cleanup_ptr)) { - Py_DECREF(s); - return converterr("(cleanup problem)", - arg, msgbuf, bufsize); - } - memcpy(*buffer, - PyString_AS_STRING(s), - size + 1); - } - Py_DECREF(s); - break; - } - -#ifdef Py_USING_UNICODE - case 'u': {/* raw unicode buffer (Py_UNICODE *) */ - if (*format == '#') { /* any buffer-like object */ - void **p = (void **)va_arg(*p_va, char **); - FETCH_SIZE; - if (PyUnicode_Check(arg)) { - *p = PyUnicode_AS_UNICODE(arg); - STORE_SIZE(PyUnicode_GET_SIZE(arg)); - } - else { - return converterr("cannot convert raw buffers", - arg, msgbuf, bufsize); - } - format++; - } else { - Py_UNICODE **p = va_arg(*p_va, Py_UNICODE **); - if (PyUnicode_Check(arg)) - *p = PyUnicode_AS_UNICODE(arg); - else - return converterr("unicode", arg, msgbuf, bufsize); - } - break; - } -#endif - - case 'S': { /* string object */ - PyObject **p = va_arg(*p_va, PyObject **); - if (PyString_Check(arg)) - *p = arg; - else - return converterr("string", arg, msgbuf, bufsize); - break; - } - -#ifdef Py_USING_UNICODE - case 'U': { /* Unicode object */ - PyObject **p = va_arg(*p_va, PyObject **); - if (PyUnicode_Check(arg)) - *p = arg; - else - return converterr("unicode", arg, msgbuf, bufsize); - break; - } -#endif - - case 'O': { /* object */ - PyTypeObject *type; - PyObject **p; - if (*format == '!') { - type = va_arg(*p_va, PyTypeObject*); - p = va_arg(*p_va, PyObject **); - format++; - if (PyType_IsSubtype(arg->ob_type, type)) - *p = arg; - else - return converterr(type->tp_name, arg, msgbuf, bufsize); - - } - else if (*format == '?') { - inquiry pred = va_arg(*p_va, inquiry); - p = va_arg(*p_va, PyObject **); - format++; - if ((*pred)(arg)) - *p = arg; - else - return converterr("(unspecified)", - arg, msgbuf, bufsize); - - } - else if (*format == '&') { - typedef int (*converter)(PyObject *, void *); - converter convert = va_arg(*p_va, converter); - void *addr = va_arg(*p_va, void *); - format++; - if (! (*convert)(arg, addr)) - return converterr("(unspecified)", - arg, msgbuf, bufsize); - } - else { - p = va_arg(*p_va, PyObject **); - *p = arg; - } - break; - } - - - case 'w': { /* memory buffer, read-write access */ - void **p = va_arg(*p_va, void **); - void *res; - PyBufferProcs *pb = arg->ob_type->tp_as_buffer; - Py_ssize_t count; - - if (pb && pb->bf_releasebuffer && *format != '*') - /* Buffer must be released, yet caller does not use - the Py_buffer protocol. */ - return converterr("pinned buffer", arg, msgbuf, bufsize); - - if (pb && pb->bf_getbuffer && *format == '*') { - /* Caller is interested in Py_buffer, and the object - supports it directly. */ - format++; - if (pb->bf_getbuffer(arg, (Py_buffer*)p, PyBUF_WRITABLE) < 0) { - PyErr_Clear(); - return converterr("read-write buffer", arg, msgbuf, bufsize); - } - if (addcleanup(p, freelist, cleanup_buffer)) { - return converterr( - "(cleanup problem)", - arg, msgbuf, bufsize); - } - if (!PyBuffer_IsContiguous((Py_buffer*)p, 'C')) - return converterr("contiguous buffer", arg, msgbuf, bufsize); - break; - } - - if (pb == NULL || - pb->bf_getwritebuffer == NULL || - pb->bf_getsegcount == NULL) - return converterr("read-write buffer", arg, msgbuf, bufsize); - if ((*pb->bf_getsegcount)(arg, NULL) != 1) - return converterr("single-segment read-write buffer", - arg, msgbuf, bufsize); - if ((count = pb->bf_getwritebuffer(arg, 0, &res)) < 0) - return converterr("(unspecified)", arg, msgbuf, bufsize); - if (*format == '*') { - PyBuffer_FillInfo((Py_buffer*)p, arg, res, count, 1, 0); - format++; - } - else { - *p = res; - if (*format == '#') { - FETCH_SIZE; - STORE_SIZE(count); - format++; - } - } - break; - } - - case 't': { /* 8-bit character buffer, read-only access */ - char **p = va_arg(*p_va, char **); - PyBufferProcs *pb = arg->ob_type->tp_as_buffer; - Py_ssize_t count; - - if (*format++ != '#') - return converterr( - "invalid use of 't' format character", - arg, msgbuf, bufsize); - if (!PyType_HasFeature(arg->ob_type, - Py_TPFLAGS_HAVE_GETCHARBUFFER) || - pb == NULL || pb->bf_getcharbuffer == NULL || - pb->bf_getsegcount == NULL) - return converterr( - "string or read-only character buffer", - arg, msgbuf, bufsize); - - if (pb->bf_getsegcount(arg, NULL) != 1) - return converterr( - "string or single-segment read-only buffer", - arg, msgbuf, bufsize); - - if (pb->bf_releasebuffer) - return converterr( - "string or pinned buffer", - arg, msgbuf, bufsize); - - count = pb->bf_getcharbuffer(arg, 0, p); - if (count < 0) - return converterr("(unspecified)", arg, msgbuf, bufsize); - { - FETCH_SIZE; - STORE_SIZE(count); - } - break; - } - - default: - return converterr("impossible", arg, msgbuf, bufsize); - - } - - *p_format = format; - return NULL; -} - -static Py_ssize_t -convertbuffer(PyObject *arg, void **p, char **errmsg) -{ - PyBufferProcs *pb = arg->ob_type->tp_as_buffer; - Py_ssize_t count; - if (pb == NULL || - pb->bf_getreadbuffer == NULL || - pb->bf_getsegcount == NULL || - pb->bf_releasebuffer != NULL) { - *errmsg = "string or read-only buffer"; - return -1; - } - if ((*pb->bf_getsegcount)(arg, NULL) != 1) { - *errmsg = "string or single-segment read-only buffer"; - return -1; - } - if ((count = (*pb->bf_getreadbuffer)(arg, 0, p)) < 0) { - *errmsg = "(unspecified)"; - } - return count; -} - -static int -getbuffer(PyObject *arg, Py_buffer *view, char **errmsg) -{ - void *buf; - Py_ssize_t count; - PyBufferProcs *pb = arg->ob_type->tp_as_buffer; - if (pb == NULL) { - *errmsg = "string or buffer"; - return -1; - } - if (pb->bf_getbuffer) { - if (pb->bf_getbuffer(arg, view, 0) < 0) { - *errmsg = "convertible to a buffer"; - return -1; - } - if (!PyBuffer_IsContiguous(view, 'C')) { - *errmsg = "contiguous buffer"; - return -1; - } - return 0; - } - - count = convertbuffer(arg, &buf, errmsg); - if (count < 0) { - *errmsg = "convertible to a buffer"; - return count; - } - PyBuffer_FillInfo(view, arg, buf, count, 1, 0); - return 0; -} - -/* Support for keyword arguments donated by - Geoff Philbrick */ - -/* Return false (0) for error, else true. */ -int -PyArg_ParseTupleAndKeywords(PyObject *args, - PyObject *keywords, - const char *format, - char **kwlist, ...) -{ - int retval; - va_list va; - - if ((args == NULL || !PyTuple_Check(args)) || - (keywords != NULL && !PyDict_Check(keywords)) || - format == NULL || - kwlist == NULL) - { - PyErr_BadInternalCall(); - return 0; - } - - va_start(va, kwlist); - retval = vgetargskeywords(args, keywords, format, kwlist, &va, 0); - va_end(va); - return retval; -} - -int -_PyArg_ParseTupleAndKeywords_SizeT(PyObject *args, - PyObject *keywords, - const char *format, - char **kwlist, ...) -{ - int retval; - va_list va; - - if ((args == NULL || !PyTuple_Check(args)) || - (keywords != NULL && !PyDict_Check(keywords)) || - format == NULL || - kwlist == NULL) - { - PyErr_BadInternalCall(); - return 0; - } - - va_start(va, kwlist); - retval = vgetargskeywords(args, keywords, format, - kwlist, &va, FLAG_SIZE_T); - va_end(va); - return retval; -} - - -int -PyArg_VaParseTupleAndKeywords(PyObject *args, - PyObject *keywords, - const char *format, - char **kwlist, va_list va) -{ - int retval; - va_list lva; - - if ((args == NULL || !PyTuple_Check(args)) || - (keywords != NULL && !PyDict_Check(keywords)) || - format == NULL || - kwlist == NULL) - { - PyErr_BadInternalCall(); - return 0; - } - -#ifdef VA_LIST_IS_ARRAY - memcpy(lva, va, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(lva, va); -#else - lva = va; -#endif -#endif - - retval = vgetargskeywords(args, keywords, format, kwlist, &lva, 0); - return retval; -} - -int -_PyArg_VaParseTupleAndKeywords_SizeT(PyObject *args, - PyObject *keywords, - const char *format, - char **kwlist, va_list va) -{ - int retval; - va_list lva; - - if ((args == NULL || !PyTuple_Check(args)) || - (keywords != NULL && !PyDict_Check(keywords)) || - format == NULL || - kwlist == NULL) - { - PyErr_BadInternalCall(); - return 0; - } - -#ifdef VA_LIST_IS_ARRAY - memcpy(lva, va, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(lva, va); -#else - lva = va; -#endif -#endif - - retval = vgetargskeywords(args, keywords, format, - kwlist, &lva, FLAG_SIZE_T); - return retval; -} - -#define IS_END_OF_FORMAT(c) (c == '\0' || c == ';' || c == ':') - -static int -vgetargskeywords(PyObject *args, PyObject *keywords, const char *format, - char **kwlist, va_list *p_va, int flags) -{ - char msgbuf[512]; - int levels[32]; - const char *fname, *msg, *custom_msg, *keyword; - int min = INT_MAX; - int i, len, nargs, nkeywords; - PyObject *freelist = NULL, *current_arg; - - assert(args != NULL && PyTuple_Check(args)); - assert(keywords == NULL || PyDict_Check(keywords)); - assert(format != NULL); - assert(kwlist != NULL); - assert(p_va != NULL); - - /* grab the function name or custom error msg first (mutually exclusive) */ - fname = strchr(format, ':'); - if (fname) { - fname++; - custom_msg = NULL; - } - else { - custom_msg = strchr(format,';'); - if (custom_msg) - custom_msg++; - } - - /* scan kwlist and get greatest possible nbr of args */ - for (len=0; kwlist[len]; len++) - continue; - - nargs = PyTuple_GET_SIZE(args); - nkeywords = (keywords == NULL) ? 0 : PyDict_Size(keywords); - if (nargs + nkeywords > len) { - PyErr_Format(PyExc_TypeError, "%s%s takes at most %d " - "argument%s (%d given)", - (fname == NULL) ? "function" : fname, - (fname == NULL) ? "" : "()", - len, - (len == 1) ? "" : "s", - nargs + nkeywords); - return 0; - } - - /* convert tuple args and keyword args in same loop, using kwlist to drive process */ - for (i = 0; i < len; i++) { - keyword = kwlist[i]; - if (*format == '|') { - min = i; - format++; - } - if (IS_END_OF_FORMAT(*format)) { - PyErr_Format(PyExc_RuntimeError, - "More keyword list entries (%d) than " - "format specifiers (%d)", len, i); - return cleanreturn(0, freelist); - } - current_arg = NULL; - if (nkeywords) { - current_arg = PyDict_GetItemString(keywords, keyword); - } - if (current_arg) { - --nkeywords; - if (i < nargs) { - /* arg present in tuple and in dict */ - PyErr_Format(PyExc_TypeError, - "Argument given by name ('%s') " - "and position (%d)", - keyword, i+1); - return cleanreturn(0, freelist); - } - } - else if (nkeywords && PyErr_Occurred()) - return cleanreturn(0, freelist); - else if (i < nargs) - current_arg = PyTuple_GET_ITEM(args, i); - - if (current_arg) { - msg = convertitem(current_arg, &format, p_va, flags, - levels, msgbuf, sizeof(msgbuf), &freelist); - if (msg) { - seterror(i+1, msg, levels, fname, custom_msg); - return cleanreturn(0, freelist); - } - continue; - } - - if (i < min) { - PyErr_Format(PyExc_TypeError, "Required argument " - "'%s' (pos %d) not found", - keyword, i+1); - return cleanreturn(0, freelist); - } - /* current code reports success when all required args - * fulfilled and no keyword args left, with no further - * validation. XXX Maybe skip this in debug build ? - */ - if (!nkeywords) - return cleanreturn(1, freelist); - - /* We are into optional args, skip thru to any remaining - * keyword args */ - msg = skipitem(&format, p_va, flags); - if (msg) { - PyErr_Format(PyExc_RuntimeError, "%s: '%s'", msg, - format); - return cleanreturn(0, freelist); - } - } - - if (!IS_END_OF_FORMAT(*format) && *format != '|') { - PyErr_Format(PyExc_RuntimeError, - "more argument specifiers than keyword list entries " - "(remaining format:'%s')", format); - return cleanreturn(0, freelist); - } - - /* make sure there are no extraneous keyword arguments */ - if (nkeywords > 0) { - PyObject *key, *value; - Py_ssize_t pos = 0; - while (PyDict_Next(keywords, &pos, &key, &value)) { - int match = 0; - char *ks; - if (!PyString_Check(key)) { - PyErr_SetString(PyExc_TypeError, - "keywords must be strings"); - return cleanreturn(0, freelist); - } - ks = PyString_AsString(key); - for (i = 0; i < len; i++) { - if (!strcmp(ks, kwlist[i])) { - match = 1; - break; - } - } - if (!match) { - PyErr_Format(PyExc_TypeError, - "'%s' is an invalid keyword " - "argument for this function", - ks); - return cleanreturn(0, freelist); - } - } - } - - return cleanreturn(1, freelist); -} - - -static char * -skipitem(const char **p_format, va_list *p_va, int flags) -{ - const char *format = *p_format; - char c = *format++; - - switch (c) { - - /* simple codes - * The individual types (second arg of va_arg) are irrelevant */ - - case 'b': /* byte -- very short int */ - case 'B': /* byte as bitfield */ - case 'h': /* short int */ - case 'H': /* short int as bitfield */ - case 'i': /* int */ - case 'I': /* int sized bitfield */ - case 'l': /* long int */ - case 'k': /* long int sized bitfield */ -#ifdef HAVE_LONG_LONG - case 'L': /* PY_LONG_LONG */ - case 'K': /* PY_LONG_LONG sized bitfield */ -#endif - case 'f': /* float */ - case 'd': /* double */ -#ifndef WITHOUT_COMPLEX - case 'D': /* complex double */ -#endif - case 'c': /* char */ - { - (void) va_arg(*p_va, void *); - break; - } - - case 'n': /* Py_ssize_t */ - { - (void) va_arg(*p_va, Py_ssize_t *); - break; - } - - /* string codes */ - - case 'e': /* string with encoding */ - { - (void) va_arg(*p_va, const char *); - if (!(*format == 's' || *format == 't')) - /* after 'e', only 's' and 't' is allowed */ - goto err; - format++; - /* explicit fallthrough to string cases */ - } - - case 's': /* string */ - case 'z': /* string or None */ -#ifdef Py_USING_UNICODE - case 'u': /* unicode string */ -#endif - case 't': /* buffer, read-only */ - case 'w': /* buffer, read-write */ - { - (void) va_arg(*p_va, char **); - if (*format == '#') { - if (flags & FLAG_SIZE_T) - (void) va_arg(*p_va, Py_ssize_t *); - else - (void) va_arg(*p_va, int *); - format++; - } else if ((c == 's' || c == 'z') && *format == '*') { - format++; - } - break; - } - - /* object codes */ - - case 'S': /* string object */ -#ifdef Py_USING_UNICODE - case 'U': /* unicode string object */ -#endif - { - (void) va_arg(*p_va, PyObject **); - break; - } - - case 'O': /* object */ - { - if (*format == '!') { - format++; - (void) va_arg(*p_va, PyTypeObject*); - (void) va_arg(*p_va, PyObject **); - } - else if (*format == '&') { - typedef int (*converter)(PyObject *, void *); - (void) va_arg(*p_va, converter); - (void) va_arg(*p_va, void *); - format++; - } - else { - (void) va_arg(*p_va, PyObject **); - } - break; - } - - case '(': /* bypass tuple, not handled at all previously */ - { - char *msg; - for (;;) { - if (*format==')') - break; - if (IS_END_OF_FORMAT(*format)) - return "Unmatched left paren in format " - "string"; - msg = skipitem(&format, p_va, flags); - if (msg) - return msg; - } - format++; - break; - } - - case ')': - return "Unmatched right paren in format string"; - - default: -err: - return "impossible"; - - } - - *p_format = format; - return NULL; -} - - -int -PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...) -{ - Py_ssize_t i, l; - PyObject **o; - va_list vargs; - -#ifdef HAVE_STDARG_PROTOTYPES - va_start(vargs, max); -#else - va_start(vargs); -#endif - - assert(min >= 0); - assert(min <= max); - if (!PyTuple_Check(args)) { - va_end(vargs); - PyErr_SetString(PyExc_SystemError, - "PyArg_UnpackTuple() argument list is not a tuple"); - return 0; - } - l = PyTuple_GET_SIZE(args); - if (l < min) { - if (name != NULL) - PyErr_Format( - PyExc_TypeError, - "%s expected %s%zd arguments, got %zd", - name, (min == max ? "" : "at least "), min, l); - else - PyErr_Format( - PyExc_TypeError, - "unpacked tuple should have %s%zd elements," - " but has %zd", - (min == max ? "" : "at least "), min, l); - va_end(vargs); - return 0; - } - if (l > max) { - if (name != NULL) - PyErr_Format( - PyExc_TypeError, - "%s expected %s%zd arguments, got %zd", - name, (min == max ? "" : "at most "), max, l); - else - PyErr_Format( - PyExc_TypeError, - "unpacked tuple should have %s%zd elements," - " but has %zd", - (min == max ? "" : "at most "), max, l); - va_end(vargs); - return 0; - } - for (i = 0; i < l; i++) { - o = va_arg(vargs, PyObject **); - *o = PyTuple_GET_ITEM(args, i); - } - va_end(vargs); - return 1; -} - - -/* For type constructors that don't take keyword args - * - * Sets a TypeError and returns 0 if the kwds dict is - * not empty, returns 1 otherwise - */ -int -_PyArg_NoKeywords(const char *funcname, PyObject *kw) -{ - if (kw == NULL) - return 1; - if (!PyDict_CheckExact(kw)) { - PyErr_BadInternalCall(); - return 0; - } - if (PyDict_Size(kw) == 0) - return 1; - - PyErr_Format(PyExc_TypeError, "%s does not take keyword arguments", - funcname); - return 0; -} -#ifdef __cplusplus -}; -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/getcompiler.c b/AppPkg/Applications/Python/Python-2.7.10/Python/getcompiler.c deleted file mode 100644 index 33a7639..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/getcompiler.c +++ /dev/null @@ -1,28 +0,0 @@ - -/* Return the compiler identification, if possible. */ - -#include "Python.h" - -#ifndef COMPILER - -#ifdef __GNUC__ -#define COMPILER "\n[GCC " __VERSION__ "]" -#endif - -#endif /* !COMPILER */ - -#ifndef COMPILER - -#ifdef __cplusplus -#define COMPILER "[C++]" -#else -#define COMPILER "[C]" -#endif - -#endif /* !COMPILER */ - -const char * -Py_GetCompiler(void) -{ - return COMPILER; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/getopt.c b/AppPkg/Applications/Python/Python-2.7.10/Python/getopt.c deleted file mode 100644 index af6f5dc..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/getopt.c +++ /dev/null @@ -1,136 +0,0 @@ -/*---------------------------------------------------------------------------* - * - * - * C++ Library - * - * Copyright 1992-1994, David Gottner - * - * All Rights Reserved - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose and without fee is hereby granted, - * provided that the above copyright notice, this permission notice and - * the following disclaimer notice appear unmodified in all copies. - * - * I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL I - * BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY - * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER - * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * Nevertheless, I would like to know about bugs in this library or - * suggestions for improvment. Send bug reports and feedback to - * davegottner@delphi.com. - *---------------------------------------------------------------------------*/ - -/* Modified to support --help and --version, as well as /? on Windows - * by Georg Brandl. */ - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -int _PyOS_opterr = 1; /* generate error messages */ -int _PyOS_optind = 1; /* index into argv array */ -char *_PyOS_optarg = NULL; /* optional argument */ -static char *opt_ptr = ""; - -void _PyOS_ResetGetOpt(void) -{ - _PyOS_opterr = 1; - _PyOS_optind = 1; - _PyOS_optarg = NULL; - opt_ptr = ""; -} - -int _PyOS_GetOpt(int argc, char **argv, char *optstring) -{ - char *ptr; - int option; - - if (*opt_ptr == '\0') { - - if (_PyOS_optind >= argc) - return -1; -#ifdef MS_WINDOWS - else if (strcmp(argv[_PyOS_optind], "/?") == 0) { - ++_PyOS_optind; - return 'h'; - } -#endif - - else if (argv[_PyOS_optind][0] != '-' || - argv[_PyOS_optind][1] == '\0' /* lone dash */ ) - return -1; - - else if (strcmp(argv[_PyOS_optind], "--") == 0) { - ++_PyOS_optind; - return -1; - } - - else if (strcmp(argv[_PyOS_optind], "--help") == 0) { - ++_PyOS_optind; - return 'h'; - } - - else if (strcmp(argv[_PyOS_optind], "--version") == 0) { - ++_PyOS_optind; - return 'V'; - } - - - opt_ptr = &argv[_PyOS_optind++][1]; - } - - if ((option = *opt_ptr++) == '\0') - return -1; - - if (option == 'J') { - if (_PyOS_opterr) - fprintf(stderr, "-J is reserved for Jython\n"); - return '_'; - } - - if (option == 'X') { - if (_PyOS_opterr) - fprintf(stderr, - "-X is reserved for implementation-specific arguments\n"); - return '_'; - } - - if ((ptr = strchr(optstring, option)) == NULL) { - if (_PyOS_opterr) - fprintf(stderr, "Unknown option: -%c\n", option); - - return '_'; - } - - if (*(ptr + 1) == ':') { - if (*opt_ptr != '\0') { - _PyOS_optarg = opt_ptr; - opt_ptr = ""; - } - - else { - if (_PyOS_optind >= argc) { - if (_PyOS_opterr) - fprintf(stderr, - "Argument expected for the -%c option\n", option); - return '_'; - } - - _PyOS_optarg = argv[_PyOS_optind++]; - } - } - - return option; -} - -#ifdef __cplusplus -} -#endif - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/getplatform.c b/AppPkg/Applications/Python/Python-2.7.10/Python/getplatform.c deleted file mode 100644 index ce79ffe..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/getplatform.c +++ /dev/null @@ -1,12 +0,0 @@ - -#include "Python.h" - -#ifndef PLATFORM -#define PLATFORM "unknown" -#endif - -const char * -Py_GetPlatform(void) -{ - return PLATFORM; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/getversion.c b/AppPkg/Applications/Python/Python-2.7.10/Python/getversion.c deleted file mode 100644 index 7c75348..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/getversion.c +++ /dev/null @@ -1,15 +0,0 @@ - -/* Return the full version string. */ - -#include "Python.h" - -#include "patchlevel.h" - -const char * -Py_GetVersion(void) -{ - static char version[250]; - PyOS_snprintf(version, sizeof(version), "%.80s (%.80s) %.80s", - PY_VERSION, Py_GetBuildInfo(), Py_GetCompiler()); - return version; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/graminit.c b/AppPkg/Applications/Python/Python-2.7.10/Python/graminit.c deleted file mode 100644 index db2e9a7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/graminit.c +++ /dev/null @@ -1,2177 +0,0 @@ -/* Generated by Parser/pgen */ - -#include "pgenheaders.h" -#include "grammar.h" -PyAPI_DATA(grammar) _PyParser_Grammar; -static arc arcs_0_0[3] = { - {2, 1}, - {3, 1}, - {4, 2}, -}; -static arc arcs_0_1[1] = { - {0, 1}, -}; -static arc arcs_0_2[1] = { - {2, 1}, -}; -static state states_0[3] = { - {3, arcs_0_0}, - {1, arcs_0_1}, - {1, arcs_0_2}, -}; -static arc arcs_1_0[3] = { - {2, 0}, - {6, 0}, - {7, 1}, -}; -static arc arcs_1_1[1] = { - {0, 1}, -}; -static state states_1[2] = { - {3, arcs_1_0}, - {1, arcs_1_1}, -}; -static arc arcs_2_0[1] = { - {9, 1}, -}; -static arc arcs_2_1[2] = { - {2, 1}, - {7, 2}, -}; -static arc arcs_2_2[1] = { - {0, 2}, -}; -static state states_2[3] = { - {1, arcs_2_0}, - {2, arcs_2_1}, - {1, arcs_2_2}, -}; -static arc arcs_3_0[1] = { - {11, 1}, -}; -static arc arcs_3_1[1] = { - {12, 2}, -}; -static arc arcs_3_2[2] = { - {13, 3}, - {2, 4}, -}; -static arc arcs_3_3[2] = { - {14, 5}, - {15, 6}, -}; -static arc arcs_3_4[1] = { - {0, 4}, -}; -static arc arcs_3_5[1] = { - {15, 6}, -}; -static arc arcs_3_6[1] = { - {2, 4}, -}; -static state states_3[7] = { - {1, arcs_3_0}, - {1, arcs_3_1}, - {2, arcs_3_2}, - {2, arcs_3_3}, - {1, arcs_3_4}, - {1, arcs_3_5}, - {1, arcs_3_6}, -}; -static arc arcs_4_0[1] = { - {10, 1}, -}; -static arc arcs_4_1[2] = { - {10, 1}, - {0, 1}, -}; -static state states_4[2] = { - {1, arcs_4_0}, - {2, arcs_4_1}, -}; -static arc arcs_5_0[1] = { - {16, 1}, -}; -static arc arcs_5_1[2] = { - {18, 2}, - {19, 2}, -}; -static arc arcs_5_2[1] = { - {0, 2}, -}; -static state states_5[3] = { - {1, arcs_5_0}, - {2, arcs_5_1}, - {1, arcs_5_2}, -}; -static arc arcs_6_0[1] = { - {20, 1}, -}; -static arc arcs_6_1[1] = { - {21, 2}, -}; -static arc arcs_6_2[1] = { - {22, 3}, -}; -static arc arcs_6_3[1] = { - {23, 4}, -}; -static arc arcs_6_4[1] = { - {24, 5}, -}; -static arc arcs_6_5[1] = { - {0, 5}, -}; -static state states_6[6] = { - {1, arcs_6_0}, - {1, arcs_6_1}, - {1, arcs_6_2}, - {1, arcs_6_3}, - {1, arcs_6_4}, - {1, arcs_6_5}, -}; -static arc arcs_7_0[1] = { - {13, 1}, -}; -static arc arcs_7_1[2] = { - {25, 2}, - {15, 3}, -}; -static arc arcs_7_2[1] = { - {15, 3}, -}; -static arc arcs_7_3[1] = { - {0, 3}, -}; -static state states_7[4] = { - {1, arcs_7_0}, - {2, arcs_7_1}, - {1, arcs_7_2}, - {1, arcs_7_3}, -}; -static arc arcs_8_0[3] = { - {26, 1}, - {30, 2}, - {31, 3}, -}; -static arc arcs_8_1[3] = { - {27, 4}, - {29, 5}, - {0, 1}, -}; -static arc arcs_8_2[1] = { - {21, 6}, -}; -static arc arcs_8_3[1] = { - {21, 7}, -}; -static arc arcs_8_4[1] = { - {28, 8}, -}; -static arc arcs_8_5[4] = { - {26, 1}, - {30, 2}, - {31, 3}, - {0, 5}, -}; -static arc arcs_8_6[2] = { - {29, 9}, - {0, 6}, -}; -static arc arcs_8_7[1] = { - {0, 7}, -}; -static arc arcs_8_8[2] = { - {29, 5}, - {0, 8}, -}; -static arc arcs_8_9[1] = { - {31, 3}, -}; -static state states_8[10] = { - {3, arcs_8_0}, - {3, arcs_8_1}, - {1, arcs_8_2}, - {1, arcs_8_3}, - {1, arcs_8_4}, - {4, arcs_8_5}, - {2, arcs_8_6}, - {1, arcs_8_7}, - {2, arcs_8_8}, - {1, arcs_8_9}, -}; -static arc arcs_9_0[2] = { - {21, 1}, - {13, 2}, -}; -static arc arcs_9_1[1] = { - {0, 1}, -}; -static arc arcs_9_2[1] = { - {32, 3}, -}; -static arc arcs_9_3[1] = { - {15, 1}, -}; -static state states_9[4] = { - {2, arcs_9_0}, - {1, arcs_9_1}, - {1, arcs_9_2}, - {1, arcs_9_3}, -}; -static arc arcs_10_0[1] = { - {26, 1}, -}; -static arc arcs_10_1[2] = { - {29, 2}, - {0, 1}, -}; -static arc arcs_10_2[2] = { - {26, 1}, - {0, 2}, -}; -static state states_10[3] = { - {1, arcs_10_0}, - {2, arcs_10_1}, - {2, arcs_10_2}, -}; -static arc arcs_11_0[2] = { - {3, 1}, - {4, 1}, -}; -static arc arcs_11_1[1] = { - {0, 1}, -}; -static state states_11[2] = { - {2, arcs_11_0}, - {1, arcs_11_1}, -}; -static arc arcs_12_0[1] = { - {33, 1}, -}; -static arc arcs_12_1[2] = { - {34, 2}, - {2, 3}, -}; -static arc arcs_12_2[2] = { - {33, 1}, - {2, 3}, -}; -static arc arcs_12_3[1] = { - {0, 3}, -}; -static state states_12[4] = { - {1, arcs_12_0}, - {2, arcs_12_1}, - {2, arcs_12_2}, - {1, arcs_12_3}, -}; -static arc arcs_13_0[9] = { - {35, 1}, - {36, 1}, - {37, 1}, - {38, 1}, - {39, 1}, - {40, 1}, - {41, 1}, - {42, 1}, - {43, 1}, -}; -static arc arcs_13_1[1] = { - {0, 1}, -}; -static state states_13[2] = { - {9, arcs_13_0}, - {1, arcs_13_1}, -}; -static arc arcs_14_0[1] = { - {9, 1}, -}; -static arc arcs_14_1[3] = { - {44, 2}, - {27, 3}, - {0, 1}, -}; -static arc arcs_14_2[2] = { - {45, 4}, - {9, 4}, -}; -static arc arcs_14_3[2] = { - {45, 5}, - {9, 5}, -}; -static arc arcs_14_4[1] = { - {0, 4}, -}; -static arc arcs_14_5[2] = { - {27, 3}, - {0, 5}, -}; -static state states_14[6] = { - {1, arcs_14_0}, - {3, arcs_14_1}, - {2, arcs_14_2}, - {2, arcs_14_3}, - {1, arcs_14_4}, - {2, arcs_14_5}, -}; -static arc arcs_15_0[12] = { - {46, 1}, - {47, 1}, - {48, 1}, - {49, 1}, - {50, 1}, - {51, 1}, - {52, 1}, - {53, 1}, - {54, 1}, - {55, 1}, - {56, 1}, - {57, 1}, -}; -static arc arcs_15_1[1] = { - {0, 1}, -}; -static state states_15[2] = { - {12, arcs_15_0}, - {1, arcs_15_1}, -}; -static arc arcs_16_0[1] = { - {58, 1}, -}; -static arc arcs_16_1[3] = { - {28, 2}, - {59, 3}, - {0, 1}, -}; -static arc arcs_16_2[2] = { - {29, 4}, - {0, 2}, -}; -static arc arcs_16_3[1] = { - {28, 5}, -}; -static arc arcs_16_4[2] = { - {28, 2}, - {0, 4}, -}; -static arc arcs_16_5[2] = { - {29, 6}, - {0, 5}, -}; -static arc arcs_16_6[1] = { - {28, 7}, -}; -static arc arcs_16_7[2] = { - {29, 8}, - {0, 7}, -}; -static arc arcs_16_8[2] = { - {28, 7}, - {0, 8}, -}; -static state states_16[9] = { - {1, arcs_16_0}, - {3, arcs_16_1}, - {2, arcs_16_2}, - {1, arcs_16_3}, - {2, arcs_16_4}, - {2, arcs_16_5}, - {1, arcs_16_6}, - {2, arcs_16_7}, - {2, arcs_16_8}, -}; -static arc arcs_17_0[1] = { - {60, 1}, -}; -static arc arcs_17_1[1] = { - {61, 2}, -}; -static arc arcs_17_2[1] = { - {0, 2}, -}; -static state states_17[3] = { - {1, arcs_17_0}, - {1, arcs_17_1}, - {1, arcs_17_2}, -}; -static arc arcs_18_0[1] = { - {62, 1}, -}; -static arc arcs_18_1[1] = { - {0, 1}, -}; -static state states_18[2] = { - {1, arcs_18_0}, - {1, arcs_18_1}, -}; -static arc arcs_19_0[5] = { - {63, 1}, - {64, 1}, - {65, 1}, - {66, 1}, - {67, 1}, -}; -static arc arcs_19_1[1] = { - {0, 1}, -}; -static state states_19[2] = { - {5, arcs_19_0}, - {1, arcs_19_1}, -}; -static arc arcs_20_0[1] = { - {68, 1}, -}; -static arc arcs_20_1[1] = { - {0, 1}, -}; -static state states_20[2] = { - {1, arcs_20_0}, - {1, arcs_20_1}, -}; -static arc arcs_21_0[1] = { - {69, 1}, -}; -static arc arcs_21_1[1] = { - {0, 1}, -}; -static state states_21[2] = { - {1, arcs_21_0}, - {1, arcs_21_1}, -}; -static arc arcs_22_0[1] = { - {70, 1}, -}; -static arc arcs_22_1[2] = { - {9, 2}, - {0, 1}, -}; -static arc arcs_22_2[1] = { - {0, 2}, -}; -static state states_22[3] = { - {1, arcs_22_0}, - {2, arcs_22_1}, - {1, arcs_22_2}, -}; -static arc arcs_23_0[1] = { - {45, 1}, -}; -static arc arcs_23_1[1] = { - {0, 1}, -}; -static state states_23[2] = { - {1, arcs_23_0}, - {1, arcs_23_1}, -}; -static arc arcs_24_0[1] = { - {71, 1}, -}; -static arc arcs_24_1[2] = { - {28, 2}, - {0, 1}, -}; -static arc arcs_24_2[2] = { - {29, 3}, - {0, 2}, -}; -static arc arcs_24_3[1] = { - {28, 4}, -}; -static arc arcs_24_4[2] = { - {29, 5}, - {0, 4}, -}; -static arc arcs_24_5[1] = { - {28, 6}, -}; -static arc arcs_24_6[1] = { - {0, 6}, -}; -static state states_24[7] = { - {1, arcs_24_0}, - {2, arcs_24_1}, - {2, arcs_24_2}, - {1, arcs_24_3}, - {2, arcs_24_4}, - {1, arcs_24_5}, - {1, arcs_24_6}, -}; -static arc arcs_25_0[2] = { - {72, 1}, - {73, 1}, -}; -static arc arcs_25_1[1] = { - {0, 1}, -}; -static state states_25[2] = { - {2, arcs_25_0}, - {1, arcs_25_1}, -}; -static arc arcs_26_0[1] = { - {74, 1}, -}; -static arc arcs_26_1[1] = { - {75, 2}, -}; -static arc arcs_26_2[1] = { - {0, 2}, -}; -static state states_26[3] = { - {1, arcs_26_0}, - {1, arcs_26_1}, - {1, arcs_26_2}, -}; -static arc arcs_27_0[1] = { - {76, 1}, -}; -static arc arcs_27_1[2] = { - {77, 2}, - {12, 3}, -}; -static arc arcs_27_2[3] = { - {77, 2}, - {12, 3}, - {74, 4}, -}; -static arc arcs_27_3[1] = { - {74, 4}, -}; -static arc arcs_27_4[3] = { - {30, 5}, - {13, 6}, - {78, 5}, -}; -static arc arcs_27_5[1] = { - {0, 5}, -}; -static arc arcs_27_6[1] = { - {78, 7}, -}; -static arc arcs_27_7[1] = { - {15, 5}, -}; -static state states_27[8] = { - {1, arcs_27_0}, - {2, arcs_27_1}, - {3, arcs_27_2}, - {1, arcs_27_3}, - {3, arcs_27_4}, - {1, arcs_27_5}, - {1, arcs_27_6}, - {1, arcs_27_7}, -}; -static arc arcs_28_0[1] = { - {21, 1}, -}; -static arc arcs_28_1[2] = { - {80, 2}, - {0, 1}, -}; -static arc arcs_28_2[1] = { - {21, 3}, -}; -static arc arcs_28_3[1] = { - {0, 3}, -}; -static state states_28[4] = { - {1, arcs_28_0}, - {2, arcs_28_1}, - {1, arcs_28_2}, - {1, arcs_28_3}, -}; -static arc arcs_29_0[1] = { - {12, 1}, -}; -static arc arcs_29_1[2] = { - {80, 2}, - {0, 1}, -}; -static arc arcs_29_2[1] = { - {21, 3}, -}; -static arc arcs_29_3[1] = { - {0, 3}, -}; -static state states_29[4] = { - {1, arcs_29_0}, - {2, arcs_29_1}, - {1, arcs_29_2}, - {1, arcs_29_3}, -}; -static arc arcs_30_0[1] = { - {79, 1}, -}; -static arc arcs_30_1[2] = { - {29, 2}, - {0, 1}, -}; -static arc arcs_30_2[2] = { - {79, 1}, - {0, 2}, -}; -static state states_30[3] = { - {1, arcs_30_0}, - {2, arcs_30_1}, - {2, arcs_30_2}, -}; -static arc arcs_31_0[1] = { - {81, 1}, -}; -static arc arcs_31_1[2] = { - {29, 0}, - {0, 1}, -}; -static state states_31[2] = { - {1, arcs_31_0}, - {2, arcs_31_1}, -}; -static arc arcs_32_0[1] = { - {21, 1}, -}; -static arc arcs_32_1[2] = { - {77, 0}, - {0, 1}, -}; -static state states_32[2] = { - {1, arcs_32_0}, - {2, arcs_32_1}, -}; -static arc arcs_33_0[1] = { - {82, 1}, -}; -static arc arcs_33_1[1] = { - {21, 2}, -}; -static arc arcs_33_2[2] = { - {29, 1}, - {0, 2}, -}; -static state states_33[3] = { - {1, arcs_33_0}, - {1, arcs_33_1}, - {2, arcs_33_2}, -}; -static arc arcs_34_0[1] = { - {83, 1}, -}; -static arc arcs_34_1[1] = { - {84, 2}, -}; -static arc arcs_34_2[2] = { - {85, 3}, - {0, 2}, -}; -static arc arcs_34_3[1] = { - {28, 4}, -}; -static arc arcs_34_4[2] = { - {29, 5}, - {0, 4}, -}; -static arc arcs_34_5[1] = { - {28, 6}, -}; -static arc arcs_34_6[1] = { - {0, 6}, -}; -static state states_34[7] = { - {1, arcs_34_0}, - {1, arcs_34_1}, - {2, arcs_34_2}, - {1, arcs_34_3}, - {2, arcs_34_4}, - {1, arcs_34_5}, - {1, arcs_34_6}, -}; -static arc arcs_35_0[1] = { - {86, 1}, -}; -static arc arcs_35_1[1] = { - {28, 2}, -}; -static arc arcs_35_2[2] = { - {29, 3}, - {0, 2}, -}; -static arc arcs_35_3[1] = { - {28, 4}, -}; -static arc arcs_35_4[1] = { - {0, 4}, -}; -static state states_35[5] = { - {1, arcs_35_0}, - {1, arcs_35_1}, - {2, arcs_35_2}, - {1, arcs_35_3}, - {1, arcs_35_4}, -}; -static arc arcs_36_0[8] = { - {87, 1}, - {88, 1}, - {89, 1}, - {90, 1}, - {91, 1}, - {19, 1}, - {18, 1}, - {17, 1}, -}; -static arc arcs_36_1[1] = { - {0, 1}, -}; -static state states_36[2] = { - {8, arcs_36_0}, - {1, arcs_36_1}, -}; -static arc arcs_37_0[1] = { - {92, 1}, -}; -static arc arcs_37_1[1] = { - {28, 2}, -}; -static arc arcs_37_2[1] = { - {23, 3}, -}; -static arc arcs_37_3[1] = { - {24, 4}, -}; -static arc arcs_37_4[3] = { - {93, 1}, - {94, 5}, - {0, 4}, -}; -static arc arcs_37_5[1] = { - {23, 6}, -}; -static arc arcs_37_6[1] = { - {24, 7}, -}; -static arc arcs_37_7[1] = { - {0, 7}, -}; -static state states_37[8] = { - {1, arcs_37_0}, - {1, arcs_37_1}, - {1, arcs_37_2}, - {1, arcs_37_3}, - {3, arcs_37_4}, - {1, arcs_37_5}, - {1, arcs_37_6}, - {1, arcs_37_7}, -}; -static arc arcs_38_0[1] = { - {95, 1}, -}; -static arc arcs_38_1[1] = { - {28, 2}, -}; -static arc arcs_38_2[1] = { - {23, 3}, -}; -static arc arcs_38_3[1] = { - {24, 4}, -}; -static arc arcs_38_4[2] = { - {94, 5}, - {0, 4}, -}; -static arc arcs_38_5[1] = { - {23, 6}, -}; -static arc arcs_38_6[1] = { - {24, 7}, -}; -static arc arcs_38_7[1] = { - {0, 7}, -}; -static state states_38[8] = { - {1, arcs_38_0}, - {1, arcs_38_1}, - {1, arcs_38_2}, - {1, arcs_38_3}, - {2, arcs_38_4}, - {1, arcs_38_5}, - {1, arcs_38_6}, - {1, arcs_38_7}, -}; -static arc arcs_39_0[1] = { - {96, 1}, -}; -static arc arcs_39_1[1] = { - {61, 2}, -}; -static arc arcs_39_2[1] = { - {85, 3}, -}; -static arc arcs_39_3[1] = { - {9, 4}, -}; -static arc arcs_39_4[1] = { - {23, 5}, -}; -static arc arcs_39_5[1] = { - {24, 6}, -}; -static arc arcs_39_6[2] = { - {94, 7}, - {0, 6}, -}; -static arc arcs_39_7[1] = { - {23, 8}, -}; -static arc arcs_39_8[1] = { - {24, 9}, -}; -static arc arcs_39_9[1] = { - {0, 9}, -}; -static state states_39[10] = { - {1, arcs_39_0}, - {1, arcs_39_1}, - {1, arcs_39_2}, - {1, arcs_39_3}, - {1, arcs_39_4}, - {1, arcs_39_5}, - {2, arcs_39_6}, - {1, arcs_39_7}, - {1, arcs_39_8}, - {1, arcs_39_9}, -}; -static arc arcs_40_0[1] = { - {97, 1}, -}; -static arc arcs_40_1[1] = { - {23, 2}, -}; -static arc arcs_40_2[1] = { - {24, 3}, -}; -static arc arcs_40_3[2] = { - {98, 4}, - {99, 5}, -}; -static arc arcs_40_4[1] = { - {23, 6}, -}; -static arc arcs_40_5[1] = { - {23, 7}, -}; -static arc arcs_40_6[1] = { - {24, 8}, -}; -static arc arcs_40_7[1] = { - {24, 9}, -}; -static arc arcs_40_8[4] = { - {98, 4}, - {94, 10}, - {99, 5}, - {0, 8}, -}; -static arc arcs_40_9[1] = { - {0, 9}, -}; -static arc arcs_40_10[1] = { - {23, 11}, -}; -static arc arcs_40_11[1] = { - {24, 12}, -}; -static arc arcs_40_12[2] = { - {99, 5}, - {0, 12}, -}; -static state states_40[13] = { - {1, arcs_40_0}, - {1, arcs_40_1}, - {1, arcs_40_2}, - {2, arcs_40_3}, - {1, arcs_40_4}, - {1, arcs_40_5}, - {1, arcs_40_6}, - {1, arcs_40_7}, - {4, arcs_40_8}, - {1, arcs_40_9}, - {1, arcs_40_10}, - {1, arcs_40_11}, - {2, arcs_40_12}, -}; -static arc arcs_41_0[1] = { - {100, 1}, -}; -static arc arcs_41_1[1] = { - {101, 2}, -}; -static arc arcs_41_2[2] = { - {29, 1}, - {23, 3}, -}; -static arc arcs_41_3[1] = { - {24, 4}, -}; -static arc arcs_41_4[1] = { - {0, 4}, -}; -static state states_41[5] = { - {1, arcs_41_0}, - {1, arcs_41_1}, - {2, arcs_41_2}, - {1, arcs_41_3}, - {1, arcs_41_4}, -}; -static arc arcs_42_0[1] = { - {28, 1}, -}; -static arc arcs_42_1[2] = { - {80, 2}, - {0, 1}, -}; -static arc arcs_42_2[1] = { - {84, 3}, -}; -static arc arcs_42_3[1] = { - {0, 3}, -}; -static state states_42[4] = { - {1, arcs_42_0}, - {2, arcs_42_1}, - {1, arcs_42_2}, - {1, arcs_42_3}, -}; -static arc arcs_43_0[1] = { - {102, 1}, -}; -static arc arcs_43_1[2] = { - {28, 2}, - {0, 1}, -}; -static arc arcs_43_2[3] = { - {80, 3}, - {29, 3}, - {0, 2}, -}; -static arc arcs_43_3[1] = { - {28, 4}, -}; -static arc arcs_43_4[1] = { - {0, 4}, -}; -static state states_43[5] = { - {1, arcs_43_0}, - {2, arcs_43_1}, - {3, arcs_43_2}, - {1, arcs_43_3}, - {1, arcs_43_4}, -}; -static arc arcs_44_0[2] = { - {3, 1}, - {2, 2}, -}; -static arc arcs_44_1[1] = { - {0, 1}, -}; -static arc arcs_44_2[1] = { - {103, 3}, -}; -static arc arcs_44_3[1] = { - {6, 4}, -}; -static arc arcs_44_4[2] = { - {6, 4}, - {104, 1}, -}; -static state states_44[5] = { - {2, arcs_44_0}, - {1, arcs_44_1}, - {1, arcs_44_2}, - {1, arcs_44_3}, - {2, arcs_44_4}, -}; -static arc arcs_45_0[1] = { - {106, 1}, -}; -static arc arcs_45_1[2] = { - {29, 2}, - {0, 1}, -}; -static arc arcs_45_2[1] = { - {106, 3}, -}; -static arc arcs_45_3[2] = { - {29, 4}, - {0, 3}, -}; -static arc arcs_45_4[2] = { - {106, 3}, - {0, 4}, -}; -static state states_45[5] = { - {1, arcs_45_0}, - {2, arcs_45_1}, - {1, arcs_45_2}, - {2, arcs_45_3}, - {2, arcs_45_4}, -}; -static arc arcs_46_0[2] = { - {107, 1}, - {108, 1}, -}; -static arc arcs_46_1[1] = { - {0, 1}, -}; -static state states_46[2] = { - {2, arcs_46_0}, - {1, arcs_46_1}, -}; -static arc arcs_47_0[1] = { - {109, 1}, -}; -static arc arcs_47_1[2] = { - {25, 2}, - {23, 3}, -}; -static arc arcs_47_2[1] = { - {23, 3}, -}; -static arc arcs_47_3[1] = { - {106, 4}, -}; -static arc arcs_47_4[1] = { - {0, 4}, -}; -static state states_47[5] = { - {1, arcs_47_0}, - {2, arcs_47_1}, - {1, arcs_47_2}, - {1, arcs_47_3}, - {1, arcs_47_4}, -}; -static arc arcs_48_0[2] = { - {107, 1}, - {110, 2}, -}; -static arc arcs_48_1[2] = { - {92, 3}, - {0, 1}, -}; -static arc arcs_48_2[1] = { - {0, 2}, -}; -static arc arcs_48_3[1] = { - {107, 4}, -}; -static arc arcs_48_4[1] = { - {94, 5}, -}; -static arc arcs_48_5[1] = { - {28, 2}, -}; -static state states_48[6] = { - {2, arcs_48_0}, - {2, arcs_48_1}, - {1, arcs_48_2}, - {1, arcs_48_3}, - {1, arcs_48_4}, - {1, arcs_48_5}, -}; -static arc arcs_49_0[1] = { - {111, 1}, -}; -static arc arcs_49_1[2] = { - {112, 0}, - {0, 1}, -}; -static state states_49[2] = { - {1, arcs_49_0}, - {2, arcs_49_1}, -}; -static arc arcs_50_0[1] = { - {113, 1}, -}; -static arc arcs_50_1[2] = { - {114, 0}, - {0, 1}, -}; -static state states_50[2] = { - {1, arcs_50_0}, - {2, arcs_50_1}, -}; -static arc arcs_51_0[2] = { - {115, 1}, - {116, 2}, -}; -static arc arcs_51_1[1] = { - {113, 2}, -}; -static arc arcs_51_2[1] = { - {0, 2}, -}; -static state states_51[3] = { - {2, arcs_51_0}, - {1, arcs_51_1}, - {1, arcs_51_2}, -}; -static arc arcs_52_0[1] = { - {84, 1}, -}; -static arc arcs_52_1[2] = { - {117, 0}, - {0, 1}, -}; -static state states_52[2] = { - {1, arcs_52_0}, - {2, arcs_52_1}, -}; -static arc arcs_53_0[10] = { - {118, 1}, - {119, 1}, - {120, 1}, - {121, 1}, - {122, 1}, - {123, 1}, - {124, 1}, - {85, 1}, - {115, 2}, - {125, 3}, -}; -static arc arcs_53_1[1] = { - {0, 1}, -}; -static arc arcs_53_2[1] = { - {85, 1}, -}; -static arc arcs_53_3[2] = { - {115, 1}, - {0, 3}, -}; -static state states_53[4] = { - {10, arcs_53_0}, - {1, arcs_53_1}, - {1, arcs_53_2}, - {2, arcs_53_3}, -}; -static arc arcs_54_0[1] = { - {126, 1}, -}; -static arc arcs_54_1[2] = { - {127, 0}, - {0, 1}, -}; -static state states_54[2] = { - {1, arcs_54_0}, - {2, arcs_54_1}, -}; -static arc arcs_55_0[1] = { - {128, 1}, -}; -static arc arcs_55_1[2] = { - {129, 0}, - {0, 1}, -}; -static state states_55[2] = { - {1, arcs_55_0}, - {2, arcs_55_1}, -}; -static arc arcs_56_0[1] = { - {130, 1}, -}; -static arc arcs_56_1[2] = { - {131, 0}, - {0, 1}, -}; -static state states_56[2] = { - {1, arcs_56_0}, - {2, arcs_56_1}, -}; -static arc arcs_57_0[1] = { - {132, 1}, -}; -static arc arcs_57_1[3] = { - {133, 0}, - {59, 0}, - {0, 1}, -}; -static state states_57[2] = { - {1, arcs_57_0}, - {3, arcs_57_1}, -}; -static arc arcs_58_0[1] = { - {134, 1}, -}; -static arc arcs_58_1[3] = { - {135, 0}, - {136, 0}, - {0, 1}, -}; -static state states_58[2] = { - {1, arcs_58_0}, - {3, arcs_58_1}, -}; -static arc arcs_59_0[1] = { - {137, 1}, -}; -static arc arcs_59_1[5] = { - {30, 0}, - {138, 0}, - {139, 0}, - {140, 0}, - {0, 1}, -}; -static state states_59[2] = { - {1, arcs_59_0}, - {5, arcs_59_1}, -}; -static arc arcs_60_0[4] = { - {135, 1}, - {136, 1}, - {141, 1}, - {142, 2}, -}; -static arc arcs_60_1[1] = { - {137, 2}, -}; -static arc arcs_60_2[1] = { - {0, 2}, -}; -static state states_60[3] = { - {4, arcs_60_0}, - {1, arcs_60_1}, - {1, arcs_60_2}, -}; -static arc arcs_61_0[1] = { - {143, 1}, -}; -static arc arcs_61_1[3] = { - {144, 1}, - {31, 2}, - {0, 1}, -}; -static arc arcs_61_2[1] = { - {137, 3}, -}; -static arc arcs_61_3[1] = { - {0, 3}, -}; -static state states_61[4] = { - {1, arcs_61_0}, - {3, arcs_61_1}, - {1, arcs_61_2}, - {1, arcs_61_3}, -}; -static arc arcs_62_0[7] = { - {13, 1}, - {146, 2}, - {149, 3}, - {152, 4}, - {21, 5}, - {154, 5}, - {155, 6}, -}; -static arc arcs_62_1[3] = { - {45, 7}, - {145, 7}, - {15, 5}, -}; -static arc arcs_62_2[2] = { - {147, 8}, - {148, 5}, -}; -static arc arcs_62_3[2] = { - {150, 9}, - {151, 5}, -}; -static arc arcs_62_4[1] = { - {153, 10}, -}; -static arc arcs_62_5[1] = { - {0, 5}, -}; -static arc arcs_62_6[2] = { - {155, 6}, - {0, 6}, -}; -static arc arcs_62_7[1] = { - {15, 5}, -}; -static arc arcs_62_8[1] = { - {148, 5}, -}; -static arc arcs_62_9[1] = { - {151, 5}, -}; -static arc arcs_62_10[1] = { - {152, 5}, -}; -static state states_62[11] = { - {7, arcs_62_0}, - {3, arcs_62_1}, - {2, arcs_62_2}, - {2, arcs_62_3}, - {1, arcs_62_4}, - {1, arcs_62_5}, - {2, arcs_62_6}, - {1, arcs_62_7}, - {1, arcs_62_8}, - {1, arcs_62_9}, - {1, arcs_62_10}, -}; -static arc arcs_63_0[1] = { - {28, 1}, -}; -static arc arcs_63_1[3] = { - {156, 2}, - {29, 3}, - {0, 1}, -}; -static arc arcs_63_2[1] = { - {0, 2}, -}; -static arc arcs_63_3[2] = { - {28, 4}, - {0, 3}, -}; -static arc arcs_63_4[2] = { - {29, 3}, - {0, 4}, -}; -static state states_63[5] = { - {1, arcs_63_0}, - {3, arcs_63_1}, - {1, arcs_63_2}, - {2, arcs_63_3}, - {2, arcs_63_4}, -}; -static arc arcs_64_0[1] = { - {28, 1}, -}; -static arc arcs_64_1[3] = { - {157, 2}, - {29, 3}, - {0, 1}, -}; -static arc arcs_64_2[1] = { - {0, 2}, -}; -static arc arcs_64_3[2] = { - {28, 4}, - {0, 3}, -}; -static arc arcs_64_4[2] = { - {29, 3}, - {0, 4}, -}; -static state states_64[5] = { - {1, arcs_64_0}, - {3, arcs_64_1}, - {1, arcs_64_2}, - {2, arcs_64_3}, - {2, arcs_64_4}, -}; -static arc arcs_65_0[1] = { - {109, 1}, -}; -static arc arcs_65_1[2] = { - {25, 2}, - {23, 3}, -}; -static arc arcs_65_2[1] = { - {23, 3}, -}; -static arc arcs_65_3[1] = { - {28, 4}, -}; -static arc arcs_65_4[1] = { - {0, 4}, -}; -static state states_65[5] = { - {1, arcs_65_0}, - {2, arcs_65_1}, - {1, arcs_65_2}, - {1, arcs_65_3}, - {1, arcs_65_4}, -}; -static arc arcs_66_0[3] = { - {13, 1}, - {146, 2}, - {77, 3}, -}; -static arc arcs_66_1[2] = { - {14, 4}, - {15, 5}, -}; -static arc arcs_66_2[1] = { - {158, 6}, -}; -static arc arcs_66_3[1] = { - {21, 5}, -}; -static arc arcs_66_4[1] = { - {15, 5}, -}; -static arc arcs_66_5[1] = { - {0, 5}, -}; -static arc arcs_66_6[1] = { - {148, 5}, -}; -static state states_66[7] = { - {3, arcs_66_0}, - {2, arcs_66_1}, - {1, arcs_66_2}, - {1, arcs_66_3}, - {1, arcs_66_4}, - {1, arcs_66_5}, - {1, arcs_66_6}, -}; -static arc arcs_67_0[1] = { - {159, 1}, -}; -static arc arcs_67_1[2] = { - {29, 2}, - {0, 1}, -}; -static arc arcs_67_2[2] = { - {159, 1}, - {0, 2}, -}; -static state states_67[3] = { - {1, arcs_67_0}, - {2, arcs_67_1}, - {2, arcs_67_2}, -}; -static arc arcs_68_0[3] = { - {77, 1}, - {28, 2}, - {23, 3}, -}; -static arc arcs_68_1[1] = { - {77, 4}, -}; -static arc arcs_68_2[2] = { - {23, 3}, - {0, 2}, -}; -static arc arcs_68_3[3] = { - {28, 5}, - {160, 6}, - {0, 3}, -}; -static arc arcs_68_4[1] = { - {77, 6}, -}; -static arc arcs_68_5[2] = { - {160, 6}, - {0, 5}, -}; -static arc arcs_68_6[1] = { - {0, 6}, -}; -static state states_68[7] = { - {3, arcs_68_0}, - {1, arcs_68_1}, - {2, arcs_68_2}, - {3, arcs_68_3}, - {1, arcs_68_4}, - {2, arcs_68_5}, - {1, arcs_68_6}, -}; -static arc arcs_69_0[1] = { - {23, 1}, -}; -static arc arcs_69_1[2] = { - {28, 2}, - {0, 1}, -}; -static arc arcs_69_2[1] = { - {0, 2}, -}; -static state states_69[3] = { - {1, arcs_69_0}, - {2, arcs_69_1}, - {1, arcs_69_2}, -}; -static arc arcs_70_0[1] = { - {84, 1}, -}; -static arc arcs_70_1[2] = { - {29, 2}, - {0, 1}, -}; -static arc arcs_70_2[2] = { - {84, 1}, - {0, 2}, -}; -static state states_70[3] = { - {1, arcs_70_0}, - {2, arcs_70_1}, - {2, arcs_70_2}, -}; -static arc arcs_71_0[1] = { - {28, 1}, -}; -static arc arcs_71_1[2] = { - {29, 2}, - {0, 1}, -}; -static arc arcs_71_2[2] = { - {28, 1}, - {0, 2}, -}; -static state states_71[3] = { - {1, arcs_71_0}, - {2, arcs_71_1}, - {2, arcs_71_2}, -}; -static arc arcs_72_0[1] = { - {28, 1}, -}; -static arc arcs_72_1[4] = { - {23, 2}, - {157, 3}, - {29, 4}, - {0, 1}, -}; -static arc arcs_72_2[1] = { - {28, 5}, -}; -static arc arcs_72_3[1] = { - {0, 3}, -}; -static arc arcs_72_4[2] = { - {28, 6}, - {0, 4}, -}; -static arc arcs_72_5[3] = { - {157, 3}, - {29, 7}, - {0, 5}, -}; -static arc arcs_72_6[2] = { - {29, 4}, - {0, 6}, -}; -static arc arcs_72_7[2] = { - {28, 8}, - {0, 7}, -}; -static arc arcs_72_8[1] = { - {23, 9}, -}; -static arc arcs_72_9[1] = { - {28, 10}, -}; -static arc arcs_72_10[2] = { - {29, 7}, - {0, 10}, -}; -static state states_72[11] = { - {1, arcs_72_0}, - {4, arcs_72_1}, - {1, arcs_72_2}, - {1, arcs_72_3}, - {2, arcs_72_4}, - {3, arcs_72_5}, - {2, arcs_72_6}, - {2, arcs_72_7}, - {1, arcs_72_8}, - {1, arcs_72_9}, - {2, arcs_72_10}, -}; -static arc arcs_73_0[1] = { - {161, 1}, -}; -static arc arcs_73_1[1] = { - {21, 2}, -}; -static arc arcs_73_2[2] = { - {13, 3}, - {23, 4}, -}; -static arc arcs_73_3[2] = { - {9, 5}, - {15, 6}, -}; -static arc arcs_73_4[1] = { - {24, 7}, -}; -static arc arcs_73_5[1] = { - {15, 6}, -}; -static arc arcs_73_6[1] = { - {23, 4}, -}; -static arc arcs_73_7[1] = { - {0, 7}, -}; -static state states_73[8] = { - {1, arcs_73_0}, - {1, arcs_73_1}, - {2, arcs_73_2}, - {2, arcs_73_3}, - {1, arcs_73_4}, - {1, arcs_73_5}, - {1, arcs_73_6}, - {1, arcs_73_7}, -}; -static arc arcs_74_0[3] = { - {162, 1}, - {30, 2}, - {31, 3}, -}; -static arc arcs_74_1[2] = { - {29, 4}, - {0, 1}, -}; -static arc arcs_74_2[1] = { - {28, 5}, -}; -static arc arcs_74_3[1] = { - {28, 6}, -}; -static arc arcs_74_4[4] = { - {162, 1}, - {30, 2}, - {31, 3}, - {0, 4}, -}; -static arc arcs_74_5[2] = { - {29, 7}, - {0, 5}, -}; -static arc arcs_74_6[1] = { - {0, 6}, -}; -static arc arcs_74_7[2] = { - {162, 5}, - {31, 3}, -}; -static state states_74[8] = { - {3, arcs_74_0}, - {2, arcs_74_1}, - {1, arcs_74_2}, - {1, arcs_74_3}, - {4, arcs_74_4}, - {2, arcs_74_5}, - {1, arcs_74_6}, - {2, arcs_74_7}, -}; -static arc arcs_75_0[1] = { - {28, 1}, -}; -static arc arcs_75_1[3] = { - {157, 2}, - {27, 3}, - {0, 1}, -}; -static arc arcs_75_2[1] = { - {0, 2}, -}; -static arc arcs_75_3[1] = { - {28, 2}, -}; -static state states_75[4] = { - {1, arcs_75_0}, - {3, arcs_75_1}, - {1, arcs_75_2}, - {1, arcs_75_3}, -}; -static arc arcs_76_0[2] = { - {156, 1}, - {164, 1}, -}; -static arc arcs_76_1[1] = { - {0, 1}, -}; -static state states_76[2] = { - {2, arcs_76_0}, - {1, arcs_76_1}, -}; -static arc arcs_77_0[1] = { - {96, 1}, -}; -static arc arcs_77_1[1] = { - {61, 2}, -}; -static arc arcs_77_2[1] = { - {85, 3}, -}; -static arc arcs_77_3[1] = { - {105, 4}, -}; -static arc arcs_77_4[2] = { - {163, 5}, - {0, 4}, -}; -static arc arcs_77_5[1] = { - {0, 5}, -}; -static state states_77[6] = { - {1, arcs_77_0}, - {1, arcs_77_1}, - {1, arcs_77_2}, - {1, arcs_77_3}, - {2, arcs_77_4}, - {1, arcs_77_5}, -}; -static arc arcs_78_0[1] = { - {92, 1}, -}; -static arc arcs_78_1[1] = { - {106, 2}, -}; -static arc arcs_78_2[2] = { - {163, 3}, - {0, 2}, -}; -static arc arcs_78_3[1] = { - {0, 3}, -}; -static state states_78[4] = { - {1, arcs_78_0}, - {1, arcs_78_1}, - {2, arcs_78_2}, - {1, arcs_78_3}, -}; -static arc arcs_79_0[2] = { - {157, 1}, - {166, 1}, -}; -static arc arcs_79_1[1] = { - {0, 1}, -}; -static state states_79[2] = { - {2, arcs_79_0}, - {1, arcs_79_1}, -}; -static arc arcs_80_0[1] = { - {96, 1}, -}; -static arc arcs_80_1[1] = { - {61, 2}, -}; -static arc arcs_80_2[1] = { - {85, 3}, -}; -static arc arcs_80_3[1] = { - {107, 4}, -}; -static arc arcs_80_4[2] = { - {165, 5}, - {0, 4}, -}; -static arc arcs_80_5[1] = { - {0, 5}, -}; -static state states_80[6] = { - {1, arcs_80_0}, - {1, arcs_80_1}, - {1, arcs_80_2}, - {1, arcs_80_3}, - {2, arcs_80_4}, - {1, arcs_80_5}, -}; -static arc arcs_81_0[1] = { - {92, 1}, -}; -static arc arcs_81_1[1] = { - {106, 2}, -}; -static arc arcs_81_2[2] = { - {165, 3}, - {0, 2}, -}; -static arc arcs_81_3[1] = { - {0, 3}, -}; -static state states_81[4] = { - {1, arcs_81_0}, - {1, arcs_81_1}, - {2, arcs_81_2}, - {1, arcs_81_3}, -}; -static arc arcs_82_0[1] = { - {28, 1}, -}; -static arc arcs_82_1[2] = { - {29, 0}, - {0, 1}, -}; -static state states_82[2] = { - {1, arcs_82_0}, - {2, arcs_82_1}, -}; -static arc arcs_83_0[1] = { - {21, 1}, -}; -static arc arcs_83_1[1] = { - {0, 1}, -}; -static state states_83[2] = { - {1, arcs_83_0}, - {1, arcs_83_1}, -}; -static arc arcs_84_0[1] = { - {168, 1}, -}; -static arc arcs_84_1[2] = { - {9, 2}, - {0, 1}, -}; -static arc arcs_84_2[1] = { - {0, 2}, -}; -static state states_84[3] = { - {1, arcs_84_0}, - {2, arcs_84_1}, - {1, arcs_84_2}, -}; -static dfa dfas[85] = { - {256, "single_input", 0, 3, states_0, - "\004\050\060\000\000\000\000\124\360\024\114\220\023\040\010\000\200\041\044\015\002\001"}, - {257, "file_input", 0, 2, states_1, - "\204\050\060\000\000\000\000\124\360\024\114\220\023\040\010\000\200\041\044\015\002\001"}, - {258, "eval_input", 0, 3, states_2, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {259, "decorator", 0, 7, states_3, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {260, "decorators", 0, 2, states_4, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {261, "decorated", 0, 3, states_5, - "\000\010\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {262, "funcdef", 0, 6, states_6, - "\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {263, "parameters", 0, 4, states_7, - "\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {264, "varargslist", 0, 10, states_8, - "\000\040\040\300\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {265, "fpdef", 0, 4, states_9, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {266, "fplist", 0, 3, states_10, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {267, "stmt", 0, 2, states_11, - "\000\050\060\000\000\000\000\124\360\024\114\220\023\040\010\000\200\041\044\015\002\001"}, - {268, "simple_stmt", 0, 4, states_12, - "\000\040\040\000\000\000\000\124\360\024\114\000\000\040\010\000\200\041\044\015\000\001"}, - {269, "small_stmt", 0, 2, states_13, - "\000\040\040\000\000\000\000\124\360\024\114\000\000\040\010\000\200\041\044\015\000\001"}, - {270, "expr_stmt", 0, 6, states_14, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {271, "augassign", 0, 2, states_15, - "\000\000\000\000\000\300\377\003\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {272, "print_stmt", 0, 9, states_16, - "\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {273, "del_stmt", 0, 3, states_17, - "\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {274, "pass_stmt", 0, 2, states_18, - "\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {275, "flow_stmt", 0, 2, states_19, - "\000\000\000\000\000\000\000\000\360\000\000\000\000\000\000\000\000\000\000\000\000\001"}, - {276, "break_stmt", 0, 2, states_20, - "\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {277, "continue_stmt", 0, 2, states_21, - "\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {278, "return_stmt", 0, 3, states_22, - "\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {279, "yield_stmt", 0, 2, states_23, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, - {280, "raise_stmt", 0, 7, states_24, - "\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {281, "import_stmt", 0, 2, states_25, - "\000\000\000\000\000\000\000\000\000\024\000\000\000\000\000\000\000\000\000\000\000\000"}, - {282, "import_name", 0, 3, states_26, - "\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000\000"}, - {283, "import_from", 0, 8, states_27, - "\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000\000\000"}, - {284, "import_as_name", 0, 4, states_28, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {285, "dotted_as_name", 0, 4, states_29, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {286, "import_as_names", 0, 3, states_30, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {287, "dotted_as_names", 0, 2, states_31, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {288, "dotted_name", 0, 2, states_32, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {289, "global_stmt", 0, 3, states_33, - "\000\000\000\000\000\000\000\000\000\000\004\000\000\000\000\000\000\000\000\000\000\000"}, - {290, "exec_stmt", 0, 7, states_34, - "\000\000\000\000\000\000\000\000\000\000\010\000\000\000\000\000\000\000\000\000\000\000"}, - {291, "assert_stmt", 0, 5, states_35, - "\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000\000\000"}, - {292, "compound_stmt", 0, 2, states_36, - "\000\010\020\000\000\000\000\000\000\000\000\220\023\000\000\000\000\000\000\000\002\000"}, - {293, "if_stmt", 0, 8, states_37, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, - {294, "while_stmt", 0, 8, states_38, - "\000\000\000\000\000\000\000\000\000\000\000\200\000\000\000\000\000\000\000\000\000\000"}, - {295, "for_stmt", 0, 10, states_39, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {296, "try_stmt", 0, 13, states_40, - "\000\000\000\000\000\000\000\000\000\000\000\000\002\000\000\000\000\000\000\000\000\000"}, - {297, "with_stmt", 0, 5, states_41, - "\000\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000"}, - {298, "with_item", 0, 4, states_42, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {299, "except_clause", 0, 5, states_43, - "\000\000\000\000\000\000\000\000\000\000\000\000\100\000\000\000\000\000\000\000\000\000"}, - {300, "suite", 0, 5, states_44, - "\004\040\040\000\000\000\000\124\360\024\114\000\000\040\010\000\200\041\044\015\000\001"}, - {301, "testlist_safe", 0, 5, states_45, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {302, "old_test", 0, 2, states_46, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {303, "old_lambdef", 0, 5, states_47, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"}, - {304, "test", 0, 6, states_48, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {305, "or_test", 0, 2, states_49, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\010\000\200\041\044\015\000\000"}, - {306, "and_test", 0, 2, states_50, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\010\000\200\041\044\015\000\000"}, - {307, "not_test", 0, 3, states_51, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\010\000\200\041\044\015\000\000"}, - {308, "comparison", 0, 2, states_52, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {309, "comp_op", 0, 4, states_53, - "\000\000\000\000\000\000\000\000\000\000\040\000\000\000\310\077\000\000\000\000\000\000"}, - {310, "expr", 0, 2, states_54, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {311, "xor_expr", 0, 2, states_55, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {312, "and_expr", 0, 2, states_56, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {313, "shift_expr", 0, 2, states_57, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {314, "arith_expr", 0, 2, states_58, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {315, "term", 0, 2, states_59, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {316, "factor", 0, 3, states_60, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {317, "power", 0, 4, states_61, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\044\015\000\000"}, - {318, "atom", 0, 11, states_62, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\044\015\000\000"}, - {319, "listmaker", 0, 5, states_63, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {320, "testlist_comp", 0, 5, states_64, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {321, "lambdef", 0, 5, states_65, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000"}, - {322, "trailer", 0, 7, states_66, - "\000\040\000\000\000\000\000\000\000\040\000\000\000\000\000\000\000\000\004\000\000\000"}, - {323, "subscriptlist", 0, 3, states_67, - "\000\040\240\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\015\000\000"}, - {324, "subscript", 0, 7, states_68, - "\000\040\240\000\000\000\000\000\000\040\000\000\000\040\010\000\200\041\044\015\000\000"}, - {325, "sliceop", 0, 3, states_69, - "\000\000\200\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {326, "exprlist", 0, 3, states_70, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\000\000\000\200\041\044\015\000\000"}, - {327, "testlist", 0, 3, states_71, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {328, "dictorsetmaker", 0, 11, states_72, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {329, "classdef", 0, 8, states_73, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\002\000"}, - {330, "arglist", 0, 8, states_74, - "\000\040\040\300\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {331, "argument", 0, 4, states_75, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {332, "list_iter", 0, 2, states_76, - "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, - {333, "list_for", 0, 6, states_77, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {334, "list_if", 0, 4, states_78, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, - {335, "comp_iter", 0, 2, states_79, - "\000\000\000\000\000\000\000\000\000\000\000\020\001\000\000\000\000\000\000\000\000\000"}, - {336, "comp_for", 0, 6, states_80, - "\000\000\000\000\000\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\000\000"}, - {337, "comp_if", 0, 4, states_81, - "\000\000\000\000\000\000\000\000\000\000\000\020\000\000\000\000\000\000\000\000\000\000"}, - {338, "testlist1", 0, 2, states_82, - "\000\040\040\000\000\000\000\000\000\000\000\000\000\040\010\000\200\041\044\015\000\000"}, - {339, "encoding_decl", 0, 2, states_83, - "\000\000\040\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000"}, - {340, "yield_expr", 0, 3, states_84, - "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\001"}, -}; -static label labels[169] = { - {0, "EMPTY"}, - {256, 0}, - {4, 0}, - {268, 0}, - {292, 0}, - {257, 0}, - {267, 0}, - {0, 0}, - {258, 0}, - {327, 0}, - {259, 0}, - {50, 0}, - {288, 0}, - {7, 0}, - {330, 0}, - {8, 0}, - {260, 0}, - {261, 0}, - {329, 0}, - {262, 0}, - {1, "def"}, - {1, 0}, - {263, 0}, - {11, 0}, - {300, 0}, - {264, 0}, - {265, 0}, - {22, 0}, - {304, 0}, - {12, 0}, - {16, 0}, - {36, 0}, - {266, 0}, - {269, 0}, - {13, 0}, - {270, 0}, - {272, 0}, - {273, 0}, - {274, 0}, - {275, 0}, - {281, 0}, - {289, 0}, - {290, 0}, - {291, 0}, - {271, 0}, - {340, 0}, - {37, 0}, - {38, 0}, - {39, 0}, - {40, 0}, - {41, 0}, - {42, 0}, - {43, 0}, - {44, 0}, - {45, 0}, - {46, 0}, - {47, 0}, - {49, 0}, - {1, "print"}, - {35, 0}, - {1, "del"}, - {326, 0}, - {1, "pass"}, - {276, 0}, - {277, 0}, - {278, 0}, - {280, 0}, - {279, 0}, - {1, "break"}, - {1, "continue"}, - {1, "return"}, - {1, "raise"}, - {282, 0}, - {283, 0}, - {1, "import"}, - {287, 0}, - {1, "from"}, - {23, 0}, - {286, 0}, - {284, 0}, - {1, "as"}, - {285, 0}, - {1, "global"}, - {1, "exec"}, - {310, 0}, - {1, "in"}, - {1, "assert"}, - {293, 0}, - {294, 0}, - {295, 0}, - {296, 0}, - {297, 0}, - {1, "if"}, - {1, "elif"}, - {1, "else"}, - {1, "while"}, - {1, "for"}, - {1, "try"}, - {299, 0}, - {1, "finally"}, - {1, "with"}, - {298, 0}, - {1, "except"}, - {5, 0}, - {6, 0}, - {301, 0}, - {302, 0}, - {305, 0}, - {303, 0}, - {1, "lambda"}, - {321, 0}, - {306, 0}, - {1, "or"}, - {307, 0}, - {1, "and"}, - {1, "not"}, - {308, 0}, - {309, 0}, - {20, 0}, - {21, 0}, - {28, 0}, - {31, 0}, - {30, 0}, - {29, 0}, - {29, 0}, - {1, "is"}, - {311, 0}, - {18, 0}, - {312, 0}, - {33, 0}, - {313, 0}, - {19, 0}, - {314, 0}, - {34, 0}, - {315, 0}, - {14, 0}, - {15, 0}, - {316, 0}, - {17, 0}, - {24, 0}, - {48, 0}, - {32, 0}, - {317, 0}, - {318, 0}, - {322, 0}, - {320, 0}, - {9, 0}, - {319, 0}, - {10, 0}, - {26, 0}, - {328, 0}, - {27, 0}, - {25, 0}, - {338, 0}, - {2, 0}, - {3, 0}, - {333, 0}, - {336, 0}, - {323, 0}, - {324, 0}, - {325, 0}, - {1, "class"}, - {331, 0}, - {332, 0}, - {334, 0}, - {335, 0}, - {337, 0}, - {339, 0}, - {1, "yield"}, -}; -grammar _PyParser_Grammar = { - 85, - dfas, - {169, labels}, - 256 -}; diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/import.c b/AppPkg/Applications/Python/Python-2.7.10/Python/import.c deleted file mode 100644 index 6a95d4d..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/import.c +++ /dev/null @@ -1,3481 +0,0 @@ - -/* Module definition and import implementation */ - -#include "Python.h" - -#include "Python-ast.h" -#undef Yield /* undefine macro conflicting with winbase.h */ -#include "pyarena.h" -#include "pythonrun.h" -#include "errcode.h" -#include "marshal.h" -#include "code.h" -#include "compile.h" -#include "eval.h" -#include "osdefs.h" -#include "importdl.h" - -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef MS_WINDOWS -/* for stat.st_mode */ -typedef unsigned short mode_t; -#endif - - -/* Magic word to reject .pyc files generated by other Python versions. - It should change for each incompatible change to the bytecode. - - The value of CR and LF is incorporated so if you ever read or write - a .pyc file in text mode the magic number will be wrong; also, the - Apple MPW compiler swaps their values, botching string constants. - - The magic numbers must be spaced apart atleast 2 values, as the - -U interpeter flag will cause MAGIC+1 being used. They have been - odd numbers for some time now. - - There were a variety of old schemes for setting the magic number. - The current working scheme is to increment the previous value by - 10. - - Known values: - Python 1.5: 20121 - Python 1.5.1: 20121 - Python 1.5.2: 20121 - Python 1.6: 50428 - Python 2.0: 50823 - Python 2.0.1: 50823 - Python 2.1: 60202 - Python 2.1.1: 60202 - Python 2.1.2: 60202 - Python 2.2: 60717 - Python 2.3a0: 62011 - Python 2.3a0: 62021 - Python 2.3a0: 62011 (!) - Python 2.4a0: 62041 - Python 2.4a3: 62051 - Python 2.4b1: 62061 - Python 2.5a0: 62071 - Python 2.5a0: 62081 (ast-branch) - Python 2.5a0: 62091 (with) - Python 2.5a0: 62092 (changed WITH_CLEANUP opcode) - Python 2.5b3: 62101 (fix wrong code: for x, in ...) - Python 2.5b3: 62111 (fix wrong code: x += yield) - Python 2.5c1: 62121 (fix wrong lnotab with for loops and - storing constants that should have been removed) - Python 2.5c2: 62131 (fix wrong code: for x, in ... in listcomp/genexp) - Python 2.6a0: 62151 (peephole optimizations and STORE_MAP opcode) - Python 2.6a1: 62161 (WITH_CLEANUP optimization) - Python 2.7a0: 62171 (optimize list comprehensions/change LIST_APPEND) - Python 2.7a0: 62181 (optimize conditional branches: - introduce POP_JUMP_IF_FALSE and POP_JUMP_IF_TRUE) - Python 2.7a0 62191 (introduce SETUP_WITH) - Python 2.7a0 62201 (introduce BUILD_SET) - Python 2.7a0 62211 (introduce MAP_ADD and SET_ADD) -. -*/ -#define MAGIC (62211 | ((long)'\r'<<16) | ((long)'\n'<<24)) - -/* Magic word as global; note that _PyImport_Init() can change the - value of this global to accommodate for alterations of how the - compiler works which are enabled by command line switches. */ -static long pyc_magic = MAGIC; - -/* See _PyImport_FixupExtension() below */ -static PyObject *extensions = NULL; - -/* This table is defined in config.c: */ -extern struct _inittab _PyImport_Inittab[]; - -struct _inittab *PyImport_Inittab = _PyImport_Inittab; - -/* these tables define the module suffixes that Python recognizes */ -struct filedescr * _PyImport_Filetab = NULL; - -#ifdef RISCOS -static const struct filedescr _PyImport_StandardFiletab[] = { - {"/py", "U", PY_SOURCE}, - {"/pyc", "rb", PY_COMPILED}, - {0, 0} -}; -#else -static const struct filedescr _PyImport_StandardFiletab[] = { - {".py", "U", PY_SOURCE}, -#ifdef MS_WINDOWS - {".pyw", "U", PY_SOURCE}, -#endif - {".pyc", "rb", PY_COMPILED}, - {0, 0} -}; -#endif - -#ifdef MS_WINDOWS -static int isdir(char *path) { - DWORD rv; - /* see issue1293 and issue3677: - * stat() on Windows doesn't recognise paths like - * "e:\\shared\\" and "\\\\whiterab-c2znlh\\shared" as dirs. - * Also reference issue6727: - * stat() on Windows is broken and doesn't resolve symlinks properly. - */ - rv = GetFileAttributesA(path); - return rv != INVALID_FILE_ATTRIBUTES && rv & FILE_ATTRIBUTE_DIRECTORY; -} -#else -#ifdef HAVE_STAT -static int isdir(char *path) { - struct stat statbuf; - return stat(path, &statbuf) == 0 && S_ISDIR(statbuf.st_mode); -} -#else -#ifdef RISCOS -/* with RISCOS, isdir is in unixstuff */ -#else -int isdir(char *path) { - return 0; -} -#endif /* RISCOS */ -#endif /* HAVE_STAT */ -#endif /* MS_WINDOWS */ - -/* Initialize things */ - -void -_PyImport_Init(void) -{ - const struct filedescr *scan; - struct filedescr *filetab; - int countD = 0; - int countS = 0; - - /* prepare _PyImport_Filetab: copy entries from - _PyImport_DynLoadFiletab and _PyImport_StandardFiletab. - */ -#ifdef HAVE_DYNAMIC_LOADING - for (scan = _PyImport_DynLoadFiletab; scan->suffix != NULL; ++scan) - ++countD; -#endif - for (scan = _PyImport_StandardFiletab; scan->suffix != NULL; ++scan) - ++countS; - filetab = PyMem_NEW(struct filedescr, countD + countS + 1); - if (filetab == NULL) - Py_FatalError("Can't initialize import file table."); -#ifdef HAVE_DYNAMIC_LOADING - memcpy(filetab, _PyImport_DynLoadFiletab, - countD * sizeof(struct filedescr)); -#endif - memcpy(filetab + countD, _PyImport_StandardFiletab, - countS * sizeof(struct filedescr)); - filetab[countD + countS].suffix = NULL; - - _PyImport_Filetab = filetab; - - if (Py_OptimizeFlag) { - /* Replace ".pyc" with ".pyo" in _PyImport_Filetab */ - for (; filetab->suffix != NULL; filetab++) { -#ifndef RISCOS - if (strcmp(filetab->suffix, ".pyc") == 0) - filetab->suffix = ".pyo"; -#else - if (strcmp(filetab->suffix, "/pyc") == 0) - filetab->suffix = "/pyo"; -#endif - } - } - - if (Py_UnicodeFlag) { - /* Fix the pyc_magic so that byte compiled code created - using the all-Unicode method doesn't interfere with - code created in normal operation mode. */ - pyc_magic = MAGIC + 1; - } -} - -void -_PyImportHooks_Init(void) -{ - PyObject *v, *path_hooks = NULL, *zimpimport; - int err = 0; - - /* adding sys.path_hooks and sys.path_importer_cache, setting up - zipimport */ - if (PyType_Ready(&PyNullImporter_Type) < 0) - goto error; - - if (Py_VerboseFlag) - PySys_WriteStderr("# installing zipimport hook\n"); - - v = PyList_New(0); - if (v == NULL) - goto error; - err = PySys_SetObject("meta_path", v); - Py_DECREF(v); - if (err) - goto error; - v = PyDict_New(); - if (v == NULL) - goto error; - err = PySys_SetObject("path_importer_cache", v); - Py_DECREF(v); - if (err) - goto error; - path_hooks = PyList_New(0); - if (path_hooks == NULL) - goto error; - err = PySys_SetObject("path_hooks", path_hooks); - if (err) { - error: - PyErr_Print(); - Py_FatalError("initializing sys.meta_path, sys.path_hooks, " - "path_importer_cache, or NullImporter failed" - ); - } - - zimpimport = PyImport_ImportModule("zipimport"); - if (zimpimport == NULL) { - PyErr_Clear(); /* No zip import module -- okay */ - if (Py_VerboseFlag) - PySys_WriteStderr("# can't import zipimport\n"); - } - else { - PyObject *zipimporter = PyObject_GetAttrString(zimpimport, - "zipimporter"); - Py_DECREF(zimpimport); - if (zipimporter == NULL) { - PyErr_Clear(); /* No zipimporter object -- okay */ - if (Py_VerboseFlag) - PySys_WriteStderr( - "# can't import zipimport.zipimporter\n"); - } - else { - /* sys.path_hooks.append(zipimporter) */ - err = PyList_Append(path_hooks, zipimporter); - Py_DECREF(zipimporter); - if (err) - goto error; - if (Py_VerboseFlag) - PySys_WriteStderr( - "# installed zipimport hook\n"); - } - } - Py_DECREF(path_hooks); -} - -void -_PyImport_Fini(void) -{ - Py_XDECREF(extensions); - extensions = NULL; - PyMem_DEL(_PyImport_Filetab); - _PyImport_Filetab = NULL; -} - - -/* Locking primitives to prevent parallel imports of the same module - in different threads to return with a partially loaded module. - These calls are serialized by the global interpreter lock. */ - -#ifdef WITH_THREAD - -#include "pythread.h" - -static PyThread_type_lock import_lock = 0; -static long import_lock_thread = -1; -static int import_lock_level = 0; - -void -_PyImport_AcquireLock(void) -{ - long me = PyThread_get_thread_ident(); - if (me == -1) - return; /* Too bad */ - if (import_lock == NULL) { - import_lock = PyThread_allocate_lock(); - if (import_lock == NULL) - return; /* Nothing much we can do. */ - } - if (import_lock_thread == me) { - import_lock_level++; - return; - } - if (import_lock_thread != -1 || !PyThread_acquire_lock(import_lock, 0)) - { - PyThreadState *tstate = PyEval_SaveThread(); - PyThread_acquire_lock(import_lock, 1); - PyEval_RestoreThread(tstate); - } - import_lock_thread = me; - import_lock_level = 1; -} - -int -_PyImport_ReleaseLock(void) -{ - long me = PyThread_get_thread_ident(); - if (me == -1 || import_lock == NULL) - return 0; /* Too bad */ - if (import_lock_thread != me) - return -1; - import_lock_level--; - if (import_lock_level == 0) { - import_lock_thread = -1; - PyThread_release_lock(import_lock); - } - return 1; -} - -/* This function is called from PyOS_AfterFork to ensure that newly - created child processes do not share locks with the parent. - We now acquire the import lock around fork() calls but on some platforms - (Solaris 9 and earlier? see isue7242) that still left us with problems. */ - -void -_PyImport_ReInitLock(void) -{ - if (import_lock != NULL) { - import_lock = PyThread_allocate_lock(); - if (import_lock == NULL) { - Py_FatalError("PyImport_ReInitLock failed to create a new lock"); - } - } - import_lock_thread = -1; - import_lock_level = 0; -} - -#endif - -static PyObject * -imp_lock_held(PyObject *self, PyObject *noargs) -{ -#ifdef WITH_THREAD - return PyBool_FromLong(import_lock_thread != -1); -#else - return PyBool_FromLong(0); -#endif -} - -static PyObject * -imp_acquire_lock(PyObject *self, PyObject *noargs) -{ -#ifdef WITH_THREAD - _PyImport_AcquireLock(); -#endif - Py_INCREF(Py_None); - return Py_None; -} - -static PyObject * -imp_release_lock(PyObject *self, PyObject *noargs) -{ -#ifdef WITH_THREAD - if (_PyImport_ReleaseLock() < 0) { - PyErr_SetString(PyExc_RuntimeError, - "not holding the import lock"); - return NULL; - } -#endif - Py_INCREF(Py_None); - return Py_None; -} - -static void -imp_modules_reloading_clear(void) -{ - PyInterpreterState *interp = PyThreadState_Get()->interp; - if (interp->modules_reloading != NULL) - PyDict_Clear(interp->modules_reloading); -} - -/* Helper for sys */ - -PyObject * -PyImport_GetModuleDict(void) -{ - PyInterpreterState *interp = PyThreadState_GET()->interp; - if (interp->modules == NULL) - Py_FatalError("PyImport_GetModuleDict: no module dictionary!"); - return interp->modules; -} - - -/* List of names to clear in sys */ -static char* sys_deletes[] = { - "path", "argv", "ps1", "ps2", "exitfunc", - "exc_type", "exc_value", "exc_traceback", - "last_type", "last_value", "last_traceback", - "path_hooks", "path_importer_cache", "meta_path", - /* misc stuff */ - "flags", "float_info", - NULL -}; - -static char* sys_files[] = { - "stdin", "__stdin__", - "stdout", "__stdout__", - "stderr", "__stderr__", - NULL -}; - - -/* Un-initialize things, as good as we can */ - -void -PyImport_Cleanup(void) -{ - Py_ssize_t pos, ndone; - char *name; - PyObject *key, *value, *dict; - PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = interp->modules; - - if (modules == NULL) - return; /* Already done */ - - /* Delete some special variables first. These are common - places where user values hide and people complain when their - destructors fail. Since the modules containing them are - deleted *last* of all, they would come too late in the normal - destruction order. Sigh. */ - - value = PyDict_GetItemString(modules, "__builtin__"); - if (value != NULL && PyModule_Check(value)) { - dict = PyModule_GetDict(value); - if (Py_VerboseFlag) - PySys_WriteStderr("# clear __builtin__._\n"); - PyDict_SetItemString(dict, "_", Py_None); - } - value = PyDict_GetItemString(modules, "sys"); - if (value != NULL && PyModule_Check(value)) { - char **p; - PyObject *v; - dict = PyModule_GetDict(value); - for (p = sys_deletes; *p != NULL; p++) { - if (Py_VerboseFlag) - PySys_WriteStderr("# clear sys.%s\n", *p); - PyDict_SetItemString(dict, *p, Py_None); - } - for (p = sys_files; *p != NULL; p+=2) { - if (Py_VerboseFlag) - PySys_WriteStderr("# restore sys.%s\n", *p); - v = PyDict_GetItemString(dict, *(p+1)); - if (v == NULL) - v = Py_None; - PyDict_SetItemString(dict, *p, v); - } - } - - /* First, delete __main__ */ - value = PyDict_GetItemString(modules, "__main__"); - if (value != NULL && PyModule_Check(value)) { - if (Py_VerboseFlag) - PySys_WriteStderr("# cleanup __main__\n"); - _PyModule_Clear(value); - PyDict_SetItemString(modules, "__main__", Py_None); - } - - /* The special treatment of __builtin__ here is because even - when it's not referenced as a module, its dictionary is - referenced by almost every module's __builtins__. Since - deleting a module clears its dictionary (even if there are - references left to it), we need to delete the __builtin__ - module last. Likewise, we don't delete sys until the very - end because it is implicitly referenced (e.g. by print). - - Also note that we 'delete' modules by replacing their entry - in the modules dict with None, rather than really deleting - them; this avoids a rehash of the modules dictionary and - also marks them as "non existent" so they won't be - re-imported. */ - - /* Next, repeatedly delete modules with a reference count of - one (skipping __builtin__ and sys) and delete them */ - do { - ndone = 0; - pos = 0; - while (PyDict_Next(modules, &pos, &key, &value)) { - if (value->ob_refcnt != 1) - continue; - if (PyString_Check(key) && PyModule_Check(value)) { - name = PyString_AS_STRING(key); - if (strcmp(name, "__builtin__") == 0) - continue; - if (strcmp(name, "sys") == 0) - continue; - if (Py_VerboseFlag) - PySys_WriteStderr( - "# cleanup[1] %s\n", name); - _PyModule_Clear(value); - PyDict_SetItem(modules, key, Py_None); - ndone++; - } - } - } while (ndone > 0); - - /* Next, delete all modules (still skipping __builtin__ and sys) */ - pos = 0; - while (PyDict_Next(modules, &pos, &key, &value)) { - if (PyString_Check(key) && PyModule_Check(value)) { - name = PyString_AS_STRING(key); - if (strcmp(name, "__builtin__") == 0) - continue; - if (strcmp(name, "sys") == 0) - continue; - if (Py_VerboseFlag) - PySys_WriteStderr("# cleanup[2] %s\n", name); - _PyModule_Clear(value); - PyDict_SetItem(modules, key, Py_None); - } - } - - /* Next, delete sys and __builtin__ (in that order) */ - value = PyDict_GetItemString(modules, "sys"); - if (value != NULL && PyModule_Check(value)) { - if (Py_VerboseFlag) - PySys_WriteStderr("# cleanup sys\n"); - _PyModule_Clear(value); - PyDict_SetItemString(modules, "sys", Py_None); - } - value = PyDict_GetItemString(modules, "__builtin__"); - if (value != NULL && PyModule_Check(value)) { - if (Py_VerboseFlag) - PySys_WriteStderr("# cleanup __builtin__\n"); - _PyModule_Clear(value); - PyDict_SetItemString(modules, "__builtin__", Py_None); - } - - /* Finally, clear and delete the modules directory */ - PyDict_Clear(modules); - interp->modules = NULL; - Py_DECREF(modules); - Py_CLEAR(interp->modules_reloading); -} - - -/* Helper for pythonrun.c -- return magic number */ - -long -PyImport_GetMagicNumber(void) -{ - return pyc_magic; -} - - -/* Magic for extension modules (built-in as well as dynamically - loaded). To prevent initializing an extension module more than - once, we keep a static dictionary 'extensions' keyed by module name - (for built-in modules) or by filename (for dynamically loaded - modules), containing these modules. A copy of the module's - dictionary is stored by calling _PyImport_FixupExtension() - immediately after the module initialization function succeeds. A - copy can be retrieved from there by calling - _PyImport_FindExtension(). */ - -PyObject * -_PyImport_FixupExtension(char *name, char *filename) -{ - PyObject *modules, *mod, *dict, *copy; - if (extensions == NULL) { - extensions = PyDict_New(); - if (extensions == NULL) - return NULL; - } - modules = PyImport_GetModuleDict(); - mod = PyDict_GetItemString(modules, name); - if (mod == NULL || !PyModule_Check(mod)) { - PyErr_Format(PyExc_SystemError, - "_PyImport_FixupExtension: module %.200s not loaded", name); - return NULL; - } - dict = PyModule_GetDict(mod); - if (dict == NULL) - return NULL; - copy = PyDict_Copy(dict); - if (copy == NULL) - return NULL; - PyDict_SetItemString(extensions, filename, copy); - Py_DECREF(copy); - return copy; -} - -PyObject * -_PyImport_FindExtension(char *name, char *filename) -{ - PyObject *dict, *mod, *mdict; - if (extensions == NULL) - return NULL; - dict = PyDict_GetItemString(extensions, filename); - if (dict == NULL) - return NULL; - mod = PyImport_AddModule(name); - if (mod == NULL) - return NULL; - mdict = PyModule_GetDict(mod); - if (mdict == NULL) - return NULL; - if (PyDict_Update(mdict, dict)) - return NULL; - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # previously loaded (%s)\n", - name, filename); - return mod; -} - - -/* Get the module object corresponding to a module name. - First check the modules dictionary if there's one there, - if not, create a new one and insert it in the modules dictionary. - Because the former action is most common, THIS DOES NOT RETURN A - 'NEW' REFERENCE! */ - -PyObject * -PyImport_AddModule(const char *name) -{ - PyObject *modules = PyImport_GetModuleDict(); - PyObject *m; - - if ((m = PyDict_GetItemString(modules, name)) != NULL && - PyModule_Check(m)) - return m; - m = PyModule_New(name); - if (m == NULL) - return NULL; - if (PyDict_SetItemString(modules, name, m) != 0) { - Py_DECREF(m); - return NULL; - } - Py_DECREF(m); /* Yes, it still exists, in modules! */ - - return m; -} - -/* Remove name from sys.modules, if it's there. */ -static void -remove_module(const char *name) -{ - PyObject *modules = PyImport_GetModuleDict(); - if (PyDict_GetItemString(modules, name) == NULL) - return; - if (PyDict_DelItemString(modules, name) < 0) - Py_FatalError("import: deleting existing key in" - "sys.modules failed"); -} - -/* Execute a code object in a module and return the module object - * WITH INCREMENTED REFERENCE COUNT. If an error occurs, name is - * removed from sys.modules, to avoid leaving damaged module objects - * in sys.modules. The caller may wish to restore the original - * module object (if any) in this case; PyImport_ReloadModule is an - * example. - */ -PyObject * -PyImport_ExecCodeModule(char *name, PyObject *co) -{ - return PyImport_ExecCodeModuleEx(name, co, (char *)NULL); -} - -PyObject * -PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname) -{ - PyObject *modules = PyImport_GetModuleDict(); - PyObject *m, *d, *v; - - m = PyImport_AddModule(name); - if (m == NULL) - return NULL; - /* If the module is being reloaded, we get the old module back - and re-use its dict to exec the new code. */ - d = PyModule_GetDict(m); - if (PyDict_GetItemString(d, "__builtins__") == NULL) { - if (PyDict_SetItemString(d, "__builtins__", - PyEval_GetBuiltins()) != 0) - goto error; - } - /* Remember the filename as the __file__ attribute */ - v = NULL; - if (pathname != NULL) { - v = PyString_FromString(pathname); - if (v == NULL) - PyErr_Clear(); - } - if (v == NULL) { - v = ((PyCodeObject *)co)->co_filename; - Py_INCREF(v); - } - if (PyDict_SetItemString(d, "__file__", v) != 0) - PyErr_Clear(); /* Not important enough to report */ - Py_DECREF(v); - - v = PyEval_EvalCode((PyCodeObject *)co, d, d); - if (v == NULL) - goto error; - Py_DECREF(v); - - if ((m = PyDict_GetItemString(modules, name)) == NULL) { - PyErr_Format(PyExc_ImportError, - "Loaded module %.200s not found in sys.modules", - name); - return NULL; - } - - Py_INCREF(m); - - return m; - - error: - remove_module(name); - return NULL; -} - - -/* Given a pathname for a Python source file, fill a buffer with the - pathname for the corresponding compiled file. Return the pathname - for the compiled file, or NULL if there's no space in the buffer. - Doesn't set an exception. */ - -static char * -make_compiled_pathname(char *pathname, char *buf, size_t buflen) -{ - size_t len = strlen(pathname); - if (len+2 > buflen) - return NULL; - -#ifdef MS_WINDOWS - /* Treat .pyw as if it were .py. The case of ".pyw" must match - that used in _PyImport_StandardFiletab. */ - if (len >= 4 && strcmp(&pathname[len-4], ".pyw") == 0) - --len; /* pretend 'w' isn't there */ -#endif - memcpy(buf, pathname, len); - buf[len] = Py_OptimizeFlag ? 'o' : 'c'; - buf[len+1] = '\0'; - - return buf; -} - - -/* Given a pathname for a Python source file, its time of last - modification, and a pathname for a compiled file, check whether the - compiled file represents the same version of the source. If so, - return a FILE pointer for the compiled file, positioned just after - the header; if not, return NULL. - Doesn't set an exception. */ - -static FILE * -check_compiled_module(char *pathname, time_t mtime, char *cpathname) -{ - FILE *fp; - long magic; - long pyc_mtime; - - fp = fopen(cpathname, "rb"); - if (fp == NULL) - return NULL; - magic = PyMarshal_ReadLongFromFile(fp); - if (magic != pyc_magic) { - if (Py_VerboseFlag) - PySys_WriteStderr("# %s has bad magic\n", cpathname); - fclose(fp); - return NULL; - } - pyc_mtime = PyMarshal_ReadLongFromFile(fp); - if (pyc_mtime != mtime) { - if (Py_VerboseFlag) - PySys_WriteStderr("# %s has bad mtime\n", cpathname); - fclose(fp); - return NULL; - } - if (Py_VerboseFlag) - PySys_WriteStderr("# %s matches %s\n", cpathname, pathname); - return fp; -} - - -/* Read a code object from a file and check it for validity */ - -static PyCodeObject * -read_compiled_module(char *cpathname, FILE *fp) -{ - PyObject *co; - - co = PyMarshal_ReadLastObjectFromFile(fp); - if (co == NULL) - return NULL; - if (!PyCode_Check(co)) { - PyErr_Format(PyExc_ImportError, - "Non-code object in %.200s", cpathname); - Py_DECREF(co); - return NULL; - } - return (PyCodeObject *)co; -} - - -/* Load a module from a compiled file, execute it, and return its - module object WITH INCREMENTED REFERENCE COUNT */ - -static PyObject * -load_compiled_module(char *name, char *cpathname, FILE *fp) -{ - long magic; - PyCodeObject *co; - PyObject *m; - - magic = PyMarshal_ReadLongFromFile(fp); - if (magic != pyc_magic) { - PyErr_Format(PyExc_ImportError, - "Bad magic number in %.200s", cpathname); - return NULL; - } - (void) PyMarshal_ReadLongFromFile(fp); - co = read_compiled_module(cpathname, fp); - if (co == NULL) - return NULL; - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # precompiled from %s\n", - name, cpathname); - m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, cpathname); - Py_DECREF(co); - - return m; -} - -/* Parse a source file and return the corresponding code object */ - -static PyCodeObject * -parse_source_module(const char *pathname, FILE *fp) -{ - PyCodeObject *co = NULL; - mod_ty mod; - PyCompilerFlags flags; - PyArena *arena = PyArena_New(); - if (arena == NULL) - return NULL; - - flags.cf_flags = 0; - - mod = PyParser_ASTFromFile(fp, pathname, Py_file_input, 0, 0, &flags, - NULL, arena); - if (mod) { - co = PyAST_Compile(mod, pathname, NULL, arena); - } - PyArena_Free(arena); - return co; -} - - -/* Helper to open a bytecode file for writing in exclusive mode */ - -static FILE * -open_exclusive(char *filename, mode_t mode) -{ -#if defined(O_EXCL)&&defined(O_CREAT)&&defined(O_WRONLY)&&defined(O_TRUNC) - /* Use O_EXCL to avoid a race condition when another process tries to - write the same file. When that happens, our open() call fails, - which is just fine (since it's only a cache). - XXX If the file exists and is writable but the directory is not - writable, the file will never be written. Oh well. - */ - int fd; - (void) unlink(filename); - fd = open(filename, O_EXCL|O_CREAT|O_WRONLY|O_TRUNC -#ifdef O_BINARY - |O_BINARY /* necessary for Windows */ -#endif -#ifdef __VMS - , mode, "ctxt=bin", "shr=nil" -#else - , mode -#endif - ); - if (fd < 0) - return NULL; - return fdopen(fd, "wb"); -#else - /* Best we can do -- on Windows this can't happen anyway */ - return fopen(filename, "wb"); -#endif -} - - -/* Write a compiled module to a file, placing the time of last - modification of its source into the header. - Errors are ignored, if a write error occurs an attempt is made to - remove the file. */ - -static void -write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat, time_t mtime) -{ - FILE *fp; -#ifdef MS_WINDOWS /* since Windows uses different permissions */ - mode_t mode = srcstat->st_mode & ~S_IEXEC; - /* Issue #6074: We ensure user write access, so we can delete it later - * when the source file changes. (On POSIX, this only requires write - * access to the directory, on Windows, we need write access to the file - * as well) - */ - mode |= _S_IWRITE; -#else - mode_t mode = srcstat->st_mode & ~S_IXUSR & ~S_IXGRP & ~S_IXOTH; -#endif - - fp = open_exclusive(cpathname, mode); - if (fp == NULL) { - if (Py_VerboseFlag) - PySys_WriteStderr( - "# can't create %s\n", cpathname); - return; - } - PyMarshal_WriteLongToFile(pyc_magic, fp, Py_MARSHAL_VERSION); - /* First write a 0 for mtime */ - PyMarshal_WriteLongToFile(0L, fp, Py_MARSHAL_VERSION); - PyMarshal_WriteObjectToFile((PyObject *)co, fp, Py_MARSHAL_VERSION); - if (fflush(fp) != 0 || ferror(fp)) { - if (Py_VerboseFlag) - PySys_WriteStderr("# can't write %s\n", cpathname); - /* Don't keep partial file */ - fclose(fp); - (void) unlink(cpathname); - return; - } - /* Now write the true mtime (as a 32-bit field) */ - fseek(fp, 4L, 0); - assert(mtime <= 0xFFFFFFFF); - PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION); - fflush(fp); - fclose(fp); - if (Py_VerboseFlag) - PySys_WriteStderr("# wrote %s\n", cpathname); -} - -static void -update_code_filenames(PyCodeObject *co, PyObject *oldname, PyObject *newname) -{ - PyObject *constants, *tmp; - Py_ssize_t i, n; - - if (!_PyString_Eq(co->co_filename, oldname)) - return; - - tmp = co->co_filename; - co->co_filename = newname; - Py_INCREF(co->co_filename); - Py_DECREF(tmp); - - constants = co->co_consts; - n = PyTuple_GET_SIZE(constants); - for (i = 0; i < n; i++) { - tmp = PyTuple_GET_ITEM(constants, i); - if (PyCode_Check(tmp)) - update_code_filenames((PyCodeObject *)tmp, - oldname, newname); - } -} - -static int -update_compiled_module(PyCodeObject *co, char *pathname) -{ - PyObject *oldname, *newname; - - if (strcmp(PyString_AsString(co->co_filename), pathname) == 0) - return 0; - - newname = PyString_FromString(pathname); - if (newname == NULL) - return -1; - - oldname = co->co_filename; - Py_INCREF(oldname); - update_code_filenames(co, oldname, newname); - Py_DECREF(oldname); - Py_DECREF(newname); - return 1; -} - -#ifdef MS_WINDOWS - -/* Seconds between 1.1.1601 and 1.1.1970 */ -static __int64 secs_between_epochs = 11644473600; - -/* Get mtime from file pointer. */ - -static time_t -win32_mtime(FILE *fp, char *pathname) -{ - __int64 filetime; - HANDLE fh; - BY_HANDLE_FILE_INFORMATION file_information; - - fh = (HANDLE)_get_osfhandle(fileno(fp)); - if (fh == INVALID_HANDLE_VALUE || - !GetFileInformationByHandle(fh, &file_information)) { - PyErr_Format(PyExc_RuntimeError, - "unable to get file status from '%s'", - pathname); - return -1; - } - /* filetime represents the number of 100ns intervals since - 1.1.1601 (UTC). Convert to seconds since 1.1.1970 (UTC). */ - filetime = (__int64)file_information.ftLastWriteTime.dwHighDateTime << 32 | - file_information.ftLastWriteTime.dwLowDateTime; - return filetime / 10000000 - secs_between_epochs; -} - -#endif /* #ifdef MS_WINDOWS */ - - -/* Load a source module from a given file and return its module - object WITH INCREMENTED REFERENCE COUNT. If there's a matching - byte-compiled file, use that instead. */ - -static PyObject * -load_source_module(char *name, char *pathname, FILE *fp) -{ - struct stat st; - FILE *fpc; - char *buf; - char *cpathname; - PyCodeObject *co = NULL; - PyObject *m; - time_t mtime; - - if (fstat(fileno(fp), &st) != 0) { - PyErr_Format(PyExc_RuntimeError, - "unable to get file status from '%s'", - pathname); - return NULL; - } - -#ifdef MS_WINDOWS - mtime = win32_mtime(fp, pathname); - if (mtime == (time_t)-1 && PyErr_Occurred()) - return NULL; -#else - mtime = st.st_mtime; -#endif - if (sizeof mtime > 4) { - /* Python's .pyc timestamp handling presumes that the timestamp fits - in 4 bytes. Since the code only does an equality comparison, - ordering is not important and we can safely ignore the higher bits - (collisions are extremely unlikely). - */ - mtime &= 0xFFFFFFFF; - } - buf = PyMem_MALLOC(MAXPATHLEN+1); - if (buf == NULL) { - return PyErr_NoMemory(); - } - cpathname = make_compiled_pathname(pathname, buf, - (size_t)MAXPATHLEN + 1); - if (cpathname != NULL && - (fpc = check_compiled_module(pathname, mtime, cpathname))) { - co = read_compiled_module(cpathname, fpc); - fclose(fpc); - if (co == NULL) - goto error_exit; - if (update_compiled_module(co, pathname) < 0) - goto error_exit; - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # precompiled from %s\n", - name, cpathname); - pathname = cpathname; - } - else { - co = parse_source_module(pathname, fp); - if (co == NULL) - goto error_exit; - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # from %s\n", - name, pathname); - if (cpathname) { - PyObject *ro = PySys_GetObject("dont_write_bytecode"); - int b = (ro == NULL) ? 0 : PyObject_IsTrue(ro); - if (b < 0) - goto error_exit; - if (!b) - write_compiled_module(co, cpathname, &st, mtime); - } - } - m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname); - Py_DECREF(co); - - PyMem_FREE(buf); - return m; - -error_exit: - Py_XDECREF(co); - PyMem_FREE(buf); - return NULL; -} - - -/* Forward */ -static PyObject *load_module(char *, FILE *, char *, int, PyObject *); -static struct filedescr *find_module(char *, char *, PyObject *, - char *, size_t, FILE **, PyObject **); -static struct _frozen *find_frozen(char *name); - -/* Load a package and return its module object WITH INCREMENTED - REFERENCE COUNT */ - -static PyObject * -load_package(char *name, char *pathname) -{ - PyObject *m, *d; - PyObject *file = NULL; - PyObject *path = NULL; - int err; - char *buf = NULL; - FILE *fp = NULL; - struct filedescr *fdp; - - m = PyImport_AddModule(name); - if (m == NULL) - return NULL; - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # directory %s\n", - name, pathname); - d = PyModule_GetDict(m); - file = PyString_FromString(pathname); - if (file == NULL) - goto error; - path = Py_BuildValue("[O]", file); - if (path == NULL) - goto error; - err = PyDict_SetItemString(d, "__file__", file); - if (err == 0) - err = PyDict_SetItemString(d, "__path__", path); - if (err != 0) - goto error; - buf = PyMem_MALLOC(MAXPATHLEN+1); - if (buf == NULL) { - PyErr_NoMemory(); - goto error; - } - buf[0] = '\0'; - fdp = find_module(name, "__init__", path, buf, MAXPATHLEN+1, &fp, NULL); - if (fdp == NULL) { - if (PyErr_ExceptionMatches(PyExc_ImportError)) { - PyErr_Clear(); - Py_INCREF(m); - } - else - m = NULL; - goto cleanup; - } - m = load_module(name, fp, buf, fdp->type, NULL); - if (fp != NULL) - fclose(fp); - goto cleanup; - - error: - m = NULL; - cleanup: - if (buf) - PyMem_FREE(buf); - Py_XDECREF(path); - Py_XDECREF(file); - return m; -} - - -/* Helper to test for built-in module */ - -static int -is_builtin(char *name) -{ - int i; - for (i = 0; PyImport_Inittab[i].name != NULL; i++) { - if (strcmp(name, PyImport_Inittab[i].name) == 0) { - if (PyImport_Inittab[i].initfunc == NULL) - return -1; - else - return 1; - } - } - return 0; -} - - -/* Return an importer object for a sys.path/pkg.__path__ item 'p', - possibly by fetching it from the path_importer_cache dict. If it - wasn't yet cached, traverse path_hooks until a hook is found - that can handle the path item. Return None if no hook could; - this tells our caller it should fall back to the builtin - import mechanism. Cache the result in path_importer_cache. - Returns a borrowed reference. */ - -static PyObject * -get_path_importer(PyObject *path_importer_cache, PyObject *path_hooks, - PyObject *p) -{ - PyObject *importer; - Py_ssize_t j, nhooks; - - /* These conditions are the caller's responsibility: */ - assert(PyList_Check(path_hooks)); - assert(PyDict_Check(path_importer_cache)); - - nhooks = PyList_Size(path_hooks); - if (nhooks < 0) - return NULL; /* Shouldn't happen */ - - importer = PyDict_GetItem(path_importer_cache, p); - if (importer != NULL) - return importer; - - /* set path_importer_cache[p] to None to avoid recursion */ - if (PyDict_SetItem(path_importer_cache, p, Py_None) != 0) - return NULL; - - for (j = 0; j < nhooks; j++) { - PyObject *hook = PyList_GetItem(path_hooks, j); - if (hook == NULL) - return NULL; - importer = PyObject_CallFunctionObjArgs(hook, p, NULL); - if (importer != NULL) - break; - - if (!PyErr_ExceptionMatches(PyExc_ImportError)) { - return NULL; - } - PyErr_Clear(); - } - if (importer == NULL) { - importer = PyObject_CallFunctionObjArgs( - (PyObject *)&PyNullImporter_Type, p, NULL - ); - if (importer == NULL) { - if (PyErr_ExceptionMatches(PyExc_ImportError)) { - PyErr_Clear(); - return Py_None; - } - } - } - if (importer != NULL) { - int err = PyDict_SetItem(path_importer_cache, p, importer); - Py_DECREF(importer); - if (err != 0) - return NULL; - } - return importer; -} - -PyAPI_FUNC(PyObject *) -PyImport_GetImporter(PyObject *path) { - PyObject *importer=NULL, *path_importer_cache=NULL, *path_hooks=NULL; - - if ((path_importer_cache = PySys_GetObject("path_importer_cache"))) { - if ((path_hooks = PySys_GetObject("path_hooks"))) { - importer = get_path_importer(path_importer_cache, - path_hooks, path); - } - } - Py_XINCREF(importer); /* get_path_importer returns a borrowed reference */ - return importer; -} - -/* Search the path (default sys.path) for a module. Return the - corresponding filedescr struct, and (via return arguments) the - pathname and an open file. Return NULL if the module is not found. */ - -#ifdef MS_COREDLL -extern FILE *PyWin_FindRegisteredModule(const char *, struct filedescr **, - char *, Py_ssize_t); -#endif - -static int case_ok(char *, Py_ssize_t, Py_ssize_t, char *); -static int find_init_module(char *); /* Forward */ -static struct filedescr importhookdescr = {"", "", IMP_HOOK}; - -static struct filedescr * -find_module(char *fullname, char *subname, PyObject *path, char *buf, - size_t buflen, FILE **p_fp, PyObject **p_loader) -{ - Py_ssize_t i, npath; - size_t len, namelen; - struct filedescr *fdp = NULL; - char *filemode; - FILE *fp = NULL; - PyObject *path_hooks, *path_importer_cache; - static struct filedescr fd_frozen = {"", "", PY_FROZEN}; - static struct filedescr fd_builtin = {"", "", C_BUILTIN}; - static struct filedescr fd_package = {"", "", PKG_DIRECTORY}; - char *name; -#if defined(PYOS_OS2) - size_t saved_len; - size_t saved_namelen; - char *saved_buf = NULL; -#endif - if (p_loader != NULL) - *p_loader = NULL; - - if (strlen(subname) > MAXPATHLEN) { - PyErr_SetString(PyExc_OverflowError, - "module name is too long"); - return NULL; - } - name = PyMem_MALLOC(MAXPATHLEN+1); - if (name == NULL) { - PyErr_NoMemory(); - return NULL; - } - strcpy(name, subname); - - /* sys.meta_path import hook */ - if (p_loader != NULL) { - PyObject *meta_path; - - meta_path = PySys_GetObject("meta_path"); - if (meta_path == NULL || !PyList_Check(meta_path)) { - PyErr_SetString(PyExc_RuntimeError, - "sys.meta_path must be a list of " - "import hooks"); - goto error_exit; - } - Py_INCREF(meta_path); /* zap guard */ - npath = PyList_Size(meta_path); - for (i = 0; i < npath; i++) { - PyObject *loader; - PyObject *hook = PyList_GetItem(meta_path, i); - loader = PyObject_CallMethod(hook, "find_module", - "sO", fullname, - path != NULL ? - path : Py_None); - if (loader == NULL) { - Py_DECREF(meta_path); - goto error_exit; /* true error */ - } - if (loader != Py_None) { - /* a loader was found */ - *p_loader = loader; - Py_DECREF(meta_path); - PyMem_FREE(name); - return &importhookdescr; - } - Py_DECREF(loader); - } - Py_DECREF(meta_path); - } - - if (path != NULL && PyString_Check(path)) { - /* The only type of submodule allowed inside a "frozen" - package are other frozen modules or packages. */ - if (PyString_Size(path) + 1 + strlen(name) >= (size_t)buflen) { - PyErr_SetString(PyExc_ImportError, - "full frozen module name too long"); - goto error_exit; - } - strcpy(buf, PyString_AsString(path)); - strcat(buf, "."); - strcat(buf, name); - strcpy(name, buf); - if (find_frozen(name) != NULL) { - strcpy(buf, name); - PyMem_FREE(name); - return &fd_frozen; - } - PyErr_Format(PyExc_ImportError, - "No frozen submodule named %.200s", name); - goto error_exit; - } - if (path == NULL) { - if (is_builtin(name)) { - strcpy(buf, name); - PyMem_FREE(name); - return &fd_builtin; - } - if ((find_frozen(name)) != NULL) { - strcpy(buf, name); - PyMem_FREE(name); - return &fd_frozen; - } - -#ifdef MS_COREDLL - fp = PyWin_FindRegisteredModule(name, &fdp, buf, buflen); - if (fp != NULL) { - *p_fp = fp; - PyMem_FREE(name); - return fdp; - } -#endif - path = PySys_GetObject("path"); - } - if (path == NULL || !PyList_Check(path)) { - PyErr_SetString(PyExc_RuntimeError, - "sys.path must be a list of directory names"); - goto error_exit; - } - - path_hooks = PySys_GetObject("path_hooks"); - if (path_hooks == NULL || !PyList_Check(path_hooks)) { - PyErr_SetString(PyExc_RuntimeError, - "sys.path_hooks must be a list of " - "import hooks"); - goto error_exit; - } - path_importer_cache = PySys_GetObject("path_importer_cache"); - if (path_importer_cache == NULL || - !PyDict_Check(path_importer_cache)) { - PyErr_SetString(PyExc_RuntimeError, - "sys.path_importer_cache must be a dict"); - goto error_exit; - } - - npath = PyList_Size(path); - namelen = strlen(name); - for (i = 0; i < npath; i++) { - PyObject *copy = NULL; - PyObject *v = PyList_GetItem(path, i); - if (!v) - goto error_exit; -#ifdef Py_USING_UNICODE - if (PyUnicode_Check(v)) { - copy = PyUnicode_Encode(PyUnicode_AS_UNICODE(v), - PyUnicode_GET_SIZE(v), Py_FileSystemDefaultEncoding, NULL); - if (copy == NULL) - goto error_exit; - v = copy; - } - else -#endif - if (!PyString_Check(v)) - continue; - len = PyString_GET_SIZE(v); - if (len + 2 + namelen + MAXSUFFIXSIZE >= buflen) { - Py_XDECREF(copy); - continue; /* Too long */ - } - strcpy(buf, PyString_AS_STRING(v)); - if (strlen(buf) != len) { - Py_XDECREF(copy); - continue; /* v contains '\0' */ - } - - /* sys.path_hooks import hook */ - if (p_loader != NULL) { - PyObject *importer; - - importer = get_path_importer(path_importer_cache, - path_hooks, v); - if (importer == NULL) { - Py_XDECREF(copy); - goto error_exit; - } - /* Note: importer is a borrowed reference */ - if (importer != Py_None) { - PyObject *loader; - loader = PyObject_CallMethod(importer, - "find_module", - "s", fullname); - Py_XDECREF(copy); - if (loader == NULL) - goto error_exit; /* error */ - if (loader != Py_None) { - /* a loader was found */ - *p_loader = loader; - PyMem_FREE(name); - return &importhookdescr; - } - Py_DECREF(loader); - continue; - } - } - /* no hook was found, use builtin import */ - - if (len > 0 && buf[len-1] != SEP -#ifdef ALTSEP - && buf[len-1] != ALTSEP -#endif - ) - buf[len++] = SEP; - strcpy(buf+len, name); - len += namelen; - - /* Check for package import (buf holds a directory name, - and there's an __init__ module in that directory */ - if (isdir(buf) && /* it's an existing directory */ - case_ok(buf, len, namelen, name)) { /* case matches */ - if (find_init_module(buf)) { /* and has __init__.py */ - Py_XDECREF(copy); - PyMem_FREE(name); - return &fd_package; - } - else { - char warnstr[MAXPATHLEN+80]; - sprintf(warnstr, "Not importing directory " - "'%.*s': missing __init__.py", - MAXPATHLEN, buf); - if (PyErr_Warn(PyExc_ImportWarning, - warnstr)) { - Py_XDECREF(copy); - goto error_exit; - } - } - } -#if defined(PYOS_OS2) - /* take a snapshot of the module spec for restoration - * after the 8 character DLL hackery - */ - saved_buf = strdup(buf); - saved_len = len; - saved_namelen = namelen; -#endif /* PYOS_OS2 */ - for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { -#if defined(PYOS_OS2) && defined(HAVE_DYNAMIC_LOADING) - /* OS/2 limits DLLs to 8 character names (w/o - extension) - * so if the name is longer than that and its a - * dynamically loaded module we're going to try, - * truncate the name before trying - */ - if (strlen(subname) > 8) { - /* is this an attempt to load a C extension? */ - const struct filedescr *scan; - scan = _PyImport_DynLoadFiletab; - while (scan->suffix != NULL) { - if (!strcmp(scan->suffix, fdp->suffix)) - break; - else - scan++; - } - if (scan->suffix != NULL) { - /* yes, so truncate the name */ - namelen = 8; - len -= strlen(subname) - namelen; - buf[len] = '\0'; - } - } -#endif /* PYOS_OS2 */ - strcpy(buf+len, fdp->suffix); - if (Py_VerboseFlag > 1) - PySys_WriteStderr("# trying %s\n", buf); - filemode = fdp->mode; - if (filemode[0] == 'U') - filemode = "r" PY_STDIOTEXTMODE; - fp = fopen(buf, filemode); - if (fp != NULL) { - if (case_ok(buf, len, namelen, name)) - break; - else { /* continue search */ - fclose(fp); - fp = NULL; - } - } -#if defined(PYOS_OS2) - /* restore the saved snapshot */ - strcpy(buf, saved_buf); - len = saved_len; - namelen = saved_namelen; -#endif - } -#if defined(PYOS_OS2) - /* don't need/want the module name snapshot anymore */ - if (saved_buf) - { - free(saved_buf); - saved_buf = NULL; - } -#endif - Py_XDECREF(copy); - if (fp != NULL) - break; - } - if (fp == NULL) { - PyErr_Format(PyExc_ImportError, - "No module named %.200s", name); - goto error_exit; - } - *p_fp = fp; - PyMem_FREE(name); - return fdp; - -error_exit: - PyMem_FREE(name); - return NULL; -} - -/* Helpers for main.c - * Find the source file corresponding to a named module - */ -struct filedescr * -_PyImport_FindModule(const char *name, PyObject *path, char *buf, - size_t buflen, FILE **p_fp, PyObject **p_loader) -{ - return find_module((char *) name, (char *) name, path, - buf, buflen, p_fp, p_loader); -} - -PyAPI_FUNC(int) _PyImport_IsScript(struct filedescr * fd) -{ - return fd->type == PY_SOURCE || fd->type == PY_COMPILED; -} - -/* case_ok(char* buf, Py_ssize_t len, Py_ssize_t namelen, char* name) - * The arguments here are tricky, best shown by example: - * /a/b/c/d/e/f/g/h/i/j/k/some_long_module_name.py\0 - * ^ ^ ^ ^ - * |--------------------- buf ---------------------| - * |------------------- len ------------------| - * |------ name -------| - * |----- namelen -----| - * buf is the full path, but len only counts up to (& exclusive of) the - * extension. name is the module name, also exclusive of extension. - * - * We've already done a successful stat() or fopen() on buf, so know that - * there's some match, possibly case-insensitive. - * - * case_ok() is to return 1 if there's a case-sensitive match for - * name, else 0. case_ok() is also to return 1 if envar PYTHONCASEOK - * exists. - * - * case_ok() is used to implement case-sensitive import semantics even - * on platforms with case-insensitive filesystems. It's trivial to implement - * for case-sensitive filesystems. It's pretty much a cross-platform - * nightmare for systems with case-insensitive filesystems. - */ - -/* First we may need a pile of platform-specific header files; the sequence - * of #if's here should match the sequence in the body of case_ok(). - */ -#if defined(MS_WINDOWS) -#include - -#elif defined(DJGPP) -#include - -#elif (defined(__MACH__) && defined(__APPLE__) || defined(__CYGWIN__)) && defined(HAVE_DIRENT_H) -#include -#include - -#elif defined(PYOS_OS2) -#define INCL_DOS -#define INCL_DOSERRORS -#define INCL_NOPMAPI -#include - -#elif defined(RISCOS) -#include "oslib/osfscontrol.h" -#endif - -static int -case_ok(char *buf, Py_ssize_t len, Py_ssize_t namelen, char *name) -{ -/* Pick a platform-specific implementation; the sequence of #if's here should - * match the sequence just above. - */ - -/* MS_WINDOWS */ -#if defined(MS_WINDOWS) - WIN32_FIND_DATA data; - HANDLE h; - - if (Py_GETENV("PYTHONCASEOK") != NULL) - return 1; - - h = FindFirstFile(buf, &data); - if (h == INVALID_HANDLE_VALUE) { - PyErr_Format(PyExc_NameError, - "Can't find file for module %.100s\n(filename %.300s)", - name, buf); - return 0; - } - FindClose(h); - return strncmp(data.cFileName, name, namelen) == 0; - -/* DJGPP */ -#elif defined(DJGPP) - struct ffblk ffblk; - int done; - - if (Py_GETENV("PYTHONCASEOK") != NULL) - return 1; - - done = findfirst(buf, &ffblk, FA_ARCH|FA_RDONLY|FA_HIDDEN|FA_DIREC); - if (done) { - PyErr_Format(PyExc_NameError, - "Can't find file for module %.100s\n(filename %.300s)", - name, buf); - return 0; - } - return strncmp(ffblk.ff_name, name, namelen) == 0; - -/* new-fangled macintosh (macosx) or Cygwin */ -#elif (defined(__MACH__) && defined(__APPLE__) || defined(__CYGWIN__)) && defined(HAVE_DIRENT_H) - DIR *dirp; - struct dirent *dp; - char dirname[MAXPATHLEN + 1]; - const int dirlen = len - namelen - 1; /* don't want trailing SEP */ - - if (Py_GETENV("PYTHONCASEOK") != NULL) - return 1; - - /* Copy the dir component into dirname; substitute "." if empty */ - if (dirlen <= 0) { - dirname[0] = '.'; - dirname[1] = '\0'; - } - else { - assert(dirlen <= MAXPATHLEN); - memcpy(dirname, buf, dirlen); - dirname[dirlen] = '\0'; - } - /* Open the directory and search the entries for an exact match. */ - dirp = opendir(dirname); - if (dirp) { - char *nameWithExt = buf + len - namelen; - while ((dp = readdir(dirp)) != NULL) { - const int thislen = -#ifdef _DIRENT_HAVE_D_NAMELEN - dp->d_namlen; -#else - strlen(dp->d_name); -#endif - if (thislen >= namelen && - strcmp(dp->d_name, nameWithExt) == 0) { - (void)closedir(dirp); - return 1; /* Found */ - } - } - (void)closedir(dirp); - } - return 0 ; /* Not found */ - -/* RISC OS */ -#elif defined(RISCOS) - char canon[MAXPATHLEN+1]; /* buffer for the canonical form of the path */ - char buf2[MAXPATHLEN+2]; - char *nameWithExt = buf+len-namelen; - int canonlen; - os_error *e; - - if (Py_GETENV("PYTHONCASEOK") != NULL) - return 1; - - /* workaround: - append wildcard, otherwise case of filename wouldn't be touched */ - strcpy(buf2, buf); - strcat(buf2, "*"); - - e = xosfscontrol_canonicalise_path(buf2,canon,0,0,MAXPATHLEN+1,&canonlen); - canonlen = MAXPATHLEN+1-canonlen; - if (e || canonlen<=0 || canonlen>(MAXPATHLEN+1) ) - return 0; - if (strcmp(nameWithExt, canon+canonlen-strlen(nameWithExt))==0) - return 1; /* match */ - - return 0; - -/* OS/2 */ -#elif defined(PYOS_OS2) - HDIR hdir = 1; - ULONG srchcnt = 1; - FILEFINDBUF3 ffbuf; - APIRET rc; - - if (Py_GETENV("PYTHONCASEOK") != NULL) - return 1; - - rc = DosFindFirst(buf, - &hdir, - FILE_READONLY | FILE_HIDDEN | FILE_SYSTEM | FILE_DIRECTORY, - &ffbuf, sizeof(ffbuf), - &srchcnt, - FIL_STANDARD); - if (rc != NO_ERROR) - return 0; - return strncmp(ffbuf.achName, name, namelen) == 0; - -/* assuming it's a case-sensitive filesystem, so there's nothing to do! */ -#else - return 1; - -#endif -} - - -#ifdef HAVE_STAT -/* Helper to look for __init__.py or __init__.py[co] in potential package */ -static int -find_init_module(char *buf) -{ - const size_t save_len = strlen(buf); - size_t i = save_len; - char *pname; /* pointer to start of __init__ */ - struct stat statbuf; - -/* For calling case_ok(buf, len, namelen, name): - * /a/b/c/d/e/f/g/h/i/j/k/some_long_module_name.py\0 - * ^ ^ ^ ^ - * |--------------------- buf ---------------------| - * |------------------- len ------------------| - * |------ name -------| - * |----- namelen -----| - */ - if (save_len + 13 >= MAXPATHLEN) - return 0; - buf[i++] = SEP; - pname = buf + i; - strcpy(pname, "__init__.py"); - if (stat(buf, &statbuf) == 0) { - if (case_ok(buf, - save_len + 9, /* len("/__init__") */ - 8, /* len("__init__") */ - pname)) { - buf[save_len] = '\0'; - return 1; - } - } - i += strlen(pname); - strcpy(buf+i, Py_OptimizeFlag ? "o" : "c"); - if (stat(buf, &statbuf) == 0) { - if (case_ok(buf, - save_len + 9, /* len("/__init__") */ - 8, /* len("__init__") */ - pname)) { - buf[save_len] = '\0'; - return 1; - } - } - buf[save_len] = '\0'; - return 0; -} - -#else - -#ifdef RISCOS -static int -find_init_module(buf) - char *buf; -{ - int save_len = strlen(buf); - int i = save_len; - - if (save_len + 13 >= MAXPATHLEN) - return 0; - buf[i++] = SEP; - strcpy(buf+i, "__init__/py"); - if (isfile(buf)) { - buf[save_len] = '\0'; - return 1; - } - - if (Py_OptimizeFlag) - strcpy(buf+i, "o"); - else - strcpy(buf+i, "c"); - if (isfile(buf)) { - buf[save_len] = '\0'; - return 1; - } - buf[save_len] = '\0'; - return 0; -} -#endif /*RISCOS*/ - -#endif /* HAVE_STAT */ - - -static int init_builtin(char *); /* Forward */ - -/* Load an external module using the default search path and return - its module object WITH INCREMENTED REFERENCE COUNT */ - -static PyObject * -load_module(char *name, FILE *fp, char *pathname, int type, PyObject *loader) -{ - PyObject *modules; - PyObject *m; - int err; - - /* First check that there's an open file (if we need one) */ - switch (type) { - case PY_SOURCE: - case PY_COMPILED: - if (fp == NULL) { - PyErr_Format(PyExc_ValueError, - "file object required for import (type code %d)", - type); - return NULL; - } - } - - switch (type) { - - case PY_SOURCE: - m = load_source_module(name, pathname, fp); - break; - - case PY_COMPILED: - m = load_compiled_module(name, pathname, fp); - break; - -#ifdef HAVE_DYNAMIC_LOADING - case C_EXTENSION: - m = _PyImport_LoadDynamicModule(name, pathname, fp); - break; -#endif - - case PKG_DIRECTORY: - m = load_package(name, pathname); - break; - - case C_BUILTIN: - case PY_FROZEN: - if (pathname != NULL && pathname[0] != '\0') - name = pathname; - if (type == C_BUILTIN) - err = init_builtin(name); - else - err = PyImport_ImportFrozenModule(name); - if (err < 0) - return NULL; - if (err == 0) { - PyErr_Format(PyExc_ImportError, - "Purported %s module %.200s not found", - type == C_BUILTIN ? - "builtin" : "frozen", - name); - return NULL; - } - modules = PyImport_GetModuleDict(); - m = PyDict_GetItemString(modules, name); - if (m == NULL) { - PyErr_Format( - PyExc_ImportError, - "%s module %.200s not properly initialized", - type == C_BUILTIN ? - "builtin" : "frozen", - name); - return NULL; - } - Py_INCREF(m); - break; - - case IMP_HOOK: { - if (loader == NULL) { - PyErr_SetString(PyExc_ImportError, - "import hook without loader"); - return NULL; - } - m = PyObject_CallMethod(loader, "load_module", "s", name); - break; - } - - default: - PyErr_Format(PyExc_ImportError, - "Don't know how to import %.200s (type code %d)", - name, type); - m = NULL; - - } - - return m; -} - - -/* Initialize a built-in module. - Return 1 for success, 0 if the module is not found, and -1 with - an exception set if the initialization failed. */ - -static int -init_builtin(char *name) -{ - struct _inittab *p; - - if (_PyImport_FindExtension(name, name) != NULL) - return 1; - - for (p = PyImport_Inittab; p->name != NULL; p++) { - if (strcmp(name, p->name) == 0) { - if (p->initfunc == NULL) { - PyErr_Format(PyExc_ImportError, - "Cannot re-init internal module %.200s", - name); - return -1; - } - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # builtin\n", name); - (*p->initfunc)(); - if (PyErr_Occurred()) - return -1; - if (_PyImport_FixupExtension(name, name) == NULL) - return -1; - return 1; - } - } - return 0; -} - - -/* Frozen modules */ - -static struct _frozen * -find_frozen(char *name) -{ - struct _frozen *p; - - for (p = PyImport_FrozenModules; ; p++) { - if (p->name == NULL) - return NULL; - if (strcmp(p->name, name) == 0) - break; - } - return p; -} - -static PyObject * -get_frozen_object(char *name) -{ - struct _frozen *p = find_frozen(name); - int size; - - if (p == NULL) { - PyErr_Format(PyExc_ImportError, - "No such frozen object named %.200s", - name); - return NULL; - } - if (p->code == NULL) { - PyErr_Format(PyExc_ImportError, - "Excluded frozen object named %.200s", - name); - return NULL; - } - size = p->size; - if (size < 0) - size = -size; - return PyMarshal_ReadObjectFromString((char *)p->code, size); -} - -/* Initialize a frozen module. - Return 1 for succes, 0 if the module is not found, and -1 with - an exception set if the initialization failed. - This function is also used from frozenmain.c */ - -int -PyImport_ImportFrozenModule(char *name) -{ - struct _frozen *p = find_frozen(name); - PyObject *co; - PyObject *m; - int ispackage; - int size; - - if (p == NULL) - return 0; - if (p->code == NULL) { - PyErr_Format(PyExc_ImportError, - "Excluded frozen object named %.200s", - name); - return -1; - } - size = p->size; - ispackage = (size < 0); - if (ispackage) - size = -size; - if (Py_VerboseFlag) - PySys_WriteStderr("import %s # frozen%s\n", - name, ispackage ? " package" : ""); - co = PyMarshal_ReadObjectFromString((char *)p->code, size); - if (co == NULL) - return -1; - if (!PyCode_Check(co)) { - PyErr_Format(PyExc_TypeError, - "frozen object %.200s is not a code object", - name); - goto err_return; - } - if (ispackage) { - /* Set __path__ to the package name */ - PyObject *d, *s; - int err; - m = PyImport_AddModule(name); - if (m == NULL) - goto err_return; - d = PyModule_GetDict(m); - s = PyString_InternFromString(name); - if (s == NULL) - goto err_return; - err = PyDict_SetItemString(d, "__path__", s); - Py_DECREF(s); - if (err != 0) - goto err_return; - } - m = PyImport_ExecCodeModuleEx(name, co, ""); - if (m == NULL) - goto err_return; - Py_DECREF(co); - Py_DECREF(m); - return 1; -err_return: - Py_DECREF(co); - return -1; -} - - -/* Import a module, either built-in, frozen, or external, and return - its module object WITH INCREMENTED REFERENCE COUNT */ - -PyObject * -PyImport_ImportModule(const char *name) -{ - PyObject *pname; - PyObject *result; - - pname = PyString_FromString(name); - if (pname == NULL) - return NULL; - result = PyImport_Import(pname); - Py_DECREF(pname); - return result; -} - -/* Import a module without blocking - * - * At first it tries to fetch the module from sys.modules. If the module was - * never loaded before it loads it with PyImport_ImportModule() unless another - * thread holds the import lock. In the latter case the function raises an - * ImportError instead of blocking. - * - * Returns the module object with incremented ref count. - */ -PyObject * -PyImport_ImportModuleNoBlock(const char *name) -{ - PyObject *result; - PyObject *modules; -#ifdef WITH_THREAD - long me; -#endif - - /* Try to get the module from sys.modules[name] */ - modules = PyImport_GetModuleDict(); - if (modules == NULL) - return NULL; - - result = PyDict_GetItemString(modules, name); - if (result != NULL) { - Py_INCREF(result); - return result; - } - else { - PyErr_Clear(); - } -#ifdef WITH_THREAD - /* check the import lock - * me might be -1 but I ignore the error here, the lock function - * takes care of the problem */ - me = PyThread_get_thread_ident(); - if (import_lock_thread == -1 || import_lock_thread == me) { - /* no thread or me is holding the lock */ - return PyImport_ImportModule(name); - } - else { - PyErr_Format(PyExc_ImportError, - "Failed to import %.200s because the import lock" - "is held by another thread.", - name); - return NULL; - } -#else - return PyImport_ImportModule(name); -#endif -} - -/* Forward declarations for helper routines */ -static PyObject *get_parent(PyObject *globals, char *buf, - Py_ssize_t *p_buflen, int level); -static PyObject *load_next(PyObject *mod, PyObject *altmod, - char **p_name, char *buf, Py_ssize_t *p_buflen); -static int mark_miss(char *name); -static int ensure_fromlist(PyObject *mod, PyObject *fromlist, - char *buf, Py_ssize_t buflen, int recursive); -static PyObject * import_submodule(PyObject *mod, char *name, char *fullname); - -/* The Magnum Opus of dotted-name import :-) */ - -static PyObject * -import_module_level(char *name, PyObject *globals, PyObject *locals, - PyObject *fromlist, int level) -{ - char *buf; - Py_ssize_t buflen = 0; - PyObject *parent, *head, *next, *tail; - - if (strchr(name, '/') != NULL -#ifdef MS_WINDOWS - || strchr(name, '\\') != NULL -#endif - ) { - PyErr_SetString(PyExc_ImportError, - "Import by filename is not supported."); - return NULL; - } - - buf = PyMem_MALLOC(MAXPATHLEN+1); - if (buf == NULL) { - return PyErr_NoMemory(); - } - parent = get_parent(globals, buf, &buflen, level); - if (parent == NULL) - goto error_exit; - - head = load_next(parent, level < 0 ? Py_None : parent, &name, buf, - &buflen); - if (head == NULL) - goto error_exit; - - tail = head; - Py_INCREF(tail); - while (name) { - next = load_next(tail, tail, &name, buf, &buflen); - Py_DECREF(tail); - if (next == NULL) { - Py_DECREF(head); - goto error_exit; - } - tail = next; - } - if (tail == Py_None) { - /* If tail is Py_None, both get_parent and load_next found - an empty module name: someone called __import__("") or - doctored faulty bytecode */ - Py_DECREF(tail); - Py_DECREF(head); - PyErr_SetString(PyExc_ValueError, - "Empty module name"); - goto error_exit; - } - - if (fromlist != NULL) { - int b = (fromlist == Py_None) ? 0 : PyObject_IsTrue(fromlist); - if (b < 0) { - Py_DECREF(tail); - Py_DECREF(head); - goto error_exit; - } - if (!b) - fromlist = NULL; - } - - if (fromlist == NULL) { - Py_DECREF(tail); - PyMem_FREE(buf); - return head; - } - - Py_DECREF(head); - if (!ensure_fromlist(tail, fromlist, buf, buflen, 0)) { - Py_DECREF(tail); - goto error_exit; - } - - PyMem_FREE(buf); - return tail; - -error_exit: - PyMem_FREE(buf); - return NULL; -} - -PyObject * -PyImport_ImportModuleLevel(char *name, PyObject *globals, PyObject *locals, - PyObject *fromlist, int level) -{ - PyObject *result; - _PyImport_AcquireLock(); - result = import_module_level(name, globals, locals, fromlist, level); - if (_PyImport_ReleaseLock() < 0) { - Py_XDECREF(result); - PyErr_SetString(PyExc_RuntimeError, - "not holding the import lock"); - return NULL; - } - return result; -} - -/* Return the package that an import is being performed in. If globals comes - from the module foo.bar.bat (not itself a package), this returns the - sys.modules entry for foo.bar. If globals is from a package's __init__.py, - the package's entry in sys.modules is returned, as a borrowed reference. - - The *name* of the returned package is returned in buf, with the length of - the name in *p_buflen. - - If globals doesn't come from a package or a module in a package, or a - corresponding entry is not found in sys.modules, Py_None is returned. -*/ -static PyObject * -get_parent(PyObject *globals, char *buf, Py_ssize_t *p_buflen, int level) -{ - static PyObject *namestr = NULL; - static PyObject *pathstr = NULL; - static PyObject *pkgstr = NULL; - PyObject *pkgname, *modname, *modpath, *modules, *parent; - int orig_level = level; - - if (globals == NULL || !PyDict_Check(globals) || !level) - return Py_None; - - if (namestr == NULL) { - namestr = PyString_InternFromString("__name__"); - if (namestr == NULL) - return NULL; - } - if (pathstr == NULL) { - pathstr = PyString_InternFromString("__path__"); - if (pathstr == NULL) - return NULL; - } - if (pkgstr == NULL) { - pkgstr = PyString_InternFromString("__package__"); - if (pkgstr == NULL) - return NULL; - } - - *buf = '\0'; - *p_buflen = 0; - pkgname = PyDict_GetItem(globals, pkgstr); - - if ((pkgname != NULL) && (pkgname != Py_None)) { - /* __package__ is set, so use it */ - Py_ssize_t len; - if (!PyString_Check(pkgname)) { - PyErr_SetString(PyExc_ValueError, - "__package__ set to non-string"); - return NULL; - } - len = PyString_GET_SIZE(pkgname); - if (len == 0) { - if (level > 0) { - PyErr_SetString(PyExc_ValueError, - "Attempted relative import in non-package"); - return NULL; - } - return Py_None; - } - if (len > MAXPATHLEN) { - PyErr_SetString(PyExc_ValueError, - "Package name too long"); - return NULL; - } - strcpy(buf, PyString_AS_STRING(pkgname)); - } else { - /* __package__ not set, so figure it out and set it */ - modname = PyDict_GetItem(globals, namestr); - if (modname == NULL || !PyString_Check(modname)) - return Py_None; - - modpath = PyDict_GetItem(globals, pathstr); - if (modpath != NULL) { - /* __path__ is set, so modname is already the package name */ - Py_ssize_t len = PyString_GET_SIZE(modname); - int error; - if (len > MAXPATHLEN) { - PyErr_SetString(PyExc_ValueError, - "Module name too long"); - return NULL; - } - strcpy(buf, PyString_AS_STRING(modname)); - error = PyDict_SetItem(globals, pkgstr, modname); - if (error) { - PyErr_SetString(PyExc_ValueError, - "Could not set __package__"); - return NULL; - } - } else { - /* Normal module, so work out the package name if any */ - char *start = PyString_AS_STRING(modname); - char *lastdot = strrchr(start, '.'); - size_t len; - int error; - if (lastdot == NULL && level > 0) { - PyErr_SetString(PyExc_ValueError, - "Attempted relative import in non-package"); - return NULL; - } - if (lastdot == NULL) { - error = PyDict_SetItem(globals, pkgstr, Py_None); - if (error) { - PyErr_SetString(PyExc_ValueError, - "Could not set __package__"); - return NULL; - } - return Py_None; - } - len = lastdot - start; - if (len >= MAXPATHLEN) { - PyErr_SetString(PyExc_ValueError, - "Module name too long"); - return NULL; - } - strncpy(buf, start, len); - buf[len] = '\0'; - pkgname = PyString_FromString(buf); - if (pkgname == NULL) { - return NULL; - } - error = PyDict_SetItem(globals, pkgstr, pkgname); - Py_DECREF(pkgname); - if (error) { - PyErr_SetString(PyExc_ValueError, - "Could not set __package__"); - return NULL; - } - } - } - while (--level > 0) { - char *dot = strrchr(buf, '.'); - if (dot == NULL) { - PyErr_SetString(PyExc_ValueError, - "Attempted relative import beyond " - "toplevel package"); - return NULL; - } - *dot = '\0'; - } - *p_buflen = strlen(buf); - - modules = PyImport_GetModuleDict(); - parent = PyDict_GetItemString(modules, buf); - if (parent == NULL) { - if (orig_level < 1) { - PyObject *err_msg = PyString_FromFormat( - "Parent module '%.200s' not found " - "while handling absolute import", buf); - if (err_msg == NULL) { - return NULL; - } - if (!PyErr_WarnEx(PyExc_RuntimeWarning, - PyString_AsString(err_msg), 1)) { - *buf = '\0'; - *p_buflen = 0; - parent = Py_None; - } - Py_DECREF(err_msg); - } else { - PyErr_Format(PyExc_SystemError, - "Parent module '%.200s' not loaded, " - "cannot perform relative import", buf); - } - } - return parent; - /* We expect, but can't guarantee, if parent != None, that: - - parent.__name__ == buf - - parent.__dict__ is globals - If this is violated... Who cares? */ -} - -/* altmod is either None or same as mod */ -static PyObject * -load_next(PyObject *mod, PyObject *altmod, char **p_name, char *buf, - Py_ssize_t *p_buflen) -{ - char *name = *p_name; - char *dot = strchr(name, '.'); - size_t len; - char *p; - PyObject *result; - - if (strlen(name) == 0) { - /* completely empty module name should only happen in - 'from . import' (or '__import__("")')*/ - Py_INCREF(mod); - *p_name = NULL; - return mod; - } - - if (dot == NULL) { - *p_name = NULL; - len = strlen(name); - } - else { - *p_name = dot+1; - len = dot-name; - } - if (len == 0) { - PyErr_SetString(PyExc_ValueError, - "Empty module name"); - return NULL; - } - - p = buf + *p_buflen; - if (p != buf) - *p++ = '.'; - if (p+len-buf >= MAXPATHLEN) { - PyErr_SetString(PyExc_ValueError, - "Module name too long"); - return NULL; - } - strncpy(p, name, len); - p[len] = '\0'; - *p_buflen = p+len-buf; - - result = import_submodule(mod, p, buf); - if (result == Py_None && altmod != mod) { - Py_DECREF(result); - /* Here, altmod must be None and mod must not be None */ - result = import_submodule(altmod, p, p); - if (result != NULL && result != Py_None) { - if (mark_miss(buf) != 0) { - Py_DECREF(result); - return NULL; - } - strncpy(buf, name, len); - buf[len] = '\0'; - *p_buflen = len; - } - } - if (result == NULL) - return NULL; - - if (result == Py_None) { - Py_DECREF(result); - PyErr_Format(PyExc_ImportError, - "No module named %.200s", name); - return NULL; - } - - return result; -} - -static int -mark_miss(char *name) -{ - PyObject *modules = PyImport_GetModuleDict(); - return PyDict_SetItemString(modules, name, Py_None); -} - -static int -ensure_fromlist(PyObject *mod, PyObject *fromlist, char *buf, Py_ssize_t buflen, - int recursive) -{ - int i; - - if (!PyObject_HasAttrString(mod, "__path__")) - return 1; - - for (i = 0; ; i++) { - PyObject *item = PySequence_GetItem(fromlist, i); - int hasit; - if (item == NULL) { - if (PyErr_ExceptionMatches(PyExc_IndexError)) { - PyErr_Clear(); - return 1; - } - return 0; - } - if (!PyString_Check(item)) { - PyErr_SetString(PyExc_TypeError, - "Item in ``from list'' not a string"); - Py_DECREF(item); - return 0; - } - if (PyString_AS_STRING(item)[0] == '*') { - PyObject *all; - Py_DECREF(item); - /* See if the package defines __all__ */ - if (recursive) - continue; /* Avoid endless recursion */ - all = PyObject_GetAttrString(mod, "__all__"); - if (all == NULL) - PyErr_Clear(); - else { - int ret = ensure_fromlist(mod, all, buf, buflen, 1); - Py_DECREF(all); - if (!ret) - return 0; - } - continue; - } - hasit = PyObject_HasAttr(mod, item); - if (!hasit) { - char *subname = PyString_AS_STRING(item); - PyObject *submod; - char *p; - if (buflen + strlen(subname) >= MAXPATHLEN) { - PyErr_SetString(PyExc_ValueError, - "Module name too long"); - Py_DECREF(item); - return 0; - } - p = buf + buflen; - *p++ = '.'; - strcpy(p, subname); - submod = import_submodule(mod, subname, buf); - Py_XDECREF(submod); - if (submod == NULL) { - Py_DECREF(item); - return 0; - } - } - Py_DECREF(item); - } - - /* NOTREACHED */ -} - -static int -add_submodule(PyObject *mod, PyObject *submod, char *fullname, char *subname, - PyObject *modules) -{ - if (mod == Py_None) - return 1; - /* Irrespective of the success of this load, make a - reference to it in the parent package module. A copy gets - saved in the modules dictionary under the full name, so get a - reference from there, if need be. (The exception is when the - load failed with a SyntaxError -- then there's no trace in - sys.modules. In that case, of course, do nothing extra.) */ - if (submod == NULL) { - submod = PyDict_GetItemString(modules, fullname); - if (submod == NULL) - return 1; - } - if (PyModule_Check(mod)) { - /* We can't use setattr here since it can give a - * spurious warning if the submodule name shadows a - * builtin name */ - PyObject *dict = PyModule_GetDict(mod); - if (!dict) - return 0; - if (PyDict_SetItemString(dict, subname, submod) < 0) - return 0; - } - else { - if (PyObject_SetAttrString(mod, subname, submod) < 0) - return 0; - } - return 1; -} - -static PyObject * -import_submodule(PyObject *mod, char *subname, char *fullname) -{ - PyObject *modules = PyImport_GetModuleDict(); - PyObject *m = NULL; - - /* Require: - if mod == None: subname == fullname - else: mod.__name__ + "." + subname == fullname - */ - - if ((m = PyDict_GetItemString(modules, fullname)) != NULL) { - Py_INCREF(m); - } - else { - PyObject *path, *loader = NULL; - char *buf; - struct filedescr *fdp; - FILE *fp = NULL; - - if (mod == Py_None) - path = NULL; - else { - path = PyObject_GetAttrString(mod, "__path__"); - if (path == NULL) { - PyErr_Clear(); - Py_INCREF(Py_None); - return Py_None; - } - } - - buf = PyMem_MALLOC(MAXPATHLEN+1); - if (buf == NULL) { - return PyErr_NoMemory(); - } - buf[0] = '\0'; - fdp = find_module(fullname, subname, path, buf, MAXPATHLEN+1, - &fp, &loader); - Py_XDECREF(path); - if (fdp == NULL) { - PyMem_FREE(buf); - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - return NULL; - PyErr_Clear(); - Py_INCREF(Py_None); - return Py_None; - } - m = load_module(fullname, fp, buf, fdp->type, loader); - Py_XDECREF(loader); - if (fp) - fclose(fp); - if (!add_submodule(mod, m, fullname, subname, modules)) { - Py_XDECREF(m); - m = NULL; - } - PyMem_FREE(buf); - } - - return m; -} - - -/* Re-import a module of any kind and return its module object, WITH - INCREMENTED REFERENCE COUNT */ - -PyObject * -PyImport_ReloadModule(PyObject *m) -{ - PyInterpreterState *interp = PyThreadState_Get()->interp; - PyObject *modules_reloading = interp->modules_reloading; - PyObject *modules = PyImport_GetModuleDict(); - PyObject *path = NULL, *loader = NULL, *existing_m = NULL; - char *name, *subname; - char *buf; - struct filedescr *fdp; - FILE *fp = NULL; - PyObject *newm; - - if (modules_reloading == NULL) { - Py_FatalError("PyImport_ReloadModule: " - "no modules_reloading dictionary!"); - return NULL; - } - - if (m == NULL || !PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "reload() argument must be module"); - return NULL; - } - name = PyModule_GetName(m); - if (name == NULL) - return NULL; - if (m != PyDict_GetItemString(modules, name)) { - PyErr_Format(PyExc_ImportError, - "reload(): module %.200s not in sys.modules", - name); - return NULL; - } - existing_m = PyDict_GetItemString(modules_reloading, name); - if (existing_m != NULL) { - /* Due to a recursive reload, this module is already - being reloaded. */ - Py_INCREF(existing_m); - return existing_m; - } - if (PyDict_SetItemString(modules_reloading, name, m) < 0) - return NULL; - - subname = strrchr(name, '.'); - if (subname == NULL) - subname = name; - else { - PyObject *parentname, *parent; - parentname = PyString_FromStringAndSize(name, (subname-name)); - if (parentname == NULL) { - imp_modules_reloading_clear(); - return NULL; - } - parent = PyDict_GetItem(modules, parentname); - if (parent == NULL) { - PyErr_Format(PyExc_ImportError, - "reload(): parent %.200s not in sys.modules", - PyString_AS_STRING(parentname)); - Py_DECREF(parentname); - imp_modules_reloading_clear(); - return NULL; - } - Py_DECREF(parentname); - subname++; - path = PyObject_GetAttrString(parent, "__path__"); - if (path == NULL) - PyErr_Clear(); - } - buf = PyMem_MALLOC(MAXPATHLEN+1); - if (buf == NULL) { - Py_XDECREF(path); - return PyErr_NoMemory(); - } - buf[0] = '\0'; - fdp = find_module(name, subname, path, buf, MAXPATHLEN+1, &fp, &loader); - Py_XDECREF(path); - - if (fdp == NULL) { - Py_XDECREF(loader); - imp_modules_reloading_clear(); - PyMem_FREE(buf); - return NULL; - } - - newm = load_module(name, fp, buf, fdp->type, loader); - Py_XDECREF(loader); - - if (fp) - fclose(fp); - if (newm == NULL) { - /* load_module probably removed name from modules because of - * the error. Put back the original module object. We're - * going to return NULL in this case regardless of whether - * replacing name succeeds, so the return value is ignored. - */ - PyDict_SetItemString(modules, name, m); - } - imp_modules_reloading_clear(); - PyMem_FREE(buf); - return newm; -} - - -/* Higher-level import emulator which emulates the "import" statement - more accurately -- it invokes the __import__() function from the - builtins of the current globals. This means that the import is - done using whatever import hooks are installed in the current - environment, e.g. by "rexec". - A dummy list ["__doc__"] is passed as the 4th argument so that - e.g. PyImport_Import(PyString_FromString("win32com.client.gencache")) - will return instead of . */ - -PyObject * -PyImport_Import(PyObject *module_name) -{ - static PyObject *silly_list = NULL; - static PyObject *builtins_str = NULL; - static PyObject *import_str = NULL; - PyObject *globals = NULL; - PyObject *import = NULL; - PyObject *builtins = NULL; - PyObject *r = NULL; - - /* Initialize constant string objects */ - if (silly_list == NULL) { - import_str = PyString_InternFromString("__import__"); - if (import_str == NULL) - return NULL; - builtins_str = PyString_InternFromString("__builtins__"); - if (builtins_str == NULL) - return NULL; - silly_list = Py_BuildValue("[s]", "__doc__"); - if (silly_list == NULL) - return NULL; - } - - /* Get the builtins from current globals */ - globals = PyEval_GetGlobals(); - if (globals != NULL) { - Py_INCREF(globals); - builtins = PyObject_GetItem(globals, builtins_str); - if (builtins == NULL) - goto err; - } - else { - /* No globals -- use standard builtins, and fake globals */ - builtins = PyImport_ImportModuleLevel("__builtin__", - NULL, NULL, NULL, 0); - if (builtins == NULL) - return NULL; - globals = Py_BuildValue("{OO}", builtins_str, builtins); - if (globals == NULL) - goto err; - } - - /* Get the __import__ function from the builtins */ - if (PyDict_Check(builtins)) { - import = PyObject_GetItem(builtins, import_str); - if (import == NULL) - PyErr_SetObject(PyExc_KeyError, import_str); - } - else - import = PyObject_GetAttr(builtins, import_str); - if (import == NULL) - goto err; - - /* Call the __import__ function with the proper argument list - * Always use absolute import here. */ - r = PyObject_CallFunction(import, "OOOOi", module_name, globals, - globals, silly_list, 0, NULL); - - err: - Py_XDECREF(globals); - Py_XDECREF(builtins); - Py_XDECREF(import); - - return r; -} - - -/* Module 'imp' provides Python access to the primitives used for - importing modules. -*/ - -static PyObject * -imp_get_magic(PyObject *self, PyObject *noargs) -{ - char buf[4]; - - buf[0] = (char) ((pyc_magic >> 0) & 0xff); - buf[1] = (char) ((pyc_magic >> 8) & 0xff); - buf[2] = (char) ((pyc_magic >> 16) & 0xff); - buf[3] = (char) ((pyc_magic >> 24) & 0xff); - - return PyString_FromStringAndSize(buf, 4); -} - -static PyObject * -imp_get_suffixes(PyObject *self, PyObject *noargs) -{ - PyObject *list; - struct filedescr *fdp; - - list = PyList_New(0); - if (list == NULL) - return NULL; - for (fdp = _PyImport_Filetab; fdp->suffix != NULL; fdp++) { - PyObject *item = Py_BuildValue("ssi", - fdp->suffix, fdp->mode, fdp->type); - if (item == NULL) { - Py_DECREF(list); - return NULL; - } - if (PyList_Append(list, item) < 0) { - Py_DECREF(list); - Py_DECREF(item); - return NULL; - } - Py_DECREF(item); - } - return list; -} - -static PyObject * -call_find_module(char *name, PyObject *path) -{ - extern int fclose(FILE *); - PyObject *fob, *ret; - struct filedescr *fdp; - char *pathname; - FILE *fp = NULL; - - pathname = PyMem_MALLOC(MAXPATHLEN+1); - if (pathname == NULL) { - return PyErr_NoMemory(); - } - pathname[0] = '\0'; - if (path == Py_None) - path = NULL; - fdp = find_module(NULL, name, path, pathname, MAXPATHLEN+1, &fp, NULL); - if (fdp == NULL) { - PyMem_FREE(pathname); - return NULL; - } - if (fp != NULL) { - fob = PyFile_FromFile(fp, pathname, fdp->mode, fclose); - if (fob == NULL) { - PyMem_FREE(pathname); - return NULL; - } - } - else { - fob = Py_None; - Py_INCREF(fob); - } - ret = Py_BuildValue("Os(ssi)", - fob, pathname, fdp->suffix, fdp->mode, fdp->type); - Py_DECREF(fob); - PyMem_FREE(pathname); - return ret; -} - -static PyObject * -imp_find_module(PyObject *self, PyObject *args) -{ - char *name; - PyObject *path = NULL; - if (!PyArg_ParseTuple(args, "s|O:find_module", &name, &path)) - return NULL; - return call_find_module(name, path); -} - -static PyObject * -imp_init_builtin(PyObject *self, PyObject *args) -{ - char *name; - int ret; - PyObject *m; - if (!PyArg_ParseTuple(args, "s:init_builtin", &name)) - return NULL; - ret = init_builtin(name); - if (ret < 0) - return NULL; - if (ret == 0) { - Py_INCREF(Py_None); - return Py_None; - } - m = PyImport_AddModule(name); - Py_XINCREF(m); - return m; -} - -static PyObject * -imp_init_frozen(PyObject *self, PyObject *args) -{ - char *name; - int ret; - PyObject *m; - if (!PyArg_ParseTuple(args, "s:init_frozen", &name)) - return NULL; - ret = PyImport_ImportFrozenModule(name); - if (ret < 0) - return NULL; - if (ret == 0) { - Py_INCREF(Py_None); - return Py_None; - } - m = PyImport_AddModule(name); - Py_XINCREF(m); - return m; -} - -static PyObject * -imp_get_frozen_object(PyObject *self, PyObject *args) -{ - char *name; - - if (!PyArg_ParseTuple(args, "s:get_frozen_object", &name)) - return NULL; - return get_frozen_object(name); -} - -static PyObject * -imp_is_builtin(PyObject *self, PyObject *args) -{ - char *name; - if (!PyArg_ParseTuple(args, "s:is_builtin", &name)) - return NULL; - return PyInt_FromLong(is_builtin(name)); -} - -static PyObject * -imp_is_frozen(PyObject *self, PyObject *args) -{ - char *name; - struct _frozen *p; - if (!PyArg_ParseTuple(args, "s:is_frozen", &name)) - return NULL; - p = find_frozen(name); - return PyBool_FromLong((long) (p == NULL ? 0 : p->size)); -} - -static FILE * -get_file(char *pathname, PyObject *fob, char *mode) -{ - FILE *fp; - if (fob == NULL) { - if (mode[0] == 'U') - mode = "r" PY_STDIOTEXTMODE; - fp = fopen(pathname, mode); - if (fp == NULL) - PyErr_SetFromErrno(PyExc_IOError); - } - else { - fp = PyFile_AsFile(fob); - if (fp == NULL) - PyErr_SetString(PyExc_ValueError, - "bad/closed file object"); - } - return fp; -} - -static PyObject * -imp_load_compiled(PyObject *self, PyObject *args) -{ - char *name; - char *pathname; - PyObject *fob = NULL; - PyObject *m; - FILE *fp; - if (!PyArg_ParseTuple(args, "ss|O!:load_compiled", &name, &pathname, - &PyFile_Type, &fob)) - return NULL; - fp = get_file(pathname, fob, "rb"); - if (fp == NULL) - return NULL; - m = load_compiled_module(name, pathname, fp); - if (fob == NULL) - fclose(fp); - return m; -} - -#ifdef HAVE_DYNAMIC_LOADING - -static PyObject * -imp_load_dynamic(PyObject *self, PyObject *args) -{ - char *name; - char *pathname; - PyObject *fob = NULL; - PyObject *m; - FILE *fp = NULL; - if (!PyArg_ParseTuple(args, "ss|O!:load_dynamic", &name, &pathname, - &PyFile_Type, &fob)) - return NULL; - if (fob) { - fp = get_file(pathname, fob, "r"); - if (fp == NULL) - return NULL; - } - m = _PyImport_LoadDynamicModule(name, pathname, fp); - return m; -} - -#endif /* HAVE_DYNAMIC_LOADING */ - -static PyObject * -imp_load_source(PyObject *self, PyObject *args) -{ - char *name; - char *pathname; - PyObject *fob = NULL; - PyObject *m; - FILE *fp; - if (!PyArg_ParseTuple(args, "ss|O!:load_source", &name, &pathname, - &PyFile_Type, &fob)) - return NULL; - fp = get_file(pathname, fob, "r"); - if (fp == NULL) - return NULL; - m = load_source_module(name, pathname, fp); - if (fob == NULL) - fclose(fp); - return m; -} - -static PyObject * -imp_load_module(PyObject *self, PyObject *args) -{ - char *name; - PyObject *fob; - char *pathname; - char *suffix; /* Unused */ - char *mode; - int type; - FILE *fp; - - if (!PyArg_ParseTuple(args, "sOs(ssi):load_module", - &name, &fob, &pathname, - &suffix, &mode, &type)) - return NULL; - if (*mode) { - /* Mode must start with 'r' or 'U' and must not contain '+'. - Implicit in this test is the assumption that the mode - may contain other modifiers like 'b' or 't'. */ - - if (!(*mode == 'r' || *mode == 'U') || strchr(mode, '+')) { - PyErr_Format(PyExc_ValueError, - "invalid file open mode %.200s", mode); - return NULL; - } - } - if (fob == Py_None) - fp = NULL; - else { - if (!PyFile_Check(fob)) { - PyErr_SetString(PyExc_ValueError, - "load_module arg#2 should be a file or None"); - return NULL; - } - fp = get_file(pathname, fob, mode); - if (fp == NULL) - return NULL; - } - return load_module(name, fp, pathname, type, NULL); -} - -static PyObject * -imp_load_package(PyObject *self, PyObject *args) -{ - char *name; - char *pathname; - if (!PyArg_ParseTuple(args, "ss:load_package", &name, &pathname)) - return NULL; - return load_package(name, pathname); -} - -static PyObject * -imp_new_module(PyObject *self, PyObject *args) -{ - char *name; - if (!PyArg_ParseTuple(args, "s:new_module", &name)) - return NULL; - return PyModule_New(name); -} - -static PyObject * -imp_reload(PyObject *self, PyObject *v) -{ - return PyImport_ReloadModule(v); -} - - -/* Doc strings */ - -PyDoc_STRVAR(doc_imp, -"This module provides the components needed to build your own\n\ -__import__ function. Undocumented functions are obsolete."); - -PyDoc_STRVAR(doc_reload, -"reload(module) -> module\n\ -\n\ -Reload the module. The module must have been successfully imported before."); - -PyDoc_STRVAR(doc_find_module, -"find_module(name, [path]) -> (file, filename, (suffix, mode, type))\n\ -Search for a module. If path is omitted or None, search for a\n\ -built-in, frozen or special module and continue search in sys.path.\n\ -The module name cannot contain '.'; to search for a submodule of a\n\ -package, pass the submodule name and the package's __path__."); - -PyDoc_STRVAR(doc_load_module, -"load_module(name, file, filename, (suffix, mode, type)) -> module\n\ -Load a module, given information returned by find_module().\n\ -The module name must include the full package name, if any."); - -PyDoc_STRVAR(doc_get_magic, -"get_magic() -> string\n\ -Return the magic number for .pyc or .pyo files."); - -PyDoc_STRVAR(doc_get_suffixes, -"get_suffixes() -> [(suffix, mode, type), ...]\n\ -Return a list of (suffix, mode, type) tuples describing the files\n\ -that find_module() looks for."); - -PyDoc_STRVAR(doc_new_module, -"new_module(name) -> module\n\ -Create a new module. Do not enter it in sys.modules.\n\ -The module name must include the full package name, if any."); - -PyDoc_STRVAR(doc_lock_held, -"lock_held() -> boolean\n\ -Return True if the import lock is currently held, else False.\n\ -On platforms without threads, return False."); - -PyDoc_STRVAR(doc_acquire_lock, -"acquire_lock() -> None\n\ -Acquires the interpreter's import lock for the current thread.\n\ -This lock should be used by import hooks to ensure thread-safety\n\ -when importing modules.\n\ -On platforms without threads, this function does nothing."); - -PyDoc_STRVAR(doc_release_lock, -"release_lock() -> None\n\ -Release the interpreter's import lock.\n\ -On platforms without threads, this function does nothing."); - -static PyMethodDef imp_methods[] = { - {"reload", imp_reload, METH_O, doc_reload}, - {"find_module", imp_find_module, METH_VARARGS, doc_find_module}, - {"get_magic", imp_get_magic, METH_NOARGS, doc_get_magic}, - {"get_suffixes", imp_get_suffixes, METH_NOARGS, doc_get_suffixes}, - {"load_module", imp_load_module, METH_VARARGS, doc_load_module}, - {"new_module", imp_new_module, METH_VARARGS, doc_new_module}, - {"lock_held", imp_lock_held, METH_NOARGS, doc_lock_held}, - {"acquire_lock", imp_acquire_lock, METH_NOARGS, doc_acquire_lock}, - {"release_lock", imp_release_lock, METH_NOARGS, doc_release_lock}, - /* The rest are obsolete */ - {"get_frozen_object", imp_get_frozen_object, METH_VARARGS}, - {"init_builtin", imp_init_builtin, METH_VARARGS}, - {"init_frozen", imp_init_frozen, METH_VARARGS}, - {"is_builtin", imp_is_builtin, METH_VARARGS}, - {"is_frozen", imp_is_frozen, METH_VARARGS}, - {"load_compiled", imp_load_compiled, METH_VARARGS}, -#ifdef HAVE_DYNAMIC_LOADING - {"load_dynamic", imp_load_dynamic, METH_VARARGS}, -#endif - {"load_package", imp_load_package, METH_VARARGS}, - {"load_source", imp_load_source, METH_VARARGS}, - {NULL, NULL} /* sentinel */ -}; - -static int -setint(PyObject *d, char *name, int value) -{ - PyObject *v; - int err; - - v = PyInt_FromLong((long)value); - err = PyDict_SetItemString(d, name, v); - Py_XDECREF(v); - return err; -} - -typedef struct { - PyObject_HEAD -} NullImporter; - -static int -NullImporter_init(NullImporter *self, PyObject *args, PyObject *kwds) -{ - char *path; - Py_ssize_t pathlen; - - if (!_PyArg_NoKeywords("NullImporter()", kwds)) - return -1; - - if (!PyArg_ParseTuple(args, "s:NullImporter", - &path)) - return -1; - - pathlen = strlen(path); - if (pathlen == 0) { - PyErr_SetString(PyExc_ImportError, "empty pathname"); - return -1; - } else { - if(isdir(path)) { - PyErr_SetString(PyExc_ImportError, - "existing directory"); - return -1; - } - } - return 0; -} - -static PyObject * -NullImporter_find_module(NullImporter *self, PyObject *args) -{ - Py_RETURN_NONE; -} - -static PyMethodDef NullImporter_methods[] = { - {"find_module", (PyCFunction)NullImporter_find_module, METH_VARARGS, - "Always return None" - }, - {NULL} /* Sentinel */ -}; - - -PyTypeObject PyNullImporter_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "imp.NullImporter", /*tp_name*/ - sizeof(NullImporter), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - 0, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /*tp_hash */ - 0, /*tp_call*/ - 0, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - 0, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT, /*tp_flags*/ - "Null importer object", /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - NullImporter_methods, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)NullImporter_init, /* tp_init */ - 0, /* tp_alloc */ - PyType_GenericNew /* tp_new */ -}; - - -PyMODINIT_FUNC -initimp(void) -{ - PyObject *m, *d; - - if (PyType_Ready(&PyNullImporter_Type) < 0) - goto failure; - - m = Py_InitModule4("imp", imp_methods, doc_imp, - NULL, PYTHON_API_VERSION); - if (m == NULL) - goto failure; - d = PyModule_GetDict(m); - if (d == NULL) - goto failure; - - if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure; - if (setint(d, "PY_SOURCE", PY_SOURCE) < 0) goto failure; - if (setint(d, "PY_COMPILED", PY_COMPILED) < 0) goto failure; - if (setint(d, "C_EXTENSION", C_EXTENSION) < 0) goto failure; - if (setint(d, "PY_RESOURCE", PY_RESOURCE) < 0) goto failure; - if (setint(d, "PKG_DIRECTORY", PKG_DIRECTORY) < 0) goto failure; - if (setint(d, "C_BUILTIN", C_BUILTIN) < 0) goto failure; - if (setint(d, "PY_FROZEN", PY_FROZEN) < 0) goto failure; - if (setint(d, "PY_CODERESOURCE", PY_CODERESOURCE) < 0) goto failure; - if (setint(d, "IMP_HOOK", IMP_HOOK) < 0) goto failure; - - Py_INCREF(&PyNullImporter_Type); - PyModule_AddObject(m, "NullImporter", (PyObject *)&PyNullImporter_Type); - failure: - ; -} - - -/* API for embedding applications that want to add their own entries - to the table of built-in modules. This should normally be called - *before* Py_Initialize(). When the table resize fails, -1 is - returned and the existing table is unchanged. - - After a similar function by Just van Rossum. */ - -int -PyImport_ExtendInittab(struct _inittab *newtab) -{ - static struct _inittab *our_copy = NULL; - struct _inittab *p; - int i, n; - - /* Count the number of entries in both tables */ - for (n = 0; newtab[n].name != NULL; n++) - ; - if (n == 0) - return 0; /* Nothing to do */ - for (i = 0; PyImport_Inittab[i].name != NULL; i++) - ; - - /* Allocate new memory for the combined table */ - p = our_copy; - PyMem_RESIZE(p, struct _inittab, i+n+1); - if (p == NULL) - return -1; - - /* Copy the tables into the new memory */ - if (our_copy != PyImport_Inittab) - memcpy(p, PyImport_Inittab, (i+1) * sizeof(struct _inittab)); - PyImport_Inittab = our_copy = p; - memcpy(p+i, newtab, (n+1) * sizeof(struct _inittab)); - - return 0; -} - -/* Shorthand to add a single entry given a name and a function */ - -int -PyImport_AppendInittab(const char *name, void (*initfunc)(void)) -{ - struct _inittab newtab[2]; - - memset(newtab, '\0', sizeof newtab); - - newtab[0].name = (char *)name; - newtab[0].initfunc = initfunc; - - return PyImport_ExtendInittab(newtab); -} - -#ifdef __cplusplus -} -#endif diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/importdl.c b/AppPkg/Applications/Python/Python-2.7.10/Python/importdl.c deleted file mode 100644 index 0280e81..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/importdl.c +++ /dev/null @@ -1,78 +0,0 @@ - -/* Support for dynamic loading of extension modules */ - -#include "Python.h" - -/* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is - supported on this platform. configure will then compile and link in one - of the dynload_*.c files, as appropriate. We will call a function in - those modules to get a function pointer to the module's init function. -*/ -#ifdef HAVE_DYNAMIC_LOADING - -#include "importdl.h" - -extern dl_funcptr _PyImport_GetDynLoadFunc(const char *name, - const char *shortname, - const char *pathname, FILE *fp); - - - -PyObject * -_PyImport_LoadDynamicModule(char *name, char *pathname, FILE *fp) -{ - PyObject *m; - char *lastdot, *shortname, *packagecontext, *oldcontext; - dl_funcptr p; - - if ((m = _PyImport_FindExtension(name, pathname)) != NULL) { - Py_INCREF(m); - return m; - } - lastdot = strrchr(name, '.'); - if (lastdot == NULL) { - packagecontext = NULL; - shortname = name; - } - else { - packagecontext = name; - shortname = lastdot+1; - } - - p = _PyImport_GetDynLoadFunc(name, shortname, pathname, fp); - if (PyErr_Occurred()) - return NULL; - if (p == NULL) { - PyErr_Format(PyExc_ImportError, - "dynamic module does not define init function (init%.200s)", - shortname); - return NULL; - } - oldcontext = _Py_PackageContext; - _Py_PackageContext = packagecontext; - (*p)(); - _Py_PackageContext = oldcontext; - if (PyErr_Occurred()) - return NULL; - - m = PyDict_GetItemString(PyImport_GetModuleDict(), name); - if (m == NULL) { - PyErr_SetString(PyExc_SystemError, - "dynamic module not initialized properly"); - return NULL; - } - /* Remember the filename as the __file__ attribute */ - if (PyModule_AddStringConstant(m, "__file__", pathname) < 0) - PyErr_Clear(); /* Not important enough to report */ - - if (_PyImport_FixupExtension(name, pathname) == NULL) - return NULL; - if (Py_VerboseFlag) - PySys_WriteStderr( - "import %s # dynamically loaded from %s\n", - name, pathname); - Py_INCREF(m); - return m; -} - -#endif /* HAVE_DYNAMIC_LOADING */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/importdl.h b/AppPkg/Applications/Python/Python-2.7.10/Python/importdl.h deleted file mode 100644 index 7e17246..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/importdl.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef Py_IMPORTDL_H -#define Py_IMPORTDL_H - -#ifdef __cplusplus -extern "C" { -#endif - - -/* Definitions for dynamic loading of extension modules */ -enum filetype { - SEARCH_ERROR, - PY_SOURCE, - PY_COMPILED, - C_EXTENSION, - PY_RESOURCE, /* Mac only */ - PKG_DIRECTORY, - C_BUILTIN, - PY_FROZEN, - PY_CODERESOURCE, /* Mac only */ - IMP_HOOK -}; - -struct filedescr { - char *suffix; - char *mode; - enum filetype type; -}; -extern struct filedescr * _PyImport_Filetab; -extern const struct filedescr _PyImport_DynLoadFiletab[]; - -extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname, - FILE *); - -/* Max length of module suffix searched for -- accommodates "module.slb" */ -#define MAXSUFFIXSIZE 12 - -#ifdef MS_WINDOWS -#include -typedef FARPROC dl_funcptr; -#else -#if defined(PYOS_OS2) && !defined(PYCC_GCC) -#include -typedef int (* APIENTRY dl_funcptr)(); -#else -typedef void (*dl_funcptr)(void); -#endif -#endif - - -#ifdef __cplusplus -} -#endif -#endif /* !Py_IMPORTDL_H */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/modsupport.c b/AppPkg/Applications/Python/Python-2.7.10/Python/modsupport.c deleted file mode 100644 index e383bdf..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/modsupport.c +++ /dev/null @@ -1,644 +0,0 @@ - -/* Module support implementation */ - -#include "Python.h" - -#define FLAG_SIZE_T 1 -typedef double va_double; - -static PyObject *va_build_value(const char *, va_list, int); - -/* Package context -- the full module name for package imports */ -char *_Py_PackageContext = NULL; - -/* Py_InitModule4() parameters: - - name is the module name - - methods is the list of top-level functions - - doc is the documentation string - - passthrough is passed as self to functions defined in the module - - api_version is the value of PYTHON_API_VERSION at the time the - module was compiled - - Return value is a borrowed reference to the module object; or NULL - if an error occurred (in Python 1.4 and before, errors were fatal). - Errors may still leak memory. -*/ - -static char api_version_warning[] = -"Python C API version mismatch for module %.100s:\ - This Python has API version %d, module %.100s has version %d."; - -PyObject * -Py_InitModule4(const char *name, PyMethodDef *methods, const char *doc, - PyObject *passthrough, int module_api_version) -{ - PyObject *m, *d, *v, *n; - PyMethodDef *ml; - PyInterpreterState *interp = PyThreadState_Get()->interp; - if (interp->modules == NULL) - Py_FatalError("Python import machinery not initialized"); - if (module_api_version != PYTHON_API_VERSION) { - char message[512]; - PyOS_snprintf(message, sizeof(message), - api_version_warning, name, - PYTHON_API_VERSION, name, - module_api_version); - if (PyErr_Warn(PyExc_RuntimeWarning, message)) - return NULL; - } - /* Make sure name is fully qualified. - - This is a bit of a hack: when the shared library is loaded, - the module name is "package.module", but the module calls - Py_InitModule*() with just "module" for the name. The shared - library loader squirrels away the true name of the module in - _Py_PackageContext, and Py_InitModule*() will substitute this - (if the name actually matches). - */ - if (_Py_PackageContext != NULL) { - char *p = strrchr(_Py_PackageContext, '.'); - if (p != NULL && strcmp(name, p+1) == 0) { - name = _Py_PackageContext; - _Py_PackageContext = NULL; - } - } - if ((m = PyImport_AddModule(name)) == NULL) - return NULL; - d = PyModule_GetDict(m); - if (methods != NULL) { - n = PyString_FromString(name); - if (n == NULL) - return NULL; - for (ml = methods; ml->ml_name != NULL; ml++) { - if ((ml->ml_flags & METH_CLASS) || - (ml->ml_flags & METH_STATIC)) { - PyErr_SetString(PyExc_ValueError, - "module functions cannot set" - " METH_CLASS or METH_STATIC"); - Py_DECREF(n); - return NULL; - } - v = PyCFunction_NewEx(ml, passthrough, n); - if (v == NULL) { - Py_DECREF(n); - return NULL; - } - if (PyDict_SetItemString(d, ml->ml_name, v) != 0) { - Py_DECREF(v); - Py_DECREF(n); - return NULL; - } - Py_DECREF(v); - } - Py_DECREF(n); - } - if (doc != NULL) { - v = PyString_FromString(doc); - if (v == NULL || PyDict_SetItemString(d, "__doc__", v) != 0) { - Py_XDECREF(v); - return NULL; - } - Py_DECREF(v); - } - return m; -} - - -/* Helper for mkvalue() to scan the length of a format */ - -static int -countformat(const char *format, int endchar) -{ - int count = 0; - int level = 0; - while (level > 0 || *format != endchar) { - switch (*format) { - case '\0': - /* Premature end */ - PyErr_SetString(PyExc_SystemError, - "unmatched paren in format"); - return -1; - case '(': - case '[': - case '{': - if (level == 0) - count++; - level++; - break; - case ')': - case ']': - case '}': - level--; - break; - case '#': - case '&': - case ',': - case ':': - case ' ': - case '\t': - break; - default: - if (level == 0) - count++; - } - format++; - } - return count; -} - - -/* Generic function to create a value -- the inverse of getargs() */ -/* After an original idea and first implementation by Steven Miale */ - -static PyObject *do_mktuple(const char**, va_list *, int, int, int); -static PyObject *do_mklist(const char**, va_list *, int, int, int); -static PyObject *do_mkdict(const char**, va_list *, int, int, int); -static PyObject *do_mkvalue(const char**, va_list *, int); - - -static PyObject * -do_mkdict(const char **p_format, va_list *p_va, int endchar, int n, int flags) -{ - PyObject *d; - int i; - int itemfailed = 0; - if (n < 0) - return NULL; - if ((d = PyDict_New()) == NULL) - return NULL; - /* Note that we can't bail immediately on error as this will leak - refcounts on any 'N' arguments. */ - for (i = 0; i < n; i+= 2) { - PyObject *k, *v; - int err; - k = do_mkvalue(p_format, p_va, flags); - if (k == NULL) { - itemfailed = 1; - Py_INCREF(Py_None); - k = Py_None; - } - v = do_mkvalue(p_format, p_va, flags); - if (v == NULL) { - itemfailed = 1; - Py_INCREF(Py_None); - v = Py_None; - } - err = PyDict_SetItem(d, k, v); - Py_DECREF(k); - Py_DECREF(v); - if (err < 0 || itemfailed) { - Py_DECREF(d); - return NULL; - } - } - if (d != NULL && **p_format != endchar) { - Py_DECREF(d); - d = NULL; - PyErr_SetString(PyExc_SystemError, - "Unmatched paren in format"); - } - else if (endchar) - ++*p_format; - return d; -} - -static PyObject * -do_mklist(const char **p_format, va_list *p_va, int endchar, int n, int flags) -{ - PyObject *v; - int i; - int itemfailed = 0; - if (n < 0) - return NULL; - v = PyList_New(n); - if (v == NULL) - return NULL; - /* Note that we can't bail immediately on error as this will leak - refcounts on any 'N' arguments. */ - for (i = 0; i < n; i++) { - PyObject *w = do_mkvalue(p_format, p_va, flags); - if (w == NULL) { - itemfailed = 1; - Py_INCREF(Py_None); - w = Py_None; - } - PyList_SET_ITEM(v, i, w); - } - - if (itemfailed) { - /* do_mkvalue() should have already set an error */ - Py_DECREF(v); - return NULL; - } - if (**p_format != endchar) { - Py_DECREF(v); - PyErr_SetString(PyExc_SystemError, - "Unmatched paren in format"); - return NULL; - } - if (endchar) - ++*p_format; - return v; -} - -#ifdef Py_USING_UNICODE -static int -_ustrlen(Py_UNICODE *u) -{ - int i = 0; - Py_UNICODE *v = u; - while (*v != 0) { i++; v++; } - return i; -} -#endif - -static PyObject * -do_mktuple(const char **p_format, va_list *p_va, int endchar, int n, int flags) -{ - PyObject *v; - int i; - int itemfailed = 0; - if (n < 0) - return NULL; - if ((v = PyTuple_New(n)) == NULL) - return NULL; - /* Note that we can't bail immediately on error as this will leak - refcounts on any 'N' arguments. */ - for (i = 0; i < n; i++) { - PyObject *w = do_mkvalue(p_format, p_va, flags); - if (w == NULL) { - itemfailed = 1; - Py_INCREF(Py_None); - w = Py_None; - } - PyTuple_SET_ITEM(v, i, w); - } - if (itemfailed) { - /* do_mkvalue() should have already set an error */ - Py_DECREF(v); - return NULL; - } - if (**p_format != endchar) { - Py_DECREF(v); - PyErr_SetString(PyExc_SystemError, - "Unmatched paren in format"); - return NULL; - } - if (endchar) - ++*p_format; - return v; -} - -static PyObject * -do_mkvalue(const char **p_format, va_list *p_va, int flags) -{ - for (;;) { - switch (*(*p_format)++) { - case '(': - return do_mktuple(p_format, p_va, ')', - countformat(*p_format, ')'), flags); - - case '[': - return do_mklist(p_format, p_va, ']', - countformat(*p_format, ']'), flags); - - case '{': - return do_mkdict(p_format, p_va, '}', - countformat(*p_format, '}'), flags); - - case 'b': - case 'B': - case 'h': - case 'i': - return PyInt_FromLong((long)va_arg(*p_va, int)); - - case 'H': - return PyInt_FromLong((long)va_arg(*p_va, unsigned int)); - - case 'I': - { - unsigned int n; - n = va_arg(*p_va, unsigned int); - if (n > (unsigned long)PyInt_GetMax()) - return PyLong_FromUnsignedLong((unsigned long)n); - else - return PyInt_FromLong(n); - } - - case 'n': -#if SIZEOF_SIZE_T!=SIZEOF_LONG - return PyInt_FromSsize_t(va_arg(*p_va, Py_ssize_t)); -#endif - /* Fall through from 'n' to 'l' if Py_ssize_t is long */ - case 'l': - return PyInt_FromLong(va_arg(*p_va, long)); - - case 'k': - { - unsigned long n; - n = va_arg(*p_va, unsigned long); - if (n > (unsigned long)PyInt_GetMax()) - return PyLong_FromUnsignedLong(n); - else - return PyInt_FromLong(n); - } - -#ifdef HAVE_LONG_LONG - case 'L': - return PyLong_FromLongLong((PY_LONG_LONG)va_arg(*p_va, PY_LONG_LONG)); - - case 'K': - return PyLong_FromUnsignedLongLong((PY_LONG_LONG)va_arg(*p_va, unsigned PY_LONG_LONG)); -#endif -#ifdef Py_USING_UNICODE - case 'u': - { - PyObject *v; - Py_UNICODE *u = va_arg(*p_va, Py_UNICODE *); - Py_ssize_t n; - if (**p_format == '#') { - ++*p_format; - if (flags & FLAG_SIZE_T) - n = va_arg(*p_va, Py_ssize_t); - else - n = va_arg(*p_va, int); - } - else - n = -1; - if (u == NULL) { - v = Py_None; - Py_INCREF(v); - } - else { - if (n < 0) - n = _ustrlen(u); - v = PyUnicode_FromUnicode(u, n); - } - return v; - } -#endif - case 'f': - case 'd': - return PyFloat_FromDouble( - (double)va_arg(*p_va, va_double)); - -#ifndef WITHOUT_COMPLEX - case 'D': - return PyComplex_FromCComplex( - *((Py_complex *)va_arg(*p_va, Py_complex *))); -#endif /* WITHOUT_COMPLEX */ - - case 'c': - { - char p[1]; - p[0] = (char)va_arg(*p_va, int); - return PyString_FromStringAndSize(p, 1); - } - - case 's': - case 'z': - { - PyObject *v; - char *str = va_arg(*p_va, char *); - Py_ssize_t n; - if (**p_format == '#') { - ++*p_format; - if (flags & FLAG_SIZE_T) - n = va_arg(*p_va, Py_ssize_t); - else - n = va_arg(*p_va, int); - } - else - n = -1; - if (str == NULL) { - v = Py_None; - Py_INCREF(v); - } - else { - if (n < 0) { - size_t m = strlen(str); - if (m > PY_SSIZE_T_MAX) { - PyErr_SetString(PyExc_OverflowError, - "string too long for Python string"); - return NULL; - } - n = (Py_ssize_t)m; - } - v = PyString_FromStringAndSize(str, n); - } - return v; - } - - case 'N': - case 'S': - case 'O': - if (**p_format == '&') { - typedef PyObject *(*converter)(void *); - converter func = va_arg(*p_va, converter); - void *arg = va_arg(*p_va, void *); - ++*p_format; - return (*func)(arg); - } - else { - PyObject *v; - v = va_arg(*p_va, PyObject *); - if (v != NULL) { - if (*(*p_format - 1) != 'N') - Py_INCREF(v); - } - else if (!PyErr_Occurred()) - /* If a NULL was passed - * because a call that should - * have constructed a value - * failed, that's OK, and we - * pass the error on; but if - * no error occurred it's not - * clear that the caller knew - * what she was doing. */ - PyErr_SetString(PyExc_SystemError, - "NULL object passed to Py_BuildValue"); - return v; - } - - case ':': - case ',': - case ' ': - case '\t': - break; - - default: - PyErr_SetString(PyExc_SystemError, - "bad format char passed to Py_BuildValue"); - return NULL; - - } - } -} - - -PyObject * -Py_BuildValue(const char *format, ...) -{ - va_list va; - PyObject* retval; - va_start(va, format); - retval = va_build_value(format, va, 0); - va_end(va); - return retval; -} - -PyObject * -_Py_BuildValue_SizeT(const char *format, ...) -{ - va_list va; - PyObject* retval; - va_start(va, format); - retval = va_build_value(format, va, FLAG_SIZE_T); - va_end(va); - return retval; -} - -PyObject * -Py_VaBuildValue(const char *format, va_list va) -{ - return va_build_value(format, va, 0); -} - -PyObject * -_Py_VaBuildValue_SizeT(const char *format, va_list va) -{ - return va_build_value(format, va, FLAG_SIZE_T); -} - -static PyObject * -va_build_value(const char *format, va_list va, int flags) -{ - const char *f = format; - int n = countformat(f, '\0'); - va_list lva; - -#ifdef VA_LIST_IS_ARRAY - memcpy(lva, va, sizeof(va_list)); -#else -#ifdef __va_copy - __va_copy(lva, va); -#else - lva = va; -#endif -#endif - - if (n < 0) - return NULL; - if (n == 0) { - Py_INCREF(Py_None); - return Py_None; - } - if (n == 1) - return do_mkvalue(&f, &lva, flags); - return do_mktuple(&f, &lva, '\0', n, flags); -} - - -PyObject * -PyEval_CallFunction(PyObject *obj, const char *format, ...) -{ - va_list vargs; - PyObject *args; - PyObject *res; - - va_start(vargs, format); - - args = Py_VaBuildValue(format, vargs); - va_end(vargs); - - if (args == NULL) - return NULL; - - res = PyEval_CallObject(obj, args); - Py_DECREF(args); - - return res; -} - - -PyObject * -PyEval_CallMethod(PyObject *obj, const char *methodname, const char *format, ...) -{ - va_list vargs; - PyObject *meth; - PyObject *args; - PyObject *res; - - meth = PyObject_GetAttrString(obj, methodname); - if (meth == NULL) - return NULL; - - va_start(vargs, format); - - args = Py_VaBuildValue(format, vargs); - va_end(vargs); - - if (args == NULL) { - Py_DECREF(meth); - return NULL; - } - - res = PyEval_CallObject(meth, args); - Py_DECREF(meth); - Py_DECREF(args); - - return res; -} - -int -PyModule_AddObject(PyObject *m, const char *name, PyObject *o) -{ - PyObject *dict; - if (!PyModule_Check(m)) { - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs module as first arg"); - return -1; - } - if (!o) { - if (!PyErr_Occurred()) - PyErr_SetString(PyExc_TypeError, - "PyModule_AddObject() needs non-NULL value"); - return -1; - } - - dict = PyModule_GetDict(m); - if (dict == NULL) { - /* Internal error -- modules must have a dict! */ - PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__", - PyModule_GetName(m)); - return -1; - } - if (PyDict_SetItemString(dict, name, o)) - return -1; - Py_DECREF(o); - return 0; -} - -int -PyModule_AddIntConstant(PyObject *m, const char *name, long value) -{ - PyObject *o = PyInt_FromLong(value); - if (!o) - return -1; - if (PyModule_AddObject(m, name, o) == 0) - return 0; - Py_DECREF(o); - return -1; -} - -int -PyModule_AddStringConstant(PyObject *m, const char *name, const char *value) -{ - PyObject *o = PyString_FromString(value); - if (!o) - return -1; - if (PyModule_AddObject(m, name, o) == 0) - return 0; - Py_DECREF(o); - return -1; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/mysnprintf.c b/AppPkg/Applications/Python/Python-2.7.10/Python/mysnprintf.c deleted file mode 100644 index f9481a8..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/mysnprintf.c +++ /dev/null @@ -1,105 +0,0 @@ -#include "Python.h" -#include - -/* snprintf() wrappers. If the platform has vsnprintf, we use it, else we - emulate it in a half-hearted way. Even if the platform has it, we wrap - it because platforms differ in what vsnprintf does in case the buffer - is too small: C99 behavior is to return the number of characters that - would have been written had the buffer not been too small, and to set - the last byte of the buffer to \0. At least MS _vsnprintf returns a - negative value instead, and fills the entire buffer with non-\0 data. - - The wrappers ensure that str[size-1] is always \0 upon return. - - PyOS_snprintf and PyOS_vsnprintf never write more than size bytes - (including the trailing '\0') into str. - - If the platform doesn't have vsnprintf, and the buffer size needed to - avoid truncation exceeds size by more than 512, Python aborts with a - Py_FatalError. - - Return value (rv): - - When 0 <= rv < size, the output conversion was unexceptional, and - rv characters were written to str (excluding a trailing \0 byte at - str[rv]). - - When rv >= size, output conversion was truncated, and a buffer of - size rv+1 would have been needed to avoid truncation. str[size-1] - is \0 in this case. - - When rv < 0, "something bad happened". str[size-1] is \0 in this - case too, but the rest of str is unreliable. It could be that - an error in format codes was detected by libc, or on platforms - with a non-C99 vsnprintf simply that the buffer wasn't big enough - to avoid truncation, or on platforms without any vsnprintf that - PyMem_Malloc couldn't obtain space for a temp buffer. - - CAUTION: Unlike C99, str != NULL and size > 0 are required. -*/ - -int -PyOS_snprintf(char *str, size_t size, const char *format, ...) -{ - int rc; - va_list va; - - va_start(va, format); - rc = PyOS_vsnprintf(str, size, format, va); - va_end(va); - return rc; -} - -int -PyOS_vsnprintf(char *str, size_t size, const char *format, va_list va) -{ - int len; /* # bytes written, excluding \0 */ -#ifdef HAVE_SNPRINTF -#define _PyOS_vsnprintf_EXTRA_SPACE 1 -#else -#define _PyOS_vsnprintf_EXTRA_SPACE 512 - char *buffer; -#endif - assert(str != NULL); - assert(size > 0); - assert(format != NULL); - /* We take a size_t as input but return an int. Sanity check - * our input so that it won't cause an overflow in the - * vsnprintf return value or the buffer malloc size. */ - if (size > INT_MAX - _PyOS_vsnprintf_EXTRA_SPACE) { - len = -666; - goto Done; - } - -#ifdef HAVE_SNPRINTF - len = vsnprintf(str, size, format, va); -#else - /* Emulate it. */ - buffer = PyMem_MALLOC(size + _PyOS_vsnprintf_EXTRA_SPACE); - if (buffer == NULL) { - len = -666; - goto Done; - } - - len = vsprintf(buffer, format, va); - if (len < 0) - /* ignore the error */; - - else if ((size_t)len >= size + _PyOS_vsnprintf_EXTRA_SPACE) - Py_FatalError("Buffer overflow in PyOS_snprintf/PyOS_vsnprintf"); - - else { - const size_t to_copy = (size_t)len < size ? - (size_t)len : size - 1; - assert(to_copy < size); - memcpy(str, buffer, to_copy); - str[to_copy] = '\0'; - } - PyMem_FREE(buffer); -#endif -Done: - if (size > 0) - str[size-1] = '\0'; - return len; -#undef _PyOS_vsnprintf_EXTRA_SPACE -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/mystrtoul.c b/AppPkg/Applications/Python/Python-2.7.10/Python/mystrtoul.c deleted file mode 100644 index 096eb16..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/mystrtoul.c +++ /dev/null @@ -1,285 +0,0 @@ - -#include "Python.h" - -#if defined(__sgi) && defined(WITH_THREAD) && !defined(_SGI_MP_SOURCE) -#define _SGI_MP_SOURCE -#endif - -/* strtol and strtoul, renamed to avoid conflicts */ - - -#include -#ifdef HAVE_ERRNO_H -#include -#endif - -/* Static overflow check values for bases 2 through 36. - * smallmax[base] is the largest unsigned long i such that - * i * base doesn't overflow unsigned long. - */ -static unsigned long smallmax[] = { - 0, /* bases 0 and 1 are invalid */ - 0, - ULONG_MAX / 2, - ULONG_MAX / 3, - ULONG_MAX / 4, - ULONG_MAX / 5, - ULONG_MAX / 6, - ULONG_MAX / 7, - ULONG_MAX / 8, - ULONG_MAX / 9, - ULONG_MAX / 10, - ULONG_MAX / 11, - ULONG_MAX / 12, - ULONG_MAX / 13, - ULONG_MAX / 14, - ULONG_MAX / 15, - ULONG_MAX / 16, - ULONG_MAX / 17, - ULONG_MAX / 18, - ULONG_MAX / 19, - ULONG_MAX / 20, - ULONG_MAX / 21, - ULONG_MAX / 22, - ULONG_MAX / 23, - ULONG_MAX / 24, - ULONG_MAX / 25, - ULONG_MAX / 26, - ULONG_MAX / 27, - ULONG_MAX / 28, - ULONG_MAX / 29, - ULONG_MAX / 30, - ULONG_MAX / 31, - ULONG_MAX / 32, - ULONG_MAX / 33, - ULONG_MAX / 34, - ULONG_MAX / 35, - ULONG_MAX / 36, -}; - -/* maximum digits that can't ever overflow for bases 2 through 36, - * calculated by [int(math.floor(math.log(2**32, i))) for i in range(2, 37)]. - * Note that this is pessimistic if sizeof(long) > 4. - */ -#if SIZEOF_LONG == 4 -static int digitlimit[] = { - 0, 0, 32, 20, 16, 13, 12, 11, 10, 10, /* 0 - 9 */ - 9, 9, 8, 8, 8, 8, 8, 7, 7, 7, /* 10 - 19 */ - 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, /* 20 - 29 */ - 6, 6, 6, 6, 6, 6, 6}; /* 30 - 36 */ -#elif SIZEOF_LONG == 8 -/* [int(math.floor(math.log(2**64, i))) for i in range(2, 37)] */ -static int digitlimit[] = { - 0, 0, 64, 40, 32, 27, 24, 22, 21, 20, /* 0 - 9 */ - 19, 18, 17, 17, 16, 16, 16, 15, 15, 15, /* 10 - 19 */ - 14, 14, 14, 14, 13, 13, 13, 13, 13, 13, /* 20 - 29 */ - 13, 12, 12, 12, 12, 12, 12}; /* 30 - 36 */ -#else -#error "Need table for SIZEOF_LONG" -#endif - -/* -** strtoul -** This is a general purpose routine for converting -** an ascii string to an integer in an arbitrary base. -** Leading white space is ignored. If 'base' is zero -** it looks for a leading 0, 0b, 0B, 0o, 0O, 0x or 0X -** to tell which base. If these are absent it defaults -** to 10. Base must be 0 or between 2 and 36 (inclusive). -** If 'ptr' is non-NULL it will contain a pointer to -** the end of the scan. -** Errors due to bad pointers will probably result in -** exceptions - we don't check for them. -*/ -unsigned long -PyOS_strtoul(register char *str, char **ptr, int base) -{ - register unsigned long result = 0; /* return value of the function */ - register int c; /* current input character */ - register int ovlimit; /* required digits to overflow */ - - /* skip leading white space */ - while (*str && isspace(Py_CHARMASK(*str))) - ++str; - - /* check for leading 0 or 0x for auto-base or base 16 */ - switch (base) { - case 0: /* look for leading 0, 0b, 0o or 0x */ - if (*str == '0') { - ++str; - if (*str == 'x' || *str == 'X') { - /* there must be at least one digit after 0x */ - if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) { - if (ptr) - *ptr = str; - return 0; - } - ++str; - base = 16; - } else if (*str == 'o' || *str == 'O') { - /* there must be at least one digit after 0o */ - if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) { - if (ptr) - *ptr = str; - return 0; - } - ++str; - base = 8; - } else if (*str == 'b' || *str == 'B') { - /* there must be at least one digit after 0b */ - if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) { - if (ptr) - *ptr = str; - return 0; - } - ++str; - base = 2; - } else { - base = 8; - } - } - else - base = 10; - break; - - case 2: /* skip leading 0b or 0B */ - if (*str == '0') { - ++str; - if (*str == 'b' || *str == 'B') { - /* there must be at least one digit after 0b */ - if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 2) { - if (ptr) - *ptr = str; - return 0; - } - ++str; - } - } - break; - - case 8: /* skip leading 0o or 0O */ - if (*str == '0') { - ++str; - if (*str == 'o' || *str == 'O') { - /* there must be at least one digit after 0o */ - if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 8) { - if (ptr) - *ptr = str; - return 0; - } - ++str; - } - } - break; - - case 16: /* skip leading 0x or 0X */ - if (*str == '0') { - ++str; - if (*str == 'x' || *str == 'X') { - /* there must be at least one digit after 0x */ - if (_PyLong_DigitValue[Py_CHARMASK(str[1])] >= 16) { - if (ptr) - *ptr = str; - return 0; - } - ++str; - } - } - break; - } - - /* catch silly bases */ - if (base < 2 || base > 36) { - if (ptr) - *ptr = str; - return 0; - } - - /* skip leading zeroes */ - while (*str == '0') - ++str; - - /* base is guaranteed to be in [2, 36] at this point */ - ovlimit = digitlimit[base]; - - /* do the conversion until non-digit character encountered */ - while ((c = _PyLong_DigitValue[Py_CHARMASK(*str)]) < base) { - if (ovlimit > 0) /* no overflow check required */ - result = result * base + c; - else { /* requires overflow check */ - register unsigned long temp_result; - - if (ovlimit < 0) /* guaranteed overflow */ - goto overflowed; - - /* there could be an overflow */ - /* check overflow just from shifting */ - if (result > smallmax[base]) - goto overflowed; - - result *= base; - - /* check overflow from the digit's value */ - temp_result = result + c; - if (temp_result < result) - goto overflowed; - - result = temp_result; - } - - ++str; - --ovlimit; - } - - /* set pointer to point to the last character scanned */ - if (ptr) - *ptr = str; - - return result; - -overflowed: - if (ptr) { - /* spool through remaining digit characters */ - while (_PyLong_DigitValue[Py_CHARMASK(*str)] < base) - ++str; - *ptr = str; - } - errno = ERANGE; - return (unsigned long)-1; -} - -/* Checking for overflow in PyOS_strtol is a PITA; see comments - * about PY_ABS_LONG_MIN in longobject.c. - */ -#define PY_ABS_LONG_MIN (0-(unsigned long)LONG_MIN) - -long -PyOS_strtol(char *str, char **ptr, int base) -{ - long result; - unsigned long uresult; - char sign; - - while (*str && isspace(Py_CHARMASK(*str))) - str++; - - sign = *str; - if (sign == '+' || sign == '-') - str++; - - uresult = PyOS_strtoul(str, ptr, base); - - if (uresult <= (unsigned long)LONG_MAX) { - result = (long)uresult; - if (sign == '-') - result = -result; - } - else if (sign == '-' && uresult == PY_ABS_LONG_MIN) { - result = LONG_MIN; - } - else { - errno = ERANGE; - result = LONG_MAX; - } - return result; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/peephole.c b/AppPkg/Applications/Python/Python-2.7.10/Python/peephole.c deleted file mode 100644 index 54404a3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/peephole.c +++ /dev/null @@ -1,667 +0,0 @@ -/* Peephole optimizations for bytecode compiler. */ - -#include "Python.h" - -#include "Python-ast.h" -#include "node.h" -#include "pyarena.h" -#include "ast.h" -#include "code.h" -#include "compile.h" -#include "symtable.h" -#include "opcode.h" - -#define GETARG(arr, i) ((int)((arr[i+2]<<8) + arr[i+1])) -#define UNCONDITIONAL_JUMP(op) (op==JUMP_ABSOLUTE || op==JUMP_FORWARD) -#define CONDITIONAL_JUMP(op) (op==POP_JUMP_IF_FALSE || op==POP_JUMP_IF_TRUE \ - || op==JUMP_IF_FALSE_OR_POP || op==JUMP_IF_TRUE_OR_POP) -#define ABSOLUTE_JUMP(op) (op==JUMP_ABSOLUTE || op==CONTINUE_LOOP \ - || op==POP_JUMP_IF_FALSE || op==POP_JUMP_IF_TRUE \ - || op==JUMP_IF_FALSE_OR_POP || op==JUMP_IF_TRUE_OR_POP) -#define JUMPS_ON_TRUE(op) (op==POP_JUMP_IF_TRUE || op==JUMP_IF_TRUE_OR_POP) -#define GETJUMPTGT(arr, i) (GETARG(arr,i) + (ABSOLUTE_JUMP(arr[i]) ? 0 : i+3)) -#define SETARG(arr, i, val) arr[i+2] = val>>8; arr[i+1] = val & 255 -#define CODESIZE(op) (HAS_ARG(op) ? 3 : 1) -#define ISBASICBLOCK(blocks, start, bytes) \ - (blocks[start]==blocks[start+bytes-1]) - -/* Replace LOAD_CONST c1. LOAD_CONST c2 ... LOAD_CONST cn BUILD_TUPLE n - with LOAD_CONST (c1, c2, ... cn). - The consts table must still be in list form so that the - new constant (c1, c2, ... cn) can be appended. - Called with codestr pointing to the first LOAD_CONST. - Bails out with no change if one or more of the LOAD_CONSTs is missing. - Also works for BUILD_LIST when followed by an "in" or "not in" test. -*/ -static int -tuple_of_constants(unsigned char *codestr, Py_ssize_t n, PyObject *consts) -{ - PyObject *newconst, *constant; - Py_ssize_t i, arg, len_consts; - - /* Pre-conditions */ - assert(PyList_CheckExact(consts)); - assert(codestr[n*3] == BUILD_TUPLE || codestr[n*3] == BUILD_LIST); - assert(GETARG(codestr, (n*3)) == n); - for (i=0 ; i 20) { - Py_DECREF(newconst); - return 0; - } - - /* Append folded constant into consts table */ - len_consts = PyList_GET_SIZE(consts); - if (PyList_Append(consts, newconst)) { - Py_DECREF(newconst); - return 0; - } - Py_DECREF(newconst); - - /* Write NOP NOP NOP NOP LOAD_CONST newconst */ - memset(codestr, NOP, 4); - codestr[4] = LOAD_CONST; - SETARG(codestr, 4, len_consts); - return 1; -} - -static int -fold_unaryops_on_constants(unsigned char *codestr, PyObject *consts) -{ - PyObject *newconst=NULL, *v; - Py_ssize_t len_consts; - int opcode; - - /* Pre-conditions */ - assert(PyList_CheckExact(consts)); - assert(codestr[0] == LOAD_CONST); - - /* Create new constant */ - v = PyList_GET_ITEM(consts, GETARG(codestr, 0)); - opcode = codestr[3]; - switch (opcode) { - case UNARY_NEGATIVE: - /* Preserve the sign of -0.0 */ - if (PyObject_IsTrue(v) == 1) - newconst = PyNumber_Negative(v); - break; - case UNARY_CONVERT: - newconst = PyObject_Repr(v); - break; - case UNARY_INVERT: - newconst = PyNumber_Invert(v); - break; - default: - /* Called with an unknown opcode */ - PyErr_Format(PyExc_SystemError, - "unexpected unary operation %d on a constant", - opcode); - return 0; - } - if (newconst == NULL) { - PyErr_Clear(); - return 0; - } - - /* Append folded constant into consts table */ - len_consts = PyList_GET_SIZE(consts); - if (PyList_Append(consts, newconst)) { - Py_DECREF(newconst); - return 0; - } - Py_DECREF(newconst); - - /* Write NOP LOAD_CONST newconst */ - codestr[0] = NOP; - codestr[1] = LOAD_CONST; - SETARG(codestr, 1, len_consts); - return 1; -} - -static unsigned int * -markblocks(unsigned char *code, Py_ssize_t len) -{ - unsigned int *blocks = PyMem_New(unsigned int, len); - int i,j, opcode, blockcnt = 0; - - if (blocks == NULL) { - PyErr_NoMemory(); - return NULL; - } - memset(blocks, 0, len*sizeof(int)); - - /* Mark labels in the first pass */ - for (i=0 ; i= 255. - - Optimizations are restricted to simple transformations occuring within a - single basic block. All transformations keep the code size the same or - smaller. For those that reduce size, the gaps are initially filled with - NOPs. Later those NOPs are removed and the jump addresses retargeted in - a single pass. Line numbering is adjusted accordingly. */ - -PyObject * -PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names, - PyObject *lineno_obj) -{ - Py_ssize_t i, j, codelen; - int nops, h, adj; - int tgt, tgttgt, opcode; - unsigned char *codestr = NULL; - unsigned char *lineno; - int *addrmap = NULL; - int new_line, cum_orig_line, last_line, tabsiz; - int cumlc=0, lastlc=0; /* Count runs of consecutive LOAD_CONSTs */ - unsigned int *blocks = NULL; - char *name; - - /* Bail out if an exception is set */ - if (PyErr_Occurred()) - goto exitError; - - /* Bypass optimization when the lineno table is too complex */ - assert(PyString_Check(lineno_obj)); - lineno = (unsigned char*)PyString_AS_STRING(lineno_obj); - tabsiz = PyString_GET_SIZE(lineno_obj); - if (memchr(lineno, 255, tabsiz) != NULL) - goto exitUnchanged; - - /* Avoid situations where jump retargeting could overflow */ - assert(PyString_Check(code)); - codelen = PyString_GET_SIZE(code); - if (codelen > 32700) - goto exitUnchanged; - - /* Make a modifiable copy of the code string */ - codestr = (unsigned char *)PyMem_Malloc(codelen); - if (codestr == NULL) - goto exitError; - codestr = (unsigned char *)memcpy(codestr, - PyString_AS_STRING(code), codelen); - - /* Verify that RETURN_VALUE terminates the codestring. This allows - the various transformation patterns to look ahead several - instructions without additional checks to make sure they are not - looking beyond the end of the code string. - */ - if (codestr[codelen-1] != RETURN_VALUE) - goto exitUnchanged; - - /* Mapping to new jump targets after NOPs are removed */ - addrmap = PyMem_New(int, codelen); - if (addrmap == NULL) { - PyErr_NoMemory(); - goto exitError; - } - - blocks = markblocks(codestr, codelen); - if (blocks == NULL) - goto exitError; - assert(PyList_Check(consts)); - - for (i=0 ; i a is not b - not a in b --> a not in b - not a is not b --> a is b - not a not in b --> a in b - */ - case COMPARE_OP: - j = GETARG(codestr, i); - if (j < 6 || j > 9 || - codestr[i+3] != UNARY_NOT || - !ISBASICBLOCK(blocks,i,4)) - continue; - SETARG(codestr, i, (j^1)); - codestr[i+3] = NOP; - break; - - /* Replace LOAD_GLOBAL/LOAD_NAME None - with LOAD_CONST None */ - case LOAD_NAME: - case LOAD_GLOBAL: - j = GETARG(codestr, i); - name = PyString_AsString(PyTuple_GET_ITEM(names, j)); - if (name == NULL || strcmp(name, "None") != 0) - continue; - for (j=0 ; j < PyList_GET_SIZE(consts) ; j++) { - if (PyList_GET_ITEM(consts, j) == Py_None) - break; - } - if (j == PyList_GET_SIZE(consts)) { - if (PyList_Append(consts, Py_None) == -1) - goto exitError; - } - assert(PyList_GET_ITEM(consts, j) == Py_None); - codestr[i] = LOAD_CONST; - SETARG(codestr, i, j); - cumlc = lastlc + 1; - break; - - /* Skip over LOAD_CONST trueconst - POP_JUMP_IF_FALSE xx. This improves - "while 1" performance. */ - case LOAD_CONST: - cumlc = lastlc + 1; - j = GETARG(codestr, i); - if (codestr[i+3] != POP_JUMP_IF_FALSE || - !ISBASICBLOCK(blocks,i,6) || - !PyObject_IsTrue(PyList_GET_ITEM(consts, j))) - continue; - memset(codestr+i, NOP, 6); - cumlc = 0; - break; - - /* Try to fold tuples of constants (includes a case for lists - which are only used for "in" and "not in" tests). - Skip over BUILD_SEQN 1 UNPACK_SEQN 1. - Replace BUILD_SEQN 2 UNPACK_SEQN 2 with ROT2. - Replace BUILD_SEQN 3 UNPACK_SEQN 3 with ROT3 ROT2. */ - case BUILD_TUPLE: - case BUILD_LIST: - j = GETARG(codestr, i); - h = i - 3 * j; - if (h >= 0 && - j <= lastlc && - ((opcode == BUILD_TUPLE && - ISBASICBLOCK(blocks, h, 3*(j+1))) || - (opcode == BUILD_LIST && - codestr[i+3]==COMPARE_OP && - ISBASICBLOCK(blocks, h, 3*(j+2)) && - (GETARG(codestr,i+3)==6 || - GETARG(codestr,i+3)==7))) && - tuple_of_constants(&codestr[h], j, consts)) { - assert(codestr[i] == LOAD_CONST); - cumlc = 1; - break; - } - if (codestr[i+3] != UNPACK_SEQUENCE || - !ISBASICBLOCK(blocks,i,6) || - j != GETARG(codestr, i+3)) - continue; - if (j == 1) { - memset(codestr+i, NOP, 6); - } else if (j == 2) { - codestr[i] = ROT_TWO; - memset(codestr+i+1, NOP, 5); - } else if (j == 3) { - codestr[i] = ROT_THREE; - codestr[i+1] = ROT_TWO; - memset(codestr+i+2, NOP, 4); - } - break; - - /* Fold binary ops on constants. - LOAD_CONST c1 LOAD_CONST c2 BINOP --> LOAD_CONST binop(c1,c2) */ - case BINARY_POWER: - case BINARY_MULTIPLY: - case BINARY_TRUE_DIVIDE: - case BINARY_FLOOR_DIVIDE: - case BINARY_MODULO: - case BINARY_ADD: - case BINARY_SUBTRACT: - case BINARY_SUBSCR: - case BINARY_LSHIFT: - case BINARY_RSHIFT: - case BINARY_AND: - case BINARY_XOR: - case BINARY_OR: - if (lastlc >= 2 && - ISBASICBLOCK(blocks, i-6, 7) && - fold_binops_on_constants(&codestr[i-6], consts)) { - i -= 2; - assert(codestr[i] == LOAD_CONST); - cumlc = 1; - } - break; - - /* Fold unary ops on constants. - LOAD_CONST c1 UNARY_OP --> LOAD_CONST unary_op(c) */ - case UNARY_NEGATIVE: - case UNARY_CONVERT: - case UNARY_INVERT: - if (lastlc >= 1 && - ISBASICBLOCK(blocks, i-3, 4) && - fold_unaryops_on_constants(&codestr[i-3], consts)) { - i -= 2; - assert(codestr[i] == LOAD_CONST); - cumlc = 1; - } - break; - - /* Simplify conditional jump to conditional jump where the - result of the first test implies the success of a similar - test or the failure of the opposite test. - Arises in code like: - "if a and b:" - "if a or b:" - "a and b or c" - "(a and b) and c" - x:JUMP_IF_FALSE_OR_POP y y:JUMP_IF_FALSE_OR_POP z - --> x:JUMP_IF_FALSE_OR_POP z - x:JUMP_IF_FALSE_OR_POP y y:JUMP_IF_TRUE_OR_POP z - --> x:POP_JUMP_IF_FALSE y+3 - where y+3 is the instruction following the second test. - */ - case JUMP_IF_FALSE_OR_POP: - case JUMP_IF_TRUE_OR_POP: - tgt = GETJUMPTGT(codestr, i); - j = codestr[tgt]; - if (CONDITIONAL_JUMP(j)) { - /* NOTE: all possible jumps here are absolute! */ - if (JUMPS_ON_TRUE(j) == JUMPS_ON_TRUE(opcode)) { - /* The second jump will be - taken iff the first is. */ - tgttgt = GETJUMPTGT(codestr, tgt); - /* The current opcode inherits - its target's stack behaviour */ - codestr[i] = j; - SETARG(codestr, i, tgttgt); - goto reoptimize_current; - } else { - /* The second jump is not taken if the first is (so - jump past it), and all conditional jumps pop their - argument when they're not taken (so change the - first jump to pop its argument when it's taken). */ - if (JUMPS_ON_TRUE(opcode)) - codestr[i] = POP_JUMP_IF_TRUE; - else - codestr[i] = POP_JUMP_IF_FALSE; - SETARG(codestr, i, (tgt + 3)); - goto reoptimize_current; - } - } - /* Intentional fallthrough */ - - /* Replace jumps to unconditional jumps */ - case POP_JUMP_IF_FALSE: - case POP_JUMP_IF_TRUE: - case FOR_ITER: - case JUMP_FORWARD: - case JUMP_ABSOLUTE: - case CONTINUE_LOOP: - case SETUP_LOOP: - case SETUP_EXCEPT: - case SETUP_FINALLY: - case SETUP_WITH: - tgt = GETJUMPTGT(codestr, i); - /* Replace JUMP_* to a RETURN into just a RETURN */ - if (UNCONDITIONAL_JUMP(opcode) && - codestr[tgt] == RETURN_VALUE) { - codestr[i] = RETURN_VALUE; - memset(codestr+i+1, NOP, 2); - continue; - } - if (!UNCONDITIONAL_JUMP(codestr[tgt])) - continue; - tgttgt = GETJUMPTGT(codestr, tgt); - if (opcode == JUMP_FORWARD) /* JMP_ABS can go backwards */ - opcode = JUMP_ABSOLUTE; - if (!ABSOLUTE_JUMP(opcode)) - tgttgt -= i + 3; /* Calc relative jump addr */ - if (tgttgt < 0) /* No backward relative jumps */ - continue; - codestr[i] = opcode; - SETARG(codestr, i, tgttgt); - break; - - case EXTENDED_ARG: - goto exitUnchanged; - - /* Replace RETURN LOAD_CONST None RETURN with just RETURN */ - /* Remove unreachable JUMPs after RETURN */ - case RETURN_VALUE: - if (i+4 >= codelen) - continue; - if (codestr[i+4] == RETURN_VALUE && - ISBASICBLOCK(blocks,i,5)) - memset(codestr+i+1, NOP, 4); - else if (UNCONDITIONAL_JUMP(codestr[i+1]) && - ISBASICBLOCK(blocks,i,4)) - memset(codestr+i+1, NOP, 3); - break; - } - } - - /* Fixup linenotab */ - for (i=0, nops=0 ; iab_size = size; - b->ab_mem = (void *)(b + 1); - b->ab_next = NULL; - b->ab_offset = ROUNDUP((Py_uintptr_t)(b->ab_mem)) - - (Py_uintptr_t)(b->ab_mem); - return b; -} - -static void -block_free(block *b) { - while (b) { - block *next = b->ab_next; - free(b); - b = next; - } -} - -static void * -block_alloc(block *b, size_t size) -{ - void *p; - assert(b); - size = ROUNDUP(size); - if (b->ab_offset + size > b->ab_size) { - /* If we need to allocate more memory than will fit in - the default block, allocate a one-off block that is - exactly the right size. */ - /* TODO(jhylton): Think about space waste at end of block */ - block *newbl = block_new( - size < DEFAULT_BLOCK_SIZE ? - DEFAULT_BLOCK_SIZE : size); - if (!newbl) - return NULL; - assert(!b->ab_next); - b->ab_next = newbl; - b = newbl; - } - - assert(b->ab_offset + size <= b->ab_size); - p = (void *)(((char *)b->ab_mem) + b->ab_offset); - b->ab_offset += size; - return p; -} - -PyArena * -PyArena_New() -{ - PyArena* arena = (PyArena *)malloc(sizeof(PyArena)); - if (!arena) - return (PyArena*)PyErr_NoMemory(); - - arena->a_head = block_new(DEFAULT_BLOCK_SIZE); - arena->a_cur = arena->a_head; - if (!arena->a_head) { - free((void *)arena); - return (PyArena*)PyErr_NoMemory(); - } - arena->a_objects = PyList_New(0); - if (!arena->a_objects) { - block_free(arena->a_head); - free((void *)arena); - return (PyArena*)PyErr_NoMemory(); - } -#if defined(Py_DEBUG) - arena->total_allocs = 0; - arena->total_size = 0; - arena->total_blocks = 1; - arena->total_block_size = DEFAULT_BLOCK_SIZE; - arena->total_big_blocks = 0; -#endif - return arena; -} - -void -PyArena_Free(PyArena *arena) -{ - assert(arena); -#if defined(Py_DEBUG) - /* - fprintf(stderr, - "alloc=%d size=%d blocks=%d block_size=%d big=%d objects=%d\n", - arena->total_allocs, arena->total_size, arena->total_blocks, - arena->total_block_size, arena->total_big_blocks, - PyList_Size(arena->a_objects)); - */ -#endif - block_free(arena->a_head); - /* This property normally holds, except when the code being compiled - is sys.getobjects(0), in which case there will be two references. - assert(arena->a_objects->ob_refcnt == 1); - */ - - Py_DECREF(arena->a_objects); - free(arena); -} - -void * -PyArena_Malloc(PyArena *arena, size_t size) -{ - void *p = block_alloc(arena->a_cur, size); - if (!p) - return PyErr_NoMemory(); -#if defined(Py_DEBUG) - arena->total_allocs++; - arena->total_size += size; -#endif - /* Reset cur if we allocated a new block. */ - if (arena->a_cur->ab_next) { - arena->a_cur = arena->a_cur->ab_next; -#if defined(Py_DEBUG) - arena->total_blocks++; - arena->total_block_size += arena->a_cur->ab_size; - if (arena->a_cur->ab_size > DEFAULT_BLOCK_SIZE) - ++arena->total_big_blocks; -#endif - } - return p; -} - -int -PyArena_AddPyObject(PyArena *arena, PyObject *obj) -{ - int r = PyList_Append(arena->a_objects, obj); - if (r >= 0) { - Py_DECREF(obj); - } - return r; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pyctype.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pyctype.c deleted file mode 100644 index ea977b3..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pyctype.c +++ /dev/null @@ -1,214 +0,0 @@ -#include "Python.h" - -/* Our own locale-independent ctype.h-like macros */ - -const unsigned int _Py_ctype_table[256] = { - 0, /* 0x0 '\x00' */ - 0, /* 0x1 '\x01' */ - 0, /* 0x2 '\x02' */ - 0, /* 0x3 '\x03' */ - 0, /* 0x4 '\x04' */ - 0, /* 0x5 '\x05' */ - 0, /* 0x6 '\x06' */ - 0, /* 0x7 '\x07' */ - 0, /* 0x8 '\x08' */ - PY_CTF_SPACE, /* 0x9 '\t' */ - PY_CTF_SPACE, /* 0xa '\n' */ - PY_CTF_SPACE, /* 0xb '\v' */ - PY_CTF_SPACE, /* 0xc '\f' */ - PY_CTF_SPACE, /* 0xd '\r' */ - 0, /* 0xe '\x0e' */ - 0, /* 0xf '\x0f' */ - 0, /* 0x10 '\x10' */ - 0, /* 0x11 '\x11' */ - 0, /* 0x12 '\x12' */ - 0, /* 0x13 '\x13' */ - 0, /* 0x14 '\x14' */ - 0, /* 0x15 '\x15' */ - 0, /* 0x16 '\x16' */ - 0, /* 0x17 '\x17' */ - 0, /* 0x18 '\x18' */ - 0, /* 0x19 '\x19' */ - 0, /* 0x1a '\x1a' */ - 0, /* 0x1b '\x1b' */ - 0, /* 0x1c '\x1c' */ - 0, /* 0x1d '\x1d' */ - 0, /* 0x1e '\x1e' */ - 0, /* 0x1f '\x1f' */ - PY_CTF_SPACE, /* 0x20 ' ' */ - 0, /* 0x21 '!' */ - 0, /* 0x22 '"' */ - 0, /* 0x23 '#' */ - 0, /* 0x24 '$' */ - 0, /* 0x25 '%' */ - 0, /* 0x26 '&' */ - 0, /* 0x27 "'" */ - 0, /* 0x28 '(' */ - 0, /* 0x29 ')' */ - 0, /* 0x2a '*' */ - 0, /* 0x2b '+' */ - 0, /* 0x2c ',' */ - 0, /* 0x2d '-' */ - 0, /* 0x2e '.' */ - 0, /* 0x2f '/' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x30 '0' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x31 '1' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x32 '2' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x33 '3' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x34 '4' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x35 '5' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x36 '6' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x37 '7' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x38 '8' */ - PY_CTF_DIGIT|PY_CTF_XDIGIT, /* 0x39 '9' */ - 0, /* 0x3a ':' */ - 0, /* 0x3b ';' */ - 0, /* 0x3c '<' */ - 0, /* 0x3d '=' */ - 0, /* 0x3e '>' */ - 0, /* 0x3f '?' */ - 0, /* 0x40 '@' */ - PY_CTF_UPPER|PY_CTF_XDIGIT, /* 0x41 'A' */ - PY_CTF_UPPER|PY_CTF_XDIGIT, /* 0x42 'B' */ - PY_CTF_UPPER|PY_CTF_XDIGIT, /* 0x43 'C' */ - PY_CTF_UPPER|PY_CTF_XDIGIT, /* 0x44 'D' */ - PY_CTF_UPPER|PY_CTF_XDIGIT, /* 0x45 'E' */ - PY_CTF_UPPER|PY_CTF_XDIGIT, /* 0x46 'F' */ - PY_CTF_UPPER, /* 0x47 'G' */ - PY_CTF_UPPER, /* 0x48 'H' */ - PY_CTF_UPPER, /* 0x49 'I' */ - PY_CTF_UPPER, /* 0x4a 'J' */ - PY_CTF_UPPER, /* 0x4b 'K' */ - PY_CTF_UPPER, /* 0x4c 'L' */ - PY_CTF_UPPER, /* 0x4d 'M' */ - PY_CTF_UPPER, /* 0x4e 'N' */ - PY_CTF_UPPER, /* 0x4f 'O' */ - PY_CTF_UPPER, /* 0x50 'P' */ - PY_CTF_UPPER, /* 0x51 'Q' */ - PY_CTF_UPPER, /* 0x52 'R' */ - PY_CTF_UPPER, /* 0x53 'S' */ - PY_CTF_UPPER, /* 0x54 'T' */ - PY_CTF_UPPER, /* 0x55 'U' */ - PY_CTF_UPPER, /* 0x56 'V' */ - PY_CTF_UPPER, /* 0x57 'W' */ - PY_CTF_UPPER, /* 0x58 'X' */ - PY_CTF_UPPER, /* 0x59 'Y' */ - PY_CTF_UPPER, /* 0x5a 'Z' */ - 0, /* 0x5b '[' */ - 0, /* 0x5c '\\' */ - 0, /* 0x5d ']' */ - 0, /* 0x5e '^' */ - 0, /* 0x5f '_' */ - 0, /* 0x60 '`' */ - PY_CTF_LOWER|PY_CTF_XDIGIT, /* 0x61 'a' */ - PY_CTF_LOWER|PY_CTF_XDIGIT, /* 0x62 'b' */ - PY_CTF_LOWER|PY_CTF_XDIGIT, /* 0x63 'c' */ - PY_CTF_LOWER|PY_CTF_XDIGIT, /* 0x64 'd' */ - PY_CTF_LOWER|PY_CTF_XDIGIT, /* 0x65 'e' */ - PY_CTF_LOWER|PY_CTF_XDIGIT, /* 0x66 'f' */ - PY_CTF_LOWER, /* 0x67 'g' */ - PY_CTF_LOWER, /* 0x68 'h' */ - PY_CTF_LOWER, /* 0x69 'i' */ - PY_CTF_LOWER, /* 0x6a 'j' */ - PY_CTF_LOWER, /* 0x6b 'k' */ - PY_CTF_LOWER, /* 0x6c 'l' */ - PY_CTF_LOWER, /* 0x6d 'm' */ - PY_CTF_LOWER, /* 0x6e 'n' */ - PY_CTF_LOWER, /* 0x6f 'o' */ - PY_CTF_LOWER, /* 0x70 'p' */ - PY_CTF_LOWER, /* 0x71 'q' */ - PY_CTF_LOWER, /* 0x72 'r' */ - PY_CTF_LOWER, /* 0x73 's' */ - PY_CTF_LOWER, /* 0x74 't' */ - PY_CTF_LOWER, /* 0x75 'u' */ - PY_CTF_LOWER, /* 0x76 'v' */ - PY_CTF_LOWER, /* 0x77 'w' */ - PY_CTF_LOWER, /* 0x78 'x' */ - PY_CTF_LOWER, /* 0x79 'y' */ - PY_CTF_LOWER, /* 0x7a 'z' */ - 0, /* 0x7b '{' */ - 0, /* 0x7c '|' */ - 0, /* 0x7d '}' */ - 0, /* 0x7e '~' */ - 0, /* 0x7f '\x7f' */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -}; - - -const unsigned char _Py_ctype_tolower[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - 0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, - 0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, - 0x70, 0x71, 0x72, 0x73, 0x74, 0x75, 0x76, 0x77, - 0x78, 0x79, 0x7a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, -}; - -const unsigned char _Py_ctype_toupper[256] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, - 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, - 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f, - 0x60, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, - 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, - 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, - 0x58, 0x59, 0x5a, 0x7b, 0x7c, 0x7d, 0x7e, 0x7f, - 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, - 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, - 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, - 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, - 0xa0, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, -}; - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pyfpe.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pyfpe.c deleted file mode 100644 index 46a6197..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pyfpe.c +++ /dev/null @@ -1,23 +0,0 @@ -#include "pyconfig.h" -#include "pyfpe.h" -/* - * The signal handler for SIGFPE is actually declared in an external - * module fpectl, or as preferred by the user. These variable - * definitions are required in order to compile Python without - * getting missing externals, but to actually handle SIGFPE requires - * defining a handler and enabling generation of SIGFPE. - */ - -#ifdef WANT_SIGFPE_HANDLER -jmp_buf PyFPE_jbuf; -int PyFPE_counter = 0; -#endif - -/* Have this outside the above #ifdef, since some picky ANSI compilers issue a - warning when compiling an empty file. */ - -double -PyFPE_dummy(void *dummy) -{ - return 1.0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pymath.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pymath.c deleted file mode 100644 index 8085bde..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pymath.c +++ /dev/null @@ -1,79 +0,0 @@ -#include "Python.h" - -#ifdef X87_DOUBLE_ROUNDING -/* On x86 platforms using an x87 FPU, this function is called from the - Py_FORCE_DOUBLE macro (defined in pymath.h) to force a floating-point - number out of an 80-bit x87 FPU register and into a 64-bit memory location, - thus rounding from extended precision to double precision. */ -double _Py_force_double(double x) -{ - volatile double y; - y = x; - return y; -} -#endif - -#ifdef HAVE_GCC_ASM_FOR_X87 - -/* inline assembly for getting and setting the 387 FPU control word on - gcc/x86 */ - -unsigned short _Py_get_387controlword(void) { - unsigned short cw; - __asm__ __volatile__ ("fnstcw %0" : "=m" (cw)); - return cw; -} - -void _Py_set_387controlword(unsigned short cw) { - __asm__ __volatile__ ("fldcw %0" : : "m" (cw)); -} - -#endif - - -#ifndef HAVE_HYPOT -double hypot(double x, double y) -{ - double yx; - - x = fabs(x); - y = fabs(y); - if (x < y) { - double temp = x; - x = y; - y = temp; - } - if (x == 0.) - return 0.; - else { - yx = y/x; - return x*sqrt(1.+yx*yx); - } -} -#endif /* HAVE_HYPOT */ - -#ifndef HAVE_COPYSIGN -double -copysign(double x, double y) -{ - /* use atan2 to distinguish -0. from 0. */ - if (y > 0. || (y == 0. && atan2(y, -1.) > 0.)) { - return fabs(x); - } else { - return -fabs(x); - } -} -#endif /* HAVE_COPYSIGN */ - -#ifndef HAVE_ROUND -double -round(double x) -{ - double absx, y; - absx = fabs(x); - y = floor(absx); - if (absx - y >= 0.5) - y += 1.0; - return copysign(y, x); -} -#endif /* HAVE_ROUND */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pystate.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pystate.c deleted file mode 100644 index 3f8a1ee..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pystate.c +++ /dev/null @@ -1,665 +0,0 @@ - -/* Thread and interpreter state structures and their interfaces */ - -#include "Python.h" - -/* -------------------------------------------------------------------------- -CAUTION - -Always use malloc() and free() directly in this file. A number of these -functions are advertised as safe to call when the GIL isn't held, and in -a debug build Python redirects (e.g.) PyMem_NEW (etc) to Python's debugging -obmalloc functions. Those aren't thread-safe (they rely on the GIL to avoid -the expense of doing their own locking). --------------------------------------------------------------------------- */ - -#ifdef HAVE_DLOPEN -#ifdef HAVE_DLFCN_H -#include -#endif -#ifndef RTLD_LAZY -#define RTLD_LAZY 1 -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef WITH_THREAD -#include "pythread.h" -static PyThread_type_lock head_mutex = NULL; /* Protects interp->tstate_head */ -#define HEAD_INIT() (void)(head_mutex || (head_mutex = PyThread_allocate_lock())) -#define HEAD_LOCK() PyThread_acquire_lock(head_mutex, WAIT_LOCK) -#define HEAD_UNLOCK() PyThread_release_lock(head_mutex) - -/* The single PyInterpreterState used by this process' - GILState implementation -*/ -static PyInterpreterState *autoInterpreterState = NULL; -static int autoTLSkey = 0; -#else -#define HEAD_INIT() /* Nothing */ -#define HEAD_LOCK() /* Nothing */ -#define HEAD_UNLOCK() /* Nothing */ -#endif - -static PyInterpreterState *interp_head = NULL; - -PyThreadState *_PyThreadState_Current = NULL; -PyThreadFrameGetter _PyThreadState_GetFrame = NULL; - -#ifdef WITH_THREAD -static void _PyGILState_NoteThreadState(PyThreadState* tstate); -#endif - - -PyInterpreterState * -PyInterpreterState_New(void) -{ - PyInterpreterState *interp = (PyInterpreterState *) - malloc(sizeof(PyInterpreterState)); - - if (interp != NULL) { - HEAD_INIT(); -#ifdef WITH_THREAD - if (head_mutex == NULL) - Py_FatalError("Can't initialize threads for interpreter"); -#endif - interp->modules = NULL; - interp->modules_reloading = NULL; - interp->sysdict = NULL; - interp->builtins = NULL; - interp->tstate_head = NULL; - interp->codec_search_path = NULL; - interp->codec_search_cache = NULL; - interp->codec_error_registry = NULL; -#ifdef HAVE_DLOPEN -#ifdef RTLD_NOW - interp->dlopenflags = RTLD_NOW; -#else - interp->dlopenflags = RTLD_LAZY; -#endif -#endif -#ifdef WITH_TSC - interp->tscdump = 0; -#endif - - HEAD_LOCK(); - interp->next = interp_head; - interp_head = interp; - HEAD_UNLOCK(); - } - - return interp; -} - - -void -PyInterpreterState_Clear(PyInterpreterState *interp) -{ - PyThreadState *p; - HEAD_LOCK(); - for (p = interp->tstate_head; p != NULL; p = p->next) - PyThreadState_Clear(p); - HEAD_UNLOCK(); - Py_CLEAR(interp->codec_search_path); - Py_CLEAR(interp->codec_search_cache); - Py_CLEAR(interp->codec_error_registry); - Py_CLEAR(interp->modules); - Py_CLEAR(interp->modules_reloading); - Py_CLEAR(interp->sysdict); - Py_CLEAR(interp->builtins); -} - - -static void -zapthreads(PyInterpreterState *interp) -{ - PyThreadState *p; - /* No need to lock the mutex here because this should only happen - when the threads are all really dead (XXX famous last words). */ - while ((p = interp->tstate_head) != NULL) { - PyThreadState_Delete(p); - } -} - - -void -PyInterpreterState_Delete(PyInterpreterState *interp) -{ - PyInterpreterState **p; - zapthreads(interp); - HEAD_LOCK(); - for (p = &interp_head; ; p = &(*p)->next) { - if (*p == NULL) - Py_FatalError( - "PyInterpreterState_Delete: invalid interp"); - if (*p == interp) - break; - } - if (interp->tstate_head != NULL) - Py_FatalError("PyInterpreterState_Delete: remaining threads"); - *p = interp->next; - HEAD_UNLOCK(); - free(interp); -} - - -/* Default implementation for _PyThreadState_GetFrame */ -static struct _frame * -threadstate_getframe(PyThreadState *self) -{ - return self->frame; -} - -static PyThreadState * -new_threadstate(PyInterpreterState *interp, int init) -{ - PyThreadState *tstate = (PyThreadState *)malloc(sizeof(PyThreadState)); - - if (_PyThreadState_GetFrame == NULL) - _PyThreadState_GetFrame = threadstate_getframe; - - if (tstate != NULL) { - tstate->interp = interp; - - tstate->frame = NULL; - tstate->recursion_depth = 0; - tstate->tracing = 0; - tstate->use_tracing = 0; - tstate->tick_counter = 0; - tstate->gilstate_counter = 0; - tstate->async_exc = NULL; -#ifdef WITH_THREAD - tstate->thread_id = PyThread_get_thread_ident(); -#else - tstate->thread_id = 0; -#endif - - tstate->dict = NULL; - - tstate->curexc_type = NULL; - tstate->curexc_value = NULL; - tstate->curexc_traceback = NULL; - - tstate->exc_type = NULL; - tstate->exc_value = NULL; - tstate->exc_traceback = NULL; - - tstate->c_profilefunc = NULL; - tstate->c_tracefunc = NULL; - tstate->c_profileobj = NULL; - tstate->c_traceobj = NULL; - - tstate->trash_delete_nesting = 0; - tstate->trash_delete_later = NULL; - - if (init) - _PyThreadState_Init(tstate); - - HEAD_LOCK(); - tstate->next = interp->tstate_head; - interp->tstate_head = tstate; - HEAD_UNLOCK(); - } - - return tstate; -} - -PyThreadState * -PyThreadState_New(PyInterpreterState *interp) -{ - return new_threadstate(interp, 1); -} - -PyThreadState * -_PyThreadState_Prealloc(PyInterpreterState *interp) -{ - return new_threadstate(interp, 0); -} - -void -_PyThreadState_Init(PyThreadState *tstate) -{ -#ifdef WITH_THREAD - _PyGILState_NoteThreadState(tstate); -#endif -} - -void -PyThreadState_Clear(PyThreadState *tstate) -{ - if (Py_VerboseFlag && tstate->frame != NULL) - fprintf(stderr, - "PyThreadState_Clear: warning: thread still has a frame\n"); - - Py_CLEAR(tstate->frame); - - Py_CLEAR(tstate->dict); - Py_CLEAR(tstate->async_exc); - - Py_CLEAR(tstate->curexc_type); - Py_CLEAR(tstate->curexc_value); - Py_CLEAR(tstate->curexc_traceback); - - Py_CLEAR(tstate->exc_type); - Py_CLEAR(tstate->exc_value); - Py_CLEAR(tstate->exc_traceback); - - tstate->c_profilefunc = NULL; - tstate->c_tracefunc = NULL; - Py_CLEAR(tstate->c_profileobj); - Py_CLEAR(tstate->c_traceobj); -} - - -/* Common code for PyThreadState_Delete() and PyThreadState_DeleteCurrent() */ -static void -tstate_delete_common(PyThreadState *tstate) -{ - PyInterpreterState *interp; - PyThreadState **p; - PyThreadState *prev_p = NULL; - if (tstate == NULL) - Py_FatalError("PyThreadState_Delete: NULL tstate"); - interp = tstate->interp; - if (interp == NULL) - Py_FatalError("PyThreadState_Delete: NULL interp"); - HEAD_LOCK(); - for (p = &interp->tstate_head; ; p = &(*p)->next) { - if (*p == NULL) - Py_FatalError( - "PyThreadState_Delete: invalid tstate"); - if (*p == tstate) - break; - /* Sanity check. These states should never happen but if - * they do we must abort. Otherwise we'll end up spinning in - * in a tight loop with the lock held. A similar check is done - * in thread.c find_key(). */ - if (*p == prev_p) - Py_FatalError( - "PyThreadState_Delete: small circular list(!)" - " and tstate not found."); - prev_p = *p; - if ((*p)->next == interp->tstate_head) - Py_FatalError( - "PyThreadState_Delete: circular list(!) and" - " tstate not found."); - } - *p = tstate->next; - HEAD_UNLOCK(); - free(tstate); -} - - -void -PyThreadState_Delete(PyThreadState *tstate) -{ - if (tstate == _PyThreadState_Current) - Py_FatalError("PyThreadState_Delete: tstate is still current"); - tstate_delete_common(tstate); -#ifdef WITH_THREAD - if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) - PyThread_delete_key_value(autoTLSkey); -#endif /* WITH_THREAD */ -} - - -#ifdef WITH_THREAD -void -PyThreadState_DeleteCurrent() -{ - PyThreadState *tstate = _PyThreadState_Current; - if (tstate == NULL) - Py_FatalError( - "PyThreadState_DeleteCurrent: no current tstate"); - _PyThreadState_Current = NULL; - if (autoInterpreterState && PyThread_get_key_value(autoTLSkey) == tstate) - PyThread_delete_key_value(autoTLSkey); - tstate_delete_common(tstate); - PyEval_ReleaseLock(); -} -#endif /* WITH_THREAD */ - - -PyThreadState * -PyThreadState_Get(void) -{ - if (_PyThreadState_Current == NULL) - Py_FatalError("PyThreadState_Get: no current thread"); - - return _PyThreadState_Current; -} - - -PyThreadState * -PyThreadState_Swap(PyThreadState *newts) -{ - PyThreadState *oldts = _PyThreadState_Current; - - _PyThreadState_Current = newts; - /* It should not be possible for more than one thread state - to be used for a thread. Check this the best we can in debug - builds. - */ -#if defined(Py_DEBUG) && defined(WITH_THREAD) - if (newts) { - /* This can be called from PyEval_RestoreThread(). Similar - to it, we need to ensure errno doesn't change. - */ - int err = errno; - PyThreadState *check = PyGILState_GetThisThreadState(); - if (check && check->interp == newts->interp && check != newts) - Py_FatalError("Invalid thread state for this thread"); - errno = err; - } -#endif - return oldts; -} - -/* An extension mechanism to store arbitrary additional per-thread state. - PyThreadState_GetDict() returns a dictionary that can be used to hold such - state; the caller should pick a unique key and store its state there. If - PyThreadState_GetDict() returns NULL, an exception has *not* been raised - and the caller should assume no per-thread state is available. */ - -PyObject * -PyThreadState_GetDict(void) -{ - if (_PyThreadState_Current == NULL) - return NULL; - - if (_PyThreadState_Current->dict == NULL) { - PyObject *d; - _PyThreadState_Current->dict = d = PyDict_New(); - if (d == NULL) - PyErr_Clear(); - } - return _PyThreadState_Current->dict; -} - - -/* Asynchronously raise an exception in a thread. - Requested by Just van Rossum and Alex Martelli. - To prevent naive misuse, you must write your own extension - to call this, or use ctypes. Must be called with the GIL held. - Returns the number of tstates modified (normally 1, but 0 if `id` didn't - match any known thread id). Can be called with exc=NULL to clear an - existing async exception. This raises no exceptions. */ - -int -PyThreadState_SetAsyncExc(long id, PyObject *exc) { - PyThreadState *tstate = PyThreadState_GET(); - PyInterpreterState *interp = tstate->interp; - PyThreadState *p; - - /* Although the GIL is held, a few C API functions can be called - * without the GIL held, and in particular some that create and - * destroy thread and interpreter states. Those can mutate the - * list of thread states we're traversing, so to prevent that we lock - * head_mutex for the duration. - */ - HEAD_LOCK(); - for (p = interp->tstate_head; p != NULL; p = p->next) { - if (p->thread_id == id) { - /* Tricky: we need to decref the current value - * (if any) in p->async_exc, but that can in turn - * allow arbitrary Python code to run, including - * perhaps calls to this function. To prevent - * deadlock, we need to release head_mutex before - * the decref. - */ - PyObject *old_exc = p->async_exc; - Py_XINCREF(exc); - p->async_exc = exc; - HEAD_UNLOCK(); - Py_XDECREF(old_exc); - return 1; - } - } - HEAD_UNLOCK(); - return 0; -} - - -/* Routines for advanced debuggers, requested by David Beazley. - Don't use unless you know what you are doing! */ - -PyInterpreterState * -PyInterpreterState_Head(void) -{ - return interp_head; -} - -PyInterpreterState * -PyInterpreterState_Next(PyInterpreterState *interp) { - return interp->next; -} - -PyThreadState * -PyInterpreterState_ThreadHead(PyInterpreterState *interp) { - return interp->tstate_head; -} - -PyThreadState * -PyThreadState_Next(PyThreadState *tstate) { - return tstate->next; -} - -/* The implementation of sys._current_frames(). This is intended to be - called with the GIL held, as it will be when called via - sys._current_frames(). It's possible it would work fine even without - the GIL held, but haven't thought enough about that. -*/ -PyObject * -_PyThread_CurrentFrames(void) -{ - PyObject *result; - PyInterpreterState *i; - - result = PyDict_New(); - if (result == NULL) - return NULL; - - /* for i in all interpreters: - * for t in all of i's thread states: - * if t's frame isn't NULL, map t's id to its frame - * Because these lists can mutate even when the GIL is held, we - * need to grab head_mutex for the duration. - */ - HEAD_LOCK(); - for (i = interp_head; i != NULL; i = i->next) { - PyThreadState *t; - for (t = i->tstate_head; t != NULL; t = t->next) { - PyObject *id; - int stat; - struct _frame *frame = t->frame; - if (frame == NULL) - continue; - id = PyInt_FromLong(t->thread_id); - if (id == NULL) - goto Fail; - stat = PyDict_SetItem(result, id, (PyObject *)frame); - Py_DECREF(id); - if (stat < 0) - goto Fail; - } - } - HEAD_UNLOCK(); - return result; - - Fail: - HEAD_UNLOCK(); - Py_DECREF(result); - return NULL; -} - -/* Python "auto thread state" API. */ -#ifdef WITH_THREAD - -/* Keep this as a static, as it is not reliable! It can only - ever be compared to the state for the *current* thread. - * If not equal, then it doesn't matter that the actual - value may change immediately after comparison, as it can't - possibly change to the current thread's state. - * If equal, then the current thread holds the lock, so the value can't - change until we yield the lock. -*/ -static int -PyThreadState_IsCurrent(PyThreadState *tstate) -{ - /* Must be the tstate for this thread */ - assert(PyGILState_GetThisThreadState()==tstate); - /* On Windows at least, simple reads and writes to 32 bit values - are atomic. - */ - return tstate == _PyThreadState_Current; -} - -/* Internal initialization/finalization functions called by - Py_Initialize/Py_Finalize -*/ -void -_PyGILState_Init(PyInterpreterState *i, PyThreadState *t) -{ - assert(i && t); /* must init with valid states */ - autoTLSkey = PyThread_create_key(); - autoInterpreterState = i; - assert(PyThread_get_key_value(autoTLSkey) == NULL); - assert(t->gilstate_counter == 0); - - _PyGILState_NoteThreadState(t); -} - -void -_PyGILState_Fini(void) -{ - PyThread_delete_key(autoTLSkey); - autoInterpreterState = NULL; -} - -/* When a thread state is created for a thread by some mechanism other than - PyGILState_Ensure, it's important that the GILState machinery knows about - it so it doesn't try to create another thread state for the thread (this is - a better fix for SF bug #1010677 than the first one attempted). -*/ -static void -_PyGILState_NoteThreadState(PyThreadState* tstate) -{ - /* If autoTLSkey isn't initialized, this must be the very first - threadstate created in Py_Initialize(). Don't do anything for now - (we'll be back here when _PyGILState_Init is called). */ - if (!autoInterpreterState) - return; - - /* Stick the thread state for this thread in thread local storage. - - The only situation where you can legitimately have more than one - thread state for an OS level thread is when there are multiple - interpreters, when: - - a) You shouldn't really be using the PyGILState_ APIs anyway, - and: - - b) The slightly odd way PyThread_set_key_value works (see - comments by its implementation) means that the first thread - state created for that given OS level thread will "win", - which seems reasonable behaviour. - */ - if (PyThread_set_key_value(autoTLSkey, (void *)tstate) < 0) - Py_FatalError("Couldn't create autoTLSkey mapping"); - - /* PyGILState_Release must not try to delete this thread state. */ - tstate->gilstate_counter = 1; -} - -/* The public functions */ -PyThreadState * -PyGILState_GetThisThreadState(void) -{ - if (autoInterpreterState == NULL) - return NULL; - return (PyThreadState *)PyThread_get_key_value(autoTLSkey); -} - -PyGILState_STATE -PyGILState_Ensure(void) -{ - int current; - PyThreadState *tcur; - /* Note that we do not auto-init Python here - apart from - potential races with 2 threads auto-initializing, pep-311 - spells out other issues. Embedders are expected to have - called Py_Initialize() and usually PyEval_InitThreads(). - */ - assert(autoInterpreterState); /* Py_Initialize() hasn't been called! */ - tcur = (PyThreadState *)PyThread_get_key_value(autoTLSkey); - if (tcur == NULL) { - /* Create a new thread state for this thread */ - tcur = PyThreadState_New(autoInterpreterState); - if (tcur == NULL) - Py_FatalError("Couldn't create thread-state for new thread"); - /* This is our thread state! We'll need to delete it in the - matching call to PyGILState_Release(). */ - tcur->gilstate_counter = 0; - current = 0; /* new thread state is never current */ - } - else - current = PyThreadState_IsCurrent(tcur); - if (current == 0) - PyEval_RestoreThread(tcur); - /* Update our counter in the thread-state - no need for locks: - - tcur will remain valid as we hold the GIL. - - the counter is safe as we are the only thread "allowed" - to modify this value - */ - ++tcur->gilstate_counter; - return current ? PyGILState_LOCKED : PyGILState_UNLOCKED; -} - -void -PyGILState_Release(PyGILState_STATE oldstate) -{ - PyThreadState *tcur = (PyThreadState *)PyThread_get_key_value( - autoTLSkey); - if (tcur == NULL) - Py_FatalError("auto-releasing thread-state, " - "but no thread-state for this thread"); - /* We must hold the GIL and have our thread state current */ - /* XXX - remove the check - the assert should be fine, - but while this is very new (April 2003), the extra check - by release-only users can't hurt. - */ - if (! PyThreadState_IsCurrent(tcur)) - Py_FatalError("This thread state must be current when releasing"); - assert(PyThreadState_IsCurrent(tcur)); - --tcur->gilstate_counter; - assert(tcur->gilstate_counter >= 0); /* illegal counter value */ - - /* If we're going to destroy this thread-state, we must - * clear it while the GIL is held, as destructors may run. - */ - if (tcur->gilstate_counter == 0) { - /* can't have been locked when we created it */ - assert(oldstate == PyGILState_UNLOCKED); - PyThreadState_Clear(tcur); - /* Delete the thread-state. Note this releases the GIL too! - * It's vital that the GIL be held here, to avoid shutdown - * races; see bugs 225673 and 1061968 (that nasty bug has a - * habit of coming back). - */ - PyThreadState_DeleteCurrent(); - } - /* Release the lock if necessary */ - else if (oldstate == PyGILState_UNLOCKED) - PyEval_SaveThread(); -} - -#endif /* WITH_THREAD */ - -#ifdef __cplusplus -} -#endif - - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pystrcmp.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pystrcmp.c deleted file mode 100644 index f1b12b4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pystrcmp.c +++ /dev/null @@ -1,26 +0,0 @@ -/* Cross platform case insensitive string compare functions - */ - -#include "Python.h" - -int -PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size) -{ - if (size == 0) - return 0; - while ((--size > 0) && - (tolower((unsigned)*s1) == tolower((unsigned)*s2))) { - if (!*s1++ || !*s2++) - break; - } - return tolower((unsigned)*s1) - tolower((unsigned)*s2); -} - -int -PyOS_mystricmp(const char *s1, const char *s2) -{ - while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) { - ; - } - return (tolower((unsigned)*s1) - tolower((unsigned)*s2)); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pystrtod.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pystrtod.c deleted file mode 100644 index 3d925a1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pystrtod.c +++ /dev/null @@ -1,1249 +0,0 @@ -/* -*- Mode: C; c-file-style: "python" -*- */ - -#include -#include - -/* Case-insensitive string match used for nan and inf detection; t should be - lower-case. Returns 1 for a successful match, 0 otherwise. */ - -static int -case_insensitive_match(const char *s, const char *t) -{ - while(*t && Py_TOLOWER(*s) == *t) { - s++; - t++; - } - return *t ? 0 : 1; -} - -/* _Py_parse_inf_or_nan: Attempt to parse a string of the form "nan", "inf" or - "infinity", with an optional leading sign of "+" or "-". On success, - return the NaN or Infinity as a double and set *endptr to point just beyond - the successfully parsed portion of the string. On failure, return -1.0 and - set *endptr to point to the start of the string. */ - -double -_Py_parse_inf_or_nan(const char *p, char **endptr) -{ - double retval; - const char *s; - int negate = 0; - - s = p; - if (*s == '-') { - negate = 1; - s++; - } - else if (*s == '+') { - s++; - } - if (case_insensitive_match(s, "inf")) { - s += 3; - if (case_insensitive_match(s, "inity")) - s += 5; - retval = negate ? -Py_HUGE_VAL : Py_HUGE_VAL; - } -#ifdef Py_NAN - else if (case_insensitive_match(s, "nan")) { - s += 3; - retval = negate ? -Py_NAN : Py_NAN; - } -#endif - else { - s = p; - retval = -1.0; - } - *endptr = (char *)s; - return retval; -} - -/** - * PyOS_ascii_strtod: - * @nptr: the string to convert to a numeric value. - * @endptr: if non-%NULL, it returns the character after - * the last character used in the conversion. - * - * Converts a string to a #gdouble value. - * This function behaves like the standard strtod() function - * does in the C locale. It does this without actually - * changing the current locale, since that would not be - * thread-safe. - * - * This function is typically used when reading configuration - * files or other non-user input that should be locale independent. - * To handle input from the user you should normally use the - * locale-sensitive system strtod() function. - * - * If the correct value would cause overflow, plus or minus %HUGE_VAL - * is returned (according to the sign of the value), and %ERANGE is - * stored in %errno. If the correct value would cause underflow, - * zero is returned and %ERANGE is stored in %errno. - * If memory allocation fails, %ENOMEM is stored in %errno. - * - * This function resets %errno before calling strtod() so that - * you can reliably detect overflow and underflow. - * - * Return value: the #gdouble value. - **/ - -#ifndef PY_NO_SHORT_FLOAT_REPR - -double -_PyOS_ascii_strtod(const char *nptr, char **endptr) -{ - double result; - _Py_SET_53BIT_PRECISION_HEADER; - - assert(nptr != NULL); - /* Set errno to zero, so that we can distinguish zero results - and underflows */ - errno = 0; - - _Py_SET_53BIT_PRECISION_START; - result = _Py_dg_strtod(nptr, endptr); - _Py_SET_53BIT_PRECISION_END; - - if (*endptr == nptr) - /* string might represent an inf or nan */ - result = _Py_parse_inf_or_nan(nptr, endptr); - - return result; - -} - -#else - -/* - Use system strtod; since strtod is locale aware, we may - have to first fix the decimal separator. - - Note that unlike _Py_dg_strtod, the system strtod may not always give - correctly rounded results. -*/ - -double -_PyOS_ascii_strtod(const char *nptr, char **endptr) -{ - char *fail_pos; - double val = -1.0; - struct lconv *locale_data; - const char *decimal_point; - size_t decimal_point_len; - const char *p, *decimal_point_pos; - const char *end = NULL; /* Silence gcc */ - const char *digits_pos = NULL; - int negate = 0; - - assert(nptr != NULL); - - fail_pos = NULL; - - locale_data = localeconv(); - decimal_point = locale_data->decimal_point; - decimal_point_len = strlen(decimal_point); - - assert(decimal_point_len != 0); - - decimal_point_pos = NULL; - - /* Parse infinities and nans */ - val = _Py_parse_inf_or_nan(nptr, endptr); - if (*endptr != nptr) - return val; - - /* Set errno to zero, so that we can distinguish zero results - and underflows */ - errno = 0; - - /* We process the optional sign manually, then pass the remainder to - the system strtod. This ensures that the result of an underflow - has the correct sign. (bug #1725) */ - p = nptr; - /* Process leading sign, if present */ - if (*p == '-') { - negate = 1; - p++; - } - else if (*p == '+') { - p++; - } - - /* Some platform strtods accept hex floats; Python shouldn't (at the - moment), so we check explicitly for strings starting with '0x'. */ - if (*p == '0' && (*(p+1) == 'x' || *(p+1) == 'X')) - goto invalid_string; - - /* Check that what's left begins with a digit or decimal point */ - if (!Py_ISDIGIT(*p) && *p != '.') - goto invalid_string; - - digits_pos = p; - if (decimal_point[0] != '.' || - decimal_point[1] != 0) - { - /* Look for a '.' in the input; if present, it'll need to be - swapped for the current locale's decimal point before we - call strtod. On the other hand, if we find the current - locale's decimal point then the input is invalid. */ - while (Py_ISDIGIT(*p)) - p++; - - if (*p == '.') - { - decimal_point_pos = p++; - - /* locate end of number */ - while (Py_ISDIGIT(*p)) - p++; - - if (*p == 'e' || *p == 'E') - p++; - if (*p == '+' || *p == '-') - p++; - while (Py_ISDIGIT(*p)) - p++; - end = p; - } - else if (strncmp(p, decimal_point, decimal_point_len) == 0) - /* Python bug #1417699 */ - goto invalid_string; - /* For the other cases, we need not convert the decimal - point */ - } - - if (decimal_point_pos) { - char *copy, *c; - /* Create a copy of the input, with the '.' converted to the - locale-specific decimal point */ - copy = (char *)PyMem_MALLOC(end - digits_pos + - 1 + decimal_point_len); - if (copy == NULL) { - *endptr = (char *)nptr; - errno = ENOMEM; - return val; - } - - c = copy; - memcpy(c, digits_pos, decimal_point_pos - digits_pos); - c += decimal_point_pos - digits_pos; - memcpy(c, decimal_point, decimal_point_len); - c += decimal_point_len; - memcpy(c, decimal_point_pos + 1, - end - (decimal_point_pos + 1)); - c += end - (decimal_point_pos + 1); - *c = 0; - - val = strtod(copy, &fail_pos); - - if (fail_pos) - { - if (fail_pos > decimal_point_pos) - fail_pos = (char *)digits_pos + - (fail_pos - copy) - - (decimal_point_len - 1); - else - fail_pos = (char *)digits_pos + - (fail_pos - copy); - } - - PyMem_FREE(copy); - - } - else { - val = strtod(digits_pos, &fail_pos); - } - - if (fail_pos == digits_pos) - goto invalid_string; - - if (negate && fail_pos != nptr) - val = -val; - *endptr = fail_pos; - - return val; - - invalid_string: - *endptr = (char*)nptr; - errno = EINVAL; - return -1.0; -} - -#endif - -/* PyOS_ascii_strtod is DEPRECATED in Python 2.7 and 3.1 */ - -double -PyOS_ascii_strtod(const char *nptr, char **endptr) -{ - char *fail_pos; - const char *p; - double x; - - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "PyOS_ascii_strtod and PyOS_ascii_atof are " - "deprecated. Use PyOS_string_to_double " - "instead.", 1) < 0) - return -1.0; - - /* _PyOS_ascii_strtod already does everything that we want, - except that it doesn't parse leading whitespace */ - p = nptr; - while (Py_ISSPACE(*p)) - p++; - x = _PyOS_ascii_strtod(p, &fail_pos); - if (fail_pos == p) - fail_pos = (char *)nptr; - if (endptr) - *endptr = (char *)fail_pos; - return x; -} - -/* PyOS_ascii_strtod is DEPRECATED in Python 2.7 and 3.1 */ - -double -PyOS_ascii_atof(const char *nptr) -{ - return PyOS_ascii_strtod(nptr, NULL); -} - -/* PyOS_string_to_double is the recommended replacement for the deprecated - PyOS_ascii_strtod and PyOS_ascii_atof functions. It converts a - null-terminated byte string s (interpreted as a string of ASCII characters) - to a float. The string should not have leading or trailing whitespace (in - contrast, PyOS_ascii_strtod allows leading whitespace but not trailing - whitespace). The conversion is independent of the current locale. - - If endptr is NULL, try to convert the whole string. Raise ValueError and - return -1.0 if the string is not a valid representation of a floating-point - number. - - If endptr is non-NULL, try to convert as much of the string as possible. - If no initial segment of the string is the valid representation of a - floating-point number then *endptr is set to point to the beginning of the - string, -1.0 is returned and again ValueError is raised. - - On overflow (e.g., when trying to convert '1e500' on an IEEE 754 machine), - if overflow_exception is NULL then +-Py_HUGE_VAL is returned, and no Python - exception is raised. Otherwise, overflow_exception should point to - a Python exception, this exception will be raised, -1.0 will be returned, - and *endptr will point just past the end of the converted value. - - If any other failure occurs (for example lack of memory), -1.0 is returned - and the appropriate Python exception will have been set. -*/ - -double -PyOS_string_to_double(const char *s, - char **endptr, - PyObject *overflow_exception) -{ - double x, result=-1.0; - char *fail_pos; - - errno = 0; - PyFPE_START_PROTECT("PyOS_string_to_double", return -1.0) - x = _PyOS_ascii_strtod(s, &fail_pos); - PyFPE_END_PROTECT(x) - - if (errno == ENOMEM) { - PyErr_NoMemory(); - fail_pos = (char *)s; - } - else if (!endptr && (fail_pos == s || *fail_pos != '\0')) - PyErr_Format(PyExc_ValueError, - "could not convert string to float: " - "%.200s", s); - else if (fail_pos == s) - PyErr_Format(PyExc_ValueError, - "could not convert string to float: " - "%.200s", s); - else if (errno == ERANGE && fabs(x) >= 1.0 && overflow_exception) - PyErr_Format(overflow_exception, - "value too large to convert to float: " - "%.200s", s); - else - result = x; - - if (endptr != NULL) - *endptr = fail_pos; - return result; -} - -/* Given a string that may have a decimal point in the current - locale, change it back to a dot. Since the string cannot get - longer, no need for a maximum buffer size parameter. */ -Py_LOCAL_INLINE(void) -change_decimal_from_locale_to_dot(char* buffer) -{ - struct lconv *locale_data = localeconv(); - const char *decimal_point = locale_data->decimal_point; - - if (decimal_point[0] != '.' || decimal_point[1] != 0) { - size_t decimal_point_len = strlen(decimal_point); - - if (*buffer == '+' || *buffer == '-') - buffer++; - while (Py_ISDIGIT(*buffer)) - buffer++; - if (strncmp(buffer, decimal_point, decimal_point_len) == 0) { - *buffer = '.'; - buffer++; - if (decimal_point_len > 1) { - /* buffer needs to get smaller */ - size_t rest_len = strlen(buffer + - (decimal_point_len - 1)); - memmove(buffer, - buffer + (decimal_point_len - 1), - rest_len); - buffer[rest_len] = 0; - } - } - } -} - - -/* From the C99 standard, section 7.19.6: -The exponent always contains at least two digits, and only as many more digits -as necessary to represent the exponent. -*/ -#define MIN_EXPONENT_DIGITS 2 - -/* Ensure that any exponent, if present, is at least MIN_EXPONENT_DIGITS - in length. */ -Py_LOCAL_INLINE(void) -ensure_minimum_exponent_length(char* buffer, size_t buf_size) -{ - char *p = strpbrk(buffer, "eE"); - if (p && (*(p + 1) == '-' || *(p + 1) == '+')) { - char *start = p + 2; - int exponent_digit_cnt = 0; - int leading_zero_cnt = 0; - int in_leading_zeros = 1; - int significant_digit_cnt; - - /* Skip over the exponent and the sign. */ - p += 2; - - /* Find the end of the exponent, keeping track of leading - zeros. */ - while (*p && Py_ISDIGIT(*p)) { - if (in_leading_zeros && *p == '0') - ++leading_zero_cnt; - if (*p != '0') - in_leading_zeros = 0; - ++p; - ++exponent_digit_cnt; - } - - significant_digit_cnt = exponent_digit_cnt - leading_zero_cnt; - if (exponent_digit_cnt == MIN_EXPONENT_DIGITS) { - /* If there are 2 exactly digits, we're done, - regardless of what they contain */ - } - else if (exponent_digit_cnt > MIN_EXPONENT_DIGITS) { - int extra_zeros_cnt; - - /* There are more than 2 digits in the exponent. See - if we can delete some of the leading zeros */ - if (significant_digit_cnt < MIN_EXPONENT_DIGITS) - significant_digit_cnt = MIN_EXPONENT_DIGITS; - extra_zeros_cnt = exponent_digit_cnt - - significant_digit_cnt; - - /* Delete extra_zeros_cnt worth of characters from the - front of the exponent */ - assert(extra_zeros_cnt >= 0); - - /* Add one to significant_digit_cnt to copy the - trailing 0 byte, thus setting the length */ - memmove(start, - start + extra_zeros_cnt, - significant_digit_cnt + 1); - } - else { - /* If there are fewer than 2 digits, add zeros - until there are 2, if there's enough room */ - int zeros = MIN_EXPONENT_DIGITS - exponent_digit_cnt; - if (start + zeros + exponent_digit_cnt + 1 - < buffer + buf_size) { - memmove(start + zeros, start, - exponent_digit_cnt + 1); - memset(start, '0', zeros); - } - } - } -} - -/* Remove trailing zeros after the decimal point from a numeric string; also - remove the decimal point if all digits following it are zero. The numeric - string must end in '\0', and should not have any leading or trailing - whitespace. Assumes that the decimal point is '.'. */ -Py_LOCAL_INLINE(void) -remove_trailing_zeros(char *buffer) -{ - char *old_fraction_end, *new_fraction_end, *end, *p; - - p = buffer; - if (*p == '-' || *p == '+') - /* Skip leading sign, if present */ - ++p; - while (Py_ISDIGIT(*p)) - ++p; - - /* if there's no decimal point there's nothing to do */ - if (*p++ != '.') - return; - - /* scan any digits after the point */ - while (Py_ISDIGIT(*p)) - ++p; - old_fraction_end = p; - - /* scan up to ending '\0' */ - while (*p != '\0') - p++; - /* +1 to make sure that we move the null byte as well */ - end = p+1; - - /* scan back from fraction_end, looking for removable zeros */ - p = old_fraction_end; - while (*(p-1) == '0') - --p; - /* and remove point if we've got that far */ - if (*(p-1) == '.') - --p; - new_fraction_end = p; - - memmove(new_fraction_end, old_fraction_end, end-old_fraction_end); -} - -/* Ensure that buffer has a decimal point in it. The decimal point will not - be in the current locale, it will always be '.'. Don't add a decimal point - if an exponent is present. Also, convert to exponential notation where - adding a '.0' would produce too many significant digits (see issue 5864). - - Returns a pointer to the fixed buffer, or NULL on failure. -*/ -Py_LOCAL_INLINE(char *) -ensure_decimal_point(char* buffer, size_t buf_size, int precision) -{ - int digit_count, insert_count = 0, convert_to_exp = 0; - char *chars_to_insert, *digits_start; - - /* search for the first non-digit character */ - char *p = buffer; - if (*p == '-' || *p == '+') - /* Skip leading sign, if present. I think this could only - ever be '-', but it can't hurt to check for both. */ - ++p; - digits_start = p; - while (*p && Py_ISDIGIT(*p)) - ++p; - digit_count = Py_SAFE_DOWNCAST(p - digits_start, Py_ssize_t, int); - - if (*p == '.') { - if (Py_ISDIGIT(*(p+1))) { - /* Nothing to do, we already have a decimal - point and a digit after it */ - } - else { - /* We have a decimal point, but no following - digit. Insert a zero after the decimal. */ - /* can't ever get here via PyOS_double_to_string */ - assert(precision == -1); - ++p; - chars_to_insert = "0"; - insert_count = 1; - } - } - else if (!(*p == 'e' || *p == 'E')) { - /* Don't add ".0" if we have an exponent. */ - if (digit_count == precision) { - /* issue 5864: don't add a trailing .0 in the case - where the '%g'-formatted result already has as many - significant digits as were requested. Switch to - exponential notation instead. */ - convert_to_exp = 1; - /* no exponent, no point, and we shouldn't land here - for infs and nans, so we must be at the end of the - string. */ - assert(*p == '\0'); - } - else { - assert(precision == -1 || digit_count < precision); - chars_to_insert = ".0"; - insert_count = 2; - } - } - if (insert_count) { - size_t buf_len = strlen(buffer); - if (buf_len + insert_count + 1 >= buf_size) { - /* If there is not enough room in the buffer - for the additional text, just skip it. It's - not worth generating an error over. */ - } - else { - memmove(p + insert_count, p, - buffer + strlen(buffer) - p + 1); - memcpy(p, chars_to_insert, insert_count); - } - } - if (convert_to_exp) { - int written; - size_t buf_avail; - p = digits_start; - /* insert decimal point */ - assert(digit_count >= 1); - memmove(p+2, p+1, digit_count); /* safe, but overwrites nul */ - p[1] = '.'; - p += digit_count+1; - assert(p <= buf_size+buffer); - buf_avail = buf_size+buffer-p; - if (buf_avail == 0) - return NULL; - /* Add exponent. It's okay to use lower case 'e': we only - arrive here as a result of using the empty format code or - repr/str builtins and those never want an upper case 'E' */ - written = PyOS_snprintf(p, buf_avail, "e%+.02d", digit_count-1); - if (!(0 <= written && - written < Py_SAFE_DOWNCAST(buf_avail, size_t, int))) - /* output truncated, or something else bad happened */ - return NULL; - remove_trailing_zeros(buffer); - } - return buffer; -} - -/* see FORMATBUFLEN in unicodeobject.c */ -#define FLOAT_FORMATBUFLEN 120 - -/** - * PyOS_ascii_formatd: - * @buffer: A buffer to place the resulting string in - * @buf_size: The length of the buffer. - * @format: The printf()-style format to use for the - * code to use for converting. - * @d: The #gdouble to convert - * - * Converts a #gdouble to a string, using the '.' as - * decimal point. To format the number you pass in - * a printf()-style format string. Allowed conversion - * specifiers are 'e', 'E', 'f', 'F', 'g', 'G', and 'Z'. - * - * 'Z' is the same as 'g', except it always has a decimal and - * at least one digit after the decimal. - * - * Return value: The pointer to the buffer with the converted string. - * On failure returns NULL but does not set any Python exception. - **/ -char * -_PyOS_ascii_formatd(char *buffer, - size_t buf_size, - const char *format, - double d, - int precision) -{ - char format_char; - size_t format_len = strlen(format); - - /* Issue 2264: code 'Z' requires copying the format. 'Z' is 'g', but - also with at least one character past the decimal. */ - char tmp_format[FLOAT_FORMATBUFLEN]; - - /* The last character in the format string must be the format char */ - format_char = format[format_len - 1]; - - if (format[0] != '%') - return NULL; - - /* I'm not sure why this test is here. It's ensuring that the format - string after the first character doesn't have a single quote, a - lowercase l, or a percent. This is the reverse of the commented-out - test about 10 lines ago. */ - if (strpbrk(format + 1, "'l%")) - return NULL; - - /* Also curious about this function is that it accepts format strings - like "%xg", which are invalid for floats. In general, the - interface to this function is not very good, but changing it is - difficult because it's a public API. */ - - if (!(format_char == 'e' || format_char == 'E' || - format_char == 'f' || format_char == 'F' || - format_char == 'g' || format_char == 'G' || - format_char == 'Z')) - return NULL; - - /* Map 'Z' format_char to 'g', by copying the format string and - replacing the final char with a 'g' */ - if (format_char == 'Z') { - if (format_len + 1 >= sizeof(tmp_format)) { - /* The format won't fit in our copy. Error out. In - practice, this will never happen and will be - detected by returning NULL */ - return NULL; - } - strcpy(tmp_format, format); - tmp_format[format_len - 1] = 'g'; - format = tmp_format; - } - - - /* Have PyOS_snprintf do the hard work */ - PyOS_snprintf(buffer, buf_size, format, d); - - /* Do various fixups on the return string */ - - /* Get the current locale, and find the decimal point string. - Convert that string back to a dot. */ - change_decimal_from_locale_to_dot(buffer); - - /* If an exponent exists, ensure that the exponent is at least - MIN_EXPONENT_DIGITS digits, providing the buffer is large enough - for the extra zeros. Also, if there are more than - MIN_EXPONENT_DIGITS, remove as many zeros as possible until we get - back to MIN_EXPONENT_DIGITS */ - ensure_minimum_exponent_length(buffer, buf_size); - - /* If format_char is 'Z', make sure we have at least one character - after the decimal point (and make sure we have a decimal point); - also switch to exponential notation in some edge cases where the - extra character would produce more significant digits that we - really want. */ - if (format_char == 'Z') - buffer = ensure_decimal_point(buffer, buf_size, precision); - - return buffer; -} - -char * -PyOS_ascii_formatd(char *buffer, - size_t buf_size, - const char *format, - double d) -{ - if (PyErr_WarnEx(PyExc_DeprecationWarning, - "PyOS_ascii_formatd is deprecated, " - "use PyOS_double_to_string instead", 1) < 0) - return NULL; - - return _PyOS_ascii_formatd(buffer, buf_size, format, d, -1); -} - -#ifdef PY_NO_SHORT_FLOAT_REPR - -/* The fallback code to use if _Py_dg_dtoa is not available. */ - -PyAPI_FUNC(char *) PyOS_double_to_string(double val, - char format_code, - int precision, - int flags, - int *type) -{ - char format[32]; - Py_ssize_t bufsize; - char *buf; - int t, exp; - int upper = 0; - - /* Validate format_code, and map upper and lower case */ - switch (format_code) { - case 'e': /* exponent */ - case 'f': /* fixed */ - case 'g': /* general */ - break; - case 'E': - upper = 1; - format_code = 'e'; - break; - case 'F': - upper = 1; - format_code = 'f'; - break; - case 'G': - upper = 1; - format_code = 'g'; - break; - case 'r': /* repr format */ - /* Supplied precision is unused, must be 0. */ - if (precision != 0) { - PyErr_BadInternalCall(); - return NULL; - } - /* The repr() precision (17 significant decimal digits) is the - minimal number that is guaranteed to have enough precision - so that if the number is read back in the exact same binary - value is recreated. This is true for IEEE floating point - by design, and also happens to work for all other modern - hardware. */ - precision = 17; - format_code = 'g'; - break; - default: - PyErr_BadInternalCall(); - return NULL; - } - - /* Here's a quick-and-dirty calculation to figure out how big a buffer - we need. In general, for a finite float we need: - - 1 byte for each digit of the decimal significand, and - - 1 for a possible sign - 1 for a possible decimal point - 2 for a possible [eE][+-] - 1 for each digit of the exponent; if we allow 19 digits - total then we're safe up to exponents of 2**63. - 1 for the trailing nul byte - - This gives a total of 24 + the number of digits in the significand, - and the number of digits in the significand is: - - for 'g' format: at most precision, except possibly - when precision == 0, when it's 1. - for 'e' format: precision+1 - for 'f' format: precision digits after the point, at least 1 - before. To figure out how many digits appear before the point - we have to examine the size of the number. If fabs(val) < 1.0 - then there will be only one digit before the point. If - fabs(val) >= 1.0, then there are at most - - 1+floor(log10(ceiling(fabs(val)))) - - digits before the point (where the 'ceiling' allows for the - possibility that the rounding rounds the integer part of val - up). A safe upper bound for the above quantity is - 1+floor(exp/3), where exp is the unique integer such that 0.5 - <= fabs(val)/2**exp < 1.0. This exp can be obtained from - frexp. - - So we allow room for precision+1 digits for all formats, plus an - extra floor(exp/3) digits for 'f' format. - - */ - - if (Py_IS_NAN(val) || Py_IS_INFINITY(val)) - /* 3 for 'inf'/'nan', 1 for sign, 1 for '\0' */ - bufsize = 5; - else { - bufsize = 25 + precision; - if (format_code == 'f' && fabs(val) >= 1.0) { - frexp(val, &exp); - bufsize += exp/3; - } - } - - buf = PyMem_Malloc(bufsize); - if (buf == NULL) { - PyErr_NoMemory(); - return NULL; - } - - /* Handle nan and inf. */ - if (Py_IS_NAN(val)) { - strcpy(buf, "nan"); - t = Py_DTST_NAN; - } else if (Py_IS_INFINITY(val)) { - if (copysign(1., val) == 1.) - strcpy(buf, "inf"); - else - strcpy(buf, "-inf"); - t = Py_DTST_INFINITE; - } else { - t = Py_DTST_FINITE; - if (flags & Py_DTSF_ADD_DOT_0) - format_code = 'Z'; - - PyOS_snprintf(format, sizeof(format), "%%%s.%i%c", - (flags & Py_DTSF_ALT ? "#" : ""), precision, - format_code); - _PyOS_ascii_formatd(buf, bufsize, format, val, precision); - } - - /* Add sign when requested. It's convenient (esp. when formatting - complex numbers) to include a sign even for inf and nan. */ - if (flags & Py_DTSF_SIGN && buf[0] != '-') { - size_t len = strlen(buf); - /* the bufsize calculations above should ensure that we've got - space to add a sign */ - assert((size_t)bufsize >= len+2); - memmove(buf+1, buf, len+1); - buf[0] = '+'; - } - if (upper) { - /* Convert to upper case. */ - char *p1; - for (p1 = buf; *p1; p1++) - *p1 = Py_TOUPPER(*p1); - } - - if (type) - *type = t; - return buf; -} - -#else - -/* _Py_dg_dtoa is available. */ - -/* I'm using a lookup table here so that I don't have to invent a non-locale - specific way to convert to uppercase */ -#define OFS_INF 0 -#define OFS_NAN 1 -#define OFS_E 2 - -/* The lengths of these are known to the code below, so don't change them */ -static char *lc_float_strings[] = { - "inf", - "nan", - "e", -}; -static char *uc_float_strings[] = { - "INF", - "NAN", - "E", -}; - - -/* Convert a double d to a string, and return a PyMem_Malloc'd block of - memory contain the resulting string. - - Arguments: - d is the double to be converted - format_code is one of 'e', 'f', 'g', 'r'. 'e', 'f' and 'g' - correspond to '%e', '%f' and '%g'; 'r' corresponds to repr. - mode is one of '0', '2' or '3', and is completely determined by - format_code: 'e' and 'g' use mode 2; 'f' mode 3, 'r' mode 0. - precision is the desired precision - always_add_sign is nonzero if a '+' sign should be included for positive - numbers - add_dot_0_if_integer is nonzero if integers in non-exponential form - should have ".0" added. Only applies to format codes 'r' and 'g'. - use_alt_formatting is nonzero if alternative formatting should be - used. Only applies to format codes 'e', 'f' and 'g'. For code 'g', - at most one of use_alt_formatting and add_dot_0_if_integer should - be nonzero. - type, if non-NULL, will be set to one of these constants to identify - the type of the 'd' argument: - Py_DTST_FINITE - Py_DTST_INFINITE - Py_DTST_NAN - - Returns a PyMem_Malloc'd block of memory containing the resulting string, - or NULL on error. If NULL is returned, the Python error has been set. - */ - -static char * -format_float_short(double d, char format_code, - int mode, Py_ssize_t precision, - int always_add_sign, int add_dot_0_if_integer, - int use_alt_formatting, char **float_strings, int *type) -{ - char *buf = NULL; - char *p = NULL; - Py_ssize_t bufsize = 0; - char *digits, *digits_end; - int decpt_as_int, sign, exp_len, exp = 0, use_exp = 0; - Py_ssize_t decpt, digits_len, vdigits_start, vdigits_end; - _Py_SET_53BIT_PRECISION_HEADER; - - /* _Py_dg_dtoa returns a digit string (no decimal point or exponent). - Must be matched by a call to _Py_dg_freedtoa. */ - _Py_SET_53BIT_PRECISION_START; - digits = _Py_dg_dtoa(d, mode, precision, &decpt_as_int, &sign, - &digits_end); - _Py_SET_53BIT_PRECISION_END; - - decpt = (Py_ssize_t)decpt_as_int; - if (digits == NULL) { - /* The only failure mode is no memory. */ - PyErr_NoMemory(); - goto exit; - } - assert(digits_end != NULL && digits_end >= digits); - digits_len = digits_end - digits; - - if (digits_len && !Py_ISDIGIT(digits[0])) { - /* Infinities and nans here; adapt Gay's output, - so convert Infinity to inf and NaN to nan, and - ignore sign of nan. Then return. */ - - /* ignore the actual sign of a nan */ - if (digits[0] == 'n' || digits[0] == 'N') - sign = 0; - - /* We only need 5 bytes to hold the result "+inf\0" . */ - bufsize = 5; /* Used later in an assert. */ - buf = (char *)PyMem_Malloc(bufsize); - if (buf == NULL) { - PyErr_NoMemory(); - goto exit; - } - p = buf; - - if (sign == 1) { - *p++ = '-'; - } - else if (always_add_sign) { - *p++ = '+'; - } - if (digits[0] == 'i' || digits[0] == 'I') { - strncpy(p, float_strings[OFS_INF], 3); - p += 3; - - if (type) - *type = Py_DTST_INFINITE; - } - else if (digits[0] == 'n' || digits[0] == 'N') { - strncpy(p, float_strings[OFS_NAN], 3); - p += 3; - - if (type) - *type = Py_DTST_NAN; - } - else { - /* shouldn't get here: Gay's code should always return - something starting with a digit, an 'I', or 'N' */ - strncpy(p, "ERR", 3); - p += 3; - assert(0); - } - goto exit; - } - - /* The result must be finite (not inf or nan). */ - if (type) - *type = Py_DTST_FINITE; - - - /* We got digits back, format them. We may need to pad 'digits' - either on the left or right (or both) with extra zeros, so in - general the resulting string has the form - - [][] - - where either of the pieces could be empty, and there's a - decimal point that could appear either in or in the - leading or trailing . - - Imagine an infinite 'virtual' string vdigits, consisting of the - string 'digits' (starting at index 0) padded on both the left and - right with infinite strings of zeros. We want to output a slice - - vdigits[vdigits_start : vdigits_end] - - of this virtual string. Thus if vdigits_start < 0 then we'll end - up producing some leading zeros; if vdigits_end > digits_len there - will be trailing zeros in the output. The next section of code - determines whether to use an exponent or not, figures out the - position 'decpt' of the decimal point, and computes 'vdigits_start' - and 'vdigits_end'. */ - vdigits_end = digits_len; - switch (format_code) { - case 'e': - use_exp = 1; - vdigits_end = precision; - break; - case 'f': - vdigits_end = decpt + precision; - break; - case 'g': - if (decpt <= -4 || decpt > - (add_dot_0_if_integer ? precision-1 : precision)) - use_exp = 1; - if (use_alt_formatting) - vdigits_end = precision; - break; - case 'r': - /* convert to exponential format at 1e16. We used to convert - at 1e17, but that gives odd-looking results for some values - when a 16-digit 'shortest' repr is padded with bogus zeros. - For example, repr(2e16+8) would give 20000000000000010.0; - the true value is 20000000000000008.0. */ - if (decpt <= -4 || decpt > 16) - use_exp = 1; - break; - default: - PyErr_BadInternalCall(); - goto exit; - } - - /* if using an exponent, reset decimal point position to 1 and adjust - exponent accordingly.*/ - if (use_exp) { - exp = decpt - 1; - decpt = 1; - } - /* ensure vdigits_start < decpt <= vdigits_end, or vdigits_start < - decpt < vdigits_end if add_dot_0_if_integer and no exponent */ - vdigits_start = decpt <= 0 ? decpt-1 : 0; - if (!use_exp && add_dot_0_if_integer) - vdigits_end = vdigits_end > decpt ? vdigits_end : decpt + 1; - else - vdigits_end = vdigits_end > decpt ? vdigits_end : decpt; - - /* double check inequalities */ - assert(vdigits_start <= 0 && - 0 <= digits_len && - digits_len <= vdigits_end); - /* decimal point should be in (vdigits_start, vdigits_end] */ - assert(vdigits_start < decpt && decpt <= vdigits_end); - - /* Compute an upper bound how much memory we need. This might be a few - chars too long, but no big deal. */ - bufsize = - /* sign, decimal point and trailing 0 byte */ - 3 + - - /* total digit count (including zero padding on both sides) */ - (vdigits_end - vdigits_start) + - - /* exponent "e+100", max 3 numerical digits */ - (use_exp ? 5 : 0); - - /* Now allocate the memory and initialize p to point to the start of - it. */ - buf = (char *)PyMem_Malloc(bufsize); - if (buf == NULL) { - PyErr_NoMemory(); - goto exit; - } - p = buf; - - /* Add a negative sign if negative, and a plus sign if non-negative - and always_add_sign is true. */ - if (sign == 1) - *p++ = '-'; - else if (always_add_sign) - *p++ = '+'; - - /* note that exactly one of the three 'if' conditions is true, - so we include exactly one decimal point */ - /* Zero padding on left of digit string */ - if (decpt <= 0) { - memset(p, '0', decpt-vdigits_start); - p += decpt - vdigits_start; - *p++ = '.'; - memset(p, '0', 0-decpt); - p += 0-decpt; - } - else { - memset(p, '0', 0-vdigits_start); - p += 0 - vdigits_start; - } - - /* Digits, with included decimal point */ - if (0 < decpt && decpt <= digits_len) { - strncpy(p, digits, decpt-0); - p += decpt-0; - *p++ = '.'; - strncpy(p, digits+decpt, digits_len-decpt); - p += digits_len-decpt; - } - else { - strncpy(p, digits, digits_len); - p += digits_len; - } - - /* And zeros on the right */ - if (digits_len < decpt) { - memset(p, '0', decpt-digits_len); - p += decpt-digits_len; - *p++ = '.'; - memset(p, '0', vdigits_end-decpt); - p += vdigits_end-decpt; - } - else { - memset(p, '0', vdigits_end-digits_len); - p += vdigits_end-digits_len; - } - - /* Delete a trailing decimal pt unless using alternative formatting. */ - if (p[-1] == '.' && !use_alt_formatting) - p--; - - /* Now that we've done zero padding, add an exponent if needed. */ - if (use_exp) { - *p++ = float_strings[OFS_E][0]; - exp_len = sprintf(p, "%+.02d", exp); - p += exp_len; - } - exit: - if (buf) { - *p = '\0'; - /* It's too late if this fails, as we've already stepped on - memory that isn't ours. But it's an okay debugging test. */ - assert(p-buf < bufsize); - } - if (digits) - _Py_dg_freedtoa(digits); - - return buf; -} - - -PyAPI_FUNC(char *) PyOS_double_to_string(double val, - char format_code, - int precision, - int flags, - int *type) -{ - char **float_strings = lc_float_strings; - int mode; - - /* Validate format_code, and map upper and lower case. Compute the - mode and make any adjustments as needed. */ - switch (format_code) { - /* exponent */ - case 'E': - float_strings = uc_float_strings; - format_code = 'e'; - /* Fall through. */ - case 'e': - mode = 2; - precision++; - break; - - /* fixed */ - case 'F': - float_strings = uc_float_strings; - format_code = 'f'; - /* Fall through. */ - case 'f': - mode = 3; - break; - - /* general */ - case 'G': - float_strings = uc_float_strings; - format_code = 'g'; - /* Fall through. */ - case 'g': - mode = 2; - /* precision 0 makes no sense for 'g' format; interpret as 1 */ - if (precision == 0) - precision = 1; - break; - - /* repr format */ - case 'r': - mode = 0; - /* Supplied precision is unused, must be 0. */ - if (precision != 0) { - PyErr_BadInternalCall(); - return NULL; - } - break; - - default: - PyErr_BadInternalCall(); - return NULL; - } - - return format_float_short(val, format_code, mode, precision, - flags & Py_DTSF_SIGN, - flags & Py_DTSF_ADD_DOT_0, - flags & Py_DTSF_ALT, - float_strings, type); -} -#endif /* ifdef PY_NO_SHORT_FLOAT_REPR */ diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/pythonrun.c b/AppPkg/Applications/Python/Python-2.7.10/Python/pythonrun.c deleted file mode 100644 index 0f76758..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/pythonrun.c +++ /dev/null @@ -1,2029 +0,0 @@ - -/* Python interpreter top-level routines, including init/exit */ - -#include "Python.h" - -#include "Python-ast.h" -#undef Yield /* undefine macro conflicting with winbase.h */ -#include "grammar.h" -#include "node.h" -#include "token.h" -#include "parsetok.h" -#include "errcode.h" -#include "code.h" -#include "compile.h" -#include "symtable.h" -#include "pyarena.h" -#include "ast.h" -#include "eval.h" -#include "marshal.h" -#include "abstract.h" - -#ifdef HAVE_SIGNAL_H -#include -#endif - -#ifdef MS_WINDOWS -#include "malloc.h" /* for alloca */ -#endif - -#ifdef HAVE_LANGINFO_H -#include -#include -#endif - -#ifdef MS_WINDOWS -#undef BYTE -#include "windows.h" -#endif - -#ifndef Py_REF_DEBUG -#define PRINT_TOTAL_REFS() -#else /* Py_REF_DEBUG */ -#define PRINT_TOTAL_REFS() fprintf(stderr, \ - "[%" PY_FORMAT_SIZE_T "d refs]\n", \ - _Py_GetRefTotal()) -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *Py_GetPath(void); - -extern grammar _PyParser_Grammar; /* From graminit.c */ - -/* Forward */ -static void initmain(void); -static void initsite(void); -static PyObject *run_mod(mod_ty, const char *, PyObject *, PyObject *, - PyCompilerFlags *, PyArena *); -static PyObject *run_pyc_file(FILE *, const char *, PyObject *, PyObject *, - PyCompilerFlags *); -static void err_input(perrdetail *); -static void initsigs(void); -static void wait_for_thread_shutdown(void); -static void call_sys_exitfunc(void); -static void call_ll_exitfuncs(void); -extern void _PyUnicode_Init(void); -extern void _PyUnicode_Fini(void); - -#ifdef WITH_THREAD -extern void _PyGILState_Init(PyInterpreterState *, PyThreadState *); -extern void _PyGILState_Fini(void); -#endif /* WITH_THREAD */ - -int Py_DebugFlag; /* Needed by parser.c */ -int Py_VerboseFlag; /* Needed by import.c */ -int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */ -int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */ -int Py_NoSiteFlag; /* Suppress 'import site' */ -int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */ -int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */ -int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */ -int Py_FrozenFlag; /* Needed by getpath.c */ -int Py_UnicodeFlag = 0; /* Needed by compile.c */ -int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */ -/* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed, - on the command line, and is used in 2.2 by ceval.c to make all "/" divisions - true divisions (which they will be in 2.3). */ -int _Py_QnewFlag = 0; -int Py_NoUserSiteDirectory = 0; /* for -s and site.py */ -int Py_HashRandomizationFlag = 0; /* for -R and PYTHONHASHSEED */ - - -/* Hack to force loading of object files */ -int (*_PyOS_mystrnicmp_hack)(const char *, const char *, Py_ssize_t) = \ - PyOS_mystrnicmp; /* Python/pystrcmp.o */ - -/* PyModule_GetWarningsModule is no longer necessary as of 2.6 -since _warnings is builtin. This API should not be used. */ -PyObject * -PyModule_GetWarningsModule(void) -{ - return PyImport_ImportModule("warnings"); -} - -static int initialized = 0; - -/* API to access the initialized flag -- useful for esoteric use */ - -int -Py_IsInitialized(void) -{ - return initialized; -} - -/* Global initializations. Can be undone by Py_Finalize(). Don't - call this twice without an intervening Py_Finalize() call. When - initializations fail, a fatal error is issued and the function does - not return. On return, the first thread and interpreter state have - been created. - - Locking: you must hold the interpreter lock while calling this. - (If the lock has not yet been initialized, that's equivalent to - having the lock, but you cannot use multiple threads.) - -*/ - -static int -add_flag(int flag, const char *envs) -{ - int env = atoi(envs); - if (flag < env) - flag = env; - if (flag < 1) - flag = 1; - return flag; -} - -void -Py_InitializeEx(int install_sigs) -{ - PyInterpreterState *interp; - PyThreadState *tstate; - PyObject *bimod, *sysmod; - char *p; - char *icodeset = NULL; /* On Windows, input codeset may theoretically - differ from output codeset. */ - char *codeset = NULL; - char *errors = NULL; - int free_codeset = 0; - int overridden = 0; - PyObject *sys_stream, *sys_isatty; -#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) - char *saved_locale, *loc_codeset; -#endif -#ifdef MS_WINDOWS - char ibuf[128]; - char buf[128]; -#endif - extern void _Py_ReadyTypes(void); - - if (initialized) - return; - initialized = 1; - - if ((p = Py_GETENV("PYTHONDEBUG")) && *p != '\0') - Py_DebugFlag = add_flag(Py_DebugFlag, p); - if ((p = Py_GETENV("PYTHONVERBOSE")) && *p != '\0') - Py_VerboseFlag = add_flag(Py_VerboseFlag, p); - if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0') - Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p); - if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0') - Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p); - /* The variable is only tested for existence here; _PyRandom_Init will - check its value further. */ - if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0') - Py_HashRandomizationFlag = add_flag(Py_HashRandomizationFlag, p); - - _PyRandom_Init(); - - interp = PyInterpreterState_New(); - if (interp == NULL) - Py_FatalError("Py_Initialize: can't make first interpreter"); - - tstate = PyThreadState_New(interp); - if (tstate == NULL) - Py_FatalError("Py_Initialize: can't make first thread"); - (void) PyThreadState_Swap(tstate); - - _Py_ReadyTypes(); - - if (!_PyFrame_Init()) - Py_FatalError("Py_Initialize: can't init frames"); - - if (!_PyInt_Init()) - Py_FatalError("Py_Initialize: can't init ints"); - - if (!_PyLong_Init()) - Py_FatalError("Py_Initialize: can't init longs"); - - if (!PyByteArray_Init()) - Py_FatalError("Py_Initialize: can't init bytearray"); - - _PyFloat_Init(); - - interp->modules = PyDict_New(); - if (interp->modules == NULL) - Py_FatalError("Py_Initialize: can't make modules dictionary"); - interp->modules_reloading = PyDict_New(); - if (interp->modules_reloading == NULL) - Py_FatalError("Py_Initialize: can't make modules_reloading dictionary"); - -#ifdef Py_USING_UNICODE - /* Init Unicode implementation; relies on the codec registry */ - _PyUnicode_Init(); -#endif - - bimod = _PyBuiltin_Init(); - if (bimod == NULL) - Py_FatalError("Py_Initialize: can't initialize __builtin__"); - interp->builtins = PyModule_GetDict(bimod); - if (interp->builtins == NULL) - Py_FatalError("Py_Initialize: can't initialize builtins dict"); - Py_INCREF(interp->builtins); - - sysmod = _PySys_Init(); - if (sysmod == NULL) - Py_FatalError("Py_Initialize: can't initialize sys"); - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - Py_FatalError("Py_Initialize: can't initialize sys dict"); - Py_INCREF(interp->sysdict); - _PyImport_FixupExtension("sys", "sys"); - PySys_SetPath(Py_GetPath()); - PyDict_SetItemString(interp->sysdict, "modules", - interp->modules); - - _PyImport_Init(); - - /* initialize builtin exceptions */ - _PyExc_Init(); - _PyImport_FixupExtension("exceptions", "exceptions"); - - /* phase 2 of builtins */ - _PyImport_FixupExtension("__builtin__", "__builtin__"); - - _PyImportHooks_Init(); - - if (install_sigs) - initsigs(); /* Signal handling stuff, including initintr() */ - - /* Initialize warnings. */ - _PyWarnings_Init(); - if (PySys_HasWarnOptions()) { - PyObject *warnings_module = PyImport_ImportModule("warnings"); - if (!warnings_module) - PyErr_Clear(); - Py_XDECREF(warnings_module); - } - - initmain(); /* Module __main__ */ - - /* auto-thread-state API, if available */ -#ifdef WITH_THREAD - _PyGILState_Init(interp, tstate); -#endif /* WITH_THREAD */ - - if (!Py_NoSiteFlag) - initsite(); /* Module site */ - - if ((p = Py_GETENV("PYTHONIOENCODING")) && *p != '\0') { - p = icodeset = codeset = strdup(p); - free_codeset = 1; - errors = strchr(p, ':'); - if (errors) { - *errors = '\0'; - errors++; - } - overridden = 1; - } - -#if defined(Py_USING_UNICODE) && defined(HAVE_LANGINFO_H) && defined(CODESET) - /* On Unix, set the file system encoding according to the - user's preference, if the CODESET names a well-known - Python codec, and Py_FileSystemDefaultEncoding isn't - initialized by other means. Also set the encoding of - stdin and stdout if these are terminals, unless overridden. */ - - if (!overridden || !Py_FileSystemDefaultEncoding) { - saved_locale = strdup(setlocale(LC_CTYPE, NULL)); - setlocale(LC_CTYPE, ""); - loc_codeset = nl_langinfo(CODESET); - if (loc_codeset && *loc_codeset) { - PyObject *enc = PyCodec_Encoder(loc_codeset); - if (enc) { - loc_codeset = strdup(loc_codeset); - Py_DECREF(enc); - } else { - if (PyErr_ExceptionMatches(PyExc_LookupError)) { - PyErr_Clear(); - loc_codeset = NULL; - } else { - PyErr_Print(); - exit(1); - } - } - } else - loc_codeset = NULL; - setlocale(LC_CTYPE, saved_locale); - free(saved_locale); - - if (!overridden) { - codeset = icodeset = loc_codeset; - free_codeset = 1; - } - - /* Initialize Py_FileSystemDefaultEncoding from - locale even if PYTHONIOENCODING is set. */ - if (!Py_FileSystemDefaultEncoding) { - Py_FileSystemDefaultEncoding = loc_codeset; - if (!overridden) - free_codeset = 0; - } - } -#endif - -#ifdef MS_WINDOWS - if (!overridden) { - icodeset = ibuf; - codeset = buf; - sprintf(ibuf, "cp%d", GetConsoleCP()); - sprintf(buf, "cp%d", GetConsoleOutputCP()); - } -#endif - - if (codeset) { - sys_stream = PySys_GetObject("stdin"); - sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); - if (!sys_isatty) - PyErr_Clear(); - if ((overridden || - (sys_isatty && PyObject_IsTrue(sys_isatty))) && - PyFile_Check(sys_stream)) { - if (!PyFile_SetEncodingAndErrors(sys_stream, icodeset, errors)) - Py_FatalError("Cannot set codeset of stdin"); - } - Py_XDECREF(sys_isatty); - - sys_stream = PySys_GetObject("stdout"); - sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); - if (!sys_isatty) - PyErr_Clear(); - if ((overridden || - (sys_isatty && PyObject_IsTrue(sys_isatty))) && - PyFile_Check(sys_stream)) { - if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) - Py_FatalError("Cannot set codeset of stdout"); - } - Py_XDECREF(sys_isatty); - - sys_stream = PySys_GetObject("stderr"); - sys_isatty = PyObject_CallMethod(sys_stream, "isatty", ""); - if (!sys_isatty) - PyErr_Clear(); - if((overridden || - (sys_isatty && PyObject_IsTrue(sys_isatty))) && - PyFile_Check(sys_stream)) { - if (!PyFile_SetEncodingAndErrors(sys_stream, codeset, errors)) - Py_FatalError("Cannot set codeset of stderr"); - } - Py_XDECREF(sys_isatty); - - if (free_codeset) - free(codeset); - } -} - -void -Py_Initialize(void) -{ - Py_InitializeEx(1); -} - - -#ifdef COUNT_ALLOCS -extern void dump_counts(FILE*); -#endif - -/* Undo the effect of Py_Initialize(). - - Beware: if multiple interpreter and/or thread states exist, these - are not wiped out; only the current thread and interpreter state - are deleted. But since everything else is deleted, those other - interpreter and thread states should no longer be used. - - (XXX We should do better, e.g. wipe out all interpreters and - threads.) - - Locking: as above. - -*/ - -void -Py_Finalize(void) -{ - PyInterpreterState *interp; - PyThreadState *tstate; - - if (!initialized) - return; - - wait_for_thread_shutdown(); - - /* The interpreter is still entirely intact at this point, and the - * exit funcs may be relying on that. In particular, if some thread - * or exit func is still waiting to do an import, the import machinery - * expects Py_IsInitialized() to return true. So don't say the - * interpreter is uninitialized until after the exit funcs have run. - * Note that Threading.py uses an exit func to do a join on all the - * threads created thru it, so this also protects pending imports in - * the threads created via Threading. - */ - call_sys_exitfunc(); - initialized = 0; - - /* Get current thread state and interpreter pointer */ - tstate = PyThreadState_GET(); - interp = tstate->interp; - - /* Disable signal handling */ - PyOS_FiniInterrupts(); - - /* Clear type lookup cache */ - PyType_ClearCache(); - - /* Collect garbage. This may call finalizers; it's nice to call these - * before all modules are destroyed. - * XXX If a __del__ or weakref callback is triggered here, and tries to - * XXX import a module, bad things can happen, because Python no - * XXX longer believes it's initialized. - * XXX Fatal Python error: Interpreter not initialized (version mismatch?) - * XXX is easy to provoke that way. I've also seen, e.g., - * XXX Exception exceptions.ImportError: 'No module named sha' - * XXX in ignored - * XXX but I'm unclear on exactly how that one happens. In any case, - * XXX I haven't seen a real-life report of either of these. - */ - PyGC_Collect(); -#ifdef COUNT_ALLOCS - /* With COUNT_ALLOCS, it helps to run GC multiple times: - each collection might release some types from the type - list, so they become garbage. */ - while (PyGC_Collect() > 0) - /* nothing */; -#endif - - /* Destroy all modules */ - PyImport_Cleanup(); - - /* Collect final garbage. This disposes of cycles created by - * new-style class definitions, for example. - * XXX This is disabled because it caused too many problems. If - * XXX a __del__ or weakref callback triggers here, Python code has - * XXX a hard time running, because even the sys module has been - * XXX cleared out (sys.stdout is gone, sys.excepthook is gone, etc). - * XXX One symptom is a sequence of information-free messages - * XXX coming from threads (if a __del__ or callback is invoked, - * XXX other threads can execute too, and any exception they encounter - * XXX triggers a comedy of errors as subsystem after subsystem - * XXX fails to find what it *expects* to find in sys to help report - * XXX the exception and consequent unexpected failures). I've also - * XXX seen segfaults then, after adding print statements to the - * XXX Python code getting called. - */ -#if 0 - PyGC_Collect(); -#endif - - /* Destroy the database used by _PyImport_{Fixup,Find}Extension */ - _PyImport_Fini(); - - /* Debugging stuff */ -#ifdef COUNT_ALLOCS - dump_counts(stdout); -#endif - - PRINT_TOTAL_REFS(); - -#ifdef Py_TRACE_REFS - /* Display all objects still alive -- this can invoke arbitrary - * __repr__ overrides, so requires a mostly-intact interpreter. - * Alas, a lot of stuff may still be alive now that will be cleaned - * up later. - */ - if (Py_GETENV("PYTHONDUMPREFS")) - _Py_PrintReferences(stderr); -#endif /* Py_TRACE_REFS */ - - /* Clear interpreter state */ - PyInterpreterState_Clear(interp); - - /* Now we decref the exception classes. After this point nothing - can raise an exception. That's okay, because each Fini() method - below has been checked to make sure no exceptions are ever - raised. - */ - - _PyExc_Fini(); - - /* Cleanup auto-thread-state */ -#ifdef WITH_THREAD - _PyGILState_Fini(); -#endif /* WITH_THREAD */ - - /* Delete current thread */ - PyThreadState_Swap(NULL); - PyInterpreterState_Delete(interp); - - /* Sundry finalizers */ - PyMethod_Fini(); - PyFrame_Fini(); - PyCFunction_Fini(); - PyTuple_Fini(); - PyList_Fini(); - PySet_Fini(); - PyString_Fini(); - PyByteArray_Fini(); - PyInt_Fini(); - PyFloat_Fini(); - PyDict_Fini(); - _PyRandom_Fini(); - -#ifdef Py_USING_UNICODE - /* Cleanup Unicode implementation */ - _PyUnicode_Fini(); -#endif - - /* XXX Still allocated: - - various static ad-hoc pointers to interned strings - - int and float free list blocks - - whatever various modules and libraries allocate - */ - - PyGrammar_RemoveAccelerators(&_PyParser_Grammar); - -#ifdef Py_TRACE_REFS - /* Display addresses (& refcnts) of all objects still alive. - * An address can be used to find the repr of the object, printed - * above by _Py_PrintReferences. - */ - if (Py_GETENV("PYTHONDUMPREFS")) - _Py_PrintReferenceAddresses(stderr); -#endif /* Py_TRACE_REFS */ -#ifdef PYMALLOC_DEBUG - if (Py_GETENV("PYTHONMALLOCSTATS")) - _PyObject_DebugMallocStats(); -#endif - - call_ll_exitfuncs(); -} - -/* Create and initialize a new interpreter and thread, and return the - new thread. This requires that Py_Initialize() has been called - first. - - Unsuccessful initialization yields a NULL pointer. Note that *no* - exception information is available even in this case -- the - exception information is held in the thread, and there is no - thread. - - Locking: as above. - -*/ - -PyThreadState * -Py_NewInterpreter(void) -{ - PyInterpreterState *interp; - PyThreadState *tstate, *save_tstate; - PyObject *bimod, *sysmod; - - if (!initialized) - Py_FatalError("Py_NewInterpreter: call Py_Initialize first"); - - interp = PyInterpreterState_New(); - if (interp == NULL) - return NULL; - - tstate = PyThreadState_New(interp); - if (tstate == NULL) { - PyInterpreterState_Delete(interp); - return NULL; - } - - save_tstate = PyThreadState_Swap(tstate); - - /* XXX The following is lax in error checking */ - - interp->modules = PyDict_New(); - interp->modules_reloading = PyDict_New(); - - bimod = _PyImport_FindExtension("__builtin__", "__builtin__"); - if (bimod != NULL) { - interp->builtins = PyModule_GetDict(bimod); - if (interp->builtins == NULL) - goto handle_error; - Py_INCREF(interp->builtins); - } - sysmod = _PyImport_FindExtension("sys", "sys"); - if (bimod != NULL && sysmod != NULL) { - interp->sysdict = PyModule_GetDict(sysmod); - if (interp->sysdict == NULL) - goto handle_error; - Py_INCREF(interp->sysdict); - PySys_SetPath(Py_GetPath()); - PyDict_SetItemString(interp->sysdict, "modules", - interp->modules); - _PyImportHooks_Init(); - initmain(); - if (!Py_NoSiteFlag) - initsite(); - } - - if (!PyErr_Occurred()) - return tstate; - -handle_error: - /* Oops, it didn't work. Undo it all. */ - - PyErr_Print(); - PyThreadState_Clear(tstate); - PyThreadState_Swap(save_tstate); - PyThreadState_Delete(tstate); - PyInterpreterState_Delete(interp); - - return NULL; -} - -/* Delete an interpreter and its last thread. This requires that the - given thread state is current, that the thread has no remaining - frames, and that it is its interpreter's only remaining thread. - It is a fatal error to violate these constraints. - - (Py_Finalize() doesn't have these constraints -- it zaps - everything, regardless.) - - Locking: as above. - -*/ - -void -Py_EndInterpreter(PyThreadState *tstate) -{ - PyInterpreterState *interp = tstate->interp; - - if (tstate != PyThreadState_GET()) - Py_FatalError("Py_EndInterpreter: thread is not current"); - if (tstate->frame != NULL) - Py_FatalError("Py_EndInterpreter: thread still has a frame"); - if (tstate != interp->tstate_head || tstate->next != NULL) - Py_FatalError("Py_EndInterpreter: not the last thread"); - - PyImport_Cleanup(); - PyInterpreterState_Clear(interp); - PyThreadState_Swap(NULL); - PyInterpreterState_Delete(interp); -} - -static char *progname = "python"; - -void -Py_SetProgramName(char *pn) -{ - if (pn && *pn) - progname = pn; -} - -char * -Py_GetProgramName(void) -{ - return progname; -} - -static char *default_home = NULL; - -void -Py_SetPythonHome(char *home) -{ - default_home = home; -} - -char * -Py_GetPythonHome(void) -{ - char *home = default_home; - if (home == NULL && !Py_IgnoreEnvironmentFlag) - home = Py_GETENV("PYTHONHOME"); - return home; -} - -/* Create __main__ module */ - -static void -initmain(void) -{ - PyObject *m, *d; - m = PyImport_AddModule("__main__"); - if (m == NULL) - Py_FatalError("can't create __main__ module"); - d = PyModule_GetDict(m); - if (PyDict_GetItemString(d, "__builtins__") == NULL) { - PyObject *bimod = PyImport_ImportModule("__builtin__"); - if (bimod == NULL || - PyDict_SetItemString(d, "__builtins__", bimod) != 0) - Py_FatalError("can't add __builtins__ to __main__"); - Py_XDECREF(bimod); - } -} - -/* Import the site module (not into __main__ though) */ - -static void -initsite(void) -{ - PyObject *m; - m = PyImport_ImportModule("site"); - if (m == NULL) { - PyErr_Print(); - Py_Finalize(); - exit(1); - } - else { - Py_DECREF(m); - } -} - -/* Parse input from a file and execute it */ - -int -PyRun_AnyFileExFlags(FILE *fp, const char *filename, int closeit, - PyCompilerFlags *flags) -{ - if (filename == NULL) - filename = "???"; - if (Py_FdIsInteractive(fp, filename)) { - int err = PyRun_InteractiveLoopFlags(fp, filename, flags); - if (closeit) - fclose(fp); - return err; - } - else - return PyRun_SimpleFileExFlags(fp, filename, closeit, flags); -} - -int -PyRun_InteractiveLoopFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) -{ - PyObject *v; - int ret; - PyCompilerFlags local_flags; - - if (flags == NULL) { - flags = &local_flags; - local_flags.cf_flags = 0; - } - v = PySys_GetObject("ps1"); - if (v == NULL) { - PySys_SetObject("ps1", v = PyString_FromString(">>> ")); - Py_XDECREF(v); - } - v = PySys_GetObject("ps2"); - if (v == NULL) { - PySys_SetObject("ps2", v = PyString_FromString("... ")); - Py_XDECREF(v); - } - for (;;) { - ret = PyRun_InteractiveOneFlags(fp, filename, flags); - PRINT_TOTAL_REFS(); - if (ret == E_EOF) - return 0; - /* - if (ret == E_NOMEM) - return -1; - */ - } -} - -#if 0 -/* compute parser flags based on compiler flags */ -#define PARSER_FLAGS(flags) \ - ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \ - PyPARSE_DONT_IMPLY_DEDENT : 0)) : 0) -#endif -#if 1 -/* Keep an example of flags with future keyword support. */ -#define PARSER_FLAGS(flags) \ - ((flags) ? ((((flags)->cf_flags & PyCF_DONT_IMPLY_DEDENT) ? \ - PyPARSE_DONT_IMPLY_DEDENT : 0) \ - | (((flags)->cf_flags & CO_FUTURE_PRINT_FUNCTION) ? \ - PyPARSE_PRINT_IS_FUNCTION : 0) \ - | (((flags)->cf_flags & CO_FUTURE_UNICODE_LITERALS) ? \ - PyPARSE_UNICODE_LITERALS : 0) \ - ) : 0) -#endif - -int -PyRun_InteractiveOneFlags(FILE *fp, const char *filename, PyCompilerFlags *flags) -{ - PyObject *m, *d, *v, *w; - mod_ty mod; - PyArena *arena; - char *ps1 = "", *ps2 = ""; - int errcode = 0; - - v = PySys_GetObject("ps1"); - if (v != NULL) { - v = PyObject_Str(v); - if (v == NULL) - PyErr_Clear(); - else if (PyString_Check(v)) - ps1 = PyString_AsString(v); - } - w = PySys_GetObject("ps2"); - if (w != NULL) { - w = PyObject_Str(w); - if (w == NULL) - PyErr_Clear(); - else if (PyString_Check(w)) - ps2 = PyString_AsString(w); - } - arena = PyArena_New(); - if (arena == NULL) { - Py_XDECREF(v); - Py_XDECREF(w); - return -1; - } - mod = PyParser_ASTFromFile(fp, filename, - Py_single_input, ps1, ps2, - flags, &errcode, arena); - Py_XDECREF(v); - Py_XDECREF(w); - if (mod == NULL) { - PyArena_Free(arena); - if (errcode == E_EOF) { - PyErr_Clear(); - return E_EOF; - } - PyErr_Print(); - return -1; - } - m = PyImport_AddModule("__main__"); - if (m == NULL) { - PyArena_Free(arena); - return -1; - } - d = PyModule_GetDict(m); - v = run_mod(mod, filename, d, d, flags, arena); - PyArena_Free(arena); - if (v == NULL) { - PyErr_Print(); - return -1; - } - Py_DECREF(v); - if (Py_FlushLine()) - PyErr_Clear(); - return 0; -} - -/* Check whether a file maybe a pyc file: Look at the extension, - the file type, and, if we may close it, at the first few bytes. */ - -static int -maybe_pyc_file(FILE *fp, const char* filename, const char* ext, int closeit) -{ - if (strcmp(ext, ".pyc") == 0 || strcmp(ext, ".pyo") == 0) - return 1; - - /* Only look into the file if we are allowed to close it, since - it then should also be seekable. */ - if (closeit) { - /* Read only two bytes of the magic. If the file was opened in - text mode, the bytes 3 and 4 of the magic (\r\n) might not - be read as they are on disk. */ - unsigned int halfmagic = PyImport_GetMagicNumber() & 0xFFFF; - unsigned char buf[2]; - /* Mess: In case of -x, the stream is NOT at its start now, - and ungetc() was used to push back the first newline, - which makes the current stream position formally undefined, - and a x-platform nightmare. - Unfortunately, we have no direct way to know whether -x - was specified. So we use a terrible hack: if the current - stream position is not 0, we assume -x was specified, and - give up. Bug 132850 on SourceForge spells out the - hopelessness of trying anything else (fseek and ftell - don't work predictably x-platform for text-mode files). - */ - int ispyc = 0; - if (ftell(fp) == 0) { - if (fread(buf, 1, 2, fp) == 2 && - ((unsigned int)buf[1]<<8 | buf[0]) == halfmagic) - ispyc = 1; - rewind(fp); - } - return ispyc; - } - return 0; -} - -int -PyRun_SimpleFileExFlags(FILE *fp, const char *filename, int closeit, - PyCompilerFlags *flags) -{ - PyObject *m, *d, *v; - const char *ext; - int set_file_name = 0, len, ret = -1; - - m = PyImport_AddModule("__main__"); - if (m == NULL) - return -1; - Py_INCREF(m); - d = PyModule_GetDict(m); - if (PyDict_GetItemString(d, "__file__") == NULL) { - PyObject *f = PyString_FromString(filename); - if (f == NULL) - goto done; - if (PyDict_SetItemString(d, "__file__", f) < 0) { - Py_DECREF(f); - goto done; - } - set_file_name = 1; - Py_DECREF(f); - } - len = strlen(filename); - ext = filename + len - (len > 4 ? 4 : 0); - if (maybe_pyc_file(fp, filename, ext, closeit)) { - /* Try to run a pyc file. First, re-open in binary */ - if (closeit) - fclose(fp); - if ((fp = fopen(filename, "rb")) == NULL) { - fprintf(stderr, "python: Can't reopen .pyc file\n"); - goto done; - } - /* Turn on optimization if a .pyo file is given */ - if (strcmp(ext, ".pyo") == 0) - Py_OptimizeFlag = 1; - v = run_pyc_file(fp, filename, d, d, flags); - } else { - v = PyRun_FileExFlags(fp, filename, Py_file_input, d, d, - closeit, flags); - } - if (v == NULL) { - PyErr_Print(); - goto done; - } - Py_DECREF(v); - if (Py_FlushLine()) - PyErr_Clear(); - ret = 0; - done: - if (set_file_name && PyDict_DelItemString(d, "__file__")) - PyErr_Clear(); - Py_DECREF(m); - return ret; -} - -int -PyRun_SimpleStringFlags(const char *command, PyCompilerFlags *flags) -{ - PyObject *m, *d, *v; - m = PyImport_AddModule("__main__"); - if (m == NULL) - return -1; - d = PyModule_GetDict(m); - v = PyRun_StringFlags(command, Py_file_input, d, d, flags); - if (v == NULL) { - PyErr_Print(); - return -1; - } - Py_DECREF(v); - if (Py_FlushLine()) - PyErr_Clear(); - return 0; -} - -static int -parse_syntax_error(PyObject *err, PyObject **message, const char **filename, - int *lineno, int *offset, const char **text) -{ - long hold; - PyObject *v; - - /* old style errors */ - if (PyTuple_Check(err)) - return PyArg_ParseTuple(err, "O(ziiz)", message, filename, - lineno, offset, text); - - *message = NULL; - - /* new style errors. `err' is an instance */ - *message = PyObject_GetAttrString(err, "msg"); - if (!*message) - goto finally; - - v = PyObject_GetAttrString(err, "filename"); - if (!v) - goto finally; - if (v == Py_None) { - Py_DECREF(v); - *filename = NULL; - } - else { - *filename = PyString_AsString(v); - Py_DECREF(v); - if (!*filename) - goto finally; - } - - v = PyObject_GetAttrString(err, "lineno"); - if (!v) - goto finally; - hold = PyInt_AsLong(v); - Py_DECREF(v); - if (hold < 0 && PyErr_Occurred()) - goto finally; - *lineno = (int)hold; - - v = PyObject_GetAttrString(err, "offset"); - if (!v) - goto finally; - if (v == Py_None) { - *offset = -1; - Py_DECREF(v); - } else { - hold = PyInt_AsLong(v); - Py_DECREF(v); - if (hold < 0 && PyErr_Occurred()) - goto finally; - *offset = (int)hold; - } - - v = PyObject_GetAttrString(err, "text"); - if (!v) - goto finally; - if (v == Py_None) { - Py_DECREF(v); - *text = NULL; - } - else { - *text = PyString_AsString(v); - Py_DECREF(v); - if (!*text) - goto finally; - } - return 1; - -finally: - Py_XDECREF(*message); - return 0; -} - -void -PyErr_Print(void) -{ - PyErr_PrintEx(1); -} - -static void -print_error_text(PyObject *f, int offset, const char *text) -{ - char *nl; - if (offset >= 0) { - if (offset > 0 && offset == strlen(text) && text[offset - 1] == '\n') - offset--; - for (;;) { - nl = strchr(text, '\n'); - if (nl == NULL || nl-text >= offset) - break; - offset -= (int)(nl+1-text); - text = nl+1; - } - while (*text == ' ' || *text == '\t') { - text++; - offset--; - } - } - PyFile_WriteString(" ", f); - PyFile_WriteString(text, f); - if (*text == '\0' || text[strlen(text)-1] != '\n') - PyFile_WriteString("\n", f); - if (offset == -1) - return; - PyFile_WriteString(" ", f); - offset--; - while (offset > 0) { - PyFile_WriteString(" ", f); - offset--; - } - PyFile_WriteString("^\n", f); -} - -static void -handle_system_exit(void) -{ - PyObject *exception, *value, *tb; - int exitcode = 0; - - if (Py_InspectFlag) - /* Don't exit if -i flag was given. This flag is set to 0 - * when entering interactive mode for inspecting. */ - return; - - PyErr_Fetch(&exception, &value, &tb); - if (Py_FlushLine()) - PyErr_Clear(); - fflush(stdout); - if (value == NULL || value == Py_None) - goto done; - if (PyExceptionInstance_Check(value)) { - /* The error code should be in the `code' attribute. */ - PyObject *code = PyObject_GetAttrString(value, "code"); - if (code) { - Py_DECREF(value); - value = code; - if (value == Py_None) - goto done; - } - /* If we failed to dig out the 'code' attribute, - just let the else clause below print the error. */ - } - if (PyInt_Check(value)) - exitcode = (int)PyInt_AsLong(value); - else { - PyObject *sys_stderr = PySys_GetObject("stderr"); - if (sys_stderr != NULL && sys_stderr != Py_None) { - PyFile_WriteObject(value, sys_stderr, Py_PRINT_RAW); - } else { - PyObject_Print(value, stderr, Py_PRINT_RAW); - fflush(stderr); - } - PySys_WriteStderr("\n"); - exitcode = 1; - } - done: - /* Restore and clear the exception info, in order to properly decref - * the exception, value, and traceback. If we just exit instead, - * these leak, which confuses PYTHONDUMPREFS output, and may prevent - * some finalizers from running. - */ - PyErr_Restore(exception, value, tb); - PyErr_Clear(); - Py_Exit(exitcode); - /* NOTREACHED */ -} - -void -PyErr_PrintEx(int set_sys_last_vars) -{ - PyObject *exception, *v, *tb, *hook; - - if (PyErr_ExceptionMatches(PyExc_SystemExit)) { - handle_system_exit(); - } - PyErr_Fetch(&exception, &v, &tb); - if (exception == NULL) - return; - PyErr_NormalizeException(&exception, &v, &tb); - if (exception == NULL) - return; - /* Now we know v != NULL too */ - if (set_sys_last_vars) { - PySys_SetObject("last_type", exception); - PySys_SetObject("last_value", v); - PySys_SetObject("last_traceback", tb); - } - hook = PySys_GetObject("excepthook"); - if (hook && hook != Py_None) { - PyObject *args = PyTuple_Pack(3, - exception, v, tb ? tb : Py_None); - PyObject *result = PyEval_CallObject(hook, args); - if (result == NULL) { - PyObject *exception2, *v2, *tb2; - if (PyErr_ExceptionMatches(PyExc_SystemExit)) { - handle_system_exit(); - } - PyErr_Fetch(&exception2, &v2, &tb2); - PyErr_NormalizeException(&exception2, &v2, &tb2); - /* It should not be possible for exception2 or v2 - to be NULL. However PyErr_Display() can't - tolerate NULLs, so just be safe. */ - if (exception2 == NULL) { - exception2 = Py_None; - Py_INCREF(exception2); - } - if (v2 == NULL) { - v2 = Py_None; - Py_INCREF(v2); - } - if (Py_FlushLine()) - PyErr_Clear(); - fflush(stdout); - PySys_WriteStderr("Error in sys.excepthook:\n"); - PyErr_Display(exception2, v2, tb2); - PySys_WriteStderr("\nOriginal exception was:\n"); - PyErr_Display(exception, v, tb); - Py_DECREF(exception2); - Py_DECREF(v2); - Py_XDECREF(tb2); - } - Py_XDECREF(result); - Py_XDECREF(args); - } else { - PySys_WriteStderr("sys.excepthook is missing\n"); - PyErr_Display(exception, v, tb); - } - Py_XDECREF(exception); - Py_XDECREF(v); - Py_XDECREF(tb); -} - -void -PyErr_Display(PyObject *exception, PyObject *value, PyObject *tb) -{ - int err = 0; - PyObject *f = PySys_GetObject("stderr"); - Py_INCREF(value); - if (f == NULL || f == Py_None) - fprintf(stderr, "lost sys.stderr\n"); - else { - if (Py_FlushLine()) - PyErr_Clear(); - fflush(stdout); - if (tb && tb != Py_None) - err = PyTraceBack_Print(tb, f); - if (err == 0 && - PyObject_HasAttrString(value, "print_file_and_line")) - { - PyObject *message; - const char *filename, *text; - int lineno, offset; - if (!parse_syntax_error(value, &message, &filename, - &lineno, &offset, &text)) - PyErr_Clear(); - else { - char buf[10]; - PyFile_WriteString(" File \"", f); - if (filename == NULL) - PyFile_WriteString("", f); - else - PyFile_WriteString(filename, f); - PyFile_WriteString("\", line ", f); - PyOS_snprintf(buf, sizeof(buf), "%d", lineno); - PyFile_WriteString(buf, f); - PyFile_WriteString("\n", f); - if (text != NULL) - print_error_text(f, offset, text); - Py_DECREF(value); - value = message; - /* Can't be bothered to check all those - PyFile_WriteString() calls */ - if (PyErr_Occurred()) - err = -1; - } - } - if (err) { - /* Don't do anything else */ - } - else if (PyExceptionClass_Check(exception)) { - PyObject* moduleName; - char* className = PyExceptionClass_Name(exception); - if (className != NULL) { - char *dot = strrchr(className, '.'); - if (dot != NULL) - className = dot+1; - } - - moduleName = PyObject_GetAttrString(exception, "__module__"); - if (moduleName == NULL) - err = PyFile_WriteString("", f); - else { - char* modstr = PyString_AsString(moduleName); - if (modstr && strcmp(modstr, "exceptions")) - { - err = PyFile_WriteString(modstr, f); - err += PyFile_WriteString(".", f); - } - Py_DECREF(moduleName); - } - if (err == 0) { - if (className == NULL) - err = PyFile_WriteString("", f); - else - err = PyFile_WriteString(className, f); - } - } - else - err = PyFile_WriteObject(exception, f, Py_PRINT_RAW); - if (err == 0 && (value != Py_None)) { - PyObject *s = PyObject_Str(value); - /* only print colon if the str() of the - object is not the empty string - */ - if (s == NULL) - err = -1; - else if (!PyString_Check(s) || - PyString_GET_SIZE(s) != 0) - err = PyFile_WriteString(": ", f); - if (err == 0) - err = PyFile_WriteObject(s, f, Py_PRINT_RAW); - Py_XDECREF(s); - } - /* try to write a newline in any case */ - err += PyFile_WriteString("\n", f); - } - Py_DECREF(value); - /* If an error happened here, don't show it. - XXX This is wrong, but too many callers rely on this behavior. */ - if (err != 0) - PyErr_Clear(); -} - -PyObject * -PyRun_StringFlags(const char *str, int start, PyObject *globals, - PyObject *locals, PyCompilerFlags *flags) -{ - PyObject *ret = NULL; - mod_ty mod; - PyArena *arena = PyArena_New(); - if (arena == NULL) - return NULL; - - mod = PyParser_ASTFromString(str, "", start, flags, arena); - if (mod != NULL) - ret = run_mod(mod, "", globals, locals, flags, arena); - PyArena_Free(arena); - return ret; -} - -PyObject * -PyRun_FileExFlags(FILE *fp, const char *filename, int start, PyObject *globals, - PyObject *locals, int closeit, PyCompilerFlags *flags) -{ - PyObject *ret; - mod_ty mod; - PyArena *arena = PyArena_New(); - if (arena == NULL) - return NULL; - - mod = PyParser_ASTFromFile(fp, filename, start, 0, 0, - flags, NULL, arena); - if (closeit) - fclose(fp); - if (mod == NULL) { - PyArena_Free(arena); - return NULL; - } - ret = run_mod(mod, filename, globals, locals, flags, arena); - PyArena_Free(arena); - return ret; -} - -static PyObject * -run_mod(mod_ty mod, const char *filename, PyObject *globals, PyObject *locals, - PyCompilerFlags *flags, PyArena *arena) -{ - PyCodeObject *co; - PyObject *v; - co = PyAST_Compile(mod, filename, flags, arena); - if (co == NULL) - return NULL; - v = PyEval_EvalCode(co, globals, locals); - Py_DECREF(co); - return v; -} - -static PyObject * -run_pyc_file(FILE *fp, const char *filename, PyObject *globals, - PyObject *locals, PyCompilerFlags *flags) -{ - PyCodeObject *co; - PyObject *v; - long magic; - long PyImport_GetMagicNumber(void); - - magic = PyMarshal_ReadLongFromFile(fp); - if (magic != PyImport_GetMagicNumber()) { - PyErr_SetString(PyExc_RuntimeError, - "Bad magic number in .pyc file"); - return NULL; - } - (void) PyMarshal_ReadLongFromFile(fp); - v = PyMarshal_ReadLastObjectFromFile(fp); - fclose(fp); - if (v == NULL || !PyCode_Check(v)) { - Py_XDECREF(v); - PyErr_SetString(PyExc_RuntimeError, - "Bad code object in .pyc file"); - return NULL; - } - co = (PyCodeObject *)v; - v = PyEval_EvalCode(co, globals, locals); - if (v && flags) - flags->cf_flags |= (co->co_flags & PyCF_MASK); - Py_DECREF(co); - return v; -} - -PyObject * -Py_CompileStringFlags(const char *str, const char *filename, int start, - PyCompilerFlags *flags) -{ - PyCodeObject *co; - mod_ty mod; - PyArena *arena = PyArena_New(); - if (arena == NULL) - return NULL; - - mod = PyParser_ASTFromString(str, filename, start, flags, arena); - if (mod == NULL) { - PyArena_Free(arena); - return NULL; - } - if (flags && (flags->cf_flags & PyCF_ONLY_AST)) { - PyObject *result = PyAST_mod2obj(mod); - PyArena_Free(arena); - return result; - } - co = PyAST_Compile(mod, filename, flags, arena); - PyArena_Free(arena); - return (PyObject *)co; -} - -struct symtable * -Py_SymtableString(const char *str, const char *filename, int start) -{ - struct symtable *st; - mod_ty mod; - PyCompilerFlags flags; - PyArena *arena = PyArena_New(); - if (arena == NULL) - return NULL; - - flags.cf_flags = 0; - - mod = PyParser_ASTFromString(str, filename, start, &flags, arena); - if (mod == NULL) { - PyArena_Free(arena); - return NULL; - } - st = PySymtable_Build(mod, filename, 0); - PyArena_Free(arena); - return st; -} - -/* Preferred access to parser is through AST. */ -mod_ty -PyParser_ASTFromString(const char *s, const char *filename, int start, - PyCompilerFlags *flags, PyArena *arena) -{ - mod_ty mod; - PyCompilerFlags localflags; - perrdetail err; - int iflags = PARSER_FLAGS(flags); - - node *n = PyParser_ParseStringFlagsFilenameEx(s, filename, - &_PyParser_Grammar, start, &err, - &iflags); - if (flags == NULL) { - localflags.cf_flags = 0; - flags = &localflags; - } - if (n) { - flags->cf_flags |= iflags & PyCF_MASK; - mod = PyAST_FromNode(n, flags, filename, arena); - PyNode_Free(n); - return mod; - } - else { - err_input(&err); - return NULL; - } -} - -mod_ty -PyParser_ASTFromFile(FILE *fp, const char *filename, int start, char *ps1, - char *ps2, PyCompilerFlags *flags, int *errcode, - PyArena *arena) -{ - mod_ty mod; - PyCompilerFlags localflags; - perrdetail err; - int iflags = PARSER_FLAGS(flags); - - node *n = PyParser_ParseFileFlagsEx(fp, filename, &_PyParser_Grammar, - start, ps1, ps2, &err, &iflags); - if (flags == NULL) { - localflags.cf_flags = 0; - flags = &localflags; - } - if (n) { - flags->cf_flags |= iflags & PyCF_MASK; - mod = PyAST_FromNode(n, flags, filename, arena); - PyNode_Free(n); - return mod; - } - else { - err_input(&err); - if (errcode) - *errcode = err.error; - return NULL; - } -} - -/* Simplified interface to parsefile -- return node or set exception */ - -node * -PyParser_SimpleParseFileFlags(FILE *fp, const char *filename, int start, int flags) -{ - perrdetail err; - node *n = PyParser_ParseFileFlags(fp, filename, &_PyParser_Grammar, - start, NULL, NULL, &err, flags); - if (n == NULL) - err_input(&err); - - return n; -} - -/* Simplified interface to parsestring -- return node or set exception */ - -node * -PyParser_SimpleParseStringFlags(const char *str, int start, int flags) -{ - perrdetail err; - node *n = PyParser_ParseStringFlags(str, &_PyParser_Grammar, - start, &err, flags); - if (n == NULL) - err_input(&err); - return n; -} - -node * -PyParser_SimpleParseStringFlagsFilename(const char *str, const char *filename, - int start, int flags) -{ - perrdetail err; - node *n = PyParser_ParseStringFlagsFilename(str, filename, - &_PyParser_Grammar, start, &err, flags); - if (n == NULL) - err_input(&err); - return n; -} - -node * -PyParser_SimpleParseStringFilename(const char *str, const char *filename, int start) -{ - return PyParser_SimpleParseStringFlagsFilename(str, filename, start, 0); -} - -/* May want to move a more generalized form of this to parsetok.c or - even parser modules. */ - -void -PyParser_SetError(perrdetail *err) -{ - err_input(err); -} - -/* Set the error appropriate to the given input error code (see errcode.h) */ - -static void -err_input(perrdetail *err) -{ - PyObject *v, *w, *errtype; - PyObject* u = NULL; - char *msg = NULL; - errtype = PyExc_SyntaxError; - switch (err->error) { - case E_ERROR: - return; - case E_SYNTAX: - errtype = PyExc_IndentationError; - if (err->expected == INDENT) - msg = "expected an indented block"; - else if (err->token == INDENT) - msg = "unexpected indent"; - else if (err->token == DEDENT) - msg = "unexpected unindent"; - else { - errtype = PyExc_SyntaxError; - msg = "invalid syntax"; - } - break; - case E_TOKEN: - msg = "invalid token"; - break; - case E_EOFS: - msg = "EOF while scanning triple-quoted string literal"; - break; - case E_EOLS: - msg = "EOL while scanning string literal"; - break; - case E_INTR: - if (!PyErr_Occurred()) - PyErr_SetNone(PyExc_KeyboardInterrupt); - goto cleanup; - case E_NOMEM: - PyErr_NoMemory(); - goto cleanup; - case E_EOF: - msg = "unexpected EOF while parsing"; - break; - case E_TABSPACE: - errtype = PyExc_TabError; - msg = "inconsistent use of tabs and spaces in indentation"; - break; - case E_OVERFLOW: - msg = "expression too long"; - break; - case E_DEDENT: - errtype = PyExc_IndentationError; - msg = "unindent does not match any outer indentation level"; - break; - case E_TOODEEP: - errtype = PyExc_IndentationError; - msg = "too many levels of indentation"; - break; - case E_DECODE: { - PyObject *type, *value, *tb; - PyErr_Fetch(&type, &value, &tb); - if (value != NULL) { - u = PyObject_Str(value); - if (u != NULL) { - msg = PyString_AsString(u); - } - } - if (msg == NULL) - msg = "unknown decode error"; - Py_XDECREF(type); - Py_XDECREF(value); - Py_XDECREF(tb); - break; - } - case E_LINECONT: - msg = "unexpected character after line continuation character"; - break; - default: - fprintf(stderr, "error=%d\n", err->error); - msg = "unknown parsing error"; - break; - } - v = Py_BuildValue("(ziiz)", err->filename, - err->lineno, err->offset, err->text); - w = NULL; - if (v != NULL) - w = Py_BuildValue("(sO)", msg, v); - Py_XDECREF(u); - Py_XDECREF(v); - PyErr_SetObject(errtype, w); - Py_XDECREF(w); -cleanup: - if (err->text != NULL) { - PyObject_FREE(err->text); - err->text = NULL; - } -} - -/* Print fatal error message and abort */ - -void -Py_FatalError(const char *msg) -{ - fprintf(stderr, "Fatal Python error: %s\n", msg); - fflush(stderr); /* it helps in Windows debug build */ - -#ifdef MS_WINDOWS - { - size_t len = strlen(msg); - WCHAR* buffer; - size_t i; - - /* Convert the message to wchar_t. This uses a simple one-to-one - conversion, assuming that the this error message actually uses ASCII - only. If this ceases to be true, we will have to convert. */ - buffer = alloca( (len+1) * (sizeof *buffer)); - for( i=0; i<=len; ++i) - buffer[i] = msg[i]; - OutputDebugStringW(L"Fatal Python error: "); - OutputDebugStringW(buffer); - OutputDebugStringW(L"\n"); - } -#ifdef _DEBUG - DebugBreak(); -#endif -#endif /* MS_WINDOWS */ - abort(); -} - -/* Clean up and exit */ - -#ifdef WITH_THREAD -#include "pythread.h" -#endif - -/* Wait until threading._shutdown completes, provided - the threading module was imported in the first place. - The shutdown routine will wait until all non-daemon - "threading" threads have completed. */ -static void -wait_for_thread_shutdown(void) -{ -#ifdef WITH_THREAD - PyObject *result; - PyThreadState *tstate = PyThreadState_GET(); - PyObject *threading = PyMapping_GetItemString(tstate->interp->modules, - "threading"); - if (threading == NULL) { - /* threading not imported */ - PyErr_Clear(); - return; - } - result = PyObject_CallMethod(threading, "_shutdown", ""); - if (result == NULL) - PyErr_WriteUnraisable(threading); - else - Py_DECREF(result); - Py_DECREF(threading); -#endif -} - -#define NEXITFUNCS 32 -static void (*exitfuncs[NEXITFUNCS])(void); -static int nexitfuncs = 0; - -int Py_AtExit(void (*func)(void)) -{ - if (nexitfuncs >= NEXITFUNCS) - return -1; - exitfuncs[nexitfuncs++] = func; - return 0; -} - -static void -call_sys_exitfunc(void) -{ - PyObject *exitfunc = PySys_GetObject("exitfunc"); - - if (exitfunc) { - PyObject *res; - Py_INCREF(exitfunc); - PySys_SetObject("exitfunc", (PyObject *)NULL); - res = PyEval_CallObject(exitfunc, (PyObject *)NULL); - if (res == NULL) { - if (!PyErr_ExceptionMatches(PyExc_SystemExit)) { - PySys_WriteStderr("Error in sys.exitfunc:\n"); - } - PyErr_Print(); - } - Py_DECREF(exitfunc); - } - - if (Py_FlushLine()) - PyErr_Clear(); -} - -static void -call_ll_exitfuncs(void) -{ - while (nexitfuncs > 0) - (*exitfuncs[--nexitfuncs])(); - - fflush(stdout); - fflush(stderr); -} - -void -Py_Exit(int sts) -{ - Py_Finalize(); - - exit(sts); -} - -static void -initsigs(void) -{ -#ifdef SIGPIPE - PyOS_setsig(SIGPIPE, SIG_IGN); -#endif -#ifdef SIGXFZ - PyOS_setsig(SIGXFZ, SIG_IGN); -#endif -#ifdef SIGXFSZ - PyOS_setsig(SIGXFSZ, SIG_IGN); -#endif - PyOS_InitInterrupts(); /* May imply initsignal() */ -} - - -/* - * The file descriptor fd is considered ``interactive'' if either - * a) isatty(fd) is TRUE, or - * b) the -i flag was given, and the filename associated with - * the descriptor is NULL or "" or "???". - */ -int -Py_FdIsInteractive(FILE *fp, const char *filename) -{ - if (isatty((int)fileno(fp))) - return 1; - if (!Py_InteractiveFlag) - return 0; - return (filename == NULL) || - (strcmp(filename, "") == 0) || - (strcmp(filename, "???") == 0); -} - - -#if defined(USE_STACKCHECK) -#if defined(WIN32) && defined(_MSC_VER) - -/* Stack checking for Microsoft C */ - -#include -#include - -/* - * Return non-zero when we run out of memory on the stack; zero otherwise. - */ -int -PyOS_CheckStack(void) -{ - __try { - /* alloca throws a stack overflow exception if there's - not enough space left on the stack */ - alloca(PYOS_STACK_MARGIN * sizeof(void*)); - return 0; - } __except (GetExceptionCode() == STATUS_STACK_OVERFLOW ? - EXCEPTION_EXECUTE_HANDLER : - EXCEPTION_CONTINUE_SEARCH) { - int errcode = _resetstkoflw(); - if (errcode == 0) - { - Py_FatalError("Could not reset the stack!"); - } - } - return 1; -} - -#endif /* WIN32 && _MSC_VER */ - -/* Alternate implementations can be added here... */ - -#endif /* USE_STACKCHECK */ - - -/* Wrappers around sigaction() or signal(). */ - -PyOS_sighandler_t -PyOS_getsig(int sig) -{ -#ifdef HAVE_SIGACTION - struct sigaction context; - if (sigaction(sig, NULL, &context) == -1) - return SIG_ERR; - return context.sa_handler; -#else - PyOS_sighandler_t handler; -/* Special signal handling for the secure CRT in Visual Studio 2005 */ -#if defined(_MSC_VER) && _MSC_VER >= 1400 - switch (sig) { - /* Only these signals are valid */ - case SIGINT: - case SIGILL: - case SIGFPE: - case SIGSEGV: - case SIGTERM: - case SIGBREAK: - case SIGABRT: - break; - /* Don't call signal() with other values or it will assert */ - default: - return SIG_ERR; - } -#endif /* _MSC_VER && _MSC_VER >= 1400 */ - handler = signal(sig, SIG_IGN); - if (handler != SIG_ERR) - signal(sig, handler); - return handler; -#endif -} - -PyOS_sighandler_t -PyOS_setsig(int sig, PyOS_sighandler_t handler) -{ -#ifdef HAVE_SIGACTION - /* Some code in Modules/signalmodule.c depends on sigaction() being - * used here if HAVE_SIGACTION is defined. Fix that if this code - * changes to invalidate that assumption. - */ - struct sigaction context, ocontext; - context.sa_handler = handler; - sigemptyset(&context.sa_mask); - context.sa_flags = 0; - if (sigaction(sig, &context, &ocontext) == -1) - return SIG_ERR; - return ocontext.sa_handler; -#else - PyOS_sighandler_t oldhandler; - oldhandler = signal(sig, handler); -#ifdef HAVE_SIGINTERRUPT - siginterrupt(sig, 1); -#endif - return oldhandler; -#endif -} - -/* Deprecated C API functions still provided for binary compatiblity */ - -#undef PyParser_SimpleParseFile -PyAPI_FUNC(node *) -PyParser_SimpleParseFile(FILE *fp, const char *filename, int start) -{ - return PyParser_SimpleParseFileFlags(fp, filename, start, 0); -} - -#undef PyParser_SimpleParseString -PyAPI_FUNC(node *) -PyParser_SimpleParseString(const char *str, int start) -{ - return PyParser_SimpleParseStringFlags(str, start, 0); -} - -#undef PyRun_AnyFile -PyAPI_FUNC(int) -PyRun_AnyFile(FILE *fp, const char *name) -{ - return PyRun_AnyFileExFlags(fp, name, 0, NULL); -} - -#undef PyRun_AnyFileEx -PyAPI_FUNC(int) -PyRun_AnyFileEx(FILE *fp, const char *name, int closeit) -{ - return PyRun_AnyFileExFlags(fp, name, closeit, NULL); -} - -#undef PyRun_AnyFileFlags -PyAPI_FUNC(int) -PyRun_AnyFileFlags(FILE *fp, const char *name, PyCompilerFlags *flags) -{ - return PyRun_AnyFileExFlags(fp, name, 0, flags); -} - -#undef PyRun_File -PyAPI_FUNC(PyObject *) -PyRun_File(FILE *fp, const char *p, int s, PyObject *g, PyObject *l) -{ - return PyRun_FileExFlags(fp, p, s, g, l, 0, NULL); -} - -#undef PyRun_FileEx -PyAPI_FUNC(PyObject *) -PyRun_FileEx(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, int c) -{ - return PyRun_FileExFlags(fp, p, s, g, l, c, NULL); -} - -#undef PyRun_FileFlags -PyAPI_FUNC(PyObject *) -PyRun_FileFlags(FILE *fp, const char *p, int s, PyObject *g, PyObject *l, - PyCompilerFlags *flags) -{ - return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); -} - -#undef PyRun_SimpleFile -PyAPI_FUNC(int) -PyRun_SimpleFile(FILE *f, const char *p) -{ - return PyRun_SimpleFileExFlags(f, p, 0, NULL); -} - -#undef PyRun_SimpleFileEx -PyAPI_FUNC(int) -PyRun_SimpleFileEx(FILE *f, const char *p, int c) -{ - return PyRun_SimpleFileExFlags(f, p, c, NULL); -} - - -#undef PyRun_String -PyAPI_FUNC(PyObject *) -PyRun_String(const char *str, int s, PyObject *g, PyObject *l) -{ - return PyRun_StringFlags(str, s, g, l, NULL); -} - -#undef PyRun_SimpleString -PyAPI_FUNC(int) -PyRun_SimpleString(const char *s) -{ - return PyRun_SimpleStringFlags(s, NULL); -} - -#undef Py_CompileString -PyAPI_FUNC(PyObject *) -Py_CompileString(const char *str, const char *p, int s) -{ - return Py_CompileStringFlags(str, p, s, NULL); -} - -#undef PyRun_InteractiveOne -PyAPI_FUNC(int) -PyRun_InteractiveOne(FILE *f, const char *p) -{ - return PyRun_InteractiveOneFlags(f, p, NULL); -} - -#undef PyRun_InteractiveLoop -PyAPI_FUNC(int) -PyRun_InteractiveLoop(FILE *f, const char *p) -{ - return PyRun_InteractiveLoopFlags(f, p, NULL); -} - -#ifdef __cplusplus -} -#endif - diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/structmember.c b/AppPkg/Applications/Python/Python-2.7.10/Python/structmember.c deleted file mode 100644 index ce018c7..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/structmember.c +++ /dev/null @@ -1,363 +0,0 @@ - -/* Map C struct members to Python object attributes */ - -#include "Python.h" - -#include "structmember.h" - -static PyObject * -listmembers(struct memberlist *mlist) -{ - int i, n; - PyObject *v; - for (n = 0; mlist[n].name != NULL; n++) - ; - v = PyList_New(n); - if (v != NULL) { - for (i = 0; i < n; i++) - PyList_SetItem(v, i, - PyString_FromString(mlist[i].name)); - if (PyErr_Occurred()) { - Py_DECREF(v); - v = NULL; - } - else { - PyList_Sort(v); - } - } - return v; -} - -PyObject * -PyMember_Get(const char *addr, struct memberlist *mlist, const char *name) -{ - struct memberlist *l; - - if (strcmp(name, "__members__") == 0) - return listmembers(mlist); - for (l = mlist; l->name != NULL; l++) { - if (strcmp(l->name, name) == 0) { - PyMemberDef copy; - copy.name = l->name; - copy.type = l->type; - copy.offset = l->offset; - copy.flags = l->flags; - copy.doc = NULL; - return PyMember_GetOne(addr, ©); - } - } - PyErr_SetString(PyExc_AttributeError, name); - return NULL; -} - -PyObject * -PyMember_GetOne(const char *addr, PyMemberDef *l) -{ - PyObject *v; - if ((l->flags & READ_RESTRICTED) && - PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, "restricted attribute"); - return NULL; - } - addr += l->offset; - switch (l->type) { - case T_BOOL: - v = PyBool_FromLong(*(char*)addr); - break; - case T_BYTE: - v = PyInt_FromLong(*(char*)addr); - break; - case T_UBYTE: - v = PyLong_FromUnsignedLong(*(unsigned char*)addr); - break; - case T_SHORT: - v = PyInt_FromLong(*(short*)addr); - break; - case T_USHORT: - v = PyLong_FromUnsignedLong(*(unsigned short*)addr); - break; - case T_INT: - v = PyInt_FromLong(*(int*)addr); - break; - case T_UINT: - v = PyLong_FromUnsignedLong(*(unsigned int*)addr); - break; - case T_LONG: - v = PyInt_FromLong(*(long*)addr); - break; - case T_ULONG: - v = PyLong_FromUnsignedLong(*(unsigned long*)addr); - break; - case T_PYSSIZET: - v = PyInt_FromSsize_t(*(Py_ssize_t*)addr); - break; - case T_FLOAT: - v = PyFloat_FromDouble((double)*(float*)addr); - break; - case T_DOUBLE: - v = PyFloat_FromDouble(*(double*)addr); - break; - case T_STRING: - if (*(char**)addr == NULL) { - Py_INCREF(Py_None); - v = Py_None; - } - else - v = PyString_FromString(*(char**)addr); - break; - case T_STRING_INPLACE: - v = PyString_FromString((char*)addr); - break; - case T_CHAR: - v = PyString_FromStringAndSize((char*)addr, 1); - break; - case T_OBJECT: - v = *(PyObject **)addr; - if (v == NULL) - v = Py_None; - Py_INCREF(v); - break; - case T_OBJECT_EX: - v = *(PyObject **)addr; - if (v == NULL) - PyErr_SetString(PyExc_AttributeError, l->name); - Py_XINCREF(v); - break; -#ifdef HAVE_LONG_LONG - case T_LONGLONG: - v = PyLong_FromLongLong(*(PY_LONG_LONG *)addr); - break; - case T_ULONGLONG: - v = PyLong_FromUnsignedLongLong(*(unsigned PY_LONG_LONG *)addr); - break; -#endif /* HAVE_LONG_LONG */ - default: - PyErr_SetString(PyExc_SystemError, "bad memberdescr type"); - v = NULL; - } - return v; -} - -int -PyMember_Set(char *addr, struct memberlist *mlist, const char *name, PyObject *v) -{ - struct memberlist *l; - - for (l = mlist; l->name != NULL; l++) { - if (strcmp(l->name, name) == 0) { - PyMemberDef copy; - copy.name = l->name; - copy.type = l->type; - copy.offset = l->offset; - copy.flags = l->flags; - copy.doc = NULL; - return PyMember_SetOne(addr, ©, v); - } - } - - PyErr_SetString(PyExc_AttributeError, name); - return -1; -} - -#define WARN(msg) \ - do { \ - if (PyErr_Warn(PyExc_RuntimeWarning, msg) < 0) \ - return -1; \ - } while (0) - -int -PyMember_SetOne(char *addr, PyMemberDef *l, PyObject *v) -{ - PyObject *oldv; - - addr += l->offset; - - if ((l->flags & READONLY)) - { - PyErr_SetString(PyExc_TypeError, "readonly attribute"); - return -1; - } - if ((l->flags & PY_WRITE_RESTRICTED) && PyEval_GetRestricted()) { - PyErr_SetString(PyExc_RuntimeError, "restricted attribute"); - return -1; - } - if (v == NULL) { - if (l->type == T_OBJECT_EX) { - /* Check if the attribute is set. */ - if (*(PyObject **)addr == NULL) { - PyErr_SetString(PyExc_AttributeError, l->name); - return -1; - } - } - else if (l->type != T_OBJECT) { - PyErr_SetString(PyExc_TypeError, - "can't delete numeric/char attribute"); - return -1; - } - } - switch (l->type) { - case T_BOOL:{ - if (!PyBool_Check(v)) { - PyErr_SetString(PyExc_TypeError, - "attribute value type must be bool"); - return -1; - } - if (v == Py_True) - *(char*)addr = (char) 1; - else - *(char*)addr = (char) 0; - break; - } - case T_BYTE:{ - long long_val = PyInt_AsLong(v); - if ((long_val == -1) && PyErr_Occurred()) - return -1; - *(char*)addr = (char)long_val; - /* XXX: For compatibility, only warn about truncations - for now. */ - if ((long_val > CHAR_MAX) || (long_val < CHAR_MIN)) - WARN("Truncation of value to char"); - break; - } - case T_UBYTE:{ - long long_val = PyInt_AsLong(v); - if ((long_val == -1) && PyErr_Occurred()) - return -1; - *(unsigned char*)addr = (unsigned char)long_val; - if ((long_val > UCHAR_MAX) || (long_val < 0)) - WARN("Truncation of value to unsigned char"); - break; - } - case T_SHORT:{ - long long_val = PyInt_AsLong(v); - if ((long_val == -1) && PyErr_Occurred()) - return -1; - *(short*)addr = (short)long_val; - if ((long_val > SHRT_MAX) || (long_val < SHRT_MIN)) - WARN("Truncation of value to short"); - break; - } - case T_USHORT:{ - long long_val = PyInt_AsLong(v); - if ((long_val == -1) && PyErr_Occurred()) - return -1; - *(unsigned short*)addr = (unsigned short)long_val; - if ((long_val > USHRT_MAX) || (long_val < 0)) - WARN("Truncation of value to unsigned short"); - break; - } - case T_INT:{ - long long_val = PyInt_AsLong(v); - if ((long_val == -1) && PyErr_Occurred()) - return -1; - *(int *)addr = (int)long_val; - if ((long_val > INT_MAX) || (long_val < INT_MIN)) - WARN("Truncation of value to int"); - break; - } - case T_UINT:{ - unsigned long ulong_val = PyLong_AsUnsignedLong(v); - if ((ulong_val == (unsigned long)-1) && PyErr_Occurred()) { - /* XXX: For compatibility, accept negative int values - as well. */ - PyErr_Clear(); - ulong_val = PyLong_AsLong(v); - if ((ulong_val == (unsigned long)-1) && - PyErr_Occurred()) - return -1; - *(unsigned int *)addr = (unsigned int)ulong_val; - WARN("Writing negative value into unsigned field"); - } else - *(unsigned int *)addr = (unsigned int)ulong_val; - if (ulong_val > UINT_MAX) - WARN("Truncation of value to unsigned int"); - break; - } - case T_LONG:{ - *(long*)addr = PyLong_AsLong(v); - if ((*(long*)addr == -1) && PyErr_Occurred()) - return -1; - break; - } - case T_ULONG:{ - *(unsigned long*)addr = PyLong_AsUnsignedLong(v); - if ((*(unsigned long*)addr == (unsigned long)-1) - && PyErr_Occurred()) { - /* XXX: For compatibility, accept negative int values - as well. */ - PyErr_Clear(); - *(unsigned long*)addr = PyLong_AsLong(v); - if ((*(unsigned long*)addr == (unsigned long)-1) - && PyErr_Occurred()) - return -1; - WARN("Writing negative value into unsigned field"); - } - break; - } - case T_PYSSIZET:{ - *(Py_ssize_t*)addr = PyInt_AsSsize_t(v); - if ((*(Py_ssize_t*)addr == (Py_ssize_t)-1) - && PyErr_Occurred()) - return -1; - break; - } - case T_FLOAT:{ - double double_val = PyFloat_AsDouble(v); - if ((double_val == -1) && PyErr_Occurred()) - return -1; - *(float*)addr = (float)double_val; - break; - } - case T_DOUBLE: - *(double*)addr = PyFloat_AsDouble(v); - if ((*(double*)addr == -1) && PyErr_Occurred()) - return -1; - break; - case T_OBJECT: - case T_OBJECT_EX: - Py_XINCREF(v); - oldv = *(PyObject **)addr; - *(PyObject **)addr = v; - Py_XDECREF(oldv); - break; - case T_CHAR: - if (PyString_Check(v) && PyString_Size(v) == 1) { - *(char*)addr = PyString_AsString(v)[0]; - } - else { - PyErr_BadArgument(); - return -1; - } - break; - case T_STRING: - case T_STRING_INPLACE: - PyErr_SetString(PyExc_TypeError, "readonly attribute"); - return -1; -#ifdef HAVE_LONG_LONG - case T_LONGLONG:{ - PY_LONG_LONG value; - *(PY_LONG_LONG*)addr = value = PyLong_AsLongLong(v); - if ((value == -1) && PyErr_Occurred()) - return -1; - break; - } - case T_ULONGLONG:{ - unsigned PY_LONG_LONG value; - /* ??? PyLong_AsLongLong accepts an int, but PyLong_AsUnsignedLongLong - doesn't ??? */ - if (PyLong_Check(v)) - *(unsigned PY_LONG_LONG*)addr = value = PyLong_AsUnsignedLongLong(v); - else - *(unsigned PY_LONG_LONG*)addr = value = PyInt_AsLong(v); - if ((value == (unsigned PY_LONG_LONG)-1) && PyErr_Occurred()) - return -1; - break; - } -#endif /* HAVE_LONG_LONG */ - default: - PyErr_Format(PyExc_SystemError, - "bad memberdescr type for %s", l->name); - return -1; - } - return 0; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/symtable.c b/AppPkg/Applications/Python/Python-2.7.10/Python/symtable.c deleted file mode 100644 index 661662f..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/symtable.c +++ /dev/null @@ -1,1556 +0,0 @@ -#include "Python.h" -#include "Python-ast.h" -#include "code.h" -#include "symtable.h" -#include "structmember.h" - -/* error strings used for warnings */ -#define GLOBAL_AFTER_ASSIGN \ -"name '%.400s' is assigned to before global declaration" - -#define GLOBAL_AFTER_USE \ -"name '%.400s' is used prior to global declaration" - -#define IMPORT_STAR_WARNING "import * only allowed at module level" - -#define RETURN_VAL_IN_GENERATOR \ - "'return' with argument inside generator" - - -static PySTEntryObject * -ste_new(struct symtable *st, identifier name, _Py_block_ty block, - void *key, int lineno) -{ - PySTEntryObject *ste = NULL; - PyObject *k = NULL; - - k = PyLong_FromVoidPtr(key); - if (k == NULL) - goto fail; - ste = PyObject_New(PySTEntryObject, &PySTEntry_Type); - if (ste == NULL) { - Py_DECREF(k); - goto fail; - } - ste->ste_table = st; - ste->ste_id = k; /* ste owns reference to k */ - - ste->ste_name = name; - Py_INCREF(name); - - ste->ste_symbols = NULL; - ste->ste_varnames = NULL; - ste->ste_children = NULL; - - ste->ste_symbols = PyDict_New(); - if (ste->ste_symbols == NULL) - goto fail; - - ste->ste_varnames = PyList_New(0); - if (ste->ste_varnames == NULL) - goto fail; - - ste->ste_children = PyList_New(0); - if (ste->ste_children == NULL) - goto fail; - - ste->ste_type = block; - ste->ste_unoptimized = 0; - ste->ste_nested = 0; - ste->ste_free = 0; - ste->ste_varargs = 0; - ste->ste_varkeywords = 0; - ste->ste_opt_lineno = 0; - ste->ste_tmpname = 0; - ste->ste_lineno = lineno; - - if (st->st_cur != NULL && - (st->st_cur->ste_nested || - st->st_cur->ste_type == FunctionBlock)) - ste->ste_nested = 1; - ste->ste_child_free = 0; - ste->ste_generator = 0; - ste->ste_returns_value = 0; - - if (PyDict_SetItem(st->st_symbols, ste->ste_id, (PyObject *)ste) < 0) - goto fail; - - return ste; - fail: - Py_XDECREF(ste); - return NULL; -} - -static PyObject * -ste_repr(PySTEntryObject *ste) -{ - char buf[256]; - - PyOS_snprintf(buf, sizeof(buf), - "", - PyString_AS_STRING(ste->ste_name), - PyInt_AS_LONG(ste->ste_id), ste->ste_lineno); - return PyString_FromString(buf); -} - -static void -ste_dealloc(PySTEntryObject *ste) -{ - ste->ste_table = NULL; - Py_XDECREF(ste->ste_id); - Py_XDECREF(ste->ste_name); - Py_XDECREF(ste->ste_symbols); - Py_XDECREF(ste->ste_varnames); - Py_XDECREF(ste->ste_children); - PyObject_Del(ste); -} - -#define OFF(x) offsetof(PySTEntryObject, x) - -static PyMemberDef ste_memberlist[] = { - {"id", T_OBJECT, OFF(ste_id), READONLY}, - {"name", T_OBJECT, OFF(ste_name), READONLY}, - {"symbols", T_OBJECT, OFF(ste_symbols), READONLY}, - {"varnames", T_OBJECT, OFF(ste_varnames), READONLY}, - {"children", T_OBJECT, OFF(ste_children), READONLY}, - {"optimized",T_INT, OFF(ste_unoptimized), READONLY}, - {"nested", T_INT, OFF(ste_nested), READONLY}, - {"type", T_INT, OFF(ste_type), READONLY}, - {"lineno", T_INT, OFF(ste_lineno), READONLY}, - {NULL} -}; - -PyTypeObject PySTEntry_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "symtable entry", - sizeof(PySTEntryObject), - 0, - (destructor)ste_dealloc, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_compare */ - (reprfunc)ste_repr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - PyObject_GenericGetAttr, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT, /* tp_flags */ - 0, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - ste_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - 0, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -static int symtable_analyze(struct symtable *st); -static int symtable_warn(struct symtable *st, char *msg, int lineno); -static int symtable_enter_block(struct symtable *st, identifier name, - _Py_block_ty block, void *ast, int lineno); -static int symtable_exit_block(struct symtable *st, void *ast); -static int symtable_visit_stmt(struct symtable *st, stmt_ty s); -static int symtable_visit_expr(struct symtable *st, expr_ty s); -static int symtable_visit_genexp(struct symtable *st, expr_ty s); -static int symtable_visit_setcomp(struct symtable *st, expr_ty e); -static int symtable_visit_dictcomp(struct symtable *st, expr_ty e); -static int symtable_visit_arguments(struct symtable *st, arguments_ty); -static int symtable_visit_excepthandler(struct symtable *st, excepthandler_ty); -static int symtable_visit_alias(struct symtable *st, alias_ty); -static int symtable_visit_comprehension(struct symtable *st, comprehension_ty); -static int symtable_visit_keyword(struct symtable *st, keyword_ty); -static int symtable_visit_slice(struct symtable *st, slice_ty); -static int symtable_visit_params(struct symtable *st, asdl_seq *args, int top); -static int symtable_visit_params_nested(struct symtable *st, asdl_seq *args); -static int symtable_implicit_arg(struct symtable *st, int pos); - - -static identifier top = NULL, lambda = NULL, genexpr = NULL, setcomp = NULL, - dictcomp = NULL; - -#define GET_IDENTIFIER(VAR) \ - ((VAR) ? (VAR) : ((VAR) = PyString_InternFromString(# VAR))) - -#define DUPLICATE_ARGUMENT \ -"duplicate argument '%s' in function definition" - -static struct symtable * -symtable_new(void) -{ - struct symtable *st; - - st = (struct symtable *)PyMem_Malloc(sizeof(struct symtable)); - if (st == NULL) - return NULL; - - st->st_filename = NULL; - st->st_symbols = NULL; - - if ((st->st_stack = PyList_New(0)) == NULL) - goto fail; - if ((st->st_symbols = PyDict_New()) == NULL) - goto fail; - st->st_cur = NULL; - st->st_private = NULL; - return st; - fail: - PySymtable_Free(st); - return NULL; -} - -struct symtable * -PySymtable_Build(mod_ty mod, const char *filename, PyFutureFeatures *future) -{ - struct symtable *st = symtable_new(); - asdl_seq *seq; - int i; - - if (st == NULL) - return st; - st->st_filename = filename; - st->st_future = future; - if (!GET_IDENTIFIER(top) || - !symtable_enter_block(st, top, ModuleBlock, (void *)mod, 0)) { - PySymtable_Free(st); - return NULL; - } - - st->st_top = st->st_cur; - st->st_cur->ste_unoptimized = OPT_TOPLEVEL; - /* Any other top-level initialization? */ - switch (mod->kind) { - case Module_kind: - seq = mod->v.Module.body; - for (i = 0; i < asdl_seq_LEN(seq); i++) - if (!symtable_visit_stmt(st, - (stmt_ty)asdl_seq_GET(seq, i))) - goto error; - break; - case Expression_kind: - if (!symtable_visit_expr(st, mod->v.Expression.body)) - goto error; - break; - case Interactive_kind: - seq = mod->v.Interactive.body; - for (i = 0; i < asdl_seq_LEN(seq); i++) - if (!symtable_visit_stmt(st, - (stmt_ty)asdl_seq_GET(seq, i))) - goto error; - break; - case Suite_kind: - PyErr_SetString(PyExc_RuntimeError, - "this compiler does not handle Suites"); - goto error; - } - if (!symtable_exit_block(st, (void *)mod)) { - PySymtable_Free(st); - return NULL; - } - if (symtable_analyze(st)) - return st; - PySymtable_Free(st); - return NULL; - error: - (void) symtable_exit_block(st, (void *)mod); - PySymtable_Free(st); - return NULL; -} - -void -PySymtable_Free(struct symtable *st) -{ - Py_XDECREF(st->st_symbols); - Py_XDECREF(st->st_stack); - PyMem_Free((void *)st); -} - -PySTEntryObject * -PySymtable_Lookup(struct symtable *st, void *key) -{ - PyObject *k, *v; - - k = PyLong_FromVoidPtr(key); - if (k == NULL) - return NULL; - v = PyDict_GetItem(st->st_symbols, k); - if (v) { - assert(PySTEntry_Check(v)); - Py_INCREF(v); - } - else { - PyErr_SetString(PyExc_KeyError, - "unknown symbol table entry"); - } - - Py_DECREF(k); - return (PySTEntryObject *)v; -} - -int -PyST_GetScope(PySTEntryObject *ste, PyObject *name) -{ - PyObject *v = PyDict_GetItem(ste->ste_symbols, name); - if (!v) - return 0; - assert(PyInt_Check(v)); - return (PyInt_AS_LONG(v) >> SCOPE_OFF) & SCOPE_MASK; -} - - -/* Analyze raw symbol information to determine scope of each name. - - The next several functions are helpers for PySymtable_Analyze(), - which determines whether a name is local, global, or free. In addition, - it determines which local variables are cell variables; they provide - bindings that are used for free variables in enclosed blocks. - - There are also two kinds of free variables, implicit and explicit. An - explicit global is declared with the global statement. An implicit - global is a free variable for which the compiler has found no binding - in an enclosing function scope. The implicit global is either a global - or a builtin. Python's module and class blocks use the xxx_NAME opcodes - to handle these names to implement slightly odd semantics. In such a - block, the name is treated as global until it is assigned to; then it - is treated as a local. - - The symbol table requires two passes to determine the scope of each name. - The first pass collects raw facts from the AST: the name is a parameter - here, the name is used by not defined here, etc. The second pass analyzes - these facts during a pass over the PySTEntryObjects created during pass 1. - - When a function is entered during the second pass, the parent passes - the set of all name bindings visible to its children. These bindings - are used to determine if the variable is free or an implicit global. - After doing the local analysis, it analyzes each of its child blocks - using an updated set of name bindings. - - The children update the free variable set. If a local variable is free - in a child, the variable is marked as a cell. The current function must - provide runtime storage for the variable that may outlive the function's - frame. Cell variables are removed from the free set before the analyze - function returns to its parent. - - The sets of bound and free variables are implemented as dictionaries - mapping strings to None. -*/ - -#define SET_SCOPE(DICT, NAME, I) { \ - PyObject *o = PyInt_FromLong(I); \ - if (!o) \ - return 0; \ - if (PyDict_SetItem((DICT), (NAME), o) < 0) { \ - Py_DECREF(o); \ - return 0; \ - } \ - Py_DECREF(o); \ -} - -/* Decide on scope of name, given flags. - - The namespace dictionaries may be modified to record information - about the new name. For example, a new global will add an entry to - global. A name that was global can be changed to local. -*/ - -static int -analyze_name(PySTEntryObject *ste, PyObject *dict, PyObject *name, long flags, - PyObject *bound, PyObject *local, PyObject *free, - PyObject *global) -{ - if (flags & DEF_GLOBAL) { - if (flags & DEF_PARAM) { - PyErr_Format(PyExc_SyntaxError, - "name '%s' is local and global", - PyString_AS_STRING(name)); - PyErr_SyntaxLocation(ste->ste_table->st_filename, - ste->ste_lineno); - - return 0; - } - SET_SCOPE(dict, name, GLOBAL_EXPLICIT); - if (PyDict_SetItem(global, name, Py_None) < 0) - return 0; - if (bound && PyDict_GetItem(bound, name)) { - if (PyDict_DelItem(bound, name) < 0) - return 0; - } - return 1; - } - if (flags & DEF_BOUND) { - SET_SCOPE(dict, name, LOCAL); - if (PyDict_SetItem(local, name, Py_None) < 0) - return 0; - if (PyDict_GetItem(global, name)) { - if (PyDict_DelItem(global, name) < 0) - return 0; - } - return 1; - } - /* If an enclosing block has a binding for this name, it - is a free variable rather than a global variable. - Note that having a non-NULL bound implies that the block - is nested. - */ - if (bound && PyDict_GetItem(bound, name)) { - SET_SCOPE(dict, name, FREE); - ste->ste_free = 1; - if (PyDict_SetItem(free, name, Py_None) < 0) - return 0; - return 1; - } - /* If a parent has a global statement, then call it global - explicit? It could also be global implicit. - */ - else if (global && PyDict_GetItem(global, name)) { - SET_SCOPE(dict, name, GLOBAL_IMPLICIT); - return 1; - } - else { - if (ste->ste_nested) - ste->ste_free = 1; - SET_SCOPE(dict, name, GLOBAL_IMPLICIT); - return 1; - } - /* Should never get here. */ - PyErr_Format(PyExc_SystemError, "failed to set scope for %s", - PyString_AS_STRING(name)); - return 0; -} - -#undef SET_SCOPE - -/* If a name is defined in free and also in locals, then this block - provides the binding for the free variable. The name should be - marked CELL in this block and removed from the free list. - - Note that the current block's free variables are included in free. - That's safe because no name can be free and local in the same scope. -*/ - -static int -analyze_cells(PyObject *scope, PyObject *free) -{ - PyObject *name, *v, *w; - int success = 0; - Py_ssize_t pos = 0; - - w = PyInt_FromLong(CELL); - if (!w) - return 0; - while (PyDict_Next(scope, &pos, &name, &v)) { - long flags; - assert(PyInt_Check(v)); - flags = PyInt_AS_LONG(v); - if (flags != LOCAL) - continue; - if (!PyDict_GetItem(free, name)) - continue; - /* Replace LOCAL with CELL for this name, and remove - from free. It is safe to replace the value of name - in the dict, because it will not cause a resize. - */ - if (PyDict_SetItem(scope, name, w) < 0) - goto error; - if (PyDict_DelItem(free, name) < 0) - goto error; - } - success = 1; - error: - Py_DECREF(w); - return success; -} - -/* Check for illegal statements in unoptimized namespaces */ -static int -check_unoptimized(const PySTEntryObject* ste) { - char buf[300]; - const char* trailer; - - if (ste->ste_type != FunctionBlock || !ste->ste_unoptimized - || !(ste->ste_free || ste->ste_child_free)) - return 1; - - trailer = (ste->ste_child_free ? - "contains a nested function with free variables" : - "is a nested function"); - - switch (ste->ste_unoptimized) { - case OPT_TOPLEVEL: /* exec / import * at top-level is fine */ - case OPT_EXEC: /* qualified exec is fine */ - return 1; - case OPT_IMPORT_STAR: - PyOS_snprintf(buf, sizeof(buf), - "import * is not allowed in function '%.100s' " - "because it %s", - PyString_AS_STRING(ste->ste_name), trailer); - break; - case OPT_BARE_EXEC: - PyOS_snprintf(buf, sizeof(buf), - "unqualified exec is not allowed in function " - "'%.100s' because it %s", - PyString_AS_STRING(ste->ste_name), trailer); - break; - default: - PyOS_snprintf(buf, sizeof(buf), - "function '%.100s' uses import * and bare exec, " - "which are illegal because it %s", - PyString_AS_STRING(ste->ste_name), trailer); - break; - } - - PyErr_SetString(PyExc_SyntaxError, buf); - PyErr_SyntaxLocation(ste->ste_table->st_filename, - ste->ste_opt_lineno); - return 0; -} - -/* Enter the final scope information into the st_symbols dict. - * - * All arguments are dicts. Modifies symbols, others are read-only. -*/ -static int -update_symbols(PyObject *symbols, PyObject *scope, - PyObject *bound, PyObject *free, int classflag) -{ - PyObject *name, *v, *u, *w, *free_value = NULL; - Py_ssize_t pos = 0; - - while (PyDict_Next(symbols, &pos, &name, &v)) { - long i, flags; - assert(PyInt_Check(v)); - flags = PyInt_AS_LONG(v); - w = PyDict_GetItem(scope, name); - assert(w && PyInt_Check(w)); - i = PyInt_AS_LONG(w); - flags |= (i << SCOPE_OFF); - u = PyInt_FromLong(flags); - if (!u) - return 0; - if (PyDict_SetItem(symbols, name, u) < 0) { - Py_DECREF(u); - return 0; - } - Py_DECREF(u); - } - - free_value = PyInt_FromLong(FREE << SCOPE_OFF); - if (!free_value) - return 0; - - /* add a free variable when it's only use is for creating a closure */ - pos = 0; - while (PyDict_Next(free, &pos, &name, &v)) { - PyObject *o = PyDict_GetItem(symbols, name); - - if (o) { - /* It could be a free variable in a method of - the class that has the same name as a local - or global in the class scope. - */ - if (classflag && - PyInt_AS_LONG(o) & (DEF_BOUND | DEF_GLOBAL)) { - long i = PyInt_AS_LONG(o) | DEF_FREE_CLASS; - o = PyInt_FromLong(i); - if (!o) { - Py_DECREF(free_value); - return 0; - } - if (PyDict_SetItem(symbols, name, o) < 0) { - Py_DECREF(o); - Py_DECREF(free_value); - return 0; - } - Py_DECREF(o); - } - /* else it's not free, probably a cell */ - continue; - } - if (!PyDict_GetItem(bound, name)) - continue; /* it's a global */ - - if (PyDict_SetItem(symbols, name, free_value) < 0) { - Py_DECREF(free_value); - return 0; - } - } - Py_DECREF(free_value); - return 1; -} - -/* Make final symbol table decisions for block of ste. - - Arguments: - ste -- current symtable entry (input/output) - bound -- set of variables bound in enclosing scopes (input). bound - is NULL for module blocks. - free -- set of free variables in enclosed scopes (output) - globals -- set of declared global variables in enclosing scopes (input) - - The implementation uses two mutually recursive functions, - analyze_block() and analyze_child_block(). analyze_block() is - responsible for analyzing the individual names defined in a block. - analyze_child_block() prepares temporary namespace dictionaries - used to evaluated nested blocks. - - The two functions exist because a child block should see the name - bindings of its enclosing blocks, but those bindings should not - propagate back to a parent block. -*/ - -static int -analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free, - PyObject *global, PyObject* child_free); - -static int -analyze_block(PySTEntryObject *ste, PyObject *bound, PyObject *free, - PyObject *global) -{ - PyObject *name, *v, *local = NULL, *scope = NULL; - PyObject *newbound = NULL, *newglobal = NULL; - PyObject *newfree = NULL, *allfree = NULL; - int i, success = 0; - Py_ssize_t pos = 0; - - local = PyDict_New(); /* collect new names bound in block */ - if (!local) - goto error; - scope = PyDict_New(); /* collect scopes defined for each name */ - if (!scope) - goto error; - - /* Allocate new global and bound variable dictionaries. These - dictionaries hold the names visible in nested blocks. For - ClassBlocks, the bound and global names are initialized - before analyzing names, because class bindings aren't - visible in methods. For other blocks, they are initialized - after names are analyzed. - */ - - /* TODO(jhylton): Package these dicts in a struct so that we - can write reasonable helper functions? - */ - newglobal = PyDict_New(); - if (!newglobal) - goto error; - newbound = PyDict_New(); - if (!newbound) - goto error; - newfree = PyDict_New(); - if (!newfree) - goto error; - - if (ste->ste_type == ClassBlock) { - if (PyDict_Update(newglobal, global) < 0) - goto error; - if (bound) - if (PyDict_Update(newbound, bound) < 0) - goto error; - } - - while (PyDict_Next(ste->ste_symbols, &pos, &name, &v)) { - long flags = PyInt_AS_LONG(v); - if (!analyze_name(ste, scope, name, flags, - bound, local, free, global)) - goto error; - } - - if (ste->ste_type != ClassBlock) { - if (ste->ste_type == FunctionBlock) { - if (PyDict_Update(newbound, local) < 0) - goto error; - } - if (bound) { - if (PyDict_Update(newbound, bound) < 0) - goto error; - } - if (PyDict_Update(newglobal, global) < 0) - goto error; - } - - /* Recursively call analyze_block() on each child block. - - newbound, newglobal now contain the names visible in - nested blocks. The free variables in the children will - be collected in allfree. - */ - allfree = PyDict_New(); - if (!allfree) - goto error; - for (i = 0; i < PyList_GET_SIZE(ste->ste_children); ++i) { - PyObject *c = PyList_GET_ITEM(ste->ste_children, i); - PySTEntryObject* entry; - assert(c && PySTEntry_Check(c)); - entry = (PySTEntryObject*)c; - if (!analyze_child_block(entry, newbound, newfree, newglobal, - allfree)) - goto error; - if (entry->ste_free || entry->ste_child_free) - ste->ste_child_free = 1; - } - - if (PyDict_Update(newfree, allfree) < 0) - goto error; - if (ste->ste_type == FunctionBlock && !analyze_cells(scope, newfree)) - goto error; - if (!update_symbols(ste->ste_symbols, scope, bound, newfree, - ste->ste_type == ClassBlock)) - goto error; - if (!check_unoptimized(ste)) - goto error; - - if (PyDict_Update(free, newfree) < 0) - goto error; - success = 1; - error: - Py_XDECREF(local); - Py_XDECREF(scope); - Py_XDECREF(newbound); - Py_XDECREF(newglobal); - Py_XDECREF(newfree); - Py_XDECREF(allfree); - if (!success) - assert(PyErr_Occurred()); - return success; -} - -static int -analyze_child_block(PySTEntryObject *entry, PyObject *bound, PyObject *free, - PyObject *global, PyObject* child_free) -{ - PyObject *temp_bound = NULL, *temp_global = NULL, *temp_free = NULL; - - /* Copy the bound and global dictionaries. - - These dictionary are used by all blocks enclosed by the - current block. The analyze_block() call modifies these - dictionaries. - - */ - temp_bound = PyDict_New(); - if (!temp_bound) - goto error; - if (PyDict_Update(temp_bound, bound) < 0) - goto error; - temp_free = PyDict_New(); - if (!temp_free) - goto error; - if (PyDict_Update(temp_free, free) < 0) - goto error; - temp_global = PyDict_New(); - if (!temp_global) - goto error; - if (PyDict_Update(temp_global, global) < 0) - goto error; - - if (!analyze_block(entry, temp_bound, temp_free, temp_global)) - goto error; - if (PyDict_Update(child_free, temp_free) < 0) - goto error; - Py_DECREF(temp_bound); - Py_DECREF(temp_free); - Py_DECREF(temp_global); - return 1; - error: - Py_XDECREF(temp_bound); - Py_XDECREF(temp_free); - Py_XDECREF(temp_global); - return 0; -} - -static int -symtable_analyze(struct symtable *st) -{ - PyObject *free, *global; - int r; - - free = PyDict_New(); - if (!free) - return 0; - global = PyDict_New(); - if (!global) { - Py_DECREF(free); - return 0; - } - r = analyze_block(st->st_top, NULL, free, global); - Py_DECREF(free); - Py_DECREF(global); - return r; -} - - -static int -symtable_warn(struct symtable *st, char *msg, int lineno) -{ - if (PyErr_WarnExplicit(PyExc_SyntaxWarning, msg, st->st_filename, - lineno, NULL, NULL) < 0) { - if (PyErr_ExceptionMatches(PyExc_SyntaxWarning)) { - PyErr_SetString(PyExc_SyntaxError, msg); - PyErr_SyntaxLocation(st->st_filename, - st->st_cur->ste_lineno); - } - return 0; - } - return 1; -} - -/* symtable_enter_block() gets a reference via ste_new. - This reference is released when the block is exited, via the DECREF - in symtable_exit_block(). -*/ - -static int -symtable_exit_block(struct symtable *st, void *ast) -{ - Py_ssize_t end; - - Py_CLEAR(st->st_cur); - end = PyList_GET_SIZE(st->st_stack) - 1; - if (end >= 0) { - st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, - end); - if (st->st_cur == NULL) - return 0; - Py_INCREF(st->st_cur); - if (PySequence_DelItem(st->st_stack, end) < 0) - return 0; - } - return 1; -} - -static int -symtable_enter_block(struct symtable *st, identifier name, _Py_block_ty block, - void *ast, int lineno) -{ - PySTEntryObject *prev = NULL; - - if (st->st_cur) { - prev = st->st_cur; - if (PyList_Append(st->st_stack, (PyObject *)st->st_cur) < 0) { - return 0; - } - Py_DECREF(st->st_cur); - } - st->st_cur = ste_new(st, name, block, ast, lineno); - if (st->st_cur == NULL) - return 0; - if (block == ModuleBlock) - st->st_global = st->st_cur->ste_symbols; - if (prev) { - if (PyList_Append(prev->ste_children, - (PyObject *)st->st_cur) < 0) { - return 0; - } - } - return 1; -} - -static long -symtable_lookup(struct symtable *st, PyObject *name) -{ - PyObject *o; - PyObject *mangled = _Py_Mangle(st->st_private, name); - if (!mangled) - return 0; - o = PyDict_GetItem(st->st_cur->ste_symbols, mangled); - Py_DECREF(mangled); - if (!o) - return 0; - return PyInt_AsLong(o); -} - -static int -symtable_add_def(struct symtable *st, PyObject *name, int flag) -{ - PyObject *o; - PyObject *dict; - long val; - PyObject *mangled = _Py_Mangle(st->st_private, name); - - if (!mangled) - return 0; - dict = st->st_cur->ste_symbols; - if ((o = PyDict_GetItem(dict, mangled))) { - val = PyInt_AS_LONG(o); - if ((flag & DEF_PARAM) && (val & DEF_PARAM)) { - /* Is it better to use 'mangled' or 'name' here? */ - PyErr_Format(PyExc_SyntaxError, DUPLICATE_ARGUMENT, - PyString_AsString(name)); - PyErr_SyntaxLocation(st->st_filename, - st->st_cur->ste_lineno); - goto error; - } - val |= flag; - } else - val = flag; - o = PyInt_FromLong(val); - if (o == NULL) - goto error; - if (PyDict_SetItem(dict, mangled, o) < 0) { - Py_DECREF(o); - goto error; - } - Py_DECREF(o); - - if (flag & DEF_PARAM) { - if (PyList_Append(st->st_cur->ste_varnames, mangled) < 0) - goto error; - } else if (flag & DEF_GLOBAL) { - /* XXX need to update DEF_GLOBAL for other flags too; - perhaps only DEF_FREE_GLOBAL */ - val = flag; - if ((o = PyDict_GetItem(st->st_global, mangled))) { - val |= PyInt_AS_LONG(o); - } - o = PyInt_FromLong(val); - if (o == NULL) - goto error; - if (PyDict_SetItem(st->st_global, mangled, o) < 0) { - Py_DECREF(o); - goto error; - } - Py_DECREF(o); - } - Py_DECREF(mangled); - return 1; - -error: - Py_DECREF(mangled); - return 0; -} - -/* VISIT, VISIT_SEQ and VIST_SEQ_TAIL take an ASDL type as their second argument. - They use the ASDL name to synthesize the name of the C type and the visit - function. - - VISIT_SEQ_TAIL permits the start of an ASDL sequence to be skipped, which is - useful if the first node in the sequence requires special treatment. -*/ - -#define VISIT(ST, TYPE, V) \ - if (!symtable_visit_ ## TYPE((ST), (V))) \ - return 0; - -#define VISIT_IN_BLOCK(ST, TYPE, V, S) \ - if (!symtable_visit_ ## TYPE((ST), (V))) { \ - symtable_exit_block((ST), (S)); \ - return 0; \ - } - -#define VISIT_SEQ(ST, TYPE, SEQ) { \ - int i; \ - asdl_seq *seq = (SEQ); /* avoid variable capture */ \ - for (i = 0; i < asdl_seq_LEN(seq); i++) { \ - TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \ - if (!symtable_visit_ ## TYPE((ST), elt)) \ - return 0; \ - } \ -} - -#define VISIT_SEQ_IN_BLOCK(ST, TYPE, SEQ, S) { \ - int i; \ - asdl_seq *seq = (SEQ); /* avoid variable capture */ \ - for (i = 0; i < asdl_seq_LEN(seq); i++) { \ - TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \ - if (!symtable_visit_ ## TYPE((ST), elt)) { \ - symtable_exit_block((ST), (S)); \ - return 0; \ - } \ - } \ -} - -#define VISIT_SEQ_TAIL(ST, TYPE, SEQ, START) { \ - int i; \ - asdl_seq *seq = (SEQ); /* avoid variable capture */ \ - for (i = (START); i < asdl_seq_LEN(seq); i++) { \ - TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \ - if (!symtable_visit_ ## TYPE((ST), elt)) \ - return 0; \ - } \ -} - -#define VISIT_SEQ_TAIL_IN_BLOCK(ST, TYPE, SEQ, START, S) { \ - int i; \ - asdl_seq *seq = (SEQ); /* avoid variable capture */ \ - for (i = (START); i < asdl_seq_LEN(seq); i++) { \ - TYPE ## _ty elt = (TYPE ## _ty)asdl_seq_GET(seq, i); \ - if (!symtable_visit_ ## TYPE((ST), elt)) { \ - symtable_exit_block((ST), (S)); \ - return 0; \ - } \ - } \ -} - -static int -symtable_visit_stmt(struct symtable *st, stmt_ty s) -{ - switch (s->kind) { - case FunctionDef_kind: - if (!symtable_add_def(st, s->v.FunctionDef.name, DEF_LOCAL)) - return 0; - if (s->v.FunctionDef.args->defaults) - VISIT_SEQ(st, expr, s->v.FunctionDef.args->defaults); - if (s->v.FunctionDef.decorator_list) - VISIT_SEQ(st, expr, s->v.FunctionDef.decorator_list); - if (!symtable_enter_block(st, s->v.FunctionDef.name, - FunctionBlock, (void *)s, s->lineno)) - return 0; - VISIT_IN_BLOCK(st, arguments, s->v.FunctionDef.args, s); - VISIT_SEQ_IN_BLOCK(st, stmt, s->v.FunctionDef.body, s); - if (!symtable_exit_block(st, s)) - return 0; - break; - case ClassDef_kind: { - PyObject *tmp; - if (!symtable_add_def(st, s->v.ClassDef.name, DEF_LOCAL)) - return 0; - VISIT_SEQ(st, expr, s->v.ClassDef.bases); - if (s->v.ClassDef.decorator_list) - VISIT_SEQ(st, expr, s->v.ClassDef.decorator_list); - if (!symtable_enter_block(st, s->v.ClassDef.name, ClassBlock, - (void *)s, s->lineno)) - return 0; - tmp = st->st_private; - st->st_private = s->v.ClassDef.name; - VISIT_SEQ_IN_BLOCK(st, stmt, s->v.ClassDef.body, s); - st->st_private = tmp; - if (!symtable_exit_block(st, s)) - return 0; - break; - } - case Return_kind: - if (s->v.Return.value) { - VISIT(st, expr, s->v.Return.value); - st->st_cur->ste_returns_value = 1; - if (st->st_cur->ste_generator) { - PyErr_SetString(PyExc_SyntaxError, - RETURN_VAL_IN_GENERATOR); - PyErr_SyntaxLocation(st->st_filename, - s->lineno); - return 0; - } - } - break; - case Delete_kind: - VISIT_SEQ(st, expr, s->v.Delete.targets); - break; - case Assign_kind: - VISIT_SEQ(st, expr, s->v.Assign.targets); - VISIT(st, expr, s->v.Assign.value); - break; - case AugAssign_kind: - VISIT(st, expr, s->v.AugAssign.target); - VISIT(st, expr, s->v.AugAssign.value); - break; - case Print_kind: - if (s->v.Print.dest) - VISIT(st, expr, s->v.Print.dest); - VISIT_SEQ(st, expr, s->v.Print.values); - break; - case For_kind: - VISIT(st, expr, s->v.For.target); - VISIT(st, expr, s->v.For.iter); - VISIT_SEQ(st, stmt, s->v.For.body); - if (s->v.For.orelse) - VISIT_SEQ(st, stmt, s->v.For.orelse); - break; - case While_kind: - VISIT(st, expr, s->v.While.test); - VISIT_SEQ(st, stmt, s->v.While.body); - if (s->v.While.orelse) - VISIT_SEQ(st, stmt, s->v.While.orelse); - break; - case If_kind: - /* XXX if 0: and lookup_yield() hacks */ - VISIT(st, expr, s->v.If.test); - VISIT_SEQ(st, stmt, s->v.If.body); - if (s->v.If.orelse) - VISIT_SEQ(st, stmt, s->v.If.orelse); - break; - case Raise_kind: - if (s->v.Raise.type) { - VISIT(st, expr, s->v.Raise.type); - if (s->v.Raise.inst) { - VISIT(st, expr, s->v.Raise.inst); - if (s->v.Raise.tback) - VISIT(st, expr, s->v.Raise.tback); - } - } - break; - case TryExcept_kind: - VISIT_SEQ(st, stmt, s->v.TryExcept.body); - VISIT_SEQ(st, stmt, s->v.TryExcept.orelse); - VISIT_SEQ(st, excepthandler, s->v.TryExcept.handlers); - break; - case TryFinally_kind: - VISIT_SEQ(st, stmt, s->v.TryFinally.body); - VISIT_SEQ(st, stmt, s->v.TryFinally.finalbody); - break; - case Assert_kind: - VISIT(st, expr, s->v.Assert.test); - if (s->v.Assert.msg) - VISIT(st, expr, s->v.Assert.msg); - break; - case Import_kind: - VISIT_SEQ(st, alias, s->v.Import.names); - /* XXX Don't have the lineno available inside - visit_alias */ - if (st->st_cur->ste_unoptimized && !st->st_cur->ste_opt_lineno) - st->st_cur->ste_opt_lineno = s->lineno; - break; - case ImportFrom_kind: - VISIT_SEQ(st, alias, s->v.ImportFrom.names); - /* XXX Don't have the lineno available inside - visit_alias */ - if (st->st_cur->ste_unoptimized && !st->st_cur->ste_opt_lineno) - st->st_cur->ste_opt_lineno = s->lineno; - break; - case Exec_kind: - VISIT(st, expr, s->v.Exec.body); - if (!st->st_cur->ste_opt_lineno) - st->st_cur->ste_opt_lineno = s->lineno; - if (s->v.Exec.globals) { - st->st_cur->ste_unoptimized |= OPT_EXEC; - VISIT(st, expr, s->v.Exec.globals); - if (s->v.Exec.locals) - VISIT(st, expr, s->v.Exec.locals); - } else { - st->st_cur->ste_unoptimized |= OPT_BARE_EXEC; - } - break; - case Global_kind: { - int i; - asdl_seq *seq = s->v.Global.names; - for (i = 0; i < asdl_seq_LEN(seq); i++) { - identifier name = (identifier)asdl_seq_GET(seq, i); - char *c_name = PyString_AS_STRING(name); - long cur = symtable_lookup(st, name); - if (cur < 0) - return 0; - if (cur & (DEF_LOCAL | USE)) { - char buf[256]; - if (cur & DEF_LOCAL) - PyOS_snprintf(buf, sizeof(buf), - GLOBAL_AFTER_ASSIGN, - c_name); - else - PyOS_snprintf(buf, sizeof(buf), - GLOBAL_AFTER_USE, - c_name); - if (!symtable_warn(st, buf, s->lineno)) - return 0; - } - if (!symtable_add_def(st, name, DEF_GLOBAL)) - return 0; - } - break; - } - case Expr_kind: - VISIT(st, expr, s->v.Expr.value); - break; - case Pass_kind: - case Break_kind: - case Continue_kind: - /* nothing to do here */ - break; - case With_kind: - VISIT(st, expr, s->v.With.context_expr); - if (s->v.With.optional_vars) { - VISIT(st, expr, s->v.With.optional_vars); - } - VISIT_SEQ(st, stmt, s->v.With.body); - break; - } - return 1; -} - -static int -symtable_visit_expr(struct symtable *st, expr_ty e) -{ - switch (e->kind) { - case BoolOp_kind: - VISIT_SEQ(st, expr, e->v.BoolOp.values); - break; - case BinOp_kind: - VISIT(st, expr, e->v.BinOp.left); - VISIT(st, expr, e->v.BinOp.right); - break; - case UnaryOp_kind: - VISIT(st, expr, e->v.UnaryOp.operand); - break; - case Lambda_kind: { - if (!GET_IDENTIFIER(lambda)) - return 0; - if (e->v.Lambda.args->defaults) - VISIT_SEQ(st, expr, e->v.Lambda.args->defaults); - if (!symtable_enter_block(st, lambda, - FunctionBlock, (void *)e, e->lineno)) - return 0; - VISIT_IN_BLOCK(st, arguments, e->v.Lambda.args, (void*)e); - VISIT_IN_BLOCK(st, expr, e->v.Lambda.body, (void*)e); - if (!symtable_exit_block(st, (void *)e)) - return 0; - break; - } - case IfExp_kind: - VISIT(st, expr, e->v.IfExp.test); - VISIT(st, expr, e->v.IfExp.body); - VISIT(st, expr, e->v.IfExp.orelse); - break; - case Dict_kind: - VISIT_SEQ(st, expr, e->v.Dict.keys); - VISIT_SEQ(st, expr, e->v.Dict.values); - break; - case Set_kind: - VISIT_SEQ(st, expr, e->v.Set.elts); - break; - case ListComp_kind: - VISIT(st, expr, e->v.ListComp.elt); - VISIT_SEQ(st, comprehension, e->v.ListComp.generators); - break; - case GeneratorExp_kind: - if (!symtable_visit_genexp(st, e)) - return 0; - break; - case SetComp_kind: - if (!symtable_visit_setcomp(st, e)) - return 0; - break; - case DictComp_kind: - if (!symtable_visit_dictcomp(st, e)) - return 0; - break; - case Yield_kind: - if (e->v.Yield.value) - VISIT(st, expr, e->v.Yield.value); - st->st_cur->ste_generator = 1; - if (st->st_cur->ste_returns_value) { - PyErr_SetString(PyExc_SyntaxError, - RETURN_VAL_IN_GENERATOR); - PyErr_SyntaxLocation(st->st_filename, - e->lineno); - return 0; - } - break; - case Compare_kind: - VISIT(st, expr, e->v.Compare.left); - VISIT_SEQ(st, expr, e->v.Compare.comparators); - break; - case Call_kind: - VISIT(st, expr, e->v.Call.func); - VISIT_SEQ(st, expr, e->v.Call.args); - VISIT_SEQ(st, keyword, e->v.Call.keywords); - if (e->v.Call.starargs) - VISIT(st, expr, e->v.Call.starargs); - if (e->v.Call.kwargs) - VISIT(st, expr, e->v.Call.kwargs); - break; - case Repr_kind: - VISIT(st, expr, e->v.Repr.value); - break; - case Num_kind: - case Str_kind: - /* Nothing to do here. */ - break; - /* The following exprs can be assignment targets. */ - case Attribute_kind: - VISIT(st, expr, e->v.Attribute.value); - break; - case Subscript_kind: - VISIT(st, expr, e->v.Subscript.value); - VISIT(st, slice, e->v.Subscript.slice); - break; - case Name_kind: - if (!symtable_add_def(st, e->v.Name.id, - e->v.Name.ctx == Load ? USE : DEF_LOCAL)) - return 0; - break; - /* child nodes of List and Tuple will have expr_context set */ - case List_kind: - VISIT_SEQ(st, expr, e->v.List.elts); - break; - case Tuple_kind: - VISIT_SEQ(st, expr, e->v.Tuple.elts); - break; - } - return 1; -} - -static int -symtable_implicit_arg(struct symtable *st, int pos) -{ - PyObject *id = PyString_FromFormat(".%d", pos); - if (id == NULL) - return 0; - if (!symtable_add_def(st, id, DEF_PARAM)) { - Py_DECREF(id); - return 0; - } - Py_DECREF(id); - return 1; -} - -static int -symtable_visit_params(struct symtable *st, asdl_seq *args, int toplevel) -{ - int i; - - /* go through all the toplevel arguments first */ - for (i = 0; i < asdl_seq_LEN(args); i++) { - expr_ty arg = (expr_ty)asdl_seq_GET(args, i); - if (arg->kind == Name_kind) { - assert(arg->v.Name.ctx == Param || - (arg->v.Name.ctx == Store && !toplevel)); - if (!symtable_add_def(st, arg->v.Name.id, DEF_PARAM)) - return 0; - } - else if (arg->kind == Tuple_kind) { - assert(arg->v.Tuple.ctx == Store); - if (toplevel) { - if (!symtable_implicit_arg(st, i)) - return 0; - } - } - else { - PyErr_SetString(PyExc_SyntaxError, - "invalid expression in parameter list"); - PyErr_SyntaxLocation(st->st_filename, - st->st_cur->ste_lineno); - return 0; - } - } - - if (!toplevel) { - if (!symtable_visit_params_nested(st, args)) - return 0; - } - - return 1; -} - -static int -symtable_visit_params_nested(struct symtable *st, asdl_seq *args) -{ - int i; - for (i = 0; i < asdl_seq_LEN(args); i++) { - expr_ty arg = (expr_ty)asdl_seq_GET(args, i); - if (arg->kind == Tuple_kind && - !symtable_visit_params(st, arg->v.Tuple.elts, 0)) - return 0; - } - - return 1; -} - -static int -symtable_visit_arguments(struct symtable *st, arguments_ty a) -{ - /* skip default arguments inside function block - XXX should ast be different? - */ - if (a->args && !symtable_visit_params(st, a->args, 1)) - return 0; - if (a->vararg) { - if (!symtable_add_def(st, a->vararg, DEF_PARAM)) - return 0; - st->st_cur->ste_varargs = 1; - } - if (a->kwarg) { - if (!symtable_add_def(st, a->kwarg, DEF_PARAM)) - return 0; - st->st_cur->ste_varkeywords = 1; - } - if (a->args && !symtable_visit_params_nested(st, a->args)) - return 0; - return 1; -} - - -static int -symtable_visit_excepthandler(struct symtable *st, excepthandler_ty eh) -{ - if (eh->v.ExceptHandler.type) - VISIT(st, expr, eh->v.ExceptHandler.type); - if (eh->v.ExceptHandler.name) - VISIT(st, expr, eh->v.ExceptHandler.name); - VISIT_SEQ(st, stmt, eh->v.ExceptHandler.body); - return 1; -} - - -static int -symtable_visit_alias(struct symtable *st, alias_ty a) -{ - /* Compute store_name, the name actually bound by the import - operation. It is different than a->name when a->name is a - dotted package name (e.g. spam.eggs) - */ - PyObject *store_name; - PyObject *name = (a->asname == NULL) ? a->name : a->asname; - const char *base = PyString_AS_STRING(name); - char *dot = strchr(base, '.'); - if (dot) { - store_name = PyString_FromStringAndSize(base, dot - base); - if (!store_name) - return 0; - } - else { - store_name = name; - Py_INCREF(store_name); - } - if (strcmp(PyString_AS_STRING(name), "*")) { - int r = symtable_add_def(st, store_name, DEF_IMPORT); - Py_DECREF(store_name); - return r; - } - else { - if (st->st_cur->ste_type != ModuleBlock) { - int lineno = st->st_cur->ste_lineno; - if (!symtable_warn(st, IMPORT_STAR_WARNING, lineno)) { - Py_DECREF(store_name); - return 0; - } - } - st->st_cur->ste_unoptimized |= OPT_IMPORT_STAR; - Py_DECREF(store_name); - return 1; - } -} - - -static int -symtable_visit_comprehension(struct symtable *st, comprehension_ty lc) -{ - VISIT(st, expr, lc->target); - VISIT(st, expr, lc->iter); - VISIT_SEQ(st, expr, lc->ifs); - return 1; -} - - -static int -symtable_visit_keyword(struct symtable *st, keyword_ty k) -{ - VISIT(st, expr, k->value); - return 1; -} - - -static int -symtable_visit_slice(struct symtable *st, slice_ty s) -{ - switch (s->kind) { - case Slice_kind: - if (s->v.Slice.lower) - VISIT(st, expr, s->v.Slice.lower) - if (s->v.Slice.upper) - VISIT(st, expr, s->v.Slice.upper) - if (s->v.Slice.step) - VISIT(st, expr, s->v.Slice.step) - break; - case ExtSlice_kind: - VISIT_SEQ(st, slice, s->v.ExtSlice.dims) - break; - case Index_kind: - VISIT(st, expr, s->v.Index.value) - break; - case Ellipsis_kind: - break; - } - return 1; -} - -static int -symtable_new_tmpname(struct symtable *st) -{ - char tmpname[256]; - identifier tmp; - - PyOS_snprintf(tmpname, sizeof(tmpname), "_[%d]", - ++st->st_cur->ste_tmpname); - tmp = PyString_InternFromString(tmpname); - if (!tmp) - return 0; - if (!symtable_add_def(st, tmp, DEF_LOCAL)) - return 0; - Py_DECREF(tmp); - return 1; -} - -static int -symtable_handle_comprehension(struct symtable *st, expr_ty e, - identifier scope_name, asdl_seq *generators, - expr_ty elt, expr_ty value) -{ - int is_generator = (e->kind == GeneratorExp_kind); - int needs_tmp = !is_generator; - comprehension_ty outermost = ((comprehension_ty) - asdl_seq_GET(generators, 0)); - /* Outermost iterator is evaluated in current scope */ - VISIT(st, expr, outermost->iter); - /* Create comprehension scope for the rest */ - if (!scope_name || - !symtable_enter_block(st, scope_name, FunctionBlock, (void *)e, 0)) { - return 0; - } - st->st_cur->ste_generator = is_generator; - /* Outermost iter is received as an argument */ - if (!symtable_implicit_arg(st, 0)) { - symtable_exit_block(st, (void *)e); - return 0; - } - /* Allocate temporary name if needed */ - if (needs_tmp && !symtable_new_tmpname(st)) { - symtable_exit_block(st, (void *)e); - return 0; - } - VISIT_IN_BLOCK(st, expr, outermost->target, (void*)e); - VISIT_SEQ_IN_BLOCK(st, expr, outermost->ifs, (void*)e); - VISIT_SEQ_TAIL_IN_BLOCK(st, comprehension, - generators, 1, (void*)e); - if (value) - VISIT_IN_BLOCK(st, expr, value, (void*)e); - VISIT_IN_BLOCK(st, expr, elt, (void*)e); - return symtable_exit_block(st, (void *)e); -} - -static int -symtable_visit_genexp(struct symtable *st, expr_ty e) -{ - return symtable_handle_comprehension(st, e, GET_IDENTIFIER(genexpr), - e->v.GeneratorExp.generators, - e->v.GeneratorExp.elt, NULL); -} - -static int -symtable_visit_setcomp(struct symtable *st, expr_ty e) -{ - return symtable_handle_comprehension(st, e, GET_IDENTIFIER(setcomp), - e->v.SetComp.generators, - e->v.SetComp.elt, NULL); -} - -static int -symtable_visit_dictcomp(struct symtable *st, expr_ty e) -{ - return symtable_handle_comprehension(st, e, GET_IDENTIFIER(dictcomp), - e->v.DictComp.generators, - e->v.DictComp.key, - e->v.DictComp.value); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/sysmodule.c b/AppPkg/Applications/Python/Python-2.7.10/Python/sysmodule.c deleted file mode 100644 index 36e81b4..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/sysmodule.c +++ /dev/null @@ -1,1800 +0,0 @@ - -/* System module */ - -/* -Various bits of information used by the interpreter are collected in -module 'sys'. -Function member: -- exit(sts): raise SystemExit -Data members: -- stdin, stdout, stderr: standard file objects -- modules: the table of modules (dictionary) -- path: module search path (list of strings) -- argv: script arguments (list of strings) -- ps1, ps2: optional primary and secondary prompts (strings) -*/ - -#include "Python.h" -#include "structseq.h" -#include "code.h" -#include "frameobject.h" -#include "eval.h" - -#include "osdefs.h" - -#ifdef MS_WINDOWS -#define WIN32_LEAN_AND_MEAN -#include "windows.h" -#endif /* MS_WINDOWS */ - -#ifdef MS_COREDLL -extern void *PyWin_DLLhModule; -/* A string loaded from the DLL at startup: */ -extern const char *PyWin_DLLVersionString; -#endif - -#ifdef __VMS -#include -#endif - -#ifdef MS_WINDOWS -#include -#endif - -#ifdef HAVE_LANGINFO_H -#include -#include -#endif - -PyObject * -PySys_GetObject(char *name) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *sd = tstate->interp->sysdict; - if (sd == NULL) - return NULL; - return PyDict_GetItemString(sd, name); -} - -FILE * -PySys_GetFile(char *name, FILE *def) -{ - FILE *fp = NULL; - PyObject *v = PySys_GetObject(name); - if (v != NULL && PyFile_Check(v)) - fp = PyFile_AsFile(v); - if (fp == NULL) - fp = def; - return fp; -} - -int -PySys_SetObject(char *name, PyObject *v) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *sd = tstate->interp->sysdict; - if (v == NULL) { - if (PyDict_GetItemString(sd, name) == NULL) - return 0; - else - return PyDict_DelItemString(sd, name); - } - else - return PyDict_SetItemString(sd, name, v); -} - -static PyObject * -sys_displayhook(PyObject *self, PyObject *o) -{ - PyObject *outf; - PyInterpreterState *interp = PyThreadState_GET()->interp; - PyObject *modules = interp->modules; - PyObject *builtins = PyDict_GetItemString(modules, "__builtin__"); - - if (builtins == NULL) { - PyErr_SetString(PyExc_RuntimeError, "lost __builtin__"); - return NULL; - } - - /* Print value except if None */ - /* After printing, also assign to '_' */ - /* Before, set '_' to None to avoid recursion */ - if (o == Py_None) { - Py_INCREF(Py_None); - return Py_None; - } - if (PyObject_SetAttrString(builtins, "_", Py_None) != 0) - return NULL; - if (Py_FlushLine() != 0) - return NULL; - outf = PySys_GetObject("stdout"); - if (outf == NULL) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - return NULL; - } - if (PyFile_WriteObject(o, outf, 0) != 0) - return NULL; - PyFile_SoftSpace(outf, 1); - if (Py_FlushLine() != 0) - return NULL; - if (PyObject_SetAttrString(builtins, "_", o) != 0) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(displayhook_doc, -"displayhook(object) -> None\n" -"\n" -"Print an object to sys.stdout and also save it in __builtin__._\n" -); - -static PyObject * -sys_excepthook(PyObject* self, PyObject* args) -{ - PyObject *exc, *value, *tb; - if (!PyArg_UnpackTuple(args, "excepthook", 3, 3, &exc, &value, &tb)) - return NULL; - PyErr_Display(exc, value, tb); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(excepthook_doc, -"excepthook(exctype, value, traceback) -> None\n" -"\n" -"Handle an exception by displaying it with a traceback on sys.stderr.\n" -); - -static PyObject * -sys_exc_info(PyObject *self, PyObject *noargs) -{ - PyThreadState *tstate; - tstate = PyThreadState_GET(); - return Py_BuildValue( - "(OOO)", - tstate->exc_type != NULL ? tstate->exc_type : Py_None, - tstate->exc_value != NULL ? tstate->exc_value : Py_None, - tstate->exc_traceback != NULL ? - tstate->exc_traceback : Py_None); -} - -PyDoc_STRVAR(exc_info_doc, -"exc_info() -> (type, value, traceback)\n\ -\n\ -Return information about the most recent exception caught by an except\n\ -clause in the current stack frame or in an older stack frame." -); - -static PyObject * -sys_exc_clear(PyObject *self, PyObject *noargs) -{ - PyThreadState *tstate; - PyObject *tmp_type, *tmp_value, *tmp_tb; - - if (PyErr_WarnPy3k("sys.exc_clear() not supported in 3.x; " - "use except clauses", 1) < 0) - return NULL; - - tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = NULL; - tstate->exc_value = NULL; - tstate->exc_traceback = NULL; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - /* For b/w compatibility */ - PySys_SetObject("exc_type", Py_None); - PySys_SetObject("exc_value", Py_None); - PySys_SetObject("exc_traceback", Py_None); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(exc_clear_doc, -"exc_clear() -> None\n\ -\n\ -Clear global information on the current exception. Subsequent calls to\n\ -exc_info() will return (None,None,None) until another exception is raised\n\ -in the current thread or the execution stack returns to a frame where\n\ -another exception is being handled." -); - -static PyObject * -sys_exit(PyObject *self, PyObject *args) -{ - PyObject *exit_code = 0; - if (!PyArg_UnpackTuple(args, "exit", 0, 1, &exit_code)) - return NULL; - /* Raise SystemExit so callers may catch it or clean up. */ - PyErr_SetObject(PyExc_SystemExit, exit_code); - return NULL; -} - -PyDoc_STRVAR(exit_doc, -"exit([status])\n\ -\n\ -Exit the interpreter by raising SystemExit(status).\n\ -If the status is omitted or None, it defaults to zero (i.e., success).\n\ -If the status is an integer, it will be used as the system exit status.\n\ -If it is another kind of object, it will be printed and the system\n\ -exit status will be one (i.e., failure)." -); - -#ifdef Py_USING_UNICODE - -static PyObject * -sys_getdefaultencoding(PyObject *self) -{ - return PyString_FromString(PyUnicode_GetDefaultEncoding()); -} - -PyDoc_STRVAR(getdefaultencoding_doc, -"getdefaultencoding() -> string\n\ -\n\ -Return the current default string encoding used by the Unicode \n\ -implementation." -); - -static PyObject * -sys_setdefaultencoding(PyObject *self, PyObject *args) -{ - char *encoding; - if (!PyArg_ParseTuple(args, "s:setdefaultencoding", &encoding)) - return NULL; - if (PyUnicode_SetDefaultEncoding(encoding)) - return NULL; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setdefaultencoding_doc, -"setdefaultencoding(encoding)\n\ -\n\ -Set the current default string encoding used by the Unicode implementation." -); - -static PyObject * -sys_getfilesystemencoding(PyObject *self) -{ - if (Py_FileSystemDefaultEncoding) - return PyString_FromString(Py_FileSystemDefaultEncoding); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(getfilesystemencoding_doc, -"getfilesystemencoding() -> string\n\ -\n\ -Return the encoding used to convert Unicode filenames in\n\ -operating system filenames." -); - -#endif - -/* - * Cached interned string objects used for calling the profile and - * trace functions. Initialized by trace_init(). - */ -static PyObject *whatstrings[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; - -static int -trace_init(void) -{ - static char *whatnames[7] = {"call", "exception", "line", "return", - "c_call", "c_exception", "c_return"}; - PyObject *name; - int i; - for (i = 0; i < 7; ++i) { - if (whatstrings[i] == NULL) { - name = PyString_InternFromString(whatnames[i]); - if (name == NULL) - return -1; - whatstrings[i] = name; - } - } - return 0; -} - - -static PyObject * -call_trampoline(PyThreadState *tstate, PyObject* callback, - PyFrameObject *frame, int what, PyObject *arg) -{ - PyObject *args = PyTuple_New(3); - PyObject *whatstr; - PyObject *result; - - if (args == NULL) - return NULL; - Py_INCREF(frame); - whatstr = whatstrings[what]; - Py_INCREF(whatstr); - if (arg == NULL) - arg = Py_None; - Py_INCREF(arg); - PyTuple_SET_ITEM(args, 0, (PyObject *)frame); - PyTuple_SET_ITEM(args, 1, whatstr); - PyTuple_SET_ITEM(args, 2, arg); - - /* call the Python-level function */ - PyFrame_FastToLocals(frame); - result = PyEval_CallObject(callback, args); - PyFrame_LocalsToFast(frame, 1); - if (result == NULL) - PyTraceBack_Here(frame); - - /* cleanup */ - Py_DECREF(args); - return result; -} - -static int -profile_trampoline(PyObject *self, PyFrameObject *frame, - int what, PyObject *arg) -{ - PyThreadState *tstate = frame->f_tstate; - PyObject *result; - - if (arg == NULL) - arg = Py_None; - result = call_trampoline(tstate, self, frame, what, arg); - if (result == NULL) { - PyEval_SetProfile(NULL, NULL); - return -1; - } - Py_DECREF(result); - return 0; -} - -static int -trace_trampoline(PyObject *self, PyFrameObject *frame, - int what, PyObject *arg) -{ - PyThreadState *tstate = frame->f_tstate; - PyObject *callback; - PyObject *result; - - if (what == PyTrace_CALL) - callback = self; - else - callback = frame->f_trace; - if (callback == NULL) - return 0; - result = call_trampoline(tstate, callback, frame, what, arg); - if (result == NULL) { - PyEval_SetTrace(NULL, NULL); - Py_CLEAR(frame->f_trace); - return -1; - } - if (result != Py_None) { - PyObject *temp = frame->f_trace; - frame->f_trace = NULL; - Py_XDECREF(temp); - frame->f_trace = result; - } - else { - Py_DECREF(result); - } - return 0; -} - -static PyObject * -sys_settrace(PyObject *self, PyObject *args) -{ - if (trace_init() == -1) - return NULL; - if (args == Py_None) - PyEval_SetTrace(NULL, NULL); - else - PyEval_SetTrace(trace_trampoline, args); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(settrace_doc, -"settrace(function)\n\ -\n\ -Set the global debug tracing function. It will be called on each\n\ -function call. See the debugger chapter in the library manual." -); - -static PyObject * -sys_gettrace(PyObject *self, PyObject *args) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *temp = tstate->c_traceobj; - - if (temp == NULL) - temp = Py_None; - Py_INCREF(temp); - return temp; -} - -PyDoc_STRVAR(gettrace_doc, -"gettrace()\n\ -\n\ -Return the global debug tracing function set with sys.settrace.\n\ -See the debugger chapter in the library manual." -); - -static PyObject * -sys_setprofile(PyObject *self, PyObject *args) -{ - if (trace_init() == -1) - return NULL; - if (args == Py_None) - PyEval_SetProfile(NULL, NULL); - else - PyEval_SetProfile(profile_trampoline, args); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setprofile_doc, -"setprofile(function)\n\ -\n\ -Set the profiling function. It will be called on each function call\n\ -and return. See the profiler chapter in the library manual." -); - -static PyObject * -sys_getprofile(PyObject *self, PyObject *args) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyObject *temp = tstate->c_profileobj; - - if (temp == NULL) - temp = Py_None; - Py_INCREF(temp); - return temp; -} - -PyDoc_STRVAR(getprofile_doc, -"getprofile()\n\ -\n\ -Return the profiling function set with sys.setprofile.\n\ -See the profiler chapter in the library manual." -); - -static PyObject * -sys_setcheckinterval(PyObject *self, PyObject *args) -{ - if (!PyArg_ParseTuple(args, "i:setcheckinterval", &_Py_CheckInterval)) - return NULL; - _Py_Ticker = _Py_CheckInterval; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setcheckinterval_doc, -"setcheckinterval(n)\n\ -\n\ -Tell the Python interpreter to check for asynchronous events every\n\ -n instructions. This also affects how often thread switches occur." -); - -static PyObject * -sys_getcheckinterval(PyObject *self, PyObject *args) -{ - return PyInt_FromLong(_Py_CheckInterval); -} - -PyDoc_STRVAR(getcheckinterval_doc, -"getcheckinterval() -> current check interval; see setcheckinterval()." -); - -#ifdef WITH_TSC -static PyObject * -sys_settscdump(PyObject *self, PyObject *args) -{ - int bool; - PyThreadState *tstate = PyThreadState_Get(); - - if (!PyArg_ParseTuple(args, "i:settscdump", &bool)) - return NULL; - if (bool) - tstate->interp->tscdump = 1; - else - tstate->interp->tscdump = 0; - Py_INCREF(Py_None); - return Py_None; - -} - -PyDoc_STRVAR(settscdump_doc, -"settscdump(bool)\n\ -\n\ -If true, tell the Python interpreter to dump VM measurements to\n\ -stderr. If false, turn off dump. The measurements are based on the\n\ -processor's time-stamp counter." -); -#endif /* TSC */ - -static PyObject * -sys_setrecursionlimit(PyObject *self, PyObject *args) -{ - int new_limit; - if (!PyArg_ParseTuple(args, "i:setrecursionlimit", &new_limit)) - return NULL; - if (new_limit <= 0) { - PyErr_SetString(PyExc_ValueError, - "recursion limit must be positive"); - return NULL; - } - Py_SetRecursionLimit(new_limit); - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setrecursionlimit_doc, -"setrecursionlimit(n)\n\ -\n\ -Set the maximum depth of the Python interpreter stack to n. This\n\ -limit prevents infinite recursion from causing an overflow of the C\n\ -stack and crashing Python. The highest possible limit is platform-\n\ -dependent." -); - -static PyObject * -sys_getrecursionlimit(PyObject *self) -{ - return PyInt_FromLong(Py_GetRecursionLimit()); -} - -PyDoc_STRVAR(getrecursionlimit_doc, -"getrecursionlimit()\n\ -\n\ -Return the current value of the recursion limit, the maximum depth\n\ -of the Python interpreter stack. This limit prevents infinite\n\ -recursion from causing an overflow of the C stack and crashing Python." -); - -#ifdef MS_WINDOWS -PyDoc_STRVAR(getwindowsversion_doc, -"getwindowsversion()\n\ -\n\ -Return information about the running version of Windows as a named tuple.\n\ -The members are named: major, minor, build, platform, service_pack,\n\ -service_pack_major, service_pack_minor, suite_mask, and product_type. For\n\ -backward compatibility, only the first 5 items are available by indexing.\n\ -All elements are numbers, except service_pack which is a string. Platform\n\ -may be 0 for win32s, 1 for Windows 9x/ME, 2 for Windows NT/2000/XP/Vista/7,\n\ -3 for Windows CE. Product_type may be 1 for a workstation, 2 for a domain\n\ -controller, 3 for a server." -); - -static PyTypeObject WindowsVersionType = {0, 0, 0, 0, 0, 0}; - -static PyStructSequence_Field windows_version_fields[] = { - {"major", "Major version number"}, - {"minor", "Minor version number"}, - {"build", "Build number"}, - {"platform", "Operating system platform"}, - {"service_pack", "Latest Service Pack installed on the system"}, - {"service_pack_major", "Service Pack major version number"}, - {"service_pack_minor", "Service Pack minor version number"}, - {"suite_mask", "Bit mask identifying available product suites"}, - {"product_type", "System product type"}, - {0} -}; - -static PyStructSequence_Desc windows_version_desc = { - "sys.getwindowsversion", /* name */ - getwindowsversion_doc, /* doc */ - windows_version_fields, /* fields */ - 5 /* For backward compatibility, - only the first 5 items are accessible - via indexing, the rest are name only */ -}; - -static PyObject * -sys_getwindowsversion(PyObject *self) -{ - PyObject *version; - int pos = 0; - OSVERSIONINFOEX ver; - ver.dwOSVersionInfoSize = sizeof(ver); - if (!GetVersionEx((OSVERSIONINFO*) &ver)) - return PyErr_SetFromWindowsErr(0); - - version = PyStructSequence_New(&WindowsVersionType); - if (version == NULL) - return NULL; - - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.dwMajorVersion)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.dwMinorVersion)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.dwBuildNumber)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.dwPlatformId)); - PyStructSequence_SET_ITEM(version, pos++, PyString_FromString(ver.szCSDVersion)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.wServicePackMajor)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.wServicePackMinor)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.wSuiteMask)); - PyStructSequence_SET_ITEM(version, pos++, PyInt_FromLong(ver.wProductType)); - - if (PyErr_Occurred()) { - Py_DECREF(version); - return NULL; - } - return version; -} - -#endif /* MS_WINDOWS */ - -#ifdef HAVE_DLOPEN -static PyObject * -sys_setdlopenflags(PyObject *self, PyObject *args) -{ - int new_val; - PyThreadState *tstate = PyThreadState_GET(); - if (!PyArg_ParseTuple(args, "i:setdlopenflags", &new_val)) - return NULL; - if (!tstate) - return NULL; - tstate->interp->dlopenflags = new_val; - Py_INCREF(Py_None); - return Py_None; -} - -PyDoc_STRVAR(setdlopenflags_doc, -"setdlopenflags(n) -> None\n\ -\n\ -Set the flags used by the interpreter for dlopen calls, such as when the\n\ -interpreter loads extension modules. Among other things, this will enable\n\ -a lazy resolving of symbols when importing a module, if called as\n\ -sys.setdlopenflags(0). To share symbols across extension modules, call as\n\ -sys.setdlopenflags(ctypes.RTLD_GLOBAL). Symbolic names for the flag modules\n\ -can be either found in the ctypes module, or in the DLFCN module. If DLFCN\n\ -is not available, it can be generated from /usr/include/dlfcn.h using the\n\ -h2py script."); - -static PyObject * -sys_getdlopenflags(PyObject *self, PyObject *args) -{ - PyThreadState *tstate = PyThreadState_GET(); - if (!tstate) - return NULL; - return PyInt_FromLong(tstate->interp->dlopenflags); -} - -PyDoc_STRVAR(getdlopenflags_doc, -"getdlopenflags() -> int\n\ -\n\ -Return the current value of the flags that are used for dlopen calls.\n\ -The flag constants are defined in the ctypes and DLFCN modules."); - -#endif /* HAVE_DLOPEN */ - -#ifdef USE_MALLOPT -/* Link with -lmalloc (or -lmpc) on an SGI */ -#include - -static PyObject * -sys_mdebug(PyObject *self, PyObject *args) -{ - int flag; - if (!PyArg_ParseTuple(args, "i:mdebug", &flag)) - return NULL; - mallopt(M_DEBUG, flag); - Py_INCREF(Py_None); - return Py_None; -} -#endif /* USE_MALLOPT */ - -size_t -_PySys_GetSizeOf(PyObject *o) -{ - static PyObject *str__sizeof__ = NULL; - PyObject *res = NULL; - Py_ssize_t size; - - /* Make sure the type is initialized. float gets initialized late */ - if (PyType_Ready(Py_TYPE(o)) < 0) - return (size_t)-1; - - /* Instance of old-style class */ - if (PyInstance_Check(o)) - size = PyInstance_Type.tp_basicsize; - /* all other objects */ - else { - PyObject *method = _PyObject_LookupSpecial(o, "__sizeof__", - &str__sizeof__); - if (method == NULL) { - if (!PyErr_Occurred()) - PyErr_Format(PyExc_TypeError, - "Type %.100s doesn't define __sizeof__", - Py_TYPE(o)->tp_name); - } - else { - res = PyObject_CallFunctionObjArgs(method, NULL); - Py_DECREF(method); - } - - if (res == NULL) - return (size_t)-1; - - size = (size_t)PyInt_AsSsize_t(res); - Py_DECREF(res); - if (size == -1 && PyErr_Occurred()) - return (size_t)-1; - } - - if (size < 0) { - PyErr_SetString(PyExc_ValueError, "__sizeof__() should return >= 0"); - return (size_t)-1; - } - - /* add gc_head size */ - if (PyObject_IS_GC(o)) - return ((size_t)size) + sizeof(PyGC_Head); - return (size_t)size; -} - -static PyObject * -sys_getsizeof(PyObject *self, PyObject *args, PyObject *kwds) -{ - static char *kwlist[] = {"object", "default", 0}; - size_t size; - PyObject *o, *dflt = NULL; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|O:getsizeof", - kwlist, &o, &dflt)) - return NULL; - - size = _PySys_GetSizeOf(o); - - if (size == (size_t)-1 && PyErr_Occurred()) { - /* Has a default value been given */ - if (dflt != NULL && PyErr_ExceptionMatches(PyExc_TypeError)) { - PyErr_Clear(); - Py_INCREF(dflt); - return dflt; - } - else - return NULL; - } - - return PyInt_FromSize_t(size); -} - -PyDoc_STRVAR(getsizeof_doc, -"getsizeof(object, default) -> int\n\ -\n\ -Return the size of object in bytes."); - -static PyObject * -sys_getrefcount(PyObject *self, PyObject *arg) -{ - return PyInt_FromSsize_t(arg->ob_refcnt); -} - -#ifdef Py_REF_DEBUG -static PyObject * -sys_gettotalrefcount(PyObject *self) -{ - return PyInt_FromSsize_t(_Py_GetRefTotal()); -} -#endif /* Py_REF_DEBUG */ - -PyDoc_STRVAR(getrefcount_doc, -"getrefcount(object) -> integer\n\ -\n\ -Return the reference count of object. The count returned is generally\n\ -one higher than you might expect, because it includes the (temporary)\n\ -reference as an argument to getrefcount()." -); - -#ifdef COUNT_ALLOCS -static PyObject * -sys_getcounts(PyObject *self) -{ - extern PyObject *get_counts(void); - - return get_counts(); -} -#endif - -PyDoc_STRVAR(getframe_doc, -"_getframe([depth]) -> frameobject\n\ -\n\ -Return a frame object from the call stack. If optional integer depth is\n\ -given, return the frame object that many calls below the top of the stack.\n\ -If that is deeper than the call stack, ValueError is raised. The default\n\ -for depth is zero, returning the frame at the top of the call stack.\n\ -\n\ -This function should be used for internal and specialized\n\ -purposes only." -); - -static PyObject * -sys_getframe(PyObject *self, PyObject *args) -{ - PyFrameObject *f = PyThreadState_GET()->frame; - int depth = -1; - - if (!PyArg_ParseTuple(args, "|i:_getframe", &depth)) - return NULL; - - while (depth > 0 && f != NULL) { - f = f->f_back; - --depth; - } - if (f == NULL) { - PyErr_SetString(PyExc_ValueError, - "call stack is not deep enough"); - return NULL; - } - Py_INCREF(f); - return (PyObject*)f; -} - -PyDoc_STRVAR(current_frames_doc, -"_current_frames() -> dictionary\n\ -\n\ -Return a dictionary mapping each current thread T's thread id to T's\n\ -current stack frame.\n\ -\n\ -This function should be used for specialized purposes only." -); - -static PyObject * -sys_current_frames(PyObject *self, PyObject *noargs) -{ - return _PyThread_CurrentFrames(); -} - -PyDoc_STRVAR(call_tracing_doc, -"call_tracing(func, args) -> object\n\ -\n\ -Call func(*args), while tracing is enabled. The tracing state is\n\ -saved, and restored afterwards. This is intended to be called from\n\ -a debugger from a checkpoint, to recursively debug some other code." -); - -static PyObject * -sys_call_tracing(PyObject *self, PyObject *args) -{ - PyObject *func, *funcargs; - if (!PyArg_ParseTuple(args, "OO!:call_tracing", &func, &PyTuple_Type, &funcargs)) - return NULL; - return _PyEval_CallTracing(func, funcargs); -} - -PyDoc_STRVAR(callstats_doc, -"callstats() -> tuple of integers\n\ -\n\ -Return a tuple of function call statistics, if CALL_PROFILE was defined\n\ -when Python was built. Otherwise, return None.\n\ -\n\ -When enabled, this function returns detailed, implementation-specific\n\ -details about the number of function calls executed. The return value is\n\ -a 11-tuple where the entries in the tuple are counts of:\n\ -0. all function calls\n\ -1. calls to PyFunction_Type objects\n\ -2. PyFunction calls that do not create an argument tuple\n\ -3. PyFunction calls that do not create an argument tuple\n\ - and bypass PyEval_EvalCodeEx()\n\ -4. PyMethod calls\n\ -5. PyMethod calls on bound methods\n\ -6. PyType calls\n\ -7. PyCFunction calls\n\ -8. generator calls\n\ -9. All other calls\n\ -10. Number of stack pops performed by call_function()" -); - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef Py_TRACE_REFS -/* Defined in objects.c because it uses static globals if that file */ -extern PyObject *_Py_GetObjects(PyObject *, PyObject *); -#endif - -#ifdef DYNAMIC_EXECUTION_PROFILE -/* Defined in ceval.c because it uses static globals if that file */ -extern PyObject *_Py_GetDXProfile(PyObject *, PyObject *); -#endif - -#ifdef __cplusplus -} -#endif - -static PyObject * -sys_clear_type_cache(PyObject* self, PyObject* args) -{ - PyType_ClearCache(); - Py_RETURN_NONE; -} - -PyDoc_STRVAR(sys_clear_type_cache__doc__, -"_clear_type_cache() -> None\n\ -Clear the internal type lookup cache."); - - -static PyMethodDef sys_methods[] = { - /* Might as well keep this in alphabetic order */ - {"callstats", (PyCFunction)PyEval_GetCallStats, METH_NOARGS, - callstats_doc}, - {"_clear_type_cache", sys_clear_type_cache, METH_NOARGS, - sys_clear_type_cache__doc__}, - {"_current_frames", sys_current_frames, METH_NOARGS, - current_frames_doc}, - {"displayhook", sys_displayhook, METH_O, displayhook_doc}, - {"exc_info", sys_exc_info, METH_NOARGS, exc_info_doc}, - {"exc_clear", sys_exc_clear, METH_NOARGS, exc_clear_doc}, - {"excepthook", sys_excepthook, METH_VARARGS, excepthook_doc}, - {"exit", sys_exit, METH_VARARGS, exit_doc}, -#ifdef Py_USING_UNICODE - {"getdefaultencoding", (PyCFunction)sys_getdefaultencoding, - METH_NOARGS, getdefaultencoding_doc}, -#endif -#ifdef HAVE_DLOPEN - {"getdlopenflags", (PyCFunction)sys_getdlopenflags, METH_NOARGS, - getdlopenflags_doc}, -#endif -#ifdef COUNT_ALLOCS - {"getcounts", (PyCFunction)sys_getcounts, METH_NOARGS}, -#endif -#ifdef DYNAMIC_EXECUTION_PROFILE - {"getdxp", _Py_GetDXProfile, METH_VARARGS}, -#endif -#ifdef Py_USING_UNICODE - {"getfilesystemencoding", (PyCFunction)sys_getfilesystemencoding, - METH_NOARGS, getfilesystemencoding_doc}, -#endif -#ifdef Py_TRACE_REFS - {"getobjects", _Py_GetObjects, METH_VARARGS}, -#endif -#ifdef Py_REF_DEBUG - {"gettotalrefcount", (PyCFunction)sys_gettotalrefcount, METH_NOARGS}, -#endif - {"getrefcount", (PyCFunction)sys_getrefcount, METH_O, getrefcount_doc}, - {"getrecursionlimit", (PyCFunction)sys_getrecursionlimit, METH_NOARGS, - getrecursionlimit_doc}, - {"getsizeof", (PyCFunction)sys_getsizeof, - METH_VARARGS | METH_KEYWORDS, getsizeof_doc}, - {"_getframe", sys_getframe, METH_VARARGS, getframe_doc}, -#ifdef MS_WINDOWS - {"getwindowsversion", (PyCFunction)sys_getwindowsversion, METH_NOARGS, - getwindowsversion_doc}, -#endif /* MS_WINDOWS */ -#ifdef USE_MALLOPT - {"mdebug", sys_mdebug, METH_VARARGS}, -#endif -#ifdef Py_USING_UNICODE - {"setdefaultencoding", sys_setdefaultencoding, METH_VARARGS, - setdefaultencoding_doc}, -#endif - {"setcheckinterval", sys_setcheckinterval, METH_VARARGS, - setcheckinterval_doc}, - {"getcheckinterval", sys_getcheckinterval, METH_NOARGS, - getcheckinterval_doc}, -#ifdef HAVE_DLOPEN - {"setdlopenflags", sys_setdlopenflags, METH_VARARGS, - setdlopenflags_doc}, -#endif - {"setprofile", sys_setprofile, METH_O, setprofile_doc}, - {"getprofile", sys_getprofile, METH_NOARGS, getprofile_doc}, - {"setrecursionlimit", sys_setrecursionlimit, METH_VARARGS, - setrecursionlimit_doc}, -#ifdef WITH_TSC - {"settscdump", sys_settscdump, METH_VARARGS, settscdump_doc}, -#endif - {"settrace", sys_settrace, METH_O, settrace_doc}, - {"gettrace", sys_gettrace, METH_NOARGS, gettrace_doc}, - {"call_tracing", sys_call_tracing, METH_VARARGS, call_tracing_doc}, - {NULL, NULL} /* sentinel */ -}; - -static PyObject * -list_builtin_module_names(void) -{ - PyObject *list = PyList_New(0); - int i; - if (list == NULL) - return NULL; - for (i = 0; PyImport_Inittab[i].name != NULL; i++) { - PyObject *name = PyString_FromString( - PyImport_Inittab[i].name); - if (name == NULL) - break; - PyList_Append(list, name); - Py_DECREF(name); - } - if (PyList_Sort(list) != 0) { - Py_DECREF(list); - list = NULL; - } - if (list) { - PyObject *v = PyList_AsTuple(list); - Py_DECREF(list); - list = v; - } - return list; -} - -static PyObject *warnoptions = NULL; - -void -PySys_ResetWarnOptions(void) -{ - if (warnoptions == NULL || !PyList_Check(warnoptions)) - return; - PyList_SetSlice(warnoptions, 0, PyList_GET_SIZE(warnoptions), NULL); -} - -void -PySys_AddWarnOption(char *s) -{ - PyObject *str; - - if (warnoptions == NULL || !PyList_Check(warnoptions)) { - Py_XDECREF(warnoptions); - warnoptions = PyList_New(0); - if (warnoptions == NULL) - return; - } - str = PyString_FromString(s); - if (str != NULL) { - PyList_Append(warnoptions, str); - Py_DECREF(str); - } -} - -int -PySys_HasWarnOptions(void) -{ - return (warnoptions != NULL && (PyList_Size(warnoptions) > 0)) ? 1 : 0; -} - -/* XXX This doc string is too long to be a single string literal in VC++ 5.0. - Two literals concatenated works just fine. If you have a K&R compiler - or other abomination that however *does* understand longer strings, - get rid of the !!! comment in the middle and the quotes that surround it. */ -PyDoc_VAR(sys_doc) = -PyDoc_STR( -"This module provides access to some objects used or maintained by the\n\ -interpreter and to functions that interact strongly with the interpreter.\n\ -\n\ -Dynamic objects:\n\ -\n\ -argv -- command line arguments; argv[0] is the script pathname if known\n\ -path -- module search path; path[0] is the script directory, else ''\n\ -modules -- dictionary of loaded modules\n\ -\n\ -displayhook -- called to show results in an interactive session\n\ -excepthook -- called to handle any uncaught exception other than SystemExit\n\ - To customize printing in an interactive session or to install a custom\n\ - top-level exception handler, assign other functions to replace these.\n\ -\n\ -exitfunc -- if sys.exitfunc exists, this routine is called when Python exits\n\ - Assigning to sys.exitfunc is deprecated; use the atexit module instead.\n\ -\n\ -stdin -- standard input file object; used by raw_input() and input()\n\ -stdout -- standard output file object; used by the print statement\n\ -stderr -- standard error object; used for error messages\n\ - By assigning other file objects (or objects that behave like files)\n\ - to these, it is possible to redirect all of the interpreter's I/O.\n\ -\n\ -last_type -- type of last uncaught exception\n\ -last_value -- value of last uncaught exception\n\ -last_traceback -- traceback of last uncaught exception\n\ - These three are only available in an interactive session after a\n\ - traceback has been printed.\n\ -\n\ -exc_type -- type of exception currently being handled\n\ -exc_value -- value of exception currently being handled\n\ -exc_traceback -- traceback of exception currently being handled\n\ - The function exc_info() should be used instead of these three,\n\ - because it is thread-safe.\n\ -" -) -/* concatenating string here */ -PyDoc_STR( -"\n\ -Static objects:\n\ -\n\ -float_info -- a dict with information about the float inplementation.\n\ -long_info -- a struct sequence with information about the long implementation.\n\ -maxint -- the largest supported integer (the smallest is -maxint-1)\n\ -maxsize -- the largest supported length of containers.\n\ -maxunicode -- the largest supported character\n\ -builtin_module_names -- tuple of module names built into this interpreter\n\ -version -- the version of this interpreter as a string\n\ -version_info -- version information as a named tuple\n\ -hexversion -- version information encoded as a single integer\n\ -copyright -- copyright notice pertaining to this interpreter\n\ -platform -- platform identifier\n\ -executable -- absolute path of the executable binary of the Python interpreter\n\ -prefix -- prefix used to find the Python library\n\ -exec_prefix -- prefix used to find the machine-specific Python library\n\ -float_repr_style -- string indicating the style of repr() output for floats\n\ -" -) -#ifdef MS_WINDOWS -/* concatenating string here */ -PyDoc_STR( -"dllhandle -- [Windows only] integer handle of the Python DLL\n\ -winver -- [Windows only] version number of the Python DLL\n\ -" -) -#endif /* MS_WINDOWS */ -PyDoc_STR( -"__stdin__ -- the original stdin; don't touch!\n\ -__stdout__ -- the original stdout; don't touch!\n\ -__stderr__ -- the original stderr; don't touch!\n\ -__displayhook__ -- the original displayhook; don't touch!\n\ -__excepthook__ -- the original excepthook; don't touch!\n\ -\n\ -Functions:\n\ -\n\ -displayhook() -- print an object to the screen, and save it in __builtin__._\n\ -excepthook() -- print an exception and its traceback to sys.stderr\n\ -exc_info() -- return thread-safe information about the current exception\n\ -exc_clear() -- clear the exception state for the current thread\n\ -exit() -- exit the interpreter by raising SystemExit\n\ -getdlopenflags() -- returns flags to be used for dlopen() calls\n\ -getprofile() -- get the global profiling function\n\ -getrefcount() -- return the reference count for an object (plus one :-)\n\ -getrecursionlimit() -- return the max recursion depth for the interpreter\n\ -getsizeof() -- return the size of an object in bytes\n\ -gettrace() -- get the global debug tracing function\n\ -setcheckinterval() -- control how often the interpreter checks for events\n\ -setdlopenflags() -- set the flags to be used for dlopen() calls\n\ -setprofile() -- set the global profiling function\n\ -setrecursionlimit() -- set the max recursion depth for the interpreter\n\ -settrace() -- set the global debug tracing function\n\ -" -) -/* end of sys_doc */ ; - -static int -_check_and_flush (FILE *stream) -{ - int prev_fail = ferror (stream); - return fflush (stream) || prev_fail ? EOF : 0; -} - -/* Subversion branch and revision management */ -static int svn_initialized; -static char patchlevel_revision[50]; /* Just the number */ -static char branch[50]; -static char shortbranch[50]; -static const char *svn_revision; - -static void -svnversion_init(void) -{ - if (svn_initialized) - return; - svn_initialized = 1; - *patchlevel_revision = '\0'; - strcpy(branch, ""); - strcpy(shortbranch, "unknown"); - svn_revision = ""; - return; -} - -/* Return svnversion output if available. - Else return Revision of patchlevel.h if on branch. - Else return empty string */ -const char* -Py_SubversionRevision() -{ - svnversion_init(); - return svn_revision; -} - -const char* -Py_SubversionShortBranch() -{ - svnversion_init(); - return shortbranch; -} - - -PyDoc_STRVAR(flags__doc__, -"sys.flags\n\ -\n\ -Flags provided through command line arguments or environment vars."); - -static PyTypeObject FlagsType = {0, 0, 0, 0, 0, 0}; - -static PyStructSequence_Field flags_fields[] = { - {"debug", "-d"}, - {"py3k_warning", "-3"}, - {"division_warning", "-Q"}, - {"division_new", "-Qnew"}, - {"inspect", "-i"}, - {"interactive", "-i"}, - {"optimize", "-O or -OO"}, - {"dont_write_bytecode", "-B"}, - {"no_user_site", "-s"}, - {"no_site", "-S"}, - {"ignore_environment", "-E"}, - {"tabcheck", "-t or -tt"}, - {"verbose", "-v"}, -#ifdef RISCOS - {"riscos_wimp", "???"}, -#endif - /* {"unbuffered", "-u"}, */ - {"unicode", "-U"}, - /* {"skip_first", "-x"}, */ - {"bytes_warning", "-b"}, - {"hash_randomization", "-R"}, - {0} -}; - -static PyStructSequence_Desc flags_desc = { - "sys.flags", /* name */ - flags__doc__, /* doc */ - flags_fields, /* fields */ -#ifdef RISCOS - 17 -#else - 16 -#endif -}; - -static PyObject* -make_flags(void) -{ - int pos = 0; - PyObject *seq; - - seq = PyStructSequence_New(&FlagsType); - if (seq == NULL) - return NULL; - -#define SetFlag(flag) \ - PyStructSequence_SET_ITEM(seq, pos++, PyInt_FromLong(flag)) - - SetFlag(Py_DebugFlag); - SetFlag(Py_Py3kWarningFlag); - SetFlag(Py_DivisionWarningFlag); - SetFlag(_Py_QnewFlag); - SetFlag(Py_InspectFlag); - SetFlag(Py_InteractiveFlag); - SetFlag(Py_OptimizeFlag); - SetFlag(Py_DontWriteBytecodeFlag); - SetFlag(Py_NoUserSiteDirectory); - SetFlag(Py_NoSiteFlag); - SetFlag(Py_IgnoreEnvironmentFlag); - SetFlag(Py_TabcheckFlag); - SetFlag(Py_VerboseFlag); -#ifdef RISCOS - SetFlag(Py_RISCOSWimpFlag); -#endif - /* SetFlag(saw_unbuffered_flag); */ - SetFlag(Py_UnicodeFlag); - /* SetFlag(skipfirstline); */ - SetFlag(Py_BytesWarningFlag); - SetFlag(Py_HashRandomizationFlag); -#undef SetFlag - - if (PyErr_Occurred()) { - Py_DECREF(seq); - return NULL; - } - return seq; -} - -PyDoc_STRVAR(version_info__doc__, -"sys.version_info\n\ -\n\ -Version information as a named tuple."); - -static PyTypeObject VersionInfoType = {0, 0, 0, 0, 0, 0}; - -static PyStructSequence_Field version_info_fields[] = { - {"major", "Major release number"}, - {"minor", "Minor release number"}, - {"micro", "Patch release number"}, - {"releaselevel", "'alpha', 'beta', 'candidate', or 'release'"}, - {"serial", "Serial release number"}, - {0} -}; - -static PyStructSequence_Desc version_info_desc = { - "sys.version_info", /* name */ - version_info__doc__, /* doc */ - version_info_fields, /* fields */ - 5 -}; - -static PyObject * -make_version_info(void) -{ - PyObject *version_info; - char *s; - int pos = 0; - - version_info = PyStructSequence_New(&VersionInfoType); - if (version_info == NULL) { - return NULL; - } - - /* - * These release level checks are mutually exclusive and cover - * the field, so don't get too fancy with the pre-processor! - */ -#if PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_ALPHA - s = "alpha"; -#elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_BETA - s = "beta"; -#elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_GAMMA - s = "candidate"; -#elif PY_RELEASE_LEVEL == PY_RELEASE_LEVEL_FINAL - s = "final"; -#endif - -#define SetIntItem(flag) \ - PyStructSequence_SET_ITEM(version_info, pos++, PyInt_FromLong(flag)) -#define SetStrItem(flag) \ - PyStructSequence_SET_ITEM(version_info, pos++, PyString_FromString(flag)) - - SetIntItem(PY_MAJOR_VERSION); - SetIntItem(PY_MINOR_VERSION); - SetIntItem(PY_MICRO_VERSION); - SetStrItem(s); - SetIntItem(PY_RELEASE_SERIAL); -#undef SetIntItem -#undef SetStrItem - - if (PyErr_Occurred()) { - Py_CLEAR(version_info); - return NULL; - } - return version_info; -} - -PyObject * -_PySys_Init(void) -{ - PyObject *m, *v, *sysdict; - PyObject *sysin, *sysout, *syserr; - char *s; - - m = Py_InitModule3("sys", sys_methods, sys_doc); - if (m == NULL) - return NULL; - sysdict = PyModule_GetDict(m); -#define SET_SYS_FROM_STRING(key, value) \ - v = value; \ - if (v != NULL) \ - PyDict_SetItemString(sysdict, key, v); \ - Py_XDECREF(v) - - /* Check that stdin is not a directory - Using shell redirection, you can redirect stdin to a directory, - crashing the Python interpreter. Catch this common mistake here - and output a useful error message. Note that under MS Windows, - the shell already prevents that. */ -#if !defined(MS_WINDOWS) - { - struct stat sb; - if (fstat(fileno(stdin), &sb) == 0 && - S_ISDIR(sb.st_mode)) { - /* There's nothing more we can do. */ - /* Py_FatalError() will core dump, so just exit. */ - PySys_WriteStderr("Python error: is a directory, cannot continue\n"); - exit(EXIT_FAILURE); - } - } -#endif - - /* Closing the standard FILE* if sys.std* goes aways causes problems - * for embedded Python usages. Closing them when somebody explicitly - * invokes .close() might be possible, but the FAQ promises they get - * never closed. However, we still need to get write errors when - * writing fails (e.g. because stdout is redirected), so we flush the - * streams and check for errors before the file objects are deleted. - * On OS X, fflush()ing stdin causes an error, so we exempt stdin - * from that procedure. - */ - sysin = PyFile_FromFile(stdin, "", "r", NULL); - sysout = PyFile_FromFile(stdout, "", "w", _check_and_flush); - syserr = PyFile_FromFile(stderr, "", "w", _check_and_flush); - if (PyErr_Occurred()) - return NULL; - - PyDict_SetItemString(sysdict, "stdin", sysin); - PyDict_SetItemString(sysdict, "stdout", sysout); - PyDict_SetItemString(sysdict, "stderr", syserr); - /* Make backup copies for cleanup */ - PyDict_SetItemString(sysdict, "__stdin__", sysin); - PyDict_SetItemString(sysdict, "__stdout__", sysout); - PyDict_SetItemString(sysdict, "__stderr__", syserr); - PyDict_SetItemString(sysdict, "__displayhook__", - PyDict_GetItemString(sysdict, "displayhook")); - PyDict_SetItemString(sysdict, "__excepthook__", - PyDict_GetItemString(sysdict, "excepthook")); - Py_XDECREF(sysin); - Py_XDECREF(sysout); - Py_XDECREF(syserr); - - SET_SYS_FROM_STRING("version", - PyString_FromString(Py_GetVersion())); - SET_SYS_FROM_STRING("hexversion", - PyInt_FromLong(PY_VERSION_HEX)); - svnversion_init(); - SET_SYS_FROM_STRING("subversion", - Py_BuildValue("(ssz)", "CPython", branch, - svn_revision)); - SET_SYS_FROM_STRING("_mercurial", - Py_BuildValue("(szz)", "CPython", _Py_hgidentifier(), - _Py_hgversion())); - SET_SYS_FROM_STRING("dont_write_bytecode", - PyBool_FromLong(Py_DontWriteBytecodeFlag)); - SET_SYS_FROM_STRING("api_version", - PyInt_FromLong(PYTHON_API_VERSION)); - SET_SYS_FROM_STRING("copyright", - PyString_FromString(Py_GetCopyright())); - SET_SYS_FROM_STRING("platform", - PyString_FromString(Py_GetPlatform())); - SET_SYS_FROM_STRING("executable", - PyString_FromString(Py_GetProgramFullPath())); - SET_SYS_FROM_STRING("prefix", - PyString_FromString(Py_GetPrefix())); - SET_SYS_FROM_STRING("exec_prefix", - PyString_FromString(Py_GetExecPrefix())); - SET_SYS_FROM_STRING("maxsize", - PyInt_FromSsize_t(PY_SSIZE_T_MAX)); - SET_SYS_FROM_STRING("maxint", - PyInt_FromLong(PyInt_GetMax())); - SET_SYS_FROM_STRING("py3kwarning", - PyBool_FromLong(Py_Py3kWarningFlag)); - SET_SYS_FROM_STRING("float_info", - PyFloat_GetInfo()); - SET_SYS_FROM_STRING("long_info", - PyLong_GetInfo()); -#ifdef Py_USING_UNICODE - SET_SYS_FROM_STRING("maxunicode", - PyInt_FromLong(PyUnicode_GetMax())); -#endif - SET_SYS_FROM_STRING("builtin_module_names", - list_builtin_module_names()); - { - /* Assumes that longs are at least 2 bytes long. - Should be safe! */ - unsigned long number = 1; - char *value; - - s = (char *) &number; - if (s[0] == 0) - value = "big"; - else - value = "little"; - SET_SYS_FROM_STRING("byteorder", - PyString_FromString(value)); - } -#ifdef MS_COREDLL - SET_SYS_FROM_STRING("dllhandle", - PyLong_FromVoidPtr(PyWin_DLLhModule)); - SET_SYS_FROM_STRING("winver", - PyString_FromString(PyWin_DLLVersionString)); -#endif - if (warnoptions == NULL) { - warnoptions = PyList_New(0); - } - else { - Py_INCREF(warnoptions); - } - if (warnoptions != NULL) { - PyDict_SetItemString(sysdict, "warnoptions", warnoptions); - } - - /* version_info */ - if (VersionInfoType.tp_name == 0) - PyStructSequence_InitType(&VersionInfoType, &version_info_desc); - SET_SYS_FROM_STRING("version_info", make_version_info()); - /* prevent user from creating new instances */ - VersionInfoType.tp_init = NULL; - VersionInfoType.tp_new = NULL; - - /* flags */ - if (FlagsType.tp_name == 0) - PyStructSequence_InitType(&FlagsType, &flags_desc); - SET_SYS_FROM_STRING("flags", make_flags()); - /* prevent user from creating new instances */ - FlagsType.tp_init = NULL; - FlagsType.tp_new = NULL; - - -#if defined(MS_WINDOWS) - /* getwindowsversion */ - if (WindowsVersionType.tp_name == 0) - PyStructSequence_InitType(&WindowsVersionType, &windows_version_desc); - /* prevent user from creating new instances */ - WindowsVersionType.tp_init = NULL; - WindowsVersionType.tp_new = NULL; -#endif - - /* float repr style: 0.03 (short) vs 0.029999999999999999 (legacy) */ -#ifndef PY_NO_SHORT_FLOAT_REPR - SET_SYS_FROM_STRING("float_repr_style", - PyString_FromString("short")); -#else - SET_SYS_FROM_STRING("float_repr_style", - PyString_FromString("legacy")); -#endif - -#undef SET_SYS_FROM_STRING - if (PyErr_Occurred()) - return NULL; - return m; -} - -static PyObject * -makepathobject(char *path, int delim) -{ - int i, n; - char *p; - PyObject *v, *w; - - n = 1; - p = path; - while ((p = strchr(p, delim)) != NULL) { - n++; - p++; - } - v = PyList_New(n); - if (v == NULL) - return NULL; - for (i = 0; ; i++) { - p = strchr(path, delim); - if (p == NULL) - p = strchr(path, '\0'); /* End of string */ - w = PyString_FromStringAndSize(path, (Py_ssize_t) (p - path)); - if (w == NULL) { - Py_DECREF(v); - return NULL; - } - PyList_SetItem(v, i, w); - if (*p == '\0') - break; - path = p+1; - } - return v; -} - -void -PySys_SetPath(char *path) -{ - PyObject *v; - if ((v = makepathobject(path, DELIM)) == NULL) - Py_FatalError("can't create sys.path"); - if (PySys_SetObject("path", v) != 0) - Py_FatalError("can't assign sys.path"); - Py_DECREF(v); -} - -static PyObject * -makeargvobject(int argc, char **argv) -{ - PyObject *av; - if (argc <= 0 || argv == NULL) { - /* Ensure at least one (empty) argument is seen */ - static char *empty_argv[1] = {""}; - argv = empty_argv; - argc = 1; - } - av = PyList_New(argc); - if (av != NULL) { - int i; - for (i = 0; i < argc; i++) { -#ifdef __VMS - PyObject *v; - - /* argv[0] is the script pathname if known */ - if (i == 0) { - char* fn = decc$translate_vms(argv[0]); - if ((fn == (char *)0) || fn == (char *)-1) - v = PyString_FromString(argv[0]); - else - v = PyString_FromString( - decc$translate_vms(argv[0])); - } else - v = PyString_FromString(argv[i]); -#else - PyObject *v = PyString_FromString(argv[i]); -#endif - if (v == NULL) { - Py_DECREF(av); - av = NULL; - break; - } - PyList_SetItem(av, i, v); - } - } - return av; -} - -void -PySys_SetArgvEx(int argc, char **argv, int updatepath) -{ -#if defined(HAVE_REALPATH) - char fullpath[MAXPATHLEN]; -#elif defined(MS_WINDOWS) && !defined(MS_WINCE) - char fullpath[MAX_PATH]; -#endif - PyObject *av = makeargvobject(argc, argv); - PyObject *path = PySys_GetObject("path"); - if (av == NULL) - Py_FatalError("no mem for sys.argv"); - if (PySys_SetObject("argv", av) != 0) - Py_FatalError("can't assign sys.argv"); - if (updatepath && path != NULL) { - char *argv0 = argv[0]; - char *p = NULL; - Py_ssize_t n = 0; - PyObject *a; -#ifdef HAVE_READLINK - char link[MAXPATHLEN+1]; - char argv0copy[2*MAXPATHLEN+1]; - int nr = 0; - if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) - nr = readlink(argv0, link, MAXPATHLEN); - if (nr > 0) { - /* It's a symlink */ - link[nr] = '\0'; - if (link[0] == SEP) - argv0 = link; /* Link to absolute path */ - else if (strchr(link, SEP) == NULL) - ; /* Link without path */ - else { - /* Must join(dirname(argv0), link) */ - char *q = strrchr(argv0, SEP); - if (q == NULL) - argv0 = link; /* argv0 without path */ - else { - /* Must make a copy */ - strcpy(argv0copy, argv0); - q = strrchr(argv0copy, SEP); - strcpy(q+1, link); - argv0 = argv0copy; - } - } - } -#endif /* HAVE_READLINK */ -#if SEP == '\\' /* Special case for MS filename syntax */ - if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { - char *q; -#if defined(MS_WINDOWS) && !defined(MS_WINCE) - /* This code here replaces the first element in argv with the full - path that it represents. Under CE, there are no relative paths so - the argument must be the full path anyway. */ - char *ptemp; - if (GetFullPathName(argv0, - sizeof(fullpath), - fullpath, - &ptemp)) { - argv0 = fullpath; - } -#endif - p = strrchr(argv0, SEP); - /* Test for alternate separator */ - q = strrchr(p ? p : argv0, '/'); - if (q != NULL) - p = q; - if (p != NULL) { - n = p + 1 - argv0; - if (n > 1 && p[-1] != ':') - n--; /* Drop trailing separator */ - } - } -#else /* All other filename syntaxes */ - if (argc > 0 && argv0 != NULL && strcmp(argv0, "-c") != 0) { -#if defined(HAVE_REALPATH) - if (realpath(argv0, fullpath)) { - argv0 = fullpath; - } -#endif - p = strrchr(argv0, SEP); - } - if (p != NULL) { -#ifndef RISCOS - n = p + 1 - argv0; -#else /* don't include trailing separator */ - n = p - argv0; -#endif /* RISCOS */ -#if SEP == '/' /* Special case for Unix filename syntax */ - if (n > 1) - n--; /* Drop trailing separator */ -#endif /* Unix */ - } -#endif /* All others */ - a = PyString_FromStringAndSize(argv0, n); - if (a == NULL) - Py_FatalError("no mem for sys.path insertion"); - if (PyList_Insert(path, 0, a) < 0) - Py_FatalError("sys.path.insert(0) failed"); - Py_DECREF(a); - } - Py_DECREF(av); -} - -void -PySys_SetArgv(int argc, char **argv) -{ - PySys_SetArgvEx(argc, argv, 1); -} - - -/* APIs to write to sys.stdout or sys.stderr using a printf-like interface. - Adapted from code submitted by Just van Rossum. - - PySys_WriteStdout(format, ...) - PySys_WriteStderr(format, ...) - - The first function writes to sys.stdout; the second to sys.stderr. When - there is a problem, they write to the real (C level) stdout or stderr; - no exceptions are raised. - - Both take a printf-style format string as their first argument followed - by a variable length argument list determined by the format string. - - *** WARNING *** - - The format should limit the total size of the formatted output string to - 1000 bytes. In particular, this means that no unrestricted "%s" formats - should occur; these should be limited using "%.s where is a - decimal number calculated so that plus the maximum size of other - formatted text does not exceed 1000 bytes. Also watch out for "%f", - which can print hundreds of digits for very large numbers. - - */ - -static void -mywrite(char *name, FILE *fp, const char *format, va_list va) -{ - PyObject *file; - PyObject *error_type, *error_value, *error_traceback; - - PyErr_Fetch(&error_type, &error_value, &error_traceback); - file = PySys_GetObject(name); - if (file == NULL || PyFile_AsFile(file) == fp) - vfprintf(fp, format, va); - else { - char buffer[1001]; - const int written = PyOS_vsnprintf(buffer, sizeof(buffer), - format, va); - if (PyFile_WriteString(buffer, file) != 0) { - PyErr_Clear(); - fputs(buffer, fp); - } - if (written < 0 || (size_t)written >= sizeof(buffer)) { - const char *truncated = "... truncated"; - if (PyFile_WriteString(truncated, file) != 0) { - PyErr_Clear(); - fputs(truncated, fp); - } - } - } - PyErr_Restore(error_type, error_value, error_traceback); -} - -void -PySys_WriteStdout(const char *format, ...) -{ - va_list va; - - va_start(va, format); - mywrite("stdout", stdout, format, va); - va_end(va); -} - -void -PySys_WriteStderr(const char *format, ...) -{ - va_list va; - - va_start(va, format); - mywrite("stderr", stderr, format, va); - va_end(va); -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python/traceback.c b/AppPkg/Applications/Python/Python-2.7.10/Python/traceback.c deleted file mode 100644 index 85caa02..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python/traceback.c +++ /dev/null @@ -1,283 +0,0 @@ - -/* Traceback implementation */ - -#include "Python.h" - -#include "code.h" -#include "frameobject.h" -#include "structmember.h" -#include "osdefs.h" -#include "traceback.h" - -#define OFF(x) offsetof(PyTracebackObject, x) - -static PyMemberDef tb_memberlist[] = { - {"tb_next", T_OBJECT, OFF(tb_next), READONLY}, - {"tb_frame", T_OBJECT, OFF(tb_frame), READONLY}, - {"tb_lasti", T_INT, OFF(tb_lasti), READONLY}, - {"tb_lineno", T_INT, OFF(tb_lineno), READONLY}, - {NULL} /* Sentinel */ -}; - -static void -tb_dealloc(PyTracebackObject *tb) -{ - PyObject_GC_UnTrack(tb); - Py_TRASHCAN_SAFE_BEGIN(tb) - Py_XDECREF(tb->tb_next); - Py_XDECREF(tb->tb_frame); - PyObject_GC_Del(tb); - Py_TRASHCAN_SAFE_END(tb) -} - -static int -tb_traverse(PyTracebackObject *tb, visitproc visit, void *arg) -{ - Py_VISIT(tb->tb_next); - Py_VISIT(tb->tb_frame); - return 0; -} - -static void -tb_clear(PyTracebackObject *tb) -{ - Py_CLEAR(tb->tb_next); - Py_CLEAR(tb->tb_frame); -} - -PyTypeObject PyTraceBack_Type = { - PyVarObject_HEAD_INIT(&PyType_Type, 0) - "traceback", - sizeof(PyTracebackObject), - 0, - (destructor)tb_dealloc, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - 0, /*tp_compare*/ - 0, /*tp_repr*/ - 0, /*tp_as_number*/ - 0, /*tp_as_sequence*/ - 0, /*tp_as_mapping*/ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,/* tp_flags */ - 0, /* tp_doc */ - (traverseproc)tb_traverse, /* tp_traverse */ - (inquiry)tb_clear, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - tb_memberlist, /* tp_members */ - 0, /* tp_getset */ - 0, /* tp_base */ - 0, /* tp_dict */ -}; - -static PyTracebackObject * -newtracebackobject(PyTracebackObject *next, PyFrameObject *frame) -{ - PyTracebackObject *tb; - if ((next != NULL && !PyTraceBack_Check(next)) || - frame == NULL || !PyFrame_Check(frame)) { - PyErr_BadInternalCall(); - return NULL; - } - tb = PyObject_GC_New(PyTracebackObject, &PyTraceBack_Type); - if (tb != NULL) { - Py_XINCREF(next); - tb->tb_next = next; - Py_XINCREF(frame); - tb->tb_frame = frame; - tb->tb_lasti = frame->f_lasti; - tb->tb_lineno = PyFrame_GetLineNumber(frame); - PyObject_GC_Track(tb); - } - return tb; -} - -int -PyTraceBack_Here(PyFrameObject *frame) -{ - PyThreadState *tstate = PyThreadState_GET(); - PyTracebackObject *oldtb = (PyTracebackObject *) tstate->curexc_traceback; - PyTracebackObject *tb = newtracebackobject(oldtb, frame); - if (tb == NULL) - return -1; - tstate->curexc_traceback = (PyObject *)tb; - Py_XDECREF(oldtb); - return 0; -} - -int -_Py_DisplaySourceLine(PyObject *f, const char *filename, int lineno, int indent) -{ - int err = 0; - FILE *xfp = NULL; - char linebuf[2000]; - int i; - char namebuf[MAXPATHLEN+1]; - - if (filename == NULL) - return -1; - /* This is needed by Emacs' compile command */ -#define FMT " File \"%.500s\", line %d, in %.500s\n" - xfp = fopen(filename, "r" PY_STDIOTEXTMODE); - if (xfp == NULL) { - /* Search tail of filename in sys.path before giving up */ - PyObject *path; - const char *tail = strrchr(filename, SEP); - if (tail == NULL) - tail = filename; - else - tail++; - path = PySys_GetObject("path"); - if (path != NULL && PyList_Check(path)) { - Py_ssize_t _npath = PyList_Size(path); - int npath = Py_SAFE_DOWNCAST(_npath, Py_ssize_t, int); - size_t taillen = strlen(tail); - for (i = 0; i < npath; i++) { - PyObject *v = PyList_GetItem(path, i); - if (v == NULL) { - PyErr_Clear(); - break; - } - if (PyString_Check(v)) { - size_t len; - len = PyString_GET_SIZE(v); - if (len + 1 + taillen >= MAXPATHLEN) - continue; /* Too long */ - strcpy(namebuf, PyString_AsString(v)); - if (strlen(namebuf) != len) - continue; /* v contains '\0' */ - if (len > 0 && namebuf[len-1] != SEP) - namebuf[len++] = SEP; - strcpy(namebuf+len, tail); - xfp = fopen(namebuf, "r" PY_STDIOTEXTMODE); - if (xfp != NULL) { - break; - } - } - } - } - } - - if (xfp == NULL) - return err; - if (err != 0) { - fclose(xfp); - return err; - } - - for (i = 0; i < lineno; i++) { - char* pLastChar = &linebuf[sizeof(linebuf)-2]; - do { - *pLastChar = '\0'; - if (Py_UniversalNewlineFgets(linebuf, sizeof linebuf, xfp, NULL) == NULL) - break; - /* fgets read *something*; if it didn't get as - far as pLastChar, it must have found a newline - or hit the end of the file; if pLastChar is \n, - it obviously found a newline; else we haven't - yet seen a newline, so must continue */ - } while (*pLastChar != '\0' && *pLastChar != '\n'); - } - if (i == lineno) { - char buf[11]; - char *p = linebuf; - while (*p == ' ' || *p == '\t' || *p == '\014') - p++; - - /* Write some spaces before the line */ - strcpy(buf, " "); - assert (strlen(buf) == 10); - while (indent > 0) { - if(indent < 10) - buf[indent] = '\0'; - err = PyFile_WriteString(buf, f); - if (err != 0) - break; - indent -= 10; - } - - if (err == 0) - err = PyFile_WriteString(p, f); - if (err == 0 && strchr(p, '\n') == NULL) - err = PyFile_WriteString("\n", f); - } - fclose(xfp); - return err; -} - -static int -tb_displayline(PyObject *f, const char *filename, int lineno, const char *name) -{ - int err = 0; - char linebuf[2000]; - - if (filename == NULL || name == NULL) - return -1; - /* This is needed by Emacs' compile command */ -#define FMT " File \"%.500s\", line %d, in %.500s\n" - PyOS_snprintf(linebuf, sizeof(linebuf), FMT, filename, lineno, name); - err = PyFile_WriteString(linebuf, f); - if (err != 0) - return err; - return _Py_DisplaySourceLine(f, filename, lineno, 4); -} - -static int -tb_printinternal(PyTracebackObject *tb, PyObject *f, long limit) -{ - int err = 0; - long depth = 0; - PyTracebackObject *tb1 = tb; - while (tb1 != NULL) { - depth++; - tb1 = tb1->tb_next; - } - while (tb != NULL && err == 0) { - if (depth <= limit) { - err = tb_displayline(f, - PyString_AsString( - tb->tb_frame->f_code->co_filename), - tb->tb_lineno, - PyString_AsString(tb->tb_frame->f_code->co_name)); - } - depth--; - tb = tb->tb_next; - if (err == 0) - err = PyErr_CheckSignals(); - } - return err; -} - -int -PyTraceBack_Print(PyObject *v, PyObject *f) -{ - int err; - PyObject *limitv; - long limit = 1000; - if (v == NULL) - return 0; - if (!PyTraceBack_Check(v)) { - PyErr_BadInternalCall(); - return -1; - } - limitv = PySys_GetObject("tracebacklimit"); - if (limitv && PyInt_Check(limitv)) { - limit = PyInt_AsLong(limitv); - if (limit <= 0) - return 0; - } - err = PyFile_WriteString("Traceback (most recent call last):\n", f); - if (!err) - err = tb_printinternal((PyTracebackObject *)v, f, limit); - return err; -} diff --git a/AppPkg/Applications/Python/Python-2.7.10/Python2710.inf b/AppPkg/Applications/Python/Python-2.7.10/Python2710.inf deleted file mode 100644 index ccf0c60..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/Python2710.inf +++ /dev/null @@ -1,255 +0,0 @@ -## @file -# Python2710.inf -# -# Copyright (c) 2015, Daryl McDaniel. All rights reserved.
-# Copyright (c) 2011-2012, Intel Corporation. All rights reserved.
-# This program and the accompanying materials -# are licensed and made available under the terms and conditions of the BSD License -# which accompanies this distribution. The full text of the license may be found at -# http://opensource.org/licenses/bsd-license. -# -# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -# -## - -[Defines] - INF_VERSION = 0x00010016 - BASE_NAME = Python2710 - FILE_GUID = F78285FD-121E-49f4-9716-44E307656586 - MODULE_TYPE = UEFI_APPLICATION - VERSION_STRING = 0.1 - ENTRY_POINT = ShellCEntryLib - - DEFINE PYTHON_VERSION = 2.7.10 - -# -# VALID_ARCHITECTURES = IA32 X64 -# - -[Packages] - StdLib/StdLib.dec - MdePkg/MdePkg.dec - -[LibraryClasses] - UefiLib - DebugLib - LibC - LibString - LibStdio - LibGdtoa - LibMath - LibWchar - LibGen - LibNetUtil - DevMedia - BsdSocketLib - EfiSocketLib - -[FixedPcd] - gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x0F - gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040 - -[Sources] -#Parser - Parser/acceler.c - Parser/bitset.c - Parser/firstsets.c - Parser/grammar.c - Parser/grammar1.c - Parser/listnode.c - Parser/metagrammar.c - Parser/myreadline.c - Parser/node.c - Parser/parser.c - Parser/parsetok.c - Parser/tokenizer.c - -#Python - PyMod-$(PYTHON_VERSION)/Python/getcopyright.c - PyMod-$(PYTHON_VERSION)/Python/marshal.c - PyMod-$(PYTHON_VERSION)/Python/random.c - - Python/_warnings.c - Python/asdl.c - Python/ast.c - Python/bltinmodule.c - Python/ceval.c - Python/codecs.c - Python/compile.c - Python/dtoa.c - Python/dynload_stub.c - Python/errors.c - Python/formatter_string.c - Python/formatter_unicode.c - Python/frozen.c - Python/future.c - Python/getargs.c - Python/getcompiler.c - Python/getopt.c - Python/getplatform.c - Python/getversion.c - Python/graminit.c - Python/import.c - Python/importdl.c - Python/modsupport.c - Python/mysnprintf.c - Python/mystrtoul.c - Python/peephole.c - Python/pyarena.c - Python/pyctype.c - Python/pyfpe.c - Python/pymath.c - Python/pystate.c - Python/pystrcmp.c - Python/pystrtod.c - Python/Python-ast.c - Python/pythonrun.c - Python/structmember.c - Python/symtable.c - Python/sysmodule.c - Python/traceback.c - -#Objects - PyMod-$(PYTHON_VERSION)/Objects/longobject.c - - Objects/abstract.c - Objects/boolobject.c - Objects/bufferobject.c - Objects/bytearrayobject.c - Objects/bytes_methods.c - Objects/capsule.c - Objects/cellobject.c - Objects/classobject.c - Objects/cobject.c - Objects/codeobject.c - Objects/complexobject.c - Objects/descrobject.c - Objects/dictobject.c - Objects/enumobject.c - Objects/exceptions.c - Objects/fileobject.c - Objects/floatobject.c - Objects/frameobject.c - Objects/funcobject.c - Objects/genobject.c - Objects/intobject.c - Objects/iterobject.c - Objects/listobject.c - Objects/memoryobject.c - Objects/methodobject.c - Objects/moduleobject.c - Objects/object.c - Objects/obmalloc.c - Objects/rangeobject.c - Objects/setobject.c - Objects/sliceobject.c - Objects/stringobject.c - Objects/structseq.c - Objects/tupleobject.c - Objects/typeobject.c - Objects/unicodectype.c - Objects/unicodeobject.c - Objects/weakrefobject.c - -#Modules -- See config.c - # Mandatory Modules -- These must always be built in. - PyMod-$(PYTHON_VERSION)/Modules/config.c - PyMod-$(PYTHON_VERSION)/Modules/edk2module.c - PyMod-$(PYTHON_VERSION)/Modules/errnomodule.c - PyMod-$(PYTHON_VERSION)/Modules/getpath.c - PyMod-$(PYTHON_VERSION)/Modules/main.c - - Modules/_functoolsmodule.c - Modules/gcmodule.c - Modules/getbuildinfo.c - Modules/python.c - - # Optional Modules -- See Python/Efi/config.c - PyMod-$(PYTHON_VERSION)/Modules/_sre.c - PyMod-$(PYTHON_VERSION)/Modules/selectmodule.c - # - Modules/_bisectmodule.c # - Modules/_codecsmodule.c # - Modules/_collectionsmodule.c # - Modules/_csv.c # - Modules/_heapqmodule.c # - Modules/_json.c # - Modules/_localemodule.c # - Modules/_math.c # - Modules/_randommodule.c # - Modules/_struct.c # - Modules/_weakref.c # - Modules/arraymodule.c # - Modules/binascii.c # - Modules/cmathmodule.c # - Modules/cPickle.c # - Modules/cStringIO.c # - Modules/datetimemodule.c # - Modules/future_builtins.c # - Modules/itertoolsmodule.c # - Modules/mathmodule.c # - Modules/md5.c # - Modules/md5module.c # - Modules/operator.c # - Modules/parsermodule.c # - Modules/sha256module.c # - Modules/sha512module.c # - Modules/shamodule.c # - Modules/signalmodule.c # - Modules/socketmodule.c # - Modules/stropmodule.c # - Modules/symtablemodule.c # - Modules/timemodule.c # - Modules/unicodedata.c # - Modules/xxsubtype.c # - Modules/zipimport.c # - Modules/zlibmodule.c # - -#Modules/_io - Modules/_io/_iomodule.c # - Modules/_io/bufferedio.c # - Modules/_io/bytesio.c # - Modules/_io/fileio.c # - Modules/_io/iobase.c # - Modules/_io/stringio.c # - Modules/_io/textio.c # - -#Modules/cjkcodecs - Modules/cjkcodecs/multibytecodec.c # - Modules/cjkcodecs/_codecs_cn.c # - Modules/cjkcodecs/_codecs_hk.c # - Modules/cjkcodecs/_codecs_iso2022.c # - Modules/cjkcodecs/_codecs_jp.c # - Modules/cjkcodecs/_codecs_kr.c # - Modules/cjkcodecs/_codecs_tw.c # - -#Modules/expat - Modules/pyexpat.c # - Modules/expat/xmlrole.c # - Modules/expat/xmltok.c # - Modules/expat/xmlparse.c # - -#Modules/zlib - Modules/zlib/adler32.c # - Modules/zlib/compress.c # - Modules/zlib/crc32.c # - Modules/zlib/deflate.c # - Modules/zlib/gzclose.c # - Modules/zlib/gzlib.c # - Modules/zlib/gzread.c # - Modules/zlib/gzwrite.c # - - Modules/zlib/infback.c # - Modules/zlib/inffast.c # - Modules/zlib/inflate.c # - Modules/zlib/inftrees.c # - Modules/zlib/trees.c # - Modules/zlib/uncompr.c # - Modules/zlib/zutil.c # - -[BuildOptions] - MSFT:*_*_IA32_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I$(WORKSPACE)\AppPkg\Applications\Python\Python-2.7.10\Ia32 /I$(WORKSPACE)\AppPkg\Applications\Python\Python-2.7.10\Include /DHAVE_MEMMOVE /DUSE_PYEXPAT_CAPI /DXML_STATIC - MSFT:*_*_X64_CC_FLAGS = /Oi- /wd4018 /wd4054 /wd4055 /wd4101 /wd4131 /wd4152 /wd4204 /wd4210 /wd4244 /wd4267 /wd4305 /wd4310 /wd4389 /wd4701 /wd4702 /wd4706 /I$(WORKSPACE)\AppPkg\Applications\Python\Python-2.7.10\X64 /I$(WORKSPACE)\AppPkg\Applications\Python\Python-2.7.10\Include /DHAVE_MEMMOVE /DUSE_PYEXPAT_CAPI /DXML_STATIC - GCC:*_*_IA32_CC_FLAGS = -fno-builtin -Wno-format -I$(WORKSPACE)/AppPkg/Applications/Python/Python-2.7.10/Ia32 -I$(WORKSPACE)/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include -I$(WORKSPACE)/AppPkg/Applications/Python/Python-2.7.10/Include -DHAVE_MEMMOVE -DUSE_PYEXPAT_CAPI -DXML_STATIC - GCC:*_*_X64_CC_FLAGS = -Wno-format -I$(WORKSPACE)/AppPkg/Applications/Python/Python-2.7.10/X64 -I$(WORKSPACE)/AppPkg/Applications/Python/Python-2.7.10/PyMod-2.7.10/Include -I$(WORKSPACE)/AppPkg/Applications/Python/Python-2.7.10/Include -DHAVE_MEMMOVE -DUSE_PYEXPAT_CAPI -DXML_STATIC diff --git a/AppPkg/Applications/Python/Python-2.7.10/README b/AppPkg/Applications/Python/Python-2.7.10/README deleted file mode 100644 index b5e2f29..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/README +++ /dev/null @@ -1,1236 +0,0 @@ -This is Python version 2.7.10 -============================= - -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, -2012, 2013, 2014, 2015 Python Software Foundation. All rights reserved. - -Copyright (c) 2000 BeOpen.com. -All rights reserved. - -Copyright (c) 1995-2001 Corporation for National Research Initiatives. -All rights reserved. - -Copyright (c) 1991-1995 Stichting Mathematisch Centrum. -All rights reserved. - - -License information -------------------- - -See the file "LICENSE" for information on the history of this -software, terms & conditions for usage, and a DISCLAIMER OF ALL -WARRANTIES. - -This Python distribution contains no GNU General Public Licensed -(GPLed) code so it may be used in proprietary projects just like prior -Python distributions. There are interfaces to some GNU code but these -are entirely optional. - -All trademarks referenced herein are property of their respective -holders. - - -What's new in this release? ---------------------------- - -See the file "Misc/NEWS". - - -If you don't read instructions ------------------------------- - -Congratulations on getting this far. :-) - -To start building right away (on UNIX): type "./configure" in the -current directory and when it finishes, type "make". This creates an -executable "./python"; to install in /usr/local, first do "su root" -and then "make install". - -The section `Build instructions' below is still recommended reading. - - -What is Python anyway? ----------------------- - -Python is an interpreted, interactive object-oriented programming -language suitable (amongst other uses) for distributed application -development, scripting, numeric computing and system testing. Python -is often compared to Tcl, Perl, Java, JavaScript, Visual Basic or -Scheme. To find out more about what Python can do for you, point your -browser to http://www.python.org/. - - -How do I learn Python? ----------------------- - -The official tutorial is still a good place to start; see -http://docs.python.org/ for online and downloadable versions, as well -as a list of other introductions, and reference documentation. - -There's a quickly growing set of books on Python. See -http://wiki.python.org/moin/PythonBooks for a list. - - -Documentation -------------- - -All documentation is provided online in a variety of formats. In -order of importance for new users: Tutorial, Library Reference, -Language Reference, Extending & Embedding, and the Python/C API. The -Library Reference is especially of immense value since much of -Python's power is described there, including the built-in data types -and functions! - -All documentation is also available online at the Python web site -(http://docs.python.org/, see below). It is available online for occasional -reference, or can be downloaded in many formats for faster access. The -documentation is downloadable in HTML, PostScript, PDF, LaTeX, and -reStructuredText (2.6+) formats; the LaTeX and reStructuredText versions are -primarily for documentation authors, translators, and people with special -formatting requirements. - -If you would like to contribute to the development of Python, relevant -documentation is available at: - - http://docs.python.org/devguide/ - -For information about building Python's documentation, refer to Doc/README.txt. - - -Web sites ---------- - -New Python releases and related technologies are published at -http://www.python.org/. Come visit us! - - -Newsgroups and Mailing Lists ----------------------------- - -Read comp.lang.python, a high-volume discussion newsgroup about -Python, or comp.lang.python.announce, a low-volume moderated newsgroup -for Python-related announcements. These are also accessible as -mailing lists: see http://www.python.org/community/lists/ for an -overview of these and many other Python-related mailing lists. - -Archives are accessible via the Google Groups Usenet archive; see -http://groups.google.com/. The mailing lists are also archived, see -http://www.python.org/community/lists/ for details. - - -Bug reports ------------ - -To report or search for bugs, please use the Python Bug -Tracker at http://bugs.python.org/. - - -Patches and contributions -------------------------- - -To submit a patch or other contribution, please use the Python Patch -Manager at http://bugs.python.org/. Guidelines -for patch submission may be found at http://www.python.org/dev/patches/. - -If you have a proposal to change Python, you may want to send an email to the -comp.lang.python or python-ideas mailing lists for inital feedback. A Python -Enhancement Proposal (PEP) may be submitted if your idea gains ground. All -current PEPs, as well as guidelines for submitting a new PEP, are listed at -http://www.python.org/dev/peps/. - - -Questions ---------- - -For help, if you can't find it in the manuals or on the web site, it's -best to post to the comp.lang.python or the Python mailing list (see -above). If you specifically don't want to involve the newsgroup or -mailing list, send questions to help@python.org (a group of volunteers -who answer questions as they can). The newsgroup is the most -efficient way to ask public questions. - - -Build instructions -================== - -Before you can build Python, you must first configure it. -Fortunately, the configuration and build process has been automated -for Unix and Linux installations, so all you usually have to do is -type a few commands and sit back. There are some platforms where -things are not quite as smooth; see the platform specific notes below. -If you want to build for multiple platforms sharing the same source -tree, see the section on VPATH below. - -Start by running the script "./configure", which determines your -system configuration and creates the Makefile. (It takes a minute or -two -- please be patient!) You may want to pass options to the -configure script -- see the section below on configuration options and -variables. When it's done, you are ready to run make. - -To build Python, you normally type "make" in the toplevel directory. -If you have changed the configuration, the Makefile may have to be -rebuilt. In this case, you may have to run make again to correctly -build your desired target. The interpreter executable is built in the -top level directory. - -Once you have built a Python interpreter, see the subsections below on -testing and installation. If you run into trouble, see the next -section. - -Previous versions of Python used a manual configuration process that -involved editing the file Modules/Setup. While this file still exists -and manual configuration is still supported, it is rarely needed any -more: almost all modules are automatically built as appropriate under -guidance of the setup.py script, which is run by Make after the -interpreter has been built. - - -Troubleshooting ---------------- - -See also the platform specific notes in the next section. - -If you run into other trouble, see the FAQ -(http://www.python.org/doc/faq/) for hints on what can go wrong, and -how to fix it. - -If you rerun the configure script with different options, remove all -object files by running "make clean" before rebuilding. Believe it or -not, "make clean" sometimes helps to clean up other inexplicable -problems as well. Try it before sending in a bug report! - -If the configure script fails or doesn't seem to find things that -should be there, inspect the config.log file. - -If you get a warning for every file about the -Olimit option being no -longer supported, you can ignore it. There's no foolproof way to know -whether this option is needed; all we can do is test whether it is -accepted without error. On some systems, e.g. older SGI compilers, it -is essential for performance (specifically when compiling ceval.c, -which has more basic blocks than the default limit of 1000). If the -warning bothers you, edit the Makefile to remove "-Olimit 1500" from -the OPT variable. - -If you get failures in test_long, or sys.maxint gets set to -1, you -are probably experiencing compiler bugs, usually related to -optimization. This is a common problem with some versions of gcc, and -some vendor-supplied compilers, which can sometimes be worked around -by turning off optimization. Consider switching to stable versions -(gcc 2.95.2, gcc 3.x, or contact your vendor.) - -From Python 2.0 onward, all Python C code is ANSI C. Compiling using -old K&R-C-only compilers is no longer possible. ANSI C compilers are -available for all modern systems, either in the form of updated -compilers from the vendor, or one of the free compilers (gcc). - -If "make install" fails mysteriously during the "compiling the library" -step, make sure that you don't have any of the PYTHONPATH or PYTHONHOME -environment variables set, as they may interfere with the newly built -executable which is compiling the library. - -Unsupported systems -------------------- - -A number of systems are not supported in Python 2.7 anymore. Some -support code is still present, but will be removed in later versions. -If you still need to use current Python versions on these systems, -please send a message to python-dev@python.org indicating that you -volunteer to support this system. For a more detailed discussion -regarding no-longer-supported and resupporting platforms, as well -as a list of platforms that became or will be unsupported, see PEP 11. - -More specifically, the following systems are not supported any -longer: -- SunOS 4 -- DYNIX -- dgux -- Minix -- NeXT -- Irix 4 and --with-sgi-dl -- Linux 1 -- Systems defining __d6_pthread_create (configure.ac) -- Systems defining PY_PTHREAD_D4, PY_PTHREAD_D6, - or PY_PTHREAD_D7 in thread_pthread.h -- Systems using --with-dl-dld -- Systems using --without-universal-newlines -- MacOS 9 -- Systems using --with-wctype-functions -- Win9x, WinME - - -Platform specific notes ------------------------ - -(Some of these may no longer apply. If you find you can build Python -on these platforms without the special directions mentioned here, -submit a documentation bug report to SourceForge (see Bug Reports -above) so we can remove them!) - -Unix platforms: If your vendor still ships (and you still use) Berkeley DB - 1.85 you will need to edit Modules/Setup to build the bsddb185 - module and add a line to sitecustomize.py which makes it the - default. In Modules/Setup a line like - - bsddb185 bsddbmodule.c - - should work. (You may need to add -I, -L or -l flags to direct the - compiler and linker to your include files and libraries.) - -XXX I think this next bit is out of date: - -64-bit platforms: The modules audioop, and imageop don't work. - The setup.py script disables them on 64-bit installations. - Don't try to enable them in the Modules/Setup file. They - contain code that is quite wordsize sensitive. (If you have a - fix, let us know!) - -Solaris: When using Sun's C compiler with threads, at least on Solaris - 2.5.1, you need to add the "-mt" compiler option (the simplest - way is probably to specify the compiler with this option as - the "CC" environment variable when running the configure - script). - - When using GCC on Solaris, beware of binutils 2.13 or GCC - versions built using it. This mistakenly enables the - -zcombreloc option which creates broken shared libraries on - Solaris. binutils 2.12 works, and the binutils maintainers - are aware of the problem. Binutils 2.13.1 only partially - fixed things. It appears that 2.13.2 solves the problem - completely. This problem is known to occur with Solaris 2.7 - and 2.8, but may also affect earlier and later versions of the - OS. - - When the dynamic loader complains about errors finding shared - libraries, such as - - ld.so.1: ./python: fatal: libstdc++.so.5: open failed: - No such file or directory - - you need to first make sure that the library is available on - your system. Then, you need to instruct the dynamic loader how - to find it. You can choose any of the following strategies: - - 1. When compiling Python, set LD_RUN_PATH to the directories - containing missing libraries. - 2. When running Python, set LD_LIBRARY_PATH to these directories. - 3. Use crle(8) to extend the search path of the loader. - 4. Modify the installed GCC specs file, adding -R options into the - *link: section. - - The complex object fails to compile on Solaris 10 with gcc 3.4 (at - least up to 3.4.3). To work around it, define Py_HUGE_VAL as - HUGE_VAL(), e.g.: - - make CPPFLAGS='-D"Py_HUGE_VAL=HUGE_VAL()" -I. -I$(srcdir)/Include' - ./python setup.py CPPFLAGS='-D"Py_HUGE_VAL=HUGE_VAL()"' - -Linux: A problem with threads and fork() was tracked down to a bug in - the pthreads code in glibc version 2.0.5; glibc version 2.0.7 - solves the problem. This causes the popen2 test to fail; - problem and solution reported by Pablo Bleyer. - -Red Hat Linux: Red Hat 9 built Python2.2 in UCS-4 mode and hacked - Tcl to support it. To compile Python2.3 with Tkinter, you will - need to pass --enable-unicode=ucs4 flag to ./configure. - - There's an executable /usr/bin/python which is Python - 1.5.2 on most older Red Hat installations; several key Red Hat tools - require this version. Python 2.1.x may be installed as - /usr/bin/python2. The Makefile installs Python as - /usr/local/bin/python, which may or may not take precedence - over /usr/bin/python, depending on how you have set up $PATH. - -FreeBSD 3.x and probably platforms with NCurses that use libmytinfo or - similar: When using cursesmodule, the linking is not done in - the correct order with the defaults. Remove "-ltermcap" from - the readline entry in Setup, and use as curses entry: "curses - cursesmodule.c -lmytinfo -lncurses -ltermcap" - "mytinfo" (so - called on FreeBSD) should be the name of the auxiliary library - required on your platform. Normally, it would be linked - automatically, but not necessarily in the correct order. - -BSDI: BSDI versions before 4.1 have known problems with threads, - which can cause strange errors in a number of modules (for - instance, the 'test_signal' test script will hang forever.) - Turning off threads (with --with-threads=no) or upgrading to - BSDI 4.1 solves this problem. - -DEC Unix: Run configure with --with-dec-threads, or with - --with-threads=no if no threads are desired (threads are on by - default). When using GCC, it is possible to get an internal - compiler error if optimization is used. This was reported for - GCC 2.7.2.3 on selectmodule.c. Manually compile the affected - file without optimization to solve the problem. - -DEC Ultrix: compile with GCC to avoid bugs in the native compiler, - and pass SHELL=/bin/sh5 to Make when installing. - -AIX: A complete overhaul of the shared library support is now in - place. See Misc/AIX-NOTES for some notes on how it's done. - (The optimizer bug reported at this place in previous releases - has been worked around by a minimal code change.) If you get - errors about pthread_* functions, during compile or during - testing, try setting CC to a thread-safe (reentrant) compiler, - like "cc_r". For full C++ module support, set CC="xlC_r" (or - CC="xlC" without thread support). - -AIX 5.3: To build a 64-bit version with IBM's compiler, I used the - following: - - export PATH=/usr/bin:/usr/vacpp/bin - ./configure --with-gcc="xlc_r -q64" --with-cxx="xlC_r -q64" \ - --disable-ipv6 AR="ar -X64" - make - -HP-UX: When using threading, you may have to add -D_REENTRANT to the - OPT variable in the top-level Makefile; reported by Pat Knight, - this seems to make a difference (at least for HP-UX 10.20) - even though pyconfig.h defines it. This seems unnecessary when - using HP/UX 11 and later - threading seems to work "out of the - box". - -HP-UX ia64: When building on the ia64 (Itanium) platform using HP's - compiler, some experience has shown that the compiler's - optimiser produces a completely broken version of python - (see http://bugs.python.org/814976). To work around this, - edit the Makefile and remove -O from the OPT line. - - To build a 64-bit executable on an Itanium 2 system using HP's - compiler, use these environment variables: - - CC=cc - CXX=aCC - BASECFLAGS="+DD64" - LDFLAGS="+DD64 -lxnet" - - and call configure as: - - ./configure --without-gcc - - then *unset* the environment variables again before running - make. (At least one of these flags causes the build to fail - if it remains set.) You still have to edit the Makefile and - remove -O from the OPT line. - -HP PA-RISC 2.0: A recent bug report (http://bugs.python.org/546117) - suggests that the C compiler in this 64-bit system has bugs - in the optimizer that break Python. Compiling without - optimization solves the problems. - -SCO: The following apply to SCO 3 only; Python builds out of the box - on SCO 5 (or so we've heard). - - 1) Everything works much better if you add -U__STDC__ to the - defs. This is because all the SCO header files are broken. - Anything that isn't mentioned in the C standard is - conditionally excluded when __STDC__ is defined. - - 2) Due to the U.S. export restrictions, SCO broke the crypt - stuff out into a separate library, libcrypt_i.a so the LIBS - needed be set to: - - LIBS=' -lsocket -lcrypt_i' - -UnixWare: There are known bugs in the math library of the system, as well as - problems in the handling of threads (calling fork in one - thread may interrupt system calls in others). Therefore, test_math and - tests involving threads will fail until those problems are fixed. - -QNX: Chris Herborth (chrish@qnx.com) writes: - configure works best if you use GNU bash; a port is available on - ftp.qnx.com in /usr/free. I used the following process to build, - test and install Python 1.5.x under QNX: - - 1) CONFIG_SHELL=/usr/local/bin/bash CC=cc RANLIB=: \ - ./configure --verbose --without-gcc --with-libm="" - - 2) edit Modules/Setup to activate everything that makes sense for - your system... tested here at QNX with the following modules: - - array, audioop, binascii, cPickle, cStringIO, cmath, - crypt, curses, errno, fcntl, gdbm, grp, imageop, - _locale, math, md5, new, operator, parser, pcre, - posix, pwd, readline, regex, reop, - select, signal, socket, soundex, strop, struct, - syslog, termios, time, timing, zlib, audioop, imageop - - 3) make SHELL=/usr/local/bin/bash - - or, if you feel the need for speed: - - make SHELL=/usr/local/bin/bash OPT="-5 -Oil+nrt" - - 4) make SHELL=/usr/local/bin/bash test - - Using GNU readline 2.2 seems to behave strangely, but I - think that's a problem with my readline 2.2 port. :-\ - - 5) make SHELL=/usr/local/bin/bash install - - If you get SIGSEGVs while running Python (I haven't yet, but - I've only run small programs and the test cases), you're - probably running out of stack; the default 32k could be a - little tight. To increase the stack size, edit the Makefile - to read: LDFLAGS = -N 48k - -BeOS: See Misc/BeOS-NOTES for notes about compiling/installing - Python on BeOS R3 or later. Note that only the PowerPC - platform is supported for R3; both PowerPC and x86 are - supported for R4. - -Cray T3E: Mark Hadfield (m.hadfield@niwa.co.nz) writes: - Python can be built satisfactorily on a Cray T3E but based on - my experience with the NIWA T3E (2002-05-22, version 2.2.1) - there are a few bugs and gotchas. For more information see a - thread on comp.lang.python in May 2002 entitled "Building - Python on Cray T3E". - - 1) Use Cray's cc and not gcc. The latter was reported not to - work by Konrad Hinsen. It may work now, but it may not. - - 2) To set sys.platform to something sensible, pass the - following environment variable to the configure script: - - MACHDEP=unicosmk - - 2) Run configure with option "--enable-unicode=ucs4". - - 3) The Cray T3E does not support dynamic linking, so extension - modules have to be built by adding (or uncommenting) lines - in Modules/Setup. The minimum set of modules is - - posix, new, _sre, unicodedata - - On NIWA's vanilla T3E system the following have also been - included successfully: - - _codecs, _locale, _socket, _symtable, _testcapi, _weakref - array, binascii, cmath, cPickle, crypt, cStringIO, dbm - errno, fcntl, grp, math, md5, operator, parser, pcre, pwd - regex, rotor, select, struct, strop, syslog, termios - time, timing, xreadlines - - 4) Once the python executable and library have been built, make - will execute setup.py, which will attempt to build remaining - extensions and link them dynamically. Each of these attempts - will fail but should not halt the make process. This is - normal. - - 5) Running "make test" uses a lot of resources and causes - problems on our system. You might want to try running tests - singly or in small groups. - -SGI: SGI's standard "make" utility (/bin/make or /usr/bin/make) - does not check whether a command actually changed the file it - is supposed to build. This means that whenever you say "make" - it will redo the link step. The remedy is to use SGI's much - smarter "smake" utility (/usr/sbin/smake), or GNU make. If - you set the first line of the Makefile to #!/usr/sbin/smake - smake will be invoked by make (likewise for GNU make). - - WARNING: There are bugs in the optimizer of some versions of - SGI's compilers that can cause bus errors or other strange - behavior, especially on numerical operations. To avoid this, - try building with "make OPT=". - -OS/2: If you are running Warp3 or Warp4 and have IBM's VisualAge C/C++ - compiler installed, just change into the pc\os2vacpp directory - and type NMAKE. Threading and sockets are supported by default - in the resulting binaries of PYTHON15.DLL and PYTHON.EXE. - -Reliant UNIX: The thread support does not compile on Reliant UNIX, and - there is a (minor) problem in the configure script for that - platform as well. This should be resolved in time for a - future release. - -MacOSX: The tests will crash on both 10.1 and 10.2 with SEGV in - test_re and test_sre due to the small default stack size. If - you set the stack size to 2048 before doing a "make test" the - failure can be avoided. If you're using the tcsh or csh shells, - use "limit stacksize 2048" and for the bash shell (the default - as of OSX 10.3), use "ulimit -s 2048". - - On naked Darwin you may want to add the configure option - "--disable-toolbox-glue" to disable the glue code for the Carbon - interface modules. The modules themselves are currently only built - if you add the --enable-framework option, see below. - - On a clean OSX /usr/local does not exist. Do a - "sudo mkdir -m 775 /usr/local" - before you do a make install. It is probably not a good idea to - do "sudo make install" which installs everything as superuser, - as this may later cause problems when installing distutils-based - additions. - - Some people have reported problems building Python after using "fink" - to install additional unix software. Disabling fink (remove all - references to /sw from your .profile or .login) should solve this. - - You may want to try the configure option "--enable-framework" - which installs Python as a framework. The location can be set - as argument to the --enable-framework option (default - /Library/Frameworks). A framework install is probably needed if you - want to use any Aqua-based GUI toolkit (whether Tkinter, wxPython, - Carbon, Cocoa or anything else). - - You may also want to try the configure option "--enable-universalsdk" - which builds Python as a universal binary with support for the - i386 and PPC architetures. This requires Xcode 2.1 or later to build. - - See Mac/README for more information on framework and - universal builds. - -Cygwin: With recent (relative to the time of writing, 2001-12-19) - Cygwin installations, there are problems with the interaction - of dynamic linking and fork(). This manifests itself in build - failures during the execution of setup.py. - - There are two workarounds that both enable Python (albeit - without threading support) to build and pass all tests on - NT/2000 (and most likely XP as well, though reports of testing - on XP would be appreciated). - - The workarounds: - - (a) the band-aid fix is to link the _socket module statically - rather than dynamically (which is the default). - - To do this, run "./configure --with-threads=no" including any - other options you need (--prefix, etc.). Then in Modules/Setup - uncomment the lines: - - #SSL=/usr/local/ssl - #_socket socketmodule.c \ - # -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ - # -L$(SSL)/lib -lssl -lcrypto - - and remove "local/" from the SSL variable. Finally, just run - "make"! - - (b) The "proper" fix is to rebase the Cygwin DLLs to prevent - base address conflicts. Details on how to do this can be - found in the following mail: - - http://sources.redhat.com/ml/cygwin/2001-12/msg00894.html - - It is hoped that a version of this solution will be - incorporated into the Cygwin distribution fairly soon. - - Two additional problems: - - (1) Threading support should still be disabled due to a known - bug in Cygwin pthreads that causes test_threadedtempfile to - hang. - - (2) The _curses module does not build. This is a known - Cygwin ncurses problem that should be resolved the next time - that this package is released. - - On older versions of Cygwin, test_poll may hang and test_strftime - may fail. - - The situation on 9X/Me is not accurately known at present. - Some time ago, there were reports that the following - regression tests failed: - - test_pwd - test_select (hang) - test_socket - - Due to the test_select hang on 9X/Me, one should run the - regression test using the following: - - make TESTOPTS='-l -x test_select' test - - News regarding these platforms with more recent Cygwin - versions would be appreciated! - -Windows: When executing Python scripts on the command line using file type - associations (i.e. starting "script.py" instead of "python script.py"), - redirects may not work unless you set a specific registry key. See - the Knowledge Base article . - - -Configuring the bsddb and dbm modules -------------------------------------- - -Beginning with Python version 2.3, the PyBsddb package - was adopted into Python as the bsddb package, -exposing a set of package-level functions which provide -backwards-compatible behavior. Only versions 3.3 through 4.4 of -Sleepycat's libraries provide the necessary API, so older versions -aren't supported through this interface. The old bsddb module has -been retained as bsddb185, though it is not built by default. Users -wishing to use it will have to tweak Modules/Setup to build it. The -dbm module will still be built against the Sleepycat libraries if -other preferred alternatives (ndbm, gdbm) are not found. - -Building the sqlite3 module ---------------------------- - -To build the sqlite3 module, you'll need the sqlite3 or libsqlite3 -packages installed, including the header files. Many modern operating -systems distribute the headers in a separate package to the library - -often it will be the same name as the main package, but with a -dev or --devel suffix. - -The version of pysqlite2 that's including in Python needs sqlite3 3.0.8 -or later. setup.py attempts to check that it can find a correct version. - -Configuring threads -------------------- - -As of Python 2.0, threads are enabled by default. If you wish to -compile without threads, or if your thread support is broken, pass the ---with-threads=no switch to configure. Unfortunately, on some -platforms, additional compiler and/or linker options are required for -threads to work properly. Below is a table of those options, -collected by Bill Janssen. We would love to automate this process -more, but the information below is not enough to write a patch for the -configure.ac file, so manual intervention is required. If you patch -the configure.ac file and are confident that the patch works, please -send in the patch. (Don't bother patching the configure script itself --- it is regenerated each time the configure.ac file changes.) - -Compiler switches for threads -............................. - -The definition of _REENTRANT should be configured automatically, if -that does not work on your system, or if _REENTRANT is defined -incorrectly, please report that as a bug. - - OS/Compiler/threads Switches for use with threads - (POSIX is draft 10, DCE is draft 4) compile & link - - SunOS 5.{1-5}/{gcc,SunPro cc}/solaris -mt - SunOS 5.5/{gcc,SunPro cc}/POSIX (nothing) - DEC OSF/1 3.x/cc/DCE -threads - (butenhof@zko.dec.com) - Digital UNIX 4.x/cc/DCE -threads - (butenhof@zko.dec.com) - Digital UNIX 4.x/cc/POSIX -pthread - (butenhof@zko.dec.com) - AIX 4.1.4/cc_r/d7 (nothing) - (buhrt@iquest.net) - AIX 4.1.4/cc_r4/DCE (nothing) - (buhrt@iquest.net) - IRIX 6.2/cc/POSIX (nothing) - (robertl@cwi.nl) - - -Linker (ld) libraries and flags for threads -........................................... - - OS/threads Libraries/switches for use with threads - - SunOS 5.{1-5}/solaris -lthread - SunOS 5.5/POSIX -lpthread - DEC OSF/1 3.x/DCE -lpthreads -lmach -lc_r -lc - (butenhof@zko.dec.com) - Digital UNIX 4.x/DCE -lpthreads -lpthread -lmach -lexc -lc - (butenhof@zko.dec.com) - Digital UNIX 4.x/POSIX -lpthread -lmach -lexc -lc - (butenhof@zko.dec.com) - AIX 4.1.4/{draft7,DCE} (nothing) - (buhrt@iquest.net) - IRIX 6.2/POSIX -lpthread - (jph@emilia.engr.sgi.com) - - -Building a shared libpython ---------------------------- - -Starting with Python 2.3, the majority of the interpreter can be built -into a shared library, which can then be used by the interpreter -executable, and by applications embedding Python. To enable this feature, -configure with --enable-shared. - -If you enable this feature, the same object files will be used to create -a static library. In particular, the static library will contain object -files using position-independent code (PIC) on platforms where PIC flags -are needed for the shared library. - - -Configuring additional built-in modules ---------------------------------------- - -Starting with Python 2.1, the setup.py script at the top of the source -distribution attempts to detect which modules can be built and -automatically compiles them. Autodetection doesn't always work, so -you can still customize the configuration by editing the Modules/Setup -file; but this should be considered a last resort. The rest of this -section only applies if you decide to edit the Modules/Setup file. -You also need this to enable static linking of certain modules (which -is needed to enable profiling on some systems). - -This file is initially copied from Setup.dist by the configure script; -if it does not exist yet, create it by copying Modules/Setup.dist -yourself (configure will never overwrite it). Never edit Setup.dist --- always edit Setup or Setup.local (see below). Read the comments in -the file for information on what kind of edits are allowed. When you -have edited Setup in the Modules directory, the interpreter will -automatically be rebuilt the next time you run make (in the toplevel -directory). - -Many useful modules can be built on any Unix system, but some optional -modules can't be reliably autodetected. Often the quickest way to -determine whether a particular module works or not is to see if it -will build: enable it in Setup, then if you get compilation or link -errors, disable it -- you're either missing support or need to adjust -the compilation and linking parameters for that module. - -On SGI IRIX, there are modules that interface to many SGI specific -system libraries, e.g. the GL library and the audio hardware. These -modules will not be built by the setup.py script. - -In addition to the file Setup, you can also edit the file Setup.local. -(the makesetup script processes both). You may find it more -convenient to edit Setup.local and leave Setup alone. Then, when -installing a new Python version, you can copy your old Setup.local -file. - - -Setting the optimization/debugging options ------------------------------------------- - -If you want or need to change the optimization/debugging options for -the C compiler, assign to the OPT variable on the toplevel make -command; e.g. "make OPT=-g" will build a debugging version of Python -on most platforms. The default is OPT=-O; a value for OPT in the -environment when the configure script is run overrides this default -(likewise for CC; and the initial value for LIBS is used as the base -set of libraries to link with). - -When compiling with GCC, the default value of OPT will also include -the -Wall and -Wstrict-prototypes options. - -Additional debugging code to help debug memory management problems can -be enabled by using the --with-pydebug option to the configure script. - -For flags that change binary compatibility, use the EXTRA_CFLAGS -variable. - - -Profiling ---------- - -If you want C profiling turned on, the easiest way is to run configure -with the CC environment variable to the necessary compiler -invocation. For example, on Linux, this works for profiling using -gprof(1): - - CC="gcc -pg" ./configure - -Note that on Linux, gprof apparently does not work for shared -libraries. The Makefile/Setup mechanism can be used to compile and -link most extension modules statically. - - -Coverage checking ------------------ - -For C coverage checking using gcov, run "make coverage". This will -build a Python binary with profiling activated, and a ".gcno" and -".gcda" file for every source file compiled with that option. With -the built binary, now run the code whose coverage you want to check. -Then, you can see coverage statistics for each individual source file -by running gcov, e.g. - - gcov -o Modules zlibmodule - -This will create a "zlibmodule.c.gcov" file in the current directory -containing coverage info for that source file. - -This works only for source files statically compiled into the -executable; use the Makefile/Setup mechanism to compile and link -extension modules you want to coverage-check statically. - - -Testing -------- - -To test the interpreter, type "make test" in the top-level directory. -This runs the test set twice (once with no compiled files, once with -the compiled files left by the previous test run). The test set -produces some output. You can generally ignore the messages about -skipped tests due to optional features which can't be imported. -If a message is printed about a failed test or a traceback or core -dump is produced, something is wrong. On some Linux systems (those -that are not yet using glibc 6), test_strftime fails due to a -non-standard implementation of strftime() in the C library. Please -ignore this, or upgrade to glibc version 6. - -By default, tests are prevented from overusing resources like disk space and -memory. To enable these tests, run "make testall". - -IMPORTANT: If the tests fail and you decide to mail a bug report, -*don't* include the output of "make test". It is useless. Run the -failing test manually, as follows: - - ./python Lib/test/regrtest.py -v test_whatever - -(substituting the top of the source tree for '.' if you built in a -different directory). This runs the test in verbose mode. - - -Installing ----------- - -To install the Python binary, library modules, shared library modules -(see below), include files, configuration files, and the manual page, -just type - - make install - -This will install all platform-independent files in subdirectories of -the directory given with the --prefix option to configure or to the -`prefix' Make variable (default /usr/local). All binary and other -platform-specific files will be installed in subdirectories if the -directory given by --exec-prefix or the `exec_prefix' Make variable -(defaults to the --prefix directory) is given. - -If DESTDIR is set, it will be taken as the root directory of the -installation, and files will be installed into $(DESTDIR)$(prefix), -$(DESTDIR)$(exec_prefix), etc. - -All subdirectories created will have Python's version number in their -name, e.g. the library modules are installed in -"/usr/local/lib/python/" by default, where is the -. release number (e.g. "2.1"). The Python binary is -installed as "python" and a hard link named "python" is -created. The only file not installed with a version number in its -name is the manual page, installed as "/usr/local/man/man1/python.1" -by default. - -If you want to install multiple versions of Python see the section below -entitled "Installing multiple versions". - -The only thing you may have to install manually is the Python mode for -Emacs found in Misc/python-mode.el. (But then again, more recent -versions of Emacs may already have it.) Follow the instructions that -came with Emacs for installation of site-specific files. - -On Mac OS X, if you have configured Python with --enable-framework, you -should use "make frameworkinstall" to do the installation. Note that this -installs the Python executable in a place that is not normally on your -PATH, you may want to set up a symlink in /usr/local/bin. - - -Installing multiple versions ----------------------------- - -On Unix and Mac systems if you intend to install multiple versions of Python -using the same installation prefix (--prefix argument to the configure -script) you must take care that your primary python executable is not -overwritten by the installation of a different version. All files and -directories installed using "make altinstall" contain the major and minor -version and can thus live side-by-side. "make install" also creates -${prefix}/bin/python which refers to ${prefix}/bin/pythonX.Y. If you intend -to install multiple versions using the same prefix you must decide which -version (if any) is your "primary" version. Install that version using -"make install". Install all other versions using "make altinstall". - -For example, if you want to install Python 2.5, 2.6 and 3.0 with 2.6 being -the primary version, you would execute "make install" in your 2.6 build -directory and "make altinstall" in the others. - - -Configuration options and variables ------------------------------------ - -Some special cases are handled by passing options to the configure -script. - -WARNING: if you rerun the configure script with different options, you -must run "make clean" before rebuilding. Exceptions to this rule: -after changing --prefix or --exec-prefix, all you need to do is remove -Modules/getpath.o. - ---with(out)-gcc: The configure script uses gcc (the GNU C compiler) if - it finds it. If you don't want this, or if this compiler is - installed but broken on your platform, pass the option - --without-gcc. You can also pass "CC=cc" (or whatever the - name of the proper C compiler is) in the environment, but the - advantage of using --without-gcc is that this option is - remembered by the config.status script for its --recheck - option. - ---prefix, --exec-prefix: If you want to install the binaries and the - Python library somewhere else than in /usr/local/{bin,lib}, - you can pass the option --prefix=DIRECTORY; the interpreter - binary will be installed as DIRECTORY/bin/python and the - library files as DIRECTORY/lib/python/*. If you pass - --exec-prefix=DIRECTORY (as well) this overrides the - installation prefix for architecture-dependent files (like the - interpreter binary). Note that --prefix=DIRECTORY also - affects the default module search path (sys.path), when - Modules/config.c is compiled. Passing make the option - prefix=DIRECTORY (and/or exec_prefix=DIRECTORY) overrides the - prefix set at configuration time; this may be more convenient - than re-running the configure script if you change your mind - about the install prefix. - ---with-readline: This option is no longer supported. GNU - readline is automatically enabled by setup.py when present. - ---with-threads: On most Unix systems, you can now use multiple - threads, and support for this is enabled by default. To - disable this, pass --with-threads=no. If the library required - for threads lives in a peculiar place, you can use - --with-thread=DIRECTORY. IMPORTANT: run "make clean" after - changing (either enabling or disabling) this option, or you - will get link errors! Note: for DEC Unix use - --with-dec-threads instead. - ---with-sgi-dl: On SGI IRIX 4, dynamic loading of extension modules is - supported by the "dl" library by Jack Jansen, which is - ftp'able from ftp://ftp.cwi.nl/pub/dynload/dl-1.6.tar.Z. - This is enabled (after you've ftp'ed and compiled the dl - library) by passing --with-sgi-dl=DIRECTORY where DIRECTORY - is the absolute pathname of the dl library. (Don't bother on - IRIX 5, it already has dynamic linking using SunOS style - shared libraries.) THIS OPTION IS UNSUPPORTED. - ---with-dl-dld: Dynamic loading of modules is rumored to be supported - on some other systems: VAX (Ultrix), Sun3 (SunOS 3.4), Sequent - Symmetry (Dynix), and Atari ST. This is done using a - combination of the GNU dynamic loading package - (ftp://ftp.cwi.nl/pub/dynload/dl-dld-1.1.tar.Z) and an - emulation of the SGI dl library mentioned above (the emulation - can be found at - ftp://ftp.cwi.nl/pub/dynload/dld-3.2.3.tar.Z). To - enable this, ftp and compile both libraries, then call - configure, passing it the option - --with-dl-dld=DL_DIRECTORY,DLD_DIRECTORY where DL_DIRECTORY is - the absolute pathname of the dl emulation library and - DLD_DIRECTORY is the absolute pathname of the GNU dld library. - (Don't bother on SunOS 4 or 5, they already have dynamic - linking using shared libraries.) THIS OPTION IS UNSUPPORTED. - ---with-libm, --with-libc: It is possible to specify alternative - versions for the Math library (default -lm) and the C library - (default the empty string) using the options - --with-libm=STRING and --with-libc=STRING, respectively. For - example, if your system requires that you pass -lc_s to the C - compiler to use the shared C library, you can pass - --with-libc=-lc_s. These libraries are passed after all other - libraries, the C library last. - ---with-libs='libs': Add 'libs' to the LIBS that the python interpreter - is linked against. - ---with-cxx-main=: If you plan to use C++ extension modules, - then -- on some platforms -- you need to compile python's main() - function with the C++ compiler. With this option, make will use - to compile main() *and* to link the python executable. - It is likely that the resulting executable depends on the C++ - runtime library of . (The default is --without-cxx-main.) - - There are platforms that do not require you to build Python - with a C++ compiler in order to use C++ extension modules. - E.g., x86 Linux with ELF shared binaries and GCC 3.x, 4.x is such - a platform. We recommend that you configure Python - --without-cxx-main on those platforms because a mismatch - between the C++ compiler version used to build Python and to - build a C++ extension module is likely to cause a crash at - runtime. - - The Python installation also stores the variable CXX that - determines, e.g., the C++ compiler distutils calls by default - to build C++ extensions. If you set CXX on the configure command - line to any string of non-zero length, then configure won't - change CXX. If you do not preset CXX but pass - --with-cxx-main=, then configure sets CXX=. - In all other cases, configure looks for a C++ compiler by - some common names (c++, g++, gcc, CC, cxx, cc++, cl) and sets - CXX to the first compiler it finds. If it does not find any - C++ compiler, then it sets CXX="". - - Similarly, if you want to change the command used to link the - python executable, then set LINKCC on the configure command line. - - ---with-pydebug: Enable additional debugging code to help track down - memory management problems. This allows printing a list of all - live objects when the interpreter terminates. - ---with(out)-universal-newlines: enable reading of text files with - foreign newline convention (default: enabled). In other words, - any of \r, \n or \r\n is acceptable as end-of-line character. - If enabled import and execfile will automatically accept any newline - in files. Python code can open a file with open(file, 'U') to - read it in universal newline mode. THIS OPTION IS UNSUPPORTED. - ---with-tsc: Profile using the Pentium timestamping counter (TSC). - ---with-system-ffi: Build the _ctypes extension module using an ffi - library installed on the system. - ---with-dbmliborder=db1:db2:...: Specify the order that backends for the - dbm extension are checked. Valid value is a colon separated string - with the backend names `ndbm', `gdbm' and `bdb'. - -Building for multiple architectures (using the VPATH feature) -------------------------------------------------------------- - -If your file system is shared between multiple architectures, it -usually is not necessary to make copies of the sources for each -architecture you want to support. If the make program supports the -VPATH feature, you can create an empty build directory for each -architecture, and in each directory run the configure script (on the -appropriate machine with the appropriate options). This creates the -necessary subdirectories and the Makefiles therein. The Makefiles -contain a line VPATH=... which points to a directory containing the -actual sources. (On SGI systems, use "smake -J1" instead of "make" if -you use VPATH -- don't try gnumake.) - -For example, the following is all you need to build a minimal Python -in /usr/tmp/python (assuming ~guido/src/python is the toplevel -directory and you want to build in /usr/tmp/python): - - $ mkdir /usr/tmp/python - $ cd /usr/tmp/python - $ ~guido/src/python/configure - [...] - $ make - [...] - $ - -Note that configure copies the original Setup file to the build -directory if it finds no Setup file there. This means that you can -edit the Setup file for each architecture independently. For this -reason, subsequent changes to the original Setup file are not tracked -automatically, as they might overwrite local changes. To force a copy -of a changed original Setup file, delete the target Setup file. (The -makesetup script supports multiple input files, so if you want to be -fancy you can change the rules to create an empty Setup.local if it -doesn't exist and run it with arguments $(srcdir)/Setup Setup.local; -however this assumes that you only need to add modules.) - -Also note that you can't use a workspace for VPATH and non VPATH builds. The -object files left behind by one version confuses the other. - - -Building on non-UNIX systems ----------------------------- - -For Windows (2000/NT/ME/98/95), assuming you have MS VC++ 7.1, the -project files are in PCbuild, the workspace is pcbuild.dsw. See -PCbuild\readme.txt for detailed instructions. - -For other non-Unix Windows compilers, in particular MS VC++ 6.0 and -for OS/2, enter the directory "PC" and read the file "readme.txt". - -For the Mac, a separate source distribution will be made available, -for use with the CodeWarrior compiler. If you are interested in Mac -development, join the PythonMac Special Interest Group -(http://www.python.org/sigs/pythonmac-sig/, or send email to -pythonmac-sig-request@python.org). - -Of course, there are also binary distributions available for these -platforms -- see http://www.python.org/. - -To port Python to a new non-UNIX system, you will have to fake the -effect of running the configure script manually (for Mac and PC, this -has already been done for you). A good start is to copy the file -pyconfig.h.in to pyconfig.h and edit the latter to reflect the actual -configuration of your system. Most symbols must simply be defined as -1 only if the corresponding feature is present and can be left alone -otherwise; however the *_t type symbols must be defined as some -variant of int if they need to be defined at all. - -For all platforms, it's important that the build arrange to define the -preprocessor symbol NDEBUG on the compiler command line in a release -build of Python (else assert() calls remain in the code, hurting -release-build performance). The Unix, Windows and Mac builds already -do this. - - -Miscellaneous issues -==================== - -Emacs mode ----------- - -There's an excellent Emacs editing mode for Python code; see the file -Misc/python-mode.el. Originally written by the famous Tim Peters, it is now -maintained by the equally famous Barry Warsaw. The latest version, along with -various other contributed Python-related Emacs goodies, is online at -http://launchpad.net/python-mode/. - - -Tkinter -------- - -The setup.py script automatically configures this when it detects a -usable Tcl/Tk installation. This requires Tcl/Tk version 8.0 or -higher. - -For more Tkinter information, see the Tkinter Resource page: -http://www.python.org/topics/tkinter/ - -There are demos in the Demo/tkinter directory. - -Note that there's a Python module called "Tkinter" (capital T) which -lives in Lib/lib-tk/Tkinter.py, and a C module called "_tkinter" -(lower case t and leading underscore) which lives in -Modules/_tkinter.c. Demos and normal Tk applications import only the -Python Tkinter module -- only the latter imports the C _tkinter -module. In order to find the C _tkinter module, it must be compiled -and linked into the Python interpreter -- the setup.py script does -this. In order to find the Python Tkinter module, sys.path must be -set correctly -- normal installation takes care of this. - - -Distribution structure ----------------------- - -Most subdirectories have their own README files. Most files have -comments. - -Demo/ Demonstration scripts, modules and programs -Doc/ Documentation sources (reStructuredText) -Grammar/ Input for the parser generator -Include/ Public header files -LICENSE Licensing information -Lib/ Python library modules -Mac/ Macintosh specific resources -Makefile.pre.in Source from which config.status creates the Makefile.pre -Misc/ Miscellaneous useful files -Modules/ Implementation of most built-in modules -Objects/ Implementation of most built-in object types -PC/ Files specific to PC ports (DOS, Windows, OS/2) -PCbuild/ Build directory for Microsoft Visual C++ -Parser/ The parser and tokenizer and their input handling -Python/ The byte-compiler and interpreter -README The file you're reading now -RISCOS/ Files specific to RISC OS port -Tools/ Some useful programs written in Python -pyconfig.h.in Source from which pyconfig.h is created (GNU autoheader output) -configure Configuration shell script (GNU autoconf output) -configure.ac Configuration specification (input for GNU autoconf) -install-sh Shell script used to install files -setup.py Python script used to build extension modules - -The following files will (may) be created in the toplevel directory by -the configuration and build processes: - -Makefile Build rules -Makefile.pre Build rules before running Modules/makesetup -buildno Keeps track of the build number -config.cache Cache of configuration variables -pyconfig.h Configuration header -config.log Log from last configure run -config.status Status from last run of the configure script -getbuildinfo.o Object file from Modules/getbuildinfo.c -libpython.a The library archive -python The executable interpreter -reflog.txt Output from running the regression suite with the -R flag -tags, TAGS Tags files for vi and Emacs - - -That's all, folks! ------------------- - - ---Guido van Rossum (home page: http://www.python.org/~guido/) diff --git a/AppPkg/Applications/Python/Python-2.7.10/X64/pyconfig.h b/AppPkg/Applications/Python/Python-2.7.10/X64/pyconfig.h deleted file mode 100644 index f07db09..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/X64/pyconfig.h +++ /dev/null @@ -1,1305 +0,0 @@ -/** @file - Manually generated Python Configuration file for EDK II. - - Copyright (c) 2015, Daryl McDaniel. All rights reserved.
- Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
- This program and the accompanying materials are licensed and made available under - the terms and conditions of the BSD License that accompanies this distribution. - The full text of the license may be found at - http://opensource.org/licenses/bsd-license. - - THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. -**/ -#ifndef Py_PYCONFIG_H -#define Py_PYCONFIG_H - -#include - -#define PLATFORM "uefi" - -/* Define if building universal (internal helper macro) */ -#undef AC_APPLE_UNIVERSAL_BUILD - -/* Define for AIX if your compiler is a genuine IBM xlC/xlC_r and you want - support for AIX C++ shared extension modules. */ -#undef AIX_GENUINE_CPLUSPLUS - -/* Define this if you have AtheOS threads. */ -#undef ATHEOS_THREADS - -/* Define this if you have BeOS threads. */ -#undef BEOS_THREADS - -/* Define if you have the Mach cthreads package */ -#undef C_THREADS - -/* Define if C doubles are 64-bit IEEE 754 binary format, stored in ARM - mixed-endian order (byte order 45670123) */ -#undef DOUBLE_IS_ARM_MIXED_ENDIAN_IEEE754 - -/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the most - significant byte first */ -#undef DOUBLE_IS_BIG_ENDIAN_IEEE754 - -/* Define if C doubles are 64-bit IEEE 754 binary format, stored with the - least significant byte first */ -#define DOUBLE_IS_LITTLE_ENDIAN_IEEE754 - -/* Define if --enable-ipv6 is specified */ -#undef ENABLE_IPV6 - -/* Define if flock needs to be linked with bsd library. */ -#undef FLOCK_NEEDS_LIBBSD - -/* Define if getpgrp() must be called as getpgrp(0). */ -#undef GETPGRP_HAVE_ARG - -/* Define if gettimeofday() does not have second (timezone) argument This is - the case on Motorola V4 (R40V4.2) */ -#undef GETTIMEOFDAY_NO_TZ - -/* Define to 1 if you have the 'acosh' function. */ -#undef HAVE_ACOSH - -/* struct addrinfo (netdb.h) */ -#undef HAVE_ADDRINFO - -/* Define to 1 if you have the 'alarm' function. */ -#undef HAVE_ALARM - -/* Define to 1 if you have the header file. */ -#undef HAVE_ALLOCA_H - -/* Define this if your time.h defines altzone. */ -#undef HAVE_ALTZONE - -/* Define to 1 if you have the 'asinh' function. */ -#undef HAVE_ASINH - -/* Define to 1 if you have the header file. */ -#undef HAVE_ASM_TYPES_H - -/* Define to 1 if you have the 'atanh' function. */ -#undef HAVE_ATANH - -/* Define if GCC supports __attribute__((format(PyArg_ParseTuple, 2, 3))) */ -#undef HAVE_ATTRIBUTE_FORMAT_PARSETUPLE - -/* Define to 1 if you have the 'bind_textdomain_codeset' function. */ -#undef HAVE_BIND_TEXTDOMAIN_CODESET - -/* Define to 1 if you have the header file. */ -#undef HAVE_BLUETOOTH_BLUETOOTH_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_BLUETOOTH_H - -/* Define if nice() returns success/failure instead of the new priority. */ -#undef HAVE_BROKEN_NICE - -/* Define if the system reports an invalid PIPE_BUF value. */ -#undef HAVE_BROKEN_PIPE_BUF - -/* Define if poll() sets errno on invalid file descriptors. */ -#undef HAVE_BROKEN_POLL - -/* Define if the Posix semaphores do not work on your system */ -#define HAVE_BROKEN_POSIX_SEMAPHORES 1 - -/* Define if pthread_sigmask() does not work on your system. */ -#define HAVE_BROKEN_PTHREAD_SIGMASK 1 - -/* define to 1 if your sem_getvalue is broken. */ -#define HAVE_BROKEN_SEM_GETVALUE 1 - -/* Define if 'unsetenv' does not return an int. */ -#undef HAVE_BROKEN_UNSETENV - -/* Define this if you have the type _Bool. */ -#define HAVE_C99_BOOL 1 - -/* Define to 1 if you have the 'chflags' function. */ -#undef HAVE_CHFLAGS - -/* Define to 1 if you have the 'chown' function. */ -#undef HAVE_CHOWN - -/* Define if you have the 'chroot' function. */ -#undef HAVE_CHROOT - -/* Define to 1 if you have the 'clock' function. */ -#define HAVE_CLOCK 1 - -/* Define to 1 if you have the 'confstr' function. */ -#undef HAVE_CONFSTR - -/* Define to 1 if you have the header file. */ -#undef HAVE_CONIO_H - -/* Define to 1 if you have the 'copysign' function. */ -#define HAVE_COPYSIGN 1 - -/* Define to 1 if you have the 'ctermid' function. */ -#undef HAVE_CTERMID - -/* Define if you have the 'ctermid_r' function. */ -#undef HAVE_CTERMID_R - -/* Define to 1 if you have the header file. */ -#undef HAVE_CURSES_H - -/* Define if you have the 'is_term_resized' function. */ -#undef HAVE_CURSES_IS_TERM_RESIZED - -/* Define if you have the 'resizeterm' function. */ -#undef HAVE_CURSES_RESIZETERM - -/* Define if you have the 'resize_term' function. */ -#undef HAVE_CURSES_RESIZE_TERM - -/* Define to 1 if you have the declaration of 'isfinite', and to 0 if you - don't. */ -#define HAVE_DECL_ISFINITE 0 - -/* Define to 1 if you have the declaration of 'isinf', and to 0 if you don't. - */ -#define HAVE_DECL_ISINF 1 - -/* Define to 1 if you have the declaration of 'isnan', and to 0 if you don't. - */ -#define HAVE_DECL_ISNAN 1 - -/* Define to 1 if you have the declaration of 'tzname', and to 0 if you don't. - */ -#define HAVE_DECL_TZNAME 0 - -/* Define to 1 if you have the device macros. */ -#undef HAVE_DEVICE_MACROS - -/* Define to 1 if you have the /dev/ptc device file. */ -#undef HAVE_DEV_PTC - -/* Define to 1 if you have the /dev/ptmx device file. */ -#undef HAVE_DEV_PTMX - -/* Define to 1 if you have the header file. */ -#undef HAVE_DIRECT_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. */ -#define HAVE_DIRENT_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the 'dlopen' function. */ -#undef HAVE_DLOPEN - -/* Define to 1 if you have the 'dup2' function. */ -#define HAVE_DUP2 1 - -/* Defined when any dynamic module loading is enabled. */ -#undef HAVE_DYNAMIC_LOADING - -/* Define if you have the 'epoll' functions. */ -#undef HAVE_EPOLL - -/* Define to 1 if you have the 'erf' function. */ -#undef HAVE_ERF - -/* Define to 1 if you have the 'erfc' function. */ -#undef HAVE_ERFC - -/* Define to 1 if you have the header file. */ -#define HAVE_ERRNO_H 1 - -/* Define to 1 if you have the 'execv' function. */ -#undef HAVE_EXECV - -/* Define to 1 if you have the 'expm1' function. */ -#undef HAVE_EXPM1 - -/* Define if you have the 'fchdir' function. */ -#undef HAVE_FCHDIR - -/* Define to 1 if you have the 'fchmod' function. */ -#undef HAVE_FCHMOD - -/* Define to 1 if you have the 'fchown' function. */ -#undef HAVE_FCHOWN - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the 'fdatasync' function. */ -#undef HAVE_FDATASYNC - -/* Define to 1 if you have the 'finite' function. */ -#define HAVE_FINITE 1 - -/* Define to 1 if you have the 'flock' function. */ -#undef HAVE_FLOCK - -/* Define to 1 if you have the 'fork' function. */ -#undef HAVE_FORK - -/* Define to 1 if you have the 'forkpty' function. */ -#undef HAVE_FORKPTY - -/* Define to 1 if you have the 'fpathconf' function. */ -#undef HAVE_FPATHCONF - -/* Define to 1 if you have the 'fseek64' function. */ -#undef HAVE_FSEEK64 - -/* Define to 1 if you have the 'fseeko' function. */ -#define HAVE_FSEEKO 1 - -/* Define to 1 if you have the 'fstatvfs' function. */ -#undef HAVE_FSTATVFS - -/* Define if you have the 'fsync' function. */ -#undef HAVE_FSYNC - -/* Define to 1 if you have the 'ftell64' function. */ -#undef HAVE_FTELL64 - -/* Define to 1 if you have the 'ftello' function. */ -#define HAVE_FTELLO 1 - -/* Define to 1 if you have the 'ftime' function. */ -#undef HAVE_FTIME - -/* Define to 1 if you have the 'ftruncate' function. */ -#undef HAVE_FTRUNCATE - -/* Define to 1 if you have the 'gai_strerror' function. */ -#undef HAVE_GAI_STRERROR - -/* Define to 1 if you have the 'gamma' function. */ -#undef HAVE_GAMMA - -/* Define if we can use gcc inline assembler to get and set x87 control word */ -#if defined(__GNUC__) - #define HAVE_GCC_ASM_FOR_X87 1 -#else - #undef HAVE_GCC_ASM_FOR_X87 -#endif - -/* Define if you have the getaddrinfo function. */ -//#undef HAVE_GETADDRINFO -#define HAVE_GETADDRINFO 1 - -/* Define to 1 if you have the 'getcwd' function. */ -#define HAVE_GETCWD 1 - -/* Define this if you have flockfile(), getc_unlocked(), and funlockfile() */ -#undef HAVE_GETC_UNLOCKED - -/* Define to 1 if you have the 'getentropy' function. */ -#undef HAVE_GETENTROPY - -/* Define to 1 if you have the 'getgroups' function. */ -#undef HAVE_GETGROUPS - -/* Define to 1 if you have the 'gethostbyname' function. */ -//#undef HAVE_GETHOSTBYNAME -#define HAVE_GETHOSTBYNAME 1 - -/* Define this if you have some version of gethostbyname_r() */ -#undef HAVE_GETHOSTBYNAME_R - -/* Define this if you have the 3-arg version of gethostbyname_r(). */ -#undef HAVE_GETHOSTBYNAME_R_3_ARG - -/* Define this if you have the 5-arg version of gethostbyname_r(). */ -#undef HAVE_GETHOSTBYNAME_R_5_ARG - -/* Define this if you have the 6-arg version of gethostbyname_r(). */ -#undef HAVE_GETHOSTBYNAME_R_6_ARG - -/* Define to 1 if you have the 'getitimer' function. */ -#undef HAVE_GETITIMER - -/* Define to 1 if you have the 'getloadavg' function. */ -#undef HAVE_GETLOADAVG - -/* Define to 1 if you have the 'getlogin' function. */ -#undef HAVE_GETLOGIN - -/* Define to 1 if you have the 'getnameinfo' function. */ -//#undef HAVE_GETNAMEINFO -#define HAVE_GETNAMEINFO 1 - -/* Define if you have the 'getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the 'getpeername' function. */ -#define HAVE_GETPEERNAME 1 - -/* Define to 1 if you have the 'getpgid' function. */ -#undef HAVE_GETPGID - -/* Define to 1 if you have the 'getpgrp' function. */ -#undef HAVE_GETPGRP - -/* Define to 1 if you have the 'getpid' function. */ -#undef HAVE_GETPID - -/* Define to 1 if you have the 'getpriority' function. */ -#undef HAVE_GETPRIORITY - -/* Define to 1 if you have the 'getpwent' function. */ -#undef HAVE_GETPWENT - -/* Define to 1 if you have the 'getresgid' function. */ -#undef HAVE_GETRESGID - -/* Define to 1 if you have the 'getresuid' function. */ -#undef HAVE_GETRESUID - -/* Define to 1 if you have the 'getsid' function. */ -#undef HAVE_GETSID - -/* Define to 1 if you have the 'getspent' function. */ -#undef HAVE_GETSPENT - -/* Define to 1 if you have the 'getspnam' function. */ -#undef HAVE_GETSPNAM - -/* Define to 1 if you have the 'gettimeofday' function. */ -#undef HAVE_GETTIMEOFDAY - -/* Define to 1 if you have the 'getwd' function. */ -#undef HAVE_GETWD - -/* Define to 1 if you have the header file. */ -#undef HAVE_GRP_H - -/* Define if you have the 'hstrerror' function. */ -#undef HAVE_HSTRERROR - -/* Define to 1 if you have the 'hypot' function. */ -#undef HAVE_HYPOT - -/* Define to 1 if you have the header file. */ -#undef HAVE_IEEEFP_H - -/* Define if you have the 'inet_aton' function. */ -#define HAVE_INET_ATON 1 - -/* Define if you have the 'inet_pton' function. */ -#define HAVE_INET_PTON 1 - -/* Define to 1 if you have the 'initgroups' function. */ -#undef HAVE_INITGROUPS - -/* Define if your compiler provides int32_t. */ -#undef HAVE_INT32_T - -/* Define if your compiler provides int64_t. */ -#undef HAVE_INT64_T - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_IO_H - -/* Define to 1 if you have the 'kill' function. */ -#undef HAVE_KILL - -/* Define to 1 if you have the 'killpg' function. */ -#undef HAVE_KILLPG - -/* Define if you have the 'kqueue' functions. */ -#undef HAVE_KQUEUE - -/* Define to 1 if you have the header file. */ -#undef HAVE_LANGINFO_H /* non-functional in EFI. */ - -/* Defined to enable large file support when an off_t is bigger than a long - and long long is available and at least as big as an off_t. You may need to - add some flags for configuration and compilation to enable this mode. (For - Solaris and Linux, the necessary defines are already defined.) */ -#undef HAVE_LARGEFILE_SUPPORT - -/* Define to 1 if you have the 'lchflags' function. */ -#undef HAVE_LCHFLAGS - -/* Define to 1 if you have the 'lchmod' function. */ -#undef HAVE_LCHMOD - -/* Define to 1 if you have the 'lchown' function. */ -#undef HAVE_LCHOWN - -/* Define to 1 if you have the 'lgamma' function. */ -#undef HAVE_LGAMMA - -/* Define to 1 if you have the 'dl' library (-ldl). */ -#undef HAVE_LIBDL - -/* Define to 1 if you have the 'dld' library (-ldld). */ -#undef HAVE_LIBDLD - -/* Define to 1 if you have the 'ieee' library (-lieee). */ -#undef HAVE_LIBIEEE - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBINTL_H - -/* Define if you have the readline library (-lreadline). */ -#undef HAVE_LIBREADLINE - -/* Define to 1 if you have the 'resolv' library (-lresolv). */ -#undef HAVE_LIBRESOLV - -/* Define to 1 if you have the header file. */ -#undef HAVE_LIBUTIL_H - -/* Define if you have the 'link' function. */ -#undef HAVE_LINK - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_NETLINK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_LINUX_TIPC_H - -/* Define to 1 if you have the 'log1p' function. */ -#undef HAVE_LOG1P - -/* Define this if you have the type long double. */ -#undef HAVE_LONG_DOUBLE - -/* Define this if you have the type long long. */ -#define HAVE_LONG_LONG 1 - -/* Define to 1 if you have the 'lstat' function. */ -#define HAVE_LSTAT 1 - -/* Define this if you have the makedev macro. */ -#undef HAVE_MAKEDEV - -/* Define to 1 if you have the 'memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have the 'mkfifo' function. */ -#undef HAVE_MKFIFO - -/* Define to 1 if you have the 'mknod' function. */ -#undef HAVE_MKNOD - -/* Define to 1 if you have the 'mktime' function. */ -#define HAVE_MKTIME 1 - -/* Define to 1 if you have the 'mmap' function. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the 'mremap' function. */ -#undef HAVE_MREMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_NCURSES_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. */ -#undef HAVE_NDIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_NETPACKET_PACKET_H - -/* Define to 1 if you have the 'nice' function. */ -#undef HAVE_NICE - -/* Define to 1 if you have the 'openpty' function. */ -#undef HAVE_OPENPTY - -/* Define if compiling using MacOS X 10.5 SDK or later. */ -#undef HAVE_OSX105_SDK - -/* Define to 1 if you have the 'pathconf' function. */ -#undef HAVE_PATHCONF - -/* Define to 1 if you have the 'pause' function. */ -#undef HAVE_PAUSE - -/* Define to 1 if you have the 'plock' function. */ -#undef HAVE_PLOCK - -/* Define to 1 if you have the 'poll' function. */ -#define HAVE_POLL 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_POLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_PROCESS_H - -/* Define if your compiler supports function prototype */ -#define HAVE_PROTOTYPES 1 - -/* Define if you have GNU PTH threads. */ -#undef HAVE_PTH - -/* Define to 1 if you have the 'pthread_atfork' function. */ -#undef HAVE_PTHREAD_ATFORK - -/* Defined for Solaris 2.6 bug in pthread header. */ -#undef HAVE_PTHREAD_DESTRUCTOR - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTHREAD_H - -/* Define to 1 if you have the 'pthread_init' function. */ -#undef HAVE_PTHREAD_INIT - -/* Define to 1 if you have the 'pthread_sigmask' function. */ -#undef HAVE_PTHREAD_SIGMASK - -/* Define to 1 if you have the header file. */ -#undef HAVE_PTY_H - -/* Define to 1 if you have the 'putenv' function. */ -#undef HAVE_PUTENV - -/* Define if the libcrypto has RAND_egd */ -#undef HAVE_RAND_EGD - -/* Define to 1 if you have the 'readlink' function. */ -#undef HAVE_READLINK - -/* Define to 1 if you have the 'realpath' function. */ -#define HAVE_REALPATH 1 - -/* Define if you have readline 2.1 */ -#undef HAVE_RL_CALLBACK - -/* Define if you can turn off readline's signal handling. */ -#undef HAVE_RL_CATCH_SIGNAL - -/* Define if you have readline 2.2 */ -#undef HAVE_RL_COMPLETION_APPEND_CHARACTER - -/* Define if you have readline 4.0 */ -#undef HAVE_RL_COMPLETION_DISPLAY_MATCHES_HOOK - -/* Define if you have readline 4.2 */ -#undef HAVE_RL_COMPLETION_MATCHES - -/* Define if you have rl_completion_suppress_append */ -#undef HAVE_RL_COMPLETION_SUPPRESS_APPEND - -/* Define if you have readline 4.0 */ -#undef HAVE_RL_PRE_INPUT_HOOK - -/* Define to 1 if you have the 'round' function. */ -#undef HAVE_ROUND - -/* Define to 1 if you have the 'select' function. */ -#define HAVE_SELECT 1 - -/* Define to 1 if you have the 'sem_getvalue' function. */ -#undef HAVE_SEM_GETVALUE - -/* Define to 1 if you have the 'sem_open' function. */ -#undef HAVE_SEM_OPEN - -/* Define to 1 if you have the 'sem_timedwait' function. */ -#undef HAVE_SEM_TIMEDWAIT - -/* Define to 1 if you have the 'sem_unlink' function. */ -#undef HAVE_SEM_UNLINK - -/* Define to 1 if you have the 'setegid' function. */ -#undef HAVE_SETEGID - -/* Define to 1 if you have the 'seteuid' function. */ -#undef HAVE_SETEUID - -/* Define to 1 if you have the 'setgid' function. */ -#undef HAVE_SETGID - -/* Define if you have the 'setgroups' function. */ -#undef HAVE_SETGROUPS - -/* Define to 1 if you have the 'setitimer' function. */ -#undef HAVE_SETITIMER - -/* Define to 1 if you have the 'setlocale' function. */ -#define HAVE_SETLOCALE 1 - -/* Define to 1 if you have the 'setpgid' function. */ -#undef HAVE_SETPGID - -/* Define to 1 if you have the 'setpgrp' function. */ -#undef HAVE_SETPGRP - -/* Define to 1 if you have the 'setregid' function. */ -#undef HAVE_SETREGID - -/* Define to 1 if you have the 'setresgid' function. */ -#undef HAVE_SETRESGID - -/* Define to 1 if you have the 'setresuid' function. */ -#undef HAVE_SETRESUID - -/* Define to 1 if you have the 'setreuid' function. */ -#undef HAVE_SETREUID - -/* Define to 1 if you have the 'setsid' function. */ -#undef HAVE_SETSID - -/* Define to 1 if you have the 'setuid' function. */ -#undef HAVE_SETUID - -/* Define to 1 if you have the 'setvbuf' function. */ -#define HAVE_SETVBUF 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SHADOW_H - -/* Define to 1 if you have the 'sigaction' function. */ -#undef HAVE_SIGACTION - -/* Define to 1 if you have the 'siginterrupt' function. */ -#undef HAVE_SIGINTERRUPT - -/* Define to 1 if you have the header file. */ -#define HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the 'sigrelse' function. */ -#undef HAVE_SIGRELSE - -/* Define to 1 if you have the 'snprintf' function. */ -#define HAVE_SNPRINTF 1 - -/* Define if sockaddr has sa_len member */ -#undef HAVE_SOCKADDR_SA_LEN - -/* struct sockaddr_storage (sys/socket.h) */ -#undef HAVE_SOCKADDR_STORAGE - -/* Define if you have the 'socketpair' function. */ -#undef HAVE_SOCKETPAIR - -/* Define to 1 if you have the header file. */ -#undef HAVE_SPAWN_H - -/* Define if your compiler provides ssize_t */ -#define HAVE_SSIZE_T 1 - -/* Define to 1 if you have the 'statvfs' function. */ -#undef HAVE_STATVFS - -/* Define if you have struct stat.st_mtim.tv_nsec */ -#undef HAVE_STAT_TV_NSEC - -/* Define if you have struct stat.st_mtimensec */ -#undef HAVE_STAT_TV_NSEC2 - -/* Define if your compiler supports variable length function prototypes (e.g. - void fprintf(FILE *, char *, ...);) *and* */ -#define HAVE_STDARG_PROTOTYPES 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the 'strdup' function. */ -#define HAVE_STRDUP 1 - -/* Define to 1 if you have the 'strftime' function. */ -#define HAVE_STRFTIME 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_STROPTS_H - -/* Define to 1 if 'st_birthtime' is a member of 'struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 - -/* Define to 1 if 'st_blksize' is a member of 'struct stat'. */ -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 - -/* Define to 1 if 'st_blocks' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_BLOCKS - -/* Define to 1 if 'st_flags' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_FLAGS - -/* Define to 1 if 'st_gen' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_GEN - -/* Define to 1 if 'st_rdev' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_RDEV - -/* Define to 1 if 'st_dev' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_DEV - -/* Define to 1 if 'st_ino' is a member of 'struct stat'. */ -#undef HAVE_STRUCT_STAT_ST_INO - -/* Define to 1 if 'tm_zone' is a member of 'struct tm'. */ -#undef HAVE_STRUCT_TM_TM_ZONE - -/* Define to 1 if your 'struct stat' has 'st_blocks'. Deprecated, use - 'HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ -#undef HAVE_ST_BLOCKS - -/* Define if you have the 'symlink' function. */ -#undef HAVE_SYMLINK - -/* Define to 1 if you have the 'sysconf' function. */ -#undef HAVE_SYSCONF - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYSEXITS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_AUDIOIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_BSDTTY_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. - */ -#undef HAVE_SYS_DIR_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EPOLL_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_EVENT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_FILE_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LOADAVG_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_LOCK_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MKDEV_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_MODEM_H - -/* Define to 1 if you have the header file, and it defines 'DIR'. - */ -#undef HAVE_SYS_NDIR_H - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_RESOURCE_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_SOCKET_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STATVFS_H - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TERMIO_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TIMES_H - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_UTSNAME_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_WAIT_H - -/* Define to 1 if you have the system() command. */ -#define HAVE_SYSTEM 1 - -/* Define to 1 if you have the 'tcgetpgrp' function. */ -#undef HAVE_TCGETPGRP - -/* Define to 1 if you have the 'tcsetpgrp' function. */ -#undef HAVE_TCSETPGRP - -/* Define to 1 if you have the 'tempnam' function. */ -#define HAVE_TEMPNAM 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERMIOS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_TERM_H - -/* Define to 1 if you have the 'tgamma' function. */ -#undef HAVE_TGAMMA - -/* Define to 1 if you have the header file. */ -#undef HAVE_THREAD_H - -/* Define to 1 if you have the 'timegm' function. */ -#undef HAVE_TIMEGM - -/* Define to 1 if you have the 'times' function. */ -#undef HAVE_TIMES - -/* Define to 1 if you have the 'tmpfile' function. */ -#define HAVE_TMPFILE 1 - -/* Define to 1 if you have the 'tmpnam' function. */ -#define HAVE_TMPNAM 1 - -/* Define to 1 if you have the 'tmpnam_r' function. */ -#undef HAVE_TMPNAM_R - -/* Define to 1 if your 'struct tm' has 'tm_zone'. Deprecated, use - 'HAVE_STRUCT_TM_TM_ZONE' instead. */ -#undef HAVE_TM_ZONE - -/* Define to 1 if you have the 'truncate' function. */ -#undef HAVE_TRUNCATE - -/* Define to 1 if you don't have 'tm_zone' but do have the external array - 'tzname'. */ -#undef HAVE_TZNAME - -/* Define this if you have tcl and TCL_UTF_MAX==6 */ -#undef HAVE_UCS4_TCL - -/* Define if your compiler provides uint32_t. */ -#undef HAVE_UINT32_T - -/* Define if your compiler provides uint64_t. */ -#undef HAVE_UINT64_T - -/* Define to 1 if the system has the type 'uintptr_t'. */ -#define HAVE_UINTPTR_T 1 - -/* Define to 1 if you have the 'uname' function. */ -#undef HAVE_UNAME - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to 1 if you have the 'unsetenv' function. */ -#undef HAVE_UNSETENV - -/* Define if you have a useable wchar_t type defined in wchar.h; useable means - wchar_t must be an unsigned type with at least 16 bits. (see - Include/unicodeobject.h). */ -#define HAVE_USABLE_WCHAR_T 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_UTIL_H - -/* Define to 1 if you have the 'utimes' function. */ -#undef HAVE_UTIMES - -/* Define to 1 if you have the header file. */ -#define HAVE_UTIME_H 1 - -/* Define to 1 if you have the 'wait3' function. */ -#undef HAVE_WAIT3 - -/* Define to 1 if you have the 'wait4' function. */ -#undef HAVE_WAIT4 - -/* Define to 1 if you have the 'waitpid' function. */ -#undef HAVE_WAITPID - -/* Define if the compiler provides a wchar.h header file. */ -#define HAVE_WCHAR_H 1 - -/* Define to 1 if you have the 'wcscoll' function. */ -#define HAVE_WCSCOLL 1 - -/* Define if tzset() actually switches the local timezone in a meaningful way. - */ -#undef HAVE_WORKING_TZSET - -/* Define if the zlib library has inflateCopy */ -#undef HAVE_ZLIB_COPY - -/* Define to 1 if you have the '_getpty' function. */ -#undef HAVE__GETPTY - -/* Define if you are using Mach cthreads directly under /include */ -#undef HURD_C_THREADS - -/* Define if you are using Mach cthreads under mach / */ -#undef MACH_C_THREADS - -/* Define to 1 if 'major', 'minor', and 'makedev' are declared in . - */ -#undef MAJOR_IN_MKDEV - -/* Define to 1 if 'major', 'minor', and 'makedev' are declared in - . */ -#undef MAJOR_IN_SYSMACROS - -/* Define if mvwdelch in curses.h is an expression. */ -#undef MVWDELCH_IS_EXPRESSION - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "edk2-devel@lists.01.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "EDK II Python 2.7.10 Package" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "EDK II Python 2.7.10 Package V0.1" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "EADK_Python" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "http://www.tianocore.org/" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "V0.1" - -/* Define if POSIX semaphores aren't enabled on your system */ -#define POSIX_SEMAPHORES_NOT_ENABLED 1 - -/* Defined if PTHREAD_SCOPE_SYSTEM supported. */ -#undef PTHREAD_SYSTEM_SCHED_SUPPORTED - -/* Define as the preferred size in bits of long digits */ -#undef PYLONG_BITS_IN_DIGIT - -/* Define to printf format modifier for long long type */ -#define PY_FORMAT_LONG_LONG "ll" - -/* Define to printf format modifier for Py_ssize_t */ -#define PY_FORMAT_SIZE_T "z" - -/* Define as the integral type used for Unicode representation. */ -#define PY_UNICODE_TYPE wchar_t - -/* Define if you want to build an interpreter with many run-time checks. */ -#undef Py_DEBUG - -/* Defined if Python is built as a shared library. */ -#undef Py_ENABLE_SHARED - -/* Define as the size of the unicode type. */ -#define Py_UNICODE_SIZE 2 - -/* Define if you want to have a Unicode type. */ -#define Py_USING_UNICODE - -/* assume C89 semantics that RETSIGTYPE is always void */ -#undef RETSIGTYPE - -/* Define if setpgrp() must be called as setpgrp(0, 0). */ -#undef SETPGRP_HAVE_ARG - -/* Define this to be extension of shared libraries (including the dot!). */ -#undef SHLIB_EXT - -/* Define if i>>j for signed int i does not extend the sign bit when i < 0 */ -#undef SIGNED_RIGHT_SHIFT_ZERO_FILLS - -/* The size of 'double', as computed by sizeof. */ -#define SIZEOF_DOUBLE 8 - -/* The size of 'float', as computed by sizeof. */ -#define SIZEOF_FLOAT 4 - -/* The size of 'fpos_t', as computed by sizeof. */ -#define SIZEOF_FPOS_T 8 - -/* The size of 'int', as computed by sizeof. */ -#define SIZEOF_INT 4 - -/* The size of 'long', as computed by sizeof. */ -#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ -#define SIZEOF_LONG 4 -#else -#define SIZEOF_LONG 8 -#endif - -/* The size of 'long double', as computed by sizeof. */ -#undef SIZEOF_LONG_DOUBLE - -/* The size of 'long long', as computed by sizeof. */ -#define SIZEOF_LONG_LONG 8 - -/* The size of 'off_t', as computed by sizeof. */ -#define SIZEOF_OFF_T 8 - -/* The size of 'pid_t', as computed by sizeof. */ -#define SIZEOF_PID_T 4 - -/* The size of 'pthread_t', as computed by sizeof. */ -#undef SIZEOF_PTHREAD_T - -/* The size of 'short', as computed by sizeof. */ -#define SIZEOF_SHORT 2 - -/* The size of 'size_t', as computed by sizeof. */ -#define SIZEOF_SIZE_T 8 - -/* The size of 'time_t', as computed by sizeof. */ -#define SIZEOF_TIME_T 4 - -/* The size of 'uintptr_t', as computed by sizeof. */ -#define SIZEOF_UINTPTR_T 8 - -/* The size of 'void *', as computed by sizeof. */ -#define SIZEOF_VOID_P 8 - -/* The size of 'wchar_t', as computed by sizeof. */ -#define SIZEOF_WCHAR_T 2 - -/* The size of '_Bool', as computed by sizeof. */ -#define SIZEOF__BOOL 1 - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and - (which you can't on SCO ODT 3.0). */ -#undef SYS_SELECT_WITH_SYS_TIME - -/* Define if tanh(-0.) is -0., or if platform doesn't have signed zeros */ -#undef TANH_PRESERVES_ZERO_SIGN - -/* Define to 1 if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME - -/* Define to 1 if your declares 'struct tm'. */ -#undef TM_IN_SYS_TIME - -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# undef _ALL_SOURCE -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# undef _GNU_SOURCE -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# undef _POSIX_PTHREAD_SEMANTICS -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# undef _TANDEM_SOURCE -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# undef __EXTENSIONS__ -#endif - - -/* Define if you want to use MacPython modules on MacOSX in unix-Python. */ -#undef USE_TOOLBOX_OBJECT_GLUE - -/* Define if a va_list is an array of some kind */ -#undef VA_LIST_IS_ARRAY - -/* Define if you want SIGFPE handled (see Include/pyfpe.h). */ -#undef WANT_SIGFPE_HANDLER - -/* Define if you want wctype.h functions to be used instead of the one - supplied by Python itself. (see Include/unicodectype.h). */ -#define WANT_WCTYPE_FUNCTIONS 1 - -/* Define if WINDOW in curses.h offers a field _flags. */ -#undef WINDOW_HAS_FLAGS - -/* Define if you want documentation strings in extension modules */ -#undef WITH_DOC_STRINGS - -/* Define if you want to use the new-style (Openstep, Rhapsody, MacOS) dynamic - linker (dyld) instead of the old-style (NextStep) dynamic linker (rld). - Dyld is necessary to support frameworks. */ -#undef WITH_DYLD - -/* Define to 1 if libintl is needed for locale functions. */ -#undef WITH_LIBINTL - -/* Define if you want to produce an OpenStep/Rhapsody framework (shared - library plus accessory files). */ -#undef WITH_NEXT_FRAMEWORK - -/* Define if you want to compile in Python-specific mallocs */ -#undef WITH_PYMALLOC - -/* Define if you want to compile in rudimentary thread support */ -#undef WITH_THREAD - -/* Define to profile with the Pentium timestamp counter */ -#undef WITH_TSC - -/* Define if you want pymalloc to be disabled when running under valgrind */ -#undef WITH_VALGRIND - -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most - significant byte first (like Motorola and SPARC, unlike Intel). */ -#if defined AC_APPLE_UNIVERSAL_BUILD -# if defined __BIG_ENDIAN__ -# define WORDS_BIGENDIAN 1 -# endif -#else -# ifndef WORDS_BIGENDIAN -# undef WORDS_BIGENDIAN -# endif -#endif - -/* Define if arithmetic is subject to x87-style double rounding issue */ -#undef X87_DOUBLE_ROUNDING - -/* Define on OpenBSD to activate all library features */ -#undef _BSD_SOURCE - -/* Define on Irix to enable u_int */ -#undef _BSD_TYPES - -/* Define on Darwin to activate all library features */ -#undef _DARWIN_C_SOURCE - -/* This must be set to 64 on some systems to enable large file support. */ -#undef _FILE_OFFSET_BITS - -/* Define on Linux to activate all library features */ -#undef _GNU_SOURCE - -/* This must be defined on some systems to enable large file support. */ -#undef _LARGEFILE_SOURCE - -/* This must be defined on AIX systems to enable large file support. */ -#undef _LARGE_FILES - -/* Define to 1 if on MINIX. */ -#undef _MINIX - -/* Define on NetBSD to activate all library features */ -#define _NETBSD_SOURCE 1 - -/* Define _OSF_SOURCE to get the makedev macro. */ -#undef _OSF_SOURCE - -/* Define to 2 if the system does not provide POSIX.1 features except with - this defined. */ -#undef _POSIX_1_SOURCE - -/* Define to activate features from IEEE Stds 1003.1-2001 */ -#undef _POSIX_C_SOURCE - -/* Define to 1 if you need to in order for 'stat' and other things to work. */ -#undef _POSIX_SOURCE - -/* Define if you have POSIX threads, and your system does not define that. */ -#undef _POSIX_THREADS - -/* Define to force use of thread-safe errno, h_errno, and other functions */ -#undef _REENTRANT - -/* Define for Solaris 2.5.1 so the uint32_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT32_T - -/* Define for Solaris 2.5.1 so the uint64_t typedef from , - , or is not used. If the typedef were allowed, the - #define below would cause a syntax error. */ -#undef _UINT64_T - -/* Define to the level of X/Open that your system supports */ -#undef _XOPEN_SOURCE - -/* Define to activate Unix95-and-earlier features */ -#undef _XOPEN_SOURCE_EXTENDED - -/* Define on FreeBSD to activate all library features */ -#undef __BSD_VISIBLE - -/* Define to 1 if type 'char' is unsigned and you are not using gcc. */ -#ifndef __CHAR_UNSIGNED__ -# undef __CHAR_UNSIGNED__ -#endif - -/* Defined on Solaris to see additional function prototypes. */ -#undef __EXTENSIONS__ - -/* Define to 'long' if doesn't define. */ -//#undef clock_t - -/* Define to empty if 'const' does not conform to ANSI C. */ -//#undef const - -/* Define to 'int' if doesn't define. */ -//#undef gid_t - -/* Define to the type of a signed integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -//#undef int32_t - -/* Define to the type of a signed integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -//#undef int64_t - -/* Define to 'int' if does not define. */ -//#undef mode_t - -/* Define to 'long int' if does not define. */ -//#undef off_t - -/* Define to 'int' if does not define. */ -//#undef pid_t - -/* Define to empty if the keyword does not work. */ -//#undef signed - -/* Define to 'unsigned int' if does not define. */ -//#undef size_t - -/* Define to 'int' if does not define. */ -//#undef socklen_t - -/* Define to 'int' if doesn't define. */ -//#undef uid_t - -/* Define to the type of an unsigned integer type of width exactly 32 bits if - such a type exists and the standard includes do not define it. */ -//#undef uint32_t - -/* Define to the type of an unsigned integer type of width exactly 64 bits if - such a type exists and the standard includes do not define it. */ -//#undef uint64_t - -/* Define to empty if the keyword does not work. */ -//#undef volatile - -#endif /*Py_PYCONFIG_H*/ diff --git a/AppPkg/Applications/Python/Python-2.7.10/libprep.bat b/AppPkg/Applications/Python/Python-2.7.10/libprep.bat deleted file mode 100644 index 1204f3c..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/libprep.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off -REM libprep.bat -REM -REM SYNTAX: libprep -REM -SETLOCAL - -set dest=%1 - -echo Copying files to %dest%. -echo Existing files will be overwritten. -echo. -PAUSE - -REM Copy Distro then PyMod files to the destination -XCOPY Lib %dest% /S /I /Y -XCOPY PyMod-2.7.10\Lib %dest% /S /I /Y - -echo DONE -ENDLOCAL diff --git a/AppPkg/Applications/Python/Python-2.7.10/srcprep.bat b/AppPkg/Applications/Python/Python-2.7.10/srcprep.bat deleted file mode 100644 index afd55c1..0000000 --- a/AppPkg/Applications/Python/Python-2.7.10/srcprep.bat +++ /dev/null @@ -1,13 +0,0 @@ -@echo off -REM Prepare the Python sources for EDK II by copying -REM the .h files from the PyMod tree into the Python tree. -REM Directory correspondence is maintained. - -FOR %%d IN (Include Modules Objects Python) DO ( - echo. - echo Processing the %%d directory. - XCOPY /S /Y /Q PyMod-2.7.10\%%d\*.h %%d -) - -echo. -echo DONE! -- 2.32.0.windows.2